From: support Date: Mon, 11 Jul 2022 15:58:12 +0000 (+0000) Subject: Built motion from commit c020b446.|2.6.13 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22avatar.png/%22?a=commitdiff_plain;h=a6d19b8966af2127a8cc5df2ff44d66dfbf645e5;p=motion2.git Built motion from commit c020b446.|2.6.13 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index c74a95d..44b43fa 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-07-11T15:35:31.789Z", + "time": "2022-07-11T15:48:38.324Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 91ae27b..c2e0b91 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-07-11T15:35:31.789Z", + "time": "2022-07-11T15:48:38.324Z", "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 a453325..584201c 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 _0xf0c0=['action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','getDataValue'];(function(_0x79b649,_0x2115b3){var _0x1af9b1=function(_0x153c9f){while(--_0x153c9f){_0x79b649['push'](_0x79b649['shift']());}};_0x1af9b1(++_0x2115b3);}(_0xf0c0,0xee));var _0x0f0c=function(_0x444667,_0x5e25ae){_0x444667=_0x444667-0x0;var _0x4e321c=_0xf0c0[_0x444667];return _0x4e321c;};'use strict';var Sequelize=require('sequelize');module[_0x0f0c('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5abc7e){return this[_0x0f0c('0x1')](_0x0f0c('0x2'));}},'action':{'type':Sequelize[_0x0f0c('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x0f0c('0x4'),_0x0f0c('0x5'),_0x0f0c('0x6'),_0x0f0c('0x7'),_0x0f0c('0x8'),_0x0f0c('0x9'),_0x0f0c('0xa'),_0x0f0c('0xb')]],'msg':_0x0f0c('0xc')}},'comment':_0x0f0c('0xc')},'data1':{'type':Sequelize[_0x0f0c('0x3')](0x1000),'comment':_0x0f0c('0xd')},'data2':{'type':Sequelize[_0x0f0c('0x3')](0x1000),'comment':_0x0f0c('0xe')},'data3':{'type':Sequelize[_0x0f0c('0x3')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x0f0c('0x3')](0x1000),'comments':_0x0f0c('0xf')},'data5':{'type':Sequelize[_0x0f0c('0x3')](0x1000),'comments':_0x0f0c('0x10')},'data6':{'type':Sequelize[_0x0f0c('0x3')],'comments':_0x0f0c('0x11')},'data7':{'type':Sequelize[_0x0f0c('0x12')],'comments':_0x0f0c('0x13')}}; \ No newline at end of file +var _0x4e2e=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','action','STRING','contactManager','integration','jscripty','urlForward','browser','bot'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x4e2e,0x193));var _0xe4e2=function(_0x360e9d,_0x46da5f){_0x360e9d=_0x360e9d-0x0;var _0x5e712c=_0x4e2e[_0x360e9d];return _0x5e712c;};'use strict';var Sequelize=require(_0xe4e2('0x0'));module[_0xe4e2('0x1')]={'name':{'type':Sequelize[_0xe4e2('0x2')],'get':function(_0x3dfbbb){return this['getDataValue'](_0xe4e2('0x3'));}},'action':{'type':Sequelize[_0xe4e2('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xe4e2('0x5'),_0xe4e2('0x6'),'motionbar',_0xe4e2('0x7'),_0xe4e2('0x8'),_0xe4e2('0x9'),_0xe4e2('0xa'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xe4e2('0xb')},'data1':{'type':Sequelize[_0xe4e2('0x4')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0xe4e2('0x4')](0x1000),'comment':_0xe4e2('0xc')},'data3':{'type':Sequelize[_0xe4e2('0x4')](0x1000),'comment':_0xe4e2('0xd')},'data4':{'type':Sequelize[_0xe4e2('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0xe4e2('0x4')](0x1000),'comments':_0xe4e2('0xe')},'data6':{'type':Sequelize[_0xe4e2('0x4')],'comments':_0xe4e2('0xf')},'data7':{'type':Sequelize[_0xe4e2('0x10')],'comments':_0xe4e2('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 2795087..487384d 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 _0xaa72=['sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','json','offset','limit','undefined','count','status','set','reject','save','update','destroy','then','end','sendStatus','stack','name','send','body','find','catch','Action','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x4ff796,_0x2becbf){var _0x443675=function(_0x30c1e5){while(--_0x30c1e5){_0x4ff796['push'](_0x4ff796['shift']());}};_0x443675(++_0x2becbf);}(_0xaa72,0xfb));var _0x2aa7=function(_0xa4bc87,_0x51613c){_0xa4bc87=_0xa4bc87-0x0;var _0x4abdb3=_0xaa72[_0xa4bc87];return _0x4abdb3;};'use strict';var emlformat=require(_0x2aa7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2aa7('0x1'));var jsonpatch=require(_0x2aa7('0x2'));var rp=require(_0x2aa7('0x3'));var moment=require(_0x2aa7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2aa7('0x5'));var util=require(_0x2aa7('0x6'));var path=require('path');var sox=require(_0x2aa7('0x7'));var csv=require(_0x2aa7('0x8'));var ejs=require(_0x2aa7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2aa7('0xa'));var squel=require('squel');var crypto=require(_0x2aa7('0xb'));var jsforce=require(_0x2aa7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2aa7('0x8'));var querystring=require(_0x2aa7('0xd'));var Papa=require(_0x2aa7('0xe'));var Redis=require(_0x2aa7('0xf'));var authService=require(_0x2aa7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2aa7('0x11'));var hardwareService=require(_0x2aa7('0x12'));var logger=require(_0x2aa7('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x2aa7('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2aa7('0x15'))['db'];function respondWithStatusCode(_0x55b6ea,_0x29ceb8){_0x29ceb8=_0x29ceb8||0xcc;return function(_0x407303){if(_0x407303){return _0x55b6ea['sendStatus'](_0x29ceb8);}return _0x55b6ea['status'](_0x29ceb8)['end']();};}function respondWithResult(_0x33b983,_0x5c59d9){_0x5c59d9=_0x5c59d9||0xc8;return function(_0x41cd86){if(_0x41cd86){return _0x33b983['status'](_0x5c59d9)[_0x2aa7('0x16')](_0x41cd86);}};}function respondWithFilteredResult(_0xd6d063,_0x409fa6){return function(_0x48b074){if(_0x48b074){var _0x46ba76=typeof _0x409fa6[_0x2aa7('0x17')]==='undefined'&&typeof _0x409fa6[_0x2aa7('0x18')]===_0x2aa7('0x19');var _0x925211=_0x48b074[_0x2aa7('0x1a')];var _0x4cc172=_0x46ba76?0x0:_0x409fa6[_0x2aa7('0x17')];var _0x2ca136=_0x46ba76?_0x48b074[_0x2aa7('0x1a')]:_0x409fa6[_0x2aa7('0x17')]+_0x409fa6['limit'];var _0x2a3927;if(_0x2ca136>=_0x925211){_0x2ca136=_0x925211;_0x2a3927=0xc8;}else{_0x2a3927=0xce;}_0xd6d063[_0x2aa7('0x1b')](_0x2a3927);return _0xd6d063[_0x2aa7('0x1c')]('Content-Range',_0x4cc172+'-'+_0x2ca136+'/'+_0x925211)[_0x2aa7('0x16')](_0x48b074);}return null;};}function patchUpdates(_0xe3149a){return function(_0x35728e){try{jsonpatch['apply'](_0x35728e,_0xe3149a,!![]);}catch(_0x4aa47e){return BPromise[_0x2aa7('0x1d')](_0x4aa47e);}return _0x35728e[_0x2aa7('0x1e')]();};}function saveUpdates(_0xef1a58,_0xd9fd14){return function(_0xc8708b){if(_0xc8708b){return _0xc8708b[_0x2aa7('0x1f')](_0xef1a58)['then'](function(_0x25c4ec){return _0x25c4ec;});}return null;};}function removeEntity(_0x3a53,_0x568b38){return function(_0x7c9515){if(_0x7c9515){return _0x7c9515[_0x2aa7('0x20')]()[_0x2aa7('0x21')](function(){_0x3a53[_0x2aa7('0x1b')](0xcc)[_0x2aa7('0x22')]();});}};}function handleEntityNotFound(_0x5ba997,_0x410c7d){return function(_0x195a81){if(!_0x195a81){_0x5ba997[_0x2aa7('0x23')](0x194);}return _0x195a81;};}function handleError(_0x53042c,_0x2bc72b){_0x2bc72b=_0x2bc72b||0x1f4;return function(_0x3410a3){logger['error'](_0x3410a3[_0x2aa7('0x24')]);if(_0x3410a3[_0x2aa7('0x25')]){delete _0x3410a3[_0x2aa7('0x25')];}_0x53042c['status'](_0x2bc72b)[_0x2aa7('0x26')](_0x3410a3);};}exports['update']=function(_0x2d2ac6,_0x5c6a00){if(_0x2d2ac6[_0x2aa7('0x27')]['id']){delete _0x2d2ac6[_0x2aa7('0x27')]['id'];}return db['Action'][_0x2aa7('0x28')]({'where':{'id':_0x2d2ac6['params']['id']}})[_0x2aa7('0x21')](handleEntityNotFound(_0x5c6a00,null))['then'](saveUpdates(_0x2d2ac6[_0x2aa7('0x27')],null))[_0x2aa7('0x21')](respondWithResult(_0x5c6a00,null))[_0x2aa7('0x29')](handleError(_0x5c6a00,null));};exports[_0x2aa7('0x20')]=function(_0x3237b2,_0x4a858d){return db[_0x2aa7('0x2a')][_0x2aa7('0x28')]({'where':{'id':_0x3237b2['params']['id']}})[_0x2aa7('0x21')](handleEntityNotFound(_0x4a858d,null))[_0x2aa7('0x21')](removeEntity(_0x4a858d,null))[_0x2aa7('0x29')](handleError(_0x4a858d,null));}; \ No newline at end of file +var _0xe2a3=['../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','save','update','then','destroy','error','name','send','body','find','params','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x2411c8,_0x2420b0){var _0x52a5d6=function(_0x251f77){while(--_0x251f77){_0x2411c8['push'](_0x2411c8['shift']());}};_0x52a5d6(++_0x2420b0);}(_0xe2a3,0xcf));var _0x3e2a=function(_0x336d54,_0x4cb876){_0x336d54=_0x336d54-0x0;var _0x571a8d=_0xe2a3[_0x336d54];return _0x571a8d;};'use strict';var emlformat=require(_0x3e2a('0x0'));var rimraf=require(_0x3e2a('0x1'));var zipdir=require(_0x3e2a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3e2a('0x3'));var moment=require(_0x3e2a('0x4'));var BPromise=require(_0x3e2a('0x5'));var Mustache=require(_0x3e2a('0x6'));var util=require(_0x3e2a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x3e2a('0x8'));var ejs=require(_0x3e2a('0x9'));var fs=require('fs');var fs_extra=require(_0x3e2a('0xa'));var _=require('lodash');var squel=require(_0x3e2a('0xb'));var crypto=require('crypto');var jsforce=require(_0x3e2a('0xc'));var deskjs=require(_0x3e2a('0xd'));var toCsv=require(_0x3e2a('0x8'));var querystring=require(_0x3e2a('0xe'));var Papa=require(_0x3e2a('0xf'));var Redis=require(_0x3e2a('0x10'));var authService=require(_0x3e2a('0x11'));var qs=require(_0x3e2a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e2a('0x13'));var logger=require('../../config/logger')(_0x3e2a('0x14'));var utils=require(_0x3e2a('0x15'));var config=require(_0x3e2a('0x16'));var licenseUtil=require(_0x3e2a('0x17'));var db=require(_0x3e2a('0x18'))['db'];function respondWithStatusCode(_0x3fdb2f,_0x6c53af){_0x6c53af=_0x6c53af||0xcc;return function(_0x2905ea){if(_0x2905ea){return _0x3fdb2f[_0x3e2a('0x19')](_0x6c53af);}return _0x3fdb2f[_0x3e2a('0x1a')](_0x6c53af)[_0x3e2a('0x1b')]();};}function respondWithResult(_0x951fd6,_0x467c6a){_0x467c6a=_0x467c6a||0xc8;return function(_0x2f08dd){if(_0x2f08dd){return _0x951fd6['status'](_0x467c6a)[_0x3e2a('0x1c')](_0x2f08dd);}};}function respondWithFilteredResult(_0x23529f,_0x3c6481){return function(_0x4d80f9){if(_0x4d80f9){var _0x32c457=typeof _0x3c6481['offset']==='undefined'&&typeof _0x3c6481[_0x3e2a('0x1d')]==='undefined';var _0x5bfbad=_0x4d80f9[_0x3e2a('0x1e')];var _0x5e1e39=_0x32c457?0x0:_0x3c6481[_0x3e2a('0x1f')];var _0x45a81c=_0x32c457?_0x4d80f9[_0x3e2a('0x1e')]:_0x3c6481[_0x3e2a('0x1f')]+_0x3c6481[_0x3e2a('0x1d')];var _0x11ea06;if(_0x45a81c>=_0x5bfbad){_0x45a81c=_0x5bfbad;_0x11ea06=0xc8;}else{_0x11ea06=0xce;}_0x23529f[_0x3e2a('0x1a')](_0x11ea06);return _0x23529f['set'](_0x3e2a('0x20'),_0x5e1e39+'-'+_0x45a81c+'/'+_0x5bfbad)[_0x3e2a('0x1c')](_0x4d80f9);}return null;};}function patchUpdates(_0x3e61ca){return function(_0x415184){try{jsonpatch[_0x3e2a('0x21')](_0x415184,_0x3e61ca,!![]);}catch(_0x1db91a){return BPromise['reject'](_0x1db91a);}return _0x415184[_0x3e2a('0x22')]();};}function saveUpdates(_0x5b1036,_0x5c8af2){return function(_0x37b3f8){if(_0x37b3f8){return _0x37b3f8[_0x3e2a('0x23')](_0x5b1036)[_0x3e2a('0x24')](function(_0x3d8307){return _0x3d8307;});}return null;};}function removeEntity(_0x75f86,_0x55a7a3){return function(_0x443df5){if(_0x443df5){return _0x443df5[_0x3e2a('0x25')]()[_0x3e2a('0x24')](function(){_0x75f86[_0x3e2a('0x1a')](0xcc)[_0x3e2a('0x1b')]();});}};}function handleEntityNotFound(_0x2115d8,_0x224ca5){return function(_0x178f3b){if(!_0x178f3b){_0x2115d8['sendStatus'](0x194);}return _0x178f3b;};}function handleError(_0x14dcd0,_0x37926d){_0x37926d=_0x37926d||0x1f4;return function(_0x4bb697){logger[_0x3e2a('0x26')](_0x4bb697['stack']);if(_0x4bb697[_0x3e2a('0x27')]){delete _0x4bb697['name'];}_0x14dcd0[_0x3e2a('0x1a')](_0x37926d)[_0x3e2a('0x28')](_0x4bb697);};}exports['update']=function(_0x72e1e4,_0x365ef6){if(_0x72e1e4[_0x3e2a('0x29')]['id']){delete _0x72e1e4[_0x3e2a('0x29')]['id'];}return db['Action'][_0x3e2a('0x2a')]({'where':{'id':_0x72e1e4[_0x3e2a('0x2b')]['id']}})[_0x3e2a('0x24')](handleEntityNotFound(_0x365ef6,null))[_0x3e2a('0x24')](saveUpdates(_0x72e1e4['body'],null))[_0x3e2a('0x24')](respondWithResult(_0x365ef6,null))[_0x3e2a('0x2c')](handleError(_0x365ef6,null));};exports[_0x3e2a('0x25')]=function(_0x541706,_0x304f23){return db['Action'][_0x3e2a('0x2a')]({'where':{'id':_0x541706[_0x3e2a('0x2b')]['id']}})[_0x3e2a('0x24')](handleEntityNotFound(_0x304f23,null))[_0x3e2a('0x24')](removeEntity(_0x304f23,null))[_0x3e2a('0x2c')](handleError(_0x304f23,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index fe2662e..b86e6c4 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 _0x0e90=['Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x43f85a,_0x138349){var _0x1d00ff=function(_0x54ca33){while(--_0x54ca33){_0x43f85a['push'](_0x43f85a['shift']());}};_0x1d00ff(++_0x138349);}(_0x0e90,0x176));var _0x00e9=function(_0xb74595,_0xbb6311){_0xb74595=_0xb74595-0x0;var _0x2c207d=_0x0e90[_0xb74595];return _0x2c207d;};'use strict';var _=require(_0x00e9('0x0'));var util=require(_0x00e9('0x1'));var logger=require(_0x00e9('0x2'))(_0x00e9('0x3'));var moment=require(_0x00e9('0x4'));var BPromise=require(_0x00e9('0x5'));var rp=require(_0x00e9('0x6'));var fs=require('fs');var path=require(_0x00e9('0x7'));var rimraf=require(_0x00e9('0x8'));var config=require('../../config/environment');var attributes=require('./action.attributes');module[_0x00e9('0x9')]=function(_0x2d2847,_0xe4595f){return _0x2d2847['define'](_0x00e9('0xa'),attributes,{'tableName':_0x00e9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8188=['bluebird','rimraf','../../config/environment','./action.attributes','exports','tools_actions','lodash','moment'];(function(_0x53e93c,_0x178b88){var _0x5287e9=function(_0x3fb4a9){while(--_0x3fb4a9){_0x53e93c['push'](_0x53e93c['shift']());}};_0x5287e9(++_0x178b88);}(_0x8188,0x76));var _0x8818=function(_0x984bd4,_0x34cebf){_0x984bd4=_0x984bd4-0x0;var _0x511209=_0x8188[_0x984bd4];return _0x511209;};'use strict';var _=require(_0x8818('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x8818('0x1'));var BPromise=require(_0x8818('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8818('0x3'));var config=require(_0x8818('0x4'));var attributes=require(_0x8818('0x5'));module[_0x8818('0x6')]=function(_0x1aa6fd,_0xee42fa){return _0x1aa6fd['define']('Action',attributes,{'tableName':_0x8818('0x7'),'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 55b97c8..a7aa60a 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(_0x3b6dd0,_0x506087){var _0x3c9143=function(_0xf00c58){while(--_0xf00c58){_0x3b6dd0['push'](_0x3b6dd0['shift']());}};_0x3c9143(++_0x506087);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0x5fc3[_0x4b7b69];return _0x173b4c;};'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 _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x4975,0x86));var _0x5497=function(_0x56f019,_0x1f6d1c){_0x56f019=_0x56f019-0x0;var _0x1f7360=_0x4975[_0x56f019];return _0x1f7360;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('Action,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 0e21980..38c2b06 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 _0x93f1=['put','/:id','isAuthenticated','update','destroy','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller'];(function(_0x47159c,_0x1c8216){var _0x454dbe=function(_0x2b54f7){while(--_0x2b54f7){_0x47159c['push'](_0x47159c['shift']());}};_0x454dbe(++_0x1c8216);}(_0x93f1,0x17e));var _0x193f=function(_0x103872,_0x110c3b){_0x103872=_0x103872-0x0;var _0x2ac4bb=_0x93f1[_0x103872];return _0x2ac4bb;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x193f('0x0'));var express=require(_0x193f('0x1'));var router=express[_0x193f('0x2')]();var fs_extra=require(_0x193f('0x3'));var auth=require(_0x193f('0x4'));var interaction=require(_0x193f('0x5'));var config=require(_0x193f('0x6'));var controller=require(_0x193f('0x7'));router[_0x193f('0x8')](_0x193f('0x9'),auth[_0x193f('0xa')](),controller[_0x193f('0xb')]);router['delete'](_0x193f('0x9'),auth['isAuthenticated'](),controller[_0x193f('0xc')]);module['exports']=router; \ No newline at end of file +var _0xeaff=['isAuthenticated','update','delete','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','put','/:id'];(function(_0x18aaee,_0x5a8edb){var _0x18610b=function(_0x33701b){while(--_0x33701b){_0x18aaee['push'](_0x18aaee['shift']());}};_0x18610b(++_0x5a8edb);}(_0xeaff,0x1bf));var _0xfeaf=function(_0xd4401f,_0x14b5aa){_0xd4401f=_0xd4401f-0x0;var _0x3ae46d=_0xeaff[_0xd4401f];return _0x3ae46d;};'use strict';var multer=require(_0xfeaf('0x0'));var util=require(_0xfeaf('0x1'));var path=require('path');var timeout=require(_0xfeaf('0x2'));var express=require(_0xfeaf('0x3'));var router=express[_0xfeaf('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfeaf('0x5'));var config=require(_0xfeaf('0x6'));var controller=require('./action.controller');router[_0xfeaf('0x7')](_0xfeaf('0x8'),auth[_0xfeaf('0x9')](),controller[_0xfeaf('0xa')]);router[_0xfeaf('0xb')](_0xfeaf('0x8'),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 b20b52c..d044306 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 _0x1883=['exports','STRING','TEXT','sequelize'];(function(_0x4c4774,_0x38d7ea){var _0x3e181e=function(_0x1d39be){while(--_0x1d39be){_0x4c4774['push'](_0x4c4774['shift']());}};_0x3e181e(++_0x38d7ea);}(_0x1883,0xab));var _0x3188=function(_0x25af3a,_0x4b9989){_0x25af3a=_0x25af3a-0x0;var _0x1d012b=_0x1883[_0x25af3a];return _0x1d012b;};'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 _0x207c=['STRING','TEXT','exports'];(function(_0x4e2510,_0x448f46){var _0x4aa6c0=function(_0x4a6483){while(--_0x4a6483){_0x4e2510['push'](_0x4e2510['shift']());}};_0x4aa6c0(++_0x448f46);}(_0x207c,0x1e8));var _0xc207=function(_0x4c5e74,_0x319d00){_0x4c5e74=_0x4c5e74-0x0;var _0x48b7f6=_0x207c[_0x4c5e74];return _0x48b7f6;};'use strict';var Sequelize=require('sequelize');module[_0xc207('0x0')]={'name':{'type':Sequelize[_0xc207('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc207('0x1')]},'parent':{'type':Sequelize[_0xc207('0x1')]},'table':{'type':Sequelize[_0xc207('0x1')]},'conditions':{'type':Sequelize[_0xc207('0x2')]},'joins':{'type':Sequelize[_0xc207('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 0fb9a85..0fd3984 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 _0xbf06=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','condition','value','ValidationErrorItem','AnalyticMetric','findAll','keyBy','from','table','MetricId','metric','field','function','replace','format','groupBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','join','COUNT(DISTINCT\x20%s)','AVG(%s)','operator','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','select','orderBy','parse','web','fullPath','%s-%s.%s','randomstring','generate','output','csv','AnalyticExtractedReport','cdr','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','COUNT(*)','SELECT','QueryTypes','run','runReport','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','json','offset','undefined','count','limit','set','apply','save','update','then','get','CustomReports','UserProfileResource','destroy','end','sendStatus','error','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','params','intersection','find','create','body','user'];(function(_0x30319a,_0x2bd28c){var _0x5039a8=function(_0x15d91e){while(--_0x15d91e){_0x30319a['push'](_0x30319a['shift']());}};_0x5039a8(++_0x2bd28c);}(_0xbf06,0x101));var _0x6bf0=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xbf06[_0x297fd3];return _0x2af381;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6bf0('0x0'));var zipdir=require(_0x6bf0('0x1'));var jsonpatch=require(_0x6bf0('0x2'));var rp=require(_0x6bf0('0x3'));var moment=require(_0x6bf0('0x4'));var BPromise=require(_0x6bf0('0x5'));var Mustache=require(_0x6bf0('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6bf0('0x7'));var csv=require(_0x6bf0('0x8'));var ejs=require(_0x6bf0('0x9'));var fs=require('fs');var fs_extra=require(_0x6bf0('0xa'));var _=require('lodash');var squel=require(_0x6bf0('0xb'));var crypto=require(_0x6bf0('0xc'));var jsforce=require(_0x6bf0('0xd'));var deskjs=require(_0x6bf0('0xe'));var toCsv=require(_0x6bf0('0x8'));var querystring=require('querystring');var Papa=require(_0x6bf0('0xf'));var Redis=require(_0x6bf0('0x10'));var authService=require(_0x6bf0('0x11'));var qs=require(_0x6bf0('0x12'));var as=require(_0x6bf0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6bf0('0x14'));var utils=require(_0x6bf0('0x15'));var config=require(_0x6bf0('0x16'));var licenseUtil=require(_0x6bf0('0x17'));var db=require(_0x6bf0('0x18'))['db'];var dbH=require(_0x6bf0('0x18'))[_0x6bf0('0x19')];function respondWithStatusCode(_0xfdda14,_0x21c846){_0x21c846=_0x21c846||0xcc;return function(_0x5791d8){if(_0x5791d8){return _0xfdda14['sendStatus'](_0x21c846);}return _0xfdda14['status'](_0x21c846)['end']();};}function respondWithResult(_0x45560c,_0x65f659){_0x65f659=_0x65f659||0xc8;return function(_0x21511d){if(_0x21511d){return _0x45560c[_0x6bf0('0x1a')](_0x65f659)[_0x6bf0('0x1b')](_0x21511d);}};}function respondWithFilteredResult(_0x87ce78,_0x3d2781){return function(_0x56bc17){if(_0x56bc17){var _0xc5e763=typeof _0x3d2781[_0x6bf0('0x1c')]===_0x6bf0('0x1d')&&typeof _0x3d2781['limit']==='undefined';var _0x13c44c=_0x56bc17[_0x6bf0('0x1e')];var _0x22766b=_0xc5e763?0x0:_0x3d2781[_0x6bf0('0x1c')];var _0x1eb811=_0xc5e763?_0x56bc17[_0x6bf0('0x1e')]:_0x3d2781['offset']+_0x3d2781[_0x6bf0('0x1f')];var _0x1c4ed8;if(_0x1eb811>=_0x13c44c){_0x1eb811=_0x13c44c;_0x1c4ed8=0xc8;}else{_0x1c4ed8=0xce;}_0x87ce78['status'](_0x1c4ed8);return _0x87ce78[_0x6bf0('0x20')]('Content-Range',_0x22766b+'-'+_0x1eb811+'/'+_0x13c44c)[_0x6bf0('0x1b')](_0x56bc17);}return null;};}function patchUpdates(_0x2776e5){return function(_0x540ee9){try{jsonpatch[_0x6bf0('0x21')](_0x540ee9,_0x2776e5,!![]);}catch(_0x4767bd){return BPromise['reject'](_0x4767bd);}return _0x540ee9[_0x6bf0('0x22')]();};}function saveUpdates(_0x1c387b,_0x2254f2){return function(_0x59bf2f){if(_0x59bf2f){return _0x59bf2f[_0x6bf0('0x23')](_0x1c387b)[_0x6bf0('0x24')](function(_0xbab7f1){return _0xbab7f1;});}return null;};}function removeEntity(_0xe80796,_0x204bab){return function(_0x4eddba){if(_0x4eddba){return _0x4eddba['destroy']()['then'](function(){var _0x59b4be=_0x4eddba[_0x6bf0('0x25')]({'plain':!![]});var _0x19504e=_0x6bf0('0x26');return db[_0x6bf0('0x27')][_0x6bf0('0x28')]({'where':{'type':_0x19504e,'resourceId':_0x59b4be['id']}})[_0x6bf0('0x24')](function(){return _0x4eddba;});})['then'](function(){_0xe80796['status'](0xcc)[_0x6bf0('0x29')]();});}};}function handleEntityNotFound(_0x2434d8,_0x5cbb4e){return function(_0x220c3a){if(!_0x220c3a){_0x2434d8[_0x6bf0('0x2a')](0x194);}return _0x220c3a;};}function handleError(_0x159412,_0x21bba0){_0x21bba0=_0x21bba0||0x1f4;return function(_0x5195f8){logger[_0x6bf0('0x2b')](_0x5195f8[_0x6bf0('0x2c')]);if(_0x5195f8[_0x6bf0('0x2d')]){delete _0x5195f8[_0x6bf0('0x2d')];}_0x159412['status'](_0x21bba0)[_0x6bf0('0x2e')](_0x5195f8);};}exports['index']=function(_0x57cfdd,_0xc0f28b){var _0x291549={},_0x8aad7e={},_0x193aa4={'count':0x0,'rows':[]};var _0x6f55d2=_[_0x6bf0('0x2f')](db[_0x6bf0('0x30')][_0x6bf0('0x31')],function(_0x108541){return{'name':_0x108541[_0x6bf0('0x32')],'type':_0x108541[_0x6bf0('0x33')][_0x6bf0('0x34')]};});_0x8aad7e[_0x6bf0('0x35')]=_['map'](_0x6f55d2,_0x6bf0('0x2d'));_0x8aad7e[_0x6bf0('0x36')]=_[_0x6bf0('0x37')](_0x57cfdd[_0x6bf0('0x36')]);_0x8aad7e[_0x6bf0('0x38')]=_['intersection'](_0x8aad7e['model'],_0x8aad7e[_0x6bf0('0x36')]);_0x291549[_0x6bf0('0x39')]=_['intersection'](_0x8aad7e[_0x6bf0('0x35')],qs[_0x6bf0('0x3a')](_0x57cfdd['query'][_0x6bf0('0x3a')]));_0x291549[_0x6bf0('0x39')]=_0x291549['attributes'][_0x6bf0('0x3b')]?_0x291549['attributes']:_0x8aad7e['model'];if(!_0x57cfdd[_0x6bf0('0x36')][_0x6bf0('0x3c')](_0x6bf0('0x3d'))){_0x291549[_0x6bf0('0x1f')]=qs[_0x6bf0('0x1f')](_0x57cfdd[_0x6bf0('0x36')][_0x6bf0('0x1f')]);_0x291549[_0x6bf0('0x1c')]=qs[_0x6bf0('0x1c')](_0x57cfdd[_0x6bf0('0x36')]['offset']);}_0x291549[_0x6bf0('0x3e')]=qs['sort'](_0x57cfdd[_0x6bf0('0x36')][_0x6bf0('0x3f')]);_0x291549[_0x6bf0('0x40')]=qs['filters'](_[_0x6bf0('0x41')](_0x57cfdd[_0x6bf0('0x36')],_0x8aad7e['filters']),_0x6f55d2);if(_0x57cfdd[_0x6bf0('0x36')][_0x6bf0('0x42')]){_0x291549[_0x6bf0('0x40')]=_['merge'](_0x291549[_0x6bf0('0x40')],{'$or':_[_0x6bf0('0x2f')](_0x6f55d2,function(_0x22627b){if(_0x22627b[_0x6bf0('0x33')]!=='VIRTUAL'){var _0x1fa0e0={};_0x1fa0e0[_0x22627b[_0x6bf0('0x2d')]]={'$like':'%'+_0x57cfdd[_0x6bf0('0x36')][_0x6bf0('0x42')]+'%'};return _0x1fa0e0;}})});}_0x291549=_[_0x6bf0('0x43')]({},_0x291549,_0x57cfdd[_0x6bf0('0x44')]);var _0x245e52={'where':_0x291549[_0x6bf0('0x40')]};return db[_0x6bf0('0x30')][_0x6bf0('0x1e')](_0x245e52)[_0x6bf0('0x24')](function(_0x22e923){_0x193aa4['count']=_0x22e923;if(_0x57cfdd[_0x6bf0('0x36')][_0x6bf0('0x45')]){_0x291549[_0x6bf0('0x46')]=[{'all':!![]}];}return db[_0x6bf0('0x30')]['findAll'](_0x291549);})[_0x6bf0('0x24')](function(_0x3e9bab){_0x193aa4[_0x6bf0('0x47')]=_0x3e9bab;return _0x193aa4;})[_0x6bf0('0x24')](respondWithFilteredResult(_0xc0f28b,_0x291549))[_0x6bf0('0x48')](handleError(_0xc0f28b,null));};exports['show']=function(_0x6aaed5,_0x158723){var _0x1ea9eb={'raw':![],'where':{'id':_0x6aaed5[_0x6bf0('0x49')]['id']}},_0x259c88={};_0x259c88[_0x6bf0('0x35')]=_[_0x6bf0('0x37')](db[_0x6bf0('0x30')][_0x6bf0('0x31')]);_0x259c88[_0x6bf0('0x36')]=_[_0x6bf0('0x37')](_0x6aaed5[_0x6bf0('0x36')]);_0x259c88[_0x6bf0('0x38')]=_[_0x6bf0('0x4a')](_0x259c88[_0x6bf0('0x35')],_0x259c88[_0x6bf0('0x36')]);_0x1ea9eb[_0x6bf0('0x39')]=_[_0x6bf0('0x4a')](_0x259c88['model'],qs[_0x6bf0('0x3a')](_0x6aaed5[_0x6bf0('0x36')]['fields']));_0x1ea9eb[_0x6bf0('0x39')]=_0x1ea9eb[_0x6bf0('0x39')][_0x6bf0('0x3b')]?_0x1ea9eb['attributes']:_0x259c88[_0x6bf0('0x35')];if(_0x6aaed5[_0x6bf0('0x36')]['includeAll']){_0x1ea9eb[_0x6bf0('0x46')]=[{'all':!![]}];}_0x1ea9eb=_[_0x6bf0('0x43')]({},_0x1ea9eb,_0x6aaed5[_0x6bf0('0x44')]);return db[_0x6bf0('0x30')][_0x6bf0('0x4b')](_0x1ea9eb)[_0x6bf0('0x24')](handleEntityNotFound(_0x158723,null))['then'](respondWithResult(_0x158723,null))[_0x6bf0('0x48')](handleError(_0x158723,null));};exports[_0x6bf0('0x4c')]=function(_0x1e3925,_0x13963e){return db['AnalyticCustomReport'][_0x6bf0('0x4c')](_0x1e3925[_0x6bf0('0x4d')],{})[_0x6bf0('0x24')](function(_0x303157){var _0x1d390e=_0x1e3925[_0x6bf0('0x4e')]['get']({'plain':!![]});if(!_0x1d390e)throw new Error(_0x6bf0('0x4f'));if(_0x1d390e[_0x6bf0('0x50')]===_0x6bf0('0x4e')){var _0x28b4f3=_0x303157[_0x6bf0('0x25')]({'plain':!![]});var _0x3b4900=_0x6bf0('0x51');return db[_0x6bf0('0x52')][_0x6bf0('0x4b')]({'where':{'name':_0x3b4900,'userProfileId':_0x1d390e[_0x6bf0('0x53')]},'raw':!![]})[_0x6bf0('0x24')](function(_0x2894bd){if(_0x2894bd&&_0x2894bd[_0x6bf0('0x54')]===0x0){return db[_0x6bf0('0x27')][_0x6bf0('0x4c')]({'name':_0x28b4f3[_0x6bf0('0x2d')],'resourceId':_0x28b4f3['id'],'type':_0x6bf0('0x26'),'sectionId':_0x2894bd['id']},{})[_0x6bf0('0x24')](function(){return _0x303157;});}else{return _0x303157;}})[_0x6bf0('0x48')](function(_0x1ea07f){logger[_0x6bf0('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ea07f);throw _0x1ea07f;});}return _0x303157;})[_0x6bf0('0x24')](respondWithResult(_0x13963e,0xc9))[_0x6bf0('0x48')](handleError(_0x13963e,null));};exports[_0x6bf0('0x23')]=function(_0x400f3d,_0x3012a0){if(_0x400f3d['body']['id']){delete _0x400f3d[_0x6bf0('0x4d')]['id'];}return db[_0x6bf0('0x30')][_0x6bf0('0x4b')]({'where':{'id':_0x400f3d[_0x6bf0('0x49')]['id']}})[_0x6bf0('0x24')](handleEntityNotFound(_0x3012a0,null))[_0x6bf0('0x24')](saveUpdates(_0x400f3d['body'],null))['then'](respondWithResult(_0x3012a0,null))[_0x6bf0('0x48')](handleError(_0x3012a0,null));};exports[_0x6bf0('0x28')]=function(_0x29d083,_0x552469){return db[_0x6bf0('0x30')]['find']({'where':{'id':_0x29d083[_0x6bf0('0x49')]['id']}})[_0x6bf0('0x24')](handleEntityNotFound(_0x552469,null))[_0x6bf0('0x24')](removeEntity(_0x552469,null))[_0x6bf0('0x48')](handleError(_0x552469,null));};exports[_0x6bf0('0x55')]=function(_0x565d41,_0x19ad28){var _0x51c292=0xa;var _0x100b63=['join',_0x6bf0('0x56'),_0x6bf0('0x57'),_0x6bf0('0x58')];var _0x81d9af={'SUM':_0x6bf0('0x59'),'COUNT':_0x6bf0('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x6bf0('0x5b'),'MIN':_0x6bf0('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x6bf0('0x5d'),'GROUP_CONCAT ASC':_0x6bf0('0x5e'),'GROUP_CONCAT DESC':_0x6bf0('0x5f')};var _0x466be9={'SEC_TO_TIME':_0x6bf0('0x60'),'DATE':_0x6bf0('0x61'),'HOUR':_0x6bf0('0x62'),'ROUND':_0x6bf0('0x63'),'UNIX_TIMESTAMP':_0x6bf0('0x64')};var _0x395fb5=function(_0x19b351){return!_[_0x6bf0('0x65')]([_0x6bf0('0x66'),_0x6bf0('0x67'),_0x6bf0('0x68'),_0x6bf0('0x69')],_0x19b351);};var _0x1e4199=function(_0x537366){if(!_0x537366||!_0x537366[_0x6bf0('0x6a')][_0x6bf0('0x3b')]){return'';}for(var _0x28d046='(',_0x16189c=0x0;_0x16189c<_0x537366[_0x6bf0('0x6a')][_0x6bf0('0x3b')];_0x16189c+=0x1){_0x16189c>0x0&&(_0x28d046+='\x20'+_0x537366['operator']+'\x20');_0x28d046+=_0x537366[_0x6bf0('0x6a')][_0x16189c]['group']?_0x1e4199(_0x537366['rules'][_0x16189c][_0x6bf0('0x6b')]):_0x537366[_0x6bf0('0x6a')][_0x16189c]['field']+'\x20'+_0x537366['rules'][_0x16189c][_0x6bf0('0x6c')]+(_0x395fb5(_0x537366[_0x6bf0('0x6a')][_0x16189c][_0x6bf0('0x6c')])?'\x20'+_0x537366['rules'][_0x16189c][_0x6bf0('0x6d')]:'');}return _0x28d046+')';};var _0x5b5160={'where':{'id':_0x565d41[_0x6bf0('0x49')]['id']}},_0x1dbb09,_0xebf7cb,_0x360a42,_0x38e4f7,_0x3232b6;_0x5b5160=_[_0x6bf0('0x43')]({},_0x5b5160,_0x565d41['options']);return db[_0x6bf0('0x30')]['find'](_0x5b5160)[_0x6bf0('0x24')](function(_0x9245f2){if(_0x9245f2){_0x1dbb09=_0x9245f2;return _0x9245f2['getFields']();}return null;})[_0x6bf0('0x24')](function(_0x488940){if(_0x488940){if(!_0x488940[_0x6bf0('0x3b')]){throw new db['Sequelize'][(_0x6bf0('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xebf7cb=_0x488940;return db[_0x6bf0('0x6f')][_0x6bf0('0x70')]({'raw':!![]});}return null;})[_0x6bf0('0x24')](function(_0x3fd2d7){if(_0x3fd2d7){_0x360a42=_[_0x6bf0('0x71')](_0x3fd2d7,'id');var _0x5654ce;var _0x4148af=squel['select']();_0x4148af[_0x6bf0('0x72')](_0x1dbb09[_0x6bf0('0x73')]);for(var _0x1f5be8=0x0;_0x1f5be8<_0xebf7cb[_0x6bf0('0x3b')];_0x1f5be8+=0x1){_0x5654ce=_0xebf7cb[_0x1f5be8][_0x6bf0('0x74')]?_0x360a42[_0xebf7cb[_0x1f5be8][_0x6bf0('0x74')]][_0x6bf0('0x75')]:_0xebf7cb[_0x1f5be8][_0x6bf0('0x76')];_0x5654ce=_0xebf7cb[_0x1f5be8][_0x6bf0('0x77')]?_[_0x6bf0('0x78')](_0x81d9af[_0xebf7cb[_0x1f5be8][_0x6bf0('0x77')]],'%s',_0x5654ce):_0x5654ce;_0x5654ce=_0xebf7cb[_0x1f5be8]['format']?_[_0x6bf0('0x78')](_0x466be9[_0xebf7cb[_0x1f5be8][_0x6bf0('0x79')]],'%s',_0x5654ce):_0x5654ce;if(_0xebf7cb[_0x1f5be8][_0x6bf0('0x7a')]){_0x4148af[_0x6bf0('0x6b')](_0x5654ce);}_0xebf7cb[_0x1f5be8]['orderBy']&&_0x4148af['order'](_0x5654ce,_0xebf7cb[_0x1f5be8]['orderBy']===_0x6bf0('0x7b')?![]:!![]);_0x4148af[_0x6bf0('0x76')](_0x5654ce,_0xebf7cb[_0x1f5be8][_0x6bf0('0x7c')]||_0x5654ce);}if(_0x1dbb09[_0x6bf0('0x7d')]){_0x1dbb09[_0x6bf0('0x7d')]=JSON['parse'](_0x1dbb09[_0x6bf0('0x7d')]);for(var _0x250c3f=0x0;_0x250c3f<_0x1dbb09['joins'][_0x6bf0('0x3b')];_0x250c3f+=0x1){if(_0x1dbb09[_0x6bf0('0x7d')][_0x250c3f][_0x6bf0('0x33')]&&_['includes'](_0x100b63,_0x1dbb09['joins'][_0x250c3f][_0x6bf0('0x33')])&&_0x1dbb09[_0x6bf0('0x7d')][_0x250c3f][_0x6bf0('0x7e')]&&_0x1dbb09['joins'][_0x250c3f][_0x6bf0('0x7f')]&&_0x1dbb09[_0x6bf0('0x7d')][_0x250c3f]['foreignKey']){_0x4148af[_0x1dbb09[_0x6bf0('0x7d')][_0x250c3f][_0x6bf0('0x33')]](_0x1dbb09['joins'][_0x250c3f][_0x6bf0('0x7f')],null,util['format'](_0x6bf0('0x80'),_0x1dbb09[_0x6bf0('0x73')],_0x1dbb09['joins'][_0x250c3f][_0x6bf0('0x7e')],_0x1dbb09[_0x6bf0('0x7d')][_0x250c3f][_0x6bf0('0x7f')],_0x1dbb09[_0x6bf0('0x7d')][_0x250c3f][_0x6bf0('0x81')]));}}}if(_0x1dbb09['conditions']){_0x1dbb09['conditions']=JSON['parse'](_0x1dbb09[_0x6bf0('0x82')]);_0x4148af['where'](_0x1e4199(_0x1dbb09[_0x6bf0('0x82')][_0x6bf0('0x6b')]));}_0x3232b6=_0x4148af[_0x6bf0('0x83')]();_0x4148af[_0x6bf0('0x1f')](_0x51c292);_0x4148af[_0x6bf0('0x1c')](0x0);logger[_0x6bf0('0x84')](_0x6bf0('0x85'),_0x4148af[_0x6bf0('0x86')]());return dbH['sequelize'][_0x6bf0('0x36')](_0x4148af[_0x6bf0('0x86')](),{'type':dbH[_0x6bf0('0x87')]['QueryTypes']['SELECT']});}})['then'](respondWithResult(_0x19ad28,null))[_0x6bf0('0x48')](handleError(_0x19ad28,null));};function runReport(_0x2effb1,_0xc4b1a0,_0x4e6df5){var _0x1bdcba=_0xc4b1a0['name'];var _0xc332d=0xa;var _0x2950c3=[_0x6bf0('0x88'),_0x6bf0('0x56'),_0x6bf0('0x57'),_0x6bf0('0x58')];var _0x2245f1={'SUM':_0x6bf0('0x59'),'COUNT':_0x6bf0('0x5a'),'COUNT DISTINCT':_0x6bf0('0x89'),'MAX':_0x6bf0('0x5b'),'MIN':_0x6bf0('0x5c'),'AVG':_0x6bf0('0x8a'),'GROUP_CONCAT':_0x6bf0('0x5d'),'GROUP_CONCAT ASC':_0x6bf0('0x5e'),'GROUP_CONCAT DESC':_0x6bf0('0x5f')};var _0x5c412b={'SEC_TO_TIME':_0x6bf0('0x60'),'DATE':_0x6bf0('0x61'),'HOUR':_0x6bf0('0x62'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x6bf0('0x64')};var _0x1210c0=function(_0x1e9493){return!_[_0x6bf0('0x65')]([_0x6bf0('0x66'),_0x6bf0('0x67'),_0x6bf0('0x68'),_0x6bf0('0x69')],_0x1e9493);};var _0x2688dd=function(_0xdcb447){if(!_0xdcb447||!_0xdcb447['rules'][_0x6bf0('0x3b')]){return'';}for(var _0x426bde='(',_0x17241a=0x0;_0x17241a<_0xdcb447[_0x6bf0('0x6a')][_0x6bf0('0x3b')];_0x17241a+=0x1){_0x17241a>0x0&&(_0x426bde+='\x20'+_0xdcb447[_0x6bf0('0x8b')]+'\x20');_0x426bde+=_0xdcb447[_0x6bf0('0x6a')][_0x17241a][_0x6bf0('0x6b')]?_0x2688dd(_0xdcb447[_0x6bf0('0x6a')][_0x17241a]['group']):_0xdcb447['rules'][_0x17241a][_0x6bf0('0x76')]+'\x20'+_0xdcb447['rules'][_0x17241a][_0x6bf0('0x6c')]+(_0x1210c0(_0xdcb447['rules'][_0x17241a][_0x6bf0('0x6c')])?'\x20'+_0xdcb447['rules'][_0x17241a]['value']:'');}return _0x426bde+')';};var _0x1d8fe0={'where':{'id':_0x2effb1['id']}},_0x5d40c2,_0x5c4073,_0x1e7627,_0x156dad,_0x2cb73e;_0x1d8fe0=_[_0x6bf0('0x43')]({},_0x1d8fe0,_0x4e6df5);return db[_0x6bf0('0x30')][_0x6bf0('0x4b')](_0x1d8fe0)[_0x6bf0('0x24')](function(_0x46ea79){if(_0x46ea79){_0x5d40c2=_0x46ea79;return _0x46ea79[_0x6bf0('0x8c')]();}return null;})[_0x6bf0('0x24')](function(_0x1d13de){if(_0x1d13de){if(!_0x1d13de[_0x6bf0('0x3b')]){throw new db[(_0x6bf0('0x8d'))][(_0x6bf0('0x6e'))](_0x6bf0('0x8e'),0x193);}_0x5c4073=_0x1d13de;return db['AnalyticMetric'][_0x6bf0('0x70')]({'raw':!![]});}return null;})[_0x6bf0('0x24')](function(_0x44f3fc){if(_0x44f3fc){_0x1e7627=_['keyBy'](_0x44f3fc,'id');var _0x4d1e11;var _0x5a143c=squel[_0x6bf0('0x8f')]();_0x5a143c[_0x6bf0('0x72')](_0x5d40c2['table']);for(var _0x2e4736=0x0;_0x2e4736<_0x5c4073[_0x6bf0('0x3b')];_0x2e4736+=0x1){_0x4d1e11=_0x5c4073[_0x2e4736]['MetricId']?_0x1e7627[_0x5c4073[_0x2e4736][_0x6bf0('0x74')]][_0x6bf0('0x75')]:_0x5c4073[_0x2e4736][_0x6bf0('0x76')];_0x4d1e11=_0x5c4073[_0x2e4736]['function']?_[_0x6bf0('0x78')](_0x2245f1[_0x5c4073[_0x2e4736][_0x6bf0('0x77')]],'%s',_0x4d1e11):_0x4d1e11;_0x4d1e11=_0x5c4073[_0x2e4736][_0x6bf0('0x79')]?_[_0x6bf0('0x78')](_0x5c412b[_0x5c4073[_0x2e4736][_0x6bf0('0x79')]],'%s',_0x4d1e11):_0x4d1e11;if(_0x5c4073[_0x2e4736]['groupBy']){_0x5a143c[_0x6bf0('0x6b')](_0x4d1e11);}_0x5c4073[_0x2e4736][_0x6bf0('0x90')]&&_0x5a143c['order'](_0x4d1e11,_0x5c4073[_0x2e4736][_0x6bf0('0x90')]===_0x6bf0('0x7b')?![]:!![]);_0x5a143c[_0x6bf0('0x76')](_0x4d1e11,_0x5c4073[_0x2e4736][_0x6bf0('0x7c')]||_0x4d1e11);}if(_0x5d40c2[_0x6bf0('0x7d')]){_0x5d40c2['joins']=JSON[_0x6bf0('0x91')](_0x5d40c2[_0x6bf0('0x7d')]);for(var _0x126723=0x0;_0x126723<_0x5d40c2[_0x6bf0('0x7d')][_0x6bf0('0x3b')];_0x126723+=0x1){if(_0x5d40c2[_0x6bf0('0x7d')][_0x126723][_0x6bf0('0x33')]&&_[_0x6bf0('0x65')](_0x2950c3,_0x5d40c2[_0x6bf0('0x7d')][_0x126723][_0x6bf0('0x33')])&&_0x5d40c2['joins'][_0x126723][_0x6bf0('0x7e')]&&_0x5d40c2[_0x6bf0('0x7d')][_0x126723][_0x6bf0('0x7f')]&&_0x5d40c2[_0x6bf0('0x7d')][_0x126723][_0x6bf0('0x81')]){_0x5a143c[_0x5d40c2[_0x6bf0('0x7d')][_0x126723][_0x6bf0('0x33')]](_0x5d40c2['joins'][_0x126723][_0x6bf0('0x7f')],null,util[_0x6bf0('0x79')](_0x6bf0('0x80'),_0x5d40c2[_0x6bf0('0x73')],_0x5d40c2[_0x6bf0('0x7d')][_0x126723][_0x6bf0('0x7e')],_0x5d40c2[_0x6bf0('0x7d')][_0x126723]['foreignTable'],_0x5d40c2[_0x6bf0('0x7d')][_0x126723][_0x6bf0('0x81')]));}}}if(_0x5d40c2['conditions']){_0x5d40c2[_0x6bf0('0x82')]=JSON[_0x6bf0('0x91')](_0x5d40c2[_0x6bf0('0x82')]);_0x5a143c['where'](_0x2688dd(_0x5d40c2[_0x6bf0('0x82')][_0x6bf0('0x6b')]));}_0x2cb73e=_0x5a143c[_0x6bf0('0x83')]();_0x5a143c['limit'](_0xc332d);_0x5a143c[_0x6bf0('0x1c')](0x0);return;}})[_0x6bf0('0x24')](function(){if(_0xc4b1a0['output']===_0x6bf0('0x92')){return null;}var _0x2725cf=_[_0x6bf0('0x43')](_0xc4b1a0,{'name':_0xc4b1a0[_0x6bf0('0x93')]||_0xc4b1a0['name']||_0x5d40c2[_0x6bf0('0x2d')],'basename':_0x1bdcba,'savename':util[_0x6bf0('0x79')](_0x6bf0('0x94'),_0xc4b1a0[_0x6bf0('0x2d')]||_0x5d40c2[_0x6bf0('0x2d')],require(_0x6bf0('0x95'))[_0x6bf0('0x96')](0x4),_0xc4b1a0[_0x6bf0('0x97')]||_0x6bf0('0x98')),'reportId':_0x5d40c2['id'],'reportType':'custom'});return db[_0x6bf0('0x99')][_0x6bf0('0x4c')](_0x2725cf,{'raw':!![]});})[_0x6bf0('0x24')](function(_0x4ae5ec){if(_0x5d40c2[_0x6bf0('0x73')]===_0x6bf0('0x9a')){_0x2cb73e[_0x6bf0('0x40')](_0x5d40c2[_0x6bf0('0x73')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xc4b1a0['startDate'],_0xc4b1a0['endDate']);}else{_0x2cb73e[_0x6bf0('0x40')](_0x5d40c2['table']+_0x6bf0('0x9b'),_0xc4b1a0[_0x6bf0('0x9c')],_0xc4b1a0[_0x6bf0('0x9d')]);}if(_0x4ae5ec){logger['info'](_0x6bf0('0x9e'),_0x2cb73e[_0x6bf0('0x86')]());require(_0x6bf0('0x9f'))['fork'](path[_0x6bf0('0x88')](__dirname,_0x6bf0('0xa0'),_0x4ae5ec[_0x6bf0('0x97')]),[_0x4ae5ec['id'],_0x2cb73e[_0x6bf0('0x86')](),path[_0x6bf0('0x88')](__dirname,_0x6bf0('0xa1'),_0x4ae5ec[_0x6bf0('0xa2')]),_0x1bdcba]);return _0x4ae5ec;}else{var _0x247147=squel[_0x6bf0('0x8f')]();_0x247147['from']('('+_0x2cb73e['toString']()+')','countTable');_0x247147['field'](_0x6bf0('0xa3'),_0x6bf0('0x1e'));_0x2cb73e[_0x6bf0('0x1f')](_0xc4b1a0[_0x6bf0('0x1f')]||_0xc332d);_0x2cb73e[_0x6bf0('0x1c')](_0xc4b1a0['offset']||0x0);return dbH[_0x6bf0('0x87')][_0x6bf0('0x36')](_0x247147[_0x6bf0('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0x6bf0('0xa4')]})[_0x6bf0('0x24')](function(_0x489b44){if(!_0x489b44[_0x6bf0('0x3b')]){_0x156dad=0x0;}else{_0x156dad=_0x489b44[0x0][_0x6bf0('0x1e')]||0x0;}return dbH[_0x6bf0('0x87')][_0x6bf0('0x36')](_0x2cb73e['toString'](),{'type':dbH[_0x6bf0('0x87')][_0x6bf0('0xa5')][_0x6bf0('0xa4')]});})['then'](function(_0x2b2716){return{'rows':_0x2b2716||[],'count':_0x156dad};});}});}exports[_0x6bf0('0xa6')]=function(_0x2178cf,_0x240b2){return runReport(_0x2178cf[_0x6bf0('0x49')],_0x2178cf['query'],_0x2178cf[_0x6bf0('0x44')])['then'](respondWithResult(_0x240b2,null))['catch'](handleError(_0x240b2,null));};exports[_0x6bf0('0xa7')]=runReport;exports[_0x6bf0('0x36')]=function(_0x399e7d,_0x1e3000){var _0x5b7d39=0xa;var _0x4186fb=[_0x6bf0('0x88'),'left_join','right_join',_0x6bf0('0x58')];var _0x4f9886={'SUM':_0x6bf0('0x59'),'COUNT':_0x6bf0('0x5a'),'COUNT DISTINCT':_0x6bf0('0x89'),'MAX':_0x6bf0('0x5b'),'MIN':_0x6bf0('0x5c'),'AVG':_0x6bf0('0x8a'),'GROUP_CONCAT':_0x6bf0('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4704db={'SEC_TO_TIME':_0x6bf0('0x60'),'DATE':_0x6bf0('0x61'),'HOUR':_0x6bf0('0x62'),'ROUND':_0x6bf0('0x63'),'UNIX_TIMESTAMP':_0x6bf0('0x64')};var _0x180fbc=function(_0x1fee38){return!_['includes']([_0x6bf0('0x66'),_0x6bf0('0x67'),'IS\x20EMPTY',_0x6bf0('0x69')],_0x1fee38);};var _0xc3fb2f=function(_0x314753){if(!_0x314753||!_0x314753[_0x6bf0('0x6a')][_0x6bf0('0x3b')]){return'';}for(var _0xfe5222='(',_0x1e0857=0x0;_0x1e0857<_0x314753['rules'][_0x6bf0('0x3b')];_0x1e0857+=0x1){_0x1e0857>0x0&&(_0xfe5222+='\x20'+_0x314753['operator']+'\x20');_0xfe5222+=_0x314753[_0x6bf0('0x6a')][_0x1e0857][_0x6bf0('0x6b')]?_0xc3fb2f(_0x314753['rules'][_0x1e0857][_0x6bf0('0x6b')]):_0x314753[_0x6bf0('0x6a')][_0x1e0857]['field']+'\x20'+_0x314753[_0x6bf0('0x6a')][_0x1e0857][_0x6bf0('0x6c')]+(_0x180fbc(_0x314753[_0x6bf0('0x6a')][_0x1e0857][_0x6bf0('0x6c')])?'\x20'+_0x314753['rules'][_0x1e0857]['value']:'');}return _0xfe5222+')';};var _0x234227={'where':{'id':_0x399e7d[_0x6bf0('0x49')]['id']}},_0x607b64,_0x39f766,_0x49bdfb,_0x1b392c,_0x5849c9;_0x234227=_[_0x6bf0('0x43')]({},_0x234227,_0x399e7d['options']);return db[_0x6bf0('0x30')][_0x6bf0('0x4b')](_0x234227)[_0x6bf0('0x24')](function(_0x405c18){if(_0x405c18){_0x607b64=_0x405c18;return _0x405c18[_0x6bf0('0x8c')]();}return null;})[_0x6bf0('0x24')](function(_0x56e7ef){if(_0x56e7ef){if(!_0x56e7ef[_0x6bf0('0x3b')]){throw new db[(_0x6bf0('0x8d'))]['ValidationErrorItem'](_0x6bf0('0x8e'),0x193);}_0x39f766=_0x56e7ef;return db[_0x6bf0('0x6f')][_0x6bf0('0x70')]({'raw':!![]});}return null;})['then'](function(_0x279a7f){if(_0x279a7f){_0x49bdfb=_[_0x6bf0('0x71')](_0x279a7f,'id');var _0x2d374d;var _0x557b99=squel[_0x6bf0('0x8f')]();_0x557b99['from'](_0x607b64[_0x6bf0('0x73')]);for(var _0x679790=0x0;_0x679790<_0x39f766['length'];_0x679790+=0x1){_0x2d374d=_0x39f766[_0x679790][_0x6bf0('0x74')]?_0x49bdfb[_0x39f766[_0x679790]['MetricId']][_0x6bf0('0x75')]:_0x39f766[_0x679790]['field'];_0x2d374d=_0x39f766[_0x679790]['function']?_[_0x6bf0('0x78')](_0x4f9886[_0x39f766[_0x679790]['function']],'%s',_0x2d374d):_0x2d374d;_0x2d374d=_0x39f766[_0x679790][_0x6bf0('0x79')]?_[_0x6bf0('0x78')](_0x4704db[_0x39f766[_0x679790][_0x6bf0('0x79')]],'%s',_0x2d374d):_0x2d374d;if(_0x39f766[_0x679790][_0x6bf0('0x7a')]){_0x557b99[_0x6bf0('0x6b')](_0x2d374d);}_0x39f766[_0x679790]['orderBy']&&_0x557b99[_0x6bf0('0x3e')](_0x2d374d,_0x39f766[_0x679790][_0x6bf0('0x90')]==='DESC'?![]:!![]);_0x557b99[_0x6bf0('0x76')](_0x2d374d,_0x39f766[_0x679790][_0x6bf0('0x7c')]||_0x2d374d);}if(_0x607b64[_0x6bf0('0x7d')]){_0x607b64['joins']=JSON['parse'](_0x607b64[_0x6bf0('0x7d')]);for(var _0x1fcc32=0x0;_0x1fcc32<_0x607b64[_0x6bf0('0x7d')]['length'];_0x1fcc32+=0x1){if(_0x607b64[_0x6bf0('0x7d')][_0x1fcc32][_0x6bf0('0x33')]&&_[_0x6bf0('0x65')](_0x4186fb,_0x607b64[_0x6bf0('0x7d')][_0x1fcc32][_0x6bf0('0x33')])&&_0x607b64[_0x6bf0('0x7d')][_0x1fcc32][_0x6bf0('0x7e')]&&_0x607b64[_0x6bf0('0x7d')][_0x1fcc32][_0x6bf0('0x7f')]&&_0x607b64[_0x6bf0('0x7d')][_0x1fcc32][_0x6bf0('0x81')]){_0x557b99[_0x607b64['joins'][_0x1fcc32]['type']](_0x607b64['joins'][_0x1fcc32][_0x6bf0('0x7f')],null,util[_0x6bf0('0x79')](_0x6bf0('0x80'),_0x607b64['table'],_0x607b64[_0x6bf0('0x7d')][_0x1fcc32][_0x6bf0('0x7e')],_0x607b64['joins'][_0x1fcc32]['foreignTable'],_0x607b64[_0x6bf0('0x7d')][_0x1fcc32][_0x6bf0('0x81')]));}}}if(_0x607b64[_0x6bf0('0x82')]){_0x607b64[_0x6bf0('0x82')]=JSON[_0x6bf0('0x91')](_0x607b64['conditions']);_0x557b99[_0x6bf0('0x40')](_0xc3fb2f(_0x607b64['conditions'][_0x6bf0('0x6b')]));}_0x5849c9=_0x557b99[_0x6bf0('0x83')]();_0x557b99[_0x6bf0('0x1f')](_0x5b7d39);_0x557b99[_0x6bf0('0x1c')](0x0);logger[_0x6bf0('0x84')](_0x6bf0('0x85'),_0x557b99[_0x6bf0('0x86')]());return dbH[_0x6bf0('0x87')]['query'](_0x557b99['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x6bf0('0xa4')]});}})[_0x6bf0('0x24')](function(){return{'sql':_0x5849c9[_0x6bf0('0x86')]()};})[_0x6bf0('0x24')](respondWithResult(_0x1e3000,null))['catch'](handleError(_0x1e3000,null));}; \ No newline at end of file +var _0xaf31=['stack','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','show','params','length','includeAll','merge','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','find','userProfileId','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','condition','value','getFields','AnalyticMetric','keyBy','select','table','MetricId','metric','field','function','format','replace','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','left_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','Sequelize','ValidationErrorItem','from','foreignKey','output','web','fullPath','%s-%s.%s','randomstring','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','run','runReport','IS\x20NOT\x20EMPTY','Please\x20insert\x20at\x20least\x20one\x20field','debug','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','dbH','status','end','json','offset','undefined','count','Content-Range','save','update','then','destroy','get','UserProfileResource','error'];(function(_0x56a589,_0x641fc6){var _0x53c67c=function(_0x29bfe5){while(--_0x29bfe5){_0x56a589['push'](_0x56a589['shift']());}};_0x53c67c(++_0x641fc6);}(_0xaf31,0x1c1));var _0x1af3=function(_0x493f2e,_0x3491b4){_0x493f2e=_0x493f2e-0x0;var _0x4083ea=_0xaf31[_0x493f2e];return _0x4083ea;};'use strict';var emlformat=require(_0x1af3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1af3('0x1'));var jsonpatch=require(_0x1af3('0x2'));var rp=require(_0x1af3('0x3'));var moment=require(_0x1af3('0x4'));var BPromise=require(_0x1af3('0x5'));var Mustache=require(_0x1af3('0x6'));var util=require('util');var path=require(_0x1af3('0x7'));var sox=require(_0x1af3('0x8'));var csv=require(_0x1af3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1af3('0xa'));var _=require('lodash');var squel=require(_0x1af3('0xb'));var crypto=require(_0x1af3('0xc'));var jsforce=require(_0x1af3('0xd'));var deskjs=require(_0x1af3('0xe'));var toCsv=require(_0x1af3('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1af3('0xf'));var authService=require(_0x1af3('0x10'));var qs=require(_0x1af3('0x11'));var as=require(_0x1af3('0x12'));var hardwareService=require(_0x1af3('0x13'));var logger=require(_0x1af3('0x14'))(_0x1af3('0x15'));var utils=require(_0x1af3('0x16'));var config=require(_0x1af3('0x17'));var licenseUtil=require(_0x1af3('0x18'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x1af3('0x19')];function respondWithStatusCode(_0x40273b,_0x1efa5a){_0x1efa5a=_0x1efa5a||0xcc;return function(_0x110b19){if(_0x110b19){return _0x40273b['sendStatus'](_0x1efa5a);}return _0x40273b[_0x1af3('0x1a')](_0x1efa5a)[_0x1af3('0x1b')]();};}function respondWithResult(_0x14b90c,_0x170888){_0x170888=_0x170888||0xc8;return function(_0x4f8c19){if(_0x4f8c19){return _0x14b90c[_0x1af3('0x1a')](_0x170888)[_0x1af3('0x1c')](_0x4f8c19);}};}function respondWithFilteredResult(_0x2e7563,_0x4584bd){return function(_0x3262c7){if(_0x3262c7){var _0x2e3d00=typeof _0x4584bd[_0x1af3('0x1d')]===_0x1af3('0x1e')&&typeof _0x4584bd['limit']===_0x1af3('0x1e');var _0x36f8e5=_0x3262c7[_0x1af3('0x1f')];var _0x21ec50=_0x2e3d00?0x0:_0x4584bd[_0x1af3('0x1d')];var _0x211f66=_0x2e3d00?_0x3262c7[_0x1af3('0x1f')]:_0x4584bd[_0x1af3('0x1d')]+_0x4584bd['limit'];var _0x341bf2;if(_0x211f66>=_0x36f8e5){_0x211f66=_0x36f8e5;_0x341bf2=0xc8;}else{_0x341bf2=0xce;}_0x2e7563['status'](_0x341bf2);return _0x2e7563['set'](_0x1af3('0x20'),_0x21ec50+'-'+_0x211f66+'/'+_0x36f8e5)[_0x1af3('0x1c')](_0x3262c7);}return null;};}function patchUpdates(_0x3c989f){return function(_0x1286f8){try{jsonpatch['apply'](_0x1286f8,_0x3c989f,!![]);}catch(_0x533085){return BPromise['reject'](_0x533085);}return _0x1286f8[_0x1af3('0x21')]();};}function saveUpdates(_0x4102f3,_0x4f9606){return function(_0x385223){if(_0x385223){return _0x385223[_0x1af3('0x22')](_0x4102f3)[_0x1af3('0x23')](function(_0x58d101){return _0x58d101;});}return null;};}function removeEntity(_0x4f14d8,_0x97c509){return function(_0x5aa499){if(_0x5aa499){return _0x5aa499[_0x1af3('0x24')]()['then'](function(){var _0x41b0ae=_0x5aa499[_0x1af3('0x25')]({'plain':!![]});var _0x38133c='CustomReports';return db[_0x1af3('0x26')]['destroy']({'where':{'type':_0x38133c,'resourceId':_0x41b0ae['id']}})[_0x1af3('0x23')](function(){return _0x5aa499;});})[_0x1af3('0x23')](function(){_0x4f14d8[_0x1af3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57115a,_0x1bed67){return function(_0x2fedb7){if(!_0x2fedb7){_0x57115a['sendStatus'](0x194);}return _0x2fedb7;};}function handleError(_0x5ddbeb,_0x13287d){_0x13287d=_0x13287d||0x1f4;return function(_0x5b32a3){logger[_0x1af3('0x27')](_0x5b32a3[_0x1af3('0x28')]);if(_0x5b32a3[_0x1af3('0x29')]){delete _0x5b32a3[_0x1af3('0x29')];}_0x5ddbeb[_0x1af3('0x1a')](_0x13287d)['send'](_0x5b32a3);};}exports[_0x1af3('0x2a')]=function(_0x462e88,_0x5aec1b){var _0x1133f6={},_0x4deeea={},_0x32ce31={'count':0x0,'rows':[]};var _0x4f3963=_[_0x1af3('0x2b')](db[_0x1af3('0x2c')][_0x1af3('0x2d')],function(_0x5b0a5c){return{'name':_0x5b0a5c[_0x1af3('0x2e')],'type':_0x5b0a5c[_0x1af3('0x2f')][_0x1af3('0x30')]};});_0x4deeea[_0x1af3('0x31')]=_[_0x1af3('0x2b')](_0x4f3963,_0x1af3('0x29'));_0x4deeea[_0x1af3('0x32')]=_[_0x1af3('0x33')](_0x462e88[_0x1af3('0x32')]);_0x4deeea[_0x1af3('0x34')]=_['intersection'](_0x4deeea[_0x1af3('0x31')],_0x4deeea[_0x1af3('0x32')]);_0x1133f6[_0x1af3('0x35')]=_[_0x1af3('0x36')](_0x4deeea[_0x1af3('0x31')],qs['fields'](_0x462e88[_0x1af3('0x32')][_0x1af3('0x37')]));_0x1133f6['attributes']=_0x1133f6[_0x1af3('0x35')]['length']?_0x1133f6[_0x1af3('0x35')]:_0x4deeea[_0x1af3('0x31')];if(!_0x462e88[_0x1af3('0x32')]['hasOwnProperty'](_0x1af3('0x38'))){_0x1133f6[_0x1af3('0x39')]=qs[_0x1af3('0x39')](_0x462e88[_0x1af3('0x32')][_0x1af3('0x39')]);_0x1133f6[_0x1af3('0x1d')]=qs[_0x1af3('0x1d')](_0x462e88[_0x1af3('0x32')][_0x1af3('0x1d')]);}_0x1133f6[_0x1af3('0x3a')]=qs[_0x1af3('0x3b')](_0x462e88['query'][_0x1af3('0x3b')]);_0x1133f6[_0x1af3('0x3c')]=qs[_0x1af3('0x34')](_[_0x1af3('0x3d')](_0x462e88[_0x1af3('0x32')],_0x4deeea['filters']),_0x4f3963);if(_0x462e88[_0x1af3('0x32')][_0x1af3('0x3e')]){_0x1133f6[_0x1af3('0x3c')]=_['merge'](_0x1133f6[_0x1af3('0x3c')],{'$or':_[_0x1af3('0x2b')](_0x4f3963,function(_0x4ed126){if(_0x4ed126[_0x1af3('0x2f')]!==_0x1af3('0x3f')){var _0x4981fa={};_0x4981fa[_0x4ed126[_0x1af3('0x29')]]={'$like':'%'+_0x462e88['query'][_0x1af3('0x3e')]+'%'};return _0x4981fa;}})});}_0x1133f6=_['merge']({},_0x1133f6,_0x462e88[_0x1af3('0x40')]);var _0xa3e4d8={'where':_0x1133f6[_0x1af3('0x3c')]};return db['AnalyticCustomReport']['count'](_0xa3e4d8)[_0x1af3('0x23')](function(_0x1a472f){_0x32ce31['count']=_0x1a472f;if(_0x462e88[_0x1af3('0x32')]['includeAll']){_0x1133f6[_0x1af3('0x41')]=[{'all':!![]}];}return db[_0x1af3('0x2c')][_0x1af3('0x42')](_0x1133f6);})[_0x1af3('0x23')](function(_0x193000){_0x32ce31[_0x1af3('0x43')]=_0x193000;return _0x32ce31;})[_0x1af3('0x23')](respondWithFilteredResult(_0x5aec1b,_0x1133f6))['catch'](handleError(_0x5aec1b,null));};exports[_0x1af3('0x44')]=function(_0x16a413,_0x30290b){var _0x31c169={'raw':![],'where':{'id':_0x16a413[_0x1af3('0x45')]['id']}},_0x1d698a={};_0x1d698a[_0x1af3('0x31')]=_['keys'](db['AnalyticCustomReport']['rawAttributes']);_0x1d698a[_0x1af3('0x32')]=_[_0x1af3('0x33')](_0x16a413[_0x1af3('0x32')]);_0x1d698a['filters']=_[_0x1af3('0x36')](_0x1d698a[_0x1af3('0x31')],_0x1d698a['query']);_0x31c169[_0x1af3('0x35')]=_[_0x1af3('0x36')](_0x1d698a[_0x1af3('0x31')],qs[_0x1af3('0x37')](_0x16a413[_0x1af3('0x32')][_0x1af3('0x37')]));_0x31c169['attributes']=_0x31c169[_0x1af3('0x35')][_0x1af3('0x46')]?_0x31c169[_0x1af3('0x35')]:_0x1d698a[_0x1af3('0x31')];if(_0x16a413[_0x1af3('0x32')][_0x1af3('0x47')]){_0x31c169[_0x1af3('0x41')]=[{'all':!![]}];}_0x31c169=_[_0x1af3('0x48')]({},_0x31c169,_0x16a413['options']);return db[_0x1af3('0x2c')]['find'](_0x31c169)[_0x1af3('0x23')](handleEntityNotFound(_0x30290b,null))[_0x1af3('0x23')](respondWithResult(_0x30290b,null))[_0x1af3('0x49')](handleError(_0x30290b,null));};exports['create']=function(_0x2b7453,_0x1a5900){return db[_0x1af3('0x2c')][_0x1af3('0x4a')](_0x2b7453['body'],{})[_0x1af3('0x23')](function(_0x69d0f5){var _0x1017a0=_0x2b7453[_0x1af3('0x4b')][_0x1af3('0x25')]({'plain':!![]});if(!_0x1017a0)throw new Error(_0x1af3('0x4c'));if(_0x1017a0['role']===_0x1af3('0x4b')){var _0x5c13e7=_0x69d0f5[_0x1af3('0x25')]({'plain':!![]});var _0x287469=_0x1af3('0x4d');return db['UserProfileSection'][_0x1af3('0x4e')]({'where':{'name':_0x287469,'userProfileId':_0x1017a0[_0x1af3('0x4f')]},'raw':!![]})[_0x1af3('0x23')](function(_0x5af47a){if(_0x5af47a&&_0x5af47a['autoAssociation']===0x0){return db[_0x1af3('0x26')][_0x1af3('0x4a')]({'name':_0x5c13e7[_0x1af3('0x29')],'resourceId':_0x5c13e7['id'],'type':_0x1af3('0x50'),'sectionId':_0x5af47a['id']},{})['then'](function(){return _0x69d0f5;});}else{return _0x69d0f5;}})['catch'](function(_0x2a1556){logger['error'](_0x1af3('0x51'),_0x2a1556);throw _0x2a1556;});}return _0x69d0f5;})[_0x1af3('0x23')](respondWithResult(_0x1a5900,0xc9))['catch'](handleError(_0x1a5900,null));};exports[_0x1af3('0x22')]=function(_0x27acfd,_0x3b8834){if(_0x27acfd[_0x1af3('0x52')]['id']){delete _0x27acfd[_0x1af3('0x52')]['id'];}return db[_0x1af3('0x2c')][_0x1af3('0x4e')]({'where':{'id':_0x27acfd[_0x1af3('0x45')]['id']}})[_0x1af3('0x23')](handleEntityNotFound(_0x3b8834,null))[_0x1af3('0x23')](saveUpdates(_0x27acfd[_0x1af3('0x52')],null))[_0x1af3('0x23')](respondWithResult(_0x3b8834,null))[_0x1af3('0x49')](handleError(_0x3b8834,null));};exports[_0x1af3('0x24')]=function(_0x529a3c,_0x63f9d2){return db['AnalyticCustomReport'][_0x1af3('0x4e')]({'where':{'id':_0x529a3c[_0x1af3('0x45')]['id']}})[_0x1af3('0x23')](handleEntityNotFound(_0x63f9d2,null))['then'](removeEntity(_0x63f9d2,null))[_0x1af3('0x49')](handleError(_0x63f9d2,null));};exports['preview']=function(_0x2eedb9,_0x2effe3){var _0x2c62fd=0xa;var _0x34371e=['join','left_join',_0x1af3('0x53'),_0x1af3('0x54')];var _0x21d539={'SUM':_0x1af3('0x55'),'COUNT':_0x1af3('0x56'),'COUNT DISTINCT':_0x1af3('0x57'),'MAX':_0x1af3('0x58'),'MIN':_0x1af3('0x59'),'AVG':_0x1af3('0x5a'),'GROUP_CONCAT':_0x1af3('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1d4fc0={'SEC_TO_TIME':_0x1af3('0x5c'),'DATE':_0x1af3('0x5d'),'HOUR':_0x1af3('0x5e'),'ROUND':_0x1af3('0x5f'),'UNIX_TIMESTAMP':_0x1af3('0x60')};var _0x3c00b6=function(_0x19ddb4){return!_[_0x1af3('0x61')]([_0x1af3('0x62'),_0x1af3('0x63'),_0x1af3('0x64'),'IS\x20NOT\x20EMPTY'],_0x19ddb4);};var _0x355f85=function(_0x1071fb){if(!_0x1071fb||!_0x1071fb[_0x1af3('0x65')][_0x1af3('0x46')]){return'';}for(var _0x190fc4='(',_0x5e0fb8=0x0;_0x5e0fb8<_0x1071fb[_0x1af3('0x65')][_0x1af3('0x46')];_0x5e0fb8+=0x1){_0x5e0fb8>0x0&&(_0x190fc4+='\x20'+_0x1071fb[_0x1af3('0x66')]+'\x20');_0x190fc4+=_0x1071fb[_0x1af3('0x65')][_0x5e0fb8][_0x1af3('0x67')]?_0x355f85(_0x1071fb[_0x1af3('0x65')][_0x5e0fb8][_0x1af3('0x67')]):_0x1071fb['rules'][_0x5e0fb8]['field']+'\x20'+_0x1071fb[_0x1af3('0x65')][_0x5e0fb8][_0x1af3('0x68')]+(_0x3c00b6(_0x1071fb[_0x1af3('0x65')][_0x5e0fb8]['condition'])?'\x20'+_0x1071fb[_0x1af3('0x65')][_0x5e0fb8][_0x1af3('0x69')]:'');}return _0x190fc4+')';};var _0x2349e5={'where':{'id':_0x2eedb9['params']['id']}},_0x5a3c74,_0x392086,_0x2aa459,_0x3ce971,_0x1161dc;_0x2349e5=_['merge']({},_0x2349e5,_0x2eedb9[_0x1af3('0x40')]);return db[_0x1af3('0x2c')]['find'](_0x2349e5)['then'](function(_0x55997a){if(_0x55997a){_0x5a3c74=_0x55997a;return _0x55997a[_0x1af3('0x6a')]();}return null;})[_0x1af3('0x23')](function(_0x10ab51){if(_0x10ab51){if(!_0x10ab51[_0x1af3('0x46')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x392086=_0x10ab51;return db[_0x1af3('0x6b')][_0x1af3('0x42')]({'raw':!![]});}return null;})[_0x1af3('0x23')](function(_0x5642f0){if(_0x5642f0){_0x2aa459=_[_0x1af3('0x6c')](_0x5642f0,'id');var _0x4d03ad;var _0x3b26c2=squel[_0x1af3('0x6d')]();_0x3b26c2['from'](_0x5a3c74[_0x1af3('0x6e')]);for(var _0x38f4a1=0x0;_0x38f4a1<_0x392086[_0x1af3('0x46')];_0x38f4a1+=0x1){_0x4d03ad=_0x392086[_0x38f4a1][_0x1af3('0x6f')]?_0x2aa459[_0x392086[_0x38f4a1][_0x1af3('0x6f')]][_0x1af3('0x70')]:_0x392086[_0x38f4a1][_0x1af3('0x71')];_0x4d03ad=_0x392086[_0x38f4a1][_0x1af3('0x72')]?_['replace'](_0x21d539[_0x392086[_0x38f4a1]['function']],'%s',_0x4d03ad):_0x4d03ad;_0x4d03ad=_0x392086[_0x38f4a1][_0x1af3('0x73')]?_[_0x1af3('0x74')](_0x1d4fc0[_0x392086[_0x38f4a1][_0x1af3('0x73')]],'%s',_0x4d03ad):_0x4d03ad;if(_0x392086[_0x38f4a1][_0x1af3('0x75')]){_0x3b26c2[_0x1af3('0x67')](_0x4d03ad);}_0x392086[_0x38f4a1][_0x1af3('0x76')]&&_0x3b26c2[_0x1af3('0x3a')](_0x4d03ad,_0x392086[_0x38f4a1]['orderBy']==='DESC'?![]:!![]);_0x3b26c2[_0x1af3('0x71')](_0x4d03ad,_0x392086[_0x38f4a1][_0x1af3('0x77')]||_0x4d03ad);}if(_0x5a3c74['joins']){_0x5a3c74[_0x1af3('0x78')]=JSON[_0x1af3('0x79')](_0x5a3c74[_0x1af3('0x78')]);for(var _0x345c31=0x0;_0x345c31<_0x5a3c74[_0x1af3('0x78')]['length'];_0x345c31+=0x1){if(_0x5a3c74[_0x1af3('0x78')][_0x345c31]['type']&&_[_0x1af3('0x61')](_0x34371e,_0x5a3c74['joins'][_0x345c31][_0x1af3('0x2f')])&&_0x5a3c74[_0x1af3('0x78')][_0x345c31][_0x1af3('0x7a')]&&_0x5a3c74['joins'][_0x345c31]['foreignTable']&&_0x5a3c74[_0x1af3('0x78')][_0x345c31]['foreignKey']){_0x3b26c2[_0x5a3c74[_0x1af3('0x78')][_0x345c31][_0x1af3('0x2f')]](_0x5a3c74[_0x1af3('0x78')][_0x345c31][_0x1af3('0x7b')],null,util[_0x1af3('0x73')](_0x1af3('0x7c'),_0x5a3c74[_0x1af3('0x6e')],_0x5a3c74[_0x1af3('0x78')][_0x345c31][_0x1af3('0x7a')],_0x5a3c74[_0x1af3('0x78')][_0x345c31][_0x1af3('0x7b')],_0x5a3c74[_0x1af3('0x78')][_0x345c31]['foreignKey']));}}}if(_0x5a3c74[_0x1af3('0x7d')]){_0x5a3c74['conditions']=JSON[_0x1af3('0x79')](_0x5a3c74[_0x1af3('0x7d')]);_0x3b26c2[_0x1af3('0x3c')](_0x355f85(_0x5a3c74['conditions'][_0x1af3('0x67')]));}_0x1161dc=_0x3b26c2[_0x1af3('0x7e')]();_0x3b26c2['limit'](_0x2c62fd);_0x3b26c2[_0x1af3('0x1d')](0x0);logger['debug'](_0x1af3('0x7f'),_0x3b26c2[_0x1af3('0x80')]());return dbH[_0x1af3('0x81')]['query'](_0x3b26c2[_0x1af3('0x80')](),{'type':dbH[_0x1af3('0x81')][_0x1af3('0x82')][_0x1af3('0x83')]});}})[_0x1af3('0x23')](respondWithResult(_0x2effe3,null))[_0x1af3('0x49')](handleError(_0x2effe3,null));};function runReport(_0x4d8d08,_0x29c85c,_0x4cf3ec){var _0x24a6c2=_0x29c85c[_0x1af3('0x29')];var _0x1e2b08=0xa;var _0x361b66=[_0x1af3('0x84'),_0x1af3('0x85'),_0x1af3('0x53'),'cross_join'];var _0xa08064={'SUM':_0x1af3('0x55'),'COUNT':_0x1af3('0x56'),'COUNT DISTINCT':_0x1af3('0x57'),'MAX':_0x1af3('0x58'),'MIN':_0x1af3('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x1af3('0x86'),'GROUP_CONCAT DESC':_0x1af3('0x87')};var _0x5a12ec={'SEC_TO_TIME':_0x1af3('0x5c'),'DATE':_0x1af3('0x5d'),'HOUR':_0x1af3('0x5e'),'ROUND':_0x1af3('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x32fa01=function(_0x50348){return!_[_0x1af3('0x61')](['IS\x20NULL',_0x1af3('0x63'),_0x1af3('0x64'),'IS\x20NOT\x20EMPTY'],_0x50348);};var _0xfce05d=function(_0x1cfe80){if(!_0x1cfe80||!_0x1cfe80['rules'][_0x1af3('0x46')]){return'';}for(var _0x3e8f4b='(',_0x8e57f=0x0;_0x8e57f<_0x1cfe80['rules'][_0x1af3('0x46')];_0x8e57f+=0x1){_0x8e57f>0x0&&(_0x3e8f4b+='\x20'+_0x1cfe80[_0x1af3('0x66')]+'\x20');_0x3e8f4b+=_0x1cfe80[_0x1af3('0x65')][_0x8e57f][_0x1af3('0x67')]?_0xfce05d(_0x1cfe80[_0x1af3('0x65')][_0x8e57f]['group']):_0x1cfe80[_0x1af3('0x65')][_0x8e57f][_0x1af3('0x71')]+'\x20'+_0x1cfe80['rules'][_0x8e57f]['condition']+(_0x32fa01(_0x1cfe80[_0x1af3('0x65')][_0x8e57f]['condition'])?'\x20'+_0x1cfe80[_0x1af3('0x65')][_0x8e57f][_0x1af3('0x69')]:'');}return _0x3e8f4b+')';};var _0x33e018={'where':{'id':_0x4d8d08['id']}},_0x51336c,_0x48fd93,_0x299123,_0x4db220,_0x3feb3c;_0x33e018=_['merge']({},_0x33e018,_0x4cf3ec);return db[_0x1af3('0x2c')][_0x1af3('0x4e')](_0x33e018)[_0x1af3('0x23')](function(_0x399cf5){if(_0x399cf5){_0x51336c=_0x399cf5;return _0x399cf5[_0x1af3('0x6a')]();}return null;})[_0x1af3('0x23')](function(_0x2e7b3e){if(_0x2e7b3e){if(!_0x2e7b3e['length']){throw new db[(_0x1af3('0x88'))][(_0x1af3('0x89'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x48fd93=_0x2e7b3e;return db[_0x1af3('0x6b')][_0x1af3('0x42')]({'raw':!![]});}return null;})[_0x1af3('0x23')](function(_0x57bdaa){if(_0x57bdaa){_0x299123=_[_0x1af3('0x6c')](_0x57bdaa,'id');var _0x14b616;var _0x233fcc=squel[_0x1af3('0x6d')]();_0x233fcc[_0x1af3('0x8a')](_0x51336c[_0x1af3('0x6e')]);for(var _0x5e5e25=0x0;_0x5e5e25<_0x48fd93[_0x1af3('0x46')];_0x5e5e25+=0x1){_0x14b616=_0x48fd93[_0x5e5e25][_0x1af3('0x6f')]?_0x299123[_0x48fd93[_0x5e5e25]['MetricId']]['metric']:_0x48fd93[_0x5e5e25][_0x1af3('0x71')];_0x14b616=_0x48fd93[_0x5e5e25]['function']?_[_0x1af3('0x74')](_0xa08064[_0x48fd93[_0x5e5e25][_0x1af3('0x72')]],'%s',_0x14b616):_0x14b616;_0x14b616=_0x48fd93[_0x5e5e25][_0x1af3('0x73')]?_[_0x1af3('0x74')](_0x5a12ec[_0x48fd93[_0x5e5e25][_0x1af3('0x73')]],'%s',_0x14b616):_0x14b616;if(_0x48fd93[_0x5e5e25][_0x1af3('0x75')]){_0x233fcc['group'](_0x14b616);}_0x48fd93[_0x5e5e25][_0x1af3('0x76')]&&_0x233fcc[_0x1af3('0x3a')](_0x14b616,_0x48fd93[_0x5e5e25][_0x1af3('0x76')]==='DESC'?![]:!![]);_0x233fcc[_0x1af3('0x71')](_0x14b616,_0x48fd93[_0x5e5e25][_0x1af3('0x77')]||_0x14b616);}if(_0x51336c[_0x1af3('0x78')]){_0x51336c[_0x1af3('0x78')]=JSON['parse'](_0x51336c['joins']);for(var _0x5dab74=0x0;_0x5dab74<_0x51336c[_0x1af3('0x78')][_0x1af3('0x46')];_0x5dab74+=0x1){if(_0x51336c[_0x1af3('0x78')][_0x5dab74][_0x1af3('0x2f')]&&_['includes'](_0x361b66,_0x51336c[_0x1af3('0x78')][_0x5dab74][_0x1af3('0x2f')])&&_0x51336c[_0x1af3('0x78')][_0x5dab74][_0x1af3('0x7a')]&&_0x51336c['joins'][_0x5dab74][_0x1af3('0x7b')]&&_0x51336c[_0x1af3('0x78')][_0x5dab74][_0x1af3('0x8b')]){_0x233fcc[_0x51336c[_0x1af3('0x78')][_0x5dab74][_0x1af3('0x2f')]](_0x51336c[_0x1af3('0x78')][_0x5dab74]['foreignTable'],null,util[_0x1af3('0x73')](_0x1af3('0x7c'),_0x51336c['table'],_0x51336c['joins'][_0x5dab74]['parentKey'],_0x51336c[_0x1af3('0x78')][_0x5dab74][_0x1af3('0x7b')],_0x51336c[_0x1af3('0x78')][_0x5dab74][_0x1af3('0x8b')]));}}}if(_0x51336c['conditions']){_0x51336c[_0x1af3('0x7d')]=JSON[_0x1af3('0x79')](_0x51336c[_0x1af3('0x7d')]);_0x233fcc[_0x1af3('0x3c')](_0xfce05d(_0x51336c[_0x1af3('0x7d')][_0x1af3('0x67')]));}_0x3feb3c=_0x233fcc['clone']();_0x233fcc['limit'](_0x1e2b08);_0x233fcc[_0x1af3('0x1d')](0x0);return;}})[_0x1af3('0x23')](function(){if(_0x29c85c[_0x1af3('0x8c')]===_0x1af3('0x8d')){return null;}var _0x46997d=_[_0x1af3('0x48')](_0x29c85c,{'name':_0x29c85c[_0x1af3('0x8e')]||_0x29c85c[_0x1af3('0x29')]||_0x51336c[_0x1af3('0x29')],'basename':_0x24a6c2,'savename':util[_0x1af3('0x73')](_0x1af3('0x8f'),_0x29c85c[_0x1af3('0x29')]||_0x51336c[_0x1af3('0x29')],require(_0x1af3('0x90'))['generate'](0x4),_0x29c85c[_0x1af3('0x8c')]||_0x1af3('0x91')),'reportId':_0x51336c['id'],'reportType':'custom'});return db[_0x1af3('0x92')]['create'](_0x46997d,{'raw':!![]});})[_0x1af3('0x23')](function(_0x5abd6c){if(_0x51336c['table']===_0x1af3('0x93')){_0x3feb3c[_0x1af3('0x3c')](_0x51336c[_0x1af3('0x6e')]+_0x1af3('0x94'),_0x29c85c['startDate'],_0x29c85c['endDate']);}else{_0x3feb3c[_0x1af3('0x3c')](_0x51336c[_0x1af3('0x6e')]+_0x1af3('0x95'),_0x29c85c['startDate'],_0x29c85c[_0x1af3('0x96')]);}if(_0x5abd6c){logger['info'](_0x1af3('0x97'),_0x3feb3c[_0x1af3('0x80')]());require(_0x1af3('0x98'))[_0x1af3('0x99')](path['join'](__dirname,_0x1af3('0x9a'),_0x5abd6c['output']),[_0x5abd6c['id'],_0x3feb3c[_0x1af3('0x80')](),path[_0x1af3('0x84')](__dirname,'../../files/reports',_0x5abd6c[_0x1af3('0x9b')]),_0x24a6c2]);return _0x5abd6c;}else{var _0x2333d1=squel[_0x1af3('0x6d')]();_0x2333d1['from']('('+_0x3feb3c[_0x1af3('0x80')]()+')',_0x1af3('0x9c'));_0x2333d1['field'](_0x1af3('0x9d'),_0x1af3('0x1f'));_0x3feb3c[_0x1af3('0x39')](_0x29c85c[_0x1af3('0x39')]||_0x1e2b08);_0x3feb3c[_0x1af3('0x1d')](_0x29c85c[_0x1af3('0x1d')]||0x0);return dbH[_0x1af3('0x81')]['query'](_0x2333d1[_0x1af3('0x80')](),{'type':dbH[_0x1af3('0x81')][_0x1af3('0x82')][_0x1af3('0x83')]})[_0x1af3('0x23')](function(_0x3d1d85){if(!_0x3d1d85[_0x1af3('0x46')]){_0x4db220=0x0;}else{_0x4db220=_0x3d1d85[0x0][_0x1af3('0x1f')]||0x0;}return dbH[_0x1af3('0x81')][_0x1af3('0x32')](_0x3feb3c[_0x1af3('0x80')](),{'type':dbH[_0x1af3('0x81')][_0x1af3('0x82')]['SELECT']});})['then'](function(_0x466d1f){return{'rows':_0x466d1f||[],'count':_0x4db220};});}});}exports[_0x1af3('0x9e')]=function(_0x150b91,_0x51c27a){return runReport(_0x150b91['params'],_0x150b91['query'],_0x150b91[_0x1af3('0x40')])['then'](respondWithResult(_0x51c27a,null))['catch'](handleError(_0x51c27a,null));};exports[_0x1af3('0x9f')]=runReport;exports[_0x1af3('0x32')]=function(_0x5220d2,_0x24d994){var _0x2ff53e=0xa;var _0xe750b2=[_0x1af3('0x84'),_0x1af3('0x85'),_0x1af3('0x53'),_0x1af3('0x54')];var _0x54c395={'SUM':_0x1af3('0x55'),'COUNT':_0x1af3('0x56'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x1af3('0x58'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x1af3('0x5b'),'GROUP_CONCAT ASC':_0x1af3('0x86'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x295066={'SEC_TO_TIME':_0x1af3('0x5c'),'DATE':_0x1af3('0x5d'),'HOUR':_0x1af3('0x5e'),'ROUND':_0x1af3('0x5f'),'UNIX_TIMESTAMP':_0x1af3('0x60')};var _0x34e185=function(_0x3c1f1f){return!_['includes']([_0x1af3('0x62'),_0x1af3('0x63'),'IS\x20EMPTY',_0x1af3('0xa0')],_0x3c1f1f);};var _0x52df67=function(_0x42be5c){if(!_0x42be5c||!_0x42be5c[_0x1af3('0x65')][_0x1af3('0x46')]){return'';}for(var _0x594eaa='(',_0xe8f3cf=0x0;_0xe8f3cf<_0x42be5c[_0x1af3('0x65')][_0x1af3('0x46')];_0xe8f3cf+=0x1){_0xe8f3cf>0x0&&(_0x594eaa+='\x20'+_0x42be5c['operator']+'\x20');_0x594eaa+=_0x42be5c['rules'][_0xe8f3cf]['group']?_0x52df67(_0x42be5c['rules'][_0xe8f3cf][_0x1af3('0x67')]):_0x42be5c[_0x1af3('0x65')][_0xe8f3cf]['field']+'\x20'+_0x42be5c['rules'][_0xe8f3cf]['condition']+(_0x34e185(_0x42be5c[_0x1af3('0x65')][_0xe8f3cf][_0x1af3('0x68')])?'\x20'+_0x42be5c['rules'][_0xe8f3cf][_0x1af3('0x69')]:'');}return _0x594eaa+')';};var _0x594ea3={'where':{'id':_0x5220d2['params']['id']}},_0x4269a7,_0x56b964,_0x5bd08e,_0x3338a1,_0x31d35e;_0x594ea3=_[_0x1af3('0x48')]({},_0x594ea3,_0x5220d2[_0x1af3('0x40')]);return db[_0x1af3('0x2c')][_0x1af3('0x4e')](_0x594ea3)['then'](function(_0x330a3a){if(_0x330a3a){_0x4269a7=_0x330a3a;return _0x330a3a[_0x1af3('0x6a')]();}return null;})[_0x1af3('0x23')](function(_0x4f25cc){if(_0x4f25cc){if(!_0x4f25cc['length']){throw new db[(_0x1af3('0x88'))][(_0x1af3('0x89'))](_0x1af3('0xa1'),0x193);}_0x56b964=_0x4f25cc;return db[_0x1af3('0x6b')][_0x1af3('0x42')]({'raw':!![]});}return null;})['then'](function(_0x89f2d9){if(_0x89f2d9){_0x5bd08e=_[_0x1af3('0x6c')](_0x89f2d9,'id');var _0x24793e;var _0x15debf=squel['select']();_0x15debf[_0x1af3('0x8a')](_0x4269a7[_0x1af3('0x6e')]);for(var _0x1ef6b1=0x0;_0x1ef6b1<_0x56b964[_0x1af3('0x46')];_0x1ef6b1+=0x1){_0x24793e=_0x56b964[_0x1ef6b1][_0x1af3('0x6f')]?_0x5bd08e[_0x56b964[_0x1ef6b1]['MetricId']][_0x1af3('0x70')]:_0x56b964[_0x1ef6b1][_0x1af3('0x71')];_0x24793e=_0x56b964[_0x1ef6b1]['function']?_[_0x1af3('0x74')](_0x54c395[_0x56b964[_0x1ef6b1]['function']],'%s',_0x24793e):_0x24793e;_0x24793e=_0x56b964[_0x1ef6b1][_0x1af3('0x73')]?_[_0x1af3('0x74')](_0x295066[_0x56b964[_0x1ef6b1][_0x1af3('0x73')]],'%s',_0x24793e):_0x24793e;if(_0x56b964[_0x1ef6b1][_0x1af3('0x75')]){_0x15debf[_0x1af3('0x67')](_0x24793e);}_0x56b964[_0x1ef6b1]['orderBy']&&_0x15debf[_0x1af3('0x3a')](_0x24793e,_0x56b964[_0x1ef6b1][_0x1af3('0x76')]==='DESC'?![]:!![]);_0x15debf[_0x1af3('0x71')](_0x24793e,_0x56b964[_0x1ef6b1]['alias']||_0x24793e);}if(_0x4269a7[_0x1af3('0x78')]){_0x4269a7['joins']=JSON['parse'](_0x4269a7[_0x1af3('0x78')]);for(var _0x2007be=0x0;_0x2007be<_0x4269a7[_0x1af3('0x78')][_0x1af3('0x46')];_0x2007be+=0x1){if(_0x4269a7[_0x1af3('0x78')][_0x2007be][_0x1af3('0x2f')]&&_[_0x1af3('0x61')](_0xe750b2,_0x4269a7[_0x1af3('0x78')][_0x2007be]['type'])&&_0x4269a7[_0x1af3('0x78')][_0x2007be][_0x1af3('0x7a')]&&_0x4269a7['joins'][_0x2007be][_0x1af3('0x7b')]&&_0x4269a7['joins'][_0x2007be][_0x1af3('0x8b')]){_0x15debf[_0x4269a7[_0x1af3('0x78')][_0x2007be][_0x1af3('0x2f')]](_0x4269a7[_0x1af3('0x78')][_0x2007be]['foreignTable'],null,util[_0x1af3('0x73')]('%s.%s\x20=\x20%s.%s',_0x4269a7['table'],_0x4269a7[_0x1af3('0x78')][_0x2007be][_0x1af3('0x7a')],_0x4269a7[_0x1af3('0x78')][_0x2007be][_0x1af3('0x7b')],_0x4269a7[_0x1af3('0x78')][_0x2007be][_0x1af3('0x8b')]));}}}if(_0x4269a7['conditions']){_0x4269a7[_0x1af3('0x7d')]=JSON[_0x1af3('0x79')](_0x4269a7[_0x1af3('0x7d')]);_0x15debf[_0x1af3('0x3c')](_0x52df67(_0x4269a7[_0x1af3('0x7d')][_0x1af3('0x67')]));}_0x31d35e=_0x15debf[_0x1af3('0x7e')]();_0x15debf['limit'](_0x2ff53e);_0x15debf[_0x1af3('0x1d')](0x0);logger[_0x1af3('0xa2')](_0x1af3('0x7f'),_0x15debf[_0x1af3('0x80')]());return dbH[_0x1af3('0x81')]['query'](_0x15debf[_0x1af3('0x80')](),{'type':dbH[_0x1af3('0x81')]['QueryTypes'][_0x1af3('0x83')]});}})[_0x1af3('0x23')](function(){return{'sql':_0x31d35e[_0x1af3('0x80')]()};})[_0x1af3('0x23')](respondWithResult(_0x24d994,null))[_0x1af3('0x49')](handleError(_0x24d994,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 5234f0f..3153eb7 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 _0x2955=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util'];(function(_0x4dbdda,_0x11f07c){var _0x1acbf1=function(_0x1a9fc8){while(--_0x1a9fc8){_0x4dbdda['push'](_0x4dbdda['shift']());}};_0x1acbf1(++_0x11f07c);}(_0x2955,0x1d2));var _0x5295=function(_0x58c58b,_0x591f9d){_0x58c58b=_0x58c58b-0x0;var _0x30b446=_0x2955[_0x58c58b];return _0x30b446;};'use strict';var _=require(_0x5295('0x0'));var util=require(_0x5295('0x1'));var logger=require(_0x5295('0x2'))(_0x5295('0x3'));var moment=require('moment');var BPromise=require(_0x5295('0x4'));var rp=require(_0x5295('0x5'));var fs=require('fs');var path=require(_0x5295('0x6'));var rimraf=require('rimraf');var config=require(_0x5295('0x7'));var attributes=require(_0x5295('0x8'));module[_0x5295('0x9')]=function(_0x4c61f9,_0x50b501){return _0x4c61f9[_0x5295('0xa')](_0x5295('0xb'),attributes,{'tableName':_0x5295('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67fb=['api','moment','path','rimraf','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','../../config/logger'];(function(_0xad98bd,_0x3d90b6){var _0x15a655=function(_0x1e1d9a){while(--_0x1e1d9a){_0xad98bd['push'](_0xad98bd['shift']());}};_0x15a655(++_0x3d90b6);}(_0x67fb,0x12b));var _0xb67f=function(_0x1e21c7,_0x23dbed){_0x1e21c7=_0x1e21c7-0x0;var _0x21e5c6=_0x67fb[_0x1e21c7];return _0x21e5c6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb67f('0x0'))(_0xb67f('0x1'));var moment=require(_0xb67f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb67f('0x3'));var rimraf=require(_0xb67f('0x4'));var config=require(_0xb67f('0x5'));var attributes=require(_0xb67f('0x6'));module['exports']=function(_0x466d1f,_0x4e7467){return _0x466d1f[_0xb67f('0x7')](_0xb67f('0x8'),attributes,{'tableName':_0xb67f('0x9'),'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 83eed8a..fec2b96 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 _0xec57=['debug','AnalyticCustomReport,\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','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4d21b3,_0x149d2b){var _0x73fc33=function(_0x18b755){while(--_0x18b755){_0x4d21b3['push'](_0x4d21b3['shift']());}};_0x73fc33(++_0x149d2b);}(_0xec57,0x161));var _0x7ec5=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xec57[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0x7ec5('0x0'));var util=require(_0x7ec5('0x1'));var moment=require(_0x7ec5('0x2'));var BPromise=require(_0x7ec5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ec5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ec5('0x5'));var logger=require(_0x7ec5('0x6'))(_0x7ec5('0x7'));var config=require(_0x7ec5('0x8'));var jayson=require(_0x7ec5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x571924,_0x2cefc9,_0x1a8573){return new BPromise(function(_0x39b040,_0x500a4c){return client[_0x7ec5('0xa')](_0x571924,_0x1a8573)[_0x7ec5('0xb')](function(_0x496056){logger[_0x7ec5('0xc')](_0x7ec5('0xd'),_0x2cefc9,_0x7ec5('0xe'));logger[_0x7ec5('0xf')](_0x7ec5('0x10'),_0x2cefc9,_0x7ec5('0xe'),JSON[_0x7ec5('0x11')](_0x496056));if(_0x496056[_0x7ec5('0x12')]){if(_0x496056[_0x7ec5('0x12')][_0x7ec5('0x13')]===0x1f4){logger[_0x7ec5('0x12')](_0x7ec5('0xd'),_0x2cefc9,_0x496056[_0x7ec5('0x12')][_0x7ec5('0x14')]);return _0x500a4c(_0x496056[_0x7ec5('0x12')][_0x7ec5('0x14')]);}logger['error'](_0x7ec5('0xd'),_0x2cefc9,_0x496056[_0x7ec5('0x12')][_0x7ec5('0x14')]);return _0x39b040(_0x496056['error'][_0x7ec5('0x14')]);}else{logger[_0x7ec5('0xc')](_0x7ec5('0xd'),_0x2cefc9,_0x7ec5('0xe'));_0x39b040(_0x496056[_0x7ec5('0x15')][_0x7ec5('0x14')]);}})[_0x7ec5('0x16')](function(_0x1e3a8f){logger[_0x7ec5('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2cefc9,_0x1e3a8f);_0x500a4c(_0x1e3a8f);});});} \ No newline at end of file +var _0x4229=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x103d9c,_0x17446a){var _0x16ded6=function(_0x35f63c){while(--_0x35f63c){_0x103d9c['push'](_0x103d9c['shift']());}};_0x16ded6(++_0x17446a);}(_0x4229,0x13c));var _0x9422=function(_0x436a7,_0x24c501){_0x436a7=_0x436a7-0x0;var _0x59e11e=_0x4229[_0x436a7];return _0x59e11e;};'use strict';var _=require(_0x9422('0x0'));var util=require('util');var moment=require(_0x9422('0x1'));var BPromise=require(_0x9422('0x2'));var rs=require(_0x9422('0x3'));var fs=require('fs');var Redis=require(_0x9422('0x4'));var db=require(_0x9422('0x5'))['db'];var utils=require(_0x9422('0x6'));var logger=require(_0x9422('0x7'))(_0x9422('0x8'));var config=require(_0x9422('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9422('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27d5cd,_0x296dee,_0x293278){return new BPromise(function(_0x4f9b76,_0x2d2db4){return client[_0x9422('0xb')](_0x27d5cd,_0x293278)[_0x9422('0xc')](function(_0x326414){logger[_0x9422('0xd')](_0x9422('0xe'),_0x296dee,_0x9422('0xf'));logger[_0x9422('0x10')](_0x9422('0x11'),_0x296dee,'request\x20sent',JSON[_0x9422('0x12')](_0x326414));if(_0x326414[_0x9422('0x13')]){if(_0x326414[_0x9422('0x13')][_0x9422('0x14')]===0x1f4){logger[_0x9422('0x13')](_0x9422('0xe'),_0x296dee,_0x326414[_0x9422('0x13')]['message']);return _0x2d2db4(_0x326414[_0x9422('0x13')]['message']);}logger[_0x9422('0x13')](_0x9422('0xe'),_0x296dee,_0x326414['error'][_0x9422('0x15')]);return _0x4f9b76(_0x326414['error'][_0x9422('0x15')]);}else{logger[_0x9422('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x296dee,'request\x20sent');_0x4f9b76(_0x326414['result'][_0x9422('0x15')]);}})[_0x9422('0x16')](function(_0x1f58f9){logger['error'](_0x9422('0xe'),_0x296dee,_0x1f58f9);_0x2d2db4(_0x1f58f9);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 2302647..3fa2464 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 _0x2e8a=['/:id/query','query','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','show','preview','get','/:id/run','run'];(function(_0x44fcda,_0x3efd79){var _0x2181c4=function(_0x52e48d){while(--_0x52e48d){_0x44fcda['push'](_0x44fcda['shift']());}};_0x2181c4(++_0x3efd79);}(_0x2e8a,0x1c3));var _0xa2e8=function(_0x1e1f17,_0x4bd574){_0x1e1f17=_0x1e1f17-0x0;var _0x465b52=_0x2e8a[_0x1e1f17];return _0x465b52;};'use strict';var multer=require(_0xa2e8('0x0'));var util=require(_0xa2e8('0x1'));var path=require(_0xa2e8('0x2'));var timeout=require(_0xa2e8('0x3'));var express=require(_0xa2e8('0x4'));var router=express[_0xa2e8('0x5')]();var fs_extra=require(_0xa2e8('0x6'));var auth=require(_0xa2e8('0x7'));var interaction=require(_0xa2e8('0x8'));var config=require(_0xa2e8('0x9'));var controller=require(_0xa2e8('0xa'));router['get']('/',auth[_0xa2e8('0xb')](),controller['index']);router['get']('/:id',auth[_0xa2e8('0xb')](),controller[_0xa2e8('0xc')]);router['get']('/:id/preview',auth[_0xa2e8('0xb')](),controller[_0xa2e8('0xd')]);router[_0xa2e8('0xe')](_0xa2e8('0xf'),auth[_0xa2e8('0xb')](),controller[_0xa2e8('0x10')]);router['get'](_0xa2e8('0x11'),auth[_0xa2e8('0xb')](),controller[_0xa2e8('0x12')]);router[_0xa2e8('0x13')]('/',auth[_0xa2e8('0xb')](),controller[_0xa2e8('0x14')]);router[_0xa2e8('0x15')](_0xa2e8('0x16'),auth[_0xa2e8('0xb')](),controller[_0xa2e8('0x17')]);router['delete'](_0xa2e8('0x16'),auth[_0xa2e8('0xb')](),controller[_0xa2e8('0x18')]);module[_0xa2e8('0x19')]=router; \ No newline at end of file +var _0x00e9=['./analyticCustomReport.controller','get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x00e9,0xf5));var _0x900e=function(_0x2121fc,_0x47c47b){_0x2121fc=_0x2121fc-0x0;var _0x1a37c6=_0x00e9[_0x2121fc];return _0x1a37c6;};'use strict';var multer=require(_0x900e('0x0'));var util=require(_0x900e('0x1'));var path=require('path');var timeout=require(_0x900e('0x2'));var express=require(_0x900e('0x3'));var router=express[_0x900e('0x4')]();var fs_extra=require(_0x900e('0x5'));var auth=require(_0x900e('0x6'));var interaction=require(_0x900e('0x7'));var config=require('../../config/environment');var controller=require(_0x900e('0x8'));router[_0x900e('0x9')]('/',auth[_0x900e('0xa')](),controller['index']);router[_0x900e('0x9')](_0x900e('0xb'),auth[_0x900e('0xa')](),controller[_0x900e('0xc')]);router[_0x900e('0x9')](_0x900e('0xd'),auth[_0x900e('0xa')](),controller[_0x900e('0xe')]);router[_0x900e('0x9')](_0x900e('0xf'),auth['isAuthenticated'](),controller[_0x900e('0x10')]);router[_0x900e('0x9')](_0x900e('0x11'),auth[_0x900e('0xa')](),controller[_0x900e('0x12')]);router[_0x900e('0x13')]('/',auth[_0x900e('0xa')](),controller['create']);router['put'](_0x900e('0xb'),auth[_0x900e('0xa')](),controller[_0x900e('0x14')]);router['delete'](_0x900e('0xb'),auth[_0x900e('0xa')](),controller[_0x900e('0x15')]);module[_0x900e('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 219e384..59f0032 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 _0x33c5=['STRING','TEXT','exports'];(function(_0x5df10a,_0x3776c4){var _0x33c54e=function(_0x1155c3){while(--_0x1155c3){_0x5df10a['push'](_0x5df10a['shift']());}};_0x33c54e(++_0x3776c4);}(_0x33c5,0xe6));var _0x533c=function(_0x9d1e6b,_0x3bdc22){_0x9d1e6b=_0x9d1e6b-0x0;var _0x2b3070=_0x33c5[_0x9d1e6b];return _0x2b3070;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'name':{'type':Sequelize[_0x533c('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x533c('0x1')]},'table':{'type':Sequelize[_0x533c('0x1')]},'conditions':{'type':Sequelize[_0x533c('0x2')]},'joins':{'type':Sequelize[_0x533c('0x2')]}}; \ No newline at end of file +var _0x31f0=['sequelize','STRING','TEXT'];(function(_0x4e9c03,_0xd8dc1b){var _0x5486a5=function(_0x4f5578){while(--_0x4f5578){_0x4e9c03['push'](_0x4e9c03['shift']());}};_0x5486a5(++_0xd8dc1b);}(_0x31f0,0xb7));var _0x031f=function(_0xbc6afa,_0x22b8ae){_0xbc6afa=_0xbc6afa-0x0;var _0x100df9=_0x31f0[_0xbc6afa];return _0x100df9;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'name':{'type':Sequelize[_0x031f('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x031f('0x1')]},'table':{'type':Sequelize[_0x031f('0x1')]},'conditions':{'type':Sequelize[_0x031f('0x2')]},'joins':{'type':Sequelize[_0x031f('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 5a54b45..8f640ac 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 _0x326f=['order','orderBy','DESC','joins','foreignTable','foreignKey','parentKey','conditions','Limited\x20Query:','toString','sequelize','SELECT','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','UNIX_TIMESTAMP(%s)','operator','AnalyticMetric','select','from','function','parse','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','join','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','SEC_TO_TIME(%s)','debug','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','count','apply','update','then','get','DefaultReports','UserProfileResource','destroy','end','error','name','send','index','map','AnalyticDefaultReport','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','left_join','right_join','cross_join','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','table','MetricId','metric','format','replace','groupBy'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x326f,0xd1));var _0xf326=function(_0x13f38c,_0x262c16){_0x13f38c=_0x13f38c-0x0;var _0x3826fb=_0x326f[_0x13f38c];return _0x3826fb;};'use strict';var emlformat=require(_0xf326('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf326('0x1'));var rp=require(_0xf326('0x2'));var moment=require(_0xf326('0x3'));var BPromise=require(_0xf326('0x4'));var Mustache=require(_0xf326('0x5'));var util=require(_0xf326('0x6'));var path=require(_0xf326('0x7'));var sox=require(_0xf326('0x8'));var csv=require(_0xf326('0x9'));var ejs=require(_0xf326('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf326('0x17'))[_0xf326('0x18')];function respondWithStatusCode(_0x4b3966,_0x342fe5){_0x342fe5=_0x342fe5||0xcc;return function(_0x472632){if(_0x472632){return _0x4b3966[_0xf326('0x19')](_0x342fe5);}return _0x4b3966[_0xf326('0x1a')](_0x342fe5)['end']();};}function respondWithResult(_0x45c1b6,_0x5204ee){_0x5204ee=_0x5204ee||0xc8;return function(_0x54bd1a){if(_0x54bd1a){return _0x45c1b6[_0xf326('0x1a')](_0x5204ee)[_0xf326('0x1b')](_0x54bd1a);}};}function respondWithFilteredResult(_0x1f2e5a,_0xa63d1a){return function(_0x292f4b){if(_0x292f4b){var _0x287a2a=typeof _0xa63d1a[_0xf326('0x1c')]===_0xf326('0x1d')&&typeof _0xa63d1a['limit']===_0xf326('0x1d');var _0x453100=_0x292f4b[_0xf326('0x1e')];var _0x31ffb9=_0x287a2a?0x0:_0xa63d1a[_0xf326('0x1c')];var _0x311af0=_0x287a2a?_0x292f4b['count']:_0xa63d1a['offset']+_0xa63d1a['limit'];var _0x16e605;if(_0x311af0>=_0x453100){_0x311af0=_0x453100;_0x16e605=0xc8;}else{_0x16e605=0xce;}_0x1f2e5a[_0xf326('0x1a')](_0x16e605);return _0x1f2e5a['set']('Content-Range',_0x31ffb9+'-'+_0x311af0+'/'+_0x453100)[_0xf326('0x1b')](_0x292f4b);}return null;};}function patchUpdates(_0x4dfa76){return function(_0x5b6d3c){try{jsonpatch[_0xf326('0x1f')](_0x5b6d3c,_0x4dfa76,!![]);}catch(_0x18ead3){return BPromise['reject'](_0x18ead3);}return _0x5b6d3c['save']();};}function saveUpdates(_0x19b8ba,_0xb1efcf){return function(_0x5f21a2){if(_0x5f21a2){return _0x5f21a2[_0xf326('0x20')](_0x19b8ba)[_0xf326('0x21')](function(_0x43c53e){return _0x43c53e;});}return null;};}function removeEntity(_0x295752,_0x17c157){return function(_0x2049ec){if(_0x2049ec){return _0x2049ec['destroy']()['then'](function(){var _0x4f31f6=_0x2049ec[_0xf326('0x22')]({'plain':!![]});var _0x1a2c4e=_0xf326('0x23');return db[_0xf326('0x24')][_0xf326('0x25')]({'where':{'type':_0x1a2c4e,'resourceId':_0x4f31f6['id']}})[_0xf326('0x21')](function(){return _0x2049ec;});})['then'](function(){_0x295752[_0xf326('0x1a')](0xcc)[_0xf326('0x26')]();});}};}function handleEntityNotFound(_0x212d5d,_0x581531){return function(_0x1617d2){if(!_0x1617d2){_0x212d5d['sendStatus'](0x194);}return _0x1617d2;};}function handleError(_0x4a9abf,_0x6a8e89){_0x6a8e89=_0x6a8e89||0x1f4;return function(_0x1ae23a){logger[_0xf326('0x27')](_0x1ae23a['stack']);if(_0x1ae23a[_0xf326('0x28')]){delete _0x1ae23a[_0xf326('0x28')];}_0x4a9abf['status'](_0x6a8e89)[_0xf326('0x29')](_0x1ae23a);};}exports[_0xf326('0x2a')]=function(_0xd77aba,_0x18d110){var _0xa80156={},_0x269be9={},_0x161143={'count':0x0,'rows':[]};var _0x39a1e2=_[_0xf326('0x2b')](db[_0xf326('0x2c')]['rawAttributes'],function(_0x1035ed){return{'name':_0x1035ed[_0xf326('0x2d')],'type':_0x1035ed[_0xf326('0x2e')]['key']};});_0x269be9[_0xf326('0x2f')]=_[_0xf326('0x2b')](_0x39a1e2,_0xf326('0x28'));_0x269be9['query']=_['keys'](_0xd77aba[_0xf326('0x30')]);_0x269be9[_0xf326('0x31')]=_[_0xf326('0x32')](_0x269be9[_0xf326('0x2f')],_0x269be9[_0xf326('0x30')]);_0xa80156[_0xf326('0x33')]=_[_0xf326('0x32')](_0x269be9[_0xf326('0x2f')],qs['fields'](_0xd77aba[_0xf326('0x30')][_0xf326('0x34')]));_0xa80156['attributes']=_0xa80156[_0xf326('0x33')]['length']?_0xa80156[_0xf326('0x33')]:_0x269be9['model'];if(!_0xd77aba['query'][_0xf326('0x35')]('nolimit')){_0xa80156[_0xf326('0x36')]=qs['limit'](_0xd77aba[_0xf326('0x30')][_0xf326('0x36')]);_0xa80156[_0xf326('0x1c')]=qs['offset'](_0xd77aba[_0xf326('0x30')][_0xf326('0x1c')]);}_0xa80156['order']=qs[_0xf326('0x37')](_0xd77aba[_0xf326('0x30')][_0xf326('0x37')]);_0xa80156[_0xf326('0x38')]=qs['filters'](_[_0xf326('0x39')](_0xd77aba[_0xf326('0x30')],_0x269be9[_0xf326('0x31')]),_0x39a1e2);if(_0xd77aba[_0xf326('0x30')][_0xf326('0x3a')]){_0xa80156['where']=_[_0xf326('0x3b')](_0xa80156[_0xf326('0x38')],{'$or':_['map'](_0x39a1e2,function(_0x4dd361){if(_0x4dd361[_0xf326('0x2e')]!=='VIRTUAL'){var _0x55dfa8={};_0x55dfa8[_0x4dd361[_0xf326('0x28')]]={'$like':'%'+_0xd77aba['query'][_0xf326('0x3a')]+'%'};return _0x55dfa8;}})});}_0xa80156=_[_0xf326('0x3b')]({},_0xa80156,_0xd77aba[_0xf326('0x3c')]);var _0x39611e={'where':_0xa80156['where']};return db[_0xf326('0x2c')][_0xf326('0x1e')](_0x39611e)[_0xf326('0x21')](function(_0x365627){_0x161143[_0xf326('0x1e')]=_0x365627;if(_0xd77aba[_0xf326('0x30')][_0xf326('0x3d')]){_0xa80156[_0xf326('0x3e')]=[{'all':!![]}];}return db[_0xf326('0x2c')][_0xf326('0x3f')](_0xa80156);})[_0xf326('0x21')](function(_0x2bab13){_0x161143['rows']=_0x2bab13;return _0x161143;})[_0xf326('0x21')](respondWithFilteredResult(_0x18d110,_0xa80156))[_0xf326('0x40')](handleError(_0x18d110,null));};exports[_0xf326('0x41')]=function(_0x270288,_0x1dd262){var _0x1a2d0d={'raw':!![],'where':{'id':_0x270288[_0xf326('0x42')]['id']}},_0x4f4c51={};_0x4f4c51[_0xf326('0x2f')]=_['keys'](db[_0xf326('0x2c')][_0xf326('0x43')]);_0x4f4c51[_0xf326('0x30')]=_[_0xf326('0x44')](_0x270288[_0xf326('0x30')]);_0x4f4c51['filters']=_['intersection'](_0x4f4c51[_0xf326('0x2f')],_0x4f4c51[_0xf326('0x30')]);_0x1a2d0d['attributes']=_['intersection'](_0x4f4c51[_0xf326('0x2f')],qs[_0xf326('0x34')](_0x270288[_0xf326('0x30')]['fields']));_0x1a2d0d[_0xf326('0x33')]=_0x1a2d0d[_0xf326('0x33')][_0xf326('0x45')]?_0x1a2d0d[_0xf326('0x33')]:_0x4f4c51[_0xf326('0x2f')];if(_0x270288[_0xf326('0x30')][_0xf326('0x3d')]){_0x1a2d0d[_0xf326('0x3e')]=[{'all':!![]}];}_0x1a2d0d=_[_0xf326('0x3b')]({},_0x1a2d0d,_0x270288[_0xf326('0x3c')]);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x1a2d0d)[_0xf326('0x21')](handleEntityNotFound(_0x1dd262,null))[_0xf326('0x21')](respondWithResult(_0x1dd262,null))[_0xf326('0x40')](handleError(_0x1dd262,null));};exports['create']=function(_0x199f8b,_0x1b0e03){return db[_0xf326('0x2c')][_0xf326('0x47')](_0x199f8b['body'],{})[_0xf326('0x21')](function(_0x2f5511){var _0xca88e=_0x199f8b[_0xf326('0x48')]['get']({'plain':!![]});if(!_0xca88e)throw new Error(_0xf326('0x49'));if(_0xca88e[_0xf326('0x4a')]===_0xf326('0x48')){var _0x451ac7=_0x2f5511[_0xf326('0x22')]({'plain':!![]});var _0x4970fb='Reports';return db[_0xf326('0x4b')][_0xf326('0x46')]({'where':{'name':_0x4970fb,'userProfileId':_0xca88e[_0xf326('0x4c')]},'raw':!![]})['then'](function(_0x102fba){if(_0x102fba&&_0x102fba[_0xf326('0x4d')]===0x0){return db[_0xf326('0x24')]['create']({'name':_0x451ac7['name'],'resourceId':_0x451ac7['id'],'type':_0xf326('0x23'),'sectionId':_0x102fba['id']},{})['then'](function(){return _0x2f5511;});}else{return _0x2f5511;}})[_0xf326('0x40')](function(_0x554277){logger[_0xf326('0x27')](_0xf326('0x4e'),_0x554277);throw _0x554277;});}return _0x2f5511;})[_0xf326('0x21')](respondWithResult(_0x1b0e03,0xc9))[_0xf326('0x40')](handleError(_0x1b0e03,null));};exports[_0xf326('0x20')]=function(_0x35d3c8,_0x7f7ece){if(_0x35d3c8['body']['id']){delete _0x35d3c8[_0xf326('0x4f')]['id'];}return db[_0xf326('0x2c')][_0xf326('0x46')]({'where':{'id':_0x35d3c8['params']['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x7f7ece,null))[_0xf326('0x21')](saveUpdates(_0x35d3c8[_0xf326('0x4f')],null))[_0xf326('0x21')](respondWithResult(_0x7f7ece,null))[_0xf326('0x40')](handleError(_0x7f7ece,null));};exports['destroy']=function(_0x161fb3,_0x21eac7){return db[_0xf326('0x2c')][_0xf326('0x46')]({'where':{'id':_0x161fb3['params']['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x21eac7,null))[_0xf326('0x21')](removeEntity(_0x21eac7,null))[_0xf326('0x40')](handleError(_0x21eac7,null));};exports[_0xf326('0x50')]=function(_0x4d3b9e,_0x5be2b1){var _0x18b46e=0xa;var _0x44d2ed=['join',_0xf326('0x51'),_0xf326('0x52'),_0xf326('0x53')];var _0x1258d1={'SUM':'SUM(%s)','COUNT':_0xf326('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xf326('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':_0xf326('0x57'),'GROUP_CONCAT DESC':_0xf326('0x58')};var _0x4eef49={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf326('0x59'),'HOUR':_0xf326('0x5a'),'ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2759d7=function(_0x487020){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x487020);};var _0x18dbfc=function(_0x23a9e8){if(!_0x23a9e8||!_0x23a9e8[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x33f9dd='(',_0x33ffb8=0x0;_0x33ffb8<_0x23a9e8[_0xf326('0x61')][_0xf326('0x45')];_0x33ffb8+=0x1){_0x33ffb8>0x0&&(_0x33f9dd+='\x20'+_0x23a9e8['operator']+'\x20');_0x33f9dd+=_0x23a9e8[_0xf326('0x61')][_0x33ffb8]['group']?_0x18dbfc(_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x62')]):_0x23a9e8['rules'][_0x33ffb8][_0xf326('0x63')]+'\x20'+_0x23a9e8['rules'][_0x33ffb8][_0xf326('0x64')]+(_0x2759d7(_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x64')])?'\x20'+_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x65')]:'');}return _0x33f9dd+')';};var _0x51ff5e={'where':{'id':_0x4d3b9e[_0xf326('0x42')]['id']}},_0x4ec099,_0x1209ca,_0x32fe3a,_0x15a538,_0x21b3cc;_0x51ff5e=_['merge']({},_0x51ff5e,_0x4d3b9e[_0xf326('0x3c')]);return db[_0xf326('0x2c')]['find'](_0x51ff5e)['then'](function(_0x5b25ca){if(_0x5b25ca){_0x4ec099=_0x5b25ca;return _0x5b25ca[_0xf326('0x66')]();}return null;})[_0xf326('0x21')](function(_0x4150fa){if(_0x4150fa){if(!_0x4150fa[_0xf326('0x45')]){throw new db[(_0xf326('0x67'))][(_0xf326('0x68'))](_0xf326('0x69'),0x193);}_0x1209ca=_0x4150fa;return db['AnalyticMetric'][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x3c3379){if(_0x3c3379){_0x32fe3a=_[_0xf326('0x6a')](_0x3c3379,'id');var _0x58de1e;var _0x3717fe=squel['select']();_0x3717fe['from'](_0x4ec099[_0xf326('0x6b')]);for(var _0x540fa0=0x0;_0x540fa0<_0x1209ca[_0xf326('0x45')];_0x540fa0+=0x1){_0x58de1e=_0x1209ca[_0x540fa0][_0xf326('0x6c')]?_0x32fe3a[_0x1209ca[_0x540fa0][_0xf326('0x6c')]][_0xf326('0x6d')]:_0x1209ca[_0x540fa0][_0xf326('0x63')];_0x58de1e=_0x1209ca[_0x540fa0]['function']?_['replace'](_0x1258d1[_0x1209ca[_0x540fa0]['function']],'%s',_0x58de1e):_0x58de1e;_0x58de1e=_0x1209ca[_0x540fa0][_0xf326('0x6e')]?_[_0xf326('0x6f')](_0x4eef49[_0x1209ca[_0x540fa0][_0xf326('0x6e')]],'%s',_0x58de1e):_0x58de1e;if(_0x1209ca[_0x540fa0][_0xf326('0x70')]){_0x3717fe[_0xf326('0x62')](_0x58de1e);}_0x1209ca[_0x540fa0]['orderBy']&&_0x3717fe[_0xf326('0x71')](_0x58de1e,_0x1209ca[_0x540fa0][_0xf326('0x72')]===_0xf326('0x73')?![]:!![]);_0x3717fe['field'](_0x58de1e,_0x1209ca[_0x540fa0]['alias']||_0x58de1e);}if(_0x4ec099[_0xf326('0x74')]){_0x4ec099[_0xf326('0x74')]=JSON['parse'](_0x4ec099['joins']);for(var _0x2497fd=0x0;_0x2497fd<_0x4ec099['joins'][_0xf326('0x45')];_0x2497fd+=0x1){if(_0x4ec099['joins'][_0x2497fd]['type']&&_['includes'](_0x44d2ed,_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x2e')])&&_0x4ec099[_0xf326('0x74')][_0x2497fd]['parentKey']&&_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')]&&_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x76')]){_0x3717fe[_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x2e')]](_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')],null,util[_0xf326('0x6e')]('%s.%s\x20=\x20%s.%s',_0x4ec099[_0xf326('0x6b')],_0x4ec099['joins'][_0x2497fd][_0xf326('0x77')],_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')],_0x4ec099['joins'][_0x2497fd][_0xf326('0x76')]));}}}if(_0x4ec099[_0xf326('0x78')]){_0x4ec099[_0xf326('0x78')]=JSON['parse'](_0x4ec099[_0xf326('0x78')]);_0x3717fe[_0xf326('0x38')](_0x18dbfc(_0x4ec099[_0xf326('0x78')][_0xf326('0x62')]));}_0x21b3cc=_0x3717fe['clone']();_0x3717fe[_0xf326('0x36')](_0x18b46e);_0x3717fe['offset'](0x0);logger['debug'](_0xf326('0x79'),_0x3717fe[_0xf326('0x7a')]());return dbH['sequelize']['query'](_0x3717fe['toString'](),{'type':dbH[_0xf326('0x7b')]['QueryTypes'][_0xf326('0x7c')]});}})[_0xf326('0x21')](respondWithResult(_0x5be2b1,null))[_0xf326('0x40')](handleError(_0x5be2b1,null));};function runReport(_0x2ec314,_0xf76a89,_0x25b56c){var _0x5d23f0=_0xf76a89[_0xf326('0x28')];var _0x323926=0xa;var _0x5f1724=['join',_0xf326('0x51'),'right_join',_0xf326('0x53')];var _0x147d51={'SUM':_0xf326('0x7d'),'COUNT':_0xf326('0x54'),'COUNT DISTINCT':_0xf326('0x7e'),'MAX':_0xf326('0x7f'),'MIN':_0xf326('0x55'),'AVG':_0xf326('0x80'),'GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xf326('0x58')};var _0x26bbb1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf326('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':_0xf326('0x81')};var _0x14e8c0=function(_0x5814ad){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x5814ad);};var _0x1e50aa=function(_0x148779){if(!_0x148779||!_0x148779[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x38b696='(',_0x384b46=0x0;_0x384b46<_0x148779[_0xf326('0x61')][_0xf326('0x45')];_0x384b46+=0x1){_0x384b46>0x0&&(_0x38b696+='\x20'+_0x148779[_0xf326('0x82')]+'\x20');_0x38b696+=_0x148779[_0xf326('0x61')][_0x384b46]['group']?_0x1e50aa(_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x62')]):_0x148779['rules'][_0x384b46][_0xf326('0x63')]+'\x20'+_0x148779[_0xf326('0x61')][_0x384b46]['condition']+(_0x14e8c0(_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x64')])?'\x20'+_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x65')]:'');}return _0x38b696+')';};var _0x2ab607={'where':{'id':_0x2ec314['id']}},_0x35c228,_0x1bb7cc,_0x5794d0,_0x15d61e,_0x107c00;_0x2ab607=_[_0xf326('0x3b')]({},_0x2ab607,_0x25b56c);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x2ab607)[_0xf326('0x21')](function(_0x204002){if(_0x204002){_0x35c228=_0x204002;return _0x204002[_0xf326('0x66')]();}return null;})['then'](function(_0xa8e05b){if(_0xa8e05b){if(!_0xa8e05b[_0xf326('0x45')]){throw new db['Sequelize'][(_0xf326('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1bb7cc=_0xa8e05b;return db[_0xf326('0x83')][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x2a0f36){if(_0x2a0f36){_0x5794d0=_[_0xf326('0x6a')](_0x2a0f36,'id');var _0x3097cf;var _0xf66b70=squel[_0xf326('0x84')]();_0xf66b70[_0xf326('0x85')](_0x35c228[_0xf326('0x6b')]);for(var _0x3f073c=0x0;_0x3f073c<_0x1bb7cc[_0xf326('0x45')];_0x3f073c+=0x1){_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x6c')]?_0x5794d0[_0x1bb7cc[_0x3f073c][_0xf326('0x6c')]]['metric']:_0x1bb7cc[_0x3f073c][_0xf326('0x63')];_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x86')]?_[_0xf326('0x6f')](_0x147d51[_0x1bb7cc[_0x3f073c][_0xf326('0x86')]],'%s',_0x3097cf):_0x3097cf;_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x6e')]?_['replace'](_0x26bbb1[_0x1bb7cc[_0x3f073c][_0xf326('0x6e')]],'%s',_0x3097cf):_0x3097cf;if(_0x1bb7cc[_0x3f073c][_0xf326('0x70')]){_0xf66b70[_0xf326('0x62')](_0x3097cf);}_0x1bb7cc[_0x3f073c][_0xf326('0x72')]&&_0xf66b70[_0xf326('0x71')](_0x3097cf,_0x1bb7cc[_0x3f073c]['orderBy']==='DESC'?![]:!![]);_0xf66b70[_0xf326('0x63')](_0x3097cf,_0x1bb7cc[_0x3f073c]['alias']||_0x3097cf);}if(_0x35c228[_0xf326('0x74')]){_0x35c228[_0xf326('0x74')]=JSON[_0xf326('0x87')](_0x35c228['joins']);for(var _0x54b023=0x0;_0x54b023<_0x35c228[_0xf326('0x74')][_0xf326('0x45')];_0x54b023+=0x1){if(_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x2e')]&&_[_0xf326('0x5c')](_0x5f1724,_0x35c228['joins'][_0x54b023][_0xf326('0x2e')])&&_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x77')]&&_0x35c228['joins'][_0x54b023]['foreignTable']&&_0x35c228['joins'][_0x54b023][_0xf326('0x76')]){_0xf66b70[_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x2e')]](_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x75')],null,util[_0xf326('0x6e')](_0xf326('0x88'),_0x35c228['table'],_0x35c228['joins'][_0x54b023][_0xf326('0x77')],_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x75')],_0x35c228['joins'][_0x54b023][_0xf326('0x76')]));}}}if(_0x35c228[_0xf326('0x78')]){_0x35c228[_0xf326('0x78')]=JSON['parse'](_0x35c228[_0xf326('0x78')]);_0xf66b70[_0xf326('0x38')](_0x1e50aa(_0x35c228[_0xf326('0x78')][_0xf326('0x62')]));}_0x107c00=_0xf66b70['clone']();_0xf66b70['limit'](_0x323926);_0xf66b70['offset'](0x0);return;}})[_0xf326('0x21')](function(){if(_0xf76a89[_0xf326('0x89')]===_0xf326('0x8a')){return null;}var _0x5f0b45=_[_0xf326('0x3b')](_0xf76a89,{'name':_0xf76a89[_0xf326('0x8b')]||_0xf76a89[_0xf326('0x28')]||_0x35c228['name'],'basename':_0x5d23f0,'savename':util[_0xf326('0x6e')](_0xf326('0x8c'),_0xf76a89[_0xf326('0x28')]||_0x35c228[_0xf326('0x28')],require('randomstring')[_0xf326('0x8d')](0x4),_0xf76a89['output']||_0xf326('0x8e')),'reportId':_0x35c228['id'],'reportType':_0xf326('0x8f')});return db[_0xf326('0x90')][_0xf326('0x47')](_0x5f0b45,{'raw':!![]});})['then'](function(_0x2e2f70){if(_0x35c228['table']===_0xf326('0x91')){_0x107c00[_0xf326('0x38')](_0x35c228[_0xf326('0x6b')]+_0xf326('0x92'),_0xf76a89[_0xf326('0x93')],_0xf76a89['endDate']);}else{_0x107c00['where'](_0x35c228[_0xf326('0x6b')]+_0xf326('0x94'),_0xf76a89[_0xf326('0x93')],_0xf76a89[_0xf326('0x95')]);}if(_0x2e2f70){logger['info'](_0xf326('0x96'),_0x107c00['toString']());require(_0xf326('0x97'))[_0xf326('0x98')](path[_0xf326('0x99')](__dirname,'../../components/export/',_0x2e2f70[_0xf326('0x89')]),[_0x2e2f70['id'],_0x107c00[_0xf326('0x7a')](),path[_0xf326('0x99')](__dirname,_0xf326('0x9a'),_0x2e2f70[_0xf326('0x9b')]),_0x5d23f0]);return _0x2e2f70;}else{var _0x4dc4bc=squel[_0xf326('0x84')]();_0x4dc4bc[_0xf326('0x85')]('('+_0x107c00['toString']()+')',_0xf326('0x9c'));_0x4dc4bc[_0xf326('0x63')](_0xf326('0x9d'),_0xf326('0x1e'));_0x107c00['limit'](_0xf76a89['limit']||_0x323926);_0x107c00[_0xf326('0x1c')](_0xf76a89[_0xf326('0x1c')]||0x0);return dbH['sequelize'][_0xf326('0x30')](_0x4dc4bc['toString'](),{'type':dbH['sequelize'][_0xf326('0x9e')][_0xf326('0x7c')]})[_0xf326('0x21')](function(_0x37cd6f){if(!_0x37cd6f[_0xf326('0x45')]){_0x15d61e=0x0;}else{_0x15d61e=_0x37cd6f[0x0][_0xf326('0x1e')]||0x0;}return dbH[_0xf326('0x7b')][_0xf326('0x30')](_0x107c00[_0xf326('0x7a')](),{'type':dbH['sequelize'][_0xf326('0x9e')][_0xf326('0x7c')]});})[_0xf326('0x21')](function(_0x1c7f81){return{'rows':_0x1c7f81||[],'count':_0x15d61e};});}});}exports['run']=function(_0x3e6a5d,_0x20020c){return runReport(_0x3e6a5d[_0xf326('0x42')],_0x3e6a5d[_0xf326('0x30')],_0x3e6a5d[_0xf326('0x3c')])['then'](respondWithResult(_0x20020c,null))[_0xf326('0x40')](handleError(_0x20020c,null));};exports['runReport']=runReport;exports[_0xf326('0x30')]=function(_0x14d255,_0xffd165){var _0x2bc501=0xa;var _0x4bd216=[_0xf326('0x99'),_0xf326('0x51'),_0xf326('0x52'),'cross_join'];var _0x23451e={'SUM':_0xf326('0x7d'),'COUNT':_0xf326('0x54'),'COUNT DISTINCT':_0xf326('0x7e'),'MAX':'MAX(%s)','MIN':_0xf326('0x55'),'AVG':_0xf326('0x80'),'GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':_0xf326('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x310223={'SEC_TO_TIME':_0xf326('0x9f'),'DATE':_0xf326('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':_0xf326('0x81')};var _0x539d23=function(_0x171c53){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x171c53);};var _0x4c7fc0=function(_0x4ffde1){if(!_0x4ffde1||!_0x4ffde1[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x4307d9='(',_0x2fa05b=0x0;_0x2fa05b<_0x4ffde1[_0xf326('0x61')][_0xf326('0x45')];_0x2fa05b+=0x1){_0x2fa05b>0x0&&(_0x4307d9+='\x20'+_0x4ffde1['operator']+'\x20');_0x4307d9+=_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x62')]?_0x4c7fc0(_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x62')]):_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x63')]+'\x20'+_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x64')]+(_0x539d23(_0x4ffde1[_0xf326('0x61')][_0x2fa05b]['condition'])?'\x20'+_0x4ffde1[_0xf326('0x61')][_0x2fa05b]['value']:'');}return _0x4307d9+')';};var _0x590dc0={'where':{'id':_0x14d255[_0xf326('0x42')]['id']}},_0x32fc6e,_0x549a1f,_0x1f37f9,_0x3e0918,_0x3398fd;_0x590dc0=_[_0xf326('0x3b')]({},_0x590dc0,_0x14d255[_0xf326('0x3c')]);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x590dc0)[_0xf326('0x21')](function(_0x314442){if(_0x314442){_0x32fc6e=_0x314442;return _0x314442[_0xf326('0x66')]();}return null;})[_0xf326('0x21')](function(_0x4c1fcd){if(_0x4c1fcd){if(!_0x4c1fcd[_0xf326('0x45')]){throw new db[(_0xf326('0x67'))][(_0xf326('0x68'))](_0xf326('0x69'),0x193);}_0x549a1f=_0x4c1fcd;return db[_0xf326('0x83')][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x5429a2){if(_0x5429a2){_0x1f37f9=_[_0xf326('0x6a')](_0x5429a2,'id');var _0x15f799;var _0x320ab3=squel[_0xf326('0x84')]();_0x320ab3[_0xf326('0x85')](_0x32fc6e[_0xf326('0x6b')]);for(var _0x2094bf=0x0;_0x2094bf<_0x549a1f['length'];_0x2094bf+=0x1){_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x6c')]?_0x1f37f9[_0x549a1f[_0x2094bf][_0xf326('0x6c')]][_0xf326('0x6d')]:_0x549a1f[_0x2094bf][_0xf326('0x63')];_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x86')]?_[_0xf326('0x6f')](_0x23451e[_0x549a1f[_0x2094bf][_0xf326('0x86')]],'%s',_0x15f799):_0x15f799;_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x6e')]?_[_0xf326('0x6f')](_0x310223[_0x549a1f[_0x2094bf][_0xf326('0x6e')]],'%s',_0x15f799):_0x15f799;if(_0x549a1f[_0x2094bf][_0xf326('0x70')]){_0x320ab3[_0xf326('0x62')](_0x15f799);}_0x549a1f[_0x2094bf]['orderBy']&&_0x320ab3[_0xf326('0x71')](_0x15f799,_0x549a1f[_0x2094bf][_0xf326('0x72')]===_0xf326('0x73')?![]:!![]);_0x320ab3['field'](_0x15f799,_0x549a1f[_0x2094bf]['alias']||_0x15f799);}if(_0x32fc6e[_0xf326('0x74')]){_0x32fc6e[_0xf326('0x74')]=JSON[_0xf326('0x87')](_0x32fc6e[_0xf326('0x74')]);for(var _0x5384a5=0x0;_0x5384a5<_0x32fc6e[_0xf326('0x74')][_0xf326('0x45')];_0x5384a5+=0x1){if(_0x32fc6e[_0xf326('0x74')][_0x5384a5]['type']&&_['includes'](_0x4bd216,_0x32fc6e['joins'][_0x5384a5][_0xf326('0x2e')])&&_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x77')]&&_0x32fc6e['joins'][_0x5384a5][_0xf326('0x75')]&&_0x32fc6e['joins'][_0x5384a5][_0xf326('0x76')]){_0x320ab3[_0x32fc6e['joins'][_0x5384a5][_0xf326('0x2e')]](_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x75')],null,util[_0xf326('0x6e')](_0xf326('0x88'),_0x32fc6e[_0xf326('0x6b')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x77')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x75')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x76')]));}}}if(_0x32fc6e[_0xf326('0x78')]){_0x32fc6e[_0xf326('0x78')]=JSON['parse'](_0x32fc6e[_0xf326('0x78')]);_0x320ab3[_0xf326('0x38')](_0x4c7fc0(_0x32fc6e[_0xf326('0x78')]['group']));}_0x3398fd=_0x320ab3['clone']();_0x320ab3['limit'](_0x2bc501);_0x320ab3[_0xf326('0x1c')](0x0);logger[_0xf326('0xa0')](_0xf326('0x79'),_0x320ab3[_0xf326('0x7a')]());return dbH[_0xf326('0x7b')][_0xf326('0x30')](_0x320ab3['toString'](),{'type':dbH[_0xf326('0x7b')][_0xf326('0x9e')][_0xf326('0x7c')]});}})[_0xf326('0x21')](function(){return{'sql':_0x3398fd[_0xf326('0x7a')]()};})['then'](respondWithResult(_0xffd165,null))[_0xf326('0x40')](handleError(_0xffd165,null));}; \ No newline at end of file +var _0x4975=['set','Content-Range','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','index','AnalyticDefaultReport','rawAttributes','type','key','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','body','role','user','Reports','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','SUM(%s)','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','joins','includes','parentKey','foreignKey','foreignTable','conditions','parse','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','HOUR(%s)','operator','Please\x20insert\x20at\x20least\x20one\x20field','alias','%s.%s\x20=\x20%s.%s','output','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:','toString','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','cross_join','getFields','replace','clone','eml-format','zip-dir','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','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x1a5ade,_0x4c6a75){var _0x246f99=function(_0x41f4c4){while(--_0x41f4c4){_0x1a5ade['push'](_0x1a5ade['shift']());}};_0x246f99(++_0x4c6a75);}(_0x4975,0x86));var _0x5497=function(_0x135ad2,_0x5eade6){_0x135ad2=_0x135ad2-0x0;var _0x1425b6=_0x4975[_0x135ad2];return _0x1425b6;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];var dbH=require(_0x5497('0x17'))[_0x5497('0x18')];function respondWithStatusCode(_0x984990,_0x747dc7){_0x747dc7=_0x747dc7||0xcc;return function(_0x365144){if(_0x365144){return _0x984990[_0x5497('0x19')](_0x747dc7);}return _0x984990[_0x5497('0x1a')](_0x747dc7)[_0x5497('0x1b')]();};}function respondWithResult(_0x1a4c74,_0x55f590){_0x55f590=_0x55f590||0xc8;return function(_0x11b0a9){if(_0x11b0a9){return _0x1a4c74['status'](_0x55f590)[_0x5497('0x1c')](_0x11b0a9);}};}function respondWithFilteredResult(_0x2bfd8a,_0x19e5f3){return function(_0x3ce50b){if(_0x3ce50b){var _0x37c18e=typeof _0x19e5f3[_0x5497('0x1d')]===_0x5497('0x1e')&&typeof _0x19e5f3['limit']==='undefined';var _0x3f4d20=_0x3ce50b[_0x5497('0x1f')];var _0x3a47fd=_0x37c18e?0x0:_0x19e5f3['offset'];var _0xbf1ba7=_0x37c18e?_0x3ce50b[_0x5497('0x1f')]:_0x19e5f3[_0x5497('0x1d')]+_0x19e5f3[_0x5497('0x20')];var _0x1b1b43;if(_0xbf1ba7>=_0x3f4d20){_0xbf1ba7=_0x3f4d20;_0x1b1b43=0xc8;}else{_0x1b1b43=0xce;}_0x2bfd8a[_0x5497('0x1a')](_0x1b1b43);return _0x2bfd8a[_0x5497('0x21')](_0x5497('0x22'),_0x3a47fd+'-'+_0xbf1ba7+'/'+_0x3f4d20)[_0x5497('0x1c')](_0x3ce50b);}return null;};}function patchUpdates(_0x3f54ef){return function(_0x186065){try{jsonpatch['apply'](_0x186065,_0x3f54ef,!![]);}catch(_0x720767){return BPromise['reject'](_0x720767);}return _0x186065[_0x5497('0x23')]();};}function saveUpdates(_0xd0868d,_0x44265c){return function(_0x2f587d){if(_0x2f587d){return _0x2f587d[_0x5497('0x24')](_0xd0868d)[_0x5497('0x25')](function(_0x5018fa){return _0x5018fa;});}return null;};}function removeEntity(_0x54043a,_0x1eefce){return function(_0x34b97f){if(_0x34b97f){return _0x34b97f[_0x5497('0x26')]()[_0x5497('0x25')](function(){var _0x5223b5=_0x34b97f[_0x5497('0x27')]({'plain':!![]});var _0x57268c=_0x5497('0x28');return db[_0x5497('0x29')][_0x5497('0x26')]({'where':{'type':_0x57268c,'resourceId':_0x5223b5['id']}})[_0x5497('0x25')](function(){return _0x34b97f;});})[_0x5497('0x25')](function(){_0x54043a[_0x5497('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4af5f4,_0x5406e2){return function(_0x583d06){if(!_0x583d06){_0x4af5f4['sendStatus'](0x194);}return _0x583d06;};}function handleError(_0x39a2b7,_0x48d146){_0x48d146=_0x48d146||0x1f4;return function(_0x5e9356){logger[_0x5497('0x2a')](_0x5e9356[_0x5497('0x2b')]);if(_0x5e9356[_0x5497('0x2c')]){delete _0x5e9356['name'];}_0x39a2b7['status'](_0x48d146)['send'](_0x5e9356);};}exports[_0x5497('0x2d')]=function(_0x471e0b,_0xf4c117){var _0x5b8f79={},_0x489f71={},_0x594866={'count':0x0,'rows':[]};var _0xa28dd8=_['map'](db[_0x5497('0x2e')][_0x5497('0x2f')],function(_0x77c575){return{'name':_0x77c575['fieldName'],'type':_0x77c575[_0x5497('0x30')][_0x5497('0x31')]};});_0x489f71['model']=_[_0x5497('0x32')](_0xa28dd8,_0x5497('0x2c'));_0x489f71[_0x5497('0x33')]=_['keys'](_0x471e0b[_0x5497('0x33')]);_0x489f71[_0x5497('0x34')]=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],_0x489f71[_0x5497('0x33')]);_0x5b8f79['attributes']=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],qs['fields'](_0x471e0b[_0x5497('0x33')][_0x5497('0x37')]));_0x5b8f79[_0x5497('0x38')]=_0x5b8f79[_0x5497('0x38')][_0x5497('0x39')]?_0x5b8f79[_0x5497('0x38')]:_0x489f71['model'];if(!_0x471e0b[_0x5497('0x33')]['hasOwnProperty'](_0x5497('0x3a'))){_0x5b8f79[_0x5497('0x20')]=qs[_0x5497('0x20')](_0x471e0b['query']['limit']);_0x5b8f79[_0x5497('0x1d')]=qs[_0x5497('0x1d')](_0x471e0b[_0x5497('0x33')][_0x5497('0x1d')]);}_0x5b8f79[_0x5497('0x3b')]=qs[_0x5497('0x3c')](_0x471e0b['query'][_0x5497('0x3c')]);_0x5b8f79[_0x5497('0x3d')]=qs[_0x5497('0x34')](_[_0x5497('0x3e')](_0x471e0b[_0x5497('0x33')],_0x489f71[_0x5497('0x34')]),_0xa28dd8);if(_0x471e0b[_0x5497('0x33')][_0x5497('0x3f')]){_0x5b8f79[_0x5497('0x3d')]=_['merge'](_0x5b8f79[_0x5497('0x3d')],{'$or':_[_0x5497('0x32')](_0xa28dd8,function(_0x1e9616){if(_0x1e9616[_0x5497('0x30')]!==_0x5497('0x40')){var _0xa5ebe6={};_0xa5ebe6[_0x1e9616[_0x5497('0x2c')]]={'$like':'%'+_0x471e0b['query'][_0x5497('0x3f')]+'%'};return _0xa5ebe6;}})});}_0x5b8f79=_[_0x5497('0x41')]({},_0x5b8f79,_0x471e0b[_0x5497('0x42')]);var _0x35993c={'where':_0x5b8f79[_0x5497('0x3d')]};return db[_0x5497('0x2e')][_0x5497('0x1f')](_0x35993c)['then'](function(_0x2137bd){_0x594866[_0x5497('0x1f')]=_0x2137bd;if(_0x471e0b[_0x5497('0x33')][_0x5497('0x43')]){_0x5b8f79[_0x5497('0x44')]=[{'all':!![]}];}return db[_0x5497('0x2e')][_0x5497('0x45')](_0x5b8f79);})[_0x5497('0x25')](function(_0x2021ae){_0x594866[_0x5497('0x46')]=_0x2021ae;return _0x594866;})['then'](respondWithFilteredResult(_0xf4c117,_0x5b8f79))[_0x5497('0x47')](handleError(_0xf4c117,null));};exports['show']=function(_0x40822a,_0x9fc24){var _0x26ef01={'raw':!![],'where':{'id':_0x40822a[_0x5497('0x48')]['id']}},_0x3602ec={};_0x3602ec['model']=_[_0x5497('0x49')](db[_0x5497('0x2e')]['rawAttributes']);_0x3602ec[_0x5497('0x33')]=_['keys'](_0x40822a[_0x5497('0x33')]);_0x3602ec['filters']=_[_0x5497('0x35')](_0x3602ec[_0x5497('0x36')],_0x3602ec[_0x5497('0x33')]);_0x26ef01[_0x5497('0x38')]=_[_0x5497('0x35')](_0x3602ec['model'],qs['fields'](_0x40822a['query']['fields']));_0x26ef01[_0x5497('0x38')]=_0x26ef01[_0x5497('0x38')][_0x5497('0x39')]?_0x26ef01[_0x5497('0x38')]:_0x3602ec[_0x5497('0x36')];if(_0x40822a[_0x5497('0x33')][_0x5497('0x43')]){_0x26ef01[_0x5497('0x44')]=[{'all':!![]}];}_0x26ef01=_[_0x5497('0x41')]({},_0x26ef01,_0x40822a['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x26ef01)[_0x5497('0x25')](handleEntityNotFound(_0x9fc24,null))['then'](respondWithResult(_0x9fc24,null))[_0x5497('0x47')](handleError(_0x9fc24,null));};exports['create']=function(_0x12ffbc,_0x31f1ba){return db[_0x5497('0x2e')]['create'](_0x12ffbc[_0x5497('0x4b')],{})[_0x5497('0x25')](function(_0x515c3e){var _0x3abc92=_0x12ffbc['user'][_0x5497('0x27')]({'plain':!![]});if(!_0x3abc92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3abc92[_0x5497('0x4c')]===_0x5497('0x4d')){var _0x26fd9f=_0x515c3e[_0x5497('0x27')]({'plain':!![]});var _0x25e80c=_0x5497('0x4e');return db[_0x5497('0x4f')][_0x5497('0x4a')]({'where':{'name':_0x25e80c,'userProfileId':_0x3abc92['userProfileId']},'raw':!![]})[_0x5497('0x25')](function(_0x5b2c22){if(_0x5b2c22&&_0x5b2c22['autoAssociation']===0x0){return db[_0x5497('0x29')][_0x5497('0x50')]({'name':_0x26fd9f['name'],'resourceId':_0x26fd9f['id'],'type':_0x5497('0x28'),'sectionId':_0x5b2c22['id']},{})[_0x5497('0x25')](function(){return _0x515c3e;});}else{return _0x515c3e;}})[_0x5497('0x47')](function(_0x3094c7){logger['error'](_0x5497('0x51'),_0x3094c7);throw _0x3094c7;});}return _0x515c3e;})['then'](respondWithResult(_0x31f1ba,0xc9))['catch'](handleError(_0x31f1ba,null));};exports[_0x5497('0x24')]=function(_0x33dd07,_0x2f7ec8){if(_0x33dd07['body']['id']){delete _0x33dd07['body']['id'];}return db[_0x5497('0x2e')]['find']({'where':{'id':_0x33dd07[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f7ec8,null))[_0x5497('0x25')](saveUpdates(_0x33dd07['body'],null))[_0x5497('0x25')](respondWithResult(_0x2f7ec8,null))[_0x5497('0x47')](handleError(_0x2f7ec8,null));};exports['destroy']=function(_0x418f17,_0x5dccfb){return db['AnalyticDefaultReport'][_0x5497('0x4a')]({'where':{'id':_0x418f17[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x5dccfb,null))[_0x5497('0x25')](removeEntity(_0x5dccfb,null))[_0x5497('0x47')](handleError(_0x5dccfb,null));};exports[_0x5497('0x52')]=function(_0x28b2a3,_0x3fca40){var _0x25c75e=0xa;var _0x590be7=[_0x5497('0x53'),'left_join','right_join','cross_join'];var _0x1f3965={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5497('0x56'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x25f349={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x425995=function(_0xc783ce){return!_['includes']([_0x5497('0x5e'),_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0xc783ce);};var _0x5823f6=function(_0x31271c){if(!_0x31271c||!_0x31271c[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x542bcf='(',_0x1ab48f=0x0;_0x1ab48f<_0x31271c['rules']['length'];_0x1ab48f+=0x1){_0x1ab48f>0x0&&(_0x542bcf+='\x20'+_0x31271c['operator']+'\x20');_0x542bcf+=_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x63')]?_0x5823f6(_0x31271c[_0x5497('0x62')][_0x1ab48f]['group']):_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x64')]+'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x65')]+(_0x425995(_0x31271c['rules'][_0x1ab48f][_0x5497('0x65')])?'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x66')]:'');}return _0x542bcf+')';};var _0x49617c={'where':{'id':_0x28b2a3[_0x5497('0x48')]['id']}},_0x164de1,_0x465bed,_0xb3eec2,_0x4368e3,_0x1467c4;_0x49617c=_[_0x5497('0x41')]({},_0x49617c,_0x28b2a3['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x49617c)[_0x5497('0x25')](function(_0x20efea){if(_0x20efea){_0x164de1=_0x20efea;return _0x20efea['getFields']();}return null;})['then'](function(_0x4a7360){if(_0x4a7360){if(!_0x4a7360[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x465bed=_0x4a7360;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x464df3){if(_0x464df3){_0xb3eec2=_[_0x5497('0x6a')](_0x464df3,'id');var _0x4338d4;var _0x3f38bf=squel[_0x5497('0x6b')]();_0x3f38bf[_0x5497('0x6c')](_0x164de1[_0x5497('0x6d')]);for(var _0x1fc6ad=0x0;_0x1fc6ad<_0x465bed['length'];_0x1fc6ad+=0x1){_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x6e')]?_0xb3eec2[_0x465bed[_0x1fc6ad][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x465bed[_0x1fc6ad]['field'];_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x70')]?_['replace'](_0x1f3965[_0x465bed[_0x1fc6ad][_0x5497('0x70')]],'%s',_0x4338d4):_0x4338d4;_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x71')]?_['replace'](_0x25f349[_0x465bed[_0x1fc6ad][_0x5497('0x71')]],'%s',_0x4338d4):_0x4338d4;if(_0x465bed[_0x1fc6ad][_0x5497('0x72')]){_0x3f38bf[_0x5497('0x63')](_0x4338d4);}_0x465bed[_0x1fc6ad][_0x5497('0x73')]&&_0x3f38bf['order'](_0x4338d4,_0x465bed[_0x1fc6ad][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x3f38bf[_0x5497('0x64')](_0x4338d4,_0x465bed[_0x1fc6ad]['alias']||_0x4338d4);}if(_0x164de1[_0x5497('0x75')]){_0x164de1[_0x5497('0x75')]=JSON['parse'](_0x164de1[_0x5497('0x75')]);for(var _0xebe694=0x0;_0xebe694<_0x164de1[_0x5497('0x75')]['length'];_0xebe694+=0x1){if(_0x164de1['joins'][_0xebe694][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x590be7,_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x30')])&&_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x77')]&&_0x164de1[_0x5497('0x75')][_0xebe694]['foreignTable']&&_0x164de1['joins'][_0xebe694][_0x5497('0x78')]){_0x3f38bf[_0x164de1[_0x5497('0x75')][_0xebe694]['type']](_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],null,util[_0x5497('0x71')]('%s.%s\x20=\x20%s.%s',_0x164de1[_0x5497('0x6d')],_0x164de1[_0x5497('0x75')][_0xebe694]['parentKey'],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x78')]));}}}if(_0x164de1[_0x5497('0x7a')]){_0x164de1['conditions']=JSON[_0x5497('0x7b')](_0x164de1[_0x5497('0x7a')]);_0x3f38bf[_0x5497('0x3d')](_0x5823f6(_0x164de1[_0x5497('0x7a')][_0x5497('0x63')]));}_0x1467c4=_0x3f38bf['clone']();_0x3f38bf[_0x5497('0x20')](_0x25c75e);_0x3f38bf[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')](_0x5497('0x7d'),_0x3f38bf['toString']());return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x3f38bf['toString'](),{'type':dbH[_0x5497('0x7e')][_0x5497('0x7f')][_0x5497('0x80')]});}})[_0x5497('0x25')](respondWithResult(_0x3fca40,null))['catch'](handleError(_0x3fca40,null));};function runReport(_0x547de7,_0x4ff64f,_0x5343d5){var _0x594761=_0x4ff64f[_0x5497('0x2c')];var _0x2375cc=0xa;var _0x15d0da=[_0x5497('0x53'),_0x5497('0x81'),'right_join','cross_join'];var _0x392987={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x4c41c4={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x22b019=function(_0x4aa4ba){return!_[_0x5497('0x76')](['IS\x20NULL',_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0x4aa4ba);};var _0x5b0f9d=function(_0x59960b){if(!_0x59960b||!_0x59960b[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x953b31='(',_0xeb52c9=0x0;_0xeb52c9<_0x59960b[_0x5497('0x62')][_0x5497('0x39')];_0xeb52c9+=0x1){_0xeb52c9>0x0&&(_0x953b31+='\x20'+_0x59960b[_0x5497('0x86')]+'\x20');_0x953b31+=_0x59960b[_0x5497('0x62')][_0xeb52c9]['group']?_0x5b0f9d(_0x59960b['rules'][_0xeb52c9]['group']):_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x64')]+'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x65')]+(_0x22b019(_0x59960b['rules'][_0xeb52c9]['condition'])?'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x66')]:'');}return _0x953b31+')';};var _0x5dd9bc={'where':{'id':_0x547de7['id']}},_0x83b240,_0x2fc11a,_0x3ce2ee,_0x36c09f,_0x51e9fb;_0x5dd9bc=_['merge']({},_0x5dd9bc,_0x5343d5);return db['AnalyticDefaultReport']['find'](_0x5dd9bc)['then'](function(_0x497295){if(_0x497295){_0x83b240=_0x497295;return _0x497295['getFields']();}return null;})[_0x5497('0x25')](function(_0x5aa5e1){if(_0x5aa5e1){if(!_0x5aa5e1[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))](_0x5497('0x87'),0x193);}_0x2fc11a=_0x5aa5e1;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})['then'](function(_0x77d52c){if(_0x77d52c){_0x3ce2ee=_['keyBy'](_0x77d52c,'id');var _0x15a67d;var _0x2721b2=squel[_0x5497('0x6b')]();_0x2721b2[_0x5497('0x6c')](_0x83b240[_0x5497('0x6d')]);for(var _0x38fa59=0x0;_0x38fa59<_0x2fc11a[_0x5497('0x39')];_0x38fa59+=0x1){_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x6e')]?_0x3ce2ee[_0x2fc11a[_0x38fa59][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x2fc11a[_0x38fa59]['field'];_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x70')]?_['replace'](_0x392987[_0x2fc11a[_0x38fa59][_0x5497('0x70')]],'%s',_0x15a67d):_0x15a67d;_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x71')]?_['replace'](_0x4c41c4[_0x2fc11a[_0x38fa59][_0x5497('0x71')]],'%s',_0x15a67d):_0x15a67d;if(_0x2fc11a[_0x38fa59][_0x5497('0x72')]){_0x2721b2[_0x5497('0x63')](_0x15a67d);}_0x2fc11a[_0x38fa59][_0x5497('0x73')]&&_0x2721b2[_0x5497('0x3b')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x2721b2[_0x5497('0x64')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x88')]||_0x15a67d);}if(_0x83b240[_0x5497('0x75')]){_0x83b240[_0x5497('0x75')]=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x75')]);for(var _0x22426e=0x0;_0x22426e<_0x83b240['joins'][_0x5497('0x39')];_0x22426e+=0x1){if(_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x15d0da,_0x83b240[_0x5497('0x75')][_0x22426e]['type'])&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')]&&_0x83b240['joins'][_0x22426e]['foreignTable']&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]){_0x2721b2[_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]](_0x83b240[_0x5497('0x75')][_0x22426e]['foreignTable'],null,util['format'](_0x5497('0x89'),_0x83b240['table'],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x79')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]));}}}if(_0x83b240['conditions']){_0x83b240['conditions']=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x7a')]);_0x2721b2[_0x5497('0x3d')](_0x5b0f9d(_0x83b240['conditions'][_0x5497('0x63')]));}_0x51e9fb=_0x2721b2['clone']();_0x2721b2[_0x5497('0x20')](_0x2375cc);_0x2721b2['offset'](0x0);return;}})['then'](function(){if(_0x4ff64f[_0x5497('0x8a')]===_0x5497('0x8b')){return null;}var _0x4ce768=_[_0x5497('0x41')](_0x4ff64f,{'name':_0x4ff64f[_0x5497('0x8c')]||_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],'basename':_0x594761,'savename':util['format'](_0x5497('0x8d'),_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],require(_0x5497('0x8e'))[_0x5497('0x8f')](0x4),_0x4ff64f['output']||_0x5497('0x90')),'reportId':_0x83b240['id'],'reportType':'default'});return db[_0x5497('0x91')][_0x5497('0x50')](_0x4ce768,{'raw':!![]});})[_0x5497('0x25')](function(_0x314db4){if(_0x83b240[_0x5497('0x6d')]===_0x5497('0x92')){_0x51e9fb[_0x5497('0x3d')](_0x83b240[_0x5497('0x6d')]+_0x5497('0x93'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}else{_0x51e9fb['where'](_0x83b240[_0x5497('0x6d')]+_0x5497('0x96'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}if(_0x314db4){logger[_0x5497('0x97')](_0x5497('0x98'),_0x51e9fb[_0x5497('0x99')]());require(_0x5497('0x9a'))[_0x5497('0x9b')](path[_0x5497('0x53')](__dirname,_0x5497('0x9c'),_0x314db4['output']),[_0x314db4['id'],_0x51e9fb[_0x5497('0x99')](),path[_0x5497('0x53')](__dirname,_0x5497('0x9d'),_0x314db4[_0x5497('0x9e')]),_0x594761]);return _0x314db4;}else{var _0x46be08=squel[_0x5497('0x6b')]();_0x46be08[_0x5497('0x6c')]('('+_0x51e9fb[_0x5497('0x99')]()+')',_0x5497('0x9f'));_0x46be08[_0x5497('0x64')](_0x5497('0xa0'),_0x5497('0x1f'));_0x51e9fb[_0x5497('0x20')](_0x4ff64f[_0x5497('0x20')]||_0x2375cc);_0x51e9fb['offset'](_0x4ff64f['offset']||0x0);return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x46be08[_0x5497('0x99')](),{'type':dbH['sequelize'][_0x5497('0x7f')][_0x5497('0x80')]})[_0x5497('0x25')](function(_0x2bd48c){if(!_0x2bd48c[_0x5497('0x39')]){_0x36c09f=0x0;}else{_0x36c09f=_0x2bd48c[0x0][_0x5497('0x1f')]||0x0;}return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x51e9fb['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5497('0x80')]});})[_0x5497('0x25')](function(_0x4dab6a){return{'rows':_0x4dab6a||[],'count':_0x36c09f};});}});}exports[_0x5497('0xa1')]=function(_0x27f42b,_0x1bef85){return runReport(_0x27f42b['params'],_0x27f42b[_0x5497('0x33')],_0x27f42b['options'])[_0x5497('0x25')](respondWithResult(_0x1bef85,null))[_0x5497('0x47')](handleError(_0x1bef85,null));};exports[_0x5497('0xa2')]=runReport;exports['query']=function(_0x1c3dad,_0xfba062){var _0x494cc3=0xa;var _0x401f04=[_0x5497('0x53'),_0x5497('0x81'),'right_join',_0x5497('0xa3')];var _0x1a5c32={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x1dfb76={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x5c2517=function(_0x367929){return!_[_0x5497('0x76')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5497('0x60'),_0x5497('0x61')],_0x367929);};var _0x2fd2e3=function(_0x2fe770){if(!_0x2fe770||!_0x2fe770['rules'][_0x5497('0x39')]){return'';}for(var _0x1299cd='(',_0x4c2b14=0x0;_0x4c2b14<_0x2fe770['rules'][_0x5497('0x39')];_0x4c2b14+=0x1){_0x4c2b14>0x0&&(_0x1299cd+='\x20'+_0x2fe770[_0x5497('0x86')]+'\x20');_0x1299cd+=_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x63')]?_0x2fd2e3(_0x2fe770[_0x5497('0x62')][_0x4c2b14]['group']):_0x2fe770['rules'][_0x4c2b14][_0x5497('0x64')]+'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14]['condition']+(_0x5c2517(_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x65')])?'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x66')]:'');}return _0x1299cd+')';};var _0x358ec5={'where':{'id':_0x1c3dad['params']['id']}},_0x5cddbc,_0x188d21,_0xf92129,_0x2d5cc1,_0x4f9228;_0x358ec5=_[_0x5497('0x41')]({},_0x358ec5,_0x1c3dad[_0x5497('0x42')]);return db[_0x5497('0x2e')]['find'](_0x358ec5)[_0x5497('0x25')](function(_0x30a248){if(_0x30a248){_0x5cddbc=_0x30a248;return _0x30a248[_0x5497('0xa4')]();}return null;})['then'](function(_0x1d4c76){if(_0x1d4c76){if(!_0x1d4c76[_0x5497('0x39')]){throw new db['Sequelize']['ValidationErrorItem'](_0x5497('0x87'),0x193);}_0x188d21=_0x1d4c76;return db[_0x5497('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x5001d5){if(_0x5001d5){_0xf92129=_[_0x5497('0x6a')](_0x5001d5,'id');var _0x2c58e6;var _0x300f3e=squel[_0x5497('0x6b')]();_0x300f3e[_0x5497('0x6c')](_0x5cddbc[_0x5497('0x6d')]);for(var _0x23732d=0x0;_0x23732d<_0x188d21['length'];_0x23732d+=0x1){_0x2c58e6=_0x188d21[_0x23732d]['MetricId']?_0xf92129[_0x188d21[_0x23732d][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x188d21[_0x23732d]['field'];_0x2c58e6=_0x188d21[_0x23732d]['function']?_[_0x5497('0xa5')](_0x1a5c32[_0x188d21[_0x23732d][_0x5497('0x70')]],'%s',_0x2c58e6):_0x2c58e6;_0x2c58e6=_0x188d21[_0x23732d][_0x5497('0x71')]?_[_0x5497('0xa5')](_0x1dfb76[_0x188d21[_0x23732d][_0x5497('0x71')]],'%s',_0x2c58e6):_0x2c58e6;if(_0x188d21[_0x23732d][_0x5497('0x72')]){_0x300f3e['group'](_0x2c58e6);}_0x188d21[_0x23732d][_0x5497('0x73')]&&_0x300f3e[_0x5497('0x3b')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x300f3e[_0x5497('0x64')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x88')]||_0x2c58e6);}if(_0x5cddbc['joins']){_0x5cddbc[_0x5497('0x75')]=JSON['parse'](_0x5cddbc[_0x5497('0x75')]);for(var _0x261804=0x0;_0x261804<_0x5cddbc[_0x5497('0x75')]['length'];_0x261804+=0x1){if(_0x5cddbc[_0x5497('0x75')][_0x261804]['type']&&_['includes'](_0x401f04,_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')])&&_0x5cddbc['joins'][_0x261804][_0x5497('0x77')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]){_0x300f3e[_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')]](_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],null,util['format'](_0x5497('0x89'),_0x5cddbc[_0x5497('0x6d')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x77')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]));}}}if(_0x5cddbc[_0x5497('0x7a')]){_0x5cddbc[_0x5497('0x7a')]=JSON[_0x5497('0x7b')](_0x5cddbc[_0x5497('0x7a')]);_0x300f3e[_0x5497('0x3d')](_0x2fd2e3(_0x5cddbc[_0x5497('0x7a')][_0x5497('0x63')]));}_0x4f9228=_0x300f3e[_0x5497('0xa6')]();_0x300f3e[_0x5497('0x20')](_0x494cc3);_0x300f3e[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')]('Limited\x20Query:',_0x300f3e[_0x5497('0x99')]());return dbH[_0x5497('0x7e')]['query'](_0x300f3e['toString'](),{'type':dbH[_0x5497('0x7e')]['QueryTypes'][_0x5497('0x80')]});}})[_0x5497('0x25')](function(){return{'sql':_0x4f9228[_0x5497('0x99')]()};})[_0x5497('0x25')](respondWithResult(_0xfba062,null))[_0x5497('0x47')](handleError(_0xfba062,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 9d8ef3c..32a6404 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 _0x36c9=['exports','define','analytics_default_reports','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x36c9,0xb7));var _0x936c=function(_0xc91ccd,_0x28f968){_0xc91ccd=_0xc91ccd-0x0;var _0x28c08e=_0x36c9[_0xc91ccd];return _0x28c08e;};'use strict';var _=require(_0x936c('0x0'));var util=require('util');var logger=require(_0x936c('0x1'))('api');var moment=require(_0x936c('0x2'));var BPromise=require(_0x936c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x936c('0x4'));var config=require(_0x936c('0x5'));var attributes=require(_0x936c('0x6'));module[_0x936c('0x7')]=function(_0x5a42eb,_0x18d903){return _0x5a42eb[_0x936c('0x8')]('AnalyticDefaultReport',attributes,{'tableName':_0x936c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x578d=['analytics_default_reports','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport'];(function(_0x4d7eb,_0x2c3a08){var _0x257a88=function(_0xd0b0b4){while(--_0xd0b0b4){_0x4d7eb['push'](_0x4d7eb['shift']());}};_0x257a88(++_0x2c3a08);}(_0x578d,0xeb));var _0xd578=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x578d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd578('0x0'));var util=require(_0xd578('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd578('0x2'));var BPromise=require(_0xd578('0x3'));var rp=require(_0xd578('0x4'));var fs=require('fs');var path=require(_0xd578('0x5'));var rimraf=require(_0xd578('0x6'));var config=require(_0xd578('0x7'));var attributes=require(_0xd578('0x8'));module[_0xd578('0x9')]=function(_0x1cd1f4,_0x10dc45){return _0x1cd1f4[_0xd578('0xa')](_0xd578('0xb'),attributes,{'tableName':_0xd578('0xc'),'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 2eaeaba..72e87b5 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 _0x9e56=['stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s'];(function(_0x1a5e85,_0x1e423f){var _0x48506e=function(_0xbbc2a4){while(--_0xbbc2a4){_0x1a5e85['push'](_0x1a5e85['shift']());}};_0x48506e(++_0x1e423f);}(_0x9e56,0x157));var _0x69e5=function(_0x1e22d6,_0x25605f){_0x1e22d6=_0x1e22d6-0x0;var _0x397cc4=_0x9e56[_0x1e22d6];return _0x397cc4;};'use strict';var _=require(_0x69e5('0x0'));var util=require(_0x69e5('0x1'));var moment=require(_0x69e5('0x2'));var BPromise=require(_0x69e5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x69e5('0x4'));var db=require(_0x69e5('0x5'))['db'];var utils=require(_0x69e5('0x6'));var logger=require(_0x69e5('0x7'))(_0x69e5('0x8'));var config=require(_0x69e5('0x9'));var jayson=require(_0x69e5('0xa'));var client=jayson['client'][_0x69e5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bc6c1,_0x591b17,_0x2a8245){return new BPromise(function(_0x567a19,_0x27bdbc){return client[_0x69e5('0xc')](_0x3bc6c1,_0x2a8245)[_0x69e5('0xd')](function(_0x3293b9){logger[_0x69e5('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x591b17,_0x69e5('0xf'));logger['debug'](_0x69e5('0x10'),_0x591b17,_0x69e5('0xf'),JSON[_0x69e5('0x11')](_0x3293b9));if(_0x3293b9[_0x69e5('0x12')]){if(_0x3293b9[_0x69e5('0x12')][_0x69e5('0x13')]===0x1f4){logger[_0x69e5('0x12')](_0x69e5('0x14'),_0x591b17,_0x3293b9[_0x69e5('0x12')]['message']);return _0x27bdbc(_0x3293b9['error'][_0x69e5('0x15')]);}logger[_0x69e5('0x12')](_0x69e5('0x14'),_0x591b17,_0x3293b9[_0x69e5('0x12')][_0x69e5('0x15')]);return _0x567a19(_0x3293b9[_0x69e5('0x12')]['message']);}else{logger[_0x69e5('0xe')](_0x69e5('0x14'),_0x591b17,'request\x20sent');_0x567a19(_0x3293b9[_0x69e5('0x16')]['message']);}})[_0x69e5('0x17')](function(_0xf1c2b0){logger[_0x69e5('0x12')](_0x69e5('0x14'),_0x591b17,_0xf1c2b0);_0x27bdbc(_0xf1c2b0);});});} \ No newline at end of file +var _0x1935=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','message','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x1935,0x169));var _0x5193=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x1935[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x5193('0x0'));var util=require('util');var moment=require(_0x5193('0x1'));var BPromise=require(_0x5193('0x2'));var rs=require(_0x5193('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5193('0x4'))['db'];var utils=require(_0x5193('0x5'));var logger=require(_0x5193('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5193('0x7'));var client=jayson[_0x5193('0x8')][_0x5193('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d2286,_0x35d411,_0x2df7e6){return new BPromise(function(_0x49babb,_0xe5586d){return client[_0x5193('0xa')](_0x3d2286,_0x2df7e6)[_0x5193('0xb')](function(_0x55911f){logger[_0x5193('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x35d411,_0x5193('0xd'));logger['debug']('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x35d411,_0x5193('0xd'),JSON[_0x5193('0xe')](_0x55911f));if(_0x55911f[_0x5193('0xf')]){if(_0x55911f[_0x5193('0xf')][_0x5193('0x10')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x35d411,_0x55911f['error']['message']);return _0xe5586d(_0x55911f[_0x5193('0xf')][_0x5193('0x11')]);}logger[_0x5193('0xf')](_0x5193('0x12'),_0x35d411,_0x55911f[_0x5193('0xf')]['message']);return _0x49babb(_0x55911f[_0x5193('0xf')][_0x5193('0x11')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x35d411,_0x5193('0xd'));_0x49babb(_0x55911f['result'][_0x5193('0x11')]);}})[_0x5193('0x13')](function(_0x58ddea){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x35d411,_0x58ddea);_0xe5586d(_0x58ddea);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index ad277c7..a48dc96 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 _0x2aab=['preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/preview'];(function(_0x168139,_0x427878){var _0x25695b=function(_0x360b83){while(--_0x360b83){_0x168139['push'](_0x168139['shift']());}};_0x25695b(++_0x427878);}(_0x2aab,0x151));var _0xb2aa=function(_0x39640c,_0x4ccc46){_0x39640c=_0x39640c-0x0;var _0x38af74=_0x2aab[_0x39640c];return _0x38af74;};'use strict';var multer=require(_0xb2aa('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb2aa('0x1'));var express=require(_0xb2aa('0x2'));var router=express[_0xb2aa('0x3')]();var fs_extra=require(_0xb2aa('0x4'));var auth=require(_0xb2aa('0x5'));var interaction=require(_0xb2aa('0x6'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0xb2aa('0x7')]('/',auth[_0xb2aa('0x8')](),controller[_0xb2aa('0x9')]);router[_0xb2aa('0x7')](_0xb2aa('0xa'),auth[_0xb2aa('0x8')](),controller[_0xb2aa('0xb')]);router[_0xb2aa('0x7')](_0xb2aa('0xc'),auth[_0xb2aa('0x8')](),controller[_0xb2aa('0xd')]);router['get'](_0xb2aa('0xe'),auth[_0xb2aa('0x8')](),controller[_0xb2aa('0xf')]);router[_0xb2aa('0x7')](_0xb2aa('0x10'),auth[_0xb2aa('0x8')](),controller[_0xb2aa('0x11')]);router[_0xb2aa('0x12')]('/',auth[_0xb2aa('0x8')](),controller[_0xb2aa('0x13')]);router[_0xb2aa('0x14')](_0xb2aa('0xa'),auth[_0xb2aa('0x8')](),controller[_0xb2aa('0x15')]);router[_0xb2aa('0x16')](_0xb2aa('0xa'),auth['isAuthenticated'](),controller[_0xb2aa('0x17')]);module[_0xb2aa('0x18')]=router; \ No newline at end of file +var _0xa88c=['/:id/query','query','post','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','/:id','preview','/:id/run','run'];(function(_0x5452ce,_0x410be2){var _0x329f18=function(_0x598bc7){while(--_0x598bc7){_0x5452ce['push'](_0x5452ce['shift']());}};_0x329f18(++_0x410be2);}(_0xa88c,0xc3));var _0xca88=function(_0x1f2c2a,_0x5bda9d){_0x1f2c2a=_0x1f2c2a-0x0;var _0x4906de=_0xa88c[_0x1f2c2a];return _0x4906de;};'use strict';var multer=require(_0xca88('0x0'));var util=require(_0xca88('0x1'));var path=require(_0xca88('0x2'));var timeout=require(_0xca88('0x3'));var express=require('express');var router=express[_0xca88('0x4')]();var fs_extra=require(_0xca88('0x5'));var auth=require(_0xca88('0x6'));var interaction=require(_0xca88('0x7'));var config=require('../../config/environment');var controller=require(_0xca88('0x8'));router[_0xca88('0x9')]('/',auth[_0xca88('0xa')](),controller['index']);router[_0xca88('0x9')](_0xca88('0xb'),auth[_0xca88('0xa')](),controller['show']);router[_0xca88('0x9')]('/:id/preview',auth['isAuthenticated'](),controller[_0xca88('0xc')]);router[_0xca88('0x9')](_0xca88('0xd'),auth[_0xca88('0xa')](),controller[_0xca88('0xe')]);router[_0xca88('0x9')](_0xca88('0xf'),auth[_0xca88('0xa')](),controller[_0xca88('0x10')]);router[_0xca88('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xca88('0x12')]);router['delete'](_0xca88('0xb'),auth[_0xca88('0xa')](),controller[_0xca88('0x13')]);module[_0xca88('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 51ebe7d..d70bcb7 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 _0xb8c5=['exports','STRING','ENUM','csv','pdf','xlsx','DATE','manual','scheduled','INTEGER','UNSIGNED','moment'];(function(_0x8d752a,_0x3d2cac){var _0x24c475=function(_0x3765a5){while(--_0x3765a5){_0x8d752a['push'](_0x8d752a['shift']());}};_0x24c475(++_0x3d2cac);}(_0xb8c5,0x137));var _0x5b8c=function(_0x458a6e,_0xc6a2ec){_0x458a6e=_0x458a6e-0x0;var _0x3ad477=_0xb8c5[_0x458a6e];return _0x3ad477;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5b8c('0x0'));module[_0x5b8c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x5b8c('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x5b8c('0x3')](_0x5b8c('0x4'),_0x5b8c('0x5'),_0x5b8c('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x5b8c('0x7')]},'status':{'type':Sequelize[_0x5b8c('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x5b8c('0x8'),_0x5b8c('0x9')),'allowNull':![],'defaultValue':_0x5b8c('0x8')},'reportId':{'type':Sequelize[_0x5b8c('0xa')](0xb)[_0x5b8c('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3c2a=['moment','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x3c2a,0x9c));var _0xa3c2=function(_0x5b491a,_0x48a13d){_0x5b491a=_0x5b491a-0x0;var _0x23df8a=_0x3c2a[_0x5b491a];return _0x23df8a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa3c2('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3c2('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0xa3c2('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0xa3c2('0x2')](_0xa3c2('0x3'),_0xa3c2('0x4'),_0xa3c2('0x5')),'allowNull':![],'defaultValue':_0xa3c2('0x3')},'savename':{'type':Sequelize[_0xa3c2('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0xa3c2('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xa3c2('0x1')],'defaultValue':_0xa3c2('0x7')},'type':{'type':Sequelize[_0xa3c2('0x2')](_0xa3c2('0x8'),_0xa3c2('0x9')),'allowNull':![],'defaultValue':_0xa3c2('0x8')},'reportId':{'type':Sequelize[_0xa3c2('0xa')](0xb)[_0xa3c2('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index d991ea9..8cfa1e8 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 _0x5190=['sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','save','update','then','destroy','get','ExtractedReports','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','params','keys','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','savename','existsSync','join','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','download','format','%s.%s','basename','toLowerCase','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4b1555,_0x3cf446){var _0x166d49=function(_0x3a3a8c){while(--_0x3a3a8c){_0x4b1555['push'](_0x4b1555['shift']());}};_0x166d49(++_0x3cf446);}(_0x5190,0xa8));var _0x0519=function(_0xf44d98,_0x12a472){_0xf44d98=_0xf44d98-0x0;var _0x5ebb04=_0x5190[_0xf44d98];return _0x5ebb04;};'use strict';var emlformat=require(_0x0519('0x0'));var rimraf=require(_0x0519('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0519('0x2'));var rp=require(_0x0519('0x3'));var moment=require('moment');var BPromise=require(_0x0519('0x4'));var Mustache=require(_0x0519('0x5'));var util=require(_0x0519('0x6'));var path=require('path');var sox=require(_0x0519('0x7'));var csv=require(_0x0519('0x8'));var ejs=require(_0x0519('0x9'));var fs=require('fs');var fs_extra=require(_0x0519('0xa'));var _=require(_0x0519('0xb'));var squel=require(_0x0519('0xc'));var crypto=require(_0x0519('0xd'));var jsforce=require(_0x0519('0xe'));var deskjs=require(_0x0519('0xf'));var toCsv=require(_0x0519('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0519('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0519('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0519('0x12'))(_0x0519('0x13'));var utils=require(_0x0519('0x14'));var config=require(_0x0519('0x15'));var licenseUtil=require(_0x0519('0x16'));var db=require(_0x0519('0x17'))['db'];function respondWithStatusCode(_0x2f2e37,_0x5dc6c9){_0x5dc6c9=_0x5dc6c9||0xcc;return function(_0x3f7440){if(_0x3f7440){return _0x2f2e37[_0x0519('0x18')](_0x5dc6c9);}return _0x2f2e37['status'](_0x5dc6c9)[_0x0519('0x19')]();};}function respondWithResult(_0x4c177b,_0x2211b9){_0x2211b9=_0x2211b9||0xc8;return function(_0x2754dc){if(_0x2754dc){return _0x4c177b['status'](_0x2211b9)[_0x0519('0x1a')](_0x2754dc);}};}function respondWithFilteredResult(_0x5b0414,_0x1de1b1){return function(_0x1fe5d0){if(_0x1fe5d0){var _0x313b5f=typeof _0x1de1b1[_0x0519('0x1b')]===_0x0519('0x1c')&&typeof _0x1de1b1[_0x0519('0x1d')]===_0x0519('0x1c');var _0x5b8e34=_0x1fe5d0[_0x0519('0x1e')];var _0x293eae=_0x313b5f?0x0:_0x1de1b1[_0x0519('0x1b')];var _0x4508f5=_0x313b5f?_0x1fe5d0[_0x0519('0x1e')]:_0x1de1b1[_0x0519('0x1b')]+_0x1de1b1[_0x0519('0x1d')];var _0x155000;if(_0x4508f5>=_0x5b8e34){_0x4508f5=_0x5b8e34;_0x155000=0xc8;}else{_0x155000=0xce;}_0x5b0414[_0x0519('0x1f')](_0x155000);return _0x5b0414['set'](_0x0519('0x20'),_0x293eae+'-'+_0x4508f5+'/'+_0x5b8e34)[_0x0519('0x1a')](_0x1fe5d0);}return null;};}function patchUpdates(_0x14cd4d){return function(_0x222ede){try{jsonpatch[_0x0519('0x21')](_0x222ede,_0x14cd4d,!![]);}catch(_0x4633b7){return BPromise['reject'](_0x4633b7);}return _0x222ede[_0x0519('0x22')]();};}function saveUpdates(_0x1e65a2,_0x1d3f15){return function(_0xf65ece){if(_0xf65ece){return _0xf65ece[_0x0519('0x23')](_0x1e65a2)[_0x0519('0x24')](function(_0x53f092){return _0x53f092;});}return null;};}function removeEntity(_0x4d253c,_0x27ff70){return function(_0x18199c){if(_0x18199c){return _0x18199c[_0x0519('0x25')]()[_0x0519('0x24')](function(){var _0xa3ec39=_0x18199c[_0x0519('0x26')]({'plain':!![]});var _0x2fbf1b=_0x0519('0x27');return db['UserProfileResource'][_0x0519('0x25')]({'where':{'type':_0x2fbf1b,'resourceId':_0xa3ec39['id']}})[_0x0519('0x24')](function(){return _0x18199c;});})[_0x0519('0x24')](function(){_0x4d253c[_0x0519('0x1f')](0xcc)[_0x0519('0x19')]();});}};}function handleEntityNotFound(_0x36dd1f,_0x21c793){return function(_0x7552b4){if(!_0x7552b4){_0x36dd1f[_0x0519('0x18')](0x194);}return _0x7552b4;};}function handleError(_0x1fe579,_0x48d422){_0x48d422=_0x48d422||0x1f4;return function(_0x1a499d){logger[_0x0519('0x28')](_0x1a499d[_0x0519('0x29')]);if(_0x1a499d[_0x0519('0x2a')]){delete _0x1a499d[_0x0519('0x2a')];}_0x1fe579[_0x0519('0x1f')](_0x48d422)[_0x0519('0x2b')](_0x1a499d);};}exports[_0x0519('0x2c')]=function(_0xe0fa58,_0x208eff){var _0x2d486f={},_0x2a15eb={},_0xd5e4a5={'count':0x0,'rows':[]};var _0x59667b=_[_0x0519('0x2d')](db[_0x0519('0x2e')][_0x0519('0x2f')],function(_0x53865a){return{'name':_0x53865a['fieldName'],'type':_0x53865a[_0x0519('0x30')][_0x0519('0x31')]};});_0x2a15eb[_0x0519('0x32')]=_['map'](_0x59667b,_0x0519('0x2a'));_0x2a15eb[_0x0519('0x33')]=_['keys'](_0xe0fa58['query']);_0x2a15eb[_0x0519('0x34')]=_[_0x0519('0x35')](_0x2a15eb[_0x0519('0x32')],_0x2a15eb[_0x0519('0x33')]);_0x2d486f[_0x0519('0x36')]=_[_0x0519('0x35')](_0x2a15eb[_0x0519('0x32')],qs['fields'](_0xe0fa58[_0x0519('0x33')][_0x0519('0x37')]));_0x2d486f['attributes']=_0x2d486f[_0x0519('0x36')][_0x0519('0x38')]?_0x2d486f[_0x0519('0x36')]:_0x2a15eb['model'];if(!_0xe0fa58[_0x0519('0x33')][_0x0519('0x39')](_0x0519('0x3a'))){_0x2d486f[_0x0519('0x1d')]=qs['limit'](_0xe0fa58[_0x0519('0x33')][_0x0519('0x1d')]);_0x2d486f[_0x0519('0x1b')]=qs[_0x0519('0x1b')](_0xe0fa58[_0x0519('0x33')]['offset']);}_0x2d486f[_0x0519('0x3b')]=qs[_0x0519('0x3c')](_0xe0fa58[_0x0519('0x33')][_0x0519('0x3c')]);_0x2d486f[_0x0519('0x3d')]=qs['filters'](_[_0x0519('0x3e')](_0xe0fa58[_0x0519('0x33')],_0x2a15eb[_0x0519('0x34')]),_0x59667b);if(_0xe0fa58[_0x0519('0x33')]['filter']){_0x2d486f[_0x0519('0x3d')]=_[_0x0519('0x3f')](_0x2d486f[_0x0519('0x3d')],{'$or':_['map'](_0x59667b,function(_0x13c40e){if(_0x13c40e[_0x0519('0x30')]!==_0x0519('0x40')){var _0x58adcd={};_0x58adcd[_0x13c40e[_0x0519('0x2a')]]={'$like':'%'+_0xe0fa58[_0x0519('0x33')][_0x0519('0x41')]+'%'};return _0x58adcd;}})});}_0x2d486f=_['merge']({},_0x2d486f,_0xe0fa58[_0x0519('0x42')]);var _0x31cadd={'where':_0x2d486f[_0x0519('0x3d')]};return db[_0x0519('0x2e')]['count'](_0x31cadd)['then'](function(_0x5a0912){_0xd5e4a5[_0x0519('0x1e')]=_0x5a0912;if(_0xe0fa58['query']['includeAll']){_0x2d486f[_0x0519('0x43')]=[{'all':!![]}];}return db[_0x0519('0x2e')][_0x0519('0x44')](_0x2d486f);})[_0x0519('0x24')](function(_0x2ad5ae){_0xd5e4a5[_0x0519('0x45')]=_0x2ad5ae;return _0xd5e4a5;})['then'](respondWithFilteredResult(_0x208eff,_0x2d486f))['catch'](handleError(_0x208eff,null));};exports['show']=function(_0x121909,_0x13c077){var _0x4dafab={'raw':!![],'where':{'id':_0x121909[_0x0519('0x46')]['id']}},_0x47fa59={};_0x47fa59['model']=_[_0x0519('0x47')](db['AnalyticExtractedReport']['rawAttributes']);_0x47fa59[_0x0519('0x33')]=_[_0x0519('0x47')](_0x121909[_0x0519('0x33')]);_0x47fa59['filters']=_[_0x0519('0x35')](_0x47fa59[_0x0519('0x32')],_0x47fa59[_0x0519('0x33')]);_0x4dafab['attributes']=_[_0x0519('0x35')](_0x47fa59[_0x0519('0x32')],qs['fields'](_0x121909[_0x0519('0x33')][_0x0519('0x37')]));_0x4dafab[_0x0519('0x36')]=_0x4dafab[_0x0519('0x36')][_0x0519('0x38')]?_0x4dafab[_0x0519('0x36')]:_0x47fa59[_0x0519('0x32')];if(_0x121909['query'][_0x0519('0x48')]){_0x4dafab[_0x0519('0x43')]=[{'all':!![]}];}_0x4dafab=_[_0x0519('0x3f')]({},_0x4dafab,_0x121909[_0x0519('0x42')]);return db['AnalyticExtractedReport'][_0x0519('0x49')](_0x4dafab)[_0x0519('0x24')](handleEntityNotFound(_0x13c077,null))['then'](respondWithResult(_0x13c077,null))[_0x0519('0x4a')](handleError(_0x13c077,null));};exports['create']=function(_0x4ad621,_0x33f376){return db[_0x0519('0x2e')][_0x0519('0x4b')](_0x4ad621['body'],{})[_0x0519('0x24')](function(_0x26bfb9){var _0x3384a2=_0x4ad621[_0x0519('0x4c')][_0x0519('0x26')]({'plain':!![]});if(!_0x3384a2)throw new Error(_0x0519('0x4d'));if(_0x3384a2[_0x0519('0x4e')]==='user'){var _0x5ae9f2=_0x26bfb9[_0x0519('0x26')]({'plain':!![]});var _0x57b37f=_0x0519('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x57b37f,'userProfileId':_0x3384a2[_0x0519('0x4f')]},'raw':!![]})[_0x0519('0x24')](function(_0x1b954b){if(_0x1b954b&&_0x1b954b['autoAssociation']===0x0){return db[_0x0519('0x50')][_0x0519('0x4b')]({'name':_0x5ae9f2[_0x0519('0x2a')],'resourceId':_0x5ae9f2['id'],'type':_0x1b954b[_0x0519('0x2a')],'sectionId':_0x1b954b['id']},{})['then'](function(){return _0x26bfb9;});}else{return _0x26bfb9;}})[_0x0519('0x4a')](function(_0x47c4e7){logger[_0x0519('0x28')](_0x0519('0x51'),_0x47c4e7);throw _0x47c4e7;});}return _0x26bfb9;})[_0x0519('0x24')](respondWithResult(_0x33f376,0xc9))['catch'](handleError(_0x33f376,null));};exports[_0x0519('0x23')]=function(_0x38b73d,_0x3e0645){if(_0x38b73d['body']['id']){delete _0x38b73d[_0x0519('0x52')]['id'];}return db[_0x0519('0x2e')][_0x0519('0x49')]({'where':{'id':_0x38b73d[_0x0519('0x46')]['id']}})[_0x0519('0x24')](handleEntityNotFound(_0x3e0645,null))['then'](saveUpdates(_0x38b73d[_0x0519('0x52')],null))[_0x0519('0x24')](respondWithResult(_0x3e0645,null))['catch'](handleError(_0x3e0645,null));};exports[_0x0519('0x25')]=function(_0x1dbb63,_0x23d1b0){return db[_0x0519('0x2e')]['find']({'where':{'id':_0x1dbb63[_0x0519('0x46')]['id']}})[_0x0519('0x24')](handleEntityNotFound(_0x23d1b0,null))['then'](removeEntity(_0x23d1b0,null))[_0x0519('0x4a')](handleError(_0x23d1b0,null));};exports['download']=function(_0x115cde,_0x1459c8,_0x1c4371){return db[_0x0519('0x2e')]['find']({'where':{'id':_0x115cde['params']['id']},'attributes':[_0x0519('0x2a'),'basename',_0x0519('0x53'),'output'],'raw':!![]})[_0x0519('0x24')](handleEntityNotFound(_0x1459c8,null))[_0x0519('0x24')](function(_0x33b66b){if(_0x33b66b){if(!fs[_0x0519('0x54')](path[_0x0519('0x55')](config[_0x0519('0x56')],_0x0519('0x57'),_0x33b66b['savename']))){throw new db[(_0x0519('0x58'))]['ValidationError'](_0x0519('0x59'));}if(_0x115cde[_0x0519('0x33')][_0x0519('0x5a')]){return _0x1459c8['sendStatus'](0xc8);}return _0x1459c8[_0x0519('0x5b')](path[_0x0519('0x55')](config[_0x0519('0x56')],_0x0519('0x57'),_0x33b66b[_0x0519('0x53')]),util[_0x0519('0x5c')](_0x0519('0x5d'),_0x33b66b[_0x0519('0x5e')]||_0x33b66b[_0x0519('0x2a')],_0x33b66b['output'][_0x0519('0x5f')]()));}})['catch'](handleError(_0x1459c8,null));}; \ No newline at end of file +var _0xb1ba=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','json','apply','reject','save','update','then','ExtractedReports','UserProfileResource','destroy','end','error','stack','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','params','download','basename','savename','output','join','root','server/files/reports','ValidationError','exists','sendStatus','format','%s.%s','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xb1ba,0x106));var _0xab1b=function(_0xa1bfdd,_0x1ef403){_0xa1bfdd=_0xa1bfdd-0x0;var _0x31eea3=_0xb1ba[_0xa1bfdd];return _0x31eea3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab1b('0x0'));var zipdir=require(_0xab1b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab1b('0x2'));var moment=require(_0xab1b('0x3'));var BPromise=require(_0xab1b('0x4'));var Mustache=require(_0xab1b('0x5'));var util=require(_0xab1b('0x6'));var path=require('path');var sox=require(_0xab1b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab1b('0x8'));var squel=require('squel');var crypto=require(_0xab1b('0x9'));var jsforce=require(_0xab1b('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xab1b('0xb'));var querystring=require(_0xab1b('0xc'));var Papa=require(_0xab1b('0xd'));var Redis=require(_0xab1b('0xe'));var authService=require(_0xab1b('0xf'));var qs=require(_0xab1b('0x10'));var as=require(_0xab1b('0x11'));var hardwareService=require(_0xab1b('0x12'));var logger=require(_0xab1b('0x13'))(_0xab1b('0x14'));var utils=require(_0xab1b('0x15'));var config=require(_0xab1b('0x16'));var licenseUtil=require(_0xab1b('0x17'));var db=require(_0xab1b('0x18'))['db'];function respondWithStatusCode(_0x1ec072,_0x55184e){_0x55184e=_0x55184e||0xcc;return function(_0x1eaf42){if(_0x1eaf42){return _0x1ec072['sendStatus'](_0x55184e);}return _0x1ec072[_0xab1b('0x19')](_0x55184e)['end']();};}function respondWithResult(_0x489752,_0x22fb31){_0x22fb31=_0x22fb31||0xc8;return function(_0x567086){if(_0x567086){return _0x489752['status'](_0x22fb31)['json'](_0x567086);}};}function respondWithFilteredResult(_0x2c5bea,_0x373ebb){return function(_0x3ed468){if(_0x3ed468){var _0xd3d03a=typeof _0x373ebb[_0xab1b('0x1a')]===_0xab1b('0x1b')&&typeof _0x373ebb['limit']===_0xab1b('0x1b');var _0x5b7d81=_0x3ed468[_0xab1b('0x1c')];var _0x5770d1=_0xd3d03a?0x0:_0x373ebb[_0xab1b('0x1a')];var _0x508109=_0xd3d03a?_0x3ed468[_0xab1b('0x1c')]:_0x373ebb[_0xab1b('0x1a')]+_0x373ebb[_0xab1b('0x1d')];var _0xb244f1;if(_0x508109>=_0x5b7d81){_0x508109=_0x5b7d81;_0xb244f1=0xc8;}else{_0xb244f1=0xce;}_0x2c5bea[_0xab1b('0x19')](_0xb244f1);return _0x2c5bea[_0xab1b('0x1e')]('Content-Range',_0x5770d1+'-'+_0x508109+'/'+_0x5b7d81)[_0xab1b('0x1f')](_0x3ed468);}return null;};}function patchUpdates(_0x53198a){return function(_0x1ba430){try{jsonpatch[_0xab1b('0x20')](_0x1ba430,_0x53198a,!![]);}catch(_0x1470ef){return BPromise[_0xab1b('0x21')](_0x1470ef);}return _0x1ba430[_0xab1b('0x22')]();};}function saveUpdates(_0x20a3b9,_0x5998ec){return function(_0x537643){if(_0x537643){return _0x537643[_0xab1b('0x23')](_0x20a3b9)[_0xab1b('0x24')](function(_0xa44f23){return _0xa44f23;});}return null;};}function removeEntity(_0x5dc089,_0x57a7c0){return function(_0x297360){if(_0x297360){return _0x297360['destroy']()[_0xab1b('0x24')](function(){var _0x2b8483=_0x297360['get']({'plain':!![]});var _0x20e890=_0xab1b('0x25');return db[_0xab1b('0x26')][_0xab1b('0x27')]({'where':{'type':_0x20e890,'resourceId':_0x2b8483['id']}})[_0xab1b('0x24')](function(){return _0x297360;});})[_0xab1b('0x24')](function(){_0x5dc089[_0xab1b('0x19')](0xcc)[_0xab1b('0x28')]();});}};}function handleEntityNotFound(_0x42c935,_0x38a48b){return function(_0x306889){if(!_0x306889){_0x42c935['sendStatus'](0x194);}return _0x306889;};}function handleError(_0x5ef9de,_0x18f709){_0x18f709=_0x18f709||0x1f4;return function(_0x58c7f3){logger[_0xab1b('0x29')](_0x58c7f3[_0xab1b('0x2a')]);if(_0x58c7f3[_0xab1b('0x2b')]){delete _0x58c7f3[_0xab1b('0x2b')];}_0x5ef9de['status'](_0x18f709)[_0xab1b('0x2c')](_0x58c7f3);};}exports['index']=function(_0x54b150,_0x3db762){var _0x1869f7={},_0x2abe75={},_0x2a981c={'count':0x0,'rows':[]};var _0x1baf6b=_[_0xab1b('0x2d')](db[_0xab1b('0x2e')][_0xab1b('0x2f')],function(_0xfb89b0){return{'name':_0xfb89b0[_0xab1b('0x30')],'type':_0xfb89b0[_0xab1b('0x31')][_0xab1b('0x32')]};});_0x2abe75[_0xab1b('0x33')]=_[_0xab1b('0x2d')](_0x1baf6b,'name');_0x2abe75[_0xab1b('0x34')]=_[_0xab1b('0x35')](_0x54b150[_0xab1b('0x34')]);_0x2abe75['filters']=_[_0xab1b('0x36')](_0x2abe75[_0xab1b('0x33')],_0x2abe75['query']);_0x1869f7['attributes']=_[_0xab1b('0x36')](_0x2abe75['model'],qs[_0xab1b('0x37')](_0x54b150[_0xab1b('0x34')][_0xab1b('0x37')]));_0x1869f7[_0xab1b('0x38')]=_0x1869f7['attributes'][_0xab1b('0x39')]?_0x1869f7[_0xab1b('0x38')]:_0x2abe75[_0xab1b('0x33')];if(!_0x54b150[_0xab1b('0x34')][_0xab1b('0x3a')]('nolimit')){_0x1869f7[_0xab1b('0x1d')]=qs[_0xab1b('0x1d')](_0x54b150['query'][_0xab1b('0x1d')]);_0x1869f7[_0xab1b('0x1a')]=qs[_0xab1b('0x1a')](_0x54b150[_0xab1b('0x34')]['offset']);}_0x1869f7[_0xab1b('0x3b')]=qs[_0xab1b('0x3c')](_0x54b150[_0xab1b('0x34')]['sort']);_0x1869f7['where']=qs[_0xab1b('0x3d')](_[_0xab1b('0x3e')](_0x54b150[_0xab1b('0x34')],_0x2abe75[_0xab1b('0x3d')]),_0x1baf6b);if(_0x54b150[_0xab1b('0x34')][_0xab1b('0x3f')]){_0x1869f7[_0xab1b('0x40')]=_[_0xab1b('0x41')](_0x1869f7[_0xab1b('0x40')],{'$or':_[_0xab1b('0x2d')](_0x1baf6b,function(_0x4cacae){if(_0x4cacae[_0xab1b('0x31')]!==_0xab1b('0x42')){var _0x2dc159={};_0x2dc159[_0x4cacae[_0xab1b('0x2b')]]={'$like':'%'+_0x54b150[_0xab1b('0x34')][_0xab1b('0x3f')]+'%'};return _0x2dc159;}})});}_0x1869f7=_[_0xab1b('0x41')]({},_0x1869f7,_0x54b150[_0xab1b('0x43')]);var _0x3b9fed={'where':_0x1869f7[_0xab1b('0x40')]};return db['AnalyticExtractedReport'][_0xab1b('0x1c')](_0x3b9fed)[_0xab1b('0x24')](function(_0x4cfeb0){_0x2a981c[_0xab1b('0x1c')]=_0x4cfeb0;if(_0x54b150['query'][_0xab1b('0x44')]){_0x1869f7[_0xab1b('0x45')]=[{'all':!![]}];}return db[_0xab1b('0x2e')][_0xab1b('0x46')](_0x1869f7);})['then'](function(_0x1698ed){_0x2a981c[_0xab1b('0x47')]=_0x1698ed;return _0x2a981c;})[_0xab1b('0x24')](respondWithFilteredResult(_0x3db762,_0x1869f7))[_0xab1b('0x48')](handleError(_0x3db762,null));};exports[_0xab1b('0x49')]=function(_0xb55d,_0x5285f7){var _0x3217b9={'raw':!![],'where':{'id':_0xb55d['params']['id']}},_0x1dd791={};_0x1dd791[_0xab1b('0x33')]=_[_0xab1b('0x35')](db['AnalyticExtractedReport'][_0xab1b('0x2f')]);_0x1dd791[_0xab1b('0x34')]=_[_0xab1b('0x35')](_0xb55d[_0xab1b('0x34')]);_0x1dd791[_0xab1b('0x3d')]=_['intersection'](_0x1dd791[_0xab1b('0x33')],_0x1dd791[_0xab1b('0x34')]);_0x3217b9[_0xab1b('0x38')]=_[_0xab1b('0x36')](_0x1dd791[_0xab1b('0x33')],qs[_0xab1b('0x37')](_0xb55d[_0xab1b('0x34')]['fields']));_0x3217b9[_0xab1b('0x38')]=_0x3217b9[_0xab1b('0x38')][_0xab1b('0x39')]?_0x3217b9[_0xab1b('0x38')]:_0x1dd791[_0xab1b('0x33')];if(_0xb55d[_0xab1b('0x34')][_0xab1b('0x44')]){_0x3217b9[_0xab1b('0x45')]=[{'all':!![]}];}_0x3217b9=_[_0xab1b('0x41')]({},_0x3217b9,_0xb55d[_0xab1b('0x43')]);return db[_0xab1b('0x2e')]['find'](_0x3217b9)[_0xab1b('0x24')](handleEntityNotFound(_0x5285f7,null))[_0xab1b('0x24')](respondWithResult(_0x5285f7,null))[_0xab1b('0x48')](handleError(_0x5285f7,null));};exports['create']=function(_0x22e401,_0x483fe9){return db[_0xab1b('0x2e')][_0xab1b('0x4a')](_0x22e401[_0xab1b('0x4b')],{})['then'](function(_0x251054){var _0x3af196=_0x22e401[_0xab1b('0x4c')][_0xab1b('0x4d')]({'plain':!![]});if(!_0x3af196)throw new Error(_0xab1b('0x4e'));if(_0x3af196['role']===_0xab1b('0x4c')){var _0x279fbf=_0x251054['get']({'plain':!![]});var _0x452d39=_0xab1b('0x25');return db['UserProfileSection'][_0xab1b('0x4f')]({'where':{'name':_0x452d39,'userProfileId':_0x3af196[_0xab1b('0x50')]},'raw':!![]})[_0xab1b('0x24')](function(_0x100af0){if(_0x100af0&&_0x100af0['autoAssociation']===0x0){return db[_0xab1b('0x26')][_0xab1b('0x4a')]({'name':_0x279fbf[_0xab1b('0x2b')],'resourceId':_0x279fbf['id'],'type':_0x100af0[_0xab1b('0x2b')],'sectionId':_0x100af0['id']},{})[_0xab1b('0x24')](function(){return _0x251054;});}else{return _0x251054;}})['catch'](function(_0x1ea04d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ea04d);throw _0x1ea04d;});}return _0x251054;})[_0xab1b('0x24')](respondWithResult(_0x483fe9,0xc9))[_0xab1b('0x48')](handleError(_0x483fe9,null));};exports['update']=function(_0x1a0773,_0x307d53){if(_0x1a0773[_0xab1b('0x4b')]['id']){delete _0x1a0773[_0xab1b('0x4b')]['id'];}return db[_0xab1b('0x2e')][_0xab1b('0x4f')]({'where':{'id':_0x1a0773[_0xab1b('0x51')]['id']}})[_0xab1b('0x24')](handleEntityNotFound(_0x307d53,null))[_0xab1b('0x24')](saveUpdates(_0x1a0773[_0xab1b('0x4b')],null))[_0xab1b('0x24')](respondWithResult(_0x307d53,null))[_0xab1b('0x48')](handleError(_0x307d53,null));};exports['destroy']=function(_0x541b69,_0x5f1431){return db['AnalyticExtractedReport'][_0xab1b('0x4f')]({'where':{'id':_0x541b69[_0xab1b('0x51')]['id']}})[_0xab1b('0x24')](handleEntityNotFound(_0x5f1431,null))[_0xab1b('0x24')](removeEntity(_0x5f1431,null))['catch'](handleError(_0x5f1431,null));};exports[_0xab1b('0x52')]=function(_0x3c2cd8,_0x2e8b3a,_0x3b2a58){return db[_0xab1b('0x2e')][_0xab1b('0x4f')]({'where':{'id':_0x3c2cd8[_0xab1b('0x51')]['id']},'attributes':[_0xab1b('0x2b'),_0xab1b('0x53'),_0xab1b('0x54'),_0xab1b('0x55')],'raw':!![]})[_0xab1b('0x24')](handleEntityNotFound(_0x2e8b3a,null))[_0xab1b('0x24')](function(_0x291b80){if(_0x291b80){if(!fs['existsSync'](path[_0xab1b('0x56')](config[_0xab1b('0x57')],_0xab1b('0x58'),_0x291b80['savename']))){throw new db['Sequelize'][(_0xab1b('0x59'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x3c2cd8[_0xab1b('0x34')][_0xab1b('0x5a')]){return _0x2e8b3a[_0xab1b('0x5b')](0xc8);}return _0x2e8b3a[_0xab1b('0x52')](path['join'](config['root'],_0xab1b('0x58'),_0x291b80[_0xab1b('0x54')]),util[_0xab1b('0x5c')](_0xab1b('0x5d'),_0x291b80[_0xab1b('0x53')]||_0x291b80[_0xab1b('0x2b')],_0x291b80[_0xab1b('0x55')]['toLowerCase']()));}})[_0xab1b('0x48')](handleError(_0x2e8b3a,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index cf771da..6efb315 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 _0x2a5e=['path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x2a5e,0xe7));var _0xe2a5=function(_0x321522,_0x15aa5a){_0x321522=_0x321522-0x0;var _0x41488d=_0x2a5e[_0x321522];return _0x41488d;};'use strict';var _=require(_0xe2a5('0x0'));var util=require(_0xe2a5('0x1'));var logger=require(_0xe2a5('0x2'))(_0xe2a5('0x3'));var moment=require(_0xe2a5('0x4'));var BPromise=require(_0xe2a5('0x5'));var rp=require(_0xe2a5('0x6'));var fs=require('fs');var path=require(_0xe2a5('0x7'));var rimraf=require(_0xe2a5('0x8'));var config=require(_0xe2a5('0x9'));var attributes=require(_0xe2a5('0xa'));module[_0xe2a5('0xb')]=function(_0x3c2611,_0x77d874){return _0x3c2611[_0xe2a5('0xc')](_0xe2a5('0xd'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1139=['../../config/logger','api','moment','request-promise','path','../../config/environment','define','AnalyticExtractedReport','lodash','util'];(function(_0x51b7c5,_0x218969){var _0x3355d7=function(_0x2cce68){while(--_0x2cce68){_0x51b7c5['push'](_0x51b7c5['shift']());}};_0x3355d7(++_0x218969);}(_0x1139,0x152));var _0x9113=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x1139[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x9113('0x0'));var util=require(_0x9113('0x1'));var logger=require(_0x9113('0x2'))(_0x9113('0x3'));var moment=require(_0x9113('0x4'));var BPromise=require('bluebird');var rp=require(_0x9113('0x5'));var fs=require('fs');var path=require(_0x9113('0x6'));var rimraf=require('rimraf');var config=require(_0x9113('0x7'));var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x337c89,_0x178470){return _0x337c89[_0x9113('0x8')](_0x9113('0x9'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 8c48331..21d35f6 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 _0x15ac=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x8ec0a5,_0x2d3796){var _0x7765c1=function(_0x2ec888){while(--_0x2ec888){_0x8ec0a5['push'](_0x8ec0a5['shift']());}};_0x7765c1(++_0x2d3796);}(_0x15ac,0x68));var _0xc15a=function(_0x3dac9c,_0x4d1f97){_0x3dac9c=_0x3dac9c-0x0;var _0x51fdd0=_0x15ac[_0x3dac9c];return _0x51fdd0;};'use strict';var _=require(_0xc15a('0x0'));var util=require(_0xc15a('0x1'));var moment=require(_0xc15a('0x2'));var BPromise=require(_0xc15a('0x3'));var rs=require(_0xc15a('0x4'));var fs=require('fs');var Redis=require(_0xc15a('0x5'));var db=require(_0xc15a('0x6'))['db'];var utils=require(_0xc15a('0x7'));var logger=require(_0xc15a('0x8'))(_0xc15a('0x9'));var config=require(_0xc15a('0xa'));var jayson=require(_0xc15a('0xb'));var client=jayson[_0xc15a('0xc')][_0xc15a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2ecf28,_0x2ce9e7,_0x27e049){return new BPromise(function(_0x326275,_0x109af){return client[_0xc15a('0xe')](_0x2ecf28,_0x27e049)[_0xc15a('0xf')](function(_0x520b9c){logger['info'](_0xc15a('0x10'),_0x2ce9e7,_0xc15a('0x11'));logger[_0xc15a('0x12')](_0xc15a('0x13'),_0x2ce9e7,_0xc15a('0x11'),JSON[_0xc15a('0x14')](_0x520b9c));if(_0x520b9c[_0xc15a('0x15')]){if(_0x520b9c['error'][_0xc15a('0x16')]===0x1f4){logger[_0xc15a('0x15')](_0xc15a('0x10'),_0x2ce9e7,_0x520b9c[_0xc15a('0x15')][_0xc15a('0x17')]);return _0x109af(_0x520b9c[_0xc15a('0x15')][_0xc15a('0x17')]);}logger[_0xc15a('0x15')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2ce9e7,_0x520b9c[_0xc15a('0x15')]['message']);return _0x326275(_0x520b9c['error']['message']);}else{logger['info'](_0xc15a('0x10'),_0x2ce9e7,_0xc15a('0x11'));_0x326275(_0x520b9c[_0xc15a('0x18')]['message']);}})['catch'](function(_0x2d7d2c){logger[_0xc15a('0x15')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2ce9e7,_0x2d7d2c);_0x109af(_0x2d7d2c);});});} \ No newline at end of file +var _0x139b=['AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x52099a,_0x5a540b){var _0x373c39=function(_0xdd3d6){while(--_0xdd3d6){_0x52099a['push'](_0x52099a['shift']());}};_0x373c39(++_0x5a540b);}(_0x139b,0x170));var _0xb139=function(_0xcac8d9,_0x1bce77){_0xcac8d9=_0xcac8d9-0x0;var _0x153371=_0x139b[_0xcac8d9];return _0x153371;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb139('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb139('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xb139('0x2'));var logger=require(_0xb139('0x3'))(_0xb139('0x4'));var config=require(_0xb139('0x5'));var jayson=require(_0xb139('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20d529,_0x171ac7,_0x5ef5e0){return new BPromise(function(_0x11e0cb,_0x327bce){return client[_0xb139('0x7')](_0x20d529,_0x5ef5e0)[_0xb139('0x8')](function(_0x62a6da){logger[_0xb139('0x9')](_0xb139('0xa'),_0x171ac7,_0xb139('0xb'));logger[_0xb139('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x171ac7,_0xb139('0xb'),JSON[_0xb139('0xd')](_0x62a6da));if(_0x62a6da['error']){if(_0x62a6da[_0xb139('0xe')]['code']===0x1f4){logger[_0xb139('0xe')](_0xb139('0xa'),_0x171ac7,_0x62a6da[_0xb139('0xe')][_0xb139('0xf')]);return _0x327bce(_0x62a6da[_0xb139('0xe')]['message']);}logger[_0xb139('0xe')](_0xb139('0xa'),_0x171ac7,_0x62a6da[_0xb139('0xe')][_0xb139('0xf')]);return _0x11e0cb(_0x62a6da[_0xb139('0xe')][_0xb139('0xf')]);}else{logger[_0xb139('0x9')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x171ac7,'request\x20sent');_0x11e0cb(_0x62a6da[_0xb139('0x10')][_0xb139('0xf')]);}})[_0xb139('0x11')](function(_0x1ad263){logger[_0xb139('0xe')](_0xb139('0xa'),_0x171ac7,_0x1ad263);_0x327bce(_0x1ad263);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 60781e5..f4ecd3d 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 _0x377f=['../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','index','get','show','/:id/download','isAuthenticated','download','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x105c32,_0x4ac0e5){var _0x2f8161=function(_0x1d1220){while(--_0x1d1220){_0x105c32['push'](_0x105c32['shift']());}};_0x2f8161(++_0x4ac0e5);}(_0x377f,0xb1));var _0xf377=function(_0x4be53d,_0x1f1c6e){_0x4be53d=_0x4be53d-0x0;var _0x1ae3dd=_0x377f[_0x4be53d];return _0x1ae3dd;};'use strict';var multer=require('multer');var util=require(_0xf377('0x0'));var path=require(_0xf377('0x1'));var timeout=require(_0xf377('0x2'));var express=require(_0xf377('0x3'));var router=express[_0xf377('0x4')]();var fs_extra=require(_0xf377('0x5'));var auth=require(_0xf377('0x6'));var interaction=require(_0xf377('0x7'));var config=require(_0xf377('0x8'));var controller=require(_0xf377('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf377('0xa')]);router[_0xf377('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xf377('0xc')]);router[_0xf377('0xb')](_0xf377('0xd'),auth[_0xf377('0xe')](),controller[_0xf377('0xf')]);router[_0xf377('0x10')]('/',auth[_0xf377('0xe')](),controller[_0xf377('0x11')]);router[_0xf377('0x12')](_0xf377('0x13'),auth['isAuthenticated'](),controller[_0xf377('0x14')]);router[_0xf377('0x15')](_0xf377('0x13'),auth[_0xf377('0xe')](),controller[_0xf377('0x16')]);module['exports']=router; \ No newline at end of file +var _0x8978=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id/download','download','post','put','/:id'];(function(_0x24ba0f,_0x3931e6){var _0x2073a6=function(_0x41d3f6){while(--_0x41d3f6){_0x24ba0f['push'](_0x24ba0f['shift']());}};_0x2073a6(++_0x3931e6);}(_0x8978,0x14d));var _0x8897=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x8978[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x8897('0x0'));var util=require(_0x8897('0x1'));var path=require(_0x8897('0x2'));var timeout=require(_0x8897('0x3'));var express=require(_0x8897('0x4'));var router=express[_0x8897('0x5')]();var fs_extra=require(_0x8897('0x6'));var auth=require(_0x8897('0x7'));var interaction=require(_0x8897('0x8'));var config=require(_0x8897('0x9'));var controller=require(_0x8897('0xa'));router[_0x8897('0xb')]('/',auth[_0x8897('0xc')](),controller[_0x8897('0xd')]);router[_0x8897('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8897('0xb')](_0x8897('0xe'),auth['isAuthenticated'](),controller[_0x8897('0xf')]);router[_0x8897('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8897('0x11')](_0x8897('0x12'),auth[_0x8897('0xc')](),controller[_0x8897('0x13')]);router[_0x8897('0x14')]('/:id',auth[_0x8897('0xc')](),controller[_0x8897('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 39e90ae..7251e6f 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 _0x9fc3=['TEXT','STRING','BOOLEAN','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9fc3,0x1e3));var _0x39fc=function(_0x1f17cc,_0x52406f){_0x1f17cc=_0x1f17cc-0x0;var _0x220ef8=_0x9fc3[_0x1f17cc];return _0x220ef8;};'use strict';var Sequelize=require('sequelize');module[_0x39fc('0x0')]={'field':{'type':Sequelize[_0x39fc('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x39fc('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x39fc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x39fc('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6def=['BOOLEAN','exports','TEXT','STRING'];(function(_0x106bc0,_0x538f68){var _0x2aacab=function(_0x1f264d){while(--_0x1f264d){_0x106bc0['push'](_0x106bc0['shift']());}};_0x2aacab(++_0x538f68);}(_0x6def,0x7d));var _0xf6de=function(_0x4029e1,_0x45ecf6){_0x4029e1=_0x4029e1-0x0;var _0x5aa63b=_0x6def[_0x4029e1];return _0x5aa63b;};'use strict';var Sequelize=require('sequelize');module[_0xf6de('0x0')]={'field':{'type':Sequelize[_0xf6de('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xf6de('0x2')]},'groupBy':{'type':Sequelize[_0xf6de('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xf6de('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index d53e083..ffe79e5 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 _0xa6ec=['include','catch','show','find','create','body','bulkCreate','params','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','destroy','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','offset','set','Content-Range','json','apply','save','update','then','end','error','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','options','count','includeAll'];(function(_0x439cea,_0x115a1c){var _0x55f8a9=function(_0x3ed1cd){while(--_0x3ed1cd){_0x439cea['push'](_0x439cea['shift']());}};_0x55f8a9(++_0x115a1c);}(_0xa6ec,0x154));var _0xca6e=function(_0x43636b,_0x4b27ff){_0x43636b=_0x43636b-0x0;var _0x1ae192=_0xa6ec[_0x43636b];return _0x1ae192;};'use strict';var emlformat=require(_0xca6e('0x0'));var rimraf=require(_0xca6e('0x1'));var zipdir=require(_0xca6e('0x2'));var jsonpatch=require(_0xca6e('0x3'));var rp=require(_0xca6e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xca6e('0x5'));var util=require(_0xca6e('0x6'));var path=require(_0xca6e('0x7'));var sox=require(_0xca6e('0x8'));var csv=require(_0xca6e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca6e('0xa'));var _=require(_0xca6e('0xb'));var squel=require(_0xca6e('0xc'));var crypto=require(_0xca6e('0xd'));var jsforce=require(_0xca6e('0xe'));var deskjs=require(_0xca6e('0xf'));var toCsv=require(_0xca6e('0x9'));var querystring=require('querystring');var Papa=require(_0xca6e('0x10'));var Redis=require(_0xca6e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xca6e('0x12'));var as=require(_0xca6e('0x13'));var hardwareService=require(_0xca6e('0x14'));var logger=require(_0xca6e('0x15'))(_0xca6e('0x16'));var utils=require(_0xca6e('0x17'));var config=require(_0xca6e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xca6e('0x19'))['db'];function respondWithStatusCode(_0x1304a7,_0xe87021){_0xe87021=_0xe87021||0xcc;return function(_0x8498fd){if(_0x8498fd){return _0x1304a7[_0xca6e('0x1a')](_0xe87021);}return _0x1304a7['status'](_0xe87021)['end']();};}function respondWithResult(_0x218c69,_0x146cd6){_0x146cd6=_0x146cd6||0xc8;return function(_0x28bde6){if(_0x28bde6){return _0x218c69[_0xca6e('0x1b')](_0x146cd6)['json'](_0x28bde6);}};}function respondWithFilteredResult(_0x1d2172,_0x129ee2){return function(_0x2849ec){if(_0x2849ec){var _0x329bdc=typeof _0x129ee2['offset']===_0xca6e('0x1c')&&typeof _0x129ee2[_0xca6e('0x1d')]==='undefined';var _0x31e341=_0x2849ec['count'];var _0x46f311=_0x329bdc?0x0:_0x129ee2[_0xca6e('0x1e')];var _0x444036=_0x329bdc?_0x2849ec['count']:_0x129ee2[_0xca6e('0x1e')]+_0x129ee2[_0xca6e('0x1d')];var _0x558f5d;if(_0x444036>=_0x31e341){_0x444036=_0x31e341;_0x558f5d=0xc8;}else{_0x558f5d=0xce;}_0x1d2172['status'](_0x558f5d);return _0x1d2172[_0xca6e('0x1f')](_0xca6e('0x20'),_0x46f311+'-'+_0x444036+'/'+_0x31e341)[_0xca6e('0x21')](_0x2849ec);}return null;};}function patchUpdates(_0xee6d0a){return function(_0x1e0526){try{jsonpatch[_0xca6e('0x22')](_0x1e0526,_0xee6d0a,!![]);}catch(_0x1396e5){return BPromise['reject'](_0x1396e5);}return _0x1e0526[_0xca6e('0x23')]();};}function saveUpdates(_0xbbe837,_0x72f532){return function(_0x8b5da2){if(_0x8b5da2){return _0x8b5da2[_0xca6e('0x24')](_0xbbe837)[_0xca6e('0x25')](function(_0x15b6c8){return _0x15b6c8;});}return null;};}function removeEntity(_0x82f4ca,_0x5558dc){return function(_0x26417a){if(_0x26417a){return _0x26417a['destroy']()[_0xca6e('0x25')](function(){_0x82f4ca[_0xca6e('0x1b')](0xcc)[_0xca6e('0x26')]();});}};}function handleEntityNotFound(_0x4cceab,_0x54186e){return function(_0x4993d7){if(!_0x4993d7){_0x4cceab[_0xca6e('0x1a')](0x194);}return _0x4993d7;};}function handleError(_0x3537b8,_0x2a15b0){_0x2a15b0=_0x2a15b0||0x1f4;return function(_0x2f1055){logger[_0xca6e('0x27')](_0x2f1055['stack']);if(_0x2f1055[_0xca6e('0x28')]){delete _0x2f1055['name'];}_0x3537b8['status'](_0x2a15b0)[_0xca6e('0x29')](_0x2f1055);};}exports[_0xca6e('0x2a')]=function(_0x457f3e,_0x445a34){var _0x38edc6={},_0x1a6c82={},_0x2e30fc={'count':0x0,'rows':[]};var _0x4938f6=_[_0xca6e('0x2b')](db[_0xca6e('0x2c')][_0xca6e('0x2d')],function(_0xd9d39f){return{'name':_0xd9d39f[_0xca6e('0x2e')],'type':_0xd9d39f['type'][_0xca6e('0x2f')]};});_0x1a6c82[_0xca6e('0x30')]=_[_0xca6e('0x2b')](_0x4938f6,_0xca6e('0x28'));_0x1a6c82['query']=_[_0xca6e('0x31')](_0x457f3e[_0xca6e('0x32')]);_0x1a6c82[_0xca6e('0x33')]=_[_0xca6e('0x34')](_0x1a6c82[_0xca6e('0x30')],_0x1a6c82[_0xca6e('0x32')]);_0x38edc6['attributes']=_[_0xca6e('0x34')](_0x1a6c82[_0xca6e('0x30')],qs[_0xca6e('0x35')](_0x457f3e['query'][_0xca6e('0x35')]));_0x38edc6['attributes']=_0x38edc6[_0xca6e('0x36')]['length']?_0x38edc6[_0xca6e('0x36')]:_0x1a6c82[_0xca6e('0x30')];if(!_0x457f3e['query'][_0xca6e('0x37')](_0xca6e('0x38'))){_0x38edc6[_0xca6e('0x1d')]=qs['limit'](_0x457f3e[_0xca6e('0x32')]['limit']);_0x38edc6['offset']=qs[_0xca6e('0x1e')](_0x457f3e[_0xca6e('0x32')]['offset']);}_0x38edc6['order']=qs[_0xca6e('0x39')](_0x457f3e['query'][_0xca6e('0x39')]);_0x38edc6['where']=qs[_0xca6e('0x33')](_['pick'](_0x457f3e['query'],_0x1a6c82[_0xca6e('0x33')]),_0x4938f6);if(_0x457f3e[_0xca6e('0x32')]['filter']){_0x38edc6[_0xca6e('0x3a')]=_[_0xca6e('0x3b')](_0x38edc6[_0xca6e('0x3a')],{'$or':_[_0xca6e('0x2b')](_0x4938f6,function(_0x27b6ac){if(_0x27b6ac[_0xca6e('0x3c')]!==_0xca6e('0x3d')){var _0x5dc61c={};_0x5dc61c[_0x27b6ac[_0xca6e('0x28')]]={'$like':'%'+_0x457f3e[_0xca6e('0x32')]['filter']+'%'};return _0x5dc61c;}})});}_0x38edc6=_[_0xca6e('0x3b')]({},_0x38edc6,_0x457f3e[_0xca6e('0x3e')]);var _0x291234={'where':_0x38edc6[_0xca6e('0x3a')]};return db[_0xca6e('0x2c')]['count'](_0x291234)['then'](function(_0x4879ca){_0x2e30fc[_0xca6e('0x3f')]=_0x4879ca;if(_0x457f3e[_0xca6e('0x32')][_0xca6e('0x40')]){_0x38edc6[_0xca6e('0x41')]=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x38edc6);})[_0xca6e('0x25')](function(_0x1d592a){_0x2e30fc['rows']=_0x1d592a;return _0x2e30fc;})[_0xca6e('0x25')](respondWithFilteredResult(_0x445a34,_0x38edc6))[_0xca6e('0x42')](handleError(_0x445a34,null));};exports[_0xca6e('0x43')]=function(_0x721d9d,_0x509fef){var _0x1c7e14={'raw':![],'where':{'id':_0x721d9d['params']['id']}},_0x399790={};_0x399790[_0xca6e('0x30')]=_[_0xca6e('0x31')](db['AnalyticFieldReport']['rawAttributes']);_0x399790[_0xca6e('0x32')]=_['keys'](_0x721d9d[_0xca6e('0x32')]);_0x399790[_0xca6e('0x33')]=_[_0xca6e('0x34')](_0x399790[_0xca6e('0x30')],_0x399790[_0xca6e('0x32')]);_0x1c7e14[_0xca6e('0x36')]=_[_0xca6e('0x34')](_0x399790['model'],qs[_0xca6e('0x35')](_0x721d9d[_0xca6e('0x32')][_0xca6e('0x35')]));_0x1c7e14[_0xca6e('0x36')]=_0x1c7e14[_0xca6e('0x36')]['length']?_0x1c7e14['attributes']:_0x399790[_0xca6e('0x30')];if(_0x721d9d[_0xca6e('0x32')][_0xca6e('0x40')]){_0x1c7e14[_0xca6e('0x41')]=[{'all':!![]}];}_0x1c7e14=_[_0xca6e('0x3b')]({},_0x1c7e14,_0x721d9d[_0xca6e('0x3e')]);return db[_0xca6e('0x2c')][_0xca6e('0x44')](_0x1c7e14)[_0xca6e('0x25')](handleEntityNotFound(_0x509fef,null))['then'](respondWithResult(_0x509fef,null))[_0xca6e('0x42')](handleError(_0x509fef,null));};exports['create']=function(_0x1d787f,_0x42a1c7){return db[_0xca6e('0x2c')][_0xca6e('0x45')](_0x1d787f[_0xca6e('0x46')],{})[_0xca6e('0x25')](respondWithResult(_0x42a1c7,0xc9))[_0xca6e('0x42')](handleError(_0x42a1c7,null));};exports[_0xca6e('0x47')]=function(_0x4c61df,_0x1b9564){return db['AnalyticFieldReport'][_0xca6e('0x47')](_0x4c61df[_0xca6e('0x46')],{'raw':![],'individualHooks':!![]})[_0xca6e('0x25')](respondWithResult(_0x1b9564,0xc9))[_0xca6e('0x42')](handleError(_0x1b9564,null));};exports[_0xca6e('0x24')]=function(_0x579663,_0x4e6f98){if(_0x579663['body']['id']){delete _0x579663[_0xca6e('0x46')]['id'];}return db[_0xca6e('0x2c')]['find']({'where':{'id':_0x579663['params']['id']}})[_0xca6e('0x25')](handleEntityNotFound(_0x4e6f98,null))[_0xca6e('0x25')](saveUpdates(_0x579663[_0xca6e('0x46')],null))[_0xca6e('0x25')](respondWithResult(_0x4e6f98,null))[_0xca6e('0x42')](handleError(_0x4e6f98,null));};exports['destroy']=function(_0xcc6f9d,_0x144089){return db[_0xca6e('0x2c')]['find']({'where':{'id':_0xcc6f9d[_0xca6e('0x48')]['id']}})[_0xca6e('0x25')](handleEntityNotFound(_0x144089,null))[_0xca6e('0x25')](removeEntity(_0x144089,null))[_0xca6e('0x42')](handleError(_0x144089,null));};exports[_0xca6e('0x49')]=function(_0x45e07f,_0x474bec){return db[_0xca6e('0x2c')]['destroy']({'where':{'id':_0x45e07f[_0xca6e('0x32')][_0xca6e('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0xca6e('0x25')](respondWithResult(_0x474bec,0xcc))['catch'](handleError(_0x474bec,null));};exports[_0xca6e('0x4b')]=function(_0x44c5bd,_0x3f72d4,_0x4d7a63){return db[_0xca6e('0x4c')][_0xca6e('0x4d')]({'where':{'id':_0x44c5bd[_0xca6e('0x48')]['id']}})[_0xca6e('0x25')](handleEntityNotFound(_0x3f72d4,null))['then'](function(_0x250e15){if(_0x250e15){return db['sequelize'][_0xca6e('0x4e')](function(_0x54acf4){return db[_0xca6e('0x2c')][_0xca6e('0x4f')]({'where':{'CustomReportId':_0x44c5bd[_0xca6e('0x48')]['id']},'transaction':_0x54acf4})[_0xca6e('0x25')](function(_0x4d16cb){var _0x27d496=_['map'](_0x44c5bd['body'],function(_0x206dd2){delete _0x206dd2['id'];_0x206dd2[_0xca6e('0x50')]=_0x44c5bd['params']['id'];return _0x206dd2;});return db[_0xca6e('0x2c')]['bulkCreate'](_0x27d496,{'transaction':_0x54acf4});});})['then'](function(){return db[_0xca6e('0x2c')]['findAll']({'where':{'CustomReportId':_0x44c5bd[_0xca6e('0x48')]['id']}});});}})[_0xca6e('0x25')](respondWithResult(_0x3f72d4,null))[_0xca6e('0x42')](handleError(_0x3f72d4,null));}; \ No newline at end of file +var _0x6a05=['include','findAll','catch','params','rawAttributes','options','find','create','bulkCreate','body','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','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','end','status','json','offset','undefined','limit','count','apply','reject','save','then','destroy','sendStatus','send','index','map','AnalyticFieldReport','fieldName','type','key','model','name','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6a05,0x191));var _0x56a0=function(_0x340da7,_0x13d6fc){_0x340da7=_0x340da7-0x0;var _0x43b466=_0x6a05[_0x340da7];return _0x43b466;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x56a0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x56a0('0x1'));var rp=require(_0x56a0('0x2'));var moment=require(_0x56a0('0x3'));var BPromise=require(_0x56a0('0x4'));var Mustache=require(_0x56a0('0x5'));var util=require('util');var path=require('path');var sox=require(_0x56a0('0x6'));var csv=require(_0x56a0('0x7'));var ejs=require(_0x56a0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x56a0('0x9'));var crypto=require(_0x56a0('0xa'));var jsforce=require(_0x56a0('0xb'));var deskjs=require(_0x56a0('0xc'));var toCsv=require(_0x56a0('0x7'));var querystring=require(_0x56a0('0xd'));var Papa=require(_0x56a0('0xe'));var Redis=require(_0x56a0('0xf'));var authService=require(_0x56a0('0x10'));var qs=require(_0x56a0('0x11'));var as=require(_0x56a0('0x12'));var hardwareService=require(_0x56a0('0x13'));var logger=require(_0x56a0('0x14'))('api');var utils=require(_0x56a0('0x15'));var config=require(_0x56a0('0x16'));var licenseUtil=require(_0x56a0('0x17'));var db=require(_0x56a0('0x18'))['db'];function respondWithStatusCode(_0x5eccd5,_0x436e91){_0x436e91=_0x436e91||0xcc;return function(_0xdf36b0){if(_0xdf36b0){return _0x5eccd5['sendStatus'](_0x436e91);}return _0x5eccd5['status'](_0x436e91)[_0x56a0('0x19')]();};}function respondWithResult(_0x518ef2,_0x35e7dd){_0x35e7dd=_0x35e7dd||0xc8;return function(_0x11d814){if(_0x11d814){return _0x518ef2[_0x56a0('0x1a')](_0x35e7dd)[_0x56a0('0x1b')](_0x11d814);}};}function respondWithFilteredResult(_0x5aec68,_0x3ea2b7){return function(_0x516ff4){if(_0x516ff4){var _0x5edd6b=typeof _0x3ea2b7[_0x56a0('0x1c')]===_0x56a0('0x1d')&&typeof _0x3ea2b7[_0x56a0('0x1e')]===_0x56a0('0x1d');var _0xfee832=_0x516ff4[_0x56a0('0x1f')];var _0x326a74=_0x5edd6b?0x0:_0x3ea2b7[_0x56a0('0x1c')];var _0x36b06f=_0x5edd6b?_0x516ff4[_0x56a0('0x1f')]:_0x3ea2b7[_0x56a0('0x1c')]+_0x3ea2b7['limit'];var _0x5691b9;if(_0x36b06f>=_0xfee832){_0x36b06f=_0xfee832;_0x5691b9=0xc8;}else{_0x5691b9=0xce;}_0x5aec68['status'](_0x5691b9);return _0x5aec68['set']('Content-Range',_0x326a74+'-'+_0x36b06f+'/'+_0xfee832)[_0x56a0('0x1b')](_0x516ff4);}return null;};}function patchUpdates(_0x56e452){return function(_0x181702){try{jsonpatch[_0x56a0('0x20')](_0x181702,_0x56e452,!![]);}catch(_0x203f12){return BPromise[_0x56a0('0x21')](_0x203f12);}return _0x181702[_0x56a0('0x22')]();};}function saveUpdates(_0x15defa,_0x5f3dac){return function(_0x4013c4){if(_0x4013c4){return _0x4013c4['update'](_0x15defa)[_0x56a0('0x23')](function(_0x5dca50){return _0x5dca50;});}return null;};}function removeEntity(_0x53ddc6,_0x5673ff){return function(_0x52df0f){if(_0x52df0f){return _0x52df0f[_0x56a0('0x24')]()[_0x56a0('0x23')](function(){_0x53ddc6[_0x56a0('0x1a')](0xcc)[_0x56a0('0x19')]();});}};}function handleEntityNotFound(_0x269464,_0x829957){return function(_0x55e959){if(!_0x55e959){_0x269464[_0x56a0('0x25')](0x194);}return _0x55e959;};}function handleError(_0x658c9f,_0x322747){_0x322747=_0x322747||0x1f4;return function(_0x2819df){logger['error'](_0x2819df['stack']);if(_0x2819df['name']){delete _0x2819df['name'];}_0x658c9f[_0x56a0('0x1a')](_0x322747)[_0x56a0('0x26')](_0x2819df);};}exports[_0x56a0('0x27')]=function(_0x53d782,_0x222734){var _0x405f7c={},_0x4f4477={},_0x5f4bc5={'count':0x0,'rows':[]};var _0x3208f9=_[_0x56a0('0x28')](db[_0x56a0('0x29')]['rawAttributes'],function(_0x3572d3){return{'name':_0x3572d3[_0x56a0('0x2a')],'type':_0x3572d3[_0x56a0('0x2b')][_0x56a0('0x2c')]};});_0x4f4477[_0x56a0('0x2d')]=_['map'](_0x3208f9,_0x56a0('0x2e'));_0x4f4477['query']=_[_0x56a0('0x2f')](_0x53d782[_0x56a0('0x30')]);_0x4f4477['filters']=_[_0x56a0('0x31')](_0x4f4477[_0x56a0('0x2d')],_0x4f4477[_0x56a0('0x30')]);_0x405f7c[_0x56a0('0x32')]=_['intersection'](_0x4f4477[_0x56a0('0x2d')],qs[_0x56a0('0x33')](_0x53d782['query'][_0x56a0('0x33')]));_0x405f7c[_0x56a0('0x32')]=_0x405f7c[_0x56a0('0x32')]['length']?_0x405f7c[_0x56a0('0x32')]:_0x4f4477[_0x56a0('0x2d')];if(!_0x53d782[_0x56a0('0x30')][_0x56a0('0x34')](_0x56a0('0x35'))){_0x405f7c[_0x56a0('0x1e')]=qs['limit'](_0x53d782[_0x56a0('0x30')][_0x56a0('0x1e')]);_0x405f7c['offset']=qs[_0x56a0('0x1c')](_0x53d782['query'][_0x56a0('0x1c')]);}_0x405f7c[_0x56a0('0x36')]=qs['sort'](_0x53d782[_0x56a0('0x30')][_0x56a0('0x37')]);_0x405f7c[_0x56a0('0x38')]=qs['filters'](_[_0x56a0('0x39')](_0x53d782[_0x56a0('0x30')],_0x4f4477['filters']),_0x3208f9);if(_0x53d782['query'][_0x56a0('0x3a')]){_0x405f7c['where']=_[_0x56a0('0x3b')](_0x405f7c['where'],{'$or':_['map'](_0x3208f9,function(_0x2e6f61){if(_0x2e6f61[_0x56a0('0x2b')]!=='VIRTUAL'){var _0x3bf902={};_0x3bf902[_0x2e6f61[_0x56a0('0x2e')]]={'$like':'%'+_0x53d782[_0x56a0('0x30')][_0x56a0('0x3a')]+'%'};return _0x3bf902;}})});}_0x405f7c=_['merge']({},_0x405f7c,_0x53d782['options']);var _0x2b7149={'where':_0x405f7c[_0x56a0('0x38')]};return db[_0x56a0('0x29')][_0x56a0('0x1f')](_0x2b7149)[_0x56a0('0x23')](function(_0x5cd0d1){_0x5f4bc5[_0x56a0('0x1f')]=_0x5cd0d1;if(_0x53d782[_0x56a0('0x30')][_0x56a0('0x3c')]){_0x405f7c[_0x56a0('0x3d')]=[{'all':!![]}];}return db[_0x56a0('0x29')][_0x56a0('0x3e')](_0x405f7c);})[_0x56a0('0x23')](function(_0x4194b0){_0x5f4bc5['rows']=_0x4194b0;return _0x5f4bc5;})[_0x56a0('0x23')](respondWithFilteredResult(_0x222734,_0x405f7c))[_0x56a0('0x3f')](handleError(_0x222734,null));};exports['show']=function(_0x45286d,_0x57e437){var _0x103ac7={'raw':![],'where':{'id':_0x45286d[_0x56a0('0x40')]['id']}},_0x3ce993={};_0x3ce993[_0x56a0('0x2d')]=_['keys'](db[_0x56a0('0x29')][_0x56a0('0x41')]);_0x3ce993[_0x56a0('0x30')]=_[_0x56a0('0x2f')](_0x45286d[_0x56a0('0x30')]);_0x3ce993['filters']=_[_0x56a0('0x31')](_0x3ce993[_0x56a0('0x2d')],_0x3ce993['query']);_0x103ac7[_0x56a0('0x32')]=_[_0x56a0('0x31')](_0x3ce993['model'],qs['fields'](_0x45286d[_0x56a0('0x30')][_0x56a0('0x33')]));_0x103ac7['attributes']=_0x103ac7['attributes']['length']?_0x103ac7[_0x56a0('0x32')]:_0x3ce993['model'];if(_0x45286d[_0x56a0('0x30')]['includeAll']){_0x103ac7[_0x56a0('0x3d')]=[{'all':!![]}];}_0x103ac7=_[_0x56a0('0x3b')]({},_0x103ac7,_0x45286d[_0x56a0('0x42')]);return db['AnalyticFieldReport'][_0x56a0('0x43')](_0x103ac7)[_0x56a0('0x23')](handleEntityNotFound(_0x57e437,null))[_0x56a0('0x23')](respondWithResult(_0x57e437,null))[_0x56a0('0x3f')](handleError(_0x57e437,null));};exports[_0x56a0('0x44')]=function(_0x5be807,_0x3ca749){return db[_0x56a0('0x29')][_0x56a0('0x44')](_0x5be807['body'],{})[_0x56a0('0x23')](respondWithResult(_0x3ca749,0xc9))['catch'](handleError(_0x3ca749,null));};exports[_0x56a0('0x45')]=function(_0x5c4c7e,_0x2aee47){return db[_0x56a0('0x29')][_0x56a0('0x45')](_0x5c4c7e[_0x56a0('0x46')],{'raw':![],'individualHooks':!![]})[_0x56a0('0x23')](respondWithResult(_0x2aee47,0xc9))[_0x56a0('0x3f')](handleError(_0x2aee47,null));};exports['update']=function(_0x5c02a8,_0xfdfb6d){if(_0x5c02a8[_0x56a0('0x46')]['id']){delete _0x5c02a8[_0x56a0('0x46')]['id'];}return db[_0x56a0('0x29')][_0x56a0('0x43')]({'where':{'id':_0x5c02a8['params']['id']}})['then'](handleEntityNotFound(_0xfdfb6d,null))[_0x56a0('0x23')](saveUpdates(_0x5c02a8[_0x56a0('0x46')],null))[_0x56a0('0x23')](respondWithResult(_0xfdfb6d,null))[_0x56a0('0x3f')](handleError(_0xfdfb6d,null));};exports[_0x56a0('0x24')]=function(_0x152e7d,_0x703acb){return db[_0x56a0('0x29')][_0x56a0('0x43')]({'where':{'id':_0x152e7d['params']['id']}})[_0x56a0('0x23')](handleEntityNotFound(_0x703acb,null))[_0x56a0('0x23')](removeEntity(_0x703acb,null))[_0x56a0('0x3f')](handleError(_0x703acb,null));};exports[_0x56a0('0x47')]=function(_0x3464d3,_0x370ddc){return db[_0x56a0('0x29')]['destroy']({'where':{'id':_0x3464d3[_0x56a0('0x30')][_0x56a0('0x48')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x370ddc,0xcc))['catch'](handleError(_0x370ddc,null));};exports['addFields']=function(_0x27c2e0,_0x49c282,_0x1a7f21){return db[_0x56a0('0x49')][_0x56a0('0x4a')]({'where':{'id':_0x27c2e0[_0x56a0('0x40')]['id']}})[_0x56a0('0x23')](handleEntityNotFound(_0x49c282,null))[_0x56a0('0x23')](function(_0x486e36){if(_0x486e36){return db[_0x56a0('0x4b')][_0x56a0('0x4c')](function(_0x51b999){return db[_0x56a0('0x29')][_0x56a0('0x24')]({'where':{'CustomReportId':_0x27c2e0[_0x56a0('0x40')]['id']},'transaction':_0x51b999})[_0x56a0('0x23')](function(_0x380437){var _0x450164=_[_0x56a0('0x28')](_0x27c2e0[_0x56a0('0x46')],function(_0x2c522c){delete _0x2c522c['id'];_0x2c522c['CustomReportId']=_0x27c2e0[_0x56a0('0x40')]['id'];return _0x2c522c;});return db[_0x56a0('0x29')]['bulkCreate'](_0x450164,{'transaction':_0x51b999});});})['then'](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x27c2e0[_0x56a0('0x40')]['id']}});});}})['then'](respondWithResult(_0x49c282,null))['catch'](handleError(_0x49c282,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 847b8ea..752b3dd 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 _0x6c02=['exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','api','moment','request-promise','path','../../config/environment','./analyticFieldReport.attributes'];(function(_0x3bb193,_0xb9fe51){var _0x2be1b9=function(_0x1be0c1){while(--_0x1be0c1){_0x3bb193['push'](_0x3bb193['shift']());}};_0x2be1b9(++_0xb9fe51);}(_0x6c02,0xac));var _0x26c0=function(_0xaa7b9b,_0x30497b){_0xaa7b9b=_0xaa7b9b-0x0;var _0x164b66=_0x6c02[_0xaa7b9b];return _0x164b66;};'use strict';var _=require(_0x26c0('0x0'));var util=require(_0x26c0('0x1'));var logger=require('../../config/logger')(_0x26c0('0x2'));var moment=require(_0x26c0('0x3'));var BPromise=require('bluebird');var rp=require(_0x26c0('0x4'));var fs=require('fs');var path=require(_0x26c0('0x5'));var rimraf=require('rimraf');var config=require(_0x26c0('0x6'));var attributes=require(_0x26c0('0x7'));module[_0x26c0('0x8')]=function(_0x5e6215,_0xb2ab64){return _0x5e6215[_0x26c0('0x9')](_0x26c0('0xa'),attributes,{'tableName':_0x26c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e3f=['lodash','util','api','rimraf','../../config/environment','./analyticFieldReport.attributes','AnalyticFieldReport','analytics_report_fields'];(function(_0x4311df,_0x48f408){var _0x541f11=function(_0x44add3){while(--_0x44add3){_0x4311df['push'](_0x4311df['shift']());}};_0x541f11(++_0x48f408);}(_0x6e3f,0x1c8));var _0xf6e3=function(_0x5828ee,_0x32b7b7){_0x5828ee=_0x5828ee-0x0;var _0x44d57c=_0x6e3f[_0x5828ee];return _0x44d57c;};'use strict';var _=require(_0xf6e3('0x0'));var util=require(_0xf6e3('0x1'));var logger=require('../../config/logger')(_0xf6e3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf6e3('0x3'));var config=require(_0xf6e3('0x4'));var attributes=require(_0xf6e3('0x5'));module['exports']=function(_0x224be7,_0x4944d7){return _0x224be7['define'](_0xf6e3('0x6'),attributes,{'tableName':_0xf6e3('0x7'),'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 e22489b..154976c 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 _0x2218=['request\x20sent','stringify','error','code','message','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','then','info','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s'];(function(_0x1216f6,_0x1294cb){var _0x9ca0e1=function(_0x3c378e){while(--_0x3c378e){_0x1216f6['push'](_0x1216f6['shift']());}};_0x9ca0e1(++_0x1294cb);}(_0x2218,0x135));var _0x8221=function(_0x19f9e6,_0x4f59a6){_0x19f9e6=_0x19f9e6-0x0;var _0x45c862=_0x2218[_0x19f9e6];return _0x45c862;};'use strict';var _=require(_0x8221('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8221('0x1'));var rs=require(_0x8221('0x2'));var fs=require('fs');var Redis=require(_0x8221('0x3'));var db=require(_0x8221('0x4'))['db'];var utils=require(_0x8221('0x5'));var logger=require('../../config/logger')(_0x8221('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d65c3,_0x53a1d6,_0x16fa64){return new BPromise(function(_0x785334,_0x5d87d6){return client['request'](_0x1d65c3,_0x16fa64)[_0x8221('0x7')](function(_0xe19449){logger[_0x8221('0x8')](_0x8221('0x9'),_0x53a1d6,'request\x20sent');logger['debug'](_0x8221('0xa'),_0x53a1d6,_0x8221('0xb'),JSON[_0x8221('0xc')](_0xe19449));if(_0xe19449[_0x8221('0xd')]){if(_0xe19449[_0x8221('0xd')][_0x8221('0xe')]===0x1f4){logger['error'](_0x8221('0x9'),_0x53a1d6,_0xe19449['error'][_0x8221('0xf')]);return _0x5d87d6(_0xe19449['error']['message']);}logger[_0x8221('0xd')](_0x8221('0x9'),_0x53a1d6,_0xe19449[_0x8221('0xd')][_0x8221('0xf')]);return _0x785334(_0xe19449[_0x8221('0xd')][_0x8221('0xf')]);}else{logger['info'](_0x8221('0x9'),_0x53a1d6,'request\x20sent');_0x785334(_0xe19449['result'][_0x8221('0xf')]);}})['catch'](function(_0x309e92){logger[_0x8221('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x53a1d6,_0x309e92);_0x5d87d6(_0x309e92);});});} \ No newline at end of file +var _0xde2d=['lodash','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch'];(function(_0x55f2e3,_0x48f995){var _0x224637=function(_0x503fa0){while(--_0x503fa0){_0x55f2e3['push'](_0x55f2e3['shift']());}};_0x224637(++_0x48f995);}(_0xde2d,0xf0));var _0xdde2=function(_0x4ba102,_0x3dc213){_0x4ba102=_0x4ba102-0x0;var _0x1f35e7=_0xde2d[_0x4ba102];return _0x1f35e7;};'use strict';var _=require(_0xdde2('0x0'));var util=require(_0xdde2('0x1'));var moment=require('moment');var BPromise=require(_0xdde2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdde2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdde2('0x4'))(_0xdde2('0x5'));var config=require(_0xdde2('0x6'));var jayson=require(_0xdde2('0x7'));var client=jayson['client'][_0xdde2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44158b,_0x354575,_0xad0e37){return new BPromise(function(_0x1e1a7d,_0x324ec8){return client[_0xdde2('0x9')](_0x44158b,_0xad0e37)[_0xdde2('0xa')](function(_0x349f6c){logger[_0xdde2('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x354575,'request\x20sent');logger['debug'](_0xdde2('0xc'),_0x354575,_0xdde2('0xd'),JSON['stringify'](_0x349f6c));if(_0x349f6c[_0xdde2('0xe')]){if(_0x349f6c[_0xdde2('0xe')][_0xdde2('0xf')]===0x1f4){logger[_0xdde2('0xe')](_0xdde2('0x10'),_0x354575,_0x349f6c[_0xdde2('0xe')]['message']);return _0x324ec8(_0x349f6c[_0xdde2('0xe')][_0xdde2('0x11')]);}logger[_0xdde2('0xe')](_0xdde2('0x10'),_0x354575,_0x349f6c[_0xdde2('0xe')][_0xdde2('0x11')]);return _0x1e1a7d(_0x349f6c[_0xdde2('0xe')]['message']);}else{logger[_0xdde2('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x354575,_0xdde2('0xd'));_0x1e1a7d(_0x349f6c[_0xdde2('0x12')][_0xdde2('0x11')]);}})[_0xdde2('0x13')](function(_0x17384d){logger[_0xdde2('0xe')](_0xdde2('0x10'),_0x354575,_0x17384d);_0x324ec8(_0x17384d);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 02e36b2..d987c7b 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(_0x18494a,_0xffb015){var _0x4eaf8b=function(_0x31f90b){while(--_0x31f90b){_0x18494a['push'](_0x18494a['shift']());}};_0x4eaf8b(++_0xffb015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file +var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x5653dd,_0x35bc61){var _0x5c80c2=function(_0x7f652e){while(--_0x7f652e){_0x5653dd['push'](_0x5653dd['shift']());}};_0x5c80c2(++_0x35bc61);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 67050b7..76d908b 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 _0x7df3=['sequelize','exports','name','TEXT'];(function(_0xfd49b6,_0x595107){var _0x2a8440=function(_0x47b899){while(--_0x47b899){_0xfd49b6['push'](_0xfd49b6['shift']());}};_0x2a8440(++_0x595107);}(_0x7df3,0x1cc));var _0x37df=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x7df3[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0x37df('0x0'));module[_0x37df('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x37df('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x37df('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7229=['STRING','name','sequelize','exports'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0x7229,0x76));var _0x9722=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x7229[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require(_0x9722('0x0'));module[_0x9722('0x1')]={'name':{'type':Sequelize[_0x9722('0x2')],'allowNull':![],'unique':_0x9722('0x3')},'table':{'type':Sequelize[_0x9722('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 0ea1ca6..d445224 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 _0xa41a=['attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Metrics','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','save','update','destroy','then','error','stack','name','send','map','AnalyticMetric','type','key','model','query','keys','intersection','fields'];(function(_0x2db0ef,_0x53c76b){var _0x1a32ac=function(_0x374575){while(--_0x374575){_0x2db0ef['push'](_0x2db0ef['shift']());}};_0x1a32ac(++_0x53c76b);}(_0xa41a,0x6b));var _0xaa41=function(_0x56e317,_0x439b49){_0x56e317=_0x56e317-0x0;var _0x2fc321=_0xa41a[_0x56e317];return _0x2fc321;};'use strict';var emlformat=require(_0xaa41('0x0'));var rimraf=require(_0xaa41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa41('0x2'));var rp=require(_0xaa41('0x3'));var moment=require(_0xaa41('0x4'));var BPromise=require(_0xaa41('0x5'));var Mustache=require(_0xaa41('0x6'));var util=require(_0xaa41('0x7'));var path=require(_0xaa41('0x8'));var sox=require(_0xaa41('0x9'));var csv=require('to-csv');var ejs=require(_0xaa41('0xa'));var fs=require('fs');var fs_extra=require(_0xaa41('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xe'));var querystring=require(_0xaa41('0xf'));var Papa=require(_0xaa41('0x10'));var Redis=require(_0xaa41('0x11'));var authService=require(_0xaa41('0x12'));var qs=require(_0xaa41('0x13'));var as=require(_0xaa41('0x14'));var hardwareService=require(_0xaa41('0x15'));var logger=require(_0xaa41('0x16'))('api');var utils=require(_0xaa41('0x17'));var config=require(_0xaa41('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d0a54,_0x518b5b){_0x518b5b=_0x518b5b||0xcc;return function(_0x19bd69){if(_0x19bd69){return _0x1d0a54[_0xaa41('0x19')](_0x518b5b);}return _0x1d0a54[_0xaa41('0x1a')](_0x518b5b)[_0xaa41('0x1b')]();};}function respondWithResult(_0x6f9ade,_0x4eaf81){_0x4eaf81=_0x4eaf81||0xc8;return function(_0x1e9d7f){if(_0x1e9d7f){return _0x6f9ade[_0xaa41('0x1a')](_0x4eaf81)[_0xaa41('0x1c')](_0x1e9d7f);}};}function respondWithFilteredResult(_0x1ef7d9,_0x2a6988){return function(_0x2005ae){if(_0x2005ae){var _0x1e1e02=typeof _0x2a6988['offset']===_0xaa41('0x1d')&&typeof _0x2a6988[_0xaa41('0x1e')]===_0xaa41('0x1d');var _0x391b01=_0x2005ae[_0xaa41('0x1f')];var _0xd20ddf=_0x1e1e02?0x0:_0x2a6988[_0xaa41('0x20')];var _0x46e6d3=_0x1e1e02?_0x2005ae[_0xaa41('0x1f')]:_0x2a6988['offset']+_0x2a6988['limit'];var _0x1f502a;if(_0x46e6d3>=_0x391b01){_0x46e6d3=_0x391b01;_0x1f502a=0xc8;}else{_0x1f502a=0xce;}_0x1ef7d9[_0xaa41('0x1a')](_0x1f502a);return _0x1ef7d9[_0xaa41('0x21')]('Content-Range',_0xd20ddf+'-'+_0x46e6d3+'/'+_0x391b01)[_0xaa41('0x1c')](_0x2005ae);}return null;};}function patchUpdates(_0x1f692b){return function(_0x4e768e){try{jsonpatch['apply'](_0x4e768e,_0x1f692b,!![]);}catch(_0x1b1910){return BPromise['reject'](_0x1b1910);}return _0x4e768e[_0xaa41('0x22')]();};}function saveUpdates(_0x209c83,_0x3e2175){return function(_0x1f27f3){if(_0x1f27f3){return _0x1f27f3[_0xaa41('0x23')](_0x209c83)['then'](function(_0x43c430){return _0x43c430;});}return null;};}function removeEntity(_0x43a85c,_0x448a21){return function(_0x21f596){if(_0x21f596){return _0x21f596[_0xaa41('0x24')]()[_0xaa41('0x25')](function(){var _0x5c3074=_0x21f596['get']({'plain':!![]});var _0x16aec5='Metrics';return db['UserProfileResource'][_0xaa41('0x24')]({'where':{'type':_0x16aec5,'resourceId':_0x5c3074['id']}})['then'](function(){return _0x21f596;});})['then'](function(){_0x43a85c[_0xaa41('0x1a')](0xcc)[_0xaa41('0x1b')]();});}};}function handleEntityNotFound(_0x392214,_0x632fd2){return function(_0x3f5272){if(!_0x3f5272){_0x392214[_0xaa41('0x19')](0x194);}return _0x3f5272;};}function handleError(_0x57ef96,_0x30a174){_0x30a174=_0x30a174||0x1f4;return function(_0x1f0275){logger[_0xaa41('0x26')](_0x1f0275[_0xaa41('0x27')]);if(_0x1f0275[_0xaa41('0x28')]){delete _0x1f0275[_0xaa41('0x28')];}_0x57ef96[_0xaa41('0x1a')](_0x30a174)[_0xaa41('0x29')](_0x1f0275);};}exports['index']=function(_0x377add,_0x48b48b){var _0x5dad80={},_0x714537={},_0x1176bd={'count':0x0,'rows':[]};var _0x534a85=_[_0xaa41('0x2a')](db[_0xaa41('0x2b')]['rawAttributes'],function(_0x5022fb){return{'name':_0x5022fb['fieldName'],'type':_0x5022fb[_0xaa41('0x2c')][_0xaa41('0x2d')]};});_0x714537[_0xaa41('0x2e')]=_[_0xaa41('0x2a')](_0x534a85,'name');_0x714537[_0xaa41('0x2f')]=_[_0xaa41('0x30')](_0x377add[_0xaa41('0x2f')]);_0x714537['filters']=_[_0xaa41('0x31')](_0x714537[_0xaa41('0x2e')],_0x714537[_0xaa41('0x2f')]);_0x5dad80['attributes']=_[_0xaa41('0x31')](_0x714537[_0xaa41('0x2e')],qs['fields'](_0x377add[_0xaa41('0x2f')][_0xaa41('0x32')]));_0x5dad80[_0xaa41('0x33')]=_0x5dad80['attributes'][_0xaa41('0x34')]?_0x5dad80['attributes']:_0x714537[_0xaa41('0x2e')];if(!_0x377add[_0xaa41('0x2f')][_0xaa41('0x35')]('nolimit')){_0x5dad80['limit']=qs['limit'](_0x377add[_0xaa41('0x2f')][_0xaa41('0x1e')]);_0x5dad80[_0xaa41('0x20')]=qs[_0xaa41('0x20')](_0x377add['query']['offset']);}_0x5dad80[_0xaa41('0x36')]=qs[_0xaa41('0x37')](_0x377add[_0xaa41('0x2f')][_0xaa41('0x37')]);_0x5dad80[_0xaa41('0x38')]=qs[_0xaa41('0x39')](_[_0xaa41('0x3a')](_0x377add['query'],_0x714537[_0xaa41('0x39')]),_0x534a85);if(_0x377add[_0xaa41('0x2f')][_0xaa41('0x3b')]){_0x5dad80[_0xaa41('0x38')]=_['merge'](_0x5dad80['where'],{'$or':_[_0xaa41('0x2a')](_0x534a85,function(_0x275fa3){if(_0x275fa3['type']!==_0xaa41('0x3c')){var _0x563687={};_0x563687[_0x275fa3[_0xaa41('0x28')]]={'$like':'%'+_0x377add[_0xaa41('0x2f')][_0xaa41('0x3b')]+'%'};return _0x563687;}})});}_0x5dad80=_[_0xaa41('0x3d')]({},_0x5dad80,_0x377add[_0xaa41('0x3e')]);var _0x12ba1a={'where':_0x5dad80[_0xaa41('0x38')]};return db[_0xaa41('0x2b')]['count'](_0x12ba1a)[_0xaa41('0x25')](function(_0x2abf39){_0x1176bd[_0xaa41('0x1f')]=_0x2abf39;if(_0x377add[_0xaa41('0x2f')][_0xaa41('0x3f')]){_0x5dad80[_0xaa41('0x40')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x5dad80);})[_0xaa41('0x25')](function(_0x4f9086){_0x1176bd[_0xaa41('0x41')]=_0x4f9086;return _0x1176bd;})[_0xaa41('0x25')](respondWithFilteredResult(_0x48b48b,_0x5dad80))[_0xaa41('0x42')](handleError(_0x48b48b,null));};exports[_0xaa41('0x43')]=function(_0x2aac10,_0x10bf09){var _0x2db8d6={'raw':!![],'where':{'id':_0x2aac10[_0xaa41('0x44')]['id']}},_0x5ee74c={};_0x5ee74c['model']=_['keys'](db[_0xaa41('0x2b')]['rawAttributes']);_0x5ee74c['query']=_['keys'](_0x2aac10[_0xaa41('0x2f')]);_0x5ee74c['filters']=_[_0xaa41('0x31')](_0x5ee74c[_0xaa41('0x2e')],_0x5ee74c['query']);_0x2db8d6['attributes']=_[_0xaa41('0x31')](_0x5ee74c[_0xaa41('0x2e')],qs[_0xaa41('0x32')](_0x2aac10[_0xaa41('0x2f')][_0xaa41('0x32')]));_0x2db8d6[_0xaa41('0x33')]=_0x2db8d6[_0xaa41('0x33')][_0xaa41('0x34')]?_0x2db8d6[_0xaa41('0x33')]:_0x5ee74c['model'];if(_0x2aac10[_0xaa41('0x2f')][_0xaa41('0x3f')]){_0x2db8d6[_0xaa41('0x40')]=[{'all':!![]}];}_0x2db8d6=_[_0xaa41('0x3d')]({},_0x2db8d6,_0x2aac10[_0xaa41('0x3e')]);return db[_0xaa41('0x2b')]['find'](_0x2db8d6)[_0xaa41('0x25')](handleEntityNotFound(_0x10bf09,null))[_0xaa41('0x25')](respondWithResult(_0x10bf09,null))[_0xaa41('0x42')](handleError(_0x10bf09,null));};exports[_0xaa41('0x45')]=function(_0x57d1f6,_0x23bc61){return db['AnalyticMetric']['create'](_0x57d1f6[_0xaa41('0x46')],{})[_0xaa41('0x25')](function(_0x3e16ef){var _0x4ca114=_0x57d1f6[_0xaa41('0x47')][_0xaa41('0x48')]({'plain':!![]});if(!_0x4ca114)throw new Error(_0xaa41('0x49'));if(_0x4ca114['role']===_0xaa41('0x47')){var _0x3c4f24=_0x3e16ef[_0xaa41('0x48')]({'plain':!![]});var _0x1378f9=_0xaa41('0x4a');return db[_0xaa41('0x4b')][_0xaa41('0x4c')]({'where':{'name':_0x1378f9,'userProfileId':_0x4ca114[_0xaa41('0x4d')]},'raw':!![]})['then'](function(_0x9f0a81){if(_0x9f0a81&&_0x9f0a81['autoAssociation']===0x0){return db['UserProfileResource'][_0xaa41('0x45')]({'name':_0x3c4f24[_0xaa41('0x28')],'resourceId':_0x3c4f24['id'],'type':_0x9f0a81[_0xaa41('0x28')],'sectionId':_0x9f0a81['id']},{})[_0xaa41('0x25')](function(){return _0x3e16ef;});}else{return _0x3e16ef;}})[_0xaa41('0x42')](function(_0x288db3){logger[_0xaa41('0x26')](_0xaa41('0x4e'),_0x288db3);throw _0x288db3;});}return _0x3e16ef;})['then'](respondWithResult(_0x23bc61,0xc9))[_0xaa41('0x42')](handleError(_0x23bc61,null));};exports[_0xaa41('0x23')]=function(_0x1d518f,_0x4f9e92){if(_0x1d518f[_0xaa41('0x46')]['id']){delete _0x1d518f[_0xaa41('0x46')]['id'];}return db['AnalyticMetric'][_0xaa41('0x4c')]({'where':{'id':_0x1d518f[_0xaa41('0x44')]['id']}})[_0xaa41('0x25')](handleEntityNotFound(_0x4f9e92,null))['then'](saveUpdates(_0x1d518f[_0xaa41('0x46')],null))[_0xaa41('0x25')](respondWithResult(_0x4f9e92,null))['catch'](handleError(_0x4f9e92,null));};exports['destroy']=function(_0x3745ed,_0x3cd14f){return db[_0xaa41('0x2b')]['find']({'where':{'id':_0x3745ed[_0xaa41('0x44')]['id']}})[_0xaa41('0x25')](handleEntityNotFound(_0x3cd14f,null))[_0xaa41('0x25')](removeEntity(_0x3cd14f,null))[_0xaa41('0x42')](handleError(_0x3cd14f,null));}; \ No newline at end of file +var _0x9c5a=['update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save'];(function(_0x3e4285,_0x83a4f0){var _0xce09e7=function(_0x2f13ee){while(--_0x2f13ee){_0x3e4285['push'](_0x3e4285['shift']());}};_0xce09e7(++_0x83a4f0);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x3a1a37,_0x502c8c){_0x3a1a37=_0x3a1a37-0x0;var _0x29e31e=_0x9c5a[_0x3a1a37];return _0x29e31e;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require('mustache');var util=require(_0xa9c5('0x6'));var path=require(_0xa9c5('0x7'));var sox=require('sox');var csv=require(_0xa9c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0x9'));var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=typeof _0x40b001['offset']===_0xa9c5('0x1b')&&typeof _0x40b001[_0xa9c5('0x1c')]===_0xa9c5('0x1b');var _0x55cce5=_0x19a43e[_0xa9c5('0x1d')];var _0x1142d9=_0xcf13f2?0x0:_0x40b001[_0xa9c5('0x1e')];var _0x3b8cf7=_0xcf13f2?_0x19a43e[_0xa9c5('0x1d')]:_0x40b001[_0xa9c5('0x1e')]+_0x40b001[_0xa9c5('0x1c')];var _0x1e5ce6;if(_0x3b8cf7>=_0x55cce5){_0x3b8cf7=_0x55cce5;_0x1e5ce6=0xc8;}else{_0x1e5ce6=0xce;}_0x251099[_0xa9c5('0x19')](_0x1e5ce6);return _0x251099[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x1142d9+'-'+_0x3b8cf7+'/'+_0x55cce5)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x54f8b9){return function(_0x1115ad){try{jsonpatch[_0xa9c5('0x21')](_0x1115ad,_0x54f8b9,!![]);}catch(_0x541c77){return BPromise['reject'](_0x541c77);}return _0x1115ad[_0xa9c5('0x22')]();};}function saveUpdates(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')](_0x366f5c)[_0xa9c5('0x24')](function(_0x48e2cb){return _0x48e2cb;});}return null;};}function removeEntity(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(_0x11d395){return _0x11d395['destroy']()[_0xa9c5('0x24')](function(){var _0x424b4c=_0x11d395[_0xa9c5('0x25')]({'plain':!![]});var _0x32fc7d=_0xa9c5('0x26');return db[_0xa9c5('0x27')][_0xa9c5('0x28')]({'where':{'type':_0x32fc7d,'resourceId':_0x424b4c['id']}})['then'](function(){return _0x11d395;});})['then'](function(){_0x4fa280[_0xa9c5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1762ac,_0x830bad){return function(_0x4caefa){if(!_0x4caefa){_0x1762ac[_0xa9c5('0x17')](0x194);}return _0x4caefa;};}function handleError(_0x320dc0,_0x5f468b){_0x5f468b=_0x5f468b||0x1f4;return function(_0x413edf){logger[_0xa9c5('0x29')](_0x413edf[_0xa9c5('0x2a')]);if(_0x413edf[_0xa9c5('0x2b')]){delete _0x413edf[_0xa9c5('0x2b')];}_0x320dc0['status'](_0x5f468b)[_0xa9c5('0x2c')](_0x413edf);};}exports['index']=function(_0x3c3da7,_0x1ef388){var _0x2eeed1={},_0x541475={},_0xc6d0c1={'count':0x0,'rows':[]};var _0xbe29c5=_['map'](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')],function(_0x431e07){return{'name':_0x431e07[_0xa9c5('0x2f')],'type':_0x431e07[_0xa9c5('0x30')][_0xa9c5('0x31')]};});_0x541475[_0xa9c5('0x32')]=_['map'](_0xbe29c5,_0xa9c5('0x2b'));_0x541475[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0x3c3da7[_0xa9c5('0x33')]);_0x541475[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0x541475[_0xa9c5('0x32')],_0x541475[_0xa9c5('0x33')]);_0x2eeed1['attributes']=_['intersection'](_0x541475[_0xa9c5('0x32')],qs[_0xa9c5('0x37')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x2eeed1[_0xa9c5('0x38')]=_0x2eeed1[_0xa9c5('0x38')]['length']?_0x2eeed1['attributes']:_0x541475['model'];if(!_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x39')]('nolimit')){_0x2eeed1[_0xa9c5('0x1c')]=qs['limit'](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x1c')]);_0x2eeed1[_0xa9c5('0x1e')]=qs[_0xa9c5('0x1e')](_0x3c3da7['query'][_0xa9c5('0x1e')]);}_0x2eeed1[_0xa9c5('0x3a')]=qs[_0xa9c5('0x3b')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3b')]);_0x2eeed1[_0xa9c5('0x3c')]=qs[_0xa9c5('0x35')](_[_0xa9c5('0x3d')](_0x3c3da7['query'],_0x541475[_0xa9c5('0x35')]),_0xbe29c5);if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]){_0x2eeed1[_0xa9c5('0x3c')]=_[_0xa9c5('0x3f')](_0x2eeed1[_0xa9c5('0x3c')],{'$or':_['map'](_0xbe29c5,function(_0x307736){if(_0x307736['type']!==_0xa9c5('0x40')){var _0x5c89e7={};_0x5c89e7[_0x307736[_0xa9c5('0x2b')]]={'$like':'%'+_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]+'%'};return _0x5c89e7;}})});}_0x2eeed1=_['merge']({},_0x2eeed1,_0x3c3da7[_0xa9c5('0x41')]);var _0x1ddd72={'where':_0x2eeed1[_0xa9c5('0x3c')]};return db[_0xa9c5('0x2d')]['count'](_0x1ddd72)[_0xa9c5('0x24')](function(_0x97803f){_0xc6d0c1[_0xa9c5('0x1d')]=_0x97803f;if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x2eeed1['include']=[{'all':!![]}];}return db[_0xa9c5('0x2d')]['findAll'](_0x2eeed1);})[_0xa9c5('0x24')](function(_0x397614){_0xc6d0c1[_0xa9c5('0x43')]=_0x397614;return _0xc6d0c1;})[_0xa9c5('0x24')](respondWithFilteredResult(_0x1ef388,_0x2eeed1))[_0xa9c5('0x44')](handleError(_0x1ef388,null));};exports[_0xa9c5('0x45')]=function(_0xf35cb3,_0x3e8633){var _0x1f895a={'raw':!![],'where':{'id':_0xf35cb3['params']['id']}},_0xc28b1a={};_0xc28b1a[_0xa9c5('0x32')]=_[_0xa9c5('0x34')](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')]);_0xc28b1a[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0xf35cb3['query']);_0xc28b1a[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0xc28b1a['model'],_0xc28b1a['query']);_0x1f895a['attributes']=_['intersection'](_0xc28b1a['model'],qs[_0xa9c5('0x37')](_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x1f895a[_0xa9c5('0x38')]=_0x1f895a[_0xa9c5('0x38')][_0xa9c5('0x46')]?_0x1f895a[_0xa9c5('0x38')]:_0xc28b1a[_0xa9c5('0x32')];if(_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x1f895a[_0xa9c5('0x47')]=[{'all':!![]}];}_0x1f895a=_[_0xa9c5('0x3f')]({},_0x1f895a,_0xf35cb3[_0xa9c5('0x41')]);return db['AnalyticMetric'][_0xa9c5('0x48')](_0x1f895a)['then'](handleEntityNotFound(_0x3e8633,null))[_0xa9c5('0x24')](respondWithResult(_0x3e8633,null))[_0xa9c5('0x44')](handleError(_0x3e8633,null));};exports['create']=function(_0x5cbd33,_0xf00970){return db[_0xa9c5('0x2d')][_0xa9c5('0x49')](_0x5cbd33['body'],{})['then'](function(_0x2333c4){var _0xd03cec=_0x5cbd33['user'][_0xa9c5('0x25')]({'plain':!![]});if(!_0xd03cec)throw new Error(_0xa9c5('0x4a'));if(_0xd03cec[_0xa9c5('0x4b')]===_0xa9c5('0x4c')){var _0x34020f=_0x2333c4[_0xa9c5('0x25')]({'plain':!![]});var _0x4b6fc9='Metrics';return db['UserProfileSection'][_0xa9c5('0x48')]({'where':{'name':_0x4b6fc9,'userProfileId':_0xd03cec[_0xa9c5('0x4d')]},'raw':!![]})[_0xa9c5('0x24')](function(_0xef4d2){if(_0xef4d2&&_0xef4d2[_0xa9c5('0x4e')]===0x0){return db[_0xa9c5('0x27')]['create']({'name':_0x34020f[_0xa9c5('0x2b')],'resourceId':_0x34020f['id'],'type':_0xef4d2[_0xa9c5('0x2b')],'sectionId':_0xef4d2['id']},{})[_0xa9c5('0x24')](function(){return _0x2333c4;});}else{return _0x2333c4;}})[_0xa9c5('0x44')](function(_0xa0b458){logger[_0xa9c5('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa0b458);throw _0xa0b458;});}return _0x2333c4;})['then'](respondWithResult(_0xf00970,0xc9))[_0xa9c5('0x44')](handleError(_0xf00970,null));};exports['update']=function(_0x1b158f,_0x5ea9b0){if(_0x1b158f[_0xa9c5('0x4f')]['id']){delete _0x1b158f[_0xa9c5('0x4f')]['id'];}return db[_0xa9c5('0x2d')]['find']({'where':{'id':_0x1b158f[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x5ea9b0,null))[_0xa9c5('0x24')](saveUpdates(_0x1b158f[_0xa9c5('0x4f')],null))['then'](respondWithResult(_0x5ea9b0,null))['catch'](handleError(_0x5ea9b0,null));};exports[_0xa9c5('0x28')]=function(_0x2b66ee,_0x3205f2){return db['AnalyticMetric'][_0xa9c5('0x48')]({'where':{'id':_0x2b66ee[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x3205f2,null))[_0xa9c5('0x24')](removeEntity(_0x3205f2,null))[_0xa9c5('0x44')](handleError(_0x3205f2,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index c13394f..694c89b 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 _0xea31=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticMetric.attributes','exports','define','analytics_metrics','lodash'];(function(_0x3c565e,_0x2b5578){var _0x40641b=function(_0x2d6b5b){while(--_0x2d6b5b){_0x3c565e['push'](_0x3c565e['shift']());}};_0x40641b(++_0x2b5578);}(_0xea31,0x6b));var _0x1ea3=function(_0x90d010,_0x217e9d){_0x90d010=_0x90d010-0x0;var _0x55ea69=_0xea31[_0x90d010];return _0x55ea69;};'use strict';var _=require(_0x1ea3('0x0'));var util=require('util');var logger=require(_0x1ea3('0x1'))(_0x1ea3('0x2'));var moment=require(_0x1ea3('0x3'));var BPromise=require(_0x1ea3('0x4'));var rp=require(_0x1ea3('0x5'));var fs=require('fs');var path=require(_0x1ea3('0x6'));var rimraf=require(_0x1ea3('0x7'));var config=require('../../config/environment');var attributes=require(_0x1ea3('0x8'));module[_0x1ea3('0x9')]=function(_0x6810da,_0x27c695){return _0x6810da[_0x1ea3('0xa')]('AnalyticMetric',attributes,{'tableName':_0x1ea3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f3f=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics'];(function(_0x4119ff,_0x2a24c4){var _0xb9058b=function(_0x30ea74){while(--_0x30ea74){_0x4119ff['push'](_0x4119ff['shift']());}};_0xb9058b(++_0x2a24c4);}(_0x7f3f,0x1c8));var _0xf7f3=function(_0xe45118,_0x5dffbc){_0xe45118=_0xe45118-0x0;var _0x15e15d=_0x7f3f[_0xe45118];return _0x15e15d;};'use strict';var _=require(_0xf7f3('0x0'));var util=require(_0xf7f3('0x1'));var logger=require('../../config/logger')(_0xf7f3('0x2'));var moment=require(_0xf7f3('0x3'));var BPromise=require(_0xf7f3('0x4'));var rp=require(_0xf7f3('0x5'));var fs=require('fs');var path=require(_0xf7f3('0x6'));var rimraf=require('rimraf');var config=require(_0xf7f3('0x7'));var attributes=require(_0xf7f3('0x8'));module['exports']=function(_0x163eab,_0x2c1059){return _0x163eab[_0xf7f3('0x9')](_0xf7f3('0xa'),attributes,{'tableName':_0xf7f3('0xb'),'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 4585f14..bc6e5e8 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 _0x7e7c=['bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','message','info','catch','lodash','util','moment'];(function(_0x2568bb,_0x283d45){var _0x435f7c=function(_0x3ce797){while(--_0x3ce797){_0x2568bb['push'](_0x2568bb['shift']());}};_0x435f7c(++_0x283d45);}(_0x7e7c,0x179));var _0xc7e7=function(_0xa3fadc,_0xd1e16){_0xa3fadc=_0xa3fadc-0x0;var _0x23ecb8=_0x7e7c[_0xa3fadc];return _0x23ecb8;};'use strict';var _=require(_0xc7e7('0x0'));var util=require(_0xc7e7('0x1'));var moment=require(_0xc7e7('0x2'));var BPromise=require(_0xc7e7('0x3'));var rs=require(_0xc7e7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc7e7('0x5'))(_0xc7e7('0x6'));var config=require(_0xc7e7('0x7'));var jayson=require(_0xc7e7('0x8'));var client=jayson[_0xc7e7('0x9')][_0xc7e7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ac9a3,_0x393f06,_0x40a834){return new BPromise(function(_0x3aacf2,_0x789d20){return client[_0xc7e7('0xb')](_0x2ac9a3,_0x40a834)['then'](function(_0x3f487b){logger['info'](_0xc7e7('0xc'),_0x393f06,_0xc7e7('0xd'));logger['debug'](_0xc7e7('0xe'),_0x393f06,_0xc7e7('0xd'),JSON['stringify'](_0x3f487b));if(_0x3f487b[_0xc7e7('0xf')]){if(_0x3f487b[_0xc7e7('0xf')]['code']===0x1f4){logger['error'](_0xc7e7('0xc'),_0x393f06,_0x3f487b[_0xc7e7('0xf')][_0xc7e7('0x10')]);return _0x789d20(_0x3f487b['error'][_0xc7e7('0x10')]);}logger[_0xc7e7('0xf')](_0xc7e7('0xc'),_0x393f06,_0x3f487b[_0xc7e7('0xf')]['message']);return _0x3aacf2(_0x3f487b[_0xc7e7('0xf')][_0xc7e7('0x10')]);}else{logger[_0xc7e7('0x11')](_0xc7e7('0xc'),_0x393f06,_0xc7e7('0xd'));_0x3aacf2(_0x3f487b['result']['message']);}})[_0xc7e7('0x12')](function(_0xf04e8e){logger[_0xc7e7('0xf')](_0xc7e7('0xc'),_0x393f06,_0xf04e8e);_0x789d20(_0xf04e8e);});});} \ No newline at end of file +var _0x6e25=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xd90f55,_0x48ac96){var _0x2bfc02=function(_0x2e752d){while(--_0x2e752d){_0xd90f55['push'](_0xd90f55['shift']());}};_0x2bfc02(++_0x48ac96);}(_0x6e25,0xb3));var _0x56e2=function(_0x1b8d87,_0x4168fb){_0x1b8d87=_0x1b8d87-0x0;var _0x182b74=_0x6e25[_0x1b8d87];return _0x182b74;};'use strict';var _=require(_0x56e2('0x0'));var util=require(_0x56e2('0x1'));var moment=require(_0x56e2('0x2'));var BPromise=require(_0x56e2('0x3'));var rs=require(_0x56e2('0x4'));var fs=require('fs');var Redis=require(_0x56e2('0x5'));var db=require(_0x56e2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x56e2('0x7'))(_0x56e2('0x8'));var config=require(_0x56e2('0x9'));var jayson=require(_0x56e2('0xa'));var client=jayson[_0x56e2('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3bc353,_0x22c6ef,_0x216b4a){return new BPromise(function(_0x593446,_0x341f66){return client['request'](_0x3bc353,_0x216b4a)[_0x56e2('0xc')](function(_0x56c56e){logger[_0x56e2('0xd')](_0x56e2('0xe'),_0x22c6ef,_0x56e2('0xf'));logger[_0x56e2('0x10')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x22c6ef,_0x56e2('0xf'),JSON[_0x56e2('0x11')](_0x56c56e));if(_0x56c56e['error']){if(_0x56c56e[_0x56e2('0x12')][_0x56e2('0x13')]===0x1f4){logger[_0x56e2('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x22c6ef,_0x56c56e[_0x56e2('0x12')]['message']);return _0x341f66(_0x56c56e['error'][_0x56e2('0x14')]);}logger['error'](_0x56e2('0xe'),_0x22c6ef,_0x56c56e[_0x56e2('0x12')][_0x56e2('0x14')]);return _0x593446(_0x56c56e['error'][_0x56e2('0x14')]);}else{logger[_0x56e2('0xd')](_0x56e2('0xe'),_0x22c6ef,_0x56e2('0xf'));_0x593446(_0x56c56e[_0x56e2('0x15')]['message']);}})[_0x56e2('0x16')](function(_0x5968c2){logger[_0x56e2('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x22c6ef,_0x5968c2);_0x341f66(_0x5968c2);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 9b38526..c6dbeb0 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 _0x5577=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout','Router'];(function(_0x573a6f,_0xd8ac92){var _0x513238=function(_0x108305){while(--_0x108305){_0x573a6f['push'](_0x573a6f['shift']());}};_0x513238(++_0xd8ac92);}(_0x5577,0x1b4));var _0x7557=function(_0x4a05a7,_0x1d4d0e){_0x4a05a7=_0x4a05a7-0x0;var _0x206c80=_0x5577[_0x4a05a7];return _0x206c80;};'use strict';var multer=require(_0x7557('0x0'));var util=require('util');var path=require(_0x7557('0x1'));var timeout=require(_0x7557('0x2'));var express=require('express');var router=express[_0x7557('0x3')]();var fs_extra=require(_0x7557('0x4'));var auth=require(_0x7557('0x5'));var interaction=require(_0x7557('0x6'));var config=require(_0x7557('0x7'));var controller=require(_0x7557('0x8'));router['get']('/',auth[_0x7557('0x9')](),controller[_0x7557('0xa')]);router[_0x7557('0xb')](_0x7557('0xc'),auth[_0x7557('0x9')](),controller[_0x7557('0xd')]);router[_0x7557('0xe')]('/',auth[_0x7557('0x9')](),controller[_0x7557('0xf')]);router[_0x7557('0x10')](_0x7557('0xc'),auth[_0x7557('0x9')](),controller[_0x7557('0x11')]);router[_0x7557('0x12')](_0x7557('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x7557('0x13')]=router; \ No newline at end of file +var _0xfd87=['put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','/:id','show','post'];(function(_0x5a5c11,_0x358f6b){var _0x5d6ba7=function(_0x272c72){while(--_0x272c72){_0x5a5c11['push'](_0x5a5c11['shift']());}};_0x5d6ba7(++_0x358f6b);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7fd8('0x0'));var util=require(_0x7fd8('0x1'));var path=require(_0x7fd8('0x2'));var timeout=require(_0x7fd8('0x3'));var express=require(_0x7fd8('0x4'));var router=express[_0x7fd8('0x5')]();var fs_extra=require(_0x7fd8('0x6'));var auth=require(_0x7fd8('0x7'));var interaction=require(_0x7fd8('0x8'));var config=require(_0x7fd8('0x9'));var controller=require(_0x7fd8('0xa'));router['get']('/',auth[_0x7fd8('0xb')](),controller[_0x7fd8('0xc')]);router['get'](_0x7fd8('0xd'),auth[_0x7fd8('0xb')](),controller[_0x7fd8('0xe')]);router[_0x7fd8('0xf')]('/',auth[_0x7fd8('0xb')](),controller['create']);router[_0x7fd8('0x10')](_0x7fd8('0xd'),auth[_0x7fd8('0xb')](),controller['update']);router['delete']('/:id',auth[_0x7fd8('0xb')](),controller['destroy']);module[_0x7fd8('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 13cc5f9..0339fe8 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 _0x675e=['TEXT','sequelize','exports'];(function(_0x336c0b,_0x173007){var _0x243e70=function(_0x1e63c6){while(--_0x1e63c6){_0x336c0b['push'](_0x336c0b['shift']());}};_0x243e70(++_0x173007);}(_0x675e,0xb5));var _0xe675=function(_0x5e1b91,_0x236f17){_0x5e1b91=_0x5e1b91-0x0;var _0x59b52f=_0x675e[_0x5e1b91];return _0x59b52f;};'use strict';var Sequelize=require(_0xe675('0x0'));module[_0xe675('0x1')]={'tree':{'type':Sequelize[_0xe675('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x693a=['TEXT','sequelize','exports'];(function(_0xeb6ce6,_0x242f59){var _0x59af38=function(_0x50ed56){while(--_0x50ed56){_0xeb6ce6['push'](_0xeb6ce6['shift']());}};_0x59af38(++_0x242f59);}(_0x693a,0x97));var _0xa693=function(_0x38a3d6,_0x52e305){_0x38a3d6=_0x38a3d6-0x0;var _0x3768d7=_0x693a[_0x38a3d6];return _0x3768d7;};'use strict';var Sequelize=require(_0xa693('0x0'));module[_0xa693('0x1')]={'tree':{'type':Sequelize[_0xa693('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 9d8c104..fe02711 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 _0x3258=['sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','save','then','destroy','error','stack','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','fields','model','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','length','create','update','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x342993,_0x43f554){var _0x366ce=function(_0x2cbdc2){while(--_0x2cbdc2){_0x342993['push'](_0x342993['shift']());}};_0x366ce(++_0x43f554);}(_0x3258,0xc8));var _0x8325=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3258[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x8325('0x0'));var rimraf=require(_0x8325('0x1'));var zipdir=require(_0x8325('0x2'));var jsonpatch=require(_0x8325('0x3'));var rp=require(_0x8325('0x4'));var moment=require(_0x8325('0x5'));var BPromise=require(_0x8325('0x6'));var Mustache=require('mustache');var util=require(_0x8325('0x7'));var path=require(_0x8325('0x8'));var sox=require(_0x8325('0x9'));var csv=require('to-csv');var ejs=require(_0x8325('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8325('0xb'));var squel=require(_0x8325('0xc'));var crypto=require(_0x8325('0xd'));var jsforce=require(_0x8325('0xe'));var deskjs=require(_0x8325('0xf'));var toCsv=require(_0x8325('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8325('0x11'));var authService=require(_0x8325('0x12'));var qs=require(_0x8325('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8325('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x8325('0x15'));var config=require(_0x8325('0x16'));var licenseUtil=require(_0x8325('0x17'));var db=require(_0x8325('0x18'))['db'];function respondWithStatusCode(_0x35bb7d,_0x388d8e){_0x388d8e=_0x388d8e||0xcc;return function(_0x10d8ec){if(_0x10d8ec){return _0x35bb7d[_0x8325('0x19')](_0x388d8e);}return _0x35bb7d[_0x8325('0x1a')](_0x388d8e)[_0x8325('0x1b')]();};}function respondWithResult(_0x13ddfb,_0x2fa677){_0x2fa677=_0x2fa677||0xc8;return function(_0xecea69){if(_0xecea69){return _0x13ddfb[_0x8325('0x1a')](_0x2fa677)[_0x8325('0x1c')](_0xecea69);}};}function respondWithFilteredResult(_0x16445a,_0x1c2295){return function(_0x3f9c71){if(_0x3f9c71){var _0x451b01=typeof _0x1c2295['offset']==='undefined'&&typeof _0x1c2295[_0x8325('0x1d')]===_0x8325('0x1e');var _0x11c861=_0x3f9c71[_0x8325('0x1f')];var _0x3c9135=_0x451b01?0x0:_0x1c2295[_0x8325('0x20')];var _0x384678=_0x451b01?_0x3f9c71[_0x8325('0x1f')]:_0x1c2295[_0x8325('0x20')]+_0x1c2295[_0x8325('0x1d')];var _0x48700;if(_0x384678>=_0x11c861){_0x384678=_0x11c861;_0x48700=0xc8;}else{_0x48700=0xce;}_0x16445a[_0x8325('0x1a')](_0x48700);return _0x16445a[_0x8325('0x21')]('Content-Range',_0x3c9135+'-'+_0x384678+'/'+_0x11c861)[_0x8325('0x1c')](_0x3f9c71);}return null;};}function patchUpdates(_0x413330){return function(_0x4300d6){try{jsonpatch[_0x8325('0x22')](_0x4300d6,_0x413330,!![]);}catch(_0x58c804){return BPromise[_0x8325('0x23')](_0x58c804);}return _0x4300d6[_0x8325('0x24')]();};}function saveUpdates(_0x282ee2,_0x97a592){return function(_0x1bf516){if(_0x1bf516){return _0x1bf516['update'](_0x282ee2)[_0x8325('0x25')](function(_0x55df2b){return _0x55df2b;});}return null;};}function removeEntity(_0xab5d79,_0x34f7d5){return function(_0x3b56b3){if(_0x3b56b3){return _0x3b56b3[_0x8325('0x26')]()[_0x8325('0x25')](function(){_0xab5d79[_0x8325('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a1298,_0x1bcc7c){return function(_0x5be4d9){if(!_0x5be4d9){_0x4a1298['sendStatus'](0x194);}return _0x5be4d9;};}function handleError(_0x725a7c,_0x19cdd7){_0x19cdd7=_0x19cdd7||0x1f4;return function(_0x5bfd15){logger[_0x8325('0x27')](_0x5bfd15[_0x8325('0x28')]);if(_0x5bfd15[_0x8325('0x29')]){delete _0x5bfd15['name'];}_0x725a7c['status'](_0x19cdd7)['send'](_0x5bfd15);};}exports[_0x8325('0x2a')]=function(_0x281254,_0x40b5ed){var _0x2a7be4={},_0x1d40b9={},_0x3c64a9={'count':0x0,'rows':[]};var _0x8cab01=_[_0x8325('0x2b')](db[_0x8325('0x2c')][_0x8325('0x2d')],function(_0x1ff5c1){return{'name':_0x1ff5c1[_0x8325('0x2e')],'type':_0x1ff5c1[_0x8325('0x2f')][_0x8325('0x30')]};});_0x1d40b9['model']=_[_0x8325('0x2b')](_0x8cab01,_0x8325('0x29'));_0x1d40b9[_0x8325('0x31')]=_[_0x8325('0x32')](_0x281254[_0x8325('0x31')]);_0x1d40b9['filters']=_['intersection'](_0x1d40b9['model'],_0x1d40b9['query']);_0x2a7be4[_0x8325('0x33')]=_[_0x8325('0x34')](_0x1d40b9['model'],qs[_0x8325('0x35')](_0x281254['query'][_0x8325('0x35')]));_0x2a7be4[_0x8325('0x33')]=_0x2a7be4['attributes']['length']?_0x2a7be4[_0x8325('0x33')]:_0x1d40b9[_0x8325('0x36')];if(!_0x281254[_0x8325('0x31')][_0x8325('0x37')](_0x8325('0x38'))){_0x2a7be4[_0x8325('0x1d')]=qs[_0x8325('0x1d')](_0x281254['query'][_0x8325('0x1d')]);_0x2a7be4[_0x8325('0x20')]=qs[_0x8325('0x20')](_0x281254[_0x8325('0x31')][_0x8325('0x20')]);}_0x2a7be4[_0x8325('0x39')]=qs['sort'](_0x281254[_0x8325('0x31')][_0x8325('0x3a')]);_0x2a7be4[_0x8325('0x3b')]=qs[_0x8325('0x3c')](_['pick'](_0x281254[_0x8325('0x31')],_0x1d40b9['filters']),_0x8cab01);if(_0x281254[_0x8325('0x31')][_0x8325('0x3d')]){_0x2a7be4['where']=_['merge'](_0x2a7be4[_0x8325('0x3b')],{'$or':_[_0x8325('0x2b')](_0x8cab01,function(_0x564960){if(_0x564960['type']!==_0x8325('0x3e')){var _0x546826={};_0x546826[_0x564960[_0x8325('0x29')]]={'$like':'%'+_0x281254['query']['filter']+'%'};return _0x546826;}})});}_0x2a7be4=_[_0x8325('0x3f')]({},_0x2a7be4,_0x281254[_0x8325('0x40')]);var _0x2e3be2={'where':_0x2a7be4[_0x8325('0x3b')]};return db[_0x8325('0x2c')]['count'](_0x2e3be2)[_0x8325('0x25')](function(_0xb0c744){_0x3c64a9[_0x8325('0x1f')]=_0xb0c744;if(_0x281254[_0x8325('0x31')][_0x8325('0x41')]){_0x2a7be4[_0x8325('0x42')]=[{'all':!![]}];}return db[_0x8325('0x2c')][_0x8325('0x43')](_0x2a7be4);})[_0x8325('0x25')](function(_0x573df9){_0x3c64a9['rows']=_0x573df9;return _0x3c64a9;})[_0x8325('0x25')](respondWithFilteredResult(_0x40b5ed,_0x2a7be4))[_0x8325('0x44')](handleError(_0x40b5ed,null));};exports['show']=function(_0x3ecee5,_0xe84c39){var _0x294958={'raw':!![],'where':{'id':_0x3ecee5[_0x8325('0x45')]['id']}},_0x5931ff={};_0x5931ff[_0x8325('0x36')]=_[_0x8325('0x32')](db[_0x8325('0x2c')][_0x8325('0x2d')]);_0x5931ff[_0x8325('0x31')]=_[_0x8325('0x32')](_0x3ecee5['query']);_0x5931ff[_0x8325('0x3c')]=_[_0x8325('0x34')](_0x5931ff[_0x8325('0x36')],_0x5931ff['query']);_0x294958[_0x8325('0x33')]=_[_0x8325('0x34')](_0x5931ff[_0x8325('0x36')],qs[_0x8325('0x35')](_0x3ecee5[_0x8325('0x31')][_0x8325('0x35')]));_0x294958[_0x8325('0x33')]=_0x294958[_0x8325('0x33')][_0x8325('0x46')]?_0x294958[_0x8325('0x33')]:_0x5931ff[_0x8325('0x36')];if(_0x3ecee5[_0x8325('0x31')]['includeAll']){_0x294958['include']=[{'all':!![]}];}_0x294958=_[_0x8325('0x3f')]({},_0x294958,_0x3ecee5[_0x8325('0x40')]);return db[_0x8325('0x2c')]['find'](_0x294958)[_0x8325('0x25')](handleEntityNotFound(_0xe84c39,null))['then'](respondWithResult(_0xe84c39,null))[_0x8325('0x44')](handleError(_0xe84c39,null));};exports['create']=function(_0x2ac898,_0x43abaf){return db[_0x8325('0x2c')][_0x8325('0x47')](_0x2ac898['body'],{})[_0x8325('0x25')](respondWithResult(_0x43abaf,0xc9))[_0x8325('0x44')](handleError(_0x43abaf,null));};exports[_0x8325('0x48')]=function(_0x40fe24,_0x228b39){if(_0x40fe24[_0x8325('0x49')]['id']){delete _0x40fe24[_0x8325('0x49')]['id'];}return db['AnalyticTreeReport'][_0x8325('0x4a')]({'where':{'id':_0x40fe24['params']['id']}})['then'](handleEntityNotFound(_0x228b39,null))[_0x8325('0x25')](saveUpdates(_0x40fe24['body'],null))['then'](respondWithResult(_0x228b39,null))[_0x8325('0x44')](handleError(_0x228b39,null));};exports[_0x8325('0x26')]=function(_0x49b792,_0x3c7058){return db[_0x8325('0x2c')][_0x8325('0x4a')]({'where':{'id':_0x49b792[_0x8325('0x45')]['id']}})[_0x8325('0x25')](handleEntityNotFound(_0x3c7058,null))[_0x8325('0x25')](removeEntity(_0x3c7058,null))[_0x8325('0x44')](handleError(_0x3c7058,null));}; \ No newline at end of file +var _0x7c6f=['../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','catch','show','keys','intersection','include','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util'];(function(_0x164ef5,_0xba6238){var _0x2d60c5=function(_0x34deca){while(--_0x34deca){_0x164ef5['push'](_0x164ef5['shift']());}};_0x2d60c5(++_0xba6238);}(_0x7c6f,0x1a4));var _0xf7c6=function(_0x20787c,_0x1a01ad){_0x20787c=_0x20787c-0x0;var _0x1361d9=_0x7c6f[_0x20787c];return _0x1361d9;};'use strict';var emlformat=require(_0xf7c6('0x0'));var rimraf=require(_0xf7c6('0x1'));var zipdir=require(_0xf7c6('0x2'));var jsonpatch=require(_0xf7c6('0x3'));var rp=require(_0xf7c6('0x4'));var moment=require('moment');var BPromise=require(_0xf7c6('0x5'));var Mustache=require(_0xf7c6('0x6'));var util=require(_0xf7c6('0x7'));var path=require(_0xf7c6('0x8'));var sox=require(_0xf7c6('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf7c6('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf7c6('0xb'));var jsforce=require(_0xf7c6('0xc'));var deskjs=require(_0xf7c6('0xd'));var toCsv=require(_0xf7c6('0xe'));var querystring=require(_0xf7c6('0xf'));var Papa=require('papaparse');var Redis=require(_0xf7c6('0x10'));var authService=require(_0xf7c6('0x11'));var qs=require(_0xf7c6('0x12'));var as=require(_0xf7c6('0x13'));var hardwareService=require(_0xf7c6('0x14'));var logger=require(_0xf7c6('0x15'))('api');var utils=require(_0xf7c6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf7c6('0x17'));var db=require(_0xf7c6('0x18'))['db'];function respondWithStatusCode(_0x24ce89,_0x37f89d){_0x37f89d=_0x37f89d||0xcc;return function(_0x50857a){if(_0x50857a){return _0x24ce89['sendStatus'](_0x37f89d);}return _0x24ce89[_0xf7c6('0x19')](_0x37f89d)[_0xf7c6('0x1a')]();};}function respondWithResult(_0x57fa85,_0x1a475a){_0x1a475a=_0x1a475a||0xc8;return function(_0x2b8322){if(_0x2b8322){return _0x57fa85[_0xf7c6('0x19')](_0x1a475a)[_0xf7c6('0x1b')](_0x2b8322);}};}function respondWithFilteredResult(_0x2d3153,_0x116e8b){return function(_0x4ff3c6){if(_0x4ff3c6){var _0x4295c0=typeof _0x116e8b['offset']===_0xf7c6('0x1c')&&typeof _0x116e8b[_0xf7c6('0x1d')]==='undefined';var _0x7463a=_0x4ff3c6[_0xf7c6('0x1e')];var _0x59e96b=_0x4295c0?0x0:_0x116e8b[_0xf7c6('0x1f')];var _0x77e783=_0x4295c0?_0x4ff3c6['count']:_0x116e8b[_0xf7c6('0x1f')]+_0x116e8b[_0xf7c6('0x1d')];var _0x564d0f;if(_0x77e783>=_0x7463a){_0x77e783=_0x7463a;_0x564d0f=0xc8;}else{_0x564d0f=0xce;}_0x2d3153[_0xf7c6('0x19')](_0x564d0f);return _0x2d3153[_0xf7c6('0x20')](_0xf7c6('0x21'),_0x59e96b+'-'+_0x77e783+'/'+_0x7463a)['json'](_0x4ff3c6);}return null;};}function patchUpdates(_0x5969d2){return function(_0x27eefd){try{jsonpatch[_0xf7c6('0x22')](_0x27eefd,_0x5969d2,!![]);}catch(_0x37be5e){return BPromise[_0xf7c6('0x23')](_0x37be5e);}return _0x27eefd[_0xf7c6('0x24')]();};}function saveUpdates(_0x1adaaa,_0x5f0b87){return function(_0x5254a5){if(_0x5254a5){return _0x5254a5['update'](_0x1adaaa)[_0xf7c6('0x25')](function(_0x24437b){return _0x24437b;});}return null;};}function removeEntity(_0x37e2a7,_0x3cb954){return function(_0x28e875){if(_0x28e875){return _0x28e875[_0xf7c6('0x26')]()['then'](function(){_0x37e2a7[_0xf7c6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x519ffe,_0x334c7c){return function(_0x38aeff){if(!_0x38aeff){_0x519ffe[_0xf7c6('0x27')](0x194);}return _0x38aeff;};}function handleError(_0x11f494,_0x17b5eb){_0x17b5eb=_0x17b5eb||0x1f4;return function(_0x5a98bb){logger[_0xf7c6('0x28')](_0x5a98bb[_0xf7c6('0x29')]);if(_0x5a98bb[_0xf7c6('0x2a')]){delete _0x5a98bb[_0xf7c6('0x2a')];}_0x11f494[_0xf7c6('0x19')](_0x17b5eb)[_0xf7c6('0x2b')](_0x5a98bb);};}exports[_0xf7c6('0x2c')]=function(_0x18a089,_0x2b6968){var _0x40b402={},_0x43d44c={},_0x2671d3={'count':0x0,'rows':[]};var _0x502cc1=_[_0xf7c6('0x2d')](db[_0xf7c6('0x2e')][_0xf7c6('0x2f')],function(_0x546c2f){return{'name':_0x546c2f[_0xf7c6('0x30')],'type':_0x546c2f[_0xf7c6('0x31')][_0xf7c6('0x32')]};});_0x43d44c[_0xf7c6('0x33')]=_['map'](_0x502cc1,_0xf7c6('0x2a'));_0x43d44c[_0xf7c6('0x34')]=_['keys'](_0x18a089[_0xf7c6('0x34')]);_0x43d44c[_0xf7c6('0x35')]=_['intersection'](_0x43d44c[_0xf7c6('0x33')],_0x43d44c['query']);_0x40b402[_0xf7c6('0x36')]=_['intersection'](_0x43d44c[_0xf7c6('0x33')],qs['fields'](_0x18a089['query'][_0xf7c6('0x37')]));_0x40b402[_0xf7c6('0x36')]=_0x40b402['attributes'][_0xf7c6('0x38')]?_0x40b402['attributes']:_0x43d44c[_0xf7c6('0x33')];if(!_0x18a089[_0xf7c6('0x34')]['hasOwnProperty']('nolimit')){_0x40b402[_0xf7c6('0x1d')]=qs[_0xf7c6('0x1d')](_0x18a089[_0xf7c6('0x34')]['limit']);_0x40b402[_0xf7c6('0x1f')]=qs['offset'](_0x18a089['query'][_0xf7c6('0x1f')]);}_0x40b402['order']=qs[_0xf7c6('0x39')](_0x18a089[_0xf7c6('0x34')][_0xf7c6('0x39')]);_0x40b402['where']=qs[_0xf7c6('0x35')](_[_0xf7c6('0x3a')](_0x18a089[_0xf7c6('0x34')],_0x43d44c[_0xf7c6('0x35')]),_0x502cc1);if(_0x18a089[_0xf7c6('0x34')]['filter']){_0x40b402[_0xf7c6('0x3b')]=_[_0xf7c6('0x3c')](_0x40b402[_0xf7c6('0x3b')],{'$or':_['map'](_0x502cc1,function(_0x59b8bd){if(_0x59b8bd[_0xf7c6('0x31')]!==_0xf7c6('0x3d')){var _0x5ef951={};_0x5ef951[_0x59b8bd[_0xf7c6('0x2a')]]={'$like':'%'+_0x18a089[_0xf7c6('0x34')][_0xf7c6('0x3e')]+'%'};return _0x5ef951;}})});}_0x40b402=_['merge']({},_0x40b402,_0x18a089[_0xf7c6('0x3f')]);var _0x265fb6={'where':_0x40b402[_0xf7c6('0x3b')]};return db[_0xf7c6('0x2e')]['count'](_0x265fb6)[_0xf7c6('0x25')](function(_0x5c83a2){_0x2671d3[_0xf7c6('0x1e')]=_0x5c83a2;if(_0x18a089['query'][_0xf7c6('0x40')]){_0x40b402['include']=[{'all':!![]}];}return db[_0xf7c6('0x2e')]['findAll'](_0x40b402);})['then'](function(_0x128677){_0x2671d3['rows']=_0x128677;return _0x2671d3;})['then'](respondWithFilteredResult(_0x2b6968,_0x40b402))[_0xf7c6('0x41')](handleError(_0x2b6968,null));};exports[_0xf7c6('0x42')]=function(_0x4e2685,_0x384134){var _0x9706b4={'raw':!![],'where':{'id':_0x4e2685['params']['id']}},_0x33e4a4={};_0x33e4a4[_0xf7c6('0x33')]=_[_0xf7c6('0x43')](db['AnalyticTreeReport'][_0xf7c6('0x2f')]);_0x33e4a4[_0xf7c6('0x34')]=_[_0xf7c6('0x43')](_0x4e2685[_0xf7c6('0x34')]);_0x33e4a4[_0xf7c6('0x35')]=_[_0xf7c6('0x44')](_0x33e4a4['model'],_0x33e4a4[_0xf7c6('0x34')]);_0x9706b4[_0xf7c6('0x36')]=_[_0xf7c6('0x44')](_0x33e4a4[_0xf7c6('0x33')],qs[_0xf7c6('0x37')](_0x4e2685['query'][_0xf7c6('0x37')]));_0x9706b4['attributes']=_0x9706b4[_0xf7c6('0x36')]['length']?_0x9706b4[_0xf7c6('0x36')]:_0x33e4a4['model'];if(_0x4e2685[_0xf7c6('0x34')]['includeAll']){_0x9706b4[_0xf7c6('0x45')]=[{'all':!![]}];}_0x9706b4=_[_0xf7c6('0x3c')]({},_0x9706b4,_0x4e2685[_0xf7c6('0x3f')]);return db['AnalyticTreeReport']['find'](_0x9706b4)[_0xf7c6('0x25')](handleEntityNotFound(_0x384134,null))[_0xf7c6('0x25')](respondWithResult(_0x384134,null))[_0xf7c6('0x41')](handleError(_0x384134,null));};exports['create']=function(_0x1004e1,_0x114021){return db[_0xf7c6('0x2e')][_0xf7c6('0x46')](_0x1004e1[_0xf7c6('0x47')],{})[_0xf7c6('0x25')](respondWithResult(_0x114021,0xc9))[_0xf7c6('0x41')](handleError(_0x114021,null));};exports['update']=function(_0x5cdfdc,_0x68fffc){if(_0x5cdfdc[_0xf7c6('0x47')]['id']){delete _0x5cdfdc[_0xf7c6('0x47')]['id'];}return db['AnalyticTreeReport'][_0xf7c6('0x48')]({'where':{'id':_0x5cdfdc[_0xf7c6('0x49')]['id']}})[_0xf7c6('0x25')](handleEntityNotFound(_0x68fffc,null))[_0xf7c6('0x25')](saveUpdates(_0x5cdfdc['body'],null))[_0xf7c6('0x25')](respondWithResult(_0x68fffc,null))['catch'](handleError(_0x68fffc,null));};exports[_0xf7c6('0x26')]=function(_0x689911,_0x43f0dd){return db['AnalyticTreeReport']['find']({'where':{'id':_0x689911[_0xf7c6('0x49')]['id']}})[_0xf7c6('0x25')](handleEntityNotFound(_0x43f0dd,null))['then'](removeEntity(_0x43f0dd,null))[_0xf7c6('0x41')](handleError(_0x43f0dd,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index ac98085..30a7ff9 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 _0xe6d1=['request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','lodash','util','api','moment'];(function(_0x1e65cc,_0x55489e){var _0x2aa244=function(_0x507592){while(--_0x507592){_0x1e65cc['push'](_0x1e65cc['shift']());}};_0x2aa244(++_0x55489e);}(_0xe6d1,0xce));var _0x1e6d=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xe6d1[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0x1e6d('0x0'));var util=require(_0x1e6d('0x1'));var logger=require('../../config/logger')(_0x1e6d('0x2'));var moment=require(_0x1e6d('0x3'));var BPromise=require('bluebird');var rp=require(_0x1e6d('0x4'));var fs=require('fs');var path=require(_0x1e6d('0x5'));var rimraf=require(_0x1e6d('0x6'));var config=require(_0x1e6d('0x7'));var attributes=require(_0x1e6d('0x8'));module[_0x1e6d('0x9')]=function(_0x4bd7e9,_0xdb173){return _0x4bd7e9['define']('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x678c=['./analyticTreeReport.attributes','exports','define','analytics_report_trees','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x678c,0x1dd));var _0xc678=function(_0x257195,_0x1a9de1){_0x257195=_0x257195-0x0;var _0x157cce=_0x678c[_0x257195];return _0x157cce;};'use strict';var _=require(_0xc678('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc678('0x1'));var moment=require('moment');var BPromise=require(_0xc678('0x2'));var rp=require(_0xc678('0x3'));var fs=require('fs');var path=require(_0xc678('0x4'));var rimraf=require(_0xc678('0x5'));var config=require(_0xc678('0x6'));var attributes=require(_0xc678('0x7'));module[_0xc678('0x8')]=function(_0x26eb44,_0x5bfce7){return _0x26eb44[_0xc678('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0xc678('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 3f5d6ae..9e44105 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 _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(_0x4a191f,_0xb95809){var _0x2eb3bf=function(_0x304bbc){while(--_0x304bbc){_0x4a191f['push'](_0x4a191f['shift']());}};_0x2eb3bf(++_0xb95809);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4508b9,_0x2d5d7c){_0x4508b9=_0x4508b9-0x0;var _0x3b664c=_0x5f2f[_0x4508b9];return _0x3b664c;};'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 +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x58b35e,_0x17a8cd){var _0x86b2a0=function(_0x162126){while(--_0x162126){_0x58b35e['push'](_0x58b35e['shift']());}};_0x86b2a0(++_0x17a8cd);}(_0xadb5,0xad));var _0x5adb=function(_0x3faab3,_0xada0ac){_0x3faab3=_0x3faab3-0x0;var _0x1e7aae=_0xadb5[_0x3faab3];return _0x1e7aae;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 7202806..37ec11a 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 _0x7d0a=['delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x53ba51,_0x2f2321){var _0x2e776e=function(_0x16b5cf){while(--_0x16b5cf){_0x53ba51['push'](_0x53ba51['shift']());}};_0x2e776e(++_0x2f2321);}(_0x7d0a,0x178));var _0xa7d0=function(_0x3b9570,_0x4ead31){_0x3b9570=_0x3b9570-0x0;var _0x28acdd=_0x7d0a[_0x3b9570];return _0x28acdd;};'use strict';var multer=require(_0xa7d0('0x0'));var util=require(_0xa7d0('0x1'));var path=require(_0xa7d0('0x2'));var timeout=require(_0xa7d0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa7d0('0x4'));var auth=require(_0xa7d0('0x5'));var interaction=require(_0xa7d0('0x6'));var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0xa7d0('0x7')]('/',auth[_0xa7d0('0x8')](),controller[_0xa7d0('0x9')]);router[_0xa7d0('0x7')](_0xa7d0('0xa'),auth[_0xa7d0('0x8')](),controller[_0xa7d0('0xb')]);router[_0xa7d0('0xc')]('/',auth['isAuthenticated'](),controller[_0xa7d0('0xd')]);router['put'](_0xa7d0('0xa'),auth[_0xa7d0('0x8')](),controller[_0xa7d0('0xe')]);router[_0xa7d0('0xf')](_0xa7d0('0xa'),auth[_0xa7d0('0x8')](),controller['destroy']);module[_0xa7d0('0x10')]=router; \ No newline at end of file +var _0xabeb=['util','path','Router','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','index','isAuthenticated','show','post','create','put','/:id','update','destroy','exports','multer'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xabeb,0x1c1));var _0xbabe=function(_0x233d84,_0x3f63c9){_0x233d84=_0x233d84-0x0;var _0x33f28f=_0xabeb[_0x233d84];return _0x33f28f;};'use strict';var multer=require(_0xbabe('0x0'));var util=require(_0xbabe('0x1'));var path=require(_0xbabe('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbabe('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbabe('0x4'));var interaction=require(_0xbabe('0x5'));var config=require('../../config/environment');var controller=require(_0xbabe('0x6'));router[_0xbabe('0x7')]('/',auth['isAuthenticated'](),controller[_0xbabe('0x8')]);router[_0xbabe('0x7')]('/:id',auth[_0xbabe('0x9')](),controller[_0xbabe('0xa')]);router[_0xbabe('0xb')]('/',auth[_0xbabe('0x9')](),controller[_0xbabe('0xc')]);router[_0xbabe('0xd')](_0xbabe('0xe'),auth[_0xbabe('0x9')](),controller[_0xbabe('0xf')]);router['delete'](_0xbabe('0xe'),auth[_0xbabe('0x9')](),controller[_0xbabe('0x10')]);module[_0xbabe('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 30e2599..57749b6 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 _0xbd3b=['STRING','sequelize','exports'];(function(_0x20a1b0,_0x18fe84){var _0x321e14=function(_0x69fdf6){while(--_0x69fdf6){_0x20a1b0['push'](_0x20a1b0['shift']());}};_0x321e14(++_0x18fe84);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0x594dc7,_0x269225){_0x594dc7=_0x594dc7-0x0;var _0x2e287d=_0xbd3b[_0x594dc7];return _0x2e287d;};'use strict';var Sequelize=require(_0xbbd3('0x0'));module[_0xbbd3('0x1')]={'name':{'type':Sequelize[_0xbbd3('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbbd3('0x2')]}}; \ No newline at end of file +var _0xbbb8=['exports','STRING','sequelize'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xbbb8,0x7d));var _0x8bbb=function(_0x7febbd,_0x258106){_0x7febbd=_0x7febbd-0x0;var _0x4076e5=_0xbbb8[_0x7febbd];return _0x4076e5;};'use strict';var Sequelize=require(_0x8bbb('0x0'));module[_0x8bbb('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x8bbb('0x2')]},'type':{'type':Sequelize[_0x8bbb('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 51e5fec..bb946f7 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 _0x5ede=['filter','merge','type','VIRTUAL','options','include','findAll','rows','includeAll','find','catch','params','get','createdAt','updatedAt','body','omit','create','file','originalname','basename','filename','mimetype','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','Attachment','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick'];(function(_0xcd479d,_0x10b519){var _0x42641b=function(_0x29d7ef){while(--_0x29d7ef){_0xcd479d['push'](_0xcd479d['shift']());}};_0x42641b(++_0x10b519);}(_0x5ede,0xd4));var _0xe5ed=function(_0x223b88,_0x294ff0){_0x223b88=_0x223b88-0x0;var _0x5b68c5=_0x5ede[_0x223b88];return _0x5b68c5;};'use strict';var emlformat=require(_0xe5ed('0x0'));var rimraf=require(_0xe5ed('0x1'));var zipdir=require(_0xe5ed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe5ed('0x3'));var moment=require(_0xe5ed('0x4'));var BPromise=require(_0xe5ed('0x5'));var Mustache=require(_0xe5ed('0x6'));var util=require(_0xe5ed('0x7'));var path=require(_0xe5ed('0x8'));var sox=require(_0xe5ed('0x9'));var csv=require(_0xe5ed('0xa'));var ejs=require(_0xe5ed('0xb'));var fs=require('fs');var fs_extra=require(_0xe5ed('0xc'));var _=require(_0xe5ed('0xd'));var squel=require(_0xe5ed('0xe'));var crypto=require(_0xe5ed('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe5ed('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe5ed('0x11'));var qs=require(_0xe5ed('0x12'));var as=require(_0xe5ed('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe5ed('0x14'))(_0xe5ed('0x15'));var utils=require('../../config/utils');var config=require(_0xe5ed('0x16'));var licenseUtil=require(_0xe5ed('0x17'));var db=require(_0xe5ed('0x18'))['db'];function respondWithStatusCode(_0x284737,_0x3fc849){_0x3fc849=_0x3fc849||0xcc;return function(_0xaaff21){if(_0xaaff21){return _0x284737['sendStatus'](_0x3fc849);}return _0x284737[_0xe5ed('0x19')](_0x3fc849)['end']();};}function respondWithResult(_0x458a3d,_0x156cec){_0x156cec=_0x156cec||0xc8;return function(_0x5347b4){if(_0x5347b4){return _0x458a3d['status'](_0x156cec)[_0xe5ed('0x1a')](_0x5347b4);}};}function respondWithFilteredResult(_0x95a8bc,_0x1c0d44){return function(_0x3235de){if(_0x3235de){var _0x5c0a09=typeof _0x1c0d44[_0xe5ed('0x1b')]===_0xe5ed('0x1c')&&typeof _0x1c0d44[_0xe5ed('0x1d')]==='undefined';var _0x40167a=_0x3235de[_0xe5ed('0x1e')];var _0x553a6c=_0x5c0a09?0x0:_0x1c0d44[_0xe5ed('0x1b')];var _0xd1a8b2=_0x5c0a09?_0x3235de[_0xe5ed('0x1e')]:_0x1c0d44[_0xe5ed('0x1b')]+_0x1c0d44[_0xe5ed('0x1d')];var _0x1fc43a;if(_0xd1a8b2>=_0x40167a){_0xd1a8b2=_0x40167a;_0x1fc43a=0xc8;}else{_0x1fc43a=0xce;}_0x95a8bc['status'](_0x1fc43a);return _0x95a8bc['set'](_0xe5ed('0x1f'),_0x553a6c+'-'+_0xd1a8b2+'/'+_0x40167a)[_0xe5ed('0x1a')](_0x3235de);}return null;};}function patchUpdates(_0x1a24e3){return function(_0x27d255){try{jsonpatch[_0xe5ed('0x20')](_0x27d255,_0x1a24e3,!![]);}catch(_0x2582a4){return BPromise[_0xe5ed('0x21')](_0x2582a4);}return _0x27d255[_0xe5ed('0x22')]();};}function saveUpdates(_0x52a480,_0xb96e37){return function(_0x43bb37){if(_0x43bb37){return _0x43bb37[_0xe5ed('0x23')](_0x52a480)[_0xe5ed('0x24')](function(_0x4b210d){return _0x4b210d;});}return null;};}function removeEntity(_0x377ad4,_0x14ffc3){return function(_0x13d3ef){if(_0x13d3ef){return _0x13d3ef[_0xe5ed('0x25')]()[_0xe5ed('0x24')](function(){_0x377ad4[_0xe5ed('0x19')](0xcc)[_0xe5ed('0x26')]();});}};}function handleEntityNotFound(_0x30fb8b,_0x5d7852){return function(_0x327d0b){if(!_0x327d0b){_0x30fb8b[_0xe5ed('0x27')](0x194);}return _0x327d0b;};}function handleError(_0x242cbf,_0xd208a){_0xd208a=_0xd208a||0x1f4;return function(_0x2a1b72){logger[_0xe5ed('0x28')](_0x2a1b72[_0xe5ed('0x29')]);if(_0x2a1b72['name']){delete _0x2a1b72[_0xe5ed('0x2a')];}_0x242cbf[_0xe5ed('0x19')](_0xd208a)['send'](_0x2a1b72);};}exports[_0xe5ed('0x2b')]=function(_0x4a7884,_0x4ab178){var _0x277774={},_0x40c867={},_0x1ae2d1={'count':0x0,'rows':[]};var _0x4cd4b0=_['map'](db[_0xe5ed('0x2c')][_0xe5ed('0x2d')],function(_0x236d9e){return{'name':_0x236d9e[_0xe5ed('0x2e')],'type':_0x236d9e['type'][_0xe5ed('0x2f')]};});_0x40c867[_0xe5ed('0x30')]=_[_0xe5ed('0x31')](_0x4cd4b0,_0xe5ed('0x2a'));_0x40c867[_0xe5ed('0x32')]=_[_0xe5ed('0x33')](_0x4a7884[_0xe5ed('0x32')]);_0x40c867[_0xe5ed('0x34')]=_[_0xe5ed('0x35')](_0x40c867[_0xe5ed('0x30')],_0x40c867[_0xe5ed('0x32')]);_0x277774[_0xe5ed('0x36')]=_[_0xe5ed('0x35')](_0x40c867[_0xe5ed('0x30')],qs[_0xe5ed('0x37')](_0x4a7884[_0xe5ed('0x32')]['fields']));_0x277774[_0xe5ed('0x36')]=_0x277774[_0xe5ed('0x36')]['length']?_0x277774['attributes']:_0x40c867[_0xe5ed('0x30')];if(!_0x4a7884['query'][_0xe5ed('0x38')]('nolimit')){_0x277774['limit']=qs[_0xe5ed('0x1d')](_0x4a7884[_0xe5ed('0x32')][_0xe5ed('0x1d')]);_0x277774['offset']=qs[_0xe5ed('0x1b')](_0x4a7884[_0xe5ed('0x32')][_0xe5ed('0x1b')]);}_0x277774[_0xe5ed('0x39')]=qs[_0xe5ed('0x3a')](_0x4a7884[_0xe5ed('0x32')][_0xe5ed('0x3a')]);_0x277774[_0xe5ed('0x3b')]=qs[_0xe5ed('0x34')](_[_0xe5ed('0x3c')](_0x4a7884[_0xe5ed('0x32')],_0x40c867['filters']),_0x4cd4b0);if(_0x4a7884[_0xe5ed('0x32')][_0xe5ed('0x3d')]){_0x277774[_0xe5ed('0x3b')]=_[_0xe5ed('0x3e')](_0x277774[_0xe5ed('0x3b')],{'$or':_[_0xe5ed('0x31')](_0x4cd4b0,function(_0x3914c0){if(_0x3914c0[_0xe5ed('0x3f')]!==_0xe5ed('0x40')){var _0x3cedb5={};_0x3cedb5[_0x3914c0[_0xe5ed('0x2a')]]={'$like':'%'+_0x4a7884['query']['filter']+'%'};return _0x3cedb5;}})});}_0x277774=_[_0xe5ed('0x3e')]({},_0x277774,_0x4a7884[_0xe5ed('0x41')]);var _0x2a783a={'where':_0x277774[_0xe5ed('0x3b')]};return db[_0xe5ed('0x2c')]['count'](_0x2a783a)[_0xe5ed('0x24')](function(_0x4e73a6){_0x1ae2d1['count']=_0x4e73a6;if(_0x4a7884[_0xe5ed('0x32')]['includeAll']){_0x277774[_0xe5ed('0x42')]=[{'all':!![]}];}return db[_0xe5ed('0x2c')][_0xe5ed('0x43')](_0x277774);})[_0xe5ed('0x24')](function(_0x594d41){_0x1ae2d1[_0xe5ed('0x44')]=_0x594d41;return _0x1ae2d1;})[_0xe5ed('0x24')](respondWithFilteredResult(_0x4ab178,_0x277774))['catch'](handleError(_0x4ab178,null));};exports['show']=function(_0x5e39ea,_0x4be277){var _0x1fd454={'raw':!![],'where':{'id':_0x5e39ea['params']['id']}},_0x5c5ce6={};_0x5c5ce6[_0xe5ed('0x30')]=_[_0xe5ed('0x33')](db[_0xe5ed('0x2c')][_0xe5ed('0x2d')]);_0x5c5ce6[_0xe5ed('0x32')]=_[_0xe5ed('0x33')](_0x5e39ea['query']);_0x5c5ce6[_0xe5ed('0x34')]=_[_0xe5ed('0x35')](_0x5c5ce6[_0xe5ed('0x30')],_0x5c5ce6[_0xe5ed('0x32')]);_0x1fd454['attributes']=_[_0xe5ed('0x35')](_0x5c5ce6[_0xe5ed('0x30')],qs[_0xe5ed('0x37')](_0x5e39ea[_0xe5ed('0x32')][_0xe5ed('0x37')]));_0x1fd454[_0xe5ed('0x36')]=_0x1fd454['attributes']['length']?_0x1fd454['attributes']:_0x5c5ce6[_0xe5ed('0x30')];if(_0x5e39ea[_0xe5ed('0x32')][_0xe5ed('0x45')]){_0x1fd454['include']=[{'all':!![]}];}_0x1fd454=_[_0xe5ed('0x3e')]({},_0x1fd454,_0x5e39ea[_0xe5ed('0x41')]);return db[_0xe5ed('0x2c')][_0xe5ed('0x46')](_0x1fd454)[_0xe5ed('0x24')](handleEntityNotFound(_0x4be277,null))[_0xe5ed('0x24')](respondWithResult(_0x4be277,null))[_0xe5ed('0x47')](handleError(_0x4be277,null));};exports['clone']=function(_0x2b7b3c,_0x33a567){var _0x39abcb={'where':{'id':_0x2b7b3c[_0xe5ed('0x48')]['id']}},_0x18c25d={};_0x18c25d['model']=_['keys'](db[_0xe5ed('0x2c')][_0xe5ed('0x2d')]);_0x39abcb[_0xe5ed('0x36')]=_[_0xe5ed('0x35')](_0x18c25d[_0xe5ed('0x30')],qs[_0xe5ed('0x37')](_0x2b7b3c['query'][_0xe5ed('0x37')]));_0x39abcb[_0xe5ed('0x36')]=_0x39abcb[_0xe5ed('0x36')]['length']?_0x39abcb[_0xe5ed('0x36')]:_0x18c25d[_0xe5ed('0x30')];if(_0x2b7b3c['query'][_0xe5ed('0x45')]){_0x39abcb[_0xe5ed('0x42')]=[{'all':!![]}];}_0x39abcb=_[_0xe5ed('0x3e')]({},_0x39abcb,_0x2b7b3c['options']);return db[_0xe5ed('0x2c')]['find'](_0x39abcb)[_0xe5ed('0x24')](handleEntityNotFound(_0x33a567,null))[_0xe5ed('0x24')](function(_0x26c7d5){if(_0x26c7d5){var _0x1822ae=_0x26c7d5[_0xe5ed('0x49')]({'plain':!![]});_0x1822ae=qs['omit'](_0x1822ae,['id',_0xe5ed('0x4a'),_0xe5ed('0x4b')]);_0x2b7b3c[_0xe5ed('0x4c')]=_[_0xe5ed('0x4d')](_0x2b7b3c[_0xe5ed('0x4c')],['id','createdAt',_0xe5ed('0x4b')]);return db[_0xe5ed('0x2c')][_0xe5ed('0x4e')](_[_0xe5ed('0x3e')](_0x1822ae,_0x2b7b3c[_0xe5ed('0x4c')]),{'include':_0x2b7b3c[_0xe5ed('0x32')][_0xe5ed('0x45')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x33a567,0xc9))[_0xe5ed('0x47')](handleError(_0x33a567,null));};exports[_0xe5ed('0x23')]=function(_0x361628,_0x10e37a){if(_0x361628[_0xe5ed('0x4c')]['id']){delete _0x361628['body']['id'];}return db[_0xe5ed('0x2c')][_0xe5ed('0x46')]({'where':{'id':_0x361628['params']['id']}})[_0xe5ed('0x24')](handleEntityNotFound(_0x10e37a,null))[_0xe5ed('0x24')](saveUpdates(_0x361628[_0xe5ed('0x4c')],null))[_0xe5ed('0x24')](respondWithResult(_0x10e37a,null))['catch'](handleError(_0x10e37a,null));};exports[_0xe5ed('0x25')]=function(_0x38738f,_0x59448b){return db[_0xe5ed('0x2c')][_0xe5ed('0x46')]({'where':{'id':_0x38738f[_0xe5ed('0x48')]['id']}})[_0xe5ed('0x24')](handleEntityNotFound(_0x59448b,null))['then'](removeEntity(_0x59448b,null))[_0xe5ed('0x47')](handleError(_0x59448b,null));};exports[_0xe5ed('0x4e')]=function(_0x53851d,_0xf5d344,_0x1fd31f){_0x53851d[_0xe5ed('0x4c')]['name']=_0x53851d[_0xe5ed('0x4f')][_0xe5ed('0x50')];_0x53851d[_0xe5ed('0x4c')][_0xe5ed('0x51')]=_0x53851d['file'][_0xe5ed('0x52')];_0x53851d[_0xe5ed('0x4c')][_0xe5ed('0x3f')]=_0x53851d['file'][_0xe5ed('0x53')];return db[_0xe5ed('0x2c')]['create'](_0x53851d[_0xe5ed('0x4c')])[_0xe5ed('0x24')](respondWithResult(_0xf5d344,0xc9))[_0xe5ed('0x47')](handleError(_0xf5d344,null));};exports['download']=function(_0x4ff632,_0x39b86e,_0x32e5fb){return db[_0xe5ed('0x2c')][_0xe5ed('0x54')]({'where':{'id':_0x4ff632[_0xe5ed('0x48')]['id']},'raw':!![]})[_0xe5ed('0x24')](handleEntityNotFound(_0x39b86e,null))[_0xe5ed('0x24')](function(_0x5b878b){if(_0x5b878b){var _0x2abe49=_0x5b878b[_0xe5ed('0x55')]!==null;var _0x33db53=path[_0xe5ed('0x56')](config[_0xe5ed('0x57')],_0xe5ed('0x58'));if(_0x2abe49){_0x33db53=path[_0xe5ed('0x56')](_0x33db53,_0xe5ed('0x59'));}var _0x4d4fde=path['join'](_0x33db53,_0x5b878b[_0xe5ed('0x51')]);return _0x39b86e[_0xe5ed('0x5a')](_0x4d4fde);}})[_0xe5ed('0x47')](handleError(_0x39b86e,null));}; \ No newline at end of file +var _0x8712=['order','sort','pick','filter','where','merge','options','findAll','rows','catch','show','params','includeAll','find','clone','include','get','omit','createdAt','updatedAt','body','create','update','name','basename','file','filename','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','send','map','Attachment','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit'];(function(_0x3713db,_0x3d6359){var _0x39ed9e=function(_0x10e394){while(--_0x10e394){_0x3713db['push'](_0x3713db['shift']());}};_0x39ed9e(++_0x3d6359);}(_0x8712,0x133));var _0x2871=function(_0x34db59,_0x5119c0){_0x34db59=_0x34db59-0x0;var _0x2766b3=_0x8712[_0x34db59];return _0x2766b3;};'use strict';var emlformat=require(_0x2871('0x0'));var rimraf=require(_0x2871('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2871('0x2'));var rp=require('request-promise');var moment=require(_0x2871('0x3'));var BPromise=require(_0x2871('0x4'));var Mustache=require('mustache');var util=require(_0x2871('0x5'));var path=require(_0x2871('0x6'));var sox=require(_0x2871('0x7'));var csv=require(_0x2871('0x8'));var ejs=require(_0x2871('0x9'));var fs=require('fs');var fs_extra=require(_0x2871('0xa'));var _=require(_0x2871('0xb'));var squel=require(_0x2871('0xc'));var crypto=require(_0x2871('0xd'));var jsforce=require(_0x2871('0xe'));var deskjs=require(_0x2871('0xf'));var toCsv=require(_0x2871('0x8'));var querystring=require(_0x2871('0x10'));var Papa=require(_0x2871('0x11'));var Redis=require(_0x2871('0x12'));var authService=require(_0x2871('0x13'));var qs=require(_0x2871('0x14'));var as=require(_0x2871('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2871('0x16'))('api');var utils=require(_0x2871('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2871('0x18'));var db=require(_0x2871('0x19'))['db'];function respondWithStatusCode(_0x433423,_0x262dd0){_0x262dd0=_0x262dd0||0xcc;return function(_0x7926cb){if(_0x7926cb){return _0x433423[_0x2871('0x1a')](_0x262dd0);}return _0x433423[_0x2871('0x1b')](_0x262dd0)[_0x2871('0x1c')]();};}function respondWithResult(_0x5074d6,_0x6b8196){_0x6b8196=_0x6b8196||0xc8;return function(_0x3e1981){if(_0x3e1981){return _0x5074d6['status'](_0x6b8196)['json'](_0x3e1981);}};}function respondWithFilteredResult(_0x183086,_0x2e56e5){return function(_0x271bab){if(_0x271bab){var _0x452ff4=typeof _0x2e56e5[_0x2871('0x1d')]===_0x2871('0x1e')&&typeof _0x2e56e5[_0x2871('0x1f')]==='undefined';var _0x395949=_0x271bab[_0x2871('0x20')];var _0x48ca48=_0x452ff4?0x0:_0x2e56e5[_0x2871('0x1d')];var _0x28986b=_0x452ff4?_0x271bab['count']:_0x2e56e5[_0x2871('0x1d')]+_0x2e56e5['limit'];var _0x30f803;if(_0x28986b>=_0x395949){_0x28986b=_0x395949;_0x30f803=0xc8;}else{_0x30f803=0xce;}_0x183086[_0x2871('0x1b')](_0x30f803);return _0x183086[_0x2871('0x21')](_0x2871('0x22'),_0x48ca48+'-'+_0x28986b+'/'+_0x395949)['json'](_0x271bab);}return null;};}function patchUpdates(_0x336d85){return function(_0xe1001a){try{jsonpatch[_0x2871('0x23')](_0xe1001a,_0x336d85,!![]);}catch(_0x1bb22c){return BPromise['reject'](_0x1bb22c);}return _0xe1001a[_0x2871('0x24')]();};}function saveUpdates(_0x1eb337,_0x29f7fe){return function(_0x307d12){if(_0x307d12){return _0x307d12['update'](_0x1eb337)[_0x2871('0x25')](function(_0x13a5f3){return _0x13a5f3;});}return null;};}function removeEntity(_0x2f54cc,_0x419f17){return function(_0x2553af){if(_0x2553af){return _0x2553af[_0x2871('0x26')]()[_0x2871('0x25')](function(){_0x2f54cc['status'](0xcc)[_0x2871('0x1c')]();});}};}function handleEntityNotFound(_0x46965b,_0xf3e48d){return function(_0x579c4a){if(!_0x579c4a){_0x46965b[_0x2871('0x1a')](0x194);}return _0x579c4a;};}function handleError(_0x5d07bb,_0x1bcfc5){_0x1bcfc5=_0x1bcfc5||0x1f4;return function(_0x435864){logger[_0x2871('0x27')](_0x435864[_0x2871('0x28')]);if(_0x435864['name']){delete _0x435864['name'];}_0x5d07bb[_0x2871('0x1b')](_0x1bcfc5)[_0x2871('0x29')](_0x435864);};}exports['index']=function(_0x522a78,_0x510c3b){var _0x133a4a={},_0x58ec59={},_0x5dc62b={'count':0x0,'rows':[]};var _0x3893b5=_[_0x2871('0x2a')](db[_0x2871('0x2b')][_0x2871('0x2c')],function(_0x4004c4){return{'name':_0x4004c4[_0x2871('0x2d')],'type':_0x4004c4[_0x2871('0x2e')][_0x2871('0x2f')]};});_0x58ec59[_0x2871('0x30')]=_[_0x2871('0x2a')](_0x3893b5,'name');_0x58ec59['query']=_[_0x2871('0x31')](_0x522a78[_0x2871('0x32')]);_0x58ec59[_0x2871('0x33')]=_['intersection'](_0x58ec59[_0x2871('0x30')],_0x58ec59[_0x2871('0x32')]);_0x133a4a[_0x2871('0x34')]=_[_0x2871('0x35')](_0x58ec59[_0x2871('0x30')],qs[_0x2871('0x36')](_0x522a78['query'][_0x2871('0x36')]));_0x133a4a[_0x2871('0x34')]=_0x133a4a[_0x2871('0x34')][_0x2871('0x37')]?_0x133a4a[_0x2871('0x34')]:_0x58ec59[_0x2871('0x30')];if(!_0x522a78[_0x2871('0x32')]['hasOwnProperty'](_0x2871('0x38'))){_0x133a4a[_0x2871('0x1f')]=qs[_0x2871('0x1f')](_0x522a78[_0x2871('0x32')][_0x2871('0x1f')]);_0x133a4a['offset']=qs['offset'](_0x522a78[_0x2871('0x32')][_0x2871('0x1d')]);}_0x133a4a[_0x2871('0x39')]=qs[_0x2871('0x3a')](_0x522a78[_0x2871('0x32')]['sort']);_0x133a4a['where']=qs[_0x2871('0x33')](_[_0x2871('0x3b')](_0x522a78[_0x2871('0x32')],_0x58ec59[_0x2871('0x33')]),_0x3893b5);if(_0x522a78[_0x2871('0x32')][_0x2871('0x3c')]){_0x133a4a[_0x2871('0x3d')]=_[_0x2871('0x3e')](_0x133a4a[_0x2871('0x3d')],{'$or':_['map'](_0x3893b5,function(_0x4f69f1){if(_0x4f69f1[_0x2871('0x2e')]!=='VIRTUAL'){var _0xaf05bb={};_0xaf05bb[_0x4f69f1['name']]={'$like':'%'+_0x522a78[_0x2871('0x32')][_0x2871('0x3c')]+'%'};return _0xaf05bb;}})});}_0x133a4a=_[_0x2871('0x3e')]({},_0x133a4a,_0x522a78[_0x2871('0x3f')]);var _0x29db27={'where':_0x133a4a[_0x2871('0x3d')]};return db['Attachment'][_0x2871('0x20')](_0x29db27)['then'](function(_0x22c17d){_0x5dc62b[_0x2871('0x20')]=_0x22c17d;if(_0x522a78[_0x2871('0x32')]['includeAll']){_0x133a4a['include']=[{'all':!![]}];}return db[_0x2871('0x2b')][_0x2871('0x40')](_0x133a4a);})['then'](function(_0x253643){_0x5dc62b[_0x2871('0x41')]=_0x253643;return _0x5dc62b;})['then'](respondWithFilteredResult(_0x510c3b,_0x133a4a))[_0x2871('0x42')](handleError(_0x510c3b,null));};exports[_0x2871('0x43')]=function(_0x59b53d,_0x129f43){var _0x30d2d5={'raw':!![],'where':{'id':_0x59b53d[_0x2871('0x44')]['id']}},_0x13e0a4={};_0x13e0a4[_0x2871('0x30')]=_['keys'](db[_0x2871('0x2b')]['rawAttributes']);_0x13e0a4[_0x2871('0x32')]=_[_0x2871('0x31')](_0x59b53d[_0x2871('0x32')]);_0x13e0a4['filters']=_[_0x2871('0x35')](_0x13e0a4[_0x2871('0x30')],_0x13e0a4[_0x2871('0x32')]);_0x30d2d5[_0x2871('0x34')]=_['intersection'](_0x13e0a4[_0x2871('0x30')],qs[_0x2871('0x36')](_0x59b53d['query']['fields']));_0x30d2d5['attributes']=_0x30d2d5['attributes'][_0x2871('0x37')]?_0x30d2d5['attributes']:_0x13e0a4['model'];if(_0x59b53d[_0x2871('0x32')][_0x2871('0x45')]){_0x30d2d5['include']=[{'all':!![]}];}_0x30d2d5=_[_0x2871('0x3e')]({},_0x30d2d5,_0x59b53d['options']);return db[_0x2871('0x2b')][_0x2871('0x46')](_0x30d2d5)[_0x2871('0x25')](handleEntityNotFound(_0x129f43,null))['then'](respondWithResult(_0x129f43,null))[_0x2871('0x42')](handleError(_0x129f43,null));};exports[_0x2871('0x47')]=function(_0x17977a,_0x2a11f6){var _0x375e75={'where':{'id':_0x17977a[_0x2871('0x44')]['id']}},_0xd84600={};_0xd84600[_0x2871('0x30')]=_[_0x2871('0x31')](db['Attachment']['rawAttributes']);_0x375e75['attributes']=_[_0x2871('0x35')](_0xd84600[_0x2871('0x30')],qs[_0x2871('0x36')](_0x17977a['query'][_0x2871('0x36')]));_0x375e75[_0x2871('0x34')]=_0x375e75[_0x2871('0x34')][_0x2871('0x37')]?_0x375e75['attributes']:_0xd84600['model'];if(_0x17977a[_0x2871('0x32')][_0x2871('0x45')]){_0x375e75[_0x2871('0x48')]=[{'all':!![]}];}_0x375e75=_['merge']({},_0x375e75,_0x17977a[_0x2871('0x3f')]);return db[_0x2871('0x2b')][_0x2871('0x46')](_0x375e75)[_0x2871('0x25')](handleEntityNotFound(_0x2a11f6,null))[_0x2871('0x25')](function(_0x590992){if(_0x590992){var _0x1e8155=_0x590992[_0x2871('0x49')]({'plain':!![]});_0x1e8155=qs[_0x2871('0x4a')](_0x1e8155,['id',_0x2871('0x4b'),_0x2871('0x4c')]);_0x17977a[_0x2871('0x4d')]=_[_0x2871('0x4a')](_0x17977a[_0x2871('0x4d')],['id',_0x2871('0x4b'),'updatedAt']);return db[_0x2871('0x2b')][_0x2871('0x4e')](_[_0x2871('0x3e')](_0x1e8155,_0x17977a[_0x2871('0x4d')]),{'include':_0x17977a[_0x2871('0x32')][_0x2871('0x45')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x2a11f6,0xc9))['catch'](handleError(_0x2a11f6,null));};exports[_0x2871('0x4f')]=function(_0x2faec1,_0x3c9c6f){if(_0x2faec1[_0x2871('0x4d')]['id']){delete _0x2faec1[_0x2871('0x4d')]['id'];}return db[_0x2871('0x2b')][_0x2871('0x46')]({'where':{'id':_0x2faec1['params']['id']}})[_0x2871('0x25')](handleEntityNotFound(_0x3c9c6f,null))['then'](saveUpdates(_0x2faec1[_0x2871('0x4d')],null))[_0x2871('0x25')](respondWithResult(_0x3c9c6f,null))[_0x2871('0x42')](handleError(_0x3c9c6f,null));};exports['destroy']=function(_0x314da1,_0x25dfda){return db[_0x2871('0x2b')]['find']({'where':{'id':_0x314da1[_0x2871('0x44')]['id']}})[_0x2871('0x25')](handleEntityNotFound(_0x25dfda,null))[_0x2871('0x25')](removeEntity(_0x25dfda,null))[_0x2871('0x42')](handleError(_0x25dfda,null));};exports[_0x2871('0x4e')]=function(_0x426a6d,_0x138e35,_0x2971eb){_0x426a6d[_0x2871('0x4d')][_0x2871('0x50')]=_0x426a6d['file']['originalname'];_0x426a6d[_0x2871('0x4d')][_0x2871('0x51')]=_0x426a6d[_0x2871('0x52')][_0x2871('0x53')];_0x426a6d[_0x2871('0x4d')][_0x2871('0x2e')]=_0x426a6d[_0x2871('0x52')]['mimetype'];return db[_0x2871('0x2b')]['create'](_0x426a6d[_0x2871('0x4d')])[_0x2871('0x25')](respondWithResult(_0x138e35,0xc9))[_0x2871('0x42')](handleError(_0x138e35,null));};exports[_0x2871('0x54')]=function(_0x448de7,_0xe14300,_0x23a3eb){return db[_0x2871('0x2b')][_0x2871('0x55')]({'where':{'id':_0x448de7[_0x2871('0x44')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0xe14300,null))['then'](function(_0x578d7b){if(_0x578d7b){var _0x598115=_0x578d7b[_0x2871('0x56')]!==null;var _0x5ea758=path[_0x2871('0x57')](config[_0x2871('0x58')],_0x2871('0x59'));if(_0x598115){_0x5ea758=path[_0x2871('0x57')](_0x5ea758,_0x2871('0x5a'));}var _0x129b5a=path[_0x2871('0x57')](_0x5ea758,_0x578d7b['basename']);return _0xe14300['download'](_0x129b5a);}})['catch'](handleError(_0xe14300,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 52f505b..dfae427 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 _0xd7f6=['moment','bluebird','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments'];(function(_0x32f93b,_0x413891){var _0x440841=function(_0x20ff1d){while(--_0x20ff1d){_0x32f93b['push'](_0x32f93b['shift']());}};_0x440841(++_0x413891);}(_0xd7f6,0x154));var _0x6d7f=function(_0x590b88,_0xaa6a0d){_0x590b88=_0x590b88-0x0;var _0x10a4c5=_0xd7f6[_0x590b88];return _0x10a4c5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6d7f('0x0'));var BPromise=require(_0x6d7f('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d7f('0x2'));var rimraf=require(_0x6d7f('0x3'));var config=require(_0x6d7f('0x4'));var attributes=require(_0x6d7f('0x5'));module[_0x6d7f('0x6')]=function(_0x118006,_0x1bbb7a){return _0x118006[_0x6d7f('0x7')](_0x6d7f('0x8'),attributes,{'tableName':_0x6d7f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24a6=['../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','Attachment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x24a6,0x19e));var _0x624a=function(_0x4948bc,_0x466d19){_0x4948bc=_0x4948bc-0x0;var _0x342d1f=_0x24a6[_0x4948bc];return _0x342d1f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x624a('0x0'))(_0x624a('0x1'));var moment=require(_0x624a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x624a('0x3'));var rimraf=require(_0x624a('0x4'));var config=require(_0x624a('0x5'));var attributes=require('./attachment.attributes');module[_0x624a('0x6')]=function(_0xc7836e,_0x7dfe8f){return _0xc7836e[_0x624a('0x7')](_0x624a('0x8'),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 3f606d7..f50b9e7 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 _0x4d9e=['CreateAttachment','Attachment','create','body','options','raw','lodash','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','Attachment,\x20%s,\x20%s','message','catch'];(function(_0x438e4c,_0x49f140){var _0x250901=function(_0x4dfad9){while(--_0x4dfad9){_0x438e4c['push'](_0x438e4c['shift']());}};_0x250901(++_0x49f140);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x218587,_0x370ace){_0x218587=_0x218587-0x0;var _0x5713f9=_0x4d9e[_0x218587];return _0x5713f9;};'use strict';var _=require(_0xe4d9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe4d9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4d9('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4d9('0x3'));var logger=require(_0xe4d9('0x4'))('rpc');var config=require(_0xe4d9('0x5'));var jayson=require(_0xe4d9('0x6'));var client=jayson[_0xe4d9('0x7')][_0xe4d9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x125dbc,_0x32222c,_0x54a63a){return new BPromise(function(_0x36316f,_0x1d3810){return client[_0xe4d9('0x9')](_0x125dbc,_0x54a63a)[_0xe4d9('0xa')](function(_0x3f8937){logger[_0xe4d9('0xb')]('Attachment,\x20%s,\x20%s',_0x32222c,_0xe4d9('0xc'));logger[_0xe4d9('0xd')](_0xe4d9('0xe'),_0x32222c,_0xe4d9('0xc'),JSON[_0xe4d9('0xf')](_0x3f8937));if(_0x3f8937[_0xe4d9('0x10')]){if(_0x3f8937[_0xe4d9('0x10')]['code']===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x32222c,_0x3f8937['error']['message']);return _0x1d3810(_0x3f8937['error']['message']);}logger['error'](_0xe4d9('0x11'),_0x32222c,_0x3f8937[_0xe4d9('0x10')][_0xe4d9('0x12')]);return _0x36316f(_0x3f8937['error'][_0xe4d9('0x12')]);}else{logger[_0xe4d9('0xb')](_0xe4d9('0x11'),_0x32222c,_0xe4d9('0xc'));_0x36316f(_0x3f8937['result'][_0xe4d9('0x12')]);}})[_0xe4d9('0x13')](function(_0x4687f8){logger['error']('Attachment,\x20%s,\x20%s',_0x32222c,_0x4687f8);_0x1d3810(_0x4687f8);});});}exports[_0xe4d9('0x14')]=function(_0x112315){var _0x5ab3d1=this;return new Promise(function(_0x2e1490,_0x4f8dba){return db[_0xe4d9('0x15')][_0xe4d9('0x16')](_0x112315[_0xe4d9('0x17')],{'raw':_0x112315[_0xe4d9('0x18')]?_0x112315['options'][_0xe4d9('0x19')]===undefined?!![]:![]:!![]})[_0xe4d9('0xa')](function(_0x151220){logger[_0xe4d9('0xb')](_0xe4d9('0x14'),_0x112315);logger[_0xe4d9('0xd')](_0xe4d9('0x14'),_0x112315,JSON[_0xe4d9('0xf')](_0x151220));_0x2e1490(_0x151220);})[_0xe4d9('0x13')](function(_0x4fed7f){logger[_0xe4d9('0x10')](_0xe4d9('0x14'),_0x4fed7f['message'],_0x112315);_0x4f8dba(_0x5ab3d1[_0xe4d9('0x10')](0x1f4,_0x4fed7f['message']));});});}; \ No newline at end of file +var _0x79d8=['client','http','request','then','Attachment,\x20%s,\x20%s','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateAttachment','create','options','raw','info','debug','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x3a8425,_0xc10467){var _0x5c5480=function(_0x1c3168){while(--_0x1c3168){_0x3a8425['push'](_0x3a8425['shift']());}};_0x5c5480(++_0xc10467);}(_0x79d8,0x67));var _0x879d=function(_0x189f47,_0x3fd794){_0x189f47=_0x189f47-0x0;var _0x415a3c=_0x79d8[_0x189f47];return _0x415a3c;};'use strict';var _=require(_0x879d('0x0'));var util=require(_0x879d('0x1'));var moment=require(_0x879d('0x2'));var BPromise=require(_0x879d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x879d('0x4'));var db=require(_0x879d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x879d('0x6'))(_0x879d('0x7'));var config=require(_0x879d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x879d('0x9')][_0x879d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x142181,_0xc70b64,_0x49c05d){return new BPromise(function(_0x257050,_0x154db7){return client[_0x879d('0xb')](_0x142181,_0x49c05d)[_0x879d('0xc')](function(_0x2d5fbc){logger['info'](_0x879d('0xd'),_0xc70b64,'request\x20sent');logger['debug'](_0x879d('0xe'),_0xc70b64,_0x879d('0xf'),JSON[_0x879d('0x10')](_0x2d5fbc));if(_0x2d5fbc['error']){if(_0x2d5fbc[_0x879d('0x11')][_0x879d('0x12')]===0x1f4){logger['error'](_0x879d('0xd'),_0xc70b64,_0x2d5fbc[_0x879d('0x11')]['message']);return _0x154db7(_0x2d5fbc[_0x879d('0x11')]['message']);}logger[_0x879d('0x11')](_0x879d('0xd'),_0xc70b64,_0x2d5fbc[_0x879d('0x11')][_0x879d('0x13')]);return _0x257050(_0x2d5fbc[_0x879d('0x11')][_0x879d('0x13')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0xc70b64,_0x879d('0xf'));_0x257050(_0x2d5fbc[_0x879d('0x14')]['message']);}})['catch'](function(_0x7478cd){logger[_0x879d('0x11')](_0x879d('0xd'),_0xc70b64,_0x7478cd);_0x154db7(_0x7478cd);});});}exports[_0x879d('0x15')]=function(_0x3a26e5){var _0x1a6252=this;return new Promise(function(_0x291c96,_0x50539d){return db['Attachment'][_0x879d('0x16')](_0x3a26e5['body'],{'raw':_0x3a26e5[_0x879d('0x17')]?_0x3a26e5['options'][_0x879d('0x18')]===undefined?!![]:![]:!![]})[_0x879d('0xc')](function(_0x31e5d5){logger[_0x879d('0x19')](_0x879d('0x15'),_0x3a26e5);logger[_0x879d('0x1a')](_0x879d('0x15'),_0x3a26e5,JSON['stringify'](_0x31e5d5));_0x291c96(_0x31e5d5);})[_0x879d('0x1b')](function(_0x460020){logger[_0x879d('0x11')](_0x879d('0x15'),_0x460020[_0x879d('0x13')],_0x3a26e5);_0x50539d(_0x1a6252[_0x879d('0x11')](0x1f4,_0x460020['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 6ccb4f5..521e74a 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(_0x42eeea,_0x1c45a1){var _0x1b7375=function(_0x4caeb4){while(--_0x4caeb4){_0x42eeea['push'](_0x42eeea['shift']());}};_0x1b7375(++_0x1c45a1);}(_0xadb5,0xad));var _0x5adb=function(_0x2e4e4c,_0x30286a){_0x2e4e4c=_0x2e4e4c-0x0;var _0x48ce6e=_0xadb5[_0x2e4e4c];return _0x48ce6e;};'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 _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4a3ee3,_0x304512){_0x4a3ee3=_0x4a3ee3-0x0;var _0x56d16d=_0x0b0e[_0x4a3ee3];return _0x56d16d;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 2c2774b..463cba0 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 _0xc2ec=['blockDuration','minutes','getLicense','catch','status','send','message','ad-login','json','use','User','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/logger','api','activedirectory','undefined','url','domain','authenticate','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','blocked','online','disabled','blockedAt','add'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2ec,0x13f));var _0xcc2e=function(_0x2bfd67,_0x393812){_0x2bfd67=_0x2bfd67-0x0;var _0x46bf94=_0xc2ec[_0x2bfd67];return _0x46bf94;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xcc2e('0x0'))[_0xcc2e('0x1')];var moment=require(_0xcc2e('0x2'));var ActiveDirectory=require(_0xcc2e('0x3'));var BPromise=require(_0xcc2e('0x4'));var util=require(_0xcc2e('0x5'));var db=require(_0xcc2e('0x6'))['db'];var authService=require(_0xcc2e('0x7'));var utils=require('../../config/utils');var config=require('../../config/environment');var logger=require(_0xcc2e('0x8'))(_0xcc2e('0x9'));function isActiveDirectoryConfigured(_0x2c0646){var _0x5ef647=![];if(typeof _0x2c0646[_0xcc2e('0xa')]!==_0xcc2e('0xb')){_0x5ef647=_0x2c0646[_0xcc2e('0xa')]['baseDN']&&_0x2c0646[_0xcc2e('0xa')][_0xcc2e('0xc')]&&_0x2c0646[_0xcc2e('0xa')][_0xcc2e('0xd')];}return _0x5ef647;}function adAuthenticate(_0x4934ce,_0x4733aa,_0x2ad492){return new BPromise(function(_0x3da67b,_0x4b3993){try{var _0xd602af=new ActiveDirectory(_0x4934ce);_0xd602af[_0xcc2e('0xe')](_0x4733aa,_0x2ad492,function(_0x44df99,_0x3d8785){if(_0x44df99){logger['error'](_0xcc2e('0xf'),_0x4733aa,util[_0xcc2e('0x10')](_0x44df99,{'showHidden':![],'depth':null}));_0x4b3993(_0xcc2e('0x11'));}else if(!_0x3d8785){logger[_0xcc2e('0x12')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x4733aa);_0x4b3993(_0xcc2e('0x11'));}else{_0x3da67b(_0x3d8785);}});}catch(_0x5a3749){_0x4b3993(_0x5a3749);}});}function ActiveDirectoryAuthenticate(_0x5db635,_0x26ade1,_0x4d871c,_0x4a6894){var _0x30ffba,_0x34f9a8;if(!isActiveDirectoryConfigured(config)){logger[_0xcc2e('0x12')](_0xcc2e('0x13'),_0x26ade1);return _0x4a6894(null,![],{'message':_0xcc2e('0x11')});}return db[_0xcc2e('0x14')][_0xcc2e('0x15')]({'where':{'id':0x1},'attributes':[_0xcc2e('0x16'),'blockDuration'],'raw':!![]})[_0xcc2e('0x17')](function(_0xa9d123){_0x30ffba=_0xa9d123;if(!_0x30ffba[_0xcc2e('0x16')]){logger[_0xcc2e('0x12')](_0xcc2e('0x18'),_0x26ade1);throw new Error(_0xcc2e('0x11'));}return _0x5db635[_0xcc2e('0x15')]({'attributes':['id',_0xcc2e('0x19'),_0xcc2e('0x1a'),_0xcc2e('0x1b'),'role','disabled',_0xcc2e('0x1c'),'blockedAt',_0xcc2e('0x1d')],'where':{'name':_0x26ade1,'role':{'$or':['admin','user','agent']},'adSsoEnabled':!![]}});})['then'](function(_0x106ca5){if(!_0x106ca5||_0x106ca5&&_0x106ca5['name']!==_0x26ade1){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x34f9a8=_0x106ca5;var _0x508d53=_0x34f9a8[_0xcc2e('0x19')]+'@'+config[_0xcc2e('0xa')][_0xcc2e('0xd')];return adAuthenticate(config[_0xcc2e('0xa')],_0x508d53,_0x4d871c);})['then'](function(_0x2c2cfc){if(_0x34f9a8[_0xcc2e('0x1e')]){throw new Error(_0xcc2e('0x11'));}if(_0x30ffba['blockDuration']>0x0){if(_0x34f9a8[_0xcc2e('0x1c')]){if(moment(_0x34f9a8[_0xcc2e('0x1f')])[_0xcc2e('0x20')](_0x30ffba[_0xcc2e('0x21')],_0xcc2e('0x22'))>moment()){throw new Error(_0xcc2e('0x11'));}return utils['clearBlockUser'](_0x34f9a8,0x0,![],null)[_0xcc2e('0x17')](function(){return utils['getLicense'](_0x34f9a8);})[_0xcc2e('0x17')](function(){return _0x4a6894(null,_0x34f9a8);});}else{return utils['getLicense'](_0x34f9a8)[_0xcc2e('0x17')](function(){return _0x4a6894(null,_0x34f9a8);});}}else{return utils[_0xcc2e('0x23')](_0x34f9a8)[_0xcc2e('0x17')](function(){return _0x4a6894(null,_0x34f9a8);});}})[_0xcc2e('0x24')](function(_0x1f7357){return _0x4a6894(null,![],_0x1f7357);});}function handleError(_0x1e0a4a,_0x2cea84,_0x51adfe){return _0x1e0a4a[_0xcc2e('0x25')](_0x2cea84||0x1f4)[_0xcc2e('0x26')]({'message':_0x51adfe?_0x51adfe[_0xcc2e('0x27')]||_0x51adfe:''});}exports['login']=function(_0x49ec71,_0x458448,_0x4aeea3){passport[_0xcc2e('0xe')](_0xcc2e('0x28'),function(_0x44fe71,_0x13e47a,_0x590103){var _0x1be76a=_0x44fe71||_0x590103;if(_0x1be76a){return handleError(_0x458448,0x191,_0x1be76a);}if(!_0x13e47a){return handleError(_0x458448,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x5dcd51={'payload':{'id':_0x13e47a['id'],'role':_0x13e47a['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x5dcd51)[_0xcc2e('0x17')](function(_0x1ca8a9){_0x458448[_0xcc2e('0x29')]({'id':_0x13e47a['id'],'token':_0x1ca8a9,'statusCall':'','isAlreadyLogged':_0x13e47a['online']});});}})(_0x49ec71,_0x458448,_0x4aeea3);};passport[_0xcc2e('0x2a')](_0xcc2e('0x28'),new LocalStrategy({'usernameField':_0xcc2e('0x19'),'passwordField':_0xcc2e('0x1a')},function(_0x58b63b,_0x4a099d,_0x5c3601){return ActiveDirectoryAuthenticate(db[_0xcc2e('0x2b')],_0x58b63b,_0x4a099d,_0x5c3601);})); \ No newline at end of file +var _0x811b=['signToken','json','use','User','passport','moment','activedirectory2','../../mysqldb','../../config/utils','../../config/environment','activedirectory','undefined','url','authenticate','error','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','findOne','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','online','admin','user','agent','then','blockDuration','blockedAt','add','minutes','getLicense','status','send','message','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.'];(function(_0x2c90c1,_0x446eda){var _0xcb55d4=function(_0x30e230){while(--_0x30e230){_0x2c90c1['push'](_0x2c90c1['shift']());}};_0xcb55d4(++_0x446eda);}(_0x811b,0xb0));var _0xb811=function(_0x422b48,_0xf131fb){_0x422b48=_0x422b48-0x0;var _0x4a6f67=_0x811b[_0x422b48];return _0x4a6f67;};'use strict';var passport=require(_0xb811('0x0'));var LocalStrategy=require('passport-local')['Strategy'];var moment=require(_0xb811('0x1'));var ActiveDirectory=require(_0xb811('0x2'));var BPromise=require('bluebird');var util=require('util');var db=require(_0xb811('0x3'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xb811('0x4'));var config=require(_0xb811('0x5'));var logger=require('../../config/logger')('api');function isActiveDirectoryConfigured(_0x636de4){var _0x23f582=![];if(typeof _0x636de4[_0xb811('0x6')]!==_0xb811('0x7')){_0x23f582=_0x636de4[_0xb811('0x6')]['baseDN']&&_0x636de4[_0xb811('0x6')][_0xb811('0x8')]&&_0x636de4[_0xb811('0x6')]['domain'];}return _0x23f582;}function adAuthenticate(_0xe321fa,_0x3c1ed3,_0x564ee4){return new BPromise(function(_0x647d40,_0x4c7acb){try{var _0xd969d2=new ActiveDirectory(_0xe321fa);_0xd969d2[_0xb811('0x9')](_0x3c1ed3,_0x564ee4,function(_0x2a02d4,_0x4a0312){if(_0x2a02d4){logger[_0xb811('0xa')]('Error\x20authenticate\x20%s:\x20%s',_0x3c1ed3,util[_0xb811('0xb')](_0x2a02d4,{'showHidden':![],'depth':null}));_0x4c7acb('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x4a0312){logger[_0xb811('0xa')](_0xb811('0xc'),_0x3c1ed3);_0x4c7acb('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x647d40(_0x4a0312);}});}catch(_0x337310){_0x4c7acb(_0x337310);}});}function ActiveDirectoryAuthenticate(_0x4c1977,_0x5305fd,_0x1a0986,_0x463b45){var _0x47ac2a,_0x32ef1c;if(!isActiveDirectoryConfigured(config)){logger[_0xb811('0xa')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x5305fd);return _0x463b45(null,![],{'message':_0xb811('0xd')});}return db[_0xb811('0xe')][_0xb811('0xf')]({'where':{'id':0x1},'attributes':[_0xb811('0x10'),'blockDuration'],'raw':!![]})['then'](function(_0x3f4c8b){_0x47ac2a=_0x3f4c8b;if(!_0x47ac2a['adSsoEnabled']){logger['error'](_0xb811('0x11'),_0x5305fd);throw new Error(_0xb811('0xd'));}return _0x4c1977[_0xb811('0xf')]({'attributes':['id',_0xb811('0x12'),_0xb811('0x13'),_0xb811('0x14'),_0xb811('0x15'),_0xb811('0x16'),_0xb811('0x17'),'blockedAt',_0xb811('0x18')],'where':{'name':_0x5305fd,'role':{'$or':[_0xb811('0x19'),_0xb811('0x1a'),_0xb811('0x1b')]},'adSsoEnabled':!![]}});})[_0xb811('0x1c')](function(_0x58343a){if(!_0x58343a||_0x58343a&&_0x58343a['name']!==_0x5305fd){throw new Error(_0xb811('0xd'));}_0x32ef1c=_0x58343a;var _0x5c95f9=_0x32ef1c[_0xb811('0x12')]+'@'+config[_0xb811('0x6')]['domain'];return adAuthenticate(config['activedirectory'],_0x5c95f9,_0x1a0986);})[_0xb811('0x1c')](function(_0x30b929){if(_0x32ef1c[_0xb811('0x16')]){throw new Error(_0xb811('0xd'));}if(_0x47ac2a[_0xb811('0x1d')]>0x0){if(_0x32ef1c['blocked']){if(moment(_0x32ef1c[_0xb811('0x1e')])[_0xb811('0x1f')](_0x47ac2a[_0xb811('0x1d')],_0xb811('0x20'))>moment()){throw new Error(_0xb811('0xd'));}return utils['clearBlockUser'](_0x32ef1c,0x0,![],null)[_0xb811('0x1c')](function(){return utils[_0xb811('0x21')](_0x32ef1c);})[_0xb811('0x1c')](function(){return _0x463b45(null,_0x32ef1c);});}else{return utils[_0xb811('0x21')](_0x32ef1c)['then'](function(){return _0x463b45(null,_0x32ef1c);});}}else{return utils[_0xb811('0x21')](_0x32ef1c)[_0xb811('0x1c')](function(){return _0x463b45(null,_0x32ef1c);});}})['catch'](function(_0x525626){return _0x463b45(null,![],_0x525626);});}function handleError(_0x1821fd,_0x272197,_0x3d88ad){return _0x1821fd[_0xb811('0x22')](_0x272197||0x1f4)[_0xb811('0x23')]({'message':_0x3d88ad?_0x3d88ad[_0xb811('0x24')]||_0x3d88ad:''});}exports['login']=function(_0x5b3671,_0x2cbcdf,_0x2e3869){passport[_0xb811('0x9')](_0xb811('0x25'),function(_0x4c0d4f,_0xea576c,_0x5d568a){var _0x1c559a=_0x4c0d4f||_0x5d568a;if(_0x1c559a){return handleError(_0x2cbcdf,0x191,_0x1c559a);}if(!_0xea576c){return handleError(_0x2cbcdf,0x194,{'message':_0xb811('0x26')});}else{var _0x4e444f={'payload':{'id':_0xea576c['id'],'role':_0xea576c[_0xb811('0x15')]},'options':{'expiresIn':0x15180}};return authService[_0xb811('0x27')](_0x4e444f)[_0xb811('0x1c')](function(_0x656e13){_0x2cbcdf[_0xb811('0x28')]({'id':_0xea576c['id'],'token':_0x656e13,'statusCall':'','isAlreadyLogged':_0xea576c['online']});});}})(_0x5b3671,_0x2cbcdf,_0x2e3869);};passport[_0xb811('0x29')](_0xb811('0x25'),new LocalStrategy({'usernameField':'name','passwordField':_0xb811('0x13')},function(_0x319bfa,_0x335f78,_0x1accba){return ActiveDirectoryAuthenticate(db[_0xb811('0x2a')],_0x319bfa,_0x335f78,_0x1accba);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 8505ae2..dd5f374 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 _0x0956=['post','login','express','Router','./authActiveDirectory.controller'];(function(_0x401089,_0x469a19){var _0x128e7c=function(_0x286ffa){while(--_0x286ffa){_0x401089['push'](_0x401089['shift']());}};_0x128e7c(++_0x469a19);}(_0x0956,0x160));var _0x6095=function(_0x56d24b,_0x420a40){_0x56d24b=_0x56d24b-0x0;var _0x31d66a=_0x0956[_0x56d24b];return _0x31d66a;};'use strict';var express=require(_0x6095('0x0'));var router=express[_0x6095('0x1')]();var controller=require(_0x6095('0x2'));router[_0x6095('0x3')]('/',controller[_0x6095('0x4')]);module['exports']=router; \ No newline at end of file +var _0xe335=['login','exports','express','Router','./authActiveDirectory.controller','post'];(function(_0x251556,_0x31fa66){var _0x3f3d0d=function(_0x4ab3d7){while(--_0x4ab3d7){_0x251556['push'](_0x251556['shift']());}};_0x3f3d0d(++_0x31fa66);}(_0xe335,0xda));var _0x5e33=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe335[_0x42cae2];return _0x5f256f;};'use strict';var express=require(_0x5e33('0x0'));var router=express[_0x5e33('0x1')]();var controller=require(_0x5e33('0x2'));router[_0x5e33('0x3')]('/',controller[_0x5e33('0x4')]);module[_0x5e33('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index a18ef61..a6202bb 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x52b3c9,_0x2bf3ae){var _0x36423d=function(_0x129862){while(--_0x129862){_0x52b3c9['push'](_0x52b3c9['shift']());}};_0x36423d(++_0x2bf3ae);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _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(_0x53f587,_0x104532){var _0x16f2de=function(_0x205ab0){while(--_0x205ab0){_0x53f587['push'](_0x53f587['shift']());}};_0x16f2de(++_0x104532);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 03b3f1c..2e97ecf 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 _0xbe44=['callback','isMiddleware','setTokenCookie','exports','express','Router','./authGoogle.controller','../../components/auth/service','login','get'];(function(_0x28f8ef,_0x54040c){var _0x5343ca=function(_0xec294d){while(--_0xec294d){_0x28f8ef['push'](_0x28f8ef['shift']());}};_0x5343ca(++_0x54040c);}(_0xbe44,0x13a));var _0x4be4=function(_0x451980,_0x2ad060){_0x451980=_0x451980-0x0;var _0x3a66cf=_0xbe44[_0x451980];return _0x3a66cf;};'use strict';var express=require(_0x4be4('0x0'));var passport=require('passport');var router=express[_0x4be4('0x1')]();var controller=require(_0x4be4('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0x4be4('0x3'));router['get']('/',controller[_0x4be4('0x4')]);router[_0x4be4('0x5')]('/callback',controller[_0x4be4('0x6')],authService[_0x4be4('0x7')],userController[_0x4be4('0x4')],authService[_0x4be4('0x8')]);module[_0x4be4('0x9')]=router; \ No newline at end of file +var _0xa925=['login','setTokenCookie','Router','../../components/auth/service','get','/callback','callback','isMiddleware'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0xa925,0x1b2));var _0x5a92=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xa925[_0x4c12ec];return _0x3ae42c;};'use strict';var express=require('express');var passport=require('passport');var router=express[_0x5a92('0x0')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0x5a92('0x1'));router[_0x5a92('0x2')]('/',controller['login']);router[_0x5a92('0x2')](_0x5a92('0x3'),controller[_0x5a92('0x4')],authService[_0x5a92('0x5')],userController[_0x5a92('0x6')],authService[_0x5a92('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 44bcba4..c7e443f 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 _0x0bae=['/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','password','enforcePasswordHistory','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','User','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','name','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','minutes','clearBlockUser','add','getLicense','catch','MailAccount','email','MailServerOut','Smtp','CloudProvider','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','headers','host'];(function(_0x5e2bec,_0x5bc60a){var _0x2ff298=function(_0x194022){while(--_0x194022){_0x5e2bec['push'](_0x5e2bec['shift']());}};_0x2ff298(++_0x5bc60a);}(_0x0bae,0xbb));var _0xe0ba=function(_0x187e0e,_0x2898a3){_0x187e0e=_0x187e0e-0x0;var _0x55321e=_0x0bae[_0x187e0e];return _0x55321e;};'use strict';var util=require(_0xe0ba('0x0'));var passport=require(_0xe0ba('0x1'));var LocalStrategy=require(_0xe0ba('0x2'))[_0xe0ba('0x3')];var jayson=require(_0xe0ba('0x4'));var _=require(_0xe0ba('0x5'));var rs=require(_0xe0ba('0x6'));var moment=require(_0xe0ba('0x7'));var db=require(_0xe0ba('0x8'))['db'];var authService=require(_0xe0ba('0x9'));var utils=require('../../config/utils');var client=jayson[_0xe0ba('0xa')][_0xe0ba('0xb')]({'port':0x232b});function localAuthenticate(_0x5ad2ee,_0x80e64e,_0x2ceff5,_0x4caf77){var _0x1aae49,_0x1c1744;return db[_0xe0ba('0xc')][_0xe0ba('0xd')]({'where':{'id':0x1},'attributes':[_0xe0ba('0xe'),_0xe0ba('0xf')],'raw':!![]})['then'](function(_0x35292d){_0x1aae49=_0x35292d;return _0x5ad2ee[_0xe0ba('0xd')]({'attributes':['id',_0xe0ba('0x10'),'password',_0xe0ba('0x11'),_0xe0ba('0x12'),_0xe0ba('0x13'),_0xe0ba('0x14'),_0xe0ba('0x15'),_0xe0ba('0x16')],'where':{'name':_0x80e64e,'role':{'$or':[_0xe0ba('0x17'),_0xe0ba('0x18'),_0xe0ba('0x19')]}}});})[_0xe0ba('0x1a')](function(_0x31a549){if(!_0x31a549||_0x31a549&&_0x31a549[_0xe0ba('0x10')]!==_0x80e64e){throw new Error(_0xe0ba('0x1b'));}else{_0x1c1744=_0x31a549;return _0x1c1744;}})[_0xe0ba('0x1a')](function(){_0x1c1744[_0xe0ba('0x1c')](_0x2ceff5,function(_0x1bb194,_0x1014cd){var _0x36e520=_0x1c1744[_0xe0ba('0x16')]+0x1;if(_0x1bb194){return _0x4caf77(_0x1bb194);}else if(!_0x1014cd){if(_0x1c1744[_0xe0ba('0x13')]){return _0x4caf77(null,![],{'message':_0xe0ba('0x1b')});}else if(_0x1aae49['allowedLoginAttempts']>0x0){if(_0x1c1744[_0xe0ba('0x14')]){if(_0x1aae49[_0xe0ba('0xf')]>0x0){if(moment(_0x1c1744[_0xe0ba('0x15')])['add'](_0x1aae49['blockDuration'],_0xe0ba('0x1d'))>moment()){return _0x4caf77(null,![],{'message':_0xe0ba('0x1b')});}else{return utils[_0xe0ba('0x1e')](_0x1c1744,_0x36e520,![],null)[_0xe0ba('0x1a')](function(){return _0x4caf77(null,![],{'message':_0xe0ba('0x1b')});});}}else{return _0x4caf77(null,![],{'message':_0xe0ba('0x1b')});}}else{if(_0x36e520>=_0x1aae49[_0xe0ba('0xe')]){return utils[_0xe0ba('0x1e')](_0x1c1744,0x0,!![],moment())[_0xe0ba('0x1a')](function(){return _0x4caf77(null,![],{'message':_0xe0ba('0x1b')});});}else{return utils[_0xe0ba('0x1e')](_0x1c1744,_0x36e520,![],null)[_0xe0ba('0x1a')](function(){return _0x4caf77(null,![],{'message':_0xe0ba('0x1b')});});}}}else{return _0x4caf77(null,![],{'message':_0xe0ba('0x1b')});}}else{if(_0x1c1744['disabled']){return _0x4caf77(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x1aae49['allowedLoginAttempts']>0x0){if(_0x1c1744['blocked']){if(_0x1aae49['blockDuration']>0x0){if(moment(_0x1c1744[_0xe0ba('0x15')])[_0xe0ba('0x1f')](_0x1aae49[_0xe0ba('0xf')],_0xe0ba('0x1d'))>moment()){return _0x4caf77(null,![],{'message':_0xe0ba('0x1b')});}else{return utils[_0xe0ba('0x1e')](_0x1c1744,0x0,![],null)['then'](function(){return utils[_0xe0ba('0x20')](_0x1c1744);})[_0xe0ba('0x1a')](function(){return _0x4caf77(null,_0x1c1744);});}}else{return _0x4caf77(null,![],{'message':_0xe0ba('0x1b')});}}else{return utils[_0xe0ba('0x1e')](_0x1c1744,0x0,![],null)['then'](function(){return utils[_0xe0ba('0x20')](_0x1c1744);})[_0xe0ba('0x1a')](function(){return _0x4caf77(null,_0x1c1744);})[_0xe0ba('0x21')](function(_0xe95280){return _0x4caf77(null,![],_0xe95280);});}}else{if(_0x1c1744[_0xe0ba('0x14')]){return _0x4caf77(null,![],{'message':_0xe0ba('0x1b')});}else{return utils[_0xe0ba('0x20')](_0x1c1744)[_0xe0ba('0x1a')](function(){return _0x4caf77(null,_0x1c1744);});}}}});})[_0xe0ba('0x21')](function(_0x5d6062){return _0x4caf77(null,![],_0x5d6062);});}function sendServiceMail(_0x148217){return db[_0xe0ba('0x22')]['find']({'where':{'service':!![]},'attributes':['id',_0xe0ba('0x10'),_0xe0ba('0x23')],'include':[{'model':db[_0xe0ba('0x24')],'as':_0xe0ba('0x25'),'include':[{'model':db[_0xe0ba('0x26')],'as':_0xe0ba('0x26')}]}]})[_0xe0ba('0x1a')](function(_0x51642e){if(!_0x51642e){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x4e00ee=_0x51642e[_0xe0ba('0x27')]();var _0x4531f9={'account':_0x4e00ee,'message':_[_0xe0ba('0x28')]({'from':util[_0xe0ba('0x29')](_0xe0ba('0x2a'),_0x51642e[_0xe0ba('0x10')],_0x51642e[_0xe0ba('0x23')]||_0x51642e[_0xe0ba('0x25')][_0xe0ba('0x18')])},_0x148217)};return client[_0xe0ba('0x2b')](_0xe0ba('0x2c'),_0x4531f9);})[_0xe0ba('0x1a')](function(_0x168c81){if(_0x168c81['error']){throw new Error(util[_0xe0ba('0x29')](_0xe0ba('0x2d'),_0x168c81[_0xe0ba('0x2e')][_0xe0ba('0x2f')]||JSON[_0xe0ba('0x30')](_0x168c81[_0xe0ba('0x2e')])));}return!![];});}function handleError(_0x421c5e,_0x4ac7fd,_0x372606){return _0x421c5e[_0xe0ba('0x31')](_0x4ac7fd||0x1f4)[_0xe0ba('0x32')]({'message':_0x372606?_0x372606[_0xe0ba('0x2f')]||_0x372606:''});}exports[_0xe0ba('0x33')]=function(_0x3c9ac2,_0x254fa7,_0x3a2ebf){passport[_0xe0ba('0x1c')](_0xe0ba('0x34'),function(_0x548891,_0x13ba3c,_0x5bba47){var _0x3aa29d=_0x548891||_0x5bba47;if(_0x3aa29d){return handleError(_0x254fa7,0x191,_0x3aa29d);}if(!_0x13ba3c){return handleError(_0x254fa7,0x194,{'message':_0xe0ba('0x35')});}else{var _0x2bd2ba={'payload':{'id':_0x13ba3c['id'],'role':_0x13ba3c[_0xe0ba('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0xe0ba('0x36')](_0x2bd2ba)['then'](function(_0xddf6b3){_0x254fa7[_0xe0ba('0x37')]({'id':_0x13ba3c['id'],'token':_0xddf6b3,'statusCall':'','isAlreadyLogged':_0x13ba3c['online']});});}})(_0x3c9ac2,_0x254fa7,_0x3a2ebf);};exports[_0xe0ba('0x38')]=function(_0x1c4b60,_0x4a81d6){if(!_0x1c4b60[_0xe0ba('0x39')][_0xe0ba('0x23')]){return handleError(_0x4a81d6,0x1f4,{'message':_0xe0ba('0x3a')});}var _0x564225=rs[_0xe0ba('0x3b')]();_0x1c4b60[_0xe0ba('0x39')][_0xe0ba('0x23')]=_0x1c4b60[_0xe0ba('0x39')][_0xe0ba('0x23')]['trim']()[_0xe0ba('0x3c')]();var _0x1350c6;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xe0ba('0xe'),_0xe0ba('0xf')],'raw':!![]})[_0xe0ba('0x1a')](function(_0x22840f){_0x1350c6=_0x22840f;return db['User'][_0xe0ba('0x3d')]({'where':{'email':_0x1c4b60[_0xe0ba('0x39')][_0xe0ba('0x23')]}});})[_0xe0ba('0x1a')](function(_0x589197){if(!_0x589197){throw new Error(_0xe0ba('0x3e'));}if(_0x589197[_0xe0ba('0x13')]){throw new Error(_0xe0ba('0x3f'));}if(_0x589197[_0xe0ba('0x14')]){if(moment(_0x589197[_0xe0ba('0x15')])[_0xe0ba('0x1f')](_0x1350c6[_0xe0ba('0xf')],_0xe0ba('0x1d'))>moment()){throw new Error(_0xe0ba('0x40'));}else{_0x589197[_0xe0ba('0x14')]=![];_0x589197['blockedAt']=null;}}_0x589197[_0xe0ba('0x41')]=_0x564225;_0x589197['resetPasswordExpires']=Date[_0xe0ba('0x42')]()+0x36ee80;return _0x589197[_0xe0ba('0x43')]();})[_0xe0ba('0x1a')](function(){return sendServiceMail({'to':_0x1c4b60[_0xe0ba('0x39')][_0xe0ba('0x23')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xe0ba('0x44')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x1c4b60[_0xe0ba('0x45')][_0xe0ba('0x46')]+_0xe0ba('0x47')+_0x564225+'\x0a\x0a'+_0xe0ba('0x48')});})[_0xe0ba('0x1a')](function(){_0x4a81d6[_0xe0ba('0x31')](0xc8)[_0xe0ba('0x32')]({'message':_0xe0ba('0x49')});})[_0xe0ba('0x21')](function(_0x160a87){return handleError(_0x4a81d6,0x1f4,_0x160a87);});};exports[_0xe0ba('0x4a')]=function(_0x23a45d,_0xc1d53e){return db['User'][_0xe0ba('0x3d')]({'where':{'resetPasswordToken':_0x23a45d['params'][_0xe0ba('0x4b')],'resetPasswordExpires':{'$gt':Date[_0xe0ba('0x42')]()}}})['then'](function(_0x524dac){if(!_0x524dac){throw new Error(_0xe0ba('0x4c'));}return db['Setting'][_0xe0ba('0xd')]({'attributes':['id',_0xe0ba('0x4d'),'enforcePasswordHistory',_0xe0ba('0x4e')]})['then'](function(_0x406c42){if(_0x406c42[_0xe0ba('0x4d')])authService[_0xe0ba('0x4f')](_0x23a45d[_0xe0ba('0x39')][_0xe0ba('0x50')]);if(!_0x406c42[_0xe0ba('0x51')]||!_0x524dac['previousPasswords'])return _0x524dac;authService[_0xe0ba('0x52')](_0x23a45d[_0xe0ba('0x39')]['password'],_0x524dac['previousPasswords'],_0x406c42[_0xe0ba('0x4e')]);return _0x524dac;})[_0xe0ba('0x1a')](function(){_0x524dac[_0xe0ba('0x50')]=_0x23a45d[_0xe0ba('0x39')]['password'];_0x524dac[_0xe0ba('0x41')]=null;_0x524dac[_0xe0ba('0x53')]=null;return _0x524dac[_0xe0ba('0x43')]();});})['then'](function(){_0xc1d53e[_0xe0ba('0x31')](0xc8)[_0xe0ba('0x32')]({'message':_0xe0ba('0x54')});})['catch'](function(_0x5abc75){return handleError(_0xc1d53e,0x1f4,_0x5abc75);});};passport['use'](_0xe0ba('0x34'),new LocalStrategy({'usernameField':_0xe0ba('0x10'),'passwordField':_0xe0ba('0x50')},function(_0x2a5c04,_0xd9ff3c,_0xa2c96b){return localAuthenticate(db[_0xe0ba('0x55')],_0x2a5c04,_0xd9ff3c,_0xa2c96b);})); \ No newline at end of file +var _0x36c2=['Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','Password\x20reset!','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','salt','role','disabled','blocked','blockedAt','admin','user','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','email','SendMail','error','message','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','params','token'];(function(_0x82d9be,_0x29c71a){var _0x772df7=function(_0x10abe2){while(--_0x10abe2){_0x82d9be['push'](_0x82d9be['shift']());}};_0x772df7(++_0x29c71a);}(_0x36c2,0xab));var _0x236c=function(_0xbc93da,_0x19b494){_0xbc93da=_0xbc93da-0x0;var _0x11b040=_0x36c2[_0xbc93da];return _0x11b040;};'use strict';var util=require(_0x236c('0x0'));var passport=require(_0x236c('0x1'));var LocalStrategy=require(_0x236c('0x2'))[_0x236c('0x3')];var jayson=require(_0x236c('0x4'));var _=require(_0x236c('0x5'));var rs=require(_0x236c('0x6'));var moment=require('moment');var db=require(_0x236c('0x7'))['db'];var authService=require(_0x236c('0x8'));var utils=require(_0x236c('0x9'));var client=jayson[_0x236c('0xa')][_0x236c('0xb')]({'port':0x232b});function localAuthenticate(_0x282685,_0x5e2f05,_0x30171f,_0x523776){var _0x5d78e4,_0xa9330;return db[_0x236c('0xc')]['findOne']({'where':{'id':0x1},'attributes':[_0x236c('0xd'),_0x236c('0xe')],'raw':!![]})[_0x236c('0xf')](function(_0x560dd9){_0x5d78e4=_0x560dd9;return _0x282685[_0x236c('0x10')]({'attributes':['id','name','password',_0x236c('0x11'),_0x236c('0x12'),_0x236c('0x13'),_0x236c('0x14'),_0x236c('0x15'),'loginAttempts'],'where':{'name':_0x5e2f05,'role':{'$or':[_0x236c('0x16'),_0x236c('0x17'),_0x236c('0x18')]}}});})[_0x236c('0xf')](function(_0x266246){if(!_0x266246||_0x266246&&_0x266246[_0x236c('0x19')]!==_0x5e2f05){throw new Error(_0x236c('0x1a'));}else{_0xa9330=_0x266246;return _0xa9330;}})[_0x236c('0xf')](function(){_0xa9330['authenticate'](_0x30171f,function(_0xb5a2ea,_0x15b3f0){var _0x39b762=_0xa9330['loginAttempts']+0x1;if(_0xb5a2ea){return _0x523776(_0xb5a2ea);}else if(!_0x15b3f0){if(_0xa9330[_0x236c('0x13')]){return _0x523776(null,![],{'message':_0x236c('0x1a')});}else if(_0x5d78e4[_0x236c('0xd')]>0x0){if(_0xa9330[_0x236c('0x14')]){if(_0x5d78e4[_0x236c('0xe')]>0x0){if(moment(_0xa9330[_0x236c('0x15')])['add'](_0x5d78e4[_0x236c('0xe')],_0x236c('0x1b'))>moment()){return _0x523776(null,![],{'message':_0x236c('0x1a')});}else{return utils[_0x236c('0x1c')](_0xa9330,_0x39b762,![],null)[_0x236c('0xf')](function(){return _0x523776(null,![],{'message':_0x236c('0x1a')});});}}else{return _0x523776(null,![],{'message':_0x236c('0x1a')});}}else{if(_0x39b762>=_0x5d78e4[_0x236c('0xd')]){return utils[_0x236c('0x1c')](_0xa9330,0x0,!![],moment())['then'](function(){return _0x523776(null,![],{'message':_0x236c('0x1a')});});}else{return utils[_0x236c('0x1c')](_0xa9330,_0x39b762,![],null)[_0x236c('0xf')](function(){return _0x523776(null,![],{'message':_0x236c('0x1a')});});}}}else{return _0x523776(null,![],{'message':_0x236c('0x1a')});}}else{if(_0xa9330[_0x236c('0x13')]){return _0x523776(null,![],{'message':_0x236c('0x1a')});}else if(_0x5d78e4[_0x236c('0xd')]>0x0){if(_0xa9330['blocked']){if(_0x5d78e4['blockDuration']>0x0){if(moment(_0xa9330[_0x236c('0x15')])[_0x236c('0x1d')](_0x5d78e4[_0x236c('0xe')],'minutes')>moment()){return _0x523776(null,![],{'message':_0x236c('0x1a')});}else{return utils[_0x236c('0x1c')](_0xa9330,0x0,![],null)[_0x236c('0xf')](function(){return utils['getLicense'](_0xa9330);})[_0x236c('0xf')](function(){return _0x523776(null,_0xa9330);});}}else{return _0x523776(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x236c('0x1c')](_0xa9330,0x0,![],null)[_0x236c('0xf')](function(){return utils[_0x236c('0x1e')](_0xa9330);})['then'](function(){return _0x523776(null,_0xa9330);})['catch'](function(_0x17dcf3){return _0x523776(null,![],_0x17dcf3);});}}else{if(_0xa9330[_0x236c('0x14')]){return _0x523776(null,![],{'message':_0x236c('0x1a')});}else{return utils[_0x236c('0x1e')](_0xa9330)[_0x236c('0xf')](function(){return _0x523776(null,_0xa9330);});}}}});})[_0x236c('0x1f')](function(_0x30fd40){return _0x523776(null,![],_0x30fd40);});}function sendServiceMail(_0x4982d7){return db[_0x236c('0x20')][_0x236c('0x21')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0x236c('0x22')],'as':_0x236c('0x23'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})[_0x236c('0xf')](function(_0x4053f7){if(!_0x4053f7){throw new Error(_0x236c('0x24'));}var _0x5ee181=_0x4053f7[_0x236c('0x25')]();var _0xb1a6={'account':_0x5ee181,'message':_['merge']({'from':util[_0x236c('0x26')]('\x22%s\x22\x20<%s>',_0x4053f7['name'],_0x4053f7[_0x236c('0x27')]||_0x4053f7[_0x236c('0x23')][_0x236c('0x17')])},_0x4982d7)};return client['request'](_0x236c('0x28'),_0xb1a6);})[_0x236c('0xf')](function(_0x464a6f){if(_0x464a6f[_0x236c('0x29')]){throw new Error(util[_0x236c('0x26')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x464a6f[_0x236c('0x29')][_0x236c('0x2a')]||JSON['stringify'](_0x464a6f['error'])));}return!![];});}function handleError(_0x147956,_0x50608e,_0x6b3e85){return _0x147956['status'](_0x50608e||0x1f4)[_0x236c('0x2b')]({'message':_0x6b3e85?_0x6b3e85[_0x236c('0x2a')]||_0x6b3e85:''});}exports[_0x236c('0x2c')]=function(_0x24bd3a,_0x27bb8b,_0x28b7fb){passport[_0x236c('0x2d')](_0x236c('0x2e'),function(_0x33e4b4,_0x2e06a0,_0x48ef66){var _0x2b2010=_0x33e4b4||_0x48ef66;if(_0x2b2010){return handleError(_0x27bb8b,0x191,_0x2b2010);}if(!_0x2e06a0){return handleError(_0x27bb8b,0x194,{'message':_0x236c('0x2f')});}else{var _0x33f702={'payload':{'id':_0x2e06a0['id'],'role':_0x2e06a0['role']},'options':{'expiresIn':0x15180}};return authService[_0x236c('0x30')](_0x33f702)[_0x236c('0xf')](function(_0x34a0bd){_0x27bb8b[_0x236c('0x31')]({'id':_0x2e06a0['id'],'token':_0x34a0bd,'statusCall':'','isAlreadyLogged':_0x2e06a0[_0x236c('0x32')]});});}})(_0x24bd3a,_0x27bb8b,_0x28b7fb);};exports[_0x236c('0x33')]=function(_0x4ad93b,_0x5d7cc6){if(!_0x4ad93b[_0x236c('0x34')][_0x236c('0x27')]){return handleError(_0x5d7cc6,0x1f4,{'message':_0x236c('0x35')});}var _0x4dec7a=rs[_0x236c('0x36')]();_0x4ad93b['body'][_0x236c('0x27')]=_0x4ad93b[_0x236c('0x34')]['email']['trim']()['toLowerCase']();var _0x2953c6;return db[_0x236c('0xc')][_0x236c('0x10')]({'where':{'id':0x1},'attributes':[_0x236c('0xd'),_0x236c('0xe')],'raw':!![]})[_0x236c('0xf')](function(_0x389ee5){_0x2953c6=_0x389ee5;return db[_0x236c('0x37')]['find']({'where':{'email':_0x4ad93b['body'][_0x236c('0x27')]}});})[_0x236c('0xf')](function(_0x29fd24){if(!_0x29fd24){throw new Error(_0x236c('0x38'));}if(_0x29fd24['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x29fd24[_0x236c('0x14')]){if(moment(_0x29fd24['blockedAt'])[_0x236c('0x1d')](_0x2953c6[_0x236c('0xe')],_0x236c('0x1b'))>moment()){throw new Error(_0x236c('0x39'));}else{_0x29fd24[_0x236c('0x14')]=![];_0x29fd24[_0x236c('0x15')]=null;}}_0x29fd24[_0x236c('0x3a')]=_0x4dec7a;_0x29fd24[_0x236c('0x3b')]=Date['now']()+0x36ee80;return _0x29fd24[_0x236c('0x3c')]();})['then'](function(){return sendServiceMail({'to':_0x4ad93b[_0x236c('0x34')]['email'],'subject':_0x236c('0x3d'),'text':_0x236c('0x3e')+_0x236c('0x3f')+'https://'+_0x4ad93b[_0x236c('0x40')]['host']+_0x236c('0x41')+_0x4dec7a+'\x0a\x0a'+_0x236c('0x42')});})[_0x236c('0xf')](function(){_0x5d7cc6[_0x236c('0x43')](0xc8)['send']({'message':_0x236c('0x44')});})['catch'](function(_0x2d22a1){return handleError(_0x5d7cc6,0x1f4,_0x2d22a1);});};exports[_0x236c('0x45')]=function(_0xdd146c,_0x5a6287){return db[_0x236c('0x37')][_0x236c('0x21')]({'where':{'resetPasswordToken':_0xdd146c[_0x236c('0x46')][_0x236c('0x47')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x236c('0xf')](function(_0x7da9b5){if(!_0x7da9b5){throw new Error(_0x236c('0x48'));}return db[_0x236c('0xc')][_0x236c('0x10')]({'attributes':['id',_0x236c('0x49'),_0x236c('0x4a'),_0x236c('0x4b')]})['then'](function(_0x1ae42a){if(_0x1ae42a['securePassword'])authService[_0x236c('0x4c')](_0xdd146c[_0x236c('0x34')][_0x236c('0x4d')]);if(!_0x1ae42a[_0x236c('0x4a')]||!_0x7da9b5[_0x236c('0x4e')])return _0x7da9b5;authService[_0x236c('0x4f')](_0xdd146c[_0x236c('0x34')][_0x236c('0x4d')],_0x7da9b5['previousPasswords'],_0x1ae42a[_0x236c('0x4b')]);return _0x7da9b5;})[_0x236c('0xf')](function(){_0x7da9b5['password']=_0xdd146c[_0x236c('0x34')][_0x236c('0x4d')];_0x7da9b5['resetPasswordToken']=null;_0x7da9b5[_0x236c('0x3b')]=null;return _0x7da9b5[_0x236c('0x3c')]();});})[_0x236c('0xf')](function(){_0x5a6287[_0x236c('0x43')](0xc8)[_0x236c('0x2b')]({'message':_0x236c('0x50')});})[_0x236c('0x1f')](function(_0x43c9b0){return handleError(_0x5a6287,0x1f4,_0x43c9b0);});};passport['use']('local-login',new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x25e0d0,_0x1d5987,_0xcb3b0){return localAuthenticate(db[_0x236c('0x37')],_0x25e0d0,_0x1d5987,_0xcb3b0);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 05ba8a5..1a0b760 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 _0xcf06=['/reset/:token','reset','exports','express','Router','./authLocal.controller','post','login','/forgot'];(function(_0xf269ca,_0x34ea81){var _0x170620=function(_0x30032a){while(--_0x30032a){_0xf269ca['push'](_0xf269ca['shift']());}};_0x170620(++_0x34ea81);}(_0xcf06,0xff));var _0x6cf0=function(_0x2f742a,_0x32885d){_0x2f742a=_0x2f742a-0x0;var _0x4634fc=_0xcf06[_0x2f742a];return _0x4634fc;};'use strict';var express=require(_0x6cf0('0x0'));var router=express[_0x6cf0('0x1')]();var controller=require(_0x6cf0('0x2'));router[_0x6cf0('0x3')]('/',controller[_0x6cf0('0x4')]);router[_0x6cf0('0x3')](_0x6cf0('0x5'),controller['forgot']);router[_0x6cf0('0x3')](_0x6cf0('0x6'),controller[_0x6cf0('0x7')]);module[_0x6cf0('0x8')]=router; \ No newline at end of file +var _0x7ff5=['login','/forgot','forgot','/reset/:token','reset','exports','./authLocal.controller','post'];(function(_0xdf22f6,_0x437b4d){var _0x3eac5e=function(_0x503843){while(--_0x503843){_0xdf22f6['push'](_0xdf22f6['shift']());}};_0x3eac5e(++_0x437b4d);}(_0x7ff5,0xfe));var _0x57ff=function(_0xff17e7,_0x3e9f3b){_0xff17e7=_0xff17e7-0x0;var _0x47cc72=_0x7ff5[_0xff17e7];return _0x47cc72;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0x57ff('0x0'));router[_0x57ff('0x1')]('/',controller[_0x57ff('0x2')]);router[_0x57ff('0x1')](_0x57ff('0x3'),controller[_0x57ff('0x4')]);router[_0x57ff('0x1')](_0x57ff('0x5'),controller[_0x57ff('0x6')]);module[_0x57ff('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 4855519..86c1541 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 _0x7ffe=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x492c73,_0x477d73){var _0x46c3a1=function(_0xfc560e){while(--_0xfc560e){_0x492c73['push'](_0x492c73['shift']());}};_0x46c3a1(++_0x477d73);}(_0x7ffe,0xe9));var _0xe7ff=function(_0x1b3c10,_0x13c894){_0x1b3c10=_0x1b3c10-0x0;var _0x57fe91=_0x7ffe[_0x1b3c10];return _0x57fe91;};'use strict';var Sequelize=require(_0xe7ff('0x0'));module[_0xe7ff('0x1')]={'name':{'type':Sequelize[_0xe7ff('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe7ff('0x2')]},'status':{'type':Sequelize[_0xe7ff('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xe7ff('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x4903=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x24a0e8,_0xbacbe6){var _0x32d2e7=function(_0xd5847f){while(--_0xd5847f){_0x24a0e8['push'](_0x24a0e8['shift']());}};_0x32d2e7(++_0xbacbe6);}(_0x4903,0xe1));var _0x3490=function(_0x494047,_0x2d3c20){_0x494047=_0x494047-0x0;var _0x2c8729=_0x4903[_0x494047];return _0x2c8729;};'use strict';var Sequelize=require(_0x3490('0x0'));module[_0x3490('0x1')]={'name':{'type':Sequelize[_0x3490('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x3490('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x3490('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x3490('0x4')],'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 102e64d..7ae435f 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 _0x39bd=['options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','create','body','find','addConditions','ids','omit','getConditions','findOne','Condition','order','hasOwnProperty','addActions','Action','getActions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','Automation','type','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge'];(function(_0x925e9b,_0x25310c){var _0x31c9ed=function(_0x1ac48e){while(--_0x1ac48e){_0x925e9b['push'](_0x925e9b['shift']());}};_0x31c9ed(++_0x25310c);}(_0x39bd,0x15c));var _0xd39b=function(_0x40f018,_0x310ad7){_0x40f018=_0x40f018-0x0;var _0x46c944=_0x39bd[_0x40f018];return _0x46c944;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd39b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd39b('0x1'));var rp=require(_0xd39b('0x2'));var moment=require(_0xd39b('0x3'));var BPromise=require(_0xd39b('0x4'));var Mustache=require(_0xd39b('0x5'));var util=require(_0xd39b('0x6'));var path=require('path');var sox=require(_0xd39b('0x7'));var csv=require('to-csv');var ejs=require(_0xd39b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd39b('0x9'));var squel=require(_0xd39b('0xa'));var crypto=require(_0xd39b('0xb'));var jsforce=require(_0xd39b('0xc'));var deskjs=require(_0xd39b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd39b('0xe'));var authService=require(_0xd39b('0xf'));var qs=require(_0xd39b('0x10'));var as=require(_0xd39b('0x11'));var hardwareService=require(_0xd39b('0x12'));var logger=require(_0xd39b('0x13'))(_0xd39b('0x14'));var utils=require('../../config/utils');var config=require(_0xd39b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd39b('0x16'))['db'];function respondWithStatusCode(_0x3baf94,_0x2c5a9e){_0x2c5a9e=_0x2c5a9e||0xcc;return function(_0x3debbf){if(_0x3debbf){return _0x3baf94['sendStatus'](_0x2c5a9e);}return _0x3baf94['status'](_0x2c5a9e)['end']();};}function respondWithResult(_0x395874,_0x5b235c){_0x5b235c=_0x5b235c||0xc8;return function(_0x19d56e){if(_0x19d56e){return _0x395874['status'](_0x5b235c)[_0xd39b('0x17')](_0x19d56e);}};}function respondWithFilteredResult(_0x2dc3b2,_0x400db5){return function(_0x538df6){if(_0x538df6){var _0xb45dfe=typeof _0x400db5[_0xd39b('0x18')]===_0xd39b('0x19')&&typeof _0x400db5[_0xd39b('0x1a')]===_0xd39b('0x19');var _0x3983c2=_0x538df6[_0xd39b('0x1b')];var _0x420e35=_0xb45dfe?0x0:_0x400db5[_0xd39b('0x18')];var _0xcfa248=_0xb45dfe?_0x538df6[_0xd39b('0x1b')]:_0x400db5[_0xd39b('0x18')]+_0x400db5[_0xd39b('0x1a')];var _0x553990;if(_0xcfa248>=_0x3983c2){_0xcfa248=_0x3983c2;_0x553990=0xc8;}else{_0x553990=0xce;}_0x2dc3b2[_0xd39b('0x1c')](_0x553990);return _0x2dc3b2[_0xd39b('0x1d')](_0xd39b('0x1e'),_0x420e35+'-'+_0xcfa248+'/'+_0x3983c2)[_0xd39b('0x17')](_0x538df6);}return null;};}function patchUpdates(_0xeacd04){return function(_0x222361){try{jsonpatch[_0xd39b('0x1f')](_0x222361,_0xeacd04,!![]);}catch(_0xdbd4d2){return BPromise[_0xd39b('0x20')](_0xdbd4d2);}return _0x222361[_0xd39b('0x21')]();};}function saveUpdates(_0x45cb87,_0x526566){return function(_0x5330d6){if(_0x5330d6){return _0x5330d6[_0xd39b('0x22')](_0x45cb87)[_0xd39b('0x23')](function(_0x54e5b6){return _0x54e5b6;});}return null;};}function removeEntity(_0x3740fc,_0x30863e){return function(_0x158439){if(_0x158439){return _0x158439[_0xd39b('0x24')]()[_0xd39b('0x23')](function(){_0x3740fc[_0xd39b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55b7c0,_0x5dd4de){return function(_0x1abc53){if(!_0x1abc53){_0x55b7c0['sendStatus'](0x194);}return _0x1abc53;};}function handleError(_0x248e3b,_0x550adb){_0x550adb=_0x550adb||0x1f4;return function(_0x1c7d5e){logger[_0xd39b('0x25')](_0x1c7d5e[_0xd39b('0x26')]);if(_0x1c7d5e[_0xd39b('0x27')]){delete _0x1c7d5e['name'];}_0x248e3b[_0xd39b('0x1c')](_0x550adb)['send'](_0x1c7d5e);};}exports[_0xd39b('0x28')]=function(_0x4df728,_0x17a78b){var _0x3e1732={},_0x1ad96b={},_0x53580a={'count':0x0,'rows':[]};var _0x104563=_[_0xd39b('0x29')](db[_0xd39b('0x2a')]['rawAttributes'],function(_0x3e6a75){return{'name':_0x3e6a75['fieldName'],'type':_0x3e6a75[_0xd39b('0x2b')]['key']};});_0x1ad96b[_0xd39b('0x2c')]=_['map'](_0x104563,'name');_0x1ad96b[_0xd39b('0x2d')]=_[_0xd39b('0x2e')](_0x4df728[_0xd39b('0x2d')]);_0x1ad96b[_0xd39b('0x2f')]=_[_0xd39b('0x30')](_0x1ad96b[_0xd39b('0x2c')],_0x1ad96b[_0xd39b('0x2d')]);_0x3e1732[_0xd39b('0x31')]=_[_0xd39b('0x30')](_0x1ad96b[_0xd39b('0x2c')],qs[_0xd39b('0x32')](_0x4df728[_0xd39b('0x2d')][_0xd39b('0x32')]));_0x3e1732[_0xd39b('0x31')]=_0x3e1732['attributes']['length']?_0x3e1732[_0xd39b('0x31')]:_0x1ad96b[_0xd39b('0x2c')];if(!_0x4df728['query']['hasOwnProperty'](_0xd39b('0x33'))){_0x3e1732[_0xd39b('0x1a')]=qs[_0xd39b('0x1a')](_0x4df728[_0xd39b('0x2d')]['limit']);_0x3e1732[_0xd39b('0x18')]=qs[_0xd39b('0x18')](_0x4df728['query'][_0xd39b('0x18')]);}_0x3e1732['order']=qs[_0xd39b('0x34')](_0x4df728[_0xd39b('0x2d')][_0xd39b('0x34')]);_0x3e1732[_0xd39b('0x35')]=qs[_0xd39b('0x2f')](_[_0xd39b('0x36')](_0x4df728[_0xd39b('0x2d')],_0x1ad96b['filters']),_0x104563);if(_0x4df728[_0xd39b('0x2d')][_0xd39b('0x37')]){_0x3e1732['where']=_[_0xd39b('0x38')](_0x3e1732[_0xd39b('0x35')],{'$or':_[_0xd39b('0x29')](_0x104563,function(_0x1bdc2a){if(_0x1bdc2a[_0xd39b('0x2b')]!=='VIRTUAL'){var _0x5cd1f1={};_0x5cd1f1[_0x1bdc2a[_0xd39b('0x27')]]={'$like':'%'+_0x4df728[_0xd39b('0x2d')][_0xd39b('0x37')]+'%'};return _0x5cd1f1;}})});}_0x3e1732=_[_0xd39b('0x38')]({},_0x3e1732,_0x4df728[_0xd39b('0x39')]);var _0xd277bc={'where':_0x3e1732[_0xd39b('0x35')]};return db[_0xd39b('0x2a')][_0xd39b('0x1b')](_0xd277bc)['then'](function(_0x2cff11){_0x53580a['count']=_0x2cff11;if(_0x4df728[_0xd39b('0x2d')][_0xd39b('0x3a')]){_0x3e1732[_0xd39b('0x3b')]=[{'all':!![]}];}return db[_0xd39b('0x2a')][_0xd39b('0x3c')](_0x3e1732);})[_0xd39b('0x23')](function(_0x5ce2b4){_0x53580a[_0xd39b('0x3d')]=_0x5ce2b4;return _0x53580a;})[_0xd39b('0x23')](respondWithFilteredResult(_0x17a78b,_0x3e1732))[_0xd39b('0x3e')](handleError(_0x17a78b,null));};exports[_0xd39b('0x3f')]=function(_0x8a3624,_0x49d169){var _0x17c766={'raw':![],'where':{'id':_0x8a3624[_0xd39b('0x40')]['id']}},_0x2dd2a9={};_0x2dd2a9['model']=_[_0xd39b('0x2e')](db[_0xd39b('0x2a')][_0xd39b('0x41')]);_0x2dd2a9[_0xd39b('0x2d')]=_[_0xd39b('0x2e')](_0x8a3624['query']);_0x2dd2a9['filters']=_[_0xd39b('0x30')](_0x2dd2a9['model'],_0x2dd2a9[_0xd39b('0x2d')]);_0x17c766[_0xd39b('0x31')]=_['intersection'](_0x2dd2a9[_0xd39b('0x2c')],qs[_0xd39b('0x32')](_0x8a3624[_0xd39b('0x2d')][_0xd39b('0x32')]));_0x17c766['attributes']=_0x17c766['attributes'][_0xd39b('0x42')]?_0x17c766[_0xd39b('0x31')]:_0x2dd2a9[_0xd39b('0x2c')];if(_0x8a3624[_0xd39b('0x2d')][_0xd39b('0x3a')]){_0x17c766['include']=[{'all':!![]}];}_0x17c766=_[_0xd39b('0x38')]({},_0x17c766,_0x8a3624[_0xd39b('0x39')]);return db[_0xd39b('0x2a')]['find'](_0x17c766)['then'](handleEntityNotFound(_0x49d169,null))[_0xd39b('0x23')](respondWithResult(_0x49d169,null))[_0xd39b('0x3e')](handleError(_0x49d169,null));};exports[_0xd39b('0x43')]=function(_0x4f3911,_0x4ffb6f){return db['Automation'][_0xd39b('0x43')](_0x4f3911[_0xd39b('0x44')],{})[_0xd39b('0x23')](respondWithResult(_0x4ffb6f,0xc9))[_0xd39b('0x3e')](handleError(_0x4ffb6f,null));};exports[_0xd39b('0x22')]=function(_0x128c76,_0x4b3c37){if(_0x128c76['body']['id']){delete _0x128c76[_0xd39b('0x44')]['id'];}return db[_0xd39b('0x2a')][_0xd39b('0x45')]({'where':{'id':_0x128c76[_0xd39b('0x40')]['id']}})[_0xd39b('0x23')](handleEntityNotFound(_0x4b3c37,null))['then'](saveUpdates(_0x128c76[_0xd39b('0x44')],null))['then'](respondWithResult(_0x4b3c37,null))['catch'](handleError(_0x4b3c37,null));};exports[_0xd39b('0x24')]=function(_0x3e6757,_0x34dbff){return db[_0xd39b('0x2a')]['find']({'where':{'id':_0x3e6757[_0xd39b('0x40')]['id']}})[_0xd39b('0x23')](handleEntityNotFound(_0x34dbff,null))[_0xd39b('0x23')](removeEntity(_0x34dbff,null))[_0xd39b('0x3e')](handleError(_0x34dbff,null));};exports[_0xd39b('0x46')]=function(_0x1d44d2,_0x4724a6,_0x32713b){return db['Condition']['find']({'where':{'id':_0x1d44d2[_0xd39b('0x40')]['id']}})[_0xd39b('0x23')](handleEntityNotFound(_0x4724a6,null))['then'](function(_0x56358d){if(_0x56358d){return _0x56358d[_0xd39b('0x46')](_0x1d44d2[_0xd39b('0x44')][_0xd39b('0x47')],_[_0xd39b('0x48')](_0x1d44d2[_0xd39b('0x44')],[_0xd39b('0x47'),'id'])||{});}})['then'](respondWithResult(_0x4724a6,null))[_0xd39b('0x3e')](handleError(_0x4724a6,null));};exports[_0xd39b('0x49')]=function(_0x36441c,_0x794f28,_0x340b07){var _0x587b98={};var _0x5d5c3a={};var _0x45c05a;var _0x180196;return db[_0xd39b('0x2a')][_0xd39b('0x4a')]({'where':{'id':_0x36441c['params']['id']}})[_0xd39b('0x23')](handleEntityNotFound(_0x794f28,null))[_0xd39b('0x23')](function(_0x1af837){if(_0x1af837){_0x45c05a=_0x1af837;_0x5d5c3a[_0xd39b('0x2c')]=_[_0xd39b('0x2e')](db[_0xd39b('0x4b')][_0xd39b('0x41')]);_0x5d5c3a[_0xd39b('0x2d')]=_[_0xd39b('0x2e')](_0x36441c[_0xd39b('0x2d')]);_0x5d5c3a['filters']=_[_0xd39b('0x30')](_0x5d5c3a[_0xd39b('0x2c')],_0x5d5c3a[_0xd39b('0x2d')]);_0x587b98[_0xd39b('0x31')]=_['intersection'](_0x5d5c3a[_0xd39b('0x2c')],qs['fields'](_0x36441c[_0xd39b('0x2d')]['fields']));_0x587b98[_0xd39b('0x31')]=_0x587b98[_0xd39b('0x31')][_0xd39b('0x42')]?_0x587b98[_0xd39b('0x31')]:_0x5d5c3a[_0xd39b('0x2c')];_0x587b98[_0xd39b('0x4c')]=qs[_0xd39b('0x34')](_0x36441c[_0xd39b('0x2d')][_0xd39b('0x34')]);_0x587b98['where']=qs[_0xd39b('0x2f')](_[_0xd39b('0x36')](_0x36441c[_0xd39b('0x2d')],_0x5d5c3a[_0xd39b('0x2f')]));if(_0x36441c[_0xd39b('0x2d')]['filter']){_0x587b98[_0xd39b('0x35')]=_[_0xd39b('0x38')](_0x587b98[_0xd39b('0x35')],{'$or':_[_0xd39b('0x29')](_0x587b98[_0xd39b('0x31')],function(_0x3c77fc){var _0x38cfa4={};_0x38cfa4[_0x3c77fc]={'$like':'%'+_0x36441c[_0xd39b('0x2d')][_0xd39b('0x37')]+'%'};return _0x38cfa4;})});}_0x587b98=_[_0xd39b('0x38')]({},_0x587b98,_0x36441c[_0xd39b('0x39')]);return _0x45c05a[_0xd39b('0x49')](_0x587b98);}})[_0xd39b('0x23')](function(_0x165141){if(_0x165141){_0x180196=_0x165141['length'];if(!_0x36441c[_0xd39b('0x2d')][_0xd39b('0x4d')](_0xd39b('0x33'))){_0x587b98['limit']=qs[_0xd39b('0x1a')](_0x36441c[_0xd39b('0x2d')][_0xd39b('0x1a')]);_0x587b98['offset']=qs[_0xd39b('0x18')](_0x36441c[_0xd39b('0x2d')]['offset']);}return _0x45c05a[_0xd39b('0x49')](_0x587b98);}})['then'](function(_0xfe716d){if(_0xfe716d){return _0xfe716d?{'count':_0x180196,'rows':_0xfe716d}:null;}})[_0xd39b('0x23')](respondWithResult(_0x794f28,null))['catch'](handleError(_0x794f28,null));};exports[_0xd39b('0x4e')]=function(_0x5e6cf8,_0x4c4f1d,_0x4e2424){return db[_0xd39b('0x4f')]['find']({'where':{'id':_0x5e6cf8[_0xd39b('0x40')]['id']}})['then'](handleEntityNotFound(_0x4c4f1d,null))[_0xd39b('0x23')](function(_0x29a277){if(_0x29a277){return _0x29a277[_0xd39b('0x4e')](_0x5e6cf8[_0xd39b('0x44')][_0xd39b('0x47')],_['omit'](_0x5e6cf8[_0xd39b('0x44')],['ids','id'])||{});}})[_0xd39b('0x23')](respondWithResult(_0x4c4f1d,null))['catch'](handleError(_0x4c4f1d,null));};exports['getActions']=function(_0x3daa64,_0x211da8,_0x1b608d){var _0x8301a4={};var _0x7696fb={};var _0x4ac8ad;var _0x21d5b8;return db['Automation'][_0xd39b('0x4a')]({'where':{'id':_0x3daa64['params']['id']}})['then'](handleEntityNotFound(_0x211da8,null))[_0xd39b('0x23')](function(_0x2708a1){if(_0x2708a1){_0x4ac8ad=_0x2708a1;_0x7696fb[_0xd39b('0x2c')]=_[_0xd39b('0x2e')](db['Action'][_0xd39b('0x41')]);_0x7696fb['query']=_[_0xd39b('0x2e')](_0x3daa64['query']);_0x7696fb[_0xd39b('0x2f')]=_[_0xd39b('0x30')](_0x7696fb[_0xd39b('0x2c')],_0x7696fb[_0xd39b('0x2d')]);_0x8301a4[_0xd39b('0x31')]=_[_0xd39b('0x30')](_0x7696fb[_0xd39b('0x2c')],qs[_0xd39b('0x32')](_0x3daa64['query'][_0xd39b('0x32')]));_0x8301a4[_0xd39b('0x31')]=_0x8301a4[_0xd39b('0x31')][_0xd39b('0x42')]?_0x8301a4[_0xd39b('0x31')]:_0x7696fb[_0xd39b('0x2c')];_0x8301a4[_0xd39b('0x4c')]=qs['sort'](_0x3daa64['query'][_0xd39b('0x34')]);_0x8301a4[_0xd39b('0x35')]=qs[_0xd39b('0x2f')](_[_0xd39b('0x36')](_0x3daa64[_0xd39b('0x2d')],_0x7696fb[_0xd39b('0x2f')]));if(_0x3daa64[_0xd39b('0x2d')][_0xd39b('0x37')]){_0x8301a4['where']=_[_0xd39b('0x38')](_0x8301a4[_0xd39b('0x35')],{'$or':_['map'](_0x8301a4[_0xd39b('0x31')],function(_0x26735a){var _0x85a18={};_0x85a18[_0x26735a]={'$like':'%'+_0x3daa64['query'][_0xd39b('0x37')]+'%'};return _0x85a18;})});}_0x8301a4=_[_0xd39b('0x38')]({},_0x8301a4,_0x3daa64[_0xd39b('0x39')]);return _0x4ac8ad['getActions'](_0x8301a4);}})[_0xd39b('0x23')](function(_0x88e593){if(_0x88e593){_0x21d5b8=_0x88e593[_0xd39b('0x42')];if(!_0x3daa64[_0xd39b('0x2d')]['hasOwnProperty'](_0xd39b('0x33'))){_0x8301a4[_0xd39b('0x1a')]=qs[_0xd39b('0x1a')](_0x3daa64['query'][_0xd39b('0x1a')]);_0x8301a4[_0xd39b('0x18')]=qs[_0xd39b('0x18')](_0x3daa64[_0xd39b('0x2d')][_0xd39b('0x18')]);}return _0x4ac8ad[_0xd39b('0x50')](_0x8301a4);}})['then'](function(_0x2289cf){if(_0x2289cf){return _0x2289cf?{'count':_0x21d5b8,'rows':_0x2289cf}:null;}})[_0xd39b('0x23')](respondWithResult(_0x211da8,null))[_0xd39b('0x3e')](handleError(_0x211da8,null));}; \ No newline at end of file +var _0x1648=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','index','Automation','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','Condition','ids','omit','getConditions','findOne','addActions','Action','getActions'];(function(_0x2d070f,_0x3699e0){var _0x3256b4=function(_0x39ef1b){while(--_0x39ef1b){_0x2d070f['push'](_0x2d070f['shift']());}};_0x3256b4(++_0x3699e0);}(_0x1648,0x1ae));var _0x8164=function(_0x5e0e89,_0x803da4){_0x5e0e89=_0x5e0e89-0x0;var _0x3507d1=_0x1648[_0x5e0e89];return _0x3507d1;};'use strict';var emlformat=require(_0x8164('0x0'));var rimraf=require(_0x8164('0x1'));var zipdir=require(_0x8164('0x2'));var jsonpatch=require(_0x8164('0x3'));var rp=require(_0x8164('0x4'));var moment=require(_0x8164('0x5'));var BPromise=require(_0x8164('0x6'));var Mustache=require(_0x8164('0x7'));var util=require(_0x8164('0x8'));var path=require(_0x8164('0x9'));var sox=require('sox');var csv=require(_0x8164('0xa'));var ejs=require(_0x8164('0xb'));var fs=require('fs');var fs_extra=require(_0x8164('0xc'));var _=require(_0x8164('0xd'));var squel=require('squel');var crypto=require(_0x8164('0xe'));var jsforce=require(_0x8164('0xf'));var deskjs=require(_0x8164('0x10'));var toCsv=require(_0x8164('0xa'));var querystring=require(_0x8164('0x11'));var Papa=require(_0x8164('0x12'));var Redis=require(_0x8164('0x13'));var authService=require(_0x8164('0x14'));var qs=require(_0x8164('0x15'));var as=require(_0x8164('0x16'));var hardwareService=require(_0x8164('0x17'));var logger=require('../../config/logger')(_0x8164('0x18'));var utils=require('../../config/utils');var config=require(_0x8164('0x19'));var licenseUtil=require(_0x8164('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3dbc6e,_0x5be8bb){_0x5be8bb=_0x5be8bb||0xcc;return function(_0xf3995c){if(_0xf3995c){return _0x3dbc6e[_0x8164('0x1b')](_0x5be8bb);}return _0x3dbc6e['status'](_0x5be8bb)[_0x8164('0x1c')]();};}function respondWithResult(_0x5d0d9c,_0x4bfbfd){_0x4bfbfd=_0x4bfbfd||0xc8;return function(_0x2a9df6){if(_0x2a9df6){return _0x5d0d9c[_0x8164('0x1d')](_0x4bfbfd)[_0x8164('0x1e')](_0x2a9df6);}};}function respondWithFilteredResult(_0x4e88ab,_0x5088dd){return function(_0x34db53){if(_0x34db53){var _0x1bcc2e=typeof _0x5088dd[_0x8164('0x1f')]===_0x8164('0x20')&&typeof _0x5088dd[_0x8164('0x21')]===_0x8164('0x20');var _0x3921e8=_0x34db53[_0x8164('0x22')];var _0x8e6672=_0x1bcc2e?0x0:_0x5088dd[_0x8164('0x1f')];var _0x1962f8=_0x1bcc2e?_0x34db53[_0x8164('0x22')]:_0x5088dd[_0x8164('0x1f')]+_0x5088dd['limit'];var _0x4354cb;if(_0x1962f8>=_0x3921e8){_0x1962f8=_0x3921e8;_0x4354cb=0xc8;}else{_0x4354cb=0xce;}_0x4e88ab[_0x8164('0x1d')](_0x4354cb);return _0x4e88ab[_0x8164('0x23')](_0x8164('0x24'),_0x8e6672+'-'+_0x1962f8+'/'+_0x3921e8)[_0x8164('0x1e')](_0x34db53);}return null;};}function patchUpdates(_0x14fa70){return function(_0x2e13b7){try{jsonpatch[_0x8164('0x25')](_0x2e13b7,_0x14fa70,!![]);}catch(_0x2ee096){return BPromise[_0x8164('0x26')](_0x2ee096);}return _0x2e13b7['save']();};}function saveUpdates(_0x1bc432,_0x59f8ea){return function(_0x399e4b){if(_0x399e4b){return _0x399e4b['update'](_0x1bc432)[_0x8164('0x27')](function(_0x2d2243){return _0x2d2243;});}return null;};}function removeEntity(_0x5cad7f,_0x1ad7ab){return function(_0x18ee49){if(_0x18ee49){return _0x18ee49[_0x8164('0x28')]()[_0x8164('0x27')](function(){_0x5cad7f[_0x8164('0x1d')](0xcc)[_0x8164('0x1c')]();});}};}function handleEntityNotFound(_0x2a3a16,_0x15e935){return function(_0x4ab04c){if(!_0x4ab04c){_0x2a3a16[_0x8164('0x1b')](0x194);}return _0x4ab04c;};}function handleError(_0x4b3e2e,_0x4acbb8){_0x4acbb8=_0x4acbb8||0x1f4;return function(_0x5dccfc){logger[_0x8164('0x29')](_0x5dccfc[_0x8164('0x2a')]);if(_0x5dccfc['name']){delete _0x5dccfc[_0x8164('0x2b')];}_0x4b3e2e[_0x8164('0x1d')](_0x4acbb8)['send'](_0x5dccfc);};}exports[_0x8164('0x2c')]=function(_0x25b48e,_0x1673a3){var _0x4e48a4={},_0x34aa3d={},_0x2a0a85={'count':0x0,'rows':[]};var _0x6011f0=_['map'](db[_0x8164('0x2d')][_0x8164('0x2e')],function(_0x385f6d){return{'name':_0x385f6d[_0x8164('0x2f')],'type':_0x385f6d[_0x8164('0x30')][_0x8164('0x31')]};});_0x34aa3d[_0x8164('0x32')]=_[_0x8164('0x33')](_0x6011f0,_0x8164('0x2b'));_0x34aa3d[_0x8164('0x34')]=_[_0x8164('0x35')](_0x25b48e[_0x8164('0x34')]);_0x34aa3d['filters']=_['intersection'](_0x34aa3d[_0x8164('0x32')],_0x34aa3d[_0x8164('0x34')]);_0x4e48a4[_0x8164('0x36')]=_[_0x8164('0x37')](_0x34aa3d[_0x8164('0x32')],qs[_0x8164('0x38')](_0x25b48e[_0x8164('0x34')][_0x8164('0x38')]));_0x4e48a4[_0x8164('0x36')]=_0x4e48a4[_0x8164('0x36')][_0x8164('0x39')]?_0x4e48a4[_0x8164('0x36')]:_0x34aa3d[_0x8164('0x32')];if(!_0x25b48e[_0x8164('0x34')][_0x8164('0x3a')](_0x8164('0x3b'))){_0x4e48a4['limit']=qs[_0x8164('0x21')](_0x25b48e['query'][_0x8164('0x21')]);_0x4e48a4['offset']=qs[_0x8164('0x1f')](_0x25b48e['query'][_0x8164('0x1f')]);}_0x4e48a4[_0x8164('0x3c')]=qs[_0x8164('0x3d')](_0x25b48e['query'][_0x8164('0x3d')]);_0x4e48a4['where']=qs[_0x8164('0x3e')](_[_0x8164('0x3f')](_0x25b48e[_0x8164('0x34')],_0x34aa3d[_0x8164('0x3e')]),_0x6011f0);if(_0x25b48e[_0x8164('0x34')][_0x8164('0x40')]){_0x4e48a4[_0x8164('0x41')]=_[_0x8164('0x42')](_0x4e48a4[_0x8164('0x41')],{'$or':_[_0x8164('0x33')](_0x6011f0,function(_0x4f2c8b){if(_0x4f2c8b[_0x8164('0x30')]!==_0x8164('0x43')){var _0x1f7d64={};_0x1f7d64[_0x4f2c8b[_0x8164('0x2b')]]={'$like':'%'+_0x25b48e[_0x8164('0x34')]['filter']+'%'};return _0x1f7d64;}})});}_0x4e48a4=_[_0x8164('0x42')]({},_0x4e48a4,_0x25b48e['options']);var _0x4e5c88={'where':_0x4e48a4[_0x8164('0x41')]};return db[_0x8164('0x2d')]['count'](_0x4e5c88)[_0x8164('0x27')](function(_0x1bb6aa){_0x2a0a85[_0x8164('0x22')]=_0x1bb6aa;if(_0x25b48e[_0x8164('0x34')][_0x8164('0x44')]){_0x4e48a4[_0x8164('0x45')]=[{'all':!![]}];}return db[_0x8164('0x2d')][_0x8164('0x46')](_0x4e48a4);})['then'](function(_0xa67ccc){_0x2a0a85['rows']=_0xa67ccc;return _0x2a0a85;})[_0x8164('0x27')](respondWithFilteredResult(_0x1673a3,_0x4e48a4))[_0x8164('0x47')](handleError(_0x1673a3,null));};exports[_0x8164('0x48')]=function(_0x23f6e3,_0x165d93){var _0x131666={'raw':![],'where':{'id':_0x23f6e3[_0x8164('0x49')]['id']}},_0x2db101={};_0x2db101[_0x8164('0x32')]=_[_0x8164('0x35')](db[_0x8164('0x2d')]['rawAttributes']);_0x2db101[_0x8164('0x34')]=_[_0x8164('0x35')](_0x23f6e3[_0x8164('0x34')]);_0x2db101[_0x8164('0x3e')]=_['intersection'](_0x2db101[_0x8164('0x32')],_0x2db101[_0x8164('0x34')]);_0x131666[_0x8164('0x36')]=_[_0x8164('0x37')](_0x2db101[_0x8164('0x32')],qs[_0x8164('0x38')](_0x23f6e3[_0x8164('0x34')][_0x8164('0x38')]));_0x131666[_0x8164('0x36')]=_0x131666[_0x8164('0x36')][_0x8164('0x39')]?_0x131666[_0x8164('0x36')]:_0x2db101['model'];if(_0x23f6e3[_0x8164('0x34')][_0x8164('0x44')]){_0x131666[_0x8164('0x45')]=[{'all':!![]}];}_0x131666=_[_0x8164('0x42')]({},_0x131666,_0x23f6e3[_0x8164('0x4a')]);return db[_0x8164('0x2d')][_0x8164('0x4b')](_0x131666)[_0x8164('0x27')](handleEntityNotFound(_0x165d93,null))[_0x8164('0x27')](respondWithResult(_0x165d93,null))[_0x8164('0x47')](handleError(_0x165d93,null));};exports[_0x8164('0x4c')]=function(_0x2df690,_0x2f6e5d){return db[_0x8164('0x2d')][_0x8164('0x4c')](_0x2df690[_0x8164('0x4d')],{})[_0x8164('0x27')](respondWithResult(_0x2f6e5d,0xc9))[_0x8164('0x47')](handleError(_0x2f6e5d,null));};exports['update']=function(_0x1ab7b6,_0x2ebe55){if(_0x1ab7b6[_0x8164('0x4d')]['id']){delete _0x1ab7b6[_0x8164('0x4d')]['id'];}return db[_0x8164('0x2d')][_0x8164('0x4b')]({'where':{'id':_0x1ab7b6[_0x8164('0x49')]['id']}})['then'](handleEntityNotFound(_0x2ebe55,null))['then'](saveUpdates(_0x1ab7b6[_0x8164('0x4d')],null))[_0x8164('0x27')](respondWithResult(_0x2ebe55,null))[_0x8164('0x47')](handleError(_0x2ebe55,null));};exports['destroy']=function(_0xcd2994,_0x2e06e2){return db[_0x8164('0x2d')]['find']({'where':{'id':_0xcd2994['params']['id']}})['then'](handleEntityNotFound(_0x2e06e2,null))[_0x8164('0x27')](removeEntity(_0x2e06e2,null))['catch'](handleError(_0x2e06e2,null));};exports['addConditions']=function(_0x2ed678,_0x2cdc99,_0x358c4c){return db[_0x8164('0x4e')]['find']({'where':{'id':_0x2ed678[_0x8164('0x49')]['id']}})[_0x8164('0x27')](handleEntityNotFound(_0x2cdc99,null))[_0x8164('0x27')](function(_0x29b09f){if(_0x29b09f){return _0x29b09f['addConditions'](_0x2ed678[_0x8164('0x4d')][_0x8164('0x4f')],_[_0x8164('0x50')](_0x2ed678[_0x8164('0x4d')],[_0x8164('0x4f'),'id'])||{});}})[_0x8164('0x27')](respondWithResult(_0x2cdc99,null))[_0x8164('0x47')](handleError(_0x2cdc99,null));};exports[_0x8164('0x51')]=function(_0x126d37,_0x53a76f,_0x2b22ec){var _0x1281a9={};var _0x5b8c94={};var _0x279318;var _0x6ce563;return db[_0x8164('0x2d')][_0x8164('0x52')]({'where':{'id':_0x126d37['params']['id']}})[_0x8164('0x27')](handleEntityNotFound(_0x53a76f,null))['then'](function(_0x24d3ad){if(_0x24d3ad){_0x279318=_0x24d3ad;_0x5b8c94[_0x8164('0x32')]=_[_0x8164('0x35')](db['Condition'][_0x8164('0x2e')]);_0x5b8c94['query']=_[_0x8164('0x35')](_0x126d37[_0x8164('0x34')]);_0x5b8c94[_0x8164('0x3e')]=_['intersection'](_0x5b8c94[_0x8164('0x32')],_0x5b8c94[_0x8164('0x34')]);_0x1281a9['attributes']=_[_0x8164('0x37')](_0x5b8c94[_0x8164('0x32')],qs['fields'](_0x126d37['query'][_0x8164('0x38')]));_0x1281a9[_0x8164('0x36')]=_0x1281a9[_0x8164('0x36')][_0x8164('0x39')]?_0x1281a9['attributes']:_0x5b8c94[_0x8164('0x32')];_0x1281a9['order']=qs['sort'](_0x126d37['query'][_0x8164('0x3d')]);_0x1281a9[_0x8164('0x41')]=qs[_0x8164('0x3e')](_['pick'](_0x126d37[_0x8164('0x34')],_0x5b8c94[_0x8164('0x3e')]));if(_0x126d37[_0x8164('0x34')][_0x8164('0x40')]){_0x1281a9['where']=_[_0x8164('0x42')](_0x1281a9[_0x8164('0x41')],{'$or':_['map'](_0x1281a9[_0x8164('0x36')],function(_0x52cc2c){var _0x513622={};_0x513622[_0x52cc2c]={'$like':'%'+_0x126d37[_0x8164('0x34')][_0x8164('0x40')]+'%'};return _0x513622;})});}_0x1281a9=_[_0x8164('0x42')]({},_0x1281a9,_0x126d37[_0x8164('0x4a')]);return _0x279318[_0x8164('0x51')](_0x1281a9);}})['then'](function(_0x347b02){if(_0x347b02){_0x6ce563=_0x347b02[_0x8164('0x39')];if(!_0x126d37['query']['hasOwnProperty'](_0x8164('0x3b'))){_0x1281a9[_0x8164('0x21')]=qs['limit'](_0x126d37[_0x8164('0x34')][_0x8164('0x21')]);_0x1281a9['offset']=qs[_0x8164('0x1f')](_0x126d37[_0x8164('0x34')][_0x8164('0x1f')]);}return _0x279318['getConditions'](_0x1281a9);}})[_0x8164('0x27')](function(_0x554ac6){if(_0x554ac6){return _0x554ac6?{'count':_0x6ce563,'rows':_0x554ac6}:null;}})[_0x8164('0x27')](respondWithResult(_0x53a76f,null))['catch'](handleError(_0x53a76f,null));};exports[_0x8164('0x53')]=function(_0x23301c,_0x2ac4ca,_0x2c8c0d){return db[_0x8164('0x54')]['find']({'where':{'id':_0x23301c[_0x8164('0x49')]['id']}})[_0x8164('0x27')](handleEntityNotFound(_0x2ac4ca,null))['then'](function(_0x104f6a){if(_0x104f6a){return _0x104f6a[_0x8164('0x53')](_0x23301c[_0x8164('0x4d')][_0x8164('0x4f')],_[_0x8164('0x50')](_0x23301c[_0x8164('0x4d')],[_0x8164('0x4f'),'id'])||{});}})[_0x8164('0x27')](respondWithResult(_0x2ac4ca,null))[_0x8164('0x47')](handleError(_0x2ac4ca,null));};exports[_0x8164('0x55')]=function(_0x32dee8,_0x115630,_0x315c22){var _0x36dcef={};var _0x59ebdc={};var _0x34ce71;var _0x1671aa;return db['Automation'][_0x8164('0x52')]({'where':{'id':_0x32dee8[_0x8164('0x49')]['id']}})[_0x8164('0x27')](handleEntityNotFound(_0x115630,null))[_0x8164('0x27')](function(_0x561d42){if(_0x561d42){_0x34ce71=_0x561d42;_0x59ebdc['model']=_[_0x8164('0x35')](db[_0x8164('0x54')][_0x8164('0x2e')]);_0x59ebdc[_0x8164('0x34')]=_[_0x8164('0x35')](_0x32dee8['query']);_0x59ebdc[_0x8164('0x3e')]=_[_0x8164('0x37')](_0x59ebdc['model'],_0x59ebdc[_0x8164('0x34')]);_0x36dcef[_0x8164('0x36')]=_[_0x8164('0x37')](_0x59ebdc['model'],qs[_0x8164('0x38')](_0x32dee8[_0x8164('0x34')][_0x8164('0x38')]));_0x36dcef[_0x8164('0x36')]=_0x36dcef['attributes']['length']?_0x36dcef[_0x8164('0x36')]:_0x59ebdc['model'];_0x36dcef[_0x8164('0x3c')]=qs[_0x8164('0x3d')](_0x32dee8[_0x8164('0x34')][_0x8164('0x3d')]);_0x36dcef[_0x8164('0x41')]=qs[_0x8164('0x3e')](_[_0x8164('0x3f')](_0x32dee8[_0x8164('0x34')],_0x59ebdc[_0x8164('0x3e')]));if(_0x32dee8[_0x8164('0x34')]['filter']){_0x36dcef['where']=_[_0x8164('0x42')](_0x36dcef[_0x8164('0x41')],{'$or':_[_0x8164('0x33')](_0x36dcef[_0x8164('0x36')],function(_0x57ac3c){var _0x4aae87={};_0x4aae87[_0x57ac3c]={'$like':'%'+_0x32dee8[_0x8164('0x34')]['filter']+'%'};return _0x4aae87;})});}_0x36dcef=_[_0x8164('0x42')]({},_0x36dcef,_0x32dee8[_0x8164('0x4a')]);return _0x34ce71[_0x8164('0x55')](_0x36dcef);}})[_0x8164('0x27')](function(_0x40d25a){if(_0x40d25a){_0x1671aa=_0x40d25a[_0x8164('0x39')];if(!_0x32dee8[_0x8164('0x34')][_0x8164('0x3a')](_0x8164('0x3b'))){_0x36dcef[_0x8164('0x21')]=qs[_0x8164('0x21')](_0x32dee8[_0x8164('0x34')][_0x8164('0x21')]);_0x36dcef[_0x8164('0x1f')]=qs[_0x8164('0x1f')](_0x32dee8['query'][_0x8164('0x1f')]);}return _0x34ce71[_0x8164('0x55')](_0x36dcef);}})[_0x8164('0x27')](function(_0x1737bb){if(_0x1737bb){return _0x1737bb?{'count':_0x1671aa,'rows':_0x1737bb}:null;}})[_0x8164('0x27')](respondWithResult(_0x115630,null))[_0x8164('0x47')](handleError(_0x115630,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 8667221..b2a3739 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 _0xadcb=['./automation.attributes','exports','define','tools_automations','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5cc993,_0x498f74){var _0x5bfbd0=function(_0x35ae1f){while(--_0x35ae1f){_0x5cc993['push'](_0x5cc993['shift']());}};_0x5bfbd0(++_0x498f74);}(_0xadcb,0xb4));var _0xbadc=function(_0x50319c,_0x332402){_0x50319c=_0x50319c-0x0;var _0x20f96e=_0xadcb[_0x50319c];return _0x20f96e;};'use strict';var _=require('lodash');var util=require(_0xbadc('0x0'));var logger=require('../../config/logger')(_0xbadc('0x1'));var moment=require(_0xbadc('0x2'));var BPromise=require(_0xbadc('0x3'));var rp=require(_0xbadc('0x4'));var fs=require('fs');var path=require(_0xbadc('0x5'));var rimraf=require('rimraf');var config=require(_0xbadc('0x6'));var attributes=require(_0xbadc('0x7'));module[_0xbadc('0x8')]=function(_0x36f30f,_0x1b9ac5){return _0x36f30f[_0xbadc('0x9')]('Automation',attributes,{'tableName':_0xbadc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea38=['moment','bluebird','request-promise','path','./automation.attributes','define','Automation','lodash','util','../../config/logger'];(function(_0x442f02,_0x47d845){var _0xab6ef1=function(_0x4cad5c){while(--_0x4cad5c){_0x442f02['push'](_0x442f02['shift']());}};_0xab6ef1(++_0x47d845);}(_0xea38,0x1d3));var _0x8ea3=function(_0x3e85ac,_0x1db7ae){_0x3e85ac=_0x3e85ac-0x0;var _0x145c9f=_0xea38[_0x3e85ac];return _0x145c9f;};'use strict';var _=require(_0x8ea3('0x0'));var util=require(_0x8ea3('0x1'));var logger=require(_0x8ea3('0x2'))('api');var moment=require(_0x8ea3('0x3'));var BPromise=require(_0x8ea3('0x4'));var rp=require(_0x8ea3('0x5'));var fs=require('fs');var path=require(_0x8ea3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8ea3('0x7'));module['exports']=function(_0x4b35c1,_0x527556){return _0x4b35c1[_0x8ea3('0x8')](_0x8ea3('0x9'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index fbc74a0..740f012 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 _0x414f=['then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x414f,0x13f));var _0xf414=function(_0x3ea3ae,_0x29dd29){_0x3ea3ae=_0x3ea3ae-0x0;var _0x2aa587=_0x414f[_0x3ea3ae];return _0x2aa587;};'use strict';var _=require(_0xf414('0x0'));var util=require('util');var moment=require(_0xf414('0x1'));var BPromise=require(_0xf414('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf414('0x3'));var db=require(_0xf414('0x4'))['db'];var utils=require(_0xf414('0x5'));var logger=require(_0xf414('0x6'))(_0xf414('0x7'));var config=require(_0xf414('0x8'));var jayson=require(_0xf414('0x9'));var client=jayson['client'][_0xf414('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cdcdb,_0x34c4d0,_0x2306e5){return new BPromise(function(_0xad732,_0x5194e5){return client['request'](_0x4cdcdb,_0x2306e5)[_0xf414('0xb')](function(_0x2bbf01){logger[_0xf414('0xc')](_0xf414('0xd'),_0x34c4d0,_0xf414('0xe'));logger[_0xf414('0xf')](_0xf414('0x10'),_0x34c4d0,_0xf414('0xe'),JSON['stringify'](_0x2bbf01));if(_0x2bbf01['error']){if(_0x2bbf01[_0xf414('0x11')][_0xf414('0x12')]===0x1f4){logger[_0xf414('0x11')](_0xf414('0xd'),_0x34c4d0,_0x2bbf01[_0xf414('0x11')]['message']);return _0x5194e5(_0x2bbf01[_0xf414('0x11')][_0xf414('0x13')]);}logger[_0xf414('0x11')](_0xf414('0xd'),_0x34c4d0,_0x2bbf01[_0xf414('0x11')]['message']);return _0xad732(_0x2bbf01[_0xf414('0x11')][_0xf414('0x13')]);}else{logger[_0xf414('0xc')](_0xf414('0xd'),_0x34c4d0,_0xf414('0xe'));_0xad732(_0x2bbf01[_0xf414('0x14')][_0xf414('0x13')]);}})[_0xf414('0x15')](function(_0x483e29){logger[_0xf414('0x11')](_0xf414('0xd'),_0x34c4d0,_0x483e29);_0x5194e5(_0x483e29);});});} \ 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','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x0b63,0xe7));var _0x30b6=function(_0x55e3e6,_0x27eb66){_0x55e3e6=_0x55e3e6-0x0;var _0x42e3d9=_0x0b63[_0x55e3e6];return _0x42e3d9;};'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']('Automation,\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/automation/index.js b/server/api/automation/index.js index aa038fa..af6ff09 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 _0xc903=['exports','multer','path','Router','../../components/auth/service','../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','show','/:id/conditions','getConditions','post','create','addConditions','/:id/actions','addActions','put','update','delete'];(function(_0xd23074,_0x9576e3){var _0x2eeb0f=function(_0x205a0a){while(--_0x205a0a){_0xd23074['push'](_0xd23074['shift']());}};_0x2eeb0f(++_0x9576e3);}(_0xc903,0x177));var _0x3c90=function(_0x2bcb75,_0x5789a7){_0x2bcb75=_0x2bcb75-0x0;var _0x175345=_0xc903[_0x2bcb75];return _0x175345;};'use strict';var multer=require(_0x3c90('0x0'));var util=require('util');var path=require(_0x3c90('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3c90('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3c90('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3c90('0x4'));var controller=require(_0x3c90('0x5'));router['get']('/',auth[_0x3c90('0x6')](),controller[_0x3c90('0x7')]);router[_0x3c90('0x8')](_0x3c90('0x9'),auth[_0x3c90('0x6')](),controller[_0x3c90('0xa')]);router[_0x3c90('0x8')](_0x3c90('0xb'),auth[_0x3c90('0x6')](),controller[_0x3c90('0xc')]);router['get']('/:id/actions',auth['isAuthenticated'](),controller['getActions']);router[_0x3c90('0xd')]('/',auth[_0x3c90('0x6')](),controller[_0x3c90('0xe')]);router[_0x3c90('0xd')]('/:id/conditions',auth[_0x3c90('0x6')](),controller[_0x3c90('0xf')]);router[_0x3c90('0xd')](_0x3c90('0x10'),auth[_0x3c90('0x6')](),controller[_0x3c90('0x11')]);router[_0x3c90('0x12')](_0x3c90('0x9'),auth['isAuthenticated'](),controller[_0x3c90('0x13')]);router[_0x3c90('0x14')](_0x3c90('0x9'),auth[_0x3c90('0x6')](),controller['destroy']);module[_0x3c90('0x15')]=router; \ No newline at end of file +var _0xc964=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','post','create','/:id/actions','update','destroy','exports'];(function(_0x2302a1,_0x4bc33d){var _0x413cae=function(_0x233632){while(--_0x233632){_0x2302a1['push'](_0x2302a1['shift']());}};_0x413cae(++_0x4bc33d);}(_0xc964,0x7e));var _0x4c96=function(_0x4d06ae,_0x45c1cc){_0x4d06ae=_0x4d06ae-0x0;var _0x274277=_0xc964[_0x4d06ae];return _0x274277;};'use strict';var multer=require(_0x4c96('0x0'));var util=require(_0x4c96('0x1'));var path=require('path');var timeout=require(_0x4c96('0x2'));var express=require(_0x4c96('0x3'));var router=express[_0x4c96('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4c96('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4c96('0x6'));var controller=require(_0x4c96('0x7'));router[_0x4c96('0x8')]('/',auth[_0x4c96('0x9')](),controller[_0x4c96('0xa')]);router[_0x4c96('0x8')](_0x4c96('0xb'),auth['isAuthenticated'](),controller[_0x4c96('0xc')]);router[_0x4c96('0x8')](_0x4c96('0xd'),auth['isAuthenticated'](),controller[_0x4c96('0xe')]);router[_0x4c96('0x8')]('/:id/actions',auth['isAuthenticated'](),controller['getActions']);router[_0x4c96('0xf')]('/',auth[_0x4c96('0x9')](),controller[_0x4c96('0x10')]);router['post'](_0x4c96('0xd'),auth['isAuthenticated'](),controller['addConditions']);router[_0x4c96('0xf')](_0x4c96('0x11'),auth[_0x4c96('0x9')](),controller['addActions']);router['put'](_0x4c96('0xb'),auth[_0x4c96('0x9')](),controller[_0x4c96('0x12')]);router['delete'](_0x4c96('0xb'),auth[_0x4c96('0x9')](),controller[_0x4c96('0x13')]);module[_0x4c96('0x14')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index e5f0b44..3c5f429 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 _0xaffb=['#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','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\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)','sequelize','exports','name','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xaffb,0xc3));var _0xbaff=function(_0x2bd88d,_0x2d5dc3){_0x2bd88d=_0x2bd88d-0x0;var _0x5516d4=_0xaffb[_0x2bd88d];return _0x5516d4;};'use strict';var Sequelize=require(_0xbaff('0x0'));module[_0xbaff('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xbaff('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xbaff('0x3')]('ivr'),'allowNull':![],'defaultValue':_0xbaff('0x4')},'description':{'type':Sequelize[_0xbaff('0x5')]},'active':{'type':Sequelize[_0xbaff('0x6')],'defaultValue':0x0,'comment':_0xbaff('0x7')},'limitCalls':{'type':Sequelize[_0xbaff('0x8')](0x4)[_0xbaff('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xbaff('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0xbaff('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xbaff('0x8')](0x3)[_0xbaff('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbaff('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0xbaff('0x8')](0x3)[_0xbaff('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbaff('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xbaff('0x8')](0x5)[_0xbaff('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbaff('0xd')},'dialBusyMaxRetry':{'type':Sequelize[_0xbaff('0x8')](0x3)[_0xbaff('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbaff('0xe')},'dialBusyRetryFrequency':{'type':Sequelize[_0xbaff('0x8')](0x5)[_0xbaff('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbaff('0xf')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xbaff('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbaff('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0xbaff('0x8')](0x3)[_0xbaff('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xbaff('0x11')},'dialTimezone':{'type':Sequelize[_0xbaff('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xbaff('0x12')},'dialCheckDuplicateType':{'type':Sequelize[_0xbaff('0x3')](_0xbaff('0x13'),_0xbaff('0x14'),_0xbaff('0x15')),'defaultValue':_0xbaff('0x13')},'dialAMDActive':{'type':Sequelize[_0xbaff('0x6')],'defaultValue':0x0,'comment':_0xbaff('0x16')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xbaff('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xbaff('0x17')},'dialAMDGreeting':{'type':Sequelize[_0xbaff('0x8')](0x9)[_0xbaff('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xbaff('0x18')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xbaff('0x8')](0x9)[_0xbaff('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xbaff('0x19')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xbaff('0x8')](0x9)[_0xbaff('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbaff('0x1a')},'dialAMDMinWordLength':{'type':Sequelize[_0xbaff('0x8')](0x9)[_0xbaff('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xbaff('0x1b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xbaff('0x8')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xbaff('0x1c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xbaff('0x1d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xbaff('0x8')](0x5)[_0xbaff('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xbaff('0x1e')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xbaff('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbaff('0x1f')},'dialOrderByScheduledAt':{'type':Sequelize[_0xbaff('0x3')](_0xbaff('0x20'),_0xbaff('0x21')),'defaultValue':_0xbaff('0x20')},'dialPrefix':{'type':Sequelize[_0xbaff('0x5')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xbaff('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xbaff('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbaff('0x22')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xbaff('0x8')](0x3)[_0xbaff('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbaff('0x23')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xbaff('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbaff('0x24')},'dialDropMaxRetry':{'type':Sequelize[_0xbaff('0x8')](0x3)[_0xbaff('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbaff('0x25')},'dialDropRetryFrequency':{'type':Sequelize[_0xbaff('0x8')](0x5)[_0xbaff('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbaff('0x26')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xbaff('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xbaff('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbaff('0x27')},'dialMachineMaxRetry':{'type':Sequelize[_0xbaff('0x8')](0x3)[_0xbaff('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbaff('0x28')},'dialMachineRetryFrequency':{'type':Sequelize[_0xbaff('0x8')](0x5)[_0xbaff('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbaff('0x29')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xbaff('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbaff('0x2a')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xbaff('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbaff('0x2b')}}; \ No newline at end of file +var _0x070f=['STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','ENUM','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','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)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','ivr'];(function(_0x35d29a,_0x10dc25){var _0x17ef40=function(_0x24f55a){while(--_0x24f55a){_0x35d29a['push'](_0x35d29a['shift']());}};_0x17ef40(++_0x10dc25);}(_0x070f,0x15b));var _0xf070=function(_0x3f96b2,_0x458834){_0x3f96b2=_0x3f96b2-0x0;var _0x10fa16=_0x070f[_0x3f96b2];return _0x10fa16;};'use strict';var Sequelize=require(_0xf070('0x0'));module[_0xf070('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':_0xf070('0x2')},'description':{'type':Sequelize[_0xf070('0x3')]},'active':{'type':Sequelize[_0xf070('0x4')],'defaultValue':0x0,'comment':_0xf070('0x5')},'limitCalls':{'type':Sequelize[_0xf070('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xf070('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0xf070('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xf070('0x3')]},'dialOriginateTimeout':{'type':Sequelize[_0xf070('0x6')](0x3)[_0xf070('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf070('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xf070('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf070('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf070('0x6')](0x5)[_0xf070('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf070('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xf070('0x6')](0x3)[_0xf070('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf070('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xf070('0x6')](0x5)[_0xf070('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf070('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xf070('0x6')](0x3)[_0xf070('0x8')],'defaultValue':0x3,'comment':_0xf070('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf070('0x6')](0x5)[_0xf070('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf070('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0xf070('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xf070('0x3')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xf070('0x3')],'defaultValue':_0xf070('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xf070('0x11')](_0xf070('0x12'),'never','onlyIfOpen'),'defaultValue':_0xf070('0x12')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xf070('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xf070('0x6')](0x9)[_0xf070('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xf070('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xf070('0x6')](0x9)[_0xf070('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xf070('0x6')](0x9)[_0xf070('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf070('0x6')](0x9)[_0xf070('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf070('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0xf070('0x6')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xf070('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xf070('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf070('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xf070('0x6')](0x9)[_0xf070('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xf070('0x6')](0x5)[_0xf070('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xf070('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xf070('0x6')](0x9)[_0xf070('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf070('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0xf070('0x11')]('DESC',_0xf070('0x1a')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xf070('0x6')](0x3)[_0xf070('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xf070('0x6')](0x3)[_0xf070('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf070('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xf070('0x6')](0x3)[_0xf070('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf070('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf070('0x1c')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf070('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf070('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0xf070('0x6')](0x5)[_0xf070('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf070('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf070('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xf070('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf070('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0xf070('0x6')](0x3)[_0xf070('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xf070('0x6')](0x5)[_0xf070('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf070('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf070('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xf070('0x6')](0x5)[_0xf070('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf070('0x22')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index ce537e5..1666297 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 _0x094c=['sequelize','all','removeBlackLists','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','UserProfileResource','destroy','end','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','merge','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','update','getHoppers','findOne','CmHopper','sort','pick','filter','getHopperHistories','CmHopperHistory','CmHopperFinal','CampaignId','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','insert','cm_hopper','fromQuery','ContactId','ListId','field','phone','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','select','COALESCE(phone,\x27\x27)','onlyIfOpen','into','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','push'];(function(_0x2d2460,_0x33a7d5){var _0x4cf86a=function(_0x165a2f){while(--_0x165a2f){_0x2d2460['push'](_0x2d2460['shift']());}};_0x4cf86a(++_0x33a7d5);}(_0x094c,0x131));var _0xc094=function(_0x239b5e,_0x208a3f){_0x239b5e=_0x239b5e-0x0;var _0x577f3d=_0x094c[_0x239b5e];return _0x577f3d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc094('0x0'));var zipdir=require(_0xc094('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc094('0x2'));var moment=require(_0xc094('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc094('0x4'));var util=require(_0xc094('0x5'));var path=require(_0xc094('0x6'));var sox=require(_0xc094('0x7'));var csv=require(_0xc094('0x8'));var ejs=require(_0xc094('0x9'));var fs=require('fs');var fs_extra=require(_0xc094('0xa'));var _=require('lodash');var squel=require(_0xc094('0xb'));var crypto=require('crypto');var jsforce=require(_0xc094('0xc'));var deskjs=require(_0xc094('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc094('0xe'));var Papa=require(_0xc094('0xf'));var Redis=require(_0xc094('0x10'));var authService=require(_0xc094('0x11'));var qs=require(_0xc094('0x12'));var as=require(_0xc094('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc094('0x14'))(_0xc094('0x15'));var utils=require(_0xc094('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc094('0x17'))['db'];function respondWithStatusCode(_0x453ed2,_0x384005){_0x384005=_0x384005||0xcc;return function(_0x458315){if(_0x458315){return _0x453ed2[_0xc094('0x18')](_0x384005);}return _0x453ed2[_0xc094('0x19')](_0x384005)['end']();};}function respondWithResult(_0x425f56,_0x5dee69){_0x5dee69=_0x5dee69||0xc8;return function(_0x3c47f6){if(_0x3c47f6){return _0x425f56[_0xc094('0x19')](_0x5dee69)[_0xc094('0x1a')](_0x3c47f6);}};}function respondWithFilteredResult(_0x43625e,_0x188418){return function(_0x147dc9){if(_0x147dc9){var _0x3b6fe2=typeof _0x188418[_0xc094('0x1b')]===_0xc094('0x1c')&&typeof _0x188418[_0xc094('0x1d')]==='undefined';var _0x5bde5d=_0x147dc9[_0xc094('0x1e')];var _0x384170=_0x3b6fe2?0x0:_0x188418[_0xc094('0x1b')];var _0x3290d4=_0x3b6fe2?_0x147dc9['count']:_0x188418[_0xc094('0x1b')]+_0x188418['limit'];var _0x3eec46;if(_0x3290d4>=_0x5bde5d){_0x3290d4=_0x5bde5d;_0x3eec46=0xc8;}else{_0x3eec46=0xce;}_0x43625e[_0xc094('0x19')](_0x3eec46);return _0x43625e[_0xc094('0x1f')](_0xc094('0x20'),_0x384170+'-'+_0x3290d4+'/'+_0x5bde5d)[_0xc094('0x1a')](_0x147dc9);}return null;};}function patchUpdates(_0x97dba8){return function(_0x5e2cc8){try{jsonpatch[_0xc094('0x21')](_0x5e2cc8,_0x97dba8,!![]);}catch(_0x54c1a9){return BPromise[_0xc094('0x22')](_0x54c1a9);}return _0x5e2cc8[_0xc094('0x23')]();};}function saveUpdates(_0x4d814d,_0x5bbc42){return function(_0x321bb3){if(_0x321bb3){return _0x321bb3['update'](_0x4d814d)[_0xc094('0x24')](function(_0x17f044){return _0x17f044;});}return null;};}function removeEntity(_0x249a32,_0x228b93){return function(_0x364ede){if(_0x364ede){return _0x364ede['destroy']()['then'](function(){var _0x59f5a6=_0x364ede['get']({'plain':!![]});var _0xa85298='IvrCampaigns';return db[_0xc094('0x25')][_0xc094('0x26')]({'where':{'type':_0xa85298,'resourceId':_0x59f5a6['id']}})[_0xc094('0x24')](function(){return _0x364ede;});})[_0xc094('0x24')](function(){_0x249a32[_0xc094('0x19')](0xcc)[_0xc094('0x27')]();});}};}function handleEntityNotFound(_0x1f9675,_0xaa6ff0){return function(_0x1000e6){if(!_0x1000e6){_0x1f9675[_0xc094('0x18')](0x194);}return _0x1000e6;};}function handleError(_0x5a92d8,_0x203f94){_0x203f94=_0x203f94||0x1f4;return function(_0x1936f3){logger['error'](_0x1936f3[_0xc094('0x28')]);if(_0x1936f3[_0xc094('0x29')]){delete _0x1936f3[_0xc094('0x29')];}_0x5a92d8[_0xc094('0x19')](_0x203f94)[_0xc094('0x2a')](_0x1936f3);};}exports[_0xc094('0x2b')]=function(_0x23790f,_0x27614c){var _0x5090e3={},_0xb267a4={},_0x56ef51={'count':0x0,'rows':[]};var _0x5bf460=_[_0xc094('0x2c')](db[_0xc094('0x2d')][_0xc094('0x2e')],function(_0x421b78){return{'name':_0x421b78[_0xc094('0x2f')],'type':_0x421b78[_0xc094('0x30')][_0xc094('0x31')]};});_0xb267a4['model']=_['map'](_0x5bf460,_0xc094('0x29'));_0xb267a4[_0xc094('0x32')]=_['keys'](_0x23790f['query']);_0xb267a4[_0xc094('0x33')]=_[_0xc094('0x34')](_0xb267a4['model'],_0xb267a4[_0xc094('0x32')]);_0x5090e3['attributes']=_[_0xc094('0x34')](_0xb267a4[_0xc094('0x35')],qs[_0xc094('0x36')](_0x23790f[_0xc094('0x32')][_0xc094('0x36')]));_0x5090e3['attributes']=_0x5090e3[_0xc094('0x37')][_0xc094('0x38')]?_0x5090e3['attributes']:_0xb267a4[_0xc094('0x35')];if(!_0x23790f[_0xc094('0x32')][_0xc094('0x39')](_0xc094('0x3a'))){_0x5090e3[_0xc094('0x1d')]=qs[_0xc094('0x1d')](_0x23790f[_0xc094('0x32')]['limit']);_0x5090e3['offset']=qs[_0xc094('0x1b')](_0x23790f[_0xc094('0x32')][_0xc094('0x1b')]);}_0x5090e3[_0xc094('0x3b')]=qs['sort'](_0x23790f[_0xc094('0x32')]['sort']);_0x5090e3['where']=qs['filters'](_['pick'](_0x23790f[_0xc094('0x32')],_0xb267a4[_0xc094('0x33')]),_0x5bf460);if(_0x23790f['query']['filter']){_0x5090e3[_0xc094('0x3c')]=_[_0xc094('0x3d')](_0x5090e3[_0xc094('0x3c')],{'$or':_['map'](_0x5bf460,function(_0x484e63){if(_0x484e63[_0xc094('0x30')]!=='VIRTUAL'){var _0x2337c3={};_0x2337c3[_0x484e63[_0xc094('0x29')]]={'$like':'%'+_0x23790f[_0xc094('0x32')]['filter']+'%'};return _0x2337c3;}})});}_0x5090e3=_[_0xc094('0x3d')]({},_0x5090e3,_0x23790f[_0xc094('0x3e')]);var _0x299494={'where':_0x5090e3[_0xc094('0x3c')]};return db['Campaign'][_0xc094('0x1e')](_0x299494)[_0xc094('0x24')](function(_0x109a09){_0x56ef51[_0xc094('0x1e')]=_0x109a09;if(_0x23790f[_0xc094('0x32')][_0xc094('0x3f')]){_0x5090e3[_0xc094('0x40')]=[{'all':!![]}];}return db['Campaign'][_0xc094('0x41')](_0x5090e3);})['then'](function(_0x5082df){_0x56ef51[_0xc094('0x42')]=_0x5082df;return _0x56ef51;})['then'](respondWithFilteredResult(_0x27614c,_0x5090e3))[_0xc094('0x43')](handleError(_0x27614c,null));};exports[_0xc094('0x44')]=function(_0x43600e,_0x1c97e6){var _0x388e76={'raw':![],'where':{'id':_0x43600e['params']['id']}},_0x1bf5f1={};_0x1bf5f1[_0xc094('0x35')]=_[_0xc094('0x45')](db['Campaign'][_0xc094('0x2e')]);_0x1bf5f1['query']=_['keys'](_0x43600e[_0xc094('0x32')]);_0x1bf5f1[_0xc094('0x33')]=_[_0xc094('0x34')](_0x1bf5f1[_0xc094('0x35')],_0x1bf5f1['query']);_0x388e76[_0xc094('0x37')]=_[_0xc094('0x34')](_0x1bf5f1[_0xc094('0x35')],qs[_0xc094('0x36')](_0x43600e['query'][_0xc094('0x36')]));_0x388e76[_0xc094('0x37')]=_0x388e76[_0xc094('0x37')][_0xc094('0x38')]?_0x388e76[_0xc094('0x37')]:_0x1bf5f1[_0xc094('0x35')];if(_0x43600e['query']['includeAll']){_0x388e76[_0xc094('0x40')]=[{'all':!![]}];}_0x388e76=_['merge']({},_0x388e76,_0x43600e[_0xc094('0x3e')]);return db['Campaign'][_0xc094('0x46')](_0x388e76)['then'](handleEntityNotFound(_0x1c97e6,null))[_0xc094('0x24')](respondWithResult(_0x1c97e6,null))['catch'](handleError(_0x1c97e6,null));};exports[_0xc094('0x47')]=function(_0x56dc51,_0x46aa3b){return db[_0xc094('0x2d')][_0xc094('0x47')](_0x56dc51[_0xc094('0x48')],{})['then'](function(_0x43cab6){var _0x5f1f2a=_0x56dc51[_0xc094('0x49')][_0xc094('0x4a')]({'plain':!![]});if(!_0x5f1f2a)throw new Error(_0xc094('0x4b'));if(_0x5f1f2a[_0xc094('0x4c')]===_0xc094('0x49')){var _0xb7ba29=_0x43cab6[_0xc094('0x4a')]({'plain':!![]});var _0xac85c5=_0xc094('0x4d');return db[_0xc094('0x4e')]['find']({'where':{'name':_0xac85c5,'userProfileId':_0x5f1f2a[_0xc094('0x4f')]},'raw':!![]})['then'](function(_0x2ba0a9){if(_0x2ba0a9&&_0x2ba0a9[_0xc094('0x50')]===0x0){return db[_0xc094('0x25')]['create']({'name':_0xb7ba29[_0xc094('0x29')],'resourceId':_0xb7ba29['id'],'type':_0x2ba0a9[_0xc094('0x29')],'sectionId':_0x2ba0a9['id']},{})[_0xc094('0x24')](function(){return _0x43cab6;});}else{return _0x43cab6;}})[_0xc094('0x43')](function(_0x5b38ef){logger[_0xc094('0x51')](_0xc094('0x52'),_0x5b38ef);throw _0x5b38ef;});}return _0x43cab6;})['then'](respondWithResult(_0x46aa3b,0xc9))[_0xc094('0x43')](handleError(_0x46aa3b,null));};exports[_0xc094('0x53')]=function(_0x5ac606,_0x1a2db9){var _0x54fc6b={'where':{'id':_0x5ac606[_0xc094('0x54')]['id']}},_0x5e7a51={};_0x5e7a51[_0xc094('0x35')]=_[_0xc094('0x45')](db['Campaign'][_0xc094('0x2e')]);_0x54fc6b[_0xc094('0x37')]=_[_0xc094('0x34')](_0x5e7a51[_0xc094('0x35')],qs[_0xc094('0x36')](_0x5ac606[_0xc094('0x32')][_0xc094('0x36')]));_0x54fc6b[_0xc094('0x37')]=_0x54fc6b[_0xc094('0x37')][_0xc094('0x38')]?_0x54fc6b['attributes']:_0x5e7a51[_0xc094('0x35')];if(_0x5ac606[_0xc094('0x32')][_0xc094('0x3f')]){_0x54fc6b['include']=[{'all':!![]}];}_0x54fc6b=_[_0xc094('0x3d')]({},_0x54fc6b,_0x5ac606[_0xc094('0x3e')]);return db['Campaign'][_0xc094('0x46')](_0x54fc6b)[_0xc094('0x24')](handleEntityNotFound(_0x1a2db9,null))[_0xc094('0x24')](function(_0x5f2bba){if(_0x5f2bba){var _0x1a0b90=_0x5f2bba['get']({'plain':!![]});_0x1a0b90=qs[_0xc094('0x55')](_0x1a0b90,['id',_0xc094('0x56'),_0xc094('0x57')]);_0x5ac606[_0xc094('0x48')]=_[_0xc094('0x55')](_0x5ac606[_0xc094('0x48')],['id',_0xc094('0x56'),_0xc094('0x57')]);return db[_0xc094('0x2d')][_0xc094('0x47')](_[_0xc094('0x3d')](_0x1a0b90,_0x5ac606[_0xc094('0x48')]),{'include':_0x5ac606['query'][_0xc094('0x3f')]?[{'all':!![]}]:undefined})[_0xc094('0x24')](function(_0xc9d8){var _0x465b28=_0x5ac606[_0xc094('0x49')][_0xc094('0x4a')]({'plain':!![]});if(!_0x465b28)throw new Error(_0xc094('0x4b'));if(_0x465b28[_0xc094('0x4c')]===_0xc094('0x49')){var _0x419006=_0xc9d8[_0xc094('0x4a')]({'plain':!![]});var _0x22d1f3=_0xc094('0x4d');return db[_0xc094('0x4e')][_0xc094('0x46')]({'where':{'name':_0x22d1f3,'userProfileId':_0x465b28[_0xc094('0x4f')]},'raw':!![]})[_0xc094('0x24')](function(_0x401f4b){if(_0x401f4b&&_0x401f4b[_0xc094('0x50')]===0x0){return db[_0xc094('0x25')][_0xc094('0x47')]({'name':_0x419006[_0xc094('0x29')],'resourceId':_0x419006['id'],'type':_0x401f4b[_0xc094('0x29')],'sectionId':_0x401f4b['id']},{})[_0xc094('0x24')](function(){return _0xc9d8;});}else{return _0xc9d8;}})['catch'](function(_0x11c69d){logger[_0xc094('0x51')](_0xc094('0x52'),_0x11c69d);throw _0x11c69d;});}return _0xc9d8;});}})[_0xc094('0x24')](respondWithResult(_0x1a2db9,0xc9))[_0xc094('0x43')](handleError(_0x1a2db9,null));};exports[_0xc094('0x58')]=function(_0x2aae68,_0xbc704c){if(_0x2aae68[_0xc094('0x48')]['id']){delete _0x2aae68['body']['id'];}return db[_0xc094('0x2d')][_0xc094('0x46')]({'where':{'id':_0x2aae68[_0xc094('0x54')]['id']}})[_0xc094('0x24')](handleEntityNotFound(_0xbc704c,null))[_0xc094('0x24')](saveUpdates(_0x2aae68[_0xc094('0x48')],null))['then'](respondWithResult(_0xbc704c,null))[_0xc094('0x43')](handleError(_0xbc704c,null));};exports['destroy']=function(_0x3fbd46,_0x6df9b3){return db[_0xc094('0x2d')][_0xc094('0x46')]({'where':{'id':_0x3fbd46[_0xc094('0x54')]['id']}})['then'](handleEntityNotFound(_0x6df9b3,null))[_0xc094('0x24')](removeEntity(_0x6df9b3,null))[_0xc094('0x43')](handleError(_0x6df9b3,null));};exports[_0xc094('0x59')]=function(_0x2168ab,_0x443857,_0x42f14e){var _0x3b81d2={'raw':!![],'where':{}};var _0x5b56dd={};var _0x519713={'count':0x0,'rows':[]};return db[_0xc094('0x2d')][_0xc094('0x5a')]({'where':{'id':_0x2168ab['params']['id']}})['then'](handleEntityNotFound(_0x443857,null))[_0xc094('0x24')](function(_0x1575d0){if(_0x1575d0){_0x5b56dd[_0xc094('0x35')]=_['keys'](db[_0xc094('0x5b')][_0xc094('0x2e')]);_0x5b56dd[_0xc094('0x32')]=_[_0xc094('0x45')](_0x2168ab['query']);_0x5b56dd['filters']=_[_0xc094('0x34')](_0x5b56dd['model'],_0x5b56dd[_0xc094('0x32')]);_0x3b81d2['attributes']=_[_0xc094('0x34')](_0x5b56dd['model'],qs[_0xc094('0x36')](_0x2168ab[_0xc094('0x32')][_0xc094('0x36')]));_0x3b81d2[_0xc094('0x37')]=_0x3b81d2[_0xc094('0x37')][_0xc094('0x38')]?_0x3b81d2['attributes']:_0x5b56dd[_0xc094('0x35')];if(!_0x2168ab[_0xc094('0x32')][_0xc094('0x39')]('nolimit')){_0x3b81d2[_0xc094('0x1d')]=qs[_0xc094('0x1d')](_0x2168ab['query'][_0xc094('0x1d')]);_0x3b81d2[_0xc094('0x1b')]=qs[_0xc094('0x1b')](_0x2168ab['query']['offset']);}_0x3b81d2['order']=qs[_0xc094('0x5c')](_0x2168ab['query'][_0xc094('0x5c')]);_0x3b81d2['where']=qs['filters'](_[_0xc094('0x5d')](_0x2168ab[_0xc094('0x32')],_0x5b56dd[_0xc094('0x33')]));_0x3b81d2['where']['CampaignId']=_0x1575d0['id'];if(_0x2168ab[_0xc094('0x32')][_0xc094('0x5e')]){_0x3b81d2[_0xc094('0x3c')]=_['merge'](_0x3b81d2[_0xc094('0x3c')],{'$or':_['map'](_0x3b81d2[_0xc094('0x37')],function(_0x5abe4a){var _0x20f456={};_0x20f456[_0x5abe4a]={'$like':'%'+_0x2168ab[_0xc094('0x32')][_0xc094('0x5e')]+'%'};return _0x20f456;})});}_0x3b81d2=_[_0xc094('0x3d')]({},_0x3b81d2,_0x2168ab['options']);return db[_0xc094('0x5b')][_0xc094('0x1e')]({'where':_0x3b81d2['where']})[_0xc094('0x24')](function(_0x53b4c0){_0x519713['count']=_0x53b4c0;if(_0x2168ab[_0xc094('0x32')][_0xc094('0x3f')]){_0x3b81d2[_0xc094('0x40')]=[{'all':!![]}];}return db[_0xc094('0x5b')]['findAll'](_0x3b81d2);})['then'](function(_0x6db787){_0x519713['rows']=_0x6db787;return _0x519713;});}})['then'](respondWithFilteredResult(_0x443857,_0x3b81d2))[_0xc094('0x43')](handleError(_0x443857,null));};exports[_0xc094('0x5f')]=function(_0x20d0a6,_0x93ed7e,_0x19a5a0){var _0xd61d85={'raw':!![],'where':{}};var _0x272d5f={};var _0x2905cf={'count':0x0,'rows':[]};return db[_0xc094('0x2d')][_0xc094('0x5a')]({'where':{'id':_0x20d0a6[_0xc094('0x54')]['id']}})['then'](handleEntityNotFound(_0x93ed7e,null))[_0xc094('0x24')](function(_0x11db0f){if(_0x11db0f){_0x272d5f[_0xc094('0x35')]=_[_0xc094('0x45')](db[_0xc094('0x60')]['rawAttributes']);_0x272d5f['query']=_['keys'](_0x20d0a6[_0xc094('0x32')]);_0x272d5f[_0xc094('0x33')]=_[_0xc094('0x34')](_0x272d5f[_0xc094('0x35')],_0x272d5f[_0xc094('0x32')]);_0xd61d85[_0xc094('0x37')]=_['intersection'](_0x272d5f[_0xc094('0x35')],qs[_0xc094('0x36')](_0x20d0a6[_0xc094('0x32')][_0xc094('0x36')]));_0xd61d85[_0xc094('0x37')]=_0xd61d85[_0xc094('0x37')][_0xc094('0x38')]?_0xd61d85[_0xc094('0x37')]:_0x272d5f['model'];if(!_0x20d0a6[_0xc094('0x32')][_0xc094('0x39')]('nolimit')){_0xd61d85[_0xc094('0x1d')]=qs[_0xc094('0x1d')](_0x20d0a6[_0xc094('0x32')][_0xc094('0x1d')]);_0xd61d85[_0xc094('0x1b')]=qs[_0xc094('0x1b')](_0x20d0a6['query'][_0xc094('0x1b')]);}_0xd61d85[_0xc094('0x3b')]=qs[_0xc094('0x5c')](_0x20d0a6[_0xc094('0x32')][_0xc094('0x5c')]);_0xd61d85[_0xc094('0x3c')]=qs['filters'](_[_0xc094('0x5d')](_0x20d0a6['query'],_0x272d5f[_0xc094('0x33')]));_0xd61d85[_0xc094('0x3c')]['CampaignId']=_0x11db0f['id'];if(_0x20d0a6['query']['filter']){_0xd61d85[_0xc094('0x3c')]=_['merge'](_0xd61d85[_0xc094('0x3c')],{'$or':_['map'](_0xd61d85[_0xc094('0x37')],function(_0x19a16a){var _0x53e9b5={};_0x53e9b5[_0x19a16a]={'$like':'%'+_0x20d0a6[_0xc094('0x32')][_0xc094('0x5e')]+'%'};return _0x53e9b5;})});}_0xd61d85=_[_0xc094('0x3d')]({},_0xd61d85,_0x20d0a6['options']);return db[_0xc094('0x60')][_0xc094('0x1e')]({'where':_0xd61d85[_0xc094('0x3c')]})[_0xc094('0x24')](function(_0x550f2e){_0x2905cf[_0xc094('0x1e')]=_0x550f2e;if(_0x20d0a6['query'][_0xc094('0x3f')]){_0xd61d85[_0xc094('0x40')]=[{'all':!![]}];}return db[_0xc094('0x60')]['findAll'](_0xd61d85);})['then'](function(_0x1b5c26){_0x2905cf[_0xc094('0x42')]=_0x1b5c26;return _0x2905cf;});}})[_0xc094('0x24')](respondWithFilteredResult(_0x93ed7e,_0xd61d85))['catch'](handleError(_0x93ed7e,null));};exports['getHopperFinals']=function(_0x3b25c5,_0x37a5ff,_0x11d965){var _0x2fd2a9={'raw':!![],'where':{}};var _0x34e5da={};var _0x3b338a={'count':0x0,'rows':[]};return db[_0xc094('0x2d')][_0xc094('0x5a')]({'where':{'id':_0x3b25c5[_0xc094('0x54')]['id']}})[_0xc094('0x24')](handleEntityNotFound(_0x37a5ff,null))[_0xc094('0x24')](function(_0x359f51){if(_0x359f51){_0x34e5da[_0xc094('0x35')]=_[_0xc094('0x45')](db[_0xc094('0x61')]['rawAttributes']);_0x34e5da[_0xc094('0x32')]=_['keys'](_0x3b25c5[_0xc094('0x32')]);_0x34e5da[_0xc094('0x33')]=_[_0xc094('0x34')](_0x34e5da[_0xc094('0x35')],_0x34e5da[_0xc094('0x32')]);_0x2fd2a9[_0xc094('0x37')]=_['intersection'](_0x34e5da[_0xc094('0x35')],qs[_0xc094('0x36')](_0x3b25c5['query']['fields']));_0x2fd2a9[_0xc094('0x37')]=_0x2fd2a9[_0xc094('0x37')]['length']?_0x2fd2a9['attributes']:_0x34e5da[_0xc094('0x35')];if(!_0x3b25c5[_0xc094('0x32')][_0xc094('0x39')](_0xc094('0x3a'))){_0x2fd2a9['limit']=qs[_0xc094('0x1d')](_0x3b25c5['query'][_0xc094('0x1d')]);_0x2fd2a9[_0xc094('0x1b')]=qs[_0xc094('0x1b')](_0x3b25c5['query']['offset']);}_0x2fd2a9[_0xc094('0x3b')]=qs['sort'](_0x3b25c5[_0xc094('0x32')]['sort']);_0x2fd2a9[_0xc094('0x3c')]=qs[_0xc094('0x33')](_[_0xc094('0x5d')](_0x3b25c5[_0xc094('0x32')],_0x34e5da[_0xc094('0x33')]));_0x2fd2a9[_0xc094('0x3c')][_0xc094('0x62')]=_0x359f51['id'];if(_0x3b25c5[_0xc094('0x32')]['filter']){_0x2fd2a9[_0xc094('0x3c')]=_[_0xc094('0x3d')](_0x2fd2a9[_0xc094('0x3c')],{'$or':_[_0xc094('0x2c')](_0x2fd2a9[_0xc094('0x37')],function(_0x525b7b){var _0x1b4278={};_0x1b4278[_0x525b7b]={'$like':'%'+_0x3b25c5[_0xc094('0x32')][_0xc094('0x5e')]+'%'};return _0x1b4278;})});}_0x2fd2a9=_[_0xc094('0x3d')]({},_0x2fd2a9,_0x3b25c5[_0xc094('0x3e')]);return db[_0xc094('0x61')][_0xc094('0x1e')]({'where':_0x2fd2a9[_0xc094('0x3c')]})[_0xc094('0x24')](function(_0xf24a1e){_0x3b338a[_0xc094('0x1e')]=_0xf24a1e;if(_0x3b25c5['query'][_0xc094('0x3f')]){_0x2fd2a9[_0xc094('0x40')]=[{'all':!![]}];}return db[_0xc094('0x61')][_0xc094('0x41')](_0x2fd2a9);})[_0xc094('0x24')](function(_0x3efdc7){_0x3b338a['rows']=_0x3efdc7;return _0x3b338a;});}})['then'](respondWithFilteredResult(_0x37a5ff,_0x2fd2a9))[_0xc094('0x43')](handleError(_0x37a5ff,null));};exports[_0xc094('0x63')]=function(_0x16e7f3,_0x12d229,_0x5572f9){var _0x45a27e={'raw':!![],'where':{}};var _0x3f2c53={};var _0x1d7664={'count':0x0,'rows':[]};return db[_0xc094('0x2d')][_0xc094('0x5a')]({'where':{'id':_0x16e7f3['params']['id']}})[_0xc094('0x24')](handleEntityNotFound(_0x12d229,null))[_0xc094('0x24')](function(_0x13ec68){if(_0x13ec68){_0x3f2c53[_0xc094('0x35')]=_[_0xc094('0x45')](db[_0xc094('0x64')][_0xc094('0x2e')]);_0x3f2c53['query']=_['keys'](_0x16e7f3[_0xc094('0x32')]);_0x3f2c53['filters']=_['intersection'](_0x3f2c53[_0xc094('0x35')],_0x3f2c53[_0xc094('0x32')]);_0x45a27e[_0xc094('0x37')]=_[_0xc094('0x34')](_0x3f2c53[_0xc094('0x35')],qs[_0xc094('0x36')](_0x16e7f3['query'][_0xc094('0x36')]));_0x45a27e[_0xc094('0x37')]=_0x45a27e[_0xc094('0x37')][_0xc094('0x38')]?_0x45a27e['attributes']:_0x3f2c53[_0xc094('0x35')];if(!_0x16e7f3[_0xc094('0x32')][_0xc094('0x39')](_0xc094('0x3a'))){_0x45a27e['limit']=qs[_0xc094('0x1d')](_0x16e7f3[_0xc094('0x32')][_0xc094('0x1d')]);_0x45a27e[_0xc094('0x1b')]=qs[_0xc094('0x1b')](_0x16e7f3['query'][_0xc094('0x1b')]);}_0x45a27e[_0xc094('0x3b')]=qs[_0xc094('0x5c')](_0x16e7f3[_0xc094('0x32')][_0xc094('0x5c')]);_0x45a27e[_0xc094('0x3c')]=qs['filters'](_[_0xc094('0x5d')](_0x16e7f3[_0xc094('0x32')],_0x3f2c53['filters']));_0x45a27e['where'][_0xc094('0x62')]=_0x13ec68['id'];if(_0x16e7f3[_0xc094('0x32')][_0xc094('0x5e')]){_0x45a27e[_0xc094('0x3c')]=_[_0xc094('0x3d')](_0x45a27e[_0xc094('0x3c')],{'$or':_['map'](_0x45a27e[_0xc094('0x37')],function(_0x12cf77){var _0x1e2330={};_0x1e2330[_0x12cf77]={'$like':'%'+_0x16e7f3['query'][_0xc094('0x5e')]+'%'};return _0x1e2330;})});}_0x45a27e=_[_0xc094('0x3d')]({},_0x45a27e,_0x16e7f3['options']);return db[_0xc094('0x64')][_0xc094('0x1e')]({'where':_0x45a27e[_0xc094('0x3c')]})[_0xc094('0x24')](function(_0x678417){_0x1d7664['count']=_0x678417;if(_0x16e7f3['query'][_0xc094('0x3f')]){_0x45a27e[_0xc094('0x40')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x45a27e);})[_0xc094('0x24')](function(_0x4904bf){_0x1d7664[_0xc094('0x42')]=_0x4904bf;return _0x1d7664;});}})['then'](respondWithFilteredResult(_0x12d229,_0x45a27e))[_0xc094('0x43')](handleError(_0x12d229,null));};exports[_0xc094('0x65')]=function(_0x267510,_0x464f19,_0x311c0c){var _0x481250={};var _0x4e3366={};var _0x4b39fa;var _0x5bd2f4;return db[_0xc094('0x2d')][_0xc094('0x5a')]({'where':{'id':_0x267510[_0xc094('0x54')]['id']}})[_0xc094('0x24')](handleEntityNotFound(_0x464f19,null))[_0xc094('0x24')](function(_0x12517e){if(_0x12517e){_0x4b39fa=_0x12517e;_0x4e3366[_0xc094('0x35')]=_[_0xc094('0x45')](db[_0xc094('0x66')][_0xc094('0x2e')]);_0x4e3366[_0xc094('0x32')]=_[_0xc094('0x45')](_0x267510[_0xc094('0x32')]);_0x4e3366[_0xc094('0x33')]=_[_0xc094('0x34')](_0x4e3366[_0xc094('0x35')],_0x4e3366[_0xc094('0x32')]);_0x481250['attributes']=_[_0xc094('0x34')](_0x4e3366[_0xc094('0x35')],qs['fields'](_0x267510[_0xc094('0x32')][_0xc094('0x36')]));_0x481250[_0xc094('0x37')]=_0x481250[_0xc094('0x37')][_0xc094('0x38')]?_0x481250[_0xc094('0x37')]:_0x4e3366[_0xc094('0x35')];_0x481250[_0xc094('0x3b')]=qs[_0xc094('0x5c')](_0x267510[_0xc094('0x32')]['sort']);_0x481250[_0xc094('0x3c')]=qs[_0xc094('0x33')](_[_0xc094('0x5d')](_0x267510[_0xc094('0x32')],_0x4e3366[_0xc094('0x33')]));if(_0x267510['query'][_0xc094('0x5e')]){_0x481250['where']=_[_0xc094('0x3d')](_0x481250['where'],{'$or':_['map'](_0x481250['attributes'],function(_0xba61d7){var _0x1959f1={};_0x1959f1[_0xba61d7]={'$like':'%'+_0x267510['query']['filter']+'%'};return _0x1959f1;})});}_0x481250=_[_0xc094('0x3d')]({},_0x481250,_0x267510['options']);return _0x4b39fa[_0xc094('0x65')](_0x481250);}})[_0xc094('0x24')](function(_0x40a016){if(_0x40a016){_0x5bd2f4=_0x40a016[_0xc094('0x38')];if(!_0x267510[_0xc094('0x32')]['hasOwnProperty'](_0xc094('0x3a'))){_0x481250[_0xc094('0x1d')]=qs[_0xc094('0x1d')](_0x267510[_0xc094('0x32')][_0xc094('0x1d')]);_0x481250['offset']=qs[_0xc094('0x1b')](_0x267510[_0xc094('0x32')][_0xc094('0x1b')]);}return _0x4b39fa['getLists'](_0x481250);}})[_0xc094('0x24')](function(_0x3071d6){if(_0x3071d6){return _0x3071d6?{'count':_0x5bd2f4,'rows':_0x3071d6}:null;}})['then'](respondWithResult(_0x464f19,null))[_0xc094('0x43')](handleError(_0x464f19,null));};exports[_0xc094('0x67')]=function(_0x4b99ec,_0x1f5279,_0x3458cd){var _0x5435bb,_0x5b84fb;var _0x25845d=[];var _0x571d4c=moment()[_0xc094('0x68')](_0xc094('0x69'));return db['Campaign'][_0xc094('0x46')]({'where':{'id':_0x4b99ec[_0xc094('0x54')]['id']}})[_0xc094('0x24')](handleEntityNotFound(_0x1f5279,null))[_0xc094('0x24')](function(_0x37369d){if(_0x37369d){_0x5b84fb=_0x37369d;return _0x37369d[_0xc094('0x67')](_0x4b99ec[_0xc094('0x48')][_0xc094('0x6a')],_['omit'](_0x4b99ec[_0xc094('0x48')],['ids','id'])||{});}return null;})['spread'](function(_0x55c5ea){var _0x5318c3;var _0x1630a5;_0x5435bb=_0x55c5ea||[];var _0x23271d=[];if(_0x55c5ea){for(var _0x2e1bb8=0x0;_0x2e1bb8<_0x55c5ea[_0xc094('0x38')];_0x2e1bb8+=0x1){var _0x53a87d=_0x55c5ea[_0x2e1bb8]['get']({'plain':!![]});_0x5b84fb[_0xc094('0x6b')]=_0x4b99ec[_0xc094('0x48')]['dialCheckDuplicateType']?_0x4b99ec['body'][_0xc094('0x6b')]:_0x5b84fb[_0xc094('0x6b')];switch(_0x5b84fb[_0xc094('0x6b')]){case'always':_0x5318c3=squel[_0xc094('0x6c')]()['into'](_0xc094('0x6d'))[_0xc094('0x6e')](['phone','scheduledAt',_0xc094('0x6f'),_0xc094('0x70'),_0xc094('0x62'),'createdAt','updatedAt'],squel['select']()[_0xc094('0x71')](_0xc094('0x72'),_0xc094('0x72'))[_0xc094('0x71')](_0xc094('0x73'),_0xc094('0x74'))[_0xc094('0x71')]('id',_0xc094('0x6f'))['field'](_0x53a87d['CmListId'][_0xc094('0x75')](),'ListId')['field'](_0x4b99ec[_0xc094('0x54')]['id']['toString'](),_0xc094('0x62'))[_0xc094('0x71')]('\x27'+_0x571d4c+'\x27',_0xc094('0x56'))[_0xc094('0x71')]('\x27'+_0x571d4c+'\x27',_0xc094('0x57'))[_0xc094('0x76')](_0xc094('0x77'))[_0xc094('0x3c')](_0xc094('0x78'))[_0xc094('0x3c')](_0xc094('0x79'),_0x53a87d[_0xc094('0x7a')][_0xc094('0x75')]())[_0xc094('0x3c')](_0xc094('0x7b'))[_0xc094('0x3c')](_0xc094('0x7c'),squel['select']()['field']('COALESCE(calleridnum,\x27\x27)')['from'](_0xc094('0x7d'))[_0xc094('0x3c')](_0xc094('0x7e'),_0x4b99ec[_0xc094('0x54')]['id'][_0xc094('0x75')]()))[_0xc094('0x3c')](_0xc094('0x7c'),squel[_0xc094('0x7f')]()[_0xc094('0x71')](_0xc094('0x80'))[_0xc094('0x76')]('cm_hopper')['where']('CampaignId\x20=\x20?',_0x4b99ec[_0xc094('0x54')]['id'][_0xc094('0x75')]())))['toString']();break;case _0xc094('0x81'):_0x5318c3=squel[_0xc094('0x6c')]()['into'](_0xc094('0x6d'))[_0xc094('0x6e')]([_0xc094('0x72'),'scheduledAt',_0xc094('0x6f'),_0xc094('0x70'),_0xc094('0x62'),_0xc094('0x56'),_0xc094('0x57')],squel[_0xc094('0x7f')]()[_0xc094('0x71')]('phone',_0xc094('0x72'))[_0xc094('0x71')](_0xc094('0x73'),_0xc094('0x74'))[_0xc094('0x71')]('id',_0xc094('0x6f'))[_0xc094('0x71')](_0x53a87d['CmListId'][_0xc094('0x75')](),_0xc094('0x70'))[_0xc094('0x71')](_0x4b99ec[_0xc094('0x54')]['id']['toString'](),'CampaignId')[_0xc094('0x71')]('\x27'+_0x571d4c+'\x27',_0xc094('0x56'))['field']('\x27'+_0x571d4c+'\x27',_0xc094('0x57'))['from'](_0xc094('0x77'))[_0xc094('0x3c')]('deletedAt\x20IS\x20NULL')[_0xc094('0x3c')]('ListId\x20=\x20?',_0x53a87d[_0xc094('0x7a')]['toString']())[_0xc094('0x3c')](_0xc094('0x7b'))[_0xc094('0x3c')](_0xc094('0x7c'),squel['select']()[_0xc094('0x71')](_0xc094('0x80'))[_0xc094('0x76')](_0xc094('0x6d'))[_0xc094('0x3c')](_0xc094('0x7e'),_0x4b99ec[_0xc094('0x54')]['id']['toString']())))[_0xc094('0x75')]();break;default:_0x5318c3=squel[_0xc094('0x6c')]()[_0xc094('0x82')](_0xc094('0x6d'))[_0xc094('0x6e')](['phone',_0xc094('0x74'),'ContactId',_0xc094('0x70'),'CampaignId','createdAt',_0xc094('0x57')],squel['select']()[_0xc094('0x71')](_0xc094('0x72'),'phone')[_0xc094('0x71')](_0xc094('0x73'),_0xc094('0x74'))[_0xc094('0x71')]('id','ContactId')[_0xc094('0x71')](_0x53a87d[_0xc094('0x7a')][_0xc094('0x75')](),_0xc094('0x70'))[_0xc094('0x71')](_0x4b99ec['params']['id'][_0xc094('0x75')](),'CampaignId')[_0xc094('0x71')]('\x27'+_0x571d4c+'\x27','createdAt')[_0xc094('0x71')]('\x27'+_0x571d4c+'\x27',_0xc094('0x57'))[_0xc094('0x76')](_0xc094('0x77'))[_0xc094('0x3c')](_0xc094('0x78'))[_0xc094('0x3c')](_0xc094('0x79'),_0x53a87d[_0xc094('0x7a')]['toString']())[_0xc094('0x3c')](_0xc094('0x7b')))['toString']();}_0x1630a5=squel['insert']()['into'](_0xc094('0x83'))[_0xc094('0x6e')]([_0xc094('0x84'),_0xc094('0x74'),_0xc094('0x72'),_0xc094('0x85'),_0xc094('0x56'),'updatedAt'],squel['select']()[_0xc094('0x71')](_0xc094('0x86'),'id')[_0xc094('0x71')](_0xc094('0x73'),_0xc094('0x74'))[_0xc094('0x71')](_0xc094('0x87'),_0xc094('0x72'))['field'](_0xc094('0x88'),'OrderBy')[_0xc094('0x71')]('\x27'+_0x571d4c+'\x27',_0xc094('0x56'))[_0xc094('0x71')]('\x27'+_0x571d4c+'\x27',_0xc094('0x57'))[_0xc094('0x76')](_0xc094('0x89'),'ci')[_0xc094('0x8a')]('cm_hopper','h',_0xc094('0x8b'))['where'](_0xc094('0x8c'),_0x53a87d[_0xc094('0x7a')]['toString']())['where'](_0xc094('0x8d'),_0x4b99ec[_0xc094('0x54')]['id']['toString']())[_0xc094('0x3c')](_0xc094('0x8e'),_0x571d4c))[_0xc094('0x75')]();_0x23271d['push'](db['sequelize'][_0xc094('0x32')](_0x5318c3));_0x25845d['push'](db['sequelize']['query'](_0x1630a5));}return BPromise['all'](_0x23271d);}})[_0xc094('0x24')](function(){return BPromise['all'](_0x25845d);})[_0xc094('0x24')](function(){return _0x5435bb;})[_0xc094('0x24')](respondWithResult(_0x1f5279,null))[_0xc094('0x43')](handleError(_0x1f5279,null));};exports[_0xc094('0x8f')]=function(_0x131b59,_0x168a34,_0x706eb0){return db['Campaign']['find']({'where':{'id':_0x131b59[_0xc094('0x54')]['id']}})[_0xc094('0x24')](handleEntityNotFound(_0x168a34,null))[_0xc094('0x24')](function(_0x713f1e){if(_0x713f1e){return _0x713f1e[_0xc094('0x8f')](_0x131b59[_0xc094('0x32')][_0xc094('0x6a')]);}})[_0xc094('0x24')](function(_0x1dfc84){if(_0x1dfc84){return db[_0xc094('0x5b')][_0xc094('0x26')]({'where':{'ListId':_0x131b59[_0xc094('0x32')][_0xc094('0x6a')],'CampaignId':_0x131b59['params']['id']}})['then'](function(){return _0x1dfc84;});}})[_0xc094('0x24')](respondWithStatusCode(_0x168a34,null))[_0xc094('0x43')](handleError(_0x168a34,null));};exports[_0xc094('0x90')]=function(_0x2425cf,_0x3b124c,_0x56f97e){var _0x4cd789={};var _0x210ea9={};var _0x2c4a3c;var _0x1da581;return db['Campaign']['findOne']({'where':{'id':_0x2425cf[_0xc094('0x54')]['id']}})[_0xc094('0x24')](handleEntityNotFound(_0x3b124c,null))[_0xc094('0x24')](function(_0x5186d8){if(_0x5186d8){_0x2c4a3c=_0x5186d8;_0x210ea9[_0xc094('0x35')]=_[_0xc094('0x45')](db['CmList']['rawAttributes']);_0x210ea9[_0xc094('0x32')]=_[_0xc094('0x45')](_0x2425cf[_0xc094('0x32')]);_0x210ea9[_0xc094('0x33')]=_[_0xc094('0x34')](_0x210ea9[_0xc094('0x35')],_0x210ea9[_0xc094('0x32')]);_0x4cd789[_0xc094('0x37')]=_['intersection'](_0x210ea9['model'],qs['fields'](_0x2425cf[_0xc094('0x32')][_0xc094('0x36')]));_0x4cd789[_0xc094('0x37')]=_0x4cd789['attributes'][_0xc094('0x38')]?_0x4cd789[_0xc094('0x37')]:_0x210ea9[_0xc094('0x35')];_0x4cd789[_0xc094('0x3b')]=qs[_0xc094('0x5c')](_0x2425cf['query'][_0xc094('0x5c')]);_0x4cd789[_0xc094('0x3c')]=qs[_0xc094('0x33')](_[_0xc094('0x5d')](_0x2425cf[_0xc094('0x32')],_0x210ea9[_0xc094('0x33')]));if(_0x2425cf[_0xc094('0x32')][_0xc094('0x5e')]){_0x4cd789[_0xc094('0x3c')]=_[_0xc094('0x3d')](_0x4cd789['where'],{'$or':_[_0xc094('0x2c')](_0x4cd789[_0xc094('0x37')],function(_0x572bf2){var _0x4d8326={};_0x4d8326[_0x572bf2]={'$like':'%'+_0x2425cf[_0xc094('0x32')][_0xc094('0x5e')]+'%'};return _0x4d8326;})});}_0x4cd789=_['merge']({},_0x4cd789,_0x2425cf[_0xc094('0x3e')]);return _0x2c4a3c[_0xc094('0x90')](_0x4cd789);}})[_0xc094('0x24')](function(_0x3b1af6){if(_0x3b1af6){_0x1da581=_0x3b1af6['length'];if(!_0x2425cf[_0xc094('0x32')]['hasOwnProperty'](_0xc094('0x3a'))){_0x4cd789[_0xc094('0x1d')]=qs[_0xc094('0x1d')](_0x2425cf['query']['limit']);_0x4cd789[_0xc094('0x1b')]=qs[_0xc094('0x1b')](_0x2425cf[_0xc094('0x32')][_0xc094('0x1b')]);}return _0x2c4a3c[_0xc094('0x90')](_0x4cd789);}})[_0xc094('0x24')](function(_0x44fc96){if(_0x44fc96){return _0x44fc96?{'count':_0x1da581,'rows':_0x44fc96}:null;}})['then'](respondWithResult(_0x3b124c,null))[_0xc094('0x43')](handleError(_0x3b124c,null));};exports['addBlackLists']=function(_0x1fc9aa,_0x200e9a,_0x353689){var _0x1468d8,_0x24000e;var _0x5903f3=[];var _0x305879=moment()[_0xc094('0x68')](_0xc094('0x69'));return db[_0xc094('0x2d')][_0xc094('0x46')]({'where':{'id':_0x1fc9aa[_0xc094('0x54')]['id']}})[_0xc094('0x24')](handleEntityNotFound(_0x200e9a,null))[_0xc094('0x24')](function(_0x12fd87){if(_0x12fd87){_0x24000e=_0x12fd87;return _0x12fd87[_0xc094('0x91')](_0x1fc9aa[_0xc094('0x48')][_0xc094('0x6a')],_[_0xc094('0x55')](_0x1fc9aa[_0xc094('0x48')],[_0xc094('0x6a'),'id'])||{});}return null;})['spread'](function(_0x5049df){var _0x340254;var _0x325a68;_0x1468d8=_0x5049df||[];var _0x3e312e=[];if(_0x5049df){for(var _0x42bd38=0x0;_0x42bd38<_0x5049df['length'];_0x42bd38+=0x1){var _0x59006f=_0x5049df[_0x42bd38]['get']({'plain':!![]});_0x340254=squel['insert']()[_0xc094('0x82')](_0xc094('0x92'))[_0xc094('0x6e')]([_0xc094('0x72'),_0xc094('0x6f'),_0xc094('0x70'),_0xc094('0x62'),_0xc094('0x56'),_0xc094('0x57')],squel[_0xc094('0x7f')]()[_0xc094('0x71')](_0xc094('0x72'),'phone')[_0xc094('0x71')]('id','ContactId')['field'](_0x59006f['CmListId'][_0xc094('0x75')](),_0xc094('0x70'))[_0xc094('0x71')](_0x1fc9aa[_0xc094('0x54')]['id'][_0xc094('0x75')](),_0xc094('0x62'))[_0xc094('0x71')](_0xc094('0x73'),_0xc094('0x56'))[_0xc094('0x71')](_0xc094('0x73'),_0xc094('0x57'))[_0xc094('0x76')]('cm_contacts')[_0xc094('0x3c')](_0xc094('0x78'))['where'](_0xc094('0x79'),_0x59006f['CmListId'][_0xc094('0x75')]())[_0xc094('0x3c')](_0xc094('0x7b')))[_0xc094('0x75')]();_0x3e312e[_0xc094('0x93')](db[_0xc094('0x94')][_0xc094('0x32')](_0x340254));}return BPromise[_0xc094('0x95')](_0x3e312e);}})[_0xc094('0x24')](function(){return _0x1468d8;})['then'](respondWithResult(_0x200e9a,null))[_0xc094('0x43')](handleError(_0x200e9a,null));};exports[_0xc094('0x96')]=function(_0x3c3827,_0x43a2fb,_0x21165f){return db[_0xc094('0x2d')][_0xc094('0x46')]({'where':{'id':_0x3c3827[_0xc094('0x54')]['id']}})[_0xc094('0x24')](handleEntityNotFound(_0x43a2fb,null))[_0xc094('0x24')](function(_0x3d7fde){if(_0x3d7fde){return _0x3d7fde[_0xc094('0x96')](_0x3c3827['query'][_0xc094('0x6a')]);}})[_0xc094('0x24')](function(_0x3fa47f){if(_0x3fa47f){return db[_0xc094('0x64')][_0xc094('0x26')]({'where':{'ListId':_0x3c3827[_0xc094('0x32')]['ids'],'CampaignId':_0x3c3827['params']['id']}})[_0xc094('0x24')](function(){return _0x3fa47f;});}})[_0xc094('0x24')](respondWithStatusCode(_0x43a2fb,null))[_0xc094('0x43')](handleError(_0x43a2fb,null));}; \ No newline at end of file +var _0x132f=['order','where','pick','filter','merge','includeAll','findAll','rows','catch','show','options','find','create','body','user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','params','getHoppers','findOne','CmHopper','hasOwnProperty','nolimit','sort','CampaignId','include','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','field','NOW()','scheduledAt','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','format','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','update','then','destroy','get','IvrCampaigns','error','stack','name','index','Campaign','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x132f,0x182));var _0xf132=function(_0x575b72,_0x1a7eb1){_0x575b72=_0x575b72-0x0;var _0x561c57=_0x132f[_0x575b72];return _0x561c57;};'use strict';var emlformat=require(_0xf132('0x0'));var rimraf=require(_0xf132('0x1'));var zipdir=require(_0xf132('0x2'));var jsonpatch=require(_0xf132('0x3'));var rp=require(_0xf132('0x4'));var moment=require(_0xf132('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf132('0x6'));var util=require(_0xf132('0x7'));var path=require(_0xf132('0x8'));var sox=require(_0xf132('0x9'));var csv=require(_0xf132('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf132('0xb'));var _=require(_0xf132('0xc'));var squel=require('squel');var crypto=require(_0xf132('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf132('0xe'));var toCsv=require(_0xf132('0xa'));var querystring=require(_0xf132('0xf'));var Papa=require(_0xf132('0x10'));var Redis=require(_0xf132('0x11'));var authService=require(_0xf132('0x12'));var qs=require(_0xf132('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf132('0x14'))(_0xf132('0x15'));var utils=require(_0xf132('0x16'));var config=require(_0xf132('0x17'));var licenseUtil=require(_0xf132('0x18'));var db=require(_0xf132('0x19'))['db'];function respondWithStatusCode(_0x37d148,_0x1c79e0){_0x1c79e0=_0x1c79e0||0xcc;return function(_0x3f0f56){if(_0x3f0f56){return _0x37d148[_0xf132('0x1a')](_0x1c79e0);}return _0x37d148[_0xf132('0x1b')](_0x1c79e0)[_0xf132('0x1c')]();};}function respondWithResult(_0x5b58f8,_0x79d371){_0x79d371=_0x79d371||0xc8;return function(_0x259b76){if(_0x259b76){return _0x5b58f8['status'](_0x79d371)[_0xf132('0x1d')](_0x259b76);}};}function respondWithFilteredResult(_0x4edb9c,_0x50ed67){return function(_0x206e0c){if(_0x206e0c){var _0x24c138=typeof _0x50ed67[_0xf132('0x1e')]==='undefined'&&typeof _0x50ed67['limit']===_0xf132('0x1f');var _0x2f3c15=_0x206e0c[_0xf132('0x20')];var _0x31db78=_0x24c138?0x0:_0x50ed67['offset'];var _0x1af2db=_0x24c138?_0x206e0c[_0xf132('0x20')]:_0x50ed67[_0xf132('0x1e')]+_0x50ed67[_0xf132('0x21')];var _0x4b4f5d;if(_0x1af2db>=_0x2f3c15){_0x1af2db=_0x2f3c15;_0x4b4f5d=0xc8;}else{_0x4b4f5d=0xce;}_0x4edb9c[_0xf132('0x1b')](_0x4b4f5d);return _0x4edb9c['set'](_0xf132('0x22'),_0x31db78+'-'+_0x1af2db+'/'+_0x2f3c15)[_0xf132('0x1d')](_0x206e0c);}return null;};}function patchUpdates(_0x53b78a){return function(_0x129820){try{jsonpatch['apply'](_0x129820,_0x53b78a,!![]);}catch(_0x5aae77){return BPromise['reject'](_0x5aae77);}return _0x129820['save']();};}function saveUpdates(_0xbb67a7,_0x202dca){return function(_0x2fb27d){if(_0x2fb27d){return _0x2fb27d[_0xf132('0x23')](_0xbb67a7)[_0xf132('0x24')](function(_0x3f7613){return _0x3f7613;});}return null;};}function removeEntity(_0x209c99,_0x5c9958){return function(_0x3db8a0){if(_0x3db8a0){return _0x3db8a0[_0xf132('0x25')]()[_0xf132('0x24')](function(){var _0x46d563=_0x3db8a0[_0xf132('0x26')]({'plain':!![]});var _0x271471=_0xf132('0x27');return db['UserProfileResource'][_0xf132('0x25')]({'where':{'type':_0x271471,'resourceId':_0x46d563['id']}})[_0xf132('0x24')](function(){return _0x3db8a0;});})['then'](function(){_0x209c99['status'](0xcc)[_0xf132('0x1c')]();});}};}function handleEntityNotFound(_0x1941d5,_0x3933bc){return function(_0x11aba6){if(!_0x11aba6){_0x1941d5[_0xf132('0x1a')](0x194);}return _0x11aba6;};}function handleError(_0x25eed0,_0x1a19b5){_0x1a19b5=_0x1a19b5||0x1f4;return function(_0x1c1756){logger[_0xf132('0x28')](_0x1c1756[_0xf132('0x29')]);if(_0x1c1756[_0xf132('0x2a')]){delete _0x1c1756[_0xf132('0x2a')];}_0x25eed0[_0xf132('0x1b')](_0x1a19b5)['send'](_0x1c1756);};}exports[_0xf132('0x2b')]=function(_0x519127,_0x4ff070){var _0x39639a={},_0x486e27={},_0x549bd0={'count':0x0,'rows':[]};var _0x23cd0d=_['map'](db[_0xf132('0x2c')][_0xf132('0x2d')],function(_0x2a02ca){return{'name':_0x2a02ca[_0xf132('0x2e')],'type':_0x2a02ca[_0xf132('0x2f')][_0xf132('0x30')]};});_0x486e27[_0xf132('0x31')]=_[_0xf132('0x32')](_0x23cd0d,_0xf132('0x2a'));_0x486e27[_0xf132('0x33')]=_[_0xf132('0x34')](_0x519127['query']);_0x486e27[_0xf132('0x35')]=_[_0xf132('0x36')](_0x486e27['model'],_0x486e27[_0xf132('0x33')]);_0x39639a[_0xf132('0x37')]=_['intersection'](_0x486e27['model'],qs[_0xf132('0x38')](_0x519127[_0xf132('0x33')][_0xf132('0x38')]));_0x39639a[_0xf132('0x37')]=_0x39639a[_0xf132('0x37')][_0xf132('0x39')]?_0x39639a[_0xf132('0x37')]:_0x486e27['model'];if(!_0x519127['query']['hasOwnProperty']('nolimit')){_0x39639a['limit']=qs[_0xf132('0x21')](_0x519127['query'][_0xf132('0x21')]);_0x39639a[_0xf132('0x1e')]=qs[_0xf132('0x1e')](_0x519127[_0xf132('0x33')][_0xf132('0x1e')]);}_0x39639a[_0xf132('0x3a')]=qs['sort'](_0x519127['query']['sort']);_0x39639a[_0xf132('0x3b')]=qs['filters'](_[_0xf132('0x3c')](_0x519127['query'],_0x486e27['filters']),_0x23cd0d);if(_0x519127[_0xf132('0x33')][_0xf132('0x3d')]){_0x39639a['where']=_[_0xf132('0x3e')](_0x39639a[_0xf132('0x3b')],{'$or':_[_0xf132('0x32')](_0x23cd0d,function(_0x46ad84){if(_0x46ad84['type']!=='VIRTUAL'){var _0x59f5d1={};_0x59f5d1[_0x46ad84[_0xf132('0x2a')]]={'$like':'%'+_0x519127[_0xf132('0x33')][_0xf132('0x3d')]+'%'};return _0x59f5d1;}})});}_0x39639a=_[_0xf132('0x3e')]({},_0x39639a,_0x519127['options']);var _0x4e9119={'where':_0x39639a['where']};return db[_0xf132('0x2c')][_0xf132('0x20')](_0x4e9119)[_0xf132('0x24')](function(_0x552c7e){_0x549bd0[_0xf132('0x20')]=_0x552c7e;if(_0x519127[_0xf132('0x33')][_0xf132('0x3f')]){_0x39639a['include']=[{'all':!![]}];}return db[_0xf132('0x2c')][_0xf132('0x40')](_0x39639a);})[_0xf132('0x24')](function(_0x4c597f){_0x549bd0[_0xf132('0x41')]=_0x4c597f;return _0x549bd0;})['then'](respondWithFilteredResult(_0x4ff070,_0x39639a))[_0xf132('0x42')](handleError(_0x4ff070,null));};exports[_0xf132('0x43')]=function(_0x2b7c30,_0x391aa0){var _0x41f410={'raw':![],'where':{'id':_0x2b7c30['params']['id']}},_0x522232={};_0x522232[_0xf132('0x31')]=_['keys'](db[_0xf132('0x2c')]['rawAttributes']);_0x522232[_0xf132('0x33')]=_['keys'](_0x2b7c30[_0xf132('0x33')]);_0x522232['filters']=_['intersection'](_0x522232[_0xf132('0x31')],_0x522232[_0xf132('0x33')]);_0x41f410[_0xf132('0x37')]=_[_0xf132('0x36')](_0x522232['model'],qs['fields'](_0x2b7c30[_0xf132('0x33')][_0xf132('0x38')]));_0x41f410[_0xf132('0x37')]=_0x41f410[_0xf132('0x37')][_0xf132('0x39')]?_0x41f410[_0xf132('0x37')]:_0x522232[_0xf132('0x31')];if(_0x2b7c30[_0xf132('0x33')][_0xf132('0x3f')]){_0x41f410['include']=[{'all':!![]}];}_0x41f410=_[_0xf132('0x3e')]({},_0x41f410,_0x2b7c30[_0xf132('0x44')]);return db[_0xf132('0x2c')][_0xf132('0x45')](_0x41f410)[_0xf132('0x24')](handleEntityNotFound(_0x391aa0,null))['then'](respondWithResult(_0x391aa0,null))[_0xf132('0x42')](handleError(_0x391aa0,null));};exports[_0xf132('0x46')]=function(_0x3f22e2,_0x12d024){return db['Campaign'][_0xf132('0x46')](_0x3f22e2[_0xf132('0x47')],{})[_0xf132('0x24')](function(_0xefdc64){var _0x4d40b9=_0x3f22e2[_0xf132('0x48')][_0xf132('0x26')]({'plain':!![]});if(!_0x4d40b9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d40b9[_0xf132('0x49')]===_0xf132('0x48')){var _0x425344=_0xefdc64[_0xf132('0x26')]({'plain':!![]});var _0x4e1548=_0xf132('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x4e1548,'userProfileId':_0x4d40b9[_0xf132('0x4a')]},'raw':!![]})['then'](function(_0x2bebd2){if(_0x2bebd2&&_0x2bebd2['autoAssociation']===0x0){return db[_0xf132('0x4b')][_0xf132('0x46')]({'name':_0x425344[_0xf132('0x2a')],'resourceId':_0x425344['id'],'type':_0x2bebd2[_0xf132('0x2a')],'sectionId':_0x2bebd2['id']},{})[_0xf132('0x24')](function(){return _0xefdc64;});}else{return _0xefdc64;}})[_0xf132('0x42')](function(_0x416907){logger[_0xf132('0x28')](_0xf132('0x4c'),_0x416907);throw _0x416907;});}return _0xefdc64;})[_0xf132('0x24')](respondWithResult(_0x12d024,0xc9))[_0xf132('0x42')](handleError(_0x12d024,null));};exports['clone']=function(_0x552ed6,_0x3ee21b){var _0x3ca606={'where':{'id':_0x552ed6['params']['id']}},_0x2eebae={};_0x2eebae['model']=_['keys'](db[_0xf132('0x2c')][_0xf132('0x2d')]);_0x3ca606[_0xf132('0x37')]=_['intersection'](_0x2eebae[_0xf132('0x31')],qs[_0xf132('0x38')](_0x552ed6['query'][_0xf132('0x38')]));_0x3ca606['attributes']=_0x3ca606[_0xf132('0x37')][_0xf132('0x39')]?_0x3ca606[_0xf132('0x37')]:_0x2eebae[_0xf132('0x31')];if(_0x552ed6['query'][_0xf132('0x3f')]){_0x3ca606['include']=[{'all':!![]}];}_0x3ca606=_['merge']({},_0x3ca606,_0x552ed6[_0xf132('0x44')]);return db['Campaign'][_0xf132('0x45')](_0x3ca606)[_0xf132('0x24')](handleEntityNotFound(_0x3ee21b,null))['then'](function(_0x46d2b2){if(_0x46d2b2){var _0x2f6001=_0x46d2b2[_0xf132('0x26')]({'plain':!![]});_0x2f6001=qs[_0xf132('0x4d')](_0x2f6001,['id',_0xf132('0x4e'),_0xf132('0x4f')]);_0x552ed6[_0xf132('0x47')]=_['omit'](_0x552ed6[_0xf132('0x47')],['id',_0xf132('0x4e'),'updatedAt']);return db[_0xf132('0x2c')][_0xf132('0x46')](_['merge'](_0x2f6001,_0x552ed6[_0xf132('0x47')]),{'include':_0x552ed6[_0xf132('0x33')][_0xf132('0x3f')]?[{'all':!![]}]:undefined})[_0xf132('0x24')](function(_0x1c1b99){var _0x18a5c0=_0x552ed6[_0xf132('0x48')][_0xf132('0x26')]({'plain':!![]});if(!_0x18a5c0)throw new Error(_0xf132('0x50'));if(_0x18a5c0[_0xf132('0x49')]===_0xf132('0x48')){var _0x5eafc7=_0x1c1b99[_0xf132('0x26')]({'plain':!![]});var _0x26f84c=_0xf132('0x27');return db[_0xf132('0x51')][_0xf132('0x45')]({'where':{'name':_0x26f84c,'userProfileId':_0x18a5c0[_0xf132('0x4a')]},'raw':!![]})[_0xf132('0x24')](function(_0x4b6299){if(_0x4b6299&&_0x4b6299[_0xf132('0x52')]===0x0){return db[_0xf132('0x4b')][_0xf132('0x46')]({'name':_0x5eafc7['name'],'resourceId':_0x5eafc7['id'],'type':_0x4b6299['name'],'sectionId':_0x4b6299['id']},{})[_0xf132('0x24')](function(){return _0x1c1b99;});}else{return _0x1c1b99;}})['catch'](function(_0x50e3c5){logger[_0xf132('0x28')](_0xf132('0x4c'),_0x50e3c5);throw _0x50e3c5;});}return _0x1c1b99;});}})[_0xf132('0x24')](respondWithResult(_0x3ee21b,0xc9))['catch'](handleError(_0x3ee21b,null));};exports[_0xf132('0x23')]=function(_0x3bb827,_0x1046d1){if(_0x3bb827[_0xf132('0x47')]['id']){delete _0x3bb827['body']['id'];}return db[_0xf132('0x2c')][_0xf132('0x45')]({'where':{'id':_0x3bb827[_0xf132('0x53')]['id']}})['then'](handleEntityNotFound(_0x1046d1,null))[_0xf132('0x24')](saveUpdates(_0x3bb827[_0xf132('0x47')],null))[_0xf132('0x24')](respondWithResult(_0x1046d1,null))['catch'](handleError(_0x1046d1,null));};exports[_0xf132('0x25')]=function(_0x49ead0,_0x591c73){return db['Campaign']['find']({'where':{'id':_0x49ead0[_0xf132('0x53')]['id']}})[_0xf132('0x24')](handleEntityNotFound(_0x591c73,null))[_0xf132('0x24')](removeEntity(_0x591c73,null))['catch'](handleError(_0x591c73,null));};exports[_0xf132('0x54')]=function(_0x4bf024,_0x23c3f0,_0x2e45e9){var _0x40100b={'raw':!![],'where':{}};var _0x4b063e={};var _0x2ebee4={'count':0x0,'rows':[]};return db[_0xf132('0x2c')][_0xf132('0x55')]({'where':{'id':_0x4bf024[_0xf132('0x53')]['id']}})[_0xf132('0x24')](handleEntityNotFound(_0x23c3f0,null))['then'](function(_0x28b27b){if(_0x28b27b){_0x4b063e[_0xf132('0x31')]=_[_0xf132('0x34')](db[_0xf132('0x56')]['rawAttributes']);_0x4b063e[_0xf132('0x33')]=_[_0xf132('0x34')](_0x4bf024[_0xf132('0x33')]);_0x4b063e[_0xf132('0x35')]=_[_0xf132('0x36')](_0x4b063e['model'],_0x4b063e[_0xf132('0x33')]);_0x40100b['attributes']=_['intersection'](_0x4b063e[_0xf132('0x31')],qs[_0xf132('0x38')](_0x4bf024['query']['fields']));_0x40100b['attributes']=_0x40100b[_0xf132('0x37')]['length']?_0x40100b[_0xf132('0x37')]:_0x4b063e[_0xf132('0x31')];if(!_0x4bf024[_0xf132('0x33')][_0xf132('0x57')](_0xf132('0x58'))){_0x40100b['limit']=qs[_0xf132('0x21')](_0x4bf024[_0xf132('0x33')][_0xf132('0x21')]);_0x40100b[_0xf132('0x1e')]=qs['offset'](_0x4bf024[_0xf132('0x33')]['offset']);}_0x40100b[_0xf132('0x3a')]=qs[_0xf132('0x59')](_0x4bf024['query'][_0xf132('0x59')]);_0x40100b[_0xf132('0x3b')]=qs[_0xf132('0x35')](_['pick'](_0x4bf024[_0xf132('0x33')],_0x4b063e[_0xf132('0x35')]));_0x40100b[_0xf132('0x3b')][_0xf132('0x5a')]=_0x28b27b['id'];if(_0x4bf024[_0xf132('0x33')][_0xf132('0x3d')]){_0x40100b[_0xf132('0x3b')]=_[_0xf132('0x3e')](_0x40100b[_0xf132('0x3b')],{'$or':_[_0xf132('0x32')](_0x40100b[_0xf132('0x37')],function(_0x547ab9){var _0x322710={};_0x322710[_0x547ab9]={'$like':'%'+_0x4bf024['query'][_0xf132('0x3d')]+'%'};return _0x322710;})});}_0x40100b=_[_0xf132('0x3e')]({},_0x40100b,_0x4bf024[_0xf132('0x44')]);return db['CmHopper']['count']({'where':_0x40100b['where']})[_0xf132('0x24')](function(_0xb6ca97){_0x2ebee4['count']=_0xb6ca97;if(_0x4bf024['query']['includeAll']){_0x40100b[_0xf132('0x5b')]=[{'all':!![]}];}return db['CmHopper'][_0xf132('0x40')](_0x40100b);})[_0xf132('0x24')](function(_0x2b654e){_0x2ebee4['rows']=_0x2b654e;return _0x2ebee4;});}})[_0xf132('0x24')](respondWithFilteredResult(_0x23c3f0,_0x40100b))[_0xf132('0x42')](handleError(_0x23c3f0,null));};exports['getHopperHistories']=function(_0x38db5f,_0x205f9c,_0x2b919c){var _0x1dc242={'raw':!![],'where':{}};var _0x54cf46={};var _0xe0defb={'count':0x0,'rows':[]};return db[_0xf132('0x2c')][_0xf132('0x55')]({'where':{'id':_0x38db5f[_0xf132('0x53')]['id']}})[_0xf132('0x24')](handleEntityNotFound(_0x205f9c,null))[_0xf132('0x24')](function(_0x3480f5){if(_0x3480f5){_0x54cf46[_0xf132('0x31')]=_[_0xf132('0x34')](db[_0xf132('0x5c')][_0xf132('0x2d')]);_0x54cf46['query']=_[_0xf132('0x34')](_0x38db5f[_0xf132('0x33')]);_0x54cf46[_0xf132('0x35')]=_['intersection'](_0x54cf46[_0xf132('0x31')],_0x54cf46[_0xf132('0x33')]);_0x1dc242[_0xf132('0x37')]=_[_0xf132('0x36')](_0x54cf46[_0xf132('0x31')],qs[_0xf132('0x38')](_0x38db5f['query'][_0xf132('0x38')]));_0x1dc242[_0xf132('0x37')]=_0x1dc242[_0xf132('0x37')][_0xf132('0x39')]?_0x1dc242[_0xf132('0x37')]:_0x54cf46[_0xf132('0x31')];if(!_0x38db5f[_0xf132('0x33')][_0xf132('0x57')](_0xf132('0x58'))){_0x1dc242['limit']=qs[_0xf132('0x21')](_0x38db5f['query']['limit']);_0x1dc242[_0xf132('0x1e')]=qs[_0xf132('0x1e')](_0x38db5f[_0xf132('0x33')][_0xf132('0x1e')]);}_0x1dc242[_0xf132('0x3a')]=qs[_0xf132('0x59')](_0x38db5f['query'][_0xf132('0x59')]);_0x1dc242[_0xf132('0x3b')]=qs['filters'](_['pick'](_0x38db5f['query'],_0x54cf46[_0xf132('0x35')]));_0x1dc242[_0xf132('0x3b')]['CampaignId']=_0x3480f5['id'];if(_0x38db5f[_0xf132('0x33')][_0xf132('0x3d')]){_0x1dc242[_0xf132('0x3b')]=_[_0xf132('0x3e')](_0x1dc242[_0xf132('0x3b')],{'$or':_[_0xf132('0x32')](_0x1dc242[_0xf132('0x37')],function(_0x5556d9){var _0x3acf98={};_0x3acf98[_0x5556d9]={'$like':'%'+_0x38db5f[_0xf132('0x33')]['filter']+'%'};return _0x3acf98;})});}_0x1dc242=_[_0xf132('0x3e')]({},_0x1dc242,_0x38db5f[_0xf132('0x44')]);return db[_0xf132('0x5c')]['count']({'where':_0x1dc242['where']})['then'](function(_0x515f3e){_0xe0defb[_0xf132('0x20')]=_0x515f3e;if(_0x38db5f[_0xf132('0x33')][_0xf132('0x3f')]){_0x1dc242[_0xf132('0x5b')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xf132('0x40')](_0x1dc242);})[_0xf132('0x24')](function(_0x46309e){_0xe0defb[_0xf132('0x41')]=_0x46309e;return _0xe0defb;});}})[_0xf132('0x24')](respondWithFilteredResult(_0x205f9c,_0x1dc242))['catch'](handleError(_0x205f9c,null));};exports[_0xf132('0x5d')]=function(_0xd53b83,_0x107373,_0x48758b){var _0x1636d4={'raw':!![],'where':{}};var _0x1a62e3={};var _0x3cfb49={'count':0x0,'rows':[]};return db[_0xf132('0x2c')][_0xf132('0x55')]({'where':{'id':_0xd53b83[_0xf132('0x53')]['id']}})[_0xf132('0x24')](handleEntityNotFound(_0x107373,null))[_0xf132('0x24')](function(_0x3f2d1e){if(_0x3f2d1e){_0x1a62e3[_0xf132('0x31')]=_[_0xf132('0x34')](db[_0xf132('0x5e')][_0xf132('0x2d')]);_0x1a62e3[_0xf132('0x33')]=_[_0xf132('0x34')](_0xd53b83[_0xf132('0x33')]);_0x1a62e3[_0xf132('0x35')]=_[_0xf132('0x36')](_0x1a62e3[_0xf132('0x31')],_0x1a62e3[_0xf132('0x33')]);_0x1636d4[_0xf132('0x37')]=_[_0xf132('0x36')](_0x1a62e3['model'],qs[_0xf132('0x38')](_0xd53b83[_0xf132('0x33')][_0xf132('0x38')]));_0x1636d4[_0xf132('0x37')]=_0x1636d4['attributes'][_0xf132('0x39')]?_0x1636d4[_0xf132('0x37')]:_0x1a62e3[_0xf132('0x31')];if(!_0xd53b83[_0xf132('0x33')][_0xf132('0x57')]('nolimit')){_0x1636d4[_0xf132('0x21')]=qs['limit'](_0xd53b83[_0xf132('0x33')][_0xf132('0x21')]);_0x1636d4[_0xf132('0x1e')]=qs[_0xf132('0x1e')](_0xd53b83[_0xf132('0x33')][_0xf132('0x1e')]);}_0x1636d4[_0xf132('0x3a')]=qs[_0xf132('0x59')](_0xd53b83['query'][_0xf132('0x59')]);_0x1636d4['where']=qs[_0xf132('0x35')](_[_0xf132('0x3c')](_0xd53b83[_0xf132('0x33')],_0x1a62e3[_0xf132('0x35')]));_0x1636d4['where'][_0xf132('0x5a')]=_0x3f2d1e['id'];if(_0xd53b83[_0xf132('0x33')]['filter']){_0x1636d4[_0xf132('0x3b')]=_['merge'](_0x1636d4[_0xf132('0x3b')],{'$or':_[_0xf132('0x32')](_0x1636d4[_0xf132('0x37')],function(_0x4847fd){var _0x1abefe={};_0x1abefe[_0x4847fd]={'$like':'%'+_0xd53b83[_0xf132('0x33')]['filter']+'%'};return _0x1abefe;})});}_0x1636d4=_[_0xf132('0x3e')]({},_0x1636d4,_0xd53b83[_0xf132('0x44')]);return db[_0xf132('0x5e')][_0xf132('0x20')]({'where':_0x1636d4['where']})[_0xf132('0x24')](function(_0x5a4085){_0x3cfb49[_0xf132('0x20')]=_0x5a4085;if(_0xd53b83[_0xf132('0x33')][_0xf132('0x3f')]){_0x1636d4['include']=[{'all':!![]}];}return db[_0xf132('0x5e')]['findAll'](_0x1636d4);})[_0xf132('0x24')](function(_0x32d74a){_0x3cfb49[_0xf132('0x41')]=_0x32d74a;return _0x3cfb49;});}})[_0xf132('0x24')](respondWithFilteredResult(_0x107373,_0x1636d4))[_0xf132('0x42')](handleError(_0x107373,null));};exports[_0xf132('0x5f')]=function(_0x5d3d14,_0x4b6f73,_0x438a02){var _0x108d81={'raw':!![],'where':{}};var _0x3e5a0f={};var _0x182a82={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x5d3d14[_0xf132('0x53')]['id']}})[_0xf132('0x24')](handleEntityNotFound(_0x4b6f73,null))[_0xf132('0x24')](function(_0x50dd36){if(_0x50dd36){_0x3e5a0f['model']=_[_0xf132('0x34')](db[_0xf132('0x60')][_0xf132('0x2d')]);_0x3e5a0f[_0xf132('0x33')]=_[_0xf132('0x34')](_0x5d3d14['query']);_0x3e5a0f[_0xf132('0x35')]=_[_0xf132('0x36')](_0x3e5a0f[_0xf132('0x31')],_0x3e5a0f[_0xf132('0x33')]);_0x108d81[_0xf132('0x37')]=_['intersection'](_0x3e5a0f[_0xf132('0x31')],qs['fields'](_0x5d3d14[_0xf132('0x33')]['fields']));_0x108d81['attributes']=_0x108d81[_0xf132('0x37')]['length']?_0x108d81[_0xf132('0x37')]:_0x3e5a0f[_0xf132('0x31')];if(!_0x5d3d14['query'][_0xf132('0x57')](_0xf132('0x58'))){_0x108d81[_0xf132('0x21')]=qs[_0xf132('0x21')](_0x5d3d14['query'][_0xf132('0x21')]);_0x108d81[_0xf132('0x1e')]=qs['offset'](_0x5d3d14[_0xf132('0x33')]['offset']);}_0x108d81[_0xf132('0x3a')]=qs['sort'](_0x5d3d14[_0xf132('0x33')]['sort']);_0x108d81[_0xf132('0x3b')]=qs['filters'](_[_0xf132('0x3c')](_0x5d3d14[_0xf132('0x33')],_0x3e5a0f['filters']));_0x108d81[_0xf132('0x3b')][_0xf132('0x5a')]=_0x50dd36['id'];if(_0x5d3d14[_0xf132('0x33')][_0xf132('0x3d')]){_0x108d81['where']=_[_0xf132('0x3e')](_0x108d81[_0xf132('0x3b')],{'$or':_[_0xf132('0x32')](_0x108d81['attributes'],function(_0x4e7e6a){var _0x4c9f17={};_0x4c9f17[_0x4e7e6a]={'$like':'%'+_0x5d3d14['query'][_0xf132('0x3d')]+'%'};return _0x4c9f17;})});}_0x108d81=_['merge']({},_0x108d81,_0x5d3d14[_0xf132('0x44')]);return db['CmHopperBlack']['count']({'where':_0x108d81[_0xf132('0x3b')]})[_0xf132('0x24')](function(_0x18f866){_0x182a82['count']=_0x18f866;if(_0x5d3d14[_0xf132('0x33')][_0xf132('0x3f')]){_0x108d81[_0xf132('0x5b')]=[{'all':!![]}];}return db[_0xf132('0x60')][_0xf132('0x40')](_0x108d81);})[_0xf132('0x24')](function(_0x3bbbf2){_0x182a82[_0xf132('0x41')]=_0x3bbbf2;return _0x182a82;});}})[_0xf132('0x24')](respondWithFilteredResult(_0x4b6f73,_0x108d81))['catch'](handleError(_0x4b6f73,null));};exports[_0xf132('0x61')]=function(_0xccc865,_0x9d7272,_0x589dac){var _0x2896f7={};var _0x34d6a7={};var _0xce0f50;var _0x396d77;return db[_0xf132('0x2c')]['findOne']({'where':{'id':_0xccc865[_0xf132('0x53')]['id']}})[_0xf132('0x24')](handleEntityNotFound(_0x9d7272,null))['then'](function(_0x38e57b){if(_0x38e57b){_0xce0f50=_0x38e57b;_0x34d6a7[_0xf132('0x31')]=_[_0xf132('0x34')](db[_0xf132('0x62')][_0xf132('0x2d')]);_0x34d6a7[_0xf132('0x33')]=_[_0xf132('0x34')](_0xccc865[_0xf132('0x33')]);_0x34d6a7[_0xf132('0x35')]=_[_0xf132('0x36')](_0x34d6a7[_0xf132('0x31')],_0x34d6a7['query']);_0x2896f7[_0xf132('0x37')]=_['intersection'](_0x34d6a7[_0xf132('0x31')],qs[_0xf132('0x38')](_0xccc865[_0xf132('0x33')][_0xf132('0x38')]));_0x2896f7[_0xf132('0x37')]=_0x2896f7[_0xf132('0x37')][_0xf132('0x39')]?_0x2896f7[_0xf132('0x37')]:_0x34d6a7[_0xf132('0x31')];_0x2896f7['order']=qs[_0xf132('0x59')](_0xccc865['query'][_0xf132('0x59')]);_0x2896f7[_0xf132('0x3b')]=qs[_0xf132('0x35')](_[_0xf132('0x3c')](_0xccc865[_0xf132('0x33')],_0x34d6a7[_0xf132('0x35')]));if(_0xccc865[_0xf132('0x33')][_0xf132('0x3d')]){_0x2896f7[_0xf132('0x3b')]=_[_0xf132('0x3e')](_0x2896f7[_0xf132('0x3b')],{'$or':_[_0xf132('0x32')](_0x2896f7['attributes'],function(_0x499f1d){var _0x28881a={};_0x28881a[_0x499f1d]={'$like':'%'+_0xccc865[_0xf132('0x33')][_0xf132('0x3d')]+'%'};return _0x28881a;})});}_0x2896f7=_[_0xf132('0x3e')]({},_0x2896f7,_0xccc865['options']);return _0xce0f50['getLists'](_0x2896f7);}})[_0xf132('0x24')](function(_0xfd50d7){if(_0xfd50d7){_0x396d77=_0xfd50d7['length'];if(!_0xccc865['query'][_0xf132('0x57')](_0xf132('0x58'))){_0x2896f7['limit']=qs[_0xf132('0x21')](_0xccc865[_0xf132('0x33')]['limit']);_0x2896f7[_0xf132('0x1e')]=qs[_0xf132('0x1e')](_0xccc865['query'][_0xf132('0x1e')]);}return _0xce0f50[_0xf132('0x61')](_0x2896f7);}})[_0xf132('0x24')](function(_0x4c9b37){if(_0x4c9b37){return _0x4c9b37?{'count':_0x396d77,'rows':_0x4c9b37}:null;}})['then'](respondWithResult(_0x9d7272,null))[_0xf132('0x42')](handleError(_0x9d7272,null));};exports[_0xf132('0x63')]=function(_0x55d7c3,_0x3d92f8,_0x3af005){var _0x367fa1,_0x468ca9;var _0x100d64=[];var _0x58e407=moment()['format'](_0xf132('0x64'));return db[_0xf132('0x2c')][_0xf132('0x45')]({'where':{'id':_0x55d7c3['params']['id']}})[_0xf132('0x24')](handleEntityNotFound(_0x3d92f8,null))['then'](function(_0x3a89f0){if(_0x3a89f0){_0x468ca9=_0x3a89f0;return _0x3a89f0['addLists'](_0x55d7c3[_0xf132('0x47')][_0xf132('0x65')],_[_0xf132('0x4d')](_0x55d7c3[_0xf132('0x47')],[_0xf132('0x65'),'id'])||{});}return null;})[_0xf132('0x66')](function(_0x386a73){var _0x22a6bf;var _0x13d646;_0x367fa1=_0x386a73||[];var _0x469981=[];if(_0x386a73){for(var _0x466fc3=0x0;_0x466fc3<_0x386a73[_0xf132('0x39')];_0x466fc3+=0x1){var _0x11937b=_0x386a73[_0x466fc3][_0xf132('0x26')]({'plain':!![]});_0x468ca9[_0xf132('0x67')]=_0x55d7c3['body'][_0xf132('0x67')]?_0x55d7c3[_0xf132('0x47')][_0xf132('0x67')]:_0x468ca9[_0xf132('0x67')];switch(_0x468ca9[_0xf132('0x67')]){case _0xf132('0x68'):_0x22a6bf=squel[_0xf132('0x69')]()[_0xf132('0x6a')](_0xf132('0x6b'))[_0xf132('0x6c')]([_0xf132('0x6d'),'scheduledAt',_0xf132('0x6e'),_0xf132('0x6f'),_0xf132('0x5a'),_0xf132('0x4e'),'updatedAt'],squel['select']()[_0xf132('0x70')](_0xf132('0x6d'),_0xf132('0x6d'))[_0xf132('0x70')](_0xf132('0x71'),_0xf132('0x72'))['field']('id',_0xf132('0x6e'))['field'](_0x11937b[_0xf132('0x73')]['toString'](),_0xf132('0x6f'))[_0xf132('0x70')](_0x55d7c3[_0xf132('0x53')]['id'][_0xf132('0x74')](),'CampaignId')[_0xf132('0x70')]('\x27'+_0x58e407+'\x27','createdAt')[_0xf132('0x70')]('\x27'+_0x58e407+'\x27','updatedAt')[_0xf132('0x75')]('cm_contacts')[_0xf132('0x3b')](_0xf132('0x76'))[_0xf132('0x3b')](_0xf132('0x77'),_0x11937b[_0xf132('0x73')][_0xf132('0x74')]())[_0xf132('0x3b')](_0xf132('0x78'))['where'](_0xf132('0x79'),squel[_0xf132('0x7a')]()[_0xf132('0x70')](_0xf132('0x7b'))[_0xf132('0x75')](_0xf132('0x7c'))['where'](_0xf132('0x7d'),_0x55d7c3['params']['id']['toString']()))[_0xf132('0x3b')](_0xf132('0x79'),squel[_0xf132('0x7a')]()['field'](_0xf132('0x7e'))[_0xf132('0x75')](_0xf132('0x6b'))[_0xf132('0x3b')](_0xf132('0x7d'),_0x55d7c3[_0xf132('0x53')]['id'][_0xf132('0x74')]())))[_0xf132('0x74')]();break;case _0xf132('0x7f'):_0x22a6bf=squel[_0xf132('0x69')]()[_0xf132('0x6a')](_0xf132('0x6b'))['fromQuery']([_0xf132('0x6d'),_0xf132('0x72'),'ContactId',_0xf132('0x6f'),'CampaignId','createdAt',_0xf132('0x4f')],squel[_0xf132('0x7a')]()['field']('phone',_0xf132('0x6d'))['field'](_0xf132('0x71'),_0xf132('0x72'))[_0xf132('0x70')]('id',_0xf132('0x6e'))[_0xf132('0x70')](_0x11937b['CmListId']['toString'](),'ListId')['field'](_0x55d7c3[_0xf132('0x53')]['id']['toString'](),_0xf132('0x5a'))[_0xf132('0x70')]('\x27'+_0x58e407+'\x27',_0xf132('0x4e'))['field']('\x27'+_0x58e407+'\x27',_0xf132('0x4f'))[_0xf132('0x75')]('cm_contacts')[_0xf132('0x3b')]('deletedAt\x20IS\x20NULL')['where'](_0xf132('0x77'),_0x11937b[_0xf132('0x73')][_0xf132('0x74')]())[_0xf132('0x3b')](_0xf132('0x78'))['where'](_0xf132('0x79'),squel[_0xf132('0x7a')]()['field'](_0xf132('0x7e'))[_0xf132('0x75')](_0xf132('0x6b'))['where'](_0xf132('0x7d'),_0x55d7c3[_0xf132('0x53')]['id']['toString']())))['toString']();break;default:_0x22a6bf=squel[_0xf132('0x69')]()[_0xf132('0x6a')](_0xf132('0x6b'))[_0xf132('0x6c')](['phone',_0xf132('0x72'),_0xf132('0x6e'),_0xf132('0x6f'),'CampaignId',_0xf132('0x4e'),'updatedAt'],squel[_0xf132('0x7a')]()[_0xf132('0x70')](_0xf132('0x6d'),_0xf132('0x6d'))[_0xf132('0x70')](_0xf132('0x71'),_0xf132('0x72'))[_0xf132('0x70')]('id',_0xf132('0x6e'))['field'](_0x11937b[_0xf132('0x73')][_0xf132('0x74')](),_0xf132('0x6f'))[_0xf132('0x70')](_0x55d7c3[_0xf132('0x53')]['id'][_0xf132('0x74')](),_0xf132('0x5a'))[_0xf132('0x70')]('\x27'+_0x58e407+'\x27','createdAt')[_0xf132('0x70')]('\x27'+_0x58e407+'\x27',_0xf132('0x4f'))[_0xf132('0x75')](_0xf132('0x80'))[_0xf132('0x3b')](_0xf132('0x76'))['where'](_0xf132('0x77'),_0x11937b[_0xf132('0x73')]['toString']())[_0xf132('0x3b')](_0xf132('0x78')))['toString']();}_0x13d646=squel[_0xf132('0x69')]()[_0xf132('0x6a')](_0xf132('0x81'))[_0xf132('0x6c')]([_0xf132('0x82'),_0xf132('0x72'),_0xf132('0x6d'),_0xf132('0x83'),_0xf132('0x4e'),_0xf132('0x4f')],squel['select']()[_0xf132('0x70')](_0xf132('0x84'),'id')[_0xf132('0x70')](_0xf132('0x71'),_0xf132('0x72'))[_0xf132('0x70')](_0xf132('0x85'),'phone')[_0xf132('0x70')](_0xf132('0x86'),_0xf132('0x83'))[_0xf132('0x70')]('\x27'+_0x58e407+'\x27','createdAt')[_0xf132('0x70')]('\x27'+_0x58e407+'\x27',_0xf132('0x4f'))[_0xf132('0x75')](_0xf132('0x87'),'ci')['join'](_0xf132('0x6b'),'h',_0xf132('0x88'))[_0xf132('0x3b')](_0xf132('0x89'),_0x11937b['CmListId'][_0xf132('0x74')]())[_0xf132('0x3b')](_0xf132('0x8a'),_0x55d7c3[_0xf132('0x53')]['id']['toString']())['where']('h.createdAt\x20=\x20?',_0x58e407))[_0xf132('0x74')]();_0x469981[_0xf132('0x8b')](db[_0xf132('0x8c')][_0xf132('0x33')](_0x22a6bf));_0x100d64[_0xf132('0x8b')](db[_0xf132('0x8c')]['query'](_0x13d646));}return BPromise[_0xf132('0x8d')](_0x469981);}})['then'](function(){return BPromise[_0xf132('0x8d')](_0x100d64);})[_0xf132('0x24')](function(){return _0x367fa1;})[_0xf132('0x24')](respondWithResult(_0x3d92f8,null))[_0xf132('0x42')](handleError(_0x3d92f8,null));};exports[_0xf132('0x8e')]=function(_0x26af49,_0x30891c,_0x552456){return db[_0xf132('0x2c')]['find']({'where':{'id':_0x26af49[_0xf132('0x53')]['id']}})[_0xf132('0x24')](handleEntityNotFound(_0x30891c,null))['then'](function(_0x54170e){if(_0x54170e){return _0x54170e[_0xf132('0x8e')](_0x26af49['query'][_0xf132('0x65')]);}})[_0xf132('0x24')](function(_0x3ef546){if(_0x3ef546){return db[_0xf132('0x56')][_0xf132('0x25')]({'where':{'ListId':_0x26af49['query'][_0xf132('0x65')],'CampaignId':_0x26af49[_0xf132('0x53')]['id']}})[_0xf132('0x24')](function(){return _0x3ef546;});}})[_0xf132('0x24')](respondWithStatusCode(_0x30891c,null))[_0xf132('0x42')](handleError(_0x30891c,null));};exports[_0xf132('0x8f')]=function(_0x6869e7,_0x13ec95,_0x2256b1){var _0x2524e8={};var _0x154035={};var _0x37fa16;var _0x57d7d8;return db[_0xf132('0x2c')][_0xf132('0x55')]({'where':{'id':_0x6869e7[_0xf132('0x53')]['id']}})[_0xf132('0x24')](handleEntityNotFound(_0x13ec95,null))['then'](function(_0x5e281d){if(_0x5e281d){_0x37fa16=_0x5e281d;_0x154035[_0xf132('0x31')]=_[_0xf132('0x34')](db[_0xf132('0x62')][_0xf132('0x2d')]);_0x154035[_0xf132('0x33')]=_[_0xf132('0x34')](_0x6869e7[_0xf132('0x33')]);_0x154035['filters']=_[_0xf132('0x36')](_0x154035[_0xf132('0x31')],_0x154035[_0xf132('0x33')]);_0x2524e8[_0xf132('0x37')]=_[_0xf132('0x36')](_0x154035[_0xf132('0x31')],qs[_0xf132('0x38')](_0x6869e7['query'][_0xf132('0x38')]));_0x2524e8[_0xf132('0x37')]=_0x2524e8[_0xf132('0x37')][_0xf132('0x39')]?_0x2524e8[_0xf132('0x37')]:_0x154035[_0xf132('0x31')];_0x2524e8[_0xf132('0x3a')]=qs[_0xf132('0x59')](_0x6869e7['query'][_0xf132('0x59')]);_0x2524e8[_0xf132('0x3b')]=qs['filters'](_['pick'](_0x6869e7[_0xf132('0x33')],_0x154035[_0xf132('0x35')]));if(_0x6869e7[_0xf132('0x33')][_0xf132('0x3d')]){_0x2524e8[_0xf132('0x3b')]=_[_0xf132('0x3e')](_0x2524e8[_0xf132('0x3b')],{'$or':_[_0xf132('0x32')](_0x2524e8[_0xf132('0x37')],function(_0xfa482b){var _0x2c55bc={};_0x2c55bc[_0xfa482b]={'$like':'%'+_0x6869e7[_0xf132('0x33')]['filter']+'%'};return _0x2c55bc;})});}_0x2524e8=_[_0xf132('0x3e')]({},_0x2524e8,_0x6869e7['options']);return _0x37fa16[_0xf132('0x8f')](_0x2524e8);}})[_0xf132('0x24')](function(_0x9a987a){if(_0x9a987a){_0x57d7d8=_0x9a987a[_0xf132('0x39')];if(!_0x6869e7['query'][_0xf132('0x57')](_0xf132('0x58'))){_0x2524e8['limit']=qs['limit'](_0x6869e7[_0xf132('0x33')][_0xf132('0x21')]);_0x2524e8[_0xf132('0x1e')]=qs[_0xf132('0x1e')](_0x6869e7[_0xf132('0x33')][_0xf132('0x1e')]);}return _0x37fa16[_0xf132('0x8f')](_0x2524e8);}})[_0xf132('0x24')](function(_0x253105){if(_0x253105){return _0x253105?{'count':_0x57d7d8,'rows':_0x253105}:null;}})['then'](respondWithResult(_0x13ec95,null))[_0xf132('0x42')](handleError(_0x13ec95,null));};exports['addBlackLists']=function(_0x5a5a95,_0x224337,_0x168d54){var _0x52ed20,_0xd47e29;var _0x541eff=[];var _0x19e7b7=moment()[_0xf132('0x90')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xf132('0x2c')][_0xf132('0x45')]({'where':{'id':_0x5a5a95[_0xf132('0x53')]['id']}})['then'](handleEntityNotFound(_0x224337,null))[_0xf132('0x24')](function(_0x412a54){if(_0x412a54){_0xd47e29=_0x412a54;return _0x412a54[_0xf132('0x91')](_0x5a5a95['body']['ids'],_[_0xf132('0x4d')](_0x5a5a95[_0xf132('0x47')],[_0xf132('0x65'),'id'])||{});}return null;})[_0xf132('0x66')](function(_0x58cd4e){var _0x4a9361;var _0x48a226;_0x52ed20=_0x58cd4e||[];var _0x348896=[];if(_0x58cd4e){for(var _0x324454=0x0;_0x324454<_0x58cd4e[_0xf132('0x39')];_0x324454+=0x1){var _0x1db7c8=_0x58cd4e[_0x324454]['get']({'plain':!![]});_0x4a9361=squel[_0xf132('0x69')]()[_0xf132('0x6a')](_0xf132('0x92'))[_0xf132('0x6c')](['phone',_0xf132('0x6e'),_0xf132('0x6f'),'CampaignId',_0xf132('0x4e'),_0xf132('0x4f')],squel[_0xf132('0x7a')]()['field'](_0xf132('0x6d'),'phone')[_0xf132('0x70')]('id',_0xf132('0x6e'))[_0xf132('0x70')](_0x1db7c8[_0xf132('0x73')][_0xf132('0x74')](),_0xf132('0x6f'))['field'](_0x5a5a95[_0xf132('0x53')]['id'][_0xf132('0x74')](),'CampaignId')[_0xf132('0x70')]('NOW()','createdAt')[_0xf132('0x70')](_0xf132('0x71'),_0xf132('0x4f'))[_0xf132('0x75')](_0xf132('0x80'))[_0xf132('0x3b')](_0xf132('0x76'))['where'](_0xf132('0x77'),_0x1db7c8[_0xf132('0x73')][_0xf132('0x74')]())[_0xf132('0x3b')](_0xf132('0x78')))[_0xf132('0x74')]();_0x348896['push'](db[_0xf132('0x8c')][_0xf132('0x33')](_0x4a9361));}return BPromise['all'](_0x348896);}})[_0xf132('0x24')](function(){return _0x52ed20;})[_0xf132('0x24')](respondWithResult(_0x224337,null))['catch'](handleError(_0x224337,null));};exports[_0xf132('0x93')]=function(_0x4e9343,_0x34193a,_0x2980b8){return db[_0xf132('0x2c')]['find']({'where':{'id':_0x4e9343['params']['id']}})[_0xf132('0x24')](handleEntityNotFound(_0x34193a,null))['then'](function(_0x54fca5){if(_0x54fca5){return _0x54fca5[_0xf132('0x93')](_0x4e9343[_0xf132('0x33')][_0xf132('0x65')]);}})[_0xf132('0x24')](function(_0x228c97){if(_0x228c97){return db[_0xf132('0x60')][_0xf132('0x25')]({'where':{'ListId':_0x4e9343[_0xf132('0x33')][_0xf132('0x65')],'CampaignId':_0x4e9343[_0xf132('0x53')]['id']}})['then'](function(){return _0x228c97;});}})['then'](respondWithStatusCode(_0x34193a,null))[_0xf132('0x42')](handleError(_0x34193a,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 193c5d2..6f550fa 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_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':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index ee8253b..f2221bc 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 _0x3cfb=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCampaign','Campaign','findAll','options','where','attributes','limit','include','map','model','lodash','util'];(function(_0x2d3ab3,_0x47d90b){var _0x321f9e=function(_0x50a53d){while(--_0x50a53d){_0x2d3ab3['push'](_0x2d3ab3['shift']());}};_0x321f9e(++_0x47d90b);}(_0x3cfb,0x1b8));var _0xb3cf=function(_0x1edd49,_0x23999e){_0x1edd49=_0x1edd49-0x0;var _0x576608=_0x3cfb[_0x1edd49];return _0x576608;};'use strict';var _=require(_0xb3cf('0x0'));var util=require(_0xb3cf('0x1'));var moment=require(_0xb3cf('0x2'));var BPromise=require(_0xb3cf('0x3'));var rs=require(_0xb3cf('0x4'));var fs=require('fs');var Redis=require(_0xb3cf('0x5'));var db=require(_0xb3cf('0x6'))['db'];var utils=require(_0xb3cf('0x7'));var logger=require('../../config/logger')(_0xb3cf('0x8'));var config=require(_0xb3cf('0x9'));var jayson=require(_0xb3cf('0xa'));var client=jayson['client'][_0xb3cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b7131,_0x42ce15,_0x53be8c){return new BPromise(function(_0x19ed7d,_0x4e4cc8){return client['request'](_0x1b7131,_0x53be8c)[_0xb3cf('0xc')](function(_0x44a55d){logger[_0xb3cf('0xd')](_0xb3cf('0xe'),_0x42ce15,_0xb3cf('0xf'));logger[_0xb3cf('0x10')](_0xb3cf('0x11'),_0x42ce15,_0xb3cf('0xf'),JSON[_0xb3cf('0x12')](_0x44a55d));if(_0x44a55d[_0xb3cf('0x13')]){if(_0x44a55d[_0xb3cf('0x13')][_0xb3cf('0x14')]===0x1f4){logger[_0xb3cf('0x13')](_0xb3cf('0xe'),_0x42ce15,_0x44a55d[_0xb3cf('0x13')]['message']);return _0x4e4cc8(_0x44a55d['error'][_0xb3cf('0x15')]);}logger[_0xb3cf('0x13')]('Campaign,\x20%s,\x20%s',_0x42ce15,_0x44a55d[_0xb3cf('0x13')]['message']);return _0x19ed7d(_0x44a55d['error'][_0xb3cf('0x15')]);}else{logger[_0xb3cf('0xd')](_0xb3cf('0xe'),_0x42ce15,'request\x20sent');_0x19ed7d(_0x44a55d[_0xb3cf('0x16')][_0xb3cf('0x15')]);}})[_0xb3cf('0x17')](function(_0x442fd6){logger[_0xb3cf('0x13')](_0xb3cf('0xe'),_0x42ce15,_0x442fd6);_0x4e4cc8(_0x442fd6);});});}exports[_0xb3cf('0x18')]=function(_0x2d0018){var _0x1526c9=this;return new Promise(function(_0x222c1d,_0x4b0a82){return db[_0xb3cf('0x19')][_0xb3cf('0x1a')]({'raw':_0x2d0018[_0xb3cf('0x1b')]?_0x2d0018[_0xb3cf('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2d0018[_0xb3cf('0x1b')]?_0x2d0018[_0xb3cf('0x1b')][_0xb3cf('0x1c')]||null:null,'attributes':_0x2d0018[_0xb3cf('0x1b')]?_0x2d0018[_0xb3cf('0x1b')][_0xb3cf('0x1d')]||null:null,'limit':_0x2d0018[_0xb3cf('0x1b')]?_0x2d0018[_0xb3cf('0x1b')][_0xb3cf('0x1e')]||null:null,'include':_0x2d0018[_0xb3cf('0x1b')]?_0x2d0018['options'][_0xb3cf('0x1f')]?_[_0xb3cf('0x20')](_0x2d0018[_0xb3cf('0x1b')][_0xb3cf('0x1f')],function(_0x1fb3ea){return{'model':db[_0x1fb3ea[_0xb3cf('0x21')]],'as':_0x1fb3ea['as'],'attributes':_0x1fb3ea[_0xb3cf('0x1d')],'include':_0x1fb3ea[_0xb3cf('0x1f')]?_[_0xb3cf('0x20')](_0x1fb3ea[_0xb3cf('0x1f')],function(_0x5d939e){return{'model':db[_0x5d939e[_0xb3cf('0x21')]],'as':_0x5d939e['as'],'attributes':_0x5d939e[_0xb3cf('0x1d')],'include':_0x5d939e[_0xb3cf('0x1f')]?_['map'](_0x5d939e['include'],function(_0x15cf4d){return{'model':db[_0x15cf4d[_0xb3cf('0x21')]],'as':_0x15cf4d['as'],'attributes':_0x15cf4d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xfc0f5b){logger[_0xb3cf('0xd')]('GetCampaign',_0x2d0018);logger[_0xb3cf('0x10')](_0xb3cf('0x18'),_0x2d0018,JSON[_0xb3cf('0x12')](_0xfc0f5b));_0x222c1d(_0xfc0f5b);})[_0xb3cf('0x17')](function(_0x1b1460){logger[_0xb3cf('0x13')](_0xb3cf('0x18'),_0x1b1460[_0xb3cf('0x15')],_0x2d0018);_0x4b0a82(_0x1526c9[_0xb3cf('0x13')](0x1f4,_0x1b1460[_0xb3cf('0x15')]));});});}; \ No newline at end of file +var _0x3a32=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','info','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','options','raw','where','attributes','include','map','model','then','stringify'];(function(_0x1d47ef,_0x113e36){var _0x1bdc06=function(_0x4588ae){while(--_0x4588ae){_0x1d47ef['push'](_0x1d47ef['shift']());}};_0x1bdc06(++_0x113e36);}(_0x3a32,0x9b));var _0x23a3=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x3a32[_0x31cb5f];return _0x586042;};'use strict';var _=require(_0x23a3('0x0'));var util=require(_0x23a3('0x1'));var moment=require(_0x23a3('0x2'));var BPromise=require(_0x23a3('0x3'));var rs=require(_0x23a3('0x4'));var fs=require('fs');var Redis=require(_0x23a3('0x5'));var db=require(_0x23a3('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x23a3('0x7'));var config=require(_0x23a3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x23a3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x103499,_0x256bcf,_0xd4e907){return new BPromise(function(_0x2562bc,_0x11d423){return client[_0x23a3('0xa')](_0x103499,_0xd4e907)['then'](function(_0x233b17){logger[_0x23a3('0xb')]('Campaign,\x20%s,\x20%s',_0x256bcf,'request\x20sent');logger[_0x23a3('0xc')](_0x23a3('0xd'),_0x256bcf,_0x23a3('0xe'),JSON['stringify'](_0x233b17));if(_0x233b17[_0x23a3('0xf')]){if(_0x233b17['error'][_0x23a3('0x10')]===0x1f4){logger[_0x23a3('0xf')](_0x23a3('0x11'),_0x256bcf,_0x233b17['error'][_0x23a3('0x12')]);return _0x11d423(_0x233b17[_0x23a3('0xf')][_0x23a3('0x12')]);}logger[_0x23a3('0xf')](_0x23a3('0x11'),_0x256bcf,_0x233b17['error'][_0x23a3('0x12')]);return _0x2562bc(_0x233b17[_0x23a3('0xf')]['message']);}else{logger[_0x23a3('0xb')](_0x23a3('0x11'),_0x256bcf,'request\x20sent');_0x2562bc(_0x233b17[_0x23a3('0x13')][_0x23a3('0x12')]);}})[_0x23a3('0x14')](function(_0x3e3cc1){logger[_0x23a3('0xf')](_0x23a3('0x11'),_0x256bcf,_0x3e3cc1);_0x11d423(_0x3e3cc1);});});}exports[_0x23a3('0x15')]=function(_0xc33cbd){var _0x53f4e8=this;return new Promise(function(_0x3961e9,_0x2303d2){return db['Campaign']['findAll']({'raw':_0xc33cbd[_0x23a3('0x16')]?_0xc33cbd[_0x23a3('0x16')][_0x23a3('0x17')]===undefined?!![]:![]:!![],'where':_0xc33cbd[_0x23a3('0x16')]?_0xc33cbd[_0x23a3('0x16')][_0x23a3('0x18')]||null:null,'attributes':_0xc33cbd[_0x23a3('0x16')]?_0xc33cbd[_0x23a3('0x16')][_0x23a3('0x19')]||null:null,'limit':_0xc33cbd[_0x23a3('0x16')]?_0xc33cbd[_0x23a3('0x16')]['limit']||null:null,'include':_0xc33cbd[_0x23a3('0x16')]?_0xc33cbd[_0x23a3('0x16')][_0x23a3('0x1a')]?_[_0x23a3('0x1b')](_0xc33cbd[_0x23a3('0x16')][_0x23a3('0x1a')],function(_0x509aa3){return{'model':db[_0x509aa3[_0x23a3('0x1c')]],'as':_0x509aa3['as'],'attributes':_0x509aa3['attributes'],'include':_0x509aa3[_0x23a3('0x1a')]?_['map'](_0x509aa3[_0x23a3('0x1a')],function(_0x525b5f){return{'model':db[_0x525b5f[_0x23a3('0x1c')]],'as':_0x525b5f['as'],'attributes':_0x525b5f['attributes'],'include':_0x525b5f[_0x23a3('0x1a')]?_[_0x23a3('0x1b')](_0x525b5f['include'],function(_0x333998){return{'model':db[_0x333998[_0x23a3('0x1c')]],'as':_0x333998['as'],'attributes':_0x333998[_0x23a3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x23a3('0x1d')](function(_0x2ace31){logger['info'](_0x23a3('0x15'),_0xc33cbd);logger[_0x23a3('0xc')](_0x23a3('0x15'),_0xc33cbd,JSON[_0x23a3('0x1e')](_0x2ace31));_0x3961e9(_0x2ace31);})[_0x23a3('0x14')](function(_0x35519f){logger[_0x23a3('0xf')](_0x23a3('0x15'),_0x35519f['message'],_0xc33cbd);_0x2303d2(_0x53f4e8[_0x23a3('0xf')](0x1f4,_0x35519f[_0x23a3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 4430d1a..c56897c 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 _0xae13=['/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals'];(function(_0x2e2cd7,_0x9a3d16){var _0x397801=function(_0x1e15e0){while(--_0x1e15e0){_0x2e2cd7['push'](_0x2e2cd7['shift']());}};_0x397801(++_0x9a3d16);}(_0xae13,0x154));var _0x3ae1=function(_0x1bd51d,_0x46f25e){_0x1bd51d=_0x1bd51d-0x0;var _0x116b83=_0xae13[_0x1bd51d];return _0x116b83;};'use strict';var multer=require(_0x3ae1('0x0'));var util=require(_0x3ae1('0x1'));var path=require(_0x3ae1('0x2'));var timeout=require(_0x3ae1('0x3'));var express=require(_0x3ae1('0x4'));var router=express[_0x3ae1('0x5')]();var fs_extra=require(_0x3ae1('0x6'));var auth=require(_0x3ae1('0x7'));var interaction=require(_0x3ae1('0x8'));var config=require(_0x3ae1('0x9'));var controller=require(_0x3ae1('0xa'));router[_0x3ae1('0xb')]('/',auth[_0x3ae1('0xc')](),controller[_0x3ae1('0xd')]);router['get']('/:id',auth[_0x3ae1('0xc')](),controller[_0x3ae1('0xe')]);router[_0x3ae1('0xb')](_0x3ae1('0xf'),auth[_0x3ae1('0xc')](),controller[_0x3ae1('0x10')]);router[_0x3ae1('0xb')](_0x3ae1('0x11'),auth[_0x3ae1('0xc')](),controller[_0x3ae1('0x12')]);router[_0x3ae1('0xb')]('/:id/hopper_finals',auth[_0x3ae1('0xc')](),controller[_0x3ae1('0x13')]);router[_0x3ae1('0xb')](_0x3ae1('0x14'),auth[_0x3ae1('0xc')](),controller[_0x3ae1('0x15')]);router['get'](_0x3ae1('0x16'),auth[_0x3ae1('0xc')](),controller[_0x3ae1('0x17')]);router['get']('/:id/blacklists',auth[_0x3ae1('0xc')](),controller['getBlackLists']);router[_0x3ae1('0x18')]('/',auth[_0x3ae1('0xc')](),controller[_0x3ae1('0x19')]);router[_0x3ae1('0x18')](_0x3ae1('0x1a'),auth[_0x3ae1('0xc')](),controller[_0x3ae1('0x1b')]);router['post'](_0x3ae1('0x16'),auth['isAuthenticated'](),controller[_0x3ae1('0x1c')]);router[_0x3ae1('0x18')](_0x3ae1('0x1d'),auth[_0x3ae1('0xc')](),controller[_0x3ae1('0x1e')]);router['put'](_0x3ae1('0x1f'),auth[_0x3ae1('0xc')](),controller[_0x3ae1('0x20')]);router[_0x3ae1('0x21')](_0x3ae1('0x1f'),auth[_0x3ae1('0xc')](),controller[_0x3ae1('0x22')]);router[_0x3ae1('0x21')](_0x3ae1('0x16'),auth['isAuthenticated'](),controller['removeLists']);router[_0x3ae1('0x21')](_0x3ae1('0x1d'),auth[_0x3ae1('0xc')](),controller['removeBlackLists']);module[_0x3ae1('0x23')]=router; \ No newline at end of file +var _0xacb8=['removeLists','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addLists','addBlackLists','delete','/:id','destroy'];(function(_0x593f03,_0x4af84a){var _0x178299=function(_0x284500){while(--_0x284500){_0x593f03['push'](_0x593f03['shift']());}};_0x178299(++_0x4af84a);}(_0xacb8,0x119));var _0x8acb=function(_0x1855de,_0x15a076){_0x1855de=_0x1855de-0x0;var _0x16b75a=_0xacb8[_0x1855de];return _0x16b75a;};'use strict';var multer=require(_0x8acb('0x0'));var util=require('util');var path=require(_0x8acb('0x1'));var timeout=require(_0x8acb('0x2'));var express=require(_0x8acb('0x3'));var router=express['Router']();var fs_extra=require(_0x8acb('0x4'));var auth=require(_0x8acb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8acb('0x6'));var controller=require(_0x8acb('0x7'));router[_0x8acb('0x8')]('/',auth[_0x8acb('0x9')](),controller[_0x8acb('0xa')]);router[_0x8acb('0x8')]('/:id',auth[_0x8acb('0x9')](),controller[_0x8acb('0xb')]);router[_0x8acb('0x8')](_0x8acb('0xc'),auth[_0x8acb('0x9')](),controller[_0x8acb('0xd')]);router['get']('/:id/hopper_histories',auth[_0x8acb('0x9')](),controller[_0x8acb('0xe')]);router[_0x8acb('0x8')](_0x8acb('0xf'),auth['isAuthenticated'](),controller[_0x8acb('0x10')]);router[_0x8acb('0x8')]('/:id/hopper_black',auth[_0x8acb('0x9')](),controller[_0x8acb('0x11')]);router[_0x8acb('0x8')](_0x8acb('0x12'),auth[_0x8acb('0x9')](),controller['getLists']);router[_0x8acb('0x8')](_0x8acb('0x13'),auth[_0x8acb('0x9')](),controller[_0x8acb('0x14')]);router[_0x8acb('0x15')]('/',auth[_0x8acb('0x9')](),controller['create']);router[_0x8acb('0x15')](_0x8acb('0x16'),auth[_0x8acb('0x9')](),controller[_0x8acb('0x17')]);router[_0x8acb('0x15')](_0x8acb('0x12'),auth[_0x8acb('0x9')](),controller[_0x8acb('0x18')]);router[_0x8acb('0x15')]('/:id/blacklists',auth[_0x8acb('0x9')](),controller[_0x8acb('0x19')]);router['put']('/:id',auth[_0x8acb('0x9')](),controller['update']);router[_0x8acb('0x1a')](_0x8acb('0x1b'),auth['isAuthenticated'](),controller[_0x8acb('0x1c')]);router[_0x8acb('0x1a')](_0x8acb('0x12'),auth[_0x8acb('0x9')](),controller[_0x8acb('0x1d')]);router[_0x8acb('0x1a')](_0x8acb('0x13'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x8acb('0x1e')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index ba82e9c..86e24d7 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 _0x8a9d=['exports','TEXT','STRING','VIRTUAL','getDataValue','key','sequelize'];(function(_0x487177,_0x1ddcd6){var _0x147202=function(_0xa5105){while(--_0xa5105){_0x487177['push'](_0x487177['shift']());}};_0x147202(++_0x1ddcd6);}(_0x8a9d,0x6f));var _0xd8a9=function(_0x21ed1f,_0xabbc54){_0x21ed1f=_0x21ed1f-0x0;var _0x2d8da9=_0x8a9d[_0x21ed1f];return _0x2d8da9;};'use strict';var Sequelize=require(_0xd8a9('0x0'));module[_0xd8a9('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xd8a9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd8a9('0x3')]},'name':{'type':Sequelize[_0xd8a9('0x4')],'get':function(){return this[_0xd8a9('0x5')](_0xd8a9('0x6'));}}}; \ No newline at end of file +var _0x09d6=['STRING','TEXT','VIRTUAL','key','exports'];(function(_0x299db6,_0x2d8407){var _0x2b3510=function(_0x1be7e6){while(--_0x1be7e6){_0x299db6['push'](_0x299db6['shift']());}};_0x2b3510(++_0x2d8407);}(_0x09d6,0xe0));var _0x609d=function(_0x1bcbe3,_0x181f09){_0x1bcbe3=_0x1bcbe3-0x0;var _0x2f1853=_0x09d6[_0x1bcbe3];return _0x2f1853;};'use strict';var Sequelize=require('sequelize');module[_0x609d('0x0')]={'key':{'type':Sequelize[_0x609d('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x609d('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x609d('0x3')],'get':function(){return this['getDataValue'](_0x609d('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 3eb2dec..d923c7e 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 _0x7cad=['include','findAll','rows','catch','show','params','find','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','destroy','get','CannedAnswers','UserProfileResource','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','CannedAnswer','includeAll'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x7cad,0xd4));var _0xd7ca=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7cad[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd7ca('0x0'));var zipdir=require(_0xd7ca('0x1'));var jsonpatch=require(_0xd7ca('0x2'));var rp=require(_0xd7ca('0x3'));var moment=require(_0xd7ca('0x4'));var BPromise=require(_0xd7ca('0x5'));var Mustache=require(_0xd7ca('0x6'));var util=require(_0xd7ca('0x7'));var path=require(_0xd7ca('0x8'));var sox=require(_0xd7ca('0x9'));var csv=require('to-csv');var ejs=require(_0xd7ca('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd7ca('0xb'));var squel=require(_0xd7ca('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd7ca('0xd'));var toCsv=require(_0xd7ca('0xe'));var querystring=require(_0xd7ca('0xf'));var Papa=require(_0xd7ca('0x10'));var Redis=require(_0xd7ca('0x11'));var authService=require(_0xd7ca('0x12'));var qs=require(_0xd7ca('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd7ca('0x14'));var logger=require(_0xd7ca('0x15'))(_0xd7ca('0x16'));var utils=require(_0xd7ca('0x17'));var config=require(_0xd7ca('0x18'));var licenseUtil=require(_0xd7ca('0x19'));var db=require(_0xd7ca('0x1a'))['db'];function respondWithStatusCode(_0x15920d,_0x3b4d6a){_0x3b4d6a=_0x3b4d6a||0xcc;return function(_0x448761){if(_0x448761){return _0x15920d[_0xd7ca('0x1b')](_0x3b4d6a);}return _0x15920d[_0xd7ca('0x1c')](_0x3b4d6a)[_0xd7ca('0x1d')]();};}function respondWithResult(_0x359d6b,_0x226b85){_0x226b85=_0x226b85||0xc8;return function(_0x71ad50){if(_0x71ad50){return _0x359d6b['status'](_0x226b85)[_0xd7ca('0x1e')](_0x71ad50);}};}function respondWithFilteredResult(_0x48420f,_0x47ca99){return function(_0x277f0b){if(_0x277f0b){var _0x34709e=typeof _0x47ca99['offset']===_0xd7ca('0x1f')&&typeof _0x47ca99[_0xd7ca('0x20')]==='undefined';var _0x3977eb=_0x277f0b[_0xd7ca('0x21')];var _0x368fd8=_0x34709e?0x0:_0x47ca99[_0xd7ca('0x22')];var _0x4043c6=_0x34709e?_0x277f0b[_0xd7ca('0x21')]:_0x47ca99[_0xd7ca('0x22')]+_0x47ca99[_0xd7ca('0x20')];var _0x472935;if(_0x4043c6>=_0x3977eb){_0x4043c6=_0x3977eb;_0x472935=0xc8;}else{_0x472935=0xce;}_0x48420f[_0xd7ca('0x1c')](_0x472935);return _0x48420f['set'](_0xd7ca('0x23'),_0x368fd8+'-'+_0x4043c6+'/'+_0x3977eb)[_0xd7ca('0x1e')](_0x277f0b);}return null;};}function patchUpdates(_0x4f38ff){return function(_0x4dfb5c){try{jsonpatch[_0xd7ca('0x24')](_0x4dfb5c,_0x4f38ff,!![]);}catch(_0x3f8928){return BPromise['reject'](_0x3f8928);}return _0x4dfb5c['save']();};}function saveUpdates(_0x267f75,_0x4ab334){return function(_0x1e29ec){if(_0x1e29ec){return _0x1e29ec[_0xd7ca('0x25')](_0x267f75)['then'](function(_0x29efc0){return _0x29efc0;});}return null;};}function removeEntity(_0x49671b,_0xc6ec5){return function(_0x1042f6){if(_0x1042f6){return _0x1042f6[_0xd7ca('0x26')]()['then'](function(){var _0x109843=_0x1042f6[_0xd7ca('0x27')]({'plain':!![]});var _0x4d4802=_0xd7ca('0x28');return db[_0xd7ca('0x29')]['destroy']({'where':{'type':_0x4d4802,'resourceId':_0x109843['id']}})[_0xd7ca('0x2a')](function(){return _0x1042f6;});})[_0xd7ca('0x2a')](function(){_0x49671b[_0xd7ca('0x1c')](0xcc)[_0xd7ca('0x1d')]();});}};}function handleEntityNotFound(_0x4898a8,_0x30314f){return function(_0x3832f6){if(!_0x3832f6){_0x4898a8[_0xd7ca('0x1b')](0x194);}return _0x3832f6;};}function handleError(_0x26f2ff,_0x23ebe4){_0x23ebe4=_0x23ebe4||0x1f4;return function(_0x2f3441){logger[_0xd7ca('0x2b')](_0x2f3441[_0xd7ca('0x2c')]);if(_0x2f3441[_0xd7ca('0x2d')]){delete _0x2f3441[_0xd7ca('0x2d')];}_0x26f2ff[_0xd7ca('0x1c')](_0x23ebe4)[_0xd7ca('0x2e')](_0x2f3441);};}exports[_0xd7ca('0x2f')]=function(_0x2dc049,_0x2cb225){var _0x4256ef={},_0x54dd4a={},_0x520d3f={'count':0x0,'rows':[]};var _0x4d4480=_[_0xd7ca('0x30')](db['CannedAnswer'][_0xd7ca('0x31')],function(_0x56b961){return{'name':_0x56b961[_0xd7ca('0x32')],'type':_0x56b961[_0xd7ca('0x33')]['key']};});_0x54dd4a[_0xd7ca('0x34')]=_['map'](_0x4d4480,_0xd7ca('0x2d'));_0x54dd4a[_0xd7ca('0x35')]=_[_0xd7ca('0x36')](_0x2dc049[_0xd7ca('0x35')]);_0x54dd4a[_0xd7ca('0x37')]=_[_0xd7ca('0x38')](_0x54dd4a[_0xd7ca('0x34')],_0x54dd4a['query']);_0x4256ef[_0xd7ca('0x39')]=_[_0xd7ca('0x38')](_0x54dd4a[_0xd7ca('0x34')],qs[_0xd7ca('0x3a')](_0x2dc049[_0xd7ca('0x35')][_0xd7ca('0x3a')]));_0x4256ef[_0xd7ca('0x39')]=_0x4256ef[_0xd7ca('0x39')][_0xd7ca('0x3b')]?_0x4256ef[_0xd7ca('0x39')]:_0x54dd4a[_0xd7ca('0x34')];if(!_0x2dc049[_0xd7ca('0x35')][_0xd7ca('0x3c')](_0xd7ca('0x3d'))){_0x4256ef[_0xd7ca('0x20')]=qs[_0xd7ca('0x20')](_0x2dc049[_0xd7ca('0x35')][_0xd7ca('0x20')]);_0x4256ef['offset']=qs[_0xd7ca('0x22')](_0x2dc049[_0xd7ca('0x35')][_0xd7ca('0x22')]);}_0x4256ef[_0xd7ca('0x3e')]=qs[_0xd7ca('0x3f')](_0x2dc049['query'][_0xd7ca('0x3f')]);_0x4256ef[_0xd7ca('0x40')]=qs[_0xd7ca('0x37')](_['pick'](_0x2dc049['query'],_0x54dd4a[_0xd7ca('0x37')]),_0x4d4480);if(_0x2dc049['query']['filter']){_0x4256ef[_0xd7ca('0x40')]=_[_0xd7ca('0x41')](_0x4256ef['where'],{'$or':[{'key':{'$like':'%'+_0x2dc049[_0xd7ca('0x35')][_0xd7ca('0x42')]+'%'}},{'value':{'$like':'%'+_0x2dc049['query'][_0xd7ca('0x42')]+'%'}}]});}_0x4256ef=_['merge']({},_0x4256ef,_0x2dc049[_0xd7ca('0x43')]);var _0x1a0a00={'where':_0x4256ef[_0xd7ca('0x40')]};return db[_0xd7ca('0x44')][_0xd7ca('0x21')](_0x1a0a00)[_0xd7ca('0x2a')](function(_0x1db052){_0x520d3f[_0xd7ca('0x21')]=_0x1db052;if(_0x2dc049[_0xd7ca('0x35')][_0xd7ca('0x45')]){_0x4256ef[_0xd7ca('0x46')]=[{'all':!![]}];}return db[_0xd7ca('0x44')][_0xd7ca('0x47')](_0x4256ef);})[_0xd7ca('0x2a')](function(_0x2e5eda){_0x520d3f[_0xd7ca('0x48')]=_0x2e5eda;return _0x520d3f;})[_0xd7ca('0x2a')](respondWithFilteredResult(_0x2cb225,_0x4256ef))[_0xd7ca('0x49')](handleError(_0x2cb225,null));};exports[_0xd7ca('0x4a')]=function(_0x52f189,_0x19fab2){var _0x1d666c={'raw':!![],'where':{'id':_0x52f189[_0xd7ca('0x4b')]['id']}},_0x59c9c9={};_0x59c9c9[_0xd7ca('0x34')]=_[_0xd7ca('0x36')](db[_0xd7ca('0x44')]['rawAttributes']);_0x59c9c9[_0xd7ca('0x35')]=_[_0xd7ca('0x36')](_0x52f189[_0xd7ca('0x35')]);_0x59c9c9[_0xd7ca('0x37')]=_[_0xd7ca('0x38')](_0x59c9c9[_0xd7ca('0x34')],_0x59c9c9[_0xd7ca('0x35')]);_0x1d666c['attributes']=_[_0xd7ca('0x38')](_0x59c9c9[_0xd7ca('0x34')],qs[_0xd7ca('0x3a')](_0x52f189[_0xd7ca('0x35')]['fields']));_0x1d666c[_0xd7ca('0x39')]=_0x1d666c[_0xd7ca('0x39')][_0xd7ca('0x3b')]?_0x1d666c[_0xd7ca('0x39')]:_0x59c9c9[_0xd7ca('0x34')];if(_0x52f189[_0xd7ca('0x35')][_0xd7ca('0x45')]){_0x1d666c[_0xd7ca('0x46')]=[{'all':!![]}];}_0x1d666c=_['merge']({},_0x1d666c,_0x52f189[_0xd7ca('0x43')]);return db['CannedAnswer'][_0xd7ca('0x4c')](_0x1d666c)[_0xd7ca('0x2a')](handleEntityNotFound(_0x19fab2,null))['then'](respondWithResult(_0x19fab2,null))[_0xd7ca('0x49')](handleError(_0x19fab2,null));};exports[_0xd7ca('0x25')]=function(_0x41ed7c,_0x2511cf){if(_0x41ed7c['body']['id']){delete _0x41ed7c[_0xd7ca('0x4d')]['id'];}return db[_0xd7ca('0x44')][_0xd7ca('0x4c')]({'where':{'id':_0x41ed7c['params']['id']}})['then'](handleEntityNotFound(_0x2511cf,null))[_0xd7ca('0x2a')](saveUpdates(_0x41ed7c[_0xd7ca('0x4d')],null))[_0xd7ca('0x2a')](respondWithResult(_0x2511cf,null))[_0xd7ca('0x49')](handleError(_0x2511cf,null));};exports[_0xd7ca('0x26')]=function(_0x41a450,_0x3aa419){return db['CannedAnswer'][_0xd7ca('0x4c')]({'where':{'id':_0x41a450[_0xd7ca('0x4b')]['id']}})[_0xd7ca('0x2a')](handleEntityNotFound(_0x3aa419,null))['then'](removeEntity(_0x3aa419,null))[_0xd7ca('0x49')](handleError(_0x3aa419,null));};exports[_0xd7ca('0x4e')]=function(_0x361647,_0x3a1442){var _0x21ca56={'key':_0x361647[_0xd7ca('0x4d')][_0xd7ca('0x4f')]};if(_0x361647[_0xd7ca('0x4d')][_0xd7ca('0x50')]){_0x21ca56[_0xd7ca('0x50')]=_0x361647[_0xd7ca('0x4d')][_0xd7ca('0x50')];}else if(_0x361647[_0xd7ca('0x4d')][_0xd7ca('0x51')]){_0x21ca56[_0xd7ca('0x51')]=_0x361647[_0xd7ca('0x4d')]['SmsAccountId'];}else if(_0x361647[_0xd7ca('0x4d')][_0xd7ca('0x52')]){_0x21ca56['OpenchannelAccountId']=_0x361647['body'][_0xd7ca('0x52')];}else if(_0x361647['body'][_0xd7ca('0x53')]){_0x21ca56['ChatWebsiteId']=_0x361647[_0xd7ca('0x4d')][_0xd7ca('0x53')];}return db['CannedAnswer'][_0xd7ca('0x4c')]({'where':_0x21ca56})[_0xd7ca('0x2a')](function(_0x1466ea){if(_0x1466ea){throw new db[(_0xd7ca('0x54'))][(_0xd7ca('0x55'))](_0xd7ca('0x56'));}return db['CannedAnswer'][_0xd7ca('0x4e')](_0x361647[_0xd7ca('0x4d')]);})[_0xd7ca('0x2a')](function(_0x532995){var _0x122094=_0x361647[_0xd7ca('0x57')][_0xd7ca('0x27')]({'plain':!![]});if(!_0x122094)throw new Error(_0xd7ca('0x58'));if(_0x122094[_0xd7ca('0x59')]===_0xd7ca('0x57')){var _0x225df5=_0x532995[_0xd7ca('0x27')]({'plain':!![]});return db[_0xd7ca('0x5a')][_0xd7ca('0x4c')]({'where':{'name':_0xd7ca('0x28'),'userProfileId':_0x122094[_0xd7ca('0x5b')]},'raw':!![]})[_0xd7ca('0x2a')](function(_0x494855){if(_0x494855&&_0x494855[_0xd7ca('0x5c')]===0x0){return db[_0xd7ca('0x29')][_0xd7ca('0x4e')]({'name':_0x225df5[_0xd7ca('0x2d')],'resourceId':_0x225df5['id'],'type':_0x494855[_0xd7ca('0x2d')],'sectionId':_0x494855['id']},{})[_0xd7ca('0x2a')](function(){return _0x532995;});}else{return _0x532995;}})['catch'](function(_0x3aa263){logger[_0xd7ca('0x2b')](_0xd7ca('0x5d'),_0x3aa263);throw _0x3aa263;});}return _0x532995;})['then'](respondWithResult(_0x3a1442,0xc9))['catch'](handleError(_0x3a1442,null));}; \ No newline at end of file +var _0x20ac=['key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','body','find','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../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','get','CannedAnswers','UserProfileResource','error','name','send','index','map','CannedAnswer','rawAttributes'];(function(_0x5aa0c2,_0x42a0ef){var _0x49dbca=function(_0x58f170){while(--_0x58f170){_0x5aa0c2['push'](_0x5aa0c2['shift']());}};_0x49dbca(++_0x42a0ef);}(_0x20ac,0xde));var _0xc20a=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x20ac[_0x381589];return _0x2a075d;};'use strict';var emlformat=require(_0xc20a('0x0'));var rimraf=require(_0xc20a('0x1'));var zipdir=require(_0xc20a('0x2'));var jsonpatch=require(_0xc20a('0x3'));var rp=require(_0xc20a('0x4'));var moment=require('moment');var BPromise=require(_0xc20a('0x5'));var Mustache=require(_0xc20a('0x6'));var util=require(_0xc20a('0x7'));var path=require(_0xc20a('0x8'));var sox=require(_0xc20a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc20a('0xa'));var _=require(_0xc20a('0xb'));var squel=require('squel');var crypto=require(_0xc20a('0xc'));var jsforce=require(_0xc20a('0xd'));var deskjs=require(_0xc20a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc20a('0xf'));var Papa=require('papaparse');var Redis=require(_0xc20a('0x10'));var authService=require(_0xc20a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc20a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc20a('0x13'))(_0xc20a('0x14'));var utils=require('../../config/utils');var config=require(_0xc20a('0x15'));var licenseUtil=require(_0xc20a('0x16'));var db=require(_0xc20a('0x17'))['db'];function respondWithStatusCode(_0x1d31ac,_0x9d6de1){_0x9d6de1=_0x9d6de1||0xcc;return function(_0x2ec8e5){if(_0x2ec8e5){return _0x1d31ac['sendStatus'](_0x9d6de1);}return _0x1d31ac[_0xc20a('0x18')](_0x9d6de1)[_0xc20a('0x19')]();};}function respondWithResult(_0x2dcbc5,_0x3894cd){_0x3894cd=_0x3894cd||0xc8;return function(_0x1fc75a){if(_0x1fc75a){return _0x2dcbc5[_0xc20a('0x18')](_0x3894cd)[_0xc20a('0x1a')](_0x1fc75a);}};}function respondWithFilteredResult(_0x11ecd7,_0x5b2cb2){return function(_0xeed689){if(_0xeed689){var _0x5ad28=typeof _0x5b2cb2[_0xc20a('0x1b')]===_0xc20a('0x1c')&&typeof _0x5b2cb2[_0xc20a('0x1d')]==='undefined';var _0x49afd8=_0xeed689[_0xc20a('0x1e')];var _0x393d8f=_0x5ad28?0x0:_0x5b2cb2[_0xc20a('0x1b')];var _0x44e49f=_0x5ad28?_0xeed689[_0xc20a('0x1e')]:_0x5b2cb2[_0xc20a('0x1b')]+_0x5b2cb2[_0xc20a('0x1d')];var _0x2959f;if(_0x44e49f>=_0x49afd8){_0x44e49f=_0x49afd8;_0x2959f=0xc8;}else{_0x2959f=0xce;}_0x11ecd7[_0xc20a('0x18')](_0x2959f);return _0x11ecd7['set'](_0xc20a('0x1f'),_0x393d8f+'-'+_0x44e49f+'/'+_0x49afd8)['json'](_0xeed689);}return null;};}function patchUpdates(_0x11ccb3){return function(_0x2d3dd2){try{jsonpatch[_0xc20a('0x20')](_0x2d3dd2,_0x11ccb3,!![]);}catch(_0x543158){return BPromise[_0xc20a('0x21')](_0x543158);}return _0x2d3dd2[_0xc20a('0x22')]();};}function saveUpdates(_0x1403d1,_0x29881b){return function(_0x110a8c){if(_0x110a8c){return _0x110a8c[_0xc20a('0x23')](_0x1403d1)['then'](function(_0x4ed2bc){return _0x4ed2bc;});}return null;};}function removeEntity(_0x51594e,_0x232bc7){return function(_0x59e925){if(_0x59e925){return _0x59e925[_0xc20a('0x24')]()[_0xc20a('0x25')](function(){var _0x2c2560=_0x59e925[_0xc20a('0x26')]({'plain':!![]});var _0x23934b=_0xc20a('0x27');return db[_0xc20a('0x28')][_0xc20a('0x24')]({'where':{'type':_0x23934b,'resourceId':_0x2c2560['id']}})[_0xc20a('0x25')](function(){return _0x59e925;});})[_0xc20a('0x25')](function(){_0x51594e[_0xc20a('0x18')](0xcc)[_0xc20a('0x19')]();});}};}function handleEntityNotFound(_0x42657c,_0x52be02){return function(_0x2c59dd){if(!_0x2c59dd){_0x42657c['sendStatus'](0x194);}return _0x2c59dd;};}function handleError(_0xf1acb0,_0x4a034a){_0x4a034a=_0x4a034a||0x1f4;return function(_0x4ab4e8){logger[_0xc20a('0x29')](_0x4ab4e8['stack']);if(_0x4ab4e8[_0xc20a('0x2a')]){delete _0x4ab4e8['name'];}_0xf1acb0[_0xc20a('0x18')](_0x4a034a)[_0xc20a('0x2b')](_0x4ab4e8);};}exports[_0xc20a('0x2c')]=function(_0x333346,_0x2d3c58){var _0x319671={},_0x4e86ed={},_0x275ff8={'count':0x0,'rows':[]};var _0x502248=_[_0xc20a('0x2d')](db[_0xc20a('0x2e')][_0xc20a('0x2f')],function(_0x3a1dd8){return{'name':_0x3a1dd8['fieldName'],'type':_0x3a1dd8['type'][_0xc20a('0x30')]};});_0x4e86ed['model']=_[_0xc20a('0x2d')](_0x502248,'name');_0x4e86ed[_0xc20a('0x31')]=_[_0xc20a('0x32')](_0x333346[_0xc20a('0x31')]);_0x4e86ed[_0xc20a('0x33')]=_[_0xc20a('0x34')](_0x4e86ed[_0xc20a('0x35')],_0x4e86ed[_0xc20a('0x31')]);_0x319671[_0xc20a('0x36')]=_[_0xc20a('0x34')](_0x4e86ed[_0xc20a('0x35')],qs['fields'](_0x333346[_0xc20a('0x31')][_0xc20a('0x37')]));_0x319671['attributes']=_0x319671[_0xc20a('0x36')][_0xc20a('0x38')]?_0x319671[_0xc20a('0x36')]:_0x4e86ed['model'];if(!_0x333346[_0xc20a('0x31')][_0xc20a('0x39')](_0xc20a('0x3a'))){_0x319671[_0xc20a('0x1d')]=qs['limit'](_0x333346[_0xc20a('0x31')][_0xc20a('0x1d')]);_0x319671[_0xc20a('0x1b')]=qs[_0xc20a('0x1b')](_0x333346[_0xc20a('0x31')][_0xc20a('0x1b')]);}_0x319671[_0xc20a('0x3b')]=qs['sort'](_0x333346[_0xc20a('0x31')][_0xc20a('0x3c')]);_0x319671[_0xc20a('0x3d')]=qs[_0xc20a('0x33')](_[_0xc20a('0x3e')](_0x333346[_0xc20a('0x31')],_0x4e86ed[_0xc20a('0x33')]),_0x502248);if(_0x333346['query']['filter']){_0x319671[_0xc20a('0x3d')]=_[_0xc20a('0x3f')](_0x319671[_0xc20a('0x3d')],{'$or':[{'key':{'$like':'%'+_0x333346['query'][_0xc20a('0x40')]+'%'}},{'value':{'$like':'%'+_0x333346['query']['filter']+'%'}}]});}_0x319671=_[_0xc20a('0x3f')]({},_0x319671,_0x333346[_0xc20a('0x41')]);var _0x4c9292={'where':_0x319671['where']};return db['CannedAnswer'][_0xc20a('0x1e')](_0x4c9292)['then'](function(_0x256474){_0x275ff8['count']=_0x256474;if(_0x333346[_0xc20a('0x31')][_0xc20a('0x42')]){_0x319671[_0xc20a('0x43')]=[{'all':!![]}];}return db[_0xc20a('0x2e')][_0xc20a('0x44')](_0x319671);})[_0xc20a('0x25')](function(_0x376fda){_0x275ff8[_0xc20a('0x45')]=_0x376fda;return _0x275ff8;})[_0xc20a('0x25')](respondWithFilteredResult(_0x2d3c58,_0x319671))[_0xc20a('0x46')](handleError(_0x2d3c58,null));};exports[_0xc20a('0x47')]=function(_0x56b0f8,_0x1ddd42){var _0x2bacdf={'raw':!![],'where':{'id':_0x56b0f8[_0xc20a('0x48')]['id']}},_0x176522={};_0x176522[_0xc20a('0x35')]=_[_0xc20a('0x32')](db[_0xc20a('0x2e')][_0xc20a('0x2f')]);_0x176522[_0xc20a('0x31')]=_[_0xc20a('0x32')](_0x56b0f8['query']);_0x176522[_0xc20a('0x33')]=_[_0xc20a('0x34')](_0x176522[_0xc20a('0x35')],_0x176522['query']);_0x2bacdf[_0xc20a('0x36')]=_[_0xc20a('0x34')](_0x176522[_0xc20a('0x35')],qs['fields'](_0x56b0f8[_0xc20a('0x31')]['fields']));_0x2bacdf['attributes']=_0x2bacdf[_0xc20a('0x36')][_0xc20a('0x38')]?_0x2bacdf[_0xc20a('0x36')]:_0x176522['model'];if(_0x56b0f8[_0xc20a('0x31')][_0xc20a('0x42')]){_0x2bacdf[_0xc20a('0x43')]=[{'all':!![]}];}_0x2bacdf=_[_0xc20a('0x3f')]({},_0x2bacdf,_0x56b0f8[_0xc20a('0x41')]);return db[_0xc20a('0x2e')]['find'](_0x2bacdf)[_0xc20a('0x25')](handleEntityNotFound(_0x1ddd42,null))[_0xc20a('0x25')](respondWithResult(_0x1ddd42,null))[_0xc20a('0x46')](handleError(_0x1ddd42,null));};exports[_0xc20a('0x23')]=function(_0x408021,_0x2d3388){if(_0x408021['body']['id']){delete _0x408021[_0xc20a('0x49')]['id'];}return db[_0xc20a('0x2e')][_0xc20a('0x4a')]({'where':{'id':_0x408021[_0xc20a('0x48')]['id']}})['then'](handleEntityNotFound(_0x2d3388,null))['then'](saveUpdates(_0x408021[_0xc20a('0x49')],null))[_0xc20a('0x25')](respondWithResult(_0x2d3388,null))[_0xc20a('0x46')](handleError(_0x2d3388,null));};exports['destroy']=function(_0x1af7a3,_0x3ead6e){return db[_0xc20a('0x2e')][_0xc20a('0x4a')]({'where':{'id':_0x1af7a3['params']['id']}})[_0xc20a('0x25')](handleEntityNotFound(_0x3ead6e,null))[_0xc20a('0x25')](removeEntity(_0x3ead6e,null))[_0xc20a('0x46')](handleError(_0x3ead6e,null));};exports['create']=function(_0x2012ca,_0x254637){var _0x26455a={'key':_0x2012ca[_0xc20a('0x49')][_0xc20a('0x30')]};if(_0x2012ca[_0xc20a('0x49')][_0xc20a('0x4b')]){_0x26455a[_0xc20a('0x4b')]=_0x2012ca[_0xc20a('0x49')][_0xc20a('0x4b')];}else if(_0x2012ca[_0xc20a('0x49')][_0xc20a('0x4c')]){_0x26455a[_0xc20a('0x4c')]=_0x2012ca[_0xc20a('0x49')][_0xc20a('0x4c')];}else if(_0x2012ca[_0xc20a('0x49')][_0xc20a('0x4d')]){_0x26455a['OpenchannelAccountId']=_0x2012ca['body']['OpenchannelAccountId'];}else if(_0x2012ca[_0xc20a('0x49')][_0xc20a('0x4e')]){_0x26455a['ChatWebsiteId']=_0x2012ca[_0xc20a('0x49')][_0xc20a('0x4e')];}return db['CannedAnswer']['find']({'where':_0x26455a})[_0xc20a('0x25')](function(_0x3b333e){if(_0x3b333e){throw new db[(_0xc20a('0x4f'))][(_0xc20a('0x50'))](_0xc20a('0x51'));}return db[_0xc20a('0x2e')]['create'](_0x2012ca[_0xc20a('0x49')]);})[_0xc20a('0x25')](function(_0x317404){var _0x90fc21=_0x2012ca[_0xc20a('0x52')][_0xc20a('0x26')]({'plain':!![]});if(!_0x90fc21)throw new Error(_0xc20a('0x53'));if(_0x90fc21[_0xc20a('0x54')]==='user'){var _0x6e97b2=_0x317404[_0xc20a('0x26')]({'plain':!![]});return db[_0xc20a('0x55')][_0xc20a('0x4a')]({'where':{'name':_0xc20a('0x27'),'userProfileId':_0x90fc21[_0xc20a('0x56')]},'raw':!![]})[_0xc20a('0x25')](function(_0x264355){if(_0x264355&&_0x264355[_0xc20a('0x57')]===0x0){return db[_0xc20a('0x28')][_0xc20a('0x58')]({'name':_0x6e97b2[_0xc20a('0x2a')],'resourceId':_0x6e97b2['id'],'type':_0x264355['name'],'sectionId':_0x264355['id']},{})['then'](function(){return _0x317404;});}else{return _0x317404;}})[_0xc20a('0x46')](function(_0x2f16cd){logger[_0xc20a('0x29')](_0xc20a('0x59'),_0x2f16cd);throw _0x2f16cd;});}return _0x317404;})['then'](respondWithResult(_0x254637,0xc9))[_0xc20a('0x46')](handleError(_0x254637,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index e9aef57..b1a00da 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 _0x0ae6=['CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./cannedAnswer.attributes','exports','define'];(function(_0x3547b0,_0x3b99f9){var _0x5051c4=function(_0x48b1f0){while(--_0x48b1f0){_0x3547b0['push'](_0x3547b0['shift']());}};_0x5051c4(++_0x3b99f9);}(_0x0ae6,0xc7));var _0x60ae=function(_0x544c53,_0x2a5c11){_0x544c53=_0x544c53-0x0;var _0x231480=_0x0ae6[_0x544c53];return _0x231480;};'use strict';var _=require(_0x60ae('0x0'));var util=require(_0x60ae('0x1'));var logger=require('../../config/logger')(_0x60ae('0x2'));var moment=require(_0x60ae('0x3'));var BPromise=require(_0x60ae('0x4'));var rp=require(_0x60ae('0x5'));var fs=require('fs');var path=require(_0x60ae('0x6'));var rimraf=require(_0x60ae('0x7'));var config=require('../../config/environment');var attributes=require(_0x60ae('0x8'));module[_0x60ae('0x9')]=function(_0x571103,_0x57684a){return _0x571103[_0x60ae('0xa')](_0x60ae('0xb'),attributes,{'tableName':_0x60ae('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x60ae('0xd')});}; \ No newline at end of file +var _0x91a7=['utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','path','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers'];(function(_0x187579,_0x2577e4){var _0x4d427c=function(_0x92cfeb){while(--_0x92cfeb){_0x187579['push'](_0x187579['shift']());}};_0x4d427c(++_0x2577e4);}(_0x91a7,0xe7));var _0x791a=function(_0x2ced97,_0x45f6e1){_0x2ced97=_0x2ced97-0x0;var _0x2afc25=_0x91a7[_0x2ced97];return _0x2afc25;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var logger=require(_0x791a('0x1'))(_0x791a('0x2'));var moment=require('moment');var BPromise=require(_0x791a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x791a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x791a('0x5'));module[_0x791a('0x6')]=function(_0x49a9b7,_0x361f53){return _0x49a9b7['define'](_0x791a('0x7'),attributes,{'tableName':_0x791a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x791a('0x9')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 081a985..c25d908 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(_0x4b0b22,_0x66dfe5){var _0x4b2030=function(_0x327196){while(--_0x327196){_0x4b0b22['push'](_0x4b0b22['shift']());}};_0x4b2030(++_0x66dfe5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(_0x4b0e7b,_0x16ec4c){var _0xaf61b9=function(_0x519bac){while(--_0x519bac){_0x4b0e7b['push'](_0x4b0e7b['shift']());}};_0xaf61b9(++_0x16ec4c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 73ced53..9e8e2eb 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 _0x789c=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','put','delete','destroy','multer','util','path','express'];(function(_0x2b1593,_0x1381ae){var _0x177e84=function(_0x35be0f){while(--_0x35be0f){_0x2b1593['push'](_0x2b1593['shift']());}};_0x177e84(++_0x1381ae);}(_0x789c,0x8c));var _0xc789=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x789c[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xc789('0x0'));var util=require(_0xc789('0x1'));var path=require(_0xc789('0x2'));var timeout=require('connect-timeout');var express=require(_0xc789('0x3'));var router=express[_0xc789('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc789('0x5'));var interaction=require(_0xc789('0x6'));var config=require(_0xc789('0x7'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0xc789('0x8')](),controller[_0xc789('0x9')]);router[_0xc789('0xa')](_0xc789('0xb'),auth[_0xc789('0x8')](),controller[_0xc789('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xc789('0xd')](_0xc789('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xc789('0xe')]('/:id',auth[_0xc789('0x8')](),controller[_0xc789('0xf')]);module['exports']=router; \ No newline at end of file +var _0x2fda=['get','isAuthenticated','index','/:id','show','create','put','update','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cannedAnswer.controller'];(function(_0x1b63a5,_0xe8250b){var _0x2ff8f8=function(_0x15ccb0){while(--_0x15ccb0){_0x1b63a5['push'](_0x1b63a5['shift']());}};_0x2ff8f8(++_0xe8250b);}(_0x2fda,0xc9));var _0xa2fd=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x2fda[_0x34bc30];return _0x5706de;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa2fd('0x0'));var timeout=require(_0xa2fd('0x1'));var express=require(_0xa2fd('0x2'));var router=express[_0xa2fd('0x3')]();var fs_extra=require(_0xa2fd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa2fd('0x5'));var config=require('../../config/environment');var controller=require(_0xa2fd('0x6'));router[_0xa2fd('0x7')]('/',auth[_0xa2fd('0x8')](),controller[_0xa2fd('0x9')]);router[_0xa2fd('0x7')](_0xa2fd('0xa'),auth['isAuthenticated'](),controller[_0xa2fd('0xb')]);router['post']('/',auth[_0xa2fd('0x8')](),controller[_0xa2fd('0xc')]);router[_0xa2fd('0xd')](_0xa2fd('0xa'),auth[_0xa2fd('0x8')](),controller[_0xa2fd('0xe')]);router['delete'](_0xa2fd('0xa'),auth[_0xa2fd('0x8')](),controller[_0xa2fd('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 46544d2..3e15007 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 _0xbe85=['STRING','INTEGER','sequelize','exports','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe85,0x19c));var _0x5be8=function(_0x1c1d62,_0x532987){_0x1c1d62=_0x1c1d62-0x0;var _0x153262=_0xbe85[_0x1c1d62];return _0x153262;};'use strict';var Sequelize=require(_0x5be8('0x0'));module[_0x5be8('0x1')]={'calldate':{'type':Sequelize[_0x5be8('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x5be8('0x3')]},'src':{'type':Sequelize[_0x5be8('0x3')]},'dst':{'type':Sequelize[_0x5be8('0x3')]},'dcontext':{'type':Sequelize[_0x5be8('0x3')]},'channel':{'type':Sequelize[_0x5be8('0x3')]},'dstchannel':{'type':Sequelize[_0x5be8('0x3')]},'lastapp':{'type':Sequelize[_0x5be8('0x3')]},'lastdata':{'type':Sequelize[_0x5be8('0x3')]},'duration':{'type':Sequelize[_0x5be8('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x5be8('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5be8('0x3')]},'amaflags':{'type':Sequelize[_0x5be8('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x5be8('0x3')]},'userfield':{'type':Sequelize[_0x5be8('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x5be8('0x3')]},'peeraccount':{'type':Sequelize[_0x5be8('0x3')]},'type':{'type':Sequelize[_0x5be8('0x3')]},'tag':{'type':Sequelize[_0x5be8('0x3')]}}; \ No newline at end of file +var _0xc3b0=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x25b5e4,_0x581442){var _0x2c86c4=function(_0x40b249){while(--_0x40b249){_0x25b5e4['push'](_0x25b5e4['shift']());}};_0x2c86c4(++_0x581442);}(_0xc3b0,0x166));var _0x0c3b=function(_0x19049a,_0x58d980){_0x19049a=_0x19049a-0x0;var _0x4c146f=_0xc3b0[_0x19049a];return _0x4c146f;};'use strict';var Sequelize=require(_0x0c3b('0x0'));module[_0x0c3b('0x1')]={'calldate':{'type':Sequelize[_0x0c3b('0x2')],'allowNull':![],'defaultValue':_0x0c3b('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x0c3b('0x4')]},'dcontext':{'type':Sequelize[_0x0c3b('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x0c3b('0x4')]},'lastapp':{'type':Sequelize[_0x0c3b('0x4')]},'lastdata':{'type':Sequelize[_0x0c3b('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x0c3b('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0c3b('0x4')]},'amaflags':{'type':Sequelize[_0x0c3b('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x0c3b('0x4')]},'sequence':{'type':Sequelize[_0x0c3b('0x4')]},'peeraccount':{'type':Sequelize[_0x0c3b('0x4')]},'type':{'type':Sequelize[_0x0c3b('0x4')]},'tag':{'type':Sequelize[_0x0c3b('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index a730612..ad90aaa 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 _0x1af3=['../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x1a1840,_0x5a8706){var _0x372521=function(_0x561038){while(--_0x561038){_0x1a1840['push'](_0x1a1840['shift']());}};_0x372521(++_0x5a8706);}(_0x1af3,0x1ca));var _0x31af=function(_0x111e94,_0x31c837){_0x111e94=_0x111e94-0x0;var _0x3de107=_0x1af3[_0x111e94];return _0x3de107;};'use strict';var emlformat=require(_0x31af('0x0'));var rimraf=require(_0x31af('0x1'));var zipdir=require(_0x31af('0x2'));var jsonpatch=require(_0x31af('0x3'));var rp=require(_0x31af('0x4'));var moment=require(_0x31af('0x5'));var BPromise=require(_0x31af('0x6'));var Mustache=require(_0x31af('0x7'));var util=require(_0x31af('0x8'));var path=require(_0x31af('0x9'));var sox=require('sox');var csv=require(_0x31af('0xa'));var ejs=require(_0x31af('0xb'));var fs=require('fs');var fs_extra=require(_0x31af('0xc'));var _=require(_0x31af('0xd'));var squel=require('squel');var crypto=require(_0x31af('0xe'));var jsforce=require(_0x31af('0xf'));var deskjs=require(_0x31af('0x10'));var toCsv=require('to-csv');var querystring=require(_0x31af('0x11'));var Papa=require(_0x31af('0x12'));var Redis=require(_0x31af('0x13'));var authService=require(_0x31af('0x14'));var qs=require(_0x31af('0x15'));var as=require(_0x31af('0x16'));var hardwareService=require(_0x31af('0x17'));var logger=require(_0x31af('0x18'))('api');var utils=require(_0x31af('0x19'));var config=require(_0x31af('0x1a'));var licenseUtil=require(_0x31af('0x1b'));var db=require(_0x31af('0x1c'))['db'];function respondWithStatusCode(_0x144406,_0x481f20){_0x481f20=_0x481f20||0xcc;return function(_0x358fb4){if(_0x358fb4){return _0x144406[_0x31af('0x1d')](_0x481f20);}return _0x144406['status'](_0x481f20)['end']();};}function respondWithResult(_0x2a4727,_0x46a494){_0x46a494=_0x46a494||0xc8;return function(_0x14c57e){if(_0x14c57e){return _0x2a4727[_0x31af('0x1e')](_0x46a494)[_0x31af('0x1f')](_0x14c57e);}};}function respondWithFilteredResult(_0x1d35fa,_0x369934){return function(_0x37c275){if(_0x37c275){var _0xd431e4=typeof _0x369934[_0x31af('0x20')]===_0x31af('0x21')&&typeof _0x369934['limit']===_0x31af('0x21');var _0xd33b3f=_0x37c275[_0x31af('0x22')];var _0x477ada=_0xd431e4?0x0:_0x369934[_0x31af('0x20')];var _0x30a112=_0xd431e4?_0x37c275[_0x31af('0x22')]:_0x369934[_0x31af('0x20')]+_0x369934[_0x31af('0x23')];var _0x550870;if(_0x30a112>=_0xd33b3f){_0x30a112=_0xd33b3f;_0x550870=0xc8;}else{_0x550870=0xce;}_0x1d35fa[_0x31af('0x1e')](_0x550870);return _0x1d35fa[_0x31af('0x24')](_0x31af('0x25'),_0x477ada+'-'+_0x30a112+'/'+_0xd33b3f)[_0x31af('0x1f')](_0x37c275);}return null;};}function patchUpdates(_0x414ad8){return function(_0x5d96ca){try{jsonpatch[_0x31af('0x26')](_0x5d96ca,_0x414ad8,!![]);}catch(_0x46b03e){return BPromise[_0x31af('0x27')](_0x46b03e);}return _0x5d96ca[_0x31af('0x28')]();};}function saveUpdates(_0x394d13,_0x14c3f9){return function(_0x1ddfba){if(_0x1ddfba){return _0x1ddfba[_0x31af('0x29')](_0x394d13)[_0x31af('0x2a')](function(_0x6634e3){return _0x6634e3;});}return null;};}function removeEntity(_0x40aa32,_0x1a67e3){return function(_0x3a98d3){if(_0x3a98d3){return _0x3a98d3[_0x31af('0x2b')]()[_0x31af('0x2a')](function(){_0x40aa32['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d3832,_0x20a50c){return function(_0x2b3bad){if(!_0x2b3bad){_0x5d3832['sendStatus'](0x194);}return _0x2b3bad;};}function handleError(_0x4c958,_0x8f9f60){_0x8f9f60=_0x8f9f60||0x1f4;return function(_0x49812a){logger[_0x31af('0x2c')](_0x49812a[_0x31af('0x2d')]);if(_0x49812a['name']){delete _0x49812a[_0x31af('0x2e')];}_0x4c958[_0x31af('0x1e')](_0x8f9f60)[_0x31af('0x2f')](_0x49812a);};}exports[_0x31af('0x30')]=function(_0x3326a7,_0x5a1f41){var _0xb1f5b1={},_0x3eb61f={},_0x1e6df8={'count':0x0,'rows':[]};var _0x1f4eae=_[_0x31af('0x31')](db[_0x31af('0x32')][_0x31af('0x33')],function(_0x231438){return{'name':_0x231438[_0x31af('0x34')],'type':_0x231438[_0x31af('0x35')][_0x31af('0x36')]};});_0x3eb61f[_0x31af('0x37')]=_['map'](_0x1f4eae,_0x31af('0x2e'));_0x3eb61f[_0x31af('0x38')]=_['keys'](_0x3326a7['query']);_0x3eb61f['filters']=_[_0x31af('0x39')](_0x3eb61f['model'],_0x3eb61f[_0x31af('0x38')]);_0xb1f5b1[_0x31af('0x3a')]=_[_0x31af('0x39')](_0x3eb61f[_0x31af('0x37')],qs[_0x31af('0x3b')](_0x3326a7[_0x31af('0x38')]['fields']));_0xb1f5b1[_0x31af('0x3a')]=_0xb1f5b1[_0x31af('0x3a')][_0x31af('0x3c')]?_0xb1f5b1[_0x31af('0x3a')]:_0x3eb61f[_0x31af('0x37')];if(!_0x3326a7[_0x31af('0x38')][_0x31af('0x3d')](_0x31af('0x3e'))){_0xb1f5b1['limit']=qs[_0x31af('0x23')](_0x3326a7['query'][_0x31af('0x23')]);_0xb1f5b1[_0x31af('0x20')]=qs[_0x31af('0x20')](_0x3326a7[_0x31af('0x38')][_0x31af('0x20')]);}_0xb1f5b1['order']=qs['sort'](_0x3326a7['query'][_0x31af('0x3f')]);_0xb1f5b1[_0x31af('0x40')]=qs[_0x31af('0x41')](_[_0x31af('0x42')](_0x3326a7[_0x31af('0x38')],_0x3eb61f[_0x31af('0x41')]),_0x1f4eae);if(_0x3326a7[_0x31af('0x38')][_0x31af('0x43')]){_0xb1f5b1['where']=_[_0x31af('0x44')](_0xb1f5b1[_0x31af('0x40')],{'$or':_[_0x31af('0x31')](_0x1f4eae,function(_0x2a5cde){if(_0x2a5cde[_0x31af('0x35')]!==_0x31af('0x45')){var _0x32d1b9={};_0x32d1b9[_0x2a5cde[_0x31af('0x2e')]]={'$like':'%'+_0x3326a7[_0x31af('0x38')]['filter']+'%'};return _0x32d1b9;}})});}_0xb1f5b1=_[_0x31af('0x44')]({},_0xb1f5b1,_0x3326a7['options']);var _0x447a01={'where':_0xb1f5b1['where']};return db['Cdr'][_0x31af('0x22')](_0x447a01)[_0x31af('0x2a')](function(_0x110f38){_0x1e6df8[_0x31af('0x22')]=_0x110f38;if(_0x3326a7[_0x31af('0x38')][_0x31af('0x46')]){_0xb1f5b1[_0x31af('0x47')]=[{'all':!![]}];}return db['Cdr'][_0x31af('0x48')](_0xb1f5b1);})[_0x31af('0x2a')](function(_0xb53565){_0x1e6df8['rows']=_0xb53565;return _0x1e6df8;})[_0x31af('0x2a')](respondWithFilteredResult(_0x5a1f41,_0xb1f5b1))[_0x31af('0x49')](handleError(_0x5a1f41,null));};exports[_0x31af('0x4a')]=function(_0x23942b,_0x34205a){var _0x57da2c={'raw':!![],'where':{'id':_0x23942b[_0x31af('0x4b')]['id']}},_0x12357c={};_0x12357c[_0x31af('0x37')]=_[_0x31af('0x4c')](db['Cdr'][_0x31af('0x33')]);_0x12357c[_0x31af('0x38')]=_['keys'](_0x23942b[_0x31af('0x38')]);_0x12357c[_0x31af('0x41')]=_[_0x31af('0x39')](_0x12357c[_0x31af('0x37')],_0x12357c[_0x31af('0x38')]);_0x57da2c[_0x31af('0x3a')]=_[_0x31af('0x39')](_0x12357c[_0x31af('0x37')],qs[_0x31af('0x3b')](_0x23942b[_0x31af('0x38')]['fields']));_0x57da2c['attributes']=_0x57da2c[_0x31af('0x3a')]['length']?_0x57da2c[_0x31af('0x3a')]:_0x12357c[_0x31af('0x37')];if(_0x23942b[_0x31af('0x38')]['includeAll']){_0x57da2c['include']=[{'all':!![]}];}_0x57da2c=_[_0x31af('0x44')]({},_0x57da2c,_0x23942b['options']);return db[_0x31af('0x32')][_0x31af('0x4d')](_0x57da2c)[_0x31af('0x2a')](handleEntityNotFound(_0x34205a,null))[_0x31af('0x2a')](respondWithResult(_0x34205a,null))['catch'](handleError(_0x34205a,null));};exports['create']=function(_0x407386,_0x3acff1){return db[_0x31af('0x32')][_0x31af('0x4e')](_0x407386['body'],{})[_0x31af('0x2a')](respondWithResult(_0x3acff1,0xc9))[_0x31af('0x49')](handleError(_0x3acff1,null));};exports[_0x31af('0x29')]=function(_0x4ad7a6,_0x5a1cbe){if(_0x4ad7a6[_0x31af('0x4f')]['id']){delete _0x4ad7a6[_0x31af('0x4f')]['id'];}return db[_0x31af('0x32')][_0x31af('0x4d')]({'where':{'id':_0x4ad7a6[_0x31af('0x4b')]['id']}})[_0x31af('0x2a')](handleEntityNotFound(_0x5a1cbe,null))[_0x31af('0x2a')](saveUpdates(_0x4ad7a6[_0x31af('0x4f')],null))[_0x31af('0x2a')](respondWithResult(_0x5a1cbe,null))[_0x31af('0x49')](handleError(_0x5a1cbe,null));};exports['destroy']=function(_0x441362,_0x29de7e){return db[_0x31af('0x32')][_0x31af('0x4d')]({'where':{'id':_0x441362[_0x31af('0x4b')]['id']}})[_0x31af('0x2a')](handleEntityNotFound(_0x29de7e,null))[_0x31af('0x2a')](removeEntity(_0x29de7e,null))[_0x31af('0x49')](handleError(_0x29de7e,null));};exports[_0x31af('0x50')]=function(_0x25369b,_0x3bfbae){return db[_0x31af('0x32')][_0x31af('0x50')]()[_0x31af('0x2a')](respondWithResult(_0x3bfbae,null))['catch'](handleError(_0x3bfbae,null));}; \ No newline at end of file +var _0xf3cc=['then','destroy','end','stack','name','send','Cdr','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf3cc,0x10d));var _0xcf3c=function(_0x2053aa,_0x3df40e){_0x2053aa=_0x2053aa-0x0;var _0x30f5bb=_0xf3cc[_0x2053aa];return _0x30f5bb;};'use strict';var emlformat=require(_0xcf3c('0x0'));var rimraf=require(_0xcf3c('0x1'));var zipdir=require(_0xcf3c('0x2'));var jsonpatch=require(_0xcf3c('0x3'));var rp=require('request-promise');var moment=require(_0xcf3c('0x4'));var BPromise=require(_0xcf3c('0x5'));var Mustache=require(_0xcf3c('0x6'));var util=require('util');var path=require(_0xcf3c('0x7'));var sox=require(_0xcf3c('0x8'));var csv=require('to-csv');var ejs=require(_0xcf3c('0x9'));var fs=require('fs');var fs_extra=require(_0xcf3c('0xa'));var _=require(_0xcf3c('0xb'));var squel=require(_0xcf3c('0xc'));var crypto=require(_0xcf3c('0xd'));var jsforce=require(_0xcf3c('0xe'));var deskjs=require(_0xcf3c('0xf'));var toCsv=require(_0xcf3c('0x10'));var querystring=require(_0xcf3c('0x11'));var Papa=require(_0xcf3c('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcf3c('0x13'));var as=require(_0xcf3c('0x14'));var hardwareService=require(_0xcf3c('0x15'));var logger=require(_0xcf3c('0x16'))(_0xcf3c('0x17'));var utils=require(_0xcf3c('0x18'));var config=require(_0xcf3c('0x19'));var licenseUtil=require(_0xcf3c('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x245b88,_0x389b0f){_0x389b0f=_0x389b0f||0xcc;return function(_0x59a8dc){if(_0x59a8dc){return _0x245b88[_0xcf3c('0x1b')](_0x389b0f);}return _0x245b88['status'](_0x389b0f)['end']();};}function respondWithResult(_0x56261f,_0x3fd714){_0x3fd714=_0x3fd714||0xc8;return function(_0x598576){if(_0x598576){return _0x56261f[_0xcf3c('0x1c')](_0x3fd714)[_0xcf3c('0x1d')](_0x598576);}};}function respondWithFilteredResult(_0x4e35fc,_0x3e759f){return function(_0x540046){if(_0x540046){var _0x30d023=typeof _0x3e759f[_0xcf3c('0x1e')]===_0xcf3c('0x1f')&&typeof _0x3e759f['limit']===_0xcf3c('0x1f');var _0x190c8c=_0x540046[_0xcf3c('0x20')];var _0x3f6cef=_0x30d023?0x0:_0x3e759f['offset'];var _0x3789b6=_0x30d023?_0x540046[_0xcf3c('0x20')]:_0x3e759f[_0xcf3c('0x1e')]+_0x3e759f[_0xcf3c('0x21')];var _0x3d0e0a;if(_0x3789b6>=_0x190c8c){_0x3789b6=_0x190c8c;_0x3d0e0a=0xc8;}else{_0x3d0e0a=0xce;}_0x4e35fc[_0xcf3c('0x1c')](_0x3d0e0a);return _0x4e35fc[_0xcf3c('0x22')](_0xcf3c('0x23'),_0x3f6cef+'-'+_0x3789b6+'/'+_0x190c8c)[_0xcf3c('0x1d')](_0x540046);}return null;};}function patchUpdates(_0x8e7738){return function(_0x26a26e){try{jsonpatch[_0xcf3c('0x24')](_0x26a26e,_0x8e7738,!![]);}catch(_0x4e80d4){return BPromise[_0xcf3c('0x25')](_0x4e80d4);}return _0x26a26e['save']();};}function saveUpdates(_0x3c9153,_0x1228c1){return function(_0x5dddc1){if(_0x5dddc1){return _0x5dddc1[_0xcf3c('0x26')](_0x3c9153)[_0xcf3c('0x27')](function(_0x328336){return _0x328336;});}return null;};}function removeEntity(_0x1d7e79,_0x32bbd5){return function(_0x3f1771){if(_0x3f1771){return _0x3f1771[_0xcf3c('0x28')]()[_0xcf3c('0x27')](function(){_0x1d7e79['status'](0xcc)[_0xcf3c('0x29')]();});}};}function handleEntityNotFound(_0x4ce43c,_0x2281b6){return function(_0x15b55c){if(!_0x15b55c){_0x4ce43c[_0xcf3c('0x1b')](0x194);}return _0x15b55c;};}function handleError(_0x35e546,_0x181c90){_0x181c90=_0x181c90||0x1f4;return function(_0x43c912){logger['error'](_0x43c912[_0xcf3c('0x2a')]);if(_0x43c912['name']){delete _0x43c912[_0xcf3c('0x2b')];}_0x35e546[_0xcf3c('0x1c')](_0x181c90)[_0xcf3c('0x2c')](_0x43c912);};}exports['index']=function(_0x397996,_0x54174a){var _0x1d8223={},_0xe22e99={},_0x21a329={'count':0x0,'rows':[]};var _0x5bdae3=_['map'](db[_0xcf3c('0x2d')][_0xcf3c('0x2e')],function(_0x1f53ee){return{'name':_0x1f53ee[_0xcf3c('0x2f')],'type':_0x1f53ee['type'][_0xcf3c('0x30')]};});_0xe22e99[_0xcf3c('0x31')]=_[_0xcf3c('0x32')](_0x5bdae3,'name');_0xe22e99[_0xcf3c('0x33')]=_[_0xcf3c('0x34')](_0x397996[_0xcf3c('0x33')]);_0xe22e99['filters']=_[_0xcf3c('0x35')](_0xe22e99[_0xcf3c('0x31')],_0xe22e99[_0xcf3c('0x33')]);_0x1d8223[_0xcf3c('0x36')]=_[_0xcf3c('0x35')](_0xe22e99['model'],qs[_0xcf3c('0x37')](_0x397996['query'][_0xcf3c('0x37')]));_0x1d8223['attributes']=_0x1d8223[_0xcf3c('0x36')][_0xcf3c('0x38')]?_0x1d8223[_0xcf3c('0x36')]:_0xe22e99[_0xcf3c('0x31')];if(!_0x397996[_0xcf3c('0x33')][_0xcf3c('0x39')](_0xcf3c('0x3a'))){_0x1d8223[_0xcf3c('0x21')]=qs['limit'](_0x397996[_0xcf3c('0x33')][_0xcf3c('0x21')]);_0x1d8223[_0xcf3c('0x1e')]=qs[_0xcf3c('0x1e')](_0x397996[_0xcf3c('0x33')][_0xcf3c('0x1e')]);}_0x1d8223[_0xcf3c('0x3b')]=qs[_0xcf3c('0x3c')](_0x397996[_0xcf3c('0x33')][_0xcf3c('0x3c')]);_0x1d8223['where']=qs[_0xcf3c('0x3d')](_['pick'](_0x397996['query'],_0xe22e99['filters']),_0x5bdae3);if(_0x397996[_0xcf3c('0x33')][_0xcf3c('0x3e')]){_0x1d8223[_0xcf3c('0x3f')]=_[_0xcf3c('0x40')](_0x1d8223['where'],{'$or':_['map'](_0x5bdae3,function(_0x27e186){if(_0x27e186[_0xcf3c('0x41')]!==_0xcf3c('0x42')){var _0x9c753f={};_0x9c753f[_0x27e186[_0xcf3c('0x2b')]]={'$like':'%'+_0x397996[_0xcf3c('0x33')]['filter']+'%'};return _0x9c753f;}})});}_0x1d8223=_[_0xcf3c('0x40')]({},_0x1d8223,_0x397996[_0xcf3c('0x43')]);var _0x292c4d={'where':_0x1d8223['where']};return db[_0xcf3c('0x2d')]['count'](_0x292c4d)['then'](function(_0x43ba75){_0x21a329[_0xcf3c('0x20')]=_0x43ba75;if(_0x397996[_0xcf3c('0x33')][_0xcf3c('0x44')]){_0x1d8223[_0xcf3c('0x45')]=[{'all':!![]}];}return db[_0xcf3c('0x2d')][_0xcf3c('0x46')](_0x1d8223);})[_0xcf3c('0x27')](function(_0x245c77){_0x21a329['rows']=_0x245c77;return _0x21a329;})['then'](respondWithFilteredResult(_0x54174a,_0x1d8223))[_0xcf3c('0x47')](handleError(_0x54174a,null));};exports[_0xcf3c('0x48')]=function(_0x4f5b07,_0x3092e4){var _0x48e5f1={'raw':!![],'where':{'id':_0x4f5b07[_0xcf3c('0x49')]['id']}},_0x2831de={};_0x2831de[_0xcf3c('0x31')]=_[_0xcf3c('0x34')](db[_0xcf3c('0x2d')][_0xcf3c('0x2e')]);_0x2831de[_0xcf3c('0x33')]=_[_0xcf3c('0x34')](_0x4f5b07[_0xcf3c('0x33')]);_0x2831de[_0xcf3c('0x3d')]=_[_0xcf3c('0x35')](_0x2831de[_0xcf3c('0x31')],_0x2831de[_0xcf3c('0x33')]);_0x48e5f1[_0xcf3c('0x36')]=_[_0xcf3c('0x35')](_0x2831de[_0xcf3c('0x31')],qs[_0xcf3c('0x37')](_0x4f5b07[_0xcf3c('0x33')]['fields']));_0x48e5f1['attributes']=_0x48e5f1[_0xcf3c('0x36')]['length']?_0x48e5f1[_0xcf3c('0x36')]:_0x2831de[_0xcf3c('0x31')];if(_0x4f5b07[_0xcf3c('0x33')][_0xcf3c('0x44')]){_0x48e5f1[_0xcf3c('0x45')]=[{'all':!![]}];}_0x48e5f1=_['merge']({},_0x48e5f1,_0x4f5b07['options']);return db['Cdr'][_0xcf3c('0x4a')](_0x48e5f1)[_0xcf3c('0x27')](handleEntityNotFound(_0x3092e4,null))['then'](respondWithResult(_0x3092e4,null))[_0xcf3c('0x47')](handleError(_0x3092e4,null));};exports[_0xcf3c('0x4b')]=function(_0x1cfbc9,_0x2800d4){return db[_0xcf3c('0x2d')][_0xcf3c('0x4b')](_0x1cfbc9[_0xcf3c('0x4c')],{})[_0xcf3c('0x27')](respondWithResult(_0x2800d4,0xc9))[_0xcf3c('0x47')](handleError(_0x2800d4,null));};exports[_0xcf3c('0x26')]=function(_0x25d090,_0x2cfc0b){if(_0x25d090['body']['id']){delete _0x25d090[_0xcf3c('0x4c')]['id'];}return db[_0xcf3c('0x2d')][_0xcf3c('0x4a')]({'where':{'id':_0x25d090[_0xcf3c('0x49')]['id']}})['then'](handleEntityNotFound(_0x2cfc0b,null))[_0xcf3c('0x27')](saveUpdates(_0x25d090['body'],null))[_0xcf3c('0x27')](respondWithResult(_0x2cfc0b,null))['catch'](handleError(_0x2cfc0b,null));};exports['destroy']=function(_0x4bba35,_0x5e3abc){return db[_0xcf3c('0x2d')][_0xcf3c('0x4a')]({'where':{'id':_0x4bba35['params']['id']}})[_0xcf3c('0x27')](handleEntityNotFound(_0x5e3abc,null))[_0xcf3c('0x27')](removeEntity(_0x5e3abc,null))[_0xcf3c('0x47')](handleError(_0x5e3abc,null));};exports['describe']=function(_0x5b5e6a,_0x43f2e1){return db[_0xcf3c('0x2d')]['describe']()['then'](respondWithResult(_0x43f2e1,null))['catch'](handleError(_0x43f2e1,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 1893760..7a37167 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(_0x311065,_0x23e18e){var _0x37239c=function(_0x25e121){while(--_0x25e121){_0x311065['push'](_0x311065['shift']());}};_0x37239c(++_0x23e18e);}(_0x7a54,0x106));var _0x47a5=function(_0x9f5f1b,_0xe997f3){_0x9f5f1b=_0x9f5f1b-0x0;var _0x1f4564=_0x7a54[_0x9f5f1b];return _0x1f4564;};'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(_0x2c8756,_0x8642a){var _0x262014=function(_0x2604d1){while(--_0x2604d1){_0x2c8756['push'](_0x2c8756['shift']());}};_0x262014(++_0x8642a);}(_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 66efbfe..1084c56 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 _0x8059=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s'];(function(_0x2aaf3a,_0x251232){var _0x56a096=function(_0x4f5e6e){while(--_0x4f5e6e){_0x2aaf3a['push'](_0x2aaf3a['shift']());}};_0x56a096(++_0x251232);}(_0x8059,0xec));var _0x9805=function(_0x493dda,_0x1528d3){_0x493dda=_0x493dda-0x0;var _0x31a5a6=_0x8059[_0x493dda];return _0x31a5a6;};'use strict';var _=require(_0x9805('0x0'));var util=require(_0x9805('0x1'));var moment=require('moment');var BPromise=require(_0x9805('0x2'));var rs=require(_0x9805('0x3'));var fs=require('fs');var Redis=require(_0x9805('0x4'));var db=require(_0x9805('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9805('0x6'))(_0x9805('0x7'));var config=require(_0x9805('0x8'));var jayson=require(_0x9805('0x9'));var client=jayson[_0x9805('0xa')][_0x9805('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52ffc4,_0x50a8a2,_0x66d938){return new BPromise(function(_0x256d7e,_0x4bf550){return client['request'](_0x52ffc4,_0x66d938)[_0x9805('0xc')](function(_0x1eed81){logger[_0x9805('0xd')](_0x9805('0xe'),_0x50a8a2,_0x9805('0xf'));logger['debug'](_0x9805('0x10'),_0x50a8a2,'request\x20sent',JSON[_0x9805('0x11')](_0x1eed81));if(_0x1eed81['error']){if(_0x1eed81[_0x9805('0x12')][_0x9805('0x13')]===0x1f4){logger[_0x9805('0x12')]('Cdr,\x20%s,\x20%s',_0x50a8a2,_0x1eed81[_0x9805('0x12')]['message']);return _0x4bf550(_0x1eed81[_0x9805('0x12')][_0x9805('0x14')]);}logger[_0x9805('0x12')](_0x9805('0xe'),_0x50a8a2,_0x1eed81[_0x9805('0x12')][_0x9805('0x14')]);return _0x256d7e(_0x1eed81[_0x9805('0x12')][_0x9805('0x14')]);}else{logger[_0x9805('0xd')](_0x9805('0xe'),_0x50a8a2,'request\x20sent');_0x256d7e(_0x1eed81[_0x9805('0x15')][_0x9805('0x14')]);}})[_0x9805('0x16')](function(_0x2f8212){logger[_0x9805('0x12')](_0x9805('0xe'),_0x50a8a2,_0x2f8212);_0x4bf550(_0x2f8212);});});} \ No newline at end of file +var _0xe553=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s'];(function(_0x297d6f,_0x12c8be){var _0x4e0852=function(_0x37780e){while(--_0x37780e){_0x297d6f['push'](_0x297d6f['shift']());}};_0x4e0852(++_0x12c8be);}(_0xe553,0x16b));var _0x3e55=function(_0x4126dc,_0x1430f8){_0x4126dc=_0x4126dc-0x0;var _0xef998b=_0xe553[_0x4126dc];return _0xef998b;};'use strict';var _=require(_0x3e55('0x0'));var util=require(_0x3e55('0x1'));var moment=require(_0x3e55('0x2'));var BPromise=require('bluebird');var rs=require(_0x3e55('0x3'));var fs=require('fs');var Redis=require(_0x3e55('0x4'));var db=require(_0x3e55('0x5'))['db'];var utils=require(_0x3e55('0x6'));var logger=require(_0x3e55('0x7'))(_0x3e55('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3e55('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19347f,_0x2a625b,_0x5e86e0){return new BPromise(function(_0x2d7439,_0x4c09c2){return client['request'](_0x19347f,_0x5e86e0)[_0x3e55('0xa')](function(_0x2c544a){logger[_0x3e55('0xb')](_0x3e55('0xc'),_0x2a625b,_0x3e55('0xd'));logger['debug'](_0x3e55('0xe'),_0x2a625b,_0x3e55('0xd'),JSON[_0x3e55('0xf')](_0x2c544a));if(_0x2c544a[_0x3e55('0x10')]){if(_0x2c544a[_0x3e55('0x10')][_0x3e55('0x11')]===0x1f4){logger[_0x3e55('0x10')](_0x3e55('0xc'),_0x2a625b,_0x2c544a[_0x3e55('0x10')][_0x3e55('0x12')]);return _0x4c09c2(_0x2c544a[_0x3e55('0x10')][_0x3e55('0x12')]);}logger[_0x3e55('0x10')](_0x3e55('0xc'),_0x2a625b,_0x2c544a['error']['message']);return _0x2d7439(_0x2c544a['error']['message']);}else{logger[_0x3e55('0xb')](_0x3e55('0xc'),_0x2a625b,_0x3e55('0xd'));_0x2d7439(_0x2c544a[_0x3e55('0x13')]['message']);}})[_0x3e55('0x14')](function(_0x494d6d){logger[_0x3e55('0x10')](_0x3e55('0xc'),_0x2a625b,_0x494d6d);_0x4c09c2(_0x494d6d);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 4e539c5..afbe32a 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(_0x3ee9b2,_0xa090bb){var _0x51ac3e=function(_0x8ba28d){while(--_0x8ba28d){_0x3ee9b2['push'](_0x3ee9b2['shift']());}};_0x51ac3e(++_0xa090bb);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0xcfeff4,_0x3f2e19){var _0xb2fadc=function(_0x4cd013){while(--_0x4cd013){_0xcfeff4['push'](_0xcfeff4['shift']());}};_0xb2fadc(++_0x3f2e19);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 a9dbe4a..de86ed5 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 _0xafdc=['exports','INTEGER','STRING','noop'];(function(_0x33e5a8,_0x3ca3ec){var _0x53faa4=function(_0x385ddb){while(--_0x385ddb){_0x33e5a8['push'](_0x33e5a8['shift']());}};_0x53faa4(++_0x3ca3ec);}(_0xafdc,0x88));var _0xcafd=function(_0x5b0308,_0x50b860){_0x5b0308=_0x5b0308-0x0;var _0x3f0b49=_0xafdc[_0x5b0308];return _0x3f0b49;};'use strict';var Sequelize=require('sequelize');module[_0xcafd('0x0')]={'priority':{'type':Sequelize[_0xcafd('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xcafd('0x2')],'allowNull':![],'defaultValue':_0xcafd('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xcafd('0x2')]},'interval':{'type':Sequelize[_0xcafd('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xaef2=['TEXT','sequelize','exports','STRING','noop'];(function(_0x2a1011,_0x389595){var _0x28dd3c=function(_0x1a73ae){while(--_0x1a73ae){_0x2a1011['push'](_0x2a1011['shift']());}};_0x28dd3c(++_0x389595);}(_0xaef2,0xc9));var _0x2aef=function(_0x5c3d5e,_0x44d78c){_0x5c3d5e=_0x5c3d5e-0x0;var _0x45cd25=_0xaef2[_0x5c3d5e];return _0x45cd25;};'use strict';var Sequelize=require(_0x2aef('0x0'));module[_0x2aef('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2aef('0x2')],'allowNull':![],'defaultValue':_0x2aef('0x3')},'appdata':{'type':Sequelize[_0x2aef('0x4')]()},'description':{'type':Sequelize[_0x2aef('0x2')]},'interval':{'type':Sequelize[_0x2aef('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 13e9fa5..5dfcaff 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 _0xd9dc=['send','params','model','keys','ChatApplication','rawAttributes','query','filters','attributes','fields','length','includeAll','include','merge','find','update','body','destroy','catch','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','end','sendStatus','error','stack','name'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0xd9dc,0x1be));var _0xcd9d=function(_0x566571,_0x3dc259){_0x566571=_0x566571-0x0;var _0x5b552b=_0xd9dc[_0x566571];return _0x5b552b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd9d('0x0'));var zipdir=require(_0xcd9d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd9d('0x2'));var moment=require(_0xcd9d('0x3'));var BPromise=require(_0xcd9d('0x4'));var Mustache=require('mustache');var util=require(_0xcd9d('0x5'));var path=require(_0xcd9d('0x6'));var sox=require(_0xcd9d('0x7'));var csv=require(_0xcd9d('0x8'));var ejs=require(_0xcd9d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcd9d('0xa'));var squel=require(_0xcd9d('0xb'));var crypto=require(_0xcd9d('0xc'));var jsforce=require(_0xcd9d('0xd'));var deskjs=require(_0xcd9d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcd9d('0xf'));var Papa=require(_0xcd9d('0x10'));var Redis=require(_0xcd9d('0x11'));var authService=require(_0xcd9d('0x12'));var qs=require(_0xcd9d('0x13'));var as=require(_0xcd9d('0x14'));var hardwareService=require(_0xcd9d('0x15'));var logger=require(_0xcd9d('0x16'))('api');var utils=require(_0xcd9d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xcd9d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ec955,_0x3ab0af){_0x3ab0af=_0x3ab0af||0xcc;return function(_0x2fa1d0){if(_0x2fa1d0){return _0x1ec955['sendStatus'](_0x3ab0af);}return _0x1ec955[_0xcd9d('0x19')](_0x3ab0af)['end']();};}function respondWithResult(_0x34bdc8,_0x957089){_0x957089=_0x957089||0xc8;return function(_0x31ddbb){if(_0x31ddbb){return _0x34bdc8['status'](_0x957089)[_0xcd9d('0x1a')](_0x31ddbb);}};}function respondWithFilteredResult(_0x64d51c,_0x50f14d){return function(_0x40d5aa){if(_0x40d5aa){var _0x5a7248=typeof _0x50f14d[_0xcd9d('0x1b')]==='undefined'&&typeof _0x50f14d[_0xcd9d('0x1c')]===_0xcd9d('0x1d');var _0x3a66af=_0x40d5aa[_0xcd9d('0x1e')];var _0x438169=_0x5a7248?0x0:_0x50f14d[_0xcd9d('0x1b')];var _0x24959b=_0x5a7248?_0x40d5aa[_0xcd9d('0x1e')]:_0x50f14d[_0xcd9d('0x1b')]+_0x50f14d[_0xcd9d('0x1c')];var _0x315cf7;if(_0x24959b>=_0x3a66af){_0x24959b=_0x3a66af;_0x315cf7=0xc8;}else{_0x315cf7=0xce;}_0x64d51c['status'](_0x315cf7);return _0x64d51c[_0xcd9d('0x1f')](_0xcd9d('0x20'),_0x438169+'-'+_0x24959b+'/'+_0x3a66af)[_0xcd9d('0x1a')](_0x40d5aa);}return null;};}function patchUpdates(_0x594bd8){return function(_0x2a5848){try{jsonpatch[_0xcd9d('0x21')](_0x2a5848,_0x594bd8,!![]);}catch(_0x376e3e){return BPromise[_0xcd9d('0x22')](_0x376e3e);}return _0x2a5848[_0xcd9d('0x23')]();};}function saveUpdates(_0x2891b6,_0x1e7d4d){return function(_0x12e585){if(_0x12e585){return _0x12e585['update'](_0x2891b6)['then'](function(_0x33d33a){return _0x33d33a;});}return null;};}function removeEntity(_0x222afe,_0x2560fd){return function(_0x474bb4){if(_0x474bb4){return _0x474bb4['destroy']()[_0xcd9d('0x24')](function(){_0x222afe[_0xcd9d('0x19')](0xcc)[_0xcd9d('0x25')]();});}};}function handleEntityNotFound(_0xf0f632,_0x32686a){return function(_0x5ed51f){if(!_0x5ed51f){_0xf0f632[_0xcd9d('0x26')](0x194);}return _0x5ed51f;};}function handleError(_0x1f8579,_0xf21e2){_0xf21e2=_0xf21e2||0x1f4;return function(_0x4ce785){logger[_0xcd9d('0x27')](_0x4ce785[_0xcd9d('0x28')]);if(_0x4ce785[_0xcd9d('0x29')]){delete _0x4ce785['name'];}_0x1f8579[_0xcd9d('0x19')](_0xf21e2)[_0xcd9d('0x2a')](_0x4ce785);};}exports['show']=function(_0x588db6,_0xf84e80){var _0x124da9={'raw':!![],'where':{'id':_0x588db6[_0xcd9d('0x2b')]['id']}},_0x5b1fd6={};_0x5b1fd6[_0xcd9d('0x2c')]=_[_0xcd9d('0x2d')](db[_0xcd9d('0x2e')][_0xcd9d('0x2f')]);_0x5b1fd6['query']=_[_0xcd9d('0x2d')](_0x588db6[_0xcd9d('0x30')]);_0x5b1fd6[_0xcd9d('0x31')]=_['intersection'](_0x5b1fd6[_0xcd9d('0x2c')],_0x5b1fd6[_0xcd9d('0x30')]);_0x124da9[_0xcd9d('0x32')]=_['intersection'](_0x5b1fd6[_0xcd9d('0x2c')],qs[_0xcd9d('0x33')](_0x588db6[_0xcd9d('0x30')][_0xcd9d('0x33')]));_0x124da9['attributes']=_0x124da9['attributes'][_0xcd9d('0x34')]?_0x124da9['attributes']:_0x5b1fd6['model'];if(_0x588db6[_0xcd9d('0x30')][_0xcd9d('0x35')]){_0x124da9[_0xcd9d('0x36')]=[{'all':!![]}];}_0x124da9=_[_0xcd9d('0x37')]({},_0x124da9,_0x588db6['options']);return db['ChatApplication'][_0xcd9d('0x38')](_0x124da9)[_0xcd9d('0x24')](handleEntityNotFound(_0xf84e80,null))[_0xcd9d('0x24')](respondWithResult(_0xf84e80,null))['catch'](handleError(_0xf84e80,null));};exports[_0xcd9d('0x39')]=function(_0x1bd2e8,_0x13553c){if(_0x1bd2e8[_0xcd9d('0x3a')]['id']){delete _0x1bd2e8[_0xcd9d('0x3a')]['id'];}return db[_0xcd9d('0x2e')][_0xcd9d('0x38')]({'where':{'id':_0x1bd2e8[_0xcd9d('0x2b')]['id']}})[_0xcd9d('0x24')](handleEntityNotFound(_0x13553c,null))[_0xcd9d('0x24')](saveUpdates(_0x1bd2e8[_0xcd9d('0x3a')],null))[_0xcd9d('0x24')](respondWithResult(_0x13553c,null))['catch'](handleError(_0x13553c,null));};exports[_0xcd9d('0x3b')]=function(_0x383c1d,_0x5630c7){return db['ChatApplication'][_0xcd9d('0x38')]({'where':{'id':_0x383c1d['params']['id']}})['then'](handleEntityNotFound(_0x5630c7,null))[_0xcd9d('0x24')](removeEntity(_0x5630c7,null))[_0xcd9d('0x3c')](handleError(_0x5630c7,null));}; \ No newline at end of file +var _0x7ee1=['util','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','error','stack','send','show','model','keys','ChatApplication','rawAttributes','query','filters','attributes','intersection','length','includeAll','include','options','find','catch','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x1bf2a7,_0x305e30){var _0x229282=function(_0x459530){while(--_0x459530){_0x1bf2a7['push'](_0x1bf2a7['shift']());}};_0x229282(++_0x305e30);}(_0x7ee1,0xab));var _0x17ee=function(_0x456a41,_0x293538){_0x456a41=_0x456a41-0x0;var _0x3613cc=_0x7ee1[_0x456a41];return _0x3613cc;};'use strict';var emlformat=require(_0x17ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x17ee('0x1'));var jsonpatch=require(_0x17ee('0x2'));var rp=require(_0x17ee('0x3'));var moment=require(_0x17ee('0x4'));var BPromise=require(_0x17ee('0x5'));var Mustache=require('mustache');var util=require(_0x17ee('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x17ee('0x7'));var ejs=require(_0x17ee('0x8'));var fs=require('fs');var fs_extra=require(_0x17ee('0x9'));var _=require(_0x17ee('0xa'));var squel=require(_0x17ee('0xb'));var crypto=require('crypto');var jsforce=require(_0x17ee('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x17ee('0x7'));var querystring=require(_0x17ee('0xd'));var Papa=require('papaparse');var Redis=require(_0x17ee('0xe'));var authService=require(_0x17ee('0xf'));var qs=require(_0x17ee('0x10'));var as=require(_0x17ee('0x11'));var hardwareService=require(_0x17ee('0x12'));var logger=require(_0x17ee('0x13'))(_0x17ee('0x14'));var utils=require(_0x17ee('0x15'));var config=require(_0x17ee('0x16'));var licenseUtil=require(_0x17ee('0x17'));var db=require(_0x17ee('0x18'))['db'];function respondWithStatusCode(_0x372279,_0x5aa625){_0x5aa625=_0x5aa625||0xcc;return function(_0x2a0f19){if(_0x2a0f19){return _0x372279[_0x17ee('0x19')](_0x5aa625);}return _0x372279['status'](_0x5aa625)[_0x17ee('0x1a')]();};}function respondWithResult(_0x53a2c2,_0x2f452e){_0x2f452e=_0x2f452e||0xc8;return function(_0x27447d){if(_0x27447d){return _0x53a2c2[_0x17ee('0x1b')](_0x2f452e)[_0x17ee('0x1c')](_0x27447d);}};}function respondWithFilteredResult(_0x5eebbc,_0x3fa583){return function(_0x749078){if(_0x749078){var _0x1b09a3=typeof _0x3fa583['offset']===_0x17ee('0x1d')&&typeof _0x3fa583[_0x17ee('0x1e')]===_0x17ee('0x1d');var _0x384eaa=_0x749078[_0x17ee('0x1f')];var _0x3785ed=_0x1b09a3?0x0:_0x3fa583[_0x17ee('0x20')];var _0x5506a3=_0x1b09a3?_0x749078['count']:_0x3fa583[_0x17ee('0x20')]+_0x3fa583[_0x17ee('0x1e')];var _0x1f8fb;if(_0x5506a3>=_0x384eaa){_0x5506a3=_0x384eaa;_0x1f8fb=0xc8;}else{_0x1f8fb=0xce;}_0x5eebbc[_0x17ee('0x1b')](_0x1f8fb);return _0x5eebbc['set'](_0x17ee('0x21'),_0x3785ed+'-'+_0x5506a3+'/'+_0x384eaa)[_0x17ee('0x1c')](_0x749078);}return null;};}function patchUpdates(_0x25782c){return function(_0x3ace7f){try{jsonpatch['apply'](_0x3ace7f,_0x25782c,!![]);}catch(_0x2354a5){return BPromise[_0x17ee('0x22')](_0x2354a5);}return _0x3ace7f[_0x17ee('0x23')]();};}function saveUpdates(_0x54daae,_0x3672df){return function(_0x2d0297){if(_0x2d0297){return _0x2d0297[_0x17ee('0x24')](_0x54daae)[_0x17ee('0x25')](function(_0x3aee75){return _0x3aee75;});}return null;};}function removeEntity(_0x4804ea,_0x249a48){return function(_0xc01da5){if(_0xc01da5){return _0xc01da5[_0x17ee('0x26')]()[_0x17ee('0x25')](function(){_0x4804ea[_0x17ee('0x1b')](0xcc)[_0x17ee('0x1a')]();});}};}function handleEntityNotFound(_0x13e8ff,_0x51a282){return function(_0x4f24a8){if(!_0x4f24a8){_0x13e8ff[_0x17ee('0x19')](0x194);}return _0x4f24a8;};}function handleError(_0x1e24bf,_0x34040a){_0x34040a=_0x34040a||0x1f4;return function(_0x32b311){logger[_0x17ee('0x27')](_0x32b311[_0x17ee('0x28')]);if(_0x32b311['name']){delete _0x32b311['name'];}_0x1e24bf[_0x17ee('0x1b')](_0x34040a)[_0x17ee('0x29')](_0x32b311);};}exports[_0x17ee('0x2a')]=function(_0x5ea202,_0x393231){var _0x34b003={'raw':!![],'where':{'id':_0x5ea202['params']['id']}},_0x954455={};_0x954455[_0x17ee('0x2b')]=_[_0x17ee('0x2c')](db[_0x17ee('0x2d')][_0x17ee('0x2e')]);_0x954455['query']=_[_0x17ee('0x2c')](_0x5ea202[_0x17ee('0x2f')]);_0x954455[_0x17ee('0x30')]=_['intersection'](_0x954455[_0x17ee('0x2b')],_0x954455['query']);_0x34b003[_0x17ee('0x31')]=_[_0x17ee('0x32')](_0x954455[_0x17ee('0x2b')],qs['fields'](_0x5ea202[_0x17ee('0x2f')]['fields']));_0x34b003[_0x17ee('0x31')]=_0x34b003[_0x17ee('0x31')][_0x17ee('0x33')]?_0x34b003[_0x17ee('0x31')]:_0x954455['model'];if(_0x5ea202[_0x17ee('0x2f')][_0x17ee('0x34')]){_0x34b003[_0x17ee('0x35')]=[{'all':!![]}];}_0x34b003=_['merge']({},_0x34b003,_0x5ea202[_0x17ee('0x36')]);return db[_0x17ee('0x2d')][_0x17ee('0x37')](_0x34b003)['then'](handleEntityNotFound(_0x393231,null))[_0x17ee('0x25')](respondWithResult(_0x393231,null))[_0x17ee('0x38')](handleError(_0x393231,null));};exports[_0x17ee('0x24')]=function(_0x35602f,_0x1e3c2f){if(_0x35602f[_0x17ee('0x39')]['id']){delete _0x35602f[_0x17ee('0x39')]['id'];}return db[_0x17ee('0x2d')][_0x17ee('0x37')]({'where':{'id':_0x35602f[_0x17ee('0x3a')]['id']}})['then'](handleEntityNotFound(_0x1e3c2f,null))[_0x17ee('0x25')](saveUpdates(_0x35602f[_0x17ee('0x39')],null))[_0x17ee('0x25')](respondWithResult(_0x1e3c2f,null))[_0x17ee('0x38')](handleError(_0x1e3c2f,null));};exports[_0x17ee('0x26')]=function(_0x754d3f,_0x2d6afc){return db[_0x17ee('0x2d')][_0x17ee('0x37')]({'where':{'id':_0x754d3f[_0x17ee('0x3a')]['id']}})[_0x17ee('0x25')](handleEntityNotFound(_0x2d6afc,null))['then'](removeEntity(_0x2d6afc,null))[_0x17ee('0x38')](handleError(_0x2d6afc,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 75a714d..1751119 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 _0xd4f4=['./chatApplication.attributes','exports','define','chat_applications','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5aa0e3,_0x27a0d0){var _0x3483c1=function(_0x4a8a4c){while(--_0x4a8a4c){_0x5aa0e3['push'](_0x5aa0e3['shift']());}};_0x3483c1(++_0x27a0d0);}(_0xd4f4,0x6d));var _0x4d4f=function(_0x410763,_0xb60a9b){_0x410763=_0x410763-0x0;var _0x46f210=_0xd4f4[_0x410763];return _0x46f210;};'use strict';var _=require(_0x4d4f('0x0'));var util=require('util');var logger=require(_0x4d4f('0x1'))(_0x4d4f('0x2'));var moment=require(_0x4d4f('0x3'));var BPromise=require(_0x4d4f('0x4'));var rp=require(_0x4d4f('0x5'));var fs=require('fs');var path=require(_0x4d4f('0x6'));var rimraf=require('rimraf');var config=require(_0x4d4f('0x7'));var attributes=require(_0x4d4f('0x8'));module[_0x4d4f('0x9')]=function(_0x2dc2e7,_0x41efae){return _0x2dc2e7[_0x4d4f('0xa')]('ChatApplication',attributes,{'tableName':_0x4d4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4d4f('0xc')});}; \ No newline at end of file +var _0x587e=['bluebird','request-promise','path','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','lodash','util','../../config/logger','api','moment'];(function(_0x1c5d60,_0x41c949){var _0x5e09be=function(_0x28b010){while(--_0x28b010){_0x1c5d60['push'](_0x1c5d60['shift']());}};_0x5e09be(++_0x41c949);}(_0x587e,0xa3));var _0xe587=function(_0x17ce2f,_0x4ca1f1){_0x17ce2f=_0x17ce2f-0x0;var _0x393d6f=_0x587e[_0x17ce2f];return _0x393d6f;};'use strict';var _=require(_0xe587('0x0'));var util=require(_0xe587('0x1'));var logger=require(_0xe587('0x2'))(_0xe587('0x3'));var moment=require(_0xe587('0x4'));var BPromise=require(_0xe587('0x5'));var rp=require(_0xe587('0x6'));var fs=require('fs');var path=require(_0xe587('0x7'));var rimraf=require('rimraf');var config=require(_0xe587('0x8'));var attributes=require(_0xe587('0x9'));module[_0xe587('0xa')]=function(_0x20e45d,_0x48abcf){return _0x20e45d[_0xe587('0xb')](_0xe587('0xc'),attributes,{'tableName':_0xe587('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 63970af..3eda93a 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 _0x344c=['../../config/environment','jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc'];(function(_0x41c01f,_0x4f3e1c){var _0x32701d=function(_0x547f4b){while(--_0x547f4b){_0x41c01f['push'](_0x41c01f['shift']());}};_0x32701d(++_0x4f3e1c);}(_0x344c,0x117));var _0xc344=function(_0x259b20,_0x3c5446){_0x259b20=_0x259b20-0x0;var _0x324642=_0x344c[_0x259b20];return _0x324642;};'use strict';var _=require(_0xc344('0x0'));var util=require(_0xc344('0x1'));var moment=require(_0xc344('0x2'));var BPromise=require(_0xc344('0x3'));var rs=require(_0xc344('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc344('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc344('0x6'));var config=require(_0xc344('0x7'));var jayson=require(_0xc344('0x8'));var client=jayson[_0xc344('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42cf33,_0x34e8f3,_0x4a8b21){return new BPromise(function(_0x18dcac,_0x5697ae){return client[_0xc344('0xa')](_0x42cf33,_0x4a8b21)[_0xc344('0xb')](function(_0x1cb0e1){logger[_0xc344('0xc')](_0xc344('0xd'),_0x34e8f3,_0xc344('0xe'));logger[_0xc344('0xf')](_0xc344('0x10'),_0x34e8f3,_0xc344('0xe'),JSON['stringify'](_0x1cb0e1));if(_0x1cb0e1[_0xc344('0x11')]){if(_0x1cb0e1['error'][_0xc344('0x12')]===0x1f4){logger[_0xc344('0x11')](_0xc344('0xd'),_0x34e8f3,_0x1cb0e1[_0xc344('0x11')]['message']);return _0x5697ae(_0x1cb0e1['error'][_0xc344('0x13')]);}logger['error'](_0xc344('0xd'),_0x34e8f3,_0x1cb0e1[_0xc344('0x11')][_0xc344('0x13')]);return _0x18dcac(_0x1cb0e1[_0xc344('0x11')]['message']);}else{logger[_0xc344('0xc')](_0xc344('0xd'),_0x34e8f3,'request\x20sent');_0x18dcac(_0x1cb0e1[_0xc344('0x14')]['message']);}})[_0xc344('0x15')](function(_0xb5b3bd){logger[_0xc344('0x11')]('ChatApplication,\x20%s,\x20%s',_0x34e8f3,_0xb5b3bd);_0x5697ae(_0xb5b3bd);});});} \ No newline at end of file +var _0xb9e7=['request','then','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http'];(function(_0x6a13ee,_0x31dea8){var _0x5413be=function(_0x1ae2f8){while(--_0x1ae2f8){_0x6a13ee['push'](_0x6a13ee['shift']());}};_0x5413be(++_0x31dea8);}(_0xb9e7,0x1d9));var _0x7b9e=function(_0x1d94d1,_0x347bb8){_0x1d94d1=_0x1d94d1-0x0;var _0x23c397=_0xb9e7[_0x1d94d1];return _0x23c397;};'use strict';var _=require('lodash');var util=require(_0x7b9e('0x0'));var moment=require(_0x7b9e('0x1'));var BPromise=require(_0x7b9e('0x2'));var rs=require(_0x7b9e('0x3'));var fs=require('fs');var Redis=require(_0x7b9e('0x4'));var db=require(_0x7b9e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7b9e('0x6'));var jayson=require(_0x7b9e('0x7'));var client=jayson[_0x7b9e('0x8')][_0x7b9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x588f3f,_0x14a251,_0x29008f){return new BPromise(function(_0x243b6f,_0x2fc661){return client[_0x7b9e('0xa')](_0x588f3f,_0x29008f)[_0x7b9e('0xb')](function(_0x1e5ecd){logger['info'](_0x7b9e('0xc'),_0x14a251,'request\x20sent');logger[_0x7b9e('0xd')](_0x7b9e('0xe'),_0x14a251,'request\x20sent',JSON[_0x7b9e('0xf')](_0x1e5ecd));if(_0x1e5ecd[_0x7b9e('0x10')]){if(_0x1e5ecd['error']['code']===0x1f4){logger['error'](_0x7b9e('0xc'),_0x14a251,_0x1e5ecd[_0x7b9e('0x10')]['message']);return _0x2fc661(_0x1e5ecd[_0x7b9e('0x10')][_0x7b9e('0x11')]);}logger[_0x7b9e('0x10')](_0x7b9e('0xc'),_0x14a251,_0x1e5ecd[_0x7b9e('0x10')]['message']);return _0x243b6f(_0x1e5ecd[_0x7b9e('0x10')][_0x7b9e('0x11')]);}else{logger[_0x7b9e('0x12')](_0x7b9e('0xc'),_0x14a251,_0x7b9e('0x13'));_0x243b6f(_0x1e5ecd['result'][_0x7b9e('0x11')]);}})[_0x7b9e('0x14')](function(_0x38c9fe){logger[_0x7b9e('0x10')](_0x7b9e('0xc'),_0x14a251,_0x38c9fe);_0x2fc661(_0x38c9fe);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index fa58c4f..e0a25d1 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 _0xaa74=['../../components/auth/service','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','util','path','connect-timeout','Router'];(function(_0x487cad,_0x5ba159){var _0x484e8d=function(_0x3a83d1){while(--_0x3a83d1){_0x487cad['push'](_0x487cad['shift']());}};_0x484e8d(++_0x5ba159);}(_0xaa74,0xc0));var _0x4aa7=function(_0x3f0d11,_0x568808){_0x3f0d11=_0x3f0d11-0x0;var _0xdc0af7=_0xaa74[_0x3f0d11];return _0xdc0af7;};'use strict';var multer=require('multer');var util=require(_0x4aa7('0x0'));var path=require(_0x4aa7('0x1'));var timeout=require(_0x4aa7('0x2'));var express=require('express');var router=express[_0x4aa7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4aa7('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4aa7('0x5'));router[_0x4aa7('0x6')](_0x4aa7('0x7'),auth[_0x4aa7('0x8')](),controller[_0x4aa7('0x9')]);router[_0x4aa7('0xa')](_0x4aa7('0x7'),auth[_0x4aa7('0x8')](),controller[_0x4aa7('0xb')]);router[_0x4aa7('0xc')](_0x4aa7('0x7'),auth[_0x4aa7('0x8')](),controller[_0x4aa7('0xd')]);module['exports']=router; \ No newline at end of file +var _0x6dd6=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x6dd6,0x6e));var _0x66dd=function(_0x26253d,_0x5dfc80){_0x26253d=_0x26253d-0x0;var _0x318a82=_0x6dd6[_0x26253d];return _0x318a82;};'use strict';var multer=require(_0x66dd('0x0'));var util=require(_0x66dd('0x1'));var path=require(_0x66dd('0x2'));var timeout=require(_0x66dd('0x3'));var express=require(_0x66dd('0x4'));var router=express[_0x66dd('0x5')]();var fs_extra=require(_0x66dd('0x6'));var auth=require(_0x66dd('0x7'));var interaction=require(_0x66dd('0x8'));var config=require(_0x66dd('0x9'));var controller=require('./chatApplication.controller');router[_0x66dd('0xa')](_0x66dd('0xb'),auth[_0x66dd('0xc')](),controller[_0x66dd('0xd')]);router[_0x66dd('0xe')](_0x66dd('0xb'),auth[_0x66dd('0xc')](),controller[_0x66dd('0xf')]);router[_0x66dd('0x10')](_0x66dd('0xb'),auth[_0x66dd('0xc')](),controller[_0x66dd('0x11')]);module[_0x66dd('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 9eef057..c610479 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 _0x299a=['exports','STRING','sequelize'];(function(_0xa89062,_0x39415c){var _0x6604ed=function(_0x4ce55b){while(--_0x4ce55b){_0xa89062['push'](_0xa89062['shift']());}};_0x6604ed(++_0x39415c);}(_0x299a,0x161));var _0xa299=function(_0x4f9f72,_0x47cab2){_0x4f9f72=_0x4f9f72-0x0;var _0x2edb06=_0x299a[_0x4f9f72];return _0x2edb06;};'use strict';var Sequelize=require(_0xa299('0x0'));module[_0xa299('0x1')]={'name':{'type':Sequelize[_0xa299('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa299('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x4975=['STRING','BOOLEAN','sequelize'];(function(_0x7c7fa3,_0x1028ea){var _0x378ab7=function(_0x477d05){while(--_0x477d05){_0x7c7fa3['push'](_0x7c7fa3['shift']());}};_0x378ab7(++_0x1028ea);}(_0x4975,0x86));var _0x5497=function(_0x1d6f4d,_0x454598){_0x1d6f4d=_0x1d6f4d-0x0;var _0x38dfef=_0x4975[_0x1d6f4d];return _0x38dfef;};'use strict';var Sequelize=require(_0x5497('0x0'));module['exports']={'name':{'type':Sequelize[_0x5497('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x5497('0x1')]},'write':{'type':Sequelize[_0x5497('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 348aa74..6807993 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 _0x47ed=['api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','User','removeMembers','addMessage','ChatGroupId','findOne','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x38eae1,_0x3e0429){var _0x6611b7=function(_0x4dbb2f){while(--_0x4dbb2f){_0x38eae1['push'](_0x38eae1['shift']());}};_0x6611b7(++_0x3e0429);}(_0x47ed,0xac));var _0xd47e=function(_0xd76974,_0x1526e2){_0xd76974=_0xd76974-0x0;var _0x3b4a03=_0x47ed[_0xd76974];return _0x3b4a03;};'use strict';var emlformat=require(_0xd47e('0x0'));var rimraf=require(_0xd47e('0x1'));var zipdir=require(_0xd47e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd47e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd47e('0x4'));var path=require(_0xd47e('0x5'));var sox=require(_0xd47e('0x6'));var csv=require(_0xd47e('0x7'));var ejs=require(_0xd47e('0x8'));var fs=require('fs');var fs_extra=require(_0xd47e('0x9'));var _=require(_0xd47e('0xa'));var squel=require(_0xd47e('0xb'));var crypto=require(_0xd47e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd47e('0xd'));var toCsv=require(_0xd47e('0x7'));var querystring=require(_0xd47e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd47e('0xf'));var qs=require(_0xd47e('0x10'));var as=require(_0xd47e('0x11'));var hardwareService=require(_0xd47e('0x12'));var logger=require(_0xd47e('0x13'))(_0xd47e('0x14'));var utils=require('../../config/utils');var config=require(_0xd47e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd47e('0x16'))['db'];config[_0xd47e('0x17')]=_[_0xd47e('0x18')](config['redis'],{'host':_0xd47e('0x19'),'port':0x18eb});var socket=require(_0xd47e('0x1a'))(new Redis(config['redis']));require('./chatGroup.socket')[_0xd47e('0x1b')](socket);function respondWithStatusCode(_0x5e036f,_0x3893c0){_0x3893c0=_0x3893c0||0xcc;return function(_0x54b4a0){if(_0x54b4a0){return _0x5e036f[_0xd47e('0x1c')](_0x3893c0);}return _0x5e036f[_0xd47e('0x1d')](_0x3893c0)['end']();};}function respondWithResult(_0x27818d,_0x2422f0){_0x2422f0=_0x2422f0||0xc8;return function(_0x1ef43f){if(_0x1ef43f){return _0x27818d[_0xd47e('0x1d')](_0x2422f0)[_0xd47e('0x1e')](_0x1ef43f);}};}function respondWithFilteredResult(_0x277789,_0x16a87d){return function(_0x20a462){if(_0x20a462){var _0x37fa28=typeof _0x16a87d[_0xd47e('0x1f')]==='undefined'&&typeof _0x16a87d[_0xd47e('0x20')]==='undefined';var _0x3c82af=_0x20a462[_0xd47e('0x21')];var _0x5c7d79=_0x37fa28?0x0:_0x16a87d['offset'];var _0x29c63e=_0x37fa28?_0x20a462['count']:_0x16a87d['offset']+_0x16a87d['limit'];var _0x4377de;if(_0x29c63e>=_0x3c82af){_0x29c63e=_0x3c82af;_0x4377de=0xc8;}else{_0x4377de=0xce;}_0x277789[_0xd47e('0x1d')](_0x4377de);return _0x277789[_0xd47e('0x22')](_0xd47e('0x23'),_0x5c7d79+'-'+_0x29c63e+'/'+_0x3c82af)['json'](_0x20a462);}return null;};}function patchUpdates(_0x359a11){return function(_0x5908a3){try{jsonpatch[_0xd47e('0x24')](_0x5908a3,_0x359a11,!![]);}catch(_0x55d20a){return BPromise[_0xd47e('0x25')](_0x55d20a);}return _0x5908a3['save']();};}function saveUpdates(_0x360c32,_0x1a83ee){return function(_0x4c33a5){if(_0x4c33a5){return _0x4c33a5[_0xd47e('0x26')](_0x360c32)[_0xd47e('0x27')](function(_0x15a104){return _0x15a104;});}return null;};}function removeEntity(_0x1241c8,_0x476687){return function(_0x352fd7){if(_0x352fd7){return _0x352fd7[_0xd47e('0x28')]()['then'](function(){_0x1241c8[_0xd47e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f0641,_0x1c7a82){return function(_0x18903b){if(!_0x18903b){_0x5f0641['sendStatus'](0x194);}return _0x18903b;};}function handleError(_0x4f25e4,_0x5507b6){_0x5507b6=_0x5507b6||0x1f4;return function(_0x3fd468){logger[_0xd47e('0x29')](_0x3fd468['stack']);if(_0x3fd468[_0xd47e('0x2a')]){delete _0x3fd468[_0xd47e('0x2a')];}_0x4f25e4[_0xd47e('0x1d')](_0x5507b6)[_0xd47e('0x2b')](_0x3fd468);};}exports[_0xd47e('0x2c')]=function(_0x49bbfe,_0x26afa6){var _0x32f69b={},_0x164a34={},_0x1fa475={'count':0x0,'rows':[]};var _0x14d83b=_[_0xd47e('0x2d')](db[_0xd47e('0x2e')][_0xd47e('0x2f')],function(_0x40d12f){return{'name':_0x40d12f[_0xd47e('0x30')],'type':_0x40d12f[_0xd47e('0x31')][_0xd47e('0x32')]};});_0x164a34[_0xd47e('0x33')]=_[_0xd47e('0x2d')](_0x14d83b,_0xd47e('0x2a'));_0x164a34['query']=_[_0xd47e('0x34')](_0x49bbfe['query']);_0x164a34[_0xd47e('0x35')]=_[_0xd47e('0x36')](_0x164a34[_0xd47e('0x33')],_0x164a34[_0xd47e('0x37')]);_0x32f69b[_0xd47e('0x38')]=_[_0xd47e('0x36')](_0x164a34[_0xd47e('0x33')],qs[_0xd47e('0x39')](_0x49bbfe['query']['fields']));_0x32f69b[_0xd47e('0x38')]=_0x32f69b[_0xd47e('0x38')][_0xd47e('0x3a')]?_0x32f69b[_0xd47e('0x38')]:_0x164a34[_0xd47e('0x33')];if(!_0x49bbfe[_0xd47e('0x37')][_0xd47e('0x3b')](_0xd47e('0x3c'))){_0x32f69b['limit']=qs[_0xd47e('0x20')](_0x49bbfe[_0xd47e('0x37')]['limit']);_0x32f69b[_0xd47e('0x1f')]=qs[_0xd47e('0x1f')](_0x49bbfe[_0xd47e('0x37')][_0xd47e('0x1f')]);}_0x32f69b[_0xd47e('0x3d')]=qs[_0xd47e('0x3e')](_0x49bbfe['query'][_0xd47e('0x3e')]);_0x32f69b['where']=qs[_0xd47e('0x35')](_[_0xd47e('0x3f')](_0x49bbfe[_0xd47e('0x37')],_0x164a34[_0xd47e('0x35')]),_0x14d83b);if(_0x49bbfe[_0xd47e('0x37')]['filter']){_0x32f69b[_0xd47e('0x40')]=_[_0xd47e('0x41')](_0x32f69b['where'],{'$or':_[_0xd47e('0x2d')](_0x14d83b,function(_0xee7294){if(_0xee7294[_0xd47e('0x31')]!=='VIRTUAL'){var _0x1fb8bf={};_0x1fb8bf[_0xee7294[_0xd47e('0x2a')]]={'$like':'%'+_0x49bbfe['query'][_0xd47e('0x42')]+'%'};return _0x1fb8bf;}})});}_0x32f69b=_[_0xd47e('0x41')]({},_0x32f69b,_0x49bbfe[_0xd47e('0x43')]);var _0x4ffabb={'where':_0x32f69b[_0xd47e('0x40')]};return db[_0xd47e('0x2e')][_0xd47e('0x21')](_0x4ffabb)[_0xd47e('0x27')](function(_0x67787d){_0x1fa475[_0xd47e('0x21')]=_0x67787d;if(_0x49bbfe['query'][_0xd47e('0x44')]){_0x32f69b['include']=[{'all':!![]}];}return db[_0xd47e('0x2e')][_0xd47e('0x45')](_0x32f69b);})['then'](function(_0x1e3b9a){_0x1fa475[_0xd47e('0x46')]=_0x1e3b9a;return _0x1fa475;})[_0xd47e('0x27')](respondWithFilteredResult(_0x26afa6,_0x32f69b))[_0xd47e('0x47')](handleError(_0x26afa6,null));};exports[_0xd47e('0x48')]=function(_0xefd94b,_0x2262fb){var _0x57c0c6={'raw':!![],'where':{'id':_0xefd94b[_0xd47e('0x49')]['id']}},_0x3d813d={};_0x3d813d[_0xd47e('0x33')]=_[_0xd47e('0x34')](db[_0xd47e('0x2e')][_0xd47e('0x2f')]);_0x3d813d['query']=_[_0xd47e('0x34')](_0xefd94b[_0xd47e('0x37')]);_0x3d813d[_0xd47e('0x35')]=_[_0xd47e('0x36')](_0x3d813d[_0xd47e('0x33')],_0x3d813d['query']);_0x57c0c6[_0xd47e('0x38')]=_[_0xd47e('0x36')](_0x3d813d[_0xd47e('0x33')],qs[_0xd47e('0x39')](_0xefd94b[_0xd47e('0x37')][_0xd47e('0x39')]));_0x57c0c6['attributes']=_0x57c0c6['attributes']['length']?_0x57c0c6[_0xd47e('0x38')]:_0x3d813d[_0xd47e('0x33')];if(_0xefd94b[_0xd47e('0x37')]['includeAll']){_0x57c0c6[_0xd47e('0x4a')]=[{'all':!![]}];}_0x57c0c6=_[_0xd47e('0x41')]({},_0x57c0c6,_0xefd94b[_0xd47e('0x43')]);return db[_0xd47e('0x2e')][_0xd47e('0x4b')](_0x57c0c6)['then'](handleEntityNotFound(_0x2262fb,null))['then'](respondWithResult(_0x2262fb,null))['catch'](handleError(_0x2262fb,null));};exports[_0xd47e('0x4c')]=function(_0x57ec34,_0x463cf7){return db[_0xd47e('0x2e')][_0xd47e('0x4c')](_0x57ec34[_0xd47e('0x4d')],{})[_0xd47e('0x27')](respondWithResult(_0x463cf7,0xc9))[_0xd47e('0x47')](handleError(_0x463cf7,null));};exports[_0xd47e('0x26')]=function(_0x482109,_0x521e08){if(_0x482109[_0xd47e('0x4d')]['id']){delete _0x482109['body']['id'];}return db[_0xd47e('0x2e')][_0xd47e('0x4b')]({'where':{'id':_0x482109[_0xd47e('0x49')]['id']}})[_0xd47e('0x27')](handleEntityNotFound(_0x521e08,null))[_0xd47e('0x27')](saveUpdates(_0x482109[_0xd47e('0x4d')],null))[_0xd47e('0x27')](respondWithResult(_0x521e08,null))[_0xd47e('0x47')](handleError(_0x521e08,null));};exports[_0xd47e('0x28')]=function(_0x2c157b,_0x37aa9b){return db[_0xd47e('0x2e')][_0xd47e('0x4b')]({'where':{'id':_0x2c157b['params']['id']}})[_0xd47e('0x27')](handleEntityNotFound(_0x37aa9b,null))[_0xd47e('0x27')](removeEntity(_0x37aa9b,null))['catch'](handleError(_0x37aa9b,null));};exports[_0xd47e('0x4e')]=function(_0xdd2c73,_0x3e3686){return db[_0xd47e('0x2e')]['describe']()[_0xd47e('0x27')](respondWithResult(_0x3e3686,null))[_0xd47e('0x47')](handleError(_0x3e3686,null));};exports[_0xd47e('0x4f')]=function(_0x5bb3b9,_0x4b57c6,_0x283483){return db[_0xd47e('0x50')][_0xd47e('0x21')]({'where':{'ChatGroupId':_0x5bb3b9[_0xd47e('0x49')]['id'],'ToId':_0x5bb3b9[_0xd47e('0x51')]['id'],'read':![]}})[_0xd47e('0x27')](function(_0x1d4038){return{'id':_[_0xd47e('0x52')](_0x5bb3b9['params']['id']),'count':_0x1d4038};})[_0xd47e('0x27')](respondWithResult(_0x4b57c6,null))['catch'](handleError(_0x4b57c6,null));};exports[_0xd47e('0x53')]=function(_0x31057a,_0x3f384e,_0x1fc7b1){return db[_0xd47e('0x2e')][_0xd47e('0x4b')]({'where':{'id':_0x31057a['params']['id']}})[_0xd47e('0x27')](handleEntityNotFound(_0x3f384e,null))[_0xd47e('0x27')](function(_0x2de51f){if(_0x2de51f){return _0x2de51f[_0xd47e('0x53')](_0x31057a[_0xd47e('0x4d')][_0xd47e('0x54')],_[_0xd47e('0x55')](_0x31057a['body'],['ids','id'])||{});}})[_0xd47e('0x27')](respondWithResult(_0x3f384e,null))[_0xd47e('0x47')](handleError(_0x3f384e,null));};exports[_0xd47e('0x56')]=function(_0x52ad75,_0x3785ef,_0x59dc50){var _0x280376={};var _0x42fb12={};var _0x2dfe2b;var _0x409b74;return db[_0xd47e('0x2e')]['findOne']({'where':{'id':_0x52ad75[_0xd47e('0x49')]['id']}})[_0xd47e('0x27')](handleEntityNotFound(_0x3785ef,null))['then'](function(_0x5a1a81){if(_0x5a1a81){_0x2dfe2b=_0x5a1a81;_0x42fb12[_0xd47e('0x33')]=_['keys'](db[_0xd47e('0x57')][_0xd47e('0x2f')]);_0x42fb12[_0xd47e('0x37')]=_[_0xd47e('0x34')](_0x52ad75[_0xd47e('0x37')]);_0x42fb12[_0xd47e('0x35')]=_[_0xd47e('0x36')](_0x42fb12['model'],_0x42fb12['query']);_0x280376[_0xd47e('0x38')]=_[_0xd47e('0x36')](_0x42fb12['model'],qs[_0xd47e('0x39')](_0x52ad75[_0xd47e('0x37')][_0xd47e('0x39')]));_0x280376[_0xd47e('0x38')]=_0x280376[_0xd47e('0x38')][_0xd47e('0x3a')]?_0x280376[_0xd47e('0x38')]:_0x42fb12[_0xd47e('0x33')];_0x280376[_0xd47e('0x3d')]=qs[_0xd47e('0x3e')](_0x52ad75[_0xd47e('0x37')][_0xd47e('0x3e')]);_0x280376[_0xd47e('0x40')]=qs[_0xd47e('0x35')](_[_0xd47e('0x3f')](_0x52ad75[_0xd47e('0x37')],_0x42fb12[_0xd47e('0x35')]));if(_0x52ad75['query'][_0xd47e('0x42')]){_0x280376[_0xd47e('0x40')]=_[_0xd47e('0x41')](_0x280376['where'],{'$or':_[_0xd47e('0x2d')](_0x280376['attributes'],function(_0x33f910){var _0x3c64cf={};_0x3c64cf[_0x33f910]={'$like':'%'+_0x52ad75[_0xd47e('0x37')][_0xd47e('0x42')]+'%'};return _0x3c64cf;})});}_0x280376=_[_0xd47e('0x41')]({},_0x280376,_0x52ad75[_0xd47e('0x43')]);return _0x2dfe2b[_0xd47e('0x56')](_0x280376);}})['then'](function(_0x43b802){if(_0x43b802){_0x409b74=_0x43b802[_0xd47e('0x3a')];if(!_0x52ad75[_0xd47e('0x37')][_0xd47e('0x3b')]('nolimit')){_0x280376[_0xd47e('0x20')]=qs[_0xd47e('0x20')](_0x52ad75[_0xd47e('0x37')][_0xd47e('0x20')]);_0x280376['offset']=qs[_0xd47e('0x1f')](_0x52ad75[_0xd47e('0x37')][_0xd47e('0x1f')]);}return _0x2dfe2b['getMembers'](_0x280376);}})[_0xd47e('0x27')](function(_0x40769e){if(_0x40769e){return _0x40769e?{'count':_0x409b74,'rows':_0x40769e}:null;}})[_0xd47e('0x27')](respondWithResult(_0x3785ef,null))[_0xd47e('0x47')](handleError(_0x3785ef,null));};exports[_0xd47e('0x58')]=function(_0x1cba31,_0x2ea866,_0x4f5f03){return db['ChatGroup']['find']({'where':{'id':_0x1cba31[_0xd47e('0x49')]['id']}})[_0xd47e('0x27')](handleEntityNotFound(_0x2ea866,null))[_0xd47e('0x27')](function(_0x184c73){if(_0x184c73){return _0x184c73['removeMembers'](_0x1cba31[_0xd47e('0x37')][_0xd47e('0x54')]);}})[_0xd47e('0x27')](respondWithStatusCode(_0x2ea866,null))[_0xd47e('0x47')](handleError(_0x2ea866,null));};exports[_0xd47e('0x59')]=function(_0x2ee2c9,_0x5680f4,_0x3565e9){if(_0x2ee2c9[_0xd47e('0x4d')]['id']){delete _0x2ee2c9[_0xd47e('0x4d')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x2ee2c9[_0xd47e('0x49')]['id']}})[_0xd47e('0x27')](handleEntityNotFound(_0x5680f4,null))['then'](function(_0x2db2ce){if(_0x2db2ce){_0x2ee2c9[_0xd47e('0x4d')][_0xd47e('0x5a')]=_0x2db2ce['id'];return db[_0xd47e('0x50')][_0xd47e('0x4c')](_0x2ee2c9[_0xd47e('0x4d')]);}})[_0xd47e('0x27')](respondWithResult(_0x5680f4,null))[_0xd47e('0x47')](handleError(_0x5680f4,null));};exports['getMessages']=function(_0x42b529,_0x5a507b,_0x1aa93d){var _0x196a5e={};var _0x3c0e1a={};var _0x1b83e4;var _0x1dfc69;return db[_0xd47e('0x2e')][_0xd47e('0x5b')]({'where':{'id':_0x42b529[_0xd47e('0x49')]['id']}})[_0xd47e('0x27')](handleEntityNotFound(_0x5a507b,null))[_0xd47e('0x27')](function(_0x6d05e7){if(_0x6d05e7){_0x1b83e4=_0x6d05e7;_0x3c0e1a[_0xd47e('0x33')]=_[_0xd47e('0x34')](db[_0xd47e('0x50')][_0xd47e('0x2f')]);_0x3c0e1a[_0xd47e('0x37')]=_[_0xd47e('0x34')](_0x42b529['query']);_0x3c0e1a[_0xd47e('0x35')]=_['intersection'](_0x3c0e1a[_0xd47e('0x33')],_0x3c0e1a['query']);_0x196a5e[_0xd47e('0x38')]=_[_0xd47e('0x36')](_0x3c0e1a[_0xd47e('0x33')],qs[_0xd47e('0x39')](_0x42b529[_0xd47e('0x37')][_0xd47e('0x39')]));_0x196a5e[_0xd47e('0x38')]=_0x196a5e[_0xd47e('0x38')]['length']?_0x196a5e[_0xd47e('0x38')]:_0x3c0e1a[_0xd47e('0x33')];_0x196a5e[_0xd47e('0x3d')]=qs[_0xd47e('0x3e')](_0x42b529['query'][_0xd47e('0x3e')]);_0x196a5e[_0xd47e('0x40')]=qs['filters'](_[_0xd47e('0x3f')](_0x42b529[_0xd47e('0x37')],_0x3c0e1a[_0xd47e('0x35')]));if(_0x42b529[_0xd47e('0x37')]['filter']){_0x196a5e[_0xd47e('0x40')]=_[_0xd47e('0x41')](_0x196a5e[_0xd47e('0x40')],{'$or':_[_0xd47e('0x2d')](_0x196a5e[_0xd47e('0x38')],function(_0x4b871e){var _0x43135a={};_0x43135a[_0x4b871e]={'$like':'%'+_0x42b529[_0xd47e('0x37')][_0xd47e('0x42')]+'%'};return _0x43135a;})});}if(_0x42b529[_0xd47e('0x37')]['$gte']){var _0x186d4d=_0x42b529['query'][_0xd47e('0x5c')][_0xd47e('0x5d')](',');var _0x3ee7ab={};_0x3ee7ab[_0x186d4d[0x0]]={'$gte':moment(_0x186d4d[0x1])['format'](_0xd47e('0x5e'))};_0x196a5e[_0xd47e('0x40')]=_[_0xd47e('0x41')](_0x196a5e['where'],_0x3ee7ab);}_0x196a5e=_['merge']({},_0x196a5e,_0x42b529['options']);return _0x1b83e4[_0xd47e('0x5f')](_0x196a5e);}})['then'](function(_0x4aa02c){if(_0x4aa02c){_0x1dfc69=_0x4aa02c['length'];if(!_0x42b529[_0xd47e('0x37')][_0xd47e('0x3b')](_0xd47e('0x3c'))){_0x196a5e[_0xd47e('0x20')]=qs[_0xd47e('0x20')](_0x42b529[_0xd47e('0x37')][_0xd47e('0x20')]);_0x196a5e['offset']=qs[_0xd47e('0x1f')](_0x42b529[_0xd47e('0x37')]['offset']);}return _0x1b83e4[_0xd47e('0x5f')](_0x196a5e);}})['then'](function(_0x376c5b){if(_0x376c5b){return _0x376c5b?{'count':_0x1dfc69,'rows':_0x376c5b}:null;}})[_0xd47e('0x27')](respondWithResult(_0x5a507b,null))[_0xd47e('0x47')](handleError(_0x5a507b,null));}; \ No newline at end of file +var _0xc32f=['sendStatus','error','stack','name','index','map','rawAttributes','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','options','ChatGroup','include','findAll','rows','catch','show','params','includeAll','merge','find','create','body','update','destroy','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','findOne','User','order','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then'];(function(_0x389318,_0x13a53d){var _0x7919e3=function(_0x2985d1){while(--_0x2985d1){_0x389318['push'](_0x389318['shift']());}};_0x7919e3(++_0x13a53d);}(_0xc32f,0x15c));var _0xfc32=function(_0x47bf99,_0x19f81f){_0x47bf99=_0x47bf99-0x0;var _0x24e2c=_0xc32f[_0x47bf99];return _0x24e2c;};'use strict';var emlformat=require(_0xfc32('0x0'));var rimraf=require(_0xfc32('0x1'));var zipdir=require(_0xfc32('0x2'));var jsonpatch=require(_0xfc32('0x3'));var rp=require(_0xfc32('0x4'));var moment=require(_0xfc32('0x5'));var BPromise=require(_0xfc32('0x6'));var Mustache=require(_0xfc32('0x7'));var util=require('util');var path=require(_0xfc32('0x8'));var sox=require(_0xfc32('0x9'));var csv=require('to-csv');var ejs=require(_0xfc32('0xa'));var fs=require('fs');var fs_extra=require(_0xfc32('0xb'));var _=require('lodash');var squel=require(_0xfc32('0xc'));var crypto=require(_0xfc32('0xd'));var jsforce=require(_0xfc32('0xe'));var deskjs=require(_0xfc32('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfc32('0x10'));var Papa=require(_0xfc32('0x11'));var Redis=require(_0xfc32('0x12'));var authService=require(_0xfc32('0x13'));var qs=require(_0xfc32('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xfc32('0x15'));var config=require(_0xfc32('0x16'));var licenseUtil=require(_0xfc32('0x17'));var db=require(_0xfc32('0x18'))['db'];config[_0xfc32('0x19')]=_[_0xfc32('0x1a')](config[_0xfc32('0x19')],{'host':_0xfc32('0x1b'),'port':0x18eb});var socket=require(_0xfc32('0x1c'))(new Redis(config[_0xfc32('0x19')]));require(_0xfc32('0x1d'))[_0xfc32('0x1e')](socket);function respondWithStatusCode(_0x1e7a1f,_0x5097a4){_0x5097a4=_0x5097a4||0xcc;return function(_0x5a5b64){if(_0x5a5b64){return _0x1e7a1f['sendStatus'](_0x5097a4);}return _0x1e7a1f[_0xfc32('0x1f')](_0x5097a4)[_0xfc32('0x20')]();};}function respondWithResult(_0x472730,_0x15f95d){_0x15f95d=_0x15f95d||0xc8;return function(_0x653c28){if(_0x653c28){return _0x472730['status'](_0x15f95d)[_0xfc32('0x21')](_0x653c28);}};}function respondWithFilteredResult(_0xdb72b0,_0x24b6f8){return function(_0x590202){if(_0x590202){var _0x681e29=typeof _0x24b6f8[_0xfc32('0x22')]===_0xfc32('0x23')&&typeof _0x24b6f8['limit']===_0xfc32('0x23');var _0x2a637b=_0x590202[_0xfc32('0x24')];var _0x40b15e=_0x681e29?0x0:_0x24b6f8[_0xfc32('0x22')];var _0x2a0374=_0x681e29?_0x590202[_0xfc32('0x24')]:_0x24b6f8['offset']+_0x24b6f8[_0xfc32('0x25')];var _0x1763c0;if(_0x2a0374>=_0x2a637b){_0x2a0374=_0x2a637b;_0x1763c0=0xc8;}else{_0x1763c0=0xce;}_0xdb72b0[_0xfc32('0x1f')](_0x1763c0);return _0xdb72b0[_0xfc32('0x26')](_0xfc32('0x27'),_0x40b15e+'-'+_0x2a0374+'/'+_0x2a637b)[_0xfc32('0x21')](_0x590202);}return null;};}function patchUpdates(_0x2f7952){return function(_0x32aa67){try{jsonpatch[_0xfc32('0x28')](_0x32aa67,_0x2f7952,!![]);}catch(_0x230561){return BPromise[_0xfc32('0x29')](_0x230561);}return _0x32aa67[_0xfc32('0x2a')]();};}function saveUpdates(_0x240506,_0x3b3ed7){return function(_0x266085){if(_0x266085){return _0x266085['update'](_0x240506)[_0xfc32('0x2b')](function(_0x33b7f0){return _0x33b7f0;});}return null;};}function removeEntity(_0x2fd5c1,_0x476aff){return function(_0x4d9a3e){if(_0x4d9a3e){return _0x4d9a3e['destroy']()[_0xfc32('0x2b')](function(){_0x2fd5c1[_0xfc32('0x1f')](0xcc)[_0xfc32('0x20')]();});}};}function handleEntityNotFound(_0x343852,_0x342c73){return function(_0x1443a1){if(!_0x1443a1){_0x343852[_0xfc32('0x2c')](0x194);}return _0x1443a1;};}function handleError(_0x4043e7,_0x3b452a){_0x3b452a=_0x3b452a||0x1f4;return function(_0x203579){logger[_0xfc32('0x2d')](_0x203579[_0xfc32('0x2e')]);if(_0x203579[_0xfc32('0x2f')]){delete _0x203579['name'];}_0x4043e7['status'](_0x3b452a)['send'](_0x203579);};}exports[_0xfc32('0x30')]=function(_0x1bf3ac,_0xa31fd){var _0x5a1a0c={},_0x2e3a76={},_0x3caba6={'count':0x0,'rows':[]};var _0x37767d=_[_0xfc32('0x31')](db['ChatGroup'][_0xfc32('0x32')],function(_0x6ef6fe){return{'name':_0x6ef6fe['fieldName'],'type':_0x6ef6fe[_0xfc32('0x33')]['key']};});_0x2e3a76['model']=_[_0xfc32('0x31')](_0x37767d,_0xfc32('0x2f'));_0x2e3a76['query']=_[_0xfc32('0x34')](_0x1bf3ac[_0xfc32('0x35')]);_0x2e3a76[_0xfc32('0x36')]=_[_0xfc32('0x37')](_0x2e3a76[_0xfc32('0x38')],_0x2e3a76[_0xfc32('0x35')]);_0x5a1a0c['attributes']=_[_0xfc32('0x37')](_0x2e3a76[_0xfc32('0x38')],qs[_0xfc32('0x39')](_0x1bf3ac[_0xfc32('0x35')][_0xfc32('0x39')]));_0x5a1a0c[_0xfc32('0x3a')]=_0x5a1a0c[_0xfc32('0x3a')][_0xfc32('0x3b')]?_0x5a1a0c[_0xfc32('0x3a')]:_0x2e3a76['model'];if(!_0x1bf3ac['query'][_0xfc32('0x3c')](_0xfc32('0x3d'))){_0x5a1a0c[_0xfc32('0x25')]=qs[_0xfc32('0x25')](_0x1bf3ac[_0xfc32('0x35')][_0xfc32('0x25')]);_0x5a1a0c[_0xfc32('0x22')]=qs['offset'](_0x1bf3ac[_0xfc32('0x35')]['offset']);}_0x5a1a0c['order']=qs[_0xfc32('0x3e')](_0x1bf3ac[_0xfc32('0x35')][_0xfc32('0x3e')]);_0x5a1a0c[_0xfc32('0x3f')]=qs[_0xfc32('0x36')](_[_0xfc32('0x40')](_0x1bf3ac[_0xfc32('0x35')],_0x2e3a76[_0xfc32('0x36')]),_0x37767d);if(_0x1bf3ac[_0xfc32('0x35')][_0xfc32('0x41')]){_0x5a1a0c[_0xfc32('0x3f')]=_['merge'](_0x5a1a0c[_0xfc32('0x3f')],{'$or':_['map'](_0x37767d,function(_0x138803){if(_0x138803['type']!=='VIRTUAL'){var _0x3e6d25={};_0x3e6d25[_0x138803[_0xfc32('0x2f')]]={'$like':'%'+_0x1bf3ac[_0xfc32('0x35')]['filter']+'%'};return _0x3e6d25;}})});}_0x5a1a0c=_['merge']({},_0x5a1a0c,_0x1bf3ac[_0xfc32('0x42')]);var _0x1d48bb={'where':_0x5a1a0c['where']};return db[_0xfc32('0x43')]['count'](_0x1d48bb)[_0xfc32('0x2b')](function(_0x2cdeb4){_0x3caba6[_0xfc32('0x24')]=_0x2cdeb4;if(_0x1bf3ac['query']['includeAll']){_0x5a1a0c[_0xfc32('0x44')]=[{'all':!![]}];}return db[_0xfc32('0x43')][_0xfc32('0x45')](_0x5a1a0c);})['then'](function(_0x544b8f){_0x3caba6[_0xfc32('0x46')]=_0x544b8f;return _0x3caba6;})[_0xfc32('0x2b')](respondWithFilteredResult(_0xa31fd,_0x5a1a0c))[_0xfc32('0x47')](handleError(_0xa31fd,null));};exports[_0xfc32('0x48')]=function(_0x484d28,_0x31bbcb){var _0x23baca={'raw':!![],'where':{'id':_0x484d28[_0xfc32('0x49')]['id']}},_0x2116b5={};_0x2116b5[_0xfc32('0x38')]=_[_0xfc32('0x34')](db[_0xfc32('0x43')][_0xfc32('0x32')]);_0x2116b5[_0xfc32('0x35')]=_[_0xfc32('0x34')](_0x484d28['query']);_0x2116b5[_0xfc32('0x36')]=_['intersection'](_0x2116b5['model'],_0x2116b5[_0xfc32('0x35')]);_0x23baca['attributes']=_['intersection'](_0x2116b5['model'],qs[_0xfc32('0x39')](_0x484d28[_0xfc32('0x35')][_0xfc32('0x39')]));_0x23baca[_0xfc32('0x3a')]=_0x23baca[_0xfc32('0x3a')][_0xfc32('0x3b')]?_0x23baca[_0xfc32('0x3a')]:_0x2116b5[_0xfc32('0x38')];if(_0x484d28[_0xfc32('0x35')][_0xfc32('0x4a')]){_0x23baca[_0xfc32('0x44')]=[{'all':!![]}];}_0x23baca=_[_0xfc32('0x4b')]({},_0x23baca,_0x484d28['options']);return db['ChatGroup'][_0xfc32('0x4c')](_0x23baca)[_0xfc32('0x2b')](handleEntityNotFound(_0x31bbcb,null))['then'](respondWithResult(_0x31bbcb,null))[_0xfc32('0x47')](handleError(_0x31bbcb,null));};exports['create']=function(_0x454cf7,_0x34555e){return db[_0xfc32('0x43')][_0xfc32('0x4d')](_0x454cf7[_0xfc32('0x4e')],{})[_0xfc32('0x2b')](respondWithResult(_0x34555e,0xc9))[_0xfc32('0x47')](handleError(_0x34555e,null));};exports[_0xfc32('0x4f')]=function(_0x3d8764,_0x41890c){if(_0x3d8764['body']['id']){delete _0x3d8764[_0xfc32('0x4e')]['id'];}return db[_0xfc32('0x43')]['find']({'where':{'id':_0x3d8764[_0xfc32('0x49')]['id']}})[_0xfc32('0x2b')](handleEntityNotFound(_0x41890c,null))['then'](saveUpdates(_0x3d8764['body'],null))[_0xfc32('0x2b')](respondWithResult(_0x41890c,null))[_0xfc32('0x47')](handleError(_0x41890c,null));};exports[_0xfc32('0x50')]=function(_0x2fecdc,_0x2067be){return db[_0xfc32('0x43')][_0xfc32('0x4c')]({'where':{'id':_0x2fecdc[_0xfc32('0x49')]['id']}})[_0xfc32('0x2b')](handleEntityNotFound(_0x2067be,null))['then'](removeEntity(_0x2067be,null))[_0xfc32('0x47')](handleError(_0x2067be,null));};exports['describe']=function(_0x40eec5,_0x3ea19e){return db[_0xfc32('0x43')][_0xfc32('0x51')]()[_0xfc32('0x2b')](respondWithResult(_0x3ea19e,null))['catch'](handleError(_0x3ea19e,null));};exports[_0xfc32('0x52')]=function(_0x1cccb4,_0x366c11,_0x580ad1){return db[_0xfc32('0x53')][_0xfc32('0x24')]({'where':{'ChatGroupId':_0x1cccb4[_0xfc32('0x49')]['id'],'ToId':_0x1cccb4['user']['id'],'read':![]}})[_0xfc32('0x2b')](function(_0x595632){return{'id':_[_0xfc32('0x54')](_0x1cccb4[_0xfc32('0x49')]['id']),'count':_0x595632};})[_0xfc32('0x2b')](respondWithResult(_0x366c11,null))['catch'](handleError(_0x366c11,null));};exports[_0xfc32('0x55')]=function(_0x1c9373,_0x2d5904,_0x4abbfa){return db[_0xfc32('0x43')][_0xfc32('0x4c')]({'where':{'id':_0x1c9373[_0xfc32('0x49')]['id']}})[_0xfc32('0x2b')](handleEntityNotFound(_0x2d5904,null))[_0xfc32('0x2b')](function(_0x491251){if(_0x491251){return _0x491251[_0xfc32('0x55')](_0x1c9373['body'][_0xfc32('0x56')],_[_0xfc32('0x57')](_0x1c9373[_0xfc32('0x4e')],[_0xfc32('0x56'),'id'])||{});}})[_0xfc32('0x2b')](respondWithResult(_0x2d5904,null))[_0xfc32('0x47')](handleError(_0x2d5904,null));};exports['getMembers']=function(_0x26d197,_0x23185c,_0x33c176){var _0x574f68={};var _0x29e686={};var _0x67938c;var _0x3de520;return db[_0xfc32('0x43')][_0xfc32('0x58')]({'where':{'id':_0x26d197[_0xfc32('0x49')]['id']}})[_0xfc32('0x2b')](handleEntityNotFound(_0x23185c,null))[_0xfc32('0x2b')](function(_0x5e692b){if(_0x5e692b){_0x67938c=_0x5e692b;_0x29e686[_0xfc32('0x38')]=_[_0xfc32('0x34')](db[_0xfc32('0x59')]['rawAttributes']);_0x29e686['query']=_[_0xfc32('0x34')](_0x26d197['query']);_0x29e686[_0xfc32('0x36')]=_[_0xfc32('0x37')](_0x29e686[_0xfc32('0x38')],_0x29e686[_0xfc32('0x35')]);_0x574f68[_0xfc32('0x3a')]=_['intersection'](_0x29e686[_0xfc32('0x38')],qs[_0xfc32('0x39')](_0x26d197[_0xfc32('0x35')][_0xfc32('0x39')]));_0x574f68['attributes']=_0x574f68[_0xfc32('0x3a')][_0xfc32('0x3b')]?_0x574f68[_0xfc32('0x3a')]:_0x29e686[_0xfc32('0x38')];_0x574f68[_0xfc32('0x5a')]=qs[_0xfc32('0x3e')](_0x26d197[_0xfc32('0x35')]['sort']);_0x574f68['where']=qs[_0xfc32('0x36')](_['pick'](_0x26d197[_0xfc32('0x35')],_0x29e686['filters']));if(_0x26d197['query']['filter']){_0x574f68[_0xfc32('0x3f')]=_[_0xfc32('0x4b')](_0x574f68[_0xfc32('0x3f')],{'$or':_['map'](_0x574f68[_0xfc32('0x3a')],function(_0x1b8076){var _0x1edd8c={};_0x1edd8c[_0x1b8076]={'$like':'%'+_0x26d197[_0xfc32('0x35')][_0xfc32('0x41')]+'%'};return _0x1edd8c;})});}_0x574f68=_[_0xfc32('0x4b')]({},_0x574f68,_0x26d197['options']);return _0x67938c[_0xfc32('0x5b')](_0x574f68);}})['then'](function(_0x222d51){if(_0x222d51){_0x3de520=_0x222d51[_0xfc32('0x3b')];if(!_0x26d197[_0xfc32('0x35')][_0xfc32('0x3c')](_0xfc32('0x3d'))){_0x574f68[_0xfc32('0x25')]=qs['limit'](_0x26d197['query'][_0xfc32('0x25')]);_0x574f68['offset']=qs[_0xfc32('0x22')](_0x26d197['query']['offset']);}return _0x67938c['getMembers'](_0x574f68);}})['then'](function(_0x4dd1dc){if(_0x4dd1dc){return _0x4dd1dc?{'count':_0x3de520,'rows':_0x4dd1dc}:null;}})[_0xfc32('0x2b')](respondWithResult(_0x23185c,null))[_0xfc32('0x47')](handleError(_0x23185c,null));};exports[_0xfc32('0x5c')]=function(_0x4ce7a2,_0x3c60b5,_0x11aa92){return db[_0xfc32('0x43')][_0xfc32('0x4c')]({'where':{'id':_0x4ce7a2[_0xfc32('0x49')]['id']}})[_0xfc32('0x2b')](handleEntityNotFound(_0x3c60b5,null))['then'](function(_0x22259a){if(_0x22259a){return _0x22259a['removeMembers'](_0x4ce7a2[_0xfc32('0x35')][_0xfc32('0x56')]);}})[_0xfc32('0x2b')](respondWithStatusCode(_0x3c60b5,null))[_0xfc32('0x47')](handleError(_0x3c60b5,null));};exports[_0xfc32('0x5d')]=function(_0x1cccc7,_0x5598af,_0x47bae5){if(_0x1cccc7[_0xfc32('0x4e')]['id']){delete _0x1cccc7[_0xfc32('0x4e')]['id'];}return db[_0xfc32('0x43')][_0xfc32('0x4c')]({'where':{'id':_0x1cccc7[_0xfc32('0x49')]['id']}})[_0xfc32('0x2b')](handleEntityNotFound(_0x5598af,null))[_0xfc32('0x2b')](function(_0x200c58){if(_0x200c58){_0x1cccc7[_0xfc32('0x4e')][_0xfc32('0x5e')]=_0x200c58['id'];return db[_0xfc32('0x53')][_0xfc32('0x4d')](_0x1cccc7['body']);}})[_0xfc32('0x2b')](respondWithResult(_0x5598af,null))['catch'](handleError(_0x5598af,null));};exports[_0xfc32('0x5f')]=function(_0x45aed4,_0x332345,_0xeaa84e){var _0x4116b9={};var _0x503c8f={};var _0x8dc04b;var _0x2bea8e;return db['ChatGroup'][_0xfc32('0x58')]({'where':{'id':_0x45aed4[_0xfc32('0x49')]['id']}})[_0xfc32('0x2b')](handleEntityNotFound(_0x332345,null))['then'](function(_0xaf3d71){if(_0xaf3d71){_0x8dc04b=_0xaf3d71;_0x503c8f['model']=_['keys'](db[_0xfc32('0x53')][_0xfc32('0x32')]);_0x503c8f[_0xfc32('0x35')]=_['keys'](_0x45aed4[_0xfc32('0x35')]);_0x503c8f[_0xfc32('0x36')]=_[_0xfc32('0x37')](_0x503c8f[_0xfc32('0x38')],_0x503c8f[_0xfc32('0x35')]);_0x4116b9[_0xfc32('0x3a')]=_[_0xfc32('0x37')](_0x503c8f[_0xfc32('0x38')],qs['fields'](_0x45aed4[_0xfc32('0x35')][_0xfc32('0x39')]));_0x4116b9[_0xfc32('0x3a')]=_0x4116b9[_0xfc32('0x3a')][_0xfc32('0x3b')]?_0x4116b9[_0xfc32('0x3a')]:_0x503c8f[_0xfc32('0x38')];_0x4116b9[_0xfc32('0x5a')]=qs['sort'](_0x45aed4['query'][_0xfc32('0x3e')]);_0x4116b9[_0xfc32('0x3f')]=qs[_0xfc32('0x36')](_[_0xfc32('0x40')](_0x45aed4['query'],_0x503c8f[_0xfc32('0x36')]));if(_0x45aed4[_0xfc32('0x35')][_0xfc32('0x41')]){_0x4116b9[_0xfc32('0x3f')]=_[_0xfc32('0x4b')](_0x4116b9[_0xfc32('0x3f')],{'$or':_[_0xfc32('0x31')](_0x4116b9[_0xfc32('0x3a')],function(_0x236ceb){var _0x5549ee={};_0x5549ee[_0x236ceb]={'$like':'%'+_0x45aed4[_0xfc32('0x35')][_0xfc32('0x41')]+'%'};return _0x5549ee;})});}if(_0x45aed4[_0xfc32('0x35')][_0xfc32('0x60')]){var _0x48930b=_0x45aed4[_0xfc32('0x35')][_0xfc32('0x60')][_0xfc32('0x61')](',');var _0x4ae544={};_0x4ae544[_0x48930b[0x0]]={'$gte':moment(_0x48930b[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4116b9[_0xfc32('0x3f')]=_[_0xfc32('0x4b')](_0x4116b9[_0xfc32('0x3f')],_0x4ae544);}_0x4116b9=_['merge']({},_0x4116b9,_0x45aed4[_0xfc32('0x42')]);return _0x8dc04b['getMessages'](_0x4116b9);}})['then'](function(_0x1c3814){if(_0x1c3814){_0x2bea8e=_0x1c3814[_0xfc32('0x3b')];if(!_0x45aed4[_0xfc32('0x35')][_0xfc32('0x3c')](_0xfc32('0x3d'))){_0x4116b9[_0xfc32('0x25')]=qs[_0xfc32('0x25')](_0x45aed4[_0xfc32('0x35')][_0xfc32('0x25')]);_0x4116b9[_0xfc32('0x22')]=qs[_0xfc32('0x22')](_0x45aed4[_0xfc32('0x35')][_0xfc32('0x22')]);}return _0x8dc04b[_0xfc32('0x5f')](_0x4116b9);}})[_0xfc32('0x2b')](function(_0xbabbc3){if(_0xbabbc3){return _0xbabbc3?{'count':_0x2bea8e,'rows':_0xbabbc3}:null;}})[_0xfc32('0x2b')](respondWithResult(_0x332345,null))[_0xfc32('0x47')](handleError(_0x332345,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 75d3cb5..90d5b95 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 _0x0adf=['ChatGroup','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x433275,_0x1937e1){var _0x2d5fcf=function(_0x11f393){while(--_0x11f393){_0x433275['push'](_0x433275['shift']());}};_0x2d5fcf(++_0x1937e1);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x1de5bf,_0x186874){_0x1de5bf=_0x1de5bf-0x0;var _0x208287=_0x0adf[_0x1de5bf];return _0x208287;};'use strict';var EventEmitter=require(_0xf0ad('0x0'));var ChatGroup=require(_0xf0ad('0x1'))['db'][_0xf0ad('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf0ad('0x3'),'afterUpdate':_0xf0ad('0x4'),'afterDestroy':_0xf0ad('0x5')};function emitEvent(_0x187aa4){return function(_0x27d666,_0x459e70,_0x719547){ChatGroupEvents['emit'](_0x187aa4+':'+_0x27d666['id'],_0x27d666);ChatGroupEvents[_0xf0ad('0x6')](_0x187aa4,_0x27d666);_0x719547(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xf0ad('0x7')](e,emitEvent(event));}}module[_0xf0ad('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x94ff=['remove','emit','hook','events','save','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x94ff,0xc3));var _0xf94f=function(_0x5ca300,_0x3dcd24){_0x5ca300=_0x5ca300-0x0;var _0x4a36fc=_0x94ff[_0x5ca300];return _0x4a36fc;};'use strict';var EventEmitter=require(_0xf94f('0x0'));var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf94f('0x1'),'afterUpdate':_0xf94f('0x2'),'afterDestroy':_0xf94f('0x3')};function emitEvent(_0x56e032){return function(_0xf166cb,_0x44677c,_0x48ce3b){ChatGroupEvents[_0xf94f('0x4')](_0x56e032+':'+_0xf166cb['id'],_0xf166cb);ChatGroupEvents[_0xf94f('0x4')](_0x56e032,_0xf166cb);_0x48ce3b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xf94f('0x5')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 1a35dfc..dcfa382 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 _0x4d9d=['lodash','util','request-promise','path','./chatGroup.attributes','exports','define','ChatGroup','chat_groups'];(function(_0x2ba59c,_0x182e51){var _0x190c42=function(_0x4ccc53){while(--_0x4ccc53){_0x2ba59c['push'](_0x2ba59c['shift']());}};_0x190c42(++_0x182e51);}(_0x4d9d,0x1cb));var _0xd4d9=function(_0x36aa05,_0x3117cc){_0x36aa05=_0x36aa05-0x0;var _0x293263=_0x4d9d[_0x36aa05];return _0x293263;};'use strict';var _=require(_0xd4d9('0x0'));var util=require(_0xd4d9('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd4d9('0x2'));var fs=require('fs');var path=require(_0xd4d9('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd4d9('0x4'));module[_0xd4d9('0x5')]=function(_0x1349f5,_0x1ca32d){return _0x1349f5[_0xd4d9('0x6')](_0xd4d9('0x7'),attributes,{'tableName':_0xd4d9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ff8=['moment','path','rimraf','../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api'];(function(_0x7ff21e,_0x36ea9b){var _0x571cd5=function(_0x43c3f3){while(--_0x43c3f3){_0x7ff21e['push'](_0x7ff21e['shift']());}};_0x571cd5(++_0x36ea9b);}(_0x9ff8,0x194));var _0x89ff=function(_0x206c7b,_0x742356){_0x206c7b=_0x206c7b-0x0;var _0xc49fec=_0x9ff8[_0x206c7b];return _0xc49fec;};'use strict';var _=require(_0x89ff('0x0'));var util=require(_0x89ff('0x1'));var logger=require(_0x89ff('0x2'))(_0x89ff('0x3'));var moment=require(_0x89ff('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x89ff('0x5'));var rimraf=require(_0x89ff('0x6'));var config=require(_0x89ff('0x7'));var attributes=require(_0x89ff('0x8'));module['exports']=function(_0x344497,_0x4470f5){return _0x344497[_0x89ff('0x9')](_0x89ff('0xa'),attributes,{'tableName':_0x89ff('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 8199381..539fd8b 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 _0x252f=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x252f,0x1e2));var _0xf252=function(_0x4b4517,_0x5dbf6a){_0x4b4517=_0x4b4517-0x0;var _0x48278b=_0x252f[_0x4b4517];return _0x48278b;};'use strict';var _=require(_0xf252('0x0'));var util=require('util');var moment=require(_0xf252('0x1'));var BPromise=require(_0xf252('0x2'));var rs=require(_0xf252('0x3'));var fs=require('fs');var Redis=require(_0xf252('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf252('0x5'));var logger=require(_0xf252('0x6'))(_0xf252('0x7'));var config=require(_0xf252('0x8'));var jayson=require(_0xf252('0x9'));var client=jayson[_0xf252('0xa')][_0xf252('0xb')]({'port':0x232a});config[_0xf252('0xc')]=_[_0xf252('0xd')](config[_0xf252('0xc')],{'host':_0xf252('0xe'),'port':0x18eb});var socket=require(_0xf252('0xf'))(new Redis(config['redis']));require(_0xf252('0x10'))['register'](socket);function respondWithRpcPromise(_0x4fa847,_0x1eab3b,_0x1486ab){return new BPromise(function(_0x4668ff,_0x6d04ce){return client[_0xf252('0x11')](_0x4fa847,_0x1486ab)[_0xf252('0x12')](function(_0xc9b64b){logger[_0xf252('0x13')](_0xf252('0x14'),_0x1eab3b,_0xf252('0x15'));logger[_0xf252('0x16')](_0xf252('0x17'),_0x1eab3b,_0xf252('0x15'),JSON[_0xf252('0x18')](_0xc9b64b));if(_0xc9b64b['error']){if(_0xc9b64b[_0xf252('0x19')][_0xf252('0x1a')]===0x1f4){logger[_0xf252('0x19')](_0xf252('0x14'),_0x1eab3b,_0xc9b64b[_0xf252('0x19')][_0xf252('0x1b')]);return _0x6d04ce(_0xc9b64b['error'][_0xf252('0x1b')]);}logger['error'](_0xf252('0x14'),_0x1eab3b,_0xc9b64b[_0xf252('0x19')][_0xf252('0x1b')]);return _0x4668ff(_0xc9b64b[_0xf252('0x19')][_0xf252('0x1b')]);}else{logger[_0xf252('0x13')]('ChatGroup,\x20%s,\x20%s',_0x1eab3b,_0xf252('0x15'));_0x4668ff(_0xc9b64b[_0xf252('0x1c')][_0xf252('0x1b')]);}})[_0xf252('0x1d')](function(_0x58cc9c){logger[_0xf252('0x19')]('ChatGroup,\x20%s,\x20%s',_0x1eab3b,_0x58cc9c);_0x6d04ce(_0x58cc9c);});});} \ No newline at end of file +var _0x70e9=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','util','moment'];(function(_0x2bfa86,_0x34bb3c){var _0xf15627=function(_0x3a930d){while(--_0x3a930d){_0x2bfa86['push'](_0x2bfa86['shift']());}};_0xf15627(++_0x34bb3c);}(_0x70e9,0x193));var _0x970e=function(_0x219ab9,_0x37e2c1){_0x219ab9=_0x219ab9-0x0;var _0x2191ae=_0x70e9[_0x219ab9];return _0x2191ae;};'use strict';var _=require('lodash');var util=require(_0x970e('0x0'));var moment=require(_0x970e('0x1'));var BPromise=require('bluebird');var rs=require(_0x970e('0x2'));var fs=require('fs');var Redis=require(_0x970e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x970e('0x4'));var logger=require('../../config/logger')(_0x970e('0x5'));var config=require(_0x970e('0x6'));var jayson=require(_0x970e('0x7'));var client=jayson[_0x970e('0x8')][_0x970e('0x9')]({'port':0x232a});config[_0x970e('0xa')]=_[_0x970e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x970e('0xc'))(new Redis(config[_0x970e('0xa')]));require('./chatGroup.socket')[_0x970e('0xd')](socket);function respondWithRpcPromise(_0x2140e5,_0x1d3fec,_0x4853e7){return new BPromise(function(_0x17256c,_0x285e82){return client[_0x970e('0xe')](_0x2140e5,_0x4853e7)[_0x970e('0xf')](function(_0x28a551){logger[_0x970e('0x10')]('ChatGroup,\x20%s,\x20%s',_0x1d3fec,_0x970e('0x11'));logger[_0x970e('0x12')](_0x970e('0x13'),_0x1d3fec,_0x970e('0x11'),JSON[_0x970e('0x14')](_0x28a551));if(_0x28a551[_0x970e('0x15')]){if(_0x28a551[_0x970e('0x15')][_0x970e('0x16')]===0x1f4){logger['error'](_0x970e('0x17'),_0x1d3fec,_0x28a551[_0x970e('0x15')]['message']);return _0x285e82(_0x28a551[_0x970e('0x15')][_0x970e('0x18')]);}logger[_0x970e('0x15')](_0x970e('0x17'),_0x1d3fec,_0x28a551['error'][_0x970e('0x18')]);return _0x17256c(_0x28a551[_0x970e('0x15')][_0x970e('0x18')]);}else{logger[_0x970e('0x10')]('ChatGroup,\x20%s,\x20%s',_0x1d3fec,'request\x20sent');_0x17256c(_0x28a551[_0x970e('0x19')][_0x970e('0x18')]);}})[_0x970e('0x1a')](function(_0x53c841){logger[_0x970e('0x15')](_0x970e('0x17'),_0x1d3fec,_0x53c841);_0x285e82(_0x53c841);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 7c77897..01cacc2 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 _0x586a=['./chatGroup.events','save','emit','removeListener','register','length'];(function(_0x55fb83,_0x1d3856){var _0x59a87a=function(_0x38bdd1){while(--_0x38bdd1){_0x55fb83['push'](_0x55fb83['shift']());}};_0x59a87a(++_0x1d3856);}(_0x586a,0x18c));var _0xa586=function(_0x266cca,_0x50b778){_0x266cca=_0x266cca-0x0;var _0x13afcd=_0x586a[_0x266cca];return _0x13afcd;};'use strict';var ChatGroupEvents=require(_0xa586('0x0'));var events=[_0xa586('0x1'),'remove','update'];function createListener(_0x2a7b2e,_0x1a2344){return function(_0x1a43d9){_0x1a2344[_0xa586('0x2')](_0x2a7b2e,_0x1a43d9);};}function removeListener(_0x2ee46b,_0x15558a){return function(){ChatGroupEvents[_0xa586('0x3')](_0x2ee46b,_0x15558a);};}exports[_0xa586('0x4')]=function(_0x32b1ce){for(var _0x460241=0x0,_0x43b7ab=events[_0xa586('0x5')];_0x460241<_0x43b7ab;_0x460241++){var _0x326d1e=events[_0x460241];var _0x599e7f=createListener('chatGroup:'+_0x326d1e,_0x32b1ce);ChatGroupEvents['on'](_0x326d1e,_0x599e7f);}}; \ No newline at end of file +var _0xfde6=['update','emit','removeListener','register','chatGroup:'];(function(_0x2c4a85,_0x58a6a7){var _0x261607=function(_0xf2ad92){while(--_0xf2ad92){_0x2c4a85['push'](_0x2c4a85['shift']());}};_0x261607(++_0x58a6a7);}(_0xfde6,0x19f));var _0x6fde=function(_0x2e48c9,_0x4fd904){_0x2e48c9=_0x2e48c9-0x0;var _0x392a1c=_0xfde6[_0x2e48c9];return _0x392a1c;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save','remove',_0x6fde('0x0')];function createListener(_0x53969c,_0x4259c8){return function(_0x5baac8){_0x4259c8[_0x6fde('0x1')](_0x53969c,_0x5baac8);};}function removeListener(_0x3f1616,_0x1e9964){return function(){ChatGroupEvents[_0x6fde('0x2')](_0x3f1616,_0x1e9964);};}exports[_0x6fde('0x3')]=function(_0x432e33){for(var _0x141ad1=0x0,_0xaa87ce=events['length'];_0x141ad1<_0xaa87ce;_0x141ad1++){var _0x4b122e=events[_0x141ad1];var _0x3a3798=createListener(_0x6fde('0x4')+_0x4b122e,_0x432e33);ChatGroupEvents['on'](_0x4b122e,_0x3a3798);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 2adc184..cef69ed 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 _0x325c=['isAuthenticated','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','getMessages','post','create','addMembers','/:id/messages','update','delete','destroy','removeMembers','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get'];(function(_0x3d0757,_0x216f9f){var _0x3761f9=function(_0x4af33c){while(--_0x4af33c){_0x3d0757['push'](_0x3d0757['shift']());}};_0x3761f9(++_0x216f9f);}(_0x325c,0x9a));var _0xc325=function(_0x36ad30,_0x5d0352){_0x36ad30=_0x36ad30-0x0;var _0x3e83e4=_0x325c[_0x36ad30];return _0x3e83e4;};'use strict';var multer=require(_0xc325('0x0'));var util=require('util');var path=require(_0xc325('0x1'));var timeout=require('connect-timeout');var express=require(_0xc325('0x2'));var router=express['Router']();var fs_extra=require(_0xc325('0x3'));var auth=require(_0xc325('0x4'));var interaction=require(_0xc325('0x5'));var config=require('../../config/environment');var controller=require(_0xc325('0x6'));router[_0xc325('0x7')]('/',auth[_0xc325('0x8')](),controller['index']);router['get'](_0xc325('0x9'),auth[_0xc325('0x8')](),controller[_0xc325('0xa')]);router[_0xc325('0x7')](_0xc325('0xb'),auth[_0xc325('0x8')](),controller[_0xc325('0xc')]);router[_0xc325('0x7')](_0xc325('0xd'),auth[_0xc325('0x8')](),controller[_0xc325('0xe')]);router[_0xc325('0x7')](_0xc325('0xf'),auth[_0xc325('0x8')](),controller[_0xc325('0x10')]);router[_0xc325('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0xc325('0x11')]);router[_0xc325('0x12')]('/',auth[_0xc325('0x8')](),controller[_0xc325('0x13')]);router[_0xc325('0x12')]('/:id/members',auth[_0xc325('0x8')](),controller[_0xc325('0x14')]);router[_0xc325('0x12')](_0xc325('0x15'),auth[_0xc325('0x8')](),controller['addMessage']);router['put'](_0xc325('0xb'),auth[_0xc325('0x8')](),controller[_0xc325('0x16')]);router[_0xc325('0x17')](_0xc325('0xb'),auth[_0xc325('0x8')](),controller[_0xc325('0x18')]);router['delete'](_0xc325('0xf'),auth[_0xc325('0x8')](),controller[_0xc325('0x19')]);module[_0xc325('0x1a')]=router; \ No newline at end of file +var _0xfc0c=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','/:id/unread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','update','destroy','delete','removeMembers','exports','multer','path','../../components/auth/service'];(function(_0x5f1694,_0x35e555){var _0x184197=function(_0x1b1963){while(--_0x1b1963){_0x5f1694['push'](_0x5f1694['shift']());}};_0x184197(++_0x35e555);}(_0xfc0c,0x169));var _0xcfc0=function(_0x208296,_0x531f88){_0x208296=_0x208296-0x0;var _0x3d8dd1=_0xfc0c[_0x208296];return _0x3d8dd1;};'use strict';var multer=require(_0xcfc0('0x0'));var util=require('util');var path=require(_0xcfc0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcfc0('0x2'));var interaction=require(_0xcfc0('0x3'));var config=require(_0xcfc0('0x4'));var controller=require('./chatGroup.controller');router[_0xcfc0('0x5')]('/',auth['isAuthenticated'](),controller[_0xcfc0('0x6')]);router[_0xcfc0('0x5')](_0xcfc0('0x7'),auth[_0xcfc0('0x8')](),controller[_0xcfc0('0x9')]);router[_0xcfc0('0x5')](_0xcfc0('0xa'),auth[_0xcfc0('0x8')](),controller['show']);router[_0xcfc0('0x5')](_0xcfc0('0xb'),auth[_0xcfc0('0x8')](),controller['getUnread']);router[_0xcfc0('0x5')](_0xcfc0('0xc'),auth[_0xcfc0('0x8')](),controller[_0xcfc0('0xd')]);router['get'](_0xcfc0('0xe'),auth[_0xcfc0('0x8')](),controller[_0xcfc0('0xf')]);router[_0xcfc0('0x10')]('/',auth[_0xcfc0('0x8')](),controller[_0xcfc0('0x11')]);router['post'](_0xcfc0('0xc'),auth[_0xcfc0('0x8')](),controller[_0xcfc0('0x12')]);router['post'](_0xcfc0('0xe'),auth[_0xcfc0('0x8')](),controller[_0xcfc0('0x13')]);router[_0xcfc0('0x14')](_0xcfc0('0xa'),auth[_0xcfc0('0x8')](),controller[_0xcfc0('0x15')]);router['delete']('/:id',auth[_0xcfc0('0x8')](),controller[_0xcfc0('0x16')]);router[_0xcfc0('0x17')](_0xcfc0('0xc'),auth['isAuthenticated'](),controller[_0xcfc0('0x18')]);module[_0xcfc0('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 945235c..c4f1879 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 _0xc06d=['TEXT','DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN','INTEGER','star','thumb'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0xc06d,0x15a));var _0xdc06=function(_0x34efb1,_0xd5094a){_0x34efb1=_0x34efb1-0x0;var _0x59a9bb=_0xc06d[_0x34efb1];return _0x59a9bb;};'use strict';var Sequelize=require(_0xdc06('0x0'));module[_0xdc06('0x1')]={'closed':{'type':Sequelize[_0xdc06('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xdc06('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0xdc06('0x4'),_0xdc06('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xdc06('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xdc06('0x7')]},'disposition':{'type':Sequelize[_0xdc06('0x8')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xdc06('0x8')]},'browserName':{'type':Sequelize[_0xdc06('0x8')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xdc06('0x8')]},'osVersion':{'type':Sequelize[_0xdc06('0x8')]},'deviceModel':{'type':Sequelize[_0xdc06('0x8')]},'deviceVendor':{'type':Sequelize[_0xdc06('0x8')]},'deviceType':{'type':Sequelize[_0xdc06('0x8')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xdc06('0x6')]('long')},'read1stAt':{'type':Sequelize[_0xdc06('0x7')]},'lastMsgAt':{'type':Sequelize[_0xdc06('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xdc06('0x9')]('in',_0xdc06('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xdc06('0x8')]},'customerPort':{'type':Sequelize[_0xdc06('0x8')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xbfcc=['TEXT','long','out','BOOLEAN','sequelize','INTEGER','ENUM','star','thumb','DATE','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xbfcc[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0xcbfc('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xcbfc('0x1')]},'ratingType':{'type':Sequelize[_0xcbfc('0x2')](_0xcbfc('0x3'),_0xcbfc('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xcbfc('0x5')]},'disposition':{'type':Sequelize[_0xcbfc('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xcbfc('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xcbfc('0x6')]},'browserVersion':{'type':Sequelize[_0xcbfc('0x6')]},'osName':{'type':Sequelize[_0xcbfc('0x6')]},'osVersion':{'type':Sequelize[_0xcbfc('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xcbfc('0x6')]},'deviceType':{'type':Sequelize[_0xcbfc('0x6')]},'referer':{'type':Sequelize[_0xcbfc('0x7')]},'customerIp':{'type':Sequelize[_0xcbfc('0x6')]},'formData':{'type':Sequelize[_0xcbfc('0x7')](_0xcbfc('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xcbfc('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xcbfc('0x2')]('in',_0xcbfc('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xcbfc('0x6')]},'customerPort':{'type':Sequelize[_0xcbfc('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xcbfc('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 6622ced..b58c975 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 _0x7efd=['transcript-%d-%s.zip','push','firstName','lastName','read','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','disposition','browserName','osName','customerIp','customerPort','existsSync','createReadStream','createWriteStream','YYYY-MM-DD\x20HH:mm:ss','out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','bluebird','mustache','util','ejs','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','register','client','http','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','name','send','render','merge','body','agent','account','map','ChatInteraction','fieldName','type','key','getOptions','query','user','show','params','model','keys','filters','intersection','attributes','fields','includeAll','include','options','find','create','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','Sequelize','updateAttributes','customUpdate','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','closed','Unauthorized','attachId','ChatOfflineMessageId','root','join','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','User','CmContact','ContactId','length','UserId','agentAlias','System','customer','%s%d','Visitor','website_alias','agent_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailServerOut','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','hasOwnProperty','nolimit','order','sort','pick','ChatInteractionId','filter','where','$gte','split','findAll','rows','rawAttributes','includeAgent','addTags','setTags','Tag','color','emit','chatInteractionTags:save','removeTags','toString','server','files','tmp','attachments'];(function(_0x7b08d0,_0x3a79bf){var _0x383a76=function(_0xb7e5be){while(--_0xb7e5be){_0x7b08d0['push'](_0x7b08d0['shift']());}};_0x383a76(++_0x3a79bf);}(_0x7efd,0x1c3));var _0xd7ef=function(_0x548ccb,_0x1fab15){_0x548ccb=_0x548ccb-0x0;var _0x2f7701=_0x7efd[_0x548ccb];return _0x2f7701;};'use strict';var rimraf=require(_0xd7ef('0x0'));var zipdir=require(_0xd7ef('0x1'));var rp=require('request-promise');var moment=require(_0xd7ef('0x2'));var BPromise=require(_0xd7ef('0x3'));var Mustache=require(_0xd7ef('0x4'));var util=require(_0xd7ef('0x5'));var path=require('path');var ejs=require(_0xd7ef('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xd7ef('0x7'));var qs=require(_0xd7ef('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0xd7ef('0x9'))('api');var config=require(_0xd7ef('0xa'));var db=require(_0xd7ef('0xb'))['db'];config['redis']=_['defaults'](config[_0xd7ef('0xc')],{'host':_0xd7ef('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd7ef('0xc')]));require('./chatInteraction.socket')[_0xd7ef('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd7ef('0xf')]['http']({'port':0x232b});var client9004=jayson[_0xd7ef('0xf')][_0xd7ef('0x10')]({'port':0x232c});function respondWithRpcPromise(_0x2cac8f,_0xe39a3c,_0x349060,_0x4d0b75){return new BPromise(function(_0x29573f,_0x43ce3f){var _0x430142=_0x4d0b75||client;return _0x430142[_0xd7ef('0x11')](_0x2cac8f,_0x349060)[_0xd7ef('0x12')](function(_0x30d6e3){logger[_0xd7ef('0x13')]('ChatInteraction,\x20%s,\x20%s',_0xe39a3c,_0xd7ef('0x14'));logger[_0xd7ef('0x15')](_0xd7ef('0x16'),_0xe39a3c,'request\x20sent',JSON[_0xd7ef('0x17')](_0x30d6e3));if(_0x30d6e3[_0xd7ef('0x18')]){if(_0x30d6e3[_0xd7ef('0x18')][_0xd7ef('0x19')]===0x1f4){logger[_0xd7ef('0x18')](_0xd7ef('0x1a'),_0xe39a3c,_0x30d6e3['error'][_0xd7ef('0x1b')]);return _0x43ce3f(_0x30d6e3[_0xd7ef('0x18')][_0xd7ef('0x1b')]);}logger['error'](_0xd7ef('0x1a'),_0xe39a3c,_0x30d6e3[_0xd7ef('0x18')][_0xd7ef('0x1b')]);return _0x29573f(_0x30d6e3['error']['message']);}else{logger['info'](_0xd7ef('0x1a'),_0xe39a3c,'request\x20sent');_0x29573f(_0x30d6e3[_0xd7ef('0x1c')][_0xd7ef('0x1b')]);}})[_0xd7ef('0x1d')](function(_0x1440f6){logger['error'](_0xd7ef('0x1a'),_0xe39a3c,_0x1440f6);_0x43ce3f(_0x1440f6);});});}function respondWithStatusCode(_0x159f24,_0x4b99cc){_0x4b99cc=_0x4b99cc||0xcc;return function(_0x5e8cb9){if(_0x5e8cb9){return _0x159f24[_0xd7ef('0x1e')](_0x4b99cc);}return _0x159f24[_0xd7ef('0x1f')](_0x4b99cc)[_0xd7ef('0x20')]();};}function respondWithResult(_0x5529b9,_0x52260a){_0x52260a=_0x52260a||0xc8;return function(_0x17c8f8){if(_0x17c8f8){return _0x5529b9[_0xd7ef('0x1f')](_0x52260a)[_0xd7ef('0x21')](_0x17c8f8);}};}function respondWithFilteredResult(_0x1056b5,_0x4a59ac){return function(_0x6f3ee8){if(_0x6f3ee8){var _0x1e5fea=typeof _0x4a59ac[_0xd7ef('0x22')]===_0xd7ef('0x23')&&typeof _0x4a59ac[_0xd7ef('0x24')]===_0xd7ef('0x23');var _0x2f7a2e=_0x6f3ee8[_0xd7ef('0x25')];var _0x3a3980=_0x1e5fea?0x0:_0x4a59ac[_0xd7ef('0x22')];var _0x44b4bf=_0x1e5fea?_0x6f3ee8[_0xd7ef('0x25')]:_0x4a59ac[_0xd7ef('0x22')]+_0x4a59ac[_0xd7ef('0x24')];var _0xff7c4a;if(_0x44b4bf>=_0x2f7a2e){_0x44b4bf=_0x2f7a2e;_0xff7c4a=0xc8;}else{_0xff7c4a=0xce;}_0x1056b5[_0xd7ef('0x1f')](_0xff7c4a);return _0x1056b5[_0xd7ef('0x26')](_0xd7ef('0x27'),_0x3a3980+'-'+_0x44b4bf+'/'+_0x2f7a2e)['json'](_0x6f3ee8);}return null;};}function saveUpdates(_0x403650){return function(_0x5c311d){if(_0x5c311d){return _0x5c311d[_0xd7ef('0x28')](_0x403650)['then'](function(_0xd206e7){return _0xd206e7;});}return null;};}function removeEntity(_0x2ad496){return function(_0x8283c9){if(_0x8283c9){return _0x8283c9[_0xd7ef('0x29')]()[_0xd7ef('0x12')](function(){_0x2ad496[_0xd7ef('0x1f')](0xcc)[_0xd7ef('0x20')]();});}};}function handleEntityNotFound(_0x5bd24e){return function(_0x39a04a){if(!_0x39a04a){_0x5bd24e['sendStatus'](0x194);}return _0x39a04a;};}function handleError(_0x26a612,_0x39c40e){_0x39c40e=_0x39c40e||0x1f4;return function(_0x5b7f42){logger['error'](_0x5b7f42['stack']);if(_0x5b7f42[_0xd7ef('0x2a')]){delete _0x5b7f42[_0xd7ef('0x2a')];}_0x26a612[_0xd7ef('0x1f')](_0x39c40e)[_0xd7ef('0x2b')](_0x5b7f42);};}function getMustacheRender(_0x52b14b,_0x87b1bc){return Mustache[_0xd7ef('0x2c')](_0x52b14b,_[_0xd7ef('0x2d')](_0x87b1bc[_0xd7ef('0x2e')],{'contact':_0x87b1bc['contact'],'message':_0x87b1bc[_0xd7ef('0x1b')],'agent':_0x87b1bc[_0xd7ef('0x2f')],'interaction':_0x87b1bc['interaction'],'account':_0x87b1bc[_0xd7ef('0x30')]}))||'';}exports['index']=function(_0x55fc3b,_0x3cc27d){var _0xca5d1c={};var _0x1e261e=_[_0xd7ef('0x31')](db[_0xd7ef('0x32')]['rawAttributes'],function(_0x41ddb0){return{'name':_0x41ddb0[_0xd7ef('0x33')],'type':_0x41ddb0[_0xd7ef('0x34')][_0xd7ef('0x35')]};});_0xca5d1c=qs[_0xd7ef('0x36')](_0x1e261e,_0x55fc3b);return interaction['findAll']('chat',_0x55fc3b[_0xd7ef('0x37')],_0x55fc3b[_0xd7ef('0x38')],_0xca5d1c,_0x1e261e)[_0xd7ef('0x12')](respondWithFilteredResult(_0x3cc27d,_0xca5d1c))['catch'](handleError(_0x3cc27d,null));};exports[_0xd7ef('0x39')]=function(_0x2002e6,_0x127438){var _0x11dfe0={'raw':![],'where':{'id':_0x2002e6[_0xd7ef('0x3a')]['id']}},_0x4222f7={};_0x4222f7[_0xd7ef('0x3b')]=_[_0xd7ef('0x3c')](db[_0xd7ef('0x32')]['rawAttributes']);_0x4222f7[_0xd7ef('0x37')]=_['keys'](_0x2002e6[_0xd7ef('0x37')]);_0x4222f7[_0xd7ef('0x3d')]=_[_0xd7ef('0x3e')](_0x4222f7[_0xd7ef('0x3b')],_0x4222f7['query']);_0x11dfe0[_0xd7ef('0x3f')]=_[_0xd7ef('0x3e')](_0x4222f7['model'],qs[_0xd7ef('0x40')](_0x2002e6[_0xd7ef('0x37')][_0xd7ef('0x40')]));_0x11dfe0[_0xd7ef('0x3f')]=_0x11dfe0['attributes']['length']?_0x11dfe0[_0xd7ef('0x3f')]:_0x4222f7[_0xd7ef('0x3b')];if(_0x2002e6['query'][_0xd7ef('0x41')]){_0x11dfe0[_0xd7ef('0x42')]=[{'all':!![]}];}_0x11dfe0=_[_0xd7ef('0x2d')]({},_0x11dfe0,_0x2002e6[_0xd7ef('0x43')]);return db[_0xd7ef('0x32')][_0xd7ef('0x44')](_0x11dfe0)[_0xd7ef('0x12')](handleEntityNotFound(_0x127438,null))['then'](respondWithResult(_0x127438,null))[_0xd7ef('0x1d')](handleError(_0x127438,null));};exports[_0xd7ef('0x45')]=function(_0x3f77ad,_0x308970){return db[_0xd7ef('0x32')][_0xd7ef('0x45')](_0x3f77ad['body'],{})[_0xd7ef('0x12')](respondWithResult(_0x308970,0xc9))[_0xd7ef('0x1d')](handleError(_0x308970,null));};exports[_0xd7ef('0x28')]=function(_0x3fdb87,_0x30464b){if(_0x3fdb87['body']['id']){delete _0x3fdb87[_0xd7ef('0x2e')]['id'];}return db[_0xd7ef('0x32')][_0xd7ef('0x44')]({'where':{'id':_0x3fdb87['params']['id']}})['then'](handleEntityNotFound(_0x30464b,null))[_0xd7ef('0x12')](saveUpdates(_0x3fdb87[_0xd7ef('0x2e')],null))[_0xd7ef('0x12')](respondWithResult(_0x30464b,null))[_0xd7ef('0x1d')](handleError(_0x30464b,null));};exports[_0xd7ef('0x29')]=function(_0x1c4abd,_0x371126){return db[_0xd7ef('0x32')][_0xd7ef('0x44')]({'where':{'id':_0x1c4abd['params']['id']}})[_0xd7ef('0x12')](handleEntityNotFound(_0x371126,null))[_0xd7ef('0x12')](removeEntity(_0x371126,null))['catch'](handleError(_0x371126,null));};exports[_0xd7ef('0x46')]=function(_0x4cd7d4,_0x5bbc29){return db['ChatInteraction'][_0xd7ef('0x46')]()[_0xd7ef('0x12')](respondWithResult(_0x5bbc29,null))[_0xd7ef('0x1d')](handleError(_0x5bbc29,null));};exports[_0xd7ef('0x47')]=function(_0x23f293,_0x1e58be){var _0x381cd6=_0x23f293[_0xd7ef('0x3a')]['id'];var _0x271593;var _0x283930;var _0x35445a;return db[_0xd7ef('0x32')][_0xd7ef('0x48')]({'where':{'id':_0x381cd6}})[_0xd7ef('0x12')](function(_0x469992){_0x271593=_0x469992;return db[_0xd7ef('0x49')][_0xd7ef('0x48')]({'where':{'id':_0x469992[_0xd7ef('0x4a')]},'attributes':['id',_0xd7ef('0x4b'),_0xd7ef('0x4c'),_0xd7ef('0x4d'),_0xd7ef('0x4e'),_0xd7ef('0x4f')],'raw':!![]});})[_0xd7ef('0x12')](function(_0x4f943e){if(_0x4f943e&&_0x4f943e['vidaooApiKey']&&_0x4f943e[_0xd7ef('0x4c')]){_0x283930=_0x4f943e;var _0x5d477d={'interaction':{'id':_0x381cd6},'agent':{'id':_0x23f293['user']['id'],'name':_0x23f293[_0xd7ef('0x38')][_0xd7ef('0x2a')],'fullname':_0x23f293[_0xd7ef('0x38')]['fullname'],'email':_0x23f293[_0xd7ef('0x38')][_0xd7ef('0x50')]},'contact':_0x23f293[_0xd7ef('0x2e')][_0xd7ef('0x51')],'account':_0x23f293[_0xd7ef('0x2e')][_0xd7ef('0x30')]};var _0x41aca9={'rejectUnauthorized':![],'method':_0xd7ef('0x52'),'url':_0xd7ef('0x53'),'headers':{'X-APIKEY':_0x4f943e['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x23f293[_0xd7ef('0x38')][_0xd7ef('0x50')]],'buttons':null,'topic':_0x283930[_0xd7ef('0x4d')],'note':_[_0xd7ef('0x54')](_0x283930[_0xd7ef('0x4e')])?null:getMustacheRender(_0x283930[_0xd7ef('0x4e')],_0x5d477d),'metadata':null},'redirect':_0xd7ef('0x55'),'json':!![]};try{if(!_[_0xd7ef('0x54')](_0x283930[_0xd7ef('0x4f')])){var _0x49a924=getMustacheRender(_0x283930[_0xd7ef('0x4f')],_0x5d477d);var _0x519085=JSON[_0xd7ef('0x56')](_0x49a924);_0x41aca9[_0xd7ef('0x2e')][_0xd7ef('0x57')]=_0x519085;}}catch(_0x6b2703){throw new db['Sequelize'][(_0xd7ef('0x58'))](_0xd7ef('0x59'));}return rp(_0x41aca9);}else{throw new db['Sequelize'][(_0xd7ef('0x58'))](_0xd7ef('0x5a'));}})['then'](function(_0x1eea36){_0x35445a=_0x1eea36;if(_0x35445a['id']){var _0xd5f728={'body':_0x35445a[_0xd7ef('0x5b')],'ChatWebsiteId':_0x283930['id'],'ChatInteractionId':_0x271593['id'],'direction':'out','UserId':_0x23f293[_0xd7ef('0x38')]['id']};return db['ChatMessage'][_0xd7ef('0x45')](_0xd5f728,{});}else{throw new db[(_0xd7ef('0x5c'))][(_0xd7ef('0x58'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xd7ef('0x12')](function(){return _0x271593[_0xd7ef('0x5d')]({'vidaooSessionId':_0x35445a['id']});})[_0xd7ef('0x12')](respondWithResult(_0x1e58be,null))[_0xd7ef('0x1d')](handleError(_0x1e58be,null));};exports[_0xd7ef('0x5e')]=function(_0x51b42a,_0x2fd036){if(_0x51b42a[_0xd7ef('0x2e')]['id']){delete _0x51b42a[_0xd7ef('0x2e')]['id'];}return db['ChatInteraction'][_0xd7ef('0x44')]({'where':{'id':_0x51b42a[_0xd7ef('0x3a')]['id']},'include':[{'model':db['CmContact'],'as':_0xd7ef('0x5f')}]})[_0xd7ef('0x12')](handleEntityNotFound(_0x2fd036,null))[_0xd7ef('0x12')](saveUpdates(_0x51b42a[_0xd7ef('0x2e')],null))[_0xd7ef('0x12')](respondWithResult(_0x2fd036,null))[_0xd7ef('0x1d')](handleError(_0x2fd036,null));};exports[_0xd7ef('0x60')]=function(_0x2ae7c9,_0x12bb35){if(_0x2ae7c9[_0xd7ef('0x2e')]['id']){delete _0x2ae7c9[_0xd7ef('0x2e')]['id'];}return db[_0xd7ef('0x32')][_0xd7ef('0x44')]({'where':{'id':_0x2ae7c9[_0xd7ef('0x3a')]['id']}})[_0xd7ef('0x12')](function(_0x5e16b0){if(!_0x5e16b0){logger[_0xd7ef('0x18')](_0xd7ef('0x61'),_0xd7ef('0x60'),0x194,_0xd7ef('0x62'));_0x12bb35[_0xd7ef('0x1e')](0x194);}else{if(_0x5e16b0['UserId']){throw new db['Sequelize'][(_0xd7ef('0x58'))]('Interaction\x20already\x20assigned');}}return _0x5e16b0;})['then'](function(_0x1c590f){if(_0x1c590f){return _0x1c590f[_0xd7ef('0x28')]({'closed':_0x2ae7c9[_0xd7ef('0x2e')]['closed'],'disposition':_0x2ae7c9['body']['disposition']})[_0xd7ef('0x12')](function(_0x190575){return _0x190575;});}})['then'](function(){return respondWithRpcPromise(_0xd7ef('0x63'),'abandon',_0x2ae7c9[_0xd7ef('0x2e')],client9004);})[_0xd7ef('0x12')](respondWithResult(_0x12bb35,null))[_0xd7ef('0x1d')](handleError(_0x12bb35,null));};exports[_0xd7ef('0x64')]=function(_0x4eeea3,_0x54715a){_0x4eeea3[_0xd7ef('0x2e')][_0xd7ef('0x2a')]=_0x4eeea3[_0xd7ef('0x65')][_0xd7ef('0x66')];_0x4eeea3['body'][_0xd7ef('0x67')]=_0x4eeea3[_0xd7ef('0x65')][_0xd7ef('0x68')];_0x4eeea3['body'][_0xd7ef('0x34')]=_0x4eeea3[_0xd7ef('0x65')]['mimetype'];return db[_0xd7ef('0x69')][_0xd7ef('0x45')](_0x4eeea3['body'])[_0xd7ef('0x12')](respondWithResult(_0x54715a,0xc9))['catch'](handleError(_0x54715a,null));};exports[_0xd7ef('0x6a')]=function(_0x74ddc1,_0x119b58){return db[_0xd7ef('0x32')][_0xd7ef('0x48')]({'where':{'id':_0x74ddc1[_0xd7ef('0x3a')]['id']},'raw':!![]})[_0xd7ef('0x12')](handleEntityNotFound(_0x119b58,null))[_0xd7ef('0x12')](function(_0xb8fc76){if(_0xb8fc76){if(_0xb8fc76[_0xd7ef('0x6b')]){return _0x119b58[_0xd7ef('0x1f')](0x193)['json']({'status':0x193,'message':_0xd7ef('0x6c')});}return db[_0xd7ef('0x69')]['findOne']({'where':{'id':_0x74ddc1[_0xd7ef('0x37')][_0xd7ef('0x6d')]},'raw':!![]})[_0xd7ef('0x12')](handleEntityNotFound(_0x119b58,null));}})[_0xd7ef('0x12')](function(_0x5e4488){if(_0x5e4488){var _0x4287f3=_0x5e4488[_0xd7ef('0x6e')]!==null;var _0x45425a=path['join'](config[_0xd7ef('0x6f')],'server/files/attachments/');if(_0x4287f3){_0x45425a=path[_0xd7ef('0x70')](_0x45425a,'offline-chat/');}var _0x396bc0=path[_0xd7ef('0x70')](_0x45425a,_0x5e4488[_0xd7ef('0x67')]);return _0x119b58[_0xd7ef('0x71')](_0x396bc0);}})['catch'](handleError(_0x119b58,null));};exports['close']=function(_0x46cdd4,_0x47f3cf){var _0x13d962=null;var _0x1940c3=null;var _0x440351=null;if(_0x46cdd4[_0xd7ef('0x2e')]['id']){delete _0x46cdd4['body']['id'];}if(_0x46cdd4[_0xd7ef('0x2e')][_0xd7ef('0x72')]){_0x440351=path[_0xd7ef('0x70')](config['root'],_0xd7ef('0x73'),util[_0xd7ef('0x74')](_0xd7ef('0x75'),Date[_0xd7ef('0x76')]()));_0x46cdd4[_0xd7ef('0x2e')][_0xd7ef('0x77')]=_0x440351;}return db[_0xd7ef('0x32')][_0xd7ef('0x44')]({'where':{'id':_0x46cdd4[_0xd7ef('0x3a')]['id']},'include':[{'model':db[_0xd7ef('0x78')],'as':_0xd7ef('0x79'),'include':[{'model':db[_0xd7ef('0x7a')],'as':_0xd7ef('0x7a')}]}]})[_0xd7ef('0x12')](handleEntityNotFound(_0x47f3cf,null))[_0xd7ef('0x12')](saveUpdates(_0x46cdd4[_0xd7ef('0x2e')],null))[_0xd7ef('0x12')](function(_0x262ab8){if(_0x262ab8){_0x13d962=_0x262ab8;return db[_0xd7ef('0x49')][_0xd7ef('0x44')]({'where':{'id':_0x13d962[_0xd7ef('0x4a')]}});}})[_0xd7ef('0x12')](function(_0x1bf5e3){if(_0x1bf5e3){_0x1940c3=_0x1bf5e3;return db[_0xd7ef('0x7b')][_0xd7ef('0x44')]({'where':{'id':_0x13d962[_0xd7ef('0x7c')]}});}})[_0xd7ef('0x12')](function(_0x1f8235){if(_0x1f8235){if(_0x440351){var _0x2e06ff=null;for(var _0x22c550=0x1;_0x22c550<_0x13d962[_0xd7ef('0x79')][_0xd7ef('0x7d')];++_0x22c550){_0x2e06ff=_0x13d962[_0xd7ef('0x79')][_0x22c550];var _0x19ee85=_0x2e06ff[_0xd7ef('0x7e')]?util['format']('%s%d',_0x1940c3[_0xd7ef('0x7f')],_0x2e06ff[_0xd7ef('0x7e')]):_0xd7ef('0x80');var _0x4786c8=_0x46cdd4[_0xd7ef('0x2e')][_0xd7ef('0x81')]||util[_0xd7ef('0x74')](_0xd7ef('0x82'),_0xd7ef('0x83'),_0x2e06ff['ContactId']);switch(_0x1940c3['agentIdentifier']){case _0xd7ef('0x84'):_0x19ee85=_0x2e06ff['UserId']?util[_0xd7ef('0x74')](_0xd7ef('0x82'),_0x1940c3[_0xd7ef('0x7f')],_0x2e06ff['UserId']):'System';break;case _0xd7ef('0x85'):_0x19ee85=_0x2e06ff['UserId']?_0x2e06ff[_0xd7ef('0x7a')][_0xd7ef('0x86')]||_0x2e06ff['User'][_0xd7ef('0x87')]:_0xd7ef('0x80');break;case _0xd7ef('0x88'):_0x19ee85=_0x2e06ff[_0xd7ef('0x7e')]?_0x2e06ff[_0xd7ef('0x7a')][_0xd7ef('0x87')]:'System';break;default:_0x19ee85=_0x2e06ff[_0xd7ef('0x7e')]?util[_0xd7ef('0x74')](_0xd7ef('0x82'),_0x1940c3[_0xd7ef('0x7f')],_0x2e06ff['UserId']):_0xd7ef('0x80');}var _0x30f993=util['format'](_0xd7ef('0x89'),moment(_0x2e06ff[_0xd7ef('0x8a')])['format'](_0xd7ef('0x8b')),_0x2e06ff[_0xd7ef('0x8c')]==='in'?_0x4786c8:_0x19ee85,_0x2e06ff['body']);if(!_0x2e06ff[_0xd7ef('0x8d')]){fs['appendFileSync'](_0x440351,_0x30f993);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xd7ef('0x8e')],'as':_0xd7ef('0x8f'),'raw':!![],'include':[{'model':db[_0xd7ef('0x90')],'as':_0xd7ef('0x90'),'raw':!![]}]}]});}}})[_0xd7ef('0x12')](function(_0x4d6078){if(!_0x4d6078||!_0x4d6078['Smtp']||!_0x46cdd4[_0xd7ef('0x2e')])return _0x13d962;var _0xd1b9d6=_0x4d6078[_0xd7ef('0x91')]();return respondWithRpcPromise('SendMail',_0xd7ef('0x92'),{'account':_0xd1b9d6,'message':{'from':util[_0xd7ef('0x74')](_0xd7ef('0x93'),_0x4d6078['name'],_0x4d6078['email']||_0x4d6078[_0xd7ef('0x8f')][_0xd7ef('0x38')]),'to':_0x46cdd4[_0xd7ef('0x2e')][_0xd7ef('0x72')],'subject':_0xd7ef('0x94'),'text':util['format'](_0xd7ef('0x95'),_0x46cdd4[_0xd7ef('0x2e')][_0xd7ef('0x72')]),'attachments':[{'path':_0x440351}]}})[_0xd7ef('0x12')](function(){return _0x13d962;})[_0xd7ef('0x1d')](function(_0x358ed7){logger[_0xd7ef('0x18')](_0x358ed7);});})['then'](respondWithStatusCode(_0x47f3cf,0xc8))[_0xd7ef('0x1d')](handleError(_0x47f3cf,null));};exports[_0xd7ef('0x96')]=function(_0x3d66b3,_0x1e49d7){return db[_0xd7ef('0x78')]['find']({'where':{'id':_0x3d66b3[_0xd7ef('0x3a')]['id']}})[_0xd7ef('0x12')](handleEntityNotFound(_0x1e49d7,null))[_0xd7ef('0x12')](function(_0x198f99){if(_0x198f99){return _0x198f99[_0xd7ef('0x96')](_0x3d66b3[_0xd7ef('0x2e')][_0xd7ef('0x97')],_[_0xd7ef('0x98')](_0x3d66b3['body'],['ids','id'])||{});}})[_0xd7ef('0x12')](respondWithResult(_0x1e49d7,null))[_0xd7ef('0x1d')](handleError(_0x1e49d7,null));};exports['getMessages']=function(_0x477796,_0x32c80b){var _0x260b23={'raw':![],'where':{}};var _0x207816={};var _0xe6f083={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xd7ef('0x48')]({'where':{'id':_0x477796[_0xd7ef('0x3a')]['id']}})[_0xd7ef('0x12')](handleEntityNotFound(_0x32c80b,null))[_0xd7ef('0x12')](function(_0x164625){if(_0x164625){_0x207816[_0xd7ef('0x3b')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x207816[_0xd7ef('0x37')]=_['keys'](_0x477796['query']);_0x207816['filters']=_['intersection'](_0x207816[_0xd7ef('0x3b')],_0x207816[_0xd7ef('0x37')]);_0x260b23[_0xd7ef('0x3f')]=_[_0xd7ef('0x3e')](_0x207816['model'],qs[_0xd7ef('0x40')](_0x477796[_0xd7ef('0x37')][_0xd7ef('0x40')]));_0x260b23[_0xd7ef('0x3f')]=_0x260b23[_0xd7ef('0x3f')][_0xd7ef('0x7d')]?_0x260b23[_0xd7ef('0x3f')]:_0x207816[_0xd7ef('0x3b')];if(!_0x477796[_0xd7ef('0x37')][_0xd7ef('0x99')](_0xd7ef('0x9a'))){_0x260b23[_0xd7ef('0x24')]=qs[_0xd7ef('0x24')](_0x477796[_0xd7ef('0x37')][_0xd7ef('0x24')]);_0x260b23[_0xd7ef('0x22')]=qs[_0xd7ef('0x22')](_0x477796['query'][_0xd7ef('0x22')]);}_0x260b23[_0xd7ef('0x9b')]=qs[_0xd7ef('0x9c')](_0x477796[_0xd7ef('0x37')][_0xd7ef('0x9c')]);_0x260b23['where']=qs[_0xd7ef('0x3d')](_[_0xd7ef('0x9d')](_0x477796['query'],_0x207816[_0xd7ef('0x3d')]));_0x260b23['where'][_0xd7ef('0x9e')]=_0x164625['id'];if(_0x477796[_0xd7ef('0x37')][_0xd7ef('0x9f')]){_0x260b23[_0xd7ef('0xa0')]=_[_0xd7ef('0x2d')](_0x260b23[_0xd7ef('0xa0')],{'$or':_[_0xd7ef('0x31')](_0x260b23[_0xd7ef('0x3f')],function(_0x1da8f6){var _0x45e28e={};_0x45e28e[_0x1da8f6]={'$like':'%'+_0x477796[_0xd7ef('0x37')]['filter']+'%'};return _0x45e28e;})});}if(_0x477796['query']['$gte']){var _0x1a997f=_0x477796[_0xd7ef('0x37')][_0xd7ef('0xa1')][_0xd7ef('0xa2')](',');var _0x5e7cb1={};_0x5e7cb1[_0x1a997f[0x0]]={'$gte':moment(_0x1a997f[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x260b23['where']=_[_0xd7ef('0x2d')](_0x260b23[_0xd7ef('0xa0')],_0x5e7cb1);}_0x260b23=_[_0xd7ef('0x2d')]({},_0x260b23,_0x477796[_0xd7ef('0x43')]);return db['ChatMessage'][_0xd7ef('0x25')]({'where':_0x260b23['where']})[_0xd7ef('0x12')](function(_0x28b863){_0xe6f083[_0xd7ef('0x25')]=_0x28b863;if(_0x477796[_0xd7ef('0x37')][_0xd7ef('0x41')]){_0x260b23[_0xd7ef('0x42')]=[{'all':!![]}];}return db[_0xd7ef('0x78')][_0xd7ef('0xa3')](_0x260b23);})['then'](function(_0x3d4be7){_0xe6f083[_0xd7ef('0xa4')]=_0x3d4be7;return _0xe6f083;});}})[_0xd7ef('0x12')](respondWithFilteredResult(_0x32c80b,_0x260b23))[_0xd7ef('0x1d')](handleError(_0x32c80b,null));};exports['getMyMessages']=function(_0x5a6e42,_0x3eef16){var _0xfa8a41={'where':{}},_0x3a89a9={},_0xef76b8={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xd7ef('0x48')]({'where':{'id':_0x5a6e42[_0xd7ef('0x3a')]['id']}})[_0xd7ef('0x12')](handleEntityNotFound(_0x3eef16,null))[_0xd7ef('0x12')](function(_0x24ccaa){if(_0x24ccaa){_0x3a89a9['model']=_[_0xd7ef('0x3c')](db['ChatMessage'][_0xd7ef('0xa5')]);_0x3a89a9[_0xd7ef('0x37')]=_['keys'](_0x5a6e42[_0xd7ef('0x37')]);_0x3a89a9[_0xd7ef('0x3d')]=_[_0xd7ef('0x3e')](_0x3a89a9[_0xd7ef('0x3b')],_0x3a89a9[_0xd7ef('0x37')]);_0xfa8a41[_0xd7ef('0x3f')]=_['intersection'](_0x3a89a9['model'],qs[_0xd7ef('0x40')](_0x5a6e42[_0xd7ef('0x37')][_0xd7ef('0x40')]));_0xfa8a41[_0xd7ef('0x3f')]=_0xfa8a41['attributes'][_0xd7ef('0x7d')]?_0xfa8a41[_0xd7ef('0x3f')]:_0x3a89a9['model'];if(!_0x5a6e42[_0xd7ef('0x37')]['hasOwnProperty'](_0xd7ef('0x9a'))){_0xfa8a41[_0xd7ef('0x24')]=qs['limit'](_0x5a6e42[_0xd7ef('0x37')][_0xd7ef('0x24')]);_0xfa8a41[_0xd7ef('0x22')]=qs[_0xd7ef('0x22')](_0x5a6e42[_0xd7ef('0x37')][_0xd7ef('0x22')]);}_0xfa8a41[_0xd7ef('0x9b')]=qs[_0xd7ef('0x9c')](_0x5a6e42['query'][_0xd7ef('0x9c')]);_0xfa8a41[_0xd7ef('0xa0')]=qs[_0xd7ef('0x3d')](_[_0xd7ef('0x9d')](_0x5a6e42[_0xd7ef('0x37')],_0x3a89a9['filters']));_0xfa8a41[_0xd7ef('0xa0')][_0xd7ef('0x9e')]=_0x24ccaa['id'];if(_0x5a6e42['query'][_0xd7ef('0x9f')]){_0xfa8a41[_0xd7ef('0xa0')]=_[_0xd7ef('0x2d')](_0xfa8a41[_0xd7ef('0xa0')],{'$or':_[_0xd7ef('0x31')](_0xfa8a41[_0xd7ef('0x3f')],function(_0x46762c){var _0x199c9d={};_0x199c9d[_0x46762c]={'$like':'%'+_0x5a6e42['query'][_0xd7ef('0x9f')]+'%'};return _0x199c9d;})});}_0xfa8a41[_0xd7ef('0xa0')]['secret']=![];if(_0x5a6e42[_0xd7ef('0x37')]['id']){_0xfa8a41[_0xd7ef('0xa0')]['id']={'$gt':_0x5a6e42[_0xd7ef('0x37')]['id']};}_0xfa8a41=_[_0xd7ef('0x2d')]({},_0xfa8a41,_0x5a6e42[_0xd7ef('0x43')]);return db['ChatMessage'][_0xd7ef('0x25')]({'where':_0xfa8a41[_0xd7ef('0xa0')]})[_0xd7ef('0x12')](function(_0xe44e0f){_0xef76b8[_0xd7ef('0x25')]=_0xe44e0f;_0xfa8a41[_0xd7ef('0x42')]=[];if(_0x5a6e42[_0xd7ef('0x37')][_0xd7ef('0xa6')]){_0xfa8a41[_0xd7ef('0x42')]['push']({'model':db[_0xd7ef('0x7a')],'as':_0xd7ef('0x7a'),'attributes':['id',_0xd7ef('0x87'),_0xd7ef('0x86')]});}if(_0x5a6e42[_0xd7ef('0x37')]['includeAll']){_0xfa8a41[_0xd7ef('0x42')]=[{'all':!![]}];}return db['ChatMessage'][_0xd7ef('0xa3')](_0xfa8a41);})[_0xd7ef('0x12')](function(_0x550c59){_0xef76b8[_0xd7ef('0xa4')]=_0x550c59;return _0xef76b8;});}})[_0xd7ef('0x12')](respondWithFilteredResult(_0x3eef16,_0xfa8a41))[_0xd7ef('0x1d')](handleError(_0x3eef16,null));};exports[_0xd7ef('0xa7')]=function(_0x42a32e,_0x386505){return db[_0xd7ef('0x32')][_0xd7ef('0x44')]({'where':{'id':_0x42a32e['params']['id']}})[_0xd7ef('0x12')](handleEntityNotFound(_0x386505,null))[_0xd7ef('0x12')](function(_0x97eb9b){if(_0x97eb9b){return _0x97eb9b[_0xd7ef('0xa8')](_0x42a32e[_0xd7ef('0x2e')][_0xd7ef('0x97')],_[_0xd7ef('0x98')](_0x42a32e['body'],[_0xd7ef('0x97'),'id'])||{})['spread'](function(){return db[_0xd7ef('0xa9')][_0xd7ef('0xa3')]({'attributes':['id',_0xd7ef('0x2a'),_0xd7ef('0xaa')],'where':{'id':_0x42a32e['body'][_0xd7ef('0x97')]}});})[_0xd7ef('0x12')](function(_0x3e8bd0){socket[_0xd7ef('0xab')](_0xd7ef('0xac'),{'id':Number(_0x42a32e[_0xd7ef('0x3a')]['id']),'tags':_0x3e8bd0||[]});return{'id':Number(_0x42a32e[_0xd7ef('0x3a')]['id']),'tags':_0x3e8bd0||[]};});}})[_0xd7ef('0x12')](respondWithResult(_0x386505,null))[_0xd7ef('0x1d')](handleError(_0x386505,null));};exports[_0xd7ef('0xad')]=function(_0xa65422,_0x1dffed){return db[_0xd7ef('0x32')][_0xd7ef('0x44')]({'where':{'id':_0xa65422[_0xd7ef('0x3a')]['id']}})['then'](handleEntityNotFound(_0x1dffed,null))[_0xd7ef('0x12')](function(_0x55b704){if(_0x55b704){return _0x55b704[_0xd7ef('0xad')](_0xa65422['query'][_0xd7ef('0x97')]);}})[_0xd7ef('0x12')](respondWithStatusCode(_0x1dffed,null))[_0xd7ef('0x1d')](handleError(_0x1dffed,null));};exports[_0xd7ef('0x71')]=function(_0xe73fa2,_0x52f4ca){var _0xa124b0=moment()['unix']()[_0xd7ef('0xae')]();var _0x42f71c=path[_0xd7ef('0x70')](config[_0xd7ef('0x6f')],_0xd7ef('0xaf'),_0xd7ef('0xb0'),_0xd7ef('0xb1'));var _0x19527b=path[_0xd7ef('0x70')](config[_0xd7ef('0x6f')],'server',_0xd7ef('0xb0'),_0xd7ef('0xb2'));var _0x28c1e7=path[_0xd7ef('0x70')](_0x42f71c,_0xa124b0);var _0x53db13=util[_0xd7ef('0x74')](_0xd7ef('0xb3'),_0xe73fa2[_0xd7ef('0x3a')]['id'],_0xa124b0);var _0x563f60=path[_0xd7ef('0x70')](_0x42f71c,_0x53db13);var _0x17ef32=[];_0x17ef32[_0xd7ef('0xb4')]({'model':db[_0xd7ef('0x7a')],'as':_0xd7ef('0x7a'),'attributes':['id',_0xd7ef('0x87')],'raw':!![]});_0x17ef32['push']({'model':db[_0xd7ef('0x7b')],'as':_0xd7ef('0x5f'),'attributes':['id',_0xd7ef('0xb5'),_0xd7ef('0xb6')],'raw':!![]});if(_0xe73fa2['query'][_0xd7ef('0xb2')]){_0x17ef32[_0xd7ef('0xb4')]({'model':db[_0xd7ef('0x69')],'as':_0xd7ef('0x69'),'raw':!![]});}var _0x1d7699=[{'model':db['ChatMessage'],'as':_0xd7ef('0x79'),'attributes':['id',_0xd7ef('0x2e'),_0xd7ef('0x8a'),_0xd7ef('0x8c'),_0xd7ef('0x8d'),_0xd7ef('0xb7')],'include':_0x17ef32}];_0x1d7699[_0xd7ef('0xb4')]({'model':db[_0xd7ef('0x49')],'as':_0xd7ef('0xb8'),'attributes':['id',_0xd7ef('0x2a')]});_0x1d7699[_0xd7ef('0xb4')]({'model':db[_0xd7ef('0x7a')],'as':_0xd7ef('0xb9'),'attributes':['id',_0xd7ef('0x87')]});return db[_0xd7ef('0x32')]['find']({'where':{'id':_0xe73fa2[_0xd7ef('0x3a')]['id']},'include':_0x1d7699})[_0xd7ef('0x12')](handleEntityNotFound(_0x52f4ca,null))[_0xd7ef('0x12')](function(_0x566950){if(_0x566950){var _0x96b625=_0x566950[_0xd7ef('0xba')]({'plain':!![]});fs[_0xd7ef('0xbb')](_0x28c1e7);var _0x315484={'channel':_0xd7ef('0xbc'),'account':_0x96b625[_0xd7ef('0xb8')][_0xd7ef('0x2a')],'agent':_0x96b625[_0xd7ef('0xb9')]?_0x96b625[_0xd7ef('0xb9')][_0xd7ef('0x87')]:_0xd7ef('0xbd'),'createdAt':moment(_0x96b625[_0xd7ef('0x8a')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xd7ef('0xae')](),'closedAt':_0x96b625[_0xd7ef('0x6b')]?moment(_0x96b625[_0xd7ef('0xbe')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x96b625[_0xd7ef('0xbf')],'chatInfo':{'browser':_0x96b625[_0xd7ef('0xc0')],'os':_0x96b625[_0xd7ef('0xc1')],'referer':_0x96b625['referer'],'customerIp':_0x96b625[_0xd7ef('0xc2')],'customerPort':_0x96b625[_0xd7ef('0xc3')]?_0x96b625[_0xd7ef('0xc3')]:_0xd7ef('0xbd')},'messages':_(_0x96b625[_0xd7ef('0x79')])['tail']()['filter']({'secret':![]})[_0xd7ef('0x31')](function(_0x4e29ff){if(_0x4e29ff['Attachment']){var _0x4e1708=path[_0xd7ef('0x70')](_0x19527b,_0x4e29ff['Attachment'][_0xd7ef('0x67')]);if(fs[_0xd7ef('0xc4')](_0x4e1708)){fs[_0xd7ef('0xc5')](_0x4e1708)['pipe'](fs[_0xd7ef('0xc6')](path['join'](_0x28c1e7,_0x4e29ff[_0xd7ef('0x69')]['basename'])));}}return{'date':moment(_0x4e29ff[_0xd7ef('0x8a')])[_0xd7ef('0x74')](_0xd7ef('0xc7'))[_0xd7ef('0xae')](),'sender':_0x4e29ff[_0xd7ef('0x8c')]==='out'?_0x4e29ff[_0xd7ef('0x7a')]?_0x4e29ff['User'][_0xd7ef('0x87')]:_0xd7ef('0x80'):_0x4e29ff[_0xd7ef('0x5f')]['firstName']+(_0x4e29ff[_0xd7ef('0x5f')][_0xd7ef('0xb6')]?'\x20'+_0x4e29ff[_0xd7ef('0x5f')][_0xd7ef('0xb6')]:''),'body':_0x4e29ff['Attachment']?_0x4e29ff['Attachment'][_0xd7ef('0x67')]:_0x4e29ff[_0xd7ef('0x2e')],'direction':_0x4e29ff['direction']===_0xd7ef('0xc8')?'A':'C','secret':_0x4e29ff['secret'],'read':_0x4e29ff[_0xd7ef('0xb7')],'attachment':_0x4e29ff[_0xd7ef('0x69')]};})[_0xd7ef('0xc9')]()};return ejs[_0xd7ef('0xca')](path[_0xd7ef('0x70')](config[_0xd7ef('0x6f')],_0xd7ef('0xaf'),_0xd7ef('0xcb'),_0xd7ef('0xcc')),{'interaction':_0x315484})[_0xd7ef('0x12')](function(_0x26b595){var _0x4a282e=path['join'](_0x28c1e7,_0xd7ef('0xcd')+_0x96b625['id']+'-'+_0xa124b0+_0xd7ef('0xce'));var _0x7b9a08={'path':_0x4a282e,'channel':_0xd7ef('0xbc'),'interactionId':_0x96b625['id']};return pdf[_0xd7ef('0xcf')](_0x26b595,_0x7b9a08);})[_0xd7ef('0x12')](function(){return new Promise(function(_0x463534,_0x139602){zipdir(_0x28c1e7,{'saveTo':_0x563f60},function(_0x3f0e3b,_0x4a1ebf){if(_0x3f0e3b)return _0x139602(_0x3f0e3b);return _0x463534(_0x4a1ebf);});})[_0xd7ef('0x12')](function(){return new BPromise(function(_0x24b20f,_0x1a2f7d){rimraf(_0x28c1e7,function(_0x2e75d6){if(_0x2e75d6)_0x1a2f7d(_0x2e75d6);return _0x24b20f();});});})[_0xd7ef('0x12')](function(){return _0x52f4ca['download'](_0x563f60,_0x53db13,function(_0x1a8c17){if(_0x1a8c17){logger['error'](_0xd7ef('0xd0'),_0x1a8c17);}else{fs[_0xd7ef('0xd1')](_0x563f60);}});});});}else{return _0x52f4ca['sendStatus'](0xc8);}})[_0xd7ef('0x1d')](handleError(_0x52f4ca,null));}; \ No newline at end of file +var _0x28ff=['moment','bluebird','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','undefined','limit','count','offset','Content-Range','destroy','stack','name','render','contact','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','findAll','chat','query','user','params','model','keys','filters','attributes','intersection','fields','length','includeAll','merge','options','find','create','body','update','describe','findOne','ChatWebsite','vidaooEscalation','vidaooNote','vidaooMetadata','vidaooApiKey','fullname','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','vidaooTopic','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','Interaction\x20already\x20assigned','disposition','AbandonInteraction','file','basename','mimetype','Attachment','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','ChatWebsiteId','UserId','%s%d','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','agentAlias','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','include','rows','getMyMessages','includeAgent','push','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','server','files','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','createdAt','direction','Account','Owner','N.A.','toString','closed','closedAt','browserName','osName','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','lastName','read','value','renderFile','views','downloadInteraction.ejs','.pdf','Chat','err','rimraf','zip-dir'];(function(_0x3f129c,_0x576eaf){var _0x3f93b4=function(_0x5af028){while(--_0x5af028){_0x3f129c['push'](_0x3f129c['shift']());}};_0x3f93b4(++_0x576eaf);}(_0x28ff,0x19c));var _0xf28f=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x28ff[_0x3bf83f];return _0x22c4a9;};'use strict';var rimraf=require(_0xf28f('0x0'));var zipdir=require(_0xf28f('0x1'));var rp=require('request-promise');var moment=require(_0xf28f('0x2'));var BPromise=require(_0xf28f('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf28f('0x4'));var ejs=require(_0xf28f('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xf28f('0x6'));var interaction=require(_0xf28f('0x7'));var qs=require(_0xf28f('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0xf28f('0x9'))('api');var config=require(_0xf28f('0xa'));var db=require(_0xf28f('0xb'))['db'];config[_0xf28f('0xc')]=_[_0xf28f('0xd')](config[_0xf28f('0xc')],{'host':_0xf28f('0xe'),'port':0x18eb});var socket=require(_0xf28f('0xf'))(new Redis(config[_0xf28f('0xc')]));require('./chatInteraction.socket')[_0xf28f('0x10')](socket);var jayson=require(_0xf28f('0x11'));var client=jayson['client'][_0xf28f('0x12')]({'port':0x232b});var client9004=jayson[_0xf28f('0x13')][_0xf28f('0x12')]({'port':0x232c});function respondWithRpcPromise(_0x219e1e,_0x434627,_0x12149b,_0x505d48){return new BPromise(function(_0x4acbfc,_0x29210a){var _0xd2bbf9=_0x505d48||client;return _0xd2bbf9[_0xf28f('0x14')](_0x219e1e,_0x12149b)[_0xf28f('0x15')](function(_0xc8e81e){logger[_0xf28f('0x16')](_0xf28f('0x17'),_0x434627,_0xf28f('0x18'));logger[_0xf28f('0x19')](_0xf28f('0x1a'),_0x434627,_0xf28f('0x18'),JSON[_0xf28f('0x1b')](_0xc8e81e));if(_0xc8e81e[_0xf28f('0x1c')]){if(_0xc8e81e[_0xf28f('0x1c')][_0xf28f('0x1d')]===0x1f4){logger[_0xf28f('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x434627,_0xc8e81e[_0xf28f('0x1c')][_0xf28f('0x1e')]);return _0x29210a(_0xc8e81e[_0xf28f('0x1c')][_0xf28f('0x1e')]);}logger[_0xf28f('0x1c')](_0xf28f('0x17'),_0x434627,_0xc8e81e[_0xf28f('0x1c')][_0xf28f('0x1e')]);return _0x4acbfc(_0xc8e81e[_0xf28f('0x1c')][_0xf28f('0x1e')]);}else{logger[_0xf28f('0x16')](_0xf28f('0x17'),_0x434627,_0xf28f('0x18'));_0x4acbfc(_0xc8e81e[_0xf28f('0x1f')][_0xf28f('0x1e')]);}})[_0xf28f('0x20')](function(_0x42ba0e){logger[_0xf28f('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x434627,_0x42ba0e);_0x29210a(_0x42ba0e);});});}function respondWithStatusCode(_0x4ec373,_0x13333f){_0x13333f=_0x13333f||0xcc;return function(_0x1c141d){if(_0x1c141d){return _0x4ec373['sendStatus'](_0x13333f);}return _0x4ec373[_0xf28f('0x21')](_0x13333f)[_0xf28f('0x22')]();};}function respondWithResult(_0x5030bf,_0x5d1ada){_0x5d1ada=_0x5d1ada||0xc8;return function(_0x4fd57c){if(_0x4fd57c){return _0x5030bf[_0xf28f('0x21')](_0x5d1ada)[_0xf28f('0x23')](_0x4fd57c);}};}function respondWithFilteredResult(_0x2be8dc,_0x61ae83){return function(_0x502d6c){if(_0x502d6c){var _0x4ee2cd=typeof _0x61ae83['offset']===_0xf28f('0x24')&&typeof _0x61ae83[_0xf28f('0x25')]===_0xf28f('0x24');var _0x40c0aa=_0x502d6c[_0xf28f('0x26')];var _0xffcefa=_0x4ee2cd?0x0:_0x61ae83[_0xf28f('0x27')];var _0x543dfe=_0x4ee2cd?_0x502d6c[_0xf28f('0x26')]:_0x61ae83[_0xf28f('0x27')]+_0x61ae83[_0xf28f('0x25')];var _0x2519ab;if(_0x543dfe>=_0x40c0aa){_0x543dfe=_0x40c0aa;_0x2519ab=0xc8;}else{_0x2519ab=0xce;}_0x2be8dc[_0xf28f('0x21')](_0x2519ab);return _0x2be8dc['set'](_0xf28f('0x28'),_0xffcefa+'-'+_0x543dfe+'/'+_0x40c0aa)[_0xf28f('0x23')](_0x502d6c);}return null;};}function saveUpdates(_0x578ee1){return function(_0x4d561e){if(_0x4d561e){return _0x4d561e['update'](_0x578ee1)[_0xf28f('0x15')](function(_0xac21ff){return _0xac21ff;});}return null;};}function removeEntity(_0x4ba137){return function(_0xcff713){if(_0xcff713){return _0xcff713[_0xf28f('0x29')]()[_0xf28f('0x15')](function(){_0x4ba137[_0xf28f('0x21')](0xcc)[_0xf28f('0x22')]();});}};}function handleEntityNotFound(_0x295f7b){return function(_0x109891){if(!_0x109891){_0x295f7b['sendStatus'](0x194);}return _0x109891;};}function handleError(_0x1642c7,_0x32a961){_0x32a961=_0x32a961||0x1f4;return function(_0x20f932){logger[_0xf28f('0x1c')](_0x20f932[_0xf28f('0x2a')]);if(_0x20f932['name']){delete _0x20f932[_0xf28f('0x2b')];}_0x1642c7[_0xf28f('0x21')](_0x32a961)['send'](_0x20f932);};}function getMustacheRender(_0x3a2b77,_0x356bd2){return Mustache[_0xf28f('0x2c')](_0x3a2b77,_['merge'](_0x356bd2['body'],{'contact':_0x356bd2[_0xf28f('0x2d')],'message':_0x356bd2[_0xf28f('0x1e')],'agent':_0x356bd2['agent'],'interaction':_0x356bd2[_0xf28f('0x2e')],'account':_0x356bd2[_0xf28f('0x2f')]}))||'';}exports[_0xf28f('0x30')]=function(_0x25e51e,_0x961701){var _0xfc52a9={};var _0x50b221=_[_0xf28f('0x31')](db[_0xf28f('0x32')][_0xf28f('0x33')],function(_0x244f37){return{'name':_0x244f37[_0xf28f('0x34')],'type':_0x244f37[_0xf28f('0x35')][_0xf28f('0x36')]};});_0xfc52a9=qs['getOptions'](_0x50b221,_0x25e51e);return interaction[_0xf28f('0x37')](_0xf28f('0x38'),_0x25e51e[_0xf28f('0x39')],_0x25e51e[_0xf28f('0x3a')],_0xfc52a9,_0x50b221)['then'](respondWithFilteredResult(_0x961701,_0xfc52a9))[_0xf28f('0x20')](handleError(_0x961701,null));};exports['show']=function(_0x23c90d,_0x57c13f){var _0x48cb1e={'raw':![],'where':{'id':_0x23c90d[_0xf28f('0x3b')]['id']}},_0x12aa05={};_0x12aa05[_0xf28f('0x3c')]=_[_0xf28f('0x3d')](db[_0xf28f('0x32')][_0xf28f('0x33')]);_0x12aa05[_0xf28f('0x39')]=_[_0xf28f('0x3d')](_0x23c90d[_0xf28f('0x39')]);_0x12aa05[_0xf28f('0x3e')]=_['intersection'](_0x12aa05[_0xf28f('0x3c')],_0x12aa05[_0xf28f('0x39')]);_0x48cb1e[_0xf28f('0x3f')]=_[_0xf28f('0x40')](_0x12aa05[_0xf28f('0x3c')],qs['fields'](_0x23c90d[_0xf28f('0x39')][_0xf28f('0x41')]));_0x48cb1e['attributes']=_0x48cb1e[_0xf28f('0x3f')][_0xf28f('0x42')]?_0x48cb1e[_0xf28f('0x3f')]:_0x12aa05['model'];if(_0x23c90d[_0xf28f('0x39')][_0xf28f('0x43')]){_0x48cb1e['include']=[{'all':!![]}];}_0x48cb1e=_[_0xf28f('0x44')]({},_0x48cb1e,_0x23c90d[_0xf28f('0x45')]);return db[_0xf28f('0x32')][_0xf28f('0x46')](_0x48cb1e)[_0xf28f('0x15')](handleEntityNotFound(_0x57c13f,null))[_0xf28f('0x15')](respondWithResult(_0x57c13f,null))[_0xf28f('0x20')](handleError(_0x57c13f,null));};exports[_0xf28f('0x47')]=function(_0x349862,_0x13b7d2){return db[_0xf28f('0x32')][_0xf28f('0x47')](_0x349862[_0xf28f('0x48')],{})[_0xf28f('0x15')](respondWithResult(_0x13b7d2,0xc9))[_0xf28f('0x20')](handleError(_0x13b7d2,null));};exports[_0xf28f('0x49')]=function(_0x267877,_0x989567){if(_0x267877[_0xf28f('0x48')]['id']){delete _0x267877[_0xf28f('0x48')]['id'];}return db['ChatInteraction'][_0xf28f('0x46')]({'where':{'id':_0x267877['params']['id']}})[_0xf28f('0x15')](handleEntityNotFound(_0x989567,null))[_0xf28f('0x15')](saveUpdates(_0x267877[_0xf28f('0x48')],null))[_0xf28f('0x15')](respondWithResult(_0x989567,null))['catch'](handleError(_0x989567,null));};exports[_0xf28f('0x29')]=function(_0x3f666a,_0x3f0414){return db['ChatInteraction'][_0xf28f('0x46')]({'where':{'id':_0x3f666a[_0xf28f('0x3b')]['id']}})[_0xf28f('0x15')](handleEntityNotFound(_0x3f0414,null))[_0xf28f('0x15')](removeEntity(_0x3f0414,null))['catch'](handleError(_0x3f0414,null));};exports[_0xf28f('0x4a')]=function(_0x2a7359,_0x34cfba){return db[_0xf28f('0x32')][_0xf28f('0x4a')]()['then'](respondWithResult(_0x34cfba,null))[_0xf28f('0x20')](handleError(_0x34cfba,null));};exports['createVidaooSession']=function(_0x234e1f,_0x480c75){var _0xf2b71=_0x234e1f[_0xf28f('0x3b')]['id'];var _0x17bb31;var _0x821749;var _0x47d9d6;return db[_0xf28f('0x32')][_0xf28f('0x4b')]({'where':{'id':_0xf2b71}})[_0xf28f('0x15')](function(_0x11ff12){_0x17bb31=_0x11ff12;return db[_0xf28f('0x4c')][_0xf28f('0x4b')]({'where':{'id':_0x11ff12['ChatWebsiteId']},'attributes':['id','vidaooApiKey',_0xf28f('0x4d'),'vidaooTopic',_0xf28f('0x4e'),_0xf28f('0x4f')],'raw':!![]});})[_0xf28f('0x15')](function(_0xbf96de){if(_0xbf96de&&_0xbf96de[_0xf28f('0x50')]&&_0xbf96de['vidaooEscalation']){_0x821749=_0xbf96de;var _0x5aa773={'interaction':{'id':_0xf2b71},'agent':{'id':_0x234e1f['user']['id'],'name':_0x234e1f[_0xf28f('0x3a')][_0xf28f('0x2b')],'fullname':_0x234e1f[_0xf28f('0x3a')][_0xf28f('0x51')],'email':_0x234e1f[_0xf28f('0x3a')]['email']},'contact':_0x234e1f[_0xf28f('0x48')][_0xf28f('0x2d')],'account':_0x234e1f['body']['account']};var _0x5bc4dc={'rejectUnauthorized':![],'method':_0xf28f('0x52'),'url':_0xf28f('0x53'),'headers':{'X-APIKEY':_0xbf96de[_0xf28f('0x50')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x234e1f[_0xf28f('0x3a')][_0xf28f('0x54')]],'buttons':null,'topic':_0x821749[_0xf28f('0x55')],'note':_[_0xf28f('0x56')](_0x821749[_0xf28f('0x4e')])?null:getMustacheRender(_0x821749[_0xf28f('0x4e')],_0x5aa773),'metadata':null},'redirect':_0xf28f('0x57'),'json':!![]};try{if(!_[_0xf28f('0x56')](_0x821749['vidaooMetadata'])){var _0x19676f=getMustacheRender(_0x821749[_0xf28f('0x4f')],_0x5aa773);var _0x5bb257=JSON[_0xf28f('0x58')](_0x19676f);_0x5bc4dc['body'][_0xf28f('0x59')]=_0x5bb257;}}catch(_0xfcb353){throw new db[(_0xf28f('0x5a'))][(_0xf28f('0x5b'))](_0xf28f('0x5c'));}return rp(_0x5bc4dc);}else{throw new db[(_0xf28f('0x5a'))][(_0xf28f('0x5b'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xf28f('0x15')](function(_0xde2879){_0x47d9d6=_0xde2879;if(_0x47d9d6['id']){var _0x48fad6={'body':_0x47d9d6[_0xf28f('0x5d')],'ChatWebsiteId':_0x821749['id'],'ChatInteractionId':_0x17bb31['id'],'direction':_0xf28f('0x5e'),'UserId':_0x234e1f[_0xf28f('0x3a')]['id']};return db[_0xf28f('0x5f')][_0xf28f('0x47')](_0x48fad6,{});}else{throw new db[(_0xf28f('0x5a'))][(_0xf28f('0x5b'))](_0xf28f('0x60'));}})['then'](function(){return _0x17bb31[_0xf28f('0x61')]({'vidaooSessionId':_0x47d9d6['id']});})[_0xf28f('0x15')](respondWithResult(_0x480c75,null))[_0xf28f('0x20')](handleError(_0x480c75,null));};exports[_0xf28f('0x62')]=function(_0x3458f8,_0x2cb228){if(_0x3458f8[_0xf28f('0x48')]['id']){delete _0x3458f8[_0xf28f('0x48')]['id'];}return db[_0xf28f('0x32')][_0xf28f('0x46')]({'where':{'id':_0x3458f8[_0xf28f('0x3b')]['id']},'include':[{'model':db[_0xf28f('0x63')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x2cb228,null))[_0xf28f('0x15')](saveUpdates(_0x3458f8[_0xf28f('0x48')],null))[_0xf28f('0x15')](respondWithResult(_0x2cb228,null))[_0xf28f('0x20')](handleError(_0x2cb228,null));};exports[_0xf28f('0x64')]=function(_0x531ca4,_0x2af9e6){if(_0x531ca4[_0xf28f('0x48')]['id']){delete _0x531ca4[_0xf28f('0x48')]['id'];}return db[_0xf28f('0x32')][_0xf28f('0x46')]({'where':{'id':_0x531ca4[_0xf28f('0x3b')]['id']}})['then'](function(_0x14ed63){if(!_0x14ed63){logger[_0xf28f('0x1c')](_0xf28f('0x65'),_0xf28f('0x64'),0x194,_0xf28f('0x66'));_0x2af9e6[_0xf28f('0x67')](0x194);}else{if(_0x14ed63['UserId']){throw new db[(_0xf28f('0x5a'))][(_0xf28f('0x5b'))](_0xf28f('0x68'));}}return _0x14ed63;})[_0xf28f('0x15')](function(_0x31469d){if(_0x31469d){return _0x31469d['update']({'closed':_0x531ca4[_0xf28f('0x48')]['closed'],'disposition':_0x531ca4[_0xf28f('0x48')][_0xf28f('0x69')]})[_0xf28f('0x15')](function(_0x17e5b8){return _0x17e5b8;});}})[_0xf28f('0x15')](function(){return respondWithRpcPromise(_0xf28f('0x6a'),_0xf28f('0x64'),_0x531ca4[_0xf28f('0x48')],client9004);})[_0xf28f('0x15')](respondWithResult(_0x2af9e6,null))[_0xf28f('0x20')](handleError(_0x2af9e6,null));};exports['attachmentUpload']=function(_0x4409af,_0x33db99){_0x4409af[_0xf28f('0x48')][_0xf28f('0x2b')]=_0x4409af[_0xf28f('0x6b')]['originalname'];_0x4409af[_0xf28f('0x48')][_0xf28f('0x6c')]=_0x4409af[_0xf28f('0x6b')]['filename'];_0x4409af[_0xf28f('0x48')][_0xf28f('0x35')]=_0x4409af['file'][_0xf28f('0x6d')];return db[_0xf28f('0x6e')]['create'](_0x4409af[_0xf28f('0x48')])[_0xf28f('0x15')](respondWithResult(_0x33db99,0xc9))[_0xf28f('0x20')](handleError(_0x33db99,null));};exports['attachmentDownload']=function(_0xef041d,_0x5af1d3){return db[_0xf28f('0x32')][_0xf28f('0x4b')]({'where':{'id':_0xef041d[_0xf28f('0x3b')]['id']},'raw':!![]})[_0xf28f('0x15')](handleEntityNotFound(_0x5af1d3,null))['then'](function(_0x375f8f){if(_0x375f8f){if(_0x375f8f['closed']){return _0x5af1d3[_0xf28f('0x21')](0x193)[_0xf28f('0x23')]({'status':0x193,'message':_0xf28f('0x6f')});}return db[_0xf28f('0x6e')]['findOne']({'where':{'id':_0xef041d[_0xf28f('0x39')][_0xf28f('0x70')]},'raw':!![]})[_0xf28f('0x15')](handleEntityNotFound(_0x5af1d3,null));}})[_0xf28f('0x15')](function(_0x12c899){if(_0x12c899){var _0x23bd30=_0x12c899[_0xf28f('0x71')]!==null;var _0x355448=path[_0xf28f('0x72')](config[_0xf28f('0x73')],_0xf28f('0x74'));if(_0x23bd30){_0x355448=path['join'](_0x355448,'offline-chat/');}var _0x2299cf=path[_0xf28f('0x72')](_0x355448,_0x12c899[_0xf28f('0x6c')]);return _0x5af1d3[_0xf28f('0x75')](_0x2299cf);}})['catch'](handleError(_0x5af1d3,null));};exports[_0xf28f('0x76')]=function(_0x154ed7,_0x5652ce){var _0xd61065=null;var _0x598296=null;var _0x10b7e7=null;if(_0x154ed7['body']['id']){delete _0x154ed7[_0xf28f('0x48')]['id'];}if(_0x154ed7[_0xf28f('0x48')][_0xf28f('0x77')]){_0x10b7e7=path[_0xf28f('0x72')](config[_0xf28f('0x73')],_0xf28f('0x78'),util[_0xf28f('0x79')](_0xf28f('0x7a'),Date[_0xf28f('0x7b')]()));_0x154ed7[_0xf28f('0x48')][_0xf28f('0x7c')]=_0x10b7e7;}return db[_0xf28f('0x32')][_0xf28f('0x46')]({'where':{'id':_0x154ed7['params']['id']},'include':[{'model':db[_0xf28f('0x5f')],'as':_0xf28f('0x7d'),'include':[{'model':db[_0xf28f('0x7e')],'as':_0xf28f('0x7e')}]}]})[_0xf28f('0x15')](handleEntityNotFound(_0x5652ce,null))[_0xf28f('0x15')](saveUpdates(_0x154ed7['body'],null))[_0xf28f('0x15')](function(_0x331ef4){if(_0x331ef4){_0xd61065=_0x331ef4;return db['ChatWebsite'][_0xf28f('0x46')]({'where':{'id':_0xd61065[_0xf28f('0x7f')]}});}})[_0xf28f('0x15')](function(_0x3505f9){if(_0x3505f9){_0x598296=_0x3505f9;return db['CmContact'][_0xf28f('0x46')]({'where':{'id':_0xd61065['ContactId']}});}})[_0xf28f('0x15')](function(_0x34ca2a){if(_0x34ca2a){if(_0x10b7e7){var _0x5878f5=null;for(var _0x35a921=0x1;_0x35a921<_0xd61065[_0xf28f('0x7d')][_0xf28f('0x42')];++_0x35a921){_0x5878f5=_0xd61065[_0xf28f('0x7d')][_0x35a921];var _0xb0e64c=_0x5878f5[_0xf28f('0x80')]?util['format'](_0xf28f('0x81'),_0x598296['agentAlias'],_0x5878f5[_0xf28f('0x80')]):_0xf28f('0x82');var _0x2670f1=_0x154ed7[_0xf28f('0x48')][_0xf28f('0x83')]||util[_0xf28f('0x79')](_0xf28f('0x81'),_0xf28f('0x84'),_0x5878f5['ContactId']);switch(_0x598296[_0xf28f('0x85')]){case _0xf28f('0x86'):_0xb0e64c=_0x5878f5['UserId']?util[_0xf28f('0x79')](_0xf28f('0x81'),_0x598296['agentAlias'],_0x5878f5[_0xf28f('0x80')]):_0xf28f('0x82');break;case _0xf28f('0x87'):_0xb0e64c=_0x5878f5['UserId']?_0x5878f5[_0xf28f('0x7e')][_0xf28f('0x88')]||_0x5878f5[_0xf28f('0x7e')][_0xf28f('0x51')]:_0xf28f('0x82');break;case _0xf28f('0x89'):_0xb0e64c=_0x5878f5[_0xf28f('0x80')]?_0x5878f5[_0xf28f('0x7e')][_0xf28f('0x51')]:'System';break;default:_0xb0e64c=_0x5878f5[_0xf28f('0x80')]?util['format']('%s%d',_0x598296[_0xf28f('0x8a')],_0x5878f5[_0xf28f('0x80')]):_0xf28f('0x82');}var _0x3417f9=util[_0xf28f('0x79')]('[%s]\x20%s:\x20%s\x0a',moment(_0x5878f5['createdAt'])['format'](_0xf28f('0x8b')),_0x5878f5['direction']==='in'?_0x2670f1:_0xb0e64c,_0x5878f5['body']);if(!_0x5878f5[_0xf28f('0x8c')]){fs[_0xf28f('0x8d')](_0x10b7e7,_0x3417f9);}}return db[_0xf28f('0x8e')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xf28f('0x8f'),'raw':!![],'include':[{'model':db[_0xf28f('0x90')],'as':_0xf28f('0x90'),'raw':!![]}]}]});}}})['then'](function(_0x2f6cef){if(!_0x2f6cef||!_0x2f6cef[_0xf28f('0x8f')]||!_0x154ed7[_0xf28f('0x48')])return _0xd61065;var _0x28fa5a=_0x2f6cef[_0xf28f('0x91')]();return respondWithRpcPromise('SendMail',_0xf28f('0x92'),{'account':_0x28fa5a,'message':{'from':util[_0xf28f('0x79')](_0xf28f('0x93'),_0x2f6cef['name'],_0x2f6cef[_0xf28f('0x54')]||_0x2f6cef['Smtp'][_0xf28f('0x3a')]),'to':_0x154ed7[_0xf28f('0x48')]['mailTranscript'],'subject':_0xf28f('0x94'),'text':util[_0xf28f('0x79')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x154ed7[_0xf28f('0x48')]['mailTranscript']),'attachments':[{'path':_0x10b7e7}]}})[_0xf28f('0x15')](function(){return _0xd61065;})['catch'](function(_0x271c68){logger[_0xf28f('0x1c')](_0x271c68);});})[_0xf28f('0x15')](respondWithStatusCode(_0x5652ce,0xc8))[_0xf28f('0x20')](handleError(_0x5652ce,null));};exports[_0xf28f('0x95')]=function(_0x354d26,_0x501f33){return db[_0xf28f('0x5f')][_0xf28f('0x46')]({'where':{'id':_0x354d26[_0xf28f('0x3b')]['id']}})[_0xf28f('0x15')](handleEntityNotFound(_0x501f33,null))[_0xf28f('0x15')](function(_0x2c7a21){if(_0x2c7a21){return _0x2c7a21[_0xf28f('0x95')](_0x354d26[_0xf28f('0x48')][_0xf28f('0x96')],_[_0xf28f('0x97')](_0x354d26[_0xf28f('0x48')],['ids','id'])||{});}})[_0xf28f('0x15')](respondWithResult(_0x501f33,null))[_0xf28f('0x20')](handleError(_0x501f33,null));};exports[_0xf28f('0x98')]=function(_0x74d590,_0x411dbe){var _0x3e86b3={'raw':![],'where':{}};var _0x3dc049={};var _0x3ecc96={'count':0x0,'rows':[]};return db[_0xf28f('0x32')][_0xf28f('0x4b')]({'where':{'id':_0x74d590['params']['id']}})[_0xf28f('0x15')](handleEntityNotFound(_0x411dbe,null))[_0xf28f('0x15')](function(_0x3ecf34){if(_0x3ecf34){_0x3dc049[_0xf28f('0x3c')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x3dc049[_0xf28f('0x39')]=_[_0xf28f('0x3d')](_0x74d590[_0xf28f('0x39')]);_0x3dc049[_0xf28f('0x3e')]=_[_0xf28f('0x40')](_0x3dc049[_0xf28f('0x3c')],_0x3dc049[_0xf28f('0x39')]);_0x3e86b3[_0xf28f('0x3f')]=_[_0xf28f('0x40')](_0x3dc049[_0xf28f('0x3c')],qs[_0xf28f('0x41')](_0x74d590[_0xf28f('0x39')][_0xf28f('0x41')]));_0x3e86b3[_0xf28f('0x3f')]=_0x3e86b3[_0xf28f('0x3f')][_0xf28f('0x42')]?_0x3e86b3['attributes']:_0x3dc049[_0xf28f('0x3c')];if(!_0x74d590[_0xf28f('0x39')][_0xf28f('0x99')](_0xf28f('0x9a'))){_0x3e86b3['limit']=qs[_0xf28f('0x25')](_0x74d590[_0xf28f('0x39')][_0xf28f('0x25')]);_0x3e86b3[_0xf28f('0x27')]=qs[_0xf28f('0x27')](_0x74d590[_0xf28f('0x39')][_0xf28f('0x27')]);}_0x3e86b3[_0xf28f('0x9b')]=qs[_0xf28f('0x9c')](_0x74d590[_0xf28f('0x39')][_0xf28f('0x9c')]);_0x3e86b3[_0xf28f('0x9d')]=qs['filters'](_[_0xf28f('0x9e')](_0x74d590[_0xf28f('0x39')],_0x3dc049['filters']));_0x3e86b3['where'][_0xf28f('0x9f')]=_0x3ecf34['id'];if(_0x74d590[_0xf28f('0x39')][_0xf28f('0xa0')]){_0x3e86b3[_0xf28f('0x9d')]=_[_0xf28f('0x44')](_0x3e86b3['where'],{'$or':_[_0xf28f('0x31')](_0x3e86b3[_0xf28f('0x3f')],function(_0x1bbc3e){var _0x12406d={};_0x12406d[_0x1bbc3e]={'$like':'%'+_0x74d590['query']['filter']+'%'};return _0x12406d;})});}if(_0x74d590[_0xf28f('0x39')][_0xf28f('0xa1')]){var _0xf91c98=_0x74d590[_0xf28f('0x39')][_0xf28f('0xa1')]['split'](',');var _0x2e900b={};_0x2e900b[_0xf91c98[0x0]]={'$gte':moment(_0xf91c98[0x1])['format'](_0xf28f('0xa2'))};_0x3e86b3[_0xf28f('0x9d')]=_[_0xf28f('0x44')](_0x3e86b3[_0xf28f('0x9d')],_0x2e900b);}_0x3e86b3=_['merge']({},_0x3e86b3,_0x74d590[_0xf28f('0x45')]);return db[_0xf28f('0x5f')][_0xf28f('0x26')]({'where':_0x3e86b3[_0xf28f('0x9d')]})[_0xf28f('0x15')](function(_0x4089e4){_0x3ecc96['count']=_0x4089e4;if(_0x74d590['query'][_0xf28f('0x43')]){_0x3e86b3[_0xf28f('0xa3')]=[{'all':!![]}];}return db['ChatMessage'][_0xf28f('0x37')](_0x3e86b3);})[_0xf28f('0x15')](function(_0x4b167a){_0x3ecc96[_0xf28f('0xa4')]=_0x4b167a;return _0x3ecc96;});}})[_0xf28f('0x15')](respondWithFilteredResult(_0x411dbe,_0x3e86b3))['catch'](handleError(_0x411dbe,null));};exports[_0xf28f('0xa5')]=function(_0x30a398,_0x1d6fc4){var _0x1d9ab2={'where':{}},_0x304bcc={},_0x1be847={'count':0x0,'rows':[]};return db[_0xf28f('0x32')]['findOne']({'where':{'id':_0x30a398[_0xf28f('0x3b')]['id']}})[_0xf28f('0x15')](handleEntityNotFound(_0x1d6fc4,null))['then'](function(_0x607639){if(_0x607639){_0x304bcc['model']=_[_0xf28f('0x3d')](db['ChatMessage'][_0xf28f('0x33')]);_0x304bcc['query']=_[_0xf28f('0x3d')](_0x30a398['query']);_0x304bcc['filters']=_[_0xf28f('0x40')](_0x304bcc[_0xf28f('0x3c')],_0x304bcc[_0xf28f('0x39')]);_0x1d9ab2[_0xf28f('0x3f')]=_['intersection'](_0x304bcc['model'],qs[_0xf28f('0x41')](_0x30a398[_0xf28f('0x39')]['fields']));_0x1d9ab2[_0xf28f('0x3f')]=_0x1d9ab2[_0xf28f('0x3f')]['length']?_0x1d9ab2[_0xf28f('0x3f')]:_0x304bcc[_0xf28f('0x3c')];if(!_0x30a398[_0xf28f('0x39')]['hasOwnProperty'](_0xf28f('0x9a'))){_0x1d9ab2[_0xf28f('0x25')]=qs[_0xf28f('0x25')](_0x30a398[_0xf28f('0x39')][_0xf28f('0x25')]);_0x1d9ab2[_0xf28f('0x27')]=qs[_0xf28f('0x27')](_0x30a398['query'][_0xf28f('0x27')]);}_0x1d9ab2[_0xf28f('0x9b')]=qs['sort'](_0x30a398[_0xf28f('0x39')]['sort']);_0x1d9ab2[_0xf28f('0x9d')]=qs[_0xf28f('0x3e')](_['pick'](_0x30a398[_0xf28f('0x39')],_0x304bcc[_0xf28f('0x3e')]));_0x1d9ab2[_0xf28f('0x9d')]['ChatInteractionId']=_0x607639['id'];if(_0x30a398[_0xf28f('0x39')][_0xf28f('0xa0')]){_0x1d9ab2[_0xf28f('0x9d')]=_[_0xf28f('0x44')](_0x1d9ab2[_0xf28f('0x9d')],{'$or':_['map'](_0x1d9ab2['attributes'],function(_0x34303e){var _0x2a97d4={};_0x2a97d4[_0x34303e]={'$like':'%'+_0x30a398['query']['filter']+'%'};return _0x2a97d4;})});}_0x1d9ab2[_0xf28f('0x9d')]['secret']=![];if(_0x30a398[_0xf28f('0x39')]['id']){_0x1d9ab2['where']['id']={'$gt':_0x30a398['query']['id']};}_0x1d9ab2=_['merge']({},_0x1d9ab2,_0x30a398[_0xf28f('0x45')]);return db[_0xf28f('0x5f')][_0xf28f('0x26')]({'where':_0x1d9ab2[_0xf28f('0x9d')]})[_0xf28f('0x15')](function(_0x395a85){_0x1be847[_0xf28f('0x26')]=_0x395a85;_0x1d9ab2[_0xf28f('0xa3')]=[];if(_0x30a398[_0xf28f('0x39')][_0xf28f('0xa6')]){_0x1d9ab2['include'][_0xf28f('0xa7')]({'model':db[_0xf28f('0x7e')],'as':_0xf28f('0x7e'),'attributes':['id',_0xf28f('0x51'),'alias']});}if(_0x30a398['query'][_0xf28f('0x43')]){_0x1d9ab2[_0xf28f('0xa3')]=[{'all':!![]}];}return db[_0xf28f('0x5f')][_0xf28f('0x37')](_0x1d9ab2);})[_0xf28f('0x15')](function(_0x37fa72){_0x1be847[_0xf28f('0xa4')]=_0x37fa72;return _0x1be847;});}})[_0xf28f('0x15')](respondWithFilteredResult(_0x1d6fc4,_0x1d9ab2))[_0xf28f('0x20')](handleError(_0x1d6fc4,null));};exports['addTags']=function(_0x2b5caa,_0xdf17eb){return db[_0xf28f('0x32')][_0xf28f('0x46')]({'where':{'id':_0x2b5caa[_0xf28f('0x3b')]['id']}})['then'](handleEntityNotFound(_0xdf17eb,null))[_0xf28f('0x15')](function(_0x13c8d1){if(_0x13c8d1){return _0x13c8d1[_0xf28f('0xa8')](_0x2b5caa[_0xf28f('0x48')][_0xf28f('0x96')],_[_0xf28f('0x97')](_0x2b5caa[_0xf28f('0x48')],[_0xf28f('0x96'),'id'])||{})[_0xf28f('0xa9')](function(){return db[_0xf28f('0xaa')]['findAll']({'attributes':['id','name',_0xf28f('0xab')],'where':{'id':_0x2b5caa[_0xf28f('0x48')][_0xf28f('0x96')]}});})[_0xf28f('0x15')](function(_0x49c5d9){socket[_0xf28f('0xac')](_0xf28f('0xad'),{'id':Number(_0x2b5caa['params']['id']),'tags':_0x49c5d9||[]});return{'id':Number(_0x2b5caa[_0xf28f('0x3b')]['id']),'tags':_0x49c5d9||[]};});}})['then'](respondWithResult(_0xdf17eb,null))[_0xf28f('0x20')](handleError(_0xdf17eb,null));};exports[_0xf28f('0xae')]=function(_0x16d409,_0x148b94){return db[_0xf28f('0x32')]['find']({'where':{'id':_0x16d409['params']['id']}})[_0xf28f('0x15')](handleEntityNotFound(_0x148b94,null))['then'](function(_0x287140){if(_0x287140){return _0x287140[_0xf28f('0xae')](_0x16d409[_0xf28f('0x39')]['ids']);}})[_0xf28f('0x15')](respondWithStatusCode(_0x148b94,null))[_0xf28f('0x20')](handleError(_0x148b94,null));};exports['download']=function(_0x34460c,_0x161b27){var _0x108c37=moment()['unix']()['toString']();var _0x807849=path[_0xf28f('0x72')](config[_0xf28f('0x73')],_0xf28f('0xaf'),_0xf28f('0xb0'),_0xf28f('0xb1'));var _0x3ef54e=path[_0xf28f('0x72')](config[_0xf28f('0x73')],_0xf28f('0xaf'),_0xf28f('0xb0'),_0xf28f('0xb2'));var _0x4a846a=path['join'](_0x807849,_0x108c37);var _0x2eafa1=util[_0xf28f('0x79')](_0xf28f('0xb3'),_0x34460c[_0xf28f('0x3b')]['id'],_0x108c37);var _0x296b75=path[_0xf28f('0x72')](_0x807849,_0x2eafa1);var _0x3b3cf7=[];_0x3b3cf7[_0xf28f('0xa7')]({'model':db[_0xf28f('0x7e')],'as':_0xf28f('0x7e'),'attributes':['id',_0xf28f('0x51')],'raw':!![]});_0x3b3cf7[_0xf28f('0xa7')]({'model':db[_0xf28f('0x63')],'as':_0xf28f('0xb4'),'attributes':['id',_0xf28f('0xb5'),'lastName'],'raw':!![]});if(_0x34460c[_0xf28f('0x39')][_0xf28f('0xb2')]){_0x3b3cf7[_0xf28f('0xa7')]({'model':db[_0xf28f('0x6e')],'as':_0xf28f('0x6e'),'raw':!![]});}var _0x22f4df=[{'model':db['ChatMessage'],'as':_0xf28f('0x7d'),'attributes':['id',_0xf28f('0x48'),_0xf28f('0xb6'),_0xf28f('0xb7'),_0xf28f('0x8c'),'read'],'include':_0x3b3cf7}];_0x22f4df['push']({'model':db[_0xf28f('0x4c')],'as':_0xf28f('0xb8'),'attributes':['id',_0xf28f('0x2b')]});_0x22f4df[_0xf28f('0xa7')]({'model':db[_0xf28f('0x7e')],'as':'Owner','attributes':['id',_0xf28f('0x51')]});return db[_0xf28f('0x32')][_0xf28f('0x46')]({'where':{'id':_0x34460c[_0xf28f('0x3b')]['id']},'include':_0x22f4df})[_0xf28f('0x15')](handleEntityNotFound(_0x161b27,null))['then'](function(_0x1b44a0){if(_0x1b44a0){var _0x7c1855=_0x1b44a0['get']({'plain':!![]});fs['mkdirSync'](_0x4a846a);var _0x55733d={'channel':'Chat','account':_0x7c1855[_0xf28f('0xb8')][_0xf28f('0x2b')],'agent':_0x7c1855[_0xf28f('0xb9')]?_0x7c1855['Owner'][_0xf28f('0x51')]:_0xf28f('0xba'),'createdAt':moment(_0x7c1855[_0xf28f('0xb6')])[_0xf28f('0x79')](_0xf28f('0xa2'))[_0xf28f('0xbb')](),'closedAt':_0x7c1855[_0xf28f('0xbc')]?moment(_0x7c1855[_0xf28f('0xbd')])[_0xf28f('0x79')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x7c1855['disposition'],'chatInfo':{'browser':_0x7c1855[_0xf28f('0xbe')],'os':_0x7c1855[_0xf28f('0xbf')],'referer':_0x7c1855['referer'],'customerIp':_0x7c1855[_0xf28f('0xc0')],'customerPort':_0x7c1855['customerPort']?_0x7c1855[_0xf28f('0xc1')]:'N.A.'},'messages':_(_0x7c1855['Messages'])[_0xf28f('0xc2')]()[_0xf28f('0xa0')]({'secret':![]})[_0xf28f('0x31')](function(_0x1a569e){if(_0x1a569e[_0xf28f('0x6e')]){var _0x583b57=path['join'](_0x3ef54e,_0x1a569e['Attachment'][_0xf28f('0x6c')]);if(fs[_0xf28f('0xc3')](_0x583b57)){fs['createReadStream'](_0x583b57)[_0xf28f('0xc4')](fs[_0xf28f('0xc5')](path[_0xf28f('0x72')](_0x4a846a,_0x1a569e[_0xf28f('0x6e')][_0xf28f('0x6c')])));}}return{'date':moment(_0x1a569e[_0xf28f('0xb6')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xf28f('0xbb')](),'sender':_0x1a569e[_0xf28f('0xb7')]===_0xf28f('0x5e')?_0x1a569e[_0xf28f('0x7e')]?_0x1a569e['User']['fullname']:'System':_0x1a569e[_0xf28f('0xb4')]['firstName']+(_0x1a569e['Contact'][_0xf28f('0xc6')]?'\x20'+_0x1a569e['Contact'][_0xf28f('0xc6')]:''),'body':_0x1a569e[_0xf28f('0x6e')]?_0x1a569e[_0xf28f('0x6e')][_0xf28f('0x6c')]:_0x1a569e['body'],'direction':_0x1a569e['direction']===_0xf28f('0x5e')?'A':'C','secret':_0x1a569e[_0xf28f('0x8c')],'read':_0x1a569e[_0xf28f('0xc7')],'attachment':_0x1a569e[_0xf28f('0x6e')]};})[_0xf28f('0xc8')]()};return ejs[_0xf28f('0xc9')](path[_0xf28f('0x72')](config[_0xf28f('0x73')],_0xf28f('0xaf'),_0xf28f('0xca'),_0xf28f('0xcb')),{'interaction':_0x55733d})['then'](function(_0x5db0be){var _0x5e726c=path[_0xf28f('0x72')](_0x4a846a,'transcript-'+_0x7c1855['id']+'-'+_0x108c37+_0xf28f('0xcc'));var _0x2a9986={'path':_0x5e726c,'channel':_0xf28f('0xcd'),'interactionId':_0x7c1855['id']};return pdf['createPdfFromHTML'](_0x5db0be,_0x2a9986);})[_0xf28f('0x15')](function(){return new Promise(function(_0x17d2e5,_0x1e0069){zipdir(_0x4a846a,{'saveTo':_0x296b75},function(_0x47a6dc,_0x149d3e){if(_0x47a6dc)return _0x1e0069(_0x47a6dc);return _0x17d2e5(_0x149d3e);});})['then'](function(){return new BPromise(function(_0x3abe7a,_0x59dcf5){rimraf(_0x4a846a,function(_0x137df3){if(_0x137df3)_0x59dcf5(_0x137df3);return _0x3abe7a();});});})[_0xf28f('0x15')](function(){return _0x161b27[_0xf28f('0x75')](_0x296b75,_0x2eafa1,function(_0x591dbe){if(_0x591dbe){logger[_0xf28f('0x1c')](_0xf28f('0xce'),_0x591dbe);}else{fs['unlinkSync'](_0x296b75);}});});});}else{return _0x161b27[_0xf28f('0x67')](0xc8);}})[_0xf28f('0x20')](handleError(_0x161b27,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 6efd787..1553fe8 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 _0x3e31=['ChatInteraction','ChatMessage','save','update','remove','getUsers','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb'];(function(_0x46306f,_0x5aef14){var _0x16a27f=function(_0x5526fd){while(--_0x5526fd){_0x46306f['push'](_0x46306f['shift']());}};_0x16a27f(++_0x5aef14);}(_0x3e31,0x6a));var _0x13e3=function(_0x574057,_0x21584c){_0x574057=_0x574057-0x0;var _0x2abba5=_0x3e31[_0x574057];return _0x2abba5;};'use strict';var EventEmitter=require(_0x13e3('0x0'));var ChatInteraction=require(_0x13e3('0x1'))['db'][_0x13e3('0x2')];var ChatMessage=require(_0x13e3('0x1'))['db'][_0x13e3('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x13e3('0x4'),'afterUpdate':_0x13e3('0x5'),'afterDestroy':_0x13e3('0x6')};function emitEvent(_0xf2c912){return function(_0x48b9a6,_0x1c7407,_0x4df08e){_0x48b9a6[_0x13e3('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x19d498){_0x48b9a6['setDataValue'](_0x13e3('0x8'),_0x19d498[_0x13e3('0x9')](function(_0x429b4f){return{'id':_0x429b4f['id']};}));return ChatMessage[_0x13e3('0xa')]({'where':{'ChatInteractionId':_0x48b9a6['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2f11db){_0x48b9a6[_0x13e3('0xb')](_0x13e3('0xc'),_0x2f11db[_0x13e3('0xd')]);ChatInteractionEvents[_0x13e3('0xe')](_0xf2c912+':'+_0x48b9a6['id'],_0x48b9a6);ChatInteractionEvents[_0x13e3('0xe')](_0xf2c912,_0x48b9a6);_0x4df08e(null);})[_0x13e3('0xf')](_0x4df08e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x13e3('0x10')](e,emitEvent(event));}}module[_0x13e3('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0xc932=['Users','map','unreadMessages','length','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','then','setDataValue'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xc932,0x18b));var _0x2c93=function(_0x1ed010,_0x734e0b){_0x1ed010=_0x1ed010-0x0;var _0x6e22bf=_0xc932[_0x1ed010];return _0x6e22bf;};'use strict';var EventEmitter=require(_0x2c93('0x0'));var ChatInteraction=require(_0x2c93('0x1'))['db'][_0x2c93('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x2c93('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x2c93('0x4')](0x0);var events={'afterCreate':_0x2c93('0x5'),'afterUpdate':_0x2c93('0x6'),'afterDestroy':_0x2c93('0x7')};function emitEvent(_0x4a2f7d){return function(_0x545242,_0x188290,_0x591935){_0x545242['getUsers']({'attributes':['id'],'raw':!![]})[_0x2c93('0x8')](function(_0x32af51){_0x545242[_0x2c93('0x9')](_0x2c93('0xa'),_0x32af51[_0x2c93('0xb')](function(_0x2f1a60){return{'id':_0x2f1a60['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x545242['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2c93('0x8')](function(_0x362059){_0x545242[_0x2c93('0x9')](_0x2c93('0xc'),_0x362059[_0x2c93('0xd')]);ChatInteractionEvents['emit'](_0x4a2f7d+':'+_0x545242['id'],_0x545242);ChatInteractionEvents['emit'](_0x4a2f7d,_0x545242);_0x591935(null);})['catch'](_0x591935(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x2c93('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 716daf4..73e529e 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 _0xc7b2=['ChatInteraction','chat_interactions','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatInteraction.attributes','define'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xc7b2,0x1c5));var _0x2c7b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7b2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2c7b('0x0'));var util=require(_0x2c7b('0x1'));var logger=require(_0x2c7b('0x2'))(_0x2c7b('0x3'));var moment=require(_0x2c7b('0x4'));var BPromise=require(_0x2c7b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c7b('0x6'));var rimraf=require(_0x2c7b('0x7'));var config=require(_0x2c7b('0x8'));var attributes=require(_0x2c7b('0x9'));module['exports']=function(_0x5cc414,_0x46aad1){return _0x5cc414[_0x2c7b('0xa')](_0x2c7b('0xb'),attributes,{'tableName':_0x2c7b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1d83e8,_0x1acaa1,_0x7792b0){if(_0x1d83e8['changed']('closed')){_0x1d83e8['closedAt']=moment()[_0x2c7b('0xd')](_0x2c7b('0xe'));}_0x7792b0(null,_0x1d83e8);}},'charset':'utf8mb4','collate':_0x2c7b('0xf')});}; \ No newline at end of file +var _0x2f7c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','ChatInteraction','chat_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x2843ea,_0x30621e){var _0x11e537=function(_0x5eac5a){while(--_0x5eac5a){_0x2843ea['push'](_0x2843ea['shift']());}};_0x11e537(++_0x30621e);}(_0x2f7c,0x1c9));var _0xc2f7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2f7c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc2f7('0x0'));var util=require(_0xc2f7('0x1'));var logger=require('../../config/logger')(_0xc2f7('0x2'));var moment=require(_0xc2f7('0x3'));var BPromise=require(_0xc2f7('0x4'));var rp=require(_0xc2f7('0x5'));var fs=require('fs');var path=require(_0xc2f7('0x6'));var rimraf=require(_0xc2f7('0x7'));var config=require(_0xc2f7('0x8'));var attributes=require(_0xc2f7('0x9'));module['exports']=function(_0x320765,_0x4b8166){return _0x320765['define'](_0xc2f7('0xa'),attributes,{'tableName':_0xc2f7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2db062,_0x82015c,_0x207740){if(_0x2db062[_0xc2f7('0xc')]('closed')){_0x2db062['closedAt']=moment()[_0xc2f7('0xd')](_0xc2f7('0xe'));}_0x207740(null,_0x2db062);}},'charset':_0xc2f7('0xf'),'collate':_0xc2f7('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 4a7cb3b..da54c9f 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 _0x1978=['http','defaults','redis','localhost','socket.io-emitter','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','limit','AddTagsToChatInteraction','find','addTags','body','omit','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x51b661,_0x566ef8){var _0x5d1971=function(_0x5cc6b8){while(--_0x5cc6b8){_0x51b661['push'](_0x51b661['shift']());}};_0x5d1971(++_0x566ef8);}(_0x1978,0x1a3));var _0x8197=function(_0x303357,_0x221d68){_0x303357=_0x303357-0x0;var _0x343b09=_0x1978[_0x303357];return _0x343b09;};'use strict';var _=require('lodash');var util=require(_0x8197('0x0'));var moment=require(_0x8197('0x1'));var BPromise=require(_0x8197('0x2'));var rs=require(_0x8197('0x3'));var fs=require('fs');var Redis=require(_0x8197('0x4'));var db=require(_0x8197('0x5'))['db'];var utils=require(_0x8197('0x6'));var logger=require(_0x8197('0x7'))(_0x8197('0x8'));var config=require(_0x8197('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8197('0xa')][_0x8197('0xb')]({'port':0x232a});config['redis']=_[_0x8197('0xc')](config[_0x8197('0xd')],{'host':_0x8197('0xe'),'port':0x18eb});var socket=require(_0x8197('0xf'))(new Redis(config[_0x8197('0xd')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x25c02b,_0xb78e41,_0x33c7bf){return new BPromise(function(_0x5c126e,_0x13fbc3){return client[_0x8197('0x10')](_0x25c02b,_0x33c7bf)[_0x8197('0x11')](function(_0x150cf7){logger[_0x8197('0x12')](_0x8197('0x13'),_0xb78e41,'request\x20sent');logger[_0x8197('0x14')](_0x8197('0x15'),_0xb78e41,_0x8197('0x16'),JSON[_0x8197('0x17')](_0x150cf7));if(_0x150cf7[_0x8197('0x18')]){if(_0x150cf7[_0x8197('0x18')][_0x8197('0x19')]===0x1f4){logger[_0x8197('0x18')](_0x8197('0x13'),_0xb78e41,_0x150cf7[_0x8197('0x18')][_0x8197('0x1a')]);return _0x13fbc3(_0x150cf7['error'][_0x8197('0x1a')]);}logger[_0x8197('0x18')](_0x8197('0x13'),_0xb78e41,_0x150cf7[_0x8197('0x18')]['message']);return _0x5c126e(_0x150cf7[_0x8197('0x18')][_0x8197('0x1a')]);}else{logger['info'](_0x8197('0x13'),_0xb78e41,_0x8197('0x16'));_0x5c126e(_0x150cf7['result'][_0x8197('0x1a')]);}})[_0x8197('0x1b')](function(_0x5b6269){logger['error'](_0x8197('0x13'),_0xb78e41,_0x5b6269);_0x13fbc3(_0x5b6269);});});}exports[_0x8197('0x1c')]=function(_0x30afc1){var _0x228b4a=this;return new Promise(function(_0x42279a,_0x56097f){return db[_0x8197('0x1d')][_0x8197('0x1e')](_0x30afc1['body'],{'raw':_0x30afc1[_0x8197('0x1f')]?_0x30afc1[_0x8197('0x1f')][_0x8197('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30afc1[_0x8197('0x1f')]?_0x30afc1[_0x8197('0x1f')][_0x8197('0x21')]||null:null,'attributes':_0x30afc1['options']?_0x30afc1[_0x8197('0x1f')]['attributes']||null:null,'limit':_0x30afc1[_0x8197('0x1f')]?_0x30afc1['options'][_0x8197('0x22')]||null:null})['then'](function(_0x2def43){logger[_0x8197('0x12')](_0x8197('0x1c'),_0x30afc1);logger[_0x8197('0x14')](_0x8197('0x1c'),_0x30afc1,JSON[_0x8197('0x17')](_0x2def43));_0x42279a(_0x2def43);})['catch'](function(_0x5aaa33){logger['error'](_0x8197('0x1c'),_0x5aaa33['message'],_0x30afc1);_0x56097f(_0x228b4a[_0x8197('0x18')](0x1f4,_0x5aaa33[_0x8197('0x1a')]));});});};exports[_0x8197('0x23')]=function(_0x162ca4){return new Promise(function(_0x4e50c5,_0x2e3254){return db['ChatInteraction'][_0x8197('0x24')]({'where':_0x162ca4['options']?_0x162ca4['options'][_0x8197('0x21')]||null:null})['then'](function(_0x16a41f){if(_0x16a41f){return _0x16a41f[_0x8197('0x25')](_0x162ca4[_0x8197('0x26')]['ids'],_[_0x8197('0x27')](_0x162ca4[_0x8197('0x26')],[_0x8197('0x28'),'id'])||{});}})[_0x8197('0x29')](function(_0x52fd75){logger[_0x8197('0x12')](_0x8197('0x2a'),_0x162ca4);logger[_0x8197('0x14')]('AddTags',_0x162ca4,JSON['stringify'](_0x52fd75));_0x4e50c5(_0x52fd75);})['catch'](function(_0x5332f9){logger[_0x8197('0x18')]('AddTags',_0x5332f9[_0x8197('0x1a')],_0x162ca4);_0x2e3254(_this[_0x8197('0x18')](0x1f4,_0x5332f9[_0x8197('0x1a')]));});});}; \ No newline at end of file +var _0x0af4=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','options','where','limit','then','AddTagsToChatInteraction','find','addTags','ids','omit','body','spread','AddTags','lodash','util','moment','bluebird'];(function(_0x2c9b2a,_0x5d5c58){var _0x47039c=function(_0x2f747d){while(--_0x2f747d){_0x2c9b2a['push'](_0x2c9b2a['shift']());}};_0x47039c(++_0x5d5c58);}(_0x0af4,0xd8));var _0x40af=function(_0x4b7ca2,_0x486d18){_0x4b7ca2=_0x4b7ca2-0x0;var _0x1a10ca=_0x0af4[_0x4b7ca2];return _0x1a10ca;};'use strict';var _=require(_0x40af('0x0'));var util=require(_0x40af('0x1'));var moment=require(_0x40af('0x2'));var BPromise=require(_0x40af('0x3'));var rs=require(_0x40af('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x40af('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x40af('0x6'))(_0x40af('0x7'));var config=require(_0x40af('0x8'));var jayson=require(_0x40af('0x9'));var client=jayson[_0x40af('0xa')][_0x40af('0xb')]({'port':0x232a});config[_0x40af('0xc')]=_[_0x40af('0xd')](config[_0x40af('0xc')],{'host':_0x40af('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x40af('0xf'))[_0x40af('0x10')](socket);function respondWithRpcPromise(_0x1fee39,_0x3ed74c,_0x17ca03){return new BPromise(function(_0x2169a0,_0x76518d){return client[_0x40af('0x11')](_0x1fee39,_0x17ca03)['then'](function(_0xd1da56){logger[_0x40af('0x12')](_0x40af('0x13'),_0x3ed74c,'request\x20sent');logger[_0x40af('0x14')](_0x40af('0x15'),_0x3ed74c,_0x40af('0x16'),JSON[_0x40af('0x17')](_0xd1da56));if(_0xd1da56['error']){if(_0xd1da56[_0x40af('0x18')][_0x40af('0x19')]===0x1f4){logger['error'](_0x40af('0x13'),_0x3ed74c,_0xd1da56['error'][_0x40af('0x1a')]);return _0x76518d(_0xd1da56[_0x40af('0x18')]['message']);}logger[_0x40af('0x18')](_0x40af('0x13'),_0x3ed74c,_0xd1da56[_0x40af('0x18')][_0x40af('0x1a')]);return _0x2169a0(_0xd1da56[_0x40af('0x18')][_0x40af('0x1a')]);}else{logger[_0x40af('0x12')](_0x40af('0x13'),_0x3ed74c,'request\x20sent');_0x2169a0(_0xd1da56[_0x40af('0x1b')][_0x40af('0x1a')]);}})[_0x40af('0x1c')](function(_0x2f59ca){logger[_0x40af('0x18')](_0x40af('0x13'),_0x3ed74c,_0x2f59ca);_0x76518d(_0x2f59ca);});});}exports[_0x40af('0x1d')]=function(_0x528f76){var _0x2c55db=this;return new Promise(function(_0x31093c,_0x32782e){return db[_0x40af('0x1e')][_0x40af('0x1f')](_0x528f76['body'],{'raw':_0x528f76[_0x40af('0x20')]?_0x528f76[_0x40af('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x528f76[_0x40af('0x20')]?_0x528f76[_0x40af('0x20')][_0x40af('0x21')]||null:null,'attributes':_0x528f76[_0x40af('0x20')]?_0x528f76[_0x40af('0x20')]['attributes']||null:null,'limit':_0x528f76[_0x40af('0x20')]?_0x528f76[_0x40af('0x20')][_0x40af('0x22')]||null:null})[_0x40af('0x23')](function(_0x5dce56){logger[_0x40af('0x12')](_0x40af('0x1d'),_0x528f76);logger[_0x40af('0x14')]('UpdateChatInteraction',_0x528f76,JSON[_0x40af('0x17')](_0x5dce56));_0x31093c(_0x5dce56);})[_0x40af('0x1c')](function(_0x4489bf){logger[_0x40af('0x18')](_0x40af('0x1d'),_0x4489bf['message'],_0x528f76);_0x32782e(_0x2c55db[_0x40af('0x18')](0x1f4,_0x4489bf[_0x40af('0x1a')]));});});};exports[_0x40af('0x24')]=function(_0x334d54){return new Promise(function(_0x1841e3,_0x32f5bd){return db['ChatInteraction'][_0x40af('0x25')]({'where':_0x334d54[_0x40af('0x20')]?_0x334d54[_0x40af('0x20')][_0x40af('0x21')]||null:null})[_0x40af('0x23')](function(_0xe2c85a){if(_0xe2c85a){return _0xe2c85a[_0x40af('0x26')](_0x334d54['body'][_0x40af('0x27')],_[_0x40af('0x28')](_0x334d54[_0x40af('0x29')],[_0x40af('0x27'),'id'])||{});}})[_0x40af('0x2a')](function(_0x2e9d15){logger[_0x40af('0x12')](_0x40af('0x2b'),_0x334d54);logger['debug'](_0x40af('0x2b'),_0x334d54,JSON[_0x40af('0x17')](_0x2e9d15));_0x1841e3(_0x2e9d15);})[_0x40af('0x1c')](function(_0x39ffca){logger[_0x40af('0x18')]('AddTags',_0x39ffca[_0x40af('0x1a')],_0x334d54);_0x32f5bd(_this['error'](0x1f4,_0x39ffca['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index c49f03c..841a46a 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 _0xe6ef=['removeListener','register','length','chatInteraction:','remove','update','emit'];(function(_0x51dd5d,_0x4a018c){var _0x457e3d=function(_0xce2260){while(--_0xce2260){_0x51dd5d['push'](_0x51dd5d['shift']());}};_0x457e3d(++_0x4a018c);}(_0xe6ef,0xba));var _0xfe6e=function(_0x34ffe5,_0x1450cd){_0x34ffe5=_0x34ffe5-0x0;var _0x52298d=_0xe6ef[_0x34ffe5];return _0x52298d;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0xfe6e('0x0'),_0xfe6e('0x1')];function createListener(_0x1e9b71,_0x551264){return function(_0x3b2fbf){_0x551264[_0xfe6e('0x2')](_0x1e9b71,_0x3b2fbf);};}function removeListener(_0x5c4e64,_0x433fb4){return function(){ChatInteractionEvents[_0xfe6e('0x3')](_0x5c4e64,_0x433fb4);};}exports[_0xfe6e('0x4')]=function(_0xf3673){for(var _0xe61a4a=0x0,_0x5ed355=events[_0xfe6e('0x5')];_0xe61a4a<_0x5ed355;_0xe61a4a++){var _0x3d0202=events[_0xe61a4a];var _0x3daf9c=createListener(_0xfe6e('0x6')+_0x3d0202,_0xf3673);ChatInteractionEvents['on'](_0x3d0202,_0x3daf9c);}}; \ No newline at end of file +var _0x37a4=['remove','removeListener','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x22d1bd,_0x387be8){var _0x1cb3a6=function(_0x5865a7){while(--_0x5865a7){_0x22d1bd['push'](_0x22d1bd['shift']());}};_0x1cb3a6(++_0x387be8);}(_0x37a4,0xcb));var _0x437a=function(_0x5b1dc7,_0x5ca18a){_0x5b1dc7=_0x5b1dc7-0x0;var _0x4c88c3=_0x37a4[_0x5b1dc7];return _0x4c88c3;};'use strict';var ChatInteractionEvents=require(_0x437a('0x0'));var events=['save',_0x437a('0x1'),'update'];function createListener(_0x421d01,_0x35f27e){return function(_0x1d6ff4){_0x35f27e['emit'](_0x421d01,_0x1d6ff4);};}function removeListener(_0x5f2883,_0xf52f1a){return function(){ChatInteractionEvents[_0x437a('0x2')](_0x5f2883,_0xf52f1a);};}exports[_0x437a('0x3')]=function(_0x1b637a){for(var _0x5f5067=0x0,_0x1c567f=events[_0x437a('0x4')];_0x5f5067<_0x1c567f;_0x5f5067++){var _0x5017ce=events[_0x5f5067];var _0x36270b=createListener(_0x437a('0x5')+_0x5017ce,_0x1b637a);ChatInteractionEvents['on'](_0x5017ce,_0x36270b);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 532ff1c..bfbd04e 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 _0x0a41=['customUpdate','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','describe','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','post','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','%s-%s','originalname','file','attachmentUpload','addMessage','/:id/tags','tracked','chatinteraction:addtags','put','/:id','chat','/:id/custom_update'];(function(_0x38a235,_0x2c9c3e){var _0x13db0c=function(_0x30408c){while(--_0x30408c){_0x38a235['push'](_0x38a235['shift']());}};_0x13db0c(++_0x2c9c3e);}(_0x0a41,0x1e1));var _0x10a4=function(_0x7a1589,_0x58e8d2){_0x7a1589=_0x7a1589-0x0;var _0x570127=_0x0a41[_0x7a1589];return _0x570127;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x10a4('0x0')]();var fs_extra=require(_0x10a4('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x10a4('0x2'));var config=require(_0x10a4('0x3'));var controller=require(_0x10a4('0x4'));router[_0x10a4('0x5')]('/',auth[_0x10a4('0x6')](),controller[_0x10a4('0x7')]);router[_0x10a4('0x5')]('/describe',auth[_0x10a4('0x6')](),controller[_0x10a4('0x8')]);router[_0x10a4('0x5')]('/:id',auth['isChatInteractionAuthorized'](),controller[_0x10a4('0x9')]);router[_0x10a4('0x5')](_0x10a4('0xa'),auth[_0x10a4('0xb')](),controller[_0x10a4('0xc')]);router['get'](_0x10a4('0xd'),auth[_0x10a4('0x6')](),controller[_0x10a4('0xe')]);router[_0x10a4('0x5')]('/:id/my_messages',auth[_0x10a4('0xb')](),controller[_0x10a4('0xf')]);router['get'](_0x10a4('0x10'),auth['isAuthenticated'](),controller['download']);router[_0x10a4('0x11')]('/',auth[_0x10a4('0x6')](),controller['create']);router[_0x10a4('0x11')](_0x10a4('0x12'),auth[_0x10a4('0x6')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x10a4('0x13')]({'destination':function(_0x57c6ba,_0x4ff945,_0x17c2c0){_0x17c2c0(null,path[_0x10a4('0x14')](config[_0x10a4('0x15')],_0x10a4('0x16')));},'filename':function(_0x1a8266,_0x1d0f59,_0x1a4f22){_0x1a4f22(null,util['format'](_0x10a4('0x17'),Date['now'](),_0x1d0f59[_0x10a4('0x18')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x10a4('0x11')]('/:id/attachment_upload',upload['single'](_0x10a4('0x19')),controller[_0x10a4('0x1a')]);router[_0x10a4('0x11')](_0x10a4('0xd'),auth['isChatInteractionAuthorized'](),controller[_0x10a4('0x1b')]);router['post'](_0x10a4('0x1c'),auth['isAuthenticated'](),interaction[_0x10a4('0x1d')]('chat',_0x10a4('0x1e')),controller['addTags']);router[_0x10a4('0x1f')](_0x10a4('0x20'),auth[_0x10a4('0x6')](),interaction[_0x10a4('0x1d')](_0x10a4('0x21'),'chatinteraction:update'),controller['update']);router[_0x10a4('0x1f')](_0x10a4('0x22'),controller[_0x10a4('0x23')]);router[_0x10a4('0x1f')](_0x10a4('0x24'),auth[_0x10a4('0xb')](),controller[_0x10a4('0x25')]);router[_0x10a4('0x1f')](_0x10a4('0x26'),controller['close']);router[_0x10a4('0x27')](_0x10a4('0x20'),auth['isAuthenticated'](),interaction[_0x10a4('0x1d')](_0x10a4('0x21'),_0x10a4('0x28')),controller[_0x10a4('0x29')]);router[_0x10a4('0x27')]('/:id/tags',auth[_0x10a4('0x6')](),controller[_0x10a4('0x2a')]);module['exports']=router; \ No newline at end of file +var _0x542b=['chatinteraction:addtags','addTags','put','update','/:id/custom_update','abandon','close','delete','chatinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','/:id/messages','/:id/tags','tracked','chat'];(function(_0x323ce0,_0x581cb1){var _0x167048=function(_0x54157f){while(--_0x54157f){_0x323ce0['push'](_0x323ce0['shift']());}};_0x167048(++_0x581cb1);}(_0x542b,0x1d6));var _0xb542=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x542b[_0x9c2427];return _0x51984f;};'use strict';var multer=require(_0xb542('0x0'));var util=require(_0xb542('0x1'));var path=require(_0xb542('0x2'));var timeout=require(_0xb542('0x3'));var express=require(_0xb542('0x4'));var router=express[_0xb542('0x5')]();var fs_extra=require(_0xb542('0x6'));var auth=require(_0xb542('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb542('0x8'));var controller=require(_0xb542('0x9'));router[_0xb542('0xa')]('/',auth[_0xb542('0xb')](),controller[_0xb542('0xc')]);router[_0xb542('0xa')]('/describe',auth[_0xb542('0xb')](),controller[_0xb542('0xd')]);router[_0xb542('0xa')](_0xb542('0xe'),auth[_0xb542('0xf')](),controller['show']);router['get'](_0xb542('0x10'),auth[_0xb542('0xf')](),controller[_0xb542('0x11')]);router['get']('/:id/messages',auth[_0xb542('0xb')](),controller[_0xb542('0x12')]);router[_0xb542('0xa')](_0xb542('0x13'),auth[_0xb542('0xf')](),controller[_0xb542('0x14')]);router[_0xb542('0xa')](_0xb542('0x15'),auth[_0xb542('0xb')](),controller[_0xb542('0x16')]);router['post']('/',auth[_0xb542('0xb')](),controller[_0xb542('0x17')]);router[_0xb542('0x18')](_0xb542('0x19'),auth['isAuthenticated'](),controller[_0xb542('0x1a')]);var upload=multer({'storage':multer[_0xb542('0x1b')]({'destination':function(_0x2fafd4,_0x50253f,_0x1db2b6){_0x1db2b6(null,path['join'](config[_0xb542('0x1c')],_0xb542('0x1d')));},'filename':function(_0x435816,_0x25533d,_0xcd0e57){_0xcd0e57(null,util[_0xb542('0x1e')](_0xb542('0x1f'),Date[_0xb542('0x20')](),_0x25533d[_0xb542('0x21')][_0xb542('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xb542('0x23'),upload['single']('file'),controller['attachmentUpload']);router[_0xb542('0x18')](_0xb542('0x24'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0xb542('0x18')](_0xb542('0x25'),auth['isAuthenticated'](),interaction[_0xb542('0x26')](_0xb542('0x27'),_0xb542('0x28')),controller[_0xb542('0x29')]);router[_0xb542('0x2a')](_0xb542('0xe'),auth[_0xb542('0xb')](),interaction[_0xb542('0x26')](_0xb542('0x27'),'chatinteraction:update'),controller[_0xb542('0x2b')]);router[_0xb542('0x2a')](_0xb542('0x2c'),controller['customUpdate']);router[_0xb542('0x2a')]('/:id/abandon',auth[_0xb542('0xf')](),controller[_0xb542('0x2d')]);router[_0xb542('0x2a')]('/:id/close',controller[_0xb542('0x2e')]);router[_0xb542('0x2f')](_0xb542('0xe'),auth['isAuthenticated'](),interaction[_0xb542('0x26')](_0xb542('0x27'),_0xb542('0x30')),controller[_0xb542('0x31')]);router[_0xb542('0x2f')](_0xb542('0x25'),auth[_0xb542('0xb')](),controller[_0xb542('0x32')]);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 0d629e1..c65021b 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 _0xc634=['exports','medium','BOOLEAN','sequelize'];(function(_0xd293ef,_0x4f7e6b){var _0x5e0e20=function(_0x2f1961){while(--_0x2f1961){_0xd293ef['push'](_0xd293ef['shift']());}};_0x5e0e20(++_0x4f7e6b);}(_0xc634,0x1b3));var _0x4c63=function(_0xbbcb36,_0x586383){_0xbbcb36=_0xbbcb36-0x0;var _0x4278ff=_0xc634[_0xbbcb36];return _0x4278ff;};'use strict';var Sequelize=require(_0x4c63('0x0'));module[_0x4c63('0x1')]={'body':{'type':Sequelize['TEXT'](_0x4c63('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4c63('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xeb0a=['INTEGER','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x2e977b,_0x15b5c3){var _0x5306f8=function(_0x58d724){while(--_0x58d724){_0x2e977b['push'](_0x2e977b['shift']());}};_0x5306f8(++_0x15b5c3);}(_0xeb0a,0x1c9));var _0xaeb0=function(_0x48cb1f,_0x5ca68d){_0x48cb1f=_0x48cb1f-0x0;var _0x172c4d=_0xeb0a[_0x48cb1f];return _0x172c4d;};'use strict';var Sequelize=require(_0xaeb0('0x0'));module[_0xaeb0('0x1')]={'body':{'type':Sequelize[_0xaeb0('0x2')](_0xaeb0('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xaeb0('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xaeb0('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index fcd14da..3f6f711 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 _0xac05=['show','find','create','body','params','describe','catch','get','lastMessageAt','createdAt','lastMessage','getUsers','User','user','fullname','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','filter','agent','push','messages','FromId','all','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./chatInternalMessage.socket','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','type','key','keys','filters','model','query','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows'];(function(_0x144ec5,_0x499f0e){var _0x212a7b=function(_0x10616d){while(--_0x10616d){_0x144ec5['push'](_0x144ec5['shift']());}};_0x212a7b(++_0x499f0e);}(_0xac05,0x1e2));var _0x5ac0=function(_0x32b710,_0x349865){_0x32b710=_0x32b710-0x0;var _0x48cc13=_0xac05[_0x32b710];return _0x48cc13;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5ac0('0x0'));var rp=require(_0x5ac0('0x1'));var moment=require(_0x5ac0('0x2'));var BPromise=require(_0x5ac0('0x3'));var Mustache=require('mustache');var util=require(_0x5ac0('0x4'));var path=require(_0x5ac0('0x5'));var sox=require(_0x5ac0('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5ac0('0x7'));var _=require('lodash');var squel=require(_0x5ac0('0x8'));var crypto=require(_0x5ac0('0x9'));var jsforce=require(_0x5ac0('0xa'));var deskjs=require(_0x5ac0('0xb'));var toCsv=require(_0x5ac0('0xc'));var querystring=require(_0x5ac0('0xd'));var Papa=require(_0x5ac0('0xe'));var Redis=require(_0x5ac0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5ac0('0x10'));var as=require(_0x5ac0('0x11'));var hardwareService=require(_0x5ac0('0x12'));var logger=require(_0x5ac0('0x13'))(_0x5ac0('0x14'));var utils=require('../../config/utils');var config=require(_0x5ac0('0x15'));var licenseUtil=require(_0x5ac0('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5ac0('0x17')](config['redis'],{'host':_0x5ac0('0x18'),'port':0x18eb});var socket=require(_0x5ac0('0x19'))(new Redis(config[_0x5ac0('0x1a')]));require(_0x5ac0('0x1b'))['register'](socket);function respondWithStatusCode(_0x31c72f,_0x2d0c2b){_0x2d0c2b=_0x2d0c2b||0xcc;return function(_0x377f9c){if(_0x377f9c){return _0x31c72f['sendStatus'](_0x2d0c2b);}return _0x31c72f[_0x5ac0('0x1c')](_0x2d0c2b)[_0x5ac0('0x1d')]();};}function respondWithResult(_0x38ee6d,_0x4b5b76){_0x4b5b76=_0x4b5b76||0xc8;return function(_0x5d8719){if(_0x5d8719){return _0x38ee6d[_0x5ac0('0x1c')](_0x4b5b76)[_0x5ac0('0x1e')](_0x5d8719);}};}function respondWithFilteredResult(_0x32e6ab,_0x22983f){return function(_0x4e983e){if(_0x4e983e){var _0x2d48a3=typeof _0x22983f['offset']===_0x5ac0('0x1f')&&typeof _0x22983f['limit']===_0x5ac0('0x1f');var _0x1fbc25=_0x4e983e[_0x5ac0('0x20')];var _0x18fff6=_0x2d48a3?0x0:_0x22983f[_0x5ac0('0x21')];var _0x40ed27=_0x2d48a3?_0x4e983e[_0x5ac0('0x20')]:_0x22983f[_0x5ac0('0x21')]+_0x22983f['limit'];var _0x5161b5;if(_0x40ed27>=_0x1fbc25){_0x40ed27=_0x1fbc25;_0x5161b5=0xc8;}else{_0x5161b5=0xce;}_0x32e6ab['status'](_0x5161b5);return _0x32e6ab[_0x5ac0('0x22')](_0x5ac0('0x23'),_0x18fff6+'-'+_0x40ed27+'/'+_0x1fbc25)['json'](_0x4e983e);}return null;};}function patchUpdates(_0x5d46a6){return function(_0x2bae7d){try{jsonpatch[_0x5ac0('0x24')](_0x2bae7d,_0x5d46a6,!![]);}catch(_0x4b1989){return BPromise[_0x5ac0('0x25')](_0x4b1989);}return _0x2bae7d[_0x5ac0('0x26')]();};}function saveUpdates(_0x14d790,_0x4ef5e5){return function(_0x1065b6){if(_0x1065b6){return _0x1065b6[_0x5ac0('0x27')](_0x14d790)[_0x5ac0('0x28')](function(_0x4d9df2){return _0x4d9df2;});}return null;};}function removeEntity(_0x211090,_0x193933){return function(_0x3ca2df){if(_0x3ca2df){return _0x3ca2df[_0x5ac0('0x29')]()[_0x5ac0('0x28')](function(){_0x211090[_0x5ac0('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x284c65,_0x3c5fe1){return function(_0x42d0c5){if(!_0x42d0c5){_0x284c65[_0x5ac0('0x2a')](0x194);}return _0x42d0c5;};}function handleError(_0x3c395b,_0x3bcf08){_0x3bcf08=_0x3bcf08||0x1f4;return function(_0x5445db){logger[_0x5ac0('0x2b')](_0x5445db[_0x5ac0('0x2c')]);if(_0x5445db['name']){delete _0x5445db[_0x5ac0('0x2d')];}_0x3c395b[_0x5ac0('0x1c')](_0x3bcf08)[_0x5ac0('0x2e')](_0x5445db);};}exports[_0x5ac0('0x2f')]=function(_0x4ead97,_0x3d93ba){var _0x394f3e={},_0x387dc4={},_0x1809df={'count':0x0,'rows':[]};var _0x24ec5f=_[_0x5ac0('0x30')](db[_0x5ac0('0x31')][_0x5ac0('0x32')],function(_0x53ecda){return{'name':_0x53ecda['fieldName'],'type':_0x53ecda[_0x5ac0('0x33')][_0x5ac0('0x34')]};});_0x387dc4['model']=_[_0x5ac0('0x30')](_0x24ec5f,'name');_0x387dc4['query']=_[_0x5ac0('0x35')](_0x4ead97['query']);_0x387dc4[_0x5ac0('0x36')]=_['intersection'](_0x387dc4[_0x5ac0('0x37')],_0x387dc4[_0x5ac0('0x38')]);_0x394f3e['attributes']=_[_0x5ac0('0x39')](_0x387dc4['model'],qs['fields'](_0x4ead97[_0x5ac0('0x38')][_0x5ac0('0x3a')]));_0x394f3e[_0x5ac0('0x3b')]=_0x394f3e['attributes'][_0x5ac0('0x3c')]?_0x394f3e[_0x5ac0('0x3b')]:_0x387dc4[_0x5ac0('0x37')];if(!_0x4ead97[_0x5ac0('0x38')]['hasOwnProperty'](_0x5ac0('0x3d'))){_0x394f3e[_0x5ac0('0x3e')]=qs[_0x5ac0('0x3e')](_0x4ead97[_0x5ac0('0x38')][_0x5ac0('0x3e')]);_0x394f3e['offset']=qs[_0x5ac0('0x21')](_0x4ead97['query'][_0x5ac0('0x21')]);}_0x394f3e[_0x5ac0('0x3f')]=qs[_0x5ac0('0x40')](_0x4ead97[_0x5ac0('0x38')]['sort']);_0x394f3e[_0x5ac0('0x41')]=qs[_0x5ac0('0x36')](_[_0x5ac0('0x42')](_0x4ead97[_0x5ac0('0x38')],_0x387dc4[_0x5ac0('0x36')]),_0x24ec5f);if(_0x4ead97['query']['filter']){_0x394f3e[_0x5ac0('0x41')]=_[_0x5ac0('0x43')](_0x394f3e['where'],{'$or':_[_0x5ac0('0x30')](_0x24ec5f,function(_0x18ee14){if(_0x18ee14[_0x5ac0('0x33')]!=='VIRTUAL'){var _0x585a74={};_0x585a74[_0x18ee14[_0x5ac0('0x2d')]]={'$like':'%'+_0x4ead97[_0x5ac0('0x38')]['filter']+'%'};return _0x585a74;}})});}_0x394f3e=_[_0x5ac0('0x43')]({},_0x394f3e,_0x4ead97[_0x5ac0('0x44')]);var _0x234efc={'where':_0x394f3e[_0x5ac0('0x41')]};return db[_0x5ac0('0x31')][_0x5ac0('0x20')](_0x234efc)['then'](function(_0x497fe4){_0x1809df[_0x5ac0('0x20')]=_0x497fe4;if(_0x4ead97[_0x5ac0('0x38')][_0x5ac0('0x45')]){_0x394f3e[_0x5ac0('0x46')]=[{'all':!![]}];}return db[_0x5ac0('0x31')][_0x5ac0('0x47')](_0x394f3e);})[_0x5ac0('0x28')](function(_0x37c62a){_0x1809df[_0x5ac0('0x48')]=_0x37c62a;return _0x1809df;})[_0x5ac0('0x28')](respondWithFilteredResult(_0x3d93ba,_0x394f3e))['catch'](handleError(_0x3d93ba,null));};exports[_0x5ac0('0x49')]=function(_0x42e10c,_0x1c2ec0){var _0x39e644={'raw':!![],'where':{'id':_0x42e10c['params']['id']}},_0x1a09b9={};_0x1a09b9[_0x5ac0('0x37')]=_[_0x5ac0('0x35')](db['ChatInternalMessage']['rawAttributes']);_0x1a09b9[_0x5ac0('0x38')]=_['keys'](_0x42e10c['query']);_0x1a09b9[_0x5ac0('0x36')]=_[_0x5ac0('0x39')](_0x1a09b9[_0x5ac0('0x37')],_0x1a09b9[_0x5ac0('0x38')]);_0x39e644[_0x5ac0('0x3b')]=_[_0x5ac0('0x39')](_0x1a09b9[_0x5ac0('0x37')],qs['fields'](_0x42e10c[_0x5ac0('0x38')][_0x5ac0('0x3a')]));_0x39e644['attributes']=_0x39e644[_0x5ac0('0x3b')][_0x5ac0('0x3c')]?_0x39e644[_0x5ac0('0x3b')]:_0x1a09b9[_0x5ac0('0x37')];if(_0x42e10c[_0x5ac0('0x38')]['includeAll']){_0x39e644[_0x5ac0('0x46')]=[{'all':!![]}];}_0x39e644=_['merge']({},_0x39e644,_0x42e10c[_0x5ac0('0x44')]);return db[_0x5ac0('0x31')][_0x5ac0('0x4a')](_0x39e644)[_0x5ac0('0x28')](handleEntityNotFound(_0x1c2ec0,null))[_0x5ac0('0x28')](respondWithResult(_0x1c2ec0,null))['catch'](handleError(_0x1c2ec0,null));};exports[_0x5ac0('0x4b')]=function(_0x399ae6,_0x553c3e){return db[_0x5ac0('0x31')]['create'](_0x399ae6['body'],{})[_0x5ac0('0x28')](respondWithResult(_0x553c3e,0xc9))['catch'](handleError(_0x553c3e,null));};exports[_0x5ac0('0x27')]=function(_0x261b1d,_0x37357f){if(_0x261b1d['body']['id']){delete _0x261b1d['body']['id'];}return db[_0x5ac0('0x31')][_0x5ac0('0x4a')]({'where':{'id':_0x261b1d['params']['id']}})[_0x5ac0('0x28')](handleEntityNotFound(_0x37357f,null))[_0x5ac0('0x28')](saveUpdates(_0x261b1d[_0x5ac0('0x4c')],null))[_0x5ac0('0x28')](respondWithResult(_0x37357f,null))['catch'](handleError(_0x37357f,null));};exports[_0x5ac0('0x29')]=function(_0x4f9b3c,_0x3656bc){return db[_0x5ac0('0x31')]['find']({'where':{'id':_0x4f9b3c[_0x5ac0('0x4d')]['id']}})[_0x5ac0('0x28')](handleEntityNotFound(_0x3656bc,null))[_0x5ac0('0x28')](removeEntity(_0x3656bc,null))['catch'](handleError(_0x3656bc,null));};exports[_0x5ac0('0x4e')]=function(_0x3c5581,_0x4bbb4e){return db['ChatInternalMessage']['describe']()[_0x5ac0('0x28')](respondWithResult(_0x4bbb4e,null))[_0x5ac0('0x4f')](handleError(_0x4bbb4e,null));};function wrapUser(_0x1f5eaa){return function(_0xa7fd06){var _0x25a84f=_0x1f5eaa[_0x5ac0('0x50')]({'plain':!![]});_0x25a84f['messages']=[];if(_0xa7fd06){_0x25a84f[_0x5ac0('0x51')]=_0xa7fd06[_0x5ac0('0x52')];_0x25a84f[_0x5ac0('0x53')]=_0xa7fd06;}else{_0x25a84f[_0x5ac0('0x51')]=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x25a84f[_0x5ac0('0x53')]={};}return _0x25a84f;};}exports[_0x5ac0('0x54')]=function(_0x4599a2,_0x15110a,_0x4dc42e){var _0x33a1e8=[];return db[_0x5ac0('0x55')][_0x5ac0('0x47')]({'where':{'role':['agent','admin',_0x5ac0('0x56')]},'attributes':['id',_0x5ac0('0x57'),_0x5ac0('0x2d'),'role',_0x5ac0('0x58'),_0x5ac0('0x59'),_0x5ac0('0x5a'),_0x5ac0('0x5b'),_0x5ac0('0x5c'),_0x5ac0('0x5d')],'order':qs[_0x5ac0('0x40')](_0x5ac0('0x5e')),'include':[{'model':db[_0x5ac0('0x5f')],'as':_0x5ac0('0x60'),'attributes':['id',_0x5ac0('0x2d'),'type'],'through':{'attributes':[]}}]})[_0x5ac0('0x28')](function(_0x27c67d){if(_0x27c67d){var _0x2d648f=_0x4599a2[_0x5ac0('0x56')]['get']({'plain':!![]});if(!_0x2d648f)throw new Error(_0x5ac0('0x61'));if(_0x2d648f[_0x5ac0('0x62')]===_0x5ac0('0x56')){return db[_0x5ac0('0x63')]['find']({'where':{'name':_0x5ac0('0x64'),'userProfileId':_0x2d648f[_0x5ac0('0x65')]},'raw':!![]})[_0x5ac0('0x28')](function(_0x552e7b){if(_0x552e7b){if(_0x552e7b[_0x5ac0('0x66')]===0x0){return db[_0x5ac0('0x67')]['findAll']({'where':{'sectionId':_0x552e7b['id']},'raw':!![]})[_0x5ac0('0x28')](function(_0x322664){var _0xd678fc=[];if(_[_0x5ac0('0x68')](_0x322664)){_0xd678fc=_[_0x5ac0('0x69')](_0x27c67d,function(_0x4c1f36){if(_0x4c1f36[_0x5ac0('0x62')]!==_0x5ac0('0x6a')){return _0x4c1f36;}});return _0xd678fc;}else{for(var _0x2b3bbe=0x0;_0x2b3bbe<_0x27c67d[_0x5ac0('0x3c')];_0x2b3bbe++){var _0x5c5f97=_0x27c67d[_0x2b3bbe];if(_0x5c5f97[_0x5ac0('0x62')]===_0x5ac0('0x6a')){var _0x3b362f=_['find'](_0x322664,function(_0x59d2b3){return _0x59d2b3['resourceId']===_0x5c5f97['id'];});if(_0x3b362f)_0xd678fc[_0x5ac0('0x6b')](_0x5c5f97);}else{_0xd678fc['push'](_0x5c5f97);}}return _0xd678fc;}});}else{return _0x27c67d;}}else{var _0x236bfa=_[_0x5ac0('0x69')](_0x27c67d,function(_0x3e2257){if(_0x3e2257[_0x5ac0('0x62')]!==_0x5ac0('0x6a')){return _0x3e2257;}});return _0x236bfa;}});}else{return _0x27c67d;}}})[_0x5ac0('0x28')](function(_0x31b9da){var _0x29bbb6=[];if(_0x31b9da){_0x33a1e8=_0x31b9da;for(var _0x57c06c=0x0;_0x57c06c<_0x31b9da[_0x5ac0('0x3c')];_0x57c06c+=0x1){_0x33a1e8[_0x57c06c][_0x5ac0('0x6c')]=[];_0x29bbb6[_0x5ac0('0x6b')](db[_0x5ac0('0x31')]['find']({'where':{'FromId':[_0x4599a2['user']['id'],_0x31b9da[_0x57c06c]['id']],'ToId':[_0x4599a2[_0x5ac0('0x56')]['id'],_0x31b9da[_0x57c06c]['id']],'ChatGroupId':null},'attributes':['id',_0x5ac0('0x52'),_0x5ac0('0x6d'),'ToId','read','body'],'order':qs[_0x5ac0('0x40')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x5ac0('0x28')](wrapUser(_0x31b9da[_0x57c06c])));}return BPromise[_0x5ac0('0x6e')](_0x29bbb6);}return[];})[_0x5ac0('0x28')](function(_0x45a6b6){return{'rows':_0x45a6b6,'count':_0x45a6b6[_0x5ac0('0x3c')]};})['then'](respondWithResult(_0x15110a,null))['catch'](handleError(_0x15110a,null));}; \ No newline at end of file +var _0xf754=['destroy','end','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','ChatInternalMessage','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','get','createdAt','lastMessage','format','agent','user','fullname','role','userpic','internal','online','lastLoginAt','-online','VoiceQueue','VoiceQueues','UserProfileSection','userProfileId','autoAssociation','isEmpty','resourceId','push','messages','FromId','read','-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','register','sendStatus','status','json','offset','limit','undefined','count','set','reject','save','update','then'];(function(_0x262ff6,_0x158799){var _0x4c9b82=function(_0x2d854d){while(--_0x2d854d){_0x262ff6['push'](_0x262ff6['shift']());}};_0x4c9b82(++_0x158799);}(_0xf754,0xaa));var _0x4f75=function(_0x85f713,_0x2c1959){_0x85f713=_0x85f713-0x0;var _0x1c4119=_0xf754[_0x85f713];return _0x1c4119;};'use strict';var emlformat=require(_0x4f75('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4f75('0x1'));var jsonpatch=require(_0x4f75('0x2'));var rp=require(_0x4f75('0x3'));var moment=require(_0x4f75('0x4'));var BPromise=require(_0x4f75('0x5'));var Mustache=require(_0x4f75('0x6'));var util=require(_0x4f75('0x7'));var path=require(_0x4f75('0x8'));var sox=require(_0x4f75('0x9'));var csv=require(_0x4f75('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4f75('0xb'));var _=require('lodash');var squel=require(_0x4f75('0xc'));var crypto=require(_0x4f75('0xd'));var jsforce=require(_0x4f75('0xe'));var deskjs=require(_0x4f75('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4f75('0x10'));var authService=require(_0x4f75('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4f75('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f75('0x13'))(_0x4f75('0x14'));var utils=require('../../config/utils');var config=require(_0x4f75('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4f75('0x16'))['db'];config[_0x4f75('0x17')]=_[_0x4f75('0x18')](config[_0x4f75('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f75('0x17')]));require('./chatInternalMessage.socket')[_0x4f75('0x19')](socket);function respondWithStatusCode(_0x13d76f,_0x932aa6){_0x932aa6=_0x932aa6||0xcc;return function(_0x2b70ea){if(_0x2b70ea){return _0x13d76f[_0x4f75('0x1a')](_0x932aa6);}return _0x13d76f[_0x4f75('0x1b')](_0x932aa6)['end']();};}function respondWithResult(_0x549ebe,_0x8b0b1e){_0x8b0b1e=_0x8b0b1e||0xc8;return function(_0x373c02){if(_0x373c02){return _0x549ebe['status'](_0x8b0b1e)[_0x4f75('0x1c')](_0x373c02);}};}function respondWithFilteredResult(_0x3b8644,_0x12105c){return function(_0x3f9843){if(_0x3f9843){var _0x656555=typeof _0x12105c[_0x4f75('0x1d')]==='undefined'&&typeof _0x12105c[_0x4f75('0x1e')]===_0x4f75('0x1f');var _0x490229=_0x3f9843[_0x4f75('0x20')];var _0x2995e5=_0x656555?0x0:_0x12105c[_0x4f75('0x1d')];var _0x593457=_0x656555?_0x3f9843['count']:_0x12105c['offset']+_0x12105c['limit'];var _0x4af5d0;if(_0x593457>=_0x490229){_0x593457=_0x490229;_0x4af5d0=0xc8;}else{_0x4af5d0=0xce;}_0x3b8644[_0x4f75('0x1b')](_0x4af5d0);return _0x3b8644[_0x4f75('0x21')]('Content-Range',_0x2995e5+'-'+_0x593457+'/'+_0x490229)['json'](_0x3f9843);}return null;};}function patchUpdates(_0x556880){return function(_0x5d3657){try{jsonpatch['apply'](_0x5d3657,_0x556880,!![]);}catch(_0x1d2071){return BPromise[_0x4f75('0x22')](_0x1d2071);}return _0x5d3657[_0x4f75('0x23')]();};}function saveUpdates(_0xb238e9,_0x5ae2d7){return function(_0x892e84){if(_0x892e84){return _0x892e84[_0x4f75('0x24')](_0xb238e9)[_0x4f75('0x25')](function(_0x546b84){return _0x546b84;});}return null;};}function removeEntity(_0x490fc5,_0x4af819){return function(_0x5a696b){if(_0x5a696b){return _0x5a696b[_0x4f75('0x26')]()[_0x4f75('0x25')](function(){_0x490fc5[_0x4f75('0x1b')](0xcc)[_0x4f75('0x27')]();});}};}function handleEntityNotFound(_0x4acc8e,_0x3c0239){return function(_0x5e5a60){if(!_0x5e5a60){_0x4acc8e[_0x4f75('0x1a')](0x194);}return _0x5e5a60;};}function handleError(_0x4d8c28,_0x90c81c){_0x90c81c=_0x90c81c||0x1f4;return function(_0x2db2e6){logger[_0x4f75('0x28')](_0x2db2e6[_0x4f75('0x29')]);if(_0x2db2e6[_0x4f75('0x2a')]){delete _0x2db2e6[_0x4f75('0x2a')];}_0x4d8c28[_0x4f75('0x1b')](_0x90c81c)[_0x4f75('0x2b')](_0x2db2e6);};}exports[_0x4f75('0x2c')]=function(_0x51eb71,_0x2ff9e8){var _0x4780ae={},_0x1cca44={},_0x58498b={'count':0x0,'rows':[]};var _0x54ee50=_[_0x4f75('0x2d')](db['ChatInternalMessage']['rawAttributes'],function(_0x4baa82){return{'name':_0x4baa82[_0x4f75('0x2e')],'type':_0x4baa82[_0x4f75('0x2f')][_0x4f75('0x30')]};});_0x1cca44[_0x4f75('0x31')]=_[_0x4f75('0x2d')](_0x54ee50,_0x4f75('0x2a'));_0x1cca44['query']=_[_0x4f75('0x32')](_0x51eb71[_0x4f75('0x33')]);_0x1cca44[_0x4f75('0x34')]=_['intersection'](_0x1cca44[_0x4f75('0x31')],_0x1cca44['query']);_0x4780ae[_0x4f75('0x35')]=_[_0x4f75('0x36')](_0x1cca44['model'],qs['fields'](_0x51eb71['query'][_0x4f75('0x37')]));_0x4780ae[_0x4f75('0x35')]=_0x4780ae[_0x4f75('0x35')][_0x4f75('0x38')]?_0x4780ae[_0x4f75('0x35')]:_0x1cca44['model'];if(!_0x51eb71[_0x4f75('0x33')][_0x4f75('0x39')](_0x4f75('0x3a'))){_0x4780ae['limit']=qs[_0x4f75('0x1e')](_0x51eb71['query'][_0x4f75('0x1e')]);_0x4780ae[_0x4f75('0x1d')]=qs[_0x4f75('0x1d')](_0x51eb71[_0x4f75('0x33')][_0x4f75('0x1d')]);}_0x4780ae['order']=qs[_0x4f75('0x3b')](_0x51eb71[_0x4f75('0x33')]['sort']);_0x4780ae['where']=qs['filters'](_[_0x4f75('0x3c')](_0x51eb71['query'],_0x1cca44[_0x4f75('0x34')]),_0x54ee50);if(_0x51eb71[_0x4f75('0x33')][_0x4f75('0x3d')]){_0x4780ae[_0x4f75('0x3e')]=_['merge'](_0x4780ae['where'],{'$or':_[_0x4f75('0x2d')](_0x54ee50,function(_0x27b561){if(_0x27b561[_0x4f75('0x2f')]!=='VIRTUAL'){var _0x456366={};_0x456366[_0x27b561[_0x4f75('0x2a')]]={'$like':'%'+_0x51eb71['query']['filter']+'%'};return _0x456366;}})});}_0x4780ae=_[_0x4f75('0x3f')]({},_0x4780ae,_0x51eb71[_0x4f75('0x40')]);var _0x1cf37c={'where':_0x4780ae[_0x4f75('0x3e')]};return db[_0x4f75('0x41')]['count'](_0x1cf37c)[_0x4f75('0x25')](function(_0x1fe9c6){_0x58498b['count']=_0x1fe9c6;if(_0x51eb71[_0x4f75('0x33')][_0x4f75('0x42')]){_0x4780ae[_0x4f75('0x43')]=[{'all':!![]}];}return db[_0x4f75('0x41')][_0x4f75('0x44')](_0x4780ae);})[_0x4f75('0x25')](function(_0x24ae9a){_0x58498b[_0x4f75('0x45')]=_0x24ae9a;return _0x58498b;})[_0x4f75('0x25')](respondWithFilteredResult(_0x2ff9e8,_0x4780ae))[_0x4f75('0x46')](handleError(_0x2ff9e8,null));};exports[_0x4f75('0x47')]=function(_0x484c60,_0x16c88f){var _0x2cd5e1={'raw':!![],'where':{'id':_0x484c60[_0x4f75('0x48')]['id']}},_0x3391a2={};_0x3391a2['model']=_[_0x4f75('0x32')](db[_0x4f75('0x41')][_0x4f75('0x49')]);_0x3391a2[_0x4f75('0x33')]=_[_0x4f75('0x32')](_0x484c60['query']);_0x3391a2['filters']=_[_0x4f75('0x36')](_0x3391a2[_0x4f75('0x31')],_0x3391a2[_0x4f75('0x33')]);_0x2cd5e1[_0x4f75('0x35')]=_[_0x4f75('0x36')](_0x3391a2[_0x4f75('0x31')],qs[_0x4f75('0x37')](_0x484c60[_0x4f75('0x33')]['fields']));_0x2cd5e1['attributes']=_0x2cd5e1['attributes'][_0x4f75('0x38')]?_0x2cd5e1[_0x4f75('0x35')]:_0x3391a2['model'];if(_0x484c60['query'][_0x4f75('0x42')]){_0x2cd5e1[_0x4f75('0x43')]=[{'all':!![]}];}_0x2cd5e1=_[_0x4f75('0x3f')]({},_0x2cd5e1,_0x484c60['options']);return db[_0x4f75('0x41')]['find'](_0x2cd5e1)['then'](handleEntityNotFound(_0x16c88f,null))[_0x4f75('0x25')](respondWithResult(_0x16c88f,null))[_0x4f75('0x46')](handleError(_0x16c88f,null));};exports[_0x4f75('0x4a')]=function(_0x12987c,_0x1f1cf3){return db[_0x4f75('0x41')]['create'](_0x12987c[_0x4f75('0x4b')],{})['then'](respondWithResult(_0x1f1cf3,0xc9))[_0x4f75('0x46')](handleError(_0x1f1cf3,null));};exports[_0x4f75('0x24')]=function(_0x4e99db,_0x57f939){if(_0x4e99db['body']['id']){delete _0x4e99db[_0x4f75('0x4b')]['id'];}return db['ChatInternalMessage'][_0x4f75('0x4c')]({'where':{'id':_0x4e99db[_0x4f75('0x48')]['id']}})[_0x4f75('0x25')](handleEntityNotFound(_0x57f939,null))[_0x4f75('0x25')](saveUpdates(_0x4e99db['body'],null))[_0x4f75('0x25')](respondWithResult(_0x57f939,null))[_0x4f75('0x46')](handleError(_0x57f939,null));};exports['destroy']=function(_0x3deed3,_0x58423e){return db[_0x4f75('0x41')][_0x4f75('0x4c')]({'where':{'id':_0x3deed3['params']['id']}})['then'](handleEntityNotFound(_0x58423e,null))[_0x4f75('0x25')](removeEntity(_0x58423e,null))[_0x4f75('0x46')](handleError(_0x58423e,null));};exports[_0x4f75('0x4d')]=function(_0x60caaa,_0x578c76){return db[_0x4f75('0x41')][_0x4f75('0x4d')]()[_0x4f75('0x25')](respondWithResult(_0x578c76,null))[_0x4f75('0x46')](handleError(_0x578c76,null));};function wrapUser(_0x4517b1){return function(_0x93bafe){var _0x594a0a=_0x4517b1[_0x4f75('0x4e')]({'plain':!![]});_0x594a0a['messages']=[];if(_0x93bafe){_0x594a0a['lastMessageAt']=_0x93bafe[_0x4f75('0x4f')];_0x594a0a[_0x4f75('0x50')]=_0x93bafe;}else{_0x594a0a['lastMessageAt']=moment(0x0)[_0x4f75('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x594a0a[_0x4f75('0x50')]={};}return _0x594a0a;};}exports['getUsers']=function(_0x5b7947,_0x58bc2e,_0x8b13bf){var _0x17237f=[];return db['User'][_0x4f75('0x44')]({'where':{'role':[_0x4f75('0x52'),'admin',_0x4f75('0x53')]},'attributes':['id',_0x4f75('0x54'),'name',_0x4f75('0x55'),_0x4f75('0x56'),_0x4f75('0x57'),_0x4f75('0x58'),_0x4f75('0x59'),'allowmessenger','showWebBar'],'order':qs[_0x4f75('0x3b')](_0x4f75('0x5a')),'include':[{'model':db[_0x4f75('0x5b')],'as':_0x4f75('0x5c'),'attributes':['id',_0x4f75('0x2a'),_0x4f75('0x2f')],'through':{'attributes':[]}}]})['then'](function(_0x382caf){if(_0x382caf){var _0xf136a0=_0x5b7947[_0x4f75('0x53')][_0x4f75('0x4e')]({'plain':!![]});if(!_0xf136a0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf136a0[_0x4f75('0x55')]===_0x4f75('0x53')){return db[_0x4f75('0x5d')]['find']({'where':{'name':'Agents','userProfileId':_0xf136a0[_0x4f75('0x5e')]},'raw':!![]})['then'](function(_0x1cf8d6){if(_0x1cf8d6){if(_0x1cf8d6[_0x4f75('0x5f')]===0x0){return db['UserProfileResource'][_0x4f75('0x44')]({'where':{'sectionId':_0x1cf8d6['id']},'raw':!![]})[_0x4f75('0x25')](function(_0xca0ee8){var _0x4a31ac=[];if(_[_0x4f75('0x60')](_0xca0ee8)){_0x4a31ac=_[_0x4f75('0x3d')](_0x382caf,function(_0x1f3d7e){if(_0x1f3d7e[_0x4f75('0x55')]!==_0x4f75('0x52')){return _0x1f3d7e;}});return _0x4a31ac;}else{for(var _0x1526dd=0x0;_0x1526dd<_0x382caf[_0x4f75('0x38')];_0x1526dd++){var _0x4655ee=_0x382caf[_0x1526dd];if(_0x4655ee[_0x4f75('0x55')]===_0x4f75('0x52')){var _0x4534f6=_[_0x4f75('0x4c')](_0xca0ee8,function(_0x175478){return _0x175478[_0x4f75('0x61')]===_0x4655ee['id'];});if(_0x4534f6)_0x4a31ac[_0x4f75('0x62')](_0x4655ee);}else{_0x4a31ac[_0x4f75('0x62')](_0x4655ee);}}return _0x4a31ac;}});}else{return _0x382caf;}}else{var _0x3f4a61=_[_0x4f75('0x3d')](_0x382caf,function(_0x206993){if(_0x206993[_0x4f75('0x55')]!==_0x4f75('0x52')){return _0x206993;}});return _0x3f4a61;}});}else{return _0x382caf;}}})[_0x4f75('0x25')](function(_0x3cea34){var _0x809d19=[];if(_0x3cea34){_0x17237f=_0x3cea34;for(var _0xb26bb=0x0;_0xb26bb<_0x3cea34[_0x4f75('0x38')];_0xb26bb+=0x1){_0x17237f[_0xb26bb][_0x4f75('0x63')]=[];_0x809d19[_0x4f75('0x62')](db[_0x4f75('0x41')][_0x4f75('0x4c')]({'where':{'FromId':[_0x5b7947[_0x4f75('0x53')]['id'],_0x3cea34[_0xb26bb]['id']],'ToId':[_0x5b7947['user']['id'],_0x3cea34[_0xb26bb]['id']],'ChatGroupId':null},'attributes':['id',_0x4f75('0x4f'),_0x4f75('0x64'),'ToId',_0x4f75('0x65'),_0x4f75('0x4b')],'order':qs[_0x4f75('0x3b')](_0x4f75('0x66')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x4f75('0x25')](wrapUser(_0x3cea34[_0xb26bb])));}return BPromise[_0x4f75('0x67')](_0x809d19);}return[];})[_0x4f75('0x25')](function(_0x1b6e2f){return{'rows':_0x1b6e2f,'count':_0x1b6e2f['length']};})[_0x4f75('0x25')](respondWithResult(_0x58bc2e,null))[_0x4f75('0x46')](handleError(_0x58bc2e,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index b3b63a4..f27bff8 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 _0x2106=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x51cc60,_0x561066){var _0x422dcd=function(_0x10493f){while(--_0x10493f){_0x51cc60['push'](_0x51cc60['shift']());}};_0x422dcd(++_0x561066);}(_0x2106,0x133));var _0x6210=function(_0x5b7574,_0x197bc2){_0x5b7574=_0x5b7574-0x0;var _0x43d8e3=_0x2106[_0x5b7574];return _0x43d8e3;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x6210('0x0'))['db'][_0x6210('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6210('0x2')](0x0);var events={'afterCreate':_0x6210('0x3'),'afterUpdate':_0x6210('0x4'),'afterDestroy':_0x6210('0x5')};function emitEvent(_0x1aa75d){return function(_0x5b5c9a,_0x1c4ddd,_0x19ec5b){ChatInternalMessageEvents['emit'](_0x1aa75d+':'+_0x5b5c9a['id'],_0x5b5c9a);ChatInternalMessageEvents[_0x6210('0x6')](_0x1aa75d,_0x5b5c9a);_0x19ec5b(null);};}for(var e in events){if(events[_0x6210('0x7')](e)){var event=events[e];ChatInternalMessage[_0x6210('0x8')](e,emitEvent(event));}}module[_0x6210('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x1b47=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage'];(function(_0x3f9123,_0x1c8a82){var _0x5465c8=function(_0xf953bc){while(--_0xf953bc){_0x3f9123['push'](_0x3f9123['shift']());}};_0x5465c8(++_0x1c8a82);}(_0x1b47,0xfa));var _0x71b4=function(_0x332edd,_0x30528b){_0x332edd=_0x332edd-0x0;var _0x310417=_0x1b47[_0x332edd];return _0x310417;};'use strict';var EventEmitter=require(_0x71b4('0x0'));var ChatInternalMessage=require(_0x71b4('0x1'))['db'][_0x71b4('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x71b4('0x3')](0x0);var events={'afterCreate':_0x71b4('0x4'),'afterUpdate':_0x71b4('0x5'),'afterDestroy':_0x71b4('0x6')};function emitEvent(_0x3ae877){return function(_0x505209,_0x2d13f6,_0x38f012){ChatInternalMessageEvents[_0x71b4('0x7')](_0x3ae877+':'+_0x505209['id'],_0x505209);ChatInternalMessageEvents[_0x71b4('0x7')](_0x3ae877,_0x505209);_0x38f012(null);};}for(var e in events){if(events[_0x71b4('0x8')](e)){var event=events[e];ChatInternalMessage[_0x71b4('0x9')](e,emitEvent(event));}}module[_0x71b4('0xa')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 7833275..a62cf44 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 _0x51ba=['chat_internal_messages','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x51ba,0x79));var _0xa51b=function(_0x473786,_0x4351b0){_0x473786=_0x473786-0x0;var _0x36764=_0x51ba[_0x473786];return _0x36764;};'use strict';var _=require(_0xa51b('0x0'));var util=require(_0xa51b('0x1'));var logger=require(_0xa51b('0x2'))('api');var moment=require(_0xa51b('0x3'));var BPromise=require(_0xa51b('0x4'));var rp=require(_0xa51b('0x5'));var fs=require('fs');var path=require(_0xa51b('0x6'));var rimraf=require(_0xa51b('0x7'));var config=require(_0xa51b('0x8'));var attributes=require('./chatInternalMessage.attributes');module[_0xa51b('0x9')]=function(_0x215dda,_0x2d26fb){return _0x215dda[_0xa51b('0xa')]('ChatInternalMessage',attributes,{'tableName':_0xa51b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb2b6=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0xb2b6,0x1c3));var _0x6b2b=function(_0x2010f0,_0x3e5f1a){_0x2010f0=_0x2010f0-0x0;var _0x4dd943=_0xb2b6[_0x2010f0];return _0x4dd943;};'use strict';var _=require(_0x6b2b('0x0'));var util=require(_0x6b2b('0x1'));var logger=require(_0x6b2b('0x2'))(_0x6b2b('0x3'));var moment=require('moment');var BPromise=require(_0x6b2b('0x4'));var rp=require(_0x6b2b('0x5'));var fs=require('fs');var path=require(_0x6b2b('0x6'));var rimraf=require('rimraf');var config=require(_0x6b2b('0x7'));var attributes=require(_0x6b2b('0x8'));module[_0x6b2b('0x9')]=function(_0x227d3b,_0x24ff89){return _0x227d3b[_0x6b2b('0xa')](_0x6b2b('0xb'),attributes,{'tableName':_0x6b2b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6b2b('0xd'),'collate':_0x6b2b('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 08cd0b4..4012f54 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 _0x3884=['./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','redis','defaults','localhost'];(function(_0x5e8298,_0x82bcb5){var _0x412466=function(_0x4958c4){while(--_0x4958c4){_0x5e8298['push'](_0x5e8298['shift']());}};_0x412466(++_0x82bcb5);}(_0x3884,0x139));var _0x4388=function(_0x27e811,_0x1fad22){_0x27e811=_0x27e811-0x0;var _0x1bfe61=_0x3884[_0x27e811];return _0x1bfe61;};'use strict';var _=require(_0x4388('0x0'));var util=require(_0x4388('0x1'));var moment=require(_0x4388('0x2'));var BPromise=require('bluebird');var rs=require(_0x4388('0x3'));var fs=require('fs');var Redis=require(_0x4388('0x4'));var db=require(_0x4388('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4388('0x6'));var config=require(_0x4388('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4388('0x8')]({'port':0x232a});config[_0x4388('0x9')]=_[_0x4388('0xa')](config['redis'],{'host':_0x4388('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4388('0x9')]));require(_0x4388('0xc'))[_0x4388('0xd')](socket);function respondWithRpcPromise(_0x2dc308,_0x1d38ba,_0x18a89a){return new BPromise(function(_0x257afd,_0x2c7864){return client[_0x4388('0xe')](_0x2dc308,_0x18a89a)[_0x4388('0xf')](function(_0x367cbe){logger[_0x4388('0x10')](_0x4388('0x11'),_0x1d38ba,_0x4388('0x12'));logger['debug'](_0x4388('0x13'),_0x1d38ba,'request\x20sent',JSON[_0x4388('0x14')](_0x367cbe));if(_0x367cbe['error']){if(_0x367cbe[_0x4388('0x15')][_0x4388('0x16')]===0x1f4){logger[_0x4388('0x15')](_0x4388('0x11'),_0x1d38ba,_0x367cbe[_0x4388('0x15')][_0x4388('0x17')]);return _0x2c7864(_0x367cbe[_0x4388('0x15')][_0x4388('0x17')]);}logger['error'](_0x4388('0x11'),_0x1d38ba,_0x367cbe[_0x4388('0x15')][_0x4388('0x17')]);return _0x257afd(_0x367cbe[_0x4388('0x15')][_0x4388('0x17')]);}else{logger[_0x4388('0x10')](_0x4388('0x11'),_0x1d38ba,_0x4388('0x12'));_0x257afd(_0x367cbe[_0x4388('0x18')][_0x4388('0x17')]);}})['catch'](function(_0x5420f4){logger[_0x4388('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x1d38ba,_0x5420f4);_0x2c7864(_0x5420f4);});});} \ No newline at end of file +var _0xa8f0=['stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','request','info','ChatInternalMessage,\x20%s,\x20%s','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8f0,0x123));var _0x0a8f=function(_0x20ae3b,_0x23a21c){_0x20ae3b=_0x20ae3b-0x0;var _0x391475=_0xa8f0[_0x20ae3b];return _0x391475;};'use strict';var _=require(_0x0a8f('0x0'));var util=require(_0x0a8f('0x1'));var moment=require(_0x0a8f('0x2'));var BPromise=require('bluebird');var rs=require(_0x0a8f('0x3'));var fs=require('fs');var Redis=require(_0x0a8f('0x4'));var db=require(_0x0a8f('0x5'))['db'];var utils=require(_0x0a8f('0x6'));var logger=require(_0x0a8f('0x7'))(_0x0a8f('0x8'));var config=require(_0x0a8f('0x9'));var jayson=require(_0x0a8f('0xa'));var client=jayson[_0x0a8f('0xb')]['http']({'port':0x232a});config[_0x0a8f('0xc')]=_['defaults'](config[_0x0a8f('0xc')],{'host':_0x0a8f('0xd'),'port':0x18eb});var socket=require(_0x0a8f('0xe'))(new Redis(config[_0x0a8f('0xc')]));require(_0x0a8f('0xf'))['register'](socket);function respondWithRpcPromise(_0x4a416d,_0x443d5b,_0x115e68){return new BPromise(function(_0x359377,_0x1921e1){return client[_0x0a8f('0x10')](_0x4a416d,_0x115e68)['then'](function(_0x273a40){logger[_0x0a8f('0x11')](_0x0a8f('0x12'),_0x443d5b,'request\x20sent');logger['debug'](_0x0a8f('0x13'),_0x443d5b,_0x0a8f('0x14'),JSON[_0x0a8f('0x15')](_0x273a40));if(_0x273a40[_0x0a8f('0x16')]){if(_0x273a40[_0x0a8f('0x16')][_0x0a8f('0x17')]===0x1f4){logger[_0x0a8f('0x16')](_0x0a8f('0x12'),_0x443d5b,_0x273a40[_0x0a8f('0x16')]['message']);return _0x1921e1(_0x273a40[_0x0a8f('0x16')][_0x0a8f('0x18')]);}logger[_0x0a8f('0x16')](_0x0a8f('0x12'),_0x443d5b,_0x273a40[_0x0a8f('0x16')][_0x0a8f('0x18')]);return _0x359377(_0x273a40[_0x0a8f('0x16')][_0x0a8f('0x18')]);}else{logger['info'](_0x0a8f('0x12'),_0x443d5b,_0x0a8f('0x14'));_0x359377(_0x273a40[_0x0a8f('0x19')][_0x0a8f('0x18')]);}})['catch'](function(_0x57b00e){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x443d5b,_0x57b00e);_0x1921e1(_0x57b00e);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 9842b0f..64aa19e 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 _0xe150=['./chatInternalMessage.events','save','remove','update','emit','register','length','chatInternalMessage:'];(function(_0x151052,_0x5a1970){var _0x5ee83e=function(_0x570415){while(--_0x570415){_0x151052['push'](_0x151052['shift']());}};_0x5ee83e(++_0x5a1970);}(_0xe150,0x110));var _0x0e15=function(_0x2b4261,_0x2ea04e){_0x2b4261=_0x2b4261-0x0;var _0x3b65ba=_0xe150[_0x2b4261];return _0x3b65ba;};'use strict';var ChatInternalMessageEvents=require(_0x0e15('0x0'));var events=[_0x0e15('0x1'),_0x0e15('0x2'),_0x0e15('0x3')];function createListener(_0x3992ff,_0x5a7213){return function(_0xe69b41){_0x5a7213[_0x0e15('0x4')](_0x3992ff,_0xe69b41);};}function removeListener(_0x8541cd,_0x137470){return function(){ChatInternalMessageEvents['removeListener'](_0x8541cd,_0x137470);};}exports[_0x0e15('0x5')]=function(_0x4be5e2){for(var _0x873f0f=0x0,_0x4fdbf9=events[_0x0e15('0x6')];_0x873f0f<_0x4fdbf9;_0x873f0f++){var _0x18d0dc=events[_0x873f0f];var _0x31892e=createListener(_0x0e15('0x7')+_0x18d0dc,_0x4be5e2);ChatInternalMessageEvents['on'](_0x18d0dc,_0x31892e);}}; \ No newline at end of file +var _0xc67c=['./chatInternalMessage.events','remove','update','emit','removeListener','register','length','chatInternalMessage:'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xc67c,0xc0));var _0xcc67=function(_0x40fda4,_0x2e4574){_0x40fda4=_0x40fda4-0x0;var _0x5646b7=_0xc67c[_0x40fda4];return _0x5646b7;};'use strict';var ChatInternalMessageEvents=require(_0xcc67('0x0'));var events=['save',_0xcc67('0x1'),_0xcc67('0x2')];function createListener(_0x5b9f8a,_0x7ba146){return function(_0x3c31c0){_0x7ba146[_0xcc67('0x3')](_0x5b9f8a,_0x3c31c0);};}function removeListener(_0x18de18,_0x582155){return function(){ChatInternalMessageEvents[_0xcc67('0x4')](_0x18de18,_0x582155);};}exports[_0xcc67('0x5')]=function(_0x5e94ea){for(var _0x4892f4=0x0,_0xe5a4d9=events[_0xcc67('0x6')];_0x4892f4<_0xe5a4d9;_0x4892f4++){var _0x9265d=events[_0x4892f4];var _0x553c3d=createListener(_0xcc67('0x7')+_0x9265d,_0x5e94ea);ChatInternalMessageEvents['on'](_0x9265d,_0x553c3d);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 5ec2a64..d8dd95e 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 _0x8834=['delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','describe','/users','getUsers','put','/:id'];(function(_0xc99cc8,_0x111197){var _0x2f1c2c=function(_0x565505){while(--_0x565505){_0xc99cc8['push'](_0xc99cc8['shift']());}};_0x2f1c2c(++_0x111197);}(_0x8834,0xf3));var _0x4883=function(_0x47e06d,_0x11e3df){_0x47e06d=_0x47e06d-0x0;var _0x1a8597=_0x8834[_0x47e06d];return _0x1a8597;};'use strict';var multer=require('multer');var util=require(_0x4883('0x0'));var path=require('path');var timeout=require(_0x4883('0x1'));var express=require(_0x4883('0x2'));var router=express[_0x4883('0x3')]();var fs_extra=require(_0x4883('0x4'));var auth=require(_0x4883('0x5'));var interaction=require(_0x4883('0x6'));var config=require(_0x4883('0x7'));var controller=require(_0x4883('0x8'));router[_0x4883('0x9')]('/',auth[_0x4883('0xa')](),controller[_0x4883('0xb')]);router[_0x4883('0x9')]('/describe',auth[_0x4883('0xa')](),controller[_0x4883('0xc')]);router[_0x4883('0x9')](_0x4883('0xd'),auth[_0x4883('0xa')](),controller[_0x4883('0xe')]);router['get']('/:id',auth[_0x4883('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4883('0xf')](_0x4883('0x10'),controller['update']);router[_0x4883('0x11')](_0x4883('0x10'),auth[_0x4883('0xa')](),controller[_0x4883('0x12')]);module[_0x4883('0x13')]=router; \ No newline at end of file +var _0xdb57=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/users','isAuthenticated','/:id','show','post','put','delete','destroy','exports','multer','util'];(function(_0x36bb8c,_0x25fae8){var _0x43b5d5=function(_0x41e6a0){while(--_0x41e6a0){_0x36bb8c['push'](_0x36bb8c['shift']());}};_0x43b5d5(++_0x25fae8);}(_0xdb57,0x11c));var _0x7db5=function(_0x385cb1,_0x1a9f21){_0x385cb1=_0x385cb1-0x0;var _0x556f91=_0xdb57[_0x385cb1];return _0x556f91;};'use strict';var multer=require(_0x7db5('0x0'));var util=require(_0x7db5('0x1'));var path=require(_0x7db5('0x2'));var timeout=require(_0x7db5('0x3'));var express=require(_0x7db5('0x4'));var router=express['Router']();var fs_extra=require(_0x7db5('0x5'));var auth=require(_0x7db5('0x6'));var interaction=require(_0x7db5('0x7'));var config=require(_0x7db5('0x8'));var controller=require('./chatInternalMessage.controller');router[_0x7db5('0x9')]('/',auth['isAuthenticated'](),controller[_0x7db5('0xa')]);router[_0x7db5('0x9')](_0x7db5('0xb'),auth['isAuthenticated'](),controller[_0x7db5('0xc')]);router[_0x7db5('0x9')](_0x7db5('0xd'),auth[_0x7db5('0xe')](),controller['getUsers']);router[_0x7db5('0x9')](_0x7db5('0xf'),auth[_0x7db5('0xe')](),controller[_0x7db5('0x10')]);router[_0x7db5('0x11')]('/',auth[_0x7db5('0xe')](),controller['create']);router[_0x7db5('0x12')]('/:id',controller['update']);router[_0x7db5('0x13')]('/:id',auth[_0x7db5('0xe')](),controller[_0x7db5('0x14')]);module[_0x7db5('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index e05bce4..61d6ac0 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 _0x97e7=['STRING','sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x97e7,0x1a1));var _0x797e=function(_0x5438d7,_0x1d660e){_0x5438d7=_0x5438d7-0x0;var _0x8c3af2=_0x97e7[_0x5438d7];return _0x8c3af2;};'use strict';var Sequelize=require(_0x797e('0x0'));module[_0x797e('0x1')]={'body':{'type':Sequelize[_0x797e('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x797e('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x797e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x797e('0x4')]('in',_0x797e('0x5')),'defaultValue':_0x797e('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x797e('0x6')]},'providerName':{'type':Sequelize[_0x797e('0x7')]},'providerResponse':{'type':Sequelize[_0x797e('0x2')]}}; \ No newline at end of file +var _0xa699=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x2e6315,_0x54cd2e){var _0x52a81f=function(_0x8d84d5){while(--_0x8d84d5){_0x2e6315['push'](_0x2e6315['shift']());}};_0x52a81f(++_0x54cd2e);}(_0xa699,0x6b));var _0x9a69=function(_0x57cb4f,_0x541f57){_0x57cb4f=_0x57cb4f-0x0;var _0x29bb45=_0xa699[_0x57cb4f];return _0x29bb45;};'use strict';var Sequelize=require(_0x9a69('0x0'));module[_0x9a69('0x1')]={'body':{'type':Sequelize[_0x9a69('0x2')](_0x9a69('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9a69('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x9a69('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9a69('0x5')]('in',_0x9a69('0x6')),'defaultValue':_0x9a69('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x9a69('0x7')]},'providerName':{'type':Sequelize[_0x9a69('0x8')]},'providerResponse':{'type':Sequelize[_0x9a69('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index b660f6d..841db40 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 _0xb173=['body','describe','../../config/logger','chat-interactions','accept','chat','readAt','format','UserId','user','agent','get','ChatInteraction','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','socket.io-emitter','client','request','then','info','request\x20sent','debug','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','rawAttributes','type','key','map','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','ChatMessage','includeAll','include','rows','params','keys','find','create'];(function(_0x5b36bd,_0x4dfb36){var _0x1614fe=function(_0x559b7c){while(--_0x559b7c){_0x5b36bd['push'](_0x5b36bd['shift']());}};_0x1614fe(++_0x4dfb36);}(_0xb173,0xa5));var _0x3b17=function(_0x2f9cbc,_0x42cf1b){_0x2f9cbc=_0x2f9cbc-0x0;var _0xd91e8=_0xb173[_0x2f9cbc];return _0xd91e8;};'use strict';var emlformat=require(_0x3b17('0x0'));var rimraf=require(_0x3b17('0x1'));var zipdir=require(_0x3b17('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b17('0x3'));var moment=require('moment');var BPromise=require(_0x3b17('0x4'));var Mustache=require(_0x3b17('0x5'));var util=require(_0x3b17('0x6'));var path=require(_0x3b17('0x7'));var sox=require(_0x3b17('0x8'));var csv=require(_0x3b17('0x9'));var ejs=require(_0x3b17('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3b17('0xb'));var squel=require(_0x3b17('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3b17('0xd'));var toCsv=require(_0x3b17('0x9'));var querystring=require(_0x3b17('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3b17('0xf'));var hardwareService=require(_0x3b17('0x10'));var logger=require('../../config/logger')(_0x3b17('0x11'));var utils=require('../../config/utils');var config=require(_0x3b17('0x12'));var licenseUtil=require(_0x3b17('0x13'));var db=require('../../mysqldb')['db'];config[_0x3b17('0x14')]=_['defaults'](config[_0x3b17('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x3b17('0x15'))(new Redis(config[_0x3b17('0x14')]));require('./chatMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x3b17('0x16')]['http']({'port':0x232c});var client9002=jayson[_0x3b17('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2942ed,_0x1597e6,_0x2680bb,_0x19d433){return new BPromise(function(_0x526aab,_0x517f3b){var _0x493d57=_0x19d433||client;return _0x493d57[_0x3b17('0x17')](_0x2942ed,_0x2680bb)[_0x3b17('0x18')](function(_0x4d2465){logger[_0x3b17('0x19')]('ChatMessage,\x20%s,\x20%s',_0x1597e6,_0x3b17('0x1a'));logger[_0x3b17('0x1b')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x1597e6,'request\x20sent',JSON[_0x3b17('0x1c')](_0x4d2465));if(_0x4d2465[_0x3b17('0x1d')]){if(_0x4d2465['error'][_0x3b17('0x1e')]===0x1f4){logger[_0x3b17('0x1d')](_0x3b17('0x1f'),_0x1597e6,_0x4d2465['error']['message']);return _0x517f3b(_0x4d2465[_0x3b17('0x1d')][_0x3b17('0x20')]);}logger[_0x3b17('0x1d')](_0x3b17('0x1f'),_0x1597e6,_0x4d2465[_0x3b17('0x1d')]['message']);return _0x526aab(_0x4d2465[_0x3b17('0x1d')]['message']);}else{logger[_0x3b17('0x19')]('ChatMessage,\x20%s,\x20%s',_0x1597e6,'request\x20sent');_0x526aab(_0x4d2465[_0x3b17('0x21')][_0x3b17('0x20')]);}})[_0x3b17('0x22')](function(_0x3b2c42){logger[_0x3b17('0x1d')](_0x3b17('0x1f'),_0x1597e6,_0x3b2c42);_0x517f3b(_0x3b2c42);});});}function respondWithStatusCode(_0x31f27e,_0x15982b){_0x15982b=_0x15982b||0xcc;return function(_0x30a4c6){if(_0x30a4c6){return _0x31f27e[_0x3b17('0x23')](_0x15982b);}return _0x31f27e['status'](_0x15982b)['end']();};}function respondWithResult(_0x4e144d,_0x3466cf){_0x3466cf=_0x3466cf||0xc8;return function(_0x5e90eb){if(_0x5e90eb){return _0x4e144d[_0x3b17('0x24')](_0x3466cf)[_0x3b17('0x25')](_0x5e90eb);}};}function respondWithFilteredResult(_0xfa911e,_0x2796f0){return function(_0x1d7a40){if(_0x1d7a40){var _0x1b34bf=typeof _0x2796f0[_0x3b17('0x26')]===_0x3b17('0x27')&&typeof _0x2796f0[_0x3b17('0x28')]==='undefined';var _0x459815=_0x1d7a40[_0x3b17('0x29')];var _0x4746e1=_0x1b34bf?0x0:_0x2796f0[_0x3b17('0x26')];var _0x556dc6=_0x1b34bf?_0x1d7a40['count']:_0x2796f0['offset']+_0x2796f0[_0x3b17('0x28')];var _0x58cb5c;if(_0x556dc6>=_0x459815){_0x556dc6=_0x459815;_0x58cb5c=0xc8;}else{_0x58cb5c=0xce;}_0xfa911e['status'](_0x58cb5c);return _0xfa911e['set'](_0x3b17('0x2a'),_0x4746e1+'-'+_0x556dc6+'/'+_0x459815)[_0x3b17('0x25')](_0x1d7a40);}return null;};}function patchUpdates(_0x326a6e){return function(_0x257be2){try{jsonpatch[_0x3b17('0x2b')](_0x257be2,_0x326a6e,!![]);}catch(_0x140534){return BPromise[_0x3b17('0x2c')](_0x140534);}return _0x257be2[_0x3b17('0x2d')]();};}function saveUpdates(_0x14cc47,_0x2239f1){return function(_0xe4399d){if(_0xe4399d){return _0xe4399d[_0x3b17('0x2e')](_0x14cc47)[_0x3b17('0x18')](function(_0x2b0472){return _0x2b0472;});}return null;};}function removeEntity(_0x32f7c2,_0x46062d){return function(_0x4a30b3){if(_0x4a30b3){return _0x4a30b3[_0x3b17('0x2f')]()[_0x3b17('0x18')](function(){_0x32f7c2['status'](0xcc)[_0x3b17('0x30')]();});}};}function handleEntityNotFound(_0x539af2,_0x48f476){return function(_0x2295df){if(!_0x2295df){_0x539af2[_0x3b17('0x23')](0x194);}return _0x2295df;};}function handleError(_0x3e22b8,_0x3fee87){_0x3fee87=_0x3fee87||0x1f4;return function(_0x4c4038){logger['error'](_0x4c4038[_0x3b17('0x31')]);if(_0x4c4038[_0x3b17('0x32')]){delete _0x4c4038[_0x3b17('0x32')];}_0x3e22b8[_0x3b17('0x24')](_0x3fee87)[_0x3b17('0x33')](_0x4c4038);};}exports[_0x3b17('0x34')]=function(_0x16aa42,_0x389a6f){var _0x617e6e={},_0xd85b43={},_0x263925={'count':0x0,'rows':[]};var _0x2bfd17=_['map'](db['ChatMessage'][_0x3b17('0x35')],function(_0x1ba21e){return{'name':_0x1ba21e['fieldName'],'type':_0x1ba21e[_0x3b17('0x36')][_0x3b17('0x37')]};});_0xd85b43['model']=_[_0x3b17('0x38')](_0x2bfd17,_0x3b17('0x32'));_0xd85b43['query']=_['keys'](_0x16aa42[_0x3b17('0x39')]);_0xd85b43['filters']=_[_0x3b17('0x3a')](_0xd85b43[_0x3b17('0x3b')],_0xd85b43[_0x3b17('0x39')]);_0x617e6e['attributes']=_[_0x3b17('0x3a')](_0xd85b43[_0x3b17('0x3b')],qs[_0x3b17('0x3c')](_0x16aa42['query'][_0x3b17('0x3c')]));_0x617e6e[_0x3b17('0x3d')]=_0x617e6e[_0x3b17('0x3d')][_0x3b17('0x3e')]?_0x617e6e[_0x3b17('0x3d')]:_0xd85b43[_0x3b17('0x3b')];if(!_0x16aa42['query'][_0x3b17('0x3f')](_0x3b17('0x40'))){_0x617e6e['limit']=qs['limit'](_0x16aa42[_0x3b17('0x39')][_0x3b17('0x28')]);_0x617e6e[_0x3b17('0x26')]=qs[_0x3b17('0x26')](_0x16aa42['query'][_0x3b17('0x26')]);}_0x617e6e[_0x3b17('0x41')]=qs[_0x3b17('0x42')](_0x16aa42['query']['sort']);_0x617e6e[_0x3b17('0x43')]=qs['filters'](_[_0x3b17('0x44')](_0x16aa42[_0x3b17('0x39')],_0xd85b43[_0x3b17('0x45')]),_0x2bfd17);if(_0x16aa42[_0x3b17('0x39')][_0x3b17('0x46')]){_0x617e6e[_0x3b17('0x43')]=_[_0x3b17('0x47')](_0x617e6e['where'],{'$or':_[_0x3b17('0x38')](_0x2bfd17,function(_0x517c29){if(_0x517c29[_0x3b17('0x36')]!=='VIRTUAL'){var _0x59b13c={};_0x59b13c[_0x517c29['name']]={'$like':'%'+_0x16aa42[_0x3b17('0x39')][_0x3b17('0x46')]+'%'};return _0x59b13c;}})});}_0x617e6e=_[_0x3b17('0x47')]({},_0x617e6e,_0x16aa42[_0x3b17('0x48')]);var _0x3dda84={'where':_0x617e6e['where']};return db[_0x3b17('0x49')]['count'](_0x3dda84)['then'](function(_0x289691){_0x263925['count']=_0x289691;if(_0x16aa42[_0x3b17('0x39')][_0x3b17('0x4a')]){_0x617e6e[_0x3b17('0x4b')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x617e6e);})[_0x3b17('0x18')](function(_0x578acd){_0x263925[_0x3b17('0x4c')]=_0x578acd;return _0x263925;})[_0x3b17('0x18')](respondWithFilteredResult(_0x389a6f,_0x617e6e))[_0x3b17('0x22')](handleError(_0x389a6f,null));};exports['show']=function(_0x4ae912,_0x2a8219){var _0xcdf36a={'raw':!![],'where':{'id':_0x4ae912[_0x3b17('0x4d')]['id']}},_0x24b489={};_0x24b489[_0x3b17('0x3b')]=_[_0x3b17('0x4e')](db[_0x3b17('0x49')][_0x3b17('0x35')]);_0x24b489['query']=_[_0x3b17('0x4e')](_0x4ae912[_0x3b17('0x39')]);_0x24b489[_0x3b17('0x45')]=_[_0x3b17('0x3a')](_0x24b489[_0x3b17('0x3b')],_0x24b489[_0x3b17('0x39')]);_0xcdf36a[_0x3b17('0x3d')]=_[_0x3b17('0x3a')](_0x24b489[_0x3b17('0x3b')],qs['fields'](_0x4ae912[_0x3b17('0x39')][_0x3b17('0x3c')]));_0xcdf36a[_0x3b17('0x3d')]=_0xcdf36a[_0x3b17('0x3d')]['length']?_0xcdf36a[_0x3b17('0x3d')]:_0x24b489['model'];if(_0x4ae912['query']['includeAll']){_0xcdf36a[_0x3b17('0x4b')]=[{'all':!![]}];}_0xcdf36a=_[_0x3b17('0x47')]({},_0xcdf36a,_0x4ae912[_0x3b17('0x48')]);return db[_0x3b17('0x49')][_0x3b17('0x4f')](_0xcdf36a)[_0x3b17('0x18')](handleEntityNotFound(_0x2a8219,null))[_0x3b17('0x18')](respondWithResult(_0x2a8219,null))['catch'](handleError(_0x2a8219,null));};exports[_0x3b17('0x50')]=function(_0x435358,_0x44389b){return db[_0x3b17('0x49')]['create'](_0x435358['body'],{})[_0x3b17('0x18')](respondWithResult(_0x44389b,0xc9))[_0x3b17('0x22')](handleError(_0x44389b,null));};exports[_0x3b17('0x2e')]=function(_0x3901bb,_0x2602b3){if(_0x3901bb[_0x3b17('0x51')]['id']){delete _0x3901bb[_0x3b17('0x51')]['id'];}return db[_0x3b17('0x49')]['find']({'where':{'id':_0x3901bb[_0x3b17('0x4d')]['id']}})[_0x3b17('0x18')](handleEntityNotFound(_0x2602b3,null))[_0x3b17('0x18')](saveUpdates(_0x3901bb[_0x3b17('0x51')],null))[_0x3b17('0x18')](respondWithResult(_0x2602b3,null))['catch'](handleError(_0x2602b3,null));};exports[_0x3b17('0x2f')]=function(_0x36a973,_0x243d86){return db['ChatMessage'][_0x3b17('0x4f')]({'where':{'id':_0x36a973['params']['id']}})[_0x3b17('0x18')](handleEntityNotFound(_0x243d86,null))[_0x3b17('0x18')](removeEntity(_0x243d86,null))[_0x3b17('0x22')](handleError(_0x243d86,null));};exports['describe']=function(_0x5e70eb,_0x5b699e){return db[_0x3b17('0x49')][_0x3b17('0x52')]()[_0x3b17('0x18')](respondWithResult(_0x5b699e,null))['catch'](handleError(_0x5b699e,null));};var interaction_log=require(_0x3b17('0x53'))(_0x3b17('0x54'));exports[_0x3b17('0x55')]=function(_0x99a662,_0x151cea,_0x30892f){var _0x1bcc1f={'agent':{},'channel':_0x3b17('0x56')};if(_0x99a662[_0x3b17('0x51')]['id']){delete _0x99a662[_0x3b17('0x51')]['id'];}_0x99a662['body']['read']=!![];_0x99a662['body'][_0x3b17('0x57')]=moment()[_0x3b17('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x99a662[_0x3b17('0x51')][_0x3b17('0x59')]=_0x99a662[_0x3b17('0x51')][_0x3b17('0x59')]||_0x99a662[_0x3b17('0x5a')]['id'];_0x1bcc1f[_0x3b17('0x5b')]['id']=_0x99a662['body'][_0x3b17('0x59')];return db[_0x3b17('0x49')][_0x3b17('0x4f')]({'where':{'id':_0x99a662[_0x3b17('0x4d')]['id'],'UserId':null}})[_0x3b17('0x18')](handleEntityNotFound(_0x151cea,null))['then'](saveUpdates(_0x99a662['body'],null))[_0x3b17('0x18')](function(_0x130105){if(_0x130105){_0x1bcc1f[_0x3b17('0x20')]=_0x130105[_0x3b17('0x5c')]({'plain':!![]});return db[_0x3b17('0x5d')]['find']({'where':{'id':_0x130105['ChatInteractionId']}});}return null;})[_0x3b17('0x18')](handleEntityNotFound(_0x151cea,null))[_0x3b17('0x18')](function(_0x32086a){if(_0x32086a){return _0x32086a[_0x3b17('0x2e')]({'UserId':_0x99a662[_0x3b17('0x51')]['UserId'],'read1stAt':_['isNil'](_0x32086a[_0x3b17('0x5e')])?moment()[_0x3b17('0x58')](_0x3b17('0x5f')):undefined});}return null;})[_0x3b17('0x18')](function(_0x33c154){if(_0x33c154){_0x1bcc1f[_0x3b17('0x60')]=_0x33c154[_0x3b17('0x5c')]({'plain':!![]});interaction_log[_0x3b17('0x19')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x99a662[_0x3b17('0x5a')]['id'],_0x99a662[_0x3b17('0x5a')][_0x3b17('0x32')],_0x99a662[_0x3b17('0x5a')][_0x3b17('0x61')],_0x1bcc1f[_0x3b17('0x60')]['id'],_0x99a662[_0x3b17('0x51')]?JSON[_0x3b17('0x1c')](_0x99a662[_0x3b17('0x51')]):'null');return respondWithRpcPromise(_0x3b17('0x62'),_0x3b17('0x63'),_0x1bcc1f);}return null;})['then'](function(_0x1579e2){var _0x49cb35=_0x3b17('0x64')+_0x1579e2[_0x3b17('0x20')]['ContactId'];return db['sequelize'][_0x3b17('0x39')](_0x49cb35,{'type':db[_0x3b17('0x65')][_0x3b17('0x66')][_0x3b17('0x67')],'raw':!![]})[_0x3b17('0x18')](function(_0x238f27){return _0x238f27;});})['then'](function(_0xe1e3c8){if(_0xe1e3c8){_0x1bcc1f[_0x3b17('0x20')][_0x3b17('0x68')]=_0xe1e3c8[0x0];if(!_0x99a662[_0x3b17('0x51')]['UserId'])return;return db[_0x3b17('0x69')][_0x3b17('0x4f')]({'where':{'id':_0x99a662['body'][_0x3b17('0x59')],'role':_0x3b17('0x5b')},'attributes':['id',_0x3b17('0x32'),_0x3b17('0x6a'),_0x3b17('0x6b'),_0x3b17('0x6c')],'raw':!![]});}return null;})[_0x3b17('0x18')](function(_0x375a3f){if(!_0x375a3f)return null;_0x1bcc1f[_0x3b17('0x20')][_0x3b17('0x5b')]=_0x375a3f;return _0x1bcc1f;})[_0x3b17('0x18')](function(_0x308aa7){if(_0x308aa7){if(_0x99a662[_0x3b17('0x51')][_0x3b17('0x6d')]){_0x1bcc1f[_0x3b17('0x20')][_0x3b17('0x6e')]=util[_0x3b17('0x58')](_0x3b17('0x6f'),_0x99a662[_0x3b17('0x5a')][_0x3b17('0x32')]);_0x1bcc1f[_0x3b17('0x20')][_0x3b17('0x70')]=_0x1bcc1f[_0x3b17('0x70')];_0x1bcc1f['message'][_0x3b17('0x71')]=_0x1bcc1f[_0x3b17('0x70')];_0x1bcc1f[_0x3b17('0x20')][_0x3b17('0x72')]='accept';return respondWithRpcPromise(_0x3b17('0x73'),_0x3b17('0x73'),{'event':'acceptmessage','message':_[_0x3b17('0x47')](_0x1bcc1f[_0x3b17('0x20')],JSON[_0x3b17('0x74')](_0x1bcc1f[_0x3b17('0x60')][_0x3b17('0x75')]))},client9002)['then'](function(){return _0x1bcc1f;});}return _0x1bcc1f;}return null;})[_0x3b17('0x18')](respondWithResult(_0x151cea,null))[_0x3b17('0x22')](handleError(_0x151cea,null));};var interaction_log=require(_0x3b17('0x53'))(_0x3b17('0x54'));exports[_0x3b17('0x2c')]=function(_0x1ff6f7,_0x4b2dac,_0x41239b){var _0x985908={'agent':{},'channel':_0x3b17('0x56')};if(_0x1ff6f7[_0x3b17('0x51')]['id']){delete _0x1ff6f7['body']['id'];}_0x1ff6f7['body'][_0x3b17('0x59')]=_0x1ff6f7[_0x3b17('0x51')]['UserId']||_0x1ff6f7[_0x3b17('0x5a')]['id'];_0x985908['agent']['id']=_0x1ff6f7[_0x3b17('0x51')]['UserId'];return db[_0x3b17('0x49')][_0x3b17('0x4f')]({'where':{'id':_0x1ff6f7[_0x3b17('0x4d')]['id'],'UserId':null}})[_0x3b17('0x18')](handleEntityNotFound(_0x4b2dac,null))[_0x3b17('0x18')](function(_0x56e139){if(_0x56e139){_0x985908[_0x3b17('0x20')]=_0x56e139[_0x3b17('0x5c')]({'plain':!![]});return db[_0x3b17('0x5d')]['find']({'where':{'id':_0x56e139['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4b2dac,null))[_0x3b17('0x18')](function(_0x265a6a){if(_0x265a6a){_0x985908['interaction']=_0x265a6a['get']({'plain':!![]});interaction_log[_0x3b17('0x19')](_0x3b17('0x76'),_0x1ff6f7[_0x3b17('0x5a')]['id'],_0x1ff6f7['user'][_0x3b17('0x32')],_0x1ff6f7[_0x3b17('0x5a')][_0x3b17('0x61')],_0x985908['interaction']['id'],_0x1ff6f7['body']?JSON['stringify'](_0x1ff6f7[_0x3b17('0x51')]):_0x3b17('0x77'));return respondWithRpcPromise(_0x3b17('0x78'),_0x3b17('0x79'),_0x985908);}return null;})[_0x3b17('0x18')](function(_0x1422dc){var _0x553922=_0x3b17('0x64')+_0x1422dc['message'][_0x3b17('0x7a')];return db['sequelize'][_0x3b17('0x39')](_0x553922,{'type':db[_0x3b17('0x65')][_0x3b17('0x66')][_0x3b17('0x67')],'raw':!![]})['then'](function(_0x967338){return _0x967338;});})['then'](function(_0x1f6a7c){if(_0x1f6a7c){_0x985908[_0x3b17('0x20')][_0x3b17('0x68')]=_0x1f6a7c[0x0];if(!_0x1ff6f7[_0x3b17('0x51')][_0x3b17('0x59')])return;return db['User'][_0x3b17('0x4f')]({'where':{'id':_0x1ff6f7[_0x3b17('0x51')]['UserId'],'role':_0x3b17('0x5b')},'attributes':['id',_0x3b17('0x32'),_0x3b17('0x6a'),_0x3b17('0x6b'),_0x3b17('0x6c')],'raw':!![]});}return null;})['then'](function(_0x5a1fd3){if(!_0x5a1fd3)return null;_0x985908[_0x3b17('0x20')][_0x3b17('0x5b')]=_0x5a1fd3;return _0x985908;})[_0x3b17('0x18')](function(_0x50a461){if(_0x50a461){_0x50a461['message'][_0x3b17('0x6e')]=util[_0x3b17('0x58')]('SIP/%s',_0x1ff6f7[_0x3b17('0x5a')][_0x3b17('0x32')]);_0x50a461[_0x3b17('0x20')][_0x3b17('0x70')]=_0x985908[_0x3b17('0x70')];_0x50a461[_0x3b17('0x20')][_0x3b17('0x71')]=_0x985908['channel'];_0x50a461[_0x3b17('0x20')][_0x3b17('0x72')]='reject';respondWithRpcPromise(_0x3b17('0x73'),_0x3b17('0x73'),{'event':'rejectmessage','message':_[_0x3b17('0x47')](_0x985908[_0x3b17('0x20')],JSON[_0x3b17('0x74')](_0x985908[_0x3b17('0x60')][_0x3b17('0x75')]))},client9002);return _0x985908;}return null;})[_0x3b17('0x18')](respondWithResult(_0x4b2dac,null))[_0x3b17('0x22')](handleError(_0x4b2dac,null));}; \ No newline at end of file +var _0x000f=['event','EventManager','acceptmessage','parse','../../config/logger','chat-interactions','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','User','fullname','internal','rejectmessage','formData','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','offset','undefined','limit','count','Content-Range','json','reject','save','then','status','name','index','map','rawAttributes','fieldName','type','key','keys','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','pick','filter','where','VIRTUAL','merge','options','ChatMessage','includeAll','include','findAll','show','params','create','update','body','destroy','describe','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','ChatInteraction','find','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','AcceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','agent','email','manual','interface','channel','motionChannel'];(function(_0x1c470d,_0x81d66b){var _0x12141b=function(_0x45bfd3){while(--_0x45bfd3){_0x1c470d['push'](_0x1c470d['shift']());}};_0x12141b(++_0x81d66b);}(_0x000f,0x96));var _0xf000=function(_0x44cc29,_0xa2faf8){_0x44cc29=_0x44cc29-0x0;var _0x596c86=_0x000f[_0x44cc29];return _0x596c86;};'use strict';var emlformat=require(_0xf000('0x0'));var rimraf=require(_0xf000('0x1'));var zipdir=require(_0xf000('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf000('0x3'));var moment=require(_0xf000('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf000('0x5'));var path=require(_0xf000('0x6'));var sox=require('sox');var csv=require(_0xf000('0x7'));var ejs=require(_0xf000('0x8'));var fs=require('fs');var fs_extra=require(_0xf000('0x9'));var _=require(_0xf000('0xa'));var squel=require(_0xf000('0xb'));var crypto=require(_0xf000('0xc'));var jsforce=require(_0xf000('0xd'));var deskjs=require(_0xf000('0xe'));var toCsv=require(_0xf000('0x7'));var querystring=require('querystring');var Papa=require(_0xf000('0xf'));var Redis=require(_0xf000('0x10'));var authService=require(_0xf000('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf000('0x12'));var hardwareService=require(_0xf000('0x13'));var logger=require('../../config/logger')(_0xf000('0x14'));var utils=require(_0xf000('0x15'));var config=require(_0xf000('0x16'));var licenseUtil=require(_0xf000('0x17'));var db=require(_0xf000('0x18'))['db'];config[_0xf000('0x19')]=_[_0xf000('0x1a')](config['redis'],{'host':_0xf000('0x1b'),'port':0x18eb});var socket=require(_0xf000('0x1c'))(new Redis(config[_0xf000('0x19')]));require(_0xf000('0x1d'))[_0xf000('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf000('0x1f')][_0xf000('0x20')]({'port':0x232c});var client9002=jayson[_0xf000('0x1f')][_0xf000('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2e7430,_0x58bcc5,_0x56e69a,_0x5ba1fb){return new BPromise(function(_0x2534c0,_0x5aa921){var _0x5a2282=_0x5ba1fb||client;return _0x5a2282['request'](_0x2e7430,_0x56e69a)['then'](function(_0x37085a){logger[_0xf000('0x21')](_0xf000('0x22'),_0x58bcc5,_0xf000('0x23'));logger[_0xf000('0x24')](_0xf000('0x25'),_0x58bcc5,_0xf000('0x23'),JSON['stringify'](_0x37085a));if(_0x37085a[_0xf000('0x26')]){if(_0x37085a['error'][_0xf000('0x27')]===0x1f4){logger[_0xf000('0x26')]('ChatMessage,\x20%s,\x20%s',_0x58bcc5,_0x37085a[_0xf000('0x26')][_0xf000('0x28')]);return _0x5aa921(_0x37085a[_0xf000('0x26')]['message']);}logger[_0xf000('0x26')](_0xf000('0x22'),_0x58bcc5,_0x37085a[_0xf000('0x26')]['message']);return _0x2534c0(_0x37085a[_0xf000('0x26')][_0xf000('0x28')]);}else{logger[_0xf000('0x21')]('ChatMessage,\x20%s,\x20%s',_0x58bcc5,_0xf000('0x23'));_0x2534c0(_0x37085a[_0xf000('0x29')][_0xf000('0x28')]);}})[_0xf000('0x2a')](function(_0x1bae7a){logger['error'](_0xf000('0x22'),_0x58bcc5,_0x1bae7a);_0x5aa921(_0x1bae7a);});});}function respondWithStatusCode(_0x122a3f,_0x1ab66c){_0x1ab66c=_0x1ab66c||0xcc;return function(_0x5bd22c){if(_0x5bd22c){return _0x122a3f[_0xf000('0x2b')](_0x1ab66c);}return _0x122a3f['status'](_0x1ab66c)[_0xf000('0x2c')]();};}function respondWithResult(_0x21a617,_0xbf9bd5){_0xbf9bd5=_0xbf9bd5||0xc8;return function(_0x2775aa){if(_0x2775aa){return _0x21a617['status'](_0xbf9bd5)['json'](_0x2775aa);}};}function respondWithFilteredResult(_0x494c8c,_0x4103e5){return function(_0x43203b){if(_0x43203b){var _0x128d65=typeof _0x4103e5[_0xf000('0x2d')]===_0xf000('0x2e')&&typeof _0x4103e5[_0xf000('0x2f')]===_0xf000('0x2e');var _0x29f6c1=_0x43203b[_0xf000('0x30')];var _0x3df14b=_0x128d65?0x0:_0x4103e5[_0xf000('0x2d')];var _0x8b8a81=_0x128d65?_0x43203b[_0xf000('0x30')]:_0x4103e5[_0xf000('0x2d')]+_0x4103e5['limit'];var _0x4404d3;if(_0x8b8a81>=_0x29f6c1){_0x8b8a81=_0x29f6c1;_0x4404d3=0xc8;}else{_0x4404d3=0xce;}_0x494c8c['status'](_0x4404d3);return _0x494c8c['set'](_0xf000('0x31'),_0x3df14b+'-'+_0x8b8a81+'/'+_0x29f6c1)[_0xf000('0x32')](_0x43203b);}return null;};}function patchUpdates(_0x53880e){return function(_0x29491e){try{jsonpatch['apply'](_0x29491e,_0x53880e,!![]);}catch(_0x241679){return BPromise[_0xf000('0x33')](_0x241679);}return _0x29491e[_0xf000('0x34')]();};}function saveUpdates(_0x1292f6,_0x210911){return function(_0x1268f6){if(_0x1268f6){return _0x1268f6['update'](_0x1292f6)['then'](function(_0xc087c8){return _0xc087c8;});}return null;};}function removeEntity(_0x33d850,_0x1e2cec){return function(_0x2e0846){if(_0x2e0846){return _0x2e0846['destroy']()[_0xf000('0x35')](function(){_0x33d850[_0xf000('0x36')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf30048,_0x321faa){return function(_0x3642c7){if(!_0x3642c7){_0xf30048[_0xf000('0x2b')](0x194);}return _0x3642c7;};}function handleError(_0x18e105,_0x2605dc){_0x2605dc=_0x2605dc||0x1f4;return function(_0xca0a79){logger[_0xf000('0x26')](_0xca0a79['stack']);if(_0xca0a79[_0xf000('0x37')]){delete _0xca0a79[_0xf000('0x37')];}_0x18e105[_0xf000('0x36')](_0x2605dc)['send'](_0xca0a79);};}exports[_0xf000('0x38')]=function(_0x4063c6,_0x4288b1){var _0x5d278b={},_0x5e9a15={},_0x7df097={'count':0x0,'rows':[]};var _0x4dfb2e=_[_0xf000('0x39')](db['ChatMessage'][_0xf000('0x3a')],function(_0x32dc52){return{'name':_0x32dc52[_0xf000('0x3b')],'type':_0x32dc52[_0xf000('0x3c')][_0xf000('0x3d')]};});_0x5e9a15['model']=_[_0xf000('0x39')](_0x4dfb2e,_0xf000('0x37'));_0x5e9a15['query']=_[_0xf000('0x3e')](_0x4063c6['query']);_0x5e9a15[_0xf000('0x3f')]=_['intersection'](_0x5e9a15[_0xf000('0x40')],_0x5e9a15[_0xf000('0x41')]);_0x5d278b[_0xf000('0x42')]=_[_0xf000('0x43')](_0x5e9a15[_0xf000('0x40')],qs[_0xf000('0x44')](_0x4063c6[_0xf000('0x41')][_0xf000('0x44')]));_0x5d278b[_0xf000('0x42')]=_0x5d278b['attributes'][_0xf000('0x45')]?_0x5d278b[_0xf000('0x42')]:_0x5e9a15[_0xf000('0x40')];if(!_0x4063c6[_0xf000('0x41')][_0xf000('0x46')](_0xf000('0x47'))){_0x5d278b[_0xf000('0x2f')]=qs[_0xf000('0x2f')](_0x4063c6[_0xf000('0x41')][_0xf000('0x2f')]);_0x5d278b[_0xf000('0x2d')]=qs['offset'](_0x4063c6['query'][_0xf000('0x2d')]);}_0x5d278b['order']=qs['sort'](_0x4063c6[_0xf000('0x41')]['sort']);_0x5d278b['where']=qs[_0xf000('0x3f')](_[_0xf000('0x48')](_0x4063c6['query'],_0x5e9a15[_0xf000('0x3f')]),_0x4dfb2e);if(_0x4063c6[_0xf000('0x41')][_0xf000('0x49')]){_0x5d278b[_0xf000('0x4a')]=_['merge'](_0x5d278b['where'],{'$or':_[_0xf000('0x39')](_0x4dfb2e,function(_0x5092bb){if(_0x5092bb['type']!==_0xf000('0x4b')){var _0x305061={};_0x305061[_0x5092bb['name']]={'$like':'%'+_0x4063c6[_0xf000('0x41')][_0xf000('0x49')]+'%'};return _0x305061;}})});}_0x5d278b=_[_0xf000('0x4c')]({},_0x5d278b,_0x4063c6[_0xf000('0x4d')]);var _0x3121e2={'where':_0x5d278b[_0xf000('0x4a')]};return db[_0xf000('0x4e')][_0xf000('0x30')](_0x3121e2)[_0xf000('0x35')](function(_0x514581){_0x7df097[_0xf000('0x30')]=_0x514581;if(_0x4063c6[_0xf000('0x41')][_0xf000('0x4f')]){_0x5d278b[_0xf000('0x50')]=[{'all':!![]}];}return db['ChatMessage'][_0xf000('0x51')](_0x5d278b);})[_0xf000('0x35')](function(_0x492787){_0x7df097['rows']=_0x492787;return _0x7df097;})['then'](respondWithFilteredResult(_0x4288b1,_0x5d278b))[_0xf000('0x2a')](handleError(_0x4288b1,null));};exports[_0xf000('0x52')]=function(_0x2d5e7b,_0x28c9d7){var _0x1b6ec8={'raw':!![],'where':{'id':_0x2d5e7b[_0xf000('0x53')]['id']}},_0x5207de={};_0x5207de[_0xf000('0x40')]=_['keys'](db['ChatMessage'][_0xf000('0x3a')]);_0x5207de[_0xf000('0x41')]=_[_0xf000('0x3e')](_0x2d5e7b[_0xf000('0x41')]);_0x5207de[_0xf000('0x3f')]=_[_0xf000('0x43')](_0x5207de['model'],_0x5207de[_0xf000('0x41')]);_0x1b6ec8['attributes']=_[_0xf000('0x43')](_0x5207de[_0xf000('0x40')],qs[_0xf000('0x44')](_0x2d5e7b['query'][_0xf000('0x44')]));_0x1b6ec8['attributes']=_0x1b6ec8[_0xf000('0x42')]['length']?_0x1b6ec8[_0xf000('0x42')]:_0x5207de[_0xf000('0x40')];if(_0x2d5e7b[_0xf000('0x41')][_0xf000('0x4f')]){_0x1b6ec8[_0xf000('0x50')]=[{'all':!![]}];}_0x1b6ec8=_[_0xf000('0x4c')]({},_0x1b6ec8,_0x2d5e7b[_0xf000('0x4d')]);return db[_0xf000('0x4e')]['find'](_0x1b6ec8)['then'](handleEntityNotFound(_0x28c9d7,null))['then'](respondWithResult(_0x28c9d7,null))[_0xf000('0x2a')](handleError(_0x28c9d7,null));};exports[_0xf000('0x54')]=function(_0x4bcfb3,_0x2f36ef){return db[_0xf000('0x4e')][_0xf000('0x54')](_0x4bcfb3['body'],{})[_0xf000('0x35')](respondWithResult(_0x2f36ef,0xc9))[_0xf000('0x2a')](handleError(_0x2f36ef,null));};exports[_0xf000('0x55')]=function(_0x509e87,_0x33f7fd){if(_0x509e87[_0xf000('0x56')]['id']){delete _0x509e87[_0xf000('0x56')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x509e87[_0xf000('0x53')]['id']}})[_0xf000('0x35')](handleEntityNotFound(_0x33f7fd,null))['then'](saveUpdates(_0x509e87[_0xf000('0x56')],null))['then'](respondWithResult(_0x33f7fd,null))['catch'](handleError(_0x33f7fd,null));};exports[_0xf000('0x57')]=function(_0x209279,_0x3ef390){return db[_0xf000('0x4e')]['find']({'where':{'id':_0x209279[_0xf000('0x53')]['id']}})[_0xf000('0x35')](handleEntityNotFound(_0x3ef390,null))[_0xf000('0x35')](removeEntity(_0x3ef390,null))['catch'](handleError(_0x3ef390,null));};exports[_0xf000('0x58')]=function(_0x1b55e4,_0x4a8fb9){return db[_0xf000('0x4e')][_0xf000('0x58')]()['then'](respondWithResult(_0x4a8fb9,null))[_0xf000('0x2a')](handleError(_0x4a8fb9,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0xf000('0x59')]=function(_0x56fa3b,_0x3645ba,_0x3688a3){var _0x88197e={'agent':{},'channel':_0xf000('0x5a')};if(_0x56fa3b['body']['id']){delete _0x56fa3b[_0xf000('0x56')]['id'];}_0x56fa3b['body'][_0xf000('0x5b')]=!![];_0x56fa3b[_0xf000('0x56')]['readAt']=moment()[_0xf000('0x5c')](_0xf000('0x5d'));_0x56fa3b[_0xf000('0x56')][_0xf000('0x5e')]=_0x56fa3b[_0xf000('0x56')]['UserId']||_0x56fa3b['user']['id'];_0x88197e['agent']['id']=_0x56fa3b[_0xf000('0x56')][_0xf000('0x5e')];return db[_0xf000('0x4e')]['find']({'where':{'id':_0x56fa3b[_0xf000('0x53')]['id'],'UserId':null}})[_0xf000('0x35')](handleEntityNotFound(_0x3645ba,null))[_0xf000('0x35')](saveUpdates(_0x56fa3b[_0xf000('0x56')],null))[_0xf000('0x35')](function(_0x4a05ee){if(_0x4a05ee){_0x88197e['message']=_0x4a05ee[_0xf000('0x5f')]({'plain':!![]});return db[_0xf000('0x60')][_0xf000('0x61')]({'where':{'id':_0x4a05ee[_0xf000('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x3645ba,null))['then'](function(_0x5a8683){if(_0x5a8683){return _0x5a8683['update']({'UserId':_0x56fa3b[_0xf000('0x56')][_0xf000('0x5e')],'read1stAt':_[_0xf000('0x63')](_0x5a8683[_0xf000('0x64')])?moment()[_0xf000('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xf000('0x35')](function(_0x2a3d29){if(_0x2a3d29){_0x88197e[_0xf000('0x65')]=_0x2a3d29[_0xf000('0x5f')]({'plain':!![]});interaction_log[_0xf000('0x21')](_0xf000('0x66'),_0x56fa3b[_0xf000('0x67')]['id'],_0x56fa3b[_0xf000('0x67')][_0xf000('0x37')],_0x56fa3b[_0xf000('0x67')][_0xf000('0x68')],_0x88197e[_0xf000('0x65')]['id'],_0x56fa3b[_0xf000('0x56')]?JSON[_0xf000('0x69')](_0x56fa3b[_0xf000('0x56')]):'null');return respondWithRpcPromise(_0xf000('0x6a'),'acceptMessage',_0x88197e);}return null;})[_0xf000('0x35')](function(_0x4eedc7){var _0x52780a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4eedc7['message'][_0xf000('0x6b')];return db[_0xf000('0x6c')][_0xf000('0x41')](_0x52780a,{'type':db['Sequelize'][_0xf000('0x6d')][_0xf000('0x6e')],'raw':!![]})[_0xf000('0x35')](function(_0x26fc5f){return _0x26fc5f;});})[_0xf000('0x35')](function(_0x4e553e){if(_0x4e553e){_0x88197e[_0xf000('0x28')][_0xf000('0x6f')]=_0x4e553e[0x0];if(!_0x56fa3b[_0xf000('0x56')][_0xf000('0x5e')])return;return db['User'][_0xf000('0x61')]({'where':{'id':_0x56fa3b[_0xf000('0x56')]['UserId'],'role':_0xf000('0x70')},'attributes':['id',_0xf000('0x37'),'fullname',_0xf000('0x71'),'internal'],'raw':!![]});}return null;})[_0xf000('0x35')](function(_0x5e92e8){if(!_0x5e92e8)return null;_0x88197e['message']['agent']=_0x5e92e8;return _0x88197e;})['then'](function(_0x10ad55){if(_0x10ad55){if(_0x56fa3b[_0xf000('0x56')][_0xf000('0x72')]){_0x88197e[_0xf000('0x28')][_0xf000('0x73')]=util[_0xf000('0x5c')]('SIP/%s',_0x56fa3b[_0xf000('0x67')]['name']);_0x88197e[_0xf000('0x28')][_0xf000('0x74')]=_0x88197e[_0xf000('0x74')];_0x88197e[_0xf000('0x28')][_0xf000('0x75')]=_0x88197e[_0xf000('0x74')];_0x88197e[_0xf000('0x28')][_0xf000('0x76')]=_0xf000('0x59');return respondWithRpcPromise(_0xf000('0x77'),_0xf000('0x77'),{'event':_0xf000('0x78'),'message':_[_0xf000('0x4c')](_0x88197e[_0xf000('0x28')],JSON[_0xf000('0x79')](_0x88197e[_0xf000('0x65')]['formData']))},client9002)[_0xf000('0x35')](function(){return _0x88197e;});}return _0x88197e;}return null;})[_0xf000('0x35')](respondWithResult(_0x3645ba,null))['catch'](handleError(_0x3645ba,null));};var interaction_log=require(_0xf000('0x7a'))(_0xf000('0x7b'));exports[_0xf000('0x33')]=function(_0x51094b,_0xfac72e,_0x2c220e){var _0x4cc7e1={'agent':{},'channel':_0xf000('0x5a')};if(_0x51094b['body']['id']){delete _0x51094b['body']['id'];}_0x51094b[_0xf000('0x56')][_0xf000('0x5e')]=_0x51094b[_0xf000('0x56')][_0xf000('0x5e')]||_0x51094b[_0xf000('0x67')]['id'];_0x4cc7e1['agent']['id']=_0x51094b[_0xf000('0x56')]['UserId'];return db[_0xf000('0x4e')][_0xf000('0x61')]({'where':{'id':_0x51094b[_0xf000('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xfac72e,null))[_0xf000('0x35')](function(_0x275812){if(_0x275812){_0x4cc7e1[_0xf000('0x28')]=_0x275812['get']({'plain':!![]});return db[_0xf000('0x60')][_0xf000('0x61')]({'where':{'id':_0x275812[_0xf000('0x62')]}});}return null;})[_0xf000('0x35')](handleEntityNotFound(_0xfac72e,null))[_0xf000('0x35')](function(_0x5b52a3){if(_0x5b52a3){_0x4cc7e1['interaction']=_0x5b52a3[_0xf000('0x5f')]({'plain':!![]});interaction_log[_0xf000('0x21')](_0xf000('0x7c'),_0x51094b['user']['id'],_0x51094b['user'][_0xf000('0x37')],_0x51094b[_0xf000('0x67')][_0xf000('0x68')],_0x4cc7e1['interaction']['id'],_0x51094b[_0xf000('0x56')]?JSON[_0xf000('0x69')](_0x51094b[_0xf000('0x56')]):_0xf000('0x7d'));return respondWithRpcPromise(_0xf000('0x7e'),'rejectMessage',_0x4cc7e1);}return null;})['then'](function(_0x7edb64){var _0x253d1d=_0xf000('0x7f')+_0x7edb64['message']['ContactId'];return db[_0xf000('0x6c')]['query'](_0x253d1d,{'type':db[_0xf000('0x80')][_0xf000('0x6d')][_0xf000('0x6e')],'raw':!![]})[_0xf000('0x35')](function(_0x4947bc){return _0x4947bc;});})[_0xf000('0x35')](function(_0x53b741){if(_0x53b741){_0x4cc7e1[_0xf000('0x28')][_0xf000('0x6f')]=_0x53b741[0x0];if(!_0x51094b['body'][_0xf000('0x5e')])return;return db[_0xf000('0x81')][_0xf000('0x61')]({'where':{'id':_0x51094b['body'][_0xf000('0x5e')],'role':_0xf000('0x70')},'attributes':['id',_0xf000('0x37'),_0xf000('0x82'),_0xf000('0x71'),_0xf000('0x83')],'raw':!![]});}return null;})['then'](function(_0x1abb1f){if(!_0x1abb1f)return null;_0x4cc7e1[_0xf000('0x28')][_0xf000('0x70')]=_0x1abb1f;return _0x4cc7e1;})[_0xf000('0x35')](function(_0x7dd6a5){if(_0x7dd6a5){_0x7dd6a5['message'][_0xf000('0x73')]=util[_0xf000('0x5c')]('SIP/%s',_0x51094b[_0xf000('0x67')][_0xf000('0x37')]);_0x7dd6a5[_0xf000('0x28')][_0xf000('0x74')]=_0x4cc7e1[_0xf000('0x74')];_0x7dd6a5['message'][_0xf000('0x75')]=_0x4cc7e1[_0xf000('0x74')];_0x7dd6a5[_0xf000('0x28')][_0xf000('0x76')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0xf000('0x84'),'message':_[_0xf000('0x4c')](_0x4cc7e1[_0xf000('0x28')],JSON['parse'](_0x4cc7e1['interaction'][_0xf000('0x85')]))},client9002);return _0x4cc7e1;}return null;})[_0xf000('0x35')](respondWithResult(_0xfac72e,null))[_0xf000('0x2a')](handleError(_0xfac72e,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 49c3375..4690d32 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 _0x628c=['save','remove','emit','hasOwnProperty','hook','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x257888,_0x1a7140){var _0x1e5534=function(_0x48a0f4){while(--_0x48a0f4){_0x257888['push'](_0x257888['shift']());}};_0x1e5534(++_0x1a7140);}(_0x628c,0x14d));var _0xc628=function(_0x54381d,_0x247b2c){_0x54381d=_0x54381d-0x0;var _0x5308a7=_0x628c[_0x54381d];return _0x5308a7;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xc628('0x0'))['db'][_0xc628('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xc628('0x2')](0x0);var events={'afterCreate':_0xc628('0x3'),'afterUpdate':'update','afterDestroy':_0xc628('0x4')};function emitEvent(_0x272b92){return function(_0xa54671,_0x416f5b,_0x5e0c2b){ChatMessageEvents[_0xc628('0x5')](_0x272b92+':'+_0xa54671['id'],_0xa54671);ChatMessageEvents['emit'](_0x272b92,_0xa54671);_0x5e0c2b(null);};}for(var e in events){if(events[_0xc628('0x6')](e)){var event=events[e];ChatMessage[_0xc628('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x2f04=['ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3f8965,_0x3c80b9){var _0xcdf5c9=function(_0x57f205){while(--_0x57f205){_0x3f8965['push'](_0x3f8965['shift']());}};_0xcdf5c9(++_0x3c80b9);}(_0x2f04,0xae));var _0x42f0=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x2f04[_0x46698a];return _0x356db0;};'use strict';var EventEmitter=require(_0x42f0('0x0'));var ChatMessage=require(_0x42f0('0x1'))['db'][_0x42f0('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x42f0('0x3')](0x0);var events={'afterCreate':_0x42f0('0x4'),'afterUpdate':_0x42f0('0x5'),'afterDestroy':_0x42f0('0x6')};function emitEvent(_0x117fa4){return function(_0x1af40d,_0x3402f5,_0x26a453){ChatMessageEvents[_0x42f0('0x7')](_0x117fa4+':'+_0x1af40d['id'],_0x1af40d);ChatMessageEvents[_0x42f0('0x7')](_0x117fa4,_0x1af40d);_0x26a453(null);};}for(var e in events){if(events[_0x42f0('0x8')](e)){var event=events[e];ChatMessage[_0x42f0('0x9')](e,emitEvent(event));}}module[_0x42f0('0xa')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index ded8b0a..b2f0cee 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 _0xb93e=['api','moment','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','isNil','UserId','findOne','ChatInteractionId','update','createdAt','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0xc9bc0f,_0x12e2ac){var _0x4aacbc=function(_0x518b76){while(--_0x518b76){_0xc9bc0f['push'](_0xc9bc0f['shift']());}};_0x4aacbc(++_0x12e2ac);}(_0xb93e,0x10c));var _0xeb93=function(_0x208d4e,_0x42c222){_0x208d4e=_0x208d4e-0x0;var _0x598629=_0xb93e[_0x208d4e];return _0x598629;};'use strict';var _=require('lodash');var util=require(_0xeb93('0x0'));var logger=require(_0xeb93('0x1'))(_0xeb93('0x2'));var moment=require(_0xeb93('0x3'));var BPromise=require('bluebird');var rp=require(_0xeb93('0x4'));var fs=require('fs');var path=require(_0xeb93('0x5'));var rimraf=require(_0xeb93('0x6'));var config=require(_0xeb93('0x7'));var attributes=require(_0xeb93('0x8'));module[_0xeb93('0x9')]=function(_0xc6b01,_0x4fcea5){return _0xc6b01[_0xeb93('0xa')](_0xeb93('0xb'),attributes,{'tableName':_0xeb93('0xc'),'paranoid':![],'indexes':[{'name':_0xeb93('0xd'),'fields':[_0xeb93('0xe')],'type':_0xeb93('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x29d651,_0x34e459,_0x11cab6){var _0x4cdd2e=_0xc6b01['models'];var _0x11b4f1=_0x29d651[_0xeb93('0x10')]({'plain':!![]});if(_0x11b4f1[_0xeb93('0x11')][_0xeb93('0x12')]()==='in'||_0x11b4f1[_0xeb93('0x11')][_0xeb93('0x12')]()==='out'&&!_0x11b4f1['secret']&&!_[_0xeb93('0x13')](_0x11b4f1[_0xeb93('0x14')])){_0x4cdd2e['ChatInteraction'][_0xeb93('0x15')]({'where':{'id':_0x11b4f1[_0xeb93('0x16')]}})['then'](function(_0xd41b58){if(_0xd41b58){_0xd41b58[_0xeb93('0x17')]({'lastMsgAt':_0x11b4f1[_0xeb93('0x18')],'lastMsgDirection':_0x11b4f1[_0xeb93('0x11')][_0xeb93('0x12')]()});}})['catch'](function(_0x99d2bd){console['error'](_0x99d2bd);});}_0x11cab6();}},'charset':_0xeb93('0x19'),'collate':_0xeb93('0x1a')});}; \ No newline at end of file +var _0x88ca=['secret','isNil','UserId','ChatInteraction','findOne','then','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','ChatMessage','chat_messages','body','FULLTEXT','get','direction','toLowerCase'];(function(_0x4cfe90,_0x3da8fb){var _0x13591e=function(_0x3f1281){while(--_0x3f1281){_0x4cfe90['push'](_0x4cfe90['shift']());}};_0x13591e(++_0x3da8fb);}(_0x88ca,0xa6));var _0xa88c=function(_0x12d812,_0x496bb7){_0x12d812=_0x12d812-0x0;var _0x3711ab=_0x88ca[_0x12d812];return _0x3711ab;};'use strict';var _=require(_0xa88c('0x0'));var util=require('util');var logger=require(_0xa88c('0x1'))(_0xa88c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa88c('0x3'));var fs=require('fs');var path=require(_0xa88c('0x4'));var rimraf=require(_0xa88c('0x5'));var config=require(_0xa88c('0x6'));var attributes=require(_0xa88c('0x7'));module[_0xa88c('0x8')]=function(_0x290278,_0x4f8693){return _0x290278['define'](_0xa88c('0x9'),attributes,{'tableName':_0xa88c('0xa'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xa88c('0xb')],'type':_0xa88c('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x39b104,_0x27c15a,_0x539138){var _0x449230=_0x290278['models'];var _0x3e63da=_0x39b104[_0xa88c('0xd')]({'plain':!![]});if(_0x3e63da[_0xa88c('0xe')][_0xa88c('0xf')]()==='in'||_0x3e63da[_0xa88c('0xe')][_0xa88c('0xf')]()==='out'&&!_0x3e63da[_0xa88c('0x10')]&&!_[_0xa88c('0x11')](_0x3e63da[_0xa88c('0x12')])){_0x449230[_0xa88c('0x13')][_0xa88c('0x14')]({'where':{'id':_0x3e63da['ChatInteractionId']}})[_0xa88c('0x15')](function(_0x555826){if(_0x555826){_0x555826[_0xa88c('0x16')]({'lastMsgAt':_0x3e63da['createdAt'],'lastMsgDirection':_0x3e63da['direction'][_0xa88c('0xf')]()});}})[_0xa88c('0x17')](function(_0x30ddb4){console['error'](_0x30ddb4);});}_0x539138();}},'charset':_0xa88c('0x18'),'collate':_0xa88c('0x19')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index b47c58e..767f655 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 _0xa51f=['http','redis','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateChatMessage','ChatMessage','body','options','raw','stringify','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x5756f8,_0x22b6d5){var _0x3bb749=function(_0x332204){while(--_0x332204){_0x5756f8['push'](_0x5756f8['shift']());}};_0x3bb749(++_0x22b6d5);}(_0xa51f,0x1d9));var _0xfa51=function(_0x5b086e,_0x5eb6c0){_0x5b086e=_0x5b086e-0x0;var _0x3e2c2c=_0xa51f[_0x5b086e];return _0x3e2c2c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa51('0x0'));var BPromise=require('bluebird');var rs=require(_0xfa51('0x1'));var fs=require('fs');var Redis=require(_0xfa51('0x2'));var db=require(_0xfa51('0x3'))['db'];var utils=require(_0xfa51('0x4'));var logger=require('../../config/logger')(_0xfa51('0x5'));var config=require(_0xfa51('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfa51('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0xfa51('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xfa51('0x9'))(new Redis(config[_0xfa51('0x8')]));require(_0xfa51('0xa'))[_0xfa51('0xb')](socket);function respondWithRpcPromise(_0x312b40,_0xa77167,_0x4265c0){return new BPromise(function(_0x1e88a6,_0x3efc9d){return client[_0xfa51('0xc')](_0x312b40,_0x4265c0)[_0xfa51('0xd')](function(_0xd2d8b0){logger[_0xfa51('0xe')](_0xfa51('0xf'),_0xa77167,_0xfa51('0x10'));logger[_0xfa51('0x11')](_0xfa51('0x12'),_0xa77167,_0xfa51('0x10'),JSON['stringify'](_0xd2d8b0));if(_0xd2d8b0[_0xfa51('0x13')]){if(_0xd2d8b0['error'][_0xfa51('0x14')]===0x1f4){logger[_0xfa51('0x13')](_0xfa51('0xf'),_0xa77167,_0xd2d8b0[_0xfa51('0x13')][_0xfa51('0x15')]);return _0x3efc9d(_0xd2d8b0[_0xfa51('0x13')][_0xfa51('0x15')]);}logger[_0xfa51('0x13')]('ChatMessage,\x20%s,\x20%s',_0xa77167,_0xd2d8b0[_0xfa51('0x13')][_0xfa51('0x15')]);return _0x1e88a6(_0xd2d8b0[_0xfa51('0x13')][_0xfa51('0x15')]);}else{logger[_0xfa51('0xe')]('ChatMessage,\x20%s,\x20%s',_0xa77167,_0xfa51('0x10'));_0x1e88a6(_0xd2d8b0[_0xfa51('0x16')]['message']);}})['catch'](function(_0x3cc802){logger[_0xfa51('0x13')]('ChatMessage,\x20%s,\x20%s',_0xa77167,_0x3cc802);_0x3efc9d(_0x3cc802);});});}exports[_0xfa51('0x17')]=function(_0x218cb1){var _0xeb1822=this;return new Promise(function(_0x12b063,_0x3cac04){return db[_0xfa51('0x18')]['create'](_0x218cb1[_0xfa51('0x19')],{'raw':_0x218cb1['options']?_0x218cb1[_0xfa51('0x1a')][_0xfa51('0x1b')]===undefined?!![]:![]:!![]})[_0xfa51('0xd')](function(_0x45a5ba){logger['info'](_0xfa51('0x17'),_0x218cb1);logger[_0xfa51('0x11')]('CreateChatMessage',_0x218cb1,JSON[_0xfa51('0x1c')](_0x45a5ba));_0x12b063(_0x45a5ba);})[_0xfa51('0x1d')](function(_0x437ec6){logger['error'](_0xfa51('0x17'),_0x437ec6[_0xfa51('0x15')],_0x218cb1);_0x3cac04(_0xeb1822['error'](0x1f4,_0x437ec6[_0xfa51('0x15')]));});});}; \ No newline at end of file +var _0x17ea=['info','request\x20sent','result','catch','ChatMessage','create','options','raw','CreateChatMessage','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./chatMessage.socket','then','ChatMessage,\x20%s,\x20%s','debug','stringify','error','code','message'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x17ea,0x169));var _0xa17e=function(_0x4f2391,_0x31ae5d){_0x4f2391=_0x4f2391-0x0;var _0x273cbb=_0x17ea[_0x4f2391];return _0x273cbb;};'use strict';var _=require(_0xa17e('0x0'));var util=require(_0xa17e('0x1'));var moment=require('moment');var BPromise=require(_0xa17e('0x2'));var rs=require(_0xa17e('0x3'));var fs=require('fs');var Redis=require(_0xa17e('0x4'));var db=require(_0xa17e('0x5'))['db'];var utils=require(_0xa17e('0x6'));var logger=require(_0xa17e('0x7'))(_0xa17e('0x8'));var config=require(_0xa17e('0x9'));var jayson=require(_0xa17e('0xa'));var client=jayson[_0xa17e('0xb')]['http']({'port':0x232a});config[_0xa17e('0xc')]=_[_0xa17e('0xd')](config[_0xa17e('0xc')],{'host':_0xa17e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa17e('0xc')]));require(_0xa17e('0xf'))['register'](socket);function respondWithRpcPromise(_0xc54626,_0x2eba2e,_0x15664c){return new BPromise(function(_0x2ab747,_0x5b8dbb){return client['request'](_0xc54626,_0x15664c)[_0xa17e('0x10')](function(_0x236dc1){logger['info'](_0xa17e('0x11'),_0x2eba2e,'request\x20sent');logger[_0xa17e('0x12')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x2eba2e,'request\x20sent',JSON[_0xa17e('0x13')](_0x236dc1));if(_0x236dc1[_0xa17e('0x14')]){if(_0x236dc1['error'][_0xa17e('0x15')]===0x1f4){logger[_0xa17e('0x14')](_0xa17e('0x11'),_0x2eba2e,_0x236dc1[_0xa17e('0x14')][_0xa17e('0x16')]);return _0x5b8dbb(_0x236dc1[_0xa17e('0x14')]['message']);}logger[_0xa17e('0x14')](_0xa17e('0x11'),_0x2eba2e,_0x236dc1[_0xa17e('0x14')][_0xa17e('0x16')]);return _0x2ab747(_0x236dc1['error']['message']);}else{logger[_0xa17e('0x17')](_0xa17e('0x11'),_0x2eba2e,_0xa17e('0x18'));_0x2ab747(_0x236dc1[_0xa17e('0x19')]['message']);}})[_0xa17e('0x1a')](function(_0x2cf412){logger[_0xa17e('0x14')](_0xa17e('0x11'),_0x2eba2e,_0x2cf412);_0x5b8dbb(_0x2cf412);});});}exports['CreateChatMessage']=function(_0x1b6e4c){var _0x27e4a8=this;return new Promise(function(_0x2adc51,_0x61b97e){return db[_0xa17e('0x1b')][_0xa17e('0x1c')](_0x1b6e4c['body'],{'raw':_0x1b6e4c[_0xa17e('0x1d')]?_0x1b6e4c[_0xa17e('0x1d')][_0xa17e('0x1e')]===undefined?!![]:![]:!![]})[_0xa17e('0x10')](function(_0x294510){logger[_0xa17e('0x17')](_0xa17e('0x1f'),_0x1b6e4c);logger[_0xa17e('0x12')]('CreateChatMessage',_0x1b6e4c,JSON['stringify'](_0x294510));_0x2adc51(_0x294510);})[_0xa17e('0x1a')](function(_0x2ed8fd){logger['error'](_0xa17e('0x1f'),_0x2ed8fd['message'],_0x1b6e4c);_0x61b97e(_0x27e4a8[_0xa17e('0x14')](0x1f4,_0x2ed8fd[_0xa17e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 2816fbd..ed66531 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 _0x8ca9=['length','chatMessage:','./chatMessage.events','save','remove','update','register'];(function(_0x37e6dc,_0x5ba4b2){var _0x4138c5=function(_0x586804){while(--_0x586804){_0x37e6dc['push'](_0x37e6dc['shift']());}};_0x4138c5(++_0x5ba4b2);}(_0x8ca9,0x9c));var _0x98ca=function(_0x1bc507,_0x32b5fd){_0x1bc507=_0x1bc507-0x0;var _0x1c110a=_0x8ca9[_0x1bc507];return _0x1c110a;};'use strict';var ChatMessageEvents=require(_0x98ca('0x0'));var events=[_0x98ca('0x1'),_0x98ca('0x2'),_0x98ca('0x3')];function createListener(_0x3d9153,_0x22047f){return function(_0xe479d6){_0x22047f['emit'](_0x3d9153,_0xe479d6);};}function removeListener(_0x4c230f,_0x142793){return function(){ChatMessageEvents['removeListener'](_0x4c230f,_0x142793);};}exports[_0x98ca('0x4')]=function(_0x48415d){for(var _0x219619=0x0,_0xca4097=events[_0x98ca('0x5')];_0x219619<_0xca4097;_0x219619++){var _0x2852a0=events[_0x219619];var _0x323c95=createListener(_0x98ca('0x6')+_0x2852a0,_0x48415d);ChatMessageEvents['on'](_0x2852a0,_0x323c95);}}; \ No newline at end of file +var _0x06f4=['register','chatMessage:','./chatMessage.events','save','update','emit','removeListener'];(function(_0x5118f8,_0x43ff98){var _0xb466ec=function(_0x1c6d97){while(--_0x1c6d97){_0x5118f8['push'](_0x5118f8['shift']());}};_0xb466ec(++_0x43ff98);}(_0x06f4,0x136));var _0x406f=function(_0x3b6880,_0x4fe877){_0x3b6880=_0x3b6880-0x0;var _0x1f598d=_0x06f4[_0x3b6880];return _0x1f598d;};'use strict';var ChatMessageEvents=require(_0x406f('0x0'));var events=[_0x406f('0x1'),'remove',_0x406f('0x2')];function createListener(_0x276a15,_0x58cd7d){return function(_0x5cab5e){_0x58cd7d[_0x406f('0x3')](_0x276a15,_0x5cab5e);};}function removeListener(_0x5ed32f,_0x32abfd){return function(){ChatMessageEvents[_0x406f('0x4')](_0x5ed32f,_0x32abfd);};}exports[_0x406f('0x5')]=function(_0x32b2bd){for(var _0x59821c=0x0,_0x1d2886=events['length'];_0x59821c<_0x1d2886;_0x59821c++){var _0x1afec4=events[_0x59821c];var _0x1c39ce=createListener(_0x406f('0x6')+_0x1afec4,_0x32b2bd);ChatMessageEvents['on'](_0x1afec4,_0x1c39ce);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index ff9660f..6b350d0 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 _0x33f3=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','/:id','show','post','chatmessage:create','update','put','/:id/accept','accept','/:id/reject','reject','delete','multer'];(function(_0x1c57d6,_0x4a7534){var _0x36d17d=function(_0x599805){while(--_0x599805){_0x1c57d6['push'](_0x1c57d6['shift']());}};_0x36d17d(++_0x4a7534);}(_0x33f3,0x1da));var _0x333f=function(_0x4127eb,_0x53b05f){_0x4127eb=_0x4127eb-0x0;var _0x76a6ea=_0x33f3[_0x4127eb];return _0x76a6ea;};'use strict';var multer=require(_0x333f('0x0'));var util=require(_0x333f('0x1'));var path=require(_0x333f('0x2'));var timeout=require(_0x333f('0x3'));var express=require(_0x333f('0x4'));var router=express[_0x333f('0x5')]();var fs_extra=require(_0x333f('0x6'));var auth=require(_0x333f('0x7'));var interaction=require(_0x333f('0x8'));var config=require(_0x333f('0x9'));var controller=require(_0x333f('0xa'));router[_0x333f('0xb')]('/',auth[_0x333f('0xc')](),controller['index']);router[_0x333f('0xb')](_0x333f('0xd'),auth[_0x333f('0xc')](),controller['describe']);router[_0x333f('0xb')](_0x333f('0xe'),auth[_0x333f('0xc')](),controller[_0x333f('0xf')]);router[_0x333f('0x10')]('/',auth['isAuthenticated'](),interaction['tracked']('chat',_0x333f('0x11')),controller['create']);router['put'](_0x333f('0xe'),controller[_0x333f('0x12')]);router[_0x333f('0x13')](_0x333f('0x14'),auth['isAuthenticated'](),controller[_0x333f('0x15')]);router[_0x333f('0x13')](_0x333f('0x16'),auth[_0x333f('0xc')](),controller[_0x333f('0x17')]);router[_0x333f('0x18')](_0x333f('0xe'),auth[_0x333f('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb75e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','describe','show','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x55c3f6,_0x1c6629){var _0x40099b=function(_0x22d967){while(--_0x22d967){_0x55c3f6['push'](_0x55c3f6['shift']());}};_0x40099b(++_0x1c6629);}(_0xb75e,0x162));var _0xeb75=function(_0x4ec472,_0x48de88){_0x4ec472=_0x4ec472-0x0;var _0x348c0d=_0xb75e[_0x4ec472];return _0x348c0d;};'use strict';var multer=require(_0xeb75('0x0'));var util=require(_0xeb75('0x1'));var path=require(_0xeb75('0x2'));var timeout=require(_0xeb75('0x3'));var express=require(_0xeb75('0x4'));var router=express[_0xeb75('0x5')]();var fs_extra=require(_0xeb75('0x6'));var auth=require(_0xeb75('0x7'));var interaction=require(_0xeb75('0x8'));var config=require(_0xeb75('0x9'));var controller=require(_0xeb75('0xa'));router[_0xeb75('0xb')]('/',auth[_0xeb75('0xc')](),controller['index']);router['get'](_0xeb75('0xd'),auth['isAuthenticated'](),controller[_0xeb75('0xe')]);router[_0xeb75('0xb')]('/:id',auth[_0xeb75('0xc')](),controller[_0xeb75('0xf')]);router[_0xeb75('0x10')]('/',auth[_0xeb75('0xc')](),interaction[_0xeb75('0x11')](_0xeb75('0x12'),_0xeb75('0x13')),controller[_0xeb75('0x14')]);router[_0xeb75('0x15')]('/:id',controller[_0xeb75('0x16')]);router[_0xeb75('0x15')](_0xeb75('0x17'),auth['isAuthenticated'](),controller['accept']);router['put'](_0xeb75('0x18'),auth[_0xeb75('0xc')](),controller[_0xeb75('0x19')]);router[_0xeb75('0x1a')](_0xeb75('0x1b'),auth[_0xeb75('0xc')](),controller[_0xeb75('0x1c')]);module[_0xeb75('0x1d')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 1b46c82..d11a7c2 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 _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x93ef32,_0xeeec1){var _0x528b6c=function(_0x3dc977){while(--_0x3dc977){_0x93ef32['push'](_0x93ef32['shift']());}};_0x528b6c(++_0xeeec1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x575de5,_0x179f6a){_0x575de5=_0x575de5-0x0;var _0x1615db=_0x5f2f[_0x575de5];return _0x1615db;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x5f66=['medium','TEXT','exports'];(function(_0x1bfb2f,_0x1042c3){var _0x392184=function(_0x40b1c3){while(--_0x40b1c3){_0x1bfb2f['push'](_0x1bfb2f['shift']());}};_0x392184(++_0x1042c3);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index c00849c..dd8fb01 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x5f0064,_0x53573a){var _0x41a295=function(_0x2672bc){while(--_0x2672bc){_0x5f0064['push'](_0x5f0064['shift']());}};_0x41a295(++_0x53573a);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x2e2992,_0x1f19d8){var _0x2a0a6b=function(_0x2e97d6){while(--_0x2e97d6){_0x2e2992['push'](_0x2e2992['shift']());}};_0x2a0a6b(++_0x1f19d8);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index a668411..d347b59 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 _0x2e4a=['save','update','emit','hasOwnProperty','hook','events','../../mysqldb','ChatOfflineMessage','setMaxListeners'];(function(_0x3a4e51,_0x280273){var _0x5e7e1f=function(_0x2757d3){while(--_0x2757d3){_0x3a4e51['push'](_0x3a4e51['shift']());}};_0x5e7e1f(++_0x280273);}(_0x2e4a,0x12e));var _0xa2e4=function(_0xf9b156,_0x28be72){_0xf9b156=_0xf9b156-0x0;var _0x444e2e=_0x2e4a[_0xf9b156];return _0x444e2e;};'use strict';var EventEmitter=require(_0xa2e4('0x0'));var ChatOfflineMessage=require(_0xa2e4('0x1'))['db'][_0xa2e4('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xa2e4('0x3')](0x0);var events={'afterCreate':_0xa2e4('0x4'),'afterUpdate':_0xa2e4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x47f347){return function(_0x2a0e91,_0x1ad61f,_0x2f61c0){ChatOfflineMessageEvents['emit'](_0x47f347+':'+_0x2a0e91['id'],_0x2a0e91);ChatOfflineMessageEvents[_0xa2e4('0x6')](_0x47f347,_0x2a0e91);_0x2f61c0(null);};}for(var e in events){if(events[_0xa2e4('0x7')](e)){var event=events[e];ChatOfflineMessage[_0xa2e4('0x8')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x1d5f=['../../mysqldb','ChatOfflineMessage','save','remove','emit','exports'];(function(_0x4f240d,_0x13a89a){var _0x5b92cc=function(_0x33fb91){while(--_0x33fb91){_0x4f240d['push'](_0x4f240d['shift']());}};_0x5b92cc(++_0x13a89a);}(_0x1d5f,0x8a));var _0xf1d5=function(_0x46e523,_0xe6fccb){_0x46e523=_0x46e523-0x0;var _0x5da0ee=_0x1d5f[_0x46e523];return _0x5da0ee;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0xf1d5('0x0'))['db'][_0xf1d5('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf1d5('0x2'),'afterUpdate':'update','afterDestroy':_0xf1d5('0x3')};function emitEvent(_0x2cbfcb){return function(_0x216d93,_0x84e726,_0x270ab9){ChatOfflineMessageEvents[_0xf1d5('0x4')](_0x2cbfcb+':'+_0x216d93['id'],_0x216d93);ChatOfflineMessageEvents[_0xf1d5('0x4')](_0x2cbfcb,_0x216d93);_0x270ab9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0xf1d5('0x5')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 8e7b3f2..6b5d80d 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 _0x8b6d=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x903228,_0x42c429){var _0xcec81d=function(_0x4da97a){while(--_0x4da97a){_0x903228['push'](_0x903228['shift']());}};_0xcec81d(++_0x42c429);}(_0x8b6d,0x135));var _0xd8b6=function(_0x1aa5d9,_0x90efec){_0x1aa5d9=_0x1aa5d9-0x0;var _0x207b5e=_0x8b6d[_0x1aa5d9];return _0x207b5e;};'use strict';var attributes=require(_0xd8b6('0x0'));module[_0xd8b6('0x1')]=function(_0x490bc6){return _0x490bc6[_0xd8b6('0x2')](_0xd8b6('0x3'),attributes,{'tableName':_0xd8b6('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd8b6('0x5'),'collate':_0xd8b6('0x6')});}; \ No newline at end of file +var _0xd0bc=['ChatOfflineMessage','utf8mb4','exports'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xd0bc,0x16a));var _0xcd0b=function(_0x332998,_0x2d99c7){_0x332998=_0x332998-0x0;var _0x460be7=_0xd0bc[_0x332998];return _0x460be7;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0xcd0b('0x0')]=function(_0x3a23c7){return _0x3a23c7['define'](_0xcd0b('0x1'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcd0b('0x2'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index a97bcca..fce7711 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 _0x61b8=['catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result'];(function(_0x3708d2,_0x3fe636){var _0x3fb0ee=function(_0x4af20e){while(--_0x4af20e){_0x3708d2['push'](_0x3708d2['shift']());}};_0x3fb0ee(++_0x3fe636);}(_0x61b8,0x169));var _0x861b=function(_0x12e24d,_0x59ce3d){_0x12e24d=_0x12e24d-0x0;var _0xabbeaf=_0x61b8[_0x12e24d];return _0xabbeaf;};'use strict';var _=require(_0x861b('0x0'));var util=require(_0x861b('0x1'));var moment=require(_0x861b('0x2'));var BPromise=require('bluebird');var rs=require(_0x861b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x861b('0x4'));var logger=require(_0x861b('0x5'))(_0x861b('0x6'));var config=require('../../config/environment');var jayson=require(_0x861b('0x7'));var client=jayson[_0x861b('0x8')][_0x861b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x143f58,_0x186952,_0xe2504a){return new BPromise(function(_0x436722,_0x41a4c5){return client[_0x861b('0xa')](_0x143f58,_0xe2504a)[_0x861b('0xb')](function(_0x45c39d){logger['info'](_0x861b('0xc'),_0x186952,_0x861b('0xd'));logger[_0x861b('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x186952,_0x861b('0xd'),JSON['stringify'](_0x45c39d));if(_0x45c39d[_0x861b('0xf')]){if(_0x45c39d[_0x861b('0xf')]['code']===0x1f4){logger[_0x861b('0xf')](_0x861b('0xc'),_0x186952,_0x45c39d[_0x861b('0xf')][_0x861b('0x10')]);return _0x41a4c5(_0x45c39d[_0x861b('0xf')][_0x861b('0x10')]);}logger[_0x861b('0xf')](_0x861b('0xc'),_0x186952,_0x45c39d[_0x861b('0xf')][_0x861b('0x10')]);return _0x436722(_0x45c39d[_0x861b('0xf')][_0x861b('0x10')]);}else{logger[_0x861b('0x11')](_0x861b('0xc'),_0x186952,_0x861b('0xd'));_0x436722(_0x45c39d[_0x861b('0x12')]['message']);}})[_0x861b('0x13')](function(_0x5a4542){logger['error'](_0x861b('0xc'),_0x186952,_0x5a4542);_0x41a4c5(_0x5a4542);});});} \ No newline at end of file +var _0xf794=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message','request\x20sent','result','moment','bluebird','randomstring','../../mysqldb'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0xf794,0x150));var _0x4f79=function(_0x2b4ea6,_0x3fe9ba){_0x2b4ea6=_0x2b4ea6-0x0;var _0x553783=_0xf794[_0x2b4ea6];return _0x553783;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4f79('0x0'));var BPromise=require(_0x4f79('0x1'));var rs=require(_0x4f79('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f79('0x3'))['db'];var utils=require(_0x4f79('0x4'));var logger=require(_0x4f79('0x5'))(_0x4f79('0x6'));var config=require(_0x4f79('0x7'));var jayson=require(_0x4f79('0x8'));var client=jayson['client'][_0x4f79('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16bb36,_0x49d46e,_0x50a969){return new BPromise(function(_0x5ba9ea,_0x3000be){return client['request'](_0x16bb36,_0x50a969)[_0x4f79('0xa')](function(_0x3c11de){logger[_0x4f79('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x49d46e,'request\x20sent');logger[_0x4f79('0xc')](_0x4f79('0xd'),_0x49d46e,'request\x20sent',JSON[_0x4f79('0xe')](_0x3c11de));if(_0x3c11de['error']){if(_0x3c11de['error']['code']===0x1f4){logger[_0x4f79('0xf')](_0x4f79('0x10'),_0x49d46e,_0x3c11de[_0x4f79('0xf')][_0x4f79('0x11')]);return _0x3000be(_0x3c11de[_0x4f79('0xf')][_0x4f79('0x11')]);}logger[_0x4f79('0xf')](_0x4f79('0x10'),_0x49d46e,_0x3c11de['error'][_0x4f79('0x11')]);return _0x5ba9ea(_0x3c11de[_0x4f79('0xf')][_0x4f79('0x11')]);}else{logger[_0x4f79('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x49d46e,_0x4f79('0x12'));_0x5ba9ea(_0x3c11de[_0x4f79('0x13')]['message']);}})['catch'](function(_0x1d36d1){logger[_0x4f79('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x49d46e,_0x1d36d1);_0x3000be(_0x1d36d1);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index d83515e..e707a6f 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 _0x323d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','get','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x47d6b6,_0x3acf52){var _0x26855d=function(_0x3f237c){while(--_0x3f237c){_0x47d6b6['push'](_0x47d6b6['shift']());}};_0x26855d(++_0x3acf52);}(_0x323d,0x1b5));var _0xd323=function(_0x18e5c7,_0x392a80){_0x18e5c7=_0x18e5c7-0x0;var _0x55f2f0=_0x323d[_0x18e5c7];return _0x55f2f0;};'use strict';var multer=require(_0xd323('0x0'));var util=require(_0xd323('0x1'));var path=require(_0xd323('0x2'));var timeout=require(_0xd323('0x3'));var express=require(_0xd323('0x4'));var router=express[_0xd323('0x5')]();var fs_extra=require(_0xd323('0x6'));var auth=require(_0xd323('0x7'));var interaction=require(_0xd323('0x8'));var config=require(_0xd323('0x9'));var controller=require(_0xd323('0xa'));router['get']('/',auth[_0xd323('0xb')](),controller[_0xd323('0xc')]);router[_0xd323('0xd')]('/describe',auth[_0xd323('0xb')](),controller['describe']);router[_0xd323('0xd')](_0xd323('0xe'),auth[_0xd323('0xb')](),controller[_0xd323('0xf')]);router[_0xd323('0x10')]('/',auth['isAuthenticated'](),controller[_0xd323('0x11')]);router['put'](_0xd323('0xe'),auth[_0xd323('0xb')](),controller[_0xd323('0x12')]);router['delete'](_0xd323('0xe'),auth[_0xd323('0xb')](),controller[_0xd323('0x13')]);module[_0xd323('0x14')]=router; \ No newline at end of file +var _0x85c6=['destroy','util','path','connect-timeout','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','create','update','delete'];(function(_0xcb2975,_0x22dbee){var _0x2f1afc=function(_0x3710a){while(--_0x3710a){_0xcb2975['push'](_0xcb2975['shift']());}};_0x2f1afc(++_0x22dbee);}(_0x85c6,0x1d2));var _0x685c=function(_0x3555dc,_0x560e24){_0x3555dc=_0x3555dc-0x0;var _0x5a6699=_0x85c6[_0x3555dc];return _0x5a6699;};'use strict';var multer=require('multer');var util=require(_0x685c('0x0'));var path=require(_0x685c('0x1'));var timeout=require(_0x685c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x685c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x685c('0x4'));var controller=require(_0x685c('0x5'));router[_0x685c('0x6')]('/',auth[_0x685c('0x7')](),controller['index']);router[_0x685c('0x6')](_0x685c('0x8'),auth[_0x685c('0x7')](),controller[_0x685c('0x9')]);router['get'](_0x685c('0xa'),auth[_0x685c('0x7')](),controller['show']);router['post']('/',auth[_0x685c('0x7')](),controller[_0x685c('0xb')]);router['put'](_0x685c('0xa'),auth[_0x685c('0x7')](),controller[_0x685c('0xc')]);router[_0x685c('0xd')](_0x685c('0xa'),auth[_0x685c('0x7')](),controller[_0x685c('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index f3820ec..405082d 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 _0x92e8=['ENUM','timeout','mouseOver','INTEGER','STRING'];(function(_0x2c1b71,_0x53f47f){var _0x248df6=function(_0x22e858){while(--_0x22e858){_0x2c1b71['push'](_0x2c1b71['shift']());}};_0x248df6(++_0x53f47f);}(_0x92e8,0x144));var _0x892e=function(_0x55fb83,_0x1d3856){_0x55fb83=_0x55fb83-0x0;var _0x59a87a=_0x92e8[_0x55fb83];return _0x59a87a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x892e('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x892e('0x1')]('mouseOver',_0x892e('0x2')),'defaultValue':_0x892e('0x3')},'selector':{'type':Sequelize[_0x892e('0x0')]},'timeout':{'type':Sequelize[_0x892e('0x4')]}}; \ No newline at end of file +var _0x79d9=['mouseOver','sequelize','exports','STRING','timeout'];(function(_0x40877f,_0x46b5b8){var _0x30b8bb=function(_0x2d3f9e){while(--_0x2d3f9e){_0x40877f['push'](_0x40877f['shift']());}};_0x30b8bb(++_0x46b5b8);}(_0x79d9,0x146));var _0x979d=function(_0x139e12,_0x59e8ef){_0x139e12=_0x139e12-0x0;var _0xe50df9=_0x79d9[_0x139e12];return _0xe50df9;};'use strict';var Sequelize=require(_0x979d('0x0'));module[_0x979d('0x1')]={'name':{'type':Sequelize[_0x979d('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0x979d('0x3')),'defaultValue':_0x979d('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 188b33b..7f3db7d 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 _0x8c79=['save','update','then','error','stack','name','send','show','params','model','keys','ChatProactiveAction','query','intersection','attributes','fields','options','create','body','find','catch','eml-format','request-promise','bluebird','mustache','path','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','count','offset','set','Content-Range','reject'];(function(_0x3a03be,_0x597b9a){var _0xd572b8=function(_0xdd1ff9){while(--_0xdd1ff9){_0x3a03be['push'](_0x3a03be['shift']());}};_0xd572b8(++_0x597b9a);}(_0x8c79,0xa8));var _0x98c7=function(_0x3dbbb7,_0x9f32b8){_0x3dbbb7=_0x3dbbb7-0x0;var _0x1cf503=_0x8c79[_0x3dbbb7];return _0x1cf503;};'use strict';var emlformat=require(_0x98c7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x98c7('0x1'));var moment=require('moment');var BPromise=require(_0x98c7('0x2'));var Mustache=require(_0x98c7('0x3'));var util=require('util');var path=require(_0x98c7('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x98c7('0x5'));var _=require('lodash');var squel=require(_0x98c7('0x6'));var crypto=require(_0x98c7('0x7'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x98c7('0x8'));var Papa=require(_0x98c7('0x9'));var Redis=require(_0x98c7('0xa'));var authService=require('../../components/auth/service');var qs=require(_0x98c7('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98c7('0xc'));var logger=require(_0x98c7('0xd'))(_0x98c7('0xe'));var utils=require(_0x98c7('0xf'));var config=require(_0x98c7('0x10'));var licenseUtil=require(_0x98c7('0x11'));var db=require(_0x98c7('0x12'))['db'];function respondWithStatusCode(_0x414446,_0x300055){_0x300055=_0x300055||0xcc;return function(_0x22d1dd){if(_0x22d1dd){return _0x414446[_0x98c7('0x13')](_0x300055);}return _0x414446[_0x98c7('0x14')](_0x300055)[_0x98c7('0x15')]();};}function respondWithResult(_0x442fc3,_0x386fd3){_0x386fd3=_0x386fd3||0xc8;return function(_0x238e98){if(_0x238e98){return _0x442fc3['status'](_0x386fd3)['json'](_0x238e98);}};}function respondWithFilteredResult(_0x3b9ced,_0x2eef73){return function(_0xb4696a){if(_0xb4696a){var _0x23d344=typeof _0x2eef73['offset']==='undefined'&&typeof _0x2eef73[_0x98c7('0x16')]==='undefined';var _0x37543f=_0xb4696a[_0x98c7('0x17')];var _0x22b669=_0x23d344?0x0:_0x2eef73[_0x98c7('0x18')];var _0x5df15b=_0x23d344?_0xb4696a[_0x98c7('0x17')]:_0x2eef73[_0x98c7('0x18')]+_0x2eef73[_0x98c7('0x16')];var _0x2207ae;if(_0x5df15b>=_0x37543f){_0x5df15b=_0x37543f;_0x2207ae=0xc8;}else{_0x2207ae=0xce;}_0x3b9ced[_0x98c7('0x14')](_0x2207ae);return _0x3b9ced[_0x98c7('0x19')](_0x98c7('0x1a'),_0x22b669+'-'+_0x5df15b+'/'+_0x37543f)['json'](_0xb4696a);}return null;};}function patchUpdates(_0x3d2a3d){return function(_0xec028){try{jsonpatch['apply'](_0xec028,_0x3d2a3d,!![]);}catch(_0x28ea17){return BPromise[_0x98c7('0x1b')](_0x28ea17);}return _0xec028[_0x98c7('0x1c')]();};}function saveUpdates(_0x41de48,_0x206000){return function(_0x260660){if(_0x260660){return _0x260660[_0x98c7('0x1d')](_0x41de48)[_0x98c7('0x1e')](function(_0x20bd1b){return _0x20bd1b;});}return null;};}function removeEntity(_0x2f0f6e,_0x9ade8f){return function(_0x807ecd){if(_0x807ecd){return _0x807ecd['destroy']()[_0x98c7('0x1e')](function(){_0x2f0f6e[_0x98c7('0x14')](0xcc)[_0x98c7('0x15')]();});}};}function handleEntityNotFound(_0x9ee36e,_0x3a9110){return function(_0x232aa9){if(!_0x232aa9){_0x9ee36e['sendStatus'](0x194);}return _0x232aa9;};}function handleError(_0x25b033,_0x12c6ba){_0x12c6ba=_0x12c6ba||0x1f4;return function(_0x96f94a){logger[_0x98c7('0x1f')](_0x96f94a[_0x98c7('0x20')]);if(_0x96f94a[_0x98c7('0x21')]){delete _0x96f94a[_0x98c7('0x21')];}_0x25b033[_0x98c7('0x14')](_0x12c6ba)[_0x98c7('0x22')](_0x96f94a);};}exports[_0x98c7('0x23')]=function(_0x16952b,_0x39a298){var _0x1ebab4={'raw':!![],'where':{'id':_0x16952b[_0x98c7('0x24')]['id']}},_0x44ff50={};_0x44ff50[_0x98c7('0x25')]=_[_0x98c7('0x26')](db[_0x98c7('0x27')]['rawAttributes']);_0x44ff50[_0x98c7('0x28')]=_[_0x98c7('0x26')](_0x16952b[_0x98c7('0x28')]);_0x44ff50['filters']=_[_0x98c7('0x29')](_0x44ff50[_0x98c7('0x25')],_0x44ff50['query']);_0x1ebab4[_0x98c7('0x2a')]=_[_0x98c7('0x29')](_0x44ff50['model'],qs[_0x98c7('0x2b')](_0x16952b[_0x98c7('0x28')][_0x98c7('0x2b')]));_0x1ebab4[_0x98c7('0x2a')]=_0x1ebab4['attributes']['length']?_0x1ebab4[_0x98c7('0x2a')]:_0x44ff50[_0x98c7('0x25')];if(_0x16952b[_0x98c7('0x28')]['includeAll']){_0x1ebab4['include']=[{'all':!![]}];}_0x1ebab4=_['merge']({},_0x1ebab4,_0x16952b[_0x98c7('0x2c')]);return db['ChatProactiveAction']['find'](_0x1ebab4)[_0x98c7('0x1e')](handleEntityNotFound(_0x39a298,null))['then'](respondWithResult(_0x39a298,null))['catch'](handleError(_0x39a298,null));};exports[_0x98c7('0x2d')]=function(_0x5128b6,_0x570fc2){return db['ChatProactiveAction'][_0x98c7('0x2d')](_0x5128b6[_0x98c7('0x2e')],{})[_0x98c7('0x1e')](respondWithResult(_0x570fc2,0xc9))['catch'](handleError(_0x570fc2,null));};exports['update']=function(_0x2df4f9,_0x48e0f3){if(_0x2df4f9['body']['id']){delete _0x2df4f9[_0x98c7('0x2e')]['id'];}return db['ChatProactiveAction'][_0x98c7('0x2f')]({'where':{'id':_0x2df4f9[_0x98c7('0x24')]['id']}})['then'](handleEntityNotFound(_0x48e0f3,null))[_0x98c7('0x1e')](saveUpdates(_0x2df4f9[_0x98c7('0x2e')],null))['then'](respondWithResult(_0x48e0f3,null))[_0x98c7('0x30')](handleError(_0x48e0f3,null));};exports['destroy']=function(_0x532cea,_0x4ed71e){return db['ChatProactiveAction']['find']({'where':{'id':_0x532cea[_0x98c7('0x24')]['id']}})[_0x98c7('0x1e')](handleEntityNotFound(_0x4ed71e,null))[_0x98c7('0x1e')](removeEntity(_0x4ed71e,null))[_0x98c7('0x30')](handleError(_0x4ed71e,null));}; \ No newline at end of file +var _0x1e19=['status','end','json','undefined','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus'];(function(_0x108831,_0x5e4f70){var _0x4da77a=function(_0x139446){while(--_0x139446){_0x108831['push'](_0x108831['shift']());}};_0x4da77a(++_0x5e4f70);}(_0x1e19,0x1c9));var _0x91e1=function(_0x5ce14b,_0x204cab){_0x5ce14b=_0x5ce14b-0x0;var _0x29c5fc=_0x1e19[_0x5ce14b];return _0x29c5fc;};'use strict';var emlformat=require(_0x91e1('0x0'));var rimraf=require(_0x91e1('0x1'));var zipdir=require(_0x91e1('0x2'));var jsonpatch=require(_0x91e1('0x3'));var rp=require(_0x91e1('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x91e1('0x5'));var sox=require(_0x91e1('0x6'));var csv=require(_0x91e1('0x7'));var ejs=require(_0x91e1('0x8'));var fs=require('fs');var fs_extra=require(_0x91e1('0x9'));var _=require('lodash');var squel=require(_0x91e1('0xa'));var crypto=require('crypto');var jsforce=require(_0x91e1('0xb'));var deskjs=require(_0x91e1('0xc'));var toCsv=require(_0x91e1('0x7'));var querystring=require(_0x91e1('0xd'));var Papa=require(_0x91e1('0xe'));var Redis=require('ioredis');var authService=require(_0x91e1('0xf'));var qs=require(_0x91e1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91e1('0x11'));var logger=require(_0x91e1('0x12'))(_0x91e1('0x13'));var utils=require(_0x91e1('0x14'));var config=require(_0x91e1('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40b3f6,_0x463abd){_0x463abd=_0x463abd||0xcc;return function(_0x36660b){if(_0x36660b){return _0x40b3f6[_0x91e1('0x16')](_0x463abd);}return _0x40b3f6[_0x91e1('0x17')](_0x463abd)[_0x91e1('0x18')]();};}function respondWithResult(_0x23da39,_0x3fb2e4){_0x3fb2e4=_0x3fb2e4||0xc8;return function(_0x511333){if(_0x511333){return _0x23da39[_0x91e1('0x17')](_0x3fb2e4)[_0x91e1('0x19')](_0x511333);}};}function respondWithFilteredResult(_0x278473,_0x1d0bca){return function(_0x3ed9e4){if(_0x3ed9e4){var _0x5bcf29=typeof _0x1d0bca['offset']===_0x91e1('0x1a')&&typeof _0x1d0bca['limit']===_0x91e1('0x1a');var _0x20fbde=_0x3ed9e4['count'];var _0x3b2b17=_0x5bcf29?0x0:_0x1d0bca[_0x91e1('0x1b')];var _0xdb98e5=_0x5bcf29?_0x3ed9e4['count']:_0x1d0bca['offset']+_0x1d0bca[_0x91e1('0x1c')];var _0x582ccf;if(_0xdb98e5>=_0x20fbde){_0xdb98e5=_0x20fbde;_0x582ccf=0xc8;}else{_0x582ccf=0xce;}_0x278473[_0x91e1('0x17')](_0x582ccf);return _0x278473[_0x91e1('0x1d')](_0x91e1('0x1e'),_0x3b2b17+'-'+_0xdb98e5+'/'+_0x20fbde)[_0x91e1('0x19')](_0x3ed9e4);}return null;};}function patchUpdates(_0xd2249f){return function(_0x1ee135){try{jsonpatch[_0x91e1('0x1f')](_0x1ee135,_0xd2249f,!![]);}catch(_0x1fc05e){return BPromise[_0x91e1('0x20')](_0x1fc05e);}return _0x1ee135[_0x91e1('0x21')]();};}function saveUpdates(_0x647dae,_0x4c80e6){return function(_0x218a5a){if(_0x218a5a){return _0x218a5a[_0x91e1('0x22')](_0x647dae)[_0x91e1('0x23')](function(_0x549b53){return _0x549b53;});}return null;};}function removeEntity(_0x477d6c,_0xccc5ad){return function(_0x3c7631){if(_0x3c7631){return _0x3c7631[_0x91e1('0x24')]()[_0x91e1('0x23')](function(){_0x477d6c[_0x91e1('0x17')](0xcc)[_0x91e1('0x18')]();});}};}function handleEntityNotFound(_0xe97618,_0xca52f1){return function(_0x1b5f7e){if(!_0x1b5f7e){_0xe97618[_0x91e1('0x16')](0x194);}return _0x1b5f7e;};}function handleError(_0xaacfcd,_0x3dbb13){_0x3dbb13=_0x3dbb13||0x1f4;return function(_0xf3bbb8){logger[_0x91e1('0x25')](_0xf3bbb8[_0x91e1('0x26')]);if(_0xf3bbb8[_0x91e1('0x27')]){delete _0xf3bbb8[_0x91e1('0x27')];}_0xaacfcd[_0x91e1('0x17')](_0x3dbb13)[_0x91e1('0x28')](_0xf3bbb8);};}exports['show']=function(_0x19f84d,_0xec7e07){var _0x5bae2b={'raw':!![],'where':{'id':_0x19f84d['params']['id']}},_0x3fab17={};_0x3fab17['model']=_[_0x91e1('0x29')](db[_0x91e1('0x2a')][_0x91e1('0x2b')]);_0x3fab17['query']=_[_0x91e1('0x29')](_0x19f84d[_0x91e1('0x2c')]);_0x3fab17[_0x91e1('0x2d')]=_[_0x91e1('0x2e')](_0x3fab17[_0x91e1('0x2f')],_0x3fab17[_0x91e1('0x2c')]);_0x5bae2b['attributes']=_['intersection'](_0x3fab17[_0x91e1('0x2f')],qs[_0x91e1('0x30')](_0x19f84d[_0x91e1('0x2c')][_0x91e1('0x30')]));_0x5bae2b[_0x91e1('0x31')]=_0x5bae2b['attributes'][_0x91e1('0x32')]?_0x5bae2b[_0x91e1('0x31')]:_0x3fab17[_0x91e1('0x2f')];if(_0x19f84d[_0x91e1('0x2c')][_0x91e1('0x33')]){_0x5bae2b[_0x91e1('0x34')]=[{'all':!![]}];}_0x5bae2b=_[_0x91e1('0x35')]({},_0x5bae2b,_0x19f84d[_0x91e1('0x36')]);return db[_0x91e1('0x2a')][_0x91e1('0x37')](_0x5bae2b)[_0x91e1('0x23')](handleEntityNotFound(_0xec7e07,null))['then'](respondWithResult(_0xec7e07,null))[_0x91e1('0x38')](handleError(_0xec7e07,null));};exports[_0x91e1('0x39')]=function(_0x38d556,_0x35fdcd){return db[_0x91e1('0x2a')]['create'](_0x38d556['body'],{})['then'](respondWithResult(_0x35fdcd,0xc9))[_0x91e1('0x38')](handleError(_0x35fdcd,null));};exports[_0x91e1('0x22')]=function(_0x605a81,_0x4eaa5c){if(_0x605a81['body']['id']){delete _0x605a81[_0x91e1('0x3a')]['id'];}return db[_0x91e1('0x2a')][_0x91e1('0x37')]({'where':{'id':_0x605a81[_0x91e1('0x3b')]['id']}})[_0x91e1('0x23')](handleEntityNotFound(_0x4eaa5c,null))[_0x91e1('0x23')](saveUpdates(_0x605a81[_0x91e1('0x3a')],null))[_0x91e1('0x23')](respondWithResult(_0x4eaa5c,null))[_0x91e1('0x38')](handleError(_0x4eaa5c,null));};exports['destroy']=function(_0x88bb37,_0x53adb9){return db[_0x91e1('0x2a')][_0x91e1('0x37')]({'where':{'id':_0x88bb37['params']['id']}})[_0x91e1('0x23')](handleEntityNotFound(_0x53adb9,null))[_0x91e1('0x23')](removeEntity(_0x53adb9,null))[_0x91e1('0x38')](handleError(_0x53adb9,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index b21b2d3..36532fd 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 _0x8cab=['api','moment','bluebird','request-promise','path','rimraf','exports','ChatProactiveAction','lodash','util','../../config/logger'];(function(_0x1c6476,_0x438e0e){var _0x9b7648=function(_0x2814a2){while(--_0x2814a2){_0x1c6476['push'](_0x1c6476['shift']());}};_0x9b7648(++_0x438e0e);}(_0x8cab,0x97));var _0xb8ca=function(_0x2360fd,_0x3b86e7){_0x2360fd=_0x2360fd-0x0;var _0x14858d=_0x8cab[_0x2360fd];return _0x14858d;};'use strict';var _=require(_0xb8ca('0x0'));var util=require(_0xb8ca('0x1'));var logger=require(_0xb8ca('0x2'))(_0xb8ca('0x3'));var moment=require(_0xb8ca('0x4'));var BPromise=require(_0xb8ca('0x5'));var rp=require(_0xb8ca('0x6'));var fs=require('fs');var path=require(_0xb8ca('0x7'));var rimraf=require(_0xb8ca('0x8'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0xb8ca('0x9')]=function(_0x35d7e5,_0x1855e8){return _0x35d7e5['define'](_0xb8ca('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0a6=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','chat_proactive_actions'];(function(_0x84846d,_0x5112dd){var _0x5f5c49=function(_0x25990b){while(--_0x25990b){_0x84846d['push'](_0x84846d['shift']());}};_0x5f5c49(++_0x5112dd);}(_0xb0a6,0x14a));var _0x6b0a=function(_0x480575,_0x4247e1){_0x480575=_0x480575-0x0;var _0x3a4491=_0xb0a6[_0x480575];return _0x3a4491;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6b0a('0x0'))(_0x6b0a('0x1'));var moment=require(_0x6b0a('0x2'));var BPromise=require('bluebird');var rp=require(_0x6b0a('0x3'));var fs=require('fs');var path=require(_0x6b0a('0x4'));var rimraf=require(_0x6b0a('0x5'));var config=require(_0x6b0a('0x6'));var attributes=require(_0x6b0a('0x7'));module[_0x6b0a('0x8')]=function(_0x3c13e3,_0x316003){return _0x3c13e3['define']('ChatProactiveAction',attributes,{'tableName':_0x6b0a('0x9'),'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 0a9d0da..3a31288 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 _0xa8f7=['ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','ChatProactiveAction,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x55cdc5,_0x2b2297){var _0x29acd5=function(_0x405234){while(--_0x405234){_0x55cdc5['push'](_0x55cdc5['shift']());}};_0x29acd5(++_0x2b2297);}(_0xa8f7,0x74));var _0x7a8f=function(_0x1d56ca,_0x326427){_0x1d56ca=_0x1d56ca-0x0;var _0x41025d=_0xa8f7[_0x1d56ca];return _0x41025d;};'use strict';var _=require(_0x7a8f('0x0'));var util=require('util');var moment=require(_0x7a8f('0x1'));var BPromise=require(_0x7a8f('0x2'));var rs=require(_0x7a8f('0x3'));var fs=require('fs');var Redis=require(_0x7a8f('0x4'));var db=require(_0x7a8f('0x5'))['db'];var utils=require(_0x7a8f('0x6'));var logger=require(_0x7a8f('0x7'))('rpc');var config=require(_0x7a8f('0x8'));var jayson=require(_0x7a8f('0x9'));var client=jayson[_0x7a8f('0xa')][_0x7a8f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f4c33,_0x58a32e,_0x752bad){return new BPromise(function(_0x4adace,_0x26a8fb){return client[_0x7a8f('0xc')](_0x3f4c33,_0x752bad)[_0x7a8f('0xd')](function(_0x14d140){logger[_0x7a8f('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x58a32e,_0x7a8f('0xf'));logger['debug'](_0x7a8f('0x10'),_0x58a32e,'request\x20sent',JSON['stringify'](_0x14d140));if(_0x14d140[_0x7a8f('0x11')]){if(_0x14d140[_0x7a8f('0x11')][_0x7a8f('0x12')]===0x1f4){logger[_0x7a8f('0x11')](_0x7a8f('0x13'),_0x58a32e,_0x14d140[_0x7a8f('0x11')]['message']);return _0x26a8fb(_0x14d140[_0x7a8f('0x11')][_0x7a8f('0x14')]);}logger[_0x7a8f('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x58a32e,_0x14d140[_0x7a8f('0x11')][_0x7a8f('0x14')]);return _0x4adace(_0x14d140[_0x7a8f('0x11')][_0x7a8f('0x14')]);}else{logger[_0x7a8f('0xe')](_0x7a8f('0x13'),_0x58a32e,_0x7a8f('0xf'));_0x4adace(_0x14d140['result'][_0x7a8f('0x14')]);}})[_0x7a8f('0x15')](function(_0x234638){logger[_0x7a8f('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x58a32e,_0x234638);_0x26a8fb(_0x234638);});});} \ No newline at end of file +var _0x2285=['../../config/environment','jayson/promise','client','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x14d410,_0x558808){var _0x684d10=function(_0x5f06a6){while(--_0x5f06a6){_0x14d410['push'](_0x14d410['shift']());}};_0x684d10(++_0x558808);}(_0x2285,0x8d));var _0x5228=function(_0x4b4c3b,_0x5b6710){_0x4b4c3b=_0x4b4c3b-0x0;var _0x59ca3e=_0x2285[_0x4b4c3b];return _0x59ca3e;};'use strict';var _=require(_0x5228('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5228('0x1'));var rs=require(_0x5228('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5228('0x3'));var logger=require(_0x5228('0x4'))(_0x5228('0x5'));var config=require(_0x5228('0x6'));var jayson=require(_0x5228('0x7'));var client=jayson[_0x5228('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1eadc2,_0x5ad264,_0x2a0232){return new BPromise(function(_0xc039a,_0x360c31){return client[_0x5228('0x9')](_0x1eadc2,_0x2a0232)[_0x5228('0xa')](function(_0x185fbe){logger['info'](_0x5228('0xb'),_0x5ad264,_0x5228('0xc'));logger[_0x5228('0xd')](_0x5228('0xe'),_0x5ad264,_0x5228('0xc'),JSON['stringify'](_0x185fbe));if(_0x185fbe[_0x5228('0xf')]){if(_0x185fbe[_0x5228('0xf')][_0x5228('0x10')]===0x1f4){logger['error'](_0x5228('0xb'),_0x5ad264,_0x185fbe[_0x5228('0xf')][_0x5228('0x11')]);return _0x360c31(_0x185fbe[_0x5228('0xf')][_0x5228('0x11')]);}logger[_0x5228('0xf')](_0x5228('0xb'),_0x5ad264,_0x185fbe[_0x5228('0xf')]['message']);return _0xc039a(_0x185fbe[_0x5228('0xf')][_0x5228('0x11')]);}else{logger[_0x5228('0x12')](_0x5228('0xb'),_0x5ad264,_0x5228('0xc'));_0xc039a(_0x185fbe[_0x5228('0x13')][_0x5228('0x11')]);}})[_0x5228('0x14')](function(_0x4031d6){logger[_0x5228('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x5ad264,_0x4031d6);_0x360c31(_0x4031d6);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 8180045..743f030 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 _0x8958=['show','post','put','update','delete','destroy','exports','util','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated'];(function(_0x24e999,_0x1878c0){var _0x3e3b76=function(_0x101931){while(--_0x101931){_0x24e999['push'](_0x24e999['shift']());}};_0x3e3b76(++_0x1878c0);}(_0x8958,0x93));var _0x8895=function(_0x1b0bcc,_0x4af3f1){_0x1b0bcc=_0x1b0bcc-0x0;var _0x497cf9=_0x8958[_0x1b0bcc];return _0x497cf9;};'use strict';var multer=require('multer');var util=require(_0x8895('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8895('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var controller=require(_0x8895('0x4'));router['get'](_0x8895('0x5'),auth[_0x8895('0x6')](),controller[_0x8895('0x7')]);router[_0x8895('0x8')]('/',auth[_0x8895('0x6')](),controller['create']);router[_0x8895('0x9')](_0x8895('0x5'),auth[_0x8895('0x6')](),controller[_0x8895('0xa')]);router[_0x8895('0xb')](_0x8895('0x5'),auth[_0x8895('0x6')](),controller[_0x8895('0xc')]);module[_0x8895('0xd')]=router; \ No newline at end of file +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(_0x20d00b,_0x53be54){_0x20d00b=_0x20d00b-0x0;var _0x1ce187=_0x038b[_0x20d00b];return _0x1ce187;};'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 diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 7527eca..3aebeb0 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 _0xb4f5=['exports','STRING','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0x1a2ea4,_0x380f20){var _0x2b32fa=function(_0x1b5fd9){while(--_0x1b5fd9){_0x1a2ea4['push'](_0x1a2ea4['shift']());}};_0x2b32fa(++_0x380f20);}(_0xb4f5,0x12d));var _0x5b4f=function(_0x43709e,_0x2c3b45){_0x43709e=_0x43709e-0x0;var _0x452820=_0xb4f5[_0x43709e];return _0x452820;};'use strict';var Sequelize=require('sequelize');module[_0x5b4f('0x0')]={'name':{'type':Sequelize[_0x5b4f('0x1')],'unique':_0x5b4f('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5b4f('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5b4f('0x3')](_0x5b4f('0x4'),_0x5b4f('0x5'),_0x5b4f('0x6'))}}; \ No newline at end of file +var _0x1914=['roundrobin','exports','STRING','name','ENUM','beepall'];(function(_0x366e3f,_0x33ecdf){var _0x1ab9c9=function(_0x2703a3){while(--_0x2703a3){_0x366e3f['push'](_0x366e3f['shift']());}};_0x1ab9c9(++_0x33ecdf);}(_0x1914,0x7f));var _0x4191=function(_0x2a8091,_0x48ed1a){_0x2a8091=_0x2a8091-0x0;var _0x2a59b6=_0x1914[_0x2a8091];return _0x2a59b6;};'use strict';var Sequelize=require('sequelize');module[_0x4191('0x0')]={'name':{'type':Sequelize[_0x4191('0x1')],'unique':_0x4191('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4191('0x3')]('rrmemory',_0x4191('0x4'),_0x4191('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 351e907..635097f 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 _0x0276=['Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','order','pick','ChatQueueId','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','User','Agents','online','interface','transaction','each','findOrCreate','forEach','emit','removeTeams','select','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','sequelize','SELECT','every','includes','all','union','compact','value','ids','isEmpty','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','end','status','limit','undefined','count','offset','set','Content-Range','save','update','get','ChatQueues','UserProfileResource','sendStatus','stack','name','index','map','ChatQueue','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','user'];(function(_0x27ea47,_0x10ffbf){var _0x5a5499=function(_0x846889){while(--_0x846889){_0x27ea47['push'](_0x27ea47['shift']());}};_0x5a5499(++_0x10ffbf);}(_0x0276,0x15c));var _0x6027=function(_0x5e9e5f,_0x19aeeb){_0x5e9e5f=_0x5e9e5f-0x0;var _0x4944f5=_0x0276[_0x5e9e5f];return _0x4944f5;};'use strict';var emlformat=require(_0x6027('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6027('0x1'));var jsonpatch=require(_0x6027('0x2'));var rp=require(_0x6027('0x3'));var moment=require(_0x6027('0x4'));var BPromise=require(_0x6027('0x5'));var Mustache=require(_0x6027('0x6'));var util=require(_0x6027('0x7'));var path=require(_0x6027('0x8'));var sox=require('sox');var csv=require(_0x6027('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6027('0xa'));var _=require(_0x6027('0xb'));var squel=require(_0x6027('0xc'));var crypto=require(_0x6027('0xd'));var jsforce=require(_0x6027('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6027('0x9'));var querystring=require('querystring');var Papa=require(_0x6027('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6027('0x10'));var as=require(_0x6027('0x11'));var hardwareService=require(_0x6027('0x12'));var logger=require(_0x6027('0x13'))(_0x6027('0x14'));var utils=require('../../config/utils');var config=require(_0x6027('0x15'));var licenseUtil=require(_0x6027('0x16'));var db=require(_0x6027('0x17'))['db'];config[_0x6027('0x18')]=_[_0x6027('0x19')](config[_0x6027('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x6027('0x1a'))(new Redis(config[_0x6027('0x18')]));require(_0x6027('0x1b'))[_0x6027('0x1c')](socket);var jayson=require(_0x6027('0x1d'));var client=jayson[_0x6027('0x1e')][_0x6027('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x195aae,_0xd819d1,_0x3615dd,_0x57d616){return new BPromise(function(_0x109efb,_0x153e1e){var _0xb1fb54=_0x57d616||client;return _0xb1fb54[_0x6027('0x20')](_0x195aae,_0x3615dd)[_0x6027('0x21')](function(_0x3768ca){logger['info'](_0x6027('0x22'),_0xd819d1,_0x6027('0x23'));logger[_0x6027('0x24')](_0x6027('0x25'),_0xd819d1,'request\x20sent',JSON['stringify'](_0x3768ca));if(_0x3768ca[_0x6027('0x26')]){if(_0x3768ca[_0x6027('0x26')][_0x6027('0x27')]===0x1f4){logger['error'](_0x6027('0x22'),_0xd819d1,_0x3768ca[_0x6027('0x26')][_0x6027('0x28')]);return _0x153e1e(_0x3768ca['error']['message']);}logger[_0x6027('0x26')](_0x6027('0x22'),_0xd819d1,_0x3768ca[_0x6027('0x26')][_0x6027('0x28')]);return _0x109efb(_0x3768ca[_0x6027('0x26')][_0x6027('0x28')]);}else{logger[_0x6027('0x29')]('ChatQueue,\x20%s,\x20%s',_0xd819d1,_0x6027('0x23'));_0x109efb(_0x3768ca['result'][_0x6027('0x28')]);}})[_0x6027('0x2a')](function(_0x3c6361){logger[_0x6027('0x26')](_0x6027('0x22'),_0xd819d1,_0x3c6361);_0x153e1e(_0x3c6361);});});}function respondWithStatusCode(_0x19c276,_0x507787){_0x507787=_0x507787||0xcc;return function(_0x4ea290){if(_0x4ea290){return _0x19c276['sendStatus'](_0x507787);}return _0x19c276['status'](_0x507787)[_0x6027('0x2b')]();};}function respondWithResult(_0x3e9365,_0x572860){_0x572860=_0x572860||0xc8;return function(_0x568f16){if(_0x568f16){return _0x3e9365[_0x6027('0x2c')](_0x572860)['json'](_0x568f16);}};}function respondWithFilteredResult(_0x308981,_0xae2e72){return function(_0x1c2600){if(_0x1c2600){var _0x180358=typeof _0xae2e72['offset']==='undefined'&&typeof _0xae2e72[_0x6027('0x2d')]===_0x6027('0x2e');var _0x504b9c=_0x1c2600[_0x6027('0x2f')];var _0x3a1a9e=_0x180358?0x0:_0xae2e72['offset'];var _0x4ed535=_0x180358?_0x1c2600[_0x6027('0x2f')]:_0xae2e72[_0x6027('0x30')]+_0xae2e72[_0x6027('0x2d')];var _0x19cf8c;if(_0x4ed535>=_0x504b9c){_0x4ed535=_0x504b9c;_0x19cf8c=0xc8;}else{_0x19cf8c=0xce;}_0x308981[_0x6027('0x2c')](_0x19cf8c);return _0x308981[_0x6027('0x31')](_0x6027('0x32'),_0x3a1a9e+'-'+_0x4ed535+'/'+_0x504b9c)['json'](_0x1c2600);}return null;};}function patchUpdates(_0x2545e3){return function(_0x11799e){try{jsonpatch['apply'](_0x11799e,_0x2545e3,!![]);}catch(_0x2d18c1){return BPromise['reject'](_0x2d18c1);}return _0x11799e[_0x6027('0x33')]();};}function saveUpdates(_0x380c46,_0x3a6ab0){return function(_0x7e82ce){if(_0x7e82ce){return _0x7e82ce[_0x6027('0x34')](_0x380c46)[_0x6027('0x21')](function(_0x37d415){return _0x37d415;});}return null;};}function removeEntity(_0x55c3ba,_0x489e69){return function(_0x1f201e){if(_0x1f201e){return _0x1f201e['destroy']()[_0x6027('0x21')](function(){var _0x1cc1d1=_0x1f201e[_0x6027('0x35')]({'plain':!![]});var _0x64faec=_0x6027('0x36');return db[_0x6027('0x37')]['destroy']({'where':{'type':_0x64faec,'resourceId':_0x1cc1d1['id']}})[_0x6027('0x21')](function(){return _0x1f201e;});})[_0x6027('0x21')](function(){_0x55c3ba[_0x6027('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x273d73,_0xafbcb0){return function(_0x262a40){if(!_0x262a40){_0x273d73[_0x6027('0x38')](0x194);}return _0x262a40;};}function handleError(_0x3a2a95,_0x285644){_0x285644=_0x285644||0x1f4;return function(_0x1c6136){logger[_0x6027('0x26')](_0x1c6136[_0x6027('0x39')]);if(_0x1c6136[_0x6027('0x3a')]){delete _0x1c6136['name'];}_0x3a2a95['status'](_0x285644)['send'](_0x1c6136);};}exports[_0x6027('0x3b')]=function(_0x417962,_0x25f1cd){var _0x36dd94={},_0x49d3f0={},_0x3eed43={'count':0x0,'rows':[]};var _0x7f249e=_[_0x6027('0x3c')](db[_0x6027('0x3d')]['rawAttributes'],function(_0x5b1c92){return{'name':_0x5b1c92[_0x6027('0x3e')],'type':_0x5b1c92[_0x6027('0x3f')]['key']};});_0x49d3f0[_0x6027('0x40')]=_[_0x6027('0x3c')](_0x7f249e,'name');_0x49d3f0['query']=_[_0x6027('0x41')](_0x417962[_0x6027('0x42')]);_0x49d3f0['filters']=_[_0x6027('0x43')](_0x49d3f0[_0x6027('0x40')],_0x49d3f0[_0x6027('0x42')]);_0x36dd94[_0x6027('0x44')]=_[_0x6027('0x43')](_0x49d3f0[_0x6027('0x40')],qs['fields'](_0x417962[_0x6027('0x42')][_0x6027('0x45')]));_0x36dd94[_0x6027('0x44')]=_0x36dd94[_0x6027('0x44')][_0x6027('0x46')]?_0x36dd94['attributes']:_0x49d3f0['model'];if(!_0x417962[_0x6027('0x42')][_0x6027('0x47')](_0x6027('0x48'))){_0x36dd94[_0x6027('0x2d')]=qs[_0x6027('0x2d')](_0x417962[_0x6027('0x42')][_0x6027('0x2d')]);_0x36dd94[_0x6027('0x30')]=qs['offset'](_0x417962['query'][_0x6027('0x30')]);}_0x36dd94['order']=qs[_0x6027('0x49')](_0x417962[_0x6027('0x42')][_0x6027('0x49')]);_0x36dd94[_0x6027('0x4a')]=qs[_0x6027('0x4b')](_['pick'](_0x417962[_0x6027('0x42')],_0x49d3f0[_0x6027('0x4b')]),_0x7f249e);if(_0x417962[_0x6027('0x42')][_0x6027('0x4c')]){_0x36dd94[_0x6027('0x4a')]=_[_0x6027('0x4d')](_0x36dd94[_0x6027('0x4a')],{'$or':_[_0x6027('0x3c')](_0x7f249e,function(_0xce233f){if(_0xce233f[_0x6027('0x3f')]!=='VIRTUAL'){var _0x253a3e={};_0x253a3e[_0xce233f['name']]={'$like':'%'+_0x417962[_0x6027('0x42')]['filter']+'%'};return _0x253a3e;}})});}_0x36dd94=_['merge']({},_0x36dd94,_0x417962[_0x6027('0x4e')]);var _0x371532={'where':_0x36dd94['where']};return db[_0x6027('0x3d')]['count'](_0x371532)[_0x6027('0x21')](function(_0x1d650c){_0x3eed43[_0x6027('0x2f')]=_0x1d650c;if(_0x417962[_0x6027('0x42')][_0x6027('0x4f')]){_0x36dd94[_0x6027('0x50')]=[{'all':!![]}];}return db[_0x6027('0x3d')][_0x6027('0x51')](_0x36dd94);})[_0x6027('0x21')](function(_0xdd9c5a){_0x3eed43[_0x6027('0x52')]=_0xdd9c5a;return _0x3eed43;})[_0x6027('0x21')](respondWithFilteredResult(_0x25f1cd,_0x36dd94))[_0x6027('0x2a')](handleError(_0x25f1cd,null));};exports[_0x6027('0x53')]=function(_0x20f6b9,_0x34f7db){var _0x271f1d={'raw':!![],'where':{'id':_0x20f6b9[_0x6027('0x54')]['id']}},_0x3c9566={};_0x3c9566[_0x6027('0x40')]=_[_0x6027('0x41')](db[_0x6027('0x3d')][_0x6027('0x55')]);_0x3c9566[_0x6027('0x42')]=_[_0x6027('0x41')](_0x20f6b9[_0x6027('0x42')]);_0x3c9566[_0x6027('0x4b')]=_[_0x6027('0x43')](_0x3c9566['model'],_0x3c9566['query']);_0x271f1d[_0x6027('0x44')]=_[_0x6027('0x43')](_0x3c9566[_0x6027('0x40')],qs[_0x6027('0x45')](_0x20f6b9[_0x6027('0x42')][_0x6027('0x45')]));_0x271f1d[_0x6027('0x44')]=_0x271f1d['attributes'][_0x6027('0x46')]?_0x271f1d[_0x6027('0x44')]:_0x3c9566['model'];if(_0x20f6b9[_0x6027('0x42')]['includeAll']){_0x271f1d[_0x6027('0x50')]=[{'all':!![]}];}_0x271f1d=_[_0x6027('0x4d')]({},_0x271f1d,_0x20f6b9[_0x6027('0x4e')]);return db[_0x6027('0x3d')][_0x6027('0x56')](_0x271f1d)[_0x6027('0x21')](handleEntityNotFound(_0x34f7db,null))['then'](respondWithResult(_0x34f7db,null))[_0x6027('0x2a')](handleError(_0x34f7db,null));};exports[_0x6027('0x57')]=function(_0x208c15,_0x470d4c){return db[_0x6027('0x3d')][_0x6027('0x57')](_0x208c15[_0x6027('0x58')],{})[_0x6027('0x21')](function(_0x29ff85){var _0x322902=_0x208c15[_0x6027('0x59')]['get']({'plain':!![]});if(!_0x322902)throw new Error(_0x6027('0x5a'));if(_0x322902['role']===_0x6027('0x59')){var _0xbbd22f=_0x29ff85[_0x6027('0x35')]({'plain':!![]});var _0x3a7f48=_0x6027('0x36');return db[_0x6027('0x5b')][_0x6027('0x56')]({'where':{'name':_0x3a7f48,'userProfileId':_0x322902['userProfileId']},'raw':!![]})[_0x6027('0x21')](function(_0x4e2748){if(_0x4e2748&&_0x4e2748[_0x6027('0x5c')]===0x0){return db[_0x6027('0x37')][_0x6027('0x57')]({'name':_0xbbd22f['name'],'resourceId':_0xbbd22f['id'],'type':_0x4e2748[_0x6027('0x3a')],'sectionId':_0x4e2748['id']},{})[_0x6027('0x21')](function(){return _0x29ff85;});}else{return _0x29ff85;}})[_0x6027('0x2a')](function(_0x465284){logger[_0x6027('0x26')](_0x6027('0x5d'),_0x465284);throw _0x465284;});}return _0x29ff85;})[_0x6027('0x21')](respondWithResult(_0x470d4c,0xc9))['catch'](handleError(_0x470d4c,null));};exports[_0x6027('0x34')]=function(_0x7ca6,_0x5b9ad2){if(_0x7ca6[_0x6027('0x58')]['id']){delete _0x7ca6['body']['id'];}return db[_0x6027('0x3d')][_0x6027('0x56')]({'where':{'id':_0x7ca6['params']['id']}})[_0x6027('0x21')](handleEntityNotFound(_0x5b9ad2,null))[_0x6027('0x21')](saveUpdates(_0x7ca6[_0x6027('0x58')],null))[_0x6027('0x21')](respondWithResult(_0x5b9ad2,null))[_0x6027('0x2a')](handleError(_0x5b9ad2,null));};exports['destroy']=function(_0x195565,_0x1a0d24){return db['ChatQueue'][_0x6027('0x56')]({'where':{'id':_0x195565[_0x6027('0x54')]['id']}})[_0x6027('0x21')](handleEntityNotFound(_0x1a0d24,null))[_0x6027('0x21')](removeEntity(_0x1a0d24,null))[_0x6027('0x2a')](handleError(_0x1a0d24,null));};exports[_0x6027('0x5e')]=function(_0x2ec45d,_0x31cd5d){return db[_0x6027('0x3d')][_0x6027('0x5e')]()['then'](respondWithResult(_0x31cd5d,null))[_0x6027('0x2a')](handleError(_0x31cd5d,null));};exports[_0x6027('0x5f')]=function(_0x213cde,_0x587319,_0x2193ac){var _0x2d87bf={'raw':!![],'where':{}},_0x331dc7={},_0x311581;return db['ChatQueue'][_0x6027('0x60')]({'where':{'id':_0x213cde[_0x6027('0x54')]['id']}})['then'](handleEntityNotFound(_0x587319,null))['then'](function(_0x10302e){if(_0x10302e){_0x311581=_0x10302e[_0x6027('0x35')]({'plain':!![]});_0x331dc7['model']=_[_0x6027('0x41')](db[_0x6027('0x61')][_0x6027('0x55')]);_0x331dc7[_0x6027('0x42')]=_[_0x6027('0x41')](_0x213cde[_0x6027('0x42')]);_0x331dc7[_0x6027('0x4b')]=_[_0x6027('0x43')](_0x331dc7[_0x6027('0x40')],_0x331dc7[_0x6027('0x42')]);_0x2d87bf[_0x6027('0x44')]=_[_0x6027('0x43')](_0x331dc7[_0x6027('0x40')],qs[_0x6027('0x45')](_0x213cde[_0x6027('0x42')][_0x6027('0x45')]));_0x2d87bf[_0x6027('0x44')]=_0x2d87bf['attributes'][_0x6027('0x46')]?_0x2d87bf[_0x6027('0x44')]:_0x331dc7['model'];if(!_0x213cde[_0x6027('0x42')][_0x6027('0x47')](_0x6027('0x48'))){_0x2d87bf[_0x6027('0x2d')]=qs['limit'](_0x213cde[_0x6027('0x42')]['limit']);_0x2d87bf[_0x6027('0x30')]=qs[_0x6027('0x30')](_0x213cde['query'][_0x6027('0x30')]);}_0x2d87bf[_0x6027('0x62')]=qs[_0x6027('0x49')](_0x213cde[_0x6027('0x42')][_0x6027('0x49')]);_0x2d87bf[_0x6027('0x4a')]=qs['filters'](_[_0x6027('0x63')](_0x213cde[_0x6027('0x42')],_0x331dc7[_0x6027('0x4b')]));_0x2d87bf[_0x6027('0x4a')][_0x6027('0x64')]=_0x10302e['id'];if(_0x213cde[_0x6027('0x42')][_0x6027('0x4c')]){_0x2d87bf[_0x6027('0x4a')]=_[_0x6027('0x4d')](_0x2d87bf[_0x6027('0x4a')],{'$or':_[_0x6027('0x3c')](_0x2d87bf[_0x6027('0x44')],function(_0x4a9b5d){var _0x4975bc={};_0x4975bc[_0x4a9b5d]={'$like':'%'+_0x213cde[_0x6027('0x42')][_0x6027('0x4c')]+'%'};return _0x4975bc;})});}_0x2d87bf=_['merge']({},_0x2d87bf,_0x213cde[_0x6027('0x4e')]);return db[_0x6027('0x61')][_0x6027('0x51')](_0x2d87bf);}})[_0x6027('0x21')](function(_0x75e7e6){if(_0x75e7e6){return db['User'][_0x6027('0x65')]({'where':{'id':_['map'](_0x75e7e6,_0x6027('0x66')),'role':_0x6027('0x67')},'attributes':['id',_0x6027('0x3a'),_0x6027('0x68'),_0x6027('0x69'),_0x6027('0x6a')]});}})[_0x6027('0x21')](function(_0x496ca2){if(_0x496ca2){return{'count':_0x496ca2[_0x6027('0x2f')],'rows':_['map'](_0x496ca2['rows'],function(_0x42df06){return{'membername':_0x42df06[_0x6027('0x3a')],'UserId':_0x42df06['id'],'queue_name':_0x311581[_0x6027('0x3a')],'ChatQueueId':_0x311581['id'],'interface':util['format'](_0x6027('0x6b'),_0x6027('0x6c'),_0x42df06[_0x6027('0x3a')]),'penalty':0x0,'paused':_0x42df06['chatPause'],'createdAt':_0x42df06['createdAt'],'updatedAt':_0x42df06[_0x6027('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6027('0x21')](respondWithFilteredResult(_0x587319,_0x2d87bf))[_0x6027('0x2a')](handleError(_0x587319,null));};exports[_0x6027('0x6d')]=function(_0x13b0d8,_0x1a54cf,_0x3f7d32){var _0x5b9521={};var _0xdd3ffc={};var _0x1d4c02;var _0x3968de;return db[_0x6027('0x3d')][_0x6027('0x60')]({'where':{'id':_0x13b0d8['params']['id']}})[_0x6027('0x21')](handleEntityNotFound(_0x1a54cf,null))[_0x6027('0x21')](function(_0x21ac16){if(_0x21ac16){_0x1d4c02=_0x21ac16;_0xdd3ffc[_0x6027('0x40')]=_[_0x6027('0x41')](db[_0x6027('0x6e')]['rawAttributes']);_0xdd3ffc[_0x6027('0x42')]=_[_0x6027('0x41')](_0x13b0d8['query']);_0xdd3ffc[_0x6027('0x4b')]=_[_0x6027('0x43')](_0xdd3ffc['model'],_0xdd3ffc['query']);_0x5b9521[_0x6027('0x44')]=_[_0x6027('0x43')](_0xdd3ffc[_0x6027('0x40')],qs[_0x6027('0x45')](_0x13b0d8[_0x6027('0x42')][_0x6027('0x45')]));_0x5b9521[_0x6027('0x44')]=_0x5b9521[_0x6027('0x44')][_0x6027('0x46')]?_0x5b9521['attributes']:_0xdd3ffc[_0x6027('0x40')];_0x5b9521[_0x6027('0x62')]=qs[_0x6027('0x49')](_0x13b0d8[_0x6027('0x42')][_0x6027('0x49')]);_0x5b9521[_0x6027('0x4a')]=qs[_0x6027('0x4b')](_['pick'](_0x13b0d8[_0x6027('0x42')],_0xdd3ffc[_0x6027('0x4b')]));if(_0x13b0d8[_0x6027('0x42')][_0x6027('0x4c')]){_0x5b9521[_0x6027('0x4a')]=_[_0x6027('0x4d')](_0x5b9521[_0x6027('0x4a')],{'$or':_[_0x6027('0x3c')](_0x5b9521[_0x6027('0x44')],function(_0x578e3d){var _0xd5cd16={};_0xd5cd16[_0x578e3d]={'$like':'%'+_0x13b0d8[_0x6027('0x42')]['filter']+'%'};return _0xd5cd16;})});}_0x5b9521=_[_0x6027('0x4d')]({},_0x5b9521,_0x13b0d8[_0x6027('0x4e')]);return _0x1d4c02[_0x6027('0x6d')](_0x5b9521);}})['then'](function(_0x4e5ca9){if(_0x4e5ca9){_0x3968de=_0x4e5ca9[_0x6027('0x46')];if(!_0x13b0d8[_0x6027('0x42')][_0x6027('0x47')](_0x6027('0x48'))){_0x5b9521[_0x6027('0x2d')]=qs[_0x6027('0x2d')](_0x13b0d8[_0x6027('0x42')][_0x6027('0x2d')]);_0x5b9521['offset']=qs[_0x6027('0x30')](_0x13b0d8[_0x6027('0x42')][_0x6027('0x30')]);}return _0x1d4c02['getTeams'](_0x5b9521);}})[_0x6027('0x21')](function(_0x1fb92a){if(_0x1fb92a){return _0x1fb92a?{'count':_0x3968de,'rows':_0x1fb92a}:null;}})[_0x6027('0x21')](respondWithResult(_0x1a54cf,null))[_0x6027('0x2a')](handleError(_0x1a54cf,null));};exports[_0x6027('0x6f')]=function(_0x4d0e78,_0x11e9c2,_0x137cbe){var _0x34fb4d=_0x4d0e78[_0x6027('0x58')]['ids'];return db[_0x6027('0x6e')][_0x6027('0x51')]({'where':{'id':_0x34fb4d},'attributes':['id'],'include':[{'model':db[_0x6027('0x70')],'as':_0x6027('0x71'),'attributes':['id',_0x6027('0x3a'),_0x6027('0x72'),'voicePause',_0x6027('0x73')],'raw':!![]}]})[_0x6027('0x21')](function(_0x296c00){if(_0x296c00){var _0x3cc1fc=_['flatMap'](_0x296c00,function(_0x3b4a80){var _0xbe4621=_0x3b4a80[_0x6027('0x35')]({'plain':!![]});return _0xbe4621[_0x6027('0x71')];});return db[_0x6027('0x3d')][_0x6027('0x56')]({'where':{'id':_0x4d0e78[_0x6027('0x54')]['id']}})[_0x6027('0x21')](function(_0x38decf){return db['sequelize'][_0x6027('0x74')](function(_0x19cc5b){return _0x38decf[_0x6027('0x6f')](_0x34fb4d,{'transaction':_0x19cc5b})[_0x6027('0x21')](function(){return BPromise[_0x6027('0x75')](_0x3cc1fc,function(_0x447421){return db['UserChatQueue'][_0x6027('0x76')]({'where':{'UserId':_0x447421['id'],'ChatQueueId':_0x4d0e78['params']['id']},'transaction':_0x19cc5b});});})[_0x6027('0x21')](function(){_0x3cc1fc[_0x6027('0x77')](function(_0xa91a72){socket[_0x6027('0x78')]('userChatQueue:save',{'UserId':_0xa91a72['id'],'ChatQueueId':_0x38decf['id']});});});});});}})[_0x6027('0x21')](respondWithStatusCode(_0x11e9c2,null))[_0x6027('0x2a')](handleError(_0x11e9c2,null));};exports[_0x6027('0x79')]=function(_0x345b2c,_0x50b4ee,_0x36af3c){return db[_0x6027('0x6e')][_0x6027('0x51')]({'where':{'id':_0x345b2c['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6027('0x71'),'attributes':['id'],'raw':!![]}]})[_0x6027('0x21')](handleEntityNotFound(_0x50b4ee,null))['then'](function(_0x1ed56f){var _0x1e03c9=_[_0x6027('0x3c')](_0x1ed56f,'id');var _0x3f20cd=[];var _0x5939f7=[];var _0x264c3d=squel[_0x6027('0x7a')]();_0x264c3d['field']('tq.TeamId')[_0x6027('0x7b')](_0x6027('0x7c'),'tq')[_0x6027('0x7d')]('user_has_teams','ut',_0x6027('0x7e'))[_0x6027('0x4a')]('ChatQueueId\x20=\x20?',_0x345b2c['params']['id']);for(var _0x2e13d0=0x0;_0x2e13d0<_0x1ed56f['length'];_0x2e13d0+=0x1){let _0x57000d=_0x1ed56f[_0x2e13d0];for(var _0x3b5781=0x0;_0x3b5781<_0x57000d['Agents'][_0x6027('0x46')];_0x3b5781+=0x1){let _0x217115=_0x57000d[_0x6027('0x71')][_0x3b5781];var _0x4bf6be=_0x264c3d['clone']();_0x4bf6be[_0x6027('0x4a')](_0x6027('0x7f'),_0x217115['id']);_0x5939f7[_0x6027('0x80')](db[_0x6027('0x81')][_0x6027('0x42')](_0x4bf6be['toString'](),{'type':db[_0x6027('0x81')]['QueryTypes'][_0x6027('0x82')]})[_0x6027('0x21')](function(_0x7ed5d){if(_0x7ed5d[_0x6027('0x46')]===0x1){return _0x217115['id'];}else{var _0x3bb9db=_[_0x6027('0x83')](_[_0x6027('0x3c')](_0x7ed5d,'TeamId'),function(_0x121c50){return _[_0x6027('0x84')](_0x1e03c9,_0x121c50);});if(_0x3bb9db){return _0x217115['id'];}}}));}}return BPromise[_0x6027('0x85')](_0x5939f7)[_0x6027('0x21')](function(_0x5b2237){_0x3f20cd=_(_0x3f20cd)[_0x6027('0x86')](_0x5b2237)[_0x6027('0x87')]()[_0x6027('0x88')]();return db['ChatQueue'][_0x6027('0x56')]({'where':{'id':_0x345b2c[_0x6027('0x54')]['id']}})['then'](function(_0x268866){return db['sequelize'][_0x6027('0x74')](function(_0x194298){return _0x268866[_0x6027('0x79')](_0x345b2c['query'][_0x6027('0x89')],{'transaction':_0x194298})[_0x6027('0x21')](function(){if(!_[_0x6027('0x8a')](_0x3f20cd)){return _0x268866['removeAgents'](_0x3f20cd,{'transaction':_0x194298});}})[_0x6027('0x21')](function(){_0x3f20cd[_0x6027('0x77')](function(_0x4b1b28){socket['emit'](_0x6027('0x8b'),{'UserId':_0x4b1b28,'ChatQueueId':_0x268866['id']});});});});});});})[_0x6027('0x21')](respondWithStatusCode(_0x50b4ee,null))['catch'](handleError(_0x50b4ee,null));};exports['addAgents']=function(_0x484fee,_0x5cd696,_0x46caa1){return db[_0x6027('0x3d')]['find']({'where':{'id':_0x484fee[_0x6027('0x54')]['id']}})[_0x6027('0x21')](handleEntityNotFound(_0x5cd696,null))[_0x6027('0x21')](function(_0x533d35){if(_0x533d35){return _0x533d35[_0x6027('0x8c')](_0x484fee[_0x6027('0x58')][_0x6027('0x89')],_[_0x6027('0x8d')](_0x484fee['body'],[_0x6027('0x89'),'id'])||{})[_0x6027('0x8e')](function(_0x4ef42d){for(var _0x2609fe=0x0;_0x2609fe<_0x484fee['body'][_0x6027('0x89')][_0x6027('0x46')];_0x2609fe+=0x1){socket['emit']('userChatQueue:save',{'UserId':Number(_0x484fee[_0x6027('0x58')]['ids'][_0x2609fe]),'ChatQueueId':Number(_0x484fee[_0x6027('0x54')]['id'])});}return _0x4ef42d;});}})[_0x6027('0x21')](respondWithResult(_0x5cd696,null))[_0x6027('0x2a')](handleError(_0x5cd696,null));};exports[_0x6027('0x8f')]=function(_0x573259,_0xcb244a,_0x13e09b){return db[_0x6027('0x3d')][_0x6027('0x56')]({'where':{'id':_0x573259[_0x6027('0x54')]['id']}})[_0x6027('0x21')](handleEntityNotFound(_0xcb244a,null))[_0x6027('0x21')](function(_0xf715fd){if(_0xf715fd){return _0xf715fd[_0x6027('0x8f')](_0x573259[_0x6027('0x42')][_0x6027('0x89')])[_0x6027('0x21')](function(){if(_[_0x6027('0x90')](_0x573259[_0x6027('0x42')][_0x6027('0x89')])){for(var _0x54fc26=0x0;_0x54fc26<_0x573259[_0x6027('0x42')][_0x6027('0x89')]['length'];_0x54fc26+=0x1){socket['emit'](_0x6027('0x8b'),{'UserId':Number(_0x573259[_0x6027('0x42')][_0x6027('0x89')][_0x54fc26]),'ChatQueueId':Number(_0x573259[_0x6027('0x54')]['id'])});}}else{socket[_0x6027('0x78')](_0x6027('0x8b'),{'UserId':Number(_0x573259[_0x6027('0x42')][_0x6027('0x89')]),'ChatQueueId':Number(_0x573259[_0x6027('0x54')]['id'])});}});}})[_0x6027('0x21')](respondWithStatusCode(_0xcb244a,null))[_0x6027('0x2a')](handleError(_0xcb244a,null));};exports[_0x6027('0x91')]=function(_0x3e00ef,_0x3cc115,_0xcac987){var _0x44aab9={};var _0x39250e={};var _0x104d62;var _0x55266d;return db[_0x6027('0x3d')][_0x6027('0x60')]({'where':{'id':_0x3e00ef['params']['id']}})['then'](handleEntityNotFound(_0x3cc115,null))[_0x6027('0x21')](function(_0x271b80){if(_0x271b80){_0x104d62=_0x271b80;_0x39250e[_0x6027('0x40')]=_['keys'](db[_0x6027('0x70')]['rawAttributes']);_0x39250e[_0x6027('0x42')]=_[_0x6027('0x41')](_0x3e00ef[_0x6027('0x42')]);_0x39250e[_0x6027('0x4b')]=_[_0x6027('0x43')](_0x39250e[_0x6027('0x40')],_0x39250e['query']);_0x44aab9[_0x6027('0x44')]=_[_0x6027('0x43')](_0x39250e[_0x6027('0x40')],qs[_0x6027('0x45')](_0x3e00ef[_0x6027('0x42')][_0x6027('0x45')]));_0x44aab9['attributes']=_0x44aab9[_0x6027('0x44')][_0x6027('0x46')]?_0x44aab9[_0x6027('0x44')]:_0x39250e[_0x6027('0x40')];_0x44aab9[_0x6027('0x62')]=qs[_0x6027('0x49')](_0x3e00ef[_0x6027('0x42')]['sort']);_0x44aab9[_0x6027('0x4a')]=qs[_0x6027('0x4b')](_[_0x6027('0x63')](_0x3e00ef[_0x6027('0x42')],_0x39250e['filters']));if(_0x3e00ef['query'][_0x6027('0x4c')]){_0x44aab9[_0x6027('0x4a')]=_[_0x6027('0x4d')](_0x44aab9[_0x6027('0x4a')],{'$or':_[_0x6027('0x3c')](_0x44aab9[_0x6027('0x44')],function(_0x17d10){var _0x5e0c6b={};_0x5e0c6b[_0x17d10]={'$like':'%'+_0x3e00ef['query'][_0x6027('0x4c')]+'%'};return _0x5e0c6b;})});}_0x44aab9=_[_0x6027('0x4d')]({},_0x44aab9,_0x3e00ef[_0x6027('0x4e')]);return _0x104d62[_0x6027('0x91')](_0x44aab9);}})[_0x6027('0x21')](function(_0x1a6ec2){if(_0x1a6ec2){_0x55266d=_0x1a6ec2[_0x6027('0x46')];if(!_0x3e00ef[_0x6027('0x42')][_0x6027('0x47')](_0x6027('0x48'))){_0x44aab9[_0x6027('0x2d')]=qs[_0x6027('0x2d')](_0x3e00ef[_0x6027('0x42')]['limit']);_0x44aab9[_0x6027('0x30')]=qs['offset'](_0x3e00ef[_0x6027('0x42')][_0x6027('0x30')]);}return _0x104d62[_0x6027('0x91')](_0x44aab9);}})[_0x6027('0x21')](function(_0x5e42c8){if(_0x5e42c8){return _0x5e42c8?{'count':_0x55266d,'rows':_0x5e42c8}:null;}})[_0x6027('0x21')](respondWithResult(_0x3cc115,null))[_0x6027('0x2a')](handleError(_0x3cc115,null));}; \ No newline at end of file +var _0x5d46=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','./chatQueue.socket','register','jayson/promise','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','reject','save','get','ChatQueues','UserProfileResource','destroy','stack','name','send','index','map','ChatQueue','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserChatQueue','ChatQueueId','User','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','online','voicePause','flatMap','Agents','sequelize','each','forEach','emit','userChatQueue:save','ids','select','field','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','SELECT','every','all','compact','value','transaction','removeTeams','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs'];(function(_0x170559,_0x1c42be){var _0x56b471=function(_0xffe802){while(--_0xffe802){_0x170559['push'](_0x170559['shift']());}};_0x56b471(++_0x1c42be);}(_0x5d46,0x10e));var _0x65d4=function(_0x13772b,_0x97743b){_0x13772b=_0x13772b-0x0;var _0x2b27e9=_0x5d46[_0x13772b];return _0x2b27e9;};'use strict';var emlformat=require(_0x65d4('0x0'));var rimraf=require(_0x65d4('0x1'));var zipdir=require(_0x65d4('0x2'));var jsonpatch=require(_0x65d4('0x3'));var rp=require(_0x65d4('0x4'));var moment=require(_0x65d4('0x5'));var BPromise=require(_0x65d4('0x6'));var Mustache=require(_0x65d4('0x7'));var util=require(_0x65d4('0x8'));var path=require(_0x65d4('0x9'));var sox=require('sox');var csv=require(_0x65d4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x65d4('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x65d4('0xc'));var jsforce=require(_0x65d4('0xd'));var deskjs=require(_0x65d4('0xe'));var toCsv=require(_0x65d4('0xa'));var querystring=require('querystring');var Papa=require(_0x65d4('0xf'));var Redis=require(_0x65d4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x65d4('0x11'));var as=require(_0x65d4('0x12'));var hardwareService=require(_0x65d4('0x13'));var logger=require(_0x65d4('0x14'))(_0x65d4('0x15'));var utils=require('../../config/utils');var config=require(_0x65d4('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x65d4('0x17')](config['redis'],{'host':_0x65d4('0x18'),'port':0x18eb});var socket=require(_0x65d4('0x19'))(new Redis(config[_0x65d4('0x1a')]));require(_0x65d4('0x1b'))[_0x65d4('0x1c')](socket);var jayson=require(_0x65d4('0x1d'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x21f054,_0x5955b9,_0xa6ab99,_0x3e49d9){return new BPromise(function(_0x374b31,_0x22b75e){var _0x25f9e3=_0x3e49d9||client;return _0x25f9e3['request'](_0x21f054,_0xa6ab99)[_0x65d4('0x1e')](function(_0x56dfad){logger[_0x65d4('0x1f')](_0x65d4('0x20'),_0x5955b9,_0x65d4('0x21'));logger[_0x65d4('0x22')](_0x65d4('0x23'),_0x5955b9,_0x65d4('0x21'),JSON['stringify'](_0x56dfad));if(_0x56dfad['error']){if(_0x56dfad[_0x65d4('0x24')][_0x65d4('0x25')]===0x1f4){logger['error'](_0x65d4('0x20'),_0x5955b9,_0x56dfad[_0x65d4('0x24')][_0x65d4('0x26')]);return _0x22b75e(_0x56dfad[_0x65d4('0x24')][_0x65d4('0x26')]);}logger['error'](_0x65d4('0x20'),_0x5955b9,_0x56dfad['error'][_0x65d4('0x26')]);return _0x374b31(_0x56dfad[_0x65d4('0x24')][_0x65d4('0x26')]);}else{logger[_0x65d4('0x1f')](_0x65d4('0x20'),_0x5955b9,_0x65d4('0x21'));_0x374b31(_0x56dfad[_0x65d4('0x27')][_0x65d4('0x26')]);}})[_0x65d4('0x28')](function(_0x3d655e){logger['error'](_0x65d4('0x20'),_0x5955b9,_0x3d655e);_0x22b75e(_0x3d655e);});});}function respondWithStatusCode(_0x42b06f,_0x56c5f3){_0x56c5f3=_0x56c5f3||0xcc;return function(_0x42304b){if(_0x42304b){return _0x42b06f[_0x65d4('0x29')](_0x56c5f3);}return _0x42b06f[_0x65d4('0x2a')](_0x56c5f3)[_0x65d4('0x2b')]();};}function respondWithResult(_0x5311e0,_0x760dfe){_0x760dfe=_0x760dfe||0xc8;return function(_0x1a5bf6){if(_0x1a5bf6){return _0x5311e0[_0x65d4('0x2a')](_0x760dfe)[_0x65d4('0x2c')](_0x1a5bf6);}};}function respondWithFilteredResult(_0x2cf012,_0x116d9e){return function(_0x20555f){if(_0x20555f){var _0x42136b=typeof _0x116d9e['offset']===_0x65d4('0x2d')&&typeof _0x116d9e[_0x65d4('0x2e')]==='undefined';var _0x2df620=_0x20555f['count'];var _0x1a4228=_0x42136b?0x0:_0x116d9e['offset'];var _0x55e580=_0x42136b?_0x20555f[_0x65d4('0x2f')]:_0x116d9e[_0x65d4('0x30')]+_0x116d9e[_0x65d4('0x2e')];var _0x5a9cd9;if(_0x55e580>=_0x2df620){_0x55e580=_0x2df620;_0x5a9cd9=0xc8;}else{_0x5a9cd9=0xce;}_0x2cf012[_0x65d4('0x2a')](_0x5a9cd9);return _0x2cf012['set']('Content-Range',_0x1a4228+'-'+_0x55e580+'/'+_0x2df620)[_0x65d4('0x2c')](_0x20555f);}return null;};}function patchUpdates(_0x4a022f){return function(_0xe48039){try{jsonpatch['apply'](_0xe48039,_0x4a022f,!![]);}catch(_0x3efc3e){return BPromise[_0x65d4('0x31')](_0x3efc3e);}return _0xe48039[_0x65d4('0x32')]();};}function saveUpdates(_0x2c84b3,_0x33a495){return function(_0x3300e9){if(_0x3300e9){return _0x3300e9['update'](_0x2c84b3)[_0x65d4('0x1e')](function(_0x23de05){return _0x23de05;});}return null;};}function removeEntity(_0x59ecae,_0x228e76){return function(_0x183fd4){if(_0x183fd4){return _0x183fd4['destroy']()[_0x65d4('0x1e')](function(){var _0x1509e5=_0x183fd4[_0x65d4('0x33')]({'plain':!![]});var _0x3bd20c=_0x65d4('0x34');return db[_0x65d4('0x35')][_0x65d4('0x36')]({'where':{'type':_0x3bd20c,'resourceId':_0x1509e5['id']}})[_0x65d4('0x1e')](function(){return _0x183fd4;});})['then'](function(){_0x59ecae[_0x65d4('0x2a')](0xcc)[_0x65d4('0x2b')]();});}};}function handleEntityNotFound(_0x205306,_0x1dedbb){return function(_0x40ce4b){if(!_0x40ce4b){_0x205306[_0x65d4('0x29')](0x194);}return _0x40ce4b;};}function handleError(_0x5ef913,_0x1d068b){_0x1d068b=_0x1d068b||0x1f4;return function(_0x27b44b){logger[_0x65d4('0x24')](_0x27b44b[_0x65d4('0x37')]);if(_0x27b44b[_0x65d4('0x38')]){delete _0x27b44b[_0x65d4('0x38')];}_0x5ef913[_0x65d4('0x2a')](_0x1d068b)[_0x65d4('0x39')](_0x27b44b);};}exports[_0x65d4('0x3a')]=function(_0x407482,_0x45f60b){var _0x295634={},_0x5637bd={},_0x5cde4c={'count':0x0,'rows':[]};var _0x5969b7=_[_0x65d4('0x3b')](db[_0x65d4('0x3c')]['rawAttributes'],function(_0x195ed6){return{'name':_0x195ed6[_0x65d4('0x3d')],'type':_0x195ed6['type'][_0x65d4('0x3e')]};});_0x5637bd[_0x65d4('0x3f')]=_['map'](_0x5969b7,_0x65d4('0x38'));_0x5637bd[_0x65d4('0x40')]=_['keys'](_0x407482['query']);_0x5637bd[_0x65d4('0x41')]=_[_0x65d4('0x42')](_0x5637bd[_0x65d4('0x3f')],_0x5637bd['query']);_0x295634[_0x65d4('0x43')]=_[_0x65d4('0x42')](_0x5637bd['model'],qs[_0x65d4('0x44')](_0x407482[_0x65d4('0x40')][_0x65d4('0x44')]));_0x295634[_0x65d4('0x43')]=_0x295634['attributes'][_0x65d4('0x45')]?_0x295634[_0x65d4('0x43')]:_0x5637bd['model'];if(!_0x407482['query'][_0x65d4('0x46')](_0x65d4('0x47'))){_0x295634[_0x65d4('0x2e')]=qs[_0x65d4('0x2e')](_0x407482[_0x65d4('0x40')][_0x65d4('0x2e')]);_0x295634[_0x65d4('0x30')]=qs['offset'](_0x407482[_0x65d4('0x40')]['offset']);}_0x295634[_0x65d4('0x48')]=qs[_0x65d4('0x49')](_0x407482[_0x65d4('0x40')][_0x65d4('0x49')]);_0x295634[_0x65d4('0x4a')]=qs[_0x65d4('0x41')](_[_0x65d4('0x4b')](_0x407482[_0x65d4('0x40')],_0x5637bd[_0x65d4('0x41')]),_0x5969b7);if(_0x407482[_0x65d4('0x40')][_0x65d4('0x4c')]){_0x295634[_0x65d4('0x4a')]=_[_0x65d4('0x4d')](_0x295634[_0x65d4('0x4a')],{'$or':_['map'](_0x5969b7,function(_0x478557){if(_0x478557['type']!==_0x65d4('0x4e')){var _0x11e65d={};_0x11e65d[_0x478557[_0x65d4('0x38')]]={'$like':'%'+_0x407482['query'][_0x65d4('0x4c')]+'%'};return _0x11e65d;}})});}_0x295634=_['merge']({},_0x295634,_0x407482[_0x65d4('0x4f')]);var _0xd48438={'where':_0x295634[_0x65d4('0x4a')]};return db[_0x65d4('0x3c')][_0x65d4('0x2f')](_0xd48438)[_0x65d4('0x1e')](function(_0x46955c){_0x5cde4c[_0x65d4('0x2f')]=_0x46955c;if(_0x407482['query'][_0x65d4('0x50')]){_0x295634[_0x65d4('0x51')]=[{'all':!![]}];}return db['ChatQueue'][_0x65d4('0x52')](_0x295634);})[_0x65d4('0x1e')](function(_0xc57326){_0x5cde4c[_0x65d4('0x53')]=_0xc57326;return _0x5cde4c;})[_0x65d4('0x1e')](respondWithFilteredResult(_0x45f60b,_0x295634))[_0x65d4('0x28')](handleError(_0x45f60b,null));};exports['show']=function(_0x1b9f9a,_0x1aaeb4){var _0x50735e={'raw':!![],'where':{'id':_0x1b9f9a[_0x65d4('0x54')]['id']}},_0x2d0d78={};_0x2d0d78[_0x65d4('0x3f')]=_[_0x65d4('0x55')](db[_0x65d4('0x3c')][_0x65d4('0x56')]);_0x2d0d78[_0x65d4('0x40')]=_[_0x65d4('0x55')](_0x1b9f9a['query']);_0x2d0d78['filters']=_[_0x65d4('0x42')](_0x2d0d78[_0x65d4('0x3f')],_0x2d0d78[_0x65d4('0x40')]);_0x50735e['attributes']=_[_0x65d4('0x42')](_0x2d0d78['model'],qs[_0x65d4('0x44')](_0x1b9f9a[_0x65d4('0x40')]['fields']));_0x50735e['attributes']=_0x50735e[_0x65d4('0x43')]['length']?_0x50735e[_0x65d4('0x43')]:_0x2d0d78[_0x65d4('0x3f')];if(_0x1b9f9a[_0x65d4('0x40')][_0x65d4('0x50')]){_0x50735e['include']=[{'all':!![]}];}_0x50735e=_[_0x65d4('0x4d')]({},_0x50735e,_0x1b9f9a[_0x65d4('0x4f')]);return db[_0x65d4('0x3c')]['find'](_0x50735e)[_0x65d4('0x1e')](handleEntityNotFound(_0x1aaeb4,null))['then'](respondWithResult(_0x1aaeb4,null))['catch'](handleError(_0x1aaeb4,null));};exports['create']=function(_0x125a59,_0x16ab17){return db[_0x65d4('0x3c')][_0x65d4('0x57')](_0x125a59[_0x65d4('0x58')],{})[_0x65d4('0x1e')](function(_0x517067){var _0x3331f1=_0x125a59[_0x65d4('0x59')][_0x65d4('0x33')]({'plain':!![]});if(!_0x3331f1)throw new Error(_0x65d4('0x5a'));if(_0x3331f1[_0x65d4('0x5b')]==='user'){var _0x404c17=_0x517067[_0x65d4('0x33')]({'plain':!![]});var _0x257b19=_0x65d4('0x34');return db[_0x65d4('0x5c')][_0x65d4('0x5d')]({'where':{'name':_0x257b19,'userProfileId':_0x3331f1['userProfileId']},'raw':!![]})[_0x65d4('0x1e')](function(_0x402820){if(_0x402820&&_0x402820[_0x65d4('0x5e')]===0x0){return db[_0x65d4('0x35')][_0x65d4('0x57')]({'name':_0x404c17['name'],'resourceId':_0x404c17['id'],'type':_0x402820[_0x65d4('0x38')],'sectionId':_0x402820['id']},{})[_0x65d4('0x1e')](function(){return _0x517067;});}else{return _0x517067;}})[_0x65d4('0x28')](function(_0x4bac5e){logger[_0x65d4('0x24')](_0x65d4('0x5f'),_0x4bac5e);throw _0x4bac5e;});}return _0x517067;})[_0x65d4('0x1e')](respondWithResult(_0x16ab17,0xc9))[_0x65d4('0x28')](handleError(_0x16ab17,null));};exports[_0x65d4('0x60')]=function(_0x59b035,_0x2ae839){if(_0x59b035['body']['id']){delete _0x59b035[_0x65d4('0x58')]['id'];}return db[_0x65d4('0x3c')]['find']({'where':{'id':_0x59b035['params']['id']}})[_0x65d4('0x1e')](handleEntityNotFound(_0x2ae839,null))[_0x65d4('0x1e')](saveUpdates(_0x59b035[_0x65d4('0x58')],null))[_0x65d4('0x1e')](respondWithResult(_0x2ae839,null))[_0x65d4('0x28')](handleError(_0x2ae839,null));};exports[_0x65d4('0x36')]=function(_0x1f9fb7,_0x50c598){return db[_0x65d4('0x3c')][_0x65d4('0x5d')]({'where':{'id':_0x1f9fb7[_0x65d4('0x54')]['id']}})[_0x65d4('0x1e')](handleEntityNotFound(_0x50c598,null))[_0x65d4('0x1e')](removeEntity(_0x50c598,null))[_0x65d4('0x28')](handleError(_0x50c598,null));};exports['describe']=function(_0x5ad53c,_0x387c34){return db[_0x65d4('0x3c')][_0x65d4('0x61')]()['then'](respondWithResult(_0x387c34,null))[_0x65d4('0x28')](handleError(_0x387c34,null));};exports[_0x65d4('0x62')]=function(_0x5286ef,_0x54bdb3,_0x216058){var _0x34bda2={'raw':!![],'where':{}},_0x66a9ce={},_0x18f9f3;return db[_0x65d4('0x3c')][_0x65d4('0x63')]({'where':{'id':_0x5286ef[_0x65d4('0x54')]['id']}})[_0x65d4('0x1e')](handleEntityNotFound(_0x54bdb3,null))[_0x65d4('0x1e')](function(_0x42f355){if(_0x42f355){_0x18f9f3=_0x42f355[_0x65d4('0x33')]({'plain':!![]});_0x66a9ce[_0x65d4('0x3f')]=_[_0x65d4('0x55')](db[_0x65d4('0x64')]['rawAttributes']);_0x66a9ce[_0x65d4('0x40')]=_[_0x65d4('0x55')](_0x5286ef[_0x65d4('0x40')]);_0x66a9ce[_0x65d4('0x41')]=_[_0x65d4('0x42')](_0x66a9ce[_0x65d4('0x3f')],_0x66a9ce[_0x65d4('0x40')]);_0x34bda2['attributes']=_[_0x65d4('0x42')](_0x66a9ce[_0x65d4('0x3f')],qs[_0x65d4('0x44')](_0x5286ef[_0x65d4('0x40')][_0x65d4('0x44')]));_0x34bda2['attributes']=_0x34bda2[_0x65d4('0x43')]['length']?_0x34bda2[_0x65d4('0x43')]:_0x66a9ce[_0x65d4('0x3f')];if(!_0x5286ef[_0x65d4('0x40')][_0x65d4('0x46')]('nolimit')){_0x34bda2[_0x65d4('0x2e')]=qs[_0x65d4('0x2e')](_0x5286ef[_0x65d4('0x40')]['limit']);_0x34bda2[_0x65d4('0x30')]=qs[_0x65d4('0x30')](_0x5286ef[_0x65d4('0x40')][_0x65d4('0x30')]);}_0x34bda2['order']=qs[_0x65d4('0x49')](_0x5286ef[_0x65d4('0x40')][_0x65d4('0x49')]);_0x34bda2[_0x65d4('0x4a')]=qs[_0x65d4('0x41')](_['pick'](_0x5286ef[_0x65d4('0x40')],_0x66a9ce['filters']));_0x34bda2[_0x65d4('0x4a')][_0x65d4('0x65')]=_0x42f355['id'];if(_0x5286ef[_0x65d4('0x40')][_0x65d4('0x4c')]){_0x34bda2[_0x65d4('0x4a')]=_[_0x65d4('0x4d')](_0x34bda2[_0x65d4('0x4a')],{'$or':_[_0x65d4('0x3b')](_0x34bda2['attributes'],function(_0x191a4a){var _0x34ac65={};_0x34ac65[_0x191a4a]={'$like':'%'+_0x5286ef['query'][_0x65d4('0x4c')]+'%'};return _0x34ac65;})});}_0x34bda2=_[_0x65d4('0x4d')]({},_0x34bda2,_0x5286ef[_0x65d4('0x4f')]);return db[_0x65d4('0x64')][_0x65d4('0x52')](_0x34bda2);}})[_0x65d4('0x1e')](function(_0x3da9db){if(_0x3da9db){return db[_0x65d4('0x66')]['findAndCountAll']({'where':{'id':_[_0x65d4('0x3b')](_0x3da9db,'UserId'),'role':_0x65d4('0x67')},'attributes':['id',_0x65d4('0x38'),_0x65d4('0x68'),_0x65d4('0x69'),_0x65d4('0x6a')]});}})[_0x65d4('0x1e')](function(_0x1efa37){if(_0x1efa37){return{'count':_0x1efa37[_0x65d4('0x2f')],'rows':_['map'](_0x1efa37[_0x65d4('0x53')],function(_0x30a0d3){return{'membername':_0x30a0d3[_0x65d4('0x38')],'UserId':_0x30a0d3['id'],'queue_name':_0x18f9f3['name'],'ChatQueueId':_0x18f9f3['id'],'interface':util['format'](_0x65d4('0x6b'),_0x65d4('0x6c'),_0x30a0d3[_0x65d4('0x38')]),'penalty':0x0,'paused':_0x30a0d3[_0x65d4('0x68')],'createdAt':_0x30a0d3['createdAt'],'updatedAt':_0x30a0d3[_0x65d4('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x65d4('0x1e')](respondWithFilteredResult(_0x54bdb3,_0x34bda2))[_0x65d4('0x28')](handleError(_0x54bdb3,null));};exports[_0x65d4('0x6d')]=function(_0x2a4a5a,_0x463007,_0x4a6905){var _0x903999={};var _0x5c357d={};var _0x2dc710;var _0x4dfc23;return db[_0x65d4('0x3c')]['findOne']({'where':{'id':_0x2a4a5a[_0x65d4('0x54')]['id']}})[_0x65d4('0x1e')](handleEntityNotFound(_0x463007,null))[_0x65d4('0x1e')](function(_0x23ff96){if(_0x23ff96){_0x2dc710=_0x23ff96;_0x5c357d[_0x65d4('0x3f')]=_[_0x65d4('0x55')](db[_0x65d4('0x6e')]['rawAttributes']);_0x5c357d[_0x65d4('0x40')]=_[_0x65d4('0x55')](_0x2a4a5a[_0x65d4('0x40')]);_0x5c357d[_0x65d4('0x41')]=_[_0x65d4('0x42')](_0x5c357d['model'],_0x5c357d[_0x65d4('0x40')]);_0x903999[_0x65d4('0x43')]=_[_0x65d4('0x42')](_0x5c357d[_0x65d4('0x3f')],qs['fields'](_0x2a4a5a[_0x65d4('0x40')][_0x65d4('0x44')]));_0x903999['attributes']=_0x903999[_0x65d4('0x43')]['length']?_0x903999[_0x65d4('0x43')]:_0x5c357d[_0x65d4('0x3f')];_0x903999['order']=qs[_0x65d4('0x49')](_0x2a4a5a[_0x65d4('0x40')][_0x65d4('0x49')]);_0x903999['where']=qs[_0x65d4('0x41')](_[_0x65d4('0x4b')](_0x2a4a5a['query'],_0x5c357d[_0x65d4('0x41')]));if(_0x2a4a5a[_0x65d4('0x40')]['filter']){_0x903999['where']=_[_0x65d4('0x4d')](_0x903999[_0x65d4('0x4a')],{'$or':_[_0x65d4('0x3b')](_0x903999['attributes'],function(_0x45e9c1){var _0x3950af={};_0x3950af[_0x45e9c1]={'$like':'%'+_0x2a4a5a['query']['filter']+'%'};return _0x3950af;})});}_0x903999=_[_0x65d4('0x4d')]({},_0x903999,_0x2a4a5a[_0x65d4('0x4f')]);return _0x2dc710[_0x65d4('0x6d')](_0x903999);}})[_0x65d4('0x1e')](function(_0x2ab3b1){if(_0x2ab3b1){_0x4dfc23=_0x2ab3b1[_0x65d4('0x45')];if(!_0x2a4a5a[_0x65d4('0x40')][_0x65d4('0x46')](_0x65d4('0x47'))){_0x903999[_0x65d4('0x2e')]=qs[_0x65d4('0x2e')](_0x2a4a5a['query'][_0x65d4('0x2e')]);_0x903999[_0x65d4('0x30')]=qs[_0x65d4('0x30')](_0x2a4a5a[_0x65d4('0x40')][_0x65d4('0x30')]);}return _0x2dc710[_0x65d4('0x6d')](_0x903999);}})['then'](function(_0x326ae5){if(_0x326ae5){return _0x326ae5?{'count':_0x4dfc23,'rows':_0x326ae5}:null;}})[_0x65d4('0x1e')](respondWithResult(_0x463007,null))[_0x65d4('0x28')](handleError(_0x463007,null));};exports[_0x65d4('0x6f')]=function(_0xc766b8,_0xfac469,_0x1124d2){var _0x3e1eb0=_0xc766b8[_0x65d4('0x58')]['ids'];return db['Team'][_0x65d4('0x52')]({'where':{'id':_0x3e1eb0},'attributes':['id'],'include':[{'model':db[_0x65d4('0x66')],'as':'Agents','attributes':['id',_0x65d4('0x38'),_0x65d4('0x70'),_0x65d4('0x71'),'interface'],'raw':!![]}]})['then'](function(_0x3bd378){if(_0x3bd378){var _0x5eb46d=_[_0x65d4('0x72')](_0x3bd378,function(_0x2c109b){var _0x13c192=_0x2c109b[_0x65d4('0x33')]({'plain':!![]});return _0x13c192[_0x65d4('0x73')];});return db[_0x65d4('0x3c')][_0x65d4('0x5d')]({'where':{'id':_0xc766b8[_0x65d4('0x54')]['id']}})['then'](function(_0x26e2cc){return db[_0x65d4('0x74')]['transaction'](function(_0x1dc6da){return _0x26e2cc[_0x65d4('0x6f')](_0x3e1eb0,{'transaction':_0x1dc6da})[_0x65d4('0x1e')](function(){return BPromise[_0x65d4('0x75')](_0x5eb46d,function(_0x166cc8){return db[_0x65d4('0x64')]['findOrCreate']({'where':{'UserId':_0x166cc8['id'],'ChatQueueId':_0xc766b8['params']['id']},'transaction':_0x1dc6da});});})[_0x65d4('0x1e')](function(){_0x5eb46d[_0x65d4('0x76')](function(_0x4fc736){socket[_0x65d4('0x77')](_0x65d4('0x78'),{'UserId':_0x4fc736['id'],'ChatQueueId':_0x26e2cc['id']});});});});});}})[_0x65d4('0x1e')](respondWithStatusCode(_0xfac469,null))[_0x65d4('0x28')](handleError(_0xfac469,null));};exports['removeTeams']=function(_0x47272e,_0x1e1717,_0x306f50){return db[_0x65d4('0x6e')][_0x65d4('0x52')]({'where':{'id':_0x47272e[_0x65d4('0x40')][_0x65d4('0x79')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x65d4('0x73'),'attributes':['id'],'raw':!![]}]})[_0x65d4('0x1e')](handleEntityNotFound(_0x1e1717,null))['then'](function(_0x44ce96){var _0x22c638=_[_0x65d4('0x3b')](_0x44ce96,'id');var _0x198372=[];var _0x5b46cd=[];var _0x3af4a8=squel[_0x65d4('0x7a')]();_0x3af4a8[_0x65d4('0x7b')]('tq.TeamId')['from'](_0x65d4('0x7c'),'tq')[_0x65d4('0x7d')](_0x65d4('0x7e'),'ut',_0x65d4('0x7f'))[_0x65d4('0x4a')](_0x65d4('0x80'),_0x47272e['params']['id']);for(var _0x5cfb03=0x0;_0x5cfb03<_0x44ce96['length'];_0x5cfb03+=0x1){let _0x3fc123=_0x44ce96[_0x5cfb03];for(var _0x2fa2f7=0x0;_0x2fa2f7<_0x3fc123[_0x65d4('0x73')][_0x65d4('0x45')];_0x2fa2f7+=0x1){let _0x3e3058=_0x3fc123[_0x65d4('0x73')][_0x2fa2f7];var _0x49519e=_0x3af4a8['clone']();_0x49519e[_0x65d4('0x4a')]('ut.UserId\x20=\x20?',_0x3e3058['id']);_0x5b46cd['push'](db['sequelize'][_0x65d4('0x40')](_0x49519e['toString'](),{'type':db[_0x65d4('0x74')]['QueryTypes'][_0x65d4('0x81')]})[_0x65d4('0x1e')](function(_0x2ae90b){if(_0x2ae90b[_0x65d4('0x45')]===0x1){return _0x3e3058['id'];}else{var _0xb46848=_[_0x65d4('0x82')](_[_0x65d4('0x3b')](_0x2ae90b,'TeamId'),function(_0x2f6ada){return _['includes'](_0x22c638,_0x2f6ada);});if(_0xb46848){return _0x3e3058['id'];}}}));}}return BPromise[_0x65d4('0x83')](_0x5b46cd)[_0x65d4('0x1e')](function(_0x166941){_0x198372=_(_0x198372)['union'](_0x166941)[_0x65d4('0x84')]()[_0x65d4('0x85')]();return db[_0x65d4('0x3c')][_0x65d4('0x5d')]({'where':{'id':_0x47272e[_0x65d4('0x54')]['id']}})['then'](function(_0x52d20a){return db[_0x65d4('0x74')][_0x65d4('0x86')](function(_0x18bb69){return _0x52d20a[_0x65d4('0x87')](_0x47272e[_0x65d4('0x40')]['ids'],{'transaction':_0x18bb69})['then'](function(){if(!_[_0x65d4('0x88')](_0x198372)){return _0x52d20a[_0x65d4('0x89')](_0x198372,{'transaction':_0x18bb69});}})[_0x65d4('0x1e')](function(){_0x198372[_0x65d4('0x76')](function(_0x37e979){socket[_0x65d4('0x77')](_0x65d4('0x8a'),{'UserId':_0x37e979,'ChatQueueId':_0x52d20a['id']});});});});});});})['then'](respondWithStatusCode(_0x1e1717,null))['catch'](handleError(_0x1e1717,null));};exports[_0x65d4('0x8b')]=function(_0x59fbd6,_0x101c18,_0x155dc1){return db['ChatQueue'][_0x65d4('0x5d')]({'where':{'id':_0x59fbd6['params']['id']}})[_0x65d4('0x1e')](handleEntityNotFound(_0x101c18,null))[_0x65d4('0x1e')](function(_0x3231ef){if(_0x3231ef){return _0x3231ef[_0x65d4('0x8b')](_0x59fbd6[_0x65d4('0x58')]['ids'],_[_0x65d4('0x8c')](_0x59fbd6['body'],[_0x65d4('0x79'),'id'])||{})[_0x65d4('0x8d')](function(_0x2e0a33){for(var _0x10b0da=0x0;_0x10b0da<_0x59fbd6[_0x65d4('0x58')]['ids'][_0x65d4('0x45')];_0x10b0da+=0x1){socket[_0x65d4('0x77')](_0x65d4('0x78'),{'UserId':Number(_0x59fbd6[_0x65d4('0x58')][_0x65d4('0x79')][_0x10b0da]),'ChatQueueId':Number(_0x59fbd6['params']['id'])});}return _0x2e0a33;});}})['then'](respondWithResult(_0x101c18,null))[_0x65d4('0x28')](handleError(_0x101c18,null));};exports[_0x65d4('0x89')]=function(_0x529c6a,_0x4d8588,_0x2079ed){return db[_0x65d4('0x3c')][_0x65d4('0x5d')]({'where':{'id':_0x529c6a[_0x65d4('0x54')]['id']}})['then'](handleEntityNotFound(_0x4d8588,null))['then'](function(_0x56bda3){if(_0x56bda3){return _0x56bda3[_0x65d4('0x89')](_0x529c6a[_0x65d4('0x40')][_0x65d4('0x79')])[_0x65d4('0x1e')](function(){if(_[_0x65d4('0x8e')](_0x529c6a[_0x65d4('0x40')][_0x65d4('0x79')])){for(var _0x28767b=0x0;_0x28767b<_0x529c6a[_0x65d4('0x40')][_0x65d4('0x79')]['length'];_0x28767b+=0x1){socket[_0x65d4('0x77')]('userChatQueue:remove',{'UserId':Number(_0x529c6a[_0x65d4('0x40')][_0x65d4('0x79')][_0x28767b]),'ChatQueueId':Number(_0x529c6a['params']['id'])});}}else{socket[_0x65d4('0x77')](_0x65d4('0x8a'),{'UserId':Number(_0x529c6a[_0x65d4('0x40')]['ids']),'ChatQueueId':Number(_0x529c6a[_0x65d4('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x4d8588,null))[_0x65d4('0x28')](handleError(_0x4d8588,null));};exports[_0x65d4('0x8f')]=function(_0x344e34,_0x274db5,_0x25b4fe){var _0x4d3659={};var _0x2be871={};var _0x18f392;var _0x3e0374;return db['ChatQueue'][_0x65d4('0x63')]({'where':{'id':_0x344e34[_0x65d4('0x54')]['id']}})['then'](handleEntityNotFound(_0x274db5,null))[_0x65d4('0x1e')](function(_0x5c3a24){if(_0x5c3a24){_0x18f392=_0x5c3a24;_0x2be871[_0x65d4('0x3f')]=_[_0x65d4('0x55')](db[_0x65d4('0x66')][_0x65d4('0x56')]);_0x2be871['query']=_['keys'](_0x344e34[_0x65d4('0x40')]);_0x2be871[_0x65d4('0x41')]=_['intersection'](_0x2be871[_0x65d4('0x3f')],_0x2be871[_0x65d4('0x40')]);_0x4d3659[_0x65d4('0x43')]=_[_0x65d4('0x42')](_0x2be871['model'],qs[_0x65d4('0x44')](_0x344e34[_0x65d4('0x40')][_0x65d4('0x44')]));_0x4d3659[_0x65d4('0x43')]=_0x4d3659[_0x65d4('0x43')][_0x65d4('0x45')]?_0x4d3659[_0x65d4('0x43')]:_0x2be871[_0x65d4('0x3f')];_0x4d3659['order']=qs[_0x65d4('0x49')](_0x344e34[_0x65d4('0x40')][_0x65d4('0x49')]);_0x4d3659[_0x65d4('0x4a')]=qs['filters'](_[_0x65d4('0x4b')](_0x344e34[_0x65d4('0x40')],_0x2be871[_0x65d4('0x41')]));if(_0x344e34[_0x65d4('0x40')]['filter']){_0x4d3659[_0x65d4('0x4a')]=_[_0x65d4('0x4d')](_0x4d3659[_0x65d4('0x4a')],{'$or':_[_0x65d4('0x3b')](_0x4d3659[_0x65d4('0x43')],function(_0x365931){var _0x576746={};_0x576746[_0x365931]={'$like':'%'+_0x344e34[_0x65d4('0x40')][_0x65d4('0x4c')]+'%'};return _0x576746;})});}_0x4d3659=_[_0x65d4('0x4d')]({},_0x4d3659,_0x344e34[_0x65d4('0x4f')]);return _0x18f392[_0x65d4('0x8f')](_0x4d3659);}})['then'](function(_0x40a36e){if(_0x40a36e){_0x3e0374=_0x40a36e[_0x65d4('0x45')];if(!_0x344e34[_0x65d4('0x40')][_0x65d4('0x46')]('nolimit')){_0x4d3659['limit']=qs[_0x65d4('0x2e')](_0x344e34[_0x65d4('0x40')][_0x65d4('0x2e')]);_0x4d3659[_0x65d4('0x30')]=qs[_0x65d4('0x30')](_0x344e34[_0x65d4('0x40')][_0x65d4('0x30')]);}return _0x18f392[_0x65d4('0x8f')](_0x4d3659);}})[_0x65d4('0x1e')](function(_0x2fb26f){if(_0x2fb26f){return _0x2fb26f?{'count':_0x3e0374,'rows':_0x2fb26f}:null;}})[_0x65d4('0x1e')](respondWithResult(_0x274db5,null))[_0x65d4('0x28')](handleError(_0x274db5,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 5496ab3..d1b9d64 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 _0x81c2=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x38c699,_0x56fea7){var _0x3b1ded=function(_0x100851){while(--_0x100851){_0x38c699['push'](_0x38c699['shift']());}};_0x3b1ded(++_0x56fea7);}(_0x81c2,0xdf));var _0x281c=function(_0xb29bef,_0x45aff1){_0xb29bef=_0xb29bef-0x0;var _0x878163=_0x81c2[_0xb29bef];return _0x878163;};'use strict';var EventEmitter=require(_0x281c('0x0'));var ChatQueue=require(_0x281c('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x281c('0x2')](0x0);var events={'afterCreate':_0x281c('0x3'),'afterUpdate':_0x281c('0x4'),'afterDestroy':_0x281c('0x5')};function emitEvent(_0x51e91e){return function(_0x2b3286,_0x2d8a0f,_0x59a35b){ChatQueueEvents[_0x281c('0x6')](_0x51e91e+':'+_0x2b3286['id'],_0x2b3286);ChatQueueEvents[_0x281c('0x6')](_0x51e91e,_0x2b3286);_0x59a35b(null);};}for(var e in events){if(events[_0x281c('0x7')](e)){var event=events[e];ChatQueue[_0x281c('0x8')](e,emitEvent(event));}}module[_0x281c('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0x06d0=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','ChatQueue'];(function(_0x2ff88e,_0x1341bd){var _0x18fcc6=function(_0x188f26){while(--_0x188f26){_0x2ff88e['push'](_0x2ff88e['shift']());}};_0x18fcc6(++_0x1341bd);}(_0x06d0,0xa0));var _0x006d=function(_0xef3547,_0x1bdde2){_0xef3547=_0xef3547-0x0;var _0x4eb3e3=_0x06d0[_0xef3547];return _0x4eb3e3;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x006d('0x0'))['db'][_0x006d('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x006d('0x2')](0x0);var events={'afterCreate':_0x006d('0x3'),'afterUpdate':_0x006d('0x4'),'afterDestroy':_0x006d('0x5')};function emitEvent(_0x344e6f){return function(_0x2e9f71,_0x2f37dd,_0x5bdbff){ChatQueueEvents[_0x006d('0x6')](_0x344e6f+':'+_0x2e9f71['id'],_0x2e9f71);ChatQueueEvents['emit'](_0x344e6f,_0x2e9f71);_0x5bdbff(null);};}for(var e in events){if(events[_0x006d('0x7')](e)){var event=events[e];ChatQueue[_0x006d('0x8')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index c4aa9bc..a89d076 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 _0xd618=['exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x5b4c44,_0x2e495e){var _0x58485a=function(_0x13299b){while(--_0x13299b){_0x5b4c44['push'](_0x5b4c44['shift']());}};_0x58485a(++_0x2e495e);}(_0xd618,0x185));var _0x8d61=function(_0x579823,_0x2a792a){_0x579823=_0x579823-0x0;var _0xd6481f=_0xd618[_0x579823];return _0xd6481f;};'use strict';var _=require(_0x8d61('0x0'));var util=require(_0x8d61('0x1'));var logger=require(_0x8d61('0x2'))(_0x8d61('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8d61('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8d61('0x5'));var config=require(_0x8d61('0x6'));var attributes=require('./chatQueue.attributes');module[_0x8d61('0x7')]=function(_0x4eabb5,_0x2a1f15){return _0x4eabb5[_0x8d61('0x8')](_0x8d61('0x9'),attributes,{'tableName':_0x8d61('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4b9=['../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe4b9,0xea));var _0x9e4b=function(_0x415346,_0x440efe){_0x415346=_0x415346-0x0;var _0x28661c=_0xe4b9[_0x415346];return _0x28661c;};'use strict';var _=require(_0x9e4b('0x0'));var util=require('util');var logger=require(_0x9e4b('0x1'))(_0x9e4b('0x2'));var moment=require('moment');var BPromise=require(_0x9e4b('0x3'));var rp=require(_0x9e4b('0x4'));var fs=require('fs');var path=require(_0x9e4b('0x5'));var rimraf=require('rimraf');var config=require(_0x9e4b('0x6'));var attributes=require(_0x9e4b('0x7'));module[_0x9e4b('0x8')]=function(_0x22747a,_0x4fa73c){return _0x22747a[_0x9e4b('0x9')](_0x9e4b('0xa'),attributes,{'tableName':_0x9e4b('0xb'),'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 1a82006..d324d0e 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 _0xfae3=['ChatQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','GetChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowChatQueue'];(function(_0x5b013d,_0xc7691c){var _0x2b6eef=function(_0x3143ca){while(--_0x3143ca){_0x5b013d['push'](_0x5b013d['shift']());}};_0x2b6eef(++_0xc7691c);}(_0xfae3,0xa1));var _0x3fae=function(_0x5aa17c,_0x5892b1){_0x5aa17c=_0x5aa17c-0x0;var _0x1d886b=_0xfae3[_0x5aa17c];return _0x1d886b;};'use strict';var _=require(_0x3fae('0x0'));var util=require(_0x3fae('0x1'));var moment=require(_0x3fae('0x2'));var BPromise=require(_0x3fae('0x3'));var rs=require(_0x3fae('0x4'));var fs=require('fs');var Redis=require(_0x3fae('0x5'));var db=require(_0x3fae('0x6'))['db'];var utils=require(_0x3fae('0x7'));var logger=require(_0x3fae('0x8'))(_0x3fae('0x9'));var config=require(_0x3fae('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x3fae('0xb')][_0x3fae('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3fae('0xd')],{'host':_0x3fae('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3fae('0xd')]));require(_0x3fae('0xf'))[_0x3fae('0x10')](socket);function respondWithRpcPromise(_0x145e13,_0x464cd8,_0xb60514){return new BPromise(function(_0x337e87,_0x1d729b){return client[_0x3fae('0x11')](_0x145e13,_0xb60514)[_0x3fae('0x12')](function(_0x40cbc1){logger[_0x3fae('0x13')](_0x3fae('0x14'),_0x464cd8,'request\x20sent');logger[_0x3fae('0x15')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x464cd8,_0x3fae('0x16'),JSON[_0x3fae('0x17')](_0x40cbc1));if(_0x40cbc1[_0x3fae('0x18')]){if(_0x40cbc1[_0x3fae('0x18')][_0x3fae('0x19')]===0x1f4){logger[_0x3fae('0x18')](_0x3fae('0x14'),_0x464cd8,_0x40cbc1[_0x3fae('0x18')][_0x3fae('0x1a')]);return _0x1d729b(_0x40cbc1[_0x3fae('0x18')][_0x3fae('0x1a')]);}logger[_0x3fae('0x18')](_0x3fae('0x14'),_0x464cd8,_0x40cbc1[_0x3fae('0x18')][_0x3fae('0x1a')]);return _0x337e87(_0x40cbc1[_0x3fae('0x18')][_0x3fae('0x1a')]);}else{logger[_0x3fae('0x13')](_0x3fae('0x14'),_0x464cd8,_0x3fae('0x16'));_0x337e87(_0x40cbc1['result']['message']);}})[_0x3fae('0x1b')](function(_0x271151){logger[_0x3fae('0x18')]('ChatQueue,\x20%s,\x20%s',_0x464cd8,_0x271151);_0x1d729b(_0x271151);});});}exports[_0x3fae('0x1c')]=function(_0x89ed35){var _0x4072fa=this;return new Promise(function(_0x34b21a,_0x4d2bf8){return db['ChatQueue'][_0x3fae('0x1d')]({'raw':_0x89ed35[_0x3fae('0x1e')]?_0x89ed35[_0x3fae('0x1e')][_0x3fae('0x1f')]===undefined?!![]:![]:!![],'where':_0x89ed35[_0x3fae('0x1e')]?_0x89ed35[_0x3fae('0x1e')][_0x3fae('0x20')]||null:null,'attributes':_0x89ed35[_0x3fae('0x1e')]?_0x89ed35[_0x3fae('0x1e')][_0x3fae('0x21')]||null:null,'limit':_0x89ed35[_0x3fae('0x1e')]?_0x89ed35[_0x3fae('0x1e')][_0x3fae('0x22')]||null:null,'include':_0x89ed35[_0x3fae('0x1e')]?_0x89ed35['options'][_0x3fae('0x23')]?_[_0x3fae('0x24')](_0x89ed35[_0x3fae('0x1e')][_0x3fae('0x23')],function(_0xc68eb2){return{'model':db[_0xc68eb2[_0x3fae('0x25')]],'as':_0xc68eb2['as'],'attributes':_0xc68eb2[_0x3fae('0x21')],'include':_0xc68eb2[_0x3fae('0x23')]?_[_0x3fae('0x24')](_0xc68eb2['include'],function(_0x153250){return{'model':db[_0x153250['model']],'as':_0x153250['as'],'attributes':_0x153250[_0x3fae('0x21')],'include':_0x153250[_0x3fae('0x23')]?_['map'](_0x153250[_0x3fae('0x23')],function(_0x3692d4){return{'model':db[_0x3692d4['model']],'as':_0x3692d4['as'],'attributes':_0x3692d4[_0x3fae('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3fae('0x12')](function(_0xca9920){logger[_0x3fae('0x13')](_0x3fae('0x1c'),_0x89ed35);logger[_0x3fae('0x15')](_0x3fae('0x1c'),_0x89ed35,JSON[_0x3fae('0x17')](_0xca9920));_0x34b21a(_0xca9920);})[_0x3fae('0x1b')](function(_0x23691c){logger[_0x3fae('0x18')]('GetChatQueue',_0x23691c[_0x3fae('0x1a')],_0x89ed35);_0x4d2bf8(_0x4072fa[_0x3fae('0x18')](0x1f4,_0x23691c[_0x3fae('0x1a')]));});});};exports[_0x3fae('0x26')]=function(_0x5a1bf3){var _0x14eaa6=this;return new Promise(function(_0x4d7cdd,_0x4fcc2d){return db[_0x3fae('0x27')]['find']({'raw':_0x5a1bf3['options']?_0x5a1bf3['options'][_0x3fae('0x1f')]===undefined?!![]:![]:!![],'where':_0x5a1bf3['options']?_0x5a1bf3[_0x3fae('0x1e')][_0x3fae('0x20')]||null:null,'attributes':_0x5a1bf3[_0x3fae('0x1e')]?_0x5a1bf3[_0x3fae('0x1e')][_0x3fae('0x21')]||null:null,'include':_0x5a1bf3['options']?_0x5a1bf3[_0x3fae('0x1e')][_0x3fae('0x23')]?_[_0x3fae('0x24')](_0x5a1bf3[_0x3fae('0x1e')][_0x3fae('0x23')],function(_0x572e98){return{'model':db[_0x572e98[_0x3fae('0x25')]],'as':_0x572e98['as'],'attributes':_0x572e98[_0x3fae('0x21')],'include':_0x572e98[_0x3fae('0x23')]?_[_0x3fae('0x24')](_0x572e98[_0x3fae('0x23')],function(_0x4efbb6){return{'model':db[_0x4efbb6[_0x3fae('0x25')]],'as':_0x4efbb6['as'],'attributes':_0x4efbb6['attributes'],'include':_0x4efbb6[_0x3fae('0x23')]?_[_0x3fae('0x24')](_0x4efbb6[_0x3fae('0x23')],function(_0x5b9c7e){return{'model':db[_0x5b9c7e[_0x3fae('0x25')]],'as':_0x5b9c7e['as'],'attributes':_0x5b9c7e[_0x3fae('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3fae('0x12')](function(_0x5597eb){logger['info'](_0x3fae('0x26'),_0x5a1bf3);logger[_0x3fae('0x15')](_0x3fae('0x26'),_0x5a1bf3,JSON['stringify'](_0x5597eb));_0x4d7cdd(_0x5597eb);})[_0x3fae('0x1b')](function(_0x377967){logger[_0x3fae('0x18')](_0x3fae('0x26'),_0x377967['message'],_0x5a1bf3);_0x4fcc2d(_0x14eaa6[_0x3fae('0x18')](0x1f4,_0x377967[_0x3fae('0x1a')]));});});}; \ No newline at end of file +var _0xa866=['then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','info','result','ChatQueue','findAll','options','where','attributes','limit','include','map','model','GetChatQueue','ShowChatQueue','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register'];(function(_0x4aeb18,_0x3406ca){var _0x1fa4f1=function(_0x27557a){while(--_0x27557a){_0x4aeb18['push'](_0x4aeb18['shift']());}};_0x1fa4f1(++_0x3406ca);}(_0xa866,0x6a));var _0x6a86=function(_0x314c18,_0x1cee4c){_0x314c18=_0x314c18-0x0;var _0x48399d=_0xa866[_0x314c18];return _0x48399d;};'use strict';var _=require(_0x6a86('0x0'));var util=require(_0x6a86('0x1'));var moment=require(_0x6a86('0x2'));var BPromise=require(_0x6a86('0x3'));var rs=require(_0x6a86('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a86('0x5'))['db'];var utils=require(_0x6a86('0x6'));var logger=require(_0x6a86('0x7'))('rpc');var config=require(_0x6a86('0x8'));var jayson=require(_0x6a86('0x9'));var client=jayson[_0x6a86('0xa')]['http']({'port':0x232a});config[_0x6a86('0xb')]=_[_0x6a86('0xc')](config[_0x6a86('0xb')],{'host':_0x6a86('0xd'),'port':0x18eb});var socket=require(_0x6a86('0xe'))(new Redis(config[_0x6a86('0xb')]));require(_0x6a86('0xf'))[_0x6a86('0x10')](socket);function respondWithRpcPromise(_0x21712d,_0x5355b7,_0x3435a8){return new BPromise(function(_0x1a4548,_0x100925){return client['request'](_0x21712d,_0x3435a8)[_0x6a86('0x11')](function(_0x1797e8){logger['info']('ChatQueue,\x20%s,\x20%s',_0x5355b7,_0x6a86('0x12'));logger[_0x6a86('0x13')](_0x6a86('0x14'),_0x5355b7,_0x6a86('0x12'),JSON[_0x6a86('0x15')](_0x1797e8));if(_0x1797e8[_0x6a86('0x16')]){if(_0x1797e8[_0x6a86('0x16')][_0x6a86('0x17')]===0x1f4){logger['error'](_0x6a86('0x18'),_0x5355b7,_0x1797e8[_0x6a86('0x16')]['message']);return _0x100925(_0x1797e8[_0x6a86('0x16')][_0x6a86('0x19')]);}logger[_0x6a86('0x16')](_0x6a86('0x18'),_0x5355b7,_0x1797e8[_0x6a86('0x16')][_0x6a86('0x19')]);return _0x1a4548(_0x1797e8['error'][_0x6a86('0x19')]);}else{logger[_0x6a86('0x1a')]('ChatQueue,\x20%s,\x20%s',_0x5355b7,'request\x20sent');_0x1a4548(_0x1797e8[_0x6a86('0x1b')]['message']);}})['catch'](function(_0x1fe0b5){logger[_0x6a86('0x16')](_0x6a86('0x18'),_0x5355b7,_0x1fe0b5);_0x100925(_0x1fe0b5);});});}exports['GetChatQueue']=function(_0x2bbcc8){var _0x22a573=this;return new Promise(function(_0x1db4ad,_0x262bf5){return db[_0x6a86('0x1c')][_0x6a86('0x1d')]({'raw':_0x2bbcc8['options']?_0x2bbcc8['options']['raw']===undefined?!![]:![]:!![],'where':_0x2bbcc8[_0x6a86('0x1e')]?_0x2bbcc8[_0x6a86('0x1e')][_0x6a86('0x1f')]||null:null,'attributes':_0x2bbcc8[_0x6a86('0x1e')]?_0x2bbcc8['options'][_0x6a86('0x20')]||null:null,'limit':_0x2bbcc8[_0x6a86('0x1e')]?_0x2bbcc8[_0x6a86('0x1e')][_0x6a86('0x21')]||null:null,'include':_0x2bbcc8[_0x6a86('0x1e')]?_0x2bbcc8[_0x6a86('0x1e')][_0x6a86('0x22')]?_[_0x6a86('0x23')](_0x2bbcc8[_0x6a86('0x1e')]['include'],function(_0x5190c9){return{'model':db[_0x5190c9[_0x6a86('0x24')]],'as':_0x5190c9['as'],'attributes':_0x5190c9['attributes'],'include':_0x5190c9[_0x6a86('0x22')]?_[_0x6a86('0x23')](_0x5190c9['include'],function(_0xbfe923){return{'model':db[_0xbfe923[_0x6a86('0x24')]],'as':_0xbfe923['as'],'attributes':_0xbfe923[_0x6a86('0x20')],'include':_0xbfe923['include']?_[_0x6a86('0x23')](_0xbfe923['include'],function(_0x5a77e6){return{'model':db[_0x5a77e6['model']],'as':_0x5a77e6['as'],'attributes':_0x5a77e6[_0x6a86('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6a86('0x11')](function(_0x14359b){logger['info'](_0x6a86('0x25'),_0x2bbcc8);logger[_0x6a86('0x13')](_0x6a86('0x25'),_0x2bbcc8,JSON[_0x6a86('0x15')](_0x14359b));_0x1db4ad(_0x14359b);})['catch'](function(_0x1f7853){logger['error'](_0x6a86('0x25'),_0x1f7853[_0x6a86('0x19')],_0x2bbcc8);_0x262bf5(_0x22a573[_0x6a86('0x16')](0x1f4,_0x1f7853[_0x6a86('0x19')]));});});};exports[_0x6a86('0x26')]=function(_0x5a2925){var _0x155054=this;return new Promise(function(_0x350524,_0x51b789){return db[_0x6a86('0x1c')][_0x6a86('0x27')]({'raw':_0x5a2925['options']?_0x5a2925[_0x6a86('0x1e')][_0x6a86('0x28')]===undefined?!![]:![]:!![],'where':_0x5a2925['options']?_0x5a2925['options'][_0x6a86('0x1f')]||null:null,'attributes':_0x5a2925[_0x6a86('0x1e')]?_0x5a2925['options']['attributes']||null:null,'include':_0x5a2925[_0x6a86('0x1e')]?_0x5a2925['options'][_0x6a86('0x22')]?_['map'](_0x5a2925[_0x6a86('0x1e')]['include'],function(_0x350ce7){return{'model':db[_0x350ce7['model']],'as':_0x350ce7['as'],'attributes':_0x350ce7[_0x6a86('0x20')],'include':_0x350ce7[_0x6a86('0x22')]?_[_0x6a86('0x23')](_0x350ce7[_0x6a86('0x22')],function(_0x4c11f0){return{'model':db[_0x4c11f0[_0x6a86('0x24')]],'as':_0x4c11f0['as'],'attributes':_0x4c11f0[_0x6a86('0x20')],'include':_0x4c11f0[_0x6a86('0x22')]?_['map'](_0x4c11f0[_0x6a86('0x22')],function(_0x17a496){return{'model':db[_0x17a496['model']],'as':_0x17a496['as'],'attributes':_0x17a496[_0x6a86('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6a86('0x11')](function(_0x556d61){logger[_0x6a86('0x1a')]('ShowChatQueue',_0x5a2925);logger['debug'](_0x6a86('0x26'),_0x5a2925,JSON['stringify'](_0x556d61));_0x350524(_0x556d61);})['catch'](function(_0x518742){logger[_0x6a86('0x16')](_0x6a86('0x26'),_0x518742['message'],_0x5a2925);_0x51b789(_0x155054['error'](0x1f4,_0x518742[_0x6a86('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index b24f062..ad3d031 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 _0x84ab=['update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save','remove'];(function(_0x6801d4,_0x2836dc){var _0x4c829b=function(_0x306129){while(--_0x306129){_0x6801d4['push'](_0x6801d4['shift']());}};_0x4c829b(++_0x2836dc);}(_0x84ab,0x12f));var _0xb84a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x84ab[_0x20a584];return _0x4b41a8;};'use strict';var ChatQueueEvents=require(_0xb84a('0x0'));var events=[_0xb84a('0x1'),_0xb84a('0x2'),_0xb84a('0x3')];function createListener(_0x473c3,_0x512f13){return function(_0xc83587){_0x512f13[_0xb84a('0x4')](_0x473c3,_0xc83587);};}function removeListener(_0x47b8e3,_0x9d3a00){return function(){ChatQueueEvents[_0xb84a('0x5')](_0x47b8e3,_0x9d3a00);};}exports[_0xb84a('0x6')]=function(_0x5b9def){for(var _0x521a64=0x0,_0x4dc496=events[_0xb84a('0x7')];_0x521a64<_0x4dc496;_0x521a64++){var _0x4fac4d=events[_0x521a64];var _0x3e9086=createListener(_0xb84a('0x8')+_0x4fac4d,_0x5b9def);ChatQueueEvents['on'](_0x4fac4d,_0x3e9086);}}; \ No newline at end of file +var _0xe14d=['update','removeListener','register','chatQueue:','./chatQueue.events','save','remove'];(function(_0x4a5585,_0x574093){var _0x2cce37=function(_0x914d94){while(--_0x914d94){_0x4a5585['push'](_0x4a5585['shift']());}};_0x2cce37(++_0x574093);}(_0xe14d,0x1ee));var _0xde14=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xe14d[_0x5c351c];return _0x26f3b3;};'use strict';var ChatQueueEvents=require(_0xde14('0x0'));var events=[_0xde14('0x1'),_0xde14('0x2'),_0xde14('0x3')];function createListener(_0x48b392,_0x1c5b4){return function(_0x28965b){_0x1c5b4['emit'](_0x48b392,_0x28965b);};}function removeListener(_0x1c3e94,_0x13c24e){return function(){ChatQueueEvents[_0xde14('0x4')](_0x1c3e94,_0x13c24e);};}exports[_0xde14('0x5')]=function(_0x461af3){for(var _0xba1514=0x0,_0x4b1f6b=events['length'];_0xba1514<_0x4b1f6b;_0xba1514++){var _0x1bd49d=events[_0xba1514];var _0x115b7d=createListener(_0xde14('0x6')+_0x1bd49d,_0x461af3);ChatQueueEvents['on'](_0x1bd49d,_0x115b7d);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 119a3ea..1b24200 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 _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1fcc64,_0x438525){var _0x3101a9=function(_0x56e2b1){while(--_0x56e2b1){_0x1fcc64['push'](_0x1fcc64['shift']());}};_0x3101a9(++_0x438525);}(_0x008c,0x188));var _0xc008=function(_0x474035,_0x41e639){_0x474035=_0x474035-0x0;var _0x1b58e0=_0x008c[_0x474035];return _0x1b58e0;};'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')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);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('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x325022,_0xa005cf){var _0x2f18c2=function(_0x48f5f5){while(--_0x48f5f5){_0x325022['push'](_0x325022['shift']());}};_0x2f18c2(++_0xa005cf);}(_0x008c,0x188));var _0xc008=function(_0x4090cd,_0x55a2f0){_0x4090cd=_0x4090cd-0x0;var _0x522fbe=_0x008c[_0x4090cd];return _0x522fbe;};'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')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);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('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 1c49755..916df01 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 _0x11a6=['STRING','DATE','moment','sequelize','exports'];(function(_0x5051ea,_0x795739){var _0x4d8457=function(_0x5a9b1d){while(--_0x5a9b1d){_0x5051ea['push'](_0x5051ea['shift']());}};_0x4d8457(++_0x795739);}(_0x11a6,0xfc));var _0x611a=function(_0x35853a,_0x27930e){_0x35853a=_0x35853a-0x0;var _0x4d7ca7=_0x11a6[_0x35853a];return _0x4d7ca7;};'use strict';var moment=require(_0x611a('0x0'));var Sequelize=require(_0x611a('0x1'));module[_0x611a('0x2')]={'uniqueid':{'type':Sequelize[_0x611a('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x611a('0x3')]},'joinAt':{'type':Sequelize[_0x611a('0x4')]},'leaveAt':{'type':Sequelize[_0x611a('0x4')]},'acceptAt':{'type':Sequelize[_0x611a('0x4')]},'exitAt':{'type':Sequelize[_0x611a('0x4')]},'reason':{'type':Sequelize[_0x611a('0x3')]}}; \ No newline at end of file +var _0xadf6=['moment','sequelize','exports','STRING','DATE'];(function(_0x553590,_0x14e49c){var _0x13651d=function(_0x5a3dc2){while(--_0x5a3dc2){_0x553590['push'](_0x553590['shift']());}};_0x13651d(++_0x14e49c);}(_0xadf6,0x78));var _0x6adf=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xadf6[_0x2ec461];return _0x28603d;};'use strict';var moment=require(_0x6adf('0x0'));var Sequelize=require(_0x6adf('0x1'));module[_0x6adf('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x6adf('0x3')]},'joinAt':{'type':Sequelize[_0x6adf('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x6adf('0x4')]},'exitAt':{'type':Sequelize[_0x6adf('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 068cb14..3a1e751 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 _0x649f=['body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','name','send','index','map','rawAttributes','type','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatQueueReport','includeAll','include','findAll','rows','catch','params','intersection','find','create'];(function(_0x1db481,_0x1627b2){var _0x3db95b=function(_0x2d54e4){while(--_0x2d54e4){_0x1db481['push'](_0x1db481['shift']());}};_0x3db95b(++_0x1627b2);}(_0x649f,0x93));var _0xf649=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x649f[_0xda464c];return _0x19e222;};'use strict';var emlformat=require(_0xf649('0x0'));var rimraf=require(_0xf649('0x1'));var zipdir=require(_0xf649('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf649('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf649('0x4'));var util=require(_0xf649('0x5'));var path=require(_0xf649('0x6'));var sox=require(_0xf649('0x7'));var csv=require(_0xf649('0x8'));var ejs=require(_0xf649('0x9'));var fs=require('fs');var fs_extra=require(_0xf649('0xa'));var _=require(_0xf649('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf649('0xc'));var deskjs=require(_0xf649('0xd'));var toCsv=require(_0xf649('0x8'));var querystring=require('querystring');var Papa=require(_0xf649('0xe'));var Redis=require(_0xf649('0xf'));var authService=require(_0xf649('0x10'));var qs=require(_0xf649('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf649('0x12'));var logger=require(_0xf649('0x13'))(_0xf649('0x14'));var utils=require(_0xf649('0x15'));var config=require(_0xf649('0x16'));var licenseUtil=require(_0xf649('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3afac6,_0x541e95){_0x541e95=_0x541e95||0xcc;return function(_0x5e6e7d){if(_0x5e6e7d){return _0x3afac6[_0xf649('0x18')](_0x541e95);}return _0x3afac6[_0xf649('0x19')](_0x541e95)[_0xf649('0x1a')]();};}function respondWithResult(_0xcf02d8,_0x180ade){_0x180ade=_0x180ade||0xc8;return function(_0x1c2fe8){if(_0x1c2fe8){return _0xcf02d8[_0xf649('0x19')](_0x180ade)[_0xf649('0x1b')](_0x1c2fe8);}};}function respondWithFilteredResult(_0x596fd9,_0x1980b3){return function(_0x1d6fe4){if(_0x1d6fe4){var _0x5aac14=typeof _0x1980b3[_0xf649('0x1c')]===_0xf649('0x1d')&&typeof _0x1980b3[_0xf649('0x1e')]==='undefined';var _0x5b536f=_0x1d6fe4[_0xf649('0x1f')];var _0x1e1740=_0x5aac14?0x0:_0x1980b3[_0xf649('0x1c')];var _0x4156fc=_0x5aac14?_0x1d6fe4[_0xf649('0x1f')]:_0x1980b3[_0xf649('0x1c')]+_0x1980b3[_0xf649('0x1e')];var _0x4c5899;if(_0x4156fc>=_0x5b536f){_0x4156fc=_0x5b536f;_0x4c5899=0xc8;}else{_0x4c5899=0xce;}_0x596fd9[_0xf649('0x19')](_0x4c5899);return _0x596fd9[_0xf649('0x20')](_0xf649('0x21'),_0x1e1740+'-'+_0x4156fc+'/'+_0x5b536f)[_0xf649('0x1b')](_0x1d6fe4);}return null;};}function patchUpdates(_0x294c22){return function(_0x80db46){try{jsonpatch[_0xf649('0x22')](_0x80db46,_0x294c22,!![]);}catch(_0x6cfc72){return BPromise[_0xf649('0x23')](_0x6cfc72);}return _0x80db46[_0xf649('0x24')]();};}function saveUpdates(_0x28e98e,_0x51be40){return function(_0x472598){if(_0x472598){return _0x472598['update'](_0x28e98e)[_0xf649('0x25')](function(_0x1e0d54){return _0x1e0d54;});}return null;};}function removeEntity(_0x3c9fb3,_0xd939e0){return function(_0x1d1df9){if(_0x1d1df9){return _0x1d1df9[_0xf649('0x26')]()[_0xf649('0x25')](function(){_0x3c9fb3[_0xf649('0x19')](0xcc)[_0xf649('0x1a')]();});}};}function handleEntityNotFound(_0x214d2a,_0x48a50d){return function(_0x1b0f03){if(!_0x1b0f03){_0x214d2a['sendStatus'](0x194);}return _0x1b0f03;};}function handleError(_0x555b58,_0x2ade00){_0x2ade00=_0x2ade00||0x1f4;return function(_0x32fa5f){logger['error'](_0x32fa5f['stack']);if(_0x32fa5f['name']){delete _0x32fa5f[_0xf649('0x27')];}_0x555b58[_0xf649('0x19')](_0x2ade00)[_0xf649('0x28')](_0x32fa5f);};}exports[_0xf649('0x29')]=function(_0x335bde,_0x42e8cd){var _0xef0b39={},_0x283147={},_0x4479ec={'count':0x0,'rows':[]};var _0x153b3e=_[_0xf649('0x2a')](db['ChatQueueReport'][_0xf649('0x2b')],function(_0x39c4da){return{'name':_0x39c4da['fieldName'],'type':_0x39c4da[_0xf649('0x2c')]['key']};});_0x283147['model']=_[_0xf649('0x2a')](_0x153b3e,_0xf649('0x27'));_0x283147[_0xf649('0x2d')]=_[_0xf649('0x2e')](_0x335bde[_0xf649('0x2d')]);_0x283147[_0xf649('0x2f')]=_['intersection'](_0x283147[_0xf649('0x30')],_0x283147[_0xf649('0x2d')]);_0xef0b39[_0xf649('0x31')]=_['intersection'](_0x283147['model'],qs[_0xf649('0x32')](_0x335bde[_0xf649('0x2d')][_0xf649('0x32')]));_0xef0b39[_0xf649('0x31')]=_0xef0b39['attributes'][_0xf649('0x33')]?_0xef0b39[_0xf649('0x31')]:_0x283147[_0xf649('0x30')];if(!_0x335bde[_0xf649('0x2d')][_0xf649('0x34')](_0xf649('0x35'))){_0xef0b39[_0xf649('0x1e')]=qs[_0xf649('0x1e')](_0x335bde[_0xf649('0x2d')][_0xf649('0x1e')]);_0xef0b39[_0xf649('0x1c')]=qs['offset'](_0x335bde[_0xf649('0x2d')]['offset']);}_0xef0b39[_0xf649('0x36')]=qs[_0xf649('0x37')](_0x335bde[_0xf649('0x2d')][_0xf649('0x37')]);_0xef0b39[_0xf649('0x38')]=qs[_0xf649('0x2f')](_[_0xf649('0x39')](_0x335bde[_0xf649('0x2d')],_0x283147['filters']),_0x153b3e);if(_0x335bde[_0xf649('0x2d')][_0xf649('0x3a')]){_0xef0b39['where']=_[_0xf649('0x3b')](_0xef0b39[_0xf649('0x38')],{'$or':_[_0xf649('0x2a')](_0x153b3e,function(_0x619450){if(_0x619450['type']!==_0xf649('0x3c')){var _0xdbe960={};_0xdbe960[_0x619450[_0xf649('0x27')]]={'$like':'%'+_0x335bde[_0xf649('0x2d')][_0xf649('0x3a')]+'%'};return _0xdbe960;}})});}_0xef0b39=_[_0xf649('0x3b')]({},_0xef0b39,_0x335bde[_0xf649('0x3d')]);var _0x33d168={'where':_0xef0b39[_0xf649('0x38')]};return db[_0xf649('0x3e')][_0xf649('0x1f')](_0x33d168)[_0xf649('0x25')](function(_0x578bfc){_0x4479ec['count']=_0x578bfc;if(_0x335bde[_0xf649('0x2d')][_0xf649('0x3f')]){_0xef0b39[_0xf649('0x40')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xf649('0x41')](_0xef0b39);})['then'](function(_0x2f2a0a){_0x4479ec[_0xf649('0x42')]=_0x2f2a0a;return _0x4479ec;})[_0xf649('0x25')](respondWithFilteredResult(_0x42e8cd,_0xef0b39))[_0xf649('0x43')](handleError(_0x42e8cd,null));};exports['show']=function(_0x5dd5ad,_0xdf8dd6){var _0x20ceaa={'raw':!![],'where':{'id':_0x5dd5ad[_0xf649('0x44')]['id']}},_0x6e094c={};_0x6e094c[_0xf649('0x30')]=_[_0xf649('0x2e')](db[_0xf649('0x3e')][_0xf649('0x2b')]);_0x6e094c[_0xf649('0x2d')]=_[_0xf649('0x2e')](_0x5dd5ad['query']);_0x6e094c[_0xf649('0x2f')]=_['intersection'](_0x6e094c[_0xf649('0x30')],_0x6e094c[_0xf649('0x2d')]);_0x20ceaa[_0xf649('0x31')]=_[_0xf649('0x45')](_0x6e094c[_0xf649('0x30')],qs[_0xf649('0x32')](_0x5dd5ad[_0xf649('0x2d')]['fields']));_0x20ceaa[_0xf649('0x31')]=_0x20ceaa[_0xf649('0x31')][_0xf649('0x33')]?_0x20ceaa[_0xf649('0x31')]:_0x6e094c[_0xf649('0x30')];if(_0x5dd5ad[_0xf649('0x2d')]['includeAll']){_0x20ceaa['include']=[{'all':!![]}];}_0x20ceaa=_['merge']({},_0x20ceaa,_0x5dd5ad[_0xf649('0x3d')]);return db[_0xf649('0x3e')][_0xf649('0x46')](_0x20ceaa)['then'](handleEntityNotFound(_0xdf8dd6,null))[_0xf649('0x25')](respondWithResult(_0xdf8dd6,null))[_0xf649('0x43')](handleError(_0xdf8dd6,null));};exports[_0xf649('0x47')]=function(_0x2e9164,_0x3305f3){return db[_0xf649('0x3e')][_0xf649('0x47')](_0x2e9164[_0xf649('0x48')],{})[_0xf649('0x25')](respondWithResult(_0x3305f3,0xc9))['catch'](handleError(_0x3305f3,null));};exports['update']=function(_0x1c6c23,_0x18c6c6){if(_0x1c6c23['body']['id']){delete _0x1c6c23['body']['id'];}return db[_0xf649('0x3e')]['find']({'where':{'id':_0x1c6c23[_0xf649('0x44')]['id']}})[_0xf649('0x25')](handleEntityNotFound(_0x18c6c6,null))[_0xf649('0x25')](saveUpdates(_0x1c6c23['body'],null))['then'](respondWithResult(_0x18c6c6,null))['catch'](handleError(_0x18c6c6,null));};exports['destroy']=function(_0x469f50,_0x165b5f){return db[_0xf649('0x3e')]['find']({'where':{'id':_0x469f50[_0xf649('0x44')]['id']}})['then'](handleEntityNotFound(_0x165b5f,null))[_0xf649('0x25')](removeEntity(_0x165b5f,null))['catch'](handleError(_0x165b5f,null));};exports['describe']=function(_0x1d1b68,_0x3bef52){return db[_0xf649('0x3e')]['describe']()[_0xf649('0x25')](respondWithResult(_0x3bef52,null))['catch'](handleError(_0x3bef52,null));}; \ No newline at end of file +var _0xe626=['keys','rawAttributes','intersection','length','options','find','create','body','catch','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','index','type','model','map','query','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','ChatQueueReport','includeAll','include','findAll','rows','show'];(function(_0x50e691,_0x24048e){var _0x54e8a7=function(_0x4cef52){while(--_0x4cef52){_0x50e691['push'](_0x50e691['shift']());}};_0x54e8a7(++_0x24048e);}(_0xe626,0x9d));var _0x6e62=function(_0x403437,_0x2265a8){_0x403437=_0x403437-0x0;var _0x37e405=_0xe626[_0x403437];return _0x37e405;};'use strict';var emlformat=require(_0x6e62('0x0'));var rimraf=require(_0x6e62('0x1'));var zipdir=require(_0x6e62('0x2'));var jsonpatch=require(_0x6e62('0x3'));var rp=require('request-promise');var moment=require(_0x6e62('0x4'));var BPromise=require(_0x6e62('0x5'));var Mustache=require(_0x6e62('0x6'));var util=require(_0x6e62('0x7'));var path=require(_0x6e62('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6e62('0x9'));var _=require(_0x6e62('0xa'));var squel=require('squel');var crypto=require(_0x6e62('0xb'));var jsforce=require(_0x6e62('0xc'));var deskjs=require(_0x6e62('0xd'));var toCsv=require(_0x6e62('0xe'));var querystring=require('querystring');var Papa=require(_0x6e62('0xf'));var Redis=require(_0x6e62('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6e62('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e62('0x12'));var logger=require('../../config/logger')(_0x6e62('0x13'));var utils=require('../../config/utils');var config=require(_0x6e62('0x14'));var licenseUtil=require(_0x6e62('0x15'));var db=require(_0x6e62('0x16'))['db'];function respondWithStatusCode(_0x43e3d4,_0x3c3af1){_0x3c3af1=_0x3c3af1||0xcc;return function(_0x1c266b){if(_0x1c266b){return _0x43e3d4[_0x6e62('0x17')](_0x3c3af1);}return _0x43e3d4['status'](_0x3c3af1)['end']();};}function respondWithResult(_0x44b131,_0x3b980d){_0x3b980d=_0x3b980d||0xc8;return function(_0x5328fe){if(_0x5328fe){return _0x44b131[_0x6e62('0x18')](_0x3b980d)[_0x6e62('0x19')](_0x5328fe);}};}function respondWithFilteredResult(_0x19a80d,_0x3f4e35){return function(_0x58d84e){if(_0x58d84e){var _0x416158=typeof _0x3f4e35[_0x6e62('0x1a')]===_0x6e62('0x1b')&&typeof _0x3f4e35[_0x6e62('0x1c')]===_0x6e62('0x1b');var _0x31b304=_0x58d84e[_0x6e62('0x1d')];var _0x45d7ee=_0x416158?0x0:_0x3f4e35[_0x6e62('0x1a')];var _0x15bce5=_0x416158?_0x58d84e['count']:_0x3f4e35[_0x6e62('0x1a')]+_0x3f4e35[_0x6e62('0x1c')];var _0x55ce3b;if(_0x15bce5>=_0x31b304){_0x15bce5=_0x31b304;_0x55ce3b=0xc8;}else{_0x55ce3b=0xce;}_0x19a80d[_0x6e62('0x18')](_0x55ce3b);return _0x19a80d['set'](_0x6e62('0x1e'),_0x45d7ee+'-'+_0x15bce5+'/'+_0x31b304)[_0x6e62('0x19')](_0x58d84e);}return null;};}function patchUpdates(_0x2e162e){return function(_0x270405){try{jsonpatch[_0x6e62('0x1f')](_0x270405,_0x2e162e,!![]);}catch(_0x77c5f9){return BPromise[_0x6e62('0x20')](_0x77c5f9);}return _0x270405[_0x6e62('0x21')]();};}function saveUpdates(_0x3f9067,_0x421d13){return function(_0x1954dc){if(_0x1954dc){return _0x1954dc['update'](_0x3f9067)[_0x6e62('0x22')](function(_0x52d5e7){return _0x52d5e7;});}return null;};}function removeEntity(_0x183469,_0x3dad96){return function(_0x345af8){if(_0x345af8){return _0x345af8[_0x6e62('0x23')]()[_0x6e62('0x22')](function(){_0x183469[_0x6e62('0x18')](0xcc)[_0x6e62('0x24')]();});}};}function handleEntityNotFound(_0x3a1683,_0x2e4fe1){return function(_0x448691){if(!_0x448691){_0x3a1683['sendStatus'](0x194);}return _0x448691;};}function handleError(_0x33f81c,_0x555793){_0x555793=_0x555793||0x1f4;return function(_0x2f9c68){logger[_0x6e62('0x25')](_0x2f9c68[_0x6e62('0x26')]);if(_0x2f9c68[_0x6e62('0x27')]){delete _0x2f9c68[_0x6e62('0x27')];}_0x33f81c[_0x6e62('0x18')](_0x555793)['send'](_0x2f9c68);};}exports[_0x6e62('0x28')]=function(_0x26c991,_0x14cd51){var _0x50ba00={},_0x58afab={},_0x191df5={'count':0x0,'rows':[]};var _0x50813d=_['map'](db['ChatQueueReport']['rawAttributes'],function(_0x17f634){return{'name':_0x17f634['fieldName'],'type':_0x17f634[_0x6e62('0x29')]['key']};});_0x58afab[_0x6e62('0x2a')]=_[_0x6e62('0x2b')](_0x50813d,_0x6e62('0x27'));_0x58afab['query']=_['keys'](_0x26c991[_0x6e62('0x2c')]);_0x58afab[_0x6e62('0x2d')]=_['intersection'](_0x58afab['model'],_0x58afab['query']);_0x50ba00[_0x6e62('0x2e')]=_['intersection'](_0x58afab[_0x6e62('0x2a')],qs[_0x6e62('0x2f')](_0x26c991[_0x6e62('0x2c')][_0x6e62('0x2f')]));_0x50ba00[_0x6e62('0x2e')]=_0x50ba00['attributes']['length']?_0x50ba00[_0x6e62('0x2e')]:_0x58afab[_0x6e62('0x2a')];if(!_0x26c991[_0x6e62('0x2c')][_0x6e62('0x30')](_0x6e62('0x31'))){_0x50ba00[_0x6e62('0x1c')]=qs[_0x6e62('0x1c')](_0x26c991[_0x6e62('0x2c')][_0x6e62('0x1c')]);_0x50ba00['offset']=qs[_0x6e62('0x1a')](_0x26c991[_0x6e62('0x2c')][_0x6e62('0x1a')]);}_0x50ba00['order']=qs[_0x6e62('0x32')](_0x26c991[_0x6e62('0x2c')]['sort']);_0x50ba00[_0x6e62('0x33')]=qs[_0x6e62('0x2d')](_[_0x6e62('0x34')](_0x26c991[_0x6e62('0x2c')],_0x58afab[_0x6e62('0x2d')]),_0x50813d);if(_0x26c991['query'][_0x6e62('0x35')]){_0x50ba00[_0x6e62('0x33')]=_[_0x6e62('0x36')](_0x50ba00[_0x6e62('0x33')],{'$or':_[_0x6e62('0x2b')](_0x50813d,function(_0x4900b0){if(_0x4900b0[_0x6e62('0x29')]!==_0x6e62('0x37')){var _0x234710={};_0x234710[_0x4900b0['name']]={'$like':'%'+_0x26c991[_0x6e62('0x2c')][_0x6e62('0x35')]+'%'};return _0x234710;}})});}_0x50ba00=_['merge']({},_0x50ba00,_0x26c991['options']);var _0x13728c={'where':_0x50ba00[_0x6e62('0x33')]};return db[_0x6e62('0x38')]['count'](_0x13728c)['then'](function(_0x1ef318){_0x191df5['count']=_0x1ef318;if(_0x26c991['query'][_0x6e62('0x39')]){_0x50ba00[_0x6e62('0x3a')]=[{'all':!![]}];}return db[_0x6e62('0x38')][_0x6e62('0x3b')](_0x50ba00);})[_0x6e62('0x22')](function(_0x58ac40){_0x191df5[_0x6e62('0x3c')]=_0x58ac40;return _0x191df5;})['then'](respondWithFilteredResult(_0x14cd51,_0x50ba00))['catch'](handleError(_0x14cd51,null));};exports[_0x6e62('0x3d')]=function(_0x469fa1,_0x940288){var _0x5352d3={'raw':!![],'where':{'id':_0x469fa1['params']['id']}},_0x1a7e7f={};_0x1a7e7f[_0x6e62('0x2a')]=_[_0x6e62('0x3e')](db[_0x6e62('0x38')][_0x6e62('0x3f')]);_0x1a7e7f[_0x6e62('0x2c')]=_[_0x6e62('0x3e')](_0x469fa1[_0x6e62('0x2c')]);_0x1a7e7f[_0x6e62('0x2d')]=_[_0x6e62('0x40')](_0x1a7e7f[_0x6e62('0x2a')],_0x1a7e7f['query']);_0x5352d3['attributes']=_['intersection'](_0x1a7e7f[_0x6e62('0x2a')],qs['fields'](_0x469fa1[_0x6e62('0x2c')][_0x6e62('0x2f')]));_0x5352d3['attributes']=_0x5352d3[_0x6e62('0x2e')][_0x6e62('0x41')]?_0x5352d3[_0x6e62('0x2e')]:_0x1a7e7f[_0x6e62('0x2a')];if(_0x469fa1[_0x6e62('0x2c')][_0x6e62('0x39')]){_0x5352d3[_0x6e62('0x3a')]=[{'all':!![]}];}_0x5352d3=_[_0x6e62('0x36')]({},_0x5352d3,_0x469fa1[_0x6e62('0x42')]);return db[_0x6e62('0x38')][_0x6e62('0x43')](_0x5352d3)[_0x6e62('0x22')](handleEntityNotFound(_0x940288,null))[_0x6e62('0x22')](respondWithResult(_0x940288,null))['catch'](handleError(_0x940288,null));};exports[_0x6e62('0x44')]=function(_0x158c75,_0x57c6d1){return db[_0x6e62('0x38')]['create'](_0x158c75[_0x6e62('0x45')],{})[_0x6e62('0x22')](respondWithResult(_0x57c6d1,0xc9))[_0x6e62('0x46')](handleError(_0x57c6d1,null));};exports['update']=function(_0x447fc2,_0x4745a3){if(_0x447fc2[_0x6e62('0x45')]['id']){delete _0x447fc2[_0x6e62('0x45')]['id'];}return db[_0x6e62('0x38')][_0x6e62('0x43')]({'where':{'id':_0x447fc2[_0x6e62('0x47')]['id']}})[_0x6e62('0x22')](handleEntityNotFound(_0x4745a3,null))[_0x6e62('0x22')](saveUpdates(_0x447fc2[_0x6e62('0x45')],null))[_0x6e62('0x22')](respondWithResult(_0x4745a3,null))['catch'](handleError(_0x4745a3,null));};exports['destroy']=function(_0x2d7732,_0xe6f92d){return db[_0x6e62('0x38')][_0x6e62('0x43')]({'where':{'id':_0x2d7732[_0x6e62('0x47')]['id']}})[_0x6e62('0x22')](handleEntityNotFound(_0xe6f92d,null))['then'](removeEntity(_0xe6f92d,null))[_0x6e62('0x46')](handleError(_0xe6f92d,null));};exports['describe']=function(_0x28bcb3,_0xead50c){return db[_0x6e62('0x38')][_0x6e62('0x48')]()[_0x6e62('0x22')](respondWithResult(_0xead50c,null))['catch'](handleError(_0xead50c,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 67e5136..f1f67d8 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 _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4c16b9,_0x3d3f24){var _0x2d25f7=function(_0x4cea4b){while(--_0x4cea4b){_0x4c16b9['push'](_0x4c16b9['shift']());}};_0x2d25f7(++_0x3d3f24);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x3c2202,_0x5b6da3){var _0x1574bf=function(_0x200e67){while(--_0x200e67){_0x3c2202['push'](_0x3c2202['shift']());}};_0x1574bf(++_0x5b6da3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0xcb91[_0x3ce2c4];return _0x4047c1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 59de502..d2ed307 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 _0x680f=['raw','stringify','update','UpdateChatQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','body','options'];(function(_0x4d2263,_0x3fbf0d){var _0x24aba0=function(_0x389a59){while(--_0x389a59){_0x4d2263['push'](_0x4d2263['shift']());}};_0x24aba0(++_0x3fbf0d);}(_0x680f,0x78));var _0xf680=function(_0x3983ff,_0x27b229){_0x3983ff=_0x3983ff-0x0;var _0x146863=_0x680f[_0x3983ff];return _0x146863;};'use strict';var _=require(_0xf680('0x0'));var util=require(_0xf680('0x1'));var moment=require(_0xf680('0x2'));var BPromise=require('bluebird');var rs=require(_0xf680('0x3'));var fs=require('fs');var Redis=require(_0xf680('0x4'));var db=require(_0xf680('0x5'))['db'];var utils=require(_0xf680('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf680('0x7'));var client=jayson[_0xf680('0x8')][_0xf680('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57f5de,_0x3951ab,_0x43241f){return new BPromise(function(_0x4ff382,_0x1450d7){return client[_0xf680('0xa')](_0x57f5de,_0x43241f)[_0xf680('0xb')](function(_0x1730b8){logger[_0xf680('0xc')](_0xf680('0xd'),_0x3951ab,'request\x20sent');logger[_0xf680('0xe')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x3951ab,_0xf680('0xf'),JSON['stringify'](_0x1730b8));if(_0x1730b8[_0xf680('0x10')]){if(_0x1730b8[_0xf680('0x10')][_0xf680('0x11')]===0x1f4){logger[_0xf680('0x10')](_0xf680('0xd'),_0x3951ab,_0x1730b8[_0xf680('0x10')][_0xf680('0x12')]);return _0x1450d7(_0x1730b8[_0xf680('0x10')][_0xf680('0x12')]);}logger[_0xf680('0x10')](_0xf680('0xd'),_0x3951ab,_0x1730b8[_0xf680('0x10')][_0xf680('0x12')]);return _0x4ff382(_0x1730b8['error'][_0xf680('0x12')]);}else{logger[_0xf680('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x3951ab,_0xf680('0xf'));_0x4ff382(_0x1730b8[_0xf680('0x13')][_0xf680('0x12')]);}})[_0xf680('0x14')](function(_0x2acdd5){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x3951ab,_0x2acdd5);_0x1450d7(_0x2acdd5);});});}exports[_0xf680('0x15')]=function(_0x49672a){var _0x5d7e0e=this;return new Promise(function(_0x1c5f71,_0x297910){return db[_0xf680('0x16')]['create'](_0x49672a[_0xf680('0x17')],{'raw':_0x49672a[_0xf680('0x18')]?_0x49672a[_0xf680('0x18')][_0xf680('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x55d0d1){logger[_0xf680('0xc')]('CreateChatQueueReport',_0x49672a);logger[_0xf680('0xe')]('CreateChatQueueReport',_0x49672a,JSON[_0xf680('0x1a')](_0x55d0d1));_0x1c5f71(_0x55d0d1);})[_0xf680('0x14')](function(_0x11add1){logger[_0xf680('0x10')]('CreateChatQueueReport',_0x11add1['message'],_0x49672a);_0x297910(_0x5d7e0e[_0xf680('0x10')](0x1f4,_0x11add1[_0xf680('0x12')]));});});};exports['UpdateChatQueueReport']=function(_0x1bf66a){var _0x317346=this;return new Promise(function(_0x3bcaac,_0x7d48ec){return db['ChatQueueReport'][_0xf680('0x1b')](_0x1bf66a['body'],{'raw':_0x1bf66a[_0xf680('0x18')]?_0x1bf66a[_0xf680('0x18')][_0xf680('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bf66a[_0xf680('0x18')]?_0x1bf66a[_0xf680('0x18')]['where']||null:null,'attributes':_0x1bf66a[_0xf680('0x18')]?_0x1bf66a[_0xf680('0x18')]['attributes']||null:null,'limit':_0x1bf66a[_0xf680('0x18')]?_0x1bf66a[_0xf680('0x18')]['limit']||null:null})[_0xf680('0xb')](function(_0x2ce435){logger[_0xf680('0xc')](_0xf680('0x1c'),_0x1bf66a);logger[_0xf680('0xe')]('UpdateChatQueueReport',_0x1bf66a,JSON[_0xf680('0x1a')](_0x2ce435));_0x3bcaac(_0x2ce435);})[_0xf680('0x14')](function(_0x58c34f){logger[_0xf680('0x10')](_0xf680('0x1c'),_0x58c34f['message'],_0x1bf66a);_0x7d48ec(_0x317346['error'](0x1f4,_0x58c34f['message']));});});}; \ No newline at end of file +var _0x1794=['CreateChatQueueReport','create','options','debug','UpdateChatQueueReport','ChatQueueReport','body','raw','where','attributes','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueueReport,\x20%s,\x20%s','result','catch'];(function(_0x59793c,_0x157e66){var _0x414073=function(_0x3482f1){while(--_0x3482f1){_0x59793c['push'](_0x59793c['shift']());}};_0x414073(++_0x157e66);}(_0x1794,0x19d));var _0x4179=function(_0x53bd67,_0x17782a){_0x53bd67=_0x53bd67-0x0;var _0x17d914=_0x1794[_0x53bd67];return _0x17d914;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4179('0x0'));var BPromise=require(_0x4179('0x1'));var rs=require(_0x4179('0x2'));var fs=require('fs');var Redis=require(_0x4179('0x3'));var db=require(_0x4179('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4179('0x5'));var config=require(_0x4179('0x6'));var jayson=require(_0x4179('0x7'));var client=jayson[_0x4179('0x8')][_0x4179('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x840dda,_0xcfdd0b,_0x24f3ff){return new BPromise(function(_0x45d2c9,_0x3fdaff){return client['request'](_0x840dda,_0x24f3ff)[_0x4179('0xa')](function(_0x1e52a6){logger[_0x4179('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0xcfdd0b,_0x4179('0xc'));logger['debug'](_0x4179('0xd'),_0xcfdd0b,'request\x20sent',JSON[_0x4179('0xe')](_0x1e52a6));if(_0x1e52a6['error']){if(_0x1e52a6[_0x4179('0xf')][_0x4179('0x10')]===0x1f4){logger[_0x4179('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0xcfdd0b,_0x1e52a6[_0x4179('0xf')]['message']);return _0x3fdaff(_0x1e52a6[_0x4179('0xf')][_0x4179('0x11')]);}logger['error'](_0x4179('0x12'),_0xcfdd0b,_0x1e52a6[_0x4179('0xf')]['message']);return _0x45d2c9(_0x1e52a6[_0x4179('0xf')][_0x4179('0x11')]);}else{logger[_0x4179('0xb')](_0x4179('0x12'),_0xcfdd0b,_0x4179('0xc'));_0x45d2c9(_0x1e52a6[_0x4179('0x13')][_0x4179('0x11')]);}})[_0x4179('0x14')](function(_0x2b82d0){logger[_0x4179('0xf')](_0x4179('0x12'),_0xcfdd0b,_0x2b82d0);_0x3fdaff(_0x2b82d0);});});}exports[_0x4179('0x15')]=function(_0x17c4ef){var _0x1b992a=this;return new Promise(function(_0x5e2e25,_0x297f3d){return db['ChatQueueReport'][_0x4179('0x16')](_0x17c4ef['body'],{'raw':_0x17c4ef[_0x4179('0x17')]?_0x17c4ef[_0x4179('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3d3264){logger[_0x4179('0xb')](_0x4179('0x15'),_0x17c4ef);logger[_0x4179('0x18')](_0x4179('0x15'),_0x17c4ef,JSON[_0x4179('0xe')](_0x3d3264));_0x5e2e25(_0x3d3264);})[_0x4179('0x14')](function(_0x10aaff){logger[_0x4179('0xf')](_0x4179('0x15'),_0x10aaff[_0x4179('0x11')],_0x17c4ef);_0x297f3d(_0x1b992a['error'](0x1f4,_0x10aaff['message']));});});};exports[_0x4179('0x19')]=function(_0x46e8d1){var _0xeabf9c=this;return new Promise(function(_0x1a46dc,_0x26ab63){return db[_0x4179('0x1a')]['update'](_0x46e8d1[_0x4179('0x1b')],{'raw':_0x46e8d1[_0x4179('0x17')]?_0x46e8d1[_0x4179('0x17')][_0x4179('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46e8d1['options']?_0x46e8d1[_0x4179('0x17')][_0x4179('0x1d')]||null:null,'attributes':_0x46e8d1[_0x4179('0x17')]?_0x46e8d1[_0x4179('0x17')][_0x4179('0x1e')]||null:null,'limit':_0x46e8d1[_0x4179('0x17')]?_0x46e8d1[_0x4179('0x17')]['limit']||null:null})['then'](function(_0x109820){logger[_0x4179('0xb')]('UpdateChatQueueReport',_0x46e8d1);logger[_0x4179('0x18')]('UpdateChatQueueReport',_0x46e8d1,JSON['stringify'](_0x109820));_0x1a46dc(_0x109820);})[_0x4179('0x14')](function(_0xd28fe3){logger[_0x4179('0xf')](_0x4179('0x19'),_0xd28fe3[_0x4179('0x11')],_0x46e8d1);_0x26ab63(_0xeabf9c['error'](0x1f4,_0xd28fe3['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index c9ce779..660bcb0 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 _0xddc9=['multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete'];(function(_0x206453,_0x46c9ec){var _0xcde5a9=function(_0x1cd1bc){while(--_0x1cd1bc){_0x206453['push'](_0x206453['shift']());}};_0xcde5a9(++_0x46c9ec);}(_0xddc9,0xd1));var _0x9ddc=function(_0x2ae621,_0x536d34){_0x2ae621=_0x2ae621-0x0;var _0x501ac8=_0xddc9[_0x2ae621];return _0x501ac8;};'use strict';var multer=require(_0x9ddc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9ddc('0x1'));var express=require(_0x9ddc('0x2'));var router=express['Router']();var fs_extra=require(_0x9ddc('0x3'));var auth=require(_0x9ddc('0x4'));var interaction=require(_0x9ddc('0x5'));var config=require(_0x9ddc('0x6'));var controller=require(_0x9ddc('0x7'));router[_0x9ddc('0x8')]('/',auth['isAuthenticated'](),controller[_0x9ddc('0x9')]);router[_0x9ddc('0x8')](_0x9ddc('0xa'),auth[_0x9ddc('0xb')](),controller[_0x9ddc('0xc')]);router[_0x9ddc('0x8')](_0x9ddc('0xd'),auth[_0x9ddc('0xb')](),controller[_0x9ddc('0xe')]);router[_0x9ddc('0xf')]('/',auth[_0x9ddc('0xb')](),controller[_0x9ddc('0x10')]);router[_0x9ddc('0x11')](_0x9ddc('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x9ddc('0x12')](_0x9ddc('0xd'),auth[_0x9ddc('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0396=['/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put'];(function(_0x14102c,_0x1cb214){var _0x13297b=function(_0x1f4372){while(--_0x1f4372){_0x14102c['push'](_0x14102c['shift']());}};_0x13297b(++_0x1cb214);}(_0x0396,0x72));var _0x6039=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x0396[_0x40bffc];return _0x3007e9;};'use strict';var multer=require(_0x6039('0x0'));var util=require(_0x6039('0x1'));var path=require(_0x6039('0x2'));var timeout=require('connect-timeout');var express=require(_0x6039('0x3'));var router=express[_0x6039('0x4')]();var fs_extra=require(_0x6039('0x5'));var auth=require(_0x6039('0x6'));var interaction=require(_0x6039('0x7'));var config=require('../../config/environment');var controller=require(_0x6039('0x8'));router['get']('/',auth[_0x6039('0x9')](),controller[_0x6039('0xa')]);router[_0x6039('0xb')](_0x6039('0xc'),auth[_0x6039('0x9')](),controller[_0x6039('0xd')]);router[_0x6039('0xb')]('/:id',auth[_0x6039('0x9')](),controller[_0x6039('0xe')]);router[_0x6039('0xf')]('/',auth['isAuthenticated'](),controller[_0x6039('0x10')]);router[_0x6039('0x11')](_0x6039('0x12'),auth[_0x6039('0x9')](),controller['update']);router[_0x6039('0x13')](_0x6039('0x12'),auth[_0x6039('0x9')](),controller[_0x6039('0x14')]);module[_0x6039('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 68fe3d4..a42b953 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x35ec9e,_0x1b5880){var _0x18a522=function(_0x1312a4){while(--_0x1312a4){_0x35ec9e['push'](_0x35ec9e['shift']());}};_0x18a522(++_0x1b5880);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x69752e,_0x2579f6){_0x69752e=_0x69752e-0x0;var _0x506a36=_0xf3cd[_0x69752e];return _0x506a36;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x20baf0,_0x5b3391){var _0x391d3a=function(_0xea37eb){while(--_0xea37eb){_0x20baf0['push'](_0x20baf0['shift']());}};_0x391d3a(++_0x5b3391);}(_0xaa88,0x137));var _0x8aa8=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xaa88[_0x1e3c16];return _0x47a0c9;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 8a2bd62..f532a30 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 _0x5700=['sox','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','ChatTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','include','findAll','catch','params','options','find','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x65b1ab,_0x2d1e7a){var _0x3d20ed=function(_0x2d6ad9){while(--_0x2d6ad9){_0x65b1ab['push'](_0x65b1ab['shift']());}};_0x3d20ed(++_0x2d1e7a);}(_0x5700,0x161));var _0x0570=function(_0x51ae35,_0x3f66b5){_0x51ae35=_0x51ae35-0x0;var _0x3cc758=_0x5700[_0x51ae35];return _0x3cc758;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0570('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0570('0x1'));var rp=require('request-promise');var moment=require(_0x0570('0x2'));var BPromise=require(_0x0570('0x3'));var Mustache=require(_0x0570('0x4'));var util=require(_0x0570('0x5'));var path=require(_0x0570('0x6'));var sox=require(_0x0570('0x7'));var csv=require('to-csv');var ejs=require(_0x0570('0x8'));var fs=require('fs');var fs_extra=require(_0x0570('0x9'));var _=require('lodash');var squel=require(_0x0570('0xa'));var crypto=require(_0x0570('0xb'));var jsforce=require(_0x0570('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0570('0xd'));var Papa=require(_0x0570('0xe'));var Redis=require(_0x0570('0xf'));var authService=require(_0x0570('0x10'));var qs=require(_0x0570('0x11'));var as=require(_0x0570('0x12'));var hardwareService=require(_0x0570('0x13'));var logger=require(_0x0570('0x14'))(_0x0570('0x15'));var utils=require(_0x0570('0x16'));var config=require(_0x0570('0x17'));var licenseUtil=require(_0x0570('0x18'));var db=require(_0x0570('0x19'))['db'];function respondWithStatusCode(_0x4f7dc1,_0x27afc9){_0x27afc9=_0x27afc9||0xcc;return function(_0x3ac3d8){if(_0x3ac3d8){return _0x4f7dc1['sendStatus'](_0x27afc9);}return _0x4f7dc1[_0x0570('0x1a')](_0x27afc9)[_0x0570('0x1b')]();};}function respondWithResult(_0x19371b,_0x293c78){_0x293c78=_0x293c78||0xc8;return function(_0xc22b2d){if(_0xc22b2d){return _0x19371b[_0x0570('0x1a')](_0x293c78)[_0x0570('0x1c')](_0xc22b2d);}};}function respondWithFilteredResult(_0x2f2979,_0x149669){return function(_0x3c6609){if(_0x3c6609){var _0x234d50=typeof _0x149669[_0x0570('0x1d')]===_0x0570('0x1e')&&typeof _0x149669['limit']===_0x0570('0x1e');var _0x597228=_0x3c6609[_0x0570('0x1f')];var _0xfc018d=_0x234d50?0x0:_0x149669[_0x0570('0x1d')];var _0x4c0ee1=_0x234d50?_0x3c6609['count']:_0x149669[_0x0570('0x1d')]+_0x149669[_0x0570('0x20')];var _0x2a0c4c;if(_0x4c0ee1>=_0x597228){_0x4c0ee1=_0x597228;_0x2a0c4c=0xc8;}else{_0x2a0c4c=0xce;}_0x2f2979[_0x0570('0x1a')](_0x2a0c4c);return _0x2f2979['set'](_0x0570('0x21'),_0xfc018d+'-'+_0x4c0ee1+'/'+_0x597228)['json'](_0x3c6609);}return null;};}function patchUpdates(_0x263470){return function(_0x3689fc){try{jsonpatch[_0x0570('0x22')](_0x3689fc,_0x263470,!![]);}catch(_0x4adc28){return BPromise[_0x0570('0x23')](_0x4adc28);}return _0x3689fc['save']();};}function saveUpdates(_0x196b2b,_0x1c1bff){return function(_0x30def7){if(_0x30def7){return _0x30def7[_0x0570('0x24')](_0x196b2b)[_0x0570('0x25')](function(_0x296885){return _0x296885;});}return null;};}function removeEntity(_0x206b0c,_0x396396){return function(_0x1adb3){if(_0x1adb3){return _0x1adb3[_0x0570('0x26')]()[_0x0570('0x25')](function(){_0x206b0c[_0x0570('0x1a')](0xcc)[_0x0570('0x1b')]();});}};}function handleEntityNotFound(_0x2ba4f3,_0x5b9ae0){return function(_0x37d158){if(!_0x37d158){_0x2ba4f3['sendStatus'](0x194);}return _0x37d158;};}function handleError(_0x4f499f,_0x557f51){_0x557f51=_0x557f51||0x1f4;return function(_0x4647c4){logger[_0x0570('0x27')](_0x4647c4[_0x0570('0x28')]);if(_0x4647c4[_0x0570('0x29')]){delete _0x4647c4[_0x0570('0x29')];}_0x4f499f[_0x0570('0x1a')](_0x557f51)['send'](_0x4647c4);};}exports[_0x0570('0x2a')]=function(_0x3f6fa4,_0xb94a73){var _0x28cd56={},_0xa465c0={},_0x2caec4={'count':0x0,'rows':[]};var _0x27946b=_[_0x0570('0x2b')](db[_0x0570('0x2c')][_0x0570('0x2d')],function(_0x2b0d45){return{'name':_0x2b0d45[_0x0570('0x2e')],'type':_0x2b0d45['type'][_0x0570('0x2f')]};});_0xa465c0[_0x0570('0x30')]=_['map'](_0x27946b,_0x0570('0x29'));_0xa465c0[_0x0570('0x31')]=_[_0x0570('0x32')](_0x3f6fa4[_0x0570('0x31')]);_0xa465c0[_0x0570('0x33')]=_[_0x0570('0x34')](_0xa465c0['model'],_0xa465c0[_0x0570('0x31')]);_0x28cd56[_0x0570('0x35')]=_[_0x0570('0x34')](_0xa465c0[_0x0570('0x30')],qs[_0x0570('0x36')](_0x3f6fa4[_0x0570('0x31')][_0x0570('0x36')]));_0x28cd56[_0x0570('0x35')]=_0x28cd56[_0x0570('0x35')][_0x0570('0x37')]?_0x28cd56[_0x0570('0x35')]:_0xa465c0[_0x0570('0x30')];if(!_0x3f6fa4['query'][_0x0570('0x38')](_0x0570('0x39'))){_0x28cd56[_0x0570('0x20')]=qs['limit'](_0x3f6fa4[_0x0570('0x31')][_0x0570('0x20')]);_0x28cd56[_0x0570('0x1d')]=qs[_0x0570('0x1d')](_0x3f6fa4[_0x0570('0x31')][_0x0570('0x1d')]);}_0x28cd56[_0x0570('0x3a')]=qs[_0x0570('0x3b')](_0x3f6fa4[_0x0570('0x31')][_0x0570('0x3b')]);_0x28cd56[_0x0570('0x3c')]=qs['filters'](_[_0x0570('0x3d')](_0x3f6fa4[_0x0570('0x31')],_0xa465c0[_0x0570('0x33')]),_0x27946b);if(_0x3f6fa4[_0x0570('0x31')]['filter']){_0x28cd56[_0x0570('0x3c')]=_[_0x0570('0x3e')](_0x28cd56[_0x0570('0x3c')],{'$or':_[_0x0570('0x2b')](_0x27946b,function(_0x102291){if(_0x102291[_0x0570('0x3f')]!=='VIRTUAL'){var _0x278f56={};_0x278f56[_0x102291[_0x0570('0x29')]]={'$like':'%'+_0x3f6fa4[_0x0570('0x31')]['filter']+'%'};return _0x278f56;}})});}_0x28cd56=_[_0x0570('0x3e')]({},_0x28cd56,_0x3f6fa4['options']);var _0xcdbd8b={'where':_0x28cd56[_0x0570('0x3c')]};return db[_0x0570('0x2c')]['count'](_0xcdbd8b)[_0x0570('0x25')](function(_0x229071){_0x2caec4[_0x0570('0x1f')]=_0x229071;if(_0x3f6fa4[_0x0570('0x31')]['includeAll']){_0x28cd56[_0x0570('0x40')]=[{'all':!![]}];}return db[_0x0570('0x2c')][_0x0570('0x41')](_0x28cd56);})[_0x0570('0x25')](function(_0x4bbfba){_0x2caec4['rows']=_0x4bbfba;return _0x2caec4;})[_0x0570('0x25')](respondWithFilteredResult(_0xb94a73,_0x28cd56))[_0x0570('0x42')](handleError(_0xb94a73,null));};exports['show']=function(_0x3a53bf,_0x193253){var _0x10fc90={'raw':!![],'where':{'id':_0x3a53bf[_0x0570('0x43')]['id']}},_0x5f3874={};_0x5f3874[_0x0570('0x30')]=_['keys'](db['ChatTransferReport'][_0x0570('0x2d')]);_0x5f3874[_0x0570('0x31')]=_['keys'](_0x3a53bf[_0x0570('0x31')]);_0x5f3874[_0x0570('0x33')]=_[_0x0570('0x34')](_0x5f3874[_0x0570('0x30')],_0x5f3874[_0x0570('0x31')]);_0x10fc90[_0x0570('0x35')]=_['intersection'](_0x5f3874[_0x0570('0x30')],qs[_0x0570('0x36')](_0x3a53bf[_0x0570('0x31')][_0x0570('0x36')]));_0x10fc90['attributes']=_0x10fc90[_0x0570('0x35')][_0x0570('0x37')]?_0x10fc90[_0x0570('0x35')]:_0x5f3874['model'];if(_0x3a53bf[_0x0570('0x31')]['includeAll']){_0x10fc90[_0x0570('0x40')]=[{'all':!![]}];}_0x10fc90=_[_0x0570('0x3e')]({},_0x10fc90,_0x3a53bf[_0x0570('0x44')]);return db[_0x0570('0x2c')][_0x0570('0x45')](_0x10fc90)[_0x0570('0x25')](handleEntityNotFound(_0x193253,null))[_0x0570('0x25')](respondWithResult(_0x193253,null))[_0x0570('0x42')](handleError(_0x193253,null));};exports['create']=function(_0x44a367,_0x2fd3be){return db[_0x0570('0x2c')]['create'](_0x44a367['body'],{})['then'](respondWithResult(_0x2fd3be,0xc9))[_0x0570('0x42')](handleError(_0x2fd3be,null));};exports[_0x0570('0x24')]=function(_0x66980e,_0x2d2a36){if(_0x66980e[_0x0570('0x46')]['id']){delete _0x66980e[_0x0570('0x46')]['id'];}return db[_0x0570('0x2c')]['find']({'where':{'id':_0x66980e[_0x0570('0x43')]['id']}})['then'](handleEntityNotFound(_0x2d2a36,null))[_0x0570('0x25')](saveUpdates(_0x66980e[_0x0570('0x46')],null))[_0x0570('0x25')](respondWithResult(_0x2d2a36,null))[_0x0570('0x42')](handleError(_0x2d2a36,null));};exports[_0x0570('0x26')]=function(_0x2a8c0a,_0x3d1a80){return db[_0x0570('0x2c')][_0x0570('0x45')]({'where':{'id':_0x2a8c0a['params']['id']}})[_0x0570('0x25')](handleEntityNotFound(_0x3d1a80,null))['then'](removeEntity(_0x3d1a80,null))[_0x0570('0x42')](handleError(_0x3d1a80,null));};exports[_0x0570('0x47')]=function(_0x3f635e,_0x2d3a4e){return db['ChatTransferReport'][_0x0570('0x47')]()[_0x0570('0x25')](respondWithResult(_0x2d3a4e,null))[_0x0570('0x42')](handleError(_0x2d3a4e,null));}; \ No newline at end of file +var _0xf5ef=['request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','ChatTransferReport','type','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','fields','includeAll','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x1a956d,_0x5c51c){var _0x153024=function(_0x21b45e){while(--_0x21b45e){_0x1a956d['push'](_0x1a956d['shift']());}};_0x153024(++_0x5c51c);}(_0xf5ef,0x92));var _0xff5e=function(_0x1a78a4,_0x2d294e){_0x1a78a4=_0x1a78a4-0x0;var _0x3792c1=_0xf5ef[_0x1a78a4];return _0x3792c1;};'use strict';var emlformat=require(_0xff5e('0x0'));var rimraf=require(_0xff5e('0x1'));var zipdir=require(_0xff5e('0x2'));var jsonpatch=require(_0xff5e('0x3'));var rp=require(_0xff5e('0x4'));var moment=require('moment');var BPromise=require(_0xff5e('0x5'));var Mustache=require(_0xff5e('0x6'));var util=require(_0xff5e('0x7'));var path=require('path');var sox=require(_0xff5e('0x8'));var csv=require(_0xff5e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xff5e('0xa'));var _=require(_0xff5e('0xb'));var squel=require('squel');var crypto=require(_0xff5e('0xc'));var jsforce=require(_0xff5e('0xd'));var deskjs=require(_0xff5e('0xe'));var toCsv=require(_0xff5e('0x9'));var querystring=require('querystring');var Papa=require(_0xff5e('0xf'));var Redis=require(_0xff5e('0x10'));var authService=require(_0xff5e('0x11'));var qs=require(_0xff5e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff5e('0x13'));var logger=require(_0xff5e('0x14'))('api');var utils=require(_0xff5e('0x15'));var config=require(_0xff5e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xff5e('0x17'))['db'];function respondWithStatusCode(_0x45d9d2,_0x366646){_0x366646=_0x366646||0xcc;return function(_0x17ee5f){if(_0x17ee5f){return _0x45d9d2[_0xff5e('0x18')](_0x366646);}return _0x45d9d2[_0xff5e('0x19')](_0x366646)[_0xff5e('0x1a')]();};}function respondWithResult(_0x57b95d,_0x284a27){_0x284a27=_0x284a27||0xc8;return function(_0x504e12){if(_0x504e12){return _0x57b95d[_0xff5e('0x19')](_0x284a27)['json'](_0x504e12);}};}function respondWithFilteredResult(_0x136425,_0x661928){return function(_0x4c183e){if(_0x4c183e){var _0x5704c0=typeof _0x661928[_0xff5e('0x1b')]===_0xff5e('0x1c')&&typeof _0x661928[_0xff5e('0x1d')]==='undefined';var _0x2ee03b=_0x4c183e['count'];var _0x3adf61=_0x5704c0?0x0:_0x661928[_0xff5e('0x1b')];var _0x3073b3=_0x5704c0?_0x4c183e[_0xff5e('0x1e')]:_0x661928[_0xff5e('0x1b')]+_0x661928['limit'];var _0x5d9226;if(_0x3073b3>=_0x2ee03b){_0x3073b3=_0x2ee03b;_0x5d9226=0xc8;}else{_0x5d9226=0xce;}_0x136425[_0xff5e('0x19')](_0x5d9226);return _0x136425[_0xff5e('0x1f')](_0xff5e('0x20'),_0x3adf61+'-'+_0x3073b3+'/'+_0x2ee03b)['json'](_0x4c183e);}return null;};}function patchUpdates(_0x2a030b){return function(_0x45556e){try{jsonpatch[_0xff5e('0x21')](_0x45556e,_0x2a030b,!![]);}catch(_0x1a82cb){return BPromise['reject'](_0x1a82cb);}return _0x45556e['save']();};}function saveUpdates(_0x5cb293,_0x2fbed6){return function(_0x255e19){if(_0x255e19){return _0x255e19[_0xff5e('0x22')](_0x5cb293)[_0xff5e('0x23')](function(_0x191a60){return _0x191a60;});}return null;};}function removeEntity(_0x184a2a,_0x4ace92){return function(_0x630138){if(_0x630138){return _0x630138[_0xff5e('0x24')]()[_0xff5e('0x23')](function(){_0x184a2a[_0xff5e('0x19')](0xcc)[_0xff5e('0x1a')]();});}};}function handleEntityNotFound(_0x1e84ee,_0x225560){return function(_0x587dd9){if(!_0x587dd9){_0x1e84ee['sendStatus'](0x194);}return _0x587dd9;};}function handleError(_0x4cdc93,_0x53f172){_0x53f172=_0x53f172||0x1f4;return function(_0x5aacd7){logger[_0xff5e('0x25')](_0x5aacd7[_0xff5e('0x26')]);if(_0x5aacd7[_0xff5e('0x27')]){delete _0x5aacd7[_0xff5e('0x27')];}_0x4cdc93[_0xff5e('0x19')](_0x53f172)[_0xff5e('0x28')](_0x5aacd7);};}exports[_0xff5e('0x29')]=function(_0x2b873,_0x2d7067){var _0x516612={},_0x59c0e5={},_0x49a540={'count':0x0,'rows':[]};var _0x38f8f9=_[_0xff5e('0x2a')](db[_0xff5e('0x2b')]['rawAttributes'],function(_0xbd309){return{'name':_0xbd309['fieldName'],'type':_0xbd309[_0xff5e('0x2c')][_0xff5e('0x2d')]};});_0x59c0e5['model']=_[_0xff5e('0x2a')](_0x38f8f9,_0xff5e('0x27'));_0x59c0e5[_0xff5e('0x2e')]=_[_0xff5e('0x2f')](_0x2b873[_0xff5e('0x2e')]);_0x59c0e5[_0xff5e('0x30')]=_[_0xff5e('0x31')](_0x59c0e5[_0xff5e('0x32')],_0x59c0e5[_0xff5e('0x2e')]);_0x516612[_0xff5e('0x33')]=_[_0xff5e('0x31')](_0x59c0e5[_0xff5e('0x32')],qs['fields'](_0x2b873['query']['fields']));_0x516612[_0xff5e('0x33')]=_0x516612[_0xff5e('0x33')]['length']?_0x516612['attributes']:_0x59c0e5[_0xff5e('0x32')];if(!_0x2b873['query'][_0xff5e('0x34')](_0xff5e('0x35'))){_0x516612[_0xff5e('0x1d')]=qs['limit'](_0x2b873[_0xff5e('0x2e')][_0xff5e('0x1d')]);_0x516612['offset']=qs[_0xff5e('0x1b')](_0x2b873[_0xff5e('0x2e')][_0xff5e('0x1b')]);}_0x516612[_0xff5e('0x36')]=qs[_0xff5e('0x37')](_0x2b873[_0xff5e('0x2e')]['sort']);_0x516612[_0xff5e('0x38')]=qs[_0xff5e('0x30')](_[_0xff5e('0x39')](_0x2b873[_0xff5e('0x2e')],_0x59c0e5[_0xff5e('0x30')]),_0x38f8f9);if(_0x2b873[_0xff5e('0x2e')][_0xff5e('0x3a')]){_0x516612[_0xff5e('0x38')]=_[_0xff5e('0x3b')](_0x516612[_0xff5e('0x38')],{'$or':_[_0xff5e('0x2a')](_0x38f8f9,function(_0x34547e){if(_0x34547e[_0xff5e('0x2c')]!==_0xff5e('0x3c')){var _0x2508ca={};_0x2508ca[_0x34547e[_0xff5e('0x27')]]={'$like':'%'+_0x2b873[_0xff5e('0x2e')][_0xff5e('0x3a')]+'%'};return _0x2508ca;}})});}_0x516612=_[_0xff5e('0x3b')]({},_0x516612,_0x2b873[_0xff5e('0x3d')]);var _0x5a58f5={'where':_0x516612[_0xff5e('0x38')]};return db[_0xff5e('0x2b')][_0xff5e('0x1e')](_0x5a58f5)[_0xff5e('0x23')](function(_0x2cfdcf){_0x49a540[_0xff5e('0x1e')]=_0x2cfdcf;if(_0x2b873[_0xff5e('0x2e')]['includeAll']){_0x516612[_0xff5e('0x3e')]=[{'all':!![]}];}return db[_0xff5e('0x2b')][_0xff5e('0x3f')](_0x516612);})[_0xff5e('0x23')](function(_0x477164){_0x49a540[_0xff5e('0x40')]=_0x477164;return _0x49a540;})[_0xff5e('0x23')](respondWithFilteredResult(_0x2d7067,_0x516612))[_0xff5e('0x41')](handleError(_0x2d7067,null));};exports[_0xff5e('0x42')]=function(_0x355ff4,_0x483e8e){var _0x188518={'raw':!![],'where':{'id':_0x355ff4['params']['id']}},_0x5e4f04={};_0x5e4f04[_0xff5e('0x32')]=_[_0xff5e('0x2f')](db[_0xff5e('0x2b')][_0xff5e('0x43')]);_0x5e4f04[_0xff5e('0x2e')]=_['keys'](_0x355ff4[_0xff5e('0x2e')]);_0x5e4f04[_0xff5e('0x30')]=_['intersection'](_0x5e4f04[_0xff5e('0x32')],_0x5e4f04[_0xff5e('0x2e')]);_0x188518[_0xff5e('0x33')]=_[_0xff5e('0x31')](_0x5e4f04[_0xff5e('0x32')],qs['fields'](_0x355ff4[_0xff5e('0x2e')][_0xff5e('0x44')]));_0x188518[_0xff5e('0x33')]=_0x188518[_0xff5e('0x33')]['length']?_0x188518[_0xff5e('0x33')]:_0x5e4f04[_0xff5e('0x32')];if(_0x355ff4[_0xff5e('0x2e')][_0xff5e('0x45')]){_0x188518[_0xff5e('0x3e')]=[{'all':!![]}];}_0x188518=_[_0xff5e('0x3b')]({},_0x188518,_0x355ff4[_0xff5e('0x3d')]);return db[_0xff5e('0x2b')]['find'](_0x188518)[_0xff5e('0x23')](handleEntityNotFound(_0x483e8e,null))[_0xff5e('0x23')](respondWithResult(_0x483e8e,null))['catch'](handleError(_0x483e8e,null));};exports[_0xff5e('0x46')]=function(_0x58c5f9,_0x35c9a2){return db[_0xff5e('0x2b')]['create'](_0x58c5f9['body'],{})[_0xff5e('0x23')](respondWithResult(_0x35c9a2,0xc9))[_0xff5e('0x41')](handleError(_0x35c9a2,null));};exports[_0xff5e('0x22')]=function(_0x486d27,_0x1c3d04){if(_0x486d27[_0xff5e('0x47')]['id']){delete _0x486d27['body']['id'];}return db['ChatTransferReport'][_0xff5e('0x48')]({'where':{'id':_0x486d27[_0xff5e('0x49')]['id']}})[_0xff5e('0x23')](handleEntityNotFound(_0x1c3d04,null))['then'](saveUpdates(_0x486d27[_0xff5e('0x47')],null))[_0xff5e('0x23')](respondWithResult(_0x1c3d04,null))[_0xff5e('0x41')](handleError(_0x1c3d04,null));};exports[_0xff5e('0x24')]=function(_0x2221a1,_0x418bc8){return db[_0xff5e('0x2b')]['find']({'where':{'id':_0x2221a1[_0xff5e('0x49')]['id']}})[_0xff5e('0x23')](handleEntityNotFound(_0x418bc8,null))[_0xff5e('0x23')](removeEntity(_0x418bc8,null))[_0xff5e('0x41')](handleError(_0x418bc8,null));};exports[_0xff5e('0x4a')]=function(_0x3ab53c,_0x4b88b5){return db[_0xff5e('0x2b')][_0xff5e('0x4a')]()[_0xff5e('0x23')](respondWithResult(_0x4b88b5,null))[_0xff5e('0x41')](handleError(_0x4b88b5,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 14cb648..3e8c2d6 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 _0x984b=['path','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport','report_chat_transfer','uniqueid','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x13bb89,_0x4e4a1d){var _0x3cf9dd=function(_0x20d5cf){while(--_0x20d5cf){_0x13bb89['push'](_0x13bb89['shift']());}};_0x3cf9dd(++_0x4e4a1d);}(_0x984b,0x17b));var _0xb984=function(_0x5beaf0,_0x44a1df){_0x5beaf0=_0x5beaf0-0x0;var _0x377e7e=_0x984b[_0x5beaf0];return _0x377e7e;};'use strict';var _=require('lodash');var util=require(_0xb984('0x0'));var logger=require(_0xb984('0x1'))('api');var moment=require(_0xb984('0x2'));var BPromise=require(_0xb984('0x3'));var rp=require(_0xb984('0x4'));var fs=require('fs');var path=require(_0xb984('0x5'));var rimraf=require('rimraf');var config=require(_0xb984('0x6'));var attributes=require(_0xb984('0x7'));module['exports']=function(_0x3057bf,_0x4776e0){return _0x3057bf[_0xb984('0x8')](_0xb984('0x9'),attributes,{'tableName':_0xb984('0xa'),'paranoid':![],'indexes':[{'name':_0xb984('0xb'),'fields':[_0xb984('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0a0c=['../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x125318,_0x445a92){var _0xa9a105=function(_0x3a296d){while(--_0x3a296d){_0x125318['push'](_0x125318['shift']());}};_0xa9a105(++_0x445a92);}(_0x0a0c,0x12f));var _0xc0a0=function(_0x3892e3,_0x24cfbc){_0x3892e3=_0x3892e3-0x0;var _0x35ba3c=_0x0a0c[_0x3892e3];return _0x35ba3c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc0a0('0x0'))(_0xc0a0('0x1'));var moment=require(_0xc0a0('0x2'));var BPromise=require('bluebird');var rp=require(_0xc0a0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc0a0('0x4'));var config=require(_0xc0a0('0x5'));var attributes=require(_0xc0a0('0x6'));module[_0xc0a0('0x7')]=function(_0x578ca7,_0x313b8d){return _0x578ca7['define'](_0xc0a0('0x8'),attributes,{'tableName':_0xc0a0('0x9'),'paranoid':![],'indexes':[{'name':_0xc0a0('0xa'),'fields':[_0xc0a0('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index e13bf00..5a8ac61 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 _0x4f1e=['../../config/environment','client','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x32c082,_0x48d535){var _0x41f3e9=function(_0x2ef037){while(--_0x2ef037){_0x32c082['push'](_0x32c082['shift']());}};_0x41f3e9(++_0x48d535);}(_0x4f1e,0x76));var _0xe4f1=function(_0x1c91f6,_0x21d75e){_0x1c91f6=_0x1c91f6-0x0;var _0x11f1c6=_0x4f1e[_0x1c91f6];return _0x11f1c6;};'use strict';var _=require(_0xe4f1('0x0'));var util=require(_0xe4f1('0x1'));var moment=require('moment');var BPromise=require(_0xe4f1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4f1('0x3'));var db=require(_0xe4f1('0x4'))['db'];var utils=require(_0xe4f1('0x5'));var logger=require(_0xe4f1('0x6'))(_0xe4f1('0x7'));var config=require(_0xe4f1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe4f1('0x9')][_0xe4f1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4aeb98,_0x207e6b,_0x1e9729){return new BPromise(function(_0x12990e,_0x3c9b4f){return client['request'](_0x4aeb98,_0x1e9729)[_0xe4f1('0xb')](function(_0x45cdc6){logger[_0xe4f1('0xc')](_0xe4f1('0xd'),_0x207e6b,_0xe4f1('0xe'));logger[_0xe4f1('0xf')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x207e6b,_0xe4f1('0xe'),JSON[_0xe4f1('0x10')](_0x45cdc6));if(_0x45cdc6['error']){if(_0x45cdc6[_0xe4f1('0x11')][_0xe4f1('0x12')]===0x1f4){logger['error'](_0xe4f1('0xd'),_0x207e6b,_0x45cdc6[_0xe4f1('0x11')][_0xe4f1('0x13')]);return _0x3c9b4f(_0x45cdc6[_0xe4f1('0x11')][_0xe4f1('0x13')]);}logger[_0xe4f1('0x11')](_0xe4f1('0xd'),_0x207e6b,_0x45cdc6['error']['message']);return _0x12990e(_0x45cdc6[_0xe4f1('0x11')]['message']);}else{logger[_0xe4f1('0xc')](_0xe4f1('0xd'),_0x207e6b,_0xe4f1('0xe'));_0x12990e(_0x45cdc6['result'][_0xe4f1('0x13')]);}})[_0xe4f1('0x14')](function(_0x238ca5){logger[_0xe4f1('0x11')](_0xe4f1('0xd'),_0x207e6b,_0x238ca5);_0x3c9b4f(_0x238ca5);});});} \ No newline at end of file +var _0x28a4=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x40de6f,_0x3d5f9c){var _0x44a887=function(_0x2d6564){while(--_0x2d6564){_0x40de6f['push'](_0x40de6f['shift']());}};_0x44a887(++_0x3d5f9c);}(_0x28a4,0xe6));var _0x428a=function(_0x54b5bd,_0x133fe1){_0x54b5bd=_0x54b5bd-0x0;var _0xcba844=_0x28a4[_0x54b5bd];return _0xcba844;};'use strict';var _=require('lodash');var util=require(_0x428a('0x0'));var moment=require(_0x428a('0x1'));var BPromise=require(_0x428a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x428a('0x3'));var db=require(_0x428a('0x4'))['db'];var utils=require(_0x428a('0x5'));var logger=require(_0x428a('0x6'))(_0x428a('0x7'));var config=require('../../config/environment');var jayson=require(_0x428a('0x8'));var client=jayson[_0x428a('0x9')][_0x428a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13706c,_0x2de4ec,_0x2c4314){return new BPromise(function(_0x8c67d4,_0x525c28){return client[_0x428a('0xb')](_0x13706c,_0x2c4314)[_0x428a('0xc')](function(_0x5c1aa8){logger[_0x428a('0xd')](_0x428a('0xe'),_0x2de4ec,'request\x20sent');logger[_0x428a('0xf')](_0x428a('0x10'),_0x2de4ec,_0x428a('0x11'),JSON[_0x428a('0x12')](_0x5c1aa8));if(_0x5c1aa8['error']){if(_0x5c1aa8[_0x428a('0x13')]['code']===0x1f4){logger[_0x428a('0x13')](_0x428a('0xe'),_0x2de4ec,_0x5c1aa8['error']['message']);return _0x525c28(_0x5c1aa8['error'][_0x428a('0x14')]);}logger[_0x428a('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x2de4ec,_0x5c1aa8[_0x428a('0x13')][_0x428a('0x14')]);return _0x8c67d4(_0x5c1aa8['error'][_0x428a('0x14')]);}else{logger['info'](_0x428a('0xe'),_0x2de4ec,_0x428a('0x11'));_0x8c67d4(_0x5c1aa8[_0x428a('0x15')]['message']);}})[_0x428a('0x16')](function(_0x509010){logger[_0x428a('0x13')](_0x428a('0xe'),_0x2de4ec,_0x509010);_0x525c28(_0x509010);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 856ab9f..461ec8d 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 _0xf93b=['isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller'];(function(_0x4d79bc,_0x32c905){var _0x4b4760=function(_0x212302){while(--_0x212302){_0x4d79bc['push'](_0x4d79bc['shift']());}};_0x4b4760(++_0x32c905);}(_0xf93b,0x1af));var _0xbf93=function(_0x5ad07c,_0x324dcd){_0x5ad07c=_0x5ad07c-0x0;var _0x204bae=_0xf93b[_0x5ad07c];return _0x204bae;};'use strict';var multer=require(_0xbf93('0x0'));var util=require('util');var path=require(_0xbf93('0x1'));var timeout=require('connect-timeout');var express=require(_0xbf93('0x2'));var router=express[_0xbf93('0x3')]();var fs_extra=require(_0xbf93('0x4'));var auth=require(_0xbf93('0x5'));var interaction=require(_0xbf93('0x6'));var config=require(_0xbf93('0x7'));var controller=require(_0xbf93('0x8'));router['get']('/',auth[_0xbf93('0x9')](),controller[_0xbf93('0xa')]);router['get'](_0xbf93('0xb'),auth[_0xbf93('0x9')](),controller[_0xbf93('0xc')]);router['get'](_0xbf93('0xd'),auth[_0xbf93('0x9')](),controller[_0xbf93('0xe')]);router[_0xbf93('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbf93('0x10')](_0xbf93('0xd'),auth[_0xbf93('0x9')](),controller[_0xbf93('0x11')]);router[_0xbf93('0x12')](_0xbf93('0xd'),auth[_0xbf93('0x9')](),controller[_0xbf93('0x13')]);module['exports']=router; \ No newline at end of file +var _0x7f3b=['../../components/interaction/service','../../config/environment','./chatTransferReport.controller','isAuthenticated','index','/describe','describe','get','/:id','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4cf666,_0x539dd2){var _0x3f9979=function(_0x3ee724){while(--_0x3ee724){_0x4cf666['push'](_0x4cf666['shift']());}};_0x3f9979(++_0x539dd2);}(_0x7f3b,0x6b));var _0xb7f3=function(_0x35521b,_0xd602cc){_0x35521b=_0x35521b-0x0;var _0x4c35ce=_0x7f3b[_0x35521b];return _0x4c35ce;};'use strict';var multer=require(_0xb7f3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb7f3('0x1'));var express=require(_0xb7f3('0x2'));var router=express[_0xb7f3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb7f3('0x4'));var interaction=require(_0xb7f3('0x5'));var config=require(_0xb7f3('0x6'));var controller=require(_0xb7f3('0x7'));router['get']('/',auth[_0xb7f3('0x8')](),controller[_0xb7f3('0x9')]);router['get'](_0xb7f3('0xa'),auth['isAuthenticated'](),controller[_0xb7f3('0xb')]);router[_0xb7f3('0xc')]('/:id',auth[_0xb7f3('0x8')](),controller['show']);router['post']('/',auth[_0xb7f3('0x8')](),controller['create']);router['put'](_0xb7f3('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xb7f3('0xe')](_0xb7f3('0xd'),auth[_0xb7f3('0x8')](),controller[_0xb7f3('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index b2c06a8..6b121eb 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 _0x4522=['mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','email','Agent','#011F6A','#ffffff','rounded','squared','We\x20are\x20here!','Chat','BOOLEAN','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Send','Feedback','ENUM','star','INTEGER','input','name','text','getDataValue','onlineForm','parse','stringify','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','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.','website_alias','bottom_right','alternate','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4522,0x1a0));var _0x2452=function(_0x352183,_0x24ff7c){_0x352183=_0x352183-0x0;var _0x252300=_0x4522[_0x352183];return _0x252300;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x2452('0x0')]={'name':{'type':Sequelize[_0x2452('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x2452('0x1')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x2452('0x1')]},'mapKey':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x2')},'mapKeyOffline':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x2')},'key':{'type':Sequelize[_0x2452('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x3')},'customerAlias':{'type':Sequelize[_0x2452('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x2452('0x1')],'allowNull':![],'defaultValue':_0x2452('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x2452('0x1')],'allowNull':![],'defaultValue':_0x2452('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x2452('0x1')],'allowNull':![],'defaultValue':_0x2452('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x2452('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x2452('0x1')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x2452('0x6'),_0x2452('0x7')),'defaultValue':_0x2452('0x6')},'header_online':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x8')},'start_chat_button':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x9')},'offline_chat_button':{'type':Sequelize[_0x2452('0x1')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x2452('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x2452('0x1')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x2452('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x2452('0xb')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x2452('0xc')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x2452('0xd')},'formSubmitFailureMessage':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0xe')},'noteTitle':{'type':Sequelize[_0x2452('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0xf')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x10')},'skipMessageButton':{'type':Sequelize[_0x2452('0x1')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x11')},'ratingType':{'type':Sequelize[_0x2452('0x12')](_0x2452('0x13'),'thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x2452('0x14')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x2452('0xb')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x2452('0x15'),'variable':null,'config':{'placeholder':_0x2452('0x16'),'type':_0x2452('0x17'),'required':!![]},'props':{'title':_0x2452('0x16'),'helpText':''}},{'type':_0x2452('0x15'),'props':{'title':_0x2452('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0x2452('0x2'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x2452('0x18')](_0x2452('0x19'))?JSON[_0x2452('0x1a')](this[_0x2452('0x18')](_0x2452('0x19'))):{};},'set':function(_0x516fcf){return this['setDataValue'](_0x2452('0x19'),JSON[_0x2452('0x1b')](_0x516fcf));}},'offlineForm':{'type':Sequelize[_0x2452('0xb')],'defaultValue':function(){return JSON[_0x2452('0x1b')]({'items':[{'type':_0x2452('0x15'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x2452('0x2'),'type':_0x2452('0x2')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0x2452('0x1c'),'helpText':_0x2452('0x1d')}}],'fromKey':0x0});},'get':function(){return this[_0x2452('0x18')](_0x2452('0x1e'))?JSON[_0x2452('0x1a')](this[_0x2452('0x18')]('offlineForm')):{};},'set':function(_0x5da9aa){return this[_0x2452('0x1f')](_0x2452('0x1e'),JSON[_0x2452('0x1b')](_0x5da9aa));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x2452('0x20')]();}},'autoclose':{'type':Sequelize[_0x2452('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x2452('0x1')]},'forwardOffline':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x2452('0x1')]},'waitingTitle':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x21')},'waitingMessage':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x22')},'offlineMessageSubject':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x23')},'offlineMessageBody':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x24')},'enableUnmanagedNote':{'type':Sequelize[_0x2452('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x2452('0x25')},'skipUnmanaged':{'type':Sequelize[_0x2452('0x1')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x2452('0x1')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x2452('0x1')]},'notificationTemplate':{'type':Sequelize[_0x2452('0xb')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x2452('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x26')},'waitForTheAssignedAgent':{'type':Sequelize[_0x2452('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x27')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x2452('0x1')],'defaultValue':_0x2452('0x28')},'defaultTitle':{'type':Sequelize[_0x2452('0x1')]},'customerAvatar':{'type':Sequelize[_0x2452('0xb')]},'showCustomerAvatar':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x2452('0x1')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2452('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2452('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x2452('0x1')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x2452('0xb')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2452('0x14')],'comment':_0x2452('0x29')},'mandatoryDisposition':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![],'comment':_0x2452('0x2a'),'set':function(_0x112849){if(!_0x112849)this[_0x2452('0x1f')](_0x2452('0x2b'),null);this['setDataValue'](_0x2452('0x2c'),_0x112849);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x2452('0x1')]},'vidaooTopic':{'type':Sequelize[_0x2452('0x1')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x2452('0x1')],'defaultValue':function(){return _0x2452('0x2d');}},'vidaooMetadata':{'type':Sequelize[_0x2452('0xb')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x2452('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x2452('0xb')]}}; \ No newline at end of file +var _0x5ff3=['text','getDataValue','onlineForm','setDataValue','stringify','Comments','Leave\x20your\x20comments','offlineForm','parse','generate','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.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','squared','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','ENUM','star','thumb','input','name'];(function(_0x231295,_0x5f0700){var _0x15c39b=function(_0x542343){while(--_0x542343){_0x231295['push'](_0x231295['shift']());}};_0x15c39b(++_0x5f0700);}(_0x5ff3,0x17d));var _0x35ff=function(_0x2af468,_0x2ca86c){_0x2af468=_0x2af468-0x0;var _0x65bfd3=_0x5ff3[_0x2af468];return _0x65bfd3;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x35ff('0x0'));module['exports']={'name':{'type':Sequelize[_0x35ff('0x1')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x35ff('0x2')},'description':{'type':Sequelize[_0x35ff('0x1')]},'mapKey':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':_0x35ff('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x35ff('0x3')},'key':{'type':Sequelize[_0x35ff('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':_0x35ff('0x4')},'customerAlias':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x35ff('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x35ff('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x35ff('0x1')],'allowNull':![],'defaultValue':_0x35ff('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x35ff('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x35ff('0x1')]},'animation':{'type':Sequelize[_0x35ff('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0x35ff('0x8')),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':_0x35ff('0x9')},'offline_chat_button':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':_0x35ff('0xa')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x35ff('0xb')},'download_transcript':{'type':Sequelize[_0x35ff('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x35ff('0xc')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x35ff('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0x35ff('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x35ff('0xe')]},'closingQuestion':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':_0x35ff('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':_0x35ff('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':_0x35ff('0x11')},'noteTitle':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':_0x35ff('0x12')},'placeholderMessage':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':_0x35ff('0x13')},'closingMessage':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':_0x35ff('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x35ff('0xa')},'skipMessageButton':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':_0x35ff('0x15')},'conditionAgreement':{'type':Sequelize[_0x35ff('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x35ff('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x35ff('0x16')](_0x35ff('0x17'),_0x35ff('0x18')),'defaultValue':_0x35ff('0x17')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x35ff('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x35ff('0x19'),'variable':null,'config':{'placeholder':_0x35ff('0x1a'),'type':_0x35ff('0x1b'),'required':!![]},'props':{'title':_0x35ff('0x1a'),'helpText':''}},{'type':_0x35ff('0x19'),'props':{'title':_0x35ff('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x35ff('0x3'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x35ff('0x1c')](_0x35ff('0x1d'))?JSON['parse'](this[_0x35ff('0x1c')]('onlineForm')):{};},'set':function(_0x4c46b7){return this[_0x35ff('0x1e')](_0x35ff('0x1d'),JSON[_0x35ff('0x1f')](_0x4c46b7));}},'offlineForm':{'type':Sequelize[_0x35ff('0xe')],'defaultValue':function(){return JSON[_0x35ff('0x1f')]({'items':[{'type':'input','props':{'title':_0x35ff('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x35ff('0x3'),'type':_0x35ff('0x3')},'variable':null},{'type':'textarea','config':{'placeholder':_0x35ff('0x20')},'props':{'title':_0x35ff('0x20'),'helpText':_0x35ff('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x35ff('0x1c')](_0x35ff('0x22'))?JSON[_0x35ff('0x23')](this[_0x35ff('0x1c')](_0x35ff('0x22'))):{};},'set':function(_0x105e58){return this['setDataValue'](_0x35ff('0x22'),JSON['stringify'](_0x105e58));}},'token':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':function(){return rs[_0x35ff('0x24')]();}},'autoclose':{'type':Sequelize[_0x35ff('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x35ff('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x35ff('0x1')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x35ff('0x1')]},'waitingTitle':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x35ff('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':_0x35ff('0x26')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':_0x35ff('0x27')},'skipUnmanaged':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':_0x35ff('0x15')},'sendUnmanaged':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':_0x35ff('0xa')},'enableCustomerAttachment':{'type':Sequelize[_0x35ff('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x35ff('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x35ff('0xe')]},'showAgentAvatar':{'type':Sequelize[_0x35ff('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x35ff('0x1')]},'notificationTemplate':{'type':Sequelize[_0x35ff('0xe')],'defaultValue':function(){return _0x35ff('0x28');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x35ff('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':_0x35ff('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x35ff('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':_0x35ff('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':_0x35ff('0x2b')},'messagesAlignment':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':_0x35ff('0x2c')},'defaultTitle':{'type':Sequelize[_0x35ff('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x35ff('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x35ff('0xc')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x35ff('0x1')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x35ff('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x35ff('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x35ff('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':_0x35ff('0x2d')},'systemAvatar':{'type':Sequelize[_0x35ff('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x35ff('0xc')],'comment':_0x35ff('0x2e')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x550c09){if(!_0x550c09)this[_0x35ff('0x1e')](_0x35ff('0x2f'),null);this[_0x35ff('0x1e')](_0x35ff('0x30'),_0x550c09);}},'vidaooEscalation':{'type':Sequelize[_0x35ff('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x35ff('0x1')],'allowNull':![],'defaultValue':_0x35ff('0x31')},'vidaooNote':{'type':Sequelize[_0x35ff('0x1')],'defaultValue':function(){return _0x35ff('0x32');}},'vidaooMetadata':{'type':Sequelize[_0x35ff('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x35ff('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 0fc30c4..6ff59bd 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 _0xc9b2=['push','close','unmanaged','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','send','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','files','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','MailAccountId','toPairsIn','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','server','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','User','fullname','internal','Tags','color','tag','getSnippet','iftime\x20%s,%s','interval','timezone','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','Interval','getProactiveActions','../../config/license/util','virtual','License','chatLicenseExceeded','Intervals','all','some','URL','origin','3.1.0','remote','connection','remoteAddress','replace','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getFields','false','onlineForm','items','fromKey','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','url','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','then','info','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','update','destroy','get','ChatWebsites','stack','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','find','catch','body','user','role','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','order','ChatWebsiteId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','addAvatar','agentAvatar','addCustomerAvatar','filename','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','customerAvatar','getSystemAvatar','notify','user-agent','Sequelize','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','Applications','account','applications','list','orderBy','priority','asc','from','contact','customerIp','headers','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','autoclose'];(function(_0x21e294,_0x4f09ec){var _0x2b3d04=function(_0x40c1c4){while(--_0x40c1c4){_0x21e294['push'](_0x21e294['shift']());}};_0x2b3d04(++_0x4f09ec);}(_0xc9b2,0x1a1));var _0x2c9b=function(_0x515f04,_0x55c951){_0x515f04=_0x515f04-0x0;var _0xa11c90=_0xc9b2[_0x515f04];return _0xa11c90;};'use strict';var BPromise=require(_0x2c9b('0x0'));var Mustache=require(_0x2c9b('0x1'));var util=require(_0x2c9b('0x2'));var path=require(_0x2c9b('0x3'));var ejs=require(_0x2c9b('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c9b('0x5'));var querystring=require(_0x2c9b('0x6'));var Redis=require(_0x2c9b('0x7'));var qs=require(_0x2c9b('0x8'));var logger=require(_0x2c9b('0x9'))(_0x2c9b('0xa'));var config=require('../../config/environment');var url=require(_0x2c9b('0xb'));var db=require(_0x2c9b('0xc'))['db'];config[_0x2c9b('0xd')]=_[_0x2c9b('0xe')](config[_0x2c9b('0xd')],{'host':_0x2c9b('0xf'),'port':0x18eb});var socket=require(_0x2c9b('0x10'))(new Redis(config[_0x2c9b('0xd')]));require(_0x2c9b('0x11'))[_0x2c9b('0x12')](socket);var htmlToText=require(_0x2c9b('0x13'));var jayson=require(_0x2c9b('0x14'));var client=jayson[_0x2c9b('0x15')][_0x2c9b('0x16')]({'port':0x232c});var client9002=jayson['client'][_0x2c9b('0x16')]({'port':0x232a});var client9003=jayson[_0x2c9b('0x15')]['http']({'port':0x232b});var client9001=jayson[_0x2c9b('0x15')][_0x2c9b('0x16')]({'port':0x2329});function respondWithRpcPromise(_0x26c8d2,_0x33075e,_0x556dde,_0x270d3f){return new BPromise(function(_0xd9b4a7,_0x295e58){var _0x3b7410=_0x270d3f||client;return _0x3b7410['request'](_0x26c8d2,_0x556dde)[_0x2c9b('0x17')](function(_0x467026){logger[_0x2c9b('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x33075e,_0x2c9b('0x19'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x33075e,'request\x20sent',JSON[_0x2c9b('0x1a')](_0x467026));if(_0x467026['error']){if(_0x467026[_0x2c9b('0x1b')][_0x2c9b('0x1c')]===0x1f4){logger[_0x2c9b('0x1b')](_0x2c9b('0x1d'),_0x33075e,_0x467026['error'][_0x2c9b('0x1e')]);return _0x295e58(_0x467026[_0x2c9b('0x1b')][_0x2c9b('0x1e')]);}logger[_0x2c9b('0x1b')](_0x2c9b('0x1d'),_0x33075e,_0x467026[_0x2c9b('0x1b')][_0x2c9b('0x1e')]);return _0xd9b4a7(_0x467026[_0x2c9b('0x1b')][_0x2c9b('0x1e')]);}else{logger['info'](_0x2c9b('0x1d'),_0x33075e,_0x2c9b('0x19'));_0xd9b4a7(_0x467026[_0x2c9b('0x1f')][_0x2c9b('0x1e')]);}})['catch'](function(_0x1769d5){logger[_0x2c9b('0x1b')](_0x2c9b('0x1d'),_0x33075e,_0x1769d5);_0x295e58(_0x1769d5);});});}function respondWithStatusCode(_0x42cdbe,_0x27e310){_0x27e310=_0x27e310||0xcc;return function(_0x3f920c){if(_0x3f920c){return _0x42cdbe[_0x2c9b('0x20')](_0x27e310);}return _0x42cdbe['status'](_0x27e310)[_0x2c9b('0x21')]();};}function respondWithResult(_0x2bc187,_0x3cbb51){_0x3cbb51=_0x3cbb51||0xc8;return function(_0x30cfca){if(_0x30cfca){return _0x2bc187[_0x2c9b('0x22')](_0x3cbb51)['json'](_0x30cfca);}};}function respondWithFilteredResult(_0x4de579,_0x339f31){return function(_0x5509de){if(_0x5509de){var _0x1b45d4=typeof _0x339f31[_0x2c9b('0x23')]==='undefined'&&typeof _0x339f31[_0x2c9b('0x24')]===_0x2c9b('0x25');var _0x285919=_0x5509de[_0x2c9b('0x26')];var _0x1120cc=_0x1b45d4?0x0:_0x339f31[_0x2c9b('0x23')];var _0x2e9e07=_0x1b45d4?_0x5509de['count']:_0x339f31['offset']+_0x339f31[_0x2c9b('0x24')];var _0x2d3c9b;if(_0x2e9e07>=_0x285919){_0x2e9e07=_0x285919;_0x2d3c9b=0xc8;}else{_0x2d3c9b=0xce;}_0x4de579['status'](_0x2d3c9b);return _0x4de579[_0x2c9b('0x27')](_0x2c9b('0x28'),_0x1120cc+'-'+_0x2e9e07+'/'+_0x285919)[_0x2c9b('0x29')](_0x5509de);}return null;};}function saveUpdates(_0x2093b5){return function(_0x54a46d){if(_0x54a46d){return _0x54a46d[_0x2c9b('0x2a')](_0x2093b5)[_0x2c9b('0x17')](function(_0x13b597){return _0x13b597;});}return null;};}function removeEntity(_0x374155){return function(_0x15a1e3){if(_0x15a1e3){return _0x15a1e3[_0x2c9b('0x2b')]()[_0x2c9b('0x17')](function(){var _0xe1840f=_0x15a1e3[_0x2c9b('0x2c')]({'plain':!![]});var _0x2b8ad0=_0x2c9b('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x2b8ad0,'resourceId':_0xe1840f['id']}})['then'](function(){return _0x15a1e3;});})['then'](function(){_0x374155[_0x2c9b('0x22')](0xcc)[_0x2c9b('0x21')]();});}};}function handleEntityNotFound(_0x54025e){return function(_0x563d3f){if(!_0x563d3f){_0x54025e[_0x2c9b('0x20')](0x194);}return _0x563d3f;};}function handleError(_0x51514a,_0x335801){_0x335801=_0x335801||0x1f4;return function(_0x1d115a){logger[_0x2c9b('0x1b')](_0x1d115a[_0x2c9b('0x2e')]);if(_0x1d115a['name']){delete _0x1d115a[_0x2c9b('0x2f')];}_0x51514a[_0x2c9b('0x22')](_0x335801)['send'](_0x1d115a);};}exports[_0x2c9b('0x30')]=function(_0x4aba94,_0x183d72){var _0xc8fdb={'include':[{'model':db[_0x2c9b('0x31')],'as':_0x2c9b('0x32')}]},_0x36e548={},_0x457aa2={'count':0x0,'rows':[]};var _0x17b9ad=_[_0x2c9b('0x33')](db[_0x2c9b('0x34')][_0x2c9b('0x35')],function(_0xb3f4c8){return{'name':_0xb3f4c8['fieldName'],'type':_0xb3f4c8[_0x2c9b('0x36')]['key']};});_0x36e548[_0x2c9b('0x37')]=_['map'](_0x17b9ad,'name');_0x36e548['query']=_['keys'](_0x4aba94[_0x2c9b('0x38')]);_0x36e548[_0x2c9b('0x39')]=_[_0x2c9b('0x3a')](_0x36e548[_0x2c9b('0x37')],_0x36e548[_0x2c9b('0x38')]);_0xc8fdb[_0x2c9b('0x3b')]=_[_0x2c9b('0x3a')](_0x36e548[_0x2c9b('0x37')],qs['fields'](_0x4aba94[_0x2c9b('0x38')][_0x2c9b('0x3c')]));_0xc8fdb[_0x2c9b('0x3b')]=_0xc8fdb[_0x2c9b('0x3b')]['length']?_0xc8fdb[_0x2c9b('0x3b')]:_0x36e548['model'];if(!_0x4aba94[_0x2c9b('0x38')][_0x2c9b('0x3d')]('nolimit')){_0xc8fdb['limit']=qs[_0x2c9b('0x24')](_0x4aba94[_0x2c9b('0x38')][_0x2c9b('0x24')]);_0xc8fdb[_0x2c9b('0x23')]=qs[_0x2c9b('0x23')](_0x4aba94[_0x2c9b('0x38')][_0x2c9b('0x23')]);}_0xc8fdb['order']=qs[_0x2c9b('0x3e')](_0x4aba94[_0x2c9b('0x38')][_0x2c9b('0x3e')]);_0xc8fdb[_0x2c9b('0x3f')]=qs[_0x2c9b('0x39')](_[_0x2c9b('0x40')](_0x4aba94[_0x2c9b('0x38')],_0x36e548[_0x2c9b('0x39')]),_0x17b9ad);if(_0x4aba94['query'][_0x2c9b('0x41')]){_0xc8fdb[_0x2c9b('0x3f')]=_[_0x2c9b('0x42')](_0xc8fdb['where'],{'$or':_[_0x2c9b('0x33')](_0x17b9ad,function(_0x5b17a1){if(_0x5b17a1['type']!==_0x2c9b('0x43')){var _0x3e8981={};_0x3e8981[_0x5b17a1[_0x2c9b('0x2f')]]={'$like':'%'+_0x4aba94['query']['filter']+'%'};return _0x3e8981;}})});}_0xc8fdb=_['merge']({},_0xc8fdb,_0x4aba94[_0x2c9b('0x44')]);var _0x2e6278={'where':_0xc8fdb[_0x2c9b('0x3f')]};return db[_0x2c9b('0x34')][_0x2c9b('0x26')](_0x2e6278)[_0x2c9b('0x17')](function(_0x2a8c0f){_0x457aa2[_0x2c9b('0x26')]=_0x2a8c0f;if(_0x4aba94[_0x2c9b('0x38')][_0x2c9b('0x45')]){_0xc8fdb[_0x2c9b('0x46')]=[{'all':!![]}];}return db[_0x2c9b('0x34')][_0x2c9b('0x47')](_0xc8fdb);})[_0x2c9b('0x17')](function(_0x58f53f){_0x457aa2[_0x2c9b('0x48')]=_0x58f53f;return _0x457aa2;})[_0x2c9b('0x17')](respondWithFilteredResult(_0x183d72,_0xc8fdb))['catch'](handleError(_0x183d72,null));};exports[_0x2c9b('0x49')]=function(_0x59cb42,_0x50c5d7){var _0x1293e8={'raw':![],'where':{'id':_0x59cb42[_0x2c9b('0x4a')]['id']},'include':[{'model':db[_0x2c9b('0x31')],'as':_0x2c9b('0x32')}]},_0x52eb28={};_0x52eb28[_0x2c9b('0x37')]=_[_0x2c9b('0x4b')](db[_0x2c9b('0x34')]['rawAttributes']);_0x52eb28['query']=_[_0x2c9b('0x4b')](_0x59cb42['query']);_0x52eb28[_0x2c9b('0x39')]=_[_0x2c9b('0x3a')](_0x52eb28[_0x2c9b('0x37')],_0x52eb28[_0x2c9b('0x38')]);_0x1293e8[_0x2c9b('0x3b')]=_[_0x2c9b('0x3a')](_0x52eb28[_0x2c9b('0x37')],qs[_0x2c9b('0x3c')](_0x59cb42[_0x2c9b('0x38')][_0x2c9b('0x3c')]));_0x1293e8['attributes']=_0x1293e8[_0x2c9b('0x3b')][_0x2c9b('0x4c')]?_0x1293e8[_0x2c9b('0x3b')]:_0x52eb28[_0x2c9b('0x37')];if(_0x59cb42[_0x2c9b('0x38')][_0x2c9b('0x45')]){_0x1293e8[_0x2c9b('0x46')]=[{'all':!![]}];}_0x1293e8=_[_0x2c9b('0x42')]({},_0x1293e8,_0x59cb42['options']);return db['ChatWebsite'][_0x2c9b('0x4d')](_0x1293e8)[_0x2c9b('0x17')](handleEntityNotFound(_0x50c5d7,null))[_0x2c9b('0x17')](respondWithResult(_0x50c5d7,null))[_0x2c9b('0x4e')](handleError(_0x50c5d7,null));};exports['create']=function(_0x44affd,_0x5b8eb1){return db[_0x2c9b('0x34')]['create'](_0x44affd[_0x2c9b('0x4f')],{})['then'](function(_0x2cdd26){var _0x5c0a0e=_0x44affd[_0x2c9b('0x50')][_0x2c9b('0x2c')]({'plain':!![]});if(!_0x5c0a0e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c0a0e[_0x2c9b('0x51')]==='user'){var _0x1aca97=_0x2cdd26[_0x2c9b('0x2c')]({'plain':!![]});var _0x3be14e=_0x2c9b('0x2d');return db['UserProfileSection'][_0x2c9b('0x4d')]({'where':{'name':_0x3be14e,'userProfileId':_0x5c0a0e[_0x2c9b('0x52')]},'raw':!![]})[_0x2c9b('0x17')](function(_0x363afe){if(_0x363afe&&_0x363afe[_0x2c9b('0x53')]===0x0){return db[_0x2c9b('0x54')][_0x2c9b('0x55')]({'name':_0x1aca97[_0x2c9b('0x2f')],'resourceId':_0x1aca97['id'],'type':_0x363afe[_0x2c9b('0x2f')],'sectionId':_0x363afe['id']},{})[_0x2c9b('0x17')](function(){return _0x2cdd26;});}else{return _0x2cdd26;}})[_0x2c9b('0x4e')](function(_0xd2b191){logger['error'](_0x2c9b('0x56'),_0xd2b191);throw _0xd2b191;});}return _0x2cdd26;})[_0x2c9b('0x17')](respondWithResult(_0x5b8eb1,0xc9))[_0x2c9b('0x4e')](handleError(_0x5b8eb1,null));};exports[_0x2c9b('0x2a')]=function(_0x28f1b3,_0x30c961){if(_0x28f1b3[_0x2c9b('0x4f')]['id']){delete _0x28f1b3[_0x2c9b('0x4f')]['id'];}return db[_0x2c9b('0x34')][_0x2c9b('0x4d')]({'where':{'id':_0x28f1b3[_0x2c9b('0x4a')]['id']},'include':[{'model':db[_0x2c9b('0x31')],'as':_0x2c9b('0x32')}]})[_0x2c9b('0x17')](handleEntityNotFound(_0x30c961,null))['then'](saveUpdates(_0x28f1b3[_0x2c9b('0x4f')],null))[_0x2c9b('0x17')](respondWithResult(_0x30c961,null))[_0x2c9b('0x4e')](handleError(_0x30c961,null));};exports[_0x2c9b('0x2b')]=function(_0x4ec757,_0x582b1b){return db[_0x2c9b('0x34')][_0x2c9b('0x4d')]({'where':{'id':_0x4ec757[_0x2c9b('0x4a')]['id']}})[_0x2c9b('0x17')](handleEntityNotFound(_0x582b1b,null))[_0x2c9b('0x17')](removeEntity(_0x582b1b,null))[_0x2c9b('0x4e')](handleError(_0x582b1b,null));};exports[_0x2c9b('0x57')]=function(_0x44fc82,_0x31ce79){return db[_0x2c9b('0x34')][_0x2c9b('0x57')]()['then'](respondWithResult(_0x31ce79,null))['catch'](handleError(_0x31ce79,null));};exports[_0x2c9b('0x58')]=function(_0x3f3e7a,_0x27c8bd){if(_0x3f3e7a[_0x2c9b('0x4f')]['id']){delete _0x3f3e7a['body']['id'];}return db['ChatWebsite'][_0x2c9b('0x4d')]({'where':{'id':_0x3f3e7a[_0x2c9b('0x4a')]['id']}})[_0x2c9b('0x17')](handleEntityNotFound(_0x27c8bd,null))['then'](function(_0x545db0){if(_0x545db0){_0x3f3e7a[_0x2c9b('0x4f')]['ChatWebsiteId']=_0x545db0['id'];return db[_0x2c9b('0x59')][_0x2c9b('0x55')](_0x3f3e7a[_0x2c9b('0x4f')]);}})[_0x2c9b('0x17')](respondWithResult(_0x27c8bd,null))[_0x2c9b('0x4e')](handleError(_0x27c8bd,null));};exports[_0x2c9b('0x5a')]=function(_0x556cc6,_0x4389a3){var _0x2280c1={'raw':![],'where':{}};var _0x849266={};var _0x38eb74={'count':0x0,'rows':[]};return db[_0x2c9b('0x34')][_0x2c9b('0x5b')]({'where':{'id':_0x556cc6['params']['id']}})['then'](handleEntityNotFound(_0x4389a3,null))[_0x2c9b('0x17')](function(_0x10f9dc){if(_0x10f9dc){_0x849266[_0x2c9b('0x37')]=_[_0x2c9b('0x4b')](db[_0x2c9b('0x59')]['rawAttributes']);_0x849266[_0x2c9b('0x38')]=_['keys'](_0x556cc6['query']);_0x849266[_0x2c9b('0x39')]=_[_0x2c9b('0x3a')](_0x849266[_0x2c9b('0x37')],_0x849266['query']);_0x2280c1[_0x2c9b('0x3b')]=_[_0x2c9b('0x3a')](_0x849266[_0x2c9b('0x37')],qs[_0x2c9b('0x3c')](_0x556cc6[_0x2c9b('0x38')][_0x2c9b('0x3c')]));_0x2280c1[_0x2c9b('0x3b')]=_0x2280c1[_0x2c9b('0x3b')][_0x2c9b('0x4c')]?_0x2280c1[_0x2c9b('0x3b')]:_0x849266[_0x2c9b('0x37')];if(!_0x556cc6[_0x2c9b('0x38')][_0x2c9b('0x3d')](_0x2c9b('0x5c'))){_0x2280c1[_0x2c9b('0x24')]=qs[_0x2c9b('0x24')](_0x556cc6[_0x2c9b('0x38')][_0x2c9b('0x24')]);_0x2280c1[_0x2c9b('0x23')]=qs['offset'](_0x556cc6[_0x2c9b('0x38')][_0x2c9b('0x23')]);}_0x2280c1[_0x2c9b('0x5d')]=qs[_0x2c9b('0x3e')](_0x556cc6['query'][_0x2c9b('0x3e')]);_0x2280c1[_0x2c9b('0x3f')]=qs[_0x2c9b('0x39')](_[_0x2c9b('0x40')](_0x556cc6[_0x2c9b('0x38')],_0x849266[_0x2c9b('0x39')]));_0x2280c1[_0x2c9b('0x3f')][_0x2c9b('0x5e')]=_0x10f9dc['id'];if(_0x556cc6['query'][_0x2c9b('0x41')]){_0x2280c1[_0x2c9b('0x3f')]=_[_0x2c9b('0x42')](_0x2280c1[_0x2c9b('0x3f')],{'$or':_[_0x2c9b('0x33')](_0x2280c1[_0x2c9b('0x3b')],function(_0x5a0d54){var _0x5cbb80={};_0x5cbb80[_0x5a0d54]={'$like':'%'+_0x556cc6[_0x2c9b('0x38')]['filter']+'%'};return _0x5cbb80;})});}_0x2280c1=_[_0x2c9b('0x42')]({},_0x2280c1,_0x556cc6[_0x2c9b('0x44')]);return db['Disposition'][_0x2c9b('0x26')]({'where':_0x2280c1[_0x2c9b('0x3f')]})[_0x2c9b('0x17')](function(_0x5d7b4c){_0x38eb74['count']=_0x5d7b4c;if(_0x556cc6[_0x2c9b('0x38')]['includeAll']){_0x2280c1[_0x2c9b('0x46')]=[{'all':!![]}];}return db['Disposition'][_0x2c9b('0x47')](_0x2280c1);})['then'](function(_0x1e9183){_0x38eb74['rows']=_0x1e9183;return _0x38eb74;});}})[_0x2c9b('0x17')](respondWithFilteredResult(_0x4389a3,_0x2280c1))[_0x2c9b('0x4e')](handleError(_0x4389a3,null));};exports[_0x2c9b('0x5f')]=function(_0xafe615,_0x42d283){return db[_0x2c9b('0x34')][_0x2c9b('0x4d')]({'where':{'id':_0xafe615['params']['id']}})['then'](handleEntityNotFound(_0x42d283,null))[_0x2c9b('0x17')](function(_0x359b70){if(_0x359b70){return _0x359b70[_0x2c9b('0x5f')](_0xafe615['query'][_0x2c9b('0x60')]);}})[_0x2c9b('0x17')](respondWithStatusCode(_0x42d283,null))['catch'](handleError(_0x42d283,null));};exports[_0x2c9b('0x61')]=function(_0x3c6459,_0x18590b){if(_0x3c6459['body']['id']){delete _0x3c6459['body']['id'];}return db[_0x2c9b('0x34')]['find']({'where':{'id':_0x3c6459[_0x2c9b('0x4a')]['id']}})[_0x2c9b('0x17')](handleEntityNotFound(_0x18590b,null))[_0x2c9b('0x17')](function(_0x5c5c36){if(_0x5c5c36){_0x3c6459[_0x2c9b('0x4f')][_0x2c9b('0x5e')]=_0x5c5c36['id'];return db[_0x2c9b('0x62')][_0x2c9b('0x55')](_0x3c6459[_0x2c9b('0x4f')]);}})['then'](respondWithResult(_0x18590b,null))[_0x2c9b('0x4e')](handleError(_0x18590b,null));};exports[_0x2c9b('0x63')]=function(_0x214a6d,_0x5b1d4c){var _0x49be59={'raw':![],'where':{}};var _0x335a9c={};var _0x3c41a6={'count':0x0,'rows':[]};return db[_0x2c9b('0x34')][_0x2c9b('0x5b')]({'where':{'id':_0x214a6d[_0x2c9b('0x4a')]['id']}})[_0x2c9b('0x17')](handleEntityNotFound(_0x5b1d4c,null))[_0x2c9b('0x17')](function(_0x1677a1){if(_0x1677a1){_0x335a9c['model']=_[_0x2c9b('0x4b')](db[_0x2c9b('0x62')][_0x2c9b('0x35')]);_0x335a9c['query']=_[_0x2c9b('0x4b')](_0x214a6d['query']);_0x335a9c[_0x2c9b('0x39')]=_[_0x2c9b('0x3a')](_0x335a9c[_0x2c9b('0x37')],_0x335a9c[_0x2c9b('0x38')]);_0x49be59[_0x2c9b('0x3b')]=_[_0x2c9b('0x3a')](_0x335a9c['model'],qs[_0x2c9b('0x3c')](_0x214a6d['query'][_0x2c9b('0x3c')]));_0x49be59[_0x2c9b('0x3b')]=_0x49be59[_0x2c9b('0x3b')][_0x2c9b('0x4c')]?_0x49be59['attributes']:_0x335a9c['model'];if(!_0x214a6d[_0x2c9b('0x38')]['hasOwnProperty'](_0x2c9b('0x5c'))){_0x49be59['limit']=qs[_0x2c9b('0x24')](_0x214a6d[_0x2c9b('0x38')][_0x2c9b('0x24')]);_0x49be59['offset']=qs[_0x2c9b('0x23')](_0x214a6d[_0x2c9b('0x38')][_0x2c9b('0x23')]);}_0x49be59[_0x2c9b('0x5d')]=qs[_0x2c9b('0x3e')](_0x214a6d['query'][_0x2c9b('0x3e')]);_0x49be59[_0x2c9b('0x3f')]=qs[_0x2c9b('0x39')](_[_0x2c9b('0x40')](_0x214a6d[_0x2c9b('0x38')],_0x335a9c[_0x2c9b('0x39')]));_0x49be59['where'][_0x2c9b('0x5e')]=_0x1677a1['id'];if(_0x214a6d['query'][_0x2c9b('0x41')]){_0x49be59[_0x2c9b('0x3f')]=_[_0x2c9b('0x42')](_0x49be59[_0x2c9b('0x3f')],{'$or':_[_0x2c9b('0x33')](_0x49be59[_0x2c9b('0x3b')],function(_0x24a05f){var _0x288262={};_0x288262[_0x24a05f]={'$like':'%'+_0x214a6d[_0x2c9b('0x38')][_0x2c9b('0x41')]+'%'};return _0x288262;})});}_0x49be59=_['merge']({},_0x49be59,_0x214a6d[_0x2c9b('0x44')]);return db[_0x2c9b('0x62')][_0x2c9b('0x26')]({'where':_0x49be59[_0x2c9b('0x3f')]})[_0x2c9b('0x17')](function(_0x2f6441){_0x3c41a6['count']=_0x2f6441;if(_0x214a6d[_0x2c9b('0x38')][_0x2c9b('0x45')]){_0x49be59[_0x2c9b('0x46')]=[{'all':!![]}];}return db['CannedAnswer'][_0x2c9b('0x47')](_0x49be59);})['then'](function(_0x23378c){_0x3c41a6[_0x2c9b('0x48')]=_0x23378c;return _0x3c41a6;});}})[_0x2c9b('0x17')](respondWithFilteredResult(_0x5b1d4c,_0x49be59))[_0x2c9b('0x4e')](handleError(_0x5b1d4c,null));};exports[_0x2c9b('0x64')]=function(_0x2c0f7a,_0x2e9dd3){return db[_0x2c9b('0x34')][_0x2c9b('0x4d')]({'where':{'id':_0x2c0f7a[_0x2c9b('0x4a')]['id']}})[_0x2c9b('0x17')](handleEntityNotFound(_0x2e9dd3,null))[_0x2c9b('0x17')](function(_0x5d7877){if(_0x5d7877){return _0x5d7877[_0x2c9b('0x64')](_0x2c0f7a[_0x2c9b('0x38')][_0x2c9b('0x60')]);}})[_0x2c9b('0x17')](respondWithStatusCode(_0x2e9dd3,null))['catch'](handleError(_0x2e9dd3,null));};exports[_0x2c9b('0x65')]=function(_0x581168,_0x426ae7){_0x581168[_0x2c9b('0x4f')][_0x2c9b('0x66')]=_0x581168[_0x2c9b('0x67')]['filename'];return db[_0x2c9b('0x34')][_0x2c9b('0x4d')]({'where':{'id':_0x581168[_0x2c9b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x426ae7,null))[_0x2c9b('0x17')](saveUpdates(_0x581168[_0x2c9b('0x4f')],null))[_0x2c9b('0x17')](respondWithResult(_0x426ae7,null))[_0x2c9b('0x4e')](handleError(_0x426ae7,null));};exports[_0x2c9b('0x68')]=function(_0x156ffe,_0x347b19){_0x156ffe['body'][_0x2c9b('0x69')]=_0x156ffe['file']['filename'];return db['ChatWebsite'][_0x2c9b('0x4d')]({'where':{'id':_0x156ffe[_0x2c9b('0x4a')]['id']}})[_0x2c9b('0x17')](handleEntityNotFound(_0x347b19,null))['then'](saveUpdates(_0x156ffe['body'],null))[_0x2c9b('0x17')](respondWithResult(_0x347b19,null))['catch'](handleError(_0x347b19,null));};exports[_0x2c9b('0x6a')]=function(_0x57af0f,_0x5cc592){_0x57af0f['body']['customerAvatar']=_0x57af0f[_0x2c9b('0x67')][_0x2c9b('0x6b')];return db[_0x2c9b('0x34')]['find']({'where':{'id':_0x57af0f['params']['id']}})['then'](handleEntityNotFound(_0x5cc592,null))[_0x2c9b('0x17')](saveUpdates(_0x57af0f[_0x2c9b('0x4f')],null))[_0x2c9b('0x17')](respondWithResult(_0x5cc592,null))['catch'](handleError(_0x5cc592,null));};exports[_0x2c9b('0x6c')]=function(_0x221bb8,_0x1169b5){_0x221bb8['body'][_0x2c9b('0x6d')]=_0x221bb8[_0x2c9b('0x67')][_0x2c9b('0x6b')];return db[_0x2c9b('0x34')]['find']({'where':{'id':_0x221bb8[_0x2c9b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1169b5,null))[_0x2c9b('0x17')](saveUpdates(_0x221bb8[_0x2c9b('0x4f')],null))['then'](respondWithResult(_0x1169b5,null))[_0x2c9b('0x4e')](handleError(_0x1169b5,null));};exports['getLogo']=function(_0x5a9a21,_0x296268){var _0x184675=path[_0x2c9b('0x6e')](config[_0x2c9b('0x6f')],_0x2c9b('0x70'));var _0x516ff6={'where':{'id':_0x5a9a21[_0x2c9b('0x4a')]['id']},'attributes':['id',_0x2c9b('0x66')],'raw':!![]};var _0x145b39=![];return require('../../config/license/util')[_0x2c9b('0x71')]()[_0x2c9b('0x17')](function(_0x6bbda5){if(_0x6bbda5){_0x145b39=_0x6bbda5[_0x2c9b('0x72')];}})[_0x2c9b('0x17')](function(){return db[_0x2c9b('0x34')][_0x2c9b('0x4d')](_0x516ff6);})['then'](handleEntityNotFound(_0x296268,null))[_0x2c9b('0x17')](function(_0x1c1d57){if(_0x1c1d57){if(!_[_0x2c9b('0x73')](_0x1c1d57[_0x2c9b('0x66')])){if(fs[_0x2c9b('0x74')](path[_0x2c9b('0x6e')](config['root'],_0x2c9b('0x75'),_0x1c1d57[_0x2c9b('0x66')]))&&_0x145b39){_0x184675=path[_0x2c9b('0x6e')](config[_0x2c9b('0x6f')],_0x2c9b('0x75'),_0x1c1d57[_0x2c9b('0x66')]);}}return _0x296268[_0x2c9b('0x76')](_0x184675);}})[_0x2c9b('0x4e')](handleError(_0x296268,null));};exports[_0x2c9b('0x77')]=function(_0x152d5a,_0x23dafa){var _0x5c281d=path['join'](config['root'],_0x2c9b('0x78'));var _0x3f4257={'where':{'id':_0x152d5a[_0x2c9b('0x4a')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite'][_0x2c9b('0x4d')](_0x3f4257)['then'](handleEntityNotFound(_0x23dafa,null))['then'](function(_0x405d8c){if(_0x405d8c){if(!_[_0x2c9b('0x73')](_0x405d8c[_0x2c9b('0x69')])){if(fs[_0x2c9b('0x74')](path[_0x2c9b('0x6e')](config[_0x2c9b('0x6f')],_0x2c9b('0x79'),_0x405d8c[_0x2c9b('0x69')]))){_0x5c281d=path['join'](config[_0x2c9b('0x6f')],_0x2c9b('0x79'),_0x405d8c[_0x2c9b('0x69')]);}}return _0x23dafa['download'](_0x5c281d);}})[_0x2c9b('0x4e')](handleError(_0x23dafa,null));};exports[_0x2c9b('0x7a')]=function(_0x2ff42b,_0x2a7816){var _0x3fc706=path[_0x2c9b('0x6e')](config[_0x2c9b('0x6f')],'server/files/images/avatars/customer_avatar.png');var _0x8df921={'where':{'id':_0x2ff42b[_0x2c9b('0x4a')]['id']},'attributes':['id','customerAvatar',_0x2c9b('0x7b')],'raw':!![]};return db[_0x2c9b('0x34')][_0x2c9b('0x4d')](_0x8df921)[_0x2c9b('0x17')](handleEntityNotFound(_0x2a7816,null))[_0x2c9b('0x17')](function(_0x185bd9){if(_0x185bd9){if(!_[_0x2c9b('0x73')](_0x185bd9[_0x2c9b('0x7c')])){if(fs[_0x2c9b('0x74')](path[_0x2c9b('0x6e')](config[_0x2c9b('0x6f')],_0x2c9b('0x79'),_0x185bd9[_0x2c9b('0x7c')]))&&_0x185bd9[_0x2c9b('0x7b')]){_0x3fc706=path[_0x2c9b('0x6e')](config[_0x2c9b('0x6f')],_0x2c9b('0x79'),_0x185bd9[_0x2c9b('0x7c')]);}}return _0x2a7816[_0x2c9b('0x76')](_0x3fc706);}})[_0x2c9b('0x4e')](handleError(_0x2a7816,null));};exports[_0x2c9b('0x7d')]=function(_0x533331,_0x485db1){var _0xf6fd20=path[_0x2c9b('0x6e')](config[_0x2c9b('0x6f')],'server/files/images/avatars/system_avatar.png');var _0x126b89={'where':{'id':_0x533331[_0x2c9b('0x4a')]['id']},'attributes':['id',_0x2c9b('0x6d')],'raw':!![]};return db['ChatWebsite'][_0x2c9b('0x4d')](_0x126b89)['then'](handleEntityNotFound(_0x485db1,null))[_0x2c9b('0x17')](function(_0x4bc96b){if(_0x4bc96b){if(!_[_0x2c9b('0x73')](_0x4bc96b['systemAvatar'])){if(fs['existsSync'](path['join'](config[_0x2c9b('0x6f')],_0x2c9b('0x79'),_0x4bc96b[_0x2c9b('0x6d')]))){_0xf6fd20=path['join'](config['root'],_0x2c9b('0x79'),_0x4bc96b[_0x2c9b('0x6d')]);}}return _0x485db1['download'](_0xf6fd20);}})[_0x2c9b('0x4e')](handleError(_0x485db1,null));};exports[_0x2c9b('0x7e')]=function(_0x3b748b,_0x2af288){var _0x2d1cbd=require('user-agent-parser');var _0x4c84a8=new _0x2d1cbd();var _0x30ec93=_0x4c84a8['setUA'](_0x3b748b['headers'][_0x2c9b('0x7f')])['getResult']();var _0x559a46={'body':_0x3b748b[_0x2c9b('0x4f')],'channel':'chat'};var _0xf1874a=[];var _0x402df0=[];var _0x3310c4={};var _0x251091=![];return db['CmContact'][_0x2c9b('0x57')]()[_0x2c9b('0x17')](function(_0xd33217){if(!_0xd33217){throw new db[(_0x2c9b('0x80'))]['ValidationError'](_0x2c9b('0x81'));}_0xf1874a=_[_0x2c9b('0x82')](_[_0x2c9b('0x4b')](_0xd33217),['createdAt','updatedAt']);_0x402df0=_[_0x2c9b('0x82')](_[_0x2c9b('0x4b')](_0xd33217),['createdAt',_0x2c9b('0x83'),_0x2c9b('0x84'),_0x2c9b('0x85')]);if(_0x3b748b['body']['id']){delete _0x3b748b['body']['id'];}if(_['isNil'](_0x3b748b[_0x2c9b('0x4f')]['from'])){throw new db['Sequelize'][(_0x2c9b('0x86'))]('from\x20is\x20mandatory');}if(_[_0x2c9b('0x73')](_0x3b748b[_0x2c9b('0x4f')][_0x2c9b('0x4f')])||_0x3b748b[_0x2c9b('0x4f')]['body']===''){throw new db[(_0x2c9b('0x80'))]['ValidationError'](_0x2c9b('0x87'));}if(_['isNil'](_0x3b748b['body'][_0x2c9b('0x88')])){throw new db[(_0x2c9b('0x80'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x402df0);}if(!_[_0x2c9b('0x89')](_0x402df0,_0x3b748b[_0x2c9b('0x4f')][_0x2c9b('0x88')])){throw new db[(_0x2c9b('0x80'))][(_0x2c9b('0x86'))](_0x2c9b('0x8a')+_0x402df0);}_0x3310c4[_0x3b748b[_0x2c9b('0x4f')][_0x2c9b('0x88')]]=_0x3b748b[_0x2c9b('0x4f')]['from'];})[_0x2c9b('0x17')](function(){return db[_0x2c9b('0x34')][_0x2c9b('0x4d')]({'where':{'id':_0x3b748b[_0x2c9b('0x4a')]['id']},'include':[{'model':db[_0x2c9b('0x8b')],'as':_0x2c9b('0x8c'),'include':[{'model':db[_0x2c9b('0x8d')],'as':_0x2c9b('0x8e'),'where':_0x3310c4,'limit':0x1,'order':[[_0x2c9b('0x83'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0x2c9b('0x8f')}]});})[_0x2c9b('0x17')](handleEntityNotFound(_0x2af288,null))['then'](function(_0x469021){if(_0x469021&&_0x469021[_0x2c9b('0x8c')]){_0x559a46[_0x2c9b('0x90')]=_0x469021;_0x559a46[_0x2c9b('0x91')]=_0x469021[_0x2c9b('0x8f')];_0x559a46[_0x2c9b('0x92')]=_0x469021[_0x2c9b('0x8c')];_0x559a46[_0x2c9b('0x91')]=_[_0x2c9b('0x93')](_0x559a46[_0x2c9b('0x91')],[_0x2c9b('0x94')],[_0x2c9b('0x95')]);if(_0x559a46[_0x2c9b('0x90')][_0x2c9b('0x8f')]){delete _0x559a46[_0x2c9b('0x90')][_0x2c9b('0x8f')];}if(_0x559a46['account'][_0x2c9b('0x8c')]&&_0x559a46[_0x2c9b('0x90')][_0x2c9b('0x8c')][_0x2c9b('0x8e')]['length']){return _0x559a46[_0x2c9b('0x90')]['List'][_0x2c9b('0x8e')][0x0];}var _0x17a3ac=_[_0x2c9b('0xe')](_0x3b748b['body'],{'firstName':_0x3b748b[_0x2c9b('0x4f')]['from'],'ListId':_0x469021[_0x2c9b('0x85')]});_0x17a3ac[_0x3b748b[_0x2c9b('0x4f')][_0x2c9b('0x88')]]=_0x3b748b[_0x2c9b('0x4f')][_0x2c9b('0x96')];return db[_0x2c9b('0x8d')][_0x2c9b('0x55')](_0x17a3ac,{'fields':_0xf1874a,'raw':!![]});}})['then'](handleEntityNotFound(_0x2af288,null))[_0x2c9b('0x17')](function(_0x3b0f56){_0x559a46[_0x2c9b('0x97')]=_0x3b0f56;var _0x2eb587=_0x3b748b[_0x2c9b('0x4f')][_0x2c9b('0x98')];if(_0x3b748b[_0x2c9b('0x99')]['cf-connecting-ip']){_0x2eb587=_0x3b748b['headers']['cf-connecting-ip'];}else if(_0x3b748b[_0x2c9b('0x99')][_0x2c9b('0x9a')]){_0x2eb587=_[_0x2c9b('0x9b')](_0x3b748b[_0x2c9b('0x99')][_0x2c9b('0x9a')][_0x2c9b('0x9c')](','));}if(_0x3b0f56){var _0x437333={'ContactId':_0x3b0f56['id'],'ChatWebsiteId':_0x3b748b[_0x2c9b('0x4a')]['id'],'from':(_0x3b0f56[_0x2c9b('0x9d')]||'')+'\x20'+(_0x3b0f56[_0x2c9b('0x9e')]||''),'customerIp':_0x2eb587,'customerPort':_0x3b748b[_0x2c9b('0x99')][_0x2c9b('0x9f')]?_0x3b748b['headers'][_0x2c9b('0x9f')]:null,'referer':_0x3b748b[_0x2c9b('0x4f')][_0x2c9b('0xa0')],'browserName':_0x30ec93[_0x2c9b('0xa1')]['name']&&_0x30ec93['browser'][_0x2c9b('0xa2')]?util[_0x2c9b('0xa3')]('%s\x20%s',_0x30ec93[_0x2c9b('0xa1')][_0x2c9b('0x2f')],_0x30ec93[_0x2c9b('0xa1')]['version']):'unknown','browserVersion':_0x30ec93['browser'][_0x2c9b('0xa2')]||_0x2c9b('0xa4'),'osName':util[_0x2c9b('0xa3')](_0x2c9b('0xa5'),_0x30ec93['os'][_0x2c9b('0x2f')],_0x30ec93['os'][_0x2c9b('0xa2')]),'osVersion':_0x30ec93['os']['version'],'deviceModel':_0x30ec93[_0x2c9b('0xa6')]['model']&&_0x30ec93[_0x2c9b('0xa6')][_0x2c9b('0xa7')]?util['format']('%s\x20%s\x20%s',_0x30ec93[_0x2c9b('0xa6')][_0x2c9b('0x37')],_0x30ec93[_0x2c9b('0xa6')][_0x2c9b('0xa7')],_0x30ec93[_0x2c9b('0xa6')]['type']):null,'deviceVendor':_0x30ec93['device'][_0x2c9b('0xa7')],'deviceType':_0x30ec93[_0x2c9b('0xa6')][_0x2c9b('0x36')],'formData':JSON[_0x2c9b('0x1a')](_0x3b748b[_0x2c9b('0x4f')])};var _0x2b0f8f={'ChatWebsiteId':_0x3b748b[_0x2c9b('0x4a')]['id'],'closed':![]};if(_0x3b748b[_0x2c9b('0x4f')]['threadId']){_0x2b0f8f['threadId']=_0x3b748b[_0x2c9b('0x4f')][_0x2c9b('0xa8')];return db[_0x2c9b('0xa9')]['find']({'where':_0x2b0f8f})[_0x2c9b('0x17')](function(_0x105424){if(_0x105424){return[_0x105424,![]];}_0x437333['threadId']=_0x3b748b[_0x2c9b('0x4f')]['threadId'];_0x437333[_0x2c9b('0xaa')]=_0x3b748b[_0x2c9b('0x4f')][_0x2c9b('0xaa')];return db[_0x2c9b('0xa9')][_0x2c9b('0x55')](_0x437333)[_0x2c9b('0x17')](function(_0x120442){return[_0x120442,!![]];});});}_0x2b0f8f[_0x2c9b('0xab')]=_0x3b0f56['id'];if(_0x3b748b[_0x2c9b('0x4f')][_0x2c9b('0xac')]&&_0x3b748b[_0x2c9b('0x4f')][_0x2c9b('0xac')]['id']){_0x2b0f8f['id']=_0x3b748b['body']['interaction']['id'];return db[_0x2c9b('0xa9')][_0x2c9b('0x4d')]({'where':_0x2b0f8f})[_0x2c9b('0x17')](function(_0x302dc2){if(_0x302dc2){return[_0x302dc2,![]];}return db[_0x2c9b('0xa9')][_0x2c9b('0x55')](_0x437333)[_0x2c9b('0x17')](function(_0x4ad540){return[_0x4ad540,!![]];});});}return db[_0x2c9b('0xa9')][_0x2c9b('0x55')](_0x437333)['then'](function(_0x223e74){return[_0x223e74,!![]];});}})['spread'](function(_0x57998a,_0x4ac647){if(_0x57998a){_0x251091=_0x4ac647;if(!_0x4ac647){var _0x52e336={'from':(_0x559a46['contact']['firstName']||'')+'\x20'+(_0x559a46['contact'][_0x2c9b('0x9e')]||'')};if(_0x3b748b[_0x2c9b('0x4f')][_0x2c9b('0xa8')]&&_0x3b748b[_0x2c9b('0x4f')][_0x2c9b('0xad')]&&_0x3b748b[_0x2c9b('0x4f')][_0x2c9b('0xa8')]!=_0x3b748b[_0x2c9b('0x4f')]['messageId']){_0x52e336[_0x2c9b('0xa8')]=_0x3b748b[_0x2c9b('0x4f')][_0x2c9b('0xad')];}return _0x57998a[_0x2c9b('0x2a')](_0x52e336);}else{return _0x57998a;}}})[_0x2c9b('0x17')](function(_0x43c00e){_0x559a46['interaction']=_0x43c00e[_0x2c9b('0x2c')]({'plain':!![]});_0x559a46[_0x2c9b('0xac')]['created']=_0x251091;if(_0x559a46[_0x2c9b('0xac')]['created']){if(_0x559a46[_0x2c9b('0x90')][_0x2c9b('0xae')]){_0x559a46['applications'][_0x2c9b('0xaf')]({'id':0x0,'priority':_0x559a46[_0x2c9b('0x91')][_0x2c9b('0x4c')]+0x1,'app':_0x2c9b('0xb0'),'appdata':_0x2c9b('0xb1'),'interval':'*,*,*,*'});}}return db[_0x2c9b('0xb2')][_0x2c9b('0x55')]({'body':_0x3b748b[_0x2c9b('0x4f')]['body'],'ChatWebsiteId':_0x3b748b['params']['id'],'ChatInteractionId':_0x43c00e['id'],'direction':'in','ContactId':_0x559a46[_0x2c9b('0x97')]['id'],'AttachmentId':_0x3b748b[_0x2c9b('0x4f')][_0x2c9b('0xb3')]});})[_0x2c9b('0x17')](function(_0x219d50){_0x559a46[_0x2c9b('0x1e')]=_0x219d50;if(_0x559a46[_0x2c9b('0xac')][_0x2c9b('0xb4')]){return db['User'][_0x2c9b('0x4d')]({'attributes':['id',_0x2c9b('0x2f')],'where':{'id':_0x559a46[_0x2c9b('0xac')][_0x2c9b('0xb4')]}})[_0x2c9b('0x17')](function(_0x29750e){if(_0x29750e){_0x559a46[_0x2c9b('0x91')][_0x2c9b('0xb5')]({'id':0x0,'priority':0x0,'app':_0x2c9b('0xb6'),'appdata':_0x29750e[_0x2c9b('0x2f')]+','+(_0x559a46[_0x2c9b('0x90')][_0x2c9b('0xb7')]||0xa),'interval':_0x2c9b('0xb8')});_0x559a46[_0x2c9b('0xb9')]=!![];}return respondWithRpcPromise(_0x2c9b('0xba'),'startRouting',_0x559a46);});}return respondWithRpcPromise(_0x2c9b('0xba'),_0x2c9b('0xbb'),_0x559a46);})[_0x2c9b('0x17')](function(_0xc9f3de){respondWithRpcPromise(_0x2c9b('0xbc'),_0x2c9b('0xbc'),{'event':'notify','message':_0xc9f3de},client9002);return _0xc9f3de;})[_0x2c9b('0x17')](respondWithResult(_0x2af288,null))['catch'](handleError(_0x2af288,null));};exports[_0x2c9b('0xbd')]=function(_0x145fb1,_0x3c23cd){var _0x3a33c7,_0x4f1eba,_0x4952a3;var _0x47c4b8=[];var _0x26bdee={};var _0x478040=_0x145fb1['files']||[];var _0x5910ca=[];var _0x48d42f;return db['CmContact'][_0x2c9b('0x57')]()[_0x2c9b('0x17')](function(_0x535868){if(!_0x535868){throw new db[(_0x2c9b('0x80'))][(_0x2c9b('0x86'))](_0x2c9b('0x81'));}_0x47c4b8=_[_0x2c9b('0x82')](_[_0x2c9b('0x4b')](_0x535868),['createdAt','updatedAt','CompanyId',_0x2c9b('0x85')]);if(_0x145fb1['body']['id']){delete _0x145fb1[_0x2c9b('0x4f')]['id'];}if(_[_0x2c9b('0x73')](_0x145fb1['body'][_0x2c9b('0x96')])){throw _0x3c23cd['status'](0x1f4)[_0x2c9b('0xbe')](new db[(_0x2c9b('0x80'))]['ValidationError']('from\x20is\x20mandatory'));}if(_['isNil'](_0x145fb1['body'][_0x2c9b('0x4f')])||_0x145fb1[_0x2c9b('0x4f')][_0x2c9b('0x4f')]===''){throw _0x3c23cd['status'](0x1f4)['send'](new db[(_0x2c9b('0x80'))][(_0x2c9b('0x86'))](_0x2c9b('0x87')));}if(_[_0x2c9b('0x73')](_0x145fb1[_0x2c9b('0x4f')][_0x2c9b('0xbf')])){throw _0x3c23cd[_0x2c9b('0x22')](0x1f4)['send'](new db[(_0x2c9b('0x80'))][(_0x2c9b('0x86'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x47c4b8));}if(!_['includes'](_0x47c4b8,_0x145fb1['body'][_0x2c9b('0xbf')])){throw _0x3c23cd['status'](0x1f4)[_0x2c9b('0xbe')](new db[(_0x2c9b('0x80'))]['ValidationError'](_0x2c9b('0xc0')+_0x47c4b8));}_0x26bdee[_0x145fb1['body'][_0x2c9b('0xbf')]]=_0x145fb1['body'][_0x2c9b('0x96')];})['then'](function(){return db[_0x2c9b('0x34')][_0x2c9b('0x4d')]({'where':{'id':_0x145fb1[_0x2c9b('0x4a')]['id']},'include':[{'model':db['CmList'],'as':_0x2c9b('0x8c')},{'model':db['MailAccount'],'as':_0x2c9b('0xc1')}]});})[_0x2c9b('0x17')](handleEntityNotFound(_0x3c23cd,null))['then'](function(_0x4a2d6c){if(_0x4a2d6c&&_0x4a2d6c[_0x2c9b('0x8c')]){_0x4f1eba=_0x4a2d6c;var _0x278b56=_[_0x2c9b('0xe')](_0x145fb1[_0x2c9b('0x4f')],{'firstName':_0x145fb1[_0x2c9b('0x4f')]['from'],'phone':_0x145fb1[_0x2c9b('0x4f')]['from'],'ListId':_0x4a2d6c['ListId']});_0x278b56[_0x145fb1[_0x2c9b('0x4f')][_0x2c9b('0xbf')]]=_0x145fb1[_0x2c9b('0x4f')]['from'];return db[_0x2c9b('0x8d')][_0x2c9b('0xc2')]({'where':_0x26bdee,'defaults':_0x278b56});}})[_0x2c9b('0xc3')](function(_0x465d57){if(_0x465d57){_0x4952a3=_0x465d57;var _0x312b79=fs[_0x2c9b('0xc4')](path[_0x2c9b('0x6e')](config[_0x2c9b('0x6f')],'server/files/templates/chatOfflineMessage.ejs'),_0x2c9b('0xc5'));var _0x4d23aa=ejs[_0x2c9b('0xc6')](_0x312b79,{'body':_[_0x2c9b('0xc7')](_0x145fb1[_0x2c9b('0x4f')][_0x2c9b('0x4f')]),'bodyTitle':_0x4f1eba[_0x2c9b('0xc8')]});return db[_0x2c9b('0xc9')]['create']({'body':_0x4d23aa,'plainBody':htmlToText[_0x2c9b('0xca')](_0x4d23aa),'ContactId':_0x465d57['id'],'ChatWebsiteId':_0x4f1eba['id']});}})['then'](function(_0x309d39){_0x48d42f=_0x309d39;if(_0x478040[_0x2c9b('0x4c')]){var _0x581ff8=_0x478040[_0x2c9b('0x33')](function(_0x392faa){return{'name':_0x392faa[_0x2c9b('0xcb')],'basename':_0x392faa[_0x2c9b('0x6b')],'type':_0x392faa[_0x2c9b('0xcc')],'ChatOfflineMessageId':_0x309d39['id']};});_0x5910ca=_0x581ff8[_0x2c9b('0x33')](_0xdae8c4=>{var _0x32c529={'filename':_0xdae8c4['name'],'path':path[_0x2c9b('0x6e')](config['root'],'server',_0x2c9b('0xcd'),_0x2c9b('0xce'),_0x2c9b('0xcf'),_0xdae8c4[_0x2c9b('0xd0')])};return _0x32c529;});if(!_0x4f1eba[_0x2c9b('0xd1')]){return db[_0x2c9b('0xd2')][_0x2c9b('0xd3')](function(_0x4a6d83){return db[_0x2c9b('0xd4')][_0x2c9b('0xd5')](_0x581ff8,{'transaction':_0x4a6d83});});}}})['then'](function(){if(_0x48d42f){_0x3a33c7=_0x48d42f;return db[_0x2c9b('0xc1')][_0x2c9b('0x5b')]({'where':{'service':!![]},'include':[{'model':db[_0x2c9b('0xd6')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x2c9b('0xd7')],'as':_0x2c9b('0xd7'),'raw':!![]}]}]});}})[_0x2c9b('0x17')](function(_0x53c498){if(_0x53c498&&_0x53c498['Smtp']&&_0x4f1eba['forwardOffline']&&_0x4f1eba['forwardOfflineAddress']){var _0x2df3aa=_0x53c498['getSmtpOptions']();return respondWithRpcPromise(_0x2c9b('0xd8'),_0x2c9b('0xd9'),{'account':_0x2df3aa,'message':{'from':util[_0x2c9b('0xa3')](_0x2c9b('0xda'),_0x53c498[_0x2c9b('0x2f')],_0x53c498[_0x2c9b('0xdb')]||_0x53c498['Smtp']['user']),'to':_0x4f1eba[_0x2c9b('0xdc')],'subject':_0x4f1eba['offlineMessageSubject'],'html':_0x3a33c7[_0x2c9b('0x4f')],'attachments':_0x5910ca}},client9003)[_0x2c9b('0x17')](function(){return _0x3a33c7;})[_0x2c9b('0x4e')](function(_0x98a9e9){logger[_0x2c9b('0x1b')](_0x98a9e9);});}})[_0x2c9b('0x17')](function(){if(_0x4f1eba&&_0x4f1eba[_0x2c9b('0xd1')]&&_0x4f1eba[_0x2c9b('0xdd')]){var _0xd631ca=[];if(_0x478040[_0x2c9b('0x4c')]){_0xd631ca=_0x478040['map'](function(_0x49291e){return{'name':_0x49291e[_0x2c9b('0xcb')],'basename':_0x49291e['filename'],'type':_0x49291e['mimetype'],'ChatOfflineMessageId':_0x48d42f['id']};});}var _0x5e3d45;if(!_[_0x2c9b('0x73')](_0x4f1eba['subjectOffline'])){var _0x5b2f17=_[_0x2c9b('0x33')](_0x145fb1['body'],function(_0xafd9ca){return _0xafd9ca;});var _0x432bae=_[_0x2c9b('0xde')](_0x5b2f17)[0x0];var _0x59a414=_['mapValues'](_0x432bae,function(_0x25c5b4){return _0x25c5b4;});_0x5e3d45=_0x59a414[0x1][_0x4f1eba['subjectOffline']];}var _0x5c0b15={'from':_0x4952a3[_0x2c9b('0xdb')],'firstName':_0x4952a3['firstName'],'lastName':_0x4952a3[_0x2c9b('0x9e')],'mapKey':'email','message':{'from':_0x4952a3[_0x2c9b('0xdb')],'to':_0x4f1eba[_0x2c9b('0xc1')][_0x2c9b('0xdb')],'cc':'','subject':_[_0x2c9b('0x73')](_0x5e3d45)?_0x4f1eba[_0x2c9b('0xdf')]:_0x5e3d45,'messageId':'','sentAt':new Date(),'attach':_0xd631ca[_0x2c9b('0x4c')],'attachments':_0xd631ca,'originChannel':_0x2c9b('0xe0'),'ChatWebsiteId':_0x4f1eba['id'],'ChatOfflineMessageId':_0x3a33c7['id'],'originTo':_0x4f1eba[_0x2c9b('0xc1')][_0x2c9b('0xdb')]},'body':_0x3a33c7['body']};var _0x350542={'account':{'id':_0x4f1eba[_0x2c9b('0xdd')]},'body':_0x5c0b15,'log':_0x2c9b('0xe1')};return respondWithRpcPromise(_0x2c9b('0xe1'),_0x2c9b('0xe2'),_0x350542,client9001)[_0x2c9b('0x17')](function(){return _0x3a33c7;})[_0x2c9b('0x4e')](function(_0x152cc4){logger['error'](_0x152cc4);});}return;})[_0x2c9b('0x17')](function(){if(_0x3a33c7){return _0x3a33c7;}})['then'](respondWithResult(_0x3c23cd,null))[_0x2c9b('0x4e')](function(_0x217952){logger['error'](_0x2c9b('0x4e'),_0x217952);for(var _0x15ce32 of _0x478040){var _0x41214d=path['join'](config[_0x2c9b('0x6f')],_0x2c9b('0xe3'),_0x2c9b('0xcd'),_0x2c9b('0xce'),_0x2c9b('0xcf'),_0x15ce32[_0x2c9b('0x6b')]);fs_extra[_0x2c9b('0xe4')](_0x41214d)[_0x2c9b('0x4e')](function(_0x3994fa){logger[_0x2c9b('0x1b')](_0x2c9b('0xe5'),_0x41214d,_0x3994fa);});}});};exports[_0x2c9b('0xe6')]=function(_0x5e2132,_0x54b635){return db['ChatInteraction'][_0x2c9b('0x4d')]({'where':{'id':_0x5e2132[_0x2c9b('0x4a')]['id']}})[_0x2c9b('0x17')](handleEntityNotFound(_0x54b635,null))[_0x2c9b('0x17')](function(_0x3a5f0d){if(_0x3a5f0d){return _0x3a5f0d[_0x2c9b('0xe6')](_0x5e2132[_0x2c9b('0x4f')][_0x2c9b('0x60')],_['omit'](_0x5e2132[_0x2c9b('0x4f')],[_0x2c9b('0x60'),'id'])||{});}})[_0x2c9b('0x17')](respondWithResult(_0x54b635,null))[_0x2c9b('0x4e')](handleError(_0x54b635,null));};exports[_0x2c9b('0xe7')]=function(_0x44fe13,_0x1f2359){var _0x162a51={'raw':![],'where':{}};var _0x3b60d1={};var _0x553a20={'count':0x0,'rows':[]};return db[_0x2c9b('0x34')]['findOne']({'where':{'id':_0x44fe13['params']['id']}})[_0x2c9b('0x17')](handleEntityNotFound(_0x1f2359,null))['then'](function(_0x31abf6){if(_0x31abf6){_0x3b60d1[_0x2c9b('0x37')]=_[_0x2c9b('0x4b')](db[_0x2c9b('0xa9')][_0x2c9b('0x35')]);_0x3b60d1[_0x2c9b('0x38')]=_[_0x2c9b('0x4b')](_0x44fe13[_0x2c9b('0x38')]);_0x3b60d1['filters']=_[_0x2c9b('0x3a')](_0x3b60d1[_0x2c9b('0x37')],_0x3b60d1[_0x2c9b('0x38')]);_0x162a51[_0x2c9b('0x3b')]=_[_0x2c9b('0x3a')](_0x3b60d1['model'],qs[_0x2c9b('0x3c')](_0x44fe13[_0x2c9b('0x38')][_0x2c9b('0x3c')]));_0x162a51[_0x2c9b('0x3b')]=_0x162a51[_0x2c9b('0x3b')][_0x2c9b('0x4c')]?_0x162a51[_0x2c9b('0x3b')]:_0x3b60d1[_0x2c9b('0x37')];if(!_0x44fe13[_0x2c9b('0x38')][_0x2c9b('0x3d')](_0x2c9b('0x5c'))){_0x162a51['limit']=qs[_0x2c9b('0x24')](_0x44fe13[_0x2c9b('0x38')][_0x2c9b('0x24')]);_0x162a51['offset']=qs[_0x2c9b('0x23')](_0x44fe13['query'][_0x2c9b('0x23')]);}_0x162a51['order']=qs[_0x2c9b('0x3e')](_0x44fe13[_0x2c9b('0x38')]['sort']);_0x162a51[_0x2c9b('0x3f')]=qs[_0x2c9b('0x39')](_[_0x2c9b('0x40')](_0x44fe13[_0x2c9b('0x38')],_0x3b60d1[_0x2c9b('0x39')]));_0x162a51[_0x2c9b('0x3f')][_0x2c9b('0x5e')]=_0x31abf6['id'];if(_0x44fe13[_0x2c9b('0x38')]['filter']){_0x162a51[_0x2c9b('0x3f')]=_[_0x2c9b('0x42')](_0x162a51[_0x2c9b('0x3f')],{'$or':_[_0x2c9b('0x33')](_0x162a51['attributes'],function(_0x283e4b){var _0x5222d7={};_0x5222d7[_0x283e4b]={'$like':'%'+_0x44fe13[_0x2c9b('0x38')]['filter']+'%'};return _0x5222d7;})});}_0x162a51=_['merge']({},_0x162a51,_0x44fe13['options']);return db[_0x2c9b('0xa9')][_0x2c9b('0x26')]({'where':_0x162a51[_0x2c9b('0x3f')]})[_0x2c9b('0x17')](function(_0x309a48){_0x553a20[_0x2c9b('0x26')]=_0x309a48;if(_0x44fe13['query'][_0x2c9b('0x45')]){_0x162a51[_0x2c9b('0x46')]=[{'model':db[_0x2c9b('0x8d')],'as':'Contact','required':![]},{'model':db[_0x2c9b('0xe8')],'as':'Owner','attributes':[_0x2c9b('0x2f'),_0x2c9b('0xe9'),_0x2c9b('0xea')],'required':![]},{'model':db['Tag'],'as':_0x2c9b('0xeb'),'attributes':['id',_0x2c9b('0x2f'),_0x2c9b('0xec')],'where':_0x44fe13[_0x2c9b('0x38')][_0x2c9b('0xed')]?{'id':_0x44fe13[_0x2c9b('0x38')]['tag']}:undefined,'required':_0x44fe13[_0x2c9b('0x38')][_0x2c9b('0xed')]?!![]:![]}];}return db[_0x2c9b('0xa9')][_0x2c9b('0x47')](_0x162a51);})[_0x2c9b('0x17')](function(_0x3099bb){_0x553a20['rows']=_0x3099bb;return _0x553a20;});}})[_0x2c9b('0x17')](respondWithFilteredResult(_0x1f2359,_0x162a51))[_0x2c9b('0x4e')](handleError(_0x1f2359,null));};function iftimePromise(_0x4005b7,_0x5bd684){return respondWithRpcPromise('Command',_0x2c9b('0xee'),{'command':_0x5bd684['timezone']?util['format'](_0x2c9b('0xef'),_0x4005b7[_0x2c9b('0xf0')],_0x5bd684[_0x2c9b('0xf1')]):util[_0x2c9b('0xa3')](_0x2c9b('0xf2'),_0x4005b7[_0x2c9b('0xf0')])},client9002)[_0x2c9b('0x17')](function(_0x54f59e){var _0x1cf137=_0x54f59e&&_0x54f59e[_0x2c9b('0xf3')]('true')>=0x0?!![]:![];logger[_0x2c9b('0x18')](_0x2c9b('0xf4'),_0x5bd684['id'],_0x4005b7['id'],_0x4005b7[_0x2c9b('0xf0')],_0x1cf137?_0x2c9b('0xf5'):_0x2c9b('0xf6'),_0x5bd684[_0x2c9b('0xf1')]?_0x5bd684['timezone']:'No\x20timezone');return _0x1cf137;})[_0x2c9b('0x4e')](function(_0x36636c){logger['error'](_0x2c9b('0xf4'),_0x5bd684['id'],_0x4005b7['id'],_0x4005b7['interval'],util[_0x2c9b('0xf7')](_0x36636c,{'showHidden':![],'depth':null}),_0x5bd684['timezone']?_0x5bd684[_0x2c9b('0xf1')]:_0x2c9b('0xf8'));return![];});}exports[_0x2c9b('0xee')]=function(_0x1fd339,_0x260309){var _0x37fd55=0x0;var _0x44d19d=0x0;var _0x3cf149=![];var _0x3b5f7d;var _0x4227f2;return db['ChatWebsite'][_0x2c9b('0x4d')]({'where':{'id':_0x1fd339[_0x2c9b('0x4a')]['id']},'include':[{'model':db[_0x2c9b('0xf9')],'as':_0x2c9b('0xf9'),'include':[{'model':db[_0x2c9b('0xf9')],'as':'Intervals','attributes':['id',_0x2c9b('0xf0')],'raw':!![]}]}]})[_0x2c9b('0x17')](handleEntityNotFound(_0x260309,null))[_0x2c9b('0x17')](function(_0xe1b9ba){if(_0xe1b9ba){_0x3b5f7d=_0xe1b9ba;return _0xe1b9ba[_0x2c9b('0xfa')]({'raw':!![]});}})[_0x2c9b('0x17')](function(_0x3e2792){if(_0x3b5f7d){if(_0x3e2792){_0x4227f2=_0x3e2792;}}return require(_0x2c9b('0xfb'))[_0x2c9b('0x71')]();})[_0x2c9b('0x17')](function(_0x3e2330){if(_0x3e2330){_0x44d19d=_0x3e2330[_0x2c9b('0xfc')];_0x3cf149=_0x3e2330[_0x2c9b('0x72')];}})['then'](function(){return db[_0x2c9b('0xa9')][_0x2c9b('0x26')]({'where':{'closed':![]}});})[_0x2c9b('0x17')](function(_0x3ddf3b){_0x37fd55=_0x3ddf3b;if(_0x44d19d&&_0x3ddf3b>_0x44d19d){return db[_0x2c9b('0xfd')][_0x2c9b('0x5b')]({'where':{'id':0x1}})[_0x2c9b('0x17')](function(_0x1e1f6a){if(_0x1e1f6a){_0x1e1f6a['increment'](_0x2c9b('0xfe'));}});}})[_0x2c9b('0x17')](function(){if(_0x3b5f7d['Interval']&&_0x3b5f7d['Interval']['Intervals']){var _0x31c7ae=[];for(var _0x1468af=0x0;_0x1468af<_0x3b5f7d[_0x2c9b('0xf9')][_0x2c9b('0xff')][_0x2c9b('0x4c')];_0x1468af++){var _0x41c92e=_0x3b5f7d['Interval'][_0x2c9b('0xff')][_0x1468af]['get']({'plain':!![]});_0x31c7ae[_0x2c9b('0xaf')](iftimePromise(_0x41c92e,_0x3b5f7d));}return BPromise[_0x2c9b('0x100')](_0x31c7ae)[_0x2c9b('0x17')](function(_0x212363){return _[_0x2c9b('0x101')](_0x212363);});}else{return!![];}})[_0x2c9b('0x17')](function(_0x3f4530){var _0x2828ca=fs['readFileSync'](path[_0x2c9b('0x6e')](config['root'],'server/files/chat/iframe.ejs'),_0x2c9b('0xc5'));var _0x59a212=new url[(_0x2c9b('0x102'))](_0x3b5f7d['address'])[_0x2c9b('0x103')];var _0x50e3ba=_0x2c9b('0x104');var _0x28aaf5=![];var _0x3b4298={'chatVersion':_0x50e3ba,'chatWebsiteAddressOrigin':_0x59a212,'remote':_0x3b5f7d[_0x2c9b('0x105')],'query':querystring['stringify'](_['merge'](_0x3b5f7d['get']({'plain':!![]}),{'customerIp':_0x1fd339[_0x2c9b('0x99')]['x-forwarded-for']||_0x1fd339['headers']['x-real-ip']||_0x1fd339[_0x2c9b('0x106')][_0x2c9b('0x107')]||_0x1fd339['ip'],'referer':_0x1fd339[_0x2c9b('0x99')][_0x2c9b('0xa0')],'openedInteractions':_0x37fd55,'maxInteractions':_0x44d19d,'virtual':_0x3cf149['virtual'],'online':_0x3f4530,'custom':_0x3cf149}))[_0x2c9b('0x108')](/'/g,'\x5c\x27')};_0x260309[_0x2c9b('0xbe')](ejs[_0x2c9b('0xc6')](Mustache[_0x2c9b('0xc6')](_0x2828ca,_0x3b4298),{'proactiveActions':_0x4227f2,'alignment':_0x3b5f7d['alignment'],'verticalAlignment':_0x3b5f7d[_0x2c9b('0x109')],'div_color':_0x3b5f7d[_0x2c9b('0xec')],'labelText':_0x3b5f7d[_0x2c9b('0x10a')],'text_color':_0x3b5f7d[_0x2c9b('0x10b')],'text_button_color':_0x3b5f7d[_0x2c9b('0x10c')],'button_color':_0x3b5f7d[_0x2c9b('0x10d')],'background_color':_0x3b5f7d[_0x2c9b('0x10e')],'hideWhenOffline':_0x3b5f7d[_0x2c9b('0x10f')],'intervalId':_0x3b5f7d[_0x2c9b('0x110')],'isDevelopment':_0x28aaf5,'chatVersion':_0x50e3ba}));})[_0x2c9b('0x4e')](handleError(_0x260309,null));};exports['addApplications']=function(_0x5905a3,_0x2c8a23){var _0x34ba6d=_0x5905a3[_0x2c9b('0x4a')]['id'];var _0x390993=_0x5905a3[_0x2c9b('0x4f')];var _0x23c65a=0xc8;var _0x33fdd3=null;return db[_0x2c9b('0xd2')][_0x2c9b('0xd3')]({'isolationLevel':db[_0x2c9b('0xd2')]['Transaction'][_0x2c9b('0x111')][_0x2c9b('0x112')]},function(_0x53b6ad){return db[_0x2c9b('0x34')][_0x2c9b('0x5b')]({'where':{'id':_0x34ba6d},'transaction':_0x53b6ad})[_0x2c9b('0x17')](function(_0x169726){if(_0x169726){return db['ChatApplication'][_0x2c9b('0x2b')]({'where':{'ChatWebsiteId':_0x34ba6d},'transaction':_0x53b6ad})[_0x2c9b('0x17')](function(){var _0x48cf02=_[_0x2c9b('0x33')](_0x390993,function(_0x213295){_0x213295['ChatWebsiteId']=_0x34ba6d;return _0x213295;});return db[_0x2c9b('0x113')][_0x2c9b('0xd5')](_0x48cf02,{'transaction':_0x53b6ad});});}else{_0x23c65a=0x194;_0x33fdd3=[];}});})[_0x2c9b('0x17')](function(){if(_0x23c65a!==0x194){return db['ChatApplication'][_0x2c9b('0x114')]({'where':{'ChatWebsiteId':_0x34ba6d},'order':_0x2c9b('0x94')})[_0x2c9b('0x17')](function(_0xa0d914){_0x33fdd3=_0xa0d914;});}})[_0x2c9b('0x4e')](function(_0x457af1){_0x23c65a=0x1f4;logger['error'](_0x457af1[_0x2c9b('0x2e')]);if(_0x457af1[_0x2c9b('0x2f')]){delete _0x457af1[_0x2c9b('0x2f')];}_0x33fdd3=_0x457af1;})[_0x2c9b('0x115')](function(){if(_0x33fdd3===null){_0x2c8a23['sendStatus'](_0x23c65a);}else{if(_0x23c65a===0x1f4){_0x2c8a23[_0x2c9b('0x22')](_0x23c65a)['send'](_0x33fdd3);}else{_0x2c8a23[_0x2c9b('0x22')](_0x23c65a)[_0x2c9b('0x29')](_0x33fdd3);}}});};exports[_0x2c9b('0x116')]=function(_0x2d3a27,_0xaaab74){var _0x4fcac9={};var _0xd11988={};var _0x28bf6f;var _0xffa1f1;return db[_0x2c9b('0x34')][_0x2c9b('0x5b')]({'where':{'id':_0x2d3a27[_0x2c9b('0x4a')]['id']}})[_0x2c9b('0x17')](handleEntityNotFound(_0xaaab74,null))[_0x2c9b('0x17')](function(_0x4c9463){if(_0x4c9463){_0x28bf6f=_0x4c9463;_0xd11988[_0x2c9b('0x37')]=_[_0x2c9b('0x4b')](db['ChatApplication'][_0x2c9b('0x35')]);_0xd11988[_0x2c9b('0x38')]=_[_0x2c9b('0x4b')](_0x2d3a27['query']);_0xd11988['filters']=_['intersection'](_0xd11988['model'],_0xd11988[_0x2c9b('0x38')]);_0x4fcac9[_0x2c9b('0x3b')]=_[_0x2c9b('0x3a')](_0xd11988[_0x2c9b('0x37')],qs[_0x2c9b('0x3c')](_0x2d3a27[_0x2c9b('0x38')][_0x2c9b('0x3c')]));_0x4fcac9[_0x2c9b('0x3b')]=_0x4fcac9[_0x2c9b('0x3b')][_0x2c9b('0x4c')]?_0x4fcac9[_0x2c9b('0x3b')]:_0xd11988['model'];_0x4fcac9[_0x2c9b('0x5d')]=qs[_0x2c9b('0x3e')](_0x2d3a27[_0x2c9b('0x38')][_0x2c9b('0x3e')]);_0x4fcac9[_0x2c9b('0x3f')]=qs[_0x2c9b('0x39')](_[_0x2c9b('0x40')](_0x2d3a27[_0x2c9b('0x38')],_0xd11988[_0x2c9b('0x39')]));if(_0x2d3a27[_0x2c9b('0x38')][_0x2c9b('0x41')]){_0x4fcac9[_0x2c9b('0x3f')]=_[_0x2c9b('0x42')](_0x4fcac9['where'],{'$or':_[_0x2c9b('0x33')](_0x4fcac9[_0x2c9b('0x3b')],function(_0x181a7c){var _0x791888={};_0x791888[_0x181a7c]={'$like':'%'+_0x2d3a27['query'][_0x2c9b('0x41')]+'%'};return _0x791888;})});}_0x4fcac9=_[_0x2c9b('0x42')]({},_0x4fcac9,_0x2d3a27['options']);return _0x28bf6f[_0x2c9b('0x116')](_0x4fcac9);}})['then'](function(_0x4b2ab5){if(_0x4b2ab5){_0xffa1f1=_0x4b2ab5[_0x2c9b('0x4c')];if(!_0x2d3a27['query'][_0x2c9b('0x3d')]('nolimit')){_0x4fcac9[_0x2c9b('0x24')]=qs[_0x2c9b('0x24')](_0x2d3a27[_0x2c9b('0x38')][_0x2c9b('0x24')]);_0x4fcac9['offset']=qs['offset'](_0x2d3a27[_0x2c9b('0x38')][_0x2c9b('0x23')]);}return _0x28bf6f[_0x2c9b('0x116')](_0x4fcac9);}})[_0x2c9b('0x17')](function(_0x24a575){if(_0x24a575){return _0x24a575?{'count':_0xffa1f1,'rows':_0x24a575}:null;}})[_0x2c9b('0x17')](respondWithResult(_0xaaab74,null))[_0x2c9b('0x4e')](handleError(_0xaaab74,null));};exports[_0x2c9b('0x117')]=function(_0x423c29,_0x4621fc){return db[_0x2c9b('0x118')][_0x2c9b('0x4d')]({'where':{'id':_0x423c29[_0x2c9b('0x4a')]['id']}})[_0x2c9b('0x17')](handleEntityNotFound(_0x4621fc,null))[_0x2c9b('0x17')](function(_0x107b55){if(_0x107b55){return _0x107b55['addProactiveActions'](_0x423c29[_0x2c9b('0x4f')][_0x2c9b('0x60')],_[_0x2c9b('0x119')](_0x423c29[_0x2c9b('0x4f')],[_0x2c9b('0x60'),'id'])||{});}})[_0x2c9b('0x17')](respondWithResult(_0x4621fc,null))[_0x2c9b('0x4e')](handleError(_0x4621fc,null));};exports[_0x2c9b('0xfa')]=function(_0x5f43c2,_0x44cd3b){var _0x276673={};var _0x219213={};var _0x25080b;var _0x3b2dee;return db['ChatWebsite'][_0x2c9b('0x5b')]({'where':{'id':_0x5f43c2[_0x2c9b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x44cd3b,null))['then'](function(_0x1e2a2b){if(_0x1e2a2b){_0x25080b=_0x1e2a2b;_0x219213[_0x2c9b('0x37')]=_[_0x2c9b('0x4b')](db[_0x2c9b('0x11a')]['rawAttributes']);_0x219213[_0x2c9b('0x38')]=_[_0x2c9b('0x4b')](_0x5f43c2[_0x2c9b('0x38')]);_0x219213['filters']=_['intersection'](_0x219213[_0x2c9b('0x37')],_0x219213[_0x2c9b('0x38')]);_0x276673[_0x2c9b('0x3b')]=_[_0x2c9b('0x3a')](_0x219213[_0x2c9b('0x37')],qs['fields'](_0x5f43c2[_0x2c9b('0x38')]['fields']));_0x276673[_0x2c9b('0x3b')]=_0x276673['attributes']['length']?_0x276673['attributes']:_0x219213[_0x2c9b('0x37')];_0x276673[_0x2c9b('0x5d')]=qs['sort'](_0x5f43c2[_0x2c9b('0x38')][_0x2c9b('0x3e')]);_0x276673[_0x2c9b('0x3f')]=qs[_0x2c9b('0x39')](_['pick'](_0x5f43c2['query'],_0x219213[_0x2c9b('0x39')]));if(_0x5f43c2[_0x2c9b('0x38')]['filter']){_0x276673[_0x2c9b('0x3f')]=_[_0x2c9b('0x42')](_0x276673[_0x2c9b('0x3f')],{'$or':_[_0x2c9b('0x33')](_0x276673[_0x2c9b('0x3b')],function(_0x25de98){var _0x4256f8={};_0x4256f8[_0x25de98]={'$like':'%'+_0x5f43c2[_0x2c9b('0x38')]['filter']+'%'};return _0x4256f8;})});}_0x276673=_['merge']({},_0x276673,_0x5f43c2[_0x2c9b('0x44')]);return _0x25080b[_0x2c9b('0xfa')](_0x276673);}})['then'](function(_0x259490){if(_0x259490){_0x3b2dee=_0x259490[_0x2c9b('0x4c')];if(!_0x5f43c2['query'][_0x2c9b('0x3d')](_0x2c9b('0x5c'))){_0x276673[_0x2c9b('0x24')]=qs[_0x2c9b('0x24')](_0x5f43c2[_0x2c9b('0x38')][_0x2c9b('0x24')]);_0x276673[_0x2c9b('0x23')]=qs[_0x2c9b('0x23')](_0x5f43c2[_0x2c9b('0x38')][_0x2c9b('0x23')]);}return _0x25080b[_0x2c9b('0xfa')](_0x276673);}})[_0x2c9b('0x17')](function(_0x58e71a){if(_0x58e71a){return _0x58e71a?{'count':_0x3b2dee,'rows':_0x58e71a}:null;}})['then'](respondWithResult(_0x44cd3b,null))[_0x2c9b('0x4e')](handleError(_0x44cd3b,null));};exports[_0x2c9b('0x11b')]=function(_0x2f6353,_0x5ec0be){var _0x246273=_0x2f6353[_0x2c9b('0x38')]['online']===_0x2c9b('0x11c')?'offlineForm':_0x2c9b('0x11d');return db['ChatWebsite'][_0x2c9b('0x4d')]({'attributes':['id',_0x246273],'where':{'id':_0x2f6353[_0x2c9b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5ec0be,null))[_0x2c9b('0x17')](function(_0x36efb0){if(_0x36efb0){var _0x1813dd=_0x36efb0[_0x246273];var _0x4c07e9=_0x1813dd&&_0x1813dd[_0x2c9b('0x11e')]?_0x1813dd[_0x2c9b('0x11e')]:[];_0x5ec0be[_0x2c9b('0xbe')]({'fromKey':_['isNil'](_0x1813dd['fromKey'])?undefined:_0x1813dd[_0x2c9b('0x11f')],'count':_0x4c07e9[_0x2c9b('0x4c')],'rows':_0x4c07e9});}})[_0x2c9b('0x4e')](handleError(_0x5ec0be,null));};exports['getOfflineMessages']=function(_0x2784f0,_0x555f33){var _0x80ad5c={'raw':![],'where':{}};var _0x5a5dca={};var _0x83fa5={'count':0x0,'rows':[]};return db[_0x2c9b('0x34')]['findOne']({'where':{'id':_0x2784f0[_0x2c9b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x555f33,null))[_0x2c9b('0x17')](function(_0x172610){if(_0x172610){_0x5a5dca[_0x2c9b('0x37')]=_['keys'](db[_0x2c9b('0xc9')]['rawAttributes']);_0x5a5dca[_0x2c9b('0x38')]=_['keys'](_0x2784f0[_0x2c9b('0x38')]);_0x5a5dca[_0x2c9b('0x39')]=_[_0x2c9b('0x3a')](_0x5a5dca['model'],_0x5a5dca[_0x2c9b('0x38')]);_0x80ad5c[_0x2c9b('0x3b')]=_['intersection'](_0x5a5dca[_0x2c9b('0x37')],qs[_0x2c9b('0x3c')](_0x2784f0['query'][_0x2c9b('0x3c')]));_0x80ad5c[_0x2c9b('0x3b')]=_0x80ad5c[_0x2c9b('0x3b')][_0x2c9b('0x4c')]?_0x80ad5c[_0x2c9b('0x3b')]:_0x5a5dca['model'];if(!_0x2784f0['query'][_0x2c9b('0x3d')]('nolimit')){_0x80ad5c[_0x2c9b('0x24')]=qs[_0x2c9b('0x24')](_0x2784f0['query'][_0x2c9b('0x24')]);_0x80ad5c[_0x2c9b('0x23')]=qs[_0x2c9b('0x23')](_0x2784f0[_0x2c9b('0x38')][_0x2c9b('0x23')]);}_0x80ad5c[_0x2c9b('0x5d')]=qs[_0x2c9b('0x3e')](_0x2784f0[_0x2c9b('0x38')][_0x2c9b('0x3e')]);_0x80ad5c[_0x2c9b('0x3f')]=qs[_0x2c9b('0x39')](_[_0x2c9b('0x40')](_0x2784f0['query'],_0x5a5dca[_0x2c9b('0x39')]));_0x80ad5c[_0x2c9b('0x3f')][_0x2c9b('0x5e')]=_0x172610['id'];if(_0x2784f0[_0x2c9b('0x38')]['filter']){_0x80ad5c[_0x2c9b('0x3f')]=_[_0x2c9b('0x42')](_0x80ad5c[_0x2c9b('0x3f')],{'$or':_['map'](_0x80ad5c[_0x2c9b('0x3b')],function(_0x2127a6){var _0x275eca={};_0x275eca[_0x2127a6]={'$like':'%'+_0x2784f0[_0x2c9b('0x38')][_0x2c9b('0x41')]+'%'};return _0x275eca;})});}_0x80ad5c=_[_0x2c9b('0x42')]({},_0x80ad5c,_0x2784f0[_0x2c9b('0x44')]);return db['ChatOfflineMessage']['count']({'where':_0x80ad5c[_0x2c9b('0x3f')]})['then'](function(_0x562cbc){_0x83fa5['count']=_0x562cbc;if(_0x2784f0[_0x2c9b('0x38')][_0x2c9b('0x45')]){_0x80ad5c[_0x2c9b('0x46')]=[{'all':!![]}];}else{_0x80ad5c[_0x2c9b('0x46')]=[{'model':db[_0x2c9b('0x8d')],'as':'Contact','required':![]},{'model':db['Attachment'],'as':_0x2c9b('0x120'),'required':![]}];}return db['ChatOfflineMessage'][_0x2c9b('0x47')](_0x80ad5c);})[_0x2c9b('0x17')](function(_0x4fb3e4){_0x83fa5[_0x2c9b('0x48')]=_0x4fb3e4;return _0x83fa5;});}})['then'](respondWithFilteredResult(_0x555f33,_0x80ad5c))['catch'](handleError(_0x555f33,null));};exports[_0x2c9b('0x121')]=function(_0x24bfce,_0x2c3dff){return db[_0x2c9b('0x34')][_0x2c9b('0x4d')]({'where':{'id':_0x24bfce[_0x2c9b('0x4a')]['id']}})[_0x2c9b('0x17')](handleEntityNotFound(_0x2c3dff,null))[_0x2c9b('0x17')](function(_0x295568){if(_0x295568){return _0x295568[_0x2c9b('0x121')](_0x24bfce[_0x2c9b('0x4f')][_0x2c9b('0x60')],_['omit'](_0x24bfce[_0x2c9b('0x4f')],[_0x2c9b('0x60'),'id'])||{})[_0x2c9b('0xc3')](function(_0x452adf){for(var _0x299724=0x0;_0x299724<_0x24bfce[_0x2c9b('0x4f')]['ids']['length'];_0x299724+=0x1){socket[_0x2c9b('0x122')](_0x2c9b('0x123'),{'UserId':Number(_0x24bfce['body'][_0x2c9b('0x60')][_0x299724]),'ChatWebsiteId':Number(_0x24bfce[_0x2c9b('0x4a')]['id'])});}return _0x452adf;});}})['then'](respondWithResult(_0x2c3dff,null))['catch'](handleError(_0x2c3dff,null));};exports['removeAgents']=function(_0x5a42e5,_0x37a9a4){return db[_0x2c9b('0x34')]['find']({'where':{'id':_0x5a42e5[_0x2c9b('0x4a')]['id']}})[_0x2c9b('0x17')](handleEntityNotFound(_0x37a9a4,null))['then'](function(_0x5a5b81){if(_0x5a5b81){return _0x5a5b81[_0x2c9b('0x124')](_0x5a42e5[_0x2c9b('0x38')][_0x2c9b('0x60')])[_0x2c9b('0x17')](function(){if(_[_0x2c9b('0x125')](_0x5a42e5[_0x2c9b('0x38')][_0x2c9b('0x60')])){for(var _0x37d854=0x0;_0x37d854<_0x5a42e5[_0x2c9b('0x38')][_0x2c9b('0x60')][_0x2c9b('0x4c')];_0x37d854+=0x1){socket[_0x2c9b('0x122')](_0x2c9b('0x126'),{'UserId':Number(_0x5a42e5[_0x2c9b('0x38')][_0x2c9b('0x60')][_0x37d854]),'ChatWebsiteId':Number(_0x5a42e5[_0x2c9b('0x4a')]['id'])});}}else{socket[_0x2c9b('0x122')](_0x2c9b('0x126'),{'UserId':Number(_0x5a42e5[_0x2c9b('0x38')][_0x2c9b('0x60')]),'ChatWebsiteId':Number(_0x5a42e5['params']['id'])});}});}})[_0x2c9b('0x17')](respondWithStatusCode(_0x37a9a4,null))[_0x2c9b('0x4e')](handleError(_0x37a9a4,null));};exports[_0x2c9b('0x127')]=function(_0x56c06f,_0x48a232){var _0x57e27e={};var _0x227f18={};var _0x36b8c3;var _0xdf811c;return db[_0x2c9b('0x34')]['findOne']({'where':{'id':_0x56c06f[_0x2c9b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x48a232,null))[_0x2c9b('0x17')](function(_0x580ac4){if(_0x580ac4){_0x36b8c3=_0x580ac4;_0x227f18['model']=_['keys'](db[_0x2c9b('0xe8')][_0x2c9b('0x35')]);_0x227f18['query']=_[_0x2c9b('0x4b')](_0x56c06f[_0x2c9b('0x38')]);_0x227f18[_0x2c9b('0x39')]=_[_0x2c9b('0x3a')](_0x227f18[_0x2c9b('0x37')],_0x227f18[_0x2c9b('0x38')]);_0x57e27e['attributes']=_[_0x2c9b('0x3a')](_0x227f18[_0x2c9b('0x37')],qs[_0x2c9b('0x3c')](_0x56c06f[_0x2c9b('0x38')]['fields']));_0x57e27e[_0x2c9b('0x3b')]=_0x57e27e['attributes'][_0x2c9b('0x4c')]?_0x57e27e[_0x2c9b('0x3b')]:_0x227f18[_0x2c9b('0x37')];_0x57e27e[_0x2c9b('0x5d')]=qs[_0x2c9b('0x3e')](_0x56c06f[_0x2c9b('0x38')][_0x2c9b('0x3e')]);_0x57e27e[_0x2c9b('0x3f')]=qs[_0x2c9b('0x39')](_[_0x2c9b('0x40')](_0x56c06f[_0x2c9b('0x38')],_0x227f18[_0x2c9b('0x39')]));if(_0x56c06f['query'][_0x2c9b('0x41')]){_0x57e27e[_0x2c9b('0x3f')]=_['merge'](_0x57e27e[_0x2c9b('0x3f')],{'$or':_['map'](_0x57e27e[_0x2c9b('0x3b')],function(_0x48fa20){var _0x2fcb9d={};_0x2fcb9d[_0x48fa20]={'$like':'%'+_0x56c06f[_0x2c9b('0x38')][_0x2c9b('0x41')]+'%'};return _0x2fcb9d;})});}_0x57e27e=_[_0x2c9b('0x42')]({},_0x57e27e,_0x56c06f[_0x2c9b('0x44')]);return _0x36b8c3['getAgents'](_0x57e27e);}})[_0x2c9b('0x17')](function(_0x376dde){if(_0x376dde){_0xdf811c=_0x376dde[_0x2c9b('0x4c')];if(!_0x56c06f[_0x2c9b('0x38')][_0x2c9b('0x3d')](_0x2c9b('0x5c'))){_0x57e27e['limit']=qs['limit'](_0x56c06f[_0x2c9b('0x38')][_0x2c9b('0x24')]);_0x57e27e['offset']=qs['offset'](_0x56c06f[_0x2c9b('0x38')][_0x2c9b('0x23')]);}return _0x36b8c3[_0x2c9b('0x127')](_0x57e27e);}})[_0x2c9b('0x17')](function(_0xb411cf){if(_0xb411cf){return _0xb411cf?{'count':_0xdf811c,'rows':_0xb411cf}:null;}})[_0x2c9b('0x17')](respondWithResult(_0x48a232,null))[_0x2c9b('0x4e')](handleError(_0x48a232,null));}; \ No newline at end of file +var _0xb10b=['updatedAt','difference','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','ChatApplication','applications','Applications','list','orderBy','priority','asc','account','Contacts','contact','customerIp','headers','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','browser','version','unknown','%s\x20%s','device','format','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','interaction','spread','messageId','created','autoclose','push','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','files','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','fromString','server','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','CloudProvider','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','email','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','ids','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','Command','iftime\x20%s,%s','timezone','iftime\x20%s','indexOf','true','interval','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','getSnippet','Interval','getProactiveActions','virtual','increment','chatLicenseExceeded','Intervals','some','server/files/chat/iframe.ejs','URL','address','origin','3.1.0','remote','x-real-ip','connection','replace','alignment','verticalAlignment','labelText','textColor','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','ChatOfflineMessage','addAgents','omit','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','bluebird','mustache','path','ejs','lodash','querystring','../../components/parsers/qs','api','../../config/environment','url','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','html-to-text','jayson/promise','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','limit','undefined','offset','count','set','update','destroy','get','ChatWebsites','UserProfileResource','sendStatus','stack','name','index','Pause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','catch','show','params','mandatoryDispositionPause','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','findOne','rows','removeDispositions','addAnswer','getAnswers','CannedAnswer','findAll','removeAnswers','addLogo','sitepic','filename','agentAvatar','file','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','user-agent','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt'];(function(_0xbdc98e,_0xd527b4){var _0x5cc9df=function(_0x3790f3){while(--_0x3790f3){_0xbdc98e['push'](_0xbdc98e['shift']());}};_0x5cc9df(++_0xd527b4);}(_0xb10b,0x1e3));var _0xbb10=function(_0xf351f3,_0x4a90f4){_0xf351f3=_0xf351f3-0x0;var _0x21d574=_0xb10b[_0xf351f3];return _0x21d574;};'use strict';var BPromise=require(_0xbb10('0x0'));var Mustache=require(_0xbb10('0x1'));var util=require('util');var path=require(_0xbb10('0x2'));var ejs=require(_0xbb10('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb10('0x4'));var querystring=require(_0xbb10('0x5'));var Redis=require('ioredis');var qs=require(_0xbb10('0x6'));var logger=require('../../config/logger')(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var url=require(_0xbb10('0x9'));var db=require(_0xbb10('0xa'))['db'];config[_0xbb10('0xb')]=_[_0xbb10('0xc')](config[_0xbb10('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config['redis']));require(_0xbb10('0xe'))['register'](socket);var htmlToText=require(_0xbb10('0xf'));var jayson=require(_0xbb10('0x10'));var client=jayson['client'][_0xbb10('0x11')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson['client'][_0xbb10('0x11')]({'port':0x232b});var client9001=jayson['client']['http']({'port':0x2329});function respondWithRpcPromise(_0x25956a,_0x525c78,_0x16bb04,_0x345e61){return new BPromise(function(_0x3fd70b,_0x332831){var _0x3c990b=_0x345e61||client;return _0x3c990b[_0xbb10('0x12')](_0x25956a,_0x16bb04)[_0xbb10('0x13')](function(_0xafe9c9){logger[_0xbb10('0x14')](_0xbb10('0x15'),_0x525c78,_0xbb10('0x16'));logger[_0xbb10('0x17')](_0xbb10('0x18'),_0x525c78,_0xbb10('0x16'),JSON[_0xbb10('0x19')](_0xafe9c9));if(_0xafe9c9[_0xbb10('0x1a')]){if(_0xafe9c9[_0xbb10('0x1a')][_0xbb10('0x1b')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x525c78,_0xafe9c9[_0xbb10('0x1a')]['message']);return _0x332831(_0xafe9c9[_0xbb10('0x1a')][_0xbb10('0x1c')]);}logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x525c78,_0xafe9c9[_0xbb10('0x1a')]['message']);return _0x3fd70b(_0xafe9c9[_0xbb10('0x1a')][_0xbb10('0x1c')]);}else{logger[_0xbb10('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x525c78,_0xbb10('0x16'));_0x3fd70b(_0xafe9c9[_0xbb10('0x1d')][_0xbb10('0x1c')]);}})['catch'](function(_0x1d1dcf){logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x525c78,_0x1d1dcf);_0x332831(_0x1d1dcf);});});}function respondWithStatusCode(_0x36eb92,_0x5b2979){_0x5b2979=_0x5b2979||0xcc;return function(_0x3ff12c){if(_0x3ff12c){return _0x36eb92['sendStatus'](_0x5b2979);}return _0x36eb92[_0xbb10('0x1e')](_0x5b2979)[_0xbb10('0x1f')]();};}function respondWithResult(_0x599e2b,_0x14bc3f){_0x14bc3f=_0x14bc3f||0xc8;return function(_0x170df9){if(_0x170df9){return _0x599e2b[_0xbb10('0x1e')](_0x14bc3f)[_0xbb10('0x20')](_0x170df9);}};}function respondWithFilteredResult(_0x5d3992,_0x52c3ea){return function(_0x10fdef){if(_0x10fdef){var _0x33f9e5=typeof _0x52c3ea['offset']==='undefined'&&typeof _0x52c3ea[_0xbb10('0x21')]===_0xbb10('0x22');var _0x2fdb77=_0x10fdef['count'];var _0x27523b=_0x33f9e5?0x0:_0x52c3ea[_0xbb10('0x23')];var _0x8c195a=_0x33f9e5?_0x10fdef[_0xbb10('0x24')]:_0x52c3ea[_0xbb10('0x23')]+_0x52c3ea[_0xbb10('0x21')];var _0x1c36ef;if(_0x8c195a>=_0x2fdb77){_0x8c195a=_0x2fdb77;_0x1c36ef=0xc8;}else{_0x1c36ef=0xce;}_0x5d3992['status'](_0x1c36ef);return _0x5d3992[_0xbb10('0x25')]('Content-Range',_0x27523b+'-'+_0x8c195a+'/'+_0x2fdb77)[_0xbb10('0x20')](_0x10fdef);}return null;};}function saveUpdates(_0x5dc075){return function(_0x1821c5){if(_0x1821c5){return _0x1821c5[_0xbb10('0x26')](_0x5dc075)[_0xbb10('0x13')](function(_0x16f1ee){return _0x16f1ee;});}return null;};}function removeEntity(_0x43e84f){return function(_0x45f1b2){if(_0x45f1b2){return _0x45f1b2[_0xbb10('0x27')]()[_0xbb10('0x13')](function(){var _0x477a34=_0x45f1b2[_0xbb10('0x28')]({'plain':!![]});var _0x33165a=_0xbb10('0x29');return db[_0xbb10('0x2a')][_0xbb10('0x27')]({'where':{'type':_0x33165a,'resourceId':_0x477a34['id']}})[_0xbb10('0x13')](function(){return _0x45f1b2;});})['then'](function(){_0x43e84f[_0xbb10('0x1e')](0xcc)[_0xbb10('0x1f')]();});}};}function handleEntityNotFound(_0x346119){return function(_0x256f05){if(!_0x256f05){_0x346119[_0xbb10('0x2b')](0x194);}return _0x256f05;};}function handleError(_0xa68070,_0x532075){_0x532075=_0x532075||0x1f4;return function(_0xb0a084){logger[_0xbb10('0x1a')](_0xb0a084[_0xbb10('0x2c')]);if(_0xb0a084['name']){delete _0xb0a084[_0xbb10('0x2d')];}_0xa68070['status'](_0x532075)['send'](_0xb0a084);};}exports[_0xbb10('0x2e')]=function(_0x135f93,_0x582cb2){var _0xfea6={'include':[{'model':db[_0xbb10('0x2f')],'as':'mandatoryDispositionPause'}]},_0x20dc10={},_0xe44e32={'count':0x0,'rows':[]};var _0x114abb=_[_0xbb10('0x30')](db[_0xbb10('0x31')][_0xbb10('0x32')],function(_0x53ff18){return{'name':_0x53ff18[_0xbb10('0x33')],'type':_0x53ff18[_0xbb10('0x34')][_0xbb10('0x35')]};});_0x20dc10[_0xbb10('0x36')]=_['map'](_0x114abb,'name');_0x20dc10['query']=_[_0xbb10('0x37')](_0x135f93[_0xbb10('0x38')]);_0x20dc10['filters']=_[_0xbb10('0x39')](_0x20dc10[_0xbb10('0x36')],_0x20dc10['query']);_0xfea6['attributes']=_[_0xbb10('0x39')](_0x20dc10[_0xbb10('0x36')],qs[_0xbb10('0x3a')](_0x135f93[_0xbb10('0x38')]['fields']));_0xfea6[_0xbb10('0x3b')]=_0xfea6[_0xbb10('0x3b')]['length']?_0xfea6[_0xbb10('0x3b')]:_0x20dc10[_0xbb10('0x36')];if(!_0x135f93[_0xbb10('0x38')][_0xbb10('0x3c')](_0xbb10('0x3d'))){_0xfea6[_0xbb10('0x21')]=qs[_0xbb10('0x21')](_0x135f93['query']['limit']);_0xfea6['offset']=qs[_0xbb10('0x23')](_0x135f93[_0xbb10('0x38')]['offset']);}_0xfea6[_0xbb10('0x3e')]=qs[_0xbb10('0x3f')](_0x135f93[_0xbb10('0x38')][_0xbb10('0x3f')]);_0xfea6[_0xbb10('0x40')]=qs['filters'](_[_0xbb10('0x41')](_0x135f93[_0xbb10('0x38')],_0x20dc10[_0xbb10('0x42')]),_0x114abb);if(_0x135f93[_0xbb10('0x38')][_0xbb10('0x43')]){_0xfea6[_0xbb10('0x40')]=_[_0xbb10('0x44')](_0xfea6[_0xbb10('0x40')],{'$or':_[_0xbb10('0x30')](_0x114abb,function(_0xdb8a71){if(_0xdb8a71[_0xbb10('0x34')]!==_0xbb10('0x45')){var _0x1a3621={};_0x1a3621[_0xdb8a71[_0xbb10('0x2d')]]={'$like':'%'+_0x135f93[_0xbb10('0x38')]['filter']+'%'};return _0x1a3621;}})});}_0xfea6=_['merge']({},_0xfea6,_0x135f93[_0xbb10('0x46')]);var _0x402655={'where':_0xfea6[_0xbb10('0x40')]};return db[_0xbb10('0x31')][_0xbb10('0x24')](_0x402655)[_0xbb10('0x13')](function(_0x3ee48b){_0xe44e32['count']=_0x3ee48b;if(_0x135f93[_0xbb10('0x38')][_0xbb10('0x47')]){_0xfea6['include']=[{'all':!![]}];}return db[_0xbb10('0x31')]['findAll'](_0xfea6);})['then'](function(_0x57cfc0){_0xe44e32['rows']=_0x57cfc0;return _0xe44e32;})['then'](respondWithFilteredResult(_0x582cb2,_0xfea6))[_0xbb10('0x48')](handleError(_0x582cb2,null));};exports[_0xbb10('0x49')]=function(_0x2a09f0,_0x2efdc6){var _0x498aa6={'raw':![],'where':{'id':_0x2a09f0[_0xbb10('0x4a')]['id']},'include':[{'model':db['Pause'],'as':_0xbb10('0x4b')}]},_0x5cdd35={};_0x5cdd35[_0xbb10('0x36')]=_[_0xbb10('0x37')](db['ChatWebsite'][_0xbb10('0x32')]);_0x5cdd35[_0xbb10('0x38')]=_['keys'](_0x2a09f0['query']);_0x5cdd35[_0xbb10('0x42')]=_[_0xbb10('0x39')](_0x5cdd35[_0xbb10('0x36')],_0x5cdd35[_0xbb10('0x38')]);_0x498aa6['attributes']=_[_0xbb10('0x39')](_0x5cdd35[_0xbb10('0x36')],qs['fields'](_0x2a09f0[_0xbb10('0x38')][_0xbb10('0x3a')]));_0x498aa6[_0xbb10('0x3b')]=_0x498aa6[_0xbb10('0x3b')][_0xbb10('0x4c')]?_0x498aa6[_0xbb10('0x3b')]:_0x5cdd35['model'];if(_0x2a09f0[_0xbb10('0x38')][_0xbb10('0x47')]){_0x498aa6[_0xbb10('0x4d')]=[{'all':!![]}];}_0x498aa6=_[_0xbb10('0x44')]({},_0x498aa6,_0x2a09f0['options']);return db[_0xbb10('0x31')][_0xbb10('0x4e')](_0x498aa6)[_0xbb10('0x13')](handleEntityNotFound(_0x2efdc6,null))[_0xbb10('0x13')](respondWithResult(_0x2efdc6,null))[_0xbb10('0x48')](handleError(_0x2efdc6,null));};exports[_0xbb10('0x4f')]=function(_0x5f480e,_0x28d0cd){return db['ChatWebsite'][_0xbb10('0x4f')](_0x5f480e[_0xbb10('0x50')],{})[_0xbb10('0x13')](function(_0x198e40){var _0x3810c1=_0x5f480e[_0xbb10('0x51')][_0xbb10('0x28')]({'plain':!![]});if(!_0x3810c1)throw new Error(_0xbb10('0x52'));if(_0x3810c1[_0xbb10('0x53')]==='user'){var _0x2221bd=_0x198e40[_0xbb10('0x28')]({'plain':!![]});var _0x128eff=_0xbb10('0x29');return db[_0xbb10('0x54')][_0xbb10('0x4e')]({'where':{'name':_0x128eff,'userProfileId':_0x3810c1[_0xbb10('0x55')]},'raw':!![]})[_0xbb10('0x13')](function(_0x264459){if(_0x264459&&_0x264459[_0xbb10('0x56')]===0x0){return db[_0xbb10('0x2a')][_0xbb10('0x4f')]({'name':_0x2221bd[_0xbb10('0x2d')],'resourceId':_0x2221bd['id'],'type':_0x264459['name'],'sectionId':_0x264459['id']},{})[_0xbb10('0x13')](function(){return _0x198e40;});}else{return _0x198e40;}})[_0xbb10('0x48')](function(_0x5d0009){logger[_0xbb10('0x1a')](_0xbb10('0x57'),_0x5d0009);throw _0x5d0009;});}return _0x198e40;})[_0xbb10('0x13')](respondWithResult(_0x28d0cd,0xc9))[_0xbb10('0x48')](handleError(_0x28d0cd,null));};exports[_0xbb10('0x26')]=function(_0x295c72,_0x2b7700){if(_0x295c72[_0xbb10('0x50')]['id']){delete _0x295c72[_0xbb10('0x50')]['id'];}return db[_0xbb10('0x31')][_0xbb10('0x4e')]({'where':{'id':_0x295c72[_0xbb10('0x4a')]['id']},'include':[{'model':db[_0xbb10('0x2f')],'as':_0xbb10('0x4b')}]})[_0xbb10('0x13')](handleEntityNotFound(_0x2b7700,null))[_0xbb10('0x13')](saveUpdates(_0x295c72[_0xbb10('0x50')],null))[_0xbb10('0x13')](respondWithResult(_0x2b7700,null))[_0xbb10('0x48')](handleError(_0x2b7700,null));};exports[_0xbb10('0x27')]=function(_0x4732d5,_0x4b0c22){return db['ChatWebsite'][_0xbb10('0x4e')]({'where':{'id':_0x4732d5[_0xbb10('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4b0c22,null))[_0xbb10('0x13')](removeEntity(_0x4b0c22,null))['catch'](handleError(_0x4b0c22,null));};exports[_0xbb10('0x58')]=function(_0x3fb56d,_0x1b2ecb){return db[_0xbb10('0x31')][_0xbb10('0x58')]()[_0xbb10('0x13')](respondWithResult(_0x1b2ecb,null))[_0xbb10('0x48')](handleError(_0x1b2ecb,null));};exports[_0xbb10('0x59')]=function(_0x168c29,_0x366e5d){if(_0x168c29[_0xbb10('0x50')]['id']){delete _0x168c29['body']['id'];}return db['ChatWebsite'][_0xbb10('0x4e')]({'where':{'id':_0x168c29[_0xbb10('0x4a')]['id']}})['then'](handleEntityNotFound(_0x366e5d,null))[_0xbb10('0x13')](function(_0x2018fd){if(_0x2018fd){_0x168c29[_0xbb10('0x50')][_0xbb10('0x5a')]=_0x2018fd['id'];return db[_0xbb10('0x5b')][_0xbb10('0x4f')](_0x168c29[_0xbb10('0x50')]);}})[_0xbb10('0x13')](respondWithResult(_0x366e5d,null))['catch'](handleError(_0x366e5d,null));};exports['getDispositions']=function(_0x2d41d4,_0x160419){var _0x43a087={'raw':![],'where':{}};var _0x21e7b2={};var _0x1015d1={'count':0x0,'rows':[]};return db[_0xbb10('0x31')][_0xbb10('0x5c')]({'where':{'id':_0x2d41d4['params']['id']}})[_0xbb10('0x13')](handleEntityNotFound(_0x160419,null))[_0xbb10('0x13')](function(_0x2d3b9e){if(_0x2d3b9e){_0x21e7b2[_0xbb10('0x36')]=_[_0xbb10('0x37')](db[_0xbb10('0x5b')][_0xbb10('0x32')]);_0x21e7b2['query']=_[_0xbb10('0x37')](_0x2d41d4[_0xbb10('0x38')]);_0x21e7b2['filters']=_[_0xbb10('0x39')](_0x21e7b2['model'],_0x21e7b2['query']);_0x43a087[_0xbb10('0x3b')]=_[_0xbb10('0x39')](_0x21e7b2[_0xbb10('0x36')],qs[_0xbb10('0x3a')](_0x2d41d4[_0xbb10('0x38')][_0xbb10('0x3a')]));_0x43a087[_0xbb10('0x3b')]=_0x43a087[_0xbb10('0x3b')][_0xbb10('0x4c')]?_0x43a087[_0xbb10('0x3b')]:_0x21e7b2[_0xbb10('0x36')];if(!_0x2d41d4[_0xbb10('0x38')][_0xbb10('0x3c')](_0xbb10('0x3d'))){_0x43a087['limit']=qs[_0xbb10('0x21')](_0x2d41d4[_0xbb10('0x38')][_0xbb10('0x21')]);_0x43a087[_0xbb10('0x23')]=qs[_0xbb10('0x23')](_0x2d41d4['query'][_0xbb10('0x23')]);}_0x43a087['order']=qs[_0xbb10('0x3f')](_0x2d41d4[_0xbb10('0x38')][_0xbb10('0x3f')]);_0x43a087[_0xbb10('0x40')]=qs[_0xbb10('0x42')](_[_0xbb10('0x41')](_0x2d41d4[_0xbb10('0x38')],_0x21e7b2['filters']));_0x43a087['where'][_0xbb10('0x5a')]=_0x2d3b9e['id'];if(_0x2d41d4[_0xbb10('0x38')][_0xbb10('0x43')]){_0x43a087[_0xbb10('0x40')]=_[_0xbb10('0x44')](_0x43a087[_0xbb10('0x40')],{'$or':_['map'](_0x43a087[_0xbb10('0x3b')],function(_0x553871){var _0x19e477={};_0x19e477[_0x553871]={'$like':'%'+_0x2d41d4['query'][_0xbb10('0x43')]+'%'};return _0x19e477;})});}_0x43a087=_[_0xbb10('0x44')]({},_0x43a087,_0x2d41d4['options']);return db[_0xbb10('0x5b')][_0xbb10('0x24')]({'where':_0x43a087[_0xbb10('0x40')]})[_0xbb10('0x13')](function(_0xaa5fa9){_0x1015d1[_0xbb10('0x24')]=_0xaa5fa9;if(_0x2d41d4[_0xbb10('0x38')][_0xbb10('0x47')]){_0x43a087[_0xbb10('0x4d')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x43a087);})[_0xbb10('0x13')](function(_0x5beac6){_0x1015d1[_0xbb10('0x5d')]=_0x5beac6;return _0x1015d1;});}})['then'](respondWithFilteredResult(_0x160419,_0x43a087))[_0xbb10('0x48')](handleError(_0x160419,null));};exports[_0xbb10('0x5e')]=function(_0x4930fb,_0x1859a1){return db[_0xbb10('0x31')][_0xbb10('0x4e')]({'where':{'id':_0x4930fb[_0xbb10('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1859a1,null))[_0xbb10('0x13')](function(_0x47d5eb){if(_0x47d5eb){return _0x47d5eb[_0xbb10('0x5e')](_0x4930fb['query']['ids']);}})['then'](respondWithStatusCode(_0x1859a1,null))[_0xbb10('0x48')](handleError(_0x1859a1,null));};exports[_0xbb10('0x5f')]=function(_0x4dd04f,_0x34a74a){if(_0x4dd04f['body']['id']){delete _0x4dd04f[_0xbb10('0x50')]['id'];}return db['ChatWebsite'][_0xbb10('0x4e')]({'where':{'id':_0x4dd04f[_0xbb10('0x4a')]['id']}})[_0xbb10('0x13')](handleEntityNotFound(_0x34a74a,null))[_0xbb10('0x13')](function(_0x1f74b5){if(_0x1f74b5){_0x4dd04f[_0xbb10('0x50')][_0xbb10('0x5a')]=_0x1f74b5['id'];return db['CannedAnswer']['create'](_0x4dd04f[_0xbb10('0x50')]);}})['then'](respondWithResult(_0x34a74a,null))[_0xbb10('0x48')](handleError(_0x34a74a,null));};exports[_0xbb10('0x60')]=function(_0x1f07c2,_0x1902d1){var _0x28b02b={'raw':![],'where':{}};var _0x4de651={};var _0x53c3f4={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xbb10('0x5c')]({'where':{'id':_0x1f07c2[_0xbb10('0x4a')]['id']}})[_0xbb10('0x13')](handleEntityNotFound(_0x1902d1,null))[_0xbb10('0x13')](function(_0x389731){if(_0x389731){_0x4de651[_0xbb10('0x36')]=_[_0xbb10('0x37')](db['CannedAnswer'][_0xbb10('0x32')]);_0x4de651[_0xbb10('0x38')]=_['keys'](_0x1f07c2['query']);_0x4de651['filters']=_[_0xbb10('0x39')](_0x4de651['model'],_0x4de651[_0xbb10('0x38')]);_0x28b02b[_0xbb10('0x3b')]=_[_0xbb10('0x39')](_0x4de651[_0xbb10('0x36')],qs[_0xbb10('0x3a')](_0x1f07c2[_0xbb10('0x38')]['fields']));_0x28b02b[_0xbb10('0x3b')]=_0x28b02b[_0xbb10('0x3b')]['length']?_0x28b02b['attributes']:_0x4de651[_0xbb10('0x36')];if(!_0x1f07c2[_0xbb10('0x38')][_0xbb10('0x3c')](_0xbb10('0x3d'))){_0x28b02b['limit']=qs['limit'](_0x1f07c2[_0xbb10('0x38')][_0xbb10('0x21')]);_0x28b02b[_0xbb10('0x23')]=qs[_0xbb10('0x23')](_0x1f07c2['query'][_0xbb10('0x23')]);}_0x28b02b[_0xbb10('0x3e')]=qs['sort'](_0x1f07c2[_0xbb10('0x38')][_0xbb10('0x3f')]);_0x28b02b[_0xbb10('0x40')]=qs[_0xbb10('0x42')](_[_0xbb10('0x41')](_0x1f07c2[_0xbb10('0x38')],_0x4de651[_0xbb10('0x42')]));_0x28b02b[_0xbb10('0x40')]['ChatWebsiteId']=_0x389731['id'];if(_0x1f07c2[_0xbb10('0x38')][_0xbb10('0x43')]){_0x28b02b[_0xbb10('0x40')]=_['merge'](_0x28b02b['where'],{'$or':_['map'](_0x28b02b[_0xbb10('0x3b')],function(_0x41d1ee){var _0x4938e8={};_0x4938e8[_0x41d1ee]={'$like':'%'+_0x1f07c2['query']['filter']+'%'};return _0x4938e8;})});}_0x28b02b=_[_0xbb10('0x44')]({},_0x28b02b,_0x1f07c2['options']);return db[_0xbb10('0x61')][_0xbb10('0x24')]({'where':_0x28b02b[_0xbb10('0x40')]})[_0xbb10('0x13')](function(_0x3dc6c8){_0x53c3f4[_0xbb10('0x24')]=_0x3dc6c8;if(_0x1f07c2[_0xbb10('0x38')][_0xbb10('0x47')]){_0x28b02b[_0xbb10('0x4d')]=[{'all':!![]}];}return db[_0xbb10('0x61')][_0xbb10('0x62')](_0x28b02b);})['then'](function(_0x1e38fc){_0x53c3f4['rows']=_0x1e38fc;return _0x53c3f4;});}})[_0xbb10('0x13')](respondWithFilteredResult(_0x1902d1,_0x28b02b))['catch'](handleError(_0x1902d1,null));};exports[_0xbb10('0x63')]=function(_0x5abd53,_0x1631d9){return db[_0xbb10('0x31')][_0xbb10('0x4e')]({'where':{'id':_0x5abd53[_0xbb10('0x4a')]['id']}})[_0xbb10('0x13')](handleEntityNotFound(_0x1631d9,null))[_0xbb10('0x13')](function(_0x75f1fe){if(_0x75f1fe){return _0x75f1fe[_0xbb10('0x63')](_0x5abd53[_0xbb10('0x38')]['ids']);}})['then'](respondWithStatusCode(_0x1631d9,null))[_0xbb10('0x48')](handleError(_0x1631d9,null));};exports[_0xbb10('0x64')]=function(_0x58f7f6,_0x4a41dd){_0x58f7f6[_0xbb10('0x50')][_0xbb10('0x65')]=_0x58f7f6['file'][_0xbb10('0x66')];return db['ChatWebsite'][_0xbb10('0x4e')]({'where':{'id':_0x58f7f6['params']['id']}})[_0xbb10('0x13')](handleEntityNotFound(_0x4a41dd,null))[_0xbb10('0x13')](saveUpdates(_0x58f7f6[_0xbb10('0x50')],null))[_0xbb10('0x13')](respondWithResult(_0x4a41dd,null))[_0xbb10('0x48')](handleError(_0x4a41dd,null));};exports['addAvatar']=function(_0x37a39c,_0xe6e2e6){_0x37a39c[_0xbb10('0x50')][_0xbb10('0x67')]=_0x37a39c[_0xbb10('0x68')]['filename'];return db[_0xbb10('0x31')][_0xbb10('0x4e')]({'where':{'id':_0x37a39c[_0xbb10('0x4a')]['id']}})[_0xbb10('0x13')](handleEntityNotFound(_0xe6e2e6,null))['then'](saveUpdates(_0x37a39c[_0xbb10('0x50')],null))['then'](respondWithResult(_0xe6e2e6,null))[_0xbb10('0x48')](handleError(_0xe6e2e6,null));};exports['addCustomerAvatar']=function(_0x52327a,_0x24c133){_0x52327a[_0xbb10('0x50')][_0xbb10('0x69')]=_0x52327a[_0xbb10('0x68')]['filename'];return db['ChatWebsite'][_0xbb10('0x4e')]({'where':{'id':_0x52327a[_0xbb10('0x4a')]['id']}})[_0xbb10('0x13')](handleEntityNotFound(_0x24c133,null))[_0xbb10('0x13')](saveUpdates(_0x52327a[_0xbb10('0x50')],null))[_0xbb10('0x13')](respondWithResult(_0x24c133,null))[_0xbb10('0x48')](handleError(_0x24c133,null));};exports[_0xbb10('0x6a')]=function(_0x1668ed,_0x5c1ebc){_0x1668ed[_0xbb10('0x50')][_0xbb10('0x6b')]=_0x1668ed[_0xbb10('0x68')]['filename'];return db[_0xbb10('0x31')][_0xbb10('0x4e')]({'where':{'id':_0x1668ed[_0xbb10('0x4a')]['id']}})[_0xbb10('0x13')](handleEntityNotFound(_0x5c1ebc,null))[_0xbb10('0x13')](saveUpdates(_0x1668ed['body'],null))[_0xbb10('0x13')](respondWithResult(_0x5c1ebc,null))[_0xbb10('0x48')](handleError(_0x5c1ebc,null));};exports[_0xbb10('0x6c')]=function(_0x2c912a,_0x2e449d){var _0x3c0dc6=path[_0xbb10('0x6d')](config[_0xbb10('0x6e')],_0xbb10('0x6f'));var _0x5a793f={'where':{'id':_0x2c912a[_0xbb10('0x4a')]['id']},'attributes':['id',_0xbb10('0x65')],'raw':!![]};var _0x1841dd=![];return require(_0xbb10('0x70'))[_0xbb10('0x71')]()['then'](function(_0x3ff3bd){if(_0x3ff3bd){_0x1841dd=_0x3ff3bd[_0xbb10('0x72')];}})['then'](function(){return db[_0xbb10('0x31')][_0xbb10('0x4e')](_0x5a793f);})[_0xbb10('0x13')](handleEntityNotFound(_0x2e449d,null))[_0xbb10('0x13')](function(_0x366d18){if(_0x366d18){if(!_[_0xbb10('0x73')](_0x366d18['sitepic'])){if(fs[_0xbb10('0x74')](path[_0xbb10('0x6d')](config['root'],'server/files/images/logos/',_0x366d18[_0xbb10('0x65')]))&&_0x1841dd){_0x3c0dc6=path[_0xbb10('0x6d')](config[_0xbb10('0x6e')],_0xbb10('0x75'),_0x366d18[_0xbb10('0x65')]);}}return _0x2e449d['download'](_0x3c0dc6);}})[_0xbb10('0x48')](handleError(_0x2e449d,null));};exports[_0xbb10('0x76')]=function(_0x3a5cd7,_0x40b182){var _0x1ac919=path[_0xbb10('0x6d')](config[_0xbb10('0x6e')],_0xbb10('0x77'));var _0x53ba9a={'where':{'id':_0x3a5cd7['params']['id']},'attributes':['id',_0xbb10('0x67')],'raw':!![]};return db[_0xbb10('0x31')][_0xbb10('0x4e')](_0x53ba9a)[_0xbb10('0x13')](handleEntityNotFound(_0x40b182,null))[_0xbb10('0x13')](function(_0x412564){if(_0x412564){if(!_[_0xbb10('0x73')](_0x412564[_0xbb10('0x67')])){if(fs[_0xbb10('0x74')](path[_0xbb10('0x6d')](config['root'],_0xbb10('0x78'),_0x412564[_0xbb10('0x67')]))){_0x1ac919=path['join'](config[_0xbb10('0x6e')],'server/files/images/avatars/',_0x412564[_0xbb10('0x67')]);}}return _0x40b182[_0xbb10('0x79')](_0x1ac919);}})[_0xbb10('0x48')](handleError(_0x40b182,null));};exports['getCustomerAvatar']=function(_0x4cfc41,_0x4d4aa1){var _0x5d2f61=path[_0xbb10('0x6d')](config[_0xbb10('0x6e')],'server/files/images/avatars/customer_avatar.png');var _0x1699f3={'where':{'id':_0x4cfc41[_0xbb10('0x4a')]['id']},'attributes':['id',_0xbb10('0x69'),_0xbb10('0x7a')],'raw':!![]};return db[_0xbb10('0x31')][_0xbb10('0x4e')](_0x1699f3)['then'](handleEntityNotFound(_0x4d4aa1,null))[_0xbb10('0x13')](function(_0x21c272){if(_0x21c272){if(!_[_0xbb10('0x73')](_0x21c272['customerAvatar'])){if(fs['existsSync'](path[_0xbb10('0x6d')](config[_0xbb10('0x6e')],'server/files/images/avatars/',_0x21c272['customerAvatar']))&&_0x21c272[_0xbb10('0x7a')]){_0x5d2f61=path[_0xbb10('0x6d')](config['root'],_0xbb10('0x78'),_0x21c272[_0xbb10('0x69')]);}}return _0x4d4aa1['download'](_0x5d2f61);}})[_0xbb10('0x48')](handleError(_0x4d4aa1,null));};exports[_0xbb10('0x7b')]=function(_0x3177b9,_0x3041d7){var _0x25f2d9=path[_0xbb10('0x6d')](config['root'],_0xbb10('0x7c'));var _0x5b0676={'where':{'id':_0x3177b9[_0xbb10('0x4a')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xbb10('0x31')][_0xbb10('0x4e')](_0x5b0676)[_0xbb10('0x13')](handleEntityNotFound(_0x3041d7,null))['then'](function(_0x2975f3){if(_0x2975f3){if(!_[_0xbb10('0x73')](_0x2975f3[_0xbb10('0x6b')])){if(fs[_0xbb10('0x74')](path['join'](config[_0xbb10('0x6e')],_0xbb10('0x78'),_0x2975f3['systemAvatar']))){_0x25f2d9=path['join'](config[_0xbb10('0x6e')],'server/files/images/avatars/',_0x2975f3['systemAvatar']);}}return _0x3041d7[_0xbb10('0x79')](_0x25f2d9);}})[_0xbb10('0x48')](handleError(_0x3041d7,null));};exports[_0xbb10('0x7d')]=function(_0x23ec2f,_0x42b5e9){var _0x2c6fb2=require(_0xbb10('0x7e'));var _0x141c64=new _0x2c6fb2();var _0xc6dc51=_0x141c64[_0xbb10('0x7f')](_0x23ec2f['headers'][_0xbb10('0x80')])['getResult']();var _0x4349bf={'body':_0x23ec2f[_0xbb10('0x50')],'channel':_0xbb10('0x81')};var _0x1b7906=[];var _0x49b74e=[];var _0x128f45={};var _0x9e04dc=![];return db[_0xbb10('0x82')][_0xbb10('0x58')]()['then'](function(_0x140c72){if(!_0x140c72){throw new db[(_0xbb10('0x83'))][(_0xbb10('0x84'))](_0xbb10('0x85'));}_0x1b7906=_['difference'](_['keys'](_0x140c72),[_0xbb10('0x86'),_0xbb10('0x87')]);_0x49b74e=_[_0xbb10('0x88')](_[_0xbb10('0x37')](_0x140c72),[_0xbb10('0x86'),_0xbb10('0x87'),_0xbb10('0x89'),_0xbb10('0x8a')]);if(_0x23ec2f['body']['id']){delete _0x23ec2f[_0xbb10('0x50')]['id'];}if(_[_0xbb10('0x73')](_0x23ec2f['body'][_0xbb10('0x8b')])){throw new db['Sequelize'][(_0xbb10('0x84'))](_0xbb10('0x8c'));}if(_[_0xbb10('0x73')](_0x23ec2f['body'][_0xbb10('0x50')])||_0x23ec2f[_0xbb10('0x50')]['body']===''){throw new db[(_0xbb10('0x83'))]['ValidationError'](_0xbb10('0x8d'));}if(_[_0xbb10('0x73')](_0x23ec2f[_0xbb10('0x50')][_0xbb10('0x8e')])){throw new db[(_0xbb10('0x83'))][(_0xbb10('0x84'))](_0xbb10('0x8f')+_0x49b74e);}if(!_['includes'](_0x49b74e,_0x23ec2f['body'][_0xbb10('0x8e')])){throw new db[(_0xbb10('0x83'))][(_0xbb10('0x84'))](_0xbb10('0x90')+_0x49b74e);}_0x128f45[_0x23ec2f['body'][_0xbb10('0x8e')]]=_0x23ec2f[_0xbb10('0x50')][_0xbb10('0x8b')];})['then'](function(){return db[_0xbb10('0x31')][_0xbb10('0x4e')]({'where':{'id':_0x23ec2f[_0xbb10('0x4a')]['id']},'include':[{'model':db[_0xbb10('0x91')],'as':_0xbb10('0x92'),'include':[{'model':db[_0xbb10('0x82')],'as':'Contacts','where':_0x128f45,'limit':0x1,'order':[[_0xbb10('0x87'),_0xbb10('0x93')]]}]},{'model':db[_0xbb10('0x94')],'as':'Applications'}]});})[_0xbb10('0x13')](handleEntityNotFound(_0x42b5e9,null))['then'](function(_0x4bea6f){if(_0x4bea6f&&_0x4bea6f[_0xbb10('0x92')]){_0x4349bf['account']=_0x4bea6f;_0x4349bf[_0xbb10('0x95')]=_0x4bea6f[_0xbb10('0x96')];_0x4349bf[_0xbb10('0x97')]=_0x4bea6f[_0xbb10('0x92')];_0x4349bf[_0xbb10('0x95')]=_[_0xbb10('0x98')](_0x4349bf[_0xbb10('0x95')],[_0xbb10('0x99')],[_0xbb10('0x9a')]);if(_0x4349bf['account'][_0xbb10('0x96')]){delete _0x4349bf[_0xbb10('0x9b')][_0xbb10('0x96')];}if(_0x4349bf[_0xbb10('0x9b')]['List']&&_0x4349bf[_0xbb10('0x9b')][_0xbb10('0x92')][_0xbb10('0x9c')]['length']){return _0x4349bf['account']['List'][_0xbb10('0x9c')][0x0];}var _0xeb4255=_['defaults'](_0x23ec2f[_0xbb10('0x50')],{'firstName':_0x23ec2f[_0xbb10('0x50')][_0xbb10('0x8b')],'ListId':_0x4bea6f[_0xbb10('0x8a')]});_0xeb4255[_0x23ec2f[_0xbb10('0x50')]['mapKey']]=_0x23ec2f[_0xbb10('0x50')]['from'];return db[_0xbb10('0x82')][_0xbb10('0x4f')](_0xeb4255,{'fields':_0x1b7906,'raw':!![]});}})[_0xbb10('0x13')](handleEntityNotFound(_0x42b5e9,null))[_0xbb10('0x13')](function(_0x44974c){_0x4349bf[_0xbb10('0x9d')]=_0x44974c;var _0x9e86ba=_0x23ec2f[_0xbb10('0x50')][_0xbb10('0x9e')];if(_0x23ec2f[_0xbb10('0x9f')]['cf-connecting-ip']){_0x9e86ba=_0x23ec2f[_0xbb10('0x9f')][_0xbb10('0xa0')];}else if(_0x23ec2f[_0xbb10('0x9f')]['x-forwarded-for']){_0x9e86ba=_[_0xbb10('0xa1')](_0x23ec2f[_0xbb10('0x9f')][_0xbb10('0xa2')][_0xbb10('0xa3')](','));}if(_0x44974c){var _0x3ac951={'ContactId':_0x44974c['id'],'ChatWebsiteId':_0x23ec2f[_0xbb10('0x4a')]['id'],'from':(_0x44974c[_0xbb10('0xa4')]||'')+'\x20'+(_0x44974c[_0xbb10('0xa5')]||''),'customerIp':_0x9e86ba,'customerPort':_0x23ec2f[_0xbb10('0x9f')][_0xbb10('0xa6')]?_0x23ec2f['headers'][_0xbb10('0xa6')]:null,'referer':_0x23ec2f[_0xbb10('0x50')]['referer'],'browserName':_0xc6dc51[_0xbb10('0xa7')][_0xbb10('0x2d')]&&_0xc6dc51[_0xbb10('0xa7')][_0xbb10('0xa8')]?util['format']('%s\x20%s',_0xc6dc51[_0xbb10('0xa7')]['name'],_0xc6dc51[_0xbb10('0xa7')]['version']):_0xbb10('0xa9'),'browserVersion':_0xc6dc51[_0xbb10('0xa7')][_0xbb10('0xa8')]||_0xbb10('0xa9'),'osName':util['format'](_0xbb10('0xaa'),_0xc6dc51['os'][_0xbb10('0x2d')],_0xc6dc51['os'][_0xbb10('0xa8')]),'osVersion':_0xc6dc51['os'][_0xbb10('0xa8')],'deviceModel':_0xc6dc51[_0xbb10('0xab')][_0xbb10('0x36')]&&_0xc6dc51[_0xbb10('0xab')]['vendor']?util[_0xbb10('0xac')](_0xbb10('0xad'),_0xc6dc51[_0xbb10('0xab')]['model'],_0xc6dc51[_0xbb10('0xab')][_0xbb10('0xae')],_0xc6dc51[_0xbb10('0xab')][_0xbb10('0x34')]):null,'deviceVendor':_0xc6dc51[_0xbb10('0xab')]['vendor'],'deviceType':_0xc6dc51['device'][_0xbb10('0x34')],'formData':JSON[_0xbb10('0x19')](_0x23ec2f['body'])};var _0x301785={'ChatWebsiteId':_0x23ec2f[_0xbb10('0x4a')]['id'],'closed':![]};if(_0x23ec2f[_0xbb10('0x50')][_0xbb10('0xaf')]){_0x301785[_0xbb10('0xaf')]=_0x23ec2f[_0xbb10('0x50')][_0xbb10('0xaf')];return db[_0xbb10('0xb0')][_0xbb10('0x4e')]({'where':_0x301785})[_0xbb10('0x13')](function(_0x5166bf){if(_0x5166bf){return[_0x5166bf,![]];}_0x3ac951[_0xbb10('0xaf')]=_0x23ec2f['body']['threadId'];_0x3ac951[_0xbb10('0xb1')]=_0x23ec2f[_0xbb10('0x50')][_0xbb10('0xb1')];return db['ChatInteraction'][_0xbb10('0x4f')](_0x3ac951)[_0xbb10('0x13')](function(_0x3eb915){return[_0x3eb915,!![]];});});}_0x301785['ContactId']=_0x44974c['id'];if(_0x23ec2f[_0xbb10('0x50')][_0xbb10('0xb2')]&&_0x23ec2f['body'][_0xbb10('0xb2')]['id']){_0x301785['id']=_0x23ec2f[_0xbb10('0x50')][_0xbb10('0xb2')]['id'];return db[_0xbb10('0xb0')]['find']({'where':_0x301785})[_0xbb10('0x13')](function(_0x2e40b2){if(_0x2e40b2){return[_0x2e40b2,![]];}return db[_0xbb10('0xb0')][_0xbb10('0x4f')](_0x3ac951)[_0xbb10('0x13')](function(_0x262975){return[_0x262975,!![]];});});}return db[_0xbb10('0xb0')]['create'](_0x3ac951)['then'](function(_0x27a89e){return[_0x27a89e,!![]];});}})[_0xbb10('0xb3')](function(_0x5594ed,_0x351037){if(_0x5594ed){_0x9e04dc=_0x351037;if(!_0x351037){var _0x69efe2={'from':(_0x4349bf[_0xbb10('0x9d')][_0xbb10('0xa4')]||'')+'\x20'+(_0x4349bf[_0xbb10('0x9d')][_0xbb10('0xa5')]||'')};if(_0x23ec2f[_0xbb10('0x50')][_0xbb10('0xaf')]&&_0x23ec2f[_0xbb10('0x50')][_0xbb10('0xb4')]&&_0x23ec2f[_0xbb10('0x50')][_0xbb10('0xaf')]!=_0x23ec2f[_0xbb10('0x50')][_0xbb10('0xb4')]){_0x69efe2[_0xbb10('0xaf')]=_0x23ec2f[_0xbb10('0x50')][_0xbb10('0xb4')];}return _0x5594ed['update'](_0x69efe2);}else{return _0x5594ed;}}})[_0xbb10('0x13')](function(_0xf3269a){_0x4349bf[_0xbb10('0xb2')]=_0xf3269a[_0xbb10('0x28')]({'plain':!![]});_0x4349bf[_0xbb10('0xb2')][_0xbb10('0xb5')]=_0x9e04dc;if(_0x4349bf['interaction'][_0xbb10('0xb5')]){if(_0x4349bf[_0xbb10('0x9b')][_0xbb10('0xb6')]){_0x4349bf[_0xbb10('0x95')][_0xbb10('0xb7')]({'id':0x0,'priority':_0x4349bf[_0xbb10('0x95')]['length']+0x1,'app':'close','appdata':_0xbb10('0xb8'),'interval':'*,*,*,*'});}}return db[_0xbb10('0xb9')]['create']({'body':_0x23ec2f[_0xbb10('0x50')][_0xbb10('0x50')],'ChatWebsiteId':_0x23ec2f['params']['id'],'ChatInteractionId':_0xf3269a['id'],'direction':'in','ContactId':_0x4349bf['contact']['id'],'AttachmentId':_0x23ec2f['body'][_0xbb10('0xba')]});})['then'](function(_0x2b2102){_0x4349bf[_0xbb10('0x1c')]=_0x2b2102;if(_0x4349bf[_0xbb10('0xb2')][_0xbb10('0xbb')]){return db[_0xbb10('0xbc')]['find']({'attributes':['id',_0xbb10('0x2d')],'where':{'id':_0x4349bf[_0xbb10('0xb2')][_0xbb10('0xbb')]}})[_0xbb10('0x13')](function(_0x2ea1e0){if(_0x2ea1e0){_0x4349bf[_0xbb10('0x95')][_0xbb10('0xbd')]({'id':0x0,'priority':0x0,'app':_0xbb10('0xbe'),'appdata':_0x2ea1e0[_0xbb10('0x2d')]+','+(_0x4349bf[_0xbb10('0x9b')][_0xbb10('0xbf')]||0xa),'interval':_0xbb10('0xc0')});_0x4349bf[_0xbb10('0xc1')]=!![];}return respondWithRpcPromise(_0xbb10('0xc2'),_0xbb10('0xc3'),_0x4349bf);});}return respondWithRpcPromise(_0xbb10('0xc2'),_0xbb10('0xc3'),_0x4349bf);})[_0xbb10('0x13')](function(_0x19fa3f){respondWithRpcPromise(_0xbb10('0xc4'),_0xbb10('0xc4'),{'event':'notify','message':_0x19fa3f},client9002);return _0x19fa3f;})[_0xbb10('0x13')](respondWithResult(_0x42b5e9,null))[_0xbb10('0x48')](handleError(_0x42b5e9,null));};exports['offline']=function(_0x93ebc,_0x3f9bf8){var _0x26cf88,_0x2b8a95,_0x1ea0c0;var _0x143566=[];var _0x18e9d1={};var _0x450625=_0x93ebc[_0xbb10('0xc5')]||[];var _0xa12882=[];var _0x1810e9;return db[_0xbb10('0x82')][_0xbb10('0x58')]()[_0xbb10('0x13')](function(_0x72d43e){if(!_0x72d43e){throw new db[(_0xbb10('0x83'))][(_0xbb10('0x84'))]('no\x20available\x20attributes');}_0x143566=_['difference'](_[_0xbb10('0x37')](_0x72d43e),[_0xbb10('0x86'),'updatedAt',_0xbb10('0x89'),_0xbb10('0x8a')]);if(_0x93ebc['body']['id']){delete _0x93ebc[_0xbb10('0x50')]['id'];}if(_[_0xbb10('0x73')](_0x93ebc[_0xbb10('0x50')][_0xbb10('0x8b')])){throw _0x3f9bf8[_0xbb10('0x1e')](0x1f4)[_0xbb10('0xc6')](new db[(_0xbb10('0x83'))]['ValidationError']('from\x20is\x20mandatory'));}if(_['isNil'](_0x93ebc[_0xbb10('0x50')][_0xbb10('0x50')])||_0x93ebc[_0xbb10('0x50')][_0xbb10('0x50')]===''){throw _0x3f9bf8[_0xbb10('0x1e')](0x1f4)['send'](new db['Sequelize']['ValidationError'](_0xbb10('0x8d')));}if(_[_0xbb10('0x73')](_0x93ebc[_0xbb10('0x50')][_0xbb10('0xc7')])){throw _0x3f9bf8[_0xbb10('0x1e')](0x1f4)[_0xbb10('0xc6')](new db[(_0xbb10('0x83'))][(_0xbb10('0x84'))](_0xbb10('0xc8')+_0x143566));}if(!_[_0xbb10('0xc9')](_0x143566,_0x93ebc['body'][_0xbb10('0xc7')])){throw _0x3f9bf8[_0xbb10('0x1e')](0x1f4)[_0xbb10('0xc6')](new db[(_0xbb10('0x83'))][(_0xbb10('0x84'))](_0xbb10('0xca')+_0x143566));}_0x18e9d1[_0x93ebc['body']['mapKeyOffline']]=_0x93ebc[_0xbb10('0x50')][_0xbb10('0x8b')];})[_0xbb10('0x13')](function(){return db[_0xbb10('0x31')][_0xbb10('0x4e')]({'where':{'id':_0x93ebc[_0xbb10('0x4a')]['id']},'include':[{'model':db[_0xbb10('0x91')],'as':_0xbb10('0x92')},{'model':db[_0xbb10('0xcb')],'as':'MailAccount'}]});})[_0xbb10('0x13')](handleEntityNotFound(_0x3f9bf8,null))[_0xbb10('0x13')](function(_0x4f3536){if(_0x4f3536&&_0x4f3536['List']){_0x2b8a95=_0x4f3536;var _0x5b8377=_[_0xbb10('0xc')](_0x93ebc[_0xbb10('0x50')],{'firstName':_0x93ebc[_0xbb10('0x50')][_0xbb10('0x8b')],'phone':_0x93ebc[_0xbb10('0x50')][_0xbb10('0x8b')],'ListId':_0x4f3536[_0xbb10('0x8a')]});_0x5b8377[_0x93ebc['body']['mapKeyOffline']]=_0x93ebc[_0xbb10('0x50')][_0xbb10('0x8b')];return db[_0xbb10('0x82')][_0xbb10('0xcc')]({'where':_0x18e9d1,'defaults':_0x5b8377});}})[_0xbb10('0xb3')](function(_0x3649d5){if(_0x3649d5){_0x1ea0c0=_0x3649d5;var _0x4060d9=fs[_0xbb10('0xcd')](path[_0xbb10('0x6d')](config[_0xbb10('0x6e')],_0xbb10('0xce')),_0xbb10('0xcf'));var _0x5590d9=ejs[_0xbb10('0xd0')](_0x4060d9,{'body':_[_0xbb10('0xd1')](_0x93ebc[_0xbb10('0x50')]['body']),'bodyTitle':_0x2b8a95[_0xbb10('0xd2')]});return db['ChatOfflineMessage'][_0xbb10('0x4f')]({'body':_0x5590d9,'plainBody':htmlToText[_0xbb10('0xd3')](_0x5590d9),'ContactId':_0x3649d5['id'],'ChatWebsiteId':_0x2b8a95['id']});}})[_0xbb10('0x13')](function(_0x1d5224){_0x1810e9=_0x1d5224;if(_0x450625[_0xbb10('0x4c')]){var _0x38f6a1=_0x450625['map'](function(_0x225850){return{'name':_0x225850['originalname'],'basename':_0x225850['filename'],'type':_0x225850['mimetype'],'ChatOfflineMessageId':_0x1d5224['id']};});_0xa12882=_0x38f6a1[_0xbb10('0x30')](_0x18000e=>{var _0x3ec5e1={'filename':_0x18000e['name'],'path':path[_0xbb10('0x6d')](config[_0xbb10('0x6e')],_0xbb10('0xd4'),_0xbb10('0xc5'),'attachments','offline-chat',_0x18000e['basename'])};return _0x3ec5e1;});if(!_0x2b8a95[_0xbb10('0xd5')]){return db[_0xbb10('0xd6')][_0xbb10('0xd7')](function(_0x560ea0){return db[_0xbb10('0xd8')][_0xbb10('0xd9')](_0x38f6a1,{'transaction':_0x560ea0});});}}})[_0xbb10('0x13')](function(){if(_0x1810e9){_0x26cf88=_0x1810e9;return db[_0xbb10('0xcb')][_0xbb10('0x5c')]({'where':{'service':!![]},'include':[{'model':db[_0xbb10('0xda')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xbb10('0xdb'),'raw':!![]}]}]});}})['then'](function(_0x4952f0){if(_0x4952f0&&_0x4952f0[_0xbb10('0xdc')]&&_0x2b8a95[_0xbb10('0xdd')]&&_0x2b8a95[_0xbb10('0xde')]){var _0x1aa881=_0x4952f0[_0xbb10('0xdf')]();return respondWithRpcPromise(_0xbb10('0xe0'),_0xbb10('0xe1'),{'account':_0x1aa881,'message':{'from':util[_0xbb10('0xac')]('\x22%s\x22\x20<%s>',_0x4952f0[_0xbb10('0x2d')],_0x4952f0[_0xbb10('0xe2')]||_0x4952f0[_0xbb10('0xdc')][_0xbb10('0x51')]),'to':_0x2b8a95[_0xbb10('0xde')],'subject':_0x2b8a95[_0xbb10('0xe3')],'html':_0x26cf88[_0xbb10('0x50')],'attachments':_0xa12882}},client9003)['then'](function(){return _0x26cf88;})[_0xbb10('0x48')](function(_0x55ca2a){logger[_0xbb10('0x1a')](_0x55ca2a);});}})['then'](function(){if(_0x2b8a95&&_0x2b8a95[_0xbb10('0xd5')]&&_0x2b8a95[_0xbb10('0xe4')]){var _0x507774=[];if(_0x450625[_0xbb10('0x4c')]){_0x507774=_0x450625[_0xbb10('0x30')](function(_0x2b57b2){return{'name':_0x2b57b2['originalname'],'basename':_0x2b57b2[_0xbb10('0x66')],'type':_0x2b57b2[_0xbb10('0xe5')],'ChatOfflineMessageId':_0x1810e9['id']};});}var _0x14100f;if(!_[_0xbb10('0x73')](_0x2b8a95[_0xbb10('0xe6')])){var _0x38f436=_[_0xbb10('0x30')](_0x93ebc['body'],function(_0x218a8a){return _0x218a8a;});var _0x54a40e=_[_0xbb10('0xe7')](_0x38f436)[0x0];var _0x19ed16=_[_0xbb10('0xe8')](_0x54a40e,function(_0x5d1624){return _0x5d1624;});_0x14100f=_0x19ed16[0x1][_0x2b8a95[_0xbb10('0xe6')]];}var _0x1b28c9={'from':_0x1ea0c0['email'],'firstName':_0x1ea0c0[_0xbb10('0xa4')],'lastName':_0x1ea0c0['lastName'],'mapKey':_0xbb10('0xe2'),'message':{'from':_0x1ea0c0[_0xbb10('0xe2')],'to':_0x2b8a95[_0xbb10('0xcb')][_0xbb10('0xe2')],'cc':'','subject':_[_0xbb10('0x73')](_0x14100f)?_0x2b8a95[_0xbb10('0xe3')]:_0x14100f,'messageId':'','sentAt':new Date(),'attach':_0x507774['length'],'attachments':_0x507774,'originChannel':_0xbb10('0xe9'),'ChatWebsiteId':_0x2b8a95['id'],'ChatOfflineMessageId':_0x26cf88['id'],'originTo':_0x2b8a95['MailAccount'][_0xbb10('0xe2')]},'body':_0x26cf88[_0xbb10('0x50')]};var _0x3faf29={'account':{'id':_0x2b8a95['MailAccountId']},'body':_0x1b28c9,'log':_0xbb10('0xea')};return respondWithRpcPromise(_0xbb10('0xea'),_0xbb10('0xeb'),_0x3faf29,client9001)[_0xbb10('0x13')](function(){return _0x26cf88;})[_0xbb10('0x48')](function(_0x47b1b){logger[_0xbb10('0x1a')](_0x47b1b);});}return;})['then'](function(){if(_0x26cf88){return _0x26cf88;}})[_0xbb10('0x13')](respondWithResult(_0x3f9bf8,null))[_0xbb10('0x48')](function(_0x471134){logger['error'](_0xbb10('0x48'),_0x471134);for(var _0x20bd66 of _0x450625){var _0x8e30c4=path[_0xbb10('0x6d')](config[_0xbb10('0x6e')],_0xbb10('0xd4'),_0xbb10('0xc5'),_0xbb10('0xec'),'offline-chat',_0x20bd66['filename']);fs_extra[_0xbb10('0xed')](_0x8e30c4)[_0xbb10('0x48')](function(_0x141399){logger[_0xbb10('0x1a')](_0xbb10('0xee'),_0x8e30c4,_0x141399);});}});};exports[_0xbb10('0xef')]=function(_0x5debe5,_0xa57f04){return db['ChatInteraction'][_0xbb10('0x4e')]({'where':{'id':_0x5debe5[_0xbb10('0x4a')]['id']}})[_0xbb10('0x13')](handleEntityNotFound(_0xa57f04,null))['then'](function(_0x390fff){if(_0x390fff){return _0x390fff[_0xbb10('0xef')](_0x5debe5['body'][_0xbb10('0xf0')],_['omit'](_0x5debe5['body'],[_0xbb10('0xf0'),'id'])||{});}})[_0xbb10('0x13')](respondWithResult(_0xa57f04,null))[_0xbb10('0x48')](handleError(_0xa57f04,null));};exports[_0xbb10('0xf1')]=function(_0xa355a8,_0x4f712d){var _0x444818={'raw':![],'where':{}};var _0x2a19f1={};var _0x5a9904={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xbb10('0x5c')]({'where':{'id':_0xa355a8[_0xbb10('0x4a')]['id']}})[_0xbb10('0x13')](handleEntityNotFound(_0x4f712d,null))[_0xbb10('0x13')](function(_0x302d36){if(_0x302d36){_0x2a19f1[_0xbb10('0x36')]=_['keys'](db[_0xbb10('0xb0')][_0xbb10('0x32')]);_0x2a19f1['query']=_['keys'](_0xa355a8[_0xbb10('0x38')]);_0x2a19f1['filters']=_['intersection'](_0x2a19f1[_0xbb10('0x36')],_0x2a19f1[_0xbb10('0x38')]);_0x444818[_0xbb10('0x3b')]=_['intersection'](_0x2a19f1[_0xbb10('0x36')],qs['fields'](_0xa355a8[_0xbb10('0x38')][_0xbb10('0x3a')]));_0x444818[_0xbb10('0x3b')]=_0x444818['attributes'][_0xbb10('0x4c')]?_0x444818[_0xbb10('0x3b')]:_0x2a19f1[_0xbb10('0x36')];if(!_0xa355a8[_0xbb10('0x38')][_0xbb10('0x3c')](_0xbb10('0x3d'))){_0x444818['limit']=qs[_0xbb10('0x21')](_0xa355a8[_0xbb10('0x38')][_0xbb10('0x21')]);_0x444818[_0xbb10('0x23')]=qs[_0xbb10('0x23')](_0xa355a8[_0xbb10('0x38')][_0xbb10('0x23')]);}_0x444818[_0xbb10('0x3e')]=qs[_0xbb10('0x3f')](_0xa355a8[_0xbb10('0x38')]['sort']);_0x444818[_0xbb10('0x40')]=qs['filters'](_['pick'](_0xa355a8[_0xbb10('0x38')],_0x2a19f1[_0xbb10('0x42')]));_0x444818[_0xbb10('0x40')][_0xbb10('0x5a')]=_0x302d36['id'];if(_0xa355a8[_0xbb10('0x38')][_0xbb10('0x43')]){_0x444818[_0xbb10('0x40')]=_['merge'](_0x444818[_0xbb10('0x40')],{'$or':_[_0xbb10('0x30')](_0x444818[_0xbb10('0x3b')],function(_0x29a5c1){var _0x1f75d9={};_0x1f75d9[_0x29a5c1]={'$like':'%'+_0xa355a8[_0xbb10('0x38')][_0xbb10('0x43')]+'%'};return _0x1f75d9;})});}_0x444818=_[_0xbb10('0x44')]({},_0x444818,_0xa355a8['options']);return db['ChatInteraction'][_0xbb10('0x24')]({'where':_0x444818[_0xbb10('0x40')]})[_0xbb10('0x13')](function(_0x5f58a9){_0x5a9904['count']=_0x5f58a9;if(_0xa355a8[_0xbb10('0x38')]['includeAll']){_0x444818[_0xbb10('0x4d')]=[{'model':db[_0xbb10('0x82')],'as':_0xbb10('0xf2'),'required':![]},{'model':db[_0xbb10('0xbc')],'as':'Owner','attributes':[_0xbb10('0x2d'),_0xbb10('0xf3'),_0xbb10('0xf4')],'required':![]},{'model':db[_0xbb10('0xf5')],'as':_0xbb10('0xf6'),'attributes':['id','name',_0xbb10('0xf7')],'where':_0xa355a8[_0xbb10('0x38')][_0xbb10('0xf8')]?{'id':_0xa355a8[_0xbb10('0x38')][_0xbb10('0xf8')]}:undefined,'required':_0xa355a8['query'][_0xbb10('0xf8')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x444818);})[_0xbb10('0x13')](function(_0x8da0cb){_0x5a9904[_0xbb10('0x5d')]=_0x8da0cb;return _0x5a9904;});}})[_0xbb10('0x13')](respondWithFilteredResult(_0x4f712d,_0x444818))['catch'](handleError(_0x4f712d,null));};function iftimePromise(_0x302241,_0x123917){return respondWithRpcPromise(_0xbb10('0xf9'),'getSnippet',{'command':_0x123917['timezone']?util[_0xbb10('0xac')](_0xbb10('0xfa'),_0x302241['interval'],_0x123917[_0xbb10('0xfb')]):util[_0xbb10('0xac')](_0xbb10('0xfc'),_0x302241['interval'])},client9002)[_0xbb10('0x13')](function(_0x2421f1){var _0x293753=_0x2421f1&&_0x2421f1[_0xbb10('0xfd')](_0xbb10('0xfe'))>=0x0?!![]:![];logger[_0xbb10('0x14')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x123917['id'],_0x302241['id'],_0x302241[_0xbb10('0xff')],_0x293753?_0xbb10('0x100'):_0xbb10('0x101'),_0x123917[_0xbb10('0xfb')]?_0x123917[_0xbb10('0xfb')]:_0xbb10('0x102'));return _0x293753;})[_0xbb10('0x48')](function(_0x487603){logger[_0xbb10('0x1a')](_0xbb10('0x103'),_0x123917['id'],_0x302241['id'],_0x302241[_0xbb10('0xff')],util[_0xbb10('0x104')](_0x487603,{'showHidden':![],'depth':null}),_0x123917[_0xbb10('0xfb')]?_0x123917['timezone']:'No\x20timezone');return![];});}exports[_0xbb10('0x105')]=function(_0x36c964,_0x344015){var _0x322f28=0x0;var _0x2656c3=0x0;var _0x33ea36=![];var _0x168634;var _0x3e7421;return db['ChatWebsite'][_0xbb10('0x4e')]({'where':{'id':_0x36c964[_0xbb10('0x4a')]['id']},'include':[{'model':db['Interval'],'as':_0xbb10('0x106'),'include':[{'model':db[_0xbb10('0x106')],'as':'Intervals','attributes':['id',_0xbb10('0xff')],'raw':!![]}]}]})[_0xbb10('0x13')](handleEntityNotFound(_0x344015,null))[_0xbb10('0x13')](function(_0x516742){if(_0x516742){_0x168634=_0x516742;return _0x516742[_0xbb10('0x107')]({'raw':!![]});}})[_0xbb10('0x13')](function(_0xabbd6e){if(_0x168634){if(_0xabbd6e){_0x3e7421=_0xabbd6e;}}return require(_0xbb10('0x70'))['getLicense']();})[_0xbb10('0x13')](function(_0x2f1649){if(_0x2f1649){_0x2656c3=_0x2f1649[_0xbb10('0x108')];_0x33ea36=_0x2f1649['custom'];}})[_0xbb10('0x13')](function(){return db[_0xbb10('0xb0')][_0xbb10('0x24')]({'where':{'closed':![]}});})['then'](function(_0x15747b){_0x322f28=_0x15747b;if(_0x2656c3&&_0x15747b>_0x2656c3){return db['License'][_0xbb10('0x5c')]({'where':{'id':0x1}})[_0xbb10('0x13')](function(_0x1d38f9){if(_0x1d38f9){_0x1d38f9[_0xbb10('0x109')](_0xbb10('0x10a'));}});}})['then'](function(){if(_0x168634[_0xbb10('0x106')]&&_0x168634[_0xbb10('0x106')]['Intervals']){var _0x5f34e9=[];for(var _0x46dfff=0x0;_0x46dfff<_0x168634[_0xbb10('0x106')][_0xbb10('0x10b')][_0xbb10('0x4c')];_0x46dfff++){var _0x5c5fe9=_0x168634['Interval']['Intervals'][_0x46dfff]['get']({'plain':!![]});_0x5f34e9[_0xbb10('0xb7')](iftimePromise(_0x5c5fe9,_0x168634));}return BPromise['all'](_0x5f34e9)[_0xbb10('0x13')](function(_0x585e30){return _[_0xbb10('0x10c')](_0x585e30);});}else{return!![];}})[_0xbb10('0x13')](function(_0x544c2b){var _0x34f1ea=fs[_0xbb10('0xcd')](path[_0xbb10('0x6d')](config[_0xbb10('0x6e')],_0xbb10('0x10d')),_0xbb10('0xcf'));var _0x2f1435=new url[(_0xbb10('0x10e'))](_0x168634[_0xbb10('0x10f')])[_0xbb10('0x110')];var _0x5e0d44=_0xbb10('0x111');var _0x1a5137=![];var _0x3d29aa={'chatVersion':_0x5e0d44,'chatWebsiteAddressOrigin':_0x2f1435,'remote':_0x168634[_0xbb10('0x112')],'query':querystring['stringify'](_[_0xbb10('0x44')](_0x168634['get']({'plain':!![]}),{'customerIp':_0x36c964[_0xbb10('0x9f')][_0xbb10('0xa2')]||_0x36c964[_0xbb10('0x9f')][_0xbb10('0x113')]||_0x36c964[_0xbb10('0x114')]['remoteAddress']||_0x36c964['ip'],'referer':_0x36c964[_0xbb10('0x9f')]['referer'],'openedInteractions':_0x322f28,'maxInteractions':_0x2656c3,'virtual':_0x33ea36[_0xbb10('0x108')],'online':_0x544c2b,'custom':_0x33ea36}))[_0xbb10('0x115')](/'/g,'\x5c\x27')};_0x344015['send'](ejs[_0xbb10('0xd0')](Mustache['render'](_0x34f1ea,_0x3d29aa),{'proactiveActions':_0x3e7421,'alignment':_0x168634[_0xbb10('0x116')],'verticalAlignment':_0x168634[_0xbb10('0x117')],'div_color':_0x168634[_0xbb10('0xf7')],'labelText':_0x168634[_0xbb10('0x118')],'text_color':_0x168634[_0xbb10('0x119')],'text_button_color':_0x168634['textButtonColor'],'button_color':_0x168634['color_button'],'background_color':_0x168634[_0xbb10('0x11a')],'hideWhenOffline':_0x168634[_0xbb10('0x11b')],'intervalId':_0x168634[_0xbb10('0x11c')],'isDevelopment':_0x1a5137,'chatVersion':_0x5e0d44}));})[_0xbb10('0x48')](handleError(_0x344015,null));};exports[_0xbb10('0x11d')]=function(_0x3e31cb,_0x5ac15f){var _0x332e96=_0x3e31cb[_0xbb10('0x4a')]['id'];var _0x16746b=_0x3e31cb[_0xbb10('0x50')];var _0x410d4c=0xc8;var _0x213f83=null;return db[_0xbb10('0xd6')][_0xbb10('0xd7')]({'isolationLevel':db[_0xbb10('0xd6')][_0xbb10('0x11e')][_0xbb10('0x11f')][_0xbb10('0x120')]},function(_0x2ff2a6){return db[_0xbb10('0x31')][_0xbb10('0x5c')]({'where':{'id':_0x332e96},'transaction':_0x2ff2a6})[_0xbb10('0x13')](function(_0x360280){if(_0x360280){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x332e96},'transaction':_0x2ff2a6})[_0xbb10('0x13')](function(){var _0xbff1a9=_[_0xbb10('0x30')](_0x16746b,function(_0x4c53b1){_0x4c53b1['ChatWebsiteId']=_0x332e96;return _0x4c53b1;});return db[_0xbb10('0x94')][_0xbb10('0xd9')](_0xbff1a9,{'transaction':_0x2ff2a6});});}else{_0x410d4c=0x194;_0x213f83=[];}});})['then'](function(){if(_0x410d4c!==0x194){return db[_0xbb10('0x94')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x332e96},'order':'priority'})['then'](function(_0x24cd0d){_0x213f83=_0x24cd0d;});}})[_0xbb10('0x48')](function(_0x33ea9b){_0x410d4c=0x1f4;logger[_0xbb10('0x1a')](_0x33ea9b['stack']);if(_0x33ea9b[_0xbb10('0x2d')]){delete _0x33ea9b['name'];}_0x213f83=_0x33ea9b;})[_0xbb10('0x121')](function(){if(_0x213f83===null){_0x5ac15f[_0xbb10('0x2b')](_0x410d4c);}else{if(_0x410d4c===0x1f4){_0x5ac15f[_0xbb10('0x1e')](_0x410d4c)[_0xbb10('0xc6')](_0x213f83);}else{_0x5ac15f['status'](_0x410d4c)[_0xbb10('0x20')](_0x213f83);}}});};exports[_0xbb10('0x122')]=function(_0x3eada4,_0x429763){var _0x5f07fb={};var _0x42a51b={};var _0x3f5e5a;var _0x4747b4;return db[_0xbb10('0x31')][_0xbb10('0x5c')]({'where':{'id':_0x3eada4[_0xbb10('0x4a')]['id']}})['then'](handleEntityNotFound(_0x429763,null))[_0xbb10('0x13')](function(_0x2a4f97){if(_0x2a4f97){_0x3f5e5a=_0x2a4f97;_0x42a51b[_0xbb10('0x36')]=_[_0xbb10('0x37')](db['ChatApplication'][_0xbb10('0x32')]);_0x42a51b['query']=_[_0xbb10('0x37')](_0x3eada4[_0xbb10('0x38')]);_0x42a51b[_0xbb10('0x42')]=_[_0xbb10('0x39')](_0x42a51b[_0xbb10('0x36')],_0x42a51b[_0xbb10('0x38')]);_0x5f07fb[_0xbb10('0x3b')]=_[_0xbb10('0x39')](_0x42a51b[_0xbb10('0x36')],qs[_0xbb10('0x3a')](_0x3eada4[_0xbb10('0x38')][_0xbb10('0x3a')]));_0x5f07fb[_0xbb10('0x3b')]=_0x5f07fb[_0xbb10('0x3b')][_0xbb10('0x4c')]?_0x5f07fb[_0xbb10('0x3b')]:_0x42a51b[_0xbb10('0x36')];_0x5f07fb['order']=qs[_0xbb10('0x3f')](_0x3eada4['query']['sort']);_0x5f07fb[_0xbb10('0x40')]=qs['filters'](_[_0xbb10('0x41')](_0x3eada4[_0xbb10('0x38')],_0x42a51b[_0xbb10('0x42')]));if(_0x3eada4['query']['filter']){_0x5f07fb[_0xbb10('0x40')]=_[_0xbb10('0x44')](_0x5f07fb[_0xbb10('0x40')],{'$or':_['map'](_0x5f07fb[_0xbb10('0x3b')],function(_0x2ba26c){var _0xc1ff67={};_0xc1ff67[_0x2ba26c]={'$like':'%'+_0x3eada4[_0xbb10('0x38')][_0xbb10('0x43')]+'%'};return _0xc1ff67;})});}_0x5f07fb=_['merge']({},_0x5f07fb,_0x3eada4[_0xbb10('0x46')]);return _0x3f5e5a[_0xbb10('0x122')](_0x5f07fb);}})[_0xbb10('0x13')](function(_0x2d0f27){if(_0x2d0f27){_0x4747b4=_0x2d0f27[_0xbb10('0x4c')];if(!_0x3eada4[_0xbb10('0x38')][_0xbb10('0x3c')](_0xbb10('0x3d'))){_0x5f07fb[_0xbb10('0x21')]=qs[_0xbb10('0x21')](_0x3eada4['query'][_0xbb10('0x21')]);_0x5f07fb['offset']=qs[_0xbb10('0x23')](_0x3eada4['query'][_0xbb10('0x23')]);}return _0x3f5e5a[_0xbb10('0x122')](_0x5f07fb);}})['then'](function(_0x25a091){if(_0x25a091){return _0x25a091?{'count':_0x4747b4,'rows':_0x25a091}:null;}})['then'](respondWithResult(_0x429763,null))[_0xbb10('0x48')](handleError(_0x429763,null));};exports[_0xbb10('0x123')]=function(_0xd0e41f,_0x4a043e){return db[_0xbb10('0x124')][_0xbb10('0x4e')]({'where':{'id':_0xd0e41f[_0xbb10('0x4a')]['id']}})[_0xbb10('0x13')](handleEntityNotFound(_0x4a043e,null))[_0xbb10('0x13')](function(_0x3bc103){if(_0x3bc103){return _0x3bc103['addProactiveActions'](_0xd0e41f[_0xbb10('0x50')][_0xbb10('0xf0')],_['omit'](_0xd0e41f[_0xbb10('0x50')],[_0xbb10('0xf0'),'id'])||{});}})[_0xbb10('0x13')](respondWithResult(_0x4a043e,null))[_0xbb10('0x48')](handleError(_0x4a043e,null));};exports[_0xbb10('0x107')]=function(_0x560362,_0x16c1e6){var _0x1dd4bb={};var _0x4d9123={};var _0x5a996b;var _0x3f7a8a;return db['ChatWebsite'][_0xbb10('0x5c')]({'where':{'id':_0x560362[_0xbb10('0x4a')]['id']}})[_0xbb10('0x13')](handleEntityNotFound(_0x16c1e6,null))['then'](function(_0x5dfd5a){if(_0x5dfd5a){_0x5a996b=_0x5dfd5a;_0x4d9123[_0xbb10('0x36')]=_[_0xbb10('0x37')](db[_0xbb10('0x125')][_0xbb10('0x32')]);_0x4d9123[_0xbb10('0x38')]=_['keys'](_0x560362[_0xbb10('0x38')]);_0x4d9123[_0xbb10('0x42')]=_[_0xbb10('0x39')](_0x4d9123['model'],_0x4d9123[_0xbb10('0x38')]);_0x1dd4bb[_0xbb10('0x3b')]=_['intersection'](_0x4d9123[_0xbb10('0x36')],qs[_0xbb10('0x3a')](_0x560362[_0xbb10('0x38')]['fields']));_0x1dd4bb[_0xbb10('0x3b')]=_0x1dd4bb[_0xbb10('0x3b')]['length']?_0x1dd4bb[_0xbb10('0x3b')]:_0x4d9123[_0xbb10('0x36')];_0x1dd4bb[_0xbb10('0x3e')]=qs[_0xbb10('0x3f')](_0x560362[_0xbb10('0x38')]['sort']);_0x1dd4bb['where']=qs[_0xbb10('0x42')](_['pick'](_0x560362[_0xbb10('0x38')],_0x4d9123['filters']));if(_0x560362['query'][_0xbb10('0x43')]){_0x1dd4bb[_0xbb10('0x40')]=_[_0xbb10('0x44')](_0x1dd4bb[_0xbb10('0x40')],{'$or':_['map'](_0x1dd4bb[_0xbb10('0x3b')],function(_0x1e708e){var _0x28bd81={};_0x28bd81[_0x1e708e]={'$like':'%'+_0x560362[_0xbb10('0x38')]['filter']+'%'};return _0x28bd81;})});}_0x1dd4bb=_[_0xbb10('0x44')]({},_0x1dd4bb,_0x560362[_0xbb10('0x46')]);return _0x5a996b[_0xbb10('0x107')](_0x1dd4bb);}})[_0xbb10('0x13')](function(_0x27ee46){if(_0x27ee46){_0x3f7a8a=_0x27ee46[_0xbb10('0x4c')];if(!_0x560362[_0xbb10('0x38')][_0xbb10('0x3c')](_0xbb10('0x3d'))){_0x1dd4bb[_0xbb10('0x21')]=qs[_0xbb10('0x21')](_0x560362[_0xbb10('0x38')][_0xbb10('0x21')]);_0x1dd4bb[_0xbb10('0x23')]=qs['offset'](_0x560362[_0xbb10('0x38')]['offset']);}return _0x5a996b[_0xbb10('0x107')](_0x1dd4bb);}})[_0xbb10('0x13')](function(_0x4e1d66){if(_0x4e1d66){return _0x4e1d66?{'count':_0x3f7a8a,'rows':_0x4e1d66}:null;}})[_0xbb10('0x13')](respondWithResult(_0x16c1e6,null))[_0xbb10('0x48')](handleError(_0x16c1e6,null));};exports[_0xbb10('0x126')]=function(_0x5815ad,_0x3fbce1){var _0x156ff5=_0x5815ad[_0xbb10('0x38')][_0xbb10('0x127')]===_0xbb10('0x128')?_0xbb10('0x129'):_0xbb10('0x12a');return db[_0xbb10('0x31')][_0xbb10('0x4e')]({'attributes':['id',_0x156ff5],'where':{'id':_0x5815ad[_0xbb10('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3fbce1,null))[_0xbb10('0x13')](function(_0x49aa2a){if(_0x49aa2a){var _0x410b05=_0x49aa2a[_0x156ff5];var _0x2f3dcd=_0x410b05&&_0x410b05[_0xbb10('0x12b')]?_0x410b05['items']:[];_0x3fbce1[_0xbb10('0xc6')]({'fromKey':_[_0xbb10('0x73')](_0x410b05[_0xbb10('0x12c')])?undefined:_0x410b05[_0xbb10('0x12c')],'count':_0x2f3dcd['length'],'rows':_0x2f3dcd});}})['catch'](handleError(_0x3fbce1,null));};exports['getOfflineMessages']=function(_0x18cb11,_0x2c7daa){var _0x576dbd={'raw':![],'where':{}};var _0x386586={};var _0x26fd90={'count':0x0,'rows':[]};return db[_0xbb10('0x31')][_0xbb10('0x5c')]({'where':{'id':_0x18cb11[_0xbb10('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2c7daa,null))[_0xbb10('0x13')](function(_0x550d95){if(_0x550d95){_0x386586[_0xbb10('0x36')]=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x386586['query']=_['keys'](_0x18cb11[_0xbb10('0x38')]);_0x386586[_0xbb10('0x42')]=_[_0xbb10('0x39')](_0x386586[_0xbb10('0x36')],_0x386586[_0xbb10('0x38')]);_0x576dbd[_0xbb10('0x3b')]=_[_0xbb10('0x39')](_0x386586[_0xbb10('0x36')],qs[_0xbb10('0x3a')](_0x18cb11[_0xbb10('0x38')][_0xbb10('0x3a')]));_0x576dbd[_0xbb10('0x3b')]=_0x576dbd[_0xbb10('0x3b')][_0xbb10('0x4c')]?_0x576dbd[_0xbb10('0x3b')]:_0x386586[_0xbb10('0x36')];if(!_0x18cb11[_0xbb10('0x38')][_0xbb10('0x3c')](_0xbb10('0x3d'))){_0x576dbd[_0xbb10('0x21')]=qs[_0xbb10('0x21')](_0x18cb11[_0xbb10('0x38')][_0xbb10('0x21')]);_0x576dbd[_0xbb10('0x23')]=qs[_0xbb10('0x23')](_0x18cb11['query'][_0xbb10('0x23')]);}_0x576dbd[_0xbb10('0x3e')]=qs['sort'](_0x18cb11[_0xbb10('0x38')][_0xbb10('0x3f')]);_0x576dbd['where']=qs[_0xbb10('0x42')](_[_0xbb10('0x41')](_0x18cb11[_0xbb10('0x38')],_0x386586[_0xbb10('0x42')]));_0x576dbd[_0xbb10('0x40')][_0xbb10('0x5a')]=_0x550d95['id'];if(_0x18cb11['query'][_0xbb10('0x43')]){_0x576dbd[_0xbb10('0x40')]=_['merge'](_0x576dbd[_0xbb10('0x40')],{'$or':_[_0xbb10('0x30')](_0x576dbd['attributes'],function(_0x232c5b){var _0x3a80d6={};_0x3a80d6[_0x232c5b]={'$like':'%'+_0x18cb11[_0xbb10('0x38')][_0xbb10('0x43')]+'%'};return _0x3a80d6;})});}_0x576dbd=_[_0xbb10('0x44')]({},_0x576dbd,_0x18cb11[_0xbb10('0x46')]);return db['ChatOfflineMessage'][_0xbb10('0x24')]({'where':_0x576dbd[_0xbb10('0x40')]})['then'](function(_0x5d1f9b){_0x26fd90[_0xbb10('0x24')]=_0x5d1f9b;if(_0x18cb11[_0xbb10('0x38')][_0xbb10('0x47')]){_0x576dbd[_0xbb10('0x4d')]=[{'all':!![]}];}else{_0x576dbd[_0xbb10('0x4d')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xbb10('0xd8')],'as':'Attachments','required':![]}];}return db[_0xbb10('0x12d')][_0xbb10('0x62')](_0x576dbd);})[_0xbb10('0x13')](function(_0x5cee7a){_0x26fd90['rows']=_0x5cee7a;return _0x26fd90;});}})[_0xbb10('0x13')](respondWithFilteredResult(_0x2c7daa,_0x576dbd))['catch'](handleError(_0x2c7daa,null));};exports['addAgents']=function(_0x506a01,_0x2f5be0){return db['ChatWebsite'][_0xbb10('0x4e')]({'where':{'id':_0x506a01['params']['id']}})['then'](handleEntityNotFound(_0x2f5be0,null))[_0xbb10('0x13')](function(_0x5a47de){if(_0x5a47de){return _0x5a47de[_0xbb10('0x12e')](_0x506a01[_0xbb10('0x50')][_0xbb10('0xf0')],_[_0xbb10('0x12f')](_0x506a01[_0xbb10('0x50')],[_0xbb10('0xf0'),'id'])||{})['spread'](function(_0x1bb951){for(var _0x139092=0x0;_0x139092<_0x506a01[_0xbb10('0x50')][_0xbb10('0xf0')]['length'];_0x139092+=0x1){socket[_0xbb10('0x130')](_0xbb10('0x131'),{'UserId':Number(_0x506a01[_0xbb10('0x50')]['ids'][_0x139092]),'ChatWebsiteId':Number(_0x506a01[_0xbb10('0x4a')]['id'])});}return _0x1bb951;});}})['then'](respondWithResult(_0x2f5be0,null))[_0xbb10('0x48')](handleError(_0x2f5be0,null));};exports['removeAgents']=function(_0x17d7ab,_0x21f522){return db[_0xbb10('0x31')]['find']({'where':{'id':_0x17d7ab[_0xbb10('0x4a')]['id']}})['then'](handleEntityNotFound(_0x21f522,null))['then'](function(_0x49e8e8){if(_0x49e8e8){return _0x49e8e8[_0xbb10('0x132')](_0x17d7ab['query'][_0xbb10('0xf0')])[_0xbb10('0x13')](function(){if(_['isArray'](_0x17d7ab[_0xbb10('0x38')][_0xbb10('0xf0')])){for(var _0x4b5bbb=0x0;_0x4b5bbb<_0x17d7ab[_0xbb10('0x38')]['ids'][_0xbb10('0x4c')];_0x4b5bbb+=0x1){socket[_0xbb10('0x130')](_0xbb10('0x133'),{'UserId':Number(_0x17d7ab[_0xbb10('0x38')][_0xbb10('0xf0')][_0x4b5bbb]),'ChatWebsiteId':Number(_0x17d7ab[_0xbb10('0x4a')]['id'])});}}else{socket[_0xbb10('0x130')](_0xbb10('0x133'),{'UserId':Number(_0x17d7ab[_0xbb10('0x38')][_0xbb10('0xf0')]),'ChatWebsiteId':Number(_0x17d7ab[_0xbb10('0x4a')]['id'])});}});}})[_0xbb10('0x13')](respondWithStatusCode(_0x21f522,null))['catch'](handleError(_0x21f522,null));};exports[_0xbb10('0x134')]=function(_0x3c0f20,_0x293de8){var _0x4b3380={};var _0x5b55a9={};var _0x13c015;var _0x18b961;return db['ChatWebsite'][_0xbb10('0x5c')]({'where':{'id':_0x3c0f20[_0xbb10('0x4a')]['id']}})[_0xbb10('0x13')](handleEntityNotFound(_0x293de8,null))['then'](function(_0x344f24){if(_0x344f24){_0x13c015=_0x344f24;_0x5b55a9[_0xbb10('0x36')]=_[_0xbb10('0x37')](db[_0xbb10('0xbc')][_0xbb10('0x32')]);_0x5b55a9[_0xbb10('0x38')]=_[_0xbb10('0x37')](_0x3c0f20[_0xbb10('0x38')]);_0x5b55a9[_0xbb10('0x42')]=_[_0xbb10('0x39')](_0x5b55a9['model'],_0x5b55a9[_0xbb10('0x38')]);_0x4b3380[_0xbb10('0x3b')]=_[_0xbb10('0x39')](_0x5b55a9[_0xbb10('0x36')],qs['fields'](_0x3c0f20['query'][_0xbb10('0x3a')]));_0x4b3380[_0xbb10('0x3b')]=_0x4b3380['attributes'][_0xbb10('0x4c')]?_0x4b3380[_0xbb10('0x3b')]:_0x5b55a9[_0xbb10('0x36')];_0x4b3380[_0xbb10('0x3e')]=qs['sort'](_0x3c0f20['query']['sort']);_0x4b3380['where']=qs['filters'](_[_0xbb10('0x41')](_0x3c0f20[_0xbb10('0x38')],_0x5b55a9[_0xbb10('0x42')]));if(_0x3c0f20[_0xbb10('0x38')][_0xbb10('0x43')]){_0x4b3380['where']=_[_0xbb10('0x44')](_0x4b3380['where'],{'$or':_[_0xbb10('0x30')](_0x4b3380[_0xbb10('0x3b')],function(_0x9f9c55){var _0x28020b={};_0x28020b[_0x9f9c55]={'$like':'%'+_0x3c0f20['query'][_0xbb10('0x43')]+'%'};return _0x28020b;})});}_0x4b3380=_[_0xbb10('0x44')]({},_0x4b3380,_0x3c0f20[_0xbb10('0x46')]);return _0x13c015['getAgents'](_0x4b3380);}})[_0xbb10('0x13')](function(_0x3afc72){if(_0x3afc72){_0x18b961=_0x3afc72[_0xbb10('0x4c')];if(!_0x3c0f20['query'][_0xbb10('0x3c')](_0xbb10('0x3d'))){_0x4b3380[_0xbb10('0x21')]=qs[_0xbb10('0x21')](_0x3c0f20[_0xbb10('0x38')]['limit']);_0x4b3380[_0xbb10('0x23')]=qs['offset'](_0x3c0f20[_0xbb10('0x38')][_0xbb10('0x23')]);}return _0x13c015['getAgents'](_0x4b3380);}})[_0xbb10('0x13')](function(_0x30db4a){if(_0x30db4a){return _0x30db4a?{'count':_0x18b961,'rows':_0x30db4a}:null;}})[_0xbb10('0x13')](respondWithResult(_0x293de8,null))['catch'](handleError(_0x293de8,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 0f30b37..03ec793 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 _0xdefc=['exports','events','../../mysqldb','ChatWebsite','update','emit','hasOwnProperty'];(function(_0x28b440,_0x1b2b23){var _0x271fdd=function(_0x1cdbaf){while(--_0x1cdbaf){_0x28b440['push'](_0x28b440['shift']());}};_0x271fdd(++_0x1b2b23);}(_0xdefc,0x1b3));var _0xcdef=function(_0x2b3a98,_0x3796c6){_0x2b3a98=_0x2b3a98-0x0;var _0xdf53c0=_0xdefc[_0x2b3a98];return _0xdf53c0;};'use strict';var EventEmitter=require(_0xcdef('0x0'));var ChatWebsite=require(_0xcdef('0x1'))['db'][_0xcdef('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xcdef('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3b18d6){return function(_0x2418f0,_0xfc14aa,_0x4602bf){ChatWebsiteEvents[_0xcdef('0x4')](_0x3b18d6+':'+_0x2418f0['id'],_0x2418f0);ChatWebsiteEvents[_0xcdef('0x4')](_0x3b18d6,_0x2418f0);_0x4602bf(null);};}for(var e in events){if(events[_0xcdef('0x5')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xcdef('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0xcf1c=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x2cd288,_0x239ae4){var _0x3434dc=function(_0xfdec59){while(--_0xfdec59){_0x2cd288['push'](_0x2cd288['shift']());}};_0x3434dc(++_0x239ae4);}(_0xcf1c,0x18d));var _0xccf1=function(_0x1c2051,_0x4cb6b9){_0x1c2051=_0x1c2051-0x0;var _0x2b58a0=_0xcf1c[_0x1c2051];return _0x2b58a0;};'use strict';var EventEmitter=require(_0xccf1('0x0'));var ChatWebsite=require(_0xccf1('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xccf1('0x2')](0x0);var events={'afterCreate':_0xccf1('0x3'),'afterUpdate':_0xccf1('0x4'),'afterDestroy':_0xccf1('0x5')};function emitEvent(_0x5670d0){return function(_0x5d3e85,_0x509c8d,_0x301b38){ChatWebsiteEvents['emit'](_0x5670d0+':'+_0x5d3e85['id'],_0x5d3e85);ChatWebsiteEvents[_0xccf1('0x6')](_0x5670d0,_0x5d3e85);_0x301b38(null);};}for(var e in events){if(events[_0xccf1('0x7')](e)){var event=events[e];ChatWebsite[_0xccf1('0x8')](e,emitEvent(event));}}module[_0xccf1('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 252a519..3c6d709 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 _0x6fac=['./chatWebsite.attributes','define','ChatWebsite','chat_websites','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4009ae,_0x24e376){var _0x31275a=function(_0x59baf7){while(--_0x59baf7){_0x4009ae['push'](_0x4009ae['shift']());}};_0x31275a(++_0x24e376);}(_0x6fac,0x70));var _0xc6fa=function(_0x5eac86,_0x4562db){_0x5eac86=_0x5eac86-0x0;var _0x3430e4=_0x6fac[_0x5eac86];return _0x3430e4;};'use strict';var _=require(_0xc6fa('0x0'));var util=require(_0xc6fa('0x1'));var logger=require('../../config/logger')(_0xc6fa('0x2'));var moment=require(_0xc6fa('0x3'));var BPromise=require(_0xc6fa('0x4'));var rp=require(_0xc6fa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc6fa('0x6'));var config=require(_0xc6fa('0x7'));var attributes=require(_0xc6fa('0x8'));module['exports']=function(_0x2f73b8,_0x40b0f8){return _0x2f73b8[_0xc6fa('0x9')](_0xc6fa('0xa'),attributes,{'tableName':_0xc6fa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf68a=['rimraf','../../config/environment','exports','ChatWebsite','chat_websites','lodash','util','bluebird','request-promise','path'];(function(_0x4d830b,_0x27f78d){var _0x238c89=function(_0x3eead9){while(--_0x3eead9){_0x4d830b['push'](_0x4d830b['shift']());}};_0x238c89(++_0x27f78d);}(_0xf68a,0xeb));var _0xaf68=function(_0x582a09,_0x2d751d){_0x582a09=_0x582a09-0x0;var _0x54b6da=_0xf68a[_0x582a09];return _0x54b6da;};'use strict';var _=require(_0xaf68('0x0'));var util=require(_0xaf68('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xaf68('0x2'));var rp=require(_0xaf68('0x3'));var fs=require('fs');var path=require(_0xaf68('0x4'));var rimraf=require(_0xaf68('0x5'));var config=require(_0xaf68('0x6'));var attributes=require('./chatWebsite.attributes');module[_0xaf68('0x7')]=function(_0x449506,_0x2c20b3){return _0x449506['define'](_0xaf68('0x8'),attributes,{'tableName':_0xaf68('0x9'),'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 b252fe4..229a71c 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 _0x5d5f=['debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','catch','lodash','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','socket.io-emitter','./chatWebsite.socket','request','then','request\x20sent'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5d5f,0x1a6));var _0xf5d5=function(_0x4a4ba7,_0x1d2a01){_0x4a4ba7=_0x4a4ba7-0x0;var _0x113936=_0x5d5f[_0x4a4ba7];return _0x113936;};'use strict';var _=require(_0xf5d5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf5d5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf5d5('0x2'));var logger=require(_0xf5d5('0x3'))(_0xf5d5('0x4'));var config=require(_0xf5d5('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf5d5('0x6')][_0xf5d5('0x7')]({'port':0x232a});config['redis']=_[_0xf5d5('0x8')](config[_0xf5d5('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xf5d5('0xa'))(new Redis(config['redis']));require(_0xf5d5('0xb'))['register'](socket);function respondWithRpcPromise(_0x6fc091,_0x1011e1,_0xc5c3e9){return new BPromise(function(_0x359465,_0x235f4b){return client[_0xf5d5('0xc')](_0x6fc091,_0xc5c3e9)[_0xf5d5('0xd')](function(_0x5ef771){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x1011e1,_0xf5d5('0xe'));logger[_0xf5d5('0xf')](_0xf5d5('0x10'),_0x1011e1,_0xf5d5('0xe'),JSON[_0xf5d5('0x11')](_0x5ef771));if(_0x5ef771[_0xf5d5('0x12')]){if(_0x5ef771[_0xf5d5('0x12')][_0xf5d5('0x13')]===0x1f4){logger[_0xf5d5('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x1011e1,_0x5ef771[_0xf5d5('0x12')][_0xf5d5('0x14')]);return _0x235f4b(_0x5ef771[_0xf5d5('0x12')][_0xf5d5('0x14')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x1011e1,_0x5ef771[_0xf5d5('0x12')][_0xf5d5('0x14')]);return _0x359465(_0x5ef771[_0xf5d5('0x12')][_0xf5d5('0x14')]);}else{logger['info'](_0xf5d5('0x15'),_0x1011e1,_0xf5d5('0xe'));_0x359465(_0x5ef771['result'][_0xf5d5('0x14')]);}})[_0xf5d5('0x16')](function(_0x5d9868){logger[_0xf5d5('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x1011e1,_0x5d9868);_0x235f4b(_0x5d9868);});});} \ No newline at end of file +var _0x794a=['debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatWebsite.socket','register','request','ChatWebsite,\x20%s,\x20%s','request\x20sent'];(function(_0x15a634,_0x4feb86){var _0xf4f7a0=function(_0x31d9fe){while(--_0x31d9fe){_0x15a634['push'](_0x15a634['shift']());}};_0xf4f7a0(++_0x4feb86);}(_0x794a,0x13d));var _0xa794=function(_0x56d257,_0x36750a){_0x56d257=_0x56d257-0x0;var _0x27d1f8=_0x794a[_0x56d257];return _0x27d1f8;};'use strict';var _=require(_0xa794('0x0'));var util=require(_0xa794('0x1'));var moment=require(_0xa794('0x2'));var BPromise=require(_0xa794('0x3'));var rs=require(_0xa794('0x4'));var fs=require('fs');var Redis=require(_0xa794('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa794('0x6'));var logger=require(_0xa794('0x7'))('rpc');var config=require(_0xa794('0x8'));var jayson=require(_0xa794('0x9'));var client=jayson[_0xa794('0xa')][_0xa794('0xb')]({'port':0x232a});config[_0xa794('0xc')]=_['defaults'](config[_0xa794('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xa794('0xd'))(new Redis(config[_0xa794('0xc')]));require(_0xa794('0xe'))[_0xa794('0xf')](socket);function respondWithRpcPromise(_0x2ef293,_0x282874,_0x52a3fd){return new BPromise(function(_0x5d5529,_0x2e4aa0){return client[_0xa794('0x10')](_0x2ef293,_0x52a3fd)['then'](function(_0xa93d98){logger['info'](_0xa794('0x11'),_0x282874,_0xa794('0x12'));logger[_0xa794('0x13')](_0xa794('0x14'),_0x282874,_0xa794('0x12'),JSON[_0xa794('0x15')](_0xa93d98));if(_0xa93d98[_0xa794('0x16')]){if(_0xa93d98[_0xa794('0x16')][_0xa794('0x17')]===0x1f4){logger[_0xa794('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x282874,_0xa93d98[_0xa794('0x16')][_0xa794('0x18')]);return _0x2e4aa0(_0xa93d98[_0xa794('0x16')][_0xa794('0x18')]);}logger[_0xa794('0x16')](_0xa794('0x11'),_0x282874,_0xa93d98[_0xa794('0x16')][_0xa794('0x18')]);return _0x5d5529(_0xa93d98[_0xa794('0x16')][_0xa794('0x18')]);}else{logger[_0xa794('0x19')](_0xa794('0x11'),_0x282874,_0xa794('0x12'));_0x5d5529(_0xa93d98[_0xa794('0x1a')][_0xa794('0x18')]);}})[_0xa794('0x1b')](function(_0x583cc0){logger[_0xa794('0x16')](_0xa794('0x11'),_0x282874,_0x583cc0);_0x2e4aa0(_0x583cc0);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index d0c7dd6..9593745 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 _0xea74=['chatWebsite:','emit','removeListener','length'];(function(_0x21c89c,_0x4e0713){var _0x19202a=function(_0x17aeb0){while(--_0x17aeb0){_0x21c89c['push'](_0x21c89c['shift']());}};_0x19202a(++_0x4e0713);}(_0xea74,0xb1));var _0x4ea7=function(_0x1b232b,_0xe42cc1){_0x1b232b=_0x1b232b-0x0;var _0x4ca805=_0xea74[_0x1b232b];return _0x4ca805;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=['save','remove','update'];function createListener(_0x1b6b7d,_0x39ad42){return function(_0x1ad6eb){_0x39ad42[_0x4ea7('0x0')](_0x1b6b7d,_0x1ad6eb);};}function removeListener(_0x54cd1e,_0x303fad){return function(){ChatWebsiteEvents[_0x4ea7('0x1')](_0x54cd1e,_0x303fad);};}exports['register']=function(_0x449eec){for(var _0x1c7df9=0x0,_0x8a3e09=events[_0x4ea7('0x2')];_0x1c7df9<_0x8a3e09;_0x1c7df9++){var _0x214560=events[_0x1c7df9];var _0x218a5d=createListener(_0x4ea7('0x3')+_0x214560,_0x449eec);ChatWebsiteEvents['on'](_0x214560,_0x218a5d);}}; \ No newline at end of file +var _0xdd28=['register','./chatWebsite.events','remove','emit','removeListener'];(function(_0x46f4f5,_0x10b90a){var _0x340d66=function(_0xb21ccc){while(--_0xb21ccc){_0x46f4f5['push'](_0x46f4f5['shift']());}};_0x340d66(++_0x10b90a);}(_0xdd28,0x155));var _0x8dd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd28[_0x3dd15e];return _0x231fd0;};'use strict';var ChatWebsiteEvents=require(_0x8dd2('0x0'));var events=['save',_0x8dd2('0x1'),'update'];function createListener(_0x19c342,_0xc31560){return function(_0x1bddac){_0xc31560[_0x8dd2('0x2')](_0x19c342,_0x1bddac);};}function removeListener(_0x36abf7,_0x3b7301){return function(){ChatWebsiteEvents[_0x8dd2('0x3')](_0x36abf7,_0x3b7301);};}exports[_0x8dd2('0x4')]=function(_0xdea42e){for(var _0x2d5529=0x0,_0x2e91f6=events['length'];_0x2d5529<_0x2e91f6;_0x2d5529++){var _0x20a1b2=events[_0x2d5529];var _0x179dcf=createListener('chatWebsite:'+_0x20a1b2,_0xdea42e);ChatWebsiteEvents['on'](_0x20a1b2,_0x179dcf);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 8353a6f..74762b7 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 _0x2118=['/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','/:id/fields','getFields','getOfflineMessages','/:id/users','create','post','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','server/files/images/avatars/','/:id/avatar','file','addAvatar','addCustomerAvatar','/:id/notify','notify','server/files','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/logo','getLogo','getAvatar','/:id/customer_avatar'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x2118,0x14e));var _0x8211=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x2118[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0x8211('0x0'));var util=require('util');var path=require(_0x8211('0x1'));var timeout=require(_0x8211('0x2'));var express=require(_0x8211('0x3'));var router=express['Router']();var fs_extra=require(_0x8211('0x4'));var auth=require(_0x8211('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8211('0x6'));var controller=require(_0x8211('0x7'));router[_0x8211('0x8')]('/',auth['isAuthenticated'](),controller[_0x8211('0x9')]);router[_0x8211('0x8')](_0x8211('0xa'),auth[_0x8211('0xb')](),controller[_0x8211('0xc')]);router[_0x8211('0x8')](_0x8211('0xd'),auth['isAuthenticated'](),controller[_0x8211('0xe')]);router[_0x8211('0x8')](_0x8211('0xf'),auth['isAuthenticated'](),controller[_0x8211('0x10')]);router[_0x8211('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0x8211('0x8')](_0x8211('0x11'),controller[_0x8211('0x12')]);router[_0x8211('0x8')]('/:id/avatar',controller[_0x8211('0x13')]);router[_0x8211('0x8')](_0x8211('0x14'),controller['getCustomerAvatar']);router[_0x8211('0x8')](_0x8211('0x15'),controller[_0x8211('0x16')]);router[_0x8211('0x8')]('/:id/interactions',auth[_0x8211('0xb')](),controller[_0x8211('0x17')]);router[_0x8211('0x8')](_0x8211('0x18'),controller[_0x8211('0x19')]);router[_0x8211('0x8')](_0x8211('0x1a'),auth['isAuthenticated'](),controller['getApplications']);router[_0x8211('0x8')](_0x8211('0x1b'),auth['isAuthenticated'](),controller['getProactiveActions']);router['get'](_0x8211('0x1c'),controller[_0x8211('0x1d')]);router[_0x8211('0x8')]('/:id/offline_messages',auth[_0x8211('0xb')](),controller[_0x8211('0x1e')]);router[_0x8211('0x8')](_0x8211('0x1f'),auth[_0x8211('0xb')](),controller['getAgents']);router['post']('/',auth[_0x8211('0xb')](),controller[_0x8211('0x20')]);router[_0x8211('0x21')](_0x8211('0xf'),auth[_0x8211('0xb')](),controller[_0x8211('0x22')]);router[_0x8211('0x21')]('/:id/canned_answers',auth[_0x8211('0xb')](),controller[_0x8211('0x23')]);var upload=multer({'storage':multer[_0x8211('0x24')]({'destination':function(_0x400a92,_0x54ad15,_0x3095c6){_0x3095c6(null,path[_0x8211('0x25')](config[_0x8211('0x26')],_0x8211('0x27')));},'filename':function(_0xf18273,_0x135bfe,_0x37f9f0){_0x37f9f0(null,util[_0x8211('0x28')](_0x8211('0x29'),Date[_0x8211('0x2a')](),_0x135bfe[_0x8211('0x2b')]));}})});router[_0x8211('0x21')](_0x8211('0x11'),upload[_0x8211('0x2c')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x8211('0x24')]({'destination':function(_0x4ba7a7,_0x2534ba,_0x4cf0a7){_0x4cf0a7(null,path[_0x8211('0x25')](config[_0x8211('0x26')],_0x8211('0x2d')));},'filename':function(_0x4277d9,_0x10ee2b,_0x4c3a9d){_0x4c3a9d(null,util[_0x8211('0x28')](_0x8211('0x29'),Date[_0x8211('0x2a')](),_0x10ee2b[_0x8211('0x2b')]));}})});router[_0x8211('0x21')](_0x8211('0x2e'),upload['single'](_0x8211('0x2f')),controller[_0x8211('0x30')]);var upload=multer({'storage':multer[_0x8211('0x24')]({'destination':function(_0x86eeca,_0x527948,_0x1077a1){_0x1077a1(null,path[_0x8211('0x25')](config[_0x8211('0x26')],_0x8211('0x2d')));},'filename':function(_0x5927df,_0x4712a7,_0x4814ce){_0x4814ce(null,util['format']('%s-%s',Date[_0x8211('0x2a')](),_0x4712a7[_0x8211('0x2b')]));}})});router[_0x8211('0x21')]('/:id/customer_avatar',upload[_0x8211('0x2c')](_0x8211('0x2f')),controller[_0x8211('0x31')]);var upload=multer({'storage':multer[_0x8211('0x24')]({'destination':function(_0x25355d,_0x77251e,_0x15c784){_0x15c784(null,path['join'](config[_0x8211('0x26')],_0x8211('0x2d')));},'filename':function(_0x1997ec,_0x2d6cef,_0x281111){_0x281111(null,util[_0x8211('0x28')](_0x8211('0x29'),Date[_0x8211('0x2a')](),_0x2d6cef[_0x8211('0x2b')]));}})});router[_0x8211('0x21')]('/:id/system_avatar',upload[_0x8211('0x2c')]('file'),controller['addSystemAvatar']);router['post'](_0x8211('0x32'),controller[_0x8211('0x33')]);const offlineUploadMulter=multer({'storage':multer[_0x8211('0x24')]({'destination':function(_0x1a2c77,_0x2e85f9,_0x4c5272){const _0x3d7aae=path[_0x8211('0x25')](config['root'],_0x8211('0x34'),'attachments',_0x8211('0x35'));fs_extra[_0x8211('0x36')](_0x3d7aae,function(){_0x4c5272(null,_0x3d7aae);});},'filename':function(_0x56fa74,_0x501456,_0x274e44){const _0x521597=_0x501456[_0x8211('0x2b')][_0x8211('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x316ae1=path[_0x8211('0x38')](_0x521597);const _0x317400=Date['now']()+'-'+_0x521597[_0x8211('0x37')](_0x316ae1,'')+_0x316ae1;_0x274e44(null,_0x317400);}})});router[_0x8211('0x21')](_0x8211('0x39'),offlineUploadMulter[_0x8211('0x3a')](),controller[_0x8211('0x3b')]);router[_0x8211('0x21')]('/:id/interactions',auth[_0x8211('0xb')](),controller[_0x8211('0x3c')]);router[_0x8211('0x21')](_0x8211('0x1a'),auth['isAuthenticated'](),controller[_0x8211('0x3d')]);router[_0x8211('0x21')](_0x8211('0x1b'),auth[_0x8211('0xb')](),controller[_0x8211('0x3e')]);router[_0x8211('0x21')]('/:id/users',auth[_0x8211('0xb')](),controller[_0x8211('0x3f')]);router[_0x8211('0x40')](_0x8211('0xd'),auth['isAuthenticated'](),controller[_0x8211('0x41')]);router[_0x8211('0x42')](_0x8211('0xd'),auth[_0x8211('0xb')](),controller[_0x8211('0x43')]);router[_0x8211('0x42')](_0x8211('0xf'),auth[_0x8211('0xb')](),controller[_0x8211('0x44')]);router['delete']('/:id/canned_answers',auth[_0x8211('0xb')](),controller[_0x8211('0x45')]);router[_0x8211('0x42')](_0x8211('0x1f'),auth['isAuthenticated'](),controller[_0x8211('0x46')]);module['exports']=router; \ No newline at end of file +var _0xec4f=['put','delete','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','getAgents','create','/:id/dispositions','addDisposition','post','addAnswer','diskStorage','join','root','server/files/images/logos/','format','now','addLogo','server/files/images/avatars/','single','file','addAvatar','%s-%s','originalname','addCustomerAvatar','/:id/system_avatar','/:id/notify','notify','attachments','offline-chat','ensureDir','replace','/:id/offline','offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','addAgents'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xec4f,0xee));var _0xfec4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xec4f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfec4('0x0'));var util=require(_0xfec4('0x1'));var path=require(_0xfec4('0x2'));var timeout=require(_0xfec4('0x3'));var express=require(_0xfec4('0x4'));var router=express[_0xfec4('0x5')]();var fs_extra=require(_0xfec4('0x6'));var auth=require(_0xfec4('0x7'));var interaction=require(_0xfec4('0x8'));var config=require('../../config/environment');var controller=require(_0xfec4('0x9'));router[_0xfec4('0xa')]('/',auth[_0xfec4('0xb')](),controller[_0xfec4('0xc')]);router['get'](_0xfec4('0xd'),auth[_0xfec4('0xb')](),controller[_0xfec4('0xe')]);router[_0xfec4('0xa')](_0xfec4('0xf'),auth[_0xfec4('0xb')](),controller[_0xfec4('0x10')]);router[_0xfec4('0xa')]('/:id/dispositions',auth[_0xfec4('0xb')](),controller[_0xfec4('0x11')]);router[_0xfec4('0xa')](_0xfec4('0x12'),auth[_0xfec4('0xb')](),controller[_0xfec4('0x13')]);router[_0xfec4('0xa')](_0xfec4('0x14'),controller[_0xfec4('0x15')]);router[_0xfec4('0xa')](_0xfec4('0x16'),controller[_0xfec4('0x17')]);router['get'](_0xfec4('0x18'),controller[_0xfec4('0x19')]);router['get']('/:id/system_avatar',controller[_0xfec4('0x1a')]);router[_0xfec4('0xa')]('/:id/interactions',auth[_0xfec4('0xb')](),controller[_0xfec4('0x1b')]);router[_0xfec4('0xa')](_0xfec4('0x1c'),controller['getSnippet']);router[_0xfec4('0xa')](_0xfec4('0x1d'),auth[_0xfec4('0xb')](),controller[_0xfec4('0x1e')]);router[_0xfec4('0xa')](_0xfec4('0x1f'),auth[_0xfec4('0xb')](),controller['getProactiveActions']);router['get'](_0xfec4('0x20'),controller[_0xfec4('0x21')]);router[_0xfec4('0xa')](_0xfec4('0x22'),auth[_0xfec4('0xb')](),controller[_0xfec4('0x23')]);router[_0xfec4('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0xfec4('0x24')]);router['post']('/',auth[_0xfec4('0xb')](),controller[_0xfec4('0x25')]);router['post'](_0xfec4('0x26'),auth[_0xfec4('0xb')](),controller[_0xfec4('0x27')]);router[_0xfec4('0x28')]('/:id/canned_answers',auth[_0xfec4('0xb')](),controller[_0xfec4('0x29')]);var upload=multer({'storage':multer[_0xfec4('0x2a')]({'destination':function(_0x186bdd,_0x4bd3aa,_0x22c799){_0x22c799(null,path[_0xfec4('0x2b')](config[_0xfec4('0x2c')],_0xfec4('0x2d')));},'filename':function(_0x51eb84,_0x2cba3e,_0x3f2a0e){_0x3f2a0e(null,util[_0xfec4('0x2e')]('%s-%s',Date[_0xfec4('0x2f')](),_0x2cba3e['originalname']));}})});router[_0xfec4('0x28')](_0xfec4('0x14'),upload['single']('file'),controller[_0xfec4('0x30')]);var upload=multer({'storage':multer[_0xfec4('0x2a')]({'destination':function(_0x1bf555,_0x4eb51e,_0x50310e){_0x50310e(null,path['join'](config[_0xfec4('0x2c')],_0xfec4('0x31')));},'filename':function(_0x352f7c,_0x93555a,_0xdb64f5){_0xdb64f5(null,util[_0xfec4('0x2e')]('%s-%s',Date[_0xfec4('0x2f')](),_0x93555a['originalname']));}})});router[_0xfec4('0x28')]('/:id/avatar',upload[_0xfec4('0x32')](_0xfec4('0x33')),controller[_0xfec4('0x34')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x283ec2,_0x465bcd,_0x3bb357){_0x3bb357(null,path[_0xfec4('0x2b')](config[_0xfec4('0x2c')],_0xfec4('0x31')));},'filename':function(_0x56d448,_0x11d3e3,_0x40bccf){_0x40bccf(null,util[_0xfec4('0x2e')](_0xfec4('0x35'),Date[_0xfec4('0x2f')](),_0x11d3e3[_0xfec4('0x36')]));}})});router[_0xfec4('0x28')](_0xfec4('0x18'),upload[_0xfec4('0x32')](_0xfec4('0x33')),controller[_0xfec4('0x37')]);var upload=multer({'storage':multer[_0xfec4('0x2a')]({'destination':function(_0x3473d0,_0x20fc5a,_0x28f0d8){_0x28f0d8(null,path[_0xfec4('0x2b')](config[_0xfec4('0x2c')],_0xfec4('0x31')));},'filename':function(_0x31d9ee,_0x138389,_0x48e2d1){_0x48e2d1(null,util['format'](_0xfec4('0x35'),Date[_0xfec4('0x2f')](),_0x138389[_0xfec4('0x36')]));}})});router['post'](_0xfec4('0x38'),upload['single'](_0xfec4('0x33')),controller['addSystemAvatar']);router[_0xfec4('0x28')](_0xfec4('0x39'),controller[_0xfec4('0x3a')]);const offlineUploadMulter=multer({'storage':multer[_0xfec4('0x2a')]({'destination':function(_0x25ca9b,_0x3142fa,_0x37e99e){const _0x16acf8=path[_0xfec4('0x2b')](config[_0xfec4('0x2c')],'server/files',_0xfec4('0x3b'),_0xfec4('0x3c'));fs_extra[_0xfec4('0x3d')](_0x16acf8,function(){_0x37e99e(null,_0x16acf8);});},'filename':function(_0x1ef95c,_0x19685f,_0x464119){const _0x3b1309=_0x19685f[_0xfec4('0x36')][_0xfec4('0x3e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x227aad=path['extname'](_0x3b1309);const _0x16bfb1=Date[_0xfec4('0x2f')]()+'-'+_0x3b1309[_0xfec4('0x3e')](_0x227aad,'')+_0x227aad;_0x464119(null,_0x16bfb1);}})});router[_0xfec4('0x28')](_0xfec4('0x3f'),offlineUploadMulter['any'](),controller[_0xfec4('0x40')]);router[_0xfec4('0x28')](_0xfec4('0x41'),auth[_0xfec4('0xb')](),controller[_0xfec4('0x42')]);router[_0xfec4('0x28')]('/:id/applications',auth[_0xfec4('0xb')](),controller[_0xfec4('0x43')]);router[_0xfec4('0x28')](_0xfec4('0x1f'),auth['isAuthenticated'](),controller[_0xfec4('0x44')]);router[_0xfec4('0x28')]('/:id/users',auth[_0xfec4('0xb')](),controller[_0xfec4('0x45')]);router[_0xfec4('0x46')](_0xfec4('0xf'),auth[_0xfec4('0xb')](),controller['update']);router[_0xfec4('0x47')]('/:id',auth[_0xfec4('0xb')](),controller['destroy']);router['delete'](_0xfec4('0x26'),auth['isAuthenticated'](),controller[_0xfec4('0x48')]);router['delete'](_0xfec4('0x12'),auth['isAuthenticated'](),controller[_0xfec4('0x49')]);router[_0xfec4('0x47')](_0xfec4('0x4a'),auth[_0xfec4('0xb')](),controller[_0xfec4('0x4b')]);module[_0xfec4('0x4c')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index c621cef..e32c401 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 _0x7443=['get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','beaver-logger/server','Router','env','production'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7443,0xf4));var _0x3744=function(_0x1a8bde,_0x301f95){_0x1a8bde=_0x1a8bde-0x0;var _0x3df6df=_0x7443[_0x1a8bde];return _0x3df6df;};var beaverLogger=require(_0x3744('0x0'));var express=require('express');var auth=require('../components/auth/service');var config=require('../config/environment');var router=express[_0x3744('0x1')]();var isProduction=config[_0x3744('0x2')]===_0x3744('0x3')||![];function clientSideLogs(_0x2701e6,_0x48f0e4,_0x4a38a3){var _0x26b92b=_0x2701e6['app'][_0x3744('0x4')](_0x3744('0x5'));if(!_0x26b92b){throw new Error(_0x3744('0x6'));}return beaverLogger[_0x3744('0x7')]({'uri':'/client-logs','logger':_0x26b92b,'enableCors':!isProduction})(_0x2701e6,_0x48f0e4,_0x4a38a3);}router['use'](auth['isAuthenticated'](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0x2f41=['expressEndpoint','/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','../config/environment','Router','production','app','client-side-logger','Client-Side\x20logger\x20not\x20found!'];(function(_0x413aac,_0x5e2430){var _0x569b11=function(_0x52e060){while(--_0x52e060){_0x413aac['push'](_0x413aac['shift']());}};_0x569b11(++_0x5e2430);}(_0x2f41,0x94));var _0x12f4=function(_0x2181fc,_0x7283aa){_0x2181fc=_0x2181fc-0x0;var _0x315da1=_0x2f41[_0x2181fc];return _0x315da1;};var beaverLogger=require(_0x12f4('0x0'));var express=require(_0x12f4('0x1'));var auth=require('../components/auth/service');var config=require(_0x12f4('0x2'));var router=express[_0x12f4('0x3')]();var isProduction=config['env']===_0x12f4('0x4')||![];function clientSideLogs(_0x262aaa,_0x4728ce,_0x44733c){var _0x56a07e=_0x262aaa[_0x12f4('0x5')]['get'](_0x12f4('0x6'));if(!_0x56a07e){throw new Error(_0x12f4('0x7'));}return beaverLogger[_0x12f4('0x8')]({'uri':_0x12f4('0x9'),'logger':_0x56a07e,'enableCors':!isProduction})(_0x262aaa,_0x4728ce,_0x44733c);}router[_0x12f4('0xa')](auth[_0x12f4('0xb')](),clientSideLogs);module[_0x12f4('0xc')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 8f59d66..44ffe48 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 _0x5030=['sequelize','ENUM','Google','Outlook365','STRING','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'];(function(_0x11f09c,_0x404556){var _0x57e24d=function(_0x358f57){while(--_0x358f57){_0x11f09c['push'](_0x11f09c['shift']());}};_0x57e24d(++_0x404556);}(_0x5030,0x19a));var _0x0503=function(_0x454ad3,_0x3d74d4){_0x454ad3=_0x454ad3-0x0;var _0x38accf=_0x5030[_0x454ad3];return _0x38accf;};'use strict';var Sequelize=require(_0x0503('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x0503('0x1')]('AmazonAWS',_0x0503('0x2'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x0503('0x1')](_0x0503('0x3'),'Dynamics365')},'data1':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x0503('0x4')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x0503('0x4')],'comment':_0x0503('0x5')},'data4':{'type':Sequelize[_0x0503('0x4')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x0503('0x6')],'comment':_0x0503('0x7')},'data6':{'type':Sequelize[_0x0503('0x6')],'comment':_0x0503('0x8')},'data7':{'type':Sequelize['TEXT'],'comment':_0x0503('0x9')}}; \ No newline at end of file +var _0xe900=['sequelize','exports','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0x2eaf3f,_0x3eed77){var _0x1780b6=function(_0x1eaf89){while(--_0x1eaf89){_0x2eaf3f['push'](_0x2eaf3f['shift']());}};_0x1780b6(++_0x3eed77);}(_0xe900,0x159));var _0x0e90=function(_0x3173ab,_0x1edb1c){_0x3173ab=_0x3173ab-0x0;var _0xea1070=_0xe900[_0x3173ab];return _0xea1070;};'use strict';var Sequelize=require(_0x0e90('0x0'));module[_0x0e90('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x0e90('0x2')](_0x0e90('0x3'),_0x0e90('0x4'),_0x0e90('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x0e90('0x2')](_0x0e90('0x6'),_0x0e90('0x7'))},'data1':{'type':Sequelize[_0x0e90('0x8')],'comment':_0x0e90('0x9')},'data2':{'type':Sequelize[_0x0e90('0x8')],'comment':_0x0e90('0xa')},'data3':{'type':Sequelize['STRING'],'comment':_0x0e90('0xb')},'data4':{'type':Sequelize[_0x0e90('0x8')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x0e90('0xc')],'comment':_0x0e90('0xd')},'data6':{'type':Sequelize['TEXT'],'comment':_0x0e90('0xe')},'data7':{'type':Sequelize[_0x0e90('0xc')],'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 a796664..7d5f8bd 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 _0xfc90=['map','CloudProvider','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','MicrosoftAzure','decryptString','data3','catch','show','params','rawAttributes','include','find','create','body','Name\x20parameter\x20not\x20specified','service','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','id_token','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../components/encryptor','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','defaults','redis','socket.io-emitter','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','update','then','destroy','error','stack','name','send','slice','index'];(function(_0x4a9beb,_0x159482){var _0x2d4c58=function(_0x28dabf){while(--_0x28dabf){_0x4a9beb['push'](_0x4a9beb['shift']());}};_0x2d4c58(++_0x159482);}(_0xfc90,0x1d8));var _0x0fc9=function(_0x27b2bb,_0xf59c0d){_0x27b2bb=_0x27b2bb-0x0;var _0x1b2fa9=_0xfc90[_0x27b2bb];return _0x1b2fa9;};'use strict';var _=require(_0x0fc9('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require(_0x0fc9('0x1'));var config=require('../../config/environment');var logger=require(_0x0fc9('0x2'))(_0x0fc9('0x3'));var db=require(_0x0fc9('0x4'))['db'];var oauth=require(_0x0fc9('0x5'));config['redis']=_[_0x0fc9('0x6')](config[_0x0fc9('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x0fc9('0x8'))(new Redis(config[_0x0fc9('0x7')]));var redis=new Redis(config[_0x0fc9('0x7')]);function respondWithStatusCode(_0x322286,_0x5925b8){_0x5925b8=_0x5925b8||0xcc;return function(_0x49d75a){if(_0x49d75a){return _0x322286[_0x0fc9('0x9')](_0x5925b8);}return _0x322286[_0x0fc9('0xa')](_0x5925b8)[_0x0fc9('0xb')]();};}function respondWithResult(_0x5cf43f,_0x32c2cd){_0x32c2cd=_0x32c2cd||0xc8;return function(_0x112255){if(_0x112255){return _0x5cf43f[_0x0fc9('0xa')](_0x32c2cd)['json'](_0x112255);}};}function respondWithFilteredResult(_0x1d0198,_0x4f2dab){return function(_0x4e8719){if(_0x4e8719){var _0x28d50e=typeof _0x4f2dab[_0x0fc9('0xc')]===_0x0fc9('0xd')&&typeof _0x4f2dab['limit']===_0x0fc9('0xd');var _0x3bb516=_0x4e8719[_0x0fc9('0xe')];var _0x49ee1e=_0x28d50e?0x0:_0x4f2dab['offset'];var _0xcfa7f5=_0x28d50e?_0x4e8719['count']:_0x4f2dab[_0x0fc9('0xc')]+_0x4f2dab[_0x0fc9('0xf')];var _0x577ce6;if(_0xcfa7f5>=_0x3bb516){_0xcfa7f5=_0x3bb516;_0x577ce6=0xc8;}else{_0x577ce6=0xce;}_0x1d0198[_0x0fc9('0xa')](_0x577ce6);return _0x1d0198[_0x0fc9('0x10')](_0x0fc9('0x11'),_0x49ee1e+'-'+_0xcfa7f5+'/'+_0x3bb516)[_0x0fc9('0x12')](_0x4e8719);}return null;};}function saveUpdates(_0x293ebe){return function(_0x479801){if(_0x479801){return _0x479801[_0x0fc9('0x13')](_0x293ebe)[_0x0fc9('0x14')](function(_0x21eebc){return _0x21eebc;});}return null;};}function removeEntity(_0x17e701){return function(_0x608f7){if(_0x608f7){return _0x608f7[_0x0fc9('0x15')]()[_0x0fc9('0x14')](function(){_0x17e701['status'](0xcc)[_0x0fc9('0xb')]();});}};}function handleEntityNotFound(_0x2fce6c){return function(_0x356e86){if(!_0x356e86){_0x2fce6c[_0x0fc9('0x9')](0x194);}return _0x356e86;};}function handleError(_0x3e322d,_0x3128be){_0x3128be=_0x3128be||0x1f4;return function(_0x5d94d7){logger[_0x0fc9('0x16')](_0x5d94d7[_0x0fc9('0x17')]);if(_0x5d94d7[_0x0fc9('0x18')]){delete _0x5d94d7[_0x0fc9('0x18')];}_0x3e322d['status'](_0x3128be)[_0x0fc9('0x19')](_0x5d94d7);};}function maskClientSecret(_0x24181c){return _['padEnd'](_0x24181c[_0x0fc9('0x1a')](0x0,0x3),0x14,'*');}exports[_0x0fc9('0x1b')]=function(_0x194519,_0x4d61bd){var _0x3faee8={},_0x3ff6d9={},_0x3ecc8d={'count':0x0,'rows':[]};var _0x351a9e=_[_0x0fc9('0x1c')](db[_0x0fc9('0x1d')]['rawAttributes'],function(_0x4d565e){return{'name':_0x4d565e[_0x0fc9('0x1e')],'type':_0x4d565e[_0x0fc9('0x1f')][_0x0fc9('0x20')]};});_0x3ff6d9['model']=_[_0x0fc9('0x1c')](_0x351a9e,'name');_0x3ff6d9[_0x0fc9('0x21')]=_[_0x0fc9('0x22')](_0x194519[_0x0fc9('0x21')]);_0x3ff6d9[_0x0fc9('0x23')]=_[_0x0fc9('0x24')](_0x3ff6d9['model'],_0x3ff6d9[_0x0fc9('0x21')]);_0x3faee8[_0x0fc9('0x25')]=_[_0x0fc9('0x24')](_0x3ff6d9['model'],qs[_0x0fc9('0x26')](_0x194519['query'][_0x0fc9('0x26')]));_0x3faee8[_0x0fc9('0x25')]=_0x3faee8[_0x0fc9('0x25')][_0x0fc9('0x27')]?_0x3faee8[_0x0fc9('0x25')]:_0x3ff6d9[_0x0fc9('0x28')];if(!_0x194519['query'][_0x0fc9('0x29')]('nolimit')){_0x3faee8[_0x0fc9('0xf')]=qs[_0x0fc9('0xf')](_0x194519[_0x0fc9('0x21')][_0x0fc9('0xf')]);_0x3faee8[_0x0fc9('0xc')]=qs[_0x0fc9('0xc')](_0x194519[_0x0fc9('0x21')][_0x0fc9('0xc')]);}_0x3faee8[_0x0fc9('0x2a')]=qs[_0x0fc9('0x2b')](_0x194519[_0x0fc9('0x21')][_0x0fc9('0x2b')]);_0x3faee8[_0x0fc9('0x2c')]=qs['filters'](_[_0x0fc9('0x2d')](_0x194519[_0x0fc9('0x21')],_0x3ff6d9[_0x0fc9('0x23')]),_0x351a9e);if(_0x194519[_0x0fc9('0x21')][_0x0fc9('0x2e')]){_0x3faee8[_0x0fc9('0x2c')]=_[_0x0fc9('0x2f')](_0x3faee8['where'],{'$or':_[_0x0fc9('0x1c')](_0x351a9e,function(_0x7fb17c){if(_0x7fb17c[_0x0fc9('0x1f')]!=='VIRTUAL'){var _0xf91bd5={};_0xf91bd5[_0x7fb17c[_0x0fc9('0x18')]]={'$like':'%'+_0x194519[_0x0fc9('0x21')][_0x0fc9('0x2e')]+'%'};return _0xf91bd5;}})});}_0x3faee8=_[_0x0fc9('0x2f')]({},_0x3faee8,_0x194519[_0x0fc9('0x30')]);var _0x3d36db={'where':_0x3faee8[_0x0fc9('0x2c')]};return db[_0x0fc9('0x1d')]['count'](_0x3d36db)['then'](function(_0x2d9075){_0x3ecc8d['count']=_0x2d9075;if(_0x194519[_0x0fc9('0x21')][_0x0fc9('0x31')]){_0x3faee8['include']=[{'all':!![]}];}return db[_0x0fc9('0x1d')][_0x0fc9('0x32')](_0x3faee8);})['then'](function(_0x50c35b){_0x3ecc8d[_0x0fc9('0x33')]=_['map'](_0x50c35b,function(_0x121e5f){if(_0x121e5f['service']===_0x0fc9('0x34')){var _0x1be25d=encryptor[_0x0fc9('0x35')](_0x121e5f[_0x0fc9('0x36')]);_0x121e5f['data3']=maskClientSecret(_0x1be25d);}return _0x121e5f;});return _0x3ecc8d;})[_0x0fc9('0x14')](respondWithFilteredResult(_0x4d61bd,_0x3faee8))[_0x0fc9('0x37')](handleError(_0x4d61bd,null));};exports[_0x0fc9('0x38')]=function(_0x144702,_0x1db95a){var _0x4a87b4={'raw':!![],'where':{'id':_0x144702[_0x0fc9('0x39')]['id']}},_0x20d00c={};_0x20d00c[_0x0fc9('0x28')]=_[_0x0fc9('0x22')](db['CloudProvider'][_0x0fc9('0x3a')]);_0x20d00c[_0x0fc9('0x21')]=_[_0x0fc9('0x22')](_0x144702[_0x0fc9('0x21')]);_0x20d00c['filters']=_[_0x0fc9('0x24')](_0x20d00c[_0x0fc9('0x28')],_0x20d00c[_0x0fc9('0x21')]);_0x4a87b4[_0x0fc9('0x25')]=_[_0x0fc9('0x24')](_0x20d00c[_0x0fc9('0x28')],qs['fields'](_0x144702[_0x0fc9('0x21')][_0x0fc9('0x26')]));_0x4a87b4[_0x0fc9('0x25')]=_0x4a87b4[_0x0fc9('0x25')][_0x0fc9('0x27')]?_0x4a87b4[_0x0fc9('0x25')]:_0x20d00c[_0x0fc9('0x28')];if(_0x144702[_0x0fc9('0x21')][_0x0fc9('0x31')]){_0x4a87b4[_0x0fc9('0x3b')]=[{'all':!![]}];}_0x4a87b4=_['merge']({},_0x4a87b4,_0x144702[_0x0fc9('0x30')]);return db[_0x0fc9('0x1d')][_0x0fc9('0x3c')](_0x4a87b4)[_0x0fc9('0x14')](handleEntityNotFound(_0x1db95a,null))[_0x0fc9('0x14')](function(_0x69e2c9){if(_0x69e2c9['service']==='MicrosoftAzure'){var _0x5f0345=encryptor['decryptString'](_0x69e2c9[_0x0fc9('0x36')]);_0x69e2c9[_0x0fc9('0x36')]=maskClientSecret(_0x5f0345);}return _0x69e2c9;})[_0x0fc9('0x14')](respondWithResult(_0x1db95a,null))[_0x0fc9('0x37')](handleError(_0x1db95a,null));};exports[_0x0fc9('0x3d')]=function(_0x304a8d,_0x45caa1){if(!_0x304a8d[_0x0fc9('0x3e')][_0x0fc9('0x18')])throw new Error(_0x0fc9('0x3f'));if(!_0x304a8d[_0x0fc9('0x3e')][_0x0fc9('0x40')])throw new Error(_0x0fc9('0x41'));var _0x20efd9=db[_0x0fc9('0x1d')][_0x0fc9('0x3a')][_0x0fc9('0x40')][_0x0fc9('0x42')];if(!_0x20efd9[_0x0fc9('0x43')](_0x304a8d[_0x0fc9('0x3e')][_0x0fc9('0x40')]))throw new Error(_0x0fc9('0x44')+_0x20efd9[_0x0fc9('0x45')](',\x20'));if(_0x304a8d[_0x0fc9('0x3e')][_0x0fc9('0x40')]===_0x0fc9('0x34')&&_0x304a8d[_0x0fc9('0x3e')][_0x0fc9('0x36')]){_0x304a8d['body'][_0x0fc9('0x36')]=encryptor[_0x0fc9('0x46')](_0x304a8d[_0x0fc9('0x3e')][_0x0fc9('0x36')]);}return db['CloudProvider'][_0x0fc9('0x3d')](_0x304a8d[_0x0fc9('0x3e')],{})[_0x0fc9('0x14')](respondWithResult(_0x45caa1,0xc9))['catch'](handleError(_0x45caa1,null));};exports[_0x0fc9('0x13')]=function(_0x465d07,_0x56636b){if(_0x465d07[_0x0fc9('0x3e')]['id']){delete _0x465d07['body']['id'];}return db['CloudProvider'][_0x0fc9('0x3c')]({'where':{'id':_0x465d07[_0x0fc9('0x39')]['id']}})[_0x0fc9('0x14')](handleEntityNotFound(_0x56636b,null))['then'](function(_0x4b962a){if(_0x4b962a['service']===_0x0fc9('0x34')&&_0x465d07[_0x0fc9('0x3e')][_0x0fc9('0x36')]){_0x465d07['body'][_0x0fc9('0x36')]=encryptor[_0x0fc9('0x46')](_0x465d07[_0x0fc9('0x3e')][_0x0fc9('0x36')]);}return _0x4b962a;})[_0x0fc9('0x14')](saveUpdates(_0x465d07[_0x0fc9('0x3e')],null))['then'](respondWithResult(_0x56636b,null))[_0x0fc9('0x37')](handleError(_0x56636b,null));};exports[_0x0fc9('0x15')]=function(_0x7b7bb2,_0x1ca75f){return db['CloudProvider']['find']({'where':{'id':_0x7b7bb2['params']['id']}})[_0x0fc9('0x14')](handleEntityNotFound(_0x1ca75f,null))[_0x0fc9('0x14')](removeEntity(_0x1ca75f,null))['catch'](handleError(_0x1ca75f,null));};exports[_0x0fc9('0x47')]=function(_0xf19436,_0x4ee61c){return db[_0x0fc9('0x1d')]['findOne']({'where':{'id':_0xf19436[_0x0fc9('0x39')]['id']},'raw':!![]})[_0x0fc9('0x14')](function(_0x29cba8){if(!_0x29cba8)return _0x4ee61c[_0x0fc9('0x9')](0x194);return{'url':oauth[_0x0fc9('0x48')](_0x29cba8,_0xf19436[_0x0fc9('0x49')]['id'])};})[_0x0fc9('0x14')](respondWithResult(_0x4ee61c,null))[_0x0fc9('0x37')](handleError(_0x4ee61c,null));};exports[_0x0fc9('0x4a')]=function(_0x864115,_0x1dd766){var _0xa7c07f=_0x864115[_0x0fc9('0x3e')];var _0x58ff2f;var _0xb85e42;if(_0xa7c07f[_0x0fc9('0x16')])throw _0xa7c07f;redis[_0x0fc9('0x4b')](_0xa7c07f[_0x0fc9('0x4c')])[_0x0fc9('0x14')](function(_0x203076){if(!_0x203076)throw new Error(_0x0fc9('0x4d'));_0x58ff2f=JSON[_0x0fc9('0x4e')](_0x203076);var _0xb50e1a=Buffer[_0x0fc9('0x4f')](_0xa7c07f['state'],_0x0fc9('0x50'))[_0x0fc9('0x51')](_0x0fc9('0x52'));_0xb85e42=JSON[_0x0fc9('0x4e')](_0xb50e1a);if(!oauth['isValidIdToken'](_0xa7c07f[_0x0fc9('0x53')],_0x58ff2f['oauth2Claims']))throw new Error(_0x0fc9('0x54'));redis[_0x0fc9('0x55')](_0xa7c07f['state']);return oauth[_0x0fc9('0x56')](_0xa7c07f[_0x0fc9('0x57')],_0x58ff2f);})[_0x0fc9('0x14')](function(_0xd5a0fc){_0x58ff2f[_0x0fc9('0x58')]=_0xd5a0fc[_0x0fc9('0x59')];_0x58ff2f[_0x0fc9('0x5a')]=_0xd5a0fc[_0x0fc9('0x5b')];return db[_0x0fc9('0x1d')]['update']({'data5':_0x58ff2f[_0x0fc9('0x58')],'data6':_0x58ff2f[_0x0fc9('0x5a')]},{'where':{'id':_0x58ff2f['id']}});})['then'](function(){oauth[_0x0fc9('0x5c')](_0x58ff2f);socket[_0x0fc9('0x5d')](_0x0fc9('0x5e'),{'id':_0xb85e42['id']});return;})[_0x0fc9('0x14')](respondWithStatusCode(_0x1dd766,null))[_0x0fc9('0x37')](function(_0xa92089){if(_0xb85e42){socket[_0x0fc9('0x5d')](_0x0fc9('0x5f'),{'id':_0xb85e42['id']});}if(!_0x58ff2f){logger[_0x0fc9('0x16')](_0x0fc9('0x60'),_0xa92089);return _0x1dd766[_0x0fc9('0xa')](0x1f4)[_0x0fc9('0x19')](_0xa92089[_0x0fc9('0x61')]);}logger[_0x0fc9('0x16')](_0x0fc9('0x62'),_0x58ff2f['id'],JSON[_0x0fc9('0x63')](_0xa92089));});}; \ No newline at end of file +var _0x3be3=['VIRTUAL','CloudProvider','includeAll','include','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','merge','options','create','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','rawAttributes','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','update','find','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','parse','from','state','base64','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','microsoftAuthorization:success','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','sendStatus','status','undefined','limit','count','offset','set','json','destroy','then','end','error','stack','name','send','padEnd','slice','map','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter'];(function(_0x4bd17e,_0x216b6e){var _0x11d7cf=function(_0x2d028f){while(--_0x2d028f){_0x4bd17e['push'](_0x4bd17e['shift']());}};_0x11d7cf(++_0x216b6e);}(_0x3be3,0x1c5));var _0x33be=function(_0x48961c,_0x280e9d){_0x48961c=_0x48961c-0x0;var _0x1d895d=_0x3be3[_0x48961c];return _0x1d895d;};'use strict';var _=require('lodash');var Redis=require(_0x33be('0x0'));var qs=require(_0x33be('0x1'));var encryptor=require(_0x33be('0x2'));var config=require(_0x33be('0x3'));var logger=require(_0x33be('0x4'))(_0x33be('0x5'));var db=require(_0x33be('0x6'))['db'];var oauth=require(_0x33be('0x7'));config[_0x33be('0x8')]=_[_0x33be('0x9')](config[_0x33be('0x8')],{'host':_0x33be('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x5984d2,_0x224a61){_0x224a61=_0x224a61||0xcc;return function(_0x1c020d){if(_0x1c020d){return _0x5984d2[_0x33be('0xb')](_0x224a61);}return _0x5984d2[_0x33be('0xc')](_0x224a61)['end']();};}function respondWithResult(_0x381415,_0x55a879){_0x55a879=_0x55a879||0xc8;return function(_0x540ea6){if(_0x540ea6){return _0x381415[_0x33be('0xc')](_0x55a879)['json'](_0x540ea6);}};}function respondWithFilteredResult(_0x36a88f,_0x35aca2){return function(_0x2fd80a){if(_0x2fd80a){var _0x42c4e6=typeof _0x35aca2['offset']===_0x33be('0xd')&&typeof _0x35aca2[_0x33be('0xe')]===_0x33be('0xd');var _0x25f29a=_0x2fd80a[_0x33be('0xf')];var _0x2de994=_0x42c4e6?0x0:_0x35aca2[_0x33be('0x10')];var _0x404a20=_0x42c4e6?_0x2fd80a[_0x33be('0xf')]:_0x35aca2[_0x33be('0x10')]+_0x35aca2[_0x33be('0xe')];var _0x5437de;if(_0x404a20>=_0x25f29a){_0x404a20=_0x25f29a;_0x5437de=0xc8;}else{_0x5437de=0xce;}_0x36a88f['status'](_0x5437de);return _0x36a88f[_0x33be('0x11')]('Content-Range',_0x2de994+'-'+_0x404a20+'/'+_0x25f29a)[_0x33be('0x12')](_0x2fd80a);}return null;};}function saveUpdates(_0x35d174){return function(_0x433580){if(_0x433580){return _0x433580['update'](_0x35d174)['then'](function(_0x4babe5){return _0x4babe5;});}return null;};}function removeEntity(_0x259686){return function(_0x1e0593){if(_0x1e0593){return _0x1e0593[_0x33be('0x13')]()[_0x33be('0x14')](function(){_0x259686['status'](0xcc)[_0x33be('0x15')]();});}};}function handleEntityNotFound(_0xc26d07){return function(_0x1185e5){if(!_0x1185e5){_0xc26d07[_0x33be('0xb')](0x194);}return _0x1185e5;};}function handleError(_0x40388a,_0x52b030){_0x52b030=_0x52b030||0x1f4;return function(_0x495c45){logger[_0x33be('0x16')](_0x495c45[_0x33be('0x17')]);if(_0x495c45['name']){delete _0x495c45[_0x33be('0x18')];}_0x40388a[_0x33be('0xc')](_0x52b030)[_0x33be('0x19')](_0x495c45);};}function maskClientSecret(_0x2e7ed7){return _[_0x33be('0x1a')](_0x2e7ed7[_0x33be('0x1b')](0x0,0x3),0x14,'*');}exports['index']=function(_0xc6983b,_0x47cf77){var _0x329059={},_0xb8a106={},_0xdf1e92={'count':0x0,'rows':[]};var _0x30dc6f=_[_0x33be('0x1c')](db['CloudProvider']['rawAttributes'],function(_0xe4fd5f){return{'name':_0xe4fd5f[_0x33be('0x1d')],'type':_0xe4fd5f[_0x33be('0x1e')][_0x33be('0x1f')]};});_0xb8a106[_0x33be('0x20')]=_['map'](_0x30dc6f,_0x33be('0x18'));_0xb8a106[_0x33be('0x21')]=_[_0x33be('0x22')](_0xc6983b[_0x33be('0x21')]);_0xb8a106['filters']=_['intersection'](_0xb8a106[_0x33be('0x20')],_0xb8a106[_0x33be('0x21')]);_0x329059[_0x33be('0x23')]=_[_0x33be('0x24')](_0xb8a106[_0x33be('0x20')],qs[_0x33be('0x25')](_0xc6983b[_0x33be('0x21')][_0x33be('0x25')]));_0x329059[_0x33be('0x23')]=_0x329059[_0x33be('0x23')][_0x33be('0x26')]?_0x329059['attributes']:_0xb8a106[_0x33be('0x20')];if(!_0xc6983b[_0x33be('0x21')][_0x33be('0x27')](_0x33be('0x28'))){_0x329059[_0x33be('0xe')]=qs[_0x33be('0xe')](_0xc6983b['query']['limit']);_0x329059[_0x33be('0x10')]=qs['offset'](_0xc6983b['query'][_0x33be('0x10')]);}_0x329059[_0x33be('0x29')]=qs[_0x33be('0x2a')](_0xc6983b['query'][_0x33be('0x2a')]);_0x329059[_0x33be('0x2b')]=qs[_0x33be('0x2c')](_[_0x33be('0x2d')](_0xc6983b['query'],_0xb8a106[_0x33be('0x2c')]),_0x30dc6f);if(_0xc6983b[_0x33be('0x21')][_0x33be('0x2e')]){_0x329059[_0x33be('0x2b')]=_['merge'](_0x329059[_0x33be('0x2b')],{'$or':_[_0x33be('0x1c')](_0x30dc6f,function(_0x31d38f){if(_0x31d38f[_0x33be('0x1e')]!==_0x33be('0x2f')){var _0x4c4575={};_0x4c4575[_0x31d38f[_0x33be('0x18')]]={'$like':'%'+_0xc6983b[_0x33be('0x21')]['filter']+'%'};return _0x4c4575;}})});}_0x329059=_['merge']({},_0x329059,_0xc6983b['options']);var _0x43b4f4={'where':_0x329059[_0x33be('0x2b')]};return db[_0x33be('0x30')][_0x33be('0xf')](_0x43b4f4)[_0x33be('0x14')](function(_0x5b1112){_0xdf1e92[_0x33be('0xf')]=_0x5b1112;if(_0xc6983b[_0x33be('0x21')][_0x33be('0x31')]){_0x329059[_0x33be('0x32')]=[{'all':!![]}];}return db[_0x33be('0x30')]['findAll'](_0x329059);})[_0x33be('0x14')](function(_0x7da500){_0xdf1e92[_0x33be('0x33')]=_['map'](_0x7da500,function(_0x243dc4){if(_0x243dc4[_0x33be('0x34')]===_0x33be('0x35')){var _0x14374b=encryptor[_0x33be('0x36')](_0x243dc4[_0x33be('0x37')]);_0x243dc4[_0x33be('0x37')]=maskClientSecret(_0x14374b);}return _0x243dc4;});return _0xdf1e92;})[_0x33be('0x14')](respondWithFilteredResult(_0x47cf77,_0x329059))[_0x33be('0x38')](handleError(_0x47cf77,null));};exports[_0x33be('0x39')]=function(_0xb6cce8,_0x5e4b17){var _0x38cc05={'raw':!![],'where':{'id':_0xb6cce8[_0x33be('0x3a')]['id']}},_0xcb9f23={};_0xcb9f23[_0x33be('0x20')]=_[_0x33be('0x22')](db['CloudProvider']['rawAttributes']);_0xcb9f23[_0x33be('0x21')]=_[_0x33be('0x22')](_0xb6cce8['query']);_0xcb9f23[_0x33be('0x2c')]=_[_0x33be('0x24')](_0xcb9f23[_0x33be('0x20')],_0xcb9f23[_0x33be('0x21')]);_0x38cc05[_0x33be('0x23')]=_[_0x33be('0x24')](_0xcb9f23['model'],qs[_0x33be('0x25')](_0xb6cce8[_0x33be('0x21')][_0x33be('0x25')]));_0x38cc05[_0x33be('0x23')]=_0x38cc05[_0x33be('0x23')][_0x33be('0x26')]?_0x38cc05[_0x33be('0x23')]:_0xcb9f23['model'];if(_0xb6cce8[_0x33be('0x21')]['includeAll']){_0x38cc05[_0x33be('0x32')]=[{'all':!![]}];}_0x38cc05=_[_0x33be('0x3b')]({},_0x38cc05,_0xb6cce8[_0x33be('0x3c')]);return db[_0x33be('0x30')]['find'](_0x38cc05)[_0x33be('0x14')](handleEntityNotFound(_0x5e4b17,null))[_0x33be('0x14')](function(_0x3be4f3){if(_0x3be4f3[_0x33be('0x34')]===_0x33be('0x35')){var _0x25767a=encryptor['decryptString'](_0x3be4f3[_0x33be('0x37')]);_0x3be4f3['data3']=maskClientSecret(_0x25767a);}return _0x3be4f3;})[_0x33be('0x14')](respondWithResult(_0x5e4b17,null))[_0x33be('0x38')](handleError(_0x5e4b17,null));};exports[_0x33be('0x3d')]=function(_0x27a94a,_0x102713){if(!_0x27a94a['body'][_0x33be('0x18')])throw new Error(_0x33be('0x3e'));if(!_0x27a94a[_0x33be('0x3f')]['service'])throw new Error(_0x33be('0x40'));var _0x308aba=db[_0x33be('0x30')][_0x33be('0x41')][_0x33be('0x34')][_0x33be('0x42')];if(!_0x308aba[_0x33be('0x43')](_0x27a94a[_0x33be('0x3f')][_0x33be('0x34')]))throw new Error(_0x33be('0x44')+_0x308aba[_0x33be('0x45')](',\x20'));if(_0x27a94a[_0x33be('0x3f')][_0x33be('0x34')]===_0x33be('0x35')&&_0x27a94a[_0x33be('0x3f')][_0x33be('0x37')]){_0x27a94a[_0x33be('0x3f')][_0x33be('0x37')]=encryptor[_0x33be('0x46')](_0x27a94a[_0x33be('0x3f')]['data3']);}return db[_0x33be('0x30')][_0x33be('0x3d')](_0x27a94a[_0x33be('0x3f')],{})[_0x33be('0x14')](respondWithResult(_0x102713,0xc9))[_0x33be('0x38')](handleError(_0x102713,null));};exports[_0x33be('0x47')]=function(_0x291c5b,_0x4482ad){if(_0x291c5b[_0x33be('0x3f')]['id']){delete _0x291c5b[_0x33be('0x3f')]['id'];}return db[_0x33be('0x30')]['find']({'where':{'id':_0x291c5b[_0x33be('0x3a')]['id']}})[_0x33be('0x14')](handleEntityNotFound(_0x4482ad,null))[_0x33be('0x14')](function(_0x5e4294){if(_0x5e4294[_0x33be('0x34')]==='MicrosoftAzure'&&_0x291c5b[_0x33be('0x3f')][_0x33be('0x37')]){_0x291c5b[_0x33be('0x3f')][_0x33be('0x37')]=encryptor[_0x33be('0x46')](_0x291c5b['body']['data3']);}return _0x5e4294;})[_0x33be('0x14')](saveUpdates(_0x291c5b[_0x33be('0x3f')],null))['then'](respondWithResult(_0x4482ad,null))[_0x33be('0x38')](handleError(_0x4482ad,null));};exports[_0x33be('0x13')]=function(_0x40dfe9,_0x2255ee){return db[_0x33be('0x30')][_0x33be('0x48')]({'where':{'id':_0x40dfe9[_0x33be('0x3a')]['id']}})['then'](handleEntityNotFound(_0x2255ee,null))[_0x33be('0x14')](removeEntity(_0x2255ee,null))[_0x33be('0x38')](handleError(_0x2255ee,null));};exports['oauth2MicrosoftAuthorize']=function(_0x1d3ce1,_0x5cdbb0){return db[_0x33be('0x30')][_0x33be('0x49')]({'where':{'id':_0x1d3ce1[_0x33be('0x3a')]['id']},'raw':!![]})[_0x33be('0x14')](function(_0x26cf12){if(!_0x26cf12)return _0x5cdbb0[_0x33be('0xb')](0x194);return{'url':oauth[_0x33be('0x4a')](_0x26cf12,_0x1d3ce1[_0x33be('0x4b')]['id'])};})['then'](respondWithResult(_0x5cdbb0,null))[_0x33be('0x38')](handleError(_0x5cdbb0,null));};exports[_0x33be('0x4c')]=function(_0x35c1e5,_0x1aadfe){var _0x28c784=_0x35c1e5['body'];var _0x2110c6;var _0x5de65d;if(_0x28c784[_0x33be('0x16')])throw _0x28c784;redis[_0x33be('0x4d')](_0x28c784['state'])['then'](function(_0x1c7376){if(!_0x1c7376)throw new Error(_0x33be('0x4e'));_0x2110c6=JSON[_0x33be('0x4f')](_0x1c7376);var _0x5bb9f3=Buffer[_0x33be('0x50')](_0x28c784[_0x33be('0x51')],_0x33be('0x52'))['toString']('ascii');_0x5de65d=JSON[_0x33be('0x4f')](_0x5bb9f3);if(!oauth[_0x33be('0x53')](_0x28c784[_0x33be('0x54')],_0x2110c6[_0x33be('0x55')]))throw new Error(_0x33be('0x56'));redis[_0x33be('0x57')](_0x28c784[_0x33be('0x51')]);return oauth[_0x33be('0x58')](_0x28c784[_0x33be('0x59')],_0x2110c6);})['then'](function(_0x387d6e){_0x2110c6[_0x33be('0x5a')]=_0x387d6e[_0x33be('0x5b')];_0x2110c6[_0x33be('0x5c')]=_0x387d6e[_0x33be('0x5d')];return db['CloudProvider'][_0x33be('0x47')]({'data5':_0x2110c6[_0x33be('0x5a')],'data6':_0x2110c6[_0x33be('0x5c')]},{'where':{'id':_0x2110c6['id']}});})[_0x33be('0x14')](function(){oauth['startRefreshInterval'](_0x2110c6);socket['emit'](_0x33be('0x5e'),{'id':_0x5de65d['id']});return;})[_0x33be('0x14')](respondWithStatusCode(_0x1aadfe,null))['catch'](function(_0xf517ee){if(_0x5de65d){socket[_0x33be('0x5f')](_0x33be('0x60'),{'id':_0x5de65d['id']});}if(!_0x2110c6){logger[_0x33be('0x16')](_0x33be('0x61'),_0xf517ee);return _0x1aadfe[_0x33be('0xc')](0x1f4)[_0x33be('0x19')](_0xf517ee[_0x33be('0x62')]);}logger[_0x33be('0x16')](_0x33be('0x63'),_0x2110c6['id'],JSON['stringify'](_0xf517ee));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index ed1b10f..83dd229 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 _0xf9e6=['exports','define','cloud_providers','lodash','api','moment','request-promise','path','rimraf','./cloudProvider.attributes'];(function(_0x10e2c9,_0x489aab){var _0x426947=function(_0x123624){while(--_0x123624){_0x10e2c9['push'](_0x10e2c9['shift']());}};_0x426947(++_0x489aab);}(_0xf9e6,0x1a7));var _0x6f9e=function(_0xde70c7,_0x1dba2e){_0xde70c7=_0xde70c7-0x0;var _0x598ed6=_0xf9e6[_0xde70c7];return _0x598ed6;};'use strict';var _=require(_0x6f9e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6f9e('0x1'));var moment=require(_0x6f9e('0x2'));var BPromise=require('bluebird');var rp=require(_0x6f9e('0x3'));var fs=require('fs');var path=require(_0x6f9e('0x4'));var rimraf=require(_0x6f9e('0x5'));var config=require('../../config/environment');var attributes=require(_0x6f9e('0x6'));module[_0x6f9e('0x7')]=function(_0x4fda76,_0x2bbbfc){return _0x4fda76[_0x6f9e('0x8')]('CloudProvider',attributes,{'tableName':_0x6f9e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c96=['path','rimraf','../../config/environment','./cloudProvider.attributes','exports','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3ab353,_0x5d5283){var _0x1e2285=function(_0x55804f){while(--_0x55804f){_0x3ab353['push'](_0x3ab353['shift']());}};_0x1e2285(++_0x5d5283);}(_0x6c96,0x1db));var _0x66c9=function(_0x162f74,_0x5b5a29){_0x162f74=_0x162f74-0x0;var _0x1026da=_0x6c96[_0x162f74];return _0x1026da;};'use strict';var _=require(_0x66c9('0x0'));var util=require(_0x66c9('0x1'));var logger=require(_0x66c9('0x2'))(_0x66c9('0x3'));var moment=require('moment');var BPromise=require(_0x66c9('0x4'));var rp=require(_0x66c9('0x5'));var fs=require('fs');var path=require(_0x66c9('0x6'));var rimraf=require(_0x66c9('0x7'));var config=require(_0x66c9('0x8'));var attributes=require(_0x66c9('0x9'));module[_0x66c9('0xa')]=function(_0x4b7be6,_0x352b6a){return _0x4b7be6['define'](_0x66c9('0xb'),attributes,{'tableName':_0x66c9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 7e1bbd2..5774c7b 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 _0x601e=['response_mode','form_post','scope','state','prompt','login','key','value','oauth2Claims','oauth2/','decode','payload','iss','issuer','aud','nonce','isAfter','unix','exp','resolve','then','CloudProvider','findOne','data6','data4','data3','POST','data5','access_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','bind','findAll','map','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','jsonwebtoken','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','defaults','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','/token','type','/.default','join','Dynamics365','data7','{TENANT_ID}','data2','code','from','toString','base64','hex','client_id','data1','response_type','redirect_uri'];(function(_0x22093a,_0xa7acf1){var _0x2f4989=function(_0x5bf12b){while(--_0x5bf12b){_0x22093a['push'](_0x22093a['shift']());}};_0x2f4989(++_0xa7acf1);}(_0x601e,0x1ef));var _0xe601=function(_0x43dc7e,_0x49a390){_0x43dc7e=_0x43dc7e-0x0;var _0x21e12d=_0x601e[_0x43dc7e];return _0x21e12d;};'use strict';var _=require(_0xe601('0x0'));var crypto=require(_0xe601('0x1'));var jwt=require(_0xe601('0x2'));var moment=require('moment');var Redis=require('ioredis');var rp=require(_0xe601('0x3'));var util=require(_0xe601('0x4'));var encryptor=require(_0xe601('0x5'));var config=require(_0xe601('0x6'));var logger=require(_0xe601('0x7'))(_0xe601('0x8'));var schedule=require(_0xe601('0x9'));var db=require(_0xe601('0xa'))['db'];config['redis']=_[_0xe601('0xb')](config[_0xe601('0xc')],{'host':_0xe601('0xd'),'port':0x18eb});var redis=new Redis(config[_0xe601('0xc')]);var MICROSOFT_AUTH_URL=_0xe601('0xe');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xe601('0xf'),'email',_0xe601('0x10'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0xe601('0x11'),_0xe601('0x12')],'Dynamics365':[_0xe601('0x13'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xe601('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0xfe134e){var _0x589f4a=_['map'](AZURE_AUTH_SCOPES[_0xfe134e[_0xe601('0x15')]]);if(_0xfe134e[_0xe601('0x15')]==='Dynamics365')_0x589f4a['push'](_0xfe134e['data7']+_0xe601('0x16'));return _0x589f4a[_0xe601('0x17')]('\x20');}function getAccessTokenScope(_0x24b9e5){if(_0x24b9e5[_0xe601('0x15')]==='Outlook365')return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x24b9e5[_0xe601('0x15')]===_0xe601('0x18'))return _0x24b9e5[_0xe601('0x19')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x4171b9,_0x4aacb8){var _0x5c44e0=MICROSOFT_AUTH_URL['replace'](_0xe601('0x1a'),_0x4171b9[_0xe601('0x1b')]);var _0x4e9f41=[_0xe601('0x1c'),'id_token'];var _0x44d76a=Buffer[_0xe601('0x1d')](JSON['stringify']({'id':_0x4aacb8}))[_0xe601('0x1e')](_0xe601('0x1f'));var _0x2db288=crypto['randomBytes'](0x10)[_0xe601('0x1e')](_0xe601('0x20'));var _0x4bc8be=getAuthorizationScopes(_0x4171b9);var _0x5c9a69=[{'key':_0xe601('0x21'),'value':_0x4171b9[_0xe601('0x22')]},{'key':_0xe601('0x23'),'value':encodeURIComponent(_0x4e9f41[_0xe601('0x17')]('\x20'))},{'key':_0xe601('0x24'),'value':_0x4171b9['data4']},{'key':_0xe601('0x25'),'value':_0xe601('0x26')},{'key':_0xe601('0x27'),'value':encodeURIComponent(_0x4bc8be)},{'key':_0xe601('0x28'),'value':_0x44d76a},{'key':'nonce','value':_0x2db288},{'key':_0xe601('0x29'),'value':_0xe601('0x2a')}];var _0x780f37=_0x5c44e0+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x5c9a69,function(_0x5c12cd){return _0x5c12cd[_0xe601('0x2b')]+'='+_0x5c12cd[_0xe601('0x2c')];})[_0xe601('0x17')]('&');_0x4171b9[_0xe601('0x2d')]={'issuer':_0x5c44e0['replace'](_0xe601('0x2e'),''),'audience':_0x4171b9[_0xe601('0x22')],'state':_0x44d76a,'nonce':_0x2db288};redis['set'](_0x44d76a,JSON['stringify'](_0x4171b9));return _0x780f37;}function isValidIdToken(_0x25f15d,_0xf9df78){try{var _0x26d4fc=jwt[_0xe601('0x2f')](_0x25f15d,{'complete':!![]});var _0xd37005=_0x26d4fc[_0xe601('0x30')];if(_0xd37005[_0xe601('0x31')]!==_0xf9df78[_0xe601('0x32')])return![];if(_0xd37005[_0xe601('0x33')]!==_0xf9df78['audience'])return![];if(_0xd37005[_0xe601('0x34')]!==_0xf9df78[_0xe601('0x34')])return![];if(moment()[_0xe601('0x35')](moment[_0xe601('0x36')](_0xd37005[_0xe601('0x37')])))return![];return!![];}catch(_0x3baa8f){throw _0x3baa8f;}}function refreshOauth2MicrosoftAccessToken(_0x143240){return Promise[_0xe601('0x38')]()[_0xe601('0x39')](function(){if(_0x143240['data3'])return _0x143240;return db[_0xe601('0x3a')][_0xe601('0x3b')]({'where':{'id':_0x143240['id']},'raw':!![]});})['then'](function(_0x925d9b){var _0x5c386d={'grant_type':'refresh_token','refresh_token':_0x925d9b[_0xe601('0x3c')],'scope':getAccessTokenScope(_0x925d9b),'redirect_uri':_0x925d9b[_0xe601('0x3d')],'client_id':_0x925d9b[_0xe601('0x22')],'client_secret':encryptor['decryptString'](_0x925d9b[_0xe601('0x3e')])};var _0x5dff16={'method':_0xe601('0x3f'),'uri':MICROSOFT_AUTH_URL['replace'](_0xe601('0x1a'),_0x925d9b[_0xe601('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5c386d,'json':!![]};return rp(_0x5dff16);})[_0xe601('0x39')](function(_0x17cc35){_0x143240[_0xe601('0x40')]=_0x17cc35[_0xe601('0x41')];_0x143240[_0xe601('0x3c')]=_0x17cc35['refresh_token'];return db[_0xe601('0x3a')][_0xe601('0x42')]({'data5':_0x143240[_0xe601('0x40')],'data6':_0x143240['data6']},{'where':{'id':_0x143240['id']}});})[_0xe601('0x39')](function(){return _0x143240;})[_0xe601('0x43')](function(_0x20b922){logger[_0xe601('0x44')](_0xe601('0x45'),_0x143240['id'],_0x20b922);});}function getOauth2MicrosoftAccessToken(_0x1d47c8,_0x474de1){var _0x61aaa6={'grant_type':'authorization_code','code':_0x1d47c8,'scope':getAccessTokenScope(_0x474de1),'redirect_uri':_0x474de1[_0xe601('0x3d')],'client_id':_0x474de1[_0xe601('0x22')],'client_secret':encryptor['decryptString'](_0x474de1[_0xe601('0x3e')])};var _0x3386d2={'method':_0xe601('0x3f'),'uri':MICROSOFT_AUTH_URL['replace'](_0xe601('0x1a'),_0x474de1[_0xe601('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x61aaa6,'json':!![]};return rp(_0x3386d2);}function startRefreshInterval(_0x567d46){var _0x1a23d9=schedule['intervals'];if(_0x1a23d9[_0x567d46['id']])clearInterval(_0x1a23d9[_0x567d46['id']]);_0x1a23d9[_0x567d46['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xe601('0x46')](this,{'id':_0x567d46['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x1a23d9;}function startAllRefreshIntervals(){return db[_0xe601('0x3a')][_0xe601('0x47')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xe601('0x39')](function(_0x50afd8){var _0x376aa2=_0x50afd8[_0xe601('0x48')](function(_0x33e6e7){return refreshOauth2MicrosoftAccessToken(_0x33e6e7)[_0xe601('0x39')](function(_0x5c700a){startRefreshInterval(_0x5c700a);});});return Promise[_0xe601('0x49')](_0x376aa2);})['catch'](function(_0x4b329c){var _0x46a600=_0x4b329c?util[_0xe601('0x4a')](_0x4b329c,{'showHidden':![],'depth':null}):'';logger[_0xe601('0x44')](_0xe601('0x4b'),_0x46a600);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xe9bf=['../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','push','/.default','Outlook365','data7','{TENANT_ID}','data2','from','stringify','toString','base64','randomBytes','client_id','response_type','join','redirect_uri','response_mode','form_post','key','oauth2Claims','replace','oauth2/','set','iss','issuer','aud','audience','nonce','unix','exp','resolve','then','data3','CloudProvider','refresh_token','data6','data4','data1','decryptString','POST','data5','access_token','update','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','intervals','bind','findAll','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api'];(function(_0x3f57f1,_0x1b1a0f){var _0x20ed13=function(_0x204ff9){while(--_0x204ff9){_0x3f57f1['push'](_0x3f57f1['shift']());}};_0x20ed13(++_0x1b1a0f);}(_0xe9bf,0x1be));var _0xfe9b=function(_0x4faf96,_0x489a92){_0x4faf96=_0x4faf96-0x0;var _0x464bd6=_0xe9bf[_0x4faf96];return _0x464bd6;};'use strict';var _=require(_0xfe9b('0x0'));var crypto=require(_0xfe9b('0x1'));var jwt=require(_0xfe9b('0x2'));var moment=require('moment');var Redis=require(_0xfe9b('0x3'));var rp=require(_0xfe9b('0x4'));var util=require(_0xfe9b('0x5'));var encryptor=require(_0xfe9b('0x6'));var config=require(_0xfe9b('0x7'));var logger=require(_0xfe9b('0x8'))(_0xfe9b('0x9'));var schedule=require(_0xfe9b('0xa'));var db=require(_0xfe9b('0xb'))['db'];config[_0xfe9b('0xc')]=_[_0xfe9b('0xd')](config[_0xfe9b('0xc')],{'host':_0xfe9b('0xe'),'port':0x18eb});var redis=new Redis(config[_0xfe9b('0xc')]);var MICROSOFT_AUTH_URL=_0xfe9b('0xf');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xfe9b('0x10'),_0xfe9b('0x11'),_0xfe9b('0x12'),_0xfe9b('0x13'),_0xfe9b('0x14'),_0xfe9b('0x15')],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xfe9b('0x16');var MICROSOFT_TOKEN_ENDPOINT=_0xfe9b('0x17');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x47a25f){var _0x574cea=_[_0xfe9b('0x18')](AZURE_AUTH_SCOPES[_0x47a25f[_0xfe9b('0x19')]]);if(_0x47a25f[_0xfe9b('0x19')]===_0xfe9b('0x1a'))_0x574cea[_0xfe9b('0x1b')](_0x47a25f['data7']+_0xfe9b('0x1c'));return _0x574cea['join']('\x20');}function getAccessTokenScope(_0x3a3531){if(_0x3a3531[_0xfe9b('0x19')]===_0xfe9b('0x1d'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x3a3531[_0xfe9b('0x19')]===_0xfe9b('0x1a'))return _0x3a3531[_0xfe9b('0x1e')]+_0xfe9b('0x1c');}function generateMicrosoftAuthorizationUrl(_0x4fcb3a,_0x279710){var _0x9723e3=MICROSOFT_AUTH_URL['replace'](_0xfe9b('0x1f'),_0x4fcb3a[_0xfe9b('0x20')]);var _0x129948=['code','id_token'];var _0x6b6e7e=Buffer[_0xfe9b('0x21')](JSON[_0xfe9b('0x22')]({'id':_0x279710}))[_0xfe9b('0x23')](_0xfe9b('0x24'));var _0x1e843b=crypto[_0xfe9b('0x25')](0x10)[_0xfe9b('0x23')]('hex');var _0x15941a=getAuthorizationScopes(_0x4fcb3a);var _0x470811=[{'key':_0xfe9b('0x26'),'value':_0x4fcb3a['data1']},{'key':_0xfe9b('0x27'),'value':encodeURIComponent(_0x129948[_0xfe9b('0x28')]('\x20'))},{'key':_0xfe9b('0x29'),'value':_0x4fcb3a['data4']},{'key':_0xfe9b('0x2a'),'value':_0xfe9b('0x2b')},{'key':'scope','value':encodeURIComponent(_0x15941a)},{'key':'state','value':_0x6b6e7e},{'key':'nonce','value':_0x1e843b},{'key':'prompt','value':'login'}];var _0x48d554=_0x9723e3+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x470811,function(_0x5423e9){return _0x5423e9[_0xfe9b('0x2c')]+'='+_0x5423e9['value'];})[_0xfe9b('0x28')]('&');_0x4fcb3a[_0xfe9b('0x2d')]={'issuer':_0x9723e3[_0xfe9b('0x2e')](_0xfe9b('0x2f'),''),'audience':_0x4fcb3a['data1'],'state':_0x6b6e7e,'nonce':_0x1e843b};redis[_0xfe9b('0x30')](_0x6b6e7e,JSON[_0xfe9b('0x22')](_0x4fcb3a));return _0x48d554;}function isValidIdToken(_0x2b1e96,_0x189e67){try{var _0x466fb1=jwt['decode'](_0x2b1e96,{'complete':!![]});var _0x3cd1d8=_0x466fb1['payload'];if(_0x3cd1d8[_0xfe9b('0x31')]!==_0x189e67[_0xfe9b('0x32')])return![];if(_0x3cd1d8[_0xfe9b('0x33')]!==_0x189e67[_0xfe9b('0x34')])return![];if(_0x3cd1d8['nonce']!==_0x189e67[_0xfe9b('0x35')])return![];if(moment()['isAfter'](moment[_0xfe9b('0x36')](_0x3cd1d8[_0xfe9b('0x37')])))return![];return!![];}catch(_0x50ffbe){throw _0x50ffbe;}}function refreshOauth2MicrosoftAccessToken(_0x3ff2bd){return Promise[_0xfe9b('0x38')]()[_0xfe9b('0x39')](function(){if(_0x3ff2bd[_0xfe9b('0x3a')])return _0x3ff2bd;return db[_0xfe9b('0x3b')]['findOne']({'where':{'id':_0x3ff2bd['id']},'raw':!![]});})[_0xfe9b('0x39')](function(_0x2c9de1){var _0x154eeb={'grant_type':_0xfe9b('0x3c'),'refresh_token':_0x2c9de1[_0xfe9b('0x3d')],'scope':getAccessTokenScope(_0x2c9de1),'redirect_uri':_0x2c9de1[_0xfe9b('0x3e')],'client_id':_0x2c9de1[_0xfe9b('0x3f')],'client_secret':encryptor[_0xfe9b('0x40')](_0x2c9de1[_0xfe9b('0x3a')])};var _0x4a7f6c={'method':_0xfe9b('0x41'),'uri':MICROSOFT_AUTH_URL['replace'](_0xfe9b('0x1f'),_0x2c9de1[_0xfe9b('0x20')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x154eeb,'json':!![]};return rp(_0x4a7f6c);})['then'](function(_0x2bfe2d){_0x3ff2bd[_0xfe9b('0x42')]=_0x2bfe2d[_0xfe9b('0x43')];_0x3ff2bd[_0xfe9b('0x3d')]=_0x2bfe2d[_0xfe9b('0x3c')];return db['CloudProvider'][_0xfe9b('0x44')]({'data5':_0x3ff2bd['data5'],'data6':_0x3ff2bd[_0xfe9b('0x3d')]},{'where':{'id':_0x3ff2bd['id']}});})[_0xfe9b('0x39')](function(){return _0x3ff2bd;})['catch'](function(_0xeffedd){logger[_0xfe9b('0x45')](_0xfe9b('0x46'),_0x3ff2bd['id'],_0xeffedd);});}function getOauth2MicrosoftAccessToken(_0x55cb06,_0x51ab06){var _0x366f72={'grant_type':'authorization_code','code':_0x55cb06,'scope':getAccessTokenScope(_0x51ab06),'redirect_uri':_0x51ab06[_0xfe9b('0x3e')],'client_id':_0x51ab06[_0xfe9b('0x3f')],'client_secret':encryptor[_0xfe9b('0x40')](_0x51ab06['data3'])};var _0x449ea8={'method':_0xfe9b('0x41'),'uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x51ab06[_0xfe9b('0x20')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x366f72,'json':!![]};return rp(_0x449ea8);}function startRefreshInterval(_0x5193b9){var _0x51087a=schedule[_0xfe9b('0x47')];if(_0x51087a[_0x5193b9['id']])clearInterval(_0x51087a[_0x5193b9['id']]);_0x51087a[_0x5193b9['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xfe9b('0x48')](this,{'id':_0x5193b9['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xfe9b('0x47')]=_0x51087a;}function startAllRefreshIntervals(){return db[_0xfe9b('0x3b')][_0xfe9b('0x49')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xfe9b('0x39')](function(_0x2eacc6){var _0x1ec486=_0x2eacc6[_0xfe9b('0x18')](function(_0x524df2){return refreshOauth2MicrosoftAccessToken(_0x524df2)[_0xfe9b('0x39')](function(_0x2a963f){startRefreshInterval(_0x2a963f);});});return Promise['all'](_0x1ec486);})['catch'](function(_0x5df103){var _0x5de00b=_0x5df103?util['inspect'](_0x5df103,{'showHidden':![],'depth':null}):'';logger[_0xfe9b('0x45')](_0xfe9b('0x4a'),_0x5de00b);});}module[_0xfe9b('0x4b')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 5eec945..4fb0952 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 _0x6d5e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x27ffef,_0x591e3b){var _0x3286bd=function(_0x432c04){while(--_0x432c04){_0x27ffef['push'](_0x27ffef['shift']());}};_0x3286bd(++_0x591e3b);}(_0x6d5e,0x103));var _0xe6d5=function(_0xaeaeda,_0x118c45){_0xaeaeda=_0xaeaeda-0x0;var _0x120269=_0x6d5e[_0xaeaeda];return _0x120269;};'use strict';var _=require(_0xe6d5('0x0'));var util=require(_0xe6d5('0x1'));var moment=require(_0xe6d5('0x2'));var BPromise=require(_0xe6d5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe6d5('0x4'));var db=require(_0xe6d5('0x5'))['db'];var utils=require(_0xe6d5('0x6'));var logger=require(_0xe6d5('0x7'))(_0xe6d5('0x8'));var config=require(_0xe6d5('0x9'));var jayson=require(_0xe6d5('0xa'));var client=jayson['client'][_0xe6d5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c0f87,_0x162375,_0x5cf296){return new BPromise(function(_0x572986,_0x52913e){return client['request'](_0x4c0f87,_0x5cf296)[_0xe6d5('0xc')](function(_0x65a619){logger[_0xe6d5('0xd')](_0xe6d5('0xe'),_0x162375,'request\x20sent');logger[_0xe6d5('0xf')](_0xe6d5('0x10'),_0x162375,_0xe6d5('0x11'),JSON['stringify'](_0x65a619));if(_0x65a619['error']){if(_0x65a619[_0xe6d5('0x12')][_0xe6d5('0x13')]===0x1f4){logger[_0xe6d5('0x12')](_0xe6d5('0xe'),_0x162375,_0x65a619[_0xe6d5('0x12')][_0xe6d5('0x14')]);return _0x52913e(_0x65a619[_0xe6d5('0x12')]['message']);}logger[_0xe6d5('0x12')](_0xe6d5('0xe'),_0x162375,_0x65a619[_0xe6d5('0x12')][_0xe6d5('0x14')]);return _0x572986(_0x65a619[_0xe6d5('0x12')][_0xe6d5('0x14')]);}else{logger[_0xe6d5('0xd')](_0xe6d5('0xe'),_0x162375,_0xe6d5('0x11'));_0x572986(_0x65a619['result'][_0xe6d5('0x14')]);}})[_0xe6d5('0x15')](function(_0x268ced){logger['error'](_0xe6d5('0xe'),_0x162375,_0x268ced);_0x52913e(_0x268ced);});});} \ No newline at end of file +var _0xc0d7=['rpc','../../config/environment','jayson/promise','http','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1cb2c5,_0x2589dc){var _0x1e373c=function(_0x55121a){while(--_0x55121a){_0x1cb2c5['push'](_0x1cb2c5['shift']());}};_0x1e373c(++_0x2589dc);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x16f0f4,_0xbd368b){_0x16f0f4=_0x16f0f4-0x0;var _0x3c3e20=_0xc0d7[_0x16f0f4];return _0x3c3e20;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7c0d('0x0'));var rs=require(_0x7c0d('0x1'));var fs=require('fs');var Redis=require(_0x7c0d('0x2'));var db=require(_0x7c0d('0x3'))['db'];var utils=require(_0x7c0d('0x4'));var logger=require(_0x7c0d('0x5'))(_0x7c0d('0x6'));var config=require(_0x7c0d('0x7'));var jayson=require(_0x7c0d('0x8'));var client=jayson['client'][_0x7c0d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14f205,_0x22101d,_0x3ffcff){return new BPromise(function(_0x5e6d16,_0x35c579){return client[_0x7c0d('0xa')](_0x14f205,_0x3ffcff)[_0x7c0d('0xb')](function(_0xfd38a0){logger['info'](_0x7c0d('0xc'),_0x22101d,_0x7c0d('0xd'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x22101d,_0x7c0d('0xd'),JSON[_0x7c0d('0xe')](_0xfd38a0));if(_0xfd38a0['error']){if(_0xfd38a0[_0x7c0d('0xf')][_0x7c0d('0x10')]===0x1f4){logger[_0x7c0d('0xf')](_0x7c0d('0xc'),_0x22101d,_0xfd38a0[_0x7c0d('0xf')][_0x7c0d('0x11')]);return _0x35c579(_0xfd38a0['error'][_0x7c0d('0x11')]);}logger[_0x7c0d('0xf')](_0x7c0d('0xc'),_0x22101d,_0xfd38a0[_0x7c0d('0xf')][_0x7c0d('0x11')]);return _0x5e6d16(_0xfd38a0[_0x7c0d('0xf')][_0x7c0d('0x11')]);}else{logger[_0x7c0d('0x12')]('CloudProvider,\x20%s,\x20%s',_0x22101d,_0x7c0d('0xd'));_0x5e6d16(_0xfd38a0['result'][_0x7c0d('0x11')]);}})['catch'](function(_0x2a8f3f){logger[_0x7c0d('0xf')](_0x7c0d('0xc'),_0x22101d,_0x2a8f3f);_0x35c579(_0x2a8f3f);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index e2700c5..e7f94c8 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 _0x5f66=['index','post','/:id','update','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','Router','./cloudProvider.controller','get','isAuthenticated'];(function(_0x5e9c45,_0x2ea79d){var _0x4af9fb=function(_0x50c8b4){while(--_0x50c8b4){_0x5e9c45['push'](_0x5e9c45['shift']());}};_0x4af9fb(++_0x2ea79d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'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')]);router[_0x65f6('0x2')]('/:id',auth[_0x65f6('0x3')](),controller['show']);router[_0x65f6('0x5')]('/',auth[_0x65f6('0x3')](),controller['create']);router['put'](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller[_0x65f6('0x7')]);router[_0x65f6('0x8')](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller['destroy']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x3')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x5')]('/oauth2/microsoft/callback',controller[_0x65f6('0xb')]);module['exports']=router; \ No newline at end of file +var _0x5f66=['index','post','/:id','update','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','Router','./cloudProvider.controller','get','isAuthenticated'];(function(_0x506ccb,_0x177378){var _0x390ec9=function(_0x5c5c4a){while(--_0x5c5c4a){_0x506ccb['push'](_0x506ccb['shift']());}};_0x390ec9(++_0x177378);}(_0x5f66,0x1a0));var _0x65f6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5f66[_0x13d07a];return _0x5ee0ee;};'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')]);router[_0x65f6('0x2')]('/:id',auth[_0x65f6('0x3')](),controller['show']);router[_0x65f6('0x5')]('/',auth[_0x65f6('0x3')](),controller['create']);router['put'](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller[_0x65f6('0x7')]);router[_0x65f6('0x8')](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller['destroy']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x3')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x5')]('/oauth2/microsoft/callback',controller[_0x65f6('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 8e61b81..d78fa58 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 _0xf418=['STRING','sequelize'];(function(_0x193878,_0x5eeff5){var _0x2ff8a0=function(_0x4e56aa){while(--_0x4e56aa){_0x193878['push'](_0x193878['shift']());}};_0x2ff8a0(++_0x5eeff5);}(_0xf418,0x1e3));var _0x8f41=function(_0x1cf7d0,_0x44cfa2){_0x1cf7d0=_0x1cf7d0-0x0;var _0x119a2a=_0xf418[_0x1cf7d0];return _0x119a2a;};'use strict';var Sequelize=require(_0x8f41('0x0'));module['exports']={'name':{'type':Sequelize[_0x8f41('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x8f41('0x1')]},'companyId':{'type':Sequelize[_0x8f41('0x1')]},'website':{'type':Sequelize[_0x8f41('0x1')]},'phone':{'type':Sequelize[_0x8f41('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8f41('0x1')]},'street':{'type':Sequelize[_0x8f41('0x1')]},'postalCode':{'type':Sequelize[_0x8f41('0x1')]},'city':{'type':Sequelize[_0x8f41('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x8f41('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x8f41('0x1')]},'sStreet':{'type':Sequelize[_0x8f41('0x1')]},'sPostalCode':{'type':Sequelize[_0x8f41('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc2ce=['STRING','name','sequelize','exports'];(function(_0x282582,_0x2ae191){var _0x85bc4e=function(_0x26be2b){while(--_0x26be2b){_0x282582['push'](_0x282582['shift']());}};_0x85bc4e(++_0x2ae191);}(_0xc2ce,0x82));var _0xec2c=function(_0x599c94,_0x464f0e){_0x599c94=_0x599c94-0x0;var _0x34e215=_0xc2ce[_0x599c94];return _0x34e215;};'use strict';var Sequelize=require(_0xec2c('0x0'));module[_0xec2c('0x1')]={'name':{'type':Sequelize[_0xec2c('0x2')],'unique':_0xec2c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xec2c('0x2')]},'companyId':{'type':Sequelize[_0xec2c('0x2')]},'website':{'type':Sequelize[_0xec2c('0x2')]},'phone':{'type':Sequelize[_0xec2c('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xec2c('0x2')]},'street':{'type':Sequelize[_0xec2c('0x2')]},'postalCode':{'type':Sequelize[_0xec2c('0x2')]},'city':{'type':Sequelize[_0xec2c('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xec2c('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xec2c('0x2')]},'sStreet':{'type':Sequelize[_0xec2c('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xec2c('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xec2c('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index fdea6e2..2471a13 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 _0x60df=['rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','omit','ids','getContacts','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','get','destroy','end','error','stack','name','describe','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','map','CmCompany','includeAll','include','findAll','catch','show','params'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x60df,0x1be));var _0xf60d=function(_0x530f0b,_0x1b595f){_0x530f0b=_0x530f0b-0x0;var _0xf259cc=_0x60df[_0x530f0b];return _0xf259cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf60d('0x0'));var zipdir=require(_0xf60d('0x1'));var jsonpatch=require(_0xf60d('0x2'));var rp=require('request-promise');var moment=require(_0xf60d('0x3'));var BPromise=require(_0xf60d('0x4'));var Mustache=require(_0xf60d('0x5'));var util=require(_0xf60d('0x6'));var path=require(_0xf60d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf60d('0x8'));var fs=require('fs');var fs_extra=require(_0xf60d('0x9'));var _=require(_0xf60d('0xa'));var squel=require(_0xf60d('0xb'));var crypto=require(_0xf60d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf60d('0xd'));var toCsv=require(_0xf60d('0xe'));var querystring=require(_0xf60d('0xf'));var Papa=require(_0xf60d('0x10'));var Redis=require(_0xf60d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf60d('0x12'));var as=require(_0xf60d('0x13'));var hardwareService=require(_0xf60d('0x14'));var logger=require(_0xf60d('0x15'))(_0xf60d('0x16'));var utils=require(_0xf60d('0x17'));var config=require(_0xf60d('0x18'));var licenseUtil=require(_0xf60d('0x19'));var db=require(_0xf60d('0x1a'))['db'];function respondWithStatusCode(_0x3d64bf,_0x124ea6){_0x124ea6=_0x124ea6||0xcc;return function(_0x21098a){if(_0x21098a){return _0x3d64bf[_0xf60d('0x1b')](_0x124ea6);}return _0x3d64bf[_0xf60d('0x1c')](_0x124ea6)['end']();};}function respondWithResult(_0x5bf3c8,_0xfa8e0a){_0xfa8e0a=_0xfa8e0a||0xc8;return function(_0x1f0678){if(_0x1f0678){return _0x5bf3c8[_0xf60d('0x1c')](_0xfa8e0a)[_0xf60d('0x1d')](_0x1f0678);}};}function respondWithFilteredResult(_0x8f3b0d,_0x44718a){return function(_0x1ce453){if(_0x1ce453){var _0x48395e=typeof _0x44718a[_0xf60d('0x1e')]===_0xf60d('0x1f')&&typeof _0x44718a[_0xf60d('0x20')]===_0xf60d('0x1f');var _0x4f8e9a=_0x1ce453[_0xf60d('0x21')];var _0x2391b0=_0x48395e?0x0:_0x44718a[_0xf60d('0x1e')];var _0x252d6b=_0x48395e?_0x1ce453[_0xf60d('0x21')]:_0x44718a[_0xf60d('0x1e')]+_0x44718a[_0xf60d('0x20')];var _0x40964e;if(_0x252d6b>=_0x4f8e9a){_0x252d6b=_0x4f8e9a;_0x40964e=0xc8;}else{_0x40964e=0xce;}_0x8f3b0d[_0xf60d('0x1c')](_0x40964e);return _0x8f3b0d[_0xf60d('0x22')](_0xf60d('0x23'),_0x2391b0+'-'+_0x252d6b+'/'+_0x4f8e9a)[_0xf60d('0x1d')](_0x1ce453);}return null;};}function patchUpdates(_0x2a510e){return function(_0x38b772){try{jsonpatch['apply'](_0x38b772,_0x2a510e,!![]);}catch(_0x36b158){return BPromise[_0xf60d('0x24')](_0x36b158);}return _0x38b772['save']();};}function saveUpdates(_0x530a59,_0xfb7987){return function(_0x39027b){if(_0x39027b){return _0x39027b[_0xf60d('0x25')](_0x530a59)[_0xf60d('0x26')](function(_0x32260c){return _0x32260c;});}return null;};}function removeEntity(_0x5368c1,_0x2c8a7a){return function(_0x2e424b){if(_0x2e424b){return _0x2e424b['destroy']()[_0xf60d('0x26')](function(){var _0x4d79ce=_0x2e424b[_0xf60d('0x27')]({'plain':!![]});var _0x58efcb='Companies';return db['UserProfileResource'][_0xf60d('0x28')]({'where':{'type':_0x58efcb,'resourceId':_0x4d79ce['id']}})[_0xf60d('0x26')](function(){return _0x2e424b;});})['then'](function(){_0x5368c1['status'](0xcc)[_0xf60d('0x29')]();});}};}function handleEntityNotFound(_0x4a409b,_0xac312a){return function(_0x4cbc0d){if(!_0x4cbc0d){_0x4a409b[_0xf60d('0x1b')](0x194);}return _0x4cbc0d;};}function handleError(_0x415f13,_0x419b07){_0x419b07=_0x419b07||0x1f4;return function(_0x1aeff5){logger[_0xf60d('0x2a')](_0x1aeff5[_0xf60d('0x2b')]);if(_0x1aeff5[_0xf60d('0x2c')]){delete _0x1aeff5['name'];}_0x415f13[_0xf60d('0x1c')](_0x419b07)['send'](_0x1aeff5);};}exports['index']=function(_0x1ff822,_0x5ec511){var _0x9ea7e2={},_0x2b7e7b={},_0x3d1b57={'count':0x0,'rows':[]};return db['CmCompany'][_0xf60d('0x2d')]()[_0xf60d('0x26')](function(_0xd0036f){_0x2b7e7b[_0xf60d('0x2e')]=_[_0xf60d('0x2f')](_0xd0036f);_0x2b7e7b[_0xf60d('0x30')]=_[_0xf60d('0x2f')](_0x1ff822[_0xf60d('0x30')]);_0x2b7e7b[_0xf60d('0x31')]=_['intersection'](_0x2b7e7b['model'],_0x2b7e7b[_0xf60d('0x30')]);_0x9ea7e2[_0xf60d('0x32')]=_[_0xf60d('0x33')](_0x2b7e7b['model'],qs[_0xf60d('0x34')](_0x1ff822['query']['fields']));_0x9ea7e2[_0xf60d('0x32')]=_0x9ea7e2[_0xf60d('0x32')][_0xf60d('0x35')]?_0x9ea7e2['attributes']:_0x2b7e7b['model'];if(!_0x1ff822[_0xf60d('0x30')][_0xf60d('0x36')](_0xf60d('0x37'))){_0x9ea7e2['limit']=qs[_0xf60d('0x20')](_0x1ff822[_0xf60d('0x30')][_0xf60d('0x20')]);_0x9ea7e2[_0xf60d('0x1e')]=qs[_0xf60d('0x1e')](_0x1ff822[_0xf60d('0x30')][_0xf60d('0x1e')]);}_0x9ea7e2[_0xf60d('0x38')]=qs[_0xf60d('0x39')](_0x1ff822[_0xf60d('0x30')][_0xf60d('0x39')]);_0x9ea7e2['where']=qs['filters'](_[_0xf60d('0x3a')](_0x1ff822[_0xf60d('0x30')],_0x2b7e7b[_0xf60d('0x31')]),_0xd0036f);if(_0x1ff822[_0xf60d('0x30')][_0xf60d('0x3b')]){_0x9ea7e2['where']=_[_0xf60d('0x3c')](_0x9ea7e2[_0xf60d('0x3d')],{'$or':_[_0xf60d('0x3e')](_0x9ea7e2[_0xf60d('0x32')],function(_0xd29b95){var _0x21b60c={};_0x21b60c[_0xd29b95]={'$like':'%'+_0x1ff822[_0xf60d('0x30')]['filter']+'%'};return _0x21b60c;})});}_0x9ea7e2=_[_0xf60d('0x3c')]({},_0x9ea7e2,_0x1ff822['options']);var _0x5497da={'where':_0x9ea7e2[_0xf60d('0x3d')]};return db[_0xf60d('0x3f')][_0xf60d('0x21')](_0x5497da)[_0xf60d('0x26')](function(_0x4e984e){_0x3d1b57[_0xf60d('0x21')]=_0x4e984e;if(_0x1ff822['query'][_0xf60d('0x40')]){_0x9ea7e2[_0xf60d('0x41')]=[{'all':!![]}];}return db[_0xf60d('0x3f')][_0xf60d('0x42')](_0x9ea7e2);})['then'](function(_0x3efdad){_0x3d1b57['rows']=_0x3efdad;return _0x3d1b57;})[_0xf60d('0x26')](respondWithFilteredResult(_0x5ec511,_0x9ea7e2))[_0xf60d('0x43')](handleError(_0x5ec511,null));})[_0xf60d('0x43')](handleError(_0x5ec511,null));};exports[_0xf60d('0x44')]=function(_0x25172f,_0x41684a){var _0x265e13={'raw':![],'where':{'id':_0x25172f[_0xf60d('0x45')]['id']}},_0x4afab2={};_0x4afab2[_0xf60d('0x2e')]=_[_0xf60d('0x2f')](db[_0xf60d('0x3f')][_0xf60d('0x46')]);_0x4afab2[_0xf60d('0x30')]=_['keys'](_0x25172f[_0xf60d('0x30')]);_0x4afab2[_0xf60d('0x31')]=_[_0xf60d('0x33')](_0x4afab2[_0xf60d('0x2e')],_0x4afab2[_0xf60d('0x30')]);_0x265e13[_0xf60d('0x32')]=_['intersection'](_0x4afab2['model'],qs[_0xf60d('0x34')](_0x25172f['query']['fields']));_0x265e13['attributes']=_0x265e13[_0xf60d('0x32')][_0xf60d('0x35')]?_0x265e13[_0xf60d('0x32')]:_0x4afab2[_0xf60d('0x2e')];if(_0x25172f[_0xf60d('0x30')][_0xf60d('0x40')]){_0x265e13[_0xf60d('0x41')]=[{'all':!![]}];}_0x265e13=_['merge']({},_0x265e13,_0x25172f[_0xf60d('0x47')]);return db['CmCompany'][_0xf60d('0x48')](_0x265e13)[_0xf60d('0x26')](handleEntityNotFound(_0x41684a,null))['then'](respondWithResult(_0x41684a,null))['catch'](handleError(_0x41684a,null));};exports[_0xf60d('0x49')]=function(_0x3fc99c,_0x5b7b1e){return db[_0xf60d('0x3f')]['create'](_0x3fc99c[_0xf60d('0x4a')],{})[_0xf60d('0x26')](function(_0x54733a){var _0x238d15=_0x3fc99c[_0xf60d('0x4b')][_0xf60d('0x27')]({'plain':!![]});if(!_0x238d15)throw new Error(_0xf60d('0x4c'));if(_0x238d15[_0xf60d('0x4d')]===_0xf60d('0x4b')){var _0x30847d=_0x54733a[_0xf60d('0x27')]({'plain':!![]});var _0x3c876d=_0xf60d('0x4e');return db[_0xf60d('0x4f')][_0xf60d('0x48')]({'where':{'name':_0x3c876d,'userProfileId':_0x238d15[_0xf60d('0x50')]},'raw':!![]})[_0xf60d('0x26')](function(_0x54bb2e){if(_0x54bb2e&&_0x54bb2e['autoAssociation']===0x0){return db['UserProfileResource'][_0xf60d('0x49')]({'name':_0x30847d[_0xf60d('0x2c')],'resourceId':_0x30847d['id'],'type':_0x54bb2e[_0xf60d('0x2c')],'sectionId':_0x54bb2e['id']},{})[_0xf60d('0x26')](function(){return _0x54733a;});}else{return _0x54733a;}})[_0xf60d('0x43')](function(_0xb495a){logger[_0xf60d('0x2a')](_0xf60d('0x51'),_0xb495a);throw _0xb495a;});}return _0x54733a;})['then'](respondWithResult(_0x5b7b1e,0xc9))[_0xf60d('0x43')](handleError(_0x5b7b1e,null));};exports[_0xf60d('0x25')]=function(_0x40b233,_0x5da4e1){if(_0x40b233[_0xf60d('0x4a')]['id']){delete _0x40b233['body']['id'];}return db['CmCompany']['find']({'where':{'id':_0x40b233[_0xf60d('0x45')]['id']}})[_0xf60d('0x26')](handleEntityNotFound(_0x5da4e1,null))[_0xf60d('0x26')](saveUpdates(_0x40b233[_0xf60d('0x4a')],null))[_0xf60d('0x26')](respondWithResult(_0x5da4e1,null))['catch'](handleError(_0x5da4e1,null));};exports[_0xf60d('0x28')]=function(_0x1e75a5,_0x2bce97){return db[_0xf60d('0x3f')][_0xf60d('0x48')]({'where':{'id':_0x1e75a5[_0xf60d('0x45')]['id']}})[_0xf60d('0x26')](handleEntityNotFound(_0x2bce97,null))[_0xf60d('0x26')](removeEntity(_0x2bce97,null))[_0xf60d('0x43')](handleError(_0x2bce97,null));};exports['describe']=function(_0x42780e,_0x391015){return db[_0xf60d('0x3f')]['describe']()[_0xf60d('0x26')](respondWithResult(_0x391015,null))['catch'](handleError(_0x391015,null));};exports[_0xf60d('0x52')]=function(_0x21f492,_0x55e118,_0xb466b3){return db['CmContact'][_0xf60d('0x48')]({'where':{'id':_0x21f492[_0xf60d('0x45')]['id']}})['then'](handleEntityNotFound(_0x55e118,null))['then'](function(_0x4b7493){if(_0x4b7493){return _0x4b7493[_0xf60d('0x52')](_0x21f492[_0xf60d('0x4a')]['ids'],_[_0xf60d('0x53')](_0x21f492['body'],[_0xf60d('0x54'),'id'])||{});}})['then'](respondWithResult(_0x55e118,null))['catch'](handleError(_0x55e118,null));};exports[_0xf60d('0x55')]=function(_0xbe920e,_0x2b7158,_0x501601){var _0x31f302={};var _0x5cf88d={};var _0x652036;var _0x195406;return db['CmCompany']['findOne']({'where':{'id':_0xbe920e['params']['id']}})[_0xf60d('0x26')](handleEntityNotFound(_0x2b7158,null))['then'](function(_0x203240){if(_0x203240){_0x652036=_0x203240;_0x5cf88d['model']=_[_0xf60d('0x2f')](db['CmContact'][_0xf60d('0x46')]);_0x5cf88d[_0xf60d('0x30')]=_[_0xf60d('0x2f')](_0xbe920e['query']);_0x5cf88d['filters']=_[_0xf60d('0x33')](_0x5cf88d['model'],_0x5cf88d[_0xf60d('0x30')]);_0x31f302[_0xf60d('0x32')]=_[_0xf60d('0x33')](_0x5cf88d[_0xf60d('0x2e')],qs[_0xf60d('0x34')](_0xbe920e['query'][_0xf60d('0x34')]));_0x31f302[_0xf60d('0x32')]=_0x31f302['attributes'][_0xf60d('0x35')]?_0x31f302[_0xf60d('0x32')]:_0x5cf88d['model'];_0x31f302[_0xf60d('0x38')]=qs[_0xf60d('0x39')](_0xbe920e[_0xf60d('0x30')][_0xf60d('0x39')]);_0x31f302[_0xf60d('0x3d')]=qs[_0xf60d('0x31')](_[_0xf60d('0x3a')](_0xbe920e[_0xf60d('0x30')],_0x5cf88d[_0xf60d('0x31')]));if(_0xbe920e[_0xf60d('0x30')][_0xf60d('0x3b')]){_0x31f302['where']=_[_0xf60d('0x3c')](_0x31f302[_0xf60d('0x3d')],{'$or':_[_0xf60d('0x3e')](_0x31f302[_0xf60d('0x32')],function(_0x2d5f10){var _0x42cee3={};_0x42cee3[_0x2d5f10]={'$like':'%'+_0xbe920e[_0xf60d('0x30')][_0xf60d('0x3b')]+'%'};return _0x42cee3;})});}_0x31f302=_[_0xf60d('0x3c')]({},_0x31f302,_0xbe920e[_0xf60d('0x47')]);return _0x652036['getContacts'](_0x31f302);}})[_0xf60d('0x26')](function(_0x35ef84){if(_0x35ef84){_0x195406=_0x35ef84[_0xf60d('0x35')];if(!_0xbe920e[_0xf60d('0x30')][_0xf60d('0x36')](_0xf60d('0x37'))){_0x31f302[_0xf60d('0x20')]=qs[_0xf60d('0x20')](_0xbe920e[_0xf60d('0x30')][_0xf60d('0x20')]);_0x31f302[_0xf60d('0x1e')]=qs['offset'](_0xbe920e['query'][_0xf60d('0x1e')]);}return _0x652036[_0xf60d('0x55')](_0x31f302);}})[_0xf60d('0x26')](function(_0x3eee4b){if(_0x3eee4b){return _0x3eee4b?{'count':_0x195406,'rows':_0x3eee4b}:null;}})[_0xf60d('0x26')](respondWithResult(_0x2b7158,null))[_0xf60d('0x43')](handleError(_0x2b7158,null));}; \ No newline at end of file +var _0x1667=['catch','show','params','keys','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','CmContact','ids','omit','getContacts','map','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','CmCompany','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows'];(function(_0x4947f0,_0x138314){var _0x11ad58=function(_0x563cf1){while(--_0x563cf1){_0x4947f0['push'](_0x4947f0['shift']());}};_0x11ad58(++_0x138314);}(_0x1667,0x1c9));var _0x7166=function(_0x36d203,_0x3653f3){_0x36d203=_0x36d203-0x0;var _0x2f9e62=_0x1667[_0x36d203];return _0x2f9e62;};'use strict';var emlformat=require(_0x7166('0x0'));var rimraf=require(_0x7166('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7166('0x2'));var moment=require('moment');var BPromise=require(_0x7166('0x3'));var Mustache=require(_0x7166('0x4'));var util=require('util');var path=require(_0x7166('0x5'));var sox=require(_0x7166('0x6'));var csv=require('to-csv');var ejs=require(_0x7166('0x7'));var fs=require('fs');var fs_extra=require(_0x7166('0x8'));var _=require('lodash');var squel=require(_0x7166('0x9'));var crypto=require(_0x7166('0xa'));var jsforce=require(_0x7166('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7166('0xc'));var querystring=require(_0x7166('0xd'));var Papa=require(_0x7166('0xe'));var Redis=require('ioredis');var authService=require(_0x7166('0xf'));var qs=require(_0x7166('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7166('0x11'));var logger=require(_0x7166('0x12'))(_0x7166('0x13'));var utils=require('../../config/utils');var config=require(_0x7166('0x14'));var licenseUtil=require(_0x7166('0x15'));var db=require(_0x7166('0x16'))['db'];function respondWithStatusCode(_0x2363e2,_0x4a36a1){_0x4a36a1=_0x4a36a1||0xcc;return function(_0x502b3f){if(_0x502b3f){return _0x2363e2[_0x7166('0x17')](_0x4a36a1);}return _0x2363e2[_0x7166('0x18')](_0x4a36a1)[_0x7166('0x19')]();};}function respondWithResult(_0x4b4ed6,_0x2e3e12){_0x2e3e12=_0x2e3e12||0xc8;return function(_0x1e343a){if(_0x1e343a){return _0x4b4ed6[_0x7166('0x18')](_0x2e3e12)[_0x7166('0x1a')](_0x1e343a);}};}function respondWithFilteredResult(_0x5f4378,_0x5c767a){return function(_0x283f3d){if(_0x283f3d){var _0x5ef5be=typeof _0x5c767a[_0x7166('0x1b')]===_0x7166('0x1c')&&typeof _0x5c767a[_0x7166('0x1d')]==='undefined';var _0x1b648e=_0x283f3d['count'];var _0x5edcb5=_0x5ef5be?0x0:_0x5c767a['offset'];var _0x3ccb43=_0x5ef5be?_0x283f3d[_0x7166('0x1e')]:_0x5c767a[_0x7166('0x1b')]+_0x5c767a[_0x7166('0x1d')];var _0x2ae971;if(_0x3ccb43>=_0x1b648e){_0x3ccb43=_0x1b648e;_0x2ae971=0xc8;}else{_0x2ae971=0xce;}_0x5f4378[_0x7166('0x18')](_0x2ae971);return _0x5f4378[_0x7166('0x1f')](_0x7166('0x20'),_0x5edcb5+'-'+_0x3ccb43+'/'+_0x1b648e)[_0x7166('0x1a')](_0x283f3d);}return null;};}function patchUpdates(_0x2fa327){return function(_0x4a8280){try{jsonpatch[_0x7166('0x21')](_0x4a8280,_0x2fa327,!![]);}catch(_0x59e997){return BPromise['reject'](_0x59e997);}return _0x4a8280['save']();};}function saveUpdates(_0x177bc1,_0x509f02){return function(_0x35e677){if(_0x35e677){return _0x35e677[_0x7166('0x22')](_0x177bc1)[_0x7166('0x23')](function(_0x21a696){return _0x21a696;});}return null;};}function removeEntity(_0x997c0c,_0xdcca07){return function(_0x1e02fb){if(_0x1e02fb){return _0x1e02fb[_0x7166('0x24')]()[_0x7166('0x23')](function(){var _0x112e7e=_0x1e02fb[_0x7166('0x25')]({'plain':!![]});var _0x524981=_0x7166('0x26');return db[_0x7166('0x27')]['destroy']({'where':{'type':_0x524981,'resourceId':_0x112e7e['id']}})[_0x7166('0x23')](function(){return _0x1e02fb;});})[_0x7166('0x23')](function(){_0x997c0c[_0x7166('0x18')](0xcc)[_0x7166('0x19')]();});}};}function handleEntityNotFound(_0x582f67,_0x480159){return function(_0x1282d4){if(!_0x1282d4){_0x582f67[_0x7166('0x17')](0x194);}return _0x1282d4;};}function handleError(_0x40b93c,_0x41d32d){_0x41d32d=_0x41d32d||0x1f4;return function(_0x10da9d){logger[_0x7166('0x28')](_0x10da9d[_0x7166('0x29')]);if(_0x10da9d[_0x7166('0x2a')]){delete _0x10da9d[_0x7166('0x2a')];}_0x40b93c['status'](_0x41d32d)[_0x7166('0x2b')](_0x10da9d);};}exports['index']=function(_0x2eed80,_0x445ab4){var _0xc861ed={},_0x429376={},_0x4347d0={'count':0x0,'rows':[]};return db[_0x7166('0x2c')]['describe']()['then'](function(_0x2a569a){_0x429376['model']=_['keys'](_0x2a569a);_0x429376[_0x7166('0x2d')]=_['keys'](_0x2eed80[_0x7166('0x2d')]);_0x429376[_0x7166('0x2e')]=_[_0x7166('0x2f')](_0x429376[_0x7166('0x30')],_0x429376[_0x7166('0x2d')]);_0xc861ed[_0x7166('0x31')]=_['intersection'](_0x429376[_0x7166('0x30')],qs[_0x7166('0x32')](_0x2eed80['query'][_0x7166('0x32')]));_0xc861ed[_0x7166('0x31')]=_0xc861ed['attributes'][_0x7166('0x33')]?_0xc861ed[_0x7166('0x31')]:_0x429376[_0x7166('0x30')];if(!_0x2eed80[_0x7166('0x2d')][_0x7166('0x34')](_0x7166('0x35'))){_0xc861ed['limit']=qs['limit'](_0x2eed80[_0x7166('0x2d')][_0x7166('0x1d')]);_0xc861ed[_0x7166('0x1b')]=qs['offset'](_0x2eed80[_0x7166('0x2d')][_0x7166('0x1b')]);}_0xc861ed[_0x7166('0x36')]=qs[_0x7166('0x37')](_0x2eed80['query']['sort']);_0xc861ed['where']=qs[_0x7166('0x2e')](_[_0x7166('0x38')](_0x2eed80['query'],_0x429376[_0x7166('0x2e')]),_0x2a569a);if(_0x2eed80['query'][_0x7166('0x39')]){_0xc861ed[_0x7166('0x3a')]=_[_0x7166('0x3b')](_0xc861ed['where'],{'$or':_['map'](_0xc861ed['attributes'],function(_0xc7f79){var _0x30ac62={};_0x30ac62[_0xc7f79]={'$like':'%'+_0x2eed80[_0x7166('0x2d')][_0x7166('0x39')]+'%'};return _0x30ac62;})});}_0xc861ed=_['merge']({},_0xc861ed,_0x2eed80[_0x7166('0x3c')]);var _0x1fa9d9={'where':_0xc861ed[_0x7166('0x3a')]};return db[_0x7166('0x2c')][_0x7166('0x1e')](_0x1fa9d9)['then'](function(_0x53b774){_0x4347d0['count']=_0x53b774;if(_0x2eed80[_0x7166('0x2d')][_0x7166('0x3d')]){_0xc861ed[_0x7166('0x3e')]=[{'all':!![]}];}return db[_0x7166('0x2c')][_0x7166('0x3f')](_0xc861ed);})[_0x7166('0x23')](function(_0x5547cf){_0x4347d0[_0x7166('0x40')]=_0x5547cf;return _0x4347d0;})[_0x7166('0x23')](respondWithFilteredResult(_0x445ab4,_0xc861ed))[_0x7166('0x41')](handleError(_0x445ab4,null));})[_0x7166('0x41')](handleError(_0x445ab4,null));};exports[_0x7166('0x42')]=function(_0xb6a3fd,_0x41537b){var _0x56cd93={'raw':![],'where':{'id':_0xb6a3fd[_0x7166('0x43')]['id']}},_0xf49a7e={};_0xf49a7e[_0x7166('0x30')]=_[_0x7166('0x44')](db[_0x7166('0x2c')][_0x7166('0x45')]);_0xf49a7e[_0x7166('0x2d')]=_[_0x7166('0x44')](_0xb6a3fd[_0x7166('0x2d')]);_0xf49a7e['filters']=_[_0x7166('0x2f')](_0xf49a7e[_0x7166('0x30')],_0xf49a7e[_0x7166('0x2d')]);_0x56cd93[_0x7166('0x31')]=_[_0x7166('0x2f')](_0xf49a7e[_0x7166('0x30')],qs[_0x7166('0x32')](_0xb6a3fd[_0x7166('0x2d')][_0x7166('0x32')]));_0x56cd93['attributes']=_0x56cd93['attributes'][_0x7166('0x33')]?_0x56cd93['attributes']:_0xf49a7e[_0x7166('0x30')];if(_0xb6a3fd['query'][_0x7166('0x3d')]){_0x56cd93[_0x7166('0x3e')]=[{'all':!![]}];}_0x56cd93=_['merge']({},_0x56cd93,_0xb6a3fd[_0x7166('0x3c')]);return db['CmCompany']['find'](_0x56cd93)[_0x7166('0x23')](handleEntityNotFound(_0x41537b,null))['then'](respondWithResult(_0x41537b,null))[_0x7166('0x41')](handleError(_0x41537b,null));};exports['create']=function(_0x2484ce,_0x4eaecd){return db[_0x7166('0x2c')][_0x7166('0x46')](_0x2484ce[_0x7166('0x47')],{})['then'](function(_0x3fdf49){var _0x48ef57=_0x2484ce['user']['get']({'plain':!![]});if(!_0x48ef57)throw new Error(_0x7166('0x48'));if(_0x48ef57[_0x7166('0x49')]===_0x7166('0x4a')){var _0x404bf3=_0x3fdf49[_0x7166('0x25')]({'plain':!![]});var _0x558e59=_0x7166('0x26');return db[_0x7166('0x4b')][_0x7166('0x4c')]({'where':{'name':_0x558e59,'userProfileId':_0x48ef57[_0x7166('0x4d')]},'raw':!![]})[_0x7166('0x23')](function(_0x58b118){if(_0x58b118&&_0x58b118[_0x7166('0x4e')]===0x0){return db[_0x7166('0x27')][_0x7166('0x46')]({'name':_0x404bf3[_0x7166('0x2a')],'resourceId':_0x404bf3['id'],'type':_0x58b118[_0x7166('0x2a')],'sectionId':_0x58b118['id']},{})[_0x7166('0x23')](function(){return _0x3fdf49;});}else{return _0x3fdf49;}})['catch'](function(_0x3f5918){logger[_0x7166('0x28')](_0x7166('0x4f'),_0x3f5918);throw _0x3f5918;});}return _0x3fdf49;})[_0x7166('0x23')](respondWithResult(_0x4eaecd,0xc9))[_0x7166('0x41')](handleError(_0x4eaecd,null));};exports[_0x7166('0x22')]=function(_0x506ca0,_0x436d14){if(_0x506ca0['body']['id']){delete _0x506ca0['body']['id'];}return db[_0x7166('0x2c')][_0x7166('0x4c')]({'where':{'id':_0x506ca0[_0x7166('0x43')]['id']}})['then'](handleEntityNotFound(_0x436d14,null))['then'](saveUpdates(_0x506ca0['body'],null))[_0x7166('0x23')](respondWithResult(_0x436d14,null))[_0x7166('0x41')](handleError(_0x436d14,null));};exports[_0x7166('0x24')]=function(_0x1ac159,_0x27fe44){return db[_0x7166('0x2c')][_0x7166('0x4c')]({'where':{'id':_0x1ac159[_0x7166('0x43')]['id']}})[_0x7166('0x23')](handleEntityNotFound(_0x27fe44,null))[_0x7166('0x23')](removeEntity(_0x27fe44,null))['catch'](handleError(_0x27fe44,null));};exports['describe']=function(_0x5ba9eb,_0x29fb78){return db[_0x7166('0x2c')][_0x7166('0x50')]()[_0x7166('0x23')](respondWithResult(_0x29fb78,null))[_0x7166('0x41')](handleError(_0x29fb78,null));};exports[_0x7166('0x51')]=function(_0xc87254,_0x2348a7,_0x20d975){return db[_0x7166('0x52')][_0x7166('0x4c')]({'where':{'id':_0xc87254[_0x7166('0x43')]['id']}})['then'](handleEntityNotFound(_0x2348a7,null))[_0x7166('0x23')](function(_0x6beafe){if(_0x6beafe){return _0x6beafe[_0x7166('0x51')](_0xc87254[_0x7166('0x47')][_0x7166('0x53')],_[_0x7166('0x54')](_0xc87254['body'],[_0x7166('0x53'),'id'])||{});}})[_0x7166('0x23')](respondWithResult(_0x2348a7,null))[_0x7166('0x41')](handleError(_0x2348a7,null));};exports[_0x7166('0x55')]=function(_0x4c971a,_0x2ca3b9,_0x4d866c){var _0x56d3eb={};var _0x1ccef1={};var _0x116b43;var _0x4dd486;return db[_0x7166('0x2c')]['findOne']({'where':{'id':_0x4c971a[_0x7166('0x43')]['id']}})[_0x7166('0x23')](handleEntityNotFound(_0x2ca3b9,null))[_0x7166('0x23')](function(_0x2a2451){if(_0x2a2451){_0x116b43=_0x2a2451;_0x1ccef1[_0x7166('0x30')]=_[_0x7166('0x44')](db[_0x7166('0x52')][_0x7166('0x45')]);_0x1ccef1[_0x7166('0x2d')]=_['keys'](_0x4c971a['query']);_0x1ccef1[_0x7166('0x2e')]=_[_0x7166('0x2f')](_0x1ccef1[_0x7166('0x30')],_0x1ccef1[_0x7166('0x2d')]);_0x56d3eb[_0x7166('0x31')]=_['intersection'](_0x1ccef1['model'],qs[_0x7166('0x32')](_0x4c971a['query'][_0x7166('0x32')]));_0x56d3eb[_0x7166('0x31')]=_0x56d3eb[_0x7166('0x31')][_0x7166('0x33')]?_0x56d3eb[_0x7166('0x31')]:_0x1ccef1['model'];_0x56d3eb[_0x7166('0x36')]=qs[_0x7166('0x37')](_0x4c971a[_0x7166('0x2d')][_0x7166('0x37')]);_0x56d3eb[_0x7166('0x3a')]=qs['filters'](_[_0x7166('0x38')](_0x4c971a[_0x7166('0x2d')],_0x1ccef1[_0x7166('0x2e')]));if(_0x4c971a[_0x7166('0x2d')][_0x7166('0x39')]){_0x56d3eb[_0x7166('0x3a')]=_[_0x7166('0x3b')](_0x56d3eb[_0x7166('0x3a')],{'$or':_[_0x7166('0x56')](_0x56d3eb[_0x7166('0x31')],function(_0x16d0b3){var _0x4a669b={};_0x4a669b[_0x16d0b3]={'$like':'%'+_0x4c971a[_0x7166('0x2d')][_0x7166('0x39')]+'%'};return _0x4a669b;})});}_0x56d3eb=_[_0x7166('0x3b')]({},_0x56d3eb,_0x4c971a[_0x7166('0x3c')]);return _0x116b43['getContacts'](_0x56d3eb);}})[_0x7166('0x23')](function(_0x50ead0){if(_0x50ead0){_0x4dd486=_0x50ead0['length'];if(!_0x4c971a[_0x7166('0x2d')][_0x7166('0x34')](_0x7166('0x35'))){_0x56d3eb[_0x7166('0x1d')]=qs[_0x7166('0x1d')](_0x4c971a[_0x7166('0x2d')]['limit']);_0x56d3eb[_0x7166('0x1b')]=qs[_0x7166('0x1b')](_0x4c971a[_0x7166('0x2d')][_0x7166('0x1b')]);}return _0x116b43[_0x7166('0x55')](_0x56d3eb);}})[_0x7166('0x23')](function(_0x2477c8){if(_0x2477c8){return _0x2477c8?{'count':_0x4dd486,'rows':_0x2477c8}:null;}})[_0x7166('0x23')](respondWithResult(_0x2ca3b9,null))['catch'](handleError(_0x2ca3b9,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index ea4d060..12e30a0 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 _0x94ce=['api','moment','bluebird','path','rimraf','exports','define','CmCompany','lodash','util'];(function(_0x312629,_0x39a7bd){var _0x587888=function(_0x40e7a1){while(--_0x40e7a1){_0x312629['push'](_0x312629['shift']());}};_0x587888(++_0x39a7bd);}(_0x94ce,0x148));var _0xe94c=function(_0x52ed18,_0x17d3de){_0x52ed18=_0x52ed18-0x0;var _0x8be0b5=_0x94ce[_0x52ed18];return _0x8be0b5;};'use strict';var _=require(_0xe94c('0x0'));var util=require(_0xe94c('0x1'));var logger=require('../../config/logger')(_0xe94c('0x2'));var moment=require(_0xe94c('0x3'));var BPromise=require(_0xe94c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe94c('0x5'));var rimraf=require(_0xe94c('0x6'));var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module[_0xe94c('0x7')]=function(_0x4b9ccd,_0x32be22){return _0x4b9ccd[_0xe94c('0x8')](_0xe94c('0x9'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x401c=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','CmCompany','cm_companies','lodash'];(function(_0x251e8c,_0x277c33){var _0x1e0c1d=function(_0x20b89c){while(--_0x20b89c){_0x251e8c['push'](_0x251e8c['shift']());}};_0x1e0c1d(++_0x277c33);}(_0x401c,0xd7));var _0xc401=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x401c[_0x4bb66f];return _0xf2772f;};'use strict';var _=require(_0xc401('0x0'));var util=require('util');var logger=require(_0xc401('0x1'))(_0xc401('0x2'));var moment=require(_0xc401('0x3'));var BPromise=require('bluebird');var rp=require(_0xc401('0x4'));var fs=require('fs');var path=require(_0xc401('0x5'));var rimraf=require(_0xc401('0x6'));var config=require(_0xc401('0x7'));var attributes=require('./cmCompany.attributes');module[_0xc401('0x8')]=function(_0x33520e,_0x1cd3c8){return _0x33520e[_0xc401('0x9')](_0xc401('0xa'),attributes,{'tableName':_0xc401('0xb'),'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 76b4f62..7cbe78b 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 _0xb079=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment'];(function(_0x131316,_0x7e6d94){var _0x466ada=function(_0x47cfad){while(--_0x47cfad){_0x131316['push'](_0x131316['shift']());}};_0x466ada(++_0x7e6d94);}(_0xb079,0xda));var _0x9b07=function(_0x441853,_0x4abb60){_0x441853=_0x441853-0x0;var _0x3780e5=_0xb079[_0x441853];return _0x3780e5;};'use strict';var _=require('lodash');var util=require(_0x9b07('0x0'));var moment=require(_0x9b07('0x1'));var BPromise=require('bluebird');var rs=require(_0x9b07('0x2'));var fs=require('fs');var Redis=require(_0x9b07('0x3'));var db=require(_0x9b07('0x4'))['db'];var utils=require(_0x9b07('0x5'));var logger=require(_0x9b07('0x6'))('rpc');var config=require(_0x9b07('0x7'));var jayson=require(_0x9b07('0x8'));var client=jayson[_0x9b07('0x9')][_0x9b07('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x564d05,_0x254601,_0x13d5bc){return new BPromise(function(_0x44cdba,_0x55b269){return client[_0x9b07('0xb')](_0x564d05,_0x13d5bc)['then'](function(_0x5b29b8){logger[_0x9b07('0xc')](_0x9b07('0xd'),_0x254601,'request\x20sent');logger[_0x9b07('0xe')](_0x9b07('0xf'),_0x254601,_0x9b07('0x10'),JSON[_0x9b07('0x11')](_0x5b29b8));if(_0x5b29b8['error']){if(_0x5b29b8[_0x9b07('0x12')][_0x9b07('0x13')]===0x1f4){logger[_0x9b07('0x12')](_0x9b07('0xd'),_0x254601,_0x5b29b8['error'][_0x9b07('0x14')]);return _0x55b269(_0x5b29b8[_0x9b07('0x12')]['message']);}logger[_0x9b07('0x12')](_0x9b07('0xd'),_0x254601,_0x5b29b8[_0x9b07('0x12')]['message']);return _0x44cdba(_0x5b29b8[_0x9b07('0x12')]['message']);}else{logger[_0x9b07('0xc')](_0x9b07('0xd'),_0x254601,_0x9b07('0x10'));_0x44cdba(_0x5b29b8[_0x9b07('0x15')][_0x9b07('0x14')]);}})['catch'](function(_0x120d17){logger['error'](_0x9b07('0xd'),_0x254601,_0x120d17);_0x55b269(_0x120d17);});});} \ No newline at end of file +var _0xce42=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x114fb8,_0x135c70){var _0x1901c7=function(_0x31b3a3){while(--_0x31b3a3){_0x114fb8['push'](_0x114fb8['shift']());}};_0x1901c7(++_0x135c70);}(_0xce42,0xe9));var _0x2ce4=function(_0x38a54d,_0x132fde){_0x38a54d=_0x38a54d-0x0;var _0x2d1b0e=_0xce42[_0x38a54d];return _0x2d1b0e;};'use strict';var _=require(_0x2ce4('0x0'));var util=require(_0x2ce4('0x1'));var moment=require(_0x2ce4('0x2'));var BPromise=require(_0x2ce4('0x3'));var rs=require(_0x2ce4('0x4'));var fs=require('fs');var Redis=require(_0x2ce4('0x5'));var db=require(_0x2ce4('0x6'))['db'];var utils=require(_0x2ce4('0x7'));var logger=require(_0x2ce4('0x8'))(_0x2ce4('0x9'));var config=require(_0x2ce4('0xa'));var jayson=require(_0x2ce4('0xb'));var client=jayson[_0x2ce4('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c8b54,_0x559987,_0xa745e0){return new BPromise(function(_0x2a481e,_0x1c29b2){return client['request'](_0x3c8b54,_0xa745e0)[_0x2ce4('0xd')](function(_0x5db144){logger[_0x2ce4('0xe')](_0x2ce4('0xf'),_0x559987,_0x2ce4('0x10'));logger[_0x2ce4('0x11')](_0x2ce4('0x12'),_0x559987,_0x2ce4('0x10'),JSON['stringify'](_0x5db144));if(_0x5db144[_0x2ce4('0x13')]){if(_0x5db144['error'][_0x2ce4('0x14')]===0x1f4){logger[_0x2ce4('0x13')](_0x2ce4('0xf'),_0x559987,_0x5db144['error'][_0x2ce4('0x15')]);return _0x1c29b2(_0x5db144['error'][_0x2ce4('0x15')]);}logger[_0x2ce4('0x13')](_0x2ce4('0xf'),_0x559987,_0x5db144['error']['message']);return _0x2a481e(_0x5db144[_0x2ce4('0x13')][_0x2ce4('0x15')]);}else{logger[_0x2ce4('0xe')](_0x2ce4('0xf'),_0x559987,_0x2ce4('0x10'));_0x2a481e(_0x5db144[_0x2ce4('0x16')]['message']);}})[_0x2ce4('0x17')](function(_0x2958d3){logger[_0x2ce4('0x13')]('CmCompany,\x20%s,\x20%s',_0x559987,_0x2958d3);_0x1c29b2(_0x2958d3);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 3a39052..3f27de4 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 _0x0c61=['Router','../../components/auth/service','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','delete','exports','util','express'];(function(_0x48b267,_0x169fc4){var _0x55cc70=function(_0x3cc7f7){while(--_0x3cc7f7){_0x48b267['push'](_0x48b267['shift']());}};_0x55cc70(++_0x169fc4);}(_0x0c61,0x70));var _0x10c6=function(_0x2c0be1,_0x1e88f2){_0x2c0be1=_0x2c0be1-0x0;var _0x3d4bd2=_0x0c61[_0x2c0be1];return _0x3d4bd2;};'use strict';var multer=require('multer');var util=require(_0x10c6('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x10c6('0x1'));var router=express[_0x10c6('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x10c6('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x10c6('0x4'));router[_0x10c6('0x5')]('/',auth[_0x10c6('0x6')](),controller[_0x10c6('0x7')]);router[_0x10c6('0x5')](_0x10c6('0x8'),auth['isAuthenticated'](),controller[_0x10c6('0x9')]);router[_0x10c6('0x5')](_0x10c6('0xa'),auth['isAuthenticated'](),controller[_0x10c6('0xb')]);router[_0x10c6('0x5')](_0x10c6('0xc'),auth[_0x10c6('0x6')](),controller[_0x10c6('0xd')]);router[_0x10c6('0xe')]('/',auth['isAuthenticated'](),controller[_0x10c6('0xf')]);router[_0x10c6('0xe')](_0x10c6('0xc'),auth[_0x10c6('0x6')](),controller[_0x10c6('0x10')]);router['put'](_0x10c6('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x10c6('0x11')]('/:id',auth[_0x10c6('0x6')](),controller['destroy']);module[_0x10c6('0x12')]=router; \ No newline at end of file +var _0x8209=['put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts','post','addContacts'];(function(_0x24351f,_0x5dc93e){var _0x5493d7=function(_0x668614){while(--_0x668614){_0x24351f['push'](_0x24351f['shift']());}};_0x5493d7(++_0x5dc93e);}(_0x8209,0x183));var _0x9820=function(_0x54efce,_0x443cb7){_0x54efce=_0x54efce-0x0;var _0x556f1c=_0x8209[_0x54efce];return _0x556f1c;};'use strict';var multer=require(_0x9820('0x0'));var util=require(_0x9820('0x1'));var path=require(_0x9820('0x2'));var timeout=require(_0x9820('0x3'));var express=require(_0x9820('0x4'));var router=express[_0x9820('0x5')]();var fs_extra=require(_0x9820('0x6'));var auth=require(_0x9820('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9820('0x8'));var controller=require(_0x9820('0x9'));router[_0x9820('0xa')]('/',auth[_0x9820('0xb')](),controller[_0x9820('0xc')]);router[_0x9820('0xa')](_0x9820('0xd'),auth[_0x9820('0xb')](),controller[_0x9820('0xe')]);router[_0x9820('0xa')](_0x9820('0xf'),auth[_0x9820('0xb')](),controller[_0x9820('0x10')]);router[_0x9820('0xa')](_0x9820('0x11'),auth['isAuthenticated'](),controller[_0x9820('0x12')]);router[_0x9820('0x13')]('/',auth[_0x9820('0xb')](),controller['create']);router[_0x9820('0x13')]('/:id/contacts',auth[_0x9820('0xb')](),controller[_0x9820('0x14')]);router[_0x9820('0x15')](_0x9820('0xf'),auth[_0x9820('0xb')](),controller[_0x9820('0x16')]);router['delete']('/:id',auth[_0x9820('0xb')](),controller['destroy']);module[_0x9820('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 1017931..3c570f9 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 _0x234c=['UNSIGNED','DATE','NOW','lodash','sequelize','STRING','TEXT','INTEGER'];(function(_0xfe1add,_0x30fec7){var _0x8ed176=function(_0x47d151){while(--_0x47d151){_0xfe1add['push'](_0xfe1add['shift']());}};_0x8ed176(++_0x30fec7);}(_0x234c,0x9b));var _0xc234=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x234c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc234('0x0'));var Sequelize=require(_0xc234('0x1'));module['exports']={'firstName':{'type':Sequelize[_0xc234('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xc234('0x2')]},'street':{'type':Sequelize[_0xc234('0x2')]},'postalCode':{'type':Sequelize[_0xc234('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xc234('0x2')]},'dateOfBirth':{'type':Sequelize[_0xc234('0x2')]},'description':{'type':Sequelize[_0xc234('0x3')]},'phone':{'type':Sequelize[_0xc234('0x2')]},'mobile':{'type':Sequelize[_0xc234('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xc234('0x2')]},'url':{'type':Sequelize[_0xc234('0x2')]},'facebook':{'type':Sequelize[_0xc234('0x2')]},'fb_data':{'type':Sequelize[_0xc234('0x2')]},'twitter':{'type':Sequelize[_0xc234('0x2')]},'skype':{'type':Sequelize[_0xc234('0x2')]},'teams':{'type':Sequelize[_0xc234('0x2')]},'viber':{'type':Sequelize[_0xc234('0x2')]},'line':{'type':Sequelize[_0xc234('0x2')]},'wechat':{'type':Sequelize[_0xc234('0x2')]},'telegram':{'type':Sequelize[_0xc234('0x2')]},'UserId':{'type':Sequelize[_0xc234('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc234('0x4')](0x2)[_0xc234('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xc234('0x6')],'defaultValue':Sequelize[_0xc234('0x7')]},'dialTimezone':{'type':Sequelize[_0xc234('0x2')]},'utcOffset':{'type':Sequelize[_0xc234('0x4')]}}; \ No newline at end of file +var _0x481d=['UNSIGNED','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x4ee408,_0x359050){var _0x477061=function(_0x5662fd){while(--_0x5662fd){_0x4ee408['push'](_0x4ee408['shift']());}};_0x477061(++_0x359050);}(_0x481d,0x1ba));var _0xd481=function(_0x53afa6,_0x59e786){_0x53afa6=_0x53afa6-0x0;var _0x51f86a=_0x481d[_0x53afa6];return _0x51f86a;};'use strict';var _=require(_0xd481('0x0'));var Sequelize=require(_0xd481('0x1'));module[_0xd481('0x2')]={'firstName':{'type':Sequelize[_0xd481('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xd481('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xd481('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xd481('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd481('0x4')]},'phone':{'type':Sequelize[_0xd481('0x3')]},'mobile':{'type':Sequelize[_0xd481('0x3')]},'fax':{'type':Sequelize[_0xd481('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xd481('0x3')]},'facebook':{'type':Sequelize[_0xd481('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xd481('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xd481('0x3')]},'viber':{'type':Sequelize[_0xd481('0x3')]},'line':{'type':Sequelize[_0xd481('0x3')]},'wechat':{'type':Sequelize[_0xd481('0x3')]},'telegram':{'type':Sequelize[_0xd481('0x3')]},'UserId':{'type':Sequelize[_0xd481('0x5')]},'AdditionalPhones':{'type':Sequelize[_0xd481('0x3')]},'priority':{'type':Sequelize[_0xd481('0x5')](0x2)[_0xd481('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xd481('0x7')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 71cb741..07c1b85 100644 --- a/server/api/cmContact/cmContact.controller.js +++ b/server/api/cmContact/cmContact.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 9133ff3..aea2e4b 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 _0x2f15=['emit','hasOwnProperty','hook','../../mysqldb','CmContact','setMaxListeners','save','update'];(function(_0x2170b1,_0x5c99e9){var _0x4be2c3=function(_0x790566){while(--_0x790566){_0x2170b1['push'](_0x2170b1['shift']());}};_0x4be2c3(++_0x5c99e9);}(_0x2f15,0x7b));var _0x52f1=function(_0x336d54,_0x4cb876){_0x336d54=_0x336d54-0x0;var _0x571a8d=_0x2f15[_0x336d54];return _0x571a8d;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x52f1('0x0'))['db'][_0x52f1('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x52f1('0x2')](0x0);var events={'afterCreate':_0x52f1('0x3'),'afterUpdate':_0x52f1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x167341){return function(_0x462f76,_0x2baee3,_0x2e5d48){CmContactEvents[_0x52f1('0x5')](_0x167341+':'+_0x462f76['id'],_0x462f76);CmContactEvents[_0x52f1('0x5')](_0x167341,_0x462f76);_0x2e5d48(null);};}for(var e in events){if(events[_0x52f1('0x6')](e)){var event=events[e];CmContact[_0x52f1('0x7')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0x6b20=['hook','exports','events','../../mysqldb','update','emit','hasOwnProperty'];(function(_0x20de88,_0x124d64){var _0x1405f0=function(_0x4d2bb){while(--_0x4d2bb){_0x20de88['push'](_0x20de88['shift']());}};_0x1405f0(++_0x124d64);}(_0x6b20,0x191));var _0x06b2=function(_0x595e07,_0x4bc525){_0x595e07=_0x595e07-0x0;var _0x398550=_0x6b20[_0x595e07];return _0x398550;};'use strict';var EventEmitter=require(_0x06b2('0x0'));var CmContact=require(_0x06b2('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x06b2('0x2'),'afterDestroy':'remove'};function emitEvent(_0x2221c9){return function(_0x1bc90c,_0x5b13d7,_0x7e9d5d){CmContactEvents['emit'](_0x2221c9+':'+_0x1bc90c['id'],_0x1bc90c);CmContactEvents[_0x06b2('0x3')](_0x2221c9,_0x1bc90c);_0x7e9d5d(null);};}for(var e in events){if(events[_0x06b2('0x4')](e)){var event=events[e];CmContact[_0x06b2('0x5')](e,emitEvent(event));}}module[_0x06b2('0x6')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 4a63491..3a0c785 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 _0x799a=['afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','add','minutes','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','error','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','dialCheckDuplicateType','CmList','Lists','always','onlyIfOpen','findAll','outbound','length','CmHopperBlack','Campaign','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','destroy','ContactId','VoiceQueueId','all','info','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','lastName','phone','mobile','fax','email','utf8mb4','utf8mb4_unicode_ci','models','get','cmContact'];(function(_0x3f260,_0x5766c4){var _0xdaf706=function(_0x274ea9){while(--_0x274ea9){_0x3f260['push'](_0x3f260['shift']());}};_0xdaf706(++_0x5766c4);}(_0x799a,0x1e1));var _0xa799=function(_0x3c0085,_0x220de2){_0x3c0085=_0x3c0085-0x0;var _0x5582d0=_0x799a[_0x3c0085];return _0x5582d0;};'use strict';var _=require(_0xa799('0x0'));var util=require(_0xa799('0x1'));var logger=require(_0xa799('0x2'))(_0xa799('0x3'));var moment=require(_0xa799('0x4'));var BPromise=require(_0xa799('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa799('0x6'));var rimraf=require(_0xa799('0x7'));var config=require('../../config/environment');var shared=require(_0xa799('0x8'));var attributes=require(_0xa799('0x9'));module[_0xa799('0xa')]=function(_0x4f6794,_0x344aaf){return _0x4f6794[_0xa799('0xb')](_0xa799('0xc'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':'phone','fields':['phone']},{'name':'fti_cm_contacts','fields':['firstName',_0xa799('0xd'),_0xa799('0xe'),_0xa799('0xf'),_0xa799('0x10'),_0xa799('0x11')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xa799('0x12'),'collate':_0xa799('0x13'),'hooks':{'afterCreate':function(_0x2c9869,_0x1fc38d,_0x1bfc17){var _0x49ff07=_0x4f6794[_0xa799('0x14')];var _0x27e6a2=_0x2c9869[_0xa799('0x15')]({'plain':!![]});function _0x39a85c(){return function(_0x2e2975){logger['error'](_0xa799('0x16'),_0xa799('0x17'),util[_0xa799('0x18')](_0x2e2975,{'showHidden':![],'depth':null}));};}function _0x3cfb39(_0x1bb3d0,_0x4b50c0){var _0x55e7e7=_0x4b50c0['scheduledat']?_0x4b50c0[_0xa799('0x19')]:moment()[_0xa799('0x1a')](_0xa799('0x1b'));return new BPromise(function(_0x53f025,_0x46dfcf){if(_[_0xa799('0x1c')](_0x4b50c0[_0xa799('0x1d')])){_0x53f025({'ret':_0x55e7e7});}else{_0x49ff07[_0xa799('0x1e')][_0xa799('0x1f')]({'where':{'id':_0x1bb3d0['id']}})[_0xa799('0x20')](function(_0x4c429f){if(!_[_0xa799('0x1c')](_0x4c429f)){var _0x508583=_0x4c429f[_0xa799('0x1d')];if(!_['isNil'](_0x508583)){var _0x27ee6c=shared[_0xa799('0x21')];var _0x474f60=_0x27ee6c[_0x508583];var _0x92352=_0x27ee6c[_0x4b50c0[_0xa799('0x1d')]];if(!_[_0xa799('0x1c')](_0x474f60)&&!_['isNil'](_0x92352)){var _0x2cadbe=_0x474f60[_0xa799('0x22')]-_0x92352[_0xa799('0x22')];_0x55e7e7=_0x4b50c0[_0xa799('0x19')]?_0x4b50c0[_0xa799('0x19')]:moment();var _0x5ee29e=moment(_0x55e7e7)[_0xa799('0x23')](_0x2cadbe,_0xa799('0x24'));_0x53f025({'ret':_0x5ee29e['format'](_0xa799('0x1b'))});}else _0x53f025({'ret':_0x55e7e7});}else _0x53f025({'ret':_0x55e7e7});}else{_0x53f025({'ret':_0x55e7e7});}});}});return 0xa;}var _0x3514f1=function(_0x575755){return new BPromise(function(_0x4283cd,_0x27e00b){_0x3cfb39(_0x575755,_0x27e6a2)[_0xa799('0x20')](function(_0xb363ea){_0x27e6a2[_0xa799('0x19')]=_0xb363ea[_0xa799('0x25')];_0x49ff07[_0xa799('0x26')][_0xa799('0x1f')]({'where':{'phone':_0x27e6a2[_0xa799('0xe')],'VoiceQueueId':_0x575755['id']}})[_0xa799('0x20')](function(_0x161e8c){if(!_['isNil'](_0x161e8c)){throw new Error(_0xa799('0x27')+_0x27e6a2[_0xa799('0xe')]+_0xa799('0x28')+_0x575755['id']);}return _0x49ff07[_0xa799('0x26')][_0xa799('0x29')]({'phone':_0x27e6a2[_0xa799('0xe')],'ContactId':_0x27e6a2['id'],'ListId':_0x27e6a2[_0xa799('0x2a')],'priority':_0x27e6a2['priority']?_0x27e6a2[_0xa799('0x2b')]:0x2,'scheduledat':_0x27e6a2[_0xa799('0x19')]?_0x27e6a2['scheduledat']:moment()[_0xa799('0x1a')](_0xa799('0x1b')),'callback':_0x27e6a2[_0xa799('0x2c')]?!![]:![],'callbackuniqueid':_0x27e6a2['callbackUniqueid']?_0x27e6a2['callbackUniqueid']:undefined,'callbackat':_0x27e6a2[_0xa799('0x2c')]?moment()[_0xa799('0x1a')](_0xa799('0x1b')):undefined,'VoiceQueueId':_0x575755['id']});})[_0xa799('0x2d')](function(_0x127924){_0x27e00b(_0x127924);});});});};var _0x5ce290=function(_0x117712){return new BPromise(function(_0x4aeb58,_0x580254){_0x3cfb39(_0x117712,_0x27e6a2)[_0xa799('0x20')](function(_0xf0c31c){_0x27e6a2[_0xa799('0x19')]=_0xf0c31c['ret'];_0x49ff07[_0xa799('0x26')][_0xa799('0x1f')]({'where':{'phone':_0x27e6a2['phone'],'VoiceQueueId':_0x117712['id']}})[_0xa799('0x20')](function(_0x31d38c){if(!_['isNil'](_0x31d38c)){throw new Error(_0xa799('0x27')+_0x27e6a2['phone']+_0xa799('0x2e')+_0x117712['id']);}return _0x49ff07['CmHopperFinal'][_0xa799('0x1f')]({'where':{'calleridnum':_0x27e6a2[_0xa799('0xe')],'VoiceQueueId':_0x117712['id']}});})[_0xa799('0x20')](function(_0x578f86){if(!_[_0xa799('0x1c')](_0x578f86)){throw new Error(_0xa799('0x2f')+_0x27e6a2[_0xa799('0xe')]+_0xa799('0x30')+_0x117712['id']);}return _0x49ff07[_0xa799('0x26')][_0xa799('0x29')]({'phone':_0x27e6a2[_0xa799('0xe')],'ContactId':_0x27e6a2['id'],'ListId':_0x27e6a2['ListId'],'priority':_0x27e6a2[_0xa799('0x2b')]?_0x27e6a2[_0xa799('0x2b')]:0x2,'scheduledat':_0x27e6a2[_0xa799('0x19')]?_0x27e6a2['scheduledat']:moment()['format'](_0xa799('0x1b')),'callback':_0x27e6a2[_0xa799('0x2c')]?!![]:![],'callbackuniqueid':_0x27e6a2['callbackUniqueid']?_0x27e6a2[_0xa799('0x2c')]:undefined,'callbackat':_0x27e6a2[_0xa799('0x2c')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x117712['id']});})[_0xa799('0x2d')](function(_0x16f6b9){_0x580254(_0x16f6b9);});});});};function _0x55f70d(){return function(_0x1cd8e5){logger[_0xa799('0x31')]('cmContact',_0xa799('0x17'),util['inspect'](_0x1cd8e5,{'showHidden':![],'depth':null}));};}function _0x3deff2(_0x3e0ecd,_0x4851dc){var _0x507c41=_0x4851dc['scheduledat']?_0x4851dc[_0xa799('0x19')]:moment()['format'](_0xa799('0x1b'));return new BPromise(function(_0x3120ea,_0x140c16){if(_[_0xa799('0x1c')](_0x4851dc[_0xa799('0x1d')])){_0x3120ea({'ret':_0x507c41});}else{_0x49ff07['Campaign'][_0xa799('0x1f')]({'where':{'id':_0x3e0ecd['id']}})[_0xa799('0x20')](function(_0x4eeb08){if(!_[_0xa799('0x1c')](_0x4eeb08)){var _0x3fe8a6=_0x4eeb08[_0xa799('0x1d')];if(!_['isNil'](_0x3fe8a6)){var _0x56c4ae=shared[_0xa799('0x21')];var _0x1106ed=_0x56c4ae[_0x3fe8a6];var _0x446264=_0x56c4ae[_0x4851dc[_0xa799('0x1d')]];if(!_[_0xa799('0x1c')](_0x1106ed)&&!_[_0xa799('0x1c')](_0x446264)){var _0x3c8ca8=_0x1106ed['utcOffset']-_0x446264['utcOffset'];_0x507c41=_0x4851dc[_0xa799('0x19')]?_0x4851dc['scheduledat']:moment();var _0x163b06=moment(_0x507c41)[_0xa799('0x23')](_0x3c8ca8,_0xa799('0x24'));_0x3120ea({'ret':_0x163b06[_0xa799('0x1a')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x3120ea({'ret':_0x507c41});}else _0x3120ea({'ret':_0x507c41});}else{_0x3120ea({'ret':_0x507c41});}});}});return 0xa;}var _0x151a59=function(_0x4f4752){return new BPromise(function(_0x3efaee,_0x5e27e7){_0x3deff2(_0x4f4752,_0x27e6a2)[_0xa799('0x20')](function(_0x3d5703){_0x27e6a2[_0xa799('0x19')]=_0x3d5703[_0xa799('0x25')];_0x49ff07[_0xa799('0x26')][_0xa799('0x1f')]({'where':{'phone':_0x27e6a2[_0xa799('0xe')],'CampaignId':_0x4f4752['id']}})[_0xa799('0x20')](function(_0x30c299){if(!_['isNil'](_0x30c299)){throw new Error(_0xa799('0x27')+_0x27e6a2[_0xa799('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x4f4752['id']);}return _0x49ff07[_0xa799('0x26')][_0xa799('0x29')]({'phone':_0x27e6a2['phone'],'ContactId':_0x27e6a2['id'],'ListId':_0x27e6a2[_0xa799('0x2a')],'priority':_0x27e6a2[_0xa799('0x2b')]?_0x27e6a2[_0xa799('0x2b')]:0x2,'scheduledat':_0x27e6a2[_0xa799('0x19')]?_0x27e6a2[_0xa799('0x19')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x27e6a2[_0xa799('0x2c')]?!![]:![],'callbackuniqueid':_0x27e6a2[_0xa799('0x2c')]?_0x27e6a2[_0xa799('0x2c')]:undefined,'callbackat':_0x27e6a2['callbackUniqueid']?moment()[_0xa799('0x1a')](_0xa799('0x1b')):undefined,'CampaignId':_0x4f4752['id']});})[_0xa799('0x2d')](function(_0x3f8256){_0x5e27e7(_0x3f8256);});});});};var _0x45c228=function(_0x4489ca){return new BPromise(function(_0x870364,_0x1330ba){_0x3deff2(_0x4489ca,_0x27e6a2)['then'](function(_0x4456e3){_0x27e6a2['scheduledat']=_0x4456e3[_0xa799('0x25')];_0x49ff07[_0xa799('0x26')][_0xa799('0x1f')]({'where':{'phone':_0x27e6a2[_0xa799('0xe')],'CampaignId':_0x4489ca['id']}})['then'](function(_0x100797){if(!_[_0xa799('0x1c')](_0x100797)){throw new Error(_0xa799('0x27')+_0x27e6a2[_0xa799('0xe')]+_0xa799('0x32')+_0x4489ca['id']);}return _0x49ff07[_0xa799('0x33')][_0xa799('0x1f')]({'where':{'calleridnum':_0x27e6a2[_0xa799('0xe')],'CampaignId':_0x4489ca['id']}});})['then'](function(_0x9ad5ca){if(!_[_0xa799('0x1c')](_0x9ad5ca)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x27e6a2[_0xa799('0xe')]+_0xa799('0x34')+_0x4489ca['id']);}return _0x49ff07[_0xa799('0x26')][_0xa799('0x29')]({'phone':_0x27e6a2[_0xa799('0xe')],'ContactId':_0x27e6a2['id'],'ListId':_0x27e6a2[_0xa799('0x2a')],'priority':_0x27e6a2[_0xa799('0x2b')]?_0x27e6a2[_0xa799('0x2b')]:0x2,'scheduledat':_0x27e6a2[_0xa799('0x19')]?_0x27e6a2['scheduledat']:moment()[_0xa799('0x1a')](_0xa799('0x1b')),'callback':_0x27e6a2[_0xa799('0x2c')]?!![]:![],'callbackuniqueid':_0x27e6a2[_0xa799('0x2c')]?_0x27e6a2['callbackUniqueid']:undefined,'callbackat':_0x27e6a2[_0xa799('0x2c')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x4489ca['id']});})[_0xa799('0x2d')](function(_0x2ca613){_0x1330ba(_0x2ca613);});});});};if(_0x27e6a2['ListId']){_0x49ff07[_0xa799('0x1e')]['findAll']({'where':{'type':'outbound'},'attributes':['id',_0xa799('0x35'),'dialTimezone'],'include':[{'model':_0x49ff07[_0xa799('0x36')],'as':_0xa799('0x37'),'where':{'id':_0x27e6a2[_0xa799('0x2a')]}}]})[_0xa799('0x20')](function(_0x33ae63){if(_0x33ae63){var _0x3ad0e1=[];for(var _0x1aef1e=0x0,_0x1a79c3;_0x1aef1e<_0x33ae63['length'];_0x1aef1e+=0x1){_0x1a79c3=_0x33ae63[_0x1aef1e]['get']({'plain':!![]});switch(_0x1a79c3[_0xa799('0x35')]){case _0xa799('0x38'):_0x5ce290(_0x1a79c3)[_0xa799('0x2d')](_0x39a85c());break;case _0xa799('0x39'):_0x3514f1(_0x1a79c3)['catch'](_0x39a85c());break;default:_0x3deff2(_0x1a79c3,_0x27e6a2)['then'](function(_0x32d05d){_0x27e6a2[_0xa799('0x19')]=_0x32d05d[_0xa799('0x25')];_0x49ff07[_0xa799('0x26')][_0xa799('0x29')]({'phone':_0x27e6a2[_0xa799('0xe')],'ContactId':_0x27e6a2['id'],'ListId':_0x27e6a2['ListId'],'scheduledat':_0x27e6a2[_0xa799('0x19')]?_0x27e6a2['scheduledat']:moment()['format'](_0xa799('0x1b')),'priority':_0x27e6a2['priority']?_0x27e6a2[_0xa799('0x2b')]:0x2,'callback':_0x27e6a2[_0xa799('0x2c')]?!![]:![],'callbackuniqueid':_0x27e6a2[_0xa799('0x2c')]?_0x27e6a2['callbackUniqueid']:undefined,'callbackat':_0x27e6a2[_0xa799('0x2c')]?moment()[_0xa799('0x1a')](_0xa799('0x1b')):undefined,'VoiceQueueId':_0x1a79c3['id']})[_0xa799('0x2d')](_0x39a85c());});}}}})[_0xa799('0x20')](function(){return _0x49ff07[_0xa799('0x1e')][_0xa799('0x3a')]({'where':{'type':_0xa799('0x3b')},'attributes':['id'],'include':[{'model':_0x49ff07['CmList'],'as':'BlackLists','where':{'id':_0x27e6a2[_0xa799('0x2a')]}}]})['then'](function(_0x54fc0c){if(_0x54fc0c){var _0x48aef5=[];for(var _0x2720f3=0x0,_0x156527;_0x2720f3<_0x54fc0c[_0xa799('0x3c')];_0x2720f3+=0x1){_0x156527=_0x54fc0c[_0x2720f3][_0xa799('0x15')]({'plain':!![]});_0x49ff07[_0xa799('0x3d')]['create']({'phone':_0x27e6a2[_0xa799('0xe')],'ContactId':_0x27e6a2['id'],'ListId':_0x27e6a2[_0xa799('0x2a')],'VoiceQueueId':_0x156527['id']})[_0xa799('0x2d')](function(_0xf3d517){logger['error']('cmContact,\x20%s,\x20%s','afterCreate',_0xf3d517['message']);});}}});})[_0xa799('0x20')](function(){return _0x49ff07[_0xa799('0x3e')][_0xa799('0x3a')]({'attributes':['id',_0xa799('0x35'),_0xa799('0x1d')],'include':[{'model':_0x49ff07['CmList'],'as':_0xa799('0x37'),'where':{'id':_0x27e6a2[_0xa799('0x2a')]}}]})['then'](function(_0x52bddb){if(_0x52bddb){var _0x2c5041=[];for(var _0xb2be1f=0x0,_0x1996c0;_0xb2be1f<_0x52bddb[_0xa799('0x3c')];_0xb2be1f+=0x1){_0x1996c0=_0x52bddb[_0xb2be1f][_0xa799('0x15')]({'plain':!![]});switch(_0x1996c0[_0xa799('0x35')]){case _0xa799('0x38'):_0x45c228(_0x1996c0)[_0xa799('0x2d')](_0x55f70d());break;case _0xa799('0x39'):_0x151a59(_0x1996c0)[_0xa799('0x2d')](_0x55f70d());break;default:_0x49ff07[_0xa799('0x26')]['create']({'phone':_0x27e6a2[_0xa799('0xe')],'ContactId':_0x27e6a2['id'],'ListId':_0x27e6a2[_0xa799('0x2a')],'scheduledat':_0x27e6a2['scheduledat']?_0x27e6a2[_0xa799('0x19')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x27e6a2[_0xa799('0x2b')]?_0x27e6a2[_0xa799('0x2b')]:0x2,'callback':_0x27e6a2[_0xa799('0x2c')]?!![]:![],'callbackuniqueid':_0x27e6a2[_0xa799('0x2c')]?_0x27e6a2[_0xa799('0x2c')]:undefined,'callbackat':_0x27e6a2[_0xa799('0x2c')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x1996c0['id']})[_0xa799('0x2d')](_0x55f70d());}}}});})[_0xa799('0x20')](function(){return _0x49ff07['Campaign']['findAll']({'attributes':['id'],'include':[{'model':_0x49ff07[_0xa799('0x36')],'as':'BlackLists','where':{'id':_0x27e6a2['ListId']}}]})[_0xa799('0x20')](function(_0x29d203){if(_0x29d203){var _0x133b8e=[];for(var _0x2c1595=0x0,_0x1d0d5c;_0x2c1595<_0x29d203[_0xa799('0x3c')];_0x2c1595+=0x1){_0x1d0d5c=_0x29d203[_0x2c1595][_0xa799('0x15')]({'plain':!![]});_0x49ff07['CmHopperBlack'][_0xa799('0x29')]({'phone':_0x27e6a2[_0xa799('0xe')],'ContactId':_0x27e6a2['id'],'ListId':_0x27e6a2[_0xa799('0x2a')],'CampaignId':_0x1d0d5c['id']})[_0xa799('0x2d')](function(_0x2da844){logger['error'](_0xa799('0x3f'),'afterCreate',_0x2da844[_0xa799('0x40')]);});}}});})[_0xa799('0x20')](function(){_0x1bfc17();})[_0xa799('0x2d')](function(_0x4b12e4){logger['error'](_0xa799('0x3f'),_0xa799('0x17'),_0x4b12e4[_0xa799('0x40')]);_0x1bfc17(_0x4b12e4);});}else{_0x1bfc17(new Error(_0xa799('0x41')));}},'afterDestroy':function(_0x264bb5,_0x14700a,_0x44b944){var _0x2a3625=_0x4f6794[_0xa799('0x14')];var _0x39a973=_0x264bb5[_0xa799('0x15')]({'plain':!![]});return _0x2a3625[_0xa799('0x26')][_0xa799('0x3a')]({'raw':!![],'where':{'ListId':_0x39a973[_0xa799('0x2a')],'ContactId':_0x39a973['id']}})[_0xa799('0x20')](function(_0x5a8155){if(!_['isEmpty'](_0x5a8155)){var _0x455da8=[];for(var _0x4aac68=0x0;_0x4aac68<_0x5a8155[_0xa799('0x3c')];_0x4aac68+=0x1){var _0x421a3c=_0x2a3625['CmHopper'][_0xa799('0x42')]({'where':{'ListId':_0x5a8155[_0x4aac68][_0xa799('0x2a')],'ContactId':_0x5a8155[_0x4aac68][_0xa799('0x43')],'VoiceQueueId':_0x5a8155[_0x4aac68][_0xa799('0x44')],'CampaignId':_0x5a8155[_0x4aac68]['CampaignId']}});_0x455da8['push'](_0x421a3c);}return BPromise[_0xa799('0x45')](_0x455da8);}})[_0xa799('0x20')](function(_0x8e807f){logger[_0xa799('0x46')]('[CmContact][afterDestroy][Succesfull]',util[_0xa799('0x18')](_0x8e807f,{'showHidden':![],'depth':null}));_0x44b944();})['catch'](function(_0x59b3bb){logger[_0xa799('0x31')](_0xa799('0x47'),util[_0xa799('0x18')](_0x59b3bb,{'showHidden':![],'depth':null}));_0x44b944(_0x59b3bb);});}}});}; \ No newline at end of file +var _0xf8f3=['CmList','Lists','length','always','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','findAll','onlyIfOpen','models','isEmpty','destroy','VoiceQueueId','CampaignId','push','info','[CmContact][afterDestroy][Succesfull]','util','../../config/logger','api','moment','bluebird','../../config/environment/shared','./cmContact.attributes','exports','define','cm_contacts','phone','fti_cm_contacts','firstName','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','get','error','cmContact','afterCreate','inspect','scheduledat','format','dialTimezone','VoiceQueue','findOne','then','isNil','timezones','utcOffset','YYYY-MM-DD\x20HH:mm:ss','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','minutes','ret','\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'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf8f3,0xe1));var _0x3f8f=function(_0x38bf4e,_0x321bf7){_0x38bf4e=_0x38bf4e-0x0;var _0x5dbf10=_0xf8f3[_0x38bf4e];return _0x5dbf10;};'use strict';var _=require('lodash');var util=require(_0x3f8f('0x0'));var logger=require(_0x3f8f('0x1'))(_0x3f8f('0x2'));var moment=require(_0x3f8f('0x3'));var BPromise=require(_0x3f8f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var shared=require(_0x3f8f('0x5'));var attributes=require(_0x3f8f('0x6'));module[_0x3f8f('0x7')]=function(_0x9d07e9,_0x1dd8eb){return _0x9d07e9[_0x3f8f('0x8')]('CmContact',attributes,{'tableName':_0x3f8f('0x9'),'paranoid':!![],'indexes':[{'name':_0x3f8f('0xa'),'fields':[_0x3f8f('0xa')]},{'name':_0x3f8f('0xb'),'fields':[_0x3f8f('0xc'),'lastName',_0x3f8f('0xa'),'mobile',_0x3f8f('0xd'),'email'],'type':_0x3f8f('0xe')}],'timestamps':!![],'charset':_0x3f8f('0xf'),'collate':_0x3f8f('0x10'),'hooks':{'afterCreate':function(_0x655050,_0x4ed040,_0x4a92f9){var _0x3bcfb5=_0x9d07e9['models'];var _0x43a502=_0x655050[_0x3f8f('0x11')]({'plain':!![]});function _0x20202f(){return function(_0x4df706){logger[_0x3f8f('0x12')](_0x3f8f('0x13'),_0x3f8f('0x14'),util[_0x3f8f('0x15')](_0x4df706,{'showHidden':![],'depth':null}));};}function _0x290160(_0x4bf6b3,_0xf3c561){var _0xb156a4=_0xf3c561['scheduledat']?_0xf3c561[_0x3f8f('0x16')]:moment()[_0x3f8f('0x17')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x8c70f2,_0x53cba6){if(_['isNil'](_0xf3c561[_0x3f8f('0x18')])){_0x8c70f2({'ret':_0xb156a4});}else{_0x3bcfb5[_0x3f8f('0x19')][_0x3f8f('0x1a')]({'where':{'id':_0x4bf6b3['id']}})[_0x3f8f('0x1b')](function(_0x46a00a){if(!_['isNil'](_0x46a00a)){var _0x3fdc5f=_0x46a00a[_0x3f8f('0x18')];if(!_[_0x3f8f('0x1c')](_0x3fdc5f)){var _0x52ed19=shared[_0x3f8f('0x1d')];var _0x4b5929=_0x52ed19[_0x3fdc5f];var _0x10ce38=_0x52ed19[_0xf3c561[_0x3f8f('0x18')]];if(!_[_0x3f8f('0x1c')](_0x4b5929)&&!_[_0x3f8f('0x1c')](_0x10ce38)){var _0xddb7c0=_0x4b5929[_0x3f8f('0x1e')]-_0x10ce38['utcOffset'];_0xb156a4=_0xf3c561[_0x3f8f('0x16')]?_0xf3c561[_0x3f8f('0x16')]:moment();var _0x2a4b53=moment(_0xb156a4)['add'](_0xddb7c0,'minutes');_0x8c70f2({'ret':_0x2a4b53[_0x3f8f('0x17')](_0x3f8f('0x1f'))});}else _0x8c70f2({'ret':_0xb156a4});}else _0x8c70f2({'ret':_0xb156a4});}else{_0x8c70f2({'ret':_0xb156a4});}});}});return 0xa;}var _0x3139c7=function(_0xe75c6){return new BPromise(function(_0xa548a3,_0x2f6acb){_0x290160(_0xe75c6,_0x43a502)['then'](function(_0x5eb48f){_0x43a502[_0x3f8f('0x16')]=_0x5eb48f['ret'];_0x3bcfb5[_0x3f8f('0x20')]['findOne']({'where':{'phone':_0x43a502[_0x3f8f('0xa')],'VoiceQueueId':_0xe75c6['id']}})['then'](function(_0x2ffe96){if(!_[_0x3f8f('0x1c')](_0x2ffe96)){throw new Error(_0x3f8f('0x21')+_0x43a502['phone']+_0x3f8f('0x22')+_0xe75c6['id']);}return _0x3bcfb5[_0x3f8f('0x20')][_0x3f8f('0x23')]({'phone':_0x43a502['phone'],'ContactId':_0x43a502['id'],'ListId':_0x43a502[_0x3f8f('0x24')],'priority':_0x43a502['priority']?_0x43a502[_0x3f8f('0x25')]:0x2,'scheduledat':_0x43a502['scheduledat']?_0x43a502['scheduledat']:moment()[_0x3f8f('0x17')](_0x3f8f('0x1f')),'callback':_0x43a502[_0x3f8f('0x26')]?!![]:![],'callbackuniqueid':_0x43a502[_0x3f8f('0x26')]?_0x43a502[_0x3f8f('0x26')]:undefined,'callbackat':_0x43a502[_0x3f8f('0x26')]?moment()[_0x3f8f('0x17')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0xe75c6['id']});})[_0x3f8f('0x27')](function(_0x40524c){_0x2f6acb(_0x40524c);});});});};var _0x4d4092=function(_0x31d548){return new BPromise(function(_0x56a07f,_0x1b8d76){_0x290160(_0x31d548,_0x43a502)[_0x3f8f('0x1b')](function(_0x597a19){_0x43a502[_0x3f8f('0x16')]=_0x597a19['ret'];_0x3bcfb5[_0x3f8f('0x20')]['findOne']({'where':{'phone':_0x43a502[_0x3f8f('0xa')],'VoiceQueueId':_0x31d548['id']}})['then'](function(_0x11ad2a){if(!_[_0x3f8f('0x1c')](_0x11ad2a)){throw new Error(_0x3f8f('0x21')+_0x43a502['phone']+_0x3f8f('0x28')+_0x31d548['id']);}return _0x3bcfb5[_0x3f8f('0x29')][_0x3f8f('0x1a')]({'where':{'calleridnum':_0x43a502[_0x3f8f('0xa')],'VoiceQueueId':_0x31d548['id']}});})['then'](function(_0x185e08){if(!_[_0x3f8f('0x1c')](_0x185e08)){throw new Error(_0x3f8f('0x2a')+_0x43a502[_0x3f8f('0xa')]+_0x3f8f('0x2b')+_0x31d548['id']);}return _0x3bcfb5[_0x3f8f('0x20')][_0x3f8f('0x23')]({'phone':_0x43a502['phone'],'ContactId':_0x43a502['id'],'ListId':_0x43a502[_0x3f8f('0x24')],'priority':_0x43a502[_0x3f8f('0x25')]?_0x43a502[_0x3f8f('0x25')]:0x2,'scheduledat':_0x43a502[_0x3f8f('0x16')]?_0x43a502[_0x3f8f('0x16')]:moment()[_0x3f8f('0x17')](_0x3f8f('0x1f')),'callback':_0x43a502[_0x3f8f('0x26')]?!![]:![],'callbackuniqueid':_0x43a502[_0x3f8f('0x26')]?_0x43a502[_0x3f8f('0x26')]:undefined,'callbackat':_0x43a502['callbackUniqueid']?moment()[_0x3f8f('0x17')](_0x3f8f('0x1f')):undefined,'VoiceQueueId':_0x31d548['id']});})[_0x3f8f('0x27')](function(_0x5be112){_0x1b8d76(_0x5be112);});});});};function _0x345c27(){return function(_0x88ed6){logger[_0x3f8f('0x12')](_0x3f8f('0x13'),_0x3f8f('0x14'),util[_0x3f8f('0x15')](_0x88ed6,{'showHidden':![],'depth':null}));};}function _0x5a3959(_0x431eac,_0x5589ab){var _0x1b93c9=_0x5589ab[_0x3f8f('0x16')]?_0x5589ab[_0x3f8f('0x16')]:moment()[_0x3f8f('0x17')](_0x3f8f('0x1f'));return new BPromise(function(_0x4e4d23,_0x11dfb9){if(_[_0x3f8f('0x1c')](_0x5589ab['dialTimezone'])){_0x4e4d23({'ret':_0x1b93c9});}else{_0x3bcfb5[_0x3f8f('0x2c')]['findOne']({'where':{'id':_0x431eac['id']}})[_0x3f8f('0x1b')](function(_0x4f447d){if(!_[_0x3f8f('0x1c')](_0x4f447d)){var _0x184087=_0x4f447d['dialTimezone'];if(!_[_0x3f8f('0x1c')](_0x184087)){var _0x5bccfb=shared['timezones'];var _0x256f9b=_0x5bccfb[_0x184087];var _0x11fdd0=_0x5bccfb[_0x5589ab['dialTimezone']];if(!_[_0x3f8f('0x1c')](_0x256f9b)&&!_['isNil'](_0x11fdd0)){var _0x294ed8=_0x256f9b[_0x3f8f('0x1e')]-_0x11fdd0[_0x3f8f('0x1e')];_0x1b93c9=_0x5589ab[_0x3f8f('0x16')]?_0x5589ab['scheduledat']:moment();var _0xb8ef30=moment(_0x1b93c9)['add'](_0x294ed8,_0x3f8f('0x2d'));_0x4e4d23({'ret':_0xb8ef30[_0x3f8f('0x17')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x4e4d23({'ret':_0x1b93c9});}else _0x4e4d23({'ret':_0x1b93c9});}else{_0x4e4d23({'ret':_0x1b93c9});}});}});return 0xa;}var _0x9d691f=function(_0x3dba7a){return new BPromise(function(_0x36473e,_0x3985ca){_0x5a3959(_0x3dba7a,_0x43a502)[_0x3f8f('0x1b')](function(_0xe559ad){_0x43a502[_0x3f8f('0x16')]=_0xe559ad[_0x3f8f('0x2e')];_0x3bcfb5[_0x3f8f('0x20')][_0x3f8f('0x1a')]({'where':{'phone':_0x43a502[_0x3f8f('0xa')],'CampaignId':_0x3dba7a['id']}})[_0x3f8f('0x1b')](function(_0x5e9870){if(!_[_0x3f8f('0x1c')](_0x5e9870)){throw new Error(_0x3f8f('0x21')+_0x43a502['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x3dba7a['id']);}return _0x3bcfb5['CmHopper']['create']({'phone':_0x43a502['phone'],'ContactId':_0x43a502['id'],'ListId':_0x43a502[_0x3f8f('0x24')],'priority':_0x43a502[_0x3f8f('0x25')]?_0x43a502[_0x3f8f('0x25')]:0x2,'scheduledat':_0x43a502[_0x3f8f('0x16')]?_0x43a502[_0x3f8f('0x16')]:moment()[_0x3f8f('0x17')](_0x3f8f('0x1f')),'callback':_0x43a502[_0x3f8f('0x26')]?!![]:![],'callbackuniqueid':_0x43a502[_0x3f8f('0x26')]?_0x43a502[_0x3f8f('0x26')]:undefined,'callbackat':_0x43a502['callbackUniqueid']?moment()[_0x3f8f('0x17')](_0x3f8f('0x1f')):undefined,'CampaignId':_0x3dba7a['id']});})[_0x3f8f('0x27')](function(_0x149017){_0x3985ca(_0x149017);});});});};var _0x30b6dc=function(_0x33f996){return new BPromise(function(_0x19aa94,_0x242b77){_0x5a3959(_0x33f996,_0x43a502)[_0x3f8f('0x1b')](function(_0x48a68f){_0x43a502[_0x3f8f('0x16')]=_0x48a68f['ret'];_0x3bcfb5[_0x3f8f('0x20')][_0x3f8f('0x1a')]({'where':{'phone':_0x43a502['phone'],'CampaignId':_0x33f996['id']}})[_0x3f8f('0x1b')](function(_0x4e65b1){if(!_[_0x3f8f('0x1c')](_0x4e65b1)){throw new Error(_0x3f8f('0x21')+_0x43a502['phone']+_0x3f8f('0x2f')+_0x33f996['id']);}return _0x3bcfb5[_0x3f8f('0x29')][_0x3f8f('0x1a')]({'where':{'calleridnum':_0x43a502[_0x3f8f('0xa')],'CampaignId':_0x33f996['id']}});})[_0x3f8f('0x1b')](function(_0x958782){if(!_[_0x3f8f('0x1c')](_0x958782)){throw new Error(_0x3f8f('0x2a')+_0x43a502[_0x3f8f('0xa')]+_0x3f8f('0x30')+_0x33f996['id']);}return _0x3bcfb5[_0x3f8f('0x20')][_0x3f8f('0x23')]({'phone':_0x43a502[_0x3f8f('0xa')],'ContactId':_0x43a502['id'],'ListId':_0x43a502[_0x3f8f('0x24')],'priority':_0x43a502['priority']?_0x43a502['priority']:0x2,'scheduledat':_0x43a502[_0x3f8f('0x16')]?_0x43a502[_0x3f8f('0x16')]:moment()[_0x3f8f('0x17')](_0x3f8f('0x1f')),'callback':_0x43a502[_0x3f8f('0x26')]?!![]:![],'callbackuniqueid':_0x43a502['callbackUniqueid']?_0x43a502['callbackUniqueid']:undefined,'callbackat':_0x43a502[_0x3f8f('0x26')]?moment()['format'](_0x3f8f('0x1f')):undefined,'CampaignId':_0x33f996['id']});})[_0x3f8f('0x27')](function(_0x54f56e){_0x242b77(_0x54f56e);});});});};if(_0x43a502[_0x3f8f('0x24')]){_0x3bcfb5['VoiceQueue']['findAll']({'where':{'type':_0x3f8f('0x31')},'attributes':['id',_0x3f8f('0x32'),_0x3f8f('0x18')],'include':[{'model':_0x3bcfb5[_0x3f8f('0x33')],'as':_0x3f8f('0x34'),'where':{'id':_0x43a502[_0x3f8f('0x24')]}}]})['then'](function(_0x1fff6e){if(_0x1fff6e){var _0x561287=[];for(var _0x5f49a7=0x0,_0x2306e5;_0x5f49a7<_0x1fff6e[_0x3f8f('0x35')];_0x5f49a7+=0x1){_0x2306e5=_0x1fff6e[_0x5f49a7]['get']({'plain':!![]});switch(_0x2306e5['dialCheckDuplicateType']){case _0x3f8f('0x36'):_0x4d4092(_0x2306e5)[_0x3f8f('0x27')](_0x20202f());break;case'onlyIfOpen':_0x3139c7(_0x2306e5)[_0x3f8f('0x27')](_0x20202f());break;default:_0x5a3959(_0x2306e5,_0x43a502)['then'](function(_0x44836e){_0x43a502[_0x3f8f('0x16')]=_0x44836e['ret'];_0x3bcfb5[_0x3f8f('0x20')][_0x3f8f('0x23')]({'phone':_0x43a502['phone'],'ContactId':_0x43a502['id'],'ListId':_0x43a502[_0x3f8f('0x24')],'scheduledat':_0x43a502[_0x3f8f('0x16')]?_0x43a502['scheduledat']:moment()['format'](_0x3f8f('0x1f')),'priority':_0x43a502[_0x3f8f('0x25')]?_0x43a502[_0x3f8f('0x25')]:0x2,'callback':_0x43a502['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x43a502[_0x3f8f('0x26')]?_0x43a502[_0x3f8f('0x26')]:undefined,'callbackat':_0x43a502[_0x3f8f('0x26')]?moment()[_0x3f8f('0x17')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x2306e5['id']})[_0x3f8f('0x27')](_0x20202f());});}}}})[_0x3f8f('0x1b')](function(){return _0x3bcfb5[_0x3f8f('0x19')]['findAll']({'where':{'type':_0x3f8f('0x31')},'attributes':['id'],'include':[{'model':_0x3bcfb5[_0x3f8f('0x33')],'as':_0x3f8f('0x37'),'where':{'id':_0x43a502[_0x3f8f('0x24')]}}]})[_0x3f8f('0x1b')](function(_0x4d47fb){if(_0x4d47fb){var _0x458d95=[];for(var _0x34330b=0x0,_0x4ac9ac;_0x34330b<_0x4d47fb[_0x3f8f('0x35')];_0x34330b+=0x1){_0x4ac9ac=_0x4d47fb[_0x34330b][_0x3f8f('0x11')]({'plain':!![]});_0x3bcfb5[_0x3f8f('0x38')][_0x3f8f('0x23')]({'phone':_0x43a502['phone'],'ContactId':_0x43a502['id'],'ListId':_0x43a502[_0x3f8f('0x24')],'VoiceQueueId':_0x4ac9ac['id']})[_0x3f8f('0x27')](function(_0xe9182c){logger['error'](_0x3f8f('0x39'),_0x3f8f('0x14'),_0xe9182c[_0x3f8f('0x3a')]);});}}});})[_0x3f8f('0x1b')](function(){return _0x3bcfb5['Campaign'][_0x3f8f('0x3b')]({'attributes':['id',_0x3f8f('0x32'),_0x3f8f('0x18')],'include':[{'model':_0x3bcfb5[_0x3f8f('0x33')],'as':_0x3f8f('0x34'),'where':{'id':_0x43a502['ListId']}}]})['then'](function(_0xbb655f){if(_0xbb655f){var _0x544986=[];for(var _0x5c6b8f=0x0,_0x4e71ea;_0x5c6b8f<_0xbb655f[_0x3f8f('0x35')];_0x5c6b8f+=0x1){_0x4e71ea=_0xbb655f[_0x5c6b8f]['get']({'plain':!![]});switch(_0x4e71ea[_0x3f8f('0x32')]){case _0x3f8f('0x36'):_0x30b6dc(_0x4e71ea)['catch'](_0x345c27());break;case _0x3f8f('0x3c'):_0x9d691f(_0x4e71ea)['catch'](_0x345c27());break;default:_0x3bcfb5[_0x3f8f('0x20')]['create']({'phone':_0x43a502[_0x3f8f('0xa')],'ContactId':_0x43a502['id'],'ListId':_0x43a502[_0x3f8f('0x24')],'scheduledat':_0x43a502[_0x3f8f('0x16')]?_0x43a502['scheduledat']:moment()[_0x3f8f('0x17')](_0x3f8f('0x1f')),'priority':_0x43a502[_0x3f8f('0x25')]?_0x43a502[_0x3f8f('0x25')]:0x2,'callback':_0x43a502['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x43a502[_0x3f8f('0x26')]?_0x43a502[_0x3f8f('0x26')]:undefined,'callbackat':_0x43a502[_0x3f8f('0x26')]?moment()['format'](_0x3f8f('0x1f')):undefined,'CampaignId':_0x4e71ea['id']})[_0x3f8f('0x27')](_0x345c27());}}}});})[_0x3f8f('0x1b')](function(){return _0x3bcfb5[_0x3f8f('0x2c')][_0x3f8f('0x3b')]({'attributes':['id'],'include':[{'model':_0x3bcfb5[_0x3f8f('0x33')],'as':_0x3f8f('0x37'),'where':{'id':_0x43a502['ListId']}}]})[_0x3f8f('0x1b')](function(_0x4fb9d3){if(_0x4fb9d3){var _0x40d0eb=[];for(var _0xd1c9f6=0x0,_0x5a7fcc;_0xd1c9f6<_0x4fb9d3[_0x3f8f('0x35')];_0xd1c9f6+=0x1){_0x5a7fcc=_0x4fb9d3[_0xd1c9f6]['get']({'plain':!![]});_0x3bcfb5['CmHopperBlack']['create']({'phone':_0x43a502[_0x3f8f('0xa')],'ContactId':_0x43a502['id'],'ListId':_0x43a502['ListId'],'CampaignId':_0x5a7fcc['id']})[_0x3f8f('0x27')](function(_0x23f1c7){logger[_0x3f8f('0x12')](_0x3f8f('0x39'),_0x3f8f('0x14'),_0x23f1c7[_0x3f8f('0x3a')]);});}}});})[_0x3f8f('0x1b')](function(){_0x4a92f9();})[_0x3f8f('0x27')](function(_0x32f67a){logger[_0x3f8f('0x12')]('cmContact,\x20%s,\x20%s',_0x3f8f('0x14'),_0x32f67a['message']);_0x4a92f9(_0x32f67a);});}else{_0x4a92f9(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x4083ce,_0x25a1cc,_0x532655){var _0x3121ad=_0x9d07e9[_0x3f8f('0x3d')];var _0xf1e3ac=_0x4083ce[_0x3f8f('0x11')]({'plain':!![]});return _0x3121ad['CmHopper'][_0x3f8f('0x3b')]({'raw':!![],'where':{'ListId':_0xf1e3ac['ListId'],'ContactId':_0xf1e3ac['id']}})['then'](function(_0x38e4d5){if(!_[_0x3f8f('0x3e')](_0x38e4d5)){var _0x12c704=[];for(var _0x4aa97c=0x0;_0x4aa97c<_0x38e4d5['length'];_0x4aa97c+=0x1){var _0xbf32fb=_0x3121ad[_0x3f8f('0x20')][_0x3f8f('0x3f')]({'where':{'ListId':_0x38e4d5[_0x4aa97c][_0x3f8f('0x24')],'ContactId':_0x38e4d5[_0x4aa97c]['ContactId'],'VoiceQueueId':_0x38e4d5[_0x4aa97c][_0x3f8f('0x40')],'CampaignId':_0x38e4d5[_0x4aa97c][_0x3f8f('0x41')]}});_0x12c704[_0x3f8f('0x42')](_0xbf32fb);}return BPromise['all'](_0x12c704);}})[_0x3f8f('0x1b')](function(_0x23d3e3){logger[_0x3f8f('0x43')](_0x3f8f('0x44'),util[_0x3f8f('0x15')](_0x23d3e3,{'showHidden':![],'depth':null}));_0x532655();})[_0x3f8f('0x27')](function(_0x5990e3){logger[_0x3f8f('0x12')]('[CmContact][afterDestroy][Error]',util['inspect'](_0x5990e3,{'showHidden':![],'depth':null}));_0x532655(_0x5990e3);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 3ddcfb2..b9dd05b 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x495321,_0x4cf2f8){var _0x116442=function(_0x4ffe3f){while(--_0x4ffe3f){_0x495321['push'](_0x495321['shift']());}};_0x116442(++_0x4cf2f8);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x2ce819,_0x103cc5){var _0x1f64a3=function(_0x1441a3){while(--_0x1441a3){_0x2ce819['push'](_0x2ce819['shift']());}};_0x1f64a3(++_0x103cc5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 6a5d794..eafc047 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 _0x3667=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0x4e0126,_0x119b89){var _0x4c785b=function(_0x5ac5b5){while(--_0x5ac5b5){_0x4e0126['push'](_0x4e0126['shift']());}};_0x4c785b(++_0x119b89);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7366('0x0'));module[_0x7366('0x1')]={'CmContactId':{'type':Sequelize[_0x7366('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x7366('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x7366('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x7366('0x4')},'OrderBy':{'type':Sequelize[_0x7366('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0xbb95=['exports','INTEGER','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb95,0x7f));var _0x5bb9=function(_0x367a9c,_0x3507e2){_0x367a9c=_0x367a9c-0x0;var _0x22d474=_0xbb95[_0x367a9c];return _0x22d474;};'use strict';var Sequelize=require(_0x5bb9('0x0'));module[_0x5bb9('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x5bb9('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x5bb9('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x5bb9('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 2089c2b..829e354 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 _0xcc7c=['status','set','Content-Range','json','apply','reject','save','destroy','then','get','end','error','stack','name','send','map','CmContactHasItem','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','role','CmContactHasItems','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','offset','undefined','limit','count'];(function(_0x1a1222,_0x11619d){var _0x5267c8=function(_0x4ba286){while(--_0x4ba286){_0x1a1222['push'](_0x1a1222['shift']());}};_0x5267c8(++_0x11619d);}(_0xcc7c,0xe1));var _0xccc7=function(_0x20a690,_0x3f137e){_0x20a690=_0x20a690-0x0;var _0x378089=_0xcc7c[_0x20a690];return _0x378089;};'use strict';var emlformat=require(_0xccc7('0x0'));var rimraf=require(_0xccc7('0x1'));var zipdir=require(_0xccc7('0x2'));var jsonpatch=require(_0xccc7('0x3'));var rp=require(_0xccc7('0x4'));var moment=require(_0xccc7('0x5'));var BPromise=require(_0xccc7('0x6'));var Mustache=require(_0xccc7('0x7'));var util=require('util');var path=require('path');var sox=require(_0xccc7('0x8'));var csv=require(_0xccc7('0x9'));var ejs=require(_0xccc7('0xa'));var fs=require('fs');var fs_extra=require(_0xccc7('0xb'));var _=require('lodash');var squel=require(_0xccc7('0xc'));var crypto=require(_0xccc7('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xccc7('0x9'));var querystring=require(_0xccc7('0xe'));var Papa=require('papaparse');var Redis=require(_0xccc7('0xf'));var authService=require(_0xccc7('0x10'));var qs=require(_0xccc7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xccc7('0x12'));var logger=require(_0xccc7('0x13'))(_0xccc7('0x14'));var utils=require(_0xccc7('0x15'));var config=require(_0xccc7('0x16'));var licenseUtil=require(_0xccc7('0x17'));var db=require(_0xccc7('0x18'))['db'];function respondWithStatusCode(_0x221106,_0x46eaf0){_0x46eaf0=_0x46eaf0||0xcc;return function(_0x452873){if(_0x452873){return _0x221106[_0xccc7('0x19')](_0x46eaf0);}return _0x221106['status'](_0x46eaf0)['end']();};}function respondWithResult(_0x7bd195,_0x2e9ca8){_0x2e9ca8=_0x2e9ca8||0xc8;return function(_0x2ec99b){if(_0x2ec99b){return _0x7bd195['status'](_0x2e9ca8)['json'](_0x2ec99b);}};}function respondWithFilteredResult(_0x1e99b2,_0x55a08a){return function(_0x46cc1f){if(_0x46cc1f){var _0x462738=typeof _0x55a08a[_0xccc7('0x1a')]===_0xccc7('0x1b')&&typeof _0x55a08a[_0xccc7('0x1c')]===_0xccc7('0x1b');var _0x2d2abb=_0x46cc1f[_0xccc7('0x1d')];var _0x510f96=_0x462738?0x0:_0x55a08a[_0xccc7('0x1a')];var _0x4404bc=_0x462738?_0x46cc1f[_0xccc7('0x1d')]:_0x55a08a[_0xccc7('0x1a')]+_0x55a08a[_0xccc7('0x1c')];var _0x42c7d3;if(_0x4404bc>=_0x2d2abb){_0x4404bc=_0x2d2abb;_0x42c7d3=0xc8;}else{_0x42c7d3=0xce;}_0x1e99b2[_0xccc7('0x1e')](_0x42c7d3);return _0x1e99b2[_0xccc7('0x1f')](_0xccc7('0x20'),_0x510f96+'-'+_0x4404bc+'/'+_0x2d2abb)[_0xccc7('0x21')](_0x46cc1f);}return null;};}function patchUpdates(_0x599c82){return function(_0x44fd08){try{jsonpatch[_0xccc7('0x22')](_0x44fd08,_0x599c82,!![]);}catch(_0x2bfd4b){return BPromise[_0xccc7('0x23')](_0x2bfd4b);}return _0x44fd08[_0xccc7('0x24')]();};}function saveUpdates(_0x190e29,_0x11c87e){return function(_0x17d9bc){if(_0x17d9bc){return _0x17d9bc['update'](_0x190e29)['then'](function(_0x37ac7f){return _0x37ac7f;});}return null;};}function removeEntity(_0x1f264f,_0x462629){return function(_0x267c53){if(_0x267c53){return _0x267c53[_0xccc7('0x25')]()[_0xccc7('0x26')](function(){var _0x24373f=_0x267c53[_0xccc7('0x27')]({'plain':!![]});var _0x48587d='CmContactHasItems';return db['UserProfileResource']['destroy']({'where':{'type':_0x48587d,'resourceId':_0x24373f['id']}})['then'](function(){return _0x267c53;});})[_0xccc7('0x26')](function(){_0x1f264f['status'](0xcc)[_0xccc7('0x28')]();});}};}function handleEntityNotFound(_0x579eed,_0x369159){return function(_0x3c4cd9){if(!_0x3c4cd9){_0x579eed[_0xccc7('0x19')](0x194);}return _0x3c4cd9;};}function handleError(_0x2c6c9b,_0x26acc0){_0x26acc0=_0x26acc0||0x1f4;return function(_0x2c87a4){logger[_0xccc7('0x29')](_0x2c87a4[_0xccc7('0x2a')]);if(_0x2c87a4[_0xccc7('0x2b')]){delete _0x2c87a4[_0xccc7('0x2b')];}_0x2c6c9b['status'](_0x26acc0)[_0xccc7('0x2c')](_0x2c87a4);};}exports['index']=function(_0x30eec0,_0x59e5af){var _0x1036b2={},_0xd356fc={},_0x2a894c={'count':0x0,'rows':[]};var _0x83a048=_[_0xccc7('0x2d')](db[_0xccc7('0x2e')][_0xccc7('0x2f')],function(_0x44ce87){return{'name':_0x44ce87[_0xccc7('0x30')],'type':_0x44ce87['type']['key']};});_0xd356fc[_0xccc7('0x31')]=_[_0xccc7('0x2d')](_0x83a048,_0xccc7('0x2b'));_0xd356fc['query']=_[_0xccc7('0x32')](_0x30eec0[_0xccc7('0x33')]);_0xd356fc[_0xccc7('0x34')]=_[_0xccc7('0x35')](_0xd356fc[_0xccc7('0x31')],_0xd356fc['query']);_0x1036b2['attributes']=_['intersection'](_0xd356fc[_0xccc7('0x31')],qs[_0xccc7('0x36')](_0x30eec0['query'][_0xccc7('0x36')]));_0x1036b2[_0xccc7('0x37')]=_0x1036b2[_0xccc7('0x37')]['length']?_0x1036b2[_0xccc7('0x37')]:_0xd356fc['model'];if(!_0x30eec0[_0xccc7('0x33')][_0xccc7('0x38')](_0xccc7('0x39'))){_0x1036b2[_0xccc7('0x1c')]=qs[_0xccc7('0x1c')](_0x30eec0[_0xccc7('0x33')][_0xccc7('0x1c')]);_0x1036b2[_0xccc7('0x1a')]=qs['offset'](_0x30eec0[_0xccc7('0x33')][_0xccc7('0x1a')]);}_0x1036b2['order']=qs['sort'](_0x30eec0[_0xccc7('0x33')]['sort']);_0x1036b2['where']=qs[_0xccc7('0x34')](_[_0xccc7('0x3a')](_0x30eec0[_0xccc7('0x33')],_0xd356fc[_0xccc7('0x34')]),_0x83a048);if(_0x30eec0[_0xccc7('0x33')]['filter']){_0x1036b2[_0xccc7('0x3b')]=_[_0xccc7('0x3c')](_0x1036b2[_0xccc7('0x3b')],{'$or':_[_0xccc7('0x2d')](_0x83a048,function(_0x5e44d2){if(_0x5e44d2[_0xccc7('0x3d')]!==_0xccc7('0x3e')){var _0x2a8718={};_0x2a8718[_0x5e44d2['name']]={'$like':'%'+_0x30eec0['query'][_0xccc7('0x3f')]+'%'};return _0x2a8718;}})});}_0x1036b2=_[_0xccc7('0x3c')]({},_0x1036b2,_0x30eec0[_0xccc7('0x40')]);var _0x1ef112={'where':_0x1036b2[_0xccc7('0x3b')]};return db['CmContactHasItem'][_0xccc7('0x1d')](_0x1ef112)[_0xccc7('0x26')](function(_0x450743){_0x2a894c[_0xccc7('0x1d')]=_0x450743;if(_0x30eec0['query'][_0xccc7('0x41')]){_0x1036b2[_0xccc7('0x42')]=[{'all':!![]}];}return db[_0xccc7('0x2e')][_0xccc7('0x43')](_0x1036b2);})['then'](function(_0x4bf5e2){_0x2a894c[_0xccc7('0x44')]=_0x4bf5e2;return _0x2a894c;})[_0xccc7('0x26')](respondWithFilteredResult(_0x59e5af,_0x1036b2))[_0xccc7('0x45')](handleError(_0x59e5af,null));};exports[_0xccc7('0x46')]=function(_0x223def,_0x27a6d6){var _0x21d3e6={'raw':!![],'where':{'id':_0x223def[_0xccc7('0x47')]['id']}},_0xe29cb6={};_0xe29cb6[_0xccc7('0x31')]=_[_0xccc7('0x32')](db['CmContactHasItem'][_0xccc7('0x2f')]);_0xe29cb6[_0xccc7('0x33')]=_[_0xccc7('0x32')](_0x223def[_0xccc7('0x33')]);_0xe29cb6[_0xccc7('0x34')]=_[_0xccc7('0x35')](_0xe29cb6[_0xccc7('0x31')],_0xe29cb6[_0xccc7('0x33')]);_0x21d3e6[_0xccc7('0x37')]=_[_0xccc7('0x35')](_0xe29cb6[_0xccc7('0x31')],qs[_0xccc7('0x36')](_0x223def['query'][_0xccc7('0x36')]));_0x21d3e6[_0xccc7('0x37')]=_0x21d3e6[_0xccc7('0x37')][_0xccc7('0x48')]?_0x21d3e6['attributes']:_0xe29cb6[_0xccc7('0x31')];if(_0x223def[_0xccc7('0x33')][_0xccc7('0x41')]){_0x21d3e6[_0xccc7('0x42')]=[{'all':!![]}];}_0x21d3e6=_[_0xccc7('0x3c')]({},_0x21d3e6,_0x223def[_0xccc7('0x40')]);return db[_0xccc7('0x2e')][_0xccc7('0x49')](_0x21d3e6)[_0xccc7('0x26')](handleEntityNotFound(_0x27a6d6,null))[_0xccc7('0x26')](respondWithResult(_0x27a6d6,null))['catch'](handleError(_0x27a6d6,null));};exports[_0xccc7('0x4a')]=function(_0x522f89,_0x3bbdf9){return db[_0xccc7('0x2e')][_0xccc7('0x4a')](_0x522f89[_0xccc7('0x4b')],{})[_0xccc7('0x26')](function(_0x193b21){var _0x3e5bba=_0x522f89[_0xccc7('0x4c')]['get']({'plain':!![]});if(!_0x3e5bba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e5bba[_0xccc7('0x4d')]==='user'){var _0x4bbeeb=_0x193b21[_0xccc7('0x27')]({'plain':!![]});var _0x3fea08=_0xccc7('0x4e');return db[_0xccc7('0x4f')][_0xccc7('0x49')]({'where':{'name':_0x3fea08,'userProfileId':_0x3e5bba[_0xccc7('0x50')]},'raw':!![]})[_0xccc7('0x26')](function(_0xd75688){if(_0xd75688&&_0xd75688[_0xccc7('0x51')]===0x0){return db[_0xccc7('0x52')]['create']({'name':_0x4bbeeb['name'],'resourceId':_0x4bbeeb['id'],'type':_0xd75688['name'],'sectionId':_0xd75688['id']},{})[_0xccc7('0x26')](function(){return _0x193b21;});}else{return _0x193b21;}})['catch'](function(_0x566471){logger[_0xccc7('0x29')](_0xccc7('0x53'),_0x566471);throw _0x566471;});}return _0x193b21;})[_0xccc7('0x26')](respondWithResult(_0x3bbdf9,0xc9))[_0xccc7('0x45')](handleError(_0x3bbdf9,null));};exports[_0xccc7('0x54')]=function(_0x46e384,_0xfc56f1){if(_0x46e384[_0xccc7('0x4b')]['id']){delete _0x46e384[_0xccc7('0x4b')]['id'];}return db['CmContactHasItem'][_0xccc7('0x49')]({'where':{'id':_0x46e384['params']['id']}})['then'](handleEntityNotFound(_0xfc56f1,null))[_0xccc7('0x26')](saveUpdates(_0x46e384['body'],null))[_0xccc7('0x26')](respondWithResult(_0xfc56f1,null))[_0xccc7('0x45')](handleError(_0xfc56f1,null));};exports[_0xccc7('0x25')]=function(_0x1f6e10,_0x31a62c){return db[_0xccc7('0x2e')]['find']({'where':{'id':_0x1f6e10[_0xccc7('0x47')]['id']}})[_0xccc7('0x26')](handleEntityNotFound(_0x31a62c,null))[_0xccc7('0x26')](removeEntity(_0x31a62c,null))[_0xccc7('0x45')](handleError(_0x31a62c,null));}; \ No newline at end of file +var _0xcef5=['fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','CmContactHasItems','error','stack','name','send','index','CmContactHasItem','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','intersection','find','create','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','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x2a845a,_0x44350e){var _0x14e5df=function(_0x204a0a){while(--_0x204a0a){_0x2a845a['push'](_0x2a845a['shift']());}};_0x14e5df(++_0x44350e);}(_0xcef5,0x1a8));var _0x5cef=function(_0x36012b,_0x2a499f){_0x36012b=_0x36012b-0x0;var _0x53bf9c=_0xcef5[_0x36012b];return _0x53bf9c;};'use strict';var emlformat=require(_0x5cef('0x0'));var rimraf=require(_0x5cef('0x1'));var zipdir=require(_0x5cef('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5cef('0x3'));var moment=require(_0x5cef('0x4'));var BPromise=require(_0x5cef('0x5'));var Mustache=require(_0x5cef('0x6'));var util=require(_0x5cef('0x7'));var path=require(_0x5cef('0x8'));var sox=require(_0x5cef('0x9'));var csv=require('to-csv');var ejs=require(_0x5cef('0xa'));var fs=require('fs');var fs_extra=require(_0x5cef('0xb'));var _=require(_0x5cef('0xc'));var squel=require(_0x5cef('0xd'));var crypto=require(_0x5cef('0xe'));var jsforce=require(_0x5cef('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5cef('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5cef('0x11'));var authService=require(_0x5cef('0x12'));var qs=require(_0x5cef('0x13'));var as=require(_0x5cef('0x14'));var hardwareService=require(_0x5cef('0x15'));var logger=require('../../config/logger')(_0x5cef('0x16'));var utils=require(_0x5cef('0x17'));var config=require(_0x5cef('0x18'));var licenseUtil=require(_0x5cef('0x19'));var db=require(_0x5cef('0x1a'))['db'];function respondWithStatusCode(_0x490fe3,_0xcef8fa){_0xcef8fa=_0xcef8fa||0xcc;return function(_0x1bdbfd){if(_0x1bdbfd){return _0x490fe3[_0x5cef('0x1b')](_0xcef8fa);}return _0x490fe3[_0x5cef('0x1c')](_0xcef8fa)[_0x5cef('0x1d')]();};}function respondWithResult(_0x5efdca,_0x35aa2b){_0x35aa2b=_0x35aa2b||0xc8;return function(_0x5a336a){if(_0x5a336a){return _0x5efdca[_0x5cef('0x1c')](_0x35aa2b)[_0x5cef('0x1e')](_0x5a336a);}};}function respondWithFilteredResult(_0x5b08e1,_0x16e768){return function(_0x3992cf){if(_0x3992cf){var _0x297507=typeof _0x16e768[_0x5cef('0x1f')]===_0x5cef('0x20')&&typeof _0x16e768[_0x5cef('0x21')]===_0x5cef('0x20');var _0x48c6a1=_0x3992cf[_0x5cef('0x22')];var _0x34b659=_0x297507?0x0:_0x16e768[_0x5cef('0x1f')];var _0x5c5e5f=_0x297507?_0x3992cf[_0x5cef('0x22')]:_0x16e768[_0x5cef('0x1f')]+_0x16e768['limit'];var _0x1a4635;if(_0x5c5e5f>=_0x48c6a1){_0x5c5e5f=_0x48c6a1;_0x1a4635=0xc8;}else{_0x1a4635=0xce;}_0x5b08e1[_0x5cef('0x1c')](_0x1a4635);return _0x5b08e1[_0x5cef('0x23')](_0x5cef('0x24'),_0x34b659+'-'+_0x5c5e5f+'/'+_0x48c6a1)[_0x5cef('0x1e')](_0x3992cf);}return null;};}function patchUpdates(_0x468d2a){return function(_0xa0ef2d){try{jsonpatch[_0x5cef('0x25')](_0xa0ef2d,_0x468d2a,!![]);}catch(_0x4810ec){return BPromise[_0x5cef('0x26')](_0x4810ec);}return _0xa0ef2d[_0x5cef('0x27')]();};}function saveUpdates(_0x3f466e,_0x2c7a4f){return function(_0x45cf32){if(_0x45cf32){return _0x45cf32[_0x5cef('0x28')](_0x3f466e)['then'](function(_0x3fb51d){return _0x3fb51d;});}return null;};}function removeEntity(_0x36bf7f,_0x4ee7cf){return function(_0x239487){if(_0x239487){return _0x239487[_0x5cef('0x29')]()[_0x5cef('0x2a')](function(){var _0x228c60=_0x239487[_0x5cef('0x2b')]({'plain':!![]});var _0x54909c=_0x5cef('0x2c');return db['UserProfileResource'][_0x5cef('0x29')]({'where':{'type':_0x54909c,'resourceId':_0x228c60['id']}})['then'](function(){return _0x239487;});})[_0x5cef('0x2a')](function(){_0x36bf7f[_0x5cef('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d81ba,_0x191467){return function(_0x5d2292){if(!_0x5d2292){_0x4d81ba[_0x5cef('0x1b')](0x194);}return _0x5d2292;};}function handleError(_0x4f86e3,_0xafb771){_0xafb771=_0xafb771||0x1f4;return function(_0x299ab9){logger[_0x5cef('0x2d')](_0x299ab9[_0x5cef('0x2e')]);if(_0x299ab9[_0x5cef('0x2f')]){delete _0x299ab9[_0x5cef('0x2f')];}_0x4f86e3[_0x5cef('0x1c')](_0xafb771)[_0x5cef('0x30')](_0x299ab9);};}exports[_0x5cef('0x31')]=function(_0xa8b5b5,_0x29a97e){var _0x92c4bc={},_0x3f55aa={},_0x48cbe4={'count':0x0,'rows':[]};var _0x2ccef1=_['map'](db[_0x5cef('0x32')][_0x5cef('0x33')],function(_0x130dda){return{'name':_0x130dda[_0x5cef('0x34')],'type':_0x130dda[_0x5cef('0x35')][_0x5cef('0x36')]};});_0x3f55aa[_0x5cef('0x37')]=_[_0x5cef('0x38')](_0x2ccef1,_0x5cef('0x2f'));_0x3f55aa[_0x5cef('0x39')]=_[_0x5cef('0x3a')](_0xa8b5b5[_0x5cef('0x39')]);_0x3f55aa[_0x5cef('0x3b')]=_['intersection'](_0x3f55aa['model'],_0x3f55aa[_0x5cef('0x39')]);_0x92c4bc[_0x5cef('0x3c')]=_['intersection'](_0x3f55aa['model'],qs['fields'](_0xa8b5b5['query'][_0x5cef('0x3d')]));_0x92c4bc[_0x5cef('0x3c')]=_0x92c4bc[_0x5cef('0x3c')][_0x5cef('0x3e')]?_0x92c4bc['attributes']:_0x3f55aa[_0x5cef('0x37')];if(!_0xa8b5b5[_0x5cef('0x39')]['hasOwnProperty']('nolimit')){_0x92c4bc[_0x5cef('0x21')]=qs[_0x5cef('0x21')](_0xa8b5b5[_0x5cef('0x39')][_0x5cef('0x21')]);_0x92c4bc[_0x5cef('0x1f')]=qs['offset'](_0xa8b5b5['query'][_0x5cef('0x1f')]);}_0x92c4bc[_0x5cef('0x3f')]=qs['sort'](_0xa8b5b5[_0x5cef('0x39')][_0x5cef('0x40')]);_0x92c4bc[_0x5cef('0x41')]=qs[_0x5cef('0x3b')](_[_0x5cef('0x42')](_0xa8b5b5[_0x5cef('0x39')],_0x3f55aa[_0x5cef('0x3b')]),_0x2ccef1);if(_0xa8b5b5[_0x5cef('0x39')][_0x5cef('0x43')]){_0x92c4bc['where']=_[_0x5cef('0x44')](_0x92c4bc[_0x5cef('0x41')],{'$or':_[_0x5cef('0x38')](_0x2ccef1,function(_0x1d0272){if(_0x1d0272[_0x5cef('0x35')]!==_0x5cef('0x45')){var _0x3211d7={};_0x3211d7[_0x1d0272[_0x5cef('0x2f')]]={'$like':'%'+_0xa8b5b5[_0x5cef('0x39')]['filter']+'%'};return _0x3211d7;}})});}_0x92c4bc=_[_0x5cef('0x44')]({},_0x92c4bc,_0xa8b5b5[_0x5cef('0x46')]);var _0x301544={'where':_0x92c4bc['where']};return db[_0x5cef('0x32')][_0x5cef('0x22')](_0x301544)[_0x5cef('0x2a')](function(_0x7b70db){_0x48cbe4[_0x5cef('0x22')]=_0x7b70db;if(_0xa8b5b5[_0x5cef('0x39')]['includeAll']){_0x92c4bc[_0x5cef('0x47')]=[{'all':!![]}];}return db[_0x5cef('0x32')][_0x5cef('0x48')](_0x92c4bc);})[_0x5cef('0x2a')](function(_0x5aa8cd){_0x48cbe4[_0x5cef('0x49')]=_0x5aa8cd;return _0x48cbe4;})[_0x5cef('0x2a')](respondWithFilteredResult(_0x29a97e,_0x92c4bc))[_0x5cef('0x4a')](handleError(_0x29a97e,null));};exports[_0x5cef('0x4b')]=function(_0xd7382b,_0x4f6673){var _0x280d80={'raw':!![],'where':{'id':_0xd7382b[_0x5cef('0x4c')]['id']}},_0x44ba9c={};_0x44ba9c[_0x5cef('0x37')]=_[_0x5cef('0x3a')](db[_0x5cef('0x32')][_0x5cef('0x33')]);_0x44ba9c[_0x5cef('0x39')]=_[_0x5cef('0x3a')](_0xd7382b[_0x5cef('0x39')]);_0x44ba9c[_0x5cef('0x3b')]=_[_0x5cef('0x4d')](_0x44ba9c[_0x5cef('0x37')],_0x44ba9c['query']);_0x280d80[_0x5cef('0x3c')]=_[_0x5cef('0x4d')](_0x44ba9c['model'],qs['fields'](_0xd7382b[_0x5cef('0x39')][_0x5cef('0x3d')]));_0x280d80[_0x5cef('0x3c')]=_0x280d80[_0x5cef('0x3c')][_0x5cef('0x3e')]?_0x280d80[_0x5cef('0x3c')]:_0x44ba9c['model'];if(_0xd7382b['query']['includeAll']){_0x280d80[_0x5cef('0x47')]=[{'all':!![]}];}_0x280d80=_[_0x5cef('0x44')]({},_0x280d80,_0xd7382b['options']);return db[_0x5cef('0x32')][_0x5cef('0x4e')](_0x280d80)[_0x5cef('0x2a')](handleEntityNotFound(_0x4f6673,null))[_0x5cef('0x2a')](respondWithResult(_0x4f6673,null))[_0x5cef('0x4a')](handleError(_0x4f6673,null));};exports[_0x5cef('0x4f')]=function(_0x5a4079,_0x4674fe){return db[_0x5cef('0x32')][_0x5cef('0x4f')](_0x5a4079[_0x5cef('0x50')],{})[_0x5cef('0x2a')](function(_0x3e4a6b){var _0xaee69a=_0x5a4079[_0x5cef('0x51')][_0x5cef('0x2b')]({'plain':!![]});if(!_0xaee69a)throw new Error(_0x5cef('0x52'));if(_0xaee69a[_0x5cef('0x53')]==='user'){var _0x54d047=_0x3e4a6b['get']({'plain':!![]});var _0x32d934=_0x5cef('0x2c');return db['UserProfileSection']['find']({'where':{'name':_0x32d934,'userProfileId':_0xaee69a[_0x5cef('0x54')]},'raw':!![]})[_0x5cef('0x2a')](function(_0xa94140){if(_0xa94140&&_0xa94140[_0x5cef('0x55')]===0x0){return db['UserProfileResource'][_0x5cef('0x4f')]({'name':_0x54d047[_0x5cef('0x2f')],'resourceId':_0x54d047['id'],'type':_0xa94140[_0x5cef('0x2f')],'sectionId':_0xa94140['id']},{})[_0x5cef('0x2a')](function(){return _0x3e4a6b;});}else{return _0x3e4a6b;}})[_0x5cef('0x4a')](function(_0x175692){logger['error'](_0x5cef('0x56'),_0x175692);throw _0x175692;});}return _0x3e4a6b;})['then'](respondWithResult(_0x4674fe,0xc9))[_0x5cef('0x4a')](handleError(_0x4674fe,null));};exports[_0x5cef('0x28')]=function(_0x1830b3,_0x537b5d){if(_0x1830b3[_0x5cef('0x50')]['id']){delete _0x1830b3[_0x5cef('0x50')]['id'];}return db['CmContactHasItem'][_0x5cef('0x4e')]({'where':{'id':_0x1830b3[_0x5cef('0x4c')]['id']}})[_0x5cef('0x2a')](handleEntityNotFound(_0x537b5d,null))[_0x5cef('0x2a')](saveUpdates(_0x1830b3[_0x5cef('0x50')],null))['then'](respondWithResult(_0x537b5d,null))[_0x5cef('0x4a')](handleError(_0x537b5d,null));};exports[_0x5cef('0x29')]=function(_0x251c2b,_0x464086){return db['CmContactHasItem'][_0x5cef('0x4e')]({'where':{'id':_0x251c2b['params']['id']}})[_0x5cef('0x2a')](handleEntityNotFound(_0x464086,null))[_0x5cef('0x2a')](removeEntity(_0x464086,null))[_0x5cef('0x4a')](handleError(_0x464086,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 107ce4a..0b77c75 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 _0x23e6=['cm_contact_has_items','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./cmContactHasItem.attributes','exports','define','CmContactHasItem'];(function(_0xb53cd3,_0xcd084d){var _0x1815f8=function(_0xdf7200){while(--_0xdf7200){_0xb53cd3['push'](_0xb53cd3['shift']());}};_0x1815f8(++_0xcd084d);}(_0x23e6,0x153));var _0x623e=function(_0x3bda64,_0xbcdc32){_0x3bda64=_0x3bda64-0x0;var _0x184d63=_0x23e6[_0x3bda64];return _0x184d63;};'use strict';var _=require(_0x623e('0x0'));var util=require(_0x623e('0x1'));var logger=require(_0x623e('0x2'))(_0x623e('0x3'));var moment=require(_0x623e('0x4'));var BPromise=require(_0x623e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x623e('0x6'));var rimraf=require(_0x623e('0x7'));var config=require('../../config/environment');var attributes=require(_0x623e('0x8'));module[_0x623e('0x9')]=function(_0x2a40f2,_0xed6ffc){return _0x2a40f2[_0x623e('0xa')](_0x623e('0xb'),attributes,{'tableName':_0x623e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6beb=['rimraf','../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem','lodash','util','api','bluebird','path'];(function(_0x58f8f6,_0x207b30){var _0x1569dc=function(_0x494d51){while(--_0x494d51){_0x58f8f6['push'](_0x58f8f6['shift']());}};_0x1569dc(++_0x207b30);}(_0x6beb,0x1e5));var _0xb6be=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6beb[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb6be('0x0'));var util=require(_0xb6be('0x1'));var logger=require('../../config/logger')(_0xb6be('0x2'));var moment=require('moment');var BPromise=require(_0xb6be('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb6be('0x4'));var rimraf=require(_0xb6be('0x5'));var config=require(_0xb6be('0x6'));var attributes=require(_0xb6be('0x7'));module[_0xb6be('0x8')]=function(_0x10360a,_0xbca13e){return _0x10360a['define'](_0xb6be('0x9'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index c77fb4a..4fd8db1 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 _0x4208=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash'];(function(_0x31019a,_0x4b49c3){var _0x585990=function(_0x46e4a0){while(--_0x46e4a0){_0x31019a['push'](_0x31019a['shift']());}};_0x585990(++_0x4b49c3);}(_0x4208,0x83));var _0x8420=function(_0x40b0b9,_0x59cd60){_0x40b0b9=_0x40b0b9-0x0;var _0x28e0e2=_0x4208[_0x40b0b9];return _0x28e0e2;};'use strict';var _=require(_0x8420('0x0'));var util=require(_0x8420('0x1'));var moment=require(_0x8420('0x2'));var BPromise=require('bluebird');var rs=require(_0x8420('0x3'));var fs=require('fs');var Redis=require(_0x8420('0x4'));var db=require(_0x8420('0x5'))['db'];var utils=require(_0x8420('0x6'));var logger=require(_0x8420('0x7'))('rpc');var config=require(_0x8420('0x8'));var jayson=require(_0x8420('0x9'));var client=jayson['client'][_0x8420('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ffdd9,_0x2cb324,_0x3ba203){return new BPromise(function(_0x57485f,_0x413916){return client[_0x8420('0xb')](_0x2ffdd9,_0x3ba203)[_0x8420('0xc')](function(_0x5ad79b){logger[_0x8420('0xd')](_0x8420('0xe'),_0x2cb324,_0x8420('0xf'));logger[_0x8420('0x10')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x2cb324,_0x8420('0xf'),JSON[_0x8420('0x11')](_0x5ad79b));if(_0x5ad79b[_0x8420('0x12')]){if(_0x5ad79b['error'][_0x8420('0x13')]===0x1f4){logger[_0x8420('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x2cb324,_0x5ad79b['error']['message']);return _0x413916(_0x5ad79b[_0x8420('0x12')][_0x8420('0x14')]);}logger['error'](_0x8420('0xe'),_0x2cb324,_0x5ad79b[_0x8420('0x12')][_0x8420('0x14')]);return _0x57485f(_0x5ad79b['error'][_0x8420('0x14')]);}else{logger['info'](_0x8420('0xe'),_0x2cb324,_0x8420('0xf'));_0x57485f(_0x5ad79b[_0x8420('0x15')][_0x8420('0x14')]);}})['catch'](function(_0x30815a){logger[_0x8420('0x12')](_0x8420('0xe'),_0x2cb324,_0x30815a);_0x413916(_0x30815a);});});} \ No newline at end of file +var _0x3f82=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util'];(function(_0x593bce,_0x484075){var _0x4f56c9=function(_0x583a02){while(--_0x583a02){_0x593bce['push'](_0x593bce['shift']());}};_0x4f56c9(++_0x484075);}(_0x3f82,0x148));var _0x23f8=function(_0x4dc897,_0x291921){_0x4dc897=_0x4dc897-0x0;var _0x54275b=_0x3f82[_0x4dc897];return _0x54275b;};'use strict';var _=require(_0x23f8('0x0'));var util=require(_0x23f8('0x1'));var moment=require(_0x23f8('0x2'));var BPromise=require(_0x23f8('0x3'));var rs=require(_0x23f8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23f8('0x5'))['db'];var utils=require(_0x23f8('0x6'));var logger=require('../../config/logger')(_0x23f8('0x7'));var config=require(_0x23f8('0x8'));var jayson=require(_0x23f8('0x9'));var client=jayson[_0x23f8('0xa')][_0x23f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x437124,_0x611f39,_0xede7cd){return new BPromise(function(_0x144e47,_0x3bac48){return client[_0x23f8('0xc')](_0x437124,_0xede7cd)[_0x23f8('0xd')](function(_0x57a454){logger[_0x23f8('0xe')](_0x23f8('0xf'),_0x611f39,_0x23f8('0x10'));logger['debug']('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x611f39,_0x23f8('0x10'),JSON[_0x23f8('0x11')](_0x57a454));if(_0x57a454[_0x23f8('0x12')]){if(_0x57a454[_0x23f8('0x12')]['code']===0x1f4){logger[_0x23f8('0x12')](_0x23f8('0xf'),_0x611f39,_0x57a454['error'][_0x23f8('0x13')]);return _0x3bac48(_0x57a454[_0x23f8('0x12')]['message']);}logger[_0x23f8('0x12')](_0x23f8('0xf'),_0x611f39,_0x57a454[_0x23f8('0x12')][_0x23f8('0x13')]);return _0x144e47(_0x57a454[_0x23f8('0x12')]['message']);}else{logger[_0x23f8('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x611f39,'request\x20sent');_0x144e47(_0x57a454[_0x23f8('0x14')]['message']);}})[_0x23f8('0x15')](function(_0xc3dbc){logger[_0x23f8('0x12')](_0x23f8('0xf'),_0x611f39,_0xc3dbc);_0x3bac48(_0xc3dbc);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 5b7fb60..963d6c3 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 _0x33d2=['get','isAuthenticated','index','post','create','/:id','update','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller'];(function(_0xf973b7,_0x46699f){var _0x499087=function(_0x45b42f){while(--_0x45b42f){_0xf973b7['push'](_0xf973b7['shift']());}};_0x499087(++_0x46699f);}(_0x33d2,0x7f));var _0x233d=function(_0x52f975,_0x305404){_0x52f975=_0x52f975-0x0;var _0x1b15a3=_0x33d2[_0x52f975];return _0x1b15a3;};'use strict';var multer=require(_0x233d('0x0'));var util=require(_0x233d('0x1'));var path=require(_0x233d('0x2'));var timeout=require('connect-timeout');var express=require(_0x233d('0x3'));var router=express[_0x233d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x233d('0x5'));var interaction=require(_0x233d('0x6'));var config=require(_0x233d('0x7'));var controller=require(_0x233d('0x8'));router[_0x233d('0x9')]('/',auth[_0x233d('0xa')](),controller[_0x233d('0xb')]);router[_0x233d('0x9')]('/:id',auth[_0x233d('0xa')](),controller['show']);router[_0x233d('0xc')]('/',auth[_0x233d('0xa')](),controller[_0x233d('0xd')]);router['put'](_0x233d('0xe'),auth['isAuthenticated'](),controller[_0x233d('0xf')]);router['delete'](_0x233d('0xe'),auth[_0x233d('0xa')](),controller[_0x233d('0x10')]);module['exports']=router; \ No newline at end of file +var _0x26f1=['index','get','/:id','isAuthenticated','show','post','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller'];(function(_0x4a6cf8,_0x5534ef){var _0x22205e=function(_0x3f4d0d){while(--_0x3f4d0d){_0x4a6cf8['push'](_0x4a6cf8['shift']());}};_0x22205e(++_0x5534ef);}(_0x26f1,0x8f));var _0x126f=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x26f1[_0x13b02f];return _0x12e9a6;};'use strict';var multer=require(_0x126f('0x0'));var util=require(_0x126f('0x1'));var path=require('path');var timeout=require(_0x126f('0x2'));var express=require(_0x126f('0x3'));var router=express[_0x126f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x126f('0x5'));var interaction=require(_0x126f('0x6'));var config=require(_0x126f('0x7'));var controller=require(_0x126f('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x126f('0x9')]);router[_0x126f('0xa')](_0x126f('0xb'),auth[_0x126f('0xc')](),controller[_0x126f('0xd')]);router[_0x126f('0xe')]('/',auth[_0x126f('0xc')](),controller['create']);router[_0x126f('0xf')](_0x126f('0xb'),auth[_0x126f('0xc')](),controller[_0x126f('0x10')]);router[_0x126f('0x11')](_0x126f('0xb'),auth[_0x126f('0xc')](),controller['destroy']);module[_0x126f('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 6e8030b..88c77fb 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 _0x0d1e=['getDataValue','alias','STRING','setDataValue','name','TEXT','long','type','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL'];(function(_0x3067fc,_0x2f63a0){var _0x3035eb=function(_0x779331){while(--_0x779331){_0x3067fc['push'](_0x3067fc['shift']());}};_0x3035eb(++_0x2f63a0);}(_0x0d1e,0x152));var _0xe0d1=function(_0x1da9bf,_0x10784f){_0x1da9bf=_0x1da9bf-0x0;var _0x4ddec7=_0x0d1e[_0x1da9bf];return _0x4ddec7;};'use strict';var Sequelize=require(_0xe0d1('0x0'));var _=require(_0xe0d1('0x1'));module[_0xe0d1('0x2')]={'name':{'type':Sequelize[_0xe0d1('0x3')],'get':function(_0x5a098d){return this[_0xe0d1('0x4')](_0xe0d1('0x5'));}},'alias':{'type':Sequelize[_0xe0d1('0x6')],'allowNull':![],'set':function(_0x2d0c54){this[_0xe0d1('0x7')](_0xe0d1('0x5'),_0x2d0c54?_0x2d0c54:this[_0xe0d1('0x4')](_0xe0d1('0x8')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xe0d1('0x9')](_0xe0d1('0xa')),'get':function(){if(this[_0xe0d1('0x4')](_0xe0d1('0xb'))==='select'){return JSON[_0xe0d1('0xc')](this[_0xe0d1('0x4')](_0xe0d1('0xd')));}else{return this[_0xe0d1('0x4')](_0xe0d1('0xd'));}},'set':function(_0x577717){if(Array[_0xe0d1('0xe')](_0x577717)){this['setDataValue']('values',JSON[_0xe0d1('0xf')](_0x577717));}else{this[_0xe0d1('0x7')](_0xe0d1('0xd'),_0x577717);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xe0d1('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xe0d1('0x11')](_0xe0d1('0x12'))}}; \ No newline at end of file +var _0x51d6=['type','select','values','isArray','BOOLEAN','voice','lodash','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','long'];(function(_0x447261,_0x2aee49){var _0x302520=function(_0x38afd8){while(--_0x38afd8){_0x447261['push'](_0x447261['shift']());}};_0x302520(++_0x2aee49);}(_0x51d6,0xe6));var _0x651d=function(_0x1a8e79,_0x53a269){_0x1a8e79=_0x1a8e79-0x0;var _0x51ae8b=_0x51d6[_0x1a8e79];return _0x51ae8b;};'use strict';var Sequelize=require('sequelize');var _=require(_0x651d('0x0'));module['exports']={'name':{'type':Sequelize[_0x651d('0x1')],'get':function(_0x2b9105){return this[_0x651d('0x2')](_0x651d('0x3'));}},'alias':{'type':Sequelize[_0x651d('0x4')],'allowNull':![],'set':function(_0xcbdc0e){this[_0x651d('0x5')](_0x651d('0x3'),_0xcbdc0e?_0xcbdc0e:this['getDataValue'](_0x651d('0x6')));}},'type':{'type':Sequelize[_0x651d('0x4')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x651d('0x7')),'get':function(){if(this[_0x651d('0x2')](_0x651d('0x8'))===_0x651d('0x9')){return JSON['parse'](this[_0x651d('0x2')](_0x651d('0xa')));}else{return this['getDataValue'](_0x651d('0xa'));}},'set':function(_0x4d9623){if(Array[_0x651d('0xb')](_0x4d9623)){this[_0x651d('0x5')](_0x651d('0xa'),JSON['stringify'](_0x4d9623));}else{this[_0x651d('0x5')](_0x651d('0xa'),_0x4d9623);}}},'required':{'type':Sequelize[_0x651d('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x651d('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x651d('0xd'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 503c907..bf94521 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 _0xc659=['end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','differenceBy','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filters','merge','VIRTUAL','filter','CmCustomField','includeAll','include','findAll','rows','catch','show','params','options','find','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x349f2b,_0x53e83e){var _0x2dbd8c=function(_0x5c0938){while(--_0x5c0938){_0x349f2b['push'](_0x349f2b['shift']());}};_0x2dbd8c(++_0x53e83e);}(_0xc659,0x95));var _0x9c65=function(_0x9ea119,_0x115db9){_0x9ea119=_0x9ea119-0x0;var _0x1b232c=_0xc659[_0x9ea119];return _0x1b232c;};'use strict';var emlformat=require(_0x9c65('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9c65('0x1'));var jsonpatch=require(_0x9c65('0x2'));var rp=require(_0x9c65('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9c65('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x9c65('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c65('0x6'));var _=require('lodash');var squel=require(_0x9c65('0x7'));var crypto=require(_0x9c65('0x8'));var jsforce=require(_0x9c65('0x9'));var deskjs=require(_0x9c65('0xa'));var toCsv=require(_0x9c65('0x5'));var querystring=require(_0x9c65('0xb'));var Papa=require('papaparse');var Redis=require(_0x9c65('0xc'));var authService=require(_0x9c65('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x9c65('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c65('0xf'))(_0x9c65('0x10'));var utils=require(_0x9c65('0x11'));var config=require(_0x9c65('0x12'));var licenseUtil=require(_0x9c65('0x13'));var db=require(_0x9c65('0x14'))['db'];function respondWithStatusCode(_0x5edbc9,_0x185383){_0x185383=_0x185383||0xcc;return function(_0x890ee7){if(_0x890ee7){return _0x5edbc9[_0x9c65('0x15')](_0x185383);}return _0x5edbc9[_0x9c65('0x16')](_0x185383)[_0x9c65('0x17')]();};}function respondWithResult(_0x24d438,_0x3e09d3){_0x3e09d3=_0x3e09d3||0xc8;return function(_0x40b6eb){if(_0x40b6eb){return _0x24d438[_0x9c65('0x16')](_0x3e09d3)[_0x9c65('0x18')](_0x40b6eb);}};}function respondWithFilteredResult(_0x510880,_0xadb311){return function(_0x267176){if(_0x267176){var _0x50137f=typeof _0xadb311[_0x9c65('0x19')]===_0x9c65('0x1a')&&typeof _0xadb311['limit']==='undefined';var _0xe84edf=_0x267176['count'];var _0xdd80c=_0x50137f?0x0:_0xadb311['offset'];var _0x2b0c8f=_0x50137f?_0x267176[_0x9c65('0x1b')]:_0xadb311[_0x9c65('0x19')]+_0xadb311[_0x9c65('0x1c')];var _0x4350c8;if(_0x2b0c8f>=_0xe84edf){_0x2b0c8f=_0xe84edf;_0x4350c8=0xc8;}else{_0x4350c8=0xce;}_0x510880['status'](_0x4350c8);return _0x510880[_0x9c65('0x1d')](_0x9c65('0x1e'),_0xdd80c+'-'+_0x2b0c8f+'/'+_0xe84edf)['json'](_0x267176);}return null;};}function patchUpdates(_0xc695a7){return function(_0x3357cd){try{jsonpatch[_0x9c65('0x1f')](_0x3357cd,_0xc695a7,!![]);}catch(_0x24c020){return BPromise[_0x9c65('0x20')](_0x24c020);}return _0x3357cd[_0x9c65('0x21')]();};}function saveUpdates(_0x2ee9cb,_0x4ecfad){return function(_0x2f94e1){if(_0x2f94e1){return _0x2f94e1['update'](_0x2ee9cb)[_0x9c65('0x22')](function(_0x399c2e){return _0x399c2e;});}return null;};}function removeEntity(_0x24d84e,_0x57e53b){return function(_0x4b21d6){if(_0x4b21d6){return _0x4b21d6[_0x9c65('0x23')]()['then'](function(){_0x24d84e['status'](0xcc)[_0x9c65('0x17')]();});}};}function handleEntityNotFound(_0x2de595,_0x602386){return function(_0xc064c2){if(!_0xc064c2){_0x2de595['sendStatus'](0x194);}return _0xc064c2;};}function handleError(_0x56182f,_0x1a24e7){_0x1a24e7=_0x1a24e7||0x1f4;return function(_0x17b4e4){logger[_0x9c65('0x24')](_0x17b4e4['stack']);if(_0x17b4e4[_0x9c65('0x25')]){delete _0x17b4e4[_0x9c65('0x25')];}_0x56182f[_0x9c65('0x16')](_0x1a24e7)[_0x9c65('0x26')](_0x17b4e4);};}exports[_0x9c65('0x27')]=function(_0x1676ee,_0x471692){var _0x652464={},_0x1d063d={},_0x1147d0={'count':0x0,'rows':[]};var _0xcc2a7e=_['map'](db['CmCustomField'][_0x9c65('0x28')],function(_0x343206){return{'name':_0x343206[_0x9c65('0x29')],'type':_0x343206[_0x9c65('0x2a')][_0x9c65('0x2b')]};});_0x1d063d[_0x9c65('0x2c')]=_[_0x9c65('0x2d')](_[_0x9c65('0x2e')](_0xcc2a7e,_0x9c65('0x25')),[_0x9c65('0x25')]);_0x1d063d[_0x9c65('0x2f')]=_[_0x9c65('0x30')](_0x1676ee['query']);_0x1d063d['filters']=_[_0x9c65('0x31')](_0x1d063d[_0x9c65('0x2c')],_0x1d063d[_0x9c65('0x2f')]);_0x652464[_0x9c65('0x32')]=_[_0x9c65('0x31')](_0x1d063d['model'],qs[_0x9c65('0x33')](_0x1676ee[_0x9c65('0x2f')][_0x9c65('0x33')]));_0x652464[_0x9c65('0x32')]=_0x652464[_0x9c65('0x32')][_0x9c65('0x34')]?_0x652464[_0x9c65('0x32')]:_0x1d063d[_0x9c65('0x2c')];if(!_0x1676ee['query'][_0x9c65('0x35')]('nolimit')){_0x652464[_0x9c65('0x1c')]=qs['limit'](_0x1676ee['query'][_0x9c65('0x1c')]);_0x652464['offset']=qs[_0x9c65('0x19')](_0x1676ee[_0x9c65('0x2f')][_0x9c65('0x19')]);}_0x652464['order']=qs[_0x9c65('0x36')](_0x1676ee[_0x9c65('0x2f')][_0x9c65('0x36')]);_0x652464[_0x9c65('0x37')]=qs['filters'](_[_0x9c65('0x38')](_0x1676ee['query'],_0x1d063d[_0x9c65('0x39')]),_0xcc2a7e);if(_0x1676ee['query']['filter']){_0x652464['where']=_[_0x9c65('0x3a')](_0x652464[_0x9c65('0x37')],{'$or':_[_0x9c65('0x2e')](_0xcc2a7e,function(_0x1beadd){if(_0x1beadd[_0x9c65('0x2a')]!==_0x9c65('0x3b')){var _0x1bbb2b={};_0x1bbb2b[_0x1beadd[_0x9c65('0x25')]]={'$like':'%'+_0x1676ee['query'][_0x9c65('0x3c')]+'%'};return _0x1bbb2b;}})});}_0x652464=_[_0x9c65('0x3a')]({},_0x652464,_0x1676ee['options']);var _0x55b95d={'where':_0x652464[_0x9c65('0x37')]};return db[_0x9c65('0x3d')][_0x9c65('0x1b')](_0x55b95d)[_0x9c65('0x22')](function(_0x2deff2){_0x1147d0[_0x9c65('0x1b')]=_0x2deff2;if(_0x1676ee[_0x9c65('0x2f')][_0x9c65('0x3e')]){_0x652464[_0x9c65('0x3f')]=[{'all':!![]}];}return db[_0x9c65('0x3d')][_0x9c65('0x40')](_0x652464);})[_0x9c65('0x22')](function(_0x7736be){_0x1147d0[_0x9c65('0x41')]=_0x7736be;return _0x1147d0;})['then'](respondWithFilteredResult(_0x471692,_0x652464))[_0x9c65('0x42')](handleError(_0x471692,null));};exports[_0x9c65('0x43')]=function(_0xb55e14,_0x777110){var _0x9ea1bc={'raw':!![],'where':{'id':_0xb55e14[_0x9c65('0x44')]['id']}},_0x451954={};_0x451954[_0x9c65('0x2c')]=_[_0x9c65('0x30')](db['CmCustomField'][_0x9c65('0x28')]);_0x451954[_0x9c65('0x2f')]=_[_0x9c65('0x30')](_0xb55e14['query']);_0x451954['filters']=_[_0x9c65('0x31')](_0x451954[_0x9c65('0x2c')],_0x451954[_0x9c65('0x2f')]);_0x9ea1bc[_0x9c65('0x32')]=_[_0x9c65('0x31')](_0x451954[_0x9c65('0x2c')],qs[_0x9c65('0x33')](_0xb55e14[_0x9c65('0x2f')][_0x9c65('0x33')]));_0x9ea1bc[_0x9c65('0x32')]=_0x9ea1bc['attributes'][_0x9c65('0x34')]?_0x9ea1bc[_0x9c65('0x32')]:_0x451954['model'];if(_0xb55e14[_0x9c65('0x2f')][_0x9c65('0x3e')]){_0x9ea1bc[_0x9c65('0x3f')]=[{'all':!![]}];}_0x9ea1bc=_[_0x9c65('0x3a')]({},_0x9ea1bc,_0xb55e14[_0x9c65('0x45')]);return db[_0x9c65('0x3d')][_0x9c65('0x46')](_0x9ea1bc)[_0x9c65('0x22')](handleEntityNotFound(_0x777110,null))['then'](respondWithResult(_0x777110,null))[_0x9c65('0x42')](handleError(_0x777110,null));};exports['update']=function(_0x5f50c2,_0xb1958){if(_0x5f50c2[_0x9c65('0x47')]['id']){delete _0x5f50c2[_0x9c65('0x47')]['id'];}return db['CmCustomField'][_0x9c65('0x46')]({'where':{'id':_0x5f50c2[_0x9c65('0x44')]['id']}})[_0x9c65('0x22')](handleEntityNotFound(_0xb1958,null))[_0x9c65('0x22')](saveUpdates(_0x5f50c2[_0x9c65('0x47')],null))['then'](respondWithResult(_0xb1958,null))[_0x9c65('0x42')](handleError(_0xb1958,null));};exports['destroy']=function(_0x571acb,_0x5cf9b2){return db['CmCustomField']['find']({'where':{'id':_0x571acb[_0x9c65('0x44')]['id']}})[_0x9c65('0x22')](handleEntityNotFound(_0x5cf9b2,null))[_0x9c65('0x22')](removeEntity(_0x5cf9b2,null))[_0x9c65('0x42')](handleError(_0x5cf9b2,null));};exports[_0x9c65('0x48')]=function(_0x4e56b0,_0x16438a){var _0x48d357;return db[_0x9c65('0x49')][_0x9c65('0x4a')](function(_0x5eacd7){return db[_0x9c65('0x3d')][_0x9c65('0x48')](_0x4e56b0[_0x9c65('0x47')],{'transaction':_0x5eacd7})[_0x9c65('0x22')](function(_0x167953){_0x48d357=_0x167953;var _0x5e1e30={'type':db[_0x9c65('0x4b')][_0x9c65('0x4c')],'transaction':_0x5eacd7};switch(_0x4e56b0[_0x9c65('0x47')][_0x9c65('0x2a')]){case _0x9c65('0x4d'):_0x5e1e30[_0x9c65('0x2a')]=db['Sequelize']['TEXT'];break;case _0x9c65('0x4e'):_0x5e1e30[_0x9c65('0x2a')]=db['Sequelize'][_0x9c65('0x4f')];break;case _0x9c65('0x50'):_0x5e1e30['type']=db[_0x9c65('0x4b')][_0x9c65('0x51')];_0x5e1e30[_0x9c65('0x52')]=![];break;default:}return db['sequelize'][_0x9c65('0x53')]['addColumn'](_0x9c65('0x54'),util['format'](_0x9c65('0x55'),_0x48d357['id']),_0x5e1e30);})[_0x9c65('0x22')](function(){return _0x48d357;});})[_0x9c65('0x22')](respondWithResult(_0x16438a,0xc9))[_0x9c65('0x42')](handleError(_0x16438a,null));}; \ No newline at end of file +var _0xd159=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','save','then','stack','name','send','map','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','rows','catch','params','keys','intersection','find','update','body','destroy','create','sequelize','transaction','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','format','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse'];(function(_0x39df87,_0xb56132){var _0x3d67b4=function(_0x12ec9f){while(--_0x12ec9f){_0x39df87['push'](_0x39df87['shift']());}};_0x3d67b4(++_0xb56132);}(_0xd159,0x19d));var _0x9d15=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd159[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x9d15('0x0'));var rimraf=require(_0x9d15('0x1'));var zipdir=require(_0x9d15('0x2'));var jsonpatch=require(_0x9d15('0x3'));var rp=require('request-promise');var moment=require(_0x9d15('0x4'));var BPromise=require(_0x9d15('0x5'));var Mustache=require('mustache');var util=require(_0x9d15('0x6'));var path=require(_0x9d15('0x7'));var sox=require(_0x9d15('0x8'));var csv=require('to-csv');var ejs=require(_0x9d15('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d15('0xa'));var squel=require(_0x9d15('0xb'));var crypto=require(_0x9d15('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9d15('0xd'));var toCsv=require(_0x9d15('0xe'));var querystring=require(_0x9d15('0xf'));var Papa=require(_0x9d15('0x10'));var Redis=require(_0x9d15('0x11'));var authService=require(_0x9d15('0x12'));var qs=require(_0x9d15('0x13'));var as=require(_0x9d15('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d15('0x15'))('api');var utils=require(_0x9d15('0x16'));var config=require(_0x9d15('0x17'));var licenseUtil=require(_0x9d15('0x18'));var db=require(_0x9d15('0x19'))['db'];function respondWithStatusCode(_0x136a4c,_0xaf4a1b){_0xaf4a1b=_0xaf4a1b||0xcc;return function(_0x1cea3f){if(_0x1cea3f){return _0x136a4c[_0x9d15('0x1a')](_0xaf4a1b);}return _0x136a4c['status'](_0xaf4a1b)[_0x9d15('0x1b')]();};}function respondWithResult(_0x2defbc,_0x5cf8f3){_0x5cf8f3=_0x5cf8f3||0xc8;return function(_0x1f98dc){if(_0x1f98dc){return _0x2defbc['status'](_0x5cf8f3)[_0x9d15('0x1c')](_0x1f98dc);}};}function respondWithFilteredResult(_0x4c08a2,_0x56112a){return function(_0x584946){if(_0x584946){var _0x50df1e=typeof _0x56112a[_0x9d15('0x1d')]===_0x9d15('0x1e')&&typeof _0x56112a['limit']===_0x9d15('0x1e');var _0x237fec=_0x584946['count'];var _0x2d3ec1=_0x50df1e?0x0:_0x56112a[_0x9d15('0x1d')];var _0x37878f=_0x50df1e?_0x584946[_0x9d15('0x1f')]:_0x56112a[_0x9d15('0x1d')]+_0x56112a[_0x9d15('0x20')];var _0x36ea6f;if(_0x37878f>=_0x237fec){_0x37878f=_0x237fec;_0x36ea6f=0xc8;}else{_0x36ea6f=0xce;}_0x4c08a2[_0x9d15('0x21')](_0x36ea6f);return _0x4c08a2[_0x9d15('0x22')]('Content-Range',_0x2d3ec1+'-'+_0x37878f+'/'+_0x237fec)[_0x9d15('0x1c')](_0x584946);}return null;};}function patchUpdates(_0x13a08c){return function(_0x49ef84){try{jsonpatch['apply'](_0x49ef84,_0x13a08c,!![]);}catch(_0xd96c05){return BPromise['reject'](_0xd96c05);}return _0x49ef84[_0x9d15('0x23')]();};}function saveUpdates(_0x4d98f0,_0x1e05a9){return function(_0x20c925){if(_0x20c925){return _0x20c925['update'](_0x4d98f0)[_0x9d15('0x24')](function(_0x5e6b8a){return _0x5e6b8a;});}return null;};}function removeEntity(_0x40ff10,_0x2c1ec9){return function(_0x5acf63){if(_0x5acf63){return _0x5acf63['destroy']()['then'](function(){_0x40ff10[_0x9d15('0x21')](0xcc)[_0x9d15('0x1b')]();});}};}function handleEntityNotFound(_0x143e19,_0x11a0e6){return function(_0xb5a9ff){if(!_0xb5a9ff){_0x143e19['sendStatus'](0x194);}return _0xb5a9ff;};}function handleError(_0x56710b,_0x22a092){_0x22a092=_0x22a092||0x1f4;return function(_0x4a361f){logger['error'](_0x4a361f[_0x9d15('0x25')]);if(_0x4a361f[_0x9d15('0x26')]){delete _0x4a361f['name'];}_0x56710b[_0x9d15('0x21')](_0x22a092)[_0x9d15('0x27')](_0x4a361f);};}exports['index']=function(_0x3f8900,_0x40f686){var _0x30e74b={},_0xdae6e={},_0xe502a5={'count':0x0,'rows':[]};var _0x1d4dd4=_[_0x9d15('0x28')](db[_0x9d15('0x29')][_0x9d15('0x2a')],function(_0x536b66){return{'name':_0x536b66[_0x9d15('0x2b')],'type':_0x536b66[_0x9d15('0x2c')]['key']};});_0xdae6e[_0x9d15('0x2d')]=_[_0x9d15('0x2e')](_[_0x9d15('0x28')](_0x1d4dd4,_0x9d15('0x26')),[_0x9d15('0x26')]);_0xdae6e[_0x9d15('0x2f')]=_['keys'](_0x3f8900[_0x9d15('0x2f')]);_0xdae6e[_0x9d15('0x30')]=_['intersection'](_0xdae6e['model'],_0xdae6e['query']);_0x30e74b['attributes']=_['intersection'](_0xdae6e[_0x9d15('0x2d')],qs['fields'](_0x3f8900['query'][_0x9d15('0x31')]));_0x30e74b[_0x9d15('0x32')]=_0x30e74b[_0x9d15('0x32')][_0x9d15('0x33')]?_0x30e74b[_0x9d15('0x32')]:_0xdae6e[_0x9d15('0x2d')];if(!_0x3f8900['query'][_0x9d15('0x34')](_0x9d15('0x35'))){_0x30e74b[_0x9d15('0x20')]=qs[_0x9d15('0x20')](_0x3f8900[_0x9d15('0x2f')][_0x9d15('0x20')]);_0x30e74b[_0x9d15('0x1d')]=qs[_0x9d15('0x1d')](_0x3f8900['query'][_0x9d15('0x1d')]);}_0x30e74b[_0x9d15('0x36')]=qs[_0x9d15('0x37')](_0x3f8900[_0x9d15('0x2f')][_0x9d15('0x37')]);_0x30e74b['where']=qs[_0x9d15('0x30')](_[_0x9d15('0x38')](_0x3f8900[_0x9d15('0x2f')],_0xdae6e[_0x9d15('0x30')]),_0x1d4dd4);if(_0x3f8900[_0x9d15('0x2f')][_0x9d15('0x39')]){_0x30e74b[_0x9d15('0x3a')]=_['merge'](_0x30e74b[_0x9d15('0x3a')],{'$or':_[_0x9d15('0x28')](_0x1d4dd4,function(_0x74772f){if(_0x74772f[_0x9d15('0x2c')]!==_0x9d15('0x3b')){var _0x57757d={};_0x57757d[_0x74772f[_0x9d15('0x26')]]={'$like':'%'+_0x3f8900[_0x9d15('0x2f')][_0x9d15('0x39')]+'%'};return _0x57757d;}})});}_0x30e74b=_[_0x9d15('0x3c')]({},_0x30e74b,_0x3f8900[_0x9d15('0x3d')]);var _0xdedc66={'where':_0x30e74b['where']};return db[_0x9d15('0x29')]['count'](_0xdedc66)[_0x9d15('0x24')](function(_0x570857){_0xe502a5[_0x9d15('0x1f')]=_0x570857;if(_0x3f8900[_0x9d15('0x2f')]['includeAll']){_0x30e74b[_0x9d15('0x3e')]=[{'all':!![]}];}return db[_0x9d15('0x29')]['findAll'](_0x30e74b);})['then'](function(_0x57c94e){_0xe502a5[_0x9d15('0x3f')]=_0x57c94e;return _0xe502a5;})[_0x9d15('0x24')](respondWithFilteredResult(_0x40f686,_0x30e74b))[_0x9d15('0x40')](handleError(_0x40f686,null));};exports['show']=function(_0x1191fb,_0x41aded){var _0x16ba5e={'raw':!![],'where':{'id':_0x1191fb[_0x9d15('0x41')]['id']}},_0x37cfd3={};_0x37cfd3['model']=_[_0x9d15('0x42')](db['CmCustomField']['rawAttributes']);_0x37cfd3[_0x9d15('0x2f')]=_[_0x9d15('0x42')](_0x1191fb[_0x9d15('0x2f')]);_0x37cfd3[_0x9d15('0x30')]=_['intersection'](_0x37cfd3['model'],_0x37cfd3[_0x9d15('0x2f')]);_0x16ba5e[_0x9d15('0x32')]=_[_0x9d15('0x43')](_0x37cfd3[_0x9d15('0x2d')],qs[_0x9d15('0x31')](_0x1191fb[_0x9d15('0x2f')]['fields']));_0x16ba5e[_0x9d15('0x32')]=_0x16ba5e[_0x9d15('0x32')][_0x9d15('0x33')]?_0x16ba5e['attributes']:_0x37cfd3[_0x9d15('0x2d')];if(_0x1191fb[_0x9d15('0x2f')]['includeAll']){_0x16ba5e[_0x9d15('0x3e')]=[{'all':!![]}];}_0x16ba5e=_[_0x9d15('0x3c')]({},_0x16ba5e,_0x1191fb[_0x9d15('0x3d')]);return db['CmCustomField'][_0x9d15('0x44')](_0x16ba5e)['then'](handleEntityNotFound(_0x41aded,null))[_0x9d15('0x24')](respondWithResult(_0x41aded,null))[_0x9d15('0x40')](handleError(_0x41aded,null));};exports[_0x9d15('0x45')]=function(_0x42d4dc,_0x4a8153){if(_0x42d4dc[_0x9d15('0x46')]['id']){delete _0x42d4dc[_0x9d15('0x46')]['id'];}return db[_0x9d15('0x29')]['find']({'where':{'id':_0x42d4dc[_0x9d15('0x41')]['id']}})[_0x9d15('0x24')](handleEntityNotFound(_0x4a8153,null))['then'](saveUpdates(_0x42d4dc[_0x9d15('0x46')],null))[_0x9d15('0x24')](respondWithResult(_0x4a8153,null))[_0x9d15('0x40')](handleError(_0x4a8153,null));};exports[_0x9d15('0x47')]=function(_0x5a6950,_0x13b31b){return db[_0x9d15('0x29')][_0x9d15('0x44')]({'where':{'id':_0x5a6950[_0x9d15('0x41')]['id']}})[_0x9d15('0x24')](handleEntityNotFound(_0x13b31b,null))[_0x9d15('0x24')](removeEntity(_0x13b31b,null))[_0x9d15('0x40')](handleError(_0x13b31b,null));};exports[_0x9d15('0x48')]=function(_0x5e21f2,_0x2e39a6){var _0x4fd201;return db[_0x9d15('0x49')][_0x9d15('0x4a')](function(_0x25b5a5){return db[_0x9d15('0x29')][_0x9d15('0x48')](_0x5e21f2[_0x9d15('0x46')],{'transaction':_0x25b5a5})['then'](function(_0x1cf084){_0x4fd201=_0x1cf084;var _0x3c909f={'type':db['Sequelize'][_0x9d15('0x4b')],'transaction':_0x25b5a5};switch(_0x5e21f2[_0x9d15('0x46')]['type']){case _0x9d15('0x4c'):_0x3c909f[_0x9d15('0x2c')]=db[_0x9d15('0x4d')][_0x9d15('0x4b')];break;case _0x9d15('0x4e'):_0x3c909f[_0x9d15('0x2c')]=db[_0x9d15('0x4d')][_0x9d15('0x4f')];break;case _0x9d15('0x50'):_0x3c909f[_0x9d15('0x2c')]=db['Sequelize'][_0x9d15('0x51')];_0x3c909f[_0x9d15('0x52')]=![];break;default:}return db['sequelize'][_0x9d15('0x53')][_0x9d15('0x54')]('cm_contacts',util[_0x9d15('0x55')]('cf_%d',_0x4fd201['id']),_0x3c909f);})['then'](function(){return _0x4fd201;});})[_0x9d15('0x24')](respondWithResult(_0x2e39a6,0xc9))[_0x9d15('0x40')](handleError(_0x2e39a6,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 3ef5e04..4efbe35 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 _0x37bc=['lodash','util','moment','bluebird','request-promise','path','rimraf','./cmCustomField.attributes','exports','define','CmCustomField'];(function(_0x4a88ef,_0x47b00b){var _0x223767=function(_0x2d1f2b){while(--_0x2d1f2b){_0x4a88ef['push'](_0x4a88ef['shift']());}};_0x223767(++_0x47b00b);}(_0x37bc,0x1a2));var _0xc37b=function(_0x18ea18,_0x4f725a){_0x18ea18=_0x18ea18-0x0;var _0x2a43dd=_0x37bc[_0x18ea18];return _0x2a43dd;};'use strict';var _=require(_0xc37b('0x0'));var util=require(_0xc37b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc37b('0x2'));var BPromise=require(_0xc37b('0x3'));var rp=require(_0xc37b('0x4'));var fs=require('fs');var path=require(_0xc37b('0x5'));var rimraf=require(_0xc37b('0x6'));var config=require('../../config/environment');var attributes=require(_0xc37b('0x7'));module[_0xc37b('0x8')]=function(_0x3493e8,_0x399757){return _0x3493e8[_0xc37b('0x9')](_0xc37b('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d3b=['path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','api','moment','bluebird','request-promise'];(function(_0x289307,_0x1a0a87){var _0x2d3b98=function(_0x143963){while(--_0x143963){_0x289307['push'](_0x289307['shift']());}};_0x2d3b98(++_0x1a0a87);}(_0x8d3b,0x1bf));var _0xb8d3=function(_0x3acb36,_0x5f1b57){_0x3acb36=_0x3acb36-0x0;var _0x23d44f=_0x8d3b[_0x3acb36];return _0x23d44f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb8d3('0x0'));var moment=require(_0xb8d3('0x1'));var BPromise=require(_0xb8d3('0x2'));var rp=require(_0xb8d3('0x3'));var fs=require('fs');var path=require(_0xb8d3('0x4'));var rimraf=require(_0xb8d3('0x5'));var config=require(_0xb8d3('0x6'));var attributes=require(_0xb8d3('0x7'));module[_0xb8d3('0x8')]=function(_0x18bda7,_0x5f1175){return _0x18bda7[_0xb8d3('0x9')](_0xb8d3('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index c00a3f1..ea517f4 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 _0xc976=['catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','CmCustomField,\x20%s,\x20%s','message','info','result'];(function(_0x37c62b,_0x331288){var _0x322478=function(_0x2e0e4e){while(--_0x2e0e4e){_0x37c62b['push'](_0x37c62b['shift']());}};_0x322478(++_0x331288);}(_0xc976,0x1b9));var _0x6c97=function(_0x5e0e7e,_0x5cf3d7){_0x5e0e7e=_0x5e0e7e-0x0;var _0x20a1bd=_0xc976[_0x5e0e7e];return _0x20a1bd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6c97('0x0'));var BPromise=require(_0x6c97('0x1'));var rs=require(_0x6c97('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c97('0x3'))['db'];var utils=require(_0x6c97('0x4'));var logger=require(_0x6c97('0x5'))(_0x6c97('0x6'));var config=require('../../config/environment');var jayson=require(_0x6c97('0x7'));var client=jayson['client'][_0x6c97('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x148184,_0x5896ff,_0x49ab89){return new BPromise(function(_0x4d95b1,_0x505677){return client[_0x6c97('0x9')](_0x148184,_0x49ab89)[_0x6c97('0xa')](function(_0x5badba){logger['info']('CmCustomField,\x20%s,\x20%s',_0x5896ff,'request\x20sent');logger['debug'](_0x6c97('0xb'),_0x5896ff,_0x6c97('0xc'),JSON['stringify'](_0x5badba));if(_0x5badba[_0x6c97('0xd')]){if(_0x5badba['error'][_0x6c97('0xe')]===0x1f4){logger[_0x6c97('0xd')](_0x6c97('0xf'),_0x5896ff,_0x5badba['error'][_0x6c97('0x10')]);return _0x505677(_0x5badba['error'][_0x6c97('0x10')]);}logger[_0x6c97('0xd')](_0x6c97('0xf'),_0x5896ff,_0x5badba[_0x6c97('0xd')][_0x6c97('0x10')]);return _0x4d95b1(_0x5badba[_0x6c97('0xd')][_0x6c97('0x10')]);}else{logger[_0x6c97('0x11')](_0x6c97('0xf'),_0x5896ff,_0x6c97('0xc'));_0x4d95b1(_0x5badba[_0x6c97('0x12')][_0x6c97('0x10')]);}})[_0x6c97('0x13')](function(_0x4ad274){logger[_0x6c97('0xd')](_0x6c97('0xf'),_0x5896ff,_0x4ad274);_0x505677(_0x4ad274);});});} \ No newline at end of file +var _0xeccf=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch'];(function(_0x255ff7,_0x1b752a){var _0xeaa41e=function(_0x52a995){while(--_0x52a995){_0x255ff7['push'](_0x255ff7['shift']());}};_0xeaa41e(++_0x1b752a);}(_0xeccf,0x1a9));var _0xfecc=function(_0x15ddb0,_0x1e3910){_0x15ddb0=_0x15ddb0-0x0;var _0x438b5e=_0xeccf[_0x15ddb0];return _0x438b5e;};'use strict';var _=require(_0xfecc('0x0'));var util=require('util');var moment=require(_0xfecc('0x1'));var BPromise=require(_0xfecc('0x2'));var rs=require(_0xfecc('0x3'));var fs=require('fs');var Redis=require(_0xfecc('0x4'));var db=require(_0xfecc('0x5'))['db'];var utils=require(_0xfecc('0x6'));var logger=require(_0xfecc('0x7'))(_0xfecc('0x8'));var config=require('../../config/environment');var jayson=require(_0xfecc('0x9'));var client=jayson[_0xfecc('0xa')][_0xfecc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f9466,_0x476bd8,_0x5581b2){return new BPromise(function(_0x18d0b6,_0x7b4685){return client[_0xfecc('0xc')](_0x1f9466,_0x5581b2)[_0xfecc('0xd')](function(_0x28a6ea){logger[_0xfecc('0xe')]('CmCustomField,\x20%s,\x20%s',_0x476bd8,_0xfecc('0xf'));logger[_0xfecc('0x10')](_0xfecc('0x11'),_0x476bd8,_0xfecc('0xf'),JSON[_0xfecc('0x12')](_0x28a6ea));if(_0x28a6ea[_0xfecc('0x13')]){if(_0x28a6ea[_0xfecc('0x13')][_0xfecc('0x14')]===0x1f4){logger['error'](_0xfecc('0x15'),_0x476bd8,_0x28a6ea[_0xfecc('0x13')][_0xfecc('0x16')]);return _0x7b4685(_0x28a6ea[_0xfecc('0x13')][_0xfecc('0x16')]);}logger[_0xfecc('0x13')](_0xfecc('0x15'),_0x476bd8,_0x28a6ea[_0xfecc('0x13')]['message']);return _0x18d0b6(_0x28a6ea[_0xfecc('0x13')][_0xfecc('0x16')]);}else{logger[_0xfecc('0xe')](_0xfecc('0x15'),_0x476bd8,_0xfecc('0xf'));_0x18d0b6(_0x28a6ea[_0xfecc('0x17')][_0xfecc('0x16')]);}})[_0xfecc('0x18')](function(_0x1da685){logger['error']('CmCustomField,\x20%s,\x20%s',_0x476bd8,_0x1da685);_0x7b4685(_0x1da685);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 8c108c6..8fd2966 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 _0x38ca=['/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','show','post','create'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x38ca,0xb0));var _0xa38c=function(_0x2acb65,_0x2f59d5){_0x2acb65=_0x2acb65-0x0;var _0x504e1e=_0x38ca[_0x2acb65];return _0x504e1e;};'use strict';var multer=require(_0xa38c('0x0'));var util=require('util');var path=require(_0xa38c('0x1'));var timeout=require(_0xa38c('0x2'));var express=require(_0xa38c('0x3'));var router=express[_0xa38c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa38c('0x5'));var interaction=require(_0xa38c('0x6'));var config=require(_0xa38c('0x7'));var controller=require(_0xa38c('0x8'));router['get']('/',auth[_0xa38c('0x9')](),controller[_0xa38c('0xa')]);router['get']('/:id',auth[_0xa38c('0x9')](),controller[_0xa38c('0xb')]);router[_0xa38c('0xc')]('/',auth['isAuthenticated'](),controller[_0xa38c('0xd')]);router['put'](_0xa38c('0xe'),auth[_0xa38c('0x9')](),controller[_0xa38c('0xf')]);router[_0xa38c('0x10')](_0xa38c('0xe'),auth['isAuthenticated'](),controller[_0xa38c('0x11')]);module[_0xa38c('0x12')]=router; \ No newline at end of file +var _0x5419=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4c0d2b,_0x2ff906){var _0x58c4fe=function(_0x21c39a){while(--_0x21c39a){_0x4c0d2b['push'](_0x4c0d2b['shift']());}};_0x58c4fe(++_0x2ff906);}(_0x5419,0x175));var _0x9541=function(_0x1d90ef,_0x39ab6d){_0x1d90ef=_0x1d90ef-0x0;var _0x554777=_0x5419[_0x1d90ef];return _0x554777;};'use strict';var multer=require(_0x9541('0x0'));var util=require(_0x9541('0x1'));var path=require(_0x9541('0x2'));var timeout=require(_0x9541('0x3'));var express=require(_0x9541('0x4'));var router=express[_0x9541('0x5')]();var fs_extra=require(_0x9541('0x6'));var auth=require(_0x9541('0x7'));var interaction=require(_0x9541('0x8'));var config=require(_0x9541('0x9'));var controller=require('./cmCustomField.controller');router[_0x9541('0xa')]('/',auth[_0x9541('0xb')](),controller[_0x9541('0xc')]);router[_0x9541('0xa')](_0x9541('0xd'),auth[_0x9541('0xb')](),controller[_0x9541('0xe')]);router[_0x9541('0xf')]('/',auth['isAuthenticated'](),controller[_0x9541('0x10')]);router['put'](_0x9541('0xd'),auth[_0x9541('0xb')](),controller[_0x9541('0x11')]);router[_0x9541('0x12')](_0x9541('0xd'),auth[_0x9541('0xb')](),controller[_0x9541('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index fe05b5b..16f02ce 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 _0xc363=['sequelize','STRING','BOOLEAN','DATE','INTEGER','UNSIGNED','contactListQueue','moment'];(function(_0x3c0408,_0x186d5b){var _0x5a0943=function(_0x11bedb){while(--_0x11bedb){_0x3c0408['push'](_0x3c0408['shift']());}};_0x5a0943(++_0x186d5b);}(_0xc363,0x137));var _0x3c36=function(_0x30c2ae,_0x4c98a2){_0x30c2ae=_0x30c2ae-0x0;var _0x1ee1cc=_0xc363[_0x30c2ae];return _0x1ee1cc;};'use strict';var moment=require(_0x3c36('0x0'));var Sequelize=require(_0x3c36('0x1'));module['exports']={'phone':{'type':Sequelize[_0x3c36('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x3c36('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x3c36('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x3c36('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3c36('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x3c36('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3c36('0x4')]},'priority':{'type':Sequelize[_0x3c36('0x5')](0x2)[_0x3c36('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x3c36('0x5')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x3c36('0x5')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x3c36('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x3c36('0x5')],'unique':_0x3c36('0x7')},'CampaignId':{'type':Sequelize[_0x3c36('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x3c36('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3c36('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3c36('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3c36('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3c36('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x3c36('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3c36('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x3c36('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xe430=['contactListQueue','moment','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','BOOLEAN','UNSIGNED','INTEGER'];(function(_0x49b931,_0x2b9f96){var _0x454f3a=function(_0x115cb2){while(--_0x115cb2){_0x49b931['push'](_0x49b931['shift']());}};_0x454f3a(++_0x2b9f96);}(_0xe430,0x14e));var _0x0e43=function(_0xaf2aa5,_0x1209e0){_0xaf2aa5=_0xaf2aa5-0x0;var _0x4cfb3f=_0xe430[_0xaf2aa5];return _0x4cfb3f;};'use strict';var moment=require(_0x0e43('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x0e43('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x0e43('0x2')],'defaultValue':moment()[_0x0e43('0x3')](_0x0e43('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x0e43('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0e43('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x0e43('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x0e43('0x7')],'unique':_0x0e43('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x0e43('0x8')},'UserId':{'type':Sequelize[_0x0e43('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x0e43('0x7')],'unique':_0x0e43('0x8')},'CampaignId':{'type':Sequelize[_0x0e43('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x0e43('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0e43('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0e43('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0e43('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x0e43('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x0e43('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0x0e43('0x2')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index e2ddeb4..f22e640 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 _0x57d4=['offset','undefined','count','limit','set','Content-Range','update','sendStatus','error','name','rawAttributes','fieldName','type','key','model','map','query','keys','filters','$and','$gt','$gte','$lt','$lte','$not','$notBetween','$in','$notIn','$like','$iLike','$overlap','$contains','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','CmHopper','then','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','updatedAt','state','deleted','campaign','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','CmHopperFinal','CmHopperAdditionalPhone','getVoiceQueues','outbound','preview','sequelize','transaction','direction','hopperIds','priority','ASC','scheduledAt','DESC','literal','isEmpty','dialOrderByScheduledAt','findOne','scheduledat','UPDATE','CmCompany','Company','CmList','List','Queue','getPreviewRecall','LOCK','Contact','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','push','utcOffset','timezones','moment','lodash','../../config/logger','api','../../config/environment','../../mysqldb','status','json'];(function(_0x11e546,_0x319abe){var _0x3dfa23=function(_0x3a84ed){while(--_0x3a84ed){_0x11e546['push'](_0x11e546['shift']());}};_0x3dfa23(++_0x319abe);}(_0x57d4,0x78));var _0x457d=function(_0x5ecc8b,_0x594ff3){_0x5ecc8b=_0x5ecc8b-0x0;var _0x4bb4d8=_0x57d4[_0x5ecc8b];return _0x4bb4d8;};'use strict';var moment=require(_0x457d('0x0'));var _=require(_0x457d('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x457d('0x2'))(_0x457d('0x3'));var shared=require(_0x457d('0x4'));var db=require(_0x457d('0x5'))['db'];function respondWithResult(_0x1219e1,_0x3c89b2){_0x3c89b2=_0x3c89b2||0xc8;return function(_0x3e2239){if(_0x3e2239){return _0x1219e1[_0x457d('0x6')](_0x3c89b2)[_0x457d('0x7')](_0x3e2239);}};}function respondWithFilteredResult(_0x247ec7,_0x3fd867){return function(_0x5c6816){if(_0x5c6816){var _0x1fc199=typeof _0x3fd867[_0x457d('0x8')]==='undefined'&&typeof _0x3fd867['limit']===_0x457d('0x9');var _0x254453=_0x5c6816[_0x457d('0xa')];var _0x559024=_0x1fc199?0x0:_0x3fd867['offset'];var _0x568a59=_0x1fc199?_0x5c6816[_0x457d('0xa')]:_0x3fd867[_0x457d('0x8')]+_0x3fd867[_0x457d('0xb')];var _0x128e09;if(_0x568a59>=_0x254453){_0x568a59=_0x254453;_0x128e09=0xc8;}else{_0x128e09=0xce;}_0x247ec7[_0x457d('0x6')](_0x128e09);return _0x247ec7[_0x457d('0xc')](_0x457d('0xd'),_0x559024+'-'+_0x568a59+'/'+_0x254453)[_0x457d('0x7')](_0x5c6816);}return null;};}function saveUpdates(_0xe7d200,_0x5abf49){return function(_0x239a20){if(_0x239a20){return _0x239a20[_0x457d('0xe')](_0xe7d200)['then'](function(_0x5e1841){return _0x5e1841;});}return null;};}function handleEntityNotFound(_0x44740f,_0x19ac04){return function(_0x3e59d9){if(!_0x3e59d9){_0x44740f[_0x457d('0xf')](0x194);}return _0x3e59d9;};}function handleError(_0x2ac416,_0x3e62f8){_0x3e62f8=_0x3e62f8||0x1f4;return function(_0xeac953){logger[_0x457d('0x10')](_0xeac953['stack']);if(_0xeac953[_0x457d('0x11')]){delete _0xeac953[_0x457d('0x11')];}_0x2ac416[_0x457d('0x6')](_0x3e62f8)['send'](_0xeac953);};}exports['index']=function(_0xc0751f,_0x4d988f){var _0x151416={},_0x802f2b={},_0x50e78f={'count':0x0,'rows':[]};var _0x2a22b6=_['map'](db['CmHopper'][_0x457d('0x12')],function(_0xe6cfcc){return{'name':_0xe6cfcc[_0x457d('0x13')],'type':_0xe6cfcc[_0x457d('0x14')][_0x457d('0x15')]};});_0x802f2b[_0x457d('0x16')]=_[_0x457d('0x17')](_0x2a22b6,_0x457d('0x11'));_0x802f2b[_0x457d('0x18')]=_[_0x457d('0x19')](_0xc0751f['query']);_0x802f2b['filters']=_['intersection'](_0x802f2b[_0x457d('0x16')],_0x802f2b['query']);_0x802f2b['filters']=_['concat'](_0x802f2b[_0x457d('0x1a')],[_0x457d('0x1b'),'$or',_0x457d('0x1c'),_0x457d('0x1d'),_0x457d('0x1e'),_0x457d('0x1f'),'$ne','$eq',_0x457d('0x20'),'$between',_0x457d('0x21'),_0x457d('0x22'),_0x457d('0x23'),_0x457d('0x24'),'$notLike',_0x457d('0x25'),'$notILike','$like',_0x457d('0x26'),_0x457d('0x27'),'$contained',_0x457d('0x28')]);_0x151416[_0x457d('0x29')]=_['intersection'](_0x802f2b[_0x457d('0x16')],qs[_0x457d('0x2a')](_0xc0751f[_0x457d('0x18')][_0x457d('0x2a')]));_0x151416[_0x457d('0x29')]=_0x151416[_0x457d('0x29')][_0x457d('0x2b')]?_0x151416[_0x457d('0x29')]:_0x802f2b[_0x457d('0x16')];if(!_0xc0751f[_0x457d('0x18')][_0x457d('0x2c')](_0x457d('0x2d'))){_0x151416[_0x457d('0xb')]=qs[_0x457d('0xb')](_0xc0751f[_0x457d('0x18')][_0x457d('0xb')]);_0x151416[_0x457d('0x8')]=qs[_0x457d('0x8')](_0xc0751f['query'][_0x457d('0x8')]);}_0x151416[_0x457d('0x2e')]=qs['sort'](_0xc0751f['query'][_0x457d('0x2f')]);_0x151416[_0x457d('0x30')]=qs['filters'](_[_0x457d('0x31')](_0xc0751f[_0x457d('0x18')],_0x802f2b[_0x457d('0x1a')]),_0x2a22b6);if(_0xc0751f[_0x457d('0x18')][_0x457d('0x32')]){_0x151416[_0x457d('0x30')]=_[_0x457d('0x33')](_0x151416[_0x457d('0x30')],{'$or':_[_0x457d('0x17')](_0x2a22b6,function(_0xde9836){if(_0xde9836[_0x457d('0x14')]!==_0x457d('0x34')){var _0x237be1={};_0x237be1[_0xde9836[_0x457d('0x11')]]={'$like':'%'+_0xc0751f[_0x457d('0x18')]['filter']+'%'};return _0x237be1;}})});}_0x151416=_[_0x457d('0x33')]({},_0x151416,_0xc0751f['options']);var _0x5a3db2={'where':_0x151416['where']};return db[_0x457d('0x35')]['count'](_0x5a3db2)[_0x457d('0x36')](function(_0x55e580){_0x50e78f['count']=_0x55e580;if(_0xc0751f[_0x457d('0x18')][_0x457d('0x37')]){_0x151416[_0x457d('0x38')]=[{'all':!![]}];}return db[_0x457d('0x35')][_0x457d('0x39')](_0x151416);})[_0x457d('0x36')](function(_0x23a9ee){_0x50e78f[_0x457d('0x3a')]=_0x23a9ee;return _0x50e78f;})[_0x457d('0x36')](respondWithFilteredResult(_0x4d988f,_0x151416))[_0x457d('0x3b')](handleError(_0x4d988f,null));};exports[_0x457d('0x3c')]=function(_0x160755,_0x1cad8c){var _0x330af1={'raw':!![],'where':{'id':_0x160755[_0x457d('0x3d')]['id']}},_0x3b6a8b={};_0x3b6a8b[_0x457d('0x16')]=_['keys'](db[_0x457d('0x35')]['rawAttributes']);_0x3b6a8b[_0x457d('0x18')]=_[_0x457d('0x19')](_0x160755[_0x457d('0x18')]);_0x3b6a8b[_0x457d('0x1a')]=_[_0x457d('0x3e')](_0x3b6a8b['model'],_0x3b6a8b['query']);_0x330af1[_0x457d('0x29')]=_['intersection'](_0x3b6a8b[_0x457d('0x16')],qs[_0x457d('0x2a')](_0x160755[_0x457d('0x18')]['fields']));_0x330af1[_0x457d('0x29')]=_0x330af1[_0x457d('0x29')][_0x457d('0x2b')]?_0x330af1[_0x457d('0x29')]:_0x3b6a8b[_0x457d('0x16')];if(_0x160755[_0x457d('0x18')][_0x457d('0x37')]){_0x330af1[_0x457d('0x38')]=[{'all':!![]}];}_0x330af1=_[_0x457d('0x33')]({},_0x330af1,_0x160755['options']);return db['CmHopper'][_0x457d('0x3f')](_0x330af1)[_0x457d('0x36')](handleEntityNotFound(_0x1cad8c,null))[_0x457d('0x36')](respondWithResult(_0x1cad8c,null))[_0x457d('0x3b')](handleError(_0x1cad8c,null));};exports[_0x457d('0x40')]=function(_0x183476,_0x5daa2c){return db[_0x457d('0x35')][_0x457d('0x40')](_0x183476[_0x457d('0x41')],{})['then'](respondWithResult(_0x5daa2c,0xc9))[_0x457d('0x3b')](handleError(_0x5daa2c,null));};exports[_0x457d('0xe')]=function(_0x1ac53f,_0x4d0507){if(_0x1ac53f[_0x457d('0x41')]['id']){delete _0x1ac53f[_0x457d('0x41')]['id'];}return db[_0x457d('0x35')][_0x457d('0x3f')]({'where':{'id':_0x1ac53f['params']['id']}})[_0x457d('0x36')](handleEntityNotFound(_0x4d0507,null))[_0x457d('0x36')](saveUpdates(_0x1ac53f[_0x457d('0x41')],null))[_0x457d('0x36')](respondWithResult(_0x4d0507,null))[_0x457d('0x3b')](handleError(_0x4d0507,null));};exports[_0x457d('0x42')]=function(_0x13787f,_0x3f7efa){return db[_0x457d('0x35')][_0x457d('0x42')]()['then'](respondWithResult(_0x3f7efa,null))[_0x457d('0x3b')](handleError(_0x3f7efa,null));};exports[_0x457d('0x43')]=function(_0x7abdf1,_0x545e67){var _0x481a89;var _0x450ad7=_0x7abdf1[_0x457d('0x3d')]['id'];return db[_0x457d('0x35')][_0x457d('0x3f')]({'where':{'id':_0x7abdf1[_0x457d('0x3d')]['id']}})[_0x457d('0x36')](handleEntityNotFound(_0x545e67,null))[_0x457d('0x36')](function(_0x7a1e61){if(_0x7a1e61){return _0x7a1e61['destroy']()['then'](function(_0xec7449){return _0xec7449;});}})[_0x457d('0x36')](function(_0x3e33c6){_0x481a89=_0x3e33c6;if(_0x3e33c6){if(_0x3e33c6[_0x457d('0x44')]||_0x3e33c6[_0x457d('0x45')]){return db[_0x3e33c6[_0x457d('0x44')]?_0x457d('0x46'):_0x457d('0x47')][_0x457d('0x3f')]({'where':{'id':_0x3e33c6[_0x457d('0x44')]?_0x3e33c6[_0x457d('0x44')]:_0x3e33c6[_0x457d('0x45')]},'attributes':['id',_0x457d('0x11')],'raw':!![]});}}})[_0x457d('0x36')](function(_0x4fe2f3){var _0x36e057={};if(_0x4fe2f3){_[_0x457d('0x33')](_0x36e057,_[_0x457d('0x48')](_0x481a89[_0x457d('0x49')],['createdAt',_0x457d('0x4a'),'id']));_0x36e057[_0x457d('0x4b')]=0x15;_0x36e057['statedesc']=_0x457d('0x4c');_0x36e057[_0x457d('0x4d')]=_0x4fe2f3[_0x457d('0x11')];_0x36e057['membername']=_0x7abdf1['user'][_0x457d('0x11')];_0x36e057['UserId']=_0x7abdf1[_0x457d('0x4e')]['id'];_0x36e057[_0x457d('0x4c')]=!![];_0x36e057[_0x457d('0x4f')]=moment()[_0x457d('0x50')](_0x457d('0x51'));_0x36e057[_0x457d('0x52')]=_0x481a89[_0x457d('0x53')];_0x36e057[_0x457d('0x54')]=_0x481a89[_0x457d('0x44')]?_0x457d('0x55'):_0x457d('0x56');return db[_0x457d('0x57')][_0x457d('0x3f')]({'where':{'id':_0x36e057[_0x457d('0x58')]},'attributes':['firstName',_0x457d('0x59')]})[_0x457d('0x36')](function(_0x4e865a){if(!_[_0x457d('0x5a')](_0x545e67)&&!_['isNil'](_0x4e865a[_0x457d('0x5b')])){_0x36e057[_0x457d('0x5c')]=_0x4e865a['firstName'];if(!_[_0x457d('0x5a')](_0x4e865a[_0x457d('0x59')])){_0x36e057[_0x457d('0x5c')]+='\x20'+_0x4e865a[_0x457d('0x59')];}}})['finally'](function(){return db[_0x457d('0x5d')]['create'](_0x36e057);});}})[_0x457d('0x36')](function(_0x58169c){return db[_0x457d('0x5e')][_0x457d('0x43')]({'where':{'CmHopperId':_0x450ad7}});})['then'](function(){return _0x545e67[_0x457d('0x6')](0xcc)['end']();})['catch'](handleError(_0x545e67,null));};exports['getPreview']=function(_0x3bef1c,_0x123a54){var _0x592ba9=[];return db[_0x457d('0x57')][_0x457d('0x42')]()[_0x457d('0x36')](function(_0x6eef82){_0x592ba9=_[_0x457d('0x19')](_0x6eef82);return _0x3bef1c[_0x457d('0x4e')][_0x457d('0x5f')]({'where':{'type':_0x457d('0x60'),'dialActive':!![],'dialMethod':_0x457d('0x61')},'attributes':['id','dialOrderByScheduledAt','dialPreviewAutoRecallMe'],'raw':!![]});})[_0x457d('0x36')](function(_0x1230cf){if(_0x1230cf&&_0x1230cf[_0x457d('0x2b')]){return db[_0x457d('0x62')][_0x457d('0x63')](function(_0x3e80cf){var _0x420bb8={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x457d('0x50')](_0x457d('0x51'))},'VoiceQueueId':{'$in':_[_0x457d('0x17')](_0x1230cf,'id')},'$or':[{'UserId':null},{'UserId':_0x3bef1c['user']['id']}]};var _0x57316a={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1230cf)[_0x457d('0x32')](['dialPreviewAutoRecallMe',0x0])[_0x457d('0x17')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x3bef1c[_0x457d('0x4e')]['id']}]};var _0x37b918={'$or':[_0x420bb8,_0x57316a]};var _0x97ebe7=[];if(_0x3bef1c['body']['direction']&&_0x3bef1c[_0x457d('0x41')][_0x457d('0x64')]==='prev'){if(!_['isEmpty'](_0x3bef1c[_0x457d('0x41')][_0x457d('0x65')])){_0x37b918['id']={'$in':_0x3bef1c['body'][_0x457d('0x65')]};}_0x97ebe7=[[_0x457d('0x66'),_0x457d('0x67')],[_0x457d('0x68'),_0x1230cf[0x0]['dialOrderByScheduledAt']===_0x457d('0x67')?_0x457d('0x69'):_0x457d('0x67')],db[_0x457d('0x62')][_0x457d('0x6a')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x457d('0x69')]];}else{if(!_[_0x457d('0x6b')](_0x3bef1c['body']['hopperIds'])){_0x37b918['id']={'$notIn':_0x3bef1c[_0x457d('0x41')][_0x457d('0x65')]};}_0x97ebe7=[[_0x457d('0x66'),_0x457d('0x69')],[_0x457d('0x68'),_0x1230cf[0x0][_0x457d('0x6c')]],db[_0x457d('0x62')][_0x457d('0x6a')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x457d('0x67')]];}return db[_0x457d('0x35')][_0x457d('0x6d')]({'attributes':['id',_0x457d('0x6e'),_0x457d('0x53'),'recallme'],'where':_0x37b918,'order':_0x97ebe7,'transaction':_0x3e80cf,'lock':_0x3e80cf['LOCK'][_0x457d('0x6f')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x592ba9,'include':[{'model':db[_0x457d('0x70')],'as':_0x457d('0x71'),'attributes':['id',_0x457d('0x11')]}]},{'model':db[_0x457d('0x72')],'as':_0x457d('0x73'),'attributes':['id',_0x457d('0x11')]},{'model':db[_0x457d('0x46')],'as':_0x457d('0x74'),'attributes':['id','name','dialActive']}]})[_0x457d('0x36')](function(_0x56e002){if(_0x56e002){return _0x56e002[_0x457d('0xe')]({'UserId':_0x3bef1c[_0x457d('0x4e')]['id']},{'transaction':_0x3e80cf});}});});}})[_0x457d('0x36')](handleEntityNotFound(_0x123a54,null))[_0x457d('0x36')](respondWithResult(_0x123a54,null))['catch'](handleError(_0x123a54,null));};exports[_0x457d('0x75')]=function(_0x4b4cac,_0x5758ec,_0x474599){var _0x49ceab=[];var _0x1d4181=_0x4b4cac[_0x457d('0x3d')]['id'];var _0x138abc=_0x4b4cac[_0x457d('0x4e')]['id'];return db[_0x457d('0x57')][_0x457d('0x42')]()[_0x457d('0x36')](function(_0x2ef13f){_0x49ceab=_['keys'](_0x2ef13f);return db[_0x457d('0x62')][_0x457d('0x63')](function(_0x357077){const _0x33f6fb={'id':_0x1d4181};return db['CmHopper']['findOne']({'attributes':['id','scheduledat','recallme'],'where':_0x33f6fb,'transaction':_0x357077,'lock':_0x357077[_0x457d('0x76')]['UPDATE'],'include':[{'model':db[_0x457d('0x57')],'as':_0x457d('0x77'),'attributes':_0x49ceab,'include':[{'model':db[_0x457d('0x70')],'as':_0x457d('0x71'),'attributes':['id',_0x457d('0x11')]}]},{'model':db[_0x457d('0x72')],'as':_0x457d('0x73'),'attributes':['id','name']},{'model':db[_0x457d('0x46')],'as':_0x457d('0x74'),'attributes':['id','name','dialActive']}]})[_0x457d('0x36')](function(_0x233572){if(_0x233572){return _0x233572[_0x457d('0xe')]({'UserId':_0x138abc},{'transaction':_0x357077});}});});})['then'](handleEntityNotFound(_0x5758ec,null))[_0x457d('0x36')](respondWithResult(_0x5758ec,null))[_0x457d('0x3b')](handleError(_0x5758ec,null));};exports[_0x457d('0x78')]=function(_0x3086bb,_0x3065b7){return _0x3086bb['user'][_0x457d('0x5f')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x457d('0x61')},'attributes':['id'],'raw':!![]})[_0x457d('0x36')](function(_0x14d449){if(_0x14d449&&_0x14d449['length']){return db[_0x457d('0x35')][_0x457d('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x457d('0x50')](_0x457d('0x51'))},'VoiceQueueId':{'$in':_['map'](_0x14d449,'id')},'$or':[{'UserId':null},{'UserId':_0x3086bb[_0x457d('0x4e')]['id']}]}});}return 0x0;})[_0x457d('0x36')](function(_0x312757){if(!_[_0x457d('0x5a')](_0x312757)&&_[_0x457d('0x79')](_0x312757)){return _0x3065b7[_0x457d('0x6')](0xc8)[_0x457d('0x7')]({'contacts':_0x312757});}else{logger['error'](_0x457d('0x7a'),'getOpenContacts',0x194,_0x457d('0x7b'));_0x3065b7[_0x457d('0xf')](0x194);}})[_0x457d('0x3b')](handleError(_0x3065b7,null));};exports[_0x457d('0x7c')]=function(_0x9c2df,_0x218b80){var _0x308916=shared['timezones'];var _0x3aac80=[];_[_0x457d('0x17')](_0x308916,function(_0x30a4f3){_0x3aac80[_0x457d('0x7d')]({'id':_0x30a4f3['name'],'name':_0x30a4f3['name'],'utcOffset':_0x30a4f3[_0x457d('0x7e')]});});return _0x218b80[_0x457d('0x6')](0xc8)[_0x457d('0x7')]({'tz':_0x3aac80});};exports['getTimezone']=function(_0x497739,_0x445215){var _0x5b65f3=shared[_0x457d('0x7f')];var _0x36efe4={};if(!_[_0x457d('0x5a')](_0x5b65f3[_0x497739['body']['id']]))_0x36efe4=_0x5b65f3[_0x497739[_0x457d('0x41')]['id']];return _0x445215['status'](0xc8)[_0x457d('0x7')](_0x36efe4);}; \ No newline at end of file +var _0x23f4=['VIRTUAL','merge','options','CmHopper','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','CampaignId','dataValues','updatedAt','state','statedesc','deleted','campaign','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','priority','findOne','recallme','LOCK','Contact','CmCompany','Queue','dialActive','getPreviewRecall','transaction','scheduledat','UPDATE','Company','CmList','List','getOpenContacts','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','lodash','api','../../config/environment','../../mysqldb','status','json','undefined','limit','offset','count','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','keys','query','intersection','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notILike','$overlap','$any','attributes','model','fields','length','hasOwnProperty','nolimit','sort','filter','where'];(function(_0x318ca1,_0x263b46){var _0x380e6e=function(_0x550173){while(--_0x550173){_0x318ca1['push'](_0x318ca1['shift']());}};_0x380e6e(++_0x263b46);}(_0x23f4,0x1ee));var _0x423f=function(_0x32cc69,_0x3a52c2){_0x32cc69=_0x32cc69-0x0;var _0x5c41bd=_0x23f4[_0x32cc69];return _0x5c41bd;};'use strict';var moment=require('moment');var _=require(_0x423f('0x0'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x423f('0x1'));var shared=require(_0x423f('0x2'));var db=require(_0x423f('0x3'))['db'];function respondWithResult(_0x3503a0,_0x1ab106){_0x1ab106=_0x1ab106||0xc8;return function(_0x129dba){if(_0x129dba){return _0x3503a0[_0x423f('0x4')](_0x1ab106)[_0x423f('0x5')](_0x129dba);}};}function respondWithFilteredResult(_0x34a2d9,_0x51066b){return function(_0x260eae){if(_0x260eae){var _0x47716d=typeof _0x51066b['offset']===_0x423f('0x6')&&typeof _0x51066b[_0x423f('0x7')]===_0x423f('0x6');var _0x50301a=_0x260eae['count'];var _0x4b8a90=_0x47716d?0x0:_0x51066b[_0x423f('0x8')];var _0x481c41=_0x47716d?_0x260eae[_0x423f('0x9')]:_0x51066b[_0x423f('0x8')]+_0x51066b[_0x423f('0x7')];var _0x162c83;if(_0x481c41>=_0x50301a){_0x481c41=_0x50301a;_0x162c83=0xc8;}else{_0x162c83=0xce;}_0x34a2d9['status'](_0x162c83);return _0x34a2d9[_0x423f('0xa')](_0x423f('0xb'),_0x4b8a90+'-'+_0x481c41+'/'+_0x50301a)[_0x423f('0x5')](_0x260eae);}return null;};}function saveUpdates(_0x3d4027,_0x216360){return function(_0x5275b0){if(_0x5275b0){return _0x5275b0[_0x423f('0xc')](_0x3d4027)[_0x423f('0xd')](function(_0x2ebc8c){return _0x2ebc8c;});}return null;};}function handleEntityNotFound(_0x1c894f,_0x44e1d5){return function(_0x3b531d){if(!_0x3b531d){_0x1c894f[_0x423f('0xe')](0x194);}return _0x3b531d;};}function handleError(_0x21d804,_0x252e6c){_0x252e6c=_0x252e6c||0x1f4;return function(_0x235c86){logger[_0x423f('0xf')](_0x235c86[_0x423f('0x10')]);if(_0x235c86[_0x423f('0x11')]){delete _0x235c86[_0x423f('0x11')];}_0x21d804[_0x423f('0x4')](_0x252e6c)[_0x423f('0x12')](_0x235c86);};}exports[_0x423f('0x13')]=function(_0x34e968,_0x26b6d1){var _0x5424e6={},_0x99435f={},_0x569fd0={'count':0x0,'rows':[]};var _0x504d8b=_[_0x423f('0x14')](db['CmHopper'][_0x423f('0x15')],function(_0xd7b80e){return{'name':_0xd7b80e['fieldName'],'type':_0xd7b80e[_0x423f('0x16')][_0x423f('0x17')]};});_0x99435f['model']=_[_0x423f('0x14')](_0x504d8b,_0x423f('0x11'));_0x99435f['query']=_[_0x423f('0x18')](_0x34e968[_0x423f('0x19')]);_0x99435f['filters']=_[_0x423f('0x1a')](_0x99435f['model'],_0x99435f[_0x423f('0x19')]);_0x99435f[_0x423f('0x1b')]=_[_0x423f('0x1c')](_0x99435f[_0x423f('0x1b')],[_0x423f('0x1d'),_0x423f('0x1e'),_0x423f('0x1f'),_0x423f('0x20'),_0x423f('0x21'),_0x423f('0x22'),_0x423f('0x23'),_0x423f('0x24'),_0x423f('0x25'),_0x423f('0x26'),'$notBetween',_0x423f('0x27'),_0x423f('0x28'),_0x423f('0x29'),'$notLike','$iLike',_0x423f('0x2a'),_0x423f('0x29'),_0x423f('0x2b'),'$contains','$contained',_0x423f('0x2c')]);_0x5424e6[_0x423f('0x2d')]=_['intersection'](_0x99435f[_0x423f('0x2e')],qs[_0x423f('0x2f')](_0x34e968[_0x423f('0x19')][_0x423f('0x2f')]));_0x5424e6['attributes']=_0x5424e6[_0x423f('0x2d')][_0x423f('0x30')]?_0x5424e6[_0x423f('0x2d')]:_0x99435f[_0x423f('0x2e')];if(!_0x34e968['query'][_0x423f('0x31')](_0x423f('0x32'))){_0x5424e6[_0x423f('0x7')]=qs[_0x423f('0x7')](_0x34e968[_0x423f('0x19')][_0x423f('0x7')]);_0x5424e6[_0x423f('0x8')]=qs[_0x423f('0x8')](_0x34e968[_0x423f('0x19')][_0x423f('0x8')]);}_0x5424e6['order']=qs[_0x423f('0x33')](_0x34e968[_0x423f('0x19')][_0x423f('0x33')]);_0x5424e6['where']=qs[_0x423f('0x1b')](_['pick'](_0x34e968[_0x423f('0x19')],_0x99435f[_0x423f('0x1b')]),_0x504d8b);if(_0x34e968[_0x423f('0x19')][_0x423f('0x34')]){_0x5424e6[_0x423f('0x35')]=_['merge'](_0x5424e6['where'],{'$or':_[_0x423f('0x14')](_0x504d8b,function(_0x5a2225){if(_0x5a2225[_0x423f('0x16')]!==_0x423f('0x36')){var _0x3e4c9f={};_0x3e4c9f[_0x5a2225[_0x423f('0x11')]]={'$like':'%'+_0x34e968[_0x423f('0x19')][_0x423f('0x34')]+'%'};return _0x3e4c9f;}})});}_0x5424e6=_[_0x423f('0x37')]({},_0x5424e6,_0x34e968[_0x423f('0x38')]);var _0x3aeb17={'where':_0x5424e6[_0x423f('0x35')]};return db[_0x423f('0x39')]['count'](_0x3aeb17)['then'](function(_0x382f91){_0x569fd0[_0x423f('0x9')]=_0x382f91;if(_0x34e968[_0x423f('0x19')][_0x423f('0x3a')]){_0x5424e6[_0x423f('0x3b')]=[{'all':!![]}];}return db['CmHopper'][_0x423f('0x3c')](_0x5424e6);})[_0x423f('0xd')](function(_0x2e6d28){_0x569fd0[_0x423f('0x3d')]=_0x2e6d28;return _0x569fd0;})[_0x423f('0xd')](respondWithFilteredResult(_0x26b6d1,_0x5424e6))[_0x423f('0x3e')](handleError(_0x26b6d1,null));};exports[_0x423f('0x3f')]=function(_0x1d280f,_0x3464e3){var _0x40571a={'raw':!![],'where':{'id':_0x1d280f['params']['id']}},_0x4fb566={};_0x4fb566[_0x423f('0x2e')]=_[_0x423f('0x18')](db[_0x423f('0x39')][_0x423f('0x15')]);_0x4fb566[_0x423f('0x19')]=_[_0x423f('0x18')](_0x1d280f['query']);_0x4fb566[_0x423f('0x1b')]=_[_0x423f('0x1a')](_0x4fb566[_0x423f('0x2e')],_0x4fb566[_0x423f('0x19')]);_0x40571a[_0x423f('0x2d')]=_[_0x423f('0x1a')](_0x4fb566[_0x423f('0x2e')],qs[_0x423f('0x2f')](_0x1d280f['query'][_0x423f('0x2f')]));_0x40571a[_0x423f('0x2d')]=_0x40571a[_0x423f('0x2d')][_0x423f('0x30')]?_0x40571a[_0x423f('0x2d')]:_0x4fb566[_0x423f('0x2e')];if(_0x1d280f[_0x423f('0x19')][_0x423f('0x3a')]){_0x40571a[_0x423f('0x3b')]=[{'all':!![]}];}_0x40571a=_['merge']({},_0x40571a,_0x1d280f[_0x423f('0x38')]);return db['CmHopper'][_0x423f('0x40')](_0x40571a)[_0x423f('0xd')](handleEntityNotFound(_0x3464e3,null))[_0x423f('0xd')](respondWithResult(_0x3464e3,null))[_0x423f('0x3e')](handleError(_0x3464e3,null));};exports[_0x423f('0x41')]=function(_0x3ad48c,_0x3087e4){return db[_0x423f('0x39')][_0x423f('0x41')](_0x3ad48c[_0x423f('0x42')],{})[_0x423f('0xd')](respondWithResult(_0x3087e4,0xc9))[_0x423f('0x3e')](handleError(_0x3087e4,null));};exports[_0x423f('0xc')]=function(_0x350e11,_0xa7708c){if(_0x350e11[_0x423f('0x42')]['id']){delete _0x350e11[_0x423f('0x42')]['id'];}return db[_0x423f('0x39')][_0x423f('0x40')]({'where':{'id':_0x350e11[_0x423f('0x43')]['id']}})['then'](handleEntityNotFound(_0xa7708c,null))[_0x423f('0xd')](saveUpdates(_0x350e11['body'],null))[_0x423f('0xd')](respondWithResult(_0xa7708c,null))[_0x423f('0x3e')](handleError(_0xa7708c,null));};exports[_0x423f('0x44')]=function(_0x37035a,_0x57f5d6){return db[_0x423f('0x39')][_0x423f('0x44')]()[_0x423f('0xd')](respondWithResult(_0x57f5d6,null))[_0x423f('0x3e')](handleError(_0x57f5d6,null));};exports[_0x423f('0x45')]=function(_0x31b88e,_0x2dcbec){var _0x489894;var _0x1e2b9f=_0x31b88e[_0x423f('0x43')]['id'];return db['CmHopper'][_0x423f('0x40')]({'where':{'id':_0x31b88e['params']['id']}})[_0x423f('0xd')](handleEntityNotFound(_0x2dcbec,null))['then'](function(_0x56e907){if(_0x56e907){return _0x56e907[_0x423f('0x45')]()[_0x423f('0xd')](function(_0x1668d4){return _0x1668d4;});}})[_0x423f('0xd')](function(_0x545476){_0x489894=_0x545476;if(_0x545476){if(_0x545476[_0x423f('0x46')]||_0x545476['CampaignId']){return db[_0x545476[_0x423f('0x46')]?_0x423f('0x47'):_0x423f('0x48')][_0x423f('0x40')]({'where':{'id':_0x545476[_0x423f('0x46')]?_0x545476[_0x423f('0x46')]:_0x545476[_0x423f('0x49')]},'attributes':['id',_0x423f('0x11')],'raw':!![]});}}})[_0x423f('0xd')](function(_0x4e3003){var _0x104fd9={};if(_0x4e3003){_[_0x423f('0x37')](_0x104fd9,_['omit'](_0x489894[_0x423f('0x4a')],['createdAt',_0x423f('0x4b'),'id']));_0x104fd9[_0x423f('0x4c')]=0x15;_0x104fd9[_0x423f('0x4d')]=_0x423f('0x4e');_0x104fd9[_0x423f('0x4f')]=_0x4e3003[_0x423f('0x11')];_0x104fd9['membername']=_0x31b88e['user'][_0x423f('0x11')];_0x104fd9[_0x423f('0x50')]=_0x31b88e[_0x423f('0x51')]['id'];_0x104fd9[_0x423f('0x4e')]=!![];_0x104fd9[_0x423f('0x52')]=moment()[_0x423f('0x53')](_0x423f('0x54'));_0x104fd9[_0x423f('0x55')]=_0x489894[_0x423f('0x56')];_0x104fd9['campaigntype']=_0x489894[_0x423f('0x46')]?_0x423f('0x57'):'ivr';return db[_0x423f('0x58')]['find']({'where':{'id':_0x104fd9[_0x423f('0x59')]},'attributes':[_0x423f('0x5a'),_0x423f('0x5b')]})['then'](function(_0x5c39e4){if(!_[_0x423f('0x5c')](_0x2dcbec)&&!_[_0x423f('0x5c')](_0x5c39e4[_0x423f('0x5a')])){_0x104fd9['calleridname']=_0x5c39e4[_0x423f('0x5a')];if(!_[_0x423f('0x5c')](_0x5c39e4[_0x423f('0x5b')])){_0x104fd9[_0x423f('0x5d')]+='\x20'+_0x5c39e4[_0x423f('0x5b')];}}})[_0x423f('0x5e')](function(){return db[_0x423f('0x5f')]['create'](_0x104fd9);});}})[_0x423f('0xd')](function(_0x588483){return db[_0x423f('0x60')][_0x423f('0x45')]({'where':{'CmHopperId':_0x1e2b9f}});})[_0x423f('0xd')](function(){return _0x2dcbec[_0x423f('0x4')](0xcc)['end']();})[_0x423f('0x3e')](handleError(_0x2dcbec,null));};exports[_0x423f('0x61')]=function(_0x4c33c7,_0x5ae8a9){var _0xfe89a9=[];return db[_0x423f('0x58')]['describe']()[_0x423f('0xd')](function(_0x1897ff){_0xfe89a9=_['keys'](_0x1897ff);return _0x4c33c7['user']['getVoiceQueues']({'where':{'type':_0x423f('0x62'),'dialActive':!![],'dialMethod':_0x423f('0x63')},'attributes':['id',_0x423f('0x64'),_0x423f('0x65')],'raw':!![]});})['then'](function(_0x4fa0ef){if(_0x4fa0ef&&_0x4fa0ef[_0x423f('0x30')]){return db[_0x423f('0x66')]['transaction'](function(_0x43b569){var _0x13ed0b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x423f('0x53')](_0x423f('0x54'))},'VoiceQueueId':{'$in':_[_0x423f('0x14')](_0x4fa0ef,'id')},'$or':[{'UserId':null},{'UserId':_0x4c33c7[_0x423f('0x51')]['id']}]};var _0x116605={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4fa0ef)['filter']([_0x423f('0x65'),0x0])[_0x423f('0x14')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x4c33c7[_0x423f('0x51')]['id']}]};var _0x223e8c={'$or':[_0x13ed0b,_0x116605]};var _0x3e5d47=[];if(_0x4c33c7['body'][_0x423f('0x67')]&&_0x4c33c7[_0x423f('0x42')][_0x423f('0x67')]===_0x423f('0x68')){if(!_[_0x423f('0x69')](_0x4c33c7[_0x423f('0x42')][_0x423f('0x6a')])){_0x223e8c['id']={'$in':_0x4c33c7[_0x423f('0x42')][_0x423f('0x6a')]};}_0x3e5d47=[['priority',_0x423f('0x6b')],[_0x423f('0x6c'),_0x4fa0ef[0x0][_0x423f('0x64')]===_0x423f('0x6b')?'DESC':_0x423f('0x6b')],db[_0x423f('0x66')][_0x423f('0x6d')](_0x423f('0x6e')),['id',_0x423f('0x6f')]];}else{if(!_[_0x423f('0x69')](_0x4c33c7[_0x423f('0x42')]['hopperIds'])){_0x223e8c['id']={'$notIn':_0x4c33c7[_0x423f('0x42')][_0x423f('0x6a')]};}_0x3e5d47=[[_0x423f('0x70'),_0x423f('0x6f')],['scheduledAt',_0x4fa0ef[0x0][_0x423f('0x64')]],db[_0x423f('0x66')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x423f('0x6b')]];}return db[_0x423f('0x39')][_0x423f('0x71')]({'attributes':['id','scheduledat',_0x423f('0x56'),_0x423f('0x72')],'where':_0x223e8c,'order':_0x3e5d47,'transaction':_0x43b569,'lock':_0x43b569[_0x423f('0x73')]['UPDATE'],'include':[{'model':db[_0x423f('0x58')],'as':_0x423f('0x74'),'attributes':_0xfe89a9,'include':[{'model':db[_0x423f('0x75')],'as':'Company','attributes':['id',_0x423f('0x11')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x423f('0x11')]},{'model':db[_0x423f('0x47')],'as':_0x423f('0x76'),'attributes':['id',_0x423f('0x11'),_0x423f('0x77')]}]})['then'](function(_0x29e60c){if(_0x29e60c){return _0x29e60c[_0x423f('0xc')]({'UserId':_0x4c33c7[_0x423f('0x51')]['id']},{'transaction':_0x43b569});}});});}})[_0x423f('0xd')](handleEntityNotFound(_0x5ae8a9,null))[_0x423f('0xd')](respondWithResult(_0x5ae8a9,null))[_0x423f('0x3e')](handleError(_0x5ae8a9,null));};exports[_0x423f('0x78')]=function(_0x5b9577,_0x4e1e04,_0xd9409e){var _0x320528=[];var _0xe76487=_0x5b9577[_0x423f('0x43')]['id'];var _0x3cffc3=_0x5b9577['user']['id'];return db[_0x423f('0x58')][_0x423f('0x44')]()[_0x423f('0xd')](function(_0x358ab3){_0x320528=_[_0x423f('0x18')](_0x358ab3);return db[_0x423f('0x66')][_0x423f('0x79')](function(_0x1db383){const _0x20bd00={'id':_0xe76487};return db[_0x423f('0x39')][_0x423f('0x71')]({'attributes':['id',_0x423f('0x7a'),_0x423f('0x72')],'where':_0x20bd00,'transaction':_0x1db383,'lock':_0x1db383['LOCK'][_0x423f('0x7b')],'include':[{'model':db[_0x423f('0x58')],'as':_0x423f('0x74'),'attributes':_0x320528,'include':[{'model':db[_0x423f('0x75')],'as':_0x423f('0x7c'),'attributes':['id','name']}]},{'model':db[_0x423f('0x7d')],'as':_0x423f('0x7e'),'attributes':['id',_0x423f('0x11')]},{'model':db[_0x423f('0x47')],'as':'Queue','attributes':['id',_0x423f('0x11'),_0x423f('0x77')]}]})[_0x423f('0xd')](function(_0x3832b6){if(_0x3832b6){return _0x3832b6[_0x423f('0xc')]({'UserId':_0x3cffc3},{'transaction':_0x1db383});}});});})[_0x423f('0xd')](handleEntityNotFound(_0x4e1e04,null))[_0x423f('0xd')](respondWithResult(_0x4e1e04,null))[_0x423f('0x3e')](handleError(_0x4e1e04,null));};exports[_0x423f('0x7f')]=function(_0x22f2af,_0x3c78c7){return _0x22f2af[_0x423f('0x51')][_0x423f('0x80')]({'where':{'type':_0x423f('0x62'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x423f('0xd')](function(_0x5333b7){if(_0x5333b7&&_0x5333b7['length']){return db[_0x423f('0x39')][_0x423f('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x423f('0x53')](_0x423f('0x54'))},'VoiceQueueId':{'$in':_['map'](_0x5333b7,'id')},'$or':[{'UserId':null},{'UserId':_0x22f2af[_0x423f('0x51')]['id']}]}});}return 0x0;})['then'](function(_0xf18525){if(!_[_0x423f('0x5c')](_0xf18525)&&_[_0x423f('0x81')](_0xf18525)){return _0x3c78c7[_0x423f('0x4')](0xc8)[_0x423f('0x5')]({'contacts':_0xf18525});}else{logger['error'](_0x423f('0x82'),'getOpenContacts',0x194,_0x423f('0x83'));_0x3c78c7['sendStatus'](0x194);}})[_0x423f('0x3e')](handleError(_0x3c78c7,null));};exports[_0x423f('0x84')]=function(_0x1990ec,_0x5697e8){var _0xbcf529=shared[_0x423f('0x85')];var _0x3ecfd5=[];_[_0x423f('0x14')](_0xbcf529,function(_0x5baf51){_0x3ecfd5[_0x423f('0x86')]({'id':_0x5baf51[_0x423f('0x11')],'name':_0x5baf51['name'],'utcOffset':_0x5baf51[_0x423f('0x87')]});});return _0x5697e8[_0x423f('0x4')](0xc8)[_0x423f('0x5')]({'tz':_0x3ecfd5});};exports[_0x423f('0x88')]=function(_0x36241e,_0x2bb2ba){var _0x140db1=shared[_0x423f('0x85')];var _0x2ede33={};if(!_[_0x423f('0x5c')](_0x140db1[_0x36241e['body']['id']]))_0x2ede33=_0x140db1[_0x36241e['body']['id']];return _0x2bb2ba[_0x423f('0x4')](0xc8)['json'](_0x2ede33);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index e23367d..372a1dc 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 _0x7a54=['bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','priority','lodash','util','../../config/logger','moment'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x7a54,0x106));var _0x47a5=function(_0x435d22,_0x2d2b57){_0x435d22=_0x435d22-0x0;var _0x46c2e8=_0x7a54[_0x435d22];return _0x46c2e8;};'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':'scheduledat','fields':[_0x47a5('0xc')]},{'name':'phone','fields':['phone']},{'name':'priority','fields':[_0x47a5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','cm_hopper','scheduledat','phone','priority','lodash'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xabce,0x103));var _0xeabc=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xabce[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./cmHopper.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('CmHopper',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]},{'name':'phone','fields':[_0xeabc('0xb')]},{'name':_0xeabc('0xc'),'fields':[_0xeabc('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 de2a316..88581a0 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 _0xb240=['active','DestroyCmHopper','GetContactDialer','CmContact','sequelize','transaction','order','LOCK','UPDATE','keys','User','name','voicePause','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','destroy','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','describe','length','Contact','GetContactByPhone','phone','DESC','getContactByPhone','ResetActiveCalls','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','List','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','limit','include','map','model','attributes','info','debug','stringify','error','message','ShowCmHopper','where','then','catch','CreateCmHopper','create','UpdateCmHopper','update','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]'];(function(_0x535498,_0x95d4b2){var _0xd3c89a=function(_0x406f47){while(--_0x406f47){_0x535498['push'](_0x535498['shift']());}};_0xd3c89a(++_0x95d4b2);}(_0xb240,0x7e));var _0x0b24=function(_0x288c11,_0x3bfb3a){_0x288c11=_0x288c11-0x0;var _0x1e8438=_0xb240[_0x288c11];return _0x1e8438;};'use strict';var _=require(_0x0b24('0x0'));var util=require(_0x0b24('0x1'));var moment=require(_0x0b24('0x2'));var BPromise=require(_0x0b24('0x3'));var db=require(_0x0b24('0x4'))['db'];var logger=require(_0x0b24('0x5'))(_0x0b24('0x6'));exports[_0x0b24('0x7')]=function(_0x30083a){var _0x567c96=this;return new Promise(function(_0x36a4d2,_0x3070eb){return db[_0x0b24('0x8')][_0x0b24('0x9')]({'raw':_0x30083a[_0x0b24('0xa')]?_0x30083a['options'][_0x0b24('0xb')]===undefined?!![]:![]:!![],'where':_0x30083a[_0x0b24('0xa')]?_0x30083a[_0x0b24('0xa')]['where']||null:null,'attributes':_0x30083a['options']?_0x30083a[_0x0b24('0xa')]['attributes']||null:null,'limit':_0x30083a['options']?_0x30083a[_0x0b24('0xa')][_0x0b24('0xc')]||null:null,'include':_0x30083a[_0x0b24('0xa')]?_0x30083a[_0x0b24('0xa')][_0x0b24('0xd')]?_[_0x0b24('0xe')](_0x30083a[_0x0b24('0xa')][_0x0b24('0xd')],function(_0x4d0322){return{'model':db[_0x4d0322[_0x0b24('0xf')]],'as':_0x4d0322['as'],'attributes':_0x4d0322[_0x0b24('0x10')],'include':_0x4d0322['include']?_[_0x0b24('0xe')](_0x4d0322[_0x0b24('0xd')],function(_0x3ed2b3){return{'model':db[_0x3ed2b3[_0x0b24('0xf')]],'as':_0x3ed2b3['as'],'attributes':_0x3ed2b3['attributes'],'include':_0x3ed2b3['include']?_['map'](_0x3ed2b3['include'],function(_0x2ea61f){return{'model':db[_0x2ea61f[_0x0b24('0xf')]],'as':_0x2ea61f['as'],'attributes':_0x2ea61f[_0x0b24('0x10')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11e71f){logger[_0x0b24('0x11')](_0x0b24('0x7'),_0x30083a);logger[_0x0b24('0x12')](_0x0b24('0x7'),_0x30083a,JSON[_0x0b24('0x13')](_0x11e71f));_0x36a4d2(_0x11e71f);})['catch'](function(_0x377fd5){logger[_0x0b24('0x14')]('GetCmHopper',_0x377fd5[_0x0b24('0x15')],_0x30083a);_0x3070eb(_0x567c96['error'](0x1f4,_0x377fd5['message']));});});};exports[_0x0b24('0x16')]=function(_0x1dacdb){var _0x43cb31=this;return new Promise(function(_0x559d1b,_0x2fec2b){return db[_0x0b24('0x8')]['find']({'raw':_0x1dacdb[_0x0b24('0xa')]?_0x1dacdb[_0x0b24('0xa')][_0x0b24('0xb')]===undefined?!![]:![]:!![],'where':_0x1dacdb[_0x0b24('0xa')]?_0x1dacdb[_0x0b24('0xa')][_0x0b24('0x17')]||null:null,'attributes':_0x1dacdb[_0x0b24('0xa')]?_0x1dacdb[_0x0b24('0xa')][_0x0b24('0x10')]||null:null,'include':_0x1dacdb['options']?_0x1dacdb['options'][_0x0b24('0xd')]?_[_0x0b24('0xe')](_0x1dacdb[_0x0b24('0xa')][_0x0b24('0xd')],function(_0x51d050){return{'model':db[_0x51d050[_0x0b24('0xf')]],'as':_0x51d050['as'],'attributes':_0x51d050['attributes'],'include':_0x51d050[_0x0b24('0xd')]?_[_0x0b24('0xe')](_0x51d050[_0x0b24('0xd')],function(_0x48a06a){return{'model':db[_0x48a06a[_0x0b24('0xf')]],'as':_0x48a06a['as'],'attributes':_0x48a06a[_0x0b24('0x10')],'include':_0x48a06a[_0x0b24('0xd')]?_[_0x0b24('0xe')](_0x48a06a[_0x0b24('0xd')],function(_0x3ff513){return{'model':db[_0x3ff513[_0x0b24('0xf')]],'as':_0x3ff513['as'],'attributes':_0x3ff513[_0x0b24('0x10')]};}):[]};}):[]};}):[]:[]})[_0x0b24('0x18')](function(_0x408511){logger[_0x0b24('0x11')](_0x0b24('0x16'),_0x1dacdb);logger[_0x0b24('0x12')](_0x0b24('0x16'),_0x1dacdb,JSON[_0x0b24('0x13')](_0x408511));_0x559d1b(_0x408511);})[_0x0b24('0x19')](function(_0x4a5b53){logger[_0x0b24('0x14')]('ShowCmHopper',_0x4a5b53[_0x0b24('0x15')],_0x1dacdb);_0x2fec2b(_0x43cb31[_0x0b24('0x14')](0x1f4,_0x4a5b53['message']));});});};exports[_0x0b24('0x1a')]=function(_0x1ecbaf){var _0x1955c7=this;return new Promise(function(_0x872e26,_0x51e4a3){return db[_0x0b24('0x8')][_0x0b24('0x1b')](_0x1ecbaf['body'],{'raw':_0x1ecbaf[_0x0b24('0xa')]?_0x1ecbaf[_0x0b24('0xa')][_0x0b24('0xb')]===undefined?!![]:![]:!![]})[_0x0b24('0x18')](function(_0x14f4b5){logger[_0x0b24('0x11')](_0x0b24('0x1a'),_0x1ecbaf);logger[_0x0b24('0x12')](_0x0b24('0x1a'),_0x1ecbaf,JSON[_0x0b24('0x13')](_0x14f4b5));_0x872e26(_0x14f4b5);})['catch'](function(_0x42d72f){logger[_0x0b24('0x14')](_0x0b24('0x1a'),_0x42d72f['message'],_0x1ecbaf);_0x51e4a3(_0x1955c7[_0x0b24('0x14')](0x1f4,_0x42d72f[_0x0b24('0x15')]));});});};exports[_0x0b24('0x1c')]=function(_0x36e3c4){var _0x580b8b=this;return new Promise(function(_0x466d62,_0x264900){return db[_0x0b24('0x8')][_0x0b24('0x1d')](_0x36e3c4[_0x0b24('0x1e')],{'raw':_0x36e3c4[_0x0b24('0xa')]?_0x36e3c4[_0x0b24('0xa')][_0x0b24('0xb')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36e3c4[_0x0b24('0xa')]?_0x36e3c4[_0x0b24('0xa')][_0x0b24('0x17')]||null:null,'attributes':_0x36e3c4[_0x0b24('0xa')]?_0x36e3c4[_0x0b24('0xa')][_0x0b24('0x10')]||null:null,'limit':_0x36e3c4[_0x0b24('0xa')]?_0x36e3c4[_0x0b24('0xa')][_0x0b24('0xc')]||null:null})[_0x0b24('0x18')](function(_0x19dddd){logger[_0x0b24('0x11')](_0x0b24('0x1c'),_0x36e3c4);logger[_0x0b24('0x11')](_0x0b24('0x1f'),JSON[_0x0b24('0x13')](_0x36e3c4['options'][_0x0b24('0x17')]),_0x36e3c4[_0x0b24('0x1e')][_0x0b24('0x20')]);logger[_0x0b24('0x12')](_0x0b24('0x1c'),_0x36e3c4,JSON[_0x0b24('0x13')](_0x19dddd));_0x466d62(_0x19dddd);})[_0x0b24('0x19')](function(_0x1cc297){logger[_0x0b24('0x14')](_0x0b24('0x1c'),_0x1cc297['message'],_0x36e3c4);_0x264900(_0x580b8b[_0x0b24('0x14')](0x1f4,_0x1cc297['message']));});});};exports[_0x0b24('0x21')]=function(_0x13bec4){var _0x3e3972=this;return new Promise(function(_0x5a529b,_0x540764){return db[_0x0b24('0x8')]['destroy']({'where':_0x13bec4[_0x0b24('0xa')]?_0x13bec4[_0x0b24('0xa')][_0x0b24('0x17')]||null:null})['then'](function(_0x10f5d6){logger['info'](_0x0b24('0x21'),_0x13bec4);logger[_0x0b24('0x12')]('DestroyCmHopper',_0x13bec4,JSON['stringify'](_0x10f5d6));_0x5a529b(_0x10f5d6);})[_0x0b24('0x19')](function(_0x4d373f){logger[_0x0b24('0x14')](_0x0b24('0x21'),_0x4d373f[_0x0b24('0x15')],_0x13bec4);_0x540764(_0x3e3972[_0x0b24('0x14')](0x1f4,_0x4d373f[_0x0b24('0x15')]));});});};exports[_0x0b24('0x22')]=function(_0x41b382){var _0x4ed647=this;return new Promise(function(_0x44e318,_0x136650){return db[_0x0b24('0x23')]['describe']()[_0x0b24('0x18')](function(_0x4789b5){return db[_0x0b24('0x24')][_0x0b24('0x25')](function(_0x3ba579){return db['CmHopper']['findAll']({'where':_0x41b382[_0x0b24('0xa')]?_0x41b382[_0x0b24('0xa')][_0x0b24('0x17')]||null:null,'attributes':_0x41b382[_0x0b24('0xa')]?_0x41b382['options'][_0x0b24('0x10')]||null:null,'limit':_0x41b382[_0x0b24('0xa')]?_0x41b382[_0x0b24('0xa')][_0x0b24('0xc')]||null:null,'order':_0x41b382[_0x0b24('0xa')]?_0x41b382[_0x0b24('0xa')][_0x0b24('0x26')]||null:null,'transaction':_0x3ba579,'lock':_0x3ba579[_0x0b24('0x27')][_0x0b24('0x28')],'include':[{'model':db[_0x0b24('0x23')],'as':'Contact','attributes':_[_0x0b24('0x29')](_0x4789b5)},{'model':db[_0x0b24('0x2a')],'as':'Agent','attributes':['id',_0x0b24('0x2b'),_0x0b24('0x2c')]}]})['then'](function(_0x4508b9){var _0x4804c6=[];var _0x525ecd=[];for(var _0x315179=0x0;_0x315179<_0x4508b9['length'];_0x315179+=0x1){var _0xe18b12=_0x4508b9[_0x315179][_0x0b24('0x2d')];if(_0xe18b12===null){_0x4804c6[_0x0b24('0x2e')](_0x4508b9[_0x315179]['update'](_0x41b382[_0x0b24('0x1e')],{'transaction':_0x3ba579}));}else if(!_0x525ecd[_0x0b24('0x2f')](_0xe18b12)){_0x525ecd[_0x0b24('0x2e')](_0xe18b12);_0x4804c6[_0x0b24('0x2e')](_0x4508b9[_0x315179]['update'](_0x41b382[_0x0b24('0x1e')],{'transaction':_0x3ba579}));}}return BPromise[_0x0b24('0x30')](_0x4804c6);});})[_0x0b24('0x18')](function(_0x30d01f){logger[_0x0b24('0x11')](_0x0b24('0x22'),_0x41b382);if(_0x30d01f['length']>0x0){logger[_0x0b24('0x11')](_0x0b24('0x31'),_0x30d01f[0x0][_0x0b24('0x32')]['id'],_0x30d01f[0x0]['dataValues'][_0x0b24('0x33')],_0x30d01f[0x0]['dataValues'][_0x0b24('0x20')]);}logger[_0x0b24('0x12')](_0x0b24('0x22'),_0x41b382,JSON[_0x0b24('0x13')](_0x30d01f));_0x44e318(_0x30d01f);})[_0x0b24('0x19')](function(_0x538a6a){logger['error'](_0x0b24('0x22'),_0x538a6a[_0x0b24('0x15')],_0x41b382);_0x136650(_0x4ed647[_0x0b24('0x14')](0x1f4,_0x538a6a['message']));});});});};exports[_0x0b24('0x34')]=function(_0x2b85d1){var _0x16943f=this;return new Promise(function(_0x18b7dc,_0x2980a4){return db['sequelize'][_0x0b24('0x25')](function(_0xfb307f){return db[_0x0b24('0x35')]['create'](_0x2b85d1[_0x0b24('0x1e')],{'raw':_0x2b85d1[_0x0b24('0xa')]?_0x2b85d1[_0x0b24('0xa')][_0x0b24('0xb')]===undefined?!![]:![]:!![],'transaction':_0xfb307f})[_0x0b24('0x18')](function(){logger[_0x0b24('0x11')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x0b24('0x13')](_0x2b85d1['options'][_0x0b24('0x17')]),_0x2b85d1[_0x0b24('0xa')]['where']['active']);return db[_0x0b24('0x8')][_0x0b24('0x36')]({'where':_0x2b85d1['options']?_0x2b85d1[_0x0b24('0xa')]['where']||null:null,'transaction':_0xfb307f});});})[_0x0b24('0x18')](function(_0x51456a){logger[_0x0b24('0x11')](_0x0b24('0x34'),_0x2b85d1);logger['debug'](_0x0b24('0x34'),_0x2b85d1,JSON[_0x0b24('0x13')](_0x51456a));_0x18b7dc(_0x51456a);})[_0x0b24('0x19')](function(_0x1571c8){logger[_0x0b24('0x14')](_0x0b24('0x34'),_0x1571c8['message'],_0x2b85d1);_0x2980a4(_0x16943f['error'](0x1f4,_0x1571c8[_0x0b24('0x15')]));});});};exports[_0x0b24('0x37')]=function(_0x30e47b){var _0x4248aa=this;return new Promise(function(_0x5de9c0,_0x1bb687){return db[_0x0b24('0x8')]['findAll']({'raw':_0x30e47b[_0x0b24('0xa')]?_0x30e47b[_0x0b24('0xa')][_0x0b24('0xb')]===undefined?!![]:![]:!![],'where':_0x30e47b[_0x0b24('0xa')]?_0x30e47b['options']['where']||null:null,'attributes':[[db[_0x0b24('0x24')]['fn'](_0x0b24('0x38'),db[_0x0b24('0x24')]['fn']('IF',db[_0x0b24('0x24')][_0x0b24('0x39')](_0x0b24('0x3a')+util[_0x0b24('0x3b')](_0x0b24('0x3c'),moment()[_0x0b24('0x3b')](_0x0b24('0x3d')))+_0x0b24('0x3e')))),'contactsRescheduled']]})[_0x0b24('0x18')](function(_0x1200a9){logger[_0x0b24('0x11')](_0x0b24('0x37'),_0x30e47b);logger[_0x0b24('0x12')](_0x0b24('0x37'),_0x30e47b,JSON[_0x0b24('0x13')](_0x1200a9));_0x5de9c0(_0x1200a9);})[_0x0b24('0x19')](function(_0x5c7da3){logger[_0x0b24('0x14')]('CountReScheduled',_0x5c7da3[_0x0b24('0x15')],_0x30e47b);_0x1bb687(_0x4248aa['error'](0x1f4,_0x5c7da3['message']));});});};exports[_0x0b24('0x3f')]=function(_0x454774){var _0x48133b=this;return new Promise(function(_0x4d9601,_0x8e950a){return db[_0x0b24('0x23')][_0x0b24('0x40')]()[_0x0b24('0x18')](function(){return db[_0x0b24('0x24')]['transaction'](function(_0x3e8568){return db[_0x0b24('0x8')]['findAll']({'where':_0x454774['options']?_0x454774[_0x0b24('0xa')]['where']||null:null,'attributes':_0x454774[_0x0b24('0xa')]?_0x454774[_0x0b24('0xa')][_0x0b24('0x10')]||null:null,'limit':0x1,'order':_0x454774[_0x0b24('0xa')]?_0x454774[_0x0b24('0xa')]['order']||null:null,'group':db[_0x0b24('0x8')]['UserId'],'transaction':_0x3e8568,'lock':_0x3e8568['LOCK'][_0x0b24('0x28')],'include':_0x454774['options']?_0x454774['options'][_0x0b24('0xd')]?_[_0x0b24('0xe')](_0x454774[_0x0b24('0xa')]['include'],function(_0xdfdddb){return{'model':db[_0xdfdddb[_0x0b24('0xf')]],'as':_0xdfdddb['as'],'attributes':_0xdfdddb[_0x0b24('0x10')],'include':_0xdfdddb[_0x0b24('0xd')]?_[_0x0b24('0xe')](_0xdfdddb[_0x0b24('0xd')],function(_0x540685){return{'model':db[_0x540685['model']],'as':_0x540685['as'],'attributes':_0x540685[_0x0b24('0x10')],'include':_0x540685[_0x0b24('0xd')]?_[_0x0b24('0xe')](_0x540685[_0x0b24('0xd')],function(_0x98e6ab){return{'model':db[_0x98e6ab[_0x0b24('0xf')]],'as':_0x98e6ab['as'],'attributes':_0x98e6ab[_0x0b24('0x10')]};}):[]};}):[]};}):[]:[]})[_0x0b24('0x18')](function(_0x2afde4){var _0xda0d31=[];for(var _0x3d7a55=0x0;_0x3d7a55<_0x2afde4[_0x0b24('0x41')];_0x3d7a55+=0x1){_0xda0d31[_0x0b24('0x2e')](_0x2afde4[_0x3d7a55][_0x0b24('0x1d')](_0x454774['body'],{'transaction':_0x3e8568}));}return BPromise[_0x0b24('0x30')](_0xda0d31);});})[_0x0b24('0x18')](function(_0x36cbb7){logger[_0x0b24('0x11')](_0x0b24('0x3f'),_0x454774);logger[_0x0b24('0x12')]('GetContactRecallMe',_0x454774,JSON[_0x0b24('0x13')](_0x36cbb7));_0x4d9601(_0x36cbb7);})['catch'](function(_0x886c76){logger[_0x0b24('0x14')](_0x0b24('0x3f'),_0x886c76['message'],_0x454774);_0x8e950a(_0x48133b['error'](0x1f4,_0x886c76[_0x0b24('0x15')]));});});});};exports['GetCmHopperPreview']=function(_0x11e42a){var _0x2dc9a8=this;return new Promise(function(_0x5b18e7,_0x34c56f){db['CmContact']['describe']()[_0x0b24('0x18')](function(_0x35b04e){return db[_0x0b24('0x8')][_0x0b24('0x9')]({'raw':_0x11e42a[_0x0b24('0xa')]?_0x11e42a[_0x0b24('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x11e42a['options']?_0x11e42a[_0x0b24('0xa')][_0x0b24('0x17')]||null:null,'attributes':_0x11e42a['options']?_0x11e42a[_0x0b24('0xa')][_0x0b24('0x10')]||null:null,'limit':_0x11e42a[_0x0b24('0xa')]?_0x11e42a['options'][_0x0b24('0xc')]||null:null,'include':_0x11e42a[_0x0b24('0xa')]?_0x11e42a['options'][_0x0b24('0xd')]?_[_0x0b24('0xe')](_0x11e42a[_0x0b24('0xa')][_0x0b24('0xd')],function(_0x255d59){return{'model':db[_0x255d59[_0x0b24('0xf')]],'as':_0x255d59['as'],'attributes':_0x255d59['as']===_0x0b24('0x42')?_[_0x0b24('0x29')](_0x35b04e):_0x255d59['attributes'],'include':_0x255d59[_0x0b24('0xd')]?_['map'](_0x255d59[_0x0b24('0xd')],function(_0x5fef1){return{'model':db[_0x5fef1['model']],'as':_0x5fef1['as'],'attributes':_0x5fef1[_0x0b24('0x10')],'include':_0x5fef1[_0x0b24('0xd')]?_['map'](_0x5fef1[_0x0b24('0xd')],function(_0xff9f3d){return{'model':db[_0xff9f3d['model']],'as':_0xff9f3d['as'],'attributes':_0xff9f3d['attributes']};}):[]};}):[]};}):[]:[]})[_0x0b24('0x18')](function(_0x4749e0){logger[_0x0b24('0x11')](_0x0b24('0x7'),_0x11e42a);logger[_0x0b24('0x12')](_0x0b24('0x7'),_0x11e42a,JSON['stringify'](_0x4749e0));_0x5b18e7(_0x4749e0);})[_0x0b24('0x19')](function(_0x55de44){logger['error'](_0x0b24('0x7'),_0x55de44[_0x0b24('0x15')],_0x11e42a);_0x34c56f(_0x2dc9a8[_0x0b24('0x14')](0x1f4,_0x55de44[_0x0b24('0x15')]));});});});};exports[_0x0b24('0x43')]=function(_0x350ff3){var _0x17ef70=this;return new Promise(function(_0x2f95a8,_0x385350){return db[_0x0b24('0x23')]['findOne']({'raw':!![],'where':{'phone':_0x350ff3[_0x0b24('0xa')]['where'][_0x0b24('0x44')]},'attributes':['id','dialTimezone'],'order':[['id',_0x0b24('0x45')]]})[_0x0b24('0x18')](function(_0x30665e){logger['info'](_0x0b24('0x46'),_0x350ff3);logger[_0x0b24('0x12')](_0x0b24('0x46'),_0x350ff3,JSON[_0x0b24('0x13')](_0x30665e));_0x2f95a8(_0x30665e);})[_0x0b24('0x19')](function(_0x1942a4){logger[_0x0b24('0x14')](_0x0b24('0x46'),_0x1942a4[_0x0b24('0x15')],_0x350ff3);_0x385350(_0x17ef70[_0x0b24('0x14')](0x1f4,_0x1942a4[_0x0b24('0x15')]));});});};exports[_0x0b24('0x47')]=function(_0x274451){var _0x346e0d=this;return new Promise(function(_0x1495b0,_0xd87266){return db[_0x0b24('0x24')][_0x0b24('0x25')](function(_0xb78cdf){var _0x3a255a=_0x274451[_0x0b24('0xa')]&&_0x274451[_0x0b24('0xa')][_0x0b24('0x17')]?_0x274451[_0x0b24('0xa')][_0x0b24('0x17')]:{};return db[_0x0b24('0x8')][_0x0b24('0x1d')](_0x274451[_0x0b24('0x1e')],{'where':_0x3a255a,'transaction':_0xb78cdf})['then'](function(_0x444c17){logger[_0x0b24('0x11')]('ResetActiveCalls',_0x274451);logger['debug'](_0x0b24('0x47'),_0x274451,JSON[_0x0b24('0x13')](_0x444c17));_0x1495b0(_0x444c17);})[_0x0b24('0x19')](function(_0xc9c61e){logger['error'](_0x0b24('0x47'),_0xc9c61e[_0x0b24('0x15')],_0x274451);_0xd87266(_0x346e0d[_0x0b24('0x14')](0x1f4,_0xc9c61e[_0x0b24('0x15')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x133235){var _0x4c343d=this;var _0x20b374=_0x133235['body'][_0x0b24('0x17')]['voiceQueueIds'];var _0x38a32d=_0x133235[_0x0b24('0x1e')][_0x0b24('0x17')][_0x0b24('0x48')];var _0x555171=_0x133235[_0x0b24('0x1e')]['where'][_0x0b24('0x49')];return new Promise(function(_0x44074c,_0x1c1904){return db[_0x0b24('0x8')][_0x0b24('0x9')]({'where':{'voiceQueueId':{'$in':_0x20b374},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0x0b24('0x39')](_0x0b24('0x4a')+_0x38a32d+_0x0b24('0x4b')),'$gt':db[_0x0b24('0x24')][_0x0b24('0x39')](_0x0b24('0x4c'))}},'UserId':{'$in':_0x555171}},'include':[{'model':db[_0x0b24('0x23')],'as':'Contact'},{'model':db['User'],'as':'Agent','attributes':['id',_0x0b24('0x2b'),_0x0b24('0x2c')]},{'model':db[_0x0b24('0x4d')],'as':_0x0b24('0x4e')}]})[_0x0b24('0x18')](function(_0x4c950c){if(_0x4c950c[_0x0b24('0x41')]>0x0){return db['sequelize']['transaction'](function(_0x4f5fc8){return db[_0x0b24('0x8')][_0x0b24('0x1d')]({'recallmeNotifiedDate':db['sequelize']['literal'](_0x0b24('0x4c'))},{'where':{'id':{'$in':_[_0x0b24('0xe')](_0x4c950c,'id')}},'transaction':_0x4f5fc8})[_0x0b24('0x18')](function(){_0x44074c(_0x4c950c);})[_0x0b24('0x19')](function(_0x254d22){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x254d22[_0x0b24('0x15')],_0x133235);_0x1c1904(_0x4c343d[_0x0b24('0x14')](0x1f4,_0x254d22[_0x0b24('0x15')]));});})[_0x0b24('0x19')](function(_0x1631f5){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x1631f5['message'],_0x133235);_0x1c1904(_0x4c343d[_0x0b24('0x14')](0x1f4,_0x1631f5[_0x0b24('0x15')]));});}else{_0x44074c(_0x4c950c);}});});}; \ No newline at end of file +var _0x279b=['sequelize','transaction','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','UserId','push','includes','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','\x20MINUTE','NOW()','List','lodash','util','moment','../../mysqldb','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','message','error','info','ShowCmHopper','debug','stringify','CreateCmHopper','create','UpdateCmHopper','update','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','describe'];(function(_0x153c91,_0x4148fe){var _0x9c8fb8=function(_0x403f9f){while(--_0x403f9f){_0x153c91['push'](_0x153c91['shift']());}};_0x9c8fb8(++_0x4148fe);}(_0x279b,0x1ab));var _0xb279=function(_0x1fba8f,_0x2226d7){_0x1fba8f=_0x1fba8f-0x0;var _0x12dccf=_0x279b[_0x1fba8f];return _0x12dccf;};'use strict';var _=require(_0xb279('0x0'));var util=require(_0xb279('0x1'));var moment=require(_0xb279('0x2'));var BPromise=require('bluebird');var db=require(_0xb279('0x3'))['db'];var logger=require('../../config/logger')(_0xb279('0x4'));exports[_0xb279('0x5')]=function(_0x17fa10){var _0x161a99=this;return new Promise(function(_0x5ca9d0,_0xc26bbb){return db[_0xb279('0x6')][_0xb279('0x7')]({'raw':_0x17fa10['options']?_0x17fa10[_0xb279('0x8')][_0xb279('0x9')]===undefined?!![]:![]:!![],'where':_0x17fa10[_0xb279('0x8')]?_0x17fa10[_0xb279('0x8')][_0xb279('0xa')]||null:null,'attributes':_0x17fa10[_0xb279('0x8')]?_0x17fa10[_0xb279('0x8')][_0xb279('0xb')]||null:null,'limit':_0x17fa10['options']?_0x17fa10['options'][_0xb279('0xc')]||null:null,'include':_0x17fa10['options']?_0x17fa10[_0xb279('0x8')][_0xb279('0xd')]?_[_0xb279('0xe')](_0x17fa10[_0xb279('0x8')][_0xb279('0xd')],function(_0x226bc3){return{'model':db[_0x226bc3[_0xb279('0xf')]],'as':_0x226bc3['as'],'attributes':_0x226bc3['attributes'],'include':_0x226bc3['include']?_['map'](_0x226bc3[_0xb279('0xd')],function(_0x30f4d9){return{'model':db[_0x30f4d9[_0xb279('0xf')]],'as':_0x30f4d9['as'],'attributes':_0x30f4d9[_0xb279('0xb')],'include':_0x30f4d9['include']?_[_0xb279('0xe')](_0x30f4d9[_0xb279('0xd')],function(_0x18a965){return{'model':db[_0x18a965[_0xb279('0xf')]],'as':_0x18a965['as'],'attributes':_0x18a965[_0xb279('0xb')]};}):[]};}):[]};}):[]:[]})[_0xb279('0x10')](function(_0x768b3f){logger['info'](_0xb279('0x5'),_0x17fa10);logger['debug'](_0xb279('0x5'),_0x17fa10,JSON['stringify'](_0x768b3f));_0x5ca9d0(_0x768b3f);})[_0xb279('0x11')](function(_0xa9e70c){logger['error'](_0xb279('0x5'),_0xa9e70c[_0xb279('0x12')],_0x17fa10);_0xc26bbb(_0x161a99[_0xb279('0x13')](0x1f4,_0xa9e70c[_0xb279('0x12')]));});});};exports['ShowCmHopper']=function(_0x3ec54c){var _0x26be39=this;return new Promise(function(_0x42f6b9,_0xf03bb4){return db[_0xb279('0x6')]['find']({'raw':_0x3ec54c['options']?_0x3ec54c[_0xb279('0x8')][_0xb279('0x9')]===undefined?!![]:![]:!![],'where':_0x3ec54c[_0xb279('0x8')]?_0x3ec54c[_0xb279('0x8')]['where']||null:null,'attributes':_0x3ec54c[_0xb279('0x8')]?_0x3ec54c[_0xb279('0x8')]['attributes']||null:null,'include':_0x3ec54c[_0xb279('0x8')]?_0x3ec54c[_0xb279('0x8')]['include']?_[_0xb279('0xe')](_0x3ec54c[_0xb279('0x8')][_0xb279('0xd')],function(_0x5e49ac){return{'model':db[_0x5e49ac['model']],'as':_0x5e49ac['as'],'attributes':_0x5e49ac[_0xb279('0xb')],'include':_0x5e49ac[_0xb279('0xd')]?_[_0xb279('0xe')](_0x5e49ac[_0xb279('0xd')],function(_0x251f38){return{'model':db[_0x251f38[_0xb279('0xf')]],'as':_0x251f38['as'],'attributes':_0x251f38[_0xb279('0xb')],'include':_0x251f38['include']?_['map'](_0x251f38['include'],function(_0x2a7224){return{'model':db[_0x2a7224[_0xb279('0xf')]],'as':_0x2a7224['as'],'attributes':_0x2a7224[_0xb279('0xb')]};}):[]};}):[]};}):[]:[]})[_0xb279('0x10')](function(_0x1bac14){logger[_0xb279('0x14')](_0xb279('0x15'),_0x3ec54c);logger[_0xb279('0x16')](_0xb279('0x15'),_0x3ec54c,JSON[_0xb279('0x17')](_0x1bac14));_0x42f6b9(_0x1bac14);})['catch'](function(_0x30f8e5){logger[_0xb279('0x13')]('ShowCmHopper',_0x30f8e5['message'],_0x3ec54c);_0xf03bb4(_0x26be39['error'](0x1f4,_0x30f8e5[_0xb279('0x12')]));});});};exports[_0xb279('0x18')]=function(_0x2c1064){var _0x35a5cb=this;return new Promise(function(_0x11ee6c,_0x4dd7ff){return db[_0xb279('0x6')][_0xb279('0x19')](_0x2c1064['body'],{'raw':_0x2c1064[_0xb279('0x8')]?_0x2c1064['options']['raw']===undefined?!![]:![]:!![]})[_0xb279('0x10')](function(_0x1e3786){logger[_0xb279('0x14')](_0xb279('0x18'),_0x2c1064);logger[_0xb279('0x16')](_0xb279('0x18'),_0x2c1064,JSON[_0xb279('0x17')](_0x1e3786));_0x11ee6c(_0x1e3786);})[_0xb279('0x11')](function(_0x55c723){logger[_0xb279('0x13')](_0xb279('0x18'),_0x55c723['message'],_0x2c1064);_0x4dd7ff(_0x35a5cb[_0xb279('0x13')](0x1f4,_0x55c723['message']));});});};exports[_0xb279('0x1a')]=function(_0x269893){var _0x3768b0=this;return new Promise(function(_0x47ac6a,_0x2dfc2e){return db['CmHopper'][_0xb279('0x1b')](_0x269893[_0xb279('0x1c')],{'raw':_0x269893[_0xb279('0x8')]?_0x269893[_0xb279('0x8')][_0xb279('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x269893[_0xb279('0x8')]?_0x269893['options'][_0xb279('0xa')]||null:null,'attributes':_0x269893[_0xb279('0x8')]?_0x269893[_0xb279('0x8')][_0xb279('0xb')]||null:null,'limit':_0x269893[_0xb279('0x8')]?_0x269893[_0xb279('0x8')][_0xb279('0xc')]||null:null})[_0xb279('0x10')](function(_0x1ca9e8){logger['info'](_0xb279('0x1a'),_0x269893);logger['info'](_0xb279('0x1d'),JSON['stringify'](_0x269893[_0xb279('0x8')][_0xb279('0xa')]),_0x269893[_0xb279('0x1c')][_0xb279('0x1e')]);logger[_0xb279('0x16')](_0xb279('0x1a'),_0x269893,JSON[_0xb279('0x17')](_0x1ca9e8));_0x47ac6a(_0x1ca9e8);})[_0xb279('0x11')](function(_0x5609eb){logger[_0xb279('0x13')](_0xb279('0x1a'),_0x5609eb[_0xb279('0x12')],_0x269893);_0x2dfc2e(_0x3768b0[_0xb279('0x13')](0x1f4,_0x5609eb[_0xb279('0x12')]));});});};exports[_0xb279('0x1f')]=function(_0x59e7e7){var _0x308fcc=this;return new Promise(function(_0x1ac186,_0x1a20cd){return db[_0xb279('0x6')]['destroy']({'where':_0x59e7e7['options']?_0x59e7e7['options'][_0xb279('0xa')]||null:null})[_0xb279('0x10')](function(_0xf23442){logger[_0xb279('0x14')]('DestroyCmHopper',_0x59e7e7);logger['debug'](_0xb279('0x1f'),_0x59e7e7,JSON[_0xb279('0x17')](_0xf23442));_0x1ac186(_0xf23442);})[_0xb279('0x11')](function(_0x2c3c22){logger[_0xb279('0x13')](_0xb279('0x1f'),_0x2c3c22['message'],_0x59e7e7);_0x1a20cd(_0x308fcc[_0xb279('0x13')](0x1f4,_0x2c3c22['message']));});});};exports[_0xb279('0x20')]=function(_0x2d1ba6){var _0x1215df=this;return new Promise(function(_0x8d6455,_0x420841){return db[_0xb279('0x21')][_0xb279('0x22')]()[_0xb279('0x10')](function(_0x10d683){return db[_0xb279('0x23')][_0xb279('0x24')](function(_0x428f2c){return db[_0xb279('0x6')]['findAll']({'where':_0x2d1ba6[_0xb279('0x8')]?_0x2d1ba6['options'][_0xb279('0xa')]||null:null,'attributes':_0x2d1ba6[_0xb279('0x8')]?_0x2d1ba6[_0xb279('0x8')][_0xb279('0xb')]||null:null,'limit':_0x2d1ba6[_0xb279('0x8')]?_0x2d1ba6[_0xb279('0x8')][_0xb279('0xc')]||null:null,'order':_0x2d1ba6['options']?_0x2d1ba6['options']['order']||null:null,'transaction':_0x428f2c,'lock':_0x428f2c[_0xb279('0x25')][_0xb279('0x26')],'include':[{'model':db[_0xb279('0x21')],'as':_0xb279('0x27'),'attributes':_[_0xb279('0x28')](_0x10d683)},{'model':db[_0xb279('0x29')],'as':_0xb279('0x2a'),'attributes':['id',_0xb279('0x2b'),_0xb279('0x2c')]}]})[_0xb279('0x10')](function(_0x57a9b7){var _0xffae1b=[];var _0x1baa29=[];for(var _0x12595e=0x0;_0x12595e<_0x57a9b7[_0xb279('0x2d')];_0x12595e+=0x1){var _0x1fa565=_0x57a9b7[_0x12595e][_0xb279('0x2e')];if(_0x1fa565===null){_0xffae1b[_0xb279('0x2f')](_0x57a9b7[_0x12595e]['update'](_0x2d1ba6[_0xb279('0x1c')],{'transaction':_0x428f2c}));}else if(!_0x1baa29[_0xb279('0x30')](_0x1fa565)){_0x1baa29[_0xb279('0x2f')](_0x1fa565);_0xffae1b[_0xb279('0x2f')](_0x57a9b7[_0x12595e][_0xb279('0x1b')](_0x2d1ba6[_0xb279('0x1c')],{'transaction':_0x428f2c}));}}return BPromise['all'](_0xffae1b);});})[_0xb279('0x10')](function(_0x83c0a8){logger[_0xb279('0x14')]('GetContactDialer',_0x2d1ba6);if(_0x83c0a8[_0xb279('0x2d')]>0x0){logger[_0xb279('0x14')](_0xb279('0x31'),_0x83c0a8[0x0][_0xb279('0x32')]['id'],_0x83c0a8[0x0][_0xb279('0x32')]['ContactId'],_0x83c0a8[0x0][_0xb279('0x32')]['active']);}logger[_0xb279('0x16')](_0xb279('0x20'),_0x2d1ba6,JSON[_0xb279('0x17')](_0x83c0a8));_0x8d6455(_0x83c0a8);})['catch'](function(_0xd4fc0c){logger[_0xb279('0x13')]('GetContactDialer',_0xd4fc0c[_0xb279('0x12')],_0x2d1ba6);_0x420841(_0x1215df[_0xb279('0x13')](0x1f4,_0xd4fc0c[_0xb279('0x12')]));});});});};exports[_0xb279('0x33')]=function(_0x2fe6ce){var _0x21c79b=this;return new Promise(function(_0x429212,_0x3f98c6){return db['sequelize'][_0xb279('0x24')](function(_0xb2d3cf){return db['CmHopperFinal'][_0xb279('0x19')](_0x2fe6ce['body'],{'raw':_0x2fe6ce['options']?_0x2fe6ce[_0xb279('0x8')][_0xb279('0x9')]===undefined?!![]:![]:!![],'transaction':_0xb2d3cf})[_0xb279('0x10')](function(){logger[_0xb279('0x14')](_0xb279('0x34'),JSON[_0xb279('0x17')](_0x2fe6ce[_0xb279('0x8')]['where']),_0x2fe6ce[_0xb279('0x8')][_0xb279('0xa')][_0xb279('0x1e')]);return db[_0xb279('0x6')][_0xb279('0x35')]({'where':_0x2fe6ce['options']?_0x2fe6ce[_0xb279('0x8')]['where']||null:null,'transaction':_0xb2d3cf});});})[_0xb279('0x10')](function(_0x65bde8){logger[_0xb279('0x14')](_0xb279('0x33'),_0x2fe6ce);logger[_0xb279('0x16')]('MoveContactManagedDialer',_0x2fe6ce,JSON[_0xb279('0x17')](_0x65bde8));_0x429212(_0x65bde8);})[_0xb279('0x11')](function(_0x4b4dfd){logger[_0xb279('0x13')](_0xb279('0x33'),_0x4b4dfd[_0xb279('0x12')],_0x2fe6ce);_0x3f98c6(_0x21c79b['error'](0x1f4,_0x4b4dfd[_0xb279('0x12')]));});});};exports[_0xb279('0x36')]=function(_0x2d6b88){var _0x35c855=this;return new Promise(function(_0x3a1ee7,_0x5039e3){return db['CmHopper'][_0xb279('0x7')]({'raw':_0x2d6b88['options']?_0x2d6b88[_0xb279('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x2d6b88[_0xb279('0x8')]?_0x2d6b88['options'][_0xb279('0xa')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xb279('0x23')]['fn']('IF',db[_0xb279('0x23')][_0xb279('0x37')](_0xb279('0x38')+util[_0xb279('0x39')](_0xb279('0x3a'),moment()[_0xb279('0x39')](_0xb279('0x3b')))+_0xb279('0x3c')))),_0xb279('0x3d')]]})[_0xb279('0x10')](function(_0x4e1011){logger[_0xb279('0x14')]('CountReScheduled',_0x2d6b88);logger['debug']('CountReScheduled',_0x2d6b88,JSON[_0xb279('0x17')](_0x4e1011));_0x3a1ee7(_0x4e1011);})[_0xb279('0x11')](function(_0x444767){logger[_0xb279('0x13')]('CountReScheduled',_0x444767[_0xb279('0x12')],_0x2d6b88);_0x5039e3(_0x35c855[_0xb279('0x13')](0x1f4,_0x444767['message']));});});};exports[_0xb279('0x3e')]=function(_0x3f2696){var _0x280ff3=this;return new Promise(function(_0x417240,_0x39e565){return db[_0xb279('0x21')][_0xb279('0x22')]()[_0xb279('0x10')](function(){return db['sequelize']['transaction'](function(_0x5e4fab){return db[_0xb279('0x6')]['findAll']({'where':_0x3f2696[_0xb279('0x8')]?_0x3f2696[_0xb279('0x8')][_0xb279('0xa')]||null:null,'attributes':_0x3f2696[_0xb279('0x8')]?_0x3f2696['options'][_0xb279('0xb')]||null:null,'limit':0x1,'order':_0x3f2696[_0xb279('0x8')]?_0x3f2696[_0xb279('0x8')]['order']||null:null,'group':db[_0xb279('0x6')]['UserId'],'transaction':_0x5e4fab,'lock':_0x5e4fab[_0xb279('0x25')][_0xb279('0x26')],'include':_0x3f2696['options']?_0x3f2696[_0xb279('0x8')]['include']?_['map'](_0x3f2696[_0xb279('0x8')][_0xb279('0xd')],function(_0x16ccb9){return{'model':db[_0x16ccb9[_0xb279('0xf')]],'as':_0x16ccb9['as'],'attributes':_0x16ccb9['attributes'],'include':_0x16ccb9[_0xb279('0xd')]?_[_0xb279('0xe')](_0x16ccb9[_0xb279('0xd')],function(_0x156678){return{'model':db[_0x156678['model']],'as':_0x156678['as'],'attributes':_0x156678[_0xb279('0xb')],'include':_0x156678[_0xb279('0xd')]?_['map'](_0x156678[_0xb279('0xd')],function(_0x22101a){return{'model':db[_0x22101a[_0xb279('0xf')]],'as':_0x22101a['as'],'attributes':_0x22101a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xfc4505){var _0x3289d6=[];for(var _0x4bfeae=0x0;_0x4bfeae<_0xfc4505['length'];_0x4bfeae+=0x1){_0x3289d6['push'](_0xfc4505[_0x4bfeae][_0xb279('0x1b')](_0x3f2696['body'],{'transaction':_0x5e4fab}));}return BPromise['all'](_0x3289d6);});})[_0xb279('0x10')](function(_0x1db758){logger[_0xb279('0x14')](_0xb279('0x3e'),_0x3f2696);logger['debug'](_0xb279('0x3e'),_0x3f2696,JSON[_0xb279('0x17')](_0x1db758));_0x417240(_0x1db758);})[_0xb279('0x11')](function(_0x557227){logger[_0xb279('0x13')](_0xb279('0x3e'),_0x557227[_0xb279('0x12')],_0x3f2696);_0x39e565(_0x280ff3[_0xb279('0x13')](0x1f4,_0x557227[_0xb279('0x12')]));});});});};exports[_0xb279('0x3f')]=function(_0x381749){var _0x4384fa=this;return new Promise(function(_0x1a4d45,_0x1482f4){db[_0xb279('0x21')][_0xb279('0x22')]()[_0xb279('0x10')](function(_0x11ae21){return db[_0xb279('0x6')][_0xb279('0x7')]({'raw':_0x381749['options']?_0x381749[_0xb279('0x8')][_0xb279('0x9')]===undefined?!![]:![]:!![],'where':_0x381749[_0xb279('0x8')]?_0x381749[_0xb279('0x8')]['where']||null:null,'attributes':_0x381749['options']?_0x381749[_0xb279('0x8')][_0xb279('0xb')]||null:null,'limit':_0x381749[_0xb279('0x8')]?_0x381749['options'][_0xb279('0xc')]||null:null,'include':_0x381749[_0xb279('0x8')]?_0x381749['options'][_0xb279('0xd')]?_[_0xb279('0xe')](_0x381749['options'][_0xb279('0xd')],function(_0x4f2c65){return{'model':db[_0x4f2c65[_0xb279('0xf')]],'as':_0x4f2c65['as'],'attributes':_0x4f2c65['as']==='Contact'?_['keys'](_0x11ae21):_0x4f2c65[_0xb279('0xb')],'include':_0x4f2c65[_0xb279('0xd')]?_[_0xb279('0xe')](_0x4f2c65[_0xb279('0xd')],function(_0x48d9c5){return{'model':db[_0x48d9c5[_0xb279('0xf')]],'as':_0x48d9c5['as'],'attributes':_0x48d9c5[_0xb279('0xb')],'include':_0x48d9c5['include']?_['map'](_0x48d9c5['include'],function(_0x22b586){return{'model':db[_0x22b586[_0xb279('0xf')]],'as':_0x22b586['as'],'attributes':_0x22b586[_0xb279('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x537839){logger[_0xb279('0x14')](_0xb279('0x5'),_0x381749);logger[_0xb279('0x16')](_0xb279('0x5'),_0x381749,JSON[_0xb279('0x17')](_0x537839));_0x1a4d45(_0x537839);})[_0xb279('0x11')](function(_0x47fa15){logger['error'](_0xb279('0x5'),_0x47fa15[_0xb279('0x12')],_0x381749);_0x1482f4(_0x4384fa[_0xb279('0x13')](0x1f4,_0x47fa15['message']));});});});};exports[_0xb279('0x40')]=function(_0x1954da){var _0x15af32=this;return new Promise(function(_0x20b75a,_0x2b1c52){return db[_0xb279('0x21')][_0xb279('0x41')]({'raw':!![],'where':{'phone':_0x1954da['options'][_0xb279('0xa')][_0xb279('0x42')]},'attributes':['id',_0xb279('0x43')],'order':[['id',_0xb279('0x44')]]})[_0xb279('0x10')](function(_0x2bda4d){logger[_0xb279('0x14')](_0xb279('0x45'),_0x1954da);logger[_0xb279('0x16')](_0xb279('0x45'),_0x1954da,JSON[_0xb279('0x17')](_0x2bda4d));_0x20b75a(_0x2bda4d);})[_0xb279('0x11')](function(_0x4086d4){logger[_0xb279('0x13')](_0xb279('0x45'),_0x4086d4[_0xb279('0x12')],_0x1954da);_0x2b1c52(_0x15af32['error'](0x1f4,_0x4086d4['message']));});});};exports['ResetActiveCalls']=function(_0x5b5387){var _0x4863a8=this;return new Promise(function(_0x49c981,_0x324267){return db[_0xb279('0x23')][_0xb279('0x24')](function(_0x469f33){var _0x4570f1=_0x5b5387[_0xb279('0x8')]&&_0x5b5387['options'][_0xb279('0xa')]?_0x5b5387[_0xb279('0x8')][_0xb279('0xa')]:{};return db[_0xb279('0x6')]['update'](_0x5b5387[_0xb279('0x1c')],{'where':_0x4570f1,'transaction':_0x469f33})[_0xb279('0x10')](function(_0x12584f){logger[_0xb279('0x14')](_0xb279('0x46'),_0x5b5387);logger[_0xb279('0x16')](_0xb279('0x46'),_0x5b5387,JSON[_0xb279('0x17')](_0x12584f));_0x49c981(_0x12584f);})[_0xb279('0x11')](function(_0x5a9e8f){logger[_0xb279('0x13')](_0xb279('0x46'),_0x5a9e8f['message'],_0x5b5387);_0x324267(_0x4863a8[_0xb279('0x13')](0x1f4,_0x5a9e8f[_0xb279('0x12')]));});});});};exports[_0xb279('0x47')]=function(_0x2c63fb){var _0x5c5f63=this;var _0xe0e427=_0x2c63fb[_0xb279('0x1c')][_0xb279('0xa')][_0xb279('0x48')];var _0x10adb1=_0x2c63fb['body'][_0xb279('0xa')][_0xb279('0x49')];var _0x2837e3=_0x2c63fb['body'][_0xb279('0xa')]['availableAgentsIds'];return new Promise(function(_0x4a9f8d,_0x5d77a0){return db['CmHopper'][_0xb279('0x7')]({'where':{'voiceQueueId':{'$in':_0xe0e427},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xb279('0x23')][_0xb279('0x37')]('NOW()\x20+\x20INTERVAL\x20'+_0x10adb1+_0xb279('0x4a')),'$gt':db[_0xb279('0x23')][_0xb279('0x37')](_0xb279('0x4b'))}},'UserId':{'$in':_0x2837e3}},'include':[{'model':db[_0xb279('0x21')],'as':_0xb279('0x27')},{'model':db[_0xb279('0x29')],'as':_0xb279('0x2a'),'attributes':['id','name',_0xb279('0x2c')]},{'model':db['CmList'],'as':_0xb279('0x4c')}]})[_0xb279('0x10')](function(_0x209c9c){if(_0x209c9c[_0xb279('0x2d')]>0x0){return db['sequelize']['transaction'](function(_0x53e0f2){return db[_0xb279('0x6')]['update']({'recallmeNotifiedDate':db[_0xb279('0x23')][_0xb279('0x37')](_0xb279('0x4b'))},{'where':{'id':{'$in':_[_0xb279('0xe')](_0x209c9c,'id')}},'transaction':_0x53e0f2})[_0xb279('0x10')](function(){_0x4a9f8d(_0x209c9c);})['catch'](function(_0xcac23c){logger[_0xb279('0x13')](_0xb279('0x47'),_0xcac23c[_0xb279('0x12')],_0x2c63fb);_0x5d77a0(_0x5c5f63[_0xb279('0x13')](0x1f4,_0xcac23c[_0xb279('0x12')]));});})['catch'](function(_0x53b00f){logger[_0xb279('0x13')](_0xb279('0x47'),_0x53b00f['message'],_0x2c63fb);_0x5d77a0(_0x5c5f63[_0xb279('0x13')](0x1f4,_0x53b00f['message']));});}else{_0x4a9f8d(_0x209c9c);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index c2f42be..22575cd 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 _0x8605=['isAuthenticated','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','create','post','/preview','getPreview','getTimezone','put','destroy','exports','express','Router','../../components/auth/service','get'];(function(_0x6e0803,_0xb85f1f){var _0x2911e4=function(_0x4c32f3){while(--_0x4c32f3){_0x6e0803['push'](_0x6e0803['shift']());}};_0x2911e4(++_0xb85f1f);}(_0x8605,0x146));var _0x5860=function(_0x533704,_0x40bb5c){_0x533704=_0x533704-0x0;var _0x5633a4=_0x8605[_0x533704];return _0x5633a4;};'use strict';var express=require(_0x5860('0x0'));var router=express[_0x5860('0x1')]();var auth=require(_0x5860('0x2'));var controller=require('./cmHopper.controller');router[_0x5860('0x3')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x5860('0x4')](),controller[_0x5860('0x5')]);router[_0x5860('0x3')](_0x5860('0x6'),auth[_0x5860('0x4')](),controller[_0x5860('0x7')]);router['get'](_0x5860('0x8'),auth[_0x5860('0x4')](),controller[_0x5860('0x9')]);router[_0x5860('0x3')](_0x5860('0xa'),auth[_0x5860('0x4')](),controller[_0x5860('0xb')]);router[_0x5860('0x3')](_0x5860('0xc'),auth[_0x5860('0x4')](),controller[_0x5860('0xd')]);router['post']('/',auth[_0x5860('0x4')](),controller[_0x5860('0xe')]);router[_0x5860('0xf')](_0x5860('0x10'),auth['isAuthenticated'](),controller[_0x5860('0x11')]);router[_0x5860('0xf')]('/timezone',auth[_0x5860('0x4')](),controller[_0x5860('0x12')]);router[_0x5860('0x13')](_0x5860('0xa'),auth[_0x5860('0x4')](),controller['update']);router['delete'](_0x5860('0xa'),auth[_0x5860('0x4')](),controller[_0x5860('0x14')]);module[_0x5860('0x15')]=router; \ No newline at end of file +var _0x40af=['getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','getPreview','/timezone','getTimezone','put','update','delete','destroy','exports','Router','../../components/auth/service','./cmHopper.controller','/describe','isAuthenticated','describe','get','/opencontacts','/timezones'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x40af,0xf4));var _0xf40a=function(_0x6623dc,_0x404688){_0x6623dc=_0x6623dc-0x0;var _0x56c4c5=_0x40af[_0x6623dc];return _0x56c4c5;};'use strict';var express=require('express');var router=express[_0xf40a('0x0')]();var auth=require(_0xf40a('0x1'));var controller=require(_0xf40a('0x2'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf40a('0x3'),auth[_0xf40a('0x4')](),controller[_0xf40a('0x5')]);router[_0xf40a('0x6')](_0xf40a('0x7'),auth[_0xf40a('0x4')](),controller['getOpenContacts']);router[_0xf40a('0x6')](_0xf40a('0x8'),auth[_0xf40a('0x4')](),controller[_0xf40a('0x9')]);router[_0xf40a('0x6')](_0xf40a('0xa'),auth[_0xf40a('0x4')](),controller[_0xf40a('0xb')]);router[_0xf40a('0x6')](_0xf40a('0xc'),auth['isAuthenticated'](),controller[_0xf40a('0xd')]);router[_0xf40a('0xe')]('/',auth[_0xf40a('0x4')](),controller['create']);router[_0xf40a('0xe')]('/preview',auth['isAuthenticated'](),controller[_0xf40a('0xf')]);router[_0xf40a('0xe')](_0xf40a('0x10'),auth[_0xf40a('0x4')](),controller[_0xf40a('0x11')]);router[_0xf40a('0x12')](_0xf40a('0xa'),auth[_0xf40a('0x4')](),controller[_0xf40a('0x13')]);router[_0xf40a('0x14')](_0xf40a('0xa'),auth[_0xf40a('0x4')](),controller[_0xf40a('0x15')]);module[_0xf40a('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index e76a8df..defdbf7 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 _0xe3c0=['sequelize','exports','INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0xe9b1f4,_0x2c3bfa){var _0x2fef8f=function(_0x31ed52){while(--_0x31ed52){_0xe9b1f4['push'](_0xe9b1f4['shift']());}};_0x2fef8f(++_0x2c3bfa);}(_0xe3c0,0x16b));var _0x0e3c=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xe3c0[_0x1ac595];return _0x455fff;};'use strict';var moment=require(_0x0e3c('0x0'));var Sequelize=require(_0x0e3c('0x1'));module[_0x0e3c('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x0e3c('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x0e3c('0x4')],'defaultValue':moment()[_0x0e3c('0x5')](_0x0e3c('0x6'))},'countbusyretry':{'type':Sequelize[_0x0e3c('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0e3c('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x0e3c('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0e3c('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0e3c('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0e3c('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0e3c('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb1b6=['moment','sequelize','exports','INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x175d71,_0x2a9eab){var _0x31c553=function(_0x199842){while(--_0x199842){_0x175d71['push'](_0x175d71['shift']());}};_0x31c553(++_0x2a9eab);}(_0xb1b6,0xc4));var _0x6b1b=function(_0x1a0af1,_0x3edc92){_0x1a0af1=_0x1a0af1-0x0;var _0xc4ea00=_0xb1b6[_0x1a0af1];return _0xc4ea00;};'use strict';var moment=require(_0x6b1b('0x0'));var Sequelize=require(_0x6b1b('0x1'));module[_0x6b1b('0x2')]={'CmHopperId':{'type':Sequelize[_0x6b1b('0x3')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x6b1b('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x6b1b('0x4')],'defaultValue':moment()[_0x6b1b('0x5')](_0x6b1b('0x6'))},'countbusyretry':{'type':Sequelize[_0x6b1b('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6b1b('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6b1b('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x6b1b('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6b1b('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6b1b('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6b1b('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 8562ca2..17334e3 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 _0x1b9b=['hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','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','update','body','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','CmHopperAdditionalPhones','then','error','stack','name','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','fields','length'];(function(_0x961ce3,_0x45c376){var _0x42df05=function(_0x5ae8b9){while(--_0x5ae8b9){_0x961ce3['push'](_0x961ce3['shift']());}};_0x42df05(++_0x45c376);}(_0x1b9b,0x1ac));var _0xb1b9=function(_0xd5a7ba,_0x11b62d){_0xd5a7ba=_0xd5a7ba-0x0;var _0xc33b6=_0x1b9b[_0xd5a7ba];return _0xc33b6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb1b9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb1b9('0x1'));var rp=require(_0xb1b9('0x2'));var moment=require('moment');var BPromise=require(_0xb1b9('0x3'));var Mustache=require('mustache');var util=require(_0xb1b9('0x4'));var path=require('path');var sox=require(_0xb1b9('0x5'));var csv=require(_0xb1b9('0x6'));var ejs=require(_0xb1b9('0x7'));var fs=require('fs');var fs_extra=require(_0xb1b9('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb1b9('0x9'));var jsforce=require(_0xb1b9('0xa'));var deskjs=require(_0xb1b9('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb1b9('0xc'));var Redis=require(_0xb1b9('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xb1b9('0xe'));var as=require(_0xb1b9('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb1b9('0x10'))(_0xb1b9('0x11'));var utils=require(_0xb1b9('0x12'));var config=require(_0xb1b9('0x13'));var licenseUtil=require(_0xb1b9('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a88e5,_0xdb2434){_0xdb2434=_0xdb2434||0xcc;return function(_0x50cfaf){if(_0x50cfaf){return _0x4a88e5[_0xb1b9('0x15')](_0xdb2434);}return _0x4a88e5[_0xb1b9('0x16')](_0xdb2434)[_0xb1b9('0x17')]();};}function respondWithResult(_0x38a268,_0x3fa55b){_0x3fa55b=_0x3fa55b||0xc8;return function(_0x462c42){if(_0x462c42){return _0x38a268['status'](_0x3fa55b)[_0xb1b9('0x18')](_0x462c42);}};}function respondWithFilteredResult(_0xc96c19,_0x76794e){return function(_0x243288){if(_0x243288){var _0x4823f3=typeof _0x76794e[_0xb1b9('0x19')]==='undefined'&&typeof _0x76794e['limit']===_0xb1b9('0x1a');var _0x495826=_0x243288[_0xb1b9('0x1b')];var _0x120567=_0x4823f3?0x0:_0x76794e[_0xb1b9('0x19')];var _0x5be561=_0x4823f3?_0x243288[_0xb1b9('0x1b')]:_0x76794e[_0xb1b9('0x19')]+_0x76794e[_0xb1b9('0x1c')];var _0x49604e;if(_0x5be561>=_0x495826){_0x5be561=_0x495826;_0x49604e=0xc8;}else{_0x49604e=0xce;}_0xc96c19[_0xb1b9('0x16')](_0x49604e);return _0xc96c19[_0xb1b9('0x1d')](_0xb1b9('0x1e'),_0x120567+'-'+_0x5be561+'/'+_0x495826)[_0xb1b9('0x18')](_0x243288);}return null;};}function patchUpdates(_0x7e7c22){return function(_0x93c79b){try{jsonpatch[_0xb1b9('0x1f')](_0x93c79b,_0x7e7c22,!![]);}catch(_0x51900f){return BPromise['reject'](_0x51900f);}return _0x93c79b[_0xb1b9('0x20')]();};}function saveUpdates(_0x3b8a65,_0x152905){return function(_0x2123e0){if(_0x2123e0){return _0x2123e0['update'](_0x3b8a65)['then'](function(_0x101694){return _0x101694;});}return null;};}function removeEntity(_0x344338,_0x42b45c){return function(_0x1ba874){if(_0x1ba874){return _0x1ba874[_0xb1b9('0x21')]()['then'](function(){var _0x325b2f=_0x1ba874['get']({'plain':!![]});var _0x16207c=_0xb1b9('0x22');return db['UserProfileResource'][_0xb1b9('0x21')]({'where':{'type':_0x16207c,'resourceId':_0x325b2f['id']}})[_0xb1b9('0x23')](function(){return _0x1ba874;});})[_0xb1b9('0x23')](function(){_0x344338[_0xb1b9('0x16')](0xcc)[_0xb1b9('0x17')]();});}};}function handleEntityNotFound(_0x28a1d2,_0x346006){return function(_0x2f8af4){if(!_0x2f8af4){_0x28a1d2[_0xb1b9('0x15')](0x194);}return _0x2f8af4;};}function handleError(_0x5eabf5,_0x216d63){_0x216d63=_0x216d63||0x1f4;return function(_0x2fb970){logger[_0xb1b9('0x24')](_0x2fb970[_0xb1b9('0x25')]);if(_0x2fb970[_0xb1b9('0x26')]){delete _0x2fb970['name'];}_0x5eabf5['status'](_0x216d63)['send'](_0x2fb970);};}exports[_0xb1b9('0x27')]=function(_0x26135e,_0x239218){var _0xdfa9ab={},_0x519236={},_0x14dae5={'count':0x0,'rows':[]};var _0x2c22ca=_['map'](db[_0xb1b9('0x28')][_0xb1b9('0x29')],function(_0x3ea460){return{'name':_0x3ea460[_0xb1b9('0x2a')],'type':_0x3ea460[_0xb1b9('0x2b')][_0xb1b9('0x2c')]};});_0x519236[_0xb1b9('0x2d')]=_[_0xb1b9('0x2e')](_0x2c22ca,_0xb1b9('0x26'));_0x519236[_0xb1b9('0x2f')]=_[_0xb1b9('0x30')](_0x26135e[_0xb1b9('0x2f')]);_0x519236['filters']=_['intersection'](_0x519236['model'],_0x519236['query']);_0xdfa9ab[_0xb1b9('0x31')]=_['intersection'](_0x519236[_0xb1b9('0x2d')],qs[_0xb1b9('0x32')](_0x26135e[_0xb1b9('0x2f')][_0xb1b9('0x32')]));_0xdfa9ab[_0xb1b9('0x31')]=_0xdfa9ab['attributes'][_0xb1b9('0x33')]?_0xdfa9ab[_0xb1b9('0x31')]:_0x519236[_0xb1b9('0x2d')];if(!_0x26135e[_0xb1b9('0x2f')][_0xb1b9('0x34')](_0xb1b9('0x35'))){_0xdfa9ab['limit']=qs[_0xb1b9('0x1c')](_0x26135e['query'][_0xb1b9('0x1c')]);_0xdfa9ab[_0xb1b9('0x19')]=qs['offset'](_0x26135e[_0xb1b9('0x2f')][_0xb1b9('0x19')]);}_0xdfa9ab[_0xb1b9('0x36')]=qs[_0xb1b9('0x37')](_0x26135e[_0xb1b9('0x2f')][_0xb1b9('0x37')]);_0xdfa9ab[_0xb1b9('0x38')]=qs[_0xb1b9('0x39')](_['pick'](_0x26135e[_0xb1b9('0x2f')],_0x519236[_0xb1b9('0x39')]),_0x2c22ca);if(_0x26135e[_0xb1b9('0x2f')][_0xb1b9('0x3a')]){_0xdfa9ab[_0xb1b9('0x38')]=_[_0xb1b9('0x3b')](_0xdfa9ab['where'],{'$or':_[_0xb1b9('0x2e')](_0x2c22ca,function(_0x2524d9){if(_0x2524d9[_0xb1b9('0x2b')]!=='VIRTUAL'){var _0x484ea7={};_0x484ea7[_0x2524d9['name']]={'$like':'%'+_0x26135e[_0xb1b9('0x2f')][_0xb1b9('0x3a')]+'%'};return _0x484ea7;}})});}_0xdfa9ab=_[_0xb1b9('0x3b')]({},_0xdfa9ab,_0x26135e[_0xb1b9('0x3c')]);var _0x451bdb={'where':_0xdfa9ab['where']};return db[_0xb1b9('0x28')]['count'](_0x451bdb)['then'](function(_0x5b8811){_0x14dae5[_0xb1b9('0x1b')]=_0x5b8811;if(_0x26135e[_0xb1b9('0x2f')]['includeAll']){_0xdfa9ab[_0xb1b9('0x3d')]=[{'all':!![]}];}return db[_0xb1b9('0x28')][_0xb1b9('0x3e')](_0xdfa9ab);})[_0xb1b9('0x23')](function(_0x12e611){_0x14dae5[_0xb1b9('0x3f')]=_0x12e611;return _0x14dae5;})['then'](respondWithFilteredResult(_0x239218,_0xdfa9ab))[_0xb1b9('0x40')](handleError(_0x239218,null));};exports[_0xb1b9('0x41')]=function(_0x44125b,_0x151db9){var _0x579b4d={'raw':!![],'where':{'id':_0x44125b[_0xb1b9('0x42')]['id']}},_0x35527c={};_0x35527c[_0xb1b9('0x2d')]=_[_0xb1b9('0x30')](db[_0xb1b9('0x28')][_0xb1b9('0x29')]);_0x35527c[_0xb1b9('0x2f')]=_[_0xb1b9('0x30')](_0x44125b[_0xb1b9('0x2f')]);_0x35527c['filters']=_['intersection'](_0x35527c[_0xb1b9('0x2d')],_0x35527c[_0xb1b9('0x2f')]);_0x579b4d[_0xb1b9('0x31')]=_['intersection'](_0x35527c['model'],qs[_0xb1b9('0x32')](_0x44125b[_0xb1b9('0x2f')][_0xb1b9('0x32')]));_0x579b4d[_0xb1b9('0x31')]=_0x579b4d[_0xb1b9('0x31')][_0xb1b9('0x33')]?_0x579b4d[_0xb1b9('0x31')]:_0x35527c[_0xb1b9('0x2d')];if(_0x44125b[_0xb1b9('0x2f')][_0xb1b9('0x43')]){_0x579b4d[_0xb1b9('0x3d')]=[{'all':!![]}];}_0x579b4d=_['merge']({},_0x579b4d,_0x44125b['options']);return db[_0xb1b9('0x28')][_0xb1b9('0x44')](_0x579b4d)[_0xb1b9('0x23')](handleEntityNotFound(_0x151db9,null))[_0xb1b9('0x23')](respondWithResult(_0x151db9,null))[_0xb1b9('0x40')](handleError(_0x151db9,null));};exports[_0xb1b9('0x45')]=function(_0x5d2f47,_0x5667c5){return db[_0xb1b9('0x28')]['create'](_0x5d2f47['body'],{})[_0xb1b9('0x23')](function(_0x4e13ab){var _0x4379d6=_0x5d2f47[_0xb1b9('0x46')][_0xb1b9('0x47')]({'plain':!![]});if(!_0x4379d6)throw new Error(_0xb1b9('0x48'));if(_0x4379d6[_0xb1b9('0x49')]==='user'){var _0x2f1268=_0x4e13ab[_0xb1b9('0x47')]({'plain':!![]});var _0x2c334f=_0xb1b9('0x22');return db[_0xb1b9('0x4a')][_0xb1b9('0x44')]({'where':{'name':_0x2c334f,'userProfileId':_0x4379d6['userProfileId']},'raw':!![]})['then'](function(_0x2ca543){if(_0x2ca543&&_0x2ca543[_0xb1b9('0x4b')]===0x0){return db[_0xb1b9('0x4c')]['create']({'name':_0x2f1268[_0xb1b9('0x26')],'resourceId':_0x2f1268['id'],'type':_0x2ca543[_0xb1b9('0x26')],'sectionId':_0x2ca543['id']},{})['then'](function(){return _0x4e13ab;});}else{return _0x4e13ab;}})['catch'](function(_0xd233d4){logger[_0xb1b9('0x24')](_0xb1b9('0x4d'),_0xd233d4);throw _0xd233d4;});}return _0x4e13ab;})[_0xb1b9('0x23')](respondWithResult(_0x5667c5,0xc9))[_0xb1b9('0x40')](handleError(_0x5667c5,null));};exports[_0xb1b9('0x4e')]=function(_0x2cea50,_0x5f1c98){if(_0x2cea50[_0xb1b9('0x4f')]['id']){delete _0x2cea50[_0xb1b9('0x4f')]['id'];}return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x2cea50[_0xb1b9('0x42')]['id']}})[_0xb1b9('0x23')](handleEntityNotFound(_0x5f1c98,null))[_0xb1b9('0x23')](saveUpdates(_0x2cea50[_0xb1b9('0x4f')],null))[_0xb1b9('0x23')](respondWithResult(_0x5f1c98,null))[_0xb1b9('0x40')](handleError(_0x5f1c98,null));};exports[_0xb1b9('0x21')]=function(_0x55243d,_0xff7fa8){return db['CmHopperAdditionalPhone'][_0xb1b9('0x44')]({'where':{'id':_0x55243d[_0xb1b9('0x42')]['id']}})[_0xb1b9('0x23')](handleEntityNotFound(_0xff7fa8,null))['then'](removeEntity(_0xff7fa8,null))[_0xb1b9('0x40')](handleError(_0xff7fa8,null));}; \ No newline at end of file +var _0xc67b=['then','get','CmHopperAdditionalPhones','UserProfileResource','destroy','error','stack','name','send','index','map','CmHopperAdditionalPhone','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','length','includeAll','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','fs-extra','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','reject','save'];(function(_0x54ab62,_0x58e021){var _0x2d71b8=function(_0x464463){while(--_0x464463){_0x54ab62['push'](_0x54ab62['shift']());}};_0x2d71b8(++_0x58e021);}(_0xc67b,0x186));var _0xbc67=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xc67b[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0xbc67('0x0'));var rimraf=require(_0xbc67('0x1'));var zipdir=require(_0xbc67('0x2'));var jsonpatch=require(_0xbc67('0x3'));var rp=require('request-promise');var moment=require(_0xbc67('0x4'));var BPromise=require(_0xbc67('0x5'));var Mustache=require(_0xbc67('0x6'));var util=require('util');var path=require(_0xbc67('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbc67('0x8'));var fs=require('fs');var fs_extra=require(_0xbc67('0x9'));var _=require(_0xbc67('0xa'));var squel=require('squel');var crypto=require(_0xbc67('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbc67('0xc'));var querystring=require(_0xbc67('0xd'));var Papa=require(_0xbc67('0xe'));var Redis=require(_0xbc67('0xf'));var authService=require(_0xbc67('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbc67('0x11'));var hardwareService=require(_0xbc67('0x12'));var logger=require(_0xbc67('0x13'))(_0xbc67('0x14'));var utils=require(_0xbc67('0x15'));var config=require(_0xbc67('0x16'));var licenseUtil=require(_0xbc67('0x17'));var db=require(_0xbc67('0x18'))['db'];function respondWithStatusCode(_0x2d1e99,_0xcb3c06){_0xcb3c06=_0xcb3c06||0xcc;return function(_0x5f14a0){if(_0x5f14a0){return _0x2d1e99[_0xbc67('0x19')](_0xcb3c06);}return _0x2d1e99[_0xbc67('0x1a')](_0xcb3c06)[_0xbc67('0x1b')]();};}function respondWithResult(_0x92d6e9,_0x42ef86){_0x42ef86=_0x42ef86||0xc8;return function(_0x53aa84){if(_0x53aa84){return _0x92d6e9[_0xbc67('0x1a')](_0x42ef86)['json'](_0x53aa84);}};}function respondWithFilteredResult(_0x2f2002,_0xbfafae){return function(_0x2044e6){if(_0x2044e6){var _0x39b97e=typeof _0xbfafae[_0xbc67('0x1c')]===_0xbc67('0x1d')&&typeof _0xbfafae[_0xbc67('0x1e')]==='undefined';var _0x45169d=_0x2044e6[_0xbc67('0x1f')];var _0x285be3=_0x39b97e?0x0:_0xbfafae[_0xbc67('0x1c')];var _0x45d325=_0x39b97e?_0x2044e6[_0xbc67('0x1f')]:_0xbfafae['offset']+_0xbfafae[_0xbc67('0x1e')];var _0x5de6b1;if(_0x45d325>=_0x45169d){_0x45d325=_0x45169d;_0x5de6b1=0xc8;}else{_0x5de6b1=0xce;}_0x2f2002['status'](_0x5de6b1);return _0x2f2002[_0xbc67('0x20')]('Content-Range',_0x285be3+'-'+_0x45d325+'/'+_0x45169d)['json'](_0x2044e6);}return null;};}function patchUpdates(_0x2eec9d){return function(_0x506c34){try{jsonpatch['apply'](_0x506c34,_0x2eec9d,!![]);}catch(_0x41bfb7){return BPromise[_0xbc67('0x21')](_0x41bfb7);}return _0x506c34[_0xbc67('0x22')]();};}function saveUpdates(_0x3a92d2,_0x2d1b87){return function(_0x1897bc){if(_0x1897bc){return _0x1897bc['update'](_0x3a92d2)[_0xbc67('0x23')](function(_0x4b1e37){return _0x4b1e37;});}return null;};}function removeEntity(_0x38dbf4,_0x56aa57){return function(_0x39b3fa){if(_0x39b3fa){return _0x39b3fa['destroy']()[_0xbc67('0x23')](function(){var _0x1192bf=_0x39b3fa[_0xbc67('0x24')]({'plain':!![]});var _0x2e8dea=_0xbc67('0x25');return db[_0xbc67('0x26')][_0xbc67('0x27')]({'where':{'type':_0x2e8dea,'resourceId':_0x1192bf['id']}})[_0xbc67('0x23')](function(){return _0x39b3fa;});})[_0xbc67('0x23')](function(){_0x38dbf4['status'](0xcc)[_0xbc67('0x1b')]();});}};}function handleEntityNotFound(_0x57a4ed,_0x534a72){return function(_0x5681a5){if(!_0x5681a5){_0x57a4ed[_0xbc67('0x19')](0x194);}return _0x5681a5;};}function handleError(_0x4aab5e,_0x38a0f8){_0x38a0f8=_0x38a0f8||0x1f4;return function(_0x5bfb54){logger[_0xbc67('0x28')](_0x5bfb54[_0xbc67('0x29')]);if(_0x5bfb54[_0xbc67('0x2a')]){delete _0x5bfb54['name'];}_0x4aab5e[_0xbc67('0x1a')](_0x38a0f8)[_0xbc67('0x2b')](_0x5bfb54);};}exports[_0xbc67('0x2c')]=function(_0x29c2ae,_0x174d6c){var _0xde906b={},_0x84bef0={},_0x28bece={'count':0x0,'rows':[]};var _0x5e2f9e=_[_0xbc67('0x2d')](db[_0xbc67('0x2e')]['rawAttributes'],function(_0x2e24cb){return{'name':_0x2e24cb[_0xbc67('0x2f')],'type':_0x2e24cb[_0xbc67('0x30')][_0xbc67('0x31')]};});_0x84bef0[_0xbc67('0x32')]=_[_0xbc67('0x2d')](_0x5e2f9e,'name');_0x84bef0[_0xbc67('0x33')]=_[_0xbc67('0x34')](_0x29c2ae[_0xbc67('0x33')]);_0x84bef0[_0xbc67('0x35')]=_[_0xbc67('0x36')](_0x84bef0[_0xbc67('0x32')],_0x84bef0['query']);_0xde906b['attributes']=_[_0xbc67('0x36')](_0x84bef0['model'],qs['fields'](_0x29c2ae[_0xbc67('0x33')][_0xbc67('0x37')]));_0xde906b[_0xbc67('0x38')]=_0xde906b[_0xbc67('0x38')]['length']?_0xde906b[_0xbc67('0x38')]:_0x84bef0[_0xbc67('0x32')];if(!_0x29c2ae[_0xbc67('0x33')][_0xbc67('0x39')](_0xbc67('0x3a'))){_0xde906b[_0xbc67('0x1e')]=qs[_0xbc67('0x1e')](_0x29c2ae[_0xbc67('0x33')]['limit']);_0xde906b[_0xbc67('0x1c')]=qs[_0xbc67('0x1c')](_0x29c2ae[_0xbc67('0x33')][_0xbc67('0x1c')]);}_0xde906b[_0xbc67('0x3b')]=qs[_0xbc67('0x3c')](_0x29c2ae['query'][_0xbc67('0x3c')]);_0xde906b[_0xbc67('0x3d')]=qs[_0xbc67('0x35')](_[_0xbc67('0x3e')](_0x29c2ae['query'],_0x84bef0[_0xbc67('0x35')]),_0x5e2f9e);if(_0x29c2ae['query'][_0xbc67('0x3f')]){_0xde906b[_0xbc67('0x3d')]=_[_0xbc67('0x40')](_0xde906b['where'],{'$or':_[_0xbc67('0x2d')](_0x5e2f9e,function(_0x33b24c){if(_0x33b24c[_0xbc67('0x30')]!==_0xbc67('0x41')){var _0x20d650={};_0x20d650[_0x33b24c[_0xbc67('0x2a')]]={'$like':'%'+_0x29c2ae[_0xbc67('0x33')]['filter']+'%'};return _0x20d650;}})});}_0xde906b=_[_0xbc67('0x40')]({},_0xde906b,_0x29c2ae['options']);var _0x3a66c1={'where':_0xde906b[_0xbc67('0x3d')]};return db[_0xbc67('0x2e')][_0xbc67('0x1f')](_0x3a66c1)[_0xbc67('0x23')](function(_0x5c4802){_0x28bece[_0xbc67('0x1f')]=_0x5c4802;if(_0x29c2ae[_0xbc67('0x33')]['includeAll']){_0xde906b[_0xbc67('0x42')]=[{'all':!![]}];}return db[_0xbc67('0x2e')][_0xbc67('0x43')](_0xde906b);})[_0xbc67('0x23')](function(_0x419064){_0x28bece[_0xbc67('0x44')]=_0x419064;return _0x28bece;})['then'](respondWithFilteredResult(_0x174d6c,_0xde906b))[_0xbc67('0x45')](handleError(_0x174d6c,null));};exports[_0xbc67('0x46')]=function(_0x4a784a,_0x4b7db9){var _0xb36705={'raw':!![],'where':{'id':_0x4a784a[_0xbc67('0x47')]['id']}},_0x288cc9={};_0x288cc9[_0xbc67('0x32')]=_[_0xbc67('0x34')](db['CmHopperAdditionalPhone']['rawAttributes']);_0x288cc9['query']=_['keys'](_0x4a784a[_0xbc67('0x33')]);_0x288cc9[_0xbc67('0x35')]=_[_0xbc67('0x36')](_0x288cc9['model'],_0x288cc9[_0xbc67('0x33')]);_0xb36705[_0xbc67('0x38')]=_[_0xbc67('0x36')](_0x288cc9['model'],qs['fields'](_0x4a784a['query'][_0xbc67('0x37')]));_0xb36705[_0xbc67('0x38')]=_0xb36705['attributes'][_0xbc67('0x48')]?_0xb36705['attributes']:_0x288cc9[_0xbc67('0x32')];if(_0x4a784a[_0xbc67('0x33')][_0xbc67('0x49')]){_0xb36705['include']=[{'all':!![]}];}_0xb36705=_[_0xbc67('0x40')]({},_0xb36705,_0x4a784a[_0xbc67('0x4a')]);return db[_0xbc67('0x2e')][_0xbc67('0x4b')](_0xb36705)[_0xbc67('0x23')](handleEntityNotFound(_0x4b7db9,null))[_0xbc67('0x23')](respondWithResult(_0x4b7db9,null))[_0xbc67('0x45')](handleError(_0x4b7db9,null));};exports[_0xbc67('0x4c')]=function(_0xab4e96,_0x154cf9){return db[_0xbc67('0x2e')]['create'](_0xab4e96[_0xbc67('0x4d')],{})['then'](function(_0x43b2a7){var _0x3740c6=_0xab4e96[_0xbc67('0x4e')][_0xbc67('0x24')]({'plain':!![]});if(!_0x3740c6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3740c6[_0xbc67('0x4f')]===_0xbc67('0x4e')){var _0x42509e=_0x43b2a7[_0xbc67('0x24')]({'plain':!![]});var _0x464875=_0xbc67('0x25');return db[_0xbc67('0x50')][_0xbc67('0x4b')]({'where':{'name':_0x464875,'userProfileId':_0x3740c6[_0xbc67('0x51')]},'raw':!![]})[_0xbc67('0x23')](function(_0x6774ec){if(_0x6774ec&&_0x6774ec[_0xbc67('0x52')]===0x0){return db[_0xbc67('0x26')][_0xbc67('0x4c')]({'name':_0x42509e[_0xbc67('0x2a')],'resourceId':_0x42509e['id'],'type':_0x6774ec['name'],'sectionId':_0x6774ec['id']},{})[_0xbc67('0x23')](function(){return _0x43b2a7;});}else{return _0x43b2a7;}})[_0xbc67('0x45')](function(_0x337ba9){logger['error'](_0xbc67('0x53'),_0x337ba9);throw _0x337ba9;});}return _0x43b2a7;})[_0xbc67('0x23')](respondWithResult(_0x154cf9,0xc9))['catch'](handleError(_0x154cf9,null));};exports[_0xbc67('0x54')]=function(_0x7e3eb4,_0x59bbb6){if(_0x7e3eb4[_0xbc67('0x4d')]['id']){delete _0x7e3eb4['body']['id'];}return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x7e3eb4['params']['id']}})['then'](handleEntityNotFound(_0x59bbb6,null))[_0xbc67('0x23')](saveUpdates(_0x7e3eb4['body'],null))['then'](respondWithResult(_0x59bbb6,null))[_0xbc67('0x45')](handleError(_0x59bbb6,null));};exports[_0xbc67('0x27')]=function(_0x19ab28,_0x5f1405){return db[_0xbc67('0x2e')][_0xbc67('0x4b')]({'where':{'id':_0x19ab28[_0xbc67('0x47')]['id']}})[_0xbc67('0x23')](handleEntityNotFound(_0x5f1405,null))[_0xbc67('0x23')](removeEntity(_0x5f1405,null))[_0xbc67('0x45')](handleError(_0x5f1405,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 4d8c707..154826d 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 _0x6f94=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','define','cm_hopper_additional_phones','lodash','util'];(function(_0x163a50,_0x164984){var _0x214d14=function(_0x3e1587){while(--_0x3e1587){_0x163a50['push'](_0x163a50['shift']());}};_0x214d14(++_0x164984);}(_0x6f94,0x1ba));var _0x46f9=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x6f94[_0x1c8c28];return _0x1f59b4;};'use strict';var _=require(_0x46f9('0x0'));var util=require(_0x46f9('0x1'));var logger=require(_0x46f9('0x2'))(_0x46f9('0x3'));var moment=require(_0x46f9('0x4'));var BPromise=require(_0x46f9('0x5'));var rp=require(_0x46f9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x46f9('0x7'));var config=require(_0x46f9('0x8'));var attributes=require(_0x46f9('0x9'));module['exports']=function(_0xd0e35b,_0x2412e1){return _0xd0e35b[_0x46f9('0xa')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x46f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9023=['../../config/environment','./cmHopperAdditionalPhone.attributes','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9023,0x1f3));var _0x3902=function(_0x2ab204,_0x4a7810){_0x2ab204=_0x2ab204-0x0;var _0x49f245=_0x9023[_0x2ab204];return _0x49f245;};'use strict';var _=require(_0x3902('0x0'));var util=require(_0x3902('0x1'));var logger=require(_0x3902('0x2'))('api');var moment=require(_0x3902('0x3'));var BPromise=require(_0x3902('0x4'));var rp=require(_0x3902('0x5'));var fs=require('fs');var path=require(_0x3902('0x6'));var rimraf=require('rimraf');var config=require(_0x3902('0x7'));var attributes=require(_0x3902('0x8'));module['exports']=function(_0x3a0181,_0x1d2632){return _0x3a0181['define'](_0x3902('0x9'),attributes,{'tableName':_0x3902('0xa'),'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 6efbf0e..c370284 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 _0x738d=['request','then','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countdropretry','countabandonedretry','SwapAdditionalPhones','ContactId','ASC','duration','waitTime','isNil','scheduledat','minutes','add','createdAt','updatedAt','phone','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x58cf4f,_0xa2aac5){var _0xdcdf94=function(_0x123c83){while(--_0x123c83){_0x58cf4f['push'](_0x58cf4f['shift']());}};_0xdcdf94(++_0xa2aac5);}(_0x738d,0x68));var _0xd738=function(_0x2eec7e,_0x5f0a62){_0x2eec7e=_0x2eec7e-0x0;var _0x7902f1=_0x738d[_0x2eec7e];return _0x7902f1;};'use strict';var _=require(_0xd738('0x0'));var util=require(_0xd738('0x1'));var moment=require(_0xd738('0x2'));var BPromise=require(_0xd738('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd738('0x4'))['db'];var utils=require(_0xd738('0x5'));var logger=require('../../config/logger')(_0xd738('0x6'));var config=require(_0xd738('0x7'));var jayson=require(_0xd738('0x8'));var client=jayson['client'][_0xd738('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45b105,_0x49acda,_0x1280a8){return new BPromise(function(_0x4b995d,_0x5ef554){return client[_0xd738('0xa')](_0x45b105,_0x1280a8)[_0xd738('0xb')](function(_0x20bde7){logger[_0xd738('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x49acda,_0xd738('0xd'));logger[_0xd738('0xe')](_0xd738('0xf'),_0x49acda,_0xd738('0xd'),JSON[_0xd738('0x10')](_0x20bde7));if(_0x20bde7[_0xd738('0x11')]){if(_0x20bde7[_0xd738('0x11')][_0xd738('0x12')]===0x1f4){logger[_0xd738('0x11')](_0xd738('0x13'),_0x49acda,_0x20bde7['error'][_0xd738('0x14')]);return _0x5ef554(_0x20bde7[_0xd738('0x11')][_0xd738('0x14')]);}logger[_0xd738('0x11')](_0xd738('0x13'),_0x49acda,_0x20bde7[_0xd738('0x11')][_0xd738('0x14')]);return _0x4b995d(_0x20bde7[_0xd738('0x11')][_0xd738('0x14')]);}else{logger[_0xd738('0xc')](_0xd738('0x13'),_0x49acda,_0xd738('0xd'));_0x4b995d(_0x20bde7[_0xd738('0x15')]['message']);}})[_0xd738('0x16')](function(_0x235230){logger[_0xd738('0x11')](_0xd738('0x13'),_0x49acda,_0x235230);_0x5ef554(_0x235230);});});}exports[_0xd738('0x17')]=function(_0x4d6d37){var _0x701544=this;return new Promise(function(_0xc980b,_0x908cfa){return db[_0xd738('0x18')][_0xd738('0x19')]({'raw':!![],'where':{'ContactId':_0x4d6d37[_0xd738('0x1a')]['ContactId'],'ListId':_0x4d6d37[_0xd738('0x1a')]['ListId'],'VoiceQueueId':_0x4d6d37[_0xd738('0x1a')]['VoiceQueueId']===undefined?null:_0x4d6d37[_0xd738('0x1a')][_0xd738('0x1b')],'CampaignId':_0x4d6d37[_0xd738('0x1a')][_0xd738('0x1c')]===undefined?null:_0x4d6d37[_0xd738('0x1a')][_0xd738('0x1c')]}})[_0xd738('0xb')](function(_0x4ea744){if(_0x4ea744!=null){return db[_0xd738('0x1d')][_0xd738('0x19')]({'raw':!![],'where':{'CmHopperId':_0x4ea744['id'],'OrderBy':{'$gt':_0x4ea744[_0xd738('0x1e')]}},'order':[[_0xd738('0x1e'),'ASC']]})[_0xd738('0xb')](function(_0x58f703){var _0x4643e0=0x0;if(_0x58f703){if(_0x58f703[_0xd738('0x1f')]+_0x58f703[_0xd738('0x20')]+_0x58f703[_0xd738('0x21')]+_0x58f703[_0xd738('0x22')]+_0x58f703['countdropretry']+_0x58f703['countabandonedretry']+_0x58f703[_0xd738('0x23')]+_0x58f703[_0xd738('0x24')]<_0x4d6d37[_0xd738('0x25')][_0xd738('0x26')])_0x4643e0=0x1;_0xc980b({'additional':_0x4643e0});}else{return db[_0xd738('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x4ea744['id']},'order':[[_0xd738('0x1e'),'ASC']]})[_0xd738('0xb')](function(_0x2dec40){var _0x2e570c=0x0;if(_0x2dec40){if(_0x2dec40[_0xd738('0x1f')]+_0x2dec40[_0xd738('0x20')]+_0x2dec40[_0xd738('0x21')]+_0x2dec40['countnosuchnumberretry']+_0x2dec40[_0xd738('0x27')]+_0x2dec40[_0xd738('0x28')]+_0x2dec40[_0xd738('0x23')]+_0x2dec40[_0xd738('0x24')]<_0x4d6d37[_0xd738('0x25')]['dialGlobalMaxRetry'])_0x2e570c=0x1;_0xc980b({'additional':_0x2e570c});}else{_0xc980b({'additional':0x0});}})[_0xd738('0x16')](function(_0x328d4a){logger['error'](_0xd738('0x17'),_0x328d4a[_0xd738('0x14')]);_0x908cfa(_0x701544[_0xd738('0x11')](0x1f4,_0x328d4a[_0xd738('0x14')]));});}})[_0xd738('0x16')](function(_0x47647d){logger[_0xd738('0x11')](_0xd738('0x17'),_0x47647d[_0xd738('0x14')]);_0x908cfa(_0x701544['error'](0x1f4,_0x47647d[_0xd738('0x14')]));});}else _0xc980b({'additional':0x0});});});};exports[_0xd738('0x29')]=function(_0x483e8d){var _0x3e7809=this;return new Promise(function(_0x5450ed,_0x13019c){return db[_0xd738('0x18')]['findOne']({'raw':!![],'where':{'ContactId':_0x483e8d[_0xd738('0x1a')][_0xd738('0x2a')],'ListId':_0x483e8d[_0xd738('0x1a')]['ListId'],'VoiceQueueId':_0x483e8d[_0xd738('0x1a')][_0xd738('0x1b')]===undefined?null:_0x483e8d['body'][_0xd738('0x1b')],'CampaignId':_0x483e8d[_0xd738('0x1a')][_0xd738('0x1c')]===undefined?null:_0x483e8d['body'][_0xd738('0x1c')]}})[_0xd738('0xb')](function(_0x439890){if(_0x439890!=null){return db[_0xd738('0x1d')][_0xd738('0x19')]({'raw':!![],'where':{'CmHopperId':_0x439890['id'],'OrderBy':{'$gte':_0x439890['OrderBy']}},'order':[[_0xd738('0x1e'),_0xd738('0x2b')]]})[_0xd738('0xb')](function(_0x1d30cd){if(_0x1d30cd)return activateAdditionalPhone(_0x439890,_0x483e8d[_0xd738('0x1a')],_0x1d30cd,_0x483e8d[_0xd738('0x2c')],_0x483e8d['waitTime'])[_0xd738('0xb')](function(_0x2c57af){_0x5450ed(_0x2c57af);});else{return db[_0xd738('0x1d')][_0xd738('0x19')]({'raw':!![],'where':{'CmHopperId':_0x439890['id']},'order':[[_0xd738('0x1e'),_0xd738('0x2b')]]})['then'](function(_0x18df8b){if(_0x18df8b)return activateAdditionalPhone(_0x439890,_0x483e8d[_0xd738('0x1a')],_0x18df8b,_0x483e8d[_0xd738('0x2c')],_0x483e8d[_0xd738('0x2d')])[_0xd738('0xb')](function(_0x3d7f89){_0x5450ed(_0x3d7f89);});else{_0x5450ed({'id':_0x439890['id'],'phone':''});}})[_0xd738('0x16')](function(_0x326678){logger[_0xd738('0x11')](_0xd738('0x17'),_0x326678['message']);_0x13019c(_0x3e7809[_0xd738('0x11')](0x1f4,_0x326678[_0xd738('0x14')]));});}})['catch'](function(_0x436c96){logger[_0xd738('0x11')](_0xd738('0x17'),_0x436c96[_0xd738('0x14')]);_0x13019c(_0x3e7809[_0xd738('0x11')](0x1f4,_0x436c96[_0xd738('0x14')]));});}else _0x5450ed(0x1);});});};function activateAdditionalPhone(_0x28697f,_0x20490f,_0x1693ee,_0x2f64aa,_0x3abd8d){return new Promise(function(_0x553e5d,_0x384bec){var _0x30e86e;if(_[_0xd738('0x2e')](_0x1693ee['scheduledat'])){_0x1693ee[_0xd738('0x2f')]=moment();}if(moment()>moment(_0x1693ee['scheduledat'])){_0x30e86e=moment()['add'](_0x3abd8d||0x3,_0xd738('0x30'));}else{if(_0x1693ee[_0xd738('0x1e')]==0x0){_0x30e86e=moment(_0x1693ee['scheduledat']);}else{_0x30e86e=moment()[_0xd738('0x31')](_0x3abd8d||0x3,_0xd738('0x30'));}}if(_[_0xd738('0x2e')](_0x30e86e)){_0x30e86e=moment()[_0xd738('0x31')](_0x3abd8d||0x3,_0xd738('0x30'));}var _0x1f5d39={'phone':_0x28697f['phone'],'active':0x0,'OrderBy':_[_0xd738('0x2e')](_0x28697f[_0xd738('0x1e')])?0x0:_0x28697f[_0xd738('0x1e')],'scheduledat':moment()['add'](_0x2f64aa||0x1,_0xd738('0x30')),'countbusyretry':_0x20490f[_0xd738('0x1f')],'countcongestionretry':_0x20490f[_0xd738('0x20')],'countnoanswerretry':_0x20490f[_0xd738('0x21')],'countnosuchnumberretry':_0x20490f['countnosuchnumberretry'],'countdropretry':_0x20490f['countdropretry'],'countabandonedretry':_0x20490f[_0xd738('0x28')],'countmachineretry':_0x20490f['countmachineretry'],'countagentrejectretry':_0x20490f['countagentrejectretry'],'createdAt':_0x20490f[_0xd738('0x32')],'updatedAt':_0x20490f[_0xd738('0x33')]};var _0x348dc1={'CmHopperId':_0x28697f['id'],'phone':_0x1693ee[_0xd738('0x34')],'active':0x0,'OrderBy':_[_0xd738('0x2e')](_0x1693ee[_0xd738('0x1e')])?0x0:_0x1693ee[_0xd738('0x1e')],'scheduledat':_0x30e86e,'countbusyretry':_0x1693ee[_0xd738('0x1f')],'countcongestionretry':_0x1693ee[_0xd738('0x20')],'countnoanswerretry':_0x1693ee['countnoanswerretry'],'countnosuchnumberretry':_0x1693ee[_0xd738('0x22')],'countdropretry':_0x1693ee[_0xd738('0x27')],'countabandonedretry':_0x1693ee['countabandonedretry'],'countmachineretry':_0x1693ee[_0xd738('0x23')],'countagentrejectretry':_0x1693ee[_0xd738('0x24')],'createdAt':_0x1693ee['createdAt'],'updatedAt':_0x1693ee[_0xd738('0x33')]};return db[_0xd738('0x35')]['transaction'](function(_0x15f221){return db[_0xd738('0x1d')]['update'](_0x1f5d39,{'where':{'id':_0x1693ee['id']}},{'transaction':_0x15f221})[_0xd738('0xb')](function(){return db[_0xd738('0x18')][_0xd738('0x36')](_0x348dc1,{'where':{'id':_0x28697f['id']}},{'transaction':_0x15f221});});})[_0xd738('0xb')](function(_0x3ed023){_0x553e5d({'id':_0x28697f['id'],'phone':_0x1693ee[_0xd738('0x34')]});})[_0xd738('0x16')](function(_0x2a7167){logger['error'](_0xd738('0x37'),_0x2a7167[_0xd738('0x14')]);_0x384bec({'error':_0x2a7167[_0xd738('0x14')]});});});}exports[_0xd738('0x38')]=function(_0x31a461){var _0xc78a00=this;return new Promise(function(_0x5cb337,_0x3cdcf8){return db[_0xd738('0x18')][_0xd738('0x36')](_0x31a461[_0xd738('0x1a')]['field'],{'where':{'id':_0x31a461['body']['id']}})[_0xd738('0xb')](function(_0x26ac73){_0x5cb337(_0x26ac73);})[_0xd738('0x16')](function(_0x256861){logger[_0xd738('0x11')](_0xd738('0x38'),_0x256861[_0xd738('0x14')]);_0x3cdcf8(_0xc78a00[_0xd738('0x11')](0x1f4,_0x256861[_0xd738('0x14')]));});});}; \ No newline at end of file +var _0x03a9=['error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','findOne','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','CmHopperAdditionalPhone','dialGlobalMaxRetry','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','isNil','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5bc27a,_0x32e2d1){var _0x2c8a4d=function(_0x1a7dd9){while(--_0x1a7dd9){_0x5bc27a['push'](_0x5bc27a['shift']());}};_0x2c8a4d(++_0x32e2d1);}(_0x03a9,0x10d));var _0x903a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x03a9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x903a('0x0'));var util=require(_0x903a('0x1'));var moment=require('moment');var BPromise=require(_0x903a('0x2'));var rs=require(_0x903a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x903a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x903a('0x5'))('rpc');var config=require(_0x903a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x903a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40fbe8,_0x1aebea,_0x4c5dd0){return new BPromise(function(_0x3b2995,_0x71fd20){return client[_0x903a('0x8')](_0x40fbe8,_0x4c5dd0)[_0x903a('0x9')](function(_0x19ba5b){logger[_0x903a('0xa')](_0x903a('0xb'),_0x1aebea,'request\x20sent');logger[_0x903a('0xc')](_0x903a('0xd'),_0x1aebea,_0x903a('0xe'),JSON[_0x903a('0xf')](_0x19ba5b));if(_0x19ba5b['error']){if(_0x19ba5b[_0x903a('0x10')][_0x903a('0x11')]===0x1f4){logger['error'](_0x903a('0xb'),_0x1aebea,_0x19ba5b[_0x903a('0x10')]['message']);return _0x71fd20(_0x19ba5b['error'][_0x903a('0x12')]);}logger[_0x903a('0x10')](_0x903a('0xb'),_0x1aebea,_0x19ba5b[_0x903a('0x10')][_0x903a('0x12')]);return _0x3b2995(_0x19ba5b[_0x903a('0x10')]['message']);}else{logger[_0x903a('0xa')](_0x903a('0xb'),_0x1aebea,_0x903a('0xe'));_0x3b2995(_0x19ba5b[_0x903a('0x13')][_0x903a('0x12')]);}})[_0x903a('0x14')](function(_0x5837ee){logger[_0x903a('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1aebea,_0x5837ee);_0x71fd20(_0x5837ee);});});}exports[_0x903a('0x15')]=function(_0x3b01ec){var _0x2ee782=this;return new Promise(function(_0xa35be9,_0x3ccaf4){return db[_0x903a('0x16')]['findOne']({'raw':!![],'where':{'ContactId':_0x3b01ec[_0x903a('0x17')][_0x903a('0x18')],'ListId':_0x3b01ec['body'][_0x903a('0x19')],'VoiceQueueId':_0x3b01ec[_0x903a('0x17')][_0x903a('0x1a')]===undefined?null:_0x3b01ec[_0x903a('0x17')][_0x903a('0x1a')],'CampaignId':_0x3b01ec[_0x903a('0x17')][_0x903a('0x1b')]===undefined?null:_0x3b01ec[_0x903a('0x17')]['CampaignId']}})[_0x903a('0x9')](function(_0x4c2f70){if(_0x4c2f70!=null){return db['CmHopperAdditionalPhone'][_0x903a('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x4c2f70['id'],'OrderBy':{'$gt':_0x4c2f70[_0x903a('0x1d')]}},'order':[[_0x903a('0x1d'),_0x903a('0x1e')]]})[_0x903a('0x9')](function(_0x10189b){var _0x3bc754=0x0;if(_0x10189b){if(_0x10189b[_0x903a('0x1f')]+_0x10189b[_0x903a('0x20')]+_0x10189b[_0x903a('0x21')]+_0x10189b[_0x903a('0x22')]+_0x10189b[_0x903a('0x23')]+_0x10189b[_0x903a('0x24')]+_0x10189b[_0x903a('0x25')]+_0x10189b[_0x903a('0x26')]<_0x3b01ec[_0x903a('0x27')]['dialGlobalMaxRetry'])_0x3bc754=0x1;_0xa35be9({'additional':_0x3bc754});}else{return db[_0x903a('0x28')][_0x903a('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x4c2f70['id']},'order':[[_0x903a('0x1d'),_0x903a('0x1e')]]})[_0x903a('0x9')](function(_0x32dee7){var _0x252967=0x0;if(_0x32dee7){if(_0x32dee7['countbusyretry']+_0x32dee7[_0x903a('0x20')]+_0x32dee7[_0x903a('0x21')]+_0x32dee7['countnosuchnumberretry']+_0x32dee7[_0x903a('0x23')]+_0x32dee7[_0x903a('0x24')]+_0x32dee7[_0x903a('0x25')]+_0x32dee7[_0x903a('0x26')]<_0x3b01ec[_0x903a('0x27')][_0x903a('0x29')])_0x252967=0x1;_0xa35be9({'additional':_0x252967});}else{_0xa35be9({'additional':0x0});}})[_0x903a('0x14')](function(_0xd16193){logger[_0x903a('0x10')](_0x903a('0x15'),_0xd16193[_0x903a('0x12')]);_0x3ccaf4(_0x2ee782[_0x903a('0x10')](0x1f4,_0xd16193['message']));});}})[_0x903a('0x14')](function(_0x151bc8){logger[_0x903a('0x10')](_0x903a('0x15'),_0x151bc8[_0x903a('0x12')]);_0x3ccaf4(_0x2ee782[_0x903a('0x10')](0x1f4,_0x151bc8['message']));});}else _0xa35be9({'additional':0x0});});});};exports[_0x903a('0x2a')]=function(_0x35499a){var _0x1abf74=this;return new Promise(function(_0x15450c,_0x518052){return db[_0x903a('0x16')][_0x903a('0x1c')]({'raw':!![],'where':{'ContactId':_0x35499a[_0x903a('0x17')][_0x903a('0x18')],'ListId':_0x35499a['body'][_0x903a('0x19')],'VoiceQueueId':_0x35499a[_0x903a('0x17')][_0x903a('0x1a')]===undefined?null:_0x35499a['body'][_0x903a('0x1a')],'CampaignId':_0x35499a[_0x903a('0x17')]['CampaignId']===undefined?null:_0x35499a[_0x903a('0x17')][_0x903a('0x1b')]}})[_0x903a('0x9')](function(_0x5cc939){if(_0x5cc939!=null){return db['CmHopperAdditionalPhone'][_0x903a('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x5cc939['id'],'OrderBy':{'$gte':_0x5cc939[_0x903a('0x1d')]}},'order':[[_0x903a('0x1d'),'ASC']]})[_0x903a('0x9')](function(_0x454421){if(_0x454421)return activateAdditionalPhone(_0x5cc939,_0x35499a[_0x903a('0x17')],_0x454421,_0x35499a[_0x903a('0x2b')],_0x35499a[_0x903a('0x2c')])['then'](function(_0x5ddc95){_0x15450c(_0x5ddc95);});else{return db[_0x903a('0x28')][_0x903a('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x5cc939['id']},'order':[[_0x903a('0x1d'),_0x903a('0x1e')]]})[_0x903a('0x9')](function(_0x53a785){if(_0x53a785)return activateAdditionalPhone(_0x5cc939,_0x35499a[_0x903a('0x17')],_0x53a785,_0x35499a[_0x903a('0x2b')],_0x35499a[_0x903a('0x2c')])[_0x903a('0x9')](function(_0x4655ad){_0x15450c(_0x4655ad);});else{_0x15450c({'id':_0x5cc939['id'],'phone':''});}})[_0x903a('0x14')](function(_0x125e54){logger[_0x903a('0x10')]('VerifyAdditionalPhones',_0x125e54['message']);_0x518052(_0x1abf74[_0x903a('0x10')](0x1f4,_0x125e54[_0x903a('0x12')]));});}})['catch'](function(_0x51dd02){logger[_0x903a('0x10')](_0x903a('0x15'),_0x51dd02[_0x903a('0x12')]);_0x518052(_0x1abf74[_0x903a('0x10')](0x1f4,_0x51dd02[_0x903a('0x12')]));});}else _0x15450c(0x1);});});};function activateAdditionalPhone(_0xd3207f,_0xbd7bbc,_0x293850,_0x25e697,_0x4aaaec){return new Promise(function(_0x3119fc,_0x214e11){var _0xaeffa9;if(_['isNil'](_0x293850[_0x903a('0x2d')])){_0x293850[_0x903a('0x2d')]=moment();}if(moment()>moment(_0x293850[_0x903a('0x2d')])){_0xaeffa9=moment()[_0x903a('0x2e')](_0x4aaaec||0x3,'minutes');}else{if(_0x293850[_0x903a('0x1d')]==0x0){_0xaeffa9=moment(_0x293850[_0x903a('0x2d')]);}else{_0xaeffa9=moment()[_0x903a('0x2e')](_0x4aaaec||0x3,_0x903a('0x2f'));}}if(_[_0x903a('0x30')](_0xaeffa9)){_0xaeffa9=moment()['add'](_0x4aaaec||0x3,_0x903a('0x2f'));}var _0x1ca3d5={'phone':_0xd3207f[_0x903a('0x31')],'active':0x0,'OrderBy':_[_0x903a('0x30')](_0xd3207f[_0x903a('0x1d')])?0x0:_0xd3207f[_0x903a('0x1d')],'scheduledat':moment()[_0x903a('0x2e')](_0x25e697||0x1,'minutes'),'countbusyretry':_0xbd7bbc[_0x903a('0x1f')],'countcongestionretry':_0xbd7bbc['countcongestionretry'],'countnoanswerretry':_0xbd7bbc[_0x903a('0x21')],'countnosuchnumberretry':_0xbd7bbc['countnosuchnumberretry'],'countdropretry':_0xbd7bbc[_0x903a('0x23')],'countabandonedretry':_0xbd7bbc['countabandonedretry'],'countmachineretry':_0xbd7bbc[_0x903a('0x25')],'countagentrejectretry':_0xbd7bbc[_0x903a('0x26')],'createdAt':_0xbd7bbc[_0x903a('0x32')],'updatedAt':_0xbd7bbc[_0x903a('0x33')]};var _0x54a34e={'CmHopperId':_0xd3207f['id'],'phone':_0x293850[_0x903a('0x31')],'active':0x0,'OrderBy':_[_0x903a('0x30')](_0x293850[_0x903a('0x1d')])?0x0:_0x293850[_0x903a('0x1d')],'scheduledat':_0xaeffa9,'countbusyretry':_0x293850['countbusyretry'],'countcongestionretry':_0x293850[_0x903a('0x20')],'countnoanswerretry':_0x293850[_0x903a('0x21')],'countnosuchnumberretry':_0x293850[_0x903a('0x22')],'countdropretry':_0x293850[_0x903a('0x23')],'countabandonedretry':_0x293850['countabandonedretry'],'countmachineretry':_0x293850[_0x903a('0x25')],'countagentrejectretry':_0x293850['countagentrejectretry'],'createdAt':_0x293850[_0x903a('0x32')],'updatedAt':_0x293850[_0x903a('0x33')]};return db[_0x903a('0x34')][_0x903a('0x35')](function(_0x3d8be6){return db[_0x903a('0x28')]['update'](_0x1ca3d5,{'where':{'id':_0x293850['id']}},{'transaction':_0x3d8be6})[_0x903a('0x9')](function(){return db['CmHopper'][_0x903a('0x36')](_0x54a34e,{'where':{'id':_0xd3207f['id']}},{'transaction':_0x3d8be6});});})[_0x903a('0x9')](function(_0x59bdd6){_0x3119fc({'id':_0xd3207f['id'],'phone':_0x293850[_0x903a('0x31')]});})['catch'](function(_0x4235af){logger[_0x903a('0x10')](_0x903a('0x37'),_0x4235af[_0x903a('0x12')]);_0x214e11({'error':_0x4235af['message']});});});}exports['IncrementPreviewCounters']=function(_0x2e5314){var _0x7fa776=this;return new Promise(function(_0x2d8790,_0x4000df){return db[_0x903a('0x16')]['update'](_0x2e5314[_0x903a('0x17')]['field'],{'where':{'id':_0x2e5314[_0x903a('0x17')]['id']}})[_0x903a('0x9')](function(_0x40b51e){_0x2d8790(_0x40b51e);})['catch'](function(_0x1c7a36){logger[_0x903a('0x10')](_0x903a('0x38'),_0x1c7a36[_0x903a('0x12')]);_0x4000df(_0x7fa776['error'](0x1f4,_0x1c7a36['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 58499d8..e8fb8a0 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 _0xee1e=['./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xee1e,0x109));var _0xeee1=function(_0xf2726b,_0x87deb7){_0xf2726b=_0xf2726b-0x0;var _0xa61a5=_0xee1e[_0xf2726b];return _0xa61a5;};'use strict';var multer=require(_0xeee1('0x0'));var util=require('util');var path=require(_0xeee1('0x1'));var timeout=require(_0xeee1('0x2'));var express=require(_0xeee1('0x3'));var router=express[_0xeee1('0x4')]();var fs_extra=require(_0xeee1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xeee1('0x6'));var config=require(_0xeee1('0x7'));var controller=require(_0xeee1('0x8'));router[_0xeee1('0x9')]('/',auth[_0xeee1('0xa')](),controller[_0xeee1('0xb')]);router[_0xeee1('0x9')](_0xeee1('0xc'),auth[_0xeee1('0xa')](),controller[_0xeee1('0xd')]);router[_0xeee1('0xe')]('/',auth['isAuthenticated'](),controller[_0xeee1('0xf')]);router[_0xeee1('0x10')](_0xeee1('0xc'),auth[_0xeee1('0xa')](),controller[_0xeee1('0x11')]);router[_0xeee1('0x12')](_0xeee1('0xc'),auth[_0xeee1('0xa')](),controller[_0xeee1('0x13')]);module[_0xeee1('0x14')]=router; \ No newline at end of file +var _0x3c2c=['get','isAuthenticated','index','/:id','create','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x37fc4c,_0x1927e1){var _0x693c96=function(_0x41ccad){while(--_0x41ccad){_0x37fc4c['push'](_0x37fc4c['shift']());}};_0x693c96(++_0x1927e1);}(_0x3c2c,0x160));var _0xc3c2=function(_0xd0cbb6,_0x3e80ea){_0xd0cbb6=_0xd0cbb6-0x0;var _0x17fd88=_0x3c2c[_0xd0cbb6];return _0x17fd88;};'use strict';var multer=require(_0xc3c2('0x0'));var util=require(_0xc3c2('0x1'));var path=require(_0xc3c2('0x2'));var timeout=require(_0xc3c2('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc3c2('0x4'));var auth=require(_0xc3c2('0x5'));var interaction=require(_0xc3c2('0x6'));var config=require(_0xc3c2('0x7'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0xc3c2('0x8')]('/',auth[_0xc3c2('0x9')](),controller[_0xc3c2('0xa')]);router[_0xc3c2('0x8')](_0xc3c2('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xc3c2('0x9')](),controller[_0xc3c2('0xc')]);router['put'](_0xc3c2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xc3c2('0xd')](_0xc3c2('0xb'),auth[_0xc3c2('0x9')](),controller['destroy']);module[_0xc3c2('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index d0e5821..de6762d 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 _0xe93a=['sequelize','INTEGER','contactListQueue','moment'];(function(_0x7bcc6,_0x390d26){var _0x368bcb=function(_0x13a30f){while(--_0x13a30f){_0x7bcc6['push'](_0x7bcc6['shift']());}};_0x368bcb(++_0x390d26);}(_0xe93a,0x1a7));var _0xae93=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xe93a[_0x3e5086];return _0xfeb102;};'use strict';var moment=require(_0xae93('0x0'));var Sequelize=require(_0xae93('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xae93('0x2')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xae93('0x2')],'unique':_0xae93('0x3')}}; \ No newline at end of file +var _0x3663=['exports','INTEGER','contactListQueue','moment','sequelize'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3663,0x1cf));var _0x3366=function(_0x2d6e76,_0x3684f0){_0x2d6e76=_0x2d6e76-0x0;var _0x4f651b=_0x3663[_0x2d6e76];return _0x4f651b;};'use strict';var moment=require(_0x3366('0x0'));var Sequelize=require(_0x3366('0x1'));module[_0x3366('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x3366('0x3')],'unique':_0x3366('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x3366('0x4')},'VoiceQueueId':{'type':Sequelize[_0x3366('0x3')],'unique':_0x3366('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 405a258..bdb10f1 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 _0xd7c8=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','apply','then','destroy','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','count','include','rows','catch','show','params','intersection','includeAll','update','body','find','describe','eml-format','fast-json-patch','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x2baa8a,_0xe97a01){var _0x122170=function(_0x5e549d){while(--_0x5e549d){_0x2baa8a['push'](_0x2baa8a['shift']());}};_0x122170(++_0xe97a01);}(_0xd7c8,0x17a));var _0x8d7c=function(_0x3bbc95,_0x7414d8){_0x3bbc95=_0x3bbc95-0x0;var _0x36808b=_0xd7c8[_0x3bbc95];return _0x36808b;};'use strict';var emlformat=require(_0x8d7c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8d7c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8d7c('0x2'));var path=require('path');var sox=require(_0x8d7c('0x3'));var csv=require(_0x8d7c('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8d7c('0x5'));var _=require(_0x8d7c('0x6'));var squel=require('squel');var crypto=require(_0x8d7c('0x7'));var jsforce=require(_0x8d7c('0x8'));var deskjs=require(_0x8d7c('0x9'));var toCsv=require(_0x8d7c('0x4'));var querystring=require(_0x8d7c('0xa'));var Papa=require(_0x8d7c('0xb'));var Redis=require(_0x8d7c('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x8d7c('0xd'));var as=require(_0x8d7c('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8d7c('0xf'));var config=require(_0x8d7c('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x8d7c('0x11'))['db'];function respondWithStatusCode(_0x58ee87,_0x2d5d1d){_0x2d5d1d=_0x2d5d1d||0xcc;return function(_0x221993){if(_0x221993){return _0x58ee87[_0x8d7c('0x12')](_0x2d5d1d);}return _0x58ee87[_0x8d7c('0x13')](_0x2d5d1d)[_0x8d7c('0x14')]();};}function respondWithResult(_0x6d8a37,_0x3d79d1){_0x3d79d1=_0x3d79d1||0xc8;return function(_0x24498a){if(_0x24498a){return _0x6d8a37['status'](_0x3d79d1)[_0x8d7c('0x15')](_0x24498a);}};}function respondWithFilteredResult(_0x4b42bf,_0x5417df){return function(_0x576b43){if(_0x576b43){var _0x5d32ad=typeof _0x5417df['offset']==='undefined'&&typeof _0x5417df[_0x8d7c('0x16')]===_0x8d7c('0x17');var _0x62abc2=_0x576b43['count'];var _0x7bde5e=_0x5d32ad?0x0:_0x5417df[_0x8d7c('0x18')];var _0x101c24=_0x5d32ad?_0x576b43['count']:_0x5417df[_0x8d7c('0x18')]+_0x5417df[_0x8d7c('0x16')];var _0x57ce87;if(_0x101c24>=_0x62abc2){_0x101c24=_0x62abc2;_0x57ce87=0xc8;}else{_0x57ce87=0xce;}_0x4b42bf[_0x8d7c('0x13')](_0x57ce87);return _0x4b42bf[_0x8d7c('0x19')](_0x8d7c('0x1a'),_0x7bde5e+'-'+_0x101c24+'/'+_0x62abc2)['json'](_0x576b43);}return null;};}function patchUpdates(_0x16a793){return function(_0x35f456){try{jsonpatch[_0x8d7c('0x1b')](_0x35f456,_0x16a793,!![]);}catch(_0x1d891b){return BPromise['reject'](_0x1d891b);}return _0x35f456['save']();};}function saveUpdates(_0x4d67a3,_0x3bade4){return function(_0x26708d){if(_0x26708d){return _0x26708d['update'](_0x4d67a3)[_0x8d7c('0x1c')](function(_0x87ffbe){return _0x87ffbe;});}return null;};}function removeEntity(_0x857d51,_0x5a362b){return function(_0x31c9f7){if(_0x31c9f7){return _0x31c9f7[_0x8d7c('0x1d')]()['then'](function(){_0x857d51[_0x8d7c('0x13')](0xcc)[_0x8d7c('0x14')]();});}};}function handleEntityNotFound(_0x554c52,_0x219fbf){return function(_0x3e3e2e){if(!_0x3e3e2e){_0x554c52[_0x8d7c('0x12')](0x194);}return _0x3e3e2e;};}function handleError(_0x3ebf85,_0x3ac330){_0x3ac330=_0x3ac330||0x1f4;return function(_0x50edf2){logger['error'](_0x50edf2[_0x8d7c('0x1e')]);if(_0x50edf2['name']){delete _0x50edf2[_0x8d7c('0x1f')];}_0x3ebf85[_0x8d7c('0x13')](_0x3ac330)[_0x8d7c('0x20')](_0x50edf2);};}exports[_0x8d7c('0x21')]=function(_0x2884f5,_0x3caa99){var _0x1a2b41={},_0x80a065={},_0x4eff05={'count':0x0,'rows':[]};var _0x5d96d3=_[_0x8d7c('0x22')](db[_0x8d7c('0x23')][_0x8d7c('0x24')],function(_0x3253ef){return{'name':_0x3253ef[_0x8d7c('0x25')],'type':_0x3253ef[_0x8d7c('0x26')]['key']};});_0x80a065['model']=_[_0x8d7c('0x22')](_0x5d96d3,_0x8d7c('0x1f'));_0x80a065[_0x8d7c('0x27')]=_[_0x8d7c('0x28')](_0x2884f5[_0x8d7c('0x27')]);_0x80a065[_0x8d7c('0x29')]=_['intersection'](_0x80a065[_0x8d7c('0x2a')],_0x80a065[_0x8d7c('0x27')]);_0x1a2b41[_0x8d7c('0x2b')]=_['intersection'](_0x80a065[_0x8d7c('0x2a')],qs[_0x8d7c('0x2c')](_0x2884f5[_0x8d7c('0x27')]['fields']));_0x1a2b41[_0x8d7c('0x2b')]=_0x1a2b41[_0x8d7c('0x2b')][_0x8d7c('0x2d')]?_0x1a2b41[_0x8d7c('0x2b')]:_0x80a065[_0x8d7c('0x2a')];if(!_0x2884f5['query'][_0x8d7c('0x2e')]('nolimit')){_0x1a2b41['limit']=qs[_0x8d7c('0x16')](_0x2884f5[_0x8d7c('0x27')][_0x8d7c('0x16')]);_0x1a2b41[_0x8d7c('0x18')]=qs['offset'](_0x2884f5[_0x8d7c('0x27')][_0x8d7c('0x18')]);}_0x1a2b41[_0x8d7c('0x2f')]=qs['sort'](_0x2884f5[_0x8d7c('0x27')][_0x8d7c('0x30')]);_0x1a2b41[_0x8d7c('0x31')]=qs[_0x8d7c('0x29')](_['pick'](_0x2884f5[_0x8d7c('0x27')],_0x80a065[_0x8d7c('0x29')]),_0x5d96d3);if(_0x2884f5[_0x8d7c('0x27')][_0x8d7c('0x32')]){_0x1a2b41[_0x8d7c('0x31')]=_['merge'](_0x1a2b41[_0x8d7c('0x31')],{'$or':_[_0x8d7c('0x22')](_0x5d96d3,function(_0xaca38a){if(_0xaca38a['type']!=='VIRTUAL'){var _0x49c150={};_0x49c150[_0xaca38a[_0x8d7c('0x1f')]]={'$like':'%'+_0x2884f5['query']['filter']+'%'};return _0x49c150;}})});}_0x1a2b41=_[_0x8d7c('0x33')]({},_0x1a2b41,_0x2884f5[_0x8d7c('0x34')]);var _0x592eb0={'where':_0x1a2b41[_0x8d7c('0x31')]};return db['CmHopperBlack'][_0x8d7c('0x35')](_0x592eb0)['then'](function(_0x33b598){_0x4eff05[_0x8d7c('0x35')]=_0x33b598;if(_0x2884f5[_0x8d7c('0x27')]['includeAll']){_0x1a2b41[_0x8d7c('0x36')]=[{'all':!![]}];}return db[_0x8d7c('0x23')]['findAll'](_0x1a2b41);})[_0x8d7c('0x1c')](function(_0x57fde5){_0x4eff05[_0x8d7c('0x37')]=_0x57fde5;return _0x4eff05;})['then'](respondWithFilteredResult(_0x3caa99,_0x1a2b41))[_0x8d7c('0x38')](handleError(_0x3caa99,null));};exports[_0x8d7c('0x39')]=function(_0x415c39,_0x1df110){var _0x154024={'raw':!![],'where':{'id':_0x415c39[_0x8d7c('0x3a')]['id']}},_0x46e150={};_0x46e150[_0x8d7c('0x2a')]=_[_0x8d7c('0x28')](db[_0x8d7c('0x23')][_0x8d7c('0x24')]);_0x46e150[_0x8d7c('0x27')]=_[_0x8d7c('0x28')](_0x415c39[_0x8d7c('0x27')]);_0x46e150['filters']=_[_0x8d7c('0x3b')](_0x46e150['model'],_0x46e150[_0x8d7c('0x27')]);_0x154024[_0x8d7c('0x2b')]=_['intersection'](_0x46e150[_0x8d7c('0x2a')],qs[_0x8d7c('0x2c')](_0x415c39[_0x8d7c('0x27')][_0x8d7c('0x2c')]));_0x154024[_0x8d7c('0x2b')]=_0x154024[_0x8d7c('0x2b')][_0x8d7c('0x2d')]?_0x154024['attributes']:_0x46e150[_0x8d7c('0x2a')];if(_0x415c39['query'][_0x8d7c('0x3c')]){_0x154024['include']=[{'all':!![]}];}_0x154024=_[_0x8d7c('0x33')]({},_0x154024,_0x415c39['options']);return db[_0x8d7c('0x23')]['find'](_0x154024)['then'](handleEntityNotFound(_0x1df110,null))[_0x8d7c('0x1c')](respondWithResult(_0x1df110,null))[_0x8d7c('0x38')](handleError(_0x1df110,null));};exports[_0x8d7c('0x3d')]=function(_0x1f10ac,_0x5004c7){if(_0x1f10ac[_0x8d7c('0x3e')]['id']){delete _0x1f10ac['body']['id'];}return db[_0x8d7c('0x23')][_0x8d7c('0x3f')]({'where':{'id':_0x1f10ac[_0x8d7c('0x3a')]['id']}})[_0x8d7c('0x1c')](handleEntityNotFound(_0x5004c7,null))[_0x8d7c('0x1c')](saveUpdates(_0x1f10ac[_0x8d7c('0x3e')],null))[_0x8d7c('0x1c')](respondWithResult(_0x5004c7,null))['catch'](handleError(_0x5004c7,null));};exports[_0x8d7c('0x1d')]=function(_0x512d8d,_0x56194a){return db['CmHopperBlack'][_0x8d7c('0x3f')]({'where':{'id':_0x512d8d[_0x8d7c('0x3a')]['id']}})[_0x8d7c('0x1c')](handleEntityNotFound(_0x56194a,null))[_0x8d7c('0x1c')](removeEntity(_0x56194a,null))[_0x8d7c('0x38')](handleError(_0x56194a,null));};exports[_0x8d7c('0x40')]=function(_0x30c45f,_0x174a5c){return db['CmHopperBlack'][_0x8d7c('0x40')]()['then'](respondWithResult(_0x174a5c,null))[_0x8d7c('0x38')](handleError(_0x174a5c,null));}; \ No newline at end of file +var _0xf69a=['../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','error','stack','name','index','map','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','CmHopperBlack','includeAll','rows','catch','show','options','find','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf69a,0x139));var _0xaf69=function(_0x597c16,_0x2292fe){_0x597c16=_0x597c16-0x0;var _0x30cc2c=_0xf69a[_0x597c16];return _0x30cc2c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaf69('0x0'));var zipdir=require(_0xaf69('0x1'));var jsonpatch=require(_0xaf69('0x2'));var rp=require(_0xaf69('0x3'));var moment=require(_0xaf69('0x4'));var BPromise=require(_0xaf69('0x5'));var Mustache=require(_0xaf69('0x6'));var util=require(_0xaf69('0x7'));var path=require(_0xaf69('0x8'));var sox=require('sox');var csv=require(_0xaf69('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaf69('0xa'));var _=require(_0xaf69('0xb'));var squel=require(_0xaf69('0xc'));var crypto=require(_0xaf69('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xaf69('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaf69('0xe'));var qs=require(_0xaf69('0xf'));var as=require(_0xaf69('0x10'));var hardwareService=require(_0xaf69('0x11'));var logger=require(_0xaf69('0x12'))(_0xaf69('0x13'));var utils=require('../../config/utils');var config=require(_0xaf69('0x14'));var licenseUtil=require(_0xaf69('0x15'));var db=require(_0xaf69('0x16'))['db'];function respondWithStatusCode(_0x4feb5c,_0x5c625f){_0x5c625f=_0x5c625f||0xcc;return function(_0x512a91){if(_0x512a91){return _0x4feb5c[_0xaf69('0x17')](_0x5c625f);}return _0x4feb5c[_0xaf69('0x18')](_0x5c625f)[_0xaf69('0x19')]();};}function respondWithResult(_0x2fdeca,_0x198bf3){_0x198bf3=_0x198bf3||0xc8;return function(_0x3a59a1){if(_0x3a59a1){return _0x2fdeca[_0xaf69('0x18')](_0x198bf3)[_0xaf69('0x1a')](_0x3a59a1);}};}function respondWithFilteredResult(_0x5808eb,_0x4ca5ba){return function(_0x152356){if(_0x152356){var _0x2c2825=typeof _0x4ca5ba[_0xaf69('0x1b')]==='undefined'&&typeof _0x4ca5ba[_0xaf69('0x1c')]===_0xaf69('0x1d');var _0x2333c5=_0x152356[_0xaf69('0x1e')];var _0x4b99f9=_0x2c2825?0x0:_0x4ca5ba[_0xaf69('0x1b')];var _0x51f1c8=_0x2c2825?_0x152356[_0xaf69('0x1e')]:_0x4ca5ba[_0xaf69('0x1b')]+_0x4ca5ba[_0xaf69('0x1c')];var _0x25b917;if(_0x51f1c8>=_0x2333c5){_0x51f1c8=_0x2333c5;_0x25b917=0xc8;}else{_0x25b917=0xce;}_0x5808eb['status'](_0x25b917);return _0x5808eb['set'](_0xaf69('0x1f'),_0x4b99f9+'-'+_0x51f1c8+'/'+_0x2333c5)[_0xaf69('0x1a')](_0x152356);}return null;};}function patchUpdates(_0x46ec80){return function(_0x251df3){try{jsonpatch[_0xaf69('0x20')](_0x251df3,_0x46ec80,!![]);}catch(_0x1f7529){return BPromise[_0xaf69('0x21')](_0x1f7529);}return _0x251df3['save']();};}function saveUpdates(_0x37052d,_0x5be2c5){return function(_0x5d9f78){if(_0x5d9f78){return _0x5d9f78[_0xaf69('0x22')](_0x37052d)[_0xaf69('0x23')](function(_0x16fb7d){return _0x16fb7d;});}return null;};}function removeEntity(_0x4636a3,_0x166ed0){return function(_0x3084a6){if(_0x3084a6){return _0x3084a6['destroy']()[_0xaf69('0x23')](function(){_0x4636a3[_0xaf69('0x18')](0xcc)[_0xaf69('0x19')]();});}};}function handleEntityNotFound(_0x21fa8c,_0xf15f50){return function(_0x26e168){if(!_0x26e168){_0x21fa8c[_0xaf69('0x17')](0x194);}return _0x26e168;};}function handleError(_0x4a9288,_0x481440){_0x481440=_0x481440||0x1f4;return function(_0x10b111){logger[_0xaf69('0x24')](_0x10b111[_0xaf69('0x25')]);if(_0x10b111[_0xaf69('0x26')]){delete _0x10b111[_0xaf69('0x26')];}_0x4a9288[_0xaf69('0x18')](_0x481440)['send'](_0x10b111);};}exports[_0xaf69('0x27')]=function(_0x3534e4,_0x16401d){var _0x4563b3={},_0x5386cd={},_0xb7ec2={'count':0x0,'rows':[]};var _0x6ec98f=_[_0xaf69('0x28')](db['CmHopperBlack'][_0xaf69('0x29')],function(_0x3e0f5d){return{'name':_0x3e0f5d['fieldName'],'type':_0x3e0f5d[_0xaf69('0x2a')][_0xaf69('0x2b')]};});_0x5386cd['model']=_[_0xaf69('0x28')](_0x6ec98f,'name');_0x5386cd[_0xaf69('0x2c')]=_[_0xaf69('0x2d')](_0x3534e4[_0xaf69('0x2c')]);_0x5386cd['filters']=_[_0xaf69('0x2e')](_0x5386cd[_0xaf69('0x2f')],_0x5386cd['query']);_0x4563b3[_0xaf69('0x30')]=_[_0xaf69('0x2e')](_0x5386cd[_0xaf69('0x2f')],qs[_0xaf69('0x31')](_0x3534e4[_0xaf69('0x2c')][_0xaf69('0x31')]));_0x4563b3[_0xaf69('0x30')]=_0x4563b3[_0xaf69('0x30')][_0xaf69('0x32')]?_0x4563b3['attributes']:_0x5386cd['model'];if(!_0x3534e4[_0xaf69('0x2c')]['hasOwnProperty'](_0xaf69('0x33'))){_0x4563b3[_0xaf69('0x1c')]=qs[_0xaf69('0x1c')](_0x3534e4[_0xaf69('0x2c')][_0xaf69('0x1c')]);_0x4563b3[_0xaf69('0x1b')]=qs['offset'](_0x3534e4[_0xaf69('0x2c')][_0xaf69('0x1b')]);}_0x4563b3[_0xaf69('0x34')]=qs[_0xaf69('0x35')](_0x3534e4[_0xaf69('0x2c')][_0xaf69('0x35')]);_0x4563b3[_0xaf69('0x36')]=qs['filters'](_['pick'](_0x3534e4[_0xaf69('0x2c')],_0x5386cd[_0xaf69('0x37')]),_0x6ec98f);if(_0x3534e4[_0xaf69('0x2c')][_0xaf69('0x38')]){_0x4563b3['where']=_[_0xaf69('0x39')](_0x4563b3[_0xaf69('0x36')],{'$or':_[_0xaf69('0x28')](_0x6ec98f,function(_0x3ddcf0){if(_0x3ddcf0[_0xaf69('0x2a')]!=='VIRTUAL'){var _0x366d8b={};_0x366d8b[_0x3ddcf0[_0xaf69('0x26')]]={'$like':'%'+_0x3534e4['query'][_0xaf69('0x38')]+'%'};return _0x366d8b;}})});}_0x4563b3=_[_0xaf69('0x39')]({},_0x4563b3,_0x3534e4['options']);var _0x1c03b6={'where':_0x4563b3[_0xaf69('0x36')]};return db[_0xaf69('0x3a')]['count'](_0x1c03b6)[_0xaf69('0x23')](function(_0x13f113){_0xb7ec2['count']=_0x13f113;if(_0x3534e4[_0xaf69('0x2c')][_0xaf69('0x3b')]){_0x4563b3['include']=[{'all':!![]}];}return db[_0xaf69('0x3a')]['findAll'](_0x4563b3);})[_0xaf69('0x23')](function(_0x9f0799){_0xb7ec2[_0xaf69('0x3c')]=_0x9f0799;return _0xb7ec2;})['then'](respondWithFilteredResult(_0x16401d,_0x4563b3))[_0xaf69('0x3d')](handleError(_0x16401d,null));};exports[_0xaf69('0x3e')]=function(_0x79fd51,_0x18b661){var _0x1436b1={'raw':!![],'where':{'id':_0x79fd51['params']['id']}},_0x26c8ca={};_0x26c8ca[_0xaf69('0x2f')]=_[_0xaf69('0x2d')](db[_0xaf69('0x3a')][_0xaf69('0x29')]);_0x26c8ca[_0xaf69('0x2c')]=_[_0xaf69('0x2d')](_0x79fd51[_0xaf69('0x2c')]);_0x26c8ca[_0xaf69('0x37')]=_[_0xaf69('0x2e')](_0x26c8ca['model'],_0x26c8ca['query']);_0x1436b1[_0xaf69('0x30')]=_[_0xaf69('0x2e')](_0x26c8ca[_0xaf69('0x2f')],qs['fields'](_0x79fd51[_0xaf69('0x2c')][_0xaf69('0x31')]));_0x1436b1[_0xaf69('0x30')]=_0x1436b1[_0xaf69('0x30')]['length']?_0x1436b1[_0xaf69('0x30')]:_0x26c8ca[_0xaf69('0x2f')];if(_0x79fd51['query'][_0xaf69('0x3b')]){_0x1436b1['include']=[{'all':!![]}];}_0x1436b1=_['merge']({},_0x1436b1,_0x79fd51[_0xaf69('0x3f')]);return db[_0xaf69('0x3a')][_0xaf69('0x40')](_0x1436b1)[_0xaf69('0x23')](handleEntityNotFound(_0x18b661,null))[_0xaf69('0x23')](respondWithResult(_0x18b661,null))[_0xaf69('0x3d')](handleError(_0x18b661,null));};exports[_0xaf69('0x22')]=function(_0x105817,_0x32adaf){if(_0x105817[_0xaf69('0x41')]['id']){delete _0x105817[_0xaf69('0x41')]['id'];}return db[_0xaf69('0x3a')][_0xaf69('0x40')]({'where':{'id':_0x105817[_0xaf69('0x42')]['id']}})[_0xaf69('0x23')](handleEntityNotFound(_0x32adaf,null))['then'](saveUpdates(_0x105817[_0xaf69('0x41')],null))[_0xaf69('0x23')](respondWithResult(_0x32adaf,null))[_0xaf69('0x3d')](handleError(_0x32adaf,null));};exports['destroy']=function(_0x1bbe17,_0x4b49be){return db[_0xaf69('0x3a')][_0xaf69('0x40')]({'where':{'id':_0x1bbe17[_0xaf69('0x42')]['id']}})['then'](handleEntityNotFound(_0x4b49be,null))['then'](removeEntity(_0x4b49be,null))[_0xaf69('0x3d')](handleError(_0x4b49be,null));};exports['describe']=function(_0x1f998e,_0x4a2779){return db[_0xaf69('0x3a')]['describe']()['then'](respondWithResult(_0x4a2779,null))['catch'](handleError(_0x4a2779,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 2cc3d4e..45f8e55 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 _0x0762=['cm_hopper_black','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack'];(function(_0x20a595,_0x41e668){var _0x283506=function(_0x4913d5){while(--_0x4913d5){_0x20a595['push'](_0x20a595['shift']());}};_0x283506(++_0x41e668);}(_0x0762,0x1bd));var _0x2076=function(_0x41c394,_0x32e672){_0x41c394=_0x41c394-0x0;var _0x521e71=_0x0762[_0x41c394];return _0x521e71;};'use strict';var _=require(_0x2076('0x0'));var util=require('util');var logger=require(_0x2076('0x1'))(_0x2076('0x2'));var moment=require(_0x2076('0x3'));var BPromise=require(_0x2076('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2076('0x5'));var config=require(_0x2076('0x6'));var attributes=require(_0x2076('0x7'));module[_0x2076('0x8')]=function(_0x4d9535,_0x4e5141){return _0x4d9535[_0x2076('0x9')](_0x2076('0xa'),attributes,{'tableName':_0x2076('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x08fa=['api','moment','request-promise','path','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','lodash','util','../../config/logger'];(function(_0x39e830,_0x37a359){var _0x396d4f=function(_0x55e6c7){while(--_0x55e6c7){_0x39e830['push'](_0x39e830['shift']());}};_0x396d4f(++_0x37a359);}(_0x08fa,0x171));var _0xa08f=function(_0x1d85a2,_0x1520ff){_0x1d85a2=_0x1d85a2-0x0;var _0x322e5a=_0x08fa[_0x1d85a2];return _0x322e5a;};'use strict';var _=require(_0xa08f('0x0'));var util=require(_0xa08f('0x1'));var logger=require(_0xa08f('0x2'))(_0xa08f('0x3'));var moment=require(_0xa08f('0x4'));var BPromise=require('bluebird');var rp=require(_0xa08f('0x5'));var fs=require('fs');var path=require(_0xa08f('0x6'));var rimraf=require(_0xa08f('0x7'));var config=require('../../config/environment');var attributes=require(_0xa08f('0x8'));module[_0xa08f('0x9')]=function(_0x115f77,_0x4106e6){return _0x115f77[_0xa08f('0xa')](_0xa08f('0xb'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 7369249..a818c1f 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 _0x7a0c=['body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','update'];(function(_0x87eee5,_0x581852){var _0x17e2dc=function(_0x1122d2){while(--_0x1122d2){_0x87eee5['push'](_0x87eee5['shift']());}};_0x17e2dc(++_0x581852);}(_0x7a0c,0x180));var _0xc7a0=function(_0x49b6ee,_0x9bf387){_0x49b6ee=_0x49b6ee-0x0;var _0x3f6002=_0x7a0c[_0x49b6ee];return _0x3f6002;};'use strict';var _=require(_0xc7a0('0x0'));var util=require('util');var moment=require(_0xc7a0('0x1'));var BPromise=require('bluebird');var rs=require(_0xc7a0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc7a0('0x3'))['db'];var utils=require(_0xc7a0('0x4'));var logger=require('../../config/logger')(_0xc7a0('0x5'));var config=require(_0xc7a0('0x6'));var jayson=require(_0xc7a0('0x7'));var client=jayson['client'][_0xc7a0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4aa083,_0x495fe6,_0x3683c7){return new BPromise(function(_0x497110,_0x3125f5){return client[_0xc7a0('0x9')](_0x4aa083,_0x3683c7)[_0xc7a0('0xa')](function(_0x38f76b){logger[_0xc7a0('0xb')](_0xc7a0('0xc'),_0x495fe6,_0xc7a0('0xd'));logger[_0xc7a0('0xe')](_0xc7a0('0xf'),_0x495fe6,_0xc7a0('0xd'),JSON[_0xc7a0('0x10')](_0x38f76b));if(_0x38f76b[_0xc7a0('0x11')]){if(_0x38f76b['error'][_0xc7a0('0x12')]===0x1f4){logger[_0xc7a0('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x495fe6,_0x38f76b[_0xc7a0('0x11')][_0xc7a0('0x13')]);return _0x3125f5(_0x38f76b[_0xc7a0('0x11')][_0xc7a0('0x13')]);}logger[_0xc7a0('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x495fe6,_0x38f76b[_0xc7a0('0x11')][_0xc7a0('0x13')]);return _0x497110(_0x38f76b['error'][_0xc7a0('0x13')]);}else{logger[_0xc7a0('0xb')](_0xc7a0('0xc'),_0x495fe6,_0xc7a0('0xd'));_0x497110(_0x38f76b[_0xc7a0('0x14')][_0xc7a0('0x13')]);}})[_0xc7a0('0x15')](function(_0x382f06){logger[_0xc7a0('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x495fe6,_0x382f06);_0x3125f5(_0x382f06);});});}exports[_0xc7a0('0x16')]=function(_0x43fa64){var _0x2e8eaa=this;return new Promise(function(_0x2e2879,_0x4a5319){return db[_0xc7a0('0x17')][_0xc7a0('0x18')]({'raw':_0x43fa64[_0xc7a0('0x19')]?_0x43fa64[_0xc7a0('0x19')][_0xc7a0('0x1a')]===undefined?!![]:![]:!![],'where':_0x43fa64[_0xc7a0('0x19')]?_0x43fa64[_0xc7a0('0x19')][_0xc7a0('0x1b')]||null:null,'attributes':_0x43fa64[_0xc7a0('0x19')]?_0x43fa64[_0xc7a0('0x19')][_0xc7a0('0x1c')]||null:null,'limit':_0x43fa64[_0xc7a0('0x19')]?_0x43fa64[_0xc7a0('0x19')][_0xc7a0('0x1d')]||null:null,'include':_0x43fa64[_0xc7a0('0x19')]?_0x43fa64[_0xc7a0('0x19')][_0xc7a0('0x1e')]?_[_0xc7a0('0x1f')](_0x43fa64[_0xc7a0('0x19')][_0xc7a0('0x1e')],function(_0x3b9416){return{'model':db[_0x3b9416['model']],'as':_0x3b9416['as'],'attributes':_0x3b9416['attributes'],'include':_0x3b9416[_0xc7a0('0x1e')]?_[_0xc7a0('0x1f')](_0x3b9416[_0xc7a0('0x1e')],function(_0x11b7ae){return{'model':db[_0x11b7ae[_0xc7a0('0x20')]],'as':_0x11b7ae['as'],'attributes':_0x11b7ae['attributes'],'include':_0x11b7ae[_0xc7a0('0x1e')]?_['map'](_0x11b7ae[_0xc7a0('0x1e')],function(_0x2b23a9){return{'model':db[_0x2b23a9['model']],'as':_0x2b23a9['as'],'attributes':_0x2b23a9[_0xc7a0('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18a692){logger[_0xc7a0('0xb')](_0xc7a0('0x16'),_0x43fa64);logger['debug'](_0xc7a0('0x16'),_0x43fa64,JSON[_0xc7a0('0x10')](_0x18a692));_0x2e2879(_0x18a692);})[_0xc7a0('0x15')](function(_0xc30cb8){logger[_0xc7a0('0x11')](_0xc7a0('0x16'),_0xc30cb8[_0xc7a0('0x13')],_0x43fa64);_0x4a5319(_0x2e8eaa[_0xc7a0('0x11')](0x1f4,_0xc30cb8[_0xc7a0('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0x5af872){var _0x45ae34=this;return new Promise(function(_0x2fb450,_0x26afed){return db[_0xc7a0('0x17')][_0xc7a0('0x21')](_0x5af872[_0xc7a0('0x22')],{'raw':_0x5af872[_0xc7a0('0x19')]?_0x5af872[_0xc7a0('0x19')][_0xc7a0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5af872['options']?_0x5af872[_0xc7a0('0x19')][_0xc7a0('0x1b')]||null:null,'attributes':_0x5af872[_0xc7a0('0x19')]?_0x5af872[_0xc7a0('0x19')][_0xc7a0('0x1c')]||null:null,'limit':_0x5af872[_0xc7a0('0x19')]?_0x5af872[_0xc7a0('0x19')][_0xc7a0('0x1d')]||null:null})[_0xc7a0('0xa')](function(_0x250c89){logger[_0xc7a0('0xb')](_0xc7a0('0x23'),_0x5af872);logger['debug'](_0xc7a0('0x23'),_0x5af872,JSON[_0xc7a0('0x10')](_0x250c89));_0x2fb450(_0x250c89);})['catch'](function(_0x49f231){logger['error'](_0xc7a0('0x23'),_0x49f231[_0xc7a0('0x13')],_0x5af872);_0x26afed(_0x45ae34[_0xc7a0('0x11')](0x1f4,_0x49f231[_0xc7a0('0x13')]));});});};exports[_0xc7a0('0x24')]=function(_0x1cf0f7){var _0x413290=this;return new Promise(function(_0xca25ca,_0x1e884e){return db[_0xc7a0('0x17')][_0xc7a0('0x25')]({'where':_0x1cf0f7[_0xc7a0('0x19')]?_0x1cf0f7[_0xc7a0('0x19')][_0xc7a0('0x1b')]||null:null})[_0xc7a0('0xa')](function(_0x4116b6){logger[_0xc7a0('0xb')](_0xc7a0('0x24'),_0x1cf0f7);logger['debug']('DestroyCmHopperBlack',_0x1cf0f7,JSON['stringify'](_0x4116b6));_0xca25ca(_0x4116b6);})[_0xc7a0('0x15')](function(_0x1b7ca){logger[_0xc7a0('0x11')](_0xc7a0('0x24'),_0x1b7ca[_0xc7a0('0x13')],_0x1cf0f7);_0x1e884e(_0x413290[_0xc7a0('0x11')](0x1f4,_0x1b7ca['message']));});});}; \ No newline at end of file +var _0xd67a=['where','limit','include','map','model','attributes','UpdateCmHopperBlack','update','raw','CmHopperBlack','destroy','DestroyCmHopperBlack','lodash','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','findAll','options'];(function(_0x5df247,_0x4a3ea3){var _0x228ca8=function(_0x3dbb94){while(--_0x3dbb94){_0x5df247['push'](_0x5df247['shift']());}};_0x228ca8(++_0x4a3ea3);}(_0xd67a,0x17e));var _0xad67=function(_0x431e49,_0x2ba80b){_0x431e49=_0x431e49-0x0;var _0x452717=_0xd67a[_0x431e49];return _0x452717;};'use strict';var _=require(_0xad67('0x0'));var util=require(_0xad67('0x1'));var moment=require(_0xad67('0x2'));var BPromise=require(_0xad67('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xad67('0x4'))(_0xad67('0x5'));var config=require(_0xad67('0x6'));var jayson=require(_0xad67('0x7'));var client=jayson['client'][_0xad67('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ce6c8,_0xa21a9b,_0x41365e){return new BPromise(function(_0x47bb56,_0x55a4c2){return client[_0xad67('0x9')](_0x3ce6c8,_0x41365e)[_0xad67('0xa')](function(_0x300729){logger[_0xad67('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0xa21a9b,_0xad67('0xc'));logger[_0xad67('0xd')](_0xad67('0xe'),_0xa21a9b,_0xad67('0xc'),JSON[_0xad67('0xf')](_0x300729));if(_0x300729[_0xad67('0x10')]){if(_0x300729[_0xad67('0x10')][_0xad67('0x11')]===0x1f4){logger['error'](_0xad67('0x12'),_0xa21a9b,_0x300729[_0xad67('0x10')][_0xad67('0x13')]);return _0x55a4c2(_0x300729[_0xad67('0x10')][_0xad67('0x13')]);}logger[_0xad67('0x10')](_0xad67('0x12'),_0xa21a9b,_0x300729[_0xad67('0x10')][_0xad67('0x13')]);return _0x47bb56(_0x300729[_0xad67('0x10')][_0xad67('0x13')]);}else{logger['info'](_0xad67('0x12'),_0xa21a9b,'request\x20sent');_0x47bb56(_0x300729[_0xad67('0x14')][_0xad67('0x13')]);}})[_0xad67('0x15')](function(_0x3600e7){logger[_0xad67('0x10')](_0xad67('0x12'),_0xa21a9b,_0x3600e7);_0x55a4c2(_0x3600e7);});});}exports[_0xad67('0x16')]=function(_0x19aa85){var _0x51d187=this;return new Promise(function(_0x225154,_0x190cab){return db['CmHopperBlack'][_0xad67('0x17')]({'raw':_0x19aa85['options']?_0x19aa85[_0xad67('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x19aa85[_0xad67('0x18')]?_0x19aa85['options'][_0xad67('0x19')]||null:null,'attributes':_0x19aa85['options']?_0x19aa85[_0xad67('0x18')]['attributes']||null:null,'limit':_0x19aa85[_0xad67('0x18')]?_0x19aa85['options'][_0xad67('0x1a')]||null:null,'include':_0x19aa85['options']?_0x19aa85[_0xad67('0x18')][_0xad67('0x1b')]?_[_0xad67('0x1c')](_0x19aa85[_0xad67('0x18')]['include'],function(_0x88a08d){return{'model':db[_0x88a08d[_0xad67('0x1d')]],'as':_0x88a08d['as'],'attributes':_0x88a08d[_0xad67('0x1e')],'include':_0x88a08d[_0xad67('0x1b')]?_[_0xad67('0x1c')](_0x88a08d[_0xad67('0x1b')],function(_0x40f4ba){return{'model':db[_0x40f4ba[_0xad67('0x1d')]],'as':_0x40f4ba['as'],'attributes':_0x40f4ba[_0xad67('0x1e')],'include':_0x40f4ba[_0xad67('0x1b')]?_[_0xad67('0x1c')](_0x40f4ba[_0xad67('0x1b')],function(_0x4c759f){return{'model':db[_0x4c759f[_0xad67('0x1d')]],'as':_0x4c759f['as'],'attributes':_0x4c759f['attributes']};}):[]};}):[]};}):[]:[]})[_0xad67('0xa')](function(_0x18c531){logger[_0xad67('0xb')](_0xad67('0x16'),_0x19aa85);logger[_0xad67('0xd')](_0xad67('0x16'),_0x19aa85,JSON['stringify'](_0x18c531));_0x225154(_0x18c531);})['catch'](function(_0x23c854){logger[_0xad67('0x10')]('GetCmHopperBlack',_0x23c854['message'],_0x19aa85);_0x190cab(_0x51d187['error'](0x1f4,_0x23c854[_0xad67('0x13')]));});});};exports[_0xad67('0x1f')]=function(_0x261ce7){var _0x31b93a=this;return new Promise(function(_0x2a4b36,_0x5e6c01){return db['CmHopperBlack'][_0xad67('0x20')](_0x261ce7['body'],{'raw':_0x261ce7[_0xad67('0x18')]?_0x261ce7[_0xad67('0x18')][_0xad67('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x261ce7[_0xad67('0x18')]?_0x261ce7[_0xad67('0x18')][_0xad67('0x19')]||null:null,'attributes':_0x261ce7[_0xad67('0x18')]?_0x261ce7[_0xad67('0x18')][_0xad67('0x1e')]||null:null,'limit':_0x261ce7[_0xad67('0x18')]?_0x261ce7[_0xad67('0x18')][_0xad67('0x1a')]||null:null})[_0xad67('0xa')](function(_0x2d6723){logger[_0xad67('0xb')](_0xad67('0x1f'),_0x261ce7);logger['debug'](_0xad67('0x1f'),_0x261ce7,JSON[_0xad67('0xf')](_0x2d6723));_0x2a4b36(_0x2d6723);})[_0xad67('0x15')](function(_0x1d6968){logger[_0xad67('0x10')](_0xad67('0x1f'),_0x1d6968[_0xad67('0x13')],_0x261ce7);_0x5e6c01(_0x31b93a['error'](0x1f4,_0x1d6968[_0xad67('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x41eca1){var _0x56b772=this;return new Promise(function(_0x5e985a,_0x470041){return db[_0xad67('0x22')][_0xad67('0x23')]({'where':_0x41eca1[_0xad67('0x18')]?_0x41eca1[_0xad67('0x18')][_0xad67('0x19')]||null:null})[_0xad67('0xa')](function(_0x2f515f){logger[_0xad67('0xb')](_0xad67('0x24'),_0x41eca1);logger['debug'](_0xad67('0x24'),_0x41eca1,JSON['stringify'](_0x2f515f));_0x5e985a(_0x2f515f);})['catch'](function(_0x1cd2e0){logger['error'](_0xad67('0x24'),_0x1cd2e0[_0xad67('0x13')],_0x41eca1);_0x470041(_0x56b772[_0xad67('0x10')](0x1f4,_0x1cd2e0[_0xad67('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 78bb62a..e989ee5 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 _0x5d58=['exports','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','put','destroy'];(function(_0x558768,_0x345b81){var _0x24a624=function(_0x58fdc7){while(--_0x58fdc7){_0x558768['push'](_0x558768['shift']());}};_0x24a624(++_0x345b81);}(_0x5d58,0x187));var _0x85d5=function(_0x128aa4,_0x5c5471){_0x128aa4=_0x128aa4-0x0;var _0x2d0330=_0x5d58[_0x128aa4];return _0x2d0330;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85d5('0x0')]();var fs_extra=require(_0x85d5('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var controller=require('./cmHopperBlack.controller');router[_0x85d5('0x4')]('/',auth[_0x85d5('0x5')](),controller[_0x85d5('0x6')]);router[_0x85d5('0x4')]('/describe',auth[_0x85d5('0x5')](),controller[_0x85d5('0x7')]);router['get'](_0x85d5('0x8'),auth['isAuthenticated'](),controller[_0x85d5('0x9')]);router[_0x85d5('0xa')](_0x85d5('0x8'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x85d5('0x8'),auth[_0x85d5('0x5')](),controller[_0x85d5('0xb')]);module[_0x85d5('0xc')]=router; \ No newline at end of file +var _0x4c60=['connect-timeout','Router','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','/:id','show','update','exports','multer','util','path'];(function(_0x2d78a4,_0x362f5){var _0x38d29a=function(_0x314265){while(--_0x314265){_0x2d78a4['push'](_0x2d78a4['shift']());}};_0x38d29a(++_0x362f5);}(_0x4c60,0xc1));var _0x04c6=function(_0x56ed2e,_0x428cd7){_0x56ed2e=_0x56ed2e-0x0;var _0x1a17fc=_0x4c60[_0x56ed2e];return _0x1a17fc;};'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['describe']);router[_0x04c6('0x6')](_0x04c6('0xa'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x04c6('0xc')]);router['delete'](_0x04c6('0xa'),auth[_0x04c6('0x7')](),controller['destroy']);module[_0x04c6('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 87db2d0..3e4fed5 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 _0xf116=['followuptime','diff','seconds','BOOLEAN','sequelize','exports','STRING','INTEGER','DATE','getDataValue','endtime','setDataValue'];(function(_0x1177d2,_0x5bd3f1){var _0x360e9c=function(_0x26b342){while(--_0x26b342){_0x1177d2['push'](_0x1177d2['shift']());}};_0x360e9c(++_0x5bd3f1);}(_0xf116,0xe8));var _0x6f11=function(_0x5426e2,_0x5f2968){_0x5426e2=_0x5426e2-0x0;var _0x920dc=_0xf116[_0x5426e2];return _0x920dc;};'use strict';var Sequelize=require(_0x6f11('0x0'));var moment=require('moment');module[_0x6f11('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x6f11('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6f11('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6f11('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6f11('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x6f11('0x2')]},'originatecalleridname':{'type':Sequelize[_0x6f11('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6f11('0x2')]},'starttime':{'type':Sequelize[_0x6f11('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x6f11('0x4')]},'droptime':{'type':Sequelize[_0x6f11('0x4')]},'endtime':{'type':Sequelize[_0x6f11('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6f11('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6f11('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6f11('0x2')]},'campaign':{'type':Sequelize[_0x6f11('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6f11('0x2')]},'reason':{'type':Sequelize[_0x6f11('0x2')]},'disposition':{'type':Sequelize[_0x6f11('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6f11('0x2')]},'dispositionat':{'type':Sequelize[_0x6f11('0x4')],'set':function(_0x5773dd){var _0x61bb43=this[_0x6f11('0x5')](_0x6f11('0x6'));if(_0x61bb43&&_0x5773dd){this[_0x6f11('0x7')](_0x6f11('0x8'),moment(_0x5773dd)[_0x6f11('0x9')](moment(_0x61bb43),_0x6f11('0xa')));}}},'amd':{'type':Sequelize[_0x6f11('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6f11('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6f11('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6f11('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6f11('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6f11('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6f11('0x4')]},'recallme':{'type':Sequelize[_0x6f11('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6f11('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6f11('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6f11('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6f11('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa182=['diff','BOOLEAN','moment','INTEGER','DATE','STRING','getDataValue','endtime','setDataValue','followuptime'];(function(_0x5f371f,_0x3aecc6){var _0x4351db=function(_0x3ee39f){while(--_0x3ee39f){_0x5f371f['push'](_0x5f371f['shift']());}};_0x4351db(++_0x3aecc6);}(_0xa182,0xac));var _0x2a18=function(_0x753ab4,_0x5e7eb4){_0x753ab4=_0x753ab4-0x0;var _0x430f7f=_0xa182[_0x753ab4];return _0x430f7f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2a18('0x0'));module['exports']={'state':{'type':Sequelize[_0x2a18('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x2a18('0x2')]},'countbusyretry':{'type':Sequelize[_0x2a18('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2a18('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2a18('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x2a18('0x3')]},'originatecalleridname':{'type':Sequelize[_0x2a18('0x3')]},'calleridnum':{'type':Sequelize[_0x2a18('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x2a18('0x2')]},'responsetime':{'type':Sequelize[_0x2a18('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x2a18('0x2')]},'endtime':{'type':Sequelize[_0x2a18('0x2')]},'ringtime':{'type':Sequelize[_0x2a18('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2a18('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2a18('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x2a18('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x2a18('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2a18('0x3')]},'dispositionat':{'type':Sequelize[_0x2a18('0x2')],'set':function(_0x5901cc){var _0x16b4d0=this[_0x2a18('0x4')](_0x2a18('0x5'));if(_0x16b4d0&&_0x5901cc){this[_0x2a18('0x6')](_0x2a18('0x7'),moment(_0x5901cc)[_0x2a18('0x8')](moment(_0x16b4d0),'seconds'));}}},'amd':{'type':Sequelize[_0x2a18('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2a18('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x2a18('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x2a18('0x2')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2a18('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2a18('0x2')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x2a18('0x2')]},'recallme':{'type':Sequelize[_0x2a18('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x2a18('0x2')]},'countnosuchnumberretry':{'type':Sequelize[_0x2a18('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2a18('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2a18('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 384e866..65a6dac 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 _0x5d58=['calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','ANY_VALUE(CampaignId)','cm_hopper_final','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','then','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','CmHopperFinal','include','findAll','rows','show','params','rawAttributes','keys','length','includeAll','merge','describe','catch','body','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x5d58,0x187));var _0x85d5=function(_0x1579f0,_0x38c61a){_0x1579f0=_0x1579f0-0x0;var _0x43d283=_0x5d58[_0x1579f0];return _0x43d283;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x85d5('0x0'));var BPromise=require(_0x85d5('0x1'));var Mustache=require('mustache');var util=require(_0x85d5('0x2'));var path=require(_0x85d5('0x3'));var sox=require('sox');var csv=require(_0x85d5('0x4'));var ejs=require(_0x85d5('0x5'));var fs=require('fs');var fs_extra=require(_0x85d5('0x6'));var _=require(_0x85d5('0x7'));var squel=require('squel');var crypto=require(_0x85d5('0x8'));var jsforce=require(_0x85d5('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x85d5('0x4'));var querystring=require('querystring');var Papa=require(_0x85d5('0xa'));var Redis=require(_0x85d5('0xb'));var authService=require(_0x85d5('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85d5('0xd'))(_0x85d5('0xe'));var utils=require(_0x85d5('0xf'));var config=require(_0x85d5('0x10'));var licenseUtil=require(_0x85d5('0x11'));var db=require(_0x85d5('0x12'))['db'];function respondWithStatusCode(_0x31409d,_0x5897af){_0x5897af=_0x5897af||0xcc;return function(_0x4bbf2a){if(_0x4bbf2a){return _0x31409d['sendStatus'](_0x5897af);}return _0x31409d[_0x85d5('0x13')](_0x5897af)[_0x85d5('0x14')]();};}function respondWithResult(_0x339d4f,_0x1704f0){_0x1704f0=_0x1704f0||0xc8;return function(_0x18a20c){if(_0x18a20c){return _0x339d4f[_0x85d5('0x13')](_0x1704f0)[_0x85d5('0x15')](_0x18a20c);}};}function respondWithFilteredResult(_0x586382,_0x18e977){return function(_0x2d7c95){if(_0x2d7c95){var _0x1621ed=typeof _0x18e977[_0x85d5('0x16')]===_0x85d5('0x17')&&typeof _0x18e977[_0x85d5('0x18')]===_0x85d5('0x17');var _0x12bef9=_0x2d7c95[_0x85d5('0x19')];var _0x17acb0=_0x1621ed?0x0:_0x18e977[_0x85d5('0x16')];var _0x432bd6=_0x1621ed?_0x2d7c95[_0x85d5('0x19')]:_0x18e977[_0x85d5('0x16')]+_0x18e977[_0x85d5('0x18')];var _0x26981b;if(_0x432bd6>=_0x12bef9){_0x432bd6=_0x12bef9;_0x26981b=0xc8;}else{_0x26981b=0xce;}_0x586382[_0x85d5('0x13')](_0x26981b);return _0x586382[_0x85d5('0x1a')]('Content-Range',_0x17acb0+'-'+_0x432bd6+'/'+_0x12bef9)[_0x85d5('0x15')](_0x2d7c95);}return null;};}function patchUpdates(_0x133fa9){return function(_0x5f5755){try{jsonpatch[_0x85d5('0x1b')](_0x5f5755,_0x133fa9,!![]);}catch(_0x1264ca){return BPromise['reject'](_0x1264ca);}return _0x5f5755['save']();};}function saveUpdates(_0x347337,_0x5a1b9a){return function(_0x2f2bae){if(_0x2f2bae){return _0x2f2bae['update'](_0x347337)[_0x85d5('0x1c')](function(_0x1f8d27){return _0x1f8d27;});}return null;};}function removeEntity(_0x560b3a,_0x4e11c4){return function(_0x4da71b){if(_0x4da71b){return _0x4da71b['destroy']()[_0x85d5('0x1c')](function(){_0x560b3a[_0x85d5('0x13')](0xcc)[_0x85d5('0x14')]();});}};}function handleEntityNotFound(_0x466bbd,_0x12fea3){return function(_0xef2405){if(!_0xef2405){_0x466bbd['sendStatus'](0x194);}return _0xef2405;};}function handleError(_0x7e9a11,_0x4f8c66){_0x4f8c66=_0x4f8c66||0x1f4;return function(_0x1b3fae){logger[_0x85d5('0x1d')](_0x1b3fae[_0x85d5('0x1e')]);if(_0x1b3fae['name']){delete _0x1b3fae[_0x85d5('0x1f')];}_0x7e9a11[_0x85d5('0x13')](_0x4f8c66)[_0x85d5('0x20')](_0x1b3fae);};}exports[_0x85d5('0x21')]=function(_0x4605c5,_0x56031f){var _0x1cbef1={},_0x476c8b={},_0x330f8a={'count':0x0,'rows':[]};var _0x22a961=_[_0x85d5('0x22')](db['CmHopperFinal']['rawAttributes'],function(_0x2ce7a9){return{'name':_0x2ce7a9[_0x85d5('0x23')],'type':_0x2ce7a9[_0x85d5('0x24')][_0x85d5('0x25')]};});_0x476c8b[_0x85d5('0x26')]=_['map'](_0x22a961,_0x85d5('0x1f'));_0x476c8b[_0x85d5('0x27')]=_['keys'](_0x4605c5['query']);_0x476c8b[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x476c8b['model'],_0x476c8b[_0x85d5('0x27')]);_0x1cbef1['attributes']=_[_0x85d5('0x29')](_0x476c8b[_0x85d5('0x26')],qs['fields'](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x1cbef1[_0x85d5('0x2b')]=_0x1cbef1[_0x85d5('0x2b')]['length']?_0x1cbef1['attributes']:_0x476c8b[_0x85d5('0x26')];if(!_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2c')](_0x85d5('0x2d'))){_0x1cbef1[_0x85d5('0x18')]=qs[_0x85d5('0x18')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x18')]);_0x1cbef1[_0x85d5('0x16')]=qs['offset'](_0x4605c5['query'][_0x85d5('0x16')]);}_0x1cbef1[_0x85d5('0x2e')]=qs[_0x85d5('0x2f')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2f')]);_0x1cbef1[_0x85d5('0x30')]=qs[_0x85d5('0x28')](_[_0x85d5('0x31')](_0x4605c5['query'],_0x476c8b[_0x85d5('0x28')]),_0x22a961);if(_0x4605c5[_0x85d5('0x27')][_0x85d5('0x32')]){_0x1cbef1[_0x85d5('0x30')]=_['merge'](_0x1cbef1[_0x85d5('0x30')],{'$or':_[_0x85d5('0x22')](_0x22a961,function(_0x3282d3){if(_0x3282d3[_0x85d5('0x24')]!=='VIRTUAL'){var _0x34caed={};_0x34caed[_0x3282d3['name']]={'$like':'%'+_0x4605c5['query'][_0x85d5('0x32')]+'%'};return _0x34caed;}})});}_0x1cbef1=_['merge']({},_0x1cbef1,_0x4605c5[_0x85d5('0x33')]);var _0x5ddba7={'where':_0x1cbef1['where']};return db[_0x85d5('0x34')][_0x85d5('0x19')](_0x5ddba7)[_0x85d5('0x1c')](function(_0x1beffc){_0x330f8a[_0x85d5('0x19')]=_0x1beffc;if(_0x4605c5['query']['includeAll']){_0x1cbef1[_0x85d5('0x35')]=[{'all':!![]}];}return db[_0x85d5('0x34')][_0x85d5('0x36')](_0x1cbef1);})[_0x85d5('0x1c')](function(_0xdd8b3e){_0x330f8a[_0x85d5('0x37')]=_0xdd8b3e;return _0x330f8a;})['then'](respondWithFilteredResult(_0x56031f,_0x1cbef1))['catch'](handleError(_0x56031f,null));};exports[_0x85d5('0x38')]=function(_0x52c99b,_0xfbf466){var _0x18e94d={'raw':!![],'where':{'id':_0x52c99b[_0x85d5('0x39')]['id']}},_0x7dd430={};_0x7dd430[_0x85d5('0x26')]=_['keys'](db['CmHopperFinal'][_0x85d5('0x3a')]);_0x7dd430[_0x85d5('0x27')]=_[_0x85d5('0x3b')](_0x52c99b[_0x85d5('0x27')]);_0x7dd430[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],_0x7dd430[_0x85d5('0x27')]);_0x18e94d[_0x85d5('0x2b')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],qs[_0x85d5('0x2a')](_0x52c99b[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x18e94d[_0x85d5('0x2b')]=_0x18e94d[_0x85d5('0x2b')][_0x85d5('0x3c')]?_0x18e94d['attributes']:_0x7dd430['model'];if(_0x52c99b[_0x85d5('0x27')][_0x85d5('0x3d')]){_0x18e94d[_0x85d5('0x35')]=[{'all':!![]}];}_0x18e94d=_[_0x85d5('0x3e')]({},_0x18e94d,_0x52c99b[_0x85d5('0x33')]);return db[_0x85d5('0x34')]['find'](_0x18e94d)[_0x85d5('0x1c')](handleEntityNotFound(_0xfbf466,null))['then'](respondWithResult(_0xfbf466,null))['catch'](handleError(_0xfbf466,null));};exports[_0x85d5('0x3f')]=function(_0x13ab32,_0x12a03){return db[_0x85d5('0x34')][_0x85d5('0x3f')]()['then'](respondWithResult(_0x12a03,null))[_0x85d5('0x40')](handleError(_0x12a03,null));};exports['update']=function(_0x1f2ef9,_0xd8db57){if(_0x1f2ef9[_0x85d5('0x41')]['uniqueid']){delete _0x1f2ef9['body']['uniqueid'];}return db[_0x85d5('0x34')][_0x85d5('0x42')]({'where':{'uniqueid':_0x1f2ef9[_0x85d5('0x39')]['id']}})['then'](handleEntityNotFound(_0xd8db57,null))['then'](saveUpdates(_0x1f2ef9[_0x85d5('0x41')],null))[_0x85d5('0x1c')](respondWithResult(_0xd8db57,null))[_0x85d5('0x40')](handleError(_0xd8db57,null));};exports[_0x85d5('0x43')]=function(_0x4b2dce,_0x3f69ea,_0x29442a){return db[_0x85d5('0x34')][_0x85d5('0x36')]({'raw':![],'where':{'VoiceQueueId':_0x4b2dce[_0x85d5('0x39')]['id']},'attributes':[[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x47')))),_0x85d5('0x48')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x49')))),_0x85d5('0x4a')],[db[_0x85d5('0x44')]['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x4b')))),_0x85d5('0x4c')],[db[_0x85d5('0x44')]['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x85d5('0x4d')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x85d5('0x4e')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x4f')))),_0x85d5('0x50')],[db['sequelize']['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')]('`state`\x20=\x2022,\x201,\x20null'))),_0x85d5('0x51')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x52')))),_0x85d5('0x53')]]})['then'](handleEntityNotFound(_0x3f69ea,null))[_0x85d5('0x1c')](respondWithResult(_0x3f69ea,null))[_0x85d5('0x40')](handleError(_0x3f69ea,null));};exports[_0x85d5('0x54')]=function(_0x561bde,_0x34aa42,_0x1c3e2c){return db['CmHopperFinal'][_0x85d5('0x36')]({'raw':![],'where':{'CampaignId':_0x561bde['params']['id']},'attributes':[[db[_0x85d5('0x44')]['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x47')))),'noSuchContacts'],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x49')))),_0x85d5('0x4a')],[db[_0x85d5('0x44')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x85d5('0x44')]['literal'](_0x85d5('0x4b')))),_0x85d5('0x4c')],[db['sequelize']['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')]('`state`\x20=\x208,\x201,\x20null'))),_0x85d5('0x4d')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize']['literal'](_0x85d5('0x55')))),'dropContacts'],[db['sequelize']['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x85d5('0x50')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db['sequelize']['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x56')))),_0x85d5('0x51')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x85d5('0x53')]]})[_0x85d5('0x1c')](handleEntityNotFound(_0x34aa42,null))[_0x85d5('0x1c')](respondWithResult(_0x34aa42,null))['catch'](handleError(_0x34aa42,null));};exports[_0x85d5('0x57')]=function(_0x1fdefb,_0x496586,_0x2dbd18){return db[_0x85d5('0x58')][_0x85d5('0x42')]({'where':{'id':_0x1fdefb[_0x85d5('0x39')]['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x496586,null))['then'](function(_0x35ba15){var _0x1b96eb;if(_0x35ba15){_0x1b96eb=squel[_0x85d5('0x59')]()[_0x85d5('0x5a')](_0x85d5('0x5b'))['fromQuery']([_0x85d5('0x5c'),_0x85d5('0x5d'),_0x85d5('0x5e'),_0x85d5('0x5f'),_0x85d5('0x60'),_0x85d5('0x61'),_0x85d5('0x62')],squel[_0x85d5('0x63')]()[_0x85d5('0x64')](_0x85d5('0x65'),'phone')[_0x85d5('0x64')](_0x85d5('0x66'),_0x85d5('0x5d'))[_0x85d5('0x64')](_0x85d5('0x67'),_0x85d5('0x5e'))['field'](_0x85d5('0x68'),'ListId')['field'](_0x85d5('0x69'),_0x85d5('0x60'))[_0x85d5('0x64')](_0x85d5('0x66'),_0x85d5('0x61'))[_0x85d5('0x64')](_0x85d5('0x66'),_0x85d5('0x62'))[_0x85d5('0x6a')]('cm_hopper_final')[_0x85d5('0x30')](_0x85d5('0x6b'),_0x1fdefb[_0x85d5('0x39')]['id'][_0x85d5('0x6c')]())[_0x85d5('0x30')](_0x85d5('0x6d'),_0x1fdefb[_0x85d5('0x41')][_0x85d5('0x6e')][_0x85d5('0x6c')]())[_0x85d5('0x30')](_0x85d5('0x6f'))[_0x85d5('0x30')](_0x85d5('0x70'),squel[_0x85d5('0x63')]()[_0x85d5('0x64')]('phone')['from'](_0x85d5('0x5b'))['where'](_0x85d5('0x6b'),_0x1fdefb[_0x85d5('0x39')]['id'][_0x85d5('0x6c')]()))[_0x85d5('0x30')](_0x85d5('0x70'),squel[_0x85d5('0x63')]()[_0x85d5('0x64')](_0x85d5('0x71'))[_0x85d5('0x6a')]('cm_hopper_final')[_0x85d5('0x30')](_0x85d5('0x6b'),_0x1fdefb['params']['id'][_0x85d5('0x6c')]())['where'](_0x85d5('0x72')))[_0x85d5('0x73')](_0x85d5('0x5e')))[_0x85d5('0x6c')]();return db['sequelize'][_0x85d5('0x27')](_0x1b96eb);}return[];})[_0x85d5('0x1c')](respondWithResult(_0x496586,null))['catch'](handleError(_0x496586,null));};exports[_0x85d5('0x74')]=function(_0x14e4e8,_0x57f26b,_0x45b1e2){return db[_0x85d5('0x75')][_0x85d5('0x42')]({'where':{'id':_0x14e4e8['params']['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x57f26b,null))[_0x85d5('0x1c')](function(_0x2dacf7){var _0x387a3b;if(_0x2dacf7){_0x387a3b=squel[_0x85d5('0x59')]()[_0x85d5('0x5a')]('cm_hopper')[_0x85d5('0x76')]([_0x85d5('0x5c'),'scheduledAt',_0x85d5('0x5e'),'ListId',_0x85d5('0x77'),_0x85d5('0x61'),_0x85d5('0x62')],squel['select']()[_0x85d5('0x64')](_0x85d5('0x65'),_0x85d5('0x5c'))[_0x85d5('0x64')](_0x85d5('0x66'),'scheduledAt')[_0x85d5('0x64')](_0x85d5('0x67'),_0x85d5('0x5e'))[_0x85d5('0x64')]('ANY_VALUE(ListId)',_0x85d5('0x5f'))[_0x85d5('0x64')](_0x85d5('0x78'),'CampaignId')[_0x85d5('0x64')]('NOW()',_0x85d5('0x61'))[_0x85d5('0x64')]('NOW()','updatedAt')[_0x85d5('0x6a')](_0x85d5('0x79'))[_0x85d5('0x30')](_0x85d5('0x7a'),_0x14e4e8[_0x85d5('0x39')]['id'][_0x85d5('0x6c')]())[_0x85d5('0x30')](_0x85d5('0x6d'),_0x14e4e8['body'][_0x85d5('0x6e')][_0x85d5('0x6c')]())[_0x85d5('0x30')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x85d5('0x30')](_0x85d5('0x70'),squel['select']()[_0x85d5('0x64')](_0x85d5('0x5c'))[_0x85d5('0x6a')](_0x85d5('0x5b'))[_0x85d5('0x30')](_0x85d5('0x7a'),_0x14e4e8[_0x85d5('0x39')]['id']['toString']()))[_0x85d5('0x30')](_0x85d5('0x70'),squel[_0x85d5('0x63')]()[_0x85d5('0x64')]('calleridnum')[_0x85d5('0x6a')](_0x85d5('0x79'))[_0x85d5('0x30')](_0x85d5('0x7a'),_0x14e4e8[_0x85d5('0x39')]['id']['toString']())['where'](_0x85d5('0x72')))['group'](_0x85d5('0x5e')))[_0x85d5('0x6c')]();return db[_0x85d5('0x44')][_0x85d5('0x27')](_0x387a3b);}return[];})[_0x85d5('0x1c')](respondWithResult(_0x57f26b,null))[_0x85d5('0x40')](handleError(_0x57f26b,null));};exports[_0x85d5('0x7b')]=function(_0x48553d,_0xedb32d,_0x5366bc){return db[_0x85d5('0x7c')][_0x85d5('0x7d')]({'where':{'VoiceQueueId':_0x48553d[_0x85d5('0x41')]['VoiceQueueId'],'CampaignId':_0x48553d[_0x85d5('0x41')][_0x85d5('0x77')],'ContactId':_0x48553d[_0x85d5('0x41')]['ContactId']}})['then'](handleEntityNotFound(_0xedb32d,null))[_0x85d5('0x1c')](function(_0x428fd4){if(_0x428fd4){return _0x428fd4;}return null;})['then'](respondWithResult(_0xedb32d,null))[_0x85d5('0x40')](handleError(_0xedb32d,null));}; \ No newline at end of file +var _0x4c60=['include','findAll','rows','catch','show','includeAll','find','describe','update','uniqueid','body','params','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','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','VoiceQueue','into','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','fromQuery','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','end','error','stack','name','index','map','CmHopperFinal','rawAttributes','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options'];(function(_0x4fd1f4,_0x1505ce){var _0xbea416=function(_0x44b21f){while(--_0x44b21f){_0x4fd1f4['push'](_0x4fd1f4['shift']());}};_0xbea416(++_0x1505ce);}(_0x4c60,0xc1));var _0x04c6=function(_0x178f2f,_0x46af41){_0x178f2f=_0x178f2f-0x0;var _0x53ed69=_0x4c60[_0x178f2f];return _0x53ed69;};'use strict';var emlformat=require(_0x04c6('0x0'));var rimraf=require(_0x04c6('0x1'));var zipdir=require(_0x04c6('0x2'));var jsonpatch=require(_0x04c6('0x3'));var rp=require('request-promise');var moment=require(_0x04c6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x04c6('0x5'));var csv=require(_0x04c6('0x6'));var ejs=require(_0x04c6('0x7'));var fs=require('fs');var fs_extra=require(_0x04c6('0x8'));var _=require(_0x04c6('0x9'));var squel=require(_0x04c6('0xa'));var crypto=require(_0x04c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04c6('0xc'));var toCsv=require(_0x04c6('0x6'));var querystring=require(_0x04c6('0xd'));var Papa=require(_0x04c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04c6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04c6('0x10'))(_0x04c6('0x11'));var utils=require('../../config/utils');var config=require(_0x04c6('0x12'));var licenseUtil=require(_0x04c6('0x13'));var db=require(_0x04c6('0x14'))['db'];function respondWithStatusCode(_0x4e5e6,_0x52cdcf){_0x52cdcf=_0x52cdcf||0xcc;return function(_0x257a0a){if(_0x257a0a){return _0x4e5e6[_0x04c6('0x15')](_0x52cdcf);}return _0x4e5e6[_0x04c6('0x16')](_0x52cdcf)['end']();};}function respondWithResult(_0x12d1c5,_0x15cbe0){_0x15cbe0=_0x15cbe0||0xc8;return function(_0x28632e){if(_0x28632e){return _0x12d1c5[_0x04c6('0x16')](_0x15cbe0)[_0x04c6('0x17')](_0x28632e);}};}function respondWithFilteredResult(_0x19a26f,_0x1cd963){return function(_0x3d46a9){if(_0x3d46a9){var _0x5a5a66=typeof _0x1cd963[_0x04c6('0x18')]===_0x04c6('0x19')&&typeof _0x1cd963[_0x04c6('0x1a')]===_0x04c6('0x19');var _0x43596a=_0x3d46a9[_0x04c6('0x1b')];var _0x21674a=_0x5a5a66?0x0:_0x1cd963[_0x04c6('0x18')];var _0x47f400=_0x5a5a66?_0x3d46a9[_0x04c6('0x1b')]:_0x1cd963[_0x04c6('0x18')]+_0x1cd963[_0x04c6('0x1a')];var _0x558b43;if(_0x47f400>=_0x43596a){_0x47f400=_0x43596a;_0x558b43=0xc8;}else{_0x558b43=0xce;}_0x19a26f['status'](_0x558b43);return _0x19a26f['set'](_0x04c6('0x1c'),_0x21674a+'-'+_0x47f400+'/'+_0x43596a)[_0x04c6('0x17')](_0x3d46a9);}return null;};}function patchUpdates(_0x50dd61){return function(_0x5a5e9e){try{jsonpatch[_0x04c6('0x1d')](_0x5a5e9e,_0x50dd61,!![]);}catch(_0x2eed94){return BPromise[_0x04c6('0x1e')](_0x2eed94);}return _0x5a5e9e['save']();};}function saveUpdates(_0x33a0f7,_0x13f2dc){return function(_0x9d41f8){if(_0x9d41f8){return _0x9d41f8['update'](_0x33a0f7)[_0x04c6('0x1f')](function(_0x41e29f){return _0x41e29f;});}return null;};}function removeEntity(_0x562491,_0x54a8b0){return function(_0x4c8d72){if(_0x4c8d72){return _0x4c8d72[_0x04c6('0x20')]()[_0x04c6('0x1f')](function(){_0x562491[_0x04c6('0x16')](0xcc)[_0x04c6('0x21')]();});}};}function handleEntityNotFound(_0x3e1328,_0x52e5f5){return function(_0x562952){if(!_0x562952){_0x3e1328[_0x04c6('0x15')](0x194);}return _0x562952;};}function handleError(_0x2ab1d2,_0x9acfa){_0x9acfa=_0x9acfa||0x1f4;return function(_0x3233d7){logger[_0x04c6('0x22')](_0x3233d7[_0x04c6('0x23')]);if(_0x3233d7['name']){delete _0x3233d7[_0x04c6('0x24')];}_0x2ab1d2[_0x04c6('0x16')](_0x9acfa)['send'](_0x3233d7);};}exports[_0x04c6('0x25')]=function(_0x1cd16a,_0x5f1331){var _0x5c9003={},_0x115d84={},_0x3a6d92={'count':0x0,'rows':[]};var _0x2a191f=_[_0x04c6('0x26')](db[_0x04c6('0x27')][_0x04c6('0x28')],function(_0x49c4ed){return{'name':_0x49c4ed['fieldName'],'type':_0x49c4ed['type'][_0x04c6('0x29')]};});_0x115d84['model']=_[_0x04c6('0x26')](_0x2a191f,_0x04c6('0x24'));_0x115d84['query']=_[_0x04c6('0x2a')](_0x1cd16a[_0x04c6('0x2b')]);_0x115d84[_0x04c6('0x2c')]=_[_0x04c6('0x2d')](_0x115d84['model'],_0x115d84[_0x04c6('0x2b')]);_0x5c9003[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0x115d84[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x30')]));_0x5c9003[_0x04c6('0x2e')]=_0x5c9003[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x5c9003[_0x04c6('0x2e')]:_0x115d84[_0x04c6('0x2f')];if(!_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x32')](_0x04c6('0x33'))){_0x5c9003['limit']=qs[_0x04c6('0x1a')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x1a')]);_0x5c9003[_0x04c6('0x18')]=qs['offset'](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x18')]);}_0x5c9003['order']=qs['sort'](_0x1cd16a['query'][_0x04c6('0x34')]);_0x5c9003[_0x04c6('0x35')]=qs['filters'](_[_0x04c6('0x36')](_0x1cd16a['query'],_0x115d84[_0x04c6('0x2c')]),_0x2a191f);if(_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x37')]){_0x5c9003[_0x04c6('0x35')]=_['merge'](_0x5c9003['where'],{'$or':_[_0x04c6('0x26')](_0x2a191f,function(_0x3a9a3b){if(_0x3a9a3b['type']!==_0x04c6('0x38')){var _0x5ce4b0={};_0x5ce4b0[_0x3a9a3b['name']]={'$like':'%'+_0x1cd16a[_0x04c6('0x2b')]['filter']+'%'};return _0x5ce4b0;}})});}_0x5c9003=_[_0x04c6('0x39')]({},_0x5c9003,_0x1cd16a[_0x04c6('0x3a')]);var _0x59ca18={'where':_0x5c9003[_0x04c6('0x35')]};return db['CmHopperFinal'][_0x04c6('0x1b')](_0x59ca18)[_0x04c6('0x1f')](function(_0x2d83eb){_0x3a6d92[_0x04c6('0x1b')]=_0x2d83eb;if(_0x1cd16a[_0x04c6('0x2b')]['includeAll']){_0x5c9003[_0x04c6('0x3b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x04c6('0x3c')](_0x5c9003);})['then'](function(_0x1f7ead){_0x3a6d92[_0x04c6('0x3d')]=_0x1f7ead;return _0x3a6d92;})[_0x04c6('0x1f')](respondWithFilteredResult(_0x5f1331,_0x5c9003))[_0x04c6('0x3e')](handleError(_0x5f1331,null));};exports[_0x04c6('0x3f')]=function(_0x2cdf34,_0x40477f){var _0x4a3c45={'raw':!![],'where':{'id':_0x2cdf34['params']['id']}},_0xdfdc34={};_0xdfdc34[_0x04c6('0x2f')]=_['keys'](db['CmHopperFinal'][_0x04c6('0x28')]);_0xdfdc34['query']=_[_0x04c6('0x2a')](_0x2cdf34[_0x04c6('0x2b')]);_0xdfdc34[_0x04c6('0x2c')]=_['intersection'](_0xdfdc34[_0x04c6('0x2f')],_0xdfdc34[_0x04c6('0x2b')]);_0x4a3c45[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0xdfdc34[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x2cdf34[_0x04c6('0x2b')]['fields']));_0x4a3c45['attributes']=_0x4a3c45[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x4a3c45[_0x04c6('0x2e')]:_0xdfdc34['model'];if(_0x2cdf34[_0x04c6('0x2b')][_0x04c6('0x40')]){_0x4a3c45[_0x04c6('0x3b')]=[{'all':!![]}];}_0x4a3c45=_['merge']({},_0x4a3c45,_0x2cdf34['options']);return db['CmHopperFinal'][_0x04c6('0x41')](_0x4a3c45)[_0x04c6('0x1f')](handleEntityNotFound(_0x40477f,null))['then'](respondWithResult(_0x40477f,null))[_0x04c6('0x3e')](handleError(_0x40477f,null));};exports[_0x04c6('0x42')]=function(_0x2bd045,_0x4ef366){return db[_0x04c6('0x27')][_0x04c6('0x42')]()['then'](respondWithResult(_0x4ef366,null))[_0x04c6('0x3e')](handleError(_0x4ef366,null));};exports[_0x04c6('0x43')]=function(_0x2472ed,_0xee2822){if(_0x2472ed['body'][_0x04c6('0x44')]){delete _0x2472ed[_0x04c6('0x45')][_0x04c6('0x44')];}return db[_0x04c6('0x27')]['find']({'where':{'uniqueid':_0x2472ed[_0x04c6('0x46')]['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0xee2822,null))[_0x04c6('0x1f')](saveUpdates(_0x2472ed[_0x04c6('0x45')],null))['then'](respondWithResult(_0xee2822,null))[_0x04c6('0x3e')](handleError(_0xee2822,null));};exports[_0x04c6('0x47')]=function(_0x15ec61,_0x489361,_0x3119f0){return db[_0x04c6('0x27')][_0x04c6('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x15ec61[_0x04c6('0x46')]['id']},'attributes':[[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4b')))),_0x04c6('0x4c')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db['sequelize']['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4d')))),_0x04c6('0x4e')],[db[_0x04c6('0x48')]['fn']('COUNT',db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4f')))),_0x04c6('0x50')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0x04c6('0x48')]['fn']('IF',db['sequelize'][_0x04c6('0x4a')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x04c6('0x51')],[db[_0x04c6('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x52')))),_0x04c6('0x53')],[db['sequelize']['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x54')))),_0x04c6('0x55')],[db[_0x04c6('0x48')]['fn']('COUNT',db[_0x04c6('0x48')]['fn']('IF',db['sequelize'][_0x04c6('0x4a')](_0x04c6('0x56')))),'answeringMachine']]})[_0x04c6('0x1f')](handleEntityNotFound(_0x489361,null))[_0x04c6('0x1f')](respondWithResult(_0x489361,null))[_0x04c6('0x3e')](handleError(_0x489361,null));};exports[_0x04c6('0x57')]=function(_0x28299e,_0x5b536f,_0xf073a8){return db[_0x04c6('0x27')]['findAll']({'raw':![],'where':{'CampaignId':_0x28299e[_0x04c6('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db['sequelize']['literal'](_0x04c6('0x4b')))),'noSuchContacts'],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db['sequelize']['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4d')))),_0x04c6('0x4e')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4f')))),_0x04c6('0x50')],[db['sequelize']['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')]('`state`\x20=\x208,\x201,\x20null'))),_0x04c6('0x58')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0x04c6('0x4a')](_0x04c6('0x59')))),_0x04c6('0x51')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db['sequelize'][_0x04c6('0x4a')](_0x04c6('0x52')))),_0x04c6('0x53')],[db['sequelize']['fn']('COUNT',db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x54')))),'reCallContacts'],[db[_0x04c6('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x56')))),_0x04c6('0x5a')]]})[_0x04c6('0x1f')](handleEntityNotFound(_0x5b536f,null))[_0x04c6('0x1f')](respondWithResult(_0x5b536f,null))[_0x04c6('0x3e')](handleError(_0x5b536f,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x31cc93,_0x1b6242,_0x1f5b9a){return db[_0x04c6('0x5b')][_0x04c6('0x41')]({'where':{'id':_0x31cc93['params']['id']}})['then'](handleEntityNotFound(_0x1b6242,null))[_0x04c6('0x1f')](function(_0x598941){var _0x2df63b;if(_0x598941){_0x2df63b=squel['insert']()[_0x04c6('0x5c')](_0x04c6('0x5d'))['fromQuery']([_0x04c6('0x5e'),_0x04c6('0x5f'),_0x04c6('0x60'),_0x04c6('0x61'),_0x04c6('0x62'),_0x04c6('0x63'),_0x04c6('0x64')],squel[_0x04c6('0x65')]()[_0x04c6('0x66')](_0x04c6('0x67'),_0x04c6('0x5e'))[_0x04c6('0x66')](_0x04c6('0x68'),'scheduledAt')[_0x04c6('0x66')](_0x04c6('0x69'),'ContactId')[_0x04c6('0x66')](_0x04c6('0x6a'),_0x04c6('0x61'))[_0x04c6('0x66')](_0x04c6('0x6b'),'VoiceQueueId')[_0x04c6('0x66')]('NOW()',_0x04c6('0x63'))['field'](_0x04c6('0x68'),_0x04c6('0x64'))[_0x04c6('0x6c')](_0x04c6('0x6d'))[_0x04c6('0x35')](_0x04c6('0x6e'),_0x31cc93[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]())[_0x04c6('0x35')]('state\x20=\x20?',_0x31cc93[_0x04c6('0x45')][_0x04c6('0x70')]['toString']())[_0x04c6('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x04c6('0x35')](_0x04c6('0x71'),squel['select']()[_0x04c6('0x66')](_0x04c6('0x5e'))['from'](_0x04c6('0x5d'))[_0x04c6('0x35')]('VoiceQueueId\x20=\x20?',_0x31cc93[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]()))['where'](_0x04c6('0x71'),squel[_0x04c6('0x65')]()['field']('calleridnum')['from'](_0x04c6('0x6d'))[_0x04c6('0x35')](_0x04c6('0x6e'),_0x31cc93[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]())['where'](_0x04c6('0x72')))[_0x04c6('0x73')](_0x04c6('0x60')))[_0x04c6('0x6f')]();return db[_0x04c6('0x48')][_0x04c6('0x2b')](_0x2df63b);}return[];})[_0x04c6('0x1f')](respondWithResult(_0x1b6242,null))['catch'](handleError(_0x1b6242,null));};exports[_0x04c6('0x74')]=function(_0x4f258c,_0x202761,_0x480c74){return db['Campaign'][_0x04c6('0x41')]({'where':{'id':_0x4f258c['params']['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x202761,null))[_0x04c6('0x1f')](function(_0x174de6){var _0x425d01;if(_0x174de6){_0x425d01=squel[_0x04c6('0x75')]()['into']('cm_hopper')[_0x04c6('0x76')]([_0x04c6('0x5e'),_0x04c6('0x5f'),_0x04c6('0x60'),_0x04c6('0x61'),_0x04c6('0x77'),'createdAt',_0x04c6('0x64')],squel['select']()['field'](_0x04c6('0x67'),_0x04c6('0x5e'))[_0x04c6('0x66')](_0x04c6('0x68'),_0x04c6('0x5f'))[_0x04c6('0x66')](_0x04c6('0x69'),_0x04c6('0x60'))[_0x04c6('0x66')](_0x04c6('0x6a'),_0x04c6('0x61'))['field'](_0x04c6('0x78'),'CampaignId')['field'](_0x04c6('0x68'),_0x04c6('0x63'))[_0x04c6('0x66')](_0x04c6('0x68'),_0x04c6('0x64'))[_0x04c6('0x6c')](_0x04c6('0x6d'))[_0x04c6('0x35')](_0x04c6('0x79'),_0x4f258c[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]())['where']('state\x20=\x20?',_0x4f258c[_0x04c6('0x45')][_0x04c6('0x70')]['toString']())[_0x04c6('0x35')](_0x04c6('0x7a'))['where'](_0x04c6('0x71'),squel[_0x04c6('0x65')]()[_0x04c6('0x66')](_0x04c6('0x5e'))[_0x04c6('0x6c')](_0x04c6('0x5d'))[_0x04c6('0x35')](_0x04c6('0x79'),_0x4f258c['params']['id'][_0x04c6('0x6f')]()))['where'](_0x04c6('0x71'),squel[_0x04c6('0x65')]()[_0x04c6('0x66')](_0x04c6('0x7b'))[_0x04c6('0x6c')](_0x04c6('0x6d'))['where'](_0x04c6('0x79'),_0x4f258c[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]())['where']('state\x20=\x204'))['group'](_0x04c6('0x60')))[_0x04c6('0x6f')]();return db['sequelize'][_0x04c6('0x2b')](_0x425d01);}return[];})[_0x04c6('0x1f')](respondWithResult(_0x202761,null))[_0x04c6('0x3e')](handleError(_0x202761,null));};exports['checkContactHopper']=function(_0x343c1f,_0x485457,_0x1c0c74){return db[_0x04c6('0x7c')][_0x04c6('0x7d')]({'where':{'VoiceQueueId':_0x343c1f['body']['VoiceQueueId'],'CampaignId':_0x343c1f[_0x04c6('0x45')][_0x04c6('0x77')],'ContactId':_0x343c1f[_0x04c6('0x45')][_0x04c6('0x60')]}})['then'](handleEntityNotFound(_0x485457,null))['then'](function(_0x3e12a4){if(_0x3e12a4){return _0x3e12a4;}return null;})[_0x04c6('0x1f')](respondWithResult(_0x485457,null))[_0x04c6('0x3e')](handleError(_0x485457,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 4822551..db634d5 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 _0xb91f=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define'];(function(_0x193a55,_0x4f205d){var _0x2d57dd=function(_0x4f8b29){while(--_0x4f8b29){_0x193a55['push'](_0x193a55['shift']());}};_0x2d57dd(++_0x4f205d);}(_0xb91f,0x7c));var _0xfb91=function(_0x85d224,_0x5f13dc){_0x85d224=_0x85d224-0x0;var _0x4d10dc=_0xb91f[_0x85d224];return _0x4d10dc;};'use strict';var _=require(_0xfb91('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfb91('0x1'));var moment=require(_0xfb91('0x2'));var BPromise=require(_0xfb91('0x3'));var rp=require(_0xfb91('0x4'));var fs=require('fs');var path=require(_0xfb91('0x5'));var rimraf=require(_0xfb91('0x6'));var config=require(_0xfb91('0x7'));var attributes=require(_0xfb91('0x8'));module[_0xfb91('0x9')]=function(_0x1144ec,_0x3303f8){return _0x1144ec[_0xfb91('0xa')](_0xfb91('0xb'),attributes,{'tableName':_0xfb91('0xc'),'paranoid':![],'indexes':[{'name':_0xfb91('0xd'),'fields':[_0xfb91('0xd')]},{'name':_0xfb91('0xe'),'fields':[_0xfb91('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf9fd=['uniqueid','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum'];(function(_0x3848be,_0x45a09b){var _0x205783=function(_0x24c3fd){while(--_0x24c3fd){_0x3848be['push'](_0x3848be['shift']());}};_0x205783(++_0x45a09b);}(_0xf9fd,0x1a5));var _0xdf9f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf9fd[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xdf9f('0x0'));var util=require(_0xdf9f('0x1'));var logger=require('../../config/logger')(_0xdf9f('0x2'));var moment=require(_0xdf9f('0x3'));var BPromise=require(_0xdf9f('0x4'));var rp=require(_0xdf9f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdf9f('0x6'));var config=require(_0xdf9f('0x7'));var attributes=require(_0xdf9f('0x8'));module[_0xdf9f('0x9')]=function(_0x573a2a,_0x124ec3){return _0x573a2a[_0xdf9f('0xa')](_0xdf9f('0xb'),attributes,{'tableName':_0xdf9f('0xc'),'paranoid':![],'indexes':[{'name':_0xdf9f('0xd'),'fields':[_0xdf9f('0xd')]},{'name':_0xdf9f('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index bb3d9ee..8fd018c 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(_0x291dd1,_0x264929){var _0x53afb9=function(_0x3e95e5){while(--_0x3e95e5){_0x291dd1['push'](_0x291dd1['shift']());}};_0x53afb9(++_0x264929);}(_0xb10b,0x12a));var _0xbb10=function(_0x54395b,_0x51babb){_0x54395b=_0x54395b-0x0;var _0x199c87=_0xb10b[_0x54395b];return _0x199c87;};'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(_0x1ec931,_0x1b6f05){var _0x52ad70=function(_0x4846d8){while(--_0x4846d8){_0x1ec931['push'](_0x1ec931['shift']());}};_0x52ad70(++_0x1b6f05);}(_0xb10b,0x12a));var _0xbb10=function(_0x1419f6,_0x4180de){_0x1419f6=_0x1419f6-0x0;var _0x5b07c7=_0xb10b[_0x1419f6];return _0x5b07c7;};'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 fae844e..40ab74c 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 _0xd472=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','multer','util','path'];(function(_0x4e13f7,_0x41780e){var _0x2778d2=function(_0x29a609){while(--_0x29a609){_0x4e13f7['push'](_0x4e13f7['shift']());}};_0x2778d2(++_0x41780e);}(_0xd472,0x1eb));var _0x2d47=function(_0x5aade3,_0x435d82){_0x5aade3=_0x5aade3-0x0;var _0x36e29d=_0xd472[_0x5aade3];return _0x36e29d;};'use strict';var multer=require(_0x2d47('0x0'));var util=require(_0x2d47('0x1'));var path=require(_0x2d47('0x2'));var timeout=require('connect-timeout');var express=require(_0x2d47('0x3'));var router=express[_0x2d47('0x4')]();var fs_extra=require(_0x2d47('0x5'));var auth=require(_0x2d47('0x6'));var interaction=require(_0x2d47('0x7'));var config=require(_0x2d47('0x8'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0x2d47('0x9')](),controller[_0x2d47('0xa')]);router[_0x2d47('0xb')](_0x2d47('0xc'),auth[_0x2d47('0x9')](),controller['describe']);router[_0x2d47('0xb')](_0x2d47('0xd'),auth[_0x2d47('0x9')](),controller['show']);router['get'](_0x2d47('0xe'),auth[_0x2d47('0x9')](),controller[_0x2d47('0xf')]);router[_0x2d47('0xb')]('/campaign/countAttributes/:id',auth[_0x2d47('0x9')](),controller[_0x2d47('0x10')]);router[_0x2d47('0x11')](_0x2d47('0x12'),auth[_0x2d47('0x9')](),controller[_0x2d47('0x13')]);router[_0x2d47('0x11')](_0x2d47('0x14'),auth[_0x2d47('0x9')](),controller[_0x2d47('0x15')]);router[_0x2d47('0x11')](_0x2d47('0x16'),auth[_0x2d47('0x9')](),controller[_0x2d47('0x17')]);router['put']('/:id',auth[_0x2d47('0x9')](),controller[_0x2d47('0x18')]);module[_0x2d47('0x19')]=router; \ No newline at end of file +var _0x8208=['/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/voice/queue/countAttributes/:id','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post'];(function(_0x36436d,_0x20292c){var _0x34615d=function(_0x5447af){while(--_0x5447af){_0x36436d['push'](_0x36436d['shift']());}};_0x34615d(++_0x20292c);}(_0x8208,0x14b));var _0x8820=function(_0xe6b4e8,_0xa692e8){_0xe6b4e8=_0xe6b4e8-0x0;var _0xdccf4a=_0x8208[_0xe6b4e8];return _0xdccf4a;};'use strict';var multer=require(_0x8820('0x0'));var util=require(_0x8820('0x1'));var path=require(_0x8820('0x2'));var timeout=require(_0x8820('0x3'));var express=require(_0x8820('0x4'));var router=express[_0x8820('0x5')]();var fs_extra=require(_0x8820('0x6'));var auth=require(_0x8820('0x7'));var interaction=require(_0x8820('0x8'));var config=require('../../config/environment');var controller=require(_0x8820('0x9'));router[_0x8820('0xa')]('/',auth[_0x8820('0xb')](),controller[_0x8820('0xc')]);router[_0x8820('0xa')](_0x8820('0xd'),auth['isAuthenticated'](),controller[_0x8820('0xe')]);router[_0x8820('0xa')]('/:id',auth[_0x8820('0xb')](),controller['show']);router['get'](_0x8820('0xf'),auth[_0x8820('0xb')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x8820('0xa')]('/campaign/countAttributes/:id',auth[_0x8820('0xb')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0x8820('0x10'),auth[_0x8820('0xb')](),controller[_0x8820('0x11')]);router[_0x8820('0x12')](_0x8820('0x13'),auth['isAuthenticated'](),controller[_0x8820('0x14')]);router[_0x8820('0x12')](_0x8820('0x15'),auth[_0x8820('0xb')](),controller[_0x8820('0x16')]);router[_0x8820('0x17')]('/:id',auth[_0x8820('0xb')](),controller['update']);module[_0x8820('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index f77dad9..fb00644 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 _0x0df3=['STRING','BOOLEAN','sequelize','INTEGER','DATE'];(function(_0x44dc16,_0x3ae089){var _0x34c5b6=function(_0xffde05){while(--_0xffde05){_0x44dc16['push'](_0x44dc16['shift']());}};_0x34c5b6(++_0x3ae089);}(_0x0df3,0x98));var _0x30df=function(_0x502953,_0x28de83){_0x502953=_0x502953-0x0;var _0x2fa32d=_0x0df3[_0x502953];return _0x2fa32d;};'use strict';var Sequelize=require(_0x30df('0x0'));module['exports']={'state':{'type':Sequelize[_0x30df('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x30df('0x2')]},'countbusyretry':{'type':Sequelize[_0x30df('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x30df('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x30df('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x30df('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x30df('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x30df('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x30df('0x3')]},'calleridname':{'type':Sequelize[_0x30df('0x3')]},'starttime':{'type':Sequelize[_0x30df('0x2')]},'responsetime':{'type':Sequelize[_0x30df('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x30df('0x2')]},'endtime':{'type':Sequelize[_0x30df('0x2')]},'ringtime':{'type':Sequelize[_0x30df('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x30df('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x30df('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x30df('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x30df('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x30df('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x30df('0x2')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x30df('0x2')]},'edited':{'type':Sequelize[_0x30df('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x30df('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x30df('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x30df('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x30df('0x3')]}}; \ No newline at end of file +var _0x4365=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x1159f9,_0x4742d9){var _0x1579a4=function(_0x11f829){while(--_0x11f829){_0x1159f9['push'](_0x1159f9['shift']());}};_0x1579a4(++_0x4742d9);}(_0x4365,0x143));var _0x5436=function(_0x5251f0,_0xc08e2d){_0x5251f0=_0x5251f0-0x0;var _0x31ff23=_0x4365[_0x5251f0];return _0x31ff23;};'use strict';var Sequelize=require(_0x5436('0x0'));module[_0x5436('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x5436('0x2')]},'scheduledat':{'type':Sequelize[_0x5436('0x3')]},'countbusyretry':{'type':Sequelize[_0x5436('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5436('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5436('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5436('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5436('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x5436('0x2')]},'originatecalleridname':{'type':Sequelize[_0x5436('0x2')]},'calleridnum':{'type':Sequelize[_0x5436('0x2')]},'calleridname':{'type':Sequelize[_0x5436('0x2')]},'starttime':{'type':Sequelize[_0x5436('0x3')]},'responsetime':{'type':Sequelize[_0x5436('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x5436('0x3')]},'endtime':{'type':Sequelize[_0x5436('0x3')]},'ringtime':{'type':Sequelize[_0x5436('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5436('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5436('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5436('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x5436('0x2')]},'membername':{'type':Sequelize[_0x5436('0x2')]},'reason':{'type':Sequelize[_0x5436('0x2')]},'amd':{'type':Sequelize[_0x5436('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5436('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x5436('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5436('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5436('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x5436('0x3')]},'edited':{'type':Sequelize[_0x5436('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5436('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5436('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5436('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5436('0x4')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 8053b06..e9e9c25 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 _0xfa3f=['querystring','papaparse','ioredis','../../components/auth/service','../../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','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','CmHopperHistory','include','findAll','rows','catch','params','includeAll','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x134827,_0x21f6ed){var _0x366671=function(_0x4dc8d4){while(--_0x4dc8d4){_0x134827['push'](_0x134827['shift']());}};_0x366671(++_0x21f6ed);}(_0xfa3f,0x184));var _0xffa3=function(_0x503834,_0x35ef9c){_0x503834=_0x503834-0x0;var _0x729548=_0xfa3f[_0x503834];return _0x729548;};'use strict';var emlformat=require(_0xffa3('0x0'));var rimraf=require(_0xffa3('0x1'));var zipdir=require(_0xffa3('0x2'));var jsonpatch=require(_0xffa3('0x3'));var rp=require(_0xffa3('0x4'));var moment=require(_0xffa3('0x5'));var BPromise=require(_0xffa3('0x6'));var Mustache=require('mustache');var util=require(_0xffa3('0x7'));var path=require(_0xffa3('0x8'));var sox=require(_0xffa3('0x9'));var csv=require(_0xffa3('0xa'));var ejs=require(_0xffa3('0xb'));var fs=require('fs');var fs_extra=require(_0xffa3('0xc'));var _=require(_0xffa3('0xd'));var squel=require(_0xffa3('0xe'));var crypto=require(_0xffa3('0xf'));var jsforce=require(_0xffa3('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xffa3('0xa'));var querystring=require(_0xffa3('0x11'));var Papa=require(_0xffa3('0x12'));var Redis=require(_0xffa3('0x13'));var authService=require(_0xffa3('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xffa3('0x15'));var hardwareService=require(_0xffa3('0x16'));var logger=require(_0xffa3('0x17'))(_0xffa3('0x18'));var utils=require(_0xffa3('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xffa3('0x1a'));var db=require(_0xffa3('0x1b'))['db'];function respondWithStatusCode(_0x354763,_0x54e257){_0x54e257=_0x54e257||0xcc;return function(_0x1cd274){if(_0x1cd274){return _0x354763[_0xffa3('0x1c')](_0x54e257);}return _0x354763[_0xffa3('0x1d')](_0x54e257)[_0xffa3('0x1e')]();};}function respondWithResult(_0xba15ea,_0x1e498e){_0x1e498e=_0x1e498e||0xc8;return function(_0x3d2091){if(_0x3d2091){return _0xba15ea[_0xffa3('0x1d')](_0x1e498e)[_0xffa3('0x1f')](_0x3d2091);}};}function respondWithFilteredResult(_0x539393,_0x21d663){return function(_0x40ee89){if(_0x40ee89){var _0x46e5d9=typeof _0x21d663['offset']===_0xffa3('0x20')&&typeof _0x21d663[_0xffa3('0x21')]===_0xffa3('0x20');var _0x556ea3=_0x40ee89[_0xffa3('0x22')];var _0x4499cf=_0x46e5d9?0x0:_0x21d663[_0xffa3('0x23')];var _0x3141eb=_0x46e5d9?_0x40ee89[_0xffa3('0x22')]:_0x21d663['offset']+_0x21d663[_0xffa3('0x21')];var _0x12d364;if(_0x3141eb>=_0x556ea3){_0x3141eb=_0x556ea3;_0x12d364=0xc8;}else{_0x12d364=0xce;}_0x539393['status'](_0x12d364);return _0x539393[_0xffa3('0x24')](_0xffa3('0x25'),_0x4499cf+'-'+_0x3141eb+'/'+_0x556ea3)[_0xffa3('0x1f')](_0x40ee89);}return null;};}function patchUpdates(_0x411b44){return function(_0x5d3676){try{jsonpatch[_0xffa3('0x26')](_0x5d3676,_0x411b44,!![]);}catch(_0x56ffdc){return BPromise[_0xffa3('0x27')](_0x56ffdc);}return _0x5d3676[_0xffa3('0x28')]();};}function saveUpdates(_0x47d82e,_0x3eb533){return function(_0x1d7c2c){if(_0x1d7c2c){return _0x1d7c2c[_0xffa3('0x29')](_0x47d82e)[_0xffa3('0x2a')](function(_0x4d77e1){return _0x4d77e1;});}return null;};}function removeEntity(_0x2d2951,_0x4d523f){return function(_0x36bd8b){if(_0x36bd8b){return _0x36bd8b[_0xffa3('0x2b')]()[_0xffa3('0x2a')](function(){_0x2d2951[_0xffa3('0x1d')](0xcc)[_0xffa3('0x1e')]();});}};}function handleEntityNotFound(_0x4565f2,_0x572397){return function(_0x401d92){if(!_0x401d92){_0x4565f2['sendStatus'](0x194);}return _0x401d92;};}function handleError(_0x16a5e0,_0xc65876){_0xc65876=_0xc65876||0x1f4;return function(_0x52ef36){logger['error'](_0x52ef36[_0xffa3('0x2c')]);if(_0x52ef36[_0xffa3('0x2d')]){delete _0x52ef36[_0xffa3('0x2d')];}_0x16a5e0['status'](_0xc65876)[_0xffa3('0x2e')](_0x52ef36);};}exports[_0xffa3('0x2f')]=function(_0x5e1fd9,_0x163284){var _0x1ef097={},_0x391cf8={},_0x59f107={'count':0x0,'rows':[]};var _0x4b6b48=_[_0xffa3('0x30')](db['CmHopperHistory'][_0xffa3('0x31')],function(_0xc7df87){return{'name':_0xc7df87['fieldName'],'type':_0xc7df87[_0xffa3('0x32')]['key']};});_0x391cf8[_0xffa3('0x33')]=_[_0xffa3('0x30')](_0x4b6b48,_0xffa3('0x2d'));_0x391cf8['query']=_[_0xffa3('0x34')](_0x5e1fd9[_0xffa3('0x35')]);_0x391cf8[_0xffa3('0x36')]=_['intersection'](_0x391cf8[_0xffa3('0x33')],_0x391cf8[_0xffa3('0x35')]);_0x1ef097['attributes']=_[_0xffa3('0x37')](_0x391cf8['model'],qs[_0xffa3('0x38')](_0x5e1fd9[_0xffa3('0x35')][_0xffa3('0x38')]));_0x1ef097['attributes']=_0x1ef097[_0xffa3('0x39')][_0xffa3('0x3a')]?_0x1ef097[_0xffa3('0x39')]:_0x391cf8[_0xffa3('0x33')];if(!_0x5e1fd9[_0xffa3('0x35')][_0xffa3('0x3b')](_0xffa3('0x3c'))){_0x1ef097[_0xffa3('0x21')]=qs[_0xffa3('0x21')](_0x5e1fd9[_0xffa3('0x35')]['limit']);_0x1ef097[_0xffa3('0x23')]=qs[_0xffa3('0x23')](_0x5e1fd9[_0xffa3('0x35')]['offset']);}_0x1ef097[_0xffa3('0x3d')]=qs[_0xffa3('0x3e')](_0x5e1fd9[_0xffa3('0x35')][_0xffa3('0x3e')]);_0x1ef097['where']=qs[_0xffa3('0x36')](_[_0xffa3('0x3f')](_0x5e1fd9['query'],_0x391cf8['filters']),_0x4b6b48);if(_0x5e1fd9[_0xffa3('0x35')]['filter']){_0x1ef097[_0xffa3('0x40')]=_[_0xffa3('0x41')](_0x1ef097[_0xffa3('0x40')],{'$or':_[_0xffa3('0x30')](_0x4b6b48,function(_0x28f77f){if(_0x28f77f[_0xffa3('0x32')]!==_0xffa3('0x42')){var _0x2b63e5={};_0x2b63e5[_0x28f77f[_0xffa3('0x2d')]]={'$like':'%'+_0x5e1fd9[_0xffa3('0x35')][_0xffa3('0x43')]+'%'};return _0x2b63e5;}})});}_0x1ef097=_[_0xffa3('0x41')]({},_0x1ef097,_0x5e1fd9[_0xffa3('0x44')]);var _0x4af05c={'where':_0x1ef097['where']};return db[_0xffa3('0x45')]['count'](_0x4af05c)[_0xffa3('0x2a')](function(_0x1af640){_0x59f107[_0xffa3('0x22')]=_0x1af640;if(_0x5e1fd9[_0xffa3('0x35')]['includeAll']){_0x1ef097[_0xffa3('0x46')]=[{'all':!![]}];}return db[_0xffa3('0x45')][_0xffa3('0x47')](_0x1ef097);})[_0xffa3('0x2a')](function(_0x502c03){_0x59f107[_0xffa3('0x48')]=_0x502c03;return _0x59f107;})[_0xffa3('0x2a')](respondWithFilteredResult(_0x163284,_0x1ef097))[_0xffa3('0x49')](handleError(_0x163284,null));};exports['show']=function(_0x2a4414,_0x545e87){var _0x1eccbe={'raw':!![],'where':{'id':_0x2a4414[_0xffa3('0x4a')]['id']}},_0x58767d={};_0x58767d[_0xffa3('0x33')]=_['keys'](db[_0xffa3('0x45')]['rawAttributes']);_0x58767d[_0xffa3('0x35')]=_[_0xffa3('0x34')](_0x2a4414['query']);_0x58767d[_0xffa3('0x36')]=_[_0xffa3('0x37')](_0x58767d[_0xffa3('0x33')],_0x58767d[_0xffa3('0x35')]);_0x1eccbe[_0xffa3('0x39')]=_[_0xffa3('0x37')](_0x58767d['model'],qs[_0xffa3('0x38')](_0x2a4414[_0xffa3('0x35')]['fields']));_0x1eccbe[_0xffa3('0x39')]=_0x1eccbe[_0xffa3('0x39')][_0xffa3('0x3a')]?_0x1eccbe[_0xffa3('0x39')]:_0x58767d[_0xffa3('0x33')];if(_0x2a4414[_0xffa3('0x35')][_0xffa3('0x4b')]){_0x1eccbe[_0xffa3('0x46')]=[{'all':!![]}];}_0x1eccbe=_[_0xffa3('0x41')]({},_0x1eccbe,_0x2a4414[_0xffa3('0x44')]);return db['CmHopperHistory'][_0xffa3('0x4c')](_0x1eccbe)[_0xffa3('0x2a')](handleEntityNotFound(_0x545e87,null))[_0xffa3('0x2a')](respondWithResult(_0x545e87,null))['catch'](handleError(_0x545e87,null));};exports[_0xffa3('0x4d')]=function(_0x1f4a4d,_0x20b70c){return db[_0xffa3('0x45')][_0xffa3('0x4d')](_0x1f4a4d[_0xffa3('0x4e')],{})['then'](respondWithResult(_0x20b70c,0xc9))[_0xffa3('0x49')](handleError(_0x20b70c,null));};exports[_0xffa3('0x4f')]=function(_0x359409,_0x4b40e4){return db['CmHopperHistory'][_0xffa3('0x4f')]()[_0xffa3('0x2a')](respondWithResult(_0x4b40e4,null))[_0xffa3('0x49')](handleError(_0x4b40e4,null));};exports['update']=function(_0xc0cf13,_0x2e338e){if(_0xc0cf13['body'][_0xffa3('0x50')]){delete _0xc0cf13['body']['uniqueid'];}return db['CmHopperHistory'][_0xffa3('0x4c')]({'where':{'uniqueid':_0xc0cf13[_0xffa3('0x4a')]['id']}})[_0xffa3('0x2a')](handleEntityNotFound(_0x2e338e,null))['then'](saveUpdates(_0xc0cf13['body'],null))[_0xffa3('0x2a')](respondWithResult(_0x2e338e,null))[_0xffa3('0x49')](handleError(_0x2e338e,null));}; \ No newline at end of file +var _0x392b=['map','CmHopperHistory','fieldName','type','key','model','query','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','rawAttributes','length','include','find','create','catch','describe','body','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','apply','save','update','then','destroy','error','name','send','index'];(function(_0x57a482,_0x564bb0){var _0x3e2608=function(_0x528209){while(--_0x528209){_0x57a482['push'](_0x57a482['shift']());}};_0x3e2608(++_0x564bb0);}(_0x392b,0xb0));var _0xb392=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x392b[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0xb392('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb392('0x1'));var jsonpatch=require(_0xb392('0x2'));var rp=require(_0xb392('0x3'));var moment=require('moment');var BPromise=require(_0xb392('0x4'));var Mustache=require(_0xb392('0x5'));var util=require(_0xb392('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb392('0x7'));var fs=require('fs');var fs_extra=require(_0xb392('0x8'));var _=require(_0xb392('0x9'));var squel=require('squel');var crypto=require(_0xb392('0xa'));var jsforce=require(_0xb392('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb392('0xc'));var querystring=require('querystring');var Papa=require(_0xb392('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb392('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb392('0xf'));var utils=require(_0xb392('0x10'));var config=require(_0xb392('0x11'));var licenseUtil=require(_0xb392('0x12'));var db=require(_0xb392('0x13'))['db'];function respondWithStatusCode(_0x1e86e0,_0x85e29e){_0x85e29e=_0x85e29e||0xcc;return function(_0x56a62e){if(_0x56a62e){return _0x1e86e0[_0xb392('0x14')](_0x85e29e);}return _0x1e86e0[_0xb392('0x15')](_0x85e29e)[_0xb392('0x16')]();};}function respondWithResult(_0x2b96b6,_0x3f0a2c){_0x3f0a2c=_0x3f0a2c||0xc8;return function(_0xeda142){if(_0xeda142){return _0x2b96b6['status'](_0x3f0a2c)[_0xb392('0x17')](_0xeda142);}};}function respondWithFilteredResult(_0x12307d,_0x74853e){return function(_0x503647){if(_0x503647){var _0x28dff3=typeof _0x74853e['offset']==='undefined'&&typeof _0x74853e['limit']===_0xb392('0x18');var _0x246b31=_0x503647['count'];var _0x1b1f43=_0x28dff3?0x0:_0x74853e[_0xb392('0x19')];var _0x4b0438=_0x28dff3?_0x503647[_0xb392('0x1a')]:_0x74853e['offset']+_0x74853e[_0xb392('0x1b')];var _0x4dd7f6;if(_0x4b0438>=_0x246b31){_0x4b0438=_0x246b31;_0x4dd7f6=0xc8;}else{_0x4dd7f6=0xce;}_0x12307d[_0xb392('0x15')](_0x4dd7f6);return _0x12307d['set']('Content-Range',_0x1b1f43+'-'+_0x4b0438+'/'+_0x246b31)[_0xb392('0x17')](_0x503647);}return null;};}function patchUpdates(_0x1e9b6d){return function(_0x480a2d){try{jsonpatch[_0xb392('0x1c')](_0x480a2d,_0x1e9b6d,!![]);}catch(_0x46d60b){return BPromise['reject'](_0x46d60b);}return _0x480a2d[_0xb392('0x1d')]();};}function saveUpdates(_0xc926da,_0x12d8aa){return function(_0x2a43cb){if(_0x2a43cb){return _0x2a43cb[_0xb392('0x1e')](_0xc926da)[_0xb392('0x1f')](function(_0x1e47cd){return _0x1e47cd;});}return null;};}function removeEntity(_0x5a3a21,_0x4133c4){return function(_0x410d73){if(_0x410d73){return _0x410d73[_0xb392('0x20')]()[_0xb392('0x1f')](function(){_0x5a3a21[_0xb392('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e9dab,_0x480058){return function(_0x1579af){if(!_0x1579af){_0x4e9dab[_0xb392('0x14')](0x194);}return _0x1579af;};}function handleError(_0x41a337,_0x274550){_0x274550=_0x274550||0x1f4;return function(_0x1f327){logger[_0xb392('0x21')](_0x1f327['stack']);if(_0x1f327[_0xb392('0x22')]){delete _0x1f327['name'];}_0x41a337['status'](_0x274550)[_0xb392('0x23')](_0x1f327);};}exports[_0xb392('0x24')]=function(_0x1aaabf,_0x1e40ee){var _0x1e28a3={},_0x1b7b3b={},_0x52c1dd={'count':0x0,'rows':[]};var _0x3cc8de=_[_0xb392('0x25')](db[_0xb392('0x26')]['rawAttributes'],function(_0x423f28){return{'name':_0x423f28[_0xb392('0x27')],'type':_0x423f28[_0xb392('0x28')][_0xb392('0x29')]};});_0x1b7b3b[_0xb392('0x2a')]=_[_0xb392('0x25')](_0x3cc8de,'name');_0x1b7b3b[_0xb392('0x2b')]=_['keys'](_0x1aaabf['query']);_0x1b7b3b[_0xb392('0x2c')]=_[_0xb392('0x2d')](_0x1b7b3b[_0xb392('0x2a')],_0x1b7b3b[_0xb392('0x2b')]);_0x1e28a3['attributes']=_['intersection'](_0x1b7b3b[_0xb392('0x2a')],qs[_0xb392('0x2e')](_0x1aaabf[_0xb392('0x2b')][_0xb392('0x2e')]));_0x1e28a3[_0xb392('0x2f')]=_0x1e28a3[_0xb392('0x2f')]['length']?_0x1e28a3[_0xb392('0x2f')]:_0x1b7b3b['model'];if(!_0x1aaabf['query']['hasOwnProperty']('nolimit')){_0x1e28a3[_0xb392('0x1b')]=qs[_0xb392('0x1b')](_0x1aaabf['query']['limit']);_0x1e28a3['offset']=qs[_0xb392('0x19')](_0x1aaabf[_0xb392('0x2b')][_0xb392('0x19')]);}_0x1e28a3[_0xb392('0x30')]=qs[_0xb392('0x31')](_0x1aaabf[_0xb392('0x2b')][_0xb392('0x31')]);_0x1e28a3[_0xb392('0x32')]=qs['filters'](_[_0xb392('0x33')](_0x1aaabf['query'],_0x1b7b3b[_0xb392('0x2c')]),_0x3cc8de);if(_0x1aaabf[_0xb392('0x2b')][_0xb392('0x34')]){_0x1e28a3[_0xb392('0x32')]=_[_0xb392('0x35')](_0x1e28a3[_0xb392('0x32')],{'$or':_[_0xb392('0x25')](_0x3cc8de,function(_0x4b43f5){if(_0x4b43f5['type']!==_0xb392('0x36')){var _0xb22046={};_0xb22046[_0x4b43f5[_0xb392('0x22')]]={'$like':'%'+_0x1aaabf[_0xb392('0x2b')][_0xb392('0x34')]+'%'};return _0xb22046;}})});}_0x1e28a3=_[_0xb392('0x35')]({},_0x1e28a3,_0x1aaabf[_0xb392('0x37')]);var _0x2ae103={'where':_0x1e28a3[_0xb392('0x32')]};return db[_0xb392('0x26')][_0xb392('0x1a')](_0x2ae103)['then'](function(_0xf04740){_0x52c1dd[_0xb392('0x1a')]=_0xf04740;if(_0x1aaabf['query'][_0xb392('0x38')]){_0x1e28a3['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xb392('0x39')](_0x1e28a3);})[_0xb392('0x1f')](function(_0x7feefb){_0x52c1dd[_0xb392('0x3a')]=_0x7feefb;return _0x52c1dd;})[_0xb392('0x1f')](respondWithFilteredResult(_0x1e40ee,_0x1e28a3))['catch'](handleError(_0x1e40ee,null));};exports[_0xb392('0x3b')]=function(_0x47901c,_0x5d7a0c){var _0x1f7a33={'raw':!![],'where':{'id':_0x47901c[_0xb392('0x3c')]['id']}},_0x29bb9b={};_0x29bb9b[_0xb392('0x2a')]=_[_0xb392('0x3d')](db[_0xb392('0x26')][_0xb392('0x3e')]);_0x29bb9b[_0xb392('0x2b')]=_['keys'](_0x47901c[_0xb392('0x2b')]);_0x29bb9b['filters']=_[_0xb392('0x2d')](_0x29bb9b['model'],_0x29bb9b[_0xb392('0x2b')]);_0x1f7a33[_0xb392('0x2f')]=_[_0xb392('0x2d')](_0x29bb9b[_0xb392('0x2a')],qs[_0xb392('0x2e')](_0x47901c[_0xb392('0x2b')][_0xb392('0x2e')]));_0x1f7a33['attributes']=_0x1f7a33[_0xb392('0x2f')][_0xb392('0x3f')]?_0x1f7a33[_0xb392('0x2f')]:_0x29bb9b[_0xb392('0x2a')];if(_0x47901c[_0xb392('0x2b')]['includeAll']){_0x1f7a33[_0xb392('0x40')]=[{'all':!![]}];}_0x1f7a33=_['merge']({},_0x1f7a33,_0x47901c[_0xb392('0x37')]);return db[_0xb392('0x26')][_0xb392('0x41')](_0x1f7a33)[_0xb392('0x1f')](handleEntityNotFound(_0x5d7a0c,null))[_0xb392('0x1f')](respondWithResult(_0x5d7a0c,null))['catch'](handleError(_0x5d7a0c,null));};exports[_0xb392('0x42')]=function(_0x300189,_0xb31418){return db['CmHopperHistory']['create'](_0x300189['body'],{})['then'](respondWithResult(_0xb31418,0xc9))[_0xb392('0x43')](handleError(_0xb31418,null));};exports['describe']=function(_0x11adb0,_0x3be3f1){return db[_0xb392('0x26')][_0xb392('0x44')]()[_0xb392('0x1f')](respondWithResult(_0x3be3f1,null))[_0xb392('0x43')](handleError(_0x3be3f1,null));};exports['update']=function(_0x22d29b,_0x27ce3a){if(_0x22d29b[_0xb392('0x45')]['uniqueid']){delete _0x22d29b[_0xb392('0x45')][_0xb392('0x46')];}return db[_0xb392('0x26')][_0xb392('0x41')]({'where':{'uniqueid':_0x22d29b[_0xb392('0x3c')]['id']}})[_0xb392('0x1f')](handleEntityNotFound(_0x27ce3a,null))[_0xb392('0x1f')](saveUpdates(_0x22d29b[_0xb392('0x45')],null))[_0xb392('0x1f')](respondWithResult(_0x27ce3a,null))[_0xb392('0x43')](handleError(_0x27ce3a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 904df4b..8eb20a4 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 _0xa7db=['path','rimraf','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','request-promise'];(function(_0x59616b,_0x38e534){var _0x5c4523=function(_0x166f2e){while(--_0x166f2e){_0x59616b['push'](_0x59616b['shift']());}};_0x5c4523(++_0x38e534);}(_0xa7db,0xbf));var _0xba7d=function(_0x2cc3c5,_0x5afa5b){_0x2cc3c5=_0x2cc3c5-0x0;var _0x18b51a=_0xa7db[_0x2cc3c5];return _0x18b51a;};'use strict';var _=require(_0xba7d('0x0'));var util=require(_0xba7d('0x1'));var logger=require(_0xba7d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xba7d('0x3'));var fs=require('fs');var path=require(_0xba7d('0x4'));var rimraf=require(_0xba7d('0x5'));var config=require(_0xba7d('0x6'));var attributes=require(_0xba7d('0x7'));module['exports']=function(_0x2f6d8d,_0x257384){return _0x2f6d8d[_0xba7d('0x8')](_0xba7d('0x9'),attributes,{'tableName':_0xba7d('0xa'),'paranoid':![],'indexes':[{'name':_0xba7d('0xb'),'fields':['endtime']},{'name':_0xba7d('0xc'),'fields':[_0xba7d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb2f3=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid','lodash','util'];(function(_0x26d0b3,_0xe1aa52){var _0x522fef=function(_0x1c9970){while(--_0x1c9970){_0x26d0b3['push'](_0x26d0b3['shift']());}};_0x522fef(++_0xe1aa52);}(_0xb2f3,0xfd));var _0x3b2f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xb2f3[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x3b2f('0x0'));var util=require(_0x3b2f('0x1'));var logger=require(_0x3b2f('0x2'))(_0x3b2f('0x3'));var moment=require(_0x3b2f('0x4'));var BPromise=require(_0x3b2f('0x5'));var rp=require(_0x3b2f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b2f('0x7'));var config=require(_0x3b2f('0x8'));var attributes=require(_0x3b2f('0x9'));module[_0x3b2f('0xa')]=function(_0x1879cf,_0xa38042){return _0x1879cf[_0x3b2f('0xb')]('CmHopperHistory',attributes,{'tableName':_0x3b2f('0xc'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x3b2f('0xd')]},{'name':_0x3b2f('0xe'),'fields':[_0x3b2f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index dc3b593..3b6767f 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 _0xb2e7=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','stringify','where','sequelize','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','COUNT','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xb2e7,0x111));var _0x7b2e=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb2e7[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x7b2e('0x0'));var util=require(_0x7b2e('0x1'));var moment=require(_0x7b2e('0x2'));var BPromise=require(_0x7b2e('0x3'));var rs=require(_0x7b2e('0x4'));var fs=require('fs');var Redis=require(_0x7b2e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b2e('0x6'));var logger=require(_0x7b2e('0x7'))(_0x7b2e('0x8'));var config=require(_0x7b2e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7b2e('0xa')][_0x7b2e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x141496,_0x560a3e,_0x3e4785){return new BPromise(function(_0x4c7f6f,_0x4f8b2f){return client[_0x7b2e('0xc')](_0x141496,_0x3e4785)[_0x7b2e('0xd')](function(_0x80ffce){logger[_0x7b2e('0xe')](_0x7b2e('0xf'),_0x560a3e,_0x7b2e('0x10'));logger[_0x7b2e('0x11')](_0x7b2e('0x12'),_0x560a3e,_0x7b2e('0x10'),JSON['stringify'](_0x80ffce));if(_0x80ffce[_0x7b2e('0x13')]){if(_0x80ffce[_0x7b2e('0x13')][_0x7b2e('0x14')]===0x1f4){logger[_0x7b2e('0x13')](_0x7b2e('0xf'),_0x560a3e,_0x80ffce[_0x7b2e('0x13')][_0x7b2e('0x15')]);return _0x4f8b2f(_0x80ffce['error'][_0x7b2e('0x15')]);}logger[_0x7b2e('0x13')](_0x7b2e('0xf'),_0x560a3e,_0x80ffce[_0x7b2e('0x13')][_0x7b2e('0x15')]);return _0x4c7f6f(_0x80ffce[_0x7b2e('0x13')][_0x7b2e('0x15')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x560a3e,'request\x20sent');_0x4c7f6f(_0x80ffce[_0x7b2e('0x16')][_0x7b2e('0x15')]);}})[_0x7b2e('0x17')](function(_0x4791e5){logger[_0x7b2e('0x13')](_0x7b2e('0xf'),_0x560a3e,_0x4791e5);_0x4f8b2f(_0x4791e5);});});}exports[_0x7b2e('0x18')]=function(_0x2120d6){var _0x216c34=this;return new Promise(function(_0xe38f2e,_0x230346){return db[_0x7b2e('0x19')][_0x7b2e('0x1a')](_0x2120d6['body'],{'raw':_0x2120d6[_0x7b2e('0x1b')]?_0x2120d6[_0x7b2e('0x1b')][_0x7b2e('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x3117c6){logger[_0x7b2e('0xe')](_0x7b2e('0x18'),_0x2120d6);logger[_0x7b2e('0x11')]('CreateCmHopperHistory',_0x2120d6,JSON[_0x7b2e('0x1d')](_0x3117c6));_0xe38f2e(_0x3117c6);})[_0x7b2e('0x17')](function(_0x28073f){logger[_0x7b2e('0x13')](_0x7b2e('0x18'),_0x28073f[_0x7b2e('0x15')],_0x2120d6);_0x230346(_0x216c34[_0x7b2e('0x13')](0x1f4,_0x28073f[_0x7b2e('0x15')]));});});};exports['AvgHandleTime']=function(_0xddc7ff){var _0x101a33=this;return new Promise(function(_0x2f48a8,_0x291f1c){return db[_0x7b2e('0x19')]['findAll']({'raw':_0xddc7ff['options']?_0xddc7ff[_0x7b2e('0x1b')][_0x7b2e('0x1c')]===undefined?!![]:![]:!![],'where':_0xddc7ff[_0x7b2e('0x1b')]?_0xddc7ff['options'][_0x7b2e('0x1e')]||null:null,'attributes':[[db[_0x7b2e('0x1f')]['fn']('COUNT',db[_0x7b2e('0x1f')]['col']('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x7b2e('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0x7b2e('0x21')],[db[_0x7b2e('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x7b2e('0x20')](_0x7b2e('0x22')))),_0x7b2e('0x23')],[db['sequelize']['fn'](_0x7b2e('0x24'),db['sequelize']['fn']('IF',db[_0x7b2e('0x1f')][_0x7b2e('0x20')](_0x7b2e('0x25')))),_0x7b2e('0x26')],[db['sequelize']['fn']('AVG',db[_0x7b2e('0x1f')]['fn']('IF',db[_0x7b2e('0x1f')][_0x7b2e('0x20')](_0x7b2e('0x27')))),_0x7b2e('0x28')],[db[_0x7b2e('0x1f')]['fn'](_0x7b2e('0x29'),db['sequelize']['fn']('IF',db[_0x7b2e('0x1f')][_0x7b2e('0x20')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x7b2e('0x2a')]]})[_0x7b2e('0xd')](function(_0x2eae95){logger[_0x7b2e('0xe')](_0x7b2e('0x2b'),_0xddc7ff);logger[_0x7b2e('0x11')]('AvgHandleTime',_0xddc7ff,JSON['stringify'](_0x2eae95));_0x2f48a8(_0x2eae95);})[_0x7b2e('0x17')](function(_0x2909a8){logger[_0x7b2e('0x13')](_0x7b2e('0x2b'),_0x2909a8[_0x7b2e('0x15')],_0xddc7ff);_0x291f1c(_0x101a33[_0x7b2e('0x13')](0x1f4,_0x2909a8[_0x7b2e('0x15')]));});});};exports[_0x7b2e('0x2c')]=function(_0x1912e6){var _0x4988e6=this;return new Promise(function(_0x1c28c2,_0x169d19){return db[_0x7b2e('0x19')][_0x7b2e('0x2d')]({'raw':_0x1912e6[_0x7b2e('0x1b')]?_0x1912e6[_0x7b2e('0x1b')][_0x7b2e('0x1c')]===undefined?!![]:![]:!![],'where':_0x1912e6[_0x7b2e('0x1b')]?_0x1912e6[_0x7b2e('0x1b')][_0x7b2e('0x1e')]||null:null,'attributes':[[_0x7b2e('0x2e'),_0x7b2e('0x2f')],[db[_0x7b2e('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7b2e('0x1f')][_0x7b2e('0x20')](_0x7b2e('0x30')))),'outboundNoSuchCallsDay'],[db[_0x7b2e('0x1f')]['fn'](_0x7b2e('0x24'),db[_0x7b2e('0x1f')]['fn']('IF',db[_0x7b2e('0x1f')][_0x7b2e('0x20')](_0x7b2e('0x31')))),'outboundNoAnswerCallsDay'],[db[_0x7b2e('0x1f')]['fn'](_0x7b2e('0x24'),db[_0x7b2e('0x1f')]['fn']('IF',db[_0x7b2e('0x1f')]['literal'](_0x7b2e('0x32')))),'outboundAnswerCallsDay'],[db[_0x7b2e('0x1f')]['fn'](_0x7b2e('0x24'),db['sequelize']['fn']('IF',db[_0x7b2e('0x1f')][_0x7b2e('0x20')](_0x7b2e('0x33')))),'outboundBusyCallsDay'],[db[_0x7b2e('0x1f')]['fn'](_0x7b2e('0x24'),db[_0x7b2e('0x1f')]['fn']('IF',db[_0x7b2e('0x1f')][_0x7b2e('0x20')](_0x7b2e('0x34')))),'outboundCongestionCallsDay'],[db[_0x7b2e('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7b2e('0x1f')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x7b2e('0x35')],[db[_0x7b2e('0x1f')]['fn']('COUNT',db[_0x7b2e('0x1f')]['fn']('IF',db[_0x7b2e('0x1f')]['literal'](_0x7b2e('0x36')))),_0x7b2e('0x37')],[db[_0x7b2e('0x1f')]['fn'](_0x7b2e('0x24'),db[_0x7b2e('0x1f')]['fn']('IF',db[_0x7b2e('0x1f')][_0x7b2e('0x20')](_0x7b2e('0x38')))),_0x7b2e('0x39')],[db[_0x7b2e('0x1f')]['fn'](_0x7b2e('0x24'),db[_0x7b2e('0x1f')]['fn']('IF',db[_0x7b2e('0x1f')][_0x7b2e('0x20')](_0x7b2e('0x3a')))),'outboundBlacklistCallsDay'],[db['sequelize']['fn'](_0x7b2e('0x24'),db['sequelize']['fn']('IF',db[_0x7b2e('0x1f')][_0x7b2e('0x20')](_0x7b2e('0x3b')))),_0x7b2e('0x3c')],[db[_0x7b2e('0x1f')]['fn'](_0x7b2e('0x24'),db['sequelize']['fn']('IF',db[_0x7b2e('0x1f')][_0x7b2e('0x20')](_0x7b2e('0x3d')))),_0x7b2e('0x3e')],[db[_0x7b2e('0x1f')]['fn']('COUNT',db[_0x7b2e('0x1f')]['fn']('IF',db[_0x7b2e('0x1f')][_0x7b2e('0x20')]('`state`\x20=\x2016,\x201,\x20null'))),_0x7b2e('0x3f')],[db[_0x7b2e('0x1f')]['fn'](_0x7b2e('0x24'),db[_0x7b2e('0x1f')]['fn']('IF',db[_0x7b2e('0x1f')][_0x7b2e('0x20')]('`state`\x20=\x2020,\x201,\x20null'))),_0x7b2e('0x3e')],[db['sequelize']['fn'](_0x7b2e('0x24'),db[_0x7b2e('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x7b2e('0x40')))),_0x7b2e('0x41')]],'group':[_0x7b2e('0x2e')]})[_0x7b2e('0xd')](function(_0x50e781){logger[_0x7b2e('0xe')]('GetVoiceQueueHopperHistory',_0x1912e6);logger[_0x7b2e('0x11')](_0x7b2e('0x2c'),_0x1912e6,JSON[_0x7b2e('0x1d')](_0x50e781));_0x1c28c2(_0x50e781);})[_0x7b2e('0x17')](function(_0x449fb7){logger[_0x7b2e('0x13')]('GetVoiceQueueHopperHistory',_0x449fb7[_0x7b2e('0x15')],_0x1912e6);_0x169d19(_0x4988e6[_0x7b2e('0x13')](0x1f4,_0x449fb7[_0x7b2e('0x15')]));});});};exports[_0x7b2e('0x42')]=function(_0x4af0cb){var _0x1b3716=this;return new Promise(function(_0xe608d9,_0x55fe59){return db[_0x7b2e('0x19')][_0x7b2e('0x2d')]({'raw':_0x4af0cb['options']?_0x4af0cb[_0x7b2e('0x1b')][_0x7b2e('0x1c')]===undefined?!![]:![]:!![],'where':_0x4af0cb[_0x7b2e('0x1b')]?_0x4af0cb[_0x7b2e('0x1b')][_0x7b2e('0x1e')]||null:null,'attributes':[[_0x7b2e('0x2e'),_0x7b2e('0x2f')],[db[_0x7b2e('0x1f')]['fn']('COUNT',db[_0x7b2e('0x1f')]['col']('id')),_0x7b2e('0x43')],[db[_0x7b2e('0x1f')]['fn'](_0x7b2e('0x24'),db[_0x7b2e('0x1f')]['fn']('IF',db['sequelize'][_0x7b2e('0x20')](_0x7b2e('0x32')))),_0x7b2e('0x44')]],'group':[_0x7b2e('0x2e')]})[_0x7b2e('0xd')](function(_0x479fcb){logger[_0x7b2e('0xe')](_0x7b2e('0x42'),_0x4af0cb);logger[_0x7b2e('0x11')](_0x7b2e('0x42'),_0x4af0cb,JSON[_0x7b2e('0x1d')](_0x479fcb));_0xe608d9(_0x479fcb);})[_0x7b2e('0x17')](function(_0x247fec){logger[_0x7b2e('0x13')](_0x7b2e('0x42'),_0x247fec[_0x7b2e('0x15')],_0x4af0cb);_0x55fe59(_0x1b3716['error'](0x1f4,_0x247fec[_0x7b2e('0x15')]));});});}; \ No newline at end of file +var _0xbb84=['name','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','where','col','ivrTotalCallsDays','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','raw','debug','AvgHandleTime','findAll','options','sequelize','predictiveIntervalTotalCalls','COUNT','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign'];(function(_0x10e653,_0x59f1cc){var _0x328dfd=function(_0x2bc428){while(--_0x2bc428){_0x10e653['push'](_0x10e653['shift']());}};_0x328dfd(++_0x59f1cc);}(_0xbb84,0x158));var _0x4bb8=function(_0x520c24,_0x3fb9af){_0x520c24=_0x520c24-0x0;var _0x377104=_0xbb84[_0x520c24];return _0x377104;};'use strict';var _=require(_0x4bb8('0x0'));var util=require(_0x4bb8('0x1'));var moment=require(_0x4bb8('0x2'));var BPromise=require(_0x4bb8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4bb8('0x4'));var db=require(_0x4bb8('0x5'))['db'];var utils=require(_0x4bb8('0x6'));var logger=require(_0x4bb8('0x7'))(_0x4bb8('0x8'));var config=require(_0x4bb8('0x9'));var jayson=require(_0x4bb8('0xa'));var client=jayson[_0x4bb8('0xb')][_0x4bb8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa06ba6,_0x34930b,_0xb4955c){return new BPromise(function(_0x255185,_0x366add){return client[_0x4bb8('0xd')](_0xa06ba6,_0xb4955c)[_0x4bb8('0xe')](function(_0x13e692){logger[_0x4bb8('0xf')](_0x4bb8('0x10'),_0x34930b,_0x4bb8('0x11'));logger['debug'](_0x4bb8('0x12'),_0x34930b,_0x4bb8('0x11'),JSON[_0x4bb8('0x13')](_0x13e692));if(_0x13e692[_0x4bb8('0x14')]){if(_0x13e692[_0x4bb8('0x14')][_0x4bb8('0x15')]===0x1f4){logger['error'](_0x4bb8('0x10'),_0x34930b,_0x13e692[_0x4bb8('0x14')]['message']);return _0x366add(_0x13e692[_0x4bb8('0x14')][_0x4bb8('0x16')]);}logger['error'](_0x4bb8('0x10'),_0x34930b,_0x13e692[_0x4bb8('0x14')][_0x4bb8('0x16')]);return _0x255185(_0x13e692['error'][_0x4bb8('0x16')]);}else{logger[_0x4bb8('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x34930b,_0x4bb8('0x11'));_0x255185(_0x13e692[_0x4bb8('0x17')][_0x4bb8('0x16')]);}})[_0x4bb8('0x18')](function(_0x38211d){logger[_0x4bb8('0x14')]('CmHopperHistory,\x20%s,\x20%s',_0x34930b,_0x38211d);_0x366add(_0x38211d);});});}exports[_0x4bb8('0x19')]=function(_0x301810){var _0x2136fd=this;return new Promise(function(_0x584d82,_0x2a726a){return db[_0x4bb8('0x1a')][_0x4bb8('0x1b')](_0x301810['body'],{'raw':_0x301810['options']?_0x301810['options'][_0x4bb8('0x1c')]===undefined?!![]:![]:!![]})[_0x4bb8('0xe')](function(_0x14a2cb){logger['info'](_0x4bb8('0x19'),_0x301810);logger[_0x4bb8('0x1d')](_0x4bb8('0x19'),_0x301810,JSON['stringify'](_0x14a2cb));_0x584d82(_0x14a2cb);})[_0x4bb8('0x18')](function(_0x45474d){logger[_0x4bb8('0x14')](_0x4bb8('0x19'),_0x45474d['message'],_0x301810);_0x2a726a(_0x2136fd['error'](0x1f4,_0x45474d['message']));});});};exports[_0x4bb8('0x1e')]=function(_0x2dfe9b){var _0x1e3ba8=this;return new Promise(function(_0x46ae3f,_0x479018){return db[_0x4bb8('0x1a')][_0x4bb8('0x1f')]({'raw':_0x2dfe9b['options']?_0x2dfe9b[_0x4bb8('0x20')][_0x4bb8('0x1c')]===undefined?!![]:![]:!![],'where':_0x2dfe9b[_0x4bb8('0x20')]?_0x2dfe9b[_0x4bb8('0x20')]['where']||null:null,'attributes':[[db[_0x4bb8('0x21')]['fn']('COUNT',db[_0x4bb8('0x21')]['col']('id')),_0x4bb8('0x22')],[db[_0x4bb8('0x21')]['fn'](_0x4bb8('0x23'),db[_0x4bb8('0x21')]['fn']('IF',db['sequelize'][_0x4bb8('0x24')]('`state`\x20=\x204,\x201,\x20null'))),_0x4bb8('0x25')],[db[_0x4bb8('0x21')]['fn']('COUNT',db[_0x4bb8('0x21')]['fn']('IF',db[_0x4bb8('0x21')][_0x4bb8('0x24')](_0x4bb8('0x26')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x4bb8('0x21')]['fn'](_0x4bb8('0x23'),db['sequelize']['fn']('IF',db[_0x4bb8('0x21')][_0x4bb8('0x24')](_0x4bb8('0x27')))),_0x4bb8('0x28')],[db[_0x4bb8('0x21')]['fn'](_0x4bb8('0x29'),db[_0x4bb8('0x21')]['fn']('IF',db[_0x4bb8('0x21')][_0x4bb8('0x24')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db[_0x4bb8('0x21')]['fn'](_0x4bb8('0x29'),db[_0x4bb8('0x21')]['fn']('IF',db[_0x4bb8('0x21')][_0x4bb8('0x24')](_0x4bb8('0x2a')))),_0x4bb8('0x2b')]]})[_0x4bb8('0xe')](function(_0x47a35a){logger[_0x4bb8('0xf')](_0x4bb8('0x1e'),_0x2dfe9b);logger[_0x4bb8('0x1d')](_0x4bb8('0x1e'),_0x2dfe9b,JSON[_0x4bb8('0x13')](_0x47a35a));_0x46ae3f(_0x47a35a);})[_0x4bb8('0x18')](function(_0x3d2ef5){logger['error'](_0x4bb8('0x1e'),_0x3d2ef5['message'],_0x2dfe9b);_0x479018(_0x1e3ba8[_0x4bb8('0x14')](0x1f4,_0x3d2ef5['message']));});});};exports[_0x4bb8('0x2c')]=function(_0x445d7c){var _0x5cb519=this;return new Promise(function(_0x4e91c6,_0x187e61){return db[_0x4bb8('0x1a')]['findAll']({'raw':_0x445d7c[_0x4bb8('0x20')]?_0x445d7c[_0x4bb8('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x445d7c[_0x4bb8('0x20')]?_0x445d7c[_0x4bb8('0x20')]['where']||null:null,'attributes':[[_0x4bb8('0x2d'),_0x4bb8('0x2e')],[db[_0x4bb8('0x21')]['fn'](_0x4bb8('0x23'),db[_0x4bb8('0x21')]['fn']('IF',db[_0x4bb8('0x21')][_0x4bb8('0x24')](_0x4bb8('0x2f')))),'outboundNoSuchCallsDay'],[db[_0x4bb8('0x21')]['fn'](_0x4bb8('0x23'),db[_0x4bb8('0x21')]['fn']('IF',db[_0x4bb8('0x21')][_0x4bb8('0x24')]('`state`\x20=\x203,\x201,\x20null'))),_0x4bb8('0x30')],[db[_0x4bb8('0x21')]['fn'](_0x4bb8('0x23'),db[_0x4bb8('0x21')]['fn']('IF',db[_0x4bb8('0x21')][_0x4bb8('0x24')](_0x4bb8('0x31')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x4bb8('0x23'),db[_0x4bb8('0x21')]['fn']('IF',db[_0x4bb8('0x21')]['literal']('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db[_0x4bb8('0x21')]['fn'](_0x4bb8('0x23'),db[_0x4bb8('0x21')]['fn']('IF',db[_0x4bb8('0x21')][_0x4bb8('0x24')](_0x4bb8('0x32')))),_0x4bb8('0x33')],[db[_0x4bb8('0x21')]['fn']('COUNT',db[_0x4bb8('0x21')]['fn']('IF',db[_0x4bb8('0x21')][_0x4bb8('0x24')](_0x4bb8('0x34')))),_0x4bb8('0x35')],[db[_0x4bb8('0x21')]['fn'](_0x4bb8('0x23'),db[_0x4bb8('0x21')]['fn']('IF',db['sequelize'][_0x4bb8('0x24')](_0x4bb8('0x36')))),'outboundDropCallsDayCallersExit'],[db[_0x4bb8('0x21')]['fn'](_0x4bb8('0x23'),db[_0x4bb8('0x21')]['fn']('IF',db['sequelize'][_0x4bb8('0x24')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db[_0x4bb8('0x21')]['fn'](_0x4bb8('0x23'),db[_0x4bb8('0x21')]['fn']('IF',db[_0x4bb8('0x21')][_0x4bb8('0x24')](_0x4bb8('0x37')))),'outboundBlacklistCallsDay'],[db[_0x4bb8('0x21')]['fn'](_0x4bb8('0x23'),db[_0x4bb8('0x21')]['fn']('IF',db[_0x4bb8('0x21')]['literal'](_0x4bb8('0x38')))),_0x4bb8('0x39')],[db[_0x4bb8('0x21')]['fn'](_0x4bb8('0x23'),db[_0x4bb8('0x21')]['fn']('IF',db['sequelize'][_0x4bb8('0x24')](_0x4bb8('0x3a')))),_0x4bb8('0x3b')],[db[_0x4bb8('0x21')]['fn'](_0x4bb8('0x23'),db[_0x4bb8('0x21')]['fn']('IF',db[_0x4bb8('0x21')][_0x4bb8('0x24')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn'](_0x4bb8('0x23'),db[_0x4bb8('0x21')]['fn']('IF',db[_0x4bb8('0x21')][_0x4bb8('0x24')]('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x4bb8('0x21')]['fn'](_0x4bb8('0x23'),db[_0x4bb8('0x21')]['fn']('IF',db[_0x4bb8('0x21')]['literal'](_0x4bb8('0x3c')))),'outboundReCallsDay']],'group':['campaign']})[_0x4bb8('0xe')](function(_0x49211b){logger['info'](_0x4bb8('0x2c'),_0x445d7c);logger[_0x4bb8('0x1d')](_0x4bb8('0x2c'),_0x445d7c,JSON[_0x4bb8('0x13')](_0x49211b));_0x4e91c6(_0x49211b);})[_0x4bb8('0x18')](function(_0x16c025){logger['error'](_0x4bb8('0x2c'),_0x16c025[_0x4bb8('0x16')],_0x445d7c);_0x187e61(_0x5cb519['error'](0x1f4,_0x16c025[_0x4bb8('0x16')]));});});};exports[_0x4bb8('0x3d')]=function(_0x311b9b){var _0x426563=this;return new Promise(function(_0x16e566,_0x3437be){return db[_0x4bb8('0x1a')][_0x4bb8('0x1f')]({'raw':_0x311b9b[_0x4bb8('0x20')]?_0x311b9b[_0x4bb8('0x20')][_0x4bb8('0x1c')]===undefined?!![]:![]:!![],'where':_0x311b9b[_0x4bb8('0x20')]?_0x311b9b[_0x4bb8('0x20')][_0x4bb8('0x3e')]||null:null,'attributes':[[_0x4bb8('0x2d'),_0x4bb8('0x2e')],[db[_0x4bb8('0x21')]['fn'](_0x4bb8('0x23'),db[_0x4bb8('0x21')][_0x4bb8('0x3f')]('id')),_0x4bb8('0x40')],[db[_0x4bb8('0x21')]['fn'](_0x4bb8('0x23'),db[_0x4bb8('0x21')]['fn']('IF',db[_0x4bb8('0x21')][_0x4bb8('0x24')](_0x4bb8('0x31')))),'ivrAnswerCallsDay']],'group':['campaign']})[_0x4bb8('0xe')](function(_0x45111f){logger[_0x4bb8('0xf')](_0x4bb8('0x3d'),_0x311b9b);logger[_0x4bb8('0x1d')](_0x4bb8('0x3d'),_0x311b9b,JSON['stringify'](_0x45111f));_0x16e566(_0x45111f);})[_0x4bb8('0x18')](function(_0x5af607){logger[_0x4bb8('0x14')](_0x4bb8('0x3d'),_0x5af607[_0x4bb8('0x16')],_0x311b9b);_0x3437be(_0x426563[_0x4bb8('0x14')](0x1f4,_0x5af607['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index f2f755f..ba7477f 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 _0x2a23=['get','describe','/:id','show','create','update','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated'];(function(_0xa9eaa0,_0x4ba2b4){var _0x30897a=function(_0x2caa01){while(--_0x2caa01){_0xa9eaa0['push'](_0xa9eaa0['shift']());}};_0x30897a(++_0x4ba2b4);}(_0x2a23,0xca));var _0x32a2=function(_0x5a42cc,_0x2fbc6c){_0x5a42cc=_0x5a42cc-0x0;var _0x44f9b9=_0x2a23[_0x5a42cc];return _0x44f9b9;};'use strict';var multer=require('multer');var util=require(_0x32a2('0x0'));var path=require(_0x32a2('0x1'));var timeout=require('connect-timeout');var express=require(_0x32a2('0x2'));var router=express[_0x32a2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x32a2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x32a2('0x5'));var controller=require(_0x32a2('0x6'));router['get']('/',auth[_0x32a2('0x7')](),controller['index']);router[_0x32a2('0x8')]('/describe',auth[_0x32a2('0x7')](),controller[_0x32a2('0x9')]);router[_0x32a2('0x8')](_0x32a2('0xa'),auth[_0x32a2('0x7')](),controller[_0x32a2('0xb')]);router['post']('/',auth[_0x32a2('0x7')](),controller[_0x32a2('0xc')]);router['put'](_0x32a2('0xa'),auth[_0x32a2('0x7')](),controller[_0x32a2('0xd')]);module[_0x32a2('0xe')]=router; \ No newline at end of file +var _0x23c4=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','put','update','exports'];(function(_0x35acf2,_0x299102){var _0x3c4c5a=function(_0x3d5fb3){while(--_0x3d5fb3){_0x35acf2['push'](_0x35acf2['shift']());}};_0x3c4c5a(++_0x299102);}(_0x23c4,0x110));var _0x423c=function(_0x3e6a06,_0x5ddcd6){_0x3e6a06=_0x3e6a06-0x0;var _0xcdc571=_0x23c4[_0x3e6a06];return _0xcdc571;};'use strict';var multer=require(_0x423c('0x0'));var util=require(_0x423c('0x1'));var path=require(_0x423c('0x2'));var timeout=require(_0x423c('0x3'));var express=require('express');var router=express[_0x423c('0x4')]();var fs_extra=require(_0x423c('0x5'));var auth=require(_0x423c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x423c('0x7'));var controller=require('./cmHopperHistory.controller');router[_0x423c('0x8')]('/',auth[_0x423c('0x9')](),controller['index']);router[_0x423c('0x8')](_0x423c('0xa'),auth[_0x423c('0x9')](),controller[_0x423c('0xb')]);router[_0x423c('0x8')](_0x423c('0xc'),auth[_0x423c('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x423c('0xd')](_0x423c('0xc'),auth['isAuthenticated'](),controller[_0x423c('0xe')]);module[_0x423c('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 78aa6fd..732481b 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 _0x27bf=['exports','STRING','name','sequelize'];(function(_0x4164c4,_0x397085){var _0x5451d5=function(_0x587419){while(--_0x587419){_0x4164c4['push'](_0x4164c4['shift']());}};_0x5451d5(++_0x397085);}(_0x27bf,0x117));var _0xf27b=function(_0x23c82c,_0x7f1bf1){_0x23c82c=_0x23c82c-0x0;var _0x2292a4=_0x27bf[_0x23c82c];return _0x2292a4;};'use strict';var Sequelize=require(_0xf27b('0x0'));module[_0xf27b('0x1')]={'name':{'type':Sequelize[_0xf27b('0x2')],'unique':_0xf27b('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf27b('0x2')]},'dialPrefix':{'type':Sequelize[_0xf27b('0x2')]}}; \ No newline at end of file +var _0xf6d1=['name','sequelize','exports','STRING'];(function(_0x4bea77,_0x2475de){var _0x55588b=function(_0x5328fc){while(--_0x5328fc){_0x4bea77['push'](_0x4bea77['shift']());}};_0x55588b(++_0x2475de);}(_0xf6d1,0x99));var _0x1f6d=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xf6d1[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require(_0x1f6d('0x0'));module[_0x1f6d('0x1')]={'name':{'type':Sequelize[_0x1f6d('0x2')],'unique':_0x1f6d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1f6d('0x2')]},'dialPrefix':{'type':Sequelize[_0x1f6d('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index b6b2f31..0ce74e1 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 _0x74fa=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','Disposition','findOne','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','success','dataValues','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','nolimit','getContactsCsv','ContactItemType','OrderBy','alias','select','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','from','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','text/csv','download','addCustomField','addCustomFields','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','cf_%s','getCustomFields','CmCustomField','findAndCountAll','getGlobalCustomFields','addAgents','omit','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','info','spread','eml-format','zip-dir','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Lists','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','CmList','count','includeAll','include','findAll','rows','catch','show','params','keys','create','body','user'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x74fa,0x19d));var _0xa74f=function(_0x5b066b,_0x35dffd){_0x5b066b=_0x5b066b-0x0;var _0x6b71d0=_0x74fa[_0x5b066b];return _0x6b71d0;};'use strict';var emlformat=require(_0xa74f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa74f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa74f('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa74f('0x3'));var util=require(_0xa74f('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xa74f('0x5'));var ejs=require(_0xa74f('0x6'));var fs=require('fs');var fs_extra=require(_0xa74f('0x7'));var _=require(_0xa74f('0x8'));var squel=require(_0xa74f('0x9'));var crypto=require(_0xa74f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa74f('0xb'));var toCsv=require(_0xa74f('0x5'));var querystring=require(_0xa74f('0xc'));var Papa=require(_0xa74f('0xd'));var Redis=require(_0xa74f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa74f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa74f('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa74f('0x11'));var licenseUtil=require(_0xa74f('0x12'));var db=require(_0xa74f('0x13'))['db'];var csv_results;config[_0xa74f('0x14')]=_[_0xa74f('0x15')](config[_0xa74f('0x14')],{'host':_0xa74f('0x16'),'port':0x18eb});var socket=require(_0xa74f('0x17'))(new Redis(config[_0xa74f('0x14')]));require(_0xa74f('0x18'))[_0xa74f('0x19')](socket);function respondWithStatusCode(_0x10cbe6,_0x5b4fd1){_0x5b4fd1=_0x5b4fd1||0xcc;return function(_0x2bf85f){if(_0x2bf85f){return _0x10cbe6[_0xa74f('0x1a')](_0x5b4fd1);}return _0x10cbe6[_0xa74f('0x1b')](_0x5b4fd1)[_0xa74f('0x1c')]();};}function respondWithResult(_0x2396df,_0x26b1de){_0x26b1de=_0x26b1de||0xc8;return function(_0x2df047){if(_0x2df047){return _0x2396df[_0xa74f('0x1b')](_0x26b1de)[_0xa74f('0x1d')](_0x2df047);}};}function respondWithFilteredResult(_0x248b2a,_0x3e6a7d){return function(_0x2aae0d){if(_0x2aae0d){var _0x50aa7c=typeof _0x3e6a7d[_0xa74f('0x1e')]===_0xa74f('0x1f')&&typeof _0x3e6a7d[_0xa74f('0x20')]===_0xa74f('0x1f');var _0x437a49=_0x2aae0d['count'];var _0x44322b=_0x50aa7c?0x0:_0x3e6a7d[_0xa74f('0x1e')];var _0x467006=_0x50aa7c?_0x2aae0d['count']:_0x3e6a7d['offset']+_0x3e6a7d[_0xa74f('0x20')];var _0x576765;if(_0x467006>=_0x437a49){_0x467006=_0x437a49;_0x576765=0xc8;}else{_0x576765=0xce;}_0x248b2a['status'](_0x576765);return _0x248b2a[_0xa74f('0x21')](_0xa74f('0x22'),_0x44322b+'-'+_0x467006+'/'+_0x437a49)[_0xa74f('0x1d')](_0x2aae0d);}return null;};}function patchUpdates(_0x53e599){return function(_0x37f8df){try{jsonpatch[_0xa74f('0x23')](_0x37f8df,_0x53e599,!![]);}catch(_0x2f028c){return BPromise[_0xa74f('0x24')](_0x2f028c);}return _0x37f8df[_0xa74f('0x25')]();};}function saveUpdates(_0x416a2a,_0x5c0bf2){return function(_0xdc78c1){if(_0xdc78c1){return _0xdc78c1[_0xa74f('0x26')](_0x416a2a)[_0xa74f('0x27')](function(_0x2f085f){return _0x2f085f;});}return null;};}function removeEntity(_0x3fdc6f,_0x28e697){return function(_0x1cec2d){if(_0x1cec2d){return _0x1cec2d[_0xa74f('0x28')]()[_0xa74f('0x27')](function(){var _0x2b372d=_0x1cec2d[_0xa74f('0x29')]({'plain':!![]});var _0x35a39a=_0xa74f('0x2a');return db['UserProfileResource'][_0xa74f('0x28')]({'where':{'type':_0x35a39a,'resourceId':_0x2b372d['id']}})[_0xa74f('0x27')](function(){return _0x1cec2d;});})[_0xa74f('0x27')](function(){_0x3fdc6f[_0xa74f('0x1b')](0xcc)[_0xa74f('0x1c')]();});}};}function handleEntityNotFound(_0x3bc4dd,_0x1e3590){return function(_0x3d37e0){if(!_0x3d37e0){_0x3bc4dd[_0xa74f('0x1a')](0x194);}return _0x3d37e0;};}function handleError(_0x4356e7,_0x4191e7){_0x4191e7=_0x4191e7||0x1f4;return function(_0x49f43e){logger[_0xa74f('0x2b')](_0x49f43e[_0xa74f('0x2c')]);if(_0x49f43e[_0xa74f('0x2d')]){delete _0x49f43e['name'];}_0x4356e7[_0xa74f('0x1b')](_0x4191e7)[_0xa74f('0x2e')](_0x49f43e);};}exports[_0xa74f('0x2f')]=function(_0x427485,_0x4c9e80){var _0x3a098e={},_0x3b73f8={},_0x44111e={'count':0x0,'rows':[]};var _0x1fee40=_[_0xa74f('0x30')](db['CmList'][_0xa74f('0x31')],function(_0x55904e){return{'name':_0x55904e[_0xa74f('0x32')],'type':_0x55904e[_0xa74f('0x33')][_0xa74f('0x34')]};});_0x3b73f8['model']=_[_0xa74f('0x30')](_0x1fee40,'name');_0x3b73f8[_0xa74f('0x35')]=_['keys'](_0x427485[_0xa74f('0x35')]);_0x3b73f8['filters']=_[_0xa74f('0x36')](_0x3b73f8[_0xa74f('0x37')],_0x3b73f8[_0xa74f('0x35')]);_0x3a098e[_0xa74f('0x38')]=_['intersection'](_0x3b73f8[_0xa74f('0x37')],qs[_0xa74f('0x39')](_0x427485[_0xa74f('0x35')][_0xa74f('0x39')]));_0x3a098e[_0xa74f('0x38')]=_0x3a098e['attributes'][_0xa74f('0x3a')]?_0x3a098e[_0xa74f('0x38')]:_0x3b73f8[_0xa74f('0x37')];if(!_0x427485[_0xa74f('0x35')][_0xa74f('0x3b')]('nolimit')){_0x3a098e[_0xa74f('0x20')]=qs['limit'](_0x427485['query']['limit']);_0x3a098e[_0xa74f('0x1e')]=qs[_0xa74f('0x1e')](_0x427485[_0xa74f('0x35')][_0xa74f('0x1e')]);}_0x3a098e[_0xa74f('0x3c')]=qs['sort'](_0x427485[_0xa74f('0x35')][_0xa74f('0x3d')]);_0x3a098e[_0xa74f('0x3e')]=qs[_0xa74f('0x3f')](_[_0xa74f('0x40')](_0x427485['query'],_0x3b73f8[_0xa74f('0x3f')]),_0x1fee40);if(_0x427485[_0xa74f('0x35')]['filter']){_0x3a098e[_0xa74f('0x3e')]=_['merge'](_0x3a098e['where'],{'$or':_['map'](_0x1fee40,function(_0x35d69e){if(_0x35d69e[_0xa74f('0x33')]!==_0xa74f('0x41')){var _0x357cfa={};_0x357cfa[_0x35d69e[_0xa74f('0x2d')]]={'$like':'%'+_0x427485[_0xa74f('0x35')][_0xa74f('0x42')]+'%'};return _0x357cfa;}})});}_0x3a098e=_[_0xa74f('0x43')]({},_0x3a098e,_0x427485[_0xa74f('0x44')]);var _0x652e3c={'where':_0x3a098e[_0xa74f('0x3e')]};return db[_0xa74f('0x45')][_0xa74f('0x46')](_0x652e3c)[_0xa74f('0x27')](function(_0x991bfa){_0x44111e[_0xa74f('0x46')]=_0x991bfa;if(_0x427485[_0xa74f('0x35')][_0xa74f('0x47')]){_0x3a098e[_0xa74f('0x48')]=[{'all':!![]}];}return db[_0xa74f('0x45')][_0xa74f('0x49')](_0x3a098e);})[_0xa74f('0x27')](function(_0x1f7494){_0x44111e[_0xa74f('0x4a')]=_0x1f7494;return _0x44111e;})[_0xa74f('0x27')](respondWithFilteredResult(_0x4c9e80,_0x3a098e))[_0xa74f('0x4b')](handleError(_0x4c9e80,null));};exports[_0xa74f('0x4c')]=function(_0x1d68cc,_0x21e89f){var _0x56b6cf={'raw':![],'where':{'id':_0x1d68cc[_0xa74f('0x4d')]['id']}},_0x2175be={};_0x2175be[_0xa74f('0x37')]=_[_0xa74f('0x4e')](db[_0xa74f('0x45')][_0xa74f('0x31')]);_0x2175be[_0xa74f('0x35')]=_[_0xa74f('0x4e')](_0x1d68cc[_0xa74f('0x35')]);_0x2175be[_0xa74f('0x3f')]=_[_0xa74f('0x36')](_0x2175be['model'],_0x2175be[_0xa74f('0x35')]);_0x56b6cf[_0xa74f('0x38')]=_[_0xa74f('0x36')](_0x2175be[_0xa74f('0x37')],qs[_0xa74f('0x39')](_0x1d68cc[_0xa74f('0x35')][_0xa74f('0x39')]));_0x56b6cf[_0xa74f('0x38')]=_0x56b6cf[_0xa74f('0x38')][_0xa74f('0x3a')]?_0x56b6cf[_0xa74f('0x38')]:_0x2175be[_0xa74f('0x37')];if(_0x1d68cc['query'][_0xa74f('0x47')]){_0x56b6cf[_0xa74f('0x48')]=[{'all':!![]}];}_0x56b6cf=_['merge']({},_0x56b6cf,_0x1d68cc['options']);return db[_0xa74f('0x45')]['find'](_0x56b6cf)[_0xa74f('0x27')](handleEntityNotFound(_0x21e89f,null))['then'](respondWithResult(_0x21e89f,null))[_0xa74f('0x4b')](handleError(_0x21e89f,null));};exports[_0xa74f('0x4f')]=function(_0x3672bb,_0x3ae02f){return db[_0xa74f('0x45')]['create'](_0x3672bb[_0xa74f('0x50')],{})[_0xa74f('0x27')](function(_0x3bd06b){var _0x27ce46=_0x3672bb[_0xa74f('0x51')][_0xa74f('0x29')]({'plain':!![]});if(!_0x27ce46)throw new Error(_0xa74f('0x52'));if(_0x27ce46[_0xa74f('0x53')]===_0xa74f('0x51')){var _0x2cd017=_0x3bd06b[_0xa74f('0x29')]({'plain':!![]});var _0x129557='Lists';return db['UserProfileSection'][_0xa74f('0x54')]({'where':{'name':_0x129557,'userProfileId':_0x27ce46[_0xa74f('0x55')]},'raw':!![]})[_0xa74f('0x27')](function(_0x345803){if(_0x345803&&_0x345803[_0xa74f('0x56')]===0x0){return db[_0xa74f('0x57')][_0xa74f('0x4f')]({'name':_0x2cd017[_0xa74f('0x2d')],'resourceId':_0x2cd017['id'],'type':_0x345803[_0xa74f('0x2d')],'sectionId':_0x345803['id']},{})[_0xa74f('0x27')](function(){return _0x3bd06b;});}else{return _0x3bd06b;}})[_0xa74f('0x4b')](function(_0x25c045){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25c045);throw _0x25c045;});}return _0x3bd06b;})[_0xa74f('0x27')](respondWithResult(_0x3ae02f,0xc9))[_0xa74f('0x4b')](handleError(_0x3ae02f,null));};exports['update']=function(_0xf245e6,_0xc6a22c){if(_0xf245e6[_0xa74f('0x50')]['id']){delete _0xf245e6[_0xa74f('0x50')]['id'];}return db[_0xa74f('0x45')][_0xa74f('0x54')]({'where':{'id':_0xf245e6[_0xa74f('0x4d')]['id']}})[_0xa74f('0x27')](handleEntityNotFound(_0xc6a22c,null))[_0xa74f('0x27')](saveUpdates(_0xf245e6[_0xa74f('0x50')],null))['then'](respondWithResult(_0xc6a22c,null))[_0xa74f('0x4b')](handleError(_0xc6a22c,null));};exports[_0xa74f('0x28')]=function(_0x2dcea3,_0x5d8eae){return db[_0xa74f('0x45')][_0xa74f('0x54')]({'where':{'id':_0x2dcea3[_0xa74f('0x4d')]['id']}})[_0xa74f('0x27')](handleEntityNotFound(_0x5d8eae,null))[_0xa74f('0x27')](removeEntity(_0x5d8eae,null))['catch'](handleError(_0x5d8eae,null));};exports[_0xa74f('0x58')]=function(_0x5aeddf,_0x3618be){return db[_0xa74f('0x45')][_0xa74f('0x58')]()[_0xa74f('0x27')](respondWithResult(_0x3618be,null))[_0xa74f('0x4b')](handleError(_0x3618be,null));};exports[_0xa74f('0x59')]=function(_0x56784c,_0x1d3504,_0x4aa6f7){if(_0x56784c['body']['id']){delete _0x56784c[_0xa74f('0x50')]['id'];}return db[_0xa74f('0x45')][_0xa74f('0x54')]({'where':{'id':_0x56784c['params']['id']}})[_0xa74f('0x27')](handleEntityNotFound(_0x1d3504,null))[_0xa74f('0x27')](function(_0x378df5){if(_0x378df5){_0x56784c[_0xa74f('0x50')]['ListId']=_0x378df5['id'];return db[_0xa74f('0x5a')][_0xa74f('0x4f')](_0x56784c[_0xa74f('0x50')]);}})[_0xa74f('0x27')](respondWithResult(_0x1d3504,null))['catch'](handleError(_0x1d3504,null));};exports['getDispositions']=function(_0x23eb50,_0xff912c,_0xdddadc){var _0x1f8b0b={'raw':![],'where':{}};var _0x189406={};var _0x4ed1d6={'count':0x0,'rows':[]};return db[_0xa74f('0x45')][_0xa74f('0x5b')]({'where':{'id':_0x23eb50['params']['id']}})[_0xa74f('0x27')](handleEntityNotFound(_0xff912c,null))[_0xa74f('0x27')](function(_0x19c43c){if(_0x19c43c){_0x189406[_0xa74f('0x37')]=_['keys'](db[_0xa74f('0x5a')]['rawAttributes']);_0x189406[_0xa74f('0x35')]=_[_0xa74f('0x4e')](_0x23eb50[_0xa74f('0x35')]);_0x189406[_0xa74f('0x3f')]=_['intersection'](_0x189406[_0xa74f('0x37')],_0x189406[_0xa74f('0x35')]);_0x1f8b0b['attributes']=_[_0xa74f('0x36')](_0x189406[_0xa74f('0x37')],qs[_0xa74f('0x39')](_0x23eb50[_0xa74f('0x35')][_0xa74f('0x39')]));_0x1f8b0b[_0xa74f('0x38')]=_0x1f8b0b[_0xa74f('0x38')][_0xa74f('0x3a')]?_0x1f8b0b[_0xa74f('0x38')]:_0x189406[_0xa74f('0x37')];if(!_0x23eb50[_0xa74f('0x35')]['hasOwnProperty']('nolimit')){_0x1f8b0b[_0xa74f('0x20')]=qs[_0xa74f('0x20')](_0x23eb50['query'][_0xa74f('0x20')]);_0x1f8b0b[_0xa74f('0x1e')]=qs['offset'](_0x23eb50[_0xa74f('0x35')]['offset']);}_0x1f8b0b[_0xa74f('0x3c')]=qs[_0xa74f('0x3d')](_0x23eb50[_0xa74f('0x35')][_0xa74f('0x3d')]);_0x1f8b0b[_0xa74f('0x3e')]=qs['filters'](_[_0xa74f('0x40')](_0x23eb50[_0xa74f('0x35')],_0x189406[_0xa74f('0x3f')]));_0x1f8b0b[_0xa74f('0x3e')]['ListId']=_0x19c43c['id'];if(_0x23eb50[_0xa74f('0x35')]['filter']){_0x1f8b0b[_0xa74f('0x3e')]=_[_0xa74f('0x43')](_0x1f8b0b['where'],{'$or':_['map'](_0x1f8b0b[_0xa74f('0x38')],function(_0x3e4e01){var _0x4db5cd={};_0x4db5cd[_0x3e4e01]={'$like':'%'+_0x23eb50[_0xa74f('0x35')][_0xa74f('0x42')]+'%'};return _0x4db5cd;})});}_0x1f8b0b=_[_0xa74f('0x43')]({},_0x1f8b0b,_0x23eb50[_0xa74f('0x44')]);return db[_0xa74f('0x5a')][_0xa74f('0x46')]({'where':_0x1f8b0b[_0xa74f('0x3e')]})[_0xa74f('0x27')](function(_0x40a921){_0x4ed1d6[_0xa74f('0x46')]=_0x40a921;if(_0x23eb50[_0xa74f('0x35')][_0xa74f('0x47')]){_0x1f8b0b[_0xa74f('0x48')]=[{'all':!![]}];}return db[_0xa74f('0x5a')]['findAll'](_0x1f8b0b);})[_0xa74f('0x27')](function(_0x4524d){_0x4ed1d6[_0xa74f('0x4a')]=_0x4524d;return _0x4ed1d6;});}})['then'](respondWithFilteredResult(_0xff912c,_0x1f8b0b))[_0xa74f('0x4b')](handleError(_0xff912c,null));};exports[_0xa74f('0x5c')]=function(_0x4d4aeb,_0x45068f,_0x36992c){return db['CmList']['find']({'where':{'id':_0x4d4aeb[_0xa74f('0x4d')]['id']}})[_0xa74f('0x27')](handleEntityNotFound(_0x45068f,null))[_0xa74f('0x27')](function(_0x4b0f09){if(_0x4b0f09){return _0x4b0f09[_0xa74f('0x5c')](_0x4d4aeb[_0xa74f('0x35')][_0xa74f('0x5d')]);}})[_0xa74f('0x27')](respondWithStatusCode(_0x45068f,null))[_0xa74f('0x4b')](handleError(_0x45068f,null));};exports[_0xa74f('0x5e')]=function(_0x104a05,_0x29dea8,_0x102038){return db[_0xa74f('0x45')][_0xa74f('0x54')]({'where':{'id':_0x104a05[_0xa74f('0x4d')]['id']}})[_0xa74f('0x27')](handleEntityNotFound(_0x29dea8,null))[_0xa74f('0x27')](function(_0x4041a3){if(_0x4041a3){var _0x35b7e3=[];var _0x4879b3={'success':[],'errors':[]};return db[_0xa74f('0x5f')][_0xa74f('0x58')]()[_0xa74f('0x27')](function(_0xafb2fc){if(_0x104a05[_0xa74f('0x50')][_0xa74f('0x60')]&&_[_0xa74f('0x61')](_0x104a05[_0xa74f('0x50')][_0xa74f('0x60')])){if(_0x104a05['body'][_0xa74f('0x60')]['length']){_0x104a05[_0xa74f('0x50')][_0xa74f('0x60')]=_0x104a05[_0xa74f('0x50')][_0xa74f('0x60')][_0xa74f('0x62')](';')+';';}else{_0x104a05[_0xa74f('0x50')][_0xa74f('0x60')]=null;}}else{_0x104a05[_0xa74f('0x50')][_0xa74f('0x60')]=null;}if(_0x104a05[_0xa74f('0x50')]&&_[_0xa74f('0x61')](_0x104a05['body'])){for(var _0x3bcd94=0x0;_0x3bcd94<_0x104a05[_0xa74f('0x50')][_0xa74f('0x3a')];_0x3bcd94+=0x1){_0x104a05[_0xa74f('0x50')][_0x3bcd94]['ListId']=_0x104a05['params']['id'];_0x35b7e3[_0xa74f('0x63')](_0x104a05[_0xa74f('0x50')][_0x3bcd94]);}return BPromise['each'](_0x35b7e3,function(_0x31c4da){return db[_0xa74f('0x5f')][_0xa74f('0x4f')](_['omit'](_0x31c4da,[_0xa74f('0x5d'),'id'])||{},{'fields':_['keys'](_0xafb2fc),'raw':!![]})['then'](function(_0x20fcf1){_0x4879b3[_0xa74f('0x64')]['push'](_0x20fcf1[_0xa74f('0x65')]);})[_0xa74f('0x4b')](function(_0x5169cc){_0x4879b3['errors']['push']({'data':_0x31c4da,'error':_0x5169cc[_0xa74f('0x66')]});});})[_0xa74f('0x27')](function(_0x49f52d){return _0x4879b3;})[_0xa74f('0x4b')](function(_0x14a026){return _0x14a026;});}else{_0x29dea8[_0xa74f('0x1b')](0x190)[_0xa74f('0x1d')]({'message':_0xa74f('0x67')});}});}})['then'](respondWithResult(_0x29dea8,null))[_0xa74f('0x4b')](handleError(_0x29dea8,null));};exports[_0xa74f('0x68')]=function(_0x105b9d,_0x4484ca,_0x36b458){var _0x5179ce;return db[_0xa74f('0x45')][_0xa74f('0x54')]({'where':{'id':_0x105b9d[_0xa74f('0x4d')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xa74f('0x69')}]})[_0xa74f('0x27')](handleEntityNotFound(_0x4484ca,null))[_0xa74f('0x27')](function(_0x59488c){if(_0x59488c){_0x5179ce=_0x59488c;return db[_0xa74f('0x5f')][_0xa74f('0x31')];}})[_0xa74f('0x27')](function(_0x5e1781){if(_0x5e1781){var _0x14083a={};var _0x105636={};_0x105636[_0xa74f('0x37')]=_[_0xa74f('0x6a')](_[_0xa74f('0x4e')](_0x5e1781),_[_0xa74f('0x30')](_0x5179ce[_0xa74f('0x69')],function(_0xe0f0d5){return util[_0xa74f('0x6b')](_0xa74f('0x6c'),_0xe0f0d5['id']);}));_0x105636['query']=_[_0xa74f('0x4e')](_0x105b9d[_0xa74f('0x35')]);_0x105636[_0xa74f('0x3f')]=_['intersection'](_0x105636[_0xa74f('0x37')],_0x105636['query']);_0x14083a[_0xa74f('0x38')]=_[_0xa74f('0x36')](_0x105636[_0xa74f('0x37')],qs['fields'](_0x105b9d['query']['fields']));_0x14083a['attributes']=_0x14083a[_0xa74f('0x38')][_0xa74f('0x3a')]?_0x14083a['attributes']:_0x105636[_0xa74f('0x37')];if(!_0x105b9d[_0xa74f('0x35')][_0xa74f('0x3b')](_0xa74f('0x6d'))){_0x14083a[_0xa74f('0x20')]=qs[_0xa74f('0x20')](_0x105b9d[_0xa74f('0x35')]['limit']);_0x14083a['offset']=qs['offset'](_0x105b9d['query']['offset']);}_0x14083a[_0xa74f('0x3c')]=qs['sort'](_0x105b9d[_0xa74f('0x35')][_0xa74f('0x3d')]);_0x14083a[_0xa74f('0x3e')]=qs[_0xa74f('0x3f')](_[_0xa74f('0x40')](_0x105b9d[_0xa74f('0x35')],_0x105636[_0xa74f('0x3f')]));_0x14083a['raw']=!![];if(_0x105b9d[_0xa74f('0x35')][_0xa74f('0x42')]){_0x14083a[_0xa74f('0x3e')]=_[_0xa74f('0x43')](_0x14083a[_0xa74f('0x3e')],{'$or':_[_0xa74f('0x30')](_0x14083a['attributes'],function(_0x24256b){var _0x4b037f={};_0x4b037f[_0x24256b]={'$like':'%'+_0x105b9d[_0xa74f('0x35')][_0xa74f('0x42')]+'%'};return _0x4b037f;})});}_0x14083a=_[_0xa74f('0x43')]({},_0x14083a,_0x105b9d[_0xa74f('0x44')]);return _0x5179ce[_0xa74f('0x68')](_0x14083a);}})[_0xa74f('0x27')](respondWithResult(_0x4484ca,null))['catch'](handleError(_0x4484ca,null));};exports[_0xa74f('0x6e')]=function(_0x136b92,_0x4f6dff,_0x16833e){var _0x605a10;var _0x390178;var _0x1e207a;var _0x53023a=_0x136b92[_0xa74f('0x4d')]['id'];csv_results=[];return db[_0xa74f('0x6f')][_0xa74f('0x49')]({'attributes':['id','name'],'raw':!![],'order':[_0xa74f('0x70')]})['then'](function(_0x165fce){_0x605a10=_0x165fce;var _0x5978c4=_['keys'](db[_0xa74f('0x5f')][_0xa74f('0x31')]);return db['CmCustomField'][_0xa74f('0x49')]({'raw':!![],'attributes':['id',_0xa74f('0x71')]})[_0xa74f('0x27')](function(_0x31ff90){_0x390178=_0x31ff90;var _0x23e044=squel[_0xa74f('0x72')]()[_0xa74f('0x39')](_0x5978c4)['from'](_0xa74f('0x73'),'c')[_0xa74f('0x3e')](_0xa74f('0x74'),_0x53023a)[_0xa74f('0x3e')](_0xa74f('0x75'))[_0xa74f('0x76')]();for(var _0x4b8009=0x0;_0x4b8009<_0x390178['length'];_0x4b8009++){_0x23e044[_0xa74f('0x77')](_0xa74f('0x78')+_0x390178[_0x4b8009]['id'],_0xa74f('0x79')+_0x390178[_0x4b8009][_0xa74f('0x71')]);}for(var _0x4b8009=0x0;_0x4b8009<_0x605a10['length'];_0x4b8009++){_0x23e044[_0xa74f('0x77')](squel[_0xa74f('0x72')]()['field']('item')[_0xa74f('0x7a')](_0xa74f('0x7b'))[_0xa74f('0x3e')](_0xa74f('0x7c'),_0x605a10[_0x4b8009]['id'])[_0xa74f('0x3e')](_0xa74f('0x7d')),'additionalPhone_'+_0x605a10[_0x4b8009][_0xa74f('0x2d')]);_0x23e044[_0xa74f('0x77')](squel[_0xa74f('0x72')]()['field'](_0xa74f('0x7e'))[_0xa74f('0x7a')](_0xa74f('0x7b'))['where'](_0xa74f('0x7c'),_0x605a10[_0x4b8009]['id'])[_0xa74f('0x3e')](_0xa74f('0x7d')),'description_additionalPhone_'+_0x605a10[_0x4b8009][_0xa74f('0x2d')]);}var _0x104523=[];_0x104523[_0xa74f('0x63')](_0x23e044[_0xa74f('0x7f')]());BPromise['each'](_0x104523,handleQuery)['then'](function(_0x180a2f){handleQuery(_0x23e044[_0xa74f('0x7f')]());var _0x9b57b=csv_results[0x0];if(!_[_0xa74f('0x80')](_0x9b57b)){var _0x1107b3=toCsv(_0x9b57b);var _0x38bf99=Date[_0xa74f('0x81')]();fs[_0xa74f('0x82')](util[_0xa74f('0x6b')](_0xa74f('0x83'),_0x53023a,_0x38bf99),_0x1107b3);_0x4f6dff['setHeader'](_0xa74f('0x84'),_0xa74f('0x85')+util['format'](_0xa74f('0x86'),_0x53023a,_0x38bf99));_0x4f6dff[_0xa74f('0x87')]('Content-type',_0xa74f('0x88'));return _0x4f6dff[_0xa74f('0x89')](util[_0xa74f('0x6b')]('/tmp/list_%d_%s.csv',_0x53023a,_0x38bf99));}else{return _0x4f6dff[_0xa74f('0x1a')](0xcc);}});});});};exports[_0xa74f('0x8a')]=function(_0x24c7e1,_0x19b543,_0x204087){var _0x2e31b1;delete _0x24c7e1[_0xa74f('0x50')]['id'];return db[_0xa74f('0x45')][_0xa74f('0x5b')]({'where':{'id':_0x24c7e1[_0xa74f('0x4d')]['id']}})[_0xa74f('0x27')](handleEntityNotFound(_0x19b543,null))[_0xa74f('0x27')](function(_0x251a6c){if(_0x251a6c){return db['sequelize']['transaction'](function(_0x40551e){return db['CmCustomField'][_0xa74f('0x4f')](_0x24c7e1[_0xa74f('0x50')],{'transaction':_0x40551e})[_0xa74f('0x27')](function(_0x5e06a5){_0x2e31b1=_0x5e06a5;return _0x251a6c[_0xa74f('0x8b')](_0x5e06a5,{'transaction':_0x40551e});})['then'](function(){var _0xf9f5cf={'type':db['Sequelize'][_0xa74f('0x8c')],'transaction':_0x40551e};switch(_0x24c7e1[_0xa74f('0x50')][_0xa74f('0x33')]){case _0xa74f('0x8d'):_0xf9f5cf[_0xa74f('0x33')]=db[_0xa74f('0x8e')][_0xa74f('0x8c')];break;case _0xa74f('0x8f'):_0xf9f5cf[_0xa74f('0x33')]=db[_0xa74f('0x8e')][_0xa74f('0x90')];break;case _0xa74f('0x91'):_0xf9f5cf[_0xa74f('0x33')]=db[_0xa74f('0x8e')][_0xa74f('0x92')];_0xf9f5cf[_0xa74f('0x93')]=![];break;default:}return db[_0xa74f('0x94')][_0xa74f('0x95')]['addColumn'](_0xa74f('0x73'),util[_0xa74f('0x6b')](_0xa74f('0x96'),_0x2e31b1['id']),_0xf9f5cf);})[_0xa74f('0x27')](function(){return _0x2e31b1;});});}})[_0xa74f('0x27')](respondWithResult(_0x19b543,null))[_0xa74f('0x4b')](handleError(_0x19b543,null));};exports[_0xa74f('0x97')]=function(_0x288ccd,_0x7d6e8f,_0x4936c8){var _0x425c4e={};var _0x307c50={};var _0x43877d;var _0x3c5bbf;return db[_0xa74f('0x45')]['findOne']({'where':{'id':_0x288ccd[_0xa74f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x7d6e8f,null))[_0xa74f('0x27')](function(_0x149922){if(_0x149922){_0x43877d=_0x149922;_0x307c50[_0xa74f('0x37')]=_[_0xa74f('0x4e')](db[_0xa74f('0x98')][_0xa74f('0x31')]);_0x307c50[_0xa74f('0x35')]=_['keys'](_0x288ccd[_0xa74f('0x35')]);_0x307c50[_0xa74f('0x3f')]=_[_0xa74f('0x36')](_0x307c50['model'],_0x307c50[_0xa74f('0x35')]);_0x425c4e[_0xa74f('0x38')]=_['intersection'](_0x307c50[_0xa74f('0x37')],qs[_0xa74f('0x39')](_0x288ccd[_0xa74f('0x35')][_0xa74f('0x39')]));_0x425c4e[_0xa74f('0x38')]=_0x425c4e[_0xa74f('0x38')]['length']?_0x425c4e[_0xa74f('0x38')]:_0x307c50[_0xa74f('0x37')];_0x425c4e[_0xa74f('0x3c')]=qs[_0xa74f('0x3d')](_0x288ccd[_0xa74f('0x35')][_0xa74f('0x3d')]);_0x425c4e[_0xa74f('0x3e')]=qs[_0xa74f('0x3f')](_['pick'](_0x288ccd[_0xa74f('0x35')],_0x307c50[_0xa74f('0x3f')]));_0x425c4e[_0xa74f('0x3e')]=_[_0xa74f('0x43')](_0x425c4e[_0xa74f('0x3e')],{'$or':[{'ListId':_0x149922['id']},{'ListId':null}]});if(_0x288ccd[_0xa74f('0x35')]['filter']){_0x425c4e[_0xa74f('0x3e')]=_['merge'](_0x425c4e[_0xa74f('0x3e')],{'$or':_['map'](_0x425c4e[_0xa74f('0x38')],function(_0x82d0a9){var _0x3e1037={};_0x3e1037[_0x82d0a9]={'$like':'%'+_0x288ccd[_0xa74f('0x35')][_0xa74f('0x42')]+'%'};return _0x3e1037;})});}_0x425c4e=_[_0xa74f('0x43')]({},_0x425c4e,_0x288ccd['options']);return db[_0xa74f('0x98')][_0xa74f('0x99')](_0x425c4e);}})[_0xa74f('0x27')](respondWithResult(_0x7d6e8f,null))[_0xa74f('0x4b')](handleError(_0x7d6e8f,null));};exports[_0xa74f('0x9a')]=function(_0x37c64e,_0x2c5fff){return db['CmCustomField']['findAndCountAll']({'where':{'ListId':null}})[_0xa74f('0x27')](handleEntityNotFound(_0x2c5fff,null))[_0xa74f('0x27')](function(_0x1f921a){return _0x1f921a;})[_0xa74f('0x27')](respondWithResult(_0x2c5fff,null))['catch'](handleError(_0x2c5fff,null));};exports[_0xa74f('0x9b')]=function(_0x4f4a99,_0x31e442,_0x444737){return db['CmList'][_0xa74f('0x54')]({'where':{'id':_0x4f4a99[_0xa74f('0x4d')]['id']}})[_0xa74f('0x27')](handleEntityNotFound(_0x31e442,null))[_0xa74f('0x27')](function(_0x1c0ee4){if(_0x1c0ee4){return _0x1c0ee4[_0xa74f('0x9b')](_0x4f4a99[_0xa74f('0x50')]['ids'],_[_0xa74f('0x9c')](_0x4f4a99[_0xa74f('0x50')],[_0xa74f('0x5d'),'id'])||{})['spread'](function(_0x464fdf){for(var _0x12315b=0x0;_0x12315b<_0x4f4a99['body']['ids'][_0xa74f('0x3a')];_0x12315b+=0x1){socket['emit'](_0xa74f('0x9d'),{'UserId':Number(_0x4f4a99[_0xa74f('0x50')][_0xa74f('0x5d')][_0x12315b]),'CmListId':Number(_0x4f4a99[_0xa74f('0x4d')]['id'])});}return _0x464fdf;});}})[_0xa74f('0x27')](respondWithResult(_0x31e442,null))[_0xa74f('0x4b')](handleError(_0x31e442,null));};exports[_0xa74f('0x9e')]=function(_0x1189e4,_0x494d3a,_0x3ab51d){return db[_0xa74f('0x45')][_0xa74f('0x54')]({'where':{'id':_0x1189e4[_0xa74f('0x4d')]['id']}})[_0xa74f('0x27')](handleEntityNotFound(_0x494d3a,null))[_0xa74f('0x27')](function(_0x429216){if(_0x429216){return _0x429216[_0xa74f('0x9e')](_0x1189e4[_0xa74f('0x35')][_0xa74f('0x5d')])[_0xa74f('0x27')](function(){if(_[_0xa74f('0x61')](_0x1189e4['query'][_0xa74f('0x5d')])){for(var _0x5ee7fd=0x0;_0x5ee7fd<_0x1189e4['query'][_0xa74f('0x5d')][_0xa74f('0x3a')];_0x5ee7fd+=0x1){socket[_0xa74f('0x9f')](_0xa74f('0xa0'),{'UserId':Number(_0x1189e4[_0xa74f('0x35')]['ids'][_0x5ee7fd]),'CmListId':Number(_0x1189e4[_0xa74f('0x4d')]['id'])});}}else{socket[_0xa74f('0x9f')](_0xa74f('0xa0'),{'UserId':Number(_0x1189e4[_0xa74f('0x35')]['ids']),'CmListId':Number(_0x1189e4[_0xa74f('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x494d3a,null))['catch'](handleError(_0x494d3a,null));};exports[_0xa74f('0xa1')]=function(_0x36efc6,_0x5dd6d8,_0x407ce1){var _0x195546={};var _0x86c6b4={};var _0x135258;var _0x12d6b4;return db[_0xa74f('0x45')][_0xa74f('0x5b')]({'where':{'id':_0x36efc6[_0xa74f('0x4d')]['id']}})[_0xa74f('0x27')](handleEntityNotFound(_0x5dd6d8,null))[_0xa74f('0x27')](function(_0x2bd48f){if(_0x2bd48f){_0x135258=_0x2bd48f;_0x86c6b4[_0xa74f('0x37')]=_[_0xa74f('0x4e')](db[_0xa74f('0xa2')][_0xa74f('0x31')]);_0x86c6b4[_0xa74f('0x35')]=_['keys'](_0x36efc6['query']);_0x86c6b4[_0xa74f('0x3f')]=_[_0xa74f('0x36')](_0x86c6b4[_0xa74f('0x37')],_0x86c6b4[_0xa74f('0x35')]);_0x195546[_0xa74f('0x38')]=_['intersection'](_0x86c6b4[_0xa74f('0x37')],qs[_0xa74f('0x39')](_0x36efc6['query']['fields']));_0x195546['attributes']=_0x195546[_0xa74f('0x38')][_0xa74f('0x3a')]?_0x195546[_0xa74f('0x38')]:_0x86c6b4['model'];_0x195546['order']=qs['sort'](_0x36efc6[_0xa74f('0x35')][_0xa74f('0x3d')]);_0x195546[_0xa74f('0x3e')]=qs['filters'](_[_0xa74f('0x40')](_0x36efc6[_0xa74f('0x35')],_0x86c6b4[_0xa74f('0x3f')]));if(_0x36efc6[_0xa74f('0x35')][_0xa74f('0x42')]){_0x195546[_0xa74f('0x3e')]=_[_0xa74f('0x43')](_0x195546[_0xa74f('0x3e')],{'$or':_['map'](_0x195546[_0xa74f('0x38')],function(_0x171567){var _0x4819be={};_0x4819be[_0x171567]={'$like':'%'+_0x36efc6[_0xa74f('0x35')][_0xa74f('0x42')]+'%'};return _0x4819be;})});}_0x195546=_[_0xa74f('0x43')]({},_0x195546,_0x36efc6[_0xa74f('0x44')]);return _0x135258[_0xa74f('0xa1')](_0x195546);}})['then'](function(_0x57d92e){if(_0x57d92e){_0x12d6b4=_0x57d92e[_0xa74f('0x3a')];if(!_0x36efc6[_0xa74f('0x35')][_0xa74f('0x3b')](_0xa74f('0x6d'))){_0x195546['limit']=qs[_0xa74f('0x20')](_0x36efc6[_0xa74f('0x35')][_0xa74f('0x20')]);_0x195546[_0xa74f('0x1e')]=qs[_0xa74f('0x1e')](_0x36efc6[_0xa74f('0x35')][_0xa74f('0x1e')]);}return _0x135258[_0xa74f('0xa1')](_0x195546);}})[_0xa74f('0x27')](function(_0x113100){if(_0x113100){return _0x113100?{'count':_0x12d6b4,'rows':_0x113100}:null;}})['then'](respondWithResult(_0x5dd6d8,null))[_0xa74f('0x4b')](handleError(_0x5dd6d8,null));};function handleQuery(_0x155368){logger[_0xa74f('0xa3')](_0x155368);return db[_0xa74f('0x94')][_0xa74f('0x35')](_0x155368)[_0xa74f('0xa4')](function(_0x5c74a0){csv_results['push'](_0x5c74a0);})['catch'](function(_0x1fec1b){logger[_0xa74f('0x2b')](_0x1fec1b[_0xa74f('0x66')]);});} \ No newline at end of file +var _0xda11=['CmContact','tags','isArray','join','each','success','push','errors','getContacts','CmCustomField','CustomFields','concat','cf_%d','filter','getContactsCsv','ContactItemType','alias','select','from','cm_contacts','field','c.cf_','customField_','item','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','cm_contact_has_items','description_additionalPhone_','toString','isEmpty','now','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','addColumn','cf_%s','getCustomFields','findAndCountAll','addAgents','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','message','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','Lists','UserProfileResource','error','stack','name','CmList','fieldName','type','map','keys','query','intersection','attributes','model','fields','length','nolimit','sort','pick','filters','merge','where','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','include','find','create','body','get','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','hasOwnProperty','order','findAll','removeDispositions','ids'];(function(_0x14a83c,_0x394b54){var _0x345d56=function(_0x34cfcd){while(--_0x34cfcd){_0x14a83c['push'](_0x14a83c['shift']());}};_0x345d56(++_0x394b54);}(_0xda11,0xde));var _0x1da1=function(_0x1c4fe8,_0x1927d5){_0x1c4fe8=_0x1c4fe8-0x0;var _0x866113=_0xda11[_0x1c4fe8];return _0x866113;};'use strict';var emlformat=require(_0x1da1('0x0'));var rimraf=require(_0x1da1('0x1'));var zipdir=require(_0x1da1('0x2'));var jsonpatch=require(_0x1da1('0x3'));var rp=require('request-promise');var moment=require(_0x1da1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1da1('0x5'));var util=require(_0x1da1('0x6'));var path=require(_0x1da1('0x7'));var sox=require(_0x1da1('0x8'));var csv=require(_0x1da1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1da1('0xa'));var squel=require(_0x1da1('0xb'));var crypto=require('crypto');var jsforce=require(_0x1da1('0xc'));var deskjs=require(_0x1da1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1da1('0xe'));var Papa=require(_0x1da1('0xf'));var Redis=require(_0x1da1('0x10'));var authService=require(_0x1da1('0x11'));var qs=require(_0x1da1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1da1('0x13'));var logger=require('../../config/logger')(_0x1da1('0x14'));var utils=require('../../config/utils');var config=require(_0x1da1('0x15'));var licenseUtil=require(_0x1da1('0x16'));var db=require('../../mysqldb')['db'];var csv_results;config['redis']=_[_0x1da1('0x17')](config[_0x1da1('0x18')],{'host':_0x1da1('0x19'),'port':0x18eb});var socket=require(_0x1da1('0x1a'))(new Redis(config[_0x1da1('0x18')]));require('./cmList.socket')[_0x1da1('0x1b')](socket);function respondWithStatusCode(_0x551153,_0x1788ef){_0x1788ef=_0x1788ef||0xcc;return function(_0x21b6d2){if(_0x21b6d2){return _0x551153[_0x1da1('0x1c')](_0x1788ef);}return _0x551153['status'](_0x1788ef)[_0x1da1('0x1d')]();};}function respondWithResult(_0x36f630,_0x17e1f1){_0x17e1f1=_0x17e1f1||0xc8;return function(_0x59d039){if(_0x59d039){return _0x36f630[_0x1da1('0x1e')](_0x17e1f1)[_0x1da1('0x1f')](_0x59d039);}};}function respondWithFilteredResult(_0x29cb40,_0x1a1951){return function(_0x32ae17){if(_0x32ae17){var _0xc9a2=typeof _0x1a1951[_0x1da1('0x20')]===_0x1da1('0x21')&&typeof _0x1a1951[_0x1da1('0x22')]==='undefined';var _0x4ff95e=_0x32ae17[_0x1da1('0x23')];var _0x133455=_0xc9a2?0x0:_0x1a1951['offset'];var _0x3fc497=_0xc9a2?_0x32ae17['count']:_0x1a1951[_0x1da1('0x20')]+_0x1a1951[_0x1da1('0x22')];var _0x5b9a05;if(_0x3fc497>=_0x4ff95e){_0x3fc497=_0x4ff95e;_0x5b9a05=0xc8;}else{_0x5b9a05=0xce;}_0x29cb40['status'](_0x5b9a05);return _0x29cb40[_0x1da1('0x24')](_0x1da1('0x25'),_0x133455+'-'+_0x3fc497+'/'+_0x4ff95e)[_0x1da1('0x1f')](_0x32ae17);}return null;};}function patchUpdates(_0x417233){return function(_0x267de5){try{jsonpatch[_0x1da1('0x26')](_0x267de5,_0x417233,!![]);}catch(_0x4428d8){return BPromise['reject'](_0x4428d8);}return _0x267de5[_0x1da1('0x27')]();};}function saveUpdates(_0x5c31b3,_0x4f6f29){return function(_0x28b215){if(_0x28b215){return _0x28b215[_0x1da1('0x28')](_0x5c31b3)[_0x1da1('0x29')](function(_0x52cadc){return _0x52cadc;});}return null;};}function removeEntity(_0x4f75c2,_0x120ec8){return function(_0x60fe3f){if(_0x60fe3f){return _0x60fe3f[_0x1da1('0x2a')]()[_0x1da1('0x29')](function(){var _0x29f2f4=_0x60fe3f['get']({'plain':!![]});var _0x5e0394=_0x1da1('0x2b');return db[_0x1da1('0x2c')][_0x1da1('0x2a')]({'where':{'type':_0x5e0394,'resourceId':_0x29f2f4['id']}})[_0x1da1('0x29')](function(){return _0x60fe3f;});})[_0x1da1('0x29')](function(){_0x4f75c2[_0x1da1('0x1e')](0xcc)[_0x1da1('0x1d')]();});}};}function handleEntityNotFound(_0x2bd85b,_0x10eadc){return function(_0x73badb){if(!_0x73badb){_0x2bd85b[_0x1da1('0x1c')](0x194);}return _0x73badb;};}function handleError(_0x576e59,_0x49458b){_0x49458b=_0x49458b||0x1f4;return function(_0x5bbe02){logger[_0x1da1('0x2d')](_0x5bbe02[_0x1da1('0x2e')]);if(_0x5bbe02[_0x1da1('0x2f')]){delete _0x5bbe02[_0x1da1('0x2f')];}_0x576e59[_0x1da1('0x1e')](_0x49458b)['send'](_0x5bbe02);};}exports['index']=function(_0x57c28a,_0x5941e3){var _0x4ea0e4={},_0x40d4b8={},_0x50e582={'count':0x0,'rows':[]};var _0x1ad5ea=_['map'](db[_0x1da1('0x30')]['rawAttributes'],function(_0x2d7cb1){return{'name':_0x2d7cb1[_0x1da1('0x31')],'type':_0x2d7cb1[_0x1da1('0x32')]['key']};});_0x40d4b8['model']=_[_0x1da1('0x33')](_0x1ad5ea,_0x1da1('0x2f'));_0x40d4b8['query']=_[_0x1da1('0x34')](_0x57c28a[_0x1da1('0x35')]);_0x40d4b8['filters']=_[_0x1da1('0x36')](_0x40d4b8['model'],_0x40d4b8[_0x1da1('0x35')]);_0x4ea0e4[_0x1da1('0x37')]=_['intersection'](_0x40d4b8[_0x1da1('0x38')],qs[_0x1da1('0x39')](_0x57c28a['query'][_0x1da1('0x39')]));_0x4ea0e4[_0x1da1('0x37')]=_0x4ea0e4[_0x1da1('0x37')][_0x1da1('0x3a')]?_0x4ea0e4[_0x1da1('0x37')]:_0x40d4b8['model'];if(!_0x57c28a[_0x1da1('0x35')]['hasOwnProperty'](_0x1da1('0x3b'))){_0x4ea0e4[_0x1da1('0x22')]=qs[_0x1da1('0x22')](_0x57c28a[_0x1da1('0x35')][_0x1da1('0x22')]);_0x4ea0e4[_0x1da1('0x20')]=qs[_0x1da1('0x20')](_0x57c28a['query'][_0x1da1('0x20')]);}_0x4ea0e4['order']=qs[_0x1da1('0x3c')](_0x57c28a[_0x1da1('0x35')][_0x1da1('0x3c')]);_0x4ea0e4['where']=qs['filters'](_[_0x1da1('0x3d')](_0x57c28a[_0x1da1('0x35')],_0x40d4b8[_0x1da1('0x3e')]),_0x1ad5ea);if(_0x57c28a[_0x1da1('0x35')]['filter']){_0x4ea0e4['where']=_[_0x1da1('0x3f')](_0x4ea0e4[_0x1da1('0x40')],{'$or':_[_0x1da1('0x33')](_0x1ad5ea,function(_0x25192e){if(_0x25192e['type']!==_0x1da1('0x41')){var _0x39603a={};_0x39603a[_0x25192e['name']]={'$like':'%'+_0x57c28a[_0x1da1('0x35')]['filter']+'%'};return _0x39603a;}})});}_0x4ea0e4=_[_0x1da1('0x3f')]({},_0x4ea0e4,_0x57c28a[_0x1da1('0x42')]);var _0x4a1d41={'where':_0x4ea0e4['where']};return db[_0x1da1('0x30')][_0x1da1('0x23')](_0x4a1d41)[_0x1da1('0x29')](function(_0x5133b4){_0x50e582[_0x1da1('0x23')]=_0x5133b4;if(_0x57c28a['query'][_0x1da1('0x43')]){_0x4ea0e4['include']=[{'all':!![]}];}return db['CmList']['findAll'](_0x4ea0e4);})['then'](function(_0x4ee24b){_0x50e582[_0x1da1('0x44')]=_0x4ee24b;return _0x50e582;})[_0x1da1('0x29')](respondWithFilteredResult(_0x5941e3,_0x4ea0e4))[_0x1da1('0x45')](handleError(_0x5941e3,null));};exports[_0x1da1('0x46')]=function(_0x4c26f6,_0xf7f919){var _0x2f7955={'raw':![],'where':{'id':_0x4c26f6[_0x1da1('0x47')]['id']}},_0x79de1a={};_0x79de1a[_0x1da1('0x38')]=_[_0x1da1('0x34')](db[_0x1da1('0x30')][_0x1da1('0x48')]);_0x79de1a[_0x1da1('0x35')]=_[_0x1da1('0x34')](_0x4c26f6['query']);_0x79de1a['filters']=_[_0x1da1('0x36')](_0x79de1a[_0x1da1('0x38')],_0x79de1a[_0x1da1('0x35')]);_0x2f7955[_0x1da1('0x37')]=_['intersection'](_0x79de1a['model'],qs['fields'](_0x4c26f6[_0x1da1('0x35')][_0x1da1('0x39')]));_0x2f7955['attributes']=_0x2f7955[_0x1da1('0x37')][_0x1da1('0x3a')]?_0x2f7955['attributes']:_0x79de1a[_0x1da1('0x38')];if(_0x4c26f6['query'][_0x1da1('0x43')]){_0x2f7955[_0x1da1('0x49')]=[{'all':!![]}];}_0x2f7955=_[_0x1da1('0x3f')]({},_0x2f7955,_0x4c26f6[_0x1da1('0x42')]);return db['CmList'][_0x1da1('0x4a')](_0x2f7955)[_0x1da1('0x29')](handleEntityNotFound(_0xf7f919,null))[_0x1da1('0x29')](respondWithResult(_0xf7f919,null))[_0x1da1('0x45')](handleError(_0xf7f919,null));};exports[_0x1da1('0x4b')]=function(_0x130ca4,_0x406ecb){return db[_0x1da1('0x30')][_0x1da1('0x4b')](_0x130ca4[_0x1da1('0x4c')],{})[_0x1da1('0x29')](function(_0x153523){var _0x38d990=_0x130ca4['user'][_0x1da1('0x4d')]({'plain':!![]});if(!_0x38d990)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38d990['role']==='user'){var _0x36bff9=_0x153523['get']({'plain':!![]});var _0x21798c=_0x1da1('0x2b');return db['UserProfileSection'][_0x1da1('0x4a')]({'where':{'name':_0x21798c,'userProfileId':_0x38d990['userProfileId']},'raw':!![]})[_0x1da1('0x29')](function(_0x7b9440){if(_0x7b9440&&_0x7b9440['autoAssociation']===0x0){return db[_0x1da1('0x2c')][_0x1da1('0x4b')]({'name':_0x36bff9[_0x1da1('0x2f')],'resourceId':_0x36bff9['id'],'type':_0x7b9440[_0x1da1('0x2f')],'sectionId':_0x7b9440['id']},{})['then'](function(){return _0x153523;});}else{return _0x153523;}})[_0x1da1('0x45')](function(_0x5b273e){logger[_0x1da1('0x2d')](_0x1da1('0x4e'),_0x5b273e);throw _0x5b273e;});}return _0x153523;})[_0x1da1('0x29')](respondWithResult(_0x406ecb,0xc9))[_0x1da1('0x45')](handleError(_0x406ecb,null));};exports[_0x1da1('0x28')]=function(_0x202a59,_0x58e45b){if(_0x202a59[_0x1da1('0x4c')]['id']){delete _0x202a59[_0x1da1('0x4c')]['id'];}return db[_0x1da1('0x30')]['find']({'where':{'id':_0x202a59['params']['id']}})[_0x1da1('0x29')](handleEntityNotFound(_0x58e45b,null))['then'](saveUpdates(_0x202a59[_0x1da1('0x4c')],null))[_0x1da1('0x29')](respondWithResult(_0x58e45b,null))[_0x1da1('0x45')](handleError(_0x58e45b,null));};exports[_0x1da1('0x2a')]=function(_0x41c347,_0x70ce11){return db[_0x1da1('0x30')][_0x1da1('0x4a')]({'where':{'id':_0x41c347[_0x1da1('0x47')]['id']}})[_0x1da1('0x29')](handleEntityNotFound(_0x70ce11,null))[_0x1da1('0x29')](removeEntity(_0x70ce11,null))[_0x1da1('0x45')](handleError(_0x70ce11,null));};exports[_0x1da1('0x4f')]=function(_0x52fa35,_0x21a5dd){return db[_0x1da1('0x30')][_0x1da1('0x4f')]()[_0x1da1('0x29')](respondWithResult(_0x21a5dd,null))[_0x1da1('0x45')](handleError(_0x21a5dd,null));};exports[_0x1da1('0x50')]=function(_0x4379a8,_0x26f0ef,_0x44f253){if(_0x4379a8[_0x1da1('0x4c')]['id']){delete _0x4379a8[_0x1da1('0x4c')]['id'];}return db[_0x1da1('0x30')][_0x1da1('0x4a')]({'where':{'id':_0x4379a8[_0x1da1('0x47')]['id']}})[_0x1da1('0x29')](handleEntityNotFound(_0x26f0ef,null))[_0x1da1('0x29')](function(_0x4817fc){if(_0x4817fc){_0x4379a8[_0x1da1('0x4c')][_0x1da1('0x51')]=_0x4817fc['id'];return db[_0x1da1('0x52')][_0x1da1('0x4b')](_0x4379a8[_0x1da1('0x4c')]);}})['then'](respondWithResult(_0x26f0ef,null))['catch'](handleError(_0x26f0ef,null));};exports[_0x1da1('0x53')]=function(_0x369871,_0x5669c4,_0x1d7bf9){var _0x1bd739={'raw':![],'where':{}};var _0x5b5a9b={};var _0x16b688={'count':0x0,'rows':[]};return db[_0x1da1('0x30')][_0x1da1('0x54')]({'where':{'id':_0x369871[_0x1da1('0x47')]['id']}})['then'](handleEntityNotFound(_0x5669c4,null))[_0x1da1('0x29')](function(_0x1a4872){if(_0x1a4872){_0x5b5a9b[_0x1da1('0x38')]=_[_0x1da1('0x34')](db[_0x1da1('0x52')][_0x1da1('0x48')]);_0x5b5a9b[_0x1da1('0x35')]=_[_0x1da1('0x34')](_0x369871[_0x1da1('0x35')]);_0x5b5a9b[_0x1da1('0x3e')]=_[_0x1da1('0x36')](_0x5b5a9b[_0x1da1('0x38')],_0x5b5a9b[_0x1da1('0x35')]);_0x1bd739[_0x1da1('0x37')]=_[_0x1da1('0x36')](_0x5b5a9b['model'],qs[_0x1da1('0x39')](_0x369871[_0x1da1('0x35')]['fields']));_0x1bd739['attributes']=_0x1bd739[_0x1da1('0x37')][_0x1da1('0x3a')]?_0x1bd739[_0x1da1('0x37')]:_0x5b5a9b['model'];if(!_0x369871[_0x1da1('0x35')][_0x1da1('0x55')](_0x1da1('0x3b'))){_0x1bd739['limit']=qs[_0x1da1('0x22')](_0x369871[_0x1da1('0x35')][_0x1da1('0x22')]);_0x1bd739[_0x1da1('0x20')]=qs[_0x1da1('0x20')](_0x369871[_0x1da1('0x35')]['offset']);}_0x1bd739[_0x1da1('0x56')]=qs[_0x1da1('0x3c')](_0x369871['query'][_0x1da1('0x3c')]);_0x1bd739[_0x1da1('0x40')]=qs['filters'](_[_0x1da1('0x3d')](_0x369871['query'],_0x5b5a9b[_0x1da1('0x3e')]));_0x1bd739['where']['ListId']=_0x1a4872['id'];if(_0x369871[_0x1da1('0x35')]['filter']){_0x1bd739[_0x1da1('0x40')]=_[_0x1da1('0x3f')](_0x1bd739['where'],{'$or':_[_0x1da1('0x33')](_0x1bd739[_0x1da1('0x37')],function(_0x1d65f9){var _0x1413ae={};_0x1413ae[_0x1d65f9]={'$like':'%'+_0x369871['query']['filter']+'%'};return _0x1413ae;})});}_0x1bd739=_[_0x1da1('0x3f')]({},_0x1bd739,_0x369871[_0x1da1('0x42')]);return db['Disposition'][_0x1da1('0x23')]({'where':_0x1bd739[_0x1da1('0x40')]})[_0x1da1('0x29')](function(_0x1715df){_0x16b688[_0x1da1('0x23')]=_0x1715df;if(_0x369871[_0x1da1('0x35')]['includeAll']){_0x1bd739[_0x1da1('0x49')]=[{'all':!![]}];}return db['Disposition'][_0x1da1('0x57')](_0x1bd739);})['then'](function(_0x4640d1){_0x16b688[_0x1da1('0x44')]=_0x4640d1;return _0x16b688;});}})[_0x1da1('0x29')](respondWithFilteredResult(_0x5669c4,_0x1bd739))[_0x1da1('0x45')](handleError(_0x5669c4,null));};exports[_0x1da1('0x58')]=function(_0x365598,_0x3f4499,_0x5aff46){return db[_0x1da1('0x30')]['find']({'where':{'id':_0x365598[_0x1da1('0x47')]['id']}})[_0x1da1('0x29')](handleEntityNotFound(_0x3f4499,null))['then'](function(_0x498261){if(_0x498261){return _0x498261[_0x1da1('0x58')](_0x365598['query'][_0x1da1('0x59')]);}})[_0x1da1('0x29')](respondWithStatusCode(_0x3f4499,null))[_0x1da1('0x45')](handleError(_0x3f4499,null));};exports['addContacts']=function(_0x55acfc,_0x3e4b27,_0x131624){return db['CmList'][_0x1da1('0x4a')]({'where':{'id':_0x55acfc[_0x1da1('0x47')]['id']}})[_0x1da1('0x29')](handleEntityNotFound(_0x3e4b27,null))[_0x1da1('0x29')](function(_0x1930b9){if(_0x1930b9){var _0x26d66a=[];var _0x3e5470={'success':[],'errors':[]};return db[_0x1da1('0x5a')][_0x1da1('0x4f')]()[_0x1da1('0x29')](function(_0x242288){if(_0x55acfc[_0x1da1('0x4c')][_0x1da1('0x5b')]&&_[_0x1da1('0x5c')](_0x55acfc[_0x1da1('0x4c')][_0x1da1('0x5b')])){if(_0x55acfc[_0x1da1('0x4c')][_0x1da1('0x5b')]['length']){_0x55acfc[_0x1da1('0x4c')][_0x1da1('0x5b')]=_0x55acfc[_0x1da1('0x4c')][_0x1da1('0x5b')][_0x1da1('0x5d')](';')+';';}else{_0x55acfc['body'][_0x1da1('0x5b')]=null;}}else{_0x55acfc['body']['tags']=null;}if(_0x55acfc['body']&&_[_0x1da1('0x5c')](_0x55acfc[_0x1da1('0x4c')])){for(var _0x3fbd22=0x0;_0x3fbd22<_0x55acfc['body'][_0x1da1('0x3a')];_0x3fbd22+=0x1){_0x55acfc['body'][_0x3fbd22]['ListId']=_0x55acfc[_0x1da1('0x47')]['id'];_0x26d66a['push'](_0x55acfc[_0x1da1('0x4c')][_0x3fbd22]);}return BPromise[_0x1da1('0x5e')](_0x26d66a,function(_0x10490f){return db[_0x1da1('0x5a')][_0x1da1('0x4b')](_['omit'](_0x10490f,['ids','id'])||{},{'fields':_[_0x1da1('0x34')](_0x242288),'raw':!![]})['then'](function(_0xc4c5b3){_0x3e5470[_0x1da1('0x5f')][_0x1da1('0x60')](_0xc4c5b3['dataValues']);})[_0x1da1('0x45')](function(_0x288cc7){_0x3e5470[_0x1da1('0x61')][_0x1da1('0x60')]({'data':_0x10490f,'error':_0x288cc7['message']});});})[_0x1da1('0x29')](function(_0x15e299){return _0x3e5470;})[_0x1da1('0x45')](function(_0x3f8636){return _0x3f8636;});}else{_0x3e4b27[_0x1da1('0x1e')](0x190)[_0x1da1('0x1f')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x1da1('0x29')](respondWithResult(_0x3e4b27,null))[_0x1da1('0x45')](handleError(_0x3e4b27,null));};exports[_0x1da1('0x62')]=function(_0x17e86f,_0x5d98dc,_0x3ec6f2){var _0x22bfaf;return db[_0x1da1('0x30')][_0x1da1('0x4a')]({'where':{'id':_0x17e86f[_0x1da1('0x47')]['id']},'include':[{'model':db[_0x1da1('0x63')],'as':_0x1da1('0x64')}]})['then'](handleEntityNotFound(_0x5d98dc,null))[_0x1da1('0x29')](function(_0x1a37df){if(_0x1a37df){_0x22bfaf=_0x1a37df;return db[_0x1da1('0x5a')]['rawAttributes'];}})[_0x1da1('0x29')](function(_0x4ee107){if(_0x4ee107){var _0x3afe24={};var _0x9dfd08={};_0x9dfd08[_0x1da1('0x38')]=_[_0x1da1('0x65')](_['keys'](_0x4ee107),_['map'](_0x22bfaf[_0x1da1('0x64')],function(_0x529d81){return util['format'](_0x1da1('0x66'),_0x529d81['id']);}));_0x9dfd08[_0x1da1('0x35')]=_[_0x1da1('0x34')](_0x17e86f[_0x1da1('0x35')]);_0x9dfd08['filters']=_[_0x1da1('0x36')](_0x9dfd08[_0x1da1('0x38')],_0x9dfd08[_0x1da1('0x35')]);_0x3afe24['attributes']=_[_0x1da1('0x36')](_0x9dfd08['model'],qs[_0x1da1('0x39')](_0x17e86f[_0x1da1('0x35')]['fields']));_0x3afe24[_0x1da1('0x37')]=_0x3afe24[_0x1da1('0x37')][_0x1da1('0x3a')]?_0x3afe24[_0x1da1('0x37')]:_0x9dfd08[_0x1da1('0x38')];if(!_0x17e86f['query'][_0x1da1('0x55')](_0x1da1('0x3b'))){_0x3afe24[_0x1da1('0x22')]=qs[_0x1da1('0x22')](_0x17e86f[_0x1da1('0x35')][_0x1da1('0x22')]);_0x3afe24[_0x1da1('0x20')]=qs[_0x1da1('0x20')](_0x17e86f[_0x1da1('0x35')][_0x1da1('0x20')]);}_0x3afe24[_0x1da1('0x56')]=qs[_0x1da1('0x3c')](_0x17e86f[_0x1da1('0x35')]['sort']);_0x3afe24['where']=qs[_0x1da1('0x3e')](_[_0x1da1('0x3d')](_0x17e86f[_0x1da1('0x35')],_0x9dfd08['filters']));_0x3afe24['raw']=!![];if(_0x17e86f[_0x1da1('0x35')][_0x1da1('0x67')]){_0x3afe24[_0x1da1('0x40')]=_[_0x1da1('0x3f')](_0x3afe24[_0x1da1('0x40')],{'$or':_['map'](_0x3afe24[_0x1da1('0x37')],function(_0x4daffe){var _0x1fdf78={};_0x1fdf78[_0x4daffe]={'$like':'%'+_0x17e86f[_0x1da1('0x35')]['filter']+'%'};return _0x1fdf78;})});}_0x3afe24=_[_0x1da1('0x3f')]({},_0x3afe24,_0x17e86f['options']);return _0x22bfaf[_0x1da1('0x62')](_0x3afe24);}})[_0x1da1('0x29')](respondWithResult(_0x5d98dc,null))[_0x1da1('0x45')](handleError(_0x5d98dc,null));};exports[_0x1da1('0x68')]=function(_0x5aba36,_0x5030b9,_0x5e8d28){var _0x484eba;var _0x23e7a4;var _0x16f6e6;var _0x41f713=_0x5aba36['params']['id'];csv_results=[];return db[_0x1da1('0x69')][_0x1da1('0x57')]({'attributes':['id',_0x1da1('0x2f')],'raw':!![],'order':['OrderBy']})[_0x1da1('0x29')](function(_0x14cb86){_0x484eba=_0x14cb86;var _0x4aa83f=_['keys'](db['CmContact'][_0x1da1('0x48')]);return db[_0x1da1('0x63')][_0x1da1('0x57')]({'raw':!![],'attributes':['id',_0x1da1('0x6a')]})[_0x1da1('0x29')](function(_0x5d0950){_0x23e7a4=_0x5d0950;var _0x2968e8=squel[_0x1da1('0x6b')]()[_0x1da1('0x39')](_0x4aa83f)[_0x1da1('0x6c')](_0x1da1('0x6d'),'c')[_0x1da1('0x40')]('c.ListId\x20=\x20?',_0x41f713)[_0x1da1('0x40')]('c.deletedAt\x20is\x20null')['distinct']();for(var _0x4c6efd=0x0;_0x4c6efd<_0x23e7a4[_0x1da1('0x3a')];_0x4c6efd++){_0x2968e8[_0x1da1('0x6e')](_0x1da1('0x6f')+_0x23e7a4[_0x4c6efd]['id'],_0x1da1('0x70')+_0x23e7a4[_0x4c6efd]['alias']);}for(var _0x4c6efd=0x0;_0x4c6efd<_0x484eba[_0x1da1('0x3a')];_0x4c6efd++){_0x2968e8[_0x1da1('0x6e')](squel[_0x1da1('0x6b')]()['field'](_0x1da1('0x71'))[_0x1da1('0x6c')]('cm_contact_has_items')[_0x1da1('0x40')](_0x1da1('0x72'),_0x484eba[_0x4c6efd]['id'])[_0x1da1('0x40')](_0x1da1('0x73')),_0x1da1('0x74')+_0x484eba[_0x4c6efd]['name']);_0x2968e8[_0x1da1('0x6e')](squel['select']()[_0x1da1('0x6e')](_0x1da1('0x75'))[_0x1da1('0x6c')](_0x1da1('0x76'))[_0x1da1('0x40')](_0x1da1('0x72'),_0x484eba[_0x4c6efd]['id'])[_0x1da1('0x40')](_0x1da1('0x73')),_0x1da1('0x77')+_0x484eba[_0x4c6efd][_0x1da1('0x2f')]);}var _0x13cd41=[];_0x13cd41['push'](_0x2968e8[_0x1da1('0x78')]());BPromise[_0x1da1('0x5e')](_0x13cd41,handleQuery)[_0x1da1('0x29')](function(_0x450e53){handleQuery(_0x2968e8[_0x1da1('0x78')]());var _0x2fda7a=csv_results[0x0];if(!_[_0x1da1('0x79')](_0x2fda7a)){var _0x13948a=toCsv(_0x2fda7a);var _0x285bbc=Date[_0x1da1('0x7a')]();fs[_0x1da1('0x7b')](util[_0x1da1('0x7c')](_0x1da1('0x7d'),_0x41f713,_0x285bbc),_0x13948a);_0x5030b9[_0x1da1('0x7e')](_0x1da1('0x7f'),_0x1da1('0x80')+util[_0x1da1('0x7c')](_0x1da1('0x81'),_0x41f713,_0x285bbc));_0x5030b9[_0x1da1('0x7e')](_0x1da1('0x82'),'text/csv');return _0x5030b9[_0x1da1('0x83')](util['format'](_0x1da1('0x7d'),_0x41f713,_0x285bbc));}else{return _0x5030b9[_0x1da1('0x1c')](0xcc);}});});});};exports['addCustomField']=function(_0x37478e,_0x226ac9,_0x59b7ee){var _0x3deb06;delete _0x37478e['body']['id'];return db[_0x1da1('0x30')][_0x1da1('0x54')]({'where':{'id':_0x37478e['params']['id']}})['then'](handleEntityNotFound(_0x226ac9,null))[_0x1da1('0x29')](function(_0x2dc370){if(_0x2dc370){return db[_0x1da1('0x84')][_0x1da1('0x85')](function(_0x2dcacc){return db[_0x1da1('0x63')][_0x1da1('0x4b')](_0x37478e['body'],{'transaction':_0x2dcacc})[_0x1da1('0x29')](function(_0x2f68dc){_0x3deb06=_0x2f68dc;return _0x2dc370[_0x1da1('0x86')](_0x2f68dc,{'transaction':_0x2dcacc});})['then'](function(){var _0x7303f0={'type':db[_0x1da1('0x87')][_0x1da1('0x88')],'transaction':_0x2dcacc};switch(_0x37478e[_0x1da1('0x4c')][_0x1da1('0x32')]){case _0x1da1('0x89'):_0x7303f0['type']=db[_0x1da1('0x87')][_0x1da1('0x88')];break;case _0x1da1('0x8a'):_0x7303f0[_0x1da1('0x32')]=db[_0x1da1('0x87')][_0x1da1('0x8b')];break;case _0x1da1('0x8c'):_0x7303f0[_0x1da1('0x32')]=db['Sequelize']['BOOLEAN'];_0x7303f0[_0x1da1('0x8d')]=![];break;default:}return db[_0x1da1('0x84')]['queryInterface'][_0x1da1('0x8e')](_0x1da1('0x6d'),util['format'](_0x1da1('0x8f'),_0x3deb06['id']),_0x7303f0);})[_0x1da1('0x29')](function(){return _0x3deb06;});});}})[_0x1da1('0x29')](respondWithResult(_0x226ac9,null))['catch'](handleError(_0x226ac9,null));};exports[_0x1da1('0x90')]=function(_0x32e1c2,_0x5460d2,_0x2dfafd){var _0x47dd33={};var _0x3c393b={};var _0x10c8f4;var _0x1d0453;return db[_0x1da1('0x30')][_0x1da1('0x54')]({'where':{'id':_0x32e1c2[_0x1da1('0x47')]['id']}})['then'](handleEntityNotFound(_0x5460d2,null))[_0x1da1('0x29')](function(_0x3900fd){if(_0x3900fd){_0x10c8f4=_0x3900fd;_0x3c393b['model']=_[_0x1da1('0x34')](db[_0x1da1('0x63')]['rawAttributes']);_0x3c393b[_0x1da1('0x35')]=_[_0x1da1('0x34')](_0x32e1c2[_0x1da1('0x35')]);_0x3c393b[_0x1da1('0x3e')]=_[_0x1da1('0x36')](_0x3c393b[_0x1da1('0x38')],_0x3c393b[_0x1da1('0x35')]);_0x47dd33[_0x1da1('0x37')]=_[_0x1da1('0x36')](_0x3c393b[_0x1da1('0x38')],qs[_0x1da1('0x39')](_0x32e1c2['query']['fields']));_0x47dd33[_0x1da1('0x37')]=_0x47dd33[_0x1da1('0x37')]['length']?_0x47dd33[_0x1da1('0x37')]:_0x3c393b[_0x1da1('0x38')];_0x47dd33['order']=qs[_0x1da1('0x3c')](_0x32e1c2[_0x1da1('0x35')][_0x1da1('0x3c')]);_0x47dd33['where']=qs[_0x1da1('0x3e')](_[_0x1da1('0x3d')](_0x32e1c2[_0x1da1('0x35')],_0x3c393b[_0x1da1('0x3e')]));_0x47dd33[_0x1da1('0x40')]=_['merge'](_0x47dd33[_0x1da1('0x40')],{'$or':[{'ListId':_0x3900fd['id']},{'ListId':null}]});if(_0x32e1c2[_0x1da1('0x35')][_0x1da1('0x67')]){_0x47dd33['where']=_[_0x1da1('0x3f')](_0x47dd33[_0x1da1('0x40')],{'$or':_[_0x1da1('0x33')](_0x47dd33[_0x1da1('0x37')],function(_0x14e4ae){var _0x413f79={};_0x413f79[_0x14e4ae]={'$like':'%'+_0x32e1c2[_0x1da1('0x35')][_0x1da1('0x67')]+'%'};return _0x413f79;})});}_0x47dd33=_[_0x1da1('0x3f')]({},_0x47dd33,_0x32e1c2[_0x1da1('0x42')]);return db['CmCustomField'][_0x1da1('0x91')](_0x47dd33);}})[_0x1da1('0x29')](respondWithResult(_0x5460d2,null))[_0x1da1('0x45')](handleError(_0x5460d2,null));};exports['getGlobalCustomFields']=function(_0x3e8d42,_0x54e7fe){return db[_0x1da1('0x63')][_0x1da1('0x91')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x54e7fe,null))[_0x1da1('0x29')](function(_0x350a7e){return _0x350a7e;})[_0x1da1('0x29')](respondWithResult(_0x54e7fe,null))[_0x1da1('0x45')](handleError(_0x54e7fe,null));};exports[_0x1da1('0x92')]=function(_0x1dd7ab,_0x313fb,_0x5375d0){return db[_0x1da1('0x30')][_0x1da1('0x4a')]({'where':{'id':_0x1dd7ab[_0x1da1('0x47')]['id']}})['then'](handleEntityNotFound(_0x313fb,null))[_0x1da1('0x29')](function(_0x32f610){if(_0x32f610){return _0x32f610[_0x1da1('0x92')](_0x1dd7ab[_0x1da1('0x4c')][_0x1da1('0x59')],_[_0x1da1('0x93')](_0x1dd7ab['body'],[_0x1da1('0x59'),'id'])||{})[_0x1da1('0x94')](function(_0x2e125d){for(var _0x29dcf2=0x0;_0x29dcf2<_0x1dd7ab[_0x1da1('0x4c')][_0x1da1('0x59')][_0x1da1('0x3a')];_0x29dcf2+=0x1){socket[_0x1da1('0x95')](_0x1da1('0x96'),{'UserId':Number(_0x1dd7ab[_0x1da1('0x4c')]['ids'][_0x29dcf2]),'CmListId':Number(_0x1dd7ab[_0x1da1('0x47')]['id'])});}return _0x2e125d;});}})['then'](respondWithResult(_0x313fb,null))[_0x1da1('0x45')](handleError(_0x313fb,null));};exports[_0x1da1('0x97')]=function(_0x3f158b,_0x4c9c19,_0x9b6999){return db['CmList'][_0x1da1('0x4a')]({'where':{'id':_0x3f158b['params']['id']}})[_0x1da1('0x29')](handleEntityNotFound(_0x4c9c19,null))[_0x1da1('0x29')](function(_0x2758b1){if(_0x2758b1){return _0x2758b1[_0x1da1('0x97')](_0x3f158b[_0x1da1('0x35')][_0x1da1('0x59')])['then'](function(){if(_[_0x1da1('0x5c')](_0x3f158b['query']['ids'])){for(var _0x30758=0x0;_0x30758<_0x3f158b[_0x1da1('0x35')][_0x1da1('0x59')][_0x1da1('0x3a')];_0x30758+=0x1){socket[_0x1da1('0x95')]('userCmList:remove',{'UserId':Number(_0x3f158b[_0x1da1('0x35')]['ids'][_0x30758]),'CmListId':Number(_0x3f158b['params']['id'])});}}else{socket[_0x1da1('0x95')](_0x1da1('0x98'),{'UserId':Number(_0x3f158b[_0x1da1('0x35')][_0x1da1('0x59')]),'CmListId':Number(_0x3f158b[_0x1da1('0x47')]['id'])});}});}})[_0x1da1('0x29')](respondWithStatusCode(_0x4c9c19,null))[_0x1da1('0x45')](handleError(_0x4c9c19,null));};exports[_0x1da1('0x99')]=function(_0x190f3d,_0x19f56e,_0x2c9b2a){var _0x125523={};var _0x50ceaf={};var _0x235fac;var _0x50b5b9;return db[_0x1da1('0x30')][_0x1da1('0x54')]({'where':{'id':_0x190f3d[_0x1da1('0x47')]['id']}})[_0x1da1('0x29')](handleEntityNotFound(_0x19f56e,null))[_0x1da1('0x29')](function(_0x2724d0){if(_0x2724d0){_0x235fac=_0x2724d0;_0x50ceaf[_0x1da1('0x38')]=_[_0x1da1('0x34')](db[_0x1da1('0x9a')]['rawAttributes']);_0x50ceaf[_0x1da1('0x35')]=_[_0x1da1('0x34')](_0x190f3d[_0x1da1('0x35')]);_0x50ceaf[_0x1da1('0x3e')]=_[_0x1da1('0x36')](_0x50ceaf[_0x1da1('0x38')],_0x50ceaf[_0x1da1('0x35')]);_0x125523[_0x1da1('0x37')]=_[_0x1da1('0x36')](_0x50ceaf[_0x1da1('0x38')],qs[_0x1da1('0x39')](_0x190f3d[_0x1da1('0x35')][_0x1da1('0x39')]));_0x125523['attributes']=_0x125523[_0x1da1('0x37')][_0x1da1('0x3a')]?_0x125523[_0x1da1('0x37')]:_0x50ceaf[_0x1da1('0x38')];_0x125523['order']=qs[_0x1da1('0x3c')](_0x190f3d[_0x1da1('0x35')][_0x1da1('0x3c')]);_0x125523[_0x1da1('0x40')]=qs[_0x1da1('0x3e')](_[_0x1da1('0x3d')](_0x190f3d[_0x1da1('0x35')],_0x50ceaf[_0x1da1('0x3e')]));if(_0x190f3d[_0x1da1('0x35')]['filter']){_0x125523[_0x1da1('0x40')]=_['merge'](_0x125523[_0x1da1('0x40')],{'$or':_[_0x1da1('0x33')](_0x125523[_0x1da1('0x37')],function(_0x475fce){var _0xe0bbb5={};_0xe0bbb5[_0x475fce]={'$like':'%'+_0x190f3d[_0x1da1('0x35')][_0x1da1('0x67')]+'%'};return _0xe0bbb5;})});}_0x125523=_[_0x1da1('0x3f')]({},_0x125523,_0x190f3d[_0x1da1('0x42')]);return _0x235fac['getAgents'](_0x125523);}})[_0x1da1('0x29')](function(_0x164d92){if(_0x164d92){_0x50b5b9=_0x164d92['length'];if(!_0x190f3d[_0x1da1('0x35')][_0x1da1('0x55')]('nolimit')){_0x125523[_0x1da1('0x22')]=qs[_0x1da1('0x22')](_0x190f3d['query'][_0x1da1('0x22')]);_0x125523[_0x1da1('0x20')]=qs['offset'](_0x190f3d[_0x1da1('0x35')][_0x1da1('0x20')]);}return _0x235fac['getAgents'](_0x125523);}})[_0x1da1('0x29')](function(_0x18d53d){if(_0x18d53d){return _0x18d53d?{'count':_0x50b5b9,'rows':_0x18d53d}:null;}})['then'](respondWithResult(_0x19f56e,null))[_0x1da1('0x45')](handleError(_0x19f56e,null));};function handleQuery(_0xbb5b4c){logger['info'](_0xbb5b4c);return db[_0x1da1('0x84')][_0x1da1('0x35')](_0xbb5b4c)[_0x1da1('0x94')](function(_0x41c065){csv_results[_0x1da1('0x60')](_0x41c065);})['catch'](function(_0x2c2c38){logger[_0x1da1('0x2d')](_0x2c2c38[_0x1da1('0x9b')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 11c40c1..3cd3d77 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 _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x55ca,0x126));var _0xa55c=function(_0x3c1304,_0x219ae5){_0x3c1304=_0x3c1304-0x0;var _0x11b071=_0x55ca[_0x3c1304];return _0x11b071;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x326f=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x326f,0xd1));var _0xf326=function(_0x207a28,_0x397a68){_0x207a28=_0x207a28-0x0;var _0x164031=_0x326f[_0x207a28];return _0x164031;};'use strict';var EventEmitter=require(_0xf326('0x0'));var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xf326('0x1')](0x0);var events={'afterCreate':_0xf326('0x2'),'afterUpdate':_0xf326('0x3'),'afterDestroy':_0xf326('0x4')};function emitEvent(_0x27e8d7){return function(_0x120a26,_0x9445c6,_0xf1c243){CmListEvents[_0xf326('0x5')](_0x27e8d7+':'+_0x120a26['id'],_0x120a26);CmListEvents[_0xf326('0x5')](_0x27e8d7,_0x120a26);_0xf1c243(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xf326('0x6')](e,emitEvent(event));}}module[_0xf326('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 7514170..57a5772 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 _0x1be1=['define','cm_lists','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmList.attributes','exports'];(function(_0x11ec6c,_0x1a8169){var _0xb59506=function(_0x58e31d){while(--_0x58e31d){_0x11ec6c['push'](_0x11ec6c['shift']());}};_0xb59506(++_0x1a8169);}(_0x1be1,0x192));var _0x11be=function(_0x46ec97,_0x3d75ff){_0x46ec97=_0x46ec97-0x0;var _0x2d870d=_0x1be1[_0x46ec97];return _0x2d870d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x11be('0x0'))(_0x11be('0x1'));var moment=require('moment');var BPromise=require(_0x11be('0x2'));var rp=require(_0x11be('0x3'));var fs=require('fs');var path=require(_0x11be('0x4'));var rimraf=require(_0x11be('0x5'));var config=require('../../config/environment');var attributes=require(_0x11be('0x6'));module[_0x11be('0x7')]=function(_0x11f793,_0x479719){return _0x11f793[_0x11be('0x8')]('CmList',attributes,{'tableName':_0x11be('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac4a=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmList.attributes','define','cm_lists'];(function(_0x5ce2a0,_0x5aff24){var _0x2aac91=function(_0x2ed5a3){while(--_0x2ed5a3){_0x5ce2a0['push'](_0x5ce2a0['shift']());}};_0x2aac91(++_0x5aff24);}(_0xac4a,0x13f));var _0xaac4=function(_0x55551f,_0x297d95){_0x55551f=_0x55551f-0x0;var _0x29a0d8=_0xac4a[_0x55551f];return _0x29a0d8;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var moment=require(_0xaac4('0x4'));var BPromise=require(_0xaac4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var attributes=require(_0xaac4('0x8'));module['exports']=function(_0x1283a5,_0x53d03a){return _0x1283a5[_0xaac4('0x9')]('CmList',attributes,{'tableName':_0xaac4('0xa'),'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 cb78e66..e0754e2 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 _0x433d=['http','defaults','redis','socket.io-emitter','./cmList.socket','register','then','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CmList,\x20%s,\x20%s','info','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1444de,_0x4e2456){var _0x43f57b=function(_0x131d01){while(--_0x131d01){_0x1444de['push'](_0x1444de['shift']());}};_0x43f57b(++_0x4e2456);}(_0x433d,0x1b0));var _0xd433=function(_0x229d7e,_0x5bc489){_0x229d7e=_0x229d7e-0x0;var _0xa78280=_0x433d[_0x229d7e];return _0xa78280;};'use strict';var _=require('lodash');var util=require(_0xd433('0x0'));var moment=require(_0xd433('0x1'));var BPromise=require(_0xd433('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd433('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd433('0x4'));var logger=require(_0xd433('0x5'))(_0xd433('0x6'));var config=require(_0xd433('0x7'));var jayson=require(_0xd433('0x8'));var client=jayson[_0xd433('0x9')][_0xd433('0xa')]({'port':0x232a});config['redis']=_[_0xd433('0xb')](config[_0xd433('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xd433('0xd'))(new Redis(config[_0xd433('0xc')]));require(_0xd433('0xe'))[_0xd433('0xf')](socket);function respondWithRpcPromise(_0x5d71a6,_0x31f7e7,_0x4fc0f6){return new BPromise(function(_0x144e81,_0x3cd120){return client['request'](_0x5d71a6,_0x4fc0f6)[_0xd433('0x10')](function(_0x1744fa){logger['info']('CmList,\x20%s,\x20%s',_0x31f7e7,'request\x20sent');logger[_0xd433('0x11')](_0xd433('0x12'),_0x31f7e7,_0xd433('0x13'),JSON[_0xd433('0x14')](_0x1744fa));if(_0x1744fa[_0xd433('0x15')]){if(_0x1744fa['error'][_0xd433('0x16')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x31f7e7,_0x1744fa[_0xd433('0x15')][_0xd433('0x17')]);return _0x3cd120(_0x1744fa[_0xd433('0x15')][_0xd433('0x17')]);}logger['error'](_0xd433('0x18'),_0x31f7e7,_0x1744fa[_0xd433('0x15')]['message']);return _0x144e81(_0x1744fa[_0xd433('0x15')][_0xd433('0x17')]);}else{logger[_0xd433('0x19')](_0xd433('0x18'),_0x31f7e7,'request\x20sent');_0x144e81(_0x1744fa['result'][_0xd433('0x17')]);}})['catch'](function(_0x1ba4f0){logger[_0xd433('0x15')](_0xd433('0x18'),_0x31f7e7,_0x1ba4f0);_0x3cd120(_0x1ba4f0);});});} \ No newline at end of file +var _0x2b41=['jayson/promise','redis','socket.io-emitter','register','then','request\x20sent','debug','stringify','error','code','CmList,\x20%s,\x20%s','message','info','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x323f83,_0x135d56){var _0x1b77d9=function(_0x22e422){while(--_0x22e422){_0x323f83['push'](_0x323f83['shift']());}};_0x1b77d9(++_0x135d56);}(_0x2b41,0x1da));var _0x12b4=function(_0x2c534a,_0x18a19e){_0x2c534a=_0x2c534a-0x0;var _0x3f5c99=_0x2b41[_0x2c534a];return _0x3f5c99;};'use strict';var _=require('lodash');var util=require(_0x12b4('0x0'));var moment=require(_0x12b4('0x1'));var BPromise=require(_0x12b4('0x2'));var rs=require(_0x12b4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x12b4('0x4'))['db'];var utils=require(_0x12b4('0x5'));var logger=require(_0x12b4('0x6'))(_0x12b4('0x7'));var config=require(_0x12b4('0x8'));var jayson=require(_0x12b4('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x12b4('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x12b4('0xb'))(new Redis(config[_0x12b4('0xa')]));require('./cmList.socket')[_0x12b4('0xc')](socket);function respondWithRpcPromise(_0x2bc3fd,_0x10fc7d,_0x571747){return new BPromise(function(_0x569089,_0x501f43){return client['request'](_0x2bc3fd,_0x571747)[_0x12b4('0xd')](function(_0x53ada9){logger['info']('CmList,\x20%s,\x20%s',_0x10fc7d,_0x12b4('0xe'));logger[_0x12b4('0xf')]('CmList,\x20%s,\x20%s,\x20%s',_0x10fc7d,'request\x20sent',JSON[_0x12b4('0x10')](_0x53ada9));if(_0x53ada9[_0x12b4('0x11')]){if(_0x53ada9[_0x12b4('0x11')][_0x12b4('0x12')]===0x1f4){logger[_0x12b4('0x11')](_0x12b4('0x13'),_0x10fc7d,_0x53ada9[_0x12b4('0x11')][_0x12b4('0x14')]);return _0x501f43(_0x53ada9[_0x12b4('0x11')][_0x12b4('0x14')]);}logger[_0x12b4('0x11')]('CmList,\x20%s,\x20%s',_0x10fc7d,_0x53ada9[_0x12b4('0x11')][_0x12b4('0x14')]);return _0x569089(_0x53ada9[_0x12b4('0x11')][_0x12b4('0x14')]);}else{logger[_0x12b4('0x15')](_0x12b4('0x13'),_0x10fc7d,_0x12b4('0xe'));_0x569089(_0x53ada9[_0x12b4('0x16')]['message']);}})['catch'](function(_0x15cf94){logger[_0x12b4('0x11')](_0x12b4('0x13'),_0x10fc7d,_0x15cf94);_0x501f43(_0x15cf94);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index cb12047..4d6aee1 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 _0x25f0=['update','emit','removeListener','length','cmList:','./cmList.events','save','remove'];(function(_0xcbd6ed,_0x1f9b0e){var _0xc6e29e=function(_0x5807d0){while(--_0x5807d0){_0xcbd6ed['push'](_0xcbd6ed['shift']());}};_0xc6e29e(++_0x1f9b0e);}(_0x25f0,0x17d));var _0x025f=function(_0xc29796,_0x26acf7){_0xc29796=_0xc29796-0x0;var _0x13f83f=_0x25f0[_0xc29796];return _0x13f83f;};'use strict';var CmListEvents=require(_0x025f('0x0'));var events=[_0x025f('0x1'),_0x025f('0x2'),_0x025f('0x3')];function createListener(_0x31cd4f,_0x573df5){return function(_0x36e83c){_0x573df5[_0x025f('0x4')](_0x31cd4f,_0x36e83c);};}function removeListener(_0x5b1dbd,_0x343e4b){return function(){CmListEvents[_0x025f('0x5')](_0x5b1dbd,_0x343e4b);};}exports['register']=function(_0x4c3256){for(var _0x20adae=0x0,_0x3beb91=events[_0x025f('0x6')];_0x20adae<_0x3beb91;_0x20adae++){var _0x5f0b1b=events[_0x20adae];var _0x2f5118=createListener(_0x025f('0x7')+_0x5f0b1b,_0x4c3256);CmListEvents['on'](_0x5f0b1b,_0x2f5118);}}; \ No newline at end of file +var _0xe2b9=['register','length','save','remove','update','emit'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xe2b9,0x10a));var _0x9e2b=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xe2b9[_0x18a79d];return _0x4f8848;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x9e2b('0x0'),_0x9e2b('0x1'),_0x9e2b('0x2')];function createListener(_0x4b3e67,_0x59cce3){return function(_0x3a98d2){_0x59cce3[_0x9e2b('0x3')](_0x4b3e67,_0x3a98d2);};}function removeListener(_0x4c1bf5,_0x4c96c3){return function(){CmListEvents['removeListener'](_0x4c1bf5,_0x4c96c3);};}exports[_0x9e2b('0x4')]=function(_0x42a701){for(var _0xeec91d=0x0,_0x13ffa0=events[_0x9e2b('0x5')];_0xeec91d<_0x13ffa0;_0xeec91d++){var _0x2905f1=events[_0xeec91d];var _0x522668=createListener('cmList:'+_0x2905f1,_0x42a701);CmListEvents['on'](_0x2905f1,_0x522668);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index ef7cd7a..d5ae889 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 _0xb469=['show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','addDisposition','addContacts','addCustomField','update','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/global_fields','getGlobalCustomFields','/:id'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xb469,0x13b));var _0x9b46=function(_0x137d64,_0xdb9dda){_0x137d64=_0x137d64-0x0;var _0x3c771a=_0xb469[_0x137d64];return _0x3c771a;};'use strict';var multer=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var path=require(_0x9b46('0x2'));var timeout=require(_0x9b46('0x3'));var express=require(_0x9b46('0x4'));var router=express[_0x9b46('0x5')]();var fs_extra=require(_0x9b46('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9b46('0x7'));var config=require(_0x9b46('0x8'));var controller=require('./cmList.controller');router[_0x9b46('0x9')]('/',auth[_0x9b46('0xa')](),controller['index']);router[_0x9b46('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x9b46('0xb')]);router['get'](_0x9b46('0xc'),auth[_0x9b46('0xa')](),controller[_0x9b46('0xd')]);router['get'](_0x9b46('0xe'),auth['isAuthenticated'](),controller[_0x9b46('0xf')]);router['get'](_0x9b46('0x10'),auth['isAuthenticated'](),controller[_0x9b46('0x11')]);router[_0x9b46('0x9')]('/:id/contacts',auth[_0x9b46('0xa')](),controller[_0x9b46('0x12')]);router['get'](_0x9b46('0x13'),auth[_0x9b46('0xa')](),controller[_0x9b46('0x14')]);router[_0x9b46('0x9')](_0x9b46('0x15'),auth[_0x9b46('0xa')](),controller[_0x9b46('0x16')]);router[_0x9b46('0x9')](_0x9b46('0x17'),auth[_0x9b46('0xa')](),controller[_0x9b46('0x18')]);router[_0x9b46('0x19')]('/',auth[_0x9b46('0xa')](),controller['create']);router['post']('/:id/dispositions',auth[_0x9b46('0xa')](),controller[_0x9b46('0x1a')]);router[_0x9b46('0x19')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x9b46('0x1b')]);router['post']('/:id/fields',auth[_0x9b46('0xa')](),controller[_0x9b46('0x1c')]);router['post'](_0x9b46('0x17'),auth[_0x9b46('0xa')](),controller['addAgents']);router['put'](_0x9b46('0xe'),auth[_0x9b46('0xa')](),controller[_0x9b46('0x1d')]);router['delete']('/:id',auth[_0x9b46('0xa')](),controller['destroy']);router[_0x9b46('0x1e')](_0x9b46('0x10'),auth['isAuthenticated'](),controller[_0x9b46('0x1f')]);router['delete'](_0x9b46('0x17'),auth[_0x9b46('0xa')](),controller['removeAgents']);module[_0x9b46('0x20')]=router; \ No newline at end of file +var _0xcbe8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','isAuthenticated','describe','/global_fields','/:id','/:id/contacts','getContacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','put','delete','destroy','removeDispositions','removeAgents','util','path','connect-timeout','express','Router'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xcbe8,0x1ea));var _0x8cbe=function(_0x4acb1a,_0x5f22d7){_0x4acb1a=_0x4acb1a-0x0;var _0x51a3c3=_0xcbe8[_0x4acb1a];return _0x51a3c3;};'use strict';var multer=require('multer');var util=require(_0x8cbe('0x0'));var path=require(_0x8cbe('0x1'));var timeout=require(_0x8cbe('0x2'));var express=require(_0x8cbe('0x3'));var router=express[_0x8cbe('0x4')]();var fs_extra=require(_0x8cbe('0x5'));var auth=require(_0x8cbe('0x6'));var interaction=require(_0x8cbe('0x7'));var config=require(_0x8cbe('0x8'));var controller=require(_0x8cbe('0x9'));router[_0x8cbe('0xa')]('/',auth['isAuthenticated'](),controller[_0x8cbe('0xb')]);router['get']('/describe',auth[_0x8cbe('0xc')](),controller[_0x8cbe('0xd')]);router['get'](_0x8cbe('0xe'),auth[_0x8cbe('0xc')](),controller['getGlobalCustomFields']);router['get'](_0x8cbe('0xf'),auth[_0x8cbe('0xc')](),controller['show']);router[_0x8cbe('0xa')]('/:id/dispositions',auth[_0x8cbe('0xc')](),controller['getDispositions']);router[_0x8cbe('0xa')](_0x8cbe('0x10'),auth[_0x8cbe('0xc')](),controller[_0x8cbe('0x11')]);router[_0x8cbe('0xa')]('/:id/contacts/csv',auth['isAuthenticated'](),controller[_0x8cbe('0x12')]);router[_0x8cbe('0xa')](_0x8cbe('0x13'),auth[_0x8cbe('0xc')](),controller[_0x8cbe('0x14')]);router[_0x8cbe('0xa')](_0x8cbe('0x15'),auth['isAuthenticated'](),controller['getAgents']);router[_0x8cbe('0x16')]('/',auth[_0x8cbe('0xc')](),controller['create']);router['post'](_0x8cbe('0x17'),auth[_0x8cbe('0xc')](),controller[_0x8cbe('0x18')]);router[_0x8cbe('0x16')](_0x8cbe('0x10'),auth['isAuthenticated'](),controller[_0x8cbe('0x19')]);router[_0x8cbe('0x16')](_0x8cbe('0x13'),auth[_0x8cbe('0xc')](),controller[_0x8cbe('0x1a')]);router[_0x8cbe('0x16')](_0x8cbe('0x15'),auth['isAuthenticated'](),controller[_0x8cbe('0x1b')]);router[_0x8cbe('0x1c')](_0x8cbe('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x8cbe('0x1d')](_0x8cbe('0xf'),auth[_0x8cbe('0xc')](),controller[_0x8cbe('0x1e')]);router[_0x8cbe('0x1d')](_0x8cbe('0x17'),auth['isAuthenticated'](),controller[_0x8cbe('0x1f')]);router[_0x8cbe('0x1d')](_0x8cbe('0x15'),auth[_0x8cbe('0xc')](),controller[_0x8cbe('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 9a5467c..7bad217 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 _0xd04a=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x3cd7f8,_0x4e3503){var _0x1389b2=function(_0x12cb25){while(--_0x12cb25){_0x3cd7f8['push'](_0x3cd7f8['shift']());}};_0x1389b2(++_0x4e3503);}(_0xd04a,0x138));var _0xad04=function(_0x2ca466,_0x317f6b){_0x2ca466=_0x2ca466-0x0;var _0x32b5b1=_0xd04a[_0x2ca466];return _0x32b5b1;};'use strict';var Sequelize=require(_0xad04('0x0'));module[_0xad04('0x1')]={'name':{'type':Sequelize[_0xad04('0x2')],'get':function(_0xb7f642){return this['getDataValue'](_0xad04('0x3'));}},'field':{'type':Sequelize[_0xad04('0x4')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xad04('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x8b6e=['STRING','sequelize','exports','field'];(function(_0x21c282,_0x4faeca){var _0x2a1530=function(_0x94422f){while(--_0x94422f){_0x21c282['push'](_0x21c282['shift']());}};_0x2a1530(++_0x4faeca);}(_0x8b6e,0x1c5));var _0xe8b6=function(_0x294e3b,_0x11387c){_0x294e3b=_0x294e3b-0x0;var _0x38b2af=_0x8b6e[_0x294e3b];return _0x38b2af;};'use strict';var Sequelize=require(_0xe8b6('0x0'));module[_0xe8b6('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x53e6c4){return this['getDataValue'](_0xe8b6('0x2'));}},'field':{'type':Sequelize[_0xe8b6('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xe8b6('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0xe8b6('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 27ef108..fe46f26 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x26b62b,_0x3d9e1b){var _0x4de8d2=function(_0x3fc340){while(--_0x3fc340){_0x26b62b['push'](_0x26b62b['shift']());}};_0x4de8d2(++_0x3d9e1b);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x1fe9e5,_0x359c72){var _0x26dc13=function(_0x31e939){while(--_0x31e939){_0x1fe9e5['push'](_0x1fe9e5['shift']());}};_0x26dc13(++_0x359c72);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 84d1220..3fd2c63 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 _0xc043=['define','Condition','tools_conditions','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes'];(function(_0x3c86dc,_0x5d22fc){var _0x4aeb79=function(_0x29d7c8){while(--_0x29d7c8){_0x3c86dc['push'](_0x3c86dc['shift']());}};_0x4aeb79(++_0x5d22fc);}(_0xc043,0x1bf));var _0x3c04=function(_0x4184d9,_0x9da583){_0x4184d9=_0x4184d9-0x0;var _0x125210=_0xc043[_0x4184d9];return _0x125210;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3c04('0x0'))(_0x3c04('0x1'));var moment=require(_0x3c04('0x2'));var BPromise=require(_0x3c04('0x3'));var rp=require(_0x3c04('0x4'));var fs=require('fs');var path=require(_0x3c04('0x5'));var rimraf=require(_0x3c04('0x6'));var config=require(_0x3c04('0x7'));var attributes=require(_0x3c04('0x8'));module['exports']=function(_0x27f40d,_0x4925c8){return _0x27f40d[_0x3c04('0x9')](_0x3c04('0xa'),attributes,{'tableName':_0x3c04('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1524=['Condition','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./condition.attributes','exports'];(function(_0x56ec62,_0x5b5b18){var _0x5cdfd4=function(_0x26f9bf){while(--_0x26f9bf){_0x56ec62['push'](_0x56ec62['shift']());}};_0x5cdfd4(++_0x5b5b18);}(_0x1524,0x123));var _0x4152=function(_0xb949a9,_0x2f948a){_0xb949a9=_0xb949a9-0x0;var _0x31932b=_0x1524[_0xb949a9];return _0x31932b;};'use strict';var _=require(_0x4152('0x0'));var util=require('util');var logger=require(_0x4152('0x1'))(_0x4152('0x2'));var moment=require(_0x4152('0x3'));var BPromise=require('bluebird');var rp=require(_0x4152('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4152('0x5'));var config=require(_0x4152('0x6'));var attributes=require(_0x4152('0x7'));module[_0x4152('0x8')]=function(_0x2ad5eb,_0x49130d){return _0x2ad5eb['define'](_0x4152('0x9'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index f4f617e..86d1da9 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 _0x46f4=['debug','Condition,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','Condition,\x20%s,\x20%s'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x46f4,0x1bd));var _0x446f=function(_0x5d62ab,_0x34daff){_0x5d62ab=_0x5d62ab-0x0;var _0x3ae79a=_0x46f4[_0x5d62ab];return _0x3ae79a;};'use strict';var _=require(_0x446f('0x0'));var util=require('util');var moment=require(_0x446f('0x1'));var BPromise=require(_0x446f('0x2'));var rs=require(_0x446f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x446f('0x4'))['db'];var utils=require(_0x446f('0x5'));var logger=require(_0x446f('0x6'))(_0x446f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x446f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5404e6,_0x24b428,_0x17c391){return new BPromise(function(_0x139caf,_0x1b843c){return client['request'](_0x5404e6,_0x17c391)[_0x446f('0x9')](function(_0x309714){logger['info'](_0x446f('0xa'),_0x24b428,'request\x20sent');logger[_0x446f('0xb')](_0x446f('0xc'),_0x24b428,'request\x20sent',JSON['stringify'](_0x309714));if(_0x309714[_0x446f('0xd')]){if(_0x309714[_0x446f('0xd')][_0x446f('0xe')]===0x1f4){logger['error'](_0x446f('0xa'),_0x24b428,_0x309714[_0x446f('0xd')][_0x446f('0xf')]);return _0x1b843c(_0x309714[_0x446f('0xd')][_0x446f('0xf')]);}logger['error']('Condition,\x20%s,\x20%s',_0x24b428,_0x309714['error'][_0x446f('0xf')]);return _0x139caf(_0x309714[_0x446f('0xd')]['message']);}else{logger[_0x446f('0x10')](_0x446f('0xa'),_0x24b428,'request\x20sent');_0x139caf(_0x309714[_0x446f('0x11')][_0x446f('0xf')]);}})[_0x446f('0x12')](function(_0x564d2){logger[_0x446f('0xd')](_0x446f('0xa'),_0x24b428,_0x564d2);_0x1b843c(_0x564d2);});});} \ No newline at end of file +var _0xc8fb=['../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x5f2183,_0x3281db){var _0x1abb54=function(_0x1b79fc){while(--_0x1b79fc){_0x5f2183['push'](_0x5f2183['shift']());}};_0x1abb54(++_0x3281db);}(_0xc8fb,0x12e));var _0xbc8f=function(_0xae1448,_0x580a7c){_0xae1448=_0xae1448-0x0;var _0x4694c2=_0xc8fb[_0xae1448];return _0x4694c2;};'use strict';var _=require(_0xbc8f('0x0'));var util=require(_0xbc8f('0x1'));var moment=require(_0xbc8f('0x2'));var BPromise=require('bluebird');var rs=require(_0xbc8f('0x3'));var fs=require('fs');var Redis=require(_0xbc8f('0x4'));var db=require(_0xbc8f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc8f('0x6'))(_0xbc8f('0x7'));var config=require(_0xbc8f('0x8'));var jayson=require(_0xbc8f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x282396,_0x283e17,_0x4fad01){return new BPromise(function(_0x31af73,_0x11f337){return client[_0xbc8f('0xa')](_0x282396,_0x4fad01)[_0xbc8f('0xb')](function(_0x5366f2){logger[_0xbc8f('0xc')](_0xbc8f('0xd'),_0x283e17,_0xbc8f('0xe'));logger[_0xbc8f('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x283e17,_0xbc8f('0xe'),JSON[_0xbc8f('0x10')](_0x5366f2));if(_0x5366f2[_0xbc8f('0x11')]){if(_0x5366f2[_0xbc8f('0x11')][_0xbc8f('0x12')]===0x1f4){logger[_0xbc8f('0x11')](_0xbc8f('0xd'),_0x283e17,_0x5366f2['error'][_0xbc8f('0x13')]);return _0x11f337(_0x5366f2['error']['message']);}logger['error'](_0xbc8f('0xd'),_0x283e17,_0x5366f2[_0xbc8f('0x11')]['message']);return _0x31af73(_0x5366f2[_0xbc8f('0x11')]['message']);}else{logger[_0xbc8f('0xc')]('Condition,\x20%s,\x20%s',_0x283e17,'request\x20sent');_0x31af73(_0x5366f2[_0xbc8f('0x14')][_0xbc8f('0x13')]);}})[_0xbc8f('0x15')](function(_0x4c43be){logger['error'](_0xbc8f('0xd'),_0x283e17,_0x4c43be);_0x11f337(_0x4c43be);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index a325229..5d3ee71 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 _0x039c=['../../components/interaction/service','../../config/environment','put','/:id','update','delete','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0x039c,0x16e));var _0xc039=function(_0x41f2a9,_0x2775fe){_0x41f2a9=_0x41f2a9-0x0;var _0x37da75=_0x039c[_0x41f2a9];return _0x37da75;};'use strict';var multer=require(_0xc039('0x0'));var util=require(_0xc039('0x1'));var path=require(_0xc039('0x2'));var timeout=require(_0xc039('0x3'));var express=require(_0xc039('0x4'));var router=express[_0xc039('0x5')]();var fs_extra=require(_0xc039('0x6'));var auth=require(_0xc039('0x7'));var interaction=require(_0xc039('0x8'));var config=require(_0xc039('0x9'));var controller=require('./condition.controller');router[_0xc039('0xa')](_0xc039('0xb'),auth['isAuthenticated'](),controller[_0xc039('0xc')]);router[_0xc039('0xd')]('/:id',auth[_0xc039('0xe')](),controller[_0xc039('0xf')]);module[_0xc039('0x10')]=router; \ No newline at end of file +var _0x4680=['express','fs-extra','../../components/auth/service','./condition.controller','put','/:id','isAuthenticated','update','multer'];(function(_0x316904,_0x1e8b77){var _0xfa9a21=function(_0x2b75ae){while(--_0x2b75ae){_0x316904['push'](_0x316904['shift']());}};_0xfa9a21(++_0x1e8b77);}(_0x4680,0x194));var _0x0468=function(_0x10a11e,_0x25306f){_0x10a11e=_0x10a11e-0x0;var _0x3bbbe1=_0x4680[_0x10a11e];return _0x3bbbe1;};'use strict';var multer=require(_0x0468('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0468('0x1'));var router=express['Router']();var fs_extra=require(_0x0468('0x2'));var auth=require(_0x0468('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0468('0x4'));router[_0x0468('0x5')](_0x0468('0x6'),auth[_0x0468('0x7')](),controller[_0x0468('0x8')]);router['delete'](_0x0468('0x6'),auth[_0x0468('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 1dbbe29..321277f 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 _0x18f8=['INTEGER','STRING','name'];(function(_0x4bc881,_0x5aea4e){var _0x593ad5=function(_0x5a05a0){while(--_0x5a05a0){_0x4bc881['push'](_0x4bc881['shift']());}};_0x593ad5(++_0x5aea4e);}(_0x18f8,0x80));var _0x818f=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x18f8[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x818f('0x0')},'OrderBy':{'type':Sequelize[_0x818f('0x1')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x818f('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x2f5c=['sequelize','exports','STRING','INTEGER'];(function(_0x2adac5,_0x38fea6){var _0x1661ab=function(_0x10797b){while(--_0x10797b){_0x2adac5['push'](_0x2adac5['shift']());}};_0x1661ab(++_0x38fea6);}(_0x2f5c,0x1c4));var _0xc2f5=function(_0x3dbcc0,_0x4365d7){_0x3dbcc0=_0x3dbcc0-0x0;var _0x56f62c=_0x2f5c[_0x3dbcc0];return _0x56f62c;};'use strict';var Sequelize=require(_0xc2f5('0x0'));module[_0xc2f5('0x1')]={'name':{'type':Sequelize[_0xc2f5('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xc2f5('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xc2f5('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index fab343b..0a962fc 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 _0x9582=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','offset','count','set','json','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','ContactItemType','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ContactItemTypes','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x9582,0x95));var _0x2958=function(_0x395c83,_0x34004e){_0x395c83=_0x395c83-0x0;var _0xeb515=_0x9582[_0x395c83];return _0xeb515;};'use strict';var emlformat=require(_0x2958('0x0'));var rimraf=require(_0x2958('0x1'));var zipdir=require(_0x2958('0x2'));var jsonpatch=require(_0x2958('0x3'));var rp=require(_0x2958('0x4'));var moment=require(_0x2958('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2958('0x6'));var util=require(_0x2958('0x7'));var path=require(_0x2958('0x8'));var sox=require(_0x2958('0x9'));var csv=require(_0x2958('0xa'));var ejs=require(_0x2958('0xb'));var fs=require('fs');var fs_extra=require(_0x2958('0xc'));var _=require(_0x2958('0xd'));var squel=require(_0x2958('0xe'));var crypto=require(_0x2958('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2958('0xa'));var querystring=require('querystring');var Papa=require(_0x2958('0x10'));var Redis=require('ioredis');var authService=require(_0x2958('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2958('0x12'));var hardwareService=require(_0x2958('0x13'));var logger=require(_0x2958('0x14'))(_0x2958('0x15'));var utils=require(_0x2958('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2958('0x17'));var db=require(_0x2958('0x18'))['db'];function respondWithStatusCode(_0x33a13a,_0x20e06a){_0x20e06a=_0x20e06a||0xcc;return function(_0x47067d){if(_0x47067d){return _0x33a13a[_0x2958('0x19')](_0x20e06a);}return _0x33a13a[_0x2958('0x1a')](_0x20e06a)[_0x2958('0x1b')]();};}function respondWithResult(_0x5bd520,_0x42e976){_0x42e976=_0x42e976||0xc8;return function(_0x2e12d4){if(_0x2e12d4){return _0x5bd520['status'](_0x42e976)['json'](_0x2e12d4);}};}function respondWithFilteredResult(_0x21ed6c,_0x38e724){return function(_0x5f06b1){if(_0x5f06b1){var _0x3bef50=typeof _0x38e724['offset']==='undefined'&&typeof _0x38e724[_0x2958('0x1c')]===_0x2958('0x1d');var _0x55e261=_0x5f06b1['count'];var _0x28a92c=_0x3bef50?0x0:_0x38e724[_0x2958('0x1e')];var _0x310d07=_0x3bef50?_0x5f06b1[_0x2958('0x1f')]:_0x38e724[_0x2958('0x1e')]+_0x38e724['limit'];var _0x19a614;if(_0x310d07>=_0x55e261){_0x310d07=_0x55e261;_0x19a614=0xc8;}else{_0x19a614=0xce;}_0x21ed6c[_0x2958('0x1a')](_0x19a614);return _0x21ed6c[_0x2958('0x20')]('Content-Range',_0x28a92c+'-'+_0x310d07+'/'+_0x55e261)[_0x2958('0x21')](_0x5f06b1);}return null;};}function patchUpdates(_0x53b100){return function(_0x1da684){try{jsonpatch['apply'](_0x1da684,_0x53b100,!![]);}catch(_0x5eaf36){return BPromise[_0x2958('0x22')](_0x5eaf36);}return _0x1da684[_0x2958('0x23')]();};}function saveUpdates(_0x2a02a4,_0x26c5a5){return function(_0x2202f8){if(_0x2202f8){return _0x2202f8[_0x2958('0x24')](_0x2a02a4)[_0x2958('0x25')](function(_0x2b9818){return _0x2b9818;});}return null;};}function removeEntity(_0x330763,_0x2aa514){return function(_0xaf5547){if(_0xaf5547){return _0xaf5547[_0x2958('0x26')]()[_0x2958('0x25')](function(){var _0x1943af=_0xaf5547[_0x2958('0x27')]({'plain':!![]});var _0x4f811a='ContactItemTypes';return db[_0x2958('0x28')][_0x2958('0x26')]({'where':{'type':_0x4f811a,'resourceId':_0x1943af['id']}})[_0x2958('0x25')](function(){return _0xaf5547;});})[_0x2958('0x25')](function(){_0x330763['status'](0xcc)[_0x2958('0x1b')]();});}};}function handleEntityNotFound(_0x57ae96,_0x402d97){return function(_0x40adce){if(!_0x40adce){_0x57ae96[_0x2958('0x19')](0x194);}return _0x40adce;};}function handleError(_0x4581d3,_0x23a566){_0x23a566=_0x23a566||0x1f4;return function(_0x36e2a5){logger[_0x2958('0x29')](_0x36e2a5['stack']);if(_0x36e2a5[_0x2958('0x2a')]){delete _0x36e2a5['name'];}_0x4581d3['status'](_0x23a566)[_0x2958('0x2b')](_0x36e2a5);};}exports[_0x2958('0x2c')]=function(_0x973486,_0x34e56e){var _0x584179={},_0x2d9472={},_0x222b83={'count':0x0,'rows':[]};var _0x2c73e9=_['map'](db[_0x2958('0x2d')][_0x2958('0x2e')],function(_0x5f34d4){return{'name':_0x5f34d4[_0x2958('0x2f')],'type':_0x5f34d4['type'][_0x2958('0x30')]};});_0x2d9472['model']=_[_0x2958('0x31')](_0x2c73e9,'name');_0x2d9472[_0x2958('0x32')]=_[_0x2958('0x33')](_0x973486[_0x2958('0x32')]);_0x2d9472[_0x2958('0x34')]=_[_0x2958('0x35')](_0x2d9472[_0x2958('0x36')],_0x2d9472[_0x2958('0x32')]);_0x584179[_0x2958('0x37')]=_[_0x2958('0x35')](_0x2d9472['model'],qs[_0x2958('0x38')](_0x973486['query'][_0x2958('0x38')]));_0x584179['attributes']=_0x584179[_0x2958('0x37')][_0x2958('0x39')]?_0x584179[_0x2958('0x37')]:_0x2d9472[_0x2958('0x36')];if(!_0x973486[_0x2958('0x32')][_0x2958('0x3a')](_0x2958('0x3b'))){_0x584179[_0x2958('0x1c')]=qs[_0x2958('0x1c')](_0x973486[_0x2958('0x32')][_0x2958('0x1c')]);_0x584179[_0x2958('0x1e')]=qs[_0x2958('0x1e')](_0x973486['query'][_0x2958('0x1e')]);}_0x584179[_0x2958('0x3c')]=qs[_0x2958('0x3d')](_0x973486[_0x2958('0x32')]['sort']);_0x584179[_0x2958('0x3e')]=qs[_0x2958('0x34')](_[_0x2958('0x3f')](_0x973486[_0x2958('0x32')],_0x2d9472[_0x2958('0x34')]),_0x2c73e9);if(_0x973486[_0x2958('0x32')][_0x2958('0x40')]){_0x584179[_0x2958('0x3e')]=_[_0x2958('0x41')](_0x584179[_0x2958('0x3e')],{'$or':_[_0x2958('0x31')](_0x2c73e9,function(_0xb0398d){if(_0xb0398d[_0x2958('0x42')]!=='VIRTUAL'){var _0x7bec41={};_0x7bec41[_0xb0398d[_0x2958('0x2a')]]={'$like':'%'+_0x973486['query']['filter']+'%'};return _0x7bec41;}})});}_0x584179=_[_0x2958('0x41')]({},_0x584179,_0x973486[_0x2958('0x43')]);var _0xab188={'where':_0x584179[_0x2958('0x3e')]};return db[_0x2958('0x2d')][_0x2958('0x1f')](_0xab188)[_0x2958('0x25')](function(_0x13be6d){_0x222b83[_0x2958('0x1f')]=_0x13be6d;if(_0x973486[_0x2958('0x32')][_0x2958('0x44')]){_0x584179[_0x2958('0x45')]=[{'all':!![]}];}return db[_0x2958('0x2d')]['findAll'](_0x584179);})[_0x2958('0x25')](function(_0x112256){_0x222b83[_0x2958('0x46')]=_0x112256;return _0x222b83;})[_0x2958('0x25')](respondWithFilteredResult(_0x34e56e,_0x584179))['catch'](handleError(_0x34e56e,null));};exports[_0x2958('0x47')]=function(_0x4af190,_0x53ac56){var _0x38c785={'raw':!![],'where':{'id':_0x4af190[_0x2958('0x48')]['id']}},_0x35993f={};_0x35993f[_0x2958('0x36')]=_[_0x2958('0x33')](db[_0x2958('0x2d')]['rawAttributes']);_0x35993f[_0x2958('0x32')]=_['keys'](_0x4af190['query']);_0x35993f[_0x2958('0x34')]=_['intersection'](_0x35993f[_0x2958('0x36')],_0x35993f[_0x2958('0x32')]);_0x38c785[_0x2958('0x37')]=_[_0x2958('0x35')](_0x35993f[_0x2958('0x36')],qs[_0x2958('0x38')](_0x4af190[_0x2958('0x32')][_0x2958('0x38')]));_0x38c785['attributes']=_0x38c785[_0x2958('0x37')][_0x2958('0x39')]?_0x38c785[_0x2958('0x37')]:_0x35993f[_0x2958('0x36')];if(_0x4af190['query'][_0x2958('0x44')]){_0x38c785[_0x2958('0x45')]=[{'all':!![]}];}_0x38c785=_['merge']({},_0x38c785,_0x4af190[_0x2958('0x43')]);return db[_0x2958('0x2d')][_0x2958('0x49')](_0x38c785)[_0x2958('0x25')](handleEntityNotFound(_0x53ac56,null))[_0x2958('0x25')](respondWithResult(_0x53ac56,null))[_0x2958('0x4a')](handleError(_0x53ac56,null));};exports['create']=function(_0x1fff2a,_0x38b551){return db[_0x2958('0x2d')][_0x2958('0x4b')](_0x1fff2a[_0x2958('0x4c')],{})[_0x2958('0x25')](function(_0x1794c7){var _0xeabeaa=_0x1fff2a[_0x2958('0x4d')][_0x2958('0x27')]({'plain':!![]});if(!_0xeabeaa)throw new Error(_0x2958('0x4e'));if(_0xeabeaa[_0x2958('0x4f')]===_0x2958('0x4d')){var _0x3f7bc1=_0x1794c7[_0x2958('0x27')]({'plain':!![]});var _0xfce675=_0x2958('0x50');return db['UserProfileSection'][_0x2958('0x49')]({'where':{'name':_0xfce675,'userProfileId':_0xeabeaa['userProfileId']},'raw':!![]})[_0x2958('0x25')](function(_0x2816cd){if(_0x2816cd&&_0x2816cd[_0x2958('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x3f7bc1[_0x2958('0x2a')],'resourceId':_0x3f7bc1['id'],'type':_0x2816cd[_0x2958('0x2a')],'sectionId':_0x2816cd['id']},{})[_0x2958('0x25')](function(){return _0x1794c7;});}else{return _0x1794c7;}})['catch'](function(_0x524562){logger[_0x2958('0x29')](_0x2958('0x52'),_0x524562);throw _0x524562;});}return _0x1794c7;})[_0x2958('0x25')](respondWithResult(_0x38b551,0xc9))[_0x2958('0x4a')](handleError(_0x38b551,null));};exports[_0x2958('0x24')]=function(_0x3bdcb6,_0x34da27){if(_0x3bdcb6[_0x2958('0x4c')]['id']){delete _0x3bdcb6[_0x2958('0x4c')]['id'];}return db['ContactItemType'][_0x2958('0x49')]({'where':{'id':_0x3bdcb6[_0x2958('0x48')]['id']}})['then'](handleEntityNotFound(_0x34da27,null))[_0x2958('0x25')](saveUpdates(_0x3bdcb6[_0x2958('0x4c')],null))[_0x2958('0x25')](respondWithResult(_0x34da27,null))[_0x2958('0x4a')](handleError(_0x34da27,null));};exports[_0x2958('0x26')]=function(_0x16d927,_0x542df8){return db[_0x2958('0x2d')][_0x2958('0x49')]({'where':{'id':_0x16d927[_0x2958('0x48')]['id']}})['then'](handleEntityNotFound(_0x542df8,null))['then'](db[_0x2958('0x53')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x16d927[_0x2958('0x48')]['id']}}))['then'](removeEntity(_0x542df8,null))[_0x2958('0x4a')](handleError(_0x542df8,null));}; \ No newline at end of file +var _0xaebd=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','ContactItemTypes','destroy','stack','name','send','map','ContactItemType','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','show','keys','rawAttributes','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation'];(function(_0x34bff6,_0x36f01d){var _0x2704ee=function(_0x2fea17){while(--_0x2fea17){_0x34bff6['push'](_0x34bff6['shift']());}};_0x2704ee(++_0x36f01d);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x232732,_0x1a5e4a){_0x232732=_0x232732-0x0;var _0x13d684=_0xaebd[_0x232732];return _0x13d684;};'use strict';var emlformat=require(_0xdaeb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdaeb('0x1'));var jsonpatch=require(_0xdaeb('0x2'));var rp=require(_0xdaeb('0x3'));var moment=require(_0xdaeb('0x4'));var BPromise=require(_0xdaeb('0x5'));var Mustache=require('mustache');var util=require(_0xdaeb('0x6'));var path=require(_0xdaeb('0x7'));var sox=require(_0xdaeb('0x8'));var csv=require(_0xdaeb('0x9'));var ejs=require(_0xdaeb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdaeb('0xb'));var squel=require(_0xdaeb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdaeb('0xd'));var toCsv=require(_0xdaeb('0x9'));var querystring=require(_0xdaeb('0xe'));var Papa=require('papaparse');var Redis=require(_0xdaeb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdaeb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdaeb('0x11'));var logger=require('../../config/logger')(_0xdaeb('0x12'));var utils=require(_0xdaeb('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdaeb('0x14'))['db'];function respondWithStatusCode(_0x5aedaa,_0x4ee3cc){_0x4ee3cc=_0x4ee3cc||0xcc;return function(_0x2673db){if(_0x2673db){return _0x5aedaa[_0xdaeb('0x15')](_0x4ee3cc);}return _0x5aedaa[_0xdaeb('0x16')](_0x4ee3cc)[_0xdaeb('0x17')]();};}function respondWithResult(_0x1f31be,_0xc6c611){_0xc6c611=_0xc6c611||0xc8;return function(_0x49ba9a){if(_0x49ba9a){return _0x1f31be['status'](_0xc6c611)[_0xdaeb('0x18')](_0x49ba9a);}};}function respondWithFilteredResult(_0x306bdb,_0x34b2fe){return function(_0x18ec4e){if(_0x18ec4e){var _0x538a25=typeof _0x34b2fe['offset']===_0xdaeb('0x19')&&typeof _0x34b2fe['limit']==='undefined';var _0x42e509=_0x18ec4e[_0xdaeb('0x1a')];var _0x1b5243=_0x538a25?0x0:_0x34b2fe[_0xdaeb('0x1b')];var _0x2d8f11=_0x538a25?_0x18ec4e[_0xdaeb('0x1a')]:_0x34b2fe['offset']+_0x34b2fe[_0xdaeb('0x1c')];var _0x5ccf66;if(_0x2d8f11>=_0x42e509){_0x2d8f11=_0x42e509;_0x5ccf66=0xc8;}else{_0x5ccf66=0xce;}_0x306bdb[_0xdaeb('0x16')](_0x5ccf66);return _0x306bdb[_0xdaeb('0x1d')](_0xdaeb('0x1e'),_0x1b5243+'-'+_0x2d8f11+'/'+_0x42e509)['json'](_0x18ec4e);}return null;};}function patchUpdates(_0x4e97e0){return function(_0x13563c){try{jsonpatch[_0xdaeb('0x1f')](_0x13563c,_0x4e97e0,!![]);}catch(_0x23fccb){return BPromise[_0xdaeb('0x20')](_0x23fccb);}return _0x13563c[_0xdaeb('0x21')]();};}function saveUpdates(_0x536aae,_0x597bb7){return function(_0x2c969d){if(_0x2c969d){return _0x2c969d[_0xdaeb('0x22')](_0x536aae)[_0xdaeb('0x23')](function(_0x1d919a){return _0x1d919a;});}return null;};}function removeEntity(_0x39dfae,_0x55c825){return function(_0x254c3b){if(_0x254c3b){return _0x254c3b['destroy']()[_0xdaeb('0x23')](function(){var _0x398616=_0x254c3b[_0xdaeb('0x24')]({'plain':!![]});var _0x3b0770=_0xdaeb('0x25');return db['UserProfileResource'][_0xdaeb('0x26')]({'where':{'type':_0x3b0770,'resourceId':_0x398616['id']}})[_0xdaeb('0x23')](function(){return _0x254c3b;});})[_0xdaeb('0x23')](function(){_0x39dfae['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43095f,_0x4e7f44){return function(_0x5045f8){if(!_0x5045f8){_0x43095f[_0xdaeb('0x15')](0x194);}return _0x5045f8;};}function handleError(_0x1ff9af,_0x3e2b8c){_0x3e2b8c=_0x3e2b8c||0x1f4;return function(_0x5eb7b5){logger['error'](_0x5eb7b5[_0xdaeb('0x27')]);if(_0x5eb7b5[_0xdaeb('0x28')]){delete _0x5eb7b5[_0xdaeb('0x28')];}_0x1ff9af['status'](_0x3e2b8c)[_0xdaeb('0x29')](_0x5eb7b5);};}exports['index']=function(_0x4da82d,_0x28812c){var _0x21f6cf={},_0x2fb019={},_0x28c15c={'count':0x0,'rows':[]};var _0x3276c2=_[_0xdaeb('0x2a')](db[_0xdaeb('0x2b')]['rawAttributes'],function(_0x1c1c7c){return{'name':_0x1c1c7c[_0xdaeb('0x2c')],'type':_0x1c1c7c[_0xdaeb('0x2d')][_0xdaeb('0x2e')]};});_0x2fb019[_0xdaeb('0x2f')]=_['map'](_0x3276c2,_0xdaeb('0x28'));_0x2fb019[_0xdaeb('0x30')]=_['keys'](_0x4da82d[_0xdaeb('0x30')]);_0x2fb019[_0xdaeb('0x31')]=_[_0xdaeb('0x32')](_0x2fb019[_0xdaeb('0x2f')],_0x2fb019[_0xdaeb('0x30')]);_0x21f6cf[_0xdaeb('0x33')]=_[_0xdaeb('0x32')](_0x2fb019[_0xdaeb('0x2f')],qs[_0xdaeb('0x34')](_0x4da82d[_0xdaeb('0x30')]['fields']));_0x21f6cf['attributes']=_0x21f6cf[_0xdaeb('0x33')]['length']?_0x21f6cf[_0xdaeb('0x33')]:_0x2fb019[_0xdaeb('0x2f')];if(!_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x35')](_0xdaeb('0x36'))){_0x21f6cf[_0xdaeb('0x1c')]=qs['limit'](_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x1c')]);_0x21f6cf[_0xdaeb('0x1b')]=qs['offset'](_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x1b')]);}_0x21f6cf[_0xdaeb('0x37')]=qs[_0xdaeb('0x38')](_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x38')]);_0x21f6cf[_0xdaeb('0x39')]=qs['filters'](_[_0xdaeb('0x3a')](_0x4da82d[_0xdaeb('0x30')],_0x2fb019['filters']),_0x3276c2);if(_0x4da82d['query'][_0xdaeb('0x3b')]){_0x21f6cf[_0xdaeb('0x39')]=_['merge'](_0x21f6cf[_0xdaeb('0x39')],{'$or':_[_0xdaeb('0x2a')](_0x3276c2,function(_0x5a4de2){if(_0x5a4de2[_0xdaeb('0x2d')]!==_0xdaeb('0x3c')){var _0x4ecba7={};_0x4ecba7[_0x5a4de2['name']]={'$like':'%'+_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x3b')]+'%'};return _0x4ecba7;}})});}_0x21f6cf=_[_0xdaeb('0x3d')]({},_0x21f6cf,_0x4da82d[_0xdaeb('0x3e')]);var _0x2ea883={'where':_0x21f6cf[_0xdaeb('0x39')]};return db['ContactItemType'][_0xdaeb('0x1a')](_0x2ea883)['then'](function(_0x46aa44){_0x28c15c['count']=_0x46aa44;if(_0x4da82d['query'][_0xdaeb('0x3f')]){_0x21f6cf['include']=[{'all':!![]}];}return db[_0xdaeb('0x2b')]['findAll'](_0x21f6cf);})[_0xdaeb('0x23')](function(_0x244369){_0x28c15c[_0xdaeb('0x40')]=_0x244369;return _0x28c15c;})[_0xdaeb('0x23')](respondWithFilteredResult(_0x28812c,_0x21f6cf))['catch'](handleError(_0x28812c,null));};exports[_0xdaeb('0x41')]=function(_0x5a4b41,_0x3cc6a4){var _0xfb250e={'raw':!![],'where':{'id':_0x5a4b41['params']['id']}},_0x447ef0={};_0x447ef0[_0xdaeb('0x2f')]=_[_0xdaeb('0x42')](db[_0xdaeb('0x2b')][_0xdaeb('0x43')]);_0x447ef0[_0xdaeb('0x30')]=_[_0xdaeb('0x42')](_0x5a4b41[_0xdaeb('0x30')]);_0x447ef0[_0xdaeb('0x31')]=_[_0xdaeb('0x32')](_0x447ef0[_0xdaeb('0x2f')],_0x447ef0[_0xdaeb('0x30')]);_0xfb250e[_0xdaeb('0x33')]=_['intersection'](_0x447ef0[_0xdaeb('0x2f')],qs[_0xdaeb('0x34')](_0x5a4b41['query']['fields']));_0xfb250e[_0xdaeb('0x33')]=_0xfb250e[_0xdaeb('0x33')][_0xdaeb('0x44')]?_0xfb250e['attributes']:_0x447ef0[_0xdaeb('0x2f')];if(_0x5a4b41[_0xdaeb('0x30')][_0xdaeb('0x3f')]){_0xfb250e[_0xdaeb('0x45')]=[{'all':!![]}];}_0xfb250e=_[_0xdaeb('0x3d')]({},_0xfb250e,_0x5a4b41[_0xdaeb('0x3e')]);return db[_0xdaeb('0x2b')][_0xdaeb('0x46')](_0xfb250e)['then'](handleEntityNotFound(_0x3cc6a4,null))[_0xdaeb('0x23')](respondWithResult(_0x3cc6a4,null))[_0xdaeb('0x47')](handleError(_0x3cc6a4,null));};exports['create']=function(_0x38d2ee,_0x4dd70c){return db[_0xdaeb('0x2b')][_0xdaeb('0x48')](_0x38d2ee[_0xdaeb('0x49')],{})[_0xdaeb('0x23')](function(_0x5df403){var _0x449f64=_0x38d2ee[_0xdaeb('0x4a')][_0xdaeb('0x24')]({'plain':!![]});if(!_0x449f64)throw new Error(_0xdaeb('0x4b'));if(_0x449f64['role']==='user'){var _0x1403c8=_0x5df403[_0xdaeb('0x24')]({'plain':!![]});var _0x311219=_0xdaeb('0x25');return db[_0xdaeb('0x4c')][_0xdaeb('0x46')]({'where':{'name':_0x311219,'userProfileId':_0x449f64['userProfileId']},'raw':!![]})[_0xdaeb('0x23')](function(_0x42af1a){if(_0x42af1a&&_0x42af1a[_0xdaeb('0x4d')]===0x0){return db['UserProfileResource'][_0xdaeb('0x48')]({'name':_0x1403c8['name'],'resourceId':_0x1403c8['id'],'type':_0x42af1a[_0xdaeb('0x28')],'sectionId':_0x42af1a['id']},{})[_0xdaeb('0x23')](function(){return _0x5df403;});}else{return _0x5df403;}})[_0xdaeb('0x47')](function(_0x395e2c){logger[_0xdaeb('0x4e')](_0xdaeb('0x4f'),_0x395e2c);throw _0x395e2c;});}return _0x5df403;})['then'](respondWithResult(_0x4dd70c,0xc9))['catch'](handleError(_0x4dd70c,null));};exports['update']=function(_0x2260c5,_0x10287e){if(_0x2260c5['body']['id']){delete _0x2260c5['body']['id'];}return db['ContactItemType'][_0xdaeb('0x46')]({'where':{'id':_0x2260c5[_0xdaeb('0x50')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x10287e,null))[_0xdaeb('0x23')](saveUpdates(_0x2260c5[_0xdaeb('0x49')],null))['then'](respondWithResult(_0x10287e,null))[_0xdaeb('0x47')](handleError(_0x10287e,null));};exports['destroy']=function(_0x25e58f,_0x1b87b2){return db[_0xdaeb('0x2b')][_0xdaeb('0x46')]({'where':{'id':_0x25e58f[_0xdaeb('0x50')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x1b87b2,null))['then'](db['CmContactHasItem'][_0xdaeb('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x25e58f['params']['id']}}))[_0xdaeb('0x23')](removeEntity(_0x1b87b2,null))[_0xdaeb('0x47')](handleError(_0x1b87b2,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 5e55d52..633f6dc 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 _0xf9c6=['../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf9c6,0x164));var _0x6f9c=function(_0x376d33,_0x1ccb15){_0x376d33=_0x376d33-0x0;var _0x360869=_0xf9c6[_0x376d33];return _0x360869;};'use strict';var _=require(_0x6f9c('0x0'));var util=require(_0x6f9c('0x1'));var logger=require('../../config/logger')(_0x6f9c('0x2'));var moment=require(_0x6f9c('0x3'));var BPromise=require(_0x6f9c('0x4'));var rp=require(_0x6f9c('0x5'));var fs=require('fs');var path=require(_0x6f9c('0x6'));var rimraf=require(_0x6f9c('0x7'));var config=require(_0x6f9c('0x8'));var attributes=require(_0x6f9c('0x9'));module[_0x6f9c('0xa')]=function(_0x4261ff,_0x312fd0){return _0x4261ff[_0x6f9c('0xb')](_0x6f9c('0xc'),attributes,{'tableName':_0x6f9c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4802=['../../config/logger','api','moment','bluebird','path','rimraf','./contactItemType.attributes','define','tools_contact_item_types','lodash','util'];(function(_0x5ae723,_0x3eddb4){var _0x1adedb=function(_0x2787dc){while(--_0x2787dc){_0x5ae723['push'](_0x5ae723['shift']());}};_0x1adedb(++_0x3eddb4);}(_0x4802,0x11c));var _0x2480=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x4802[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x2480('0x0'));var util=require(_0x2480('0x1'));var logger=require(_0x2480('0x2'))(_0x2480('0x3'));var moment=require(_0x2480('0x4'));var BPromise=require(_0x2480('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2480('0x6'));var rimraf=require(_0x2480('0x7'));var config=require('../../config/environment');var attributes=require(_0x2480('0x8'));module['exports']=function(_0x21814e,_0x4bfcb3){return _0x21814e[_0x2480('0x9')]('ContactItemType',attributes,{'tableName':_0x2480('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 2267c0d..e84c920 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 _0xc1ae=['jayson/promise','client','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2df97b,_0x25ad7b){var _0x489f67=function(_0x346994){while(--_0x346994){_0x2df97b['push'](_0x2df97b['shift']());}};_0x489f67(++_0x25ad7b);}(_0xc1ae,0xae));var _0xec1a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc1ae[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xec1a('0x0'));var util=require(_0xec1a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec1a('0x2'))['db'];var utils=require(_0xec1a('0x3'));var logger=require(_0xec1a('0x4'))(_0xec1a('0x5'));var config=require('../../config/environment');var jayson=require(_0xec1a('0x6'));var client=jayson[_0xec1a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x578162,_0xfb2418,_0x518979){return new BPromise(function(_0x5e2f42,_0x214935){return client[_0xec1a('0x8')](_0x578162,_0x518979)[_0xec1a('0x9')](function(_0x3f6aef){logger[_0xec1a('0xa')](_0xec1a('0xb'),_0xfb2418,_0xec1a('0xc'));logger[_0xec1a('0xd')](_0xec1a('0xe'),_0xfb2418,_0xec1a('0xc'),JSON[_0xec1a('0xf')](_0x3f6aef));if(_0x3f6aef[_0xec1a('0x10')]){if(_0x3f6aef[_0xec1a('0x10')][_0xec1a('0x11')]===0x1f4){logger[_0xec1a('0x10')](_0xec1a('0xb'),_0xfb2418,_0x3f6aef[_0xec1a('0x10')]['message']);return _0x214935(_0x3f6aef[_0xec1a('0x10')][_0xec1a('0x12')]);}logger[_0xec1a('0x10')](_0xec1a('0xb'),_0xfb2418,_0x3f6aef['error']['message']);return _0x5e2f42(_0x3f6aef[_0xec1a('0x10')]['message']);}else{logger[_0xec1a('0xa')](_0xec1a('0xb'),_0xfb2418,_0xec1a('0xc'));_0x5e2f42(_0x3f6aef['result'][_0xec1a('0x12')]);}})[_0xec1a('0x13')](function(_0x2fd0b1){logger[_0xec1a('0x10')](_0xec1a('0xb'),_0xfb2418,_0x2fd0b1);_0x214935(_0x2fd0b1);});});} \ No newline at end of file +var _0x2ab7=['then','info','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x443834,_0x55f596){var _0x574305=function(_0x1b314b){while(--_0x1b314b){_0x443834['push'](_0x443834['shift']());}};_0x574305(++_0x55f596);}(_0x2ab7,0xe7));var _0x72ab=function(_0x3c2dae,_0x1bcb28){_0x3c2dae=_0x3c2dae-0x0;var _0x18dc5d=_0x2ab7[_0x3c2dae];return _0x18dc5d;};'use strict';var _=require(_0x72ab('0x0'));var util=require(_0x72ab('0x1'));var moment=require(_0x72ab('0x2'));var BPromise=require(_0x72ab('0x3'));var rs=require(_0x72ab('0x4'));var fs=require('fs');var Redis=require(_0x72ab('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x72ab('0x6'));var logger=require(_0x72ab('0x7'))(_0x72ab('0x8'));var config=require(_0x72ab('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x72ab('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54caaf,_0x188caa,_0x2ed3b1){return new BPromise(function(_0xbd73df,_0x4dd1fe){return client['request'](_0x54caaf,_0x2ed3b1)[_0x72ab('0xb')](function(_0x4819ef){logger[_0x72ab('0xc')](_0x72ab('0xd'),_0x188caa,'request\x20sent');logger[_0x72ab('0xe')](_0x72ab('0xf'),_0x188caa,_0x72ab('0x10'),JSON[_0x72ab('0x11')](_0x4819ef));if(_0x4819ef[_0x72ab('0x12')]){if(_0x4819ef[_0x72ab('0x12')][_0x72ab('0x13')]===0x1f4){logger[_0x72ab('0x12')](_0x72ab('0xd'),_0x188caa,_0x4819ef[_0x72ab('0x12')]['message']);return _0x4dd1fe(_0x4819ef['error'][_0x72ab('0x14')]);}logger[_0x72ab('0x12')](_0x72ab('0xd'),_0x188caa,_0x4819ef['error']['message']);return _0xbd73df(_0x4819ef[_0x72ab('0x12')][_0x72ab('0x14')]);}else{logger[_0x72ab('0xc')]('ContactItemType,\x20%s,\x20%s',_0x188caa,_0x72ab('0x10'));_0xbd73df(_0x4819ef['result'][_0x72ab('0x14')]);}})[_0x72ab('0x15')](function(_0x337218){logger[_0x72ab('0x12')](_0x72ab('0xd'),_0x188caa,_0x337218);_0x4dd1fe(_0x337218);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index a022389..bf6493d 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 _0x90db=['express','Router','fs-extra','../../components/interaction/service','./contactItemType.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer'];(function(_0x5cfba4,_0x38818c){var _0x2055c2=function(_0x54adbf){while(--_0x54adbf){_0x5cfba4['push'](_0x5cfba4['shift']());}};_0x2055c2(++_0x38818c);}(_0x90db,0xef));var _0xb90d=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x90db[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0xb90d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb90d('0x1'));var router=express[_0xb90d('0x2')]();var fs_extra=require(_0xb90d('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb90d('0x4'));var config=require('../../config/environment');var controller=require(_0xb90d('0x5'));router[_0xb90d('0x6')]('/',auth[_0xb90d('0x7')](),controller[_0xb90d('0x8')]);router[_0xb90d('0x6')](_0xb90d('0x9'),auth[_0xb90d('0x7')](),controller['show']);router[_0xb90d('0xa')]('/',auth[_0xb90d('0x7')](),controller[_0xb90d('0xb')]);router[_0xb90d('0xc')](_0xb90d('0x9'),auth['isAuthenticated'](),controller[_0xb90d('0xd')]);router['delete']('/:id',auth[_0xb90d('0x7')](),controller[_0xb90d('0xe')]);module[_0xb90d('0xf')]=router; \ No newline at end of file +var _0xab95=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports'];(function(_0x4cfa88,_0x47f1f7){var _0x497e2a=function(_0x533624){while(--_0x533624){_0x4cfa88['push'](_0x4cfa88['shift']());}};_0x497e2a(++_0x47f1f7);}(_0xab95,0x85));var _0x5ab9=function(_0x1ba39c,_0x30ec59){_0x1ba39c=_0x1ba39c-0x0;var _0xf12aab=_0xab95[_0x1ba39c];return _0xf12aab;};'use strict';var multer=require(_0x5ab9('0x0'));var util=require('util');var path=require(_0x5ab9('0x1'));var timeout=require(_0x5ab9('0x2'));var express=require('express');var router=express[_0x5ab9('0x3')]();var fs_extra=require(_0x5ab9('0x4'));var auth=require(_0x5ab9('0x5'));var interaction=require(_0x5ab9('0x6'));var config=require(_0x5ab9('0x7'));var controller=require(_0x5ab9('0x8'));router[_0x5ab9('0x9')]('/',auth[_0x5ab9('0xa')](),controller['index']);router[_0x5ab9('0x9')](_0x5ab9('0xb'),auth[_0x5ab9('0xa')](),controller[_0x5ab9('0xc')]);router[_0x5ab9('0xd')]('/',auth['isAuthenticated'](),controller[_0x5ab9('0xe')]);router[_0x5ab9('0xf')](_0x5ab9('0xb'),auth['isAuthenticated'](),controller[_0x5ab9('0x10')]);router['delete'](_0x5ab9('0xb'),auth[_0x5ab9('0xa')](),controller[_0x5ab9('0x11')]);module[_0x5ab9('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 4273169..f7837ca 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x995a28,_0x1a4be3){var _0x2652ae=function(_0x550360){while(--_0x550360){_0x995a28['push'](_0x995a28['shift']());}};_0x2652ae(++_0x1a4be3);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0xae9569,_0x4da8f1){var _0x3474e9=function(_0x54b36c){while(--_0x54b36c){_0xae9569['push'](_0xae9569['shift']());}};_0x3474e9(++_0x4da8f1);}(_0x2032,0xd9));var _0x2203=function(_0x5ae86d,_0x450f26){_0x5ae86d=_0x5ae86d-0x0;var _0x59d2cc=_0x2032[_0x5ae86d];return _0x59d2cc;};'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/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index ce0f418..2d409a8 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 _0xacd2=['mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','end','status','offset','limit','undefined','count','set','json','reject','save','then','destroy','get','UserProfileResource','sendStatus','error','stack','send','index','map','Dashboard','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','clone','params','find','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','findOne','getItems','eml-format','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x560485,_0x244601){var _0x3e7f69=function(_0x45529f){while(--_0x45529f){_0x560485['push'](_0x560485['shift']());}};_0x3e7f69(++_0x244601);}(_0xacd2,0x80));var _0x2acd=function(_0x450141,_0x18396f){_0x450141=_0x450141-0x0;var _0xd1b59d=_0xacd2[_0x450141];return _0xd1b59d;};'use strict';var emlformat=require(_0x2acd('0x0'));var rimraf=require(_0x2acd('0x1'));var zipdir=require(_0x2acd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2acd('0x3'));var moment=require(_0x2acd('0x4'));var BPromise=require(_0x2acd('0x5'));var Mustache=require(_0x2acd('0x6'));var util=require(_0x2acd('0x7'));var path=require(_0x2acd('0x8'));var sox=require('sox');var csv=require(_0x2acd('0x9'));var ejs=require(_0x2acd('0xa'));var fs=require('fs');var fs_extra=require(_0x2acd('0xb'));var _=require(_0x2acd('0xc'));var squel=require(_0x2acd('0xd'));var crypto=require(_0x2acd('0xe'));var jsforce=require(_0x2acd('0xf'));var deskjs=require(_0x2acd('0x10'));var toCsv=require(_0x2acd('0x9'));var querystring=require(_0x2acd('0x11'));var Papa=require(_0x2acd('0x12'));var Redis=require(_0x2acd('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2acd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2acd('0x15'))(_0x2acd('0x16'));var utils=require(_0x2acd('0x17'));var config=require(_0x2acd('0x18'));var licenseUtil=require(_0x2acd('0x19'));var db=require(_0x2acd('0x1a'))['db'];config['redis']=_[_0x2acd('0x1b')](config[_0x2acd('0x1c')],{'host':_0x2acd('0x1d'),'port':0x18eb});var socket=require(_0x2acd('0x1e'))(new Redis(config[_0x2acd('0x1c')]));require('./dashboard.socket')[_0x2acd('0x1f')](socket);function respondWithStatusCode(_0x1bb70a,_0xfef3c2){_0xfef3c2=_0xfef3c2||0xcc;return function(_0xb6f54f){if(_0xb6f54f){return _0x1bb70a['sendStatus'](_0xfef3c2);}return _0x1bb70a['status'](_0xfef3c2)[_0x2acd('0x20')]();};}function respondWithResult(_0x2b32cc,_0x21b73f){_0x21b73f=_0x21b73f||0xc8;return function(_0x5add57){if(_0x5add57){return _0x2b32cc[_0x2acd('0x21')](_0x21b73f)['json'](_0x5add57);}};}function respondWithFilteredResult(_0x13f855,_0x2f3ccc){return function(_0x140e27){if(_0x140e27){var _0x1d96ab=typeof _0x2f3ccc[_0x2acd('0x22')]==='undefined'&&typeof _0x2f3ccc[_0x2acd('0x23')]===_0x2acd('0x24');var _0x1072a0=_0x140e27['count'];var _0x132241=_0x1d96ab?0x0:_0x2f3ccc[_0x2acd('0x22')];var _0x52d291=_0x1d96ab?_0x140e27[_0x2acd('0x25')]:_0x2f3ccc[_0x2acd('0x22')]+_0x2f3ccc[_0x2acd('0x23')];var _0x34e573;if(_0x52d291>=_0x1072a0){_0x52d291=_0x1072a0;_0x34e573=0xc8;}else{_0x34e573=0xce;}_0x13f855['status'](_0x34e573);return _0x13f855[_0x2acd('0x26')]('Content-Range',_0x132241+'-'+_0x52d291+'/'+_0x1072a0)[_0x2acd('0x27')](_0x140e27);}return null;};}function patchUpdates(_0x2d1217){return function(_0x68089b){try{jsonpatch['apply'](_0x68089b,_0x2d1217,!![]);}catch(_0x1911a3){return BPromise[_0x2acd('0x28')](_0x1911a3);}return _0x68089b[_0x2acd('0x29')]();};}function saveUpdates(_0x91cf15,_0x351a9d){return function(_0x455c04){if(_0x455c04){return _0x455c04['update'](_0x91cf15)[_0x2acd('0x2a')](function(_0xe7379e){return _0xe7379e;});}return null;};}function removeEntity(_0x3db19a,_0x4f00cd){return function(_0x277ae7){if(_0x277ae7){return _0x277ae7[_0x2acd('0x2b')]()[_0x2acd('0x2a')](function(){var _0xd9c348=_0x277ae7[_0x2acd('0x2c')]({'plain':!![]});var _0x50cf21='CustomDashboards';return db[_0x2acd('0x2d')]['destroy']({'where':{'type':_0x50cf21,'resourceId':_0xd9c348['id']}})[_0x2acd('0x2a')](function(){return _0x277ae7;});})['then'](function(){_0x3db19a[_0x2acd('0x21')](0xcc)[_0x2acd('0x20')]();});}};}function handleEntityNotFound(_0x99a739,_0x16c26b){return function(_0x453718){if(!_0x453718){_0x99a739[_0x2acd('0x2e')](0x194);}return _0x453718;};}function handleError(_0xc4ea6d,_0x19d44c){_0x19d44c=_0x19d44c||0x1f4;return function(_0x39de83){logger[_0x2acd('0x2f')](_0x39de83[_0x2acd('0x30')]);if(_0x39de83['name']){delete _0x39de83['name'];}_0xc4ea6d[_0x2acd('0x21')](_0x19d44c)[_0x2acd('0x31')](_0x39de83);};}exports[_0x2acd('0x32')]=function(_0x3d69f7,_0x4bf9e3){var _0x3237ed={},_0x4f56c4={},_0x118bb3={'count':0x0,'rows':[]};var _0x43fa1b=_[_0x2acd('0x33')](db[_0x2acd('0x34')][_0x2acd('0x35')],function(_0x53b400){return{'name':_0x53b400['fieldName'],'type':_0x53b400[_0x2acd('0x36')][_0x2acd('0x37')]};});_0x4f56c4[_0x2acd('0x38')]=_[_0x2acd('0x33')](_0x43fa1b,_0x2acd('0x39'));_0x4f56c4[_0x2acd('0x3a')]=_[_0x2acd('0x3b')](_0x3d69f7[_0x2acd('0x3a')]);_0x4f56c4[_0x2acd('0x3c')]=_[_0x2acd('0x3d')](_0x4f56c4[_0x2acd('0x38')],_0x4f56c4['query']);_0x3237ed[_0x2acd('0x3e')]=_[_0x2acd('0x3d')](_0x4f56c4[_0x2acd('0x38')],qs[_0x2acd('0x3f')](_0x3d69f7[_0x2acd('0x3a')][_0x2acd('0x3f')]));_0x3237ed[_0x2acd('0x3e')]=_0x3237ed[_0x2acd('0x3e')][_0x2acd('0x40')]?_0x3237ed[_0x2acd('0x3e')]:_0x4f56c4[_0x2acd('0x38')];if(!_0x3d69f7[_0x2acd('0x3a')][_0x2acd('0x41')](_0x2acd('0x42'))){_0x3237ed[_0x2acd('0x23')]=qs[_0x2acd('0x23')](_0x3d69f7[_0x2acd('0x3a')][_0x2acd('0x23')]);_0x3237ed['offset']=qs[_0x2acd('0x22')](_0x3d69f7[_0x2acd('0x3a')]['offset']);}_0x3237ed[_0x2acd('0x43')]=qs[_0x2acd('0x44')](_0x3d69f7[_0x2acd('0x3a')][_0x2acd('0x44')]);_0x3237ed[_0x2acd('0x45')]=qs[_0x2acd('0x3c')](_[_0x2acd('0x46')](_0x3d69f7[_0x2acd('0x3a')],_0x4f56c4[_0x2acd('0x3c')]),_0x43fa1b);if(_0x3d69f7[_0x2acd('0x3a')]['filter']){_0x3237ed['where']=_['merge'](_0x3237ed[_0x2acd('0x45')],{'$or':_[_0x2acd('0x33')](_0x43fa1b,function(_0x53097d){if(_0x53097d['type']!==_0x2acd('0x47')){var _0x4ecee0={};_0x4ecee0[_0x53097d[_0x2acd('0x39')]]={'$like':'%'+_0x3d69f7[_0x2acd('0x3a')][_0x2acd('0x48')]+'%'};return _0x4ecee0;}})});}_0x3237ed=_[_0x2acd('0x49')]({},_0x3237ed,_0x3d69f7[_0x2acd('0x4a')]);var _0x57f630={'where':_0x3237ed['where']};return db['Dashboard'][_0x2acd('0x25')](_0x57f630)['then'](function(_0x6afbc2){_0x118bb3[_0x2acd('0x25')]=_0x6afbc2;if(_0x3d69f7['query'][_0x2acd('0x4b')]){_0x3237ed[_0x2acd('0x4c')]=[{'all':!![]}];}return db[_0x2acd('0x34')][_0x2acd('0x4d')](_0x3237ed);})[_0x2acd('0x2a')](function(_0x423a8d){_0x118bb3[_0x2acd('0x4e')]=_0x423a8d;return _0x118bb3;})[_0x2acd('0x2a')](respondWithFilteredResult(_0x4bf9e3,_0x3237ed))[_0x2acd('0x4f')](handleError(_0x4bf9e3,null));};exports[_0x2acd('0x50')]=function(_0x2877fe,_0x4f5c19){var _0x675a34={'raw':![],'where':{'id':_0x2877fe['params']['id']}},_0x43815c={};_0x43815c[_0x2acd('0x38')]=_[_0x2acd('0x3b')](db['Dashboard'][_0x2acd('0x35')]);_0x43815c[_0x2acd('0x3a')]=_[_0x2acd('0x3b')](_0x2877fe[_0x2acd('0x3a')]);_0x43815c[_0x2acd('0x3c')]=_[_0x2acd('0x3d')](_0x43815c[_0x2acd('0x38')],_0x43815c[_0x2acd('0x3a')]);_0x675a34['attributes']=_['intersection'](_0x43815c['model'],qs[_0x2acd('0x3f')](_0x2877fe['query']['fields']));_0x675a34[_0x2acd('0x3e')]=_0x675a34[_0x2acd('0x3e')][_0x2acd('0x40')]?_0x675a34[_0x2acd('0x3e')]:_0x43815c['model'];if(_0x2877fe[_0x2acd('0x3a')]['includeAll']){_0x675a34[_0x2acd('0x4c')]=[{'all':!![]}];}_0x675a34=_[_0x2acd('0x49')]({},_0x675a34,_0x2877fe[_0x2acd('0x4a')]);return db['Dashboard']['find'](_0x675a34)[_0x2acd('0x2a')](handleEntityNotFound(_0x4f5c19,null))[_0x2acd('0x2a')](respondWithResult(_0x4f5c19,null))[_0x2acd('0x4f')](handleError(_0x4f5c19,null));};exports[_0x2acd('0x51')]=function(_0x58b309,_0x5e46e3){return db['Dashboard']['create'](_0x58b309[_0x2acd('0x52')],{})['then'](function(_0x333551){var _0x47f2bc=_0x58b309['user'][_0x2acd('0x2c')]({'plain':!![]});if(!_0x47f2bc)throw new Error(_0x2acd('0x53'));if(_0x47f2bc[_0x2acd('0x54')]===_0x2acd('0x55')){var _0x4d07f9=_0x333551[_0x2acd('0x2c')]({'plain':!![]});var _0x4dea9e=_0x2acd('0x56');return db[_0x2acd('0x57')]['find']({'where':{'name':_0x4dea9e,'userProfileId':_0x47f2bc[_0x2acd('0x58')]},'raw':!![]})[_0x2acd('0x2a')](function(_0x29e693){if(_0x29e693&&_0x29e693[_0x2acd('0x59')]===0x0){return db[_0x2acd('0x2d')][_0x2acd('0x51')]({'name':_0x4d07f9[_0x2acd('0x39')],'resourceId':_0x4d07f9['id'],'type':_0x29e693[_0x2acd('0x39')],'sectionId':_0x29e693['id']},{})['then'](function(){return _0x333551;});}else{return _0x333551;}})['catch'](function(_0x418ab3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x418ab3);throw _0x418ab3;});}return _0x333551;})[_0x2acd('0x2a')](respondWithResult(_0x5e46e3,0xc9))[_0x2acd('0x4f')](handleError(_0x5e46e3,null));};exports[_0x2acd('0x5a')]=function(_0x2fd36e,_0x253350){var _0x19ac34={'where':{'id':_0x2fd36e[_0x2acd('0x5b')]['id']}},_0x27bab3={};_0x27bab3[_0x2acd('0x38')]=_[_0x2acd('0x3b')](db[_0x2acd('0x34')][_0x2acd('0x35')]);_0x19ac34[_0x2acd('0x3e')]=_['intersection'](_0x27bab3[_0x2acd('0x38')],qs['fields'](_0x2fd36e[_0x2acd('0x3a')]['fields']));_0x19ac34[_0x2acd('0x3e')]=_0x19ac34[_0x2acd('0x3e')][_0x2acd('0x40')]?_0x19ac34[_0x2acd('0x3e')]:_0x27bab3[_0x2acd('0x38')];if(_0x2fd36e[_0x2acd('0x3a')][_0x2acd('0x4b')]){_0x19ac34[_0x2acd('0x4c')]=[{'all':!![]}];}_0x19ac34=_[_0x2acd('0x49')]({},_0x19ac34,_0x2fd36e[_0x2acd('0x4a')]);return db[_0x2acd('0x34')][_0x2acd('0x5c')](_0x19ac34)[_0x2acd('0x2a')](handleEntityNotFound(_0x253350,null))['then'](function(_0x50e85e){if(_0x50e85e){var _0x1ca6c6=_0x50e85e[_0x2acd('0x2c')]({'plain':!![]});_0x1ca6c6=qs[_0x2acd('0x5d')](_0x1ca6c6,['id',_0x2acd('0x5e'),_0x2acd('0x5f')]);_0x2fd36e['body']=_[_0x2acd('0x5d')](_0x2fd36e[_0x2acd('0x52')],['id','createdAt','updatedAt']);return db[_0x2acd('0x34')][_0x2acd('0x51')](_[_0x2acd('0x49')](_0x1ca6c6,_0x2fd36e['body']),{'include':_0x2fd36e['query'][_0x2acd('0x4b')]?[{'all':!![]}]:undefined})[_0x2acd('0x2a')](function(_0x2c2693){var _0x5635e2=_0x2fd36e[_0x2acd('0x55')][_0x2acd('0x2c')]({'plain':!![]});if(!_0x5635e2)throw new Error(_0x2acd('0x53'));if(_0x5635e2['role']===_0x2acd('0x55')){var _0x14c703=_0x2c2693[_0x2acd('0x2c')]({'plain':!![]});var _0x4c7275='CustomDashboards';return db[_0x2acd('0x57')][_0x2acd('0x5c')]({'where':{'name':_0x4c7275,'userProfileId':_0x5635e2[_0x2acd('0x58')]},'raw':!![]})['then'](function(_0x12fe62){if(_0x12fe62&&_0x12fe62[_0x2acd('0x59')]===0x0){return db[_0x2acd('0x2d')][_0x2acd('0x51')]({'name':_0x14c703['name'],'resourceId':_0x14c703['id'],'type':_0x12fe62[_0x2acd('0x39')],'sectionId':_0x12fe62['id']},{})[_0x2acd('0x2a')](function(){return _0x2c2693;});}else{return _0x2c2693;}})[_0x2acd('0x4f')](function(_0x12ab46){logger['error'](_0x2acd('0x60'),_0x12ab46);throw _0x12ab46;});}return _0x2c2693;});}})[_0x2acd('0x2a')](respondWithResult(_0x253350,0xc9))[_0x2acd('0x4f')](handleError(_0x253350,null));};exports['update']=function(_0x497e8c,_0x1186d5){if(_0x497e8c[_0x2acd('0x52')]['id']){delete _0x497e8c[_0x2acd('0x52')]['id'];}return db[_0x2acd('0x34')][_0x2acd('0x5c')]({'where':{'id':_0x497e8c[_0x2acd('0x5b')]['id']}})[_0x2acd('0x2a')](handleEntityNotFound(_0x1186d5,null))['then'](saveUpdates(_0x497e8c[_0x2acd('0x52')],null))[_0x2acd('0x2a')](respondWithResult(_0x1186d5,null))[_0x2acd('0x4f')](handleError(_0x1186d5,null));};exports['destroy']=function(_0x3f9838,_0x3af462){return db['Dashboard']['find']({'where':{'id':_0x3f9838[_0x2acd('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3af462,null))[_0x2acd('0x2a')](removeEntity(_0x3af462,null))[_0x2acd('0x4f')](handleError(_0x3af462,null));};function widgetAttributes(_0x5aedb7){try{switch(_0x5aedb7[_0x2acd('0x36')]){case'iframe':return[{'name':_0x2acd('0x61'),'value':_0x5aedb7[_0x2acd('0x61')]||(_0x5aedb7[_0x2acd('0x62')]&&_0x5aedb7[_0x2acd('0x62')][0x0]?_0x5aedb7['attrs'][0x0][_0x2acd('0x63')]:undefined)||'https://'}];case _0x2acd('0x64'):return[{'name':_0x2acd('0x65'),'value':_0x5aedb7[_0x2acd('0x65')]||(_0x5aedb7['attrs']&&_0x5aedb7[_0x2acd('0x62')][0x0]?_0x5aedb7['attrs'][0x0]['value']:undefined)||''}];case _0x2acd('0x66'):return[{'name':_0x2acd('0x67'),'value':_0x5aedb7['attrHourFormat']||(_0x5aedb7[_0x2acd('0x62')]&&_0x5aedb7[_0x2acd('0x62')][0x0]?_0x5aedb7[_0x2acd('0x62')][0x0][_0x2acd('0x63')]:undefined)||_0x2acd('0x68')},{'name':_0x2acd('0x69'),'value':_0x5aedb7['attrTimezone']||(_0x5aedb7[_0x2acd('0x62')]&&_0x5aedb7[_0x2acd('0x62')][0x1]?_0x5aedb7[_0x2acd('0x62')][0x1]['value']:undefined)||'0.00'},{'name':_0x2acd('0x6a'),'value':_0x5aedb7[_0x2acd('0x6a')]||(_0x5aedb7[_0x2acd('0x62')]&&_0x5aedb7[_0x2acd('0x62')][0x2]?_0x5aedb7[_0x2acd('0x62')][0x2][_0x2acd('0x63')]:undefined)||0xc}];case'counter':return[{'name':_0x2acd('0x6b'),'value':_0x5aedb7[_0x2acd('0x6b')]||(_0x5aedb7['attrs']&&_0x5aedb7['attrs'][0x0]?_0x5aedb7['attrs'][0x0][_0x2acd('0x63')]:undefined)||_0x2acd('0x6c')},{'name':_0x2acd('0x6d'),'value':_0x5aedb7[_0x2acd('0x6d')]||(_0x5aedb7[_0x2acd('0x62')]&&_0x5aedb7[_0x2acd('0x62')][0x1]?_0x5aedb7[_0x2acd('0x62')][0x1]['value']:undefined)||[]},{'name':_0x2acd('0x6a'),'value':_0x5aedb7[_0x2acd('0x6a')]||(_0x5aedb7['attrs']&&_0x5aedb7[_0x2acd('0x62')][0x2]?_0x5aedb7[_0x2acd('0x62')][0x2][_0x2acd('0x63')]:undefined)||0x14},{'name':'attrChannel','value':_0x5aedb7[_0x2acd('0x6e')]||(_0x5aedb7[_0x2acd('0x62')]&&_0x5aedb7[_0x2acd('0x62')][0x3]?_0x5aedb7[_0x2acd('0x62')][0x3]['value']:undefined)||_0x2acd('0x6f')},{'name':_0x2acd('0x70'),'value':_0x5aedb7[_0x2acd('0x70')]||(_0x5aedb7[_0x2acd('0x62')]&&_0x5aedb7[_0x2acd('0x62')][0x4]?_0x5aedb7[_0x2acd('0x62')][0x4][_0x2acd('0x63')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x5aedb7[_0x2acd('0x71')]||(_0x5aedb7['attrs']&&_0x5aedb7[_0x2acd('0x62')][0x5]?_0x5aedb7['attrs'][0x5][_0x2acd('0x63')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x5aedb7[_0x2acd('0x72')]||(_0x5aedb7[_0x2acd('0x62')]&&_0x5aedb7['attrs'][0x6]?_0x5aedb7[_0x2acd('0x62')][0x6]['value']:undefined)||''},{'name':_0x2acd('0x73'),'value':_0x5aedb7['attrOpenchannelAccounts']||(_0x5aedb7[_0x2acd('0x62')]&&_0x5aedb7['attrs'][0x7]?_0x5aedb7[_0x2acd('0x62')][0x7][_0x2acd('0x63')]:undefined)||''},{'name':_0x2acd('0x74'),'value':_0x5aedb7[_0x2acd('0x74')]||(_0x5aedb7[_0x2acd('0x62')]&&_0x5aedb7[_0x2acd('0x62')][0x8]?_0x5aedb7[_0x2acd('0x62')][0x8][_0x2acd('0x63')]:undefined)||''},{'name':_0x2acd('0x75'),'value':_0x5aedb7[_0x2acd('0x75')]||(_0x5aedb7['attrs']&&_0x5aedb7[_0x2acd('0x62')][0x9]?_0x5aedb7[_0x2acd('0x62')][0x9][_0x2acd('0x63')]:undefined)||''}];case _0x2acd('0x76'):case _0x2acd('0x77'):return[{'name':_0x2acd('0x78'),'value':_0x5aedb7[_0x2acd('0x78')]||(_0x5aedb7[_0x2acd('0x62')]&&_0x5aedb7['attrs'][0x0]?_0x5aedb7[_0x2acd('0x62')][0x0][_0x2acd('0x63')]:undefined)||'total'},{'name':_0x2acd('0x79'),'value':_0x5aedb7[_0x2acd('0x79')]||(_0x5aedb7['attrs']&&_0x5aedb7[_0x2acd('0x62')][0x1]?_0x5aedb7[_0x2acd('0x62')][0x1]['value']:undefined)||null},{'name':_0x2acd('0x7a'),'value':_0x5aedb7[_0x2acd('0x7a')]||(_0x5aedb7[_0x2acd('0x62')]&&_0x5aedb7[_0x2acd('0x62')][0x2]?_0x5aedb7['attrs'][0x2][_0x2acd('0x63')]:undefined)||null},{'name':_0x2acd('0x6d'),'value':_0x5aedb7[_0x2acd('0x6d')]||(_0x5aedb7[_0x2acd('0x62')]&&_0x5aedb7[_0x2acd('0x62')][0x3]?_0x5aedb7[_0x2acd('0x62')][0x3][_0x2acd('0x63')]:undefined)||[]},{'name':'attrChannel','value':_0x5aedb7[_0x2acd('0x6e')]||(_0x5aedb7['attrs']&&_0x5aedb7[_0x2acd('0x62')][0x4]?_0x5aedb7[_0x2acd('0x62')][0x4]['value']:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x5aedb7[_0x2acd('0x70')]||(_0x5aedb7[_0x2acd('0x62')]&&_0x5aedb7['attrs'][0x5]?_0x5aedb7[_0x2acd('0x62')][0x5][_0x2acd('0x63')]:undefined)||''},{'name':_0x2acd('0x71'),'value':_0x5aedb7[_0x2acd('0x71')]||(_0x5aedb7[_0x2acd('0x62')]&&_0x5aedb7['attrs'][0x6]?_0x5aedb7[_0x2acd('0x62')][0x6][_0x2acd('0x63')]:undefined)||''},{'name':_0x2acd('0x72'),'value':_0x5aedb7[_0x2acd('0x72')]||(_0x5aedb7[_0x2acd('0x62')]&&_0x5aedb7[_0x2acd('0x62')][0x7]?_0x5aedb7[_0x2acd('0x62')][0x7][_0x2acd('0x63')]:undefined)||''},{'name':_0x2acd('0x73'),'value':_0x5aedb7[_0x2acd('0x73')]||(_0x5aedb7[_0x2acd('0x62')]&&_0x5aedb7[_0x2acd('0x62')][0x8]?_0x5aedb7[_0x2acd('0x62')][0x8][_0x2acd('0x63')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5aedb7[_0x2acd('0x74')]||(_0x5aedb7[_0x2acd('0x62')]&&_0x5aedb7[_0x2acd('0x62')][0x9]?_0x5aedb7['attrs'][0x9][_0x2acd('0x63')]:undefined)||''},{'name':_0x2acd('0x75'),'value':_0x5aedb7['attrChatWebsites']||(_0x5aedb7[_0x2acd('0x62')]&&_0x5aedb7[_0x2acd('0x62')][0xa]?_0x5aedb7[_0x2acd('0x62')][0xa][_0x2acd('0x63')]:undefined)||''}];case _0x2acd('0x7b'):return[{'name':_0x2acd('0x7c'),'type':_0x5aedb7[_0x2acd('0x7d')]||(_0x5aedb7['attrs']&&_0x5aedb7['attrs'][0x0]?_0x5aedb7[_0x2acd('0x62')][0x0][_0x2acd('0x36')]:undefined)||null,'value':_0x5aedb7['attrReport']||(_0x5aedb7['attrs']&&_0x5aedb7[_0x2acd('0x62')][0x0]?_0x5aedb7[_0x2acd('0x62')][0x0][_0x2acd('0x63')]:undefined)||null},{'name':'attrRefresh','value':_0x5aedb7[_0x2acd('0x7e')]||(_0x5aedb7[_0x2acd('0x62')]&&_0x5aedb7[_0x2acd('0x62')][0x1]?_0x5aedb7[_0x2acd('0x62')][0x1][_0x2acd('0x63')]:undefined)||0x0}];default:return[];}}catch(_0xd1e9af){logger[_0x2acd('0x2f')](_0x2acd('0x7f'),JSON[_0x2acd('0x80')](_0xd1e9af));return[];}}exports[_0x2acd('0x81')]=function(_0x1b0255,_0x3bda9d,_0x4ee1ec){if(_0x1b0255[_0x2acd('0x52')]['id']){delete _0x1b0255[_0x2acd('0x52')]['id'];}return db[_0x2acd('0x34')][_0x2acd('0x5c')]({'where':{'id':_0x1b0255['params']['id']}})[_0x2acd('0x2a')](handleEntityNotFound(_0x3bda9d,null))[_0x2acd('0x2a')](function(_0x3a2732){if(_0x3a2732){_0x1b0255['body'][_0x2acd('0x82')]=_0x3a2732['id'];_0x1b0255[_0x2acd('0x52')][_0x2acd('0x62')]=widgetAttributes(_0x1b0255[_0x2acd('0x52')]);return db[_0x2acd('0x83')]['create'](_0x1b0255[_0x2acd('0x52')]);}})[_0x2acd('0x2a')](respondWithResult(_0x3bda9d,null))[_0x2acd('0x4f')](handleError(_0x3bda9d,null));};exports['getItems']=function(_0x29fc1f,_0x351c8e,_0x4501ca){var _0x2b2dfb={};var _0x5d4069={};var _0x55c2f7;var _0x2b70f1;return db[_0x2acd('0x34')][_0x2acd('0x84')]({'where':{'id':_0x29fc1f[_0x2acd('0x5b')]['id']}})[_0x2acd('0x2a')](handleEntityNotFound(_0x351c8e,null))[_0x2acd('0x2a')](function(_0x40eb9e){if(_0x40eb9e){_0x55c2f7=_0x40eb9e;_0x5d4069[_0x2acd('0x38')]=_[_0x2acd('0x3b')](db['DashboardItem'][_0x2acd('0x35')]);_0x5d4069['query']=_[_0x2acd('0x3b')](_0x29fc1f[_0x2acd('0x3a')]);_0x5d4069[_0x2acd('0x3c')]=_[_0x2acd('0x3d')](_0x5d4069['model'],_0x5d4069['query']);_0x2b2dfb[_0x2acd('0x3e')]=_['intersection'](_0x5d4069[_0x2acd('0x38')],qs[_0x2acd('0x3f')](_0x29fc1f[_0x2acd('0x3a')]['fields']));_0x2b2dfb['attributes']=_0x2b2dfb[_0x2acd('0x3e')][_0x2acd('0x40')]?_0x2b2dfb[_0x2acd('0x3e')]:_0x5d4069[_0x2acd('0x38')];_0x2b2dfb[_0x2acd('0x43')]=qs[_0x2acd('0x44')](_0x29fc1f[_0x2acd('0x3a')][_0x2acd('0x44')]);_0x2b2dfb['where']=qs[_0x2acd('0x3c')](_[_0x2acd('0x46')](_0x29fc1f[_0x2acd('0x3a')],_0x5d4069[_0x2acd('0x3c')]));if(_0x29fc1f[_0x2acd('0x3a')][_0x2acd('0x48')]){_0x2b2dfb[_0x2acd('0x45')]=_[_0x2acd('0x49')](_0x2b2dfb['where'],{'$or':_[_0x2acd('0x33')](_0x2b2dfb[_0x2acd('0x3e')],function(_0x330297){var _0xf7aeb8={};_0xf7aeb8[_0x330297]={'$like':'%'+_0x29fc1f[_0x2acd('0x3a')][_0x2acd('0x48')]+'%'};return _0xf7aeb8;})});}_0x2b2dfb=_['merge']({},_0x2b2dfb,_0x29fc1f[_0x2acd('0x4a')]);return _0x55c2f7[_0x2acd('0x85')](_0x2b2dfb);}})[_0x2acd('0x2a')](function(_0x3426bd){if(_0x3426bd){_0x2b70f1=_0x3426bd[_0x2acd('0x40')];if(!_0x29fc1f[_0x2acd('0x3a')][_0x2acd('0x41')](_0x2acd('0x42'))){_0x2b2dfb[_0x2acd('0x23')]=qs[_0x2acd('0x23')](_0x29fc1f[_0x2acd('0x3a')][_0x2acd('0x23')]);_0x2b2dfb['offset']=qs[_0x2acd('0x22')](_0x29fc1f[_0x2acd('0x3a')][_0x2acd('0x22')]);}return _0x55c2f7['getItems'](_0x2b2dfb);}})['then'](function(_0x4ccf08){if(_0x4ccf08){return _0x4ccf08?{'count':_0x2b70f1,'rows':_0x4ccf08}:null;}})[_0x2acd('0x2a')](respondWithResult(_0x351c8e,null))[_0x2acd('0x4f')](handleError(_0x351c8e,null));}; \ No newline at end of file +var _0xbe6c=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','map','Dashboard','rawAttributes','fieldName','key','filters','intersection','attributes','model','query','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','keys','omit','createdAt','updatedAt','role','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','counter','attrMetric','total','attrFontSize','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','voice','web-report','attrReport','type','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','findOne','DashboardItem','getItems','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus'];(function(_0xb19521,_0xe3a196){var _0x1d4ac6=function(_0x447ebf){while(--_0x447ebf){_0xb19521['push'](_0xb19521['shift']());}};_0x1d4ac6(++_0xe3a196);}(_0xbe6c,0x171));var _0xcbe6=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xbe6c[_0x1caf6a];return _0x1bf493;};'use strict';var emlformat=require(_0xcbe6('0x0'));var rimraf=require(_0xcbe6('0x1'));var zipdir=require(_0xcbe6('0x2'));var jsonpatch=require(_0xcbe6('0x3'));var rp=require(_0xcbe6('0x4'));var moment=require(_0xcbe6('0x5'));var BPromise=require(_0xcbe6('0x6'));var Mustache=require(_0xcbe6('0x7'));var util=require('util');var path=require('path');var sox=require(_0xcbe6('0x8'));var csv=require(_0xcbe6('0x9'));var ejs=require(_0xcbe6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbe6('0xb'));var squel=require(_0xcbe6('0xc'));var crypto=require(_0xcbe6('0xd'));var jsforce=require(_0xcbe6('0xe'));var deskjs=require(_0xcbe6('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcbe6('0x10'));var Papa=require('papaparse');var Redis=require(_0xcbe6('0x11'));var authService=require(_0xcbe6('0x12'));var qs=require(_0xcbe6('0x13'));var as=require(_0xcbe6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbe6('0x15'))(_0xcbe6('0x16'));var utils=require(_0xcbe6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xcbe6('0x18'));var db=require(_0xcbe6('0x19'))['db'];config[_0xcbe6('0x1a')]=_[_0xcbe6('0x1b')](config[_0xcbe6('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcbe6('0x1a')]));require('./dashboard.socket')[_0xcbe6('0x1c')](socket);function respondWithStatusCode(_0x3d4df6,_0x3ed6b8){_0x3ed6b8=_0x3ed6b8||0xcc;return function(_0x2fabb2){if(_0x2fabb2){return _0x3d4df6[_0xcbe6('0x1d')](_0x3ed6b8);}return _0x3d4df6[_0xcbe6('0x1e')](_0x3ed6b8)[_0xcbe6('0x1f')]();};}function respondWithResult(_0x2522b2,_0x1c6ab7){_0x1c6ab7=_0x1c6ab7||0xc8;return function(_0xda5a){if(_0xda5a){return _0x2522b2['status'](_0x1c6ab7)[_0xcbe6('0x20')](_0xda5a);}};}function respondWithFilteredResult(_0x4be2b7,_0x3d8ac7){return function(_0x2d830e){if(_0x2d830e){var _0x4c6c6c=typeof _0x3d8ac7[_0xcbe6('0x21')]===_0xcbe6('0x22')&&typeof _0x3d8ac7[_0xcbe6('0x23')]===_0xcbe6('0x22');var _0x585dfe=_0x2d830e[_0xcbe6('0x24')];var _0xf99777=_0x4c6c6c?0x0:_0x3d8ac7[_0xcbe6('0x21')];var _0x32ee36=_0x4c6c6c?_0x2d830e['count']:_0x3d8ac7[_0xcbe6('0x21')]+_0x3d8ac7[_0xcbe6('0x23')];var _0x3b7837;if(_0x32ee36>=_0x585dfe){_0x32ee36=_0x585dfe;_0x3b7837=0xc8;}else{_0x3b7837=0xce;}_0x4be2b7['status'](_0x3b7837);return _0x4be2b7[_0xcbe6('0x25')](_0xcbe6('0x26'),_0xf99777+'-'+_0x32ee36+'/'+_0x585dfe)[_0xcbe6('0x20')](_0x2d830e);}return null;};}function patchUpdates(_0x1a3d2c){return function(_0x2d817c){try{jsonpatch[_0xcbe6('0x27')](_0x2d817c,_0x1a3d2c,!![]);}catch(_0x1f9256){return BPromise[_0xcbe6('0x28')](_0x1f9256);}return _0x2d817c[_0xcbe6('0x29')]();};}function saveUpdates(_0xab8058,_0x2c2313){return function(_0x33a51d){if(_0x33a51d){return _0x33a51d[_0xcbe6('0x2a')](_0xab8058)[_0xcbe6('0x2b')](function(_0x3b54f6){return _0x3b54f6;});}return null;};}function removeEntity(_0x120f36,_0x35b85d){return function(_0x43fe5c){if(_0x43fe5c){return _0x43fe5c[_0xcbe6('0x2c')]()[_0xcbe6('0x2b')](function(){var _0x19e8ff=_0x43fe5c[_0xcbe6('0x2d')]({'plain':!![]});var _0x246491=_0xcbe6('0x2e');return db[_0xcbe6('0x2f')]['destroy']({'where':{'type':_0x246491,'resourceId':_0x19e8ff['id']}})[_0xcbe6('0x2b')](function(){return _0x43fe5c;});})[_0xcbe6('0x2b')](function(){_0x120f36[_0xcbe6('0x1e')](0xcc)[_0xcbe6('0x1f')]();});}};}function handleEntityNotFound(_0x2b72f8,_0x168dc6){return function(_0x8fed8f){if(!_0x8fed8f){_0x2b72f8[_0xcbe6('0x1d')](0x194);}return _0x8fed8f;};}function handleError(_0x1f20dc,_0x11d722){_0x11d722=_0x11d722||0x1f4;return function(_0x5a5c2a){logger[_0xcbe6('0x30')](_0x5a5c2a[_0xcbe6('0x31')]);if(_0x5a5c2a[_0xcbe6('0x32')]){delete _0x5a5c2a[_0xcbe6('0x32')];}_0x1f20dc[_0xcbe6('0x1e')](_0x11d722)[_0xcbe6('0x33')](_0x5a5c2a);};}exports['index']=function(_0x5db35d,_0x231e83){var _0x2b9c25={},_0x25999c={},_0x4234a7={'count':0x0,'rows':[]};var _0x14459e=_[_0xcbe6('0x34')](db[_0xcbe6('0x35')][_0xcbe6('0x36')],function(_0x55d7f5){return{'name':_0x55d7f5[_0xcbe6('0x37')],'type':_0x55d7f5['type'][_0xcbe6('0x38')]};});_0x25999c['model']=_['map'](_0x14459e,_0xcbe6('0x32'));_0x25999c['query']=_['keys'](_0x5db35d['query']);_0x25999c[_0xcbe6('0x39')]=_[_0xcbe6('0x3a')](_0x25999c['model'],_0x25999c['query']);_0x2b9c25[_0xcbe6('0x3b')]=_[_0xcbe6('0x3a')](_0x25999c[_0xcbe6('0x3c')],qs['fields'](_0x5db35d[_0xcbe6('0x3d')][_0xcbe6('0x3e')]));_0x2b9c25['attributes']=_0x2b9c25['attributes'][_0xcbe6('0x3f')]?_0x2b9c25[_0xcbe6('0x3b')]:_0x25999c[_0xcbe6('0x3c')];if(!_0x5db35d['query']['hasOwnProperty'](_0xcbe6('0x40'))){_0x2b9c25['limit']=qs['limit'](_0x5db35d[_0xcbe6('0x3d')]['limit']);_0x2b9c25[_0xcbe6('0x21')]=qs['offset'](_0x5db35d[_0xcbe6('0x3d')]['offset']);}_0x2b9c25[_0xcbe6('0x41')]=qs[_0xcbe6('0x42')](_0x5db35d[_0xcbe6('0x3d')][_0xcbe6('0x42')]);_0x2b9c25[_0xcbe6('0x43')]=qs[_0xcbe6('0x39')](_[_0xcbe6('0x44')](_0x5db35d[_0xcbe6('0x3d')],_0x25999c[_0xcbe6('0x39')]),_0x14459e);if(_0x5db35d[_0xcbe6('0x3d')][_0xcbe6('0x45')]){_0x2b9c25[_0xcbe6('0x43')]=_['merge'](_0x2b9c25['where'],{'$or':_[_0xcbe6('0x34')](_0x14459e,function(_0x165b59){if(_0x165b59['type']!==_0xcbe6('0x46')){var _0x5ce70b={};_0x5ce70b[_0x165b59['name']]={'$like':'%'+_0x5db35d['query'][_0xcbe6('0x45')]+'%'};return _0x5ce70b;}})});}_0x2b9c25=_[_0xcbe6('0x47')]({},_0x2b9c25,_0x5db35d[_0xcbe6('0x48')]);var _0x2edee3={'where':_0x2b9c25[_0xcbe6('0x43')]};return db[_0xcbe6('0x35')]['count'](_0x2edee3)['then'](function(_0x32a0af){_0x4234a7[_0xcbe6('0x24')]=_0x32a0af;if(_0x5db35d[_0xcbe6('0x3d')]['includeAll']){_0x2b9c25[_0xcbe6('0x49')]=[{'all':!![]}];}return db[_0xcbe6('0x35')][_0xcbe6('0x4a')](_0x2b9c25);})['then'](function(_0x1a4c04){_0x4234a7[_0xcbe6('0x4b')]=_0x1a4c04;return _0x4234a7;})[_0xcbe6('0x2b')](respondWithFilteredResult(_0x231e83,_0x2b9c25))[_0xcbe6('0x4c')](handleError(_0x231e83,null));};exports['show']=function(_0x26d186,_0x3e4ab8){var _0x47277d={'raw':![],'where':{'id':_0x26d186[_0xcbe6('0x4d')]['id']}},_0x2f1219={};_0x2f1219[_0xcbe6('0x3c')]=_['keys'](db[_0xcbe6('0x35')]['rawAttributes']);_0x2f1219[_0xcbe6('0x3d')]=_['keys'](_0x26d186[_0xcbe6('0x3d')]);_0x2f1219['filters']=_['intersection'](_0x2f1219[_0xcbe6('0x3c')],_0x2f1219[_0xcbe6('0x3d')]);_0x47277d[_0xcbe6('0x3b')]=_[_0xcbe6('0x3a')](_0x2f1219[_0xcbe6('0x3c')],qs[_0xcbe6('0x3e')](_0x26d186[_0xcbe6('0x3d')][_0xcbe6('0x3e')]));_0x47277d[_0xcbe6('0x3b')]=_0x47277d[_0xcbe6('0x3b')]['length']?_0x47277d[_0xcbe6('0x3b')]:_0x2f1219['model'];if(_0x26d186[_0xcbe6('0x3d')][_0xcbe6('0x4e')]){_0x47277d[_0xcbe6('0x49')]=[{'all':!![]}];}_0x47277d=_[_0xcbe6('0x47')]({},_0x47277d,_0x26d186[_0xcbe6('0x48')]);return db['Dashboard'][_0xcbe6('0x4f')](_0x47277d)[_0xcbe6('0x2b')](handleEntityNotFound(_0x3e4ab8,null))[_0xcbe6('0x2b')](respondWithResult(_0x3e4ab8,null))[_0xcbe6('0x4c')](handleError(_0x3e4ab8,null));};exports['create']=function(_0x21d82a,_0x12aa72){return db['Dashboard'][_0xcbe6('0x50')](_0x21d82a[_0xcbe6('0x51')],{})[_0xcbe6('0x2b')](function(_0xc37089){var _0xa2bf2=_0x21d82a[_0xcbe6('0x52')][_0xcbe6('0x2d')]({'plain':!![]});if(!_0xa2bf2)throw new Error(_0xcbe6('0x53'));if(_0xa2bf2['role']===_0xcbe6('0x52')){var _0x330408=_0xc37089[_0xcbe6('0x2d')]({'plain':!![]});var _0x565361='CustomDashboards';return db[_0xcbe6('0x54')][_0xcbe6('0x4f')]({'where':{'name':_0x565361,'userProfileId':_0xa2bf2[_0xcbe6('0x55')]},'raw':!![]})[_0xcbe6('0x2b')](function(_0x1728aa){if(_0x1728aa&&_0x1728aa[_0xcbe6('0x56')]===0x0){return db[_0xcbe6('0x2f')][_0xcbe6('0x50')]({'name':_0x330408[_0xcbe6('0x32')],'resourceId':_0x330408['id'],'type':_0x1728aa[_0xcbe6('0x32')],'sectionId':_0x1728aa['id']},{})[_0xcbe6('0x2b')](function(){return _0xc37089;});}else{return _0xc37089;}})[_0xcbe6('0x4c')](function(_0x42f124){logger[_0xcbe6('0x30')](_0xcbe6('0x57'),_0x42f124);throw _0x42f124;});}return _0xc37089;})[_0xcbe6('0x2b')](respondWithResult(_0x12aa72,0xc9))[_0xcbe6('0x4c')](handleError(_0x12aa72,null));};exports['clone']=function(_0x42c7a6,_0x43ac64){var _0x4652e1={'where':{'id':_0x42c7a6[_0xcbe6('0x4d')]['id']}},_0x207353={};_0x207353[_0xcbe6('0x3c')]=_[_0xcbe6('0x58')](db['Dashboard'][_0xcbe6('0x36')]);_0x4652e1[_0xcbe6('0x3b')]=_[_0xcbe6('0x3a')](_0x207353[_0xcbe6('0x3c')],qs[_0xcbe6('0x3e')](_0x42c7a6[_0xcbe6('0x3d')]['fields']));_0x4652e1[_0xcbe6('0x3b')]=_0x4652e1[_0xcbe6('0x3b')][_0xcbe6('0x3f')]?_0x4652e1['attributes']:_0x207353['model'];if(_0x42c7a6['query'][_0xcbe6('0x4e')]){_0x4652e1[_0xcbe6('0x49')]=[{'all':!![]}];}_0x4652e1=_[_0xcbe6('0x47')]({},_0x4652e1,_0x42c7a6[_0xcbe6('0x48')]);return db[_0xcbe6('0x35')]['find'](_0x4652e1)[_0xcbe6('0x2b')](handleEntityNotFound(_0x43ac64,null))[_0xcbe6('0x2b')](function(_0x471ec3){if(_0x471ec3){var _0x5e5c47=_0x471ec3[_0xcbe6('0x2d')]({'plain':!![]});_0x5e5c47=qs[_0xcbe6('0x59')](_0x5e5c47,['id',_0xcbe6('0x5a'),_0xcbe6('0x5b')]);_0x42c7a6['body']=_['omit'](_0x42c7a6[_0xcbe6('0x51')],['id',_0xcbe6('0x5a'),_0xcbe6('0x5b')]);return db[_0xcbe6('0x35')][_0xcbe6('0x50')](_['merge'](_0x5e5c47,_0x42c7a6[_0xcbe6('0x51')]),{'include':_0x42c7a6[_0xcbe6('0x3d')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x586725){var _0x57cf90=_0x42c7a6[_0xcbe6('0x52')][_0xcbe6('0x2d')]({'plain':!![]});if(!_0x57cf90)throw new Error(_0xcbe6('0x53'));if(_0x57cf90[_0xcbe6('0x5c')]===_0xcbe6('0x52')){var _0x76d123=_0x586725['get']({'plain':!![]});var _0x427e09=_0xcbe6('0x2e');return db[_0xcbe6('0x54')][_0xcbe6('0x4f')]({'where':{'name':_0x427e09,'userProfileId':_0x57cf90[_0xcbe6('0x55')]},'raw':!![]})['then'](function(_0x4880c1){if(_0x4880c1&&_0x4880c1[_0xcbe6('0x56')]===0x0){return db[_0xcbe6('0x2f')][_0xcbe6('0x50')]({'name':_0x76d123[_0xcbe6('0x32')],'resourceId':_0x76d123['id'],'type':_0x4880c1['name'],'sectionId':_0x4880c1['id']},{})[_0xcbe6('0x2b')](function(){return _0x586725;});}else{return _0x586725;}})[_0xcbe6('0x4c')](function(_0x1842fa){logger[_0xcbe6('0x30')](_0xcbe6('0x57'),_0x1842fa);throw _0x1842fa;});}return _0x586725;});}})[_0xcbe6('0x2b')](respondWithResult(_0x43ac64,0xc9))[_0xcbe6('0x4c')](handleError(_0x43ac64,null));};exports['update']=function(_0x246692,_0x51b708){if(_0x246692['body']['id']){delete _0x246692[_0xcbe6('0x51')]['id'];}return db[_0xcbe6('0x35')][_0xcbe6('0x4f')]({'where':{'id':_0x246692['params']['id']}})[_0xcbe6('0x2b')](handleEntityNotFound(_0x51b708,null))['then'](saveUpdates(_0x246692[_0xcbe6('0x51')],null))['then'](respondWithResult(_0x51b708,null))['catch'](handleError(_0x51b708,null));};exports[_0xcbe6('0x2c')]=function(_0x43e38d,_0x2c0b17){return db[_0xcbe6('0x35')][_0xcbe6('0x4f')]({'where':{'id':_0x43e38d[_0xcbe6('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2c0b17,null))[_0xcbe6('0x2b')](removeEntity(_0x2c0b17,null))['catch'](handleError(_0x2c0b17,null));};function widgetAttributes(_0x571a81){try{switch(_0x571a81['type']){case _0xcbe6('0x5d'):return[{'name':_0xcbe6('0x5e'),'value':_0x571a81[_0xcbe6('0x5e')]||(_0x571a81[_0xcbe6('0x5f')]&&_0x571a81[_0xcbe6('0x5f')][0x0]?_0x571a81['attrs'][0x0][_0xcbe6('0x60')]:undefined)||_0xcbe6('0x61')}];case _0xcbe6('0x62'):return[{'name':_0xcbe6('0x63'),'value':_0x571a81['attrPath']||(_0x571a81[_0xcbe6('0x5f')]&&_0x571a81['attrs'][0x0]?_0x571a81[_0xcbe6('0x5f')][0x0][_0xcbe6('0x60')]:undefined)||''}];case _0xcbe6('0x64'):return[{'name':_0xcbe6('0x65'),'value':_0x571a81[_0xcbe6('0x65')]||(_0x571a81['attrs']&&_0x571a81[_0xcbe6('0x5f')][0x0]?_0x571a81[_0xcbe6('0x5f')][0x0][_0xcbe6('0x60')]:undefined)||_0xcbe6('0x66')},{'name':_0xcbe6('0x67'),'value':_0x571a81[_0xcbe6('0x67')]||(_0x571a81[_0xcbe6('0x5f')]&&_0x571a81[_0xcbe6('0x5f')][0x1]?_0x571a81[_0xcbe6('0x5f')][0x1]['value']:undefined)||'0.00'},{'name':'attrFontSize','value':_0x571a81['attrFontSize']||(_0x571a81[_0xcbe6('0x5f')]&&_0x571a81[_0xcbe6('0x5f')][0x2]?_0x571a81[_0xcbe6('0x5f')][0x2]['value']:undefined)||0xc}];case _0xcbe6('0x68'):return[{'name':_0xcbe6('0x69'),'value':_0x571a81[_0xcbe6('0x69')]||(_0x571a81[_0xcbe6('0x5f')]&&_0x571a81[_0xcbe6('0x5f')][0x0]?_0x571a81['attrs'][0x0]['value']:undefined)||_0xcbe6('0x6a')},{'name':'attrVoiceQueues','value':_0x571a81['attrVoiceQueues']||(_0x571a81[_0xcbe6('0x5f')]&&_0x571a81['attrs'][0x1]?_0x571a81[_0xcbe6('0x5f')][0x1][_0xcbe6('0x60')]:undefined)||[]},{'name':_0xcbe6('0x6b'),'value':_0x571a81['attrFontSize']||(_0x571a81[_0xcbe6('0x5f')]&&_0x571a81[_0xcbe6('0x5f')][0x2]?_0x571a81[_0xcbe6('0x5f')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x571a81[_0xcbe6('0x6c')]||(_0x571a81[_0xcbe6('0x5f')]&&_0x571a81[_0xcbe6('0x5f')][0x3]?_0x571a81[_0xcbe6('0x5f')][0x3][_0xcbe6('0x60')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x571a81[_0xcbe6('0x6d')]||(_0x571a81[_0xcbe6('0x5f')]&&_0x571a81['attrs'][0x4]?_0x571a81[_0xcbe6('0x5f')][0x4][_0xcbe6('0x60')]:undefined)||''},{'name':_0xcbe6('0x6e'),'value':_0x571a81[_0xcbe6('0x6e')]||(_0x571a81[_0xcbe6('0x5f')]&&_0x571a81[_0xcbe6('0x5f')][0x5]?_0x571a81[_0xcbe6('0x5f')][0x5][_0xcbe6('0x60')]:undefined)||''},{'name':_0xcbe6('0x6f'),'value':_0x571a81[_0xcbe6('0x6f')]||(_0x571a81[_0xcbe6('0x5f')]&&_0x571a81[_0xcbe6('0x5f')][0x6]?_0x571a81[_0xcbe6('0x5f')][0x6][_0xcbe6('0x60')]:undefined)||''},{'name':_0xcbe6('0x70'),'value':_0x571a81['attrOpenchannelAccounts']||(_0x571a81[_0xcbe6('0x5f')]&&_0x571a81[_0xcbe6('0x5f')][0x7]?_0x571a81[_0xcbe6('0x5f')][0x7]['value']:undefined)||''},{'name':_0xcbe6('0x71'),'value':_0x571a81['attrWhatsappAccounts']||(_0x571a81[_0xcbe6('0x5f')]&&_0x571a81[_0xcbe6('0x5f')][0x8]?_0x571a81[_0xcbe6('0x5f')][0x8][_0xcbe6('0x60')]:undefined)||''},{'name':_0xcbe6('0x72'),'value':_0x571a81[_0xcbe6('0x72')]||(_0x571a81[_0xcbe6('0x5f')]&&_0x571a81[_0xcbe6('0x5f')][0x9]?_0x571a81[_0xcbe6('0x5f')][0x9][_0xcbe6('0x60')]:undefined)||''}];case _0xcbe6('0x73'):case _0xcbe6('0x74'):return[{'name':_0xcbe6('0x75'),'value':_0x571a81[_0xcbe6('0x75')]||(_0x571a81[_0xcbe6('0x5f')]&&_0x571a81[_0xcbe6('0x5f')][0x0]?_0x571a81[_0xcbe6('0x5f')][0x0][_0xcbe6('0x60')]:undefined)||_0xcbe6('0x6a')},{'name':_0xcbe6('0x76'),'value':_0x571a81[_0xcbe6('0x76')]||(_0x571a81['attrs']&&_0x571a81[_0xcbe6('0x5f')][0x1]?_0x571a81['attrs'][0x1]['value']:undefined)||null},{'name':_0xcbe6('0x77'),'value':_0x571a81['attrSerie3']||(_0x571a81[_0xcbe6('0x5f')]&&_0x571a81[_0xcbe6('0x5f')][0x2]?_0x571a81[_0xcbe6('0x5f')][0x2][_0xcbe6('0x60')]:undefined)||null},{'name':_0xcbe6('0x78'),'value':_0x571a81[_0xcbe6('0x78')]||(_0x571a81[_0xcbe6('0x5f')]&&_0x571a81['attrs'][0x3]?_0x571a81[_0xcbe6('0x5f')][0x3][_0xcbe6('0x60')]:undefined)||[]},{'name':'attrChannel','value':_0x571a81[_0xcbe6('0x6c')]||(_0x571a81['attrs']&&_0x571a81['attrs'][0x4]?_0x571a81[_0xcbe6('0x5f')][0x4][_0xcbe6('0x60')]:undefined)||_0xcbe6('0x79')},{'name':_0xcbe6('0x6d'),'value':_0x571a81[_0xcbe6('0x6d')]||(_0x571a81[_0xcbe6('0x5f')]&&_0x571a81['attrs'][0x5]?_0x571a81[_0xcbe6('0x5f')][0x5][_0xcbe6('0x60')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x571a81['attrFaxAccounts']||(_0x571a81[_0xcbe6('0x5f')]&&_0x571a81[_0xcbe6('0x5f')][0x6]?_0x571a81[_0xcbe6('0x5f')][0x6]['value']:undefined)||''},{'name':_0xcbe6('0x6f'),'value':_0x571a81['attrSmsAccounts']||(_0x571a81['attrs']&&_0x571a81[_0xcbe6('0x5f')][0x7]?_0x571a81['attrs'][0x7]['value']:undefined)||''},{'name':_0xcbe6('0x70'),'value':_0x571a81['attrOpenchannelAccounts']||(_0x571a81[_0xcbe6('0x5f')]&&_0x571a81['attrs'][0x8]?_0x571a81['attrs'][0x8]['value']:undefined)||''},{'name':_0xcbe6('0x71'),'value':_0x571a81['attrWhatsappAccounts']||(_0x571a81['attrs']&&_0x571a81['attrs'][0x9]?_0x571a81[_0xcbe6('0x5f')][0x9][_0xcbe6('0x60')]:undefined)||''},{'name':'attrChatWebsites','value':_0x571a81[_0xcbe6('0x72')]||(_0x571a81[_0xcbe6('0x5f')]&&_0x571a81['attrs'][0xa]?_0x571a81[_0xcbe6('0x5f')][0xa][_0xcbe6('0x60')]:undefined)||''}];case _0xcbe6('0x7a'):return[{'name':_0xcbe6('0x7b'),'type':_0x571a81['reportType']||(_0x571a81[_0xcbe6('0x5f')]&&_0x571a81[_0xcbe6('0x5f')][0x0]?_0x571a81[_0xcbe6('0x5f')][0x0][_0xcbe6('0x7c')]:undefined)||null,'value':_0x571a81[_0xcbe6('0x7b')]||(_0x571a81[_0xcbe6('0x5f')]&&_0x571a81[_0xcbe6('0x5f')][0x0]?_0x571a81[_0xcbe6('0x5f')][0x0]['value']:undefined)||null},{'name':_0xcbe6('0x7d'),'value':_0x571a81['attrRefresh']||(_0x571a81['attrs']&&_0x571a81[_0xcbe6('0x5f')][0x1]?_0x571a81['attrs'][0x1][_0xcbe6('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x54032e){logger['error'](_0xcbe6('0x7e'),JSON[_0xcbe6('0x7f')](_0x54032e));return[];}}exports[_0xcbe6('0x80')]=function(_0x19e734,_0x4e0a69,_0x139a18){if(_0x19e734['body']['id']){delete _0x19e734['body']['id'];}return db[_0xcbe6('0x35')][_0xcbe6('0x4f')]({'where':{'id':_0x19e734['params']['id']}})[_0xcbe6('0x2b')](handleEntityNotFound(_0x4e0a69,null))[_0xcbe6('0x2b')](function(_0x44e573){if(_0x44e573){_0x19e734[_0xcbe6('0x51')]['DashboardId']=_0x44e573['id'];_0x19e734[_0xcbe6('0x51')][_0xcbe6('0x5f')]=widgetAttributes(_0x19e734['body']);return db['DashboardItem'][_0xcbe6('0x50')](_0x19e734['body']);}})[_0xcbe6('0x2b')](respondWithResult(_0x4e0a69,null))['catch'](handleError(_0x4e0a69,null));};exports['getItems']=function(_0x25e1da,_0x5f4808,_0x293637){var _0x2284ec={};var _0x471505={};var _0x1db254;var _0x473960;return db[_0xcbe6('0x35')][_0xcbe6('0x81')]({'where':{'id':_0x25e1da[_0xcbe6('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5f4808,null))['then'](function(_0x386a02){if(_0x386a02){_0x1db254=_0x386a02;_0x471505[_0xcbe6('0x3c')]=_[_0xcbe6('0x58')](db[_0xcbe6('0x82')]['rawAttributes']);_0x471505[_0xcbe6('0x3d')]=_[_0xcbe6('0x58')](_0x25e1da[_0xcbe6('0x3d')]);_0x471505['filters']=_[_0xcbe6('0x3a')](_0x471505[_0xcbe6('0x3c')],_0x471505['query']);_0x2284ec[_0xcbe6('0x3b')]=_[_0xcbe6('0x3a')](_0x471505['model'],qs[_0xcbe6('0x3e')](_0x25e1da[_0xcbe6('0x3d')][_0xcbe6('0x3e')]));_0x2284ec[_0xcbe6('0x3b')]=_0x2284ec[_0xcbe6('0x3b')][_0xcbe6('0x3f')]?_0x2284ec[_0xcbe6('0x3b')]:_0x471505[_0xcbe6('0x3c')];_0x2284ec[_0xcbe6('0x41')]=qs[_0xcbe6('0x42')](_0x25e1da['query'][_0xcbe6('0x42')]);_0x2284ec[_0xcbe6('0x43')]=qs[_0xcbe6('0x39')](_[_0xcbe6('0x44')](_0x25e1da[_0xcbe6('0x3d')],_0x471505['filters']));if(_0x25e1da['query'][_0xcbe6('0x45')]){_0x2284ec['where']=_[_0xcbe6('0x47')](_0x2284ec['where'],{'$or':_[_0xcbe6('0x34')](_0x2284ec[_0xcbe6('0x3b')],function(_0x327447){var _0x4e0448={};_0x4e0448[_0x327447]={'$like':'%'+_0x25e1da[_0xcbe6('0x3d')][_0xcbe6('0x45')]+'%'};return _0x4e0448;})});}_0x2284ec=_[_0xcbe6('0x47')]({},_0x2284ec,_0x25e1da[_0xcbe6('0x48')]);return _0x1db254[_0xcbe6('0x83')](_0x2284ec);}})[_0xcbe6('0x2b')](function(_0x5c4eb7){if(_0x5c4eb7){_0x473960=_0x5c4eb7['length'];if(!_0x25e1da[_0xcbe6('0x3d')][_0xcbe6('0x84')]('nolimit')){_0x2284ec['limit']=qs[_0xcbe6('0x23')](_0x25e1da[_0xcbe6('0x3d')][_0xcbe6('0x23')]);_0x2284ec[_0xcbe6('0x21')]=qs[_0xcbe6('0x21')](_0x25e1da[_0xcbe6('0x3d')][_0xcbe6('0x21')]);}return _0x1db254[_0xcbe6('0x83')](_0x2284ec);}})[_0xcbe6('0x2b')](function(_0x43856e){if(_0x43856e){return _0x43856e?{'count':_0x473960,'rows':_0x43856e}:null;}})[_0xcbe6('0x2b')](respondWithResult(_0x5f4808,null))[_0xcbe6('0x4c')](handleError(_0x5f4808,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 4d7ee13..34bc488 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 _0x6ee7=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','update'];(function(_0x2a6f6a,_0x4b0fdf){var _0x3c9e47=function(_0x45f854){while(--_0x45f854){_0x2a6f6a['push'](_0x2a6f6a['shift']());}};_0x3c9e47(++_0x4b0fdf);}(_0x6ee7,0x1e1));var _0x76ee=function(_0xa55922,_0x153c44){_0xa55922=_0xa55922-0x0;var _0x1bed9a=_0x6ee7[_0xa55922];return _0x1bed9a;};'use strict';var EventEmitter=require(_0x76ee('0x0'));var Dashboard=require(_0x76ee('0x1'))['db'][_0x76ee('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x76ee('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x76ee('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5dd4ef){return function(_0x3b427a,_0x173429,_0x1ee465){DashboardEvents[_0x76ee('0x5')](_0x5dd4ef+':'+_0x3b427a['id'],_0x3b427a);DashboardEvents[_0x76ee('0x5')](_0x5dd4ef,_0x3b427a);_0x1ee465(null);};}for(var e in events){if(events[_0x76ee('0x6')](e)){var event=events[e];Dashboard[_0x76ee('0x7')](e,emitEvent(event));}}module[_0x76ee('0x8')]=DashboardEvents; \ No newline at end of file +var _0xcb04=['events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0xb49d10,_0x103e8c){var _0x2a8e96=function(_0x11308f){while(--_0x11308f){_0xb49d10['push'](_0xb49d10['shift']());}};_0x2a8e96(++_0x103e8c);}(_0xcb04,0x9a));var _0x4cb0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcb04[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x4cb0('0x0'));var Dashboard=require(_0x4cb0('0x1'))['db'][_0x4cb0('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x4cb0('0x3')](0x0);var events={'afterCreate':_0x4cb0('0x4'),'afterUpdate':_0x4cb0('0x5'),'afterDestroy':_0x4cb0('0x6')};function emitEvent(_0x2f1690){return function(_0x392bd7,_0x3939b4,_0x47aae7){DashboardEvents[_0x4cb0('0x7')](_0x2f1690+':'+_0x392bd7['id'],_0x392bd7);DashboardEvents[_0x4cb0('0x7')](_0x2f1690,_0x392bd7);_0x47aae7(null);};}for(var e in events){if(events[_0x4cb0('0x8')](e)){var event=events[e];Dashboard[_0x4cb0('0x9')](e,emitEvent(event));}}module[_0x4cb0('0xa')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index ac599e0..102d051 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 _0xd4e2=['bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','../../config/logger','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd4e2,0xdc));var _0x2d4e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd4e2[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x2d4e('0x0'));var util=require(_0x2d4e('0x1'));var logger=require(_0x2d4e('0x2'))('api');var moment=require(_0x2d4e('0x3'));var BPromise=require(_0x2d4e('0x4'));var rp=require(_0x2d4e('0x5'));var fs=require('fs');var path=require(_0x2d4e('0x6'));var rimraf=require(_0x2d4e('0x7'));var config=require(_0x2d4e('0x8'));var attributes=require(_0x2d4e('0x9'));module[_0x2d4e('0xa')]=function(_0x492669,_0x5d0300){return _0x492669[_0x2d4e('0xb')](_0x2d4e('0xc'),attributes,{'tableName':_0x2d4e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x18f6=['../../config/environment','./dashboard.attributes','exports','define','dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2e48d8,_0x16167d){var _0x54de0d=function(_0x42a405){while(--_0x42a405){_0x2e48d8['push'](_0x2e48d8['shift']());}};_0x54de0d(++_0x16167d);}(_0x18f6,0x1ef));var _0x618f=function(_0x5aaa93,_0x4a4812){_0x5aaa93=_0x5aaa93-0x0;var _0x2ca00c=_0x18f6[_0x5aaa93];return _0x2ca00c;};'use strict';var _=require(_0x618f('0x0'));var util=require(_0x618f('0x1'));var logger=require(_0x618f('0x2'))(_0x618f('0x3'));var moment=require(_0x618f('0x4'));var BPromise=require(_0x618f('0x5'));var rp=require(_0x618f('0x6'));var fs=require('fs');var path=require(_0x618f('0x7'));var rimraf=require(_0x618f('0x8'));var config=require(_0x618f('0x9'));var attributes=require(_0x618f('0xa'));module[_0x618f('0xb')]=function(_0x36fb8a,_0x4f3f22){return _0x36fb8a[_0x618f('0xc')]('Dashboard',attributes,{'tableName':_0x618f('0xd'),'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 c4fdac3..a4a3563 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 _0x5420=['../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x4c5e5e,_0x5175d1){var _0x1c1175=function(_0x2e43ad){while(--_0x2e43ad){_0x4c5e5e['push'](_0x4c5e5e['shift']());}};_0x1c1175(++_0x5175d1);}(_0x5420,0x94));var _0x0542=function(_0x21dfaa,_0x3b34ef){_0x21dfaa=_0x21dfaa-0x0;var _0xb55215=_0x5420[_0x21dfaa];return _0xb55215;};'use strict';var _=require(_0x0542('0x0'));var util=require(_0x0542('0x1'));var moment=require(_0x0542('0x2'));var BPromise=require(_0x0542('0x3'));var rs=require(_0x0542('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0542('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0542('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0542('0x7')][_0x0542('0x8')]({'port':0x232a});config[_0x0542('0x9')]=_[_0x0542('0xa')](config[_0x0542('0x9')],{'host':_0x0542('0xb'),'port':0x18eb});var socket=require(_0x0542('0xc'))(new Redis(config['redis']));require('./dashboard.socket')[_0x0542('0xd')](socket);function respondWithRpcPromise(_0x60315a,_0x28dd43,_0x4fab45){return new BPromise(function(_0x2573b0,_0x2add40){return client['request'](_0x60315a,_0x4fab45)['then'](function(_0xdabcd3){logger['info'](_0x0542('0xe'),_0x28dd43,_0x0542('0xf'));logger['debug'](_0x0542('0x10'),_0x28dd43,_0x0542('0xf'),JSON['stringify'](_0xdabcd3));if(_0xdabcd3['error']){if(_0xdabcd3[_0x0542('0x11')][_0x0542('0x12')]===0x1f4){logger[_0x0542('0x11')](_0x0542('0xe'),_0x28dd43,_0xdabcd3['error']['message']);return _0x2add40(_0xdabcd3[_0x0542('0x11')]['message']);}logger[_0x0542('0x11')]('Dashboard,\x20%s,\x20%s',_0x28dd43,_0xdabcd3[_0x0542('0x11')][_0x0542('0x13')]);return _0x2573b0(_0xdabcd3[_0x0542('0x11')]['message']);}else{logger[_0x0542('0x14')](_0x0542('0xe'),_0x28dd43,_0x0542('0xf'));_0x2573b0(_0xdabcd3['result']['message']);}})[_0x0542('0x15')](function(_0x382d4a){logger[_0x0542('0x11')](_0x0542('0xe'),_0x28dd43,_0x382d4a);_0x2add40(_0x382d4a);});});} \ No newline at end of file +var _0xeb85=['message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','defaults','localhost','socket.io-emitter','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb85,0x1dd));var _0x5eb8=function(_0x2cd293,_0x2a2c8a){_0x2cd293=_0x2cd293-0x0;var _0x53e244=_0xeb85[_0x2cd293];return _0x53e244;};'use strict';var _=require(_0x5eb8('0x0'));var util=require('util');var moment=require(_0x5eb8('0x1'));var BPromise=require(_0x5eb8('0x2'));var rs=require(_0x5eb8('0x3'));var fs=require('fs');var Redis=require(_0x5eb8('0x4'));var db=require(_0x5eb8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5eb8('0x6'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x5eb8('0x7')](config['redis'],{'host':_0x5eb8('0x8'),'port':0x18eb});var socket=require(_0x5eb8('0x9'))(new Redis(config['redis']));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x40b5fe,_0x26f502,_0x410c1a){return new BPromise(function(_0x35d924,_0x41c076){return client['request'](_0x40b5fe,_0x410c1a)[_0x5eb8('0xa')](function(_0xa881ac){logger[_0x5eb8('0xb')](_0x5eb8('0xc'),_0x26f502,_0x5eb8('0xd'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x26f502,_0x5eb8('0xd'),JSON[_0x5eb8('0xe')](_0xa881ac));if(_0xa881ac[_0x5eb8('0xf')]){if(_0xa881ac[_0x5eb8('0xf')]['code']===0x1f4){logger[_0x5eb8('0xf')](_0x5eb8('0xc'),_0x26f502,_0xa881ac['error'][_0x5eb8('0x10')]);return _0x41c076(_0xa881ac['error'][_0x5eb8('0x10')]);}logger[_0x5eb8('0xf')](_0x5eb8('0xc'),_0x26f502,_0xa881ac[_0x5eb8('0xf')][_0x5eb8('0x10')]);return _0x35d924(_0xa881ac[_0x5eb8('0xf')][_0x5eb8('0x10')]);}else{logger[_0x5eb8('0xb')](_0x5eb8('0xc'),_0x26f502,'request\x20sent');_0x35d924(_0xa881ac['result'][_0x5eb8('0x10')]);}})['catch'](function(_0x2fdf55){logger[_0x5eb8('0xf')]('Dashboard,\x20%s,\x20%s',_0x26f502,_0x2fdf55);_0x41c076(_0x2fdf55);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 7fd838f..0b04fab 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 _0x9f7f=['removeListener','register','length','./dashboard.events','save','remove','update','emit'];(function(_0x57928b,_0x29a111){var _0x49aad6=function(_0x34a268){while(--_0x34a268){_0x57928b['push'](_0x57928b['shift']());}};_0x49aad6(++_0x29a111);}(_0x9f7f,0xdb));var _0xf9f7=function(_0x497f79,_0x14d394){_0x497f79=_0x497f79-0x0;var _0x41c02b=_0x9f7f[_0x497f79];return _0x41c02b;};'use strict';var DashboardEvents=require(_0xf9f7('0x0'));var events=[_0xf9f7('0x1'),_0xf9f7('0x2'),_0xf9f7('0x3')];function createListener(_0x27c775,_0x3b1d4d){return function(_0x2312ed){_0x3b1d4d[_0xf9f7('0x4')](_0x27c775,_0x2312ed);};}function removeListener(_0x640542,_0x14b850){return function(){DashboardEvents[_0xf9f7('0x5')](_0x640542,_0x14b850);};}exports[_0xf9f7('0x6')]=function(_0x5cfcb1){for(var _0x10de1d=0x0,_0x53ac96=events[_0xf9f7('0x7')];_0x10de1d<_0x53ac96;_0x10de1d++){var _0x98f998=events[_0x10de1d];var _0xf9bec4=createListener('dashboard:'+_0x98f998,_0x5cfcb1);DashboardEvents['on'](_0x98f998,_0xf9bec4);}}; \ No newline at end of file +var _0x5740=['dashboard:','./dashboard.events','save','remove','update','emit','removeListener'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x5740,0x120));var _0x0574=function(_0x3b0eac,_0x503c4e){_0x3b0eac=_0x3b0eac-0x0;var _0xdf4967=_0x5740[_0x3b0eac];return _0xdf4967;};'use strict';var DashboardEvents=require(_0x0574('0x0'));var events=[_0x0574('0x1'),_0x0574('0x2'),_0x0574('0x3')];function createListener(_0x5ba941,_0x4e3899){return function(_0x528475){_0x4e3899[_0x0574('0x4')](_0x5ba941,_0x528475);};}function removeListener(_0x2fa60c,_0x39cb19){return function(){DashboardEvents[_0x0574('0x5')](_0x2fa60c,_0x39cb19);};}exports['register']=function(_0x1226b4){for(var _0x483032=0x0,_0x3d9afd=events['length'];_0x483032<_0x3d9afd;_0x483032++){var _0x3bd999=events[_0x483032];var _0x1bed60=createListener(_0x0574('0x6')+_0x3bd999,_0x1226b4);DashboardEvents['on'](_0x3bd999,_0x1bed60);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index ba4175f..4d9d15c 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 _0x02a1=['multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./dashboard.controller','index','get','/:id','isAuthenticated','show','getItems','post','create','/:id/clone','clone','/:id/items','put','update','destroy','exports'];(function(_0x1253a8,_0x299dc6){var _0x43b26b=function(_0x387518){while(--_0x387518){_0x1253a8['push'](_0x1253a8['shift']());}};_0x43b26b(++_0x299dc6);}(_0x02a1,0x1e0));var _0x102a=function(_0x5dfc24,_0xdfb32b){_0x5dfc24=_0x5dfc24-0x0;var _0x4f4bbf=_0x02a1[_0x5dfc24];return _0x4f4bbf;};'use strict';var multer=require(_0x102a('0x0'));var util=require(_0x102a('0x1'));var path=require(_0x102a('0x2'));var timeout=require(_0x102a('0x3'));var express=require(_0x102a('0x4'));var router=express[_0x102a('0x5')]();var fs_extra=require(_0x102a('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x102a('0x7'));var controller=require(_0x102a('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x102a('0x9')]);router[_0x102a('0xa')](_0x102a('0xb'),auth[_0x102a('0xc')](),controller[_0x102a('0xd')]);router[_0x102a('0xa')]('/:id/items',auth[_0x102a('0xc')](),controller[_0x102a('0xe')]);router[_0x102a('0xf')]('/',auth['isAuthenticated'](),controller[_0x102a('0x10')]);router[_0x102a('0xf')](_0x102a('0x11'),auth['isAuthenticated'](),controller[_0x102a('0x12')]);router[_0x102a('0xf')](_0x102a('0x13'),auth[_0x102a('0xc')](),controller['addItem']);router[_0x102a('0x14')](_0x102a('0xb'),auth[_0x102a('0xc')](),controller[_0x102a('0x15')]);router['delete'](_0x102a('0xb'),auth[_0x102a('0xc')](),controller[_0x102a('0x16')]);module[_0x102a('0x17')]=router; \ No newline at end of file +var _0x9c38=['addItem','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getItems','post','create','/:id/clone','clone','/:id/items'];(function(_0x23cdbd,_0xb9572d){var _0x45be65=function(_0x35d55e){while(--_0x35d55e){_0x23cdbd['push'](_0x23cdbd['shift']());}};_0x45be65(++_0xb9572d);}(_0x9c38,0x1da));var _0x89c3=function(_0x201469,_0x44bb60){_0x201469=_0x201469-0x0;var _0x304c47=_0x9c38[_0x201469];return _0x304c47;};'use strict';var multer=require(_0x89c3('0x0'));var util=require(_0x89c3('0x1'));var path=require(_0x89c3('0x2'));var timeout=require(_0x89c3('0x3'));var express=require('express');var router=express[_0x89c3('0x4')]();var fs_extra=require(_0x89c3('0x5'));var auth=require(_0x89c3('0x6'));var interaction=require(_0x89c3('0x7'));var config=require(_0x89c3('0x8'));var controller=require('./dashboard.controller');router[_0x89c3('0x9')]('/',auth[_0x89c3('0xa')](),controller[_0x89c3('0xb')]);router['get'](_0x89c3('0xc'),auth[_0x89c3('0xa')](),controller[_0x89c3('0xd')]);router[_0x89c3('0x9')]('/:id/items',auth[_0x89c3('0xa')](),controller[_0x89c3('0xe')]);router[_0x89c3('0xf')]('/',auth[_0x89c3('0xa')](),controller[_0x89c3('0x10')]);router['post'](_0x89c3('0x11'),auth[_0x89c3('0xa')](),controller[_0x89c3('0x12')]);router['post'](_0x89c3('0x13'),auth[_0x89c3('0xa')](),controller[_0x89c3('0x14')]);router[_0x89c3('0x15')](_0x89c3('0xc'),auth[_0x89c3('0xa')](),controller[_0x89c3('0x16')]);router[_0x89c3('0x17')]('/:id',auth[_0x89c3('0xa')](),controller[_0x89c3('0x18')]);module[_0x89c3('0x19')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 40a6d74..4bcf2e8 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 _0x5d58=['attrs','stringify','INTEGER','#2196f3','STRING','TEXT','parse','getDataValue','setDataValue'];(function(_0x3310d4,_0xbc7852){var _0x1af496=function(_0x3e5cae){while(--_0x3e5cae){_0x3310d4['push'](_0x3310d4['shift']());}};_0x1af496(++_0xbc7852);}(_0x5d58,0x187));var _0x85d5=function(_0x3b0bdd,_0x16586c){_0x3b0bdd=_0x3b0bdd-0x0;var _0x22fc98=_0x5d58[_0x3b0bdd];return _0x22fc98;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require('lodash');module['exports']={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x85d5('0x0')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x85d5('0x1')]('long'),'get':function(){try{return JSON[_0x85d5('0x2')](this[_0x85d5('0x3')]('attrs'));}catch(_0x1eb211){return[];}},'set':function(_0x2d457a){try{this[_0x85d5('0x4')](_0x85d5('0x5'),JSON['stringify'](_0x2d457a));}catch(_0x98c963){this[_0x85d5('0x4')]('attrs',JSON[_0x85d5('0x6')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x85d5('0x7')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x85d5('0x7')]},'col':{'type':Sequelize[_0x85d5('0x7')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x85d5('0x8'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x85d5('0x0')]},'titleFontSize':{'type':Sequelize[_0x85d5('0x7')],'defaultValue':0xc}}; \ No newline at end of file +var _0xbd51=['setDataValue','INTEGER','#ffffff','#2196f3','sequelize','lodash','exports','STRING','attrs','stringify'];(function(_0x1bd85d,_0xdc683f){var _0xd40669=function(_0x318648){while(--_0x318648){_0x1bd85d['push'](_0x1bd85d['shift']());}};_0xd40669(++_0xdc683f);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x4087a0,_0x1eedfe){_0x4087a0=_0x4087a0-0x0;var _0x23a2ba=_0xbd51[_0x4087a0];return _0x23a2ba;};'use strict';var Sequelize=require(_0x1bd5('0x0'));var squel=require('squel');var _=require(_0x1bd5('0x1'));module[_0x1bd5('0x2')]={'title':{'type':Sequelize[_0x1bd5('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1bd5('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON['parse'](this['getDataValue'](_0x1bd5('0x4')));}catch(_0x362b24){return[];}},'set':function(_0x43e6b6){try{this['setDataValue'](_0x1bd5('0x4'),JSON[_0x1bd5('0x5')](_0x43e6b6));}catch(_0x19077c){this[_0x1bd5('0x6')](_0x1bd5('0x4'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x1bd5('0x7')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x1bd5('0x7')]},'col':{'type':Sequelize[_0x1bd5('0x7')]},'background':{'type':Sequelize[_0x1bd5('0x3')],'allowNull':![],'defaultValue':_0x1bd5('0x8'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x1bd5('0x3')],'allowNull':![],'defaultValue':_0x1bd5('0x9'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x1bd5('0x7')],'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 70239ad..e55d397 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 _0x8efc=['apply','reject','update','then','destroy','error','name','show','model','rawAttributes','keys','intersection','query','attributes','fields','includeAll','include','options','DashboardItem','find','catch','params','type','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSmsAccounts','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','zip-dir','request-promise','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','offset','limit','set','Content-Range','json'];(function(_0x2000df,_0x1b77e3){var _0x30da61=function(_0x44ae93){while(--_0x44ae93){_0x2000df['push'](_0x2000df['shift']());}};_0x30da61(++_0x1b77e3);}(_0x8efc,0x8f));var _0xc8ef=function(_0xeaba4b,_0x1eab4b){_0xeaba4b=_0xeaba4b-0x0;var _0x32f4fd=_0x8efc[_0xeaba4b];return _0x32f4fd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc8ef('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc8ef('0x1'));var moment=require('moment');var BPromise=require(_0xc8ef('0x2'));var Mustache=require(_0xc8ef('0x3'));var util=require('util');var path=require('path');var sox=require(_0xc8ef('0x4'));var csv=require('to-csv');var ejs=require(_0xc8ef('0x5'));var fs=require('fs');var fs_extra=require(_0xc8ef('0x6'));var _=require(_0xc8ef('0x7'));var squel=require(_0xc8ef('0x8'));var crypto=require(_0xc8ef('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc8ef('0xa'));var toCsv=require('to-csv');var querystring=require(_0xc8ef('0xb'));var Papa=require(_0xc8ef('0xc'));var Redis=require(_0xc8ef('0xd'));var authService=require(_0xc8ef('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc8ef('0xf'))(_0xc8ef('0x10'));var utils=require(_0xc8ef('0x11'));var config=require(_0xc8ef('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc8ef('0x13'))['db'];config[_0xc8ef('0x14')]=_[_0xc8ef('0x15')](config[_0xc8ef('0x14')],{'host':_0xc8ef('0x16'),'port':0x18eb});var socket=require(_0xc8ef('0x17'))(new Redis(config[_0xc8ef('0x14')]));require(_0xc8ef('0x18'))['register'](socket);function respondWithStatusCode(_0x562685,_0xc4572e){_0xc4572e=_0xc4572e||0xcc;return function(_0x2d9ecf){if(_0x2d9ecf){return _0x562685[_0xc8ef('0x19')](_0xc4572e);}return _0x562685[_0xc8ef('0x1a')](_0xc4572e)[_0xc8ef('0x1b')]();};}function respondWithResult(_0x19054b,_0x957bb6){_0x957bb6=_0x957bb6||0xc8;return function(_0x4026c6){if(_0x4026c6){return _0x19054b['status'](_0x957bb6)['json'](_0x4026c6);}};}function respondWithFilteredResult(_0x38cad6,_0x1dc488){return function(_0x166ec4){if(_0x166ec4){var _0x183c85=typeof _0x1dc488['offset']==='undefined'&&typeof _0x1dc488['limit']==='undefined';var _0x14f7a0=_0x166ec4['count'];var _0x46a1b7=_0x183c85?0x0:_0x1dc488[_0xc8ef('0x1c')];var _0x12d604=_0x183c85?_0x166ec4['count']:_0x1dc488[_0xc8ef('0x1c')]+_0x1dc488[_0xc8ef('0x1d')];var _0x190ec2;if(_0x12d604>=_0x14f7a0){_0x12d604=_0x14f7a0;_0x190ec2=0xc8;}else{_0x190ec2=0xce;}_0x38cad6[_0xc8ef('0x1a')](_0x190ec2);return _0x38cad6[_0xc8ef('0x1e')](_0xc8ef('0x1f'),_0x46a1b7+'-'+_0x12d604+'/'+_0x14f7a0)[_0xc8ef('0x20')](_0x166ec4);}return null;};}function patchUpdates(_0x16bf51){return function(_0x20204f){try{jsonpatch[_0xc8ef('0x21')](_0x20204f,_0x16bf51,!![]);}catch(_0x1790d1){return BPromise[_0xc8ef('0x22')](_0x1790d1);}return _0x20204f['save']();};}function saveUpdates(_0x509619,_0x24b251){return function(_0x3688aa){if(_0x3688aa){return _0x3688aa[_0xc8ef('0x23')](_0x509619)[_0xc8ef('0x24')](function(_0x16c6d4){return _0x16c6d4;});}return null;};}function removeEntity(_0x50238c,_0x5093d3){return function(_0x14c3d0){if(_0x14c3d0){return _0x14c3d0[_0xc8ef('0x25')]()[_0xc8ef('0x24')](function(){_0x50238c['status'](0xcc)[_0xc8ef('0x1b')]();});}};}function handleEntityNotFound(_0x3d7a62,_0xf285d9){return function(_0xc6749){if(!_0xc6749){_0x3d7a62['sendStatus'](0x194);}return _0xc6749;};}function handleError(_0x5524dc,_0x1aad6e){_0x1aad6e=_0x1aad6e||0x1f4;return function(_0xc203df){logger[_0xc8ef('0x26')](_0xc203df['stack']);if(_0xc203df[_0xc8ef('0x27')]){delete _0xc203df[_0xc8ef('0x27')];}_0x5524dc[_0xc8ef('0x1a')](_0x1aad6e)['send'](_0xc203df);};}exports[_0xc8ef('0x28')]=function(_0x5c7b7b,_0x30dd95){var _0x3a54d4={'raw':![],'where':{'id':_0x5c7b7b['params']['id']}},_0x17c07c={};_0x17c07c[_0xc8ef('0x29')]=_['keys'](db['DashboardItem'][_0xc8ef('0x2a')]);_0x17c07c['query']=_[_0xc8ef('0x2b')](_0x5c7b7b['query']);_0x17c07c['filters']=_[_0xc8ef('0x2c')](_0x17c07c[_0xc8ef('0x29')],_0x17c07c[_0xc8ef('0x2d')]);_0x3a54d4[_0xc8ef('0x2e')]=_[_0xc8ef('0x2c')](_0x17c07c[_0xc8ef('0x29')],qs['fields'](_0x5c7b7b[_0xc8ef('0x2d')][_0xc8ef('0x2f')]));_0x3a54d4['attributes']=_0x3a54d4[_0xc8ef('0x2e')]['length']?_0x3a54d4['attributes']:_0x17c07c[_0xc8ef('0x29')];if(_0x5c7b7b[_0xc8ef('0x2d')][_0xc8ef('0x30')]){_0x3a54d4[_0xc8ef('0x31')]=[{'all':!![]}];}_0x3a54d4=_['merge']({},_0x3a54d4,_0x5c7b7b[_0xc8ef('0x32')]);return db[_0xc8ef('0x33')][_0xc8ef('0x34')](_0x3a54d4)[_0xc8ef('0x24')](handleEntityNotFound(_0x30dd95,null))[_0xc8ef('0x24')](respondWithResult(_0x30dd95,null))[_0xc8ef('0x35')](handleError(_0x30dd95,null));};exports[_0xc8ef('0x25')]=function(_0x5d32c8,_0x21e53d){return db['DashboardItem']['find']({'where':{'id':_0x5d32c8[_0xc8ef('0x36')]['id']}})[_0xc8ef('0x24')](handleEntityNotFound(_0x21e53d,null))[_0xc8ef('0x24')](removeEntity(_0x21e53d,null))[_0xc8ef('0x35')](handleError(_0x21e53d,null));};function widgetAttributes(_0xc1f2cf){try{switch(_0xc1f2cf[_0xc8ef('0x37')]){case _0xc8ef('0x38'):return[{'name':_0xc8ef('0x39'),'value':_0xc1f2cf[_0xc8ef('0x39')]||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x0]?_0xc1f2cf[_0xc8ef('0x3a')][0x0][_0xc8ef('0x3b')]:undefined)||'https://'}];case'custom':return[{'name':_0xc8ef('0x3c'),'value':_0xc1f2cf[_0xc8ef('0x3c')]||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x0]?_0xc1f2cf[_0xc8ef('0x3a')][0x0]['value']:undefined)||''}];case _0xc8ef('0x3d'):return[{'name':_0xc8ef('0x3e'),'value':_0xc1f2cf['attrHourFormat']||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x0]?_0xc1f2cf[_0xc8ef('0x3a')][0x0][_0xc8ef('0x3b')]:undefined)||_0xc8ef('0x3f')},{'name':_0xc8ef('0x40'),'value':_0xc1f2cf['attrTimezone']||(_0xc1f2cf['attrs']&&_0xc1f2cf[_0xc8ef('0x3a')][0x1]?_0xc1f2cf[_0xc8ef('0x3a')][0x1][_0xc8ef('0x3b')]:undefined)||_0xc8ef('0x41')},{'name':'attrFontSize','value':_0xc1f2cf[_0xc8ef('0x42')]||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf['attrs'][0x2]?_0xc1f2cf[_0xc8ef('0x3a')][0x2][_0xc8ef('0x3b')]:undefined)||0xc}];case _0xc8ef('0x43'):return[{'name':_0xc8ef('0x44'),'value':_0xc1f2cf['attrMetric']||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x0]?_0xc1f2cf[_0xc8ef('0x3a')][0x0][_0xc8ef('0x3b')]:undefined)||_0xc8ef('0x45')},{'name':_0xc8ef('0x46'),'value':_0xc1f2cf[_0xc8ef('0x46')]||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x1]?_0xc1f2cf[_0xc8ef('0x3a')][0x1][_0xc8ef('0x3b')]:undefined)||[]},{'name':_0xc8ef('0x42'),'value':_0xc1f2cf[_0xc8ef('0x42')]||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x2]?_0xc1f2cf[_0xc8ef('0x3a')][0x2]['value']:undefined)||0x14},{'name':_0xc8ef('0x47'),'value':_0xc1f2cf[_0xc8ef('0x47')]||(_0xc1f2cf['attrs']&&_0xc1f2cf[_0xc8ef('0x3a')][0x3]?_0xc1f2cf['attrs'][0x3][_0xc8ef('0x3b')]:undefined)||'voice'},{'name':_0xc8ef('0x48'),'value':_0xc1f2cf[_0xc8ef('0x48')]||(_0xc1f2cf['attrs']&&_0xc1f2cf['attrs'][0x4]?_0xc1f2cf['attrs'][0x4]['value']:undefined)||''},{'name':_0xc8ef('0x49'),'value':_0xc1f2cf[_0xc8ef('0x49')]||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x5]?_0xc1f2cf[_0xc8ef('0x3a')][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0xc1f2cf['attrSmsAccounts']||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x6]?_0xc1f2cf[_0xc8ef('0x3a')][0x6][_0xc8ef('0x3b')]:undefined)||''},{'name':_0xc8ef('0x4a'),'value':_0xc1f2cf[_0xc8ef('0x4a')]||(_0xc1f2cf['attrs']&&_0xc1f2cf[_0xc8ef('0x3a')][0x7]?_0xc1f2cf[_0xc8ef('0x3a')][0x7]['value']:undefined)||''},{'name':_0xc8ef('0x4b'),'value':_0xc1f2cf['attrWhatsappAccounts']||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf['attrs'][0x8]?_0xc1f2cf['attrs'][0x8][_0xc8ef('0x3b')]:undefined)||''},{'name':'attrChatWebsites','value':_0xc1f2cf[_0xc8ef('0x4c')]||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x9]?_0xc1f2cf[_0xc8ef('0x3a')][0x9]['value']:undefined)||''}];case _0xc8ef('0x4d'):case _0xc8ef('0x4e'):return[{'name':_0xc8ef('0x4f'),'value':_0xc1f2cf['attrSerie1']||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf['attrs'][0x0]?_0xc1f2cf[_0xc8ef('0x3a')][0x0][_0xc8ef('0x3b')]:undefined)||_0xc8ef('0x45')},{'name':_0xc8ef('0x50'),'value':_0xc1f2cf[_0xc8ef('0x50')]||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x1]?_0xc1f2cf[_0xc8ef('0x3a')][0x1][_0xc8ef('0x3b')]:undefined)||null},{'name':'attrSerie3','value':_0xc1f2cf['attrSerie3']||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf['attrs'][0x2]?_0xc1f2cf[_0xc8ef('0x3a')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0xc1f2cf[_0xc8ef('0x46')]||(_0xc1f2cf['attrs']&&_0xc1f2cf['attrs'][0x3]?_0xc1f2cf[_0xc8ef('0x3a')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0xc1f2cf['attrChannel']||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf['attrs'][0x4]?_0xc1f2cf['attrs'][0x4][_0xc8ef('0x3b')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0xc1f2cf[_0xc8ef('0x48')]||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x5]?_0xc1f2cf[_0xc8ef('0x3a')][0x5][_0xc8ef('0x3b')]:undefined)||''},{'name':'attrFaxAccounts','value':_0xc1f2cf['attrFaxAccounts']||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x6]?_0xc1f2cf['attrs'][0x6][_0xc8ef('0x3b')]:undefined)||''},{'name':_0xc8ef('0x51'),'value':_0xc1f2cf['attrSmsAccounts']||(_0xc1f2cf['attrs']&&_0xc1f2cf['attrs'][0x7]?_0xc1f2cf[_0xc8ef('0x3a')][0x7]['value']:undefined)||''},{'name':_0xc8ef('0x4a'),'value':_0xc1f2cf[_0xc8ef('0x4a')]||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x8]?_0xc1f2cf['attrs'][0x8][_0xc8ef('0x3b')]:undefined)||''},{'name':_0xc8ef('0x4b'),'value':_0xc1f2cf['attrWhatsappAccounts']||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x9]?_0xc1f2cf[_0xc8ef('0x3a')][0x9][_0xc8ef('0x3b')]:undefined)||''},{'name':_0xc8ef('0x4c'),'value':_0xc1f2cf[_0xc8ef('0x4c')]||(_0xc1f2cf['attrs']&&_0xc1f2cf['attrs'][0xa]?_0xc1f2cf[_0xc8ef('0x3a')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0xc8ef('0x52'),'type':_0xc1f2cf['reportType']||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf[_0xc8ef('0x3a')][0x0]?_0xc1f2cf[_0xc8ef('0x3a')][0x0][_0xc8ef('0x37')]:undefined)||null,'value':_0xc1f2cf[_0xc8ef('0x52')]||(_0xc1f2cf['attrs']&&_0xc1f2cf[_0xc8ef('0x3a')][0x0]?_0xc1f2cf[_0xc8ef('0x3a')][0x0][_0xc8ef('0x3b')]:undefined)||null},{'name':_0xc8ef('0x53'),'value':_0xc1f2cf[_0xc8ef('0x53')]||(_0xc1f2cf[_0xc8ef('0x3a')]&&_0xc1f2cf['attrs'][0x1]?_0xc1f2cf[_0xc8ef('0x3a')][0x1][_0xc8ef('0x3b')]:undefined)||0x0}];default:return[];}}catch(_0x36f35b){logger[_0xc8ef('0x26')](_0xc8ef('0x54'),JSON[_0xc8ef('0x55')](_0x36f35b));return[];}}exports[_0xc8ef('0x56')]=function(_0x493bc8,_0x403dee){if(_0x493bc8[_0xc8ef('0x57')]){_0x493bc8[_0xc8ef('0x57')][_0xc8ef('0x3a')]=widgetAttributes(_0x493bc8[_0xc8ef('0x57')]);}return db['DashboardItem'][_0xc8ef('0x56')](_0x493bc8[_0xc8ef('0x57')],{})[_0xc8ef('0x24')](respondWithResult(_0x403dee,0xc9))['catch'](handleError(_0x403dee,null));};exports[_0xc8ef('0x23')]=function(_0x5c8bfa,_0x23dc4a){if(_0x5c8bfa[_0xc8ef('0x57')]['id']){delete _0x5c8bfa[_0xc8ef('0x57')]['id'];}_0x5c8bfa[_0xc8ef('0x57')][_0xc8ef('0x3a')]=widgetAttributes(_0x5c8bfa['body']);return db[_0xc8ef('0x33')][_0xc8ef('0x34')]({'where':{'id':_0x5c8bfa[_0xc8ef('0x36')]['id']}})['then'](handleEntityNotFound(_0x23dc4a,null))[_0xc8ef('0x24')](saveUpdates(_0x5c8bfa[_0xc8ef('0x57')],null))['then'](respondWithResult(_0x23dc4a,null))[_0xc8ef('0x35')](handleError(_0x23dc4a,null));}; \ No newline at end of file +var _0x04f9=['register','sendStatus','offset','count','limit','status','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','show','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','destroy','DashboardItem','params','catch','type','iframe','attrUrl','value','https://','custom','attrPath','attrs','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket'];(function(_0x1becf4,_0x54d2f0){var _0x4fedf2=function(_0x554cec){while(--_0x554cec){_0x1becf4['push'](_0x1becf4['shift']());}};_0x4fedf2(++_0x54d2f0);}(_0x04f9,0xb3));var _0x904f=function(_0x5be249,_0x341d5b){_0x5be249=_0x5be249-0x0;var _0x114e05=_0x04f9[_0x5be249];return _0x114e05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x904f('0x0'));var zipdir=require(_0x904f('0x1'));var jsonpatch=require(_0x904f('0x2'));var rp=require('request-promise');var moment=require(_0x904f('0x3'));var BPromise=require(_0x904f('0x4'));var Mustache=require(_0x904f('0x5'));var util=require(_0x904f('0x6'));var path=require(_0x904f('0x7'));var sox=require(_0x904f('0x8'));var csv=require('to-csv');var ejs=require(_0x904f('0x9'));var fs=require('fs');var fs_extra=require(_0x904f('0xa'));var _=require(_0x904f('0xb'));var squel=require(_0x904f('0xc'));var crypto=require(_0x904f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x904f('0xe'));var toCsv=require(_0x904f('0xf'));var querystring=require(_0x904f('0x10'));var Papa=require('papaparse');var Redis=require(_0x904f('0x11'));var authService=require(_0x904f('0x12'));var qs=require(_0x904f('0x13'));var as=require(_0x904f('0x14'));var hardwareService=require(_0x904f('0x15'));var logger=require(_0x904f('0x16'))(_0x904f('0x17'));var utils=require(_0x904f('0x18'));var config=require(_0x904f('0x19'));var licenseUtil=require(_0x904f('0x1a'));var db=require(_0x904f('0x1b'))['db'];config[_0x904f('0x1c')]=_[_0x904f('0x1d')](config[_0x904f('0x1c')],{'host':_0x904f('0x1e'),'port':0x18eb});var socket=require(_0x904f('0x1f'))(new Redis(config[_0x904f('0x1c')]));require(_0x904f('0x20'))[_0x904f('0x21')](socket);function respondWithStatusCode(_0x37c745,_0x19114b){_0x19114b=_0x19114b||0xcc;return function(_0xc49e39){if(_0xc49e39){return _0x37c745[_0x904f('0x22')](_0x19114b);}return _0x37c745['status'](_0x19114b)['end']();};}function respondWithResult(_0xf5268d,_0x40f1b0){_0x40f1b0=_0x40f1b0||0xc8;return function(_0x5c8306){if(_0x5c8306){return _0xf5268d['status'](_0x40f1b0)['json'](_0x5c8306);}};}function respondWithFilteredResult(_0x3f5312,_0x34770b){return function(_0x4eb784){if(_0x4eb784){var _0x43cf3e=typeof _0x34770b['offset']==='undefined'&&typeof _0x34770b['limit']==='undefined';var _0x50457c=_0x4eb784['count'];var _0x884767=_0x43cf3e?0x0:_0x34770b[_0x904f('0x23')];var _0x4ab9b3=_0x43cf3e?_0x4eb784[_0x904f('0x24')]:_0x34770b[_0x904f('0x23')]+_0x34770b[_0x904f('0x25')];var _0x551093;if(_0x4ab9b3>=_0x50457c){_0x4ab9b3=_0x50457c;_0x551093=0xc8;}else{_0x551093=0xce;}_0x3f5312[_0x904f('0x26')](_0x551093);return _0x3f5312[_0x904f('0x27')](_0x904f('0x28'),_0x884767+'-'+_0x4ab9b3+'/'+_0x50457c)[_0x904f('0x29')](_0x4eb784);}return null;};}function patchUpdates(_0x1f394d){return function(_0x286a78){try{jsonpatch[_0x904f('0x2a')](_0x286a78,_0x1f394d,!![]);}catch(_0x1b0937){return BPromise[_0x904f('0x2b')](_0x1b0937);}return _0x286a78[_0x904f('0x2c')]();};}function saveUpdates(_0x5826dd,_0x39205c){return function(_0x3acfd9){if(_0x3acfd9){return _0x3acfd9[_0x904f('0x2d')](_0x5826dd)[_0x904f('0x2e')](function(_0x57dbcc){return _0x57dbcc;});}return null;};}function removeEntity(_0x5930df,_0x1512b5){return function(_0x37184c){if(_0x37184c){return _0x37184c['destroy']()[_0x904f('0x2e')](function(){_0x5930df[_0x904f('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b0d35,_0x202c64){return function(_0x3fcb62){if(!_0x3fcb62){_0x1b0d35[_0x904f('0x22')](0x194);}return _0x3fcb62;};}function handleError(_0x347871,_0x2de57d){_0x2de57d=_0x2de57d||0x1f4;return function(_0x2bc4f9){logger[_0x904f('0x2f')](_0x2bc4f9[_0x904f('0x30')]);if(_0x2bc4f9[_0x904f('0x31')]){delete _0x2bc4f9['name'];}_0x347871[_0x904f('0x26')](_0x2de57d)['send'](_0x2bc4f9);};}exports[_0x904f('0x32')]=function(_0x356e70,_0x5a9eb0){var _0x56ac39={'raw':![],'where':{'id':_0x356e70['params']['id']}},_0x39fd1d={};_0x39fd1d[_0x904f('0x33')]=_[_0x904f('0x34')](db['DashboardItem'][_0x904f('0x35')]);_0x39fd1d['query']=_[_0x904f('0x34')](_0x356e70[_0x904f('0x36')]);_0x39fd1d[_0x904f('0x37')]=_[_0x904f('0x38')](_0x39fd1d[_0x904f('0x33')],_0x39fd1d[_0x904f('0x36')]);_0x56ac39['attributes']=_['intersection'](_0x39fd1d[_0x904f('0x33')],qs[_0x904f('0x39')](_0x356e70['query'][_0x904f('0x39')]));_0x56ac39[_0x904f('0x3a')]=_0x56ac39[_0x904f('0x3a')][_0x904f('0x3b')]?_0x56ac39[_0x904f('0x3a')]:_0x39fd1d[_0x904f('0x33')];if(_0x356e70['query'][_0x904f('0x3c')]){_0x56ac39[_0x904f('0x3d')]=[{'all':!![]}];}_0x56ac39=_[_0x904f('0x3e')]({},_0x56ac39,_0x356e70[_0x904f('0x3f')]);return db['DashboardItem'][_0x904f('0x40')](_0x56ac39)[_0x904f('0x2e')](handleEntityNotFound(_0x5a9eb0,null))[_0x904f('0x2e')](respondWithResult(_0x5a9eb0,null))['catch'](handleError(_0x5a9eb0,null));};exports[_0x904f('0x41')]=function(_0x26f28c,_0xeb03c9){return db[_0x904f('0x42')][_0x904f('0x40')]({'where':{'id':_0x26f28c[_0x904f('0x43')]['id']}})[_0x904f('0x2e')](handleEntityNotFound(_0xeb03c9,null))[_0x904f('0x2e')](removeEntity(_0xeb03c9,null))[_0x904f('0x44')](handleError(_0xeb03c9,null));};function widgetAttributes(_0x5c9a07){try{switch(_0x5c9a07[_0x904f('0x45')]){case _0x904f('0x46'):return[{'name':_0x904f('0x47'),'value':_0x5c9a07[_0x904f('0x47')]||(_0x5c9a07['attrs']&&_0x5c9a07['attrs'][0x0]?_0x5c9a07['attrs'][0x0][_0x904f('0x48')]:undefined)||_0x904f('0x49')}];case _0x904f('0x4a'):return[{'name':_0x904f('0x4b'),'value':_0x5c9a07[_0x904f('0x4b')]||(_0x5c9a07[_0x904f('0x4c')]&&_0x5c9a07['attrs'][0x0]?_0x5c9a07[_0x904f('0x4c')][0x0][_0x904f('0x48')]:undefined)||''}];case _0x904f('0x4d'):return[{'name':_0x904f('0x4e'),'value':_0x5c9a07[_0x904f('0x4e')]||(_0x5c9a07['attrs']&&_0x5c9a07['attrs'][0x0]?_0x5c9a07[_0x904f('0x4c')][0x0]['value']:undefined)||_0x904f('0x4f')},{'name':_0x904f('0x50'),'value':_0x5c9a07[_0x904f('0x50')]||(_0x5c9a07[_0x904f('0x4c')]&&_0x5c9a07[_0x904f('0x4c')][0x1]?_0x5c9a07[_0x904f('0x4c')][0x1][_0x904f('0x48')]:undefined)||_0x904f('0x51')},{'name':_0x904f('0x52'),'value':_0x5c9a07[_0x904f('0x52')]||(_0x5c9a07[_0x904f('0x4c')]&&_0x5c9a07[_0x904f('0x4c')][0x2]?_0x5c9a07[_0x904f('0x4c')][0x2]['value']:undefined)||0xc}];case _0x904f('0x53'):return[{'name':_0x904f('0x54'),'value':_0x5c9a07[_0x904f('0x54')]||(_0x5c9a07['attrs']&&_0x5c9a07[_0x904f('0x4c')][0x0]?_0x5c9a07[_0x904f('0x4c')][0x0][_0x904f('0x48')]:undefined)||_0x904f('0x55')},{'name':'attrVoiceQueues','value':_0x5c9a07[_0x904f('0x56')]||(_0x5c9a07[_0x904f('0x4c')]&&_0x5c9a07['attrs'][0x1]?_0x5c9a07[_0x904f('0x4c')][0x1][_0x904f('0x48')]:undefined)||[]},{'name':'attrFontSize','value':_0x5c9a07[_0x904f('0x52')]||(_0x5c9a07[_0x904f('0x4c')]&&_0x5c9a07[_0x904f('0x4c')][0x2]?_0x5c9a07[_0x904f('0x4c')][0x2][_0x904f('0x48')]:undefined)||0x14},{'name':'attrChannel','value':_0x5c9a07['attrChannel']||(_0x5c9a07[_0x904f('0x4c')]&&_0x5c9a07['attrs'][0x3]?_0x5c9a07[_0x904f('0x4c')][0x3][_0x904f('0x48')]:undefined)||_0x904f('0x57')},{'name':_0x904f('0x58'),'value':_0x5c9a07['attrEmailAccounts']||(_0x5c9a07['attrs']&&_0x5c9a07[_0x904f('0x4c')][0x4]?_0x5c9a07[_0x904f('0x4c')][0x4][_0x904f('0x48')]:undefined)||''},{'name':_0x904f('0x59'),'value':_0x5c9a07[_0x904f('0x59')]||(_0x5c9a07[_0x904f('0x4c')]&&_0x5c9a07['attrs'][0x5]?_0x5c9a07[_0x904f('0x4c')][0x5]['value']:undefined)||''},{'name':_0x904f('0x5a'),'value':_0x5c9a07[_0x904f('0x5a')]||(_0x5c9a07[_0x904f('0x4c')]&&_0x5c9a07[_0x904f('0x4c')][0x6]?_0x5c9a07[_0x904f('0x4c')][0x6][_0x904f('0x48')]:undefined)||''},{'name':_0x904f('0x5b'),'value':_0x5c9a07[_0x904f('0x5b')]||(_0x5c9a07[_0x904f('0x4c')]&&_0x5c9a07[_0x904f('0x4c')][0x7]?_0x5c9a07[_0x904f('0x4c')][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5c9a07[_0x904f('0x5c')]||(_0x5c9a07[_0x904f('0x4c')]&&_0x5c9a07[_0x904f('0x4c')][0x8]?_0x5c9a07[_0x904f('0x4c')][0x8]['value']:undefined)||''},{'name':_0x904f('0x5d'),'value':_0x5c9a07[_0x904f('0x5d')]||(_0x5c9a07['attrs']&&_0x5c9a07[_0x904f('0x4c')][0x9]?_0x5c9a07[_0x904f('0x4c')][0x9][_0x904f('0x48')]:undefined)||''}];case _0x904f('0x5e'):case _0x904f('0x5f'):return[{'name':_0x904f('0x60'),'value':_0x5c9a07[_0x904f('0x60')]||(_0x5c9a07[_0x904f('0x4c')]&&_0x5c9a07[_0x904f('0x4c')][0x0]?_0x5c9a07[_0x904f('0x4c')][0x0][_0x904f('0x48')]:undefined)||_0x904f('0x55')},{'name':_0x904f('0x61'),'value':_0x5c9a07['attrSerie2']||(_0x5c9a07[_0x904f('0x4c')]&&_0x5c9a07['attrs'][0x1]?_0x5c9a07[_0x904f('0x4c')][0x1][_0x904f('0x48')]:undefined)||null},{'name':_0x904f('0x62'),'value':_0x5c9a07['attrSerie3']||(_0x5c9a07[_0x904f('0x4c')]&&_0x5c9a07[_0x904f('0x4c')][0x2]?_0x5c9a07[_0x904f('0x4c')][0x2][_0x904f('0x48')]:undefined)||null},{'name':_0x904f('0x56'),'value':_0x5c9a07['attrVoiceQueues']||(_0x5c9a07[_0x904f('0x4c')]&&_0x5c9a07[_0x904f('0x4c')][0x3]?_0x5c9a07[_0x904f('0x4c')][0x3][_0x904f('0x48')]:undefined)||[]},{'name':_0x904f('0x63'),'value':_0x5c9a07[_0x904f('0x63')]||(_0x5c9a07[_0x904f('0x4c')]&&_0x5c9a07[_0x904f('0x4c')][0x4]?_0x5c9a07[_0x904f('0x4c')][0x4][_0x904f('0x48')]:undefined)||_0x904f('0x57')},{'name':'attrEmailAccounts','value':_0x5c9a07[_0x904f('0x58')]||(_0x5c9a07['attrs']&&_0x5c9a07[_0x904f('0x4c')][0x5]?_0x5c9a07[_0x904f('0x4c')][0x5][_0x904f('0x48')]:undefined)||''},{'name':_0x904f('0x59'),'value':_0x5c9a07[_0x904f('0x59')]||(_0x5c9a07['attrs']&&_0x5c9a07[_0x904f('0x4c')][0x6]?_0x5c9a07[_0x904f('0x4c')][0x6][_0x904f('0x48')]:undefined)||''},{'name':_0x904f('0x5a'),'value':_0x5c9a07['attrSmsAccounts']||(_0x5c9a07[_0x904f('0x4c')]&&_0x5c9a07[_0x904f('0x4c')][0x7]?_0x5c9a07['attrs'][0x7][_0x904f('0x48')]:undefined)||''},{'name':_0x904f('0x5b'),'value':_0x5c9a07[_0x904f('0x5b')]||(_0x5c9a07[_0x904f('0x4c')]&&_0x5c9a07[_0x904f('0x4c')][0x8]?_0x5c9a07[_0x904f('0x4c')][0x8][_0x904f('0x48')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5c9a07[_0x904f('0x5c')]||(_0x5c9a07[_0x904f('0x4c')]&&_0x5c9a07['attrs'][0x9]?_0x5c9a07['attrs'][0x9][_0x904f('0x48')]:undefined)||''},{'name':_0x904f('0x5d'),'value':_0x5c9a07[_0x904f('0x5d')]||(_0x5c9a07[_0x904f('0x4c')]&&_0x5c9a07[_0x904f('0x4c')][0xa]?_0x5c9a07['attrs'][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x904f('0x64'),'type':_0x5c9a07[_0x904f('0x65')]||(_0x5c9a07[_0x904f('0x4c')]&&_0x5c9a07['attrs'][0x0]?_0x5c9a07[_0x904f('0x4c')][0x0]['type']:undefined)||null,'value':_0x5c9a07[_0x904f('0x64')]||(_0x5c9a07[_0x904f('0x4c')]&&_0x5c9a07['attrs'][0x0]?_0x5c9a07[_0x904f('0x4c')][0x0][_0x904f('0x48')]:undefined)||null},{'name':_0x904f('0x66'),'value':_0x5c9a07[_0x904f('0x66')]||(_0x5c9a07[_0x904f('0x4c')]&&_0x5c9a07['attrs'][0x1]?_0x5c9a07[_0x904f('0x4c')][0x1][_0x904f('0x48')]:undefined)||0x0}];default:return[];}}catch(_0x2d4d06){logger[_0x904f('0x2f')](_0x904f('0x67'),JSON['stringify'](_0x2d4d06));return[];}}exports[_0x904f('0x68')]=function(_0x3b48c6,_0x5f1832){if(_0x3b48c6[_0x904f('0x69')]){_0x3b48c6['body']['attrs']=widgetAttributes(_0x3b48c6[_0x904f('0x69')]);}return db[_0x904f('0x42')][_0x904f('0x68')](_0x3b48c6[_0x904f('0x69')],{})[_0x904f('0x2e')](respondWithResult(_0x5f1832,0xc9))[_0x904f('0x44')](handleError(_0x5f1832,null));};exports[_0x904f('0x2d')]=function(_0x174109,_0x440843){if(_0x174109[_0x904f('0x69')]['id']){delete _0x174109[_0x904f('0x69')]['id'];}_0x174109['body']['attrs']=widgetAttributes(_0x174109[_0x904f('0x69')]);return db['DashboardItem'][_0x904f('0x40')]({'where':{'id':_0x174109[_0x904f('0x43')]['id']}})[_0x904f('0x2e')](handleEntityNotFound(_0x440843,null))[_0x904f('0x2e')](saveUpdates(_0x174109[_0x904f('0x69')],null))['then'](respondWithResult(_0x440843,null))[_0x904f('0x44')](handleError(_0x440843,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 370b516..a7ff0d2 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 _0xabd7=['emit','hook','events','../../mysqldb','DashboardItem','setMaxListeners','update'];(function(_0x57e05f,_0x318b8d){var _0x435e54=function(_0x5de9eb){while(--_0x5de9eb){_0x57e05f['push'](_0x57e05f['shift']());}};_0x435e54(++_0x318b8d);}(_0xabd7,0x121));var _0x7abd=function(_0x3120d9,_0x75ca11){_0x3120d9=_0x3120d9-0x0;var _0x4aea62=_0xabd7[_0x3120d9];return _0x4aea62;};'use strict';var EventEmitter=require(_0x7abd('0x0'));var DashboardItem=require(_0x7abd('0x1'))['db'][_0x7abd('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x7abd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7abd('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5d5649){return function(_0x512c3b,_0x2eb373,_0x5174f1){DashboardItemEvents['emit'](_0x5d5649+':'+_0x512c3b['id'],_0x512c3b);DashboardItemEvents[_0x7abd('0x5')](_0x5d5649,_0x512c3b);_0x5174f1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x7abd('0x6')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x0a4b=['hook','setMaxListeners','save','update','remove'];(function(_0x92a987,_0x4415b6){var _0x331f4c=function(_0x223e9d){while(--_0x223e9d){_0x92a987['push'](_0x92a987['shift']());}};_0x331f4c(++_0x4415b6);}(_0x0a4b,0x14b));var _0xb0a4=function(_0x1e08f8,_0x40723d){_0x1e08f8=_0x1e08f8-0x0;var _0x9c34d=_0x0a4b[_0x1e08f8];return _0x9c34d;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xb0a4('0x0')](0x0);var events={'afterCreate':_0xb0a4('0x1'),'afterUpdate':_0xb0a4('0x2'),'afterDestroy':_0xb0a4('0x3')};function emitEvent(_0x408a76){return function(_0x2572a6,_0x3eb119,_0x3fa5f2){DashboardItemEvents['emit'](_0x408a76+':'+_0x2572a6['id'],_0x2572a6);DashboardItemEvents['emit'](_0x408a76,_0x2572a6);_0x3fa5f2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xb0a4('0x4')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 02a8c2a..959b553 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 _0x3b0d=['path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','util','../../config/logger','api','bluebird'];(function(_0x5cc72c,_0x347000){var _0x2c8346=function(_0x57a0c4){while(--_0x57a0c4){_0x5cc72c['push'](_0x5cc72c['shift']());}};_0x2c8346(++_0x347000);}(_0x3b0d,0x132));var _0xd3b0=function(_0x1d0184,_0x3fa782){_0x1d0184=_0x1d0184-0x0;var _0x364129=_0x3b0d[_0x1d0184];return _0x364129;};'use strict';var _=require('lodash');var util=require(_0xd3b0('0x0'));var logger=require(_0xd3b0('0x1'))(_0xd3b0('0x2'));var moment=require('moment');var BPromise=require(_0xd3b0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd3b0('0x4'));var rimraf=require(_0xd3b0('0x5'));var config=require(_0xd3b0('0x6'));var attributes=require(_0xd3b0('0x7'));module[_0xd3b0('0x8')]=function(_0x13ccd5,_0x2f39d6){return _0x13ccd5[_0xd3b0('0x9')]('DashboardItem',attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf555=['bluebird','request-promise','path','../../config/environment','./dashboardItem.attributes','define','DashboardItem','dashboard_items','lodash','util','api'];(function(_0x50e351,_0x35608c){var _0x418d06=function(_0x26145a){while(--_0x26145a){_0x50e351['push'](_0x50e351['shift']());}};_0x418d06(++_0x35608c);}(_0xf555,0x97));var _0x5f55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf555[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5f55('0x0'));var util=require(_0x5f55('0x1'));var logger=require('../../config/logger')(_0x5f55('0x2'));var moment=require('moment');var BPromise=require(_0x5f55('0x3'));var rp=require(_0x5f55('0x4'));var fs=require('fs');var path=require(_0x5f55('0x5'));var rimraf=require('rimraf');var config=require(_0x5f55('0x6'));var attributes=require(_0x5f55('0x7'));module['exports']=function(_0x2c6a58,_0x113537){return _0x2c6a58[_0x5f55('0x8')](_0x5f55('0x9'),attributes,{'tableName':_0x5f55('0xa'),'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 d8c84b0..3de8233 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 _0xe141=['../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','then','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DashboardItem,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5cd287,_0x17071c){var _0x25e20f=function(_0x2a4ecd){while(--_0x2a4ecd){_0x5cd287['push'](_0x5cd287['shift']());}};_0x25e20f(++_0x17071c);}(_0xe141,0x142));var _0x1e14=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xe141[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x1e14('0x0'));var util=require(_0x1e14('0x1'));var moment=require(_0x1e14('0x2'));var BPromise=require(_0x1e14('0x3'));var rs=require(_0x1e14('0x4'));var fs=require('fs');var Redis=require(_0x1e14('0x5'));var db=require(_0x1e14('0x6'))['db'];var utils=require(_0x1e14('0x7'));var logger=require(_0x1e14('0x8'))(_0x1e14('0x9'));var config=require(_0x1e14('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x1e14('0xb')][_0x1e14('0xc')]({'port':0x232a});config[_0x1e14('0xd')]=_[_0x1e14('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1e14('0xf'))(new Redis(config[_0x1e14('0xd')]));require(_0x1e14('0x10'))[_0x1e14('0x11')](socket);function respondWithRpcPromise(_0x3030b4,_0xdf794e,_0x56d21e){return new BPromise(function(_0x3c8162,_0xec41c6){return client['request'](_0x3030b4,_0x56d21e)[_0x1e14('0x12')](function(_0x22619a){logger['info']('DashboardItem,\x20%s,\x20%s',_0xdf794e,_0x1e14('0x13'));logger[_0x1e14('0x14')](_0x1e14('0x15'),_0xdf794e,_0x1e14('0x13'),JSON[_0x1e14('0x16')](_0x22619a));if(_0x22619a['error']){if(_0x22619a[_0x1e14('0x17')][_0x1e14('0x18')]===0x1f4){logger[_0x1e14('0x17')]('DashboardItem,\x20%s,\x20%s',_0xdf794e,_0x22619a[_0x1e14('0x17')][_0x1e14('0x19')]);return _0xec41c6(_0x22619a['error'][_0x1e14('0x19')]);}logger[_0x1e14('0x17')](_0x1e14('0x1a'),_0xdf794e,_0x22619a['error'][_0x1e14('0x19')]);return _0x3c8162(_0x22619a[_0x1e14('0x17')][_0x1e14('0x19')]);}else{logger[_0x1e14('0x1b')]('DashboardItem,\x20%s,\x20%s',_0xdf794e,_0x1e14('0x13'));_0x3c8162(_0x22619a[_0x1e14('0x1c')][_0x1e14('0x19')]);}})[_0x1e14('0x1d')](function(_0x47e5f7){logger[_0x1e14('0x17')](_0x1e14('0x1a'),_0xdf794e,_0x47e5f7);_0xec41c6(_0x47e5f7);});});} \ No newline at end of file +var _0xa066=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','./dashboardItem.socket','register','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x1b92a6,_0x14444b){var _0x24be5b=function(_0x3a5fb5){while(--_0x3a5fb5){_0x1b92a6['push'](_0x1b92a6['shift']());}};_0x24be5b(++_0x14444b);}(_0xa066,0x1ea));var _0x6a06=function(_0x11500e,_0x457be0){_0x11500e=_0x11500e-0x0;var _0x135e1a=_0xa066[_0x11500e];return _0x135e1a;};'use strict';var _=require(_0x6a06('0x0'));var util=require(_0x6a06('0x1'));var moment=require(_0x6a06('0x2'));var BPromise=require(_0x6a06('0x3'));var rs=require(_0x6a06('0x4'));var fs=require('fs');var Redis=require(_0x6a06('0x5'));var db=require(_0x6a06('0x6'))['db'];var utils=require(_0x6a06('0x7'));var logger=require(_0x6a06('0x8'))(_0x6a06('0x9'));var config=require(_0x6a06('0xa'));var jayson=require(_0x6a06('0xb'));var client=jayson[_0x6a06('0xc')]['http']({'port':0x232a});config[_0x6a06('0xd')]=_[_0x6a06('0xe')](config[_0x6a06('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6a06('0xd')]));require(_0x6a06('0xf'))[_0x6a06('0x10')](socket);function respondWithRpcPromise(_0x8b89f,_0x1fc46b,_0x85dbb0){return new BPromise(function(_0x546aef,_0x873c9e){return client['request'](_0x8b89f,_0x85dbb0)['then'](function(_0x2e841b){logger[_0x6a06('0x11')](_0x6a06('0x12'),_0x1fc46b,_0x6a06('0x13'));logger[_0x6a06('0x14')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x1fc46b,_0x6a06('0x13'),JSON[_0x6a06('0x15')](_0x2e841b));if(_0x2e841b[_0x6a06('0x16')]){if(_0x2e841b['error'][_0x6a06('0x17')]===0x1f4){logger[_0x6a06('0x16')]('DashboardItem,\x20%s,\x20%s',_0x1fc46b,_0x2e841b[_0x6a06('0x16')][_0x6a06('0x18')]);return _0x873c9e(_0x2e841b[_0x6a06('0x16')]['message']);}logger[_0x6a06('0x16')](_0x6a06('0x12'),_0x1fc46b,_0x2e841b[_0x6a06('0x16')][_0x6a06('0x18')]);return _0x546aef(_0x2e841b[_0x6a06('0x16')]['message']);}else{logger[_0x6a06('0x11')](_0x6a06('0x12'),_0x1fc46b,_0x6a06('0x13'));_0x546aef(_0x2e841b[_0x6a06('0x19')][_0x6a06('0x18')]);}})[_0x6a06('0x1a')](function(_0xa1cda0){logger[_0x6a06('0x16')](_0x6a06('0x12'),_0x1fc46b,_0xa1cda0);_0x873c9e(_0xa1cda0);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index bf3051a..62f9f31 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 _0x920f=['length','dashboardItem:','./dashboardItem.events','update','emit','removeListener'];(function(_0x52829f,_0x1ae085){var _0x566b05=function(_0x4025ec){while(--_0x4025ec){_0x52829f['push'](_0x52829f['shift']());}};_0x566b05(++_0x1ae085);}(_0x920f,0x1ac));var _0xf920=function(_0xc069,_0x3005d6){_0xc069=_0xc069-0x0;var _0x3f143c=_0x920f[_0xc069];return _0x3f143c;};'use strict';var DashboardItemEvents=require(_0xf920('0x0'));var events=['save','remove',_0xf920('0x1')];function createListener(_0x443c01,_0x44ea3c){return function(_0x5d88fa){_0x44ea3c[_0xf920('0x2')](_0x443c01,_0x5d88fa);};}function removeListener(_0xad82dc,_0x2beeb0){return function(){DashboardItemEvents[_0xf920('0x3')](_0xad82dc,_0x2beeb0);};}exports['register']=function(_0x4ee201){for(var _0x232f87=0x0,_0x44c81b=events[_0xf920('0x4')];_0x232f87<_0x44c81b;_0x232f87++){var _0x56ea1c=events[_0x232f87];var _0x4177a7=createListener(_0xf920('0x5')+_0x56ea1c,_0x4ee201);DashboardItemEvents['on'](_0x56ea1c,_0x4177a7);}}; \ No newline at end of file +var _0x48eb=['save','remove','update','removeListener','register','length','dashboardItem:','./dashboardItem.events'];(function(_0x58e094,_0x2ad128){var _0x1f419e=function(_0x5277ca){while(--_0x5277ca){_0x58e094['push'](_0x58e094['shift']());}};_0x1f419e(++_0x2ad128);}(_0x48eb,0xd7));var _0xb48e=function(_0x383bd7,_0x45829a){_0x383bd7=_0x383bd7-0x0;var _0x3f83eb=_0x48eb[_0x383bd7];return _0x3f83eb;};'use strict';var DashboardItemEvents=require(_0xb48e('0x0'));var events=[_0xb48e('0x1'),_0xb48e('0x2'),_0xb48e('0x3')];function createListener(_0xd5e84a,_0x2d4679){return function(_0x16151a){_0x2d4679['emit'](_0xd5e84a,_0x16151a);};}function removeListener(_0x3c8743,_0x46564f){return function(){DashboardItemEvents[_0xb48e('0x4')](_0x3c8743,_0x46564f);};}exports[_0xb48e('0x5')]=function(_0xd7fe5e){for(var _0x5c4fa8=0x0,_0x133833=events[_0xb48e('0x6')];_0x5c4fa8<_0x133833;_0x5c4fa8++){var _0x3079a8=events[_0x5c4fa8];var _0xa4a879=createListener(_0xb48e('0x7')+_0x3079a8,_0xd7fe5e);DashboardItemEvents['on'](_0x3079a8,_0xa4a879);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index d539d3f..27f90bf 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 _0xecba=['create','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','show'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xecba,0x1bf));var _0xaecb=function(_0x4e7d6e,_0x311190){_0x4e7d6e=_0x4e7d6e-0x0;var _0x581dde=_0xecba[_0x4e7d6e];return _0x581dde;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaecb('0x0'));var timeout=require(_0xaecb('0x1'));var express=require(_0xaecb('0x2'));var router=express[_0xaecb('0x3')]();var fs_extra=require(_0xaecb('0x4'));var auth=require(_0xaecb('0x5'));var interaction=require(_0xaecb('0x6'));var config=require('../../config/environment');var controller=require(_0xaecb('0x7'));router[_0xaecb('0x8')](_0xaecb('0x9'),auth[_0xaecb('0xa')](),controller[_0xaecb('0xb')]);router['post']('/',auth[_0xaecb('0xa')](),controller[_0xaecb('0xc')]);router['put'](_0xaecb('0x9'),auth['isAuthenticated'](),controller[_0xaecb('0xd')]);router[_0xaecb('0xe')](_0xaecb('0x9'),auth[_0xaecb('0xa')](),controller[_0xaecb('0xf')]);module[_0xaecb('0x10')]=router; \ No newline at end of file +var _0x75e4=['../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x236f1c,_0x5875b9){var _0x710a8=function(_0x3f9430){while(--_0x3f9430){_0x236f1c['push'](_0x236f1c['shift']());}};_0x710a8(++_0x5875b9);}(_0x75e4,0xd6));var _0x475e=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x75e4[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0x475e('0x0'));var util=require('util');var path=require(_0x475e('0x1'));var timeout=require(_0x475e('0x2'));var express=require(_0x475e('0x3'));var router=express['Router']();var fs_extra=require(_0x475e('0x4'));var auth=require(_0x475e('0x5'));var interaction=require(_0x475e('0x6'));var config=require(_0x475e('0x7'));var controller=require(_0x475e('0x8'));router[_0x475e('0x9')](_0x475e('0xa'),auth[_0x475e('0xb')](),controller[_0x475e('0xc')]);router['post']('/',auth[_0x475e('0xb')](),controller['create']);router[_0x475e('0xd')]('/:id',auth[_0x475e('0xb')](),controller['update']);router[_0x475e('0xe')]('/:id',auth[_0x475e('0xb')](),controller[_0x475e('0xf')]);module[_0x475e('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 806457d..6b27f2a 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 _0x32a3=['third','STRING','sequelize','exports','first','second'];(function(_0x4af01e,_0x543f5c){var _0x178c11=function(_0x2c2f76){while(--_0x2c2f76){_0x4af01e['push'](_0x4af01e['shift']());}};_0x178c11(++_0x543f5c);}(_0x32a3,0xbc));var _0x332a=function(_0x32a452,_0x2f5298){_0x32a452=_0x32a452-0x0;var _0x5c2764=_0x32a3[_0x32a452];return _0x5c2764;};'use strict';var Sequelize=require(_0x332a('0x0'));module[_0x332a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x332a('0x2'),_0x332a('0x3'),_0x332a('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x332a('0x5')]}}; \ No newline at end of file +var _0xcb3d=['exports','STRING','ENUM','first','sequelize'];(function(_0x40d0c2,_0xc72477){var _0x43a0d2=function(_0x4a3c4a){while(--_0x4a3c4a){_0x40d0c2['push'](_0x40d0c2['shift']());}};_0x43a0d2(++_0xc72477);}(_0xcb3d,0x17b));var _0xdcb3=function(_0x363029,_0x1f14f7){_0x363029=_0x363029-0x0;var _0x3d68ca=_0xcb3d[_0x363029];return _0x3d68ca;};'use strict';var Sequelize=require(_0xdcb3('0x0'));module[_0xdcb3('0x1')]={'name':{'type':Sequelize[_0xdcb3('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xdcb3('0x3')](_0xdcb3('0x4'),'second','third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xdcb3('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 281fb1d..05bbaf1 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 _0xc911=['UserProfileSection','find','autoAssociation','UserProfileResource','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Dispositions','error','stack','name','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','create','body','user'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xc911,0x1ea));var _0x1c91=function(_0x3d3729,_0x3394c8){_0x3d3729=_0x3d3729-0x0;var _0xde3557=_0xc911[_0x3d3729];return _0xde3557;};'use strict';var emlformat=require(_0x1c91('0x0'));var rimraf=require(_0x1c91('0x1'));var zipdir=require(_0x1c91('0x2'));var jsonpatch=require(_0x1c91('0x3'));var rp=require(_0x1c91('0x4'));var moment=require(_0x1c91('0x5'));var BPromise=require(_0x1c91('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1c91('0x7'));var sox=require(_0x1c91('0x8'));var csv=require(_0x1c91('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1c91('0xa'));var _=require(_0x1c91('0xb'));var squel=require(_0x1c91('0xc'));var crypto=require('crypto');var jsforce=require(_0x1c91('0xd'));var deskjs=require(_0x1c91('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1c91('0xf'));var Papa=require('papaparse');var Redis=require(_0x1c91('0x10'));var authService=require(_0x1c91('0x11'));var qs=require(_0x1c91('0x12'));var as=require(_0x1c91('0x13'));var hardwareService=require(_0x1c91('0x14'));var logger=require('../../config/logger')(_0x1c91('0x15'));var utils=require(_0x1c91('0x16'));var config=require(_0x1c91('0x17'));var licenseUtil=require(_0x1c91('0x18'));var db=require(_0x1c91('0x19'))['db'];function respondWithStatusCode(_0x15cbfa,_0x2f1930){_0x2f1930=_0x2f1930||0xcc;return function(_0x2216fd){if(_0x2216fd){return _0x15cbfa['sendStatus'](_0x2f1930);}return _0x15cbfa[_0x1c91('0x1a')](_0x2f1930)[_0x1c91('0x1b')]();};}function respondWithResult(_0x9988a3,_0x5e3c50){_0x5e3c50=_0x5e3c50||0xc8;return function(_0x4f3a6c){if(_0x4f3a6c){return _0x9988a3[_0x1c91('0x1a')](_0x5e3c50)[_0x1c91('0x1c')](_0x4f3a6c);}};}function respondWithFilteredResult(_0x103bbc,_0x1bd00b){return function(_0xf56ad9){if(_0xf56ad9){var _0xbcaf38=typeof _0x1bd00b[_0x1c91('0x1d')]===_0x1c91('0x1e')&&typeof _0x1bd00b[_0x1c91('0x1f')]===_0x1c91('0x1e');var _0xeb7dc8=_0xf56ad9[_0x1c91('0x20')];var _0x246f55=_0xbcaf38?0x0:_0x1bd00b[_0x1c91('0x1d')];var _0x3a3045=_0xbcaf38?_0xf56ad9[_0x1c91('0x20')]:_0x1bd00b['offset']+_0x1bd00b['limit'];var _0x1edb19;if(_0x3a3045>=_0xeb7dc8){_0x3a3045=_0xeb7dc8;_0x1edb19=0xc8;}else{_0x1edb19=0xce;}_0x103bbc[_0x1c91('0x1a')](_0x1edb19);return _0x103bbc[_0x1c91('0x21')](_0x1c91('0x22'),_0x246f55+'-'+_0x3a3045+'/'+_0xeb7dc8)[_0x1c91('0x1c')](_0xf56ad9);}return null;};}function patchUpdates(_0x2d80f4){return function(_0x42faba){try{jsonpatch['apply'](_0x42faba,_0x2d80f4,!![]);}catch(_0x54bcfb){return BPromise[_0x1c91('0x23')](_0x54bcfb);}return _0x42faba[_0x1c91('0x24')]();};}function saveUpdates(_0x2f81c0,_0x2109f7){return function(_0x575da0){if(_0x575da0){return _0x575da0[_0x1c91('0x25')](_0x2f81c0)[_0x1c91('0x26')](function(_0x50c52c){return _0x50c52c;});}return null;};}function removeEntity(_0x2353bb,_0xd555cb){return function(_0x511da6){if(_0x511da6){return _0x511da6[_0x1c91('0x27')]()['then'](function(){var _0x1e70c0=_0x511da6[_0x1c91('0x28')]({'plain':!![]});var _0x451f01=_0x1c91('0x29');return db['UserProfileResource'][_0x1c91('0x27')]({'where':{'type':_0x451f01,'resourceId':_0x1e70c0['id']}})[_0x1c91('0x26')](function(){return _0x511da6;});})[_0x1c91('0x26')](function(){_0x2353bb[_0x1c91('0x1a')](0xcc)[_0x1c91('0x1b')]();});}};}function handleEntityNotFound(_0x366b87,_0x5a1c09){return function(_0x39042a){if(!_0x39042a){_0x366b87['sendStatus'](0x194);}return _0x39042a;};}function handleError(_0x35f43b,_0x207228){_0x207228=_0x207228||0x1f4;return function(_0x4ace72){logger[_0x1c91('0x2a')](_0x4ace72[_0x1c91('0x2b')]);if(_0x4ace72[_0x1c91('0x2c')]){delete _0x4ace72[_0x1c91('0x2c')];}_0x35f43b[_0x1c91('0x1a')](_0x207228)['send'](_0x4ace72);};}exports[_0x1c91('0x2d')]=function(_0x2f56bc,_0x58a0a8){var _0x62b038={},_0x17e815={},_0x52172c={'count':0x0,'rows':[]};var _0x2432e7=_[_0x1c91('0x2e')](db[_0x1c91('0x2f')][_0x1c91('0x30')],function(_0x46c4be){return{'name':_0x46c4be[_0x1c91('0x31')],'type':_0x46c4be[_0x1c91('0x32')][_0x1c91('0x33')]};});_0x17e815[_0x1c91('0x34')]=_[_0x1c91('0x2e')](_0x2432e7,_0x1c91('0x2c'));_0x17e815[_0x1c91('0x35')]=_[_0x1c91('0x36')](_0x2f56bc[_0x1c91('0x35')]);_0x17e815[_0x1c91('0x37')]=_[_0x1c91('0x38')](_0x17e815[_0x1c91('0x34')],_0x17e815[_0x1c91('0x35')]);_0x62b038[_0x1c91('0x39')]=_[_0x1c91('0x38')](_0x17e815['model'],qs[_0x1c91('0x3a')](_0x2f56bc[_0x1c91('0x35')][_0x1c91('0x3a')]));_0x62b038['attributes']=_0x62b038[_0x1c91('0x39')][_0x1c91('0x3b')]?_0x62b038[_0x1c91('0x39')]:_0x17e815[_0x1c91('0x34')];if(!_0x2f56bc['query'][_0x1c91('0x3c')]('nolimit')){_0x62b038[_0x1c91('0x1f')]=qs['limit'](_0x2f56bc[_0x1c91('0x35')]['limit']);_0x62b038['offset']=qs['offset'](_0x2f56bc[_0x1c91('0x35')][_0x1c91('0x1d')]);}_0x62b038[_0x1c91('0x3d')]=qs[_0x1c91('0x3e')](_0x2f56bc[_0x1c91('0x35')][_0x1c91('0x3e')]);_0x62b038['where']=qs[_0x1c91('0x37')](_[_0x1c91('0x3f')](_0x2f56bc[_0x1c91('0x35')],_0x17e815[_0x1c91('0x37')]),_0x2432e7);if(_0x2f56bc[_0x1c91('0x35')][_0x1c91('0x40')]){_0x62b038[_0x1c91('0x41')]=_[_0x1c91('0x42')](_0x62b038[_0x1c91('0x41')],{'$or':_[_0x1c91('0x2e')](_0x2432e7,function(_0x4ad65c){if(_0x4ad65c['type']!=='VIRTUAL'){var _0x40df45={};_0x40df45[_0x4ad65c[_0x1c91('0x2c')]]={'$like':'%'+_0x2f56bc[_0x1c91('0x35')][_0x1c91('0x40')]+'%'};return _0x40df45;}})});}_0x62b038=_[_0x1c91('0x42')]({},_0x62b038,_0x2f56bc[_0x1c91('0x43')]);var _0x3622fe={'where':_0x62b038[_0x1c91('0x41')]};return db[_0x1c91('0x2f')][_0x1c91('0x20')](_0x3622fe)[_0x1c91('0x26')](function(_0x59150d){_0x52172c[_0x1c91('0x20')]=_0x59150d;if(_0x2f56bc['query'][_0x1c91('0x44')]){_0x62b038[_0x1c91('0x45')]=[{'all':!![]}];}return db[_0x1c91('0x2f')][_0x1c91('0x46')](_0x62b038);})['then'](function(_0xba7c9e){_0x52172c['rows']=_0xba7c9e;return _0x52172c;})[_0x1c91('0x26')](respondWithFilteredResult(_0x58a0a8,_0x62b038))[_0x1c91('0x47')](handleError(_0x58a0a8,null));};exports[_0x1c91('0x48')]=function(_0x49f225,_0x31b51f){var _0x48e7ea={'raw':!![],'where':{'id':_0x49f225[_0x1c91('0x49')]['id']}},_0x16fedc={};_0x16fedc[_0x1c91('0x34')]=_[_0x1c91('0x36')](db[_0x1c91('0x2f')][_0x1c91('0x30')]);_0x16fedc[_0x1c91('0x35')]=_[_0x1c91('0x36')](_0x49f225[_0x1c91('0x35')]);_0x16fedc[_0x1c91('0x37')]=_[_0x1c91('0x38')](_0x16fedc[_0x1c91('0x34')],_0x16fedc[_0x1c91('0x35')]);_0x48e7ea[_0x1c91('0x39')]=_[_0x1c91('0x38')](_0x16fedc[_0x1c91('0x34')],qs[_0x1c91('0x3a')](_0x49f225[_0x1c91('0x35')][_0x1c91('0x3a')]));_0x48e7ea[_0x1c91('0x39')]=_0x48e7ea['attributes'][_0x1c91('0x3b')]?_0x48e7ea[_0x1c91('0x39')]:_0x16fedc[_0x1c91('0x34')];if(_0x49f225[_0x1c91('0x35')]['includeAll']){_0x48e7ea[_0x1c91('0x45')]=[{'all':!![]}];}_0x48e7ea=_[_0x1c91('0x42')]({},_0x48e7ea,_0x49f225[_0x1c91('0x43')]);return db[_0x1c91('0x2f')]['find'](_0x48e7ea)[_0x1c91('0x26')](handleEntityNotFound(_0x31b51f,null))[_0x1c91('0x26')](respondWithResult(_0x31b51f,null))[_0x1c91('0x47')](handleError(_0x31b51f,null));};exports[_0x1c91('0x4a')]=function(_0x5a69bd,_0xc6cda3){return db[_0x1c91('0x2f')]['create'](_0x5a69bd[_0x1c91('0x4b')],{})[_0x1c91('0x26')](function(_0x49f19d){var _0x35b049=_0x5a69bd[_0x1c91('0x4c')][_0x1c91('0x28')]({'plain':!![]});if(!_0x35b049)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35b049['role']===_0x1c91('0x4c')){var _0x5b81cd=_0x49f19d[_0x1c91('0x28')]({'plain':!![]});var _0x5748ea=_0x1c91('0x29');return db[_0x1c91('0x4d')][_0x1c91('0x4e')]({'where':{'name':_0x5748ea,'userProfileId':_0x35b049['userProfileId']},'raw':!![]})[_0x1c91('0x26')](function(_0xe9f553){if(_0xe9f553&&_0xe9f553[_0x1c91('0x4f')]===0x0){return db[_0x1c91('0x50')]['create']({'name':_0x5b81cd['name'],'resourceId':_0x5b81cd['id'],'type':_0xe9f553[_0x1c91('0x2c')],'sectionId':_0xe9f553['id']},{})[_0x1c91('0x26')](function(){return _0x49f19d;});}else{return _0x49f19d;}})[_0x1c91('0x47')](function(_0x2f7c45){logger[_0x1c91('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f7c45);throw _0x2f7c45;});}return _0x49f19d;})[_0x1c91('0x26')](respondWithResult(_0xc6cda3,0xc9))[_0x1c91('0x47')](handleError(_0xc6cda3,null));};exports[_0x1c91('0x25')]=function(_0x1a3a49,_0x23ae03){if(_0x1a3a49['body']['id']){delete _0x1a3a49['body']['id'];}return db[_0x1c91('0x2f')][_0x1c91('0x4e')]({'where':{'id':_0x1a3a49[_0x1c91('0x49')]['id']}})['then'](handleEntityNotFound(_0x23ae03,null))[_0x1c91('0x26')](saveUpdates(_0x1a3a49[_0x1c91('0x4b')],null))[_0x1c91('0x26')](respondWithResult(_0x23ae03,null))[_0x1c91('0x47')](handleError(_0x23ae03,null));};exports[_0x1c91('0x27')]=function(_0x1fd97b,_0x2e7fbf){return db[_0x1c91('0x2f')][_0x1c91('0x4e')]({'where':{'id':_0x1fd97b[_0x1c91('0x49')]['id']}})[_0x1c91('0x26')](handleEntityNotFound(_0x2e7fbf,null))[_0x1c91('0x26')](removeEntity(_0x2e7fbf,null))[_0x1c91('0x47')](handleError(_0x2e7fbf,null));}; \ No newline at end of file +var _0x19d1=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','name','index','Disposition','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','count','findAll','catch','show','rawAttributes','includeAll','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','request-promise','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x2adfb1,_0x406e6e){var _0xa52d45=function(_0x2de16c){while(--_0x2de16c){_0x2adfb1['push'](_0x2adfb1['shift']());}};_0xa52d45(++_0x406e6e);}(_0x19d1,0xd6));var _0x119d=function(_0x11b2c2,_0xd4c52e){_0x11b2c2=_0x11b2c2-0x0;var _0x31641c=_0x19d1[_0x11b2c2];return _0x31641c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x119d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x119d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x119d('0x2'));var util=require(_0x119d('0x3'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x119d('0x4'));var fs=require('fs');var fs_extra=require(_0x119d('0x5'));var _=require(_0x119d('0x6'));var squel=require(_0x119d('0x7'));var crypto=require(_0x119d('0x8'));var jsforce=require(_0x119d('0x9'));var deskjs=require(_0x119d('0xa'));var toCsv=require('to-csv');var querystring=require(_0x119d('0xb'));var Papa=require(_0x119d('0xc'));var Redis=require(_0x119d('0xd'));var authService=require(_0x119d('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x119d('0xf'));var logger=require(_0x119d('0x10'))(_0x119d('0x11'));var utils=require(_0x119d('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x119d('0x13'));var db=require(_0x119d('0x14'))['db'];function respondWithStatusCode(_0x44e281,_0x5e1e6c){_0x5e1e6c=_0x5e1e6c||0xcc;return function(_0x4efaf6){if(_0x4efaf6){return _0x44e281[_0x119d('0x15')](_0x5e1e6c);}return _0x44e281[_0x119d('0x16')](_0x5e1e6c)[_0x119d('0x17')]();};}function respondWithResult(_0x1b8683,_0x29e9fa){_0x29e9fa=_0x29e9fa||0xc8;return function(_0x3d00c3){if(_0x3d00c3){return _0x1b8683['status'](_0x29e9fa)[_0x119d('0x18')](_0x3d00c3);}};}function respondWithFilteredResult(_0x5022c2,_0x55257d){return function(_0x3e1b07){if(_0x3e1b07){var _0x317573=typeof _0x55257d[_0x119d('0x19')]===_0x119d('0x1a')&&typeof _0x55257d[_0x119d('0x1b')]===_0x119d('0x1a');var _0x15791b=_0x3e1b07['count'];var _0x465cb2=_0x317573?0x0:_0x55257d['offset'];var _0x1dc80b=_0x317573?_0x3e1b07['count']:_0x55257d[_0x119d('0x19')]+_0x55257d[_0x119d('0x1b')];var _0x41e5e6;if(_0x1dc80b>=_0x15791b){_0x1dc80b=_0x15791b;_0x41e5e6=0xc8;}else{_0x41e5e6=0xce;}_0x5022c2[_0x119d('0x16')](_0x41e5e6);return _0x5022c2[_0x119d('0x1c')]('Content-Range',_0x465cb2+'-'+_0x1dc80b+'/'+_0x15791b)['json'](_0x3e1b07);}return null;};}function patchUpdates(_0x30346d){return function(_0x3423be){try{jsonpatch[_0x119d('0x1d')](_0x3423be,_0x30346d,!![]);}catch(_0x5020bf){return BPromise[_0x119d('0x1e')](_0x5020bf);}return _0x3423be[_0x119d('0x1f')]();};}function saveUpdates(_0xfd56f6,_0x58245b){return function(_0x532283){if(_0x532283){return _0x532283[_0x119d('0x20')](_0xfd56f6)[_0x119d('0x21')](function(_0x53919f){return _0x53919f;});}return null;};}function removeEntity(_0x3d8df0,_0x5e07aa){return function(_0x281d48){if(_0x281d48){return _0x281d48[_0x119d('0x22')]()[_0x119d('0x21')](function(){var _0x4ddacb=_0x281d48[_0x119d('0x23')]({'plain':!![]});var _0x4fd794=_0x119d('0x24');return db[_0x119d('0x25')][_0x119d('0x22')]({'where':{'type':_0x4fd794,'resourceId':_0x4ddacb['id']}})[_0x119d('0x21')](function(){return _0x281d48;});})[_0x119d('0x21')](function(){_0x3d8df0[_0x119d('0x16')](0xcc)[_0x119d('0x17')]();});}};}function handleEntityNotFound(_0x58e30e,_0x11bcb2){return function(_0xd48c9a){if(!_0xd48c9a){_0x58e30e['sendStatus'](0x194);}return _0xd48c9a;};}function handleError(_0x3c1d67,_0x3d059e){_0x3d059e=_0x3d059e||0x1f4;return function(_0xbf08bc){logger['error'](_0xbf08bc['stack']);if(_0xbf08bc[_0x119d('0x26')]){delete _0xbf08bc[_0x119d('0x26')];}_0x3c1d67[_0x119d('0x16')](_0x3d059e)['send'](_0xbf08bc);};}exports[_0x119d('0x27')]=function(_0x1766f3,_0x20ac23){var _0x29cab8={},_0x1ef0e0={},_0x4da8a4={'count':0x0,'rows':[]};var _0x3b8b14=_['map'](db[_0x119d('0x28')]['rawAttributes'],function(_0x3d7b1e){return{'name':_0x3d7b1e[_0x119d('0x29')],'type':_0x3d7b1e[_0x119d('0x2a')][_0x119d('0x2b')]};});_0x1ef0e0[_0x119d('0x2c')]=_[_0x119d('0x2d')](_0x3b8b14,_0x119d('0x26'));_0x1ef0e0[_0x119d('0x2e')]=_[_0x119d('0x2f')](_0x1766f3['query']);_0x1ef0e0[_0x119d('0x30')]=_[_0x119d('0x31')](_0x1ef0e0[_0x119d('0x2c')],_0x1ef0e0[_0x119d('0x2e')]);_0x29cab8[_0x119d('0x32')]=_['intersection'](_0x1ef0e0[_0x119d('0x2c')],qs[_0x119d('0x33')](_0x1766f3[_0x119d('0x2e')][_0x119d('0x33')]));_0x29cab8[_0x119d('0x32')]=_0x29cab8[_0x119d('0x32')][_0x119d('0x34')]?_0x29cab8[_0x119d('0x32')]:_0x1ef0e0[_0x119d('0x2c')];if(!_0x1766f3['query']['hasOwnProperty'](_0x119d('0x35'))){_0x29cab8[_0x119d('0x1b')]=qs['limit'](_0x1766f3[_0x119d('0x2e')]['limit']);_0x29cab8[_0x119d('0x19')]=qs[_0x119d('0x19')](_0x1766f3['query'][_0x119d('0x19')]);}_0x29cab8[_0x119d('0x36')]=qs[_0x119d('0x37')](_0x1766f3[_0x119d('0x2e')][_0x119d('0x37')]);_0x29cab8[_0x119d('0x38')]=qs[_0x119d('0x30')](_[_0x119d('0x39')](_0x1766f3['query'],_0x1ef0e0[_0x119d('0x30')]),_0x3b8b14);if(_0x1766f3[_0x119d('0x2e')][_0x119d('0x3a')]){_0x29cab8[_0x119d('0x38')]=_[_0x119d('0x3b')](_0x29cab8[_0x119d('0x38')],{'$or':_[_0x119d('0x2d')](_0x3b8b14,function(_0x36cd56){if(_0x36cd56[_0x119d('0x2a')]!=='VIRTUAL'){var _0x316542={};_0x316542[_0x36cd56[_0x119d('0x26')]]={'$like':'%'+_0x1766f3['query'][_0x119d('0x3a')]+'%'};return _0x316542;}})});}_0x29cab8=_[_0x119d('0x3b')]({},_0x29cab8,_0x1766f3[_0x119d('0x3c')]);var _0x5e09e3={'where':_0x29cab8[_0x119d('0x38')]};return db[_0x119d('0x28')][_0x119d('0x3d')](_0x5e09e3)['then'](function(_0x4f6df1){_0x4da8a4[_0x119d('0x3d')]=_0x4f6df1;if(_0x1766f3[_0x119d('0x2e')]['includeAll']){_0x29cab8['include']=[{'all':!![]}];}return db[_0x119d('0x28')][_0x119d('0x3e')](_0x29cab8);})[_0x119d('0x21')](function(_0x2c67b2){_0x4da8a4['rows']=_0x2c67b2;return _0x4da8a4;})['then'](respondWithFilteredResult(_0x20ac23,_0x29cab8))[_0x119d('0x3f')](handleError(_0x20ac23,null));};exports[_0x119d('0x40')]=function(_0x340665,_0x44c1cd){var _0x5e0953={'raw':!![],'where':{'id':_0x340665['params']['id']}},_0x528e53={};_0x528e53[_0x119d('0x2c')]=_[_0x119d('0x2f')](db['Disposition'][_0x119d('0x41')]);_0x528e53[_0x119d('0x2e')]=_[_0x119d('0x2f')](_0x340665[_0x119d('0x2e')]);_0x528e53['filters']=_[_0x119d('0x31')](_0x528e53[_0x119d('0x2c')],_0x528e53[_0x119d('0x2e')]);_0x5e0953[_0x119d('0x32')]=_[_0x119d('0x31')](_0x528e53[_0x119d('0x2c')],qs['fields'](_0x340665['query'][_0x119d('0x33')]));_0x5e0953[_0x119d('0x32')]=_0x5e0953[_0x119d('0x32')]['length']?_0x5e0953[_0x119d('0x32')]:_0x528e53[_0x119d('0x2c')];if(_0x340665[_0x119d('0x2e')][_0x119d('0x42')]){_0x5e0953[_0x119d('0x43')]=[{'all':!![]}];}_0x5e0953=_[_0x119d('0x3b')]({},_0x5e0953,_0x340665[_0x119d('0x3c')]);return db[_0x119d('0x28')]['find'](_0x5e0953)['then'](handleEntityNotFound(_0x44c1cd,null))[_0x119d('0x21')](respondWithResult(_0x44c1cd,null))[_0x119d('0x3f')](handleError(_0x44c1cd,null));};exports[_0x119d('0x44')]=function(_0x4603c1,_0x36c11a){return db[_0x119d('0x28')][_0x119d('0x44')](_0x4603c1['body'],{})[_0x119d('0x21')](function(_0x1e0f0a){var _0x3f2789=_0x4603c1[_0x119d('0x45')][_0x119d('0x23')]({'plain':!![]});if(!_0x3f2789)throw new Error(_0x119d('0x46'));if(_0x3f2789['role']==='user'){var _0x37ff29=_0x1e0f0a[_0x119d('0x23')]({'plain':!![]});var _0xcbc0bf=_0x119d('0x24');return db[_0x119d('0x47')][_0x119d('0x48')]({'where':{'name':_0xcbc0bf,'userProfileId':_0x3f2789['userProfileId']},'raw':!![]})[_0x119d('0x21')](function(_0x4da73e){if(_0x4da73e&&_0x4da73e[_0x119d('0x49')]===0x0){return db[_0x119d('0x25')]['create']({'name':_0x37ff29[_0x119d('0x26')],'resourceId':_0x37ff29['id'],'type':_0x4da73e[_0x119d('0x26')],'sectionId':_0x4da73e['id']},{})[_0x119d('0x21')](function(){return _0x1e0f0a;});}else{return _0x1e0f0a;}})['catch'](function(_0x2f3bf7){logger[_0x119d('0x4a')](_0x119d('0x4b'),_0x2f3bf7);throw _0x2f3bf7;});}return _0x1e0f0a;})[_0x119d('0x21')](respondWithResult(_0x36c11a,0xc9))['catch'](handleError(_0x36c11a,null));};exports[_0x119d('0x20')]=function(_0x46916b,_0x45f877){if(_0x46916b[_0x119d('0x4c')]['id']){delete _0x46916b['body']['id'];}return db['Disposition']['find']({'where':{'id':_0x46916b[_0x119d('0x4d')]['id']}})[_0x119d('0x21')](handleEntityNotFound(_0x45f877,null))[_0x119d('0x21')](saveUpdates(_0x46916b[_0x119d('0x4c')],null))[_0x119d('0x21')](respondWithResult(_0x45f877,null))['catch'](handleError(_0x45f877,null));};exports[_0x119d('0x22')]=function(_0x2bcc4e,_0x546eee){return db[_0x119d('0x28')]['find']({'where':{'id':_0x2bcc4e[_0x119d('0x4d')]['id']}})[_0x119d('0x21')](handleEntityNotFound(_0x546eee,null))[_0x119d('0x21')](removeEntity(_0x546eee,null))[_0x119d('0x3f')](handleError(_0x546eee,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index e9bcff8..58a2461 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 _0xa14a=['name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','moment','bluebird','../../config/environment','./disposition.attributes','exports','define','Disposition','name_voice','name','ListId','name_chat','ChatWebsiteId'];(function(_0x3710e3,_0x2ca6bb){var _0x360784=function(_0x3c763d){while(--_0x3c763d){_0x3710e3['push'](_0x3710e3['shift']());}};_0x360784(++_0x2ca6bb);}(_0xa14a,0x1b9));var _0xaa14=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xa14a[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0xaa14('0x0'));var util=require('util');var logger=require(_0xaa14('0x1'))(_0xaa14('0x2'));var moment=require(_0xaa14('0x3'));var BPromise=require(_0xaa14('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaa14('0x5'));var attributes=require(_0xaa14('0x6'));module[_0xaa14('0x7')]=function(_0x5df053,_0xba108){return _0x5df053[_0xaa14('0x8')](_0xaa14('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xaa14('0xa'),'fields':[_0xaa14('0xb'),_0xaa14('0xc')]},{'unique':!![],'name':_0xaa14('0xd'),'fields':[_0xaa14('0xb'),_0xaa14('0xe')]},{'unique':!![],'name':_0xaa14('0xf'),'fields':[_0xaa14('0xb'),_0xaa14('0x10')]},{'unique':!![],'name':_0xaa14('0x11'),'fields':[_0xaa14('0xb'),_0xaa14('0x12')]},{'unique':!![],'name':_0xaa14('0x13'),'fields':[_0xaa14('0xb'),'FaxAccountId']},{'unique':!![],'name':_0xaa14('0x14'),'fields':[_0xaa14('0xb'),_0xaa14('0x15')]},{'unique':!![],'name':_0xaa14('0x16'),'fields':[_0xaa14('0xb'),_0xaa14('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xacd2=['name_openchannel','WhatsappAccountId','lodash','api','moment','bluebird','request-promise','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xacd2,0x116));var _0x2acd=function(_0x2516a5,_0x41f5b4){_0x2516a5=_0x2516a5-0x0;var _0x1297a7=_0xacd2[_0x2516a5];return _0x1297a7;};'use strict';var _=require(_0x2acd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2acd('0x1'));var moment=require(_0x2acd('0x2'));var BPromise=require(_0x2acd('0x3'));var rp=require(_0x2acd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2acd('0x5'));module[_0x2acd('0x6')]=function(_0x131d42,_0x5d7806){return _0x131d42[_0x2acd('0x7')](_0x2acd('0x8'),attributes,{'tableName':_0x2acd('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x2acd('0xa'),'fields':[_0x2acd('0xb'),_0x2acd('0xc')]},{'unique':!![],'name':_0x2acd('0xd'),'fields':[_0x2acd('0xb'),_0x2acd('0xe')]},{'unique':!![],'name':_0x2acd('0xf'),'fields':[_0x2acd('0xb'),_0x2acd('0x10')]},{'unique':!![],'name':_0x2acd('0x11'),'fields':[_0x2acd('0xb'),_0x2acd('0x12')]},{'unique':!![],'name':_0x2acd('0x13'),'fields':[_0x2acd('0xb'),_0x2acd('0x14')]},{'unique':!![],'name':_0x2acd('0x15'),'fields':[_0x2acd('0xb'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':['name',_0x2acd('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 2294150..8d70c20 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(_0xc795dd,_0x35a952){var _0x3a6814=function(_0x4fbf99){while(--_0x4fbf99){_0xc795dd['push'](_0xc795dd['shift']());}};_0x3a6814(++_0x35a952);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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(_0x366762,_0x48a99d){var _0x13e0de=function(_0x57529f){while(--_0x57529f){_0x366762['push'](_0x366762['shift']());}};_0x13e0de(++_0x48a99d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 4de62f7..457934e 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 _0x7890=['get','index','isAuthenticated','show','post','create','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7890,0x184));var _0x0789=function(_0xa19361,_0x18f3fb){_0xa19361=_0xa19361-0x0;var _0xda99f1=_0x7890[_0xa19361];return _0xda99f1;};'use strict';var multer=require(_0x0789('0x0'));var util=require(_0x0789('0x1'));var path=require(_0x0789('0x2'));var timeout=require(_0x0789('0x3'));var express=require(_0x0789('0x4'));var router=express['Router']();var fs_extra=require(_0x0789('0x5'));var auth=require(_0x0789('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0789('0x7'));var controller=require('./disposition.controller');router[_0x0789('0x8')]('/',auth['isAuthenticated'](),controller[_0x0789('0x9')]);router[_0x0789('0x8')]('/:id',auth[_0x0789('0xa')](),controller[_0x0789('0xb')]);router[_0x0789('0xc')]('/',auth[_0x0789('0xa')](),controller[_0x0789('0xd')]);router[_0x0789('0xe')](_0x0789('0xf'),auth[_0x0789('0xa')](),controller['update']);router[_0x0789('0x10')](_0x0789('0xf'),auth[_0x0789('0xa')](),controller[_0x0789('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2dd5=['./disposition.controller','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x2dd5,0x19a));var _0x52dd=function(_0x3e01ab,_0x23eb3d){_0x3e01ab=_0x3e01ab-0x0;var _0x339968=_0x2dd5[_0x3e01ab];return _0x339968;};'use strict';var multer=require(_0x52dd('0x0'));var util=require('util');var path=require(_0x52dd('0x1'));var timeout=require('connect-timeout');var express=require(_0x52dd('0x2'));var router=express[_0x52dd('0x3')]();var fs_extra=require(_0x52dd('0x4'));var auth=require(_0x52dd('0x5'));var interaction=require(_0x52dd('0x6'));var config=require(_0x52dd('0x7'));var controller=require(_0x52dd('0x8'));router['get']('/',auth[_0x52dd('0x9')](),controller[_0x52dd('0xa')]);router['get'](_0x52dd('0xb'),auth['isAuthenticated'](),controller[_0x52dd('0xc')]);router[_0x52dd('0xd')]('/',auth[_0x52dd('0x9')](),controller[_0x52dd('0xe')]);router[_0x52dd('0xf')](_0x52dd('0xb'),auth[_0x52dd('0x9')](),controller[_0x52dd('0x10')]);router['delete'](_0x52dd('0xb'),auth[_0x52dd('0x9')](),controller[_0x52dd('0x11')]);module[_0x52dd('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index fc280cc..bd9e077 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 _0x3045=['14400','v17,v27,v29','INTEGER','SIP','DADHI','KHOMP','TEXT','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','exports','STRING','yes','localstationid','ENUM','2400','4800','7200','9600','12000'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3045,0x73));var _0x5304=function(_0x18813b,_0x28b0fe){_0x18813b=_0x18813b-0x0;var _0x19b6e3=_0x3045[_0x18813b];return _0x19b6e3;};'use strict';var Sequelize=require(_0x5304('0x0'));module[_0x5304('0x1')]={'name':{'type':Sequelize[_0x5304('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5304('0x2')]},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x5304('0x3')},'headerinfo':{'type':Sequelize[_0x5304('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x5304('0x2')],'unique':_0x5304('0x4')},'minrate':{'type':Sequelize[_0x5304('0x5')](_0x5304('0x6'),_0x5304('0x7'),_0x5304('0x8'),_0x5304('0x9'),_0x5304('0xa'),_0x5304('0xb')),'defaultValue':_0x5304('0x7')},'maxrate':{'type':Sequelize[_0x5304('0x5')](_0x5304('0x6'),_0x5304('0x7'),_0x5304('0x8'),_0x5304('0x9'),_0x5304('0xa'),'14400'),'defaultValue':_0x5304('0xb')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x5304('0xc')},'gateway':{'type':Sequelize[_0x5304('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x5304('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x5304('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x5304('0x5')](_0x5304('0xe'),'IAX',_0x5304('0xf'),_0x5304('0x10')),'defaultValue':_0x5304('0xe')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5304('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5304('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5304('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5304('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5304('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5304('0x12')],'defaultValue':![],'comment':_0x5304('0x13'),'set':function(_0x5d01b1){if(!_0x5d01b1)this[_0x5304('0x14')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x5d01b1);}}}; \ No newline at end of file +var _0x2e02=['yes','4800','12000','14400','2400','7200','9600','v17,v27,v29','INTEGER','DADHI','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM'];(function(_0x5b2850,_0x508e8b){var _0x42c28f=function(_0x2893f9){while(--_0x2893f9){_0x5b2850['push'](_0x5b2850['shift']());}};_0x42c28f(++_0x508e8b);}(_0x2e02,0x1e0));var _0x22e0=function(_0x26474a,_0x3cfcfd){_0x26474a=_0x26474a-0x0;var _0x32e0e0=_0x2e02[_0x26474a];return _0x32e0e0;};'use strict';var Sequelize=require(_0x22e0('0x0'));module[_0x22e0('0x1')]={'name':{'type':Sequelize[_0x22e0('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x22e0('0x2')]},'ecm':{'type':Sequelize[_0x22e0('0x3')](_0x22e0('0x4'),'no'),'defaultValue':_0x22e0('0x4')},'headerinfo':{'type':Sequelize[_0x22e0('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x22e0('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x22e0('0x3')]('2400',_0x22e0('0x5'),'7200','9600',_0x22e0('0x6'),_0x22e0('0x7')),'defaultValue':_0x22e0('0x5')},'maxrate':{'type':Sequelize[_0x22e0('0x3')](_0x22e0('0x8'),_0x22e0('0x5'),_0x22e0('0x9'),_0x22e0('0xa'),_0x22e0('0x6'),'14400'),'defaultValue':_0x22e0('0x7')},'modem':{'type':Sequelize[_0x22e0('0x2')],'defaultValue':_0x22e0('0xb')},'gateway':{'type':Sequelize[_0x22e0('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x22e0('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x22e0('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP','IAX',_0x22e0('0xd'),'KHOMP'),'defaultValue':_0x22e0('0xe')},'key':{'type':Sequelize[_0x22e0('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x22e0('0xf')],'defaultValue':function(){return _0x22e0('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x22e0('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x22e0('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x22e0('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x22e0('0xc')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x22e0('0x12'),'set':function(_0x5084d1){if(!_0x5084d1)this[_0x22e0('0x13')](_0x22e0('0x14'),null);this['setDataValue'](_0x22e0('0x15'),_0x5084d1);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index d86414c..e33445f 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 _0x53e6=['fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','Disposition','rawAttributes','nolimit','removeDispositions','ids','CannedAnswer','create','findOne','order','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','internal','Tag','color','tag','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','priority','getApplications','context','exten','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','tech','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','format','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','fax','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','FaxAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','FaxAccount','fieldName','type','key','model','map','query','keys','intersection'];(function(_0xe369d6,_0x3a0c2b){var _0x313a58=function(_0x24d47c){while(--_0x24d47c){_0xe369d6['push'](_0xe369d6['shift']());}};_0x313a58(++_0x3a0c2b);}(_0x53e6,0x75));var _0x653e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x53e6[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0x653e('0x0'));var rimraf=require(_0x653e('0x1'));var zipdir=require(_0x653e('0x2'));var jsonpatch=require(_0x653e('0x3'));var rp=require('request-promise');var moment=require(_0x653e('0x4'));var BPromise=require(_0x653e('0x5'));var Mustache=require(_0x653e('0x6'));var util=require(_0x653e('0x7'));var path=require(_0x653e('0x8'));var sox=require(_0x653e('0x9'));var csv=require(_0x653e('0xa'));var ejs=require(_0x653e('0xb'));var fs=require('fs');var fs_extra=require(_0x653e('0xc'));var _=require(_0x653e('0xd'));var squel=require(_0x653e('0xe'));var crypto=require(_0x653e('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x653e('0x10'));var toCsv=require('to-csv');var querystring=require(_0x653e('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x653e('0x12'));var qs=require(_0x653e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x653e('0x14'));var logger=require(_0x653e('0x15'))('api');var utils=require(_0x653e('0x16'));var config=require(_0x653e('0x17'));var licenseUtil=require(_0x653e('0x18'));var db=require(_0x653e('0x19'))['db'];config[_0x653e('0x1a')]=_[_0x653e('0x1b')](config[_0x653e('0x1a')],{'host':_0x653e('0x1c'),'port':0x18eb});var socket=require(_0x653e('0x1d'))(new Redis(config[_0x653e('0x1a')]));require(_0x653e('0x1e'))[_0x653e('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x653e('0x20')][_0x653e('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x653e('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x58e698,_0x3f78e7,_0x18beec,_0x4e16ad){return new BPromise(function(_0x21c732,_0x591b4e){var _0x5ecaf2=_0x4e16ad||client;return _0x5ecaf2[_0x653e('0x22')](_0x58e698,_0x18beec)['then'](function(_0x53e60e){logger['info'](_0x653e('0x23'),_0x3f78e7,_0x653e('0x24'));logger[_0x653e('0x25')](_0x653e('0x26'),_0x3f78e7,_0x653e('0x24'),JSON['stringify'](_0x53e60e));if(_0x53e60e[_0x653e('0x27')]){if(_0x53e60e[_0x653e('0x27')][_0x653e('0x28')]===0x1f4){logger[_0x653e('0x27')]('FaxAccount,\x20%s,\x20%s',_0x3f78e7,_0x53e60e[_0x653e('0x27')][_0x653e('0x29')]);return _0x591b4e(_0x53e60e['error'][_0x653e('0x29')]);}logger['error'](_0x653e('0x23'),_0x3f78e7,_0x53e60e[_0x653e('0x27')][_0x653e('0x29')]);return _0x21c732(_0x53e60e[_0x653e('0x27')][_0x653e('0x29')]);}else{logger[_0x653e('0x2a')](_0x653e('0x23'),_0x3f78e7,'request\x20sent');_0x21c732(_0x53e60e[_0x653e('0x2b')][_0x653e('0x29')]);}})['catch'](function(_0x34309a){logger[_0x653e('0x27')](_0x653e('0x23'),_0x3f78e7,_0x34309a);_0x591b4e(_0x34309a);});});}function respondWithStatusCode(_0x4ed1b1,_0x2daff2){_0x2daff2=_0x2daff2||0xcc;return function(_0x234dce){if(_0x234dce){return _0x4ed1b1[_0x653e('0x2c')](_0x2daff2);}return _0x4ed1b1[_0x653e('0x2d')](_0x2daff2)[_0x653e('0x2e')]();};}function respondWithResult(_0x303f5e,_0x5f4ac4){_0x5f4ac4=_0x5f4ac4||0xc8;return function(_0x5cc23d){if(_0x5cc23d){return _0x303f5e['status'](_0x5f4ac4)[_0x653e('0x2f')](_0x5cc23d);}};}function respondWithFilteredResult(_0x2c8821,_0x49d5d3){return function(_0xba1137){if(_0xba1137){var _0x5171ba=typeof _0x49d5d3[_0x653e('0x30')]===_0x653e('0x31')&&typeof _0x49d5d3[_0x653e('0x32')]===_0x653e('0x31');var _0x1b7da4=_0xba1137['count'];var _0xf79174=_0x5171ba?0x0:_0x49d5d3[_0x653e('0x30')];var _0x4f6869=_0x5171ba?_0xba1137[_0x653e('0x33')]:_0x49d5d3[_0x653e('0x30')]+_0x49d5d3[_0x653e('0x32')];var _0x3ceb5f;if(_0x4f6869>=_0x1b7da4){_0x4f6869=_0x1b7da4;_0x3ceb5f=0xc8;}else{_0x3ceb5f=0xce;}_0x2c8821['status'](_0x3ceb5f);return _0x2c8821[_0x653e('0x34')](_0x653e('0x35'),_0xf79174+'-'+_0x4f6869+'/'+_0x1b7da4)[_0x653e('0x2f')](_0xba1137);}return null;};}function patchUpdates(_0x39856a){return function(_0x4106e3){try{jsonpatch[_0x653e('0x36')](_0x4106e3,_0x39856a,!![]);}catch(_0x3b5f8d){return BPromise[_0x653e('0x37')](_0x3b5f8d);}return _0x4106e3[_0x653e('0x38')]();};}function saveUpdates(_0x30f0bd,_0x2cf432){return function(_0x32db1a){if(_0x32db1a){return _0x32db1a[_0x653e('0x39')](_0x30f0bd)[_0x653e('0x3a')](function(_0x1d2ef9){return _0x1d2ef9;});}return null;};}function removeEntity(_0x1a9428,_0x160028){return function(_0x3c91f2){if(_0x3c91f2){return _0x3c91f2[_0x653e('0x3b')]()[_0x653e('0x3a')](function(){var _0xb466c7=_0x3c91f2[_0x653e('0x3c')]({'plain':!![]});var _0x2a5c77=_0x653e('0x3d');return db[_0x653e('0x3e')][_0x653e('0x3b')]({'where':{'type':_0x2a5c77,'resourceId':_0xb466c7['id']}})['then'](function(){return _0x3c91f2;});})[_0x653e('0x3a')](function(){_0x1a9428[_0x653e('0x2d')](0xcc)[_0x653e('0x2e')]();});}};}function handleEntityNotFound(_0x524f21,_0x10a2ee){return function(_0x5dd5e1){if(!_0x5dd5e1){_0x524f21[_0x653e('0x2c')](0x194);}return _0x5dd5e1;};}function handleError(_0x2789bb,_0x4798e7){_0x4798e7=_0x4798e7||0x1f4;return function(_0x1e4f22){logger[_0x653e('0x27')](_0x1e4f22[_0x653e('0x3f')]);if(_0x1e4f22['name']){delete _0x1e4f22[_0x653e('0x40')];}_0x2789bb[_0x653e('0x2d')](_0x4798e7)['send'](_0x1e4f22);};}exports[_0x653e('0x41')]=function(_0x39e5cc,_0x3b8528){var _0x407fd5={'include':[{'model':db[_0x653e('0x42')],'as':_0x653e('0x43')}]},_0x5a2813={},_0x29acf6={'count':0x0,'rows':[]};var _0x53ad27=_['map'](db[_0x653e('0x44')]['rawAttributes'],function(_0x1d92d4){return{'name':_0x1d92d4[_0x653e('0x45')],'type':_0x1d92d4[_0x653e('0x46')][_0x653e('0x47')]};});_0x5a2813[_0x653e('0x48')]=_[_0x653e('0x49')](_0x53ad27,_0x653e('0x40'));_0x5a2813[_0x653e('0x4a')]=_[_0x653e('0x4b')](_0x39e5cc[_0x653e('0x4a')]);_0x5a2813['filters']=_[_0x653e('0x4c')](_0x5a2813[_0x653e('0x48')],_0x5a2813[_0x653e('0x4a')]);_0x407fd5['attributes']=_[_0x653e('0x4c')](_0x5a2813['model'],qs['fields'](_0x39e5cc[_0x653e('0x4a')][_0x653e('0x4d')]));_0x407fd5['attributes']=_0x407fd5[_0x653e('0x4e')][_0x653e('0x4f')]?_0x407fd5[_0x653e('0x4e')]:_0x5a2813[_0x653e('0x48')];if(!_0x39e5cc[_0x653e('0x4a')][_0x653e('0x50')]('nolimit')){_0x407fd5['limit']=qs[_0x653e('0x32')](_0x39e5cc['query'][_0x653e('0x32')]);_0x407fd5[_0x653e('0x30')]=qs[_0x653e('0x30')](_0x39e5cc[_0x653e('0x4a')]['offset']);}_0x407fd5['order']=qs[_0x653e('0x51')](_0x39e5cc[_0x653e('0x4a')][_0x653e('0x51')]);_0x407fd5[_0x653e('0x52')]=qs[_0x653e('0x53')](_[_0x653e('0x54')](_0x39e5cc[_0x653e('0x4a')],_0x5a2813[_0x653e('0x53')]),_0x53ad27);if(_0x39e5cc[_0x653e('0x4a')][_0x653e('0x55')]){_0x407fd5[_0x653e('0x52')]=_['merge'](_0x407fd5['where'],{'$or':_[_0x653e('0x49')](_0x53ad27,function(_0x5bab3f){if(_0x5bab3f['type']!=='VIRTUAL'){var _0x280a19={};_0x280a19[_0x5bab3f['name']]={'$like':'%'+_0x39e5cc[_0x653e('0x4a')]['filter']+'%'};return _0x280a19;}})});}_0x407fd5=_[_0x653e('0x56')]({},_0x407fd5,_0x39e5cc['options']);var _0x395274={'where':_0x407fd5[_0x653e('0x52')]};return db['FaxAccount']['count'](_0x395274)['then'](function(_0x36c8f3){_0x29acf6[_0x653e('0x33')]=_0x36c8f3;if(_0x39e5cc[_0x653e('0x4a')][_0x653e('0x57')]){_0x407fd5[_0x653e('0x58')]=[{'all':!![]}];}return db[_0x653e('0x44')][_0x653e('0x59')](_0x407fd5);})[_0x653e('0x3a')](function(_0x278824){_0x29acf6[_0x653e('0x5a')]=_0x278824;return _0x29acf6;})['then'](respondWithFilteredResult(_0x3b8528,_0x407fd5))[_0x653e('0x5b')](handleError(_0x3b8528,null));};exports[_0x653e('0x5c')]=function(_0x1aa4a8,_0x2b5678){var _0x1e3a49={'raw':![],'where':{'id':_0x1aa4a8[_0x653e('0x5d')]['id']},'include':[{'model':db[_0x653e('0x42')],'as':_0x653e('0x43')}]},_0x4a5957={};_0x4a5957[_0x653e('0x48')]=_[_0x653e('0x4b')](db[_0x653e('0x44')]['rawAttributes']);_0x4a5957[_0x653e('0x4a')]=_[_0x653e('0x4b')](_0x1aa4a8[_0x653e('0x4a')]);_0x4a5957[_0x653e('0x53')]=_[_0x653e('0x4c')](_0x4a5957[_0x653e('0x48')],_0x4a5957[_0x653e('0x4a')]);_0x1e3a49[_0x653e('0x4e')]=_[_0x653e('0x4c')](_0x4a5957['model'],qs[_0x653e('0x4d')](_0x1aa4a8[_0x653e('0x4a')]['fields']));_0x1e3a49[_0x653e('0x4e')]=_0x1e3a49[_0x653e('0x4e')]['length']?_0x1e3a49[_0x653e('0x4e')]:_0x4a5957[_0x653e('0x48')];if(_0x1aa4a8[_0x653e('0x4a')]['includeAll']){_0x1e3a49[_0x653e('0x58')]=[{'all':!![]}];}_0x1e3a49=_[_0x653e('0x56')]({},_0x1e3a49,_0x1aa4a8[_0x653e('0x5e')]);return db['FaxAccount'][_0x653e('0x5f')](_0x1e3a49)[_0x653e('0x3a')](handleEntityNotFound(_0x2b5678,null))[_0x653e('0x3a')](respondWithResult(_0x2b5678,null))[_0x653e('0x5b')](handleError(_0x2b5678,null));};exports['create']=function(_0x46beae,_0x2dd421){return db['FaxAccount']['create'](_0x46beae['body'],{})['then'](function(_0x5f1f94){var _0xa842eb=_0x46beae[_0x653e('0x60')][_0x653e('0x3c')]({'plain':!![]});if(!_0xa842eb)throw new Error(_0x653e('0x61'));if(_0xa842eb['role']===_0x653e('0x60')){var _0x45b167=_0x5f1f94['get']({'plain':!![]});var _0x418e65='FaxAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x418e65,'userProfileId':_0xa842eb[_0x653e('0x62')]},'raw':!![]})['then'](function(_0x50073f){if(_0x50073f&&_0x50073f[_0x653e('0x63')]===0x0){return db[_0x653e('0x3e')]['create']({'name':_0x45b167[_0x653e('0x40')],'resourceId':_0x45b167['id'],'type':_0x50073f['name'],'sectionId':_0x50073f['id']},{})['then'](function(){return _0x5f1f94;});}else{return _0x5f1f94;}})['catch'](function(_0x4ed858){logger[_0x653e('0x27')](_0x653e('0x64'),_0x4ed858);throw _0x4ed858;});}return _0x5f1f94;})[_0x653e('0x3a')](respondWithResult(_0x2dd421,0xc9))[_0x653e('0x5b')](handleError(_0x2dd421,null));};exports[_0x653e('0x39')]=function(_0x521666,_0x2fe699){if(_0x521666['body']['id']){delete _0x521666[_0x653e('0x65')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x521666[_0x653e('0x5d')]['id']},'include':[{'model':db[_0x653e('0x42')],'as':_0x653e('0x43')}]})[_0x653e('0x3a')](handleEntityNotFound(_0x2fe699,null))[_0x653e('0x3a')](saveUpdates(_0x521666[_0x653e('0x65')],null))[_0x653e('0x3a')](respondWithResult(_0x2fe699,null))['catch'](handleError(_0x2fe699,null));};exports[_0x653e('0x3b')]=function(_0x291a3a,_0x1ff42b){return db[_0x653e('0x44')][_0x653e('0x5f')]({'where':{'id':_0x291a3a[_0x653e('0x5d')]['id']}})[_0x653e('0x3a')](handleEntityNotFound(_0x1ff42b,null))[_0x653e('0x3a')](removeEntity(_0x1ff42b,null))[_0x653e('0x5b')](handleError(_0x1ff42b,null));};exports['describe']=function(_0x3dd38b,_0x24b6c5){return db[_0x653e('0x44')][_0x653e('0x66')]()[_0x653e('0x3a')](respondWithResult(_0x24b6c5,null))[_0x653e('0x5b')](handleError(_0x24b6c5,null));};exports[_0x653e('0x67')]=function(_0x2dbb2c,_0x4ff2f9,_0x3531c2){if(_0x2dbb2c['body']['id']){delete _0x2dbb2c['body']['id'];}return db[_0x653e('0x44')][_0x653e('0x5f')]({'where':{'id':_0x2dbb2c['params']['id']}})[_0x653e('0x3a')](handleEntityNotFound(_0x4ff2f9,null))[_0x653e('0x3a')](function(_0x1d46c8){if(_0x1d46c8){_0x2dbb2c[_0x653e('0x65')][_0x653e('0x68')]=_0x1d46c8['id'];return db['Disposition']['create'](_0x2dbb2c['body']);}})[_0x653e('0x3a')](respondWithResult(_0x4ff2f9,null))[_0x653e('0x5b')](handleError(_0x4ff2f9,null));};exports['getDispositions']=function(_0xb325c4,_0x64af7a,_0x2879b0){var _0x4fdf38={'raw':![],'where':{}};var _0x593474={};var _0x41393f={'count':0x0,'rows':[]};return db[_0x653e('0x44')]['findOne']({'where':{'id':_0xb325c4[_0x653e('0x5d')]['id']}})[_0x653e('0x3a')](handleEntityNotFound(_0x64af7a,null))['then'](function(_0xb8e265){if(_0xb8e265){_0x593474[_0x653e('0x48')]=_[_0x653e('0x4b')](db[_0x653e('0x69')][_0x653e('0x6a')]);_0x593474[_0x653e('0x4a')]=_[_0x653e('0x4b')](_0xb325c4['query']);_0x593474[_0x653e('0x53')]=_[_0x653e('0x4c')](_0x593474['model'],_0x593474[_0x653e('0x4a')]);_0x4fdf38['attributes']=_[_0x653e('0x4c')](_0x593474[_0x653e('0x48')],qs['fields'](_0xb325c4['query']['fields']));_0x4fdf38[_0x653e('0x4e')]=_0x4fdf38[_0x653e('0x4e')][_0x653e('0x4f')]?_0x4fdf38[_0x653e('0x4e')]:_0x593474['model'];if(!_0xb325c4['query'][_0x653e('0x50')](_0x653e('0x6b'))){_0x4fdf38[_0x653e('0x32')]=qs[_0x653e('0x32')](_0xb325c4[_0x653e('0x4a')][_0x653e('0x32')]);_0x4fdf38[_0x653e('0x30')]=qs[_0x653e('0x30')](_0xb325c4['query'][_0x653e('0x30')]);}_0x4fdf38['order']=qs['sort'](_0xb325c4[_0x653e('0x4a')]['sort']);_0x4fdf38['where']=qs[_0x653e('0x53')](_[_0x653e('0x54')](_0xb325c4[_0x653e('0x4a')],_0x593474[_0x653e('0x53')]));_0x4fdf38[_0x653e('0x52')][_0x653e('0x68')]=_0xb8e265['id'];if(_0xb325c4['query'][_0x653e('0x55')]){_0x4fdf38['where']=_['merge'](_0x4fdf38[_0x653e('0x52')],{'$or':_[_0x653e('0x49')](_0x4fdf38[_0x653e('0x4e')],function(_0x3c24c3){var _0x2b10c1={};_0x2b10c1[_0x3c24c3]={'$like':'%'+_0xb325c4[_0x653e('0x4a')]['filter']+'%'};return _0x2b10c1;})});}_0x4fdf38=_[_0x653e('0x56')]({},_0x4fdf38,_0xb325c4['options']);return db[_0x653e('0x69')][_0x653e('0x33')]({'where':_0x4fdf38[_0x653e('0x52')]})[_0x653e('0x3a')](function(_0x3ad908){_0x41393f[_0x653e('0x33')]=_0x3ad908;if(_0xb325c4[_0x653e('0x4a')][_0x653e('0x57')]){_0x4fdf38['include']=[{'all':!![]}];}return db[_0x653e('0x69')]['findAll'](_0x4fdf38);})[_0x653e('0x3a')](function(_0x301482){_0x41393f['rows']=_0x301482;return _0x41393f;});}})['then'](respondWithFilteredResult(_0x64af7a,_0x4fdf38))[_0x653e('0x5b')](handleError(_0x64af7a,null));};exports['removeDispositions']=function(_0x19be05,_0x5e6d56,_0x2fa672){return db[_0x653e('0x44')][_0x653e('0x5f')]({'where':{'id':_0x19be05[_0x653e('0x5d')]['id']}})[_0x653e('0x3a')](handleEntityNotFound(_0x5e6d56,null))[_0x653e('0x3a')](function(_0x51d2d3){if(_0x51d2d3){return _0x51d2d3[_0x653e('0x6c')](_0x19be05[_0x653e('0x4a')][_0x653e('0x6d')]);}})[_0x653e('0x3a')](respondWithStatusCode(_0x5e6d56,null))[_0x653e('0x5b')](handleError(_0x5e6d56,null));};exports['addAnswer']=function(_0x31d911,_0x2eb7fe,_0x41ab45){if(_0x31d911['body']['id']){delete _0x31d911[_0x653e('0x65')]['id'];}return db[_0x653e('0x44')][_0x653e('0x5f')]({'where':{'id':_0x31d911[_0x653e('0x5d')]['id']}})[_0x653e('0x3a')](handleEntityNotFound(_0x2eb7fe,null))[_0x653e('0x3a')](function(_0x4e2bbd){if(_0x4e2bbd){_0x31d911[_0x653e('0x65')][_0x653e('0x68')]=_0x4e2bbd['id'];return db[_0x653e('0x6e')][_0x653e('0x6f')](_0x31d911['body']);}})[_0x653e('0x3a')](respondWithResult(_0x2eb7fe,null))[_0x653e('0x5b')](handleError(_0x2eb7fe,null));};exports['getAnswers']=function(_0x5efefb,_0x18199f,_0x1e1749){var _0x1e2ae8={'raw':![],'where':{}};var _0x1590c8={};var _0x1f6c07={'count':0x0,'rows':[]};return db['FaxAccount'][_0x653e('0x70')]({'where':{'id':_0x5efefb['params']['id']}})[_0x653e('0x3a')](handleEntityNotFound(_0x18199f,null))[_0x653e('0x3a')](function(_0x4db4e4){if(_0x4db4e4){_0x1590c8['model']=_[_0x653e('0x4b')](db[_0x653e('0x6e')]['rawAttributes']);_0x1590c8['query']=_['keys'](_0x5efefb['query']);_0x1590c8[_0x653e('0x53')]=_[_0x653e('0x4c')](_0x1590c8[_0x653e('0x48')],_0x1590c8[_0x653e('0x4a')]);_0x1e2ae8[_0x653e('0x4e')]=_['intersection'](_0x1590c8['model'],qs[_0x653e('0x4d')](_0x5efefb[_0x653e('0x4a')][_0x653e('0x4d')]));_0x1e2ae8[_0x653e('0x4e')]=_0x1e2ae8[_0x653e('0x4e')][_0x653e('0x4f')]?_0x1e2ae8[_0x653e('0x4e')]:_0x1590c8[_0x653e('0x48')];if(!_0x5efefb[_0x653e('0x4a')]['hasOwnProperty'](_0x653e('0x6b'))){_0x1e2ae8['limit']=qs[_0x653e('0x32')](_0x5efefb[_0x653e('0x4a')][_0x653e('0x32')]);_0x1e2ae8[_0x653e('0x30')]=qs[_0x653e('0x30')](_0x5efefb[_0x653e('0x4a')][_0x653e('0x30')]);}_0x1e2ae8[_0x653e('0x71')]=qs[_0x653e('0x51')](_0x5efefb[_0x653e('0x4a')]['sort']);_0x1e2ae8['where']=qs[_0x653e('0x53')](_[_0x653e('0x54')](_0x5efefb[_0x653e('0x4a')],_0x1590c8[_0x653e('0x53')]));_0x1e2ae8[_0x653e('0x52')][_0x653e('0x68')]=_0x4db4e4['id'];if(_0x5efefb[_0x653e('0x4a')][_0x653e('0x55')]){_0x1e2ae8[_0x653e('0x52')]=_[_0x653e('0x56')](_0x1e2ae8['where'],{'$or':_[_0x653e('0x49')](_0x1e2ae8[_0x653e('0x4e')],function(_0xc91301){var _0x3a8f1b={};_0x3a8f1b[_0xc91301]={'$like':'%'+_0x5efefb[_0x653e('0x4a')]['filter']+'%'};return _0x3a8f1b;})});}_0x1e2ae8=_[_0x653e('0x56')]({},_0x1e2ae8,_0x5efefb['options']);return db['CannedAnswer'][_0x653e('0x33')]({'where':_0x1e2ae8[_0x653e('0x52')]})[_0x653e('0x3a')](function(_0x45a3c5){_0x1f6c07[_0x653e('0x33')]=_0x45a3c5;if(_0x5efefb['query']['includeAll']){_0x1e2ae8[_0x653e('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0x653e('0x59')](_0x1e2ae8);})['then'](function(_0x5dbe19){_0x1f6c07[_0x653e('0x5a')]=_0x5dbe19;return _0x1f6c07;});}})[_0x653e('0x3a')](respondWithFilteredResult(_0x18199f,_0x1e2ae8))[_0x653e('0x5b')](handleError(_0x18199f,null));};exports[_0x653e('0x72')]=function(_0x27035e,_0x3b1fba,_0x533b99){return db[_0x653e('0x44')][_0x653e('0x5f')]({'where':{'id':_0x27035e[_0x653e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3b1fba,null))[_0x653e('0x3a')](function(_0x22f0f2){if(_0x22f0f2){return _0x22f0f2[_0x653e('0x72')](_0x27035e[_0x653e('0x4a')][_0x653e('0x6d')]);}})['then'](respondWithStatusCode(_0x3b1fba,null))[_0x653e('0x5b')](handleError(_0x3b1fba,null));};exports[_0x653e('0x73')]=function(_0x40f4d1,_0x30bb69,_0x5b9428){return db[_0x653e('0x74')][_0x653e('0x5f')]({'where':{'id':_0x40f4d1[_0x653e('0x5d')]['id']}})[_0x653e('0x3a')](handleEntityNotFound(_0x30bb69,null))[_0x653e('0x3a')](function(_0x2c3baa){if(_0x2c3baa){return _0x2c3baa[_0x653e('0x73')](_0x40f4d1['body'][_0x653e('0x6d')],_[_0x653e('0x75')](_0x40f4d1[_0x653e('0x65')],[_0x653e('0x6d'),'id'])||{});}})[_0x653e('0x3a')](respondWithResult(_0x30bb69,null))['catch'](handleError(_0x30bb69,null));};exports[_0x653e('0x76')]=function(_0x59ae7d,_0x267aca,_0x259d78){var _0x20c980={'raw':![],'where':{}};var _0x345dd0={};var _0x6c2ee6={'count':0x0,'rows':[]};return db[_0x653e('0x44')][_0x653e('0x70')]({'where':{'id':_0x59ae7d[_0x653e('0x5d')]['id']}})[_0x653e('0x3a')](handleEntityNotFound(_0x267aca,null))[_0x653e('0x3a')](function(_0x1fa47a){if(_0x1fa47a){_0x345dd0[_0x653e('0x48')]=_[_0x653e('0x4b')](db['FaxInteraction']['rawAttributes']);_0x345dd0[_0x653e('0x4a')]=_[_0x653e('0x4b')](_0x59ae7d[_0x653e('0x4a')]);_0x345dd0[_0x653e('0x53')]=_[_0x653e('0x4c')](_0x345dd0[_0x653e('0x48')],_0x345dd0['query']);_0x20c980['attributes']=_[_0x653e('0x4c')](_0x345dd0[_0x653e('0x48')],qs[_0x653e('0x4d')](_0x59ae7d[_0x653e('0x4a')][_0x653e('0x4d')]));_0x20c980[_0x653e('0x4e')]=_0x20c980[_0x653e('0x4e')][_0x653e('0x4f')]?_0x20c980[_0x653e('0x4e')]:_0x345dd0[_0x653e('0x48')];if(!_0x59ae7d[_0x653e('0x4a')][_0x653e('0x50')]('nolimit')){_0x20c980['limit']=qs[_0x653e('0x32')](_0x59ae7d[_0x653e('0x4a')]['limit']);_0x20c980[_0x653e('0x30')]=qs[_0x653e('0x30')](_0x59ae7d[_0x653e('0x4a')][_0x653e('0x30')]);}_0x20c980[_0x653e('0x71')]=qs[_0x653e('0x51')](_0x59ae7d[_0x653e('0x4a')][_0x653e('0x51')]);_0x20c980[_0x653e('0x52')]=qs[_0x653e('0x53')](_[_0x653e('0x54')](_0x59ae7d['query'],_0x345dd0[_0x653e('0x53')]));_0x20c980[_0x653e('0x52')][_0x653e('0x68')]=_0x1fa47a['id'];if(_0x59ae7d['query'][_0x653e('0x55')]){_0x20c980[_0x653e('0x52')]=_[_0x653e('0x56')](_0x20c980['where'],{'$or':_[_0x653e('0x49')](_0x20c980[_0x653e('0x4e')],function(_0x48dfdd){var _0x159db8={};_0x159db8[_0x48dfdd]={'$like':'%'+_0x59ae7d[_0x653e('0x4a')][_0x653e('0x55')]+'%'};return _0x159db8;})});}_0x20c980=_[_0x653e('0x56')]({},_0x20c980,_0x59ae7d[_0x653e('0x5e')]);return db[_0x653e('0x74')][_0x653e('0x33')]({'where':_0x20c980[_0x653e('0x52')]})['then'](function(_0x3ed790){_0x6c2ee6[_0x653e('0x33')]=_0x3ed790;if(_0x59ae7d[_0x653e('0x4a')][_0x653e('0x57')]){_0x20c980[_0x653e('0x58')]=[{'model':db[_0x653e('0x77')],'as':_0x653e('0x78'),'required':![]},{'model':db[_0x653e('0x79')],'as':'Owner','attributes':[_0x653e('0x40'),'fullname',_0x653e('0x7a')],'required':![]},{'model':db[_0x653e('0x7b')],'as':'Tags','attributes':['id',_0x653e('0x40'),_0x653e('0x7c')],'where':_0x59ae7d[_0x653e('0x4a')]['tag']?{'id':_0x59ae7d[_0x653e('0x4a')][_0x653e('0x7d')]}:undefined,'required':_0x59ae7d['query'][_0x653e('0x7d')]?!![]:![]}];}return db['FaxInteraction'][_0x653e('0x59')](_0x20c980);})[_0x653e('0x3a')](function(_0x251462){_0x6c2ee6[_0x653e('0x5a')]=_0x251462;return _0x6c2ee6;});}})[_0x653e('0x3a')](respondWithFilteredResult(_0x267aca,_0x20c980))['catch'](handleError(_0x267aca,null));};exports['addApplications']=function(_0x482f09,_0x1fea0a){var _0x1240d1=_0x482f09['params']['id'];var _0x514598=_0x482f09[_0x653e('0x65')];var _0x3fdd32=0xc8;var _0x2c4b24=null;return db['sequelize'][_0x653e('0x7e')]({'isolationLevel':db[_0x653e('0x7f')][_0x653e('0x80')][_0x653e('0x81')][_0x653e('0x82')]},function(_0x345dd4){return db[_0x653e('0x44')][_0x653e('0x70')]({'where':{'id':_0x1240d1},'transaction':_0x345dd4})['then'](function(_0x34acf1){if(_0x34acf1){return db[_0x653e('0x83')][_0x653e('0x3b')]({'where':{'FaxAccountId':_0x1240d1},'transaction':_0x345dd4})[_0x653e('0x3a')](function(){var _0x1a1bbc=_[_0x653e('0x49')](_0x514598,function(_0x4f3c74){_0x4f3c74['FaxAccountId']=_0x1240d1;return _0x4f3c74;});return db[_0x653e('0x83')]['bulkCreate'](_0x1a1bbc,{'transaction':_0x345dd4});});}else{_0x3fdd32=0x194;_0x2c4b24=[];}});})['then'](function(){if(_0x3fdd32!==0x194){return db[_0x653e('0x83')]['findAndCountAll']({'where':{'FaxAccountId':_0x1240d1},'order':_0x653e('0x84')})['then'](function(_0x233560){_0x2c4b24=_0x233560;});}})[_0x653e('0x5b')](function(_0x2aa0d2){_0x3fdd32=0x1f4;logger[_0x653e('0x27')](_0x2aa0d2[_0x653e('0x3f')]);if(_0x2aa0d2['name']){delete _0x2aa0d2[_0x653e('0x40')];}_0x2c4b24=_0x2aa0d2;})['finally'](function(){if(_0x2c4b24===null){_0x1fea0a[_0x653e('0x2c')](_0x3fdd32);}else{if(_0x3fdd32===0x1f4){_0x1fea0a['status'](_0x3fdd32)['send'](_0x2c4b24);}else{_0x1fea0a[_0x653e('0x2d')](_0x3fdd32)[_0x653e('0x2f')](_0x2c4b24);}}});};exports[_0x653e('0x85')]=function(_0x40d962,_0x5d3819,_0x183ec1){var _0x520ceb={};var _0x3ec302={};var _0x112dee;var _0x3a59aa;return db[_0x653e('0x44')][_0x653e('0x70')]({'where':{'id':_0x40d962[_0x653e('0x5d')]['id']}})[_0x653e('0x3a')](handleEntityNotFound(_0x5d3819,null))[_0x653e('0x3a')](function(_0x499b69){if(_0x499b69){_0x112dee=_0x499b69;_0x3ec302[_0x653e('0x48')]=_[_0x653e('0x4b')](db[_0x653e('0x83')]['rawAttributes']);_0x3ec302[_0x653e('0x4a')]=_[_0x653e('0x4b')](_0x40d962[_0x653e('0x4a')]);_0x3ec302[_0x653e('0x53')]=_[_0x653e('0x4c')](_0x3ec302[_0x653e('0x48')],_0x3ec302[_0x653e('0x4a')]);_0x520ceb[_0x653e('0x4e')]=_[_0x653e('0x4c')](_0x3ec302['model'],qs[_0x653e('0x4d')](_0x40d962[_0x653e('0x4a')]['fields']));_0x520ceb[_0x653e('0x4e')]=_0x520ceb[_0x653e('0x4e')][_0x653e('0x4f')]?_0x520ceb[_0x653e('0x4e')]:_0x3ec302['model'];_0x520ceb['order']=qs['sort'](_0x40d962['query'][_0x653e('0x51')]);_0x520ceb['where']=qs['filters'](_['pick'](_0x40d962[_0x653e('0x4a')],_0x3ec302[_0x653e('0x53')]));if(_0x40d962[_0x653e('0x4a')][_0x653e('0x55')]){_0x520ceb[_0x653e('0x52')]=_[_0x653e('0x56')](_0x520ceb[_0x653e('0x52')],{'$or':_['map'](_0x520ceb[_0x653e('0x4e')],function(_0x3a2f36){var _0x22cff2={};_0x22cff2[_0x3a2f36]={'$like':'%'+_0x40d962['query']['filter']+'%'};return _0x22cff2;})});}_0x520ceb=_[_0x653e('0x56')]({},_0x520ceb,_0x40d962[_0x653e('0x5e')]);return _0x112dee['getApplications'](_0x520ceb);}})[_0x653e('0x3a')](function(_0x87bf51){if(_0x87bf51){_0x3a59aa=_0x87bf51['length'];if(!_0x40d962[_0x653e('0x4a')][_0x653e('0x50')](_0x653e('0x6b'))){_0x520ceb['limit']=qs['limit'](_0x40d962[_0x653e('0x4a')][_0x653e('0x32')]);_0x520ceb['offset']=qs[_0x653e('0x30')](_0x40d962[_0x653e('0x4a')][_0x653e('0x30')]);}return _0x112dee[_0x653e('0x85')](_0x520ceb);}})[_0x653e('0x3a')](function(_0x575d20){if(_0x575d20){return _0x575d20?{'count':_0x3a59aa,'rows':_0x575d20}:null;}})['then'](respondWithResult(_0x5d3819,null))[_0x653e('0x5b')](handleError(_0x5d3819,null));};function Extension(_0x28cecc,_0x5c7290,_0x37302d,_0x3d8b63){this[_0x653e('0x86')]='from-voip-provider';this[_0x653e('0x87')]=_0x28cecc['localstationid'];this['app']=_0x3d8b63;this[_0x653e('0x46')]=_0x653e('0x88');this[_0x653e('0x89')]=_0x653e('0x8a');this[_0x653e('0x68')]=_0x28cecc['id'];this[_0x653e('0x84')]=_0x5c7290;this[_0x653e('0x8b')]=_0x37302d;}function createExtensionsReciveFax(_0x33d952){var _0x296f78=0x1;var _0x3da50a=[];_0x3da50a[_0x653e('0x8c')](new Extension(_0x33d952,_0x296f78,'',_0x653e('0x8d')));_0x296f78+=0x1;_0x3da50a['push'](new Extension(_0x33d952,_0x296f78,_0x653e('0x8e'),'Set'));_0x296f78+=0x1;for(var _0x85d7eb in _0x33d952){if(_0x33d952[_0x653e('0x50')](_0x85d7eb)&&(_0x85d7eb===_0x653e('0x8f')||_0x85d7eb===_0x653e('0x90')||_0x85d7eb===_0x653e('0x91')||_0x85d7eb===_0x653e('0x92')||_0x85d7eb===_0x653e('0x93')||_0x85d7eb===_0x653e('0x94')||_0x85d7eb===_0x653e('0x95')||_0x85d7eb==='modem'||_0x85d7eb===_0x653e('0x96'))){_0x3da50a[_0x653e('0x8c')](new Extension(_0x33d952,_0x296f78,_0x653e('0x97')+_0x85d7eb+')='+_0x33d952[_0x85d7eb],_0x653e('0x98')));_0x296f78+=0x1;}}_0x3da50a['push'](new Extension(_0x33d952,_0x296f78,'6',_0x653e('0x99')));_0x296f78+=0x1;_0x3da50a['push'](new Extension(_0x33d952,_0x296f78,_0x653e('0x9a'),_0x653e('0x9b')));_0x296f78=0x0;return _0x3da50a;}exports[_0x653e('0x9c')]=function(_0x3923d2,_0x380572,_0x35fda4){var _0x402dd8;return db[_0x653e('0x7f')][_0x653e('0x7e')](function(_0x5ce673){return db['FaxAccount']['create'](_0x3923d2[_0x653e('0x65')],{'transaction':_0x5ce673})[_0x653e('0x3a')](function(_0x49b29d){_0x402dd8=_0x49b29d[_0x653e('0x3c')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x402dd8),{'transaction':_0x5ce673});});})[_0x653e('0x3a')](function(){return _0x402dd8;})[_0x653e('0x3a')](respondWithResult(_0x380572,null))[_0x653e('0x5b')](handleError(_0x380572,null));};exports['updateAccountApplications']=function(_0x54d2ec,_0x5d9acb,_0x1dda47){var _0x3e52ca;return db['sequelize'][_0x653e('0x7e')](function(_0x116d48){return db[_0x653e('0x44')][_0x653e('0x39')](_0x54d2ec[_0x653e('0x65')],{'where':{'id':_0x54d2ec[_0x653e('0x65')]['id']},'transaction':_0x116d48})[_0x653e('0x3a')](function(_0x5be187){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x54d2ec[_0x653e('0x65')]['id']},'transaction':_0x116d48})[_0x653e('0x3a')](function(_0x4ce693){return db[_0x653e('0x9d')]['bulkCreate'](createExtensionsReciveFax(_[_0x653e('0x75')](_0x54d2ec['body'],[_0x653e('0x9e'),_0x653e('0x47'),_0x653e('0x9f'),_0x653e('0xa0'),'TrunkId',_0x653e('0xa1')])),{'transaction':_0x116d48});});});})[_0x653e('0x3a')](function(){return db[_0x653e('0x44')][_0x653e('0xa2')](_0x54d2ec[_0x653e('0x65')]['id']);})[_0x653e('0x3a')](respondWithResult(_0x5d9acb,null))[_0x653e('0x5b')](handleError(_0x5d9acb,null));};exports[_0x653e('0xa3')]=function(_0x29262b,_0x288be9,_0x101e8a){var _0x3dec49={'raw':!![],'where':{}};var _0x5d40c9={};var _0x52d1b5={'count':0x0,'rows':[]};return db[_0x653e('0x44')][_0x653e('0x70')]({'where':{'id':_0x29262b[_0x653e('0x5d')]['id']}})[_0x653e('0x3a')](handleEntityNotFound(_0x288be9,null))[_0x653e('0x3a')](function(_0x1c2e2b){if(_0x1c2e2b){_0x5d40c9[_0x653e('0x48')]=_[_0x653e('0x4b')](db[_0x653e('0xa4')][_0x653e('0x6a')]);_0x5d40c9['query']=_['keys'](_0x29262b[_0x653e('0x4a')]);_0x5d40c9[_0x653e('0x53')]=_[_0x653e('0x4c')](_0x5d40c9[_0x653e('0x48')],_0x5d40c9[_0x653e('0x4a')]);_0x3dec49[_0x653e('0x4e')]=_[_0x653e('0x4c')](_0x5d40c9[_0x653e('0x48')],qs[_0x653e('0x4d')](_0x29262b['query'][_0x653e('0x4d')]));_0x3dec49[_0x653e('0x4e')]=_0x3dec49[_0x653e('0x4e')][_0x653e('0x4f')]?_0x3dec49['attributes']:_0x5d40c9[_0x653e('0x48')];if(!_0x29262b[_0x653e('0x4a')]['hasOwnProperty']('nolimit')){_0x3dec49[_0x653e('0x32')]=qs[_0x653e('0x32')](_0x29262b['query'][_0x653e('0x32')]);_0x3dec49['offset']=qs[_0x653e('0x30')](_0x29262b[_0x653e('0x4a')][_0x653e('0x30')]);}_0x3dec49['order']=qs[_0x653e('0x51')](_0x29262b['query'][_0x653e('0x51')]);_0x3dec49[_0x653e('0x52')]=qs[_0x653e('0x53')](_['pick'](_0x29262b[_0x653e('0x4a')],_0x5d40c9[_0x653e('0x53')]));_0x3dec49['where'][_0x653e('0x68')]=_0x1c2e2b['id'];if(_0x29262b[_0x653e('0x4a')]['filter']){_0x3dec49[_0x653e('0x52')]=_[_0x653e('0x56')](_0x3dec49[_0x653e('0x52')],{'$or':_[_0x653e('0x49')](_0x3dec49['attributes'],function(_0x3ba40c){var _0x22ad09={};_0x22ad09[_0x3ba40c]={'$like':'%'+_0x29262b[_0x653e('0x4a')]['filter']+'%'};return _0x22ad09;})});}if(_0x29262b[_0x653e('0x4a')][_0x653e('0xa5')]){var _0x412cd8=_0x29262b[_0x653e('0x4a')]['$gte']['split'](',');var _0xe666d={};_0xe666d[_0x412cd8[0x0]]={'$gte':moment(_0x412cd8[0x1])[_0x653e('0xa6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3dec49['where']=_['merge'](_0x3dec49[_0x653e('0x52')],_0xe666d);}_0x3dec49=_[_0x653e('0x56')]({},_0x3dec49,_0x29262b[_0x653e('0x5e')]);return db[_0x653e('0xa4')][_0x653e('0x33')]({'where':_0x3dec49[_0x653e('0x52')]})[_0x653e('0x3a')](function(_0x25e4d6){_0x52d1b5[_0x653e('0x33')]=_0x25e4d6;if(_0x29262b['query']['includeAll']){_0x3dec49[_0x653e('0x58')]=[{'all':!![]}];}return db[_0x653e('0xa4')][_0x653e('0x59')](_0x3dec49);})['then'](function(_0x4c8f02){_0x52d1b5['rows']=_0x4c8f02;return _0x52d1b5;});}})[_0x653e('0x3a')](respondWithFilteredResult(_0x288be9,_0x3dec49))['catch'](handleError(_0x288be9,null));};exports['send']=function(_0x5d8cf5,_0x4aa6ed,_0x48f68b){var _0x4ba78a,_0x337416={},_0x49f2fb;if(_0x5d8cf5['body']['to']){_0x49f2fb=_0x5d8cf5['body']['to'][0x0];}return db[_0x653e('0x44')][_0x653e('0x5f')]({'where':{'id':_0x5d8cf5[_0x653e('0x5d')]['id']},'include':[{'model':db[_0x653e('0xa7')],'as':_0x653e('0xa8'),'include':[{'model':db[_0x653e('0x77')],'as':_0x653e('0xa9'),'where':{'fax':_0x49f2fb},'limit':0x1,'order':[[_0x653e('0xa0'),_0x653e('0xaa')]]}]}]})[_0x653e('0x3a')](handleEntityNotFound(_0x4aa6ed,null))[_0x653e('0x3a')](function(_0x50d519){_0x4ba78a=_0x50d519;if(_0x5d8cf5['body'][_0x653e('0xab')]&&_0x5d8cf5[_0x653e('0x65')]['attachments']['length']){for(var _0x476c9c=0x0;_0x476c9c<_0x5d8cf5[_0x653e('0x65')][_0x653e('0xab')][_0x653e('0x4f')];_0x476c9c+=0x1){_0x5d8cf5[_0x653e('0x65')][_0x653e('0xab')][_0x476c9c]={'filename':_0x5d8cf5[_0x653e('0x65')][_0x653e('0xab')][_0x476c9c]['name'],'id':_0x5d8cf5['body']['attachments'][_0x476c9c]['id'],'path':path[_0x653e('0xac')](config[_0x653e('0xad')],_0x653e('0xae'),_0x5d8cf5['body'][_0x653e('0xab')][_0x476c9c]['basename'])};}}return respondWithRpcPromise(_0x653e('0xaf'),_0x653e('0xaf'),{'FaxAccountId':_[_0x653e('0xb0')](_0x5d8cf5[_0x653e('0x5d')]['id'])?undefined:_0x5d8cf5[_0x653e('0x5d')]['id'],'path':_[_0x653e('0xb0')](_0x5d8cf5[_0x653e('0x65')]['attachments'][0x0]['path'])?undefined:_0x5d8cf5[_0x653e('0x65')][_0x653e('0xab')][0x0][_0x653e('0x8')],'fax':_[_0x653e('0xb0')](_0x5d8cf5[_0x653e('0x65')]['to'][0x0])?undefined:_0x5d8cf5['body']['to'][0x0]},client9002);})['then'](function(){if(_0x4ba78a){if(_['isNil'](_0x5d8cf5[_0x653e('0x65')][_0x653e('0xb1')])){_0x5d8cf5[_0x653e('0x65')][_0x653e('0xb1')]=util[_0x653e('0xa6')]('\x22%s\x22\x20<%s>',_0x4ba78a[_0x653e('0x40')],_0x4ba78a[_0x653e('0xb2')]);}if(_0x4ba78a[_0x653e('0xa8')]){if(_0x4ba78a['List'][_0x653e('0xa9')]['length']){return _0x4ba78a['List'][_0x653e('0xa9')][0x0];}else{return db[_0x653e('0x77')][_0x653e('0x6f')](_[_0x653e('0x1b')](_0x5d8cf5[_0x653e('0x65')],{'firstName':_0x5d8cf5[_0x653e('0x65')]['to'][0x0],'phone':_0x5d8cf5[_0x653e('0x65')]['to'][0x0],'fax':_0x5d8cf5[_0x653e('0x65')]['to'][0x0],'ListId':_0x4ba78a[_0x653e('0xa1')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x653e('0xb3'));}})[_0x653e('0x3a')](function(_0x1d423a){if(_0x1d423a){return db['FaxInteraction']['find']({'where':{'ContactId':_0x1d423a['id'],'closed':![],'FaxAccountId':_0x4ba78a['id']}})[_0x653e('0x3a')](function(_0x8c94d){if(_0x8c94d){return[_0x8c94d,![]];}return db[_0x653e('0x74')]['create']({'UserId':_0x5d8cf5[_0x653e('0x60')]['id'],'ContactId':_0x1d423a['id'],'FaxAccountId':_0x4ba78a['id'],'fax':_0x5d8cf5[_0x653e('0x65')]['to'][0x0],'firstMsgDirection':_0x653e('0xb4'),'Messages':[_[_0x653e('0x56')](_0x5d8cf5['body'],{'read':![],'body':_0x5d8cf5[_0x653e('0x65')][_0x653e('0xab')][0x0]['filename'],'FaxAccountId':_0x4ba78a['id'],'UserId':_0x5d8cf5['user']['id'],'ContactId':_0x1d423a['id'],'AttachmentId':_0x5d8cf5[_0x653e('0x65')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x653e('0xa4')],'as':_0x653e('0xb5')}]})['then'](function(_0x32e192){return[_0x32e192,!![]];});});}else{throw new Error(_0x653e('0xb6'));}})[_0x653e('0xb7')](function(_0xf78ceb,_0xf9817d){if(_0xf9817d){return _0xf78ceb;}return db[_0x653e('0xa4')]['create']({'direction':_0x653e('0xb4'),'read':![],'body':_0x5d8cf5[_0x653e('0x65')][_0x653e('0xab')][0x0][_0x653e('0xb8')],'FaxAccountId':_0x4ba78a['id'],'FaxInteractionId':_0xf78ceb['id'],'UserId':_0x5d8cf5[_0x653e('0x60')]['id'],'ContactId':_0xf78ceb[_0x653e('0xb9')],'AttachmentId':_0x5d8cf5[_0x653e('0x65')][_0x653e('0xab')][0x0]['id']})[_0x653e('0x3a')](function(_0x1c63bf){_0xf78ceb[_0x653e('0xba')][_0x653e('0xb5')]=[];_0xf78ceb[_0x653e('0xba')][_0x653e('0xb5')]['push'](_0x1c63bf['dataValues']);return _0xf78ceb;});})[_0x653e('0x3a')](function(_0x13235a){respondWithRpcPromise(_0x653e('0xbb'),_0x653e('0xbb'),{'FaxAccountId':_[_0x653e('0xb0')](_0x5d8cf5[_0x653e('0x5d')]['id'])?undefined:_0x5d8cf5[_0x653e('0x5d')]['id'],'path':_[_0x653e('0xb0')](_0x5d8cf5[_0x653e('0x65')][_0x653e('0xab')][0x0][_0x653e('0x8')])?undefined:_0x5d8cf5[_0x653e('0x65')][_0x653e('0xab')][0x0]['path'],'fax':_['isNil'](_0x5d8cf5[_0x653e('0x65')]['to'][0x0])?undefined:_0x5d8cf5[_0x653e('0x65')]['to'][0x0],'AttachmentId':_0x5d8cf5[_0x653e('0x65')][_0x653e('0xab')][0x0]['id']},client9002)['then'](function(_0x389085){logger[_0x653e('0x2a')](_0x653e('0xbc'),_0x389085);})[_0x653e('0x5b')](function(_0x6f7ff7){logger[_0x653e('0x2a')](_0x653e('0xbc'),_0x6f7ff7);});return _0x13235a;})['then'](respondWithResult(_0x4aa6ed,null))[_0x653e('0x5b')](handleError(_0x4aa6ed,null));};exports[_0x653e('0xbd')]=function(_0x46ad7e,_0x48cba8,_0xbf467a){return db[_0x653e('0x44')][_0x653e('0x5f')]({'where':{'id':_0x46ad7e['params']['id']}})['then'](handleEntityNotFound(_0x48cba8,null))[_0x653e('0x3a')](function(_0x25a2ae){if(_0x25a2ae){return _0x25a2ae[_0x653e('0xbd')](_0x46ad7e[_0x653e('0x65')][_0x653e('0x6d')],_[_0x653e('0x75')](_0x46ad7e['body'],[_0x653e('0x6d'),'id'])||{})[_0x653e('0xb7')](function(_0x3373cd){for(var _0x343123=0x0;_0x343123<_0x46ad7e[_0x653e('0x65')][_0x653e('0x6d')][_0x653e('0x4f')];_0x343123+=0x1){socket[_0x653e('0xbe')]('userFaxAccount:save',{'UserId':Number(_0x46ad7e[_0x653e('0x65')][_0x653e('0x6d')][_0x343123]),'FaxAccountId':Number(_0x46ad7e['params']['id'])});}return _0x3373cd;});}})[_0x653e('0x3a')](respondWithResult(_0x48cba8,null))['catch'](handleError(_0x48cba8,null));};exports['removeAgents']=function(_0x2bc4d8,_0x38ce6d,_0x5d4d17){return db[_0x653e('0x44')][_0x653e('0x5f')]({'where':{'id':_0x2bc4d8[_0x653e('0x5d')]['id']}})[_0x653e('0x3a')](handleEntityNotFound(_0x38ce6d,null))[_0x653e('0x3a')](function(_0x19486c){if(_0x19486c){return _0x19486c['removeAgents'](_0x2bc4d8['query']['ids'])[_0x653e('0x3a')](function(){if(_[_0x653e('0xbf')](_0x2bc4d8[_0x653e('0x4a')][_0x653e('0x6d')])){for(var _0x22d6f0=0x0;_0x22d6f0<_0x2bc4d8[_0x653e('0x4a')][_0x653e('0x6d')][_0x653e('0x4f')];_0x22d6f0+=0x1){socket[_0x653e('0xbe')](_0x653e('0xc0'),{'UserId':Number(_0x2bc4d8[_0x653e('0x4a')][_0x653e('0x6d')][_0x22d6f0]),'FaxAccountId':Number(_0x2bc4d8[_0x653e('0x5d')]['id'])});}}else{socket[_0x653e('0xbe')](_0x653e('0xc0'),{'UserId':Number(_0x2bc4d8[_0x653e('0x4a')]['ids']),'FaxAccountId':Number(_0x2bc4d8[_0x653e('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x38ce6d,null))[_0x653e('0x5b')](handleError(_0x38ce6d,null));};exports[_0x653e('0xc1')]=function(_0xa0b734,_0x54b280,_0x41b465){var _0x46e4d3={};var _0x14ef17={};var _0x6e6302;var _0x3e9550;return db[_0x653e('0x44')][_0x653e('0x70')]({'where':{'id':_0xa0b734[_0x653e('0x5d')]['id']}})[_0x653e('0x3a')](handleEntityNotFound(_0x54b280,null))[_0x653e('0x3a')](function(_0x1a1b71){if(_0x1a1b71){_0x6e6302=_0x1a1b71;_0x14ef17[_0x653e('0x48')]=_[_0x653e('0x4b')](db[_0x653e('0x79')]['rawAttributes']);_0x14ef17['query']=_['keys'](_0xa0b734['query']);_0x14ef17['filters']=_[_0x653e('0x4c')](_0x14ef17[_0x653e('0x48')],_0x14ef17[_0x653e('0x4a')]);_0x46e4d3[_0x653e('0x4e')]=_[_0x653e('0x4c')](_0x14ef17[_0x653e('0x48')],qs['fields'](_0xa0b734['query'][_0x653e('0x4d')]));_0x46e4d3[_0x653e('0x4e')]=_0x46e4d3['attributes'][_0x653e('0x4f')]?_0x46e4d3['attributes']:_0x14ef17['model'];_0x46e4d3[_0x653e('0x71')]=qs['sort'](_0xa0b734[_0x653e('0x4a')][_0x653e('0x51')]);_0x46e4d3[_0x653e('0x52')]=qs[_0x653e('0x53')](_[_0x653e('0x54')](_0xa0b734['query'],_0x14ef17[_0x653e('0x53')]));if(_0xa0b734[_0x653e('0x4a')][_0x653e('0x55')]){_0x46e4d3['where']=_[_0x653e('0x56')](_0x46e4d3[_0x653e('0x52')],{'$or':_['map'](_0x46e4d3[_0x653e('0x4e')],function(_0x539169){var _0x39d15d={};_0x39d15d[_0x539169]={'$like':'%'+_0xa0b734[_0x653e('0x4a')][_0x653e('0x55')]+'%'};return _0x39d15d;})});}_0x46e4d3=_['merge']({},_0x46e4d3,_0xa0b734['options']);return _0x6e6302[_0x653e('0xc1')](_0x46e4d3);}})['then'](function(_0x5b8af4){if(_0x5b8af4){_0x3e9550=_0x5b8af4[_0x653e('0x4f')];if(!_0xa0b734[_0x653e('0x4a')]['hasOwnProperty'](_0x653e('0x6b'))){_0x46e4d3[_0x653e('0x32')]=qs['limit'](_0xa0b734[_0x653e('0x4a')]['limit']);_0x46e4d3['offset']=qs['offset'](_0xa0b734[_0x653e('0x4a')][_0x653e('0x30')]);}return _0x6e6302[_0x653e('0xc1')](_0x46e4d3);}})[_0x653e('0x3a')](function(_0x2d3405){if(_0x2d3405){return _0x2d3405?{'count':_0x3e9550,'rows':_0x2d3405}:null;}})[_0x653e('0x3a')](respondWithResult(_0x54b280,null))[_0x653e('0x5b')](handleError(_0x54b280,null));}; \ No newline at end of file +var _0x016b=['apply','reject','update','destroy','get','FaxAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','sort','removeDispositions','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','ids','getInteractions','CmContact','Contact','Owner','internal','Tag','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','context','exten','app','system','description','Fax\x20Extension','appdata','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','maxrate','minrate','modem','push','FAXOPT(','Wait','ReceiveFax','addAccountApplications','updateAccountApplications','transaction','VoiceExtension','omit','tech','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','split','format','CmList','List','Contacts','DESC','attachments','join','root','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x44268a,_0x335e30){var _0x1bd0ed=function(_0x377258){while(--_0x377258){_0x44268a['push'](_0x44268a['shift']());}};_0x1bd0ed(++_0x335e30);}(_0x016b,0x91));var _0xb016=function(_0x4ac9ff,_0x3ddb39){_0x4ac9ff=_0x4ac9ff-0x0;var _0x236dde=_0x016b[_0x4ac9ff];return _0x236dde;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb016('0x0'));var zipdir=require(_0xb016('0x1'));var jsonpatch=require(_0xb016('0x2'));var rp=require(_0xb016('0x3'));var moment=require(_0xb016('0x4'));var BPromise=require(_0xb016('0x5'));var Mustache=require(_0xb016('0x6'));var util=require(_0xb016('0x7'));var path=require(_0xb016('0x8'));var sox=require(_0xb016('0x9'));var csv=require(_0xb016('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb016('0xb'));var _=require(_0xb016('0xc'));var squel=require(_0xb016('0xd'));var crypto=require(_0xb016('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb016('0xf'));var toCsv=require(_0xb016('0xa'));var querystring=require('querystring');var Papa=require(_0xb016('0x10'));var Redis=require(_0xb016('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb016('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb016('0x13'));var config=require(_0xb016('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb016('0x15'))['db'];config[_0xb016('0x16')]=_[_0xb016('0x17')](config[_0xb016('0x16')],{'host':_0xb016('0x18'),'port':0x18eb});var socket=require(_0xb016('0x19'))(new Redis(config[_0xb016('0x16')]));require(_0xb016('0x1a'))[_0xb016('0x1b')](socket);var jayson=require(_0xb016('0x1c'));var client=jayson[_0xb016('0x1d')][_0xb016('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xb016('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xb271fc,_0x225257,_0x69a044,_0x575ef8){return new BPromise(function(_0x47a393,_0x59f15b){var _0x4d4603=_0x575ef8||client;return _0x4d4603['request'](_0xb271fc,_0x69a044)[_0xb016('0x1f')](function(_0x506100){logger[_0xb016('0x20')](_0xb016('0x21'),_0x225257,_0xb016('0x22'));logger['debug'](_0xb016('0x23'),_0x225257,_0xb016('0x22'),JSON[_0xb016('0x24')](_0x506100));if(_0x506100[_0xb016('0x25')]){if(_0x506100['error'][_0xb016('0x26')]===0x1f4){logger['error'](_0xb016('0x21'),_0x225257,_0x506100[_0xb016('0x25')][_0xb016('0x27')]);return _0x59f15b(_0x506100[_0xb016('0x25')][_0xb016('0x27')]);}logger[_0xb016('0x25')](_0xb016('0x21'),_0x225257,_0x506100[_0xb016('0x25')]['message']);return _0x47a393(_0x506100[_0xb016('0x25')][_0xb016('0x27')]);}else{logger[_0xb016('0x20')](_0xb016('0x21'),_0x225257,'request\x20sent');_0x47a393(_0x506100['result'][_0xb016('0x27')]);}})[_0xb016('0x28')](function(_0x5643bf){logger[_0xb016('0x25')]('FaxAccount,\x20%s,\x20%s',_0x225257,_0x5643bf);_0x59f15b(_0x5643bf);});});}function respondWithStatusCode(_0x1e4629,_0xba89fe){_0xba89fe=_0xba89fe||0xcc;return function(_0x121bd7){if(_0x121bd7){return _0x1e4629[_0xb016('0x29')](_0xba89fe);}return _0x1e4629[_0xb016('0x2a')](_0xba89fe)[_0xb016('0x2b')]();};}function respondWithResult(_0x350620,_0x544ed8){_0x544ed8=_0x544ed8||0xc8;return function(_0x500627){if(_0x500627){return _0x350620[_0xb016('0x2a')](_0x544ed8)[_0xb016('0x2c')](_0x500627);}};}function respondWithFilteredResult(_0x12f612,_0x747aca){return function(_0x46de79){if(_0x46de79){var _0x3a21af=typeof _0x747aca[_0xb016('0x2d')]===_0xb016('0x2e')&&typeof _0x747aca[_0xb016('0x2f')]===_0xb016('0x2e');var _0x95db52=_0x46de79[_0xb016('0x30')];var _0x3738ce=_0x3a21af?0x0:_0x747aca['offset'];var _0x335db1=_0x3a21af?_0x46de79[_0xb016('0x30')]:_0x747aca[_0xb016('0x2d')]+_0x747aca['limit'];var _0x280c93;if(_0x335db1>=_0x95db52){_0x335db1=_0x95db52;_0x280c93=0xc8;}else{_0x280c93=0xce;}_0x12f612[_0xb016('0x2a')](_0x280c93);return _0x12f612[_0xb016('0x31')](_0xb016('0x32'),_0x3738ce+'-'+_0x335db1+'/'+_0x95db52)[_0xb016('0x2c')](_0x46de79);}return null;};}function patchUpdates(_0x4b64f2){return function(_0x2b852e){try{jsonpatch[_0xb016('0x33')](_0x2b852e,_0x4b64f2,!![]);}catch(_0x3b6024){return BPromise[_0xb016('0x34')](_0x3b6024);}return _0x2b852e['save']();};}function saveUpdates(_0x577c48,_0x4d8ff9){return function(_0x45babe){if(_0x45babe){return _0x45babe[_0xb016('0x35')](_0x577c48)[_0xb016('0x1f')](function(_0x27b68a){return _0x27b68a;});}return null;};}function removeEntity(_0x5caac1,_0x2613ec){return function(_0x13a946){if(_0x13a946){return _0x13a946[_0xb016('0x36')]()[_0xb016('0x1f')](function(){var _0x530bc8=_0x13a946[_0xb016('0x37')]({'plain':!![]});var _0x3916d0=_0xb016('0x38');return db[_0xb016('0x39')][_0xb016('0x36')]({'where':{'type':_0x3916d0,'resourceId':_0x530bc8['id']}})[_0xb016('0x1f')](function(){return _0x13a946;});})['then'](function(){_0x5caac1['status'](0xcc)[_0xb016('0x2b')]();});}};}function handleEntityNotFound(_0x166bdd,_0x453e18){return function(_0x511dd7){if(!_0x511dd7){_0x166bdd[_0xb016('0x29')](0x194);}return _0x511dd7;};}function handleError(_0xf7e024,_0x2dcc98){_0x2dcc98=_0x2dcc98||0x1f4;return function(_0x250140){logger[_0xb016('0x25')](_0x250140['stack']);if(_0x250140[_0xb016('0x3a')]){delete _0x250140[_0xb016('0x3a')];}_0xf7e024[_0xb016('0x2a')](_0x2dcc98)[_0xb016('0x3b')](_0x250140);};}exports[_0xb016('0x3c')]=function(_0x348243,_0x3a1299){var _0x27bd50={'include':[{'model':db[_0xb016('0x3d')],'as':_0xb016('0x3e')}]},_0x22ce71={},_0x2181ac={'count':0x0,'rows':[]};var _0x4941d7=_['map'](db[_0xb016('0x3f')][_0xb016('0x40')],function(_0x4a8450){return{'name':_0x4a8450['fieldName'],'type':_0x4a8450[_0xb016('0x41')][_0xb016('0x42')]};});_0x22ce71[_0xb016('0x43')]=_[_0xb016('0x44')](_0x4941d7,_0xb016('0x3a'));_0x22ce71[_0xb016('0x45')]=_[_0xb016('0x46')](_0x348243[_0xb016('0x45')]);_0x22ce71[_0xb016('0x47')]=_[_0xb016('0x48')](_0x22ce71[_0xb016('0x43')],_0x22ce71['query']);_0x27bd50[_0xb016('0x49')]=_[_0xb016('0x48')](_0x22ce71[_0xb016('0x43')],qs[_0xb016('0x4a')](_0x348243[_0xb016('0x45')]['fields']));_0x27bd50['attributes']=_0x27bd50[_0xb016('0x49')][_0xb016('0x4b')]?_0x27bd50['attributes']:_0x22ce71[_0xb016('0x43')];if(!_0x348243[_0xb016('0x45')]['hasOwnProperty'](_0xb016('0x4c'))){_0x27bd50[_0xb016('0x2f')]=qs[_0xb016('0x2f')](_0x348243['query'][_0xb016('0x2f')]);_0x27bd50[_0xb016('0x2d')]=qs[_0xb016('0x2d')](_0x348243[_0xb016('0x45')]['offset']);}_0x27bd50[_0xb016('0x4d')]=qs['sort'](_0x348243['query']['sort']);_0x27bd50['where']=qs['filters'](_[_0xb016('0x4e')](_0x348243[_0xb016('0x45')],_0x22ce71['filters']),_0x4941d7);if(_0x348243[_0xb016('0x45')][_0xb016('0x4f')]){_0x27bd50[_0xb016('0x50')]=_[_0xb016('0x51')](_0x27bd50[_0xb016('0x50')],{'$or':_[_0xb016('0x44')](_0x4941d7,function(_0x562e16){if(_0x562e16[_0xb016('0x41')]!==_0xb016('0x52')){var _0x57e40a={};_0x57e40a[_0x562e16[_0xb016('0x3a')]]={'$like':'%'+_0x348243[_0xb016('0x45')]['filter']+'%'};return _0x57e40a;}})});}_0x27bd50=_[_0xb016('0x51')]({},_0x27bd50,_0x348243['options']);var _0x5b9f10={'where':_0x27bd50['where']};return db[_0xb016('0x3f')]['count'](_0x5b9f10)['then'](function(_0x5f475c){_0x2181ac[_0xb016('0x30')]=_0x5f475c;if(_0x348243['query'][_0xb016('0x53')]){_0x27bd50[_0xb016('0x54')]=[{'all':!![]}];}return db['FaxAccount'][_0xb016('0x55')](_0x27bd50);})[_0xb016('0x1f')](function(_0x39673a){_0x2181ac[_0xb016('0x56')]=_0x39673a;return _0x2181ac;})[_0xb016('0x1f')](respondWithFilteredResult(_0x3a1299,_0x27bd50))[_0xb016('0x28')](handleError(_0x3a1299,null));};exports['show']=function(_0x5bed12,_0x427174){var _0x163785={'raw':![],'where':{'id':_0x5bed12[_0xb016('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xb016('0x3e')}]},_0x57de1b={};_0x57de1b[_0xb016('0x43')]=_['keys'](db[_0xb016('0x3f')][_0xb016('0x40')]);_0x57de1b[_0xb016('0x45')]=_[_0xb016('0x46')](_0x5bed12[_0xb016('0x45')]);_0x57de1b[_0xb016('0x47')]=_[_0xb016('0x48')](_0x57de1b['model'],_0x57de1b[_0xb016('0x45')]);_0x163785[_0xb016('0x49')]=_[_0xb016('0x48')](_0x57de1b[_0xb016('0x43')],qs['fields'](_0x5bed12[_0xb016('0x45')]['fields']));_0x163785[_0xb016('0x49')]=_0x163785[_0xb016('0x49')][_0xb016('0x4b')]?_0x163785[_0xb016('0x49')]:_0x57de1b[_0xb016('0x43')];if(_0x5bed12[_0xb016('0x45')][_0xb016('0x53')]){_0x163785['include']=[{'all':!![]}];}_0x163785=_[_0xb016('0x51')]({},_0x163785,_0x5bed12[_0xb016('0x58')]);return db[_0xb016('0x3f')][_0xb016('0x59')](_0x163785)['then'](handleEntityNotFound(_0x427174,null))[_0xb016('0x1f')](respondWithResult(_0x427174,null))[_0xb016('0x28')](handleError(_0x427174,null));};exports[_0xb016('0x5a')]=function(_0x5d3a8b,_0x3a08a8){return db['FaxAccount'][_0xb016('0x5a')](_0x5d3a8b[_0xb016('0x5b')],{})[_0xb016('0x1f')](function(_0x3e99e4){var _0x2c6056=_0x5d3a8b[_0xb016('0x5c')][_0xb016('0x37')]({'plain':!![]});if(!_0x2c6056)throw new Error(_0xb016('0x5d'));if(_0x2c6056[_0xb016('0x5e')]===_0xb016('0x5c')){var _0x5acc5c=_0x3e99e4['get']({'plain':!![]});var _0x4b2e37=_0xb016('0x38');return db['UserProfileSection'][_0xb016('0x59')]({'where':{'name':_0x4b2e37,'userProfileId':_0x2c6056['userProfileId']},'raw':!![]})['then'](function(_0x1ded98){if(_0x1ded98&&_0x1ded98[_0xb016('0x5f')]===0x0){return db[_0xb016('0x39')][_0xb016('0x5a')]({'name':_0x5acc5c['name'],'resourceId':_0x5acc5c['id'],'type':_0x1ded98[_0xb016('0x3a')],'sectionId':_0x1ded98['id']},{})[_0xb016('0x1f')](function(){return _0x3e99e4;});}else{return _0x3e99e4;}})[_0xb016('0x28')](function(_0x37d231){logger[_0xb016('0x25')](_0xb016('0x60'),_0x37d231);throw _0x37d231;});}return _0x3e99e4;})['then'](respondWithResult(_0x3a08a8,0xc9))['catch'](handleError(_0x3a08a8,null));};exports['update']=function(_0x31e8ee,_0x2a50f4){if(_0x31e8ee[_0xb016('0x5b')]['id']){delete _0x31e8ee[_0xb016('0x5b')]['id'];}return db[_0xb016('0x3f')][_0xb016('0x59')]({'where':{'id':_0x31e8ee[_0xb016('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xb016('0x3e')}]})[_0xb016('0x1f')](handleEntityNotFound(_0x2a50f4,null))['then'](saveUpdates(_0x31e8ee[_0xb016('0x5b')],null))[_0xb016('0x1f')](respondWithResult(_0x2a50f4,null))[_0xb016('0x28')](handleError(_0x2a50f4,null));};exports[_0xb016('0x36')]=function(_0x4484e3,_0x53b38c){return db[_0xb016('0x3f')][_0xb016('0x59')]({'where':{'id':_0x4484e3[_0xb016('0x57')]['id']}})['then'](handleEntityNotFound(_0x53b38c,null))[_0xb016('0x1f')](removeEntity(_0x53b38c,null))[_0xb016('0x28')](handleError(_0x53b38c,null));};exports[_0xb016('0x61')]=function(_0x445060,_0x166c51){return db[_0xb016('0x3f')][_0xb016('0x61')]()[_0xb016('0x1f')](respondWithResult(_0x166c51,null))[_0xb016('0x28')](handleError(_0x166c51,null));};exports[_0xb016('0x62')]=function(_0x1c4ef2,_0x242da9,_0x404b53){if(_0x1c4ef2[_0xb016('0x5b')]['id']){delete _0x1c4ef2[_0xb016('0x5b')]['id'];}return db[_0xb016('0x3f')][_0xb016('0x59')]({'where':{'id':_0x1c4ef2[_0xb016('0x57')]['id']}})['then'](handleEntityNotFound(_0x242da9,null))['then'](function(_0x28bdc8){if(_0x28bdc8){_0x1c4ef2[_0xb016('0x5b')][_0xb016('0x63')]=_0x28bdc8['id'];return db[_0xb016('0x64')][_0xb016('0x5a')](_0x1c4ef2['body']);}})[_0xb016('0x1f')](respondWithResult(_0x242da9,null))['catch'](handleError(_0x242da9,null));};exports[_0xb016('0x65')]=function(_0x398806,_0x41b29d,_0x22e489){var _0x5d4cb2={'raw':![],'where':{}};var _0x1c8c10={};var _0x5b196d={'count':0x0,'rows':[]};return db['FaxAccount'][_0xb016('0x66')]({'where':{'id':_0x398806[_0xb016('0x57')]['id']}})[_0xb016('0x1f')](handleEntityNotFound(_0x41b29d,null))['then'](function(_0x41f973){if(_0x41f973){_0x1c8c10[_0xb016('0x43')]=_[_0xb016('0x46')](db['Disposition'][_0xb016('0x40')]);_0x1c8c10['query']=_[_0xb016('0x46')](_0x398806[_0xb016('0x45')]);_0x1c8c10['filters']=_['intersection'](_0x1c8c10[_0xb016('0x43')],_0x1c8c10[_0xb016('0x45')]);_0x5d4cb2[_0xb016('0x49')]=_['intersection'](_0x1c8c10[_0xb016('0x43')],qs[_0xb016('0x4a')](_0x398806[_0xb016('0x45')]['fields']));_0x5d4cb2[_0xb016('0x49')]=_0x5d4cb2['attributes'][_0xb016('0x4b')]?_0x5d4cb2[_0xb016('0x49')]:_0x1c8c10[_0xb016('0x43')];if(!_0x398806['query'][_0xb016('0x67')](_0xb016('0x4c'))){_0x5d4cb2[_0xb016('0x2f')]=qs[_0xb016('0x2f')](_0x398806[_0xb016('0x45')]['limit']);_0x5d4cb2[_0xb016('0x2d')]=qs[_0xb016('0x2d')](_0x398806[_0xb016('0x45')]['offset']);}_0x5d4cb2[_0xb016('0x4d')]=qs[_0xb016('0x68')](_0x398806[_0xb016('0x45')][_0xb016('0x68')]);_0x5d4cb2[_0xb016('0x50')]=qs[_0xb016('0x47')](_[_0xb016('0x4e')](_0x398806[_0xb016('0x45')],_0x1c8c10[_0xb016('0x47')]));_0x5d4cb2[_0xb016('0x50')][_0xb016('0x63')]=_0x41f973['id'];if(_0x398806[_0xb016('0x45')]['filter']){_0x5d4cb2[_0xb016('0x50')]=_['merge'](_0x5d4cb2[_0xb016('0x50')],{'$or':_[_0xb016('0x44')](_0x5d4cb2[_0xb016('0x49')],function(_0x23b819){var _0x259ee0={};_0x259ee0[_0x23b819]={'$like':'%'+_0x398806[_0xb016('0x45')][_0xb016('0x4f')]+'%'};return _0x259ee0;})});}_0x5d4cb2=_[_0xb016('0x51')]({},_0x5d4cb2,_0x398806['options']);return db[_0xb016('0x64')][_0xb016('0x30')]({'where':_0x5d4cb2[_0xb016('0x50')]})[_0xb016('0x1f')](function(_0x46fe51){_0x5b196d[_0xb016('0x30')]=_0x46fe51;if(_0x398806[_0xb016('0x45')][_0xb016('0x53')]){_0x5d4cb2[_0xb016('0x54')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x5d4cb2);})[_0xb016('0x1f')](function(_0x5aceae){_0x5b196d[_0xb016('0x56')]=_0x5aceae;return _0x5b196d;});}})[_0xb016('0x1f')](respondWithFilteredResult(_0x41b29d,_0x5d4cb2))[_0xb016('0x28')](handleError(_0x41b29d,null));};exports[_0xb016('0x69')]=function(_0x5184ba,_0x311b37,_0x1b9faf){return db[_0xb016('0x3f')][_0xb016('0x59')]({'where':{'id':_0x5184ba[_0xb016('0x57')]['id']}})[_0xb016('0x1f')](handleEntityNotFound(_0x311b37,null))[_0xb016('0x1f')](function(_0x4f020c){if(_0x4f020c){return _0x4f020c[_0xb016('0x69')](_0x5184ba['query']['ids']);}})[_0xb016('0x1f')](respondWithStatusCode(_0x311b37,null))[_0xb016('0x28')](handleError(_0x311b37,null));};exports['addAnswer']=function(_0x538a6f,_0x6e982b,_0x204c70){if(_0x538a6f['body']['id']){delete _0x538a6f[_0xb016('0x5b')]['id'];}return db[_0xb016('0x3f')][_0xb016('0x59')]({'where':{'id':_0x538a6f[_0xb016('0x57')]['id']}})[_0xb016('0x1f')](handleEntityNotFound(_0x6e982b,null))[_0xb016('0x1f')](function(_0x5669ab){if(_0x5669ab){_0x538a6f[_0xb016('0x5b')][_0xb016('0x63')]=_0x5669ab['id'];return db[_0xb016('0x6a')][_0xb016('0x5a')](_0x538a6f['body']);}})[_0xb016('0x1f')](respondWithResult(_0x6e982b,null))[_0xb016('0x28')](handleError(_0x6e982b,null));};exports['getAnswers']=function(_0x2c331a,_0x20dd37,_0x52649e){var _0x267eb1={'raw':![],'where':{}};var _0x14ab72={};var _0x42eaa6={'count':0x0,'rows':[]};return db[_0xb016('0x3f')][_0xb016('0x66')]({'where':{'id':_0x2c331a[_0xb016('0x57')]['id']}})[_0xb016('0x1f')](handleEntityNotFound(_0x20dd37,null))['then'](function(_0x42e562){if(_0x42e562){_0x14ab72[_0xb016('0x43')]=_[_0xb016('0x46')](db['CannedAnswer'][_0xb016('0x40')]);_0x14ab72[_0xb016('0x45')]=_[_0xb016('0x46')](_0x2c331a[_0xb016('0x45')]);_0x14ab72[_0xb016('0x47')]=_[_0xb016('0x48')](_0x14ab72[_0xb016('0x43')],_0x14ab72[_0xb016('0x45')]);_0x267eb1[_0xb016('0x49')]=_[_0xb016('0x48')](_0x14ab72['model'],qs[_0xb016('0x4a')](_0x2c331a[_0xb016('0x45')][_0xb016('0x4a')]));_0x267eb1[_0xb016('0x49')]=_0x267eb1[_0xb016('0x49')][_0xb016('0x4b')]?_0x267eb1[_0xb016('0x49')]:_0x14ab72['model'];if(!_0x2c331a[_0xb016('0x45')][_0xb016('0x67')](_0xb016('0x4c'))){_0x267eb1[_0xb016('0x2f')]=qs[_0xb016('0x2f')](_0x2c331a[_0xb016('0x45')]['limit']);_0x267eb1[_0xb016('0x2d')]=qs[_0xb016('0x2d')](_0x2c331a[_0xb016('0x45')][_0xb016('0x2d')]);}_0x267eb1[_0xb016('0x4d')]=qs[_0xb016('0x68')](_0x2c331a[_0xb016('0x45')][_0xb016('0x68')]);_0x267eb1['where']=qs[_0xb016('0x47')](_[_0xb016('0x4e')](_0x2c331a[_0xb016('0x45')],_0x14ab72[_0xb016('0x47')]));_0x267eb1[_0xb016('0x50')][_0xb016('0x63')]=_0x42e562['id'];if(_0x2c331a[_0xb016('0x45')]['filter']){_0x267eb1['where']=_[_0xb016('0x51')](_0x267eb1['where'],{'$or':_[_0xb016('0x44')](_0x267eb1[_0xb016('0x49')],function(_0x28a892){var _0xceab3a={};_0xceab3a[_0x28a892]={'$like':'%'+_0x2c331a[_0xb016('0x45')][_0xb016('0x4f')]+'%'};return _0xceab3a;})});}_0x267eb1=_[_0xb016('0x51')]({},_0x267eb1,_0x2c331a[_0xb016('0x58')]);return db[_0xb016('0x6a')]['count']({'where':_0x267eb1[_0xb016('0x50')]})['then'](function(_0x881f14){_0x42eaa6[_0xb016('0x30')]=_0x881f14;if(_0x2c331a['query'][_0xb016('0x53')]){_0x267eb1[_0xb016('0x54')]=[{'all':!![]}];}return db[_0xb016('0x6a')][_0xb016('0x55')](_0x267eb1);})[_0xb016('0x1f')](function(_0x32362f){_0x42eaa6[_0xb016('0x56')]=_0x32362f;return _0x42eaa6;});}})['then'](respondWithFilteredResult(_0x20dd37,_0x267eb1))[_0xb016('0x28')](handleError(_0x20dd37,null));};exports[_0xb016('0x6b')]=function(_0x2c54b2,_0x442c5b,_0x22691a){return db[_0xb016('0x3f')][_0xb016('0x59')]({'where':{'id':_0x2c54b2['params']['id']}})[_0xb016('0x1f')](handleEntityNotFound(_0x442c5b,null))['then'](function(_0x1c2208){if(_0x1c2208){return _0x1c2208[_0xb016('0x6b')](_0x2c54b2[_0xb016('0x45')]['ids']);}})[_0xb016('0x1f')](respondWithStatusCode(_0x442c5b,null))[_0xb016('0x28')](handleError(_0x442c5b,null));};exports[_0xb016('0x6c')]=function(_0x2ad0e5,_0x14b23e,_0xbe1c07){return db[_0xb016('0x6d')][_0xb016('0x59')]({'where':{'id':_0x2ad0e5[_0xb016('0x57')]['id']}})[_0xb016('0x1f')](handleEntityNotFound(_0x14b23e,null))[_0xb016('0x1f')](function(_0x314eb9){if(_0x314eb9){return _0x314eb9['addInteraction'](_0x2ad0e5[_0xb016('0x5b')][_0xb016('0x6e')],_['omit'](_0x2ad0e5[_0xb016('0x5b')],[_0xb016('0x6e'),'id'])||{});}})[_0xb016('0x1f')](respondWithResult(_0x14b23e,null))[_0xb016('0x28')](handleError(_0x14b23e,null));};exports[_0xb016('0x6f')]=function(_0x122ce4,_0x38cdeb,_0x41fd61){var _0x233723={'raw':![],'where':{}};var _0x10413c={};var _0x6774ea={'count':0x0,'rows':[]};return db['FaxAccount'][_0xb016('0x66')]({'where':{'id':_0x122ce4['params']['id']}})[_0xb016('0x1f')](handleEntityNotFound(_0x38cdeb,null))[_0xb016('0x1f')](function(_0x113aee){if(_0x113aee){_0x10413c['model']=_[_0xb016('0x46')](db['FaxInteraction'][_0xb016('0x40')]);_0x10413c['query']=_['keys'](_0x122ce4[_0xb016('0x45')]);_0x10413c[_0xb016('0x47')]=_[_0xb016('0x48')](_0x10413c['model'],_0x10413c['query']);_0x233723['attributes']=_[_0xb016('0x48')](_0x10413c['model'],qs['fields'](_0x122ce4[_0xb016('0x45')]['fields']));_0x233723['attributes']=_0x233723['attributes'][_0xb016('0x4b')]?_0x233723['attributes']:_0x10413c[_0xb016('0x43')];if(!_0x122ce4['query'][_0xb016('0x67')](_0xb016('0x4c'))){_0x233723[_0xb016('0x2f')]=qs['limit'](_0x122ce4[_0xb016('0x45')][_0xb016('0x2f')]);_0x233723['offset']=qs['offset'](_0x122ce4[_0xb016('0x45')][_0xb016('0x2d')]);}_0x233723[_0xb016('0x4d')]=qs[_0xb016('0x68')](_0x122ce4[_0xb016('0x45')]['sort']);_0x233723[_0xb016('0x50')]=qs[_0xb016('0x47')](_[_0xb016('0x4e')](_0x122ce4[_0xb016('0x45')],_0x10413c[_0xb016('0x47')]));_0x233723[_0xb016('0x50')][_0xb016('0x63')]=_0x113aee['id'];if(_0x122ce4[_0xb016('0x45')][_0xb016('0x4f')]){_0x233723['where']=_['merge'](_0x233723[_0xb016('0x50')],{'$or':_[_0xb016('0x44')](_0x233723['attributes'],function(_0xea286a){var _0x1b1530={};_0x1b1530[_0xea286a]={'$like':'%'+_0x122ce4[_0xb016('0x45')][_0xb016('0x4f')]+'%'};return _0x1b1530;})});}_0x233723=_[_0xb016('0x51')]({},_0x233723,_0x122ce4[_0xb016('0x58')]);return db['FaxInteraction'][_0xb016('0x30')]({'where':_0x233723[_0xb016('0x50')]})[_0xb016('0x1f')](function(_0xed9a9c){_0x6774ea['count']=_0xed9a9c;if(_0x122ce4[_0xb016('0x45')][_0xb016('0x53')]){_0x233723[_0xb016('0x54')]=[{'model':db[_0xb016('0x70')],'as':_0xb016('0x71'),'required':![]},{'model':db['User'],'as':_0xb016('0x72'),'attributes':[_0xb016('0x3a'),'fullname',_0xb016('0x73')],'required':![]},{'model':db[_0xb016('0x74')],'as':'Tags','attributes':['id',_0xb016('0x3a'),_0xb016('0x75')],'where':_0x122ce4[_0xb016('0x45')][_0xb016('0x76')]?{'id':_0x122ce4['query']['tag']}:undefined,'required':_0x122ce4[_0xb016('0x45')][_0xb016('0x76')]?!![]:![]}];}return db[_0xb016('0x6d')][_0xb016('0x55')](_0x233723);})[_0xb016('0x1f')](function(_0x252a54){_0x6774ea[_0xb016('0x56')]=_0x252a54;return _0x6774ea;});}})[_0xb016('0x1f')](respondWithFilteredResult(_0x38cdeb,_0x233723))[_0xb016('0x28')](handleError(_0x38cdeb,null));};exports[_0xb016('0x77')]=function(_0x5cb32f,_0x3b39fd){var _0x4929d9=_0x5cb32f['params']['id'];var _0x40ae98=_0x5cb32f[_0xb016('0x5b')];var _0x33d4bd=0xc8;var _0x3e8def=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xb016('0x78')][_0xb016('0x79')][_0xb016('0x7a')][_0xb016('0x7b')]},function(_0x35929a){return db['FaxAccount'][_0xb016('0x66')]({'where':{'id':_0x4929d9},'transaction':_0x35929a})[_0xb016('0x1f')](function(_0xfd9055){if(_0xfd9055){return db[_0xb016('0x7c')][_0xb016('0x36')]({'where':{'FaxAccountId':_0x4929d9},'transaction':_0x35929a})[_0xb016('0x1f')](function(){var _0x1419aa=_['map'](_0x40ae98,function(_0x1ad9f7){_0x1ad9f7['FaxAccountId']=_0x4929d9;return _0x1ad9f7;});return db[_0xb016('0x7c')][_0xb016('0x7d')](_0x1419aa,{'transaction':_0x35929a});});}else{_0x33d4bd=0x194;_0x3e8def=[];}});})['then'](function(){if(_0x33d4bd!==0x194){return db[_0xb016('0x7c')][_0xb016('0x7e')]({'where':{'FaxAccountId':_0x4929d9},'order':_0xb016('0x7f')})[_0xb016('0x1f')](function(_0x1a61fb){_0x3e8def=_0x1a61fb;});}})['catch'](function(_0x4e6100){_0x33d4bd=0x1f4;logger[_0xb016('0x25')](_0x4e6100[_0xb016('0x80')]);if(_0x4e6100['name']){delete _0x4e6100['name'];}_0x3e8def=_0x4e6100;})[_0xb016('0x81')](function(){if(_0x3e8def===null){_0x3b39fd[_0xb016('0x29')](_0x33d4bd);}else{if(_0x33d4bd===0x1f4){_0x3b39fd[_0xb016('0x2a')](_0x33d4bd)['send'](_0x3e8def);}else{_0x3b39fd[_0xb016('0x2a')](_0x33d4bd)[_0xb016('0x2c')](_0x3e8def);}}});};exports[_0xb016('0x82')]=function(_0x18a484,_0xd3017a,_0x5b4232){var _0x13716c={};var _0x3a4b47={};var _0x2346d7;var _0x55ad11;return db['FaxAccount']['findOne']({'where':{'id':_0x18a484['params']['id']}})[_0xb016('0x1f')](handleEntityNotFound(_0xd3017a,null))[_0xb016('0x1f')](function(_0x7114af){if(_0x7114af){_0x2346d7=_0x7114af;_0x3a4b47[_0xb016('0x43')]=_[_0xb016('0x46')](db[_0xb016('0x7c')][_0xb016('0x40')]);_0x3a4b47[_0xb016('0x45')]=_[_0xb016('0x46')](_0x18a484['query']);_0x3a4b47[_0xb016('0x47')]=_['intersection'](_0x3a4b47[_0xb016('0x43')],_0x3a4b47[_0xb016('0x45')]);_0x13716c['attributes']=_[_0xb016('0x48')](_0x3a4b47[_0xb016('0x43')],qs[_0xb016('0x4a')](_0x18a484[_0xb016('0x45')][_0xb016('0x4a')]));_0x13716c[_0xb016('0x49')]=_0x13716c[_0xb016('0x49')][_0xb016('0x4b')]?_0x13716c[_0xb016('0x49')]:_0x3a4b47[_0xb016('0x43')];_0x13716c[_0xb016('0x4d')]=qs[_0xb016('0x68')](_0x18a484[_0xb016('0x45')]['sort']);_0x13716c[_0xb016('0x50')]=qs[_0xb016('0x47')](_[_0xb016('0x4e')](_0x18a484[_0xb016('0x45')],_0x3a4b47['filters']));if(_0x18a484[_0xb016('0x45')][_0xb016('0x4f')]){_0x13716c['where']=_['merge'](_0x13716c[_0xb016('0x50')],{'$or':_[_0xb016('0x44')](_0x13716c[_0xb016('0x49')],function(_0x468b0c){var _0x5a6057={};_0x5a6057[_0x468b0c]={'$like':'%'+_0x18a484[_0xb016('0x45')]['filter']+'%'};return _0x5a6057;})});}_0x13716c=_[_0xb016('0x51')]({},_0x13716c,_0x18a484[_0xb016('0x58')]);return _0x2346d7[_0xb016('0x82')](_0x13716c);}})[_0xb016('0x1f')](function(_0x1a8657){if(_0x1a8657){_0x55ad11=_0x1a8657[_0xb016('0x4b')];if(!_0x18a484['query'][_0xb016('0x67')](_0xb016('0x4c'))){_0x13716c['limit']=qs['limit'](_0x18a484[_0xb016('0x45')]['limit']);_0x13716c[_0xb016('0x2d')]=qs[_0xb016('0x2d')](_0x18a484[_0xb016('0x45')][_0xb016('0x2d')]);}return _0x2346d7['getApplications'](_0x13716c);}})['then'](function(_0x336486){if(_0x336486){return _0x336486?{'count':_0x55ad11,'rows':_0x336486}:null;}})[_0xb016('0x1f')](respondWithResult(_0xd3017a,null))[_0xb016('0x28')](handleError(_0xd3017a,null));};function Extension(_0x1e481b,_0x22e274,_0x590011,_0xb62e1e){this[_0xb016('0x83')]='from-voip-provider';this[_0xb016('0x84')]=_0x1e481b['localstationid'];this[_0xb016('0x85')]=_0xb62e1e;this['type']=_0xb016('0x86');this[_0xb016('0x87')]=_0xb016('0x88');this[_0xb016('0x63')]=_0x1e481b['id'];this[_0xb016('0x7f')]=_0x22e274;this[_0xb016('0x89')]=_0x590011;}function createExtensionsReciveFax(_0x244b0a){var _0x465e40=0x1;var _0x4d2b80=[];_0x4d2b80['push'](new Extension(_0x244b0a,_0x465e40,'','Answer'));_0x465e40+=0x1;_0x4d2b80['push'](new Extension(_0x244b0a,_0x465e40,_0xb016('0x8a'),_0xb016('0x8b')));_0x465e40+=0x1;for(var _0x3cef4b in _0x244b0a){if(_0x244b0a['hasOwnProperty'](_0x3cef4b)&&(_0x3cef4b===_0xb016('0x8c')||_0x3cef4b===_0xb016('0x8d')||_0x3cef4b===_0xb016('0x8e')||_0x3cef4b===_0xb016('0x8f')||_0x3cef4b==='headerinfo'||_0x3cef4b===_0xb016('0x90')||_0x3cef4b===_0xb016('0x91')||_0x3cef4b===_0xb016('0x92')||_0x3cef4b==='t38timeout')){_0x4d2b80[_0xb016('0x93')](new Extension(_0x244b0a,_0x465e40,_0xb016('0x94')+_0x3cef4b+')='+_0x244b0a[_0x3cef4b],_0xb016('0x8b')));_0x465e40+=0x1;}}_0x4d2b80[_0xb016('0x93')](new Extension(_0x244b0a,_0x465e40,'6',_0xb016('0x95')));_0x465e40+=0x1;_0x4d2b80['push'](new Extension(_0x244b0a,_0x465e40,'/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',_0xb016('0x96')));_0x465e40=0x0;return _0x4d2b80;}exports[_0xb016('0x97')]=function(_0x561455,_0x59f6b0,_0x2def41){var _0x2611fd;return db[_0xb016('0x78')]['transaction'](function(_0x2d2de6){return db[_0xb016('0x3f')][_0xb016('0x5a')](_0x561455[_0xb016('0x5b')],{'transaction':_0x2d2de6})[_0xb016('0x1f')](function(_0x19a851){_0x2611fd=_0x19a851[_0xb016('0x37')]({'plain':!![]});return db['VoiceExtension'][_0xb016('0x7d')](createExtensionsReciveFax(_0x2611fd),{'transaction':_0x2d2de6});});})[_0xb016('0x1f')](function(){return _0x2611fd;})[_0xb016('0x1f')](respondWithResult(_0x59f6b0,null))[_0xb016('0x28')](handleError(_0x59f6b0,null));};exports[_0xb016('0x98')]=function(_0x5e0064,_0x47424c,_0xd24743){var _0x3700e7;return db[_0xb016('0x78')][_0xb016('0x99')](function(_0x40d0a8){return db['FaxAccount']['update'](_0x5e0064['body'],{'where':{'id':_0x5e0064['body']['id']},'transaction':_0x40d0a8})['then'](function(_0x2ffaf6){return db[_0xb016('0x9a')][_0xb016('0x36')]({'where':{'FaxAccountId':_0x5e0064[_0xb016('0x5b')]['id']},'transaction':_0x40d0a8})[_0xb016('0x1f')](function(_0x3face3){return db[_0xb016('0x9a')][_0xb016('0x7d')](createExtensionsReciveFax(_[_0xb016('0x9b')](_0x5e0064['body'],[_0xb016('0x9c'),_0xb016('0x42'),_0xb016('0x9d'),_0xb016('0x9e'),'TrunkId',_0xb016('0x9f')])),{'transaction':_0x40d0a8});});});})['then'](function(){return db[_0xb016('0x3f')][_0xb016('0xa0')](_0x5e0064[_0xb016('0x5b')]['id']);})[_0xb016('0x1f')](respondWithResult(_0x47424c,null))[_0xb016('0x28')](handleError(_0x47424c,null));};exports[_0xb016('0xa1')]=function(_0x370859,_0x59fbc0,_0x48e16d){var _0x247ada={'raw':!![],'where':{}};var _0x586804={};var _0x46349e={'count':0x0,'rows':[]};return db[_0xb016('0x3f')][_0xb016('0x66')]({'where':{'id':_0x370859[_0xb016('0x57')]['id']}})[_0xb016('0x1f')](handleEntityNotFound(_0x59fbc0,null))[_0xb016('0x1f')](function(_0x2f6b2d){if(_0x2f6b2d){_0x586804[_0xb016('0x43')]=_['keys'](db[_0xb016('0xa2')][_0xb016('0x40')]);_0x586804[_0xb016('0x45')]=_[_0xb016('0x46')](_0x370859[_0xb016('0x45')]);_0x586804[_0xb016('0x47')]=_[_0xb016('0x48')](_0x586804[_0xb016('0x43')],_0x586804[_0xb016('0x45')]);_0x247ada[_0xb016('0x49')]=_[_0xb016('0x48')](_0x586804['model'],qs[_0xb016('0x4a')](_0x370859['query']['fields']));_0x247ada[_0xb016('0x49')]=_0x247ada[_0xb016('0x49')][_0xb016('0x4b')]?_0x247ada[_0xb016('0x49')]:_0x586804[_0xb016('0x43')];if(!_0x370859[_0xb016('0x45')]['hasOwnProperty'](_0xb016('0x4c'))){_0x247ada[_0xb016('0x2f')]=qs[_0xb016('0x2f')](_0x370859[_0xb016('0x45')][_0xb016('0x2f')]);_0x247ada[_0xb016('0x2d')]=qs[_0xb016('0x2d')](_0x370859[_0xb016('0x45')][_0xb016('0x2d')]);}_0x247ada[_0xb016('0x4d')]=qs[_0xb016('0x68')](_0x370859[_0xb016('0x45')][_0xb016('0x68')]);_0x247ada[_0xb016('0x50')]=qs[_0xb016('0x47')](_[_0xb016('0x4e')](_0x370859[_0xb016('0x45')],_0x586804[_0xb016('0x47')]));_0x247ada[_0xb016('0x50')][_0xb016('0x63')]=_0x2f6b2d['id'];if(_0x370859[_0xb016('0x45')][_0xb016('0x4f')]){_0x247ada[_0xb016('0x50')]=_[_0xb016('0x51')](_0x247ada[_0xb016('0x50')],{'$or':_['map'](_0x247ada[_0xb016('0x49')],function(_0x1997f0){var _0x37516d={};_0x37516d[_0x1997f0]={'$like':'%'+_0x370859['query'][_0xb016('0x4f')]+'%'};return _0x37516d;})});}if(_0x370859[_0xb016('0x45')]['$gte']){var _0x59588d=_0x370859[_0xb016('0x45')]['$gte'][_0xb016('0xa3')](',');var _0xecd1f4={};_0xecd1f4[_0x59588d[0x0]]={'$gte':moment(_0x59588d[0x1])[_0xb016('0xa4')]('YYYY-MM-DD\x20HH:mm:ss')};_0x247ada['where']=_['merge'](_0x247ada['where'],_0xecd1f4);}_0x247ada=_['merge']({},_0x247ada,_0x370859['options']);return db[_0xb016('0xa2')][_0xb016('0x30')]({'where':_0x247ada['where']})[_0xb016('0x1f')](function(_0x3e33ec){_0x46349e[_0xb016('0x30')]=_0x3e33ec;if(_0x370859[_0xb016('0x45')][_0xb016('0x53')]){_0x247ada['include']=[{'all':!![]}];}return db['FaxMessage'][_0xb016('0x55')](_0x247ada);})['then'](function(_0x56df38){_0x46349e[_0xb016('0x56')]=_0x56df38;return _0x46349e;});}})[_0xb016('0x1f')](respondWithFilteredResult(_0x59fbc0,_0x247ada))[_0xb016('0x28')](handleError(_0x59fbc0,null));};exports[_0xb016('0x3b')]=function(_0x43c1a2,_0x65c5ef,_0x58ee57){var _0x5a3b11,_0xfeda96={},_0x155c9c;if(_0x43c1a2[_0xb016('0x5b')]['to']){_0x155c9c=_0x43c1a2['body']['to'][0x0];}return db['FaxAccount'][_0xb016('0x59')]({'where':{'id':_0x43c1a2[_0xb016('0x57')]['id']},'include':[{'model':db[_0xb016('0xa5')],'as':_0xb016('0xa6'),'include':[{'model':db[_0xb016('0x70')],'as':_0xb016('0xa7'),'where':{'fax':_0x155c9c},'limit':0x1,'order':[['updatedAt',_0xb016('0xa8')]]}]}]})[_0xb016('0x1f')](handleEntityNotFound(_0x65c5ef,null))[_0xb016('0x1f')](function(_0x41b202){_0x5a3b11=_0x41b202;if(_0x43c1a2['body'][_0xb016('0xa9')]&&_0x43c1a2['body']['attachments'][_0xb016('0x4b')]){for(var _0x58e61e=0x0;_0x58e61e<_0x43c1a2['body'][_0xb016('0xa9')][_0xb016('0x4b')];_0x58e61e+=0x1){_0x43c1a2['body']['attachments'][_0x58e61e]={'filename':_0x43c1a2[_0xb016('0x5b')]['attachments'][_0x58e61e][_0xb016('0x3a')],'id':_0x43c1a2[_0xb016('0x5b')][_0xb016('0xa9')][_0x58e61e]['id'],'path':path[_0xb016('0xaa')](config[_0xb016('0xab')],'server/files/attachments',_0x43c1a2['body'][_0xb016('0xa9')][_0x58e61e]['basename'])};}}return respondWithRpcPromise(_0xb016('0xac'),_0xb016('0xac'),{'FaxAccountId':_[_0xb016('0xad')](_0x43c1a2[_0xb016('0x57')]['id'])?undefined:_0x43c1a2['params']['id'],'path':_[_0xb016('0xad')](_0x43c1a2['body'][_0xb016('0xa9')][0x0]['path'])?undefined:_0x43c1a2[_0xb016('0x5b')][_0xb016('0xa9')][0x0][_0xb016('0x8')],'fax':_[_0xb016('0xad')](_0x43c1a2[_0xb016('0x5b')]['to'][0x0])?undefined:_0x43c1a2['body']['to'][0x0]},client9002);})[_0xb016('0x1f')](function(){if(_0x5a3b11){if(_[_0xb016('0xad')](_0x43c1a2['body'][_0xb016('0xae')])){_0x43c1a2['body']['from']=util[_0xb016('0xa4')](_0xb016('0xaf'),_0x5a3b11[_0xb016('0x3a')],_0x5a3b11[_0xb016('0xb0')]);}if(_0x5a3b11[_0xb016('0xa6')]){if(_0x5a3b11[_0xb016('0xa6')][_0xb016('0xa7')]['length']){return _0x5a3b11[_0xb016('0xa6')][_0xb016('0xa7')][0x0];}else{return db['CmContact'][_0xb016('0x5a')](_[_0xb016('0x17')](_0x43c1a2[_0xb016('0x5b')],{'firstName':_0x43c1a2[_0xb016('0x5b')]['to'][0x0],'phone':_0x43c1a2[_0xb016('0x5b')]['to'][0x0],'fax':_0x43c1a2[_0xb016('0x5b')]['to'][0x0],'ListId':_0x5a3b11[_0xb016('0x9f')]}));}}else{throw new Error(_0xb016('0xb1'));}}else{throw new Error(_0xb016('0xb2'));}})[_0xb016('0x1f')](function(_0x3640d4){if(_0x3640d4){return db[_0xb016('0x6d')]['find']({'where':{'ContactId':_0x3640d4['id'],'closed':![],'FaxAccountId':_0x5a3b11['id']}})[_0xb016('0x1f')](function(_0x492cc1){if(_0x492cc1){return[_0x492cc1,![]];}return db['FaxInteraction'][_0xb016('0x5a')]({'UserId':_0x43c1a2['user']['id'],'ContactId':_0x3640d4['id'],'FaxAccountId':_0x5a3b11['id'],'fax':_0x43c1a2['body']['to'][0x0],'firstMsgDirection':_0xb016('0xb3'),'Messages':[_['merge'](_0x43c1a2['body'],{'read':![],'body':_0x43c1a2[_0xb016('0x5b')]['attachments'][0x0][_0xb016('0xb4')],'FaxAccountId':_0x5a3b11['id'],'UserId':_0x43c1a2['user']['id'],'ContactId':_0x3640d4['id'],'AttachmentId':_0x43c1a2[_0xb016('0x5b')][_0xb016('0xa9')][0x0]['id']})]},{'include':[{'model':db[_0xb016('0xa2')],'as':_0xb016('0xb5')}]})[_0xb016('0x1f')](function(_0x25d203){return[_0x25d203,!![]];});});}else{throw new Error(_0xb016('0xb6'));}})[_0xb016('0xb7')](function(_0x3cd036,_0x514bdf){if(_0x514bdf){return _0x3cd036;}return db[_0xb016('0xa2')]['create']({'direction':'out','read':![],'body':_0x43c1a2['body'][_0xb016('0xa9')][0x0][_0xb016('0xb4')],'FaxAccountId':_0x5a3b11['id'],'FaxInteractionId':_0x3cd036['id'],'UserId':_0x43c1a2[_0xb016('0x5c')]['id'],'ContactId':_0x3cd036[_0xb016('0xb8')],'AttachmentId':_0x43c1a2[_0xb016('0x5b')][_0xb016('0xa9')][0x0]['id']})['then'](function(_0x53cf68){_0x3cd036[_0xb016('0xb9')][_0xb016('0xb5')]=[];_0x3cd036[_0xb016('0xb9')][_0xb016('0xb5')][_0xb016('0x93')](_0x53cf68[_0xb016('0xb9')]);return _0x3cd036;});})[_0xb016('0x1f')](function(_0x1ff56b){respondWithRpcPromise(_0xb016('0xba'),_0xb016('0xba'),{'FaxAccountId':_[_0xb016('0xad')](_0x43c1a2['params']['id'])?undefined:_0x43c1a2[_0xb016('0x57')]['id'],'path':_[_0xb016('0xad')](_0x43c1a2[_0xb016('0x5b')][_0xb016('0xa9')][0x0][_0xb016('0x8')])?undefined:_0x43c1a2[_0xb016('0x5b')][_0xb016('0xa9')][0x0][_0xb016('0x8')],'fax':_[_0xb016('0xad')](_0x43c1a2[_0xb016('0x5b')]['to'][0x0])?undefined:_0x43c1a2[_0xb016('0x5b')]['to'][0x0],'AttachmentId':_0x43c1a2[_0xb016('0x5b')][_0xb016('0xa9')][0x0]['id']},client9002)['then'](function(_0x179229){logger['info'](_0xb016('0xbb'),_0x179229);})[_0xb016('0x28')](function(_0x36197d){logger[_0xb016('0x20')](_0xb016('0xbb'),_0x36197d);});return _0x1ff56b;})[_0xb016('0x1f')](respondWithResult(_0x65c5ef,null))[_0xb016('0x28')](handleError(_0x65c5ef,null));};exports[_0xb016('0xbc')]=function(_0x45b8ec,_0x57d94e,_0x232a1c){return db[_0xb016('0x3f')][_0xb016('0x59')]({'where':{'id':_0x45b8ec[_0xb016('0x57')]['id']}})[_0xb016('0x1f')](handleEntityNotFound(_0x57d94e,null))[_0xb016('0x1f')](function(_0x163e6f){if(_0x163e6f){return _0x163e6f['addAgents'](_0x45b8ec[_0xb016('0x5b')][_0xb016('0x6e')],_[_0xb016('0x9b')](_0x45b8ec[_0xb016('0x5b')],[_0xb016('0x6e'),'id'])||{})[_0xb016('0xb7')](function(_0x5bd647){for(var _0x51c5a3=0x0;_0x51c5a3<_0x45b8ec[_0xb016('0x5b')][_0xb016('0x6e')][_0xb016('0x4b')];_0x51c5a3+=0x1){socket[_0xb016('0xbd')](_0xb016('0xbe'),{'UserId':Number(_0x45b8ec[_0xb016('0x5b')][_0xb016('0x6e')][_0x51c5a3]),'FaxAccountId':Number(_0x45b8ec['params']['id'])});}return _0x5bd647;});}})['then'](respondWithResult(_0x57d94e,null))['catch'](handleError(_0x57d94e,null));};exports[_0xb016('0xbf')]=function(_0x3408b3,_0x4c258a,_0x420f8c){return db[_0xb016('0x3f')][_0xb016('0x59')]({'where':{'id':_0x3408b3[_0xb016('0x57')]['id']}})['then'](handleEntityNotFound(_0x4c258a,null))[_0xb016('0x1f')](function(_0x4e7630){if(_0x4e7630){return _0x4e7630[_0xb016('0xbf')](_0x3408b3[_0xb016('0x45')][_0xb016('0x6e')])[_0xb016('0x1f')](function(){if(_[_0xb016('0xc0')](_0x3408b3[_0xb016('0x45')][_0xb016('0x6e')])){for(var _0x940a66=0x0;_0x940a66<_0x3408b3[_0xb016('0x45')][_0xb016('0x6e')][_0xb016('0x4b')];_0x940a66+=0x1){socket['emit'](_0xb016('0xc1'),{'UserId':Number(_0x3408b3[_0xb016('0x45')][_0xb016('0x6e')][_0x940a66]),'FaxAccountId':Number(_0x3408b3[_0xb016('0x57')]['id'])});}}else{socket[_0xb016('0xbd')]('userFaxAccount:remove',{'UserId':Number(_0x3408b3[_0xb016('0x45')][_0xb016('0x6e')]),'FaxAccountId':Number(_0x3408b3[_0xb016('0x57')]['id'])});}});}})[_0xb016('0x1f')](respondWithStatusCode(_0x4c258a,null))[_0xb016('0x28')](handleError(_0x4c258a,null));};exports[_0xb016('0xc2')]=function(_0xc4d5e,_0x564806,_0x1ecb17){var _0x52e01c={};var _0x3b1589={};var _0x5ac284;var _0x4b7c02;return db['FaxAccount']['findOne']({'where':{'id':_0xc4d5e[_0xb016('0x57')]['id']}})[_0xb016('0x1f')](handleEntityNotFound(_0x564806,null))[_0xb016('0x1f')](function(_0x50911e){if(_0x50911e){_0x5ac284=_0x50911e;_0x3b1589['model']=_[_0xb016('0x46')](db[_0xb016('0xc3')][_0xb016('0x40')]);_0x3b1589[_0xb016('0x45')]=_[_0xb016('0x46')](_0xc4d5e['query']);_0x3b1589['filters']=_[_0xb016('0x48')](_0x3b1589[_0xb016('0x43')],_0x3b1589[_0xb016('0x45')]);_0x52e01c[_0xb016('0x49')]=_[_0xb016('0x48')](_0x3b1589[_0xb016('0x43')],qs[_0xb016('0x4a')](_0xc4d5e[_0xb016('0x45')]['fields']));_0x52e01c['attributes']=_0x52e01c['attributes'][_0xb016('0x4b')]?_0x52e01c[_0xb016('0x49')]:_0x3b1589['model'];_0x52e01c['order']=qs[_0xb016('0x68')](_0xc4d5e[_0xb016('0x45')][_0xb016('0x68')]);_0x52e01c['where']=qs['filters'](_[_0xb016('0x4e')](_0xc4d5e[_0xb016('0x45')],_0x3b1589[_0xb016('0x47')]));if(_0xc4d5e['query'][_0xb016('0x4f')]){_0x52e01c[_0xb016('0x50')]=_[_0xb016('0x51')](_0x52e01c[_0xb016('0x50')],{'$or':_[_0xb016('0x44')](_0x52e01c[_0xb016('0x49')],function(_0xc9e459){var _0x1bf124={};_0x1bf124[_0xc9e459]={'$like':'%'+_0xc4d5e[_0xb016('0x45')][_0xb016('0x4f')]+'%'};return _0x1bf124;})});}_0x52e01c=_[_0xb016('0x51')]({},_0x52e01c,_0xc4d5e['options']);return _0x5ac284[_0xb016('0xc2')](_0x52e01c);}})[_0xb016('0x1f')](function(_0x3703a2){if(_0x3703a2){_0x4b7c02=_0x3703a2['length'];if(!_0xc4d5e['query'][_0xb016('0x67')](_0xb016('0x4c'))){_0x52e01c[_0xb016('0x2f')]=qs[_0xb016('0x2f')](_0xc4d5e[_0xb016('0x45')]['limit']);_0x52e01c['offset']=qs[_0xb016('0x2d')](_0xc4d5e[_0xb016('0x45')][_0xb016('0x2d')]);}return _0x5ac284[_0xb016('0xc2')](_0x52e01c);}})[_0xb016('0x1f')](function(_0x59cae2){if(_0x59cae2){return _0x59cae2?{'count':_0x4b7c02,'rows':_0x59cae2}:null;}})['then'](respondWithResult(_0x564806,null))[_0xb016('0x28')](handleError(_0x564806,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index b8b0b1b..800611e 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 _0x36ca=['FaxAccount','setMaxListeners','save','update','emit','hook','exports','../../mysqldb'];(function(_0xf5862b,_0x4a2dda){var _0x5e47ce=function(_0x12bed6){while(--_0x12bed6){_0xf5862b['push'](_0xf5862b['shift']());}};_0x5e47ce(++_0x4a2dda);}(_0x36ca,0x137));var _0xa36c=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x36ca[_0x2f5ac5];return _0x37c9a8;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xa36c('0x0'))['db'][_0xa36c('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xa36c('0x2')](0x0);var events={'afterCreate':_0xa36c('0x3'),'afterUpdate':_0xa36c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5356d5){return function(_0x426dec,_0x532842,_0x201ca9){FaxAccountEvents[_0xa36c('0x5')](_0x5356d5+':'+_0x426dec['id'],_0x426dec);FaxAccountEvents['emit'](_0x5356d5,_0x426dec);_0x201ca9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xa36c('0x6')](e,emitEvent(event));}}module[_0xa36c('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x207d=['hook','events','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x349c08,_0x2914b9){var _0x569c4f=function(_0x468c53){while(--_0x468c53){_0x349c08['push'](_0x349c08['shift']());}};_0x569c4f(++_0x2914b9);}(_0x207d,0x189));var _0xd207=function(_0x10cc70,_0x38b66c){_0x10cc70=_0x10cc70-0x0;var _0x233da3=_0x207d[_0x10cc70];return _0x233da3;};'use strict';var EventEmitter=require(_0xd207('0x0'));var FaxAccount=require('../../mysqldb')['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xd207('0x1')](0x0);var events={'afterCreate':_0xd207('0x2'),'afterUpdate':_0xd207('0x3'),'afterDestroy':_0xd207('0x4')};function emitEvent(_0x47dd56){return function(_0x1fff9d,_0x5eb8ec,_0x41ffa1){FaxAccountEvents['emit'](_0x47dd56+':'+_0x1fff9d['id'],_0x1fff9d);FaxAccountEvents[_0xd207('0x5')](_0x47dd56,_0x1fff9d);_0x41ffa1(null);};}for(var e in events){if(events[_0xd207('0x6')](e)){var event=events[e];FaxAccount[_0xd207('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 9363af1..98616d6 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 _0x45c5=['fax_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1505e5,_0x5cc291){var _0x5b1dcd=function(_0x18bfe5){while(--_0x18bfe5){_0x1505e5['push'](_0x1505e5['shift']());}};_0x5b1dcd(++_0x5cc291);}(_0x45c5,0x17b));var _0x545c=function(_0x5b4afb,_0x1ef5c8){_0x5b4afb=_0x5b4afb-0x0;var _0x8d2c5f=_0x45c5[_0x5b4afb];return _0x8d2c5f;};'use strict';var _=require(_0x545c('0x0'));var util=require(_0x545c('0x1'));var logger=require(_0x545c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x545c('0x3'));var rp=require(_0x545c('0x4'));var fs=require('fs');var path=require(_0x545c('0x5'));var rimraf=require(_0x545c('0x6'));var config=require(_0x545c('0x7'));var attributes=require('./faxAccount.attributes');module['exports']=function(_0x35ef14,_0x3916f4){return _0x35ef14['define']('FaxAccount',attributes,{'tableName':_0x545c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02e7=['exports','FaxAccount','fax_accounts','api','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes'];(function(_0x123092,_0x4655bc){var _0x2816cc=function(_0x106014){while(--_0x106014){_0x123092['push'](_0x123092['shift']());}};_0x2816cc(++_0x4655bc);}(_0x02e7,0xff));var _0x702e=function(_0x42cf51,_0x208e43){_0x42cf51=_0x42cf51-0x0;var _0x2786d5=_0x02e7[_0x42cf51];return _0x2786d5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x702e('0x0'));var moment=require('moment');var BPromise=require(_0x702e('0x1'));var rp=require(_0x702e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x702e('0x3'));var config=require(_0x702e('0x4'));var attributes=require(_0x702e('0x5'));module[_0x702e('0x6')]=function(_0x23797b,_0x27ae1c){return _0x23797b['define'](_0x702e('0x7'),attributes,{'tableName':_0x702e('0x8'),'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 d95e7ec..1a6f2c1 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 _0x03ce=['map','model','attributes','GetFaxAccount','body','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','CmList','List','Contacts','DESC','FaxApplication','Applications','account','applications','orderBy','priority','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','push','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','UserId','User','find','name','interaction','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','catch','findAll','options','raw','where','limit','include'];(function(_0x2dbc91,_0x49c96b){var _0x153259=function(_0x462a41){while(--_0x462a41){_0x2dbc91['push'](_0x2dbc91['shift']());}};_0x153259(++_0x49c96b);}(_0x03ce,0x95));var _0xe03c=function(_0x53ccb6,_0x4b3497){_0x53ccb6=_0x53ccb6-0x0;var _0x3e3d9a=_0x03ce[_0x53ccb6];return _0x3e3d9a;};'use strict';var _=require(_0xe03c('0x0'));var util=require(_0xe03c('0x1'));var moment=require(_0xe03c('0x2'));var BPromise=require(_0xe03c('0x3'));var rs=require(_0xe03c('0x4'));var fs=require('fs');var Redis=require(_0xe03c('0x5'));var db=require(_0xe03c('0x6'))['db'];var utils=require(_0xe03c('0x7'));var logger=require(_0xe03c('0x8'))(_0xe03c('0x9'));var config=require('../../config/environment');var jayson=require(_0xe03c('0xa'));var client=jayson[_0xe03c('0xb')]['http']({'port':0x232c});config[_0xe03c('0xc')]=_[_0xe03c('0xd')](config[_0xe03c('0xc')],{'host':_0xe03c('0xe'),'port':0x18eb});var socket=require(_0xe03c('0xf'))(new Redis(config[_0xe03c('0xc')]));require(_0xe03c('0x10'))[_0xe03c('0x11')](socket);function respondWithRpcPromise(_0x39e18c,_0x193beb,_0x1f4877){return new BPromise(function(_0x1bdf50,_0x4fa358){return client['request'](_0x39e18c,_0x1f4877)[_0xe03c('0x12')](function(_0x322b46){logger[_0xe03c('0x13')]('FaxAccount,\x20%s,\x20%s',_0x193beb,_0xe03c('0x14'));logger[_0xe03c('0x15')](_0xe03c('0x16'),_0x193beb,_0xe03c('0x14'),JSON[_0xe03c('0x17')](_0x322b46));if(_0x322b46[_0xe03c('0x18')]){if(_0x322b46['error']['code']===0x1f4){logger[_0xe03c('0x18')](_0xe03c('0x19'),_0x193beb,_0x322b46['error']['message']);return _0x4fa358(_0x322b46['error']['message']);}logger[_0xe03c('0x18')](_0xe03c('0x19'),_0x193beb,_0x322b46[_0xe03c('0x18')][_0xe03c('0x1a')]);return _0x1bdf50(_0x322b46['error'][_0xe03c('0x1a')]);}else{logger[_0xe03c('0x13')](_0xe03c('0x19'),_0x193beb,_0xe03c('0x14'));_0x1bdf50(_0x322b46[_0xe03c('0x1b')][_0xe03c('0x1a')]);}})[_0xe03c('0x1c')](function(_0x2ed2ae){logger[_0xe03c('0x18')](_0xe03c('0x19'),_0x193beb,_0x2ed2ae);_0x4fa358(_0x2ed2ae);});});}exports['GetFaxAccount']=function(_0x1f9de0){var _0x2fcc50=this;return new Promise(function(_0x4ce583,_0x24c43b){return db['FaxAccount'][_0xe03c('0x1d')]({'raw':_0x1f9de0[_0xe03c('0x1e')]?_0x1f9de0['options'][_0xe03c('0x1f')]===undefined?!![]:![]:!![],'where':_0x1f9de0[_0xe03c('0x1e')]?_0x1f9de0[_0xe03c('0x1e')][_0xe03c('0x20')]||null:null,'attributes':_0x1f9de0[_0xe03c('0x1e')]?_0x1f9de0[_0xe03c('0x1e')]['attributes']||null:null,'limit':_0x1f9de0[_0xe03c('0x1e')]?_0x1f9de0[_0xe03c('0x1e')][_0xe03c('0x21')]||null:null,'include':_0x1f9de0[_0xe03c('0x1e')]?_0x1f9de0[_0xe03c('0x1e')][_0xe03c('0x22')]?_[_0xe03c('0x23')](_0x1f9de0['options'][_0xe03c('0x22')],function(_0x1998d1){return{'model':db[_0x1998d1[_0xe03c('0x24')]],'as':_0x1998d1['as'],'attributes':_0x1998d1['attributes'],'include':_0x1998d1[_0xe03c('0x22')]?_[_0xe03c('0x23')](_0x1998d1[_0xe03c('0x22')],function(_0x465919){return{'model':db[_0x465919[_0xe03c('0x24')]],'as':_0x465919['as'],'attributes':_0x465919[_0xe03c('0x25')],'include':_0x465919['include']?_[_0xe03c('0x23')](_0x465919[_0xe03c('0x22')],function(_0x2a3a92){return{'model':db[_0x2a3a92[_0xe03c('0x24')]],'as':_0x2a3a92['as'],'attributes':_0x2a3a92[_0xe03c('0x25')]};}):[]};}):[]};}):[]:[]})[_0xe03c('0x12')](function(_0x4faab0){logger[_0xe03c('0x13')](_0xe03c('0x26'),_0x1f9de0);logger[_0xe03c('0x15')](_0xe03c('0x26'),_0x1f9de0,JSON[_0xe03c('0x17')](_0x4faab0));_0x4ce583(_0x4faab0);})[_0xe03c('0x1c')](function(_0x2f2d6a){logger[_0xe03c('0x18')]('GetFaxAccount',_0x2f2d6a['message'],_0x1f9de0);_0x24c43b(_0x2fcc50[_0xe03c('0x18')](0x1f4,_0x2f2d6a['message']));});});};exports['NotifyFaxAccount']=function(_0x1797db,_0x158ec7,_0x555ea0){var _0xfc3176=this;return new Promise(function(_0x3b091f,_0x2ac8a0){var _0x3776ef={'body':_0x1797db[_0xe03c('0x27')],'channel':'fax'};var _0x33326b=[];var _0x514356=[];var _0x220bf8={};return db[_0xe03c('0x28')]['describe']()[_0xe03c('0x12')](function(_0x2ab340){if(!_0x2ab340){throw new db[(_0xe03c('0x29'))]['ValidationError'](_0xe03c('0x2a'));}_0x33326b=_[_0xe03c('0x2b')](_['keys'](_0x2ab340),['createdAt',_0xe03c('0x2c')]);_0x514356=_[_0xe03c('0x2b')](_['keys'](_0x2ab340),[_0xe03c('0x2d'),_0xe03c('0x2c'),_0xe03c('0x2e'),_0xe03c('0x2f')]);if(_0x1797db[_0xe03c('0x27')]['id']){delete _0x1797db[_0xe03c('0x27')]['id'];}if(_[_0xe03c('0x30')](_0x1797db[_0xe03c('0x27')][_0xe03c('0x31')])){throw new db['Sequelize'][(_0xe03c('0x32'))](_0xe03c('0x33'));}if(_['isNil'](_0x1797db['body'][_0xe03c('0x27')])||_0x1797db[_0xe03c('0x27')][_0xe03c('0x27')]===''){throw new db[(_0xe03c('0x29'))][(_0xe03c('0x32'))](_0xe03c('0x34'));}if(_[_0xe03c('0x30')](_0x1797db[_0xe03c('0x27')][_0xe03c('0x35')])){throw new db[(_0xe03c('0x29'))][(_0xe03c('0x32'))](_0xe03c('0x36')+_0x514356);}if(!_[_0xe03c('0x37')](_0x514356,_0x1797db[_0xe03c('0x27')][_0xe03c('0x35')])){throw new db[(_0xe03c('0x29'))][(_0xe03c('0x32'))](_0xe03c('0x38')+_0x514356);}_0x220bf8[_0x1797db[_0xe03c('0x27')][_0xe03c('0x35')]]=_0x1797db[_0xe03c('0x27')][_0xe03c('0x31')];})['then'](function(){return db[_0xe03c('0x39')]['find']({'where':{'id':_0x1797db['account']['id']},'include':[{'model':db[_0xe03c('0x3a')],'as':_0xe03c('0x3b'),'include':[{'model':db[_0xe03c('0x28')],'as':_0xe03c('0x3c'),'where':_0x220bf8,'limit':0x1,'order':[[_0xe03c('0x2c'),_0xe03c('0x3d')]]}]},{'model':db[_0xe03c('0x3e')],'as':_0xe03c('0x3f')}]});})[_0xe03c('0x12')](function(_0x272f86){if(_0x272f86&&_0x272f86[_0xe03c('0x3b')]){var _0x3ed4b0=_0x272f86['get']({'plain':!![]});_0x3776ef[_0xe03c('0x40')]=_0x3ed4b0;_0x3776ef[_0xe03c('0x41')]=_0x3ed4b0['Applications'];_0x3776ef['list']=_0x3ed4b0['List'];_0x3776ef['applications']=_[_0xe03c('0x42')](_0x3776ef[_0xe03c('0x41')],[_0xe03c('0x43')],['asc']);if(_0x3776ef[_0xe03c('0x40')][_0xe03c('0x3f')]){delete _0x3776ef[_0xe03c('0x40')]['Applications'];}if(_0x3776ef[_0xe03c('0x40')]['List']&&_0x3776ef[_0xe03c('0x40')][_0xe03c('0x3b')][_0xe03c('0x3c')][_0xe03c('0x44')]){return _0x3776ef[_0xe03c('0x40')][_0xe03c('0x3b')][_0xe03c('0x3c')][0x0];}var _0x5cd830=_[_0xe03c('0xd')](_0x1797db[_0xe03c('0x27')],{'firstName':_0x1797db[_0xe03c('0x27')][_0xe03c('0x31')],'ListId':_0x3ed4b0['ListId']});_0x5cd830[_0x1797db[_0xe03c('0x27')]['mapKey']]=_0x1797db[_0xe03c('0x27')]['from'];return db[_0xe03c('0x28')][_0xe03c('0x45')](_0x5cd830,{'fields':_0x33326b,'raw':!![]});}})[_0xe03c('0x12')](function(_0x909f8){_0x3776ef[_0xe03c('0x46')]=_0x909f8;if(_0x909f8){var _0x646f80={'ContactId':_0x909f8['id'],'FaxAccountId':_0x1797db['account']['id'],'fax':_0x909f8['fax']};return db[_0xe03c('0x47')]['find']({'where':{'ContactId':_0x909f8['id'],'closed':![],'FaxAccountId':_0x1797db[_0xe03c('0x40')]['id']}})[_0xe03c('0x12')](function(_0x234f9e){if(_0x234f9e){return[_0x234f9e,![]];}return db[_0xe03c('0x47')]['create'](_0x646f80)[_0xe03c('0x12')](function(_0x78ebe2){return[_0x78ebe2,!![]];});});}else{throw new Error(_0xe03c('0x48'));}})[_0xe03c('0x49')](function(_0x1b5a2b,_0x11b439){var _0x3965e7=_0x1b5a2b[_0xe03c('0x4a')]({'plain':!![]});if(_0x11b439){if(_0x3776ef[_0xe03c('0x40')][_0xe03c('0x4b')]){_0x3776ef[_0xe03c('0x41')][_0xe03c('0x4c')]({'id':0x0,'priority':_0x3776ef[_0xe03c('0x41')][_0xe03c('0x44')]+0x1,'app':_0xe03c('0x4d'),'appdata':_0xe03c('0x4e'),'interval':_0xe03c('0x4f')});}_0x3965e7[_0xe03c('0x50')]=!![];}else{_0x3965e7['created']=![];}_0x3776ef['interaction']=_0x3965e7;return db[_0xe03c('0x51')][_0xe03c('0x45')]({'body':_0x1797db[_0xe03c('0x27')][_0xe03c('0x27')],'FaxAccountId':_0x1797db['account']['id'],'FaxInteractionId':_0x1b5a2b['id'],'direction':'in','ContactId':_0x1b5a2b[_0xe03c('0x52')],'AttachmentId':_0x1797db['body']['AttachmentId']});})[_0xe03c('0x12')](function(_0x3e0bbb){_0x3776ef[_0xe03c('0x1a')]=_0x3e0bbb;if(_0x3776ef['interaction'][_0xe03c('0x53')]){return db[_0xe03c('0x54')][_0xe03c('0x55')]({'attributes':['id',_0xe03c('0x56')],'where':{'id':_0x3776ef[_0xe03c('0x57')][_0xe03c('0x53')]}})[_0xe03c('0x12')](function(_0x236613){if(_0x236613){_0x3776ef[_0xe03c('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':_0xe03c('0x58'),'appdata':_0x236613[_0xe03c('0x56')]+','+(_0x3776ef[_0xe03c('0x40')][_0xe03c('0x59')]||0xa),'interval':_0xe03c('0x4f')});}return respondWithRpcPromise(_0xe03c('0x5a'),'startRouting',_0x3776ef);});}return respondWithRpcPromise('Start',_0xe03c('0x5b'),_0x3776ef);})[_0xe03c('0x12')](function(_0x53f78a){_0x3b091f(_0x53f78a);})['catch'](function(_0x46f540){_0x2ac8a0(_0xfc3176['error'](0x1f4,_0x46f540[_0xe03c('0x1a')]));});});}; \ No newline at end of file +var _0x5cb1=['waitForTheAssignedAgent','Start','startRouting','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','request','then','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','catch','GetFaxAccount','findAll','options','where','attributes','limit','map','model','include','debug','NotifyFaxAccount','fax','describe','ValidationError','keys','createdAt','updatedAt','CompanyId','ListId','body','from','Sequelize','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','CmList','CmContact','Contacts','DESC','Applications','List','list','applications','orderBy','priority','asc','account','create','contact','FaxInteraction','spread','get','autoclose','push','length','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','name','unshift','agent'];(function(_0x2bcb75,_0x5789a7){var _0x175345=function(_0x3a7d41){while(--_0x3a7d41){_0x2bcb75['push'](_0x2bcb75['shift']());}};_0x175345(++_0x5789a7);}(_0x5cb1,0xb5));var _0x15cb=function(_0x4738b7,_0x9096f0){_0x4738b7=_0x4738b7-0x0;var _0x47cb9e=_0x5cb1[_0x4738b7];return _0x47cb9e;};'use strict';var _=require('lodash');var util=require(_0x15cb('0x0'));var moment=require('moment');var BPromise=require(_0x15cb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15cb('0x2'));var db=require(_0x15cb('0x3'))['db'];var utils=require(_0x15cb('0x4'));var logger=require(_0x15cb('0x5'))('rpc');var config=require(_0x15cb('0x6'));var jayson=require(_0x15cb('0x7'));var client=jayson[_0x15cb('0x8')][_0x15cb('0x9')]({'port':0x232c});config[_0x15cb('0xa')]=_[_0x15cb('0xb')](config[_0x15cb('0xa')],{'host':_0x15cb('0xc'),'port':0x18eb});var socket=require(_0x15cb('0xd'))(new Redis(config[_0x15cb('0xa')]));require(_0x15cb('0xe'))['register'](socket);function respondWithRpcPromise(_0x7b84c5,_0x5f27cb,_0x577a9e){return new BPromise(function(_0x32e4fc,_0x303c43){return client[_0x15cb('0xf')](_0x7b84c5,_0x577a9e)[_0x15cb('0x10')](function(_0x5a3ee9){logger['info']('FaxAccount,\x20%s,\x20%s',_0x5f27cb,_0x15cb('0x11'));logger['debug'](_0x15cb('0x12'),_0x5f27cb,'request\x20sent',JSON[_0x15cb('0x13')](_0x5a3ee9));if(_0x5a3ee9['error']){if(_0x5a3ee9[_0x15cb('0x14')][_0x15cb('0x15')]===0x1f4){logger[_0x15cb('0x14')](_0x15cb('0x16'),_0x5f27cb,_0x5a3ee9[_0x15cb('0x14')][_0x15cb('0x17')]);return _0x303c43(_0x5a3ee9[_0x15cb('0x14')][_0x15cb('0x17')]);}logger[_0x15cb('0x14')](_0x15cb('0x16'),_0x5f27cb,_0x5a3ee9[_0x15cb('0x14')][_0x15cb('0x17')]);return _0x32e4fc(_0x5a3ee9[_0x15cb('0x14')]['message']);}else{logger[_0x15cb('0x18')]('FaxAccount,\x20%s,\x20%s',_0x5f27cb,_0x15cb('0x11'));_0x32e4fc(_0x5a3ee9[_0x15cb('0x19')]['message']);}})[_0x15cb('0x1a')](function(_0x24f15a){logger[_0x15cb('0x14')](_0x15cb('0x16'),_0x5f27cb,_0x24f15a);_0x303c43(_0x24f15a);});});}exports[_0x15cb('0x1b')]=function(_0x21eec4){var _0x1704f5=this;return new Promise(function(_0x75ed54,_0x4dd912){return db['FaxAccount'][_0x15cb('0x1c')]({'raw':_0x21eec4[_0x15cb('0x1d')]?_0x21eec4[_0x15cb('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x21eec4['options']?_0x21eec4[_0x15cb('0x1d')][_0x15cb('0x1e')]||null:null,'attributes':_0x21eec4[_0x15cb('0x1d')]?_0x21eec4['options'][_0x15cb('0x1f')]||null:null,'limit':_0x21eec4[_0x15cb('0x1d')]?_0x21eec4[_0x15cb('0x1d')][_0x15cb('0x20')]||null:null,'include':_0x21eec4['options']?_0x21eec4[_0x15cb('0x1d')]['include']?_[_0x15cb('0x21')](_0x21eec4[_0x15cb('0x1d')]['include'],function(_0x238676){return{'model':db[_0x238676[_0x15cb('0x22')]],'as':_0x238676['as'],'attributes':_0x238676[_0x15cb('0x1f')],'include':_0x238676['include']?_['map'](_0x238676[_0x15cb('0x23')],function(_0x2651c5){return{'model':db[_0x2651c5[_0x15cb('0x22')]],'as':_0x2651c5['as'],'attributes':_0x2651c5[_0x15cb('0x1f')],'include':_0x2651c5['include']?_[_0x15cb('0x21')](_0x2651c5[_0x15cb('0x23')],function(_0x58142f){return{'model':db[_0x58142f[_0x15cb('0x22')]],'as':_0x58142f['as'],'attributes':_0x58142f[_0x15cb('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32604b){logger[_0x15cb('0x18')]('GetFaxAccount',_0x21eec4);logger[_0x15cb('0x24')](_0x15cb('0x1b'),_0x21eec4,JSON[_0x15cb('0x13')](_0x32604b));_0x75ed54(_0x32604b);})[_0x15cb('0x1a')](function(_0xb03bb3){logger[_0x15cb('0x14')](_0x15cb('0x1b'),_0xb03bb3['message'],_0x21eec4);_0x4dd912(_0x1704f5[_0x15cb('0x14')](0x1f4,_0xb03bb3[_0x15cb('0x17')]));});});};exports[_0x15cb('0x25')]=function(_0x256f4f,_0xbd9969,_0x45f61a){var _0x21d186=this;return new Promise(function(_0x54bfff,_0x21ca42){var _0x39b0aa={'body':_0x256f4f['body'],'channel':_0x15cb('0x26')};var _0x2403ea=[];var _0x4e2ab3=[];var _0x2432dd={};return db['CmContact'][_0x15cb('0x27')]()['then'](function(_0x32d1e5){if(!_0x32d1e5){throw new db['Sequelize'][(_0x15cb('0x28'))]('no\x20available\x20attributes');}_0x2403ea=_['difference'](_[_0x15cb('0x29')](_0x32d1e5),[_0x15cb('0x2a'),_0x15cb('0x2b')]);_0x4e2ab3=_['difference'](_[_0x15cb('0x29')](_0x32d1e5),[_0x15cb('0x2a'),_0x15cb('0x2b'),_0x15cb('0x2c'),_0x15cb('0x2d')]);if(_0x256f4f[_0x15cb('0x2e')]['id']){delete _0x256f4f[_0x15cb('0x2e')]['id'];}if(_['isNil'](_0x256f4f['body'][_0x15cb('0x2f')])){throw new db[(_0x15cb('0x30'))][(_0x15cb('0x28'))](_0x15cb('0x31'));}if(_[_0x15cb('0x32')](_0x256f4f[_0x15cb('0x2e')][_0x15cb('0x2e')])||_0x256f4f['body'][_0x15cb('0x2e')]===''){throw new db['Sequelize'][(_0x15cb('0x28'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x15cb('0x32')](_0x256f4f[_0x15cb('0x2e')][_0x15cb('0x33')])){throw new db[(_0x15cb('0x30'))][(_0x15cb('0x28'))](_0x15cb('0x34')+_0x4e2ab3);}if(!_[_0x15cb('0x35')](_0x4e2ab3,_0x256f4f[_0x15cb('0x2e')][_0x15cb('0x33')])){throw new db[(_0x15cb('0x30'))][(_0x15cb('0x28'))](_0x15cb('0x36')+_0x4e2ab3);}_0x2432dd[_0x256f4f[_0x15cb('0x2e')][_0x15cb('0x33')]]=_0x256f4f[_0x15cb('0x2e')]['from'];})[_0x15cb('0x10')](function(){return db[_0x15cb('0x37')][_0x15cb('0x38')]({'where':{'id':_0x256f4f['account']['id']},'include':[{'model':db[_0x15cb('0x39')],'as':'List','include':[{'model':db[_0x15cb('0x3a')],'as':_0x15cb('0x3b'),'where':_0x2432dd,'limit':0x1,'order':[[_0x15cb('0x2b'),_0x15cb('0x3c')]]}]},{'model':db['FaxApplication'],'as':_0x15cb('0x3d')}]});})['then'](function(_0x491007){if(_0x491007&&_0x491007[_0x15cb('0x3e')]){var _0x349796=_0x491007['get']({'plain':!![]});_0x39b0aa['account']=_0x349796;_0x39b0aa['applications']=_0x349796[_0x15cb('0x3d')];_0x39b0aa[_0x15cb('0x3f')]=_0x349796[_0x15cb('0x3e')];_0x39b0aa[_0x15cb('0x40')]=_[_0x15cb('0x41')](_0x39b0aa[_0x15cb('0x40')],[_0x15cb('0x42')],[_0x15cb('0x43')]);if(_0x39b0aa[_0x15cb('0x44')]['Applications']){delete _0x39b0aa[_0x15cb('0x44')]['Applications'];}if(_0x39b0aa[_0x15cb('0x44')][_0x15cb('0x3e')]&&_0x39b0aa[_0x15cb('0x44')][_0x15cb('0x3e')][_0x15cb('0x3b')]['length']){return _0x39b0aa[_0x15cb('0x44')][_0x15cb('0x3e')]['Contacts'][0x0];}var _0x3c0933=_[_0x15cb('0xb')](_0x256f4f[_0x15cb('0x2e')],{'firstName':_0x256f4f[_0x15cb('0x2e')][_0x15cb('0x2f')],'ListId':_0x349796[_0x15cb('0x2d')]});_0x3c0933[_0x256f4f['body'][_0x15cb('0x33')]]=_0x256f4f[_0x15cb('0x2e')][_0x15cb('0x2f')];return db[_0x15cb('0x3a')][_0x15cb('0x45')](_0x3c0933,{'fields':_0x2403ea,'raw':!![]});}})[_0x15cb('0x10')](function(_0x3b8a7c){_0x39b0aa[_0x15cb('0x46')]=_0x3b8a7c;if(_0x3b8a7c){var _0x2e337e={'ContactId':_0x3b8a7c['id'],'FaxAccountId':_0x256f4f[_0x15cb('0x44')]['id'],'fax':_0x3b8a7c[_0x15cb('0x26')]};return db[_0x15cb('0x47')][_0x15cb('0x38')]({'where':{'ContactId':_0x3b8a7c['id'],'closed':![],'FaxAccountId':_0x256f4f[_0x15cb('0x44')]['id']}})[_0x15cb('0x10')](function(_0x490698){if(_0x490698){return[_0x490698,![]];}return db[_0x15cb('0x47')]['create'](_0x2e337e)[_0x15cb('0x10')](function(_0xf13202){return[_0xf13202,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x15cb('0x48')](function(_0x59e6b3,_0x56a711){var _0x236f55=_0x59e6b3[_0x15cb('0x49')]({'plain':!![]});if(_0x56a711){if(_0x39b0aa[_0x15cb('0x44')][_0x15cb('0x4a')]){_0x39b0aa[_0x15cb('0x40')][_0x15cb('0x4b')]({'id':0x0,'priority':_0x39b0aa['applications'][_0x15cb('0x4c')]+0x1,'app':'close','appdata':_0x15cb('0x4d'),'interval':_0x15cb('0x4e')});}_0x236f55[_0x15cb('0x4f')]=!![];}else{_0x236f55[_0x15cb('0x4f')]=![];}_0x39b0aa[_0x15cb('0x50')]=_0x236f55;return db[_0x15cb('0x51')]['create']({'body':_0x256f4f['body']['body'],'FaxAccountId':_0x256f4f[_0x15cb('0x44')]['id'],'FaxInteractionId':_0x59e6b3['id'],'direction':'in','ContactId':_0x59e6b3['ContactId'],'AttachmentId':_0x256f4f['body'][_0x15cb('0x52')]});})[_0x15cb('0x10')](function(_0x458319){_0x39b0aa[_0x15cb('0x17')]=_0x458319;if(_0x39b0aa['interaction']['UserId']){return db['User'][_0x15cb('0x38')]({'attributes':['id',_0x15cb('0x53')],'where':{'id':_0x39b0aa['interaction']['UserId']}})['then'](function(_0x1246c1){if(_0x1246c1){_0x39b0aa[_0x15cb('0x40')][_0x15cb('0x54')]({'id':0x0,'priority':0x0,'app':_0x15cb('0x55'),'appdata':_0x1246c1['name']+','+(_0x39b0aa[_0x15cb('0x44')][_0x15cb('0x56')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x15cb('0x57'),_0x15cb('0x58'),_0x39b0aa);});}return respondWithRpcPromise(_0x15cb('0x57'),'startRouting',_0x39b0aa);})['then'](function(_0x1ccc48){_0x54bfff(_0x1ccc48);})[_0x15cb('0x1a')](function(_0x323509){_0x21ca42(_0x21d186[_0x15cb('0x14')](0x1f4,_0x323509[_0x15cb('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index f35fb29..51f86ee 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 _0x4612=['remove','removeListener','register','length','faxAccount:','./faxAccount.events','save'];(function(_0xd2f4ac,_0x5aa8e5){var _0x9757b2=function(_0x442ced){while(--_0x442ced){_0xd2f4ac['push'](_0xd2f4ac['shift']());}};_0x9757b2(++_0x5aa8e5);}(_0x4612,0x155));var _0x2461=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x4612[_0x220dbb];return _0x2b77de;};'use strict';var FaxAccountEvents=require(_0x2461('0x0'));var events=[_0x2461('0x1'),_0x2461('0x2'),'update'];function createListener(_0x25a061,_0x3b7677){return function(_0x3b8f56){_0x3b7677['emit'](_0x25a061,_0x3b8f56);};}function removeListener(_0x380d82,_0x381c5e){return function(){FaxAccountEvents[_0x2461('0x3')](_0x380d82,_0x381c5e);};}exports[_0x2461('0x4')]=function(_0x4a0e6f){for(var _0x4bef8b=0x0,_0x407604=events[_0x2461('0x5')];_0x4bef8b<_0x407604;_0x4bef8b++){var _0xa07dd6=events[_0x4bef8b];var _0xd70456=createListener(_0x2461('0x6')+_0xa07dd6,_0x4a0e6f);FaxAccountEvents['on'](_0xa07dd6,_0xd70456);}}; \ No newline at end of file +var _0x2527=['update','emit','removeListener','length','faxAccount:','./faxAccount.events','save','remove'];(function(_0x52370e,_0x589e8b){var _0xc57e90=function(_0x432e5f){while(--_0x432e5f){_0x52370e['push'](_0x52370e['shift']());}};_0xc57e90(++_0x589e8b);}(_0x2527,0x1ad));var _0x7252=function(_0x1ab28a,_0x1a07ef){_0x1ab28a=_0x1ab28a-0x0;var _0x1889b4=_0x2527[_0x1ab28a];return _0x1889b4;};'use strict';var FaxAccountEvents=require(_0x7252('0x0'));var events=[_0x7252('0x1'),_0x7252('0x2'),_0x7252('0x3')];function createListener(_0x2f343f,_0x5aae4a){return function(_0xaf9dc3){_0x5aae4a[_0x7252('0x4')](_0x2f343f,_0xaf9dc3);};}function removeListener(_0x2e95dc,_0xeef384){return function(){FaxAccountEvents[_0x7252('0x5')](_0x2e95dc,_0xeef384);};}exports['register']=function(_0x214f57){for(var _0x9d585e=0x0,_0x5c6774=events[_0x7252('0x6')];_0x9d585e<_0x5c6774;_0x9d585e++){var _0x5e2177=events[_0x9d585e];var _0x18c379=createListener(_0x7252('0x7')+_0x5e2177,_0x214f57);FaxAccountEvents['on'](_0x5e2177,_0x18c379);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 5c756b3..731ddfe 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(_0x39a764,_0x461979){var _0x2049da=function(_0x22137a){while(--_0x22137a){_0x39a764['push'](_0x39a764['shift']());}};_0x2049da(++_0x461979);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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(_0x3fe65b,_0x13ac2e){var _0x32de12=function(_0x1612d5){while(--_0x1612d5){_0x3fe65b['push'](_0x3fe65b['shift']());}};_0x32de12(++_0x13ac2e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 903c533..1b2b380 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 _0xa660=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0x2ef6d7,_0x58d155){var _0xe84426=function(_0x18d5ad){while(--_0x18d5ad){_0x2ef6d7['push'](_0x2ef6d7['shift']());}};_0xe84426(++_0x58d155);}(_0xa660,0xa9));var _0x0a66=function(_0x566ebd,_0x1830bb){_0x566ebd=_0x566ebd-0x0;var _0x13f852=_0xa660[_0x566ebd];return _0x13f852;};'use strict';var Sequelize=require(_0x0a66('0x0'));module[_0x0a66('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0a66('0x2')],'allowNull':![],'defaultValue':_0x0a66('0x3')},'appdata':{'type':Sequelize[_0x0a66('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a66('0x2')],'defaultValue':_0x0a66('0x5')}}; \ No newline at end of file +var _0x93a8=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x358701,_0x98a09){var _0x5af878=function(_0x23bf11){while(--_0x23bf11){_0x358701['push'](_0x358701['shift']());}};_0x5af878(++_0x98a09);}(_0x93a8,0x123));var _0x893a=function(_0x401f6e,_0x28e13f){_0x401f6e=_0x401f6e-0x0;var _0x348da7=_0x93a8[_0x401f6e];return _0x348da7;};'use strict';var Sequelize=require(_0x893a('0x0'));module[_0x893a('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x893a('0x2')],'allowNull':![],'defaultValue':_0x893a('0x3')},'appdata':{'type':Sequelize[_0x893a('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x893a('0x2')],'defaultValue':_0x893a('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 6e36eb9..c019aab 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 _0xe9ae=['offset','limit','set','Content-Range','reject','save','update','then','stack','name','index','rawAttributes','fieldName','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','type','VIRTUAL','merge','options','includeAll','rows','catch','params','FaxApplication','create','body','destroy','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','count'];(function(_0x74745d,_0x177606){var _0x174ab3=function(_0x1c94e9){while(--_0x1c94e9){_0x74745d['push'](_0x74745d['shift']());}};_0x174ab3(++_0x177606);}(_0xe9ae,0x181));var _0xee9a=function(_0x555a7b,_0x4191f8){_0x555a7b=_0x555a7b-0x0;var _0x1dffa3=_0xe9ae[_0x555a7b];return _0x1dffa3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xee9a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xee9a('0x1'));var rp=require(_0xee9a('0x2'));var moment=require(_0xee9a('0x3'));var BPromise=require(_0xee9a('0x4'));var Mustache=require(_0xee9a('0x5'));var util=require('util');var path=require(_0xee9a('0x6'));var sox=require(_0xee9a('0x7'));var csv=require('to-csv');var ejs=require(_0xee9a('0x8'));var fs=require('fs');var fs_extra=require(_0xee9a('0x9'));var _=require(_0xee9a('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xee9a('0xb'));var toCsv=require(_0xee9a('0xc'));var querystring=require(_0xee9a('0xd'));var Papa=require(_0xee9a('0xe'));var Redis=require(_0xee9a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xee9a('0x10'));var as=require(_0xee9a('0x11'));var hardwareService=require(_0xee9a('0x12'));var logger=require(_0xee9a('0x13'))(_0xee9a('0x14'));var utils=require('../../config/utils');var config=require(_0xee9a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xee9a('0x16'))['db'];function respondWithStatusCode(_0x2491ea,_0x5587e0){_0x5587e0=_0x5587e0||0xcc;return function(_0x593c3b){if(_0x593c3b){return _0x2491ea[_0xee9a('0x17')](_0x5587e0);}return _0x2491ea['status'](_0x5587e0)[_0xee9a('0x18')]();};}function respondWithResult(_0x9e0831,_0x57cebf){_0x57cebf=_0x57cebf||0xc8;return function(_0x5a2064){if(_0x5a2064){return _0x9e0831[_0xee9a('0x19')](_0x57cebf)[_0xee9a('0x1a')](_0x5a2064);}};}function respondWithFilteredResult(_0x1fbfda,_0x3939df){return function(_0x13723b){if(_0x13723b){var _0x32ea3d=typeof _0x3939df['offset']===_0xee9a('0x1b')&&typeof _0x3939df['limit']===_0xee9a('0x1b');var _0x23296f=_0x13723b[_0xee9a('0x1c')];var _0x5673e2=_0x32ea3d?0x0:_0x3939df[_0xee9a('0x1d')];var _0x218f84=_0x32ea3d?_0x13723b['count']:_0x3939df['offset']+_0x3939df[_0xee9a('0x1e')];var _0x58685a;if(_0x218f84>=_0x23296f){_0x218f84=_0x23296f;_0x58685a=0xc8;}else{_0x58685a=0xce;}_0x1fbfda[_0xee9a('0x19')](_0x58685a);return _0x1fbfda[_0xee9a('0x1f')](_0xee9a('0x20'),_0x5673e2+'-'+_0x218f84+'/'+_0x23296f)[_0xee9a('0x1a')](_0x13723b);}return null;};}function patchUpdates(_0x161d00){return function(_0x1a7722){try{jsonpatch['apply'](_0x1a7722,_0x161d00,!![]);}catch(_0x5d1444){return BPromise[_0xee9a('0x21')](_0x5d1444);}return _0x1a7722[_0xee9a('0x22')]();};}function saveUpdates(_0xc72263,_0x5b9636){return function(_0x4b41c5){if(_0x4b41c5){return _0x4b41c5[_0xee9a('0x23')](_0xc72263)[_0xee9a('0x24')](function(_0x33ad4b){return _0x33ad4b;});}return null;};}function removeEntity(_0x471a00,_0x560ac5){return function(_0x2b63d9){if(_0x2b63d9){return _0x2b63d9['destroy']()[_0xee9a('0x24')](function(){_0x471a00[_0xee9a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3378e4,_0x32b583){return function(_0x35ad9f){if(!_0x35ad9f){_0x3378e4[_0xee9a('0x17')](0x194);}return _0x35ad9f;};}function handleError(_0x145172,_0x1b0723){_0x1b0723=_0x1b0723||0x1f4;return function(_0x2e7485){logger['error'](_0x2e7485[_0xee9a('0x25')]);if(_0x2e7485[_0xee9a('0x26')]){delete _0x2e7485[_0xee9a('0x26')];}_0x145172[_0xee9a('0x19')](_0x1b0723)['send'](_0x2e7485);};}exports[_0xee9a('0x27')]=function(_0x4c2a45,_0x2133c6){var _0xc164fd={},_0x36bfec={},_0x25ac83={'count':0x0,'rows':[]};var _0x2bf467=_['map'](db['FaxApplication'][_0xee9a('0x28')],function(_0x13b203){return{'name':_0x13b203[_0xee9a('0x29')],'type':_0x13b203['type']['key']};});_0x36bfec[_0xee9a('0x2a')]=_[_0xee9a('0x2b')](_0x2bf467,_0xee9a('0x26'));_0x36bfec['query']=_[_0xee9a('0x2c')](_0x4c2a45[_0xee9a('0x2d')]);_0x36bfec[_0xee9a('0x2e')]=_[_0xee9a('0x2f')](_0x36bfec[_0xee9a('0x2a')],_0x36bfec[_0xee9a('0x2d')]);_0xc164fd[_0xee9a('0x30')]=_[_0xee9a('0x2f')](_0x36bfec['model'],qs[_0xee9a('0x31')](_0x4c2a45['query'][_0xee9a('0x31')]));_0xc164fd[_0xee9a('0x30')]=_0xc164fd[_0xee9a('0x30')][_0xee9a('0x32')]?_0xc164fd[_0xee9a('0x30')]:_0x36bfec['model'];if(!_0x4c2a45[_0xee9a('0x2d')][_0xee9a('0x33')](_0xee9a('0x34'))){_0xc164fd[_0xee9a('0x1e')]=qs[_0xee9a('0x1e')](_0x4c2a45['query'][_0xee9a('0x1e')]);_0xc164fd[_0xee9a('0x1d')]=qs[_0xee9a('0x1d')](_0x4c2a45[_0xee9a('0x2d')][_0xee9a('0x1d')]);}_0xc164fd['order']=qs[_0xee9a('0x35')](_0x4c2a45['query']['sort']);_0xc164fd['where']=qs[_0xee9a('0x2e')](_['pick'](_0x4c2a45[_0xee9a('0x2d')],_0x36bfec[_0xee9a('0x2e')]),_0x2bf467);if(_0x4c2a45[_0xee9a('0x2d')][_0xee9a('0x36')]){_0xc164fd[_0xee9a('0x37')]=_['merge'](_0xc164fd['where'],{'$or':_[_0xee9a('0x2b')](_0x2bf467,function(_0x5efc20){if(_0x5efc20[_0xee9a('0x38')]!==_0xee9a('0x39')){var _0x342afb={};_0x342afb[_0x5efc20[_0xee9a('0x26')]]={'$like':'%'+_0x4c2a45[_0xee9a('0x2d')][_0xee9a('0x36')]+'%'};return _0x342afb;}})});}_0xc164fd=_[_0xee9a('0x3a')]({},_0xc164fd,_0x4c2a45[_0xee9a('0x3b')]);var _0x34b8f7={'where':_0xc164fd[_0xee9a('0x37')]};return db['FaxApplication'][_0xee9a('0x1c')](_0x34b8f7)[_0xee9a('0x24')](function(_0x3b516e){_0x25ac83['count']=_0x3b516e;if(_0x4c2a45[_0xee9a('0x2d')][_0xee9a('0x3c')]){_0xc164fd['include']=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0xc164fd);})['then'](function(_0x4950f7){_0x25ac83[_0xee9a('0x3d')]=_0x4950f7;return _0x25ac83;})['then'](respondWithFilteredResult(_0x2133c6,_0xc164fd))[_0xee9a('0x3e')](handleError(_0x2133c6,null));};exports['show']=function(_0x22a666,_0x3e927d){var _0x5bd9be={'raw':!![],'where':{'id':_0x22a666[_0xee9a('0x3f')]['id']}},_0x98064a={};_0x98064a['model']=_['keys'](db[_0xee9a('0x40')][_0xee9a('0x28')]);_0x98064a[_0xee9a('0x2d')]=_[_0xee9a('0x2c')](_0x22a666['query']);_0x98064a[_0xee9a('0x2e')]=_[_0xee9a('0x2f')](_0x98064a['model'],_0x98064a['query']);_0x5bd9be[_0xee9a('0x30')]=_[_0xee9a('0x2f')](_0x98064a[_0xee9a('0x2a')],qs[_0xee9a('0x31')](_0x22a666[_0xee9a('0x2d')][_0xee9a('0x31')]));_0x5bd9be[_0xee9a('0x30')]=_0x5bd9be[_0xee9a('0x30')][_0xee9a('0x32')]?_0x5bd9be[_0xee9a('0x30')]:_0x98064a[_0xee9a('0x2a')];if(_0x22a666['query'][_0xee9a('0x3c')]){_0x5bd9be['include']=[{'all':!![]}];}_0x5bd9be=_[_0xee9a('0x3a')]({},_0x5bd9be,_0x22a666[_0xee9a('0x3b')]);return db[_0xee9a('0x40')]['find'](_0x5bd9be)[_0xee9a('0x24')](handleEntityNotFound(_0x3e927d,null))['then'](respondWithResult(_0x3e927d,null))[_0xee9a('0x3e')](handleError(_0x3e927d,null));};exports['create']=function(_0x2991a1,_0x4848c2){return db['FaxApplication'][_0xee9a('0x41')](_0x2991a1[_0xee9a('0x42')],{})['then'](respondWithResult(_0x4848c2,0xc9))[_0xee9a('0x3e')](handleError(_0x4848c2,null));};exports[_0xee9a('0x23')]=function(_0x30574e,_0x454fdb){if(_0x30574e[_0xee9a('0x42')]['id']){delete _0x30574e[_0xee9a('0x42')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x30574e[_0xee9a('0x3f')]['id']}})[_0xee9a('0x24')](handleEntityNotFound(_0x454fdb,null))[_0xee9a('0x24')](saveUpdates(_0x30574e[_0xee9a('0x42')],null))[_0xee9a('0x24')](respondWithResult(_0x454fdb,null))[_0xee9a('0x3e')](handleError(_0x454fdb,null));};exports[_0xee9a('0x43')]=function(_0x32d5a2,_0x3f71b9){return db[_0xee9a('0x40')][_0xee9a('0x44')]({'where':{'id':_0x32d5a2[_0xee9a('0x3f')]['id']}})[_0xee9a('0x24')](handleEntityNotFound(_0x3f71b9,null))[_0xee9a('0x24')](removeEntity(_0x3f71b9,null))['catch'](handleError(_0x3f71b9,null));}; \ No newline at end of file +var _0x42fc=['stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','FaxApplication','show','params','rawAttributes','length','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x42fc,0x1f1));var _0xc42f=function(_0x2999d7,_0x569750){_0x2999d7=_0x2999d7-0x0;var _0x2c9b06=_0x42fc[_0x2999d7];return _0x2c9b06;};'use strict';var emlformat=require(_0xc42f('0x0'));var rimraf=require(_0xc42f('0x1'));var zipdir=require(_0xc42f('0x2'));var jsonpatch=require(_0xc42f('0x3'));var rp=require('request-promise');var moment=require(_0xc42f('0x4'));var BPromise=require(_0xc42f('0x5'));var Mustache=require(_0xc42f('0x6'));var util=require('util');var path=require(_0xc42f('0x7'));var sox=require(_0xc42f('0x8'));var csv=require(_0xc42f('0x9'));var ejs=require(_0xc42f('0xa'));var fs=require('fs');var fs_extra=require(_0xc42f('0xb'));var _=require(_0xc42f('0xc'));var squel=require('squel');var crypto=require(_0xc42f('0xd'));var jsforce=require(_0xc42f('0xe'));var deskjs=require(_0xc42f('0xf'));var toCsv=require(_0xc42f('0x9'));var querystring=require(_0xc42f('0x10'));var Papa=require('papaparse');var Redis=require(_0xc42f('0x11'));var authService=require(_0xc42f('0x12'));var qs=require(_0xc42f('0x13'));var as=require(_0xc42f('0x14'));var hardwareService=require(_0xc42f('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xc42f('0x16'));var config=require(_0xc42f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc42f('0x18'))['db'];function respondWithStatusCode(_0x29e595,_0x3a176f){_0x3a176f=_0x3a176f||0xcc;return function(_0x3eec83){if(_0x3eec83){return _0x29e595[_0xc42f('0x19')](_0x3a176f);}return _0x29e595[_0xc42f('0x1a')](_0x3a176f)[_0xc42f('0x1b')]();};}function respondWithResult(_0xa8a3ff,_0x31e14f){_0x31e14f=_0x31e14f||0xc8;return function(_0x7112f5){if(_0x7112f5){return _0xa8a3ff[_0xc42f('0x1a')](_0x31e14f)[_0xc42f('0x1c')](_0x7112f5);}};}function respondWithFilteredResult(_0x32b7e2,_0x49b550){return function(_0x1b6226){if(_0x1b6226){var _0x505bc4=typeof _0x49b550[_0xc42f('0x1d')]===_0xc42f('0x1e')&&typeof _0x49b550['limit']===_0xc42f('0x1e');var _0x57aae1=_0x1b6226[_0xc42f('0x1f')];var _0x1542e9=_0x505bc4?0x0:_0x49b550[_0xc42f('0x1d')];var _0x532dec=_0x505bc4?_0x1b6226['count']:_0x49b550[_0xc42f('0x1d')]+_0x49b550[_0xc42f('0x20')];var _0x24ad26;if(_0x532dec>=_0x57aae1){_0x532dec=_0x57aae1;_0x24ad26=0xc8;}else{_0x24ad26=0xce;}_0x32b7e2[_0xc42f('0x1a')](_0x24ad26);return _0x32b7e2[_0xc42f('0x21')](_0xc42f('0x22'),_0x1542e9+'-'+_0x532dec+'/'+_0x57aae1)['json'](_0x1b6226);}return null;};}function patchUpdates(_0x48374a){return function(_0x5d910b){try{jsonpatch[_0xc42f('0x23')](_0x5d910b,_0x48374a,!![]);}catch(_0x5f47e6){return BPromise[_0xc42f('0x24')](_0x5f47e6);}return _0x5d910b[_0xc42f('0x25')]();};}function saveUpdates(_0x551bb7,_0x52eacc){return function(_0x39fb2d){if(_0x39fb2d){return _0x39fb2d[_0xc42f('0x26')](_0x551bb7)[_0xc42f('0x27')](function(_0x2ad427){return _0x2ad427;});}return null;};}function removeEntity(_0x3bf4c9,_0x5ac79f){return function(_0x116201){if(_0x116201){return _0x116201[_0xc42f('0x28')]()['then'](function(){_0x3bf4c9['status'](0xcc)[_0xc42f('0x1b')]();});}};}function handleEntityNotFound(_0x13573c,_0x530592){return function(_0x422406){if(!_0x422406){_0x13573c[_0xc42f('0x19')](0x194);}return _0x422406;};}function handleError(_0x28d3e2,_0x215bc5){_0x215bc5=_0x215bc5||0x1f4;return function(_0xfc44b3){logger[_0xc42f('0x29')](_0xfc44b3[_0xc42f('0x2a')]);if(_0xfc44b3[_0xc42f('0x2b')]){delete _0xfc44b3[_0xc42f('0x2b')];}_0x28d3e2[_0xc42f('0x1a')](_0x215bc5)[_0xc42f('0x2c')](_0xfc44b3);};}exports[_0xc42f('0x2d')]=function(_0x5eba7a,_0x2aa6ed){var _0x493da1={},_0x1d8f33={},_0x4ecc89={'count':0x0,'rows':[]};var _0x108fd2=_[_0xc42f('0x2e')](db['FaxApplication']['rawAttributes'],function(_0x487bf7){return{'name':_0x487bf7[_0xc42f('0x2f')],'type':_0x487bf7[_0xc42f('0x30')]['key']};});_0x1d8f33[_0xc42f('0x31')]=_[_0xc42f('0x2e')](_0x108fd2,_0xc42f('0x2b'));_0x1d8f33[_0xc42f('0x32')]=_[_0xc42f('0x33')](_0x5eba7a['query']);_0x1d8f33[_0xc42f('0x34')]=_[_0xc42f('0x35')](_0x1d8f33[_0xc42f('0x31')],_0x1d8f33[_0xc42f('0x32')]);_0x493da1[_0xc42f('0x36')]=_[_0xc42f('0x35')](_0x1d8f33['model'],qs[_0xc42f('0x37')](_0x5eba7a[_0xc42f('0x32')][_0xc42f('0x37')]));_0x493da1[_0xc42f('0x36')]=_0x493da1['attributes']['length']?_0x493da1[_0xc42f('0x36')]:_0x1d8f33[_0xc42f('0x31')];if(!_0x5eba7a[_0xc42f('0x32')][_0xc42f('0x38')](_0xc42f('0x39'))){_0x493da1[_0xc42f('0x20')]=qs[_0xc42f('0x20')](_0x5eba7a['query'][_0xc42f('0x20')]);_0x493da1[_0xc42f('0x1d')]=qs[_0xc42f('0x1d')](_0x5eba7a[_0xc42f('0x32')][_0xc42f('0x1d')]);}_0x493da1[_0xc42f('0x3a')]=qs['sort'](_0x5eba7a[_0xc42f('0x32')][_0xc42f('0x3b')]);_0x493da1['where']=qs[_0xc42f('0x34')](_[_0xc42f('0x3c')](_0x5eba7a['query'],_0x1d8f33[_0xc42f('0x34')]),_0x108fd2);if(_0x5eba7a[_0xc42f('0x32')]['filter']){_0x493da1[_0xc42f('0x3d')]=_[_0xc42f('0x3e')](_0x493da1['where'],{'$or':_[_0xc42f('0x2e')](_0x108fd2,function(_0x1502d3){if(_0x1502d3[_0xc42f('0x30')]!==_0xc42f('0x3f')){var _0x2c90d4={};_0x2c90d4[_0x1502d3[_0xc42f('0x2b')]]={'$like':'%'+_0x5eba7a[_0xc42f('0x32')][_0xc42f('0x40')]+'%'};return _0x2c90d4;}})});}_0x493da1=_[_0xc42f('0x3e')]({},_0x493da1,_0x5eba7a['options']);var _0xc0c0eb={'where':_0x493da1[_0xc42f('0x3d')]};return db['FaxApplication'][_0xc42f('0x1f')](_0xc0c0eb)['then'](function(_0x52d36b){_0x4ecc89[_0xc42f('0x1f')]=_0x52d36b;if(_0x5eba7a[_0xc42f('0x32')][_0xc42f('0x41')]){_0x493da1[_0xc42f('0x42')]=[{'all':!![]}];}return db[_0xc42f('0x43')]['findAll'](_0x493da1);})['then'](function(_0x55f33d){_0x4ecc89['rows']=_0x55f33d;return _0x4ecc89;})['then'](respondWithFilteredResult(_0x2aa6ed,_0x493da1))['catch'](handleError(_0x2aa6ed,null));};exports[_0xc42f('0x44')]=function(_0x9a888d,_0x348919){var _0x35dcb1={'raw':!![],'where':{'id':_0x9a888d[_0xc42f('0x45')]['id']}},_0x264919={};_0x264919['model']=_[_0xc42f('0x33')](db[_0xc42f('0x43')][_0xc42f('0x46')]);_0x264919[_0xc42f('0x32')]=_[_0xc42f('0x33')](_0x9a888d[_0xc42f('0x32')]);_0x264919['filters']=_[_0xc42f('0x35')](_0x264919['model'],_0x264919[_0xc42f('0x32')]);_0x35dcb1[_0xc42f('0x36')]=_[_0xc42f('0x35')](_0x264919['model'],qs[_0xc42f('0x37')](_0x9a888d[_0xc42f('0x32')][_0xc42f('0x37')]));_0x35dcb1[_0xc42f('0x36')]=_0x35dcb1['attributes'][_0xc42f('0x47')]?_0x35dcb1['attributes']:_0x264919[_0xc42f('0x31')];if(_0x9a888d['query']['includeAll']){_0x35dcb1['include']=[{'all':!![]}];}_0x35dcb1=_[_0xc42f('0x3e')]({},_0x35dcb1,_0x9a888d[_0xc42f('0x48')]);return db[_0xc42f('0x43')][_0xc42f('0x49')](_0x35dcb1)['then'](handleEntityNotFound(_0x348919,null))[_0xc42f('0x27')](respondWithResult(_0x348919,null))[_0xc42f('0x4a')](handleError(_0x348919,null));};exports[_0xc42f('0x4b')]=function(_0x154649,_0x5d6b62){return db[_0xc42f('0x43')][_0xc42f('0x4b')](_0x154649['body'],{})[_0xc42f('0x27')](respondWithResult(_0x5d6b62,0xc9))[_0xc42f('0x4a')](handleError(_0x5d6b62,null));};exports[_0xc42f('0x26')]=function(_0x302bbf,_0xf24aaa){if(_0x302bbf[_0xc42f('0x4c')]['id']){delete _0x302bbf[_0xc42f('0x4c')]['id'];}return db[_0xc42f('0x43')][_0xc42f('0x49')]({'where':{'id':_0x302bbf[_0xc42f('0x45')]['id']}})[_0xc42f('0x27')](handleEntityNotFound(_0xf24aaa,null))[_0xc42f('0x27')](saveUpdates(_0x302bbf[_0xc42f('0x4c')],null))[_0xc42f('0x27')](respondWithResult(_0xf24aaa,null))['catch'](handleError(_0xf24aaa,null));};exports[_0xc42f('0x28')]=function(_0x5ea895,_0x752669){return db[_0xc42f('0x43')][_0xc42f('0x49')]({'where':{'id':_0x5ea895['params']['id']}})[_0xc42f('0x27')](handleEntityNotFound(_0x752669,null))[_0xc42f('0x27')](removeEntity(_0x752669,null))['catch'](handleError(_0x752669,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 17539b1..866fc32 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 _0x25b6=['path','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','lodash','util','api','moment','request-promise'];(function(_0x302f67,_0x56a4b1){var _0x5d09bb=function(_0x252632){while(--_0x252632){_0x302f67['push'](_0x302f67['shift']());}};_0x5d09bb(++_0x56a4b1);}(_0x25b6,0xdf));var _0x625b=function(_0x142156,_0x5169f8){_0x142156=_0x142156-0x0;var _0x5b1ea3=_0x25b6[_0x142156];return _0x5b1ea3;};'use strict';var _=require(_0x625b('0x0'));var util=require(_0x625b('0x1'));var logger=require('../../config/logger')(_0x625b('0x2'));var moment=require(_0x625b('0x3'));var BPromise=require('bluebird');var rp=require(_0x625b('0x4'));var fs=require('fs');var path=require(_0x625b('0x5'));var rimraf=require('rimraf');var config=require(_0x625b('0x6'));var attributes=require(_0x625b('0x7'));module[_0x625b('0x8')]=function(_0x1f0ed8,_0x2b9c31){return _0x1f0ed8[_0x625b('0x9')](_0x625b('0xa'),attributes,{'tableName':_0x625b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbfd1=['path','rimraf','../../config/environment','./faxApplication.attributes','exports','fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1a4b25,_0x4ef579){var _0x2d19fd=function(_0x468f7a){while(--_0x468f7a){_0x1a4b25['push'](_0x1a4b25['shift']());}};_0x2d19fd(++_0x4ef579);}(_0xbfd1,0xcb));var _0x1bfd=function(_0x26b8b5,_0xf5c2c1){_0x26b8b5=_0x26b8b5-0x0;var _0x2150a9=_0xbfd1[_0x26b8b5];return _0x2150a9;};'use strict';var _=require(_0x1bfd('0x0'));var util=require(_0x1bfd('0x1'));var logger=require(_0x1bfd('0x2'))(_0x1bfd('0x3'));var moment=require(_0x1bfd('0x4'));var BPromise=require(_0x1bfd('0x5'));var rp=require(_0x1bfd('0x6'));var fs=require('fs');var path=require(_0x1bfd('0x7'));var rimraf=require(_0x1bfd('0x8'));var config=require(_0x1bfd('0x9'));var attributes=require(_0x1bfd('0xa'));module[_0x1bfd('0xb')]=function(_0x344126,_0x3a7c74){return _0x344126['define']('FaxApplication',attributes,{'tableName':_0x1bfd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1bfd('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index a7744c6..b73a1d4 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 _0xd8af=['attributes','limit','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','FaxApplication,\x20%s,\x20%s','debug','error','message','request\x20sent','result','UpdateFaxApplication','FaxApplication','update','body','options','raw','where'];(function(_0x18615a,_0x2b272e){var _0x2c8481=function(_0x376782){while(--_0x376782){_0x18615a['push'](_0x18615a['shift']());}};_0x2c8481(++_0x2b272e);}(_0xd8af,0x142));var _0xfd8a=function(_0x811f77,_0x37f525){_0x811f77=_0x811f77-0x0;var _0x1e8f12=_0xd8af[_0x811f77];return _0x1e8f12;};'use strict';var _=require(_0xfd8a('0x0'));var util=require(_0xfd8a('0x1'));var moment=require(_0xfd8a('0x2'));var BPromise=require(_0xfd8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd8a('0x4'));var db=require(_0xfd8a('0x5'))['db'];var utils=require(_0xfd8a('0x6'));var logger=require('../../config/logger')(_0xfd8a('0x7'));var config=require('../../config/environment');var jayson=require(_0xfd8a('0x8'));var client=jayson[_0xfd8a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5260c4,_0x1f132d,_0x344457){return new BPromise(function(_0x20a4fa,_0x4a32e3){return client[_0xfd8a('0xa')](_0x5260c4,_0x344457)[_0xfd8a('0xb')](function(_0x124962){logger[_0xfd8a('0xc')](_0xfd8a('0xd'),_0x1f132d,'request\x20sent');logger[_0xfd8a('0xe')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x1f132d,'request\x20sent',JSON['stringify'](_0x124962));if(_0x124962[_0xfd8a('0xf')]){if(_0x124962[_0xfd8a('0xf')]['code']===0x1f4){logger[_0xfd8a('0xf')](_0xfd8a('0xd'),_0x1f132d,_0x124962[_0xfd8a('0xf')]['message']);return _0x4a32e3(_0x124962[_0xfd8a('0xf')][_0xfd8a('0x10')]);}logger[_0xfd8a('0xf')](_0xfd8a('0xd'),_0x1f132d,_0x124962[_0xfd8a('0xf')]['message']);return _0x20a4fa(_0x124962[_0xfd8a('0xf')][_0xfd8a('0x10')]);}else{logger[_0xfd8a('0xc')](_0xfd8a('0xd'),_0x1f132d,_0xfd8a('0x11'));_0x20a4fa(_0x124962[_0xfd8a('0x12')]['message']);}})['catch'](function(_0x240770){logger['error'](_0xfd8a('0xd'),_0x1f132d,_0x240770);_0x4a32e3(_0x240770);});});}exports[_0xfd8a('0x13')]=function(_0x546f91){var _0x2f258d=this;return new Promise(function(_0x5b518d,_0x113d2f){return db[_0xfd8a('0x14')][_0xfd8a('0x15')](_0x546f91[_0xfd8a('0x16')],{'raw':_0x546f91[_0xfd8a('0x17')]?_0x546f91[_0xfd8a('0x17')][_0xfd8a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x546f91[_0xfd8a('0x17')]?_0x546f91[_0xfd8a('0x17')][_0xfd8a('0x19')]||null:null,'attributes':_0x546f91[_0xfd8a('0x17')]?_0x546f91[_0xfd8a('0x17')][_0xfd8a('0x1a')]||null:null,'limit':_0x546f91[_0xfd8a('0x17')]?_0x546f91[_0xfd8a('0x17')][_0xfd8a('0x1b')]||null:null})['then'](function(_0x24ce07){logger[_0xfd8a('0xc')]('UpdateFaxApplication',_0x546f91);logger[_0xfd8a('0xe')](_0xfd8a('0x13'),_0x546f91,JSON['stringify'](_0x24ce07));_0x5b518d(_0x24ce07);})[_0xfd8a('0x1c')](function(_0xf5b798){logger[_0xfd8a('0xf')]('UpdateFaxApplication',_0xf5b798[_0xfd8a('0x10')],_0x546f91);_0x113d2f(_0x2f258d[_0xfd8a('0xf')](0x1f4,_0xf5b798[_0xfd8a('0x10')]));});});}; \ No newline at end of file +var _0x3d7b=['bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxApplication','update','body','options','raw','attributes','limit','then','lodash','moment'];(function(_0x3b84c1,_0x2169a0){var _0x136760=function(_0x46b3f1){while(--_0x46b3f1){_0x3b84c1['push'](_0x3b84c1['shift']());}};_0x136760(++_0x2169a0);}(_0x3d7b,0x194));var _0xb3d7=function(_0x569ebc,_0x415cde){_0x569ebc=_0x569ebc-0x0;var _0xacee87=_0x3d7b[_0x569ebc];return _0xacee87;};'use strict';var _=require(_0xb3d7('0x0'));var util=require('util');var moment=require(_0xb3d7('0x1'));var BPromise=require(_0xb3d7('0x2'));var rs=require(_0xb3d7('0x3'));var fs=require('fs');var Redis=require(_0xb3d7('0x4'));var db=require(_0xb3d7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb3d7('0x6'));var config=require(_0xb3d7('0x7'));var jayson=require(_0xb3d7('0x8'));var client=jayson[_0xb3d7('0x9')][_0xb3d7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37aeec,_0x2b9fff,_0x15dbde){return new BPromise(function(_0x5271f6,_0x1480fa){return client[_0xb3d7('0xb')](_0x37aeec,_0x15dbde)['then'](function(_0x1dafa6){logger[_0xb3d7('0xc')](_0xb3d7('0xd'),_0x2b9fff,_0xb3d7('0xe'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x2b9fff,_0xb3d7('0xe'),JSON[_0xb3d7('0xf')](_0x1dafa6));if(_0x1dafa6['error']){if(_0x1dafa6[_0xb3d7('0x10')][_0xb3d7('0x11')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x2b9fff,_0x1dafa6[_0xb3d7('0x10')][_0xb3d7('0x12')]);return _0x1480fa(_0x1dafa6[_0xb3d7('0x10')][_0xb3d7('0x12')]);}logger[_0xb3d7('0x10')]('FaxApplication,\x20%s,\x20%s',_0x2b9fff,_0x1dafa6[_0xb3d7('0x10')]['message']);return _0x5271f6(_0x1dafa6[_0xb3d7('0x10')][_0xb3d7('0x12')]);}else{logger[_0xb3d7('0xc')](_0xb3d7('0xd'),_0x2b9fff,_0xb3d7('0xe'));_0x5271f6(_0x1dafa6[_0xb3d7('0x13')]['message']);}})[_0xb3d7('0x14')](function(_0xccceaa){logger['error']('FaxApplication,\x20%s,\x20%s',_0x2b9fff,_0xccceaa);_0x1480fa(_0xccceaa);});});}exports[_0xb3d7('0x15')]=function(_0x3255ba){var _0x29c885=this;return new Promise(function(_0x12f334,_0x3afc77){return db['FaxApplication'][_0xb3d7('0x16')](_0x3255ba[_0xb3d7('0x17')],{'raw':_0x3255ba[_0xb3d7('0x18')]?_0x3255ba[_0xb3d7('0x18')][_0xb3d7('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3255ba[_0xb3d7('0x18')]?_0x3255ba[_0xb3d7('0x18')]['where']||null:null,'attributes':_0x3255ba[_0xb3d7('0x18')]?_0x3255ba[_0xb3d7('0x18')][_0xb3d7('0x1a')]||null:null,'limit':_0x3255ba[_0xb3d7('0x18')]?_0x3255ba[_0xb3d7('0x18')][_0xb3d7('0x1b')]||null:null})[_0xb3d7('0x1c')](function(_0xda311d){logger[_0xb3d7('0xc')](_0xb3d7('0x15'),_0x3255ba);logger['debug'](_0xb3d7('0x15'),_0x3255ba,JSON[_0xb3d7('0xf')](_0xda311d));_0x12f334(_0xda311d);})['catch'](function(_0x2d12b3){logger[_0xb3d7('0x10')](_0xb3d7('0x15'),_0x2d12b3['message'],_0x3255ba);_0x3afc77(_0x29c885[_0xb3d7('0x10')](0x1f4,_0x2d12b3[_0xb3d7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 7f5e2b4..3a43e3f 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 _0x4cf8=['show','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated'];(function(_0x10d670,_0x178996){var _0x20d6f8=function(_0x4a4b87){while(--_0x4a4b87){_0x10d670['push'](_0x10d670['shift']());}};_0x20d6f8(++_0x178996);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x5e4ffa,_0x56154d){_0x5e4ffa=_0x5e4ffa-0x0;var _0x43a656=_0x4cf8[_0x5e4ffa];return _0x43a656;};'use strict';var multer=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var path=require(_0x84cf('0x2'));var timeout=require(_0x84cf('0x3'));var express=require(_0x84cf('0x4'));var router=express[_0x84cf('0x5')]();var fs_extra=require(_0x84cf('0x6'));var auth=require(_0x84cf('0x7'));var interaction=require(_0x84cf('0x8'));var config=require(_0x84cf('0x9'));var controller=require(_0x84cf('0xa'));router[_0x84cf('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x84cf('0xb')]('/:id',auth[_0x84cf('0xc')](),controller[_0x84cf('0xd')]);router['post']('/',auth[_0x84cf('0xc')](),controller[_0x84cf('0xe')]);router['put'](_0x84cf('0xf'),auth[_0x84cf('0xc')](),controller[_0x84cf('0x10')]);router[_0x84cf('0x11')]('/:id',auth[_0x84cf('0xc')](),controller[_0x84cf('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0b0e=['./faxApplication.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x160e80,_0x52a4f3){var _0x328e25=function(_0x4d48fb){while(--_0x4d48fb){_0x160e80['push'](_0x160e80['shift']());}};_0x328e25(++_0x52a4f3);}(_0x0b0e,0x187));var _0xe0b0=function(_0x189305,_0x46c43f){_0x189305=_0x189305-0x0;var _0xea3406=_0x0b0e[_0x189305];return _0xea3406;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 4d3c05e..f4c58af 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 _0xa85b=['sequelize','exports','DATE','STRING','ENUM','out'];(function(_0x2381b8,_0x367413){var _0x11fe01=function(_0x357f62){while(--_0x357f62){_0x2381b8['push'](_0x2381b8['shift']());}};_0x11fe01(++_0x367413);}(_0xa85b,0x1ec));var _0xba85=function(_0xaed9,_0x41bdf0){_0xaed9=_0xaed9-0x0;var _0x5ba6d7=_0xa85b[_0xaed9];return _0x5ba6d7;};'use strict';var Sequelize=require(_0xba85('0x0'));module[_0xba85('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xba85('0x2')]},'disposition':{'type':Sequelize[_0xba85('0x3')]},'secondDisposition':{'type':Sequelize[_0xba85('0x3')]},'thirdDisposition':{'type':Sequelize[_0xba85('0x3')]},'note':{'type':Sequelize[_0xba85('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xba85('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xba85('0x4')]('in',_0xba85('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xba85('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xba85('0x4')]('in',_0xba85('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xb79f=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x2522fa,_0x1964ed){var _0x362cc2=function(_0x1b3710){while(--_0x1b3710){_0x2522fa['push'](_0x2522fa['shift']());}};_0x362cc2(++_0x1964ed);}(_0xb79f,0x161));var _0xfb79=function(_0x111494,_0x1d73da){_0x111494=_0x111494-0x0;var _0x1d0d8b=_0xb79f[_0x111494];return _0x1d0d8b;};'use strict';var Sequelize=require(_0xfb79('0x0'));module[_0xfb79('0x1')]={'closed':{'type':Sequelize[_0xfb79('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfb79('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xfb79('0x4')]},'thirdDisposition':{'type':Sequelize[_0xfb79('0x4')]},'note':{'type':Sequelize[_0xfb79('0x4')]},'read1stAt':{'type':Sequelize[_0xfb79('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfb79('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xfb79('0x5')]('in',_0xfb79('0x6')),'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 f12aa0e..b0267d1 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 _0xf988=['unix','toString','join','root','server','files','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','basename','createReadStream','pipe','createWriteStream','resolve','log','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','end','status','json','undefined','limit','count','offset','set','Content-Range','then','destroy','sendStatus','error','name','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax','query','user','catch','show','params','model','keys','intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','update','describe','addMessage','FaxMessage','ids','omit','findOne','hasOwnProperty','nolimit','order','sort','where','filters','pick','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','emit','faxInteractionTags:save','removeTags','download'];(function(_0x20af04,_0x67b883){var _0x1c194a=function(_0x3e6736){while(--_0x3e6736){_0x20af04['push'](_0x20af04['shift']());}};_0x1c194a(++_0x67b883);}(_0xf988,0x1b3));var _0x8f98=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf988[_0xa464c9];return _0x3d73c4;};'use strict';var rimraf=require(_0x8f98('0x0'));var zipdir=require(_0x8f98('0x1'));var moment=require(_0x8f98('0x2'));var BPromise=require(_0x8f98('0x3'));var util=require(_0x8f98('0x4'));var path=require(_0x8f98('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x8f98('0x6'));var interaction=require(_0x8f98('0x7'));var qs=require(_0x8f98('0x8'));var logger=require('../../config/logger')(_0x8f98('0x9'));var config=require(_0x8f98('0xa'));var db=require(_0x8f98('0xb'))['db'];config[_0x8f98('0xc')]=_[_0x8f98('0xd')](config[_0x8f98('0xc')],{'host':_0x8f98('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxInteraction.socket')[_0x8f98('0xf')](socket);function respondWithStatusCode(_0x1f0645,_0x5c563f){_0x5c563f=_0x5c563f||0xcc;return function(_0x570f1c){if(_0x570f1c){return _0x1f0645['sendStatus'](_0x5c563f);}return _0x1f0645['status'](_0x5c563f)[_0x8f98('0x10')]();};}function respondWithResult(_0x34f2c7,_0x242e27){_0x242e27=_0x242e27||0xc8;return function(_0x1610ae){if(_0x1610ae){return _0x34f2c7[_0x8f98('0x11')](_0x242e27)[_0x8f98('0x12')](_0x1610ae);}};}function respondWithFilteredResult(_0xf4ba51,_0x4fff6c){return function(_0x4c8c5c){if(_0x4c8c5c){var _0xb06e55=typeof _0x4fff6c['offset']===_0x8f98('0x13')&&typeof _0x4fff6c[_0x8f98('0x14')]===_0x8f98('0x13');var _0x22770e=_0x4c8c5c[_0x8f98('0x15')];var _0x40cf54=_0xb06e55?0x0:_0x4fff6c[_0x8f98('0x16')];var _0x496e2e=_0xb06e55?_0x4c8c5c[_0x8f98('0x15')]:_0x4fff6c['offset']+_0x4fff6c[_0x8f98('0x14')];var _0x3d2480;if(_0x496e2e>=_0x22770e){_0x496e2e=_0x22770e;_0x3d2480=0xc8;}else{_0x3d2480=0xce;}_0xf4ba51[_0x8f98('0x11')](_0x3d2480);return _0xf4ba51[_0x8f98('0x17')](_0x8f98('0x18'),_0x40cf54+'-'+_0x496e2e+'/'+_0x22770e)[_0x8f98('0x12')](_0x4c8c5c);}return null;};}function saveUpdates(_0x592fc8){return function(_0x1f7d07){if(_0x1f7d07){return _0x1f7d07['update'](_0x592fc8)[_0x8f98('0x19')](function(_0x557f96){return _0x557f96;});}return null;};}function removeEntity(_0xddd105){return function(_0x188510){if(_0x188510){return _0x188510[_0x8f98('0x1a')]()[_0x8f98('0x19')](function(){_0xddd105[_0x8f98('0x11')](0xcc)[_0x8f98('0x10')]();});}};}function handleEntityNotFound(_0xcf9a39){return function(_0x7a6470){if(!_0x7a6470){_0xcf9a39[_0x8f98('0x1b')](0x194);}return _0x7a6470;};}function handleError(_0x56a83f,_0xe3d1dc){_0xe3d1dc=_0xe3d1dc||0x1f4;return function(_0x849c56){logger[_0x8f98('0x1c')](_0x849c56['stack']);if(_0x849c56['name']){delete _0x849c56[_0x8f98('0x1d')];}_0x56a83f[_0x8f98('0x11')](_0xe3d1dc)['send'](_0x849c56);};}exports[_0x8f98('0x1e')]=function(_0xff2c63,_0x19b89d){var _0x54f358={};var _0x308d4e=_[_0x8f98('0x1f')](db[_0x8f98('0x20')][_0x8f98('0x21')],function(_0x4cf518){return{'name':_0x4cf518[_0x8f98('0x22')],'type':_0x4cf518[_0x8f98('0x23')][_0x8f98('0x24')]};});_0x54f358=qs[_0x8f98('0x25')](_0x308d4e,_0xff2c63);return interaction[_0x8f98('0x26')](_0x8f98('0x27'),_0xff2c63[_0x8f98('0x28')],_0xff2c63[_0x8f98('0x29')],_0x54f358,_0x308d4e)['then'](respondWithFilteredResult(_0x19b89d,_0x54f358))[_0x8f98('0x2a')](handleError(_0x19b89d,null));};exports[_0x8f98('0x2b')]=function(_0x193ac2,_0x41799b){var _0x5d4a80={'raw':![],'where':{'id':_0x193ac2[_0x8f98('0x2c')]['id']}},_0x182955={};_0x182955[_0x8f98('0x2d')]=_['keys'](db[_0x8f98('0x20')][_0x8f98('0x21')]);_0x182955[_0x8f98('0x28')]=_[_0x8f98('0x2e')](_0x193ac2[_0x8f98('0x28')]);_0x182955['filters']=_['intersection'](_0x182955[_0x8f98('0x2d')],_0x182955['query']);_0x5d4a80['attributes']=_[_0x8f98('0x2f')](_0x182955[_0x8f98('0x2d')],qs['fields'](_0x193ac2[_0x8f98('0x28')][_0x8f98('0x30')]));_0x5d4a80[_0x8f98('0x31')]=_0x5d4a80[_0x8f98('0x31')][_0x8f98('0x32')]?_0x5d4a80[_0x8f98('0x31')]:_0x182955['model'];if(_0x193ac2[_0x8f98('0x28')][_0x8f98('0x33')]){_0x5d4a80[_0x8f98('0x34')]=[{'all':!![]}];}_0x5d4a80=_[_0x8f98('0x35')]({},_0x5d4a80,_0x193ac2[_0x8f98('0x36')]);return db[_0x8f98('0x20')][_0x8f98('0x37')](_0x5d4a80)['then'](handleEntityNotFound(_0x41799b,null))[_0x8f98('0x19')](respondWithResult(_0x41799b,null))[_0x8f98('0x2a')](handleError(_0x41799b,null));};exports[_0x8f98('0x38')]=function(_0x1a0abf,_0x170f01){return db[_0x8f98('0x20')]['create'](_0x1a0abf[_0x8f98('0x39')],{})[_0x8f98('0x19')](respondWithResult(_0x170f01,0xc9))[_0x8f98('0x2a')](handleError(_0x170f01,null));};exports[_0x8f98('0x3a')]=function(_0x58b394,_0x3d78c7){if(_0x58b394[_0x8f98('0x39')]['id']){delete _0x58b394[_0x8f98('0x39')]['id'];}return db['FaxInteraction'][_0x8f98('0x37')]({'where':{'id':_0x58b394['params']['id']}})[_0x8f98('0x19')](handleEntityNotFound(_0x3d78c7,null))['then'](saveUpdates(_0x58b394[_0x8f98('0x39')],null))[_0x8f98('0x19')](respondWithResult(_0x3d78c7,null))[_0x8f98('0x2a')](handleError(_0x3d78c7,null));};exports['destroy']=function(_0x91ded0,_0x1ae8f3){return db[_0x8f98('0x20')][_0x8f98('0x37')]({'where':{'id':_0x91ded0[_0x8f98('0x2c')]['id']}})[_0x8f98('0x19')](handleEntityNotFound(_0x1ae8f3,null))[_0x8f98('0x19')](removeEntity(_0x1ae8f3,null))[_0x8f98('0x2a')](handleError(_0x1ae8f3,null));};exports[_0x8f98('0x3b')]=function(_0x110830,_0x13439c){return db[_0x8f98('0x20')][_0x8f98('0x3b')]()[_0x8f98('0x19')](respondWithResult(_0x13439c,null))[_0x8f98('0x2a')](handleError(_0x13439c,null));};exports[_0x8f98('0x3c')]=function(_0x179832,_0x3117c4){return db[_0x8f98('0x3d')][_0x8f98('0x37')]({'where':{'id':_0x179832[_0x8f98('0x2c')]['id']}})[_0x8f98('0x19')](handleEntityNotFound(_0x3117c4,null))['then'](function(_0x356009){if(_0x356009){return _0x356009['addMessage'](_0x179832[_0x8f98('0x39')][_0x8f98('0x3e')],_[_0x8f98('0x3f')](_0x179832[_0x8f98('0x39')],[_0x8f98('0x3e'),'id'])||{});}})[_0x8f98('0x19')](respondWithResult(_0x3117c4,null))['catch'](handleError(_0x3117c4,null));};exports['getMessages']=function(_0x123af1,_0x1192d3){var _0x21b6e1={'raw':![],'where':{}};var _0x4cc0c6={};var _0x3212ff={'count':0x0,'rows':[]};return db[_0x8f98('0x20')][_0x8f98('0x40')]({'where':{'id':_0x123af1[_0x8f98('0x2c')]['id']}})[_0x8f98('0x19')](handleEntityNotFound(_0x1192d3,null))[_0x8f98('0x19')](function(_0xa28589){if(_0xa28589){_0x4cc0c6[_0x8f98('0x2d')]=_[_0x8f98('0x2e')](db[_0x8f98('0x3d')][_0x8f98('0x21')]);_0x4cc0c6[_0x8f98('0x28')]=_[_0x8f98('0x2e')](_0x123af1['query']);_0x4cc0c6['filters']=_['intersection'](_0x4cc0c6['model'],_0x4cc0c6[_0x8f98('0x28')]);_0x21b6e1['attributes']=_[_0x8f98('0x2f')](_0x4cc0c6[_0x8f98('0x2d')],qs[_0x8f98('0x30')](_0x123af1['query'][_0x8f98('0x30')]));_0x21b6e1[_0x8f98('0x31')]=_0x21b6e1['attributes'][_0x8f98('0x32')]?_0x21b6e1[_0x8f98('0x31')]:_0x4cc0c6['model'];if(!_0x123af1[_0x8f98('0x28')][_0x8f98('0x41')](_0x8f98('0x42'))){_0x21b6e1[_0x8f98('0x14')]=qs['limit'](_0x123af1['query']['limit']);_0x21b6e1[_0x8f98('0x16')]=qs['offset'](_0x123af1[_0x8f98('0x28')][_0x8f98('0x16')]);}_0x21b6e1[_0x8f98('0x43')]=qs['sort'](_0x123af1[_0x8f98('0x28')][_0x8f98('0x44')]);_0x21b6e1[_0x8f98('0x45')]=qs[_0x8f98('0x46')](_[_0x8f98('0x47')](_0x123af1[_0x8f98('0x28')],_0x4cc0c6[_0x8f98('0x46')]));_0x21b6e1['where'][_0x8f98('0x48')]=_0xa28589['id'];if(_0x123af1[_0x8f98('0x28')][_0x8f98('0x49')]){_0x21b6e1[_0x8f98('0x45')]=_[_0x8f98('0x35')](_0x21b6e1[_0x8f98('0x45')],{'$or':_[_0x8f98('0x1f')](_0x21b6e1[_0x8f98('0x31')],function(_0x1bf01b){var _0x2353da={};_0x2353da[_0x1bf01b]={'$like':'%'+_0x123af1[_0x8f98('0x28')][_0x8f98('0x49')]+'%'};return _0x2353da;})});}if(_0x123af1[_0x8f98('0x28')][_0x8f98('0x4a')]){var _0x2d9f63=_0x123af1[_0x8f98('0x28')][_0x8f98('0x4a')][_0x8f98('0x4b')](',');var _0x5a045b={};_0x5a045b[_0x2d9f63[0x0]]={'$gte':moment(_0x2d9f63[0x1])[_0x8f98('0x4c')](_0x8f98('0x4d'))};_0x21b6e1[_0x8f98('0x45')]=_[_0x8f98('0x35')](_0x21b6e1[_0x8f98('0x45')],_0x5a045b);}_0x21b6e1=_['merge']({},_0x21b6e1,_0x123af1[_0x8f98('0x36')]);return db[_0x8f98('0x3d')][_0x8f98('0x15')]({'where':_0x21b6e1['where']})['then'](function(_0xd9bc75){_0x3212ff[_0x8f98('0x15')]=_0xd9bc75;if(_0x123af1[_0x8f98('0x28')]['includeAll']){_0x21b6e1['include']=[{'all':!![]}];}return db[_0x8f98('0x3d')][_0x8f98('0x26')](_0x21b6e1);})['then'](function(_0x55aa22){_0x3212ff[_0x8f98('0x4e')]=_0x55aa22;return _0x3212ff;});}})[_0x8f98('0x19')](respondWithFilteredResult(_0x1192d3,_0x21b6e1))[_0x8f98('0x2a')](handleError(_0x1192d3,null));};exports[_0x8f98('0x4f')]=function(_0x20b4f8,_0x47403e){return db[_0x8f98('0x20')]['find']({'where':{'id':_0x20b4f8[_0x8f98('0x2c')]['id']}})[_0x8f98('0x19')](handleEntityNotFound(_0x47403e,null))[_0x8f98('0x19')](function(_0x3e5b05){if(_0x3e5b05){return _0x3e5b05['setTags'](_0x20b4f8[_0x8f98('0x39')]['ids'],_[_0x8f98('0x3f')](_0x20b4f8[_0x8f98('0x39')],[_0x8f98('0x3e'),'id'])||{})[_0x8f98('0x50')](function(){return db['Tag']['findAll']({'attributes':['id','name','color'],'where':{'id':_0x20b4f8[_0x8f98('0x39')]['ids']}});})['then'](function(_0x50ef70){socket[_0x8f98('0x51')](_0x8f98('0x52'),{'id':Number(_0x20b4f8[_0x8f98('0x2c')]['id']),'tags':_0x50ef70||[]});return{'id':Number(_0x20b4f8[_0x8f98('0x2c')]['id']),'tags':_0x50ef70||[]};});}})[_0x8f98('0x19')](respondWithResult(_0x47403e,null))['catch'](handleError(_0x47403e,null));};exports[_0x8f98('0x53')]=function(_0x505b5b,_0x5a780a){return db['FaxInteraction'][_0x8f98('0x37')]({'where':{'id':_0x505b5b[_0x8f98('0x2c')]['id']}})[_0x8f98('0x19')](handleEntityNotFound(_0x5a780a,null))[_0x8f98('0x19')](function(_0x14d7b7){if(_0x14d7b7){return _0x14d7b7['removeTags'](_0x505b5b[_0x8f98('0x28')]['ids']);}})[_0x8f98('0x19')](respondWithStatusCode(_0x5a780a,null))[_0x8f98('0x2a')](handleError(_0x5a780a,null));};exports[_0x8f98('0x54')]=function(_0x1b3b6f,_0x1b93ad){var _0x4f3057=moment()[_0x8f98('0x55')]()[_0x8f98('0x56')]();var _0x56d7d2=path[_0x8f98('0x57')](config[_0x8f98('0x58')],_0x8f98('0x59'),_0x8f98('0x5a'),'tmp');var _0x4164c3=path[_0x8f98('0x57')](config['root'],_0x8f98('0x59'),_0x8f98('0x5a'),_0x8f98('0x5b'));var _0x4b0d28=path[_0x8f98('0x57')](_0x56d7d2,_0x4f3057);var _0x4b1dc5=util['format'](_0x8f98('0x5c'),_0x1b3b6f[_0x8f98('0x2c')]['id'],_0x4f3057);var _0x406eba=path['join'](_0x56d7d2,_0x4b1dc5);var _0x408625=[];_0x408625[_0x8f98('0x5d')]({'model':db[_0x8f98('0x5e')],'as':_0x8f98('0x5e'),'raw':!![]});var _0x1b0fd8=[{'model':db['FaxMessage'],'as':_0x8f98('0x5f'),'attributes':['id',_0x8f98('0x39'),_0x8f98('0x60')],'include':_0x408625}];return db[_0x8f98('0x20')]['find']({'where':{'id':_0x1b3b6f[_0x8f98('0x2c')]['id']},'include':_0x1b0fd8})[_0x8f98('0x19')](handleEntityNotFound(_0x1b93ad,null))[_0x8f98('0x19')](function(_0x2a589a){if(_0x2a589a&&_0x2a589a['Messages']){var _0x36202b=_0x2a589a['get']({'plain':!![]});fs['mkdirSync'](_0x4b0d28);for(var _0x27b9ff=0x0;_0x27b9ff<_0x36202b[_0x8f98('0x5f')][_0x8f98('0x32')];_0x27b9ff++){var _0x500af4=_0x36202b[_0x8f98('0x5f')][_0x27b9ff]['Attachment'];if(_0x500af4){var _0x27fdab=path['join'](_0x4164c3,_0x500af4[_0x8f98('0x61')]);if(fs['existsSync'](_0x27fdab)){fs[_0x8f98('0x62')](_0x27fdab)[_0x8f98('0x63')](fs[_0x8f98('0x64')](path[_0x8f98('0x57')](_0x4b0d28,_0x500af4['basename'])));}}}return BPromise[_0x8f98('0x65')]()[_0x8f98('0x19')](function(){return new BPromise(function(_0x483d82,_0xa6a932){zipdir(_0x4b0d28,{'saveTo':_0x406eba},function(_0xbc461c,_0x7528c7){if(_0xbc461c)return _0xa6a932(_0xbc461c);return _0x483d82(_0x7528c7);});})['then'](function(){return new BPromise(function(_0x5c0d7f,_0x14fa12){rimraf(_0x4b0d28,function(_0xad82f8){if(_0xad82f8)_0x14fa12(_0xad82f8);return _0x5c0d7f();});});})[_0x8f98('0x19')](function(){return _0x1b93ad[_0x8f98('0x54')](_0x406eba,_0x4b1dc5,function(_0x2892e9){if(_0x2892e9){console[_0x8f98('0x66')]('err',_0x2892e9);}else{fs[_0x8f98('0x67')](_0x406eba);}});});});}else{return _0x1b93ad[_0x8f98('0x1b')](0xc8);}})[_0x8f98('0x2a')](handleError(_0x1b93ad,null));}; \ No newline at end of file +var _0x6fdc=['files','push','Attachment','Messages','createdAt','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','moment','bluebird','util','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','error','stack','name','index','FaxInteraction','rawAttributes','fieldName','type','findAll','fax','user','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','include','create','body','find','describe','addMessage','FaxMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','FaxInteractionId','filter','merge','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','spread','Tag','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server'];(function(_0x55e3aa,_0x12d79f){var _0x4640cd=function(_0x4e2f36){while(--_0x4e2f36){_0x55e3aa['push'](_0x55e3aa['shift']());}};_0x4640cd(++_0x12d79f);}(_0x6fdc,0xd7));var _0xc6fd=function(_0x5814ca,_0x3b6713){_0x5814ca=_0x5814ca-0x0;var _0xeb1833=_0x6fdc[_0x5814ca];return _0xeb1833;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0xc6fd('0x0'));var BPromise=require(_0xc6fd('0x1'));var util=require(_0xc6fd('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0xc6fd('0x3'));var interaction=require(_0xc6fd('0x4'));var qs=require(_0xc6fd('0x5'));var logger=require(_0xc6fd('0x6'))(_0xc6fd('0x7'));var config=require(_0xc6fd('0x8'));var db=require(_0xc6fd('0x9'))['db'];config[_0xc6fd('0xa')]=_[_0xc6fd('0xb')](config[_0xc6fd('0xa')],{'host':_0xc6fd('0xc'),'port':0x18eb});var socket=require(_0xc6fd('0xd'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0xc6fd('0xe')](socket);function respondWithStatusCode(_0x41a300,_0x336a99){_0x336a99=_0x336a99||0xcc;return function(_0x8368bd){if(_0x8368bd){return _0x41a300[_0xc6fd('0xf')](_0x336a99);}return _0x41a300[_0xc6fd('0x10')](_0x336a99)['end']();};}function respondWithResult(_0x587955,_0x2013a7){_0x2013a7=_0x2013a7||0xc8;return function(_0x1eaddd){if(_0x1eaddd){return _0x587955[_0xc6fd('0x10')](_0x2013a7)[_0xc6fd('0x11')](_0x1eaddd);}};}function respondWithFilteredResult(_0x269a8d,_0x4a2b81){return function(_0x29ba00){if(_0x29ba00){var _0x5ede30=typeof _0x4a2b81[_0xc6fd('0x12')]===_0xc6fd('0x13')&&typeof _0x4a2b81['limit']===_0xc6fd('0x13');var _0xf99285=_0x29ba00[_0xc6fd('0x14')];var _0x4a5918=_0x5ede30?0x0:_0x4a2b81[_0xc6fd('0x12')];var _0x2ea9af=_0x5ede30?_0x29ba00[_0xc6fd('0x14')]:_0x4a2b81['offset']+_0x4a2b81[_0xc6fd('0x15')];var _0x43ea4c;if(_0x2ea9af>=_0xf99285){_0x2ea9af=_0xf99285;_0x43ea4c=0xc8;}else{_0x43ea4c=0xce;}_0x269a8d[_0xc6fd('0x10')](_0x43ea4c);return _0x269a8d[_0xc6fd('0x16')](_0xc6fd('0x17'),_0x4a5918+'-'+_0x2ea9af+'/'+_0xf99285)[_0xc6fd('0x11')](_0x29ba00);}return null;};}function saveUpdates(_0x24cce7){return function(_0x5be412){if(_0x5be412){return _0x5be412[_0xc6fd('0x18')](_0x24cce7)[_0xc6fd('0x19')](function(_0x502e4f){return _0x502e4f;});}return null;};}function removeEntity(_0xc41e06){return function(_0x26f95c){if(_0x26f95c){return _0x26f95c[_0xc6fd('0x1a')]()[_0xc6fd('0x19')](function(){_0xc41e06[_0xc6fd('0x10')](0xcc)[_0xc6fd('0x1b')]();});}};}function handleEntityNotFound(_0x251e26){return function(_0x12e80f){if(!_0x12e80f){_0x251e26['sendStatus'](0x194);}return _0x12e80f;};}function handleError(_0x1457ce,_0x397753){_0x397753=_0x397753||0x1f4;return function(_0x543cb2){logger[_0xc6fd('0x1c')](_0x543cb2[_0xc6fd('0x1d')]);if(_0x543cb2[_0xc6fd('0x1e')]){delete _0x543cb2[_0xc6fd('0x1e')];}_0x1457ce['status'](_0x397753)['send'](_0x543cb2);};}exports[_0xc6fd('0x1f')]=function(_0x8a40f5,_0x4277d1){var _0xb6f52d={};var _0x2e481a=_['map'](db[_0xc6fd('0x20')][_0xc6fd('0x21')],function(_0x3ab7d7){return{'name':_0x3ab7d7[_0xc6fd('0x22')],'type':_0x3ab7d7[_0xc6fd('0x23')]['key']};});_0xb6f52d=qs['getOptions'](_0x2e481a,_0x8a40f5);return interaction[_0xc6fd('0x24')](_0xc6fd('0x25'),_0x8a40f5['query'],_0x8a40f5[_0xc6fd('0x26')],_0xb6f52d,_0x2e481a)[_0xc6fd('0x19')](respondWithFilteredResult(_0x4277d1,_0xb6f52d))[_0xc6fd('0x27')](handleError(_0x4277d1,null));};exports[_0xc6fd('0x28')]=function(_0x31a13a,_0x19ffb7){var _0x1d9edf={'raw':![],'where':{'id':_0x31a13a[_0xc6fd('0x29')]['id']}},_0x1762da={};_0x1762da[_0xc6fd('0x2a')]=_[_0xc6fd('0x2b')](db[_0xc6fd('0x20')]['rawAttributes']);_0x1762da[_0xc6fd('0x2c')]=_[_0xc6fd('0x2b')](_0x31a13a[_0xc6fd('0x2c')]);_0x1762da[_0xc6fd('0x2d')]=_[_0xc6fd('0x2e')](_0x1762da[_0xc6fd('0x2a')],_0x1762da[_0xc6fd('0x2c')]);_0x1d9edf[_0xc6fd('0x2f')]=_[_0xc6fd('0x2e')](_0x1762da['model'],qs[_0xc6fd('0x30')](_0x31a13a[_0xc6fd('0x2c')][_0xc6fd('0x30')]));_0x1d9edf[_0xc6fd('0x2f')]=_0x1d9edf[_0xc6fd('0x2f')][_0xc6fd('0x31')]?_0x1d9edf[_0xc6fd('0x2f')]:_0x1762da[_0xc6fd('0x2a')];if(_0x31a13a[_0xc6fd('0x2c')][_0xc6fd('0x32')]){_0x1d9edf[_0xc6fd('0x33')]=[{'all':!![]}];}_0x1d9edf=_['merge']({},_0x1d9edf,_0x31a13a['options']);return db[_0xc6fd('0x20')]['find'](_0x1d9edf)[_0xc6fd('0x19')](handleEntityNotFound(_0x19ffb7,null))[_0xc6fd('0x19')](respondWithResult(_0x19ffb7,null))[_0xc6fd('0x27')](handleError(_0x19ffb7,null));};exports[_0xc6fd('0x34')]=function(_0x119b07,_0x26dfba){return db[_0xc6fd('0x20')][_0xc6fd('0x34')](_0x119b07[_0xc6fd('0x35')],{})[_0xc6fd('0x19')](respondWithResult(_0x26dfba,0xc9))[_0xc6fd('0x27')](handleError(_0x26dfba,null));};exports['update']=function(_0x348ceb,_0x360fc9){if(_0x348ceb[_0xc6fd('0x35')]['id']){delete _0x348ceb['body']['id'];}return db[_0xc6fd('0x20')][_0xc6fd('0x36')]({'where':{'id':_0x348ceb['params']['id']}})[_0xc6fd('0x19')](handleEntityNotFound(_0x360fc9,null))[_0xc6fd('0x19')](saveUpdates(_0x348ceb[_0xc6fd('0x35')],null))[_0xc6fd('0x19')](respondWithResult(_0x360fc9,null))[_0xc6fd('0x27')](handleError(_0x360fc9,null));};exports[_0xc6fd('0x1a')]=function(_0x53fb1d,_0x3799a8){return db['FaxInteraction'][_0xc6fd('0x36')]({'where':{'id':_0x53fb1d[_0xc6fd('0x29')]['id']}})[_0xc6fd('0x19')](handleEntityNotFound(_0x3799a8,null))[_0xc6fd('0x19')](removeEntity(_0x3799a8,null))[_0xc6fd('0x27')](handleError(_0x3799a8,null));};exports[_0xc6fd('0x37')]=function(_0x2bdf3f,_0x4e8ef6){return db[_0xc6fd('0x20')][_0xc6fd('0x37')]()['then'](respondWithResult(_0x4e8ef6,null))['catch'](handleError(_0x4e8ef6,null));};exports[_0xc6fd('0x38')]=function(_0x261abd,_0x238a2b){return db[_0xc6fd('0x39')][_0xc6fd('0x36')]({'where':{'id':_0x261abd[_0xc6fd('0x29')]['id']}})[_0xc6fd('0x19')](handleEntityNotFound(_0x238a2b,null))[_0xc6fd('0x19')](function(_0x53d155){if(_0x53d155){return _0x53d155['addMessage'](_0x261abd[_0xc6fd('0x35')][_0xc6fd('0x3a')],_[_0xc6fd('0x3b')](_0x261abd[_0xc6fd('0x35')],[_0xc6fd('0x3a'),'id'])||{});}})[_0xc6fd('0x19')](respondWithResult(_0x238a2b,null))[_0xc6fd('0x27')](handleError(_0x238a2b,null));};exports[_0xc6fd('0x3c')]=function(_0xd4492d,_0x4b61d7){var _0x505782={'raw':![],'where':{}};var _0x505131={};var _0x3a9920={'count':0x0,'rows':[]};return db[_0xc6fd('0x20')]['findOne']({'where':{'id':_0xd4492d['params']['id']}})[_0xc6fd('0x19')](handleEntityNotFound(_0x4b61d7,null))[_0xc6fd('0x19')](function(_0x474d20){if(_0x474d20){_0x505131['model']=_[_0xc6fd('0x2b')](db[_0xc6fd('0x39')][_0xc6fd('0x21')]);_0x505131[_0xc6fd('0x2c')]=_[_0xc6fd('0x2b')](_0xd4492d['query']);_0x505131[_0xc6fd('0x2d')]=_[_0xc6fd('0x2e')](_0x505131[_0xc6fd('0x2a')],_0x505131[_0xc6fd('0x2c')]);_0x505782[_0xc6fd('0x2f')]=_[_0xc6fd('0x2e')](_0x505131[_0xc6fd('0x2a')],qs[_0xc6fd('0x30')](_0xd4492d['query'][_0xc6fd('0x30')]));_0x505782[_0xc6fd('0x2f')]=_0x505782['attributes'][_0xc6fd('0x31')]?_0x505782['attributes']:_0x505131[_0xc6fd('0x2a')];if(!_0xd4492d[_0xc6fd('0x2c')][_0xc6fd('0x3d')](_0xc6fd('0x3e'))){_0x505782[_0xc6fd('0x15')]=qs[_0xc6fd('0x15')](_0xd4492d[_0xc6fd('0x2c')][_0xc6fd('0x15')]);_0x505782['offset']=qs[_0xc6fd('0x12')](_0xd4492d[_0xc6fd('0x2c')][_0xc6fd('0x12')]);}_0x505782[_0xc6fd('0x3f')]=qs[_0xc6fd('0x40')](_0xd4492d[_0xc6fd('0x2c')][_0xc6fd('0x40')]);_0x505782[_0xc6fd('0x41')]=qs[_0xc6fd('0x2d')](_['pick'](_0xd4492d['query'],_0x505131[_0xc6fd('0x2d')]));_0x505782[_0xc6fd('0x41')][_0xc6fd('0x42')]=_0x474d20['id'];if(_0xd4492d['query'][_0xc6fd('0x43')]){_0x505782['where']=_[_0xc6fd('0x44')](_0x505782[_0xc6fd('0x41')],{'$or':_[_0xc6fd('0x45')](_0x505782['attributes'],function(_0x18d74b){var _0x2c90e9={};_0x2c90e9[_0x18d74b]={'$like':'%'+_0xd4492d['query'][_0xc6fd('0x43')]+'%'};return _0x2c90e9;})});}if(_0xd4492d[_0xc6fd('0x2c')][_0xc6fd('0x46')]){var _0xd9f563=_0xd4492d[_0xc6fd('0x2c')][_0xc6fd('0x46')]['split'](',');var _0x468f99={};_0x468f99[_0xd9f563[0x0]]={'$gte':moment(_0xd9f563[0x1])[_0xc6fd('0x47')](_0xc6fd('0x48'))};_0x505782['where']=_[_0xc6fd('0x44')](_0x505782[_0xc6fd('0x41')],_0x468f99);}_0x505782=_[_0xc6fd('0x44')]({},_0x505782,_0xd4492d[_0xc6fd('0x49')]);return db['FaxMessage'][_0xc6fd('0x14')]({'where':_0x505782[_0xc6fd('0x41')]})[_0xc6fd('0x19')](function(_0x10de93){_0x3a9920[_0xc6fd('0x14')]=_0x10de93;if(_0xd4492d[_0xc6fd('0x2c')]['includeAll']){_0x505782[_0xc6fd('0x33')]=[{'all':!![]}];}return db[_0xc6fd('0x39')][_0xc6fd('0x24')](_0x505782);})[_0xc6fd('0x19')](function(_0x564d2d){_0x3a9920['rows']=_0x564d2d;return _0x3a9920;});}})[_0xc6fd('0x19')](respondWithFilteredResult(_0x4b61d7,_0x505782))[_0xc6fd('0x27')](handleError(_0x4b61d7,null));};exports['addTags']=function(_0x1c7849,_0x27e4c1){return db[_0xc6fd('0x20')][_0xc6fd('0x36')]({'where':{'id':_0x1c7849[_0xc6fd('0x29')]['id']}})[_0xc6fd('0x19')](handleEntityNotFound(_0x27e4c1,null))['then'](function(_0x23fc06){if(_0x23fc06){return _0x23fc06['setTags'](_0x1c7849[_0xc6fd('0x35')]['ids'],_[_0xc6fd('0x3b')](_0x1c7849[_0xc6fd('0x35')],[_0xc6fd('0x3a'),'id'])||{})[_0xc6fd('0x4a')](function(){return db[_0xc6fd('0x4b')][_0xc6fd('0x24')]({'attributes':['id',_0xc6fd('0x1e'),'color'],'where':{'id':_0x1c7849[_0xc6fd('0x35')][_0xc6fd('0x3a')]}});})[_0xc6fd('0x19')](function(_0x18f165){socket[_0xc6fd('0x4c')](_0xc6fd('0x4d'),{'id':Number(_0x1c7849['params']['id']),'tags':_0x18f165||[]});return{'id':Number(_0x1c7849[_0xc6fd('0x29')]['id']),'tags':_0x18f165||[]};});}})[_0xc6fd('0x19')](respondWithResult(_0x27e4c1,null))['catch'](handleError(_0x27e4c1,null));};exports[_0xc6fd('0x4e')]=function(_0xa62fdb,_0xe42aa5){return db[_0xc6fd('0x20')][_0xc6fd('0x36')]({'where':{'id':_0xa62fdb[_0xc6fd('0x29')]['id']}})[_0xc6fd('0x19')](handleEntityNotFound(_0xe42aa5,null))[_0xc6fd('0x19')](function(_0x451629){if(_0x451629){return _0x451629[_0xc6fd('0x4e')](_0xa62fdb[_0xc6fd('0x2c')][_0xc6fd('0x3a')]);}})[_0xc6fd('0x19')](respondWithStatusCode(_0xe42aa5,null))[_0xc6fd('0x27')](handleError(_0xe42aa5,null));};exports[_0xc6fd('0x4f')]=function(_0x535d81,_0x11f891){var _0x1bf7eb=moment()[_0xc6fd('0x50')]()[_0xc6fd('0x51')]();var _0xce4082=path[_0xc6fd('0x52')](config[_0xc6fd('0x53')],'server','files','tmp');var _0x39248e=path[_0xc6fd('0x52')](config[_0xc6fd('0x53')],_0xc6fd('0x54'),_0xc6fd('0x55'),'attachments');var _0x18cab8=path[_0xc6fd('0x52')](_0xce4082,_0x1bf7eb);var _0x36aee1=util[_0xc6fd('0x47')]('transcript-%d-%s.zip',_0x535d81[_0xc6fd('0x29')]['id'],_0x1bf7eb);var _0xf896b5=path[_0xc6fd('0x52')](_0xce4082,_0x36aee1);var _0x2c9f77=[];_0x2c9f77[_0xc6fd('0x56')]({'model':db['Attachment'],'as':_0xc6fd('0x57'),'raw':!![]});var _0x548760=[{'model':db['FaxMessage'],'as':_0xc6fd('0x58'),'attributes':['id',_0xc6fd('0x35'),_0xc6fd('0x59')],'include':_0x2c9f77}];return db[_0xc6fd('0x20')]['find']({'where':{'id':_0x535d81[_0xc6fd('0x29')]['id']},'include':_0x548760})[_0xc6fd('0x19')](handleEntityNotFound(_0x11f891,null))['then'](function(_0x4f34e1){if(_0x4f34e1&&_0x4f34e1['Messages']){var _0xefd4a5=_0x4f34e1['get']({'plain':!![]});fs[_0xc6fd('0x5a')](_0x18cab8);for(var _0x187d73=0x0;_0x187d73<_0xefd4a5[_0xc6fd('0x58')]['length'];_0x187d73++){var _0x10178f=_0xefd4a5['Messages'][_0x187d73][_0xc6fd('0x57')];if(_0x10178f){var _0x34c1d2=path[_0xc6fd('0x52')](_0x39248e,_0x10178f[_0xc6fd('0x5b')]);if(fs[_0xc6fd('0x5c')](_0x34c1d2)){fs[_0xc6fd('0x5d')](_0x34c1d2)[_0xc6fd('0x5e')](fs[_0xc6fd('0x5f')](path['join'](_0x18cab8,_0x10178f[_0xc6fd('0x5b')])));}}}return BPromise[_0xc6fd('0x60')]()[_0xc6fd('0x19')](function(){return new BPromise(function(_0x538d3b,_0x3f3d2c){zipdir(_0x18cab8,{'saveTo':_0xf896b5},function(_0x424210,_0x3b4d19){if(_0x424210)return _0x3f3d2c(_0x424210);return _0x538d3b(_0x3b4d19);});})['then'](function(){return new BPromise(function(_0x1a60f9,_0x4d2271){rimraf(_0x18cab8,function(_0x3c8566){if(_0x3c8566)_0x4d2271(_0x3c8566);return _0x1a60f9();});});})[_0xc6fd('0x19')](function(){return _0x11f891[_0xc6fd('0x4f')](_0xf896b5,_0x36aee1,function(_0x259e1d){if(_0x259e1d){console[_0xc6fd('0x61')](_0xc6fd('0x62'),_0x259e1d);}else{fs[_0xc6fd('0x63')](_0xf896b5);}});});});}else{return _0x11f891[_0xc6fd('0xf')](0xc8);}})['catch'](handleError(_0x11f891,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 31c2c3a..3248283 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 _0x047a=['events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','then','setDataValue','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports'];(function(_0x1f4495,_0x4bba32){var _0x55366d=function(_0x40c5b4){while(--_0x40c5b4){_0x1f4495['push'](_0x1f4495['shift']());}};_0x55366d(++_0x4bba32);}(_0x047a,0x1dc));var _0xa047=function(_0x4c4037,_0x15054b){_0x4c4037=_0x4c4037-0x0;var _0x357862=_0x047a[_0x4c4037];return _0x357862;};'use strict';var EventEmitter=require(_0xa047('0x0'));var FaxInteraction=require(_0xa047('0x1'))['db'][_0xa047('0x2')];var FaxMessage=require(_0xa047('0x1'))['db'][_0xa047('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xa047('0x4')](0x0);var events={'afterCreate':_0xa047('0x5'),'afterUpdate':_0xa047('0x6'),'afterDestroy':_0xa047('0x7')};function emitEvent(_0x1fada2){return function(_0x24c525,_0x57af64,_0x111d2b){_0x24c525['getUsers']({'attributes':['id'],'raw':!![]})[_0xa047('0x8')](function(_0x59bbf5){_0x24c525[_0xa047('0x9')]('Users',_0x59bbf5['map'](function(_0xf3a544){return{'id':_0xf3a544['id']};}));return FaxMessage[_0xa047('0xa')]({'where':{'FaxInteractionId':_0x24c525['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa047('0x8')](function(_0x36b968){_0x24c525[_0xa047('0x9')](_0xa047('0xb'),_0x36b968[_0xa047('0xc')]);FaxInteractionEvents[_0xa047('0xd')](_0x1fada2+':'+_0x24c525['id'],_0x24c525);FaxInteractionEvents[_0xa047('0xd')](_0x1fada2,_0x24c525);_0x111d2b(null);})[_0xa047('0xe')](_0x111d2b(null));};}for(var e in events){if(events[_0xa047('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xa047('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x415f=['findAll','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','then','setDataValue'];(function(_0x981d85,_0x30d5c0){var _0x1305a1=function(_0x25cc9b){while(--_0x25cc9b){_0x981d85['push'](_0x981d85['shift']());}};_0x1305a1(++_0x30d5c0);}(_0x415f,0x16e));var _0xf415=function(_0x53d045,_0x33eed3){_0x53d045=_0x53d045-0x0;var _0x47252c=_0x415f[_0x53d045];return _0x47252c;};'use strict';var EventEmitter=require(_0xf415('0x0'));var FaxInteraction=require(_0xf415('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0xf415('0x1'))['db'][_0xf415('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf415('0x3')](0x0);var events={'afterCreate':_0xf415('0x4'),'afterUpdate':_0xf415('0x5'),'afterDestroy':_0xf415('0x6')};function emitEvent(_0x522026){return function(_0x7546ec,_0x46d063,_0xf321df){_0x7546ec['getUsers']({'attributes':['id'],'raw':!![]})[_0xf415('0x7')](function(_0x58fa65){_0x7546ec[_0xf415('0x8')]('Users',_0x58fa65['map'](function(_0x32c122){return{'id':_0x32c122['id']};}));return FaxMessage[_0xf415('0x9')]({'where':{'FaxInteractionId':_0x7546ec['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x567eb9){_0x7546ec['setDataValue']('unreadMessages',_0x567eb9[_0xf415('0xa')]);FaxInteractionEvents[_0xf415('0xb')](_0x522026+':'+_0x7546ec['id'],_0x7546ec);FaxInteractionEvents[_0xf415('0xb')](_0x522026,_0x7546ec);_0xf321df(null);})[_0xf415('0xc')](_0xf321df(null));};}for(var e in events){if(events[_0xf415('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xf415('0xe')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 5c30d9c..1cf8a25 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 _0x82e2=['YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','path','rimraf','./faxInteraction.attributes','exports','FaxInteraction','changed','closed','closedAt','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x82e2,0xd3));var _0x282e=function(_0x3e690a,_0x31aa0f){_0x3e690a=_0x3e690a-0x0;var _0x435ca0=_0x82e2[_0x3e690a];return _0x435ca0;};'use strict';var _=require('lodash');var util=require(_0x282e('0x0'));var logger=require(_0x282e('0x1'))(_0x282e('0x2'));var moment=require(_0x282e('0x3'));var BPromise=require(_0x282e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x282e('0x5'));var rimraf=require(_0x282e('0x6'));var config=require('../../config/environment');var attributes=require(_0x282e('0x7'));module[_0x282e('0x8')]=function(_0x44f7d1,_0x1b8fe1){return _0x44f7d1['define'](_0x282e('0x9'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xc815c0,_0x1ce1a5,_0x2e34d2){if(_0xc815c0[_0x282e('0xa')](_0x282e('0xb'))){_0xc815c0[_0x282e('0xc')]=moment()[_0x282e('0xd')](_0x282e('0xe'));}_0x2e34d2(null,_0xc815c0);}}});}; \ No newline at end of file +var _0x4f3d=['request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4f3d,0x171));var _0xd4f3=function(_0xb34b6e,_0x59ecf6){_0xb34b6e=_0xb34b6e-0x0;var _0x4143ac=_0x4f3d[_0xb34b6e];return _0x4143ac;};'use strict';var _=require(_0xd4f3('0x0'));var util=require('util');var logger=require(_0xd4f3('0x1'))(_0xd4f3('0x2'));var moment=require(_0xd4f3('0x3'));var BPromise=require(_0xd4f3('0x4'));var rp=require(_0xd4f3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd4f3('0x6'));var config=require(_0xd4f3('0x7'));var attributes=require(_0xd4f3('0x8'));module[_0xd4f3('0x9')]=function(_0x3a9c6e,_0x28c4ac){return _0x3a9c6e[_0xd4f3('0xa')](_0xd4f3('0xb'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a9886,_0x1b3339,_0x25ad5d){if(_0x2a9886[_0xd4f3('0xc')](_0xd4f3('0xd'))){_0x2a9886[_0xd4f3('0xe')]=moment()[_0xd4f3('0xf')](_0xd4f3('0x10'));}_0x25ad5d(null,_0x2a9886);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 81fd4de..3e5a4af 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 _0xf6a9=['rpc','http','defaults','redis','localhost','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','error','message','result','UpdateFaxInteraction','FaxInteraction','update','options','where','attributes','limit','stringify','catch','AddTagsToFaxInteraction','find','addTags','ids','omit','body','spread','AddTags','util','bluebird','ioredis','../../mysqldb'];(function(_0x1e4697,_0x548835){var _0x4fe719=function(_0x28e5f6){while(--_0x28e5f6){_0x1e4697['push'](_0x1e4697['shift']());}};_0x4fe719(++_0x548835);}(_0xf6a9,0x17d));var _0x9f6a=function(_0x513bf7,_0x5cea75){_0x513bf7=_0x513bf7-0x0;var _0x625387=_0xf6a9[_0x513bf7];return _0x625387;};'use strict';var _=require('lodash');var util=require(_0x9f6a('0x0'));var moment=require('moment');var BPromise=require(_0x9f6a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f6a('0x2'));var db=require(_0x9f6a('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9f6a('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9f6a('0x5')]({'port':0x232a});config['redis']=_[_0x9f6a('0x6')](config[_0x9f6a('0x7')],{'host':_0x9f6a('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x3050ab,_0x23af17,_0x48abcd){return new BPromise(function(_0x3fc087,_0x360281){return client[_0x9f6a('0x9')](_0x3050ab,_0x48abcd)[_0x9f6a('0xa')](function(_0x51f467){logger[_0x9f6a('0xb')](_0x9f6a('0xc'),_0x23af17,_0x9f6a('0xd'));logger[_0x9f6a('0xe')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x23af17,'request\x20sent',JSON['stringify'](_0x51f467));if(_0x51f467[_0x9f6a('0xf')]){if(_0x51f467[_0x9f6a('0xf')]['code']===0x1f4){logger[_0x9f6a('0xf')]('FaxInteraction,\x20%s,\x20%s',_0x23af17,_0x51f467[_0x9f6a('0xf')][_0x9f6a('0x10')]);return _0x360281(_0x51f467[_0x9f6a('0xf')][_0x9f6a('0x10')]);}logger[_0x9f6a('0xf')](_0x9f6a('0xc'),_0x23af17,_0x51f467[_0x9f6a('0xf')]['message']);return _0x3fc087(_0x51f467['error'][_0x9f6a('0x10')]);}else{logger[_0x9f6a('0xb')](_0x9f6a('0xc'),_0x23af17,'request\x20sent');_0x3fc087(_0x51f467[_0x9f6a('0x11')][_0x9f6a('0x10')]);}})['catch'](function(_0x4cc327){logger[_0x9f6a('0xf')](_0x9f6a('0xc'),_0x23af17,_0x4cc327);_0x360281(_0x4cc327);});});}exports[_0x9f6a('0x12')]=function(_0x5ad92b){var _0x27066b=this;return new Promise(function(_0x30aa9f,_0x407fd5){return db[_0x9f6a('0x13')][_0x9f6a('0x14')](_0x5ad92b['body'],{'raw':_0x5ad92b[_0x9f6a('0x15')]?_0x5ad92b[_0x9f6a('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ad92b['options']?_0x5ad92b[_0x9f6a('0x15')][_0x9f6a('0x16')]||null:null,'attributes':_0x5ad92b[_0x9f6a('0x15')]?_0x5ad92b[_0x9f6a('0x15')][_0x9f6a('0x17')]||null:null,'limit':_0x5ad92b['options']?_0x5ad92b['options'][_0x9f6a('0x18')]||null:null})[_0x9f6a('0xa')](function(_0x2b3006){logger[_0x9f6a('0xb')](_0x9f6a('0x12'),_0x5ad92b);logger[_0x9f6a('0xe')]('UpdateFaxInteraction',_0x5ad92b,JSON[_0x9f6a('0x19')](_0x2b3006));_0x30aa9f(_0x2b3006);})[_0x9f6a('0x1a')](function(_0x124347){logger['error'](_0x9f6a('0x12'),_0x124347[_0x9f6a('0x10')],_0x5ad92b);_0x407fd5(_0x27066b[_0x9f6a('0xf')](0x1f4,_0x124347[_0x9f6a('0x10')]));});});};exports[_0x9f6a('0x1b')]=function(_0x1b605b){return new Promise(function(_0x4c9db8,_0x171792){return db[_0x9f6a('0x13')][_0x9f6a('0x1c')]({'where':_0x1b605b[_0x9f6a('0x15')]?_0x1b605b[_0x9f6a('0x15')][_0x9f6a('0x16')]||null:null})[_0x9f6a('0xa')](function(_0x487e37){if(_0x487e37){return _0x487e37[_0x9f6a('0x1d')](_0x1b605b['body'][_0x9f6a('0x1e')],_[_0x9f6a('0x1f')](_0x1b605b[_0x9f6a('0x20')],[_0x9f6a('0x1e'),'id'])||{});}})[_0x9f6a('0x21')](function(_0x39ba9a){logger['info'](_0x9f6a('0x22'),_0x1b605b);logger[_0x9f6a('0xe')](_0x9f6a('0x22'),_0x1b605b,JSON[_0x9f6a('0x19')](_0x39ba9a));_0x4c9db8(_0x39ba9a);})[_0x9f6a('0x1a')](function(_0x11f8a4){logger['error']('AddTags',_0x11f8a4[_0x9f6a('0x10')],_0x1b605b);_0x171792(_this['error'](0x1f4,_0x11f8a4[_0x9f6a('0x10')]));});});}; \ No newline at end of file +var _0x60fa=['client','http','defaults','localhost','socket.io-emitter','redis','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','attributes','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x60fa,0x9e));var _0xa60f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x60fa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa60f('0x0'));var util=require(_0xa60f('0x1'));var moment=require(_0xa60f('0x2'));var BPromise=require(_0xa60f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa60f('0x4'));var db=require(_0xa60f('0x5'))['db'];var utils=require(_0xa60f('0x6'));var logger=require(_0xa60f('0x7'))(_0xa60f('0x8'));var config=require('../../config/environment');var jayson=require(_0xa60f('0x9'));var client=jayson[_0xa60f('0xa')][_0xa60f('0xb')]({'port':0x232a});config['redis']=_[_0xa60f('0xc')](config['redis'],{'host':_0xa60f('0xd'),'port':0x18eb});var socket=require(_0xa60f('0xe'))(new Redis(config[_0xa60f('0xf')]));require(_0xa60f('0x10'))[_0xa60f('0x11')](socket);function respondWithRpcPromise(_0x573165,_0x206565,_0x38dae8){return new BPromise(function(_0x4341fd,_0x208504){return client['request'](_0x573165,_0x38dae8)[_0xa60f('0x12')](function(_0x486d93){logger[_0xa60f('0x13')](_0xa60f('0x14'),_0x206565,_0xa60f('0x15'));logger[_0xa60f('0x16')](_0xa60f('0x17'),_0x206565,_0xa60f('0x15'),JSON[_0xa60f('0x18')](_0x486d93));if(_0x486d93[_0xa60f('0x19')]){if(_0x486d93[_0xa60f('0x19')]['code']===0x1f4){logger['error'](_0xa60f('0x14'),_0x206565,_0x486d93[_0xa60f('0x19')]['message']);return _0x208504(_0x486d93[_0xa60f('0x19')][_0xa60f('0x1a')]);}logger[_0xa60f('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x206565,_0x486d93[_0xa60f('0x19')][_0xa60f('0x1a')]);return _0x4341fd(_0x486d93['error']['message']);}else{logger[_0xa60f('0x13')](_0xa60f('0x14'),_0x206565,_0xa60f('0x15'));_0x4341fd(_0x486d93[_0xa60f('0x1b')]['message']);}})[_0xa60f('0x1c')](function(_0x1e62ba){logger[_0xa60f('0x19')](_0xa60f('0x14'),_0x206565,_0x1e62ba);_0x208504(_0x1e62ba);});});}exports[_0xa60f('0x1d')]=function(_0x27b0c1){var _0x132582=this;return new Promise(function(_0x1530ed,_0x4faeb6){return db[_0xa60f('0x1e')][_0xa60f('0x1f')](_0x27b0c1['body'],{'raw':_0x27b0c1[_0xa60f('0x20')]?_0x27b0c1['options'][_0xa60f('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27b0c1[_0xa60f('0x20')]?_0x27b0c1[_0xa60f('0x20')]['where']||null:null,'attributes':_0x27b0c1['options']?_0x27b0c1[_0xa60f('0x20')][_0xa60f('0x22')]||null:null,'limit':_0x27b0c1['options']?_0x27b0c1[_0xa60f('0x20')]['limit']||null:null})['then'](function(_0x447abc){logger[_0xa60f('0x13')]('UpdateFaxInteraction',_0x27b0c1);logger['debug'](_0xa60f('0x1d'),_0x27b0c1,JSON[_0xa60f('0x18')](_0x447abc));_0x1530ed(_0x447abc);})[_0xa60f('0x1c')](function(_0x17a554){logger[_0xa60f('0x19')](_0xa60f('0x1d'),_0x17a554[_0xa60f('0x1a')],_0x27b0c1);_0x4faeb6(_0x132582[_0xa60f('0x19')](0x1f4,_0x17a554[_0xa60f('0x1a')]));});});};exports['AddTagsToFaxInteraction']=function(_0x5016a1){return new Promise(function(_0x3003e2,_0x2b8b43){return db['FaxInteraction'][_0xa60f('0x23')]({'where':_0x5016a1[_0xa60f('0x20')]?_0x5016a1['options'][_0xa60f('0x24')]||null:null})[_0xa60f('0x12')](function(_0x284152){if(_0x284152){return _0x284152[_0xa60f('0x25')](_0x5016a1['body'][_0xa60f('0x26')],_[_0xa60f('0x27')](_0x5016a1['body'],['ids','id'])||{});}})[_0xa60f('0x28')](function(_0x2ee2dc){logger[_0xa60f('0x13')](_0xa60f('0x29'),_0x5016a1);logger[_0xa60f('0x16')](_0xa60f('0x29'),_0x5016a1,JSON[_0xa60f('0x18')](_0x2ee2dc));_0x3003e2(_0x2ee2dc);})['catch'](function(_0x4a8736){logger[_0xa60f('0x19')]('AddTags',_0x4a8736[_0xa60f('0x1a')],_0x5016a1);_0x2b8b43(_this['error'](0x1f4,_0x4a8736[_0xa60f('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index e8c8d56..944767f 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 _0xb525=['removeListener','register','length','./faxInteraction.events','save','remove','update','emit'];(function(_0x5005df,_0x545de0){var _0x36bf8f=function(_0x10599f){while(--_0x10599f){_0x5005df['push'](_0x5005df['shift']());}};_0x36bf8f(++_0x545de0);}(_0xb525,0x7b));var _0x5b52=function(_0x3d83ac,_0x1d0135){_0x3d83ac=_0x3d83ac-0x0;var _0x299760=_0xb525[_0x3d83ac];return _0x299760;};'use strict';var FaxInteractionEvents=require(_0x5b52('0x0'));var events=[_0x5b52('0x1'),_0x5b52('0x2'),_0x5b52('0x3')];function createListener(_0x376bc8,_0x148166){return function(_0x222faf){_0x148166[_0x5b52('0x4')](_0x376bc8,_0x222faf);};}function removeListener(_0x1bf9b8,_0x4a270f){return function(){FaxInteractionEvents[_0x5b52('0x5')](_0x1bf9b8,_0x4a270f);};}exports[_0x5b52('0x6')]=function(_0x51afcc){for(var _0x10fdd2=0x0,_0x3fc7a1=events[_0x5b52('0x7')];_0x10fdd2<_0x3fc7a1;_0x10fdd2++){var _0x2a65fb=events[_0x10fdd2];var _0x7612eb=createListener('faxInteraction:'+_0x2a65fb,_0x51afcc);FaxInteractionEvents['on'](_0x2a65fb,_0x7612eb);}}; \ No newline at end of file +var _0x29c3=['register','length','faxInteraction:','./faxInteraction.events','save','emit','removeListener'];(function(_0x5888be,_0x3d3e84){var _0x3226b2=function(_0x40f81a){while(--_0x40f81a){_0x5888be['push'](_0x5888be['shift']());}};_0x3226b2(++_0x3d3e84);}(_0x29c3,0x192));var _0x329c=function(_0xbba381,_0x4b78df){_0xbba381=_0xbba381-0x0;var _0x4ee3e0=_0x29c3[_0xbba381];return _0x4ee3e0;};'use strict';var FaxInteractionEvents=require(_0x329c('0x0'));var events=[_0x329c('0x1'),'remove','update'];function createListener(_0x39976f,_0x50c112){return function(_0x472087){_0x50c112[_0x329c('0x2')](_0x39976f,_0x472087);};}function removeListener(_0x4a32a8,_0x506aa9){return function(){FaxInteractionEvents[_0x329c('0x3')](_0x4a32a8,_0x506aa9);};}exports[_0x329c('0x4')]=function(_0x2b080e){for(var _0x76d9ca=0x0,_0x4b3690=events[_0x329c('0x5')];_0x76d9ca<_0x4b3690;_0x76d9ca++){var _0x3b675e=events[_0x76d9ca];var _0x32a89f=createListener(_0x329c('0x6')+_0x3b675e,_0x2b080e);FaxInteractionEvents['on'](_0x3b675e,_0x32a89f);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 34caff4..7f4b542 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 _0x5f79=['download','post','create','/:id/tags','tracked','put','fax','faxinteraction:update','delete','faxinteraction:destroy','removeTags','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download'];(function(_0x10abfe,_0x7a9ad6){var _0x473c1b=function(_0x392758){while(--_0x392758){_0x10abfe['push'](_0x10abfe['shift']());}};_0x473c1b(++_0x7a9ad6);}(_0x5f79,0x92));var _0x95f7=function(_0x3cbe1c,_0x4bcabd){_0x3cbe1c=_0x3cbe1c-0x0;var _0x5ee08b=_0x5f79[_0x3cbe1c];return _0x5ee08b;};'use strict';var multer=require('multer');var util=require(_0x95f7('0x0'));var path=require(_0x95f7('0x1'));var timeout=require(_0x95f7('0x2'));var express=require(_0x95f7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x95f7('0x4'));var interaction=require(_0x95f7('0x5'));var config=require(_0x95f7('0x6'));var controller=require('./faxInteraction.controller');router[_0x95f7('0x7')]('/',auth['isAuthenticated'](),controller[_0x95f7('0x8')]);router[_0x95f7('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x95f7('0x9')]);router[_0x95f7('0x7')](_0x95f7('0xa'),auth[_0x95f7('0xb')](),controller[_0x95f7('0xc')]);router[_0x95f7('0x7')](_0x95f7('0xd'),auth['isAuthenticated'](),controller[_0x95f7('0xe')]);router[_0x95f7('0x7')](_0x95f7('0xf'),auth[_0x95f7('0xb')](),controller[_0x95f7('0x10')]);router[_0x95f7('0x11')]('/',auth[_0x95f7('0xb')](),controller[_0x95f7('0x12')]);router[_0x95f7('0x11')](_0x95f7('0xd'),auth['isAuthenticated'](),controller['addMessage']);router[_0x95f7('0x11')](_0x95f7('0x13'),auth[_0x95f7('0xb')](),interaction[_0x95f7('0x14')]('fax','faxinteraction:addtags'),controller['addTags']);router[_0x95f7('0x15')]('/:id',auth[_0x95f7('0xb')](),interaction[_0x95f7('0x14')](_0x95f7('0x16'),_0x95f7('0x17')),controller['update']);router[_0x95f7('0x18')](_0x95f7('0xa'),auth[_0x95f7('0xb')](),interaction[_0x95f7('0x14')](_0x95f7('0x16'),_0x95f7('0x19')),controller['destroy']);router[_0x95f7('0x18')](_0x95f7('0x13'),auth[_0x95f7('0xb')](),controller[_0x95f7('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xe528=['Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','getMessages','/:id/download','post','create','/:id/messages','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','path','connect-timeout','express'];(function(_0x37bedf,_0x1678e7){var _0x47f2ec=function(_0x4a5fb2){while(--_0x4a5fb2){_0x37bedf['push'](_0x37bedf['shift']());}};_0x47f2ec(++_0x1678e7);}(_0xe528,0x9d));var _0x8e52=function(_0x4584c6,_0x1e2637){_0x4584c6=_0x4584c6-0x0;var _0x6321d9=_0xe528[_0x4584c6];return _0x6321d9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8e52('0x0'));var timeout=require(_0x8e52('0x1'));var express=require(_0x8e52('0x2'));var router=express[_0x8e52('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8e52('0x4'));var config=require(_0x8e52('0x5'));var controller=require(_0x8e52('0x6'));router[_0x8e52('0x7')]('/',auth['isAuthenticated'](),controller[_0x8e52('0x8')]);router[_0x8e52('0x7')](_0x8e52('0x9'),auth[_0x8e52('0xa')](),controller[_0x8e52('0xb')]);router[_0x8e52('0x7')](_0x8e52('0xc'),auth[_0x8e52('0xa')](),controller['show']);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x8e52('0xd')]);router[_0x8e52('0x7')](_0x8e52('0xe'),auth[_0x8e52('0xa')](),controller['download']);router[_0x8e52('0xf')]('/',auth[_0x8e52('0xa')](),controller[_0x8e52('0x10')]);router['post'](_0x8e52('0x11'),auth[_0x8e52('0xa')](),controller[_0x8e52('0x12')]);router[_0x8e52('0xf')](_0x8e52('0x13'),auth['isAuthenticated'](),interaction[_0x8e52('0x14')](_0x8e52('0x15'),_0x8e52('0x16')),controller[_0x8e52('0x17')]);router[_0x8e52('0x18')](_0x8e52('0xc'),auth[_0x8e52('0xa')](),interaction['tracked'](_0x8e52('0x15'),_0x8e52('0x19')),controller[_0x8e52('0x1a')]);router[_0x8e52('0x1b')](_0x8e52('0xc'),auth[_0x8e52('0xa')](),interaction[_0x8e52('0x14')](_0x8e52('0x15'),_0x8e52('0x1c')),controller[_0x8e52('0x1d')]);router['delete'](_0x8e52('0x13'),auth[_0x8e52('0xa')](),controller[_0x8e52('0x1e')]);module[_0x8e52('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 aa2055f..558762a 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 _0xe2cc=['sequelize','exports','BOOLEAN','ENUM','out','TEXT','DATE'];(function(_0x4044f7,_0x43c401){var _0x14a6ac=function(_0x4561e2){while(--_0x4561e2){_0x4044f7['push'](_0x4044f7['shift']());}};_0x14a6ac(++_0x43c401);}(_0xe2cc,0x69));var _0xce2c=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xe2cc[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0xce2c('0x0'));module[_0xce2c('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xce2c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xce2c('0x3')]('in',_0xce2c('0x4')),'defaultValue':_0xce2c('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xce2c('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0xce2c('0x6')]}}; \ No newline at end of file +var _0x2904=['out','TEXT','DATE','sequelize','exports','medium','ENUM'];(function(_0x41f594,_0x449ce2){var _0x5b0e8f=function(_0x53abfb){while(--_0x53abfb){_0x41f594['push'](_0x41f594['shift']());}};_0x5b0e8f(++_0x449ce2);}(_0x2904,0x137));var _0x4290=function(_0x578633,_0xae154a){_0x578633=_0x578633-0x0;var _0x3b2e81=_0x2904[_0x578633];return _0x3b2e81;};'use strict';var Sequelize=require(_0x4290('0x0'));module[_0x4290('0x1')]={'body':{'type':Sequelize['TEXT'](_0x4290('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4290('0x3')]('in',_0x4290('0x4')),'defaultValue':_0x4290('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x4290('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0x4290('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 6dc2669..f5a7588 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 _0xd554=['include','rows','show','params','rawAttributes','body','find','destroy','fax-interactions','accept','read','readAt','format','UserId','user','agent','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE: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','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','../../config/logger','get','FaxInteraction','RejectMessage','rejectMessage','ContactId','internal','rejectmessage','create','CmContact','findOne','fax','AttachmentId','SendFax','FaxAccountId','basename','join','root','files','Attachment','download','eml-format','rimraf','fast-json-patch','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','end','stack','name','send','map','FaxMessage','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll'];(function(_0x500a1d,_0x226a30){var _0x17157e=function(_0x51ff45){while(--_0x51ff45){_0x500a1d['push'](_0x500a1d['shift']());}};_0x17157e(++_0x226a30);}(_0xd554,0x1da));var _0x4d55=function(_0x1a6951,_0x3dcda0){_0x1a6951=_0x1a6951-0x0;var _0x22d484=_0xd554[_0x1a6951];return _0x22d484;};'use strict';var emlformat=require(_0x4d55('0x0'));var rimraf=require(_0x4d55('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d55('0x2'));var rp=require('request-promise');var moment=require(_0x4d55('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4d55('0x4'));var path=require('path');var sox=require(_0x4d55('0x5'));var csv=require(_0x4d55('0x6'));var ejs=require(_0x4d55('0x7'));var fs=require('fs');var fs_extra=require(_0x4d55('0x8'));var _=require(_0x4d55('0x9'));var squel=require(_0x4d55('0xa'));var crypto=require(_0x4d55('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4d55('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4d55('0xd'));var Papa=require(_0x4d55('0xe'));var Redis=require(_0x4d55('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4d55('0x10'));var as=require(_0x4d55('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4d55('0x12'));var utils=require(_0x4d55('0x13'));var config=require(_0x4d55('0x14'));var licenseUtil=require(_0x4d55('0x15'));var db=require('../../mysqldb')['db'];config[_0x4d55('0x16')]=_[_0x4d55('0x17')](config[_0x4d55('0x16')],{'host':_0x4d55('0x18'),'port':0x18eb});var socket=require(_0x4d55('0x19'))(new Redis(config[_0x4d55('0x16')]));require(_0x4d55('0x1a'))['register'](socket);var jayson=require(_0x4d55('0x1b'));var client=jayson[_0x4d55('0x1c')][_0x4d55('0x1d')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3de487,_0x26599e,_0xa4f75d,_0x195ea0){return new BPromise(function(_0x220860,_0x3cdaa8){var _0x182950=_0x195ea0||client;return _0x182950['request'](_0x3de487,_0xa4f75d)[_0x4d55('0x1e')](function(_0x59c0ed){logger[_0x4d55('0x1f')]('FaxMessage,\x20%s,\x20%s',_0x26599e,_0x4d55('0x20'));logger[_0x4d55('0x21')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x26599e,_0x4d55('0x20'),JSON[_0x4d55('0x22')](_0x59c0ed));if(_0x59c0ed[_0x4d55('0x23')]){if(_0x59c0ed[_0x4d55('0x23')]['code']===0x1f4){logger['error'](_0x4d55('0x24'),_0x26599e,_0x59c0ed[_0x4d55('0x23')][_0x4d55('0x25')]);return _0x3cdaa8(_0x59c0ed[_0x4d55('0x23')][_0x4d55('0x25')]);}logger[_0x4d55('0x23')]('FaxMessage,\x20%s,\x20%s',_0x26599e,_0x59c0ed['error'][_0x4d55('0x25')]);return _0x220860(_0x59c0ed[_0x4d55('0x23')][_0x4d55('0x25')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x26599e,_0x4d55('0x20'));_0x220860(_0x59c0ed[_0x4d55('0x26')]['message']);}})[_0x4d55('0x27')](function(_0x4edc08){logger[_0x4d55('0x23')](_0x4d55('0x24'),_0x26599e,_0x4edc08);_0x3cdaa8(_0x4edc08);});});}function respondWithStatusCode(_0x43819d,_0x211643){_0x211643=_0x211643||0xcc;return function(_0x386a21){if(_0x386a21){return _0x43819d[_0x4d55('0x28')](_0x211643);}return _0x43819d[_0x4d55('0x29')](_0x211643)['end']();};}function respondWithResult(_0x2b16dc,_0x19ccc2){_0x19ccc2=_0x19ccc2||0xc8;return function(_0x15dc7f){if(_0x15dc7f){return _0x2b16dc[_0x4d55('0x29')](_0x19ccc2)['json'](_0x15dc7f);}};}function respondWithFilteredResult(_0x1516ed,_0x457fd2){return function(_0x4ddbe4){if(_0x4ddbe4){var _0x2a97e5=typeof _0x457fd2[_0x4d55('0x2a')]===_0x4d55('0x2b')&&typeof _0x457fd2[_0x4d55('0x2c')]===_0x4d55('0x2b');var _0x362255=_0x4ddbe4[_0x4d55('0x2d')];var _0x1913fe=_0x2a97e5?0x0:_0x457fd2[_0x4d55('0x2a')];var _0x42da04=_0x2a97e5?_0x4ddbe4[_0x4d55('0x2d')]:_0x457fd2['offset']+_0x457fd2[_0x4d55('0x2c')];var _0x55e113;if(_0x42da04>=_0x362255){_0x42da04=_0x362255;_0x55e113=0xc8;}else{_0x55e113=0xce;}_0x1516ed[_0x4d55('0x29')](_0x55e113);return _0x1516ed[_0x4d55('0x2e')](_0x4d55('0x2f'),_0x1913fe+'-'+_0x42da04+'/'+_0x362255)[_0x4d55('0x30')](_0x4ddbe4);}return null;};}function patchUpdates(_0x35a8a2){return function(_0x4c7c69){try{jsonpatch[_0x4d55('0x31')](_0x4c7c69,_0x35a8a2,!![]);}catch(_0x4966ea){return BPromise[_0x4d55('0x32')](_0x4966ea);}return _0x4c7c69[_0x4d55('0x33')]();};}function saveUpdates(_0x9ac46a,_0x4f27af){return function(_0x165517){if(_0x165517){return _0x165517[_0x4d55('0x34')](_0x9ac46a)['then'](function(_0x2f2e49){return _0x2f2e49;});}return null;};}function removeEntity(_0x10bec1,_0x26b094){return function(_0x39610d){if(_0x39610d){return _0x39610d['destroy']()['then'](function(){_0x10bec1['status'](0xcc)[_0x4d55('0x35')]();});}};}function handleEntityNotFound(_0x5e3d70,_0x29ec3d){return function(_0xfa01c){if(!_0xfa01c){_0x5e3d70['sendStatus'](0x194);}return _0xfa01c;};}function handleError(_0x2f436f,_0x152b9f){_0x152b9f=_0x152b9f||0x1f4;return function(_0x334bf1){logger[_0x4d55('0x23')](_0x334bf1[_0x4d55('0x36')]);if(_0x334bf1[_0x4d55('0x37')]){delete _0x334bf1['name'];}_0x2f436f[_0x4d55('0x29')](_0x152b9f)[_0x4d55('0x38')](_0x334bf1);};}exports['index']=function(_0x4bf0d1,_0x2c73cc){var _0x2b5fcc={},_0x42d981={},_0x44fc6c={'count':0x0,'rows':[]};var _0x8531dc=_[_0x4d55('0x39')](db[_0x4d55('0x3a')]['rawAttributes'],function(_0x379452){return{'name':_0x379452[_0x4d55('0x3b')],'type':_0x379452[_0x4d55('0x3c')]['key']};});_0x42d981[_0x4d55('0x3d')]=_[_0x4d55('0x39')](_0x8531dc,_0x4d55('0x37'));_0x42d981[_0x4d55('0x3e')]=_[_0x4d55('0x3f')](_0x4bf0d1[_0x4d55('0x3e')]);_0x42d981[_0x4d55('0x40')]=_[_0x4d55('0x41')](_0x42d981['model'],_0x42d981[_0x4d55('0x3e')]);_0x2b5fcc[_0x4d55('0x42')]=_[_0x4d55('0x41')](_0x42d981[_0x4d55('0x3d')],qs['fields'](_0x4bf0d1[_0x4d55('0x3e')][_0x4d55('0x43')]));_0x2b5fcc[_0x4d55('0x42')]=_0x2b5fcc['attributes'][_0x4d55('0x44')]?_0x2b5fcc[_0x4d55('0x42')]:_0x42d981[_0x4d55('0x3d')];if(!_0x4bf0d1[_0x4d55('0x3e')][_0x4d55('0x45')](_0x4d55('0x46'))){_0x2b5fcc[_0x4d55('0x2c')]=qs[_0x4d55('0x2c')](_0x4bf0d1[_0x4d55('0x3e')][_0x4d55('0x2c')]);_0x2b5fcc['offset']=qs[_0x4d55('0x2a')](_0x4bf0d1[_0x4d55('0x3e')][_0x4d55('0x2a')]);}_0x2b5fcc['order']=qs[_0x4d55('0x47')](_0x4bf0d1[_0x4d55('0x3e')][_0x4d55('0x47')]);_0x2b5fcc[_0x4d55('0x48')]=qs[_0x4d55('0x40')](_[_0x4d55('0x49')](_0x4bf0d1[_0x4d55('0x3e')],_0x42d981[_0x4d55('0x40')]),_0x8531dc);if(_0x4bf0d1['query'][_0x4d55('0x4a')]){_0x2b5fcc['where']=_[_0x4d55('0x4b')](_0x2b5fcc['where'],{'$or':_[_0x4d55('0x39')](_0x8531dc,function(_0x49ec07){if(_0x49ec07[_0x4d55('0x3c')]!=='VIRTUAL'){var _0xe96178={};_0xe96178[_0x49ec07[_0x4d55('0x37')]]={'$like':'%'+_0x4bf0d1[_0x4d55('0x3e')][_0x4d55('0x4a')]+'%'};return _0xe96178;}})});}_0x2b5fcc=_[_0x4d55('0x4b')]({},_0x2b5fcc,_0x4bf0d1[_0x4d55('0x4c')]);var _0x53054d={'where':_0x2b5fcc['where']};return db[_0x4d55('0x3a')][_0x4d55('0x2d')](_0x53054d)[_0x4d55('0x1e')](function(_0x236357){_0x44fc6c['count']=_0x236357;if(_0x4bf0d1[_0x4d55('0x3e')][_0x4d55('0x4d')]){_0x2b5fcc[_0x4d55('0x4e')]=[{'all':!![]}];}return db[_0x4d55('0x3a')]['findAll'](_0x2b5fcc);})[_0x4d55('0x1e')](function(_0x3c87ab){_0x44fc6c[_0x4d55('0x4f')]=_0x3c87ab;return _0x44fc6c;})[_0x4d55('0x1e')](respondWithFilteredResult(_0x2c73cc,_0x2b5fcc))[_0x4d55('0x27')](handleError(_0x2c73cc,null));};exports[_0x4d55('0x50')]=function(_0x251cc6,_0x26aeb5){var _0x48065a={'raw':!![],'where':{'id':_0x251cc6[_0x4d55('0x51')]['id']}},_0x46eb0a={};_0x46eb0a['model']=_[_0x4d55('0x3f')](db[_0x4d55('0x3a')][_0x4d55('0x52')]);_0x46eb0a[_0x4d55('0x3e')]=_['keys'](_0x251cc6[_0x4d55('0x3e')]);_0x46eb0a['filters']=_[_0x4d55('0x41')](_0x46eb0a[_0x4d55('0x3d')],_0x46eb0a[_0x4d55('0x3e')]);_0x48065a[_0x4d55('0x42')]=_[_0x4d55('0x41')](_0x46eb0a[_0x4d55('0x3d')],qs[_0x4d55('0x43')](_0x251cc6[_0x4d55('0x3e')][_0x4d55('0x43')]));_0x48065a[_0x4d55('0x42')]=_0x48065a[_0x4d55('0x42')][_0x4d55('0x44')]?_0x48065a['attributes']:_0x46eb0a[_0x4d55('0x3d')];if(_0x251cc6[_0x4d55('0x3e')][_0x4d55('0x4d')]){_0x48065a[_0x4d55('0x4e')]=[{'all':!![]}];}_0x48065a=_['merge']({},_0x48065a,_0x251cc6[_0x4d55('0x4c')]);return db[_0x4d55('0x3a')]['find'](_0x48065a)[_0x4d55('0x1e')](handleEntityNotFound(_0x26aeb5,null))[_0x4d55('0x1e')](respondWithResult(_0x26aeb5,null))['catch'](handleError(_0x26aeb5,null));};exports[_0x4d55('0x34')]=function(_0x28a42a,_0x497297){if(_0x28a42a[_0x4d55('0x53')]['id']){delete _0x28a42a['body']['id'];}return db[_0x4d55('0x3a')][_0x4d55('0x54')]({'where':{'id':_0x28a42a[_0x4d55('0x51')]['id']}})['then'](handleEntityNotFound(_0x497297,null))[_0x4d55('0x1e')](saveUpdates(_0x28a42a[_0x4d55('0x53')],null))['then'](respondWithResult(_0x497297,null))[_0x4d55('0x27')](handleError(_0x497297,null));};exports[_0x4d55('0x55')]=function(_0x426104,_0x2410bc){return db[_0x4d55('0x3a')][_0x4d55('0x54')]({'where':{'id':_0x426104[_0x4d55('0x51')]['id']}})[_0x4d55('0x1e')](handleEntityNotFound(_0x2410bc,null))[_0x4d55('0x1e')](removeEntity(_0x2410bc,null))[_0x4d55('0x27')](handleError(_0x2410bc,null));};exports['describe']=function(_0x377fef,_0x51e6bc){return db[_0x4d55('0x3a')]['describe']()[_0x4d55('0x1e')](respondWithResult(_0x51e6bc,null))[_0x4d55('0x27')](handleError(_0x51e6bc,null));};var interaction_log=require('../../config/logger')(_0x4d55('0x56'));exports[_0x4d55('0x57')]=function(_0x30c1a4,_0x48a3d4,_0xe2f7b4){var _0xa0b5eb={'agent':{},'channel':'fax'};if(_0x30c1a4[_0x4d55('0x53')]['id']){delete _0x30c1a4[_0x4d55('0x53')]['id'];}_0x30c1a4[_0x4d55('0x53')][_0x4d55('0x58')]=!![];_0x30c1a4[_0x4d55('0x53')][_0x4d55('0x59')]=moment()[_0x4d55('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x30c1a4['body']['UserId']=_0x30c1a4[_0x4d55('0x53')][_0x4d55('0x5b')]||_0x30c1a4[_0x4d55('0x5c')]['id'];_0xa0b5eb[_0x4d55('0x5d')]['id']=_0x30c1a4['body'][_0x4d55('0x5b')];return db[_0x4d55('0x3a')]['find']({'where':{'id':_0x30c1a4[_0x4d55('0x51')]['id'],'UserId':null}})[_0x4d55('0x1e')](handleEntityNotFound(_0x48a3d4,null))[_0x4d55('0x1e')](saveUpdates(_0x30c1a4[_0x4d55('0x53')],null))['then'](function(_0x5698aa){if(_0x5698aa){_0xa0b5eb['message']=_0x5698aa['get']({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x5698aa[_0x4d55('0x5e')]}});}return null;})[_0x4d55('0x1e')](handleEntityNotFound(_0x48a3d4,null))['then'](function(_0x35d143){if(_0x35d143){return _0x35d143['update']({'UserId':_0x30c1a4['body']['UserId'],'read1stAt':_[_0x4d55('0x5f')](_0x35d143[_0x4d55('0x60')])?moment()[_0x4d55('0x5a')](_0x4d55('0x61')):undefined});}return null;})[_0x4d55('0x1e')](function(_0x5db99a){if(_0x5db99a){_0xa0b5eb[_0x4d55('0x62')]=_0x5db99a['get']({'plain':!![]});interaction_log[_0x4d55('0x1f')](_0x4d55('0x63'),_0x30c1a4[_0x4d55('0x5c')]['id'],_0x30c1a4[_0x4d55('0x5c')][_0x4d55('0x37')],_0x30c1a4[_0x4d55('0x5c')]['role'],_0xa0b5eb[_0x4d55('0x62')]['id'],_0x30c1a4[_0x4d55('0x53')]?JSON['stringify'](_0x30c1a4[_0x4d55('0x53')]):_0x4d55('0x64'));return respondWithRpcPromise(_0x4d55('0x65'),'acceptMessage',_0xa0b5eb);}return null;})[_0x4d55('0x1e')](function(_0x7569a){var _0x198ab6=_0x4d55('0x66')+_0x7569a[_0x4d55('0x25')]['ContactId'];return db[_0x4d55('0x67')][_0x4d55('0x3e')](_0x198ab6,{'type':db[_0x4d55('0x68')][_0x4d55('0x69')][_0x4d55('0x6a')],'raw':!![]})[_0x4d55('0x1e')](function(_0x152dfb){return _0x152dfb;});})[_0x4d55('0x1e')](function(_0x14ac25){if(_0x14ac25){_0xa0b5eb[_0x4d55('0x25')]['contact']=_0x14ac25[0x0];if(!_0x30c1a4[_0x4d55('0x53')][_0x4d55('0x5b')])return;return db[_0x4d55('0x6b')][_0x4d55('0x54')]({'where':{'id':_0x30c1a4[_0x4d55('0x53')]['UserId'],'role':_0x4d55('0x5d')},'attributes':['id','name',_0x4d55('0x6c'),_0x4d55('0x6d'),'internal'],'raw':!![]});}return null;})[_0x4d55('0x1e')](function(_0x25e098){if(!_0x25e098)return null;_0xa0b5eb['message'][_0x4d55('0x5d')]=_0x25e098;return _0xa0b5eb;})[_0x4d55('0x1e')](function(_0x3e49e5){if(_0x3e49e5){if(_0x30c1a4['body'][_0x4d55('0x6e')]){_0xa0b5eb[_0x4d55('0x25')][_0x4d55('0x6f')]=util[_0x4d55('0x5a')](_0x4d55('0x70'),_0x30c1a4[_0x4d55('0x5c')][_0x4d55('0x37')]);_0xa0b5eb[_0x4d55('0x25')][_0x4d55('0x71')]=_0xa0b5eb[_0x4d55('0x71')];_0xa0b5eb[_0x4d55('0x25')][_0x4d55('0x72')]=_0xa0b5eb['channel'];_0xa0b5eb[_0x4d55('0x25')][_0x4d55('0x73')]=_0x4d55('0x57');return respondWithRpcPromise(_0x4d55('0x74'),_0x4d55('0x74'),{'event':'acceptmessage','message':_0xa0b5eb[_0x4d55('0x25')]},client9002)[_0x4d55('0x1e')](function(){return _0xa0b5eb;});}return _0xa0b5eb;}return null;})[_0x4d55('0x1e')](respondWithResult(_0x48a3d4,null))[_0x4d55('0x27')](handleError(_0x48a3d4,null));};var interaction_log=require(_0x4d55('0x75'))('fax-interactions');exports[_0x4d55('0x32')]=function(_0x352377,_0x3567a8,_0x2edde2){var _0x11aacb={'agent':{},'channel':'fax'};if(_0x352377['body']['id']){delete _0x352377[_0x4d55('0x53')]['id'];}_0x352377[_0x4d55('0x53')]['UserId']=_0x352377[_0x4d55('0x53')]['UserId']||_0x352377['user']['id'];_0x11aacb[_0x4d55('0x5d')]['id']=_0x352377['body']['UserId'];return db[_0x4d55('0x3a')]['find']({'where':{'id':_0x352377[_0x4d55('0x51')]['id'],'UserId':null}})[_0x4d55('0x1e')](handleEntityNotFound(_0x3567a8,null))[_0x4d55('0x1e')](function(_0x1bee31){if(_0x1bee31){_0x11aacb['message']=_0x1bee31[_0x4d55('0x76')]({'plain':!![]});return db[_0x4d55('0x77')]['find']({'where':{'id':_0x1bee31[_0x4d55('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x3567a8,null))[_0x4d55('0x1e')](function(_0x59080b){if(_0x59080b){_0x11aacb[_0x4d55('0x62')]=_0x59080b[_0x4d55('0x76')]({'plain':!![]});interaction_log[_0x4d55('0x1f')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x352377['user']['id'],_0x352377['user'][_0x4d55('0x37')],_0x352377['user']['role'],_0x11aacb[_0x4d55('0x62')]['id'],_0x352377[_0x4d55('0x53')]?JSON[_0x4d55('0x22')](_0x352377['body']):'null');return respondWithRpcPromise(_0x4d55('0x78'),_0x4d55('0x79'),_0x11aacb);}return null;})[_0x4d55('0x1e')](function(_0x10da79){var _0x367628='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x10da79['message'][_0x4d55('0x7a')];return db[_0x4d55('0x67')][_0x4d55('0x3e')](_0x367628,{'type':db[_0x4d55('0x68')][_0x4d55('0x69')][_0x4d55('0x6a')],'raw':!![]})[_0x4d55('0x1e')](function(_0x1ab57b){return _0x1ab57b;});})[_0x4d55('0x1e')](function(_0x33a0a4){if(_0x33a0a4){_0x11aacb[_0x4d55('0x25')]['contact']=_0x33a0a4[0x0];if(!_0x352377[_0x4d55('0x53')][_0x4d55('0x5b')])return;return db[_0x4d55('0x6b')][_0x4d55('0x54')]({'where':{'id':_0x352377[_0x4d55('0x53')][_0x4d55('0x5b')],'role':_0x4d55('0x5d')},'attributes':['id',_0x4d55('0x37'),_0x4d55('0x6c'),_0x4d55('0x6d'),_0x4d55('0x7b')],'raw':!![]});}return null;})[_0x4d55('0x1e')](function(_0x313e8b){if(!_0x313e8b)return null;_0x11aacb[_0x4d55('0x25')][_0x4d55('0x5d')]=_0x313e8b;return _0x11aacb;})[_0x4d55('0x1e')](function(_0x21a213){if(_0x21a213){_0x21a213['message'][_0x4d55('0x6f')]=util['format'](_0x4d55('0x70'),_0x352377[_0x4d55('0x5c')][_0x4d55('0x37')]);_0x21a213[_0x4d55('0x25')]['channel']=_0x11aacb[_0x4d55('0x71')];_0x21a213['message'][_0x4d55('0x72')]=_0x11aacb['channel'];_0x21a213[_0x4d55('0x25')][_0x4d55('0x73')]=_0x4d55('0x32');respondWithRpcPromise(_0x4d55('0x74'),_0x4d55('0x74'),{'event':_0x4d55('0x7c'),'message':_0x21a213['message']},client9002);return _0x11aacb;}return null;})[_0x4d55('0x1e')](respondWithResult(_0x3567a8,null))[_0x4d55('0x27')](handleError(_0x3567a8,null));};exports[_0x4d55('0x7d')]=function(_0x22558d,_0x13e3c1){var _0xd44a6a;return db[_0x4d55('0x3a')]['create'](_0x22558d[_0x4d55('0x53')],{})[_0x4d55('0x1e')](function(_0x248e9e){_0xd44a6a=_0x248e9e;return db[_0x4d55('0x7e')][_0x4d55('0x7f')]({'where':{'id':_0xd44a6a[_0x4d55('0x7a')]}});})[_0x4d55('0x1e')](function(_0x4d5afa){if(_['isNil'](_0x4d5afa)){return;}else{_0xd44a6a[_0x4d55('0x80')]=_0x4d5afa['fax'];return db['Attachment'][_0x4d55('0x7f')]({'where':{'id':_0xd44a6a[_0x4d55('0x81')]}});}})[_0x4d55('0x1e')](function(_0x373ebc){return respondWithRpcPromise(_0x4d55('0x82'),'SendFax',{'FaxAccountId':_[_0x4d55('0x5f')](_0x22558d['body'])?undefined:_0x22558d[_0x4d55('0x53')][_0x4d55('0x83')],'path':_[_0x4d55('0x5f')](_0x373ebc)?undefined:util[_0x4d55('0x5a')]('/var/opt/motion2/server/files/attachments/%s',_0x373ebc[_0x4d55('0x84')]),'fax':_[_0x4d55('0x5f')](_0xd44a6a['fax'])?undefined:_0xd44a6a[_0x4d55('0x80')],'AttachmentId':_0xd44a6a[_0x4d55('0x81')]},client9002);})[_0x4d55('0x1e')](respondWithResult(_0x13e3c1,0xc9))['catch'](handleError(_0x13e3c1,null));};exports['download']=function(_0x60b12c,_0x38dde8){var _0x31e6de=path[_0x4d55('0x85')](config[_0x4d55('0x86')],'server',_0x4d55('0x87'),'attachments');return db['FaxMessage'][_0x4d55('0x54')]({'where':{'id':_0x60b12c['params']['id']},'include':[{'model':db[_0x4d55('0x88')],'as':'Attachment'}]})[_0x4d55('0x1e')](handleEntityNotFound(_0x38dde8,null))[_0x4d55('0x1e')](function(_0x17ae75){if(_0x17ae75){return _0x38dde8[_0x4d55('0x89')](path[_0x4d55('0x85')](_0x31e6de,_0x17ae75['Attachment'][_0x4d55('0x84')]));}})[_0x4d55('0x27')](handleError(_0x38dde8,null));}; \ No newline at end of file +var _0x2195=['FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','role','stringify','null','acceptMessage','ContactId','sequelize','Sequelize','contact','User','agent','fullname','email','internal','SIP/%s','channel','motionChannel','event','EventManager','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','interface','rejectmessage','findOne','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','files','Attachment','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./faxMessage.socket','register','client','http','request','then','FaxMessage,\x20%s,\x20%s','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','index','map','FaxMessage','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','length','find','body','describe','fax-interactions','accept','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get'];(function(_0x3d3f80,_0x264ad7){var _0x54ce4b=function(_0x366d71){while(--_0x366d71){_0x3d3f80['push'](_0x3d3f80['shift']());}};_0x54ce4b(++_0x264ad7);}(_0x2195,0x13a));var _0x5219=function(_0x43bdfa,_0x47bbd0){_0x43bdfa=_0x43bdfa-0x0;var _0x34dcdd=_0x2195[_0x43bdfa];return _0x34dcdd;};'use strict';var emlformat=require(_0x5219('0x0'));var rimraf=require(_0x5219('0x1'));var zipdir=require(_0x5219('0x2'));var jsonpatch=require(_0x5219('0x3'));var rp=require(_0x5219('0x4'));var moment=require(_0x5219('0x5'));var BPromise=require(_0x5219('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5219('0x7'));var sox=require(_0x5219('0x8'));var csv=require(_0x5219('0x9'));var ejs=require(_0x5219('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5219('0xb'));var crypto=require('crypto');var jsforce=require(_0x5219('0xc'));var deskjs=require(_0x5219('0xd'));var toCsv=require(_0x5219('0x9'));var querystring=require(_0x5219('0xe'));var Papa=require(_0x5219('0xf'));var Redis=require(_0x5219('0x10'));var authService=require(_0x5219('0x11'));var qs=require(_0x5219('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5219('0x13'));var logger=require(_0x5219('0x14'))(_0x5219('0x15'));var utils=require(_0x5219('0x16'));var config=require(_0x5219('0x17'));var licenseUtil=require(_0x5219('0x18'));var db=require(_0x5219('0x19'))['db'];config['redis']=_[_0x5219('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5219('0x1b'))(new Redis(config[_0x5219('0x1c')]));require(_0x5219('0x1d'))[_0x5219('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5219('0x1f')][_0x5219('0x20')]({'port':0x232c});var client9002=jayson[_0x5219('0x1f')][_0x5219('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x22f314,_0x1882e8,_0x4a9f71,_0x4bfe26){return new BPromise(function(_0x104bdf,_0x570e27){var _0x3e7a2e=_0x4bfe26||client;return _0x3e7a2e[_0x5219('0x21')](_0x22f314,_0x4a9f71)[_0x5219('0x22')](function(_0x3062ae){logger['info'](_0x5219('0x23'),_0x1882e8,'request\x20sent');logger['debug'](_0x5219('0x24'),_0x1882e8,_0x5219('0x25'),JSON['stringify'](_0x3062ae));if(_0x3062ae[_0x5219('0x26')]){if(_0x3062ae[_0x5219('0x26')][_0x5219('0x27')]===0x1f4){logger[_0x5219('0x26')]('FaxMessage,\x20%s,\x20%s',_0x1882e8,_0x3062ae[_0x5219('0x26')]['message']);return _0x570e27(_0x3062ae[_0x5219('0x26')]['message']);}logger[_0x5219('0x26')](_0x5219('0x23'),_0x1882e8,_0x3062ae[_0x5219('0x26')][_0x5219('0x28')]);return _0x104bdf(_0x3062ae[_0x5219('0x26')]['message']);}else{logger[_0x5219('0x29')](_0x5219('0x23'),_0x1882e8,_0x5219('0x25'));_0x104bdf(_0x3062ae[_0x5219('0x2a')][_0x5219('0x28')]);}})[_0x5219('0x2b')](function(_0x3701ae){logger[_0x5219('0x26')](_0x5219('0x23'),_0x1882e8,_0x3701ae);_0x570e27(_0x3701ae);});});}function respondWithStatusCode(_0x216047,_0x3c0c61){_0x3c0c61=_0x3c0c61||0xcc;return function(_0x1bb041){if(_0x1bb041){return _0x216047['sendStatus'](_0x3c0c61);}return _0x216047[_0x5219('0x2c')](_0x3c0c61)[_0x5219('0x2d')]();};}function respondWithResult(_0x274c1e,_0x39c638){_0x39c638=_0x39c638||0xc8;return function(_0x577025){if(_0x577025){return _0x274c1e[_0x5219('0x2c')](_0x39c638)[_0x5219('0x2e')](_0x577025);}};}function respondWithFilteredResult(_0x1f5e67,_0x3058ee){return function(_0x5a9a59){if(_0x5a9a59){var _0x46f385=typeof _0x3058ee[_0x5219('0x2f')]===_0x5219('0x30')&&typeof _0x3058ee[_0x5219('0x31')]===_0x5219('0x30');var _0x854aa8=_0x5a9a59['count'];var _0x8fac1b=_0x46f385?0x0:_0x3058ee[_0x5219('0x2f')];var _0x30180a=_0x46f385?_0x5a9a59[_0x5219('0x32')]:_0x3058ee[_0x5219('0x2f')]+_0x3058ee[_0x5219('0x31')];var _0x29d5dc;if(_0x30180a>=_0x854aa8){_0x30180a=_0x854aa8;_0x29d5dc=0xc8;}else{_0x29d5dc=0xce;}_0x1f5e67[_0x5219('0x2c')](_0x29d5dc);return _0x1f5e67[_0x5219('0x33')](_0x5219('0x34'),_0x8fac1b+'-'+_0x30180a+'/'+_0x854aa8)['json'](_0x5a9a59);}return null;};}function patchUpdates(_0xe9dfcb){return function(_0x4c9bac){try{jsonpatch[_0x5219('0x35')](_0x4c9bac,_0xe9dfcb,!![]);}catch(_0x423b9b){return BPromise[_0x5219('0x36')](_0x423b9b);}return _0x4c9bac[_0x5219('0x37')]();};}function saveUpdates(_0x2964b7,_0x446ab0){return function(_0x36e1de){if(_0x36e1de){return _0x36e1de[_0x5219('0x38')](_0x2964b7)[_0x5219('0x22')](function(_0x49921a){return _0x49921a;});}return null;};}function removeEntity(_0x1a5bb0,_0x270c36){return function(_0x202bc1){if(_0x202bc1){return _0x202bc1[_0x5219('0x39')]()[_0x5219('0x22')](function(){_0x1a5bb0[_0x5219('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cd4a3,_0x53d3f0){return function(_0x43ca1b){if(!_0x43ca1b){_0x4cd4a3[_0x5219('0x3a')](0x194);}return _0x43ca1b;};}function handleError(_0x17885e,_0x39b0d2){_0x39b0d2=_0x39b0d2||0x1f4;return function(_0xed9222){logger[_0x5219('0x26')](_0xed9222['stack']);if(_0xed9222[_0x5219('0x3b')]){delete _0xed9222[_0x5219('0x3b')];}_0x17885e[_0x5219('0x2c')](_0x39b0d2)['send'](_0xed9222);};}exports[_0x5219('0x3c')]=function(_0x50741b,_0xdcdf19){var _0x13d2ee={},_0x53ff63={},_0x435730={'count':0x0,'rows':[]};var _0x21100c=_[_0x5219('0x3d')](db[_0x5219('0x3e')]['rawAttributes'],function(_0x3120c4){return{'name':_0x3120c4[_0x5219('0x3f')],'type':_0x3120c4[_0x5219('0x40')]['key']};});_0x53ff63[_0x5219('0x41')]=_[_0x5219('0x3d')](_0x21100c,_0x5219('0x3b'));_0x53ff63[_0x5219('0x42')]=_['keys'](_0x50741b[_0x5219('0x42')]);_0x53ff63[_0x5219('0x43')]=_[_0x5219('0x44')](_0x53ff63[_0x5219('0x41')],_0x53ff63[_0x5219('0x42')]);_0x13d2ee['attributes']=_[_0x5219('0x44')](_0x53ff63[_0x5219('0x41')],qs[_0x5219('0x45')](_0x50741b['query'][_0x5219('0x45')]));_0x13d2ee[_0x5219('0x46')]=_0x13d2ee[_0x5219('0x46')]['length']?_0x13d2ee[_0x5219('0x46')]:_0x53ff63['model'];if(!_0x50741b[_0x5219('0x42')][_0x5219('0x47')](_0x5219('0x48'))){_0x13d2ee[_0x5219('0x31')]=qs[_0x5219('0x31')](_0x50741b[_0x5219('0x42')][_0x5219('0x31')]);_0x13d2ee[_0x5219('0x2f')]=qs['offset'](_0x50741b[_0x5219('0x42')]['offset']);}_0x13d2ee[_0x5219('0x49')]=qs[_0x5219('0x4a')](_0x50741b[_0x5219('0x42')][_0x5219('0x4a')]);_0x13d2ee['where']=qs['filters'](_[_0x5219('0x4b')](_0x50741b[_0x5219('0x42')],_0x53ff63[_0x5219('0x43')]),_0x21100c);if(_0x50741b[_0x5219('0x42')][_0x5219('0x4c')]){_0x13d2ee[_0x5219('0x4d')]=_[_0x5219('0x4e')](_0x13d2ee[_0x5219('0x4d')],{'$or':_[_0x5219('0x3d')](_0x21100c,function(_0x5a9fff){if(_0x5a9fff[_0x5219('0x40')]!==_0x5219('0x4f')){var _0x52ad3e={};_0x52ad3e[_0x5a9fff[_0x5219('0x3b')]]={'$like':'%'+_0x50741b['query'][_0x5219('0x4c')]+'%'};return _0x52ad3e;}})});}_0x13d2ee=_[_0x5219('0x4e')]({},_0x13d2ee,_0x50741b[_0x5219('0x50')]);var _0x1c6e50={'where':_0x13d2ee['where']};return db['FaxMessage'][_0x5219('0x32')](_0x1c6e50)['then'](function(_0x4b4c0a){_0x435730[_0x5219('0x32')]=_0x4b4c0a;if(_0x50741b[_0x5219('0x42')][_0x5219('0x51')]){_0x13d2ee[_0x5219('0x52')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x13d2ee);})[_0x5219('0x22')](function(_0x5bd203){_0x435730[_0x5219('0x53')]=_0x5bd203;return _0x435730;})[_0x5219('0x22')](respondWithFilteredResult(_0xdcdf19,_0x13d2ee))[_0x5219('0x2b')](handleError(_0xdcdf19,null));};exports[_0x5219('0x54')]=function(_0x546c4b,_0x231df1){var _0x4a0de1={'raw':!![],'where':{'id':_0x546c4b[_0x5219('0x55')]['id']}},_0xdfbcac={};_0xdfbcac['model']=_[_0x5219('0x56')](db[_0x5219('0x3e')]['rawAttributes']);_0xdfbcac[_0x5219('0x42')]=_['keys'](_0x546c4b[_0x5219('0x42')]);_0xdfbcac[_0x5219('0x43')]=_['intersection'](_0xdfbcac[_0x5219('0x41')],_0xdfbcac['query']);_0x4a0de1[_0x5219('0x46')]=_[_0x5219('0x44')](_0xdfbcac[_0x5219('0x41')],qs[_0x5219('0x45')](_0x546c4b[_0x5219('0x42')][_0x5219('0x45')]));_0x4a0de1[_0x5219('0x46')]=_0x4a0de1[_0x5219('0x46')][_0x5219('0x57')]?_0x4a0de1[_0x5219('0x46')]:_0xdfbcac[_0x5219('0x41')];if(_0x546c4b[_0x5219('0x42')]['includeAll']){_0x4a0de1[_0x5219('0x52')]=[{'all':!![]}];}_0x4a0de1=_[_0x5219('0x4e')]({},_0x4a0de1,_0x546c4b[_0x5219('0x50')]);return db[_0x5219('0x3e')][_0x5219('0x58')](_0x4a0de1)[_0x5219('0x22')](handleEntityNotFound(_0x231df1,null))['then'](respondWithResult(_0x231df1,null))['catch'](handleError(_0x231df1,null));};exports[_0x5219('0x38')]=function(_0x492aad,_0x2da536){if(_0x492aad[_0x5219('0x59')]['id']){delete _0x492aad['body']['id'];}return db[_0x5219('0x3e')][_0x5219('0x58')]({'where':{'id':_0x492aad[_0x5219('0x55')]['id']}})[_0x5219('0x22')](handleEntityNotFound(_0x2da536,null))[_0x5219('0x22')](saveUpdates(_0x492aad[_0x5219('0x59')],null))[_0x5219('0x22')](respondWithResult(_0x2da536,null))[_0x5219('0x2b')](handleError(_0x2da536,null));};exports[_0x5219('0x39')]=function(_0x3ccc31,_0x3e2200){return db['FaxMessage'][_0x5219('0x58')]({'where':{'id':_0x3ccc31[_0x5219('0x55')]['id']}})[_0x5219('0x22')](handleEntityNotFound(_0x3e2200,null))[_0x5219('0x22')](removeEntity(_0x3e2200,null))['catch'](handleError(_0x3e2200,null));};exports[_0x5219('0x5a')]=function(_0x352812,_0x4adf99){return db[_0x5219('0x3e')][_0x5219('0x5a')]()[_0x5219('0x22')](respondWithResult(_0x4adf99,null))[_0x5219('0x2b')](handleError(_0x4adf99,null));};var interaction_log=require(_0x5219('0x14'))(_0x5219('0x5b'));exports[_0x5219('0x5c')]=function(_0x133b52,_0x28258d,_0x27af98){var _0x4e5cb9={'agent':{},'channel':_0x5219('0x5d')};if(_0x133b52['body']['id']){delete _0x133b52[_0x5219('0x59')]['id'];}_0x133b52[_0x5219('0x59')]['read']=!![];_0x133b52[_0x5219('0x59')][_0x5219('0x5e')]=moment()[_0x5219('0x5f')](_0x5219('0x60'));_0x133b52[_0x5219('0x59')][_0x5219('0x61')]=_0x133b52[_0x5219('0x59')][_0x5219('0x61')]||_0x133b52[_0x5219('0x62')]['id'];_0x4e5cb9['agent']['id']=_0x133b52[_0x5219('0x59')][_0x5219('0x61')];return db[_0x5219('0x3e')][_0x5219('0x58')]({'where':{'id':_0x133b52[_0x5219('0x55')]['id'],'UserId':null}})[_0x5219('0x22')](handleEntityNotFound(_0x28258d,null))['then'](saveUpdates(_0x133b52['body'],null))[_0x5219('0x22')](function(_0x3b7e63){if(_0x3b7e63){_0x4e5cb9[_0x5219('0x28')]=_0x3b7e63[_0x5219('0x63')]({'plain':!![]});return db[_0x5219('0x64')][_0x5219('0x58')]({'where':{'id':_0x3b7e63[_0x5219('0x65')]}});}return null;})[_0x5219('0x22')](handleEntityNotFound(_0x28258d,null))['then'](function(_0x4b7ad9){if(_0x4b7ad9){return _0x4b7ad9['update']({'UserId':_0x133b52[_0x5219('0x59')][_0x5219('0x61')],'read1stAt':_[_0x5219('0x66')](_0x4b7ad9[_0x5219('0x67')])?moment()[_0x5219('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x2983d6){if(_0x2983d6){_0x4e5cb9[_0x5219('0x68')]=_0x2983d6[_0x5219('0x63')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x133b52['user']['id'],_0x133b52[_0x5219('0x62')][_0x5219('0x3b')],_0x133b52[_0x5219('0x62')][_0x5219('0x69')],_0x4e5cb9[_0x5219('0x68')]['id'],_0x133b52[_0x5219('0x59')]?JSON[_0x5219('0x6a')](_0x133b52['body']):_0x5219('0x6b'));return respondWithRpcPromise('AcceptMessage',_0x5219('0x6c'),_0x4e5cb9);}return null;})[_0x5219('0x22')](function(_0x482224){var _0x4bc17c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x482224[_0x5219('0x28')][_0x5219('0x6d')];return db[_0x5219('0x6e')][_0x5219('0x42')](_0x4bc17c,{'type':db[_0x5219('0x6f')]['QueryTypes']['SELECT'],'raw':!![]})[_0x5219('0x22')](function(_0x2ce657){return _0x2ce657;});})['then'](function(_0x156198){if(_0x156198){_0x4e5cb9[_0x5219('0x28')][_0x5219('0x70')]=_0x156198[0x0];if(!_0x133b52[_0x5219('0x59')]['UserId'])return;return db[_0x5219('0x71')][_0x5219('0x58')]({'where':{'id':_0x133b52['body'][_0x5219('0x61')],'role':_0x5219('0x72')},'attributes':['id',_0x5219('0x3b'),_0x5219('0x73'),_0x5219('0x74'),_0x5219('0x75')],'raw':!![]});}return null;})[_0x5219('0x22')](function(_0x5bc319){if(!_0x5bc319)return null;_0x4e5cb9[_0x5219('0x28')][_0x5219('0x72')]=_0x5bc319;return _0x4e5cb9;})['then'](function(_0x5726e3){if(_0x5726e3){if(_0x133b52[_0x5219('0x59')]['manual']){_0x4e5cb9[_0x5219('0x28')]['interface']=util[_0x5219('0x5f')](_0x5219('0x76'),_0x133b52['user'][_0x5219('0x3b')]);_0x4e5cb9[_0x5219('0x28')][_0x5219('0x77')]=_0x4e5cb9[_0x5219('0x77')];_0x4e5cb9['message'][_0x5219('0x78')]=_0x4e5cb9[_0x5219('0x77')];_0x4e5cb9[_0x5219('0x28')][_0x5219('0x79')]=_0x5219('0x5c');return respondWithRpcPromise(_0x5219('0x7a'),_0x5219('0x7a'),{'event':'acceptmessage','message':_0x4e5cb9[_0x5219('0x28')]},client9002)[_0x5219('0x22')](function(){return _0x4e5cb9;});}return _0x4e5cb9;}return null;})[_0x5219('0x22')](respondWithResult(_0x28258d,null))['catch'](handleError(_0x28258d,null));};var interaction_log=require('../../config/logger')(_0x5219('0x5b'));exports[_0x5219('0x36')]=function(_0x3d59f6,_0x4dfd30,_0x29b1f0){var _0xc77b0={'agent':{},'channel':'fax'};if(_0x3d59f6[_0x5219('0x59')]['id']){delete _0x3d59f6['body']['id'];}_0x3d59f6[_0x5219('0x59')][_0x5219('0x61')]=_0x3d59f6[_0x5219('0x59')][_0x5219('0x61')]||_0x3d59f6[_0x5219('0x62')]['id'];_0xc77b0[_0x5219('0x72')]['id']=_0x3d59f6[_0x5219('0x59')][_0x5219('0x61')];return db['FaxMessage'][_0x5219('0x58')]({'where':{'id':_0x3d59f6[_0x5219('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4dfd30,null))[_0x5219('0x22')](function(_0x1604cd){if(_0x1604cd){_0xc77b0[_0x5219('0x28')]=_0x1604cd['get']({'plain':!![]});return db[_0x5219('0x64')]['find']({'where':{'id':_0x1604cd[_0x5219('0x65')]}});}return null;})[_0x5219('0x22')](handleEntityNotFound(_0x4dfd30,null))[_0x5219('0x22')](function(_0x98435){if(_0x98435){_0xc77b0['interaction']=_0x98435['get']({'plain':!![]});interaction_log[_0x5219('0x29')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3d59f6[_0x5219('0x62')]['id'],_0x3d59f6[_0x5219('0x62')][_0x5219('0x3b')],_0x3d59f6[_0x5219('0x62')][_0x5219('0x69')],_0xc77b0[_0x5219('0x68')]['id'],_0x3d59f6[_0x5219('0x59')]?JSON[_0x5219('0x6a')](_0x3d59f6[_0x5219('0x59')]):_0x5219('0x6b'));return respondWithRpcPromise(_0x5219('0x7b'),_0x5219('0x7c'),_0xc77b0);}return null;})[_0x5219('0x22')](function(_0x295ffd){var _0x2af19f=_0x5219('0x7d')+_0x295ffd[_0x5219('0x28')]['ContactId'];return db['sequelize']['query'](_0x2af19f,{'type':db['Sequelize'][_0x5219('0x7e')]['SELECT'],'raw':!![]})['then'](function(_0x17e6d3){return _0x17e6d3;});})[_0x5219('0x22')](function(_0x45b805){if(_0x45b805){_0xc77b0[_0x5219('0x28')][_0x5219('0x70')]=_0x45b805[0x0];if(!_0x3d59f6[_0x5219('0x59')][_0x5219('0x61')])return;return db['User'][_0x5219('0x58')]({'where':{'id':_0x3d59f6[_0x5219('0x59')][_0x5219('0x61')],'role':_0x5219('0x72')},'attributes':['id',_0x5219('0x3b'),'fullname',_0x5219('0x74'),'internal'],'raw':!![]});}return null;})[_0x5219('0x22')](function(_0x10b1be){if(!_0x10b1be)return null;_0xc77b0['message'][_0x5219('0x72')]=_0x10b1be;return _0xc77b0;})[_0x5219('0x22')](function(_0x162a4e){if(_0x162a4e){_0x162a4e[_0x5219('0x28')][_0x5219('0x7f')]=util[_0x5219('0x5f')]('SIP/%s',_0x3d59f6['user'][_0x5219('0x3b')]);_0x162a4e[_0x5219('0x28')][_0x5219('0x77')]=_0xc77b0['channel'];_0x162a4e[_0x5219('0x28')][_0x5219('0x78')]=_0xc77b0[_0x5219('0x77')];_0x162a4e['message']['event']=_0x5219('0x36');respondWithRpcPromise(_0x5219('0x7a'),_0x5219('0x7a'),{'event':_0x5219('0x80'),'message':_0x162a4e[_0x5219('0x28')]},client9002);return _0xc77b0;}return null;})[_0x5219('0x22')](respondWithResult(_0x4dfd30,null))[_0x5219('0x2b')](handleError(_0x4dfd30,null));};exports['create']=function(_0x211477,_0x29a58c){var _0x372d77;return db[_0x5219('0x3e')]['create'](_0x211477[_0x5219('0x59')],{})[_0x5219('0x22')](function(_0x5d0e4d){_0x372d77=_0x5d0e4d;return db['CmContact'][_0x5219('0x81')]({'where':{'id':_0x372d77[_0x5219('0x6d')]}});})[_0x5219('0x22')](function(_0x2f871d){if(_[_0x5219('0x66')](_0x2f871d)){return;}else{_0x372d77[_0x5219('0x5d')]=_0x2f871d[_0x5219('0x5d')];return db['Attachment'][_0x5219('0x81')]({'where':{'id':_0x372d77['AttachmentId']}});}})['then'](function(_0x1838bc){return respondWithRpcPromise(_0x5219('0x82'),_0x5219('0x82'),{'FaxAccountId':_[_0x5219('0x66')](_0x211477['body'])?undefined:_0x211477[_0x5219('0x59')][_0x5219('0x83')],'path':_[_0x5219('0x66')](_0x1838bc)?undefined:util[_0x5219('0x5f')](_0x5219('0x84'),_0x1838bc[_0x5219('0x85')]),'fax':_[_0x5219('0x66')](_0x372d77['fax'])?undefined:_0x372d77[_0x5219('0x5d')],'AttachmentId':_0x372d77['AttachmentId']},client9002);})[_0x5219('0x22')](respondWithResult(_0x29a58c,0xc9))[_0x5219('0x2b')](handleError(_0x29a58c,null));};exports['download']=function(_0x49caf8,_0x261761){var _0x1b9a8a=path[_0x5219('0x86')](config[_0x5219('0x87')],'server',_0x5219('0x88'),'attachments');return db[_0x5219('0x3e')]['find']({'where':{'id':_0x49caf8[_0x5219('0x55')]['id']},'include':[{'model':db[_0x5219('0x89')],'as':_0x5219('0x89')}]})[_0x5219('0x22')](handleEntityNotFound(_0x261761,null))[_0x5219('0x22')](function(_0x232e99){if(_0x232e99){return _0x261761['download'](path[_0x5219('0x86')](_0x1b9a8a,_0x232e99['Attachment'][_0x5219('0x85')]));}})[_0x5219('0x2b')](handleError(_0x261761,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index ae1087c..3f9aef9 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 _0x00cd=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','update','remove'];(function(_0x1d55fb,_0x48a73b){var _0x1a5b1a=function(_0xb1f7cd){while(--_0xb1f7cd){_0x1d55fb['push'](_0x1d55fb['shift']());}};_0x1a5b1a(++_0x48a73b);}(_0x00cd,0xee));var _0xd00c=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0x00cd[_0x11a220];return _0x20d8fe;};'use strict';var EventEmitter=require(_0xd00c('0x0'));var FaxMessage=require(_0xd00c('0x1'))['db'][_0xd00c('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd00c('0x3'),'afterDestroy':_0xd00c('0x4')};function emitEvent(_0x3057b7){return function(_0x2291b2,_0x2187fa,_0x5ab1ad){FaxMessageEvents[_0xd00c('0x5')](_0x3057b7+':'+_0x2291b2['id'],_0x2291b2);FaxMessageEvents[_0xd00c('0x5')](_0x3057b7,_0x2291b2);_0x5ab1ad(null);};}for(var e in events){if(events[_0xd00c('0x6')](e)){var event=events[e];FaxMessage[_0xd00c('0x7')](e,emitEvent(event));}}module[_0xd00c('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x644f=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0xc1217a,_0x1b280b){var _0x5192ba=function(_0x10e685){while(--_0x10e685){_0xc1217a['push'](_0xc1217a['shift']());}};_0x5192ba(++_0x1b280b);}(_0x644f,0x177));var _0xf644=function(_0x1b5aea,_0x1afe6f){_0x1b5aea=_0x1b5aea-0x0;var _0x51cae9=_0x644f[_0x1b5aea];return _0x51cae9;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xf644('0x0'))['db'][_0xf644('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xf644('0x2')](0x0);var events={'afterCreate':_0xf644('0x3'),'afterUpdate':_0xf644('0x4'),'afterDestroy':_0xf644('0x5')};function emitEvent(_0x318999){return function(_0x2885d7,_0x347827,_0x57bf32){FaxMessageEvents['emit'](_0x318999+':'+_0x2885d7['id'],_0x2885d7);FaxMessageEvents[_0xf644('0x6')](_0x318999,_0x2885d7);_0x57bf32(null);};}for(var e in events){if(events[_0xf644('0x7')](e)){var event=events[e];FaxMessage[_0xf644('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index eec2d2a..64a7efc 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 _0x98b6=['findOne','FaxInteractionId','then','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','FaxInteraction'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x98b6,0x7b));var _0x698b=function(_0xc89450,_0x2acbe6){_0xc89450=_0xc89450-0x0;var _0x5cd7f5=_0x98b6[_0xc89450];return _0x5cd7f5;};'use strict';var _=require('lodash');var util=require(_0x698b('0x0'));var logger=require(_0x698b('0x1'))(_0x698b('0x2'));var moment=require(_0x698b('0x3'));var BPromise=require(_0x698b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x698b('0x5'));var config=require(_0x698b('0x6'));var attributes=require(_0x698b('0x7'));module[_0x698b('0x8')]=function(_0xfce71a,_0x4e7792){return _0xfce71a[_0x698b('0x9')](_0x698b('0xa'),attributes,{'tableName':_0x698b('0xb'),'paranoid':![],'indexes':[{'name':_0x698b('0xc'),'fields':[_0x698b('0xd')],'type':_0x698b('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56f46c,_0x176dfc,_0x181d8c){var _0x23e5d4=_0xfce71a[_0x698b('0xf')];var _0x22f2c9=_0x56f46c['get']({'plain':!![]});if(_0x22f2c9[_0x698b('0x10')]['toLowerCase']()==='in'||_0x22f2c9[_0x698b('0x10')][_0x698b('0x11')]()===_0x698b('0x12')&&!_0x22f2c9['secret']&&!_[_0x698b('0x13')](_0x22f2c9[_0x698b('0x14')])){_0x23e5d4[_0x698b('0x15')][_0x698b('0x16')]({'where':{'id':_0x22f2c9[_0x698b('0x17')]}})[_0x698b('0x18')](function(_0x34b252){if(_0x34b252){_0x34b252['update']({'lastMsgAt':_0x22f2c9[_0x698b('0x19')],'lastMsgDirection':_0x22f2c9[_0x698b('0x10')]['toLowerCase']()});}})[_0x698b('0x1a')](function(_0x22b1a1){console['error'](_0x22b1a1);});}_0x181d8c();}},'charset':_0x698b('0x1b'),'collate':_0x698b('0x1c')});}; \ No newline at end of file +var _0x96e4=['fax_messages','fti_fax_messages','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','update','catch','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage'];(function(_0x4c92dc,_0x3ec04b){var _0x560eb0=function(_0x11e15c){while(--_0x11e15c){_0x4c92dc['push'](_0x4c92dc['shift']());}};_0x560eb0(++_0x3ec04b);}(_0x96e4,0xa1));var _0x496e=function(_0x5bd4f6,_0xf4e45c){_0x5bd4f6=_0x5bd4f6-0x0;var _0x33a165=_0x96e4[_0x5bd4f6];return _0x33a165;};'use strict';var _=require(_0x496e('0x0'));var util=require(_0x496e('0x1'));var logger=require('../../config/logger')(_0x496e('0x2'));var moment=require(_0x496e('0x3'));var BPromise=require(_0x496e('0x4'));var rp=require(_0x496e('0x5'));var fs=require('fs');var path=require(_0x496e('0x6'));var rimraf=require(_0x496e('0x7'));var config=require(_0x496e('0x8'));var attributes=require(_0x496e('0x9'));module[_0x496e('0xa')]=function(_0x4412ea,_0x19ba65){return _0x4412ea[_0x496e('0xb')](_0x496e('0xc'),attributes,{'tableName':_0x496e('0xd'),'paranoid':![],'indexes':[{'name':_0x496e('0xe'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x59dabe,_0x49826e,_0x36ba60){var _0x222543=_0x4412ea[_0x496e('0xf')];var _0x116c45=_0x59dabe[_0x496e('0x10')]({'plain':!![]});if(_0x116c45[_0x496e('0x11')][_0x496e('0x12')]()==='in'||_0x116c45['direction'][_0x496e('0x12')]()===_0x496e('0x13')&&!_0x116c45[_0x496e('0x14')]&&!_[_0x496e('0x15')](_0x116c45[_0x496e('0x16')])){_0x222543[_0x496e('0x17')]['findOne']({'where':{'id':_0x116c45[_0x496e('0x18')]}})[_0x496e('0x19')](function(_0xa4a469){if(_0xa4a469){_0xa4a469[_0x496e('0x1a')]({'lastMsgAt':_0x116c45['createdAt'],'lastMsgDirection':_0x116c45[_0x496e('0x11')][_0x496e('0x12')]()});}})[_0x496e('0x1b')](function(_0x2cb90e){console['error'](_0x2cb90e);});}_0x36ba60();}},'charset':'utf8mb4','collate':_0x496e('0x1c')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 3dab971..60a3b12 100644 --- a/server/api/faxMessage/faxMessage.rpc.js +++ b/server/api/faxMessage/faxMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c4e=['localhost','socket.io-emitter','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','then','debug','stringify','attributes','limit','UpdateFaxMessage','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults'];(function(_0x59f987,_0x3cfa35){var _0x2a9cb6=function(_0x577d56){while(--_0x577d56){_0x59f987['push'](_0x59f987['shift']());}};_0x2a9cb6(++_0x3cfa35);}(_0x4c4e,0x152));var _0xe4c4=function(_0x1160b3,_0x181e1a){_0x1160b3=_0x1160b3-0x0;var _0x249a19=_0x4c4e[_0x1160b3];return _0x249a19;};'use strict';var _=require(_0xe4c4('0x0'));var util=require('util');var moment=require(_0xe4c4('0x1'));var BPromise=require(_0xe4c4('0x2'));var rs=require(_0xe4c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4c4('0x4'))['db'];var utils=require(_0xe4c4('0x5'));var logger=require(_0xe4c4('0x6'))('rpc');var config=require(_0xe4c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe4c4('0x8')][_0xe4c4('0x9')]({'port':0x232a});config[_0xe4c4('0xa')]=_[_0xe4c4('0xb')](config[_0xe4c4('0xa')],{'host':_0xe4c4('0xc'),'port':0x18eb});var socket=require(_0xe4c4('0xd'))(new Redis(config[_0xe4c4('0xa')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x31f879,_0x6f2545,_0x27ad42){return new BPromise(function(_0x1bc786,_0x333c08){return client[_0xe4c4('0xe')](_0x31f879,_0x27ad42)['then'](function(_0x303d89){logger[_0xe4c4('0xf')](_0xe4c4('0x10'),_0x6f2545,_0xe4c4('0x11'));logger['debug'](_0xe4c4('0x12'),_0x6f2545,_0xe4c4('0x11'),JSON['stringify'](_0x303d89));if(_0x303d89[_0xe4c4('0x13')]){if(_0x303d89[_0xe4c4('0x13')]['code']===0x1f4){logger[_0xe4c4('0x13')](_0xe4c4('0x10'),_0x6f2545,_0x303d89['error'][_0xe4c4('0x14')]);return _0x333c08(_0x303d89[_0xe4c4('0x13')][_0xe4c4('0x14')]);}logger[_0xe4c4('0x13')](_0xe4c4('0x10'),_0x6f2545,_0x303d89[_0xe4c4('0x13')][_0xe4c4('0x14')]);return _0x1bc786(_0x303d89[_0xe4c4('0x13')][_0xe4c4('0x14')]);}else{logger[_0xe4c4('0xf')](_0xe4c4('0x10'),_0x6f2545,_0xe4c4('0x11'));_0x1bc786(_0x303d89[_0xe4c4('0x15')][_0xe4c4('0x14')]);}})[_0xe4c4('0x16')](function(_0x5a32b5){logger[_0xe4c4('0x13')](_0xe4c4('0x10'),_0x6f2545,_0x5a32b5);_0x333c08(_0x5a32b5);});});}exports[_0xe4c4('0x17')]=function(_0x317cc8){var _0x5da165=this;return new Promise(function(_0x3d5856,_0x1cad5d){return db[_0xe4c4('0x18')][_0xe4c4('0x19')](_0x317cc8[_0xe4c4('0x1a')],{'raw':_0x317cc8[_0xe4c4('0x1b')]?_0x317cc8[_0xe4c4('0x1b')][_0xe4c4('0x1c')]===undefined?!![]:![]:!![]})[_0xe4c4('0x1d')](function(_0x1a7690){logger[_0xe4c4('0xf')](_0xe4c4('0x17'),_0x317cc8);logger[_0xe4c4('0x1e')](_0xe4c4('0x17'),_0x317cc8,JSON[_0xe4c4('0x1f')](_0x1a7690));_0x3d5856(_0x1a7690);})['catch'](function(_0x49cadc){logger[_0xe4c4('0x13')]('CreateFaxMessage',_0x49cadc[_0xe4c4('0x14')],_0x317cc8);_0x1cad5d(_0x5da165['error'](0x1f4,_0x49cadc[_0xe4c4('0x14')]));});});};exports['UpdateFaxMessage']=function(_0x34d667){var _0x583393=this;return new Promise(function(_0xba53ef,_0x4a0199){return db['FaxMessage']['update'](_0x34d667['body'],{'raw':_0x34d667[_0xe4c4('0x1b')]?_0x34d667['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34d667[_0xe4c4('0x1b')]?_0x34d667[_0xe4c4('0x1b')]['where']||null:null,'attributes':_0x34d667['options']?_0x34d667[_0xe4c4('0x1b')][_0xe4c4('0x20')]||null:null,'limit':_0x34d667['options']?_0x34d667[_0xe4c4('0x1b')][_0xe4c4('0x21')]||null:null})[_0xe4c4('0x1d')](function(_0x48060e){logger['info'](_0xe4c4('0x22'),_0x34d667);logger[_0xe4c4('0x1e')](_0xe4c4('0x22'),_0x34d667,JSON[_0xe4c4('0x1f')](_0x48060e));_0xba53ef(_0x48060e);})['catch'](function(_0x49c913){logger[_0xe4c4('0x13')](_0xe4c4('0x22'),_0x49c913['message'],_0x34d667);_0x4a0199(_0x583393[_0xe4c4('0x13')](0x1f4,_0x49c913[_0xe4c4('0x14')]));});});}; \ No newline at end of file +var _0xbec5=['then','info','request\x20sent','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','catch','CreateFaxMessage','FaxMessage','create','body','options','UpdateFaxMessage','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket'];(function(_0x34c377,_0x56a256){var _0x534463=function(_0x14b6e4){while(--_0x14b6e4){_0x34c377['push'](_0x34c377['shift']());}};_0x534463(++_0x56a256);}(_0xbec5,0xe5));var _0x5bec=function(_0x3d00db,_0x3692b3){_0x3d00db=_0x3d00db-0x0;var _0x41f115=_0xbec5[_0x3d00db];return _0x41f115;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var moment=require('moment');var BPromise=require(_0x5bec('0x2'));var rs=require(_0x5bec('0x3'));var fs=require('fs');var Redis=require(_0x5bec('0x4'));var db=require(_0x5bec('0x5'))['db'];var utils=require(_0x5bec('0x6'));var logger=require('../../config/logger')(_0x5bec('0x7'));var config=require(_0x5bec('0x8'));var jayson=require(_0x5bec('0x9'));var client=jayson['client'][_0x5bec('0xa')]({'port':0x232a});config[_0x5bec('0xb')]=_[_0x5bec('0xc')](config[_0x5bec('0xb')],{'host':_0x5bec('0xd'),'port':0x18eb});var socket=require(_0x5bec('0xe'))(new Redis(config[_0x5bec('0xb')]));require(_0x5bec('0xf'))['register'](socket);function respondWithRpcPromise(_0x41a827,_0x5c2d67,_0x748f75){return new BPromise(function(_0x2a70a7,_0x117162){return client['request'](_0x41a827,_0x748f75)[_0x5bec('0x10')](function(_0x18fa47){logger[_0x5bec('0x11')]('FaxMessage,\x20%s,\x20%s',_0x5c2d67,_0x5bec('0x12'));logger[_0x5bec('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5c2d67,_0x5bec('0x12'),JSON[_0x5bec('0x14')](_0x18fa47));if(_0x18fa47[_0x5bec('0x15')]){if(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x16')]===0x1f4){logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);return _0x117162(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);}logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x18fa47['error']['message']);return _0x2a70a7(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);}else{logger[_0x5bec('0x11')](_0x5bec('0x17'),_0x5c2d67,'request\x20sent');_0x2a70a7(_0x18fa47['result'][_0x5bec('0x18')]);}})[_0x5bec('0x19')](function(_0x4e0191){logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x4e0191);_0x117162(_0x4e0191);});});}exports[_0x5bec('0x1a')]=function(_0x593786){var _0x554f9f=this;return new Promise(function(_0xab397b,_0x5be91c){return db[_0x5bec('0x1b')][_0x5bec('0x1c')](_0x593786[_0x5bec('0x1d')],{'raw':_0x593786[_0x5bec('0x1e')]?_0x593786[_0x5bec('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x5bec('0x10')](function(_0x4cfcb8){logger[_0x5bec('0x11')](_0x5bec('0x1a'),_0x593786);logger['debug'](_0x5bec('0x1a'),_0x593786,JSON[_0x5bec('0x14')](_0x4cfcb8));_0xab397b(_0x4cfcb8);})['catch'](function(_0x45afb7){logger[_0x5bec('0x15')](_0x5bec('0x1a'),_0x45afb7[_0x5bec('0x18')],_0x593786);_0x5be91c(_0x554f9f[_0x5bec('0x15')](0x1f4,_0x45afb7[_0x5bec('0x18')]));});});};exports[_0x5bec('0x1f')]=function(_0x4de66a){var _0x5b63ab=this;return new Promise(function(_0x5e44b3,_0x2961bd){return db[_0x5bec('0x1b')][_0x5bec('0x20')](_0x4de66a['body'],{'raw':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')]['where']||null:null,'attributes':_0x4de66a['options']?_0x4de66a[_0x5bec('0x1e')][_0x5bec('0x21')]||null:null,'limit':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')][_0x5bec('0x22')]||null:null})[_0x5bec('0x10')](function(_0x5d6621){logger[_0x5bec('0x11')]('UpdateFaxMessage',_0x4de66a);logger[_0x5bec('0x13')](_0x5bec('0x1f'),_0x4de66a,JSON[_0x5bec('0x14')](_0x5d6621));_0x5e44b3(_0x5d6621);})[_0x5bec('0x19')](function(_0x5128c0){logger[_0x5bec('0x15')](_0x5bec('0x1f'),_0x5128c0[_0x5bec('0x18')],_0x4de66a);_0x2961bd(_0x5b63ab['error'](0x1f4,_0x5128c0[_0x5bec('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 19f5073..5d497b7 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 _0x3ce9=['emit','register','faxMessage:','./faxMessage.events','save','remove'];(function(_0x55cd2c,_0x867c66){var _0x3002a4=function(_0x1c7919){while(--_0x1c7919){_0x55cd2c['push'](_0x55cd2c['shift']());}};_0x3002a4(++_0x867c66);}(_0x3ce9,0x17d));var _0x93ce=function(_0x81ba34,_0x333d88){_0x81ba34=_0x81ba34-0x0;var _0x285be1=_0x3ce9[_0x81ba34];return _0x285be1;};'use strict';var FaxMessageEvents=require(_0x93ce('0x0'));var events=[_0x93ce('0x1'),_0x93ce('0x2'),'update'];function createListener(_0x431755,_0x4e1d37){return function(_0x5c332f){_0x4e1d37[_0x93ce('0x3')](_0x431755,_0x5c332f);};}function removeListener(_0x5695de,_0x1ef9e1){return function(){FaxMessageEvents['removeListener'](_0x5695de,_0x1ef9e1);};}exports[_0x93ce('0x4')]=function(_0x20de79){for(var _0x31ab62=0x0,_0x20ec64=events['length'];_0x31ab62<_0x20ec64;_0x31ab62++){var _0x2fb492=events[_0x31ab62];var _0x4dca3b=createListener(_0x93ce('0x5')+_0x2fb492,_0x20de79);FaxMessageEvents['on'](_0x2fb492,_0x4dca3b);}}; \ No newline at end of file +var _0x2d63=['register','length','./faxMessage.events','save','remove','update','removeListener'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x2d63,0x1bb));var _0x32d6=function(_0x53fc4e,_0x5e37b6){_0x53fc4e=_0x53fc4e-0x0;var _0x5f2513=_0x2d63[_0x53fc4e];return _0x5f2513;};'use strict';var FaxMessageEvents=require(_0x32d6('0x0'));var events=[_0x32d6('0x1'),_0x32d6('0x2'),_0x32d6('0x3')];function createListener(_0x4d5687,_0x636e4a){return function(_0x4394b8){_0x636e4a['emit'](_0x4d5687,_0x4394b8);};}function removeListener(_0x59325a,_0x710f15){return function(){FaxMessageEvents[_0x32d6('0x4')](_0x59325a,_0x710f15);};}exports[_0x32d6('0x5')]=function(_0x118338){for(var _0x153864=0x0,_0x500136=events[_0x32d6('0x6')];_0x153864<_0x500136;_0x153864++){var _0x4d75d5=events[_0x153864];var _0x3a219f=createListener('faxMessage:'+_0x4d75d5,_0x118338);FaxMessageEvents['on'](_0x4d75d5,_0x3a219f);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index d4375f6..2d75e13 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 _0x91a7=['isAuthenticated','/:id','show','download','tracked','fax','faxmessage:create','create','put','update','accept','/:id/reject','reject','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','./faxMessage.controller','get','index','/describe'];(function(_0x1655bb,_0x5a82ae){var _0x5e2020=function(_0x1ccfb4){while(--_0x1ccfb4){_0x1655bb['push'](_0x1655bb['shift']());}};_0x5e2020(++_0x5a82ae);}(_0x91a7,0xe7));var _0x791a=function(_0x23c50c,_0x5cb405){_0x23c50c=_0x23c50c-0x0;var _0x52bc34=_0x91a7[_0x23c50c];return _0x52bc34;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/',auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['describe']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0x6')]('/:id/download',auth[_0x791a('0x9')](),controller[_0x791a('0xc')]);router['post']('/',auth[_0x791a('0x9')](),interaction[_0x791a('0xd')](_0x791a('0xe'),_0x791a('0xf')),controller[_0x791a('0x10')]);router[_0x791a('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x791a('0x12')]);router[_0x791a('0x11')]('/:id/accept',auth[_0x791a('0x9')](),controller[_0x791a('0x13')]);router['put'](_0x791a('0x14'),auth[_0x791a('0x9')](),controller[_0x791a('0x15')]);router[_0x791a('0x16')]('/:id',auth[_0x791a('0x9')](),controller['destroy']);module[_0x791a('0x17')]=router; \ No newline at end of file +var _0xdb94=['express','fs-extra','../../components/auth/service','./faxMessage.controller','index','/describe','describe','get','/:id','isAuthenticated','show','/:id/download','download','post','fax','faxmessage:create','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','connect-timeout'];(function(_0x4701c4,_0x7a8f61){var _0x3bec9e=function(_0x483e8e){while(--_0x483e8e){_0x4701c4['push'](_0x4701c4['shift']());}};_0x3bec9e(++_0x7a8f61);}(_0xdb94,0xab));var _0x4db9=function(_0x315e79,_0x2cf4a5){_0x315e79=_0x315e79-0x0;var _0x2eba39=_0xdb94[_0x315e79];return _0x2eba39;};'use strict';var multer=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var path=require(_0x4db9('0x2'));var timeout=require(_0x4db9('0x3'));var express=require(_0x4db9('0x4'));var router=express['Router']();var fs_extra=require(_0x4db9('0x5'));var auth=require(_0x4db9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4db9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4db9('0x8')]);router['get'](_0x4db9('0x9'),auth['isAuthenticated'](),controller[_0x4db9('0xa')]);router[_0x4db9('0xb')](_0x4db9('0xc'),auth[_0x4db9('0xd')](),controller[_0x4db9('0xe')]);router[_0x4db9('0xb')](_0x4db9('0xf'),auth[_0x4db9('0xd')](),controller[_0x4db9('0x10')]);router[_0x4db9('0x11')]('/',auth[_0x4db9('0xd')](),interaction['tracked'](_0x4db9('0x12'),_0x4db9('0x13')),controller['create']);router['put'](_0x4db9('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x4db9('0x14')](_0x4db9('0x15'),auth['isAuthenticated'](),controller[_0x4db9('0x16')]);router[_0x4db9('0x14')](_0x4db9('0x17'),auth[_0x4db9('0xd')](),controller['reject']);router['delete'](_0x4db9('0xc'),auth[_0x4db9('0xd')](),controller['destroy']);module[_0x4db9('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 9deee25..a0252ed 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 _0x3124=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x2b1bc8,_0x54dba5){var _0x56733b=function(_0x4a38c9){while(--_0x4a38c9){_0x2b1bc8['push'](_0x2b1bc8['shift']());}};_0x56733b(++_0x54dba5);}(_0x3124,0x6e));var _0x4312=function(_0x35abda,_0x5c2a8a){_0x35abda=_0x35abda-0x0;var _0x4a6e8b=_0x3124[_0x35abda];return _0x4a6e8b;};'use strict';var Sequelize=require(_0x4312('0x0'));module[_0x4312('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4312('0x2')]},'timeout':{'type':Sequelize[_0x4312('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4312('0x4')](_0x4312('0x5'),_0x4312('0x6'),_0x4312('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x4312('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd7ec=['rrmemory','roundrobin','sequelize','exports','name','INTEGER'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0xd7ec,0x6e));var _0xcd7e=function(_0x26b308,_0x39df7d){_0x26b308=_0x26b308-0x0;var _0x23d531=_0xd7ec[_0x26b308];return _0x23d531;};'use strict';var Sequelize=require(_0xcd7e('0x0'));module[_0xcd7e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xcd7e('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xcd7e('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xcd7e('0x4'),'beepall',_0xcd7e('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xcd7e('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 14f1a3e..9409b3f 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 _0x6d71=['include','rows','show','catch','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','findOne','FaxQueueId','UserFaxQueue','findAll','User','UserId','agent','updatedAt','createdAt','format','%s/%s','faxPause','getTeams','addTeams','ids','Agents','online','voicePause','interface','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','Team','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','sequelize','QueryTypes','SELECT','every','includes','all','compact','value','isEmpty','userFaxQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','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','./faxQueue.socket','register','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','name','send','index','FaxQueue','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','map','type','VIRTUAL','options','includeAll'];(function(_0x51b60e,_0x8ad329){var _0x39d1af=function(_0x36f6a2){while(--_0x36f6a2){_0x51b60e['push'](_0x51b60e['shift']());}};_0x39d1af(++_0x8ad329);}(_0x6d71,0x160));var _0x16d7=function(_0x3cdc8f,_0x302f64){_0x3cdc8f=_0x3cdc8f-0x0;var _0xcf315d=_0x6d71[_0x3cdc8f];return _0xcf315d;};'use strict';var emlformat=require(_0x16d7('0x0'));var rimraf=require(_0x16d7('0x1'));var zipdir=require(_0x16d7('0x2'));var jsonpatch=require(_0x16d7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x16d7('0x4'));var Mustache=require(_0x16d7('0x5'));var util=require(_0x16d7('0x6'));var path=require(_0x16d7('0x7'));var sox=require(_0x16d7('0x8'));var csv=require(_0x16d7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x16d7('0xa'));var squel=require(_0x16d7('0xb'));var crypto=require('crypto');var jsforce=require(_0x16d7('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x16d7('0xd'));var Papa=require('papaparse');var Redis=require(_0x16d7('0xe'));var authService=require(_0x16d7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x16d7('0x10'));var hardwareService=require(_0x16d7('0x11'));var logger=require(_0x16d7('0x12'))(_0x16d7('0x13'));var utils=require(_0x16d7('0x14'));var config=require(_0x16d7('0x15'));var licenseUtil=require(_0x16d7('0x16'));var db=require(_0x16d7('0x17'))['db'];config[_0x16d7('0x18')]=_[_0x16d7('0x19')](config[_0x16d7('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x16d7('0x1a'))(new Redis(config[_0x16d7('0x18')]));require(_0x16d7('0x1b'))[_0x16d7('0x1c')](socket);function respondWithStatusCode(_0xca440c,_0x77cbd){_0x77cbd=_0x77cbd||0xcc;return function(_0x848472){if(_0x848472){return _0xca440c[_0x16d7('0x1d')](_0x77cbd);}return _0xca440c[_0x16d7('0x1e')](_0x77cbd)[_0x16d7('0x1f')]();};}function respondWithResult(_0x374211,_0x1c5e3f){_0x1c5e3f=_0x1c5e3f||0xc8;return function(_0xbe39f8){if(_0xbe39f8){return _0x374211[_0x16d7('0x1e')](_0x1c5e3f)['json'](_0xbe39f8);}};}function respondWithFilteredResult(_0x5ce94d,_0x4ad44a){return function(_0x2f58e0){if(_0x2f58e0){var _0x3c4d9c=typeof _0x4ad44a['offset']===_0x16d7('0x20')&&typeof _0x4ad44a[_0x16d7('0x21')]===_0x16d7('0x20');var _0x4c934=_0x2f58e0['count'];var _0x1f4bdd=_0x3c4d9c?0x0:_0x4ad44a[_0x16d7('0x22')];var _0xf859f5=_0x3c4d9c?_0x2f58e0[_0x16d7('0x23')]:_0x4ad44a[_0x16d7('0x22')]+_0x4ad44a['limit'];var _0x43b555;if(_0xf859f5>=_0x4c934){_0xf859f5=_0x4c934;_0x43b555=0xc8;}else{_0x43b555=0xce;}_0x5ce94d[_0x16d7('0x1e')](_0x43b555);return _0x5ce94d[_0x16d7('0x24')](_0x16d7('0x25'),_0x1f4bdd+'-'+_0xf859f5+'/'+_0x4c934)['json'](_0x2f58e0);}return null;};}function patchUpdates(_0x3e802c){return function(_0x41312c){try{jsonpatch['apply'](_0x41312c,_0x3e802c,!![]);}catch(_0x119ab5){return BPromise[_0x16d7('0x26')](_0x119ab5);}return _0x41312c[_0x16d7('0x27')]();};}function saveUpdates(_0x5222cc,_0x16b47b){return function(_0x4e2dc8){if(_0x4e2dc8){return _0x4e2dc8[_0x16d7('0x28')](_0x5222cc)[_0x16d7('0x29')](function(_0x46d6de){return _0x46d6de;});}return null;};}function removeEntity(_0x4bd976,_0x43b0a0){return function(_0x476c1e){if(_0x476c1e){return _0x476c1e[_0x16d7('0x2a')]()[_0x16d7('0x29')](function(){var _0x5cb156=_0x476c1e[_0x16d7('0x2b')]({'plain':!![]});var _0x55abcf=_0x16d7('0x2c');return db[_0x16d7('0x2d')][_0x16d7('0x2a')]({'where':{'type':_0x55abcf,'resourceId':_0x5cb156['id']}})[_0x16d7('0x29')](function(){return _0x476c1e;});})[_0x16d7('0x29')](function(){_0x4bd976['status'](0xcc)[_0x16d7('0x1f')]();});}};}function handleEntityNotFound(_0x418247,_0x2c2f71){return function(_0x1cfb5a){if(!_0x1cfb5a){_0x418247['sendStatus'](0x194);}return _0x1cfb5a;};}function handleError(_0x368131,_0x4ece7d){_0x4ece7d=_0x4ece7d||0x1f4;return function(_0x5ef3aa){logger[_0x16d7('0x2e')](_0x5ef3aa['stack']);if(_0x5ef3aa[_0x16d7('0x2f')]){delete _0x5ef3aa[_0x16d7('0x2f')];}_0x368131[_0x16d7('0x1e')](_0x4ece7d)[_0x16d7('0x30')](_0x5ef3aa);};}exports[_0x16d7('0x31')]=function(_0x3a3924,_0x5afeae){var _0x2e29f5={},_0xe51345={},_0x5cc197={'count':0x0,'rows':[]};var _0x425f2b=_['map'](db[_0x16d7('0x32')][_0x16d7('0x33')],function(_0x5dcbd7){return{'name':_0x5dcbd7['fieldName'],'type':_0x5dcbd7['type'][_0x16d7('0x34')]};});_0xe51345[_0x16d7('0x35')]=_['map'](_0x425f2b,'name');_0xe51345[_0x16d7('0x36')]=_[_0x16d7('0x37')](_0x3a3924[_0x16d7('0x36')]);_0xe51345['filters']=_[_0x16d7('0x38')](_0xe51345[_0x16d7('0x35')],_0xe51345[_0x16d7('0x36')]);_0x2e29f5[_0x16d7('0x39')]=_[_0x16d7('0x38')](_0xe51345[_0x16d7('0x35')],qs[_0x16d7('0x3a')](_0x3a3924['query']['fields']));_0x2e29f5[_0x16d7('0x39')]=_0x2e29f5[_0x16d7('0x39')][_0x16d7('0x3b')]?_0x2e29f5[_0x16d7('0x39')]:_0xe51345[_0x16d7('0x35')];if(!_0x3a3924['query'][_0x16d7('0x3c')](_0x16d7('0x3d'))){_0x2e29f5[_0x16d7('0x21')]=qs[_0x16d7('0x21')](_0x3a3924['query']['limit']);_0x2e29f5[_0x16d7('0x22')]=qs[_0x16d7('0x22')](_0x3a3924[_0x16d7('0x36')][_0x16d7('0x22')]);}_0x2e29f5[_0x16d7('0x3e')]=qs[_0x16d7('0x3f')](_0x3a3924[_0x16d7('0x36')][_0x16d7('0x3f')]);_0x2e29f5['where']=qs[_0x16d7('0x40')](_[_0x16d7('0x41')](_0x3a3924[_0x16d7('0x36')],_0xe51345[_0x16d7('0x40')]),_0x425f2b);if(_0x3a3924['query'][_0x16d7('0x42')]){_0x2e29f5[_0x16d7('0x43')]=_[_0x16d7('0x44')](_0x2e29f5[_0x16d7('0x43')],{'$or':_[_0x16d7('0x45')](_0x425f2b,function(_0x3b2a3b){if(_0x3b2a3b[_0x16d7('0x46')]!==_0x16d7('0x47')){var _0x26c294={};_0x26c294[_0x3b2a3b[_0x16d7('0x2f')]]={'$like':'%'+_0x3a3924[_0x16d7('0x36')][_0x16d7('0x42')]+'%'};return _0x26c294;}})});}_0x2e29f5=_['merge']({},_0x2e29f5,_0x3a3924[_0x16d7('0x48')]);var _0x2c876f={'where':_0x2e29f5[_0x16d7('0x43')]};return db[_0x16d7('0x32')][_0x16d7('0x23')](_0x2c876f)[_0x16d7('0x29')](function(_0x392751){_0x5cc197[_0x16d7('0x23')]=_0x392751;if(_0x3a3924[_0x16d7('0x36')][_0x16d7('0x49')]){_0x2e29f5[_0x16d7('0x4a')]=[{'all':!![]}];}return db[_0x16d7('0x32')]['findAll'](_0x2e29f5);})[_0x16d7('0x29')](function(_0x679d8c){_0x5cc197[_0x16d7('0x4b')]=_0x679d8c;return _0x5cc197;})[_0x16d7('0x29')](respondWithFilteredResult(_0x5afeae,_0x2e29f5))['catch'](handleError(_0x5afeae,null));};exports[_0x16d7('0x4c')]=function(_0x5be0f7,_0x43e10b){var _0x1ff827={'raw':!![],'where':{'id':_0x5be0f7['params']['id']}},_0x288a92={};_0x288a92[_0x16d7('0x35')]=_['keys'](db['FaxQueue']['rawAttributes']);_0x288a92[_0x16d7('0x36')]=_[_0x16d7('0x37')](_0x5be0f7['query']);_0x288a92[_0x16d7('0x40')]=_[_0x16d7('0x38')](_0x288a92[_0x16d7('0x35')],_0x288a92[_0x16d7('0x36')]);_0x1ff827[_0x16d7('0x39')]=_['intersection'](_0x288a92['model'],qs['fields'](_0x5be0f7['query'][_0x16d7('0x3a')]));_0x1ff827[_0x16d7('0x39')]=_0x1ff827[_0x16d7('0x39')][_0x16d7('0x3b')]?_0x1ff827['attributes']:_0x288a92[_0x16d7('0x35')];if(_0x5be0f7[_0x16d7('0x36')][_0x16d7('0x49')]){_0x1ff827['include']=[{'all':!![]}];}_0x1ff827=_[_0x16d7('0x44')]({},_0x1ff827,_0x5be0f7['options']);return db['FaxQueue']['find'](_0x1ff827)[_0x16d7('0x29')](handleEntityNotFound(_0x43e10b,null))[_0x16d7('0x29')](respondWithResult(_0x43e10b,null))[_0x16d7('0x4d')](handleError(_0x43e10b,null));};exports['create']=function(_0x46974d,_0xa58b9d){return db[_0x16d7('0x32')]['create'](_0x46974d[_0x16d7('0x4e')],{})[_0x16d7('0x29')](function(_0x38c326){var _0x6a8486=_0x46974d[_0x16d7('0x4f')]['get']({'plain':!![]});if(!_0x6a8486)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6a8486[_0x16d7('0x50')]==='user'){var _0x33f44d=_0x38c326[_0x16d7('0x2b')]({'plain':!![]});var _0x17a5be=_0x16d7('0x2c');return db[_0x16d7('0x51')][_0x16d7('0x52')]({'where':{'name':_0x17a5be,'userProfileId':_0x6a8486[_0x16d7('0x53')]},'raw':!![]})[_0x16d7('0x29')](function(_0x510644){if(_0x510644&&_0x510644[_0x16d7('0x54')]===0x0){return db[_0x16d7('0x2d')][_0x16d7('0x55')]({'name':_0x33f44d[_0x16d7('0x2f')],'resourceId':_0x33f44d['id'],'type':_0x510644[_0x16d7('0x2f')],'sectionId':_0x510644['id']},{})[_0x16d7('0x29')](function(){return _0x38c326;});}else{return _0x38c326;}})[_0x16d7('0x4d')](function(_0x594afa){logger[_0x16d7('0x2e')](_0x16d7('0x56'),_0x594afa);throw _0x594afa;});}return _0x38c326;})[_0x16d7('0x29')](respondWithResult(_0xa58b9d,0xc9))['catch'](handleError(_0xa58b9d,null));};exports[_0x16d7('0x28')]=function(_0x1beaf9,_0x32abdc){if(_0x1beaf9[_0x16d7('0x4e')]['id']){delete _0x1beaf9['body']['id'];}return db[_0x16d7('0x32')]['find']({'where':{'id':_0x1beaf9[_0x16d7('0x57')]['id']}})[_0x16d7('0x29')](handleEntityNotFound(_0x32abdc,null))['then'](saveUpdates(_0x1beaf9['body'],null))[_0x16d7('0x29')](respondWithResult(_0x32abdc,null))['catch'](handleError(_0x32abdc,null));};exports['destroy']=function(_0xd3e87d,_0x3b76e7){return db[_0x16d7('0x32')][_0x16d7('0x52')]({'where':{'id':_0xd3e87d[_0x16d7('0x57')]['id']}})[_0x16d7('0x29')](handleEntityNotFound(_0x3b76e7,null))[_0x16d7('0x29')](removeEntity(_0x3b76e7,null))[_0x16d7('0x4d')](handleError(_0x3b76e7,null));};exports['describe']=function(_0x4217e9,_0x30bad4){return db[_0x16d7('0x32')]['describe']()[_0x16d7('0x29')](respondWithResult(_0x30bad4,null))['catch'](handleError(_0x30bad4,null));};exports['getMembers']=function(_0x34e31a,_0x1bfcdf,_0x1a12ea){var _0x27def9={'raw':!![],'where':{}},_0x4b42bf={},_0x2316b1;return db[_0x16d7('0x32')][_0x16d7('0x58')]({'where':{'id':_0x34e31a['params']['id']}})[_0x16d7('0x29')](handleEntityNotFound(_0x1bfcdf,null))[_0x16d7('0x29')](function(_0x5525aa){if(_0x5525aa){_0x2316b1=_0x5525aa[_0x16d7('0x2b')]({'plain':!![]});_0x4b42bf[_0x16d7('0x35')]=_['keys'](db['UserFaxQueue']['rawAttributes']);_0x4b42bf[_0x16d7('0x36')]=_['keys'](_0x34e31a[_0x16d7('0x36')]);_0x4b42bf['filters']=_[_0x16d7('0x38')](_0x4b42bf[_0x16d7('0x35')],_0x4b42bf[_0x16d7('0x36')]);_0x27def9[_0x16d7('0x39')]=_[_0x16d7('0x38')](_0x4b42bf[_0x16d7('0x35')],qs[_0x16d7('0x3a')](_0x34e31a[_0x16d7('0x36')][_0x16d7('0x3a')]));_0x27def9[_0x16d7('0x39')]=_0x27def9[_0x16d7('0x39')]['length']?_0x27def9[_0x16d7('0x39')]:_0x4b42bf['model'];if(!_0x34e31a[_0x16d7('0x36')]['hasOwnProperty'](_0x16d7('0x3d'))){_0x27def9['limit']=qs[_0x16d7('0x21')](_0x34e31a[_0x16d7('0x36')][_0x16d7('0x21')]);_0x27def9[_0x16d7('0x22')]=qs[_0x16d7('0x22')](_0x34e31a['query'][_0x16d7('0x22')]);}_0x27def9['order']=qs[_0x16d7('0x3f')](_0x34e31a[_0x16d7('0x36')]['sort']);_0x27def9[_0x16d7('0x43')]=qs['filters'](_[_0x16d7('0x41')](_0x34e31a[_0x16d7('0x36')],_0x4b42bf[_0x16d7('0x40')]));_0x27def9[_0x16d7('0x43')][_0x16d7('0x59')]=_0x5525aa['id'];if(_0x34e31a[_0x16d7('0x36')][_0x16d7('0x42')]){_0x27def9[_0x16d7('0x43')]=_[_0x16d7('0x44')](_0x27def9[_0x16d7('0x43')],{'$or':_[_0x16d7('0x45')](_0x27def9[_0x16d7('0x39')],function(_0x827d68){var _0x53fda2={};_0x53fda2[_0x827d68]={'$like':'%'+_0x34e31a['query'][_0x16d7('0x42')]+'%'};return _0x53fda2;})});}_0x27def9=_[_0x16d7('0x44')]({},_0x27def9,_0x34e31a[_0x16d7('0x48')]);return db[_0x16d7('0x5a')][_0x16d7('0x5b')](_0x27def9);}})[_0x16d7('0x29')](function(_0x1d84a7){if(_0x1d84a7){return db[_0x16d7('0x5c')]['findAndCountAll']({'where':{'id':_[_0x16d7('0x45')](_0x1d84a7,_0x16d7('0x5d')),'role':_0x16d7('0x5e')},'attributes':['id','name','faxPause',_0x16d7('0x5f'),_0x16d7('0x60')]});}})['then'](function(_0x3c2290){if(_0x3c2290){return{'count':_0x3c2290['count'],'rows':_['map'](_0x3c2290[_0x16d7('0x4b')],function(_0x3532e1){return{'membername':_0x3532e1[_0x16d7('0x2f')],'UserId':_0x3532e1['id'],'queue_name':_0x2316b1[_0x16d7('0x2f')],'FaxQueueId':_0x2316b1['id'],'interface':util[_0x16d7('0x61')](_0x16d7('0x62'),'SIP',_0x3532e1[_0x16d7('0x2f')]),'penalty':0x0,'paused':_0x3532e1[_0x16d7('0x63')],'createdAt':_0x3532e1['createdAt'],'updatedAt':_0x3532e1[_0x16d7('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x16d7('0x29')](respondWithFilteredResult(_0x1bfcdf,_0x27def9))[_0x16d7('0x4d')](handleError(_0x1bfcdf,null));};exports[_0x16d7('0x64')]=function(_0x4a7698,_0x45358e,_0x3e7bea){var _0x177554={};var _0x4a5489={};var _0x4f8d56;var _0x5c6950;return db[_0x16d7('0x32')]['findOne']({'where':{'id':_0x4a7698[_0x16d7('0x57')]['id']}})[_0x16d7('0x29')](handleEntityNotFound(_0x45358e,null))['then'](function(_0x14dd57){if(_0x14dd57){_0x4f8d56=_0x14dd57;_0x4a5489[_0x16d7('0x35')]=_[_0x16d7('0x37')](db['Team'][_0x16d7('0x33')]);_0x4a5489[_0x16d7('0x36')]=_[_0x16d7('0x37')](_0x4a7698[_0x16d7('0x36')]);_0x4a5489[_0x16d7('0x40')]=_[_0x16d7('0x38')](_0x4a5489[_0x16d7('0x35')],_0x4a5489[_0x16d7('0x36')]);_0x177554[_0x16d7('0x39')]=_['intersection'](_0x4a5489[_0x16d7('0x35')],qs[_0x16d7('0x3a')](_0x4a7698[_0x16d7('0x36')][_0x16d7('0x3a')]));_0x177554['attributes']=_0x177554[_0x16d7('0x39')][_0x16d7('0x3b')]?_0x177554[_0x16d7('0x39')]:_0x4a5489[_0x16d7('0x35')];_0x177554[_0x16d7('0x3e')]=qs[_0x16d7('0x3f')](_0x4a7698['query'][_0x16d7('0x3f')]);_0x177554[_0x16d7('0x43')]=qs[_0x16d7('0x40')](_[_0x16d7('0x41')](_0x4a7698[_0x16d7('0x36')],_0x4a5489['filters']));if(_0x4a7698['query'][_0x16d7('0x42')]){_0x177554[_0x16d7('0x43')]=_[_0x16d7('0x44')](_0x177554['where'],{'$or':_[_0x16d7('0x45')](_0x177554[_0x16d7('0x39')],function(_0x11738e){var _0x237e12={};_0x237e12[_0x11738e]={'$like':'%'+_0x4a7698[_0x16d7('0x36')][_0x16d7('0x42')]+'%'};return _0x237e12;})});}_0x177554=_[_0x16d7('0x44')]({},_0x177554,_0x4a7698[_0x16d7('0x48')]);return _0x4f8d56['getTeams'](_0x177554);}})[_0x16d7('0x29')](function(_0x419749){if(_0x419749){_0x5c6950=_0x419749[_0x16d7('0x3b')];if(!_0x4a7698[_0x16d7('0x36')]['hasOwnProperty'](_0x16d7('0x3d'))){_0x177554[_0x16d7('0x21')]=qs[_0x16d7('0x21')](_0x4a7698[_0x16d7('0x36')][_0x16d7('0x21')]);_0x177554[_0x16d7('0x22')]=qs[_0x16d7('0x22')](_0x4a7698[_0x16d7('0x36')][_0x16d7('0x22')]);}return _0x4f8d56[_0x16d7('0x64')](_0x177554);}})['then'](function(_0x348b41){if(_0x348b41){return _0x348b41?{'count':_0x5c6950,'rows':_0x348b41}:null;}})['then'](respondWithResult(_0x45358e,null))[_0x16d7('0x4d')](handleError(_0x45358e,null));};exports[_0x16d7('0x65')]=function(_0x255864,_0x54937d,_0x40c05e){var _0x1212a6=_0x255864[_0x16d7('0x4e')][_0x16d7('0x66')];return db['Team'][_0x16d7('0x5b')]({'where':{'id':_0x1212a6},'attributes':['id'],'include':[{'model':db[_0x16d7('0x5c')],'as':_0x16d7('0x67'),'attributes':['id',_0x16d7('0x2f'),_0x16d7('0x68'),_0x16d7('0x69'),_0x16d7('0x6a')],'raw':!![]}]})[_0x16d7('0x29')](function(_0xf8d980){if(_0xf8d980){var _0x56aae0=_['flatMap'](_0xf8d980,function(_0x538662){var _0x4e9903=_0x538662[_0x16d7('0x2b')]({'plain':!![]});return _0x4e9903[_0x16d7('0x67')];});return db[_0x16d7('0x32')][_0x16d7('0x52')]({'where':{'id':_0x255864[_0x16d7('0x57')]['id']}})[_0x16d7('0x29')](function(_0x71f547){return db['sequelize'][_0x16d7('0x6b')](function(_0x35e3b3){return _0x71f547[_0x16d7('0x65')](_0x1212a6,{'transaction':_0x35e3b3})[_0x16d7('0x29')](function(){return BPromise[_0x16d7('0x6c')](_0x56aae0,function(_0x5e7b8b){return db[_0x16d7('0x5a')][_0x16d7('0x6d')]({'where':{'UserId':_0x5e7b8b['id'],'FaxQueueId':_0x255864[_0x16d7('0x57')]['id']},'transaction':_0x35e3b3});});})['then'](function(){_0x56aae0[_0x16d7('0x6e')](function(_0x3c5609){socket[_0x16d7('0x6f')](_0x16d7('0x70'),{'UserId':_0x3c5609['id'],'FaxQueueId':_0x71f547['id']});});});});});}})['then'](respondWithStatusCode(_0x54937d,null))[_0x16d7('0x4d')](handleError(_0x54937d,null));};exports[_0x16d7('0x71')]=function(_0x17750c,_0x2f5694,_0x1a07aa){return db[_0x16d7('0x72')]['findAll']({'where':{'id':_0x17750c[_0x16d7('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x16d7('0x5c')],'as':_0x16d7('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2f5694,null))[_0x16d7('0x29')](function(_0x2a704d){var _0x2255f5=_[_0x16d7('0x45')](_0x2a704d,'id');var _0x3400ea=[];var _0x31b19f=[];var _0x4eea55=squel[_0x16d7('0x73')]();_0x4eea55[_0x16d7('0x74')](_0x16d7('0x75'))[_0x16d7('0x76')](_0x16d7('0x77'),'tq')[_0x16d7('0x78')](_0x16d7('0x79'),'ut',_0x16d7('0x7a'))[_0x16d7('0x43')](_0x16d7('0x7b'),_0x17750c[_0x16d7('0x57')]['id']);for(var _0x6f1178=0x0;_0x6f1178<_0x2a704d['length'];_0x6f1178+=0x1){let _0x29a047=_0x2a704d[_0x6f1178];for(var _0x4f0255=0x0;_0x4f0255<_0x29a047[_0x16d7('0x67')]['length'];_0x4f0255+=0x1){let _0x341308=_0x29a047['Agents'][_0x4f0255];var _0x69dbe=_0x4eea55[_0x16d7('0x7c')]();_0x69dbe[_0x16d7('0x43')](_0x16d7('0x7d'),_0x341308['id']);_0x31b19f['push'](db['sequelize']['query'](_0x69dbe[_0x16d7('0x7e')](),{'type':db[_0x16d7('0x7f')][_0x16d7('0x80')][_0x16d7('0x81')]})['then'](function(_0x1a8042){if(_0x1a8042[_0x16d7('0x3b')]===0x1){return _0x341308['id'];}else{var _0x1bd0fd=_[_0x16d7('0x82')](_['map'](_0x1a8042,'TeamId'),function(_0x4bc379){return _[_0x16d7('0x83')](_0x2255f5,_0x4bc379);});if(_0x1bd0fd){return _0x341308['id'];}}}));}}return BPromise[_0x16d7('0x84')](_0x31b19f)['then'](function(_0x2f73a0){_0x3400ea=_(_0x3400ea)['union'](_0x2f73a0)[_0x16d7('0x85')]()[_0x16d7('0x86')]();return db['FaxQueue'][_0x16d7('0x52')]({'where':{'id':_0x17750c['params']['id']}})['then'](function(_0xf82b29){return db[_0x16d7('0x7f')][_0x16d7('0x6b')](function(_0x4af12d){return _0xf82b29['removeTeams'](_0x17750c[_0x16d7('0x36')][_0x16d7('0x66')],{'transaction':_0x4af12d})[_0x16d7('0x29')](function(){if(!_[_0x16d7('0x87')](_0x3400ea)){return _0xf82b29['removeAgents'](_0x3400ea,{'transaction':_0x4af12d});}})[_0x16d7('0x29')](function(){_0x3400ea[_0x16d7('0x6e')](function(_0xe27d4c){socket[_0x16d7('0x6f')](_0x16d7('0x88'),{'UserId':_0xe27d4c,'FaxQueueId':_0xf82b29['id']});});});});});});})[_0x16d7('0x29')](respondWithStatusCode(_0x2f5694,null))[_0x16d7('0x4d')](handleError(_0x2f5694,null));};exports[_0x16d7('0x89')]=function(_0x69f2ac,_0x46ad1b,_0x45c52c){return db[_0x16d7('0x32')][_0x16d7('0x52')]({'where':{'id':_0x69f2ac[_0x16d7('0x57')]['id']}})[_0x16d7('0x29')](handleEntityNotFound(_0x46ad1b,null))[_0x16d7('0x29')](function(_0x4b4466){if(_0x4b4466){return _0x4b4466['addAgents'](_0x69f2ac[_0x16d7('0x4e')][_0x16d7('0x66')],_[_0x16d7('0x8a')](_0x69f2ac['body'],[_0x16d7('0x66'),'id'])||{})['spread'](function(_0xa1abe0){for(var _0x23f847=0x0;_0x23f847<_0x69f2ac[_0x16d7('0x4e')][_0x16d7('0x66')][_0x16d7('0x3b')];_0x23f847+=0x1){socket[_0x16d7('0x6f')]('userFaxQueue:save',{'UserId':Number(_0x69f2ac[_0x16d7('0x4e')][_0x16d7('0x66')][_0x23f847]),'FaxQueueId':Number(_0x69f2ac[_0x16d7('0x57')]['id'])});}return _0xa1abe0;});}})[_0x16d7('0x29')](respondWithResult(_0x46ad1b,null))[_0x16d7('0x4d')](handleError(_0x46ad1b,null));};exports['removeAgents']=function(_0x125678,_0x42c17c,_0x3e3205){return db[_0x16d7('0x32')][_0x16d7('0x52')]({'where':{'id':_0x125678[_0x16d7('0x57')]['id']}})['then'](handleEntityNotFound(_0x42c17c,null))['then'](function(_0x57780a){if(_0x57780a){return _0x57780a[_0x16d7('0x8b')](_0x125678['query'][_0x16d7('0x66')])['then'](function(){if(_[_0x16d7('0x8c')](_0x125678[_0x16d7('0x36')][_0x16d7('0x66')])){for(var _0x2c43af=0x0;_0x2c43af<_0x125678[_0x16d7('0x36')][_0x16d7('0x66')]['length'];_0x2c43af+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x125678[_0x16d7('0x36')][_0x16d7('0x66')][_0x2c43af]),'FaxQueueId':Number(_0x125678[_0x16d7('0x57')]['id'])});}}else{socket[_0x16d7('0x6f')](_0x16d7('0x88'),{'UserId':Number(_0x125678[_0x16d7('0x36')][_0x16d7('0x66')]),'FaxQueueId':Number(_0x125678[_0x16d7('0x57')]['id'])});}});}})[_0x16d7('0x29')](respondWithStatusCode(_0x42c17c,null))['catch'](handleError(_0x42c17c,null));};exports[_0x16d7('0x8d')]=function(_0x1f8f18,_0x5a50a7,_0x4ed9e6){var _0x551220={};var _0x3eb6e5={};var _0x4436ab;var _0x297b1c;return db[_0x16d7('0x32')][_0x16d7('0x58')]({'where':{'id':_0x1f8f18[_0x16d7('0x57')]['id']}})[_0x16d7('0x29')](handleEntityNotFound(_0x5a50a7,null))[_0x16d7('0x29')](function(_0x557ea5){if(_0x557ea5){_0x4436ab=_0x557ea5;_0x3eb6e5[_0x16d7('0x35')]=_[_0x16d7('0x37')](db[_0x16d7('0x5c')][_0x16d7('0x33')]);_0x3eb6e5['query']=_[_0x16d7('0x37')](_0x1f8f18[_0x16d7('0x36')]);_0x3eb6e5[_0x16d7('0x40')]=_[_0x16d7('0x38')](_0x3eb6e5[_0x16d7('0x35')],_0x3eb6e5[_0x16d7('0x36')]);_0x551220[_0x16d7('0x39')]=_[_0x16d7('0x38')](_0x3eb6e5['model'],qs[_0x16d7('0x3a')](_0x1f8f18[_0x16d7('0x36')]['fields']));_0x551220[_0x16d7('0x39')]=_0x551220[_0x16d7('0x39')]['length']?_0x551220[_0x16d7('0x39')]:_0x3eb6e5[_0x16d7('0x35')];_0x551220[_0x16d7('0x3e')]=qs[_0x16d7('0x3f')](_0x1f8f18[_0x16d7('0x36')][_0x16d7('0x3f')]);_0x551220[_0x16d7('0x43')]=qs[_0x16d7('0x40')](_['pick'](_0x1f8f18['query'],_0x3eb6e5[_0x16d7('0x40')]));if(_0x1f8f18[_0x16d7('0x36')][_0x16d7('0x42')]){_0x551220['where']=_['merge'](_0x551220[_0x16d7('0x43')],{'$or':_[_0x16d7('0x45')](_0x551220[_0x16d7('0x39')],function(_0x19cf82){var _0x5ca249={};_0x5ca249[_0x19cf82]={'$like':'%'+_0x1f8f18['query'][_0x16d7('0x42')]+'%'};return _0x5ca249;})});}_0x551220=_['merge']({},_0x551220,_0x1f8f18[_0x16d7('0x48')]);return _0x4436ab[_0x16d7('0x8d')](_0x551220);}})[_0x16d7('0x29')](function(_0x1d189d){if(_0x1d189d){_0x297b1c=_0x1d189d[_0x16d7('0x3b')];if(!_0x1f8f18[_0x16d7('0x36')][_0x16d7('0x3c')](_0x16d7('0x3d'))){_0x551220[_0x16d7('0x21')]=qs[_0x16d7('0x21')](_0x1f8f18[_0x16d7('0x36')]['limit']);_0x551220['offset']=qs[_0x16d7('0x22')](_0x1f8f18[_0x16d7('0x36')][_0x16d7('0x22')]);}return _0x4436ab[_0x16d7('0x8d')](_0x551220);}})[_0x16d7('0x29')](function(_0x31e577){if(_0x31e577){return _0x31e577?{'count':_0x297b1c,'rows':_0x31e577}:null;}})[_0x16d7('0x29')](respondWithResult(_0x5a50a7,null))[_0x16d7('0x4d')](handleError(_0x5a50a7,null));}; \ No newline at end of file +var _0x4e55=['params','fields','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','UserFaxQueue','hasOwnProperty','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','Agents','online','voicePause','interface','transaction','each','findOrCreate','forEach','removeTeams','select','from','team_has_fax_queues','join','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','TeamId','includes','union','compact','value','ids','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','FaxQueues','UserProfileResource','error','stack','name','send','index','FaxQueue','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show'];(function(_0x32f8a2,_0x49c502){var _0x258cca=function(_0x1040e4){while(--_0x1040e4){_0x32f8a2['push'](_0x32f8a2['shift']());}};_0x258cca(++_0x49c502);}(_0x4e55,0x15d));var _0x54e5=function(_0x28287e,_0x1b25c3){_0x28287e=_0x28287e-0x0;var _0xc8df58=_0x4e55[_0x28287e];return _0xc8df58;};'use strict';var emlformat=require(_0x54e5('0x0'));var rimraf=require(_0x54e5('0x1'));var zipdir=require(_0x54e5('0x2'));var jsonpatch=require(_0x54e5('0x3'));var rp=require(_0x54e5('0x4'));var moment=require(_0x54e5('0x5'));var BPromise=require(_0x54e5('0x6'));var Mustache=require(_0x54e5('0x7'));var util=require(_0x54e5('0x8'));var path=require(_0x54e5('0x9'));var sox=require(_0x54e5('0xa'));var csv=require(_0x54e5('0xb'));var ejs=require(_0x54e5('0xc'));var fs=require('fs');var fs_extra=require(_0x54e5('0xd'));var _=require(_0x54e5('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x54e5('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x54e5('0xf'));var authService=require(_0x54e5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x54e5('0x11'));var hardwareService=require(_0x54e5('0x12'));var logger=require(_0x54e5('0x13'))(_0x54e5('0x14'));var utils=require(_0x54e5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x54e5('0x16'));var db=require(_0x54e5('0x17'))['db'];config[_0x54e5('0x18')]=_['defaults'](config[_0x54e5('0x18')],{'host':_0x54e5('0x19'),'port':0x18eb});var socket=require(_0x54e5('0x1a'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x54e5('0x1b')](socket);function respondWithStatusCode(_0x8c80f8,_0xf8d419){_0xf8d419=_0xf8d419||0xcc;return function(_0x10e4c0){if(_0x10e4c0){return _0x8c80f8[_0x54e5('0x1c')](_0xf8d419);}return _0x8c80f8['status'](_0xf8d419)[_0x54e5('0x1d')]();};}function respondWithResult(_0xdbda1f,_0x227241){_0x227241=_0x227241||0xc8;return function(_0x2a1c1c){if(_0x2a1c1c){return _0xdbda1f[_0x54e5('0x1e')](_0x227241)[_0x54e5('0x1f')](_0x2a1c1c);}};}function respondWithFilteredResult(_0x3d7000,_0x46c277){return function(_0x5d9f6d){if(_0x5d9f6d){var _0x27eafb=typeof _0x46c277[_0x54e5('0x20')]===_0x54e5('0x21')&&typeof _0x46c277[_0x54e5('0x22')]==='undefined';var _0x1b35f6=_0x5d9f6d[_0x54e5('0x23')];var _0x19793f=_0x27eafb?0x0:_0x46c277[_0x54e5('0x20')];var _0x3010ab=_0x27eafb?_0x5d9f6d['count']:_0x46c277[_0x54e5('0x20')]+_0x46c277[_0x54e5('0x22')];var _0x44031a;if(_0x3010ab>=_0x1b35f6){_0x3010ab=_0x1b35f6;_0x44031a=0xc8;}else{_0x44031a=0xce;}_0x3d7000[_0x54e5('0x1e')](_0x44031a);return _0x3d7000[_0x54e5('0x24')](_0x54e5('0x25'),_0x19793f+'-'+_0x3010ab+'/'+_0x1b35f6)['json'](_0x5d9f6d);}return null;};}function patchUpdates(_0x4912de){return function(_0x46fe37){try{jsonpatch[_0x54e5('0x26')](_0x46fe37,_0x4912de,!![]);}catch(_0x4db4a2){return BPromise[_0x54e5('0x27')](_0x4db4a2);}return _0x46fe37['save']();};}function saveUpdates(_0x194909,_0x40f92d){return function(_0x292763){if(_0x292763){return _0x292763[_0x54e5('0x28')](_0x194909)[_0x54e5('0x29')](function(_0x332dfd){return _0x332dfd;});}return null;};}function removeEntity(_0xf0b7d3,_0x45275d){return function(_0xf1ebd8){if(_0xf1ebd8){return _0xf1ebd8[_0x54e5('0x2a')]()[_0x54e5('0x29')](function(){var _0x1b2181=_0xf1ebd8['get']({'plain':!![]});var _0x1f8710=_0x54e5('0x2b');return db[_0x54e5('0x2c')][_0x54e5('0x2a')]({'where':{'type':_0x1f8710,'resourceId':_0x1b2181['id']}})[_0x54e5('0x29')](function(){return _0xf1ebd8;});})[_0x54e5('0x29')](function(){_0xf0b7d3[_0x54e5('0x1e')](0xcc)[_0x54e5('0x1d')]();});}};}function handleEntityNotFound(_0x5dc4f6,_0xc2fa7c){return function(_0x21339f){if(!_0x21339f){_0x5dc4f6[_0x54e5('0x1c')](0x194);}return _0x21339f;};}function handleError(_0xca9eee,_0x24f7b6){_0x24f7b6=_0x24f7b6||0x1f4;return function(_0x3190d7){logger[_0x54e5('0x2d')](_0x3190d7[_0x54e5('0x2e')]);if(_0x3190d7[_0x54e5('0x2f')]){delete _0x3190d7['name'];}_0xca9eee[_0x54e5('0x1e')](_0x24f7b6)[_0x54e5('0x30')](_0x3190d7);};}exports[_0x54e5('0x31')]=function(_0x2e77c7,_0x401b31){var _0x31aef3={},_0xdd9ad1={},_0x4abe2d={'count':0x0,'rows':[]};var _0x1afa81=_['map'](db[_0x54e5('0x32')][_0x54e5('0x33')],function(_0x108d36){return{'name':_0x108d36[_0x54e5('0x34')],'type':_0x108d36[_0x54e5('0x35')][_0x54e5('0x36')]};});_0xdd9ad1['model']=_[_0x54e5('0x37')](_0x1afa81,_0x54e5('0x2f'));_0xdd9ad1[_0x54e5('0x38')]=_[_0x54e5('0x39')](_0x2e77c7[_0x54e5('0x38')]);_0xdd9ad1[_0x54e5('0x3a')]=_[_0x54e5('0x3b')](_0xdd9ad1[_0x54e5('0x3c')],_0xdd9ad1[_0x54e5('0x38')]);_0x31aef3[_0x54e5('0x3d')]=_['intersection'](_0xdd9ad1['model'],qs['fields'](_0x2e77c7[_0x54e5('0x38')]['fields']));_0x31aef3[_0x54e5('0x3d')]=_0x31aef3[_0x54e5('0x3d')][_0x54e5('0x3e')]?_0x31aef3[_0x54e5('0x3d')]:_0xdd9ad1[_0x54e5('0x3c')];if(!_0x2e77c7[_0x54e5('0x38')]['hasOwnProperty'](_0x54e5('0x3f'))){_0x31aef3[_0x54e5('0x22')]=qs[_0x54e5('0x22')](_0x2e77c7[_0x54e5('0x38')][_0x54e5('0x22')]);_0x31aef3[_0x54e5('0x20')]=qs[_0x54e5('0x20')](_0x2e77c7[_0x54e5('0x38')][_0x54e5('0x20')]);}_0x31aef3[_0x54e5('0x40')]=qs[_0x54e5('0x41')](_0x2e77c7['query'][_0x54e5('0x41')]);_0x31aef3[_0x54e5('0x42')]=qs[_0x54e5('0x3a')](_[_0x54e5('0x43')](_0x2e77c7[_0x54e5('0x38')],_0xdd9ad1[_0x54e5('0x3a')]),_0x1afa81);if(_0x2e77c7[_0x54e5('0x38')]['filter']){_0x31aef3[_0x54e5('0x42')]=_[_0x54e5('0x44')](_0x31aef3[_0x54e5('0x42')],{'$or':_[_0x54e5('0x37')](_0x1afa81,function(_0x1d23ce){if(_0x1d23ce[_0x54e5('0x35')]!==_0x54e5('0x45')){var _0x41805e={};_0x41805e[_0x1d23ce[_0x54e5('0x2f')]]={'$like':'%'+_0x2e77c7[_0x54e5('0x38')][_0x54e5('0x46')]+'%'};return _0x41805e;}})});}_0x31aef3=_[_0x54e5('0x44')]({},_0x31aef3,_0x2e77c7[_0x54e5('0x47')]);var _0x56b87e={'where':_0x31aef3[_0x54e5('0x42')]};return db['FaxQueue'][_0x54e5('0x23')](_0x56b87e)[_0x54e5('0x29')](function(_0x102545){_0x4abe2d[_0x54e5('0x23')]=_0x102545;if(_0x2e77c7[_0x54e5('0x38')][_0x54e5('0x48')]){_0x31aef3[_0x54e5('0x49')]=[{'all':!![]}];}return db[_0x54e5('0x32')][_0x54e5('0x4a')](_0x31aef3);})[_0x54e5('0x29')](function(_0x1748d1){_0x4abe2d[_0x54e5('0x4b')]=_0x1748d1;return _0x4abe2d;})[_0x54e5('0x29')](respondWithFilteredResult(_0x401b31,_0x31aef3))['catch'](handleError(_0x401b31,null));};exports[_0x54e5('0x4c')]=function(_0xd38146,_0x1f6e60){var _0x3e866e={'raw':!![],'where':{'id':_0xd38146[_0x54e5('0x4d')]['id']}},_0x235990={};_0x235990[_0x54e5('0x3c')]=_['keys'](db[_0x54e5('0x32')]['rawAttributes']);_0x235990[_0x54e5('0x38')]=_['keys'](_0xd38146[_0x54e5('0x38')]);_0x235990[_0x54e5('0x3a')]=_[_0x54e5('0x3b')](_0x235990[_0x54e5('0x3c')],_0x235990[_0x54e5('0x38')]);_0x3e866e['attributes']=_[_0x54e5('0x3b')](_0x235990['model'],qs[_0x54e5('0x4e')](_0xd38146[_0x54e5('0x38')]['fields']));_0x3e866e[_0x54e5('0x3d')]=_0x3e866e[_0x54e5('0x3d')][_0x54e5('0x3e')]?_0x3e866e[_0x54e5('0x3d')]:_0x235990[_0x54e5('0x3c')];if(_0xd38146[_0x54e5('0x38')]['includeAll']){_0x3e866e[_0x54e5('0x49')]=[{'all':!![]}];}_0x3e866e=_['merge']({},_0x3e866e,_0xd38146[_0x54e5('0x47')]);return db[_0x54e5('0x32')][_0x54e5('0x4f')](_0x3e866e)[_0x54e5('0x29')](handleEntityNotFound(_0x1f6e60,null))['then'](respondWithResult(_0x1f6e60,null))[_0x54e5('0x50')](handleError(_0x1f6e60,null));};exports['create']=function(_0x335615,_0x251c39){return db['FaxQueue'][_0x54e5('0x51')](_0x335615[_0x54e5('0x52')],{})[_0x54e5('0x29')](function(_0x1139d3){var _0x178e92=_0x335615[_0x54e5('0x53')][_0x54e5('0x54')]({'plain':!![]});if(!_0x178e92)throw new Error(_0x54e5('0x55'));if(_0x178e92['role']===_0x54e5('0x53')){var _0x232dcc=_0x1139d3[_0x54e5('0x54')]({'plain':!![]});var _0x3ad2ca=_0x54e5('0x2b');return db[_0x54e5('0x56')][_0x54e5('0x4f')]({'where':{'name':_0x3ad2ca,'userProfileId':_0x178e92[_0x54e5('0x57')]},'raw':!![]})['then'](function(_0x4e9424){if(_0x4e9424&&_0x4e9424[_0x54e5('0x58')]===0x0){return db['UserProfileResource'][_0x54e5('0x51')]({'name':_0x232dcc[_0x54e5('0x2f')],'resourceId':_0x232dcc['id'],'type':_0x4e9424[_0x54e5('0x2f')],'sectionId':_0x4e9424['id']},{})['then'](function(){return _0x1139d3;});}else{return _0x1139d3;}})[_0x54e5('0x50')](function(_0x3c91e2){logger[_0x54e5('0x2d')](_0x54e5('0x59'),_0x3c91e2);throw _0x3c91e2;});}return _0x1139d3;})[_0x54e5('0x29')](respondWithResult(_0x251c39,0xc9))[_0x54e5('0x50')](handleError(_0x251c39,null));};exports[_0x54e5('0x28')]=function(_0x599ae6,_0x84abc1){if(_0x599ae6[_0x54e5('0x52')]['id']){delete _0x599ae6[_0x54e5('0x52')]['id'];}return db[_0x54e5('0x32')][_0x54e5('0x4f')]({'where':{'id':_0x599ae6['params']['id']}})['then'](handleEntityNotFound(_0x84abc1,null))[_0x54e5('0x29')](saveUpdates(_0x599ae6[_0x54e5('0x52')],null))['then'](respondWithResult(_0x84abc1,null))[_0x54e5('0x50')](handleError(_0x84abc1,null));};exports[_0x54e5('0x2a')]=function(_0x1248be,_0x38b7ad){return db['FaxQueue']['find']({'where':{'id':_0x1248be['params']['id']}})[_0x54e5('0x29')](handleEntityNotFound(_0x38b7ad,null))['then'](removeEntity(_0x38b7ad,null))[_0x54e5('0x50')](handleError(_0x38b7ad,null));};exports['describe']=function(_0x7fec66,_0x2bb510){return db['FaxQueue']['describe']()[_0x54e5('0x29')](respondWithResult(_0x2bb510,null))[_0x54e5('0x50')](handleError(_0x2bb510,null));};exports[_0x54e5('0x5a')]=function(_0x31272b,_0x29a995,_0x4dc3f6){var _0x23ff3c={'raw':!![],'where':{}},_0x3b9056={},_0x3d8a98;return db[_0x54e5('0x32')][_0x54e5('0x5b')]({'where':{'id':_0x31272b[_0x54e5('0x4d')]['id']}})[_0x54e5('0x29')](handleEntityNotFound(_0x29a995,null))[_0x54e5('0x29')](function(_0x167888){if(_0x167888){_0x3d8a98=_0x167888[_0x54e5('0x54')]({'plain':!![]});_0x3b9056[_0x54e5('0x3c')]=_[_0x54e5('0x39')](db[_0x54e5('0x5c')][_0x54e5('0x33')]);_0x3b9056['query']=_[_0x54e5('0x39')](_0x31272b[_0x54e5('0x38')]);_0x3b9056['filters']=_[_0x54e5('0x3b')](_0x3b9056['model'],_0x3b9056[_0x54e5('0x38')]);_0x23ff3c[_0x54e5('0x3d')]=_['intersection'](_0x3b9056['model'],qs[_0x54e5('0x4e')](_0x31272b['query'][_0x54e5('0x4e')]));_0x23ff3c[_0x54e5('0x3d')]=_0x23ff3c[_0x54e5('0x3d')][_0x54e5('0x3e')]?_0x23ff3c[_0x54e5('0x3d')]:_0x3b9056['model'];if(!_0x31272b['query'][_0x54e5('0x5d')](_0x54e5('0x3f'))){_0x23ff3c[_0x54e5('0x22')]=qs[_0x54e5('0x22')](_0x31272b['query']['limit']);_0x23ff3c[_0x54e5('0x20')]=qs['offset'](_0x31272b[_0x54e5('0x38')][_0x54e5('0x20')]);}_0x23ff3c[_0x54e5('0x40')]=qs[_0x54e5('0x41')](_0x31272b[_0x54e5('0x38')][_0x54e5('0x41')]);_0x23ff3c[_0x54e5('0x42')]=qs[_0x54e5('0x3a')](_['pick'](_0x31272b[_0x54e5('0x38')],_0x3b9056[_0x54e5('0x3a')]));_0x23ff3c[_0x54e5('0x42')]['FaxQueueId']=_0x167888['id'];if(_0x31272b[_0x54e5('0x38')][_0x54e5('0x46')]){_0x23ff3c[_0x54e5('0x42')]=_[_0x54e5('0x44')](_0x23ff3c[_0x54e5('0x42')],{'$or':_[_0x54e5('0x37')](_0x23ff3c[_0x54e5('0x3d')],function(_0x59e64c){var _0x48b095={};_0x48b095[_0x59e64c]={'$like':'%'+_0x31272b['query']['filter']+'%'};return _0x48b095;})});}_0x23ff3c=_[_0x54e5('0x44')]({},_0x23ff3c,_0x31272b['options']);return db[_0x54e5('0x5c')][_0x54e5('0x4a')](_0x23ff3c);}})[_0x54e5('0x29')](function(_0x2d8343){if(_0x2d8343){return db[_0x54e5('0x5e')][_0x54e5('0x5f')]({'where':{'id':_['map'](_0x2d8343,_0x54e5('0x60')),'role':_0x54e5('0x61')},'attributes':['id','name',_0x54e5('0x62'),_0x54e5('0x63'),_0x54e5('0x64')]});}})[_0x54e5('0x29')](function(_0x1cc26a){if(_0x1cc26a){return{'count':_0x1cc26a['count'],'rows':_['map'](_0x1cc26a[_0x54e5('0x4b')],function(_0x11860e){return{'membername':_0x11860e[_0x54e5('0x2f')],'UserId':_0x11860e['id'],'queue_name':_0x3d8a98['name'],'FaxQueueId':_0x3d8a98['id'],'interface':util[_0x54e5('0x65')]('%s/%s',_0x54e5('0x66'),_0x11860e[_0x54e5('0x2f')]),'penalty':0x0,'paused':_0x11860e[_0x54e5('0x62')],'createdAt':_0x11860e[_0x54e5('0x64')],'updatedAt':_0x11860e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x29a995,_0x23ff3c))['catch'](handleError(_0x29a995,null));};exports[_0x54e5('0x67')]=function(_0x85d8ba,_0x51dd0e,_0x3c0e01){var _0x130352={};var _0x4eb47d={};var _0x2d0db8;var _0x2e9ad9;return db[_0x54e5('0x32')]['findOne']({'where':{'id':_0x85d8ba['params']['id']}})[_0x54e5('0x29')](handleEntityNotFound(_0x51dd0e,null))[_0x54e5('0x29')](function(_0x19c785){if(_0x19c785){_0x2d0db8=_0x19c785;_0x4eb47d[_0x54e5('0x3c')]=_[_0x54e5('0x39')](db[_0x54e5('0x68')][_0x54e5('0x33')]);_0x4eb47d['query']=_[_0x54e5('0x39')](_0x85d8ba[_0x54e5('0x38')]);_0x4eb47d[_0x54e5('0x3a')]=_[_0x54e5('0x3b')](_0x4eb47d[_0x54e5('0x3c')],_0x4eb47d[_0x54e5('0x38')]);_0x130352[_0x54e5('0x3d')]=_[_0x54e5('0x3b')](_0x4eb47d[_0x54e5('0x3c')],qs['fields'](_0x85d8ba[_0x54e5('0x38')][_0x54e5('0x4e')]));_0x130352['attributes']=_0x130352[_0x54e5('0x3d')][_0x54e5('0x3e')]?_0x130352[_0x54e5('0x3d')]:_0x4eb47d[_0x54e5('0x3c')];_0x130352['order']=qs[_0x54e5('0x41')](_0x85d8ba[_0x54e5('0x38')][_0x54e5('0x41')]);_0x130352[_0x54e5('0x42')]=qs[_0x54e5('0x3a')](_[_0x54e5('0x43')](_0x85d8ba[_0x54e5('0x38')],_0x4eb47d[_0x54e5('0x3a')]));if(_0x85d8ba[_0x54e5('0x38')]['filter']){_0x130352['where']=_[_0x54e5('0x44')](_0x130352[_0x54e5('0x42')],{'$or':_[_0x54e5('0x37')](_0x130352['attributes'],function(_0x5bbacf){var _0x359e7e={};_0x359e7e[_0x5bbacf]={'$like':'%'+_0x85d8ba[_0x54e5('0x38')]['filter']+'%'};return _0x359e7e;})});}_0x130352=_[_0x54e5('0x44')]({},_0x130352,_0x85d8ba['options']);return _0x2d0db8[_0x54e5('0x67')](_0x130352);}})[_0x54e5('0x29')](function(_0x4403ed){if(_0x4403ed){_0x2e9ad9=_0x4403ed[_0x54e5('0x3e')];if(!_0x85d8ba[_0x54e5('0x38')][_0x54e5('0x5d')](_0x54e5('0x3f'))){_0x130352['limit']=qs[_0x54e5('0x22')](_0x85d8ba[_0x54e5('0x38')]['limit']);_0x130352[_0x54e5('0x20')]=qs[_0x54e5('0x20')](_0x85d8ba['query']['offset']);}return _0x2d0db8[_0x54e5('0x67')](_0x130352);}})[_0x54e5('0x29')](function(_0x46c716){if(_0x46c716){return _0x46c716?{'count':_0x2e9ad9,'rows':_0x46c716}:null;}})['then'](respondWithResult(_0x51dd0e,null))['catch'](handleError(_0x51dd0e,null));};exports[_0x54e5('0x69')]=function(_0x440627,_0x37e7fa,_0x873e6){var _0xacbbb0=_0x440627['body']['ids'];return db[_0x54e5('0x68')][_0x54e5('0x4a')]({'where':{'id':_0xacbbb0},'attributes':['id'],'include':[{'model':db[_0x54e5('0x5e')],'as':_0x54e5('0x6a'),'attributes':['id',_0x54e5('0x2f'),_0x54e5('0x6b'),_0x54e5('0x6c'),_0x54e5('0x6d')],'raw':!![]}]})['then'](function(_0x3860ae){if(_0x3860ae){var _0xc4ce8d=_['flatMap'](_0x3860ae,function(_0x4ee98d){var _0x45636f=_0x4ee98d['get']({'plain':!![]});return _0x45636f['Agents'];});return db['FaxQueue']['find']({'where':{'id':_0x440627[_0x54e5('0x4d')]['id']}})[_0x54e5('0x29')](function(_0xc0b81b){return db['sequelize'][_0x54e5('0x6e')](function(_0x1f7817){return _0xc0b81b[_0x54e5('0x69')](_0xacbbb0,{'transaction':_0x1f7817})['then'](function(){return BPromise[_0x54e5('0x6f')](_0xc4ce8d,function(_0x425286){return db['UserFaxQueue'][_0x54e5('0x70')]({'where':{'UserId':_0x425286['id'],'FaxQueueId':_0x440627['params']['id']},'transaction':_0x1f7817});});})['then'](function(){_0xc4ce8d[_0x54e5('0x71')](function(_0x50401c){socket['emit']('userFaxQueue:save',{'UserId':_0x50401c['id'],'FaxQueueId':_0xc0b81b['id']});});});});});}})[_0x54e5('0x29')](respondWithStatusCode(_0x37e7fa,null))['catch'](handleError(_0x37e7fa,null));};exports[_0x54e5('0x72')]=function(_0x527fef,_0x1ffbf5,_0x33bb94){return db[_0x54e5('0x68')][_0x54e5('0x4a')]({'where':{'id':_0x527fef[_0x54e5('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x54e5('0x5e')],'as':_0x54e5('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x54e5('0x29')](handleEntityNotFound(_0x1ffbf5,null))[_0x54e5('0x29')](function(_0x1fccd8){var _0x885d70=_[_0x54e5('0x37')](_0x1fccd8,'id');var _0x49153f=[];var _0x556c08=[];var _0x4e91ab=squel[_0x54e5('0x73')]();_0x4e91ab['field']('tq.TeamId')[_0x54e5('0x74')](_0x54e5('0x75'),'tq')[_0x54e5('0x76')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x54e5('0x42')](_0x54e5('0x77'),_0x527fef[_0x54e5('0x4d')]['id']);for(var _0x36335b=0x0;_0x36335b<_0x1fccd8[_0x54e5('0x3e')];_0x36335b+=0x1){let _0x2427c4=_0x1fccd8[_0x36335b];for(var _0x1dd357=0x0;_0x1dd357<_0x2427c4[_0x54e5('0x6a')][_0x54e5('0x3e')];_0x1dd357+=0x1){let _0x33237b=_0x2427c4[_0x54e5('0x6a')][_0x1dd357];var _0x3fd25b=_0x4e91ab[_0x54e5('0x78')]();_0x3fd25b['where'](_0x54e5('0x79'),_0x33237b['id']);_0x556c08[_0x54e5('0x7a')](db['sequelize'][_0x54e5('0x38')](_0x3fd25b['toString'](),{'type':db[_0x54e5('0x7b')][_0x54e5('0x7c')][_0x54e5('0x7d')]})[_0x54e5('0x29')](function(_0x43e40d){if(_0x43e40d[_0x54e5('0x3e')]===0x1){return _0x33237b['id'];}else{var _0x34768e=_['every'](_[_0x54e5('0x37')](_0x43e40d,_0x54e5('0x7e')),function(_0x33bf6b){return _[_0x54e5('0x7f')](_0x885d70,_0x33bf6b);});if(_0x34768e){return _0x33237b['id'];}}}));}}return BPromise['all'](_0x556c08)['then'](function(_0x22b4ad){_0x49153f=_(_0x49153f)[_0x54e5('0x80')](_0x22b4ad)[_0x54e5('0x81')]()[_0x54e5('0x82')]();return db[_0x54e5('0x32')][_0x54e5('0x4f')]({'where':{'id':_0x527fef['params']['id']}})[_0x54e5('0x29')](function(_0x13c9a6){return db['sequelize']['transaction'](function(_0x318842){return _0x13c9a6[_0x54e5('0x72')](_0x527fef['query'][_0x54e5('0x83')],{'transaction':_0x318842})[_0x54e5('0x29')](function(){if(!_[_0x54e5('0x84')](_0x49153f)){return _0x13c9a6[_0x54e5('0x85')](_0x49153f,{'transaction':_0x318842});}})['then'](function(){_0x49153f[_0x54e5('0x71')](function(_0x2a375f){socket[_0x54e5('0x86')](_0x54e5('0x87'),{'UserId':_0x2a375f,'FaxQueueId':_0x13c9a6['id']});});});});});});})[_0x54e5('0x29')](respondWithStatusCode(_0x1ffbf5,null))[_0x54e5('0x50')](handleError(_0x1ffbf5,null));};exports[_0x54e5('0x88')]=function(_0x403e2d,_0x5d27f4,_0x3939f4){return db[_0x54e5('0x32')][_0x54e5('0x4f')]({'where':{'id':_0x403e2d[_0x54e5('0x4d')]['id']}})[_0x54e5('0x29')](handleEntityNotFound(_0x5d27f4,null))[_0x54e5('0x29')](function(_0x2e37b2){if(_0x2e37b2){return _0x2e37b2[_0x54e5('0x88')](_0x403e2d[_0x54e5('0x52')]['ids'],_[_0x54e5('0x89')](_0x403e2d[_0x54e5('0x52')],['ids','id'])||{})[_0x54e5('0x8a')](function(_0x4517d5){for(var _0x8d3273=0x0;_0x8d3273<_0x403e2d[_0x54e5('0x52')]['ids'][_0x54e5('0x3e')];_0x8d3273+=0x1){socket['emit'](_0x54e5('0x8b'),{'UserId':Number(_0x403e2d['body'][_0x54e5('0x83')][_0x8d3273]),'FaxQueueId':Number(_0x403e2d[_0x54e5('0x4d')]['id'])});}return _0x4517d5;});}})[_0x54e5('0x29')](respondWithResult(_0x5d27f4,null))[_0x54e5('0x50')](handleError(_0x5d27f4,null));};exports['removeAgents']=function(_0x30cc0a,_0xdc72d8,_0xb6320b){return db[_0x54e5('0x32')][_0x54e5('0x4f')]({'where':{'id':_0x30cc0a['params']['id']}})[_0x54e5('0x29')](handleEntityNotFound(_0xdc72d8,null))[_0x54e5('0x29')](function(_0x36d70b){if(_0x36d70b){return _0x36d70b[_0x54e5('0x85')](_0x30cc0a[_0x54e5('0x38')][_0x54e5('0x83')])['then'](function(){if(_[_0x54e5('0x8c')](_0x30cc0a[_0x54e5('0x38')]['ids'])){for(var _0x1b1c46=0x0;_0x1b1c46<_0x30cc0a[_0x54e5('0x38')][_0x54e5('0x83')]['length'];_0x1b1c46+=0x1){socket[_0x54e5('0x86')]('userFaxQueue:remove',{'UserId':Number(_0x30cc0a[_0x54e5('0x38')][_0x54e5('0x83')][_0x1b1c46]),'FaxQueueId':Number(_0x30cc0a[_0x54e5('0x4d')]['id'])});}}else{socket[_0x54e5('0x86')](_0x54e5('0x87'),{'UserId':Number(_0x30cc0a[_0x54e5('0x38')][_0x54e5('0x83')]),'FaxQueueId':Number(_0x30cc0a[_0x54e5('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0xdc72d8,null))[_0x54e5('0x50')](handleError(_0xdc72d8,null));};exports[_0x54e5('0x8d')]=function(_0x5e38fb,_0x71a6c1,_0x181100){var _0x40a0cd={};var _0x5b03ae={};var _0x561ac9;var _0xc282e9;return db['FaxQueue'][_0x54e5('0x5b')]({'where':{'id':_0x5e38fb['params']['id']}})[_0x54e5('0x29')](handleEntityNotFound(_0x71a6c1,null))[_0x54e5('0x29')](function(_0x1a95aa){if(_0x1a95aa){_0x561ac9=_0x1a95aa;_0x5b03ae[_0x54e5('0x3c')]=_['keys'](db[_0x54e5('0x5e')][_0x54e5('0x33')]);_0x5b03ae[_0x54e5('0x38')]=_[_0x54e5('0x39')](_0x5e38fb[_0x54e5('0x38')]);_0x5b03ae[_0x54e5('0x3a')]=_[_0x54e5('0x3b')](_0x5b03ae[_0x54e5('0x3c')],_0x5b03ae[_0x54e5('0x38')]);_0x40a0cd['attributes']=_[_0x54e5('0x3b')](_0x5b03ae['model'],qs[_0x54e5('0x4e')](_0x5e38fb[_0x54e5('0x38')][_0x54e5('0x4e')]));_0x40a0cd[_0x54e5('0x3d')]=_0x40a0cd[_0x54e5('0x3d')]['length']?_0x40a0cd[_0x54e5('0x3d')]:_0x5b03ae['model'];_0x40a0cd['order']=qs['sort'](_0x5e38fb[_0x54e5('0x38')]['sort']);_0x40a0cd[_0x54e5('0x42')]=qs[_0x54e5('0x3a')](_[_0x54e5('0x43')](_0x5e38fb['query'],_0x5b03ae[_0x54e5('0x3a')]));if(_0x5e38fb['query'][_0x54e5('0x46')]){_0x40a0cd[_0x54e5('0x42')]=_['merge'](_0x40a0cd[_0x54e5('0x42')],{'$or':_['map'](_0x40a0cd['attributes'],function(_0x4e7a9f){var _0x2cacb6={};_0x2cacb6[_0x4e7a9f]={'$like':'%'+_0x5e38fb[_0x54e5('0x38')][_0x54e5('0x46')]+'%'};return _0x2cacb6;})});}_0x40a0cd=_[_0x54e5('0x44')]({},_0x40a0cd,_0x5e38fb['options']);return _0x561ac9[_0x54e5('0x8d')](_0x40a0cd);}})[_0x54e5('0x29')](function(_0x31d58f){if(_0x31d58f){_0xc282e9=_0x31d58f[_0x54e5('0x3e')];if(!_0x5e38fb[_0x54e5('0x38')]['hasOwnProperty']('nolimit')){_0x40a0cd[_0x54e5('0x22')]=qs[_0x54e5('0x22')](_0x5e38fb['query'][_0x54e5('0x22')]);_0x40a0cd[_0x54e5('0x20')]=qs['offset'](_0x5e38fb['query'][_0x54e5('0x20')]);}return _0x561ac9['getAgents'](_0x40a0cd);}})[_0x54e5('0x29')](function(_0x43ef01){if(_0x43ef01){return _0x43ef01?{'count':_0xc282e9,'rows':_0x43ef01}:null;}})[_0x54e5('0x29')](respondWithResult(_0x71a6c1,null))[_0x54e5('0x50')](handleError(_0x71a6c1,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 20f7036..3f579af 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 _0x16a0=['save','update','emit','hasOwnProperty','exports','events'];(function(_0x51c127,_0x3e65bb){var _0xa9db39=function(_0x5b98e7){while(--_0x5b98e7){_0x51c127['push'](_0x51c127['shift']());}};_0xa9db39(++_0x3e65bb);}(_0x16a0,0xdd));var _0x016a=function(_0x387a0c,_0x9fb0a2){_0x387a0c=_0x387a0c-0x0;var _0xce7213=_0x16a0[_0x387a0c];return _0xce7213;};'use strict';var EventEmitter=require(_0x016a('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x016a('0x1'),'afterUpdate':_0x016a('0x2'),'afterDestroy':'remove'};function emitEvent(_0x3b3f81){return function(_0x14135a,_0x39efcc,_0x2697bb){FaxQueueEvents[_0x016a('0x3')](_0x3b3f81+':'+_0x14135a['id'],_0x14135a);FaxQueueEvents[_0x016a('0x3')](_0x3b3f81,_0x14135a);_0x2697bb(null);};}for(var e in events){if(events[_0x016a('0x4')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x016a('0x5')]=FaxQueueEvents; \ No newline at end of file +var _0x2eb4=['emit','hook','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove'];(function(_0x885990,_0x3a8e90){var _0x48f8e0=function(_0x2521cb){while(--_0x2521cb){_0x885990['push'](_0x885990['shift']());}};_0x48f8e0(++_0x3a8e90);}(_0x2eb4,0xc2));var _0x42eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2eb4[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x42eb('0x0'))['db'][_0x42eb('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x42eb('0x2')](0x0);var events={'afterCreate':_0x42eb('0x3'),'afterUpdate':_0x42eb('0x4'),'afterDestroy':_0x42eb('0x5')};function emitEvent(_0x3e64db){return function(_0x5f49e1,_0x23ccc5,_0x1d82fa){FaxQueueEvents[_0x42eb('0x6')](_0x3e64db+':'+_0x5f49e1['id'],_0x5f49e1);FaxQueueEvents[_0x42eb('0x6')](_0x3e64db,_0x5f49e1);_0x1d82fa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x42eb('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 2ce976c..4cb8de3 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 _0x0310=['./faxQueue.attributes','exports','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x201c2e,_0x4e7792){var _0x416b52=function(_0x48735a){while(--_0x48735a){_0x201c2e['push'](_0x201c2e['shift']());}};_0x416b52(++_0x4e7792);}(_0x0310,0x1a4));var _0x0031=function(_0x5bdc6e,_0x361628){_0x5bdc6e=_0x5bdc6e-0x0;var _0x454f45=_0x0310[_0x5bdc6e];return _0x454f45;};'use strict';var _=require(_0x0031('0x0'));var util=require(_0x0031('0x1'));var logger=require(_0x0031('0x2'))(_0x0031('0x3'));var moment=require(_0x0031('0x4'));var BPromise=require(_0x0031('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0031('0x6'));var rimraf=require(_0x0031('0x7'));var config=require(_0x0031('0x8'));var attributes=require(_0x0031('0x9'));module[_0x0031('0xa')]=function(_0x29bffc,_0x560164){return _0x29bffc['define'](_0x0031('0xb'),attributes,{'tableName':_0x0031('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa40c=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','FaxQueue','util'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xa40c,0x1af));var _0xca40=function(_0x294cf1,_0x5d6a40){_0x294cf1=_0x294cf1-0x0;var _0x334402=_0xa40c[_0x294cf1];return _0x334402;};'use strict';var _=require('lodash');var util=require(_0xca40('0x0'));var logger=require(_0xca40('0x1'))(_0xca40('0x2'));var moment=require(_0xca40('0x3'));var BPromise=require(_0xca40('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xca40('0x5'));var config=require(_0xca40('0x6'));var attributes=require('./faxQueue.attributes');module[_0xca40('0x7')]=function(_0x242f8b,_0x3042f5){return _0x242f8b['define'](_0xca40('0x8'),attributes,{'tableName':'fax_queues','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 3b5b0e8..7f340f4 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 _0x6e72=['code','message','result','catch','GetFaxQueue','FaxQueue','options','raw','attributes','limit','map','include','model','ShowFaxQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x15feba,_0x54c0ff){var _0x1fd70d=function(_0x359fb4){while(--_0x359fb4){_0x15feba['push'](_0x15feba['shift']());}};_0x1fd70d(++_0x54c0ff);}(_0x6e72,0x144));var _0x26e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e72[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x26e7('0x0'));var util=require(_0x26e7('0x1'));var moment=require(_0x26e7('0x2'));var BPromise=require(_0x26e7('0x3'));var rs=require(_0x26e7('0x4'));var fs=require('fs');var Redis=require(_0x26e7('0x5'));var db=require(_0x26e7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x26e7('0x7'))(_0x26e7('0x8'));var config=require(_0x26e7('0x9'));var jayson=require(_0x26e7('0xa'));var client=jayson[_0x26e7('0xb')][_0x26e7('0xc')]({'port':0x232a});config[_0x26e7('0xd')]=_[_0x26e7('0xe')](config[_0x26e7('0xd')],{'host':_0x26e7('0xf'),'port':0x18eb});var socket=require(_0x26e7('0x10'))(new Redis(config[_0x26e7('0xd')]));require(_0x26e7('0x11'))[_0x26e7('0x12')](socket);function respondWithRpcPromise(_0x276684,_0x11a77c,_0x5ec819){return new BPromise(function(_0x18d1f2,_0x7cf00b){return client[_0x26e7('0x13')](_0x276684,_0x5ec819)[_0x26e7('0x14')](function(_0x6e625f){logger[_0x26e7('0x15')](_0x26e7('0x16'),_0x11a77c,'request\x20sent');logger[_0x26e7('0x17')](_0x26e7('0x18'),_0x11a77c,_0x26e7('0x19'),JSON[_0x26e7('0x1a')](_0x6e625f));if(_0x6e625f[_0x26e7('0x1b')]){if(_0x6e625f[_0x26e7('0x1b')][_0x26e7('0x1c')]===0x1f4){logger['error'](_0x26e7('0x16'),_0x11a77c,_0x6e625f[_0x26e7('0x1b')][_0x26e7('0x1d')]);return _0x7cf00b(_0x6e625f[_0x26e7('0x1b')]['message']);}logger[_0x26e7('0x1b')](_0x26e7('0x16'),_0x11a77c,_0x6e625f[_0x26e7('0x1b')][_0x26e7('0x1d')]);return _0x18d1f2(_0x6e625f[_0x26e7('0x1b')][_0x26e7('0x1d')]);}else{logger[_0x26e7('0x15')]('FaxQueue,\x20%s,\x20%s',_0x11a77c,_0x26e7('0x19'));_0x18d1f2(_0x6e625f[_0x26e7('0x1e')][_0x26e7('0x1d')]);}})[_0x26e7('0x1f')](function(_0x2c3ecc){logger[_0x26e7('0x1b')]('FaxQueue,\x20%s,\x20%s',_0x11a77c,_0x2c3ecc);_0x7cf00b(_0x2c3ecc);});});}exports[_0x26e7('0x20')]=function(_0xd2e256){var _0x23f4d4=this;return new Promise(function(_0x8816cf,_0x24a6a0){return db[_0x26e7('0x21')]['findAll']({'raw':_0xd2e256['options']?_0xd2e256[_0x26e7('0x22')][_0x26e7('0x23')]===undefined?!![]:![]:!![],'where':_0xd2e256[_0x26e7('0x22')]?_0xd2e256[_0x26e7('0x22')]['where']||null:null,'attributes':_0xd2e256[_0x26e7('0x22')]?_0xd2e256[_0x26e7('0x22')][_0x26e7('0x24')]||null:null,'limit':_0xd2e256[_0x26e7('0x22')]?_0xd2e256[_0x26e7('0x22')][_0x26e7('0x25')]||null:null,'include':_0xd2e256[_0x26e7('0x22')]?_0xd2e256['options']['include']?_[_0x26e7('0x26')](_0xd2e256['options']['include'],function(_0x1a90fa){return{'model':db[_0x1a90fa['model']],'as':_0x1a90fa['as'],'attributes':_0x1a90fa[_0x26e7('0x24')],'include':_0x1a90fa[_0x26e7('0x27')]?_[_0x26e7('0x26')](_0x1a90fa[_0x26e7('0x27')],function(_0x22a09b){return{'model':db[_0x22a09b[_0x26e7('0x28')]],'as':_0x22a09b['as'],'attributes':_0x22a09b[_0x26e7('0x24')],'include':_0x22a09b[_0x26e7('0x27')]?_[_0x26e7('0x26')](_0x22a09b[_0x26e7('0x27')],function(_0x173558){return{'model':db[_0x173558[_0x26e7('0x28')]],'as':_0x173558['as'],'attributes':_0x173558[_0x26e7('0x24')]};}):[]};}):[]};}):[]:[]})[_0x26e7('0x14')](function(_0x4e509b){logger[_0x26e7('0x15')](_0x26e7('0x20'),_0xd2e256);logger[_0x26e7('0x17')](_0x26e7('0x20'),_0xd2e256,JSON[_0x26e7('0x1a')](_0x4e509b));_0x8816cf(_0x4e509b);})[_0x26e7('0x1f')](function(_0x340bc8){logger[_0x26e7('0x1b')](_0x26e7('0x20'),_0x340bc8['message'],_0xd2e256);_0x24a6a0(_0x23f4d4[_0x26e7('0x1b')](0x1f4,_0x340bc8[_0x26e7('0x1d')]));});});};exports[_0x26e7('0x29')]=function(_0x289cb1){var _0x1c1dab=this;return new Promise(function(_0x3eb7b1,_0x3bd17a){return db[_0x26e7('0x21')][_0x26e7('0x2a')]({'raw':_0x289cb1[_0x26e7('0x22')]?_0x289cb1[_0x26e7('0x22')][_0x26e7('0x23')]===undefined?!![]:![]:!![],'where':_0x289cb1[_0x26e7('0x22')]?_0x289cb1[_0x26e7('0x22')][_0x26e7('0x2b')]||null:null,'attributes':_0x289cb1[_0x26e7('0x22')]?_0x289cb1[_0x26e7('0x22')]['attributes']||null:null,'include':_0x289cb1[_0x26e7('0x22')]?_0x289cb1[_0x26e7('0x22')]['include']?_[_0x26e7('0x26')](_0x289cb1[_0x26e7('0x22')][_0x26e7('0x27')],function(_0x380a1e){return{'model':db[_0x380a1e[_0x26e7('0x28')]],'as':_0x380a1e['as'],'attributes':_0x380a1e[_0x26e7('0x24')],'include':_0x380a1e[_0x26e7('0x27')]?_[_0x26e7('0x26')](_0x380a1e[_0x26e7('0x27')],function(_0x31d14f){return{'model':db[_0x31d14f['model']],'as':_0x31d14f['as'],'attributes':_0x31d14f[_0x26e7('0x24')],'include':_0x31d14f['include']?_[_0x26e7('0x26')](_0x31d14f[_0x26e7('0x27')],function(_0x1ee479){return{'model':db[_0x1ee479['model']],'as':_0x1ee479['as'],'attributes':_0x1ee479['attributes']};}):[]};}):[]};}):[]:[]})[_0x26e7('0x14')](function(_0x33892f){logger[_0x26e7('0x15')](_0x26e7('0x29'),_0x289cb1);logger['debug'](_0x26e7('0x29'),_0x289cb1,JSON['stringify'](_0x33892f));_0x3eb7b1(_0x33892f);})['catch'](function(_0x4f06b4){logger[_0x26e7('0x1b')](_0x26e7('0x29'),_0x4f06b4[_0x26e7('0x1d')],_0x289cb1);_0x3bd17a(_0x1c1dab['error'](0x1f4,_0x4f06b4['message']));});});}; \ No newline at end of file +var _0x69ed=['request\x20sent','stringify','error','code','message','result','catch','FaxQueue','findAll','options','raw','attributes','limit','include','map','model','GetFaxQueue','ShowFaxQueue','find','where','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','debug'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0x69ed,0xcd));var _0xd69e=function(_0x36388f,_0x16ee0f){_0x36388f=_0x36388f-0x0;var _0x3c9499=_0x69ed[_0x36388f];return _0x3c9499;};'use strict';var _=require(_0xd69e('0x0'));var util=require('util');var moment=require(_0xd69e('0x1'));var BPromise=require('bluebird');var rs=require(_0xd69e('0x2'));var fs=require('fs');var Redis=require(_0xd69e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd69e('0x4'))(_0xd69e('0x5'));var config=require(_0xd69e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd69e('0x7')]['http']({'port':0x232a});config[_0xd69e('0x8')]=_[_0xd69e('0x9')](config[_0xd69e('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xd69e('0xa'))(new Redis(config[_0xd69e('0x8')]));require(_0xd69e('0xb'))[_0xd69e('0xc')](socket);function respondWithRpcPromise(_0x1dd17c,_0x4936f4,_0x441665){return new BPromise(function(_0x56c5a9,_0x59e6c8){return client['request'](_0x1dd17c,_0x441665)[_0xd69e('0xd')](function(_0x21b391){logger[_0xd69e('0xe')](_0xd69e('0xf'),_0x4936f4,'request\x20sent');logger[_0xd69e('0x10')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x4936f4,_0xd69e('0x11'),JSON[_0xd69e('0x12')](_0x21b391));if(_0x21b391['error']){if(_0x21b391[_0xd69e('0x13')][_0xd69e('0x14')]===0x1f4){logger[_0xd69e('0x13')]('FaxQueue,\x20%s,\x20%s',_0x4936f4,_0x21b391[_0xd69e('0x13')][_0xd69e('0x15')]);return _0x59e6c8(_0x21b391[_0xd69e('0x13')][_0xd69e('0x15')]);}logger[_0xd69e('0x13')](_0xd69e('0xf'),_0x4936f4,_0x21b391[_0xd69e('0x13')]['message']);return _0x56c5a9(_0x21b391['error'][_0xd69e('0x15')]);}else{logger[_0xd69e('0xe')](_0xd69e('0xf'),_0x4936f4,_0xd69e('0x11'));_0x56c5a9(_0x21b391[_0xd69e('0x16')][_0xd69e('0x15')]);}})[_0xd69e('0x17')](function(_0x5d9b03){logger[_0xd69e('0x13')](_0xd69e('0xf'),_0x4936f4,_0x5d9b03);_0x59e6c8(_0x5d9b03);});});}exports['GetFaxQueue']=function(_0x2da00a){var _0x5d2cac=this;return new Promise(function(_0x12ed59,_0x222743){return db[_0xd69e('0x18')][_0xd69e('0x19')]({'raw':_0x2da00a['options']?_0x2da00a[_0xd69e('0x1a')][_0xd69e('0x1b')]===undefined?!![]:![]:!![],'where':_0x2da00a[_0xd69e('0x1a')]?_0x2da00a[_0xd69e('0x1a')]['where']||null:null,'attributes':_0x2da00a[_0xd69e('0x1a')]?_0x2da00a[_0xd69e('0x1a')][_0xd69e('0x1c')]||null:null,'limit':_0x2da00a[_0xd69e('0x1a')]?_0x2da00a[_0xd69e('0x1a')][_0xd69e('0x1d')]||null:null,'include':_0x2da00a['options']?_0x2da00a[_0xd69e('0x1a')][_0xd69e('0x1e')]?_[_0xd69e('0x1f')](_0x2da00a[_0xd69e('0x1a')][_0xd69e('0x1e')],function(_0x1eba95){return{'model':db[_0x1eba95[_0xd69e('0x20')]],'as':_0x1eba95['as'],'attributes':_0x1eba95[_0xd69e('0x1c')],'include':_0x1eba95[_0xd69e('0x1e')]?_[_0xd69e('0x1f')](_0x1eba95[_0xd69e('0x1e')],function(_0x51cc3e){return{'model':db[_0x51cc3e[_0xd69e('0x20')]],'as':_0x51cc3e['as'],'attributes':_0x51cc3e[_0xd69e('0x1c')],'include':_0x51cc3e[_0xd69e('0x1e')]?_[_0xd69e('0x1f')](_0x51cc3e['include'],function(_0x37e6ba){return{'model':db[_0x37e6ba[_0xd69e('0x20')]],'as':_0x37e6ba['as'],'attributes':_0x37e6ba['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x19c9cd){logger['info']('GetFaxQueue',_0x2da00a);logger[_0xd69e('0x10')](_0xd69e('0x21'),_0x2da00a,JSON[_0xd69e('0x12')](_0x19c9cd));_0x12ed59(_0x19c9cd);})[_0xd69e('0x17')](function(_0xbcc3bc){logger[_0xd69e('0x13')](_0xd69e('0x21'),_0xbcc3bc[_0xd69e('0x15')],_0x2da00a);_0x222743(_0x5d2cac[_0xd69e('0x13')](0x1f4,_0xbcc3bc[_0xd69e('0x15')]));});});};exports[_0xd69e('0x22')]=function(_0x5c8d09){var _0x37eddf=this;return new Promise(function(_0xd72269,_0x126c38){return db[_0xd69e('0x18')][_0xd69e('0x23')]({'raw':_0x5c8d09[_0xd69e('0x1a')]?_0x5c8d09[_0xd69e('0x1a')][_0xd69e('0x1b')]===undefined?!![]:![]:!![],'where':_0x5c8d09[_0xd69e('0x1a')]?_0x5c8d09[_0xd69e('0x1a')][_0xd69e('0x24')]||null:null,'attributes':_0x5c8d09[_0xd69e('0x1a')]?_0x5c8d09['options']['attributes']||null:null,'include':_0x5c8d09['options']?_0x5c8d09[_0xd69e('0x1a')][_0xd69e('0x1e')]?_[_0xd69e('0x1f')](_0x5c8d09[_0xd69e('0x1a')][_0xd69e('0x1e')],function(_0x36443a){return{'model':db[_0x36443a[_0xd69e('0x20')]],'as':_0x36443a['as'],'attributes':_0x36443a['attributes'],'include':_0x36443a['include']?_[_0xd69e('0x1f')](_0x36443a[_0xd69e('0x1e')],function(_0x1c341f){return{'model':db[_0x1c341f[_0xd69e('0x20')]],'as':_0x1c341f['as'],'attributes':_0x1c341f[_0xd69e('0x1c')],'include':_0x1c341f[_0xd69e('0x1e')]?_[_0xd69e('0x1f')](_0x1c341f[_0xd69e('0x1e')],function(_0x1ebe89){return{'model':db[_0x1ebe89['model']],'as':_0x1ebe89['as'],'attributes':_0x1ebe89['attributes']};}):[]};}):[]};}):[]:[]})[_0xd69e('0xd')](function(_0x32eb16){logger[_0xd69e('0xe')]('ShowFaxQueue',_0x5c8d09);logger[_0xd69e('0x10')](_0xd69e('0x22'),_0x5c8d09,JSON[_0xd69e('0x12')](_0x32eb16));_0xd72269(_0x32eb16);})[_0xd69e('0x17')](function(_0x27d002){logger['error'](_0xd69e('0x22'),_0x27d002[_0xd69e('0x15')],_0x5c8d09);_0x126c38(_0x37eddf['error'](0x1f4,_0x27d002[_0xd69e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 7b7d5e8..30054ff 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 _0x07bd=['register','length','./faxQueue.events','save','emit','removeListener'];(function(_0x570cdc,_0xc45524){var _0xbde795=function(_0x527f68){while(--_0x527f68){_0x570cdc['push'](_0x570cdc['shift']());}};_0xbde795(++_0xc45524);}(_0x07bd,0x13a));var _0xd07b=function(_0x3c015d,_0x452a75){_0x3c015d=_0x3c015d-0x0;var _0x533fde=_0x07bd[_0x3c015d];return _0x533fde;};'use strict';var FaxQueueEvents=require(_0xd07b('0x0'));var events=[_0xd07b('0x1'),'remove','update'];function createListener(_0x144e67,_0x2be6f5){return function(_0x296c25){_0x2be6f5[_0xd07b('0x2')](_0x144e67,_0x296c25);};}function removeListener(_0x2dcb3d,_0x16450b){return function(){FaxQueueEvents[_0xd07b('0x3')](_0x2dcb3d,_0x16450b);};}exports[_0xd07b('0x4')]=function(_0x439e2c){for(var _0x328944=0x0,_0xe38b=events[_0xd07b('0x5')];_0x328944<_0xe38b;_0x328944++){var _0x527090=events[_0x328944];var _0x367f40=createListener('faxQueue:'+_0x527090,_0x439e2c);FaxQueueEvents['on'](_0x527090,_0x367f40);}}; \ No newline at end of file +var _0xf596=['emit','register','length','faxQueue:','./faxQueue.events','remove','update'];(function(_0x40f161,_0x34361d){var _0x331015=function(_0x1e1372){while(--_0x1e1372){_0x40f161['push'](_0x40f161['shift']());}};_0x331015(++_0x34361d);}(_0xf596,0x66));var _0x6f59=function(_0x54dea5,_0x12f394){_0x54dea5=_0x54dea5-0x0;var _0x26a692=_0xf596[_0x54dea5];return _0x26a692;};'use strict';var FaxQueueEvents=require(_0x6f59('0x0'));var events=['save',_0x6f59('0x1'),_0x6f59('0x2')];function createListener(_0x122b9a,_0x2a2afc){return function(_0x4aeec0){_0x2a2afc[_0x6f59('0x3')](_0x122b9a,_0x4aeec0);};}function removeListener(_0x1a0725,_0x7364ed){return function(){FaxQueueEvents['removeListener'](_0x1a0725,_0x7364ed);};}exports[_0x6f59('0x4')]=function(_0x3ac024){for(var _0x1e1e79=0x0,_0x58b943=events[_0x6f59('0x5')];_0x1e1e79<_0x58b943;_0x1e1e79++){var _0x35972a=events[_0x1e1e79];var _0x34ddcb=createListener(_0x6f59('0x6')+_0x35972a,_0x3ac024);FaxQueueEvents['on'](_0x35972a,_0x34ddcb);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index f38730e..fbb21c4 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 _0xb145=['addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getAgents','post','create','addTeams','/:id/users'];(function(_0x2ef9ea,_0x228864){var _0x50b52d=function(_0x23adb3){while(--_0x23adb3){_0x2ef9ea['push'](_0x2ef9ea['shift']());}};_0x50b52d(++_0x228864);}(_0xb145,0xa3));var _0x5b14=function(_0x54266b,_0xc5b28){_0x54266b=_0x54266b-0x0;var _0x41badc=_0xb145[_0x54266b];return _0x41badc;};'use strict';var multer=require('multer');var util=require(_0x5b14('0x0'));var path=require(_0x5b14('0x1'));var timeout=require(_0x5b14('0x2'));var express=require(_0x5b14('0x3'));var router=express[_0x5b14('0x4')]();var fs_extra=require(_0x5b14('0x5'));var auth=require(_0x5b14('0x6'));var interaction=require(_0x5b14('0x7'));var config=require('../../config/environment');var controller=require(_0x5b14('0x8'));router[_0x5b14('0x9')]('/',auth[_0x5b14('0xa')](),controller[_0x5b14('0xb')]);router['get'](_0x5b14('0xc'),auth[_0x5b14('0xa')](),controller[_0x5b14('0xd')]);router[_0x5b14('0x9')](_0x5b14('0xe'),auth['isAuthenticated'](),controller[_0x5b14('0xf')]);router[_0x5b14('0x9')]('/:id/members',auth[_0x5b14('0xa')](),controller[_0x5b14('0x10')]);router[_0x5b14('0x9')](_0x5b14('0x11'),auth[_0x5b14('0xa')](),controller['getTeams']);router[_0x5b14('0x9')]('/:id/users',auth[_0x5b14('0xa')](),controller[_0x5b14('0x12')]);router[_0x5b14('0x13')]('/',auth[_0x5b14('0xa')](),controller[_0x5b14('0x14')]);router[_0x5b14('0x13')]('/:id/teams',auth[_0x5b14('0xa')](),controller[_0x5b14('0x15')]);router[_0x5b14('0x13')](_0x5b14('0x16'),auth[_0x5b14('0xa')](),controller[_0x5b14('0x17')]);router[_0x5b14('0x18')](_0x5b14('0xe'),auth[_0x5b14('0xa')](),controller[_0x5b14('0x19')]);router[_0x5b14('0x1a')](_0x5b14('0xe'),auth['isAuthenticated'](),controller[_0x5b14('0x1b')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0x5b14('0x1c')]);router[_0x5b14('0x1a')](_0x5b14('0x16'),auth[_0x5b14('0xa')](),controller[_0x5b14('0x1d')]);module[_0x5b14('0x1e')]=router; \ No newline at end of file +var _0x01d9=['post','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create'];(function(_0x29a8dc,_0x232a94){var _0x47526a=function(_0x41fbbe){while(--_0x41fbbe){_0x29a8dc['push'](_0x29a8dc['shift']());}};_0x47526a(++_0x232a94);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var path=require(_0x901d('0x2'));var timeout=require(_0x901d('0x3'));var express=require('express');var router=express[_0x901d('0x4')]();var fs_extra=require(_0x901d('0x5'));var auth=require(_0x901d('0x6'));var interaction=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var controller=require(_0x901d('0x9'));router[_0x901d('0xa')]('/',auth['isAuthenticated'](),controller[_0x901d('0xb')]);router[_0x901d('0xa')](_0x901d('0xc'),auth[_0x901d('0xd')](),controller[_0x901d('0xe')]);router[_0x901d('0xa')](_0x901d('0xf'),auth[_0x901d('0xd')](),controller[_0x901d('0x10')]);router[_0x901d('0xa')](_0x901d('0x11'),auth[_0x901d('0xd')](),controller[_0x901d('0x12')]);router['get'](_0x901d('0x13'),auth['isAuthenticated'](),controller[_0x901d('0x14')]);router[_0x901d('0xa')](_0x901d('0x15'),auth[_0x901d('0xd')](),controller[_0x901d('0x16')]);router['post']('/',auth[_0x901d('0xd')](),controller[_0x901d('0x17')]);router[_0x901d('0x18')](_0x901d('0x13'),auth[_0x901d('0xd')](),controller[_0x901d('0x19')]);router['post'](_0x901d('0x15'),auth[_0x901d('0xd')](),controller[_0x901d('0x1a')]);router[_0x901d('0x1b')](_0x901d('0xf'),auth[_0x901d('0xd')](),controller[_0x901d('0x1c')]);router[_0x901d('0x1d')](_0x901d('0xf'),auth[_0x901d('0xd')](),controller[_0x901d('0x1e')]);router[_0x901d('0x1d')](_0x901d('0x13'),auth[_0x901d('0xd')](),controller[_0x901d('0x1f')]);router[_0x901d('0x1d')](_0x901d('0x15'),auth[_0x901d('0xd')](),controller['removeAgents']);module[_0x901d('0x20')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 70c38a3..07832f9 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 _0x8e81=['sequelize','exports','STRING','DATE','moment'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x8e81,0x1d0));var _0x18e8=function(_0x30ac80,_0x353710){_0x30ac80=_0x30ac80-0x0;var _0x454603=_0x8e81[_0x30ac80];return _0x454603;};'use strict';var moment=require(_0x18e8('0x0'));var Sequelize=require(_0x18e8('0x1'));module[_0x18e8('0x2')]={'uniqueid':{'type':Sequelize[_0x18e8('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x18e8('0x3')]},'joinAt':{'type':Sequelize[_0x18e8('0x4')]},'leaveAt':{'type':Sequelize[_0x18e8('0x4')]},'acceptAt':{'type':Sequelize[_0x18e8('0x4')]},'exitAt':{'type':Sequelize[_0x18e8('0x4')]},'reason':{'type':Sequelize[_0x18e8('0x3')]}}; \ No newline at end of file +var _0x6865=['exports','STRING','DATE','sequelize'];(function(_0x4429bf,_0x447621){var _0x2743da=function(_0x5b2f1a){while(--_0x5b2f1a){_0x4429bf['push'](_0x4429bf['shift']());}};_0x2743da(++_0x447621);}(_0x6865,0x17f));var _0x5686=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6865[_0x20a584];return _0x4b41a8;};'use strict';var moment=require('moment');var Sequelize=require(_0x5686('0x0'));module[_0x5686('0x1')]={'uniqueid':{'type':Sequelize[_0x5686('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5686('0x3')]},'acceptAt':{'type':Sequelize[_0x5686('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x5686('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 5dca5fe..9f8a374 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 _0xca66=['lodash','squel','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','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','name','send','FaxQueueReport','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','merge','includeAll','include','rows','catch','params','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra'];(function(_0x172090,_0x290c69){var _0x2321bd=function(_0x44f5dc){while(--_0x44f5dc){_0x172090['push'](_0x172090['shift']());}};_0x2321bd(++_0x290c69);}(_0xca66,0x8b));var _0x6ca6=function(_0x4e124b,_0x3cce00){_0x4e124b=_0x4e124b-0x0;var _0x9023fc=_0xca66[_0x4e124b];return _0x9023fc;};'use strict';var emlformat=require(_0x6ca6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6ca6('0x1'));var rp=require(_0x6ca6('0x2'));var moment=require(_0x6ca6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6ca6('0x4'));var util=require('util');var path=require(_0x6ca6('0x5'));var sox=require('sox');var csv=require(_0x6ca6('0x6'));var ejs=require(_0x6ca6('0x7'));var fs=require('fs');var fs_extra=require(_0x6ca6('0x8'));var _=require(_0x6ca6('0x9'));var squel=require(_0x6ca6('0xa'));var crypto=require(_0x6ca6('0xb'));var jsforce=require(_0x6ca6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6ca6('0x6'));var querystring=require(_0x6ca6('0xd'));var Papa=require(_0x6ca6('0xe'));var Redis=require(_0x6ca6('0xf'));var authService=require(_0x6ca6('0x10'));var qs=require(_0x6ca6('0x11'));var as=require(_0x6ca6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ca6('0x13'))(_0x6ca6('0x14'));var utils=require(_0x6ca6('0x15'));var config=require(_0x6ca6('0x16'));var licenseUtil=require(_0x6ca6('0x17'));var db=require(_0x6ca6('0x18'))['db'];function respondWithStatusCode(_0x4c05e9,_0x152e63){_0x152e63=_0x152e63||0xcc;return function(_0x38de67){if(_0x38de67){return _0x4c05e9['sendStatus'](_0x152e63);}return _0x4c05e9[_0x6ca6('0x19')](_0x152e63)[_0x6ca6('0x1a')]();};}function respondWithResult(_0x3f417f,_0x3570f1){_0x3570f1=_0x3570f1||0xc8;return function(_0xc774c){if(_0xc774c){return _0x3f417f[_0x6ca6('0x19')](_0x3570f1)['json'](_0xc774c);}};}function respondWithFilteredResult(_0x52c59a,_0x5785b1){return function(_0x36ff3e){if(_0x36ff3e){var _0x19e94f=typeof _0x5785b1[_0x6ca6('0x1b')]===_0x6ca6('0x1c')&&typeof _0x5785b1[_0x6ca6('0x1d')]===_0x6ca6('0x1c');var _0x25dc6c=_0x36ff3e['count'];var _0x2391ce=_0x19e94f?0x0:_0x5785b1[_0x6ca6('0x1b')];var _0xc97f0=_0x19e94f?_0x36ff3e[_0x6ca6('0x1e')]:_0x5785b1[_0x6ca6('0x1b')]+_0x5785b1[_0x6ca6('0x1d')];var _0x16a3d7;if(_0xc97f0>=_0x25dc6c){_0xc97f0=_0x25dc6c;_0x16a3d7=0xc8;}else{_0x16a3d7=0xce;}_0x52c59a[_0x6ca6('0x19')](_0x16a3d7);return _0x52c59a[_0x6ca6('0x1f')](_0x6ca6('0x20'),_0x2391ce+'-'+_0xc97f0+'/'+_0x25dc6c)[_0x6ca6('0x21')](_0x36ff3e);}return null;};}function patchUpdates(_0x4c3be9){return function(_0x28a982){try{jsonpatch[_0x6ca6('0x22')](_0x28a982,_0x4c3be9,!![]);}catch(_0x38cad4){return BPromise[_0x6ca6('0x23')](_0x38cad4);}return _0x28a982[_0x6ca6('0x24')]();};}function saveUpdates(_0x438694,_0x593f15){return function(_0xfb962d){if(_0xfb962d){return _0xfb962d[_0x6ca6('0x25')](_0x438694)['then'](function(_0x4927c1){return _0x4927c1;});}return null;};}function removeEntity(_0xfbf496,_0x216701){return function(_0xfe0760){if(_0xfe0760){return _0xfe0760[_0x6ca6('0x26')]()[_0x6ca6('0x27')](function(){_0xfbf496['status'](0xcc)[_0x6ca6('0x1a')]();});}};}function handleEntityNotFound(_0x1d6caa,_0x1c43ee){return function(_0x2d8c64){if(!_0x2d8c64){_0x1d6caa[_0x6ca6('0x28')](0x194);}return _0x2d8c64;};}function handleError(_0x29f37e,_0x3c32ae){_0x3c32ae=_0x3c32ae||0x1f4;return function(_0x2a1e2d){logger['error'](_0x2a1e2d['stack']);if(_0x2a1e2d[_0x6ca6('0x29')]){delete _0x2a1e2d[_0x6ca6('0x29')];}_0x29f37e[_0x6ca6('0x19')](_0x3c32ae)[_0x6ca6('0x2a')](_0x2a1e2d);};}exports['index']=function(_0x5ea6f7,_0x306583){var _0x47cf48={},_0x4ab84c={},_0x141e78={'count':0x0,'rows':[]};var _0xefd407=_['map'](db[_0x6ca6('0x2b')][_0x6ca6('0x2c')],function(_0xac50e8){return{'name':_0xac50e8[_0x6ca6('0x2d')],'type':_0xac50e8['type'][_0x6ca6('0x2e')]};});_0x4ab84c[_0x6ca6('0x2f')]=_[_0x6ca6('0x30')](_0xefd407,_0x6ca6('0x29'));_0x4ab84c['query']=_[_0x6ca6('0x31')](_0x5ea6f7[_0x6ca6('0x32')]);_0x4ab84c[_0x6ca6('0x33')]=_[_0x6ca6('0x34')](_0x4ab84c['model'],_0x4ab84c['query']);_0x47cf48['attributes']=_['intersection'](_0x4ab84c['model'],qs[_0x6ca6('0x35')](_0x5ea6f7[_0x6ca6('0x32')][_0x6ca6('0x35')]));_0x47cf48['attributes']=_0x47cf48[_0x6ca6('0x36')][_0x6ca6('0x37')]?_0x47cf48[_0x6ca6('0x36')]:_0x4ab84c[_0x6ca6('0x2f')];if(!_0x5ea6f7['query'][_0x6ca6('0x38')](_0x6ca6('0x39'))){_0x47cf48[_0x6ca6('0x1d')]=qs[_0x6ca6('0x1d')](_0x5ea6f7['query'][_0x6ca6('0x1d')]);_0x47cf48['offset']=qs[_0x6ca6('0x1b')](_0x5ea6f7['query']['offset']);}_0x47cf48[_0x6ca6('0x3a')]=qs[_0x6ca6('0x3b')](_0x5ea6f7[_0x6ca6('0x32')][_0x6ca6('0x3b')]);_0x47cf48['where']=qs['filters'](_[_0x6ca6('0x3c')](_0x5ea6f7[_0x6ca6('0x32')],_0x4ab84c['filters']),_0xefd407);if(_0x5ea6f7[_0x6ca6('0x32')]['filter']){_0x47cf48[_0x6ca6('0x3d')]=_['merge'](_0x47cf48[_0x6ca6('0x3d')],{'$or':_[_0x6ca6('0x30')](_0xefd407,function(_0x254733){if(_0x254733[_0x6ca6('0x3e')]!==_0x6ca6('0x3f')){var _0x3ca258={};_0x3ca258[_0x254733[_0x6ca6('0x29')]]={'$like':'%'+_0x5ea6f7[_0x6ca6('0x32')]['filter']+'%'};return _0x3ca258;}})});}_0x47cf48=_[_0x6ca6('0x40')]({},_0x47cf48,_0x5ea6f7['options']);var _0x57186c={'where':_0x47cf48[_0x6ca6('0x3d')]};return db[_0x6ca6('0x2b')]['count'](_0x57186c)[_0x6ca6('0x27')](function(_0x500ed4){_0x141e78[_0x6ca6('0x1e')]=_0x500ed4;if(_0x5ea6f7[_0x6ca6('0x32')][_0x6ca6('0x41')]){_0x47cf48[_0x6ca6('0x42')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x47cf48);})[_0x6ca6('0x27')](function(_0x3813d6){_0x141e78[_0x6ca6('0x43')]=_0x3813d6;return _0x141e78;})[_0x6ca6('0x27')](respondWithFilteredResult(_0x306583,_0x47cf48))[_0x6ca6('0x44')](handleError(_0x306583,null));};exports['show']=function(_0x76db8d,_0x2ffdfc){var _0x5bed6e={'raw':!![],'where':{'id':_0x76db8d[_0x6ca6('0x45')]['id']}},_0x317b5e={};_0x317b5e[_0x6ca6('0x2f')]=_[_0x6ca6('0x31')](db[_0x6ca6('0x2b')][_0x6ca6('0x2c')]);_0x317b5e[_0x6ca6('0x32')]=_[_0x6ca6('0x31')](_0x76db8d[_0x6ca6('0x32')]);_0x317b5e['filters']=_[_0x6ca6('0x34')](_0x317b5e[_0x6ca6('0x2f')],_0x317b5e[_0x6ca6('0x32')]);_0x5bed6e[_0x6ca6('0x36')]=_[_0x6ca6('0x34')](_0x317b5e[_0x6ca6('0x2f')],qs[_0x6ca6('0x35')](_0x76db8d[_0x6ca6('0x32')]['fields']));_0x5bed6e['attributes']=_0x5bed6e[_0x6ca6('0x36')][_0x6ca6('0x37')]?_0x5bed6e[_0x6ca6('0x36')]:_0x317b5e[_0x6ca6('0x2f')];if(_0x76db8d[_0x6ca6('0x32')][_0x6ca6('0x41')]){_0x5bed6e[_0x6ca6('0x42')]=[{'all':!![]}];}_0x5bed6e=_['merge']({},_0x5bed6e,_0x76db8d['options']);return db[_0x6ca6('0x2b')][_0x6ca6('0x46')](_0x5bed6e)['then'](handleEntityNotFound(_0x2ffdfc,null))[_0x6ca6('0x27')](respondWithResult(_0x2ffdfc,null))[_0x6ca6('0x44')](handleError(_0x2ffdfc,null));};exports[_0x6ca6('0x47')]=function(_0x34a388,_0xc1928f){return db[_0x6ca6('0x2b')][_0x6ca6('0x47')](_0x34a388['body'],{})[_0x6ca6('0x27')](respondWithResult(_0xc1928f,0xc9))[_0x6ca6('0x44')](handleError(_0xc1928f,null));};exports[_0x6ca6('0x25')]=function(_0x4fde51,_0x408df3){if(_0x4fde51['body']['id']){delete _0x4fde51[_0x6ca6('0x48')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x4fde51['params']['id']}})[_0x6ca6('0x27')](handleEntityNotFound(_0x408df3,null))[_0x6ca6('0x27')](saveUpdates(_0x4fde51[_0x6ca6('0x48')],null))['then'](respondWithResult(_0x408df3,null))[_0x6ca6('0x44')](handleError(_0x408df3,null));};exports['destroy']=function(_0x1f552d,_0x1010a6){return db[_0x6ca6('0x2b')][_0x6ca6('0x46')]({'where':{'id':_0x1f552d[_0x6ca6('0x45')]['id']}})[_0x6ca6('0x27')](handleEntityNotFound(_0x1010a6,null))[_0x6ca6('0x27')](removeEntity(_0x1010a6,null))[_0x6ca6('0x44')](handleError(_0x1010a6,null));};exports[_0x6ca6('0x49')]=function(_0x2e4cc5,_0x321f41){return db['FaxQueueReport'][_0x6ca6('0x49')]()[_0x6ca6('0x27')](respondWithResult(_0x321f41,null))[_0x6ca6('0x44')](handleError(_0x321f41,null));}; \ No newline at end of file +var _0x180f=['rows','params','include','find','catch','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','save','update','then','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','merge','VIRTUAL','filter','options','includeAll'];(function(_0x256f12,_0x26bdef){var _0xc04d5e=function(_0x360318){while(--_0x360318){_0x256f12['push'](_0x256f12['shift']());}};_0xc04d5e(++_0x26bdef);}(_0x180f,0xf3));var _0xf180=function(_0x1f239e,_0x367b43){_0x1f239e=_0x1f239e-0x0;var _0x826971=_0x180f[_0x1f239e];return _0x826971;};'use strict';var emlformat=require(_0xf180('0x0'));var rimraf=require(_0xf180('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf180('0x2'));var rp=require(_0xf180('0x3'));var moment=require('moment');var BPromise=require(_0xf180('0x4'));var Mustache=require(_0xf180('0x5'));var util=require(_0xf180('0x6'));var path=require(_0xf180('0x7'));var sox=require(_0xf180('0x8'));var csv=require('to-csv');var ejs=require(_0xf180('0x9'));var fs=require('fs');var fs_extra=require(_0xf180('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf180('0xb'));var jsforce=require(_0xf180('0xc'));var deskjs=require(_0xf180('0xd'));var toCsv=require(_0xf180('0xe'));var querystring=require(_0xf180('0xf'));var Papa=require(_0xf180('0x10'));var Redis=require(_0xf180('0x11'));var authService=require(_0xf180('0x12'));var qs=require(_0xf180('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf180('0x14'));var logger=require(_0xf180('0x15'))(_0xf180('0x16'));var utils=require(_0xf180('0x17'));var config=require(_0xf180('0x18'));var licenseUtil=require(_0xf180('0x19'));var db=require(_0xf180('0x1a'))['db'];function respondWithStatusCode(_0x2122a0,_0x171513){_0x171513=_0x171513||0xcc;return function(_0x22a1f8){if(_0x22a1f8){return _0x2122a0[_0xf180('0x1b')](_0x171513);}return _0x2122a0['status'](_0x171513)[_0xf180('0x1c')]();};}function respondWithResult(_0x22d179,_0x1eb0a2){_0x1eb0a2=_0x1eb0a2||0xc8;return function(_0x355b07){if(_0x355b07){return _0x22d179['status'](_0x1eb0a2)[_0xf180('0x1d')](_0x355b07);}};}function respondWithFilteredResult(_0x3d3f48,_0x1dbdcf){return function(_0x4ee79b){if(_0x4ee79b){var _0x105c6a=typeof _0x1dbdcf[_0xf180('0x1e')]==='undefined'&&typeof _0x1dbdcf[_0xf180('0x1f')]===_0xf180('0x20');var _0x492c22=_0x4ee79b[_0xf180('0x21')];var _0x14ddc6=_0x105c6a?0x0:_0x1dbdcf[_0xf180('0x1e')];var _0xf7ab26=_0x105c6a?_0x4ee79b[_0xf180('0x21')]:_0x1dbdcf[_0xf180('0x1e')]+_0x1dbdcf[_0xf180('0x1f')];var _0x43f1f4;if(_0xf7ab26>=_0x492c22){_0xf7ab26=_0x492c22;_0x43f1f4=0xc8;}else{_0x43f1f4=0xce;}_0x3d3f48[_0xf180('0x22')](_0x43f1f4);return _0x3d3f48[_0xf180('0x23')](_0xf180('0x24'),_0x14ddc6+'-'+_0xf7ab26+'/'+_0x492c22)[_0xf180('0x1d')](_0x4ee79b);}return null;};}function patchUpdates(_0x180c0a){return function(_0x5c8e98){try{jsonpatch[_0xf180('0x25')](_0x5c8e98,_0x180c0a,!![]);}catch(_0x185cc6){return BPromise['reject'](_0x185cc6);}return _0x5c8e98[_0xf180('0x26')]();};}function saveUpdates(_0x538bac,_0x36aeee){return function(_0x4c54b6){if(_0x4c54b6){return _0x4c54b6[_0xf180('0x27')](_0x538bac)[_0xf180('0x28')](function(_0x5d5ead){return _0x5d5ead;});}return null;};}function removeEntity(_0x48925e,_0x1b28d6){return function(_0x932e29){if(_0x932e29){return _0x932e29['destroy']()[_0xf180('0x28')](function(){_0x48925e[_0xf180('0x22')](0xcc)[_0xf180('0x1c')]();});}};}function handleEntityNotFound(_0x1242d3,_0x12aaad){return function(_0x2ca8f9){if(!_0x2ca8f9){_0x1242d3[_0xf180('0x1b')](0x194);}return _0x2ca8f9;};}function handleError(_0x806b84,_0x3d20bc){_0x3d20bc=_0x3d20bc||0x1f4;return function(_0x34d380){logger['error'](_0x34d380[_0xf180('0x29')]);if(_0x34d380[_0xf180('0x2a')]){delete _0x34d380[_0xf180('0x2a')];}_0x806b84[_0xf180('0x22')](_0x3d20bc)[_0xf180('0x2b')](_0x34d380);};}exports[_0xf180('0x2c')]=function(_0xe1db31,_0x2c875f){var _0x2ac6d2={},_0x3bb197={},_0x564ce1={'count':0x0,'rows':[]};var _0x323482=_[_0xf180('0x2d')](db[_0xf180('0x2e')][_0xf180('0x2f')],function(_0x466895){return{'name':_0x466895[_0xf180('0x30')],'type':_0x466895[_0xf180('0x31')][_0xf180('0x32')]};});_0x3bb197[_0xf180('0x33')]=_[_0xf180('0x2d')](_0x323482,_0xf180('0x2a'));_0x3bb197[_0xf180('0x34')]=_[_0xf180('0x35')](_0xe1db31[_0xf180('0x34')]);_0x3bb197['filters']=_[_0xf180('0x36')](_0x3bb197[_0xf180('0x33')],_0x3bb197['query']);_0x2ac6d2[_0xf180('0x37')]=_['intersection'](_0x3bb197[_0xf180('0x33')],qs[_0xf180('0x38')](_0xe1db31[_0xf180('0x34')]['fields']));_0x2ac6d2[_0xf180('0x37')]=_0x2ac6d2[_0xf180('0x37')][_0xf180('0x39')]?_0x2ac6d2[_0xf180('0x37')]:_0x3bb197['model'];if(!_0xe1db31[_0xf180('0x34')][_0xf180('0x3a')](_0xf180('0x3b'))){_0x2ac6d2[_0xf180('0x1f')]=qs[_0xf180('0x1f')](_0xe1db31[_0xf180('0x34')][_0xf180('0x1f')]);_0x2ac6d2[_0xf180('0x1e')]=qs[_0xf180('0x1e')](_0xe1db31[_0xf180('0x34')]['offset']);}_0x2ac6d2[_0xf180('0x3c')]=qs['sort'](_0xe1db31['query'][_0xf180('0x3d')]);_0x2ac6d2['where']=qs['filters'](_[_0xf180('0x3e')](_0xe1db31[_0xf180('0x34')],_0x3bb197[_0xf180('0x3f')]),_0x323482);if(_0xe1db31[_0xf180('0x34')]['filter']){_0x2ac6d2['where']=_[_0xf180('0x40')](_0x2ac6d2['where'],{'$or':_[_0xf180('0x2d')](_0x323482,function(_0x5bc4be){if(_0x5bc4be[_0xf180('0x31')]!==_0xf180('0x41')){var _0x13de1b={};_0x13de1b[_0x5bc4be[_0xf180('0x2a')]]={'$like':'%'+_0xe1db31[_0xf180('0x34')][_0xf180('0x42')]+'%'};return _0x13de1b;}})});}_0x2ac6d2=_[_0xf180('0x40')]({},_0x2ac6d2,_0xe1db31[_0xf180('0x43')]);var _0x40d5f9={'where':_0x2ac6d2['where']};return db[_0xf180('0x2e')][_0xf180('0x21')](_0x40d5f9)['then'](function(_0x2cd770){_0x564ce1[_0xf180('0x21')]=_0x2cd770;if(_0xe1db31[_0xf180('0x34')][_0xf180('0x44')]){_0x2ac6d2['include']=[{'all':!![]}];}return db[_0xf180('0x2e')]['findAll'](_0x2ac6d2);})[_0xf180('0x28')](function(_0xaa961){_0x564ce1[_0xf180('0x45')]=_0xaa961;return _0x564ce1;})[_0xf180('0x28')](respondWithFilteredResult(_0x2c875f,_0x2ac6d2))['catch'](handleError(_0x2c875f,null));};exports['show']=function(_0x2e85dd,_0x19f297){var _0xafbff7={'raw':!![],'where':{'id':_0x2e85dd[_0xf180('0x46')]['id']}},_0x3083ba={};_0x3083ba[_0xf180('0x33')]=_[_0xf180('0x35')](db[_0xf180('0x2e')][_0xf180('0x2f')]);_0x3083ba[_0xf180('0x34')]=_['keys'](_0x2e85dd[_0xf180('0x34')]);_0x3083ba['filters']=_[_0xf180('0x36')](_0x3083ba[_0xf180('0x33')],_0x3083ba[_0xf180('0x34')]);_0xafbff7['attributes']=_[_0xf180('0x36')](_0x3083ba[_0xf180('0x33')],qs['fields'](_0x2e85dd[_0xf180('0x34')][_0xf180('0x38')]));_0xafbff7[_0xf180('0x37')]=_0xafbff7[_0xf180('0x37')][_0xf180('0x39')]?_0xafbff7[_0xf180('0x37')]:_0x3083ba[_0xf180('0x33')];if(_0x2e85dd[_0xf180('0x34')][_0xf180('0x44')]){_0xafbff7[_0xf180('0x47')]=[{'all':!![]}];}_0xafbff7=_[_0xf180('0x40')]({},_0xafbff7,_0x2e85dd[_0xf180('0x43')]);return db[_0xf180('0x2e')][_0xf180('0x48')](_0xafbff7)[_0xf180('0x28')](handleEntityNotFound(_0x19f297,null))[_0xf180('0x28')](respondWithResult(_0x19f297,null))[_0xf180('0x49')](handleError(_0x19f297,null));};exports[_0xf180('0x4a')]=function(_0x41b90e,_0x43c26c){return db['FaxQueueReport']['create'](_0x41b90e[_0xf180('0x4b')],{})[_0xf180('0x28')](respondWithResult(_0x43c26c,0xc9))[_0xf180('0x49')](handleError(_0x43c26c,null));};exports[_0xf180('0x27')]=function(_0x1915b4,_0x30e469){if(_0x1915b4[_0xf180('0x4b')]['id']){delete _0x1915b4[_0xf180('0x4b')]['id'];}return db[_0xf180('0x2e')][_0xf180('0x48')]({'where':{'id':_0x1915b4[_0xf180('0x46')]['id']}})[_0xf180('0x28')](handleEntityNotFound(_0x30e469,null))[_0xf180('0x28')](saveUpdates(_0x1915b4[_0xf180('0x4b')],null))[_0xf180('0x28')](respondWithResult(_0x30e469,null))['catch'](handleError(_0x30e469,null));};exports[_0xf180('0x4c')]=function(_0x12fabe,_0x4b0dcd){return db[_0xf180('0x2e')][_0xf180('0x48')]({'where':{'id':_0x12fabe[_0xf180('0x46')]['id']}})[_0xf180('0x28')](handleEntityNotFound(_0x4b0dcd,null))[_0xf180('0x28')](removeEntity(_0x4b0dcd,null))[_0xf180('0x49')](handleError(_0x4b0dcd,null));};exports[_0xf180('0x4d')]=function(_0x639114,_0x475b0f){return db[_0xf180('0x2e')][_0xf180('0x4d')]()[_0xf180('0x28')](respondWithResult(_0x475b0f,null))['catch'](handleError(_0x475b0f,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 58cb999..2fe76ff 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x3998a5,_0x221caf){var _0x4b68b5=function(_0x1583a0){while(--_0x1583a0){_0x3998a5['push'](_0x3998a5['shift']());}};_0x4b68b5(++_0x221caf);}(_0x326f,0xd1));var _0xf326=function(_0x1634b3,_0x52c360){_0x1634b3=_0x1634b3-0x0;var _0x27c035=_0x326f[_0x1634b3];return _0x27c035;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x2aa856,_0x138965){var _0x434efe=function(_0xc4bcc2){while(--_0xc4bcc2){_0x2aa856['push'](_0x2aa856['shift']());}};_0x434efe(++_0x138965);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xc4aa[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 14a45e6..5bdda1b 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 _0xb529=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','stringify','UpdateFaxQueueReport','update','body','attributes','limit','lodash'];(function(_0x40d22f,_0x401be6){var _0x558cc4=function(_0x4513e2){while(--_0x4513e2){_0x40d22f['push'](_0x40d22f['shift']());}};_0x558cc4(++_0x401be6);}(_0xb529,0xe6));var _0x9b52=function(_0x4a63b0,_0x27532b){_0x4a63b0=_0x4a63b0-0x0;var _0x6219a2=_0xb529[_0x4a63b0];return _0x6219a2;};'use strict';var _=require(_0x9b52('0x0'));var util=require(_0x9b52('0x1'));var moment=require('moment');var BPromise=require(_0x9b52('0x2'));var rs=require(_0x9b52('0x3'));var fs=require('fs');var Redis=require(_0x9b52('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9b52('0x5'))(_0x9b52('0x6'));var config=require(_0x9b52('0x7'));var jayson=require(_0x9b52('0x8'));var client=jayson[_0x9b52('0x9')][_0x9b52('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2028dd,_0x2e113f,_0x2aff5f){return new BPromise(function(_0x4481a8,_0x43e676){return client[_0x9b52('0xb')](_0x2028dd,_0x2aff5f)[_0x9b52('0xc')](function(_0x3a5c17){logger[_0x9b52('0xd')](_0x9b52('0xe'),_0x2e113f,_0x9b52('0xf'));logger[_0x9b52('0x10')](_0x9b52('0x11'),_0x2e113f,_0x9b52('0xf'),JSON['stringify'](_0x3a5c17));if(_0x3a5c17[_0x9b52('0x12')]){if(_0x3a5c17['error'][_0x9b52('0x13')]===0x1f4){logger[_0x9b52('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x2e113f,_0x3a5c17[_0x9b52('0x12')][_0x9b52('0x14')]);return _0x43e676(_0x3a5c17[_0x9b52('0x12')][_0x9b52('0x14')]);}logger[_0x9b52('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x2e113f,_0x3a5c17[_0x9b52('0x12')][_0x9b52('0x14')]);return _0x4481a8(_0x3a5c17[_0x9b52('0x12')][_0x9b52('0x14')]);}else{logger[_0x9b52('0xd')](_0x9b52('0xe'),_0x2e113f,_0x9b52('0xf'));_0x4481a8(_0x3a5c17['result'][_0x9b52('0x14')]);}})[_0x9b52('0x15')](function(_0x3ec564){logger[_0x9b52('0x12')](_0x9b52('0xe'),_0x2e113f,_0x3ec564);_0x43e676(_0x3ec564);});});}exports[_0x9b52('0x16')]=function(_0x513410){var _0x250432=this;return new Promise(function(_0x114615,_0x17fdc8){return db[_0x9b52('0x17')][_0x9b52('0x18')](_0x513410['body'],{'raw':_0x513410[_0x9b52('0x19')]?_0x513410[_0x9b52('0x19')][_0x9b52('0x1a')]===undefined?!![]:![]:!![]})[_0x9b52('0xc')](function(_0x5656ad){logger[_0x9b52('0xd')](_0x9b52('0x16'),_0x513410);logger[_0x9b52('0x10')](_0x9b52('0x16'),_0x513410,JSON[_0x9b52('0x1b')](_0x5656ad));_0x114615(_0x5656ad);})['catch'](function(_0x3dda1e){logger['error'](_0x9b52('0x16'),_0x3dda1e[_0x9b52('0x14')],_0x513410);_0x17fdc8(_0x250432[_0x9b52('0x12')](0x1f4,_0x3dda1e[_0x9b52('0x14')]));});});};exports[_0x9b52('0x1c')]=function(_0x972f63){var _0x200381=this;return new Promise(function(_0x3ec91f,_0x27f3dd){return db['FaxQueueReport'][_0x9b52('0x1d')](_0x972f63[_0x9b52('0x1e')],{'raw':_0x972f63[_0x9b52('0x19')]?_0x972f63[_0x9b52('0x19')][_0x9b52('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x972f63[_0x9b52('0x19')]?_0x972f63['options']['where']||null:null,'attributes':_0x972f63[_0x9b52('0x19')]?_0x972f63[_0x9b52('0x19')][_0x9b52('0x1f')]||null:null,'limit':_0x972f63[_0x9b52('0x19')]?_0x972f63[_0x9b52('0x19')][_0x9b52('0x20')]||null:null})[_0x9b52('0xc')](function(_0x9f040c){logger[_0x9b52('0xd')](_0x9b52('0x1c'),_0x972f63);logger['debug'](_0x9b52('0x1c'),_0x972f63,JSON[_0x9b52('0x1b')](_0x9f040c));_0x3ec91f(_0x9f040c);})[_0x9b52('0x15')](function(_0x4b1b94){logger['error'](_0x9b52('0x1c'),_0x4b1b94[_0x9b52('0x14')],_0x972f63);_0x27f3dd(_0x200381[_0x9b52('0x12')](0x1f4,_0x4b1b94[_0x9b52('0x14')]));});});}; \ No newline at end of file +var _0x33be=['raw','catch','update','where','attributes','limit','UpdateFaxQueueReport','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateFaxQueueReport','FaxQueueReport','create','body','options'];(function(_0x53c48a,_0x5bc4e9){var _0x465dd2=function(_0x2a0fb2){while(--_0x2a0fb2){_0x53c48a['push'](_0x53c48a['shift']());}};_0x465dd2(++_0x5bc4e9);}(_0x33be,0x1b9));var _0xe33b=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x33be[_0x199572];return _0x13cfa3;};'use strict';var _=require('lodash');var util=require(_0xe33b('0x0'));var moment=require(_0xe33b('0x1'));var BPromise=require(_0xe33b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe33b('0x3'));var logger=require('../../config/logger')(_0xe33b('0x4'));var config=require(_0xe33b('0x5'));var jayson=require(_0xe33b('0x6'));var client=jayson['client'][_0xe33b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2438fb,_0x255098,_0x65f65d){return new BPromise(function(_0x1c9275,_0x5bbccb){return client['request'](_0x2438fb,_0x65f65d)[_0xe33b('0x8')](function(_0x2cbb0b){logger[_0xe33b('0x9')](_0xe33b('0xa'),_0x255098,_0xe33b('0xb'));logger[_0xe33b('0xc')](_0xe33b('0xd'),_0x255098,'request\x20sent',JSON[_0xe33b('0xe')](_0x2cbb0b));if(_0x2cbb0b[_0xe33b('0xf')]){if(_0x2cbb0b[_0xe33b('0xf')][_0xe33b('0x10')]===0x1f4){logger['error'](_0xe33b('0xa'),_0x255098,_0x2cbb0b['error'][_0xe33b('0x11')]);return _0x5bbccb(_0x2cbb0b[_0xe33b('0xf')][_0xe33b('0x11')]);}logger[_0xe33b('0xf')](_0xe33b('0xa'),_0x255098,_0x2cbb0b[_0xe33b('0xf')][_0xe33b('0x11')]);return _0x1c9275(_0x2cbb0b[_0xe33b('0xf')]['message']);}else{logger[_0xe33b('0x9')](_0xe33b('0xa'),_0x255098,_0xe33b('0xb'));_0x1c9275(_0x2cbb0b[_0xe33b('0x12')][_0xe33b('0x11')]);}})['catch'](function(_0x59c28a){logger[_0xe33b('0xf')](_0xe33b('0xa'),_0x255098,_0x59c28a);_0x5bbccb(_0x59c28a);});});}exports[_0xe33b('0x13')]=function(_0xb6f546){var _0x4c3b7c=this;return new Promise(function(_0x3ab279,_0x372a49){return db[_0xe33b('0x14')][_0xe33b('0x15')](_0xb6f546[_0xe33b('0x16')],{'raw':_0xb6f546[_0xe33b('0x17')]?_0xb6f546['options'][_0xe33b('0x18')]===undefined?!![]:![]:!![]})[_0xe33b('0x8')](function(_0x30c560){logger[_0xe33b('0x9')](_0xe33b('0x13'),_0xb6f546);logger[_0xe33b('0xc')](_0xe33b('0x13'),_0xb6f546,JSON['stringify'](_0x30c560));_0x3ab279(_0x30c560);})[_0xe33b('0x19')](function(_0x15dc18){logger[_0xe33b('0xf')]('CreateFaxQueueReport',_0x15dc18[_0xe33b('0x11')],_0xb6f546);_0x372a49(_0x4c3b7c['error'](0x1f4,_0x15dc18[_0xe33b('0x11')]));});});};exports['UpdateFaxQueueReport']=function(_0x1c0da4){var _0x274974=this;return new Promise(function(_0x184e32,_0x282a83){return db[_0xe33b('0x14')][_0xe33b('0x1a')](_0x1c0da4['body'],{'raw':_0x1c0da4[_0xe33b('0x17')]?_0x1c0da4[_0xe33b('0x17')][_0xe33b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c0da4[_0xe33b('0x17')]?_0x1c0da4[_0xe33b('0x17')][_0xe33b('0x1b')]||null:null,'attributes':_0x1c0da4[_0xe33b('0x17')]?_0x1c0da4[_0xe33b('0x17')][_0xe33b('0x1c')]||null:null,'limit':_0x1c0da4[_0xe33b('0x17')]?_0x1c0da4['options'][_0xe33b('0x1d')]||null:null})[_0xe33b('0x8')](function(_0x24d169){logger[_0xe33b('0x9')]('UpdateFaxQueueReport',_0x1c0da4);logger[_0xe33b('0xc')](_0xe33b('0x1e'),_0x1c0da4,JSON[_0xe33b('0xe')](_0x24d169));_0x184e32(_0x24d169);})[_0xe33b('0x19')](function(_0x267de4){logger[_0xe33b('0xf')](_0xe33b('0x1e'),_0x267de4['message'],_0x1c0da4);_0x282a83(_0x274974[_0xe33b('0xf')](0x1f4,_0x267de4[_0xe33b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index b6afff4..60c1809 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 _0xd316=['put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create'];(function(_0xb2b9f1,_0xf40b9b){var _0x47d532=function(_0x2511d3){while(--_0x2511d3){_0xb2b9f1['push'](_0xb2b9f1['shift']());}};_0x47d532(++_0xf40b9b);}(_0xd316,0x97));var _0x6d31=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd316[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6d31('0x0'));var util=require(_0x6d31('0x1'));var path=require('path');var timeout=require(_0x6d31('0x2'));var express=require(_0x6d31('0x3'));var router=express[_0x6d31('0x4')]();var fs_extra=require(_0x6d31('0x5'));var auth=require(_0x6d31('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6d31('0x7'));var controller=require(_0x6d31('0x8'));router['get']('/',auth[_0x6d31('0x9')](),controller[_0x6d31('0xa')]);router[_0x6d31('0xb')]('/describe',auth[_0x6d31('0x9')](),controller[_0x6d31('0xc')]);router['get'](_0x6d31('0xd'),auth[_0x6d31('0x9')](),controller[_0x6d31('0xe')]);router[_0x6d31('0xf')]('/',auth[_0x6d31('0x9')](),controller[_0x6d31('0x10')]);router[_0x6d31('0x11')](_0x6d31('0xd'),auth[_0x6d31('0x9')](),controller[_0x6d31('0x12')]);router[_0x6d31('0x13')](_0x6d31('0xd'),auth[_0x6d31('0x9')](),controller[_0x6d31('0x14')]);module['exports']=router; \ No newline at end of file +var _0x36ee=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','describe','post','create','/:id','update','delete','destroy','exports'];(function(_0xae1a83,_0x1980d4){var _0xdb9da8=function(_0x36fc99){while(--_0x36fc99){_0xae1a83['push'](_0xae1a83['shift']());}};_0xdb9da8(++_0x1980d4);}(_0x36ee,0x118));var _0xe36e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x36ee[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xe36e('0x0'));var util=require(_0xe36e('0x1'));var path=require(_0xe36e('0x2'));var timeout=require(_0xe36e('0x3'));var express=require('express');var router=express[_0xe36e('0x4')]();var fs_extra=require(_0xe36e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe36e('0x6'));var config=require(_0xe36e('0x7'));var controller=require(_0xe36e('0x8'));router[_0xe36e('0x9')]('/',auth[_0xe36e('0xa')](),controller[_0xe36e('0xb')]);router[_0xe36e('0x9')]('/describe',auth[_0xe36e('0xa')](),controller[_0xe36e('0xc')]);router[_0xe36e('0x9')]('/:id',auth[_0xe36e('0xa')](),controller['show']);router[_0xe36e('0xd')]('/',auth[_0xe36e('0xa')](),controller[_0xe36e('0xe')]);router['put'](_0xe36e('0xf'),auth[_0xe36e('0xa')](),controller[_0xe36e('0x10')]);router[_0xe36e('0x11')](_0xe36e('0xf'),auth[_0xe36e('0xa')](),controller[_0xe36e('0x12')]);module[_0xe36e('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 5f20764..784a149 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0xc5eee4,_0x2e71fb){var _0x531dba=function(_0x241c5b){while(--_0x241c5b){_0xc5eee4['push'](_0xc5eee4['shift']());}};_0x531dba(++_0x2e71fb);}(_0xf4eb,0xec));var _0xbf4e=function(_0x440906,_0x15829d){_0x440906=_0x440906-0x0;var _0x59479a=_0xf4eb[_0x440906];return _0x59479a;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0xd578cb,_0x2167a3){var _0x775533=function(_0x1c340d){while(--_0x1c340d){_0xd578cb['push'](_0xd578cb['shift']());}};_0x775533(++_0x2167a3);}(_0xb43b,0x1b2));var _0xbb43=function(_0x48294e,_0x1685b5){_0x48294e=_0x48294e-0x0;var _0xe40300=_0xb43b[_0x48294e];return _0xe40300;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index d70afa5..d1e96d2 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 _0x65bf=['params','keys','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x3f9631,_0x51ffcb){var _0x242d84=function(_0xfcd4f7){while(--_0xfcd4f7){_0x3f9631['push'](_0x3f9631['shift']());}};_0x242d84(++_0x51ffcb);}(_0x65bf,0x188));var _0xf65b=function(_0x47cfdc,_0x5f0a4a){_0x47cfdc=_0x47cfdc-0x0;var _0x3537d2=_0x65bf[_0x47cfdc];return _0x3537d2;};'use strict';var emlformat=require(_0xf65b('0x0'));var rimraf=require(_0xf65b('0x1'));var zipdir=require(_0xf65b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf65b('0x3'));var moment=require(_0xf65b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf65b('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf65b('0x6'));var csv=require(_0xf65b('0x7'));var ejs=require(_0xf65b('0x8'));var fs=require('fs');var fs_extra=require(_0xf65b('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf65b('0xa'));var deskjs=require(_0xf65b('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf65b('0xc'));var Redis=require(_0xf65b('0xd'));var authService=require(_0xf65b('0xe'));var qs=require(_0xf65b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf65b('0x10'));var logger=require('../../config/logger')(_0xf65b('0x11'));var utils=require(_0xf65b('0x12'));var config=require(_0xf65b('0x13'));var licenseUtil=require(_0xf65b('0x14'));var db=require(_0xf65b('0x15'))['db'];function respondWithStatusCode(_0x2c4e0a,_0x4e0d51){_0x4e0d51=_0x4e0d51||0xcc;return function(_0x36d3a3){if(_0x36d3a3){return _0x2c4e0a[_0xf65b('0x16')](_0x4e0d51);}return _0x2c4e0a[_0xf65b('0x17')](_0x4e0d51)['end']();};}function respondWithResult(_0x579ccd,_0x3fde05){_0x3fde05=_0x3fde05||0xc8;return function(_0x35dbd6){if(_0x35dbd6){return _0x579ccd[_0xf65b('0x17')](_0x3fde05)[_0xf65b('0x18')](_0x35dbd6);}};}function respondWithFilteredResult(_0x3a4daf,_0x287b33){return function(_0x5858d4){if(_0x5858d4){var _0x15e276=typeof _0x287b33[_0xf65b('0x19')]===_0xf65b('0x1a')&&typeof _0x287b33[_0xf65b('0x1b')]==='undefined';var _0x24e420=_0x5858d4[_0xf65b('0x1c')];var _0x57273b=_0x15e276?0x0:_0x287b33[_0xf65b('0x19')];var _0x3f4eee=_0x15e276?_0x5858d4['count']:_0x287b33['offset']+_0x287b33[_0xf65b('0x1b')];var _0x239b43;if(_0x3f4eee>=_0x24e420){_0x3f4eee=_0x24e420;_0x239b43=0xc8;}else{_0x239b43=0xce;}_0x3a4daf[_0xf65b('0x17')](_0x239b43);return _0x3a4daf[_0xf65b('0x1d')](_0xf65b('0x1e'),_0x57273b+'-'+_0x3f4eee+'/'+_0x24e420)['json'](_0x5858d4);}return null;};}function patchUpdates(_0x12f478){return function(_0x34cc40){try{jsonpatch[_0xf65b('0x1f')](_0x34cc40,_0x12f478,!![]);}catch(_0x2b4e30){return BPromise[_0xf65b('0x20')](_0x2b4e30);}return _0x34cc40[_0xf65b('0x21')]();};}function saveUpdates(_0x4ebfe1,_0x2157a7){return function(_0x9dd9ba){if(_0x9dd9ba){return _0x9dd9ba[_0xf65b('0x22')](_0x4ebfe1)[_0xf65b('0x23')](function(_0x4a6086){return _0x4a6086;});}return null;};}function removeEntity(_0x3c29c2,_0x4bc219){return function(_0x5e6d22){if(_0x5e6d22){return _0x5e6d22['destroy']()['then'](function(){_0x3c29c2[_0xf65b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fdb62,_0x41c3e7){return function(_0x4ee300){if(!_0x4ee300){_0x3fdb62[_0xf65b('0x16')](0x194);}return _0x4ee300;};}function handleError(_0x398e0b,_0x44eeac){_0x44eeac=_0x44eeac||0x1f4;return function(_0x5488c7){logger[_0xf65b('0x24')](_0x5488c7[_0xf65b('0x25')]);if(_0x5488c7['name']){delete _0x5488c7[_0xf65b('0x26')];}_0x398e0b['status'](_0x44eeac)[_0xf65b('0x27')](_0x5488c7);};}exports[_0xf65b('0x28')]=function(_0x4ab401,_0x11ad63){var _0x25ba7e={},_0x34d24d={},_0x52a6dd={'count':0x0,'rows':[]};var _0x566468=_[_0xf65b('0x29')](db[_0xf65b('0x2a')][_0xf65b('0x2b')],function(_0x3c781f){return{'name':_0x3c781f[_0xf65b('0x2c')],'type':_0x3c781f[_0xf65b('0x2d')][_0xf65b('0x2e')]};});_0x34d24d[_0xf65b('0x2f')]=_['map'](_0x566468,_0xf65b('0x26'));_0x34d24d[_0xf65b('0x30')]=_['keys'](_0x4ab401[_0xf65b('0x30')]);_0x34d24d[_0xf65b('0x31')]=_[_0xf65b('0x32')](_0x34d24d[_0xf65b('0x2f')],_0x34d24d['query']);_0x25ba7e[_0xf65b('0x33')]=_[_0xf65b('0x32')](_0x34d24d[_0xf65b('0x2f')],qs['fields'](_0x4ab401[_0xf65b('0x30')][_0xf65b('0x34')]));_0x25ba7e[_0xf65b('0x33')]=_0x25ba7e[_0xf65b('0x33')][_0xf65b('0x35')]?_0x25ba7e[_0xf65b('0x33')]:_0x34d24d[_0xf65b('0x2f')];if(!_0x4ab401['query'][_0xf65b('0x36')](_0xf65b('0x37'))){_0x25ba7e[_0xf65b('0x1b')]=qs[_0xf65b('0x1b')](_0x4ab401[_0xf65b('0x30')][_0xf65b('0x1b')]);_0x25ba7e[_0xf65b('0x19')]=qs['offset'](_0x4ab401[_0xf65b('0x30')][_0xf65b('0x19')]);}_0x25ba7e[_0xf65b('0x38')]=qs[_0xf65b('0x39')](_0x4ab401[_0xf65b('0x30')]['sort']);_0x25ba7e[_0xf65b('0x3a')]=qs[_0xf65b('0x31')](_[_0xf65b('0x3b')](_0x4ab401['query'],_0x34d24d['filters']),_0x566468);if(_0x4ab401[_0xf65b('0x30')][_0xf65b('0x3c')]){_0x25ba7e[_0xf65b('0x3a')]=_[_0xf65b('0x3d')](_0x25ba7e[_0xf65b('0x3a')],{'$or':_[_0xf65b('0x29')](_0x566468,function(_0x354998){if(_0x354998[_0xf65b('0x2d')]!==_0xf65b('0x3e')){var _0x3a8f33={};_0x3a8f33[_0x354998[_0xf65b('0x26')]]={'$like':'%'+_0x4ab401[_0xf65b('0x30')][_0xf65b('0x3c')]+'%'};return _0x3a8f33;}})});}_0x25ba7e=_[_0xf65b('0x3d')]({},_0x25ba7e,_0x4ab401[_0xf65b('0x3f')]);var _0x52675a={'where':_0x25ba7e['where']};return db['FaxTransferReport']['count'](_0x52675a)[_0xf65b('0x23')](function(_0x2ddfa2){_0x52a6dd[_0xf65b('0x1c')]=_0x2ddfa2;if(_0x4ab401['query'][_0xf65b('0x40')]){_0x25ba7e[_0xf65b('0x41')]=[{'all':!![]}];}return db[_0xf65b('0x2a')][_0xf65b('0x42')](_0x25ba7e);})[_0xf65b('0x23')](function(_0x2d540e){_0x52a6dd[_0xf65b('0x43')]=_0x2d540e;return _0x52a6dd;})['then'](respondWithFilteredResult(_0x11ad63,_0x25ba7e))[_0xf65b('0x44')](handleError(_0x11ad63,null));};exports[_0xf65b('0x45')]=function(_0x403a4b,_0x2e5a8e){var _0x20643f={'raw':!![],'where':{'id':_0x403a4b[_0xf65b('0x46')]['id']}},_0x2e19b4={};_0x2e19b4['model']=_[_0xf65b('0x47')](db[_0xf65b('0x2a')][_0xf65b('0x2b')]);_0x2e19b4['query']=_[_0xf65b('0x47')](_0x403a4b['query']);_0x2e19b4['filters']=_[_0xf65b('0x32')](_0x2e19b4[_0xf65b('0x2f')],_0x2e19b4[_0xf65b('0x30')]);_0x20643f['attributes']=_[_0xf65b('0x32')](_0x2e19b4[_0xf65b('0x2f')],qs['fields'](_0x403a4b['query']['fields']));_0x20643f['attributes']=_0x20643f[_0xf65b('0x33')][_0xf65b('0x35')]?_0x20643f['attributes']:_0x2e19b4[_0xf65b('0x2f')];if(_0x403a4b[_0xf65b('0x30')][_0xf65b('0x40')]){_0x20643f['include']=[{'all':!![]}];}_0x20643f=_[_0xf65b('0x3d')]({},_0x20643f,_0x403a4b['options']);return db[_0xf65b('0x2a')][_0xf65b('0x48')](_0x20643f)[_0xf65b('0x23')](handleEntityNotFound(_0x2e5a8e,null))[_0xf65b('0x23')](respondWithResult(_0x2e5a8e,null))[_0xf65b('0x44')](handleError(_0x2e5a8e,null));};exports[_0xf65b('0x49')]=function(_0x5097c7,_0x21fa44){return db[_0xf65b('0x2a')][_0xf65b('0x49')](_0x5097c7[_0xf65b('0x4a')],{})[_0xf65b('0x23')](respondWithResult(_0x21fa44,0xc9))[_0xf65b('0x44')](handleError(_0x21fa44,null));};exports['update']=function(_0x516de7,_0x345363){if(_0x516de7[_0xf65b('0x4a')]['id']){delete _0x516de7[_0xf65b('0x4a')]['id'];}return db['FaxTransferReport'][_0xf65b('0x48')]({'where':{'id':_0x516de7[_0xf65b('0x46')]['id']}})['then'](handleEntityNotFound(_0x345363,null))[_0xf65b('0x23')](saveUpdates(_0x516de7[_0xf65b('0x4a')],null))[_0xf65b('0x23')](respondWithResult(_0x345363,null))[_0xf65b('0x44')](handleError(_0x345363,null));};exports[_0xf65b('0x4b')]=function(_0x2762c7,_0x1f6f11){return db['FaxTransferReport'][_0xf65b('0x48')]({'where':{'id':_0x2762c7[_0xf65b('0x46')]['id']}})[_0xf65b('0x23')](handleEntityNotFound(_0x1f6f11,null))[_0xf65b('0x23')](removeEntity(_0x1f6f11,null))[_0xf65b('0x44')](handleError(_0x1f6f11,null));};exports[_0xf65b('0x4c')]=function(_0x470cf8,_0x245df0){return db['FaxTransferReport'][_0xf65b('0x4c')]()[_0xf65b('0x23')](respondWithResult(_0x245df0,null))[_0xf65b('0x44')](handleError(_0x245df0,null));}; \ No newline at end of file +var _0x139f=['where','pick','filter','merge','options','count','includeAll','include','FaxTransferReport','findAll','rows','catch','show','params','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x575424,_0x537f1c){var _0x2983c6=function(_0x192a6d){while(--_0x192a6d){_0x575424['push'](_0x575424['shift']());}};_0x2983c6(++_0x537f1c);}(_0x139f,0xb0));var _0xf139=function(_0x113e5b,_0x1bfc47){_0x113e5b=_0x113e5b-0x0;var _0x2ada3a=_0x139f[_0x113e5b];return _0x2ada3a;};'use strict';var emlformat=require(_0xf139('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf139('0x1'));var jsonpatch=require(_0xf139('0x2'));var rp=require(_0xf139('0x3'));var moment=require(_0xf139('0x4'));var BPromise=require(_0xf139('0x5'));var Mustache=require(_0xf139('0x6'));var util=require('util');var path=require(_0xf139('0x7'));var sox=require('sox');var csv=require(_0xf139('0x8'));var ejs=require(_0xf139('0x9'));var fs=require('fs');var fs_extra=require(_0xf139('0xa'));var _=require(_0xf139('0xb'));var squel=require(_0xf139('0xc'));var crypto=require(_0xf139('0xd'));var jsforce=require(_0xf139('0xe'));var deskjs=require(_0xf139('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf139('0x10'));var Papa=require(_0xf139('0x11'));var Redis=require(_0xf139('0x12'));var authService=require(_0xf139('0x13'));var qs=require(_0xf139('0x14'));var as=require(_0xf139('0x15'));var hardwareService=require(_0xf139('0x16'));var logger=require(_0xf139('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xf139('0x18'));var licenseUtil=require(_0xf139('0x19'));var db=require(_0xf139('0x1a'))['db'];function respondWithStatusCode(_0x406dfd,_0x5cd8e5){_0x5cd8e5=_0x5cd8e5||0xcc;return function(_0x492d30){if(_0x492d30){return _0x406dfd[_0xf139('0x1b')](_0x5cd8e5);}return _0x406dfd[_0xf139('0x1c')](_0x5cd8e5)[_0xf139('0x1d')]();};}function respondWithResult(_0x3dc7e4,_0x348fdb){_0x348fdb=_0x348fdb||0xc8;return function(_0x1ab0ea){if(_0x1ab0ea){return _0x3dc7e4[_0xf139('0x1c')](_0x348fdb)[_0xf139('0x1e')](_0x1ab0ea);}};}function respondWithFilteredResult(_0x43b495,_0x41c5f3){return function(_0x2986a8){if(_0x2986a8){var _0x1903fd=typeof _0x41c5f3['offset']===_0xf139('0x1f')&&typeof _0x41c5f3[_0xf139('0x20')]==='undefined';var _0x2fda01=_0x2986a8['count'];var _0x1832b6=_0x1903fd?0x0:_0x41c5f3[_0xf139('0x21')];var _0x484ebd=_0x1903fd?_0x2986a8['count']:_0x41c5f3[_0xf139('0x21')]+_0x41c5f3[_0xf139('0x20')];var _0x27c1aa;if(_0x484ebd>=_0x2fda01){_0x484ebd=_0x2fda01;_0x27c1aa=0xc8;}else{_0x27c1aa=0xce;}_0x43b495['status'](_0x27c1aa);return _0x43b495[_0xf139('0x22')](_0xf139('0x23'),_0x1832b6+'-'+_0x484ebd+'/'+_0x2fda01)[_0xf139('0x1e')](_0x2986a8);}return null;};}function patchUpdates(_0x39440e){return function(_0x59cfae){try{jsonpatch[_0xf139('0x24')](_0x59cfae,_0x39440e,!![]);}catch(_0xeeafa4){return BPromise[_0xf139('0x25')](_0xeeafa4);}return _0x59cfae['save']();};}function saveUpdates(_0x423586,_0x45f479){return function(_0x117127){if(_0x117127){return _0x117127[_0xf139('0x26')](_0x423586)[_0xf139('0x27')](function(_0x53ee58){return _0x53ee58;});}return null;};}function removeEntity(_0x3673ea,_0x1f4ef3){return function(_0x584221){if(_0x584221){return _0x584221[_0xf139('0x28')]()[_0xf139('0x27')](function(){_0x3673ea[_0xf139('0x1c')](0xcc)[_0xf139('0x1d')]();});}};}function handleEntityNotFound(_0x401a94,_0x3babf3){return function(_0x3f7eba){if(!_0x3f7eba){_0x401a94[_0xf139('0x1b')](0x194);}return _0x3f7eba;};}function handleError(_0x4b2d61,_0x37dad6){_0x37dad6=_0x37dad6||0x1f4;return function(_0x18c61d){logger[_0xf139('0x29')](_0x18c61d[_0xf139('0x2a')]);if(_0x18c61d['name']){delete _0x18c61d[_0xf139('0x2b')];}_0x4b2d61[_0xf139('0x1c')](_0x37dad6)[_0xf139('0x2c')](_0x18c61d);};}exports[_0xf139('0x2d')]=function(_0x16b001,_0x101120){var _0x291022={},_0x1ad23b={},_0xd75e3f={'count':0x0,'rows':[]};var _0x35c11f=_['map'](db['FaxTransferReport'][_0xf139('0x2e')],function(_0x1170db){return{'name':_0x1170db[_0xf139('0x2f')],'type':_0x1170db['type'][_0xf139('0x30')]};});_0x1ad23b[_0xf139('0x31')]=_['map'](_0x35c11f,_0xf139('0x2b'));_0x1ad23b[_0xf139('0x32')]=_[_0xf139('0x33')](_0x16b001[_0xf139('0x32')]);_0x1ad23b[_0xf139('0x34')]=_[_0xf139('0x35')](_0x1ad23b[_0xf139('0x31')],_0x1ad23b[_0xf139('0x32')]);_0x291022[_0xf139('0x36')]=_[_0xf139('0x35')](_0x1ad23b[_0xf139('0x31')],qs[_0xf139('0x37')](_0x16b001['query'][_0xf139('0x37')]));_0x291022[_0xf139('0x36')]=_0x291022[_0xf139('0x36')][_0xf139('0x38')]?_0x291022[_0xf139('0x36')]:_0x1ad23b['model'];if(!_0x16b001['query'][_0xf139('0x39')](_0xf139('0x3a'))){_0x291022[_0xf139('0x20')]=qs[_0xf139('0x20')](_0x16b001[_0xf139('0x32')]['limit']);_0x291022[_0xf139('0x21')]=qs[_0xf139('0x21')](_0x16b001['query'][_0xf139('0x21')]);}_0x291022[_0xf139('0x3b')]=qs[_0xf139('0x3c')](_0x16b001['query'][_0xf139('0x3c')]);_0x291022[_0xf139('0x3d')]=qs['filters'](_[_0xf139('0x3e')](_0x16b001[_0xf139('0x32')],_0x1ad23b[_0xf139('0x34')]),_0x35c11f);if(_0x16b001[_0xf139('0x32')][_0xf139('0x3f')]){_0x291022[_0xf139('0x3d')]=_[_0xf139('0x40')](_0x291022[_0xf139('0x3d')],{'$or':_['map'](_0x35c11f,function(_0x373160){if(_0x373160['type']!=='VIRTUAL'){var _0x65ad13={};_0x65ad13[_0x373160[_0xf139('0x2b')]]={'$like':'%'+_0x16b001['query'][_0xf139('0x3f')]+'%'};return _0x65ad13;}})});}_0x291022=_[_0xf139('0x40')]({},_0x291022,_0x16b001[_0xf139('0x41')]);var _0x2b45e1={'where':_0x291022[_0xf139('0x3d')]};return db['FaxTransferReport'][_0xf139('0x42')](_0x2b45e1)[_0xf139('0x27')](function(_0x3251e1){_0xd75e3f['count']=_0x3251e1;if(_0x16b001[_0xf139('0x32')][_0xf139('0x43')]){_0x291022[_0xf139('0x44')]=[{'all':!![]}];}return db[_0xf139('0x45')][_0xf139('0x46')](_0x291022);})[_0xf139('0x27')](function(_0x382a5e){_0xd75e3f[_0xf139('0x47')]=_0x382a5e;return _0xd75e3f;})[_0xf139('0x27')](respondWithFilteredResult(_0x101120,_0x291022))[_0xf139('0x48')](handleError(_0x101120,null));};exports[_0xf139('0x49')]=function(_0x549e84,_0x5434e7){var _0xafea1a={'raw':!![],'where':{'id':_0x549e84[_0xf139('0x4a')]['id']}},_0x380016={};_0x380016[_0xf139('0x31')]=_[_0xf139('0x33')](db[_0xf139('0x45')][_0xf139('0x2e')]);_0x380016[_0xf139('0x32')]=_[_0xf139('0x33')](_0x549e84[_0xf139('0x32')]);_0x380016[_0xf139('0x34')]=_[_0xf139('0x35')](_0x380016[_0xf139('0x31')],_0x380016['query']);_0xafea1a[_0xf139('0x36')]=_[_0xf139('0x35')](_0x380016[_0xf139('0x31')],qs[_0xf139('0x37')](_0x549e84[_0xf139('0x32')][_0xf139('0x37')]));_0xafea1a['attributes']=_0xafea1a[_0xf139('0x36')][_0xf139('0x38')]?_0xafea1a[_0xf139('0x36')]:_0x380016[_0xf139('0x31')];if(_0x549e84[_0xf139('0x32')][_0xf139('0x43')]){_0xafea1a[_0xf139('0x44')]=[{'all':!![]}];}_0xafea1a=_['merge']({},_0xafea1a,_0x549e84[_0xf139('0x41')]);return db[_0xf139('0x45')]['find'](_0xafea1a)[_0xf139('0x27')](handleEntityNotFound(_0x5434e7,null))[_0xf139('0x27')](respondWithResult(_0x5434e7,null))[_0xf139('0x48')](handleError(_0x5434e7,null));};exports[_0xf139('0x4b')]=function(_0x7b0214,_0x2556c6){return db[_0xf139('0x45')][_0xf139('0x4b')](_0x7b0214[_0xf139('0x4c')],{})[_0xf139('0x27')](respondWithResult(_0x2556c6,0xc9))[_0xf139('0x48')](handleError(_0x2556c6,null));};exports[_0xf139('0x26')]=function(_0x15ce88,_0x402643){if(_0x15ce88[_0xf139('0x4c')]['id']){delete _0x15ce88[_0xf139('0x4c')]['id'];}return db['FaxTransferReport'][_0xf139('0x4d')]({'where':{'id':_0x15ce88[_0xf139('0x4a')]['id']}})[_0xf139('0x27')](handleEntityNotFound(_0x402643,null))[_0xf139('0x27')](saveUpdates(_0x15ce88[_0xf139('0x4c')],null))[_0xf139('0x27')](respondWithResult(_0x402643,null))[_0xf139('0x48')](handleError(_0x402643,null));};exports[_0xf139('0x28')]=function(_0x340b29,_0x302fe0){return db[_0xf139('0x45')][_0xf139('0x4d')]({'where':{'id':_0x340b29[_0xf139('0x4a')]['id']}})['then'](handleEntityNotFound(_0x302fe0,null))['then'](removeEntity(_0x302fe0,null))['catch'](handleError(_0x302fe0,null));};exports[_0xf139('0x4e')]=function(_0x1cfaf2,_0x482229){return db[_0xf139('0x45')]['describe']()[_0xf139('0x27')](respondWithResult(_0x482229,null))[_0xf139('0x48')](handleError(_0x482229,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index c40c23f..d74176d 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 _0x3bb4=['./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x3bb4,0x87));var _0x43bb=function(_0x11bb0d,_0x418af4){_0x11bb0d=_0x11bb0d-0x0;var _0x509d26=_0x3bb4[_0x11bb0d];return _0x509d26;};'use strict';var _=require(_0x43bb('0x0'));var util=require(_0x43bb('0x1'));var logger=require('../../config/logger')(_0x43bb('0x2'));var moment=require(_0x43bb('0x3'));var BPromise=require('bluebird');var rp=require(_0x43bb('0x4'));var fs=require('fs');var path=require(_0x43bb('0x5'));var rimraf=require(_0x43bb('0x6'));var config=require(_0x43bb('0x7'));var attributes=require(_0x43bb('0x8'));module[_0x43bb('0x9')]=function(_0x485f8e,_0x5eb10a){return _0x485f8e[_0x43bb('0xa')](_0x43bb('0xb'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x43bb('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0a4b=['uniqueid','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','define'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x0a4b,0x14b));var _0xb0a4=function(_0x810611,_0x4466d3){_0x810611=_0x810611-0x0;var _0x3c7749=_0x0a4b[_0x810611];return _0x3c7749;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb0a4('0x0'));var moment=require(_0xb0a4('0x1'));var BPromise=require(_0xb0a4('0x2'));var rp=require(_0xb0a4('0x3'));var fs=require('fs');var path=require(_0xb0a4('0x4'));var rimraf=require(_0xb0a4('0x5'));var config=require(_0xb0a4('0x6'));var attributes=require(_0xb0a4('0x7'));module['exports']=function(_0x5f4975,_0x4f56fa){return _0x5f4975[_0xb0a4('0x8')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xb0a4('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index c010a39..60518ff 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 _0x7ec7=['lodash','moment','ioredis','../../config/utils','../../config/environment','client','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch'];(function(_0x636e2b,_0x54a5bf){var _0x29a702=function(_0x2dff98){while(--_0x2dff98){_0x636e2b['push'](_0x636e2b['shift']());}};_0x29a702(++_0x54a5bf);}(_0x7ec7,0x130));var _0x77ec=function(_0x384900,_0xb6537e){_0x384900=_0x384900-0x0;var _0x30c2a2=_0x7ec7[_0x384900];return _0x30c2a2;};'use strict';var _=require(_0x77ec('0x0'));var util=require('util');var moment=require(_0x77ec('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77ec('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x77ec('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x77ec('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x77ec('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c785a,_0x2f0976,_0x3f0382){return new BPromise(function(_0x32464c,_0x413318){return client[_0x77ec('0x6')](_0x2c785a,_0x3f0382)[_0x77ec('0x7')](function(_0x41342c){logger['info'](_0x77ec('0x8'),_0x2f0976,_0x77ec('0x9'));logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x2f0976,_0x77ec('0x9'),JSON[_0x77ec('0xa')](_0x41342c));if(_0x41342c[_0x77ec('0xb')]){if(_0x41342c['error']['code']===0x1f4){logger[_0x77ec('0xb')](_0x77ec('0x8'),_0x2f0976,_0x41342c['error'][_0x77ec('0xc')]);return _0x413318(_0x41342c[_0x77ec('0xb')]['message']);}logger['error'](_0x77ec('0x8'),_0x2f0976,_0x41342c[_0x77ec('0xb')][_0x77ec('0xc')]);return _0x32464c(_0x41342c[_0x77ec('0xb')][_0x77ec('0xc')]);}else{logger[_0x77ec('0xd')](_0x77ec('0x8'),_0x2f0976,_0x77ec('0x9'));_0x32464c(_0x41342c[_0x77ec('0xe')]['message']);}})[_0x77ec('0xf')](function(_0x2317b4){logger[_0x77ec('0xb')](_0x77ec('0x8'),_0x2f0976,_0x2317b4);_0x413318(_0x2317b4);});});} \ No newline at end of file +var _0x37c8=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','FaxTransferReport,\x20%s,\x20%s','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3260ac,_0xbe4b03){var _0x5c2662=function(_0x5045b4){while(--_0x5045b4){_0x3260ac['push'](_0x3260ac['shift']());}};_0x5c2662(++_0xbe4b03);}(_0x37c8,0x17b));var _0x837c=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x37c8[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0x837c('0x0'));var util=require(_0x837c('0x1'));var moment=require('moment');var BPromise=require(_0x837c('0x2'));var rs=require(_0x837c('0x3'));var fs=require('fs');var Redis=require(_0x837c('0x4'));var db=require(_0x837c('0x5'))['db'];var utils=require(_0x837c('0x6'));var logger=require('../../config/logger')(_0x837c('0x7'));var config=require(_0x837c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x837c('0x9')][_0x837c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b7349,_0x12faa9,_0x335c08){return new BPromise(function(_0xdc3e27,_0x193854){return client['request'](_0x2b7349,_0x335c08)[_0x837c('0xb')](function(_0x403895){logger[_0x837c('0xc')](_0x837c('0xd'),_0x12faa9,'request\x20sent');logger['debug'](_0x837c('0xe'),_0x12faa9,_0x837c('0xf'),JSON[_0x837c('0x10')](_0x403895));if(_0x403895[_0x837c('0x11')]){if(_0x403895['error'][_0x837c('0x12')]===0x1f4){logger[_0x837c('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x12faa9,_0x403895[_0x837c('0x11')][_0x837c('0x13')]);return _0x193854(_0x403895[_0x837c('0x11')][_0x837c('0x13')]);}logger['error'](_0x837c('0xd'),_0x12faa9,_0x403895[_0x837c('0x11')][_0x837c('0x13')]);return _0xdc3e27(_0x403895[_0x837c('0x11')][_0x837c('0x13')]);}else{logger[_0x837c('0xc')](_0x837c('0xd'),_0x12faa9,_0x837c('0xf'));_0xdc3e27(_0x403895['result'][_0x837c('0x13')]);}})[_0x837c('0x14')](function(_0x3b945c){logger[_0x837c('0x11')](_0x837c('0xd'),_0x12faa9,_0x3b945c);_0x193854(_0x3b945c);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index fc2ae65..c568ae5 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 _0x4a4a=['describe','/:id','show','post','put','update','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','/describe'];(function(_0x44dfaf,_0xdbc849){var _0x1c1ca6=function(_0x3d6ff7){while(--_0x3d6ff7){_0x44dfaf['push'](_0x44dfaf['shift']());}};_0x1c1ca6(++_0xdbc849);}(_0x4a4a,0x7d));var _0xa4a4=function(_0x14bb9c,_0x502b14){_0x14bb9c=_0x14bb9c-0x0;var _0x549c7a=_0x4a4a[_0x14bb9c];return _0x549c7a;};'use strict';var multer=require(_0xa4a4('0x0'));var util=require('util');var path=require(_0xa4a4('0x1'));var timeout=require('connect-timeout');var express=require(_0xa4a4('0x2'));var router=express['Router']();var fs_extra=require(_0xa4a4('0x3'));var auth=require(_0xa4a4('0x4'));var interaction=require(_0xa4a4('0x5'));var config=require(_0xa4a4('0x6'));var controller=require(_0xa4a4('0x7'));router['get']('/',auth[_0xa4a4('0x8')](),controller[_0xa4a4('0x9')]);router['get'](_0xa4a4('0xa'),auth[_0xa4a4('0x8')](),controller[_0xa4a4('0xb')]);router['get'](_0xa4a4('0xc'),auth['isAuthenticated'](),controller[_0xa4a4('0xd')]);router[_0xa4a4('0xe')]('/',auth[_0xa4a4('0x8')](),controller['create']);router[_0xa4a4('0xf')](_0xa4a4('0xc'),auth[_0xa4a4('0x8')](),controller[_0xa4a4('0x10')]);router['delete']('/:id',auth[_0xa4a4('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9e7a=['isAuthenticated','index','/describe','describe','show','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x95a02b,_0x34e0fa){var _0x438159=function(_0x6f3c5){while(--_0x6f3c5){_0x95a02b['push'](_0x95a02b['shift']());}};_0x438159(++_0x34e0fa);}(_0x9e7a,0x75));var _0xa9e7=function(_0x2d261e,_0x2104aa){_0x2d261e=_0x2d261e-0x0;var _0x5519d8=_0x9e7a[_0x2d261e];return _0x5519d8;};'use strict';var multer=require(_0xa9e7('0x0'));var util=require('util');var path=require(_0xa9e7('0x1'));var timeout=require(_0xa9e7('0x2'));var express=require(_0xa9e7('0x3'));var router=express[_0xa9e7('0x4')]();var fs_extra=require(_0xa9e7('0x5'));var auth=require(_0xa9e7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa9e7('0x7'));var controller=require('./faxTransferReport.controller');router[_0xa9e7('0x8')]('/',auth[_0xa9e7('0x9')](),controller[_0xa9e7('0xa')]);router[_0xa9e7('0x8')](_0xa9e7('0xb'),auth[_0xa9e7('0x9')](),controller[_0xa9e7('0xc')]);router['get']('/:id',auth[_0xa9e7('0x9')](),controller[_0xa9e7('0xd')]);router['post']('/',auth[_0xa9e7('0x9')](),controller['create']);router['put'](_0xa9e7('0xe'),auth[_0xa9e7('0x9')](),controller[_0xa9e7('0xf')]);router['delete'](_0xa9e7('0xe'),auth[_0xa9e7('0x9')](),controller[_0xa9e7('0x10')]);module[_0xa9e7('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index ec8172e..4a69621 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 _0xf788=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','/:id','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer'];(function(_0x4b6720,_0x55d114){var _0x29c4c2=function(_0x520943){while(--_0x520943){_0x4b6720['push'](_0x4b6720['shift']());}};_0x29c4c2(++_0x55d114);}(_0xf788,0x197));var _0x8f78=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xf788[_0x2dea24];return _0x309d58;};'use strict';var multer=require(_0x8f78('0x0'));var util=require(_0x8f78('0x1'));var path=require('path');var timeout=require(_0x8f78('0x2'));var express=require(_0x8f78('0x3'));var router=express[_0x8f78('0x4')]();var fs_extra=require(_0x8f78('0x5'));var auth=require(_0x8f78('0x6'));var interaction=require(_0x8f78('0x7'));var config=require('../../config/environment');var controller=require(_0x8f78('0x8'));router[_0x8f78('0x9')]('/',auth[_0x8f78('0xa')](),controller['index']);router[_0x8f78('0x9')](_0x8f78('0xb'),auth[_0x8f78('0xa')](),controller['show']);router['get']('/:id/configurations',auth[_0x8f78('0xa')](),controller[_0x8f78('0xc')]);router[_0x8f78('0x9')](_0x8f78('0xd'),auth[_0x8f78('0xa')](),controller[_0x8f78('0xe')]);router[_0x8f78('0xf')]('/',auth['isAuthenticated'](),controller[_0x8f78('0x10')]);router[_0x8f78('0xf')](_0x8f78('0x11'),auth['isAuthenticated'](),controller[_0x8f78('0x12')]);router[_0x8f78('0x13')](_0x8f78('0xb'),auth['isAuthenticated'](),controller[_0x8f78('0x14')]);router[_0x8f78('0x15')](_0x8f78('0xb'),auth[_0x8f78('0xa')](),controller[_0x8f78('0x16')]);module[_0x8f78('0x17')]=router; \ No newline at end of file +var _0x42bd=['get','index','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','destroy','multer','path','express','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller'];(function(_0x1cd638,_0x379869){var _0x48b2a2=function(_0x4dab6e){while(--_0x4dab6e){_0x1cd638['push'](_0x1cd638['shift']());}};_0x48b2a2(++_0x379869);}(_0x42bd,0x19d));var _0xd42b=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x42bd[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xd42b('0x0'));var util=require('util');var path=require(_0xd42b('0x1'));var timeout=require('connect-timeout');var express=require(_0xd42b('0x2'));var router=express['Router']();var fs_extra=require(_0xd42b('0x3'));var auth=require(_0xd42b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd42b('0x5'));var controller=require(_0xd42b('0x6'));router[_0xd42b('0x7')]('/',auth['isAuthenticated'](),controller[_0xd42b('0x8')]);router[_0xd42b('0x7')]('/:id',auth[_0xd42b('0x9')](),controller['show']);router['get'](_0xd42b('0xa'),auth['isAuthenticated'](),controller[_0xd42b('0xb')]);router[_0xd42b('0x7')](_0xd42b('0xc'),auth[_0xd42b('0x9')](),controller[_0xd42b('0xd')]);router[_0xd42b('0xe')]('/',auth[_0xd42b('0x9')](),controller[_0xd42b('0xf')]);router['post'](_0xd42b('0xa'),auth[_0xd42b('0x9')](),controller[_0xd42b('0x10')]);router[_0xd42b('0x11')](_0xd42b('0x12'),auth[_0xd42b('0x9')](),controller['update']);router['delete'](_0xd42b('0x12'),auth[_0xd42b('0x9')](),controller[_0xd42b('0x13')]);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 e024441..5631f31 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 _0xcc13=['STRING','ENUM','basic','integrationTab','newTab','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc13,0xc9));var _0x3cc1=function(_0x2fbe8d,_0xf86e79){_0x2fbe8d=_0x2fbe8d-0x0;var _0x17c3aa=_0xcc13[_0x2fbe8d];return _0x17c3aa;};'use strict';var Sequelize=require(_0x3cc1('0x0'));module[_0x3cc1('0x1')]={'name':{'type':Sequelize[_0x3cc1('0x2')]},'description':{'type':Sequelize[_0x3cc1('0x2')]},'username':{'type':Sequelize[_0x3cc1('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x3cc1('0x3')](_0x3cc1('0x4')),'defaultValue':_0x3cc1('0x4')},'password':{'type':Sequelize[_0x3cc1('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x3cc1('0x3')](_0x3cc1('0x5'),_0x3cc1('0x6')),'defaultValue':_0x3cc1('0x5')}}; \ No newline at end of file +var _0x6b61=['sequelize','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x5ce15c,_0x19c917){var _0x36e4f5=function(_0x50fa90){while(--_0x50fa90){_0x5ce15c['push'](_0x5ce15c['shift']());}};_0x36e4f5(++_0x19c917);}(_0x6b61,0x132));var _0x16b6=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x6b61[_0x12d033];return _0x3b4e80;};'use strict';var Sequelize=require(_0x16b6('0x0'));module['exports']={'name':{'type':Sequelize[_0x16b6('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x16b6('0x1')]},'remoteUri':{'type':Sequelize[_0x16b6('0x1')]},'authType':{'type':Sequelize[_0x16b6('0x2')](_0x16b6('0x3')),'defaultValue':_0x16b6('0x3')},'password':{'type':Sequelize[_0x16b6('0x1')]},'consumerKey':{'type':Sequelize[_0x16b6('0x1')]},'consumerSecret':{'type':Sequelize[_0x16b6('0x1')]},'token':{'type':Sequelize[_0x16b6('0x1')]},'tokenSecret':{'type':Sequelize[_0x16b6('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x16b6('0x2')](_0x16b6('0x4'),_0x16b6('0x5')),'defaultValue':_0x16b6('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 14c7371..11dee45 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 _0x421b=['stack','send','index','DeskAccount','rawAttributes','type','key','model','map','name','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','count','include','rows','catch','show','params','keys','length','includeAll','options','find','create','body','DeskConfiguration','getConfigurations','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','DeskField','Subjects','priority','remoteUri','username','password','consumerKey','token','substring','lastIndexOf','%s/custom_fields','application/json','authType','headers','Authorization','format','Basic\x20%s','%s:%s','concat','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','limit','undefined','status','set','apply','reject','save','update','then','destroy','error'];(function(_0x64ef12,_0x3a7c23){var _0x1322bd=function(_0x543051){while(--_0x543051){_0x64ef12['push'](_0x64ef12['shift']());}};_0x1322bd(++_0x3a7c23);}(_0x421b,0xbc));var _0xb421=function(_0x47cc41,_0x11e552){_0x47cc41=_0x47cc41-0x0;var _0x580c72=_0x421b[_0x47cc41];return _0x580c72;};'use strict';var emlformat=require(_0xb421('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb421('0x1'));var jsonpatch=require(_0xb421('0x2'));var rp=require(_0xb421('0x3'));var moment=require(_0xb421('0x4'));var BPromise=require(_0xb421('0x5'));var Mustache=require(_0xb421('0x6'));var util=require('util');var path=require(_0xb421('0x7'));var sox=require('sox');var csv=require(_0xb421('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb421('0x9'));var _=require(_0xb421('0xa'));var squel=require('squel');var crypto=require(_0xb421('0xb'));var jsforce=require(_0xb421('0xc'));var deskjs=require(_0xb421('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb421('0xe'));var Papa=require(_0xb421('0xf'));var Redis=require(_0xb421('0x10'));var authService=require(_0xb421('0x11'));var qs=require(_0xb421('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb421('0x13'));var logger=require(_0xb421('0x14'))(_0xb421('0x15'));var utils=require(_0xb421('0x16'));var config=require(_0xb421('0x17'));var licenseUtil=require(_0xb421('0x18'));var db=require(_0xb421('0x19'))['db'];var integrations=require(_0xb421('0x1a'));function respondWithStatusCode(_0x57d24d,_0x21eb0c){_0x21eb0c=_0x21eb0c||0xcc;return function(_0x47d5be){if(_0x47d5be){return _0x57d24d[_0xb421('0x1b')](_0x21eb0c);}return _0x57d24d['status'](_0x21eb0c)[_0xb421('0x1c')]();};}function respondWithResult(_0x2ebeb9,_0x38cee6){_0x38cee6=_0x38cee6||0xc8;return function(_0x5a0535){if(_0x5a0535){return _0x2ebeb9['status'](_0x38cee6)[_0xb421('0x1d')](_0x5a0535);}};}function respondWithFilteredResult(_0x4c80f5,_0x346594){return function(_0x12b58a){if(_0x12b58a){var _0x3d9e06=typeof _0x346594[_0xb421('0x1e')]==='undefined'&&typeof _0x346594[_0xb421('0x1f')]===_0xb421('0x20');var _0xc521cb=_0x12b58a['count'];var _0x4ed8a4=_0x3d9e06?0x0:_0x346594['offset'];var _0x1f4f85=_0x3d9e06?_0x12b58a['count']:_0x346594[_0xb421('0x1e')]+_0x346594[_0xb421('0x1f')];var _0x18b1a8;if(_0x1f4f85>=_0xc521cb){_0x1f4f85=_0xc521cb;_0x18b1a8=0xc8;}else{_0x18b1a8=0xce;}_0x4c80f5[_0xb421('0x21')](_0x18b1a8);return _0x4c80f5[_0xb421('0x22')]('Content-Range',_0x4ed8a4+'-'+_0x1f4f85+'/'+_0xc521cb)[_0xb421('0x1d')](_0x12b58a);}return null;};}function patchUpdates(_0x448df8){return function(_0x424c09){try{jsonpatch[_0xb421('0x23')](_0x424c09,_0x448df8,!![]);}catch(_0x45938f){return BPromise[_0xb421('0x24')](_0x45938f);}return _0x424c09[_0xb421('0x25')]();};}function saveUpdates(_0x1b0954,_0x122c11){return function(_0x2df1ff){if(_0x2df1ff){return _0x2df1ff[_0xb421('0x26')](_0x1b0954)[_0xb421('0x27')](function(_0x270d1e){return _0x270d1e;});}return null;};}function removeEntity(_0x274d0c,_0x1e1afa){return function(_0x2685a5){if(_0x2685a5){return _0x2685a5[_0xb421('0x28')]()[_0xb421('0x27')](function(){_0x274d0c[_0xb421('0x21')](0xcc)[_0xb421('0x1c')]();});}};}function handleEntityNotFound(_0x32d855,_0x230b6e){return function(_0x5aa62e){if(!_0x5aa62e){_0x32d855['sendStatus'](0x194);}return _0x5aa62e;};}function handleError(_0x153fde,_0x267c89){_0x267c89=_0x267c89||0x1f4;return function(_0x4f78a2){logger[_0xb421('0x29')](_0x4f78a2[_0xb421('0x2a')]);if(_0x4f78a2['name']){delete _0x4f78a2['name'];}_0x153fde[_0xb421('0x21')](_0x267c89)[_0xb421('0x2b')](_0x4f78a2);};}exports[_0xb421('0x2c')]=function(_0x2654bf,_0x10fba0){var _0x58dfb5={},_0x28c143={},_0x3ccdea={'count':0x0,'rows':[]};var _0x37eff3=_['map'](db[_0xb421('0x2d')][_0xb421('0x2e')],function(_0x21b4bb){return{'name':_0x21b4bb['fieldName'],'type':_0x21b4bb[_0xb421('0x2f')][_0xb421('0x30')]};});_0x28c143[_0xb421('0x31')]=_[_0xb421('0x32')](_0x37eff3,_0xb421('0x33'));_0x28c143[_0xb421('0x34')]=_['keys'](_0x2654bf[_0xb421('0x34')]);_0x28c143[_0xb421('0x35')]=_['intersection'](_0x28c143[_0xb421('0x31')],_0x28c143[_0xb421('0x34')]);_0x58dfb5[_0xb421('0x36')]=_[_0xb421('0x37')](_0x28c143[_0xb421('0x31')],qs[_0xb421('0x38')](_0x2654bf[_0xb421('0x34')][_0xb421('0x38')]));_0x58dfb5[_0xb421('0x36')]=_0x58dfb5['attributes']['length']?_0x58dfb5[_0xb421('0x36')]:_0x28c143['model'];if(!_0x2654bf[_0xb421('0x34')][_0xb421('0x39')](_0xb421('0x3a'))){_0x58dfb5[_0xb421('0x1f')]=qs[_0xb421('0x1f')](_0x2654bf[_0xb421('0x34')]['limit']);_0x58dfb5[_0xb421('0x1e')]=qs[_0xb421('0x1e')](_0x2654bf[_0xb421('0x34')][_0xb421('0x1e')]);}_0x58dfb5[_0xb421('0x3b')]=qs[_0xb421('0x3c')](_0x2654bf['query']['sort']);_0x58dfb5['where']=qs[_0xb421('0x35')](_[_0xb421('0x3d')](_0x2654bf[_0xb421('0x34')],_0x28c143[_0xb421('0x35')]),_0x37eff3);if(_0x2654bf[_0xb421('0x34')][_0xb421('0x3e')]){_0x58dfb5[_0xb421('0x3f')]=_[_0xb421('0x40')](_0x58dfb5[_0xb421('0x3f')],{'$or':_[_0xb421('0x32')](_0x37eff3,function(_0x341c72){if(_0x341c72[_0xb421('0x2f')]!==_0xb421('0x41')){var _0x157dad={};_0x157dad[_0x341c72['name']]={'$like':'%'+_0x2654bf['query'][_0xb421('0x3e')]+'%'};return _0x157dad;}})});}_0x58dfb5=_[_0xb421('0x40')]({},_0x58dfb5,_0x2654bf['options']);var _0x4982b1={'where':_0x58dfb5[_0xb421('0x3f')]};return db[_0xb421('0x2d')][_0xb421('0x42')](_0x4982b1)[_0xb421('0x27')](function(_0x15076d){_0x3ccdea[_0xb421('0x42')]=_0x15076d;if(_0x2654bf[_0xb421('0x34')]['includeAll']){_0x58dfb5[_0xb421('0x43')]=[{'all':!![]}];}return db[_0xb421('0x2d')]['findAll'](_0x58dfb5);})[_0xb421('0x27')](function(_0x1e03e4){_0x3ccdea[_0xb421('0x44')]=_0x1e03e4;return _0x3ccdea;})[_0xb421('0x27')](respondWithFilteredResult(_0x10fba0,_0x58dfb5))[_0xb421('0x45')](handleError(_0x10fba0,null));};exports[_0xb421('0x46')]=function(_0xde94d6,_0x3c66f7){var _0x26f927={'raw':![],'where':{'id':_0xde94d6[_0xb421('0x47')]['id']}},_0xa311f3={};_0xa311f3[_0xb421('0x31')]=_[_0xb421('0x48')](db[_0xb421('0x2d')]['rawAttributes']);_0xa311f3[_0xb421('0x34')]=_[_0xb421('0x48')](_0xde94d6[_0xb421('0x34')]);_0xa311f3['filters']=_[_0xb421('0x37')](_0xa311f3['model'],_0xa311f3['query']);_0x26f927[_0xb421('0x36')]=_[_0xb421('0x37')](_0xa311f3[_0xb421('0x31')],qs['fields'](_0xde94d6['query'][_0xb421('0x38')]));_0x26f927['attributes']=_0x26f927[_0xb421('0x36')][_0xb421('0x49')]?_0x26f927[_0xb421('0x36')]:_0xa311f3[_0xb421('0x31')];if(_0xde94d6['query'][_0xb421('0x4a')]){_0x26f927[_0xb421('0x43')]=[{'all':!![]}];}_0x26f927=_[_0xb421('0x40')]({},_0x26f927,_0xde94d6[_0xb421('0x4b')]);return db[_0xb421('0x2d')][_0xb421('0x4c')](_0x26f927)[_0xb421('0x27')](handleEntityNotFound(_0x3c66f7,null))[_0xb421('0x27')](respondWithResult(_0x3c66f7,null))[_0xb421('0x45')](handleError(_0x3c66f7,null));};exports[_0xb421('0x4d')]=function(_0x59a9b7,_0x41fd46){return db['DeskAccount'][_0xb421('0x4d')](_0x59a9b7['body'],{})['then'](respondWithResult(_0x41fd46,0xc9))[_0xb421('0x45')](handleError(_0x41fd46,null));};exports[_0xb421('0x26')]=function(_0x3a5dfe,_0x5a906f){if(_0x3a5dfe['body']['id']){delete _0x3a5dfe['body']['id'];}return db[_0xb421('0x2d')]['find']({'where':{'id':_0x3a5dfe[_0xb421('0x47')]['id']}})[_0xb421('0x27')](handleEntityNotFound(_0x5a906f,null))['then'](saveUpdates(_0x3a5dfe[_0xb421('0x4e')],null))[_0xb421('0x27')](respondWithResult(_0x5a906f,null))[_0xb421('0x45')](handleError(_0x5a906f,null));};exports[_0xb421('0x28')]=function(_0x207096,_0x3f19bd){return db['DeskAccount'][_0xb421('0x4c')]({'where':{'id':_0x207096[_0xb421('0x47')]['id']}})[_0xb421('0x27')](handleEntityNotFound(_0x3f19bd,null))[_0xb421('0x27')](removeEntity(_0x3f19bd,null))[_0xb421('0x45')](handleError(_0x3f19bd,null));};exports['getConfigurations']=function(_0x4ec4de,_0x2c7ae8,_0xb6a3f7){var _0x1a8086={};var _0xdc1fd1={};var _0x5dd5be;var _0x5e0d5c;return db['DeskAccount']['findOne']({'where':{'id':_0x4ec4de[_0xb421('0x47')]['id']}})['then'](handleEntityNotFound(_0x2c7ae8,null))[_0xb421('0x27')](function(_0x3fe36c){if(_0x3fe36c){_0x5dd5be=_0x3fe36c;_0xdc1fd1[_0xb421('0x31')]=_[_0xb421('0x48')](db[_0xb421('0x4f')][_0xb421('0x2e')]);_0xdc1fd1['query']=_[_0xb421('0x48')](_0x4ec4de['query']);_0xdc1fd1[_0xb421('0x35')]=_[_0xb421('0x37')](_0xdc1fd1[_0xb421('0x31')],_0xdc1fd1['query']);_0x1a8086['attributes']=_[_0xb421('0x37')](_0xdc1fd1[_0xb421('0x31')],qs['fields'](_0x4ec4de[_0xb421('0x34')]['fields']));_0x1a8086[_0xb421('0x36')]=_0x1a8086[_0xb421('0x36')][_0xb421('0x49')]?_0x1a8086['attributes']:_0xdc1fd1[_0xb421('0x31')];_0x1a8086[_0xb421('0x3b')]=qs[_0xb421('0x3c')](_0x4ec4de[_0xb421('0x34')][_0xb421('0x3c')]);_0x1a8086[_0xb421('0x3f')]=qs['filters'](_[_0xb421('0x3d')](_0x4ec4de[_0xb421('0x34')],_0xdc1fd1[_0xb421('0x35')]));if(_0x4ec4de[_0xb421('0x34')][_0xb421('0x3e')]){_0x1a8086['where']=_[_0xb421('0x40')](_0x1a8086[_0xb421('0x3f')],{'$or':_[_0xb421('0x32')](_0x1a8086[_0xb421('0x36')],function(_0x44a244){var _0x361d7e={};_0x361d7e[_0x44a244]={'$like':'%'+_0x4ec4de['query'][_0xb421('0x3e')]+'%'};return _0x361d7e;})});}_0x1a8086=_['merge']({},_0x1a8086,_0x4ec4de[_0xb421('0x4b')]);return _0x5dd5be[_0xb421('0x50')](_0x1a8086);}})[_0xb421('0x27')](function(_0xe85669){if(_0xe85669){_0x5e0d5c=_0xe85669[_0xb421('0x49')];if(!_0x4ec4de[_0xb421('0x34')][_0xb421('0x39')](_0xb421('0x3a'))){_0x1a8086[_0xb421('0x1f')]=qs[_0xb421('0x1f')](_0x4ec4de[_0xb421('0x34')]['limit']);_0x1a8086['offset']=qs[_0xb421('0x1e')](_0x4ec4de['query'][_0xb421('0x1e')]);}return _0x5dd5be['getConfigurations'](_0x1a8086);}})['then'](function(_0x574854){if(_0x574854){return _0x574854?{'count':_0x5e0d5c,'rows':_0x574854}:null;}})[_0xb421('0x27')](respondWithResult(_0x2c7ae8,null))[_0xb421('0x45')](handleError(_0x2c7ae8,null));};exports[_0xb421('0x51')]=function(_0x38981a,_0x441258,_0x23c47b){if(_0x38981a['body']['id']){delete _0x38981a['body']['id'];}return db['DeskAccount'][_0xb421('0x52')]({'where':{'id':_0x38981a[_0xb421('0x47')]['id']}})[_0xb421('0x27')](handleEntityNotFound(_0x441258,null))['then'](function(_0x20c3d3){if(_0x20c3d3){_0x38981a[_0xb421('0x4e')][_0xb421('0x53')]=_0x20c3d3['id'];_0x38981a['body']['Subjects']=integrations[_0xb421('0x54')](_0x38981a[_0xb421('0x4e')][_0xb421('0x55')],_0x38981a['body'][_0xb421('0x2f')]);_0x38981a['body'][_0xb421('0x56')]=integrations['getDescriptions'](_0x38981a['body'][_0xb421('0x55')],_0x38981a[_0xb421('0x4e')]['type']);return db[_0xb421('0x4f')][_0xb421('0x4d')](_0x38981a[_0xb421('0x4e')],{'include':[{'model':db[_0xb421('0x57')],'as':_0xb421('0x58')},{'model':db[_0xb421('0x57')],'as':_0xb421('0x56')}]});}return null;})[_0xb421('0x27')](respondWithResult(_0x441258,null))['catch'](handleError(_0x441258,null));};exports['getFields']=function(_0x5100a5,_0x418997,_0x3a5f9e){var _0x30f549=[{'name':_0xb421('0x59'),'label':_0xb421('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 _0x2da13a='';return db['DeskAccount'][_0xb421('0x52')]({'where':{'id':_0x5100a5[_0xb421('0x47')]['id']},'attributes':['id',_0xb421('0x5a'),'authType',_0xb421('0x5b'),_0xb421('0x5c'),_0xb421('0x5d'),'consumerSecret',_0xb421('0x5e'),'tokenSecret']})[_0xb421('0x27')](handleEntityNotFound(_0x418997,null))[_0xb421('0x27')](function(_0x2f26a1){if(_0x2f26a1){_0x2da13a=_0x2f26a1['remoteUri'];var _0x8dfbb5=_0x2da13a['slice'](-0x1);if(_0x8dfbb5==='/'){_0x2da13a=_0x2da13a[_0xb421('0x5f')](0x0,_0x2da13a[_0xb421('0x60')](_0x8dfbb5));}var _0x1ccb56={'method':'GET','uri':util['format'](_0xb421('0x61'),_0x2da13a),'headers':{'Content-Type':_0xb421('0x62'),'Accept':_0xb421('0x62')},'json':!![]};if(_0x2f26a1[_0xb421('0x63')]==='basic'){_0x1ccb56[_0xb421('0x64')][_0xb421('0x65')]=util[_0xb421('0x66')](_0xb421('0x67'),new Buffer(util[_0xb421('0x66')](_0xb421('0x68'),_0x2f26a1[_0xb421('0x5b')],_0x2f26a1[_0xb421('0x5c')]))['toString']('base64'));}return rp(_0x1ccb56)[_0xb421('0x27')](function(_0x2af939){return _0x30f549[_0xb421('0x69')](_['map'](_0x2af939[_0xb421('0x6a')][_0xb421('0x6b')],function(_0x572cfe){return{'id':_0x572cfe['name'],'name':_0x572cfe[_0xb421('0x33')],'type':_0x572cfe['type'],'active':_0x572cfe[_0xb421('0x6c')],'label':_0x572cfe[_0xb421('0x6d')],'custom':!![]};}));});}})['then'](function(_0x15ddbe){return{'count':_0x15ddbe[_0xb421('0x49')],'rows':_0x15ddbe};})[_0xb421('0x27')](respondWithResult(_0x418997,null))[_0xb421('0x45')](function(_0x17d3c3){var _0x5e5340=_0x5100a5[_0xb421('0x34')]['test']?0x1f4:_0x17d3c3[_0xb421('0x6e')]||0x1f4;logger['error'](_0xb421('0x6f'),_0xb421('0x70'),_0x5e5340,JSON[_0xb421('0x71')](_0x17d3c3));delete _0x17d3c3[_0xb421('0x33')];if(_0x5e5340===0x191){_0x5e5340=0x190;}_0x418997[_0xb421('0x21')](_0x5e5340)[_0xb421('0x2b')](_0x5100a5[_0xb421('0x34')]['test']?{'message':_0xb421('0x72'),'statusCode':_0x17d3c3[_0xb421('0x6e')]}:_0x17d3c3);});}; \ No newline at end of file +var _0xaff3=['status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','DeskAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','DeskField','Subjects','getFields','priority','remoteUri','authType','password','token','tokenSecret','slice','substring','lastIndexOf','format','application/json','basic','Authorization','%s:%s','username','toString','entries','active','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x3272b5,_0x95e31a){var _0x10b83c=function(_0x191825){while(--_0x191825){_0x3272b5['push'](_0x3272b5['shift']());}};_0x10b83c(++_0x95e31a);}(_0xaff3,0xc1));var _0x3aff=function(_0x3bb995,_0x523a43){_0x3bb995=_0x3bb995-0x0;var _0x27c7f1=_0xaff3[_0x3bb995];return _0x27c7f1;};'use strict';var emlformat=require(_0x3aff('0x0'));var rimraf=require(_0x3aff('0x1'));var zipdir=require(_0x3aff('0x2'));var jsonpatch=require(_0x3aff('0x3'));var rp=require(_0x3aff('0x4'));var moment=require(_0x3aff('0x5'));var BPromise=require(_0x3aff('0x6'));var Mustache=require(_0x3aff('0x7'));var util=require('util');var path=require(_0x3aff('0x8'));var sox=require(_0x3aff('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3aff('0xa'));var squel=require(_0x3aff('0xb'));var crypto=require(_0x3aff('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3aff('0xd'));var toCsv=require(_0x3aff('0xe'));var querystring=require(_0x3aff('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3aff('0x10'));var qs=require(_0x3aff('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3aff('0x12'));var logger=require(_0x3aff('0x13'))(_0x3aff('0x14'));var utils=require(_0x3aff('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3aff('0x16'));var db=require(_0x3aff('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2c8ac9,_0x230b51){_0x230b51=_0x230b51||0xcc;return function(_0x11e658){if(_0x11e658){return _0x2c8ac9[_0x3aff('0x18')](_0x230b51);}return _0x2c8ac9[_0x3aff('0x19')](_0x230b51)[_0x3aff('0x1a')]();};}function respondWithResult(_0x1e91af,_0x55cdd9){_0x55cdd9=_0x55cdd9||0xc8;return function(_0x3c0037){if(_0x3c0037){return _0x1e91af['status'](_0x55cdd9)[_0x3aff('0x1b')](_0x3c0037);}};}function respondWithFilteredResult(_0x2a4920,_0x1140c1){return function(_0x52d3a0){if(_0x52d3a0){var _0x45a13d=typeof _0x1140c1[_0x3aff('0x1c')]==='undefined'&&typeof _0x1140c1[_0x3aff('0x1d')]===_0x3aff('0x1e');var _0x36d3ae=_0x52d3a0[_0x3aff('0x1f')];var _0x16a764=_0x45a13d?0x0:_0x1140c1['offset'];var _0x19c98e=_0x45a13d?_0x52d3a0['count']:_0x1140c1[_0x3aff('0x1c')]+_0x1140c1['limit'];var _0x1146fa;if(_0x19c98e>=_0x36d3ae){_0x19c98e=_0x36d3ae;_0x1146fa=0xc8;}else{_0x1146fa=0xce;}_0x2a4920[_0x3aff('0x19')](_0x1146fa);return _0x2a4920[_0x3aff('0x20')](_0x3aff('0x21'),_0x16a764+'-'+_0x19c98e+'/'+_0x36d3ae)[_0x3aff('0x1b')](_0x52d3a0);}return null;};}function patchUpdates(_0x53ab98){return function(_0x3f2841){try{jsonpatch[_0x3aff('0x22')](_0x3f2841,_0x53ab98,!![]);}catch(_0x245746){return BPromise[_0x3aff('0x23')](_0x245746);}return _0x3f2841[_0x3aff('0x24')]();};}function saveUpdates(_0x7fd0b8,_0xd164a0){return function(_0x207a68){if(_0x207a68){return _0x207a68[_0x3aff('0x25')](_0x7fd0b8)[_0x3aff('0x26')](function(_0x29f0d7){return _0x29f0d7;});}return null;};}function removeEntity(_0x1bed64,_0x2f0a06){return function(_0x1ac862){if(_0x1ac862){return _0x1ac862[_0x3aff('0x27')]()[_0x3aff('0x26')](function(){_0x1bed64[_0x3aff('0x19')](0xcc)[_0x3aff('0x1a')]();});}};}function handleEntityNotFound(_0x5481a3,_0xc098d3){return function(_0x14f4fe){if(!_0x14f4fe){_0x5481a3[_0x3aff('0x18')](0x194);}return _0x14f4fe;};}function handleError(_0x2815f1,_0x33e19c){_0x33e19c=_0x33e19c||0x1f4;return function(_0xe28dd0){logger[_0x3aff('0x28')](_0xe28dd0[_0x3aff('0x29')]);if(_0xe28dd0[_0x3aff('0x2a')]){delete _0xe28dd0[_0x3aff('0x2a')];}_0x2815f1[_0x3aff('0x19')](_0x33e19c)['send'](_0xe28dd0);};}exports['index']=function(_0xed95a,_0x341272){var _0x36cf50={},_0x5674c9={},_0x3fbf0c={'count':0x0,'rows':[]};var _0x506768=_['map'](db[_0x3aff('0x2b')][_0x3aff('0x2c')],function(_0x3ba221){return{'name':_0x3ba221[_0x3aff('0x2d')],'type':_0x3ba221['type'][_0x3aff('0x2e')]};});_0x5674c9[_0x3aff('0x2f')]=_[_0x3aff('0x30')](_0x506768,_0x3aff('0x2a'));_0x5674c9[_0x3aff('0x31')]=_[_0x3aff('0x32')](_0xed95a[_0x3aff('0x31')]);_0x5674c9[_0x3aff('0x33')]=_[_0x3aff('0x34')](_0x5674c9['model'],_0x5674c9[_0x3aff('0x31')]);_0x36cf50[_0x3aff('0x35')]=_[_0x3aff('0x34')](_0x5674c9[_0x3aff('0x2f')],qs[_0x3aff('0x36')](_0xed95a[_0x3aff('0x31')]['fields']));_0x36cf50[_0x3aff('0x35')]=_0x36cf50[_0x3aff('0x35')][_0x3aff('0x37')]?_0x36cf50[_0x3aff('0x35')]:_0x5674c9[_0x3aff('0x2f')];if(!_0xed95a[_0x3aff('0x31')][_0x3aff('0x38')](_0x3aff('0x39'))){_0x36cf50[_0x3aff('0x1d')]=qs[_0x3aff('0x1d')](_0xed95a['query'][_0x3aff('0x1d')]);_0x36cf50['offset']=qs[_0x3aff('0x1c')](_0xed95a[_0x3aff('0x31')][_0x3aff('0x1c')]);}_0x36cf50[_0x3aff('0x3a')]=qs[_0x3aff('0x3b')](_0xed95a[_0x3aff('0x31')][_0x3aff('0x3b')]);_0x36cf50['where']=qs[_0x3aff('0x33')](_[_0x3aff('0x3c')](_0xed95a[_0x3aff('0x31')],_0x5674c9['filters']),_0x506768);if(_0xed95a[_0x3aff('0x31')]['filter']){_0x36cf50[_0x3aff('0x3d')]=_[_0x3aff('0x3e')](_0x36cf50['where'],{'$or':_[_0x3aff('0x30')](_0x506768,function(_0x5acc71){if(_0x5acc71[_0x3aff('0x3f')]!=='VIRTUAL'){var _0x5ef8e3={};_0x5ef8e3[_0x5acc71['name']]={'$like':'%'+_0xed95a['query'][_0x3aff('0x40')]+'%'};return _0x5ef8e3;}})});}_0x36cf50=_[_0x3aff('0x3e')]({},_0x36cf50,_0xed95a[_0x3aff('0x41')]);var _0x203666={'where':_0x36cf50['where']};return db['DeskAccount'][_0x3aff('0x1f')](_0x203666)[_0x3aff('0x26')](function(_0x43f68c){_0x3fbf0c[_0x3aff('0x1f')]=_0x43f68c;if(_0xed95a[_0x3aff('0x31')][_0x3aff('0x42')]){_0x36cf50[_0x3aff('0x43')]=[{'all':!![]}];}return db[_0x3aff('0x2b')][_0x3aff('0x44')](_0x36cf50);})[_0x3aff('0x26')](function(_0x334563){_0x3fbf0c[_0x3aff('0x45')]=_0x334563;return _0x3fbf0c;})[_0x3aff('0x26')](respondWithFilteredResult(_0x341272,_0x36cf50))[_0x3aff('0x46')](handleError(_0x341272,null));};exports[_0x3aff('0x47')]=function(_0x162d5a,_0x976858){var _0x55bb88={'raw':![],'where':{'id':_0x162d5a[_0x3aff('0x48')]['id']}},_0x5074f8={};_0x5074f8[_0x3aff('0x2f')]=_[_0x3aff('0x32')](db['DeskAccount']['rawAttributes']);_0x5074f8['query']=_[_0x3aff('0x32')](_0x162d5a[_0x3aff('0x31')]);_0x5074f8[_0x3aff('0x33')]=_[_0x3aff('0x34')](_0x5074f8[_0x3aff('0x2f')],_0x5074f8['query']);_0x55bb88[_0x3aff('0x35')]=_[_0x3aff('0x34')](_0x5074f8[_0x3aff('0x2f')],qs['fields'](_0x162d5a[_0x3aff('0x31')]['fields']));_0x55bb88['attributes']=_0x55bb88[_0x3aff('0x35')][_0x3aff('0x37')]?_0x55bb88[_0x3aff('0x35')]:_0x5074f8[_0x3aff('0x2f')];if(_0x162d5a[_0x3aff('0x31')][_0x3aff('0x42')]){_0x55bb88[_0x3aff('0x43')]=[{'all':!![]}];}_0x55bb88=_[_0x3aff('0x3e')]({},_0x55bb88,_0x162d5a[_0x3aff('0x41')]);return db[_0x3aff('0x2b')][_0x3aff('0x49')](_0x55bb88)['then'](handleEntityNotFound(_0x976858,null))[_0x3aff('0x26')](respondWithResult(_0x976858,null))[_0x3aff('0x46')](handleError(_0x976858,null));};exports[_0x3aff('0x4a')]=function(_0x5a2122,_0x24c304){return db[_0x3aff('0x2b')][_0x3aff('0x4a')](_0x5a2122[_0x3aff('0x4b')],{})[_0x3aff('0x26')](respondWithResult(_0x24c304,0xc9))['catch'](handleError(_0x24c304,null));};exports['update']=function(_0x67d3e5,_0x498ab7){if(_0x67d3e5[_0x3aff('0x4b')]['id']){delete _0x67d3e5[_0x3aff('0x4b')]['id'];}return db[_0x3aff('0x2b')][_0x3aff('0x49')]({'where':{'id':_0x67d3e5[_0x3aff('0x48')]['id']}})[_0x3aff('0x26')](handleEntityNotFound(_0x498ab7,null))['then'](saveUpdates(_0x67d3e5[_0x3aff('0x4b')],null))['then'](respondWithResult(_0x498ab7,null))['catch'](handleError(_0x498ab7,null));};exports['destroy']=function(_0x1dc1b0,_0x5511f2){return db['DeskAccount'][_0x3aff('0x49')]({'where':{'id':_0x1dc1b0['params']['id']}})['then'](handleEntityNotFound(_0x5511f2,null))[_0x3aff('0x26')](removeEntity(_0x5511f2,null))['catch'](handleError(_0x5511f2,null));};exports[_0x3aff('0x4c')]=function(_0x288d35,_0x5e79eb,_0x11eb1e){var _0x453857={};var _0x20db32={};var _0x2bc98a;var _0x2b2589;return db[_0x3aff('0x2b')][_0x3aff('0x4d')]({'where':{'id':_0x288d35[_0x3aff('0x48')]['id']}})[_0x3aff('0x26')](handleEntityNotFound(_0x5e79eb,null))['then'](function(_0x1ca8ff){if(_0x1ca8ff){_0x2bc98a=_0x1ca8ff;_0x20db32[_0x3aff('0x2f')]=_[_0x3aff('0x32')](db['DeskConfiguration'][_0x3aff('0x2c')]);_0x20db32[_0x3aff('0x31')]=_[_0x3aff('0x32')](_0x288d35['query']);_0x20db32[_0x3aff('0x33')]=_[_0x3aff('0x34')](_0x20db32[_0x3aff('0x2f')],_0x20db32[_0x3aff('0x31')]);_0x453857[_0x3aff('0x35')]=_['intersection'](_0x20db32[_0x3aff('0x2f')],qs[_0x3aff('0x36')](_0x288d35['query']['fields']));_0x453857[_0x3aff('0x35')]=_0x453857[_0x3aff('0x35')]['length']?_0x453857['attributes']:_0x20db32[_0x3aff('0x2f')];_0x453857[_0x3aff('0x3a')]=qs[_0x3aff('0x3b')](_0x288d35[_0x3aff('0x31')][_0x3aff('0x3b')]);_0x453857[_0x3aff('0x3d')]=qs[_0x3aff('0x33')](_[_0x3aff('0x3c')](_0x288d35['query'],_0x20db32[_0x3aff('0x33')]));if(_0x288d35['query'][_0x3aff('0x40')]){_0x453857[_0x3aff('0x3d')]=_['merge'](_0x453857[_0x3aff('0x3d')],{'$or':_[_0x3aff('0x30')](_0x453857[_0x3aff('0x35')],function(_0x236a5e){var _0x154cd5={};_0x154cd5[_0x236a5e]={'$like':'%'+_0x288d35[_0x3aff('0x31')][_0x3aff('0x40')]+'%'};return _0x154cd5;})});}_0x453857=_[_0x3aff('0x3e')]({},_0x453857,_0x288d35['options']);return _0x2bc98a[_0x3aff('0x4c')](_0x453857);}})[_0x3aff('0x26')](function(_0x3311c9){if(_0x3311c9){_0x2b2589=_0x3311c9[_0x3aff('0x37')];if(!_0x288d35[_0x3aff('0x31')][_0x3aff('0x38')](_0x3aff('0x39'))){_0x453857[_0x3aff('0x1d')]=qs[_0x3aff('0x1d')](_0x288d35[_0x3aff('0x31')][_0x3aff('0x1d')]);_0x453857[_0x3aff('0x1c')]=qs['offset'](_0x288d35['query'][_0x3aff('0x1c')]);}return _0x2bc98a[_0x3aff('0x4c')](_0x453857);}})[_0x3aff('0x26')](function(_0x3e206e){if(_0x3e206e){return _0x3e206e?{'count':_0x2b2589,'rows':_0x3e206e}:null;}})[_0x3aff('0x26')](respondWithResult(_0x5e79eb,null))['catch'](handleError(_0x5e79eb,null));};exports[_0x3aff('0x4e')]=function(_0x309687,_0x4af8f0,_0x215915){if(_0x309687[_0x3aff('0x4b')]['id']){delete _0x309687[_0x3aff('0x4b')]['id'];}return db[_0x3aff('0x2b')][_0x3aff('0x4d')]({'where':{'id':_0x309687['params']['id']}})[_0x3aff('0x26')](handleEntityNotFound(_0x4af8f0,null))[_0x3aff('0x26')](function(_0xe79071){if(_0xe79071){_0x309687[_0x3aff('0x4b')][_0x3aff('0x4f')]=_0xe79071['id'];_0x309687[_0x3aff('0x4b')]['Subjects']=integrations[_0x3aff('0x50')](_0x309687[_0x3aff('0x4b')][_0x3aff('0x51')],_0x309687[_0x3aff('0x4b')][_0x3aff('0x3f')]);_0x309687['body'][_0x3aff('0x52')]=integrations[_0x3aff('0x53')](_0x309687['body']['channel'],_0x309687[_0x3aff('0x4b')][_0x3aff('0x3f')]);return db['DeskConfiguration']['create'](_0x309687[_0x3aff('0x4b')],{'include':[{'model':db[_0x3aff('0x54')],'as':_0x3aff('0x55')},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0x3aff('0x26')](respondWithResult(_0x4af8f0,null))['catch'](handleError(_0x4af8f0,null));};exports[_0x3aff('0x56')]=function(_0x2a6aeb,_0x5ed4f9,_0x308dc9){var _0x3e50ee=[{'name':'priority','label':_0x3aff('0x57'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0xba29af='';return db[_0x3aff('0x2b')][_0x3aff('0x4d')]({'where':{'id':_0x2a6aeb[_0x3aff('0x48')]['id']},'attributes':['id',_0x3aff('0x58'),_0x3aff('0x59'),'username',_0x3aff('0x5a'),'consumerKey','consumerSecret',_0x3aff('0x5b'),_0x3aff('0x5c')]})['then'](handleEntityNotFound(_0x5ed4f9,null))[_0x3aff('0x26')](function(_0x3a203b){if(_0x3a203b){_0xba29af=_0x3a203b[_0x3aff('0x58')];var _0x9709a1=_0xba29af[_0x3aff('0x5d')](-0x1);if(_0x9709a1==='/'){_0xba29af=_0xba29af[_0x3aff('0x5e')](0x0,_0xba29af[_0x3aff('0x5f')](_0x9709a1));}var _0x4284a9={'method':'GET','uri':util[_0x3aff('0x60')]('%s/custom_fields',_0xba29af),'headers':{'Content-Type':_0x3aff('0x61'),'Accept':_0x3aff('0x61')},'json':!![]};if(_0x3a203b[_0x3aff('0x59')]===_0x3aff('0x62')){_0x4284a9['headers'][_0x3aff('0x63')]=util['format']('Basic\x20%s',new Buffer(util['format'](_0x3aff('0x64'),_0x3a203b[_0x3aff('0x65')],_0x3a203b[_0x3aff('0x5a')]))[_0x3aff('0x66')]('base64'));}return rp(_0x4284a9)[_0x3aff('0x26')](function(_0x51bfaf){return _0x3e50ee['concat'](_[_0x3aff('0x30')](_0x51bfaf['_embedded'][_0x3aff('0x67')],function(_0x1edd75){return{'id':_0x1edd75[_0x3aff('0x2a')],'name':_0x1edd75[_0x3aff('0x2a')],'type':_0x1edd75[_0x3aff('0x3f')],'active':_0x1edd75[_0x3aff('0x68')],'label':_0x1edd75['label'],'custom':!![]};}));});}})[_0x3aff('0x26')](function(_0x4279f1){return{'count':_0x4279f1[_0x3aff('0x37')],'rows':_0x4279f1};})[_0x3aff('0x26')](respondWithResult(_0x5ed4f9,null))[_0x3aff('0x46')](function(_0x2efb57){var _0x184aa4=_0x2a6aeb[_0x3aff('0x31')][_0x3aff('0x69')]?0x1f4:_0x2efb57['statusCode']||0x1f4;logger[_0x3aff('0x28')](_0x3aff('0x6a'),_0x3aff('0x56'),_0x184aa4,JSON['stringify'](_0x2efb57));delete _0x2efb57[_0x3aff('0x2a')];if(_0x184aa4===0x191){_0x184aa4=0x190;}_0x5ed4f9[_0x3aff('0x19')](_0x184aa4)[_0x3aff('0x6b')](_0x2a6aeb[_0x3aff('0x31')][_0x3aff('0x69')]?{'message':_0x3aff('0x6c'),'statusCode':_0x2efb57['statusCode']}:_0x2efb57);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 807742c..fa570d7 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 _0x1ea8=['./intDeskAccount.attributes','exports','define','DeskAccount','int_desk_accounts','lodash','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x340fce,_0x23af0e){var _0x322089=function(_0x269f02){while(--_0x269f02){_0x340fce['push'](_0x340fce['shift']());}};_0x322089(++_0x23af0e);}(_0x1ea8,0xb5));var _0x81ea=function(_0x374986,_0x1de34b){_0x374986=_0x374986-0x0;var _0x364745=_0x1ea8[_0x374986];return _0x364745;};'use strict';var _=require(_0x81ea('0x0'));var util=require('util');var logger=require(_0x81ea('0x1'))('api');var moment=require('moment');var BPromise=require(_0x81ea('0x2'));var rp=require(_0x81ea('0x3'));var fs=require('fs');var path=require(_0x81ea('0x4'));var rimraf=require(_0x81ea('0x5'));var config=require('../../config/environment');var attributes=require(_0x81ea('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x81ea('0x7')]=function(_0x342db5,_0x32a081){return _0x342db5[_0x81ea('0x8')](_0x81ea('0x9'),attributes,{'tableName':_0x81ea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdaa=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','int_desk_accounts','util','../../config/logger','api','moment','request-promise','path'];(function(_0x33e4a7,_0x2e80a2){var _0x598620=function(_0x65d618){while(--_0x65d618){_0x33e4a7['push'](_0x33e4a7['shift']());}};_0x598620(++_0x2e80a2);}(_0xfdaa,0x191));var _0xafda=function(_0x420513,_0x30eae3){_0x420513=_0x420513-0x0;var _0x1b44ec=_0xfdaa[_0x420513];return _0x1b44ec;};'use strict';var _=require('lodash');var util=require(_0xafda('0x0'));var logger=require(_0xafda('0x1'))(_0xafda('0x2'));var moment=require(_0xafda('0x3'));var BPromise=require('bluebird');var rp=require(_0xafda('0x4'));var fs=require('fs');var path=require(_0xafda('0x5'));var rimraf=require('rimraf');var config=require(_0xafda('0x6'));var attributes=require(_0xafda('0x7'));var integrations=require(_0xafda('0x8'));module['exports']=function(_0x5d5280,_0x2811f6){return _0x5d5280[_0xafda('0x9')]('DeskAccount',attributes,{'tableName':_0xafda('0xa'),'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 497dd9c..0a54261 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 _0x5a54=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowDeskAccount','find','debug','catch','moment','bluebird','randomstring'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x5a54,0x1a1));var _0x45a5=function(_0x2e2e40,_0x3459e6){_0x2e2e40=_0x2e2e40-0x0;var _0x277603=_0x5a54[_0x2e2e40];return _0x277603;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x45a5('0x0'));var BPromise=require(_0x45a5('0x1'));var rs=require(_0x45a5('0x2'));var fs=require('fs');var Redis=require(_0x45a5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x45a5('0x4'));var logger=require('../../config/logger')(_0x45a5('0x5'));var config=require(_0x45a5('0x6'));var jayson=require(_0x45a5('0x7'));var client=jayson[_0x45a5('0x8')][_0x45a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f75c9,_0xa73fdb,_0x55bbb1){return new BPromise(function(_0x52806e,_0x27a7c1){return client[_0x45a5('0xa')](_0x1f75c9,_0x55bbb1)[_0x45a5('0xb')](function(_0x3fc4bf){logger[_0x45a5('0xc')](_0x45a5('0xd'),_0xa73fdb,_0x45a5('0xe'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0xa73fdb,'request\x20sent',JSON[_0x45a5('0xf')](_0x3fc4bf));if(_0x3fc4bf['error']){if(_0x3fc4bf[_0x45a5('0x10')][_0x45a5('0x11')]===0x1f4){logger[_0x45a5('0x10')](_0x45a5('0xd'),_0xa73fdb,_0x3fc4bf[_0x45a5('0x10')][_0x45a5('0x12')]);return _0x27a7c1(_0x3fc4bf[_0x45a5('0x10')][_0x45a5('0x12')]);}logger[_0x45a5('0x10')]('DeskAccount,\x20%s,\x20%s',_0xa73fdb,_0x3fc4bf['error'][_0x45a5('0x12')]);return _0x52806e(_0x3fc4bf[_0x45a5('0x10')][_0x45a5('0x12')]);}else{logger[_0x45a5('0xc')](_0x45a5('0xd'),_0xa73fdb,_0x45a5('0xe'));_0x52806e(_0x3fc4bf[_0x45a5('0x13')][_0x45a5('0x12')]);}})['catch'](function(_0x58ecee){logger['error'](_0x45a5('0xd'),_0xa73fdb,_0x58ecee);_0x27a7c1(_0x58ecee);});});}exports[_0x45a5('0x14')]=function(_0x122e65){var _0x4b307e=this;return new Promise(function(_0x34be50,_0x5dfabf){return db[_0x45a5('0x15')][_0x45a5('0x16')]({'raw':_0x122e65[_0x45a5('0x17')]?_0x122e65['options'][_0x45a5('0x18')]===undefined?!![]:![]:!![],'where':_0x122e65[_0x45a5('0x17')]?_0x122e65[_0x45a5('0x17')][_0x45a5('0x19')]||null:null,'attributes':_0x122e65['options']?_0x122e65[_0x45a5('0x17')][_0x45a5('0x1a')]||null:null,'limit':_0x122e65['options']?_0x122e65[_0x45a5('0x17')][_0x45a5('0x1b')]||null:null,'include':_0x122e65[_0x45a5('0x17')]?_0x122e65['options'][_0x45a5('0x1c')]?_[_0x45a5('0x1d')](_0x122e65['options'][_0x45a5('0x1c')],function(_0x5692fd){return{'model':db[_0x5692fd[_0x45a5('0x1e')]],'as':_0x5692fd['as'],'attributes':_0x5692fd['attributes'],'include':_0x5692fd['include']?_[_0x45a5('0x1d')](_0x5692fd[_0x45a5('0x1c')],function(_0x2f0aa5){return{'model':db[_0x2f0aa5[_0x45a5('0x1e')]],'as':_0x2f0aa5['as'],'attributes':_0x2f0aa5['attributes'],'include':_0x2f0aa5[_0x45a5('0x1c')]?_[_0x45a5('0x1d')](_0x2f0aa5[_0x45a5('0x1c')],function(_0x51d589){return{'model':db[_0x51d589['model']],'as':_0x51d589['as'],'attributes':_0x51d589['attributes']};}):[]};}):[]};}):[]:[]})[_0x45a5('0xb')](function(_0x33e665){logger[_0x45a5('0xc')](_0x45a5('0x14'),_0x122e65);logger['debug'](_0x45a5('0x14'),_0x122e65,JSON[_0x45a5('0xf')](_0x33e665));_0x34be50(_0x33e665);})['catch'](function(_0xd77281){logger[_0x45a5('0x10')]('GetDeskAccount',_0xd77281['message'],_0x122e65);_0x5dfabf(_0x4b307e[_0x45a5('0x10')](0x1f4,_0xd77281[_0x45a5('0x12')]));});});};exports[_0x45a5('0x1f')]=function(_0x1c69f3){var _0x1f2c34=this;return new Promise(function(_0x39a9eb,_0x5d802c){return db[_0x45a5('0x15')][_0x45a5('0x20')]({'raw':_0x1c69f3[_0x45a5('0x17')]?_0x1c69f3[_0x45a5('0x17')][_0x45a5('0x18')]===undefined?!![]:![]:!![],'where':_0x1c69f3[_0x45a5('0x17')]?_0x1c69f3['options'][_0x45a5('0x19')]||null:null,'attributes':_0x1c69f3[_0x45a5('0x17')]?_0x1c69f3[_0x45a5('0x17')][_0x45a5('0x1a')]||null:null,'include':_0x1c69f3['options']?_0x1c69f3['options'][_0x45a5('0x1c')]?_[_0x45a5('0x1d')](_0x1c69f3[_0x45a5('0x17')]['include'],function(_0x42a2de){return{'model':db[_0x42a2de[_0x45a5('0x1e')]],'as':_0x42a2de['as'],'attributes':_0x42a2de[_0x45a5('0x1a')],'include':_0x42a2de[_0x45a5('0x1c')]?_[_0x45a5('0x1d')](_0x42a2de[_0x45a5('0x1c')],function(_0x444f49){return{'model':db[_0x444f49[_0x45a5('0x1e')]],'as':_0x444f49['as'],'attributes':_0x444f49['attributes'],'include':_0x444f49[_0x45a5('0x1c')]?_[_0x45a5('0x1d')](_0x444f49[_0x45a5('0x1c')],function(_0x397816){return{'model':db[_0x397816['model']],'as':_0x397816['as'],'attributes':_0x397816[_0x45a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x45a5('0xb')](function(_0x4a5b33){logger[_0x45a5('0xc')](_0x45a5('0x1f'),_0x1c69f3);logger[_0x45a5('0x21')](_0x45a5('0x1f'),_0x1c69f3,JSON[_0x45a5('0xf')](_0x4a5b33));_0x39a9eb(_0x4a5b33);})[_0x45a5('0x22')](function(_0x1d4d34){logger[_0x45a5('0x10')]('ShowDeskAccount',_0x1d4d34['message'],_0x1c69f3);_0x5d802c(_0x1f2c34[_0x45a5('0x10')](0x1f4,_0x1d4d34['message']));});});}; \ No newline at end of file +var _0x2b90=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetDeskAccount','findAll','options','where','attributes','include','map','model','ShowDeskAccount','find','raw'];(function(_0x212537,_0x64c7f5){var _0x233b98=function(_0x9d0a4d){while(--_0x9d0a4d){_0x212537['push'](_0x212537['shift']());}};_0x233b98(++_0x64c7f5);}(_0x2b90,0xd2));var _0x02b9=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2b90[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x02b9('0x0'));var util=require(_0x02b9('0x1'));var moment=require(_0x02b9('0x2'));var BPromise=require(_0x02b9('0x3'));var rs=require(_0x02b9('0x4'));var fs=require('fs');var Redis=require(_0x02b9('0x5'));var db=require(_0x02b9('0x6'))['db'];var utils=require(_0x02b9('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x02b9('0x8'));var client=jayson[_0x02b9('0x9')][_0x02b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15da48,_0x25bb14,_0x8cd0a7){return new BPromise(function(_0x1c583c,_0x4ebf49){return client[_0x02b9('0xb')](_0x15da48,_0x8cd0a7)[_0x02b9('0xc')](function(_0x2165f8){logger['info'](_0x02b9('0xd'),_0x25bb14,_0x02b9('0xe'));logger[_0x02b9('0xf')](_0x02b9('0x10'),_0x25bb14,_0x02b9('0xe'),JSON[_0x02b9('0x11')](_0x2165f8));if(_0x2165f8[_0x02b9('0x12')]){if(_0x2165f8[_0x02b9('0x12')][_0x02b9('0x13')]===0x1f4){logger['error'](_0x02b9('0xd'),_0x25bb14,_0x2165f8['error']['message']);return _0x4ebf49(_0x2165f8['error'][_0x02b9('0x14')]);}logger[_0x02b9('0x12')]('DeskAccount,\x20%s,\x20%s',_0x25bb14,_0x2165f8['error'][_0x02b9('0x14')]);return _0x1c583c(_0x2165f8[_0x02b9('0x12')][_0x02b9('0x14')]);}else{logger[_0x02b9('0x15')]('DeskAccount,\x20%s,\x20%s',_0x25bb14,_0x02b9('0xe'));_0x1c583c(_0x2165f8[_0x02b9('0x16')][_0x02b9('0x14')]);}})[_0x02b9('0x17')](function(_0x2ef71d){logger['error'](_0x02b9('0xd'),_0x25bb14,_0x2ef71d);_0x4ebf49(_0x2ef71d);});});}exports[_0x02b9('0x18')]=function(_0x3ca8c0){var _0x58071b=this;return new Promise(function(_0x4c6d86,_0xcfeebc){return db['DeskAccount'][_0x02b9('0x19')]({'raw':_0x3ca8c0[_0x02b9('0x1a')]?_0x3ca8c0[_0x02b9('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3ca8c0[_0x02b9('0x1a')]?_0x3ca8c0[_0x02b9('0x1a')][_0x02b9('0x1b')]||null:null,'attributes':_0x3ca8c0['options']?_0x3ca8c0[_0x02b9('0x1a')][_0x02b9('0x1c')]||null:null,'limit':_0x3ca8c0['options']?_0x3ca8c0[_0x02b9('0x1a')]['limit']||null:null,'include':_0x3ca8c0[_0x02b9('0x1a')]?_0x3ca8c0[_0x02b9('0x1a')][_0x02b9('0x1d')]?_[_0x02b9('0x1e')](_0x3ca8c0[_0x02b9('0x1a')]['include'],function(_0x560642){return{'model':db[_0x560642[_0x02b9('0x1f')]],'as':_0x560642['as'],'attributes':_0x560642[_0x02b9('0x1c')],'include':_0x560642[_0x02b9('0x1d')]?_[_0x02b9('0x1e')](_0x560642[_0x02b9('0x1d')],function(_0x106d01){return{'model':db[_0x106d01[_0x02b9('0x1f')]],'as':_0x106d01['as'],'attributes':_0x106d01[_0x02b9('0x1c')],'include':_0x106d01['include']?_[_0x02b9('0x1e')](_0x106d01['include'],function(_0x5b7543){return{'model':db[_0x5b7543[_0x02b9('0x1f')]],'as':_0x5b7543['as'],'attributes':_0x5b7543[_0x02b9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x02b9('0xc')](function(_0x579a22){logger[_0x02b9('0x15')](_0x02b9('0x18'),_0x3ca8c0);logger['debug'](_0x02b9('0x18'),_0x3ca8c0,JSON['stringify'](_0x579a22));_0x4c6d86(_0x579a22);})[_0x02b9('0x17')](function(_0x357852){logger[_0x02b9('0x12')](_0x02b9('0x18'),_0x357852['message'],_0x3ca8c0);_0xcfeebc(_0x58071b[_0x02b9('0x12')](0x1f4,_0x357852[_0x02b9('0x14')]));});});};exports[_0x02b9('0x20')]=function(_0x209672){var _0x52b8d4=this;return new Promise(function(_0x367e9c,_0x49fe66){return db['DeskAccount'][_0x02b9('0x21')]({'raw':_0x209672['options']?_0x209672[_0x02b9('0x1a')][_0x02b9('0x22')]===undefined?!![]:![]:!![],'where':_0x209672[_0x02b9('0x1a')]?_0x209672['options'][_0x02b9('0x1b')]||null:null,'attributes':_0x209672[_0x02b9('0x1a')]?_0x209672['options'][_0x02b9('0x1c')]||null:null,'include':_0x209672[_0x02b9('0x1a')]?_0x209672[_0x02b9('0x1a')][_0x02b9('0x1d')]?_['map'](_0x209672[_0x02b9('0x1a')][_0x02b9('0x1d')],function(_0x328360){return{'model':db[_0x328360['model']],'as':_0x328360['as'],'attributes':_0x328360[_0x02b9('0x1c')],'include':_0x328360[_0x02b9('0x1d')]?_[_0x02b9('0x1e')](_0x328360[_0x02b9('0x1d')],function(_0x1fe292){return{'model':db[_0x1fe292[_0x02b9('0x1f')]],'as':_0x1fe292['as'],'attributes':_0x1fe292[_0x02b9('0x1c')],'include':_0x1fe292[_0x02b9('0x1d')]?_[_0x02b9('0x1e')](_0x1fe292[_0x02b9('0x1d')],function(_0x1af874){return{'model':db[_0x1af874[_0x02b9('0x1f')]],'as':_0x1af874['as'],'attributes':_0x1af874[_0x02b9('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c18b5){logger['info'](_0x02b9('0x20'),_0x209672);logger[_0x02b9('0xf')](_0x02b9('0x20'),_0x209672,JSON[_0x02b9('0x11')](_0x4c18b5));_0x367e9c(_0x4c18b5);})[_0x02b9('0x17')](function(_0xa37613){logger[_0x02b9('0x12')](_0x02b9('0x20'),_0xa37613[_0x02b9('0x14')],_0x209672);_0x49fe66(_0x52b8d4['error'](0x1f4,_0xa37613[_0x02b9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 4c7764a..d0a0c91 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 _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x403437,_0x2265a8){var _0x37e405=function(_0x33f7cf){while(--_0x33f7cf){_0x403437['push'](_0x403437['shift']());}};_0x37e405(++_0x2265a8);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file +var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x1b2e3c,_0x8c2564){var _0x52dc4d=function(_0x5be766){while(--_0x5be766){_0x1b2e3c['push'](_0x1b2e3c['shift']());}};_0x52dc4d(++_0x8c2564);}(_0xedd9,0xfc));var _0x9edd=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0xedd9[_0x5774be];return _0x4914b4;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index cedb29d..613a0ed 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 _0xc2a6=['exports','STRING','sequelize'];(function(_0x3cd025,_0x1e2adf){var _0xaa86eb=function(_0x1029d0){while(--_0x1029d0){_0x3cd025['push'](_0x3cd025['shift']());}};_0xaa86eb(++_0x1e2adf);}(_0xc2a6,0x134));var _0x6c2a=function(_0x2318bc,_0x2bd3cf){_0x2318bc=_0x2318bc-0x0;var _0xe17483=_0xc2a6[_0x2318bc];return _0xe17483;};'use strict';var Sequelize=require(_0x6c2a('0x0'));module[_0x6c2a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6c2a('0x2')]}}; \ No newline at end of file +var _0x527c=['sequelize','exports','STRING'];(function(_0x3a7cce,_0x3c415f){var _0x12849f=function(_0x538bee){while(--_0x538bee){_0x3a7cce['push'](_0x3a7cce['shift']());}};_0x12849f(++_0x3c415f);}(_0x527c,0x150));var _0xc527=function(_0x4cfc1d,_0x2c0927){_0x4cfc1d=_0x4cfc1d-0x0;var _0x1c01a0=_0x527c[_0x4cfc1d];return _0x1c01a0;};'use strict';var Sequelize=require(_0xc527('0x0'));module[_0xc527('0x1')]={'name':{'type':Sequelize[_0xc527('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 8f1c549..41c7ec9 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 _0x4e90=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','getFields','findOne','DeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','apply','reject','update','then','destroy','error','stack','name','send','index','map','DeskConfiguration','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','limit','order'];(function(_0x583a65,_0x5a6186){var _0x37e901=function(_0x24eacc){while(--_0x24eacc){_0x583a65['push'](_0x583a65['shift']());}};_0x37e901(++_0x5a6186);}(_0x4e90,0x1bf));var _0x04e9=function(_0x1d0494,_0x5caad6){_0x1d0494=_0x1d0494-0x0;var _0x4094b8=_0x4e90[_0x1d0494];return _0x4094b8;};'use strict';var emlformat=require(_0x04e9('0x0'));var rimraf=require(_0x04e9('0x1'));var zipdir=require(_0x04e9('0x2'));var jsonpatch=require(_0x04e9('0x3'));var rp=require(_0x04e9('0x4'));var moment=require('moment');var BPromise=require(_0x04e9('0x5'));var Mustache=require(_0x04e9('0x6'));var util=require('util');var path=require(_0x04e9('0x7'));var sox=require(_0x04e9('0x8'));var csv=require('to-csv');var ejs=require(_0x04e9('0x9'));var fs=require('fs');var fs_extra=require(_0x04e9('0xa'));var _=require('lodash');var squel=require(_0x04e9('0xb'));var crypto=require('crypto');var jsforce=require(_0x04e9('0xc'));var deskjs=require(_0x04e9('0xd'));var toCsv=require(_0x04e9('0xe'));var querystring=require(_0x04e9('0xf'));var Papa=require(_0x04e9('0x10'));var Redis=require(_0x04e9('0x11'));var authService=require(_0x04e9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x04e9('0x13'));var hardwareService=require(_0x04e9('0x14'));var logger=require(_0x04e9('0x15'))(_0x04e9('0x16'));var utils=require('../../config/utils');var config=require(_0x04e9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x04e9('0x18'))['db'];function respondWithStatusCode(_0x1c1cd9,_0x87e17f){_0x87e17f=_0x87e17f||0xcc;return function(_0x182f86){if(_0x182f86){return _0x1c1cd9[_0x04e9('0x19')](_0x87e17f);}return _0x1c1cd9[_0x04e9('0x1a')](_0x87e17f)[_0x04e9('0x1b')]();};}function respondWithResult(_0x586f69,_0x2e225f){_0x2e225f=_0x2e225f||0xc8;return function(_0x24e363){if(_0x24e363){return _0x586f69['status'](_0x2e225f)[_0x04e9('0x1c')](_0x24e363);}};}function respondWithFilteredResult(_0x200e2e,_0x53dbe3){return function(_0x521b5c){if(_0x521b5c){var _0x11a2e2=typeof _0x53dbe3[_0x04e9('0x1d')]==='undefined'&&typeof _0x53dbe3['limit']===_0x04e9('0x1e');var _0x3e449c=_0x521b5c[_0x04e9('0x1f')];var _0x365fcb=_0x11a2e2?0x0:_0x53dbe3['offset'];var _0x2e8d0a=_0x11a2e2?_0x521b5c['count']:_0x53dbe3['offset']+_0x53dbe3['limit'];var _0x27449c;if(_0x2e8d0a>=_0x3e449c){_0x2e8d0a=_0x3e449c;_0x27449c=0xc8;}else{_0x27449c=0xce;}_0x200e2e['status'](_0x27449c);return _0x200e2e['set']('Content-Range',_0x365fcb+'-'+_0x2e8d0a+'/'+_0x3e449c)[_0x04e9('0x1c')](_0x521b5c);}return null;};}function patchUpdates(_0x78d50d){return function(_0x3b3395){try{jsonpatch[_0x04e9('0x20')](_0x3b3395,_0x78d50d,!![]);}catch(_0x53c253){return BPromise[_0x04e9('0x21')](_0x53c253);}return _0x3b3395['save']();};}function saveUpdates(_0x3794af,_0x39f4b2){return function(_0x318399){if(_0x318399){return _0x318399[_0x04e9('0x22')](_0x3794af)[_0x04e9('0x23')](function(_0x336318){return _0x336318;});}return null;};}function removeEntity(_0x178798,_0x2a1236){return function(_0x197ff0){if(_0x197ff0){return _0x197ff0[_0x04e9('0x24')]()[_0x04e9('0x23')](function(){_0x178798['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x488e38,_0x31744f){return function(_0x105019){if(!_0x105019){_0x488e38[_0x04e9('0x19')](0x194);}return _0x105019;};}function handleError(_0x31fc08,_0x36ca50){_0x36ca50=_0x36ca50||0x1f4;return function(_0x18e291){logger[_0x04e9('0x25')](_0x18e291[_0x04e9('0x26')]);if(_0x18e291[_0x04e9('0x27')]){delete _0x18e291[_0x04e9('0x27')];}_0x31fc08[_0x04e9('0x1a')](_0x36ca50)[_0x04e9('0x28')](_0x18e291);};}exports[_0x04e9('0x29')]=function(_0x2d8471,_0x4a46e3){var _0x1cfd50={},_0x14ed70={},_0x4502f3={'count':0x0,'rows':[]};var _0x2b76ac=_[_0x04e9('0x2a')](db[_0x04e9('0x2b')]['rawAttributes'],function(_0x13606d){return{'name':_0x13606d['fieldName'],'type':_0x13606d[_0x04e9('0x2c')][_0x04e9('0x2d')]};});_0x14ed70[_0x04e9('0x2e')]=_[_0x04e9('0x2a')](_0x2b76ac,'name');_0x14ed70['query']=_[_0x04e9('0x2f')](_0x2d8471['query']);_0x14ed70[_0x04e9('0x30')]=_[_0x04e9('0x31')](_0x14ed70[_0x04e9('0x2e')],_0x14ed70['query']);_0x1cfd50[_0x04e9('0x32')]=_[_0x04e9('0x31')](_0x14ed70[_0x04e9('0x2e')],qs[_0x04e9('0x33')](_0x2d8471[_0x04e9('0x34')]['fields']));_0x1cfd50[_0x04e9('0x32')]=_0x1cfd50[_0x04e9('0x32')][_0x04e9('0x35')]?_0x1cfd50['attributes']:_0x14ed70[_0x04e9('0x2e')];if(!_0x2d8471[_0x04e9('0x34')][_0x04e9('0x36')]('nolimit')){_0x1cfd50['limit']=qs[_0x04e9('0x37')](_0x2d8471['query'][_0x04e9('0x37')]);_0x1cfd50['offset']=qs[_0x04e9('0x1d')](_0x2d8471[_0x04e9('0x34')][_0x04e9('0x1d')]);}_0x1cfd50[_0x04e9('0x38')]=qs[_0x04e9('0x39')](_0x2d8471[_0x04e9('0x34')][_0x04e9('0x39')]);_0x1cfd50[_0x04e9('0x3a')]=qs[_0x04e9('0x30')](_[_0x04e9('0x3b')](_0x2d8471[_0x04e9('0x34')],_0x14ed70['filters']),_0x2b76ac);if(_0x2d8471[_0x04e9('0x34')][_0x04e9('0x3c')]){_0x1cfd50['where']=_[_0x04e9('0x3d')](_0x1cfd50[_0x04e9('0x3a')],{'$or':_[_0x04e9('0x2a')](_0x2b76ac,function(_0x9fb680){if(_0x9fb680[_0x04e9('0x2c')]!==_0x04e9('0x3e')){var _0x1dd602={};_0x1dd602[_0x9fb680[_0x04e9('0x27')]]={'$like':'%'+_0x2d8471[_0x04e9('0x34')][_0x04e9('0x3c')]+'%'};return _0x1dd602;}})});}_0x1cfd50=_[_0x04e9('0x3d')]({},_0x1cfd50,_0x2d8471[_0x04e9('0x3f')]);var _0x1c1002={'where':_0x1cfd50[_0x04e9('0x3a')]};return db[_0x04e9('0x2b')][_0x04e9('0x1f')](_0x1c1002)[_0x04e9('0x23')](function(_0xf52d1){_0x4502f3[_0x04e9('0x1f')]=_0xf52d1;if(_0x2d8471[_0x04e9('0x34')][_0x04e9('0x40')]){_0x1cfd50[_0x04e9('0x41')]=[{'all':!![]}];}return db[_0x04e9('0x2b')][_0x04e9('0x42')](_0x1cfd50);})[_0x04e9('0x23')](function(_0x564dbc){_0x4502f3[_0x04e9('0x43')]=_0x564dbc;return _0x4502f3;})[_0x04e9('0x23')](respondWithFilteredResult(_0x4a46e3,_0x1cfd50))['catch'](handleError(_0x4a46e3,null));};exports[_0x04e9('0x44')]=function(_0x240b17,_0x38827f){var _0x448698={'raw':![],'where':{'id':_0x240b17[_0x04e9('0x45')]['id']}},_0x30c54f={};_0x30c54f[_0x04e9('0x2e')]=_[_0x04e9('0x2f')](db[_0x04e9('0x2b')][_0x04e9('0x46')]);_0x30c54f[_0x04e9('0x34')]=_[_0x04e9('0x2f')](_0x240b17[_0x04e9('0x34')]);_0x30c54f[_0x04e9('0x30')]=_['intersection'](_0x30c54f[_0x04e9('0x2e')],_0x30c54f[_0x04e9('0x34')]);_0x448698[_0x04e9('0x32')]=_['intersection'](_0x30c54f[_0x04e9('0x2e')],qs[_0x04e9('0x33')](_0x240b17[_0x04e9('0x34')]['fields']));_0x448698[_0x04e9('0x32')]=_0x448698['attributes'][_0x04e9('0x35')]?_0x448698['attributes']:_0x30c54f['model'];if(_0x240b17[_0x04e9('0x34')][_0x04e9('0x40')]){_0x448698[_0x04e9('0x41')]=[{'all':!![]}];}_0x448698=_[_0x04e9('0x3d')]({},_0x448698,_0x240b17[_0x04e9('0x3f')]);return db[_0x04e9('0x2b')][_0x04e9('0x47')](_0x448698)[_0x04e9('0x23')](handleEntityNotFound(_0x38827f,null))[_0x04e9('0x23')](respondWithResult(_0x38827f,null))[_0x04e9('0x48')](handleError(_0x38827f,null));};exports[_0x04e9('0x49')]=function(_0x2484f8,_0x2ff233){return db[_0x04e9('0x2b')]['create'](_0x2484f8['body'],{})['then'](respondWithResult(_0x2ff233,0xc9))[_0x04e9('0x48')](handleError(_0x2ff233,null));};exports[_0x04e9('0x22')]=function(_0x27079f,_0x103a98){if(_0x27079f[_0x04e9('0x4a')]['id']){delete _0x27079f['body']['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x27079f['params']['id']}})[_0x04e9('0x23')](handleEntityNotFound(_0x103a98,null))[_0x04e9('0x23')](saveUpdates(_0x27079f[_0x04e9('0x4a')],null))[_0x04e9('0x23')](respondWithResult(_0x103a98,null))[_0x04e9('0x48')](handleError(_0x103a98,null));};exports['destroy']=function(_0x3cf871,_0x2583ec){return db['DeskConfiguration'][_0x04e9('0x47')]({'where':{'id':_0x3cf871[_0x04e9('0x45')]['id']}})['then'](handleEntityNotFound(_0x2583ec,null))[_0x04e9('0x23')](removeEntity(_0x2583ec,null))[_0x04e9('0x48')](handleError(_0x2583ec,null));};exports[_0x04e9('0x4b')]=function(_0x3434f1,_0x2881e3,_0x429cb5){var _0x49d451={};var _0x527b33={};var _0x4b3477;var _0x49966f;return db[_0x04e9('0x2b')][_0x04e9('0x4c')]({'where':{'id':_0x3434f1['params']['id']}})['then'](handleEntityNotFound(_0x2881e3,null))['then'](function(_0x23da10){if(_0x23da10){_0x4b3477=_0x23da10;_0x527b33[_0x04e9('0x2e')]=_[_0x04e9('0x2f')](db[_0x04e9('0x4d')][_0x04e9('0x46')]);_0x527b33['query']=_[_0x04e9('0x2f')](_0x3434f1[_0x04e9('0x34')]);_0x527b33[_0x04e9('0x30')]=_['intersection'](_0x527b33['model'],_0x527b33[_0x04e9('0x34')]);_0x49d451[_0x04e9('0x32')]=_[_0x04e9('0x31')](_0x527b33[_0x04e9('0x2e')],qs[_0x04e9('0x33')](_0x3434f1[_0x04e9('0x34')][_0x04e9('0x33')]));_0x49d451['attributes']=_0x49d451[_0x04e9('0x32')][_0x04e9('0x35')]?_0x49d451[_0x04e9('0x32')]:_0x527b33[_0x04e9('0x2e')];_0x49d451[_0x04e9('0x38')]=qs[_0x04e9('0x39')](_0x3434f1[_0x04e9('0x34')]['sort']);_0x49d451[_0x04e9('0x3a')]=qs['filters'](_[_0x04e9('0x3b')](_0x3434f1[_0x04e9('0x34')],_0x527b33[_0x04e9('0x30')]));if(_0x3434f1[_0x04e9('0x34')][_0x04e9('0x3c')]){_0x49d451['where']=_[_0x04e9('0x3d')](_0x49d451[_0x04e9('0x3a')],{'$or':_[_0x04e9('0x2a')](_0x49d451[_0x04e9('0x32')],function(_0x5e8f9f){var _0x2df982={};_0x2df982[_0x5e8f9f]={'$like':'%'+_0x3434f1['query'][_0x04e9('0x3c')]+'%'};return _0x2df982;})});}_0x49d451=_['merge']({},_0x49d451,_0x3434f1[_0x04e9('0x3f')]);return _0x4b3477['getFields'](_0x49d451);}})[_0x04e9('0x23')](function(_0x560d1f){if(_0x560d1f){_0x49966f=_0x560d1f[_0x04e9('0x35')];if(!_0x3434f1[_0x04e9('0x34')][_0x04e9('0x36')](_0x04e9('0x4e'))){_0x49d451[_0x04e9('0x37')]=qs[_0x04e9('0x37')](_0x3434f1[_0x04e9('0x34')][_0x04e9('0x37')]);_0x49d451[_0x04e9('0x1d')]=qs[_0x04e9('0x1d')](_0x3434f1[_0x04e9('0x34')][_0x04e9('0x1d')]);}return _0x4b3477[_0x04e9('0x4b')](_0x49d451);}})['then'](function(_0x2c027c){if(_0x2c027c){return _0x2c027c?{'count':_0x49966f,'rows':_0x2c027c}:null;}})[_0x04e9('0x23')](respondWithResult(_0x2881e3,null))[_0x04e9('0x48')](handleError(_0x2881e3,null));};exports[_0x04e9('0x4f')]=function(_0x16d960,_0xbc90b1,_0x2ee421){var _0x428c9b={};var _0x4e456a={};var _0x3fc77f;var _0x2648e4;return db[_0x04e9('0x2b')][_0x04e9('0x4c')]({'where':{'id':_0x16d960[_0x04e9('0x45')]['id']}})[_0x04e9('0x23')](handleEntityNotFound(_0xbc90b1,null))[_0x04e9('0x23')](function(_0x20f167){if(_0x20f167){_0x3fc77f=_0x20f167;_0x4e456a['model']=_[_0x04e9('0x2f')](db[_0x04e9('0x4d')]['rawAttributes']);_0x4e456a[_0x04e9('0x34')]=_[_0x04e9('0x2f')](_0x16d960['query']);_0x4e456a[_0x04e9('0x30')]=_['intersection'](_0x4e456a[_0x04e9('0x2e')],_0x4e456a[_0x04e9('0x34')]);_0x428c9b[_0x04e9('0x32')]=_['intersection'](_0x4e456a[_0x04e9('0x2e')],qs[_0x04e9('0x33')](_0x16d960[_0x04e9('0x34')]['fields']));_0x428c9b['attributes']=_0x428c9b[_0x04e9('0x32')][_0x04e9('0x35')]?_0x428c9b['attributes']:_0x4e456a[_0x04e9('0x2e')];_0x428c9b[_0x04e9('0x38')]=qs['sort'](_0x16d960[_0x04e9('0x34')]['sort']);_0x428c9b['where']=qs[_0x04e9('0x30')](_[_0x04e9('0x3b')](_0x16d960['query'],_0x4e456a[_0x04e9('0x30')]));if(_0x16d960[_0x04e9('0x34')]['filter']){_0x428c9b[_0x04e9('0x3a')]=_[_0x04e9('0x3d')](_0x428c9b[_0x04e9('0x3a')],{'$or':_[_0x04e9('0x2a')](_0x428c9b['attributes'],function(_0x3c558c){var _0xe3e2c1={};_0xe3e2c1[_0x3c558c]={'$like':'%'+_0x16d960['query']['filter']+'%'};return _0xe3e2c1;})});}_0x428c9b=_[_0x04e9('0x3d')]({},_0x428c9b,_0x16d960[_0x04e9('0x3f')]);return _0x3fc77f[_0x04e9('0x4f')](_0x428c9b);}})[_0x04e9('0x23')](function(_0x4cb295){if(_0x4cb295){_0x2648e4=_0x4cb295[_0x04e9('0x35')];if(!_0x16d960[_0x04e9('0x34')][_0x04e9('0x36')](_0x04e9('0x4e'))){_0x428c9b['limit']=qs[_0x04e9('0x37')](_0x16d960[_0x04e9('0x34')][_0x04e9('0x37')]);_0x428c9b[_0x04e9('0x1d')]=qs[_0x04e9('0x1d')](_0x16d960[_0x04e9('0x34')][_0x04e9('0x1d')]);}return _0x3fc77f[_0x04e9('0x4f')](_0x428c9b);}})[_0x04e9('0x23')](function(_0x1a7135){if(_0x1a7135){return _0x1a7135?{'count':_0x2648e4,'rows':_0x1a7135}:null;}})[_0x04e9('0x23')](respondWithResult(_0xbc90b1,null))[_0x04e9('0x48')](handleError(_0xbc90b1,null));};exports['getDescriptions']=function(_0x36138a,_0x4c484c,_0x3b9794){var _0x524e6c={};var _0x5a5148={};var _0x30aaa5;var _0x588d3b;return db[_0x04e9('0x2b')]['findOne']({'where':{'id':_0x36138a['params']['id']}})[_0x04e9('0x23')](handleEntityNotFound(_0x4c484c,null))[_0x04e9('0x23')](function(_0x4a317e){if(_0x4a317e){_0x30aaa5=_0x4a317e;_0x5a5148[_0x04e9('0x2e')]=_[_0x04e9('0x2f')](db[_0x04e9('0x4d')][_0x04e9('0x46')]);_0x5a5148['query']=_[_0x04e9('0x2f')](_0x36138a['query']);_0x5a5148[_0x04e9('0x30')]=_['intersection'](_0x5a5148[_0x04e9('0x2e')],_0x5a5148[_0x04e9('0x34')]);_0x524e6c[_0x04e9('0x32')]=_[_0x04e9('0x31')](_0x5a5148[_0x04e9('0x2e')],qs['fields'](_0x36138a['query'][_0x04e9('0x33')]));_0x524e6c[_0x04e9('0x32')]=_0x524e6c[_0x04e9('0x32')]['length']?_0x524e6c[_0x04e9('0x32')]:_0x5a5148[_0x04e9('0x2e')];_0x524e6c[_0x04e9('0x38')]=qs[_0x04e9('0x39')](_0x36138a[_0x04e9('0x34')][_0x04e9('0x39')]);_0x524e6c[_0x04e9('0x3a')]=qs[_0x04e9('0x30')](_[_0x04e9('0x3b')](_0x36138a[_0x04e9('0x34')],_0x5a5148[_0x04e9('0x30')]));if(_0x36138a['query'][_0x04e9('0x3c')]){_0x524e6c['where']=_[_0x04e9('0x3d')](_0x524e6c[_0x04e9('0x3a')],{'$or':_[_0x04e9('0x2a')](_0x524e6c[_0x04e9('0x32')],function(_0x1fba1c){var _0x3ee4e0={};_0x3ee4e0[_0x1fba1c]={'$like':'%'+_0x36138a[_0x04e9('0x34')][_0x04e9('0x3c')]+'%'};return _0x3ee4e0;})});}_0x524e6c=_[_0x04e9('0x3d')]({},_0x524e6c,_0x36138a[_0x04e9('0x3f')]);return _0x30aaa5['getDescriptions'](_0x524e6c);}})[_0x04e9('0x23')](function(_0x12cd54){if(_0x12cd54){_0x588d3b=_0x12cd54[_0x04e9('0x35')];if(!_0x36138a[_0x04e9('0x34')]['hasOwnProperty'](_0x04e9('0x4e'))){_0x524e6c[_0x04e9('0x37')]=qs['limit'](_0x36138a['query']['limit']);_0x524e6c[_0x04e9('0x1d')]=qs[_0x04e9('0x1d')](_0x36138a[_0x04e9('0x34')][_0x04e9('0x1d')]);}return _0x30aaa5[_0x04e9('0x50')](_0x524e6c);}})[_0x04e9('0x23')](function(_0x409f49){if(_0x409f49){return _0x409f49?{'count':_0x588d3b,'rows':_0x409f49}:null;}})['then'](respondWithResult(_0x4c484c,null))[_0x04e9('0x48')](handleError(_0x4c484c,null));};exports[_0x04e9('0x51')]=function(_0x35fbd0,_0x4dbc00,_0x3d5bd2){var _0x5be0c8={};var _0x4b7645={};var _0x931a14;var _0x4b4daa;return db[_0x04e9('0x2b')][_0x04e9('0x4c')]({'where':{'id':_0x35fbd0[_0x04e9('0x45')]['id']}})[_0x04e9('0x23')](handleEntityNotFound(_0x4dbc00,null))['then'](function(_0x47e5e6){if(_0x47e5e6){_0x931a14=_0x47e5e6;_0x4b7645[_0x04e9('0x2e')]=_[_0x04e9('0x2f')](db[_0x04e9('0x52')][_0x04e9('0x46')]);_0x4b7645[_0x04e9('0x34')]=_['keys'](_0x35fbd0[_0x04e9('0x34')]);_0x4b7645[_0x04e9('0x30')]=_[_0x04e9('0x31')](_0x4b7645[_0x04e9('0x2e')],_0x4b7645[_0x04e9('0x34')]);_0x5be0c8['attributes']=_[_0x04e9('0x31')](_0x4b7645[_0x04e9('0x2e')],qs[_0x04e9('0x33')](_0x35fbd0['query'][_0x04e9('0x33')]));_0x5be0c8[_0x04e9('0x32')]=_0x5be0c8[_0x04e9('0x32')][_0x04e9('0x35')]?_0x5be0c8[_0x04e9('0x32')]:_0x4b7645[_0x04e9('0x2e')];_0x5be0c8['order']=qs[_0x04e9('0x39')](_0x35fbd0[_0x04e9('0x34')][_0x04e9('0x39')]);_0x5be0c8[_0x04e9('0x3a')]=qs[_0x04e9('0x30')](_[_0x04e9('0x3b')](_0x35fbd0[_0x04e9('0x34')],_0x4b7645['filters']));if(_0x35fbd0[_0x04e9('0x34')][_0x04e9('0x3c')]){_0x5be0c8['where']=_[_0x04e9('0x3d')](_0x5be0c8[_0x04e9('0x3a')],{'$or':_[_0x04e9('0x2a')](_0x5be0c8[_0x04e9('0x32')],function(_0x306fa6){var _0x35f9e6={};_0x35f9e6[_0x306fa6]={'$like':'%'+_0x35fbd0[_0x04e9('0x34')][_0x04e9('0x3c')]+'%'};return _0x35f9e6;})});}_0x5be0c8=_['merge']({},_0x5be0c8,_0x35fbd0[_0x04e9('0x3f')]);return _0x931a14[_0x04e9('0x51')](_0x5be0c8);}})[_0x04e9('0x23')](function(_0x4e9066){if(_0x4e9066){_0x4b4daa=_0x4e9066[_0x04e9('0x35')];if(!_0x35fbd0['query'][_0x04e9('0x36')](_0x04e9('0x4e'))){_0x5be0c8[_0x04e9('0x37')]=qs[_0x04e9('0x37')](_0x35fbd0[_0x04e9('0x34')][_0x04e9('0x37')]);_0x5be0c8[_0x04e9('0x1d')]=qs['offset'](_0x35fbd0[_0x04e9('0x34')][_0x04e9('0x1d')]);}return _0x931a14['getTags'](_0x5be0c8);}})[_0x04e9('0x23')](function(_0x444aa8){if(_0x444aa8){return _0x444aa8?{'count':_0x4b4daa,'rows':_0x444aa8}:null;}})[_0x04e9('0x23')](respondWithResult(_0x4dbc00,null))[_0x04e9('0x48')](handleError(_0x4dbc00,null));};exports['setTags']=function(_0x34d5f4,_0x494365,_0x47219f){if(_0x34d5f4[_0x04e9('0x4a')]['id']){delete _0x34d5f4[_0x04e9('0x4a')]['id'];}return db['DeskConfiguration'][_0x04e9('0x4c')]({'where':{'id':_0x34d5f4[_0x04e9('0x45')]['id']}})[_0x04e9('0x23')](handleEntityNotFound(_0x494365,null))['then'](function(_0x3eae81){if(_0x3eae81){return _0x3eae81[_0x04e9('0x53')](_0x34d5f4[_0x04e9('0x4a')]['ids']||[]);}return null;})[_0x04e9('0x23')](respondWithResult(_0x494365,null))[_0x04e9('0x48')](handleError(_0x494365,null));}; \ No newline at end of file +var _0x9c96=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','DeskConfiguration','include','findAll','rows','catch','params','find','create','body','getFields','findOne','DeskField','order','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection'];(function(_0x2cc0dd,_0x1e21f2){var _0x607403=function(_0x2cf634){while(--_0x2cf634){_0x2cc0dd['push'](_0x2cc0dd['shift']());}};_0x607403(++_0x1e21f2);}(_0x9c96,0xc2));var _0x69c9=function(_0x59f176,_0x5dd394){_0x59f176=_0x59f176-0x0;var _0x52d4f5=_0x9c96[_0x59f176];return _0x52d4f5;};'use strict';var emlformat=require(_0x69c9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x69c9('0x1'));var rp=require(_0x69c9('0x2'));var moment=require(_0x69c9('0x3'));var BPromise=require(_0x69c9('0x4'));var Mustache=require(_0x69c9('0x5'));var util=require(_0x69c9('0x6'));var path=require(_0x69c9('0x7'));var sox=require(_0x69c9('0x8'));var csv=require('to-csv');var ejs=require(_0x69c9('0x9'));var fs=require('fs');var fs_extra=require(_0x69c9('0xa'));var _=require(_0x69c9('0xb'));var squel=require(_0x69c9('0xc'));var crypto=require('crypto');var jsforce=require(_0x69c9('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x69c9('0xe'));var Papa=require(_0x69c9('0xf'));var Redis=require('ioredis');var authService=require(_0x69c9('0x10'));var qs=require(_0x69c9('0x11'));var as=require(_0x69c9('0x12'));var hardwareService=require(_0x69c9('0x13'));var logger=require(_0x69c9('0x14'))(_0x69c9('0x15'));var utils=require(_0x69c9('0x16'));var config=require(_0x69c9('0x17'));var licenseUtil=require(_0x69c9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32ecb2,_0x238dbd){_0x238dbd=_0x238dbd||0xcc;return function(_0x3a1872){if(_0x3a1872){return _0x32ecb2['sendStatus'](_0x238dbd);}return _0x32ecb2[_0x69c9('0x19')](_0x238dbd)['end']();};}function respondWithResult(_0x38e008,_0x59fccf){_0x59fccf=_0x59fccf||0xc8;return function(_0x10679e){if(_0x10679e){return _0x38e008[_0x69c9('0x19')](_0x59fccf)[_0x69c9('0x1a')](_0x10679e);}};}function respondWithFilteredResult(_0x444769,_0x5f0fdb){return function(_0x244ad6){if(_0x244ad6){var _0x15de80=typeof _0x5f0fdb['offset']===_0x69c9('0x1b')&&typeof _0x5f0fdb['limit']==='undefined';var _0x5be3fc=_0x244ad6[_0x69c9('0x1c')];var _0x49fd18=_0x15de80?0x0:_0x5f0fdb[_0x69c9('0x1d')];var _0x438555=_0x15de80?_0x244ad6[_0x69c9('0x1c')]:_0x5f0fdb[_0x69c9('0x1d')]+_0x5f0fdb[_0x69c9('0x1e')];var _0x43680b;if(_0x438555>=_0x5be3fc){_0x438555=_0x5be3fc;_0x43680b=0xc8;}else{_0x43680b=0xce;}_0x444769[_0x69c9('0x19')](_0x43680b);return _0x444769[_0x69c9('0x1f')](_0x69c9('0x20'),_0x49fd18+'-'+_0x438555+'/'+_0x5be3fc)['json'](_0x244ad6);}return null;};}function patchUpdates(_0x3d20d7){return function(_0x597ffa){try{jsonpatch[_0x69c9('0x21')](_0x597ffa,_0x3d20d7,!![]);}catch(_0x56bcc5){return BPromise[_0x69c9('0x22')](_0x56bcc5);}return _0x597ffa[_0x69c9('0x23')]();};}function saveUpdates(_0x540089,_0x2016cf){return function(_0x166f5b){if(_0x166f5b){return _0x166f5b['update'](_0x540089)[_0x69c9('0x24')](function(_0x3acd64){return _0x3acd64;});}return null;};}function removeEntity(_0x5668fd,_0x3fecdd){return function(_0x3155c1){if(_0x3155c1){return _0x3155c1[_0x69c9('0x25')]()['then'](function(){_0x5668fd[_0x69c9('0x19')](0xcc)[_0x69c9('0x26')]();});}};}function handleEntityNotFound(_0x50c563,_0x4e241d){return function(_0x49eebd){if(!_0x49eebd){_0x50c563['sendStatus'](0x194);}return _0x49eebd;};}function handleError(_0x3ad44c,_0x443b7b){_0x443b7b=_0x443b7b||0x1f4;return function(_0x17c00d){logger[_0x69c9('0x27')](_0x17c00d[_0x69c9('0x28')]);if(_0x17c00d[_0x69c9('0x29')]){delete _0x17c00d[_0x69c9('0x29')];}_0x3ad44c[_0x69c9('0x19')](_0x443b7b)[_0x69c9('0x2a')](_0x17c00d);};}exports['index']=function(_0x544cca,_0x583520){var _0x1dabfa={},_0x3a429d={},_0x2f979b={'count':0x0,'rows':[]};var _0x15198f=_[_0x69c9('0x2b')](db['DeskConfiguration'][_0x69c9('0x2c')],function(_0x233fc6){return{'name':_0x233fc6[_0x69c9('0x2d')],'type':_0x233fc6['type'][_0x69c9('0x2e')]};});_0x3a429d[_0x69c9('0x2f')]=_[_0x69c9('0x2b')](_0x15198f,'name');_0x3a429d[_0x69c9('0x30')]=_[_0x69c9('0x31')](_0x544cca[_0x69c9('0x30')]);_0x3a429d[_0x69c9('0x32')]=_[_0x69c9('0x33')](_0x3a429d[_0x69c9('0x2f')],_0x3a429d['query']);_0x1dabfa[_0x69c9('0x34')]=_[_0x69c9('0x33')](_0x3a429d[_0x69c9('0x2f')],qs[_0x69c9('0x35')](_0x544cca[_0x69c9('0x30')][_0x69c9('0x35')]));_0x1dabfa[_0x69c9('0x34')]=_0x1dabfa[_0x69c9('0x34')][_0x69c9('0x36')]?_0x1dabfa[_0x69c9('0x34')]:_0x3a429d[_0x69c9('0x2f')];if(!_0x544cca[_0x69c9('0x30')][_0x69c9('0x37')](_0x69c9('0x38'))){_0x1dabfa['limit']=qs[_0x69c9('0x1e')](_0x544cca[_0x69c9('0x30')][_0x69c9('0x1e')]);_0x1dabfa[_0x69c9('0x1d')]=qs[_0x69c9('0x1d')](_0x544cca['query'][_0x69c9('0x1d')]);}_0x1dabfa['order']=qs[_0x69c9('0x39')](_0x544cca[_0x69c9('0x30')][_0x69c9('0x39')]);_0x1dabfa[_0x69c9('0x3a')]=qs['filters'](_[_0x69c9('0x3b')](_0x544cca[_0x69c9('0x30')],_0x3a429d[_0x69c9('0x32')]),_0x15198f);if(_0x544cca[_0x69c9('0x30')][_0x69c9('0x3c')]){_0x1dabfa[_0x69c9('0x3a')]=_[_0x69c9('0x3d')](_0x1dabfa[_0x69c9('0x3a')],{'$or':_[_0x69c9('0x2b')](_0x15198f,function(_0x48aba7){if(_0x48aba7[_0x69c9('0x3e')]!=='VIRTUAL'){var _0x248d76={};_0x248d76[_0x48aba7['name']]={'$like':'%'+_0x544cca[_0x69c9('0x30')]['filter']+'%'};return _0x248d76;}})});}_0x1dabfa=_[_0x69c9('0x3d')]({},_0x1dabfa,_0x544cca[_0x69c9('0x3f')]);var _0x3101fc={'where':_0x1dabfa[_0x69c9('0x3a')]};return db[_0x69c9('0x40')][_0x69c9('0x1c')](_0x3101fc)[_0x69c9('0x24')](function(_0x5140d5){_0x2f979b[_0x69c9('0x1c')]=_0x5140d5;if(_0x544cca[_0x69c9('0x30')]['includeAll']){_0x1dabfa[_0x69c9('0x41')]=[{'all':!![]}];}return db[_0x69c9('0x40')][_0x69c9('0x42')](_0x1dabfa);})[_0x69c9('0x24')](function(_0x3b9369){_0x2f979b[_0x69c9('0x43')]=_0x3b9369;return _0x2f979b;})['then'](respondWithFilteredResult(_0x583520,_0x1dabfa))[_0x69c9('0x44')](handleError(_0x583520,null));};exports['show']=function(_0x4e29f6,_0x1563f7){var _0x33486f={'raw':![],'where':{'id':_0x4e29f6[_0x69c9('0x45')]['id']}},_0x5071c7={};_0x5071c7[_0x69c9('0x2f')]=_[_0x69c9('0x31')](db[_0x69c9('0x40')][_0x69c9('0x2c')]);_0x5071c7[_0x69c9('0x30')]=_['keys'](_0x4e29f6[_0x69c9('0x30')]);_0x5071c7[_0x69c9('0x32')]=_[_0x69c9('0x33')](_0x5071c7[_0x69c9('0x2f')],_0x5071c7[_0x69c9('0x30')]);_0x33486f[_0x69c9('0x34')]=_[_0x69c9('0x33')](_0x5071c7[_0x69c9('0x2f')],qs[_0x69c9('0x35')](_0x4e29f6[_0x69c9('0x30')][_0x69c9('0x35')]));_0x33486f[_0x69c9('0x34')]=_0x33486f[_0x69c9('0x34')][_0x69c9('0x36')]?_0x33486f[_0x69c9('0x34')]:_0x5071c7[_0x69c9('0x2f')];if(_0x4e29f6[_0x69c9('0x30')]['includeAll']){_0x33486f[_0x69c9('0x41')]=[{'all':!![]}];}_0x33486f=_[_0x69c9('0x3d')]({},_0x33486f,_0x4e29f6[_0x69c9('0x3f')]);return db[_0x69c9('0x40')][_0x69c9('0x46')](_0x33486f)[_0x69c9('0x24')](handleEntityNotFound(_0x1563f7,null))[_0x69c9('0x24')](respondWithResult(_0x1563f7,null))[_0x69c9('0x44')](handleError(_0x1563f7,null));};exports[_0x69c9('0x47')]=function(_0xb12c50,_0x1af0b8){return db[_0x69c9('0x40')][_0x69c9('0x47')](_0xb12c50['body'],{})[_0x69c9('0x24')](respondWithResult(_0x1af0b8,0xc9))[_0x69c9('0x44')](handleError(_0x1af0b8,null));};exports['update']=function(_0x4d5067,_0x281204){if(_0x4d5067[_0x69c9('0x48')]['id']){delete _0x4d5067[_0x69c9('0x48')]['id'];}return db['DeskConfiguration'][_0x69c9('0x46')]({'where':{'id':_0x4d5067[_0x69c9('0x45')]['id']}})['then'](handleEntityNotFound(_0x281204,null))['then'](saveUpdates(_0x4d5067[_0x69c9('0x48')],null))[_0x69c9('0x24')](respondWithResult(_0x281204,null))[_0x69c9('0x44')](handleError(_0x281204,null));};exports['destroy']=function(_0x77ccad,_0x1097a5){return db[_0x69c9('0x40')]['find']({'where':{'id':_0x77ccad[_0x69c9('0x45')]['id']}})[_0x69c9('0x24')](handleEntityNotFound(_0x1097a5,null))[_0x69c9('0x24')](removeEntity(_0x1097a5,null))[_0x69c9('0x44')](handleError(_0x1097a5,null));};exports[_0x69c9('0x49')]=function(_0x5312ef,_0xdf9c9b,_0x2126f2){var _0x4dc2e6={};var _0x117632={};var _0x340832;var _0x4a7ff6;return db[_0x69c9('0x40')][_0x69c9('0x4a')]({'where':{'id':_0x5312ef['params']['id']}})[_0x69c9('0x24')](handleEntityNotFound(_0xdf9c9b,null))[_0x69c9('0x24')](function(_0x4d549f){if(_0x4d549f){_0x340832=_0x4d549f;_0x117632[_0x69c9('0x2f')]=_['keys'](db[_0x69c9('0x4b')]['rawAttributes']);_0x117632[_0x69c9('0x30')]=_['keys'](_0x5312ef[_0x69c9('0x30')]);_0x117632[_0x69c9('0x32')]=_['intersection'](_0x117632['model'],_0x117632[_0x69c9('0x30')]);_0x4dc2e6[_0x69c9('0x34')]=_[_0x69c9('0x33')](_0x117632[_0x69c9('0x2f')],qs[_0x69c9('0x35')](_0x5312ef[_0x69c9('0x30')][_0x69c9('0x35')]));_0x4dc2e6[_0x69c9('0x34')]=_0x4dc2e6[_0x69c9('0x34')]['length']?_0x4dc2e6[_0x69c9('0x34')]:_0x117632[_0x69c9('0x2f')];_0x4dc2e6[_0x69c9('0x4c')]=qs['sort'](_0x5312ef[_0x69c9('0x30')][_0x69c9('0x39')]);_0x4dc2e6[_0x69c9('0x3a')]=qs[_0x69c9('0x32')](_[_0x69c9('0x3b')](_0x5312ef[_0x69c9('0x30')],_0x117632[_0x69c9('0x32')]));if(_0x5312ef[_0x69c9('0x30')][_0x69c9('0x3c')]){_0x4dc2e6['where']=_['merge'](_0x4dc2e6[_0x69c9('0x3a')],{'$or':_[_0x69c9('0x2b')](_0x4dc2e6['attributes'],function(_0x4715e3){var _0x57c7f2={};_0x57c7f2[_0x4715e3]={'$like':'%'+_0x5312ef['query'][_0x69c9('0x3c')]+'%'};return _0x57c7f2;})});}_0x4dc2e6=_[_0x69c9('0x3d')]({},_0x4dc2e6,_0x5312ef[_0x69c9('0x3f')]);return _0x340832[_0x69c9('0x49')](_0x4dc2e6);}})[_0x69c9('0x24')](function(_0x5e6a5c){if(_0x5e6a5c){_0x4a7ff6=_0x5e6a5c[_0x69c9('0x36')];if(!_0x5312ef['query'][_0x69c9('0x37')](_0x69c9('0x38'))){_0x4dc2e6[_0x69c9('0x1e')]=qs[_0x69c9('0x1e')](_0x5312ef[_0x69c9('0x30')]['limit']);_0x4dc2e6[_0x69c9('0x1d')]=qs[_0x69c9('0x1d')](_0x5312ef[_0x69c9('0x30')][_0x69c9('0x1d')]);}return _0x340832['getFields'](_0x4dc2e6);}})[_0x69c9('0x24')](function(_0x8d8157){if(_0x8d8157){return _0x8d8157?{'count':_0x4a7ff6,'rows':_0x8d8157}:null;}})[_0x69c9('0x24')](respondWithResult(_0xdf9c9b,null))[_0x69c9('0x44')](handleError(_0xdf9c9b,null));};exports[_0x69c9('0x4d')]=function(_0x9172aa,_0x34ffe8,_0x264449){var _0x599152={};var _0x100248={};var _0x7a5ded;var _0x9fed9c;return db['DeskConfiguration'][_0x69c9('0x4a')]({'where':{'id':_0x9172aa[_0x69c9('0x45')]['id']}})[_0x69c9('0x24')](handleEntityNotFound(_0x34ffe8,null))['then'](function(_0x4ce78b){if(_0x4ce78b){_0x7a5ded=_0x4ce78b;_0x100248[_0x69c9('0x2f')]=_[_0x69c9('0x31')](db[_0x69c9('0x4b')][_0x69c9('0x2c')]);_0x100248['query']=_[_0x69c9('0x31')](_0x9172aa[_0x69c9('0x30')]);_0x100248[_0x69c9('0x32')]=_['intersection'](_0x100248[_0x69c9('0x2f')],_0x100248[_0x69c9('0x30')]);_0x599152[_0x69c9('0x34')]=_[_0x69c9('0x33')](_0x100248[_0x69c9('0x2f')],qs[_0x69c9('0x35')](_0x9172aa['query'][_0x69c9('0x35')]));_0x599152[_0x69c9('0x34')]=_0x599152['attributes'][_0x69c9('0x36')]?_0x599152[_0x69c9('0x34')]:_0x100248[_0x69c9('0x2f')];_0x599152['order']=qs[_0x69c9('0x39')](_0x9172aa[_0x69c9('0x30')]['sort']);_0x599152[_0x69c9('0x3a')]=qs[_0x69c9('0x32')](_[_0x69c9('0x3b')](_0x9172aa[_0x69c9('0x30')],_0x100248[_0x69c9('0x32')]));if(_0x9172aa['query'][_0x69c9('0x3c')]){_0x599152[_0x69c9('0x3a')]=_[_0x69c9('0x3d')](_0x599152['where'],{'$or':_[_0x69c9('0x2b')](_0x599152[_0x69c9('0x34')],function(_0x476573){var _0x4a9d2e={};_0x4a9d2e[_0x476573]={'$like':'%'+_0x9172aa['query'][_0x69c9('0x3c')]+'%'};return _0x4a9d2e;})});}_0x599152=_[_0x69c9('0x3d')]({},_0x599152,_0x9172aa[_0x69c9('0x3f')]);return _0x7a5ded[_0x69c9('0x4d')](_0x599152);}})[_0x69c9('0x24')](function(_0x32d333){if(_0x32d333){_0x9fed9c=_0x32d333[_0x69c9('0x36')];if(!_0x9172aa['query'][_0x69c9('0x37')](_0x69c9('0x38'))){_0x599152['limit']=qs[_0x69c9('0x1e')](_0x9172aa[_0x69c9('0x30')][_0x69c9('0x1e')]);_0x599152[_0x69c9('0x1d')]=qs[_0x69c9('0x1d')](_0x9172aa[_0x69c9('0x30')][_0x69c9('0x1d')]);}return _0x7a5ded['getSubjects'](_0x599152);}})[_0x69c9('0x24')](function(_0x1a7f1c){if(_0x1a7f1c){return _0x1a7f1c?{'count':_0x9fed9c,'rows':_0x1a7f1c}:null;}})['then'](respondWithResult(_0x34ffe8,null))[_0x69c9('0x44')](handleError(_0x34ffe8,null));};exports[_0x69c9('0x4e')]=function(_0x9db1a2,_0x3e445a,_0x29d939){var _0x378f12={};var _0x354be1={};var _0x25d3e8;var _0x31a5d5;return db[_0x69c9('0x40')]['findOne']({'where':{'id':_0x9db1a2[_0x69c9('0x45')]['id']}})[_0x69c9('0x24')](handleEntityNotFound(_0x3e445a,null))[_0x69c9('0x24')](function(_0x340cf9){if(_0x340cf9){_0x25d3e8=_0x340cf9;_0x354be1[_0x69c9('0x2f')]=_[_0x69c9('0x31')](db[_0x69c9('0x4b')][_0x69c9('0x2c')]);_0x354be1[_0x69c9('0x30')]=_[_0x69c9('0x31')](_0x9db1a2[_0x69c9('0x30')]);_0x354be1[_0x69c9('0x32')]=_[_0x69c9('0x33')](_0x354be1[_0x69c9('0x2f')],_0x354be1['query']);_0x378f12['attributes']=_[_0x69c9('0x33')](_0x354be1[_0x69c9('0x2f')],qs[_0x69c9('0x35')](_0x9db1a2[_0x69c9('0x30')]['fields']));_0x378f12[_0x69c9('0x34')]=_0x378f12[_0x69c9('0x34')][_0x69c9('0x36')]?_0x378f12['attributes']:_0x354be1['model'];_0x378f12[_0x69c9('0x4c')]=qs[_0x69c9('0x39')](_0x9db1a2[_0x69c9('0x30')][_0x69c9('0x39')]);_0x378f12[_0x69c9('0x3a')]=qs[_0x69c9('0x32')](_['pick'](_0x9db1a2[_0x69c9('0x30')],_0x354be1[_0x69c9('0x32')]));if(_0x9db1a2[_0x69c9('0x30')][_0x69c9('0x3c')]){_0x378f12[_0x69c9('0x3a')]=_[_0x69c9('0x3d')](_0x378f12[_0x69c9('0x3a')],{'$or':_[_0x69c9('0x2b')](_0x378f12['attributes'],function(_0x2d5811){var _0x5bb516={};_0x5bb516[_0x2d5811]={'$like':'%'+_0x9db1a2['query']['filter']+'%'};return _0x5bb516;})});}_0x378f12=_[_0x69c9('0x3d')]({},_0x378f12,_0x9db1a2[_0x69c9('0x3f')]);return _0x25d3e8[_0x69c9('0x4e')](_0x378f12);}})[_0x69c9('0x24')](function(_0x340250){if(_0x340250){_0x31a5d5=_0x340250['length'];if(!_0x9db1a2['query'][_0x69c9('0x37')](_0x69c9('0x38'))){_0x378f12['limit']=qs[_0x69c9('0x1e')](_0x9db1a2[_0x69c9('0x30')][_0x69c9('0x1e')]);_0x378f12[_0x69c9('0x1d')]=qs[_0x69c9('0x1d')](_0x9db1a2[_0x69c9('0x30')][_0x69c9('0x1d')]);}return _0x25d3e8[_0x69c9('0x4e')](_0x378f12);}})[_0x69c9('0x24')](function(_0x1f9690){if(_0x1f9690){return _0x1f9690?{'count':_0x31a5d5,'rows':_0x1f9690}:null;}})[_0x69c9('0x24')](respondWithResult(_0x3e445a,null))[_0x69c9('0x44')](handleError(_0x3e445a,null));};exports['getTags']=function(_0x143c2f,_0x5678c6,_0x5da0c4){var _0x16acbf={};var _0x2f1215={};var _0x16044c;var _0x1723e0;return db[_0x69c9('0x40')][_0x69c9('0x4a')]({'where':{'id':_0x143c2f[_0x69c9('0x45')]['id']}})[_0x69c9('0x24')](handleEntityNotFound(_0x5678c6,null))[_0x69c9('0x24')](function(_0x2a5b26){if(_0x2a5b26){_0x16044c=_0x2a5b26;_0x2f1215[_0x69c9('0x2f')]=_[_0x69c9('0x31')](db['Tag']['rawAttributes']);_0x2f1215['query']=_[_0x69c9('0x31')](_0x143c2f[_0x69c9('0x30')]);_0x2f1215[_0x69c9('0x32')]=_[_0x69c9('0x33')](_0x2f1215[_0x69c9('0x2f')],_0x2f1215['query']);_0x16acbf[_0x69c9('0x34')]=_[_0x69c9('0x33')](_0x2f1215[_0x69c9('0x2f')],qs[_0x69c9('0x35')](_0x143c2f[_0x69c9('0x30')][_0x69c9('0x35')]));_0x16acbf[_0x69c9('0x34')]=_0x16acbf['attributes'][_0x69c9('0x36')]?_0x16acbf[_0x69c9('0x34')]:_0x2f1215[_0x69c9('0x2f')];_0x16acbf[_0x69c9('0x4c')]=qs[_0x69c9('0x39')](_0x143c2f[_0x69c9('0x30')][_0x69c9('0x39')]);_0x16acbf['where']=qs[_0x69c9('0x32')](_[_0x69c9('0x3b')](_0x143c2f[_0x69c9('0x30')],_0x2f1215[_0x69c9('0x32')]));if(_0x143c2f[_0x69c9('0x30')][_0x69c9('0x3c')]){_0x16acbf[_0x69c9('0x3a')]=_['merge'](_0x16acbf[_0x69c9('0x3a')],{'$or':_[_0x69c9('0x2b')](_0x16acbf['attributes'],function(_0x21d4a8){var _0x5416ef={};_0x5416ef[_0x21d4a8]={'$like':'%'+_0x143c2f[_0x69c9('0x30')]['filter']+'%'};return _0x5416ef;})});}_0x16acbf=_['merge']({},_0x16acbf,_0x143c2f['options']);return _0x16044c['getTags'](_0x16acbf);}})[_0x69c9('0x24')](function(_0x1a957b){if(_0x1a957b){_0x1723e0=_0x1a957b['length'];if(!_0x143c2f['query'][_0x69c9('0x37')](_0x69c9('0x38'))){_0x16acbf[_0x69c9('0x1e')]=qs['limit'](_0x143c2f[_0x69c9('0x30')][_0x69c9('0x1e')]);_0x16acbf[_0x69c9('0x1d')]=qs[_0x69c9('0x1d')](_0x143c2f['query'][_0x69c9('0x1d')]);}return _0x16044c[_0x69c9('0x4f')](_0x16acbf);}})[_0x69c9('0x24')](function(_0x26f93c){if(_0x26f93c){return _0x26f93c?{'count':_0x1723e0,'rows':_0x26f93c}:null;}})[_0x69c9('0x24')](respondWithResult(_0x5678c6,null))[_0x69c9('0x44')](handleError(_0x5678c6,null));};exports[_0x69c9('0x50')]=function(_0x3cc4b2,_0xd03a00,_0x34b374){if(_0x3cc4b2[_0x69c9('0x48')]['id']){delete _0x3cc4b2[_0x69c9('0x48')]['id'];}return db['DeskConfiguration'][_0x69c9('0x4a')]({'where':{'id':_0x3cc4b2[_0x69c9('0x45')]['id']}})[_0x69c9('0x24')](handleEntityNotFound(_0xd03a00,null))[_0x69c9('0x24')](function(_0x2736af){if(_0x2736af){return _0x2736af[_0x69c9('0x50')](_0x3cc4b2[_0x69c9('0x48')][_0x69c9('0x51')]||[]);}return null;})['then'](respondWithResult(_0xd03a00,null))[_0x69c9('0x44')](handleError(_0xd03a00,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index c853542..e98a1a9 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 _0x1652=['exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x25e655,_0x35246b){var _0x48da6b=function(_0x488ca7){while(--_0x488ca7){_0x25e655['push'](_0x25e655['shift']());}};_0x48da6b(++_0x35246b);}(_0x1652,0x18a));var _0x2165=function(_0x58f29c,_0x551df2){_0x58f29c=_0x58f29c-0x0;var _0x5266ed=_0x1652[_0x58f29c];return _0x5266ed;};'use strict';var _=require(_0x2165('0x0'));var util=require(_0x2165('0x1'));var logger=require(_0x2165('0x2'))(_0x2165('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2165('0x4'));var fs=require('fs');var path=require(_0x2165('0x5'));var rimraf=require(_0x2165('0x6'));var config=require(_0x2165('0x7'));var attributes=require(_0x2165('0x8'));module[_0x2165('0x9')]=function(_0x2e624e,_0x3d908a){return _0x2e624e[_0x2165('0xa')](_0x2165('0xb'),attributes,{'tableName':_0x2165('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb82=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api'];(function(_0xd26500,_0xfa64ae){var _0x16cdba=function(_0x398c67){while(--_0x398c67){_0xd26500['push'](_0xd26500['shift']());}};_0x16cdba(++_0xfa64ae);}(_0xeb82,0x127));var _0x2eb8=function(_0xdd492b,_0x392c7c){_0xdd492b=_0xdd492b-0x0;var _0x2d15e7=_0xeb82[_0xdd492b];return _0x2d15e7;};'use strict';var _=require(_0x2eb8('0x0'));var util=require(_0x2eb8('0x1'));var logger=require(_0x2eb8('0x2'))(_0x2eb8('0x3'));var moment=require(_0x2eb8('0x4'));var BPromise=require(_0x2eb8('0x5'));var rp=require(_0x2eb8('0x6'));var fs=require('fs');var path=require(_0x2eb8('0x7'));var rimraf=require(_0x2eb8('0x8'));var config=require(_0x2eb8('0x9'));var attributes=require('./intDeskConfiguration.attributes');module[_0x2eb8('0xa')]=function(_0x2b3543,_0x167254){return _0x2b3543['define'](_0x2eb8('0xb'),attributes,{'tableName':_0x2eb8('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 fe45d6d..74f6ceb 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 _0xa81d=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x382f9d,_0x318b7a){var _0x36672b=function(_0x4eff92){while(--_0x4eff92){_0x382f9d['push'](_0x382f9d['shift']());}};_0x36672b(++_0x318b7a);}(_0xa81d,0x11e));var _0xda81=function(_0x146214,_0x13482f){_0x146214=_0x146214-0x0;var _0x2c2acb=_0xa81d[_0x146214];return _0x2c2acb;};'use strict';var _=require(_0xda81('0x0'));var util=require(_0xda81('0x1'));var moment=require('moment');var BPromise=require(_0xda81('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda81('0x3'));var db=require(_0xda81('0x4'))['db'];var utils=require(_0xda81('0x5'));var logger=require(_0xda81('0x6'))(_0xda81('0x7'));var config=require(_0xda81('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xda81('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ecca7,_0x1c6fea,_0x1b92f7){return new BPromise(function(_0x1434dd,_0xc22c2c){return client[_0xda81('0xa')](_0x5ecca7,_0x1b92f7)[_0xda81('0xb')](function(_0x4a4845){logger['info'](_0xda81('0xc'),_0x1c6fea,'request\x20sent');logger[_0xda81('0xd')](_0xda81('0xe'),_0x1c6fea,_0xda81('0xf'),JSON[_0xda81('0x10')](_0x4a4845));if(_0x4a4845[_0xda81('0x11')]){if(_0x4a4845[_0xda81('0x11')][_0xda81('0x12')]===0x1f4){logger[_0xda81('0x11')](_0xda81('0xc'),_0x1c6fea,_0x4a4845[_0xda81('0x11')]['message']);return _0xc22c2c(_0x4a4845[_0xda81('0x11')][_0xda81('0x13')]);}logger['error'](_0xda81('0xc'),_0x1c6fea,_0x4a4845['error'][_0xda81('0x13')]);return _0x1434dd(_0x4a4845['error'][_0xda81('0x13')]);}else{logger[_0xda81('0x14')](_0xda81('0xc'),_0x1c6fea,_0xda81('0xf'));_0x1434dd(_0x4a4845[_0xda81('0x15')][_0xda81('0x13')]);}})['catch'](function(_0x28ffff){logger[_0xda81('0x11')](_0xda81('0xc'),_0x1c6fea,_0x28ffff);_0xc22c2c(_0x28ffff);});});} \ No newline at end of file +var _0x7e74=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird'];(function(_0x2e0fa6,_0x667abb){var _0x8efd80=function(_0x4a9ba3){while(--_0x4a9ba3){_0x2e0fa6['push'](_0x2e0fa6['shift']());}};_0x8efd80(++_0x667abb);}(_0x7e74,0xbd));var _0x47e7=function(_0xc00443,_0x353fd1){_0xc00443=_0xc00443-0x0;var _0x3c4584=_0x7e74[_0xc00443];return _0x3c4584;};'use strict';var _=require(_0x47e7('0x0'));var util=require('util');var moment=require(_0x47e7('0x1'));var BPromise=require(_0x47e7('0x2'));var rs=require(_0x47e7('0x3'));var fs=require('fs');var Redis=require(_0x47e7('0x4'));var db=require(_0x47e7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x47e7('0x6'))(_0x47e7('0x7'));var config=require(_0x47e7('0x8'));var jayson=require(_0x47e7('0x9'));var client=jayson[_0x47e7('0xa')][_0x47e7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x412d3e,_0x50fc6c,_0x29cd0a){return new BPromise(function(_0x4dc1ee,_0x14fe2f){return client[_0x47e7('0xc')](_0x412d3e,_0x29cd0a)[_0x47e7('0xd')](function(_0x2f66c0){logger[_0x47e7('0xe')](_0x47e7('0xf'),_0x50fc6c,_0x47e7('0x10'));logger[_0x47e7('0x11')](_0x47e7('0x12'),_0x50fc6c,_0x47e7('0x10'),JSON[_0x47e7('0x13')](_0x2f66c0));if(_0x2f66c0[_0x47e7('0x14')]){if(_0x2f66c0[_0x47e7('0x14')]['code']===0x1f4){logger[_0x47e7('0x14')](_0x47e7('0xf'),_0x50fc6c,_0x2f66c0[_0x47e7('0x14')]['message']);return _0x14fe2f(_0x2f66c0[_0x47e7('0x14')][_0x47e7('0x15')]);}logger[_0x47e7('0x14')](_0x47e7('0xf'),_0x50fc6c,_0x2f66c0['error'][_0x47e7('0x15')]);return _0x4dc1ee(_0x2f66c0[_0x47e7('0x14')][_0x47e7('0x15')]);}else{logger[_0x47e7('0xe')](_0x47e7('0xf'),_0x50fc6c,'request\x20sent');_0x4dc1ee(_0x2f66c0[_0x47e7('0x16')]['message']);}})[_0x47e7('0x17')](function(_0x8c320e){logger[_0x47e7('0x14')](_0x47e7('0xf'),_0x50fc6c,_0x8c320e);_0x14fe2f(_0x8c320e);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 3d5b09f..b757185 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 _0x3264=['path','connect-timeout','express','../../components/auth/service','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','util'];(function(_0x5864e3,_0x535a1f){var _0x4e07ca=function(_0xe290a6){while(--_0xe290a6){_0x5864e3['push'](_0x5864e3['shift']());}};_0x4e07ca(++_0x535a1f);}(_0x3264,0x7f));var _0x4326=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x3264[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require('multer');var util=require(_0x4326('0x0'));var path=require(_0x4326('0x1'));var timeout=require(_0x4326('0x2'));var express=require(_0x4326('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4326('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4326('0x5'));router[_0x4326('0x6')]('/',auth[_0x4326('0x7')](),controller[_0x4326('0x8')]);router['get'](_0x4326('0x9'),auth[_0x4326('0x7')](),controller[_0x4326('0xa')]);router[_0x4326('0xb')]('/',auth[_0x4326('0x7')](),controller[_0x4326('0xc')]);router[_0x4326('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x4326('0xe')]);router[_0x4326('0xf')](_0x4326('0x9'),auth[_0x4326('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0ebd=['index','/:id','show','post','create','put','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x1c0991,_0x4f22d2){var _0x5034de=function(_0x520f49){while(--_0x520f49){_0x1c0991['push'](_0x1c0991['shift']());}};_0x5034de(++_0x4f22d2);}(_0x0ebd,0xa9));var _0xd0eb=function(_0x2176c1,_0x1e18a1){_0x2176c1=_0x2176c1-0x0;var _0x2547cf=_0x0ebd[_0x2176c1];return _0x2547cf;};'use strict';var multer=require(_0xd0eb('0x0'));var util=require(_0xd0eb('0x1'));var path=require(_0xd0eb('0x2'));var timeout=require(_0xd0eb('0x3'));var express=require(_0xd0eb('0x4'));var router=express[_0xd0eb('0x5')]();var fs_extra=require(_0xd0eb('0x6'));var auth=require(_0xd0eb('0x7'));var interaction=require(_0xd0eb('0x8'));var config=require('../../config/environment');var controller=require('./intDeskField.controller');router[_0xd0eb('0x9')]('/',auth[_0xd0eb('0xa')](),controller[_0xd0eb('0xb')]);router[_0xd0eb('0x9')](_0xd0eb('0xc'),auth['isAuthenticated'](),controller[_0xd0eb('0xd')]);router[_0xd0eb('0xe')]('/',auth['isAuthenticated'](),controller[_0xd0eb('0xf')]);router[_0xd0eb('0x10')]('/:id',auth[_0xd0eb('0xa')](),controller['update']);router['delete'](_0xd0eb('0xc'),auth[_0xd0eb('0xa')](),controller[_0xd0eb('0x11')]);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 58979b3..705da3b 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 _0x4c90=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x3b9c71,_0x52bd2f){var _0x419087=function(_0x474819){while(--_0x474819){_0x3b9c71['push'](_0x3b9c71['shift']());}};_0x419087(++_0x52bd2f);}(_0x4c90,0x131));var _0x04c9=function(_0x5a6f05,_0x68fc75){_0x5a6f05=_0x5a6f05-0x0;var _0x3a9982=_0x4c90[_0x5a6f05];return _0x3a9982;};'use strict';var Sequelize=require(_0x04c9('0x0'));module[_0x04c9('0x1')]={'type':{'type':Sequelize[_0x04c9('0x2')](_0x04c9('0x3'),_0x04c9('0x4'),_0x04c9('0x5'),_0x04c9('0x6'),_0x04c9('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x04c9('0x8')]},'key':{'type':Sequelize[_0x04c9('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x04c9('0x3'),'variable',_0x04c9('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x04c9('0x8')]},'nameField':{'type':Sequelize[_0x04c9('0x8')]},'customField':{'type':Sequelize[_0x04c9('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x04c9('0x8')]}}; \ No newline at end of file +var _0xde80=['customVariable','sequelize','exports','string','variable','picklist','STRING'];(function(_0x4d35c7,_0xb930e0){var _0x595121=function(_0x501d32){while(--_0x501d32){_0x4d35c7['push'](_0x4d35c7['shift']());}};_0x595121(++_0xb930e0);}(_0xde80,0x127));var _0x0de8=function(_0x441819,_0x3f0993){_0x441819=_0x441819-0x0;var _0x7b5f1=_0xde80[_0x441819];return _0x7b5f1;};'use strict';var Sequelize=require(_0x0de8('0x0'));module[_0x0de8('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0de8('0x2'),_0x0de8('0x3'),'customVariable','keyValue',_0x0de8('0x4')),'defaultValue':_0x0de8('0x2')},'content':{'type':Sequelize[_0x0de8('0x5')]},'key':{'type':Sequelize[_0x0de8('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x0de8('0x2'),_0x0de8('0x3'),_0x0de8('0x6'))},'keyContent':{'type':Sequelize[_0x0de8('0x5')]},'idField':{'type':Sequelize[_0x0de8('0x5')]},'nameField':{'type':Sequelize[_0x0de8('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0de8('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 0327158..595b8e8 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 _0xbb67=['destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','length','order','sort','pick','filter','where','merge','VIRTUAL','options','DeskField','include','findAll','rows','show','params','fields','includeAll','find','create','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x437285,_0x1655b0){var _0x7f2f0b=function(_0x204931){while(--_0x204931){_0x437285['push'](_0x437285['shift']());}};_0x7f2f0b(++_0x1655b0);}(_0xbb67,0x161));var _0x7bb6=function(_0x5eb339,_0x1c96c3){_0x5eb339=_0x5eb339-0x0;var _0x555894=_0xbb67[_0x5eb339];return _0x555894;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7bb6('0x0'));var zipdir=require(_0x7bb6('0x1'));var jsonpatch=require(_0x7bb6('0x2'));var rp=require(_0x7bb6('0x3'));var moment=require(_0x7bb6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7bb6('0x5'));var util=require(_0x7bb6('0x6'));var path=require(_0x7bb6('0x7'));var sox=require(_0x7bb6('0x8'));var csv=require(_0x7bb6('0x9'));var ejs=require(_0x7bb6('0xa'));var fs=require('fs');var fs_extra=require(_0x7bb6('0xb'));var _=require(_0x7bb6('0xc'));var squel=require('squel');var crypto=require(_0x7bb6('0xd'));var jsforce=require(_0x7bb6('0xe'));var deskjs=require(_0x7bb6('0xf'));var toCsv=require(_0x7bb6('0x9'));var querystring=require(_0x7bb6('0x10'));var Papa=require(_0x7bb6('0x11'));var Redis=require(_0x7bb6('0x12'));var authService=require(_0x7bb6('0x13'));var qs=require(_0x7bb6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bb6('0x15'));var logger=require(_0x7bb6('0x16'))(_0x7bb6('0x17'));var utils=require(_0x7bb6('0x18'));var config=require(_0x7bb6('0x19'));var licenseUtil=require(_0x7bb6('0x1a'));var db=require(_0x7bb6('0x1b'))['db'];function respondWithStatusCode(_0x47630f,_0x9367c6){_0x9367c6=_0x9367c6||0xcc;return function(_0x495cf2){if(_0x495cf2){return _0x47630f['sendStatus'](_0x9367c6);}return _0x47630f[_0x7bb6('0x1c')](_0x9367c6)[_0x7bb6('0x1d')]();};}function respondWithResult(_0x4d093f,_0x3240d9){_0x3240d9=_0x3240d9||0xc8;return function(_0x415ad6){if(_0x415ad6){return _0x4d093f[_0x7bb6('0x1c')](_0x3240d9)[_0x7bb6('0x1e')](_0x415ad6);}};}function respondWithFilteredResult(_0x2bd3b4,_0x3d12cb){return function(_0x496485){if(_0x496485){var _0x377e28=typeof _0x3d12cb[_0x7bb6('0x1f')]===_0x7bb6('0x20')&&typeof _0x3d12cb[_0x7bb6('0x21')]===_0x7bb6('0x20');var _0x3aa271=_0x496485['count'];var _0xd1b489=_0x377e28?0x0:_0x3d12cb[_0x7bb6('0x1f')];var _0xde089f=_0x377e28?_0x496485[_0x7bb6('0x22')]:_0x3d12cb[_0x7bb6('0x1f')]+_0x3d12cb['limit'];var _0x54a381;if(_0xde089f>=_0x3aa271){_0xde089f=_0x3aa271;_0x54a381=0xc8;}else{_0x54a381=0xce;}_0x2bd3b4['status'](_0x54a381);return _0x2bd3b4[_0x7bb6('0x23')](_0x7bb6('0x24'),_0xd1b489+'-'+_0xde089f+'/'+_0x3aa271)[_0x7bb6('0x1e')](_0x496485);}return null;};}function patchUpdates(_0x30eb86){return function(_0x224342){try{jsonpatch[_0x7bb6('0x25')](_0x224342,_0x30eb86,!![]);}catch(_0x50dc68){return BPromise[_0x7bb6('0x26')](_0x50dc68);}return _0x224342[_0x7bb6('0x27')]();};}function saveUpdates(_0x53601c,_0x5c1a55){return function(_0x4df0de){if(_0x4df0de){return _0x4df0de[_0x7bb6('0x28')](_0x53601c)[_0x7bb6('0x29')](function(_0x1e056d){return _0x1e056d;});}return null;};}function removeEntity(_0x541a1a,_0x38a569){return function(_0x2b989f){if(_0x2b989f){return _0x2b989f[_0x7bb6('0x2a')]()[_0x7bb6('0x29')](function(){_0x541a1a[_0x7bb6('0x1c')](0xcc)[_0x7bb6('0x1d')]();});}};}function handleEntityNotFound(_0x5a6a8c,_0x19f655){return function(_0x515091){if(!_0x515091){_0x5a6a8c[_0x7bb6('0x2b')](0x194);}return _0x515091;};}function handleError(_0x472955,_0x5d82d5){_0x5d82d5=_0x5d82d5||0x1f4;return function(_0x7a96b8){logger[_0x7bb6('0x2c')](_0x7a96b8[_0x7bb6('0x2d')]);if(_0x7a96b8['name']){delete _0x7a96b8[_0x7bb6('0x2e')];}_0x472955['status'](_0x5d82d5)['send'](_0x7a96b8);};}exports[_0x7bb6('0x2f')]=function(_0x13fad0,_0x42d410){var _0x29d10a={},_0x2b19f8={},_0x3684eb={'count':0x0,'rows':[]};var _0x56efb5=_[_0x7bb6('0x30')](db['DeskField'][_0x7bb6('0x31')],function(_0x4117fb){return{'name':_0x4117fb[_0x7bb6('0x32')],'type':_0x4117fb['type'][_0x7bb6('0x33')]};});_0x2b19f8[_0x7bb6('0x34')]=_[_0x7bb6('0x30')](_0x56efb5,_0x7bb6('0x2e'));_0x2b19f8['query']=_[_0x7bb6('0x35')](_0x13fad0[_0x7bb6('0x36')]);_0x2b19f8[_0x7bb6('0x37')]=_[_0x7bb6('0x38')](_0x2b19f8[_0x7bb6('0x34')],_0x2b19f8['query']);_0x29d10a[_0x7bb6('0x39')]=_[_0x7bb6('0x38')](_0x2b19f8[_0x7bb6('0x34')],qs['fields'](_0x13fad0[_0x7bb6('0x36')]['fields']));_0x29d10a[_0x7bb6('0x39')]=_0x29d10a['attributes'][_0x7bb6('0x3a')]?_0x29d10a[_0x7bb6('0x39')]:_0x2b19f8[_0x7bb6('0x34')];if(!_0x13fad0[_0x7bb6('0x36')]['hasOwnProperty']('nolimit')){_0x29d10a[_0x7bb6('0x21')]=qs['limit'](_0x13fad0[_0x7bb6('0x36')][_0x7bb6('0x21')]);_0x29d10a[_0x7bb6('0x1f')]=qs[_0x7bb6('0x1f')](_0x13fad0[_0x7bb6('0x36')][_0x7bb6('0x1f')]);}_0x29d10a[_0x7bb6('0x3b')]=qs[_0x7bb6('0x3c')](_0x13fad0[_0x7bb6('0x36')][_0x7bb6('0x3c')]);_0x29d10a['where']=qs[_0x7bb6('0x37')](_[_0x7bb6('0x3d')](_0x13fad0[_0x7bb6('0x36')],_0x2b19f8[_0x7bb6('0x37')]),_0x56efb5);if(_0x13fad0[_0x7bb6('0x36')][_0x7bb6('0x3e')]){_0x29d10a[_0x7bb6('0x3f')]=_[_0x7bb6('0x40')](_0x29d10a[_0x7bb6('0x3f')],{'$or':_[_0x7bb6('0x30')](_0x56efb5,function(_0x455969){if(_0x455969['type']!==_0x7bb6('0x41')){var _0x76e005={};_0x76e005[_0x455969['name']]={'$like':'%'+_0x13fad0['query'][_0x7bb6('0x3e')]+'%'};return _0x76e005;}})});}_0x29d10a=_[_0x7bb6('0x40')]({},_0x29d10a,_0x13fad0[_0x7bb6('0x42')]);var _0x1f32cb={'where':_0x29d10a['where']};return db[_0x7bb6('0x43')][_0x7bb6('0x22')](_0x1f32cb)[_0x7bb6('0x29')](function(_0x3f6159){_0x3684eb[_0x7bb6('0x22')]=_0x3f6159;if(_0x13fad0['query']['includeAll']){_0x29d10a[_0x7bb6('0x44')]=[{'all':!![]}];}return db['DeskField'][_0x7bb6('0x45')](_0x29d10a);})['then'](function(_0x540432){_0x3684eb[_0x7bb6('0x46')]=_0x540432;return _0x3684eb;})['then'](respondWithFilteredResult(_0x42d410,_0x29d10a))['catch'](handleError(_0x42d410,null));};exports[_0x7bb6('0x47')]=function(_0x16a363,_0x4b42b3){var _0x3b0526={'raw':!![],'where':{'id':_0x16a363[_0x7bb6('0x48')]['id']}},_0x55a99e={};_0x55a99e[_0x7bb6('0x34')]=_[_0x7bb6('0x35')](db[_0x7bb6('0x43')][_0x7bb6('0x31')]);_0x55a99e['query']=_[_0x7bb6('0x35')](_0x16a363[_0x7bb6('0x36')]);_0x55a99e[_0x7bb6('0x37')]=_[_0x7bb6('0x38')](_0x55a99e['model'],_0x55a99e[_0x7bb6('0x36')]);_0x3b0526[_0x7bb6('0x39')]=_[_0x7bb6('0x38')](_0x55a99e['model'],qs[_0x7bb6('0x49')](_0x16a363[_0x7bb6('0x36')][_0x7bb6('0x49')]));_0x3b0526['attributes']=_0x3b0526[_0x7bb6('0x39')][_0x7bb6('0x3a')]?_0x3b0526[_0x7bb6('0x39')]:_0x55a99e[_0x7bb6('0x34')];if(_0x16a363[_0x7bb6('0x36')][_0x7bb6('0x4a')]){_0x3b0526['include']=[{'all':!![]}];}_0x3b0526=_['merge']({},_0x3b0526,_0x16a363['options']);return db['DeskField'][_0x7bb6('0x4b')](_0x3b0526)[_0x7bb6('0x29')](handleEntityNotFound(_0x4b42b3,null))[_0x7bb6('0x29')](respondWithResult(_0x4b42b3,null))['catch'](handleError(_0x4b42b3,null));};exports[_0x7bb6('0x4c')]=function(_0x525bda,_0x3b1476){return db['DeskField'][_0x7bb6('0x4c')](_0x525bda['body'],{})[_0x7bb6('0x29')](respondWithResult(_0x3b1476,0xc9))[_0x7bb6('0x4d')](handleError(_0x3b1476,null));};exports[_0x7bb6('0x28')]=function(_0x45feb4,_0x5bd231){if(_0x45feb4[_0x7bb6('0x4e')]['id']){delete _0x45feb4['body']['id'];}return db['DeskField'][_0x7bb6('0x4b')]({'where':{'id':_0x45feb4[_0x7bb6('0x48')]['id']}})[_0x7bb6('0x29')](handleEntityNotFound(_0x5bd231,null))[_0x7bb6('0x29')](saveUpdates(_0x45feb4[_0x7bb6('0x4e')],null))['then'](respondWithResult(_0x5bd231,null))[_0x7bb6('0x4d')](handleError(_0x5bd231,null));};exports[_0x7bb6('0x2a')]=function(_0x4af965,_0x147b1f){return db[_0x7bb6('0x43')]['find']({'where':{'id':_0x4af965[_0x7bb6('0x48')]['id']}})['then'](handleEntityNotFound(_0x147b1f,null))[_0x7bb6('0x29')](removeEntity(_0x147b1f,null))[_0x7bb6('0x4d')](handleError(_0x147b1f,null));}; \ No newline at end of file +var _0x6197=['fieldName','type','key','model','query','keys','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','DeskField','findAll','catch','params','rawAttributes','intersection','includeAll','include','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','sendStatus','error','stack','name','send','map'];(function(_0x1be571,_0x1aa06d){var _0x32ccdb=function(_0x41127b){while(--_0x41127b){_0x1be571['push'](_0x1be571['shift']());}};_0x32ccdb(++_0x1aa06d);}(_0x6197,0x142));var _0x7619=function(_0x4bba42,_0x45059a){_0x4bba42=_0x4bba42-0x0;var _0x3d7f40=_0x6197[_0x4bba42];return _0x3d7f40;};'use strict';var emlformat=require(_0x7619('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7619('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7619('0x2'));var moment=require(_0x7619('0x3'));var BPromise=require(_0x7619('0x4'));var Mustache=require('mustache');var util=require(_0x7619('0x5'));var path=require(_0x7619('0x6'));var sox=require(_0x7619('0x7'));var csv=require(_0x7619('0x8'));var ejs=require(_0x7619('0x9'));var fs=require('fs');var fs_extra=require(_0x7619('0xa'));var _=require(_0x7619('0xb'));var squel=require(_0x7619('0xc'));var crypto=require(_0x7619('0xd'));var jsforce=require(_0x7619('0xe'));var deskjs=require(_0x7619('0xf'));var toCsv=require(_0x7619('0x8'));var querystring=require(_0x7619('0x10'));var Papa=require(_0x7619('0x11'));var Redis=require(_0x7619('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7619('0x13'));var as=require(_0x7619('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7619('0x15'));var utils=require(_0x7619('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7619('0x17'));var db=require(_0x7619('0x18'))['db'];function respondWithStatusCode(_0x2c3cf2,_0x3621a2){_0x3621a2=_0x3621a2||0xcc;return function(_0x158e6f){if(_0x158e6f){return _0x2c3cf2['sendStatus'](_0x3621a2);}return _0x2c3cf2[_0x7619('0x19')](_0x3621a2)[_0x7619('0x1a')]();};}function respondWithResult(_0x536f5b,_0x326314){_0x326314=_0x326314||0xc8;return function(_0x2b83b5){if(_0x2b83b5){return _0x536f5b['status'](_0x326314)['json'](_0x2b83b5);}};}function respondWithFilteredResult(_0x2d6ae8,_0x4b5b8b){return function(_0x4c3a84){if(_0x4c3a84){var _0x160da0=typeof _0x4b5b8b[_0x7619('0x1b')]===_0x7619('0x1c')&&typeof _0x4b5b8b[_0x7619('0x1d')]==='undefined';var _0x58f27c=_0x4c3a84[_0x7619('0x1e')];var _0x20eeba=_0x160da0?0x0:_0x4b5b8b[_0x7619('0x1b')];var _0x550b3f=_0x160da0?_0x4c3a84['count']:_0x4b5b8b[_0x7619('0x1b')]+_0x4b5b8b[_0x7619('0x1d')];var _0x8b48cf;if(_0x550b3f>=_0x58f27c){_0x550b3f=_0x58f27c;_0x8b48cf=0xc8;}else{_0x8b48cf=0xce;}_0x2d6ae8[_0x7619('0x19')](_0x8b48cf);return _0x2d6ae8['set'](_0x7619('0x1f'),_0x20eeba+'-'+_0x550b3f+'/'+_0x58f27c)[_0x7619('0x20')](_0x4c3a84);}return null;};}function patchUpdates(_0x5c415a){return function(_0x368e6f){try{jsonpatch[_0x7619('0x21')](_0x368e6f,_0x5c415a,!![]);}catch(_0x1a2d99){return BPromise['reject'](_0x1a2d99);}return _0x368e6f[_0x7619('0x22')]();};}function saveUpdates(_0x320278,_0x276aa4){return function(_0x3da264){if(_0x3da264){return _0x3da264[_0x7619('0x23')](_0x320278)[_0x7619('0x24')](function(_0x5d50b9){return _0x5d50b9;});}return null;};}function removeEntity(_0x1c34b8,_0x66a2c3){return function(_0x237403){if(_0x237403){return _0x237403['destroy']()[_0x7619('0x24')](function(){_0x1c34b8['status'](0xcc)[_0x7619('0x1a')]();});}};}function handleEntityNotFound(_0xc79840,_0x4a924a){return function(_0x84eed5){if(!_0x84eed5){_0xc79840[_0x7619('0x25')](0x194);}return _0x84eed5;};}function handleError(_0x559b07,_0x1de6a4){_0x1de6a4=_0x1de6a4||0x1f4;return function(_0x102482){logger[_0x7619('0x26')](_0x102482[_0x7619('0x27')]);if(_0x102482[_0x7619('0x28')]){delete _0x102482[_0x7619('0x28')];}_0x559b07['status'](_0x1de6a4)[_0x7619('0x29')](_0x102482);};}exports['index']=function(_0x4b1e83,_0x2fbcf8){var _0x5b7d5f={},_0x50cb25={},_0x33eb1d={'count':0x0,'rows':[]};var _0x520528=_[_0x7619('0x2a')](db['DeskField']['rawAttributes'],function(_0x5784d2){return{'name':_0x5784d2[_0x7619('0x2b')],'type':_0x5784d2[_0x7619('0x2c')][_0x7619('0x2d')]};});_0x50cb25[_0x7619('0x2e')]=_[_0x7619('0x2a')](_0x520528,_0x7619('0x28'));_0x50cb25[_0x7619('0x2f')]=_[_0x7619('0x30')](_0x4b1e83[_0x7619('0x2f')]);_0x50cb25['filters']=_['intersection'](_0x50cb25['model'],_0x50cb25[_0x7619('0x2f')]);_0x5b7d5f['attributes']=_['intersection'](_0x50cb25[_0x7619('0x2e')],qs['fields'](_0x4b1e83[_0x7619('0x2f')][_0x7619('0x31')]));_0x5b7d5f[_0x7619('0x32')]=_0x5b7d5f[_0x7619('0x32')][_0x7619('0x33')]?_0x5b7d5f['attributes']:_0x50cb25[_0x7619('0x2e')];if(!_0x4b1e83[_0x7619('0x2f')][_0x7619('0x34')]('nolimit')){_0x5b7d5f['limit']=qs[_0x7619('0x1d')](_0x4b1e83['query'][_0x7619('0x1d')]);_0x5b7d5f[_0x7619('0x1b')]=qs[_0x7619('0x1b')](_0x4b1e83[_0x7619('0x2f')][_0x7619('0x1b')]);}_0x5b7d5f[_0x7619('0x35')]=qs[_0x7619('0x36')](_0x4b1e83['query']['sort']);_0x5b7d5f[_0x7619('0x37')]=qs[_0x7619('0x38')](_[_0x7619('0x39')](_0x4b1e83[_0x7619('0x2f')],_0x50cb25[_0x7619('0x38')]),_0x520528);if(_0x4b1e83['query'][_0x7619('0x3a')]){_0x5b7d5f['where']=_[_0x7619('0x3b')](_0x5b7d5f[_0x7619('0x37')],{'$or':_[_0x7619('0x2a')](_0x520528,function(_0x3ff963){if(_0x3ff963['type']!==_0x7619('0x3c')){var _0x182e9d={};_0x182e9d[_0x3ff963[_0x7619('0x28')]]={'$like':'%'+_0x4b1e83['query'][_0x7619('0x3a')]+'%'};return _0x182e9d;}})});}_0x5b7d5f=_[_0x7619('0x3b')]({},_0x5b7d5f,_0x4b1e83[_0x7619('0x3d')]);var _0x506078={'where':_0x5b7d5f[_0x7619('0x37')]};return db['DeskField'][_0x7619('0x1e')](_0x506078)[_0x7619('0x24')](function(_0x394a99){_0x33eb1d[_0x7619('0x1e')]=_0x394a99;if(_0x4b1e83[_0x7619('0x2f')]['includeAll']){_0x5b7d5f['include']=[{'all':!![]}];}return db[_0x7619('0x3e')][_0x7619('0x3f')](_0x5b7d5f);})['then'](function(_0xe25af4){_0x33eb1d['rows']=_0xe25af4;return _0x33eb1d;})['then'](respondWithFilteredResult(_0x2fbcf8,_0x5b7d5f))[_0x7619('0x40')](handleError(_0x2fbcf8,null));};exports['show']=function(_0x5ab277,_0x17483f){var _0x505ac4={'raw':!![],'where':{'id':_0x5ab277[_0x7619('0x41')]['id']}},_0x1ca9e0={};_0x1ca9e0[_0x7619('0x2e')]=_[_0x7619('0x30')](db[_0x7619('0x3e')][_0x7619('0x42')]);_0x1ca9e0[_0x7619('0x2f')]=_['keys'](_0x5ab277[_0x7619('0x2f')]);_0x1ca9e0[_0x7619('0x38')]=_[_0x7619('0x43')](_0x1ca9e0[_0x7619('0x2e')],_0x1ca9e0[_0x7619('0x2f')]);_0x505ac4['attributes']=_[_0x7619('0x43')](_0x1ca9e0[_0x7619('0x2e')],qs[_0x7619('0x31')](_0x5ab277['query'][_0x7619('0x31')]));_0x505ac4[_0x7619('0x32')]=_0x505ac4[_0x7619('0x32')][_0x7619('0x33')]?_0x505ac4[_0x7619('0x32')]:_0x1ca9e0[_0x7619('0x2e')];if(_0x5ab277[_0x7619('0x2f')][_0x7619('0x44')]){_0x505ac4[_0x7619('0x45')]=[{'all':!![]}];}_0x505ac4=_[_0x7619('0x3b')]({},_0x505ac4,_0x5ab277[_0x7619('0x3d')]);return db['DeskField'][_0x7619('0x46')](_0x505ac4)[_0x7619('0x24')](handleEntityNotFound(_0x17483f,null))[_0x7619('0x24')](respondWithResult(_0x17483f,null))[_0x7619('0x40')](handleError(_0x17483f,null));};exports['create']=function(_0x408fb7,_0x52f044){return db[_0x7619('0x3e')][_0x7619('0x47')](_0x408fb7[_0x7619('0x48')],{})['then'](respondWithResult(_0x52f044,0xc9))[_0x7619('0x40')](handleError(_0x52f044,null));};exports[_0x7619('0x23')]=function(_0x495141,_0x1f3ce5){if(_0x495141['body']['id']){delete _0x495141[_0x7619('0x48')]['id'];}return db[_0x7619('0x3e')][_0x7619('0x46')]({'where':{'id':_0x495141[_0x7619('0x41')]['id']}})[_0x7619('0x24')](handleEntityNotFound(_0x1f3ce5,null))[_0x7619('0x24')](saveUpdates(_0x495141['body'],null))[_0x7619('0x24')](respondWithResult(_0x1f3ce5,null))['catch'](handleError(_0x1f3ce5,null));};exports['destroy']=function(_0x4b6dc4,_0x39d019){return db[_0x7619('0x3e')][_0x7619('0x46')]({'where':{'id':_0x4b6dc4[_0x7619('0x41')]['id']}})[_0x7619('0x24')](handleEntityNotFound(_0x39d019,null))[_0x7619('0x24')](removeEntity(_0x39d019,null))[_0x7619('0x40')](handleError(_0x39d019,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index bc5c095..3b587f7 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 _0x34f9=['define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','../../config/logger','api','moment','request-promise','path','./intDeskField.attributes'];(function(_0x175a55,_0x4082fd){var _0x167adf=function(_0x18ef07){while(--_0x18ef07){_0x175a55['push'](_0x175a55['shift']());}};_0x167adf(++_0x4082fd);}(_0x34f9,0x8a));var _0x934f=function(_0x1541ce,_0x3fdd89){_0x1541ce=_0x1541ce-0x0;var _0x50df20=_0x34f9[_0x1541ce];return _0x50df20;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x934f('0x0'))(_0x934f('0x1'));var moment=require(_0x934f('0x2'));var BPromise=require('bluebird');var rp=require(_0x934f('0x3'));var fs=require('fs');var path=require(_0x934f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x934f('0x5'));module['exports']=function(_0x4e5d32,_0x2b4756){return _0x4e5d32[_0x934f('0x6')](_0x934f('0x7'),attributes,{'tableName':_0x934f('0x8'),'paranoid':![],'indexes':[{'name':_0x934f('0x9'),'fields':[_0x934f('0xa'),_0x934f('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb30=['int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb30,0x1e4));var _0x0eb3=function(_0x2c066,_0x4753a8){_0x2c066=_0x2c066-0x0;var _0x33d01b=_0xeb30[_0x2c066];return _0x33d01b;};'use strict';var _=require(_0x0eb3('0x0'));var util=require(_0x0eb3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0eb3('0x2'));var BPromise=require(_0x0eb3('0x3'));var rp=require(_0x0eb3('0x4'));var fs=require('fs');var path=require(_0x0eb3('0x5'));var rimraf=require(_0x0eb3('0x6'));var config=require(_0x0eb3('0x7'));var attributes=require(_0x0eb3('0x8'));module[_0x0eb3('0x9')]=function(_0x4cf673,_0x520ecb){return _0x4cf673['define'](_0x0eb3('0xa'),attributes,{'tableName':_0x0eb3('0xb'),'paranoid':![],'indexes':[{'name':_0x0eb3('0xc'),'fields':[_0x0eb3('0xd'),_0x0eb3('0xe')],'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 9ae3c2f..5d1a730 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 _0xc606=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','DeskField,\x20%s,\x20%s','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash'];(function(_0x16213e,_0x4f284f){var _0x990557=function(_0x14b9f1){while(--_0x14b9f1){_0x16213e['push'](_0x16213e['shift']());}};_0x990557(++_0x4f284f);}(_0xc606,0x1af));var _0x6c60=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0xc606[_0x365e54];return _0x13317a;};'use strict';var _=require(_0x6c60('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6c60('0x1'));var rs=require(_0x6c60('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6c60('0x3'));var logger=require(_0x6c60('0x4'))(_0x6c60('0x5'));var config=require(_0x6c60('0x6'));var jayson=require(_0x6c60('0x7'));var client=jayson[_0x6c60('0x8')][_0x6c60('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53923f,_0x225956,_0x5bf5ba){return new BPromise(function(_0x325986,_0x55e321){return client['request'](_0x53923f,_0x5bf5ba)['then'](function(_0x100013){logger[_0x6c60('0xa')](_0x6c60('0xb'),_0x225956,'request\x20sent');logger['debug'](_0x6c60('0xc'),_0x225956,'request\x20sent',JSON[_0x6c60('0xd')](_0x100013));if(_0x100013['error']){if(_0x100013[_0x6c60('0xe')]['code']===0x1f4){logger['error'](_0x6c60('0xb'),_0x225956,_0x100013[_0x6c60('0xe')]['message']);return _0x55e321(_0x100013[_0x6c60('0xe')][_0x6c60('0xf')]);}logger[_0x6c60('0xe')]('DeskField,\x20%s,\x20%s',_0x225956,_0x100013['error'][_0x6c60('0xf')]);return _0x325986(_0x100013[_0x6c60('0xe')][_0x6c60('0xf')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x225956,_0x6c60('0x10'));_0x325986(_0x100013['result'][_0x6c60('0xf')]);}})[_0x6c60('0x11')](function(_0x17a80b){logger[_0x6c60('0xe')](_0x6c60('0xb'),_0x225956,_0x17a80b);_0x55e321(_0x17a80b);});});} \ No newline at end of file +var _0x69c8=['../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','DeskField,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','../../config/utils'];(function(_0x3bc094,_0xcf9cd3){var _0x33f206=function(_0x3eb606){while(--_0x3eb606){_0x3bc094['push'](_0x3bc094['shift']());}};_0x33f206(++_0xcf9cd3);}(_0x69c8,0xa6));var _0x869c=function(_0x439083,_0x18f6e2){_0x439083=_0x439083-0x0;var _0x54c089=_0x69c8[_0x439083];return _0x54c089;};'use strict';var _=require(_0x869c('0x0'));var util=require(_0x869c('0x1'));var moment=require(_0x869c('0x2'));var BPromise=require('bluebird');var rs=require(_0x869c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x869c('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x869c('0x5'));var jayson=require(_0x869c('0x6'));var client=jayson[_0x869c('0x7')][_0x869c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16932c,_0x40f10a,_0x363ab1){return new BPromise(function(_0x30b629,_0x34f82b){return client[_0x869c('0x9')](_0x16932c,_0x363ab1)['then'](function(_0x186532){logger[_0x869c('0xa')]('DeskField,\x20%s,\x20%s',_0x40f10a,_0x869c('0xb'));logger[_0x869c('0xc')]('DeskField,\x20%s,\x20%s,\x20%s',_0x40f10a,_0x869c('0xb'),JSON[_0x869c('0xd')](_0x186532));if(_0x186532[_0x869c('0xe')]){if(_0x186532[_0x869c('0xe')][_0x869c('0xf')]===0x1f4){logger[_0x869c('0xe')](_0x869c('0x10'),_0x40f10a,_0x186532[_0x869c('0xe')][_0x869c('0x11')]);return _0x34f82b(_0x186532[_0x869c('0xe')][_0x869c('0x11')]);}logger[_0x869c('0xe')]('DeskField,\x20%s,\x20%s',_0x40f10a,_0x186532[_0x869c('0xe')][_0x869c('0x11')]);return _0x30b629(_0x186532[_0x869c('0xe')][_0x869c('0x11')]);}else{logger[_0x869c('0xa')](_0x869c('0x10'),_0x40f10a,_0x869c('0xb'));_0x30b629(_0x186532['result']['message']);}})[_0x869c('0x12')](function(_0x79d73e){logger[_0x869c('0xe')](_0x869c('0x10'),_0x40f10a,_0x79d73e);_0x34f82b(_0x79d73e);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 250d0ef..b68ad11 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 _0xa82a=['put','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','index','get','/:id','getConfigurations','/:id/fields','post','addConfiguration'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa82a,0xfa));var _0xaa82=function(_0x4d0429,_0x542ccd){_0x4d0429=_0x4d0429-0x0;var _0x39639e=_0xa82a[_0x4d0429];return _0x39639e;};'use strict';var multer=require('multer');var util=require(_0xaa82('0x0'));var path=require(_0xaa82('0x1'));var timeout=require(_0xaa82('0x2'));var express=require(_0xaa82('0x3'));var router=express['Router']();var fs_extra=require(_0xaa82('0x4'));var auth=require(_0xaa82('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaa82('0x6'));var controller=require(_0xaa82('0x7'));router['get']('/',auth[_0xaa82('0x8')](),controller[_0xaa82('0x9')]);router[_0xaa82('0xa')](_0xaa82('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xaa82('0xa')]('/:id/configurations',auth[_0xaa82('0x8')](),controller[_0xaa82('0xc')]);router[_0xaa82('0xa')](_0xaa82('0xd'),auth[_0xaa82('0x8')](),controller['getFields']);router[_0xaa82('0xe')]('/',auth[_0xaa82('0x8')](),controller['create']);router[_0xaa82('0xe')]('/:id/configurations',auth[_0xaa82('0x8')](),controller[_0xaa82('0xf')]);router[_0xaa82('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xaa82('0x11')]);module[_0xaa82('0x12')]=router; \ No newline at end of file +var _0x95f8=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','/:id','show','get','/:id/fields','create','addConfiguration','put','update','delete','destroy','exports'];(function(_0x44d921,_0x4c7144){var _0x261df0=function(_0x1c3dbd){while(--_0x1c3dbd){_0x44d921['push'](_0x44d921['shift']());}};_0x261df0(++_0x4c7144);}(_0x95f8,0x104));var _0x895f=function(_0xab2afb,_0x546bfb){_0xab2afb=_0xab2afb-0x0;var _0x25262b=_0x95f8[_0xab2afb];return _0x25262b;};'use strict';var multer=require(_0x895f('0x0'));var util=require(_0x895f('0x1'));var path=require(_0x895f('0x2'));var timeout=require('connect-timeout');var express=require(_0x895f('0x3'));var router=express[_0x895f('0x4')]();var fs_extra=require(_0x895f('0x5'));var auth=require(_0x895f('0x6'));var interaction=require(_0x895f('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Account.controller');router['get']('/',auth[_0x895f('0x8')](),controller['index']);router['get'](_0x895f('0x9'),auth[_0x895f('0x8')](),controller[_0x895f('0xa')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x895f('0xb')](_0x895f('0xc'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0x895f('0x8')](),controller[_0x895f('0xd')]);router['post']('/:id/configurations',auth[_0x895f('0x8')](),controller[_0x895f('0xe')]);router[_0x895f('0xf')](_0x895f('0x9'),auth[_0x895f('0x8')](),controller[_0x895f('0x10')]);router[_0x895f('0x11')](_0x895f('0x9'),auth[_0x895f('0x8')](),controller[_0x895f('0x12')]);module[_0x895f('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index e1948fa..3922898 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 _0xcf71=['STRING','BOOLEAN','sequelize','exports'];(function(_0x4c1e23,_0x250906){var _0x1fad31=function(_0x3513bb){while(--_0x3513bb){_0x4c1e23['push'](_0x4c1e23['shift']());}};_0x1fad31(++_0x250906);}(_0xcf71,0xba));var _0x1cf7=function(_0x4b9cb4,_0x1f18a8){_0x4b9cb4=_0x4b9cb4-0x0;var _0x335d39=_0xcf71[_0x4b9cb4];return _0x335d39;};'use strict';var Sequelize=require(_0x1cf7('0x0'));module[_0x1cf7('0x1')]={'name':{'type':Sequelize[_0x1cf7('0x2')]},'username':{'type':Sequelize[_0x1cf7('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1cf7('0x2')]},'tenantId':{'type':Sequelize[_0x1cf7('0x2')]},'clientId':{'type':Sequelize[_0x1cf7('0x2')]},'clientSecret':{'type':Sequelize[_0x1cf7('0x2')]},'serverUrl':{'type':Sequelize[_0x1cf7('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1cf7('0x2')]},'modernAuthentication':{'type':Sequelize[_0x1cf7('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3831=['sequelize','STRING'];(function(_0x14eab9,_0x3ffe8c){var _0x53de71=function(_0x1c89b1){while(--_0x1c89b1){_0x14eab9['push'](_0x14eab9['shift']());}};_0x53de71(++_0x3ffe8c);}(_0x3831,0x14c));var _0x1383=function(_0x29c9eb,_0x3d680b){_0x29c9eb=_0x29c9eb-0x0;var _0x438352=_0x3831[_0x29c9eb];return _0x438352;};'use strict';var Sequelize=require(_0x1383('0x0'));module['exports']={'name':{'type':Sequelize[_0x1383('0x1')]},'username':{'type':Sequelize[_0x1383('0x1')]},'password':{'type':Sequelize[_0x1383('0x1')]},'remoteUri':{'type':Sequelize[_0x1383('0x1')]},'tenantId':{'type':Sequelize[_0x1383('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x1383('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x1383('0x1')]},'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 f499a68..f7db8cf 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 _0x5ef5=['type','key','model','query','keys','filters','attributes','intersection','length','limit','order','sort','pick','filter','merge','where','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','options','create','body','find','getConfigurations','findOne','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','getDescriptions','Dynamics365Configuration','Dynamics365Field','Subjects','Descriptions','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','title','description','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidyominame','slainvokedidname','slaname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','password','remoteUri','clientId','CloudProvider','data5','access_token','data7','https://login.microsoftonline.com/','tenantId','/oauth2/token','username','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','LogicalName','@odata.type','all','forEach','isNil','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','statusCode','stack','test',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','FalseOption',')/Microsoft.Dynamics.CRM.','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','json','offset','undefined','count','status','set','update','then','destroy','end','sendStatus','error','name','send','index','Dynamics365Account','fieldName'];(function(_0x32ce61,_0x2ba733){var _0x28eded=function(_0x34db11){while(--_0x34db11){_0x32ce61['push'](_0x32ce61['shift']());}};_0x28eded(++_0x2ba733);}(_0x5ef5,0xa7));var _0x55ef=function(_0x5aabd8,_0x536905){_0x5aabd8=_0x5aabd8-0x0;var _0x4d48d7=_0x5ef5[_0x5aabd8];return _0x4d48d7;};'use strict';var rp=require(_0x55ef('0x0'));var util=require(_0x55ef('0x1'));var _=require(_0x55ef('0x2'));var qs=require(_0x55ef('0x3'));var logger=require(_0x55ef('0x4'))(_0x55ef('0x5'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x401087,_0x51d432){_0x51d432=_0x51d432||0xc8;return function(_0x10dd19){if(_0x10dd19){return _0x401087['status'](_0x51d432)[_0x55ef('0x6')](_0x10dd19);}};}function respondWithFilteredResult(_0x187c0f,_0x8d949f){return function(_0x589c07){if(_0x589c07){var _0xff47aa=typeof _0x8d949f[_0x55ef('0x7')]==='undefined'&&typeof _0x8d949f['limit']===_0x55ef('0x8');var _0xf5d552=_0x589c07[_0x55ef('0x9')];var _0x4e5a7e=_0xff47aa?0x0:_0x8d949f['offset'];var _0x47f2ba=_0xff47aa?_0x589c07[_0x55ef('0x9')]:_0x8d949f[_0x55ef('0x7')]+_0x8d949f['limit'];var _0x1dffbb;if(_0x47f2ba>=_0xf5d552){_0x47f2ba=_0xf5d552;_0x1dffbb=0xc8;}else{_0x1dffbb=0xce;}_0x187c0f[_0x55ef('0xa')](_0x1dffbb);return _0x187c0f[_0x55ef('0xb')]('Content-Range',_0x4e5a7e+'-'+_0x47f2ba+'/'+_0xf5d552)['json'](_0x589c07);}return null;};}function saveUpdates(_0x5107ac){return function(_0xf4a497){if(_0xf4a497){return _0xf4a497[_0x55ef('0xc')](_0x5107ac)[_0x55ef('0xd')](function(_0x4e9a13){return _0x4e9a13;});}return null;};}function removeEntity(_0x14d0df){return function(_0x33e866){if(_0x33e866){return _0x33e866[_0x55ef('0xe')]()['then'](function(){_0x14d0df['status'](0xcc)[_0x55ef('0xf')]();});}};}function handleEntityNotFound(_0x3bf0c6){return function(_0x4bd04f){if(!_0x4bd04f){_0x3bf0c6[_0x55ef('0x10')](0x194);}return _0x4bd04f;};}function handleError(_0x9b06d7,_0x1e496c){_0x1e496c=_0x1e496c||0x1f4;return function(_0x4b0954){logger[_0x55ef('0x11')](_0x4b0954['stack']);if(_0x4b0954[_0x55ef('0x12')]){delete _0x4b0954[_0x55ef('0x12')];}_0x9b06d7['status'](_0x1e496c)[_0x55ef('0x13')](_0x4b0954);};}exports[_0x55ef('0x14')]=function(_0x5b1d77,_0x1db11f){var _0x2051ee={},_0x30c6a0={},_0x214b6e={'count':0x0,'rows':[]};var _0x5a7716=_['map'](db[_0x55ef('0x15')]['rawAttributes'],function(_0x2687d8){return{'name':_0x2687d8[_0x55ef('0x16')],'type':_0x2687d8[_0x55ef('0x17')][_0x55ef('0x18')]};});_0x30c6a0[_0x55ef('0x19')]=_['map'](_0x5a7716,'name');_0x30c6a0[_0x55ef('0x1a')]=_[_0x55ef('0x1b')](_0x5b1d77[_0x55ef('0x1a')]);_0x30c6a0[_0x55ef('0x1c')]=_['intersection'](_0x30c6a0[_0x55ef('0x19')],_0x30c6a0['query']);_0x2051ee[_0x55ef('0x1d')]=_[_0x55ef('0x1e')](_0x30c6a0[_0x55ef('0x19')],qs['fields'](_0x5b1d77[_0x55ef('0x1a')]['fields']));_0x2051ee[_0x55ef('0x1d')]=_0x2051ee['attributes'][_0x55ef('0x1f')]?_0x2051ee['attributes']:_0x30c6a0['model'];if(!_0x5b1d77['query']['hasOwnProperty']('nolimit')){_0x2051ee[_0x55ef('0x20')]=qs[_0x55ef('0x20')](_0x5b1d77[_0x55ef('0x1a')][_0x55ef('0x20')]);_0x2051ee[_0x55ef('0x7')]=qs[_0x55ef('0x7')](_0x5b1d77[_0x55ef('0x1a')][_0x55ef('0x7')]);}_0x2051ee[_0x55ef('0x21')]=qs[_0x55ef('0x22')](_0x5b1d77[_0x55ef('0x1a')][_0x55ef('0x22')]);_0x2051ee['where']=qs[_0x55ef('0x1c')](_[_0x55ef('0x23')](_0x5b1d77['query'],_0x30c6a0[_0x55ef('0x1c')]),_0x5a7716);if(_0x5b1d77[_0x55ef('0x1a')][_0x55ef('0x24')]){_0x2051ee['where']=_[_0x55ef('0x25')](_0x2051ee[_0x55ef('0x26')],{'$or':_[_0x55ef('0x27')](_0x5a7716,function(_0x4b0f80){if(_0x4b0f80[_0x55ef('0x17')]!==_0x55ef('0x28')){var _0x28fb60={};_0x28fb60[_0x4b0f80[_0x55ef('0x12')]]={'$like':'%'+_0x5b1d77[_0x55ef('0x1a')][_0x55ef('0x24')]+'%'};return _0x28fb60;}})});}_0x2051ee=_[_0x55ef('0x25')]({},_0x2051ee,_0x5b1d77['options']);var _0x235809={'where':_0x2051ee['where']};return db[_0x55ef('0x15')]['count'](_0x235809)[_0x55ef('0xd')](function(_0x32cfb0){_0x214b6e[_0x55ef('0x9')]=_0x32cfb0;if(_0x5b1d77[_0x55ef('0x1a')][_0x55ef('0x29')]){_0x2051ee[_0x55ef('0x2a')]=[{'all':!![]}];}return db[_0x55ef('0x15')][_0x55ef('0x2b')](_0x2051ee);})[_0x55ef('0xd')](function(_0x310e16){_0x214b6e[_0x55ef('0x2c')]=_0x310e16;return _0x214b6e;})['then'](respondWithFilteredResult(_0x1db11f,_0x2051ee))[_0x55ef('0x2d')](handleError(_0x1db11f,null));};exports[_0x55ef('0x2e')]=function(_0xde0871,_0x469dbc){var _0x31dc29={'raw':![],'where':{'id':_0xde0871[_0x55ef('0x2f')]['id']}},_0x54fdb4={};_0x54fdb4[_0x55ef('0x19')]=_[_0x55ef('0x1b')](db[_0x55ef('0x15')][_0x55ef('0x30')]);_0x54fdb4[_0x55ef('0x1a')]=_[_0x55ef('0x1b')](_0xde0871['query']);_0x54fdb4[_0x55ef('0x1c')]=_[_0x55ef('0x1e')](_0x54fdb4[_0x55ef('0x19')],_0x54fdb4[_0x55ef('0x1a')]);_0x31dc29[_0x55ef('0x1d')]=_[_0x55ef('0x1e')](_0x54fdb4[_0x55ef('0x19')],qs[_0x55ef('0x31')](_0xde0871['query'][_0x55ef('0x31')]));_0x31dc29[_0x55ef('0x1d')]=_0x31dc29[_0x55ef('0x1d')]['length']?_0x31dc29[_0x55ef('0x1d')]:_0x54fdb4[_0x55ef('0x19')];if(_0xde0871[_0x55ef('0x1a')][_0x55ef('0x29')]){_0x31dc29[_0x55ef('0x2a')]=[{'all':!![]}];}_0x31dc29=_[_0x55ef('0x25')]({},_0x31dc29,_0xde0871[_0x55ef('0x32')]);return db[_0x55ef('0x15')]['find'](_0x31dc29)[_0x55ef('0xd')](handleEntityNotFound(_0x469dbc,null))[_0x55ef('0xd')](respondWithResult(_0x469dbc,null))[_0x55ef('0x2d')](handleError(_0x469dbc,null));};exports[_0x55ef('0x33')]=function(_0x14565b,_0x2aa2b5){return db[_0x55ef('0x15')][_0x55ef('0x33')](_0x14565b[_0x55ef('0x34')],{})[_0x55ef('0xd')](respondWithResult(_0x2aa2b5,0xc9))[_0x55ef('0x2d')](handleError(_0x2aa2b5,null));};exports[_0x55ef('0xc')]=function(_0x24ae36,_0x2d31b0){if(_0x24ae36[_0x55ef('0x34')]['id']){delete _0x24ae36[_0x55ef('0x34')]['id'];}return db[_0x55ef('0x15')][_0x55ef('0x35')]({'where':{'id':_0x24ae36['params']['id']}})[_0x55ef('0xd')](handleEntityNotFound(_0x2d31b0,null))['then'](saveUpdates(_0x24ae36['body'],null))['then'](respondWithResult(_0x2d31b0,null))[_0x55ef('0x2d')](handleError(_0x2d31b0,null));};exports[_0x55ef('0xe')]=function(_0x4662cc,_0x337541){return db[_0x55ef('0x15')]['find']({'where':{'id':_0x4662cc[_0x55ef('0x2f')]['id']}})[_0x55ef('0xd')](handleEntityNotFound(_0x337541,null))[_0x55ef('0xd')](removeEntity(_0x337541,null))[_0x55ef('0x2d')](handleError(_0x337541,null));};exports[_0x55ef('0x36')]=function(_0x1d0c09,_0x290435){var _0xce5a71={};var _0x1def3d={};var _0x48ab8f;var _0x31b33b;return db[_0x55ef('0x15')][_0x55ef('0x37')]({'where':{'id':_0x1d0c09['params']['id']}})[_0x55ef('0xd')](handleEntityNotFound(_0x290435,null))[_0x55ef('0xd')](function(_0xc6c75a){if(_0xc6c75a){_0x48ab8f=_0xc6c75a;_0x1def3d[_0x55ef('0x19')]=_['keys'](db['Dynamics365Configuration']['rawAttributes']);_0x1def3d['query']=_[_0x55ef('0x1b')](_0x1d0c09[_0x55ef('0x1a')]);_0x1def3d['filters']=_[_0x55ef('0x1e')](_0x1def3d[_0x55ef('0x19')],_0x1def3d[_0x55ef('0x1a')]);_0xce5a71[_0x55ef('0x1d')]=_[_0x55ef('0x1e')](_0x1def3d[_0x55ef('0x19')],qs[_0x55ef('0x31')](_0x1d0c09['query']['fields']));_0xce5a71['attributes']=_0xce5a71[_0x55ef('0x1d')][_0x55ef('0x1f')]?_0xce5a71[_0x55ef('0x1d')]:_0x1def3d[_0x55ef('0x19')];_0xce5a71[_0x55ef('0x21')]=qs[_0x55ef('0x22')](_0x1d0c09[_0x55ef('0x1a')][_0x55ef('0x22')]);_0xce5a71[_0x55ef('0x26')]=qs['filters'](_[_0x55ef('0x23')](_0x1d0c09[_0x55ef('0x1a')],_0x1def3d[_0x55ef('0x1c')]));if(_0x1d0c09[_0x55ef('0x1a')][_0x55ef('0x24')]){_0xce5a71[_0x55ef('0x26')]=_['merge'](_0xce5a71['where'],{'$or':_[_0x55ef('0x27')](_0xce5a71[_0x55ef('0x1d')],function(_0x1d4ed1){var _0x15174c={};_0x15174c[_0x1d4ed1]={'$like':'%'+_0x1d0c09['query'][_0x55ef('0x24')]+'%'};return _0x15174c;})});}_0xce5a71=_[_0x55ef('0x25')]({},_0xce5a71,_0x1d0c09[_0x55ef('0x32')]);return _0x48ab8f[_0x55ef('0x36')](_0xce5a71);}})[_0x55ef('0xd')](function(_0x53c971){if(_0x53c971){_0x31b33b=_0x53c971[_0x55ef('0x1f')];if(!_0x1d0c09[_0x55ef('0x1a')][_0x55ef('0x38')]('nolimit')){_0xce5a71[_0x55ef('0x20')]=qs[_0x55ef('0x20')](_0x1d0c09[_0x55ef('0x1a')]['limit']);_0xce5a71[_0x55ef('0x7')]=qs[_0x55ef('0x7')](_0x1d0c09['query'][_0x55ef('0x7')]);}return _0x48ab8f[_0x55ef('0x36')](_0xce5a71);}})['then'](function(_0x2fa7ae){if(_0x2fa7ae){return _0x2fa7ae?{'count':_0x31b33b,'rows':_0x2fa7ae}:null;}})[_0x55ef('0xd')](respondWithResult(_0x290435,null))[_0x55ef('0x2d')](handleError(_0x290435,null));};exports[_0x55ef('0x39')]=function(_0x685390,_0xd82229){if(_0x685390[_0x55ef('0x34')]['id']){delete _0x685390[_0x55ef('0x34')]['id'];}return db[_0x55ef('0x15')]['findOne']({'where':{'id':_0x685390['params']['id']}})['then'](handleEntityNotFound(_0xd82229,null))[_0x55ef('0xd')](function(_0x14f000){if(_0x14f000){_0x685390['body'][_0x55ef('0x3a')]=_0x14f000['id'];_0x685390[_0x55ef('0x34')]['Subjects']=integrations[_0x55ef('0x3b')](_0x685390[_0x55ef('0x34')][_0x55ef('0x3c')],_0x685390[_0x55ef('0x34')]['type']);_0x685390[_0x55ef('0x34')]['Descriptions']=integrations[_0x55ef('0x3d')](_0x685390[_0x55ef('0x34')]['channel'],_0x685390[_0x55ef('0x34')][_0x55ef('0x17')]);return db[_0x55ef('0x3e')]['create'](_0x685390[_0x55ef('0x34')],{'include':[{'model':db[_0x55ef('0x3f')],'as':_0x55ef('0x40')},{'model':db[_0x55ef('0x3f')],'as':_0x55ef('0x41')}]});}return null;})[_0x55ef('0xd')](respondWithResult(_0xd82229,null))[_0x55ef('0x2d')](handleError(_0xd82229,null));};function sanitizeRemoteUri(_0x4404a3){var _0x14db65=_0x4404a3[_0x55ef('0x42')](-0x1);if(_0x14db65==='/')return _0x4404a3[_0x55ef('0x43')](0x0,_0x4404a3[_0x55ef('0x44')](_0x14db65));return _0x4404a3;}function getWebApiUrl(_0x7488c3){return util[_0x55ef('0x45')](_0x55ef('0x46'),_0x7488c3);}exports[_0x55ef('0x47')]=function(_0x4ed647,_0x405ea2){var _0xa9bce3=_0x4ed647[_0x55ef('0x1a')][_0x55ef('0x48')];var _0x473df3=_0xa9bce3===_0x55ef('0x49')?_0x55ef('0x4a'):'PhoneCall';var _0x3c9706='';var _0x5eaf72='';var _0x2bc1fd='';var _0x34cd70='';var _0x232218='';var _0x51c7cc='';var _0x87f14d='';var _0x4e5bb6='';var _0x51f776=[_0x55ef('0x4b'),_0x55ef('0x4c'),'customerid',_0x55ef('0x4d'),_0x55ef('0x4e'),_0x55ef('0x4f'),_0x55ef('0x50'),_0x55ef('0x51'),'directioncode',_0x55ef('0x52')];var _0x363ca9=[_0x55ef('0x53'),_0x55ef('0x54'),_0x55ef('0x55'),_0x55ef('0x56'),_0x55ef('0x57'),_0x55ef('0x58'),_0x55ef('0x59'),_0x55ef('0x5a'),_0x55ef('0x5b'),_0x55ef('0x5c'),_0x55ef('0x5d'),_0x55ef('0x5e'),_0x55ef('0x5f'),_0x55ef('0x60'),_0x55ef('0x61'),_0x55ef('0x62'),'customeridtype',_0x55ef('0x63'),_0x55ef('0x64'),_0x55ef('0x65'),_0x55ef('0x66'),_0x55ef('0x67'),'escalatedon',_0x55ef('0x68'),'firstresponsebykpiidname','followupby','importsequencenumber',_0x55ef('0x69'),_0x55ef('0x6a'),_0x55ef('0x6b'),'masteridname',_0x55ef('0x6c'),_0x55ef('0x6d'),_0x55ef('0x6e'),_0x55ef('0x6f'),'modifiedon',_0x55ef('0x70'),_0x55ef('0x71'),'msdyn_incidenttypename',_0x55ef('0x72'),_0x55ef('0x73'),_0x55ef('0x74'),_0x55ef('0x75'),_0x55ef('0x76'),_0x55ef('0x77'),_0x55ef('0x78'),_0x55ef('0x79'),_0x55ef('0x7a'),_0x55ef('0x7b'),_0x55ef('0x7c'),_0x55ef('0x7d'),_0x55ef('0x7e'),'resolveby',_0x55ef('0x7f'),_0x55ef('0x80'),'responsiblecontactidname',_0x55ef('0x81'),'sentimentvalue',_0x55ef('0x82'),_0x55ef('0x83'),'socialprofileidname',_0x55ef('0x84'),'statuscode',_0x55ef('0x85'),_0x55ef('0x86'),_0x55ef('0x87'),_0x55ef('0x88'),_0x55ef('0x89'),'utcconversiontimezonecode',_0x55ef('0x8a')];var _0x1949dc=_0x51f776[_0x55ef('0x8b')](_0x363ca9);return db[_0x55ef('0x15')][_0x55ef('0x37')]({'where':{'id':_0x4ed647[_0x55ef('0x2f')]['id']},'attributes':['id','username',_0x55ef('0x8c'),_0x55ef('0x8d'),'tenantId',_0x55ef('0x8e'),'clientSecret','modernAuthentication'],'include':[{'model':db[_0x55ef('0x8f')],'as':_0x55ef('0x8f'),'attributes':['id',_0x55ef('0x90'),'data7']}]})[_0x55ef('0xd')](handleEntityNotFound(_0x405ea2,null))[_0x55ef('0xd')](function(_0x4d74ca){if(_0x4d74ca){if(_0x4d74ca['modernAuthentication']){_0x4d74ca[_0x55ef('0x91')]=_0x4d74ca[_0x55ef('0x8f')][_0x55ef('0x90')];_0x4e5bb6=sanitizeRemoteUri(_0x4d74ca[_0x55ef('0x8f')][_0x55ef('0x92')]);_0x87f14d=getWebApiUrl(_0x4e5bb6);return _0x4d74ca;}_0x4e5bb6=sanitizeRemoteUri(_0x4d74ca[_0x55ef('0x8d')]);_0x87f14d=getWebApiUrl(_0x4e5bb6);var _0x27ca48={'method':'POST','uri':_0x55ef('0x93')+_0x4d74ca[_0x55ef('0x94')]+_0x55ef('0x95'),'form':{'client_id':_0x4d74ca['clientId'],'resource':_0x4e5bb6,'username':_0x4d74ca[_0x55ef('0x96')],'password':_0x4d74ca[_0x55ef('0x8c')],'grant_type':_0x55ef('0x8c'),'client_secret':_0x4d74ca[_0x55ef('0x97')]},'json':!![]};return rp(_0x27ca48);}})[_0x55ef('0xd')](function(_0x5cdfcd){_0x51c7cc=_0x5cdfcd[_0x55ef('0x91')];var _0xa411d4={'method':_0x55ef('0x98'),'uri':encodeURI(_0x87f14d+_0x55ef('0x99')+_0x473df3+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x51c7cc,'If-None-Match':null,'OData-Version':_0x55ef('0x9a')},'json':!![]};return rp(_0xa411d4);})[_0x55ef('0xd')](function(_0x2f7110){var _0x4cca78=_0x2f7110[_0x55ef('0x9b')][0x0];var _0x41abc8=_0x4cca78[_0x55ef('0x9c')];var _0x202787={'method':'GET','uri':_0x87f14d+_0x55ef('0x9d')+_0x41abc8+_0x55ef('0x9e'),'headers':{'Authorization':_0x55ef('0x9f')+_0x51c7cc,'If-None-Match':null,'OData-Version':_0x55ef('0x9a')},'json':!![]};return rp(_0x202787);})['then'](function(_0x3bd26c){_0x3c9706=_0x3bd26c;_0x5eaf72=_0x3c9706[_0x55ef('0xa0')];_0x5eaf72=_[_0x55ef('0xa1')](_0x5eaf72,function(_0xb3c00f){return!_0x1949dc['includes'](_0xb3c00f[_0x55ef('0xa2')]);});var _0x133cd1=[];var _0x37812b=[];_0x5eaf72['forEach'](function(_0x3be347){if(_0x3be347[_0x55ef('0xa3')]){var _0x280c96=_0x3be347[_0x55ef('0xa3')]['substring'](_0x3be347['@odata.type'][_0x55ef('0x44')]('.')+0x1);if(_0x280c96==='PicklistAttributeMetadata'){_0x133cd1['push'](getSelectList(_0x87f14d,_0xa9bce3,_0x37812b,_0x3c9706[_0x55ef('0x9c')],_0x3be347[_0x55ef('0x9c')],_0x51c7cc));}}});return Promise[_0x55ef('0xa4')](_0x133cd1);})[_0x55ef('0xd')](function(_0x4220ed){_0x2bc1fd=_0x4220ed[0x0];var _0xd6915b=[];var _0x18e83d=[];_0x5eaf72[_0x55ef('0xa5')](function(_0x2b776c){if(!_[_0x55ef('0xa6')](_0x2b776c[_0x55ef('0xa3')])){var _0x155a63=_0x2b776c[_0x55ef('0xa3')][_0x55ef('0x43')](_0x2b776c[_0x55ef('0xa3')][_0x55ef('0x44')]('.')+0x1);if(_0x155a63==='BooleanAttributeMetadata'){_0xd6915b[_0x55ef('0xa7')](getBooleanList(_0x87f14d,_0xa9bce3,_0x18e83d,_0x3c9706[_0x55ef('0x9c')],_0x2b776c[_0x55ef('0x9c')],_0x51c7cc));}}});return Promise['all'](_0xd6915b);})[_0x55ef('0xd')](function(_0x5bab9a){_0x34cd70=_0x5bab9a[0x0];var _0x3b9999=[];var _0x3c859b=[];_0x5eaf72[_0x55ef('0xa5')](function(_0xcfd2b1){if(_0xcfd2b1[_0x55ef('0xa3')]){var _0x340034=_0xcfd2b1[_0x55ef('0xa3')][_0x55ef('0x43')](_0xcfd2b1[_0x55ef('0xa3')][_0x55ef('0x44')]('.')+0x1);if(_0x340034===_0x55ef('0xa8')||_0x340034===_0x55ef('0xa9')||_0x340034===_0x55ef('0xaa')||_0x340034===_0x55ef('0xab')||_0x340034===_0x55ef('0xac')||_0x340034==='DateTimeAttributeMetadata'||_0x340034===_0x55ef('0xad')||_0x340034===_0x55ef('0xae')||_0x340034===_0x55ef('0xaf')||_0x340034==='DecimalAttributeMetadata'){_0x3b9999[_0x55ef('0xa7')](getInputList(_0x87f14d,_0xa9bce3,_0x340034,_0x3c859b,_0x3c9706[_0x55ef('0x9c')],_0xcfd2b1['MetadataId'],_0x51c7cc));}}});return Promise[_0x55ef('0xa4')](_0x3b9999);})[_0x55ef('0xd')](function(_0x3eb73a){_0x232218=_0x3eb73a[0x0];var _0xa9ec64=_0x2bc1fd[_0x55ef('0x8b')](_0x34cd70)[_0x55ef('0x8b')](_0x232218);var _0x4baa5a={'count':_0xa9ec64[_0x55ef('0x1f')],'rows':_0xa9ec64};return _0x4baa5a;})['then'](respondWithResult(_0x405ea2,null))[_0x55ef('0x2d')](function(_0x3c96d1){var _0x2337e2=_0x4ed647[_0x55ef('0x1a')]['test']?0x1f4:_0x3c96d1[_0x55ef('0xb0')]||0x1f4;logger[_0x55ef('0x11')](_0x3c96d1[_0x55ef('0xb1')]);delete _0x3c96d1[_0x55ef('0x12')];if(_0x2337e2===0x191){_0x2337e2=0x190;}_0x405ea2[_0x55ef('0xa')](_0x2337e2)[_0x55ef('0x13')](_0x4ed647[_0x55ef('0x1a')][_0x55ef('0xb2')]?{'message':'Wrong\x20credentials','statusCode':_0x3c96d1[_0x55ef('0xb0')]}:_0x3c96d1);});};function getSelectList(_0x228d7a,_0x3f5982,_0x3b96ef,_0x2658c2,_0x4084b2,_0x49a197){var _0x4703fe={'method':_0x55ef('0x98'),'uri':_0x228d7a+_0x55ef('0x9d')+_0x2658c2+_0x55ef('0xb3')+_0x4084b2+_0x55ef('0xb4')+_0x55ef('0xb5'),'headers':{'Authorization':'Bearer\x20'+_0x49a197,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4703fe)['then'](function(_0x417911){var _0x21f65a=[];var _0x490299=_0x417911[_0x55ef('0xb6')][_0x55ef('0xb7')];_0x490299[_0x55ef('0xa5')](function(_0x24a2d9){_0x21f65a[_0x55ef('0xa7')]({'name':_0x24a2d9[_0x55ef('0xb8')]['UserLocalizedLabel']['Label'],'value':String(_0x24a2d9['Value'])});});var _0x221b65={'id':_0x3f5982+'_'+_0x417911['LogicalName'],'name':_0x417911[_0x55ef('0xb9')][_0x55ef('0xba')]['Label'],'custom':![],'options':_0x21f65a};_0x3b96ef[_0x55ef('0xa7')](_0x221b65);return _0x3b96ef;});}function getBooleanList(_0x1bd620,_0x564ef4,_0x26c81e,_0x4e6a20,_0x3baf49,_0x592d20){var _0x1fda52={'method':'GET','uri':_0x1bd620+_0x55ef('0x9d')+_0x4e6a20+_0x55ef('0xb3')+_0x3baf49+_0x55ef('0xbb'),'headers':{'Authorization':_0x55ef('0x9f')+_0x592d20,'If-None-Match':null,'OData-Version':_0x55ef('0x9a')},'json':!![]};return rp(_0x1fda52)[_0x55ef('0xd')](function(_0x529b85){var _0x2fbf06=[];_0x2fbf06[_0x55ef('0xa7')]({'name':_0x529b85['OptionSet']['TrueOption'][_0x55ef('0xb8')][_0x55ef('0xba')][_0x55ef('0xb8')],'value':'true'},{'name':_0x529b85[_0x55ef('0xb6')][_0x55ef('0xbc')]['Label'][_0x55ef('0xba')]['Label'],'value':'false'});var _0x50148b={'id':_0x564ef4+'_'+_0x529b85[_0x55ef('0xa2')],'name':_0x529b85[_0x55ef('0xb9')][_0x55ef('0xba')]['Label'],'custom':![],'options':_0x2fbf06};_0x26c81e[_0x55ef('0xa7')](_0x50148b);return _0x26c81e;});}function getInputList(_0x35d5ba,_0x4c4910,_0x5c256d,_0x2a5fe4,_0xb5af34,_0x4076d6,_0x3b41a2){var _0x50f937={'method':'GET','uri':_0x35d5ba+_0x55ef('0x9d')+_0xb5af34+')/Attributes('+_0x4076d6+_0x55ef('0xbd')+_0x5c256d+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x3b41a2,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x50f937)[_0x55ef('0xd')](function(_0x4f48e4){var _0x545978={'id':_0x4c4910+'_'+_0x4f48e4[_0x55ef('0xa2')],'name':_0x4f48e4['DisplayName'][_0x55ef('0xba')]?_0x4f48e4[_0x55ef('0xb9')][_0x55ef('0xba')]['Label']:_0x4f48e4[_0x55ef('0xa2')],'custom':![],'options':[]};_0x2a5fe4[_0x55ef('0xa7')](_0x545978);return _0x2a5fe4;});} \ No newline at end of file +var _0x9f48=['order','getConfigurations','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','slice','substring','lastIndexOf','format','incident','Incident','PhoneCall','description','customerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','masteridname','modifiedbyname','modifiedbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','findOne','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','username','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','error','send','Wrong\x20credentials','statusCode',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','OptionSet','Options','Label','Value','DisplayName','UserLocalizedLabel','GET',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../config/logger','api','../../mysqldb','status','json','limit','undefined','count','offset','Content-Range','update','then','destroy','end','stack','name','map','Dynamics365Account','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','include','rows','params','options','find','catch','create','body','Dynamics365Configuration'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x9f48,0x1ee));var _0x89f4=function(_0x553837,_0x161714){_0x553837=_0x553837-0x0;var _0x124212=_0x9f48[_0x553837];return _0x124212;};'use strict';var rp=require(_0x89f4('0x0'));var util=require(_0x89f4('0x1'));var _=require(_0x89f4('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x89f4('0x3'))(_0x89f4('0x4'));var db=require(_0x89f4('0x5'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x18cb67,_0x5f4054){_0x5f4054=_0x5f4054||0xc8;return function(_0x18c3c1){if(_0x18c3c1){return _0x18cb67[_0x89f4('0x6')](_0x5f4054)[_0x89f4('0x7')](_0x18c3c1);}};}function respondWithFilteredResult(_0x8c05d5,_0xcb18b2){return function(_0x1da726){if(_0x1da726){var _0x56b26e=typeof _0xcb18b2['offset']==='undefined'&&typeof _0xcb18b2[_0x89f4('0x8')]===_0x89f4('0x9');var _0x52ac0e=_0x1da726[_0x89f4('0xa')];var _0x5a4725=_0x56b26e?0x0:_0xcb18b2[_0x89f4('0xb')];var _0x45dbfe=_0x56b26e?_0x1da726[_0x89f4('0xa')]:_0xcb18b2[_0x89f4('0xb')]+_0xcb18b2[_0x89f4('0x8')];var _0xa40feb;if(_0x45dbfe>=_0x52ac0e){_0x45dbfe=_0x52ac0e;_0xa40feb=0xc8;}else{_0xa40feb=0xce;}_0x8c05d5['status'](_0xa40feb);return _0x8c05d5['set'](_0x89f4('0xc'),_0x5a4725+'-'+_0x45dbfe+'/'+_0x52ac0e)[_0x89f4('0x7')](_0x1da726);}return null;};}function saveUpdates(_0x295677){return function(_0x21d551){if(_0x21d551){return _0x21d551[_0x89f4('0xd')](_0x295677)[_0x89f4('0xe')](function(_0x2c4be8){return _0x2c4be8;});}return null;};}function removeEntity(_0x327dcb){return function(_0x4482eb){if(_0x4482eb){return _0x4482eb[_0x89f4('0xf')]()[_0x89f4('0xe')](function(){_0x327dcb[_0x89f4('0x6')](0xcc)[_0x89f4('0x10')]();});}};}function handleEntityNotFound(_0x248684){return function(_0x4adc08){if(!_0x4adc08){_0x248684['sendStatus'](0x194);}return _0x4adc08;};}function handleError(_0x2ee292,_0x394436){_0x394436=_0x394436||0x1f4;return function(_0x44c16e){logger['error'](_0x44c16e[_0x89f4('0x11')]);if(_0x44c16e[_0x89f4('0x12')]){delete _0x44c16e['name'];}_0x2ee292[_0x89f4('0x6')](_0x394436)['send'](_0x44c16e);};}exports['index']=function(_0x4ddee5,_0x1d5a37){var _0x428c46={},_0x4d5748={},_0xd10531={'count':0x0,'rows':[]};var _0x140fb6=_[_0x89f4('0x13')](db[_0x89f4('0x14')][_0x89f4('0x15')],function(_0x99365b){return{'name':_0x99365b[_0x89f4('0x16')],'type':_0x99365b[_0x89f4('0x17')]['key']};});_0x4d5748[_0x89f4('0x18')]=_[_0x89f4('0x13')](_0x140fb6,_0x89f4('0x12'));_0x4d5748['query']=_[_0x89f4('0x19')](_0x4ddee5[_0x89f4('0x1a')]);_0x4d5748[_0x89f4('0x1b')]=_[_0x89f4('0x1c')](_0x4d5748[_0x89f4('0x18')],_0x4d5748[_0x89f4('0x1a')]);_0x428c46[_0x89f4('0x1d')]=_['intersection'](_0x4d5748[_0x89f4('0x18')],qs[_0x89f4('0x1e')](_0x4ddee5[_0x89f4('0x1a')]['fields']));_0x428c46[_0x89f4('0x1d')]=_0x428c46['attributes'][_0x89f4('0x1f')]?_0x428c46[_0x89f4('0x1d')]:_0x4d5748['model'];if(!_0x4ddee5['query'][_0x89f4('0x20')](_0x89f4('0x21'))){_0x428c46[_0x89f4('0x8')]=qs[_0x89f4('0x8')](_0x4ddee5[_0x89f4('0x1a')][_0x89f4('0x8')]);_0x428c46['offset']=qs[_0x89f4('0xb')](_0x4ddee5['query'][_0x89f4('0xb')]);}_0x428c46['order']=qs[_0x89f4('0x22')](_0x4ddee5['query'][_0x89f4('0x22')]);_0x428c46['where']=qs['filters'](_[_0x89f4('0x23')](_0x4ddee5['query'],_0x4d5748['filters']),_0x140fb6);if(_0x4ddee5['query'][_0x89f4('0x24')]){_0x428c46[_0x89f4('0x25')]=_[_0x89f4('0x26')](_0x428c46['where'],{'$or':_[_0x89f4('0x13')](_0x140fb6,function(_0x52789f){if(_0x52789f['type']!==_0x89f4('0x27')){var _0x23372c={};_0x23372c[_0x52789f['name']]={'$like':'%'+_0x4ddee5[_0x89f4('0x1a')][_0x89f4('0x24')]+'%'};return _0x23372c;}})});}_0x428c46=_[_0x89f4('0x26')]({},_0x428c46,_0x4ddee5['options']);var _0x13549d={'where':_0x428c46[_0x89f4('0x25')]};return db[_0x89f4('0x14')][_0x89f4('0xa')](_0x13549d)['then'](function(_0x181958){_0xd10531['count']=_0x181958;if(_0x4ddee5[_0x89f4('0x1a')]['includeAll']){_0x428c46[_0x89f4('0x28')]=[{'all':!![]}];}return db[_0x89f4('0x14')]['findAll'](_0x428c46);})[_0x89f4('0xe')](function(_0x3379b3){_0xd10531[_0x89f4('0x29')]=_0x3379b3;return _0xd10531;})[_0x89f4('0xe')](respondWithFilteredResult(_0x1d5a37,_0x428c46))['catch'](handleError(_0x1d5a37,null));};exports['show']=function(_0x3ac202,_0x2f38c7){var _0x33b9af={'raw':![],'where':{'id':_0x3ac202[_0x89f4('0x2a')]['id']}},_0x3d1529={};_0x3d1529[_0x89f4('0x18')]=_[_0x89f4('0x19')](db[_0x89f4('0x14')][_0x89f4('0x15')]);_0x3d1529[_0x89f4('0x1a')]=_[_0x89f4('0x19')](_0x3ac202[_0x89f4('0x1a')]);_0x3d1529[_0x89f4('0x1b')]=_['intersection'](_0x3d1529['model'],_0x3d1529[_0x89f4('0x1a')]);_0x33b9af[_0x89f4('0x1d')]=_[_0x89f4('0x1c')](_0x3d1529[_0x89f4('0x18')],qs['fields'](_0x3ac202[_0x89f4('0x1a')]['fields']));_0x33b9af[_0x89f4('0x1d')]=_0x33b9af[_0x89f4('0x1d')]['length']?_0x33b9af[_0x89f4('0x1d')]:_0x3d1529[_0x89f4('0x18')];if(_0x3ac202[_0x89f4('0x1a')]['includeAll']){_0x33b9af[_0x89f4('0x28')]=[{'all':!![]}];}_0x33b9af=_[_0x89f4('0x26')]({},_0x33b9af,_0x3ac202[_0x89f4('0x2b')]);return db[_0x89f4('0x14')][_0x89f4('0x2c')](_0x33b9af)[_0x89f4('0xe')](handleEntityNotFound(_0x2f38c7,null))[_0x89f4('0xe')](respondWithResult(_0x2f38c7,null))[_0x89f4('0x2d')](handleError(_0x2f38c7,null));};exports[_0x89f4('0x2e')]=function(_0x24e712,_0x5507da){return db[_0x89f4('0x14')][_0x89f4('0x2e')](_0x24e712['body'],{})['then'](respondWithResult(_0x5507da,0xc9))[_0x89f4('0x2d')](handleError(_0x5507da,null));};exports['update']=function(_0x4fd7f6,_0x47b7ea){if(_0x4fd7f6[_0x89f4('0x2f')]['id']){delete _0x4fd7f6['body']['id'];}return db[_0x89f4('0x14')][_0x89f4('0x2c')]({'where':{'id':_0x4fd7f6['params']['id']}})[_0x89f4('0xe')](handleEntityNotFound(_0x47b7ea,null))[_0x89f4('0xe')](saveUpdates(_0x4fd7f6[_0x89f4('0x2f')],null))['then'](respondWithResult(_0x47b7ea,null))[_0x89f4('0x2d')](handleError(_0x47b7ea,null));};exports[_0x89f4('0xf')]=function(_0x451b64,_0x3e5c2f){return db[_0x89f4('0x14')][_0x89f4('0x2c')]({'where':{'id':_0x451b64[_0x89f4('0x2a')]['id']}})[_0x89f4('0xe')](handleEntityNotFound(_0x3e5c2f,null))[_0x89f4('0xe')](removeEntity(_0x3e5c2f,null))[_0x89f4('0x2d')](handleError(_0x3e5c2f,null));};exports['getConfigurations']=function(_0x5c512f,_0x37a411){var _0x3c883a={};var _0x1b132f={};var _0x209e88;var _0x137b19;return db['Dynamics365Account']['findOne']({'where':{'id':_0x5c512f[_0x89f4('0x2a')]['id']}})['then'](handleEntityNotFound(_0x37a411,null))['then'](function(_0x397e05){if(_0x397e05){_0x209e88=_0x397e05;_0x1b132f[_0x89f4('0x18')]=_[_0x89f4('0x19')](db[_0x89f4('0x30')][_0x89f4('0x15')]);_0x1b132f['query']=_[_0x89f4('0x19')](_0x5c512f[_0x89f4('0x1a')]);_0x1b132f['filters']=_['intersection'](_0x1b132f[_0x89f4('0x18')],_0x1b132f[_0x89f4('0x1a')]);_0x3c883a[_0x89f4('0x1d')]=_['intersection'](_0x1b132f[_0x89f4('0x18')],qs[_0x89f4('0x1e')](_0x5c512f[_0x89f4('0x1a')][_0x89f4('0x1e')]));_0x3c883a['attributes']=_0x3c883a[_0x89f4('0x1d')][_0x89f4('0x1f')]?_0x3c883a[_0x89f4('0x1d')]:_0x1b132f[_0x89f4('0x18')];_0x3c883a[_0x89f4('0x31')]=qs['sort'](_0x5c512f['query']['sort']);_0x3c883a[_0x89f4('0x25')]=qs['filters'](_[_0x89f4('0x23')](_0x5c512f[_0x89f4('0x1a')],_0x1b132f[_0x89f4('0x1b')]));if(_0x5c512f[_0x89f4('0x1a')]['filter']){_0x3c883a[_0x89f4('0x25')]=_[_0x89f4('0x26')](_0x3c883a['where'],{'$or':_[_0x89f4('0x13')](_0x3c883a[_0x89f4('0x1d')],function(_0x4f4c96){var _0x174c37={};_0x174c37[_0x4f4c96]={'$like':'%'+_0x5c512f['query']['filter']+'%'};return _0x174c37;})});}_0x3c883a=_[_0x89f4('0x26')]({},_0x3c883a,_0x5c512f[_0x89f4('0x2b')]);return _0x209e88[_0x89f4('0x32')](_0x3c883a);}})[_0x89f4('0xe')](function(_0x4798eb){if(_0x4798eb){_0x137b19=_0x4798eb[_0x89f4('0x1f')];if(!_0x5c512f[_0x89f4('0x1a')][_0x89f4('0x20')]('nolimit')){_0x3c883a[_0x89f4('0x8')]=qs[_0x89f4('0x8')](_0x5c512f[_0x89f4('0x1a')][_0x89f4('0x8')]);_0x3c883a[_0x89f4('0xb')]=qs[_0x89f4('0xb')](_0x5c512f[_0x89f4('0x1a')][_0x89f4('0xb')]);}return _0x209e88['getConfigurations'](_0x3c883a);}})[_0x89f4('0xe')](function(_0xcb8058){if(_0xcb8058){return _0xcb8058?{'count':_0x137b19,'rows':_0xcb8058}:null;}})[_0x89f4('0xe')](respondWithResult(_0x37a411,null))[_0x89f4('0x2d')](handleError(_0x37a411,null));};exports['addConfiguration']=function(_0x25ce90,_0x634c39){if(_0x25ce90[_0x89f4('0x2f')]['id']){delete _0x25ce90[_0x89f4('0x2f')]['id'];}return db[_0x89f4('0x14')]['findOne']({'where':{'id':_0x25ce90[_0x89f4('0x2a')]['id']}})['then'](handleEntityNotFound(_0x634c39,null))['then'](function(_0x3e21e5){if(_0x3e21e5){_0x25ce90['body'][_0x89f4('0x33')]=_0x3e21e5['id'];_0x25ce90[_0x89f4('0x2f')][_0x89f4('0x34')]=integrations[_0x89f4('0x35')](_0x25ce90[_0x89f4('0x2f')][_0x89f4('0x36')],_0x25ce90[_0x89f4('0x2f')][_0x89f4('0x17')]);_0x25ce90['body']['Descriptions']=integrations[_0x89f4('0x37')](_0x25ce90['body'][_0x89f4('0x36')],_0x25ce90['body'][_0x89f4('0x17')]);return db[_0x89f4('0x30')][_0x89f4('0x2e')](_0x25ce90[_0x89f4('0x2f')],{'include':[{'model':db[_0x89f4('0x38')],'as':'Subjects'},{'model':db[_0x89f4('0x38')],'as':_0x89f4('0x39')}]});}return null;})[_0x89f4('0xe')](respondWithResult(_0x634c39,null))['catch'](handleError(_0x634c39,null));};function sanitizeRemoteUri(_0x1134bd){var _0x548b6d=_0x1134bd[_0x89f4('0x3a')](-0x1);if(_0x548b6d==='/')return _0x1134bd[_0x89f4('0x3b')](0x0,_0x1134bd[_0x89f4('0x3c')](_0x548b6d));return _0x1134bd;}function getWebApiUrl(_0x4d03f6){return util[_0x89f4('0x3d')]('%s/api/data/v9.0/',_0x4d03f6);}exports['getFields']=function(_0x441efd,_0x25171f){var _0x2467ce=_0x441efd[_0x89f4('0x1a')]['ticketType'];var _0x118eb2=_0x2467ce===_0x89f4('0x3e')?_0x89f4('0x3f'):_0x89f4('0x40');var _0x5c098b='';var _0x2d0244='';var _0x5710b2='';var _0x481a86='';var _0x24a4df='';var _0x51f378='';var _0x37b646='';var _0x14517a='';var _0x53694c=['title',_0x89f4('0x41'),_0x89f4('0x42'),'ownerid',_0x89f4('0x43'),_0x89f4('0x44'),_0x89f4('0x45'),_0x89f4('0x46'),_0x89f4('0x47'),_0x89f4('0x48')];var _0x31af38=['accountidname',_0x89f4('0x49'),_0x89f4('0x4a'),_0x89f4('0x4b'),'contactidname',_0x89f4('0x4c'),_0x89f4('0x4d'),_0x89f4('0x4e'),'createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame',_0x89f4('0x4f'),_0x89f4('0x50'),_0x89f4('0x51'),_0x89f4('0x52'),_0x89f4('0x53'),'customeridyominame',_0x89f4('0x54'),_0x89f4('0x55'),'entityimage_timestamp',_0x89f4('0x56'),'escalatedon',_0x89f4('0x57'),_0x89f4('0x58'),_0x89f4('0x59'),_0x89f4('0x5a'),'influencescore',_0x89f4('0x5b'),'lastonholdtime',_0x89f4('0x5c'),'modifiedbyexternalpartyname','modifiedbyexternalpartyyominame',_0x89f4('0x5d'),_0x89f4('0x5e'),'modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0x89f4('0x5f'),_0x89f4('0x60'),_0x89f4('0x61'),_0x89f4('0x62'),_0x89f4('0x63'),_0x89f4('0x64'),'owneridtype',_0x89f4('0x65'),_0x89f4('0x66'),_0x89f4('0x67'),_0x89f4('0x68'),'prioritycodename','productidname',_0x89f4('0x69'),_0x89f4('0x6a'),'resolvebykpiidname',_0x89f4('0x6b'),_0x89f4('0x6c'),_0x89f4('0x6d'),_0x89f4('0x6e'),_0x89f4('0x6f'),_0x89f4('0x70'),_0x89f4('0x71'),'statecode',_0x89f4('0x72'),_0x89f4('0x73'),'ticketnumber',_0x89f4('0x74'),_0x89f4('0x75'),_0x89f4('0x76'),_0x89f4('0x77'),_0x89f4('0x78')];var _0x49c5a3=_0x53694c[_0x89f4('0x79')](_0x31af38);return db['Dynamics365Account'][_0x89f4('0x7a')]({'where':{'id':_0x441efd['params']['id']},'attributes':['id','username',_0x89f4('0x7b'),_0x89f4('0x7c'),_0x89f4('0x7d'),_0x89f4('0x7e'),_0x89f4('0x7f'),_0x89f4('0x80')],'include':[{'model':db[_0x89f4('0x81')],'as':'CloudProvider','attributes':['id',_0x89f4('0x82'),_0x89f4('0x83')]}]})[_0x89f4('0xe')](handleEntityNotFound(_0x25171f,null))[_0x89f4('0xe')](function(_0x2dca9a){if(_0x2dca9a){if(_0x2dca9a['modernAuthentication']){_0x2dca9a[_0x89f4('0x84')]=_0x2dca9a[_0x89f4('0x81')][_0x89f4('0x82')];_0x14517a=sanitizeRemoteUri(_0x2dca9a[_0x89f4('0x81')][_0x89f4('0x83')]);_0x37b646=getWebApiUrl(_0x14517a);return _0x2dca9a;}_0x14517a=sanitizeRemoteUri(_0x2dca9a['remoteUri']);_0x37b646=getWebApiUrl(_0x14517a);var _0x4f3bf4={'method':_0x89f4('0x85'),'uri':_0x89f4('0x86')+_0x2dca9a['tenantId']+_0x89f4('0x87'),'form':{'client_id':_0x2dca9a[_0x89f4('0x7e')],'resource':_0x14517a,'username':_0x2dca9a[_0x89f4('0x88')],'password':_0x2dca9a[_0x89f4('0x7b')],'grant_type':'password','client_secret':_0x2dca9a['clientSecret']},'json':!![]};return rp(_0x4f3bf4);}})[_0x89f4('0xe')](function(_0x1bd7e9){_0x51f378=_0x1bd7e9[_0x89f4('0x84')];var _0x234a0b={'method':'GET','uri':encodeURI(_0x37b646+_0x89f4('0x89')+_0x118eb2+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x51f378,'If-None-Match':null,'OData-Version':_0x89f4('0x8a')},'json':!![]};return rp(_0x234a0b);})[_0x89f4('0xe')](function(_0x6ce1b1){var _0x12ce71=_0x6ce1b1[_0x89f4('0x8b')][0x0];var _0x1036e8=_0x12ce71[_0x89f4('0x8c')];var _0x1efd47={'method':'GET','uri':_0x37b646+_0x89f4('0x8d')+_0x1036e8+_0x89f4('0x8e'),'headers':{'Authorization':'Bearer\x20'+_0x51f378,'If-None-Match':null,'OData-Version':_0x89f4('0x8a')},'json':!![]};return rp(_0x1efd47);})[_0x89f4('0xe')](function(_0x54ebea){_0x5c098b=_0x54ebea;_0x2d0244=_0x5c098b['Attributes'];_0x2d0244=_[_0x89f4('0x8f')](_0x2d0244,function(_0x3f4f82){return!_0x49c5a3['includes'](_0x3f4f82[_0x89f4('0x90')]);});var _0x393c70=[];var _0x2fa211=[];_0x2d0244[_0x89f4('0x91')](function(_0x311fe6){if(_0x311fe6['@odata.type']){var _0x57b485=_0x311fe6[_0x89f4('0x92')][_0x89f4('0x3b')](_0x311fe6[_0x89f4('0x92')][_0x89f4('0x3c')]('.')+0x1);if(_0x57b485===_0x89f4('0x93')){_0x393c70[_0x89f4('0x94')](getSelectList(_0x37b646,_0x2467ce,_0x2fa211,_0x5c098b[_0x89f4('0x8c')],_0x311fe6['MetadataId'],_0x51f378));}}});return Promise[_0x89f4('0x95')](_0x393c70);})[_0x89f4('0xe')](function(_0x2202e0){_0x5710b2=_0x2202e0[0x0];var _0x1d27f2=[];var _0x3dad7b=[];_0x2d0244[_0x89f4('0x91')](function(_0x54d03e){if(!_[_0x89f4('0x96')](_0x54d03e[_0x89f4('0x92')])){var _0x4a0135=_0x54d03e['@odata.type'][_0x89f4('0x3b')](_0x54d03e['@odata.type'][_0x89f4('0x3c')]('.')+0x1);if(_0x4a0135==='BooleanAttributeMetadata'){_0x1d27f2[_0x89f4('0x94')](getBooleanList(_0x37b646,_0x2467ce,_0x3dad7b,_0x5c098b[_0x89f4('0x8c')],_0x54d03e[_0x89f4('0x8c')],_0x51f378));}}});return Promise[_0x89f4('0x95')](_0x1d27f2);})[_0x89f4('0xe')](function(_0x469590){_0x481a86=_0x469590[0x0];var _0x2c8237=[];var _0x51fd05=[];_0x2d0244[_0x89f4('0x91')](function(_0x48b50e){if(_0x48b50e[_0x89f4('0x92')]){var _0x16ff3e=_0x48b50e[_0x89f4('0x92')][_0x89f4('0x3b')](_0x48b50e[_0x89f4('0x92')]['lastIndexOf']('.')+0x1);if(_0x16ff3e===_0x89f4('0x97')||_0x16ff3e===_0x89f4('0x98')||_0x16ff3e===_0x89f4('0x99')||_0x16ff3e===_0x89f4('0x9a')||_0x16ff3e===_0x89f4('0x9b')||_0x16ff3e===_0x89f4('0x9c')||_0x16ff3e===_0x89f4('0x9d')||_0x16ff3e===_0x89f4('0x9e')||_0x16ff3e===_0x89f4('0x9f')||_0x16ff3e===_0x89f4('0xa0')){_0x2c8237['push'](getInputList(_0x37b646,_0x2467ce,_0x16ff3e,_0x51fd05,_0x5c098b[_0x89f4('0x8c')],_0x48b50e[_0x89f4('0x8c')],_0x51f378));}}});return Promise[_0x89f4('0x95')](_0x2c8237);})[_0x89f4('0xe')](function(_0x257012){_0x24a4df=_0x257012[0x0];var _0x585b2c=_0x5710b2[_0x89f4('0x79')](_0x481a86)[_0x89f4('0x79')](_0x24a4df);var _0x1747e3={'count':_0x585b2c[_0x89f4('0x1f')],'rows':_0x585b2c};return _0x1747e3;})[_0x89f4('0xe')](respondWithResult(_0x25171f,null))[_0x89f4('0x2d')](function(_0x114b0d){var _0x184c4b=_0x441efd['query'][_0x89f4('0xa1')]?0x1f4:_0x114b0d['statusCode']||0x1f4;logger[_0x89f4('0xa2')](_0x114b0d['stack']);delete _0x114b0d[_0x89f4('0x12')];if(_0x184c4b===0x191){_0x184c4b=0x190;}_0x25171f[_0x89f4('0x6')](_0x184c4b)[_0x89f4('0xa3')](_0x441efd[_0x89f4('0x1a')]['test']?{'message':_0x89f4('0xa4'),'statusCode':_0x114b0d[_0x89f4('0xa5')]}:_0x114b0d);});};function getSelectList(_0x444069,_0x270b36,_0x1713c7,_0x45ddce,_0x263ed1,_0x563a1d){var _0x2fa9bc={'method':'GET','uri':_0x444069+_0x89f4('0x8d')+_0x45ddce+_0x89f4('0xa6')+_0x263ed1+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x89f4('0xa7'),'headers':{'Authorization':_0x89f4('0xa8')+_0x563a1d,'If-None-Match':null,'OData-Version':_0x89f4('0x8a')},'json':!![]};return rp(_0x2fa9bc)['then'](function(_0x2700d9){var _0x45bb39=[];var _0x5e7c57=_0x2700d9[_0x89f4('0xa9')][_0x89f4('0xaa')];_0x5e7c57[_0x89f4('0x91')](function(_0x15d746){_0x45bb39['push']({'name':_0x15d746['Label']['UserLocalizedLabel'][_0x89f4('0xab')],'value':String(_0x15d746[_0x89f4('0xac')])});});var _0x5119b6={'id':_0x270b36+'_'+_0x2700d9[_0x89f4('0x90')],'name':_0x2700d9[_0x89f4('0xad')][_0x89f4('0xae')][_0x89f4('0xab')],'custom':![],'options':_0x45bb39};_0x1713c7['push'](_0x5119b6);return _0x1713c7;});}function getBooleanList(_0x4a8390,_0x1e92a5,_0x3738d4,_0x2176f4,_0x159c67,_0x2ed509){var _0x400c53={'method':_0x89f4('0xaf'),'uri':_0x4a8390+_0x89f4('0x8d')+_0x2176f4+_0x89f4('0xa6')+_0x159c67+_0x89f4('0xb0'),'headers':{'Authorization':_0x89f4('0xa8')+_0x2ed509,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x400c53)['then'](function(_0x11f2f4){var _0x1d6ea1=[];_0x1d6ea1[_0x89f4('0x94')]({'name':_0x11f2f4[_0x89f4('0xa9')][_0x89f4('0xb1')]['Label'][_0x89f4('0xae')]['Label'],'value':'true'},{'name':_0x11f2f4['OptionSet'][_0x89f4('0xb2')][_0x89f4('0xab')][_0x89f4('0xae')]['Label'],'value':'false'});var _0xf92275={'id':_0x1e92a5+'_'+_0x11f2f4[_0x89f4('0x90')],'name':_0x11f2f4[_0x89f4('0xad')][_0x89f4('0xae')][_0x89f4('0xab')],'custom':![],'options':_0x1d6ea1};_0x3738d4[_0x89f4('0x94')](_0xf92275);return _0x3738d4;});}function getInputList(_0x57f1fc,_0xa61feb,_0x1bfbd3,_0x3afdea,_0x76d448,_0x586ddc,_0x329e42){var _0x1564c3={'method':_0x89f4('0xaf'),'uri':_0x57f1fc+_0x89f4('0x8d')+_0x76d448+')/Attributes('+_0x586ddc+_0x89f4('0xb3')+_0x1bfbd3+_0x89f4('0xb4'),'headers':{'Authorization':_0x89f4('0xa8')+_0x329e42,'If-None-Match':null,'OData-Version':_0x89f4('0x8a')},'json':!![]};return rp(_0x1564c3)[_0x89f4('0xe')](function(_0x1537fc){var _0x465a97={'id':_0xa61feb+'_'+_0x1537fc[_0x89f4('0x90')],'name':_0x1537fc['DisplayName'][_0x89f4('0xae')]?_0x1537fc[_0x89f4('0xad')]['UserLocalizedLabel']['Label']:_0x1537fc[_0x89f4('0x90')],'custom':![],'options':[]};_0x3afdea['push'](_0x465a97);return _0x3afdea;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index ca226d8..943bab8 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x43d81b,_0x2a43c0){var _0x4ffc1f=function(_0x595c03){while(--_0x595c03){_0x43d81b['push'](_0x43d81b['shift']());}};_0x4ffc1f(++_0x2a43c0);}(_0xe706,0xa3));var _0x6e70=function(_0x33f6a9,_0x5e195c){_0x33f6a9=_0x33f6a9-0x0;var _0x36df01=_0xe706[_0x33f6a9];return _0x36df01;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x58a1a6,_0x385e32){var _0x2a748d=function(_0x3dfc8f){while(--_0x3dfc8f){_0x58a1a6['push'](_0x58a1a6['shift']());}};_0x2a748d(++_0x385e32);}(_0xe706,0xa3));var _0x6e70=function(_0x3f92c2,_0x371fe1){_0x3f92c2=_0x3f92c2-0x0;var _0x1e964b=_0xe706[_0x3f92c2];return _0x1e964b;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 4538592..1067f61 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 _0x24c3=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','code','Dynamics365Account,\x20%s,\x20%s','message','error','catch','GetDynamics365Account','Dynamics365Account','options','raw','limit','include','map','model','attributes','ShowDynamics365Account','find','where','then','lodash'];(function(_0x1518eb,_0x55dad2){var _0x17eab3=function(_0x5128e6){while(--_0x5128e6){_0x1518eb['push'](_0x1518eb['shift']());}};_0x17eab3(++_0x55dad2);}(_0x24c3,0xa9));var _0x324c=function(_0x37ed55,_0xb73328){_0x37ed55=_0x37ed55-0x0;var _0x378ebc=_0x24c3[_0x37ed55];return _0x378ebc;};'use strict';var _=require(_0x324c('0x0'));var util=require(_0x324c('0x1'));var moment=require(_0x324c('0x2'));var BPromise=require(_0x324c('0x3'));var rs=require(_0x324c('0x4'));var fs=require('fs');var Redis=require(_0x324c('0x5'));var db=require(_0x324c('0x6'))['db'];var utils=require(_0x324c('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x324c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x324c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e47e6,_0xfa5e15,_0x481ca6){return new BPromise(function(_0xc510a2,_0x2e6476){return client[_0x324c('0xa')](_0x4e47e6,_0x481ca6)['then'](function(_0xf9d501){logger[_0x324c('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0xfa5e15,_0x324c('0xc'));logger[_0x324c('0xd')](_0x324c('0xe'),_0xfa5e15,_0x324c('0xc'),JSON[_0x324c('0xf')](_0xf9d501));if(_0xf9d501['error']){if(_0xf9d501['error'][_0x324c('0x10')]===0x1f4){logger['error'](_0x324c('0x11'),_0xfa5e15,_0xf9d501['error'][_0x324c('0x12')]);return _0x2e6476(_0xf9d501[_0x324c('0x13')][_0x324c('0x12')]);}logger[_0x324c('0x13')](_0x324c('0x11'),_0xfa5e15,_0xf9d501['error']['message']);return _0xc510a2(_0xf9d501['error'][_0x324c('0x12')]);}else{logger[_0x324c('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0xfa5e15,'request\x20sent');_0xc510a2(_0xf9d501['result']['message']);}})[_0x324c('0x14')](function(_0xc81fd2){logger[_0x324c('0x13')](_0x324c('0x11'),_0xfa5e15,_0xc81fd2);_0x2e6476(_0xc81fd2);});});}exports[_0x324c('0x15')]=function(_0x338238){var _0x49489a=this;return new Promise(function(_0xbf355d,_0x9694ee){return db[_0x324c('0x16')]['findAll']({'raw':_0x338238[_0x324c('0x17')]?_0x338238['options'][_0x324c('0x18')]===undefined?!![]:![]:!![],'where':_0x338238['options']?_0x338238['options']['where']||null:null,'attributes':_0x338238[_0x324c('0x17')]?_0x338238[_0x324c('0x17')]['attributes']||null:null,'limit':_0x338238[_0x324c('0x17')]?_0x338238[_0x324c('0x17')][_0x324c('0x19')]||null:null,'include':_0x338238[_0x324c('0x17')]?_0x338238[_0x324c('0x17')][_0x324c('0x1a')]?_[_0x324c('0x1b')](_0x338238['options']['include'],function(_0x40a2ce){return{'model':db[_0x40a2ce[_0x324c('0x1c')]],'as':_0x40a2ce['as'],'attributes':_0x40a2ce['attributes'],'include':_0x40a2ce[_0x324c('0x1a')]?_[_0x324c('0x1b')](_0x40a2ce['include'],function(_0x401b4d){return{'model':db[_0x401b4d[_0x324c('0x1c')]],'as':_0x401b4d['as'],'attributes':_0x401b4d[_0x324c('0x1d')],'include':_0x401b4d[_0x324c('0x1a')]?_[_0x324c('0x1b')](_0x401b4d[_0x324c('0x1a')],function(_0x2109a1){return{'model':db[_0x2109a1[_0x324c('0x1c')]],'as':_0x2109a1['as'],'attributes':_0x2109a1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f1690){logger['info'](_0x324c('0x15'),_0x338238);logger['debug'](_0x324c('0x15'),_0x338238,JSON[_0x324c('0xf')](_0x2f1690));_0xbf355d(_0x2f1690);})[_0x324c('0x14')](function(_0x2dcc26){logger[_0x324c('0x13')]('GetDynamics365Account',_0x2dcc26[_0x324c('0x12')],_0x338238);_0x9694ee(_0x49489a[_0x324c('0x13')](0x1f4,_0x2dcc26[_0x324c('0x12')]));});});};exports[_0x324c('0x1e')]=function(_0x4ae771){var _0x46eabe=this;return new Promise(function(_0x3d419b,_0x4ff208){return db['Dynamics365Account'][_0x324c('0x1f')]({'raw':_0x4ae771['options']?_0x4ae771['options'][_0x324c('0x18')]===undefined?!![]:![]:!![],'where':_0x4ae771[_0x324c('0x17')]?_0x4ae771[_0x324c('0x17')][_0x324c('0x20')]||null:null,'attributes':_0x4ae771[_0x324c('0x17')]?_0x4ae771['options'][_0x324c('0x1d')]||null:null,'include':_0x4ae771[_0x324c('0x17')]?_0x4ae771[_0x324c('0x17')]['include']?_[_0x324c('0x1b')](_0x4ae771['options']['include'],function(_0x400049){return{'model':db[_0x400049[_0x324c('0x1c')]],'as':_0x400049['as'],'attributes':_0x400049[_0x324c('0x1d')],'include':_0x400049['include']?_[_0x324c('0x1b')](_0x400049[_0x324c('0x1a')],function(_0x54e210){return{'model':db[_0x54e210[_0x324c('0x1c')]],'as':_0x54e210['as'],'attributes':_0x54e210[_0x324c('0x1d')],'include':_0x54e210[_0x324c('0x1a')]?_[_0x324c('0x1b')](_0x54e210[_0x324c('0x1a')],function(_0x185701){return{'model':db[_0x185701[_0x324c('0x1c')]],'as':_0x185701['as'],'attributes':_0x185701[_0x324c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x324c('0x21')](function(_0x15e560){logger[_0x324c('0xb')](_0x324c('0x1e'),_0x4ae771);logger[_0x324c('0xd')](_0x324c('0x1e'),_0x4ae771,JSON[_0x324c('0xf')](_0x15e560));_0x3d419b(_0x15e560);})[_0x324c('0x14')](function(_0x4b76a6){logger[_0x324c('0x13')](_0x324c('0x1e'),_0x4b76a6['message'],_0x4ae771);_0x4ff208(_0x46eabe[_0x324c('0x13')](0x1f4,_0x4b76a6[_0x324c('0x12')]));});});}; \ No newline at end of file +var _0x4dbb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','Dynamics365Account,\x20%s,\x20%s','message','info','catch','GetDynamics365Account','findAll','options','raw','attributes','limit','map','include','model','then','ShowDynamics365Account','Dynamics365Account','find','where','stringify','lodash','util','moment','bluebird'];(function(_0x9f303f,_0x130e64){var _0x1d64bd=function(_0x5b475f){while(--_0x5b475f){_0x9f303f['push'](_0x9f303f['shift']());}};_0x1d64bd(++_0x130e64);}(_0x4dbb,0xd4));var _0xb4db=function(_0x5a213a,_0x2b4a23){_0x5a213a=_0x5a213a-0x0;var _0x3577b3=_0x4dbb[_0x5a213a];return _0x3577b3;};'use strict';var _=require(_0xb4db('0x0'));var util=require(_0xb4db('0x1'));var moment=require(_0xb4db('0x2'));var BPromise=require(_0xb4db('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4db('0x4'));var db=require(_0xb4db('0x5'))['db'];var utils=require(_0xb4db('0x6'));var logger=require(_0xb4db('0x7'))(_0xb4db('0x8'));var config=require(_0xb4db('0x9'));var jayson=require(_0xb4db('0xa'));var client=jayson[_0xb4db('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x281fe4,_0x31c7ed,_0xf3724b){return new BPromise(function(_0x18032b,_0x2d1715){return client[_0xb4db('0xc')](_0x281fe4,_0xf3724b)['then'](function(_0x34a96f){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x31c7ed,_0xb4db('0xd'));logger[_0xb4db('0xe')](_0xb4db('0xf'),_0x31c7ed,_0xb4db('0xd'),JSON['stringify'](_0x34a96f));if(_0x34a96f[_0xb4db('0x10')]){if(_0x34a96f[_0xb4db('0x10')]['code']===0x1f4){logger[_0xb4db('0x10')](_0xb4db('0x11'),_0x31c7ed,_0x34a96f['error'][_0xb4db('0x12')]);return _0x2d1715(_0x34a96f[_0xb4db('0x10')][_0xb4db('0x12')]);}logger[_0xb4db('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x31c7ed,_0x34a96f['error']['message']);return _0x18032b(_0x34a96f['error'][_0xb4db('0x12')]);}else{logger[_0xb4db('0x13')](_0xb4db('0x11'),_0x31c7ed,_0xb4db('0xd'));_0x18032b(_0x34a96f['result']['message']);}})[_0xb4db('0x14')](function(_0x91f14a){logger[_0xb4db('0x10')](_0xb4db('0x11'),_0x31c7ed,_0x91f14a);_0x2d1715(_0x91f14a);});});}exports[_0xb4db('0x15')]=function(_0x2b25f5){var _0x53ce42=this;return new Promise(function(_0x470f17,_0x86e949){return db['Dynamics365Account'][_0xb4db('0x16')]({'raw':_0x2b25f5[_0xb4db('0x17')]?_0x2b25f5[_0xb4db('0x17')][_0xb4db('0x18')]===undefined?!![]:![]:!![],'where':_0x2b25f5['options']?_0x2b25f5[_0xb4db('0x17')]['where']||null:null,'attributes':_0x2b25f5[_0xb4db('0x17')]?_0x2b25f5[_0xb4db('0x17')][_0xb4db('0x19')]||null:null,'limit':_0x2b25f5[_0xb4db('0x17')]?_0x2b25f5[_0xb4db('0x17')][_0xb4db('0x1a')]||null:null,'include':_0x2b25f5[_0xb4db('0x17')]?_0x2b25f5[_0xb4db('0x17')]['include']?_[_0xb4db('0x1b')](_0x2b25f5[_0xb4db('0x17')][_0xb4db('0x1c')],function(_0x3b9cf0){return{'model':db[_0x3b9cf0[_0xb4db('0x1d')]],'as':_0x3b9cf0['as'],'attributes':_0x3b9cf0[_0xb4db('0x19')],'include':_0x3b9cf0[_0xb4db('0x1c')]?_[_0xb4db('0x1b')](_0x3b9cf0[_0xb4db('0x1c')],function(_0x5dba95){return{'model':db[_0x5dba95[_0xb4db('0x1d')]],'as':_0x5dba95['as'],'attributes':_0x5dba95['attributes'],'include':_0x5dba95[_0xb4db('0x1c')]?_[_0xb4db('0x1b')](_0x5dba95['include'],function(_0x2935fd){return{'model':db[_0x2935fd['model']],'as':_0x2935fd['as'],'attributes':_0x2935fd[_0xb4db('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb4db('0x1e')](function(_0x27fb1c){logger[_0xb4db('0x13')]('GetDynamics365Account',_0x2b25f5);logger[_0xb4db('0xe')](_0xb4db('0x15'),_0x2b25f5,JSON['stringify'](_0x27fb1c));_0x470f17(_0x27fb1c);})[_0xb4db('0x14')](function(_0x9a2d53){logger[_0xb4db('0x10')]('GetDynamics365Account',_0x9a2d53[_0xb4db('0x12')],_0x2b25f5);_0x86e949(_0x53ce42[_0xb4db('0x10')](0x1f4,_0x9a2d53[_0xb4db('0x12')]));});});};exports[_0xb4db('0x1f')]=function(_0xb39828){var _0x33a6fa=this;return new Promise(function(_0x52d5d9,_0x620834){return db[_0xb4db('0x20')][_0xb4db('0x21')]({'raw':_0xb39828[_0xb4db('0x17')]?_0xb39828[_0xb4db('0x17')][_0xb4db('0x18')]===undefined?!![]:![]:!![],'where':_0xb39828[_0xb4db('0x17')]?_0xb39828[_0xb4db('0x17')][_0xb4db('0x22')]||null:null,'attributes':_0xb39828[_0xb4db('0x17')]?_0xb39828[_0xb4db('0x17')][_0xb4db('0x19')]||null:null,'include':_0xb39828[_0xb4db('0x17')]?_0xb39828[_0xb4db('0x17')][_0xb4db('0x1c')]?_[_0xb4db('0x1b')](_0xb39828['options']['include'],function(_0x1b3ee4){return{'model':db[_0x1b3ee4['model']],'as':_0x1b3ee4['as'],'attributes':_0x1b3ee4['attributes'],'include':_0x1b3ee4[_0xb4db('0x1c')]?_[_0xb4db('0x1b')](_0x1b3ee4['include'],function(_0x1f0a23){return{'model':db[_0x1f0a23['model']],'as':_0x1f0a23['as'],'attributes':_0x1f0a23[_0xb4db('0x19')],'include':_0x1f0a23[_0xb4db('0x1c')]?_[_0xb4db('0x1b')](_0x1f0a23[_0xb4db('0x1c')],function(_0x455569){return{'model':db[_0x455569[_0xb4db('0x1d')]],'as':_0x455569['as'],'attributes':_0x455569['attributes']};}):[]};}):[]};}):[]:[]})[_0xb4db('0x1e')](function(_0x4120f8){logger[_0xb4db('0x13')](_0xb4db('0x1f'),_0xb39828);logger['debug']('ShowDynamics365Account',_0xb39828,JSON[_0xb4db('0x23')](_0x4120f8));_0x52d5d9(_0x4120f8);})[_0xb4db('0x14')](function(_0x5701a6){logger['error'](_0xb4db('0x1f'),_0x5701a6[_0xb4db('0x12')],_0xb39828);_0x620834(_0x33a6fa['error'](0x1f4,_0x5701a6[_0xb4db('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index ed4c28c..7911d33 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 _0x4227=['/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','delete','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index'];(function(_0x2d1da8,_0x5606b9){var _0x53ae73=function(_0x341c0e){while(--_0x341c0e){_0x2d1da8['push'](_0x2d1da8['shift']());}};_0x53ae73(++_0x5606b9);}(_0x4227,0x89));var _0x7422=function(_0x16c55b,_0x21abad){_0x16c55b=_0x16c55b-0x0;var _0x3cca78=_0x4227[_0x16c55b];return _0x3cca78;};'use strict';var multer=require(_0x7422('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7422('0x1'));var express=require('express');var router=express[_0x7422('0x2')]();var fs_extra=require(_0x7422('0x3'));var auth=require(_0x7422('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7422('0x5'));var controller=require(_0x7422('0x6'));router[_0x7422('0x7')]('/',auth[_0x7422('0x8')](),controller[_0x7422('0x9')]);router[_0x7422('0x7')](_0x7422('0xa'),auth[_0x7422('0x8')](),controller[_0x7422('0xb')]);router['get'](_0x7422('0xc'),auth[_0x7422('0x8')](),controller[_0x7422('0xd')]);router['get'](_0x7422('0xe'),auth['isAuthenticated'](),controller[_0x7422('0xf')]);router[_0x7422('0x7')](_0x7422('0x10'),auth[_0x7422('0x8')](),controller[_0x7422('0x11')]);router['post']('/',auth[_0x7422('0x8')](),controller[_0x7422('0x12')]);router['put'](_0x7422('0xa'),auth[_0x7422('0x8')](),controller['update']);router[_0x7422('0x13')](_0x7422('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x7422('0x14')]=router; \ No newline at end of file +var _0x281a=['get','index','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id','update','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x307aad,_0x270a9b){var _0x42eed6=function(_0x19f361){while(--_0x19f361){_0x307aad['push'](_0x307aad['shift']());}};_0x42eed6(++_0x270a9b);}(_0x281a,0x160));var _0xa281=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x281a[_0x5f0089];return _0x193892;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa281('0x0'));var express=require('express');var router=express[_0xa281('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xa281('0x2'));var interaction=require(_0xa281('0x3'));var config=require(_0xa281('0x4'));var controller=require('./intDynamics365Configuration.controller');router[_0xa281('0x5')]('/',auth['isAuthenticated'](),controller[_0xa281('0x6')]);router[_0xa281('0x5')]('/:id',auth[_0xa281('0x7')](),controller['show']);router[_0xa281('0x5')]('/:id/fields',auth[_0xa281('0x7')](),controller[_0xa281('0x8')]);router[_0xa281('0x5')](_0xa281('0x9'),auth['isAuthenticated'](),controller[_0xa281('0xa')]);router[_0xa281('0x5')](_0xa281('0xb'),auth[_0xa281('0x7')](),controller[_0xa281('0xc')]);router[_0xa281('0xd')]('/',auth['isAuthenticated'](),controller[_0xa281('0xe')]);router['put'](_0xa281('0xf'),auth[_0xa281('0x7')](),controller[_0xa281('0x10')]);router['delete'](_0xa281('0xf'),auth[_0xa281('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index cccf3f4..2cf99fa 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 _0x6c43=['sequelize','STRING','incident','contact','nothing'];(function(_0x1f1ea8,_0x45f535){var _0x365d02=function(_0x1f22d6){while(--_0x1f22d6){_0x1f1ea8['push'](_0x1f1ea8['shift']());}};_0x365d02(++_0x45f535);}(_0x6c43,0x177));var _0x36c4=function(_0x4d23dc,_0x30def6){_0x4d23dc=_0x4d23dc-0x0;var _0x1ffc30=_0x6c43[_0x4d23dc];return _0x1ffc30;};'use strict';var Sequelize=require(_0x36c4('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x36c4('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x36c4('0x2'),'phonecall'),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM'](_0x36c4('0x3'),_0x36c4('0x4')),'defaultValue':_0x36c4('0x3'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x9781=['ENUM','incident','phonecall','nothing','BOOLEAN','sequelize','STRING'];(function(_0xa17c4a,_0x35191c){var _0x51ae38=function(_0x5922ec){while(--_0x5922ec){_0xa17c4a['push'](_0xa17c4a['shift']());}};_0x51ae38(++_0x35191c);}(_0x9781,0x83));var _0x1978=function(_0x199bc4,_0x338105){_0x199bc4=_0x199bc4-0x0;var _0x136ffb=_0x9781[_0x199bc4];return _0x136ffb;};'use strict';var Sequelize=require(_0x1978('0x0'));module['exports']={'name':{'type':Sequelize[_0x1978('0x1')]},'description':{'type':Sequelize[_0x1978('0x1')]},'ticketType':{'type':Sequelize[_0x1978('0x2')](_0x1978('0x3'),_0x1978('0x4')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x1978('0x2')]('contact',_0x1978('0x5')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x1978('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index dfa19f8..d6d3ae2 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 _0x9e3e=['findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','body','find','getFields','Dynamics365Field','getSubjects'];(function(_0x3be372,_0x2a9b52){var _0x2b97c5=function(_0x2f4b1f){while(--_0x2f4b1f){_0x3be372['push'](_0x3be372['shift']());}};_0x2b97c5(++_0x2a9b52);}(_0x9e3e,0xaa));var _0xe9e3=function(_0x4772e0,_0x1072a2){_0x4772e0=_0x4772e0-0x0;var _0x8797f0=_0x9e3e[_0x4772e0];return _0x8797f0;};'use strict';var emlformat=require(_0xe9e3('0x0'));var rimraf=require(_0xe9e3('0x1'));var zipdir=require(_0xe9e3('0x2'));var jsonpatch=require(_0xe9e3('0x3'));var rp=require(_0xe9e3('0x4'));var moment=require('moment');var BPromise=require(_0xe9e3('0x5'));var Mustache=require(_0xe9e3('0x6'));var util=require(_0xe9e3('0x7'));var path=require(_0xe9e3('0x8'));var sox=require(_0xe9e3('0x9'));var csv=require(_0xe9e3('0xa'));var ejs=require(_0xe9e3('0xb'));var fs=require('fs');var fs_extra=require(_0xe9e3('0xc'));var _=require(_0xe9e3('0xd'));var squel=require('squel');var crypto=require(_0xe9e3('0xe'));var jsforce=require(_0xe9e3('0xf'));var deskjs=require(_0xe9e3('0x10'));var toCsv=require(_0xe9e3('0xa'));var querystring=require(_0xe9e3('0x11'));var Papa=require(_0xe9e3('0x12'));var Redis=require(_0xe9e3('0x13'));var authService=require(_0xe9e3('0x14'));var qs=require(_0xe9e3('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9e3('0x16'));var logger=require(_0xe9e3('0x17'))(_0xe9e3('0x18'));var utils=require('../../config/utils');var config=require(_0xe9e3('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9e3('0x1a'))['db'];function respondWithStatusCode(_0x5d71c5,_0x193b2e){_0x193b2e=_0x193b2e||0xcc;return function(_0x36d3e4){if(_0x36d3e4){return _0x5d71c5[_0xe9e3('0x1b')](_0x193b2e);}return _0x5d71c5[_0xe9e3('0x1c')](_0x193b2e)[_0xe9e3('0x1d')]();};}function respondWithResult(_0x463f2b,_0x5d53a7){_0x5d53a7=_0x5d53a7||0xc8;return function(_0xdb018f){if(_0xdb018f){return _0x463f2b['status'](_0x5d53a7)[_0xe9e3('0x1e')](_0xdb018f);}};}function respondWithFilteredResult(_0x385825,_0x2cc0d5){return function(_0x60dbe4){if(_0x60dbe4){var _0xe07172=typeof _0x2cc0d5[_0xe9e3('0x1f')]===_0xe9e3('0x20')&&typeof _0x2cc0d5[_0xe9e3('0x21')]==='undefined';var _0x5308bd=_0x60dbe4[_0xe9e3('0x22')];var _0x385ac1=_0xe07172?0x0:_0x2cc0d5[_0xe9e3('0x1f')];var _0x20960c=_0xe07172?_0x60dbe4[_0xe9e3('0x22')]:_0x2cc0d5['offset']+_0x2cc0d5['limit'];var _0x35e63b;if(_0x20960c>=_0x5308bd){_0x20960c=_0x5308bd;_0x35e63b=0xc8;}else{_0x35e63b=0xce;}_0x385825['status'](_0x35e63b);return _0x385825[_0xe9e3('0x23')](_0xe9e3('0x24'),_0x385ac1+'-'+_0x20960c+'/'+_0x5308bd)['json'](_0x60dbe4);}return null;};}function patchUpdates(_0x2870c5){return function(_0x23b38f){try{jsonpatch[_0xe9e3('0x25')](_0x23b38f,_0x2870c5,!![]);}catch(_0x223628){return BPromise[_0xe9e3('0x26')](_0x223628);}return _0x23b38f[_0xe9e3('0x27')]();};}function saveUpdates(_0x539832,_0x4fe9ff){return function(_0x297934){if(_0x297934){return _0x297934[_0xe9e3('0x28')](_0x539832)[_0xe9e3('0x29')](function(_0x1f082f){return _0x1f082f;});}return null;};}function removeEntity(_0x1871a3,_0x293a9c){return function(_0x36c45e){if(_0x36c45e){return _0x36c45e[_0xe9e3('0x2a')]()[_0xe9e3('0x29')](function(){_0x1871a3['status'](0xcc)[_0xe9e3('0x1d')]();});}};}function handleEntityNotFound(_0x92dc7c,_0xb9e899){return function(_0x9e7813){if(!_0x9e7813){_0x92dc7c[_0xe9e3('0x1b')](0x194);}return _0x9e7813;};}function handleError(_0x1350f7,_0xf18ae1){_0xf18ae1=_0xf18ae1||0x1f4;return function(_0x54cdcd){logger[_0xe9e3('0x2b')](_0x54cdcd['stack']);if(_0x54cdcd[_0xe9e3('0x2c')]){delete _0x54cdcd['name'];}_0x1350f7[_0xe9e3('0x1c')](_0xf18ae1)[_0xe9e3('0x2d')](_0x54cdcd);};}exports[_0xe9e3('0x2e')]=function(_0x3cd9d3,_0xbe839d){var _0x49c00a={},_0x3c6f88={},_0x56134f={'count':0x0,'rows':[]};var _0x3bf56a=_[_0xe9e3('0x2f')](db[_0xe9e3('0x30')][_0xe9e3('0x31')],function(_0x167478){return{'name':_0x167478[_0xe9e3('0x32')],'type':_0x167478[_0xe9e3('0x33')][_0xe9e3('0x34')]};});_0x3c6f88[_0xe9e3('0x35')]=_['map'](_0x3bf56a,_0xe9e3('0x2c'));_0x3c6f88[_0xe9e3('0x36')]=_['keys'](_0x3cd9d3[_0xe9e3('0x36')]);_0x3c6f88['filters']=_[_0xe9e3('0x37')](_0x3c6f88[_0xe9e3('0x35')],_0x3c6f88[_0xe9e3('0x36')]);_0x49c00a[_0xe9e3('0x38')]=_[_0xe9e3('0x37')](_0x3c6f88[_0xe9e3('0x35')],qs[_0xe9e3('0x39')](_0x3cd9d3[_0xe9e3('0x36')][_0xe9e3('0x39')]));_0x49c00a[_0xe9e3('0x38')]=_0x49c00a['attributes'][_0xe9e3('0x3a')]?_0x49c00a[_0xe9e3('0x38')]:_0x3c6f88[_0xe9e3('0x35')];if(!_0x3cd9d3[_0xe9e3('0x36')][_0xe9e3('0x3b')](_0xe9e3('0x3c'))){_0x49c00a[_0xe9e3('0x21')]=qs[_0xe9e3('0x21')](_0x3cd9d3[_0xe9e3('0x36')][_0xe9e3('0x21')]);_0x49c00a[_0xe9e3('0x1f')]=qs[_0xe9e3('0x1f')](_0x3cd9d3[_0xe9e3('0x36')][_0xe9e3('0x1f')]);}_0x49c00a[_0xe9e3('0x3d')]=qs[_0xe9e3('0x3e')](_0x3cd9d3[_0xe9e3('0x36')][_0xe9e3('0x3e')]);_0x49c00a[_0xe9e3('0x3f')]=qs['filters'](_[_0xe9e3('0x40')](_0x3cd9d3[_0xe9e3('0x36')],_0x3c6f88[_0xe9e3('0x41')]),_0x3bf56a);if(_0x3cd9d3[_0xe9e3('0x36')]['filter']){_0x49c00a[_0xe9e3('0x3f')]=_[_0xe9e3('0x42')](_0x49c00a[_0xe9e3('0x3f')],{'$or':_['map'](_0x3bf56a,function(_0x589dc2){if(_0x589dc2['type']!==_0xe9e3('0x43')){var _0x225ed={};_0x225ed[_0x589dc2[_0xe9e3('0x2c')]]={'$like':'%'+_0x3cd9d3[_0xe9e3('0x36')][_0xe9e3('0x44')]+'%'};return _0x225ed;}})});}_0x49c00a=_[_0xe9e3('0x42')]({},_0x49c00a,_0x3cd9d3[_0xe9e3('0x45')]);var _0x5bdc7b={'where':_0x49c00a['where']};return db[_0xe9e3('0x30')][_0xe9e3('0x22')](_0x5bdc7b)[_0xe9e3('0x29')](function(_0x4616c0){_0x56134f[_0xe9e3('0x22')]=_0x4616c0;if(_0x3cd9d3[_0xe9e3('0x36')][_0xe9e3('0x46')]){_0x49c00a[_0xe9e3('0x47')]=[{'all':!![]}];}return db[_0xe9e3('0x30')][_0xe9e3('0x48')](_0x49c00a);})['then'](function(_0x17e153){_0x56134f['rows']=_0x17e153;return _0x56134f;})[_0xe9e3('0x29')](respondWithFilteredResult(_0xbe839d,_0x49c00a))[_0xe9e3('0x49')](handleError(_0xbe839d,null));};exports[_0xe9e3('0x4a')]=function(_0x249260,_0x5314cc){var _0x16f4b4={'raw':![],'where':{'id':_0x249260[_0xe9e3('0x4b')]['id']}},_0x1f467b={};_0x1f467b[_0xe9e3('0x35')]=_[_0xe9e3('0x4c')](db['Dynamics365Configuration'][_0xe9e3('0x31')]);_0x1f467b[_0xe9e3('0x36')]=_[_0xe9e3('0x4c')](_0x249260['query']);_0x1f467b[_0xe9e3('0x41')]=_[_0xe9e3('0x37')](_0x1f467b[_0xe9e3('0x35')],_0x1f467b[_0xe9e3('0x36')]);_0x16f4b4['attributes']=_[_0xe9e3('0x37')](_0x1f467b['model'],qs[_0xe9e3('0x39')](_0x249260['query'][_0xe9e3('0x39')]));_0x16f4b4['attributes']=_0x16f4b4[_0xe9e3('0x38')][_0xe9e3('0x3a')]?_0x16f4b4[_0xe9e3('0x38')]:_0x1f467b[_0xe9e3('0x35')];if(_0x249260[_0xe9e3('0x36')][_0xe9e3('0x46')]){_0x16f4b4[_0xe9e3('0x47')]=[{'all':!![]}];}_0x16f4b4=_[_0xe9e3('0x42')]({},_0x16f4b4,_0x249260[_0xe9e3('0x45')]);return db[_0xe9e3('0x30')]['find'](_0x16f4b4)[_0xe9e3('0x29')](handleEntityNotFound(_0x5314cc,null))[_0xe9e3('0x29')](respondWithResult(_0x5314cc,null))[_0xe9e3('0x49')](handleError(_0x5314cc,null));};exports['create']=function(_0x384437,_0x31aee1){return db[_0xe9e3('0x30')]['create'](_0x384437['body'],{})[_0xe9e3('0x29')](respondWithResult(_0x31aee1,0xc9))[_0xe9e3('0x49')](handleError(_0x31aee1,null));};exports[_0xe9e3('0x28')]=function(_0x5a15e8,_0x3b5161){if(_0x5a15e8[_0xe9e3('0x4d')]['id']){delete _0x5a15e8[_0xe9e3('0x4d')]['id'];}return db[_0xe9e3('0x30')][_0xe9e3('0x4e')]({'where':{'id':_0x5a15e8[_0xe9e3('0x4b')]['id']}})[_0xe9e3('0x29')](handleEntityNotFound(_0x3b5161,null))[_0xe9e3('0x29')](saveUpdates(_0x5a15e8[_0xe9e3('0x4d')],null))[_0xe9e3('0x29')](respondWithResult(_0x3b5161,null))[_0xe9e3('0x49')](handleError(_0x3b5161,null));};exports[_0xe9e3('0x2a')]=function(_0x32ade0,_0x428b6f){return db[_0xe9e3('0x30')][_0xe9e3('0x4e')]({'where':{'id':_0x32ade0[_0xe9e3('0x4b')]['id']}})[_0xe9e3('0x29')](handleEntityNotFound(_0x428b6f,null))[_0xe9e3('0x29')](removeEntity(_0x428b6f,null))['catch'](handleError(_0x428b6f,null));};exports[_0xe9e3('0x4f')]=function(_0x52e549,_0x3afa4c,_0x3302b4){var _0x166a33={};var _0x1a3731={};var _0x50820;var _0x52f988;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x52e549[_0xe9e3('0x4b')]['id']}})[_0xe9e3('0x29')](handleEntityNotFound(_0x3afa4c,null))[_0xe9e3('0x29')](function(_0x40d4d5){if(_0x40d4d5){_0x50820=_0x40d4d5;_0x1a3731[_0xe9e3('0x35')]=_[_0xe9e3('0x4c')](db[_0xe9e3('0x50')][_0xe9e3('0x31')]);_0x1a3731['query']=_['keys'](_0x52e549[_0xe9e3('0x36')]);_0x1a3731[_0xe9e3('0x41')]=_[_0xe9e3('0x37')](_0x1a3731[_0xe9e3('0x35')],_0x1a3731['query']);_0x166a33[_0xe9e3('0x38')]=_[_0xe9e3('0x37')](_0x1a3731['model'],qs[_0xe9e3('0x39')](_0x52e549[_0xe9e3('0x36')][_0xe9e3('0x39')]));_0x166a33[_0xe9e3('0x38')]=_0x166a33[_0xe9e3('0x38')][_0xe9e3('0x3a')]?_0x166a33[_0xe9e3('0x38')]:_0x1a3731[_0xe9e3('0x35')];_0x166a33[_0xe9e3('0x3d')]=qs['sort'](_0x52e549[_0xe9e3('0x36')][_0xe9e3('0x3e')]);_0x166a33['where']=qs['filters'](_[_0xe9e3('0x40')](_0x52e549[_0xe9e3('0x36')],_0x1a3731[_0xe9e3('0x41')]));if(_0x52e549['query'][_0xe9e3('0x44')]){_0x166a33[_0xe9e3('0x3f')]=_[_0xe9e3('0x42')](_0x166a33[_0xe9e3('0x3f')],{'$or':_[_0xe9e3('0x2f')](_0x166a33['attributes'],function(_0x3b6c07){var _0x2e76ed={};_0x2e76ed[_0x3b6c07]={'$like':'%'+_0x52e549[_0xe9e3('0x36')]['filter']+'%'};return _0x2e76ed;})});}_0x166a33=_[_0xe9e3('0x42')]({},_0x166a33,_0x52e549[_0xe9e3('0x45')]);return _0x50820[_0xe9e3('0x4f')](_0x166a33);}})[_0xe9e3('0x29')](function(_0x103c01){if(_0x103c01){_0x52f988=_0x103c01['length'];if(!_0x52e549[_0xe9e3('0x36')]['hasOwnProperty'](_0xe9e3('0x3c'))){_0x166a33[_0xe9e3('0x21')]=qs['limit'](_0x52e549[_0xe9e3('0x36')]['limit']);_0x166a33['offset']=qs['offset'](_0x52e549[_0xe9e3('0x36')][_0xe9e3('0x1f')]);}return _0x50820['getFields'](_0x166a33);}})[_0xe9e3('0x29')](function(_0x558f61){if(_0x558f61){return _0x558f61?{'count':_0x52f988,'rows':_0x558f61}:null;}})[_0xe9e3('0x29')](respondWithResult(_0x3afa4c,null))[_0xe9e3('0x49')](handleError(_0x3afa4c,null));};exports[_0xe9e3('0x51')]=function(_0x41b0cc,_0x4d1f78,_0x4eba89){var _0x50f4c8={};var _0x4f62ff={};var _0x586ec0;var _0x508cd0;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x41b0cc[_0xe9e3('0x4b')]['id']}})[_0xe9e3('0x29')](handleEntityNotFound(_0x4d1f78,null))['then'](function(_0x589d13){if(_0x589d13){_0x586ec0=_0x589d13;_0x4f62ff[_0xe9e3('0x35')]=_[_0xe9e3('0x4c')](db['Dynamics365Field']['rawAttributes']);_0x4f62ff['query']=_[_0xe9e3('0x4c')](_0x41b0cc['query']);_0x4f62ff[_0xe9e3('0x41')]=_['intersection'](_0x4f62ff['model'],_0x4f62ff[_0xe9e3('0x36')]);_0x50f4c8[_0xe9e3('0x38')]=_[_0xe9e3('0x37')](_0x4f62ff[_0xe9e3('0x35')],qs[_0xe9e3('0x39')](_0x41b0cc[_0xe9e3('0x36')][_0xe9e3('0x39')]));_0x50f4c8['attributes']=_0x50f4c8['attributes'][_0xe9e3('0x3a')]?_0x50f4c8[_0xe9e3('0x38')]:_0x4f62ff[_0xe9e3('0x35')];_0x50f4c8[_0xe9e3('0x3d')]=qs['sort'](_0x41b0cc[_0xe9e3('0x36')][_0xe9e3('0x3e')]);_0x50f4c8['where']=qs[_0xe9e3('0x41')](_['pick'](_0x41b0cc['query'],_0x4f62ff['filters']));if(_0x41b0cc[_0xe9e3('0x36')][_0xe9e3('0x44')]){_0x50f4c8[_0xe9e3('0x3f')]=_[_0xe9e3('0x42')](_0x50f4c8[_0xe9e3('0x3f')],{'$or':_[_0xe9e3('0x2f')](_0x50f4c8['attributes'],function(_0x1ed918){var _0x5714d9={};_0x5714d9[_0x1ed918]={'$like':'%'+_0x41b0cc[_0xe9e3('0x36')][_0xe9e3('0x44')]+'%'};return _0x5714d9;})});}_0x50f4c8=_[_0xe9e3('0x42')]({},_0x50f4c8,_0x41b0cc[_0xe9e3('0x45')]);return _0x586ec0[_0xe9e3('0x51')](_0x50f4c8);}})['then'](function(_0x2797cf){if(_0x2797cf){_0x508cd0=_0x2797cf['length'];if(!_0x41b0cc[_0xe9e3('0x36')][_0xe9e3('0x3b')]('nolimit')){_0x50f4c8[_0xe9e3('0x21')]=qs[_0xe9e3('0x21')](_0x41b0cc[_0xe9e3('0x36')][_0xe9e3('0x21')]);_0x50f4c8[_0xe9e3('0x1f')]=qs[_0xe9e3('0x1f')](_0x41b0cc[_0xe9e3('0x36')]['offset']);}return _0x586ec0[_0xe9e3('0x51')](_0x50f4c8);}})[_0xe9e3('0x29')](function(_0x22dd87){if(_0x22dd87){return _0x22dd87?{'count':_0x508cd0,'rows':_0x22dd87}:null;}})['then'](respondWithResult(_0x4d1f78,null))[_0xe9e3('0x49')](handleError(_0x4d1f78,null));};exports['getDescriptions']=function(_0x4eb238,_0x2326c4,_0x1caa5d){var _0x590aad={};var _0x5478f5={};var _0x4668f2;var _0x5ecfd9;return db['Dynamics365Configuration'][_0xe9e3('0x52')]({'where':{'id':_0x4eb238[_0xe9e3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2326c4,null))[_0xe9e3('0x29')](function(_0x337746){if(_0x337746){_0x4668f2=_0x337746;_0x5478f5[_0xe9e3('0x35')]=_[_0xe9e3('0x4c')](db[_0xe9e3('0x50')][_0xe9e3('0x31')]);_0x5478f5['query']=_['keys'](_0x4eb238[_0xe9e3('0x36')]);_0x5478f5[_0xe9e3('0x41')]=_['intersection'](_0x5478f5['model'],_0x5478f5[_0xe9e3('0x36')]);_0x590aad['attributes']=_['intersection'](_0x5478f5[_0xe9e3('0x35')],qs['fields'](_0x4eb238[_0xe9e3('0x36')][_0xe9e3('0x39')]));_0x590aad[_0xe9e3('0x38')]=_0x590aad['attributes'][_0xe9e3('0x3a')]?_0x590aad['attributes']:_0x5478f5[_0xe9e3('0x35')];_0x590aad[_0xe9e3('0x3d')]=qs[_0xe9e3('0x3e')](_0x4eb238[_0xe9e3('0x36')][_0xe9e3('0x3e')]);_0x590aad[_0xe9e3('0x3f')]=qs['filters'](_['pick'](_0x4eb238[_0xe9e3('0x36')],_0x5478f5['filters']));if(_0x4eb238[_0xe9e3('0x36')][_0xe9e3('0x44')]){_0x590aad[_0xe9e3('0x3f')]=_[_0xe9e3('0x42')](_0x590aad[_0xe9e3('0x3f')],{'$or':_[_0xe9e3('0x2f')](_0x590aad[_0xe9e3('0x38')],function(_0x46f4ec){var _0x5abc51={};_0x5abc51[_0x46f4ec]={'$like':'%'+_0x4eb238[_0xe9e3('0x36')][_0xe9e3('0x44')]+'%'};return _0x5abc51;})});}_0x590aad=_['merge']({},_0x590aad,_0x4eb238[_0xe9e3('0x45')]);return _0x4668f2[_0xe9e3('0x53')](_0x590aad);}})['then'](function(_0x5154b0){if(_0x5154b0){_0x5ecfd9=_0x5154b0['length'];if(!_0x4eb238[_0xe9e3('0x36')][_0xe9e3('0x3b')](_0xe9e3('0x3c'))){_0x590aad[_0xe9e3('0x21')]=qs[_0xe9e3('0x21')](_0x4eb238['query'][_0xe9e3('0x21')]);_0x590aad['offset']=qs[_0xe9e3('0x1f')](_0x4eb238[_0xe9e3('0x36')][_0xe9e3('0x1f')]);}return _0x4668f2[_0xe9e3('0x53')](_0x590aad);}})[_0xe9e3('0x29')](function(_0x126909){if(_0x126909){return _0x126909?{'count':_0x5ecfd9,'rows':_0x126909}:null;}})['then'](respondWithResult(_0x2326c4,null))[_0xe9e3('0x49')](handleError(_0x2326c4,null));}; \ No newline at end of file +var _0x103e=['model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','includeAll','include','rows','catch','show','params','keys','rawAttributes','options','find','create','update','body','order','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','fieldName','key','query','filters','attributes','intersection'];(function(_0x3b1be7,_0x52e12b){var _0x5af56c=function(_0x703c2){while(--_0x703c2){_0x3b1be7['push'](_0x3b1be7['shift']());}};_0x5af56c(++_0x52e12b);}(_0x103e,0xc8));var _0xe103=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x103e[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0xe103('0x0'));var rimraf=require(_0xe103('0x1'));var zipdir=require(_0xe103('0x2'));var jsonpatch=require(_0xe103('0x3'));var rp=require(_0xe103('0x4'));var moment=require('moment');var BPromise=require(_0xe103('0x5'));var Mustache=require(_0xe103('0x6'));var util=require(_0xe103('0x7'));var path=require(_0xe103('0x8'));var sox=require(_0xe103('0x9'));var csv=require(_0xe103('0xa'));var ejs=require(_0xe103('0xb'));var fs=require('fs');var fs_extra=require(_0xe103('0xc'));var _=require(_0xe103('0xd'));var squel=require(_0xe103('0xe'));var crypto=require(_0xe103('0xf'));var jsforce=require(_0xe103('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe103('0x11'));var Papa=require(_0xe103('0x12'));var Redis=require(_0xe103('0x13'));var authService=require(_0xe103('0x14'));var qs=require(_0xe103('0x15'));var as=require(_0xe103('0x16'));var hardwareService=require(_0xe103('0x17'));var logger=require(_0xe103('0x18'))(_0xe103('0x19'));var utils=require(_0xe103('0x1a'));var config=require(_0xe103('0x1b'));var licenseUtil=require(_0xe103('0x1c'));var db=require(_0xe103('0x1d'))['db'];function respondWithStatusCode(_0x515c6,_0x49f417){_0x49f417=_0x49f417||0xcc;return function(_0x5a3393){if(_0x5a3393){return _0x515c6[_0xe103('0x1e')](_0x49f417);}return _0x515c6[_0xe103('0x1f')](_0x49f417)[_0xe103('0x20')]();};}function respondWithResult(_0x11c4ee,_0x42920c){_0x42920c=_0x42920c||0xc8;return function(_0x583322){if(_0x583322){return _0x11c4ee[_0xe103('0x1f')](_0x42920c)[_0xe103('0x21')](_0x583322);}};}function respondWithFilteredResult(_0x29af2a,_0x57af8a){return function(_0x222079){if(_0x222079){var _0x229637=typeof _0x57af8a[_0xe103('0x22')]===_0xe103('0x23')&&typeof _0x57af8a[_0xe103('0x24')]===_0xe103('0x23');var _0x508164=_0x222079['count'];var _0x5c4b93=_0x229637?0x0:_0x57af8a[_0xe103('0x22')];var _0xbdceee=_0x229637?_0x222079[_0xe103('0x25')]:_0x57af8a[_0xe103('0x22')]+_0x57af8a['limit'];var _0x1a059d;if(_0xbdceee>=_0x508164){_0xbdceee=_0x508164;_0x1a059d=0xc8;}else{_0x1a059d=0xce;}_0x29af2a[_0xe103('0x1f')](_0x1a059d);return _0x29af2a['set'](_0xe103('0x26'),_0x5c4b93+'-'+_0xbdceee+'/'+_0x508164)[_0xe103('0x21')](_0x222079);}return null;};}function patchUpdates(_0x3bae9f){return function(_0x990362){try{jsonpatch['apply'](_0x990362,_0x3bae9f,!![]);}catch(_0xc592c){return BPromise['reject'](_0xc592c);}return _0x990362[_0xe103('0x27')]();};}function saveUpdates(_0x16b5ae,_0x1ced4e){return function(_0x565ea7){if(_0x565ea7){return _0x565ea7['update'](_0x16b5ae)[_0xe103('0x28')](function(_0x4cdc2c){return _0x4cdc2c;});}return null;};}function removeEntity(_0x2f9131,_0x1e0e4f){return function(_0x141df8){if(_0x141df8){return _0x141df8[_0xe103('0x29')]()[_0xe103('0x28')](function(){_0x2f9131[_0xe103('0x1f')](0xcc)[_0xe103('0x20')]();});}};}function handleEntityNotFound(_0x25d98d,_0x34642e){return function(_0x5debbf){if(!_0x5debbf){_0x25d98d[_0xe103('0x1e')](0x194);}return _0x5debbf;};}function handleError(_0x475a0c,_0x486b81){_0x486b81=_0x486b81||0x1f4;return function(_0x183469){logger[_0xe103('0x2a')](_0x183469[_0xe103('0x2b')]);if(_0x183469[_0xe103('0x2c')]){delete _0x183469['name'];}_0x475a0c[_0xe103('0x1f')](_0x486b81)[_0xe103('0x2d')](_0x183469);};}exports[_0xe103('0x2e')]=function(_0x55c7be,_0x32caf9){var _0x3f7b45={},_0x19c952={},_0x3ea107={'count':0x0,'rows':[]};var _0x35fc6a=_[_0xe103('0x2f')](db[_0xe103('0x30')]['rawAttributes'],function(_0x1e46c1){return{'name':_0x1e46c1[_0xe103('0x31')],'type':_0x1e46c1['type'][_0xe103('0x32')]};});_0x19c952['model']=_[_0xe103('0x2f')](_0x35fc6a,'name');_0x19c952[_0xe103('0x33')]=_['keys'](_0x55c7be[_0xe103('0x33')]);_0x19c952[_0xe103('0x34')]=_['intersection'](_0x19c952['model'],_0x19c952[_0xe103('0x33')]);_0x3f7b45[_0xe103('0x35')]=_[_0xe103('0x36')](_0x19c952[_0xe103('0x37')],qs[_0xe103('0x38')](_0x55c7be[_0xe103('0x33')][_0xe103('0x38')]));_0x3f7b45['attributes']=_0x3f7b45[_0xe103('0x35')][_0xe103('0x39')]?_0x3f7b45['attributes']:_0x19c952[_0xe103('0x37')];if(!_0x55c7be['query'][_0xe103('0x3a')](_0xe103('0x3b'))){_0x3f7b45['limit']=qs['limit'](_0x55c7be[_0xe103('0x33')][_0xe103('0x24')]);_0x3f7b45['offset']=qs['offset'](_0x55c7be['query'][_0xe103('0x22')]);}_0x3f7b45['order']=qs[_0xe103('0x3c')](_0x55c7be[_0xe103('0x33')][_0xe103('0x3c')]);_0x3f7b45[_0xe103('0x3d')]=qs[_0xe103('0x34')](_[_0xe103('0x3e')](_0x55c7be[_0xe103('0x33')],_0x19c952[_0xe103('0x34')]),_0x35fc6a);if(_0x55c7be[_0xe103('0x33')][_0xe103('0x3f')]){_0x3f7b45['where']=_[_0xe103('0x40')](_0x3f7b45['where'],{'$or':_['map'](_0x35fc6a,function(_0x38fd85){if(_0x38fd85[_0xe103('0x41')]!=='VIRTUAL'){var _0x195b9a={};_0x195b9a[_0x38fd85['name']]={'$like':'%'+_0x55c7be['query'][_0xe103('0x3f')]+'%'};return _0x195b9a;}})});}_0x3f7b45=_[_0xe103('0x40')]({},_0x3f7b45,_0x55c7be['options']);var _0x57c2de={'where':_0x3f7b45[_0xe103('0x3d')]};return db[_0xe103('0x30')][_0xe103('0x25')](_0x57c2de)['then'](function(_0x4b10b1){_0x3ea107[_0xe103('0x25')]=_0x4b10b1;if(_0x55c7be['query'][_0xe103('0x42')]){_0x3f7b45[_0xe103('0x43')]=[{'all':!![]}];}return db[_0xe103('0x30')]['findAll'](_0x3f7b45);})[_0xe103('0x28')](function(_0x57e206){_0x3ea107[_0xe103('0x44')]=_0x57e206;return _0x3ea107;})['then'](respondWithFilteredResult(_0x32caf9,_0x3f7b45))[_0xe103('0x45')](handleError(_0x32caf9,null));};exports[_0xe103('0x46')]=function(_0x1181f3,_0x31104c){var _0x15e3b6={'raw':![],'where':{'id':_0x1181f3[_0xe103('0x47')]['id']}},_0x4a192f={};_0x4a192f[_0xe103('0x37')]=_[_0xe103('0x48')](db[_0xe103('0x30')][_0xe103('0x49')]);_0x4a192f['query']=_['keys'](_0x1181f3[_0xe103('0x33')]);_0x4a192f['filters']=_[_0xe103('0x36')](_0x4a192f[_0xe103('0x37')],_0x4a192f[_0xe103('0x33')]);_0x15e3b6[_0xe103('0x35')]=_[_0xe103('0x36')](_0x4a192f[_0xe103('0x37')],qs['fields'](_0x1181f3[_0xe103('0x33')][_0xe103('0x38')]));_0x15e3b6[_0xe103('0x35')]=_0x15e3b6[_0xe103('0x35')][_0xe103('0x39')]?_0x15e3b6[_0xe103('0x35')]:_0x4a192f[_0xe103('0x37')];if(_0x1181f3['query'][_0xe103('0x42')]){_0x15e3b6[_0xe103('0x43')]=[{'all':!![]}];}_0x15e3b6=_['merge']({},_0x15e3b6,_0x1181f3[_0xe103('0x4a')]);return db[_0xe103('0x30')][_0xe103('0x4b')](_0x15e3b6)['then'](handleEntityNotFound(_0x31104c,null))[_0xe103('0x28')](respondWithResult(_0x31104c,null))[_0xe103('0x45')](handleError(_0x31104c,null));};exports[_0xe103('0x4c')]=function(_0x241498,_0x648b90){return db[_0xe103('0x30')][_0xe103('0x4c')](_0x241498['body'],{})[_0xe103('0x28')](respondWithResult(_0x648b90,0xc9))[_0xe103('0x45')](handleError(_0x648b90,null));};exports[_0xe103('0x4d')]=function(_0x42e9aa,_0x3a0bd2){if(_0x42e9aa[_0xe103('0x4e')]['id']){delete _0x42e9aa[_0xe103('0x4e')]['id'];}return db[_0xe103('0x30')][_0xe103('0x4b')]({'where':{'id':_0x42e9aa[_0xe103('0x47')]['id']}})['then'](handleEntityNotFound(_0x3a0bd2,null))[_0xe103('0x28')](saveUpdates(_0x42e9aa[_0xe103('0x4e')],null))['then'](respondWithResult(_0x3a0bd2,null))[_0xe103('0x45')](handleError(_0x3a0bd2,null));};exports[_0xe103('0x29')]=function(_0xdde800,_0x462467){return db['Dynamics365Configuration']['find']({'where':{'id':_0xdde800['params']['id']}})[_0xe103('0x28')](handleEntityNotFound(_0x462467,null))[_0xe103('0x28')](removeEntity(_0x462467,null))[_0xe103('0x45')](handleError(_0x462467,null));};exports['getFields']=function(_0x12af0f,_0x37cddc,_0xc2f9c5){var _0x405c0e={};var _0x4903e1={};var _0x58daff;var _0x357824;return db[_0xe103('0x30')]['findOne']({'where':{'id':_0x12af0f[_0xe103('0x47')]['id']}})[_0xe103('0x28')](handleEntityNotFound(_0x37cddc,null))[_0xe103('0x28')](function(_0xba5ca9){if(_0xba5ca9){_0x58daff=_0xba5ca9;_0x4903e1[_0xe103('0x37')]=_[_0xe103('0x48')](db['Dynamics365Field'][_0xe103('0x49')]);_0x4903e1[_0xe103('0x33')]=_[_0xe103('0x48')](_0x12af0f[_0xe103('0x33')]);_0x4903e1[_0xe103('0x34')]=_['intersection'](_0x4903e1[_0xe103('0x37')],_0x4903e1[_0xe103('0x33')]);_0x405c0e[_0xe103('0x35')]=_['intersection'](_0x4903e1[_0xe103('0x37')],qs[_0xe103('0x38')](_0x12af0f[_0xe103('0x33')]['fields']));_0x405c0e[_0xe103('0x35')]=_0x405c0e[_0xe103('0x35')][_0xe103('0x39')]?_0x405c0e[_0xe103('0x35')]:_0x4903e1[_0xe103('0x37')];_0x405c0e[_0xe103('0x4f')]=qs[_0xe103('0x3c')](_0x12af0f[_0xe103('0x33')][_0xe103('0x3c')]);_0x405c0e[_0xe103('0x3d')]=qs['filters'](_[_0xe103('0x3e')](_0x12af0f[_0xe103('0x33')],_0x4903e1['filters']));if(_0x12af0f[_0xe103('0x33')][_0xe103('0x3f')]){_0x405c0e[_0xe103('0x3d')]=_[_0xe103('0x40')](_0x405c0e[_0xe103('0x3d')],{'$or':_[_0xe103('0x2f')](_0x405c0e['attributes'],function(_0x1557bd){var _0x549ad8={};_0x549ad8[_0x1557bd]={'$like':'%'+_0x12af0f['query']['filter']+'%'};return _0x549ad8;})});}_0x405c0e=_['merge']({},_0x405c0e,_0x12af0f[_0xe103('0x4a')]);return _0x58daff[_0xe103('0x50')](_0x405c0e);}})[_0xe103('0x28')](function(_0x203e5d){if(_0x203e5d){_0x357824=_0x203e5d[_0xe103('0x39')];if(!_0x12af0f['query']['hasOwnProperty'](_0xe103('0x3b'))){_0x405c0e[_0xe103('0x24')]=qs[_0xe103('0x24')](_0x12af0f[_0xe103('0x33')]['limit']);_0x405c0e[_0xe103('0x22')]=qs[_0xe103('0x22')](_0x12af0f['query'][_0xe103('0x22')]);}return _0x58daff[_0xe103('0x50')](_0x405c0e);}})['then'](function(_0x5d4ab0){if(_0x5d4ab0){return _0x5d4ab0?{'count':_0x357824,'rows':_0x5d4ab0}:null;}})[_0xe103('0x28')](respondWithResult(_0x37cddc,null))[_0xe103('0x45')](handleError(_0x37cddc,null));};exports['getSubjects']=function(_0x2bfa85,_0x369605,_0x308ad6){var _0x12bc10={};var _0x2b1666={};var _0x11f748;var _0x4ee530;return db[_0xe103('0x30')][_0xe103('0x51')]({'where':{'id':_0x2bfa85[_0xe103('0x47')]['id']}})[_0xe103('0x28')](handleEntityNotFound(_0x369605,null))[_0xe103('0x28')](function(_0x3750fe){if(_0x3750fe){_0x11f748=_0x3750fe;_0x2b1666['model']=_['keys'](db[_0xe103('0x52')][_0xe103('0x49')]);_0x2b1666[_0xe103('0x33')]=_[_0xe103('0x48')](_0x2bfa85[_0xe103('0x33')]);_0x2b1666[_0xe103('0x34')]=_['intersection'](_0x2b1666[_0xe103('0x37')],_0x2b1666['query']);_0x12bc10[_0xe103('0x35')]=_[_0xe103('0x36')](_0x2b1666[_0xe103('0x37')],qs[_0xe103('0x38')](_0x2bfa85[_0xe103('0x33')][_0xe103('0x38')]));_0x12bc10['attributes']=_0x12bc10[_0xe103('0x35')][_0xe103('0x39')]?_0x12bc10[_0xe103('0x35')]:_0x2b1666[_0xe103('0x37')];_0x12bc10['order']=qs[_0xe103('0x3c')](_0x2bfa85[_0xe103('0x33')][_0xe103('0x3c')]);_0x12bc10[_0xe103('0x3d')]=qs[_0xe103('0x34')](_[_0xe103('0x3e')](_0x2bfa85[_0xe103('0x33')],_0x2b1666[_0xe103('0x34')]));if(_0x2bfa85[_0xe103('0x33')][_0xe103('0x3f')]){_0x12bc10['where']=_[_0xe103('0x40')](_0x12bc10['where'],{'$or':_['map'](_0x12bc10[_0xe103('0x35')],function(_0x3f33b2){var _0x5b5364={};_0x5b5364[_0x3f33b2]={'$like':'%'+_0x2bfa85[_0xe103('0x33')]['filter']+'%'};return _0x5b5364;})});}_0x12bc10=_['merge']({},_0x12bc10,_0x2bfa85[_0xe103('0x4a')]);return _0x11f748['getSubjects'](_0x12bc10);}})[_0xe103('0x28')](function(_0x5e8047){if(_0x5e8047){_0x4ee530=_0x5e8047[_0xe103('0x39')];if(!_0x2bfa85['query'][_0xe103('0x3a')](_0xe103('0x3b'))){_0x12bc10[_0xe103('0x24')]=qs[_0xe103('0x24')](_0x2bfa85[_0xe103('0x33')][_0xe103('0x24')]);_0x12bc10[_0xe103('0x22')]=qs['offset'](_0x2bfa85[_0xe103('0x33')][_0xe103('0x22')]);}return _0x11f748[_0xe103('0x53')](_0x12bc10);}})['then'](function(_0x3ad0db){if(_0x3ad0db){return _0x3ad0db?{'count':_0x4ee530,'rows':_0x3ad0db}:null;}})[_0xe103('0x28')](respondWithResult(_0x369605,null))[_0xe103('0x45')](handleError(_0x369605,null));};exports[_0xe103('0x54')]=function(_0x46adda,_0x5933e1,_0x2ce651){var _0x36ddb9={};var _0x272365={};var _0x28f34d;var _0x39a92b;return db[_0xe103('0x30')]['findOne']({'where':{'id':_0x46adda[_0xe103('0x47')]['id']}})['then'](handleEntityNotFound(_0x5933e1,null))[_0xe103('0x28')](function(_0x16a034){if(_0x16a034){_0x28f34d=_0x16a034;_0x272365[_0xe103('0x37')]=_['keys'](db[_0xe103('0x52')][_0xe103('0x49')]);_0x272365[_0xe103('0x33')]=_[_0xe103('0x48')](_0x46adda[_0xe103('0x33')]);_0x272365[_0xe103('0x34')]=_['intersection'](_0x272365[_0xe103('0x37')],_0x272365[_0xe103('0x33')]);_0x36ddb9['attributes']=_[_0xe103('0x36')](_0x272365[_0xe103('0x37')],qs[_0xe103('0x38')](_0x46adda[_0xe103('0x33')][_0xe103('0x38')]));_0x36ddb9[_0xe103('0x35')]=_0x36ddb9[_0xe103('0x35')][_0xe103('0x39')]?_0x36ddb9['attributes']:_0x272365['model'];_0x36ddb9[_0xe103('0x4f')]=qs[_0xe103('0x3c')](_0x46adda['query'][_0xe103('0x3c')]);_0x36ddb9[_0xe103('0x3d')]=qs[_0xe103('0x34')](_[_0xe103('0x3e')](_0x46adda['query'],_0x272365[_0xe103('0x34')]));if(_0x46adda[_0xe103('0x33')][_0xe103('0x3f')]){_0x36ddb9[_0xe103('0x3d')]=_[_0xe103('0x40')](_0x36ddb9[_0xe103('0x3d')],{'$or':_['map'](_0x36ddb9['attributes'],function(_0x380522){var _0x4a96c8={};_0x4a96c8[_0x380522]={'$like':'%'+_0x46adda['query'][_0xe103('0x3f')]+'%'};return _0x4a96c8;})});}_0x36ddb9=_['merge']({},_0x36ddb9,_0x46adda[_0xe103('0x4a')]);return _0x28f34d[_0xe103('0x54')](_0x36ddb9);}})['then'](function(_0x2fca39){if(_0x2fca39){_0x39a92b=_0x2fca39[_0xe103('0x39')];if(!_0x46adda['query']['hasOwnProperty']('nolimit')){_0x36ddb9['limit']=qs['limit'](_0x46adda[_0xe103('0x33')][_0xe103('0x24')]);_0x36ddb9['offset']=qs[_0xe103('0x22')](_0x46adda['query'][_0xe103('0x22')]);}return _0x28f34d[_0xe103('0x54')](_0x36ddb9);}})[_0xe103('0x28')](function(_0x3a2b58){if(_0x3a2b58){return _0x3a2b58?{'count':_0x39a92b,'rows':_0x3a2b58}:null;}})[_0xe103('0x28')](respondWithResult(_0x5933e1,null))[_0xe103('0x45')](handleError(_0x5933e1,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 3997fba..9795584 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 _0x84ab=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','lodash','util','../../config/logger','api','moment'];(function(_0x36fcc8,_0x5d1ecb){var _0x259df5=function(_0x3bf2d1){while(--_0x3bf2d1){_0x36fcc8['push'](_0x36fcc8['shift']());}};_0x259df5(++_0x5d1ecb);}(_0x84ab,0x12f));var _0xb84a=function(_0x10e983,_0x2f4eda){_0x10e983=_0x10e983-0x0;var _0x324138=_0x84ab[_0x10e983];return _0x324138;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb84a('0x5'));var fs=require('fs');var path=require(_0xb84a('0x6'));var rimraf=require('rimraf');var config=require(_0xb84a('0x7'));var attributes=require(_0xb84a('0x8'));module[_0xb84a('0x9')]=function(_0x5b9def,_0x521a64){return _0x5b9def['define'](_0xb84a('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bde=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','api','bluebird'];(function(_0x4f123b,_0x59e853){var _0x41ff43=function(_0x10822f){while(--_0x10822f){_0x4f123b['push'](_0x4f123b['shift']());}};_0x41ff43(++_0x59e853);}(_0x9bde,0xe1));var _0xe9bd=function(_0x17dba6,_0x9d69df){_0x17dba6=_0x17dba6-0x0;var _0x5aab4c=_0x9bde[_0x17dba6];return _0x5aab4c;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index d16135d..652bc19 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 _0x2be5=['jayson/promise','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x70a4e2,_0x1b833a){var _0x4d1d1e=function(_0x479208){while(--_0x479208){_0x70a4e2['push'](_0x70a4e2['shift']());}};_0x4d1d1e(++_0x1b833a);}(_0x2be5,0x83));var _0x52be=function(_0x3e1bf2,_0x121002){_0x3e1bf2=_0x3e1bf2-0x0;var _0x1de65a=_0x2be5[_0x3e1bf2];return _0x1de65a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x52be('0x0'));var BPromise=require(_0x52be('0x1'));var rs=require(_0x52be('0x2'));var fs=require('fs');var Redis=require(_0x52be('0x3'));var db=require(_0x52be('0x4'))['db'];var utils=require(_0x52be('0x5'));var logger=require(_0x52be('0x6'))(_0x52be('0x7'));var config=require(_0x52be('0x8'));var jayson=require(_0x52be('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x408f49,_0x30c815,_0x33d9be){return new BPromise(function(_0x3d2d06,_0x54f563){return client[_0x52be('0xa')](_0x408f49,_0x33d9be)[_0x52be('0xb')](function(_0x20087c){logger[_0x52be('0xc')](_0x52be('0xd'),_0x30c815,_0x52be('0xe'));logger['debug'](_0x52be('0xf'),_0x30c815,_0x52be('0xe'),JSON[_0x52be('0x10')](_0x20087c));if(_0x20087c[_0x52be('0x11')]){if(_0x20087c[_0x52be('0x11')]['code']===0x1f4){logger[_0x52be('0x11')](_0x52be('0xd'),_0x30c815,_0x20087c[_0x52be('0x11')][_0x52be('0x12')]);return _0x54f563(_0x20087c[_0x52be('0x11')][_0x52be('0x12')]);}logger[_0x52be('0x11')](_0x52be('0xd'),_0x30c815,_0x20087c['error'][_0x52be('0x12')]);return _0x3d2d06(_0x20087c[_0x52be('0x11')][_0x52be('0x12')]);}else{logger[_0x52be('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x30c815,_0x52be('0xe'));_0x3d2d06(_0x20087c['result'][_0x52be('0x12')]);}})[_0x52be('0x13')](function(_0x31de0d){logger[_0x52be('0x11')](_0x52be('0xd'),_0x30c815,_0x31de0d);_0x54f563(_0x31de0d);});});} \ No newline at end of file +var _0x4625=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x311ee1,_0x4f6803){var _0x14376b=function(_0x55a4d9){while(--_0x55a4d9){_0x311ee1['push'](_0x311ee1['shift']());}};_0x14376b(++_0x4f6803);}(_0x4625,0x1e0));var _0x5462=function(_0xe325bf,_0x4d6161){_0xe325bf=_0xe325bf-0x0;var _0x3b498d=_0x4625[_0xe325bf];return _0x3b498d;};'use strict';var _=require(_0x5462('0x0'));var util=require(_0x5462('0x1'));var moment=require('moment');var BPromise=require(_0x5462('0x2'));var rs=require(_0x5462('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5462('0x4'))['db'];var utils=require(_0x5462('0x5'));var logger=require(_0x5462('0x6'))(_0x5462('0x7'));var config=require(_0x5462('0x8'));var jayson=require(_0x5462('0x9'));var client=jayson['client'][_0x5462('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44be1c,_0x2af41b,_0x24a7e8){return new BPromise(function(_0x42360a,_0x33e1c5){return client[_0x5462('0xb')](_0x44be1c,_0x24a7e8)[_0x5462('0xc')](function(_0xd454b4){logger[_0x5462('0xd')](_0x5462('0xe'),_0x2af41b,_0x5462('0xf'));logger['debug'](_0x5462('0x10'),_0x2af41b,_0x5462('0xf'),JSON[_0x5462('0x11')](_0xd454b4));if(_0xd454b4['error']){if(_0xd454b4[_0x5462('0x12')][_0x5462('0x13')]===0x1f4){logger['error'](_0x5462('0xe'),_0x2af41b,_0xd454b4[_0x5462('0x12')][_0x5462('0x14')]);return _0x33e1c5(_0xd454b4['error'][_0x5462('0x14')]);}logger[_0x5462('0x12')](_0x5462('0xe'),_0x2af41b,_0xd454b4[_0x5462('0x12')][_0x5462('0x14')]);return _0x42360a(_0xd454b4['error'][_0x5462('0x14')]);}else{logger[_0x5462('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2af41b,'request\x20sent');_0x42360a(_0xd454b4[_0x5462('0x15')]['message']);}})[_0x5462('0x16')](function(_0x272e8b){logger[_0x5462('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2af41b,_0x272e8b);_0x33e1c5(_0x272e8b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index fd5b6e4..93033a7 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 _0x2ce8=['show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id'];(function(_0x1b0b7,_0x35b31c){var _0x171f72=function(_0x277947){while(--_0x277947){_0x1b0b7['push'](_0x1b0b7['shift']());}};_0x171f72(++_0x35b31c);}(_0x2ce8,0x139));var _0x82ce=function(_0x3414ab,_0x5beee8){_0x3414ab=_0x3414ab-0x0;var _0x3fa9fb=_0x2ce8[_0x3414ab];return _0x3fa9fb;};'use strict';var multer=require(_0x82ce('0x0'));var util=require('util');var path=require(_0x82ce('0x1'));var timeout=require(_0x82ce('0x2'));var express=require(_0x82ce('0x3'));var router=express[_0x82ce('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x82ce('0x5'));var interaction=require(_0x82ce('0x6'));var config=require(_0x82ce('0x7'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0x82ce('0x8')](),controller[_0x82ce('0x9')]);router['get'](_0x82ce('0xa'),auth['isAuthenticated'](),controller[_0x82ce('0xb')]);router[_0x82ce('0xc')]('/',auth[_0x82ce('0x8')](),controller[_0x82ce('0xd')]);router[_0x82ce('0xe')](_0x82ce('0xa'),auth[_0x82ce('0x8')](),controller['update']);router[_0x82ce('0xf')]('/:id',auth[_0x82ce('0x8')](),controller[_0x82ce('0x10')]);module[_0x82ce('0x11')]=router; \ No newline at end of file +var _0x6ce5=['multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','create','put','update','delete','exports'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x6ce5,0x1b0));var _0x56ce=function(_0x2b1295,_0x5004a9){_0x2b1295=_0x2b1295-0x0;var _0x94492d=_0x6ce5[_0x2b1295];return _0x94492d;};'use strict';var multer=require(_0x56ce('0x0'));var util=require('util');var path=require(_0x56ce('0x1'));var timeout=require('connect-timeout');var express=require(_0x56ce('0x2'));var router=express[_0x56ce('0x3')]();var fs_extra=require(_0x56ce('0x4'));var auth=require(_0x56ce('0x5'));var interaction=require(_0x56ce('0x6'));var config=require(_0x56ce('0x7'));var controller=require(_0x56ce('0x8'));router[_0x56ce('0x9')]('/',auth[_0x56ce('0xa')](),controller['index']);router[_0x56ce('0x9')](_0x56ce('0xb'),auth[_0x56ce('0xa')](),controller[_0x56ce('0xc')]);router['post']('/',auth[_0x56ce('0xa')](),controller[_0x56ce('0xd')]);router[_0x56ce('0xe')](_0x56ce('0xb'),auth[_0x56ce('0xa')](),controller[_0x56ce('0xf')]);router[_0x56ce('0x10')]('/:id',auth[_0x56ce('0xa')](),controller['destroy']);module[_0x56ce('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 63fd70e..01ef779 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 _0x5805=['string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x5805,0xf0));var _0x5580=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x5805[_0x1d24eb];return _0x1dc576;};'use strict';var Sequelize=require(_0x5580('0x0'));module[_0x5580('0x1')]={'type':{'type':Sequelize[_0x5580('0x2')](_0x5580('0x3'),_0x5580('0x4'),_0x5580('0x5'),_0x5580('0x6'),_0x5580('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5580('0x8')]},'key':{'type':Sequelize[_0x5580('0x8')]},'keyType':{'type':Sequelize[_0x5580('0x2')](_0x5580('0x3'),'variable',_0x5580('0x5'))},'keyContent':{'type':Sequelize[_0x5580('0x8')]},'idField':{'type':Sequelize[_0x5580('0x8')]},'nameField':{'type':Sequelize[_0x5580('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5580('0x8')]}}; \ No newline at end of file +var _0xba36=['STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x349a74,_0x5316dc){var _0x944b87=function(_0x37e95c){while(--_0x37e95c){_0x349a74['push'](_0x349a74['shift']());}};_0x944b87(++_0x5316dc);}(_0xba36,0x1d6));var _0x6ba3=function(_0x5aa8f7,_0x4004a5){_0x5aa8f7=_0x5aa8f7-0x0;var _0x32bb47=_0xba36[_0x5aa8f7];return _0x32bb47;};'use strict';var Sequelize=require(_0x6ba3('0x0'));module['exports']={'type':{'type':Sequelize[_0x6ba3('0x1')](_0x6ba3('0x2'),_0x6ba3('0x3'),_0x6ba3('0x4'),_0x6ba3('0x5'),_0x6ba3('0x6')),'defaultValue':_0x6ba3('0x2')},'content':{'type':Sequelize[_0x6ba3('0x7')]},'key':{'type':Sequelize[_0x6ba3('0x7')]},'keyType':{'type':Sequelize[_0x6ba3('0x1')](_0x6ba3('0x2'),_0x6ba3('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x6ba3('0x7')]},'idField':{'type':Sequelize[_0x6ba3('0x7')]},'nameField':{'type':Sequelize[_0x6ba3('0x7')]},'customField':{'type':Sequelize[_0x6ba3('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6ba3('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index dd45b37..2053b3d 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 _0x187d=['destroy','name','send','index','Dynamics365Field','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then'];(function(_0x1c436a,_0x2415bd){var _0x487990=function(_0x510538){while(--_0x510538){_0x1c436a['push'](_0x1c436a['shift']());}};_0x487990(++_0x2415bd);}(_0x187d,0x150));var _0xd187=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x187d[_0x3e112d];return _0x531c31;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd187('0x0'));var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require('moment');var BPromise=require(_0xd187('0x4'));var Mustache=require(_0xd187('0x5'));var util=require(_0xd187('0x6'));var path=require('path');var sox=require(_0xd187('0x7'));var csv=require(_0xd187('0x8'));var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd187('0xe'));var toCsv=require(_0xd187('0x8'));var querystring=require(_0xd187('0xf'));var Papa=require(_0xd187('0x10'));var Redis=require(_0xd187('0x11'));var authService=require(_0xd187('0x12'));var qs=require(_0xd187('0x13'));var as=require(_0xd187('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd187('0x15'))(_0xd187('0x16'));var utils=require('../../config/utils');var config=require(_0xd187('0x17'));var licenseUtil=require(_0xd187('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b7710,_0x56751b){_0x56751b=_0x56751b||0xcc;return function(_0x1ba3f4){if(_0x1ba3f4){return _0x1b7710[_0xd187('0x19')](_0x56751b);}return _0x1b7710['status'](_0x56751b)[_0xd187('0x1a')]();};}function respondWithResult(_0x569ffe,_0x5c7d81){_0x5c7d81=_0x5c7d81||0xc8;return function(_0x137775){if(_0x137775){return _0x569ffe[_0xd187('0x1b')](_0x5c7d81)[_0xd187('0x1c')](_0x137775);}};}function respondWithFilteredResult(_0x32a481,_0x26e87e){return function(_0x19eac5){if(_0x19eac5){var _0x16a2fc=typeof _0x26e87e['offset']==='undefined'&&typeof _0x26e87e[_0xd187('0x1d')]===_0xd187('0x1e');var _0x3fd8b1=_0x19eac5[_0xd187('0x1f')];var _0x59d49b=_0x16a2fc?0x0:_0x26e87e[_0xd187('0x20')];var _0x1f8902=_0x16a2fc?_0x19eac5[_0xd187('0x1f')]:_0x26e87e['offset']+_0x26e87e[_0xd187('0x1d')];var _0x5cb71e;if(_0x1f8902>=_0x3fd8b1){_0x1f8902=_0x3fd8b1;_0x5cb71e=0xc8;}else{_0x5cb71e=0xce;}_0x32a481[_0xd187('0x1b')](_0x5cb71e);return _0x32a481['set'](_0xd187('0x21'),_0x59d49b+'-'+_0x1f8902+'/'+_0x3fd8b1)[_0xd187('0x1c')](_0x19eac5);}return null;};}function patchUpdates(_0x200718){return function(_0x3a1862){try{jsonpatch[_0xd187('0x22')](_0x3a1862,_0x200718,!![]);}catch(_0x5b9141){return BPromise[_0xd187('0x23')](_0x5b9141);}return _0x3a1862[_0xd187('0x24')]();};}function saveUpdates(_0x28ee87,_0x13ee80){return function(_0x4d0aef){if(_0x4d0aef){return _0x4d0aef[_0xd187('0x25')](_0x28ee87)[_0xd187('0x26')](function(_0x9c42c9){return _0x9c42c9;});}return null;};}function removeEntity(_0x2e525b,_0x32bd0f){return function(_0x397c4f){if(_0x397c4f){return _0x397c4f[_0xd187('0x27')]()[_0xd187('0x26')](function(){_0x2e525b[_0xd187('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2070cd,_0x1b4447){return function(_0x2d39c2){if(!_0x2d39c2){_0x2070cd['sendStatus'](0x194);}return _0x2d39c2;};}function handleError(_0x400cca,_0x1d11bd){_0x1d11bd=_0x1d11bd||0x1f4;return function(_0x325a3f){logger['error'](_0x325a3f['stack']);if(_0x325a3f['name']){delete _0x325a3f[_0xd187('0x28')];}_0x400cca[_0xd187('0x1b')](_0x1d11bd)[_0xd187('0x29')](_0x325a3f);};}exports[_0xd187('0x2a')]=function(_0x2f9413,_0x555970){var _0x16736a={},_0x241144={},_0x2d78b3={'count':0x0,'rows':[]};var _0x4b1849=_['map'](db[_0xd187('0x2b')][_0xd187('0x2c')],function(_0x16d5ad){return{'name':_0x16d5ad['fieldName'],'type':_0x16d5ad['type'][_0xd187('0x2d')]};});_0x241144[_0xd187('0x2e')]=_['map'](_0x4b1849,'name');_0x241144[_0xd187('0x2f')]=_[_0xd187('0x30')](_0x2f9413[_0xd187('0x2f')]);_0x241144[_0xd187('0x31')]=_[_0xd187('0x32')](_0x241144['model'],_0x241144['query']);_0x16736a[_0xd187('0x33')]=_[_0xd187('0x32')](_0x241144[_0xd187('0x2e')],qs[_0xd187('0x34')](_0x2f9413[_0xd187('0x2f')]['fields']));_0x16736a[_0xd187('0x33')]=_0x16736a[_0xd187('0x33')][_0xd187('0x35')]?_0x16736a[_0xd187('0x33')]:_0x241144[_0xd187('0x2e')];if(!_0x2f9413[_0xd187('0x2f')][_0xd187('0x36')](_0xd187('0x37'))){_0x16736a[_0xd187('0x1d')]=qs[_0xd187('0x1d')](_0x2f9413['query']['limit']);_0x16736a[_0xd187('0x20')]=qs[_0xd187('0x20')](_0x2f9413[_0xd187('0x2f')][_0xd187('0x20')]);}_0x16736a[_0xd187('0x38')]=qs[_0xd187('0x39')](_0x2f9413[_0xd187('0x2f')][_0xd187('0x39')]);_0x16736a[_0xd187('0x3a')]=qs[_0xd187('0x31')](_[_0xd187('0x3b')](_0x2f9413['query'],_0x241144['filters']),_0x4b1849);if(_0x2f9413['query'][_0xd187('0x3c')]){_0x16736a['where']=_[_0xd187('0x3d')](_0x16736a[_0xd187('0x3a')],{'$or':_[_0xd187('0x3e')](_0x4b1849,function(_0x20b799){if(_0x20b799[_0xd187('0x3f')]!==_0xd187('0x40')){var _0x5e59d6={};_0x5e59d6[_0x20b799[_0xd187('0x28')]]={'$like':'%'+_0x2f9413[_0xd187('0x2f')][_0xd187('0x3c')]+'%'};return _0x5e59d6;}})});}_0x16736a=_[_0xd187('0x3d')]({},_0x16736a,_0x2f9413[_0xd187('0x41')]);var _0x5e53c6={'where':_0x16736a[_0xd187('0x3a')]};return db[_0xd187('0x2b')][_0xd187('0x1f')](_0x5e53c6)[_0xd187('0x26')](function(_0x445f15){_0x2d78b3['count']=_0x445f15;if(_0x2f9413[_0xd187('0x2f')]['includeAll']){_0x16736a[_0xd187('0x42')]=[{'all':!![]}];}return db[_0xd187('0x2b')][_0xd187('0x43')](_0x16736a);})[_0xd187('0x26')](function(_0xcf1b70){_0x2d78b3[_0xd187('0x44')]=_0xcf1b70;return _0x2d78b3;})[_0xd187('0x26')](respondWithFilteredResult(_0x555970,_0x16736a))[_0xd187('0x45')](handleError(_0x555970,null));};exports[_0xd187('0x46')]=function(_0x223262,_0x10d2cd){var _0x9f6b26={'raw':!![],'where':{'id':_0x223262[_0xd187('0x47')]['id']}},_0x4dd249={};_0x4dd249[_0xd187('0x2e')]=_[_0xd187('0x30')](db[_0xd187('0x2b')][_0xd187('0x2c')]);_0x4dd249[_0xd187('0x2f')]=_[_0xd187('0x30')](_0x223262[_0xd187('0x2f')]);_0x4dd249[_0xd187('0x31')]=_['intersection'](_0x4dd249[_0xd187('0x2e')],_0x4dd249[_0xd187('0x2f')]);_0x9f6b26[_0xd187('0x33')]=_[_0xd187('0x32')](_0x4dd249[_0xd187('0x2e')],qs[_0xd187('0x34')](_0x223262[_0xd187('0x2f')]['fields']));_0x9f6b26[_0xd187('0x33')]=_0x9f6b26[_0xd187('0x33')][_0xd187('0x35')]?_0x9f6b26[_0xd187('0x33')]:_0x4dd249[_0xd187('0x2e')];if(_0x223262[_0xd187('0x2f')]['includeAll']){_0x9f6b26[_0xd187('0x42')]=[{'all':!![]}];}_0x9f6b26=_[_0xd187('0x3d')]({},_0x9f6b26,_0x223262['options']);return db['Dynamics365Field'][_0xd187('0x48')](_0x9f6b26)[_0xd187('0x26')](handleEntityNotFound(_0x10d2cd,null))['then'](respondWithResult(_0x10d2cd,null))[_0xd187('0x45')](handleError(_0x10d2cd,null));};exports[_0xd187('0x49')]=function(_0x56f916,_0x3e9748){return db[_0xd187('0x2b')][_0xd187('0x49')](_0x56f916[_0xd187('0x4a')],{})['then'](respondWithResult(_0x3e9748,0xc9))[_0xd187('0x45')](handleError(_0x3e9748,null));};exports['update']=function(_0x592900,_0x9e59fd){if(_0x592900[_0xd187('0x4a')]['id']){delete _0x592900['body']['id'];}return db[_0xd187('0x2b')][_0xd187('0x48')]({'where':{'id':_0x592900[_0xd187('0x47')]['id']}})['then'](handleEntityNotFound(_0x9e59fd,null))[_0xd187('0x26')](saveUpdates(_0x592900['body'],null))[_0xd187('0x26')](respondWithResult(_0x9e59fd,null))[_0xd187('0x45')](handleError(_0x9e59fd,null));};exports[_0xd187('0x27')]=function(_0x15fd4a,_0x3eaf49){return db[_0xd187('0x2b')][_0xd187('0x48')]({'where':{'id':_0x15fd4a['params']['id']}})[_0xd187('0x26')](handleEntityNotFound(_0x3eaf49,null))[_0xd187('0x26')](removeEntity(_0x3eaf49,null))[_0xd187('0x45')](handleError(_0x3eaf49,null));}; \ No newline at end of file +var _0x2c6c=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','count','status','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','Dynamics365Field','includeAll','include','findAll','catch','show','params','options','find','create','body','eml-format','zip-dir','fast-json-patch','moment','mustache','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x56f276,_0x5099ad){var _0x55b1ba=function(_0x8a2722){while(--_0x8a2722){_0x56f276['push'](_0x56f276['shift']());}};_0x55b1ba(++_0x5099ad);}(_0x2c6c,0xc0));var _0xc2c6=function(_0x1e57d5,_0x2e889a){_0x1e57d5=_0x1e57d5-0x0;var _0x306a23=_0x2c6c[_0x1e57d5];return _0x306a23;};'use strict';var emlformat=require(_0xc2c6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc2c6('0x1'));var jsonpatch=require(_0xc2c6('0x2'));var rp=require('request-promise');var moment=require(_0xc2c6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc2c6('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc2c6('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc2c6('0x6'));var _=require(_0xc2c6('0x7'));var squel=require(_0xc2c6('0x8'));var crypto=require(_0xc2c6('0x9'));var jsforce=require(_0xc2c6('0xa'));var deskjs=require(_0xc2c6('0xb'));var toCsv=require(_0xc2c6('0x5'));var querystring=require('querystring');var Papa=require(_0xc2c6('0xc'));var Redis=require('ioredis');var authService=require(_0xc2c6('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xc2c6('0xe'));var hardwareService=require(_0xc2c6('0xf'));var logger=require(_0xc2c6('0x10'))(_0xc2c6('0x11'));var utils=require(_0xc2c6('0x12'));var config=require(_0xc2c6('0x13'));var licenseUtil=require(_0xc2c6('0x14'));var db=require(_0xc2c6('0x15'))['db'];function respondWithStatusCode(_0x1ca429,_0x30e549){_0x30e549=_0x30e549||0xcc;return function(_0x301a68){if(_0x301a68){return _0x1ca429[_0xc2c6('0x16')](_0x30e549);}return _0x1ca429['status'](_0x30e549)[_0xc2c6('0x17')]();};}function respondWithResult(_0x3dab04,_0x147876){_0x147876=_0x147876||0xc8;return function(_0x4a2d0a){if(_0x4a2d0a){return _0x3dab04['status'](_0x147876)[_0xc2c6('0x18')](_0x4a2d0a);}};}function respondWithFilteredResult(_0x2a2a2f,_0x48204b){return function(_0x153003){if(_0x153003){var _0x24df5f=typeof _0x48204b[_0xc2c6('0x19')]==='undefined'&&typeof _0x48204b[_0xc2c6('0x1a')]==='undefined';var _0x4c71ac=_0x153003[_0xc2c6('0x1b')];var _0x265498=_0x24df5f?0x0:_0x48204b['offset'];var _0x42e672=_0x24df5f?_0x153003[_0xc2c6('0x1b')]:_0x48204b[_0xc2c6('0x19')]+_0x48204b[_0xc2c6('0x1a')];var _0x432527;if(_0x42e672>=_0x4c71ac){_0x42e672=_0x4c71ac;_0x432527=0xc8;}else{_0x432527=0xce;}_0x2a2a2f[_0xc2c6('0x1c')](_0x432527);return _0x2a2a2f['set'](_0xc2c6('0x1d'),_0x265498+'-'+_0x42e672+'/'+_0x4c71ac)[_0xc2c6('0x18')](_0x153003);}return null;};}function patchUpdates(_0x5722dc){return function(_0x40d06d){try{jsonpatch['apply'](_0x40d06d,_0x5722dc,!![]);}catch(_0x12a3cc){return BPromise[_0xc2c6('0x1e')](_0x12a3cc);}return _0x40d06d[_0xc2c6('0x1f')]();};}function saveUpdates(_0x443596,_0x226742){return function(_0x5cb156){if(_0x5cb156){return _0x5cb156[_0xc2c6('0x20')](_0x443596)[_0xc2c6('0x21')](function(_0x109827){return _0x109827;});}return null;};}function removeEntity(_0x5b57c3,_0xbd59c9){return function(_0x59eb09){if(_0x59eb09){return _0x59eb09[_0xc2c6('0x22')]()[_0xc2c6('0x21')](function(){_0x5b57c3[_0xc2c6('0x1c')](0xcc)[_0xc2c6('0x17')]();});}};}function handleEntityNotFound(_0x22e328,_0x13baee){return function(_0x56dc26){if(!_0x56dc26){_0x22e328[_0xc2c6('0x16')](0x194);}return _0x56dc26;};}function handleError(_0x26aa98,_0x8c6c78){_0x8c6c78=_0x8c6c78||0x1f4;return function(_0x1aa726){logger['error'](_0x1aa726[_0xc2c6('0x23')]);if(_0x1aa726['name']){delete _0x1aa726[_0xc2c6('0x24')];}_0x26aa98[_0xc2c6('0x1c')](_0x8c6c78)[_0xc2c6('0x25')](_0x1aa726);};}exports[_0xc2c6('0x26')]=function(_0xbd22a2,_0x118c22){var _0x5e3a75={},_0x3e77b5={},_0x900281={'count':0x0,'rows':[]};var _0x4a9717=_[_0xc2c6('0x27')](db['Dynamics365Field'][_0xc2c6('0x28')],function(_0x579993){return{'name':_0x579993[_0xc2c6('0x29')],'type':_0x579993[_0xc2c6('0x2a')][_0xc2c6('0x2b')]};});_0x3e77b5['model']=_[_0xc2c6('0x27')](_0x4a9717,'name');_0x3e77b5['query']=_[_0xc2c6('0x2c')](_0xbd22a2[_0xc2c6('0x2d')]);_0x3e77b5[_0xc2c6('0x2e')]=_[_0xc2c6('0x2f')](_0x3e77b5[_0xc2c6('0x30')],_0x3e77b5['query']);_0x5e3a75[_0xc2c6('0x31')]=_[_0xc2c6('0x2f')](_0x3e77b5['model'],qs[_0xc2c6('0x32')](_0xbd22a2[_0xc2c6('0x2d')][_0xc2c6('0x32')]));_0x5e3a75[_0xc2c6('0x31')]=_0x5e3a75[_0xc2c6('0x31')][_0xc2c6('0x33')]?_0x5e3a75[_0xc2c6('0x31')]:_0x3e77b5[_0xc2c6('0x30')];if(!_0xbd22a2[_0xc2c6('0x2d')]['hasOwnProperty'](_0xc2c6('0x34'))){_0x5e3a75[_0xc2c6('0x1a')]=qs['limit'](_0xbd22a2['query'][_0xc2c6('0x1a')]);_0x5e3a75[_0xc2c6('0x19')]=qs[_0xc2c6('0x19')](_0xbd22a2[_0xc2c6('0x2d')][_0xc2c6('0x19')]);}_0x5e3a75[_0xc2c6('0x35')]=qs[_0xc2c6('0x36')](_0xbd22a2['query'][_0xc2c6('0x36')]);_0x5e3a75[_0xc2c6('0x37')]=qs[_0xc2c6('0x2e')](_['pick'](_0xbd22a2[_0xc2c6('0x2d')],_0x3e77b5[_0xc2c6('0x2e')]),_0x4a9717);if(_0xbd22a2[_0xc2c6('0x2d')][_0xc2c6('0x38')]){_0x5e3a75[_0xc2c6('0x37')]=_[_0xc2c6('0x39')](_0x5e3a75[_0xc2c6('0x37')],{'$or':_[_0xc2c6('0x27')](_0x4a9717,function(_0x39024f){if(_0x39024f[_0xc2c6('0x2a')]!=='VIRTUAL'){var _0x2a78d9={};_0x2a78d9[_0x39024f['name']]={'$like':'%'+_0xbd22a2[_0xc2c6('0x2d')]['filter']+'%'};return _0x2a78d9;}})});}_0x5e3a75=_[_0xc2c6('0x39')]({},_0x5e3a75,_0xbd22a2['options']);var _0x550f54={'where':_0x5e3a75[_0xc2c6('0x37')]};return db[_0xc2c6('0x3a')][_0xc2c6('0x1b')](_0x550f54)[_0xc2c6('0x21')](function(_0x4681c5){_0x900281['count']=_0x4681c5;if(_0xbd22a2['query'][_0xc2c6('0x3b')]){_0x5e3a75[_0xc2c6('0x3c')]=[{'all':!![]}];}return db[_0xc2c6('0x3a')][_0xc2c6('0x3d')](_0x5e3a75);})[_0xc2c6('0x21')](function(_0x789be8){_0x900281['rows']=_0x789be8;return _0x900281;})[_0xc2c6('0x21')](respondWithFilteredResult(_0x118c22,_0x5e3a75))[_0xc2c6('0x3e')](handleError(_0x118c22,null));};exports[_0xc2c6('0x3f')]=function(_0x4ac8ab,_0xac40e3){var _0x244011={'raw':!![],'where':{'id':_0x4ac8ab[_0xc2c6('0x40')]['id']}},_0x7195c0={};_0x7195c0[_0xc2c6('0x30')]=_[_0xc2c6('0x2c')](db[_0xc2c6('0x3a')]['rawAttributes']);_0x7195c0['query']=_['keys'](_0x4ac8ab[_0xc2c6('0x2d')]);_0x7195c0[_0xc2c6('0x2e')]=_[_0xc2c6('0x2f')](_0x7195c0[_0xc2c6('0x30')],_0x7195c0[_0xc2c6('0x2d')]);_0x244011[_0xc2c6('0x31')]=_[_0xc2c6('0x2f')](_0x7195c0[_0xc2c6('0x30')],qs[_0xc2c6('0x32')](_0x4ac8ab['query'][_0xc2c6('0x32')]));_0x244011[_0xc2c6('0x31')]=_0x244011['attributes']['length']?_0x244011[_0xc2c6('0x31')]:_0x7195c0[_0xc2c6('0x30')];if(_0x4ac8ab['query']['includeAll']){_0x244011[_0xc2c6('0x3c')]=[{'all':!![]}];}_0x244011=_['merge']({},_0x244011,_0x4ac8ab[_0xc2c6('0x41')]);return db[_0xc2c6('0x3a')][_0xc2c6('0x42')](_0x244011)['then'](handleEntityNotFound(_0xac40e3,null))[_0xc2c6('0x21')](respondWithResult(_0xac40e3,null))[_0xc2c6('0x3e')](handleError(_0xac40e3,null));};exports[_0xc2c6('0x43')]=function(_0x128acb,_0x359aa9){return db['Dynamics365Field']['create'](_0x128acb['body'],{})[_0xc2c6('0x21')](respondWithResult(_0x359aa9,0xc9))[_0xc2c6('0x3e')](handleError(_0x359aa9,null));};exports[_0xc2c6('0x20')]=function(_0x267382,_0x32a2f1){if(_0x267382[_0xc2c6('0x44')]['id']){delete _0x267382['body']['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x267382[_0xc2c6('0x40')]['id']}})['then'](handleEntityNotFound(_0x32a2f1,null))[_0xc2c6('0x21')](saveUpdates(_0x267382[_0xc2c6('0x44')],null))[_0xc2c6('0x21')](respondWithResult(_0x32a2f1,null))[_0xc2c6('0x3e')](handleError(_0x32a2f1,null));};exports[_0xc2c6('0x22')]=function(_0xa6e178,_0xb6cccb){return db['Dynamics365Field'][_0xc2c6('0x42')]({'where':{'id':_0xa6e178[_0xc2c6('0x40')]['id']}})[_0xc2c6('0x21')](handleEntityNotFound(_0xb6cccb,null))[_0xc2c6('0x21')](removeEntity(_0xb6cccb,null))[_0xc2c6('0x3e')](handleError(_0xb6cccb,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 96a2c60..c1f4e55 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 _0x537a=['Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports'];(function(_0x56222e,_0x48569f){var _0x373b78=function(_0x14212a){while(--_0x14212a){_0x56222e['push'](_0x56222e['shift']());}};_0x373b78(++_0x48569f);}(_0x537a,0x109));var _0xa537=function(_0x45c32f,_0x412fcc){_0x45c32f=_0x45c32f-0x0;var _0x41d93d=_0x537a[_0x45c32f];return _0x41d93d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa537('0x0'))('api');var moment=require(_0xa537('0x1'));var BPromise=require('bluebird');var rp=require(_0xa537('0x2'));var fs=require('fs');var path=require(_0xa537('0x3'));var rimraf=require(_0xa537('0x4'));var config=require(_0xa537('0x5'));var attributes=require(_0xa537('0x6'));module[_0xa537('0x7')]=function(_0x364e4b,_0x389887){return _0x364e4b['define'](_0xa537('0x8'),attributes,{'tableName':_0xa537('0x9'),'paranoid':![],'indexes':[{'name':_0xa537('0xa'),'fields':[_0xa537('0xb'),_0xa537('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1ef5=['./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x1ef5,0x14c));var _0x51ef=function(_0x242bd9,_0x5b6978){_0x242bd9=_0x242bd9-0x0;var _0x2ecdf8=_0x1ef5[_0x242bd9];return _0x2ecdf8;};'use strict';var _=require(_0x51ef('0x0'));var util=require(_0x51ef('0x1'));var logger=require(_0x51ef('0x2'))(_0x51ef('0x3'));var moment=require(_0x51ef('0x4'));var BPromise=require(_0x51ef('0x5'));var rp=require(_0x51ef('0x6'));var fs=require('fs');var path=require(_0x51ef('0x7'));var rimraf=require(_0x51ef('0x8'));var config=require(_0x51ef('0x9'));var attributes=require(_0x51ef('0xa'));module[_0x51ef('0xb')]=function(_0x447e7f,_0x510c7d){return _0x447e7f[_0x51ef('0xc')](_0x51ef('0xd'),attributes,{'tableName':_0x51ef('0xe'),'paranoid':![],'indexes':[{'name':_0x51ef('0xf'),'fields':[_0x51ef('0x10'),_0x51ef('0x11')],'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 c3aed0d..e7c0b2d 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 _0xa4d0=['rpc','../../config/environment','jayson/promise','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3ab8ba,_0x3dc941){var _0x2fc201=function(_0x47f070){while(--_0x47f070){_0x3ab8ba['push'](_0x3ab8ba['shift']());}};_0x2fc201(++_0x3dc941);}(_0xa4d0,0x117));var _0x0a4d=function(_0x23d85c,_0xdc9859){_0x23d85c=_0x23d85c-0x0;var _0x2a4891=_0xa4d0[_0x23d85c];return _0x2a4891;};'use strict';var _=require(_0x0a4d('0x0'));var util=require(_0x0a4d('0x1'));var moment=require(_0x0a4d('0x2'));var BPromise=require(_0x0a4d('0x3'));var rs=require(_0x0a4d('0x4'));var fs=require('fs');var Redis=require(_0x0a4d('0x5'));var db=require(_0x0a4d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0a4d('0x7'));var config=require(_0x0a4d('0x8'));var jayson=require(_0x0a4d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x213a62,_0x2e81a1,_0x400d79){return new BPromise(function(_0x1a3f7f,_0xf356a4){return client['request'](_0x213a62,_0x400d79)[_0x0a4d('0xa')](function(_0xaf835e){logger[_0x0a4d('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x2e81a1,_0x0a4d('0xc'));logger[_0x0a4d('0xd')](_0x0a4d('0xe'),_0x2e81a1,_0x0a4d('0xc'),JSON[_0x0a4d('0xf')](_0xaf835e));if(_0xaf835e[_0x0a4d('0x10')]){if(_0xaf835e['error'][_0x0a4d('0x11')]===0x1f4){logger[_0x0a4d('0x10')](_0x0a4d('0x12'),_0x2e81a1,_0xaf835e[_0x0a4d('0x10')][_0x0a4d('0x13')]);return _0xf356a4(_0xaf835e[_0x0a4d('0x10')]['message']);}logger['error'](_0x0a4d('0x12'),_0x2e81a1,_0xaf835e[_0x0a4d('0x10')][_0x0a4d('0x13')]);return _0x1a3f7f(_0xaf835e['error']['message']);}else{logger['info'](_0x0a4d('0x12'),_0x2e81a1,'request\x20sent');_0x1a3f7f(_0xaf835e[_0x0a4d('0x14')][_0x0a4d('0x13')]);}})[_0x0a4d('0x15')](function(_0x2c9f20){logger['error'](_0x0a4d('0x12'),_0x2e81a1,_0x2c9f20);_0xf356a4(_0x2c9f20);});});} \ No newline at end of file +var _0x6f63=['error','message','info','Dynamics365Field,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify'];(function(_0x4c4cd0,_0x3ef773){var _0x2ebd7c=function(_0xd35800){while(--_0xd35800){_0x4c4cd0['push'](_0x4c4cd0['shift']());}};_0x2ebd7c(++_0x3ef773);}(_0x6f63,0xcb));var _0x36f6=function(_0x4646dc,_0x4763a8){_0x4646dc=_0x4646dc-0x0;var _0x296689=_0x6f63[_0x4646dc];return _0x296689;};'use strict';var _=require(_0x36f6('0x0'));var util=require(_0x36f6('0x1'));var moment=require(_0x36f6('0x2'));var BPromise=require(_0x36f6('0x3'));var rs=require(_0x36f6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x36f6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x36f6('0x6'))(_0x36f6('0x7'));var config=require(_0x36f6('0x8'));var jayson=require(_0x36f6('0x9'));var client=jayson[_0x36f6('0xa')][_0x36f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30720c,_0xeb0c41,_0x12ddf2){return new BPromise(function(_0x3d3df1,_0x3fe7a9){return client[_0x36f6('0xc')](_0x30720c,_0x12ddf2)[_0x36f6('0xd')](function(_0x12e0fa){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0xeb0c41,_0x36f6('0xe'));logger[_0x36f6('0xf')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0xeb0c41,_0x36f6('0xe'),JSON[_0x36f6('0x10')](_0x12e0fa));if(_0x12e0fa[_0x36f6('0x11')]){if(_0x12e0fa[_0x36f6('0x11')]['code']===0x1f4){logger[_0x36f6('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0xeb0c41,_0x12e0fa[_0x36f6('0x11')][_0x36f6('0x12')]);return _0x3fe7a9(_0x12e0fa[_0x36f6('0x11')][_0x36f6('0x12')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0xeb0c41,_0x12e0fa[_0x36f6('0x11')][_0x36f6('0x12')]);return _0x3d3df1(_0x12e0fa[_0x36f6('0x11')][_0x36f6('0x12')]);}else{logger[_0x36f6('0x13')](_0x36f6('0x14'),_0xeb0c41,_0x36f6('0xe'));_0x3d3df1(_0x12e0fa[_0x36f6('0x15')][_0x36f6('0x12')]);}})['catch'](function(_0x46355e){logger['error'](_0x36f6('0x14'),_0xeb0c41,_0x46355e);_0x3fe7a9(_0x46355e);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index a8e44ec..410bf0d 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 _0x6472=['getFields','post','addConfiguration','update','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations'];(function(_0x1b8f5a,_0x57c154){var _0x594189=function(_0x15b277){while(--_0x15b277){_0x1b8f5a['push'](_0x1b8f5a['shift']());}};_0x594189(++_0x57c154);}(_0x6472,0xcd));var _0x2647=function(_0x35d741,_0x13c71c){_0x35d741=_0x35d741-0x0;var _0x37cca8=_0x6472[_0x35d741];return _0x37cca8;};'use strict';var multer=require(_0x2647('0x0'));var util=require('util');var path=require(_0x2647('0x1'));var timeout=require(_0x2647('0x2'));var express=require('express');var router=express[_0x2647('0x3')]();var fs_extra=require(_0x2647('0x4'));var auth=require(_0x2647('0x5'));var interaction=require(_0x2647('0x6'));var config=require(_0x2647('0x7'));var controller=require('./intFreshdeskAccount.controller');router[_0x2647('0x8')]('/',auth[_0x2647('0x9')](),controller[_0x2647('0xa')]);router[_0x2647('0x8')](_0x2647('0xb'),auth['isAuthenticated'](),controller[_0x2647('0xc')]);router[_0x2647('0x8')](_0x2647('0xd'),auth[_0x2647('0x9')](),controller[_0x2647('0xe')]);router[_0x2647('0x8')]('/:id/fields',auth[_0x2647('0x9')](),controller[_0x2647('0xf')]);router[_0x2647('0x10')]('/',auth[_0x2647('0x9')](),controller['create']);router[_0x2647('0x10')](_0x2647('0xd'),auth['isAuthenticated'](),controller[_0x2647('0x11')]);router['put'](_0x2647('0xb'),auth['isAuthenticated'](),controller[_0x2647('0x12')]);router['delete']('/:id',auth[_0x2647('0x9')](),controller[_0x2647('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe22b=['Router','fs-extra','../../components/auth/service','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3d0bf2,_0x5e7f22){var _0x3be65f=function(_0x51bcdf){while(--_0x51bcdf){_0x3d0bf2['push'](_0x3d0bf2['shift']());}};_0x3be65f(++_0x5e7f22);}(_0xe22b,0x122));var _0xbe22=function(_0x377950,_0x55d937){_0x377950=_0x377950-0x0;var _0x4188e2=_0xe22b[_0x377950];return _0x4188e2;};'use strict';var multer=require(_0xbe22('0x0'));var util=require('util');var path=require(_0xbe22('0x1'));var timeout=require(_0xbe22('0x2'));var express=require(_0xbe22('0x3'));var router=express[_0xbe22('0x4')]();var fs_extra=require(_0xbe22('0x5'));var auth=require(_0xbe22('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe22('0x7'));router['get']('/',auth[_0xbe22('0x8')](),controller[_0xbe22('0x9')]);router[_0xbe22('0xa')](_0xbe22('0xb'),auth[_0xbe22('0x8')](),controller['show']);router['get'](_0xbe22('0xc'),auth[_0xbe22('0x8')](),controller[_0xbe22('0xd')]);router[_0xbe22('0xa')](_0xbe22('0xe'),auth[_0xbe22('0x8')](),controller[_0xbe22('0xf')]);router[_0xbe22('0x10')]('/',auth[_0xbe22('0x8')](),controller[_0xbe22('0x11')]);router['post'](_0xbe22('0xc'),auth[_0xbe22('0x8')](),controller[_0xbe22('0x12')]);router['put']('/:id',auth[_0xbe22('0x8')](),controller['update']);router['delete'](_0xbe22('0xb'),auth[_0xbe22('0x8')](),controller[_0xbe22('0x13')]);module[_0xbe22('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index e8e19df..494e019 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 _0x1eba=['exports','STRING','remoteUri','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x3e961c,_0x5747e7){_0x3e961c=_0x3e961c-0x0;var _0x474f9c=_0x1eba[_0x3e961c];return _0x474f9c;};'use strict';var Sequelize=require(_0xa1eb('0x0'));module[_0xa1eb('0x1')]={'name':{'type':Sequelize[_0xa1eb('0x2')]},'description':{'type':Sequelize[_0xa1eb('0x2')]},'username':{'type':Sequelize[_0xa1eb('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa1eb('0x2')],'unique':_0xa1eb('0x3')},'serverUrl':{'type':Sequelize[_0xa1eb('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x056b=['username','remoteUri','exports','STRING'];(function(_0x5ae2ba,_0x55c5eb){var _0x52f1da=function(_0x2e4aa1){while(--_0x2e4aa1){_0x5ae2ba['push'](_0x5ae2ba['shift']());}};_0x52f1da(++_0x55c5eb);}(_0x056b,0xb6));var _0xb056=function(_0x59ed0e,_0x41a60f){_0x59ed0e=_0x59ed0e-0x0;var _0x9a8307=_0x056b[_0x59ed0e];return _0x9a8307;};'use strict';var Sequelize=require('sequelize');module[_0xb056('0x0')]={'name':{'type':Sequelize[_0xb056('0x1')]},'description':{'type':Sequelize[_0xb056('0x1')]},'username':{'type':Sequelize[_0xb056('0x1')],'unique':_0xb056('0x2')},'apiKey':{'type':Sequelize[_0xb056('0x1')]},'remoteUri':{'type':Sequelize[_0xb056('0x1')],'unique':_0xb056('0x3')},'serverUrl':{'type':Sequelize[_0xb056('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 1313493..db1086d 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 _0x6308=['length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','create','body','find','getConfigurations','FreshdeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','Basic\x20%s','requester','agent','description','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','type','key','model','query','filters','intersection','attributes','fields'];(function(_0x3bd288,_0x5c0ca0){var _0x49066a=function(_0x1aea59){while(--_0x1aea59){_0x3bd288['push'](_0x3bd288['shift']());}};_0x49066a(++_0x5c0ca0);}(_0x6308,0x1f2));var _0x8630=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x6308[_0xc0a3d3];return _0x3386e8;};'use strict';var emlformat=require(_0x8630('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8630('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8630('0x2'));var BPromise=require(_0x8630('0x3'));var Mustache=require(_0x8630('0x4'));var util=require(_0x8630('0x5'));var path=require(_0x8630('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8630('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8630('0x8'));var squel=require(_0x8630('0x9'));var crypto=require(_0x8630('0xa'));var jsforce=require(_0x8630('0xb'));var deskjs=require(_0x8630('0xc'));var toCsv=require(_0x8630('0xd'));var querystring=require('querystring');var Papa=require(_0x8630('0xe'));var Redis=require('ioredis');var authService=require(_0x8630('0xf'));var qs=require(_0x8630('0x10'));var as=require(_0x8630('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8630('0x12'))(_0x8630('0x13'));var utils=require(_0x8630('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8630('0x15'));var db=require(_0x8630('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x54073b,_0x303e3a){_0x303e3a=_0x303e3a||0xcc;return function(_0x22b75c){if(_0x22b75c){return _0x54073b['sendStatus'](_0x303e3a);}return _0x54073b[_0x8630('0x17')](_0x303e3a)['end']();};}function respondWithResult(_0xf31c17,_0x4cc542){_0x4cc542=_0x4cc542||0xc8;return function(_0x1527b1){if(_0x1527b1){return _0xf31c17['status'](_0x4cc542)['json'](_0x1527b1);}};}function respondWithFilteredResult(_0x29a42d,_0x86c262){return function(_0x49fce1){if(_0x49fce1){var _0x5c0ba0=typeof _0x86c262[_0x8630('0x18')]==='undefined'&&typeof _0x86c262[_0x8630('0x19')]===_0x8630('0x1a');var _0x2c360d=_0x49fce1[_0x8630('0x1b')];var _0x1304b9=_0x5c0ba0?0x0:_0x86c262[_0x8630('0x18')];var _0x4356b9=_0x5c0ba0?_0x49fce1[_0x8630('0x1b')]:_0x86c262[_0x8630('0x18')]+_0x86c262['limit'];var _0x59bda7;if(_0x4356b9>=_0x2c360d){_0x4356b9=_0x2c360d;_0x59bda7=0xc8;}else{_0x59bda7=0xce;}_0x29a42d[_0x8630('0x17')](_0x59bda7);return _0x29a42d[_0x8630('0x1c')]('Content-Range',_0x1304b9+'-'+_0x4356b9+'/'+_0x2c360d)['json'](_0x49fce1);}return null;};}function patchUpdates(_0x1325dc){return function(_0x441918){try{jsonpatch[_0x8630('0x1d')](_0x441918,_0x1325dc,!![]);}catch(_0x491c65){return BPromise['reject'](_0x491c65);}return _0x441918[_0x8630('0x1e')]();};}function saveUpdates(_0x58c0b5,_0x30fb4d){return function(_0x44e007){if(_0x44e007){return _0x44e007[_0x8630('0x1f')](_0x58c0b5)[_0x8630('0x20')](function(_0x4c2851){return _0x4c2851;});}return null;};}function removeEntity(_0x37c224,_0xf24c11){return function(_0x37ca50){if(_0x37ca50){return _0x37ca50[_0x8630('0x21')]()[_0x8630('0x20')](function(){_0x37c224[_0x8630('0x17')](0xcc)[_0x8630('0x22')]();});}};}function handleEntityNotFound(_0x5c0a22,_0x5b2823){return function(_0x18fd53){if(!_0x18fd53){_0x5c0a22[_0x8630('0x23')](0x194);}return _0x18fd53;};}function handleError(_0x439b33,_0xf97e31){_0xf97e31=_0xf97e31||0x1f4;return function(_0x2b1196){logger[_0x8630('0x24')](_0x2b1196[_0x8630('0x25')]);if(_0x2b1196[_0x8630('0x26')]){delete _0x2b1196[_0x8630('0x26')];}_0x439b33[_0x8630('0x17')](_0xf97e31)[_0x8630('0x27')](_0x2b1196);};}exports[_0x8630('0x28')]=function(_0xc18164,_0x4285ee){var _0xbb1a58={},_0x190216={},_0x2d3f0b={'count':0x0,'rows':[]};var _0x4d42c6=_[_0x8630('0x29')](db[_0x8630('0x2a')][_0x8630('0x2b')],function(_0xe3ed67){return{'name':_0xe3ed67['fieldName'],'type':_0xe3ed67[_0x8630('0x2c')][_0x8630('0x2d')]};});_0x190216[_0x8630('0x2e')]=_[_0x8630('0x29')](_0x4d42c6,_0x8630('0x26'));_0x190216[_0x8630('0x2f')]=_['keys'](_0xc18164[_0x8630('0x2f')]);_0x190216[_0x8630('0x30')]=_[_0x8630('0x31')](_0x190216['model'],_0x190216[_0x8630('0x2f')]);_0xbb1a58[_0x8630('0x32')]=_[_0x8630('0x31')](_0x190216[_0x8630('0x2e')],qs[_0x8630('0x33')](_0xc18164[_0x8630('0x2f')]['fields']));_0xbb1a58[_0x8630('0x32')]=_0xbb1a58[_0x8630('0x32')][_0x8630('0x34')]?_0xbb1a58[_0x8630('0x32')]:_0x190216[_0x8630('0x2e')];if(!_0xc18164[_0x8630('0x2f')][_0x8630('0x35')](_0x8630('0x36'))){_0xbb1a58[_0x8630('0x19')]=qs[_0x8630('0x19')](_0xc18164[_0x8630('0x2f')][_0x8630('0x19')]);_0xbb1a58[_0x8630('0x18')]=qs[_0x8630('0x18')](_0xc18164[_0x8630('0x2f')][_0x8630('0x18')]);}_0xbb1a58[_0x8630('0x37')]=qs['sort'](_0xc18164[_0x8630('0x2f')][_0x8630('0x38')]);_0xbb1a58['where']=qs['filters'](_[_0x8630('0x39')](_0xc18164[_0x8630('0x2f')],_0x190216[_0x8630('0x30')]),_0x4d42c6);if(_0xc18164[_0x8630('0x2f')][_0x8630('0x3a')]){_0xbb1a58['where']=_[_0x8630('0x3b')](_0xbb1a58[_0x8630('0x3c')],{'$or':_[_0x8630('0x29')](_0x4d42c6,function(_0x25c816){if(_0x25c816['type']!==_0x8630('0x3d')){var _0x437fde={};_0x437fde[_0x25c816[_0x8630('0x26')]]={'$like':'%'+_0xc18164[_0x8630('0x2f')][_0x8630('0x3a')]+'%'};return _0x437fde;}})});}_0xbb1a58=_[_0x8630('0x3b')]({},_0xbb1a58,_0xc18164[_0x8630('0x3e')]);var _0x58ba3a={'where':_0xbb1a58[_0x8630('0x3c')]};return db[_0x8630('0x2a')][_0x8630('0x1b')](_0x58ba3a)[_0x8630('0x20')](function(_0x225676){_0x2d3f0b[_0x8630('0x1b')]=_0x225676;if(_0xc18164[_0x8630('0x2f')][_0x8630('0x3f')]){_0xbb1a58[_0x8630('0x40')]=[{'all':!![]}];}return db[_0x8630('0x2a')]['findAll'](_0xbb1a58);})[_0x8630('0x20')](function(_0x53882a){_0x2d3f0b[_0x8630('0x41')]=_0x53882a;return _0x2d3f0b;})[_0x8630('0x20')](respondWithFilteredResult(_0x4285ee,_0xbb1a58))[_0x8630('0x42')](handleError(_0x4285ee,null));};exports[_0x8630('0x43')]=function(_0x193bae,_0x2f1fec){var _0x5bcf39={'raw':![],'where':{'id':_0x193bae[_0x8630('0x44')]['id']}},_0x1853e6={};_0x1853e6[_0x8630('0x2e')]=_['keys'](db[_0x8630('0x2a')][_0x8630('0x2b')]);_0x1853e6[_0x8630('0x2f')]=_[_0x8630('0x45')](_0x193bae[_0x8630('0x2f')]);_0x1853e6[_0x8630('0x30')]=_['intersection'](_0x1853e6[_0x8630('0x2e')],_0x1853e6[_0x8630('0x2f')]);_0x5bcf39[_0x8630('0x32')]=_['intersection'](_0x1853e6[_0x8630('0x2e')],qs[_0x8630('0x33')](_0x193bae['query'][_0x8630('0x33')]));_0x5bcf39[_0x8630('0x32')]=_0x5bcf39[_0x8630('0x32')]['length']?_0x5bcf39['attributes']:_0x1853e6[_0x8630('0x2e')];if(_0x193bae['query']['includeAll']){_0x5bcf39[_0x8630('0x40')]=[{'all':!![]}];}_0x5bcf39=_['merge']({},_0x5bcf39,_0x193bae[_0x8630('0x3e')]);return db[_0x8630('0x2a')]['find'](_0x5bcf39)[_0x8630('0x20')](handleEntityNotFound(_0x2f1fec,null))[_0x8630('0x20')](respondWithResult(_0x2f1fec,null))[_0x8630('0x42')](handleError(_0x2f1fec,null));};exports[_0x8630('0x46')]=function(_0x121e83,_0x4e82ec){return db[_0x8630('0x2a')][_0x8630('0x46')](_0x121e83['body'],{})[_0x8630('0x20')](respondWithResult(_0x4e82ec,0xc9))[_0x8630('0x42')](handleError(_0x4e82ec,null));};exports[_0x8630('0x1f')]=function(_0x47aa03,_0x1a4bf1){if(_0x47aa03[_0x8630('0x47')]['id']){delete _0x47aa03[_0x8630('0x47')]['id'];}return db[_0x8630('0x2a')][_0x8630('0x48')]({'where':{'id':_0x47aa03[_0x8630('0x44')]['id']}})[_0x8630('0x20')](handleEntityNotFound(_0x1a4bf1,null))[_0x8630('0x20')](saveUpdates(_0x47aa03[_0x8630('0x47')],null))['then'](respondWithResult(_0x1a4bf1,null))['catch'](handleError(_0x1a4bf1,null));};exports[_0x8630('0x21')]=function(_0x13326d,_0x34619c){return db[_0x8630('0x2a')][_0x8630('0x48')]({'where':{'id':_0x13326d[_0x8630('0x44')]['id']}})[_0x8630('0x20')](handleEntityNotFound(_0x34619c,null))['then'](removeEntity(_0x34619c,null))[_0x8630('0x42')](handleError(_0x34619c,null));};exports[_0x8630('0x49')]=function(_0x34e316,_0x16c286,_0x2b61c5){var _0x5b21ac={};var _0x398ea7={};var _0x23d5f7;var _0xeacec4;return db[_0x8630('0x2a')]['findOne']({'where':{'id':_0x34e316[_0x8630('0x44')]['id']}})[_0x8630('0x20')](handleEntityNotFound(_0x16c286,null))['then'](function(_0x2edc3d){if(_0x2edc3d){_0x23d5f7=_0x2edc3d;_0x398ea7[_0x8630('0x2e')]=_[_0x8630('0x45')](db[_0x8630('0x4a')]['rawAttributes']);_0x398ea7[_0x8630('0x2f')]=_[_0x8630('0x45')](_0x34e316['query']);_0x398ea7['filters']=_[_0x8630('0x31')](_0x398ea7[_0x8630('0x2e')],_0x398ea7['query']);_0x5b21ac[_0x8630('0x32')]=_['intersection'](_0x398ea7[_0x8630('0x2e')],qs[_0x8630('0x33')](_0x34e316[_0x8630('0x2f')]['fields']));_0x5b21ac[_0x8630('0x32')]=_0x5b21ac[_0x8630('0x32')][_0x8630('0x34')]?_0x5b21ac[_0x8630('0x32')]:_0x398ea7[_0x8630('0x2e')];_0x5b21ac[_0x8630('0x37')]=qs[_0x8630('0x38')](_0x34e316['query'][_0x8630('0x38')]);_0x5b21ac[_0x8630('0x3c')]=qs[_0x8630('0x30')](_['pick'](_0x34e316['query'],_0x398ea7[_0x8630('0x30')]));if(_0x34e316['query'][_0x8630('0x3a')]){_0x5b21ac[_0x8630('0x3c')]=_['merge'](_0x5b21ac[_0x8630('0x3c')],{'$or':_[_0x8630('0x29')](_0x5b21ac[_0x8630('0x32')],function(_0x2134f6){var _0x5aa640={};_0x5aa640[_0x2134f6]={'$like':'%'+_0x34e316[_0x8630('0x2f')][_0x8630('0x3a')]+'%'};return _0x5aa640;})});}_0x5b21ac=_[_0x8630('0x3b')]({},_0x5b21ac,_0x34e316['options']);return _0x23d5f7['getConfigurations'](_0x5b21ac);}})['then'](function(_0x3bf690){if(_0x3bf690){_0xeacec4=_0x3bf690[_0x8630('0x34')];if(!_0x34e316[_0x8630('0x2f')][_0x8630('0x35')](_0x8630('0x36'))){_0x5b21ac['limit']=qs[_0x8630('0x19')](_0x34e316[_0x8630('0x2f')][_0x8630('0x19')]);_0x5b21ac['offset']=qs['offset'](_0x34e316[_0x8630('0x2f')][_0x8630('0x18')]);}return _0x23d5f7['getConfigurations'](_0x5b21ac);}})[_0x8630('0x20')](function(_0x4fd5f5){if(_0x4fd5f5){return _0x4fd5f5?{'count':_0xeacec4,'rows':_0x4fd5f5}:null;}})[_0x8630('0x20')](respondWithResult(_0x16c286,null))[_0x8630('0x42')](handleError(_0x16c286,null));};exports[_0x8630('0x4b')]=function(_0x1fea4d,_0x166dff,_0x5eaae3){if(_0x1fea4d['body']['id']){delete _0x1fea4d['body']['id'];}return db[_0x8630('0x2a')][_0x8630('0x4c')]({'where':{'id':_0x1fea4d[_0x8630('0x44')]['id']}})[_0x8630('0x20')](handleEntityNotFound(_0x166dff,null))[_0x8630('0x20')](function(_0x189066){if(_0x189066){_0x1fea4d[_0x8630('0x47')][_0x8630('0x4d')]=_0x189066['id'];_0x1fea4d[_0x8630('0x47')][_0x8630('0x4e')]=integrations[_0x8630('0x4f')](_0x1fea4d[_0x8630('0x47')]['channel'],_0x1fea4d[_0x8630('0x47')]['type']);_0x1fea4d[_0x8630('0x47')][_0x8630('0x50')]=integrations[_0x8630('0x51')](_0x1fea4d[_0x8630('0x47')]['channel'],_0x1fea4d['body'][_0x8630('0x2c')]);return db[_0x8630('0x4a')][_0x8630('0x46')](_0x1fea4d['body'],{'include':[{'model':db[_0x8630('0x52')],'as':_0x8630('0x4e')},{'model':db['FreshdeskField'],'as':_0x8630('0x50')}]});}return null;})[_0x8630('0x20')](respondWithResult(_0x166dff,null))[_0x8630('0x42')](handleError(_0x166dff,null));};exports[_0x8630('0x53')]=function(_0x2304e6,_0x5b567b,_0x588d6e){var _0xa45700='';return db[_0x8630('0x2a')][_0x8630('0x4c')]({'where':{'id':_0x2304e6['params']['id']},'attributes':['id',_0x8630('0x54'),_0x8630('0x55')]})['then'](handleEntityNotFound(_0x5b567b,null))[_0x8630('0x20')](function(_0x1f5b06){if(_0x1f5b06){_0xa45700=_0x1f5b06[_0x8630('0x54')];var _0x2b8cb1=_0xa45700[_0x8630('0x56')](-0x1);if(_0x2b8cb1==='/'){_0xa45700=_0xa45700[_0x8630('0x57')](0x0,_0xa45700[_0x8630('0x58')](_0x2b8cb1));}return rp({'method':_0x8630('0x59'),'uri':util[_0x8630('0x5a')]('%s/%s',_0xa45700,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x8630('0x5a')](_0x8630('0x5b'),new Buffer(util[_0x8630('0x5a')]('%s:X',_0x1f5b06[_0x8630('0x55')]))['toString']('base64'))},'json':!![]});}})[_0x8630('0x20')](function(_0x38b894){if(_0x38b894){var _0x26611d=[_0x8630('0x5c'),'subject',_0x8630('0x5d'),_0x8630('0x5e'),_0x8630('0x17'),'priority',_0x8630('0x5f'),_0x8630('0x60'),_0x8630('0x61'),_0x8630('0x5f'),_0x8630('0x62')];_[_0x8630('0x63')](_0x38b894,function(_0x2b543a){return _0x26611d[_0x8630('0x64')](_0x2b543a[_0x8630('0x26')])||!_0x2b543a[_0x8630('0x65')]&&_0x2b543a['type']!==_0x8630('0x66')&&_0x2b543a[_0x8630('0x2c')]!==_0x8630('0x67');});return{'count':_0x38b894[_0x8630('0x34')],'rows':_[_0x8630('0x29')](_0x38b894,function(_0x548e16){return{'id':_0x548e16[_0x8630('0x26')],'name':_0x548e16[_0x8630('0x68')],'custom':!_0x548e16['default'],'options':_0x548e16[_0x8630('0x69')]?_['map'](_0x548e16[_0x8630('0x69')],function(_0xbfa84c){return{'name':_['capitalize'](_0xbfa84c),'value':_0xbfa84c};}):[]};})};}})['then'](respondWithResult(_0x5b567b,null))['catch'](function(_0x47b449){var _0x2cd150=_0x2304e6[_0x8630('0x2f')][_0x8630('0x6a')]?0x1f4:_0x47b449['statusCode']||0x1f4;logger[_0x8630('0x24')](_0x8630('0x6b'),'getFields',_0x2cd150,JSON['stringify'](_0x47b449));delete _0x47b449[_0x8630('0x26')];if(_0x2cd150===0x191){_0x2cd150=0x190;}_0x5b567b[_0x8630('0x17')](_0x2cd150)[_0x8630('0x27')](_0x2304e6['query'][_0x8630('0x6a')]?{'message':_0x8630('0x6c'),'statusCode':_0x47b449[_0x8630('0x6d')]}:_0x47b449);});}; \ No newline at end of file +var _0x6a55=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','Content-Range','apply','reject','destroy','then','status','error','stack','name','send','index','map','FreshdeskAccount','fieldName','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','includeAll','create','body','update','find','getConfigurations','findOne','FreshdeskConfiguration','filter','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','requester','subject','description','priority','group','source','ticket_type','company','remove','includes','default','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x508e4c,_0x2f1ea3){var _0x5058a2=function(_0x1bb30d){while(--_0x1bb30d){_0x508e4c['push'](_0x508e4c['shift']());}};_0x5058a2(++_0x2f1ea3);}(_0x6a55,0x154));var _0x56a5=function(_0x4a7193,_0x556c6a){_0x4a7193=_0x4a7193-0x0;var _0xc33d94=_0x6a55[_0x4a7193];return _0xc33d94;};'use strict';var emlformat=require(_0x56a5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x56a5('0x1'));var jsonpatch=require(_0x56a5('0x2'));var rp=require('request-promise');var moment=require(_0x56a5('0x3'));var BPromise=require(_0x56a5('0x4'));var Mustache=require(_0x56a5('0x5'));var util=require(_0x56a5('0x6'));var path=require(_0x56a5('0x7'));var sox=require(_0x56a5('0x8'));var csv=require(_0x56a5('0x9'));var ejs=require(_0x56a5('0xa'));var fs=require('fs');var fs_extra=require(_0x56a5('0xb'));var _=require(_0x56a5('0xc'));var squel=require(_0x56a5('0xd'));var crypto=require(_0x56a5('0xe'));var jsforce=require(_0x56a5('0xf'));var deskjs=require(_0x56a5('0x10'));var toCsv=require('to-csv');var querystring=require(_0x56a5('0x11'));var Papa=require(_0x56a5('0x12'));var Redis=require('ioredis');var authService=require(_0x56a5('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x56a5('0x14'));var logger=require(_0x56a5('0x15'))(_0x56a5('0x16'));var utils=require(_0x56a5('0x17'));var config=require(_0x56a5('0x18'));var licenseUtil=require(_0x56a5('0x19'));var db=require(_0x56a5('0x1a'))['db'];var integrations=require(_0x56a5('0x1b'));function respondWithStatusCode(_0x42dced,_0x5a80ed){_0x5a80ed=_0x5a80ed||0xcc;return function(_0x1a388c){if(_0x1a388c){return _0x42dced[_0x56a5('0x1c')](_0x5a80ed);}return _0x42dced['status'](_0x5a80ed)[_0x56a5('0x1d')]();};}function respondWithResult(_0x145174,_0x11f64d){_0x11f64d=_0x11f64d||0xc8;return function(_0x2e99f3){if(_0x2e99f3){return _0x145174['status'](_0x11f64d)[_0x56a5('0x1e')](_0x2e99f3);}};}function respondWithFilteredResult(_0xdfce42,_0x24cb7b){return function(_0x466f52){if(_0x466f52){var _0x1e06c9=typeof _0x24cb7b[_0x56a5('0x1f')]===_0x56a5('0x20')&&typeof _0x24cb7b[_0x56a5('0x21')]===_0x56a5('0x20');var _0x59ded0=_0x466f52['count'];var _0x217005=_0x1e06c9?0x0:_0x24cb7b['offset'];var _0x20f22a=_0x1e06c9?_0x466f52[_0x56a5('0x22')]:_0x24cb7b[_0x56a5('0x1f')]+_0x24cb7b[_0x56a5('0x21')];var _0x2f8585;if(_0x20f22a>=_0x59ded0){_0x20f22a=_0x59ded0;_0x2f8585=0xc8;}else{_0x2f8585=0xce;}_0xdfce42['status'](_0x2f8585);return _0xdfce42['set'](_0x56a5('0x23'),_0x217005+'-'+_0x20f22a+'/'+_0x59ded0)['json'](_0x466f52);}return null;};}function patchUpdates(_0x32b71f){return function(_0x5eaed8){try{jsonpatch[_0x56a5('0x24')](_0x5eaed8,_0x32b71f,!![]);}catch(_0x1bd05a){return BPromise[_0x56a5('0x25')](_0x1bd05a);}return _0x5eaed8['save']();};}function saveUpdates(_0x25eeb2,_0x5bdefb){return function(_0x1e0365){if(_0x1e0365){return _0x1e0365['update'](_0x25eeb2)['then'](function(_0x1228af){return _0x1228af;});}return null;};}function removeEntity(_0x488b2a,_0x2cc3c0){return function(_0x536d68){if(_0x536d68){return _0x536d68[_0x56a5('0x26')]()[_0x56a5('0x27')](function(){_0x488b2a[_0x56a5('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38b5e0,_0x2950f6){return function(_0x59158c){if(!_0x59158c){_0x38b5e0[_0x56a5('0x1c')](0x194);}return _0x59158c;};}function handleError(_0x3cb7ae,_0x3dfdaf){_0x3dfdaf=_0x3dfdaf||0x1f4;return function(_0x59ef96){logger[_0x56a5('0x29')](_0x59ef96[_0x56a5('0x2a')]);if(_0x59ef96['name']){delete _0x59ef96[_0x56a5('0x2b')];}_0x3cb7ae['status'](_0x3dfdaf)[_0x56a5('0x2c')](_0x59ef96);};}exports[_0x56a5('0x2d')]=function(_0x1355d6,_0xb1e9c5){var _0x263188={},_0x2de197={},_0x512a48={'count':0x0,'rows':[]};var _0x1ee1d7=_[_0x56a5('0x2e')](db[_0x56a5('0x2f')]['rawAttributes'],function(_0x38b761){return{'name':_0x38b761[_0x56a5('0x30')],'type':_0x38b761['type']['key']};});_0x2de197[_0x56a5('0x31')]=_[_0x56a5('0x2e')](_0x1ee1d7,_0x56a5('0x2b'));_0x2de197['query']=_[_0x56a5('0x32')](_0x1355d6['query']);_0x2de197[_0x56a5('0x33')]=_[_0x56a5('0x34')](_0x2de197[_0x56a5('0x31')],_0x2de197[_0x56a5('0x35')]);_0x263188[_0x56a5('0x36')]=_[_0x56a5('0x34')](_0x2de197['model'],qs['fields'](_0x1355d6[_0x56a5('0x35')][_0x56a5('0x37')]));_0x263188['attributes']=_0x263188[_0x56a5('0x36')][_0x56a5('0x38')]?_0x263188[_0x56a5('0x36')]:_0x2de197['model'];if(!_0x1355d6[_0x56a5('0x35')][_0x56a5('0x39')](_0x56a5('0x3a'))){_0x263188[_0x56a5('0x21')]=qs[_0x56a5('0x21')](_0x1355d6[_0x56a5('0x35')]['limit']);_0x263188[_0x56a5('0x1f')]=qs[_0x56a5('0x1f')](_0x1355d6['query'][_0x56a5('0x1f')]);}_0x263188[_0x56a5('0x3b')]=qs[_0x56a5('0x3c')](_0x1355d6[_0x56a5('0x35')]['sort']);_0x263188[_0x56a5('0x3d')]=qs[_0x56a5('0x33')](_[_0x56a5('0x3e')](_0x1355d6[_0x56a5('0x35')],_0x2de197[_0x56a5('0x33')]),_0x1ee1d7);if(_0x1355d6[_0x56a5('0x35')]['filter']){_0x263188['where']=_[_0x56a5('0x3f')](_0x263188[_0x56a5('0x3d')],{'$or':_[_0x56a5('0x2e')](_0x1ee1d7,function(_0x36f323){if(_0x36f323[_0x56a5('0x40')]!==_0x56a5('0x41')){var _0x49c7fb={};_0x49c7fb[_0x36f323[_0x56a5('0x2b')]]={'$like':'%'+_0x1355d6[_0x56a5('0x35')]['filter']+'%'};return _0x49c7fb;}})});}_0x263188=_['merge']({},_0x263188,_0x1355d6[_0x56a5('0x42')]);var _0x87be28={'where':_0x263188['where']};return db[_0x56a5('0x2f')][_0x56a5('0x22')](_0x87be28)['then'](function(_0x38d253){_0x512a48[_0x56a5('0x22')]=_0x38d253;if(_0x1355d6[_0x56a5('0x35')]['includeAll']){_0x263188[_0x56a5('0x43')]=[{'all':!![]}];}return db[_0x56a5('0x2f')]['findAll'](_0x263188);})[_0x56a5('0x27')](function(_0x4a4394){_0x512a48[_0x56a5('0x44')]=_0x4a4394;return _0x512a48;})['then'](respondWithFilteredResult(_0xb1e9c5,_0x263188))[_0x56a5('0x45')](handleError(_0xb1e9c5,null));};exports[_0x56a5('0x46')]=function(_0x4431f7,_0x5205b8){var _0x39ee9a={'raw':![],'where':{'id':_0x4431f7[_0x56a5('0x47')]['id']}},_0x5840c3={};_0x5840c3[_0x56a5('0x31')]=_[_0x56a5('0x32')](db[_0x56a5('0x2f')][_0x56a5('0x48')]);_0x5840c3[_0x56a5('0x35')]=_[_0x56a5('0x32')](_0x4431f7[_0x56a5('0x35')]);_0x5840c3['filters']=_[_0x56a5('0x34')](_0x5840c3[_0x56a5('0x31')],_0x5840c3['query']);_0x39ee9a[_0x56a5('0x36')]=_[_0x56a5('0x34')](_0x5840c3['model'],qs['fields'](_0x4431f7[_0x56a5('0x35')][_0x56a5('0x37')]));_0x39ee9a[_0x56a5('0x36')]=_0x39ee9a[_0x56a5('0x36')][_0x56a5('0x38')]?_0x39ee9a[_0x56a5('0x36')]:_0x5840c3['model'];if(_0x4431f7['query'][_0x56a5('0x49')]){_0x39ee9a[_0x56a5('0x43')]=[{'all':!![]}];}_0x39ee9a=_[_0x56a5('0x3f')]({},_0x39ee9a,_0x4431f7['options']);return db[_0x56a5('0x2f')]['find'](_0x39ee9a)[_0x56a5('0x27')](handleEntityNotFound(_0x5205b8,null))[_0x56a5('0x27')](respondWithResult(_0x5205b8,null))[_0x56a5('0x45')](handleError(_0x5205b8,null));};exports[_0x56a5('0x4a')]=function(_0x37faf5,_0x217e6b){return db[_0x56a5('0x2f')][_0x56a5('0x4a')](_0x37faf5[_0x56a5('0x4b')],{})['then'](respondWithResult(_0x217e6b,0xc9))[_0x56a5('0x45')](handleError(_0x217e6b,null));};exports[_0x56a5('0x4c')]=function(_0x5a8ba3,_0xdf5da8){if(_0x5a8ba3[_0x56a5('0x4b')]['id']){delete _0x5a8ba3[_0x56a5('0x4b')]['id'];}return db['FreshdeskAccount'][_0x56a5('0x4d')]({'where':{'id':_0x5a8ba3[_0x56a5('0x47')]['id']}})[_0x56a5('0x27')](handleEntityNotFound(_0xdf5da8,null))['then'](saveUpdates(_0x5a8ba3[_0x56a5('0x4b')],null))[_0x56a5('0x27')](respondWithResult(_0xdf5da8,null))[_0x56a5('0x45')](handleError(_0xdf5da8,null));};exports[_0x56a5('0x26')]=function(_0x2b5f2a,_0x158c41){return db[_0x56a5('0x2f')][_0x56a5('0x4d')]({'where':{'id':_0x2b5f2a[_0x56a5('0x47')]['id']}})[_0x56a5('0x27')](handleEntityNotFound(_0x158c41,null))[_0x56a5('0x27')](removeEntity(_0x158c41,null))[_0x56a5('0x45')](handleError(_0x158c41,null));};exports[_0x56a5('0x4e')]=function(_0xff01fa,_0x169bfe,_0x1a1ba9){var _0x5c3cca={};var _0x5f245f={};var _0x457e59;var _0xdc280;return db[_0x56a5('0x2f')][_0x56a5('0x4f')]({'where':{'id':_0xff01fa['params']['id']}})[_0x56a5('0x27')](handleEntityNotFound(_0x169bfe,null))[_0x56a5('0x27')](function(_0x24b4b7){if(_0x24b4b7){_0x457e59=_0x24b4b7;_0x5f245f[_0x56a5('0x31')]=_[_0x56a5('0x32')](db[_0x56a5('0x50')][_0x56a5('0x48')]);_0x5f245f[_0x56a5('0x35')]=_[_0x56a5('0x32')](_0xff01fa[_0x56a5('0x35')]);_0x5f245f[_0x56a5('0x33')]=_[_0x56a5('0x34')](_0x5f245f[_0x56a5('0x31')],_0x5f245f[_0x56a5('0x35')]);_0x5c3cca[_0x56a5('0x36')]=_[_0x56a5('0x34')](_0x5f245f[_0x56a5('0x31')],qs[_0x56a5('0x37')](_0xff01fa[_0x56a5('0x35')][_0x56a5('0x37')]));_0x5c3cca['attributes']=_0x5c3cca[_0x56a5('0x36')][_0x56a5('0x38')]?_0x5c3cca[_0x56a5('0x36')]:_0x5f245f['model'];_0x5c3cca[_0x56a5('0x3b')]=qs[_0x56a5('0x3c')](_0xff01fa['query']['sort']);_0x5c3cca[_0x56a5('0x3d')]=qs['filters'](_[_0x56a5('0x3e')](_0xff01fa[_0x56a5('0x35')],_0x5f245f[_0x56a5('0x33')]));if(_0xff01fa[_0x56a5('0x35')]['filter']){_0x5c3cca['where']=_[_0x56a5('0x3f')](_0x5c3cca[_0x56a5('0x3d')],{'$or':_['map'](_0x5c3cca['attributes'],function(_0x8bc846){var _0x5a1ca1={};_0x5a1ca1[_0x8bc846]={'$like':'%'+_0xff01fa[_0x56a5('0x35')][_0x56a5('0x51')]+'%'};return _0x5a1ca1;})});}_0x5c3cca=_[_0x56a5('0x3f')]({},_0x5c3cca,_0xff01fa[_0x56a5('0x42')]);return _0x457e59['getConfigurations'](_0x5c3cca);}})['then'](function(_0x218552){if(_0x218552){_0xdc280=_0x218552['length'];if(!_0xff01fa['query']['hasOwnProperty']('nolimit')){_0x5c3cca[_0x56a5('0x21')]=qs['limit'](_0xff01fa[_0x56a5('0x35')][_0x56a5('0x21')]);_0x5c3cca[_0x56a5('0x1f')]=qs[_0x56a5('0x1f')](_0xff01fa[_0x56a5('0x35')][_0x56a5('0x1f')]);}return _0x457e59[_0x56a5('0x4e')](_0x5c3cca);}})[_0x56a5('0x27')](function(_0x4d4a0a){if(_0x4d4a0a){return _0x4d4a0a?{'count':_0xdc280,'rows':_0x4d4a0a}:null;}})[_0x56a5('0x27')](respondWithResult(_0x169bfe,null))[_0x56a5('0x45')](handleError(_0x169bfe,null));};exports['addConfiguration']=function(_0x3e9f84,_0x1e8f8b,_0x5539f5){if(_0x3e9f84[_0x56a5('0x4b')]['id']){delete _0x3e9f84['body']['id'];}return db[_0x56a5('0x2f')][_0x56a5('0x4f')]({'where':{'id':_0x3e9f84[_0x56a5('0x47')]['id']}})[_0x56a5('0x27')](handleEntityNotFound(_0x1e8f8b,null))[_0x56a5('0x27')](function(_0x5e2245){if(_0x5e2245){_0x3e9f84[_0x56a5('0x4b')][_0x56a5('0x52')]=_0x5e2245['id'];_0x3e9f84['body'][_0x56a5('0x53')]=integrations[_0x56a5('0x54')](_0x3e9f84['body'][_0x56a5('0x55')],_0x3e9f84[_0x56a5('0x4b')][_0x56a5('0x40')]);_0x3e9f84[_0x56a5('0x4b')][_0x56a5('0x56')]=integrations[_0x56a5('0x57')](_0x3e9f84[_0x56a5('0x4b')][_0x56a5('0x55')],_0x3e9f84[_0x56a5('0x4b')][_0x56a5('0x40')]);return db[_0x56a5('0x50')][_0x56a5('0x4a')](_0x3e9f84[_0x56a5('0x4b')],{'include':[{'model':db[_0x56a5('0x58')],'as':'Subjects'},{'model':db[_0x56a5('0x58')],'as':_0x56a5('0x56')}]});}return null;})[_0x56a5('0x27')](respondWithResult(_0x1e8f8b,null))[_0x56a5('0x45')](handleError(_0x1e8f8b,null));};exports[_0x56a5('0x59')]=function(_0x3c216b,_0x422612,_0x5edeaf){var _0x101f95='';return db[_0x56a5('0x2f')][_0x56a5('0x4f')]({'where':{'id':_0x3c216b[_0x56a5('0x47')]['id']},'attributes':['id',_0x56a5('0x5a'),_0x56a5('0x5b')]})[_0x56a5('0x27')](handleEntityNotFound(_0x422612,null))[_0x56a5('0x27')](function(_0x1a72fc){if(_0x1a72fc){_0x101f95=_0x1a72fc['remoteUri'];var _0x1f4e70=_0x101f95[_0x56a5('0x5c')](-0x1);if(_0x1f4e70==='/'){_0x101f95=_0x101f95[_0x56a5('0x5d')](0x0,_0x101f95['lastIndexOf'](_0x1f4e70));}return rp({'method':_0x56a5('0x5e'),'uri':util['format'](_0x56a5('0x5f'),_0x101f95,_0x56a5('0x60')),'headers':{'Authorization':util[_0x56a5('0x61')](_0x56a5('0x62'),new Buffer(util[_0x56a5('0x61')](_0x56a5('0x63'),_0x1a72fc['apiKey']))[_0x56a5('0x64')]('base64'))},'json':!![]});}})[_0x56a5('0x27')](function(_0x15d493){if(_0x15d493){var _0x4726fd=[_0x56a5('0x65'),_0x56a5('0x66'),'agent',_0x56a5('0x67'),'status',_0x56a5('0x68'),_0x56a5('0x69'),_0x56a5('0x6a'),_0x56a5('0x6b'),_0x56a5('0x69'),_0x56a5('0x6c')];_[_0x56a5('0x6d')](_0x15d493,function(_0x54026e){return _0x4726fd[_0x56a5('0x6e')](_0x54026e[_0x56a5('0x2b')])||!_0x54026e[_0x56a5('0x6f')]&&_0x54026e['type']!=='custom_text'&&_0x54026e[_0x56a5('0x40')]!=='custom_dropdown';});return{'count':_0x15d493[_0x56a5('0x38')],'rows':_['map'](_0x15d493,function(_0x148623){return{'id':_0x148623[_0x56a5('0x2b')],'name':_0x148623['label'],'custom':!_0x148623[_0x56a5('0x6f')],'options':_0x148623[_0x56a5('0x70')]?_[_0x56a5('0x2e')](_0x148623['choices'],function(_0x3fb755){return{'name':_[_0x56a5('0x71')](_0x3fb755),'value':_0x3fb755};}):[]};})};}})[_0x56a5('0x27')](respondWithResult(_0x422612,null))[_0x56a5('0x45')](function(_0x2b31e3){var _0x111ef2=_0x3c216b[_0x56a5('0x35')][_0x56a5('0x72')]?0x1f4:_0x2b31e3[_0x56a5('0x73')]||0x1f4;logger[_0x56a5('0x29')](_0x56a5('0x74'),_0x56a5('0x59'),_0x111ef2,JSON['stringify'](_0x2b31e3));delete _0x2b31e3[_0x56a5('0x2b')];if(_0x111ef2===0x191){_0x111ef2=0x190;}_0x422612[_0x56a5('0x28')](_0x111ef2)[_0x56a5('0x2c')](_0x3c216b['query'][_0x56a5('0x72')]?{'message':_0x56a5('0x75'),'statusCode':_0x2b31e3['statusCode']}:_0x2b31e3);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 5fcd3a8..98866db 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 _0x8ce6=['define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x38ef85,_0x317bcc){var _0x1ffa8d=function(_0x5069b0){while(--_0x5069b0){_0x38ef85['push'](_0x38ef85['shift']());}};_0x1ffa8d(++_0x317bcc);}(_0x8ce6,0xf1));var _0x68ce=function(_0x1a34b9,_0x289010){_0x1a34b9=_0x1a34b9-0x0;var _0x44bce9=_0x8ce6[_0x1a34b9];return _0x44bce9;};'use strict';var _=require(_0x68ce('0x0'));var util=require(_0x68ce('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x68ce('0x2'));var BPromise=require(_0x68ce('0x3'));var rp=require(_0x68ce('0x4'));var fs=require('fs');var path=require(_0x68ce('0x5'));var rimraf=require(_0x68ce('0x6'));var config=require(_0x68ce('0x7'));var attributes=require(_0x68ce('0x8'));var integrations=require(_0x68ce('0x9'));module[_0x68ce('0xa')]=function(_0x45837d,_0x4f57eb){return _0x45837d[_0x68ce('0xb')](_0x68ce('0xc'),attributes,{'tableName':_0x68ce('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b69=['bluebird','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api'];(function(_0x4ec3a2,_0x57c069){var _0x1cb8cc=function(_0xffed4e){while(--_0xffed4e){_0x4ec3a2['push'](_0x4ec3a2['shift']());}};_0x1cb8cc(++_0x57c069);}(_0x4b69,0xf8));var _0x94b6=function(_0x77a933,_0x1cdd24){_0x77a933=_0x77a933-0x0;var _0x9df572=_0x4b69[_0x77a933];return _0x9df572;};'use strict';var _=require(_0x94b6('0x0'));var util=require(_0x94b6('0x1'));var logger=require(_0x94b6('0x2'))(_0x94b6('0x3'));var moment=require('moment');var BPromise=require(_0x94b6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x94b6('0x5'));var rimraf=require(_0x94b6('0x6'));var config=require(_0x94b6('0x7'));var attributes=require(_0x94b6('0x8'));var integrations=require(_0x94b6('0x9'));module[_0x94b6('0xa')]=function(_0x5d7a51,_0x481811){return _0x5d7a51[_0x94b6('0xb')](_0x94b6('0xc'),attributes,{'tableName':_0x94b6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index cdcc020..cf2e4fb 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 _0xf282=['stringify','error','message','result','GetFreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','ShowFreshdeskAccount','FreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x1f2d5e,_0x3957e0){var _0x19207f=function(_0x1cde48){while(--_0x1cde48){_0x1f2d5e['push'](_0x1f2d5e['shift']());}};_0x19207f(++_0x3957e0);}(_0xf282,0x85));var _0x2f28=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xf282[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x2f28('0x0'));var util=require(_0x2f28('0x1'));var moment=require(_0x2f28('0x2'));var BPromise=require(_0x2f28('0x3'));var rs=require(_0x2f28('0x4'));var fs=require('fs');var Redis=require(_0x2f28('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f28('0x6'));var logger=require(_0x2f28('0x7'))(_0x2f28('0x8'));var config=require(_0x2f28('0x9'));var jayson=require(_0x2f28('0xa'));var client=jayson[_0x2f28('0xb')][_0x2f28('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59c539,_0x1067c0,_0x2e7a0a){return new BPromise(function(_0x4ce819,_0x1148ea){return client[_0x2f28('0xd')](_0x59c539,_0x2e7a0a)['then'](function(_0x2d08bc){logger[_0x2f28('0xe')](_0x2f28('0xf'),_0x1067c0,_0x2f28('0x10'));logger[_0x2f28('0x11')](_0x2f28('0x12'),_0x1067c0,_0x2f28('0x10'),JSON[_0x2f28('0x13')](_0x2d08bc));if(_0x2d08bc['error']){if(_0x2d08bc[_0x2f28('0x14')]['code']===0x1f4){logger[_0x2f28('0x14')](_0x2f28('0xf'),_0x1067c0,_0x2d08bc[_0x2f28('0x14')][_0x2f28('0x15')]);return _0x1148ea(_0x2d08bc[_0x2f28('0x14')][_0x2f28('0x15')]);}logger[_0x2f28('0x14')](_0x2f28('0xf'),_0x1067c0,_0x2d08bc[_0x2f28('0x14')]['message']);return _0x4ce819(_0x2d08bc['error'][_0x2f28('0x15')]);}else{logger['info'](_0x2f28('0xf'),_0x1067c0,_0x2f28('0x10'));_0x4ce819(_0x2d08bc[_0x2f28('0x16')][_0x2f28('0x15')]);}})['catch'](function(_0x2c8abc){logger[_0x2f28('0x14')](_0x2f28('0xf'),_0x1067c0,_0x2c8abc);_0x1148ea(_0x2c8abc);});});}exports[_0x2f28('0x17')]=function(_0x6aa7b5){var _0x3170ae=this;return new Promise(function(_0x20abf2,_0x251aea){return db['FreshdeskAccount'][_0x2f28('0x18')]({'raw':_0x6aa7b5[_0x2f28('0x19')]?_0x6aa7b5[_0x2f28('0x19')][_0x2f28('0x1a')]===undefined?!![]:![]:!![],'where':_0x6aa7b5[_0x2f28('0x19')]?_0x6aa7b5[_0x2f28('0x19')][_0x2f28('0x1b')]||null:null,'attributes':_0x6aa7b5[_0x2f28('0x19')]?_0x6aa7b5[_0x2f28('0x19')][_0x2f28('0x1c')]||null:null,'limit':_0x6aa7b5[_0x2f28('0x19')]?_0x6aa7b5[_0x2f28('0x19')][_0x2f28('0x1d')]||null:null,'include':_0x6aa7b5['options']?_0x6aa7b5[_0x2f28('0x19')][_0x2f28('0x1e')]?_[_0x2f28('0x1f')](_0x6aa7b5[_0x2f28('0x19')][_0x2f28('0x1e')],function(_0x13b035){return{'model':db[_0x13b035[_0x2f28('0x20')]],'as':_0x13b035['as'],'attributes':_0x13b035[_0x2f28('0x1c')],'include':_0x13b035[_0x2f28('0x1e')]?_[_0x2f28('0x1f')](_0x13b035['include'],function(_0x5ed7f8){return{'model':db[_0x5ed7f8[_0x2f28('0x20')]],'as':_0x5ed7f8['as'],'attributes':_0x5ed7f8[_0x2f28('0x1c')],'include':_0x5ed7f8[_0x2f28('0x1e')]?_[_0x2f28('0x1f')](_0x5ed7f8[_0x2f28('0x1e')],function(_0x148c97){return{'model':db[_0x148c97[_0x2f28('0x20')]],'as':_0x148c97['as'],'attributes':_0x148c97[_0x2f28('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2f28('0x21')](function(_0x8ec111){logger[_0x2f28('0xe')](_0x2f28('0x17'),_0x6aa7b5);logger[_0x2f28('0x11')](_0x2f28('0x17'),_0x6aa7b5,JSON[_0x2f28('0x13')](_0x8ec111));_0x20abf2(_0x8ec111);})[_0x2f28('0x22')](function(_0x212e99){logger[_0x2f28('0x14')](_0x2f28('0x17'),_0x212e99[_0x2f28('0x15')],_0x6aa7b5);_0x251aea(_0x3170ae[_0x2f28('0x14')](0x1f4,_0x212e99[_0x2f28('0x15')]));});});};exports[_0x2f28('0x23')]=function(_0x2f3010){var _0x4116d6=this;return new Promise(function(_0x1b005b,_0x5b43a3){return db[_0x2f28('0x24')][_0x2f28('0x25')]({'raw':_0x2f3010['options']?_0x2f3010[_0x2f28('0x19')][_0x2f28('0x1a')]===undefined?!![]:![]:!![],'where':_0x2f3010[_0x2f28('0x19')]?_0x2f3010['options'][_0x2f28('0x1b')]||null:null,'attributes':_0x2f3010[_0x2f28('0x19')]?_0x2f3010['options'][_0x2f28('0x1c')]||null:null,'include':_0x2f3010[_0x2f28('0x19')]?_0x2f3010[_0x2f28('0x19')]['include']?_[_0x2f28('0x1f')](_0x2f3010[_0x2f28('0x19')][_0x2f28('0x1e')],function(_0x33573b){return{'model':db[_0x33573b[_0x2f28('0x20')]],'as':_0x33573b['as'],'attributes':_0x33573b[_0x2f28('0x1c')],'include':_0x33573b[_0x2f28('0x1e')]?_[_0x2f28('0x1f')](_0x33573b[_0x2f28('0x1e')],function(_0x155437){return{'model':db[_0x155437[_0x2f28('0x20')]],'as':_0x155437['as'],'attributes':_0x155437['attributes'],'include':_0x155437[_0x2f28('0x1e')]?_[_0x2f28('0x1f')](_0x155437[_0x2f28('0x1e')],function(_0x45188b){return{'model':db[_0x45188b[_0x2f28('0x20')]],'as':_0x45188b['as'],'attributes':_0x45188b['attributes']};}):[]};}):[]};}):[]:[]})[_0x2f28('0x21')](function(_0x491664){logger[_0x2f28('0xe')]('ShowFreshdeskAccount',_0x2f3010);logger[_0x2f28('0x11')](_0x2f28('0x23'),_0x2f3010,JSON[_0x2f28('0x13')](_0x491664));_0x1b005b(_0x491664);})[_0x2f28('0x22')](function(_0x1fa692){logger[_0x2f28('0x14')]('ShowFreshdeskAccount',_0x1fa692[_0x2f28('0x15')],_0x2f3010);_0x5b43a3(_0x4116d6[_0x2f28('0x14')](0x1f4,_0x1fa692[_0x2f28('0x15')]));});});}; \ No newline at end of file +var _0xf473=['find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshdeskAccount,\x20%s,\x20%s','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','include','map','model','attributes','then','ShowFreshdeskAccount'];(function(_0x28a131,_0x5dced4){var _0x47fb6b=function(_0x3450be){while(--_0x3450be){_0x28a131['push'](_0x28a131['shift']());}};_0x47fb6b(++_0x5dced4);}(_0xf473,0xda));var _0x3f47=function(_0x15df1b,_0x39ea33){_0x15df1b=_0x15df1b-0x0;var _0x3a3cfc=_0xf473[_0x15df1b];return _0x3a3cfc;};'use strict';var _=require(_0x3f47('0x0'));var util=require(_0x3f47('0x1'));var moment=require(_0x3f47('0x2'));var BPromise=require(_0x3f47('0x3'));var rs=require(_0x3f47('0x4'));var fs=require('fs');var Redis=require(_0x3f47('0x5'));var db=require(_0x3f47('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3f47('0x7'))(_0x3f47('0x8'));var config=require(_0x3f47('0x9'));var jayson=require(_0x3f47('0xa'));var client=jayson[_0x3f47('0xb')][_0x3f47('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c8959,_0x1af408,_0x40ed14){return new BPromise(function(_0x57169c,_0x2d08a7){return client['request'](_0x3c8959,_0x40ed14)['then'](function(_0x11931b){logger[_0x3f47('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x1af408,_0x3f47('0xe'));logger[_0x3f47('0xf')](_0x3f47('0x10'),_0x1af408,_0x3f47('0xe'),JSON[_0x3f47('0x11')](_0x11931b));if(_0x11931b[_0x3f47('0x12')]){if(_0x11931b[_0x3f47('0x12')]['code']===0x1f4){logger[_0x3f47('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x1af408,_0x11931b[_0x3f47('0x12')][_0x3f47('0x13')]);return _0x2d08a7(_0x11931b['error'][_0x3f47('0x13')]);}logger[_0x3f47('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x1af408,_0x11931b[_0x3f47('0x12')]['message']);return _0x57169c(_0x11931b['error'][_0x3f47('0x13')]);}else{logger[_0x3f47('0xd')](_0x3f47('0x14'),_0x1af408,_0x3f47('0xe'));_0x57169c(_0x11931b[_0x3f47('0x15')][_0x3f47('0x13')]);}})[_0x3f47('0x16')](function(_0xcd78ea){logger[_0x3f47('0x12')](_0x3f47('0x14'),_0x1af408,_0xcd78ea);_0x2d08a7(_0xcd78ea);});});}exports[_0x3f47('0x17')]=function(_0x3353e5){var _0x321651=this;return new Promise(function(_0x1a696a,_0x3f788b){return db[_0x3f47('0x18')][_0x3f47('0x19')]({'raw':_0x3353e5[_0x3f47('0x1a')]?_0x3353e5['options']['raw']===undefined?!![]:![]:!![],'where':_0x3353e5['options']?_0x3353e5[_0x3f47('0x1a')][_0x3f47('0x1b')]||null:null,'attributes':_0x3353e5['options']?_0x3353e5['options']['attributes']||null:null,'limit':_0x3353e5[_0x3f47('0x1a')]?_0x3353e5[_0x3f47('0x1a')]['limit']||null:null,'include':_0x3353e5[_0x3f47('0x1a')]?_0x3353e5['options'][_0x3f47('0x1c')]?_[_0x3f47('0x1d')](_0x3353e5[_0x3f47('0x1a')][_0x3f47('0x1c')],function(_0x1ce973){return{'model':db[_0x1ce973[_0x3f47('0x1e')]],'as':_0x1ce973['as'],'attributes':_0x1ce973[_0x3f47('0x1f')],'include':_0x1ce973['include']?_['map'](_0x1ce973[_0x3f47('0x1c')],function(_0x240a7f){return{'model':db[_0x240a7f['model']],'as':_0x240a7f['as'],'attributes':_0x240a7f[_0x3f47('0x1f')],'include':_0x240a7f[_0x3f47('0x1c')]?_[_0x3f47('0x1d')](_0x240a7f[_0x3f47('0x1c')],function(_0x4a64ac){return{'model':db[_0x4a64ac['model']],'as':_0x4a64ac['as'],'attributes':_0x4a64ac['attributes']};}):[]};}):[]};}):[]:[]})[_0x3f47('0x20')](function(_0x15a57b){logger[_0x3f47('0xd')](_0x3f47('0x17'),_0x3353e5);logger[_0x3f47('0xf')](_0x3f47('0x17'),_0x3353e5,JSON[_0x3f47('0x11')](_0x15a57b));_0x1a696a(_0x15a57b);})[_0x3f47('0x16')](function(_0x260534){logger[_0x3f47('0x12')](_0x3f47('0x17'),_0x260534[_0x3f47('0x13')],_0x3353e5);_0x3f788b(_0x321651[_0x3f47('0x12')](0x1f4,_0x260534[_0x3f47('0x13')]));});});};exports[_0x3f47('0x21')]=function(_0x4018eb){var _0x485dae=this;return new Promise(function(_0x38ce54,_0x402630){return db['FreshdeskAccount'][_0x3f47('0x22')]({'raw':_0x4018eb[_0x3f47('0x1a')]?_0x4018eb[_0x3f47('0x1a')][_0x3f47('0x23')]===undefined?!![]:![]:!![],'where':_0x4018eb['options']?_0x4018eb[_0x3f47('0x1a')][_0x3f47('0x1b')]||null:null,'attributes':_0x4018eb[_0x3f47('0x1a')]?_0x4018eb[_0x3f47('0x1a')]['attributes']||null:null,'include':_0x4018eb['options']?_0x4018eb['options'][_0x3f47('0x1c')]?_[_0x3f47('0x1d')](_0x4018eb['options'][_0x3f47('0x1c')],function(_0x28e4df){return{'model':db[_0x28e4df['model']],'as':_0x28e4df['as'],'attributes':_0x28e4df[_0x3f47('0x1f')],'include':_0x28e4df[_0x3f47('0x1c')]?_[_0x3f47('0x1d')](_0x28e4df[_0x3f47('0x1c')],function(_0x4e64ba){return{'model':db[_0x4e64ba['model']],'as':_0x4e64ba['as'],'attributes':_0x4e64ba[_0x3f47('0x1f')],'include':_0x4e64ba['include']?_[_0x3f47('0x1d')](_0x4e64ba[_0x3f47('0x1c')],function(_0x1f5456){return{'model':db[_0x1f5456[_0x3f47('0x1e')]],'as':_0x1f5456['as'],'attributes':_0x1f5456[_0x3f47('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23bef3){logger['info']('ShowFreshdeskAccount',_0x4018eb);logger[_0x3f47('0xf')]('ShowFreshdeskAccount',_0x4018eb,JSON[_0x3f47('0x11')](_0x23bef3));_0x38ce54(_0x23bef3);})[_0x3f47('0x16')](function(_0x3d7317){logger['error'](_0x3f47('0x21'),_0x3d7317[_0x3f47('0x13')],_0x4018eb);_0x402630(_0x485dae[_0x3f47('0x12')](0x1f4,_0x3d7317['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 756c1e8..2255d9d 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 _0xfdd4=['getDescriptions','/:id/tags','getTags','post','create','setTags','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','/:id','isAuthenticated','show','getFields','/:id/subjects','/:id/descriptions'];(function(_0x1c76f3,_0x13807c){var _0x3d11e2=function(_0x14fdd1){while(--_0x14fdd1){_0x1c76f3['push'](_0x1c76f3['shift']());}};_0x3d11e2(++_0x13807c);}(_0xfdd4,0x91));var _0x4fdd=function(_0x243481,_0x33ba56){_0x243481=_0x243481-0x0;var _0x3c7a5c=_0xfdd4[_0x243481];return _0x3c7a5c;};'use strict';var multer=require(_0x4fdd('0x0'));var util=require(_0x4fdd('0x1'));var path=require('path');var timeout=require(_0x4fdd('0x2'));var express=require(_0x4fdd('0x3'));var router=express[_0x4fdd('0x4')]();var fs_extra=require(_0x4fdd('0x5'));var auth=require(_0x4fdd('0x6'));var interaction=require(_0x4fdd('0x7'));var config=require(_0x4fdd('0x8'));var controller=require(_0x4fdd('0x9'));router[_0x4fdd('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4fdd('0xa')](_0x4fdd('0xb'),auth[_0x4fdd('0xc')](),controller[_0x4fdd('0xd')]);router['get']('/:id/fields',auth[_0x4fdd('0xc')](),controller[_0x4fdd('0xe')]);router[_0x4fdd('0xa')](_0x4fdd('0xf'),auth[_0x4fdd('0xc')](),controller['getSubjects']);router[_0x4fdd('0xa')](_0x4fdd('0x10'),auth['isAuthenticated'](),controller[_0x4fdd('0x11')]);router[_0x4fdd('0xa')](_0x4fdd('0x12'),auth['isAuthenticated'](),controller[_0x4fdd('0x13')]);router[_0x4fdd('0x14')]('/',auth['isAuthenticated'](),controller[_0x4fdd('0x15')]);router[_0x4fdd('0x14')]('/:id/tags',auth[_0x4fdd('0xc')](),controller[_0x4fdd('0x16')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4fdd('0x17')]);router[_0x4fdd('0x18')](_0x4fdd('0xb'),auth[_0x4fdd('0xc')](),controller[_0x4fdd('0x19')]);module[_0x4fdd('0x1a')]=router; \ No newline at end of file +var _0xece0=['getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id/fields','/:id/subjects','getSubjects'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xece0,0x144));var _0x0ece=function(_0x57d71f,_0x598a0e){_0x57d71f=_0x57d71f-0x0;var _0x2d1d26=_0xece0[_0x57d71f];return _0x2d1d26;};'use strict';var multer=require(_0x0ece('0x0'));var util=require('util');var path=require(_0x0ece('0x1'));var timeout=require('connect-timeout');var express=require(_0x0ece('0x2'));var router=express['Router']();var fs_extra=require(_0x0ece('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0ece('0x4'));var config=require(_0x0ece('0x5'));var controller=require(_0x0ece('0x6'));router[_0x0ece('0x7')]('/',auth[_0x0ece('0x8')](),controller['index']);router[_0x0ece('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0ece('0x7')](_0x0ece('0x9'),auth[_0x0ece('0x8')](),controller['getFields']);router['get'](_0x0ece('0xa'),auth[_0x0ece('0x8')](),controller[_0x0ece('0xb')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x0ece('0xc')]);router[_0x0ece('0x7')](_0x0ece('0xd'),auth[_0x0ece('0x8')](),controller[_0x0ece('0xe')]);router[_0x0ece('0xf')]('/',auth[_0x0ece('0x8')](),controller[_0x0ece('0x10')]);router[_0x0ece('0xf')]('/:id/tags',auth[_0x0ece('0x8')](),controller[_0x0ece('0x11')]);router[_0x0ece('0x12')](_0x0ece('0x13'),auth[_0x0ece('0x8')](),controller[_0x0ece('0x14')]);router[_0x0ece('0x15')](_0x0ece('0x13'),auth['isAuthenticated'](),controller[_0x0ece('0x16')]);module[_0x0ece('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 5be31d1..d0e856c 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 _0x6cb4=['STRING','exports'];(function(_0x4e4ad9,_0x143864){var _0x1d4661=function(_0x118571){while(--_0x118571){_0x4e4ad9['push'](_0x4e4ad9['shift']());}};_0x1d4661(++_0x143864);}(_0x6cb4,0x1a5));var _0x46cb=function(_0x3d57f8,_0x4e7dc1){_0x3d57f8=_0x3d57f8-0x0;var _0x33b1da=_0x6cb4[_0x3d57f8];return _0x33b1da;};'use strict';var Sequelize=require('sequelize');module[_0x46cb('0x0')]={'name':{'type':Sequelize[_0x46cb('0x1')]},'description':{'type':Sequelize[_0x46cb('0x1')]}}; \ No newline at end of file +var _0x2330=['exports'];(function(_0x46dab8,_0x4ef8ed){var _0x3d1e3a=function(_0x4579fe){while(--_0x4579fe){_0x46dab8['push'](_0x46dab8['shift']());}};_0x3d1e3a(++_0x4ef8ed);}(_0x2330,0x129));var _0x0233=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x2330[_0x2aec52];return _0x3b8835;};'use strict';var Sequelize=require('sequelize');module[_0x0233('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 650e2bb..80cde79 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 _0x4d9f=['squel','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','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','FreshdeskConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','include','findAll','show','params','includeAll','options','find','catch','create','body','getFields','FreshdeskField','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash'];(function(_0x3aeb9b,_0x3f3ff2){var _0x5e318f=function(_0x47e3e8){while(--_0x47e3e8){_0x3aeb9b['push'](_0x3aeb9b['shift']());}};_0x5e318f(++_0x3f3ff2);}(_0x4d9f,0x199));var _0xf4d9=function(_0x593557,_0x17d8e3){_0x593557=_0x593557-0x0;var _0x2db0ef=_0x4d9f[_0x593557];return _0x2db0ef;};'use strict';var emlformat=require(_0xf4d9('0x0'));var rimraf=require(_0xf4d9('0x1'));var zipdir=require(_0xf4d9('0x2'));var jsonpatch=require(_0xf4d9('0x3'));var rp=require(_0xf4d9('0x4'));var moment=require('moment');var BPromise=require(_0xf4d9('0x5'));var Mustache=require(_0xf4d9('0x6'));var util=require('util');var path=require(_0xf4d9('0x7'));var sox=require('sox');var csv=require(_0xf4d9('0x8'));var ejs=require(_0xf4d9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf4d9('0xa'));var squel=require(_0xf4d9('0xb'));var crypto=require(_0xf4d9('0xc'));var jsforce=require(_0xf4d9('0xd'));var deskjs=require(_0xf4d9('0xe'));var toCsv=require(_0xf4d9('0x8'));var querystring=require(_0xf4d9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf4d9('0x10'));var qs=require(_0xf4d9('0x11'));var as=require(_0xf4d9('0x12'));var hardwareService=require(_0xf4d9('0x13'));var logger=require(_0xf4d9('0x14'))('api');var utils=require(_0xf4d9('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf4d9('0x16'));var db=require(_0xf4d9('0x17'))['db'];function respondWithStatusCode(_0x1988e4,_0x4c9d9b){_0x4c9d9b=_0x4c9d9b||0xcc;return function(_0x40f2b0){if(_0x40f2b0){return _0x1988e4[_0xf4d9('0x18')](_0x4c9d9b);}return _0x1988e4[_0xf4d9('0x19')](_0x4c9d9b)[_0xf4d9('0x1a')]();};}function respondWithResult(_0x4efdfc,_0xb9c1c8){_0xb9c1c8=_0xb9c1c8||0xc8;return function(_0x115c32){if(_0x115c32){return _0x4efdfc[_0xf4d9('0x19')](_0xb9c1c8)[_0xf4d9('0x1b')](_0x115c32);}};}function respondWithFilteredResult(_0x50007c,_0x44a955){return function(_0x54ae3c){if(_0x54ae3c){var _0x21bdd2=typeof _0x44a955['offset']==='undefined'&&typeof _0x44a955[_0xf4d9('0x1c')]==='undefined';var _0x420dbd=_0x54ae3c[_0xf4d9('0x1d')];var _0xe47a21=_0x21bdd2?0x0:_0x44a955[_0xf4d9('0x1e')];var _0x24a36e=_0x21bdd2?_0x54ae3c[_0xf4d9('0x1d')]:_0x44a955[_0xf4d9('0x1e')]+_0x44a955[_0xf4d9('0x1c')];var _0x32c0fb;if(_0x24a36e>=_0x420dbd){_0x24a36e=_0x420dbd;_0x32c0fb=0xc8;}else{_0x32c0fb=0xce;}_0x50007c['status'](_0x32c0fb);return _0x50007c['set'](_0xf4d9('0x1f'),_0xe47a21+'-'+_0x24a36e+'/'+_0x420dbd)[_0xf4d9('0x1b')](_0x54ae3c);}return null;};}function patchUpdates(_0x597585){return function(_0x3653fb){try{jsonpatch[_0xf4d9('0x20')](_0x3653fb,_0x597585,!![]);}catch(_0x283c43){return BPromise[_0xf4d9('0x21')](_0x283c43);}return _0x3653fb[_0xf4d9('0x22')]();};}function saveUpdates(_0x5057b2,_0x122c5c){return function(_0x4f820d){if(_0x4f820d){return _0x4f820d[_0xf4d9('0x23')](_0x5057b2)[_0xf4d9('0x24')](function(_0x4fcb9e){return _0x4fcb9e;});}return null;};}function removeEntity(_0x433f47,_0x5176bc){return function(_0x3b26f0){if(_0x3b26f0){return _0x3b26f0['destroy']()['then'](function(){_0x433f47[_0xf4d9('0x19')](0xcc)[_0xf4d9('0x1a')]();});}};}function handleEntityNotFound(_0x3a0312,_0x30a8e0){return function(_0x1a8ec6){if(!_0x1a8ec6){_0x3a0312[_0xf4d9('0x18')](0x194);}return _0x1a8ec6;};}function handleError(_0x26cf10,_0x168314){_0x168314=_0x168314||0x1f4;return function(_0x5719c8){logger[_0xf4d9('0x25')](_0x5719c8[_0xf4d9('0x26')]);if(_0x5719c8[_0xf4d9('0x27')]){delete _0x5719c8[_0xf4d9('0x27')];}_0x26cf10[_0xf4d9('0x19')](_0x168314)[_0xf4d9('0x28')](_0x5719c8);};}exports[_0xf4d9('0x29')]=function(_0x71ce40,_0x12aa2b){var _0x44d1db={},_0x178549={},_0x139c93={'count':0x0,'rows':[]};var _0x10ffe9=_['map'](db[_0xf4d9('0x2a')][_0xf4d9('0x2b')],function(_0x501980){return{'name':_0x501980[_0xf4d9('0x2c')],'type':_0x501980['type'][_0xf4d9('0x2d')]};});_0x178549[_0xf4d9('0x2e')]=_[_0xf4d9('0x2f')](_0x10ffe9,_0xf4d9('0x27'));_0x178549[_0xf4d9('0x30')]=_[_0xf4d9('0x31')](_0x71ce40[_0xf4d9('0x30')]);_0x178549[_0xf4d9('0x32')]=_[_0xf4d9('0x33')](_0x178549[_0xf4d9('0x2e')],_0x178549[_0xf4d9('0x30')]);_0x44d1db['attributes']=_[_0xf4d9('0x33')](_0x178549[_0xf4d9('0x2e')],qs[_0xf4d9('0x34')](_0x71ce40[_0xf4d9('0x30')]['fields']));_0x44d1db[_0xf4d9('0x35')]=_0x44d1db[_0xf4d9('0x35')][_0xf4d9('0x36')]?_0x44d1db[_0xf4d9('0x35')]:_0x178549[_0xf4d9('0x2e')];if(!_0x71ce40['query'][_0xf4d9('0x37')](_0xf4d9('0x38'))){_0x44d1db[_0xf4d9('0x1c')]=qs['limit'](_0x71ce40[_0xf4d9('0x30')][_0xf4d9('0x1c')]);_0x44d1db[_0xf4d9('0x1e')]=qs[_0xf4d9('0x1e')](_0x71ce40[_0xf4d9('0x30')][_0xf4d9('0x1e')]);}_0x44d1db[_0xf4d9('0x39')]=qs['sort'](_0x71ce40['query'][_0xf4d9('0x3a')]);_0x44d1db[_0xf4d9('0x3b')]=qs[_0xf4d9('0x32')](_[_0xf4d9('0x3c')](_0x71ce40[_0xf4d9('0x30')],_0x178549[_0xf4d9('0x32')]),_0x10ffe9);if(_0x71ce40[_0xf4d9('0x30')]['filter']){_0x44d1db[_0xf4d9('0x3b')]=_[_0xf4d9('0x3d')](_0x44d1db['where'],{'$or':_[_0xf4d9('0x2f')](_0x10ffe9,function(_0x4d0ce5){if(_0x4d0ce5[_0xf4d9('0x3e')]!==_0xf4d9('0x3f')){var _0xfafc8c={};_0xfafc8c[_0x4d0ce5[_0xf4d9('0x27')]]={'$like':'%'+_0x71ce40[_0xf4d9('0x30')][_0xf4d9('0x40')]+'%'};return _0xfafc8c;}})});}_0x44d1db=_[_0xf4d9('0x3d')]({},_0x44d1db,_0x71ce40['options']);var _0x459330={'where':_0x44d1db[_0xf4d9('0x3b')]};return db[_0xf4d9('0x2a')]['count'](_0x459330)[_0xf4d9('0x24')](function(_0x4cca72){_0x139c93[_0xf4d9('0x1d')]=_0x4cca72;if(_0x71ce40[_0xf4d9('0x30')]['includeAll']){_0x44d1db[_0xf4d9('0x41')]=[{'all':!![]}];}return db[_0xf4d9('0x2a')][_0xf4d9('0x42')](_0x44d1db);})[_0xf4d9('0x24')](function(_0x5444a5){_0x139c93['rows']=_0x5444a5;return _0x139c93;})[_0xf4d9('0x24')](respondWithFilteredResult(_0x12aa2b,_0x44d1db))['catch'](handleError(_0x12aa2b,null));};exports[_0xf4d9('0x43')]=function(_0x147528,_0x5bdccd){var _0x137ec7={'raw':![],'where':{'id':_0x147528[_0xf4d9('0x44')]['id']}},_0x224aca={};_0x224aca[_0xf4d9('0x2e')]=_[_0xf4d9('0x31')](db[_0xf4d9('0x2a')][_0xf4d9('0x2b')]);_0x224aca['query']=_[_0xf4d9('0x31')](_0x147528['query']);_0x224aca['filters']=_[_0xf4d9('0x33')](_0x224aca[_0xf4d9('0x2e')],_0x224aca[_0xf4d9('0x30')]);_0x137ec7[_0xf4d9('0x35')]=_['intersection'](_0x224aca['model'],qs[_0xf4d9('0x34')](_0x147528[_0xf4d9('0x30')][_0xf4d9('0x34')]));_0x137ec7[_0xf4d9('0x35')]=_0x137ec7[_0xf4d9('0x35')][_0xf4d9('0x36')]?_0x137ec7[_0xf4d9('0x35')]:_0x224aca[_0xf4d9('0x2e')];if(_0x147528[_0xf4d9('0x30')][_0xf4d9('0x45')]){_0x137ec7[_0xf4d9('0x41')]=[{'all':!![]}];}_0x137ec7=_[_0xf4d9('0x3d')]({},_0x137ec7,_0x147528[_0xf4d9('0x46')]);return db['FreshdeskConfiguration'][_0xf4d9('0x47')](_0x137ec7)[_0xf4d9('0x24')](handleEntityNotFound(_0x5bdccd,null))[_0xf4d9('0x24')](respondWithResult(_0x5bdccd,null))[_0xf4d9('0x48')](handleError(_0x5bdccd,null));};exports[_0xf4d9('0x49')]=function(_0x468eb2,_0xff977){return db[_0xf4d9('0x2a')]['create'](_0x468eb2[_0xf4d9('0x4a')],{})[_0xf4d9('0x24')](respondWithResult(_0xff977,0xc9))[_0xf4d9('0x48')](handleError(_0xff977,null));};exports[_0xf4d9('0x23')]=function(_0x5d5344,_0x35bae6){if(_0x5d5344[_0xf4d9('0x4a')]['id']){delete _0x5d5344['body']['id'];}return db[_0xf4d9('0x2a')][_0xf4d9('0x47')]({'where':{'id':_0x5d5344[_0xf4d9('0x44')]['id']}})[_0xf4d9('0x24')](handleEntityNotFound(_0x35bae6,null))[_0xf4d9('0x24')](saveUpdates(_0x5d5344[_0xf4d9('0x4a')],null))['then'](respondWithResult(_0x35bae6,null))[_0xf4d9('0x48')](handleError(_0x35bae6,null));};exports['destroy']=function(_0x13a38a,_0x58f6bb){return db[_0xf4d9('0x2a')][_0xf4d9('0x47')]({'where':{'id':_0x13a38a[_0xf4d9('0x44')]['id']}})['then'](handleEntityNotFound(_0x58f6bb,null))[_0xf4d9('0x24')](removeEntity(_0x58f6bb,null))[_0xf4d9('0x48')](handleError(_0x58f6bb,null));};exports[_0xf4d9('0x4b')]=function(_0x2a502d,_0x2668f4,_0x1110fc){var _0x412d17={};var _0x1749be={};var _0x2134d9;var _0x3ed6c1;return db[_0xf4d9('0x2a')]['findOne']({'where':{'id':_0x2a502d['params']['id']}})[_0xf4d9('0x24')](handleEntityNotFound(_0x2668f4,null))[_0xf4d9('0x24')](function(_0x370604){if(_0x370604){_0x2134d9=_0x370604;_0x1749be[_0xf4d9('0x2e')]=_[_0xf4d9('0x31')](db[_0xf4d9('0x4c')][_0xf4d9('0x2b')]);_0x1749be['query']=_[_0xf4d9('0x31')](_0x2a502d[_0xf4d9('0x30')]);_0x1749be[_0xf4d9('0x32')]=_[_0xf4d9('0x33')](_0x1749be[_0xf4d9('0x2e')],_0x1749be['query']);_0x412d17[_0xf4d9('0x35')]=_['intersection'](_0x1749be['model'],qs['fields'](_0x2a502d[_0xf4d9('0x30')][_0xf4d9('0x34')]));_0x412d17[_0xf4d9('0x35')]=_0x412d17['attributes']['length']?_0x412d17[_0xf4d9('0x35')]:_0x1749be[_0xf4d9('0x2e')];_0x412d17['order']=qs['sort'](_0x2a502d[_0xf4d9('0x30')][_0xf4d9('0x3a')]);_0x412d17['where']=qs[_0xf4d9('0x32')](_['pick'](_0x2a502d[_0xf4d9('0x30')],_0x1749be[_0xf4d9('0x32')]));if(_0x2a502d[_0xf4d9('0x30')][_0xf4d9('0x40')]){_0x412d17[_0xf4d9('0x3b')]=_[_0xf4d9('0x3d')](_0x412d17[_0xf4d9('0x3b')],{'$or':_[_0xf4d9('0x2f')](_0x412d17[_0xf4d9('0x35')],function(_0x3c2b76){var _0x3bfb43={};_0x3bfb43[_0x3c2b76]={'$like':'%'+_0x2a502d[_0xf4d9('0x30')][_0xf4d9('0x40')]+'%'};return _0x3bfb43;})});}_0x412d17=_[_0xf4d9('0x3d')]({},_0x412d17,_0x2a502d['options']);return _0x2134d9['getFields'](_0x412d17);}})[_0xf4d9('0x24')](function(_0x18080f){if(_0x18080f){_0x3ed6c1=_0x18080f[_0xf4d9('0x36')];if(!_0x2a502d[_0xf4d9('0x30')][_0xf4d9('0x37')](_0xf4d9('0x38'))){_0x412d17['limit']=qs[_0xf4d9('0x1c')](_0x2a502d['query']['limit']);_0x412d17[_0xf4d9('0x1e')]=qs[_0xf4d9('0x1e')](_0x2a502d[_0xf4d9('0x30')]['offset']);}return _0x2134d9[_0xf4d9('0x4b')](_0x412d17);}})['then'](function(_0x2a8b6c){if(_0x2a8b6c){return _0x2a8b6c?{'count':_0x3ed6c1,'rows':_0x2a8b6c}:null;}})['then'](respondWithResult(_0x2668f4,null))[_0xf4d9('0x48')](handleError(_0x2668f4,null));};exports[_0xf4d9('0x4d')]=function(_0x1df424,_0x37ef57,_0x1b7aa0){var _0x439796={};var _0x30b15f={};var _0x41a180;var _0x41178c;return db['FreshdeskConfiguration'][_0xf4d9('0x4e')]({'where':{'id':_0x1df424[_0xf4d9('0x44')]['id']}})[_0xf4d9('0x24')](handleEntityNotFound(_0x37ef57,null))[_0xf4d9('0x24')](function(_0x476599){if(_0x476599){_0x41a180=_0x476599;_0x30b15f[_0xf4d9('0x2e')]=_[_0xf4d9('0x31')](db['FreshdeskField']['rawAttributes']);_0x30b15f[_0xf4d9('0x30')]=_['keys'](_0x1df424['query']);_0x30b15f['filters']=_[_0xf4d9('0x33')](_0x30b15f[_0xf4d9('0x2e')],_0x30b15f[_0xf4d9('0x30')]);_0x439796[_0xf4d9('0x35')]=_['intersection'](_0x30b15f[_0xf4d9('0x2e')],qs[_0xf4d9('0x34')](_0x1df424[_0xf4d9('0x30')][_0xf4d9('0x34')]));_0x439796[_0xf4d9('0x35')]=_0x439796[_0xf4d9('0x35')]['length']?_0x439796['attributes']:_0x30b15f[_0xf4d9('0x2e')];_0x439796[_0xf4d9('0x39')]=qs['sort'](_0x1df424[_0xf4d9('0x30')]['sort']);_0x439796[_0xf4d9('0x3b')]=qs['filters'](_[_0xf4d9('0x3c')](_0x1df424[_0xf4d9('0x30')],_0x30b15f[_0xf4d9('0x32')]));if(_0x1df424[_0xf4d9('0x30')][_0xf4d9('0x40')]){_0x439796[_0xf4d9('0x3b')]=_[_0xf4d9('0x3d')](_0x439796[_0xf4d9('0x3b')],{'$or':_[_0xf4d9('0x2f')](_0x439796['attributes'],function(_0x881f70){var _0x20336c={};_0x20336c[_0x881f70]={'$like':'%'+_0x1df424[_0xf4d9('0x30')][_0xf4d9('0x40')]+'%'};return _0x20336c;})});}_0x439796=_[_0xf4d9('0x3d')]({},_0x439796,_0x1df424[_0xf4d9('0x46')]);return _0x41a180[_0xf4d9('0x4d')](_0x439796);}})[_0xf4d9('0x24')](function(_0x594678){if(_0x594678){_0x41178c=_0x594678[_0xf4d9('0x36')];if(!_0x1df424[_0xf4d9('0x30')]['hasOwnProperty'](_0xf4d9('0x38'))){_0x439796[_0xf4d9('0x1c')]=qs['limit'](_0x1df424['query'][_0xf4d9('0x1c')]);_0x439796[_0xf4d9('0x1e')]=qs['offset'](_0x1df424[_0xf4d9('0x30')][_0xf4d9('0x1e')]);}return _0x41a180[_0xf4d9('0x4d')](_0x439796);}})['then'](function(_0x25a499){if(_0x25a499){return _0x25a499?{'count':_0x41178c,'rows':_0x25a499}:null;}})[_0xf4d9('0x24')](respondWithResult(_0x37ef57,null))[_0xf4d9('0x48')](handleError(_0x37ef57,null));};exports[_0xf4d9('0x4f')]=function(_0x2a7aed,_0xfacd94,_0x2d6fb5){var _0x186c5d={};var _0x3ad4f2={};var _0x4dfd2a;var _0x5ccf14;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x2a7aed[_0xf4d9('0x44')]['id']}})[_0xf4d9('0x24')](handleEntityNotFound(_0xfacd94,null))[_0xf4d9('0x24')](function(_0x58f2e4){if(_0x58f2e4){_0x4dfd2a=_0x58f2e4;_0x3ad4f2[_0xf4d9('0x2e')]=_[_0xf4d9('0x31')](db['FreshdeskField'][_0xf4d9('0x2b')]);_0x3ad4f2[_0xf4d9('0x30')]=_[_0xf4d9('0x31')](_0x2a7aed[_0xf4d9('0x30')]);_0x3ad4f2[_0xf4d9('0x32')]=_[_0xf4d9('0x33')](_0x3ad4f2[_0xf4d9('0x2e')],_0x3ad4f2['query']);_0x186c5d[_0xf4d9('0x35')]=_['intersection'](_0x3ad4f2[_0xf4d9('0x2e')],qs[_0xf4d9('0x34')](_0x2a7aed['query']['fields']));_0x186c5d[_0xf4d9('0x35')]=_0x186c5d[_0xf4d9('0x35')][_0xf4d9('0x36')]?_0x186c5d[_0xf4d9('0x35')]:_0x3ad4f2['model'];_0x186c5d['order']=qs['sort'](_0x2a7aed[_0xf4d9('0x30')][_0xf4d9('0x3a')]);_0x186c5d[_0xf4d9('0x3b')]=qs['filters'](_[_0xf4d9('0x3c')](_0x2a7aed[_0xf4d9('0x30')],_0x3ad4f2['filters']));if(_0x2a7aed['query']['filter']){_0x186c5d['where']=_[_0xf4d9('0x3d')](_0x186c5d[_0xf4d9('0x3b')],{'$or':_['map'](_0x186c5d[_0xf4d9('0x35')],function(_0x3fcb3e){var _0x3c0672={};_0x3c0672[_0x3fcb3e]={'$like':'%'+_0x2a7aed['query']['filter']+'%'};return _0x3c0672;})});}_0x186c5d=_[_0xf4d9('0x3d')]({},_0x186c5d,_0x2a7aed['options']);return _0x4dfd2a['getDescriptions'](_0x186c5d);}})[_0xf4d9('0x24')](function(_0x2ac7a8){if(_0x2ac7a8){_0x5ccf14=_0x2ac7a8[_0xf4d9('0x36')];if(!_0x2a7aed[_0xf4d9('0x30')]['hasOwnProperty'](_0xf4d9('0x38'))){_0x186c5d['limit']=qs['limit'](_0x2a7aed[_0xf4d9('0x30')][_0xf4d9('0x1c')]);_0x186c5d[_0xf4d9('0x1e')]=qs[_0xf4d9('0x1e')](_0x2a7aed[_0xf4d9('0x30')][_0xf4d9('0x1e')]);}return _0x4dfd2a[_0xf4d9('0x4f')](_0x186c5d);}})['then'](function(_0x1d762e){if(_0x1d762e){return _0x1d762e?{'count':_0x5ccf14,'rows':_0x1d762e}:null;}})[_0xf4d9('0x24')](respondWithResult(_0xfacd94,null))[_0xf4d9('0x48')](handleError(_0xfacd94,null));};exports[_0xf4d9('0x50')]=function(_0x7a2958,_0x4ac29a,_0x2c033b){var _0x23151d={};var _0x3efa22={};var _0x172c67;var _0x5cba9d;return db[_0xf4d9('0x2a')]['findOne']({'where':{'id':_0x7a2958[_0xf4d9('0x44')]['id']}})['then'](handleEntityNotFound(_0x4ac29a,null))[_0xf4d9('0x24')](function(_0x3e4106){if(_0x3e4106){_0x172c67=_0x3e4106;_0x3efa22[_0xf4d9('0x2e')]=_[_0xf4d9('0x31')](db[_0xf4d9('0x51')][_0xf4d9('0x2b')]);_0x3efa22[_0xf4d9('0x30')]=_[_0xf4d9('0x31')](_0x7a2958[_0xf4d9('0x30')]);_0x3efa22[_0xf4d9('0x32')]=_['intersection'](_0x3efa22[_0xf4d9('0x2e')],_0x3efa22['query']);_0x23151d[_0xf4d9('0x35')]=_[_0xf4d9('0x33')](_0x3efa22[_0xf4d9('0x2e')],qs[_0xf4d9('0x34')](_0x7a2958[_0xf4d9('0x30')][_0xf4d9('0x34')]));_0x23151d[_0xf4d9('0x35')]=_0x23151d[_0xf4d9('0x35')][_0xf4d9('0x36')]?_0x23151d['attributes']:_0x3efa22[_0xf4d9('0x2e')];_0x23151d[_0xf4d9('0x39')]=qs['sort'](_0x7a2958[_0xf4d9('0x30')][_0xf4d9('0x3a')]);_0x23151d[_0xf4d9('0x3b')]=qs[_0xf4d9('0x32')](_['pick'](_0x7a2958[_0xf4d9('0x30')],_0x3efa22['filters']));if(_0x7a2958[_0xf4d9('0x30')][_0xf4d9('0x40')]){_0x23151d[_0xf4d9('0x3b')]=_['merge'](_0x23151d[_0xf4d9('0x3b')],{'$or':_[_0xf4d9('0x2f')](_0x23151d[_0xf4d9('0x35')],function(_0x487b9a){var _0x12317f={};_0x12317f[_0x487b9a]={'$like':'%'+_0x7a2958[_0xf4d9('0x30')][_0xf4d9('0x40')]+'%'};return _0x12317f;})});}_0x23151d=_[_0xf4d9('0x3d')]({},_0x23151d,_0x7a2958[_0xf4d9('0x46')]);return _0x172c67['getTags'](_0x23151d);}})[_0xf4d9('0x24')](function(_0x5d6b07){if(_0x5d6b07){_0x5cba9d=_0x5d6b07[_0xf4d9('0x36')];if(!_0x7a2958[_0xf4d9('0x30')]['hasOwnProperty'](_0xf4d9('0x38'))){_0x23151d[_0xf4d9('0x1c')]=qs['limit'](_0x7a2958[_0xf4d9('0x30')][_0xf4d9('0x1c')]);_0x23151d[_0xf4d9('0x1e')]=qs[_0xf4d9('0x1e')](_0x7a2958[_0xf4d9('0x30')][_0xf4d9('0x1e')]);}return _0x172c67['getTags'](_0x23151d);}})['then'](function(_0x5203b8){if(_0x5203b8){return _0x5203b8?{'count':_0x5cba9d,'rows':_0x5203b8}:null;}})[_0xf4d9('0x24')](respondWithResult(_0x4ac29a,null))[_0xf4d9('0x48')](handleError(_0x4ac29a,null));};exports['setTags']=function(_0x5cdbb9,_0x431da6,_0x12d882){if(_0x5cdbb9['body']['id']){delete _0x5cdbb9['body']['id'];}return db[_0xf4d9('0x2a')][_0xf4d9('0x4e')]({'where':{'id':_0x5cdbb9['params']['id']}})[_0xf4d9('0x24')](handleEntityNotFound(_0x431da6,null))[_0xf4d9('0x24')](function(_0x17531c){if(_0x17531c){return _0x17531c[_0xf4d9('0x52')](_0x5cdbb9[_0xf4d9('0x4a')][_0xf4d9('0x53')]||[]);}return null;})[_0xf4d9('0x24')](respondWithResult(_0x431da6,null))['catch'](handleError(_0x431da6,null));}; \ No newline at end of file +var _0x4761=['getFields','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','FreshdeskConfiguration','fieldName','type','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filters','where','VIRTUAL','merge','includeAll','include','rows','catch','params','keys','rawAttributes','options','find','create','body','FreshdeskField','order','filter'];(function(_0x152276,_0x3c77ef){var _0x4db640=function(_0x34111c){while(--_0x34111c){_0x152276['push'](_0x152276['shift']());}};_0x4db640(++_0x3c77ef);}(_0x4761,0x107));var _0x1476=function(_0x243bfd,_0x4f7fea){_0x243bfd=_0x243bfd-0x0;var _0x2c332a=_0x4761[_0x243bfd];return _0x2c332a;};'use strict';var emlformat=require(_0x1476('0x0'));var rimraf=require(_0x1476('0x1'));var zipdir=require(_0x1476('0x2'));var jsonpatch=require(_0x1476('0x3'));var rp=require(_0x1476('0x4'));var moment=require(_0x1476('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1476('0x6'));var util=require(_0x1476('0x7'));var path=require(_0x1476('0x8'));var sox=require(_0x1476('0x9'));var csv=require(_0x1476('0xa'));var ejs=require(_0x1476('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1476('0xc'));var squel=require('squel');var crypto=require(_0x1476('0xd'));var jsforce=require(_0x1476('0xe'));var deskjs=require(_0x1476('0xf'));var toCsv=require(_0x1476('0xa'));var querystring=require(_0x1476('0x10'));var Papa=require(_0x1476('0x11'));var Redis=require(_0x1476('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1476('0x13'));var as=require(_0x1476('0x14'));var hardwareService=require(_0x1476('0x15'));var logger=require(_0x1476('0x16'))(_0x1476('0x17'));var utils=require('../../config/utils');var config=require(_0x1476('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1476('0x19'))['db'];function respondWithStatusCode(_0x235f55,_0x3f2ff6){_0x3f2ff6=_0x3f2ff6||0xcc;return function(_0x419df2){if(_0x419df2){return _0x235f55[_0x1476('0x1a')](_0x3f2ff6);}return _0x235f55[_0x1476('0x1b')](_0x3f2ff6)[_0x1476('0x1c')]();};}function respondWithResult(_0x3cee8c,_0x41716b){_0x41716b=_0x41716b||0xc8;return function(_0x35e1ea){if(_0x35e1ea){return _0x3cee8c['status'](_0x41716b)['json'](_0x35e1ea);}};}function respondWithFilteredResult(_0xe2f962,_0x65f158){return function(_0x37e7e1){if(_0x37e7e1){var _0x2ceaa5=typeof _0x65f158[_0x1476('0x1d')]===_0x1476('0x1e')&&typeof _0x65f158[_0x1476('0x1f')]==='undefined';var _0x321c1a=_0x37e7e1[_0x1476('0x20')];var _0x2cd5a9=_0x2ceaa5?0x0:_0x65f158[_0x1476('0x1d')];var _0x1eea8c=_0x2ceaa5?_0x37e7e1['count']:_0x65f158['offset']+_0x65f158[_0x1476('0x1f')];var _0x58bff5;if(_0x1eea8c>=_0x321c1a){_0x1eea8c=_0x321c1a;_0x58bff5=0xc8;}else{_0x58bff5=0xce;}_0xe2f962[_0x1476('0x1b')](_0x58bff5);return _0xe2f962['set'](_0x1476('0x21'),_0x2cd5a9+'-'+_0x1eea8c+'/'+_0x321c1a)[_0x1476('0x22')](_0x37e7e1);}return null;};}function patchUpdates(_0x4c9ba8){return function(_0x291eed){try{jsonpatch[_0x1476('0x23')](_0x291eed,_0x4c9ba8,!![]);}catch(_0x3fb03d){return BPromise[_0x1476('0x24')](_0x3fb03d);}return _0x291eed[_0x1476('0x25')]();};}function saveUpdates(_0x569809,_0x20135c){return function(_0x2aab9f){if(_0x2aab9f){return _0x2aab9f[_0x1476('0x26')](_0x569809)[_0x1476('0x27')](function(_0x28f42a){return _0x28f42a;});}return null;};}function removeEntity(_0x506462,_0x55b172){return function(_0x2ef051){if(_0x2ef051){return _0x2ef051[_0x1476('0x28')]()[_0x1476('0x27')](function(){_0x506462[_0x1476('0x1b')](0xcc)[_0x1476('0x1c')]();});}};}function handleEntityNotFound(_0x2de091,_0x49136c){return function(_0x5ed67f){if(!_0x5ed67f){_0x2de091[_0x1476('0x1a')](0x194);}return _0x5ed67f;};}function handleError(_0x17fc48,_0x294f8d){_0x294f8d=_0x294f8d||0x1f4;return function(_0x3ca17e){logger[_0x1476('0x29')](_0x3ca17e['stack']);if(_0x3ca17e[_0x1476('0x2a')]){delete _0x3ca17e[_0x1476('0x2a')];}_0x17fc48[_0x1476('0x1b')](_0x294f8d)[_0x1476('0x2b')](_0x3ca17e);};}exports[_0x1476('0x2c')]=function(_0x3078a5,_0x8801be){var _0x344727={},_0x19a130={},_0x3bd32f={'count':0x0,'rows':[]};var _0x55202c=_['map'](db[_0x1476('0x2d')]['rawAttributes'],function(_0x45e3e7){return{'name':_0x45e3e7[_0x1476('0x2e')],'type':_0x45e3e7[_0x1476('0x2f')]['key']};});_0x19a130[_0x1476('0x30')]=_[_0x1476('0x31')](_0x55202c,_0x1476('0x2a'));_0x19a130[_0x1476('0x32')]=_['keys'](_0x3078a5[_0x1476('0x32')]);_0x19a130['filters']=_[_0x1476('0x33')](_0x19a130[_0x1476('0x30')],_0x19a130['query']);_0x344727[_0x1476('0x34')]=_[_0x1476('0x33')](_0x19a130[_0x1476('0x30')],qs[_0x1476('0x35')](_0x3078a5[_0x1476('0x32')][_0x1476('0x35')]));_0x344727[_0x1476('0x34')]=_0x344727[_0x1476('0x34')][_0x1476('0x36')]?_0x344727[_0x1476('0x34')]:_0x19a130[_0x1476('0x30')];if(!_0x3078a5[_0x1476('0x32')][_0x1476('0x37')](_0x1476('0x38'))){_0x344727['limit']=qs[_0x1476('0x1f')](_0x3078a5[_0x1476('0x32')][_0x1476('0x1f')]);_0x344727[_0x1476('0x1d')]=qs[_0x1476('0x1d')](_0x3078a5['query']['offset']);}_0x344727['order']=qs[_0x1476('0x39')](_0x3078a5[_0x1476('0x32')][_0x1476('0x39')]);_0x344727['where']=qs['filters'](_[_0x1476('0x3a')](_0x3078a5[_0x1476('0x32')],_0x19a130[_0x1476('0x3b')]),_0x55202c);if(_0x3078a5[_0x1476('0x32')]['filter']){_0x344727[_0x1476('0x3c')]=_['merge'](_0x344727[_0x1476('0x3c')],{'$or':_[_0x1476('0x31')](_0x55202c,function(_0x2987f2){if(_0x2987f2[_0x1476('0x2f')]!==_0x1476('0x3d')){var _0x2765cb={};_0x2765cb[_0x2987f2[_0x1476('0x2a')]]={'$like':'%'+_0x3078a5[_0x1476('0x32')]['filter']+'%'};return _0x2765cb;}})});}_0x344727=_[_0x1476('0x3e')]({},_0x344727,_0x3078a5['options']);var _0x58f74f={'where':_0x344727[_0x1476('0x3c')]};return db[_0x1476('0x2d')][_0x1476('0x20')](_0x58f74f)[_0x1476('0x27')](function(_0x8d5013){_0x3bd32f[_0x1476('0x20')]=_0x8d5013;if(_0x3078a5[_0x1476('0x32')][_0x1476('0x3f')]){_0x344727[_0x1476('0x40')]=[{'all':!![]}];}return db[_0x1476('0x2d')]['findAll'](_0x344727);})[_0x1476('0x27')](function(_0x256db8){_0x3bd32f[_0x1476('0x41')]=_0x256db8;return _0x3bd32f;})[_0x1476('0x27')](respondWithFilteredResult(_0x8801be,_0x344727))[_0x1476('0x42')](handleError(_0x8801be,null));};exports['show']=function(_0x180ee8,_0x1fd4ec){var _0xac0113={'raw':![],'where':{'id':_0x180ee8[_0x1476('0x43')]['id']}},_0x1445be={};_0x1445be[_0x1476('0x30')]=_[_0x1476('0x44')](db[_0x1476('0x2d')][_0x1476('0x45')]);_0x1445be[_0x1476('0x32')]=_['keys'](_0x180ee8[_0x1476('0x32')]);_0x1445be[_0x1476('0x3b')]=_[_0x1476('0x33')](_0x1445be[_0x1476('0x30')],_0x1445be[_0x1476('0x32')]);_0xac0113[_0x1476('0x34')]=_[_0x1476('0x33')](_0x1445be['model'],qs[_0x1476('0x35')](_0x180ee8[_0x1476('0x32')][_0x1476('0x35')]));_0xac0113[_0x1476('0x34')]=_0xac0113[_0x1476('0x34')][_0x1476('0x36')]?_0xac0113[_0x1476('0x34')]:_0x1445be[_0x1476('0x30')];if(_0x180ee8[_0x1476('0x32')][_0x1476('0x3f')]){_0xac0113[_0x1476('0x40')]=[{'all':!![]}];}_0xac0113=_[_0x1476('0x3e')]({},_0xac0113,_0x180ee8[_0x1476('0x46')]);return db[_0x1476('0x2d')][_0x1476('0x47')](_0xac0113)[_0x1476('0x27')](handleEntityNotFound(_0x1fd4ec,null))[_0x1476('0x27')](respondWithResult(_0x1fd4ec,null))[_0x1476('0x42')](handleError(_0x1fd4ec,null));};exports[_0x1476('0x48')]=function(_0x330afa,_0x49a99a){return db[_0x1476('0x2d')][_0x1476('0x48')](_0x330afa[_0x1476('0x49')],{})[_0x1476('0x27')](respondWithResult(_0x49a99a,0xc9))[_0x1476('0x42')](handleError(_0x49a99a,null));};exports[_0x1476('0x26')]=function(_0x39c68a,_0x5d8e75){if(_0x39c68a[_0x1476('0x49')]['id']){delete _0x39c68a['body']['id'];}return db[_0x1476('0x2d')][_0x1476('0x47')]({'where':{'id':_0x39c68a[_0x1476('0x43')]['id']}})['then'](handleEntityNotFound(_0x5d8e75,null))['then'](saveUpdates(_0x39c68a[_0x1476('0x49')],null))[_0x1476('0x27')](respondWithResult(_0x5d8e75,null))[_0x1476('0x42')](handleError(_0x5d8e75,null));};exports[_0x1476('0x28')]=function(_0x54b912,_0x444c0d){return db['FreshdeskConfiguration'][_0x1476('0x47')]({'where':{'id':_0x54b912[_0x1476('0x43')]['id']}})[_0x1476('0x27')](handleEntityNotFound(_0x444c0d,null))['then'](removeEntity(_0x444c0d,null))[_0x1476('0x42')](handleError(_0x444c0d,null));};exports['getFields']=function(_0x3e01d4,_0x505b7a,_0x41fda8){var _0x2c761b={};var _0x5851ba={};var _0x596d15;var _0x2aaed9;return db[_0x1476('0x2d')]['findOne']({'where':{'id':_0x3e01d4[_0x1476('0x43')]['id']}})[_0x1476('0x27')](handleEntityNotFound(_0x505b7a,null))['then'](function(_0x1f7b83){if(_0x1f7b83){_0x596d15=_0x1f7b83;_0x5851ba[_0x1476('0x30')]=_[_0x1476('0x44')](db[_0x1476('0x4a')][_0x1476('0x45')]);_0x5851ba['query']=_[_0x1476('0x44')](_0x3e01d4[_0x1476('0x32')]);_0x5851ba[_0x1476('0x3b')]=_[_0x1476('0x33')](_0x5851ba[_0x1476('0x30')],_0x5851ba[_0x1476('0x32')]);_0x2c761b[_0x1476('0x34')]=_['intersection'](_0x5851ba['model'],qs[_0x1476('0x35')](_0x3e01d4[_0x1476('0x32')][_0x1476('0x35')]));_0x2c761b['attributes']=_0x2c761b[_0x1476('0x34')]['length']?_0x2c761b[_0x1476('0x34')]:_0x5851ba[_0x1476('0x30')];_0x2c761b[_0x1476('0x4b')]=qs[_0x1476('0x39')](_0x3e01d4[_0x1476('0x32')]['sort']);_0x2c761b[_0x1476('0x3c')]=qs['filters'](_[_0x1476('0x3a')](_0x3e01d4[_0x1476('0x32')],_0x5851ba[_0x1476('0x3b')]));if(_0x3e01d4[_0x1476('0x32')][_0x1476('0x4c')]){_0x2c761b[_0x1476('0x3c')]=_[_0x1476('0x3e')](_0x2c761b[_0x1476('0x3c')],{'$or':_['map'](_0x2c761b[_0x1476('0x34')],function(_0x596f8c){var _0x1cb37c={};_0x1cb37c[_0x596f8c]={'$like':'%'+_0x3e01d4['query'][_0x1476('0x4c')]+'%'};return _0x1cb37c;})});}_0x2c761b=_[_0x1476('0x3e')]({},_0x2c761b,_0x3e01d4[_0x1476('0x46')]);return _0x596d15[_0x1476('0x4d')](_0x2c761b);}})[_0x1476('0x27')](function(_0x34456a){if(_0x34456a){_0x2aaed9=_0x34456a[_0x1476('0x36')];if(!_0x3e01d4[_0x1476('0x32')][_0x1476('0x37')](_0x1476('0x38'))){_0x2c761b['limit']=qs[_0x1476('0x1f')](_0x3e01d4[_0x1476('0x32')][_0x1476('0x1f')]);_0x2c761b[_0x1476('0x1d')]=qs[_0x1476('0x1d')](_0x3e01d4[_0x1476('0x32')][_0x1476('0x1d')]);}return _0x596d15[_0x1476('0x4d')](_0x2c761b);}})[_0x1476('0x27')](function(_0x47a5b8){if(_0x47a5b8){return _0x47a5b8?{'count':_0x2aaed9,'rows':_0x47a5b8}:null;}})[_0x1476('0x27')](respondWithResult(_0x505b7a,null))['catch'](handleError(_0x505b7a,null));};exports[_0x1476('0x4e')]=function(_0x1c44d0,_0xc14e7,_0x3d5b50){var _0x1e71bd={};var _0x47c96a={};var _0x508569;var _0x34ddc2;return db[_0x1476('0x2d')][_0x1476('0x4f')]({'where':{'id':_0x1c44d0[_0x1476('0x43')]['id']}})[_0x1476('0x27')](handleEntityNotFound(_0xc14e7,null))[_0x1476('0x27')](function(_0xe4889e){if(_0xe4889e){_0x508569=_0xe4889e;_0x47c96a[_0x1476('0x30')]=_[_0x1476('0x44')](db[_0x1476('0x4a')][_0x1476('0x45')]);_0x47c96a['query']=_[_0x1476('0x44')](_0x1c44d0[_0x1476('0x32')]);_0x47c96a['filters']=_[_0x1476('0x33')](_0x47c96a[_0x1476('0x30')],_0x47c96a[_0x1476('0x32')]);_0x1e71bd[_0x1476('0x34')]=_[_0x1476('0x33')](_0x47c96a[_0x1476('0x30')],qs[_0x1476('0x35')](_0x1c44d0[_0x1476('0x32')][_0x1476('0x35')]));_0x1e71bd[_0x1476('0x34')]=_0x1e71bd[_0x1476('0x34')][_0x1476('0x36')]?_0x1e71bd[_0x1476('0x34')]:_0x47c96a[_0x1476('0x30')];_0x1e71bd['order']=qs[_0x1476('0x39')](_0x1c44d0['query']['sort']);_0x1e71bd[_0x1476('0x3c')]=qs[_0x1476('0x3b')](_[_0x1476('0x3a')](_0x1c44d0[_0x1476('0x32')],_0x47c96a[_0x1476('0x3b')]));if(_0x1c44d0[_0x1476('0x32')][_0x1476('0x4c')]){_0x1e71bd['where']=_[_0x1476('0x3e')](_0x1e71bd[_0x1476('0x3c')],{'$or':_['map'](_0x1e71bd['attributes'],function(_0x52fece){var _0xd4f7e2={};_0xd4f7e2[_0x52fece]={'$like':'%'+_0x1c44d0['query'][_0x1476('0x4c')]+'%'};return _0xd4f7e2;})});}_0x1e71bd=_[_0x1476('0x3e')]({},_0x1e71bd,_0x1c44d0[_0x1476('0x46')]);return _0x508569[_0x1476('0x4e')](_0x1e71bd);}})[_0x1476('0x27')](function(_0x2f9467){if(_0x2f9467){_0x34ddc2=_0x2f9467[_0x1476('0x36')];if(!_0x1c44d0[_0x1476('0x32')][_0x1476('0x37')](_0x1476('0x38'))){_0x1e71bd[_0x1476('0x1f')]=qs[_0x1476('0x1f')](_0x1c44d0[_0x1476('0x32')][_0x1476('0x1f')]);_0x1e71bd[_0x1476('0x1d')]=qs[_0x1476('0x1d')](_0x1c44d0['query']['offset']);}return _0x508569[_0x1476('0x4e')](_0x1e71bd);}})[_0x1476('0x27')](function(_0x543e74){if(_0x543e74){return _0x543e74?{'count':_0x34ddc2,'rows':_0x543e74}:null;}})[_0x1476('0x27')](respondWithResult(_0xc14e7,null))[_0x1476('0x42')](handleError(_0xc14e7,null));};exports['getDescriptions']=function(_0x3fd29d,_0x341260,_0x484844){var _0x175035={};var _0x2e2123={};var _0x7a5e20;var _0x2f546;return db['FreshdeskConfiguration'][_0x1476('0x4f')]({'where':{'id':_0x3fd29d[_0x1476('0x43')]['id']}})[_0x1476('0x27')](handleEntityNotFound(_0x341260,null))[_0x1476('0x27')](function(_0xee12bb){if(_0xee12bb){_0x7a5e20=_0xee12bb;_0x2e2123['model']=_[_0x1476('0x44')](db[_0x1476('0x4a')][_0x1476('0x45')]);_0x2e2123[_0x1476('0x32')]=_['keys'](_0x3fd29d[_0x1476('0x32')]);_0x2e2123[_0x1476('0x3b')]=_[_0x1476('0x33')](_0x2e2123['model'],_0x2e2123[_0x1476('0x32')]);_0x175035[_0x1476('0x34')]=_[_0x1476('0x33')](_0x2e2123[_0x1476('0x30')],qs['fields'](_0x3fd29d[_0x1476('0x32')][_0x1476('0x35')]));_0x175035[_0x1476('0x34')]=_0x175035[_0x1476('0x34')][_0x1476('0x36')]?_0x175035['attributes']:_0x2e2123[_0x1476('0x30')];_0x175035[_0x1476('0x4b')]=qs[_0x1476('0x39')](_0x3fd29d[_0x1476('0x32')][_0x1476('0x39')]);_0x175035[_0x1476('0x3c')]=qs['filters'](_['pick'](_0x3fd29d[_0x1476('0x32')],_0x2e2123[_0x1476('0x3b')]));if(_0x3fd29d['query'][_0x1476('0x4c')]){_0x175035[_0x1476('0x3c')]=_[_0x1476('0x3e')](_0x175035[_0x1476('0x3c')],{'$or':_[_0x1476('0x31')](_0x175035[_0x1476('0x34')],function(_0x20ecc1){var _0xca78fc={};_0xca78fc[_0x20ecc1]={'$like':'%'+_0x3fd29d[_0x1476('0x32')][_0x1476('0x4c')]+'%'};return _0xca78fc;})});}_0x175035=_[_0x1476('0x3e')]({},_0x175035,_0x3fd29d['options']);return _0x7a5e20[_0x1476('0x50')](_0x175035);}})[_0x1476('0x27')](function(_0x3c4d38){if(_0x3c4d38){_0x2f546=_0x3c4d38[_0x1476('0x36')];if(!_0x3fd29d[_0x1476('0x32')]['hasOwnProperty'](_0x1476('0x38'))){_0x175035[_0x1476('0x1f')]=qs[_0x1476('0x1f')](_0x3fd29d['query'][_0x1476('0x1f')]);_0x175035[_0x1476('0x1d')]=qs[_0x1476('0x1d')](_0x3fd29d['query'][_0x1476('0x1d')]);}return _0x7a5e20[_0x1476('0x50')](_0x175035);}})['then'](function(_0x24f8ec){if(_0x24f8ec){return _0x24f8ec?{'count':_0x2f546,'rows':_0x24f8ec}:null;}})[_0x1476('0x27')](respondWithResult(_0x341260,null))['catch'](handleError(_0x341260,null));};exports[_0x1476('0x51')]=function(_0x1c6273,_0x328614,_0xcfed8f){var _0x502c42={};var _0x3f7e94={};var _0x5e8175;var _0x34c20a;return db[_0x1476('0x2d')][_0x1476('0x4f')]({'where':{'id':_0x1c6273[_0x1476('0x43')]['id']}})[_0x1476('0x27')](handleEntityNotFound(_0x328614,null))[_0x1476('0x27')](function(_0x4b69de){if(_0x4b69de){_0x5e8175=_0x4b69de;_0x3f7e94['model']=_[_0x1476('0x44')](db[_0x1476('0x52')][_0x1476('0x45')]);_0x3f7e94['query']=_[_0x1476('0x44')](_0x1c6273[_0x1476('0x32')]);_0x3f7e94[_0x1476('0x3b')]=_[_0x1476('0x33')](_0x3f7e94[_0x1476('0x30')],_0x3f7e94[_0x1476('0x32')]);_0x502c42[_0x1476('0x34')]=_[_0x1476('0x33')](_0x3f7e94[_0x1476('0x30')],qs['fields'](_0x1c6273[_0x1476('0x32')][_0x1476('0x35')]));_0x502c42[_0x1476('0x34')]=_0x502c42[_0x1476('0x34')][_0x1476('0x36')]?_0x502c42[_0x1476('0x34')]:_0x3f7e94[_0x1476('0x30')];_0x502c42[_0x1476('0x4b')]=qs['sort'](_0x1c6273['query'][_0x1476('0x39')]);_0x502c42[_0x1476('0x3c')]=qs['filters'](_[_0x1476('0x3a')](_0x1c6273[_0x1476('0x32')],_0x3f7e94[_0x1476('0x3b')]));if(_0x1c6273[_0x1476('0x32')]['filter']){_0x502c42[_0x1476('0x3c')]=_[_0x1476('0x3e')](_0x502c42[_0x1476('0x3c')],{'$or':_[_0x1476('0x31')](_0x502c42[_0x1476('0x34')],function(_0x55c3af){var _0x30f42a={};_0x30f42a[_0x55c3af]={'$like':'%'+_0x1c6273['query'][_0x1476('0x4c')]+'%'};return _0x30f42a;})});}_0x502c42=_[_0x1476('0x3e')]({},_0x502c42,_0x1c6273[_0x1476('0x46')]);return _0x5e8175[_0x1476('0x51')](_0x502c42);}})['then'](function(_0x133fb8){if(_0x133fb8){_0x34c20a=_0x133fb8[_0x1476('0x36')];if(!_0x1c6273['query'][_0x1476('0x37')](_0x1476('0x38'))){_0x502c42['limit']=qs['limit'](_0x1c6273[_0x1476('0x32')]['limit']);_0x502c42[_0x1476('0x1d')]=qs[_0x1476('0x1d')](_0x1c6273[_0x1476('0x32')]['offset']);}return _0x5e8175[_0x1476('0x51')](_0x502c42);}})[_0x1476('0x27')](function(_0x2a2b59){if(_0x2a2b59){return _0x2a2b59?{'count':_0x34c20a,'rows':_0x2a2b59}:null;}})[_0x1476('0x27')](respondWithResult(_0x328614,null))[_0x1476('0x42')](handleError(_0x328614,null));};exports[_0x1476('0x53')]=function(_0x73583f,_0x186fc6,_0x4c401b){if(_0x73583f['body']['id']){delete _0x73583f['body']['id'];}return db[_0x1476('0x2d')]['findOne']({'where':{'id':_0x73583f[_0x1476('0x43')]['id']}})[_0x1476('0x27')](handleEntityNotFound(_0x186fc6,null))[_0x1476('0x27')](function(_0x44938d){if(_0x44938d){return _0x44938d[_0x1476('0x53')](_0x73583f[_0x1476('0x49')][_0x1476('0x54')]||[]);}return null;})[_0x1476('0x27')](respondWithResult(_0x186fc6,null))[_0x1476('0x42')](handleError(_0x186fc6,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 17cd286..f5ce445 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 _0xe699=['exports','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x2356e3,_0x3c1521){var _0x12e9f7=function(_0x47acc9){while(--_0x47acc9){_0x2356e3['push'](_0x2356e3['shift']());}};_0x12e9f7(++_0x3c1521);}(_0xe699,0x1cf));var _0x9e69=function(_0x3e4ccb,_0x21f6db){_0x3e4ccb=_0x3e4ccb-0x0;var _0x201cfd=_0xe699[_0x3e4ccb];return _0x201cfd;};'use strict';var _=require(_0x9e69('0x0'));var util=require('util');var logger=require(_0x9e69('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9e69('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e69('0x3'));var rimraf=require(_0x9e69('0x4'));var config=require(_0x9e69('0x5'));var attributes=require(_0x9e69('0x6'));module[_0x9e69('0x7')]=function(_0x562e25,_0xfb7747){return _0x562e25['define'](_0x9e69('0x8'),attributes,{'tableName':_0x9e69('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2e7=['moment','bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api'];(function(_0x48f011,_0x4f4a87){var _0x47824e=function(_0x1a6233){while(--_0x1a6233){_0x48f011['push'](_0x48f011['shift']());}};_0x47824e(++_0x4f4a87);}(_0xc2e7,0x1aa));var _0x7c2e=function(_0x5aab64,_0x126bf7){_0x5aab64=_0x5aab64-0x0;var _0x2e10e3=_0xc2e7[_0x5aab64];return _0x2e10e3;};'use strict';var _=require(_0x7c2e('0x0'));var util=require('util');var logger=require(_0x7c2e('0x1'))(_0x7c2e('0x2'));var moment=require(_0x7c2e('0x3'));var BPromise=require(_0x7c2e('0x4'));var rp=require(_0x7c2e('0x5'));var fs=require('fs');var path=require(_0x7c2e('0x6'));var rimraf=require(_0x7c2e('0x7'));var config=require('../../config/environment');var attributes=require(_0x7c2e('0x8'));module[_0x7c2e('0x9')]=function(_0x4a0f7b,_0x4d4432){return _0x4a0f7b[_0x7c2e('0xa')](_0x7c2e('0xb'),attributes,{'tableName':_0x7c2e('0xc'),'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 5e6e93a..ffdca13 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 _0x8a38=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3d8f37,_0x4d12ce){var _0x2264fa=function(_0x131a1e){while(--_0x131a1e){_0x3d8f37['push'](_0x3d8f37['shift']());}};_0x2264fa(++_0x4d12ce);}(_0x8a38,0x103));var _0x88a3=function(_0x5b7d6a,_0x63e6a2){_0x5b7d6a=_0x5b7d6a-0x0;var _0x992adf=_0x8a38[_0x5b7d6a];return _0x992adf;};'use strict';var _=require(_0x88a3('0x0'));var util=require(_0x88a3('0x1'));var moment=require(_0x88a3('0x2'));var BPromise=require(_0x88a3('0x3'));var rs=require(_0x88a3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x88a3('0x5'))['db'];var utils=require(_0x88a3('0x6'));var logger=require(_0x88a3('0x7'))(_0x88a3('0x8'));var config=require(_0x88a3('0x9'));var jayson=require(_0x88a3('0xa'));var client=jayson[_0x88a3('0xb')][_0x88a3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5651b4,_0x578930,_0x4b4d91){return new BPromise(function(_0x57f27d,_0x17cf8d){return client['request'](_0x5651b4,_0x4b4d91)['then'](function(_0x3490d7){logger[_0x88a3('0xd')](_0x88a3('0xe'),_0x578930,_0x88a3('0xf'));logger[_0x88a3('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x578930,_0x88a3('0xf'),JSON[_0x88a3('0x11')](_0x3490d7));if(_0x3490d7[_0x88a3('0x12')]){if(_0x3490d7[_0x88a3('0x12')][_0x88a3('0x13')]===0x1f4){logger[_0x88a3('0x12')](_0x88a3('0xe'),_0x578930,_0x3490d7['error'][_0x88a3('0x14')]);return _0x17cf8d(_0x3490d7[_0x88a3('0x12')]['message']);}logger[_0x88a3('0x12')](_0x88a3('0xe'),_0x578930,_0x3490d7[_0x88a3('0x12')][_0x88a3('0x14')]);return _0x57f27d(_0x3490d7[_0x88a3('0x12')][_0x88a3('0x14')]);}else{logger['info'](_0x88a3('0xe'),_0x578930,_0x88a3('0xf'));_0x57f27d(_0x3490d7[_0x88a3('0x15')][_0x88a3('0x14')]);}})[_0x88a3('0x16')](function(_0x109ffa){logger[_0x88a3('0x12')](_0x88a3('0xe'),_0x578930,_0x109ffa);_0x17cf8d(_0x109ffa);});});} \ No newline at end of file +var _0xa140=['debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x420610,_0x597626){var _0xff7914=function(_0x448012){while(--_0x448012){_0x420610['push'](_0x420610['shift']());}};_0xff7914(++_0x597626);}(_0xa140,0x9b));var _0x0a14=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xa140[_0xa8883];return _0x479426;};'use strict';var _=require(_0x0a14('0x0'));var util=require(_0x0a14('0x1'));var moment=require(_0x0a14('0x2'));var BPromise=require('bluebird');var rs=require(_0x0a14('0x3'));var fs=require('fs');var Redis=require(_0x0a14('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a14('0x5'));var logger=require(_0x0a14('0x6'))(_0x0a14('0x7'));var config=require(_0x0a14('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0a14('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x808536,_0x5b0a0e,_0x2527ad){return new BPromise(function(_0x345dc5,_0x34b9be){return client['request'](_0x808536,_0x2527ad)[_0x0a14('0xa')](function(_0x311205){logger[_0x0a14('0xb')](_0x0a14('0xc'),_0x5b0a0e,'request\x20sent');logger[_0x0a14('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5b0a0e,'request\x20sent',JSON[_0x0a14('0xe')](_0x311205));if(_0x311205[_0x0a14('0xf')]){if(_0x311205[_0x0a14('0xf')][_0x0a14('0x10')]===0x1f4){logger[_0x0a14('0xf')](_0x0a14('0xc'),_0x5b0a0e,_0x311205[_0x0a14('0xf')][_0x0a14('0x11')]);return _0x34b9be(_0x311205[_0x0a14('0xf')]['message']);}logger[_0x0a14('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5b0a0e,_0x311205[_0x0a14('0xf')][_0x0a14('0x11')]);return _0x345dc5(_0x311205['error']['message']);}else{logger[_0x0a14('0xb')](_0x0a14('0xc'),_0x5b0a0e,_0x0a14('0x12'));_0x345dc5(_0x311205[_0x0a14('0x13')][_0x0a14('0x11')]);}})[_0x0a14('0x14')](function(_0x3e7153){logger['error'](_0x0a14('0xc'),_0x5b0a0e,_0x3e7153);_0x34b9be(_0x3e7153);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index ebe0d66..aabe63d 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 _0x9785=['get','/:id','isAuthenticated','show','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9785,0x16e));var _0x5978=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0x9785[_0x6d6a66];return _0x11eb6e;};'use strict';var multer=require('multer');var util=require(_0x5978('0x0'));var path=require(_0x5978('0x1'));var timeout=require(_0x5978('0x2'));var express=require(_0x5978('0x3'));var router=express[_0x5978('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5978('0x5'));var interaction=require(_0x5978('0x6'));var config=require('../../config/environment');var controller=require(_0x5978('0x7'));router[_0x5978('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5978('0x8')](_0x5978('0x9'),auth[_0x5978('0xa')](),controller[_0x5978('0xb')]);router['post']('/',auth[_0x5978('0xa')](),controller[_0x5978('0xc')]);router[_0x5978('0xd')](_0x5978('0x9'),auth[_0x5978('0xa')](),controller[_0x5978('0xe')]);router['delete'](_0x5978('0x9'),auth['isAuthenticated'](),controller[_0x5978('0xf')]);module[_0x5978('0x10')]=router; \ No newline at end of file +var _0x2804=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','index','get','/:id','isAuthenticated','show','post','create','update','delete','multer','util','path'];(function(_0x5365d0,_0xb003b2){var _0x2fe817=function(_0x18f585){while(--_0x18f585){_0x5365d0['push'](_0x5365d0['shift']());}};_0x2fe817(++_0xb003b2);}(_0x2804,0xe7));var _0x4280=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2804[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x4280('0x0'));var util=require(_0x4280('0x1'));var path=require(_0x4280('0x2'));var timeout=require(_0x4280('0x3'));var express=require(_0x4280('0x4'));var router=express['Router']();var fs_extra=require(_0x4280('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4280('0x6'));var config=require(_0x4280('0x7'));var controller=require(_0x4280('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4280('0x9')]);router[_0x4280('0xa')](_0x4280('0xb'),auth[_0x4280('0xc')](),controller[_0x4280('0xd')]);router[_0x4280('0xe')]('/',auth[_0x4280('0xc')](),controller[_0x4280('0xf')]);router['put']('/:id',auth[_0x4280('0xc')](),controller[_0x4280('0x10')]);router[_0x4280('0x11')](_0x4280('0xb'),auth[_0x4280('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 0ca3dc5..1bd9299 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 _0x6723=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x180ac2,_0x219d65){var _0xfcaede=function(_0x728ebe){while(--_0x728ebe){_0x180ac2['push'](_0x180ac2['shift']());}};_0xfcaede(++_0x219d65);}(_0x6723,0x1d3));var _0x3672=function(_0xef9bf5,_0x2cd85e){_0xef9bf5=_0xef9bf5-0x0;var _0x5f4a92=_0x6723[_0xef9bf5];return _0x5f4a92;};'use strict';var Sequelize=require(_0x3672('0x0'));module['exports']={'type':{'type':Sequelize[_0x3672('0x1')](_0x3672('0x2'),_0x3672('0x3'),_0x3672('0x4'),_0x3672('0x5'),_0x3672('0x6')),'defaultValue':_0x3672('0x2')},'content':{'type':Sequelize[_0x3672('0x7')]},'key':{'type':Sequelize[_0x3672('0x7')]},'keyType':{'type':Sequelize[_0x3672('0x1')](_0x3672('0x2'),_0x3672('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x3672('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3672('0x7')]},'customField':{'type':Sequelize[_0x3672('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3672('0x7')]}}; \ No newline at end of file +var _0xda46=['variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x46bb87,_0x5a88fa){var _0x304cdc=function(_0x277021){while(--_0x277021){_0x46bb87['push'](_0x46bb87['shift']());}};_0x304cdc(++_0x5a88fa);}(_0xda46,0x70));var _0x6da4=function(_0x458c2e,_0x402b9f){_0x458c2e=_0x458c2e-0x0;var _0x20a82d=_0xda46[_0x458c2e];return _0x20a82d;};'use strict';var Sequelize=require(_0x6da4('0x0'));module[_0x6da4('0x1')]={'type':{'type':Sequelize[_0x6da4('0x2')](_0x6da4('0x3'),'variable',_0x6da4('0x4'),_0x6da4('0x5'),_0x6da4('0x6')),'defaultValue':_0x6da4('0x3')},'content':{'type':Sequelize[_0x6da4('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6da4('0x2')](_0x6da4('0x3'),_0x6da4('0x8'),_0x6da4('0x4'))},'keyContent':{'type':Sequelize[_0x6da4('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6da4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6da4('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 09678db..bad1629 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 _0x55e0=['destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','end','stack','name','index','FreshdeskField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','fields','includeAll','find','catch','create','body','params'];(function(_0x27ee5b,_0x2285e3){var _0x15bcf8=function(_0x17db72){while(--_0x17db72){_0x27ee5b['push'](_0x27ee5b['shift']());}};_0x15bcf8(++_0x2285e3);}(_0x55e0,0xdc));var _0x055e=function(_0x878c2d,_0x3c49b8){_0x878c2d=_0x878c2d-0x0;var _0x447781=_0x55e0[_0x878c2d];return _0x447781;};'use strict';var emlformat=require(_0x055e('0x0'));var rimraf=require(_0x055e('0x1'));var zipdir=require(_0x055e('0x2'));var jsonpatch=require(_0x055e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x055e('0x4'));var Mustache=require(_0x055e('0x5'));var util=require(_0x055e('0x6'));var path=require(_0x055e('0x7'));var sox=require(_0x055e('0x8'));var csv=require(_0x055e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x055e('0xa'));var squel=require('squel');var crypto=require(_0x055e('0xb'));var jsforce=require(_0x055e('0xc'));var deskjs=require(_0x055e('0xd'));var toCsv=require(_0x055e('0x9'));var querystring=require(_0x055e('0xe'));var Papa=require('papaparse');var Redis=require(_0x055e('0xf'));var authService=require(_0x055e('0x10'));var qs=require(_0x055e('0x11'));var as=require(_0x055e('0x12'));var hardwareService=require(_0x055e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x055e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x055e('0x15'));var db=require(_0x055e('0x16'))['db'];function respondWithStatusCode(_0x72d424,_0x101bc3){_0x101bc3=_0x101bc3||0xcc;return function(_0xc98c6a){if(_0xc98c6a){return _0x72d424[_0x055e('0x17')](_0x101bc3);}return _0x72d424[_0x055e('0x18')](_0x101bc3)['end']();};}function respondWithResult(_0x14064d,_0xb80d83){_0xb80d83=_0xb80d83||0xc8;return function(_0x3cfd14){if(_0x3cfd14){return _0x14064d[_0x055e('0x18')](_0xb80d83)[_0x055e('0x19')](_0x3cfd14);}};}function respondWithFilteredResult(_0x56af18,_0x230674){return function(_0x2fe55f){if(_0x2fe55f){var _0x111cdb=typeof _0x230674['offset']===_0x055e('0x1a')&&typeof _0x230674[_0x055e('0x1b')]===_0x055e('0x1a');var _0x2bad86=_0x2fe55f[_0x055e('0x1c')];var _0x4c85dd=_0x111cdb?0x0:_0x230674[_0x055e('0x1d')];var _0x2cf3de=_0x111cdb?_0x2fe55f[_0x055e('0x1c')]:_0x230674[_0x055e('0x1d')]+_0x230674['limit'];var _0x4004ce;if(_0x2cf3de>=_0x2bad86){_0x2cf3de=_0x2bad86;_0x4004ce=0xc8;}else{_0x4004ce=0xce;}_0x56af18[_0x055e('0x18')](_0x4004ce);return _0x56af18['set'](_0x055e('0x1e'),_0x4c85dd+'-'+_0x2cf3de+'/'+_0x2bad86)[_0x055e('0x19')](_0x2fe55f);}return null;};}function patchUpdates(_0x10258f){return function(_0x124d86){try{jsonpatch[_0x055e('0x1f')](_0x124d86,_0x10258f,!![]);}catch(_0x4675ff){return BPromise['reject'](_0x4675ff);}return _0x124d86[_0x055e('0x20')]();};}function saveUpdates(_0x2f0346,_0x211594){return function(_0x5930ff){if(_0x5930ff){return _0x5930ff[_0x055e('0x21')](_0x2f0346)[_0x055e('0x22')](function(_0x32c64e){return _0x32c64e;});}return null;};}function removeEntity(_0x37243b,_0x51df23){return function(_0x71a6e1){if(_0x71a6e1){return _0x71a6e1['destroy']()[_0x055e('0x22')](function(){_0x37243b[_0x055e('0x18')](0xcc)[_0x055e('0x23')]();});}};}function handleEntityNotFound(_0x1a76c6,_0x40c62a){return function(_0x4c653c){if(!_0x4c653c){_0x1a76c6['sendStatus'](0x194);}return _0x4c653c;};}function handleError(_0x2fb49b,_0x1f90a9){_0x1f90a9=_0x1f90a9||0x1f4;return function(_0x2a82f8){logger['error'](_0x2a82f8[_0x055e('0x24')]);if(_0x2a82f8[_0x055e('0x25')]){delete _0x2a82f8[_0x055e('0x25')];}_0x2fb49b[_0x055e('0x18')](_0x1f90a9)['send'](_0x2a82f8);};}exports[_0x055e('0x26')]=function(_0x5958ef,_0x1528c3){var _0x35def0={},_0x23a506={},_0x7822db={'count':0x0,'rows':[]};var _0x1610f1=_['map'](db[_0x055e('0x27')][_0x055e('0x28')],function(_0x293062){return{'name':_0x293062[_0x055e('0x29')],'type':_0x293062[_0x055e('0x2a')][_0x055e('0x2b')]};});_0x23a506[_0x055e('0x2c')]=_[_0x055e('0x2d')](_0x1610f1,'name');_0x23a506[_0x055e('0x2e')]=_[_0x055e('0x2f')](_0x5958ef['query']);_0x23a506[_0x055e('0x30')]=_[_0x055e('0x31')](_0x23a506[_0x055e('0x2c')],_0x23a506[_0x055e('0x2e')]);_0x35def0[_0x055e('0x32')]=_[_0x055e('0x31')](_0x23a506['model'],qs['fields'](_0x5958ef[_0x055e('0x2e')]['fields']));_0x35def0['attributes']=_0x35def0['attributes'][_0x055e('0x33')]?_0x35def0[_0x055e('0x32')]:_0x23a506[_0x055e('0x2c')];if(!_0x5958ef[_0x055e('0x2e')][_0x055e('0x34')](_0x055e('0x35'))){_0x35def0[_0x055e('0x1b')]=qs[_0x055e('0x1b')](_0x5958ef[_0x055e('0x2e')][_0x055e('0x1b')]);_0x35def0[_0x055e('0x1d')]=qs[_0x055e('0x1d')](_0x5958ef['query']['offset']);}_0x35def0[_0x055e('0x36')]=qs[_0x055e('0x37')](_0x5958ef[_0x055e('0x2e')][_0x055e('0x37')]);_0x35def0[_0x055e('0x38')]=qs[_0x055e('0x30')](_[_0x055e('0x39')](_0x5958ef['query'],_0x23a506[_0x055e('0x30')]),_0x1610f1);if(_0x5958ef[_0x055e('0x2e')][_0x055e('0x3a')]){_0x35def0[_0x055e('0x38')]=_[_0x055e('0x3b')](_0x35def0['where'],{'$or':_[_0x055e('0x2d')](_0x1610f1,function(_0x3017f4){if(_0x3017f4['type']!==_0x055e('0x3c')){var _0x1a109f={};_0x1a109f[_0x3017f4['name']]={'$like':'%'+_0x5958ef[_0x055e('0x2e')][_0x055e('0x3a')]+'%'};return _0x1a109f;}})});}_0x35def0=_['merge']({},_0x35def0,_0x5958ef[_0x055e('0x3d')]);var _0x233423={'where':_0x35def0['where']};return db[_0x055e('0x27')][_0x055e('0x1c')](_0x233423)[_0x055e('0x22')](function(_0x4ac128){_0x7822db[_0x055e('0x1c')]=_0x4ac128;if(_0x5958ef[_0x055e('0x2e')]['includeAll']){_0x35def0[_0x055e('0x3e')]=[{'all':!![]}];}return db[_0x055e('0x27')][_0x055e('0x3f')](_0x35def0);})['then'](function(_0x228eca){_0x7822db[_0x055e('0x40')]=_0x228eca;return _0x7822db;})[_0x055e('0x22')](respondWithFilteredResult(_0x1528c3,_0x35def0))['catch'](handleError(_0x1528c3,null));};exports['show']=function(_0x27c49c,_0x237318){var _0x4ff19e={'raw':!![],'where':{'id':_0x27c49c['params']['id']}},_0x3a5bc5={};_0x3a5bc5[_0x055e('0x2c')]=_['keys'](db[_0x055e('0x27')][_0x055e('0x28')]);_0x3a5bc5[_0x055e('0x2e')]=_['keys'](_0x27c49c['query']);_0x3a5bc5[_0x055e('0x30')]=_[_0x055e('0x31')](_0x3a5bc5[_0x055e('0x2c')],_0x3a5bc5[_0x055e('0x2e')]);_0x4ff19e['attributes']=_['intersection'](_0x3a5bc5[_0x055e('0x2c')],qs[_0x055e('0x41')](_0x27c49c['query'][_0x055e('0x41')]));_0x4ff19e[_0x055e('0x32')]=_0x4ff19e[_0x055e('0x32')][_0x055e('0x33')]?_0x4ff19e[_0x055e('0x32')]:_0x3a5bc5[_0x055e('0x2c')];if(_0x27c49c['query'][_0x055e('0x42')]){_0x4ff19e[_0x055e('0x3e')]=[{'all':!![]}];}_0x4ff19e=_['merge']({},_0x4ff19e,_0x27c49c[_0x055e('0x3d')]);return db[_0x055e('0x27')][_0x055e('0x43')](_0x4ff19e)[_0x055e('0x22')](handleEntityNotFound(_0x237318,null))[_0x055e('0x22')](respondWithResult(_0x237318,null))[_0x055e('0x44')](handleError(_0x237318,null));};exports[_0x055e('0x45')]=function(_0x4ee2f8,_0x35b2c6){return db['FreshdeskField'][_0x055e('0x45')](_0x4ee2f8[_0x055e('0x46')],{})[_0x055e('0x22')](respondWithResult(_0x35b2c6,0xc9))['catch'](handleError(_0x35b2c6,null));};exports['update']=function(_0x45845e,_0x20114c){if(_0x45845e[_0x055e('0x46')]['id']){delete _0x45845e[_0x055e('0x46')]['id'];}return db[_0x055e('0x27')][_0x055e('0x43')]({'where':{'id':_0x45845e[_0x055e('0x47')]['id']}})[_0x055e('0x22')](handleEntityNotFound(_0x20114c,null))[_0x055e('0x22')](saveUpdates(_0x45845e['body'],null))[_0x055e('0x22')](respondWithResult(_0x20114c,null))[_0x055e('0x44')](handleError(_0x20114c,null));};exports[_0x055e('0x48')]=function(_0x17695b,_0x335415){return db['FreshdeskField'][_0x055e('0x43')]({'where':{'id':_0x17695b[_0x055e('0x47')]['id']}})[_0x055e('0x22')](handleEntityNotFound(_0x335415,null))['then'](removeEntity(_0x335415,null))[_0x055e('0x44')](handleError(_0x335415,null));}; \ No newline at end of file +var _0xcea2=['undefined','limit','count','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','VIRTUAL','filter','merge','options','where','FreshdeskField','includeAll','include','findAll','rows','catch','params','length','find','create','body','update','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x599f31,_0x4cb05e){var _0x4d86f2=function(_0x117640){while(--_0x117640){_0x599f31['push'](_0x599f31['shift']());}};_0x4d86f2(++_0x4cb05e);}(_0xcea2,0x15a));var _0x2cea=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xcea2[_0x3e5086];return _0xfeb102;};'use strict';var emlformat=require(_0x2cea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2cea('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cea('0x2'));var moment=require(_0x2cea('0x3'));var BPromise=require(_0x2cea('0x4'));var Mustache=require('mustache');var util=require(_0x2cea('0x5'));var path=require(_0x2cea('0x6'));var sox=require(_0x2cea('0x7'));var csv=require('to-csv');var ejs=require(_0x2cea('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2cea('0x9'));var squel=require(_0x2cea('0xa'));var crypto=require(_0x2cea('0xb'));var jsforce=require(_0x2cea('0xc'));var deskjs=require(_0x2cea('0xd'));var toCsv=require(_0x2cea('0xe'));var querystring=require('querystring');var Papa=require(_0x2cea('0xf'));var Redis=require(_0x2cea('0x10'));var authService=require(_0x2cea('0x11'));var qs=require(_0x2cea('0x12'));var as=require(_0x2cea('0x13'));var hardwareService=require(_0x2cea('0x14'));var logger=require(_0x2cea('0x15'))(_0x2cea('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2cea('0x17'));var db=require(_0x2cea('0x18'))['db'];function respondWithStatusCode(_0x528c1d,_0x4bd265){_0x4bd265=_0x4bd265||0xcc;return function(_0x160eaf){if(_0x160eaf){return _0x528c1d['sendStatus'](_0x4bd265);}return _0x528c1d[_0x2cea('0x19')](_0x4bd265)[_0x2cea('0x1a')]();};}function respondWithResult(_0x4377b1,_0x5cf805){_0x5cf805=_0x5cf805||0xc8;return function(_0x4d7f8b){if(_0x4d7f8b){return _0x4377b1['status'](_0x5cf805)[_0x2cea('0x1b')](_0x4d7f8b);}};}function respondWithFilteredResult(_0x586ad5,_0x3c7130){return function(_0x338669){if(_0x338669){var _0x981e3f=typeof _0x3c7130[_0x2cea('0x1c')]===_0x2cea('0x1d')&&typeof _0x3c7130[_0x2cea('0x1e')]===_0x2cea('0x1d');var _0x1ead4c=_0x338669['count'];var _0x19927a=_0x981e3f?0x0:_0x3c7130[_0x2cea('0x1c')];var _0x20c46c=_0x981e3f?_0x338669[_0x2cea('0x1f')]:_0x3c7130[_0x2cea('0x1c')]+_0x3c7130[_0x2cea('0x1e')];var _0x5d75c4;if(_0x20c46c>=_0x1ead4c){_0x20c46c=_0x1ead4c;_0x5d75c4=0xc8;}else{_0x5d75c4=0xce;}_0x586ad5[_0x2cea('0x19')](_0x5d75c4);return _0x586ad5['set'](_0x2cea('0x20'),_0x19927a+'-'+_0x20c46c+'/'+_0x1ead4c)[_0x2cea('0x1b')](_0x338669);}return null;};}function patchUpdates(_0xa73bea){return function(_0x4fd3d5){try{jsonpatch[_0x2cea('0x21')](_0x4fd3d5,_0xa73bea,!![]);}catch(_0x22249e){return BPromise[_0x2cea('0x22')](_0x22249e);}return _0x4fd3d5[_0x2cea('0x23')]();};}function saveUpdates(_0x3246bc,_0x3f6f0e){return function(_0x10f13a){if(_0x10f13a){return _0x10f13a['update'](_0x3246bc)[_0x2cea('0x24')](function(_0x5e5b46){return _0x5e5b46;});}return null;};}function removeEntity(_0x7d88b9,_0x4926ff){return function(_0x3966d5){if(_0x3966d5){return _0x3966d5[_0x2cea('0x25')]()['then'](function(){_0x7d88b9[_0x2cea('0x19')](0xcc)[_0x2cea('0x1a')]();});}};}function handleEntityNotFound(_0x101314,_0xf0bfbe){return function(_0x3f3ee0){if(!_0x3f3ee0){_0x101314[_0x2cea('0x26')](0x194);}return _0x3f3ee0;};}function handleError(_0x5d032f,_0x4ec9b3){_0x4ec9b3=_0x4ec9b3||0x1f4;return function(_0x32b6a3){logger[_0x2cea('0x27')](_0x32b6a3[_0x2cea('0x28')]);if(_0x32b6a3[_0x2cea('0x29')]){delete _0x32b6a3[_0x2cea('0x29')];}_0x5d032f[_0x2cea('0x19')](_0x4ec9b3)[_0x2cea('0x2a')](_0x32b6a3);};}exports['index']=function(_0xff69ad,_0x128863){var _0x5f3fb4={},_0xfeb8bd={},_0xc398c5={'count':0x0,'rows':[]};var _0x271b2f=_[_0x2cea('0x2b')](db['FreshdeskField'][_0x2cea('0x2c')],function(_0x128934){return{'name':_0x128934['fieldName'],'type':_0x128934[_0x2cea('0x2d')][_0x2cea('0x2e')]};});_0xfeb8bd[_0x2cea('0x2f')]=_[_0x2cea('0x2b')](_0x271b2f,_0x2cea('0x29'));_0xfeb8bd[_0x2cea('0x30')]=_[_0x2cea('0x31')](_0xff69ad[_0x2cea('0x30')]);_0xfeb8bd[_0x2cea('0x32')]=_[_0x2cea('0x33')](_0xfeb8bd[_0x2cea('0x2f')],_0xfeb8bd['query']);_0x5f3fb4[_0x2cea('0x34')]=_[_0x2cea('0x33')](_0xfeb8bd[_0x2cea('0x2f')],qs[_0x2cea('0x35')](_0xff69ad['query']['fields']));_0x5f3fb4[_0x2cea('0x34')]=_0x5f3fb4[_0x2cea('0x34')]['length']?_0x5f3fb4[_0x2cea('0x34')]:_0xfeb8bd['model'];if(!_0xff69ad[_0x2cea('0x30')]['hasOwnProperty'](_0x2cea('0x36'))){_0x5f3fb4['limit']=qs[_0x2cea('0x1e')](_0xff69ad[_0x2cea('0x30')]['limit']);_0x5f3fb4[_0x2cea('0x1c')]=qs[_0x2cea('0x1c')](_0xff69ad['query'][_0x2cea('0x1c')]);}_0x5f3fb4[_0x2cea('0x37')]=qs[_0x2cea('0x38')](_0xff69ad[_0x2cea('0x30')][_0x2cea('0x38')]);_0x5f3fb4['where']=qs[_0x2cea('0x32')](_[_0x2cea('0x39')](_0xff69ad['query'],_0xfeb8bd['filters']),_0x271b2f);if(_0xff69ad[_0x2cea('0x30')]['filter']){_0x5f3fb4['where']=_['merge'](_0x5f3fb4['where'],{'$or':_[_0x2cea('0x2b')](_0x271b2f,function(_0xb5b358){if(_0xb5b358['type']!==_0x2cea('0x3a')){var _0x3e0683={};_0x3e0683[_0xb5b358[_0x2cea('0x29')]]={'$like':'%'+_0xff69ad['query'][_0x2cea('0x3b')]+'%'};return _0x3e0683;}})});}_0x5f3fb4=_[_0x2cea('0x3c')]({},_0x5f3fb4,_0xff69ad[_0x2cea('0x3d')]);var _0x37d175={'where':_0x5f3fb4[_0x2cea('0x3e')]};return db[_0x2cea('0x3f')][_0x2cea('0x1f')](_0x37d175)[_0x2cea('0x24')](function(_0x2cfa0e){_0xc398c5[_0x2cea('0x1f')]=_0x2cfa0e;if(_0xff69ad[_0x2cea('0x30')][_0x2cea('0x40')]){_0x5f3fb4[_0x2cea('0x41')]=[{'all':!![]}];}return db[_0x2cea('0x3f')][_0x2cea('0x42')](_0x5f3fb4);})[_0x2cea('0x24')](function(_0x36efa8){_0xc398c5[_0x2cea('0x43')]=_0x36efa8;return _0xc398c5;})['then'](respondWithFilteredResult(_0x128863,_0x5f3fb4))[_0x2cea('0x44')](handleError(_0x128863,null));};exports['show']=function(_0x29ab58,_0x1afbb9){var _0x22ce6b={'raw':!![],'where':{'id':_0x29ab58[_0x2cea('0x45')]['id']}},_0x5b5d71={};_0x5b5d71[_0x2cea('0x2f')]=_[_0x2cea('0x31')](db[_0x2cea('0x3f')][_0x2cea('0x2c')]);_0x5b5d71[_0x2cea('0x30')]=_['keys'](_0x29ab58['query']);_0x5b5d71[_0x2cea('0x32')]=_[_0x2cea('0x33')](_0x5b5d71['model'],_0x5b5d71[_0x2cea('0x30')]);_0x22ce6b['attributes']=_[_0x2cea('0x33')](_0x5b5d71['model'],qs[_0x2cea('0x35')](_0x29ab58[_0x2cea('0x30')][_0x2cea('0x35')]));_0x22ce6b[_0x2cea('0x34')]=_0x22ce6b[_0x2cea('0x34')][_0x2cea('0x46')]?_0x22ce6b[_0x2cea('0x34')]:_0x5b5d71[_0x2cea('0x2f')];if(_0x29ab58[_0x2cea('0x30')][_0x2cea('0x40')]){_0x22ce6b['include']=[{'all':!![]}];}_0x22ce6b=_[_0x2cea('0x3c')]({},_0x22ce6b,_0x29ab58[_0x2cea('0x3d')]);return db[_0x2cea('0x3f')][_0x2cea('0x47')](_0x22ce6b)['then'](handleEntityNotFound(_0x1afbb9,null))['then'](respondWithResult(_0x1afbb9,null))[_0x2cea('0x44')](handleError(_0x1afbb9,null));};exports[_0x2cea('0x48')]=function(_0xd922c6,_0x510e0f){return db[_0x2cea('0x3f')][_0x2cea('0x48')](_0xd922c6[_0x2cea('0x49')],{})[_0x2cea('0x24')](respondWithResult(_0x510e0f,0xc9))['catch'](handleError(_0x510e0f,null));};exports[_0x2cea('0x4a')]=function(_0x526e92,_0x4d1b77){if(_0x526e92[_0x2cea('0x49')]['id']){delete _0x526e92[_0x2cea('0x49')]['id'];}return db[_0x2cea('0x3f')][_0x2cea('0x47')]({'where':{'id':_0x526e92['params']['id']}})['then'](handleEntityNotFound(_0x4d1b77,null))[_0x2cea('0x24')](saveUpdates(_0x526e92[_0x2cea('0x49')],null))[_0x2cea('0x24')](respondWithResult(_0x4d1b77,null))[_0x2cea('0x44')](handleError(_0x4d1b77,null));};exports['destroy']=function(_0x4ec462,_0x5d7cb6){return db[_0x2cea('0x3f')][_0x2cea('0x47')]({'where':{'id':_0x4ec462[_0x2cea('0x45')]['id']}})[_0x2cea('0x24')](handleEntityNotFound(_0x5d7cb6,null))[_0x2cea('0x24')](removeEntity(_0x5d7cb6,null))[_0x2cea('0x44')](handleError(_0x5d7cb6,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index d18b01d..0e78d68 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 _0xfb3d=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId'];(function(_0x1e8bed,_0x32e41){var _0x39ee02=function(_0x2d4d29){while(--_0x2d4d29){_0x1e8bed['push'](_0x1e8bed['shift']());}};_0x39ee02(++_0x32e41);}(_0xfb3d,0x1ef));var _0xdfb3=function(_0x3bbd18,_0x351222){_0x3bbd18=_0x3bbd18-0x0;var _0x20b979=_0xfb3d[_0x3bbd18];return _0x20b979;};'use strict';var _=require(_0xdfb3('0x0'));var util=require(_0xdfb3('0x1'));var logger=require('../../config/logger')(_0xdfb3('0x2'));var moment=require(_0xdfb3('0x3'));var BPromise=require('bluebird');var rp=require(_0xdfb3('0x4'));var fs=require('fs');var path=require(_0xdfb3('0x5'));var rimraf=require(_0xdfb3('0x6'));var config=require(_0xdfb3('0x7'));var attributes=require(_0xdfb3('0x8'));module[_0xdfb3('0x9')]=function(_0x564a19,_0x4e0ed8){return _0x564a19[_0xdfb3('0xa')](_0xdfb3('0xb'),attributes,{'tableName':_0xdfb3('0xc'),'paranoid':![],'indexes':[{'name':_0xdfb3('0xd'),'fields':['idField',_0xdfb3('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6f0d=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x5e14a6,_0x7e2a85){_0x5e14a6=_0x5e14a6-0x0;var _0x5ab516=_0x6f0d[_0x5e14a6];return _0x5ab516;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'paranoid':![],'indexes':[{'name':_0xd6f0('0xc'),'fields':['idField','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 7a2123c..dfbfc4f 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 _0xb238=['../../config/environment','jayson/promise','http','request','then','info','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskField,\x20%s,\x20%s','result','catch','util','moment','randomstring'];(function(_0x650619,_0x430bbc){var _0x4e83e6=function(_0xdd4db2){while(--_0xdd4db2){_0x650619['push'](_0x650619['shift']());}};_0x4e83e6(++_0x430bbc);}(_0xb238,0x141));var _0x8b23=function(_0x5d9179,_0x55a8b5){_0x5d9179=_0x5d9179-0x0;var _0x1d2141=_0xb238[_0x5d9179];return _0x1d2141;};'use strict';var _=require('lodash');var util=require(_0x8b23('0x0'));var moment=require(_0x8b23('0x1'));var BPromise=require('bluebird');var rs=require(_0x8b23('0x2'));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(_0x8b23('0x3'));var jayson=require(_0x8b23('0x4'));var client=jayson['client'][_0x8b23('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x312cfa,_0x942664,_0x11e0d6){return new BPromise(function(_0x17a2fc,_0x11a868){return client[_0x8b23('0x6')](_0x312cfa,_0x11e0d6)[_0x8b23('0x7')](function(_0x1594b5){logger[_0x8b23('0x8')]('FreshdeskField,\x20%s,\x20%s',_0x942664,_0x8b23('0x9'));logger['debug'](_0x8b23('0xa'),_0x942664,_0x8b23('0x9'),JSON[_0x8b23('0xb')](_0x1594b5));if(_0x1594b5['error']){if(_0x1594b5[_0x8b23('0xc')][_0x8b23('0xd')]===0x1f4){logger[_0x8b23('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x942664,_0x1594b5[_0x8b23('0xc')][_0x8b23('0xe')]);return _0x11a868(_0x1594b5[_0x8b23('0xc')]['message']);}logger[_0x8b23('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x942664,_0x1594b5[_0x8b23('0xc')]['message']);return _0x17a2fc(_0x1594b5[_0x8b23('0xc')][_0x8b23('0xe')]);}else{logger[_0x8b23('0x8')](_0x8b23('0xf'),_0x942664,'request\x20sent');_0x17a2fc(_0x1594b5[_0x8b23('0x10')][_0x8b23('0xe')]);}})[_0x8b23('0x11')](function(_0x3091ed){logger[_0x8b23('0xc')](_0x8b23('0xf'),_0x942664,_0x3091ed);_0x11a868(_0x3091ed);});});} \ No newline at end of file +var _0x70f6=['http','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x70f6,0xa3));var _0x670f=function(_0xa62a6b,_0x50f390){_0xa62a6b=_0xa62a6b-0x0;var _0x57380b=_0x70f6[_0xa62a6b];return _0x57380b;};'use strict';var _=require(_0x670f('0x0'));var util=require(_0x670f('0x1'));var moment=require(_0x670f('0x2'));var BPromise=require(_0x670f('0x3'));var rs=require(_0x670f('0x4'));var fs=require('fs');var Redis=require(_0x670f('0x5'));var db=require(_0x670f('0x6'))['db'];var utils=require(_0x670f('0x7'));var logger=require(_0x670f('0x8'))('rpc');var config=require(_0x670f('0x9'));var jayson=require(_0x670f('0xa'));var client=jayson[_0x670f('0xb')][_0x670f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xcd3cfc,_0x54bf00,_0xeb611a){return new BPromise(function(_0x439431,_0x3a1b2a){return client[_0x670f('0xd')](_0xcd3cfc,_0xeb611a)['then'](function(_0x2cba94){logger[_0x670f('0xe')](_0x670f('0xf'),_0x54bf00,_0x670f('0x10'));logger[_0x670f('0x11')](_0x670f('0x12'),_0x54bf00,_0x670f('0x10'),JSON[_0x670f('0x13')](_0x2cba94));if(_0x2cba94[_0x670f('0x14')]){if(_0x2cba94[_0x670f('0x14')][_0x670f('0x15')]===0x1f4){logger[_0x670f('0x14')](_0x670f('0xf'),_0x54bf00,_0x2cba94[_0x670f('0x14')]['message']);return _0x3a1b2a(_0x2cba94[_0x670f('0x14')][_0x670f('0x16')]);}logger['error'](_0x670f('0xf'),_0x54bf00,_0x2cba94[_0x670f('0x14')]['message']);return _0x439431(_0x2cba94[_0x670f('0x14')][_0x670f('0x16')]);}else{logger[_0x670f('0xe')](_0x670f('0xf'),_0x54bf00,_0x670f('0x10'));_0x439431(_0x2cba94[_0x670f('0x17')][_0x670f('0x16')]);}})[_0x670f('0x18')](function(_0x4e5a3c){logger['error'](_0x670f('0xf'),_0x54bf00,_0x4e5a3c);_0x3a1b2a(_0x4e5a3c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index fda7c36..ce961cf 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 _0xaa88=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','index','/:id','isAuthenticated','show','get','getConfigurations','getFields','post','/:id/configurations','addConfiguration','put','update','delete','destroy','multer'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xaa88,0x137));var _0x8aa8=function(_0x3457b4,_0x4cd8f9){_0x3457b4=_0x3457b4-0x0;var _0xaa8fa9=_0xaa88[_0x3457b4];return _0xaa8fa9;};'use strict';var multer=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var path=require(_0x8aa8('0x2'));var timeout=require(_0x8aa8('0x3'));var express=require('express');var router=express[_0x8aa8('0x4')]();var fs_extra=require(_0x8aa8('0x5'));var auth=require(_0x8aa8('0x6'));var interaction=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var controller=require(_0x8aa8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8aa8('0xa')]);router['get'](_0x8aa8('0xb'),auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xd')]);router[_0x8aa8('0xe')]('/:id/configurations',auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xf')]);router[_0x8aa8('0xe')]('/:id/fields',auth[_0x8aa8('0xc')](),controller[_0x8aa8('0x10')]);router[_0x8aa8('0x11')]('/',auth[_0x8aa8('0xc')](),controller['create']);router[_0x8aa8('0x11')](_0x8aa8('0x12'),auth['isAuthenticated'](),controller[_0x8aa8('0x13')]);router[_0x8aa8('0x14')](_0x8aa8('0xb'),auth['isAuthenticated'](),controller[_0x8aa8('0x15')]);router[_0x8aa8('0x16')](_0x8aa8('0xb'),auth['isAuthenticated'](),controller[_0x8aa8('0x17')]);module['exports']=router; \ No newline at end of file +var _0xdb94=['isAuthenticated','getConfigurations','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./intFreshsalesAccount.controller','index','/:id','show','get','/:id/configurations'];(function(_0x5e637e,_0x34d3fb){var _0x12047b=function(_0x5b4b54){while(--_0x5b4b54){_0x5e637e['push'](_0x5e637e['shift']());}};_0x12047b(++_0x34d3fb);}(_0xdb94,0xab));var _0x4db9=function(_0x497a21,_0x4ad5c2){_0x497a21=_0x497a21-0x0;var _0x392169=_0xdb94[_0x497a21];return _0x392169;};'use strict';var multer=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var path=require(_0x4db9('0x2'));var timeout=require(_0x4db9('0x3'));var express=require(_0x4db9('0x4'));var router=express['Router']();var fs_extra=require(_0x4db9('0x5'));var auth=require(_0x4db9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4db9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4db9('0x8')]);router['get'](_0x4db9('0x9'),auth['isAuthenticated'](),controller[_0x4db9('0xa')]);router[_0x4db9('0xb')](_0x4db9('0xc'),auth[_0x4db9('0xd')](),controller[_0x4db9('0xe')]);router[_0x4db9('0xb')](_0x4db9('0xf'),auth[_0x4db9('0xd')](),controller[_0x4db9('0x10')]);router[_0x4db9('0x11')]('/',auth[_0x4db9('0xd')](),controller['create']);router[_0x4db9('0x11')](_0x4db9('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x4db9('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x4db9('0x13')]);router[_0x4db9('0x14')]('/:id',auth[_0x4db9('0xd')](),controller[_0x4db9('0x15')]);module[_0x4db9('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 45e1636..f5c57cb 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 _0x065e=['sequelize','STRING','username'];(function(_0x4f35f4,_0x51a8c3){var _0x2e9a70=function(_0x110aca){while(--_0x110aca){_0x4f35f4['push'](_0x4f35f4['shift']());}};_0x2e9a70(++_0x51a8c3);}(_0x065e,0x1a7));var _0xe065=function(_0x2468c3,_0x29433d){_0x2468c3=_0x2468c3-0x0;var _0x2f49fd=_0x065e[_0x2468c3];return _0x2f49fd;};'use strict';var Sequelize=require(_0xe065('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe065('0x1')],'unique':_0xe065('0x2')},'apiKey':{'type':Sequelize[_0xe065('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xe065('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xfef3=['sequelize','STRING','username','remoteUri'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xfef3,0x118));var _0x3fef=function(_0x25d73b,_0x15dae9){_0x25d73b=_0x25d73b-0x0;var _0x5f4b34=_0xfef3[_0x25d73b];return _0x5f4b34;};'use strict';var Sequelize=require(_0x3fef('0x0'));module['exports']={'name':{'type':Sequelize[_0x3fef('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3fef('0x1')],'unique':_0x3fef('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3fef('0x1')],'unique':_0x3fef('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 63ed5f0..9e2bcb3 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 _0x0be9=['index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','FreshsalesAccount','includeAll','include','findAll','rows','catch','show','params','create','body','find','getConfigurations','FreshsalesConfiguration','options','hasOwnProperty','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri','substring','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x0be9,0x177));var _0x90be=function(_0x3fd7e7,_0x278b79){_0x3fd7e7=_0x3fd7e7-0x0;var _0xe77ee0=_0x0be9[_0x3fd7e7];return _0xe77ee0;};'use strict';var emlformat=require(_0x90be('0x0'));var rimraf=require(_0x90be('0x1'));var zipdir=require(_0x90be('0x2'));var jsonpatch=require(_0x90be('0x3'));var rp=require(_0x90be('0x4'));var moment=require(_0x90be('0x5'));var BPromise=require(_0x90be('0x6'));var Mustache=require(_0x90be('0x7'));var util=require(_0x90be('0x8'));var path=require(_0x90be('0x9'));var sox=require('sox');var csv=require(_0x90be('0xa'));var ejs=require(_0x90be('0xb'));var fs=require('fs');var fs_extra=require(_0x90be('0xc'));var _=require(_0x90be('0xd'));var squel=require(_0x90be('0xe'));var crypto=require(_0x90be('0xf'));var jsforce=require(_0x90be('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x90be('0xa'));var querystring=require(_0x90be('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x90be('0x12'));var qs=require(_0x90be('0x13'));var as=require(_0x90be('0x14'));var hardwareService=require(_0x90be('0x15'));var logger=require(_0x90be('0x16'))('api');var utils=require(_0x90be('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x90be('0x18'))['db'];var integrations=require(_0x90be('0x19'));function respondWithStatusCode(_0x3d39a8,_0x132d2a){_0x132d2a=_0x132d2a||0xcc;return function(_0x477c7d){if(_0x477c7d){return _0x3d39a8['sendStatus'](_0x132d2a);}return _0x3d39a8[_0x90be('0x1a')](_0x132d2a)['end']();};}function respondWithResult(_0x569eee,_0x358d53){_0x358d53=_0x358d53||0xc8;return function(_0x49683c){if(_0x49683c){return _0x569eee[_0x90be('0x1a')](_0x358d53)[_0x90be('0x1b')](_0x49683c);}};}function respondWithFilteredResult(_0x154334,_0xe197b8){return function(_0x45234e){if(_0x45234e){var _0x3915fe=typeof _0xe197b8['offset']==='undefined'&&typeof _0xe197b8[_0x90be('0x1c')]===_0x90be('0x1d');var _0xf0b58=_0x45234e[_0x90be('0x1e')];var _0x2c1d54=_0x3915fe?0x0:_0xe197b8[_0x90be('0x1f')];var _0x528ba5=_0x3915fe?_0x45234e[_0x90be('0x1e')]:_0xe197b8[_0x90be('0x1f')]+_0xe197b8[_0x90be('0x1c')];var _0x2f9d01;if(_0x528ba5>=_0xf0b58){_0x528ba5=_0xf0b58;_0x2f9d01=0xc8;}else{_0x2f9d01=0xce;}_0x154334[_0x90be('0x1a')](_0x2f9d01);return _0x154334[_0x90be('0x20')](_0x90be('0x21'),_0x2c1d54+'-'+_0x528ba5+'/'+_0xf0b58)[_0x90be('0x1b')](_0x45234e);}return null;};}function patchUpdates(_0x4bd43e){return function(_0x4f32d8){try{jsonpatch[_0x90be('0x22')](_0x4f32d8,_0x4bd43e,!![]);}catch(_0x3f3541){return BPromise[_0x90be('0x23')](_0x3f3541);}return _0x4f32d8[_0x90be('0x24')]();};}function saveUpdates(_0x341530,_0x1f8899){return function(_0x46569e){if(_0x46569e){return _0x46569e[_0x90be('0x25')](_0x341530)[_0x90be('0x26')](function(_0x4a1edd){return _0x4a1edd;});}return null;};}function removeEntity(_0x119da5,_0x11dc1c){return function(_0x276fe2){if(_0x276fe2){return _0x276fe2[_0x90be('0x27')]()[_0x90be('0x26')](function(){_0x119da5[_0x90be('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x360767,_0x194504){return function(_0x5b09fa){if(!_0x5b09fa){_0x360767[_0x90be('0x28')](0x194);}return _0x5b09fa;};}function handleError(_0xf74e20,_0x2aaf77){_0x2aaf77=_0x2aaf77||0x1f4;return function(_0x58efac){logger[_0x90be('0x29')](_0x58efac[_0x90be('0x2a')]);if(_0x58efac[_0x90be('0x2b')]){delete _0x58efac[_0x90be('0x2b')];}_0xf74e20['status'](_0x2aaf77)[_0x90be('0x2c')](_0x58efac);};}exports[_0x90be('0x2d')]=function(_0x704578,_0x3a3da3){var _0xea0fdf={},_0x4e5402={},_0x4c0b42={'count':0x0,'rows':[]};var _0x2a43eb=_['map'](db['FreshsalesAccount'][_0x90be('0x2e')],function(_0x30d3ae){return{'name':_0x30d3ae[_0x90be('0x2f')],'type':_0x30d3ae[_0x90be('0x30')][_0x90be('0x31')]};});_0x4e5402[_0x90be('0x32')]=_[_0x90be('0x33')](_0x2a43eb,_0x90be('0x2b'));_0x4e5402[_0x90be('0x34')]=_[_0x90be('0x35')](_0x704578['query']);_0x4e5402[_0x90be('0x36')]=_[_0x90be('0x37')](_0x4e5402[_0x90be('0x32')],_0x4e5402[_0x90be('0x34')]);_0xea0fdf[_0x90be('0x38')]=_[_0x90be('0x37')](_0x4e5402[_0x90be('0x32')],qs[_0x90be('0x39')](_0x704578[_0x90be('0x34')][_0x90be('0x39')]));_0xea0fdf[_0x90be('0x38')]=_0xea0fdf[_0x90be('0x38')][_0x90be('0x3a')]?_0xea0fdf['attributes']:_0x4e5402[_0x90be('0x32')];if(!_0x704578[_0x90be('0x34')]['hasOwnProperty']('nolimit')){_0xea0fdf[_0x90be('0x1c')]=qs[_0x90be('0x1c')](_0x704578[_0x90be('0x34')][_0x90be('0x1c')]);_0xea0fdf[_0x90be('0x1f')]=qs[_0x90be('0x1f')](_0x704578['query']['offset']);}_0xea0fdf[_0x90be('0x3b')]=qs[_0x90be('0x3c')](_0x704578[_0x90be('0x34')][_0x90be('0x3c')]);_0xea0fdf['where']=qs[_0x90be('0x36')](_[_0x90be('0x3d')](_0x704578[_0x90be('0x34')],_0x4e5402['filters']),_0x2a43eb);if(_0x704578['query'][_0x90be('0x3e')]){_0xea0fdf[_0x90be('0x3f')]=_['merge'](_0xea0fdf[_0x90be('0x3f')],{'$or':_[_0x90be('0x33')](_0x2a43eb,function(_0x3abc39){if(_0x3abc39['type']!=='VIRTUAL'){var _0x2eb427={};_0x2eb427[_0x3abc39[_0x90be('0x2b')]]={'$like':'%'+_0x704578[_0x90be('0x34')][_0x90be('0x3e')]+'%'};return _0x2eb427;}})});}_0xea0fdf=_[_0x90be('0x40')]({},_0xea0fdf,_0x704578['options']);var _0x3a3ed0={'where':_0xea0fdf[_0x90be('0x3f')]};return db[_0x90be('0x41')]['count'](_0x3a3ed0)[_0x90be('0x26')](function(_0x241a3f){_0x4c0b42[_0x90be('0x1e')]=_0x241a3f;if(_0x704578[_0x90be('0x34')][_0x90be('0x42')]){_0xea0fdf[_0x90be('0x43')]=[{'all':!![]}];}return db[_0x90be('0x41')][_0x90be('0x44')](_0xea0fdf);})[_0x90be('0x26')](function(_0x347afa){_0x4c0b42[_0x90be('0x45')]=_0x347afa;return _0x4c0b42;})[_0x90be('0x26')](respondWithFilteredResult(_0x3a3da3,_0xea0fdf))[_0x90be('0x46')](handleError(_0x3a3da3,null));};exports[_0x90be('0x47')]=function(_0x533459,_0x3282fd){var _0x23f48c={'raw':![],'where':{'id':_0x533459[_0x90be('0x48')]['id']}},_0x4b72c4={};_0x4b72c4[_0x90be('0x32')]=_[_0x90be('0x35')](db[_0x90be('0x41')]['rawAttributes']);_0x4b72c4['query']=_[_0x90be('0x35')](_0x533459[_0x90be('0x34')]);_0x4b72c4[_0x90be('0x36')]=_[_0x90be('0x37')](_0x4b72c4[_0x90be('0x32')],_0x4b72c4[_0x90be('0x34')]);_0x23f48c[_0x90be('0x38')]=_[_0x90be('0x37')](_0x4b72c4['model'],qs[_0x90be('0x39')](_0x533459['query']['fields']));_0x23f48c[_0x90be('0x38')]=_0x23f48c[_0x90be('0x38')][_0x90be('0x3a')]?_0x23f48c[_0x90be('0x38')]:_0x4b72c4[_0x90be('0x32')];if(_0x533459[_0x90be('0x34')][_0x90be('0x42')]){_0x23f48c[_0x90be('0x43')]=[{'all':!![]}];}_0x23f48c=_['merge']({},_0x23f48c,_0x533459['options']);return db[_0x90be('0x41')]['find'](_0x23f48c)['then'](handleEntityNotFound(_0x3282fd,null))[_0x90be('0x26')](respondWithResult(_0x3282fd,null))[_0x90be('0x46')](handleError(_0x3282fd,null));};exports[_0x90be('0x49')]=function(_0x408cba,_0x322308){return db[_0x90be('0x41')][_0x90be('0x49')](_0x408cba[_0x90be('0x4a')],{})[_0x90be('0x26')](respondWithResult(_0x322308,0xc9))[_0x90be('0x46')](handleError(_0x322308,null));};exports[_0x90be('0x25')]=function(_0x33c154,_0x32f18c){if(_0x33c154[_0x90be('0x4a')]['id']){delete _0x33c154[_0x90be('0x4a')]['id'];}return db[_0x90be('0x41')]['find']({'where':{'id':_0x33c154['params']['id']}})[_0x90be('0x26')](handleEntityNotFound(_0x32f18c,null))[_0x90be('0x26')](saveUpdates(_0x33c154[_0x90be('0x4a')],null))[_0x90be('0x26')](respondWithResult(_0x32f18c,null))[_0x90be('0x46')](handleError(_0x32f18c,null));};exports[_0x90be('0x27')]=function(_0x3fd2a4,_0x5125f1){return db[_0x90be('0x41')][_0x90be('0x4b')]({'where':{'id':_0x3fd2a4['params']['id']}})['then'](handleEntityNotFound(_0x5125f1,null))[_0x90be('0x26')](removeEntity(_0x5125f1,null))[_0x90be('0x46')](handleError(_0x5125f1,null));};exports[_0x90be('0x4c')]=function(_0x524a46,_0x4a4ed5,_0x281158){var _0x4604a4={};var _0x98645e={};var _0x1d54e1;var _0x485e6c;return db[_0x90be('0x41')]['findOne']({'where':{'id':_0x524a46[_0x90be('0x48')]['id']}})[_0x90be('0x26')](handleEntityNotFound(_0x4a4ed5,null))['then'](function(_0x313ee0){if(_0x313ee0){_0x1d54e1=_0x313ee0;_0x98645e[_0x90be('0x32')]=_['keys'](db[_0x90be('0x4d')]['rawAttributes']);_0x98645e[_0x90be('0x34')]=_[_0x90be('0x35')](_0x524a46[_0x90be('0x34')]);_0x98645e[_0x90be('0x36')]=_[_0x90be('0x37')](_0x98645e[_0x90be('0x32')],_0x98645e[_0x90be('0x34')]);_0x4604a4[_0x90be('0x38')]=_[_0x90be('0x37')](_0x98645e[_0x90be('0x32')],qs[_0x90be('0x39')](_0x524a46[_0x90be('0x34')]['fields']));_0x4604a4[_0x90be('0x38')]=_0x4604a4[_0x90be('0x38')][_0x90be('0x3a')]?_0x4604a4[_0x90be('0x38')]:_0x98645e[_0x90be('0x32')];_0x4604a4[_0x90be('0x3b')]=qs[_0x90be('0x3c')](_0x524a46[_0x90be('0x34')][_0x90be('0x3c')]);_0x4604a4[_0x90be('0x3f')]=qs[_0x90be('0x36')](_[_0x90be('0x3d')](_0x524a46['query'],_0x98645e[_0x90be('0x36')]));if(_0x524a46[_0x90be('0x34')][_0x90be('0x3e')]){_0x4604a4[_0x90be('0x3f')]=_['merge'](_0x4604a4[_0x90be('0x3f')],{'$or':_['map'](_0x4604a4[_0x90be('0x38')],function(_0x34f5b4){var _0x3bb998={};_0x3bb998[_0x34f5b4]={'$like':'%'+_0x524a46['query']['filter']+'%'};return _0x3bb998;})});}_0x4604a4=_[_0x90be('0x40')]({},_0x4604a4,_0x524a46[_0x90be('0x4e')]);return _0x1d54e1[_0x90be('0x4c')](_0x4604a4);}})[_0x90be('0x26')](function(_0x50fce0){if(_0x50fce0){_0x485e6c=_0x50fce0['length'];if(!_0x524a46['query'][_0x90be('0x4f')](_0x90be('0x50'))){_0x4604a4['limit']=qs[_0x90be('0x1c')](_0x524a46['query'][_0x90be('0x1c')]);_0x4604a4[_0x90be('0x1f')]=qs[_0x90be('0x1f')](_0x524a46['query'][_0x90be('0x1f')]);}return _0x1d54e1['getConfigurations'](_0x4604a4);}})['then'](function(_0x450e31){if(_0x450e31){return _0x450e31?{'count':_0x485e6c,'rows':_0x450e31}:null;}})[_0x90be('0x26')](respondWithResult(_0x4a4ed5,null))[_0x90be('0x46')](handleError(_0x4a4ed5,null));};exports[_0x90be('0x51')]=function(_0x29c3c2,_0x1def9e,_0x3d718b){if(_0x29c3c2[_0x90be('0x4a')]['id']){delete _0x29c3c2['body']['id'];}return db[_0x90be('0x41')][_0x90be('0x52')]({'where':{'id':_0x29c3c2[_0x90be('0x48')]['id']}})[_0x90be('0x26')](handleEntityNotFound(_0x1def9e,null))['then'](function(_0xc7f409){if(_0xc7f409){_0x29c3c2[_0x90be('0x4a')][_0x90be('0x53')]=_0xc7f409['id'];_0x29c3c2[_0x90be('0x4a')][_0x90be('0x54')]=integrations[_0x90be('0x55')](_0x29c3c2[_0x90be('0x4a')][_0x90be('0x56')],_0x29c3c2[_0x90be('0x4a')]['type']);_0x29c3c2[_0x90be('0x4a')][_0x90be('0x57')]=integrations['getDescriptions'](_0x29c3c2['body'][_0x90be('0x56')],_0x29c3c2[_0x90be('0x4a')]['type']);return db[_0x90be('0x4d')]['create'](_0x29c3c2['body'],{'include':[{'model':db['FreshsalesField'],'as':'Subjects'},{'model':db[_0x90be('0x58')],'as':_0x90be('0x57')}]});}return null;})[_0x90be('0x26')](respondWithResult(_0x1def9e,null))[_0x90be('0x46')](handleError(_0x1def9e,null));};exports[_0x90be('0x59')]=function(_0x4df67b,_0x5d5976,_0x5d4af7){var _0x521589='';var _0x1c10d4='';return db[_0x90be('0x41')][_0x90be('0x52')]({'where':{'id':_0x4df67b[_0x90be('0x48')]['id']},'attributes':['id',_0x90be('0x5a'),_0x90be('0x5b'),'apiKey']})[_0x90be('0x26')](handleEntityNotFound(_0x5d5976,null))[_0x90be('0x26')](function(_0x1f8158){if(_0x1f8158){_0x1c10d4=_0x1f8158[_0x90be('0x5a')];_0x521589=_0x1f8158[_0x90be('0x5b')];var _0x29551=_0x1f8158[_0x90be('0x5b')]['slice'](-0x1);if(_0x29551==='/'){_0x521589=_0x521589[_0x90be('0x5c')](0x0,_0x521589['lastIndexOf'](_0x29551));}return rp({'method':'GET','uri':util[_0x90be('0x5d')](_0x90be('0x5e'),_0x521589,_0x90be('0x5f')),'headers':{'Authorization':_0x90be('0x60')+_0x1f8158['apiKey']},'json':!![]});}})['then'](function(_0x25b789){if(_0x25b789){var _0xa9b3d8=_0x25b789[_0x90be('0x61')];var _0x59c5c3=![];var _0x3acb14=null;for(_0x3acb14=0x0;_0x3acb14<_0xa9b3d8[_0x90be('0x3a')];_0x3acb14++){if(_0xa9b3d8[_0x3acb14][_0x90be('0x62')]===_0x1c10d4){_0x59c5c3=!![];}}if(_0x59c5c3){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x90be('0x63')});}}})[_0x90be('0x26')](respondWithResult(_0x5d5976,null))['catch'](function(_0x3be094){var _0x2112ec=_0x4df67b[_0x90be('0x34')]['test']?0x1f4:_0x3be094['statusCode']||0x1f4;logger[_0x90be('0x29')](_0x90be('0x64'),_0x90be('0x59'),_0x2112ec,JSON[_0x90be('0x65')](_0x3be094));delete _0x3be094[_0x90be('0x2b')];if(_0x2112ec===0x191){_0x2112ec=0x190;}_0x5d5976[_0x90be('0x1a')](_0x2112ec)[_0x90be('0x2c')](_0x4df67b[_0x90be('0x34')][_0x90be('0x66')]?{'message':_0x90be('0x67'),'statusCode':_0x3be094[_0x90be('0x68')]}:_0x3be094);});}; \ No newline at end of file +var _0xf030=['merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','fields','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','FreshsalesField','Descriptions','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','limit','undefined','offset','count','Content-Range','reject','save','update','then','destroy','name','send','index','FreshsalesAccount','type','key','model','map','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filters','where'];(function(_0x5612c8,_0x31d3aa){var _0x2105e2=function(_0xb66d85){while(--_0xb66d85){_0x5612c8['push'](_0x5612c8['shift']());}};_0x2105e2(++_0x31d3aa);}(_0xf030,0xf9));var _0x0f03=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf030[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x0f03('0x0'));var rimraf=require(_0x0f03('0x1'));var zipdir=require(_0x0f03('0x2'));var jsonpatch=require(_0x0f03('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0f03('0x4'));var util=require(_0x0f03('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x0f03('0x6'));var ejs=require(_0x0f03('0x7'));var fs=require('fs');var fs_extra=require(_0x0f03('0x8'));var _=require(_0x0f03('0x9'));var squel=require(_0x0f03('0xa'));var crypto=require(_0x0f03('0xb'));var jsforce=require(_0x0f03('0xc'));var deskjs=require(_0x0f03('0xd'));var toCsv=require(_0x0f03('0x6'));var querystring=require(_0x0f03('0xe'));var Papa=require('papaparse');var Redis=require(_0x0f03('0xf'));var authService=require(_0x0f03('0x10'));var qs=require(_0x0f03('0x11'));var as=require(_0x0f03('0x12'));var hardwareService=require(_0x0f03('0x13'));var logger=require(_0x0f03('0x14'))(_0x0f03('0x15'));var utils=require(_0x0f03('0x16'));var config=require(_0x0f03('0x17'));var licenseUtil=require(_0x0f03('0x18'));var db=require(_0x0f03('0x19'))['db'];var integrations=require(_0x0f03('0x1a'));function respondWithStatusCode(_0x1a00d8,_0x287ca6){_0x287ca6=_0x287ca6||0xcc;return function(_0x41b82f){if(_0x41b82f){return _0x1a00d8[_0x0f03('0x1b')](_0x287ca6);}return _0x1a00d8[_0x0f03('0x1c')](_0x287ca6)[_0x0f03('0x1d')]();};}function respondWithResult(_0x5c4e56,_0x36f224){_0x36f224=_0x36f224||0xc8;return function(_0x50a0b7){if(_0x50a0b7){return _0x5c4e56[_0x0f03('0x1c')](_0x36f224)[_0x0f03('0x1e')](_0x50a0b7);}};}function respondWithFilteredResult(_0x2c939a,_0x1aaa7c){return function(_0x22b66f){if(_0x22b66f){var _0x2f363c=typeof _0x1aaa7c['offset']==='undefined'&&typeof _0x1aaa7c[_0x0f03('0x1f')]===_0x0f03('0x20');var _0x4f4de1=_0x22b66f['count'];var _0x52dd73=_0x2f363c?0x0:_0x1aaa7c[_0x0f03('0x21')];var _0xf74ae=_0x2f363c?_0x22b66f[_0x0f03('0x22')]:_0x1aaa7c['offset']+_0x1aaa7c[_0x0f03('0x1f')];var _0x26078f;if(_0xf74ae>=_0x4f4de1){_0xf74ae=_0x4f4de1;_0x26078f=0xc8;}else{_0x26078f=0xce;}_0x2c939a['status'](_0x26078f);return _0x2c939a['set'](_0x0f03('0x23'),_0x52dd73+'-'+_0xf74ae+'/'+_0x4f4de1)[_0x0f03('0x1e')](_0x22b66f);}return null;};}function patchUpdates(_0x3f62cc){return function(_0x2014ff){try{jsonpatch['apply'](_0x2014ff,_0x3f62cc,!![]);}catch(_0x2e02e4){return BPromise[_0x0f03('0x24')](_0x2e02e4);}return _0x2014ff[_0x0f03('0x25')]();};}function saveUpdates(_0x4ef90d,_0x7d8ece){return function(_0x5067cd){if(_0x5067cd){return _0x5067cd[_0x0f03('0x26')](_0x4ef90d)[_0x0f03('0x27')](function(_0x22502e){return _0x22502e;});}return null;};}function removeEntity(_0x1ac54b,_0x38362e){return function(_0x1685ae){if(_0x1685ae){return _0x1685ae[_0x0f03('0x28')]()['then'](function(){_0x1ac54b[_0x0f03('0x1c')](0xcc)[_0x0f03('0x1d')]();});}};}function handleEntityNotFound(_0x521cf0,_0x362c0c){return function(_0x298546){if(!_0x298546){_0x521cf0['sendStatus'](0x194);}return _0x298546;};}function handleError(_0x58028e,_0x3bdc8c){_0x3bdc8c=_0x3bdc8c||0x1f4;return function(_0xb71128){logger['error'](_0xb71128['stack']);if(_0xb71128[_0x0f03('0x29')]){delete _0xb71128[_0x0f03('0x29')];}_0x58028e['status'](_0x3bdc8c)[_0x0f03('0x2a')](_0xb71128);};}exports[_0x0f03('0x2b')]=function(_0x2f449b,_0x4da92f){var _0x2f3948={},_0xb67018={},_0x45620b={'count':0x0,'rows':[]};var _0x14e67a=_['map'](db[_0x0f03('0x2c')]['rawAttributes'],function(_0x5de0dd){return{'name':_0x5de0dd['fieldName'],'type':_0x5de0dd[_0x0f03('0x2d')][_0x0f03('0x2e')]};});_0xb67018[_0x0f03('0x2f')]=_[_0x0f03('0x30')](_0x14e67a,'name');_0xb67018[_0x0f03('0x31')]=_[_0x0f03('0x32')](_0x2f449b[_0x0f03('0x31')]);_0xb67018['filters']=_[_0x0f03('0x33')](_0xb67018[_0x0f03('0x2f')],_0xb67018['query']);_0x2f3948['attributes']=_[_0x0f03('0x33')](_0xb67018['model'],qs['fields'](_0x2f449b[_0x0f03('0x31')]['fields']));_0x2f3948[_0x0f03('0x34')]=_0x2f3948[_0x0f03('0x34')][_0x0f03('0x35')]?_0x2f3948[_0x0f03('0x34')]:_0xb67018[_0x0f03('0x2f')];if(!_0x2f449b[_0x0f03('0x31')][_0x0f03('0x36')](_0x0f03('0x37'))){_0x2f3948['limit']=qs[_0x0f03('0x1f')](_0x2f449b[_0x0f03('0x31')][_0x0f03('0x1f')]);_0x2f3948[_0x0f03('0x21')]=qs[_0x0f03('0x21')](_0x2f449b[_0x0f03('0x31')][_0x0f03('0x21')]);}_0x2f3948[_0x0f03('0x38')]=qs[_0x0f03('0x39')](_0x2f449b['query'][_0x0f03('0x39')]);_0x2f3948['where']=qs[_0x0f03('0x3a')](_['pick'](_0x2f449b[_0x0f03('0x31')],_0xb67018[_0x0f03('0x3a')]),_0x14e67a);if(_0x2f449b[_0x0f03('0x31')]['filter']){_0x2f3948[_0x0f03('0x3b')]=_[_0x0f03('0x3c')](_0x2f3948[_0x0f03('0x3b')],{'$or':_[_0x0f03('0x30')](_0x14e67a,function(_0x112a46){if(_0x112a46[_0x0f03('0x2d')]!==_0x0f03('0x3d')){var _0x35787c={};_0x35787c[_0x112a46[_0x0f03('0x29')]]={'$like':'%'+_0x2f449b['query'][_0x0f03('0x3e')]+'%'};return _0x35787c;}})});}_0x2f3948=_['merge']({},_0x2f3948,_0x2f449b[_0x0f03('0x3f')]);var _0x497c7b={'where':_0x2f3948[_0x0f03('0x3b')]};return db[_0x0f03('0x2c')]['count'](_0x497c7b)[_0x0f03('0x27')](function(_0x254e2d){_0x45620b[_0x0f03('0x22')]=_0x254e2d;if(_0x2f449b['query'][_0x0f03('0x40')]){_0x2f3948[_0x0f03('0x41')]=[{'all':!![]}];}return db[_0x0f03('0x2c')][_0x0f03('0x42')](_0x2f3948);})[_0x0f03('0x27')](function(_0x84e6ed){_0x45620b['rows']=_0x84e6ed;return _0x45620b;})[_0x0f03('0x27')](respondWithFilteredResult(_0x4da92f,_0x2f3948))[_0x0f03('0x43')](handleError(_0x4da92f,null));};exports[_0x0f03('0x44')]=function(_0x42eff7,_0x10ff43){var _0x114848={'raw':![],'where':{'id':_0x42eff7[_0x0f03('0x45')]['id']}},_0x37d67c={};_0x37d67c['model']=_[_0x0f03('0x32')](db[_0x0f03('0x2c')][_0x0f03('0x46')]);_0x37d67c[_0x0f03('0x31')]=_[_0x0f03('0x32')](_0x42eff7[_0x0f03('0x31')]);_0x37d67c[_0x0f03('0x3a')]=_[_0x0f03('0x33')](_0x37d67c[_0x0f03('0x2f')],_0x37d67c[_0x0f03('0x31')]);_0x114848[_0x0f03('0x34')]=_[_0x0f03('0x33')](_0x37d67c[_0x0f03('0x2f')],qs[_0x0f03('0x47')](_0x42eff7[_0x0f03('0x31')][_0x0f03('0x47')]));_0x114848['attributes']=_0x114848[_0x0f03('0x34')]['length']?_0x114848[_0x0f03('0x34')]:_0x37d67c[_0x0f03('0x2f')];if(_0x42eff7[_0x0f03('0x31')][_0x0f03('0x40')]){_0x114848['include']=[{'all':!![]}];}_0x114848=_[_0x0f03('0x3c')]({},_0x114848,_0x42eff7[_0x0f03('0x3f')]);return db['FreshsalesAccount'][_0x0f03('0x48')](_0x114848)[_0x0f03('0x27')](handleEntityNotFound(_0x10ff43,null))[_0x0f03('0x27')](respondWithResult(_0x10ff43,null))[_0x0f03('0x43')](handleError(_0x10ff43,null));};exports[_0x0f03('0x49')]=function(_0x31f4c7,_0x18b7f1){return db[_0x0f03('0x2c')][_0x0f03('0x49')](_0x31f4c7['body'],{})['then'](respondWithResult(_0x18b7f1,0xc9))[_0x0f03('0x43')](handleError(_0x18b7f1,null));};exports['update']=function(_0x4a85ac,_0x547165){if(_0x4a85ac[_0x0f03('0x4a')]['id']){delete _0x4a85ac[_0x0f03('0x4a')]['id'];}return db['FreshsalesAccount'][_0x0f03('0x48')]({'where':{'id':_0x4a85ac[_0x0f03('0x45')]['id']}})[_0x0f03('0x27')](handleEntityNotFound(_0x547165,null))[_0x0f03('0x27')](saveUpdates(_0x4a85ac[_0x0f03('0x4a')],null))[_0x0f03('0x27')](respondWithResult(_0x547165,null))[_0x0f03('0x43')](handleError(_0x547165,null));};exports['destroy']=function(_0x3b9395,_0x1191b4){return db[_0x0f03('0x2c')][_0x0f03('0x48')]({'where':{'id':_0x3b9395[_0x0f03('0x45')]['id']}})['then'](handleEntityNotFound(_0x1191b4,null))[_0x0f03('0x27')](removeEntity(_0x1191b4,null))[_0x0f03('0x43')](handleError(_0x1191b4,null));};exports[_0x0f03('0x4b')]=function(_0x1bcd11,_0x5bdfbe,_0x5e0e12){var _0x37550f={};var _0x2d3cac={};var _0x299699;var _0x201ba2;return db['FreshsalesAccount'][_0x0f03('0x4c')]({'where':{'id':_0x1bcd11[_0x0f03('0x45')]['id']}})['then'](handleEntityNotFound(_0x5bdfbe,null))[_0x0f03('0x27')](function(_0x52fbc4){if(_0x52fbc4){_0x299699=_0x52fbc4;_0x2d3cac[_0x0f03('0x2f')]=_[_0x0f03('0x32')](db[_0x0f03('0x4d')][_0x0f03('0x46')]);_0x2d3cac[_0x0f03('0x31')]=_['keys'](_0x1bcd11[_0x0f03('0x31')]);_0x2d3cac[_0x0f03('0x3a')]=_[_0x0f03('0x33')](_0x2d3cac[_0x0f03('0x2f')],_0x2d3cac[_0x0f03('0x31')]);_0x37550f[_0x0f03('0x34')]=_[_0x0f03('0x33')](_0x2d3cac[_0x0f03('0x2f')],qs[_0x0f03('0x47')](_0x1bcd11['query']['fields']));_0x37550f[_0x0f03('0x34')]=_0x37550f['attributes'][_0x0f03('0x35')]?_0x37550f[_0x0f03('0x34')]:_0x2d3cac['model'];_0x37550f[_0x0f03('0x38')]=qs['sort'](_0x1bcd11['query'][_0x0f03('0x39')]);_0x37550f['where']=qs[_0x0f03('0x3a')](_['pick'](_0x1bcd11[_0x0f03('0x31')],_0x2d3cac['filters']));if(_0x1bcd11[_0x0f03('0x31')]['filter']){_0x37550f[_0x0f03('0x3b')]=_[_0x0f03('0x3c')](_0x37550f['where'],{'$or':_[_0x0f03('0x30')](_0x37550f[_0x0f03('0x34')],function(_0x3ad0b1){var _0x3472ec={};_0x3472ec[_0x3ad0b1]={'$like':'%'+_0x1bcd11[_0x0f03('0x31')][_0x0f03('0x3e')]+'%'};return _0x3472ec;})});}_0x37550f=_[_0x0f03('0x3c')]({},_0x37550f,_0x1bcd11[_0x0f03('0x3f')]);return _0x299699['getConfigurations'](_0x37550f);}})['then'](function(_0x34ee8b){if(_0x34ee8b){_0x201ba2=_0x34ee8b[_0x0f03('0x35')];if(!_0x1bcd11[_0x0f03('0x31')][_0x0f03('0x36')](_0x0f03('0x37'))){_0x37550f['limit']=qs[_0x0f03('0x1f')](_0x1bcd11[_0x0f03('0x31')]['limit']);_0x37550f[_0x0f03('0x21')]=qs['offset'](_0x1bcd11[_0x0f03('0x31')][_0x0f03('0x21')]);}return _0x299699['getConfigurations'](_0x37550f);}})['then'](function(_0x19d1ee){if(_0x19d1ee){return _0x19d1ee?{'count':_0x201ba2,'rows':_0x19d1ee}:null;}})[_0x0f03('0x27')](respondWithResult(_0x5bdfbe,null))[_0x0f03('0x43')](handleError(_0x5bdfbe,null));};exports['addConfiguration']=function(_0x586e20,_0x59b11e,_0xcb3f1b){if(_0x586e20[_0x0f03('0x4a')]['id']){delete _0x586e20[_0x0f03('0x4a')]['id'];}return db[_0x0f03('0x2c')][_0x0f03('0x4c')]({'where':{'id':_0x586e20[_0x0f03('0x45')]['id']}})[_0x0f03('0x27')](handleEntityNotFound(_0x59b11e,null))[_0x0f03('0x27')](function(_0x230d0a){if(_0x230d0a){_0x586e20[_0x0f03('0x4a')][_0x0f03('0x4e')]=_0x230d0a['id'];_0x586e20[_0x0f03('0x4a')][_0x0f03('0x4f')]=integrations[_0x0f03('0x50')](_0x586e20[_0x0f03('0x4a')]['channel'],_0x586e20[_0x0f03('0x4a')]['type']);_0x586e20[_0x0f03('0x4a')]['Descriptions']=integrations[_0x0f03('0x51')](_0x586e20[_0x0f03('0x4a')][_0x0f03('0x52')],_0x586e20[_0x0f03('0x4a')]['type']);return db['FreshsalesConfiguration'][_0x0f03('0x49')](_0x586e20[_0x0f03('0x4a')],{'include':[{'model':db[_0x0f03('0x53')],'as':_0x0f03('0x4f')},{'model':db['FreshsalesField'],'as':_0x0f03('0x54')}]});}return null;})[_0x0f03('0x27')](respondWithResult(_0x59b11e,null))[_0x0f03('0x43')](handleError(_0x59b11e,null));};exports[_0x0f03('0x55')]=function(_0x5c9405,_0x3f6ed0,_0x13d6d0){var _0x5f5c64='';var _0x18f19b='';return db[_0x0f03('0x2c')]['findOne']({'where':{'id':_0x5c9405[_0x0f03('0x45')]['id']},'attributes':['id',_0x0f03('0x56'),_0x0f03('0x57'),_0x0f03('0x58')]})['then'](handleEntityNotFound(_0x3f6ed0,null))[_0x0f03('0x27')](function(_0x82fcbd){if(_0x82fcbd){_0x18f19b=_0x82fcbd[_0x0f03('0x56')];_0x5f5c64=_0x82fcbd[_0x0f03('0x57')];var _0x417eb5=_0x82fcbd[_0x0f03('0x57')][_0x0f03('0x59')](-0x1);if(_0x417eb5==='/'){_0x5f5c64=_0x5f5c64[_0x0f03('0x5a')](0x0,_0x5f5c64[_0x0f03('0x5b')](_0x417eb5));}return rp({'method':_0x0f03('0x5c'),'uri':util[_0x0f03('0x5d')](_0x0f03('0x5e'),_0x5f5c64,'/api/selector/owners'),'headers':{'Authorization':_0x0f03('0x5f')+_0x82fcbd[_0x0f03('0x58')]},'json':!![]});}})[_0x0f03('0x27')](function(_0x1ad0ec){if(_0x1ad0ec){var _0x480132=_0x1ad0ec[_0x0f03('0x60')];var _0x21710d=![];var _0x5df60f=null;for(_0x5df60f=0x0;_0x5df60f<_0x480132[_0x0f03('0x35')];_0x5df60f++){if(_0x480132[_0x5df60f][_0x0f03('0x61')]===_0x18f19b){_0x21710d=!![];}}if(_0x21710d){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x0f03('0x62')});}}})[_0x0f03('0x27')](respondWithResult(_0x3f6ed0,null))[_0x0f03('0x43')](function(_0x439e77){var _0x2ef80d=_0x5c9405[_0x0f03('0x31')][_0x0f03('0x63')]?0x1f4:_0x439e77[_0x0f03('0x64')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x0f03('0x55'),_0x2ef80d,JSON[_0x0f03('0x65')](_0x439e77));delete _0x439e77[_0x0f03('0x29')];if(_0x2ef80d===0x191){_0x2ef80d=0x190;}_0x3f6ed0['status'](_0x2ef80d)['send'](_0x5c9405['query'][_0x0f03('0x63')]?{'message':_0x0f03('0x66'),'statusCode':_0x439e77[_0x0f03('0x64')]}:_0x439e77);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index b8b65c8..578ba1c 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 _0x0424=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','../../config/logger','api','moment','bluebird','path'];(function(_0x4c326b,_0x5cd692){var _0x20f6c0=function(_0x22d4aa){while(--_0x22d4aa){_0x4c326b['push'](_0x4c326b['shift']());}};_0x20f6c0(++_0x5cd692);}(_0x0424,0x159));var _0x4042=function(_0x292e87,_0x9b2eb5){_0x292e87=_0x292e87-0x0;var _0x5186f6=_0x0424[_0x292e87];return _0x5186f6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4042('0x0'))(_0x4042('0x1'));var moment=require(_0x4042('0x2'));var BPromise=require(_0x4042('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4042('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4042('0x5'));var integrations=require(_0x4042('0x6'));module[_0x4042('0x7')]=function(_0xc0fba0,_0x3abaf1){return _0xc0fba0[_0x4042('0x8')](_0x4042('0x9'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4137=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','lodash','util','../../config/logger','api'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4137,0xf8));var _0x7413=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4137[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var logger=require(_0x7413('0x2'))(_0x7413('0x3'));var moment=require(_0x7413('0x4'));var BPromise=require(_0x7413('0x5'));var rp=require(_0x7413('0x6'));var fs=require('fs');var path=require(_0x7413('0x7'));var rimraf=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var attributes=require(_0x7413('0xa'));var integrations=require(_0x7413('0xb'));module['exports']=function(_0xc808cd,_0x188d89){return _0xc808cd[_0x7413('0xc')](_0x7413('0xd'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index cc84a29..75136a3 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 _0x57ca=['then','debug','ShowFreshsalesAccount','find','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x448ca9,_0x3ddb4e){var _0x5e35a8=function(_0x175a4a){while(--_0x175a4a){_0x448ca9['push'](_0x448ca9['shift']());}};_0x5e35a8(++_0x3ddb4e);}(_0x57ca,0x108));var _0xa57c=function(_0x541c2b,_0x3c7b5f){_0x541c2b=_0x541c2b-0x0;var _0x377665=_0x57ca[_0x541c2b];return _0x377665;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});}exports[_0xa57c('0x15')]=function(_0x3d781d){var _0x93462c=this;return new Promise(function(_0xe3d505,_0x1fd0d8){return db[_0xa57c('0x16')][_0xa57c('0x17')]({'raw':_0x3d781d[_0xa57c('0x18')]?_0x3d781d['options'][_0xa57c('0x19')]===undefined?!![]:![]:!![],'where':_0x3d781d['options']?_0x3d781d['options'][_0xa57c('0x1a')]||null:null,'attributes':_0x3d781d[_0xa57c('0x18')]?_0x3d781d[_0xa57c('0x18')][_0xa57c('0x1b')]||null:null,'limit':_0x3d781d['options']?_0x3d781d[_0xa57c('0x18')][_0xa57c('0x1c')]||null:null,'include':_0x3d781d[_0xa57c('0x18')]?_0x3d781d[_0xa57c('0x18')][_0xa57c('0x1d')]?_[_0xa57c('0x1e')](_0x3d781d[_0xa57c('0x18')][_0xa57c('0x1d')],function(_0x2e99ed){return{'model':db[_0x2e99ed[_0xa57c('0x1f')]],'as':_0x2e99ed['as'],'attributes':_0x2e99ed[_0xa57c('0x1b')],'include':_0x2e99ed[_0xa57c('0x1d')]?_[_0xa57c('0x1e')](_0x2e99ed[_0xa57c('0x1d')],function(_0x431bec){return{'model':db[_0x431bec['model']],'as':_0x431bec['as'],'attributes':_0x431bec[_0xa57c('0x1b')],'include':_0x431bec[_0xa57c('0x1d')]?_[_0xa57c('0x1e')](_0x431bec[_0xa57c('0x1d')],function(_0x315ad7){return{'model':db[_0x315ad7[_0xa57c('0x1f')]],'as':_0x315ad7['as'],'attributes':_0x315ad7[_0xa57c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa57c('0x20')](function(_0x337f97){logger[_0xa57c('0xc')]('GetFreshsalesAccount',_0x3d781d);logger[_0xa57c('0x21')]('GetFreshsalesAccount',_0x3d781d,JSON['stringify'](_0x337f97));_0xe3d505(_0x337f97);})[_0xa57c('0x14')](function(_0x7d10ec){logger['error'](_0xa57c('0x15'),_0x7d10ec[_0xa57c('0x12')],_0x3d781d);_0x1fd0d8(_0x93462c[_0xa57c('0xf')](0x1f4,_0x7d10ec['message']));});});};exports[_0xa57c('0x22')]=function(_0x58d46f){var _0xf5f70c=this;return new Promise(function(_0x5464f2,_0x2a3bbe){return db['FreshsalesAccount'][_0xa57c('0x23')]({'raw':_0x58d46f['options']?_0x58d46f[_0xa57c('0x18')][_0xa57c('0x19')]===undefined?!![]:![]:!![],'where':_0x58d46f[_0xa57c('0x18')]?_0x58d46f[_0xa57c('0x18')][_0xa57c('0x1a')]||null:null,'attributes':_0x58d46f[_0xa57c('0x18')]?_0x58d46f[_0xa57c('0x18')]['attributes']||null:null,'include':_0x58d46f[_0xa57c('0x18')]?_0x58d46f['options'][_0xa57c('0x1d')]?_[_0xa57c('0x1e')](_0x58d46f[_0xa57c('0x18')]['include'],function(_0x289174){return{'model':db[_0x289174['model']],'as':_0x289174['as'],'attributes':_0x289174[_0xa57c('0x1b')],'include':_0x289174['include']?_[_0xa57c('0x1e')](_0x289174['include'],function(_0x433116){return{'model':db[_0x433116[_0xa57c('0x1f')]],'as':_0x433116['as'],'attributes':_0x433116['attributes'],'include':_0x433116[_0xa57c('0x1d')]?_['map'](_0x433116[_0xa57c('0x1d')],function(_0x5c56d3){return{'model':db[_0x5c56d3[_0xa57c('0x1f')]],'as':_0x5c56d3['as'],'attributes':_0x5c56d3[_0xa57c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa57c('0x20')](function(_0x62f697){logger[_0xa57c('0xc')](_0xa57c('0x22'),_0x58d46f);logger['debug']('ShowFreshsalesAccount',_0x58d46f,JSON[_0xa57c('0x24')](_0x62f697));_0x5464f2(_0x62f697);})[_0xa57c('0x14')](function(_0x2c70d6){logger['error'](_0xa57c('0x22'),_0x2c70d6['message'],_0x58d46f);_0x2a3bbe(_0xf5f70c[_0xa57c('0xf')](0x1f4,_0x2c70d6[_0xa57c('0x12')]));});});}; \ No newline at end of file +var _0x3e24=['limit','map','include','model','debug','stringify','ShowFreshsalesAccount','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','options','where','attributes'];(function(_0x9a181b,_0x3c0220){var _0x4962af=function(_0x1e3c78){while(--_0x1e3c78){_0x9a181b['push'](_0x9a181b['shift']());}};_0x4962af(++_0x3c0220);}(_0x3e24,0x167));var _0x43e2=function(_0x38e8b0,_0x5b8cb5){_0x38e8b0=_0x38e8b0-0x0;var _0x139697=_0x3e24[_0x38e8b0];return _0x139697;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var moment=require(_0x43e2('0x2'));var BPromise=require(_0x43e2('0x3'));var rs=require(_0x43e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43e2('0x5'))['db'];var utils=require(_0x43e2('0x6'));var logger=require('../../config/logger')(_0x43e2('0x7'));var config=require(_0x43e2('0x8'));var jayson=require(_0x43e2('0x9'));var client=jayson[_0x43e2('0xa')][_0x43e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x121e2e,_0x23b2d8,_0x59956d){return new BPromise(function(_0xb75b,_0x2357bc){return client['request'](_0x121e2e,_0x59956d)[_0x43e2('0xc')](function(_0x2fdf85){logger['info'](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));logger['debug'](_0x43e2('0xf'),_0x23b2d8,'request\x20sent',JSON['stringify'](_0x2fdf85));if(_0x2fdf85['error']){if(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x11')]===0x1f4){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0x2357bc(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);}logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0xb75b(_0x2fdf85['error'][_0x43e2('0x12')]);}else{logger[_0x43e2('0x13')](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));_0xb75b(_0x2fdf85['result']['message']);}})[_0x43e2('0x14')](function(_0x417ce5){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x417ce5);_0x2357bc(_0x417ce5);});});}exports[_0x43e2('0x15')]=function(_0x1b7cde){var _0x3ea010=this;return new Promise(function(_0x15ecb5,_0x3236b9){return db[_0x43e2('0x16')]['findAll']({'raw':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde[_0x43e2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde['options'][_0x43e2('0x18')]||null:null,'attributes':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde[_0x43e2('0x17')][_0x43e2('0x19')]||null:null,'limit':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde['options'][_0x43e2('0x1a')]||null:null,'include':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde[_0x43e2('0x17')]['include']?_[_0x43e2('0x1b')](_0x1b7cde[_0x43e2('0x17')][_0x43e2('0x1c')],function(_0x11b285){return{'model':db[_0x11b285['model']],'as':_0x11b285['as'],'attributes':_0x11b285[_0x43e2('0x19')],'include':_0x11b285[_0x43e2('0x1c')]?_[_0x43e2('0x1b')](_0x11b285[_0x43e2('0x1c')],function(_0x178223){return{'model':db[_0x178223[_0x43e2('0x1d')]],'as':_0x178223['as'],'attributes':_0x178223[_0x43e2('0x19')],'include':_0x178223[_0x43e2('0x1c')]?_[_0x43e2('0x1b')](_0x178223[_0x43e2('0x1c')],function(_0x1ea844){return{'model':db[_0x1ea844[_0x43e2('0x1d')]],'as':_0x1ea844['as'],'attributes':_0x1ea844['attributes']};}):[]};}):[]};}):[]:[]})[_0x43e2('0xc')](function(_0x2f2bd8){logger['info'](_0x43e2('0x15'),_0x1b7cde);logger[_0x43e2('0x1e')](_0x43e2('0x15'),_0x1b7cde,JSON[_0x43e2('0x1f')](_0x2f2bd8));_0x15ecb5(_0x2f2bd8);})[_0x43e2('0x14')](function(_0x5a896b){logger[_0x43e2('0x10')](_0x43e2('0x15'),_0x5a896b[_0x43e2('0x12')],_0x1b7cde);_0x3236b9(_0x3ea010[_0x43e2('0x10')](0x1f4,_0x5a896b[_0x43e2('0x12')]));});});};exports[_0x43e2('0x20')]=function(_0x53f797){var _0x51226b=this;return new Promise(function(_0xe09322,_0x1dcbc8){return db[_0x43e2('0x16')][_0x43e2('0x21')]({'raw':_0x53f797[_0x43e2('0x17')]?_0x53f797['options'][_0x43e2('0x22')]===undefined?!![]:![]:!![],'where':_0x53f797[_0x43e2('0x17')]?_0x53f797[_0x43e2('0x17')][_0x43e2('0x18')]||null:null,'attributes':_0x53f797[_0x43e2('0x17')]?_0x53f797[_0x43e2('0x17')][_0x43e2('0x19')]||null:null,'include':_0x53f797['options']?_0x53f797['options'][_0x43e2('0x1c')]?_[_0x43e2('0x1b')](_0x53f797['options'][_0x43e2('0x1c')],function(_0x34effb){return{'model':db[_0x34effb['model']],'as':_0x34effb['as'],'attributes':_0x34effb[_0x43e2('0x19')],'include':_0x34effb['include']?_['map'](_0x34effb['include'],function(_0x2bb489){return{'model':db[_0x2bb489['model']],'as':_0x2bb489['as'],'attributes':_0x2bb489[_0x43e2('0x19')],'include':_0x2bb489[_0x43e2('0x1c')]?_[_0x43e2('0x1b')](_0x2bb489[_0x43e2('0x1c')],function(_0x44670b){return{'model':db[_0x44670b[_0x43e2('0x1d')]],'as':_0x44670b['as'],'attributes':_0x44670b[_0x43e2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x43e2('0xc')](function(_0x1e9be1){logger[_0x43e2('0x13')](_0x43e2('0x20'),_0x53f797);logger[_0x43e2('0x1e')](_0x43e2('0x20'),_0x53f797,JSON[_0x43e2('0x1f')](_0x1e9be1));_0xe09322(_0x1e9be1);})[_0x43e2('0x14')](function(_0x40b39b){logger[_0x43e2('0x10')]('ShowFreshsalesAccount',_0x40b39b['message'],_0x53f797);_0x1dcbc8(_0x51226b['error'](0x1f4,_0x40b39b[_0x43e2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index b5cc3d0..7560c8e 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 _0x227e=['destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','getSubjects','getFields','post','create','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x227e,0x10c));var _0xe227=function(_0x3fec75,_0x523d63){_0x3fec75=_0x3fec75-0x0;var _0x1dc06=_0x227e[_0x3fec75];return _0x1dc06;};'use strict';var multer=require(_0xe227('0x0'));var util=require(_0xe227('0x1'));var path=require(_0xe227('0x2'));var timeout=require('connect-timeout');var express=require(_0xe227('0x3'));var router=express[_0xe227('0x4')]();var fs_extra=require(_0xe227('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe227('0x6'));var controller=require(_0xe227('0x7'));router[_0xe227('0x8')]('/',auth[_0xe227('0x9')](),controller[_0xe227('0xa')]);router['get'](_0xe227('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xe227('0x8')]('/:id/subjects',auth[_0xe227('0x9')](),controller[_0xe227('0xc')]);router[_0xe227('0x8')]('/:id/descriptions',auth[_0xe227('0x9')](),controller['getDescriptions']);router[_0xe227('0x8')]('/:id/fields',auth[_0xe227('0x9')](),controller[_0xe227('0xd')]);router[_0xe227('0xe')]('/',auth[_0xe227('0x9')](),controller[_0xe227('0xf')]);router[_0xe227('0x10')](_0xe227('0xb'),auth[_0xe227('0x9')](),controller['update']);router['delete'](_0xe227('0xb'),auth[_0xe227('0x9')](),controller[_0xe227('0x11')]);module[_0xe227('0x12')]=router; \ No newline at end of file +var _0x75b2=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0xf307f4,_0xb2be8c){var _0x3c6502=function(_0x172213){while(--_0x172213){_0xf307f4['push'](_0xf307f4['shift']());}};_0x3c6502(++_0xb2be8c);}(_0x75b2,0x100));var _0x275b=function(_0x1d4376,_0x3c09b1){_0x1d4376=_0x1d4376-0x0;var _0x33c20f=_0x75b2[_0x1d4376];return _0x33c20f;};'use strict';var multer=require(_0x275b('0x0'));var util=require('util');var path=require(_0x275b('0x1'));var timeout=require(_0x275b('0x2'));var express=require(_0x275b('0x3'));var router=express[_0x275b('0x4')]();var fs_extra=require(_0x275b('0x5'));var auth=require(_0x275b('0x6'));var interaction=require(_0x275b('0x7'));var config=require(_0x275b('0x8'));var controller=require(_0x275b('0x9'));router[_0x275b('0xa')]('/',auth[_0x275b('0xb')](),controller[_0x275b('0xc')]);router[_0x275b('0xa')](_0x275b('0xd'),auth['isAuthenticated'](),controller[_0x275b('0xe')]);router[_0x275b('0xa')](_0x275b('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x275b('0x10'),auth['isAuthenticated'](),controller[_0x275b('0x11')]);router['get'](_0x275b('0x12'),auth[_0x275b('0xb')](),controller['getFields']);router[_0x275b('0x13')]('/',auth['isAuthenticated'](),controller[_0x275b('0x14')]);router[_0x275b('0x15')](_0x275b('0xd'),auth['isAuthenticated'](),controller[_0x275b('0x16')]);router[_0x275b('0x17')](_0x275b('0xd'),auth[_0x275b('0xb')](),controller[_0x275b('0x18')]);module[_0x275b('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index d8f48cd..135edf6 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 _0x9f8a=['exports','STRING','sequelize'];(function(_0x4c66e0,_0x2a6d3b){var _0x58e2dc=function(_0x2d9b99){while(--_0x2d9b99){_0x4c66e0['push'](_0x4c66e0['shift']());}};_0x58e2dc(++_0x2a6d3b);}(_0x9f8a,0x89));var _0xa9f8=function(_0x5191be,_0x352e85){_0x5191be=_0x5191be-0x0;var _0x40ee04=_0x9f8a[_0x5191be];return _0x40ee04;};'use strict';var Sequelize=require(_0xa9f8('0x0'));module[_0xa9f8('0x1')]={'name':{'type':Sequelize[_0xa9f8('0x2')]},'description':{'type':Sequelize[_0xa9f8('0x2')]}}; \ No newline at end of file +var _0xb73c=['sequelize','STRING'];(function(_0x55e1d1,_0x3c9376){var _0x1165db=function(_0x5b0120){while(--_0x5b0120){_0x55e1d1['push'](_0x55e1d1['shift']());}};_0x1165db(++_0x3c9376);}(_0xb73c,0x18e));var _0xcb73=function(_0x5704cf,_0x3f078a){_0x5704cf=_0x5704cf-0x0;var _0x57e7fc=_0xb73c[_0x5704cf];return _0x57e7fc;};'use strict';var Sequelize=require(_0xcb73('0x0'));module['exports']={'name':{'type':Sequelize[_0xcb73('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index b9fa6a8..f511ed6 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 _0x22cd=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','filter','where','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','getSubjects','findOne','sort','hasOwnProperty','nolimit','getDescriptions','getFields','FreshsalesField','pick','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api'];(function(_0xbf2c9f,_0x274f21){var _0x5d91ae=function(_0x8e926f){while(--_0x8e926f){_0xbf2c9f['push'](_0xbf2c9f['shift']());}};_0x5d91ae(++_0x274f21);}(_0x22cd,0x126));var _0xd22c=function(_0x644ecd,_0x397f36){_0x644ecd=_0x644ecd-0x0;var _0x1c66ce=_0x22cd[_0x644ecd];return _0x1c66ce;};'use strict';var emlformat=require(_0xd22c('0x0'));var rimraf=require(_0xd22c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd22c('0x2'));var moment=require(_0xd22c('0x3'));var BPromise=require(_0xd22c('0x4'));var Mustache=require(_0xd22c('0x5'));var util=require(_0xd22c('0x6'));var path=require(_0xd22c('0x7'));var sox=require(_0xd22c('0x8'));var csv=require(_0xd22c('0x9'));var ejs=require(_0xd22c('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(_0xd22c('0xb'));var deskjs=require(_0xd22c('0xc'));var toCsv=require(_0xd22c('0x9'));var querystring=require('querystring');var Papa=require(_0xd22c('0xd'));var Redis=require(_0xd22c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd22c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd22c('0x10'));var logger=require('../../config/logger')(_0xd22c('0x11'));var utils=require(_0xd22c('0x12'));var config=require(_0xd22c('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xd22c('0x14'))['db'];function respondWithStatusCode(_0x38d218,_0x1dcdaf){_0x1dcdaf=_0x1dcdaf||0xcc;return function(_0x5a9a30){if(_0x5a9a30){return _0x38d218[_0xd22c('0x15')](_0x1dcdaf);}return _0x38d218[_0xd22c('0x16')](_0x1dcdaf)[_0xd22c('0x17')]();};}function respondWithResult(_0x21bf13,_0x575b03){_0x575b03=_0x575b03||0xc8;return function(_0x571424){if(_0x571424){return _0x21bf13[_0xd22c('0x16')](_0x575b03)[_0xd22c('0x18')](_0x571424);}};}function respondWithFilteredResult(_0x526d7b,_0x599acf){return function(_0xc9e0ba){if(_0xc9e0ba){var _0x568091=typeof _0x599acf[_0xd22c('0x19')]===_0xd22c('0x1a')&&typeof _0x599acf[_0xd22c('0x1b')]===_0xd22c('0x1a');var _0x15f939=_0xc9e0ba[_0xd22c('0x1c')];var _0x35b0a6=_0x568091?0x0:_0x599acf[_0xd22c('0x19')];var _0x259501=_0x568091?_0xc9e0ba['count']:_0x599acf[_0xd22c('0x19')]+_0x599acf[_0xd22c('0x1b')];var _0x4737dc;if(_0x259501>=_0x15f939){_0x259501=_0x15f939;_0x4737dc=0xc8;}else{_0x4737dc=0xce;}_0x526d7b['status'](_0x4737dc);return _0x526d7b['set'](_0xd22c('0x1d'),_0x35b0a6+'-'+_0x259501+'/'+_0x15f939)[_0xd22c('0x18')](_0xc9e0ba);}return null;};}function patchUpdates(_0x2ae26b){return function(_0x40082a){try{jsonpatch[_0xd22c('0x1e')](_0x40082a,_0x2ae26b,!![]);}catch(_0x25af89){return BPromise['reject'](_0x25af89);}return _0x40082a[_0xd22c('0x1f')]();};}function saveUpdates(_0x40bc13,_0x456261){return function(_0xaf644e){if(_0xaf644e){return _0xaf644e[_0xd22c('0x20')](_0x40bc13)[_0xd22c('0x21')](function(_0x387c3e){return _0x387c3e;});}return null;};}function removeEntity(_0x405bd3,_0x3ab885){return function(_0x48bf6f){if(_0x48bf6f){return _0x48bf6f[_0xd22c('0x22')]()[_0xd22c('0x21')](function(){_0x405bd3[_0xd22c('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x211a78,_0x5ee491){return function(_0x5c7db2){if(!_0x5c7db2){_0x211a78[_0xd22c('0x15')](0x194);}return _0x5c7db2;};}function handleError(_0x55665a,_0x173b57){_0x173b57=_0x173b57||0x1f4;return function(_0x3b6bce){logger[_0xd22c('0x23')](_0x3b6bce[_0xd22c('0x24')]);if(_0x3b6bce[_0xd22c('0x25')]){delete _0x3b6bce[_0xd22c('0x25')];}_0x55665a[_0xd22c('0x16')](_0x173b57)[_0xd22c('0x26')](_0x3b6bce);};}exports[_0xd22c('0x27')]=function(_0x31a6e8,_0x1328f6){var _0x5220cb={},_0x22411f={},_0x21e475={'count':0x0,'rows':[]};var _0x2bbc3a=_[_0xd22c('0x28')](db[_0xd22c('0x29')]['rawAttributes'],function(_0x2234be){return{'name':_0x2234be[_0xd22c('0x2a')],'type':_0x2234be[_0xd22c('0x2b')][_0xd22c('0x2c')]};});_0x22411f[_0xd22c('0x2d')]=_[_0xd22c('0x28')](_0x2bbc3a,_0xd22c('0x25'));_0x22411f[_0xd22c('0x2e')]=_[_0xd22c('0x2f')](_0x31a6e8['query']);_0x22411f[_0xd22c('0x30')]=_[_0xd22c('0x31')](_0x22411f[_0xd22c('0x2d')],_0x22411f['query']);_0x5220cb[_0xd22c('0x32')]=_['intersection'](_0x22411f[_0xd22c('0x2d')],qs[_0xd22c('0x33')](_0x31a6e8['query'][_0xd22c('0x33')]));_0x5220cb[_0xd22c('0x32')]=_0x5220cb['attributes'][_0xd22c('0x34')]?_0x5220cb[_0xd22c('0x32')]:_0x22411f[_0xd22c('0x2d')];if(!_0x31a6e8[_0xd22c('0x2e')]['hasOwnProperty']('nolimit')){_0x5220cb['limit']=qs[_0xd22c('0x1b')](_0x31a6e8[_0xd22c('0x2e')][_0xd22c('0x1b')]);_0x5220cb[_0xd22c('0x19')]=qs[_0xd22c('0x19')](_0x31a6e8['query'][_0xd22c('0x19')]);}_0x5220cb[_0xd22c('0x35')]=qs['sort'](_0x31a6e8['query']['sort']);_0x5220cb['where']=qs[_0xd22c('0x30')](_['pick'](_0x31a6e8[_0xd22c('0x2e')],_0x22411f[_0xd22c('0x30')]),_0x2bbc3a);if(_0x31a6e8['query'][_0xd22c('0x36')]){_0x5220cb[_0xd22c('0x37')]=_['merge'](_0x5220cb[_0xd22c('0x37')],{'$or':_[_0xd22c('0x28')](_0x2bbc3a,function(_0x4c3231){if(_0x4c3231[_0xd22c('0x2b')]!=='VIRTUAL'){var _0x20d889={};_0x20d889[_0x4c3231[_0xd22c('0x25')]]={'$like':'%'+_0x31a6e8[_0xd22c('0x2e')][_0xd22c('0x36')]+'%'};return _0x20d889;}})});}_0x5220cb=_[_0xd22c('0x38')]({},_0x5220cb,_0x31a6e8[_0xd22c('0x39')]);var _0x391570={'where':_0x5220cb[_0xd22c('0x37')]};return db[_0xd22c('0x29')]['count'](_0x391570)['then'](function(_0x10dfbe){_0x21e475[_0xd22c('0x1c')]=_0x10dfbe;if(_0x31a6e8[_0xd22c('0x2e')][_0xd22c('0x3a')]){_0x5220cb[_0xd22c('0x3b')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xd22c('0x3c')](_0x5220cb);})['then'](function(_0x528418){_0x21e475[_0xd22c('0x3d')]=_0x528418;return _0x21e475;})[_0xd22c('0x21')](respondWithFilteredResult(_0x1328f6,_0x5220cb))['catch'](handleError(_0x1328f6,null));};exports[_0xd22c('0x3e')]=function(_0x5cacb2,_0x24a94f){var _0xa24cd9={'raw':![],'where':{'id':_0x5cacb2[_0xd22c('0x3f')]['id']}},_0x1a41d8={};_0x1a41d8[_0xd22c('0x2d')]=_[_0xd22c('0x2f')](db[_0xd22c('0x29')][_0xd22c('0x40')]);_0x1a41d8['query']=_[_0xd22c('0x2f')](_0x5cacb2[_0xd22c('0x2e')]);_0x1a41d8['filters']=_['intersection'](_0x1a41d8['model'],_0x1a41d8[_0xd22c('0x2e')]);_0xa24cd9[_0xd22c('0x32')]=_[_0xd22c('0x31')](_0x1a41d8['model'],qs[_0xd22c('0x33')](_0x5cacb2['query'][_0xd22c('0x33')]));_0xa24cd9[_0xd22c('0x32')]=_0xa24cd9[_0xd22c('0x32')][_0xd22c('0x34')]?_0xa24cd9[_0xd22c('0x32')]:_0x1a41d8[_0xd22c('0x2d')];if(_0x5cacb2[_0xd22c('0x2e')][_0xd22c('0x3a')]){_0xa24cd9[_0xd22c('0x3b')]=[{'all':!![]}];}_0xa24cd9=_[_0xd22c('0x38')]({},_0xa24cd9,_0x5cacb2[_0xd22c('0x39')]);return db[_0xd22c('0x29')][_0xd22c('0x41')](_0xa24cd9)['then'](handleEntityNotFound(_0x24a94f,null))[_0xd22c('0x21')](respondWithResult(_0x24a94f,null))[_0xd22c('0x42')](handleError(_0x24a94f,null));};exports['create']=function(_0x1fae34,_0x1d8057){return db[_0xd22c('0x29')][_0xd22c('0x43')](_0x1fae34[_0xd22c('0x44')],{})[_0xd22c('0x21')](respondWithResult(_0x1d8057,0xc9))[_0xd22c('0x42')](handleError(_0x1d8057,null));};exports['update']=function(_0x2758e5,_0x1b9048){if(_0x2758e5[_0xd22c('0x44')]['id']){delete _0x2758e5[_0xd22c('0x44')]['id'];}return db[_0xd22c('0x29')][_0xd22c('0x41')]({'where':{'id':_0x2758e5[_0xd22c('0x3f')]['id']}})[_0xd22c('0x21')](handleEntityNotFound(_0x1b9048,null))[_0xd22c('0x21')](saveUpdates(_0x2758e5[_0xd22c('0x44')],null))[_0xd22c('0x21')](respondWithResult(_0x1b9048,null))['catch'](handleError(_0x1b9048,null));};exports[_0xd22c('0x22')]=function(_0x5a869f,_0x203301){return db[_0xd22c('0x29')][_0xd22c('0x41')]({'where':{'id':_0x5a869f[_0xd22c('0x3f')]['id']}})[_0xd22c('0x21')](handleEntityNotFound(_0x203301,null))[_0xd22c('0x21')](removeEntity(_0x203301,null))[_0xd22c('0x42')](handleError(_0x203301,null));};exports[_0xd22c('0x45')]=function(_0x27edc1,_0x3ca147,_0x3b2fd5){var _0x41e0c1={};var _0x3a5ad7={};var _0x591250;var _0x37c1e6;return db['FreshsalesConfiguration'][_0xd22c('0x46')]({'where':{'id':_0x27edc1[_0xd22c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3ca147,null))['then'](function(_0x1ba491){if(_0x1ba491){_0x591250=_0x1ba491;_0x3a5ad7['model']=_['keys'](db['FreshsalesField'][_0xd22c('0x40')]);_0x3a5ad7[_0xd22c('0x2e')]=_['keys'](_0x27edc1[_0xd22c('0x2e')]);_0x3a5ad7[_0xd22c('0x30')]=_[_0xd22c('0x31')](_0x3a5ad7[_0xd22c('0x2d')],_0x3a5ad7[_0xd22c('0x2e')]);_0x41e0c1[_0xd22c('0x32')]=_[_0xd22c('0x31')](_0x3a5ad7[_0xd22c('0x2d')],qs['fields'](_0x27edc1[_0xd22c('0x2e')][_0xd22c('0x33')]));_0x41e0c1['attributes']=_0x41e0c1[_0xd22c('0x32')][_0xd22c('0x34')]?_0x41e0c1['attributes']:_0x3a5ad7[_0xd22c('0x2d')];_0x41e0c1[_0xd22c('0x35')]=qs['sort'](_0x27edc1[_0xd22c('0x2e')][_0xd22c('0x47')]);_0x41e0c1[_0xd22c('0x37')]=qs[_0xd22c('0x30')](_['pick'](_0x27edc1[_0xd22c('0x2e')],_0x3a5ad7[_0xd22c('0x30')]));if(_0x27edc1[_0xd22c('0x2e')][_0xd22c('0x36')]){_0x41e0c1['where']=_['merge'](_0x41e0c1[_0xd22c('0x37')],{'$or':_[_0xd22c('0x28')](_0x41e0c1['attributes'],function(_0x5afd4c){var _0x58220d={};_0x58220d[_0x5afd4c]={'$like':'%'+_0x27edc1[_0xd22c('0x2e')]['filter']+'%'};return _0x58220d;})});}_0x41e0c1=_['merge']({},_0x41e0c1,_0x27edc1['options']);return _0x591250[_0xd22c('0x45')](_0x41e0c1);}})['then'](function(_0xb8f9ae){if(_0xb8f9ae){_0x37c1e6=_0xb8f9ae['length'];if(!_0x27edc1[_0xd22c('0x2e')][_0xd22c('0x48')](_0xd22c('0x49'))){_0x41e0c1[_0xd22c('0x1b')]=qs[_0xd22c('0x1b')](_0x27edc1[_0xd22c('0x2e')]['limit']);_0x41e0c1[_0xd22c('0x19')]=qs[_0xd22c('0x19')](_0x27edc1[_0xd22c('0x2e')]['offset']);}return _0x591250[_0xd22c('0x45')](_0x41e0c1);}})['then'](function(_0x2f6f8b){if(_0x2f6f8b){return _0x2f6f8b?{'count':_0x37c1e6,'rows':_0x2f6f8b}:null;}})[_0xd22c('0x21')](respondWithResult(_0x3ca147,null))['catch'](handleError(_0x3ca147,null));};exports['getDescriptions']=function(_0x365ef0,_0xac4f37,_0x4c76ff){var _0x2f608c={};var _0x33608d={};var _0x5461fd;var _0x530392;return db[_0xd22c('0x29')][_0xd22c('0x46')]({'where':{'id':_0x365ef0[_0xd22c('0x3f')]['id']}})[_0xd22c('0x21')](handleEntityNotFound(_0xac4f37,null))['then'](function(_0x455e6a){if(_0x455e6a){_0x5461fd=_0x455e6a;_0x33608d[_0xd22c('0x2d')]=_[_0xd22c('0x2f')](db['FreshsalesField'][_0xd22c('0x40')]);_0x33608d[_0xd22c('0x2e')]=_['keys'](_0x365ef0[_0xd22c('0x2e')]);_0x33608d[_0xd22c('0x30')]=_[_0xd22c('0x31')](_0x33608d['model'],_0x33608d['query']);_0x2f608c[_0xd22c('0x32')]=_[_0xd22c('0x31')](_0x33608d[_0xd22c('0x2d')],qs['fields'](_0x365ef0['query'][_0xd22c('0x33')]));_0x2f608c[_0xd22c('0x32')]=_0x2f608c[_0xd22c('0x32')][_0xd22c('0x34')]?_0x2f608c[_0xd22c('0x32')]:_0x33608d['model'];_0x2f608c[_0xd22c('0x35')]=qs['sort'](_0x365ef0['query']['sort']);_0x2f608c[_0xd22c('0x37')]=qs['filters'](_['pick'](_0x365ef0[_0xd22c('0x2e')],_0x33608d[_0xd22c('0x30')]));if(_0x365ef0[_0xd22c('0x2e')][_0xd22c('0x36')]){_0x2f608c[_0xd22c('0x37')]=_[_0xd22c('0x38')](_0x2f608c[_0xd22c('0x37')],{'$or':_[_0xd22c('0x28')](_0x2f608c[_0xd22c('0x32')],function(_0x59354a){var _0x3b303c={};_0x3b303c[_0x59354a]={'$like':'%'+_0x365ef0[_0xd22c('0x2e')][_0xd22c('0x36')]+'%'};return _0x3b303c;})});}_0x2f608c=_[_0xd22c('0x38')]({},_0x2f608c,_0x365ef0[_0xd22c('0x39')]);return _0x5461fd[_0xd22c('0x4a')](_0x2f608c);}})[_0xd22c('0x21')](function(_0x3ed599){if(_0x3ed599){_0x530392=_0x3ed599[_0xd22c('0x34')];if(!_0x365ef0[_0xd22c('0x2e')][_0xd22c('0x48')]('nolimit')){_0x2f608c['limit']=qs[_0xd22c('0x1b')](_0x365ef0['query'][_0xd22c('0x1b')]);_0x2f608c['offset']=qs[_0xd22c('0x19')](_0x365ef0[_0xd22c('0x2e')][_0xd22c('0x19')]);}return _0x5461fd['getDescriptions'](_0x2f608c);}})['then'](function(_0x3d39db){if(_0x3d39db){return _0x3d39db?{'count':_0x530392,'rows':_0x3d39db}:null;}})[_0xd22c('0x21')](respondWithResult(_0xac4f37,null))[_0xd22c('0x42')](handleError(_0xac4f37,null));};exports[_0xd22c('0x4b')]=function(_0xd52ead,_0x24d744,_0x2225ed){var _0x349c94={};var _0x4c847c={};var _0x18659b;var _0x23e89e;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0xd52ead[_0xd22c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x24d744,null))[_0xd22c('0x21')](function(_0x1800f6){if(_0x1800f6){_0x18659b=_0x1800f6;_0x4c847c[_0xd22c('0x2d')]=_[_0xd22c('0x2f')](db[_0xd22c('0x4c')][_0xd22c('0x40')]);_0x4c847c[_0xd22c('0x2e')]=_[_0xd22c('0x2f')](_0xd52ead[_0xd22c('0x2e')]);_0x4c847c[_0xd22c('0x30')]=_[_0xd22c('0x31')](_0x4c847c['model'],_0x4c847c['query']);_0x349c94[_0xd22c('0x32')]=_[_0xd22c('0x31')](_0x4c847c[_0xd22c('0x2d')],qs[_0xd22c('0x33')](_0xd52ead[_0xd22c('0x2e')][_0xd22c('0x33')]));_0x349c94[_0xd22c('0x32')]=_0x349c94[_0xd22c('0x32')]['length']?_0x349c94[_0xd22c('0x32')]:_0x4c847c[_0xd22c('0x2d')];_0x349c94[_0xd22c('0x35')]=qs['sort'](_0xd52ead[_0xd22c('0x2e')]['sort']);_0x349c94[_0xd22c('0x37')]=qs[_0xd22c('0x30')](_[_0xd22c('0x4d')](_0xd52ead['query'],_0x4c847c[_0xd22c('0x30')]));if(_0xd52ead[_0xd22c('0x2e')]['filter']){_0x349c94[_0xd22c('0x37')]=_['merge'](_0x349c94['where'],{'$or':_[_0xd22c('0x28')](_0x349c94[_0xd22c('0x32')],function(_0x30e4ed){var _0x1b3b44={};_0x1b3b44[_0x30e4ed]={'$like':'%'+_0xd52ead['query'][_0xd22c('0x36')]+'%'};return _0x1b3b44;})});}_0x349c94=_[_0xd22c('0x38')]({},_0x349c94,_0xd52ead[_0xd22c('0x39')]);return _0x18659b[_0xd22c('0x4b')](_0x349c94);}})[_0xd22c('0x21')](function(_0x4010dc){if(_0x4010dc){_0x23e89e=_0x4010dc[_0xd22c('0x34')];if(!_0xd52ead[_0xd22c('0x2e')][_0xd22c('0x48')](_0xd22c('0x49'))){_0x349c94['limit']=qs[_0xd22c('0x1b')](_0xd52ead[_0xd22c('0x2e')][_0xd22c('0x1b')]);_0x349c94[_0xd22c('0x19')]=qs['offset'](_0xd52ead[_0xd22c('0x2e')][_0xd22c('0x19')]);}return _0x18659b[_0xd22c('0x4b')](_0x349c94);}})[_0xd22c('0x21')](function(_0x1a6cc4){if(_0x1a6cc4){return _0x1a6cc4?{'count':_0x23e89e,'rows':_0x1a6cc4}:null;}})[_0xd22c('0x21')](respondWithResult(_0x24d744,null))[_0xd22c('0x42')](handleError(_0x24d744,null));}; \ No newline at end of file +var _0xeaba=['order','sort','where','pick','filter','merge','include','findAll','catch','params','includeAll','create','body','find','getSubjects','findOne','FreshsalesField','options','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0xcd2fcb,_0x269357){var _0x3a8b1e=function(_0x2c900f){while(--_0x2c900f){_0xcd2fcb['push'](_0xcd2fcb['shift']());}};_0x3a8b1e(++_0x269357);}(_0xeaba,0x1a9));var _0xaeab=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xeaba[_0x5c9307];return _0x373e29;};'use strict';var emlformat=require(_0xaeab('0x0'));var rimraf=require(_0xaeab('0x1'));var zipdir=require(_0xaeab('0x2'));var jsonpatch=require(_0xaeab('0x3'));var rp=require(_0xaeab('0x4'));var moment=require('moment');var BPromise=require(_0xaeab('0x5'));var Mustache=require(_0xaeab('0x6'));var util=require(_0xaeab('0x7'));var path=require('path');var sox=require(_0xaeab('0x8'));var csv=require('to-csv');var ejs=require(_0xaeab('0x9'));var fs=require('fs');var fs_extra=require(_0xaeab('0xa'));var _=require(_0xaeab('0xb'));var squel=require(_0xaeab('0xc'));var crypto=require(_0xaeab('0xd'));var jsforce=require(_0xaeab('0xe'));var deskjs=require(_0xaeab('0xf'));var toCsv=require('to-csv');var querystring=require(_0xaeab('0x10'));var Papa=require(_0xaeab('0x11'));var Redis=require(_0xaeab('0x12'));var authService=require(_0xaeab('0x13'));var qs=require(_0xaeab('0x14'));var as=require(_0xaeab('0x15'));var hardwareService=require(_0xaeab('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xaeab('0x17'));var config=require(_0xaeab('0x18'));var licenseUtil=require(_0xaeab('0x19'));var db=require(_0xaeab('0x1a'))['db'];function respondWithStatusCode(_0x4ba4ca,_0x5d9f39){_0x5d9f39=_0x5d9f39||0xcc;return function(_0x4d2a61){if(_0x4d2a61){return _0x4ba4ca[_0xaeab('0x1b')](_0x5d9f39);}return _0x4ba4ca[_0xaeab('0x1c')](_0x5d9f39)[_0xaeab('0x1d')]();};}function respondWithResult(_0x2b9539,_0x4e9b9e){_0x4e9b9e=_0x4e9b9e||0xc8;return function(_0x38b4fc){if(_0x38b4fc){return _0x2b9539['status'](_0x4e9b9e)[_0xaeab('0x1e')](_0x38b4fc);}};}function respondWithFilteredResult(_0x58caf2,_0x444dde){return function(_0x2ca713){if(_0x2ca713){var _0x4618a8=typeof _0x444dde[_0xaeab('0x1f')]==='undefined'&&typeof _0x444dde[_0xaeab('0x20')]==='undefined';var _0xe4f022=_0x2ca713[_0xaeab('0x21')];var _0x5db3e6=_0x4618a8?0x0:_0x444dde[_0xaeab('0x1f')];var _0x1100c1=_0x4618a8?_0x2ca713[_0xaeab('0x21')]:_0x444dde[_0xaeab('0x1f')]+_0x444dde[_0xaeab('0x20')];var _0x552337;if(_0x1100c1>=_0xe4f022){_0x1100c1=_0xe4f022;_0x552337=0xc8;}else{_0x552337=0xce;}_0x58caf2[_0xaeab('0x1c')](_0x552337);return _0x58caf2[_0xaeab('0x22')](_0xaeab('0x23'),_0x5db3e6+'-'+_0x1100c1+'/'+_0xe4f022)[_0xaeab('0x1e')](_0x2ca713);}return null;};}function patchUpdates(_0x20c673){return function(_0x999385){try{jsonpatch[_0xaeab('0x24')](_0x999385,_0x20c673,!![]);}catch(_0x336a7c){return BPromise['reject'](_0x336a7c);}return _0x999385['save']();};}function saveUpdates(_0x41290b,_0x3b6667){return function(_0x40eb83){if(_0x40eb83){return _0x40eb83[_0xaeab('0x25')](_0x41290b)[_0xaeab('0x26')](function(_0x542197){return _0x542197;});}return null;};}function removeEntity(_0x6656a9,_0x13fcf3){return function(_0x8d6dc8){if(_0x8d6dc8){return _0x8d6dc8[_0xaeab('0x27')]()['then'](function(){_0x6656a9[_0xaeab('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x531d74,_0x40eb87){return function(_0xc3070d){if(!_0xc3070d){_0x531d74[_0xaeab('0x1b')](0x194);}return _0xc3070d;};}function handleError(_0x4c4304,_0x28e63f){_0x28e63f=_0x28e63f||0x1f4;return function(_0x143a5a){logger[_0xaeab('0x28')](_0x143a5a[_0xaeab('0x29')]);if(_0x143a5a[_0xaeab('0x2a')]){delete _0x143a5a[_0xaeab('0x2a')];}_0x4c4304['status'](_0x28e63f)[_0xaeab('0x2b')](_0x143a5a);};}exports[_0xaeab('0x2c')]=function(_0x375f02,_0x45ad39){var _0x46fdf4={},_0x4dcf8f={},_0x2cac88={'count':0x0,'rows':[]};var _0x4056e4=_[_0xaeab('0x2d')](db[_0xaeab('0x2e')][_0xaeab('0x2f')],function(_0x472b7e){return{'name':_0x472b7e[_0xaeab('0x30')],'type':_0x472b7e[_0xaeab('0x31')][_0xaeab('0x32')]};});_0x4dcf8f[_0xaeab('0x33')]=_[_0xaeab('0x2d')](_0x4056e4,_0xaeab('0x2a'));_0x4dcf8f[_0xaeab('0x34')]=_[_0xaeab('0x35')](_0x375f02[_0xaeab('0x34')]);_0x4dcf8f[_0xaeab('0x36')]=_['intersection'](_0x4dcf8f[_0xaeab('0x33')],_0x4dcf8f['query']);_0x46fdf4[_0xaeab('0x37')]=_[_0xaeab('0x38')](_0x4dcf8f[_0xaeab('0x33')],qs[_0xaeab('0x39')](_0x375f02[_0xaeab('0x34')][_0xaeab('0x39')]));_0x46fdf4['attributes']=_0x46fdf4[_0xaeab('0x37')][_0xaeab('0x3a')]?_0x46fdf4['attributes']:_0x4dcf8f[_0xaeab('0x33')];if(!_0x375f02['query'][_0xaeab('0x3b')](_0xaeab('0x3c'))){_0x46fdf4['limit']=qs[_0xaeab('0x20')](_0x375f02[_0xaeab('0x34')]['limit']);_0x46fdf4[_0xaeab('0x1f')]=qs[_0xaeab('0x1f')](_0x375f02[_0xaeab('0x34')][_0xaeab('0x1f')]);}_0x46fdf4[_0xaeab('0x3d')]=qs[_0xaeab('0x3e')](_0x375f02[_0xaeab('0x34')][_0xaeab('0x3e')]);_0x46fdf4[_0xaeab('0x3f')]=qs[_0xaeab('0x36')](_[_0xaeab('0x40')](_0x375f02[_0xaeab('0x34')],_0x4dcf8f[_0xaeab('0x36')]),_0x4056e4);if(_0x375f02[_0xaeab('0x34')][_0xaeab('0x41')]){_0x46fdf4[_0xaeab('0x3f')]=_[_0xaeab('0x42')](_0x46fdf4[_0xaeab('0x3f')],{'$or':_['map'](_0x4056e4,function(_0x211182){if(_0x211182[_0xaeab('0x31')]!=='VIRTUAL'){var _0x3018dd={};_0x3018dd[_0x211182[_0xaeab('0x2a')]]={'$like':'%'+_0x375f02['query'][_0xaeab('0x41')]+'%'};return _0x3018dd;}})});}_0x46fdf4=_[_0xaeab('0x42')]({},_0x46fdf4,_0x375f02['options']);var _0x56e532={'where':_0x46fdf4[_0xaeab('0x3f')]};return db[_0xaeab('0x2e')][_0xaeab('0x21')](_0x56e532)[_0xaeab('0x26')](function(_0x1efa79){_0x2cac88['count']=_0x1efa79;if(_0x375f02[_0xaeab('0x34')]['includeAll']){_0x46fdf4[_0xaeab('0x43')]=[{'all':!![]}];}return db[_0xaeab('0x2e')][_0xaeab('0x44')](_0x46fdf4);})[_0xaeab('0x26')](function(_0x4ce52f){_0x2cac88['rows']=_0x4ce52f;return _0x2cac88;})[_0xaeab('0x26')](respondWithFilteredResult(_0x45ad39,_0x46fdf4))[_0xaeab('0x45')](handleError(_0x45ad39,null));};exports['show']=function(_0x42b66f,_0xdcc9b3){var _0x37df5a={'raw':![],'where':{'id':_0x42b66f[_0xaeab('0x46')]['id']}},_0x4e9705={};_0x4e9705[_0xaeab('0x33')]=_[_0xaeab('0x35')](db[_0xaeab('0x2e')][_0xaeab('0x2f')]);_0x4e9705[_0xaeab('0x34')]=_[_0xaeab('0x35')](_0x42b66f[_0xaeab('0x34')]);_0x4e9705[_0xaeab('0x36')]=_[_0xaeab('0x38')](_0x4e9705[_0xaeab('0x33')],_0x4e9705[_0xaeab('0x34')]);_0x37df5a['attributes']=_[_0xaeab('0x38')](_0x4e9705['model'],qs[_0xaeab('0x39')](_0x42b66f[_0xaeab('0x34')][_0xaeab('0x39')]));_0x37df5a['attributes']=_0x37df5a['attributes'][_0xaeab('0x3a')]?_0x37df5a[_0xaeab('0x37')]:_0x4e9705[_0xaeab('0x33')];if(_0x42b66f[_0xaeab('0x34')][_0xaeab('0x47')]){_0x37df5a[_0xaeab('0x43')]=[{'all':!![]}];}_0x37df5a=_['merge']({},_0x37df5a,_0x42b66f['options']);return db['FreshsalesConfiguration']['find'](_0x37df5a)['then'](handleEntityNotFound(_0xdcc9b3,null))[_0xaeab('0x26')](respondWithResult(_0xdcc9b3,null))[_0xaeab('0x45')](handleError(_0xdcc9b3,null));};exports[_0xaeab('0x48')]=function(_0x4f43ec,_0x2ec7ee){return db['FreshsalesConfiguration']['create'](_0x4f43ec[_0xaeab('0x49')],{})[_0xaeab('0x26')](respondWithResult(_0x2ec7ee,0xc9))[_0xaeab('0x45')](handleError(_0x2ec7ee,null));};exports[_0xaeab('0x25')]=function(_0xc93ae3,_0x16ccb4){if(_0xc93ae3[_0xaeab('0x49')]['id']){delete _0xc93ae3[_0xaeab('0x49')]['id'];}return db[_0xaeab('0x2e')][_0xaeab('0x4a')]({'where':{'id':_0xc93ae3[_0xaeab('0x46')]['id']}})[_0xaeab('0x26')](handleEntityNotFound(_0x16ccb4,null))[_0xaeab('0x26')](saveUpdates(_0xc93ae3[_0xaeab('0x49')],null))['then'](respondWithResult(_0x16ccb4,null))[_0xaeab('0x45')](handleError(_0x16ccb4,null));};exports[_0xaeab('0x27')]=function(_0x33a6e7,_0x3a8827){return db['FreshsalesConfiguration'][_0xaeab('0x4a')]({'where':{'id':_0x33a6e7['params']['id']}})[_0xaeab('0x26')](handleEntityNotFound(_0x3a8827,null))['then'](removeEntity(_0x3a8827,null))[_0xaeab('0x45')](handleError(_0x3a8827,null));};exports[_0xaeab('0x4b')]=function(_0x5b26f0,_0x2963ff,_0x1f9bd0){var _0x1958da={};var _0x3bc18b={};var _0x1f7b15;var _0x2b2667;return db[_0xaeab('0x2e')][_0xaeab('0x4c')]({'where':{'id':_0x5b26f0[_0xaeab('0x46')]['id']}})[_0xaeab('0x26')](handleEntityNotFound(_0x2963ff,null))['then'](function(_0x879c44){if(_0x879c44){_0x1f7b15=_0x879c44;_0x3bc18b[_0xaeab('0x33')]=_['keys'](db[_0xaeab('0x4d')][_0xaeab('0x2f')]);_0x3bc18b[_0xaeab('0x34')]=_['keys'](_0x5b26f0['query']);_0x3bc18b[_0xaeab('0x36')]=_[_0xaeab('0x38')](_0x3bc18b[_0xaeab('0x33')],_0x3bc18b[_0xaeab('0x34')]);_0x1958da[_0xaeab('0x37')]=_[_0xaeab('0x38')](_0x3bc18b[_0xaeab('0x33')],qs['fields'](_0x5b26f0[_0xaeab('0x34')][_0xaeab('0x39')]));_0x1958da[_0xaeab('0x37')]=_0x1958da[_0xaeab('0x37')][_0xaeab('0x3a')]?_0x1958da[_0xaeab('0x37')]:_0x3bc18b[_0xaeab('0x33')];_0x1958da[_0xaeab('0x3d')]=qs[_0xaeab('0x3e')](_0x5b26f0[_0xaeab('0x34')][_0xaeab('0x3e')]);_0x1958da[_0xaeab('0x3f')]=qs['filters'](_[_0xaeab('0x40')](_0x5b26f0[_0xaeab('0x34')],_0x3bc18b['filters']));if(_0x5b26f0[_0xaeab('0x34')][_0xaeab('0x41')]){_0x1958da[_0xaeab('0x3f')]=_['merge'](_0x1958da[_0xaeab('0x3f')],{'$or':_[_0xaeab('0x2d')](_0x1958da[_0xaeab('0x37')],function(_0x17d2a7){var _0x21a3ee={};_0x21a3ee[_0x17d2a7]={'$like':'%'+_0x5b26f0[_0xaeab('0x34')][_0xaeab('0x41')]+'%'};return _0x21a3ee;})});}_0x1958da=_[_0xaeab('0x42')]({},_0x1958da,_0x5b26f0[_0xaeab('0x4e')]);return _0x1f7b15[_0xaeab('0x4b')](_0x1958da);}})[_0xaeab('0x26')](function(_0x1075cf){if(_0x1075cf){_0x2b2667=_0x1075cf[_0xaeab('0x3a')];if(!_0x5b26f0['query'][_0xaeab('0x3b')]('nolimit')){_0x1958da[_0xaeab('0x20')]=qs['limit'](_0x5b26f0['query'][_0xaeab('0x20')]);_0x1958da[_0xaeab('0x1f')]=qs[_0xaeab('0x1f')](_0x5b26f0[_0xaeab('0x34')][_0xaeab('0x1f')]);}return _0x1f7b15[_0xaeab('0x4b')](_0x1958da);}})[_0xaeab('0x26')](function(_0x3da0ca){if(_0x3da0ca){return _0x3da0ca?{'count':_0x2b2667,'rows':_0x3da0ca}:null;}})['then'](respondWithResult(_0x2963ff,null))['catch'](handleError(_0x2963ff,null));};exports['getDescriptions']=function(_0xaa6265,_0x51e33f,_0x2d1669){var _0x15dd14={};var _0xf7db6f={};var _0x32eac8;var _0x34ad6d;return db['FreshsalesConfiguration'][_0xaeab('0x4c')]({'where':{'id':_0xaa6265[_0xaeab('0x46')]['id']}})[_0xaeab('0x26')](handleEntityNotFound(_0x51e33f,null))[_0xaeab('0x26')](function(_0x53c9c0){if(_0x53c9c0){_0x32eac8=_0x53c9c0;_0xf7db6f[_0xaeab('0x33')]=_[_0xaeab('0x35')](db[_0xaeab('0x4d')][_0xaeab('0x2f')]);_0xf7db6f['query']=_[_0xaeab('0x35')](_0xaa6265[_0xaeab('0x34')]);_0xf7db6f[_0xaeab('0x36')]=_[_0xaeab('0x38')](_0xf7db6f['model'],_0xf7db6f[_0xaeab('0x34')]);_0x15dd14[_0xaeab('0x37')]=_[_0xaeab('0x38')](_0xf7db6f[_0xaeab('0x33')],qs['fields'](_0xaa6265[_0xaeab('0x34')][_0xaeab('0x39')]));_0x15dd14[_0xaeab('0x37')]=_0x15dd14[_0xaeab('0x37')][_0xaeab('0x3a')]?_0x15dd14['attributes']:_0xf7db6f[_0xaeab('0x33')];_0x15dd14[_0xaeab('0x3d')]=qs[_0xaeab('0x3e')](_0xaa6265[_0xaeab('0x34')][_0xaeab('0x3e')]);_0x15dd14['where']=qs['filters'](_[_0xaeab('0x40')](_0xaa6265[_0xaeab('0x34')],_0xf7db6f[_0xaeab('0x36')]));if(_0xaa6265[_0xaeab('0x34')][_0xaeab('0x41')]){_0x15dd14[_0xaeab('0x3f')]=_['merge'](_0x15dd14[_0xaeab('0x3f')],{'$or':_[_0xaeab('0x2d')](_0x15dd14[_0xaeab('0x37')],function(_0x4aa04a){var _0x440e9f={};_0x440e9f[_0x4aa04a]={'$like':'%'+_0xaa6265[_0xaeab('0x34')]['filter']+'%'};return _0x440e9f;})});}_0x15dd14=_['merge']({},_0x15dd14,_0xaa6265[_0xaeab('0x4e')]);return _0x32eac8[_0xaeab('0x4f')](_0x15dd14);}})[_0xaeab('0x26')](function(_0x36034b){if(_0x36034b){_0x34ad6d=_0x36034b[_0xaeab('0x3a')];if(!_0xaa6265[_0xaeab('0x34')][_0xaeab('0x3b')](_0xaeab('0x3c'))){_0x15dd14[_0xaeab('0x20')]=qs['limit'](_0xaa6265[_0xaeab('0x34')][_0xaeab('0x20')]);_0x15dd14[_0xaeab('0x1f')]=qs[_0xaeab('0x1f')](_0xaa6265[_0xaeab('0x34')][_0xaeab('0x1f')]);}return _0x32eac8[_0xaeab('0x4f')](_0x15dd14);}})[_0xaeab('0x26')](function(_0x173ac5){if(_0x173ac5){return _0x173ac5?{'count':_0x34ad6d,'rows':_0x173ac5}:null;}})[_0xaeab('0x26')](respondWithResult(_0x51e33f,null))[_0xaeab('0x45')](handleError(_0x51e33f,null));};exports[_0xaeab('0x50')]=function(_0x42acbe,_0x1cad4c,_0x661e61){var _0xfaf61e={};var _0x142dce={};var _0x14405d;var _0x5c38ed;return db[_0xaeab('0x2e')]['findOne']({'where':{'id':_0x42acbe[_0xaeab('0x46')]['id']}})[_0xaeab('0x26')](handleEntityNotFound(_0x1cad4c,null))[_0xaeab('0x26')](function(_0x9f0093){if(_0x9f0093){_0x14405d=_0x9f0093;_0x142dce[_0xaeab('0x33')]=_[_0xaeab('0x35')](db[_0xaeab('0x4d')][_0xaeab('0x2f')]);_0x142dce[_0xaeab('0x34')]=_['keys'](_0x42acbe[_0xaeab('0x34')]);_0x142dce[_0xaeab('0x36')]=_[_0xaeab('0x38')](_0x142dce['model'],_0x142dce[_0xaeab('0x34')]);_0xfaf61e[_0xaeab('0x37')]=_[_0xaeab('0x38')](_0x142dce[_0xaeab('0x33')],qs[_0xaeab('0x39')](_0x42acbe[_0xaeab('0x34')][_0xaeab('0x39')]));_0xfaf61e[_0xaeab('0x37')]=_0xfaf61e[_0xaeab('0x37')][_0xaeab('0x3a')]?_0xfaf61e['attributes']:_0x142dce[_0xaeab('0x33')];_0xfaf61e[_0xaeab('0x3d')]=qs[_0xaeab('0x3e')](_0x42acbe[_0xaeab('0x34')]['sort']);_0xfaf61e[_0xaeab('0x3f')]=qs['filters'](_[_0xaeab('0x40')](_0x42acbe[_0xaeab('0x34')],_0x142dce[_0xaeab('0x36')]));if(_0x42acbe[_0xaeab('0x34')][_0xaeab('0x41')]){_0xfaf61e[_0xaeab('0x3f')]=_['merge'](_0xfaf61e[_0xaeab('0x3f')],{'$or':_[_0xaeab('0x2d')](_0xfaf61e[_0xaeab('0x37')],function(_0x5060cb){var _0x6a412a={};_0x6a412a[_0x5060cb]={'$like':'%'+_0x42acbe[_0xaeab('0x34')][_0xaeab('0x41')]+'%'};return _0x6a412a;})});}_0xfaf61e=_[_0xaeab('0x42')]({},_0xfaf61e,_0x42acbe['options']);return _0x14405d[_0xaeab('0x50')](_0xfaf61e);}})[_0xaeab('0x26')](function(_0x22ec5a){if(_0x22ec5a){_0x5c38ed=_0x22ec5a[_0xaeab('0x3a')];if(!_0x42acbe[_0xaeab('0x34')]['hasOwnProperty'](_0xaeab('0x3c'))){_0xfaf61e[_0xaeab('0x20')]=qs[_0xaeab('0x20')](_0x42acbe['query'][_0xaeab('0x20')]);_0xfaf61e['offset']=qs[_0xaeab('0x1f')](_0x42acbe['query'][_0xaeab('0x1f')]);}return _0x14405d[_0xaeab('0x50')](_0xfaf61e);}})[_0xaeab('0x26')](function(_0x1629c2){if(_0x1629c2){return _0x1629c2?{'count':_0x5c38ed,'rows':_0x1629c2}:null;}})[_0xaeab('0x26')](respondWithResult(_0x1cad4c,null))[_0xaeab('0x45')](handleError(_0x1cad4c,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index b2d87ba..0860c59 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 _0xcdb5=['../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util'];(function(_0x298e75,_0x112786){var _0x1d2081=function(_0x17936f){while(--_0x17936f){_0x298e75['push'](_0x298e75['shift']());}};_0x1d2081(++_0x112786);}(_0xcdb5,0xfa));var _0x5cdb=function(_0x2e78e9,_0x42957c){_0x2e78e9=_0x2e78e9-0x0;var _0x35aad4=_0xcdb5[_0x2e78e9];return _0x35aad4;};'use strict';var _=require(_0x5cdb('0x0'));var util=require(_0x5cdb('0x1'));var logger=require(_0x5cdb('0x2'))(_0x5cdb('0x3'));var moment=require(_0x5cdb('0x4'));var BPromise=require(_0x5cdb('0x5'));var rp=require(_0x5cdb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5cdb('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x5cdb('0x8')]=function(_0x23a49f,_0x19d524){return _0x23a49f[_0x5cdb('0x9')](_0x5cdb('0xa'),attributes,{'tableName':_0x5cdb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x094c=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x13709c,_0x181a51){var _0x5b72b9=function(_0x27bbab){while(--_0x27bbab){_0x13709c['push'](_0x13709c['shift']());}};_0x5b72b9(++_0x181a51);}(_0x094c,0x18b));var _0xc094=function(_0x313a00,_0x107929){_0x313a00=_0x313a00-0x0;var _0x46d07b=_0x094c[_0x313a00];return _0x46d07b;};'use strict';var _=require(_0xc094('0x0'));var util=require('util');var logger=require(_0xc094('0x1'))(_0xc094('0x2'));var moment=require(_0xc094('0x3'));var BPromise=require(_0xc094('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc094('0x5'));var rimraf=require(_0xc094('0x6'));var config=require(_0xc094('0x7'));var attributes=require(_0xc094('0x8'));module['exports']=function(_0x21195f,_0x4bc496){return _0x21195f['define'](_0xc094('0x9'),attributes,{'tableName':_0xc094('0xa'),'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 07a2a64..7028d7b 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 _0x5435=['message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x13f7df,_0x489d28){var _0x24903a=function(_0x33b9af){while(--_0x33b9af){_0x13f7df['push'](_0x13f7df['shift']());}};_0x24903a(++_0x489d28);}(_0x5435,0x173));var _0x5543=function(_0x3dc1ac,_0x17abd7){_0x3dc1ac=_0x3dc1ac-0x0;var _0x5a03dc=_0x5435[_0x3dc1ac];return _0x5a03dc;};'use strict';var _=require('lodash');var util=require(_0x5543('0x0'));var moment=require('moment');var BPromise=require(_0x5543('0x1'));var rs=require(_0x5543('0x2'));var fs=require('fs');var Redis=require(_0x5543('0x3'));var db=require(_0x5543('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5543('0x5'));var config=require(_0x5543('0x6'));var jayson=require(_0x5543('0x7'));var client=jayson[_0x5543('0x8')][_0x5543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2894a2,_0x51613a,_0x5c6c34){return new BPromise(function(_0x4bde70,_0xb4c0f){return client[_0x5543('0xa')](_0x2894a2,_0x5c6c34)[_0x5543('0xb')](function(_0x51f055){logger[_0x5543('0xc')](_0x5543('0xd'),_0x51613a,_0x5543('0xe'));logger[_0x5543('0xf')](_0x5543('0x10'),_0x51613a,_0x5543('0xe'),JSON[_0x5543('0x11')](_0x51f055));if(_0x51f055['error']){if(_0x51f055['error'][_0x5543('0x12')]===0x1f4){logger[_0x5543('0x13')](_0x5543('0xd'),_0x51613a,_0x51f055[_0x5543('0x13')][_0x5543('0x14')]);return _0xb4c0f(_0x51f055['error']['message']);}logger[_0x5543('0x13')](_0x5543('0xd'),_0x51613a,_0x51f055[_0x5543('0x13')][_0x5543('0x14')]);return _0x4bde70(_0x51f055[_0x5543('0x13')][_0x5543('0x14')]);}else{logger[_0x5543('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x51613a,_0x5543('0xe'));_0x4bde70(_0x51f055[_0x5543('0x15')][_0x5543('0x14')]);}})[_0x5543('0x16')](function(_0x3b7f31){logger[_0x5543('0x13')](_0x5543('0xd'),_0x51613a,_0x3b7f31);_0xb4c0f(_0x3b7f31);});});} \ No newline at end of file +var _0xf633=['code','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','client','http','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2fe1cd,_0x231125){var _0xa2c098=function(_0x2e4e67){while(--_0x2e4e67){_0x2fe1cd['push'](_0x2fe1cd['shift']());}};_0xa2c098(++_0x231125);}(_0xf633,0xdd));var _0x3f63=function(_0x51fd35,_0x23b5be){_0x51fd35=_0x51fd35-0x0;var _0x57e45d=_0xf633[_0x51fd35];return _0x57e45d;};'use strict';var _=require('lodash');var util=require(_0x3f63('0x0'));var moment=require(_0x3f63('0x1'));var BPromise=require(_0x3f63('0x2'));var rs=require(_0x3f63('0x3'));var fs=require('fs');var Redis=require(_0x3f63('0x4'));var db=require(_0x3f63('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[_0x3f63('0x6')][_0x3f63('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5a17da,_0x553cb1,_0x2116d0){return new BPromise(function(_0x3561df,_0x3458e0){return client['request'](_0x5a17da,_0x2116d0)['then'](function(_0x11cf12){logger['info'](_0x3f63('0x8'),_0x553cb1,_0x3f63('0x9'));logger[_0x3f63('0xa')](_0x3f63('0xb'),_0x553cb1,_0x3f63('0x9'),JSON[_0x3f63('0xc')](_0x11cf12));if(_0x11cf12['error']){if(_0x11cf12['error'][_0x3f63('0xd')]===0x1f4){logger[_0x3f63('0xe')](_0x3f63('0x8'),_0x553cb1,_0x11cf12['error'][_0x3f63('0xf')]);return _0x3458e0(_0x11cf12['error'][_0x3f63('0xf')]);}logger[_0x3f63('0xe')](_0x3f63('0x8'),_0x553cb1,_0x11cf12[_0x3f63('0xe')][_0x3f63('0xf')]);return _0x3561df(_0x11cf12[_0x3f63('0xe')]['message']);}else{logger['info'](_0x3f63('0x8'),_0x553cb1,_0x3f63('0x9'));_0x3561df(_0x11cf12[_0x3f63('0x10')][_0x3f63('0xf')]);}})[_0x3f63('0x11')](function(_0x2252f2){logger['error'](_0x3f63('0x8'),_0x553cb1,_0x2252f2);_0x3458e0(_0x2252f2);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 56122cc..293730d 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 _0xd0b5=['get','isAuthenticated','index','/:id','show','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0x345e82,_0x5ae749){var _0x5afa56=function(_0x1a3a47){while(--_0x1a3a47){_0x345e82['push'](_0x345e82['shift']());}};_0x5afa56(++_0x5ae749);}(_0xd0b5,0x1b8));var _0x5d0b=function(_0x2bcba7,_0x1da680){_0x2bcba7=_0x2bcba7-0x0;var _0x4808c1=_0xd0b5[_0x2bcba7];return _0x4808c1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5d0b('0x0'));var timeout=require(_0x5d0b('0x1'));var express=require('express');var router=express[_0x5d0b('0x2')]();var fs_extra=require(_0x5d0b('0x3'));var auth=require(_0x5d0b('0x4'));var interaction=require(_0x5d0b('0x5'));var config=require(_0x5d0b('0x6'));var controller=require(_0x5d0b('0x7'));router[_0x5d0b('0x8')]('/',auth[_0x5d0b('0x9')](),controller[_0x5d0b('0xa')]);router[_0x5d0b('0x8')](_0x5d0b('0xb'),auth[_0x5d0b('0x9')](),controller[_0x5d0b('0xc')]);router['post']('/',auth[_0x5d0b('0x9')](),controller['create']);router['put'](_0x5d0b('0xb'),auth[_0x5d0b('0x9')](),controller['update']);router[_0x5d0b('0xd')](_0x5d0b('0xb'),auth['isAuthenticated'](),controller[_0x5d0b('0xe')]);module[_0x5d0b('0xf')]=router; \ No newline at end of file +var _0x26c2=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','connect-timeout','express'];(function(_0x13bc3d,_0x1c3dff){var _0xf1ea58=function(_0x4a7485){while(--_0x4a7485){_0x13bc3d['push'](_0x13bc3d['shift']());}};_0xf1ea58(++_0x1c3dff);}(_0x26c2,0x130));var _0x226c=function(_0x3e42b7,_0x1d8e9e){_0x3e42b7=_0x3e42b7-0x0;var _0x3bdc13=_0x26c2[_0x3e42b7];return _0x3bdc13;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x226c('0x0'));var express=require(_0x226c('0x1'));var router=express[_0x226c('0x2')]();var fs_extra=require(_0x226c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x226c('0x4'));var config=require(_0x226c('0x5'));var controller=require('./intFreshsalesField.controller');router[_0x226c('0x6')]('/',auth[_0x226c('0x7')](),controller[_0x226c('0x8')]);router[_0x226c('0x6')](_0x226c('0x9'),auth['isAuthenticated'](),controller[_0x226c('0xa')]);router[_0x226c('0xb')]('/',auth[_0x226c('0x7')](),controller[_0x226c('0xc')]);router[_0x226c('0xd')]('/:id',auth[_0x226c('0x7')](),controller[_0x226c('0xe')]);router['delete']('/:id',auth[_0x226c('0x7')](),controller[_0x226c('0xf')]);module[_0x226c('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index a076902..3aa090f 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 _0x6b94=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','ENUM','string'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0x6b94,0x1ae));var _0x46b9=function(_0x4d8360,_0x4e8a24){_0x4d8360=_0x4d8360-0x0;var _0x37a093=_0x6b94[_0x4d8360];return _0x37a093;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x46b9('0x0')](_0x46b9('0x1'),_0x46b9('0x2'),_0x46b9('0x3'),_0x46b9('0x4'),_0x46b9('0x5')),'defaultValue':_0x46b9('0x1')},'content':{'type':Sequelize[_0x46b9('0x6')]},'key':{'type':Sequelize[_0x46b9('0x6')]},'keyType':{'type':Sequelize[_0x46b9('0x0')](_0x46b9('0x1'),_0x46b9('0x2'),_0x46b9('0x3'))},'keyContent':{'type':Sequelize[_0x46b9('0x6')]},'idField':{'type':Sequelize[_0x46b9('0x6')]},'nameField':{'type':Sequelize[_0x46b9('0x6')]},'customField':{'type':Sequelize[_0x46b9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf15a=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf15a,0xbe));var _0xaf15=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xf15a[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0xaf15('0x0')]={'type':{'type':Sequelize['ENUM'](_0xaf15('0x1'),_0xaf15('0x2'),_0xaf15('0x3'),_0xaf15('0x4'),_0xaf15('0x5')),'defaultValue':_0xaf15('0x1')},'content':{'type':Sequelize[_0xaf15('0x6')]},'key':{'type':Sequelize[_0xaf15('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xaf15('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xaf15('0x6')]},'idField':{'type':Sequelize[_0xaf15('0x6')]},'nameField':{'type':Sequelize[_0xaf15('0x6')]},'customField':{'type':Sequelize[_0xaf15('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaf15('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 595fe8a..6f66a39 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 _0xd0dc=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','name','send','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','FreshsalesField','include','rows','catch','show','params','keys','find','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x457c9d,_0x257d4d){var _0x20e15e=function(_0x128992){while(--_0x128992){_0x457c9d['push'](_0x457c9d['shift']());}};_0x20e15e(++_0x257d4d);}(_0xd0dc,0x143));var _0xcd0d=function(_0x3fa1c7,_0x13d816){_0x3fa1c7=_0x3fa1c7-0x0;var _0x21e45d=_0xd0dc[_0x3fa1c7];return _0x21e45d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd0d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcd0d('0x1'));var rp=require('request-promise');var moment=require(_0xcd0d('0x2'));var BPromise=require(_0xcd0d('0x3'));var Mustache=require(_0xcd0d('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcd0d('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcd0d('0x6'));var squel=require(_0xcd0d('0x7'));var crypto=require(_0xcd0d('0x8'));var jsforce=require(_0xcd0d('0x9'));var deskjs=require(_0xcd0d('0xa'));var toCsv=require('to-csv');var querystring=require(_0xcd0d('0xb'));var Papa=require(_0xcd0d('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcd0d('0xd'));var as=require(_0xcd0d('0xe'));var hardwareService=require(_0xcd0d('0xf'));var logger=require(_0xcd0d('0x10'))(_0xcd0d('0x11'));var utils=require(_0xcd0d('0x12'));var config=require(_0xcd0d('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xcd0d('0x14'))['db'];function respondWithStatusCode(_0x3f6395,_0x491b1c){_0x491b1c=_0x491b1c||0xcc;return function(_0x56d5f0){if(_0x56d5f0){return _0x3f6395[_0xcd0d('0x15')](_0x491b1c);}return _0x3f6395[_0xcd0d('0x16')](_0x491b1c)[_0xcd0d('0x17')]();};}function respondWithResult(_0x3b6f2e,_0x1d83e7){_0x1d83e7=_0x1d83e7||0xc8;return function(_0x10df26){if(_0x10df26){return _0x3b6f2e[_0xcd0d('0x16')](_0x1d83e7)[_0xcd0d('0x18')](_0x10df26);}};}function respondWithFilteredResult(_0x3a7f99,_0x54b794){return function(_0x2edfce){if(_0x2edfce){var _0x1acb53=typeof _0x54b794[_0xcd0d('0x19')]===_0xcd0d('0x1a')&&typeof _0x54b794[_0xcd0d('0x1b')]==='undefined';var _0x150a9f=_0x2edfce['count'];var _0x22a377=_0x1acb53?0x0:_0x54b794['offset'];var _0x3cc226=_0x1acb53?_0x2edfce[_0xcd0d('0x1c')]:_0x54b794['offset']+_0x54b794['limit'];var _0x553ba5;if(_0x3cc226>=_0x150a9f){_0x3cc226=_0x150a9f;_0x553ba5=0xc8;}else{_0x553ba5=0xce;}_0x3a7f99[_0xcd0d('0x16')](_0x553ba5);return _0x3a7f99[_0xcd0d('0x1d')](_0xcd0d('0x1e'),_0x22a377+'-'+_0x3cc226+'/'+_0x150a9f)[_0xcd0d('0x18')](_0x2edfce);}return null;};}function patchUpdates(_0x2586d1){return function(_0x4a297){try{jsonpatch['apply'](_0x4a297,_0x2586d1,!![]);}catch(_0x5424b1){return BPromise[_0xcd0d('0x1f')](_0x5424b1);}return _0x4a297[_0xcd0d('0x20')]();};}function saveUpdates(_0x39312b,_0xf19773){return function(_0x29acfe){if(_0x29acfe){return _0x29acfe[_0xcd0d('0x21')](_0x39312b)[_0xcd0d('0x22')](function(_0x404a4a){return _0x404a4a;});}return null;};}function removeEntity(_0xbb2db5,_0x57d260){return function(_0x49b097){if(_0x49b097){return _0x49b097[_0xcd0d('0x23')]()['then'](function(){_0xbb2db5[_0xcd0d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30c8d5,_0x32768b){return function(_0x559770){if(!_0x559770){_0x30c8d5['sendStatus'](0x194);}return _0x559770;};}function handleError(_0x63f9d3,_0x1c2fe0){_0x1c2fe0=_0x1c2fe0||0x1f4;return function(_0x53edbb){logger['error'](_0x53edbb['stack']);if(_0x53edbb[_0xcd0d('0x24')]){delete _0x53edbb['name'];}_0x63f9d3['status'](_0x1c2fe0)[_0xcd0d('0x25')](_0x53edbb);};}exports['index']=function(_0x223a68,_0x26825d){var _0x3a217b={},_0x4b186b={},_0x2eefb8={'count':0x0,'rows':[]};var _0x99b1a0=_['map'](db['FreshsalesField'][_0xcd0d('0x26')],function(_0x578361){return{'name':_0x578361[_0xcd0d('0x27')],'type':_0x578361['type'][_0xcd0d('0x28')]};});_0x4b186b[_0xcd0d('0x29')]=_['map'](_0x99b1a0,_0xcd0d('0x24'));_0x4b186b['query']=_['keys'](_0x223a68[_0xcd0d('0x2a')]);_0x4b186b[_0xcd0d('0x2b')]=_[_0xcd0d('0x2c')](_0x4b186b[_0xcd0d('0x29')],_0x4b186b[_0xcd0d('0x2a')]);_0x3a217b[_0xcd0d('0x2d')]=_[_0xcd0d('0x2c')](_0x4b186b[_0xcd0d('0x29')],qs[_0xcd0d('0x2e')](_0x223a68['query'][_0xcd0d('0x2e')]));_0x3a217b[_0xcd0d('0x2d')]=_0x3a217b[_0xcd0d('0x2d')]['length']?_0x3a217b[_0xcd0d('0x2d')]:_0x4b186b[_0xcd0d('0x29')];if(!_0x223a68[_0xcd0d('0x2a')]['hasOwnProperty'](_0xcd0d('0x2f'))){_0x3a217b[_0xcd0d('0x1b')]=qs[_0xcd0d('0x1b')](_0x223a68[_0xcd0d('0x2a')]['limit']);_0x3a217b[_0xcd0d('0x19')]=qs[_0xcd0d('0x19')](_0x223a68['query'][_0xcd0d('0x19')]);}_0x3a217b[_0xcd0d('0x30')]=qs[_0xcd0d('0x31')](_0x223a68['query']['sort']);_0x3a217b[_0xcd0d('0x32')]=qs['filters'](_[_0xcd0d('0x33')](_0x223a68[_0xcd0d('0x2a')],_0x4b186b['filters']),_0x99b1a0);if(_0x223a68[_0xcd0d('0x2a')][_0xcd0d('0x34')]){_0x3a217b['where']=_[_0xcd0d('0x35')](_0x3a217b['where'],{'$or':_[_0xcd0d('0x36')](_0x99b1a0,function(_0x4e4f52){if(_0x4e4f52[_0xcd0d('0x37')]!==_0xcd0d('0x38')){var _0x4a64cc={};_0x4a64cc[_0x4e4f52['name']]={'$like':'%'+_0x223a68[_0xcd0d('0x2a')]['filter']+'%'};return _0x4a64cc;}})});}_0x3a217b=_['merge']({},_0x3a217b,_0x223a68[_0xcd0d('0x39')]);var _0x1cf434={'where':_0x3a217b[_0xcd0d('0x32')]};return db[_0xcd0d('0x3a')][_0xcd0d('0x1c')](_0x1cf434)[_0xcd0d('0x22')](function(_0x521a2c){_0x2eefb8[_0xcd0d('0x1c')]=_0x521a2c;if(_0x223a68[_0xcd0d('0x2a')]['includeAll']){_0x3a217b[_0xcd0d('0x3b')]=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x3a217b);})[_0xcd0d('0x22')](function(_0x19a449){_0x2eefb8[_0xcd0d('0x3c')]=_0x19a449;return _0x2eefb8;})[_0xcd0d('0x22')](respondWithFilteredResult(_0x26825d,_0x3a217b))[_0xcd0d('0x3d')](handleError(_0x26825d,null));};exports[_0xcd0d('0x3e')]=function(_0x279314,_0x3e18cd){var _0xd7b2f8={'raw':!![],'where':{'id':_0x279314[_0xcd0d('0x3f')]['id']}},_0x48e191={};_0x48e191[_0xcd0d('0x29')]=_['keys'](db[_0xcd0d('0x3a')][_0xcd0d('0x26')]);_0x48e191[_0xcd0d('0x2a')]=_[_0xcd0d('0x40')](_0x279314[_0xcd0d('0x2a')]);_0x48e191[_0xcd0d('0x2b')]=_[_0xcd0d('0x2c')](_0x48e191[_0xcd0d('0x29')],_0x48e191[_0xcd0d('0x2a')]);_0xd7b2f8['attributes']=_[_0xcd0d('0x2c')](_0x48e191[_0xcd0d('0x29')],qs['fields'](_0x279314[_0xcd0d('0x2a')]['fields']));_0xd7b2f8[_0xcd0d('0x2d')]=_0xd7b2f8[_0xcd0d('0x2d')]['length']?_0xd7b2f8[_0xcd0d('0x2d')]:_0x48e191[_0xcd0d('0x29')];if(_0x279314['query']['includeAll']){_0xd7b2f8[_0xcd0d('0x3b')]=[{'all':!![]}];}_0xd7b2f8=_[_0xcd0d('0x35')]({},_0xd7b2f8,_0x279314[_0xcd0d('0x39')]);return db['FreshsalesField'][_0xcd0d('0x41')](_0xd7b2f8)[_0xcd0d('0x22')](handleEntityNotFound(_0x3e18cd,null))['then'](respondWithResult(_0x3e18cd,null))['catch'](handleError(_0x3e18cd,null));};exports['create']=function(_0x47bc44,_0x3992f5){return db[_0xcd0d('0x3a')][_0xcd0d('0x42')](_0x47bc44[_0xcd0d('0x43')],{})['then'](respondWithResult(_0x3992f5,0xc9))[_0xcd0d('0x3d')](handleError(_0x3992f5,null));};exports[_0xcd0d('0x21')]=function(_0x16a9e3,_0xd25e33){if(_0x16a9e3[_0xcd0d('0x43')]['id']){delete _0x16a9e3[_0xcd0d('0x43')]['id'];}return db[_0xcd0d('0x3a')][_0xcd0d('0x41')]({'where':{'id':_0x16a9e3[_0xcd0d('0x3f')]['id']}})['then'](handleEntityNotFound(_0xd25e33,null))[_0xcd0d('0x22')](saveUpdates(_0x16a9e3[_0xcd0d('0x43')],null))[_0xcd0d('0x22')](respondWithResult(_0xd25e33,null))['catch'](handleError(_0xd25e33,null));};exports['destroy']=function(_0x5a2627,_0x60e503){return db[_0xcd0d('0x3a')][_0xcd0d('0x41')]({'where':{'id':_0x5a2627[_0xcd0d('0x3f')]['id']}})[_0xcd0d('0x22')](handleEntityNotFound(_0x60e503,null))[_0xcd0d('0x22')](removeEntity(_0x60e503,null))[_0xcd0d('0x3d')](handleError(_0x60e503,null));}; \ No newline at end of file +var _0xfb61=['count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','FreshsalesField','catch','show','params','intersection','length','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined'];(function(_0x467b55,_0x51cad2){var _0x3ed372=function(_0x4761a1){while(--_0x4761a1){_0x467b55['push'](_0x467b55['shift']());}};_0x3ed372(++_0x51cad2);}(_0xfb61,0x1ae));var _0x1fb6=function(_0x4907de,_0x5bbdc6){_0x4907de=_0x4907de-0x0;var _0x482054=_0xfb61[_0x4907de];return _0x482054;};'use strict';var emlformat=require(_0x1fb6('0x0'));var rimraf=require(_0x1fb6('0x1'));var zipdir=require(_0x1fb6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1fb6('0x3'));var moment=require(_0x1fb6('0x4'));var BPromise=require(_0x1fb6('0x5'));var Mustache=require(_0x1fb6('0x6'));var util=require(_0x1fb6('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x1fb6('0x8'));var ejs=require(_0x1fb6('0x9'));var fs=require('fs');var fs_extra=require(_0x1fb6('0xa'));var _=require(_0x1fb6('0xb'));var squel=require(_0x1fb6('0xc'));var crypto=require(_0x1fb6('0xd'));var jsforce=require(_0x1fb6('0xe'));var deskjs=require(_0x1fb6('0xf'));var toCsv=require(_0x1fb6('0x8'));var querystring=require(_0x1fb6('0x10'));var Papa=require(_0x1fb6('0x11'));var Redis=require(_0x1fb6('0x12'));var authService=require(_0x1fb6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1fb6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1fb6('0x15'))(_0x1fb6('0x16'));var utils=require(_0x1fb6('0x17'));var config=require(_0x1fb6('0x18'));var licenseUtil=require(_0x1fb6('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9c5281,_0x4de943){_0x4de943=_0x4de943||0xcc;return function(_0x322bed){if(_0x322bed){return _0x9c5281[_0x1fb6('0x1a')](_0x4de943);}return _0x9c5281[_0x1fb6('0x1b')](_0x4de943)[_0x1fb6('0x1c')]();};}function respondWithResult(_0xc69038,_0x31b1b1){_0x31b1b1=_0x31b1b1||0xc8;return function(_0x314b07){if(_0x314b07){return _0xc69038['status'](_0x31b1b1)[_0x1fb6('0x1d')](_0x314b07);}};}function respondWithFilteredResult(_0x4bb396,_0x2f4916){return function(_0x17bd74){if(_0x17bd74){var _0x801ab2=typeof _0x2f4916['offset']==='undefined'&&typeof _0x2f4916[_0x1fb6('0x1e')]===_0x1fb6('0x1f');var _0x2aec11=_0x17bd74[_0x1fb6('0x20')];var _0x3fd429=_0x801ab2?0x0:_0x2f4916[_0x1fb6('0x21')];var _0xfafdc6=_0x801ab2?_0x17bd74[_0x1fb6('0x20')]:_0x2f4916[_0x1fb6('0x21')]+_0x2f4916[_0x1fb6('0x1e')];var _0x1bc547;if(_0xfafdc6>=_0x2aec11){_0xfafdc6=_0x2aec11;_0x1bc547=0xc8;}else{_0x1bc547=0xce;}_0x4bb396[_0x1fb6('0x1b')](_0x1bc547);return _0x4bb396[_0x1fb6('0x22')](_0x1fb6('0x23'),_0x3fd429+'-'+_0xfafdc6+'/'+_0x2aec11)['json'](_0x17bd74);}return null;};}function patchUpdates(_0x345671){return function(_0x1dca94){try{jsonpatch[_0x1fb6('0x24')](_0x1dca94,_0x345671,!![]);}catch(_0x5f07aa){return BPromise[_0x1fb6('0x25')](_0x5f07aa);}return _0x1dca94[_0x1fb6('0x26')]();};}function saveUpdates(_0x41ac5d,_0x3f1a96){return function(_0x8afe0f){if(_0x8afe0f){return _0x8afe0f[_0x1fb6('0x27')](_0x41ac5d)[_0x1fb6('0x28')](function(_0x4d4109){return _0x4d4109;});}return null;};}function removeEntity(_0x55a1d2,_0x1c57a5){return function(_0x11eef9){if(_0x11eef9){return _0x11eef9[_0x1fb6('0x29')]()[_0x1fb6('0x28')](function(){_0x55a1d2[_0x1fb6('0x1b')](0xcc)[_0x1fb6('0x1c')]();});}};}function handleEntityNotFound(_0x481a43,_0x10366a){return function(_0x18000d){if(!_0x18000d){_0x481a43['sendStatus'](0x194);}return _0x18000d;};}function handleError(_0x140eec,_0x1f1159){_0x1f1159=_0x1f1159||0x1f4;return function(_0x4b12fc){logger['error'](_0x4b12fc[_0x1fb6('0x2a')]);if(_0x4b12fc[_0x1fb6('0x2b')]){delete _0x4b12fc['name'];}_0x140eec[_0x1fb6('0x1b')](_0x1f1159)[_0x1fb6('0x2c')](_0x4b12fc);};}exports[_0x1fb6('0x2d')]=function(_0x1c2104,_0x491b89){var _0x1eb122={},_0x227502={},_0x429e3d={'count':0x0,'rows':[]};var _0x5f1453=_['map'](db['FreshsalesField'][_0x1fb6('0x2e')],function(_0x5752b5){return{'name':_0x5752b5[_0x1fb6('0x2f')],'type':_0x5752b5[_0x1fb6('0x30')][_0x1fb6('0x31')]};});_0x227502[_0x1fb6('0x32')]=_[_0x1fb6('0x33')](_0x5f1453,_0x1fb6('0x2b'));_0x227502[_0x1fb6('0x34')]=_[_0x1fb6('0x35')](_0x1c2104[_0x1fb6('0x34')]);_0x227502[_0x1fb6('0x36')]=_['intersection'](_0x227502[_0x1fb6('0x32')],_0x227502[_0x1fb6('0x34')]);_0x1eb122[_0x1fb6('0x37')]=_['intersection'](_0x227502[_0x1fb6('0x32')],qs[_0x1fb6('0x38')](_0x1c2104[_0x1fb6('0x34')]['fields']));_0x1eb122['attributes']=_0x1eb122[_0x1fb6('0x37')]['length']?_0x1eb122['attributes']:_0x227502['model'];if(!_0x1c2104['query'][_0x1fb6('0x39')]('nolimit')){_0x1eb122[_0x1fb6('0x1e')]=qs['limit'](_0x1c2104['query'][_0x1fb6('0x1e')]);_0x1eb122[_0x1fb6('0x21')]=qs['offset'](_0x1c2104[_0x1fb6('0x34')]['offset']);}_0x1eb122[_0x1fb6('0x3a')]=qs[_0x1fb6('0x3b')](_0x1c2104[_0x1fb6('0x34')][_0x1fb6('0x3b')]);_0x1eb122['where']=qs[_0x1fb6('0x36')](_[_0x1fb6('0x3c')](_0x1c2104['query'],_0x227502['filters']),_0x5f1453);if(_0x1c2104[_0x1fb6('0x34')]['filter']){_0x1eb122[_0x1fb6('0x3d')]=_[_0x1fb6('0x3e')](_0x1eb122['where'],{'$or':_[_0x1fb6('0x33')](_0x5f1453,function(_0x26b993){if(_0x26b993['type']!==_0x1fb6('0x3f')){var _0x470f7a={};_0x470f7a[_0x26b993['name']]={'$like':'%'+_0x1c2104['query'][_0x1fb6('0x40')]+'%'};return _0x470f7a;}})});}_0x1eb122=_[_0x1fb6('0x3e')]({},_0x1eb122,_0x1c2104['options']);var _0x1b8a65={'where':_0x1eb122['where']};return db['FreshsalesField'][_0x1fb6('0x20')](_0x1b8a65)[_0x1fb6('0x28')](function(_0x3d110d){_0x429e3d['count']=_0x3d110d;if(_0x1c2104[_0x1fb6('0x34')][_0x1fb6('0x41')]){_0x1eb122[_0x1fb6('0x42')]=[{'all':!![]}];}return db[_0x1fb6('0x43')]['findAll'](_0x1eb122);})['then'](function(_0x5230da){_0x429e3d['rows']=_0x5230da;return _0x429e3d;})[_0x1fb6('0x28')](respondWithFilteredResult(_0x491b89,_0x1eb122))[_0x1fb6('0x44')](handleError(_0x491b89,null));};exports[_0x1fb6('0x45')]=function(_0x502db8,_0x3593df){var _0xa26edf={'raw':!![],'where':{'id':_0x502db8[_0x1fb6('0x46')]['id']}},_0x47818c={};_0x47818c['model']=_['keys'](db[_0x1fb6('0x43')][_0x1fb6('0x2e')]);_0x47818c[_0x1fb6('0x34')]=_[_0x1fb6('0x35')](_0x502db8[_0x1fb6('0x34')]);_0x47818c[_0x1fb6('0x36')]=_[_0x1fb6('0x47')](_0x47818c[_0x1fb6('0x32')],_0x47818c['query']);_0xa26edf[_0x1fb6('0x37')]=_[_0x1fb6('0x47')](_0x47818c[_0x1fb6('0x32')],qs[_0x1fb6('0x38')](_0x502db8[_0x1fb6('0x34')]['fields']));_0xa26edf['attributes']=_0xa26edf[_0x1fb6('0x37')][_0x1fb6('0x48')]?_0xa26edf['attributes']:_0x47818c[_0x1fb6('0x32')];if(_0x502db8['query'][_0x1fb6('0x41')]){_0xa26edf[_0x1fb6('0x42')]=[{'all':!![]}];}_0xa26edf=_[_0x1fb6('0x3e')]({},_0xa26edf,_0x502db8[_0x1fb6('0x49')]);return db[_0x1fb6('0x43')][_0x1fb6('0x4a')](_0xa26edf)['then'](handleEntityNotFound(_0x3593df,null))['then'](respondWithResult(_0x3593df,null))['catch'](handleError(_0x3593df,null));};exports[_0x1fb6('0x4b')]=function(_0x3c2ad2,_0x308b57){return db[_0x1fb6('0x43')][_0x1fb6('0x4b')](_0x3c2ad2[_0x1fb6('0x4c')],{})[_0x1fb6('0x28')](respondWithResult(_0x308b57,0xc9))['catch'](handleError(_0x308b57,null));};exports[_0x1fb6('0x27')]=function(_0x4fee5a,_0x153274){if(_0x4fee5a['body']['id']){delete _0x4fee5a[_0x1fb6('0x4c')]['id'];}return db[_0x1fb6('0x43')][_0x1fb6('0x4a')]({'where':{'id':_0x4fee5a['params']['id']}})['then'](handleEntityNotFound(_0x153274,null))[_0x1fb6('0x28')](saveUpdates(_0x4fee5a['body'],null))[_0x1fb6('0x28')](respondWithResult(_0x153274,null))[_0x1fb6('0x44')](handleError(_0x153274,null));};exports[_0x1fb6('0x29')]=function(_0x298b1b,_0x10792f){return db[_0x1fb6('0x43')][_0x1fb6('0x4a')]({'where':{'id':_0x298b1b[_0x1fb6('0x46')]['id']}})['then'](handleEntityNotFound(_0x10792f,null))[_0x1fb6('0x28')](removeEntity(_0x10792f,null))[_0x1fb6('0x44')](handleError(_0x10792f,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 223bcbd..e0d1a82 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 _0x3c1a=['request-promise','rimraf','./intFreshsalesField.attributes','exports','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5d46c7,_0x458fb1){var _0x59bb87=function(_0x19d17f){while(--_0x19d17f){_0x5d46c7['push'](_0x5d46c7['shift']());}};_0x59bb87(++_0x458fb1);}(_0x3c1a,0xda));var _0xa3c1=function(_0x211632,_0x378e2e){_0x211632=_0x211632-0x0;var _0x5a1da1=_0x3c1a[_0x211632];return _0x5a1da1;};'use strict';var _=require(_0xa3c1('0x0'));var util=require(_0xa3c1('0x1'));var logger=require(_0xa3c1('0x2'))(_0xa3c1('0x3'));var moment=require(_0xa3c1('0x4'));var BPromise=require(_0xa3c1('0x5'));var rp=require(_0xa3c1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa3c1('0x7'));var config=require('../../config/environment');var attributes=require(_0xa3c1('0x8'));module[_0xa3c1('0x9')]=function(_0x3f6cab,_0x2da4d2){return _0x3f6cab['define']('FreshsalesField',attributes,{'tableName':_0xa3c1('0xa'),'paranoid':![],'indexes':[{'name':_0xa3c1('0xb'),'fields':[_0xa3c1('0xc'),_0xa3c1('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9ab9=['api','moment','request-promise','path','../../config/environment','exports','define','FreshsalesField','idField','FieldId','lodash','util','../../config/logger'];(function(_0x209203,_0xf7bc3){var _0x910569=function(_0x2ec6eb){while(--_0x2ec6eb){_0x209203['push'](_0x209203['shift']());}};_0x910569(++_0xf7bc3);}(_0x9ab9,0x19d));var _0x99ab=function(_0x2105b3,_0x2ce2de){_0x2105b3=_0x2105b3-0x0;var _0x425d83=_0x9ab9[_0x2105b3];return _0x425d83;};'use strict';var _=require(_0x99ab('0x0'));var util=require(_0x99ab('0x1'));var logger=require(_0x99ab('0x2'))(_0x99ab('0x3'));var moment=require(_0x99ab('0x4'));var BPromise=require('bluebird');var rp=require(_0x99ab('0x5'));var fs=require('fs');var path=require(_0x99ab('0x6'));var rimraf=require('rimraf');var config=require(_0x99ab('0x7'));var attributes=require('./intFreshsalesField.attributes');module[_0x99ab('0x8')]=function(_0x1042a3,_0x390d41){return _0x1042a3[_0x99ab('0x9')](_0x99ab('0xa'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x99ab('0xb'),_0x99ab('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index a23e132..a79f67d 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 _0x326f=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x26f073,_0x3ebdde){var _0x3c6e8b=function(_0x30742d){while(--_0x30742d){_0x26f073['push'](_0x26f073['shift']());}};_0x3c6e8b(++_0x3ebdde);}(_0x326f,0xd1));var _0xf326=function(_0xed5379,_0x18fc46){_0xed5379=_0xed5379-0x0;var _0x333f27=_0x326f[_0xed5379];return _0x333f27;};'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')]('FreshsalesField,\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')]('FreshsalesField,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +var _0x5d17=['request','info','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x203527,_0x3663c0){var _0x21cf5e=function(_0x23d73e){while(--_0x23d73e){_0x203527['push'](_0x203527['shift']());}};_0x21cf5e(++_0x3663c0);}(_0x5d17,0x114));var _0x75d1=function(_0x27c1ab,_0x3734be){_0x27c1ab=_0x27c1ab-0x0;var _0x5087a3=_0x5d17[_0x27c1ab];return _0x5087a3;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x75d1('0x2'));var fs=require('fs');var Redis=require(_0x75d1('0x3'));var db=require(_0x75d1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x75d1('0x5'))(_0x75d1('0x6'));var config=require(_0x75d1('0x7'));var jayson=require(_0x75d1('0x8'));var client=jayson['client'][_0x75d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x116a51,_0x5c957a,_0x1ee61b){return new BPromise(function(_0x3a9d5e,_0x105607){return client[_0x75d1('0xa')](_0x116a51,_0x1ee61b)['then'](function(_0x4cf632){logger[_0x75d1('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x5c957a,'request\x20sent');logger[_0x75d1('0xc')](_0x75d1('0xd'),_0x5c957a,'request\x20sent',JSON[_0x75d1('0xe')](_0x4cf632));if(_0x4cf632[_0x75d1('0xf')]){if(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x10')]===0x1f4){logger[_0x75d1('0xf')](_0x75d1('0x11'),_0x5c957a,_0x4cf632['error'][_0x75d1('0x12')]);return _0x105607(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x12')]);}logger[_0x75d1('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x5c957a,_0x4cf632['error']['message']);return _0x3a9d5e(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x12')]);}else{logger[_0x75d1('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x5c957a,_0x75d1('0x13'));_0x3a9d5e(_0x4cf632[_0x75d1('0x14')][_0x75d1('0x12')]);}})[_0x75d1('0x15')](function(_0x1160ca){logger[_0x75d1('0xf')](_0x75d1('0x11'),_0x5c957a,_0x1160ca);_0x105607(_0x1160ca);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 9b89b85..91304ac 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(_0xb77909,_0x3f62e3){var _0x46a4aa=function(_0x532a60){while(--_0x532a60){_0xb77909['push'](_0xb77909['shift']());}};_0x46a4aa(++_0x3f62e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x36c6f4,_0x27ea73){var _0x3517fa=function(_0xf66780){while(--_0xf66780){_0x36c6f4['push'](_0x36c6f4['shift']());}};_0x3517fa(++_0x27ea73);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 429fc1a..4c6debf 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 _0x928c=['newTab','sequelize','STRING','username','ENUM','integrationTab'];(function(_0x3b4144,_0x39bdf4){var _0x201797=function(_0x90d2eb){while(--_0x90d2eb){_0x3b4144['push'](_0x3b4144['shift']());}};_0x201797(++_0x39bdf4);}(_0x928c,0x157));var _0xc928=function(_0xba38bd,_0x140c0f){_0xba38bd=_0xba38bd-0x0;var _0x2afd17=_0x928c[_0xba38bd];return _0x2afd17;};'use strict';var Sequelize=require(_0xc928('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc928('0x1')]},'username':{'type':Sequelize[_0xc928('0x1')],'unique':_0xc928('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xc928('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xc928('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xc928('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xc928('0x3')](_0xc928('0x4'),_0xc928('0x5')),'defaultValue':_0xc928('0x4')}}; \ No newline at end of file +var _0xe056=['STRING','integrationTab','newTab'];(function(_0x5ee8f4,_0x3dc0f){var _0x5c1405=function(_0x1012c6){while(--_0x1012c6){_0x5ee8f4['push'](_0x5ee8f4['shift']());}};_0x5c1405(++_0x3dc0f);}(_0xe056,0xdb));var _0x6e05=function(_0x2bb66c,_0x36c6c6){_0x2bb66c=_0x2bb66c-0x0;var _0x1e0f98=_0xe056[_0x2bb66c];return _0x1e0f98;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6e05('0x0')]},'description':{'type':Sequelize[_0x6e05('0x0')]},'username':{'type':Sequelize[_0x6e05('0x0')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x6e05('0x0')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x6e05('0x0')]},'clientSecret':{'type':Sequelize[_0x6e05('0x0')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6e05('0x1'),_0x6e05('0x2')),'defaultValue':_0x6e05('0x1')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 3878a06..8df533d 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 _0x0f9e=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','getSubjects','channel','getDescriptions','SalesforceField','Subjects','Descriptions','getFields','Task','remoteUri','clientId','clientSecret','username','password','substring','lastIndexOf','concat','securityToken','isNil','ticketType','describe','OwnerId','ActivityDate','Subject','string','int','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','False','false','getFields,\x20%s,\x20%s,\x20%s','stringify','test','statusCode'];(function(_0x243630,_0x1dfc62){var _0x1ad06a=function(_0x4364f6){while(--_0x4364f6){_0x243630['push'](_0x243630['shift']());}};_0x1ad06a(++_0x1dfc62);}(_0x0f9e,0x7e));var _0xe0f9=function(_0x4ac575,_0x5e9a80){_0x4ac575=_0x4ac575-0x0;var _0x262479=_0x0f9e[_0x4ac575];return _0x262479;};'use strict';var emlformat=require(_0xe0f9('0x0'));var rimraf=require(_0xe0f9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0f9('0x2'));var rp=require(_0xe0f9('0x3'));var moment=require(_0xe0f9('0x4'));var BPromise=require(_0xe0f9('0x5'));var Mustache=require(_0xe0f9('0x6'));var util=require(_0xe0f9('0x7'));var path=require(_0xe0f9('0x8'));var sox=require(_0xe0f9('0x9'));var csv=require(_0xe0f9('0xa'));var ejs=require(_0xe0f9('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe0f9('0xc'));var crypto=require(_0xe0f9('0xd'));var jsforce=require(_0xe0f9('0xe'));var deskjs=require(_0xe0f9('0xf'));var toCsv=require(_0xe0f9('0xa'));var querystring=require(_0xe0f9('0x10'));var Papa=require(_0xe0f9('0x11'));var Redis=require(_0xe0f9('0x12'));var authService=require(_0xe0f9('0x13'));var qs=require(_0xe0f9('0x14'));var as=require(_0xe0f9('0x15'));var hardwareService=require(_0xe0f9('0x16'));var logger=require('../../config/logger')(_0xe0f9('0x17'));var utils=require(_0xe0f9('0x18'));var config=require(_0xe0f9('0x19'));var licenseUtil=require(_0xe0f9('0x1a'));var db=require(_0xe0f9('0x1b'))['db'];var integrations=require(_0xe0f9('0x1c'));function respondWithStatusCode(_0x23398c,_0x1d58e0){_0x1d58e0=_0x1d58e0||0xcc;return function(_0x33e457){if(_0x33e457){return _0x23398c[_0xe0f9('0x1d')](_0x1d58e0);}return _0x23398c[_0xe0f9('0x1e')](_0x1d58e0)[_0xe0f9('0x1f')]();};}function respondWithResult(_0x1beadc,_0x43863e){_0x43863e=_0x43863e||0xc8;return function(_0x5e4343){if(_0x5e4343){return _0x1beadc[_0xe0f9('0x1e')](_0x43863e)[_0xe0f9('0x20')](_0x5e4343);}};}function respondWithFilteredResult(_0x17dd29,_0x1a16e3){return function(_0x128a32){if(_0x128a32){var _0x2420af=typeof _0x1a16e3[_0xe0f9('0x21')]===_0xe0f9('0x22')&&typeof _0x1a16e3[_0xe0f9('0x23')]===_0xe0f9('0x22');var _0x1bdc78=_0x128a32['count'];var _0x9f3273=_0x2420af?0x0:_0x1a16e3['offset'];var _0x1752e0=_0x2420af?_0x128a32['count']:_0x1a16e3[_0xe0f9('0x21')]+_0x1a16e3[_0xe0f9('0x23')];var _0x4cc8d9;if(_0x1752e0>=_0x1bdc78){_0x1752e0=_0x1bdc78;_0x4cc8d9=0xc8;}else{_0x4cc8d9=0xce;}_0x17dd29[_0xe0f9('0x1e')](_0x4cc8d9);return _0x17dd29[_0xe0f9('0x24')](_0xe0f9('0x25'),_0x9f3273+'-'+_0x1752e0+'/'+_0x1bdc78)[_0xe0f9('0x20')](_0x128a32);}return null;};}function patchUpdates(_0x275315){return function(_0x210f74){try{jsonpatch['apply'](_0x210f74,_0x275315,!![]);}catch(_0x15ef0f){return BPromise['reject'](_0x15ef0f);}return _0x210f74[_0xe0f9('0x26')]();};}function saveUpdates(_0x11aae5,_0x1be055){return function(_0xa56be2){if(_0xa56be2){return _0xa56be2[_0xe0f9('0x27')](_0x11aae5)[_0xe0f9('0x28')](function(_0x153a17){return _0x153a17;});}return null;};}function removeEntity(_0x27f855,_0x48be7c){return function(_0x2e3504){if(_0x2e3504){return _0x2e3504[_0xe0f9('0x29')]()[_0xe0f9('0x28')](function(){_0x27f855[_0xe0f9('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x321d49,_0x389e65){return function(_0x259193){if(!_0x259193){_0x321d49[_0xe0f9('0x1d')](0x194);}return _0x259193;};}function handleError(_0x27ee7d,_0x17e355){_0x17e355=_0x17e355||0x1f4;return function(_0x283337){logger[_0xe0f9('0x2a')](_0x283337[_0xe0f9('0x2b')]);if(_0x283337[_0xe0f9('0x2c')]){delete _0x283337[_0xe0f9('0x2c')];}_0x27ee7d[_0xe0f9('0x1e')](_0x17e355)['send'](_0x283337);};}exports[_0xe0f9('0x2d')]=function(_0x144562,_0x1fb579){var _0x412c02={},_0x534218={},_0x2401ca={'count':0x0,'rows':[]};var _0x399510=_[_0xe0f9('0x2e')](db[_0xe0f9('0x2f')][_0xe0f9('0x30')],function(_0xde52b0){return{'name':_0xde52b0[_0xe0f9('0x31')],'type':_0xde52b0[_0xe0f9('0x32')][_0xe0f9('0x33')]};});_0x534218[_0xe0f9('0x34')]=_[_0xe0f9('0x2e')](_0x399510,'name');_0x534218[_0xe0f9('0x35')]=_[_0xe0f9('0x36')](_0x144562[_0xe0f9('0x35')]);_0x534218[_0xe0f9('0x37')]=_['intersection'](_0x534218[_0xe0f9('0x34')],_0x534218[_0xe0f9('0x35')]);_0x412c02['attributes']=_['intersection'](_0x534218[_0xe0f9('0x34')],qs[_0xe0f9('0x38')](_0x144562[_0xe0f9('0x35')][_0xe0f9('0x38')]));_0x412c02[_0xe0f9('0x39')]=_0x412c02['attributes'][_0xe0f9('0x3a')]?_0x412c02[_0xe0f9('0x39')]:_0x534218[_0xe0f9('0x34')];if(!_0x144562['query'][_0xe0f9('0x3b')](_0xe0f9('0x3c'))){_0x412c02[_0xe0f9('0x23')]=qs[_0xe0f9('0x23')](_0x144562[_0xe0f9('0x35')][_0xe0f9('0x23')]);_0x412c02[_0xe0f9('0x21')]=qs[_0xe0f9('0x21')](_0x144562['query'][_0xe0f9('0x21')]);}_0x412c02[_0xe0f9('0x3d')]=qs[_0xe0f9('0x3e')](_0x144562[_0xe0f9('0x35')][_0xe0f9('0x3e')]);_0x412c02[_0xe0f9('0x3f')]=qs[_0xe0f9('0x37')](_[_0xe0f9('0x40')](_0x144562[_0xe0f9('0x35')],_0x534218[_0xe0f9('0x37')]),_0x399510);if(_0x144562[_0xe0f9('0x35')]['filter']){_0x412c02[_0xe0f9('0x3f')]=_['merge'](_0x412c02['where'],{'$or':_['map'](_0x399510,function(_0x118b3e){if(_0x118b3e[_0xe0f9('0x32')]!==_0xe0f9('0x41')){var _0x57450d={};_0x57450d[_0x118b3e[_0xe0f9('0x2c')]]={'$like':'%'+_0x144562['query'][_0xe0f9('0x42')]+'%'};return _0x57450d;}})});}_0x412c02=_[_0xe0f9('0x43')]({},_0x412c02,_0x144562[_0xe0f9('0x44')]);var _0x47a8a1={'where':_0x412c02[_0xe0f9('0x3f')]};return db[_0xe0f9('0x2f')][_0xe0f9('0x45')](_0x47a8a1)['then'](function(_0xfa4014){_0x2401ca[_0xe0f9('0x45')]=_0xfa4014;if(_0x144562[_0xe0f9('0x35')][_0xe0f9('0x46')]){_0x412c02[_0xe0f9('0x47')]=[{'all':!![]}];}return db[_0xe0f9('0x2f')][_0xe0f9('0x48')](_0x412c02);})[_0xe0f9('0x28')](function(_0x39760c){_0x2401ca[_0xe0f9('0x49')]=_0x39760c;return _0x2401ca;})[_0xe0f9('0x28')](respondWithFilteredResult(_0x1fb579,_0x412c02))[_0xe0f9('0x4a')](handleError(_0x1fb579,null));};exports[_0xe0f9('0x4b')]=function(_0x244e2f,_0x181a02){var _0x434386={'raw':![],'where':{'id':_0x244e2f[_0xe0f9('0x4c')]['id']}},_0x263eaf={};_0x263eaf[_0xe0f9('0x34')]=_[_0xe0f9('0x36')](db['SalesforceAccount'][_0xe0f9('0x30')]);_0x263eaf[_0xe0f9('0x35')]=_[_0xe0f9('0x36')](_0x244e2f[_0xe0f9('0x35')]);_0x263eaf[_0xe0f9('0x37')]=_[_0xe0f9('0x4d')](_0x263eaf['model'],_0x263eaf['query']);_0x434386[_0xe0f9('0x39')]=_[_0xe0f9('0x4d')](_0x263eaf[_0xe0f9('0x34')],qs[_0xe0f9('0x38')](_0x244e2f[_0xe0f9('0x35')][_0xe0f9('0x38')]));_0x434386[_0xe0f9('0x39')]=_0x434386['attributes'][_0xe0f9('0x3a')]?_0x434386[_0xe0f9('0x39')]:_0x263eaf[_0xe0f9('0x34')];if(_0x244e2f[_0xe0f9('0x35')][_0xe0f9('0x46')]){_0x434386[_0xe0f9('0x47')]=[{'all':!![]}];}_0x434386=_['merge']({},_0x434386,_0x244e2f[_0xe0f9('0x44')]);return db[_0xe0f9('0x2f')][_0xe0f9('0x4e')](_0x434386)['then'](handleEntityNotFound(_0x181a02,null))[_0xe0f9('0x28')](respondWithResult(_0x181a02,null))['catch'](handleError(_0x181a02,null));};exports[_0xe0f9('0x4f')]=function(_0x34403c,_0x5f75ae){return db[_0xe0f9('0x2f')][_0xe0f9('0x4f')](_0x34403c[_0xe0f9('0x50')],{})[_0xe0f9('0x28')](respondWithResult(_0x5f75ae,0xc9))[_0xe0f9('0x4a')](handleError(_0x5f75ae,null));};exports['update']=function(_0x574988,_0x5564c7){if(_0x574988[_0xe0f9('0x50')]['id']){delete _0x574988['body']['id'];}return db['SalesforceAccount'][_0xe0f9('0x4e')]({'where':{'id':_0x574988[_0xe0f9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5564c7,null))[_0xe0f9('0x28')](saveUpdates(_0x574988[_0xe0f9('0x50')],null))[_0xe0f9('0x28')](respondWithResult(_0x5564c7,null))['catch'](handleError(_0x5564c7,null));};exports['destroy']=function(_0x554e09,_0x3752eb){return db[_0xe0f9('0x2f')][_0xe0f9('0x4e')]({'where':{'id':_0x554e09[_0xe0f9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3752eb,null))[_0xe0f9('0x28')](removeEntity(_0x3752eb,null))[_0xe0f9('0x4a')](handleError(_0x3752eb,null));};exports[_0xe0f9('0x51')]=function(_0x335e92,_0x26f096,_0x289e7a){var _0x2b0f9c={};var _0x4e22b5={};var _0x133bf8;var _0x5024c9;return db[_0xe0f9('0x2f')][_0xe0f9('0x52')]({'where':{'id':_0x335e92[_0xe0f9('0x4c')]['id']}})[_0xe0f9('0x28')](handleEntityNotFound(_0x26f096,null))['then'](function(_0x3e3ca4){if(_0x3e3ca4){_0x133bf8=_0x3e3ca4;_0x4e22b5[_0xe0f9('0x34')]=_[_0xe0f9('0x36')](db[_0xe0f9('0x53')][_0xe0f9('0x30')]);_0x4e22b5[_0xe0f9('0x35')]=_['keys'](_0x335e92['query']);_0x4e22b5[_0xe0f9('0x37')]=_['intersection'](_0x4e22b5['model'],_0x4e22b5[_0xe0f9('0x35')]);_0x2b0f9c[_0xe0f9('0x39')]=_[_0xe0f9('0x4d')](_0x4e22b5[_0xe0f9('0x34')],qs[_0xe0f9('0x38')](_0x335e92[_0xe0f9('0x35')][_0xe0f9('0x38')]));_0x2b0f9c[_0xe0f9('0x39')]=_0x2b0f9c['attributes'][_0xe0f9('0x3a')]?_0x2b0f9c[_0xe0f9('0x39')]:_0x4e22b5[_0xe0f9('0x34')];_0x2b0f9c[_0xe0f9('0x3d')]=qs[_0xe0f9('0x3e')](_0x335e92[_0xe0f9('0x35')]['sort']);_0x2b0f9c[_0xe0f9('0x3f')]=qs[_0xe0f9('0x37')](_[_0xe0f9('0x40')](_0x335e92[_0xe0f9('0x35')],_0x4e22b5[_0xe0f9('0x37')]));if(_0x335e92['query'][_0xe0f9('0x42')]){_0x2b0f9c[_0xe0f9('0x3f')]=_[_0xe0f9('0x43')](_0x2b0f9c['where'],{'$or':_['map'](_0x2b0f9c[_0xe0f9('0x39')],function(_0xcfa69d){var _0x499d45={};_0x499d45[_0xcfa69d]={'$like':'%'+_0x335e92[_0xe0f9('0x35')][_0xe0f9('0x42')]+'%'};return _0x499d45;})});}_0x2b0f9c=_[_0xe0f9('0x43')]({},_0x2b0f9c,_0x335e92[_0xe0f9('0x44')]);return _0x133bf8[_0xe0f9('0x51')](_0x2b0f9c);}})['then'](function(_0x11306e){if(_0x11306e){_0x5024c9=_0x11306e[_0xe0f9('0x3a')];if(!_0x335e92['query']['hasOwnProperty'](_0xe0f9('0x3c'))){_0x2b0f9c[_0xe0f9('0x23')]=qs[_0xe0f9('0x23')](_0x335e92['query'][_0xe0f9('0x23')]);_0x2b0f9c[_0xe0f9('0x21')]=qs[_0xe0f9('0x21')](_0x335e92['query'][_0xe0f9('0x21')]);}return _0x133bf8[_0xe0f9('0x51')](_0x2b0f9c);}})[_0xe0f9('0x28')](function(_0x34cf4e){if(_0x34cf4e){return _0x34cf4e?{'count':_0x5024c9,'rows':_0x34cf4e}:null;}})['then'](respondWithResult(_0x26f096,null))['catch'](handleError(_0x26f096,null));};exports[_0xe0f9('0x54')]=function(_0x39f6c6,_0x33ea84,_0xbf7a1f){if(_0x39f6c6[_0xe0f9('0x50')]['id']){delete _0x39f6c6[_0xe0f9('0x50')]['id'];}return db[_0xe0f9('0x2f')][_0xe0f9('0x52')]({'where':{'id':_0x39f6c6[_0xe0f9('0x4c')]['id']}})[_0xe0f9('0x28')](handleEntityNotFound(_0x33ea84,null))[_0xe0f9('0x28')](function(_0x136fd4){if(_0x136fd4){_0x39f6c6['body'][_0xe0f9('0x55')]=_0x136fd4['id'];_0x39f6c6[_0xe0f9('0x50')]['Subjects']=integrations[_0xe0f9('0x56')](_0x39f6c6[_0xe0f9('0x50')][_0xe0f9('0x57')],_0x39f6c6[_0xe0f9('0x50')][_0xe0f9('0x32')]);_0x39f6c6[_0xe0f9('0x50')]['Descriptions']=integrations[_0xe0f9('0x58')](_0x39f6c6[_0xe0f9('0x50')][_0xe0f9('0x57')],_0x39f6c6['body'][_0xe0f9('0x32')]);return db['SalesforceConfiguration'][_0xe0f9('0x4f')](_0x39f6c6[_0xe0f9('0x50')],{'include':[{'model':db[_0xe0f9('0x59')],'as':_0xe0f9('0x5a')},{'model':db['SalesforceField'],'as':_0xe0f9('0x5b')}]});}return null;})['then'](respondWithResult(_0x33ea84,null))['catch'](handleError(_0x33ea84,null));};exports[_0xe0f9('0x5c')]=function(_0x5eb08c,_0x2fb5dc,_0x447550){var _0x5068b2;var _0x3b93bf='';var _0x1520d0=_0xe0f9('0x5d');return db[_0xe0f9('0x2f')][_0xe0f9('0x52')]({'where':{'id':_0x5eb08c[_0xe0f9('0x4c')]['id']},'attributes':['id',_0xe0f9('0x5e'),_0xe0f9('0x5f'),_0xe0f9('0x60'),_0xe0f9('0x61'),_0xe0f9('0x62'),'securityToken']})[_0xe0f9('0x28')](handleEntityNotFound(_0x2fb5dc,null))[_0xe0f9('0x28')](function(_0xa0e95b){if(_0xa0e95b){_0x3b93bf=_0xa0e95b['remoteUri'];var _0x2cd62f=_0x3b93bf['slice'](-0x1);if(_0x2cd62f==='/'){_0x3b93bf=_0x3b93bf[_0xe0f9('0x63')](0x0,_0x3b93bf[_0xe0f9('0x64')](_0x2cd62f));}_0x5068b2=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3b93bf,'clientId':_0xa0e95b[_0xe0f9('0x5f')],'clientSecret':_0xa0e95b[_0xe0f9('0x60')]}});return _0x5068b2['login'](_0xa0e95b['username'],_0xa0e95b[_0xe0f9('0x62')][_0xe0f9('0x65')](_0xa0e95b[_0xe0f9('0x66')]));}})[_0xe0f9('0x28')](function(_0x4dece0){if(_0x4dece0){if(!_[_0xe0f9('0x67')](_0x5eb08c[_0xe0f9('0x35')][_0xe0f9('0x68')])){_0x1520d0=_0x5eb08c[_0xe0f9('0x35')][_0xe0f9('0x68')];}return _0x5068b2['sobject'](_0x1520d0)[_0xe0f9('0x69')]();}})[_0xe0f9('0x28')](function(_0x20a85e){var _0x39fcb1=[_0xe0f9('0x6a'),_0xe0f9('0x6b'),'IsReminderSet','IsRecurrence',_0xe0f9('0x6c'),'Description'];var _0xc83f55=[_0xe0f9('0x6d'),_0xe0f9('0x6e'),'picklist',_0xe0f9('0x6f'),_0xe0f9('0x70'),_0xe0f9('0x71'),_0xe0f9('0x72')];if(_0x20a85e){_[_0xe0f9('0x73')](_0x20a85e['fields'],function(_0x5aecb0){return _0x39fcb1[_0xe0f9('0x74')](_0x5aecb0['name'])||!_0xc83f55[_0xe0f9('0x74')](_0x5aecb0[_0xe0f9('0x32')]);});return{'count':_0x20a85e['fields']['length'],'rows':_[_0xe0f9('0x2e')](_0x20a85e[_0xe0f9('0x38')],function(_0x5c434c){return{'id':_0x5c434c[_0xe0f9('0x2c')],'name':_0x5c434c[_0xe0f9('0x75')],'custom':_0x5c434c[_0xe0f9('0x76')],'options':_0x5c434c[_0xe0f9('0x77')][_0xe0f9('0x3a')]>0x0?_['map'](_0x5c434c[_0xe0f9('0x77')],function(_0x4e547c){return{'name':_0x4e547c[_0xe0f9('0x75')],'value':_0x4e547c['value']};}):_0x5c434c[_0xe0f9('0x32')]==_0xe0f9('0x6f')?[{'name':'True','value':'true'},{'name':_0xe0f9('0x78'),'value':_0xe0f9('0x79')}]:[]};})};}})[_0xe0f9('0x28')](respondWithResult(_0x2fb5dc,null))[_0xe0f9('0x4a')](function(_0x15db5b){var _0x4e7c40=_0x5eb08c[_0xe0f9('0x35')]['test']?0x1f4:_0x15db5b['statusCode']||0x1f4;logger['error'](_0xe0f9('0x7a'),_0xe0f9('0x5c'),_0x4e7c40,JSON[_0xe0f9('0x7b')](_0x15db5b));delete _0x15db5b[_0xe0f9('0x2c')];if(_0x4e7c40===0x191){_0x4e7c40=0x190;}_0x2fb5dc[_0xe0f9('0x1e')](_0x4e7c40)['send'](_0x5eb08c['query'][_0xe0f9('0x7c')]?{'message':'Wrong\x20credentials','statusCode':_0x15db5b[_0xe0f9('0x7d')]}:_0x15db5b);});}; \ No newline at end of file +var _0xe5c7=['email','phone','remove','includes','label','value','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','error','stack','name','index','map','SalesforceAccount','fieldName','type','model','keys','filters','attributes','fields','query','nolimit','offset','order','sort','pick','where','VIRTUAL','filter','merge','include','rows','catch','show','params','intersection','length','includeAll','options','create','body','destroy','find','getConfigurations','SalesforceConfiguration','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Subjects','Task','findOne','remoteUri','username','password','securityToken','slice','substring','lastIndexOf','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','Subject','Description','string','boolean'];(function(_0x2d2908,_0x1d613a){var _0x1bd810=function(_0x3b4af3){while(--_0x3b4af3){_0x2d2908['push'](_0x2d2908['shift']());}};_0x1bd810(++_0x1d613a);}(_0xe5c7,0x88));var _0x7e5c=function(_0x8a13cf,_0x5a1279){_0x8a13cf=_0x8a13cf-0x0;var _0x59fe67=_0xe5c7[_0x8a13cf];return _0x59fe67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7e5c('0x0'));var zipdir=require(_0x7e5c('0x1'));var jsonpatch=require(_0x7e5c('0x2'));var rp=require(_0x7e5c('0x3'));var moment=require(_0x7e5c('0x4'));var BPromise=require(_0x7e5c('0x5'));var Mustache=require('mustache');var util=require(_0x7e5c('0x6'));var path=require(_0x7e5c('0x7'));var sox=require(_0x7e5c('0x8'));var csv=require(_0x7e5c('0x9'));var ejs=require(_0x7e5c('0xa'));var fs=require('fs');var fs_extra=require(_0x7e5c('0xb'));var _=require('lodash');var squel=require(_0x7e5c('0xc'));var crypto=require(_0x7e5c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7e5c('0xe'));var toCsv=require(_0x7e5c('0x9'));var querystring=require(_0x7e5c('0xf'));var Papa=require(_0x7e5c('0x10'));var Redis=require(_0x7e5c('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7e5c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e5c('0x13'))(_0x7e5c('0x14'));var utils=require(_0x7e5c('0x15'));var config=require(_0x7e5c('0x16'));var licenseUtil=require(_0x7e5c('0x17'));var db=require(_0x7e5c('0x18'))['db'];var integrations=require(_0x7e5c('0x19'));function respondWithStatusCode(_0x30f2d3,_0x20cd44){_0x20cd44=_0x20cd44||0xcc;return function(_0x168ffb){if(_0x168ffb){return _0x30f2d3[_0x7e5c('0x1a')](_0x20cd44);}return _0x30f2d3['status'](_0x20cd44)[_0x7e5c('0x1b')]();};}function respondWithResult(_0x48c529,_0x267975){_0x267975=_0x267975||0xc8;return function(_0x1aed81){if(_0x1aed81){return _0x48c529[_0x7e5c('0x1c')](_0x267975)['json'](_0x1aed81);}};}function respondWithFilteredResult(_0x5a8dad,_0x4bda23){return function(_0x229878){if(_0x229878){var _0x1f97b6=typeof _0x4bda23['offset']===_0x7e5c('0x1d')&&typeof _0x4bda23[_0x7e5c('0x1e')]===_0x7e5c('0x1d');var _0x558669=_0x229878[_0x7e5c('0x1f')];var _0x1defb0=_0x1f97b6?0x0:_0x4bda23['offset'];var _0x3a8e5a=_0x1f97b6?_0x229878[_0x7e5c('0x1f')]:_0x4bda23['offset']+_0x4bda23[_0x7e5c('0x1e')];var _0x2a6511;if(_0x3a8e5a>=_0x558669){_0x3a8e5a=_0x558669;_0x2a6511=0xc8;}else{_0x2a6511=0xce;}_0x5a8dad[_0x7e5c('0x1c')](_0x2a6511);return _0x5a8dad['set'](_0x7e5c('0x20'),_0x1defb0+'-'+_0x3a8e5a+'/'+_0x558669)[_0x7e5c('0x21')](_0x229878);}return null;};}function patchUpdates(_0x28e29c){return function(_0x105e03){try{jsonpatch[_0x7e5c('0x22')](_0x105e03,_0x28e29c,!![]);}catch(_0x147b1a){return BPromise[_0x7e5c('0x23')](_0x147b1a);}return _0x105e03[_0x7e5c('0x24')]();};}function saveUpdates(_0xf28933,_0xb56cbd){return function(_0x5462ec){if(_0x5462ec){return _0x5462ec[_0x7e5c('0x25')](_0xf28933)[_0x7e5c('0x26')](function(_0x4246fc){return _0x4246fc;});}return null;};}function removeEntity(_0x4d8bff,_0x2fed07){return function(_0x46e150){if(_0x46e150){return _0x46e150['destroy']()[_0x7e5c('0x26')](function(){_0x4d8bff[_0x7e5c('0x1c')](0xcc)[_0x7e5c('0x1b')]();});}};}function handleEntityNotFound(_0x564092,_0x564045){return function(_0x1914ce){if(!_0x1914ce){_0x564092[_0x7e5c('0x1a')](0x194);}return _0x1914ce;};}function handleError(_0x2ace4a,_0x59ddad){_0x59ddad=_0x59ddad||0x1f4;return function(_0x55e206){logger[_0x7e5c('0x27')](_0x55e206[_0x7e5c('0x28')]);if(_0x55e206[_0x7e5c('0x29')]){delete _0x55e206[_0x7e5c('0x29')];}_0x2ace4a[_0x7e5c('0x1c')](_0x59ddad)['send'](_0x55e206);};}exports[_0x7e5c('0x2a')]=function(_0x39f1b0,_0x4865af){var _0x2a1993={},_0x283655={},_0x54e1c0={'count':0x0,'rows':[]};var _0xd153c7=_[_0x7e5c('0x2b')](db[_0x7e5c('0x2c')]['rawAttributes'],function(_0x226c12){return{'name':_0x226c12[_0x7e5c('0x2d')],'type':_0x226c12[_0x7e5c('0x2e')]['key']};});_0x283655[_0x7e5c('0x2f')]=_[_0x7e5c('0x2b')](_0xd153c7,_0x7e5c('0x29'));_0x283655['query']=_[_0x7e5c('0x30')](_0x39f1b0['query']);_0x283655[_0x7e5c('0x31')]=_['intersection'](_0x283655['model'],_0x283655['query']);_0x2a1993[_0x7e5c('0x32')]=_['intersection'](_0x283655['model'],qs[_0x7e5c('0x33')](_0x39f1b0[_0x7e5c('0x34')][_0x7e5c('0x33')]));_0x2a1993[_0x7e5c('0x32')]=_0x2a1993['attributes']['length']?_0x2a1993['attributes']:_0x283655[_0x7e5c('0x2f')];if(!_0x39f1b0[_0x7e5c('0x34')]['hasOwnProperty'](_0x7e5c('0x35'))){_0x2a1993[_0x7e5c('0x1e')]=qs[_0x7e5c('0x1e')](_0x39f1b0['query'][_0x7e5c('0x1e')]);_0x2a1993[_0x7e5c('0x36')]=qs['offset'](_0x39f1b0[_0x7e5c('0x34')][_0x7e5c('0x36')]);}_0x2a1993[_0x7e5c('0x37')]=qs[_0x7e5c('0x38')](_0x39f1b0[_0x7e5c('0x34')][_0x7e5c('0x38')]);_0x2a1993['where']=qs[_0x7e5c('0x31')](_[_0x7e5c('0x39')](_0x39f1b0[_0x7e5c('0x34')],_0x283655['filters']),_0xd153c7);if(_0x39f1b0['query']['filter']){_0x2a1993[_0x7e5c('0x3a')]=_['merge'](_0x2a1993['where'],{'$or':_['map'](_0xd153c7,function(_0x2e71e9){if(_0x2e71e9[_0x7e5c('0x2e')]!==_0x7e5c('0x3b')){var _0x43cac7={};_0x43cac7[_0x2e71e9['name']]={'$like':'%'+_0x39f1b0[_0x7e5c('0x34')][_0x7e5c('0x3c')]+'%'};return _0x43cac7;}})});}_0x2a1993=_[_0x7e5c('0x3d')]({},_0x2a1993,_0x39f1b0['options']);var _0x2d781f={'where':_0x2a1993[_0x7e5c('0x3a')]};return db[_0x7e5c('0x2c')][_0x7e5c('0x1f')](_0x2d781f)[_0x7e5c('0x26')](function(_0x4e47dc){_0x54e1c0[_0x7e5c('0x1f')]=_0x4e47dc;if(_0x39f1b0[_0x7e5c('0x34')]['includeAll']){_0x2a1993[_0x7e5c('0x3e')]=[{'all':!![]}];}return db[_0x7e5c('0x2c')]['findAll'](_0x2a1993);})[_0x7e5c('0x26')](function(_0x21cd50){_0x54e1c0[_0x7e5c('0x3f')]=_0x21cd50;return _0x54e1c0;})[_0x7e5c('0x26')](respondWithFilteredResult(_0x4865af,_0x2a1993))[_0x7e5c('0x40')](handleError(_0x4865af,null));};exports[_0x7e5c('0x41')]=function(_0x2aaa74,_0x5bc812){var _0x437def={'raw':![],'where':{'id':_0x2aaa74[_0x7e5c('0x42')]['id']}},_0x42fe1c={};_0x42fe1c['model']=_[_0x7e5c('0x30')](db['SalesforceAccount']['rawAttributes']);_0x42fe1c[_0x7e5c('0x34')]=_[_0x7e5c('0x30')](_0x2aaa74[_0x7e5c('0x34')]);_0x42fe1c[_0x7e5c('0x31')]=_[_0x7e5c('0x43')](_0x42fe1c[_0x7e5c('0x2f')],_0x42fe1c['query']);_0x437def[_0x7e5c('0x32')]=_['intersection'](_0x42fe1c[_0x7e5c('0x2f')],qs['fields'](_0x2aaa74[_0x7e5c('0x34')]['fields']));_0x437def[_0x7e5c('0x32')]=_0x437def[_0x7e5c('0x32')][_0x7e5c('0x44')]?_0x437def[_0x7e5c('0x32')]:_0x42fe1c['model'];if(_0x2aaa74[_0x7e5c('0x34')][_0x7e5c('0x45')]){_0x437def['include']=[{'all':!![]}];}_0x437def=_[_0x7e5c('0x3d')]({},_0x437def,_0x2aaa74[_0x7e5c('0x46')]);return db[_0x7e5c('0x2c')]['find'](_0x437def)['then'](handleEntityNotFound(_0x5bc812,null))[_0x7e5c('0x26')](respondWithResult(_0x5bc812,null))[_0x7e5c('0x40')](handleError(_0x5bc812,null));};exports[_0x7e5c('0x47')]=function(_0x23aae4,_0x4d8cb1){return db[_0x7e5c('0x2c')]['create'](_0x23aae4[_0x7e5c('0x48')],{})['then'](respondWithResult(_0x4d8cb1,0xc9))[_0x7e5c('0x40')](handleError(_0x4d8cb1,null));};exports[_0x7e5c('0x25')]=function(_0x33943a,_0x33325f){if(_0x33943a['body']['id']){delete _0x33943a[_0x7e5c('0x48')]['id'];}return db[_0x7e5c('0x2c')]['find']({'where':{'id':_0x33943a['params']['id']}})[_0x7e5c('0x26')](handleEntityNotFound(_0x33325f,null))[_0x7e5c('0x26')](saveUpdates(_0x33943a[_0x7e5c('0x48')],null))[_0x7e5c('0x26')](respondWithResult(_0x33325f,null))[_0x7e5c('0x40')](handleError(_0x33325f,null));};exports[_0x7e5c('0x49')]=function(_0x27c0a9,_0x43dd7c){return db['SalesforceAccount'][_0x7e5c('0x4a')]({'where':{'id':_0x27c0a9['params']['id']}})[_0x7e5c('0x26')](handleEntityNotFound(_0x43dd7c,null))[_0x7e5c('0x26')](removeEntity(_0x43dd7c,null))['catch'](handleError(_0x43dd7c,null));};exports[_0x7e5c('0x4b')]=function(_0x2f2ca9,_0x48b2f0,_0x5a9a9e){var _0x4bada3={};var _0x2fdb98={};var _0x40eb3a;var _0x5d410e;return db[_0x7e5c('0x2c')]['findOne']({'where':{'id':_0x2f2ca9[_0x7e5c('0x42')]['id']}})[_0x7e5c('0x26')](handleEntityNotFound(_0x48b2f0,null))['then'](function(_0x458023){if(_0x458023){_0x40eb3a=_0x458023;_0x2fdb98['model']=_[_0x7e5c('0x30')](db[_0x7e5c('0x4c')]['rawAttributes']);_0x2fdb98[_0x7e5c('0x34')]=_[_0x7e5c('0x30')](_0x2f2ca9[_0x7e5c('0x34')]);_0x2fdb98[_0x7e5c('0x31')]=_[_0x7e5c('0x43')](_0x2fdb98[_0x7e5c('0x2f')],_0x2fdb98[_0x7e5c('0x34')]);_0x4bada3[_0x7e5c('0x32')]=_['intersection'](_0x2fdb98[_0x7e5c('0x2f')],qs['fields'](_0x2f2ca9['query']['fields']));_0x4bada3[_0x7e5c('0x32')]=_0x4bada3['attributes'][_0x7e5c('0x44')]?_0x4bada3[_0x7e5c('0x32')]:_0x2fdb98[_0x7e5c('0x2f')];_0x4bada3[_0x7e5c('0x37')]=qs['sort'](_0x2f2ca9['query'][_0x7e5c('0x38')]);_0x4bada3[_0x7e5c('0x3a')]=qs['filters'](_[_0x7e5c('0x39')](_0x2f2ca9[_0x7e5c('0x34')],_0x2fdb98[_0x7e5c('0x31')]));if(_0x2f2ca9[_0x7e5c('0x34')][_0x7e5c('0x3c')]){_0x4bada3[_0x7e5c('0x3a')]=_[_0x7e5c('0x3d')](_0x4bada3['where'],{'$or':_[_0x7e5c('0x2b')](_0x4bada3[_0x7e5c('0x32')],function(_0xca88ea){var _0x306596={};_0x306596[_0xca88ea]={'$like':'%'+_0x2f2ca9['query'][_0x7e5c('0x3c')]+'%'};return _0x306596;})});}_0x4bada3=_['merge']({},_0x4bada3,_0x2f2ca9[_0x7e5c('0x46')]);return _0x40eb3a[_0x7e5c('0x4b')](_0x4bada3);}})[_0x7e5c('0x26')](function(_0x504b0f){if(_0x504b0f){_0x5d410e=_0x504b0f[_0x7e5c('0x44')];if(!_0x2f2ca9[_0x7e5c('0x34')][_0x7e5c('0x4d')](_0x7e5c('0x35'))){_0x4bada3[_0x7e5c('0x1e')]=qs[_0x7e5c('0x1e')](_0x2f2ca9[_0x7e5c('0x34')][_0x7e5c('0x1e')]);_0x4bada3[_0x7e5c('0x36')]=qs['offset'](_0x2f2ca9[_0x7e5c('0x34')][_0x7e5c('0x36')]);}return _0x40eb3a['getConfigurations'](_0x4bada3);}})[_0x7e5c('0x26')](function(_0x1e19be){if(_0x1e19be){return _0x1e19be?{'count':_0x5d410e,'rows':_0x1e19be}:null;}})[_0x7e5c('0x26')](respondWithResult(_0x48b2f0,null))[_0x7e5c('0x40')](handleError(_0x48b2f0,null));};exports[_0x7e5c('0x4e')]=function(_0x4093db,_0xe8e282,_0x512d69){if(_0x4093db[_0x7e5c('0x48')]['id']){delete _0x4093db[_0x7e5c('0x48')]['id'];}return db[_0x7e5c('0x2c')]['findOne']({'where':{'id':_0x4093db[_0x7e5c('0x42')]['id']}})['then'](handleEntityNotFound(_0xe8e282,null))[_0x7e5c('0x26')](function(_0x3f86f9){if(_0x3f86f9){_0x4093db[_0x7e5c('0x48')][_0x7e5c('0x4f')]=_0x3f86f9['id'];_0x4093db[_0x7e5c('0x48')]['Subjects']=integrations[_0x7e5c('0x50')](_0x4093db[_0x7e5c('0x48')][_0x7e5c('0x51')],_0x4093db[_0x7e5c('0x48')][_0x7e5c('0x2e')]);_0x4093db[_0x7e5c('0x48')][_0x7e5c('0x52')]=integrations[_0x7e5c('0x53')](_0x4093db['body'][_0x7e5c('0x51')],_0x4093db['body']['type']);return db[_0x7e5c('0x4c')]['create'](_0x4093db['body'],{'include':[{'model':db[_0x7e5c('0x54')],'as':_0x7e5c('0x55')},{'model':db['SalesforceField'],'as':_0x7e5c('0x52')}]});}return null;})[_0x7e5c('0x26')](respondWithResult(_0xe8e282,null))['catch'](handleError(_0xe8e282,null));};exports['getFields']=function(_0x2b09c8,_0xcc1464,_0xb925e4){var _0xb0e978;var _0xf62c2e='';var _0x18c05b=_0x7e5c('0x56');return db[_0x7e5c('0x2c')][_0x7e5c('0x57')]({'where':{'id':_0x2b09c8[_0x7e5c('0x42')]['id']},'attributes':['id',_0x7e5c('0x58'),'clientId','clientSecret',_0x7e5c('0x59'),_0x7e5c('0x5a'),_0x7e5c('0x5b')]})[_0x7e5c('0x26')](handleEntityNotFound(_0xcc1464,null))[_0x7e5c('0x26')](function(_0x160c40){if(_0x160c40){_0xf62c2e=_0x160c40[_0x7e5c('0x58')];var _0x2120c6=_0xf62c2e[_0x7e5c('0x5c')](-0x1);if(_0x2120c6==='/'){_0xf62c2e=_0xf62c2e[_0x7e5c('0x5d')](0x0,_0xf62c2e[_0x7e5c('0x5e')](_0x2120c6));}_0xb0e978=new jsforce['Connection']({'oauth2':{'loginUrl':_0xf62c2e,'clientId':_0x160c40['clientId'],'clientSecret':_0x160c40['clientSecret']}});return _0xb0e978['login'](_0x160c40[_0x7e5c('0x59')],_0x160c40['password'][_0x7e5c('0x5f')](_0x160c40[_0x7e5c('0x5b')]));}})[_0x7e5c('0x26')](function(_0x55387d){if(_0x55387d){if(!_[_0x7e5c('0x60')](_0x2b09c8[_0x7e5c('0x34')][_0x7e5c('0x61')])){_0x18c05b=_0x2b09c8[_0x7e5c('0x34')][_0x7e5c('0x61')];}return _0xb0e978[_0x7e5c('0x62')](_0x18c05b)[_0x7e5c('0x63')]();}})[_0x7e5c('0x26')](function(_0x2613eb){var _0x140901=[_0x7e5c('0x64'),_0x7e5c('0x65'),'IsReminderSet','IsRecurrence',_0x7e5c('0x66'),_0x7e5c('0x67')];var _0x67825e=[_0x7e5c('0x68'),'int','picklist',_0x7e5c('0x69'),_0x7e5c('0x6a'),'textarea',_0x7e5c('0x6b')];if(_0x2613eb){_[_0x7e5c('0x6c')](_0x2613eb[_0x7e5c('0x33')],function(_0x2579f8){return _0x140901[_0x7e5c('0x6d')](_0x2579f8[_0x7e5c('0x29')])||!_0x67825e['includes'](_0x2579f8[_0x7e5c('0x2e')]);});return{'count':_0x2613eb[_0x7e5c('0x33')][_0x7e5c('0x44')],'rows':_['map'](_0x2613eb[_0x7e5c('0x33')],function(_0x2da038){return{'id':_0x2da038[_0x7e5c('0x29')],'name':_0x2da038[_0x7e5c('0x6e')],'custom':_0x2da038['custom'],'options':_0x2da038['picklistValues']['length']>0x0?_[_0x7e5c('0x2b')](_0x2da038['picklistValues'],function(_0x279fe5){return{'name':_0x279fe5[_0x7e5c('0x6e')],'value':_0x279fe5[_0x7e5c('0x6f')]};}):_0x2da038[_0x7e5c('0x2e')]==_0x7e5c('0x69')?[{'name':'True','value':_0x7e5c('0x70')},{'name':_0x7e5c('0x71'),'value':_0x7e5c('0x72')}]:[]};})};}})[_0x7e5c('0x26')](respondWithResult(_0xcc1464,null))['catch'](function(_0xa10d54){var _0x5072d0=_0x2b09c8[_0x7e5c('0x34')][_0x7e5c('0x73')]?0x1f4:_0xa10d54[_0x7e5c('0x74')]||0x1f4;logger['error'](_0x7e5c('0x75'),_0x7e5c('0x76'),_0x5072d0,JSON[_0x7e5c('0x77')](_0xa10d54));delete _0xa10d54['name'];if(_0x5072d0===0x191){_0x5072d0=0x190;}_0xcc1464['status'](_0x5072d0)['send'](_0x2b09c8[_0x7e5c('0x34')][_0x7e5c('0x73')]?{'message':_0x7e5c('0x78'),'statusCode':_0xa10d54[_0x7e5c('0x74')]}:_0xa10d54);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index bf6be26..2a2bfc9 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 _0x0088=['moment','bluebird','request-promise','rimraf','../../components/integrations/configuration','exports','define','SalesforceAccount','lodash','../../config/logger','api'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x0088,0x1ec));var _0x8008=function(_0x93f9d8,_0xda9968){_0x93f9d8=_0x93f9d8-0x0;var _0xc5b7af=_0x0088[_0x93f9d8];return _0xc5b7af;};'use strict';var _=require(_0x8008('0x0'));var util=require('util');var logger=require(_0x8008('0x1'))(_0x8008('0x2'));var moment=require(_0x8008('0x3'));var BPromise=require(_0x8008('0x4'));var rp=require(_0x8008('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8008('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x8008('0x7'));module[_0x8008('0x8')]=function(_0x54f525,_0x30ada8){return _0x54f525[_0x8008('0x9')](_0x8008('0xa'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64f6=['define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports'];(function(_0x444547,_0x1431fd){var _0x19515f=function(_0x280023){while(--_0x280023){_0x444547['push'](_0x444547['shift']());}};_0x19515f(++_0x1431fd);}(_0x64f6,0x17d));var _0x664f=function(_0x292a97,_0x49fb87){_0x292a97=_0x292a97-0x0;var _0x36aa25=_0x64f6[_0x292a97];return _0x36aa25;};'use strict';var _=require(_0x664f('0x0'));var util=require(_0x664f('0x1'));var logger=require(_0x664f('0x2'))(_0x664f('0x3'));var moment=require(_0x664f('0x4'));var BPromise=require('bluebird');var rp=require(_0x664f('0x5'));var fs=require('fs');var path=require(_0x664f('0x6'));var rimraf=require(_0x664f('0x7'));var config=require(_0x664f('0x8'));var attributes=require(_0x664f('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x664f('0xa')]=function(_0x4d83a8,_0x1c63fb){return _0x4d83a8[_0x664f('0xb')](_0x664f('0xc'),attributes,{'tableName':_0x664f('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 1c567e8..71cd656 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 _0xcfb8=['debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SalesforceAccount','options','raw','where','attributes','limit','include','map','model','GetSalesforceAccount','find','ShowSalesforceAccount','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1ac6c3,_0x253ba9){var _0x34fefa=function(_0x47d1eb){while(--_0x47d1eb){_0x1ac6c3['push'](_0x1ac6c3['shift']());}};_0x34fefa(++_0x253ba9);}(_0xcfb8,0x1c1));var _0x8cfb=function(_0x3879ca,_0x180a1a){_0x3879ca=_0x3879ca-0x0;var _0x12dc63=_0xcfb8[_0x3879ca];return _0x12dc63;};'use strict';var _=require(_0x8cfb('0x0'));var util=require(_0x8cfb('0x1'));var moment=require('moment');var BPromise=require(_0x8cfb('0x2'));var rs=require(_0x8cfb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8cfb('0x4'));var logger=require('../../config/logger')(_0x8cfb('0x5'));var config=require(_0x8cfb('0x6'));var jayson=require(_0x8cfb('0x7'));var client=jayson[_0x8cfb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32b78c,_0x451913,_0x525945){return new BPromise(function(_0x18fcad,_0x24c014){return client['request'](_0x32b78c,_0x525945)[_0x8cfb('0x9')](function(_0x30d7c4){logger[_0x8cfb('0xa')](_0x8cfb('0xb'),_0x451913,_0x8cfb('0xc'));logger[_0x8cfb('0xd')](_0x8cfb('0xe'),_0x451913,_0x8cfb('0xc'),JSON[_0x8cfb('0xf')](_0x30d7c4));if(_0x30d7c4[_0x8cfb('0x10')]){if(_0x30d7c4['error'][_0x8cfb('0x11')]===0x1f4){logger[_0x8cfb('0x10')](_0x8cfb('0xb'),_0x451913,_0x30d7c4['error'][_0x8cfb('0x12')]);return _0x24c014(_0x30d7c4[_0x8cfb('0x10')][_0x8cfb('0x12')]);}logger['error'](_0x8cfb('0xb'),_0x451913,_0x30d7c4['error'][_0x8cfb('0x12')]);return _0x18fcad(_0x30d7c4[_0x8cfb('0x10')][_0x8cfb('0x12')]);}else{logger[_0x8cfb('0xa')](_0x8cfb('0xb'),_0x451913,_0x8cfb('0xc'));_0x18fcad(_0x30d7c4[_0x8cfb('0x13')][_0x8cfb('0x12')]);}})[_0x8cfb('0x14')](function(_0x3e3258){logger[_0x8cfb('0x10')](_0x8cfb('0xb'),_0x451913,_0x3e3258);_0x24c014(_0x3e3258);});});}exports['GetSalesforceAccount']=function(_0x256c98){var _0xaba39c=this;return new Promise(function(_0x38b1de,_0x2ab479){return db[_0x8cfb('0x15')]['findAll']({'raw':_0x256c98[_0x8cfb('0x16')]?_0x256c98[_0x8cfb('0x16')][_0x8cfb('0x17')]===undefined?!![]:![]:!![],'where':_0x256c98[_0x8cfb('0x16')]?_0x256c98[_0x8cfb('0x16')][_0x8cfb('0x18')]||null:null,'attributes':_0x256c98['options']?_0x256c98['options'][_0x8cfb('0x19')]||null:null,'limit':_0x256c98['options']?_0x256c98[_0x8cfb('0x16')][_0x8cfb('0x1a')]||null:null,'include':_0x256c98['options']?_0x256c98[_0x8cfb('0x16')][_0x8cfb('0x1b')]?_[_0x8cfb('0x1c')](_0x256c98[_0x8cfb('0x16')][_0x8cfb('0x1b')],function(_0x316235){return{'model':db[_0x316235['model']],'as':_0x316235['as'],'attributes':_0x316235[_0x8cfb('0x19')],'include':_0x316235[_0x8cfb('0x1b')]?_[_0x8cfb('0x1c')](_0x316235[_0x8cfb('0x1b')],function(_0x4a535b){return{'model':db[_0x4a535b[_0x8cfb('0x1d')]],'as':_0x4a535b['as'],'attributes':_0x4a535b['attributes'],'include':_0x4a535b['include']?_[_0x8cfb('0x1c')](_0x4a535b[_0x8cfb('0x1b')],function(_0x3e3145){return{'model':db[_0x3e3145[_0x8cfb('0x1d')]],'as':_0x3e3145['as'],'attributes':_0x3e3145[_0x8cfb('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8cfb('0x9')](function(_0x2db5c3){logger['info'](_0x8cfb('0x1e'),_0x256c98);logger[_0x8cfb('0xd')](_0x8cfb('0x1e'),_0x256c98,JSON[_0x8cfb('0xf')](_0x2db5c3));_0x38b1de(_0x2db5c3);})[_0x8cfb('0x14')](function(_0x227d96){logger['error'](_0x8cfb('0x1e'),_0x227d96[_0x8cfb('0x12')],_0x256c98);_0x2ab479(_0xaba39c[_0x8cfb('0x10')](0x1f4,_0x227d96[_0x8cfb('0x12')]));});});};exports['ShowSalesforceAccount']=function(_0x312b1c){var _0x51a8c3=this;return new Promise(function(_0x3d1d3c,_0x36305b){return db[_0x8cfb('0x15')][_0x8cfb('0x1f')]({'raw':_0x312b1c['options']?_0x312b1c[_0x8cfb('0x16')][_0x8cfb('0x17')]===undefined?!![]:![]:!![],'where':_0x312b1c[_0x8cfb('0x16')]?_0x312b1c['options'][_0x8cfb('0x18')]||null:null,'attributes':_0x312b1c[_0x8cfb('0x16')]?_0x312b1c[_0x8cfb('0x16')]['attributes']||null:null,'include':_0x312b1c[_0x8cfb('0x16')]?_0x312b1c[_0x8cfb('0x16')][_0x8cfb('0x1b')]?_[_0x8cfb('0x1c')](_0x312b1c[_0x8cfb('0x16')][_0x8cfb('0x1b')],function(_0x3de368){return{'model':db[_0x3de368['model']],'as':_0x3de368['as'],'attributes':_0x3de368['attributes'],'include':_0x3de368[_0x8cfb('0x1b')]?_[_0x8cfb('0x1c')](_0x3de368[_0x8cfb('0x1b')],function(_0x141fa6){return{'model':db[_0x141fa6[_0x8cfb('0x1d')]],'as':_0x141fa6['as'],'attributes':_0x141fa6['attributes'],'include':_0x141fa6[_0x8cfb('0x1b')]?_[_0x8cfb('0x1c')](_0x141fa6[_0x8cfb('0x1b')],function(_0x2f3cc2){return{'model':db[_0x2f3cc2['model']],'as':_0x2f3cc2['as'],'attributes':_0x2f3cc2[_0x8cfb('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8cfb('0x9')](function(_0x17b4be){logger['info'](_0x8cfb('0x20'),_0x312b1c);logger[_0x8cfb('0xd')](_0x8cfb('0x20'),_0x312b1c,JSON['stringify'](_0x17b4be));_0x3d1d3c(_0x17b4be);})[_0x8cfb('0x14')](function(_0x459dcd){logger[_0x8cfb('0x10')](_0x8cfb('0x20'),_0x459dcd[_0x8cfb('0x12')],_0x312b1c);_0x36305b(_0x51a8c3[_0x8cfb('0x10')](0x1f4,_0x459dcd[_0x8cfb('0x12')]));});});}; \ No newline at end of file +var _0x0c52=['request','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','SalesforceAccount,\x20%s,\x20%s','message','result','catch','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','GetSalesforceAccount','find','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x384f12,_0x208425){var _0x4812f8=function(_0x5d2436){while(--_0x5d2436){_0x384f12['push'](_0x384f12['shift']());}};_0x4812f8(++_0x208425);}(_0x0c52,0x170));var _0x20c5=function(_0x58d7d0,_0x1ee728){_0x58d7d0=_0x58d7d0-0x0;var _0x1505e6=_0x0c52[_0x58d7d0];return _0x1505e6;};'use strict';var _=require(_0x20c5('0x0'));var util=require(_0x20c5('0x1'));var moment=require(_0x20c5('0x2'));var BPromise=require(_0x20c5('0x3'));var rs=require(_0x20c5('0x4'));var fs=require('fs');var Redis=require(_0x20c5('0x5'));var db=require(_0x20c5('0x6'))['db'];var utils=require(_0x20c5('0x7'));var logger=require(_0x20c5('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x20c5('0x9'));var client=jayson[_0x20c5('0xa')][_0x20c5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c0c16,_0x1f79f1,_0x3236da){return new BPromise(function(_0xe7b226,_0x44f280){return client[_0x20c5('0xc')](_0x5c0c16,_0x3236da)['then'](function(_0x595d2e){logger[_0x20c5('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x1f79f1,_0x20c5('0xe'));logger[_0x20c5('0xf')](_0x20c5('0x10'),_0x1f79f1,_0x20c5('0xe'),JSON[_0x20c5('0x11')](_0x595d2e));if(_0x595d2e['error']){if(_0x595d2e['error'][_0x20c5('0x12')]===0x1f4){logger[_0x20c5('0x13')](_0x20c5('0x14'),_0x1f79f1,_0x595d2e['error'][_0x20c5('0x15')]);return _0x44f280(_0x595d2e[_0x20c5('0x13')][_0x20c5('0x15')]);}logger[_0x20c5('0x13')](_0x20c5('0x14'),_0x1f79f1,_0x595d2e[_0x20c5('0x13')][_0x20c5('0x15')]);return _0xe7b226(_0x595d2e[_0x20c5('0x13')][_0x20c5('0x15')]);}else{logger[_0x20c5('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x1f79f1,_0x20c5('0xe'));_0xe7b226(_0x595d2e[_0x20c5('0x16')][_0x20c5('0x15')]);}})[_0x20c5('0x17')](function(_0x41ad22){logger[_0x20c5('0x13')](_0x20c5('0x14'),_0x1f79f1,_0x41ad22);_0x44f280(_0x41ad22);});});}exports['GetSalesforceAccount']=function(_0x30bc8f){var _0x431f47=this;return new Promise(function(_0x3f2939,_0x59399f){return db[_0x20c5('0x18')][_0x20c5('0x19')]({'raw':_0x30bc8f[_0x20c5('0x1a')]?_0x30bc8f[_0x20c5('0x1a')][_0x20c5('0x1b')]===undefined?!![]:![]:!![],'where':_0x30bc8f[_0x20c5('0x1a')]?_0x30bc8f['options'][_0x20c5('0x1c')]||null:null,'attributes':_0x30bc8f['options']?_0x30bc8f[_0x20c5('0x1a')][_0x20c5('0x1d')]||null:null,'limit':_0x30bc8f[_0x20c5('0x1a')]?_0x30bc8f[_0x20c5('0x1a')][_0x20c5('0x1e')]||null:null,'include':_0x30bc8f[_0x20c5('0x1a')]?_0x30bc8f['options'][_0x20c5('0x1f')]?_[_0x20c5('0x20')](_0x30bc8f['options']['include'],function(_0x37687d){return{'model':db[_0x37687d[_0x20c5('0x21')]],'as':_0x37687d['as'],'attributes':_0x37687d[_0x20c5('0x1d')],'include':_0x37687d[_0x20c5('0x1f')]?_['map'](_0x37687d[_0x20c5('0x1f')],function(_0x116166){return{'model':db[_0x116166[_0x20c5('0x21')]],'as':_0x116166['as'],'attributes':_0x116166[_0x20c5('0x1d')],'include':_0x116166['include']?_['map'](_0x116166['include'],function(_0x16b867){return{'model':db[_0x16b867[_0x20c5('0x21')]],'as':_0x16b867['as'],'attributes':_0x16b867[_0x20c5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x20c5('0x22')](function(_0x5897c1){logger[_0x20c5('0xd')](_0x20c5('0x23'),_0x30bc8f);logger['debug'](_0x20c5('0x23'),_0x30bc8f,JSON[_0x20c5('0x11')](_0x5897c1));_0x3f2939(_0x5897c1);})[_0x20c5('0x17')](function(_0x53b215){logger[_0x20c5('0x13')]('GetSalesforceAccount',_0x53b215['message'],_0x30bc8f);_0x59399f(_0x431f47[_0x20c5('0x13')](0x1f4,_0x53b215[_0x20c5('0x15')]));});});};exports['ShowSalesforceAccount']=function(_0x48fcec){var _0x4ace71=this;return new Promise(function(_0x1d5965,_0x263229){return db[_0x20c5('0x18')][_0x20c5('0x24')]({'raw':_0x48fcec[_0x20c5('0x1a')]?_0x48fcec[_0x20c5('0x1a')][_0x20c5('0x1b')]===undefined?!![]:![]:!![],'where':_0x48fcec['options']?_0x48fcec['options']['where']||null:null,'attributes':_0x48fcec[_0x20c5('0x1a')]?_0x48fcec[_0x20c5('0x1a')][_0x20c5('0x1d')]||null:null,'include':_0x48fcec[_0x20c5('0x1a')]?_0x48fcec[_0x20c5('0x1a')]['include']?_[_0x20c5('0x20')](_0x48fcec['options']['include'],function(_0x129f6e){return{'model':db[_0x129f6e[_0x20c5('0x21')]],'as':_0x129f6e['as'],'attributes':_0x129f6e[_0x20c5('0x1d')],'include':_0x129f6e[_0x20c5('0x1f')]?_[_0x20c5('0x20')](_0x129f6e[_0x20c5('0x1f')],function(_0x19cd97){return{'model':db[_0x19cd97[_0x20c5('0x21')]],'as':_0x19cd97['as'],'attributes':_0x19cd97[_0x20c5('0x1d')],'include':_0x19cd97[_0x20c5('0x1f')]?_[_0x20c5('0x20')](_0x19cd97[_0x20c5('0x1f')],function(_0x5a195f){return{'model':db[_0x5a195f[_0x20c5('0x21')]],'as':_0x5a195f['as'],'attributes':_0x5a195f[_0x20c5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x20c5('0x22')](function(_0x5f41d3){logger[_0x20c5('0xd')]('ShowSalesforceAccount',_0x48fcec);logger['debug']('ShowSalesforceAccount',_0x48fcec,JSON[_0x20c5('0x11')](_0x5f41d3));_0x1d5965(_0x5f41d3);})[_0x20c5('0x17')](function(_0x52fcb8){logger['error'](_0x20c5('0x25'),_0x52fcb8[_0x20c5('0x15')],_0x48fcec);_0x263229(_0x4ace71[_0x20c5('0x13')](0x1f4,_0x52fcb8[_0x20c5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 6bcb7d5..e6f14d1 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 _0x2032=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','exports','util','path','connect-timeout'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2032,0xd9));var _0x2203=function(_0x352163,_0x3cfb90){_0x352163=_0x352163-0x0;var _0x15f8b=_0x2032[_0x352163];return _0x15f8b;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x2203('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x2203('0x13')]=router; \ No newline at end of file +var _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x3d605d,_0x345263){var _0x19cbf6=function(_0x22b525){while(--_0x22b525){_0x3d605d['push'](_0x3d605d['shift']());}};_0x19cbf6(++_0x345263);}(_0x7a54,0x106));var _0x47a5=function(_0x29882f,_0x1ebdc){_0x29882f=_0x29882f-0x0;var _0x17417c=_0x7a54[_0x29882f];return _0x17417c;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 2d74e39..cd00769 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 _0x6e68=['ENUM','Case','Task','contact_lead','lead','account_contact_lead','account','contact','sequelize','exports','STRING'];(function(_0x409deb,_0x2b731){var _0x15a4f7=function(_0x556510){while(--_0x556510){_0x409deb['push'](_0x409deb['shift']());}};_0x15a4f7(++_0x2b731);}(_0x6e68,0x1b5));var _0x86e6=function(_0x5377b2,_0xe50bc6){_0x5377b2=_0x5377b2-0x0;var _0x26d42d=_0x6e68[_0x5377b2];return _0x26d42d;};'use strict';var Sequelize=require(_0x86e6('0x0'));module[_0x86e6('0x1')]={'name':{'type':Sequelize[_0x86e6('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x86e6('0x3')]('Task',_0x86e6('0x4')),'defaultValue':_0x86e6('0x5')},'moduleSearch':{'type':Sequelize['ENUM'](_0x86e6('0x6'),'contact',_0x86e6('0x7'),_0x86e6('0x8'),_0x86e6('0x9')),'defaultValue':_0x86e6('0x6')},'moduleCreate':{'type':Sequelize[_0x86e6('0x3')]('nothing',_0x86e6('0xa'),_0x86e6('0x7'),_0x86e6('0x9')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x86e6('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x86e6('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x86e6('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x86e6('0x2')]}}; \ No newline at end of file +var _0x4566=['contact_lead','account','sequelize','exports','STRING','ENUM','Task','contact','lead','account_contact_lead'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x4566,0xe8));var _0x6456=function(_0x33a17a,_0x2eacc9){_0x33a17a=_0x33a17a-0x0;var _0x2af849=_0x4566[_0x33a17a];return _0x2af849;};'use strict';var Sequelize=require(_0x6456('0x0'));module[_0x6456('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6456('0x2')]},'ticketType':{'type':Sequelize[_0x6456('0x3')]('Task','Case'),'defaultValue':_0x6456('0x4')},'moduleSearch':{'type':Sequelize[_0x6456('0x3')]('contact_lead',_0x6456('0x5'),_0x6456('0x6'),_0x6456('0x7'),'account'),'defaultValue':_0x6456('0x8')},'moduleCreate':{'type':Sequelize[_0x6456('0x3')]('nothing',_0x6456('0x5'),_0x6456('0x6'),_0x6456('0x9')),'defaultValue':_0x6456('0x6')},'leadId':{'type':Sequelize[_0x6456('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x6456('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x6456('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x6456('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index bcaee93..4b1732f 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 _0xac8b=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','getFields','findOne','keys','SalesforceField','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','filters','attributes'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xac8b,0x1c2));var _0xbac8=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xac8b[_0x9cd4c3];return _0x4c9025;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbac8('0x0'));var zipdir=require(_0xbac8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbac8('0x2'));var moment=require(_0xbac8('0x3'));var BPromise=require(_0xbac8('0x4'));var Mustache=require(_0xbac8('0x5'));var util=require(_0xbac8('0x6'));var path=require(_0xbac8('0x7'));var sox=require(_0xbac8('0x8'));var csv=require(_0xbac8('0x9'));var ejs=require(_0xbac8('0xa'));var fs=require('fs');var fs_extra=require(_0xbac8('0xb'));var _=require(_0xbac8('0xc'));var squel=require(_0xbac8('0xd'));var crypto=require(_0xbac8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbac8('0xf'));var toCsv=require(_0xbac8('0x9'));var querystring=require(_0xbac8('0x10'));var Papa=require(_0xbac8('0x11'));var Redis=require(_0xbac8('0x12'));var authService=require(_0xbac8('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbac8('0x14'));var logger=require('../../config/logger')(_0xbac8('0x15'));var utils=require(_0xbac8('0x16'));var config=require(_0xbac8('0x17'));var licenseUtil=require(_0xbac8('0x18'));var db=require(_0xbac8('0x19'))['db'];function respondWithStatusCode(_0x468463,_0xdce793){_0xdce793=_0xdce793||0xcc;return function(_0x378ff2){if(_0x378ff2){return _0x468463[_0xbac8('0x1a')](_0xdce793);}return _0x468463[_0xbac8('0x1b')](_0xdce793)[_0xbac8('0x1c')]();};}function respondWithResult(_0x1720aa,_0x10ad73){_0x10ad73=_0x10ad73||0xc8;return function(_0x425728){if(_0x425728){return _0x1720aa[_0xbac8('0x1b')](_0x10ad73)[_0xbac8('0x1d')](_0x425728);}};}function respondWithFilteredResult(_0x4f3c1a,_0x57225b){return function(_0x5084e1){if(_0x5084e1){var _0x3cdeaf=typeof _0x57225b[_0xbac8('0x1e')]==='undefined'&&typeof _0x57225b[_0xbac8('0x1f')]===_0xbac8('0x20');var _0x564b83=_0x5084e1[_0xbac8('0x21')];var _0x3724dc=_0x3cdeaf?0x0:_0x57225b[_0xbac8('0x1e')];var _0x58f311=_0x3cdeaf?_0x5084e1[_0xbac8('0x21')]:_0x57225b['offset']+_0x57225b[_0xbac8('0x1f')];var _0x209e41;if(_0x58f311>=_0x564b83){_0x58f311=_0x564b83;_0x209e41=0xc8;}else{_0x209e41=0xce;}_0x4f3c1a[_0xbac8('0x1b')](_0x209e41);return _0x4f3c1a['set'](_0xbac8('0x22'),_0x3724dc+'-'+_0x58f311+'/'+_0x564b83)[_0xbac8('0x1d')](_0x5084e1);}return null;};}function patchUpdates(_0x4afed3){return function(_0x1d812d){try{jsonpatch[_0xbac8('0x23')](_0x1d812d,_0x4afed3,!![]);}catch(_0x2fe2fd){return BPromise[_0xbac8('0x24')](_0x2fe2fd);}return _0x1d812d[_0xbac8('0x25')]();};}function saveUpdates(_0x58215b,_0x427fe3){return function(_0x54ec7d){if(_0x54ec7d){return _0x54ec7d['update'](_0x58215b)[_0xbac8('0x26')](function(_0x3b168b){return _0x3b168b;});}return null;};}function removeEntity(_0x3bb198,_0x15ab73){return function(_0x2eb3a5){if(_0x2eb3a5){return _0x2eb3a5[_0xbac8('0x27')]()[_0xbac8('0x26')](function(){_0x3bb198['status'](0xcc)[_0xbac8('0x1c')]();});}};}function handleEntityNotFound(_0x22e677,_0xa664cb){return function(_0x46693b){if(!_0x46693b){_0x22e677[_0xbac8('0x1a')](0x194);}return _0x46693b;};}function handleError(_0x22c67f,_0x6eb99c){_0x6eb99c=_0x6eb99c||0x1f4;return function(_0x2a16df){logger['error'](_0x2a16df[_0xbac8('0x28')]);if(_0x2a16df[_0xbac8('0x29')]){delete _0x2a16df[_0xbac8('0x29')];}_0x22c67f[_0xbac8('0x1b')](_0x6eb99c)[_0xbac8('0x2a')](_0x2a16df);};}exports[_0xbac8('0x2b')]=function(_0x12fcbe,_0x4e7688){var _0x18cb11={},_0x1218cb={},_0x45fdc5={'count':0x0,'rows':[]};var _0x48fb78=_[_0xbac8('0x2c')](db[_0xbac8('0x2d')][_0xbac8('0x2e')],function(_0x5b4de2){return{'name':_0x5b4de2[_0xbac8('0x2f')],'type':_0x5b4de2[_0xbac8('0x30')][_0xbac8('0x31')]};});_0x1218cb[_0xbac8('0x32')]=_[_0xbac8('0x2c')](_0x48fb78,'name');_0x1218cb[_0xbac8('0x33')]=_['keys'](_0x12fcbe[_0xbac8('0x33')]);_0x1218cb[_0xbac8('0x34')]=_['intersection'](_0x1218cb[_0xbac8('0x32')],_0x1218cb[_0xbac8('0x33')]);_0x18cb11[_0xbac8('0x35')]=_[_0xbac8('0x36')](_0x1218cb[_0xbac8('0x32')],qs[_0xbac8('0x37')](_0x12fcbe[_0xbac8('0x33')]['fields']));_0x18cb11[_0xbac8('0x35')]=_0x18cb11[_0xbac8('0x35')][_0xbac8('0x38')]?_0x18cb11[_0xbac8('0x35')]:_0x1218cb[_0xbac8('0x32')];if(!_0x12fcbe[_0xbac8('0x33')][_0xbac8('0x39')](_0xbac8('0x3a'))){_0x18cb11[_0xbac8('0x1f')]=qs[_0xbac8('0x1f')](_0x12fcbe['query'][_0xbac8('0x1f')]);_0x18cb11[_0xbac8('0x1e')]=qs[_0xbac8('0x1e')](_0x12fcbe[_0xbac8('0x33')]['offset']);}_0x18cb11[_0xbac8('0x3b')]=qs[_0xbac8('0x3c')](_0x12fcbe[_0xbac8('0x33')]['sort']);_0x18cb11[_0xbac8('0x3d')]=qs[_0xbac8('0x34')](_[_0xbac8('0x3e')](_0x12fcbe[_0xbac8('0x33')],_0x1218cb[_0xbac8('0x34')]),_0x48fb78);if(_0x12fcbe[_0xbac8('0x33')][_0xbac8('0x3f')]){_0x18cb11[_0xbac8('0x3d')]=_['merge'](_0x18cb11[_0xbac8('0x3d')],{'$or':_[_0xbac8('0x2c')](_0x48fb78,function(_0x5788bd){if(_0x5788bd[_0xbac8('0x30')]!==_0xbac8('0x40')){var _0x342eee={};_0x342eee[_0x5788bd[_0xbac8('0x29')]]={'$like':'%'+_0x12fcbe[_0xbac8('0x33')]['filter']+'%'};return _0x342eee;}})});}_0x18cb11=_[_0xbac8('0x41')]({},_0x18cb11,_0x12fcbe['options']);var _0x34c633={'where':_0x18cb11[_0xbac8('0x3d')]};return db['SalesforceConfiguration'][_0xbac8('0x21')](_0x34c633)[_0xbac8('0x26')](function(_0x130eda){_0x45fdc5['count']=_0x130eda;if(_0x12fcbe[_0xbac8('0x33')][_0xbac8('0x42')]){_0x18cb11[_0xbac8('0x43')]=[{'all':!![]}];}return db[_0xbac8('0x2d')][_0xbac8('0x44')](_0x18cb11);})[_0xbac8('0x26')](function(_0x16ccb3){_0x45fdc5[_0xbac8('0x45')]=_0x16ccb3;return _0x45fdc5;})['then'](respondWithFilteredResult(_0x4e7688,_0x18cb11))[_0xbac8('0x46')](handleError(_0x4e7688,null));};exports[_0xbac8('0x47')]=function(_0x3ade97,_0x5f1456){var _0xf6ac31={'raw':![],'where':{'id':_0x3ade97[_0xbac8('0x48')]['id']}},_0x194f2f={};_0x194f2f[_0xbac8('0x32')]=_['keys'](db[_0xbac8('0x2d')][_0xbac8('0x2e')]);_0x194f2f['query']=_['keys'](_0x3ade97[_0xbac8('0x33')]);_0x194f2f['filters']=_[_0xbac8('0x36')](_0x194f2f[_0xbac8('0x32')],_0x194f2f[_0xbac8('0x33')]);_0xf6ac31[_0xbac8('0x35')]=_['intersection'](_0x194f2f[_0xbac8('0x32')],qs[_0xbac8('0x37')](_0x3ade97[_0xbac8('0x33')][_0xbac8('0x37')]));_0xf6ac31[_0xbac8('0x35')]=_0xf6ac31['attributes'][_0xbac8('0x38')]?_0xf6ac31[_0xbac8('0x35')]:_0x194f2f[_0xbac8('0x32')];if(_0x3ade97[_0xbac8('0x33')][_0xbac8('0x42')]){_0xf6ac31[_0xbac8('0x43')]=[{'all':!![]}];}_0xf6ac31=_[_0xbac8('0x41')]({},_0xf6ac31,_0x3ade97[_0xbac8('0x49')]);return db[_0xbac8('0x2d')][_0xbac8('0x4a')](_0xf6ac31)[_0xbac8('0x26')](handleEntityNotFound(_0x5f1456,null))[_0xbac8('0x26')](respondWithResult(_0x5f1456,null))[_0xbac8('0x46')](handleError(_0x5f1456,null));};exports[_0xbac8('0x4b')]=function(_0x289984,_0xd41f4){return db[_0xbac8('0x2d')][_0xbac8('0x4b')](_0x289984[_0xbac8('0x4c')],{})[_0xbac8('0x26')](respondWithResult(_0xd41f4,0xc9))[_0xbac8('0x46')](handleError(_0xd41f4,null));};exports[_0xbac8('0x4d')]=function(_0x22d901,_0x97854d){if(_0x22d901['body']['id']){delete _0x22d901[_0xbac8('0x4c')]['id'];}return db[_0xbac8('0x2d')][_0xbac8('0x4a')]({'where':{'id':_0x22d901[_0xbac8('0x48')]['id']}})['then'](handleEntityNotFound(_0x97854d,null))['then'](saveUpdates(_0x22d901[_0xbac8('0x4c')],null))[_0xbac8('0x26')](respondWithResult(_0x97854d,null))[_0xbac8('0x46')](handleError(_0x97854d,null));};exports[_0xbac8('0x27')]=function(_0x411e3b,_0x291496){return db[_0xbac8('0x2d')]['find']({'where':{'id':_0x411e3b['params']['id']}})['then'](handleEntityNotFound(_0x291496,null))['then'](removeEntity(_0x291496,null))[_0xbac8('0x46')](handleError(_0x291496,null));};exports[_0xbac8('0x4e')]=function(_0x46a610,_0x4bddf5,_0x1f9354){var _0x4179e1={};var _0x5a4694={};var _0x4822e4;var _0x4bb899;return db[_0xbac8('0x2d')][_0xbac8('0x4f')]({'where':{'id':_0x46a610['params']['id']}})[_0xbac8('0x26')](handleEntityNotFound(_0x4bddf5,null))[_0xbac8('0x26')](function(_0x14b43c){if(_0x14b43c){_0x4822e4=_0x14b43c;_0x5a4694[_0xbac8('0x32')]=_[_0xbac8('0x50')](db['SalesforceField'][_0xbac8('0x2e')]);_0x5a4694['query']=_[_0xbac8('0x50')](_0x46a610[_0xbac8('0x33')]);_0x5a4694['filters']=_[_0xbac8('0x36')](_0x5a4694['model'],_0x5a4694[_0xbac8('0x33')]);_0x4179e1[_0xbac8('0x35')]=_['intersection'](_0x5a4694[_0xbac8('0x32')],qs[_0xbac8('0x37')](_0x46a610[_0xbac8('0x33')]['fields']));_0x4179e1['attributes']=_0x4179e1[_0xbac8('0x35')][_0xbac8('0x38')]?_0x4179e1['attributes']:_0x5a4694[_0xbac8('0x32')];_0x4179e1[_0xbac8('0x3b')]=qs[_0xbac8('0x3c')](_0x46a610[_0xbac8('0x33')][_0xbac8('0x3c')]);_0x4179e1[_0xbac8('0x3d')]=qs[_0xbac8('0x34')](_[_0xbac8('0x3e')](_0x46a610[_0xbac8('0x33')],_0x5a4694[_0xbac8('0x34')]));if(_0x46a610[_0xbac8('0x33')][_0xbac8('0x3f')]){_0x4179e1[_0xbac8('0x3d')]=_[_0xbac8('0x41')](_0x4179e1['where'],{'$or':_[_0xbac8('0x2c')](_0x4179e1['attributes'],function(_0x1dda06){var _0x37bb2b={};_0x37bb2b[_0x1dda06]={'$like':'%'+_0x46a610[_0xbac8('0x33')][_0xbac8('0x3f')]+'%'};return _0x37bb2b;})});}_0x4179e1=_['merge']({},_0x4179e1,_0x46a610[_0xbac8('0x49')]);return _0x4822e4[_0xbac8('0x4e')](_0x4179e1);}})['then'](function(_0x52e05d){if(_0x52e05d){_0x4bb899=_0x52e05d[_0xbac8('0x38')];if(!_0x46a610[_0xbac8('0x33')][_0xbac8('0x39')](_0xbac8('0x3a'))){_0x4179e1['limit']=qs[_0xbac8('0x1f')](_0x46a610[_0xbac8('0x33')]['limit']);_0x4179e1[_0xbac8('0x1e')]=qs[_0xbac8('0x1e')](_0x46a610[_0xbac8('0x33')]['offset']);}return _0x4822e4[_0xbac8('0x4e')](_0x4179e1);}})[_0xbac8('0x26')](function(_0x154afc){if(_0x154afc){return _0x154afc?{'count':_0x4bb899,'rows':_0x154afc}:null;}})[_0xbac8('0x26')](respondWithResult(_0x4bddf5,null))[_0xbac8('0x46')](handleError(_0x4bddf5,null));};exports['getSubjects']=function(_0x53a72b,_0x2b226b,_0x5745e8){var _0x31f601={};var _0x497ada={};var _0x13666c;var _0x136d20;return db[_0xbac8('0x2d')][_0xbac8('0x4f')]({'where':{'id':_0x53a72b[_0xbac8('0x48')]['id']}})[_0xbac8('0x26')](handleEntityNotFound(_0x2b226b,null))[_0xbac8('0x26')](function(_0x39e30e){if(_0x39e30e){_0x13666c=_0x39e30e;_0x497ada[_0xbac8('0x32')]=_['keys'](db[_0xbac8('0x51')][_0xbac8('0x2e')]);_0x497ada[_0xbac8('0x33')]=_[_0xbac8('0x50')](_0x53a72b[_0xbac8('0x33')]);_0x497ada[_0xbac8('0x34')]=_[_0xbac8('0x36')](_0x497ada['model'],_0x497ada[_0xbac8('0x33')]);_0x31f601[_0xbac8('0x35')]=_[_0xbac8('0x36')](_0x497ada[_0xbac8('0x32')],qs[_0xbac8('0x37')](_0x53a72b[_0xbac8('0x33')][_0xbac8('0x37')]));_0x31f601[_0xbac8('0x35')]=_0x31f601[_0xbac8('0x35')][_0xbac8('0x38')]?_0x31f601[_0xbac8('0x35')]:_0x497ada[_0xbac8('0x32')];_0x31f601['order']=qs[_0xbac8('0x3c')](_0x53a72b[_0xbac8('0x33')]['sort']);_0x31f601[_0xbac8('0x3d')]=qs[_0xbac8('0x34')](_['pick'](_0x53a72b[_0xbac8('0x33')],_0x497ada[_0xbac8('0x34')]));if(_0x53a72b[_0xbac8('0x33')][_0xbac8('0x3f')]){_0x31f601[_0xbac8('0x3d')]=_[_0xbac8('0x41')](_0x31f601[_0xbac8('0x3d')],{'$or':_[_0xbac8('0x2c')](_0x31f601[_0xbac8('0x35')],function(_0x386d09){var _0x37187d={};_0x37187d[_0x386d09]={'$like':'%'+_0x53a72b[_0xbac8('0x33')]['filter']+'%'};return _0x37187d;})});}_0x31f601=_[_0xbac8('0x41')]({},_0x31f601,_0x53a72b[_0xbac8('0x49')]);return _0x13666c[_0xbac8('0x52')](_0x31f601);}})[_0xbac8('0x26')](function(_0x3ad1c2){if(_0x3ad1c2){_0x136d20=_0x3ad1c2[_0xbac8('0x38')];if(!_0x53a72b[_0xbac8('0x33')]['hasOwnProperty']('nolimit')){_0x31f601[_0xbac8('0x1f')]=qs[_0xbac8('0x1f')](_0x53a72b[_0xbac8('0x33')][_0xbac8('0x1f')]);_0x31f601['offset']=qs[_0xbac8('0x1e')](_0x53a72b[_0xbac8('0x33')][_0xbac8('0x1e')]);}return _0x13666c[_0xbac8('0x52')](_0x31f601);}})[_0xbac8('0x26')](function(_0x2918f9){if(_0x2918f9){return _0x2918f9?{'count':_0x136d20,'rows':_0x2918f9}:null;}})['then'](respondWithResult(_0x2b226b,null))[_0xbac8('0x46')](handleError(_0x2b226b,null));};exports[_0xbac8('0x53')]=function(_0x246398,_0x244e9f,_0x374c84){var _0x2d423a={};var _0x518ef6={};var _0x68196a;var _0x560411;return db['SalesforceConfiguration'][_0xbac8('0x4f')]({'where':{'id':_0x246398[_0xbac8('0x48')]['id']}})[_0xbac8('0x26')](handleEntityNotFound(_0x244e9f,null))[_0xbac8('0x26')](function(_0x443fde){if(_0x443fde){_0x68196a=_0x443fde;_0x518ef6[_0xbac8('0x32')]=_[_0xbac8('0x50')](db[_0xbac8('0x51')][_0xbac8('0x2e')]);_0x518ef6[_0xbac8('0x33')]=_[_0xbac8('0x50')](_0x246398[_0xbac8('0x33')]);_0x518ef6['filters']=_[_0xbac8('0x36')](_0x518ef6['model'],_0x518ef6[_0xbac8('0x33')]);_0x2d423a[_0xbac8('0x35')]=_[_0xbac8('0x36')](_0x518ef6[_0xbac8('0x32')],qs['fields'](_0x246398['query'][_0xbac8('0x37')]));_0x2d423a['attributes']=_0x2d423a['attributes'][_0xbac8('0x38')]?_0x2d423a['attributes']:_0x518ef6[_0xbac8('0x32')];_0x2d423a[_0xbac8('0x3b')]=qs[_0xbac8('0x3c')](_0x246398[_0xbac8('0x33')][_0xbac8('0x3c')]);_0x2d423a[_0xbac8('0x3d')]=qs[_0xbac8('0x34')](_[_0xbac8('0x3e')](_0x246398[_0xbac8('0x33')],_0x518ef6[_0xbac8('0x34')]));if(_0x246398[_0xbac8('0x33')][_0xbac8('0x3f')]){_0x2d423a[_0xbac8('0x3d')]=_[_0xbac8('0x41')](_0x2d423a[_0xbac8('0x3d')],{'$or':_[_0xbac8('0x2c')](_0x2d423a[_0xbac8('0x35')],function(_0x111aec){var _0x3ee1b7={};_0x3ee1b7[_0x111aec]={'$like':'%'+_0x246398['query'][_0xbac8('0x3f')]+'%'};return _0x3ee1b7;})});}_0x2d423a=_['merge']({},_0x2d423a,_0x246398[_0xbac8('0x49')]);return _0x68196a['getDescriptions'](_0x2d423a);}})[_0xbac8('0x26')](function(_0xc2fed3){if(_0xc2fed3){_0x560411=_0xc2fed3[_0xbac8('0x38')];if(!_0x246398[_0xbac8('0x33')][_0xbac8('0x39')](_0xbac8('0x3a'))){_0x2d423a['limit']=qs[_0xbac8('0x1f')](_0x246398[_0xbac8('0x33')][_0xbac8('0x1f')]);_0x2d423a['offset']=qs['offset'](_0x246398[_0xbac8('0x33')][_0xbac8('0x1e')]);}return _0x68196a[_0xbac8('0x53')](_0x2d423a);}})[_0xbac8('0x26')](function(_0x5ccc91){if(_0x5ccc91){return _0x5ccc91?{'count':_0x560411,'rows':_0x5ccc91}:null;}})['then'](respondWithResult(_0x244e9f,null))[_0xbac8('0x46')](handleError(_0x244e9f,null));}; \ No newline at end of file +var _0x7fd4=['include','findAll','catch','show','rawAttributes','find','create','body','params','findOne','SalesforceField','order','getFields','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceConfiguration','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll'];(function(_0x4b8c98,_0x4387a1){var _0x234daf=function(_0x13db38){while(--_0x13db38){_0x4b8c98['push'](_0x4b8c98['shift']());}};_0x234daf(++_0x4387a1);}(_0x7fd4,0x117));var _0x47fd=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x7fd4[_0x40220a];return _0x3903cc;};'use strict';var emlformat=require(_0x47fd('0x0'));var rimraf=require(_0x47fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47fd('0x2'));var rp=require(_0x47fd('0x3'));var moment=require(_0x47fd('0x4'));var BPromise=require(_0x47fd('0x5'));var Mustache=require(_0x47fd('0x6'));var util=require(_0x47fd('0x7'));var path=require('path');var sox=require(_0x47fd('0x8'));var csv=require(_0x47fd('0x9'));var ejs=require(_0x47fd('0xa'));var fs=require('fs');var fs_extra=require(_0x47fd('0xb'));var _=require(_0x47fd('0xc'));var squel=require(_0x47fd('0xd'));var crypto=require(_0x47fd('0xe'));var jsforce=require(_0x47fd('0xf'));var deskjs=require(_0x47fd('0x10'));var toCsv=require('to-csv');var querystring=require(_0x47fd('0x11'));var Papa=require(_0x47fd('0x12'));var Redis=require(_0x47fd('0x13'));var authService=require(_0x47fd('0x14'));var qs=require(_0x47fd('0x15'));var as=require(_0x47fd('0x16'));var hardwareService=require(_0x47fd('0x17'));var logger=require(_0x47fd('0x18'))(_0x47fd('0x19'));var utils=require(_0x47fd('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x47fd('0x1b'));var db=require(_0x47fd('0x1c'))['db'];function respondWithStatusCode(_0xaf1c81,_0x5d29de){_0x5d29de=_0x5d29de||0xcc;return function(_0x21152e){if(_0x21152e){return _0xaf1c81[_0x47fd('0x1d')](_0x5d29de);}return _0xaf1c81[_0x47fd('0x1e')](_0x5d29de)[_0x47fd('0x1f')]();};}function respondWithResult(_0x17a92e,_0x20c885){_0x20c885=_0x20c885||0xc8;return function(_0x33b315){if(_0x33b315){return _0x17a92e[_0x47fd('0x1e')](_0x20c885)[_0x47fd('0x20')](_0x33b315);}};}function respondWithFilteredResult(_0x1893c4,_0x579a03){return function(_0x39e6fb){if(_0x39e6fb){var _0x2b0a79=typeof _0x579a03[_0x47fd('0x21')]===_0x47fd('0x22')&&typeof _0x579a03[_0x47fd('0x23')]==='undefined';var _0x581fde=_0x39e6fb[_0x47fd('0x24')];var _0x4795ac=_0x2b0a79?0x0:_0x579a03[_0x47fd('0x21')];var _0x1f2155=_0x2b0a79?_0x39e6fb[_0x47fd('0x24')]:_0x579a03[_0x47fd('0x21')]+_0x579a03[_0x47fd('0x23')];var _0x1396c3;if(_0x1f2155>=_0x581fde){_0x1f2155=_0x581fde;_0x1396c3=0xc8;}else{_0x1396c3=0xce;}_0x1893c4['status'](_0x1396c3);return _0x1893c4[_0x47fd('0x25')](_0x47fd('0x26'),_0x4795ac+'-'+_0x1f2155+'/'+_0x581fde)[_0x47fd('0x20')](_0x39e6fb);}return null;};}function patchUpdates(_0x471673){return function(_0x4454af){try{jsonpatch[_0x47fd('0x27')](_0x4454af,_0x471673,!![]);}catch(_0x33589f){return BPromise[_0x47fd('0x28')](_0x33589f);}return _0x4454af[_0x47fd('0x29')]();};}function saveUpdates(_0x5ce65d,_0x12dd9f){return function(_0x1980b5){if(_0x1980b5){return _0x1980b5[_0x47fd('0x2a')](_0x5ce65d)[_0x47fd('0x2b')](function(_0x376ad6){return _0x376ad6;});}return null;};}function removeEntity(_0x5ce949,_0x23d3ec){return function(_0x1ada55){if(_0x1ada55){return _0x1ada55[_0x47fd('0x2c')]()[_0x47fd('0x2b')](function(){_0x5ce949['status'](0xcc)[_0x47fd('0x1f')]();});}};}function handleEntityNotFound(_0x1f96ef,_0x3577a6){return function(_0x1c11a7){if(!_0x1c11a7){_0x1f96ef[_0x47fd('0x1d')](0x194);}return _0x1c11a7;};}function handleError(_0x1329d0,_0x18f0aa){_0x18f0aa=_0x18f0aa||0x1f4;return function(_0x3ae3ef){logger[_0x47fd('0x2d')](_0x3ae3ef[_0x47fd('0x2e')]);if(_0x3ae3ef[_0x47fd('0x2f')]){delete _0x3ae3ef[_0x47fd('0x2f')];}_0x1329d0['status'](_0x18f0aa)[_0x47fd('0x30')](_0x3ae3ef);};}exports[_0x47fd('0x31')]=function(_0x2d2df0,_0x240745){var _0x11df99={},_0x5b51a7={},_0x2c5000={'count':0x0,'rows':[]};var _0x2e44e3=_[_0x47fd('0x32')](db[_0x47fd('0x33')]['rawAttributes'],function(_0x500011){return{'name':_0x500011[_0x47fd('0x34')],'type':_0x500011[_0x47fd('0x35')][_0x47fd('0x36')]};});_0x5b51a7['model']=_['map'](_0x2e44e3,_0x47fd('0x2f'));_0x5b51a7[_0x47fd('0x37')]=_[_0x47fd('0x38')](_0x2d2df0[_0x47fd('0x37')]);_0x5b51a7[_0x47fd('0x39')]=_[_0x47fd('0x3a')](_0x5b51a7[_0x47fd('0x3b')],_0x5b51a7[_0x47fd('0x37')]);_0x11df99[_0x47fd('0x3c')]=_['intersection'](_0x5b51a7[_0x47fd('0x3b')],qs[_0x47fd('0x3d')](_0x2d2df0[_0x47fd('0x37')][_0x47fd('0x3d')]));_0x11df99[_0x47fd('0x3c')]=_0x11df99[_0x47fd('0x3c')][_0x47fd('0x3e')]?_0x11df99[_0x47fd('0x3c')]:_0x5b51a7[_0x47fd('0x3b')];if(!_0x2d2df0[_0x47fd('0x37')][_0x47fd('0x3f')](_0x47fd('0x40'))){_0x11df99[_0x47fd('0x23')]=qs[_0x47fd('0x23')](_0x2d2df0[_0x47fd('0x37')][_0x47fd('0x23')]);_0x11df99[_0x47fd('0x21')]=qs[_0x47fd('0x21')](_0x2d2df0['query']['offset']);}_0x11df99['order']=qs[_0x47fd('0x41')](_0x2d2df0['query']['sort']);_0x11df99[_0x47fd('0x42')]=qs[_0x47fd('0x39')](_[_0x47fd('0x43')](_0x2d2df0['query'],_0x5b51a7[_0x47fd('0x39')]),_0x2e44e3);if(_0x2d2df0['query'][_0x47fd('0x44')]){_0x11df99[_0x47fd('0x42')]=_['merge'](_0x11df99[_0x47fd('0x42')],{'$or':_['map'](_0x2e44e3,function(_0x291e30){if(_0x291e30[_0x47fd('0x35')]!==_0x47fd('0x45')){var _0x3ff194={};_0x3ff194[_0x291e30[_0x47fd('0x2f')]]={'$like':'%'+_0x2d2df0[_0x47fd('0x37')]['filter']+'%'};return _0x3ff194;}})});}_0x11df99=_[_0x47fd('0x46')]({},_0x11df99,_0x2d2df0[_0x47fd('0x47')]);var _0x598734={'where':_0x11df99['where']};return db[_0x47fd('0x33')][_0x47fd('0x24')](_0x598734)[_0x47fd('0x2b')](function(_0x3423e4){_0x2c5000[_0x47fd('0x24')]=_0x3423e4;if(_0x2d2df0[_0x47fd('0x37')][_0x47fd('0x48')]){_0x11df99[_0x47fd('0x49')]=[{'all':!![]}];}return db[_0x47fd('0x33')][_0x47fd('0x4a')](_0x11df99);})['then'](function(_0x1758ce){_0x2c5000['rows']=_0x1758ce;return _0x2c5000;})[_0x47fd('0x2b')](respondWithFilteredResult(_0x240745,_0x11df99))[_0x47fd('0x4b')](handleError(_0x240745,null));};exports[_0x47fd('0x4c')]=function(_0x50514,_0x1c21aa){var _0xd30a={'raw':![],'where':{'id':_0x50514['params']['id']}},_0x4a9742={};_0x4a9742[_0x47fd('0x3b')]=_[_0x47fd('0x38')](db[_0x47fd('0x33')][_0x47fd('0x4d')]);_0x4a9742[_0x47fd('0x37')]=_[_0x47fd('0x38')](_0x50514['query']);_0x4a9742[_0x47fd('0x39')]=_[_0x47fd('0x3a')](_0x4a9742[_0x47fd('0x3b')],_0x4a9742[_0x47fd('0x37')]);_0xd30a[_0x47fd('0x3c')]=_[_0x47fd('0x3a')](_0x4a9742['model'],qs['fields'](_0x50514[_0x47fd('0x37')][_0x47fd('0x3d')]));_0xd30a['attributes']=_0xd30a[_0x47fd('0x3c')][_0x47fd('0x3e')]?_0xd30a[_0x47fd('0x3c')]:_0x4a9742[_0x47fd('0x3b')];if(_0x50514[_0x47fd('0x37')][_0x47fd('0x48')]){_0xd30a[_0x47fd('0x49')]=[{'all':!![]}];}_0xd30a=_[_0x47fd('0x46')]({},_0xd30a,_0x50514[_0x47fd('0x47')]);return db[_0x47fd('0x33')][_0x47fd('0x4e')](_0xd30a)[_0x47fd('0x2b')](handleEntityNotFound(_0x1c21aa,null))[_0x47fd('0x2b')](respondWithResult(_0x1c21aa,null))[_0x47fd('0x4b')](handleError(_0x1c21aa,null));};exports[_0x47fd('0x4f')]=function(_0x31d1da,_0x202260){return db[_0x47fd('0x33')][_0x47fd('0x4f')](_0x31d1da[_0x47fd('0x50')],{})['then'](respondWithResult(_0x202260,0xc9))[_0x47fd('0x4b')](handleError(_0x202260,null));};exports['update']=function(_0x4f23fa,_0x40dbe5){if(_0x4f23fa[_0x47fd('0x50')]['id']){delete _0x4f23fa['body']['id'];}return db[_0x47fd('0x33')][_0x47fd('0x4e')]({'where':{'id':_0x4f23fa[_0x47fd('0x51')]['id']}})[_0x47fd('0x2b')](handleEntityNotFound(_0x40dbe5,null))[_0x47fd('0x2b')](saveUpdates(_0x4f23fa['body'],null))['then'](respondWithResult(_0x40dbe5,null))['catch'](handleError(_0x40dbe5,null));};exports['destroy']=function(_0x38c41d,_0x23d6e7){return db['SalesforceConfiguration'][_0x47fd('0x4e')]({'where':{'id':_0x38c41d[_0x47fd('0x51')]['id']}})[_0x47fd('0x2b')](handleEntityNotFound(_0x23d6e7,null))['then'](removeEntity(_0x23d6e7,null))[_0x47fd('0x4b')](handleError(_0x23d6e7,null));};exports['getFields']=function(_0x6602a2,_0x4cebd3,_0x5d1783){var _0x502492={};var _0x5acc32={};var _0x105e0c;var _0x309c44;return db[_0x47fd('0x33')][_0x47fd('0x52')]({'where':{'id':_0x6602a2[_0x47fd('0x51')]['id']}})['then'](handleEntityNotFound(_0x4cebd3,null))[_0x47fd('0x2b')](function(_0x19d95f){if(_0x19d95f){_0x105e0c=_0x19d95f;_0x5acc32[_0x47fd('0x3b')]=_[_0x47fd('0x38')](db[_0x47fd('0x53')]['rawAttributes']);_0x5acc32[_0x47fd('0x37')]=_[_0x47fd('0x38')](_0x6602a2[_0x47fd('0x37')]);_0x5acc32[_0x47fd('0x39')]=_['intersection'](_0x5acc32['model'],_0x5acc32[_0x47fd('0x37')]);_0x502492['attributes']=_['intersection'](_0x5acc32['model'],qs['fields'](_0x6602a2[_0x47fd('0x37')]['fields']));_0x502492['attributes']=_0x502492['attributes'][_0x47fd('0x3e')]?_0x502492[_0x47fd('0x3c')]:_0x5acc32[_0x47fd('0x3b')];_0x502492[_0x47fd('0x54')]=qs[_0x47fd('0x41')](_0x6602a2[_0x47fd('0x37')][_0x47fd('0x41')]);_0x502492['where']=qs['filters'](_[_0x47fd('0x43')](_0x6602a2[_0x47fd('0x37')],_0x5acc32[_0x47fd('0x39')]));if(_0x6602a2[_0x47fd('0x37')]['filter']){_0x502492[_0x47fd('0x42')]=_['merge'](_0x502492['where'],{'$or':_['map'](_0x502492[_0x47fd('0x3c')],function(_0x5ddaa7){var _0x25d29e={};_0x25d29e[_0x5ddaa7]={'$like':'%'+_0x6602a2[_0x47fd('0x37')][_0x47fd('0x44')]+'%'};return _0x25d29e;})});}_0x502492=_[_0x47fd('0x46')]({},_0x502492,_0x6602a2[_0x47fd('0x47')]);return _0x105e0c[_0x47fd('0x55')](_0x502492);}})[_0x47fd('0x2b')](function(_0x499725){if(_0x499725){_0x309c44=_0x499725['length'];if(!_0x6602a2['query'][_0x47fd('0x3f')](_0x47fd('0x40'))){_0x502492[_0x47fd('0x23')]=qs[_0x47fd('0x23')](_0x6602a2[_0x47fd('0x37')][_0x47fd('0x23')]);_0x502492[_0x47fd('0x21')]=qs[_0x47fd('0x21')](_0x6602a2[_0x47fd('0x37')][_0x47fd('0x21')]);}return _0x105e0c['getFields'](_0x502492);}})['then'](function(_0x503ccc){if(_0x503ccc){return _0x503ccc?{'count':_0x309c44,'rows':_0x503ccc}:null;}})['then'](respondWithResult(_0x4cebd3,null))['catch'](handleError(_0x4cebd3,null));};exports['getSubjects']=function(_0x466d02,_0x4f7e12,_0x2838c9){var _0x54d1bb={};var _0x54bc47={};var _0x373222;var _0x532eef;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x466d02[_0x47fd('0x51')]['id']}})[_0x47fd('0x2b')](handleEntityNotFound(_0x4f7e12,null))[_0x47fd('0x2b')](function(_0x18b330){if(_0x18b330){_0x373222=_0x18b330;_0x54bc47['model']=_[_0x47fd('0x38')](db['SalesforceField']['rawAttributes']);_0x54bc47[_0x47fd('0x37')]=_[_0x47fd('0x38')](_0x466d02[_0x47fd('0x37')]);_0x54bc47['filters']=_[_0x47fd('0x3a')](_0x54bc47[_0x47fd('0x3b')],_0x54bc47[_0x47fd('0x37')]);_0x54d1bb[_0x47fd('0x3c')]=_['intersection'](_0x54bc47[_0x47fd('0x3b')],qs[_0x47fd('0x3d')](_0x466d02[_0x47fd('0x37')]['fields']));_0x54d1bb[_0x47fd('0x3c')]=_0x54d1bb[_0x47fd('0x3c')][_0x47fd('0x3e')]?_0x54d1bb[_0x47fd('0x3c')]:_0x54bc47[_0x47fd('0x3b')];_0x54d1bb[_0x47fd('0x54')]=qs[_0x47fd('0x41')](_0x466d02['query'][_0x47fd('0x41')]);_0x54d1bb[_0x47fd('0x42')]=qs[_0x47fd('0x39')](_[_0x47fd('0x43')](_0x466d02[_0x47fd('0x37')],_0x54bc47[_0x47fd('0x39')]));if(_0x466d02['query'][_0x47fd('0x44')]){_0x54d1bb[_0x47fd('0x42')]=_[_0x47fd('0x46')](_0x54d1bb['where'],{'$or':_['map'](_0x54d1bb['attributes'],function(_0x4e562b){var _0x5d37f3={};_0x5d37f3[_0x4e562b]={'$like':'%'+_0x466d02['query'][_0x47fd('0x44')]+'%'};return _0x5d37f3;})});}_0x54d1bb=_[_0x47fd('0x46')]({},_0x54d1bb,_0x466d02[_0x47fd('0x47')]);return _0x373222[_0x47fd('0x56')](_0x54d1bb);}})[_0x47fd('0x2b')](function(_0xdf0e54){if(_0xdf0e54){_0x532eef=_0xdf0e54[_0x47fd('0x3e')];if(!_0x466d02['query'][_0x47fd('0x3f')](_0x47fd('0x40'))){_0x54d1bb['limit']=qs[_0x47fd('0x23')](_0x466d02[_0x47fd('0x37')][_0x47fd('0x23')]);_0x54d1bb[_0x47fd('0x21')]=qs[_0x47fd('0x21')](_0x466d02['query'][_0x47fd('0x21')]);}return _0x373222['getSubjects'](_0x54d1bb);}})[_0x47fd('0x2b')](function(_0x5f56da){if(_0x5f56da){return _0x5f56da?{'count':_0x532eef,'rows':_0x5f56da}:null;}})[_0x47fd('0x2b')](respondWithResult(_0x4f7e12,null))[_0x47fd('0x4b')](handleError(_0x4f7e12,null));};exports[_0x47fd('0x57')]=function(_0x1a816c,_0x122972,_0x3ff12e){var _0x56087d={};var _0x5395fa={};var _0x4b6076;var _0x331647;return db[_0x47fd('0x33')][_0x47fd('0x52')]({'where':{'id':_0x1a816c[_0x47fd('0x51')]['id']}})[_0x47fd('0x2b')](handleEntityNotFound(_0x122972,null))[_0x47fd('0x2b')](function(_0x283b87){if(_0x283b87){_0x4b6076=_0x283b87;_0x5395fa[_0x47fd('0x3b')]=_[_0x47fd('0x38')](db[_0x47fd('0x53')][_0x47fd('0x4d')]);_0x5395fa[_0x47fd('0x37')]=_[_0x47fd('0x38')](_0x1a816c[_0x47fd('0x37')]);_0x5395fa[_0x47fd('0x39')]=_[_0x47fd('0x3a')](_0x5395fa[_0x47fd('0x3b')],_0x5395fa[_0x47fd('0x37')]);_0x56087d[_0x47fd('0x3c')]=_['intersection'](_0x5395fa[_0x47fd('0x3b')],qs[_0x47fd('0x3d')](_0x1a816c[_0x47fd('0x37')]['fields']));_0x56087d[_0x47fd('0x3c')]=_0x56087d['attributes'][_0x47fd('0x3e')]?_0x56087d['attributes']:_0x5395fa[_0x47fd('0x3b')];_0x56087d[_0x47fd('0x54')]=qs[_0x47fd('0x41')](_0x1a816c[_0x47fd('0x37')][_0x47fd('0x41')]);_0x56087d['where']=qs[_0x47fd('0x39')](_['pick'](_0x1a816c['query'],_0x5395fa[_0x47fd('0x39')]));if(_0x1a816c[_0x47fd('0x37')]['filter']){_0x56087d[_0x47fd('0x42')]=_[_0x47fd('0x46')](_0x56087d[_0x47fd('0x42')],{'$or':_[_0x47fd('0x32')](_0x56087d['attributes'],function(_0x2bfaf1){var _0x1bc7ff={};_0x1bc7ff[_0x2bfaf1]={'$like':'%'+_0x1a816c[_0x47fd('0x37')][_0x47fd('0x44')]+'%'};return _0x1bc7ff;})});}_0x56087d=_['merge']({},_0x56087d,_0x1a816c[_0x47fd('0x47')]);return _0x4b6076[_0x47fd('0x57')](_0x56087d);}})['then'](function(_0x28b123){if(_0x28b123){_0x331647=_0x28b123['length'];if(!_0x1a816c[_0x47fd('0x37')][_0x47fd('0x3f')](_0x47fd('0x40'))){_0x56087d[_0x47fd('0x23')]=qs[_0x47fd('0x23')](_0x1a816c[_0x47fd('0x37')][_0x47fd('0x23')]);_0x56087d[_0x47fd('0x21')]=qs[_0x47fd('0x21')](_0x1a816c[_0x47fd('0x37')]['offset']);}return _0x4b6076[_0x47fd('0x57')](_0x56087d);}})['then'](function(_0x5b665f){if(_0x5b665f){return _0x5b665f?{'count':_0x331647,'rows':_0x5b665f}:null;}})['then'](respondWithResult(_0x122972,null))[_0x47fd('0x4b')](handleError(_0x122972,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 1621836..7104971 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 _0x6451=['rimraf','../../config/environment','exports','define','SalesforceConfiguration','lodash','api','moment','bluebird','request-promise','path'];(function(_0xb99421,_0xaab133){var _0x4b3ec7=function(_0x591d1a){while(--_0x591d1a){_0xb99421['push'](_0xb99421['shift']());}};_0x4b3ec7(++_0xaab133);}(_0x6451,0x68));var _0x1645=function(_0x36eb29,_0xc6943){_0x36eb29=_0x36eb29-0x0;var _0x50b519=_0x6451[_0x36eb29];return _0x50b519;};'use strict';var _=require(_0x1645('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1645('0x1'));var moment=require(_0x1645('0x2'));var BPromise=require(_0x1645('0x3'));var rp=require(_0x1645('0x4'));var fs=require('fs');var path=require(_0x1645('0x5'));var rimraf=require(_0x1645('0x6'));var config=require(_0x1645('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x1645('0x8')]=function(_0x46ed3e,_0x1411d1){return _0x46ed3e[_0x1645('0x9')](_0x1645('0xa'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x930a=['define','SalesforceConfiguration','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports'];(function(_0x2baf03,_0x2b2568){var _0x23185d=function(_0x4267ff){while(--_0x4267ff){_0x2baf03['push'](_0x2baf03['shift']());}};_0x23185d(++_0x2b2568);}(_0x930a,0x115));var _0xa930=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x930a[_0x2070da];return _0x4f9fe1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa930('0x0'))(_0xa930('0x1'));var moment=require(_0xa930('0x2'));var BPromise=require(_0xa930('0x3'));var rp=require(_0xa930('0x4'));var fs=require('fs');var path=require(_0xa930('0x5'));var rimraf=require('rimraf');var config=require(_0xa930('0x6'));var attributes=require(_0xa930('0x7'));module[_0xa930('0x8')]=function(_0x10b779,_0x38e192){return _0x10b779[_0xa930('0x9')](_0xa930('0xa'),attributes,{'tableName':'int_salesforce_configurations','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 0f95441..3305c29 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 _0x7446=['error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','request\x20sent','code'];(function(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_0x7446,0x16b));var _0x6744=function(_0x414f29,_0x23a4dd){_0x414f29=_0x414f29-0x0;var _0x19b65a=_0x7446[_0x414f29];return _0x19b65a;};'use strict';var _=require(_0x6744('0x0'));var util=require(_0x6744('0x1'));var moment=require(_0x6744('0x2'));var BPromise=require('bluebird');var rs=require(_0x6744('0x3'));var fs=require('fs');var Redis=require(_0x6744('0x4'));var db=require(_0x6744('0x5'))['db'];var utils=require(_0x6744('0x6'));var logger=require('../../config/logger')(_0x6744('0x7'));var config=require(_0x6744('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6744('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59fa58,_0x4dadca,_0x534c13){return new BPromise(function(_0x5c8b84,_0xcc8760){return client[_0x6744('0xa')](_0x59fa58,_0x534c13)[_0x6744('0xb')](function(_0x20212c){logger[_0x6744('0xc')](_0x6744('0xd'),_0x4dadca,'request\x20sent');logger[_0x6744('0xe')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x4dadca,_0x6744('0xf'),JSON['stringify'](_0x20212c));if(_0x20212c['error']){if(_0x20212c['error'][_0x6744('0x10')]===0x1f4){logger[_0x6744('0x11')](_0x6744('0xd'),_0x4dadca,_0x20212c[_0x6744('0x11')][_0x6744('0x12')]);return _0xcc8760(_0x20212c['error'][_0x6744('0x12')]);}logger[_0x6744('0x11')](_0x6744('0xd'),_0x4dadca,_0x20212c[_0x6744('0x11')][_0x6744('0x12')]);return _0x5c8b84(_0x20212c[_0x6744('0x11')]['message']);}else{logger[_0x6744('0xc')](_0x6744('0xd'),_0x4dadca,_0x6744('0xf'));_0x5c8b84(_0x20212c[_0x6744('0x13')][_0x6744('0x12')]);}})['catch'](function(_0x1364a9){logger['error'](_0x6744('0xd'),_0x4dadca,_0x1364a9);_0xcc8760(_0x1364a9);});});} \ No newline at end of file +var _0x4873=['../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xb7362e,_0x29405c){var _0x39565c=function(_0x6f663f){while(--_0x6f663f){_0xb7362e['push'](_0xb7362e['shift']());}};_0x39565c(++_0x29405c);}(_0x4873,0x120));var _0x3487=function(_0x267176,_0xfe4480){_0x267176=_0x267176-0x0;var _0x4e803b=_0x4873[_0x267176];return _0x4e803b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3487('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3487('0x1'));var db=require(_0x3487('0x2'))['db'];var utils=require(_0x3487('0x3'));var logger=require(_0x3487('0x4'))(_0x3487('0x5'));var config=require(_0x3487('0x6'));var jayson=require(_0x3487('0x7'));var client=jayson[_0x3487('0x8')][_0x3487('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cb3b9,_0x1b471d,_0x44e83c){return new BPromise(function(_0x5bb015,_0x4fba45){return client[_0x3487('0xa')](_0x4cb3b9,_0x44e83c)[_0x3487('0xb')](function(_0x36fcb2){logger[_0x3487('0xc')](_0x3487('0xd'),_0x1b471d,_0x3487('0xe'));logger['debug'](_0x3487('0xf'),_0x1b471d,_0x3487('0xe'),JSON[_0x3487('0x10')](_0x36fcb2));if(_0x36fcb2['error']){if(_0x36fcb2[_0x3487('0x11')]['code']===0x1f4){logger[_0x3487('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1b471d,_0x36fcb2[_0x3487('0x11')]['message']);return _0x4fba45(_0x36fcb2['error'][_0x3487('0x12')]);}logger[_0x3487('0x11')](_0x3487('0xd'),_0x1b471d,_0x36fcb2[_0x3487('0x11')][_0x3487('0x12')]);return _0x5bb015(_0x36fcb2[_0x3487('0x11')][_0x3487('0x12')]);}else{logger[_0x3487('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1b471d,_0x3487('0xe'));_0x5bb015(_0x36fcb2[_0x3487('0x13')][_0x3487('0x12')]);}})[_0x3487('0x14')](function(_0x4d457e){logger[_0x3487('0x11')](_0x3487('0xd'),_0x1b471d,_0x4d457e);_0x4fba45(_0x4d457e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 05d0e5f..10b8693 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 _0xa790=['express','Router','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','create','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x3dd991,_0x4bef12){var _0x251609=function(_0x371481){while(--_0x371481){_0x3dd991['push'](_0x3dd991['shift']());}};_0x251609(++_0x4bef12);}(_0xa790,0xfd));var _0x0a79=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa790[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0a79('0x0'));var util=require('util');var path=require(_0x0a79('0x1'));var timeout=require(_0x0a79('0x2'));var express=require(_0x0a79('0x3'));var router=express[_0x0a79('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0a79('0x5'));var controller=require(_0x0a79('0x6'));router[_0x0a79('0x7')]('/',auth[_0x0a79('0x8')](),controller[_0x0a79('0x9')]);router[_0x0a79('0x7')](_0x0a79('0xa'),auth[_0x0a79('0x8')](),controller['show']);router['post']('/',auth[_0x0a79('0x8')](),controller[_0x0a79('0xb')]);router['put']('/:id',auth[_0x0a79('0x8')](),controller[_0x0a79('0xc')]);router[_0x0a79('0xd')]('/:id',auth[_0x0a79('0x8')](),controller[_0x0a79('0xe')]);module[_0x0a79('0xf')]=router; \ No newline at end of file +var _0x7840=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','post','create','/:id','delete','destroy','exports','multer','util','path'];(function(_0x4e93a9,_0x413f30){var _0x43013c=function(_0x3a0cf3){while(--_0x3a0cf3){_0x4e93a9['push'](_0x4e93a9['shift']());}};_0x43013c(++_0x413f30);}(_0x7840,0xf4));var _0x0784=function(_0x1ef639,_0x8202f8){_0x1ef639=_0x1ef639-0x0;var _0xbada0=_0x7840[_0x1ef639];return _0xbada0;};'use strict';var multer=require(_0x0784('0x0'));var util=require(_0x0784('0x1'));var path=require(_0x0784('0x2'));var timeout=require(_0x0784('0x3'));var express=require(_0x0784('0x4'));var router=express['Router']();var fs_extra=require(_0x0784('0x5'));var auth=require(_0x0784('0x6'));var interaction=require(_0x0784('0x7'));var config=require(_0x0784('0x8'));var controller=require(_0x0784('0x9'));router[_0x0784('0xa')]('/',auth[_0x0784('0xb')](),controller[_0x0784('0xc')]);router[_0x0784('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0784('0xd')]('/',auth['isAuthenticated'](),controller[_0x0784('0xe')]);router['put'](_0x0784('0xf'),auth[_0x0784('0xb')](),controller['update']);router[_0x0784('0x10')](_0x0784('0xf'),auth[_0x0784('0xb')](),controller[_0x0784('0x11')]);module[_0x0784('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index ce2c17e..ad2c40e 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 _0x3584=['string','variable','keyValue','ENUM','STRING','sequelize','exports'];(function(_0x5bc4ca,_0x21f738){var _0x12bf3b=function(_0x202536){while(--_0x202536){_0x5bc4ca['push'](_0x5bc4ca['shift']());}};_0x12bf3b(++_0x21f738);}(_0x3584,0x132));var _0x4358=function(_0x4b89b6,_0x1d1f1d){_0x4b89b6=_0x4b89b6-0x0;var _0xf50331=_0x3584[_0x4b89b6];return _0xf50331;};'use strict';var Sequelize=require(_0x4358('0x0'));module[_0x4358('0x1')]={'type':{'type':Sequelize['ENUM'](_0x4358('0x2'),_0x4358('0x3'),'customVariable',_0x4358('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4358('0x5')](_0x4358('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4358('0x6')]},'variableName':{'type':Sequelize[_0x4358('0x6')]}}; \ No newline at end of file +var _0x82d3=['ENUM','variable','customVariable','STRING','string','sequelize','exports'];(function(_0x2da995,_0x12b08d){var _0x4d2ea4=function(_0x1f354f){while(--_0x1f354f){_0x2da995['push'](_0x2da995['shift']());}};_0x4d2ea4(++_0x12b08d);}(_0x82d3,0xfa));var _0x382d=function(_0x350790,_0x3fc428){_0x350790=_0x350790-0x0;var _0xdbcf58=_0x82d3[_0x350790];return _0xdbcf58;};'use strict';var Sequelize=require(_0x382d('0x0'));module[_0x382d('0x1')]={'type':{'type':Sequelize[_0x382d('0x2')]('string',_0x382d('0x3'),_0x382d('0x4'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x382d('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x382d('0x2')](_0x382d('0x6'),_0x382d('0x3'),_0x382d('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x382d('0x5')]},'variableName':{'type':Sequelize[_0x382d('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index d72d368..767ccee 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 _0xb75f=['includeAll','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','json','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','SalesforceField','fieldName','type','key','keys','query','filters','intersection','model','attributes','length','sort','where','pick','filter','merge','options','include','catch','show','params','fields'];(function(_0xbd92a,_0x389c9e){var _0x55c34e=function(_0x19a633){while(--_0x19a633){_0xbd92a['push'](_0xbd92a['shift']());}};_0x55c34e(++_0x389c9e);}(_0xb75f,0x93));var _0xfb75=function(_0x5e53e1,_0x2b23fb){_0x5e53e1=_0x5e53e1-0x0;var _0x3c8876=_0xb75f[_0x5e53e1];return _0x3c8876;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfb75('0x0'));var zipdir=require(_0xfb75('0x1'));var jsonpatch=require(_0xfb75('0x2'));var rp=require(_0xfb75('0x3'));var moment=require('moment');var BPromise=require(_0xfb75('0x4'));var Mustache=require(_0xfb75('0x5'));var util=require('util');var path=require(_0xfb75('0x6'));var sox=require(_0xfb75('0x7'));var csv=require(_0xfb75('0x8'));var ejs=require(_0xfb75('0x9'));var fs=require('fs');var fs_extra=require(_0xfb75('0xa'));var _=require(_0xfb75('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfb75('0xc'));var deskjs=require(_0xfb75('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfb75('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfb75('0xf'));var qs=require(_0xfb75('0x10'));var as=require(_0xfb75('0x11'));var hardwareService=require(_0xfb75('0x12'));var logger=require(_0xfb75('0x13'))(_0xfb75('0x14'));var utils=require(_0xfb75('0x15'));var config=require(_0xfb75('0x16'));var licenseUtil=require(_0xfb75('0x17'));var db=require(_0xfb75('0x18'))['db'];function respondWithStatusCode(_0x14fb51,_0x58b5f0){_0x58b5f0=_0x58b5f0||0xcc;return function(_0x14fd66){if(_0x14fd66){return _0x14fb51['sendStatus'](_0x58b5f0);}return _0x14fb51[_0xfb75('0x19')](_0x58b5f0)[_0xfb75('0x1a')]();};}function respondWithResult(_0x22c211,_0x12a291){_0x12a291=_0x12a291||0xc8;return function(_0x263f69){if(_0x263f69){return _0x22c211[_0xfb75('0x19')](_0x12a291)['json'](_0x263f69);}};}function respondWithFilteredResult(_0x88c5f1,_0x2d1569){return function(_0x2b3977){if(_0x2b3977){var _0x141246=typeof _0x2d1569['offset']===_0xfb75('0x1b')&&typeof _0x2d1569[_0xfb75('0x1c')]===_0xfb75('0x1b');var _0x2f2d91=_0x2b3977[_0xfb75('0x1d')];var _0x59600c=_0x141246?0x0:_0x2d1569[_0xfb75('0x1e')];var _0x460d1c=_0x141246?_0x2b3977['count']:_0x2d1569[_0xfb75('0x1e')]+_0x2d1569[_0xfb75('0x1c')];var _0x131b9c;if(_0x460d1c>=_0x2f2d91){_0x460d1c=_0x2f2d91;_0x131b9c=0xc8;}else{_0x131b9c=0xce;}_0x88c5f1[_0xfb75('0x19')](_0x131b9c);return _0x88c5f1[_0xfb75('0x1f')]('Content-Range',_0x59600c+'-'+_0x460d1c+'/'+_0x2f2d91)[_0xfb75('0x20')](_0x2b3977);}return null;};}function patchUpdates(_0x2158e8){return function(_0x86b255){try{jsonpatch[_0xfb75('0x21')](_0x86b255,_0x2158e8,!![]);}catch(_0x1a1ebe){return BPromise[_0xfb75('0x22')](_0x1a1ebe);}return _0x86b255[_0xfb75('0x23')]();};}function saveUpdates(_0x4d7bdf,_0x2b6804){return function(_0x325f27){if(_0x325f27){return _0x325f27['update'](_0x4d7bdf)[_0xfb75('0x24')](function(_0x219ebb){return _0x219ebb;});}return null;};}function removeEntity(_0x367254,_0x1a0eb2){return function(_0x39b23b){if(_0x39b23b){return _0x39b23b['destroy']()[_0xfb75('0x24')](function(){_0x367254['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b03e2,_0x2fb2ff){return function(_0x10de8f){if(!_0x10de8f){_0x1b03e2[_0xfb75('0x25')](0x194);}return _0x10de8f;};}function handleError(_0x5b4cf9,_0x30290d){_0x30290d=_0x30290d||0x1f4;return function(_0x545125){logger[_0xfb75('0x26')](_0x545125[_0xfb75('0x27')]);if(_0x545125[_0xfb75('0x28')]){delete _0x545125['name'];}_0x5b4cf9[_0xfb75('0x19')](_0x30290d)[_0xfb75('0x29')](_0x545125);};}exports[_0xfb75('0x2a')]=function(_0x389da4,_0x4d3255){var _0x3e99ce={},_0x55ae39={},_0x59ad9a={'count':0x0,'rows':[]};var _0x200e18=_[_0xfb75('0x2b')](db[_0xfb75('0x2c')]['rawAttributes'],function(_0x5ad09e){return{'name':_0x5ad09e[_0xfb75('0x2d')],'type':_0x5ad09e[_0xfb75('0x2e')][_0xfb75('0x2f')]};});_0x55ae39['model']=_['map'](_0x200e18,_0xfb75('0x28'));_0x55ae39['query']=_[_0xfb75('0x30')](_0x389da4[_0xfb75('0x31')]);_0x55ae39[_0xfb75('0x32')]=_[_0xfb75('0x33')](_0x55ae39[_0xfb75('0x34')],_0x55ae39[_0xfb75('0x31')]);_0x3e99ce[_0xfb75('0x35')]=_[_0xfb75('0x33')](_0x55ae39['model'],qs['fields'](_0x389da4['query']['fields']));_0x3e99ce[_0xfb75('0x35')]=_0x3e99ce[_0xfb75('0x35')][_0xfb75('0x36')]?_0x3e99ce['attributes']:_0x55ae39[_0xfb75('0x34')];if(!_0x389da4[_0xfb75('0x31')]['hasOwnProperty']('nolimit')){_0x3e99ce['limit']=qs['limit'](_0x389da4[_0xfb75('0x31')][_0xfb75('0x1c')]);_0x3e99ce['offset']=qs['offset'](_0x389da4['query'][_0xfb75('0x1e')]);}_0x3e99ce['order']=qs[_0xfb75('0x37')](_0x389da4[_0xfb75('0x31')][_0xfb75('0x37')]);_0x3e99ce[_0xfb75('0x38')]=qs['filters'](_[_0xfb75('0x39')](_0x389da4[_0xfb75('0x31')],_0x55ae39[_0xfb75('0x32')]),_0x200e18);if(_0x389da4[_0xfb75('0x31')][_0xfb75('0x3a')]){_0x3e99ce[_0xfb75('0x38')]=_[_0xfb75('0x3b')](_0x3e99ce[_0xfb75('0x38')],{'$or':_[_0xfb75('0x2b')](_0x200e18,function(_0x4564d0){if(_0x4564d0['type']!=='VIRTUAL'){var _0x114143={};_0x114143[_0x4564d0[_0xfb75('0x28')]]={'$like':'%'+_0x389da4[_0xfb75('0x31')][_0xfb75('0x3a')]+'%'};return _0x114143;}})});}_0x3e99ce=_[_0xfb75('0x3b')]({},_0x3e99ce,_0x389da4[_0xfb75('0x3c')]);var _0x4fc0d5={'where':_0x3e99ce[_0xfb75('0x38')]};return db[_0xfb75('0x2c')][_0xfb75('0x1d')](_0x4fc0d5)[_0xfb75('0x24')](function(_0x44a92d){_0x59ad9a[_0xfb75('0x1d')]=_0x44a92d;if(_0x389da4[_0xfb75('0x31')]['includeAll']){_0x3e99ce[_0xfb75('0x3d')]=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x3e99ce);})[_0xfb75('0x24')](function(_0x30d0c6){_0x59ad9a['rows']=_0x30d0c6;return _0x59ad9a;})[_0xfb75('0x24')](respondWithFilteredResult(_0x4d3255,_0x3e99ce))[_0xfb75('0x3e')](handleError(_0x4d3255,null));};exports[_0xfb75('0x3f')]=function(_0x37411a,_0x19a750){var _0x48d89d={'raw':!![],'where':{'id':_0x37411a[_0xfb75('0x40')]['id']}},_0xd801d0={};_0xd801d0['model']=_[_0xfb75('0x30')](db[_0xfb75('0x2c')]['rawAttributes']);_0xd801d0[_0xfb75('0x31')]=_[_0xfb75('0x30')](_0x37411a[_0xfb75('0x31')]);_0xd801d0[_0xfb75('0x32')]=_[_0xfb75('0x33')](_0xd801d0[_0xfb75('0x34')],_0xd801d0['query']);_0x48d89d[_0xfb75('0x35')]=_[_0xfb75('0x33')](_0xd801d0['model'],qs[_0xfb75('0x41')](_0x37411a[_0xfb75('0x31')]['fields']));_0x48d89d[_0xfb75('0x35')]=_0x48d89d[_0xfb75('0x35')][_0xfb75('0x36')]?_0x48d89d[_0xfb75('0x35')]:_0xd801d0['model'];if(_0x37411a[_0xfb75('0x31')][_0xfb75('0x42')]){_0x48d89d['include']=[{'all':!![]}];}_0x48d89d=_[_0xfb75('0x3b')]({},_0x48d89d,_0x37411a[_0xfb75('0x3c')]);return db[_0xfb75('0x2c')][_0xfb75('0x43')](_0x48d89d)[_0xfb75('0x24')](handleEntityNotFound(_0x19a750,null))[_0xfb75('0x24')](respondWithResult(_0x19a750,null))[_0xfb75('0x3e')](handleError(_0x19a750,null));};exports[_0xfb75('0x44')]=function(_0x5696d0,_0x4b5f10){return db[_0xfb75('0x2c')]['create'](_0x5696d0[_0xfb75('0x45')],{})[_0xfb75('0x24')](respondWithResult(_0x4b5f10,0xc9))['catch'](handleError(_0x4b5f10,null));};exports['update']=function(_0x35ccd5,_0x45899b){if(_0x35ccd5[_0xfb75('0x45')]['id']){delete _0x35ccd5[_0xfb75('0x45')]['id'];}return db[_0xfb75('0x2c')][_0xfb75('0x43')]({'where':{'id':_0x35ccd5[_0xfb75('0x40')]['id']}})['then'](handleEntityNotFound(_0x45899b,null))['then'](saveUpdates(_0x35ccd5[_0xfb75('0x45')],null))[_0xfb75('0x24')](respondWithResult(_0x45899b,null))[_0xfb75('0x3e')](handleError(_0x45899b,null));};exports[_0xfb75('0x46')]=function(_0x4faea1,_0x4d4067){return db[_0xfb75('0x2c')]['find']({'where':{'id':_0x4faea1[_0xfb75('0x40')]['id']}})[_0xfb75('0x24')](handleEntityNotFound(_0x4d4067,null))[_0xfb75('0x24')](removeEntity(_0x4d4067,null))[_0xfb75('0x3e')](handleError(_0x4d4067,null));}; \ No newline at end of file +var _0x533d=['create','body','find','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','params','keys'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x533d,0x16b));var _0xd533=function(_0x3bd93d,_0x49393d){_0x3bd93d=_0x3bd93d-0x0;var _0x4c8680=_0x533d[_0x3bd93d];return _0x4c8680;};'use strict';var emlformat=require(_0xd533('0x0'));var rimraf=require(_0xd533('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd533('0x2'));var moment=require(_0xd533('0x3'));var BPromise=require(_0xd533('0x4'));var Mustache=require('mustache');var util=require(_0xd533('0x5'));var path=require(_0xd533('0x6'));var sox=require(_0xd533('0x7'));var csv=require(_0xd533('0x8'));var ejs=require(_0xd533('0x9'));var fs=require('fs');var fs_extra=require(_0xd533('0xa'));var _=require(_0xd533('0xb'));var squel=require(_0xd533('0xc'));var crypto=require(_0xd533('0xd'));var jsforce=require(_0xd533('0xe'));var deskjs=require(_0xd533('0xf'));var toCsv=require(_0xd533('0x8'));var querystring=require(_0xd533('0x10'));var Papa=require(_0xd533('0x11'));var Redis=require(_0xd533('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd533('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd533('0x14'))(_0xd533('0x15'));var utils=require(_0xd533('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd533('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f6c21,_0x55b89a){_0x55b89a=_0x55b89a||0xcc;return function(_0xe9c4a8){if(_0xe9c4a8){return _0x2f6c21[_0xd533('0x18')](_0x55b89a);}return _0x2f6c21[_0xd533('0x19')](_0x55b89a)[_0xd533('0x1a')]();};}function respondWithResult(_0x402775,_0x252598){_0x252598=_0x252598||0xc8;return function(_0x3bf884){if(_0x3bf884){return _0x402775[_0xd533('0x19')](_0x252598)[_0xd533('0x1b')](_0x3bf884);}};}function respondWithFilteredResult(_0x273c65,_0x59e743){return function(_0x372eae){if(_0x372eae){var _0x513244=typeof _0x59e743[_0xd533('0x1c')]===_0xd533('0x1d')&&typeof _0x59e743[_0xd533('0x1e')]==='undefined';var _0x29c5c7=_0x372eae[_0xd533('0x1f')];var _0x5bf9d5=_0x513244?0x0:_0x59e743[_0xd533('0x1c')];var _0x2f4dae=_0x513244?_0x372eae[_0xd533('0x1f')]:_0x59e743[_0xd533('0x1c')]+_0x59e743[_0xd533('0x1e')];var _0x1aa89f;if(_0x2f4dae>=_0x29c5c7){_0x2f4dae=_0x29c5c7;_0x1aa89f=0xc8;}else{_0x1aa89f=0xce;}_0x273c65[_0xd533('0x19')](_0x1aa89f);return _0x273c65[_0xd533('0x20')](_0xd533('0x21'),_0x5bf9d5+'-'+_0x2f4dae+'/'+_0x29c5c7)[_0xd533('0x1b')](_0x372eae);}return null;};}function patchUpdates(_0x1d0e23){return function(_0x4cd6b8){try{jsonpatch['apply'](_0x4cd6b8,_0x1d0e23,!![]);}catch(_0x8de2e3){return BPromise[_0xd533('0x22')](_0x8de2e3);}return _0x4cd6b8[_0xd533('0x23')]();};}function saveUpdates(_0x44ae76,_0x59c026){return function(_0x3780d9){if(_0x3780d9){return _0x3780d9[_0xd533('0x24')](_0x44ae76)['then'](function(_0x3c8489){return _0x3c8489;});}return null;};}function removeEntity(_0x1d5c4a,_0xcff8b3){return function(_0x12c98a){if(_0x12c98a){return _0x12c98a[_0xd533('0x25')]()[_0xd533('0x26')](function(){_0x1d5c4a[_0xd533('0x19')](0xcc)[_0xd533('0x1a')]();});}};}function handleEntityNotFound(_0x34f4e7,_0x2ac2c4){return function(_0x50bd0c){if(!_0x50bd0c){_0x34f4e7[_0xd533('0x18')](0x194);}return _0x50bd0c;};}function handleError(_0x48d4a9,_0x43fd9f){_0x43fd9f=_0x43fd9f||0x1f4;return function(_0x34b2f8){logger[_0xd533('0x27')](_0x34b2f8[_0xd533('0x28')]);if(_0x34b2f8[_0xd533('0x29')]){delete _0x34b2f8['name'];}_0x48d4a9['status'](_0x43fd9f)['send'](_0x34b2f8);};}exports['index']=function(_0x3bd4a2,_0x282e03){var _0x553dcc={},_0x4d07f6={},_0x50dde3={'count':0x0,'rows':[]};var _0x5150c5=_[_0xd533('0x2a')](db[_0xd533('0x2b')][_0xd533('0x2c')],function(_0x5e198f){return{'name':_0x5e198f[_0xd533('0x2d')],'type':_0x5e198f[_0xd533('0x2e')][_0xd533('0x2f')]};});_0x4d07f6[_0xd533('0x30')]=_[_0xd533('0x2a')](_0x5150c5,_0xd533('0x29'));_0x4d07f6[_0xd533('0x31')]=_['keys'](_0x3bd4a2[_0xd533('0x31')]);_0x4d07f6[_0xd533('0x32')]=_[_0xd533('0x33')](_0x4d07f6[_0xd533('0x30')],_0x4d07f6[_0xd533('0x31')]);_0x553dcc[_0xd533('0x34')]=_[_0xd533('0x33')](_0x4d07f6[_0xd533('0x30')],qs[_0xd533('0x35')](_0x3bd4a2[_0xd533('0x31')]['fields']));_0x553dcc[_0xd533('0x34')]=_0x553dcc[_0xd533('0x34')][_0xd533('0x36')]?_0x553dcc[_0xd533('0x34')]:_0x4d07f6[_0xd533('0x30')];if(!_0x3bd4a2[_0xd533('0x31')][_0xd533('0x37')]('nolimit')){_0x553dcc[_0xd533('0x1e')]=qs[_0xd533('0x1e')](_0x3bd4a2['query'][_0xd533('0x1e')]);_0x553dcc[_0xd533('0x1c')]=qs[_0xd533('0x1c')](_0x3bd4a2[_0xd533('0x31')][_0xd533('0x1c')]);}_0x553dcc[_0xd533('0x38')]=qs[_0xd533('0x39')](_0x3bd4a2['query'][_0xd533('0x39')]);_0x553dcc[_0xd533('0x3a')]=qs[_0xd533('0x32')](_[_0xd533('0x3b')](_0x3bd4a2[_0xd533('0x31')],_0x4d07f6[_0xd533('0x32')]),_0x5150c5);if(_0x3bd4a2['query'][_0xd533('0x3c')]){_0x553dcc[_0xd533('0x3a')]=_[_0xd533('0x3d')](_0x553dcc['where'],{'$or':_['map'](_0x5150c5,function(_0x478c2a){if(_0x478c2a[_0xd533('0x2e')]!==_0xd533('0x3e')){var _0x473f34={};_0x473f34[_0x478c2a['name']]={'$like':'%'+_0x3bd4a2[_0xd533('0x31')][_0xd533('0x3c')]+'%'};return _0x473f34;}})});}_0x553dcc=_[_0xd533('0x3d')]({},_0x553dcc,_0x3bd4a2[_0xd533('0x3f')]);var _0x4372e6={'where':_0x553dcc['where']};return db[_0xd533('0x2b')][_0xd533('0x1f')](_0x4372e6)[_0xd533('0x26')](function(_0x1c806f){_0x50dde3[_0xd533('0x1f')]=_0x1c806f;if(_0x3bd4a2[_0xd533('0x31')]['includeAll']){_0x553dcc[_0xd533('0x40')]=[{'all':!![]}];}return db['SalesforceField'][_0xd533('0x41')](_0x553dcc);})[_0xd533('0x26')](function(_0x16c856){_0x50dde3['rows']=_0x16c856;return _0x50dde3;})[_0xd533('0x26')](respondWithFilteredResult(_0x282e03,_0x553dcc))[_0xd533('0x42')](handleError(_0x282e03,null));};exports['show']=function(_0x2770d7,_0x1cfa45){var _0x37e372={'raw':!![],'where':{'id':_0x2770d7[_0xd533('0x43')]['id']}},_0x45b7b0={};_0x45b7b0[_0xd533('0x30')]=_[_0xd533('0x44')](db['SalesforceField']['rawAttributes']);_0x45b7b0['query']=_[_0xd533('0x44')](_0x2770d7[_0xd533('0x31')]);_0x45b7b0[_0xd533('0x32')]=_[_0xd533('0x33')](_0x45b7b0[_0xd533('0x30')],_0x45b7b0['query']);_0x37e372[_0xd533('0x34')]=_[_0xd533('0x33')](_0x45b7b0[_0xd533('0x30')],qs[_0xd533('0x35')](_0x2770d7[_0xd533('0x31')][_0xd533('0x35')]));_0x37e372[_0xd533('0x34')]=_0x37e372[_0xd533('0x34')][_0xd533('0x36')]?_0x37e372[_0xd533('0x34')]:_0x45b7b0[_0xd533('0x30')];if(_0x2770d7[_0xd533('0x31')]['includeAll']){_0x37e372[_0xd533('0x40')]=[{'all':!![]}];}_0x37e372=_[_0xd533('0x3d')]({},_0x37e372,_0x2770d7[_0xd533('0x3f')]);return db[_0xd533('0x2b')]['find'](_0x37e372)[_0xd533('0x26')](handleEntityNotFound(_0x1cfa45,null))[_0xd533('0x26')](respondWithResult(_0x1cfa45,null))[_0xd533('0x42')](handleError(_0x1cfa45,null));};exports[_0xd533('0x45')]=function(_0x37555a,_0x51b7e7){return db[_0xd533('0x2b')]['create'](_0x37555a[_0xd533('0x46')],{})['then'](respondWithResult(_0x51b7e7,0xc9))[_0xd533('0x42')](handleError(_0x51b7e7,null));};exports['update']=function(_0x301710,_0x18489b){if(_0x301710[_0xd533('0x46')]['id']){delete _0x301710[_0xd533('0x46')]['id'];}return db[_0xd533('0x2b')]['find']({'where':{'id':_0x301710[_0xd533('0x43')]['id']}})['then'](handleEntityNotFound(_0x18489b,null))[_0xd533('0x26')](saveUpdates(_0x301710[_0xd533('0x46')],null))[_0xd533('0x26')](respondWithResult(_0x18489b,null))[_0xd533('0x42')](handleError(_0x18489b,null));};exports[_0xd533('0x25')]=function(_0x417d75,_0x25fe5e){return db['SalesforceField'][_0xd533('0x47')]({'where':{'id':_0x417d75['params']['id']}})[_0xd533('0x26')](handleEntityNotFound(_0x25fe5e,null))['then'](removeEntity(_0x25fe5e,null))[_0xd533('0x42')](handleError(_0x25fe5e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index e5090fa..1ce66b4 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 _0xa1b5=['../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','api','moment','path','rimraf'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xa1b5,0x64));var _0x5a1b=function(_0x563000,_0x1f11d9){_0x563000=_0x563000-0x0;var _0x443c98=_0xa1b5[_0x563000];return _0x443c98;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5a1b('0x0'));var moment=require(_0x5a1b('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a1b('0x2'));var rimraf=require(_0x5a1b('0x3'));var config=require(_0x5a1b('0x4'));var attributes=require(_0x5a1b('0x5'));module[_0x5a1b('0x6')]=function(_0x1fb7fa,_0x3619d2){return _0x1fb7fa[_0x5a1b('0x7')](_0x5a1b('0x8'),attributes,{'tableName':_0x5a1b('0x9'),'paranoid':![],'indexes':[{'name':_0x5a1b('0xa'),'fields':[_0x5a1b('0xb'),_0x5a1b('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa74c=['FieldId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField'];(function(_0x424663,_0xfa30f0){var _0x35b493=function(_0x3d8608){while(--_0x3d8608){_0x424663['push'](_0x424663['shift']());}};_0x35b493(++_0xfa30f0);}(_0xa74c,0x1a5));var _0xca74=function(_0x4f63f1,_0x1f9373){_0x4f63f1=_0x4f63f1-0x0;var _0x5b119d=_0xa74c[_0x4f63f1];return _0x5b119d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xca74('0x0'))(_0xca74('0x1'));var moment=require(_0xca74('0x2'));var BPromise=require(_0xca74('0x3'));var rp=require(_0xca74('0x4'));var fs=require('fs');var path=require(_0xca74('0x5'));var rimraf=require(_0xca74('0x6'));var config=require(_0xca74('0x7'));var attributes=require(_0xca74('0x8'));module[_0xca74('0x9')]=function(_0x54f049,_0x40d87f){return _0x54f049['define'](_0xca74('0xa'),attributes,{'tableName':_0xca74('0xb'),'paranoid':![],'indexes':[{'name':_0xca74('0xc'),'fields':[_0xca74('0xd'),_0xca74('0xe')],'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 41683ed..b701d9c 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 _0xfc6b=['lodash','util','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x163ff1,_0x537aea){var _0x5202a6=function(_0xf94254){while(--_0xf94254){_0x163ff1['push'](_0x163ff1['shift']());}};_0x5202a6(++_0x537aea);}(_0xfc6b,0x143));var _0xbfc6=function(_0xe54198,_0x36ca56){_0xe54198=_0xe54198-0x0;var _0x56e674=_0xfc6b[_0xe54198];return _0x56e674;};'use strict';var _=require(_0xbfc6('0x0'));var util=require(_0xbfc6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbfc6('0x2'));var fs=require('fs');var Redis=require(_0xbfc6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbfc6('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbfc6('0x5'));var jayson=require(_0xbfc6('0x6'));var client=jayson[_0xbfc6('0x7')][_0xbfc6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16c818,_0xe08805,_0x26118f){return new BPromise(function(_0x5f024d,_0x1d6bd0){return client[_0xbfc6('0x9')](_0x16c818,_0x26118f)[_0xbfc6('0xa')](function(_0x487f72){logger['info'](_0xbfc6('0xb'),_0xe08805,_0xbfc6('0xc'));logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0xe08805,_0xbfc6('0xc'),JSON[_0xbfc6('0xd')](_0x487f72));if(_0x487f72[_0xbfc6('0xe')]){if(_0x487f72[_0xbfc6('0xe')][_0xbfc6('0xf')]===0x1f4){logger['error'](_0xbfc6('0xb'),_0xe08805,_0x487f72[_0xbfc6('0xe')][_0xbfc6('0x10')]);return _0x1d6bd0(_0x487f72[_0xbfc6('0xe')][_0xbfc6('0x10')]);}logger[_0xbfc6('0xe')](_0xbfc6('0xb'),_0xe08805,_0x487f72[_0xbfc6('0xe')]['message']);return _0x5f024d(_0x487f72['error'][_0xbfc6('0x10')]);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0xe08805,_0xbfc6('0xc'));_0x5f024d(_0x487f72[_0xbfc6('0x11')][_0xbfc6('0x10')]);}})[_0xbfc6('0x12')](function(_0x3dc7e4){logger['error'](_0xbfc6('0xb'),_0xe08805,_0x3dc7e4);_0x1d6bd0(_0x3dc7e4);});});} \ No newline at end of file +var _0x97e9=['jayson/promise','client','request','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2f454b,_0x4f0132){var _0x3077ab=function(_0x4cd985){while(--_0x4cd985){_0x2f454b['push'](_0x2f454b['shift']());}};_0x3077ab(++_0x4f0132);}(_0x97e9,0xb6));var _0x997e=function(_0x56fdf8,_0x28cd52){_0x56fdf8=_0x56fdf8-0x0;var _0x2ddc41=_0x97e9[_0x56fdf8];return _0x2ddc41;};'use strict';var _=require(_0x997e('0x0'));var util=require('util');var moment=require(_0x997e('0x1'));var BPromise=require(_0x997e('0x2'));var rs=require(_0x997e('0x3'));var fs=require('fs');var Redis=require(_0x997e('0x4'));var db=require(_0x997e('0x5'))['db'];var utils=require(_0x997e('0x6'));var logger=require(_0x997e('0x7'))(_0x997e('0x8'));var config=require(_0x997e('0x9'));var jayson=require(_0x997e('0xa'));var client=jayson[_0x997e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4094ea,_0x390aff,_0x1e3854){return new BPromise(function(_0x5ee666,_0x552fd1){return client[_0x997e('0xc')](_0x4094ea,_0x1e3854)['then'](function(_0x2e253a){logger['info'](_0x997e('0xd'),_0x390aff,_0x997e('0xe'));logger[_0x997e('0xf')](_0x997e('0x10'),_0x390aff,'request\x20sent',JSON[_0x997e('0x11')](_0x2e253a));if(_0x2e253a[_0x997e('0x12')]){if(_0x2e253a['error'][_0x997e('0x13')]===0x1f4){logger[_0x997e('0x12')](_0x997e('0xd'),_0x390aff,_0x2e253a[_0x997e('0x12')][_0x997e('0x14')]);return _0x552fd1(_0x2e253a[_0x997e('0x12')][_0x997e('0x14')]);}logger[_0x997e('0x12')](_0x997e('0xd'),_0x390aff,_0x2e253a[_0x997e('0x12')][_0x997e('0x14')]);return _0x5ee666(_0x2e253a[_0x997e('0x12')][_0x997e('0x14')]);}else{logger[_0x997e('0x15')](_0x997e('0xd'),_0x390aff,_0x997e('0xe'));_0x5ee666(_0x2e253a[_0x997e('0x16')][_0x997e('0x14')]);}})[_0x997e('0x17')](function(_0x2ee6ca){logger[_0x997e('0x12')](_0x997e('0xd'),_0x390aff,_0x2ee6ca);_0x552fd1(_0x2ee6ca);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index d9d17e9..b4138ae 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 _0xf874=['create','addConfiguration','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','show','/:id/configurations','isAuthenticated','getConfigurations','getFields','post'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0xf874,0x177));var _0x4f87=function(_0x2c6902,_0x179a36){_0x2c6902=_0x2c6902-0x0;var _0x86a350=_0xf874[_0x2c6902];return _0x86a350;};'use strict';var multer=require(_0x4f87('0x0'));var util=require('util');var path=require(_0x4f87('0x1'));var timeout=require(_0x4f87('0x2'));var express=require(_0x4f87('0x3'));var router=express[_0x4f87('0x4')]();var fs_extra=require(_0x4f87('0x5'));var auth=require(_0x4f87('0x6'));var interaction=require(_0x4f87('0x7'));var config=require('../../config/environment');var controller=require(_0x4f87('0x8'));router[_0x4f87('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4f87('0xa')]);router['get'](_0x4f87('0xb'),auth[_0x4f87('0xc')](),controller[_0x4f87('0xd')]);router[_0x4f87('0x9')]('/:id/fields',auth[_0x4f87('0xc')](),controller[_0x4f87('0xe')]);router[_0x4f87('0xf')]('/',auth[_0x4f87('0xc')](),controller[_0x4f87('0x10')]);router[_0x4f87('0xf')](_0x4f87('0xb'),auth[_0x4f87('0xc')](),controller[_0x4f87('0x11')]);router[_0x4f87('0x12')](_0x4f87('0x13'),auth['isAuthenticated'](),controller[_0x4f87('0x14')]);router[_0x4f87('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x4f87('0x16')]);module['exports']=router; \ No newline at end of file +var _0xbaa8=['create','addConfiguration','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','index','isAuthenticated','show','/:id/configurations','/:id/fields'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xbaa8,0x1d2));var _0x8baa=function(_0x5ca2f7,_0x483543){_0x5ca2f7=_0x5ca2f7-0x0;var _0x4a993d=_0xbaa8[_0x5ca2f7];return _0x4a993d;};'use strict';var multer=require(_0x8baa('0x0'));var util=require(_0x8baa('0x1'));var path=require(_0x8baa('0x2'));var timeout=require(_0x8baa('0x3'));var express=require(_0x8baa('0x4'));var router=express[_0x8baa('0x5')]();var fs_extra=require(_0x8baa('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8baa('0x7'));var controller=require('./intServicenowAccount.controller');router[_0x8baa('0x8')]('/',auth['isAuthenticated'](),controller[_0x8baa('0x9')]);router['get']('/:id',auth[_0x8baa('0xa')](),controller[_0x8baa('0xb')]);router[_0x8baa('0x8')](_0x8baa('0xc'),auth[_0x8baa('0xa')](),controller['getConfigurations']);router[_0x8baa('0x8')](_0x8baa('0xd'),auth[_0x8baa('0xa')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x8baa('0xe')]);router['post'](_0x8baa('0xc'),auth[_0x8baa('0xa')](),controller[_0x8baa('0xf')]);router['put'](_0x8baa('0x10'),auth[_0x8baa('0xa')](),controller[_0x8baa('0x11')]);router[_0x8baa('0x12')](_0x8baa('0x10'),auth[_0x8baa('0xa')](),controller['destroy']);module[_0x8baa('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 473b43e..67a849f 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 _0xb12d=['STRING','username'];(function(_0x4e2c5d,_0x1374b3){var _0x37111b=function(_0x32f8b8){while(--_0x32f8b8){_0x4e2c5d['push'](_0x4e2c5d['shift']());}};_0x37111b(++_0x1374b3);}(_0xb12d,0xfe));var _0xdb12=function(_0x2d9e27,_0x5965b2){_0x2d9e27=_0x2d9e27-0x0;var _0xd35381=_0xb12d[_0x2d9e27];return _0xd35381;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdb12('0x0')]},'description':{'type':Sequelize[_0xdb12('0x0')]},'username':{'type':Sequelize[_0xdb12('0x0')],'unique':_0xdb12('0x1')},'password':{'type':Sequelize[_0xdb12('0x0')]},'email':{'type':Sequelize[_0xdb12('0x0')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xdb12('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0xaafc=['username','sequelize','exports','STRING'];(function(_0x4529a7,_0x33f6eb){var _0x434db1=function(_0x1dc944){while(--_0x1dc944){_0x4529a7['push'](_0x4529a7['shift']());}};_0x434db1(++_0x33f6eb);}(_0xaafc,0xe1));var _0xcaaf=function(_0x15dd77,_0x1fdec5){_0x15dd77=_0x15dd77-0x0;var _0x159400=_0xaafc[_0x15dd77];return _0x159400;};'use strict';var Sequelize=require(_0xcaaf('0x0'));module[_0xcaaf('0x1')]={'name':{'type':Sequelize[_0xcaaf('0x2')]},'description':{'type':Sequelize[_0xcaaf('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xcaaf('0x3')},'password':{'type':Sequelize[_0xcaaf('0x2')]},'email':{'type':Sequelize[_0xcaaf('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xcaaf('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 42ec952..95c0704 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 _0xfdf8=['work_end','reopened_time','caller_id','approval_set','correlation_display','delivery_task','business_stc','additional_assignee_list','description','notify','sys_class_name','close_notes','sys_id','reopened_by','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','username','result','log','incident\x20table\x20objects','remove','includes','forEach','internalType','label','push','all','assign','TCL:\x20_object','concat','ServiceNow\x20error:\x20','test','statusCode','stack','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','include','findAll','rows','catch','params','keys','fields','includeAll','options','create','body','find','getConfigurations','findOne','ServicenowConfiguration','pick','merge','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','hold_reason','knowledge','subcategory','close_code','incident_state','severity','category','parent','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','number','sys_updated_by','opened_by','user_input','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration'];(function(_0xd7e3b0,_0xbb2724){var _0x22f670=function(_0x13c689){while(--_0x13c689){_0xd7e3b0['push'](_0xd7e3b0['shift']());}};_0x22f670(++_0xbb2724);}(_0xfdf8,0xf7));var _0x8fdf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfdf8[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8fdf('0x0'));var zipdir=require(_0x8fdf('0x1'));var jsonpatch=require(_0x8fdf('0x2'));var rp=require(_0x8fdf('0x3'));var moment=require('moment');var BPromise=require(_0x8fdf('0x4'));var Mustache=require(_0x8fdf('0x5'));var util=require('util');var path=require(_0x8fdf('0x6'));var sox=require(_0x8fdf('0x7'));var csv=require(_0x8fdf('0x8'));var ejs=require(_0x8fdf('0x9'));var fs=require('fs');var fs_extra=require(_0x8fdf('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8fdf('0xb'));var jsforce=require(_0x8fdf('0xc'));var deskjs=require(_0x8fdf('0xd'));var toCsv=require(_0x8fdf('0x8'));var querystring=require(_0x8fdf('0xe'));var Papa=require(_0x8fdf('0xf'));var Redis=require(_0x8fdf('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8fdf('0x11'));var logger=require('../../config/logger')(_0x8fdf('0x12'));var utils=require(_0x8fdf('0x13'));var config=require(_0x8fdf('0x14'));var licenseUtil=require(_0x8fdf('0x15'));var db=require(_0x8fdf('0x16'))['db'];var integrations=require(_0x8fdf('0x17'));function respondWithStatusCode(_0x582e5b,_0x145438){_0x145438=_0x145438||0xcc;return function(_0x1ab631){if(_0x1ab631){return _0x582e5b['sendStatus'](_0x145438);}return _0x582e5b['status'](_0x145438)['end']();};}function respondWithResult(_0x59f682,_0x13c812){_0x13c812=_0x13c812||0xc8;return function(_0x1f5f56){if(_0x1f5f56){return _0x59f682['status'](_0x13c812)[_0x8fdf('0x18')](_0x1f5f56);}};}function respondWithFilteredResult(_0x49548f,_0x360d5b){return function(_0x3168d7){if(_0x3168d7){var _0x27f6bb=typeof _0x360d5b[_0x8fdf('0x19')]===_0x8fdf('0x1a')&&typeof _0x360d5b[_0x8fdf('0x1b')]===_0x8fdf('0x1a');var _0x1ae15d=_0x3168d7[_0x8fdf('0x1c')];var _0x268410=_0x27f6bb?0x0:_0x360d5b[_0x8fdf('0x19')];var _0x2fbef3=_0x27f6bb?_0x3168d7['count']:_0x360d5b[_0x8fdf('0x19')]+_0x360d5b[_0x8fdf('0x1b')];var _0x57d581;if(_0x2fbef3>=_0x1ae15d){_0x2fbef3=_0x1ae15d;_0x57d581=0xc8;}else{_0x57d581=0xce;}_0x49548f[_0x8fdf('0x1d')](_0x57d581);return _0x49548f[_0x8fdf('0x1e')](_0x8fdf('0x1f'),_0x268410+'-'+_0x2fbef3+'/'+_0x1ae15d)['json'](_0x3168d7);}return null;};}function patchUpdates(_0x253742){return function(_0x15e75d){try{jsonpatch[_0x8fdf('0x20')](_0x15e75d,_0x253742,!![]);}catch(_0x4fb38e){return BPromise[_0x8fdf('0x21')](_0x4fb38e);}return _0x15e75d[_0x8fdf('0x22')]();};}function saveUpdates(_0x53a835,_0x58558d){return function(_0x495ba6){if(_0x495ba6){return _0x495ba6[_0x8fdf('0x23')](_0x53a835)[_0x8fdf('0x24')](function(_0x509efc){return _0x509efc;});}return null;};}function removeEntity(_0x5464e6,_0x542ade){return function(_0x3ef6bf){if(_0x3ef6bf){return _0x3ef6bf[_0x8fdf('0x25')]()[_0x8fdf('0x24')](function(){_0x5464e6[_0x8fdf('0x1d')](0xcc)[_0x8fdf('0x26')]();});}};}function handleEntityNotFound(_0x14a491,_0x31825b){return function(_0x20a99a){if(!_0x20a99a){_0x14a491[_0x8fdf('0x27')](0x194);}return _0x20a99a;};}function handleError(_0x2092c1,_0x2762e4){_0x2762e4=_0x2762e4||0x1f4;return function(_0x5d0c5a){logger[_0x8fdf('0x28')](_0x5d0c5a['stack']);if(_0x5d0c5a[_0x8fdf('0x29')]){delete _0x5d0c5a[_0x8fdf('0x29')];}_0x2092c1[_0x8fdf('0x1d')](_0x2762e4)[_0x8fdf('0x2a')](_0x5d0c5a);};}exports['index']=function(_0x185434,_0x54d8af){var _0xead708={},_0x1a94ec={},_0x4403b0={'count':0x0,'rows':[]};var _0x531b23=_[_0x8fdf('0x2b')](db[_0x8fdf('0x2c')][_0x8fdf('0x2d')],function(_0x48ef2d){return{'name':_0x48ef2d[_0x8fdf('0x2e')],'type':_0x48ef2d[_0x8fdf('0x2f')][_0x8fdf('0x30')]};});_0x1a94ec[_0x8fdf('0x31')]=_[_0x8fdf('0x2b')](_0x531b23,'name');_0x1a94ec['query']=_['keys'](_0x185434[_0x8fdf('0x32')]);_0x1a94ec[_0x8fdf('0x33')]=_[_0x8fdf('0x34')](_0x1a94ec[_0x8fdf('0x31')],_0x1a94ec[_0x8fdf('0x32')]);_0xead708[_0x8fdf('0x35')]=_[_0x8fdf('0x34')](_0x1a94ec[_0x8fdf('0x31')],qs['fields'](_0x185434['query']['fields']));_0xead708['attributes']=_0xead708[_0x8fdf('0x35')][_0x8fdf('0x36')]?_0xead708[_0x8fdf('0x35')]:_0x1a94ec['model'];if(!_0x185434[_0x8fdf('0x32')][_0x8fdf('0x37')]('nolimit')){_0xead708['limit']=qs[_0x8fdf('0x1b')](_0x185434[_0x8fdf('0x32')][_0x8fdf('0x1b')]);_0xead708[_0x8fdf('0x19')]=qs[_0x8fdf('0x19')](_0x185434[_0x8fdf('0x32')][_0x8fdf('0x19')]);}_0xead708[_0x8fdf('0x38')]=qs[_0x8fdf('0x39')](_0x185434[_0x8fdf('0x32')][_0x8fdf('0x39')]);_0xead708[_0x8fdf('0x3a')]=qs[_0x8fdf('0x33')](_['pick'](_0x185434[_0x8fdf('0x32')],_0x1a94ec[_0x8fdf('0x33')]),_0x531b23);if(_0x185434[_0x8fdf('0x32')][_0x8fdf('0x3b')]){_0xead708[_0x8fdf('0x3a')]=_['merge'](_0xead708['where'],{'$or':_['map'](_0x531b23,function(_0x257c35){if(_0x257c35[_0x8fdf('0x2f')]!==_0x8fdf('0x3c')){var _0x86fd95={};_0x86fd95[_0x257c35['name']]={'$like':'%'+_0x185434[_0x8fdf('0x32')][_0x8fdf('0x3b')]+'%'};return _0x86fd95;}})});}_0xead708=_['merge']({},_0xead708,_0x185434['options']);var _0x208a12={'where':_0xead708['where']};return db[_0x8fdf('0x2c')]['count'](_0x208a12)[_0x8fdf('0x24')](function(_0x42a4fc){_0x4403b0[_0x8fdf('0x1c')]=_0x42a4fc;if(_0x185434[_0x8fdf('0x32')]['includeAll']){_0xead708[_0x8fdf('0x3d')]=[{'all':!![]}];}return db[_0x8fdf('0x2c')][_0x8fdf('0x3e')](_0xead708);})[_0x8fdf('0x24')](function(_0x1841b9){_0x4403b0[_0x8fdf('0x3f')]=_0x1841b9;return _0x4403b0;})[_0x8fdf('0x24')](respondWithFilteredResult(_0x54d8af,_0xead708))[_0x8fdf('0x40')](handleError(_0x54d8af,null));};exports['show']=function(_0x1555d1,_0x5bc3df){var _0x5f1983={'raw':![],'where':{'id':_0x1555d1[_0x8fdf('0x41')]['id']}},_0x1738b1={};_0x1738b1['model']=_[_0x8fdf('0x42')](db[_0x8fdf('0x2c')][_0x8fdf('0x2d')]);_0x1738b1[_0x8fdf('0x32')]=_['keys'](_0x1555d1[_0x8fdf('0x32')]);_0x1738b1[_0x8fdf('0x33')]=_['intersection'](_0x1738b1[_0x8fdf('0x31')],_0x1738b1[_0x8fdf('0x32')]);_0x5f1983[_0x8fdf('0x35')]=_[_0x8fdf('0x34')](_0x1738b1[_0x8fdf('0x31')],qs['fields'](_0x1555d1[_0x8fdf('0x32')][_0x8fdf('0x43')]));_0x5f1983[_0x8fdf('0x35')]=_0x5f1983[_0x8fdf('0x35')][_0x8fdf('0x36')]?_0x5f1983[_0x8fdf('0x35')]:_0x1738b1[_0x8fdf('0x31')];if(_0x1555d1[_0x8fdf('0x32')][_0x8fdf('0x44')]){_0x5f1983[_0x8fdf('0x3d')]=[{'all':!![]}];}_0x5f1983=_['merge']({},_0x5f1983,_0x1555d1[_0x8fdf('0x45')]);return db[_0x8fdf('0x2c')]['find'](_0x5f1983)[_0x8fdf('0x24')](handleEntityNotFound(_0x5bc3df,null))['then'](respondWithResult(_0x5bc3df,null))['catch'](handleError(_0x5bc3df,null));};exports[_0x8fdf('0x46')]=function(_0x1b49fe,_0x45f748){return db[_0x8fdf('0x2c')][_0x8fdf('0x46')](_0x1b49fe[_0x8fdf('0x47')],{})[_0x8fdf('0x24')](respondWithResult(_0x45f748,0xc9))[_0x8fdf('0x40')](handleError(_0x45f748,null));};exports[_0x8fdf('0x23')]=function(_0x10d2d3,_0x45fabe){if(_0x10d2d3[_0x8fdf('0x47')]['id']){delete _0x10d2d3['body']['id'];}return db[_0x8fdf('0x2c')]['find']({'where':{'id':_0x10d2d3[_0x8fdf('0x41')]['id']}})[_0x8fdf('0x24')](handleEntityNotFound(_0x45fabe,null))[_0x8fdf('0x24')](saveUpdates(_0x10d2d3[_0x8fdf('0x47')],null))['then'](respondWithResult(_0x45fabe,null))[_0x8fdf('0x40')](handleError(_0x45fabe,null));};exports[_0x8fdf('0x25')]=function(_0x11b120,_0x56baa6){return db[_0x8fdf('0x2c')][_0x8fdf('0x48')]({'where':{'id':_0x11b120['params']['id']}})['then'](handleEntityNotFound(_0x56baa6,null))[_0x8fdf('0x24')](removeEntity(_0x56baa6,null))[_0x8fdf('0x40')](handleError(_0x56baa6,null));};exports[_0x8fdf('0x49')]=function(_0x755258,_0xc008e3,_0x2de8ba){var _0x5ce2eb={};var _0x439922={};var _0x3c07da;var _0x31e258;return db[_0x8fdf('0x2c')][_0x8fdf('0x4a')]({'where':{'id':_0x755258['params']['id']}})[_0x8fdf('0x24')](handleEntityNotFound(_0xc008e3,null))['then'](function(_0x577b5c){if(_0x577b5c){_0x3c07da=_0x577b5c;_0x439922['model']=_[_0x8fdf('0x42')](db[_0x8fdf('0x4b')][_0x8fdf('0x2d')]);_0x439922['query']=_[_0x8fdf('0x42')](_0x755258[_0x8fdf('0x32')]);_0x439922['filters']=_['intersection'](_0x439922[_0x8fdf('0x31')],_0x439922[_0x8fdf('0x32')]);_0x5ce2eb[_0x8fdf('0x35')]=_[_0x8fdf('0x34')](_0x439922['model'],qs[_0x8fdf('0x43')](_0x755258[_0x8fdf('0x32')]['fields']));_0x5ce2eb[_0x8fdf('0x35')]=_0x5ce2eb[_0x8fdf('0x35')][_0x8fdf('0x36')]?_0x5ce2eb[_0x8fdf('0x35')]:_0x439922['model'];_0x5ce2eb[_0x8fdf('0x38')]=qs[_0x8fdf('0x39')](_0x755258[_0x8fdf('0x32')][_0x8fdf('0x39')]);_0x5ce2eb[_0x8fdf('0x3a')]=qs['filters'](_[_0x8fdf('0x4c')](_0x755258['query'],_0x439922[_0x8fdf('0x33')]));if(_0x755258[_0x8fdf('0x32')][_0x8fdf('0x3b')]){_0x5ce2eb[_0x8fdf('0x3a')]=_['merge'](_0x5ce2eb['where'],{'$or':_[_0x8fdf('0x2b')](_0x5ce2eb[_0x8fdf('0x35')],function(_0x29a548){var _0x23addc={};_0x23addc[_0x29a548]={'$like':'%'+_0x755258[_0x8fdf('0x32')][_0x8fdf('0x3b')]+'%'};return _0x23addc;})});}_0x5ce2eb=_[_0x8fdf('0x4d')]({},_0x5ce2eb,_0x755258['options']);return _0x3c07da[_0x8fdf('0x49')](_0x5ce2eb);}})[_0x8fdf('0x24')](function(_0x798dd1){if(_0x798dd1){_0x31e258=_0x798dd1[_0x8fdf('0x36')];if(!_0x755258[_0x8fdf('0x32')]['hasOwnProperty'](_0x8fdf('0x4e'))){_0x5ce2eb[_0x8fdf('0x1b')]=qs[_0x8fdf('0x1b')](_0x755258[_0x8fdf('0x32')][_0x8fdf('0x1b')]);_0x5ce2eb['offset']=qs[_0x8fdf('0x19')](_0x755258[_0x8fdf('0x32')][_0x8fdf('0x19')]);}return _0x3c07da[_0x8fdf('0x49')](_0x5ce2eb);}})['then'](function(_0x3635a7){if(_0x3635a7){return _0x3635a7?{'count':_0x31e258,'rows':_0x3635a7}:null;}})['then'](respondWithResult(_0xc008e3,null))['catch'](handleError(_0xc008e3,null));};exports[_0x8fdf('0x4f')]=function(_0x5e4183,_0x19262d,_0x2c1f40){if(_0x5e4183['body']['id']){delete _0x5e4183[_0x8fdf('0x47')]['id'];}return db[_0x8fdf('0x2c')][_0x8fdf('0x4a')]({'where':{'id':_0x5e4183[_0x8fdf('0x41')]['id']}})[_0x8fdf('0x24')](handleEntityNotFound(_0x19262d,null))['then'](function(_0x5afa32){if(_0x5afa32){_0x5e4183[_0x8fdf('0x47')]['AccountId']=_0x5afa32['id'];_0x5e4183[_0x8fdf('0x47')][_0x8fdf('0x50')]=integrations[_0x8fdf('0x51')](_0x5e4183[_0x8fdf('0x47')][_0x8fdf('0x52')],_0x5e4183[_0x8fdf('0x47')][_0x8fdf('0x2f')]);_0x5e4183[_0x8fdf('0x47')][_0x8fdf('0x53')]=integrations[_0x8fdf('0x54')](_0x5e4183[_0x8fdf('0x47')][_0x8fdf('0x52')],_0x5e4183[_0x8fdf('0x47')][_0x8fdf('0x2f')]);return db['ServicenowConfiguration'][_0x8fdf('0x46')](_0x5e4183[_0x8fdf('0x47')],{'include':[{'model':db[_0x8fdf('0x55')],'as':'Subjects'},{'model':db[_0x8fdf('0x55')],'as':_0x8fdf('0x53')}]});}return null;})['then'](respondWithResult(_0x19262d,null))[_0x8fdf('0x40')](handleError(_0x19262d,null));};exports[_0x8fdf('0x56')]=function(_0x2fcb40,_0x5e4c2d,_0x2b7f0a){var _0x484a2e=['made_sla',_0x8fdf('0x57'),_0x8fdf('0x58'),_0x8fdf('0x59'),_0x8fdf('0x5a'),'notify',_0x8fdf('0x5b'),_0x8fdf('0x5c'),_0x8fdf('0x5d')];var _0x1c5f0e=[_0x8fdf('0x5e'),_0x8fdf('0x5f'),_0x8fdf('0x60'),_0x8fdf('0x61'),_0x8fdf('0x62'),_0x8fdf('0x63'),_0x8fdf('0x64'),_0x8fdf('0x57'),'approval_history',_0x8fdf('0x65'),'resolved_by',_0x8fdf('0x66'),_0x8fdf('0x67'),_0x8fdf('0x68'),'sys_created_on','sys_domain',_0x8fdf('0x69'),_0x8fdf('0x6a'),_0x8fdf('0x58'),_0x8fdf('0x38'),_0x8fdf('0x6b'),_0x8fdf('0x6c'),_0x8fdf('0x6d'),_0x8fdf('0x6e'),_0x8fdf('0x6f'),_0x8fdf('0x70'),_0x8fdf('0x71'),_0x8fdf('0x72'),_0x8fdf('0x73'),_0x8fdf('0x74'),'rfc',_0x8fdf('0x75'),_0x8fdf('0x76'),_0x8fdf('0x77'),_0x8fdf('0x78'),'group_list',_0x8fdf('0x79'),_0x8fdf('0x7a'),'resolved_at',_0x8fdf('0x7b'),_0x8fdf('0x7c'),_0x8fdf('0x59'),'work_notes','short_description',_0x8fdf('0x5a'),_0x8fdf('0x7d'),_0x8fdf('0x7e'),'work_start','assignment_group',_0x8fdf('0x7f'),_0x8fdf('0x80'),_0x8fdf('0x81'),'calendar_duration',_0x8fdf('0x82'),_0x8fdf('0x83'),_0x8fdf('0x84'),'closed_by','follow_up','parent_incident',_0x8fdf('0x85'),'contact_type',_0x8fdf('0x86'),_0x8fdf('0x5b'),'urgency',_0x8fdf('0x87'),_0x8fdf('0x88'),_0x8fdf('0x89'),_0x8fdf('0x8a'),_0x8fdf('0x8b'),_0x8fdf('0x5c'),'comments',_0x8fdf('0x8c'),'approval','comments_and_work_notes',_0x8fdf('0x8d'),_0x8fdf('0x8e'),_0x8fdf('0x8f'),_0x8fdf('0x90'),_0x8fdf('0x91'),'upon_approval',_0x8fdf('0x92'),_0x8fdf('0x93'),_0x8fdf('0x5d')];var _0x197b1f='';var _0x11e824='';var _0x3de436=[];var _0xe65e9f='';var _0x35739b='';var _0x1690dd=[];var _0x9aebb0='';var _0x3a115b='';var _0xdea6cc={};var _0x3dbe40='';return db[_0x8fdf('0x2c')][_0x8fdf('0x4a')]({'where':{'id':_0x2fcb40[_0x8fdf('0x41')]['id']},'attributes':['id','username',_0x8fdf('0x94'),_0x8fdf('0x95'),_0x8fdf('0x96'),_0x8fdf('0x97')]})[_0x8fdf('0x24')](handleEntityNotFound(_0x5e4c2d,null))[_0x8fdf('0x24')](function(_0x19c4e1){if(_0x19c4e1){_0x3dbe40=_0x19c4e1[_0x8fdf('0x96')];var _0x2ba330=_0x3dbe40[_0x8fdf('0x98')](-0x1);if(_0x2ba330==='/'){_0x3dbe40=_0x3dbe40[_0x8fdf('0x99')](0x0,_0x3dbe40[_0x8fdf('0x9a')](_0x2ba330));}_0x3a115b=util[_0x8fdf('0x9b')]('%s/api/now/doc/table/schema/',_0x3dbe40);_0x9aebb0=util[_0x8fdf('0x9b')](_0x8fdf('0x9c'),_0x3dbe40);_0xdea6cc={'user':_0x19c4e1[_0x8fdf('0x9d')],'pass':_0x19c4e1['password']};var _0x53eb3e={'method':'GET','uri':_0x3a115b+'incident?sysparm_display_value=all','auth':_0xdea6cc,'json':!![]};return rp(_0x53eb3e);}})['then'](function(_0x26032e){if(_0x26032e[_0x8fdf('0x9e')][_0x8fdf('0x36')]>0x0){_0x197b1f=_0x26032e[_0x8fdf('0x9e')];}console[_0x8fdf('0x9f')](_0x8fdf('0xa0'),_0x197b1f);_0x1690dd=[];_0x11e824=Object['assign']([],_0x197b1f);_[_0x8fdf('0xa1')](_0x11e824,function(_0x474b2c){return!_0x484a2e[_0x8fdf('0xa2')](_0x474b2c[_0x8fdf('0x29')]);});_0x11e824[_0x8fdf('0xa3')](function(_0x3655cf){var _0x1733ee=createFieldObject(_0x9aebb0,_0xdea6cc,_0x3655cf[_0x8fdf('0xa4')],_0x3655cf[_0x8fdf('0x29')],_0x3655cf[_0x8fdf('0xa5')],![]);_0x1690dd[_0x8fdf('0xa6')](_0x1733ee);});return Promise[_0x8fdf('0xa7')](_0x1690dd);})[_0x8fdf('0x24')](function(_0x3bdc39){_0x3de436=_0x3bdc39;_0xe65e9f=Object[_0x8fdf('0xa8')]([],_0x197b1f);console[_0x8fdf('0x9f')](_0x8fdf('0xa9'),_0x197b1f);_[_0x8fdf('0xa1')](_0xe65e9f,function(_0x312342){return _0x1c5f0e['includes'](_0x312342[_0x8fdf('0x29')]);});console[_0x8fdf('0x9f')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0xe65e9f);_0x1690dd=[];_0xe65e9f[_0x8fdf('0xa3')](function(_0x30d7aa){var _0x1209f0=createFieldObject(_0x9aebb0,_0xdea6cc,_0x30d7aa[_0x8fdf('0xa4')],_0x30d7aa[_0x8fdf('0x29')],_0x30d7aa[_0x8fdf('0xa5')],!![]);_0x1690dd[_0x8fdf('0xa6')](_0x1209f0);});return Promise['all'](_0x1690dd);})['then'](function(_0x4e3d8b){_0x35739b=_0x4e3d8b;var _0x32a49d=_0x3de436[_0x8fdf('0xaa')](_0x35739b);return{'count':_0x32a49d[_0x8fdf('0x36')],'rows':_0x32a49d};})[_0x8fdf('0x24')](respondWithResult(_0x5e4c2d,null))['catch'](function(_0xb68c3a){console['log'](_0x8fdf('0xab')+_0xb68c3a);var _0x5e7dc6=_0x2fcb40[_0x8fdf('0x32')][_0x8fdf('0xac')]?0x1f4:_0xb68c3a[_0x8fdf('0xad')]||0x1f4;logger['error'](_0xb68c3a[_0x8fdf('0xae')]);delete _0xb68c3a[_0x8fdf('0x29')];if(_0x5e7dc6===0x191){_0x5e7dc6=0x190;}_0x5e4c2d[_0x8fdf('0x1d')](_0x5e7dc6)[_0x8fdf('0x2a')](_0x2fcb40[_0x8fdf('0x32')][_0x8fdf('0xac')]?{'message':_0x8fdf('0xaf'),'statusCode':_0xb68c3a[_0x8fdf('0xad')]}:_0xb68c3a);});};function createFieldObject(_0x9d6a2e,_0x344f74,_0x254a7d,_0x3d1551,_0xc25259,_0x1508de){return new Promise(function(_0x35ff71,_0x4acd63){var _0x40ab03={'id':_0x3d1551,'name':_0xc25259,'custom':_0x1508de};if(_0x254a7d===_0x8fdf('0xb0')){_0x40ab03['options']=[{'name':_0x8fdf('0xb1'),'value':_0x8fdf('0xb2')},{'name':_0x8fdf('0xb3'),'value':_0x8fdf('0xb4')}];_0x35ff71(_0x40ab03);}else{var _0x219b17={'method':'GET','uri':_0x9d6a2e+_0x8fdf('0xb5')+_0x3d1551,'auth':_0x344f74,'json':!![]};return rp(_0x219b17)[_0x8fdf('0x24')](function(_0x1bdb6c){var _0x1f68c0=[];if(_0x1bdb6c[_0x8fdf('0x9e')][_0x8fdf('0x36')]>0x0){_0x1bdb6c[_0x8fdf('0x9e')][_0x8fdf('0xa3')](function(_0x17d769){if(_0x17d769[_0x8fdf('0xb6')]===_0x8fdf('0xb4')){var _0x8bbc5d={'name':_0x17d769[_0x8fdf('0xa5')],'value':_0x17d769[_0x8fdf('0xb7')]};_0x1f68c0['push'](_0x8bbc5d);}});}_0x40ab03[_0x8fdf('0x45')]=_0x1f68c0;if(_0x40ab03[_0x8fdf('0x45')][_0x8fdf('0x36')]>0x0){_0x35ff71(_0x40ab03);}else{if(_0x1508de==![]){_0x35ff71();}else{_0x35ff71(_0x40ab03);}}});}});} \ No newline at end of file +var _0xd0bb=['boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','false','value','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','offset','set','reject','save','update','then','destroy','stack','name','send','index','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','order','pick','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','notify','incident_state','severity','category','parent','caused_by','upon_reject','sys_updated_on','opened_by','user_input','sys_created_on','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','priority','time_worked','expected_start','opened_at','business_duration','group_list','work_end','resolved_at','caller_id','work_notes','short_description','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','follow_up','contact_type','urgency','reassignment_count','activity_due','assigned_to','comments','approval','reopen_count','upon_approval','correlation_id','location','username','password','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','forEach','push','all','TCL:\x20_object','remove','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','label','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode'];(function(_0x3bfc65,_0x2fd28c){var _0x4b5626=function(_0x5e007c){while(--_0x5e007c){_0x3bfc65['push'](_0x3bfc65['shift']());}};_0x4b5626(++_0x2fd28c);}(_0xd0bb,0xb8));var _0xbd0b=function(_0x5a3f3a,_0x3ae10e){_0x5a3f3a=_0x5a3f3a-0x0;var _0x5a6216=_0xd0bb[_0x5a3f3a];return _0x5a6216;};'use strict';var emlformat=require(_0xbd0b('0x0'));var rimraf=require(_0xbd0b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd0b('0x2'));var rp=require(_0xbd0b('0x3'));var moment=require(_0xbd0b('0x4'));var BPromise=require(_0xbd0b('0x5'));var Mustache=require(_0xbd0b('0x6'));var util=require(_0xbd0b('0x7'));var path=require(_0xbd0b('0x8'));var sox=require(_0xbd0b('0x9'));var csv=require(_0xbd0b('0xa'));var ejs=require(_0xbd0b('0xb'));var fs=require('fs');var fs_extra=require(_0xbd0b('0xc'));var _=require(_0xbd0b('0xd'));var squel=require('squel');var crypto=require(_0xbd0b('0xe'));var jsforce=require(_0xbd0b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbd0b('0xa'));var querystring=require(_0xbd0b('0x10'));var Papa=require(_0xbd0b('0x11'));var Redis=require('ioredis');var authService=require(_0xbd0b('0x12'));var qs=require(_0xbd0b('0x13'));var as=require(_0xbd0b('0x14'));var hardwareService=require(_0xbd0b('0x15'));var logger=require('../../config/logger')(_0xbd0b('0x16'));var utils=require('../../config/utils');var config=require(_0xbd0b('0x17'));var licenseUtil=require(_0xbd0b('0x18'));var db=require(_0xbd0b('0x19'))['db'];var integrations=require(_0xbd0b('0x1a'));function respondWithStatusCode(_0x593f56,_0xa05bf){_0xa05bf=_0xa05bf||0xcc;return function(_0x16b9a0){if(_0x16b9a0){return _0x593f56[_0xbd0b('0x1b')](_0xa05bf);}return _0x593f56[_0xbd0b('0x1c')](_0xa05bf)[_0xbd0b('0x1d')]();};}function respondWithResult(_0x13cdae,_0x1833b4){_0x1833b4=_0x1833b4||0xc8;return function(_0x5c2a39){if(_0x5c2a39){return _0x13cdae['status'](_0x1833b4)['json'](_0x5c2a39);}};}function respondWithFilteredResult(_0x3b5689,_0x14c9a6){return function(_0x10b5ca){if(_0x10b5ca){var _0x49284a=typeof _0x14c9a6['offset']===_0xbd0b('0x1e')&&typeof _0x14c9a6[_0xbd0b('0x1f')]===_0xbd0b('0x1e');var _0x4e6c9f=_0x10b5ca[_0xbd0b('0x20')];var _0x47d8b4=_0x49284a?0x0:_0x14c9a6[_0xbd0b('0x21')];var _0x55c7ed=_0x49284a?_0x10b5ca[_0xbd0b('0x20')]:_0x14c9a6[_0xbd0b('0x21')]+_0x14c9a6[_0xbd0b('0x1f')];var _0x46c5e9;if(_0x55c7ed>=_0x4e6c9f){_0x55c7ed=_0x4e6c9f;_0x46c5e9=0xc8;}else{_0x46c5e9=0xce;}_0x3b5689[_0xbd0b('0x1c')](_0x46c5e9);return _0x3b5689[_0xbd0b('0x22')]('Content-Range',_0x47d8b4+'-'+_0x55c7ed+'/'+_0x4e6c9f)['json'](_0x10b5ca);}return null;};}function patchUpdates(_0x2d696f){return function(_0xd682dd){try{jsonpatch['apply'](_0xd682dd,_0x2d696f,!![]);}catch(_0x2255da){return BPromise[_0xbd0b('0x23')](_0x2255da);}return _0xd682dd[_0xbd0b('0x24')]();};}function saveUpdates(_0x28a492,_0x2a9eb1){return function(_0x45cbde){if(_0x45cbde){return _0x45cbde[_0xbd0b('0x25')](_0x28a492)[_0xbd0b('0x26')](function(_0x462970){return _0x462970;});}return null;};}function removeEntity(_0x297427,_0x4cd43b){return function(_0x48c41c){if(_0x48c41c){return _0x48c41c[_0xbd0b('0x27')]()[_0xbd0b('0x26')](function(){_0x297427[_0xbd0b('0x1c')](0xcc)[_0xbd0b('0x1d')]();});}};}function handleEntityNotFound(_0x5193ab,_0x3f0107){return function(_0x1c955f){if(!_0x1c955f){_0x5193ab[_0xbd0b('0x1b')](0x194);}return _0x1c955f;};}function handleError(_0x174919,_0x147b07){_0x147b07=_0x147b07||0x1f4;return function(_0x2ee4d1){logger['error'](_0x2ee4d1[_0xbd0b('0x28')]);if(_0x2ee4d1[_0xbd0b('0x29')]){delete _0x2ee4d1[_0xbd0b('0x29')];}_0x174919[_0xbd0b('0x1c')](_0x147b07)[_0xbd0b('0x2a')](_0x2ee4d1);};}exports[_0xbd0b('0x2b')]=function(_0x3ca502,_0x9e33d2){var _0x215478={},_0x3040e8={},_0x2985a0={'count':0x0,'rows':[]};var _0x2a76da=_['map'](db[_0xbd0b('0x2c')][_0xbd0b('0x2d')],function(_0x5c0dcc){return{'name':_0x5c0dcc[_0xbd0b('0x2e')],'type':_0x5c0dcc[_0xbd0b('0x2f')][_0xbd0b('0x30')]};});_0x3040e8[_0xbd0b('0x31')]=_['map'](_0x2a76da,'name');_0x3040e8[_0xbd0b('0x32')]=_[_0xbd0b('0x33')](_0x3ca502[_0xbd0b('0x32')]);_0x3040e8[_0xbd0b('0x34')]=_['intersection'](_0x3040e8[_0xbd0b('0x31')],_0x3040e8[_0xbd0b('0x32')]);_0x215478[_0xbd0b('0x35')]=_[_0xbd0b('0x36')](_0x3040e8[_0xbd0b('0x31')],qs[_0xbd0b('0x37')](_0x3ca502[_0xbd0b('0x32')][_0xbd0b('0x37')]));_0x215478[_0xbd0b('0x35')]=_0x215478['attributes']['length']?_0x215478['attributes']:_0x3040e8[_0xbd0b('0x31')];if(!_0x3ca502[_0xbd0b('0x32')][_0xbd0b('0x38')](_0xbd0b('0x39'))){_0x215478[_0xbd0b('0x1f')]=qs[_0xbd0b('0x1f')](_0x3ca502['query'][_0xbd0b('0x1f')]);_0x215478[_0xbd0b('0x21')]=qs[_0xbd0b('0x21')](_0x3ca502['query']['offset']);}_0x215478['order']=qs[_0xbd0b('0x3a')](_0x3ca502[_0xbd0b('0x32')]['sort']);_0x215478[_0xbd0b('0x3b')]=qs['filters'](_['pick'](_0x3ca502[_0xbd0b('0x32')],_0x3040e8[_0xbd0b('0x34')]),_0x2a76da);if(_0x3ca502[_0xbd0b('0x32')][_0xbd0b('0x3c')]){_0x215478[_0xbd0b('0x3b')]=_[_0xbd0b('0x3d')](_0x215478[_0xbd0b('0x3b')],{'$or':_[_0xbd0b('0x3e')](_0x2a76da,function(_0x1de112){if(_0x1de112[_0xbd0b('0x2f')]!=='VIRTUAL'){var _0x53eab9={};_0x53eab9[_0x1de112['name']]={'$like':'%'+_0x3ca502[_0xbd0b('0x32')][_0xbd0b('0x3c')]+'%'};return _0x53eab9;}})});}_0x215478=_[_0xbd0b('0x3d')]({},_0x215478,_0x3ca502[_0xbd0b('0x3f')]);var _0xedb041={'where':_0x215478[_0xbd0b('0x3b')]};return db['ServicenowAccount'][_0xbd0b('0x20')](_0xedb041)['then'](function(_0x31cd2f){_0x2985a0[_0xbd0b('0x20')]=_0x31cd2f;if(_0x3ca502[_0xbd0b('0x32')][_0xbd0b('0x40')]){_0x215478[_0xbd0b('0x41')]=[{'all':!![]}];}return db[_0xbd0b('0x2c')][_0xbd0b('0x42')](_0x215478);})[_0xbd0b('0x26')](function(_0x514060){_0x2985a0[_0xbd0b('0x43')]=_0x514060;return _0x2985a0;})[_0xbd0b('0x26')](respondWithFilteredResult(_0x9e33d2,_0x215478))[_0xbd0b('0x44')](handleError(_0x9e33d2,null));};exports[_0xbd0b('0x45')]=function(_0x5d654d,_0xbdd1ba){var _0x378ee5={'raw':![],'where':{'id':_0x5d654d[_0xbd0b('0x46')]['id']}},_0x176dd1={};_0x176dd1[_0xbd0b('0x31')]=_['keys'](db['ServicenowAccount'][_0xbd0b('0x2d')]);_0x176dd1['query']=_[_0xbd0b('0x33')](_0x5d654d[_0xbd0b('0x32')]);_0x176dd1[_0xbd0b('0x34')]=_['intersection'](_0x176dd1[_0xbd0b('0x31')],_0x176dd1[_0xbd0b('0x32')]);_0x378ee5[_0xbd0b('0x35')]=_[_0xbd0b('0x36')](_0x176dd1[_0xbd0b('0x31')],qs[_0xbd0b('0x37')](_0x5d654d[_0xbd0b('0x32')]['fields']));_0x378ee5['attributes']=_0x378ee5['attributes'][_0xbd0b('0x47')]?_0x378ee5['attributes']:_0x176dd1[_0xbd0b('0x31')];if(_0x5d654d[_0xbd0b('0x32')][_0xbd0b('0x40')]){_0x378ee5[_0xbd0b('0x41')]=[{'all':!![]}];}_0x378ee5=_[_0xbd0b('0x3d')]({},_0x378ee5,_0x5d654d[_0xbd0b('0x3f')]);return db[_0xbd0b('0x2c')][_0xbd0b('0x48')](_0x378ee5)['then'](handleEntityNotFound(_0xbdd1ba,null))[_0xbd0b('0x26')](respondWithResult(_0xbdd1ba,null))[_0xbd0b('0x44')](handleError(_0xbdd1ba,null));};exports[_0xbd0b('0x49')]=function(_0x496937,_0x27c4db){return db['ServicenowAccount'][_0xbd0b('0x49')](_0x496937['body'],{})[_0xbd0b('0x26')](respondWithResult(_0x27c4db,0xc9))[_0xbd0b('0x44')](handleError(_0x27c4db,null));};exports[_0xbd0b('0x25')]=function(_0x4e1d53,_0x1b5eb3){if(_0x4e1d53[_0xbd0b('0x4a')]['id']){delete _0x4e1d53[_0xbd0b('0x4a')]['id'];}return db[_0xbd0b('0x2c')][_0xbd0b('0x48')]({'where':{'id':_0x4e1d53[_0xbd0b('0x46')]['id']}})[_0xbd0b('0x26')](handleEntityNotFound(_0x1b5eb3,null))[_0xbd0b('0x26')](saveUpdates(_0x4e1d53['body'],null))['then'](respondWithResult(_0x1b5eb3,null))[_0xbd0b('0x44')](handleError(_0x1b5eb3,null));};exports[_0xbd0b('0x27')]=function(_0x4ec149,_0x5c1474){return db[_0xbd0b('0x2c')]['find']({'where':{'id':_0x4ec149[_0xbd0b('0x46')]['id']}})[_0xbd0b('0x26')](handleEntityNotFound(_0x5c1474,null))['then'](removeEntity(_0x5c1474,null))[_0xbd0b('0x44')](handleError(_0x5c1474,null));};exports[_0xbd0b('0x4b')]=function(_0x9fae90,_0x377286,_0x4f178d){var _0x26a0c1={};var _0x1ade96={};var _0x53714a;var _0x38c697;return db['ServicenowAccount'][_0xbd0b('0x4c')]({'where':{'id':_0x9fae90[_0xbd0b('0x46')]['id']}})[_0xbd0b('0x26')](handleEntityNotFound(_0x377286,null))[_0xbd0b('0x26')](function(_0x1376f5){if(_0x1376f5){_0x53714a=_0x1376f5;_0x1ade96['model']=_[_0xbd0b('0x33')](db['ServicenowConfiguration'][_0xbd0b('0x2d')]);_0x1ade96['query']=_['keys'](_0x9fae90[_0xbd0b('0x32')]);_0x1ade96['filters']=_[_0xbd0b('0x36')](_0x1ade96[_0xbd0b('0x31')],_0x1ade96['query']);_0x26a0c1[_0xbd0b('0x35')]=_[_0xbd0b('0x36')](_0x1ade96[_0xbd0b('0x31')],qs[_0xbd0b('0x37')](_0x9fae90[_0xbd0b('0x32')][_0xbd0b('0x37')]));_0x26a0c1[_0xbd0b('0x35')]=_0x26a0c1[_0xbd0b('0x35')][_0xbd0b('0x47')]?_0x26a0c1[_0xbd0b('0x35')]:_0x1ade96[_0xbd0b('0x31')];_0x26a0c1[_0xbd0b('0x4d')]=qs['sort'](_0x9fae90[_0xbd0b('0x32')][_0xbd0b('0x3a')]);_0x26a0c1[_0xbd0b('0x3b')]=qs['filters'](_[_0xbd0b('0x4e')](_0x9fae90[_0xbd0b('0x32')],_0x1ade96['filters']));if(_0x9fae90[_0xbd0b('0x32')][_0xbd0b('0x3c')]){_0x26a0c1[_0xbd0b('0x3b')]=_['merge'](_0x26a0c1[_0xbd0b('0x3b')],{'$or':_[_0xbd0b('0x3e')](_0x26a0c1[_0xbd0b('0x35')],function(_0x2df797){var _0x3129ce={};_0x3129ce[_0x2df797]={'$like':'%'+_0x9fae90['query'][_0xbd0b('0x3c')]+'%'};return _0x3129ce;})});}_0x26a0c1=_['merge']({},_0x26a0c1,_0x9fae90[_0xbd0b('0x3f')]);return _0x53714a[_0xbd0b('0x4b')](_0x26a0c1);}})[_0xbd0b('0x26')](function(_0x222295){if(_0x222295){_0x38c697=_0x222295[_0xbd0b('0x47')];if(!_0x9fae90[_0xbd0b('0x32')]['hasOwnProperty'](_0xbd0b('0x39'))){_0x26a0c1['limit']=qs[_0xbd0b('0x1f')](_0x9fae90['query'][_0xbd0b('0x1f')]);_0x26a0c1[_0xbd0b('0x21')]=qs['offset'](_0x9fae90[_0xbd0b('0x32')][_0xbd0b('0x21')]);}return _0x53714a[_0xbd0b('0x4b')](_0x26a0c1);}})[_0xbd0b('0x26')](function(_0x20a932){if(_0x20a932){return _0x20a932?{'count':_0x38c697,'rows':_0x20a932}:null;}})[_0xbd0b('0x26')](respondWithResult(_0x377286,null))[_0xbd0b('0x44')](handleError(_0x377286,null));};exports[_0xbd0b('0x4f')]=function(_0x3e5be3,_0x3a87ed,_0x3f4fbe){if(_0x3e5be3[_0xbd0b('0x4a')]['id']){delete _0x3e5be3['body']['id'];}return db[_0xbd0b('0x2c')][_0xbd0b('0x4c')]({'where':{'id':_0x3e5be3['params']['id']}})[_0xbd0b('0x26')](handleEntityNotFound(_0x3a87ed,null))[_0xbd0b('0x26')](function(_0xebcdf8){if(_0xebcdf8){_0x3e5be3[_0xbd0b('0x4a')][_0xbd0b('0x50')]=_0xebcdf8['id'];_0x3e5be3['body'][_0xbd0b('0x51')]=integrations[_0xbd0b('0x52')](_0x3e5be3[_0xbd0b('0x4a')]['channel'],_0x3e5be3[_0xbd0b('0x4a')][_0xbd0b('0x2f')]);_0x3e5be3[_0xbd0b('0x4a')][_0xbd0b('0x53')]=integrations[_0xbd0b('0x54')](_0x3e5be3[_0xbd0b('0x4a')][_0xbd0b('0x55')],_0x3e5be3['body'][_0xbd0b('0x2f')]);return db[_0xbd0b('0x56')][_0xbd0b('0x49')](_0x3e5be3[_0xbd0b('0x4a')],{'include':[{'model':db[_0xbd0b('0x57')],'as':_0xbd0b('0x51')},{'model':db[_0xbd0b('0x57')],'as':_0xbd0b('0x53')}]});}return null;})[_0xbd0b('0x26')](respondWithResult(_0x3a87ed,null))['catch'](handleError(_0x3a87ed,null));};exports[_0xbd0b('0x58')]=function(_0x164b9b,_0x492ca2,_0x18284a){var _0x3907ad=[_0xbd0b('0x59'),_0xbd0b('0x5a'),_0xbd0b('0x5b'),_0xbd0b('0x5c'),'close_code',_0xbd0b('0x5d'),_0xbd0b('0x5e'),_0xbd0b('0x5f'),_0xbd0b('0x60')];var _0x7ccfdc=[_0xbd0b('0x61'),_0xbd0b('0x59'),_0xbd0b('0x62'),'watch_list',_0xbd0b('0x63'),_0xbd0b('0x64'),'child_incidents',_0xbd0b('0x5a'),'approval_history','number','resolved_by','sys_updated_by',_0xbd0b('0x65'),_0xbd0b('0x66'),_0xbd0b('0x67'),'sys_domain','state',_0xbd0b('0x68'),'knowledge',_0xbd0b('0x4d'),_0xbd0b('0x69'),_0xbd0b('0x6a'),_0xbd0b('0x6b'),_0xbd0b('0x6c'),'impact',_0xbd0b('0x6d'),'work_notes_list','business_service',_0xbd0b('0x6e'),'sys_domain_path','rfc',_0xbd0b('0x6f'),_0xbd0b('0x70'),_0xbd0b('0x71'),_0xbd0b('0x72'),_0xbd0b('0x73'),_0xbd0b('0x74'),'reopened_time',_0xbd0b('0x75'),_0xbd0b('0x76'),'approval_set','subcategory',_0xbd0b('0x77'),_0xbd0b('0x78'),'close_code','correlation_display',_0xbd0b('0x79'),_0xbd0b('0x7a'),_0xbd0b('0x7b'),_0xbd0b('0x7c'),_0xbd0b('0x7d'),_0xbd0b('0x7e'),_0xbd0b('0x7f'),_0xbd0b('0x5d'),_0xbd0b('0x80'),'close_notes',_0xbd0b('0x81'),_0xbd0b('0x82'),'parent_incident','sys_id',_0xbd0b('0x83'),'reopened_by',_0xbd0b('0x5e'),_0xbd0b('0x84'),'problem_id','company',_0xbd0b('0x85'),_0xbd0b('0x86'),_0xbd0b('0x87'),'severity',_0xbd0b('0x88'),'sla_due',_0xbd0b('0x89'),'comments_and_work_notes','due_date','sys_mod_count',_0xbd0b('0x8a'),'sys_tags','escalation',_0xbd0b('0x8b'),_0xbd0b('0x8c'),_0xbd0b('0x8d'),_0xbd0b('0x60')];var _0x41dc3f='';var _0x4de3e6='';var _0xdcfa82=[];var _0x2562c1='';var _0x5dfaa0='';var _0x436284=[];var _0x37f8c8='';var _0x4d303f='';var _0x41b42a={};var _0x553110='';return db[_0xbd0b('0x2c')][_0xbd0b('0x4c')]({'where':{'id':_0x164b9b[_0xbd0b('0x46')]['id']},'attributes':['id',_0xbd0b('0x8e'),_0xbd0b('0x8f'),'email',_0xbd0b('0x90'),'serverUrl']})[_0xbd0b('0x26')](handleEntityNotFound(_0x492ca2,null))[_0xbd0b('0x26')](function(_0x27c135){if(_0x27c135){_0x553110=_0x27c135['remoteUri'];var _0x196dfb=_0x553110[_0xbd0b('0x91')](-0x1);if(_0x196dfb==='/'){_0x553110=_0x553110[_0xbd0b('0x92')](0x0,_0x553110[_0xbd0b('0x93')](_0x196dfb));}_0x4d303f=util[_0xbd0b('0x94')](_0xbd0b('0x95'),_0x553110);_0x37f8c8=util[_0xbd0b('0x94')]('%s/api/now/table/',_0x553110);_0x41b42a={'user':_0x27c135['username'],'pass':_0x27c135[_0xbd0b('0x8f')]};var _0x5326ce={'method':_0xbd0b('0x96'),'uri':_0x4d303f+_0xbd0b('0x97'),'auth':_0x41b42a,'json':!![]};return rp(_0x5326ce);}})[_0xbd0b('0x26')](function(_0x538f6f){if(_0x538f6f['result'][_0xbd0b('0x47')]>0x0){_0x41dc3f=_0x538f6f[_0xbd0b('0x98')];}console[_0xbd0b('0x99')](_0xbd0b('0x9a'),_0x41dc3f);_0x436284=[];_0x4de3e6=Object[_0xbd0b('0x9b')]([],_0x41dc3f);_['remove'](_0x4de3e6,function(_0x65d656){return!_0x3907ad['includes'](_0x65d656[_0xbd0b('0x29')]);});_0x4de3e6[_0xbd0b('0x9c')](function(_0x1b355f){var _0x54a4a0=createFieldObject(_0x37f8c8,_0x41b42a,_0x1b355f['internalType'],_0x1b355f[_0xbd0b('0x29')],_0x1b355f['label'],![]);_0x436284[_0xbd0b('0x9d')](_0x54a4a0);});return Promise[_0xbd0b('0x9e')](_0x436284);})[_0xbd0b('0x26')](function(_0x5f14eb){_0xdcfa82=_0x5f14eb;_0x2562c1=Object[_0xbd0b('0x9b')]([],_0x41dc3f);console[_0xbd0b('0x99')](_0xbd0b('0x9f'),_0x41dc3f);_[_0xbd0b('0xa0')](_0x2562c1,function(_0x59854d){return _0x7ccfdc[_0xbd0b('0xa1')](_0x59854d[_0xbd0b('0x29')]);});console[_0xbd0b('0x99')](_0xbd0b('0xa2'),_0x2562c1);_0x436284=[];_0x2562c1[_0xbd0b('0x9c')](function(_0x466b68){var _0x2b9595=createFieldObject(_0x37f8c8,_0x41b42a,_0x466b68[_0xbd0b('0xa3')],_0x466b68[_0xbd0b('0x29')],_0x466b68[_0xbd0b('0xa4')],!![]);_0x436284['push'](_0x2b9595);});return Promise[_0xbd0b('0x9e')](_0x436284);})['then'](function(_0x4281d8){_0x5dfaa0=_0x4281d8;var _0xbcf288=_0xdcfa82[_0xbd0b('0xa5')](_0x5dfaa0);return{'count':_0xbcf288[_0xbd0b('0x47')],'rows':_0xbcf288};})[_0xbd0b('0x26')](respondWithResult(_0x492ca2,null))[_0xbd0b('0x44')](function(_0x35ae41){console['log'](_0xbd0b('0xa6')+_0x35ae41);var _0xd26cef=_0x164b9b[_0xbd0b('0x32')]['test']?0x1f4:_0x35ae41['statusCode']||0x1f4;logger['error'](_0x35ae41['stack']);delete _0x35ae41['name'];if(_0xd26cef===0x191){_0xd26cef=0x190;}_0x492ca2[_0xbd0b('0x1c')](_0xd26cef)[_0xbd0b('0x2a')](_0x164b9b[_0xbd0b('0x32')][_0xbd0b('0xa7')]?{'message':_0xbd0b('0xa8'),'statusCode':_0x35ae41[_0xbd0b('0xa9')]}:_0x35ae41);});};function createFieldObject(_0x9a1f54,_0x3fc667,_0x1d9af2,_0x4205a5,_0x5ca5ad,_0x2b78ae){return new Promise(function(_0xe713be,_0x4a310c){var _0x253b39={'id':_0x4205a5,'name':_0x5ca5ad,'custom':_0x2b78ae};if(_0x1d9af2===_0xbd0b('0xaa')){_0x253b39[_0xbd0b('0x3f')]=[{'name':_0xbd0b('0xab'),'value':_0xbd0b('0xac')},{'name':_0xbd0b('0xad'),'value':'false'}];_0xe713be(_0x253b39);}else{var _0x25a821={'method':_0xbd0b('0x96'),'uri':_0x9a1f54+_0xbd0b('0xae')+_0x4205a5,'auth':_0x3fc667,'json':!![]};return rp(_0x25a821)[_0xbd0b('0x26')](function(_0x2e8beb){var _0x55e4d2=[];if(_0x2e8beb[_0xbd0b('0x98')]['length']>0x0){_0x2e8beb['result'][_0xbd0b('0x9c')](function(_0x48fec3){if(_0x48fec3['inactive']===_0xbd0b('0xaf')){var _0x1443e1={'name':_0x48fec3[_0xbd0b('0xa4')],'value':_0x48fec3[_0xbd0b('0xb0')]};_0x55e4d2['push'](_0x1443e1);}});}_0x253b39['options']=_0x55e4d2;if(_0x253b39[_0xbd0b('0x3f')][_0xbd0b('0x47')]>0x0){_0xe713be(_0x253b39);}else{if(_0x2b78ae==![]){_0xe713be();}else{_0xe713be(_0x253b39);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 1c8b1d9..9c87059 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 _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','../../config/logger','api'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x26c9fb,_0x4282e2){_0x26c9fb=_0x26c9fb-0x0;var _0x3210a8=_0x7fbe[_0x26c9fb];return _0x3210a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));var integrations=require(_0xe7fb('0x9'));module[_0xe7fb('0xa')]=function(_0x12d1b0,_0x24cd67){return _0x12d1b0[_0xe7fb('0xb')]('ServicenowAccount',attributes,{'tableName':_0xe7fb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5075=['bluebird','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x4783a4,_0x278356){var _0x1a3751=function(_0x48ac4e){while(--_0x48ac4e){_0x4783a4['push'](_0x4783a4['shift']());}};_0x1a3751(++_0x278356);}(_0x5075,0x73));var _0x5507=function(_0x1f109c,_0xd9952e){_0x1f109c=_0x1f109c-0x0;var _0x3984e8=_0x5075[_0x1f109c];return _0x3984e8;};'use strict';var _=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var logger=require(_0x5507('0x2'))(_0x5507('0x3'));var moment=require(_0x5507('0x4'));var BPromise=require(_0x5507('0x5'));var rp=require(_0x5507('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5507('0x7'));var config=require(_0x5507('0x8'));var attributes=require(_0x5507('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2cd9ee,_0x773559){return _0x2cd9ee['define'](_0x5507('0xa'),attributes,{'tableName':_0x5507('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index d79c56e..f6590e5 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 _0xb766=['then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','where','include','map','model','attributes','stringify','ShowServicenowAccount','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x50a1f6,_0x238fd8){var _0x84f8d4=function(_0x2d9586){while(--_0x2d9586){_0x50a1f6['push'](_0x50a1f6['shift']());}};_0x84f8d4(++_0x238fd8);}(_0xb766,0x1eb));var _0x6b76=function(_0x3f8a03,_0x319b9c){_0x3f8a03=_0x3f8a03-0x0;var _0x147fb2=_0xb766[_0x3f8a03];return _0x147fb2;};'use strict';var _=require(_0x6b76('0x0'));var util=require(_0x6b76('0x1'));var moment=require(_0x6b76('0x2'));var BPromise=require('bluebird');var rs=require(_0x6b76('0x3'));var fs=require('fs');var Redis=require(_0x6b76('0x4'));var db=require(_0x6b76('0x5'))['db'];var utils=require(_0x6b76('0x6'));var logger=require('../../config/logger')(_0x6b76('0x7'));var config=require(_0x6b76('0x8'));var jayson=require(_0x6b76('0x9'));var client=jayson[_0x6b76('0xa')][_0x6b76('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x592835,_0x3d467a,_0x29ee27){return new BPromise(function(_0x246b15,_0x1798fd){return client[_0x6b76('0xc')](_0x592835,_0x29ee27)[_0x6b76('0xd')](function(_0x7e1a3b){logger[_0x6b76('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x3d467a,_0x6b76('0xf'));logger[_0x6b76('0x10')](_0x6b76('0x11'),_0x3d467a,_0x6b76('0xf'),JSON['stringify'](_0x7e1a3b));if(_0x7e1a3b['error']){if(_0x7e1a3b[_0x6b76('0x12')][_0x6b76('0x13')]===0x1f4){logger[_0x6b76('0x12')](_0x6b76('0x14'),_0x3d467a,_0x7e1a3b[_0x6b76('0x12')][_0x6b76('0x15')]);return _0x1798fd(_0x7e1a3b[_0x6b76('0x12')][_0x6b76('0x15')]);}logger[_0x6b76('0x12')](_0x6b76('0x14'),_0x3d467a,_0x7e1a3b[_0x6b76('0x12')][_0x6b76('0x15')]);return _0x246b15(_0x7e1a3b[_0x6b76('0x12')][_0x6b76('0x15')]);}else{logger[_0x6b76('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x3d467a,_0x6b76('0xf'));_0x246b15(_0x7e1a3b[_0x6b76('0x16')][_0x6b76('0x15')]);}})[_0x6b76('0x17')](function(_0x593a23){logger[_0x6b76('0x12')](_0x6b76('0x14'),_0x3d467a,_0x593a23);_0x1798fd(_0x593a23);});});}exports[_0x6b76('0x18')]=function(_0x434b68){var _0x26fd34=this;return new Promise(function(_0xf19dce,_0x5a44ac){return db[_0x6b76('0x19')][_0x6b76('0x1a')]({'raw':_0x434b68[_0x6b76('0x1b')]?_0x434b68[_0x6b76('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x434b68[_0x6b76('0x1b')]?_0x434b68[_0x6b76('0x1b')][_0x6b76('0x1c')]||null:null,'attributes':_0x434b68[_0x6b76('0x1b')]?_0x434b68[_0x6b76('0x1b')]['attributes']||null:null,'limit':_0x434b68['options']?_0x434b68[_0x6b76('0x1b')]['limit']||null:null,'include':_0x434b68['options']?_0x434b68[_0x6b76('0x1b')][_0x6b76('0x1d')]?_[_0x6b76('0x1e')](_0x434b68[_0x6b76('0x1b')][_0x6b76('0x1d')],function(_0x5a5944){return{'model':db[_0x5a5944[_0x6b76('0x1f')]],'as':_0x5a5944['as'],'attributes':_0x5a5944[_0x6b76('0x20')],'include':_0x5a5944[_0x6b76('0x1d')]?_[_0x6b76('0x1e')](_0x5a5944[_0x6b76('0x1d')],function(_0x5676ed){return{'model':db[_0x5676ed[_0x6b76('0x1f')]],'as':_0x5676ed['as'],'attributes':_0x5676ed[_0x6b76('0x20')],'include':_0x5676ed[_0x6b76('0x1d')]?_[_0x6b76('0x1e')](_0x5676ed[_0x6b76('0x1d')],function(_0x2c54e8){return{'model':db[_0x2c54e8[_0x6b76('0x1f')]],'as':_0x2c54e8['as'],'attributes':_0x2c54e8[_0x6b76('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ff1a6){logger[_0x6b76('0xe')](_0x6b76('0x18'),_0x434b68);logger[_0x6b76('0x10')](_0x6b76('0x18'),_0x434b68,JSON[_0x6b76('0x21')](_0x2ff1a6));_0xf19dce(_0x2ff1a6);})[_0x6b76('0x17')](function(_0x332c70){logger[_0x6b76('0x12')](_0x6b76('0x18'),_0x332c70['message'],_0x434b68);_0x5a44ac(_0x26fd34[_0x6b76('0x12')](0x1f4,_0x332c70[_0x6b76('0x15')]));});});};exports[_0x6b76('0x22')]=function(_0x9dac2e){var _0x2884d4=this;return new Promise(function(_0x210f68,_0x1f4f22){return db[_0x6b76('0x19')]['find']({'raw':_0x9dac2e[_0x6b76('0x1b')]?_0x9dac2e[_0x6b76('0x1b')][_0x6b76('0x23')]===undefined?!![]:![]:!![],'where':_0x9dac2e[_0x6b76('0x1b')]?_0x9dac2e[_0x6b76('0x1b')]['where']||null:null,'attributes':_0x9dac2e[_0x6b76('0x1b')]?_0x9dac2e[_0x6b76('0x1b')][_0x6b76('0x20')]||null:null,'include':_0x9dac2e[_0x6b76('0x1b')]?_0x9dac2e[_0x6b76('0x1b')][_0x6b76('0x1d')]?_['map'](_0x9dac2e['options'][_0x6b76('0x1d')],function(_0x4af55a){return{'model':db[_0x4af55a[_0x6b76('0x1f')]],'as':_0x4af55a['as'],'attributes':_0x4af55a[_0x6b76('0x20')],'include':_0x4af55a[_0x6b76('0x1d')]?_[_0x6b76('0x1e')](_0x4af55a['include'],function(_0x342684){return{'model':db[_0x342684[_0x6b76('0x1f')]],'as':_0x342684['as'],'attributes':_0x342684[_0x6b76('0x20')],'include':_0x342684['include']?_[_0x6b76('0x1e')](_0x342684[_0x6b76('0x1d')],function(_0x130ec6){return{'model':db[_0x130ec6[_0x6b76('0x1f')]],'as':_0x130ec6['as'],'attributes':_0x130ec6[_0x6b76('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6b76('0xd')](function(_0x4615f0){logger[_0x6b76('0xe')](_0x6b76('0x22'),_0x9dac2e);logger[_0x6b76('0x10')](_0x6b76('0x22'),_0x9dac2e,JSON[_0x6b76('0x21')](_0x4615f0));_0x210f68(_0x4615f0);})[_0x6b76('0x17')](function(_0x539ddb){logger[_0x6b76('0x12')](_0x6b76('0x22'),_0x539ddb[_0x6b76('0x15')],_0x9dac2e);_0x1f4f22(_0x2884d4[_0x6b76('0x12')](0x1f4,_0x539ddb[_0x6b76('0x15')]));});});}; \ No newline at end of file +var _0xccd5=['request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ServicenowAccount,\x20%s,\x20%s','result','catch','GetServicenowAccount','findAll','options','where','attributes','limit','include','map','model','ShowServicenowAccount','ServicenowAccount','find','raw','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x321f08,_0x480cc6){var _0x16e544=function(_0x3cb0cd){while(--_0x3cb0cd){_0x321f08['push'](_0x321f08['shift']());}};_0x16e544(++_0x480cc6);}(_0xccd5,0xc5));var _0x5ccd=function(_0x2a885a,_0x4c083d){_0x2a885a=_0x2a885a-0x0;var _0x3756f1=_0xccd5[_0x2a885a];return _0x3756f1;};'use strict';var _=require('lodash');var util=require(_0x5ccd('0x0'));var moment=require('moment');var BPromise=require(_0x5ccd('0x1'));var rs=require(_0x5ccd('0x2'));var fs=require('fs');var Redis=require(_0x5ccd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5ccd('0x4'));var logger=require('../../config/logger')(_0x5ccd('0x5'));var config=require(_0x5ccd('0x6'));var jayson=require(_0x5ccd('0x7'));var client=jayson[_0x5ccd('0x8')][_0x5ccd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x143804,_0x27ec41,_0x172490){return new BPromise(function(_0x430683,_0x445b84){return client[_0x5ccd('0xa')](_0x143804,_0x172490)[_0x5ccd('0xb')](function(_0x4bbbba){logger[_0x5ccd('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x27ec41,_0x5ccd('0xd'));logger[_0x5ccd('0xe')](_0x5ccd('0xf'),_0x27ec41,_0x5ccd('0xd'),JSON[_0x5ccd('0x10')](_0x4bbbba));if(_0x4bbbba[_0x5ccd('0x11')]){if(_0x4bbbba[_0x5ccd('0x11')]['code']===0x1f4){logger[_0x5ccd('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x27ec41,_0x4bbbba[_0x5ccd('0x11')]['message']);return _0x445b84(_0x4bbbba['error'][_0x5ccd('0x12')]);}logger[_0x5ccd('0x11')](_0x5ccd('0x13'),_0x27ec41,_0x4bbbba[_0x5ccd('0x11')][_0x5ccd('0x12')]);return _0x430683(_0x4bbbba[_0x5ccd('0x11')]['message']);}else{logger[_0x5ccd('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x27ec41,_0x5ccd('0xd'));_0x430683(_0x4bbbba[_0x5ccd('0x14')][_0x5ccd('0x12')]);}})[_0x5ccd('0x15')](function(_0x4c0049){logger[_0x5ccd('0x11')](_0x5ccd('0x13'),_0x27ec41,_0x4c0049);_0x445b84(_0x4c0049);});});}exports[_0x5ccd('0x16')]=function(_0x13d1dd){var _0x57b5d3=this;return new Promise(function(_0x2a6913,_0x2255f8){return db['ServicenowAccount'][_0x5ccd('0x17')]({'raw':_0x13d1dd[_0x5ccd('0x18')]?_0x13d1dd['options']['raw']===undefined?!![]:![]:!![],'where':_0x13d1dd[_0x5ccd('0x18')]?_0x13d1dd['options'][_0x5ccd('0x19')]||null:null,'attributes':_0x13d1dd[_0x5ccd('0x18')]?_0x13d1dd[_0x5ccd('0x18')][_0x5ccd('0x1a')]||null:null,'limit':_0x13d1dd[_0x5ccd('0x18')]?_0x13d1dd['options'][_0x5ccd('0x1b')]||null:null,'include':_0x13d1dd[_0x5ccd('0x18')]?_0x13d1dd[_0x5ccd('0x18')][_0x5ccd('0x1c')]?_[_0x5ccd('0x1d')](_0x13d1dd[_0x5ccd('0x18')]['include'],function(_0x4ce5f5){return{'model':db[_0x4ce5f5[_0x5ccd('0x1e')]],'as':_0x4ce5f5['as'],'attributes':_0x4ce5f5['attributes'],'include':_0x4ce5f5[_0x5ccd('0x1c')]?_[_0x5ccd('0x1d')](_0x4ce5f5[_0x5ccd('0x1c')],function(_0x73b0c2){return{'model':db[_0x73b0c2['model']],'as':_0x73b0c2['as'],'attributes':_0x73b0c2['attributes'],'include':_0x73b0c2[_0x5ccd('0x1c')]?_[_0x5ccd('0x1d')](_0x73b0c2[_0x5ccd('0x1c')],function(_0x2333d4){return{'model':db[_0x2333d4[_0x5ccd('0x1e')]],'as':_0x2333d4['as'],'attributes':_0x2333d4[_0x5ccd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5ccd('0xb')](function(_0x28e62e){logger['info'](_0x5ccd('0x16'),_0x13d1dd);logger[_0x5ccd('0xe')](_0x5ccd('0x16'),_0x13d1dd,JSON['stringify'](_0x28e62e));_0x2a6913(_0x28e62e);})[_0x5ccd('0x15')](function(_0xb88277){logger[_0x5ccd('0x11')]('GetServicenowAccount',_0xb88277[_0x5ccd('0x12')],_0x13d1dd);_0x2255f8(_0x57b5d3[_0x5ccd('0x11')](0x1f4,_0xb88277[_0x5ccd('0x12')]));});});};exports[_0x5ccd('0x1f')]=function(_0x27ddc2){var _0x3c2c9b=this;return new Promise(function(_0xa77eb,_0x2ae10c){return db[_0x5ccd('0x20')][_0x5ccd('0x21')]({'raw':_0x27ddc2[_0x5ccd('0x18')]?_0x27ddc2['options'][_0x5ccd('0x22')]===undefined?!![]:![]:!![],'where':_0x27ddc2['options']?_0x27ddc2[_0x5ccd('0x18')][_0x5ccd('0x19')]||null:null,'attributes':_0x27ddc2[_0x5ccd('0x18')]?_0x27ddc2[_0x5ccd('0x18')]['attributes']||null:null,'include':_0x27ddc2[_0x5ccd('0x18')]?_0x27ddc2[_0x5ccd('0x18')]['include']?_[_0x5ccd('0x1d')](_0x27ddc2[_0x5ccd('0x18')][_0x5ccd('0x1c')],function(_0x3899f9){return{'model':db[_0x3899f9['model']],'as':_0x3899f9['as'],'attributes':_0x3899f9[_0x5ccd('0x1a')],'include':_0x3899f9[_0x5ccd('0x1c')]?_['map'](_0x3899f9[_0x5ccd('0x1c')],function(_0xe2b658){return{'model':db[_0xe2b658[_0x5ccd('0x1e')]],'as':_0xe2b658['as'],'attributes':_0xe2b658[_0x5ccd('0x1a')],'include':_0xe2b658[_0x5ccd('0x1c')]?_['map'](_0xe2b658[_0x5ccd('0x1c')],function(_0x14f1a9){return{'model':db[_0x14f1a9[_0x5ccd('0x1e')]],'as':_0x14f1a9['as'],'attributes':_0x14f1a9[_0x5ccd('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x530da6){logger[_0x5ccd('0xc')]('ShowServicenowAccount',_0x27ddc2);logger[_0x5ccd('0xe')](_0x5ccd('0x1f'),_0x27ddc2,JSON[_0x5ccd('0x10')](_0x530da6));_0xa77eb(_0x530da6);})[_0x5ccd('0x15')](function(_0x78518e){logger['error']('ShowServicenowAccount',_0x78518e[_0x5ccd('0x12')],_0x27ddc2);_0x2ae10c(_0x3c2c9b[_0x5ccd('0x11')](0x1f4,_0x78518e[_0x5ccd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index ab3afa4..c18b981 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 _0x16c9=['getDescriptions','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x5e8359,_0x6b4b5b){var _0x5757be=function(_0x113b04){while(--_0x113b04){_0x5e8359['push'](_0x5e8359['shift']());}};_0x5757be(++_0x6b4b5b);}(_0x16c9,0x17e));var _0x916c=function(_0xff3fde,_0x1ed4f5){_0xff3fde=_0xff3fde-0x0;var _0x3a8cf6=_0x16c9[_0xff3fde];return _0x3a8cf6;};'use strict';var multer=require(_0x916c('0x0'));var util=require(_0x916c('0x1'));var path=require(_0x916c('0x2'));var timeout=require(_0x916c('0x3'));var express=require(_0x916c('0x4'));var router=express[_0x916c('0x5')]();var fs_extra=require(_0x916c('0x6'));var auth=require(_0x916c('0x7'));var interaction=require(_0x916c('0x8'));var config=require(_0x916c('0x9'));var controller=require('./intServicenowConfiguration.controller');router[_0x916c('0xa')]('/',auth['isAuthenticated'](),controller[_0x916c('0xb')]);router[_0x916c('0xa')](_0x916c('0xc'),auth[_0x916c('0xd')](),controller['show']);router[_0x916c('0xa')]('/:id/fields',auth[_0x916c('0xd')](),controller[_0x916c('0xe')]);router[_0x916c('0xa')](_0x916c('0xf'),auth['isAuthenticated'](),controller[_0x916c('0x10')]);router[_0x916c('0xa')](_0x916c('0x11'),auth[_0x916c('0xd')](),controller[_0x916c('0x12')]);router['post']('/',auth[_0x916c('0xd')](),controller[_0x916c('0x13')]);router[_0x916c('0x14')](_0x916c('0xc'),auth['isAuthenticated'](),controller[_0x916c('0x15')]);router[_0x916c('0x16')](_0x916c('0xc'),auth[_0x916c('0xd')](),controller[_0x916c('0x17')]);module[_0x916c('0x18')]=router; \ No newline at end of file +var _0xe15d=['path','express','fs-extra','../../components/interaction/service','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe15d,0x78));var _0xde15=function(_0x3f3b99,_0x57d3e2){_0x3f3b99=_0x3f3b99-0x0;var _0xd75dc=_0xe15d[_0x3f3b99];return _0xd75dc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xde15('0x0'));var timeout=require('connect-timeout');var express=require(_0xde15('0x1'));var router=express['Router']();var fs_extra=require(_0xde15('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xde15('0x3'));var config=require('../../config/environment');var controller=require(_0xde15('0x4'));router[_0xde15('0x5')]('/',auth['isAuthenticated'](),controller[_0xde15('0x6')]);router[_0xde15('0x5')](_0xde15('0x7'),auth[_0xde15('0x8')](),controller[_0xde15('0x9')]);router['get'](_0xde15('0xa'),auth['isAuthenticated'](),controller[_0xde15('0xb')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xde15('0xc')]);router[_0xde15('0x5')](_0xde15('0xd'),auth['isAuthenticated'](),controller[_0xde15('0xe')]);router[_0xde15('0xf')]('/',auth[_0xde15('0x8')](),controller[_0xde15('0x10')]);router[_0xde15('0x11')](_0xde15('0x7'),auth[_0xde15('0x8')](),controller[_0xde15('0x12')]);router['delete'](_0xde15('0x7'),auth[_0xde15('0x8')](),controller[_0xde15('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index f64576b..35efa95 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 _0x427a=['sequelize','exports','STRING'];(function(_0xf0ff92,_0x57fdcc){var _0x488192=function(_0x432908){while(--_0x432908){_0xf0ff92['push'](_0xf0ff92['shift']());}};_0x488192(++_0x57fdcc);}(_0x427a,0x15c));var _0xa427=function(_0x53f9fd,_0x5676fa){_0x53f9fd=_0x53f9fd-0x0;var _0x1ed258=_0x427a[_0x53f9fd];return _0x1ed258;};'use strict';var Sequelize=require(_0xa427('0x0'));module[_0xa427('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa427('0x2')]}}; \ No newline at end of file +var _0x53c5=['STRING'];(function(_0x2828f1,_0x3872c1){var _0x4d4610=function(_0x599722){while(--_0x599722){_0x2828f1['push'](_0x2828f1['shift']());}};_0x4d4610(++_0x3872c1);}(_0x53c5,0x1d6));var _0x553c=function(_0x37ad71,_0x129351){_0x37ad71=_0x37ad71-0x0;var _0x44eeaf=_0x53c5[_0x37ad71];return _0x44eeaf;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x553c('0x0')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 171a630..8d04985 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 _0xe677=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','ServicenowConfiguration','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','findOne','keys','ServicenowField','getFields','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','request-promise','moment','util','path','sox','ejs','fs-extra','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4f7fcf,_0x56aa79){var _0x108398=function(_0x23bd93){while(--_0x23bd93){_0x4f7fcf['push'](_0x4f7fcf['shift']());}};_0x108398(++_0x56aa79);}(_0xe677,0x168));var _0x7e67=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0xe677[_0x484c03];return _0x294127;};'use strict';var emlformat=require(_0x7e67('0x0'));var rimraf=require(_0x7e67('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7e67('0x2'));var moment=require(_0x7e67('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7e67('0x4'));var path=require(_0x7e67('0x5'));var sox=require(_0x7e67('0x6'));var csv=require('to-csv');var ejs=require(_0x7e67('0x7'));var fs=require('fs');var fs_extra=require(_0x7e67('0x8'));var _=require('lodash');var squel=require(_0x7e67('0x9'));var crypto=require(_0x7e67('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7e67('0xb'));var Redis=require('ioredis');var authService=require(_0x7e67('0xc'));var qs=require(_0x7e67('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e67('0xe'));var logger=require(_0x7e67('0xf'))(_0x7e67('0x10'));var utils=require('../../config/utils');var config=require(_0x7e67('0x11'));var licenseUtil=require(_0x7e67('0x12'));var db=require(_0x7e67('0x13'))['db'];function respondWithStatusCode(_0x1892e2,_0x22b17f){_0x22b17f=_0x22b17f||0xcc;return function(_0x2286d6){if(_0x2286d6){return _0x1892e2[_0x7e67('0x14')](_0x22b17f);}return _0x1892e2[_0x7e67('0x15')](_0x22b17f)[_0x7e67('0x16')]();};}function respondWithResult(_0xc133ed,_0x11f16d){_0x11f16d=_0x11f16d||0xc8;return function(_0x3db23c){if(_0x3db23c){return _0xc133ed[_0x7e67('0x15')](_0x11f16d)[_0x7e67('0x17')](_0x3db23c);}};}function respondWithFilteredResult(_0x1715f7,_0x150a8c){return function(_0xb72936){if(_0xb72936){var _0x1689bd=typeof _0x150a8c[_0x7e67('0x18')]===_0x7e67('0x19')&&typeof _0x150a8c[_0x7e67('0x1a')]==='undefined';var _0x259f1c=_0xb72936[_0x7e67('0x1b')];var _0x57707d=_0x1689bd?0x0:_0x150a8c[_0x7e67('0x18')];var _0x2664c4=_0x1689bd?_0xb72936['count']:_0x150a8c[_0x7e67('0x18')]+_0x150a8c[_0x7e67('0x1a')];var _0x2d1b54;if(_0x2664c4>=_0x259f1c){_0x2664c4=_0x259f1c;_0x2d1b54=0xc8;}else{_0x2d1b54=0xce;}_0x1715f7[_0x7e67('0x15')](_0x2d1b54);return _0x1715f7[_0x7e67('0x1c')](_0x7e67('0x1d'),_0x57707d+'-'+_0x2664c4+'/'+_0x259f1c)[_0x7e67('0x17')](_0xb72936);}return null;};}function patchUpdates(_0xdc49e5){return function(_0x1e4abd){try{jsonpatch[_0x7e67('0x1e')](_0x1e4abd,_0xdc49e5,!![]);}catch(_0x1af8f4){return BPromise['reject'](_0x1af8f4);}return _0x1e4abd[_0x7e67('0x1f')]();};}function saveUpdates(_0x384328,_0xda86c9){return function(_0x3c4796){if(_0x3c4796){return _0x3c4796[_0x7e67('0x20')](_0x384328)[_0x7e67('0x21')](function(_0x394fe4){return _0x394fe4;});}return null;};}function removeEntity(_0x5da53f,_0x3bf1be){return function(_0x402f12){if(_0x402f12){return _0x402f12[_0x7e67('0x22')]()[_0x7e67('0x21')](function(){_0x5da53f[_0x7e67('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f7e95,_0x46e1af){return function(_0x2864cf){if(!_0x2864cf){_0x2f7e95[_0x7e67('0x14')](0x194);}return _0x2864cf;};}function handleError(_0x50c62c,_0xd09be){_0xd09be=_0xd09be||0x1f4;return function(_0x4adb05){logger[_0x7e67('0x23')](_0x4adb05['stack']);if(_0x4adb05[_0x7e67('0x24')]){delete _0x4adb05[_0x7e67('0x24')];}_0x50c62c[_0x7e67('0x15')](_0xd09be)[_0x7e67('0x25')](_0x4adb05);};}exports[_0x7e67('0x26')]=function(_0x15186f,_0x262597){var _0x1e1653={},_0x279019={},_0x415abe={'count':0x0,'rows':[]};var _0x1fa95f=_[_0x7e67('0x27')](db[_0x7e67('0x28')][_0x7e67('0x29')],function(_0x2a1bdb){return{'name':_0x2a1bdb['fieldName'],'type':_0x2a1bdb[_0x7e67('0x2a')]['key']};});_0x279019[_0x7e67('0x2b')]=_[_0x7e67('0x27')](_0x1fa95f,_0x7e67('0x24'));_0x279019['query']=_['keys'](_0x15186f[_0x7e67('0x2c')]);_0x279019[_0x7e67('0x2d')]=_['intersection'](_0x279019['model'],_0x279019['query']);_0x1e1653[_0x7e67('0x2e')]=_[_0x7e67('0x2f')](_0x279019['model'],qs[_0x7e67('0x30')](_0x15186f[_0x7e67('0x2c')]['fields']));_0x1e1653[_0x7e67('0x2e')]=_0x1e1653[_0x7e67('0x2e')][_0x7e67('0x31')]?_0x1e1653[_0x7e67('0x2e')]:_0x279019['model'];if(!_0x15186f[_0x7e67('0x2c')]['hasOwnProperty'](_0x7e67('0x32'))){_0x1e1653[_0x7e67('0x1a')]=qs['limit'](_0x15186f[_0x7e67('0x2c')][_0x7e67('0x1a')]);_0x1e1653['offset']=qs['offset'](_0x15186f[_0x7e67('0x2c')][_0x7e67('0x18')]);}_0x1e1653[_0x7e67('0x33')]=qs[_0x7e67('0x34')](_0x15186f[_0x7e67('0x2c')]['sort']);_0x1e1653[_0x7e67('0x35')]=qs[_0x7e67('0x2d')](_[_0x7e67('0x36')](_0x15186f[_0x7e67('0x2c')],_0x279019[_0x7e67('0x2d')]),_0x1fa95f);if(_0x15186f[_0x7e67('0x2c')][_0x7e67('0x37')]){_0x1e1653[_0x7e67('0x35')]=_['merge'](_0x1e1653[_0x7e67('0x35')],{'$or':_[_0x7e67('0x27')](_0x1fa95f,function(_0x2c4190){if(_0x2c4190[_0x7e67('0x2a')]!==_0x7e67('0x38')){var _0x2c5bd3={};_0x2c5bd3[_0x2c4190[_0x7e67('0x24')]]={'$like':'%'+_0x15186f['query'][_0x7e67('0x37')]+'%'};return _0x2c5bd3;}})});}_0x1e1653=_[_0x7e67('0x39')]({},_0x1e1653,_0x15186f[_0x7e67('0x3a')]);var _0x3ce632={'where':_0x1e1653['where']};return db[_0x7e67('0x28')][_0x7e67('0x1b')](_0x3ce632)['then'](function(_0x477dee){_0x415abe[_0x7e67('0x1b')]=_0x477dee;if(_0x15186f[_0x7e67('0x2c')]['includeAll']){_0x1e1653[_0x7e67('0x3b')]=[{'all':!![]}];}return db[_0x7e67('0x28')][_0x7e67('0x3c')](_0x1e1653);})['then'](function(_0xad57d1){_0x415abe[_0x7e67('0x3d')]=_0xad57d1;return _0x415abe;})[_0x7e67('0x21')](respondWithFilteredResult(_0x262597,_0x1e1653))[_0x7e67('0x3e')](handleError(_0x262597,null));};exports[_0x7e67('0x3f')]=function(_0x28dd3a,_0x3a6bdd){var _0x16beba={'raw':![],'where':{'id':_0x28dd3a[_0x7e67('0x40')]['id']}},_0xaa9ece={};_0xaa9ece['model']=_['keys'](db[_0x7e67('0x28')][_0x7e67('0x29')]);_0xaa9ece[_0x7e67('0x2c')]=_['keys'](_0x28dd3a[_0x7e67('0x2c')]);_0xaa9ece[_0x7e67('0x2d')]=_[_0x7e67('0x2f')](_0xaa9ece[_0x7e67('0x2b')],_0xaa9ece['query']);_0x16beba['attributes']=_['intersection'](_0xaa9ece['model'],qs['fields'](_0x28dd3a[_0x7e67('0x2c')]['fields']));_0x16beba[_0x7e67('0x2e')]=_0x16beba[_0x7e67('0x2e')][_0x7e67('0x31')]?_0x16beba[_0x7e67('0x2e')]:_0xaa9ece[_0x7e67('0x2b')];if(_0x28dd3a[_0x7e67('0x2c')][_0x7e67('0x41')]){_0x16beba[_0x7e67('0x3b')]=[{'all':!![]}];}_0x16beba=_[_0x7e67('0x39')]({},_0x16beba,_0x28dd3a[_0x7e67('0x3a')]);return db[_0x7e67('0x28')][_0x7e67('0x42')](_0x16beba)[_0x7e67('0x21')](handleEntityNotFound(_0x3a6bdd,null))['then'](respondWithResult(_0x3a6bdd,null))[_0x7e67('0x3e')](handleError(_0x3a6bdd,null));};exports[_0x7e67('0x43')]=function(_0x4e3c0f,_0x5dcc9f){return db['ServicenowConfiguration'][_0x7e67('0x43')](_0x4e3c0f[_0x7e67('0x44')],{})[_0x7e67('0x21')](respondWithResult(_0x5dcc9f,0xc9))[_0x7e67('0x3e')](handleError(_0x5dcc9f,null));};exports[_0x7e67('0x20')]=function(_0x1ba2a8,_0x3ae0ee){if(_0x1ba2a8[_0x7e67('0x44')]['id']){delete _0x1ba2a8[_0x7e67('0x44')]['id'];}return db['ServicenowConfiguration'][_0x7e67('0x42')]({'where':{'id':_0x1ba2a8['params']['id']}})[_0x7e67('0x21')](handleEntityNotFound(_0x3ae0ee,null))[_0x7e67('0x21')](saveUpdates(_0x1ba2a8[_0x7e67('0x44')],null))[_0x7e67('0x21')](respondWithResult(_0x3ae0ee,null))['catch'](handleError(_0x3ae0ee,null));};exports[_0x7e67('0x22')]=function(_0x78a2fa,_0x55a867){return db['ServicenowConfiguration']['find']({'where':{'id':_0x78a2fa[_0x7e67('0x40')]['id']}})[_0x7e67('0x21')](handleEntityNotFound(_0x55a867,null))['then'](removeEntity(_0x55a867,null))['catch'](handleError(_0x55a867,null));};exports['getFields']=function(_0x19321c,_0xb9f706,_0x1048cc){var _0x1687e5={};var _0x3e3887={};var _0x3ba3c5;var _0x46e10d;return db[_0x7e67('0x28')][_0x7e67('0x45')]({'where':{'id':_0x19321c[_0x7e67('0x40')]['id']}})[_0x7e67('0x21')](handleEntityNotFound(_0xb9f706,null))[_0x7e67('0x21')](function(_0x174704){if(_0x174704){_0x3ba3c5=_0x174704;_0x3e3887[_0x7e67('0x2b')]=_[_0x7e67('0x46')](db[_0x7e67('0x47')][_0x7e67('0x29')]);_0x3e3887[_0x7e67('0x2c')]=_[_0x7e67('0x46')](_0x19321c[_0x7e67('0x2c')]);_0x3e3887[_0x7e67('0x2d')]=_[_0x7e67('0x2f')](_0x3e3887[_0x7e67('0x2b')],_0x3e3887['query']);_0x1687e5[_0x7e67('0x2e')]=_['intersection'](_0x3e3887['model'],qs['fields'](_0x19321c[_0x7e67('0x2c')][_0x7e67('0x30')]));_0x1687e5[_0x7e67('0x2e')]=_0x1687e5[_0x7e67('0x2e')][_0x7e67('0x31')]?_0x1687e5[_0x7e67('0x2e')]:_0x3e3887['model'];_0x1687e5['order']=qs['sort'](_0x19321c[_0x7e67('0x2c')][_0x7e67('0x34')]);_0x1687e5[_0x7e67('0x35')]=qs[_0x7e67('0x2d')](_[_0x7e67('0x36')](_0x19321c[_0x7e67('0x2c')],_0x3e3887[_0x7e67('0x2d')]));if(_0x19321c[_0x7e67('0x2c')]['filter']){_0x1687e5[_0x7e67('0x35')]=_[_0x7e67('0x39')](_0x1687e5[_0x7e67('0x35')],{'$or':_['map'](_0x1687e5[_0x7e67('0x2e')],function(_0x14b42d){var _0x2bf4e3={};_0x2bf4e3[_0x14b42d]={'$like':'%'+_0x19321c[_0x7e67('0x2c')][_0x7e67('0x37')]+'%'};return _0x2bf4e3;})});}_0x1687e5=_[_0x7e67('0x39')]({},_0x1687e5,_0x19321c[_0x7e67('0x3a')]);return _0x3ba3c5[_0x7e67('0x48')](_0x1687e5);}})[_0x7e67('0x21')](function(_0x19210c){if(_0x19210c){_0x46e10d=_0x19210c[_0x7e67('0x31')];if(!_0x19321c[_0x7e67('0x2c')][_0x7e67('0x49')](_0x7e67('0x32'))){_0x1687e5['limit']=qs['limit'](_0x19321c[_0x7e67('0x2c')][_0x7e67('0x1a')]);_0x1687e5[_0x7e67('0x18')]=qs[_0x7e67('0x18')](_0x19321c[_0x7e67('0x2c')][_0x7e67('0x18')]);}return _0x3ba3c5['getFields'](_0x1687e5);}})[_0x7e67('0x21')](function(_0x533e6a){if(_0x533e6a){return _0x533e6a?{'count':_0x46e10d,'rows':_0x533e6a}:null;}})[_0x7e67('0x21')](respondWithResult(_0xb9f706,null))['catch'](handleError(_0xb9f706,null));};exports[_0x7e67('0x4a')]=function(_0x3dc738,_0x94520a,_0x4969da){var _0x24ff7d={};var _0x5b63c8={};var _0x2b7416;var _0x58f80a;return db[_0x7e67('0x28')][_0x7e67('0x45')]({'where':{'id':_0x3dc738[_0x7e67('0x40')]['id']}})[_0x7e67('0x21')](handleEntityNotFound(_0x94520a,null))['then'](function(_0x40285c){if(_0x40285c){_0x2b7416=_0x40285c;_0x5b63c8[_0x7e67('0x2b')]=_[_0x7e67('0x46')](db[_0x7e67('0x47')][_0x7e67('0x29')]);_0x5b63c8[_0x7e67('0x2c')]=_[_0x7e67('0x46')](_0x3dc738[_0x7e67('0x2c')]);_0x5b63c8[_0x7e67('0x2d')]=_[_0x7e67('0x2f')](_0x5b63c8[_0x7e67('0x2b')],_0x5b63c8['query']);_0x24ff7d[_0x7e67('0x2e')]=_[_0x7e67('0x2f')](_0x5b63c8[_0x7e67('0x2b')],qs[_0x7e67('0x30')](_0x3dc738['query']['fields']));_0x24ff7d['attributes']=_0x24ff7d['attributes']['length']?_0x24ff7d['attributes']:_0x5b63c8[_0x7e67('0x2b')];_0x24ff7d['order']=qs['sort'](_0x3dc738[_0x7e67('0x2c')][_0x7e67('0x34')]);_0x24ff7d[_0x7e67('0x35')]=qs[_0x7e67('0x2d')](_[_0x7e67('0x36')](_0x3dc738[_0x7e67('0x2c')],_0x5b63c8[_0x7e67('0x2d')]));if(_0x3dc738[_0x7e67('0x2c')][_0x7e67('0x37')]){_0x24ff7d[_0x7e67('0x35')]=_[_0x7e67('0x39')](_0x24ff7d[_0x7e67('0x35')],{'$or':_['map'](_0x24ff7d[_0x7e67('0x2e')],function(_0x4f4b52){var _0x308ff2={};_0x308ff2[_0x4f4b52]={'$like':'%'+_0x3dc738[_0x7e67('0x2c')][_0x7e67('0x37')]+'%'};return _0x308ff2;})});}_0x24ff7d=_['merge']({},_0x24ff7d,_0x3dc738[_0x7e67('0x3a')]);return _0x2b7416['getSubjects'](_0x24ff7d);}})[_0x7e67('0x21')](function(_0x369431){if(_0x369431){_0x58f80a=_0x369431['length'];if(!_0x3dc738[_0x7e67('0x2c')]['hasOwnProperty'](_0x7e67('0x32'))){_0x24ff7d['limit']=qs[_0x7e67('0x1a')](_0x3dc738[_0x7e67('0x2c')][_0x7e67('0x1a')]);_0x24ff7d[_0x7e67('0x18')]=qs[_0x7e67('0x18')](_0x3dc738[_0x7e67('0x2c')][_0x7e67('0x18')]);}return _0x2b7416[_0x7e67('0x4a')](_0x24ff7d);}})['then'](function(_0x574b80){if(_0x574b80){return _0x574b80?{'count':_0x58f80a,'rows':_0x574b80}:null;}})[_0x7e67('0x21')](respondWithResult(_0x94520a,null))[_0x7e67('0x3e')](handleError(_0x94520a,null));};exports[_0x7e67('0x4b')]=function(_0x217a7e,_0x2a6b9e,_0x5d9468){var _0x9970a6={};var _0x3b7051={};var _0x143cae;var _0x27ac21;return db[_0x7e67('0x28')][_0x7e67('0x45')]({'where':{'id':_0x217a7e[_0x7e67('0x40')]['id']}})['then'](handleEntityNotFound(_0x2a6b9e,null))['then'](function(_0x3811e3){if(_0x3811e3){_0x143cae=_0x3811e3;_0x3b7051['model']=_['keys'](db['ServicenowField'][_0x7e67('0x29')]);_0x3b7051[_0x7e67('0x2c')]=_[_0x7e67('0x46')](_0x217a7e[_0x7e67('0x2c')]);_0x3b7051['filters']=_[_0x7e67('0x2f')](_0x3b7051[_0x7e67('0x2b')],_0x3b7051[_0x7e67('0x2c')]);_0x9970a6[_0x7e67('0x2e')]=_[_0x7e67('0x2f')](_0x3b7051['model'],qs[_0x7e67('0x30')](_0x217a7e['query']['fields']));_0x9970a6[_0x7e67('0x2e')]=_0x9970a6[_0x7e67('0x2e')]['length']?_0x9970a6['attributes']:_0x3b7051[_0x7e67('0x2b')];_0x9970a6[_0x7e67('0x33')]=qs[_0x7e67('0x34')](_0x217a7e[_0x7e67('0x2c')][_0x7e67('0x34')]);_0x9970a6[_0x7e67('0x35')]=qs['filters'](_[_0x7e67('0x36')](_0x217a7e[_0x7e67('0x2c')],_0x3b7051[_0x7e67('0x2d')]));if(_0x217a7e[_0x7e67('0x2c')][_0x7e67('0x37')]){_0x9970a6[_0x7e67('0x35')]=_['merge'](_0x9970a6[_0x7e67('0x35')],{'$or':_['map'](_0x9970a6['attributes'],function(_0x2f033e){var _0x1267db={};_0x1267db[_0x2f033e]={'$like':'%'+_0x217a7e[_0x7e67('0x2c')][_0x7e67('0x37')]+'%'};return _0x1267db;})});}_0x9970a6=_['merge']({},_0x9970a6,_0x217a7e[_0x7e67('0x3a')]);return _0x143cae['getDescriptions'](_0x9970a6);}})[_0x7e67('0x21')](function(_0x18eee8){if(_0x18eee8){_0x27ac21=_0x18eee8[_0x7e67('0x31')];if(!_0x217a7e[_0x7e67('0x2c')][_0x7e67('0x49')](_0x7e67('0x32'))){_0x9970a6[_0x7e67('0x1a')]=qs[_0x7e67('0x1a')](_0x217a7e[_0x7e67('0x2c')]['limit']);_0x9970a6['offset']=qs[_0x7e67('0x18')](_0x217a7e['query'][_0x7e67('0x18')]);}return _0x143cae[_0x7e67('0x4b')](_0x9970a6);}})['then'](function(_0x445138){if(_0x445138){return _0x445138?{'count':_0x27ac21,'rows':_0x445138}:null;}})['then'](respondWithResult(_0x2a6b9e,null))[_0x7e67('0x3e')](handleError(_0x2a6b9e,null));}; \ No newline at end of file +var _0xcc4e=['ServicenowField','pick','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','to-csv','querystring','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','apply','reject','update','destroy','then','error','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','getFields','findOne'];(function(_0x10986c,_0x286bf5){var _0xe5a386=function(_0xaa404){while(--_0xaa404){_0x10986c['push'](_0x10986c['shift']());}};_0xe5a386(++_0x286bf5);}(_0xcc4e,0x194));var _0xecc4=function(_0x34cd94,_0x4a6def){_0x34cd94=_0x34cd94-0x0;var _0x1c4da3=_0xcc4e[_0x34cd94];return _0x1c4da3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xecc4('0x0'));var zipdir=require(_0xecc4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xecc4('0x2'));var moment=require(_0xecc4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xecc4('0x4'));var util=require(_0xecc4('0x5'));var path=require(_0xecc4('0x6'));var sox=require(_0xecc4('0x7'));var csv=require('to-csv');var ejs=require(_0xecc4('0x8'));var fs=require('fs');var fs_extra=require(_0xecc4('0x9'));var _=require('lodash');var squel=require(_0xecc4('0xa'));var crypto=require('crypto');var jsforce=require(_0xecc4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xecc4('0xc'));var querystring=require(_0xecc4('0xd'));var Papa=require('papaparse');var Redis=require(_0xecc4('0xe'));var authService=require(_0xecc4('0xf'));var qs=require(_0xecc4('0x10'));var as=require(_0xecc4('0x11'));var hardwareService=require(_0xecc4('0x12'));var logger=require(_0xecc4('0x13'))(_0xecc4('0x14'));var utils=require(_0xecc4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xecc4('0x16'));var db=require(_0xecc4('0x17'))['db'];function respondWithStatusCode(_0x198f00,_0x476a91){_0x476a91=_0x476a91||0xcc;return function(_0x279b6f){if(_0x279b6f){return _0x198f00[_0xecc4('0x18')](_0x476a91);}return _0x198f00[_0xecc4('0x19')](_0x476a91)[_0xecc4('0x1a')]();};}function respondWithResult(_0x2857c3,_0x1fd508){_0x1fd508=_0x1fd508||0xc8;return function(_0x53de8b){if(_0x53de8b){return _0x2857c3[_0xecc4('0x19')](_0x1fd508)[_0xecc4('0x1b')](_0x53de8b);}};}function respondWithFilteredResult(_0x3a293c,_0x3f3593){return function(_0x4e3c49){if(_0x4e3c49){var _0x5597f0=typeof _0x3f3593['offset']===_0xecc4('0x1c')&&typeof _0x3f3593[_0xecc4('0x1d')]===_0xecc4('0x1c');var _0x1abcfa=_0x4e3c49[_0xecc4('0x1e')];var _0x177ff1=_0x5597f0?0x0:_0x3f3593[_0xecc4('0x1f')];var _0x3c973b=_0x5597f0?_0x4e3c49[_0xecc4('0x1e')]:_0x3f3593['offset']+_0x3f3593[_0xecc4('0x1d')];var _0x3773b6;if(_0x3c973b>=_0x1abcfa){_0x3c973b=_0x1abcfa;_0x3773b6=0xc8;}else{_0x3773b6=0xce;}_0x3a293c[_0xecc4('0x19')](_0x3773b6);return _0x3a293c[_0xecc4('0x20')]('Content-Range',_0x177ff1+'-'+_0x3c973b+'/'+_0x1abcfa)[_0xecc4('0x1b')](_0x4e3c49);}return null;};}function patchUpdates(_0x550b11){return function(_0x4c7253){try{jsonpatch[_0xecc4('0x21')](_0x4c7253,_0x550b11,!![]);}catch(_0x258ff0){return BPromise[_0xecc4('0x22')](_0x258ff0);}return _0x4c7253['save']();};}function saveUpdates(_0x54a5d4,_0x306417){return function(_0x439607){if(_0x439607){return _0x439607[_0xecc4('0x23')](_0x54a5d4)['then'](function(_0xb5595a){return _0xb5595a;});}return null;};}function removeEntity(_0x588877,_0x1a0600){return function(_0x38adba){if(_0x38adba){return _0x38adba[_0xecc4('0x24')]()[_0xecc4('0x25')](function(){_0x588877[_0xecc4('0x19')](0xcc)[_0xecc4('0x1a')]();});}};}function handleEntityNotFound(_0x397751,_0x3846ed){return function(_0x27bd1a){if(!_0x27bd1a){_0x397751[_0xecc4('0x18')](0x194);}return _0x27bd1a;};}function handleError(_0x1a1db6,_0x1c4839){_0x1c4839=_0x1c4839||0x1f4;return function(_0x145a34){logger[_0xecc4('0x26')](_0x145a34['stack']);if(_0x145a34['name']){delete _0x145a34[_0xecc4('0x27')];}_0x1a1db6[_0xecc4('0x19')](_0x1c4839)[_0xecc4('0x28')](_0x145a34);};}exports[_0xecc4('0x29')]=function(_0x5e30f1,_0x5ed0db){var _0x15a400={},_0x297678={},_0x5eebbb={'count':0x0,'rows':[]};var _0x582b9d=_['map'](db[_0xecc4('0x2a')][_0xecc4('0x2b')],function(_0x162fa1){return{'name':_0x162fa1[_0xecc4('0x2c')],'type':_0x162fa1[_0xecc4('0x2d')][_0xecc4('0x2e')]};});_0x297678[_0xecc4('0x2f')]=_[_0xecc4('0x30')](_0x582b9d,_0xecc4('0x27'));_0x297678[_0xecc4('0x31')]=_[_0xecc4('0x32')](_0x5e30f1[_0xecc4('0x31')]);_0x297678[_0xecc4('0x33')]=_['intersection'](_0x297678['model'],_0x297678[_0xecc4('0x31')]);_0x15a400[_0xecc4('0x34')]=_[_0xecc4('0x35')](_0x297678[_0xecc4('0x2f')],qs[_0xecc4('0x36')](_0x5e30f1[_0xecc4('0x31')][_0xecc4('0x36')]));_0x15a400[_0xecc4('0x34')]=_0x15a400['attributes'][_0xecc4('0x37')]?_0x15a400['attributes']:_0x297678['model'];if(!_0x5e30f1[_0xecc4('0x31')][_0xecc4('0x38')](_0xecc4('0x39'))){_0x15a400['limit']=qs[_0xecc4('0x1d')](_0x5e30f1[_0xecc4('0x31')][_0xecc4('0x1d')]);_0x15a400[_0xecc4('0x1f')]=qs[_0xecc4('0x1f')](_0x5e30f1[_0xecc4('0x31')][_0xecc4('0x1f')]);}_0x15a400[_0xecc4('0x3a')]=qs[_0xecc4('0x3b')](_0x5e30f1['query']['sort']);_0x15a400[_0xecc4('0x3c')]=qs[_0xecc4('0x33')](_['pick'](_0x5e30f1[_0xecc4('0x31')],_0x297678[_0xecc4('0x33')]),_0x582b9d);if(_0x5e30f1[_0xecc4('0x31')]['filter']){_0x15a400[_0xecc4('0x3c')]=_['merge'](_0x15a400[_0xecc4('0x3c')],{'$or':_[_0xecc4('0x30')](_0x582b9d,function(_0x1015de){if(_0x1015de[_0xecc4('0x2d')]!=='VIRTUAL'){var _0x56371c={};_0x56371c[_0x1015de['name']]={'$like':'%'+_0x5e30f1['query'][_0xecc4('0x3d')]+'%'};return _0x56371c;}})});}_0x15a400=_[_0xecc4('0x3e')]({},_0x15a400,_0x5e30f1[_0xecc4('0x3f')]);var _0x430036={'where':_0x15a400[_0xecc4('0x3c')]};return db[_0xecc4('0x2a')][_0xecc4('0x1e')](_0x430036)[_0xecc4('0x25')](function(_0x15db8e){_0x5eebbb[_0xecc4('0x1e')]=_0x15db8e;if(_0x5e30f1[_0xecc4('0x31')][_0xecc4('0x40')]){_0x15a400[_0xecc4('0x41')]=[{'all':!![]}];}return db[_0xecc4('0x2a')][_0xecc4('0x42')](_0x15a400);})[_0xecc4('0x25')](function(_0x4d8bcf){_0x5eebbb[_0xecc4('0x43')]=_0x4d8bcf;return _0x5eebbb;})[_0xecc4('0x25')](respondWithFilteredResult(_0x5ed0db,_0x15a400))['catch'](handleError(_0x5ed0db,null));};exports[_0xecc4('0x44')]=function(_0x476697,_0x2bbe3e){var _0x11705e={'raw':![],'where':{'id':_0x476697[_0xecc4('0x45')]['id']}},_0x1177ac={};_0x1177ac[_0xecc4('0x2f')]=_['keys'](db[_0xecc4('0x2a')][_0xecc4('0x2b')]);_0x1177ac[_0xecc4('0x31')]=_[_0xecc4('0x32')](_0x476697[_0xecc4('0x31')]);_0x1177ac[_0xecc4('0x33')]=_[_0xecc4('0x35')](_0x1177ac['model'],_0x1177ac['query']);_0x11705e[_0xecc4('0x34')]=_[_0xecc4('0x35')](_0x1177ac[_0xecc4('0x2f')],qs[_0xecc4('0x36')](_0x476697[_0xecc4('0x31')][_0xecc4('0x36')]));_0x11705e[_0xecc4('0x34')]=_0x11705e['attributes'][_0xecc4('0x37')]?_0x11705e['attributes']:_0x1177ac[_0xecc4('0x2f')];if(_0x476697[_0xecc4('0x31')][_0xecc4('0x40')]){_0x11705e[_0xecc4('0x41')]=[{'all':!![]}];}_0x11705e=_[_0xecc4('0x3e')]({},_0x11705e,_0x476697[_0xecc4('0x3f')]);return db['ServicenowConfiguration']['find'](_0x11705e)[_0xecc4('0x25')](handleEntityNotFound(_0x2bbe3e,null))[_0xecc4('0x25')](respondWithResult(_0x2bbe3e,null))[_0xecc4('0x46')](handleError(_0x2bbe3e,null));};exports[_0xecc4('0x47')]=function(_0x145306,_0x584142){return db[_0xecc4('0x2a')]['create'](_0x145306[_0xecc4('0x48')],{})[_0xecc4('0x25')](respondWithResult(_0x584142,0xc9))['catch'](handleError(_0x584142,null));};exports[_0xecc4('0x23')]=function(_0x4e595c,_0x79e433){if(_0x4e595c[_0xecc4('0x48')]['id']){delete _0x4e595c[_0xecc4('0x48')]['id'];}return db[_0xecc4('0x2a')][_0xecc4('0x49')]({'where':{'id':_0x4e595c[_0xecc4('0x45')]['id']}})[_0xecc4('0x25')](handleEntityNotFound(_0x79e433,null))['then'](saveUpdates(_0x4e595c[_0xecc4('0x48')],null))[_0xecc4('0x25')](respondWithResult(_0x79e433,null))[_0xecc4('0x46')](handleError(_0x79e433,null));};exports['destroy']=function(_0x285548,_0x377f5a){return db[_0xecc4('0x2a')][_0xecc4('0x49')]({'where':{'id':_0x285548[_0xecc4('0x45')]['id']}})[_0xecc4('0x25')](handleEntityNotFound(_0x377f5a,null))[_0xecc4('0x25')](removeEntity(_0x377f5a,null))[_0xecc4('0x46')](handleError(_0x377f5a,null));};exports[_0xecc4('0x4a')]=function(_0x1ee49a,_0x2e70d5,_0x257bbb){var _0x4479ba={};var _0x15cd79={};var _0xa5af19;var _0x46968e;return db[_0xecc4('0x2a')][_0xecc4('0x4b')]({'where':{'id':_0x1ee49a[_0xecc4('0x45')]['id']}})[_0xecc4('0x25')](handleEntityNotFound(_0x2e70d5,null))[_0xecc4('0x25')](function(_0x668597){if(_0x668597){_0xa5af19=_0x668597;_0x15cd79[_0xecc4('0x2f')]=_[_0xecc4('0x32')](db[_0xecc4('0x4c')]['rawAttributes']);_0x15cd79[_0xecc4('0x31')]=_[_0xecc4('0x32')](_0x1ee49a[_0xecc4('0x31')]);_0x15cd79[_0xecc4('0x33')]=_['intersection'](_0x15cd79[_0xecc4('0x2f')],_0x15cd79['query']);_0x4479ba[_0xecc4('0x34')]=_['intersection'](_0x15cd79[_0xecc4('0x2f')],qs['fields'](_0x1ee49a[_0xecc4('0x31')][_0xecc4('0x36')]));_0x4479ba[_0xecc4('0x34')]=_0x4479ba[_0xecc4('0x34')]['length']?_0x4479ba[_0xecc4('0x34')]:_0x15cd79['model'];_0x4479ba['order']=qs[_0xecc4('0x3b')](_0x1ee49a[_0xecc4('0x31')]['sort']);_0x4479ba[_0xecc4('0x3c')]=qs[_0xecc4('0x33')](_[_0xecc4('0x4d')](_0x1ee49a[_0xecc4('0x31')],_0x15cd79[_0xecc4('0x33')]));if(_0x1ee49a['query'][_0xecc4('0x3d')]){_0x4479ba['where']=_[_0xecc4('0x3e')](_0x4479ba['where'],{'$or':_[_0xecc4('0x30')](_0x4479ba[_0xecc4('0x34')],function(_0x221c07){var _0x2f4663={};_0x2f4663[_0x221c07]={'$like':'%'+_0x1ee49a[_0xecc4('0x31')][_0xecc4('0x3d')]+'%'};return _0x2f4663;})});}_0x4479ba=_[_0xecc4('0x3e')]({},_0x4479ba,_0x1ee49a[_0xecc4('0x3f')]);return _0xa5af19[_0xecc4('0x4a')](_0x4479ba);}})['then'](function(_0x38692f){if(_0x38692f){_0x46968e=_0x38692f[_0xecc4('0x37')];if(!_0x1ee49a[_0xecc4('0x31')]['hasOwnProperty']('nolimit')){_0x4479ba[_0xecc4('0x1d')]=qs[_0xecc4('0x1d')](_0x1ee49a[_0xecc4('0x31')][_0xecc4('0x1d')]);_0x4479ba[_0xecc4('0x1f')]=qs[_0xecc4('0x1f')](_0x1ee49a['query'][_0xecc4('0x1f')]);}return _0xa5af19[_0xecc4('0x4a')](_0x4479ba);}})[_0xecc4('0x25')](function(_0x561003){if(_0x561003){return _0x561003?{'count':_0x46968e,'rows':_0x561003}:null;}})[_0xecc4('0x25')](respondWithResult(_0x2e70d5,null))[_0xecc4('0x46')](handleError(_0x2e70d5,null));};exports['getSubjects']=function(_0x39f33a,_0x13bd27,_0x3431b1){var _0x19d640={};var _0x4325c5={};var _0x3245d0;var _0x370aca;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x39f33a['params']['id']}})['then'](handleEntityNotFound(_0x13bd27,null))[_0xecc4('0x25')](function(_0x46b7a7){if(_0x46b7a7){_0x3245d0=_0x46b7a7;_0x4325c5[_0xecc4('0x2f')]=_[_0xecc4('0x32')](db[_0xecc4('0x4c')][_0xecc4('0x2b')]);_0x4325c5[_0xecc4('0x31')]=_[_0xecc4('0x32')](_0x39f33a[_0xecc4('0x31')]);_0x4325c5[_0xecc4('0x33')]=_[_0xecc4('0x35')](_0x4325c5[_0xecc4('0x2f')],_0x4325c5[_0xecc4('0x31')]);_0x19d640[_0xecc4('0x34')]=_['intersection'](_0x4325c5['model'],qs[_0xecc4('0x36')](_0x39f33a[_0xecc4('0x31')][_0xecc4('0x36')]));_0x19d640[_0xecc4('0x34')]=_0x19d640[_0xecc4('0x34')][_0xecc4('0x37')]?_0x19d640[_0xecc4('0x34')]:_0x4325c5[_0xecc4('0x2f')];_0x19d640['order']=qs['sort'](_0x39f33a['query'][_0xecc4('0x3b')]);_0x19d640[_0xecc4('0x3c')]=qs['filters'](_['pick'](_0x39f33a[_0xecc4('0x31')],_0x4325c5[_0xecc4('0x33')]));if(_0x39f33a[_0xecc4('0x31')][_0xecc4('0x3d')]){_0x19d640[_0xecc4('0x3c')]=_[_0xecc4('0x3e')](_0x19d640[_0xecc4('0x3c')],{'$or':_['map'](_0x19d640[_0xecc4('0x34')],function(_0x395334){var _0x2a4b6b={};_0x2a4b6b[_0x395334]={'$like':'%'+_0x39f33a['query'][_0xecc4('0x3d')]+'%'};return _0x2a4b6b;})});}_0x19d640=_[_0xecc4('0x3e')]({},_0x19d640,_0x39f33a[_0xecc4('0x3f')]);return _0x3245d0[_0xecc4('0x4e')](_0x19d640);}})[_0xecc4('0x25')](function(_0x42cab9){if(_0x42cab9){_0x370aca=_0x42cab9[_0xecc4('0x37')];if(!_0x39f33a['query'][_0xecc4('0x38')](_0xecc4('0x39'))){_0x19d640[_0xecc4('0x1d')]=qs['limit'](_0x39f33a[_0xecc4('0x31')][_0xecc4('0x1d')]);_0x19d640['offset']=qs[_0xecc4('0x1f')](_0x39f33a[_0xecc4('0x31')]['offset']);}return _0x3245d0[_0xecc4('0x4e')](_0x19d640);}})[_0xecc4('0x25')](function(_0x34f253){if(_0x34f253){return _0x34f253?{'count':_0x370aca,'rows':_0x34f253}:null;}})['then'](respondWithResult(_0x13bd27,null))[_0xecc4('0x46')](handleError(_0x13bd27,null));};exports['getDescriptions']=function(_0x50bc65,_0x34688b,_0x735504){var _0x80629f={};var _0x51ff85={};var _0x364f59;var _0x10b79c;return db[_0xecc4('0x2a')][_0xecc4('0x4b')]({'where':{'id':_0x50bc65[_0xecc4('0x45')]['id']}})[_0xecc4('0x25')](handleEntityNotFound(_0x34688b,null))[_0xecc4('0x25')](function(_0x53350d){if(_0x53350d){_0x364f59=_0x53350d;_0x51ff85[_0xecc4('0x2f')]=_[_0xecc4('0x32')](db['ServicenowField'][_0xecc4('0x2b')]);_0x51ff85[_0xecc4('0x31')]=_[_0xecc4('0x32')](_0x50bc65[_0xecc4('0x31')]);_0x51ff85['filters']=_[_0xecc4('0x35')](_0x51ff85[_0xecc4('0x2f')],_0x51ff85['query']);_0x80629f['attributes']=_[_0xecc4('0x35')](_0x51ff85[_0xecc4('0x2f')],qs['fields'](_0x50bc65['query'][_0xecc4('0x36')]));_0x80629f[_0xecc4('0x34')]=_0x80629f[_0xecc4('0x34')][_0xecc4('0x37')]?_0x80629f['attributes']:_0x51ff85['model'];_0x80629f[_0xecc4('0x3a')]=qs[_0xecc4('0x3b')](_0x50bc65[_0xecc4('0x31')][_0xecc4('0x3b')]);_0x80629f[_0xecc4('0x3c')]=qs[_0xecc4('0x33')](_['pick'](_0x50bc65['query'],_0x51ff85[_0xecc4('0x33')]));if(_0x50bc65[_0xecc4('0x31')][_0xecc4('0x3d')]){_0x80629f[_0xecc4('0x3c')]=_['merge'](_0x80629f[_0xecc4('0x3c')],{'$or':_[_0xecc4('0x30')](_0x80629f[_0xecc4('0x34')],function(_0x5819e0){var _0x318315={};_0x318315[_0x5819e0]={'$like':'%'+_0x50bc65[_0xecc4('0x31')]['filter']+'%'};return _0x318315;})});}_0x80629f=_[_0xecc4('0x3e')]({},_0x80629f,_0x50bc65[_0xecc4('0x3f')]);return _0x364f59[_0xecc4('0x4f')](_0x80629f);}})[_0xecc4('0x25')](function(_0x5e4680){if(_0x5e4680){_0x10b79c=_0x5e4680['length'];if(!_0x50bc65[_0xecc4('0x31')][_0xecc4('0x38')](_0xecc4('0x39'))){_0x80629f[_0xecc4('0x1d')]=qs[_0xecc4('0x1d')](_0x50bc65['query'][_0xecc4('0x1d')]);_0x80629f['offset']=qs['offset'](_0x50bc65['query'][_0xecc4('0x1f')]);}return _0x364f59[_0xecc4('0x4f')](_0x80629f);}})[_0xecc4('0x25')](function(_0x3096e7){if(_0x3096e7){return _0x3096e7?{'count':_0x10b79c,'rows':_0x3096e7}:null;}})[_0xecc4('0x25')](respondWithResult(_0x34688b,null))['catch'](handleError(_0x34688b,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 9a993a8..3c1e524 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 _0x7708=['../../config/environment','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','api','rimraf'];(function(_0x44cdea,_0x37862c){var _0x1021c0=function(_0x438a78){while(--_0x438a78){_0x44cdea['push'](_0x44cdea['shift']());}};_0x1021c0(++_0x37862c);}(_0x7708,0x188));var _0x8770=function(_0x21a2b3,_0x5d6564){_0x21a2b3=_0x21a2b3-0x0;var _0x4651a7=_0x7708[_0x21a2b3];return _0x4651a7;};'use strict';var _=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var logger=require('../../config/logger')(_0x8770('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x8770('0x5')]=function(_0x50bab7,_0x31390d){return _0x50bab7[_0x8770('0x6')](_0x8770('0x7'),attributes,{'tableName':_0x8770('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f08=['rimraf','./intServicenowConfiguration.attributes','define','int_servicenow_configurations','lodash','util','api','moment','request-promise','path'];(function(_0x18997a,_0x41fa1d){var _0x5a41b8=function(_0x3b609a){while(--_0x3b609a){_0x18997a['push'](_0x18997a['shift']());}};_0x5a41b8(++_0x41fa1d);}(_0x4f08,0x194));var _0x84f0=function(_0x594117,_0x1a4279){_0x594117=_0x594117-0x0;var _0x4e453a=_0x4f08[_0x594117];return _0x4e453a;};'use strict';var _=require(_0x84f0('0x0'));var util=require(_0x84f0('0x1'));var logger=require('../../config/logger')(_0x84f0('0x2'));var moment=require(_0x84f0('0x3'));var BPromise=require('bluebird');var rp=require(_0x84f0('0x4'));var fs=require('fs');var path=require(_0x84f0('0x5'));var rimraf=require(_0x84f0('0x6'));var config=require('../../config/environment');var attributes=require(_0x84f0('0x7'));module['exports']=function(_0x3886d6,_0x3a1161){return _0x3886d6[_0x84f0('0x8')]('ServicenowConfiguration',attributes,{'tableName':_0x84f0('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 1819491..35d33d7 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 _0x3bf9=['error','code','message','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x45681f,_0x1c29dc){var _0x511a5d=function(_0x1b43d2){while(--_0x1b43d2){_0x45681f['push'](_0x45681f['shift']());}};_0x511a5d(++_0x1c29dc);}(_0x3bf9,0x8b));var _0x93bf=function(_0x1b5080,_0x3e7cc9){_0x1b5080=_0x1b5080-0x0;var _0x195c87=_0x3bf9[_0x1b5080];return _0x195c87;};'use strict';var _=require('lodash');var util=require(_0x93bf('0x0'));var moment=require(_0x93bf('0x1'));var BPromise=require(_0x93bf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x93bf('0x3'));var db=require(_0x93bf('0x4'))['db'];var utils=require(_0x93bf('0x5'));var logger=require(_0x93bf('0x6'))(_0x93bf('0x7'));var config=require(_0x93bf('0x8'));var jayson=require(_0x93bf('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x31d618,_0x5cb814,_0x534e3f){return new BPromise(function(_0x31438a,_0x3b0e6c){return client[_0x93bf('0xa')](_0x31d618,_0x534e3f)[_0x93bf('0xb')](function(_0x180a62){logger[_0x93bf('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5cb814,'request\x20sent');logger['debug'](_0x93bf('0xd'),_0x5cb814,'request\x20sent',JSON[_0x93bf('0xe')](_0x180a62));if(_0x180a62['error']){if(_0x180a62[_0x93bf('0xf')][_0x93bf('0x10')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x5cb814,_0x180a62[_0x93bf('0xf')][_0x93bf('0x11')]);return _0x3b0e6c(_0x180a62[_0x93bf('0xf')]['message']);}logger[_0x93bf('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5cb814,_0x180a62[_0x93bf('0xf')][_0x93bf('0x11')]);return _0x31438a(_0x180a62[_0x93bf('0xf')]['message']);}else{logger[_0x93bf('0xc')](_0x93bf('0x12'),_0x5cb814,_0x93bf('0x13'));_0x31438a(_0x180a62[_0x93bf('0x14')][_0x93bf('0x11')]);}})[_0x93bf('0x15')](function(_0x42d838){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x5cb814,_0x42d838);_0x3b0e6c(_0x42d838);});});} \ No newline at end of file +var _0x7a08=['ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x3570fd,_0x1bbdf8){var _0x28aefd=function(_0x2ecc93){while(--_0x2ecc93){_0x3570fd['push'](_0x3570fd['shift']());}};_0x28aefd(++_0x1bbdf8);}(_0x7a08,0x15f));var _0x87a0=function(_0xecab6a,_0x3c768a){_0xecab6a=_0xecab6a-0x0;var _0x40b98b=_0x7a08[_0xecab6a];return _0x40b98b;};'use strict';var _=require(_0x87a0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x87a0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x87a0('0x2'));var logger=require(_0x87a0('0x3'))(_0x87a0('0x4'));var config=require('../../config/environment');var jayson=require(_0x87a0('0x5'));var client=jayson[_0x87a0('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57325f,_0x1d9212,_0x518977){return new BPromise(function(_0x690c3c,_0x23f4b2){return client[_0x87a0('0x7')](_0x57325f,_0x518977)[_0x87a0('0x8')](function(_0x377f42){logger['info'](_0x87a0('0x9'),_0x1d9212,_0x87a0('0xa'));logger[_0x87a0('0xb')](_0x87a0('0xc'),_0x1d9212,'request\x20sent',JSON[_0x87a0('0xd')](_0x377f42));if(_0x377f42[_0x87a0('0xe')]){if(_0x377f42[_0x87a0('0xe')][_0x87a0('0xf')]===0x1f4){logger['error'](_0x87a0('0x9'),_0x1d9212,_0x377f42[_0x87a0('0xe')][_0x87a0('0x10')]);return _0x23f4b2(_0x377f42[_0x87a0('0xe')][_0x87a0('0x10')]);}logger['error'](_0x87a0('0x9'),_0x1d9212,_0x377f42[_0x87a0('0xe')][_0x87a0('0x10')]);return _0x690c3c(_0x377f42[_0x87a0('0xe')]['message']);}else{logger[_0x87a0('0x11')](_0x87a0('0x9'),_0x1d9212,_0x87a0('0xa'));_0x690c3c(_0x377f42[_0x87a0('0x12')]['message']);}})[_0x87a0('0x13')](function(_0x4b830e){logger[_0x87a0('0xe')](_0x87a0('0x9'),_0x1d9212,_0x4b830e);_0x23f4b2(_0x4b830e);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 53856d6..d4365f8 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 _0x601b=['create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./intServicenowField.controller','isAuthenticated','index','/:id','post'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x601b,0x9e));var _0xb601=function(_0x2a914c,_0x4d2614){_0x2a914c=_0x2a914c-0x0;var _0x30a598=_0x601b[_0x2a914c];return _0x30a598;};'use strict';var multer=require(_0xb601('0x0'));var util=require(_0xb601('0x1'));var path=require(_0xb601('0x2'));var timeout=require(_0xb601('0x3'));var express=require(_0xb601('0x4'));var router=express[_0xb601('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb601('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb601('0x7'));router['get']('/',auth[_0xb601('0x8')](),controller[_0xb601('0x9')]);router['get'](_0xb601('0xa'),auth[_0xb601('0x8')](),controller['show']);router[_0xb601('0xb')]('/',auth[_0xb601('0x8')](),controller[_0xb601('0xc')]);router[_0xb601('0xd')](_0xb601('0xa'),auth[_0xb601('0x8')](),controller[_0xb601('0xe')]);router[_0xb601('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xb601('0x10')]=router; \ No newline at end of file +var _0xc2ed=['post','create','put','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','isAuthenticated','index','get','/:id'];(function(_0x2139ff,_0x1ec8e5){var _0x55242f=function(_0x5ee07f){while(--_0x5ee07f){_0x2139ff['push'](_0x2139ff['shift']());}};_0x55242f(++_0x1ec8e5);}(_0xc2ed,0x72));var _0xdc2e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xc2ed[_0xea8947];return _0x2455e9;};'use strict';var multer=require(_0xdc2e('0x0'));var util=require(_0xdc2e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdc2e('0x2'));var router=express[_0xdc2e('0x3')]();var fs_extra=require(_0xdc2e('0x4'));var auth=require(_0xdc2e('0x5'));var interaction=require(_0xdc2e('0x6'));var config=require('../../config/environment');var controller=require(_0xdc2e('0x7'));router['get']('/',auth[_0xdc2e('0x8')](),controller[_0xdc2e('0x9')]);router[_0xdc2e('0xa')](_0xdc2e('0xb'),auth[_0xdc2e('0x8')](),controller['show']);router[_0xdc2e('0xc')]('/',auth[_0xdc2e('0x8')](),controller[_0xdc2e('0xd')]);router[_0xdc2e('0xe')](_0xdc2e('0xb'),auth[_0xdc2e('0x8')](),controller[_0xdc2e('0xf')]);router[_0xdc2e('0x10')](_0xdc2e('0xb'),auth[_0xdc2e('0x8')](),controller['destroy']);module[_0xdc2e('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 1b5db5a..8f86059 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 _0x2b37=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x9144c1,_0x157e52){var _0x45abe9=function(_0x548969){while(--_0x548969){_0x9144c1['push'](_0x9144c1['shift']());}};_0x45abe9(++_0x157e52);}(_0x2b37,0xb4));var _0x72b3=function(_0x7e8de,_0x13e3b6){_0x7e8de=_0x7e8de-0x0;var _0x55c822=_0x2b37[_0x7e8de];return _0x55c822;};'use strict';var Sequelize=require(_0x72b3('0x0'));module[_0x72b3('0x1')]={'type':{'type':Sequelize[_0x72b3('0x2')](_0x72b3('0x3'),_0x72b3('0x4'),_0x72b3('0x5'),_0x72b3('0x6'),_0x72b3('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x72b3('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x72b3('0x4'),_0x72b3('0x5'))},'keyContent':{'type':Sequelize[_0x72b3('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x72b3('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc921=['BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x416c1a,_0xe30f87){var _0x5a307e=function(_0x205021){while(--_0x205021){_0x416c1a['push'](_0x416c1a['shift']());}};_0x5a307e(++_0xe30f87);}(_0xc921,0x119));var _0x1c92=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xc921[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require('sequelize');module[_0x1c92('0x0')]={'type':{'type':Sequelize[_0x1c92('0x1')](_0x1c92('0x2'),_0x1c92('0x3'),_0x1c92('0x4'),_0x1c92('0x5'),'picklist'),'defaultValue':_0x1c92('0x2')},'content':{'type':Sequelize[_0x1c92('0x6')]},'key':{'type':Sequelize[_0x1c92('0x6')]},'keyType':{'type':Sequelize[_0x1c92('0x1')](_0x1c92('0x2'),_0x1c92('0x3'),_0x1c92('0x4'))},'keyContent':{'type':Sequelize[_0x1c92('0x6')]},'idField':{'type':Sequelize[_0x1c92('0x6')]},'nameField':{'type':Sequelize[_0x1c92('0x6')]},'customField':{'type':Sequelize[_0x1c92('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1c92('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 50fbb61..ff2c146 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 _0x7f9b=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','map','ServicenowField','rawAttributes','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','merge','type','filter','findAll','rows','show','params','keys','includeAll','options','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../config/license/hardware','../../config/license/util','../../mysqldb'];(function(_0x51f8b1,_0x45449e){var _0x198b35=function(_0x2ab243){while(--_0x2ab243){_0x51f8b1['push'](_0x51f8b1['shift']());}};_0x198b35(++_0x45449e);}(_0x7f9b,0x145));var _0xb7f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7f9b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb7f9('0x0'));var rimraf=require(_0xb7f9('0x1'));var zipdir=require(_0xb7f9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb7f9('0x3'));var moment=require(_0xb7f9('0x4'));var BPromise=require(_0xb7f9('0x5'));var Mustache=require(_0xb7f9('0x6'));var util=require(_0xb7f9('0x7'));var path=require(_0xb7f9('0x8'));var sox=require('sox');var csv=require(_0xb7f9('0x9'));var ejs=require(_0xb7f9('0xa'));var fs=require('fs');var fs_extra=require(_0xb7f9('0xb'));var _=require('lodash');var squel=require(_0xb7f9('0xc'));var crypto=require(_0xb7f9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb7f9('0xe'));var toCsv=require(_0xb7f9('0x9'));var querystring=require(_0xb7f9('0xf'));var Papa=require(_0xb7f9('0x10'));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(_0xb7f9('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb7f9('0x12'));var db=require(_0xb7f9('0x13'))['db'];function respondWithStatusCode(_0x27629a,_0xcffa37){_0xcffa37=_0xcffa37||0xcc;return function(_0x48ec58){if(_0x48ec58){return _0x27629a[_0xb7f9('0x14')](_0xcffa37);}return _0x27629a[_0xb7f9('0x15')](_0xcffa37)[_0xb7f9('0x16')]();};}function respondWithResult(_0x37db6f,_0xa5df29){_0xa5df29=_0xa5df29||0xc8;return function(_0x456596){if(_0x456596){return _0x37db6f[_0xb7f9('0x15')](_0xa5df29)[_0xb7f9('0x17')](_0x456596);}};}function respondWithFilteredResult(_0x5ae097,_0x54f140){return function(_0x396d6a){if(_0x396d6a){var _0x27720a=typeof _0x54f140[_0xb7f9('0x18')]===_0xb7f9('0x19')&&typeof _0x54f140[_0xb7f9('0x1a')]===_0xb7f9('0x19');var _0x489bca=_0x396d6a['count'];var _0xe9735b=_0x27720a?0x0:_0x54f140[_0xb7f9('0x18')];var _0x5e9016=_0x27720a?_0x396d6a[_0xb7f9('0x1b')]:_0x54f140[_0xb7f9('0x18')]+_0x54f140['limit'];var _0x49997e;if(_0x5e9016>=_0x489bca){_0x5e9016=_0x489bca;_0x49997e=0xc8;}else{_0x49997e=0xce;}_0x5ae097[_0xb7f9('0x15')](_0x49997e);return _0x5ae097[_0xb7f9('0x1c')](_0xb7f9('0x1d'),_0xe9735b+'-'+_0x5e9016+'/'+_0x489bca)[_0xb7f9('0x17')](_0x396d6a);}return null;};}function patchUpdates(_0x42f24c){return function(_0x441d3d){try{jsonpatch[_0xb7f9('0x1e')](_0x441d3d,_0x42f24c,!![]);}catch(_0x298a2e){return BPromise[_0xb7f9('0x1f')](_0x298a2e);}return _0x441d3d[_0xb7f9('0x20')]();};}function saveUpdates(_0xf37fe9,_0x4a93eb){return function(_0x1ed29b){if(_0x1ed29b){return _0x1ed29b[_0xb7f9('0x21')](_0xf37fe9)[_0xb7f9('0x22')](function(_0xc1da45){return _0xc1da45;});}return null;};}function removeEntity(_0x49a1bc,_0x24b0ed){return function(_0x16faf9){if(_0x16faf9){return _0x16faf9['destroy']()[_0xb7f9('0x22')](function(){_0x49a1bc[_0xb7f9('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58fc36,_0xe4979f){return function(_0x5a2fdf){if(!_0x5a2fdf){_0x58fc36[_0xb7f9('0x14')](0x194);}return _0x5a2fdf;};}function handleError(_0x1ed5f0,_0x59bfd8){_0x59bfd8=_0x59bfd8||0x1f4;return function(_0x26e47e){logger[_0xb7f9('0x23')](_0x26e47e['stack']);if(_0x26e47e[_0xb7f9('0x24')]){delete _0x26e47e['name'];}_0x1ed5f0['status'](_0x59bfd8)[_0xb7f9('0x25')](_0x26e47e);};}exports['index']=function(_0x3297d6,_0xacfa32){var _0x5cee46={},_0x59238b={},_0xd2a5bf={'count':0x0,'rows':[]};var _0x1f0f3c=_[_0xb7f9('0x26')](db[_0xb7f9('0x27')][_0xb7f9('0x28')],function(_0x270fb9){return{'name':_0x270fb9['fieldName'],'type':_0x270fb9['type'][_0xb7f9('0x29')]};});_0x59238b['model']=_[_0xb7f9('0x26')](_0x1f0f3c,'name');_0x59238b[_0xb7f9('0x2a')]=_['keys'](_0x3297d6[_0xb7f9('0x2a')]);_0x59238b['filters']=_[_0xb7f9('0x2b')](_0x59238b[_0xb7f9('0x2c')],_0x59238b[_0xb7f9('0x2a')]);_0x5cee46['attributes']=_[_0xb7f9('0x2b')](_0x59238b['model'],qs[_0xb7f9('0x2d')](_0x3297d6[_0xb7f9('0x2a')]['fields']));_0x5cee46[_0xb7f9('0x2e')]=_0x5cee46[_0xb7f9('0x2e')][_0xb7f9('0x2f')]?_0x5cee46[_0xb7f9('0x2e')]:_0x59238b['model'];if(!_0x3297d6['query'][_0xb7f9('0x30')](_0xb7f9('0x31'))){_0x5cee46['limit']=qs[_0xb7f9('0x1a')](_0x3297d6[_0xb7f9('0x2a')][_0xb7f9('0x1a')]);_0x5cee46['offset']=qs[_0xb7f9('0x18')](_0x3297d6[_0xb7f9('0x2a')]['offset']);}_0x5cee46[_0xb7f9('0x32')]=qs['sort'](_0x3297d6['query']['sort']);_0x5cee46[_0xb7f9('0x33')]=qs[_0xb7f9('0x34')](_[_0xb7f9('0x35')](_0x3297d6[_0xb7f9('0x2a')],_0x59238b[_0xb7f9('0x34')]),_0x1f0f3c);if(_0x3297d6[_0xb7f9('0x2a')]['filter']){_0x5cee46['where']=_[_0xb7f9('0x36')](_0x5cee46[_0xb7f9('0x33')],{'$or':_[_0xb7f9('0x26')](_0x1f0f3c,function(_0x4f33f7){if(_0x4f33f7[_0xb7f9('0x37')]!=='VIRTUAL'){var _0x2f1a1e={};_0x2f1a1e[_0x4f33f7[_0xb7f9('0x24')]]={'$like':'%'+_0x3297d6['query'][_0xb7f9('0x38')]+'%'};return _0x2f1a1e;}})});}_0x5cee46=_[_0xb7f9('0x36')]({},_0x5cee46,_0x3297d6['options']);var _0xfbfa14={'where':_0x5cee46['where']};return db[_0xb7f9('0x27')][_0xb7f9('0x1b')](_0xfbfa14)[_0xb7f9('0x22')](function(_0x290363){_0xd2a5bf['count']=_0x290363;if(_0x3297d6[_0xb7f9('0x2a')]['includeAll']){_0x5cee46['include']=[{'all':!![]}];}return db['ServicenowField'][_0xb7f9('0x39')](_0x5cee46);})[_0xb7f9('0x22')](function(_0x1be655){_0xd2a5bf[_0xb7f9('0x3a')]=_0x1be655;return _0xd2a5bf;})['then'](respondWithFilteredResult(_0xacfa32,_0x5cee46))['catch'](handleError(_0xacfa32,null));};exports[_0xb7f9('0x3b')]=function(_0x2bae75,_0x2d2716){var _0x57a569={'raw':!![],'where':{'id':_0x2bae75[_0xb7f9('0x3c')]['id']}},_0x5512be={};_0x5512be[_0xb7f9('0x2c')]=_['keys'](db[_0xb7f9('0x27')]['rawAttributes']);_0x5512be[_0xb7f9('0x2a')]=_[_0xb7f9('0x3d')](_0x2bae75['query']);_0x5512be[_0xb7f9('0x34')]=_['intersection'](_0x5512be[_0xb7f9('0x2c')],_0x5512be[_0xb7f9('0x2a')]);_0x57a569['attributes']=_[_0xb7f9('0x2b')](_0x5512be[_0xb7f9('0x2c')],qs[_0xb7f9('0x2d')](_0x2bae75[_0xb7f9('0x2a')]['fields']));_0x57a569['attributes']=_0x57a569[_0xb7f9('0x2e')][_0xb7f9('0x2f')]?_0x57a569[_0xb7f9('0x2e')]:_0x5512be[_0xb7f9('0x2c')];if(_0x2bae75[_0xb7f9('0x2a')][_0xb7f9('0x3e')]){_0x57a569['include']=[{'all':!![]}];}_0x57a569=_[_0xb7f9('0x36')]({},_0x57a569,_0x2bae75[_0xb7f9('0x3f')]);return db['ServicenowField'][_0xb7f9('0x40')](_0x57a569)[_0xb7f9('0x22')](handleEntityNotFound(_0x2d2716,null))[_0xb7f9('0x22')](respondWithResult(_0x2d2716,null))[_0xb7f9('0x41')](handleError(_0x2d2716,null));};exports[_0xb7f9('0x42')]=function(_0x2a15b0,_0x4c34f9){return db['ServicenowField']['create'](_0x2a15b0['body'],{})[_0xb7f9('0x22')](respondWithResult(_0x4c34f9,0xc9))[_0xb7f9('0x41')](handleError(_0x4c34f9,null));};exports[_0xb7f9('0x21')]=function(_0x9f0642,_0x5252bd){if(_0x9f0642['body']['id']){delete _0x9f0642['body']['id'];}return db[_0xb7f9('0x27')][_0xb7f9('0x40')]({'where':{'id':_0x9f0642['params']['id']}})['then'](handleEntityNotFound(_0x5252bd,null))[_0xb7f9('0x22')](saveUpdates(_0x9f0642[_0xb7f9('0x43')],null))[_0xb7f9('0x22')](respondWithResult(_0x5252bd,null))['catch'](handleError(_0x5252bd,null));};exports[_0xb7f9('0x44')]=function(_0x1064d0,_0x2718af){return db[_0xb7f9('0x27')][_0xb7f9('0x40')]({'where':{'id':_0x1064d0[_0xb7f9('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2718af,null))['then'](removeEntity(_0x2718af,null))['catch'](handleError(_0x2718af,null));}; \ No newline at end of file +var _0x5431=['set','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','ServicenowField','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','attributes','length','includeAll','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count'];(function(_0x47896b,_0x121912){var _0x4f8db2=function(_0x3b3bfa){while(--_0x3b3bfa){_0x47896b['push'](_0x47896b['shift']());}};_0x4f8db2(++_0x121912);}(_0x5431,0x1af));var _0x1543=function(_0x24394a,_0x5940a3){_0x24394a=_0x24394a-0x0;var _0x18120d=_0x5431[_0x24394a];return _0x18120d;};'use strict';var emlformat=require(_0x1543('0x0'));var rimraf=require(_0x1543('0x1'));var zipdir=require(_0x1543('0x2'));var jsonpatch=require(_0x1543('0x3'));var rp=require(_0x1543('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1543('0x5'));var util=require('util');var path=require(_0x1543('0x6'));var sox=require(_0x1543('0x7'));var csv=require('to-csv');var ejs=require(_0x1543('0x8'));var fs=require('fs');var fs_extra=require(_0x1543('0x9'));var _=require('lodash');var squel=require(_0x1543('0xa'));var crypto=require('crypto');var jsforce=require(_0x1543('0xb'));var deskjs=require(_0x1543('0xc'));var toCsv=require(_0x1543('0xd'));var querystring=require(_0x1543('0xe'));var Papa=require('papaparse');var Redis=require(_0x1543('0xf'));var authService=require(_0x1543('0x10'));var qs=require(_0x1543('0x11'));var as=require(_0x1543('0x12'));var hardwareService=require(_0x1543('0x13'));var logger=require(_0x1543('0x14'))(_0x1543('0x15'));var utils=require(_0x1543('0x16'));var config=require(_0x1543('0x17'));var licenseUtil=require(_0x1543('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11dbc9,_0x2516de){_0x2516de=_0x2516de||0xcc;return function(_0x27cfcd){if(_0x27cfcd){return _0x11dbc9['sendStatus'](_0x2516de);}return _0x11dbc9[_0x1543('0x19')](_0x2516de)['end']();};}function respondWithResult(_0x124e6a,_0xbaedf1){_0xbaedf1=_0xbaedf1||0xc8;return function(_0x4e0940){if(_0x4e0940){return _0x124e6a[_0x1543('0x19')](_0xbaedf1)[_0x1543('0x1a')](_0x4e0940);}};}function respondWithFilteredResult(_0x25c356,_0x55868d){return function(_0x1258d6){if(_0x1258d6){var _0x3c403e=typeof _0x55868d[_0x1543('0x1b')]==='undefined'&&typeof _0x55868d[_0x1543('0x1c')]===_0x1543('0x1d');var _0x337de9=_0x1258d6[_0x1543('0x1e')];var _0x4bc9de=_0x3c403e?0x0:_0x55868d['offset'];var _0x251512=_0x3c403e?_0x1258d6[_0x1543('0x1e')]:_0x55868d[_0x1543('0x1b')]+_0x55868d['limit'];var _0x4d0b15;if(_0x251512>=_0x337de9){_0x251512=_0x337de9;_0x4d0b15=0xc8;}else{_0x4d0b15=0xce;}_0x25c356[_0x1543('0x19')](_0x4d0b15);return _0x25c356[_0x1543('0x1f')]('Content-Range',_0x4bc9de+'-'+_0x251512+'/'+_0x337de9)[_0x1543('0x1a')](_0x1258d6);}return null;};}function patchUpdates(_0x3224f4){return function(_0x359eca){try{jsonpatch[_0x1543('0x20')](_0x359eca,_0x3224f4,!![]);}catch(_0x333756){return BPromise[_0x1543('0x21')](_0x333756);}return _0x359eca[_0x1543('0x22')]();};}function saveUpdates(_0x167d4f,_0x255fab){return function(_0x31d5e1){if(_0x31d5e1){return _0x31d5e1[_0x1543('0x23')](_0x167d4f)[_0x1543('0x24')](function(_0x34a2b3){return _0x34a2b3;});}return null;};}function removeEntity(_0x2de692,_0x4c6a14){return function(_0x1daba8){if(_0x1daba8){return _0x1daba8[_0x1543('0x25')]()[_0x1543('0x24')](function(){_0x2de692[_0x1543('0x19')](0xcc)[_0x1543('0x26')]();});}};}function handleEntityNotFound(_0x5a0804,_0x5d9dfc){return function(_0xc2ea4a){if(!_0xc2ea4a){_0x5a0804[_0x1543('0x27')](0x194);}return _0xc2ea4a;};}function handleError(_0xac1647,_0x5dd3df){_0x5dd3df=_0x5dd3df||0x1f4;return function(_0x22d464){logger[_0x1543('0x28')](_0x22d464[_0x1543('0x29')]);if(_0x22d464[_0x1543('0x2a')]){delete _0x22d464['name'];}_0xac1647[_0x1543('0x19')](_0x5dd3df)['send'](_0x22d464);};}exports[_0x1543('0x2b')]=function(_0x3ae055,_0x578ee1){var _0xb37f46={},_0x23519e={},_0x4e23e1={'count':0x0,'rows':[]};var _0x3fc6d9=_['map'](db[_0x1543('0x2c')][_0x1543('0x2d')],function(_0x2ab014){return{'name':_0x2ab014['fieldName'],'type':_0x2ab014[_0x1543('0x2e')][_0x1543('0x2f')]};});_0x23519e[_0x1543('0x30')]=_[_0x1543('0x31')](_0x3fc6d9,_0x1543('0x2a'));_0x23519e[_0x1543('0x32')]=_[_0x1543('0x33')](_0x3ae055[_0x1543('0x32')]);_0x23519e[_0x1543('0x34')]=_[_0x1543('0x35')](_0x23519e[_0x1543('0x30')],_0x23519e[_0x1543('0x32')]);_0xb37f46['attributes']=_['intersection'](_0x23519e['model'],qs[_0x1543('0x36')](_0x3ae055['query'][_0x1543('0x36')]));_0xb37f46['attributes']=_0xb37f46['attributes']['length']?_0xb37f46['attributes']:_0x23519e['model'];if(!_0x3ae055[_0x1543('0x32')][_0x1543('0x37')](_0x1543('0x38'))){_0xb37f46['limit']=qs['limit'](_0x3ae055['query'][_0x1543('0x1c')]);_0xb37f46[_0x1543('0x1b')]=qs['offset'](_0x3ae055[_0x1543('0x32')][_0x1543('0x1b')]);}_0xb37f46[_0x1543('0x39')]=qs['sort'](_0x3ae055['query'][_0x1543('0x3a')]);_0xb37f46['where']=qs[_0x1543('0x34')](_[_0x1543('0x3b')](_0x3ae055[_0x1543('0x32')],_0x23519e['filters']),_0x3fc6d9);if(_0x3ae055[_0x1543('0x32')][_0x1543('0x3c')]){_0xb37f46[_0x1543('0x3d')]=_[_0x1543('0x3e')](_0xb37f46[_0x1543('0x3d')],{'$or':_[_0x1543('0x31')](_0x3fc6d9,function(_0x22019b){if(_0x22019b[_0x1543('0x2e')]!==_0x1543('0x3f')){var _0x17cbc7={};_0x17cbc7[_0x22019b[_0x1543('0x2a')]]={'$like':'%'+_0x3ae055['query'][_0x1543('0x3c')]+'%'};return _0x17cbc7;}})});}_0xb37f46=_[_0x1543('0x3e')]({},_0xb37f46,_0x3ae055['options']);var _0x1d48c2={'where':_0xb37f46[_0x1543('0x3d')]};return db['ServicenowField'][_0x1543('0x1e')](_0x1d48c2)[_0x1543('0x24')](function(_0x38e63c){_0x4e23e1['count']=_0x38e63c;if(_0x3ae055[_0x1543('0x32')]['includeAll']){_0xb37f46[_0x1543('0x40')]=[{'all':!![]}];}return db[_0x1543('0x2c')][_0x1543('0x41')](_0xb37f46);})[_0x1543('0x24')](function(_0xb6d487){_0x4e23e1[_0x1543('0x42')]=_0xb6d487;return _0x4e23e1;})[_0x1543('0x24')](respondWithFilteredResult(_0x578ee1,_0xb37f46))[_0x1543('0x43')](handleError(_0x578ee1,null));};exports[_0x1543('0x44')]=function(_0x45286f,_0x40a8ec){var _0x3f0dcc={'raw':!![],'where':{'id':_0x45286f[_0x1543('0x45')]['id']}},_0x456373={};_0x456373['model']=_[_0x1543('0x33')](db[_0x1543('0x2c')][_0x1543('0x2d')]);_0x456373[_0x1543('0x32')]=_[_0x1543('0x33')](_0x45286f[_0x1543('0x32')]);_0x456373[_0x1543('0x34')]=_[_0x1543('0x35')](_0x456373[_0x1543('0x30')],_0x456373[_0x1543('0x32')]);_0x3f0dcc[_0x1543('0x46')]=_[_0x1543('0x35')](_0x456373[_0x1543('0x30')],qs['fields'](_0x45286f['query'][_0x1543('0x36')]));_0x3f0dcc[_0x1543('0x46')]=_0x3f0dcc[_0x1543('0x46')][_0x1543('0x47')]?_0x3f0dcc[_0x1543('0x46')]:_0x456373['model'];if(_0x45286f[_0x1543('0x32')][_0x1543('0x48')]){_0x3f0dcc['include']=[{'all':!![]}];}_0x3f0dcc=_[_0x1543('0x3e')]({},_0x3f0dcc,_0x45286f[_0x1543('0x49')]);return db[_0x1543('0x2c')][_0x1543('0x4a')](_0x3f0dcc)['then'](handleEntityNotFound(_0x40a8ec,null))[_0x1543('0x24')](respondWithResult(_0x40a8ec,null))[_0x1543('0x43')](handleError(_0x40a8ec,null));};exports[_0x1543('0x4b')]=function(_0xea07f0,_0x5a55cb){return db[_0x1543('0x2c')]['create'](_0xea07f0['body'],{})[_0x1543('0x24')](respondWithResult(_0x5a55cb,0xc9))[_0x1543('0x43')](handleError(_0x5a55cb,null));};exports[_0x1543('0x23')]=function(_0x454d0e,_0x113c3e){if(_0x454d0e['body']['id']){delete _0x454d0e[_0x1543('0x4c')]['id'];}return db['ServicenowField'][_0x1543('0x4a')]({'where':{'id':_0x454d0e[_0x1543('0x45')]['id']}})[_0x1543('0x24')](handleEntityNotFound(_0x113c3e,null))[_0x1543('0x24')](saveUpdates(_0x454d0e[_0x1543('0x4c')],null))[_0x1543('0x24')](respondWithResult(_0x113c3e,null))[_0x1543('0x43')](handleError(_0x113c3e,null));};exports[_0x1543('0x25')]=function(_0x616c70,_0x5ddedc){return db[_0x1543('0x2c')]['find']({'where':{'id':_0x616c70['params']['id']}})[_0x1543('0x24')](handleEntityNotFound(_0x5ddedc,null))[_0x1543('0x24')](removeEntity(_0x5ddedc,null))[_0x1543('0x43')](handleError(_0x5ddedc,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index c5cc5af..285d259 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 _0xfd9a=['exports','define','int_servicenow_fields','servicenow_unique_index','idField','lodash','util','../../config/logger','api','bluebird','path','rimraf','./intServicenowField.attributes'];(function(_0x101802,_0x11f913){var _0x5d61ce=function(_0x4acc0){while(--_0x4acc0){_0x101802['push'](_0x101802['shift']());}};_0x5d61ce(++_0x11f913);}(_0xfd9a,0x1a5));var _0xafd9=function(_0x57dff9,_0x37bd67){_0x57dff9=_0x57dff9-0x0;var _0x346ae6=_0xfd9a[_0x57dff9];return _0x346ae6;};'use strict';var _=require(_0xafd9('0x0'));var util=require(_0xafd9('0x1'));var logger=require(_0xafd9('0x2'))(_0xafd9('0x3'));var moment=require('moment');var BPromise=require(_0xafd9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xafd9('0x5'));var rimraf=require(_0xafd9('0x6'));var config=require('../../config/environment');var attributes=require(_0xafd9('0x7'));module[_0xafd9('0x8')]=function(_0x2dbef0,_0x308e0a){return _0x2dbef0[_0xafd9('0x9')]('ServicenowField',attributes,{'tableName':_0xafd9('0xa'),'paranoid':![],'indexes':[{'name':_0xafd9('0xb'),'fields':[_0xafd9('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd0e8=['exports','ServicenowField','servicenow_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowField.attributes'];(function(_0x206338,_0x2d800b){var _0x2b87f2=function(_0x436c1c){while(--_0x436c1c){_0x206338['push'](_0x206338['shift']());}};_0x2b87f2(++_0x2d800b);}(_0xd0e8,0x12a));var _0x8d0e=function(_0x5d611b,_0x341621){_0x5d611b=_0x5d611b-0x0;var _0x70d31d=_0xd0e8[_0x5d611b];return _0x70d31d;};'use strict';var _=require(_0x8d0e('0x0'));var util=require(_0x8d0e('0x1'));var logger=require(_0x8d0e('0x2'))(_0x8d0e('0x3'));var moment=require(_0x8d0e('0x4'));var BPromise=require(_0x8d0e('0x5'));var rp=require(_0x8d0e('0x6'));var fs=require('fs');var path=require(_0x8d0e('0x7'));var rimraf=require('rimraf');var config=require(_0x8d0e('0x8'));var attributes=require(_0x8d0e('0x9'));module[_0x8d0e('0xa')]=function(_0x1eb1bb,_0x3a5d91){return _0x1eb1bb['define'](_0x8d0e('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x8d0e('0xc'),'fields':['idField',_0x8d0e('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 7b7bb29..4480293 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 _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\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(_0x38a37e,_0x18f65e){var _0x4b6b82=function(_0x2a3d9b){while(--_0x2a3d9b){_0x38a37e['push'](_0x38a37e['shift']());}};_0x4b6b82(++_0x18f65e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xb7e7[_0x34843e];return _0x598f7f;};'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')]('ServicenowField,\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 _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2febf4,_0x4966f4){var _0x261cb0=function(_0x1b01f9){while(--_0x1b01f9){_0x2febf4['push'](_0x2febf4['shift']());}};_0x261cb0(++_0x4966f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index b5b22ee..ae59dca 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1bb719,_0x220fb0){var _0x23b36b=function(_0xe5601d){while(--_0xe5601d){_0x1bb719['push'](_0x1bb719['shift']());}};_0x23b36b(++_0x220fb0);}(_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('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x388593,_0x47a8a7){var _0x4f5b68=function(_0x594b42){while(--_0x594b42){_0x388593['push'](_0x388593['shift']());}};_0x4f5b68(++_0x47a8a7);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index e926ed9..39ef864 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(_0x45ad7f,_0xb64f54){var _0x467506=function(_0x1676ed){while(--_0x1676ed){_0x45ad7f['push'](_0x45ad7f['shift']());}};_0x467506(++_0xb64f54);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x20320d,_0x4a5185){var _0x11f1f3=function(_0x344e10){while(--_0x344e10){_0x20320d['push'](_0x20320d['shift']());}};_0x11f1f3(++_0x4a5185);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 7ec4b94..717c096 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 _0xc732=['AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Password\x20Expired','get_module_fields','Calls','remove','includes','label','endsWith','values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','count','limit','status','Content-Range','apply','save','then','destroy','error','name','map','SugarcrmAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','include','findAll','rows','show','params','keys','rawAttributes','includeAll','options','find','catch','create','update','body','getConfigurations','findOne','SugarcrmConfiguration','pick','addConfiguration'];(function(_0x3e9415,_0x59a3fd){var _0x3a2fd5=function(_0x2cf29d){while(--_0x2cf29d){_0x3e9415['push'](_0x3e9415['shift']());}};_0x3a2fd5(++_0x59a3fd);}(_0xc732,0xa7));var _0x2c73=function(_0x1868b0,_0x2f4ee1){_0x1868b0=_0x1868b0-0x0;var _0x2d2c1f=_0xc732[_0x1868b0];return _0x2d2c1f;};'use strict';var emlformat=require(_0x2c73('0x0'));var rimraf=require(_0x2c73('0x1'));var zipdir=require(_0x2c73('0x2'));var jsonpatch=require(_0x2c73('0x3'));var rp=require(_0x2c73('0x4'));var moment=require(_0x2c73('0x5'));var BPromise=require(_0x2c73('0x6'));var Mustache=require(_0x2c73('0x7'));var util=require(_0x2c73('0x8'));var path=require(_0x2c73('0x9'));var sox=require('sox');var csv=require(_0x2c73('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c73('0xb'));var _=require('lodash');var squel=require(_0x2c73('0xc'));var crypto=require(_0x2c73('0xd'));var jsforce=require(_0x2c73('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2c73('0xa'));var querystring=require(_0x2c73('0xf'));var Papa=require('papaparse');var Redis=require(_0x2c73('0x10'));var authService=require(_0x2c73('0x11'));var qs=require(_0x2c73('0x12'));var as=require(_0x2c73('0x13'));var hardwareService=require(_0x2c73('0x14'));var logger=require(_0x2c73('0x15'))(_0x2c73('0x16'));var utils=require(_0x2c73('0x17'));var config=require(_0x2c73('0x18'));var licenseUtil=require(_0x2c73('0x19'));var db=require(_0x2c73('0x1a'))['db'];var integrations=require(_0x2c73('0x1b'));function respondWithStatusCode(_0x5280c6,_0x5c3134){_0x5c3134=_0x5c3134||0xcc;return function(_0x320f48){if(_0x320f48){return _0x5280c6[_0x2c73('0x1c')](_0x5c3134);}return _0x5280c6['status'](_0x5c3134)[_0x2c73('0x1d')]();};}function respondWithResult(_0x3e561e,_0x3d63d9){_0x3d63d9=_0x3d63d9||0xc8;return function(_0x4db047){if(_0x4db047){return _0x3e561e['status'](_0x3d63d9)[_0x2c73('0x1e')](_0x4db047);}};}function respondWithFilteredResult(_0xd49217,_0x3f98f9){return function(_0x1cf761){if(_0x1cf761){var _0x53d48e=typeof _0x3f98f9[_0x2c73('0x1f')]===_0x2c73('0x20')&&typeof _0x3f98f9['limit']===_0x2c73('0x20');var _0x3ac825=_0x1cf761[_0x2c73('0x21')];var _0x3fd9d5=_0x53d48e?0x0:_0x3f98f9[_0x2c73('0x1f')];var _0x1f510f=_0x53d48e?_0x1cf761[_0x2c73('0x21')]:_0x3f98f9['offset']+_0x3f98f9[_0x2c73('0x22')];var _0x1536d8;if(_0x1f510f>=_0x3ac825){_0x1f510f=_0x3ac825;_0x1536d8=0xc8;}else{_0x1536d8=0xce;}_0xd49217[_0x2c73('0x23')](_0x1536d8);return _0xd49217['set'](_0x2c73('0x24'),_0x3fd9d5+'-'+_0x1f510f+'/'+_0x3ac825)[_0x2c73('0x1e')](_0x1cf761);}return null;};}function patchUpdates(_0x5c4ab7){return function(_0x25d351){try{jsonpatch[_0x2c73('0x25')](_0x25d351,_0x5c4ab7,!![]);}catch(_0xe920f0){return BPromise['reject'](_0xe920f0);}return _0x25d351[_0x2c73('0x26')]();};}function saveUpdates(_0x539acd,_0x4bfff9){return function(_0x2014ca){if(_0x2014ca){return _0x2014ca['update'](_0x539acd)[_0x2c73('0x27')](function(_0x2f2523){return _0x2f2523;});}return null;};}function removeEntity(_0x271f32,_0xfb1cd3){return function(_0x5bb574){if(_0x5bb574){return _0x5bb574[_0x2c73('0x28')]()[_0x2c73('0x27')](function(){_0x271f32[_0x2c73('0x23')](0xcc)[_0x2c73('0x1d')]();});}};}function handleEntityNotFound(_0x954778,_0x250b03){return function(_0x34cfce){if(!_0x34cfce){_0x954778['sendStatus'](0x194);}return _0x34cfce;};}function handleError(_0x8c4401,_0x26fc6f){_0x26fc6f=_0x26fc6f||0x1f4;return function(_0x5b80e0){logger[_0x2c73('0x29')](_0x5b80e0['stack']);if(_0x5b80e0['name']){delete _0x5b80e0[_0x2c73('0x2a')];}_0x8c4401[_0x2c73('0x23')](_0x26fc6f)['send'](_0x5b80e0);};}exports['index']=function(_0x559f6d,_0x4ea85d){var _0x32a24d={},_0xcc021a={},_0x54fa51={'count':0x0,'rows':[]};var _0x32e1f7=_[_0x2c73('0x2b')](db[_0x2c73('0x2c')]['rawAttributes'],function(_0x1943a4){return{'name':_0x1943a4[_0x2c73('0x2d')],'type':_0x1943a4[_0x2c73('0x2e')][_0x2c73('0x2f')]};});_0xcc021a[_0x2c73('0x30')]=_['map'](_0x32e1f7,_0x2c73('0x2a'));_0xcc021a[_0x2c73('0x31')]=_['keys'](_0x559f6d[_0x2c73('0x31')]);_0xcc021a[_0x2c73('0x32')]=_[_0x2c73('0x33')](_0xcc021a[_0x2c73('0x30')],_0xcc021a[_0x2c73('0x31')]);_0x32a24d[_0x2c73('0x34')]=_['intersection'](_0xcc021a[_0x2c73('0x30')],qs[_0x2c73('0x35')](_0x559f6d[_0x2c73('0x31')][_0x2c73('0x35')]));_0x32a24d[_0x2c73('0x34')]=_0x32a24d[_0x2c73('0x34')][_0x2c73('0x36')]?_0x32a24d[_0x2c73('0x34')]:_0xcc021a['model'];if(!_0x559f6d[_0x2c73('0x31')][_0x2c73('0x37')](_0x2c73('0x38'))){_0x32a24d[_0x2c73('0x22')]=qs['limit'](_0x559f6d[_0x2c73('0x31')][_0x2c73('0x22')]);_0x32a24d[_0x2c73('0x1f')]=qs['offset'](_0x559f6d['query'][_0x2c73('0x1f')]);}_0x32a24d[_0x2c73('0x39')]=qs[_0x2c73('0x3a')](_0x559f6d[_0x2c73('0x31')]['sort']);_0x32a24d[_0x2c73('0x3b')]=qs['filters'](_['pick'](_0x559f6d[_0x2c73('0x31')],_0xcc021a[_0x2c73('0x32')]),_0x32e1f7);if(_0x559f6d['query'][_0x2c73('0x3c')]){_0x32a24d[_0x2c73('0x3b')]=_[_0x2c73('0x3d')](_0x32a24d[_0x2c73('0x3b')],{'$or':_[_0x2c73('0x2b')](_0x32e1f7,function(_0x34dde5){if(_0x34dde5[_0x2c73('0x2e')]!=='VIRTUAL'){var _0x2934b1={};_0x2934b1[_0x34dde5['name']]={'$like':'%'+_0x559f6d['query']['filter']+'%'};return _0x2934b1;}})});}_0x32a24d=_[_0x2c73('0x3d')]({},_0x32a24d,_0x559f6d['options']);var _0x5e82a2={'where':_0x32a24d[_0x2c73('0x3b')]};return db['SugarcrmAccount'][_0x2c73('0x21')](_0x5e82a2)[_0x2c73('0x27')](function(_0x17b6a7){_0x54fa51[_0x2c73('0x21')]=_0x17b6a7;if(_0x559f6d[_0x2c73('0x31')]['includeAll']){_0x32a24d[_0x2c73('0x3e')]=[{'all':!![]}];}return db[_0x2c73('0x2c')][_0x2c73('0x3f')](_0x32a24d);})[_0x2c73('0x27')](function(_0x3c9c33){_0x54fa51[_0x2c73('0x40')]=_0x3c9c33;return _0x54fa51;})['then'](respondWithFilteredResult(_0x4ea85d,_0x32a24d))['catch'](handleError(_0x4ea85d,null));};exports[_0x2c73('0x41')]=function(_0x2a64ed,_0x1ce440){var _0x23e0d9={'raw':![],'where':{'id':_0x2a64ed[_0x2c73('0x42')]['id']}},_0xf1f3ec={};_0xf1f3ec[_0x2c73('0x30')]=_[_0x2c73('0x43')](db[_0x2c73('0x2c')][_0x2c73('0x44')]);_0xf1f3ec[_0x2c73('0x31')]=_[_0x2c73('0x43')](_0x2a64ed[_0x2c73('0x31')]);_0xf1f3ec['filters']=_['intersection'](_0xf1f3ec[_0x2c73('0x30')],_0xf1f3ec[_0x2c73('0x31')]);_0x23e0d9[_0x2c73('0x34')]=_[_0x2c73('0x33')](_0xf1f3ec['model'],qs[_0x2c73('0x35')](_0x2a64ed[_0x2c73('0x31')][_0x2c73('0x35')]));_0x23e0d9['attributes']=_0x23e0d9['attributes']['length']?_0x23e0d9['attributes']:_0xf1f3ec[_0x2c73('0x30')];if(_0x2a64ed[_0x2c73('0x31')][_0x2c73('0x45')]){_0x23e0d9['include']=[{'all':!![]}];}_0x23e0d9=_[_0x2c73('0x3d')]({},_0x23e0d9,_0x2a64ed[_0x2c73('0x46')]);return db[_0x2c73('0x2c')][_0x2c73('0x47')](_0x23e0d9)[_0x2c73('0x27')](handleEntityNotFound(_0x1ce440,null))[_0x2c73('0x27')](respondWithResult(_0x1ce440,null))[_0x2c73('0x48')](handleError(_0x1ce440,null));};exports['create']=function(_0x2656a4,_0xec6785){return db['SugarcrmAccount'][_0x2c73('0x49')](_0x2656a4['body'],{})[_0x2c73('0x27')](respondWithResult(_0xec6785,0xc9))['catch'](handleError(_0xec6785,null));};exports[_0x2c73('0x4a')]=function(_0x46d4e2,_0x2130bb){if(_0x46d4e2[_0x2c73('0x4b')]['id']){delete _0x46d4e2[_0x2c73('0x4b')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x46d4e2['params']['id']}})[_0x2c73('0x27')](handleEntityNotFound(_0x2130bb,null))['then'](saveUpdates(_0x46d4e2['body'],null))['then'](respondWithResult(_0x2130bb,null))[_0x2c73('0x48')](handleError(_0x2130bb,null));};exports[_0x2c73('0x28')]=function(_0x202227,_0x406d89){return db[_0x2c73('0x2c')]['find']({'where':{'id':_0x202227[_0x2c73('0x42')]['id']}})[_0x2c73('0x27')](handleEntityNotFound(_0x406d89,null))[_0x2c73('0x27')](removeEntity(_0x406d89,null))[_0x2c73('0x48')](handleError(_0x406d89,null));};exports[_0x2c73('0x4c')]=function(_0x2988ca,_0x3328b3,_0x58bbec){var _0x2b278e={};var _0x113fd2={};var _0x34610d;var _0x302eaa;return db[_0x2c73('0x2c')][_0x2c73('0x4d')]({'where':{'id':_0x2988ca['params']['id']}})['then'](handleEntityNotFound(_0x3328b3,null))[_0x2c73('0x27')](function(_0x4ff465){if(_0x4ff465){_0x34610d=_0x4ff465;_0x113fd2['model']=_[_0x2c73('0x43')](db[_0x2c73('0x4e')][_0x2c73('0x44')]);_0x113fd2[_0x2c73('0x31')]=_[_0x2c73('0x43')](_0x2988ca['query']);_0x113fd2['filters']=_[_0x2c73('0x33')](_0x113fd2[_0x2c73('0x30')],_0x113fd2[_0x2c73('0x31')]);_0x2b278e[_0x2c73('0x34')]=_[_0x2c73('0x33')](_0x113fd2[_0x2c73('0x30')],qs[_0x2c73('0x35')](_0x2988ca[_0x2c73('0x31')][_0x2c73('0x35')]));_0x2b278e[_0x2c73('0x34')]=_0x2b278e[_0x2c73('0x34')][_0x2c73('0x36')]?_0x2b278e['attributes']:_0x113fd2[_0x2c73('0x30')];_0x2b278e[_0x2c73('0x39')]=qs[_0x2c73('0x3a')](_0x2988ca[_0x2c73('0x31')][_0x2c73('0x3a')]);_0x2b278e[_0x2c73('0x3b')]=qs[_0x2c73('0x32')](_[_0x2c73('0x4f')](_0x2988ca[_0x2c73('0x31')],_0x113fd2[_0x2c73('0x32')]));if(_0x2988ca[_0x2c73('0x31')][_0x2c73('0x3c')]){_0x2b278e[_0x2c73('0x3b')]=_['merge'](_0x2b278e[_0x2c73('0x3b')],{'$or':_[_0x2c73('0x2b')](_0x2b278e['attributes'],function(_0x294f31){var _0x31fa3c={};_0x31fa3c[_0x294f31]={'$like':'%'+_0x2988ca[_0x2c73('0x31')][_0x2c73('0x3c')]+'%'};return _0x31fa3c;})});}_0x2b278e=_[_0x2c73('0x3d')]({},_0x2b278e,_0x2988ca['options']);return _0x34610d[_0x2c73('0x4c')](_0x2b278e);}})['then'](function(_0x2b7d51){if(_0x2b7d51){_0x302eaa=_0x2b7d51[_0x2c73('0x36')];if(!_0x2988ca[_0x2c73('0x31')][_0x2c73('0x37')](_0x2c73('0x38'))){_0x2b278e[_0x2c73('0x22')]=qs[_0x2c73('0x22')](_0x2988ca[_0x2c73('0x31')]['limit']);_0x2b278e['offset']=qs[_0x2c73('0x1f')](_0x2988ca['query'][_0x2c73('0x1f')]);}return _0x34610d[_0x2c73('0x4c')](_0x2b278e);}})['then'](function(_0x4bc81e){if(_0x4bc81e){return _0x4bc81e?{'count':_0x302eaa,'rows':_0x4bc81e}:null;}})[_0x2c73('0x27')](respondWithResult(_0x3328b3,null))['catch'](handleError(_0x3328b3,null));};exports[_0x2c73('0x50')]=function(_0x3f492a,_0x2a3c78,_0x27f7d2){if(_0x3f492a[_0x2c73('0x4b')]['id']){delete _0x3f492a[_0x2c73('0x4b')]['id'];}return db[_0x2c73('0x2c')][_0x2c73('0x4d')]({'where':{'id':_0x3f492a[_0x2c73('0x42')]['id']}})[_0x2c73('0x27')](handleEntityNotFound(_0x2a3c78,null))['then'](function(_0x12b6d6){if(_0x12b6d6){_0x3f492a['body'][_0x2c73('0x51')]=_0x12b6d6['id'];_0x3f492a[_0x2c73('0x4b')][_0x2c73('0x52')]=integrations[_0x2c73('0x53')](_0x3f492a['body'][_0x2c73('0x54')],_0x3f492a[_0x2c73('0x4b')]['type']);_0x3f492a[_0x2c73('0x4b')][_0x2c73('0x55')]=integrations[_0x2c73('0x56')](_0x3f492a[_0x2c73('0x4b')][_0x2c73('0x54')],_0x3f492a[_0x2c73('0x4b')][_0x2c73('0x2e')]);return db[_0x2c73('0x4e')]['create'](_0x3f492a[_0x2c73('0x4b')],{'include':[{'model':db[_0x2c73('0x57')],'as':'Subjects'},{'model':db[_0x2c73('0x57')],'as':'Descriptions'}]});}return null;})[_0x2c73('0x27')](respondWithResult(_0x2a3c78,null))[_0x2c73('0x48')](handleError(_0x2a3c78,null));};exports['getFields']=function(_0x1f2f75,_0x48129a,_0x480f45){var _0x364124='';var _0x36cd53=['id',_0x2c73('0x2a'),_0x2c73('0x58'),_0x2c73('0x59'),_0x2c73('0x5a'),_0x2c73('0x5b'),'duration_hours',_0x2c73('0x5c'),_0x2c73('0x5d'),_0x2c73('0x5e'),_0x2c73('0x5f'),_0x2c73('0x60')];return db[_0x2c73('0x2c')][_0x2c73('0x4d')]({'where':{'id':_0x1f2f75[_0x2c73('0x42')]['id']},'attributes':['id',_0x2c73('0x61'),_0x2c73('0x62'),'remoteUri']})[_0x2c73('0x27')](handleEntityNotFound(_0x48129a,null))[_0x2c73('0x27')](function(_0x23779c){if(_0x23779c){_0x364124=_0x23779c['remoteUri'];var _0x3caff8=_0x364124[_0x2c73('0x63')](-0x1);if(_0x3caff8==='/'){_0x364124=_0x364124[_0x2c73('0x64')](0x0,_0x364124[_0x2c73('0x65')](_0x3caff8));}return rp({'method':_0x2c73('0x66'),'uri':util[_0x2c73('0x67')](_0x2c73('0x68'),_0x364124,_0x2c73('0x69')),'json':!![],'form':{'method':_0x2c73('0x6a'),'input_type':_0x2c73('0x6b'),'response_type':'JSON','rest_data':JSON[_0x2c73('0x6c')]({'user_auth':{'user_name':_0x23779c[_0x2c73('0x61')],'password':_0x23779c['password'],'encryption':'PLAIN'},'application':_0x2c73('0x6d')})}});}})[_0x2c73('0x27')](function(_0x2c5861){if(_0x2c5861&&_0x2c5861[_0x2c73('0x2a')]!=='Invalid\x20Login'&&_0x2c5861[_0x2c73('0x2a')]!==_0x2c73('0x6e')){return rp({'method':_0x2c73('0x66'),'uri':util[_0x2c73('0x67')](_0x2c73('0x68'),_0x364124,_0x2c73('0x69')),'json':!![],'form':{'method':_0x2c73('0x6f'),'input_type':'JSON','response_type':_0x2c73('0x6b'),'rest_data':JSON[_0x2c73('0x6c')]({'session':_0x2c5861['id'],'module_name':_0x2c73('0x70')})}})[_0x2c73('0x27')](function(_0x38dc78){if(_0x38dc78){var _0x33a3fb=_['values'](_0x38dc78['module_fields']);_[_0x2c73('0x71')](_0x33a3fb,function(_0xcb067f){return _0x36cd53[_0x2c73('0x72')](_0xcb067f[_0x2c73('0x2a')]);});return{'count':_0x33a3fb[_0x2c73('0x36')],'rows':_['map'](_0x33a3fb,function(_0x364ddb){return{'id':_0x364ddb[_0x2c73('0x2a')],'name':_0x364ddb[_0x2c73('0x73')],'custom':_[_0x2c73('0x74')](_0x364ddb[_0x2c73('0x2a')],'_c')?!![]:![],'options':_0x364ddb[_0x2c73('0x46')]?_[_0x2c73('0x2b')](_[_0x2c73('0x75')](_0x364ddb[_0x2c73('0x46')]),function(_0x4720e8){return{'name':_0x4720e8['value'],'value':_0x4720e8[_0x2c73('0x2a')]};}):[]};})};}})[_0x2c73('0x27')](respondWithResult(_0x48129a,null))[_0x2c73('0x48')](function(_0x326545){var _0x146205=_0x1f2f75[_0x2c73('0x31')][_0x2c73('0x76')]?0x1f4:_0x326545[_0x2c73('0x77')]||0x1f4;logger['error'](_0x2c73('0x78'),_0x2c73('0x79'),_0x146205,JSON[_0x2c73('0x6c')](_0x326545));delete _0x326545['name'];if(_0x146205===0x191){_0x146205=0x190;}_0x48129a[_0x2c73('0x23')](_0x146205)[_0x2c73('0x7a')](_0x1f2f75[_0x2c73('0x31')][_0x2c73('0x76')]?{'message':_0x2c73('0x7b'),'statusCode':_0x326545[_0x2c73('0x77')]}:_0x326545);});}else{var _0x508b06=0x1f4;_0x48129a[_0x2c73('0x23')](_0x508b06)[_0x2c73('0x7a')]({'message':_0x2c73('0x7b'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x25ad=['status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','index','map','SugarcrmAccount','fieldName','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','limit','order','where','pick','filter','merge','type','include','findAll','rows','show','params','includeAll','find','catch','create','body','getConfigurations','SugarcrmConfiguration','sort','options','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','date_start','duration_hours','parent_type','username','remoteUri','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','Invalid\x20Login','Password\x20Expired','get_module_fields','stringify','Calls','remove','includes','label','values','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','../../components/integrations/configuration'];(function(_0x885eff,_0x555809){var _0x17819f=function(_0x3a69f0){while(--_0x3a69f0){_0x885eff['push'](_0x885eff['shift']());}};_0x17819f(++_0x555809);}(_0x25ad,0x1b1));var _0xd25a=function(_0x199131,_0x2c1c83){_0x199131=_0x199131-0x0;var _0x155dcd=_0x25ad[_0x199131];return _0x155dcd;};'use strict';var emlformat=require(_0xd25a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd25a('0x1'));var jsonpatch=require(_0xd25a('0x2'));var rp=require(_0xd25a('0x3'));var moment=require('moment');var BPromise=require(_0xd25a('0x4'));var Mustache=require(_0xd25a('0x5'));var util=require(_0xd25a('0x6'));var path=require(_0xd25a('0x7'));var sox=require(_0xd25a('0x8'));var csv=require(_0xd25a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd25a('0xa'));var squel=require(_0xd25a('0xb'));var crypto=require('crypto');var jsforce=require(_0xd25a('0xc'));var deskjs=require(_0xd25a('0xd'));var toCsv=require(_0xd25a('0x9'));var querystring=require(_0xd25a('0xe'));var Papa=require(_0xd25a('0xf'));var Redis=require(_0xd25a('0x10'));var authService=require(_0xd25a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd25a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd25a('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd25a('0x14'));var db=require(_0xd25a('0x15'))['db'];var integrations=require(_0xd25a('0x16'));function respondWithStatusCode(_0x1d2507,_0x2842d2){_0x2842d2=_0x2842d2||0xcc;return function(_0x3a9286){if(_0x3a9286){return _0x1d2507['sendStatus'](_0x2842d2);}return _0x1d2507[_0xd25a('0x17')](_0x2842d2)[_0xd25a('0x18')]();};}function respondWithResult(_0xf0e768,_0x503611){_0x503611=_0x503611||0xc8;return function(_0x13ac69){if(_0x13ac69){return _0xf0e768['status'](_0x503611)[_0xd25a('0x19')](_0x13ac69);}};}function respondWithFilteredResult(_0x18c903,_0x46d8c2){return function(_0x19ad9e){if(_0x19ad9e){var _0x4dc209=typeof _0x46d8c2[_0xd25a('0x1a')]===_0xd25a('0x1b')&&typeof _0x46d8c2['limit']===_0xd25a('0x1b');var _0x46c889=_0x19ad9e[_0xd25a('0x1c')];var _0x3627b0=_0x4dc209?0x0:_0x46d8c2[_0xd25a('0x1a')];var _0x353ddd=_0x4dc209?_0x19ad9e['count']:_0x46d8c2[_0xd25a('0x1a')]+_0x46d8c2['limit'];var _0x228e20;if(_0x353ddd>=_0x46c889){_0x353ddd=_0x46c889;_0x228e20=0xc8;}else{_0x228e20=0xce;}_0x18c903[_0xd25a('0x17')](_0x228e20);return _0x18c903['set'](_0xd25a('0x1d'),_0x3627b0+'-'+_0x353ddd+'/'+_0x46c889)['json'](_0x19ad9e);}return null;};}function patchUpdates(_0x41bf3f){return function(_0x58fabc){try{jsonpatch[_0xd25a('0x1e')](_0x58fabc,_0x41bf3f,!![]);}catch(_0x1e61aa){return BPromise[_0xd25a('0x1f')](_0x1e61aa);}return _0x58fabc[_0xd25a('0x20')]();};}function saveUpdates(_0x2eb6c2,_0x57c794){return function(_0x32a400){if(_0x32a400){return _0x32a400[_0xd25a('0x21')](_0x2eb6c2)[_0xd25a('0x22')](function(_0x4b5622){return _0x4b5622;});}return null;};}function removeEntity(_0x40362d,_0xeaa46f){return function(_0x562f3b){if(_0x562f3b){return _0x562f3b[_0xd25a('0x23')]()[_0xd25a('0x22')](function(){_0x40362d[_0xd25a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ae9e3,_0x468062){return function(_0x30f132){if(!_0x30f132){_0x1ae9e3[_0xd25a('0x24')](0x194);}return _0x30f132;};}function handleError(_0x1d10c5,_0x11979b){_0x11979b=_0x11979b||0x1f4;return function(_0x1b1b02){logger[_0xd25a('0x25')](_0x1b1b02['stack']);if(_0x1b1b02['name']){delete _0x1b1b02[_0xd25a('0x26')];}_0x1d10c5[_0xd25a('0x17')](_0x11979b)['send'](_0x1b1b02);};}exports[_0xd25a('0x27')]=function(_0x415f86,_0x173ff2){var _0x31f5b9={},_0x193343={},_0x305e42={'count':0x0,'rows':[]};var _0x3e1334=_[_0xd25a('0x28')](db[_0xd25a('0x29')]['rawAttributes'],function(_0x4de265){return{'name':_0x4de265[_0xd25a('0x2a')],'type':_0x4de265['type'][_0xd25a('0x2b')]};});_0x193343[_0xd25a('0x2c')]=_[_0xd25a('0x28')](_0x3e1334,_0xd25a('0x26'));_0x193343[_0xd25a('0x2d')]=_[_0xd25a('0x2e')](_0x415f86['query']);_0x193343[_0xd25a('0x2f')]=_[_0xd25a('0x30')](_0x193343[_0xd25a('0x2c')],_0x193343[_0xd25a('0x2d')]);_0x31f5b9['attributes']=_[_0xd25a('0x30')](_0x193343[_0xd25a('0x2c')],qs[_0xd25a('0x31')](_0x415f86[_0xd25a('0x2d')][_0xd25a('0x31')]));_0x31f5b9['attributes']=_0x31f5b9['attributes'][_0xd25a('0x32')]?_0x31f5b9[_0xd25a('0x33')]:_0x193343[_0xd25a('0x2c')];if(!_0x415f86['query'][_0xd25a('0x34')]('nolimit')){_0x31f5b9[_0xd25a('0x35')]=qs[_0xd25a('0x35')](_0x415f86['query'][_0xd25a('0x35')]);_0x31f5b9[_0xd25a('0x1a')]=qs[_0xd25a('0x1a')](_0x415f86[_0xd25a('0x2d')][_0xd25a('0x1a')]);}_0x31f5b9[_0xd25a('0x36')]=qs['sort'](_0x415f86[_0xd25a('0x2d')]['sort']);_0x31f5b9[_0xd25a('0x37')]=qs[_0xd25a('0x2f')](_[_0xd25a('0x38')](_0x415f86['query'],_0x193343['filters']),_0x3e1334);if(_0x415f86['query'][_0xd25a('0x39')]){_0x31f5b9['where']=_[_0xd25a('0x3a')](_0x31f5b9[_0xd25a('0x37')],{'$or':_[_0xd25a('0x28')](_0x3e1334,function(_0x564671){if(_0x564671[_0xd25a('0x3b')]!=='VIRTUAL'){var _0x5ed23b={};_0x5ed23b[_0x564671[_0xd25a('0x26')]]={'$like':'%'+_0x415f86[_0xd25a('0x2d')]['filter']+'%'};return _0x5ed23b;}})});}_0x31f5b9=_[_0xd25a('0x3a')]({},_0x31f5b9,_0x415f86['options']);var _0x4383bd={'where':_0x31f5b9[_0xd25a('0x37')]};return db[_0xd25a('0x29')]['count'](_0x4383bd)[_0xd25a('0x22')](function(_0x62ee2b){_0x305e42[_0xd25a('0x1c')]=_0x62ee2b;if(_0x415f86['query']['includeAll']){_0x31f5b9[_0xd25a('0x3c')]=[{'all':!![]}];}return db[_0xd25a('0x29')][_0xd25a('0x3d')](_0x31f5b9);})['then'](function(_0x48b63e){_0x305e42[_0xd25a('0x3e')]=_0x48b63e;return _0x305e42;})[_0xd25a('0x22')](respondWithFilteredResult(_0x173ff2,_0x31f5b9))['catch'](handleError(_0x173ff2,null));};exports[_0xd25a('0x3f')]=function(_0x10f33e,_0x47c407){var _0x12412a={'raw':![],'where':{'id':_0x10f33e[_0xd25a('0x40')]['id']}},_0x16f003={};_0x16f003['model']=_[_0xd25a('0x2e')](db[_0xd25a('0x29')]['rawAttributes']);_0x16f003['query']=_[_0xd25a('0x2e')](_0x10f33e[_0xd25a('0x2d')]);_0x16f003[_0xd25a('0x2f')]=_['intersection'](_0x16f003[_0xd25a('0x2c')],_0x16f003['query']);_0x12412a[_0xd25a('0x33')]=_[_0xd25a('0x30')](_0x16f003['model'],qs['fields'](_0x10f33e[_0xd25a('0x2d')]['fields']));_0x12412a[_0xd25a('0x33')]=_0x12412a[_0xd25a('0x33')][_0xd25a('0x32')]?_0x12412a['attributes']:_0x16f003['model'];if(_0x10f33e[_0xd25a('0x2d')][_0xd25a('0x41')]){_0x12412a[_0xd25a('0x3c')]=[{'all':!![]}];}_0x12412a=_[_0xd25a('0x3a')]({},_0x12412a,_0x10f33e['options']);return db['SugarcrmAccount'][_0xd25a('0x42')](_0x12412a)[_0xd25a('0x22')](handleEntityNotFound(_0x47c407,null))[_0xd25a('0x22')](respondWithResult(_0x47c407,null))[_0xd25a('0x43')](handleError(_0x47c407,null));};exports[_0xd25a('0x44')]=function(_0x3390e7,_0x506c37){return db[_0xd25a('0x29')][_0xd25a('0x44')](_0x3390e7[_0xd25a('0x45')],{})[_0xd25a('0x22')](respondWithResult(_0x506c37,0xc9))[_0xd25a('0x43')](handleError(_0x506c37,null));};exports['update']=function(_0x16bf7f,_0x534242){if(_0x16bf7f[_0xd25a('0x45')]['id']){delete _0x16bf7f[_0xd25a('0x45')]['id'];}return db[_0xd25a('0x29')]['find']({'where':{'id':_0x16bf7f[_0xd25a('0x40')]['id']}})[_0xd25a('0x22')](handleEntityNotFound(_0x534242,null))[_0xd25a('0x22')](saveUpdates(_0x16bf7f[_0xd25a('0x45')],null))['then'](respondWithResult(_0x534242,null))[_0xd25a('0x43')](handleError(_0x534242,null));};exports[_0xd25a('0x23')]=function(_0xa18f00,_0x27c127){return db['SugarcrmAccount'][_0xd25a('0x42')]({'where':{'id':_0xa18f00[_0xd25a('0x40')]['id']}})[_0xd25a('0x22')](handleEntityNotFound(_0x27c127,null))[_0xd25a('0x22')](removeEntity(_0x27c127,null))[_0xd25a('0x43')](handleError(_0x27c127,null));};exports[_0xd25a('0x46')]=function(_0xdcd26a,_0x59637c,_0x491efb){var _0x5580f9={};var _0x71ae14={};var _0x5f4456;var _0x16621b;return db[_0xd25a('0x29')]['findOne']({'where':{'id':_0xdcd26a[_0xd25a('0x40')]['id']}})[_0xd25a('0x22')](handleEntityNotFound(_0x59637c,null))[_0xd25a('0x22')](function(_0x50fafe){if(_0x50fafe){_0x5f4456=_0x50fafe;_0x71ae14['model']=_[_0xd25a('0x2e')](db[_0xd25a('0x47')]['rawAttributes']);_0x71ae14[_0xd25a('0x2d')]=_[_0xd25a('0x2e')](_0xdcd26a[_0xd25a('0x2d')]);_0x71ae14[_0xd25a('0x2f')]=_['intersection'](_0x71ae14[_0xd25a('0x2c')],_0x71ae14[_0xd25a('0x2d')]);_0x5580f9[_0xd25a('0x33')]=_['intersection'](_0x71ae14[_0xd25a('0x2c')],qs[_0xd25a('0x31')](_0xdcd26a[_0xd25a('0x2d')][_0xd25a('0x31')]));_0x5580f9['attributes']=_0x5580f9[_0xd25a('0x33')][_0xd25a('0x32')]?_0x5580f9[_0xd25a('0x33')]:_0x71ae14[_0xd25a('0x2c')];_0x5580f9['order']=qs[_0xd25a('0x48')](_0xdcd26a[_0xd25a('0x2d')]['sort']);_0x5580f9[_0xd25a('0x37')]=qs[_0xd25a('0x2f')](_[_0xd25a('0x38')](_0xdcd26a[_0xd25a('0x2d')],_0x71ae14[_0xd25a('0x2f')]));if(_0xdcd26a['query']['filter']){_0x5580f9[_0xd25a('0x37')]=_[_0xd25a('0x3a')](_0x5580f9[_0xd25a('0x37')],{'$or':_[_0xd25a('0x28')](_0x5580f9[_0xd25a('0x33')],function(_0x203f8f){var _0x5c3b66={};_0x5c3b66[_0x203f8f]={'$like':'%'+_0xdcd26a[_0xd25a('0x2d')][_0xd25a('0x39')]+'%'};return _0x5c3b66;})});}_0x5580f9=_[_0xd25a('0x3a')]({},_0x5580f9,_0xdcd26a[_0xd25a('0x49')]);return _0x5f4456[_0xd25a('0x46')](_0x5580f9);}})[_0xd25a('0x22')](function(_0x1776a4){if(_0x1776a4){_0x16621b=_0x1776a4['length'];if(!_0xdcd26a['query'][_0xd25a('0x34')](_0xd25a('0x4a'))){_0x5580f9[_0xd25a('0x35')]=qs[_0xd25a('0x35')](_0xdcd26a['query']['limit']);_0x5580f9[_0xd25a('0x1a')]=qs['offset'](_0xdcd26a[_0xd25a('0x2d')]['offset']);}return _0x5f4456[_0xd25a('0x46')](_0x5580f9);}})[_0xd25a('0x22')](function(_0x52b70c){if(_0x52b70c){return _0x52b70c?{'count':_0x16621b,'rows':_0x52b70c}:null;}})[_0xd25a('0x22')](respondWithResult(_0x59637c,null))[_0xd25a('0x43')](handleError(_0x59637c,null));};exports[_0xd25a('0x4b')]=function(_0x2ae662,_0x2257cf,_0x3b2034){if(_0x2ae662[_0xd25a('0x45')]['id']){delete _0x2ae662[_0xd25a('0x45')]['id'];}return db[_0xd25a('0x29')][_0xd25a('0x4c')]({'where':{'id':_0x2ae662[_0xd25a('0x40')]['id']}})[_0xd25a('0x22')](handleEntityNotFound(_0x2257cf,null))['then'](function(_0x5c004b){if(_0x5c004b){_0x2ae662[_0xd25a('0x45')][_0xd25a('0x4d')]=_0x5c004b['id'];_0x2ae662[_0xd25a('0x45')][_0xd25a('0x4e')]=integrations[_0xd25a('0x4f')](_0x2ae662['body'][_0xd25a('0x50')],_0x2ae662[_0xd25a('0x45')][_0xd25a('0x3b')]);_0x2ae662[_0xd25a('0x45')][_0xd25a('0x51')]=integrations[_0xd25a('0x52')](_0x2ae662[_0xd25a('0x45')][_0xd25a('0x50')],_0x2ae662[_0xd25a('0x45')][_0xd25a('0x3b')]);return db[_0xd25a('0x47')]['create'](_0x2ae662[_0xd25a('0x45')],{'include':[{'model':db[_0xd25a('0x53')],'as':_0xd25a('0x4e')},{'model':db['SugarcrmField'],'as':_0xd25a('0x51')}]});}return null;})[_0xd25a('0x22')](respondWithResult(_0x2257cf,null))['catch'](handleError(_0x2257cf,null));};exports[_0xd25a('0x54')]=function(_0x395ebb,_0x4bb530,_0x14950a){var _0x21bafc='';var _0x395f41=['id','name',_0xd25a('0x55'),'created_by','description',_0xd25a('0x56'),_0xd25a('0x57'),'duration_minutes','parent_id',_0xd25a('0x58'),'parent_name','direction'];return db[_0xd25a('0x29')]['findOne']({'where':{'id':_0x395ebb[_0xd25a('0x40')]['id']},'attributes':['id',_0xd25a('0x59'),'password','remoteUri']})['then'](handleEntityNotFound(_0x4bb530,null))[_0xd25a('0x22')](function(_0x52bfac){if(_0x52bfac){_0x21bafc=_0x52bfac[_0xd25a('0x5a')];var _0x2671e3=_0x21bafc['slice'](-0x1);if(_0x2671e3==='/'){_0x21bafc=_0x21bafc[_0xd25a('0x5b')](0x0,_0x21bafc[_0xd25a('0x5c')](_0x2671e3));}return rp({'method':_0xd25a('0x5d'),'uri':util[_0xd25a('0x5e')](_0xd25a('0x5f'),_0x21bafc,_0xd25a('0x60')),'json':!![],'form':{'method':_0xd25a('0x61'),'input_type':_0xd25a('0x62'),'response_type':_0xd25a('0x62'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x52bfac[_0xd25a('0x59')],'password':_0x52bfac['password'],'encryption':_0xd25a('0x63')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xd25a('0x22')](function(_0x3f6135){if(_0x3f6135&&_0x3f6135[_0xd25a('0x26')]!==_0xd25a('0x64')&&_0x3f6135['name']!==_0xd25a('0x65')){return rp({'method':'POST','uri':util[_0xd25a('0x5e')]('%s%s',_0x21bafc,_0xd25a('0x60')),'json':!![],'form':{'method':_0xd25a('0x66'),'input_type':_0xd25a('0x62'),'response_type':'JSON','rest_data':JSON[_0xd25a('0x67')]({'session':_0x3f6135['id'],'module_name':_0xd25a('0x68')})}})[_0xd25a('0x22')](function(_0x48ce7d){if(_0x48ce7d){var _0x497409=_['values'](_0x48ce7d['module_fields']);_[_0xd25a('0x69')](_0x497409,function(_0x25334b){return _0x395f41[_0xd25a('0x6a')](_0x25334b['name']);});return{'count':_0x497409[_0xd25a('0x32')],'rows':_[_0xd25a('0x28')](_0x497409,function(_0x2ad739){return{'id':_0x2ad739['name'],'name':_0x2ad739[_0xd25a('0x6b')],'custom':_['endsWith'](_0x2ad739[_0xd25a('0x26')],'_c')?!![]:![],'options':_0x2ad739['options']?_[_0xd25a('0x28')](_[_0xd25a('0x6c')](_0x2ad739[_0xd25a('0x49')]),function(_0x31975b){return{'name':_0x31975b['value'],'value':_0x31975b[_0xd25a('0x26')]};}):[]};})};}})[_0xd25a('0x22')](respondWithResult(_0x4bb530,null))[_0xd25a('0x43')](function(_0x262249){var _0xdb252b=_0x395ebb[_0xd25a('0x2d')]['test']?0x1f4:_0x262249[_0xd25a('0x6d')]||0x1f4;logger['error'](_0xd25a('0x6e'),_0xd25a('0x54'),_0xdb252b,JSON[_0xd25a('0x67')](_0x262249));delete _0x262249[_0xd25a('0x26')];if(_0xdb252b===0x191){_0xdb252b=0x190;}_0x4bb530['status'](_0xdb252b)[_0xd25a('0x6f')](_0x395ebb[_0xd25a('0x2d')][_0xd25a('0x70')]?{'message':_0xd25a('0x71'),'statusCode':_0x262249['statusCode']}:_0x262249);});}else{var _0x5eaf9f=0x1f4;_0x4bb530[_0xd25a('0x17')](_0x5eaf9f)[_0xd25a('0x6f')]({'message':_0xd25a('0x71'),'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 93c0491..2346e6b 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 _0x898f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','int_sugarcrm_accounts','lodash','util'];(function(_0x465137,_0x3ec0b0){var _0xd61384=function(_0x2f2fa3){while(--_0x2f2fa3){_0x465137['push'](_0x465137['shift']());}};_0xd61384(++_0x3ec0b0);}(_0x898f,0x11e));var _0xf898=function(_0x397b73,_0x212a4a){_0x397b73=_0x397b73-0x0;var _0x41102f=_0x898f[_0x397b73];return _0x41102f;};'use strict';var _=require(_0xf898('0x0'));var util=require(_0xf898('0x1'));var logger=require('../../config/logger')(_0xf898('0x2'));var moment=require(_0xf898('0x3'));var BPromise=require(_0xf898('0x4'));var rp=require(_0xf898('0x5'));var fs=require('fs');var path=require(_0xf898('0x6'));var rimraf=require(_0xf898('0x7'));var config=require(_0xf898('0x8'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xf898('0x9'));module[_0xf898('0xa')]=function(_0x4fadea,_0x5aecb0){return _0x4fadea['define']('SugarcrmAccount',attributes,{'tableName':_0xf898('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb368=['rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x6f24f9,_0x14049c){var _0x3d36d7=function(_0x4c54bd){while(--_0x4c54bd){_0x6f24f9['push'](_0x6f24f9['shift']());}};_0x3d36d7(++_0x14049c);}(_0xb368,0x68));var _0x8b36=function(_0x38d2e3,_0x1bc00c){_0x38d2e3=_0x38d2e3-0x0;var _0x5a4e2c=_0xb368[_0x38d2e3];return _0x5a4e2c;};'use strict';var _=require(_0x8b36('0x0'));var util=require(_0x8b36('0x1'));var logger=require(_0x8b36('0x2'))(_0x8b36('0x3'));var moment=require(_0x8b36('0x4'));var BPromise=require(_0x8b36('0x5'));var rp=require(_0x8b36('0x6'));var fs=require('fs');var path=require(_0x8b36('0x7'));var rimraf=require(_0x8b36('0x8'));var config=require(_0x8b36('0x9'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x8b36('0xa'));module[_0x8b36('0xb')]=function(_0x48a8a4,_0x5ce2b7){return _0x48a8a4[_0x8b36('0xc')]('SugarcrmAccount',attributes,{'tableName':_0x8b36('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 10bcc06..72e4a9e 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 _0x99b0=['message','result','catch','GetSugarcrmAccount','findAll','options','raw','attributes','include','map','model','then','ShowSugarcrmAccount','SugarcrmAccount','find','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x2720d2,_0x4a2a30){var _0x407165=function(_0x104664){while(--_0x104664){_0x2720d2['push'](_0x2720d2['shift']());}};_0x407165(++_0x4a2a30);}(_0x99b0,0xaa));var _0x099b=function(_0x2231ae,_0x440448){_0x2231ae=_0x2231ae-0x0;var _0xe0aa1f=_0x99b0[_0x2231ae];return _0xe0aa1f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x099b('0x0'));var BPromise=require('bluebird');var rs=require(_0x099b('0x1'));var fs=require('fs');var Redis=require(_0x099b('0x2'));var db=require(_0x099b('0x3'))['db'];var utils=require(_0x099b('0x4'));var logger=require(_0x099b('0x5'))(_0x099b('0x6'));var config=require('../../config/environment');var jayson=require(_0x099b('0x7'));var client=jayson['client'][_0x099b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x350eec,_0x33e37e,_0x51ee2b){return new BPromise(function(_0x3185a8,_0x28e29c){return client[_0x099b('0x9')](_0x350eec,_0x51ee2b)['then'](function(_0x24e68c){logger[_0x099b('0xa')](_0x099b('0xb'),_0x33e37e,_0x099b('0xc'));logger[_0x099b('0xd')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x33e37e,_0x099b('0xc'),JSON[_0x099b('0xe')](_0x24e68c));if(_0x24e68c[_0x099b('0xf')]){if(_0x24e68c[_0x099b('0xf')]['code']===0x1f4){logger[_0x099b('0xf')](_0x099b('0xb'),_0x33e37e,_0x24e68c['error'][_0x099b('0x10')]);return _0x28e29c(_0x24e68c['error'][_0x099b('0x10')]);}logger[_0x099b('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x33e37e,_0x24e68c[_0x099b('0xf')][_0x099b('0x10')]);return _0x3185a8(_0x24e68c[_0x099b('0xf')]['message']);}else{logger[_0x099b('0xa')](_0x099b('0xb'),_0x33e37e,'request\x20sent');_0x3185a8(_0x24e68c[_0x099b('0x11')]['message']);}})[_0x099b('0x12')](function(_0x2dfa02){logger[_0x099b('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x33e37e,_0x2dfa02);_0x28e29c(_0x2dfa02);});});}exports[_0x099b('0x13')]=function(_0xdf9b7d){var _0x3d40c5=this;return new Promise(function(_0xa56e80,_0x262940){return db['SugarcrmAccount'][_0x099b('0x14')]({'raw':_0xdf9b7d[_0x099b('0x15')]?_0xdf9b7d[_0x099b('0x15')][_0x099b('0x16')]===undefined?!![]:![]:!![],'where':_0xdf9b7d['options']?_0xdf9b7d[_0x099b('0x15')]['where']||null:null,'attributes':_0xdf9b7d['options']?_0xdf9b7d[_0x099b('0x15')][_0x099b('0x17')]||null:null,'limit':_0xdf9b7d[_0x099b('0x15')]?_0xdf9b7d['options']['limit']||null:null,'include':_0xdf9b7d[_0x099b('0x15')]?_0xdf9b7d[_0x099b('0x15')][_0x099b('0x18')]?_[_0x099b('0x19')](_0xdf9b7d['options'][_0x099b('0x18')],function(_0x27a242){return{'model':db[_0x27a242[_0x099b('0x1a')]],'as':_0x27a242['as'],'attributes':_0x27a242[_0x099b('0x17')],'include':_0x27a242['include']?_[_0x099b('0x19')](_0x27a242[_0x099b('0x18')],function(_0x4073f8){return{'model':db[_0x4073f8[_0x099b('0x1a')]],'as':_0x4073f8['as'],'attributes':_0x4073f8[_0x099b('0x17')],'include':_0x4073f8[_0x099b('0x18')]?_[_0x099b('0x19')](_0x4073f8['include'],function(_0x51a316){return{'model':db[_0x51a316[_0x099b('0x1a')]],'as':_0x51a316['as'],'attributes':_0x51a316[_0x099b('0x17')]};}):[]};}):[]};}):[]:[]})[_0x099b('0x1b')](function(_0x33ccec){logger[_0x099b('0xa')](_0x099b('0x13'),_0xdf9b7d);logger[_0x099b('0xd')]('GetSugarcrmAccount',_0xdf9b7d,JSON[_0x099b('0xe')](_0x33ccec));_0xa56e80(_0x33ccec);})[_0x099b('0x12')](function(_0x2d19bf){logger['error']('GetSugarcrmAccount',_0x2d19bf[_0x099b('0x10')],_0xdf9b7d);_0x262940(_0x3d40c5[_0x099b('0xf')](0x1f4,_0x2d19bf['message']));});});};exports[_0x099b('0x1c')]=function(_0x1cb3f9){var _0x2d4619=this;return new Promise(function(_0x595521,_0x4a52ab){return db[_0x099b('0x1d')][_0x099b('0x1e')]({'raw':_0x1cb3f9[_0x099b('0x15')]?_0x1cb3f9[_0x099b('0x15')][_0x099b('0x16')]===undefined?!![]:![]:!![],'where':_0x1cb3f9['options']?_0x1cb3f9[_0x099b('0x15')]['where']||null:null,'attributes':_0x1cb3f9[_0x099b('0x15')]?_0x1cb3f9[_0x099b('0x15')][_0x099b('0x17')]||null:null,'include':_0x1cb3f9['options']?_0x1cb3f9[_0x099b('0x15')][_0x099b('0x18')]?_[_0x099b('0x19')](_0x1cb3f9[_0x099b('0x15')][_0x099b('0x18')],function(_0x5deeaf){return{'model':db[_0x5deeaf[_0x099b('0x1a')]],'as':_0x5deeaf['as'],'attributes':_0x5deeaf[_0x099b('0x17')],'include':_0x5deeaf[_0x099b('0x18')]?_['map'](_0x5deeaf[_0x099b('0x18')],function(_0xd786d){return{'model':db[_0xd786d[_0x099b('0x1a')]],'as':_0xd786d['as'],'attributes':_0xd786d[_0x099b('0x17')],'include':_0xd786d['include']?_['map'](_0xd786d['include'],function(_0xedf3a7){return{'model':db[_0xedf3a7[_0x099b('0x1a')]],'as':_0xedf3a7['as'],'attributes':_0xedf3a7['attributes']};}):[]};}):[]};}):[]:[]})[_0x099b('0x1b')](function(_0x33a25a){logger[_0x099b('0xa')](_0x099b('0x1c'),_0x1cb3f9);logger[_0x099b('0xd')](_0x099b('0x1c'),_0x1cb3f9,JSON[_0x099b('0xe')](_0x33a25a));_0x595521(_0x33a25a);})[_0x099b('0x12')](function(_0x4dee3f){logger[_0x099b('0xf')]('ShowSugarcrmAccount',_0x4dee3f[_0x099b('0x10')],_0x1cb3f9);_0x4a52ab(_0x2d4619[_0x099b('0xf')](0x1f4,_0x4dee3f[_0x099b('0x10')]));});});}; \ No newline at end of file +var _0xa601=['util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','findAll','options','where','attributes','limit','map','model','include','GetSugarcrmAccount','stringify','ShowSugarcrmAccount','SugarcrmAccount','find','raw','debug'];(function(_0x41a821,_0x49a7ae){var _0x561739=function(_0x1b67f0){while(--_0x1b67f0){_0x41a821['push'](_0x41a821['shift']());}};_0x561739(++_0x49a7ae);}(_0xa601,0x108));var _0x1a60=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa601[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x1a60('0x0'));var moment=require(_0x1a60('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1a60('0x2'));var logger=require(_0x1a60('0x3'))(_0x1a60('0x4'));var config=require(_0x1a60('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1a60('0x6')][_0x1a60('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3fcd5c,_0x2c71bf,_0x4d8d77){return new BPromise(function(_0x825c01,_0x3431a0){return client[_0x1a60('0x8')](_0x3fcd5c,_0x4d8d77)[_0x1a60('0x9')](function(_0x15c2cf){logger[_0x1a60('0xa')](_0x1a60('0xb'),_0x2c71bf,_0x1a60('0xc'));logger['debug'](_0x1a60('0xd'),_0x2c71bf,_0x1a60('0xc'),JSON['stringify'](_0x15c2cf));if(_0x15c2cf[_0x1a60('0xe')]){if(_0x15c2cf[_0x1a60('0xe')]['code']===0x1f4){logger['error'](_0x1a60('0xb'),_0x2c71bf,_0x15c2cf[_0x1a60('0xe')][_0x1a60('0xf')]);return _0x3431a0(_0x15c2cf['error'][_0x1a60('0xf')]);}logger[_0x1a60('0xe')](_0x1a60('0xb'),_0x2c71bf,_0x15c2cf[_0x1a60('0xe')][_0x1a60('0xf')]);return _0x825c01(_0x15c2cf['error'][_0x1a60('0xf')]);}else{logger[_0x1a60('0xa')](_0x1a60('0xb'),_0x2c71bf,'request\x20sent');_0x825c01(_0x15c2cf[_0x1a60('0x10')][_0x1a60('0xf')]);}})[_0x1a60('0x11')](function(_0x29f794){logger[_0x1a60('0xe')](_0x1a60('0xb'),_0x2c71bf,_0x29f794);_0x3431a0(_0x29f794);});});}exports['GetSugarcrmAccount']=function(_0x2363ee){var _0x2c3fb6=this;return new Promise(function(_0x3d553b,_0x463ad2){return db['SugarcrmAccount'][_0x1a60('0x12')]({'raw':_0x2363ee[_0x1a60('0x13')]?_0x2363ee['options']['raw']===undefined?!![]:![]:!![],'where':_0x2363ee[_0x1a60('0x13')]?_0x2363ee[_0x1a60('0x13')][_0x1a60('0x14')]||null:null,'attributes':_0x2363ee['options']?_0x2363ee[_0x1a60('0x13')][_0x1a60('0x15')]||null:null,'limit':_0x2363ee[_0x1a60('0x13')]?_0x2363ee[_0x1a60('0x13')][_0x1a60('0x16')]||null:null,'include':_0x2363ee[_0x1a60('0x13')]?_0x2363ee[_0x1a60('0x13')]['include']?_[_0x1a60('0x17')](_0x2363ee[_0x1a60('0x13')]['include'],function(_0x243080){return{'model':db[_0x243080[_0x1a60('0x18')]],'as':_0x243080['as'],'attributes':_0x243080['attributes'],'include':_0x243080[_0x1a60('0x19')]?_[_0x1a60('0x17')](_0x243080['include'],function(_0x6f52a7){return{'model':db[_0x6f52a7['model']],'as':_0x6f52a7['as'],'attributes':_0x6f52a7[_0x1a60('0x15')],'include':_0x6f52a7['include']?_[_0x1a60('0x17')](_0x6f52a7[_0x1a60('0x19')],function(_0x3dfea7){return{'model':db[_0x3dfea7['model']],'as':_0x3dfea7['as'],'attributes':_0x3dfea7[_0x1a60('0x15')]};}):[]};}):[]};}):[]:[]})[_0x1a60('0x9')](function(_0x432dee){logger[_0x1a60('0xa')](_0x1a60('0x1a'),_0x2363ee);logger['debug'](_0x1a60('0x1a'),_0x2363ee,JSON[_0x1a60('0x1b')](_0x432dee));_0x3d553b(_0x432dee);})[_0x1a60('0x11')](function(_0x5f3cd4){logger[_0x1a60('0xe')](_0x1a60('0x1a'),_0x5f3cd4['message'],_0x2363ee);_0x463ad2(_0x2c3fb6[_0x1a60('0xe')](0x1f4,_0x5f3cd4[_0x1a60('0xf')]));});});};exports[_0x1a60('0x1c')]=function(_0x230dbb){var _0x135285=this;return new Promise(function(_0x11ee7a,_0x10913c){return db[_0x1a60('0x1d')][_0x1a60('0x1e')]({'raw':_0x230dbb[_0x1a60('0x13')]?_0x230dbb['options'][_0x1a60('0x1f')]===undefined?!![]:![]:!![],'where':_0x230dbb[_0x1a60('0x13')]?_0x230dbb[_0x1a60('0x13')][_0x1a60('0x14')]||null:null,'attributes':_0x230dbb[_0x1a60('0x13')]?_0x230dbb[_0x1a60('0x13')][_0x1a60('0x15')]||null:null,'include':_0x230dbb[_0x1a60('0x13')]?_0x230dbb[_0x1a60('0x13')]['include']?_[_0x1a60('0x17')](_0x230dbb[_0x1a60('0x13')][_0x1a60('0x19')],function(_0x56ff34){return{'model':db[_0x56ff34[_0x1a60('0x18')]],'as':_0x56ff34['as'],'attributes':_0x56ff34[_0x1a60('0x15')],'include':_0x56ff34[_0x1a60('0x19')]?_[_0x1a60('0x17')](_0x56ff34[_0x1a60('0x19')],function(_0x5c683c){return{'model':db[_0x5c683c[_0x1a60('0x18')]],'as':_0x5c683c['as'],'attributes':_0x5c683c[_0x1a60('0x15')],'include':_0x5c683c[_0x1a60('0x19')]?_[_0x1a60('0x17')](_0x5c683c[_0x1a60('0x19')],function(_0x2da7d7){return{'model':db[_0x2da7d7[_0x1a60('0x18')]],'as':_0x2da7d7['as'],'attributes':_0x2da7d7['attributes']};}):[]};}):[]};}):[]:[]})[_0x1a60('0x9')](function(_0x26277c){logger[_0x1a60('0xa')]('ShowSugarcrmAccount',_0x230dbb);logger[_0x1a60('0x20')](_0x1a60('0x1c'),_0x230dbb,JSON['stringify'](_0x26277c));_0x11ee7a(_0x26277c);})['catch'](function(_0x4de0a5){logger[_0x1a60('0xe')](_0x1a60('0x1c'),_0x4de0a5[_0x1a60('0xf')],_0x230dbb);_0x10913c(_0x135285[_0x1a60('0xe')](0x1f4,_0x4de0a5['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 13332f4..b6fda6f 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 _0x71a1=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','update','destroy','exports','multer','util','path'];(function(_0x5e3b04,_0x1a1c2f){var _0x216a46=function(_0x30abf7){while(--_0x30abf7){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x216a46(++_0x1a1c2f);}(_0x71a1,0xfa));var _0x171a=function(_0x18ea47,_0x396db6){_0x18ea47=_0x18ea47-0x0;var _0x51e29f=_0x71a1[_0x18ea47];return _0x51e29f;};'use strict';var multer=require(_0x171a('0x0'));var util=require(_0x171a('0x1'));var path=require(_0x171a('0x2'));var timeout=require(_0x171a('0x3'));var express=require(_0x171a('0x4'));var router=express[_0x171a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x171a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x171a('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x171a('0x8')]('/',auth[_0x171a('0x9')](),controller[_0x171a('0xa')]);router['get'](_0x171a('0xb'),auth[_0x171a('0x9')](),controller[_0x171a('0xc')]);router[_0x171a('0x8')](_0x171a('0xd'),auth['isAuthenticated'](),controller[_0x171a('0xe')]);router[_0x171a('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x171a('0xf')]);router[_0x171a('0x8')](_0x171a('0x10'),auth['isAuthenticated'](),controller[_0x171a('0x11')]);router[_0x171a('0x12')]('/',auth[_0x171a('0x9')](),controller[_0x171a('0x13')]);router['put']('/:id',auth[_0x171a('0x9')](),controller[_0x171a('0x14')]);router['delete'](_0x171a('0xb'),auth[_0x171a('0x9')](),controller[_0x171a('0x15')]);module[_0x171a('0x16')]=router; \ No newline at end of file +var _0x6c41=['isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x1184e6,_0x567817){var _0x52052d=function(_0x178525){while(--_0x178525){_0x1184e6['push'](_0x1184e6['shift']());}};_0x52052d(++_0x567817);}(_0x6c41,0x7d));var _0x16c4=function(_0x172ed7,_0x3d08fd){_0x172ed7=_0x172ed7-0x0;var _0xfa8f61=_0x6c41[_0x172ed7];return _0xfa8f61;};'use strict';var multer=require(_0x16c4('0x0'));var util=require(_0x16c4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x16c4('0x2'));var router=express[_0x16c4('0x3')]();var fs_extra=require(_0x16c4('0x4'));var auth=require(_0x16c4('0x5'));var interaction=require(_0x16c4('0x6'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0x16c4('0x7')]('/',auth[_0x16c4('0x8')](),controller['index']);router[_0x16c4('0x7')](_0x16c4('0x9'),auth[_0x16c4('0x8')](),controller[_0x16c4('0xa')]);router['get'](_0x16c4('0xb'),auth['isAuthenticated'](),controller[_0x16c4('0xc')]);router['get'](_0x16c4('0xd'),auth['isAuthenticated'](),controller[_0x16c4('0xe')]);router[_0x16c4('0x7')](_0x16c4('0xf'),auth[_0x16c4('0x8')](),controller['getDescriptions']);router[_0x16c4('0x10')]('/',auth['isAuthenticated'](),controller[_0x16c4('0x11')]);router['put'](_0x16c4('0x9'),auth[_0x16c4('0x8')](),controller['update']);router['delete'](_0x16c4('0x9'),auth[_0x16c4('0x8')](),controller['destroy']);module[_0x16c4('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 7ca0516..5f32bc6 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 _0x60a9=['STRING','sequelize'];(function(_0xf68efd,_0x554066){var _0x11d2fb=function(_0x3fa10e){while(--_0x3fa10e){_0xf68efd['push'](_0xf68efd['shift']());}};_0x11d2fb(++_0x554066);}(_0x60a9,0xf5));var _0x960a=function(_0x1b18c5,_0x18494f){_0x1b18c5=_0x1b18c5-0x0;var _0x2a10c8=_0x60a9[_0x1b18c5];return _0x2a10c8;};'use strict';var Sequelize=require(_0x960a('0x0'));module['exports']={'name':{'type':Sequelize[_0x960a('0x1')]},'description':{'type':Sequelize[_0x960a('0x1')]}}; \ No newline at end of file +var _0x1f71=['sequelize','exports','STRING'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x1f71,0xc9));var _0x11f7=function(_0x1af894,_0x11d190){_0x1af894=_0x1af894-0x0;var _0x1f8003=_0x1f71[_0x1af894];return _0x1f8003;};'use strict';var Sequelize=require(_0x11f7('0x0'));module[_0x11f7('0x1')]={'name':{'type':Sequelize[_0x11f7('0x2')]},'description':{'type':Sequelize[_0x11f7('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 63b4ead..9d78b1f 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 _0xec07=['json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','destroy','then','error','name','send','index','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','show','params','fields','merge','find','catch','create','body','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','zip-dir','moment','mustache','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x4fb5f6,_0x7c07d0){var _0x4be350=function(_0x34785b){while(--_0x34785b){_0x4fb5f6['push'](_0x4fb5f6['shift']());}};_0x4be350(++_0x7c07d0);}(_0xec07,0x82));var _0x7ec0=function(_0x10d9c1,_0xea6f87){_0x10d9c1=_0x10d9c1-0x0;var _0x126310=_0xec07[_0x10d9c1];return _0x126310;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7ec0('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7ec0('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x7ec0('0x2'));var util=require('util');var path=require(_0x7ec0('0x3'));var sox=require('sox');var csv=require(_0x7ec0('0x4'));var ejs=require(_0x7ec0('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7ec0('0x6'));var squel=require('squel');var crypto=require(_0x7ec0('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x7ec0('0x8'));var toCsv=require(_0x7ec0('0x4'));var querystring=require(_0x7ec0('0x9'));var Papa=require(_0x7ec0('0xa'));var Redis=require('ioredis');var authService=require(_0x7ec0('0xb'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7ec0('0xc'))(_0x7ec0('0xd'));var utils=require(_0x7ec0('0xe'));var config=require(_0x7ec0('0xf'));var licenseUtil=require(_0x7ec0('0x10'));var db=require(_0x7ec0('0x11'))['db'];function respondWithStatusCode(_0x20f6a3,_0x3a2f30){_0x3a2f30=_0x3a2f30||0xcc;return function(_0x276463){if(_0x276463){return _0x20f6a3[_0x7ec0('0x12')](_0x3a2f30);}return _0x20f6a3['status'](_0x3a2f30)[_0x7ec0('0x13')]();};}function respondWithResult(_0x8cbbe7,_0x33e907){_0x33e907=_0x33e907||0xc8;return function(_0x5ba9d4){if(_0x5ba9d4){return _0x8cbbe7['status'](_0x33e907)[_0x7ec0('0x14')](_0x5ba9d4);}};}function respondWithFilteredResult(_0x59ed74,_0x2a2025){return function(_0x2778af){if(_0x2778af){var _0x28b2ea=typeof _0x2a2025[_0x7ec0('0x15')]===_0x7ec0('0x16')&&typeof _0x2a2025[_0x7ec0('0x17')]===_0x7ec0('0x16');var _0x4c0277=_0x2778af[_0x7ec0('0x18')];var _0x31b307=_0x28b2ea?0x0:_0x2a2025[_0x7ec0('0x15')];var _0x194151=_0x28b2ea?_0x2778af[_0x7ec0('0x18')]:_0x2a2025[_0x7ec0('0x15')]+_0x2a2025['limit'];var _0x47b938;if(_0x194151>=_0x4c0277){_0x194151=_0x4c0277;_0x47b938=0xc8;}else{_0x47b938=0xce;}_0x59ed74[_0x7ec0('0x19')](_0x47b938);return _0x59ed74[_0x7ec0('0x1a')](_0x7ec0('0x1b'),_0x31b307+'-'+_0x194151+'/'+_0x4c0277)[_0x7ec0('0x14')](_0x2778af);}return null;};}function patchUpdates(_0x29fae4){return function(_0x5118e1){try{jsonpatch[_0x7ec0('0x1c')](_0x5118e1,_0x29fae4,!![]);}catch(_0x28410c){return BPromise[_0x7ec0('0x1d')](_0x28410c);}return _0x5118e1[_0x7ec0('0x1e')]();};}function saveUpdates(_0xbc5c66,_0x39b169){return function(_0x3a49d8){if(_0x3a49d8){return _0x3a49d8['update'](_0xbc5c66)['then'](function(_0x24220d){return _0x24220d;});}return null;};}function removeEntity(_0x3c95e5,_0x2663b2){return function(_0xa90659){if(_0xa90659){return _0xa90659[_0x7ec0('0x1f')]()[_0x7ec0('0x20')](function(){_0x3c95e5[_0x7ec0('0x19')](0xcc)[_0x7ec0('0x13')]();});}};}function handleEntityNotFound(_0x81c2a4,_0x22ae95){return function(_0x572d0a){if(!_0x572d0a){_0x81c2a4[_0x7ec0('0x12')](0x194);}return _0x572d0a;};}function handleError(_0x156cf3,_0x4e62e1){_0x4e62e1=_0x4e62e1||0x1f4;return function(_0x2b3447){logger[_0x7ec0('0x21')](_0x2b3447['stack']);if(_0x2b3447[_0x7ec0('0x22')]){delete _0x2b3447['name'];}_0x156cf3['status'](_0x4e62e1)[_0x7ec0('0x23')](_0x2b3447);};}exports[_0x7ec0('0x24')]=function(_0x1022db,_0x41e6dd){var _0x2b6b1c={},_0x578571={},_0xb8d670={'count':0x0,'rows':[]};var _0x37d6d0=_['map'](db[_0x7ec0('0x25')][_0x7ec0('0x26')],function(_0x1b28c1){return{'name':_0x1b28c1[_0x7ec0('0x27')],'type':_0x1b28c1[_0x7ec0('0x28')][_0x7ec0('0x29')]};});_0x578571[_0x7ec0('0x2a')]=_[_0x7ec0('0x2b')](_0x37d6d0,_0x7ec0('0x22'));_0x578571['query']=_[_0x7ec0('0x2c')](_0x1022db[_0x7ec0('0x2d')]);_0x578571['filters']=_[_0x7ec0('0x2e')](_0x578571['model'],_0x578571[_0x7ec0('0x2d')]);_0x2b6b1c['attributes']=_['intersection'](_0x578571[_0x7ec0('0x2a')],qs['fields'](_0x1022db[_0x7ec0('0x2d')]['fields']));_0x2b6b1c[_0x7ec0('0x2f')]=_0x2b6b1c['attributes'][_0x7ec0('0x30')]?_0x2b6b1c[_0x7ec0('0x2f')]:_0x578571['model'];if(!_0x1022db[_0x7ec0('0x2d')][_0x7ec0('0x31')](_0x7ec0('0x32'))){_0x2b6b1c[_0x7ec0('0x17')]=qs['limit'](_0x1022db['query'][_0x7ec0('0x17')]);_0x2b6b1c['offset']=qs[_0x7ec0('0x15')](_0x1022db[_0x7ec0('0x2d')][_0x7ec0('0x15')]);}_0x2b6b1c[_0x7ec0('0x33')]=qs[_0x7ec0('0x34')](_0x1022db[_0x7ec0('0x2d')][_0x7ec0('0x34')]);_0x2b6b1c['where']=qs[_0x7ec0('0x35')](_[_0x7ec0('0x36')](_0x1022db['query'],_0x578571['filters']),_0x37d6d0);if(_0x1022db['query'][_0x7ec0('0x37')]){_0x2b6b1c[_0x7ec0('0x38')]=_['merge'](_0x2b6b1c['where'],{'$or':_[_0x7ec0('0x2b')](_0x37d6d0,function(_0x59e532){if(_0x59e532[_0x7ec0('0x28')]!==_0x7ec0('0x39')){var _0x11fb11={};_0x11fb11[_0x59e532[_0x7ec0('0x22')]]={'$like':'%'+_0x1022db[_0x7ec0('0x2d')][_0x7ec0('0x37')]+'%'};return _0x11fb11;}})});}_0x2b6b1c=_['merge']({},_0x2b6b1c,_0x1022db[_0x7ec0('0x3a')]);var _0x1dbf3d={'where':_0x2b6b1c['where']};return db[_0x7ec0('0x25')]['count'](_0x1dbf3d)[_0x7ec0('0x20')](function(_0x1dd032){_0xb8d670['count']=_0x1dd032;if(_0x1022db[_0x7ec0('0x2d')][_0x7ec0('0x3b')]){_0x2b6b1c[_0x7ec0('0x3c')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x7ec0('0x3d')](_0x2b6b1c);})['then'](function(_0x5aa39e){_0xb8d670['rows']=_0x5aa39e;return _0xb8d670;})[_0x7ec0('0x20')](respondWithFilteredResult(_0x41e6dd,_0x2b6b1c))['catch'](handleError(_0x41e6dd,null));};exports[_0x7ec0('0x3e')]=function(_0x4bec9e,_0xfbe07a){var _0x230b19={'raw':![],'where':{'id':_0x4bec9e[_0x7ec0('0x3f')]['id']}},_0x2fb8a4={};_0x2fb8a4[_0x7ec0('0x2a')]=_[_0x7ec0('0x2c')](db[_0x7ec0('0x25')][_0x7ec0('0x26')]);_0x2fb8a4['query']=_[_0x7ec0('0x2c')](_0x4bec9e[_0x7ec0('0x2d')]);_0x2fb8a4[_0x7ec0('0x35')]=_[_0x7ec0('0x2e')](_0x2fb8a4['model'],_0x2fb8a4[_0x7ec0('0x2d')]);_0x230b19[_0x7ec0('0x2f')]=_['intersection'](_0x2fb8a4[_0x7ec0('0x2a')],qs['fields'](_0x4bec9e[_0x7ec0('0x2d')][_0x7ec0('0x40')]));_0x230b19['attributes']=_0x230b19['attributes'][_0x7ec0('0x30')]?_0x230b19['attributes']:_0x2fb8a4[_0x7ec0('0x2a')];if(_0x4bec9e[_0x7ec0('0x2d')][_0x7ec0('0x3b')]){_0x230b19['include']=[{'all':!![]}];}_0x230b19=_[_0x7ec0('0x41')]({},_0x230b19,_0x4bec9e['options']);return db['SugarcrmConfiguration'][_0x7ec0('0x42')](_0x230b19)[_0x7ec0('0x20')](handleEntityNotFound(_0xfbe07a,null))[_0x7ec0('0x20')](respondWithResult(_0xfbe07a,null))[_0x7ec0('0x43')](handleError(_0xfbe07a,null));};exports[_0x7ec0('0x44')]=function(_0x3237e3,_0x56dc80){return db[_0x7ec0('0x25')][_0x7ec0('0x44')](_0x3237e3[_0x7ec0('0x45')],{})[_0x7ec0('0x20')](respondWithResult(_0x56dc80,0xc9))['catch'](handleError(_0x56dc80,null));};exports['update']=function(_0x1d4add,_0x5a142b){if(_0x1d4add[_0x7ec0('0x45')]['id']){delete _0x1d4add['body']['id'];}return db[_0x7ec0('0x25')]['find']({'where':{'id':_0x1d4add[_0x7ec0('0x3f')]['id']}})[_0x7ec0('0x20')](handleEntityNotFound(_0x5a142b,null))[_0x7ec0('0x20')](saveUpdates(_0x1d4add['body'],null))['then'](respondWithResult(_0x5a142b,null))['catch'](handleError(_0x5a142b,null));};exports[_0x7ec0('0x1f')]=function(_0x2bcf8a,_0x23718e){return db[_0x7ec0('0x25')][_0x7ec0('0x42')]({'where':{'id':_0x2bcf8a[_0x7ec0('0x3f')]['id']}})[_0x7ec0('0x20')](handleEntityNotFound(_0x23718e,null))[_0x7ec0('0x20')](removeEntity(_0x23718e,null))[_0x7ec0('0x43')](handleError(_0x23718e,null));};exports[_0x7ec0('0x46')]=function(_0x1c55af,_0x2025af,_0xd9486c){var _0x5368d9={};var _0x5da8eb={};var _0x3027e0;var _0x1602b7;return db[_0x7ec0('0x25')][_0x7ec0('0x47')]({'where':{'id':_0x1c55af[_0x7ec0('0x3f')]['id']}})[_0x7ec0('0x20')](handleEntityNotFound(_0x2025af,null))[_0x7ec0('0x20')](function(_0x507d21){if(_0x507d21){_0x3027e0=_0x507d21;_0x5da8eb[_0x7ec0('0x2a')]=_['keys'](db[_0x7ec0('0x48')]['rawAttributes']);_0x5da8eb['query']=_['keys'](_0x1c55af[_0x7ec0('0x2d')]);_0x5da8eb[_0x7ec0('0x35')]=_['intersection'](_0x5da8eb[_0x7ec0('0x2a')],_0x5da8eb[_0x7ec0('0x2d')]);_0x5368d9['attributes']=_['intersection'](_0x5da8eb[_0x7ec0('0x2a')],qs[_0x7ec0('0x40')](_0x1c55af[_0x7ec0('0x2d')][_0x7ec0('0x40')]));_0x5368d9[_0x7ec0('0x2f')]=_0x5368d9[_0x7ec0('0x2f')]['length']?_0x5368d9[_0x7ec0('0x2f')]:_0x5da8eb[_0x7ec0('0x2a')];_0x5368d9[_0x7ec0('0x33')]=qs[_0x7ec0('0x34')](_0x1c55af['query'][_0x7ec0('0x34')]);_0x5368d9['where']=qs[_0x7ec0('0x35')](_[_0x7ec0('0x36')](_0x1c55af['query'],_0x5da8eb[_0x7ec0('0x35')]));if(_0x1c55af['query'][_0x7ec0('0x37')]){_0x5368d9[_0x7ec0('0x38')]=_[_0x7ec0('0x41')](_0x5368d9['where'],{'$or':_[_0x7ec0('0x2b')](_0x5368d9[_0x7ec0('0x2f')],function(_0x2885a5){var _0x3f676f={};_0x3f676f[_0x2885a5]={'$like':'%'+_0x1c55af[_0x7ec0('0x2d')][_0x7ec0('0x37')]+'%'};return _0x3f676f;})});}_0x5368d9=_[_0x7ec0('0x41')]({},_0x5368d9,_0x1c55af[_0x7ec0('0x3a')]);return _0x3027e0[_0x7ec0('0x46')](_0x5368d9);}})[_0x7ec0('0x20')](function(_0x5deae3){if(_0x5deae3){_0x1602b7=_0x5deae3['length'];if(!_0x1c55af[_0x7ec0('0x2d')][_0x7ec0('0x31')](_0x7ec0('0x32'))){_0x5368d9[_0x7ec0('0x17')]=qs[_0x7ec0('0x17')](_0x1c55af[_0x7ec0('0x2d')][_0x7ec0('0x17')]);_0x5368d9[_0x7ec0('0x15')]=qs[_0x7ec0('0x15')](_0x1c55af[_0x7ec0('0x2d')][_0x7ec0('0x15')]);}return _0x3027e0['getFields'](_0x5368d9);}})[_0x7ec0('0x20')](function(_0x1e283e){if(_0x1e283e){return _0x1e283e?{'count':_0x1602b7,'rows':_0x1e283e}:null;}})['then'](respondWithResult(_0x2025af,null))['catch'](handleError(_0x2025af,null));};exports[_0x7ec0('0x49')]=function(_0x39b559,_0x20d186,_0x319d4f){var _0x5b423d={};var _0x1dd037={};var _0x13a092;var _0x55b21f;return db[_0x7ec0('0x25')][_0x7ec0('0x47')]({'where':{'id':_0x39b559['params']['id']}})['then'](handleEntityNotFound(_0x20d186,null))['then'](function(_0x631e74){if(_0x631e74){_0x13a092=_0x631e74;_0x1dd037[_0x7ec0('0x2a')]=_[_0x7ec0('0x2c')](db['SugarcrmField'][_0x7ec0('0x26')]);_0x1dd037[_0x7ec0('0x2d')]=_[_0x7ec0('0x2c')](_0x39b559[_0x7ec0('0x2d')]);_0x1dd037[_0x7ec0('0x35')]=_['intersection'](_0x1dd037[_0x7ec0('0x2a')],_0x1dd037['query']);_0x5b423d['attributes']=_[_0x7ec0('0x2e')](_0x1dd037[_0x7ec0('0x2a')],qs['fields'](_0x39b559['query'][_0x7ec0('0x40')]));_0x5b423d[_0x7ec0('0x2f')]=_0x5b423d[_0x7ec0('0x2f')][_0x7ec0('0x30')]?_0x5b423d['attributes']:_0x1dd037[_0x7ec0('0x2a')];_0x5b423d[_0x7ec0('0x33')]=qs[_0x7ec0('0x34')](_0x39b559[_0x7ec0('0x2d')]['sort']);_0x5b423d['where']=qs['filters'](_['pick'](_0x39b559['query'],_0x1dd037['filters']));if(_0x39b559[_0x7ec0('0x2d')][_0x7ec0('0x37')]){_0x5b423d[_0x7ec0('0x38')]=_[_0x7ec0('0x41')](_0x5b423d['where'],{'$or':_['map'](_0x5b423d[_0x7ec0('0x2f')],function(_0x4b24bb){var _0xa53a38={};_0xa53a38[_0x4b24bb]={'$like':'%'+_0x39b559[_0x7ec0('0x2d')]['filter']+'%'};return _0xa53a38;})});}_0x5b423d=_[_0x7ec0('0x41')]({},_0x5b423d,_0x39b559[_0x7ec0('0x3a')]);return _0x13a092[_0x7ec0('0x49')](_0x5b423d);}})[_0x7ec0('0x20')](function(_0x1fe791){if(_0x1fe791){_0x55b21f=_0x1fe791[_0x7ec0('0x30')];if(!_0x39b559[_0x7ec0('0x2d')][_0x7ec0('0x31')]('nolimit')){_0x5b423d[_0x7ec0('0x17')]=qs['limit'](_0x39b559[_0x7ec0('0x2d')][_0x7ec0('0x17')]);_0x5b423d[_0x7ec0('0x15')]=qs[_0x7ec0('0x15')](_0x39b559[_0x7ec0('0x2d')][_0x7ec0('0x15')]);}return _0x13a092[_0x7ec0('0x49')](_0x5b423d);}})[_0x7ec0('0x20')](function(_0x8d5018){if(_0x8d5018){return _0x8d5018?{'count':_0x55b21f,'rows':_0x8d5018}:null;}})[_0x7ec0('0x20')](respondWithResult(_0x20d186,null))[_0x7ec0('0x43')](handleError(_0x20d186,null));};exports[_0x7ec0('0x4a')]=function(_0x3ebe51,_0x1a5a55,_0x2b56a3){var _0x2f29e9={};var _0x1d6fcb={};var _0x578fa5;var _0x3a19cc;return db['SugarcrmConfiguration'][_0x7ec0('0x47')]({'where':{'id':_0x3ebe51[_0x7ec0('0x3f')]['id']}})[_0x7ec0('0x20')](handleEntityNotFound(_0x1a5a55,null))[_0x7ec0('0x20')](function(_0x558ae2){if(_0x558ae2){_0x578fa5=_0x558ae2;_0x1d6fcb['model']=_[_0x7ec0('0x2c')](db[_0x7ec0('0x48')][_0x7ec0('0x26')]);_0x1d6fcb['query']=_[_0x7ec0('0x2c')](_0x3ebe51['query']);_0x1d6fcb[_0x7ec0('0x35')]=_[_0x7ec0('0x2e')](_0x1d6fcb[_0x7ec0('0x2a')],_0x1d6fcb[_0x7ec0('0x2d')]);_0x2f29e9[_0x7ec0('0x2f')]=_[_0x7ec0('0x2e')](_0x1d6fcb['model'],qs[_0x7ec0('0x40')](_0x3ebe51['query'][_0x7ec0('0x40')]));_0x2f29e9[_0x7ec0('0x2f')]=_0x2f29e9[_0x7ec0('0x2f')][_0x7ec0('0x30')]?_0x2f29e9[_0x7ec0('0x2f')]:_0x1d6fcb[_0x7ec0('0x2a')];_0x2f29e9[_0x7ec0('0x33')]=qs[_0x7ec0('0x34')](_0x3ebe51[_0x7ec0('0x2d')][_0x7ec0('0x34')]);_0x2f29e9[_0x7ec0('0x38')]=qs['filters'](_[_0x7ec0('0x36')](_0x3ebe51[_0x7ec0('0x2d')],_0x1d6fcb['filters']));if(_0x3ebe51[_0x7ec0('0x2d')][_0x7ec0('0x37')]){_0x2f29e9['where']=_['merge'](_0x2f29e9[_0x7ec0('0x38')],{'$or':_[_0x7ec0('0x2b')](_0x2f29e9[_0x7ec0('0x2f')],function(_0x922bc3){var _0x3fbe47={};_0x3fbe47[_0x922bc3]={'$like':'%'+_0x3ebe51[_0x7ec0('0x2d')][_0x7ec0('0x37')]+'%'};return _0x3fbe47;})});}_0x2f29e9=_[_0x7ec0('0x41')]({},_0x2f29e9,_0x3ebe51[_0x7ec0('0x3a')]);return _0x578fa5[_0x7ec0('0x4a')](_0x2f29e9);}})[_0x7ec0('0x20')](function(_0x41b84f){if(_0x41b84f){_0x3a19cc=_0x41b84f[_0x7ec0('0x30')];if(!_0x3ebe51[_0x7ec0('0x2d')][_0x7ec0('0x31')](_0x7ec0('0x32'))){_0x2f29e9[_0x7ec0('0x17')]=qs['limit'](_0x3ebe51['query']['limit']);_0x2f29e9[_0x7ec0('0x15')]=qs['offset'](_0x3ebe51['query'][_0x7ec0('0x15')]);}return _0x578fa5[_0x7ec0('0x4a')](_0x2f29e9);}})['then'](function(_0x2acd1d){if(_0x2acd1d){return _0x2acd1d?{'count':_0x3a19cc,'rows':_0x2acd1d}:null;}})[_0x7ec0('0x20')](respondWithResult(_0x1a5a55,null))[_0x7ec0('0x43')](handleError(_0x1a5a55,null));}; \ No newline at end of file +var _0xb31e=['count','offset','set','json','save','destroy','end','error','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','SugarcrmConfiguration','then','include','rows','catch','show','includeAll','options','find','create','body','update','params','getFields','findOne','SugarcrmField','rawAttributes','getSubjects','hasOwnProperty','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb31e,0x11f));var _0xeb31=function(_0x2dd8b5,_0x130f35){_0x2dd8b5=_0x2dd8b5-0x0;var _0x1d8c18=_0xb31e[_0x2dd8b5];return _0x1d8c18;};'use strict';var emlformat=require(_0xeb31('0x0'));var rimraf=require(_0xeb31('0x1'));var zipdir=require(_0xeb31('0x2'));var jsonpatch=require(_0xeb31('0x3'));var rp=require(_0xeb31('0x4'));var moment=require(_0xeb31('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xeb31('0x6'));var util=require(_0xeb31('0x7'));var path=require(_0xeb31('0x8'));var sox=require(_0xeb31('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb31('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeb31('0xb'));var toCsv=require(_0xeb31('0xc'));var querystring=require(_0xeb31('0xd'));var Papa=require(_0xeb31('0xe'));var Redis=require(_0xeb31('0xf'));var authService=require(_0xeb31('0x10'));var qs=require(_0xeb31('0x11'));var as=require(_0xeb31('0x12'));var hardwareService=require(_0xeb31('0x13'));var logger=require(_0xeb31('0x14'))('api');var utils=require(_0xeb31('0x15'));var config=require(_0xeb31('0x16'));var licenseUtil=require(_0xeb31('0x17'));var db=require(_0xeb31('0x18'))['db'];function respondWithStatusCode(_0x135f6d,_0x877b05){_0x877b05=_0x877b05||0xcc;return function(_0x31cda8){if(_0x31cda8){return _0x135f6d[_0xeb31('0x19')](_0x877b05);}return _0x135f6d[_0xeb31('0x1a')](_0x877b05)['end']();};}function respondWithResult(_0x2cbd46,_0x6f694b){_0x6f694b=_0x6f694b||0xc8;return function(_0x20d5a8){if(_0x20d5a8){return _0x2cbd46['status'](_0x6f694b)['json'](_0x20d5a8);}};}function respondWithFilteredResult(_0xe1ca8,_0x22b6c6){return function(_0xeefc77){if(_0xeefc77){var _0x2aadc3=typeof _0x22b6c6['offset']===_0xeb31('0x1b')&&typeof _0x22b6c6[_0xeb31('0x1c')]===_0xeb31('0x1b');var _0x38ebdd=_0xeefc77[_0xeb31('0x1d')];var _0x557b86=_0x2aadc3?0x0:_0x22b6c6['offset'];var _0x360f2c=_0x2aadc3?_0xeefc77[_0xeb31('0x1d')]:_0x22b6c6[_0xeb31('0x1e')]+_0x22b6c6[_0xeb31('0x1c')];var _0x27ab2e;if(_0x360f2c>=_0x38ebdd){_0x360f2c=_0x38ebdd;_0x27ab2e=0xc8;}else{_0x27ab2e=0xce;}_0xe1ca8[_0xeb31('0x1a')](_0x27ab2e);return _0xe1ca8[_0xeb31('0x1f')]('Content-Range',_0x557b86+'-'+_0x360f2c+'/'+_0x38ebdd)[_0xeb31('0x20')](_0xeefc77);}return null;};}function patchUpdates(_0x540e21){return function(_0x1b9d8c){try{jsonpatch['apply'](_0x1b9d8c,_0x540e21,!![]);}catch(_0x2352b2){return BPromise['reject'](_0x2352b2);}return _0x1b9d8c[_0xeb31('0x21')]();};}function saveUpdates(_0x269305,_0x8d9f7c){return function(_0x5e7e85){if(_0x5e7e85){return _0x5e7e85['update'](_0x269305)['then'](function(_0x325552){return _0x325552;});}return null;};}function removeEntity(_0x522068,_0x5f0988){return function(_0x4ab600){if(_0x4ab600){return _0x4ab600[_0xeb31('0x22')]()['then'](function(){_0x522068[_0xeb31('0x1a')](0xcc)[_0xeb31('0x23')]();});}};}function handleEntityNotFound(_0x1a682c,_0x171731){return function(_0xa954b5){if(!_0xa954b5){_0x1a682c['sendStatus'](0x194);}return _0xa954b5;};}function handleError(_0x346900,_0x3482c8){_0x3482c8=_0x3482c8||0x1f4;return function(_0x336855){logger[_0xeb31('0x24')](_0x336855[_0xeb31('0x25')]);if(_0x336855[_0xeb31('0x26')]){delete _0x336855['name'];}_0x346900[_0xeb31('0x1a')](_0x3482c8)[_0xeb31('0x27')](_0x336855);};}exports[_0xeb31('0x28')]=function(_0x22a553,_0x162b65){var _0x1e06be={},_0x2cacd4={},_0x1daa80={'count':0x0,'rows':[]};var _0x1559ec=_[_0xeb31('0x29')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x5bdf0e){return{'name':_0x5bdf0e['fieldName'],'type':_0x5bdf0e[_0xeb31('0x2a')][_0xeb31('0x2b')]};});_0x2cacd4[_0xeb31('0x2c')]=_[_0xeb31('0x29')](_0x1559ec,_0xeb31('0x26'));_0x2cacd4[_0xeb31('0x2d')]=_[_0xeb31('0x2e')](_0x22a553['query']);_0x2cacd4[_0xeb31('0x2f')]=_[_0xeb31('0x30')](_0x2cacd4[_0xeb31('0x2c')],_0x2cacd4['query']);_0x1e06be[_0xeb31('0x31')]=_['intersection'](_0x2cacd4[_0xeb31('0x2c')],qs['fields'](_0x22a553[_0xeb31('0x2d')][_0xeb31('0x32')]));_0x1e06be[_0xeb31('0x31')]=_0x1e06be[_0xeb31('0x31')][_0xeb31('0x33')]?_0x1e06be['attributes']:_0x2cacd4[_0xeb31('0x2c')];if(!_0x22a553['query']['hasOwnProperty']('nolimit')){_0x1e06be[_0xeb31('0x1c')]=qs[_0xeb31('0x1c')](_0x22a553['query']['limit']);_0x1e06be[_0xeb31('0x1e')]=qs[_0xeb31('0x1e')](_0x22a553['query']['offset']);}_0x1e06be[_0xeb31('0x34')]=qs[_0xeb31('0x35')](_0x22a553[_0xeb31('0x2d')][_0xeb31('0x35')]);_0x1e06be['where']=qs[_0xeb31('0x2f')](_[_0xeb31('0x36')](_0x22a553[_0xeb31('0x2d')],_0x2cacd4[_0xeb31('0x2f')]),_0x1559ec);if(_0x22a553[_0xeb31('0x2d')][_0xeb31('0x37')]){_0x1e06be[_0xeb31('0x38')]=_[_0xeb31('0x39')](_0x1e06be['where'],{'$or':_[_0xeb31('0x29')](_0x1559ec,function(_0x556213){if(_0x556213['type']!=='VIRTUAL'){var _0x3324f1={};_0x3324f1[_0x556213[_0xeb31('0x26')]]={'$like':'%'+_0x22a553[_0xeb31('0x2d')][_0xeb31('0x37')]+'%'};return _0x3324f1;}})});}_0x1e06be=_[_0xeb31('0x39')]({},_0x1e06be,_0x22a553['options']);var _0x5139c3={'where':_0x1e06be['where']};return db[_0xeb31('0x3a')]['count'](_0x5139c3)[_0xeb31('0x3b')](function(_0x23312d){_0x1daa80[_0xeb31('0x1d')]=_0x23312d;if(_0x22a553[_0xeb31('0x2d')]['includeAll']){_0x1e06be[_0xeb31('0x3c')]=[{'all':!![]}];}return db[_0xeb31('0x3a')]['findAll'](_0x1e06be);})[_0xeb31('0x3b')](function(_0x39f8f3){_0x1daa80[_0xeb31('0x3d')]=_0x39f8f3;return _0x1daa80;})[_0xeb31('0x3b')](respondWithFilteredResult(_0x162b65,_0x1e06be))[_0xeb31('0x3e')](handleError(_0x162b65,null));};exports[_0xeb31('0x3f')]=function(_0x7bf914,_0x5a80c5){var _0x4e5860={'raw':![],'where':{'id':_0x7bf914['params']['id']}},_0x97451d={};_0x97451d[_0xeb31('0x2c')]=_[_0xeb31('0x2e')](db[_0xeb31('0x3a')]['rawAttributes']);_0x97451d[_0xeb31('0x2d')]=_[_0xeb31('0x2e')](_0x7bf914[_0xeb31('0x2d')]);_0x97451d[_0xeb31('0x2f')]=_[_0xeb31('0x30')](_0x97451d[_0xeb31('0x2c')],_0x97451d[_0xeb31('0x2d')]);_0x4e5860[_0xeb31('0x31')]=_['intersection'](_0x97451d[_0xeb31('0x2c')],qs['fields'](_0x7bf914[_0xeb31('0x2d')]['fields']));_0x4e5860['attributes']=_0x4e5860[_0xeb31('0x31')]['length']?_0x4e5860[_0xeb31('0x31')]:_0x97451d[_0xeb31('0x2c')];if(_0x7bf914['query'][_0xeb31('0x40')]){_0x4e5860['include']=[{'all':!![]}];}_0x4e5860=_[_0xeb31('0x39')]({},_0x4e5860,_0x7bf914[_0xeb31('0x41')]);return db[_0xeb31('0x3a')][_0xeb31('0x42')](_0x4e5860)[_0xeb31('0x3b')](handleEntityNotFound(_0x5a80c5,null))[_0xeb31('0x3b')](respondWithResult(_0x5a80c5,null))[_0xeb31('0x3e')](handleError(_0x5a80c5,null));};exports[_0xeb31('0x43')]=function(_0x568af6,_0xc860cb){return db[_0xeb31('0x3a')][_0xeb31('0x43')](_0x568af6[_0xeb31('0x44')],{})['then'](respondWithResult(_0xc860cb,0xc9))[_0xeb31('0x3e')](handleError(_0xc860cb,null));};exports[_0xeb31('0x45')]=function(_0x1d7cd4,_0x2ee640){if(_0x1d7cd4[_0xeb31('0x44')]['id']){delete _0x1d7cd4[_0xeb31('0x44')]['id'];}return db[_0xeb31('0x3a')]['find']({'where':{'id':_0x1d7cd4[_0xeb31('0x46')]['id']}})[_0xeb31('0x3b')](handleEntityNotFound(_0x2ee640,null))[_0xeb31('0x3b')](saveUpdates(_0x1d7cd4[_0xeb31('0x44')],null))[_0xeb31('0x3b')](respondWithResult(_0x2ee640,null))[_0xeb31('0x3e')](handleError(_0x2ee640,null));};exports[_0xeb31('0x22')]=function(_0xb3451f,_0x2e9c62){return db[_0xeb31('0x3a')][_0xeb31('0x42')]({'where':{'id':_0xb3451f[_0xeb31('0x46')]['id']}})[_0xeb31('0x3b')](handleEntityNotFound(_0x2e9c62,null))[_0xeb31('0x3b')](removeEntity(_0x2e9c62,null))[_0xeb31('0x3e')](handleError(_0x2e9c62,null));};exports[_0xeb31('0x47')]=function(_0x2724cc,_0x26fe5e,_0xd8ac49){var _0x25dda4={};var _0x277bca={};var _0x36e3ae;var _0x122658;return db[_0xeb31('0x3a')][_0xeb31('0x48')]({'where':{'id':_0x2724cc[_0xeb31('0x46')]['id']}})[_0xeb31('0x3b')](handleEntityNotFound(_0x26fe5e,null))[_0xeb31('0x3b')](function(_0x4d3eb2){if(_0x4d3eb2){_0x36e3ae=_0x4d3eb2;_0x277bca[_0xeb31('0x2c')]=_['keys'](db[_0xeb31('0x49')][_0xeb31('0x4a')]);_0x277bca[_0xeb31('0x2d')]=_['keys'](_0x2724cc[_0xeb31('0x2d')]);_0x277bca[_0xeb31('0x2f')]=_[_0xeb31('0x30')](_0x277bca[_0xeb31('0x2c')],_0x277bca[_0xeb31('0x2d')]);_0x25dda4[_0xeb31('0x31')]=_[_0xeb31('0x30')](_0x277bca[_0xeb31('0x2c')],qs[_0xeb31('0x32')](_0x2724cc[_0xeb31('0x2d')][_0xeb31('0x32')]));_0x25dda4[_0xeb31('0x31')]=_0x25dda4[_0xeb31('0x31')]['length']?_0x25dda4[_0xeb31('0x31')]:_0x277bca['model'];_0x25dda4['order']=qs['sort'](_0x2724cc['query'][_0xeb31('0x35')]);_0x25dda4['where']=qs[_0xeb31('0x2f')](_['pick'](_0x2724cc[_0xeb31('0x2d')],_0x277bca[_0xeb31('0x2f')]));if(_0x2724cc[_0xeb31('0x2d')][_0xeb31('0x37')]){_0x25dda4[_0xeb31('0x38')]=_['merge'](_0x25dda4['where'],{'$or':_[_0xeb31('0x29')](_0x25dda4['attributes'],function(_0x2f9696){var _0x37c12b={};_0x37c12b[_0x2f9696]={'$like':'%'+_0x2724cc[_0xeb31('0x2d')]['filter']+'%'};return _0x37c12b;})});}_0x25dda4=_['merge']({},_0x25dda4,_0x2724cc[_0xeb31('0x41')]);return _0x36e3ae['getFields'](_0x25dda4);}})[_0xeb31('0x3b')](function(_0x1f0f0f){if(_0x1f0f0f){_0x122658=_0x1f0f0f[_0xeb31('0x33')];if(!_0x2724cc[_0xeb31('0x2d')]['hasOwnProperty']('nolimit')){_0x25dda4[_0xeb31('0x1c')]=qs[_0xeb31('0x1c')](_0x2724cc[_0xeb31('0x2d')]['limit']);_0x25dda4[_0xeb31('0x1e')]=qs[_0xeb31('0x1e')](_0x2724cc[_0xeb31('0x2d')][_0xeb31('0x1e')]);}return _0x36e3ae[_0xeb31('0x47')](_0x25dda4);}})[_0xeb31('0x3b')](function(_0x464893){if(_0x464893){return _0x464893?{'count':_0x122658,'rows':_0x464893}:null;}})[_0xeb31('0x3b')](respondWithResult(_0x26fe5e,null))[_0xeb31('0x3e')](handleError(_0x26fe5e,null));};exports[_0xeb31('0x4b')]=function(_0x44daff,_0x1057d4,_0x3ab41f){var _0x392616={};var _0x6ab8b1={};var _0x3f0105;var _0x5aee18;return db[_0xeb31('0x3a')][_0xeb31('0x48')]({'where':{'id':_0x44daff['params']['id']}})[_0xeb31('0x3b')](handleEntityNotFound(_0x1057d4,null))['then'](function(_0x154afa){if(_0x154afa){_0x3f0105=_0x154afa;_0x6ab8b1[_0xeb31('0x2c')]=_[_0xeb31('0x2e')](db[_0xeb31('0x49')][_0xeb31('0x4a')]);_0x6ab8b1[_0xeb31('0x2d')]=_[_0xeb31('0x2e')](_0x44daff['query']);_0x6ab8b1[_0xeb31('0x2f')]=_[_0xeb31('0x30')](_0x6ab8b1[_0xeb31('0x2c')],_0x6ab8b1[_0xeb31('0x2d')]);_0x392616[_0xeb31('0x31')]=_[_0xeb31('0x30')](_0x6ab8b1[_0xeb31('0x2c')],qs[_0xeb31('0x32')](_0x44daff[_0xeb31('0x2d')][_0xeb31('0x32')]));_0x392616['attributes']=_0x392616[_0xeb31('0x31')][_0xeb31('0x33')]?_0x392616[_0xeb31('0x31')]:_0x6ab8b1[_0xeb31('0x2c')];_0x392616[_0xeb31('0x34')]=qs[_0xeb31('0x35')](_0x44daff['query'][_0xeb31('0x35')]);_0x392616[_0xeb31('0x38')]=qs['filters'](_[_0xeb31('0x36')](_0x44daff['query'],_0x6ab8b1['filters']));if(_0x44daff[_0xeb31('0x2d')][_0xeb31('0x37')]){_0x392616[_0xeb31('0x38')]=_[_0xeb31('0x39')](_0x392616[_0xeb31('0x38')],{'$or':_[_0xeb31('0x29')](_0x392616[_0xeb31('0x31')],function(_0x3158b9){var _0x3da88c={};_0x3da88c[_0x3158b9]={'$like':'%'+_0x44daff[_0xeb31('0x2d')][_0xeb31('0x37')]+'%'};return _0x3da88c;})});}_0x392616=_[_0xeb31('0x39')]({},_0x392616,_0x44daff[_0xeb31('0x41')]);return _0x3f0105[_0xeb31('0x4b')](_0x392616);}})[_0xeb31('0x3b')](function(_0xd232a){if(_0xd232a){_0x5aee18=_0xd232a[_0xeb31('0x33')];if(!_0x44daff[_0xeb31('0x2d')][_0xeb31('0x4c')](_0xeb31('0x4d'))){_0x392616[_0xeb31('0x1c')]=qs[_0xeb31('0x1c')](_0x44daff[_0xeb31('0x2d')][_0xeb31('0x1c')]);_0x392616[_0xeb31('0x1e')]=qs['offset'](_0x44daff[_0xeb31('0x2d')]['offset']);}return _0x3f0105['getSubjects'](_0x392616);}})[_0xeb31('0x3b')](function(_0x4800e4){if(_0x4800e4){return _0x4800e4?{'count':_0x5aee18,'rows':_0x4800e4}:null;}})[_0xeb31('0x3b')](respondWithResult(_0x1057d4,null))[_0xeb31('0x3e')](handleError(_0x1057d4,null));};exports[_0xeb31('0x4e')]=function(_0x22c4fd,_0x4c687f,_0x5c1ee8){var _0x175545={};var _0x347c07={};var _0x5f520d;var _0x12caf9;return db['SugarcrmConfiguration'][_0xeb31('0x48')]({'where':{'id':_0x22c4fd[_0xeb31('0x46')]['id']}})[_0xeb31('0x3b')](handleEntityNotFound(_0x4c687f,null))[_0xeb31('0x3b')](function(_0x3ec868){if(_0x3ec868){_0x5f520d=_0x3ec868;_0x347c07[_0xeb31('0x2c')]=_[_0xeb31('0x2e')](db[_0xeb31('0x49')][_0xeb31('0x4a')]);_0x347c07[_0xeb31('0x2d')]=_['keys'](_0x22c4fd[_0xeb31('0x2d')]);_0x347c07['filters']=_[_0xeb31('0x30')](_0x347c07[_0xeb31('0x2c')],_0x347c07[_0xeb31('0x2d')]);_0x175545['attributes']=_[_0xeb31('0x30')](_0x347c07[_0xeb31('0x2c')],qs[_0xeb31('0x32')](_0x22c4fd[_0xeb31('0x2d')][_0xeb31('0x32')]));_0x175545[_0xeb31('0x31')]=_0x175545['attributes'][_0xeb31('0x33')]?_0x175545[_0xeb31('0x31')]:_0x347c07[_0xeb31('0x2c')];_0x175545[_0xeb31('0x34')]=qs[_0xeb31('0x35')](_0x22c4fd[_0xeb31('0x2d')]['sort']);_0x175545[_0xeb31('0x38')]=qs[_0xeb31('0x2f')](_['pick'](_0x22c4fd['query'],_0x347c07[_0xeb31('0x2f')]));if(_0x22c4fd[_0xeb31('0x2d')][_0xeb31('0x37')]){_0x175545['where']=_[_0xeb31('0x39')](_0x175545[_0xeb31('0x38')],{'$or':_[_0xeb31('0x29')](_0x175545[_0xeb31('0x31')],function(_0x1c125a){var _0x31b96d={};_0x31b96d[_0x1c125a]={'$like':'%'+_0x22c4fd[_0xeb31('0x2d')][_0xeb31('0x37')]+'%'};return _0x31b96d;})});}_0x175545=_[_0xeb31('0x39')]({},_0x175545,_0x22c4fd['options']);return _0x5f520d['getDescriptions'](_0x175545);}})[_0xeb31('0x3b')](function(_0x3ece33){if(_0x3ece33){_0x12caf9=_0x3ece33[_0xeb31('0x33')];if(!_0x22c4fd[_0xeb31('0x2d')][_0xeb31('0x4c')](_0xeb31('0x4d'))){_0x175545[_0xeb31('0x1c')]=qs['limit'](_0x22c4fd['query'][_0xeb31('0x1c')]);_0x175545[_0xeb31('0x1e')]=qs[_0xeb31('0x1e')](_0x22c4fd[_0xeb31('0x2d')][_0xeb31('0x1e')]);}return _0x5f520d[_0xeb31('0x4e')](_0x175545);}})[_0xeb31('0x3b')](function(_0x2e694e){if(_0x2e694e){return _0x2e694e?{'count':_0x12caf9,'rows':_0x2e694e}:null;}})[_0xeb31('0x3b')](respondWithResult(_0x4c687f,null))['catch'](handleError(_0x4c687f,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 6496acd..cbfcecf 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 _0x74eb=['util','../../config/logger','moment','request-promise','rimraf','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x74eb,0x112));var _0xb74e=function(_0x287e43,_0x3d0f0c){_0x287e43=_0x287e43-0x0;var _0x4d0d19=_0x74eb[_0x287e43];return _0x4d0d19;};'use strict';var _=require(_0xb74e('0x0'));var util=require(_0xb74e('0x1'));var logger=require(_0xb74e('0x2'))('api');var moment=require(_0xb74e('0x3'));var BPromise=require('bluebird');var rp=require(_0xb74e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb74e('0x5'));var config=require('../../config/environment');var attributes=require(_0xb74e('0x6'));module[_0xb74e('0x7')]=function(_0x1ec204,_0x45b344){return _0x1ec204[_0xb74e('0x8')](_0xb74e('0x9'),attributes,{'tableName':_0xb74e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf799=['util','api','bluebird','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf799,0x83));var _0x9f79=function(_0x119cd8,_0x556b73){_0x119cd8=_0x119cd8-0x0;var _0x7072a3=_0xf799[_0x119cd8];return _0x7072a3;};'use strict';var _=require(_0x9f79('0x0'));var util=require(_0x9f79('0x1'));var logger=require('../../config/logger')(_0x9f79('0x2'));var moment=require('moment');var BPromise=require(_0x9f79('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f79('0x4'));var rimraf=require(_0x9f79('0x5'));var config=require(_0x9f79('0x6'));var attributes=require(_0x9f79('0x7'));module[_0x9f79('0x8')]=function(_0x284d90,_0x8e0e28){return _0x284d90[_0x9f79('0x9')](_0x9f79('0xa'),attributes,{'tableName':_0x9f79('0xb'),'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 45eea17..544fdd7 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 _0xa901=['error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x2baf33,_0xf4ee21){var _0x507802=function(_0x49e361){while(--_0x49e361){_0x2baf33['push'](_0x2baf33['shift']());}};_0x507802(++_0xf4ee21);}(_0xa901,0xbd));var _0x1a90=function(_0x59e020,_0x3338d0){_0x59e020=_0x59e020-0x0;var _0x423809=_0xa901[_0x59e020];return _0x423809;};'use strict';var _=require('lodash');var util=require(_0x1a90('0x0'));var moment=require(_0x1a90('0x1'));var BPromise=require(_0x1a90('0x2'));var rs=require(_0x1a90('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a90('0x4'))['db'];var utils=require(_0x1a90('0x5'));var logger=require(_0x1a90('0x6'))(_0x1a90('0x7'));var config=require(_0x1a90('0x8'));var jayson=require(_0x1a90('0x9'));var client=jayson['client'][_0x1a90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x143eb8,_0x39d075,_0x2516ee){return new BPromise(function(_0x56086c,_0x428391){return client[_0x1a90('0xb')](_0x143eb8,_0x2516ee)[_0x1a90('0xc')](function(_0x35114b){logger[_0x1a90('0xd')](_0x1a90('0xe'),_0x39d075,_0x1a90('0xf'));logger[_0x1a90('0x10')](_0x1a90('0x11'),_0x39d075,'request\x20sent',JSON['stringify'](_0x35114b));if(_0x35114b[_0x1a90('0x12')]){if(_0x35114b[_0x1a90('0x12')][_0x1a90('0x13')]===0x1f4){logger[_0x1a90('0x12')](_0x1a90('0xe'),_0x39d075,_0x35114b[_0x1a90('0x12')][_0x1a90('0x14')]);return _0x428391(_0x35114b[_0x1a90('0x12')][_0x1a90('0x14')]);}logger[_0x1a90('0x12')](_0x1a90('0xe'),_0x39d075,_0x35114b[_0x1a90('0x12')][_0x1a90('0x14')]);return _0x56086c(_0x35114b[_0x1a90('0x12')][_0x1a90('0x14')]);}else{logger[_0x1a90('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x39d075,_0x1a90('0xf'));_0x56086c(_0x35114b[_0x1a90('0x15')][_0x1a90('0x14')]);}})[_0x1a90('0x16')](function(_0x5dbed4){logger[_0x1a90('0x12')](_0x1a90('0xe'),_0x39d075,_0x5dbed4);_0x428391(_0x5dbed4);});});} \ No newline at end of file +var _0x5b9d=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','util'];(function(_0x539fb2,_0x5b6718){var _0x4d583d=function(_0x55fa69){while(--_0x55fa69){_0x539fb2['push'](_0x539fb2['shift']());}};_0x4d583d(++_0x5b6718);}(_0x5b9d,0x1e2));var _0xd5b9=function(_0x208b7a,_0x2e3baa){_0x208b7a=_0x208b7a-0x0;var _0x37b7ec=_0x5b9d[_0x208b7a];return _0x37b7ec;};'use strict';var _=require('lodash');var util=require(_0xd5b9('0x0'));var moment=require(_0xd5b9('0x1'));var BPromise=require(_0xd5b9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd5b9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5b9('0x4'));var logger=require(_0xd5b9('0x5'))(_0xd5b9('0x6'));var config=require(_0xd5b9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd5b9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2bde9d,_0x206ab4,_0x4839b0){return new BPromise(function(_0x14fc89,_0x38bdbf){return client[_0xd5b9('0x9')](_0x2bde9d,_0x4839b0)[_0xd5b9('0xa')](function(_0x16be8e){logger[_0xd5b9('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x206ab4,_0xd5b9('0xc'));logger['debug'](_0xd5b9('0xd'),_0x206ab4,_0xd5b9('0xc'),JSON[_0xd5b9('0xe')](_0x16be8e));if(_0x16be8e[_0xd5b9('0xf')]){if(_0x16be8e['error'][_0xd5b9('0x10')]===0x1f4){logger['error'](_0xd5b9('0x11'),_0x206ab4,_0x16be8e[_0xd5b9('0xf')][_0xd5b9('0x12')]);return _0x38bdbf(_0x16be8e['error']['message']);}logger[_0xd5b9('0xf')](_0xd5b9('0x11'),_0x206ab4,_0x16be8e[_0xd5b9('0xf')][_0xd5b9('0x12')]);return _0x14fc89(_0x16be8e[_0xd5b9('0xf')][_0xd5b9('0x12')]);}else{logger[_0xd5b9('0xb')](_0xd5b9('0x11'),_0x206ab4,_0xd5b9('0xc'));_0x14fc89(_0x16be8e[_0xd5b9('0x13')][_0xd5b9('0x12')]);}})[_0xd5b9('0x14')](function(_0x2173e0){logger['error'](_0xd5b9('0x11'),_0x206ab4,_0x2173e0);_0x38bdbf(_0x2173e0);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index a6458db..4ee0c26 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 _0xbc21=['./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x13e04d,_0x40a506){var _0x2b0a95=function(_0xfa0d96){while(--_0xfa0d96){_0x13e04d['push'](_0x13e04d['shift']());}};_0x2b0a95(++_0x40a506);}(_0xbc21,0x12a));var _0x1bc2=function(_0x3479e3,_0x4cc349){_0x3479e3=_0x3479e3-0x0;var _0x841571=_0xbc21[_0x3479e3];return _0x841571;};'use strict';var multer=require(_0x1bc2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1bc2('0x1'));var express=require(_0x1bc2('0x2'));var router=express['Router']();var fs_extra=require(_0x1bc2('0x3'));var auth=require(_0x1bc2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1bc2('0x5'));var controller=require(_0x1bc2('0x6'));router[_0x1bc2('0x7')]('/',auth[_0x1bc2('0x8')](),controller[_0x1bc2('0x9')]);router[_0x1bc2('0x7')](_0x1bc2('0xa'),auth[_0x1bc2('0x8')](),controller[_0x1bc2('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1bc2('0xc')](_0x1bc2('0xa'),auth[_0x1bc2('0x8')](),controller[_0x1bc2('0xd')]);router[_0x1bc2('0xe')](_0x1bc2('0xa'),auth['isAuthenticated'](),controller[_0x1bc2('0xf')]);module['exports']=router; \ No newline at end of file +var _0xe5f3=['../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','/:id','show','post','create','update','delete','exports','multer','path','Router','fs-extra','../../components/interaction/service'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xe5f3,0x7b));var _0x3e5f=function(_0x202b7c,_0x143753){_0x202b7c=_0x202b7c-0x0;var _0x3b5401=_0xe5f3[_0x202b7c];return _0x3b5401;};'use strict';var multer=require(_0x3e5f('0x0'));var util=require('util');var path=require(_0x3e5f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3e5f('0x2')]();var fs_extra=require(_0x3e5f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3e5f('0x4'));var config=require(_0x3e5f('0x5'));var controller=require(_0x3e5f('0x6'));router[_0x3e5f('0x7')]('/',auth[_0x3e5f('0x8')](),controller['index']);router[_0x3e5f('0x7')](_0x3e5f('0x9'),auth['isAuthenticated'](),controller[_0x3e5f('0xa')]);router[_0x3e5f('0xb')]('/',auth[_0x3e5f('0x8')](),controller[_0x3e5f('0xc')]);router['put'](_0x3e5f('0x9'),auth[_0x3e5f('0x8')](),controller[_0x3e5f('0xd')]);router[_0x3e5f('0xe')]('/:id',auth[_0x3e5f('0x8')](),controller['destroy']);module[_0x3e5f('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index ea3d467..1911c78 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 _0x3320=['customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','ENUM','string'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x3320,0x96));var _0x0332=function(_0x5333c1,_0x5382d3){_0x5333c1=_0x5333c1-0x0;var _0x173c8d=_0x3320[_0x5333c1];return _0x173c8d;};'use strict';var Sequelize=require(_0x0332('0x0'));module['exports']={'type':{'type':Sequelize[_0x0332('0x1')](_0x0332('0x2'),'variable',_0x0332('0x3'),_0x0332('0x4'),_0x0332('0x5')),'defaultValue':_0x0332('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0332('0x6')]},'keyType':{'type':Sequelize[_0x0332('0x1')](_0x0332('0x2'),_0x0332('0x7'),_0x0332('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0332('0x6')]},'nameField':{'type':Sequelize[_0x0332('0x6')]},'customField':{'type':Sequelize[_0x0332('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0332('0x6')]}}; \ No newline at end of file +var _0x90c1=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x90c1,0x19c));var _0x190c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x90c1[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x190c('0x0'));module[_0x190c('0x1')]={'type':{'type':Sequelize[_0x190c('0x2')](_0x190c('0x3'),_0x190c('0x4'),_0x190c('0x5'),_0x190c('0x6'),_0x190c('0x7')),'defaultValue':_0x190c('0x3')},'content':{'type':Sequelize[_0x190c('0x8')]},'key':{'type':Sequelize[_0x190c('0x8')]},'keyType':{'type':Sequelize[_0x190c('0x2')](_0x190c('0x3'),_0x190c('0x4'),_0x190c('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x190c('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x190c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x190c('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 496c465..5749e26 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 _0x06ac=['query','filters','attributes','intersection','model','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','merge','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key'];(function(_0x1016b1,_0x3d61ca){var _0x534376=function(_0x221f0a){while(--_0x221f0a){_0x1016b1['push'](_0x1016b1['shift']());}};_0x534376(++_0x3d61ca);}(_0x06ac,0xb9));var _0xc06a=function(_0x488f7e,_0x30b20f){_0x488f7e=_0x488f7e-0x0;var _0x118ce5=_0x06ac[_0x488f7e];return _0x118ce5;};'use strict';var emlformat=require(_0xc06a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc06a('0x1'));var jsonpatch=require(_0xc06a('0x2'));var rp=require(_0xc06a('0x3'));var moment=require(_0xc06a('0x4'));var BPromise=require(_0xc06a('0x5'));var Mustache=require('mustache');var util=require(_0xc06a('0x6'));var path=require(_0xc06a('0x7'));var sox=require(_0xc06a('0x8'));var csv=require(_0xc06a('0x9'));var ejs=require(_0xc06a('0xa'));var fs=require('fs');var fs_extra=require(_0xc06a('0xb'));var _=require(_0xc06a('0xc'));var squel=require(_0xc06a('0xd'));var crypto=require(_0xc06a('0xe'));var jsforce=require(_0xc06a('0xf'));var deskjs=require(_0xc06a('0x10'));var toCsv=require(_0xc06a('0x9'));var querystring=require('querystring');var Papa=require(_0xc06a('0x11'));var Redis=require(_0xc06a('0x12'));var authService=require(_0xc06a('0x13'));var qs=require(_0xc06a('0x14'));var as=require(_0xc06a('0x15'));var hardwareService=require(_0xc06a('0x16'));var logger=require(_0xc06a('0x17'))(_0xc06a('0x18'));var utils=require(_0xc06a('0x19'));var config=require(_0xc06a('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xc06a('0x1b'))['db'];function respondWithStatusCode(_0x7cab0d,_0x45cfbe){_0x45cfbe=_0x45cfbe||0xcc;return function(_0x288b38){if(_0x288b38){return _0x7cab0d[_0xc06a('0x1c')](_0x45cfbe);}return _0x7cab0d[_0xc06a('0x1d')](_0x45cfbe)[_0xc06a('0x1e')]();};}function respondWithResult(_0x1bc2c9,_0x1ee555){_0x1ee555=_0x1ee555||0xc8;return function(_0x4b52a0){if(_0x4b52a0){return _0x1bc2c9[_0xc06a('0x1d')](_0x1ee555)['json'](_0x4b52a0);}};}function respondWithFilteredResult(_0x5dc317,_0x4c7534){return function(_0x3e38cc){if(_0x3e38cc){var _0x31905c=typeof _0x4c7534[_0xc06a('0x1f')]==='undefined'&&typeof _0x4c7534[_0xc06a('0x20')]==='undefined';var _0xc7dead=_0x3e38cc['count'];var _0x15b069=_0x31905c?0x0:_0x4c7534[_0xc06a('0x1f')];var _0x431da1=_0x31905c?_0x3e38cc[_0xc06a('0x21')]:_0x4c7534[_0xc06a('0x1f')]+_0x4c7534[_0xc06a('0x20')];var _0x528630;if(_0x431da1>=_0xc7dead){_0x431da1=_0xc7dead;_0x528630=0xc8;}else{_0x528630=0xce;}_0x5dc317[_0xc06a('0x1d')](_0x528630);return _0x5dc317[_0xc06a('0x22')](_0xc06a('0x23'),_0x15b069+'-'+_0x431da1+'/'+_0xc7dead)[_0xc06a('0x24')](_0x3e38cc);}return null;};}function patchUpdates(_0x5c68ae){return function(_0x23db73){try{jsonpatch[_0xc06a('0x25')](_0x23db73,_0x5c68ae,!![]);}catch(_0xc8d12a){return BPromise[_0xc06a('0x26')](_0xc8d12a);}return _0x23db73[_0xc06a('0x27')]();};}function saveUpdates(_0x1462b0,_0x1e9a26){return function(_0x2ac0cd){if(_0x2ac0cd){return _0x2ac0cd['update'](_0x1462b0)[_0xc06a('0x28')](function(_0x16c5ab){return _0x16c5ab;});}return null;};}function removeEntity(_0x5cf64a,_0x3250ec){return function(_0x2dd271){if(_0x2dd271){return _0x2dd271[_0xc06a('0x29')]()[_0xc06a('0x28')](function(){_0x5cf64a[_0xc06a('0x1d')](0xcc)[_0xc06a('0x1e')]();});}};}function handleEntityNotFound(_0x51f6e0,_0x5e48da){return function(_0x1f89e3){if(!_0x1f89e3){_0x51f6e0['sendStatus'](0x194);}return _0x1f89e3;};}function handleError(_0x5a83b5,_0x45ca3d){_0x45ca3d=_0x45ca3d||0x1f4;return function(_0x20c590){logger[_0xc06a('0x2a')](_0x20c590['stack']);if(_0x20c590[_0xc06a('0x2b')]){delete _0x20c590['name'];}_0x5a83b5[_0xc06a('0x1d')](_0x45ca3d)[_0xc06a('0x2c')](_0x20c590);};}exports[_0xc06a('0x2d')]=function(_0x1ba62c,_0x46a50c){var _0x54c6ac={},_0x2816f5={},_0x1d02b1={'count':0x0,'rows':[]};var _0x306c2c=_[_0xc06a('0x2e')](db[_0xc06a('0x2f')][_0xc06a('0x30')],function(_0x130c9e){return{'name':_0x130c9e[_0xc06a('0x31')],'type':_0x130c9e[_0xc06a('0x32')][_0xc06a('0x33')]};});_0x2816f5['model']=_[_0xc06a('0x2e')](_0x306c2c,_0xc06a('0x2b'));_0x2816f5[_0xc06a('0x34')]=_['keys'](_0x1ba62c['query']);_0x2816f5[_0xc06a('0x35')]=_['intersection'](_0x2816f5['model'],_0x2816f5[_0xc06a('0x34')]);_0x54c6ac[_0xc06a('0x36')]=_[_0xc06a('0x37')](_0x2816f5[_0xc06a('0x38')],qs[_0xc06a('0x39')](_0x1ba62c[_0xc06a('0x34')][_0xc06a('0x39')]));_0x54c6ac['attributes']=_0x54c6ac[_0xc06a('0x36')]['length']?_0x54c6ac['attributes']:_0x2816f5['model'];if(!_0x1ba62c[_0xc06a('0x34')]['hasOwnProperty'](_0xc06a('0x3a'))){_0x54c6ac['limit']=qs[_0xc06a('0x20')](_0x1ba62c[_0xc06a('0x34')]['limit']);_0x54c6ac[_0xc06a('0x1f')]=qs[_0xc06a('0x1f')](_0x1ba62c[_0xc06a('0x34')][_0xc06a('0x1f')]);}_0x54c6ac[_0xc06a('0x3b')]=qs['sort'](_0x1ba62c[_0xc06a('0x34')][_0xc06a('0x3c')]);_0x54c6ac[_0xc06a('0x3d')]=qs[_0xc06a('0x35')](_[_0xc06a('0x3e')](_0x1ba62c[_0xc06a('0x34')],_0x2816f5[_0xc06a('0x35')]),_0x306c2c);if(_0x1ba62c[_0xc06a('0x34')][_0xc06a('0x3f')]){_0x54c6ac['where']=_['merge'](_0x54c6ac['where'],{'$or':_[_0xc06a('0x2e')](_0x306c2c,function(_0x23a5d4){if(_0x23a5d4[_0xc06a('0x32')]!==_0xc06a('0x40')){var _0x758b49={};_0x758b49[_0x23a5d4['name']]={'$like':'%'+_0x1ba62c[_0xc06a('0x34')][_0xc06a('0x3f')]+'%'};return _0x758b49;}})});}_0x54c6ac=_['merge']({},_0x54c6ac,_0x1ba62c[_0xc06a('0x41')]);var _0x2b426e={'where':_0x54c6ac['where']};return db[_0xc06a('0x2f')]['count'](_0x2b426e)[_0xc06a('0x28')](function(_0x4d1013){_0x1d02b1[_0xc06a('0x21')]=_0x4d1013;if(_0x1ba62c['query'][_0xc06a('0x42')]){_0x54c6ac[_0xc06a('0x43')]=[{'all':!![]}];}return db[_0xc06a('0x2f')][_0xc06a('0x44')](_0x54c6ac);})[_0xc06a('0x28')](function(_0x3aaca4){_0x1d02b1[_0xc06a('0x45')]=_0x3aaca4;return _0x1d02b1;})[_0xc06a('0x28')](respondWithFilteredResult(_0x46a50c,_0x54c6ac))[_0xc06a('0x46')](handleError(_0x46a50c,null));};exports[_0xc06a('0x47')]=function(_0x25a2c4,_0x1b9c37){var _0x25ecd5={'raw':!![],'where':{'id':_0x25a2c4[_0xc06a('0x48')]['id']}},_0x2772ea={};_0x2772ea[_0xc06a('0x38')]=_[_0xc06a('0x49')](db[_0xc06a('0x2f')]['rawAttributes']);_0x2772ea['query']=_['keys'](_0x25a2c4['query']);_0x2772ea['filters']=_[_0xc06a('0x37')](_0x2772ea[_0xc06a('0x38')],_0x2772ea[_0xc06a('0x34')]);_0x25ecd5[_0xc06a('0x36')]=_['intersection'](_0x2772ea[_0xc06a('0x38')],qs['fields'](_0x25a2c4[_0xc06a('0x34')]['fields']));_0x25ecd5[_0xc06a('0x36')]=_0x25ecd5[_0xc06a('0x36')][_0xc06a('0x4a')]?_0x25ecd5['attributes']:_0x2772ea['model'];if(_0x25a2c4['query'][_0xc06a('0x42')]){_0x25ecd5['include']=[{'all':!![]}];}_0x25ecd5=_[_0xc06a('0x4b')]({},_0x25ecd5,_0x25a2c4[_0xc06a('0x41')]);return db[_0xc06a('0x2f')][_0xc06a('0x4c')](_0x25ecd5)[_0xc06a('0x28')](handleEntityNotFound(_0x1b9c37,null))[_0xc06a('0x28')](respondWithResult(_0x1b9c37,null))[_0xc06a('0x46')](handleError(_0x1b9c37,null));};exports[_0xc06a('0x4d')]=function(_0xc0187b,_0x195dbb){return db[_0xc06a('0x2f')][_0xc06a('0x4d')](_0xc0187b['body'],{})[_0xc06a('0x28')](respondWithResult(_0x195dbb,0xc9))[_0xc06a('0x46')](handleError(_0x195dbb,null));};exports['update']=function(_0x3f5c90,_0x186d19){if(_0x3f5c90[_0xc06a('0x4e')]['id']){delete _0x3f5c90[_0xc06a('0x4e')]['id'];}return db[_0xc06a('0x2f')][_0xc06a('0x4c')]({'where':{'id':_0x3f5c90[_0xc06a('0x48')]['id']}})['then'](handleEntityNotFound(_0x186d19,null))[_0xc06a('0x28')](saveUpdates(_0x3f5c90['body'],null))[_0xc06a('0x28')](respondWithResult(_0x186d19,null))[_0xc06a('0x46')](handleError(_0x186d19,null));};exports[_0xc06a('0x29')]=function(_0xf77655,_0x2a543b){return db[_0xc06a('0x2f')][_0xc06a('0x4c')]({'where':{'id':_0xf77655[_0xc06a('0x48')]['id']}})['then'](handleEntityNotFound(_0x2a543b,null))['then'](removeEntity(_0x2a543b,null))[_0xc06a('0x46')](handleError(_0x2a543b,null));}; \ No newline at end of file +var _0xfe8f=['../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','apply','reject','save','destroy','then','error','send','index','map','rawAttributes','type','name','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','SugarcrmField','findAll','rows','catch','params','include','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x3cf341,_0xd0a978){var _0x4cb6a4=function(_0x36c53b){while(--_0x36c53b){_0x3cf341['push'](_0x3cf341['shift']());}};_0x4cb6a4(++_0xd0a978);}(_0xfe8f,0x14c));var _0xffe8=function(_0x574a9c,_0x283e0b){_0x574a9c=_0x574a9c-0x0;var _0x3f7ce3=_0xfe8f[_0x574a9c];return _0x3f7ce3;};'use strict';var emlformat=require(_0xffe8('0x0'));var rimraf=require(_0xffe8('0x1'));var zipdir=require(_0xffe8('0x2'));var jsonpatch=require(_0xffe8('0x3'));var rp=require('request-promise');var moment=require(_0xffe8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xffe8('0x5'));var util=require(_0xffe8('0x6'));var path=require(_0xffe8('0x7'));var sox=require(_0xffe8('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xffe8('0x9'));var _=require(_0xffe8('0xa'));var squel=require(_0xffe8('0xb'));var crypto=require(_0xffe8('0xc'));var jsforce=require(_0xffe8('0xd'));var deskjs=require(_0xffe8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xffe8('0xf'));var Papa=require('papaparse');var Redis=require(_0xffe8('0x10'));var authService=require(_0xffe8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xffe8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xffe8('0x13'))(_0xffe8('0x14'));var utils=require(_0xffe8('0x15'));var config=require(_0xffe8('0x16'));var licenseUtil=require(_0xffe8('0x17'));var db=require(_0xffe8('0x18'))['db'];function respondWithStatusCode(_0x2a3e67,_0x1a98ad){_0x1a98ad=_0x1a98ad||0xcc;return function(_0x21c515){if(_0x21c515){return _0x2a3e67['sendStatus'](_0x1a98ad);}return _0x2a3e67['status'](_0x1a98ad)[_0xffe8('0x19')]();};}function respondWithResult(_0x10c3ec,_0x28d5b0){_0x28d5b0=_0x28d5b0||0xc8;return function(_0x2c52bb){if(_0x2c52bb){return _0x10c3ec[_0xffe8('0x1a')](_0x28d5b0)[_0xffe8('0x1b')](_0x2c52bb);}};}function respondWithFilteredResult(_0xa835d6,_0x313ea9){return function(_0x1276fe){if(_0x1276fe){var _0x46a992=typeof _0x313ea9[_0xffe8('0x1c')]===_0xffe8('0x1d')&&typeof _0x313ea9[_0xffe8('0x1e')]==='undefined';var _0x5bc253=_0x1276fe[_0xffe8('0x1f')];var _0x1e3168=_0x46a992?0x0:_0x313ea9[_0xffe8('0x1c')];var _0x74cc81=_0x46a992?_0x1276fe[_0xffe8('0x1f')]:_0x313ea9[_0xffe8('0x1c')]+_0x313ea9['limit'];var _0x2b727a;if(_0x74cc81>=_0x5bc253){_0x74cc81=_0x5bc253;_0x2b727a=0xc8;}else{_0x2b727a=0xce;}_0xa835d6['status'](_0x2b727a);return _0xa835d6['set']('Content-Range',_0x1e3168+'-'+_0x74cc81+'/'+_0x5bc253)['json'](_0x1276fe);}return null;};}function patchUpdates(_0x266aa2){return function(_0x4e4423){try{jsonpatch[_0xffe8('0x20')](_0x4e4423,_0x266aa2,!![]);}catch(_0x24f752){return BPromise[_0xffe8('0x21')](_0x24f752);}return _0x4e4423[_0xffe8('0x22')]();};}function saveUpdates(_0x2924d8,_0x1c2439){return function(_0x4cf1a1){if(_0x4cf1a1){return _0x4cf1a1['update'](_0x2924d8)['then'](function(_0x31ae9d){return _0x31ae9d;});}return null;};}function removeEntity(_0x2d58ae,_0x79b925){return function(_0x2c8206){if(_0x2c8206){return _0x2c8206[_0xffe8('0x23')]()[_0xffe8('0x24')](function(){_0x2d58ae[_0xffe8('0x1a')](0xcc)[_0xffe8('0x19')]();});}};}function handleEntityNotFound(_0x671d32,_0x4f27ff){return function(_0x2016b3){if(!_0x2016b3){_0x671d32['sendStatus'](0x194);}return _0x2016b3;};}function handleError(_0x562860,_0x3f7041){_0x3f7041=_0x3f7041||0x1f4;return function(_0x150b0c){logger[_0xffe8('0x25')](_0x150b0c['stack']);if(_0x150b0c['name']){delete _0x150b0c['name'];}_0x562860[_0xffe8('0x1a')](_0x3f7041)[_0xffe8('0x26')](_0x150b0c);};}exports[_0xffe8('0x27')]=function(_0x4df6e7,_0x5696f4){var _0x15b64b={},_0x209573={},_0x226f7d={'count':0x0,'rows':[]};var _0x1efcfa=_[_0xffe8('0x28')](db['SugarcrmField'][_0xffe8('0x29')],function(_0x1e5a69){return{'name':_0x1e5a69['fieldName'],'type':_0x1e5a69[_0xffe8('0x2a')]['key']};});_0x209573['model']=_[_0xffe8('0x28')](_0x1efcfa,_0xffe8('0x2b'));_0x209573['query']=_[_0xffe8('0x2c')](_0x4df6e7[_0xffe8('0x2d')]);_0x209573[_0xffe8('0x2e')]=_[_0xffe8('0x2f')](_0x209573['model'],_0x209573[_0xffe8('0x2d')]);_0x15b64b[_0xffe8('0x30')]=_[_0xffe8('0x2f')](_0x209573[_0xffe8('0x31')],qs[_0xffe8('0x32')](_0x4df6e7[_0xffe8('0x2d')]['fields']));_0x15b64b[_0xffe8('0x30')]=_0x15b64b[_0xffe8('0x30')][_0xffe8('0x33')]?_0x15b64b[_0xffe8('0x30')]:_0x209573[_0xffe8('0x31')];if(!_0x4df6e7[_0xffe8('0x2d')][_0xffe8('0x34')](_0xffe8('0x35'))){_0x15b64b['limit']=qs[_0xffe8('0x1e')](_0x4df6e7[_0xffe8('0x2d')][_0xffe8('0x1e')]);_0x15b64b['offset']=qs[_0xffe8('0x1c')](_0x4df6e7['query']['offset']);}_0x15b64b[_0xffe8('0x36')]=qs['sort'](_0x4df6e7[_0xffe8('0x2d')][_0xffe8('0x37')]);_0x15b64b[_0xffe8('0x38')]=qs[_0xffe8('0x2e')](_[_0xffe8('0x39')](_0x4df6e7['query'],_0x209573['filters']),_0x1efcfa);if(_0x4df6e7[_0xffe8('0x2d')]['filter']){_0x15b64b['where']=_['merge'](_0x15b64b['where'],{'$or':_[_0xffe8('0x28')](_0x1efcfa,function(_0x1938dd){if(_0x1938dd['type']!==_0xffe8('0x3a')){var _0x38c185={};_0x38c185[_0x1938dd[_0xffe8('0x2b')]]={'$like':'%'+_0x4df6e7[_0xffe8('0x2d')]['filter']+'%'};return _0x38c185;}})});}_0x15b64b=_[_0xffe8('0x3b')]({},_0x15b64b,_0x4df6e7[_0xffe8('0x3c')]);var _0xa7d6af={'where':_0x15b64b['where']};return db['SugarcrmField']['count'](_0xa7d6af)['then'](function(_0x4cfc3e){_0x226f7d[_0xffe8('0x1f')]=_0x4cfc3e;if(_0x4df6e7[_0xffe8('0x2d')][_0xffe8('0x3d')]){_0x15b64b['include']=[{'all':!![]}];}return db[_0xffe8('0x3e')][_0xffe8('0x3f')](_0x15b64b);})['then'](function(_0x12ac60){_0x226f7d[_0xffe8('0x40')]=_0x12ac60;return _0x226f7d;})[_0xffe8('0x24')](respondWithFilteredResult(_0x5696f4,_0x15b64b))[_0xffe8('0x41')](handleError(_0x5696f4,null));};exports['show']=function(_0xeebf39,_0x1ec262){var _0x363262={'raw':!![],'where':{'id':_0xeebf39[_0xffe8('0x42')]['id']}},_0x2ca25a={};_0x2ca25a[_0xffe8('0x31')]=_[_0xffe8('0x2c')](db[_0xffe8('0x3e')][_0xffe8('0x29')]);_0x2ca25a['query']=_['keys'](_0xeebf39[_0xffe8('0x2d')]);_0x2ca25a[_0xffe8('0x2e')]=_[_0xffe8('0x2f')](_0x2ca25a[_0xffe8('0x31')],_0x2ca25a[_0xffe8('0x2d')]);_0x363262[_0xffe8('0x30')]=_['intersection'](_0x2ca25a[_0xffe8('0x31')],qs[_0xffe8('0x32')](_0xeebf39[_0xffe8('0x2d')]['fields']));_0x363262[_0xffe8('0x30')]=_0x363262['attributes'][_0xffe8('0x33')]?_0x363262['attributes']:_0x2ca25a['model'];if(_0xeebf39[_0xffe8('0x2d')][_0xffe8('0x3d')]){_0x363262[_0xffe8('0x43')]=[{'all':!![]}];}_0x363262=_['merge']({},_0x363262,_0xeebf39[_0xffe8('0x3c')]);return db[_0xffe8('0x3e')]['find'](_0x363262)['then'](handleEntityNotFound(_0x1ec262,null))[_0xffe8('0x24')](respondWithResult(_0x1ec262,null))['catch'](handleError(_0x1ec262,null));};exports[_0xffe8('0x44')]=function(_0x1e3aba,_0x150cb7){return db[_0xffe8('0x3e')]['create'](_0x1e3aba['body'],{})[_0xffe8('0x24')](respondWithResult(_0x150cb7,0xc9))[_0xffe8('0x41')](handleError(_0x150cb7,null));};exports[_0xffe8('0x45')]=function(_0x5a1501,_0x5b3ee6){if(_0x5a1501[_0xffe8('0x46')]['id']){delete _0x5a1501['body']['id'];}return db[_0xffe8('0x3e')]['find']({'where':{'id':_0x5a1501['params']['id']}})[_0xffe8('0x24')](handleEntityNotFound(_0x5b3ee6,null))[_0xffe8('0x24')](saveUpdates(_0x5a1501[_0xffe8('0x46')],null))['then'](respondWithResult(_0x5b3ee6,null))[_0xffe8('0x41')](handleError(_0x5b3ee6,null));};exports[_0xffe8('0x23')]=function(_0x3e602f,_0x1645dd){return db['SugarcrmField']['find']({'where':{'id':_0x3e602f[_0xffe8('0x42')]['id']}})[_0xffe8('0x24')](handleEntityNotFound(_0x1645dd,null))[_0xffe8('0x24')](removeEntity(_0x1645dd,null))[_0xffe8('0x41')](handleError(_0x1645dd,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 40548fd..84ab9d2 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 _0x2146=['./intSugarcrmField.attributes','exports','define','idField','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xfa5c65,_0x54ab9b){var _0x3946c0=function(_0x41dad9){while(--_0x41dad9){_0xfa5c65['push'](_0xfa5c65['shift']());}};_0x3946c0(++_0x54ab9b);}(_0x2146,0x184));var _0x6214=function(_0x4f2e9d,_0x45327a){_0x4f2e9d=_0x4f2e9d-0x0;var _0x4c9598=_0x2146[_0x4f2e9d];return _0x4c9598;};'use strict';var _=require('lodash');var util=require(_0x6214('0x0'));var logger=require(_0x6214('0x1'))(_0x6214('0x2'));var moment=require(_0x6214('0x3'));var BPromise=require(_0x6214('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6214('0x5'));var rimraf=require(_0x6214('0x6'));var config=require(_0x6214('0x7'));var attributes=require(_0x6214('0x8'));module[_0x6214('0x9')]=function(_0x4f6955,_0x52de81){return _0x4f6955[_0x6214('0xa')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x6214('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x27c7=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x5bc513,_0x286172){var _0x5bee72=function(_0x4fc6b2){while(--_0x4fc6b2){_0x5bc513['push'](_0x5bc513['shift']());}};_0x5bee72(++_0x286172);}(_0x27c7,0x1c7));var _0x727c=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x27c7[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x727c('0x0'));var util=require(_0x727c('0x1'));var logger=require(_0x727c('0x2'))(_0x727c('0x3'));var moment=require(_0x727c('0x4'));var BPromise=require(_0x727c('0x5'));var rp=require(_0x727c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x727c('0x7'));var config=require('../../config/environment');var attributes=require(_0x727c('0x8'));module[_0x727c('0x9')]=function(_0x1f88d6,_0x27983c){return _0x1f88d6[_0x727c('0xa')]('SugarcrmField',attributes,{'tableName':_0x727c('0xb'),'paranoid':![],'indexes':[{'name':_0x727c('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 37a001f..4ffeda8 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 _0xb2d2=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3f08e4,_0x4c0546){var _0xa44ad1=function(_0x4830fa){while(--_0x4830fa){_0x3f08e4['push'](_0x3f08e4['shift']());}};_0xa44ad1(++_0x4c0546);}(_0xb2d2,0x1ce));var _0x2b2d=function(_0x2ee318,_0x27eaa5){_0x2ee318=_0x2ee318-0x0;var _0x49f1a4=_0xb2d2[_0x2ee318];return _0x49f1a4;};'use strict';var _=require(_0x2b2d('0x0'));var util=require(_0x2b2d('0x1'));var moment=require(_0x2b2d('0x2'));var BPromise=require(_0x2b2d('0x3'));var rs=require(_0x2b2d('0x4'));var fs=require('fs');var Redis=require(_0x2b2d('0x5'));var db=require(_0x2b2d('0x6'))['db'];var utils=require(_0x2b2d('0x7'));var logger=require(_0x2b2d('0x8'))(_0x2b2d('0x9'));var config=require(_0x2b2d('0xa'));var jayson=require(_0x2b2d('0xb'));var client=jayson[_0x2b2d('0xc')][_0x2b2d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1bedff,_0x4b9441,_0x45ad02){return new BPromise(function(_0x105ea2,_0x278f8c){return client['request'](_0x1bedff,_0x45ad02)[_0x2b2d('0xe')](function(_0x476e6f){logger['info'](_0x2b2d('0xf'),_0x4b9441,_0x2b2d('0x10'));logger['debug'](_0x2b2d('0x11'),_0x4b9441,_0x2b2d('0x10'),JSON[_0x2b2d('0x12')](_0x476e6f));if(_0x476e6f[_0x2b2d('0x13')]){if(_0x476e6f['error']['code']===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x4b9441,_0x476e6f[_0x2b2d('0x13')][_0x2b2d('0x14')]);return _0x278f8c(_0x476e6f[_0x2b2d('0x13')][_0x2b2d('0x14')]);}logger[_0x2b2d('0x13')](_0x2b2d('0xf'),_0x4b9441,_0x476e6f[_0x2b2d('0x13')][_0x2b2d('0x14')]);return _0x105ea2(_0x476e6f['error'][_0x2b2d('0x14')]);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x4b9441,_0x2b2d('0x10'));_0x105ea2(_0x476e6f[_0x2b2d('0x15')][_0x2b2d('0x14')]);}})[_0x2b2d('0x16')](function(_0x186732){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x4b9441,_0x186732);_0x278f8c(_0x186732);});});} \ No newline at end of file +var _0x861f=['rpc','jayson/promise','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3ddefb,_0x2641f9){var _0x206cfc=function(_0x5832e2){while(--_0x5832e2){_0x3ddefb['push'](_0x3ddefb['shift']());}};_0x206cfc(++_0x2641f9);}(_0x861f,0xa2));var _0xf861=function(_0x3e182f,_0x380ec7){_0x3e182f=_0x3e182f-0x0;var _0x23edc9=_0x861f[_0x3e182f];return _0x23edc9;};'use strict';var _=require(_0xf861('0x0'));var util=require(_0xf861('0x1'));var moment=require('moment');var BPromise=require(_0xf861('0x2'));var rs=require(_0xf861('0x3'));var fs=require('fs');var Redis=require(_0xf861('0x4'));var db=require(_0xf861('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf861('0x6'));var config=require('../../config/environment');var jayson=require(_0xf861('0x7'));var client=jayson['client'][_0xf861('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40c513,_0x57df26,_0x1babf4){return new BPromise(function(_0x390c74,_0x33a9ae){return client[_0xf861('0x9')](_0x40c513,_0x1babf4)[_0xf861('0xa')](function(_0x3a9c18){logger[_0xf861('0xb')](_0xf861('0xc'),_0x57df26,_0xf861('0xd'));logger[_0xf861('0xe')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x57df26,'request\x20sent',JSON[_0xf861('0xf')](_0x3a9c18));if(_0x3a9c18[_0xf861('0x10')]){if(_0x3a9c18[_0xf861('0x10')][_0xf861('0x11')]===0x1f4){logger[_0xf861('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x57df26,_0x3a9c18['error'][_0xf861('0x12')]);return _0x33a9ae(_0x3a9c18[_0xf861('0x10')][_0xf861('0x12')]);}logger[_0xf861('0x10')](_0xf861('0xc'),_0x57df26,_0x3a9c18[_0xf861('0x10')]['message']);return _0x390c74(_0x3a9c18['error'][_0xf861('0x12')]);}else{logger[_0xf861('0xb')](_0xf861('0xc'),_0x57df26,'request\x20sent');_0x390c74(_0x3a9c18[_0xf861('0x13')][_0xf861('0x12')]);}})[_0xf861('0x14')](function(_0x4b4890){logger[_0xf861('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x57df26,_0x4b4890);_0x33a9ae(_0x4b4890);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index e68e472..8f49c11 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 _0xd1b3=['express','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x486a49,_0x131d00){var _0x2c521b=function(_0x5f01a7){while(--_0x5f01a7){_0x486a49['push'](_0x486a49['shift']());}};_0x2c521b(++_0x131d00);}(_0xd1b3,0xec));var _0x3d1b=function(_0x5f482c,_0x55104d){_0x5f482c=_0x5f482c-0x0;var _0x59f344=_0xd1b3[_0x5f482c];return _0x59f344;};'use strict';var multer=require(_0x3d1b('0x0'));var util=require(_0x3d1b('0x1'));var path=require(_0x3d1b('0x2'));var timeout=require(_0x3d1b('0x3'));var express=require(_0x3d1b('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3d1b('0x5'));var config=require(_0x3d1b('0x6'));var controller=require(_0x3d1b('0x7'));router[_0x3d1b('0x8')]('/',auth[_0x3d1b('0x9')](),controller[_0x3d1b('0xa')]);router[_0x3d1b('0x8')](_0x3d1b('0xb'),auth[_0x3d1b('0x9')](),controller[_0x3d1b('0xc')]);router[_0x3d1b('0x8')]('/:id/configurations',auth[_0x3d1b('0x9')](),controller[_0x3d1b('0xd')]);router[_0x3d1b('0x8')](_0x3d1b('0xe'),auth[_0x3d1b('0x9')](),controller[_0x3d1b('0xf')]);router[_0x3d1b('0x10')]('/',auth[_0x3d1b('0x9')](),controller[_0x3d1b('0x11')]);router[_0x3d1b('0x10')](_0x3d1b('0x12'),auth['isAuthenticated'](),controller[_0x3d1b('0x13')]);router[_0x3d1b('0x14')](_0x3d1b('0xb'),auth[_0x3d1b('0x9')](),controller[_0x3d1b('0x15')]);router['delete'](_0x3d1b('0xb'),auth['isAuthenticated'](),controller[_0x3d1b('0x16')]);module[_0x3d1b('0x17')]=router; \ No newline at end of file +var _0xb2ff=['update','delete','exports','multer','util','connect-timeout','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','post','create','addConfiguration','put'];(function(_0x5b3e28,_0x2ad693){var _0x21a6f4=function(_0xea4216){while(--_0xea4216){_0x5b3e28['push'](_0x5b3e28['shift']());}};_0x21a6f4(++_0x2ad693);}(_0xb2ff,0x123));var _0xfb2f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb2ff[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xfb2f('0x0'));var util=require(_0xfb2f('0x1'));var path=require('path');var timeout=require(_0xfb2f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfb2f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xfb2f('0x4'));var controller=require(_0xfb2f('0x5'));router[_0xfb2f('0x6')]('/',auth[_0xfb2f('0x7')](),controller['index']);router['get'](_0xfb2f('0x8'),auth['isAuthenticated'](),controller[_0xfb2f('0x9')]);router[_0xfb2f('0x6')](_0xfb2f('0xa'),auth[_0xfb2f('0x7')](),controller['getConfigurations']);router[_0xfb2f('0x6')]('/:id/fields',auth[_0xfb2f('0x7')](),controller['getFields']);router[_0xfb2f('0xb')]('/',auth[_0xfb2f('0x7')](),controller[_0xfb2f('0xc')]);router[_0xfb2f('0xb')](_0xfb2f('0xa'),auth['isAuthenticated'](),controller[_0xfb2f('0xd')]);router[_0xfb2f('0xe')](_0xfb2f('0x8'),auth[_0xfb2f('0x7')](),controller[_0xfb2f('0xf')]);router[_0xfb2f('0x10')](_0xfb2f('0x8'),auth[_0xfb2f('0x7')](),controller['destroy']);module[_0xfb2f('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 261ea34..d618c4a 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 _0xefec=['exports','STRING'];(function(_0x5dc965,_0x5b1f51){var _0x1072f9=function(_0x29ed74){while(--_0x29ed74){_0x5dc965['push'](_0x5dc965['shift']());}};_0x1072f9(++_0x5b1f51);}(_0xefec,0x16c));var _0xcefe=function(_0xc0db3b,_0xf3c461){_0xc0db3b=_0xc0db3b-0x0;var _0x381b2e=_0xefec[_0xc0db3b];return _0x381b2e;};'use strict';var Sequelize=require('sequelize');module[_0xcefe('0x0')]={'name':{'type':Sequelize[_0xcefe('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xcefe('0x1')]},'username':{'type':Sequelize[_0xcefe('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xcefe('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xcefe('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xcefe('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xcefe('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xa0cf=['sequelize','exports','STRING'];(function(_0x5f33be,_0x475327){var _0x365a5e=function(_0x227eee){while(--_0x227eee){_0x5f33be['push'](_0x5f33be['shift']());}};_0x365a5e(++_0x475327);}(_0xa0cf,0xd5));var _0xfa0c=function(_0x24cdd5,_0x4232a0){_0x24cdd5=_0x24cdd5-0x0;var _0x52a09e=_0xa0cf[_0x24cdd5];return _0x52a09e;};'use strict';var Sequelize=require(_0xfa0c('0x0'));module[_0xfa0c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xfa0c('0x2')]},'username':{'type':Sequelize[_0xfa0c('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xfa0c('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'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 da600cc..895ae9a 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 _0x6f74=['sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','rawAttributes','find','catch','create','body','params','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','format','GET','getchallenge','success','POST','login','result','token','sessionName','autogenerated','reference','remove','editable','false','label','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','offset','undefined','count','status','Content-Range','json','apply','save','update','then','destroy','sendStatus','name','send','index','map','VtigerAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0x4afbce,_0x1f649f){var _0x22c09c=function(_0x3dbc23){while(--_0x3dbc23){_0x4afbce['push'](_0x4afbce['shift']());}};_0x22c09c(++_0x1f649f);}(_0x6f74,0x12e));var _0x46f7=function(_0x27fbba,_0x499850){_0x27fbba=_0x27fbba-0x0;var _0x14ac01=_0x6f74[_0x27fbba];return _0x14ac01;};'use strict';var emlformat=require(_0x46f7('0x0'));var rimraf=require(_0x46f7('0x1'));var zipdir=require(_0x46f7('0x2'));var jsonpatch=require(_0x46f7('0x3'));var rp=require(_0x46f7('0x4'));var moment=require(_0x46f7('0x5'));var BPromise=require(_0x46f7('0x6'));var Mustache=require(_0x46f7('0x7'));var util=require(_0x46f7('0x8'));var path=require(_0x46f7('0x9'));var sox=require(_0x46f7('0xa'));var csv=require(_0x46f7('0xb'));var ejs=require(_0x46f7('0xc'));var fs=require('fs');var fs_extra=require(_0x46f7('0xd'));var _=require(_0x46f7('0xe'));var squel=require(_0x46f7('0xf'));var crypto=require(_0x46f7('0x10'));var jsforce=require(_0x46f7('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x46f7('0xb'));var querystring=require(_0x46f7('0x12'));var Papa=require(_0x46f7('0x13'));var Redis=require(_0x46f7('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x46f7('0x15'));var as=require(_0x46f7('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46f7('0x17'))('api');var utils=require(_0x46f7('0x18'));var config=require(_0x46f7('0x19'));var licenseUtil=require(_0x46f7('0x1a'));var db=require(_0x46f7('0x1b'))['db'];var integrations=require(_0x46f7('0x1c'));function respondWithStatusCode(_0x6f237c,_0x14a8c3){_0x14a8c3=_0x14a8c3||0xcc;return function(_0x3efa5e){if(_0x3efa5e){return _0x6f237c['sendStatus'](_0x14a8c3);}return _0x6f237c['status'](_0x14a8c3)[_0x46f7('0x1d')]();};}function respondWithResult(_0x23280d,_0x14de32){_0x14de32=_0x14de32||0xc8;return function(_0x293bbe){if(_0x293bbe){return _0x23280d['status'](_0x14de32)['json'](_0x293bbe);}};}function respondWithFilteredResult(_0x5a2e2d,_0x4414c1){return function(_0x4e2cea){if(_0x4e2cea){var _0x58d5e4=typeof _0x4414c1[_0x46f7('0x1e')]===_0x46f7('0x1f')&&typeof _0x4414c1['limit']===_0x46f7('0x1f');var _0x10152e=_0x4e2cea[_0x46f7('0x20')];var _0x209a05=_0x58d5e4?0x0:_0x4414c1[_0x46f7('0x1e')];var _0x1c7725=_0x58d5e4?_0x4e2cea[_0x46f7('0x20')]:_0x4414c1['offset']+_0x4414c1['limit'];var _0x23f76b;if(_0x1c7725>=_0x10152e){_0x1c7725=_0x10152e;_0x23f76b=0xc8;}else{_0x23f76b=0xce;}_0x5a2e2d[_0x46f7('0x21')](_0x23f76b);return _0x5a2e2d['set'](_0x46f7('0x22'),_0x209a05+'-'+_0x1c7725+'/'+_0x10152e)[_0x46f7('0x23')](_0x4e2cea);}return null;};}function patchUpdates(_0x266734){return function(_0x44df81){try{jsonpatch[_0x46f7('0x24')](_0x44df81,_0x266734,!![]);}catch(_0x24a3bd){return BPromise['reject'](_0x24a3bd);}return _0x44df81[_0x46f7('0x25')]();};}function saveUpdates(_0x4ac211,_0xf8979c){return function(_0x2edead){if(_0x2edead){return _0x2edead[_0x46f7('0x26')](_0x4ac211)[_0x46f7('0x27')](function(_0x1abd3f){return _0x1abd3f;});}return null;};}function removeEntity(_0x4766a1,_0x6bcd4e){return function(_0x54fe9d){if(_0x54fe9d){return _0x54fe9d[_0x46f7('0x28')]()[_0x46f7('0x27')](function(){_0x4766a1[_0x46f7('0x21')](0xcc)[_0x46f7('0x1d')]();});}};}function handleEntityNotFound(_0x449c5d,_0xbccb60){return function(_0x388328){if(!_0x388328){_0x449c5d[_0x46f7('0x29')](0x194);}return _0x388328;};}function handleError(_0x5a75d7,_0x472d06){_0x472d06=_0x472d06||0x1f4;return function(_0x3a9384){logger['error'](_0x3a9384['stack']);if(_0x3a9384[_0x46f7('0x2a')]){delete _0x3a9384[_0x46f7('0x2a')];}_0x5a75d7[_0x46f7('0x21')](_0x472d06)[_0x46f7('0x2b')](_0x3a9384);};}exports[_0x46f7('0x2c')]=function(_0x4eb33f,_0x31380d){var _0x3a78cb={},_0x1d310a={},_0x119afc={'count':0x0,'rows':[]};var _0x35326d=_[_0x46f7('0x2d')](db[_0x46f7('0x2e')]['rawAttributes'],function(_0x1e8f1e){return{'name':_0x1e8f1e[_0x46f7('0x2f')],'type':_0x1e8f1e[_0x46f7('0x30')]['key']};});_0x1d310a[_0x46f7('0x31')]=_['map'](_0x35326d,'name');_0x1d310a[_0x46f7('0x32')]=_[_0x46f7('0x33')](_0x4eb33f[_0x46f7('0x32')]);_0x1d310a[_0x46f7('0x34')]=_[_0x46f7('0x35')](_0x1d310a[_0x46f7('0x31')],_0x1d310a[_0x46f7('0x32')]);_0x3a78cb[_0x46f7('0x36')]=_['intersection'](_0x1d310a[_0x46f7('0x31')],qs[_0x46f7('0x37')](_0x4eb33f[_0x46f7('0x32')][_0x46f7('0x37')]));_0x3a78cb[_0x46f7('0x36')]=_0x3a78cb[_0x46f7('0x36')][_0x46f7('0x38')]?_0x3a78cb[_0x46f7('0x36')]:_0x1d310a[_0x46f7('0x31')];if(!_0x4eb33f[_0x46f7('0x32')][_0x46f7('0x39')](_0x46f7('0x3a'))){_0x3a78cb['limit']=qs[_0x46f7('0x3b')](_0x4eb33f[_0x46f7('0x32')]['limit']);_0x3a78cb[_0x46f7('0x1e')]=qs[_0x46f7('0x1e')](_0x4eb33f[_0x46f7('0x32')][_0x46f7('0x1e')]);}_0x3a78cb[_0x46f7('0x3c')]=qs[_0x46f7('0x3d')](_0x4eb33f[_0x46f7('0x32')][_0x46f7('0x3d')]);_0x3a78cb[_0x46f7('0x3e')]=qs[_0x46f7('0x34')](_[_0x46f7('0x3f')](_0x4eb33f['query'],_0x1d310a[_0x46f7('0x34')]),_0x35326d);if(_0x4eb33f[_0x46f7('0x32')][_0x46f7('0x40')]){_0x3a78cb[_0x46f7('0x3e')]=_[_0x46f7('0x41')](_0x3a78cb[_0x46f7('0x3e')],{'$or':_[_0x46f7('0x2d')](_0x35326d,function(_0x5e602c){if(_0x5e602c[_0x46f7('0x30')]!==_0x46f7('0x42')){var _0xabc0f2={};_0xabc0f2[_0x5e602c[_0x46f7('0x2a')]]={'$like':'%'+_0x4eb33f[_0x46f7('0x32')][_0x46f7('0x40')]+'%'};return _0xabc0f2;}})});}_0x3a78cb=_[_0x46f7('0x41')]({},_0x3a78cb,_0x4eb33f[_0x46f7('0x43')]);var _0x18d332={'where':_0x3a78cb[_0x46f7('0x3e')]};return db['VtigerAccount']['count'](_0x18d332)[_0x46f7('0x27')](function(_0x23e02e){_0x119afc[_0x46f7('0x20')]=_0x23e02e;if(_0x4eb33f[_0x46f7('0x32')]['includeAll']){_0x3a78cb[_0x46f7('0x44')]=[{'all':!![]}];}return db[_0x46f7('0x2e')][_0x46f7('0x45')](_0x3a78cb);})['then'](function(_0x19bb56){_0x119afc[_0x46f7('0x46')]=_0x19bb56;return _0x119afc;})['then'](respondWithFilteredResult(_0x31380d,_0x3a78cb))['catch'](handleError(_0x31380d,null));};exports[_0x46f7('0x47')]=function(_0x51783b,_0x493fb4){var _0x247585={'raw':![],'where':{'id':_0x51783b['params']['id']}},_0x226b33={};_0x226b33[_0x46f7('0x31')]=_[_0x46f7('0x33')](db[_0x46f7('0x2e')][_0x46f7('0x48')]);_0x226b33['query']=_[_0x46f7('0x33')](_0x51783b[_0x46f7('0x32')]);_0x226b33[_0x46f7('0x34')]=_[_0x46f7('0x35')](_0x226b33[_0x46f7('0x31')],_0x226b33['query']);_0x247585[_0x46f7('0x36')]=_[_0x46f7('0x35')](_0x226b33['model'],qs[_0x46f7('0x37')](_0x51783b[_0x46f7('0x32')][_0x46f7('0x37')]));_0x247585[_0x46f7('0x36')]=_0x247585[_0x46f7('0x36')]['length']?_0x247585[_0x46f7('0x36')]:_0x226b33[_0x46f7('0x31')];if(_0x51783b[_0x46f7('0x32')]['includeAll']){_0x247585[_0x46f7('0x44')]=[{'all':!![]}];}_0x247585=_[_0x46f7('0x41')]({},_0x247585,_0x51783b[_0x46f7('0x43')]);return db[_0x46f7('0x2e')][_0x46f7('0x49')](_0x247585)[_0x46f7('0x27')](handleEntityNotFound(_0x493fb4,null))[_0x46f7('0x27')](respondWithResult(_0x493fb4,null))[_0x46f7('0x4a')](handleError(_0x493fb4,null));};exports[_0x46f7('0x4b')]=function(_0x4c4e1d,_0x1ace2b){return db[_0x46f7('0x2e')][_0x46f7('0x4b')](_0x4c4e1d[_0x46f7('0x4c')],{})['then'](respondWithResult(_0x1ace2b,0xc9))[_0x46f7('0x4a')](handleError(_0x1ace2b,null));};exports[_0x46f7('0x26')]=function(_0x3e6d2e,_0x42d9b9){if(_0x3e6d2e['body']['id']){delete _0x3e6d2e[_0x46f7('0x4c')]['id'];}return db[_0x46f7('0x2e')][_0x46f7('0x49')]({'where':{'id':_0x3e6d2e[_0x46f7('0x4d')]['id']}})[_0x46f7('0x27')](handleEntityNotFound(_0x42d9b9,null))[_0x46f7('0x27')](saveUpdates(_0x3e6d2e[_0x46f7('0x4c')],null))[_0x46f7('0x27')](respondWithResult(_0x42d9b9,null))['catch'](handleError(_0x42d9b9,null));};exports[_0x46f7('0x28')]=function(_0x5d2ed6,_0x53f162){return db[_0x46f7('0x2e')][_0x46f7('0x49')]({'where':{'id':_0x5d2ed6[_0x46f7('0x4d')]['id']}})['then'](handleEntityNotFound(_0x53f162,null))[_0x46f7('0x27')](removeEntity(_0x53f162,null))[_0x46f7('0x4a')](handleError(_0x53f162,null));};exports[_0x46f7('0x4e')]=function(_0x1e680c,_0x37cd99,_0x3b0dce){var _0x1f9e21={};var _0x33a95e={};var _0x5a0d17;var _0x1b9df2;return db['VtigerAccount'][_0x46f7('0x4f')]({'where':{'id':_0x1e680c[_0x46f7('0x4d')]['id']}})[_0x46f7('0x27')](handleEntityNotFound(_0x37cd99,null))['then'](function(_0x18de3e){if(_0x18de3e){_0x5a0d17=_0x18de3e;_0x33a95e[_0x46f7('0x31')]=_[_0x46f7('0x33')](db['VtigerConfiguration'][_0x46f7('0x48')]);_0x33a95e[_0x46f7('0x32')]=_[_0x46f7('0x33')](_0x1e680c[_0x46f7('0x32')]);_0x33a95e[_0x46f7('0x34')]=_['intersection'](_0x33a95e[_0x46f7('0x31')],_0x33a95e[_0x46f7('0x32')]);_0x1f9e21[_0x46f7('0x36')]=_[_0x46f7('0x35')](_0x33a95e['model'],qs[_0x46f7('0x37')](_0x1e680c[_0x46f7('0x32')][_0x46f7('0x37')]));_0x1f9e21[_0x46f7('0x36')]=_0x1f9e21[_0x46f7('0x36')]['length']?_0x1f9e21[_0x46f7('0x36')]:_0x33a95e[_0x46f7('0x31')];_0x1f9e21[_0x46f7('0x3c')]=qs[_0x46f7('0x3d')](_0x1e680c[_0x46f7('0x32')]['sort']);_0x1f9e21[_0x46f7('0x3e')]=qs[_0x46f7('0x34')](_['pick'](_0x1e680c[_0x46f7('0x32')],_0x33a95e['filters']));if(_0x1e680c[_0x46f7('0x32')][_0x46f7('0x40')]){_0x1f9e21['where']=_[_0x46f7('0x41')](_0x1f9e21[_0x46f7('0x3e')],{'$or':_['map'](_0x1f9e21['attributes'],function(_0x2ff050){var _0x361848={};_0x361848[_0x2ff050]={'$like':'%'+_0x1e680c[_0x46f7('0x32')][_0x46f7('0x40')]+'%'};return _0x361848;})});}_0x1f9e21=_[_0x46f7('0x41')]({},_0x1f9e21,_0x1e680c[_0x46f7('0x43')]);return _0x5a0d17[_0x46f7('0x4e')](_0x1f9e21);}})['then'](function(_0xeff6ef){if(_0xeff6ef){_0x1b9df2=_0xeff6ef[_0x46f7('0x38')];if(!_0x1e680c[_0x46f7('0x32')]['hasOwnProperty']('nolimit')){_0x1f9e21[_0x46f7('0x3b')]=qs[_0x46f7('0x3b')](_0x1e680c[_0x46f7('0x32')][_0x46f7('0x3b')]);_0x1f9e21['offset']=qs[_0x46f7('0x1e')](_0x1e680c[_0x46f7('0x32')]['offset']);}return _0x5a0d17[_0x46f7('0x4e')](_0x1f9e21);}})[_0x46f7('0x27')](function(_0x19cb62){if(_0x19cb62){return _0x19cb62?{'count':_0x1b9df2,'rows':_0x19cb62}:null;}})[_0x46f7('0x27')](respondWithResult(_0x37cd99,null))[_0x46f7('0x4a')](handleError(_0x37cd99,null));};exports[_0x46f7('0x50')]=function(_0x875d81,_0x208958,_0x1bd121){if(_0x875d81[_0x46f7('0x4c')]['id']){delete _0x875d81[_0x46f7('0x4c')]['id'];}return db['VtigerAccount'][_0x46f7('0x4f')]({'where':{'id':_0x875d81['params']['id']}})[_0x46f7('0x27')](handleEntityNotFound(_0x208958,null))[_0x46f7('0x27')](function(_0x4f8100){if(_0x4f8100){_0x875d81[_0x46f7('0x4c')][_0x46f7('0x51')]=_0x4f8100['id'];_0x875d81[_0x46f7('0x4c')][_0x46f7('0x52')]=integrations[_0x46f7('0x53')](_0x875d81[_0x46f7('0x4c')]['channel'],_0x875d81['body'][_0x46f7('0x30')]);_0x875d81[_0x46f7('0x4c')]['Descriptions']=integrations['getDescriptions'](_0x875d81[_0x46f7('0x4c')]['channel'],_0x875d81[_0x46f7('0x4c')][_0x46f7('0x30')]);return db['VtigerConfiguration'][_0x46f7('0x4b')](_0x875d81['body'],{'include':[{'model':db['VtigerField'],'as':_0x46f7('0x52')},{'model':db['VtigerField'],'as':_0x46f7('0x54')}]});}return null;})[_0x46f7('0x27')](respondWithResult(_0x208958,null))['catch'](handleError(_0x208958,null));};var md5=require('md5');exports[_0x46f7('0x55')]=function(_0x51bc62,_0x30c544,_0x375856){var _0x314e68=null;var _0x934028=null;var _0x318a0d=null;var _0x4ddfbe=null;var _0x10d9d4='';return db[_0x46f7('0x2e')][_0x46f7('0x4f')]({'where':{'id':_0x51bc62[_0x46f7('0x4d')]['id']},'attributes':['id',_0x46f7('0x2a'),_0x46f7('0x56'),_0x46f7('0x57'),_0x46f7('0x58'),_0x46f7('0x59'),_0x46f7('0x5a'),'accessKey']})['then'](handleEntityNotFound(_0x30c544,null))['then'](function(_0x1f7db6){if(_0x1f7db6){_0x314e68=_0x1f7db6[_0x46f7('0x56')];_0x934028=_0x1f7db6[_0x46f7('0x5b')];_0x318a0d=_0x1f7db6[_0x46f7('0x58')];_0x10d9d4=_0x1f7db6[_0x46f7('0x59')];var _0x281f2e=_0x10d9d4[_0x46f7('0x5c')](-0x1);if(_0x281f2e==='/'){_0x10d9d4=_0x10d9d4[_0x46f7('0x5d')](0x0,_0x10d9d4['lastIndexOf'](_0x281f2e));}_0x4ddfbe=util[_0x46f7('0x5e')]('%s/webservice.php',_0x10d9d4);var _0x23cd8b={'method':_0x46f7('0x5f'),'uri':_0x4ddfbe,'qs':{'operation':_0x46f7('0x60'),'username':_0x1f7db6['username']},'json':!![]};return rp(_0x23cd8b);}})[_0x46f7('0x27')](function(_0x661255){if(_0x661255[_0x46f7('0x61')]){var _0x430535={'method':_0x46f7('0x62'),'uri':_0x4ddfbe,'form':{'operation':_0x46f7('0x63'),'username':_0x314e68,'accessKey':md5(_0x661255[_0x46f7('0x64')][_0x46f7('0x65')]+_0x934028)},'json':!![]};return rp(_0x430535);}})[_0x46f7('0x27')](function(_0x1a0b44){if(_0x1a0b44[_0x46f7('0x61')]){var _0x46a9b5={'method':_0x46f7('0x5f'),'uri':_0x4ddfbe,'qs':{'operation':'describe','username':_0x314e68,'sessionName':_0x1a0b44[_0x46f7('0x64')][_0x46f7('0x66')],'elementType':_0x318a0d},'json':!![]};return rp(_0x46a9b5);}})[_0x46f7('0x27')](function(_0x4ddded){if(_0x4ddded[_0x46f7('0x61')]){var _0x2c2b16=[_0x46f7('0x67'),_0x46f7('0x68'),'owner'];_[_0x46f7('0x69')](_0x4ddded[_0x46f7('0x64')][_0x46f7('0x37')],function(_0x2c10ca){return _0x2c2b16['includes'](_0x2c10ca[_0x46f7('0x30')][_0x46f7('0x2a')]);});_[_0x46f7('0x69')](_0x4ddded[_0x46f7('0x64')][_0x46f7('0x37')],function(_0x25e9c6){return _0x25e9c6[_0x46f7('0x6a')]===_0x46f7('0x6b');});return{'count':_0x4ddded[_0x46f7('0x64')][_0x46f7('0x37')][_0x46f7('0x38')],'rows':_[_0x46f7('0x2d')](_0x4ddded['result'][_0x46f7('0x37')],function(_0x50b372){return{'id':_0x50b372[_0x46f7('0x2a')],'name':_0x50b372[_0x46f7('0x6c')],'custom':_['startsWith'](_0x50b372[_0x46f7('0x2a')],_0x46f7('0x6d'))?!![]:![],'options':_0x50b372[_0x46f7('0x30')][_0x46f7('0x2a')]===_0x46f7('0x6e')&&_0x50b372[_0x46f7('0x30')]['picklistValues'][_0x46f7('0x38')]>0x0?_[_0x46f7('0x2d')](_0x50b372[_0x46f7('0x30')][_0x46f7('0x6f')],function(_0x5f1bf1){return{'name':_0x5f1bf1[_0x46f7('0x6c')],'value':_0x5f1bf1[_0x46f7('0x70')]};}):[]};})};}})[_0x46f7('0x27')](respondWithResult(_0x30c544,null))[_0x46f7('0x4a')](function(_0x335833){console[_0x46f7('0x71')](_0x46f7('0x72')+_0x335833);var _0x320b38=_0x51bc62[_0x46f7('0x32')][_0x46f7('0x73')]?0x1f4:_0x335833[_0x46f7('0x74')]||0x1f4;logger[_0x46f7('0x75')](_0x46f7('0x76'),'getFields',_0x320b38,JSON[_0x46f7('0x77')](_0x335833));delete _0x335833[_0x46f7('0x2a')];if(_0x320b38===0x191){_0x320b38=0x190;}_0x30c544[_0x46f7('0x21')](_0x320b38)[_0x46f7('0x2b')](_0x51bc62[_0x46f7('0x32')][_0x46f7('0x73')]?{'message':_0x46f7('0x78'),'statusCode':_0x335833[_0x46f7('0x74')]}:_0x335833);});}; \ No newline at end of file +var _0x4ff7=['value','vTiger\x20error:\x20','getFields,\x20%s,\x20%s,\x20%s','stringify','send','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','reject','update','then','sendStatus','error','stack','name','index','map','VtigerAccount','fieldName','type','query','keys','model','fields','attributes','length','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','intersection','find','create','body','destroy','getConfigurations','findOne','VtigerConfiguration','pick','hasOwnProperty','Subjects','getSubjects','channel','Descriptions','VtigerField','md5','getFields','description','moduleName','serverUrl','accessKey','slice','GET','username','success','POST','login','result','token','sessionName','owner','remove','editable','startsWith','cf_','picklistValues','label'];(function(_0x587ba2,_0x42eb40){var _0x50ec73=function(_0x2f32e3){while(--_0x2f32e3){_0x587ba2['push'](_0x587ba2['shift']());}};_0x50ec73(++_0x42eb40);}(_0x4ff7,0x71));var _0x74ff=function(_0x51b698,_0x2fd161){_0x51b698=_0x51b698-0x0;var _0xfa0590=_0x4ff7[_0x51b698];return _0xfa0590;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x74ff('0x0'));var zipdir=require(_0x74ff('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74ff('0x2'));var moment=require(_0x74ff('0x3'));var BPromise=require(_0x74ff('0x4'));var Mustache=require(_0x74ff('0x5'));var util=require(_0x74ff('0x6'));var path=require(_0x74ff('0x7'));var sox=require(_0x74ff('0x8'));var csv=require(_0x74ff('0x9'));var ejs=require(_0x74ff('0xa'));var fs=require('fs');var fs_extra=require(_0x74ff('0xb'));var _=require(_0x74ff('0xc'));var squel=require(_0x74ff('0xd'));var crypto=require(_0x74ff('0xe'));var jsforce=require(_0x74ff('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x74ff('0x9'));var querystring=require(_0x74ff('0x10'));var Papa=require(_0x74ff('0x11'));var Redis=require('ioredis');var authService=require(_0x74ff('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x74ff('0x13'))(_0x74ff('0x14'));var utils=require('../../config/utils');var config=require(_0x74ff('0x15'));var licenseUtil=require(_0x74ff('0x16'));var db=require(_0x74ff('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2f7869,_0x49d242){_0x49d242=_0x49d242||0xcc;return function(_0x5d3c67){if(_0x5d3c67){return _0x2f7869['sendStatus'](_0x49d242);}return _0x2f7869[_0x74ff('0x18')](_0x49d242)[_0x74ff('0x19')]();};}function respondWithResult(_0x25b7a4,_0x5786a4){_0x5786a4=_0x5786a4||0xc8;return function(_0x382b5a){if(_0x382b5a){return _0x25b7a4[_0x74ff('0x18')](_0x5786a4)[_0x74ff('0x1a')](_0x382b5a);}};}function respondWithFilteredResult(_0x1adeae,_0x3c3f8d){return function(_0xf7ed1a){if(_0xf7ed1a){var _0x1a2c2d=typeof _0x3c3f8d[_0x74ff('0x1b')]===_0x74ff('0x1c')&&typeof _0x3c3f8d['limit']===_0x74ff('0x1c');var _0x3a96b5=_0xf7ed1a[_0x74ff('0x1d')];var _0x1e4aef=_0x1a2c2d?0x0:_0x3c3f8d[_0x74ff('0x1b')];var _0xd4288e=_0x1a2c2d?_0xf7ed1a[_0x74ff('0x1d')]:_0x3c3f8d[_0x74ff('0x1b')]+_0x3c3f8d[_0x74ff('0x1e')];var _0x247a4a;if(_0xd4288e>=_0x3a96b5){_0xd4288e=_0x3a96b5;_0x247a4a=0xc8;}else{_0x247a4a=0xce;}_0x1adeae['status'](_0x247a4a);return _0x1adeae[_0x74ff('0x1f')]('Content-Range',_0x1e4aef+'-'+_0xd4288e+'/'+_0x3a96b5)['json'](_0xf7ed1a);}return null;};}function patchUpdates(_0xa5443f){return function(_0xa6bab7){try{jsonpatch['apply'](_0xa6bab7,_0xa5443f,!![]);}catch(_0x4e6924){return BPromise[_0x74ff('0x20')](_0x4e6924);}return _0xa6bab7['save']();};}function saveUpdates(_0x572436,_0x5e516c){return function(_0x4cbb71){if(_0x4cbb71){return _0x4cbb71[_0x74ff('0x21')](_0x572436)[_0x74ff('0x22')](function(_0x386d8a){return _0x386d8a;});}return null;};}function removeEntity(_0x54538b,_0x2c7e13){return function(_0x830e79){if(_0x830e79){return _0x830e79['destroy']()[_0x74ff('0x22')](function(){_0x54538b[_0x74ff('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481d26,_0x5d5d09){return function(_0x3c13ae){if(!_0x3c13ae){_0x481d26[_0x74ff('0x23')](0x194);}return _0x3c13ae;};}function handleError(_0x2fb3b9,_0x194988){_0x194988=_0x194988||0x1f4;return function(_0x13a8cb){logger[_0x74ff('0x24')](_0x13a8cb[_0x74ff('0x25')]);if(_0x13a8cb[_0x74ff('0x26')]){delete _0x13a8cb['name'];}_0x2fb3b9['status'](_0x194988)['send'](_0x13a8cb);};}exports[_0x74ff('0x27')]=function(_0x3edbf5,_0x55ad6c){var _0x3621f4={},_0x50da10={},_0x36b27a={'count':0x0,'rows':[]};var _0x5629b5=_[_0x74ff('0x28')](db[_0x74ff('0x29')]['rawAttributes'],function(_0x489743){return{'name':_0x489743[_0x74ff('0x2a')],'type':_0x489743[_0x74ff('0x2b')]['key']};});_0x50da10['model']=_[_0x74ff('0x28')](_0x5629b5,_0x74ff('0x26'));_0x50da10[_0x74ff('0x2c')]=_[_0x74ff('0x2d')](_0x3edbf5[_0x74ff('0x2c')]);_0x50da10['filters']=_['intersection'](_0x50da10[_0x74ff('0x2e')],_0x50da10[_0x74ff('0x2c')]);_0x3621f4['attributes']=_['intersection'](_0x50da10['model'],qs['fields'](_0x3edbf5['query'][_0x74ff('0x2f')]));_0x3621f4[_0x74ff('0x30')]=_0x3621f4[_0x74ff('0x30')][_0x74ff('0x31')]?_0x3621f4[_0x74ff('0x30')]:_0x50da10['model'];if(!_0x3edbf5[_0x74ff('0x2c')]['hasOwnProperty'](_0x74ff('0x32'))){_0x3621f4['limit']=qs[_0x74ff('0x1e')](_0x3edbf5[_0x74ff('0x2c')]['limit']);_0x3621f4['offset']=qs[_0x74ff('0x1b')](_0x3edbf5[_0x74ff('0x2c')][_0x74ff('0x1b')]);}_0x3621f4[_0x74ff('0x33')]=qs[_0x74ff('0x34')](_0x3edbf5[_0x74ff('0x2c')][_0x74ff('0x34')]);_0x3621f4[_0x74ff('0x35')]=qs[_0x74ff('0x36')](_['pick'](_0x3edbf5['query'],_0x50da10[_0x74ff('0x36')]),_0x5629b5);if(_0x3edbf5['query'][_0x74ff('0x37')]){_0x3621f4[_0x74ff('0x35')]=_['merge'](_0x3621f4['where'],{'$or':_['map'](_0x5629b5,function(_0x586109){if(_0x586109[_0x74ff('0x2b')]!==_0x74ff('0x38')){var _0x34e265={};_0x34e265[_0x586109[_0x74ff('0x26')]]={'$like':'%'+_0x3edbf5[_0x74ff('0x2c')][_0x74ff('0x37')]+'%'};return _0x34e265;}})});}_0x3621f4=_[_0x74ff('0x39')]({},_0x3621f4,_0x3edbf5[_0x74ff('0x3a')]);var _0x1b571f={'where':_0x3621f4['where']};return db[_0x74ff('0x29')]['count'](_0x1b571f)[_0x74ff('0x22')](function(_0x445c99){_0x36b27a[_0x74ff('0x1d')]=_0x445c99;if(_0x3edbf5[_0x74ff('0x2c')][_0x74ff('0x3b')]){_0x3621f4[_0x74ff('0x3c')]=[{'all':!![]}];}return db[_0x74ff('0x29')][_0x74ff('0x3d')](_0x3621f4);})[_0x74ff('0x22')](function(_0x30715c){_0x36b27a['rows']=_0x30715c;return _0x36b27a;})[_0x74ff('0x22')](respondWithFilteredResult(_0x55ad6c,_0x3621f4))[_0x74ff('0x3e')](handleError(_0x55ad6c,null));};exports[_0x74ff('0x3f')]=function(_0x51e3c2,_0x58fd94){var _0x45b1a4={'raw':![],'where':{'id':_0x51e3c2[_0x74ff('0x40')]['id']}},_0x5f4652={};_0x5f4652[_0x74ff('0x2e')]=_[_0x74ff('0x2d')](db[_0x74ff('0x29')][_0x74ff('0x41')]);_0x5f4652[_0x74ff('0x2c')]=_[_0x74ff('0x2d')](_0x51e3c2[_0x74ff('0x2c')]);_0x5f4652['filters']=_[_0x74ff('0x42')](_0x5f4652['model'],_0x5f4652[_0x74ff('0x2c')]);_0x45b1a4['attributes']=_['intersection'](_0x5f4652['model'],qs['fields'](_0x51e3c2['query'][_0x74ff('0x2f')]));_0x45b1a4[_0x74ff('0x30')]=_0x45b1a4[_0x74ff('0x30')][_0x74ff('0x31')]?_0x45b1a4[_0x74ff('0x30')]:_0x5f4652[_0x74ff('0x2e')];if(_0x51e3c2[_0x74ff('0x2c')][_0x74ff('0x3b')]){_0x45b1a4[_0x74ff('0x3c')]=[{'all':!![]}];}_0x45b1a4=_['merge']({},_0x45b1a4,_0x51e3c2['options']);return db['VtigerAccount'][_0x74ff('0x43')](_0x45b1a4)['then'](handleEntityNotFound(_0x58fd94,null))[_0x74ff('0x22')](respondWithResult(_0x58fd94,null))[_0x74ff('0x3e')](handleError(_0x58fd94,null));};exports[_0x74ff('0x44')]=function(_0x43b660,_0x38162f){return db[_0x74ff('0x29')]['create'](_0x43b660[_0x74ff('0x45')],{})[_0x74ff('0x22')](respondWithResult(_0x38162f,0xc9))['catch'](handleError(_0x38162f,null));};exports[_0x74ff('0x21')]=function(_0x43472c,_0x44a550){if(_0x43472c[_0x74ff('0x45')]['id']){delete _0x43472c[_0x74ff('0x45')]['id'];}return db[_0x74ff('0x29')][_0x74ff('0x43')]({'where':{'id':_0x43472c['params']['id']}})['then'](handleEntityNotFound(_0x44a550,null))['then'](saveUpdates(_0x43472c[_0x74ff('0x45')],null))[_0x74ff('0x22')](respondWithResult(_0x44a550,null))['catch'](handleError(_0x44a550,null));};exports[_0x74ff('0x46')]=function(_0x2869b2,_0x4dc1ab){return db[_0x74ff('0x29')][_0x74ff('0x43')]({'where':{'id':_0x2869b2['params']['id']}})['then'](handleEntityNotFound(_0x4dc1ab,null))[_0x74ff('0x22')](removeEntity(_0x4dc1ab,null))[_0x74ff('0x3e')](handleError(_0x4dc1ab,null));};exports[_0x74ff('0x47')]=function(_0x1ea886,_0x17c345,_0x5bca27){var _0x15fb11={};var _0x46ce32={};var _0x216a82;var _0x201957;return db[_0x74ff('0x29')][_0x74ff('0x48')]({'where':{'id':_0x1ea886[_0x74ff('0x40')]['id']}})[_0x74ff('0x22')](handleEntityNotFound(_0x17c345,null))[_0x74ff('0x22')](function(_0x2d5a50){if(_0x2d5a50){_0x216a82=_0x2d5a50;_0x46ce32['model']=_[_0x74ff('0x2d')](db[_0x74ff('0x49')][_0x74ff('0x41')]);_0x46ce32[_0x74ff('0x2c')]=_['keys'](_0x1ea886[_0x74ff('0x2c')]);_0x46ce32['filters']=_[_0x74ff('0x42')](_0x46ce32['model'],_0x46ce32['query']);_0x15fb11[_0x74ff('0x30')]=_[_0x74ff('0x42')](_0x46ce32[_0x74ff('0x2e')],qs['fields'](_0x1ea886['query'][_0x74ff('0x2f')]));_0x15fb11[_0x74ff('0x30')]=_0x15fb11['attributes'][_0x74ff('0x31')]?_0x15fb11[_0x74ff('0x30')]:_0x46ce32[_0x74ff('0x2e')];_0x15fb11[_0x74ff('0x33')]=qs['sort'](_0x1ea886['query'][_0x74ff('0x34')]);_0x15fb11[_0x74ff('0x35')]=qs[_0x74ff('0x36')](_[_0x74ff('0x4a')](_0x1ea886[_0x74ff('0x2c')],_0x46ce32['filters']));if(_0x1ea886[_0x74ff('0x2c')][_0x74ff('0x37')]){_0x15fb11[_0x74ff('0x35')]=_['merge'](_0x15fb11[_0x74ff('0x35')],{'$or':_[_0x74ff('0x28')](_0x15fb11['attributes'],function(_0x3dad18){var _0x337edf={};_0x337edf[_0x3dad18]={'$like':'%'+_0x1ea886['query'][_0x74ff('0x37')]+'%'};return _0x337edf;})});}_0x15fb11=_[_0x74ff('0x39')]({},_0x15fb11,_0x1ea886[_0x74ff('0x3a')]);return _0x216a82[_0x74ff('0x47')](_0x15fb11);}})['then'](function(_0x3329c8){if(_0x3329c8){_0x201957=_0x3329c8[_0x74ff('0x31')];if(!_0x1ea886['query'][_0x74ff('0x4b')](_0x74ff('0x32'))){_0x15fb11['limit']=qs['limit'](_0x1ea886[_0x74ff('0x2c')][_0x74ff('0x1e')]);_0x15fb11[_0x74ff('0x1b')]=qs[_0x74ff('0x1b')](_0x1ea886[_0x74ff('0x2c')][_0x74ff('0x1b')]);}return _0x216a82['getConfigurations'](_0x15fb11);}})[_0x74ff('0x22')](function(_0x4c32b4){if(_0x4c32b4){return _0x4c32b4?{'count':_0x201957,'rows':_0x4c32b4}:null;}})['then'](respondWithResult(_0x17c345,null))['catch'](handleError(_0x17c345,null));};exports['addConfiguration']=function(_0x2f242d,_0x362d40,_0x25bfba){if(_0x2f242d['body']['id']){delete _0x2f242d[_0x74ff('0x45')]['id'];}return db[_0x74ff('0x29')][_0x74ff('0x48')]({'where':{'id':_0x2f242d['params']['id']}})[_0x74ff('0x22')](handleEntityNotFound(_0x362d40,null))['then'](function(_0x488bca){if(_0x488bca){_0x2f242d[_0x74ff('0x45')]['AccountId']=_0x488bca['id'];_0x2f242d['body'][_0x74ff('0x4c')]=integrations[_0x74ff('0x4d')](_0x2f242d[_0x74ff('0x45')][_0x74ff('0x4e')],_0x2f242d[_0x74ff('0x45')][_0x74ff('0x2b')]);_0x2f242d[_0x74ff('0x45')][_0x74ff('0x4f')]=integrations['getDescriptions'](_0x2f242d[_0x74ff('0x45')][_0x74ff('0x4e')],_0x2f242d[_0x74ff('0x45')]['type']);return db[_0x74ff('0x49')]['create'](_0x2f242d[_0x74ff('0x45')],{'include':[{'model':db[_0x74ff('0x50')],'as':'Subjects'},{'model':db[_0x74ff('0x50')],'as':'Descriptions'}]});}return null;})[_0x74ff('0x22')](respondWithResult(_0x362d40,null))[_0x74ff('0x3e')](handleError(_0x362d40,null));};var md5=require(_0x74ff('0x51'));exports[_0x74ff('0x52')]=function(_0xbf4643,_0x42bd99,_0x272a25){var _0x3da120=null;var _0x37fe4e=null;var _0x463b48=null;var _0x24a054=null;var _0x508d2d='';return db[_0x74ff('0x29')][_0x74ff('0x48')]({'where':{'id':_0xbf4643['params']['id']},'attributes':['id',_0x74ff('0x26'),'username',_0x74ff('0x53'),_0x74ff('0x54'),'remoteUri',_0x74ff('0x55'),_0x74ff('0x56')]})['then'](handleEntityNotFound(_0x42bd99,null))[_0x74ff('0x22')](function(_0x597056){if(_0x597056){_0x3da120=_0x597056['username'];_0x37fe4e=_0x597056[_0x74ff('0x56')];_0x463b48=_0x597056['moduleName'];_0x508d2d=_0x597056['remoteUri'];var _0x19afc4=_0x508d2d[_0x74ff('0x57')](-0x1);if(_0x19afc4==='/'){_0x508d2d=_0x508d2d['substring'](0x0,_0x508d2d['lastIndexOf'](_0x19afc4));}_0x24a054=util['format']('%s/webservice.php',_0x508d2d);var _0x52f188={'method':_0x74ff('0x58'),'uri':_0x24a054,'qs':{'operation':'getchallenge','username':_0x597056[_0x74ff('0x59')]},'json':!![]};return rp(_0x52f188);}})[_0x74ff('0x22')](function(_0x32a081){if(_0x32a081[_0x74ff('0x5a')]){var _0x4671e2={'method':_0x74ff('0x5b'),'uri':_0x24a054,'form':{'operation':_0x74ff('0x5c'),'username':_0x3da120,'accessKey':md5(_0x32a081[_0x74ff('0x5d')][_0x74ff('0x5e')]+_0x37fe4e)},'json':!![]};return rp(_0x4671e2);}})[_0x74ff('0x22')](function(_0x552bb0){if(_0x552bb0['success']){var _0x448213={'method':_0x74ff('0x58'),'uri':_0x24a054,'qs':{'operation':'describe','username':_0x3da120,'sessionName':_0x552bb0['result'][_0x74ff('0x5f')],'elementType':_0x463b48},'json':!![]};return rp(_0x448213);}})[_0x74ff('0x22')](function(_0x559679){if(_0x559679[_0x74ff('0x5a')]){var _0x81817a=['autogenerated','reference',_0x74ff('0x60')];_[_0x74ff('0x61')](_0x559679[_0x74ff('0x5d')][_0x74ff('0x2f')],function(_0x36995b){return _0x81817a['includes'](_0x36995b[_0x74ff('0x2b')][_0x74ff('0x26')]);});_[_0x74ff('0x61')](_0x559679[_0x74ff('0x5d')][_0x74ff('0x2f')],function(_0x445074){return _0x445074[_0x74ff('0x62')]==='false';});return{'count':_0x559679[_0x74ff('0x5d')][_0x74ff('0x2f')]['length'],'rows':_[_0x74ff('0x28')](_0x559679[_0x74ff('0x5d')][_0x74ff('0x2f')],function(_0x248cca){return{'id':_0x248cca[_0x74ff('0x26')],'name':_0x248cca['label'],'custom':_[_0x74ff('0x63')](_0x248cca['name'],_0x74ff('0x64'))?!![]:![],'options':_0x248cca[_0x74ff('0x2b')]['name']==='picklist'&&_0x248cca[_0x74ff('0x2b')]['picklistValues']['length']>0x0?_[_0x74ff('0x28')](_0x248cca[_0x74ff('0x2b')][_0x74ff('0x65')],function(_0x20cfdd){return{'name':_0x20cfdd[_0x74ff('0x66')],'value':_0x20cfdd[_0x74ff('0x67')]};}):[]};})};}})[_0x74ff('0x22')](respondWithResult(_0x42bd99,null))[_0x74ff('0x3e')](function(_0x1473b4){console['log'](_0x74ff('0x68')+_0x1473b4);var _0x46c445=_0xbf4643['query']['test']?0x1f4:_0x1473b4['statusCode']||0x1f4;logger[_0x74ff('0x24')](_0x74ff('0x69'),'getFields',_0x46c445,JSON[_0x74ff('0x6a')](_0x1473b4));delete _0x1473b4[_0x74ff('0x26')];if(_0x46c445===0x191){_0x46c445=0x190;}_0x42bd99[_0x74ff('0x18')](_0x46c445)[_0x74ff('0x6b')](_0xbf4643['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x1473b4['statusCode']}:_0x1473b4);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index b99ef2f..de304d1 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 _0x6e7c=['../../config/logger','api','moment','bluebird','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','int_vtiger_accounts','util'];(function(_0x2dbbf2,_0x34c336){var _0x2b40ce=function(_0x1566c4){while(--_0x1566c4){_0x2dbbf2['push'](_0x2dbbf2['shift']());}};_0x2b40ce(++_0x34c336);}(_0x6e7c,0xdb));var _0xc6e7=function(_0x4d84d0,_0x5a94af){_0x4d84d0=_0x4d84d0-0x0;var _0x10d9a7=_0x6e7c[_0x4d84d0];return _0x10d9a7;};'use strict';var _=require('lodash');var util=require(_0xc6e7('0x0'));var logger=require(_0xc6e7('0x1'))(_0xc6e7('0x2'));var moment=require(_0xc6e7('0x3'));var BPromise=require(_0xc6e7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6e7('0x5'));var rimraf=require('rimraf');var config=require(_0xc6e7('0x6'));var attributes=require(_0xc6e7('0x7'));var integrations=require(_0xc6e7('0x8'));module[_0xc6e7('0x9')]=function(_0x15fde6,_0x256011){return _0x15fde6['define']('VtigerAccount',attributes,{'tableName':_0xc6e7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd0b=['define','VtigerAccount','int_vtiger_accounts','util','../../config/logger','api','bluebird','request-promise','rimraf','../../components/integrations/configuration','exports'];(function(_0x4b433b,_0x27509a){var _0xde9cf1=function(_0x5ac40c){while(--_0x5ac40c){_0x4b433b['push'](_0x4b433b['shift']());}};_0xde9cf1(++_0x27509a);}(_0xfd0b,0x19a));var _0xbfd0=function(_0x2728d4,_0x1f82dc){_0x2728d4=_0x2728d4-0x0;var _0x17a654=_0xfd0b[_0x2728d4];return _0x17a654;};'use strict';var _=require('lodash');var util=require(_0xbfd0('0x0'));var logger=require(_0xbfd0('0x1'))(_0xbfd0('0x2'));var moment=require('moment');var BPromise=require(_0xbfd0('0x3'));var rp=require(_0xbfd0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbfd0('0x5'));var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xbfd0('0x6'));module[_0xbfd0('0x7')]=function(_0x278038,_0x5155f2){return _0x278038[_0xbfd0('0x8')](_0xbfd0('0x9'),attributes,{'tableName':_0xbfd0('0xa'),'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 98b8487..abf3438 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 _0xb58b=['model','map','debug','catch','ShowVtigerAccount','find','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../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','GetVtigerAccount','VtigerAccount','findAll','options','raw','attributes','limit','include'];(function(_0x32c8ed,_0x45fef2){var _0x580764=function(_0xeb440e){while(--_0xeb440e){_0x32c8ed['push'](_0x32c8ed['shift']());}};_0x580764(++_0x45fef2);}(_0xb58b,0x1f1));var _0xbb58=function(_0x48dbf2,_0x39e8c1){_0x48dbf2=_0x48dbf2-0x0;var _0x12d880=_0xb58b[_0x48dbf2];return _0x12d880;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var moment=require(_0xbb58('0x1'));var BPromise=require(_0xbb58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb58('0x3'));var db=require(_0xbb58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb58('0x5'))('rpc');var config=require(_0xbb58('0x6'));var jayson=require(_0xbb58('0x7'));var client=jayson[_0xbb58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27cbda,_0x323066,_0xe874f2){return new BPromise(function(_0x5d7fe8,_0xd94f1){return client[_0xbb58('0x9')](_0x27cbda,_0xe874f2)[_0xbb58('0xa')](function(_0x36ca50){logger[_0xbb58('0xb')](_0xbb58('0xc'),_0x323066,_0xbb58('0xd'));logger['debug'](_0xbb58('0xe'),_0x323066,'request\x20sent',JSON[_0xbb58('0xf')](_0x36ca50));if(_0x36ca50[_0xbb58('0x10')]){if(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x11')]===0x1f4){logger['error'](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0xd94f1(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}logger[_0xbb58('0x10')](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0x5d7fe8(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x323066,_0xbb58('0xd'));_0x5d7fe8(_0x36ca50[_0xbb58('0x13')][_0xbb58('0x12')]);}})['catch'](function(_0x5edc97){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x323066,_0x5edc97);_0xd94f1(_0x5edc97);});});}exports[_0xbb58('0x14')]=function(_0x3134ea){var _0x48f3e0=this;return new Promise(function(_0xbee66,_0x497653){return db[_0xbb58('0x15')][_0xbb58('0x16')]({'raw':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x18')]===undefined?!![]:![]:!![],'where':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')]['where']||null:null,'attributes':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x19')]||null:null,'limit':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x1a')]||null:null,'include':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x1b')]?_['map'](_0x3134ea[_0xbb58('0x17')]['include'],function(_0x21964d){return{'model':db[_0x21964d[_0xbb58('0x1c')]],'as':_0x21964d['as'],'attributes':_0x21964d[_0xbb58('0x19')],'include':_0x21964d[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x21964d[_0xbb58('0x1b')],function(_0x2d556a){return{'model':db[_0x2d556a[_0xbb58('0x1c')]],'as':_0x2d556a['as'],'attributes':_0x2d556a['attributes'],'include':_0x2d556a[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x2d556a[_0xbb58('0x1b')],function(_0x129094){return{'model':db[_0x129094[_0xbb58('0x1c')]],'as':_0x129094['as'],'attributes':_0x129094[_0xbb58('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbb58('0xa')](function(_0x2ce7c3){logger[_0xbb58('0xb')](_0xbb58('0x14'),_0x3134ea);logger[_0xbb58('0x1e')](_0xbb58('0x14'),_0x3134ea,JSON[_0xbb58('0xf')](_0x2ce7c3));_0xbee66(_0x2ce7c3);})[_0xbb58('0x1f')](function(_0x3559b6){logger['error'](_0xbb58('0x14'),_0x3559b6[_0xbb58('0x12')],_0x3134ea);_0x497653(_0x48f3e0[_0xbb58('0x10')](0x1f4,_0x3559b6[_0xbb58('0x12')]));});});};exports[_0xbb58('0x20')]=function(_0x9d379f){var _0x1ba526=this;return new Promise(function(_0x643e0e,_0x3f8db3){return db['VtigerAccount'][_0xbb58('0x21')]({'raw':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x18')]===undefined?!![]:![]:!![],'where':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x22')]||null:null,'attributes':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x19')]||null:null,'include':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x1b')]?_['map'](_0x9d379f['options']['include'],function(_0x1def9f){return{'model':db[_0x1def9f[_0xbb58('0x1c')]],'as':_0x1def9f['as'],'attributes':_0x1def9f[_0xbb58('0x19')],'include':_0x1def9f[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x1def9f[_0xbb58('0x1b')],function(_0x3093bf){return{'model':db[_0x3093bf[_0xbb58('0x1c')]],'as':_0x3093bf['as'],'attributes':_0x3093bf['attributes'],'include':_0x3093bf[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x3093bf['include'],function(_0x33ec68){return{'model':db[_0x33ec68['model']],'as':_0x33ec68['as'],'attributes':_0x33ec68[_0xbb58('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x86372e){logger[_0xbb58('0xb')]('ShowVtigerAccount',_0x9d379f);logger[_0xbb58('0x1e')](_0xbb58('0x20'),_0x9d379f,JSON[_0xbb58('0xf')](_0x86372e));_0x643e0e(_0x86372e);})[_0xbb58('0x1f')](function(_0x1b86a6){logger[_0xbb58('0x10')](_0xbb58('0x20'),_0x1b86a6[_0xbb58('0x12')],_0x9d379f);_0x3f8db3(_0x1ba526['error'](0x1f4,_0x1b86a6[_0xbb58('0x12')]));});});}; \ No newline at end of file +var _0xb58b=['model','map','debug','catch','ShowVtigerAccount','find','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../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','GetVtigerAccount','VtigerAccount','findAll','options','raw','attributes','limit','include'];(function(_0x44b827,_0x1bb1aa){var _0x527342=function(_0x481338){while(--_0x481338){_0x44b827['push'](_0x44b827['shift']());}};_0x527342(++_0x1bb1aa);}(_0xb58b,0x1f1));var _0xbb58=function(_0x55057e,_0x4d22cb){_0x55057e=_0x55057e-0x0;var _0x3237a6=_0xb58b[_0x55057e];return _0x3237a6;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var moment=require(_0xbb58('0x1'));var BPromise=require(_0xbb58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb58('0x3'));var db=require(_0xbb58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb58('0x5'))('rpc');var config=require(_0xbb58('0x6'));var jayson=require(_0xbb58('0x7'));var client=jayson[_0xbb58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27cbda,_0x323066,_0xe874f2){return new BPromise(function(_0x5d7fe8,_0xd94f1){return client[_0xbb58('0x9')](_0x27cbda,_0xe874f2)[_0xbb58('0xa')](function(_0x36ca50){logger[_0xbb58('0xb')](_0xbb58('0xc'),_0x323066,_0xbb58('0xd'));logger['debug'](_0xbb58('0xe'),_0x323066,'request\x20sent',JSON[_0xbb58('0xf')](_0x36ca50));if(_0x36ca50[_0xbb58('0x10')]){if(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x11')]===0x1f4){logger['error'](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0xd94f1(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}logger[_0xbb58('0x10')](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0x5d7fe8(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x323066,_0xbb58('0xd'));_0x5d7fe8(_0x36ca50[_0xbb58('0x13')][_0xbb58('0x12')]);}})['catch'](function(_0x5edc97){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x323066,_0x5edc97);_0xd94f1(_0x5edc97);});});}exports[_0xbb58('0x14')]=function(_0x3134ea){var _0x48f3e0=this;return new Promise(function(_0xbee66,_0x497653){return db[_0xbb58('0x15')][_0xbb58('0x16')]({'raw':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x18')]===undefined?!![]:![]:!![],'where':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')]['where']||null:null,'attributes':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x19')]||null:null,'limit':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x1a')]||null:null,'include':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x1b')]?_['map'](_0x3134ea[_0xbb58('0x17')]['include'],function(_0x21964d){return{'model':db[_0x21964d[_0xbb58('0x1c')]],'as':_0x21964d['as'],'attributes':_0x21964d[_0xbb58('0x19')],'include':_0x21964d[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x21964d[_0xbb58('0x1b')],function(_0x2d556a){return{'model':db[_0x2d556a[_0xbb58('0x1c')]],'as':_0x2d556a['as'],'attributes':_0x2d556a['attributes'],'include':_0x2d556a[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x2d556a[_0xbb58('0x1b')],function(_0x129094){return{'model':db[_0x129094[_0xbb58('0x1c')]],'as':_0x129094['as'],'attributes':_0x129094[_0xbb58('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbb58('0xa')](function(_0x2ce7c3){logger[_0xbb58('0xb')](_0xbb58('0x14'),_0x3134ea);logger[_0xbb58('0x1e')](_0xbb58('0x14'),_0x3134ea,JSON[_0xbb58('0xf')](_0x2ce7c3));_0xbee66(_0x2ce7c3);})[_0xbb58('0x1f')](function(_0x3559b6){logger['error'](_0xbb58('0x14'),_0x3559b6[_0xbb58('0x12')],_0x3134ea);_0x497653(_0x48f3e0[_0xbb58('0x10')](0x1f4,_0x3559b6[_0xbb58('0x12')]));});});};exports[_0xbb58('0x20')]=function(_0x9d379f){var _0x1ba526=this;return new Promise(function(_0x643e0e,_0x3f8db3){return db['VtigerAccount'][_0xbb58('0x21')]({'raw':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x18')]===undefined?!![]:![]:!![],'where':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x22')]||null:null,'attributes':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x19')]||null:null,'include':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x1b')]?_['map'](_0x9d379f['options']['include'],function(_0x1def9f){return{'model':db[_0x1def9f[_0xbb58('0x1c')]],'as':_0x1def9f['as'],'attributes':_0x1def9f[_0xbb58('0x19')],'include':_0x1def9f[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x1def9f[_0xbb58('0x1b')],function(_0x3093bf){return{'model':db[_0x3093bf[_0xbb58('0x1c')]],'as':_0x3093bf['as'],'attributes':_0x3093bf['attributes'],'include':_0x3093bf[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x3093bf['include'],function(_0x33ec68){return{'model':db[_0x33ec68['model']],'as':_0x33ec68['as'],'attributes':_0x33ec68[_0xbb58('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x86372e){logger[_0xbb58('0xb')]('ShowVtigerAccount',_0x9d379f);logger[_0xbb58('0x1e')](_0xbb58('0x20'),_0x9d379f,JSON[_0xbb58('0xf')](_0x86372e));_0x643e0e(_0x86372e);})[_0xbb58('0x1f')](function(_0x1b86a6){logger[_0xbb58('0x10')](_0xbb58('0x20'),_0x1b86a6[_0xbb58('0x12')],_0x9d379f);_0x3f8db3(_0x1ba526['error'](0x1f4,_0x1b86a6[_0xbb58('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 27d795c..d84b589 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 _0x2946=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports'];(function(_0x22628a,_0x27859f){var _0x3cd08e=function(_0xf39add){while(--_0xf39add){_0x22628a['push'](_0x22628a['shift']());}};_0x3cd08e(++_0x27859f);}(_0x2946,0x150));var _0x6294=function(_0x81a4f,_0x1844ce){_0x81a4f=_0x81a4f-0x0;var _0x18a7e9=_0x2946[_0x81a4f];return _0x18a7e9;};'use strict';var multer=require(_0x6294('0x0'));var util=require(_0x6294('0x1'));var path=require(_0x6294('0x2'));var timeout=require(_0x6294('0x3'));var express=require('express');var router=express[_0x6294('0x4')]();var fs_extra=require(_0x6294('0x5'));var auth=require(_0x6294('0x6'));var interaction=require(_0x6294('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0x6294('0x8')]('/',auth[_0x6294('0x9')](),controller[_0x6294('0xa')]);router[_0x6294('0x8')]('/:id',auth[_0x6294('0x9')](),controller[_0x6294('0xb')]);router['get'](_0x6294('0xc'),auth[_0x6294('0x9')](),controller[_0x6294('0xd')]);router[_0x6294('0x8')](_0x6294('0xe'),auth[_0x6294('0x9')](),controller[_0x6294('0xf')]);router[_0x6294('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x6294('0x10')]);router[_0x6294('0x11')]('/',auth[_0x6294('0x9')](),controller[_0x6294('0x12')]);router[_0x6294('0x13')]('/:id',auth[_0x6294('0x9')](),controller[_0x6294('0x14')]);router[_0x6294('0x15')]('/:id',auth[_0x6294('0x9')](),controller[_0x6294('0x16')]);module[_0x6294('0x17')]=router; \ No newline at end of file +var _0x4537=['Router','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','index','get','isAuthenticated','show','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','/:id','destroy','exports','multer','util','path'];(function(_0x5119ff,_0x1e49d3){var _0x29b31c=function(_0x10934c){while(--_0x10934c){_0x5119ff['push'](_0x5119ff['shift']());}};_0x29b31c(++_0x1e49d3);}(_0x4537,0x129));var _0x7453=function(_0x373852,_0x1f1965){_0x373852=_0x373852-0x0;var _0xdb9536=_0x4537[_0x373852];return _0xdb9536;};'use strict';var multer=require(_0x7453('0x0'));var util=require(_0x7453('0x1'));var path=require(_0x7453('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7453('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7453('0x4'));var interaction=require(_0x7453('0x5'));var config=require('../../config/environment');var controller=require(_0x7453('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7453('0x7')]);router[_0x7453('0x8')]('/:id',auth[_0x7453('0x9')](),controller[_0x7453('0xa')]);router[_0x7453('0x8')]('/:id/fields',auth[_0x7453('0x9')](),controller[_0x7453('0xb')]);router[_0x7453('0x8')](_0x7453('0xc'),auth[_0x7453('0x9')](),controller[_0x7453('0xd')]);router[_0x7453('0x8')]('/:id/descriptions',auth[_0x7453('0x9')](),controller[_0x7453('0xe')]);router['post']('/',auth[_0x7453('0x9')](),controller[_0x7453('0xf')]);router[_0x7453('0x10')]('/:id',auth[_0x7453('0x9')](),controller['update']);router['delete'](_0x7453('0x11'),auth[_0x7453('0x9')](),controller[_0x7453('0x12')]);module[_0x7453('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index c82b179..c53cdde 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 _0x3ca0=['exports','STRING','sequelize'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x3ca0,0x98));var _0x03ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ca0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x03ca('0x0'));module[_0x03ca('0x1')]={'name':{'type':Sequelize[_0x03ca('0x2')]},'description':{'type':Sequelize[_0x03ca('0x2')]}}; \ No newline at end of file +var _0x2cae=['sequelize','exports','STRING'];(function(_0x319250,_0x5d3896){var _0x1f2590=function(_0x17c347){while(--_0x17c347){_0x319250['push'](_0x319250['shift']());}};_0x1f2590(++_0x5d3896);}(_0x2cae,0xb4));var _0xe2ca=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0x2cae[_0x5cb97e];return _0x1714b4;};'use strict';var Sequelize=require(_0xe2ca('0x0'));module[_0xe2ca('0x1')]={'name':{'type':Sequelize[_0xe2ca('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 2e14845..568212d 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 _0x3cb7=['hasOwnProperty','nolimit','getDescriptions','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','sendStatus','error','send','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','create','body','getFields','VtigerField','getSubjects'];(function(_0x371649,_0x93c727){var _0x4ecd30=function(_0x33ef93){while(--_0x33ef93){_0x371649['push'](_0x371649['shift']());}};_0x4ecd30(++_0x93c727);}(_0x3cb7,0x1a8));var _0x73cb=function(_0x456a84,_0x46bc0b){_0x456a84=_0x456a84-0x0;var _0x1117d6=_0x3cb7[_0x456a84];return _0x1117d6;};'use strict';var emlformat=require(_0x73cb('0x0'));var rimraf=require(_0x73cb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x73cb('0x2'));var rp=require(_0x73cb('0x3'));var moment=require(_0x73cb('0x4'));var BPromise=require(_0x73cb('0x5'));var Mustache=require(_0x73cb('0x6'));var util=require('util');var path=require(_0x73cb('0x7'));var sox=require('sox');var csv=require(_0x73cb('0x8'));var ejs=require(_0x73cb('0x9'));var fs=require('fs');var fs_extra=require(_0x73cb('0xa'));var _=require(_0x73cb('0xb'));var squel=require(_0x73cb('0xc'));var crypto=require(_0x73cb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x73cb('0xe'));var toCsv=require(_0x73cb('0x8'));var querystring=require(_0x73cb('0xf'));var Papa=require(_0x73cb('0x10'));var Redis=require(_0x73cb('0x11'));var authService=require(_0x73cb('0x12'));var qs=require(_0x73cb('0x13'));var as=require(_0x73cb('0x14'));var hardwareService=require(_0x73cb('0x15'));var logger=require(_0x73cb('0x16'))(_0x73cb('0x17'));var utils=require(_0x73cb('0x18'));var config=require(_0x73cb('0x19'));var licenseUtil=require(_0x73cb('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e0d79,_0x3ff5c5){_0x3ff5c5=_0x3ff5c5||0xcc;return function(_0xcb7fd2){if(_0xcb7fd2){return _0x1e0d79['sendStatus'](_0x3ff5c5);}return _0x1e0d79['status'](_0x3ff5c5)[_0x73cb('0x1b')]();};}function respondWithResult(_0x32c009,_0x423a56){_0x423a56=_0x423a56||0xc8;return function(_0x554e20){if(_0x554e20){return _0x32c009[_0x73cb('0x1c')](_0x423a56)[_0x73cb('0x1d')](_0x554e20);}};}function respondWithFilteredResult(_0x53f53e,_0x1a1a8d){return function(_0x59c935){if(_0x59c935){var _0x32f167=typeof _0x1a1a8d[_0x73cb('0x1e')]===_0x73cb('0x1f')&&typeof _0x1a1a8d['limit']===_0x73cb('0x1f');var _0x487751=_0x59c935[_0x73cb('0x20')];var _0x1b2a83=_0x32f167?0x0:_0x1a1a8d[_0x73cb('0x1e')];var _0x5d5df4=_0x32f167?_0x59c935[_0x73cb('0x20')]:_0x1a1a8d[_0x73cb('0x1e')]+_0x1a1a8d[_0x73cb('0x21')];var _0x17d583;if(_0x5d5df4>=_0x487751){_0x5d5df4=_0x487751;_0x17d583=0xc8;}else{_0x17d583=0xce;}_0x53f53e['status'](_0x17d583);return _0x53f53e[_0x73cb('0x22')](_0x73cb('0x23'),_0x1b2a83+'-'+_0x5d5df4+'/'+_0x487751)[_0x73cb('0x1d')](_0x59c935);}return null;};}function patchUpdates(_0xebd7f8){return function(_0x3a7710){try{jsonpatch[_0x73cb('0x24')](_0x3a7710,_0xebd7f8,!![]);}catch(_0x590cea){return BPromise[_0x73cb('0x25')](_0x590cea);}return _0x3a7710[_0x73cb('0x26')]();};}function saveUpdates(_0x55c4bb,_0x5ee010){return function(_0x5a030e){if(_0x5a030e){return _0x5a030e['update'](_0x55c4bb)['then'](function(_0x310013){return _0x310013;});}return null;};}function removeEntity(_0x3bc73a,_0x459da4){return function(_0x489db3){if(_0x489db3){return _0x489db3[_0x73cb('0x27')]()[_0x73cb('0x28')](function(){_0x3bc73a[_0x73cb('0x1c')](0xcc)[_0x73cb('0x1b')]();});}};}function handleEntityNotFound(_0x263dd6,_0x28cac5){return function(_0x58eb8a){if(!_0x58eb8a){_0x263dd6[_0x73cb('0x29')](0x194);}return _0x58eb8a;};}function handleError(_0xd7aa1a,_0x55d725){_0x55d725=_0x55d725||0x1f4;return function(_0x1981ae){logger[_0x73cb('0x2a')](_0x1981ae['stack']);if(_0x1981ae['name']){delete _0x1981ae['name'];}_0xd7aa1a[_0x73cb('0x1c')](_0x55d725)[_0x73cb('0x2b')](_0x1981ae);};}exports['index']=function(_0x1834db,_0x4dca3d){var _0x350820={},_0x2cd5a2={},_0x175be6={'count':0x0,'rows':[]};var _0x8fc620=_[_0x73cb('0x2c')](db[_0x73cb('0x2d')][_0x73cb('0x2e')],function(_0x3126d3){return{'name':_0x3126d3[_0x73cb('0x2f')],'type':_0x3126d3[_0x73cb('0x30')][_0x73cb('0x31')]};});_0x2cd5a2[_0x73cb('0x32')]=_[_0x73cb('0x2c')](_0x8fc620,_0x73cb('0x33'));_0x2cd5a2['query']=_['keys'](_0x1834db[_0x73cb('0x34')]);_0x2cd5a2[_0x73cb('0x35')]=_[_0x73cb('0x36')](_0x2cd5a2['model'],_0x2cd5a2['query']);_0x350820['attributes']=_[_0x73cb('0x36')](_0x2cd5a2[_0x73cb('0x32')],qs[_0x73cb('0x37')](_0x1834db['query'][_0x73cb('0x37')]));_0x350820[_0x73cb('0x38')]=_0x350820[_0x73cb('0x38')]['length']?_0x350820[_0x73cb('0x38')]:_0x2cd5a2['model'];if(!_0x1834db[_0x73cb('0x34')]['hasOwnProperty']('nolimit')){_0x350820[_0x73cb('0x21')]=qs['limit'](_0x1834db[_0x73cb('0x34')][_0x73cb('0x21')]);_0x350820[_0x73cb('0x1e')]=qs[_0x73cb('0x1e')](_0x1834db['query']['offset']);}_0x350820[_0x73cb('0x39')]=qs[_0x73cb('0x3a')](_0x1834db[_0x73cb('0x34')][_0x73cb('0x3a')]);_0x350820[_0x73cb('0x3b')]=qs[_0x73cb('0x35')](_[_0x73cb('0x3c')](_0x1834db[_0x73cb('0x34')],_0x2cd5a2['filters']),_0x8fc620);if(_0x1834db[_0x73cb('0x34')][_0x73cb('0x3d')]){_0x350820[_0x73cb('0x3b')]=_[_0x73cb('0x3e')](_0x350820[_0x73cb('0x3b')],{'$or':_[_0x73cb('0x2c')](_0x8fc620,function(_0x3e24b2){if(_0x3e24b2['type']!==_0x73cb('0x3f')){var _0xeef2f9={};_0xeef2f9[_0x3e24b2[_0x73cb('0x33')]]={'$like':'%'+_0x1834db['query']['filter']+'%'};return _0xeef2f9;}})});}_0x350820=_[_0x73cb('0x3e')]({},_0x350820,_0x1834db['options']);var _0x40fa73={'where':_0x350820[_0x73cb('0x3b')]};return db[_0x73cb('0x2d')]['count'](_0x40fa73)[_0x73cb('0x28')](function(_0x5b210d){_0x175be6[_0x73cb('0x20')]=_0x5b210d;if(_0x1834db[_0x73cb('0x34')][_0x73cb('0x40')]){_0x350820[_0x73cb('0x41')]=[{'all':!![]}];}return db[_0x73cb('0x2d')][_0x73cb('0x42')](_0x350820);})[_0x73cb('0x28')](function(_0x2a2ccb){_0x175be6[_0x73cb('0x43')]=_0x2a2ccb;return _0x175be6;})[_0x73cb('0x28')](respondWithFilteredResult(_0x4dca3d,_0x350820))[_0x73cb('0x44')](handleError(_0x4dca3d,null));};exports[_0x73cb('0x45')]=function(_0x299fc6,_0xd49ea4){var _0x6f06c5={'raw':![],'where':{'id':_0x299fc6[_0x73cb('0x46')]['id']}},_0x3c7e57={};_0x3c7e57[_0x73cb('0x32')]=_['keys'](db['VtigerConfiguration'][_0x73cb('0x2e')]);_0x3c7e57[_0x73cb('0x34')]=_[_0x73cb('0x47')](_0x299fc6[_0x73cb('0x34')]);_0x3c7e57[_0x73cb('0x35')]=_[_0x73cb('0x36')](_0x3c7e57[_0x73cb('0x32')],_0x3c7e57[_0x73cb('0x34')]);_0x6f06c5[_0x73cb('0x38')]=_[_0x73cb('0x36')](_0x3c7e57[_0x73cb('0x32')],qs['fields'](_0x299fc6[_0x73cb('0x34')][_0x73cb('0x37')]));_0x6f06c5[_0x73cb('0x38')]=_0x6f06c5[_0x73cb('0x38')][_0x73cb('0x48')]?_0x6f06c5[_0x73cb('0x38')]:_0x3c7e57[_0x73cb('0x32')];if(_0x299fc6[_0x73cb('0x34')][_0x73cb('0x40')]){_0x6f06c5[_0x73cb('0x41')]=[{'all':!![]}];}_0x6f06c5=_[_0x73cb('0x3e')]({},_0x6f06c5,_0x299fc6[_0x73cb('0x49')]);return db[_0x73cb('0x2d')][_0x73cb('0x4a')](_0x6f06c5)[_0x73cb('0x28')](handleEntityNotFound(_0xd49ea4,null))[_0x73cb('0x28')](respondWithResult(_0xd49ea4,null))[_0x73cb('0x44')](handleError(_0xd49ea4,null));};exports[_0x73cb('0x4b')]=function(_0xd562f6,_0x4a60ac){return db[_0x73cb('0x2d')][_0x73cb('0x4b')](_0xd562f6[_0x73cb('0x4c')],{})['then'](respondWithResult(_0x4a60ac,0xc9))[_0x73cb('0x44')](handleError(_0x4a60ac,null));};exports['update']=function(_0x554038,_0x15c211){if(_0x554038[_0x73cb('0x4c')]['id']){delete _0x554038[_0x73cb('0x4c')]['id'];}return db['VtigerConfiguration'][_0x73cb('0x4a')]({'where':{'id':_0x554038['params']['id']}})[_0x73cb('0x28')](handleEntityNotFound(_0x15c211,null))[_0x73cb('0x28')](saveUpdates(_0x554038['body'],null))[_0x73cb('0x28')](respondWithResult(_0x15c211,null))[_0x73cb('0x44')](handleError(_0x15c211,null));};exports[_0x73cb('0x27')]=function(_0x1c9824,_0x33d847){return db[_0x73cb('0x2d')][_0x73cb('0x4a')]({'where':{'id':_0x1c9824['params']['id']}})[_0x73cb('0x28')](handleEntityNotFound(_0x33d847,null))[_0x73cb('0x28')](removeEntity(_0x33d847,null))[_0x73cb('0x44')](handleError(_0x33d847,null));};exports[_0x73cb('0x4d')]=function(_0x50c852,_0xa909fe,_0x5a56e2){var _0x370374={};var _0x4e3249={};var _0x27f4c2;var _0x259996;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x50c852[_0x73cb('0x46')]['id']}})['then'](handleEntityNotFound(_0xa909fe,null))['then'](function(_0x1894f5){if(_0x1894f5){_0x27f4c2=_0x1894f5;_0x4e3249['model']=_[_0x73cb('0x47')](db[_0x73cb('0x4e')][_0x73cb('0x2e')]);_0x4e3249['query']=_[_0x73cb('0x47')](_0x50c852[_0x73cb('0x34')]);_0x4e3249[_0x73cb('0x35')]=_[_0x73cb('0x36')](_0x4e3249[_0x73cb('0x32')],_0x4e3249['query']);_0x370374[_0x73cb('0x38')]=_[_0x73cb('0x36')](_0x4e3249[_0x73cb('0x32')],qs[_0x73cb('0x37')](_0x50c852[_0x73cb('0x34')]['fields']));_0x370374['attributes']=_0x370374[_0x73cb('0x38')][_0x73cb('0x48')]?_0x370374['attributes']:_0x4e3249[_0x73cb('0x32')];_0x370374[_0x73cb('0x39')]=qs[_0x73cb('0x3a')](_0x50c852[_0x73cb('0x34')][_0x73cb('0x3a')]);_0x370374[_0x73cb('0x3b')]=qs[_0x73cb('0x35')](_['pick'](_0x50c852['query'],_0x4e3249[_0x73cb('0x35')]));if(_0x50c852['query'][_0x73cb('0x3d')]){_0x370374[_0x73cb('0x3b')]=_[_0x73cb('0x3e')](_0x370374[_0x73cb('0x3b')],{'$or':_[_0x73cb('0x2c')](_0x370374['attributes'],function(_0x186703){var _0x4e091f={};_0x4e091f[_0x186703]={'$like':'%'+_0x50c852['query'][_0x73cb('0x3d')]+'%'};return _0x4e091f;})});}_0x370374=_[_0x73cb('0x3e')]({},_0x370374,_0x50c852['options']);return _0x27f4c2['getFields'](_0x370374);}})[_0x73cb('0x28')](function(_0x4955a5){if(_0x4955a5){_0x259996=_0x4955a5['length'];if(!_0x50c852[_0x73cb('0x34')]['hasOwnProperty']('nolimit')){_0x370374[_0x73cb('0x21')]=qs[_0x73cb('0x21')](_0x50c852[_0x73cb('0x34')]['limit']);_0x370374['offset']=qs[_0x73cb('0x1e')](_0x50c852[_0x73cb('0x34')][_0x73cb('0x1e')]);}return _0x27f4c2[_0x73cb('0x4d')](_0x370374);}})[_0x73cb('0x28')](function(_0x214e28){if(_0x214e28){return _0x214e28?{'count':_0x259996,'rows':_0x214e28}:null;}})[_0x73cb('0x28')](respondWithResult(_0xa909fe,null))[_0x73cb('0x44')](handleError(_0xa909fe,null));};exports['getSubjects']=function(_0x2cc6a2,_0x45055b,_0x5903ce){var _0x10c535={};var _0x2fd5c3={};var _0x430673;var _0xe5b0d6;return db[_0x73cb('0x2d')]['findOne']({'where':{'id':_0x2cc6a2[_0x73cb('0x46')]['id']}})[_0x73cb('0x28')](handleEntityNotFound(_0x45055b,null))[_0x73cb('0x28')](function(_0x1adbc2){if(_0x1adbc2){_0x430673=_0x1adbc2;_0x2fd5c3[_0x73cb('0x32')]=_[_0x73cb('0x47')](db[_0x73cb('0x4e')][_0x73cb('0x2e')]);_0x2fd5c3[_0x73cb('0x34')]=_[_0x73cb('0x47')](_0x2cc6a2['query']);_0x2fd5c3[_0x73cb('0x35')]=_[_0x73cb('0x36')](_0x2fd5c3[_0x73cb('0x32')],_0x2fd5c3[_0x73cb('0x34')]);_0x10c535[_0x73cb('0x38')]=_[_0x73cb('0x36')](_0x2fd5c3['model'],qs[_0x73cb('0x37')](_0x2cc6a2[_0x73cb('0x34')]['fields']));_0x10c535[_0x73cb('0x38')]=_0x10c535[_0x73cb('0x38')][_0x73cb('0x48')]?_0x10c535[_0x73cb('0x38')]:_0x2fd5c3['model'];_0x10c535[_0x73cb('0x39')]=qs[_0x73cb('0x3a')](_0x2cc6a2[_0x73cb('0x34')][_0x73cb('0x3a')]);_0x10c535[_0x73cb('0x3b')]=qs['filters'](_[_0x73cb('0x3c')](_0x2cc6a2['query'],_0x2fd5c3[_0x73cb('0x35')]));if(_0x2cc6a2[_0x73cb('0x34')][_0x73cb('0x3d')]){_0x10c535[_0x73cb('0x3b')]=_[_0x73cb('0x3e')](_0x10c535[_0x73cb('0x3b')],{'$or':_[_0x73cb('0x2c')](_0x10c535[_0x73cb('0x38')],function(_0x1f2f33){var _0x40e323={};_0x40e323[_0x1f2f33]={'$like':'%'+_0x2cc6a2['query'][_0x73cb('0x3d')]+'%'};return _0x40e323;})});}_0x10c535=_[_0x73cb('0x3e')]({},_0x10c535,_0x2cc6a2['options']);return _0x430673[_0x73cb('0x4f')](_0x10c535);}})['then'](function(_0x80490){if(_0x80490){_0xe5b0d6=_0x80490[_0x73cb('0x48')];if(!_0x2cc6a2[_0x73cb('0x34')][_0x73cb('0x50')](_0x73cb('0x51'))){_0x10c535[_0x73cb('0x21')]=qs[_0x73cb('0x21')](_0x2cc6a2[_0x73cb('0x34')][_0x73cb('0x21')]);_0x10c535[_0x73cb('0x1e')]=qs[_0x73cb('0x1e')](_0x2cc6a2['query'][_0x73cb('0x1e')]);}return _0x430673[_0x73cb('0x4f')](_0x10c535);}})[_0x73cb('0x28')](function(_0x457fad){if(_0x457fad){return _0x457fad?{'count':_0xe5b0d6,'rows':_0x457fad}:null;}})['then'](respondWithResult(_0x45055b,null))[_0x73cb('0x44')](handleError(_0x45055b,null));};exports[_0x73cb('0x52')]=function(_0x4897c5,_0x1057ec,_0x3dd864){var _0x5d3368={};var _0x2dca01={};var _0x395248;var _0xd512fb;return db[_0x73cb('0x2d')][_0x73cb('0x53')]({'where':{'id':_0x4897c5[_0x73cb('0x46')]['id']}})[_0x73cb('0x28')](handleEntityNotFound(_0x1057ec,null))[_0x73cb('0x28')](function(_0x2a34ec){if(_0x2a34ec){_0x395248=_0x2a34ec;_0x2dca01['model']=_[_0x73cb('0x47')](db[_0x73cb('0x4e')][_0x73cb('0x2e')]);_0x2dca01[_0x73cb('0x34')]=_[_0x73cb('0x47')](_0x4897c5[_0x73cb('0x34')]);_0x2dca01[_0x73cb('0x35')]=_[_0x73cb('0x36')](_0x2dca01['model'],_0x2dca01['query']);_0x5d3368[_0x73cb('0x38')]=_['intersection'](_0x2dca01[_0x73cb('0x32')],qs[_0x73cb('0x37')](_0x4897c5[_0x73cb('0x34')][_0x73cb('0x37')]));_0x5d3368[_0x73cb('0x38')]=_0x5d3368[_0x73cb('0x38')]['length']?_0x5d3368[_0x73cb('0x38')]:_0x2dca01[_0x73cb('0x32')];_0x5d3368['order']=qs[_0x73cb('0x3a')](_0x4897c5[_0x73cb('0x34')][_0x73cb('0x3a')]);_0x5d3368[_0x73cb('0x3b')]=qs[_0x73cb('0x35')](_[_0x73cb('0x3c')](_0x4897c5[_0x73cb('0x34')],_0x2dca01[_0x73cb('0x35')]));if(_0x4897c5['query'][_0x73cb('0x3d')]){_0x5d3368['where']=_[_0x73cb('0x3e')](_0x5d3368[_0x73cb('0x3b')],{'$or':_[_0x73cb('0x2c')](_0x5d3368[_0x73cb('0x38')],function(_0x4d2dfd){var _0x18e647={};_0x18e647[_0x4d2dfd]={'$like':'%'+_0x4897c5[_0x73cb('0x34')][_0x73cb('0x3d')]+'%'};return _0x18e647;})});}_0x5d3368=_[_0x73cb('0x3e')]({},_0x5d3368,_0x4897c5[_0x73cb('0x49')]);return _0x395248[_0x73cb('0x52')](_0x5d3368);}})[_0x73cb('0x28')](function(_0x20bd25){if(_0x20bd25){_0xd512fb=_0x20bd25[_0x73cb('0x48')];if(!_0x4897c5[_0x73cb('0x34')][_0x73cb('0x50')]('nolimit')){_0x5d3368[_0x73cb('0x21')]=qs[_0x73cb('0x21')](_0x4897c5['query'][_0x73cb('0x21')]);_0x5d3368[_0x73cb('0x1e')]=qs[_0x73cb('0x1e')](_0x4897c5[_0x73cb('0x34')][_0x73cb('0x1e')]);}return _0x395248['getDescriptions'](_0x5d3368);}})[_0x73cb('0x28')](function(_0x45e3c5){if(_0x45e3c5){return _0x45e3c5?{'count':_0xd512fb,'rows':_0x45e3c5}:null;}})['then'](respondWithResult(_0x1057ec,null))['catch'](handleError(_0x1057ec,null));}; \ No newline at end of file +var _0xa109=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','options','where','count','include','findAll','rows','catch','params','keys','length','includeAll','merge','find','create','body','destroy','findOne','VtigerField','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','set','Content-Range','json','apply','update','then','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','type','key','model','query','filters'];(function(_0x596c2e,_0x1f49e0){var _0x10ff6c=function(_0x712f24){while(--_0x712f24){_0x596c2e['push'](_0x596c2e['shift']());}};_0x10ff6c(++_0x1f49e0);}(_0xa109,0x1b9));var _0x9a10=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa109[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x9a10('0x0'));var rimraf=require(_0x9a10('0x1'));var zipdir=require(_0x9a10('0x2'));var jsonpatch=require(_0x9a10('0x3'));var rp=require(_0x9a10('0x4'));var moment=require('moment');var BPromise=require(_0x9a10('0x5'));var Mustache=require(_0x9a10('0x6'));var util=require(_0x9a10('0x7'));var path=require(_0x9a10('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9a10('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9a10('0xa'));var crypto=require(_0x9a10('0xb'));var jsforce=require(_0x9a10('0xc'));var deskjs=require(_0x9a10('0xd'));var toCsv=require(_0x9a10('0xe'));var querystring=require(_0x9a10('0xf'));var Papa=require(_0x9a10('0x10'));var Redis=require(_0x9a10('0x11'));var authService=require(_0x9a10('0x12'));var qs=require(_0x9a10('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a10('0x14'));var logger=require('../../config/logger')(_0x9a10('0x15'));var utils=require(_0x9a10('0x16'));var config=require(_0x9a10('0x17'));var licenseUtil=require(_0x9a10('0x18'));var db=require(_0x9a10('0x19'))['db'];function respondWithStatusCode(_0x45d54f,_0x4f3f48){_0x4f3f48=_0x4f3f48||0xcc;return function(_0x2c40c5){if(_0x2c40c5){return _0x45d54f[_0x9a10('0x1a')](_0x4f3f48);}return _0x45d54f[_0x9a10('0x1b')](_0x4f3f48)[_0x9a10('0x1c')]();};}function respondWithResult(_0x155fd9,_0xef2b6b){_0xef2b6b=_0xef2b6b||0xc8;return function(_0x54aea9){if(_0x54aea9){return _0x155fd9[_0x9a10('0x1b')](_0xef2b6b)['json'](_0x54aea9);}};}function respondWithFilteredResult(_0x5d9cce,_0x100465){return function(_0x496b4c){if(_0x496b4c){var _0x29ffb4=typeof _0x100465[_0x9a10('0x1d')]==='undefined'&&typeof _0x100465[_0x9a10('0x1e')]===_0x9a10('0x1f');var _0x2888fd=_0x496b4c['count'];var _0x186c94=_0x29ffb4?0x0:_0x100465[_0x9a10('0x1d')];var _0x59d72c=_0x29ffb4?_0x496b4c['count']:_0x100465[_0x9a10('0x1d')]+_0x100465['limit'];var _0x3e8169;if(_0x59d72c>=_0x2888fd){_0x59d72c=_0x2888fd;_0x3e8169=0xc8;}else{_0x3e8169=0xce;}_0x5d9cce[_0x9a10('0x1b')](_0x3e8169);return _0x5d9cce[_0x9a10('0x20')](_0x9a10('0x21'),_0x186c94+'-'+_0x59d72c+'/'+_0x2888fd)[_0x9a10('0x22')](_0x496b4c);}return null;};}function patchUpdates(_0x5bea4d){return function(_0x465c19){try{jsonpatch[_0x9a10('0x23')](_0x465c19,_0x5bea4d,!![]);}catch(_0x4b5f74){return BPromise['reject'](_0x4b5f74);}return _0x465c19['save']();};}function saveUpdates(_0x4158cb,_0x1790ce){return function(_0x2c1eab){if(_0x2c1eab){return _0x2c1eab[_0x9a10('0x24')](_0x4158cb)[_0x9a10('0x25')](function(_0x407df7){return _0x407df7;});}return null;};}function removeEntity(_0x175286,_0x5ec745){return function(_0x447da5){if(_0x447da5){return _0x447da5['destroy']()['then'](function(){_0x175286['status'](0xcc)[_0x9a10('0x1c')]();});}};}function handleEntityNotFound(_0x2b725f,_0x8f4dc3){return function(_0x377556){if(!_0x377556){_0x2b725f[_0x9a10('0x1a')](0x194);}return _0x377556;};}function handleError(_0x329772,_0x488caf){_0x488caf=_0x488caf||0x1f4;return function(_0xad4bf2){logger[_0x9a10('0x26')](_0xad4bf2[_0x9a10('0x27')]);if(_0xad4bf2[_0x9a10('0x28')]){delete _0xad4bf2[_0x9a10('0x28')];}_0x329772[_0x9a10('0x1b')](_0x488caf)[_0x9a10('0x29')](_0xad4bf2);};}exports[_0x9a10('0x2a')]=function(_0x1cddfc,_0x457cbe){var _0x19a03e={},_0x16a04e={},_0xe576e8={'count':0x0,'rows':[]};var _0x21e441=_[_0x9a10('0x2b')](db[_0x9a10('0x2c')][_0x9a10('0x2d')],function(_0x161bb9){return{'name':_0x161bb9['fieldName'],'type':_0x161bb9[_0x9a10('0x2e')][_0x9a10('0x2f')]};});_0x16a04e[_0x9a10('0x30')]=_[_0x9a10('0x2b')](_0x21e441,_0x9a10('0x28'));_0x16a04e[_0x9a10('0x31')]=_['keys'](_0x1cddfc['query']);_0x16a04e[_0x9a10('0x32')]=_[_0x9a10('0x33')](_0x16a04e['model'],_0x16a04e['query']);_0x19a03e[_0x9a10('0x34')]=_[_0x9a10('0x33')](_0x16a04e[_0x9a10('0x30')],qs[_0x9a10('0x35')](_0x1cddfc[_0x9a10('0x31')][_0x9a10('0x35')]));_0x19a03e[_0x9a10('0x34')]=_0x19a03e[_0x9a10('0x34')]['length']?_0x19a03e['attributes']:_0x16a04e[_0x9a10('0x30')];if(!_0x1cddfc['query'][_0x9a10('0x36')](_0x9a10('0x37'))){_0x19a03e[_0x9a10('0x1e')]=qs[_0x9a10('0x1e')](_0x1cddfc[_0x9a10('0x31')]['limit']);_0x19a03e['offset']=qs[_0x9a10('0x1d')](_0x1cddfc[_0x9a10('0x31')]['offset']);}_0x19a03e[_0x9a10('0x38')]=qs[_0x9a10('0x39')](_0x1cddfc['query'][_0x9a10('0x39')]);_0x19a03e['where']=qs[_0x9a10('0x32')](_[_0x9a10('0x3a')](_0x1cddfc['query'],_0x16a04e[_0x9a10('0x32')]),_0x21e441);if(_0x1cddfc[_0x9a10('0x31')][_0x9a10('0x3b')]){_0x19a03e['where']=_['merge'](_0x19a03e['where'],{'$or':_[_0x9a10('0x2b')](_0x21e441,function(_0x3e2b9a){if(_0x3e2b9a[_0x9a10('0x2e')]!==_0x9a10('0x3c')){var _0x544c19={};_0x544c19[_0x3e2b9a[_0x9a10('0x28')]]={'$like':'%'+_0x1cddfc[_0x9a10('0x31')][_0x9a10('0x3b')]+'%'};return _0x544c19;}})});}_0x19a03e=_['merge']({},_0x19a03e,_0x1cddfc[_0x9a10('0x3d')]);var _0x428ada={'where':_0x19a03e[_0x9a10('0x3e')]};return db[_0x9a10('0x2c')][_0x9a10('0x3f')](_0x428ada)[_0x9a10('0x25')](function(_0x7c2d38){_0xe576e8[_0x9a10('0x3f')]=_0x7c2d38;if(_0x1cddfc['query']['includeAll']){_0x19a03e[_0x9a10('0x40')]=[{'all':!![]}];}return db[_0x9a10('0x2c')][_0x9a10('0x41')](_0x19a03e);})[_0x9a10('0x25')](function(_0x3c35e7){_0xe576e8[_0x9a10('0x42')]=_0x3c35e7;return _0xe576e8;})[_0x9a10('0x25')](respondWithFilteredResult(_0x457cbe,_0x19a03e))[_0x9a10('0x43')](handleError(_0x457cbe,null));};exports['show']=function(_0xa2b24,_0xc93ad5){var _0x4cd276={'raw':![],'where':{'id':_0xa2b24[_0x9a10('0x44')]['id']}},_0x500679={};_0x500679['model']=_[_0x9a10('0x45')](db[_0x9a10('0x2c')][_0x9a10('0x2d')]);_0x500679[_0x9a10('0x31')]=_['keys'](_0xa2b24[_0x9a10('0x31')]);_0x500679[_0x9a10('0x32')]=_[_0x9a10('0x33')](_0x500679[_0x9a10('0x30')],_0x500679[_0x9a10('0x31')]);_0x4cd276['attributes']=_[_0x9a10('0x33')](_0x500679[_0x9a10('0x30')],qs[_0x9a10('0x35')](_0xa2b24[_0x9a10('0x31')][_0x9a10('0x35')]));_0x4cd276['attributes']=_0x4cd276[_0x9a10('0x34')][_0x9a10('0x46')]?_0x4cd276['attributes']:_0x500679[_0x9a10('0x30')];if(_0xa2b24[_0x9a10('0x31')][_0x9a10('0x47')]){_0x4cd276[_0x9a10('0x40')]=[{'all':!![]}];}_0x4cd276=_[_0x9a10('0x48')]({},_0x4cd276,_0xa2b24[_0x9a10('0x3d')]);return db[_0x9a10('0x2c')][_0x9a10('0x49')](_0x4cd276)[_0x9a10('0x25')](handleEntityNotFound(_0xc93ad5,null))[_0x9a10('0x25')](respondWithResult(_0xc93ad5,null))['catch'](handleError(_0xc93ad5,null));};exports[_0x9a10('0x4a')]=function(_0x3a31b8,_0x1e18c8){return db['VtigerConfiguration'][_0x9a10('0x4a')](_0x3a31b8[_0x9a10('0x4b')],{})[_0x9a10('0x25')](respondWithResult(_0x1e18c8,0xc9))[_0x9a10('0x43')](handleError(_0x1e18c8,null));};exports[_0x9a10('0x24')]=function(_0x26e124,_0x2fad99){if(_0x26e124['body']['id']){delete _0x26e124['body']['id'];}return db['VtigerConfiguration'][_0x9a10('0x49')]({'where':{'id':_0x26e124[_0x9a10('0x44')]['id']}})[_0x9a10('0x25')](handleEntityNotFound(_0x2fad99,null))[_0x9a10('0x25')](saveUpdates(_0x26e124['body'],null))[_0x9a10('0x25')](respondWithResult(_0x2fad99,null))[_0x9a10('0x43')](handleError(_0x2fad99,null));};exports[_0x9a10('0x4c')]=function(_0x3570f7,_0xd029a3){return db['VtigerConfiguration'][_0x9a10('0x49')]({'where':{'id':_0x3570f7[_0x9a10('0x44')]['id']}})[_0x9a10('0x25')](handleEntityNotFound(_0xd029a3,null))[_0x9a10('0x25')](removeEntity(_0xd029a3,null))[_0x9a10('0x43')](handleError(_0xd029a3,null));};exports['getFields']=function(_0xf7bb8c,_0x470761,_0x1ff718){var _0x525f5b={};var _0xcaf944={};var _0x120fed;var _0x18a637;return db[_0x9a10('0x2c')][_0x9a10('0x4d')]({'where':{'id':_0xf7bb8c[_0x9a10('0x44')]['id']}})['then'](handleEntityNotFound(_0x470761,null))[_0x9a10('0x25')](function(_0x1f618f){if(_0x1f618f){_0x120fed=_0x1f618f;_0xcaf944['model']=_[_0x9a10('0x45')](db[_0x9a10('0x4e')][_0x9a10('0x2d')]);_0xcaf944[_0x9a10('0x31')]=_[_0x9a10('0x45')](_0xf7bb8c[_0x9a10('0x31')]);_0xcaf944[_0x9a10('0x32')]=_[_0x9a10('0x33')](_0xcaf944[_0x9a10('0x30')],_0xcaf944[_0x9a10('0x31')]);_0x525f5b[_0x9a10('0x34')]=_['intersection'](_0xcaf944[_0x9a10('0x30')],qs[_0x9a10('0x35')](_0xf7bb8c[_0x9a10('0x31')][_0x9a10('0x35')]));_0x525f5b[_0x9a10('0x34')]=_0x525f5b['attributes']['length']?_0x525f5b[_0x9a10('0x34')]:_0xcaf944[_0x9a10('0x30')];_0x525f5b[_0x9a10('0x38')]=qs['sort'](_0xf7bb8c[_0x9a10('0x31')][_0x9a10('0x39')]);_0x525f5b[_0x9a10('0x3e')]=qs['filters'](_[_0x9a10('0x3a')](_0xf7bb8c[_0x9a10('0x31')],_0xcaf944['filters']));if(_0xf7bb8c[_0x9a10('0x31')]['filter']){_0x525f5b[_0x9a10('0x3e')]=_[_0x9a10('0x48')](_0x525f5b[_0x9a10('0x3e')],{'$or':_[_0x9a10('0x2b')](_0x525f5b['attributes'],function(_0x5a74cf){var _0x2b3f7e={};_0x2b3f7e[_0x5a74cf]={'$like':'%'+_0xf7bb8c[_0x9a10('0x31')][_0x9a10('0x3b')]+'%'};return _0x2b3f7e;})});}_0x525f5b=_['merge']({},_0x525f5b,_0xf7bb8c[_0x9a10('0x3d')]);return _0x120fed['getFields'](_0x525f5b);}})['then'](function(_0x344401){if(_0x344401){_0x18a637=_0x344401['length'];if(!_0xf7bb8c['query'][_0x9a10('0x36')](_0x9a10('0x37'))){_0x525f5b[_0x9a10('0x1e')]=qs[_0x9a10('0x1e')](_0xf7bb8c['query'][_0x9a10('0x1e')]);_0x525f5b[_0x9a10('0x1d')]=qs[_0x9a10('0x1d')](_0xf7bb8c[_0x9a10('0x31')][_0x9a10('0x1d')]);}return _0x120fed[_0x9a10('0x4f')](_0x525f5b);}})['then'](function(_0xd86245){if(_0xd86245){return _0xd86245?{'count':_0x18a637,'rows':_0xd86245}:null;}})[_0x9a10('0x25')](respondWithResult(_0x470761,null))[_0x9a10('0x43')](handleError(_0x470761,null));};exports['getSubjects']=function(_0x52e6b1,_0x15b060,_0xb6cfb6){var _0x5ae731={};var _0x25df6d={};var _0x19cf47;var _0x10eeac;return db[_0x9a10('0x2c')][_0x9a10('0x4d')]({'where':{'id':_0x52e6b1[_0x9a10('0x44')]['id']}})[_0x9a10('0x25')](handleEntityNotFound(_0x15b060,null))[_0x9a10('0x25')](function(_0x441301){if(_0x441301){_0x19cf47=_0x441301;_0x25df6d[_0x9a10('0x30')]=_[_0x9a10('0x45')](db[_0x9a10('0x4e')][_0x9a10('0x2d')]);_0x25df6d['query']=_['keys'](_0x52e6b1['query']);_0x25df6d[_0x9a10('0x32')]=_[_0x9a10('0x33')](_0x25df6d['model'],_0x25df6d[_0x9a10('0x31')]);_0x5ae731[_0x9a10('0x34')]=_[_0x9a10('0x33')](_0x25df6d[_0x9a10('0x30')],qs[_0x9a10('0x35')](_0x52e6b1[_0x9a10('0x31')][_0x9a10('0x35')]));_0x5ae731[_0x9a10('0x34')]=_0x5ae731[_0x9a10('0x34')][_0x9a10('0x46')]?_0x5ae731['attributes']:_0x25df6d[_0x9a10('0x30')];_0x5ae731[_0x9a10('0x38')]=qs[_0x9a10('0x39')](_0x52e6b1[_0x9a10('0x31')]['sort']);_0x5ae731[_0x9a10('0x3e')]=qs[_0x9a10('0x32')](_[_0x9a10('0x3a')](_0x52e6b1[_0x9a10('0x31')],_0x25df6d[_0x9a10('0x32')]));if(_0x52e6b1[_0x9a10('0x31')][_0x9a10('0x3b')]){_0x5ae731[_0x9a10('0x3e')]=_[_0x9a10('0x48')](_0x5ae731[_0x9a10('0x3e')],{'$or':_['map'](_0x5ae731[_0x9a10('0x34')],function(_0x43e897){var _0x44291a={};_0x44291a[_0x43e897]={'$like':'%'+_0x52e6b1['query']['filter']+'%'};return _0x44291a;})});}_0x5ae731=_[_0x9a10('0x48')]({},_0x5ae731,_0x52e6b1[_0x9a10('0x3d')]);return _0x19cf47[_0x9a10('0x50')](_0x5ae731);}})[_0x9a10('0x25')](function(_0x787a48){if(_0x787a48){_0x10eeac=_0x787a48[_0x9a10('0x46')];if(!_0x52e6b1[_0x9a10('0x31')]['hasOwnProperty'](_0x9a10('0x37'))){_0x5ae731['limit']=qs[_0x9a10('0x1e')](_0x52e6b1[_0x9a10('0x31')][_0x9a10('0x1e')]);_0x5ae731[_0x9a10('0x1d')]=qs[_0x9a10('0x1d')](_0x52e6b1[_0x9a10('0x31')][_0x9a10('0x1d')]);}return _0x19cf47[_0x9a10('0x50')](_0x5ae731);}})[_0x9a10('0x25')](function(_0x5e08c8){if(_0x5e08c8){return _0x5e08c8?{'count':_0x10eeac,'rows':_0x5e08c8}:null;}})[_0x9a10('0x25')](respondWithResult(_0x15b060,null))['catch'](handleError(_0x15b060,null));};exports[_0x9a10('0x51')]=function(_0x5eab9e,_0x181074,_0x31fa46){var _0x267e31={};var _0x2abb52={};var _0x152c4b;var _0x29fba0;return db[_0x9a10('0x2c')][_0x9a10('0x4d')]({'where':{'id':_0x5eab9e[_0x9a10('0x44')]['id']}})[_0x9a10('0x25')](handleEntityNotFound(_0x181074,null))['then'](function(_0x312a83){if(_0x312a83){_0x152c4b=_0x312a83;_0x2abb52[_0x9a10('0x30')]=_[_0x9a10('0x45')](db[_0x9a10('0x4e')]['rawAttributes']);_0x2abb52[_0x9a10('0x31')]=_[_0x9a10('0x45')](_0x5eab9e[_0x9a10('0x31')]);_0x2abb52[_0x9a10('0x32')]=_[_0x9a10('0x33')](_0x2abb52[_0x9a10('0x30')],_0x2abb52['query']);_0x267e31['attributes']=_['intersection'](_0x2abb52[_0x9a10('0x30')],qs[_0x9a10('0x35')](_0x5eab9e[_0x9a10('0x31')]['fields']));_0x267e31[_0x9a10('0x34')]=_0x267e31[_0x9a10('0x34')]['length']?_0x267e31[_0x9a10('0x34')]:_0x2abb52[_0x9a10('0x30')];_0x267e31['order']=qs[_0x9a10('0x39')](_0x5eab9e[_0x9a10('0x31')][_0x9a10('0x39')]);_0x267e31[_0x9a10('0x3e')]=qs[_0x9a10('0x32')](_[_0x9a10('0x3a')](_0x5eab9e[_0x9a10('0x31')],_0x2abb52['filters']));if(_0x5eab9e['query'][_0x9a10('0x3b')]){_0x267e31[_0x9a10('0x3e')]=_['merge'](_0x267e31['where'],{'$or':_[_0x9a10('0x2b')](_0x267e31[_0x9a10('0x34')],function(_0x41ac60){var _0x3d90f3={};_0x3d90f3[_0x41ac60]={'$like':'%'+_0x5eab9e[_0x9a10('0x31')][_0x9a10('0x3b')]+'%'};return _0x3d90f3;})});}_0x267e31=_[_0x9a10('0x48')]({},_0x267e31,_0x5eab9e[_0x9a10('0x3d')]);return _0x152c4b['getDescriptions'](_0x267e31);}})[_0x9a10('0x25')](function(_0xd84568){if(_0xd84568){_0x29fba0=_0xd84568[_0x9a10('0x46')];if(!_0x5eab9e[_0x9a10('0x31')][_0x9a10('0x36')](_0x9a10('0x37'))){_0x267e31[_0x9a10('0x1e')]=qs[_0x9a10('0x1e')](_0x5eab9e[_0x9a10('0x31')][_0x9a10('0x1e')]);_0x267e31[_0x9a10('0x1d')]=qs[_0x9a10('0x1d')](_0x5eab9e[_0x9a10('0x31')][_0x9a10('0x1d')]);}return _0x152c4b['getDescriptions'](_0x267e31);}})[_0x9a10('0x25')](function(_0x8a7007){if(_0x8a7007){return _0x8a7007?{'count':_0x29fba0,'rows':_0x8a7007}:null;}})[_0x9a10('0x25')](respondWithResult(_0x181074,null))[_0x9a10('0x43')](handleError(_0x181074,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index cb4cdb0..19bd89d 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 _0x37a9=['rimraf','./intVtigerConfiguration.attributes','VtigerConfiguration','int_vtiger_configurations','util','api','moment','bluebird','request-promise','path'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x37a9,0xea));var _0x937a=function(_0x5c2320,_0x543863){_0x5c2320=_0x5c2320-0x0;var _0x50d333=_0x37a9[_0x5c2320];return _0x50d333;};'use strict';var _=require('lodash');var util=require(_0x937a('0x0'));var logger=require('../../config/logger')(_0x937a('0x1'));var moment=require(_0x937a('0x2'));var BPromise=require(_0x937a('0x3'));var rp=require(_0x937a('0x4'));var fs=require('fs');var path=require(_0x937a('0x5'));var rimraf=require(_0x937a('0x6'));var config=require('../../config/environment');var attributes=require(_0x937a('0x7'));module['exports']=function(_0x54ee2f,_0x57ff00){return _0x54ee2f['define'](_0x937a('0x8'),attributes,{'tableName':_0x937a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf472=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xf472,0xd1));var _0x2f47=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf472[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x2f47('0x0'));var util=require(_0x2f47('0x1'));var logger=require(_0x2f47('0x2'))(_0x2f47('0x3'));var moment=require(_0x2f47('0x4'));var BPromise=require(_0x2f47('0x5'));var rp=require(_0x2f47('0x6'));var fs=require('fs');var path=require(_0x2f47('0x7'));var rimraf=require(_0x2f47('0x8'));var config=require(_0x2f47('0x9'));var attributes=require(_0x2f47('0xa'));module[_0x2f47('0xb')]=function(_0x15345c,_0x1ec197){return _0x15345c[_0x2f47('0xc')](_0x2f47('0xd'),attributes,{'tableName':_0x2f47('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 56fcb70..17028e6 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 _0x6cb5=['lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','then','request\x20sent','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message','info','result','catch'];(function(_0x5e1aa5,_0x35d6e9){var _0x2c4704=function(_0x57ae32){while(--_0x57ae32){_0x5e1aa5['push'](_0x5e1aa5['shift']());}};_0x2c4704(++_0x35d6e9);}(_0x6cb5,0x1b0));var _0x56cb=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x6cb5[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x56cb('0x0'));var util=require(_0x56cb('0x1'));var moment=require(_0x56cb('0x2'));var BPromise=require('bluebird');var rs=require(_0x56cb('0x3'));var fs=require('fs');var Redis=require(_0x56cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x56cb('0x5'))(_0x56cb('0x6'));var config=require('../../config/environment');var jayson=require(_0x56cb('0x7'));var client=jayson[_0x56cb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bec01,_0x5e73f2,_0x73cce7){return new BPromise(function(_0x2a2437,_0x2ddc26){return client['request'](_0x4bec01,_0x73cce7)[_0x56cb('0x9')](function(_0x2d215d){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x5e73f2,_0x56cb('0xa'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x5e73f2,_0x56cb('0xa'),JSON[_0x56cb('0xb')](_0x2d215d));if(_0x2d215d[_0x56cb('0xc')]){if(_0x2d215d['error']['code']===0x1f4){logger[_0x56cb('0xc')](_0x56cb('0xd'),_0x5e73f2,_0x2d215d['error'][_0x56cb('0xe')]);return _0x2ddc26(_0x2d215d[_0x56cb('0xc')][_0x56cb('0xe')]);}logger[_0x56cb('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x5e73f2,_0x2d215d[_0x56cb('0xc')][_0x56cb('0xe')]);return _0x2a2437(_0x2d215d['error'][_0x56cb('0xe')]);}else{logger[_0x56cb('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x5e73f2,_0x56cb('0xa'));_0x2a2437(_0x2d215d[_0x56cb('0x10')]['message']);}})[_0x56cb('0x11')](function(_0x2e4606){logger[_0x56cb('0xc')](_0x56cb('0xd'),_0x5e73f2,_0x2e4606);_0x2ddc26(_0x2e4606);});});} \ No newline at end of file +var _0xe56e=['debug','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x573e08,_0x2081dc){var _0x5ecaa0=function(_0xf879f0){while(--_0xf879f0){_0x573e08['push'](_0x573e08['shift']());}};_0x5ecaa0(++_0x2081dc);}(_0xe56e,0x73));var _0xee56=function(_0x57bad4,_0x2575b0){_0x57bad4=_0x57bad4-0x0;var _0x1b41c3=_0xe56e[_0x57bad4];return _0x1b41c3;};'use strict';var _=require(_0xee56('0x0'));var util=require(_0xee56('0x1'));var moment=require(_0xee56('0x2'));var BPromise=require(_0xee56('0x3'));var rs=require(_0xee56('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee56('0x5'))['db'];var utils=require(_0xee56('0x6'));var logger=require('../../config/logger')(_0xee56('0x7'));var config=require(_0xee56('0x8'));var jayson=require(_0xee56('0x9'));var client=jayson[_0xee56('0xa')][_0xee56('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59179b,_0x4e4697,_0x45bae2){return new BPromise(function(_0x3f2aa4,_0x2df478){return client[_0xee56('0xc')](_0x59179b,_0x45bae2)[_0xee56('0xd')](function(_0x3468d3){logger[_0xee56('0xe')](_0xee56('0xf'),_0x4e4697,_0xee56('0x10'));logger[_0xee56('0x11')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x4e4697,'request\x20sent',JSON[_0xee56('0x12')](_0x3468d3));if(_0x3468d3[_0xee56('0x13')]){if(_0x3468d3['error']['code']===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x4e4697,_0x3468d3[_0xee56('0x13')][_0xee56('0x14')]);return _0x2df478(_0x3468d3[_0xee56('0x13')]['message']);}logger[_0xee56('0x13')](_0xee56('0xf'),_0x4e4697,_0x3468d3[_0xee56('0x13')][_0xee56('0x14')]);return _0x3f2aa4(_0x3468d3[_0xee56('0x13')][_0xee56('0x14')]);}else{logger['info'](_0xee56('0xf'),_0x4e4697,_0xee56('0x10'));_0x3f2aa4(_0x3468d3[_0xee56('0x15')][_0xee56('0x14')]);}})['catch'](function(_0x19cf09){logger[_0xee56('0x13')](_0xee56('0xf'),_0x4e4697,_0x19cf09);_0x2df478(_0x19cf09);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 1c73e0f..ae2f60a 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 _0x758f=['delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','create','put','update'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x758f,0x1b1));var _0xf758=function(_0x380356,_0x44304f){_0x380356=_0x380356-0x0;var _0x542fb4=_0x758f[_0x380356];return _0x542fb4;};'use strict';var multer=require(_0xf758('0x0'));var util=require(_0xf758('0x1'));var path=require(_0xf758('0x2'));var timeout=require('connect-timeout');var express=require(_0xf758('0x3'));var router=express[_0xf758('0x4')]();var fs_extra=require(_0xf758('0x5'));var auth=require(_0xf758('0x6'));var interaction=require(_0xf758('0x7'));var config=require(_0xf758('0x8'));var controller=require('./intVtigerField.controller');router[_0xf758('0x9')]('/',auth[_0xf758('0xa')](),controller['index']);router['get'](_0xf758('0xb'),auth[_0xf758('0xa')](),controller['show']);router['post']('/',auth[_0xf758('0xa')](),controller[_0xf758('0xc')]);router[_0xf758('0xd')](_0xf758('0xb'),auth[_0xf758('0xa')](),controller[_0xf758('0xe')]);router[_0xf758('0xf')]('/:id',auth[_0xf758('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xeea9=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated'];(function(_0x115b95,_0xa1f8b9){var _0x460b3d=function(_0x510c02){while(--_0x510c02){_0x115b95['push'](_0x115b95['shift']());}};_0x460b3d(++_0xa1f8b9);}(_0xeea9,0xea));var _0x9eea=function(_0xc5729a,_0x18e591){_0xc5729a=_0xc5729a-0x0;var _0xb5acde=_0xeea9[_0xc5729a];return _0xb5acde;};'use strict';var multer=require(_0x9eea('0x0'));var util=require(_0x9eea('0x1'));var path=require(_0x9eea('0x2'));var timeout=require(_0x9eea('0x3'));var express=require(_0x9eea('0x4'));var router=express[_0x9eea('0x5')]();var fs_extra=require(_0x9eea('0x6'));var auth=require(_0x9eea('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9eea('0x8'));var controller=require('./intVtigerField.controller');router[_0x9eea('0x9')]('/',auth['isAuthenticated'](),controller[_0x9eea('0xa')]);router['get'](_0x9eea('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x9eea('0xc')](),controller[_0x9eea('0xd')]);router[_0x9eea('0xe')](_0x9eea('0xb'),auth['isAuthenticated'](),controller[_0x9eea('0xf')]);router[_0x9eea('0x10')](_0x9eea('0xb'),auth['isAuthenticated'](),controller[_0x9eea('0x11')]);module[_0x9eea('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 3e6e27b..d9b3d4f 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 _0x42ed=['STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','picklist'];(function(_0x59a0c0,_0x4567ed){var _0x618f48=function(_0x148e23){while(--_0x148e23){_0x59a0c0['push'](_0x59a0c0['shift']());}};_0x618f48(++_0x4567ed);}(_0x42ed,0x19a));var _0xd42e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x42ed[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd42e('0x0'));module[_0xd42e('0x1')]={'type':{'type':Sequelize[_0xd42e('0x2')]('string',_0xd42e('0x3'),_0xd42e('0x4'),'keyValue',_0xd42e('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd42e('0x6')]},'key':{'type':Sequelize[_0xd42e('0x6')]},'keyType':{'type':Sequelize[_0xd42e('0x2')]('string','variable',_0xd42e('0x4'))},'keyContent':{'type':Sequelize[_0xd42e('0x6')]},'idField':{'type':Sequelize[_0xd42e('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd42e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd42e('0x6')]}}; \ No newline at end of file +var _0x3a20=['BOOLEAN','sequelize','ENUM','string','variable','keyValue','STRING','customVariable'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x3a20,0xc9));var _0x03a2=function(_0x556eb2,_0x45ec79){_0x556eb2=_0x556eb2-0x0;var _0x447956=_0x3a20[_0x556eb2];return _0x447956;};'use strict';var Sequelize=require(_0x03a2('0x0'));module['exports']={'type':{'type':Sequelize[_0x03a2('0x1')](_0x03a2('0x2'),_0x03a2('0x3'),'customVariable',_0x03a2('0x4'),'picklist'),'defaultValue':_0x03a2('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x03a2('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x03a2('0x2'),_0x03a2('0x3'),_0x03a2('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x03a2('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x03a2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x03a2('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 24a8b48..d8a9e5f 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 _0xcd89=['find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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/logger','../../config/utils','../../mysqldb','sendStatus','status','json','offset','count','limit','set','apply','reject','save','update','destroy','then','end','error','stack','name','send','VtigerField','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','where','merge','filter','options','includeAll','include','findAll','rows','catch','params'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcd89,0xe1));var _0x9cd8=function(_0x2818db,_0x408a26){_0x2818db=_0x2818db-0x0;var _0x53e50a=_0xcd89[_0x2818db];return _0x53e50a;};'use strict';var emlformat=require(_0x9cd8('0x0'));var rimraf=require(_0x9cd8('0x1'));var zipdir=require(_0x9cd8('0x2'));var jsonpatch=require(_0x9cd8('0x3'));var rp=require(_0x9cd8('0x4'));var moment=require('moment');var BPromise=require(_0x9cd8('0x5'));var Mustache=require(_0x9cd8('0x6'));var util=require('util');var path=require(_0x9cd8('0x7'));var sox=require(_0x9cd8('0x8'));var csv=require(_0x9cd8('0x9'));var ejs=require(_0x9cd8('0xa'));var fs=require('fs');var fs_extra=require(_0x9cd8('0xb'));var _=require(_0x9cd8('0xc'));var squel=require(_0x9cd8('0xd'));var crypto=require(_0x9cd8('0xe'));var jsforce=require(_0x9cd8('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9cd8('0x10'));var Papa=require(_0x9cd8('0x11'));var Redis=require(_0x9cd8('0x12'));var authService=require(_0x9cd8('0x13'));var qs=require(_0x9cd8('0x14'));var as=require(_0x9cd8('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9cd8('0x16'))('api');var utils=require(_0x9cd8('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9cd8('0x18'))['db'];function respondWithStatusCode(_0x3db3d5,_0x873de0){_0x873de0=_0x873de0||0xcc;return function(_0x425cef){if(_0x425cef){return _0x3db3d5[_0x9cd8('0x19')](_0x873de0);}return _0x3db3d5['status'](_0x873de0)['end']();};}function respondWithResult(_0x5ac494,_0x20cddb){_0x20cddb=_0x20cddb||0xc8;return function(_0x455c3a){if(_0x455c3a){return _0x5ac494[_0x9cd8('0x1a')](_0x20cddb)[_0x9cd8('0x1b')](_0x455c3a);}};}function respondWithFilteredResult(_0x29aaf0,_0x1f2f2c){return function(_0x1169f9){if(_0x1169f9){var _0x2fe745=typeof _0x1f2f2c[_0x9cd8('0x1c')]==='undefined'&&typeof _0x1f2f2c['limit']==='undefined';var _0x53b0cf=_0x1169f9[_0x9cd8('0x1d')];var _0x15dffb=_0x2fe745?0x0:_0x1f2f2c[_0x9cd8('0x1c')];var _0x42fe1d=_0x2fe745?_0x1169f9[_0x9cd8('0x1d')]:_0x1f2f2c[_0x9cd8('0x1c')]+_0x1f2f2c[_0x9cd8('0x1e')];var _0xfda305;if(_0x42fe1d>=_0x53b0cf){_0x42fe1d=_0x53b0cf;_0xfda305=0xc8;}else{_0xfda305=0xce;}_0x29aaf0['status'](_0xfda305);return _0x29aaf0[_0x9cd8('0x1f')]('Content-Range',_0x15dffb+'-'+_0x42fe1d+'/'+_0x53b0cf)[_0x9cd8('0x1b')](_0x1169f9);}return null;};}function patchUpdates(_0x54ed87){return function(_0xcff39d){try{jsonpatch[_0x9cd8('0x20')](_0xcff39d,_0x54ed87,!![]);}catch(_0x504118){return BPromise[_0x9cd8('0x21')](_0x504118);}return _0xcff39d[_0x9cd8('0x22')]();};}function saveUpdates(_0x175b73,_0x331104){return function(_0x8f7b5e){if(_0x8f7b5e){return _0x8f7b5e[_0x9cd8('0x23')](_0x175b73)['then'](function(_0x41d0b6){return _0x41d0b6;});}return null;};}function removeEntity(_0x246181,_0x1b516d){return function(_0x4f3cc2){if(_0x4f3cc2){return _0x4f3cc2[_0x9cd8('0x24')]()[_0x9cd8('0x25')](function(){_0x246181[_0x9cd8('0x1a')](0xcc)[_0x9cd8('0x26')]();});}};}function handleEntityNotFound(_0x2a7b1,_0x46d053){return function(_0x5aeeb4){if(!_0x5aeeb4){_0x2a7b1[_0x9cd8('0x19')](0x194);}return _0x5aeeb4;};}function handleError(_0x49700e,_0x210a95){_0x210a95=_0x210a95||0x1f4;return function(_0x370bd8){logger[_0x9cd8('0x27')](_0x370bd8[_0x9cd8('0x28')]);if(_0x370bd8[_0x9cd8('0x29')]){delete _0x370bd8['name'];}_0x49700e[_0x9cd8('0x1a')](_0x210a95)[_0x9cd8('0x2a')](_0x370bd8);};}exports['index']=function(_0x276624,_0x580835){var _0x37c23a={},_0x3308e4={},_0xf402b7={'count':0x0,'rows':[]};var _0x2be8e9=_['map'](db[_0x9cd8('0x2b')][_0x9cd8('0x2c')],function(_0x110189){return{'name':_0x110189[_0x9cd8('0x2d')],'type':_0x110189[_0x9cd8('0x2e')][_0x9cd8('0x2f')]};});_0x3308e4[_0x9cd8('0x30')]=_[_0x9cd8('0x31')](_0x2be8e9,_0x9cd8('0x29'));_0x3308e4[_0x9cd8('0x32')]=_[_0x9cd8('0x33')](_0x276624[_0x9cd8('0x32')]);_0x3308e4['filters']=_[_0x9cd8('0x34')](_0x3308e4[_0x9cd8('0x30')],_0x3308e4[_0x9cd8('0x32')]);_0x37c23a['attributes']=_['intersection'](_0x3308e4[_0x9cd8('0x30')],qs['fields'](_0x276624['query'][_0x9cd8('0x35')]));_0x37c23a[_0x9cd8('0x36')]=_0x37c23a[_0x9cd8('0x36')][_0x9cd8('0x37')]?_0x37c23a['attributes']:_0x3308e4[_0x9cd8('0x30')];if(!_0x276624[_0x9cd8('0x32')][_0x9cd8('0x38')]('nolimit')){_0x37c23a[_0x9cd8('0x1e')]=qs['limit'](_0x276624[_0x9cd8('0x32')]['limit']);_0x37c23a[_0x9cd8('0x1c')]=qs[_0x9cd8('0x1c')](_0x276624['query']['offset']);}_0x37c23a[_0x9cd8('0x39')]=qs[_0x9cd8('0x3a')](_0x276624['query'][_0x9cd8('0x3a')]);_0x37c23a['where']=qs[_0x9cd8('0x3b')](_[_0x9cd8('0x3c')](_0x276624[_0x9cd8('0x32')],_0x3308e4[_0x9cd8('0x3b')]),_0x2be8e9);if(_0x276624[_0x9cd8('0x32')]['filter']){_0x37c23a[_0x9cd8('0x3d')]=_[_0x9cd8('0x3e')](_0x37c23a[_0x9cd8('0x3d')],{'$or':_[_0x9cd8('0x31')](_0x2be8e9,function(_0x36058e){if(_0x36058e[_0x9cd8('0x2e')]!=='VIRTUAL'){var _0x5ebb6d={};_0x5ebb6d[_0x36058e[_0x9cd8('0x29')]]={'$like':'%'+_0x276624[_0x9cd8('0x32')][_0x9cd8('0x3f')]+'%'};return _0x5ebb6d;}})});}_0x37c23a=_['merge']({},_0x37c23a,_0x276624[_0x9cd8('0x40')]);var _0x4f7b69={'where':_0x37c23a[_0x9cd8('0x3d')]};return db['VtigerField'][_0x9cd8('0x1d')](_0x4f7b69)['then'](function(_0x2c9b9c){_0xf402b7[_0x9cd8('0x1d')]=_0x2c9b9c;if(_0x276624['query'][_0x9cd8('0x41')]){_0x37c23a[_0x9cd8('0x42')]=[{'all':!![]}];}return db[_0x9cd8('0x2b')][_0x9cd8('0x43')](_0x37c23a);})[_0x9cd8('0x25')](function(_0x4a9b0c){_0xf402b7[_0x9cd8('0x44')]=_0x4a9b0c;return _0xf402b7;})[_0x9cd8('0x25')](respondWithFilteredResult(_0x580835,_0x37c23a))[_0x9cd8('0x45')](handleError(_0x580835,null));};exports['show']=function(_0x5eff90,_0x243483){var _0x6abb8={'raw':!![],'where':{'id':_0x5eff90[_0x9cd8('0x46')]['id']}},_0x7b74f6={};_0x7b74f6[_0x9cd8('0x30')]=_[_0x9cd8('0x33')](db[_0x9cd8('0x2b')][_0x9cd8('0x2c')]);_0x7b74f6[_0x9cd8('0x32')]=_[_0x9cd8('0x33')](_0x5eff90['query']);_0x7b74f6[_0x9cd8('0x3b')]=_[_0x9cd8('0x34')](_0x7b74f6[_0x9cd8('0x30')],_0x7b74f6['query']);_0x6abb8[_0x9cd8('0x36')]=_['intersection'](_0x7b74f6[_0x9cd8('0x30')],qs[_0x9cd8('0x35')](_0x5eff90[_0x9cd8('0x32')][_0x9cd8('0x35')]));_0x6abb8[_0x9cd8('0x36')]=_0x6abb8[_0x9cd8('0x36')][_0x9cd8('0x37')]?_0x6abb8[_0x9cd8('0x36')]:_0x7b74f6[_0x9cd8('0x30')];if(_0x5eff90[_0x9cd8('0x32')]['includeAll']){_0x6abb8['include']=[{'all':!![]}];}_0x6abb8=_[_0x9cd8('0x3e')]({},_0x6abb8,_0x5eff90[_0x9cd8('0x40')]);return db[_0x9cd8('0x2b')][_0x9cd8('0x47')](_0x6abb8)['then'](handleEntityNotFound(_0x243483,null))[_0x9cd8('0x25')](respondWithResult(_0x243483,null))[_0x9cd8('0x45')](handleError(_0x243483,null));};exports[_0x9cd8('0x48')]=function(_0x4e3aae,_0x118eba){return db[_0x9cd8('0x2b')][_0x9cd8('0x48')](_0x4e3aae[_0x9cd8('0x49')],{})[_0x9cd8('0x25')](respondWithResult(_0x118eba,0xc9))[_0x9cd8('0x45')](handleError(_0x118eba,null));};exports[_0x9cd8('0x23')]=function(_0x35d1d4,_0x4d4f84){if(_0x35d1d4[_0x9cd8('0x49')]['id']){delete _0x35d1d4[_0x9cd8('0x49')]['id'];}return db[_0x9cd8('0x2b')][_0x9cd8('0x47')]({'where':{'id':_0x35d1d4[_0x9cd8('0x46')]['id']}})[_0x9cd8('0x25')](handleEntityNotFound(_0x4d4f84,null))[_0x9cd8('0x25')](saveUpdates(_0x35d1d4['body'],null))[_0x9cd8('0x25')](respondWithResult(_0x4d4f84,null))[_0x9cd8('0x45')](handleError(_0x4d4f84,null));};exports[_0x9cd8('0x24')]=function(_0x2430a0,_0x46990b){return db[_0x9cd8('0x2b')][_0x9cd8('0x47')]({'where':{'id':_0x2430a0[_0x9cd8('0x46')]['id']}})[_0x9cd8('0x25')](handleEntityNotFound(_0x46990b,null))['then'](removeEntity(_0x46990b,null))[_0x9cd8('0x45')](handleError(_0x46990b,null));}; \ No newline at end of file +var _0x3efa=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','include','options','find','create','body','update','destroy','params','eml-format','rimraf','fast-json-patch','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','then','error','stack','name','send','map','VtigerField','rawAttributes','fieldName','key','model','query','keys','filters','intersection'];(function(_0x2653d5,_0x188159){var _0x3004aa=function(_0x470aed){while(--_0x470aed){_0x2653d5['push'](_0x2653d5['shift']());}};_0x3004aa(++_0x188159);}(_0x3efa,0xab));var _0xa3ef=function(_0x42f887,_0x209ded){_0x42f887=_0x42f887-0x0;var _0x2e20a0=_0x3efa[_0x42f887];return _0x2e20a0;};'use strict';var emlformat=require(_0xa3ef('0x0'));var rimraf=require(_0xa3ef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa3ef('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa3ef('0x3'));var Mustache=require('mustache');var util=require(_0xa3ef('0x4'));var path=require('path');var sox=require(_0xa3ef('0x5'));var csv=require(_0xa3ef('0x6'));var ejs=require(_0xa3ef('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa3ef('0x8'));var squel=require(_0xa3ef('0x9'));var crypto=require('crypto');var jsforce=require(_0xa3ef('0xa'));var deskjs=require(_0xa3ef('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa3ef('0xc'));var Papa=require(_0xa3ef('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa3ef('0xe'));var as=require(_0xa3ef('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3ef('0x10'))(_0xa3ef('0x11'));var utils=require(_0xa3ef('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xa3ef('0x13'));var db=require(_0xa3ef('0x14'))['db'];function respondWithStatusCode(_0x381ec2,_0x15f75a){_0x15f75a=_0x15f75a||0xcc;return function(_0x13dee){if(_0x13dee){return _0x381ec2[_0xa3ef('0x15')](_0x15f75a);}return _0x381ec2[_0xa3ef('0x16')](_0x15f75a)[_0xa3ef('0x17')]();};}function respondWithResult(_0xa9b37e,_0x212bcb){_0x212bcb=_0x212bcb||0xc8;return function(_0x434579){if(_0x434579){return _0xa9b37e[_0xa3ef('0x16')](_0x212bcb)[_0xa3ef('0x18')](_0x434579);}};}function respondWithFilteredResult(_0x939a77,_0x1bc236){return function(_0x365f1b){if(_0x365f1b){var _0x2cd2d9=typeof _0x1bc236['offset']==='undefined'&&typeof _0x1bc236[_0xa3ef('0x19')]===_0xa3ef('0x1a');var _0x4abb74=_0x365f1b[_0xa3ef('0x1b')];var _0x4eeb48=_0x2cd2d9?0x0:_0x1bc236[_0xa3ef('0x1c')];var _0x57553a=_0x2cd2d9?_0x365f1b[_0xa3ef('0x1b')]:_0x1bc236[_0xa3ef('0x1c')]+_0x1bc236['limit'];var _0x344319;if(_0x57553a>=_0x4abb74){_0x57553a=_0x4abb74;_0x344319=0xc8;}else{_0x344319=0xce;}_0x939a77[_0xa3ef('0x16')](_0x344319);return _0x939a77['set'](_0xa3ef('0x1d'),_0x4eeb48+'-'+_0x57553a+'/'+_0x4abb74)['json'](_0x365f1b);}return null;};}function patchUpdates(_0x1ddd54){return function(_0x335c91){try{jsonpatch[_0xa3ef('0x1e')](_0x335c91,_0x1ddd54,!![]);}catch(_0x196116){return BPromise[_0xa3ef('0x1f')](_0x196116);}return _0x335c91[_0xa3ef('0x20')]();};}function saveUpdates(_0x337640,_0xe9c273){return function(_0x13ff0c){if(_0x13ff0c){return _0x13ff0c['update'](_0x337640)[_0xa3ef('0x21')](function(_0x12216e){return _0x12216e;});}return null;};}function removeEntity(_0x22d9aa,_0x42698b){return function(_0x13d074){if(_0x13d074){return _0x13d074['destroy']()[_0xa3ef('0x21')](function(){_0x22d9aa[_0xa3ef('0x16')](0xcc)[_0xa3ef('0x17')]();});}};}function handleEntityNotFound(_0x18261d,_0x1d2d27){return function(_0xfb8a01){if(!_0xfb8a01){_0x18261d['sendStatus'](0x194);}return _0xfb8a01;};}function handleError(_0x1fda43,_0xda2dbf){_0xda2dbf=_0xda2dbf||0x1f4;return function(_0x1828ec){logger[_0xa3ef('0x22')](_0x1828ec[_0xa3ef('0x23')]);if(_0x1828ec[_0xa3ef('0x24')]){delete _0x1828ec['name'];}_0x1fda43['status'](_0xda2dbf)[_0xa3ef('0x25')](_0x1828ec);};}exports['index']=function(_0x210250,_0x3454f7){var _0x74a7a1={},_0x5319d7={},_0x5e87e6={'count':0x0,'rows':[]};var _0x18de0e=_[_0xa3ef('0x26')](db[_0xa3ef('0x27')][_0xa3ef('0x28')],function(_0xf4b274){return{'name':_0xf4b274[_0xa3ef('0x29')],'type':_0xf4b274['type'][_0xa3ef('0x2a')]};});_0x5319d7[_0xa3ef('0x2b')]=_['map'](_0x18de0e,_0xa3ef('0x24'));_0x5319d7[_0xa3ef('0x2c')]=_[_0xa3ef('0x2d')](_0x210250[_0xa3ef('0x2c')]);_0x5319d7[_0xa3ef('0x2e')]=_[_0xa3ef('0x2f')](_0x5319d7[_0xa3ef('0x2b')],_0x5319d7[_0xa3ef('0x2c')]);_0x74a7a1[_0xa3ef('0x30')]=_[_0xa3ef('0x2f')](_0x5319d7[_0xa3ef('0x2b')],qs[_0xa3ef('0x31')](_0x210250['query'][_0xa3ef('0x31')]));_0x74a7a1[_0xa3ef('0x30')]=_0x74a7a1[_0xa3ef('0x30')][_0xa3ef('0x32')]?_0x74a7a1[_0xa3ef('0x30')]:_0x5319d7[_0xa3ef('0x2b')];if(!_0x210250['query'][_0xa3ef('0x33')](_0xa3ef('0x34'))){_0x74a7a1[_0xa3ef('0x19')]=qs[_0xa3ef('0x19')](_0x210250[_0xa3ef('0x2c')]['limit']);_0x74a7a1['offset']=qs['offset'](_0x210250['query'][_0xa3ef('0x1c')]);}_0x74a7a1[_0xa3ef('0x35')]=qs['sort'](_0x210250[_0xa3ef('0x2c')][_0xa3ef('0x36')]);_0x74a7a1[_0xa3ef('0x37')]=qs[_0xa3ef('0x2e')](_[_0xa3ef('0x38')](_0x210250[_0xa3ef('0x2c')],_0x5319d7['filters']),_0x18de0e);if(_0x210250[_0xa3ef('0x2c')][_0xa3ef('0x39')]){_0x74a7a1[_0xa3ef('0x37')]=_[_0xa3ef('0x3a')](_0x74a7a1[_0xa3ef('0x37')],{'$or':_['map'](_0x18de0e,function(_0x145962){if(_0x145962['type']!==_0xa3ef('0x3b')){var _0x25bdd5={};_0x25bdd5[_0x145962[_0xa3ef('0x24')]]={'$like':'%'+_0x210250[_0xa3ef('0x2c')]['filter']+'%'};return _0x25bdd5;}})});}_0x74a7a1=_[_0xa3ef('0x3a')]({},_0x74a7a1,_0x210250['options']);var _0xbb3a04={'where':_0x74a7a1[_0xa3ef('0x37')]};return db['VtigerField'][_0xa3ef('0x1b')](_0xbb3a04)['then'](function(_0x5b57eb){_0x5e87e6[_0xa3ef('0x1b')]=_0x5b57eb;if(_0x210250[_0xa3ef('0x2c')][_0xa3ef('0x3c')]){_0x74a7a1['include']=[{'all':!![]}];}return db[_0xa3ef('0x27')][_0xa3ef('0x3d')](_0x74a7a1);})[_0xa3ef('0x21')](function(_0x34f59c){_0x5e87e6[_0xa3ef('0x3e')]=_0x34f59c;return _0x5e87e6;})[_0xa3ef('0x21')](respondWithFilteredResult(_0x3454f7,_0x74a7a1))[_0xa3ef('0x3f')](handleError(_0x3454f7,null));};exports[_0xa3ef('0x40')]=function(_0x209d40,_0x377701){var _0x2a87df={'raw':!![],'where':{'id':_0x209d40['params']['id']}},_0x5cb7ac={};_0x5cb7ac['model']=_[_0xa3ef('0x2d')](db[_0xa3ef('0x27')][_0xa3ef('0x28')]);_0x5cb7ac[_0xa3ef('0x2c')]=_['keys'](_0x209d40[_0xa3ef('0x2c')]);_0x5cb7ac[_0xa3ef('0x2e')]=_[_0xa3ef('0x2f')](_0x5cb7ac[_0xa3ef('0x2b')],_0x5cb7ac[_0xa3ef('0x2c')]);_0x2a87df[_0xa3ef('0x30')]=_['intersection'](_0x5cb7ac[_0xa3ef('0x2b')],qs[_0xa3ef('0x31')](_0x209d40[_0xa3ef('0x2c')][_0xa3ef('0x31')]));_0x2a87df['attributes']=_0x2a87df[_0xa3ef('0x30')]['length']?_0x2a87df[_0xa3ef('0x30')]:_0x5cb7ac[_0xa3ef('0x2b')];if(_0x209d40[_0xa3ef('0x2c')][_0xa3ef('0x3c')]){_0x2a87df[_0xa3ef('0x41')]=[{'all':!![]}];}_0x2a87df=_[_0xa3ef('0x3a')]({},_0x2a87df,_0x209d40[_0xa3ef('0x42')]);return db['VtigerField'][_0xa3ef('0x43')](_0x2a87df)['then'](handleEntityNotFound(_0x377701,null))[_0xa3ef('0x21')](respondWithResult(_0x377701,null))[_0xa3ef('0x3f')](handleError(_0x377701,null));};exports[_0xa3ef('0x44')]=function(_0x26c3a2,_0x4ef848){return db[_0xa3ef('0x27')][_0xa3ef('0x44')](_0x26c3a2[_0xa3ef('0x45')],{})['then'](respondWithResult(_0x4ef848,0xc9))[_0xa3ef('0x3f')](handleError(_0x4ef848,null));};exports[_0xa3ef('0x46')]=function(_0x3f1fff,_0x3b9f33){if(_0x3f1fff[_0xa3ef('0x45')]['id']){delete _0x3f1fff[_0xa3ef('0x45')]['id'];}return db['VtigerField'][_0xa3ef('0x43')]({'where':{'id':_0x3f1fff['params']['id']}})[_0xa3ef('0x21')](handleEntityNotFound(_0x3b9f33,null))[_0xa3ef('0x21')](saveUpdates(_0x3f1fff['body'],null))[_0xa3ef('0x21')](respondWithResult(_0x3b9f33,null))['catch'](handleError(_0x3b9f33,null));};exports[_0xa3ef('0x47')]=function(_0x40aea6,_0x48237f){return db[_0xa3ef('0x27')][_0xa3ef('0x43')]({'where':{'id':_0x40aea6[_0xa3ef('0x48')]['id']}})[_0xa3ef('0x21')](handleEntityNotFound(_0x48237f,null))['then'](removeEntity(_0x48237f,null))[_0xa3ef('0x3f')](handleError(_0x48237f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 554a34b..054c6d1 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 _0x954d=['int_vtiger_fields','vtiger_unique_index','idField','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x1c4add,_0x1141ef){var _0x2b1cc1=function(_0x2e88c7){while(--_0x2e88c7){_0x1c4add['push'](_0x1c4add['shift']());}};_0x2b1cc1(++_0x1141ef);}(_0x954d,0x147));var _0xd954=function(_0x40fb1a,_0xc40248){_0x40fb1a=_0x40fb1a-0x0;var _0x5a7770=_0x954d[_0x40fb1a];return _0x5a7770;};'use strict';var _=require(_0xd954('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd954('0x1'));var moment=require(_0xd954('0x2'));var BPromise=require(_0xd954('0x3'));var rp=require(_0xd954('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd954('0x5'));var config=require(_0xd954('0x6'));var attributes=require('./intVtigerField.attributes');module[_0xd954('0x7')]=function(_0x2a9ccf,_0x33663e){return _0x2a9ccf[_0xd954('0x8')]('VtigerField',attributes,{'tableName':_0xd954('0x9'),'paranoid':![],'indexes':[{'name':_0xd954('0xa'),'fields':[_0xd954('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe8c4=['vtiger_unique_index','lodash','util','../../config/logger','api','moment','bluebird','path','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields'];(function(_0x122bc8,_0x489566){var _0x99babf=function(_0x5135f3){while(--_0x5135f3){_0x122bc8['push'](_0x122bc8['shift']());}};_0x99babf(++_0x489566);}(_0xe8c4,0x160));var _0x4e8c=function(_0x5cea98,_0x148931){_0x5cea98=_0x5cea98-0x0;var _0x5528de=_0xe8c4[_0x5cea98];return _0x5528de;};'use strict';var _=require(_0x4e8c('0x0'));var util=require(_0x4e8c('0x1'));var logger=require(_0x4e8c('0x2'))(_0x4e8c('0x3'));var moment=require(_0x4e8c('0x4'));var BPromise=require(_0x4e8c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e8c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4e8c('0x7'));module[_0x4e8c('0x8')]=function(_0x1836b7,_0x1c0bfe){return _0x1836b7[_0x4e8c('0x9')](_0x4e8c('0xa'),attributes,{'tableName':_0x4e8c('0xb'),'paranoid':![],'indexes':[{'name':_0x4e8c('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 b9f84b8..5385829 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 _0xfb70=['VtigerField,\x20%s,\x20%s','result','lodash','util','moment','../../mysqldb','rpc','jayson/promise','client','request','then','info','debug','request\x20sent','stringify','error','code','message'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xfb70,0x16a));var _0x0fb7=function(_0x141112,_0xffa567){_0x141112=_0x141112-0x0;var _0x5f3753=_0xfb70[_0x141112];return _0x5f3753;};'use strict';var _=require(_0x0fb7('0x0'));var util=require(_0x0fb7('0x1'));var moment=require(_0x0fb7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0fb7('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0fb7('0x4'));var config=require('../../config/environment');var jayson=require(_0x0fb7('0x5'));var client=jayson[_0x0fb7('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b8aac,_0x5f25bf,_0x5bab55){return new BPromise(function(_0x3076d5,_0x387155){return client[_0x0fb7('0x7')](_0x3b8aac,_0x5bab55)[_0x0fb7('0x8')](function(_0x18af94){logger[_0x0fb7('0x9')]('VtigerField,\x20%s,\x20%s',_0x5f25bf,'request\x20sent');logger[_0x0fb7('0xa')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x5f25bf,_0x0fb7('0xb'),JSON[_0x0fb7('0xc')](_0x18af94));if(_0x18af94[_0x0fb7('0xd')]){if(_0x18af94[_0x0fb7('0xd')][_0x0fb7('0xe')]===0x1f4){logger[_0x0fb7('0xd')]('VtigerField,\x20%s,\x20%s',_0x5f25bf,_0x18af94[_0x0fb7('0xd')][_0x0fb7('0xf')]);return _0x387155(_0x18af94[_0x0fb7('0xd')][_0x0fb7('0xf')]);}logger[_0x0fb7('0xd')](_0x0fb7('0x10'),_0x5f25bf,_0x18af94['error'][_0x0fb7('0xf')]);return _0x3076d5(_0x18af94[_0x0fb7('0xd')][_0x0fb7('0xf')]);}else{logger[_0x0fb7('0x9')](_0x0fb7('0x10'),_0x5f25bf,'request\x20sent');_0x3076d5(_0x18af94[_0x0fb7('0x11')][_0x0fb7('0xf')]);}})['catch'](function(_0x4cc7f1){logger['error'](_0x0fb7('0x10'),_0x5f25bf,_0x4cc7f1);_0x387155(_0x4cc7f1);});});} \ No newline at end of file +var _0x1816=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment'];(function(_0x3e8270,_0x293590){var _0x1ccde9=function(_0x213490){while(--_0x213490){_0x3e8270['push'](_0x3e8270['shift']());}};_0x1ccde9(++_0x293590);}(_0x1816,0x15e));var _0x6181=function(_0x120919,_0x103060){_0x120919=_0x120919-0x0;var _0xac91f3=_0x1816[_0x120919];return _0xac91f3;};'use strict';var _=require('lodash');var util=require(_0x6181('0x0'));var moment=require(_0x6181('0x1'));var BPromise=require('bluebird');var rs=require(_0x6181('0x2'));var fs=require('fs');var Redis=require(_0x6181('0x3'));var db=require(_0x6181('0x4'))['db'];var utils=require(_0x6181('0x5'));var logger=require('../../config/logger')(_0x6181('0x6'));var config=require(_0x6181('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6181('0x8')][_0x6181('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2669a5,_0x31bb34,_0x4dec74){return new BPromise(function(_0x32a0be,_0x5286d6){return client[_0x6181('0xa')](_0x2669a5,_0x4dec74)[_0x6181('0xb')](function(_0x1b2728){logger[_0x6181('0xc')](_0x6181('0xd'),_0x31bb34,_0x6181('0xe'));logger[_0x6181('0xf')](_0x6181('0x10'),_0x31bb34,_0x6181('0xe'),JSON['stringify'](_0x1b2728));if(_0x1b2728[_0x6181('0x11')]){if(_0x1b2728[_0x6181('0x11')][_0x6181('0x12')]===0x1f4){logger[_0x6181('0x11')](_0x6181('0xd'),_0x31bb34,_0x1b2728['error'][_0x6181('0x13')]);return _0x5286d6(_0x1b2728[_0x6181('0x11')][_0x6181('0x13')]);}logger['error'](_0x6181('0xd'),_0x31bb34,_0x1b2728['error'][_0x6181('0x13')]);return _0x32a0be(_0x1b2728[_0x6181('0x11')][_0x6181('0x13')]);}else{logger[_0x6181('0xc')](_0x6181('0xd'),_0x31bb34,'request\x20sent');_0x32a0be(_0x1b2728[_0x6181('0x14')][_0x6181('0x13')]);}})[_0x6181('0x15')](function(_0x53da42){logger[_0x6181('0x11')](_0x6181('0xd'),_0x31bb34,_0x53da42);_0x5286d6(_0x53da42);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 50b506e..f3eb4f8 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 _0xe7d9=['path','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update','util'];(function(_0x45518f,_0x475a6b){var _0x198175=function(_0x40d333){while(--_0x40d333){_0x45518f['push'](_0x45518f['shift']());}};_0x198175(++_0x475a6b);}(_0xe7d9,0xc5));var _0x9e7d=function(_0x2a9285,_0x44accb){_0x2a9285=_0x2a9285-0x0;var _0xf06891=_0xe7d9[_0x2a9285];return _0xf06891;};'use strict';var multer=require('multer');var util=require(_0x9e7d('0x0'));var path=require(_0x9e7d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x9e7d('0x2'));var auth=require(_0x9e7d('0x3'));var interaction=require(_0x9e7d('0x4'));var config=require('../../config/environment');var controller=require(_0x9e7d('0x5'));router['get']('/',auth[_0x9e7d('0x6')](),controller[_0x9e7d('0x7')]);router[_0x9e7d('0x8')](_0x9e7d('0x9'),auth[_0x9e7d('0x6')](),controller[_0x9e7d('0xa')]);router[_0x9e7d('0x8')](_0x9e7d('0xb'),auth[_0x9e7d('0x6')](),controller[_0x9e7d('0xc')]);router['get'](_0x9e7d('0xd'),auth[_0x9e7d('0x6')](),controller['getFields']);router[_0x9e7d('0xe')]('/',auth[_0x9e7d('0x6')](),controller['create']);router[_0x9e7d('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x9e7d('0xf')]);router[_0x9e7d('0x10')](_0x9e7d('0x9'),auth[_0x9e7d('0x6')](),controller[_0x9e7d('0x11')]);router['delete'](_0x9e7d('0x9'),auth[_0x9e7d('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf63f=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post','/:id/configurations','put','update','exports'];(function(_0x9e03d4,_0x569cb1){var _0xfa21b3=function(_0x429f90){while(--_0x429f90){_0x9e03d4['push'](_0x9e03d4['shift']());}};_0xfa21b3(++_0x569cb1);}(_0xf63f,0x6e));var _0xff63=function(_0x48403b,_0x3ebf54){_0x48403b=_0x48403b-0x0;var _0x36d1a3=_0xf63f[_0x48403b];return _0x36d1a3;};'use strict';var multer=require(_0xff63('0x0'));var util=require(_0xff63('0x1'));var path=require(_0xff63('0x2'));var timeout=require(_0xff63('0x3'));var express=require(_0xff63('0x4'));var router=express[_0xff63('0x5')]();var fs_extra=require(_0xff63('0x6'));var auth=require(_0xff63('0x7'));var interaction=require(_0xff63('0x8'));var config=require(_0xff63('0x9'));var controller=require('./intZendeskAccount.controller');router[_0xff63('0xa')]('/',auth[_0xff63('0xb')](),controller[_0xff63('0xc')]);router[_0xff63('0xa')](_0xff63('0xd'),auth[_0xff63('0xb')](),controller['show']);router['get']('/:id/configurations',auth[_0xff63('0xb')](),controller[_0xff63('0xe')]);router[_0xff63('0xa')](_0xff63('0xf'),auth['isAuthenticated'](),controller[_0xff63('0x10')]);router[_0xff63('0x11')]('/',auth[_0xff63('0xb')](),controller['create']);router[_0xff63('0x11')](_0xff63('0x12'),auth[_0xff63('0xb')](),controller['addConfiguration']);router[_0xff63('0x13')]('/:id',auth[_0xff63('0xb')](),controller[_0xff63('0x14')]);router['delete'](_0xff63('0xd'),auth[_0xff63('0xb')](),controller['destroy']);module[_0xff63('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 907ad49..b6912b9 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 _0x4fb4=['password','token','newTab','integrationTab','exports','STRING','username','remoteUri','ENUM'];(function(_0x2d982d,_0x121028){var _0x4f36b0=function(_0x11f3a9){while(--_0x11f3a9){_0x2d982d['push'](_0x2d982d['shift']());}};_0x4f36b0(++_0x121028);}(_0x4fb4,0x190));var _0x44fb=function(_0x48752a,_0x1b7f0e){_0x48752a=_0x48752a-0x0;var _0x384e54=_0x4fb4[_0x48752a];return _0x384e54;};'use strict';var Sequelize=require('sequelize');module[_0x44fb('0x0')]={'name':{'type':Sequelize[_0x44fb('0x1')]},'description':{'type':Sequelize[_0x44fb('0x1')]},'username':{'type':Sequelize[_0x44fb('0x1')],'unique':_0x44fb('0x2')},'password':{'type':Sequelize[_0x44fb('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x44fb('0x1')],'unique':_0x44fb('0x3')},'authType':{'type':Sequelize[_0x44fb('0x4')](_0x44fb('0x5'),_0x44fb('0x6')),'defaultValue':_0x44fb('0x5')},'serverUrl':{'type':Sequelize[_0x44fb('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x44fb('0x4')]('integrationTab',_0x44fb('0x7')),'defaultValue':_0x44fb('0x8')}}; \ No newline at end of file +var _0x6db4=['token','integrationTab','newTab','exports','STRING','username','remoteUri','ENUM','password'];(function(_0x2af8c5,_0x11b96e){var _0x207837=function(_0x3875fa){while(--_0x3875fa){_0x2af8c5['push'](_0x2af8c5['shift']());}};_0x207837(++_0x11b96e);}(_0x6db4,0x111));var _0x46db=function(_0x1ff023,_0x1b8777){_0x1ff023=_0x1ff023-0x0;var _0x12aab7=_0x6db4[_0x1ff023];return _0x12aab7;};'use strict';var Sequelize=require('sequelize');module[_0x46db('0x0')]={'name':{'type':Sequelize[_0x46db('0x1')]},'description':{'type':Sequelize[_0x46db('0x1')]},'username':{'type':Sequelize[_0x46db('0x1')],'unique':_0x46db('0x2')},'password':{'type':Sequelize[_0x46db('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x46db('0x1')],'unique':_0x46db('0x3')},'authType':{'type':Sequelize[_0x46db('0x4')](_0x46db('0x5'),_0x46db('0x6')),'defaultValue':_0x46db('0x5')},'serverUrl':{'type':Sequelize[_0x46db('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x46db('0x7'),_0x46db('0x8')),'defaultValue':_0x46db('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 89bea9c..b1eaa23 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 _0xbaf0=['findAll','rows','catch','show','params','create','body','find','getConfigurations','findOne','ZendeskConfiguration','pick','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','%s:%s','toString','headers','%s/token:%s','base64','Sequelize','ValidationError','subject','description','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','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','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','sendStatus','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','merge','where','VIRTUAL','filter','options','includeAll','include'];(function(_0x96455d,_0x4a3ea1){var _0x55555f=function(_0x5b11a7){while(--_0x5b11a7){_0x96455d['push'](_0x96455d['shift']());}};_0x55555f(++_0x4a3ea1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0baf('0x0'));var zipdir=require(_0x0baf('0x1'));var jsonpatch=require(_0x0baf('0x2'));var rp=require(_0x0baf('0x3'));var moment=require(_0x0baf('0x4'));var BPromise=require(_0x0baf('0x5'));var Mustache=require('mustache');var util=require(_0x0baf('0x6'));var path=require(_0x0baf('0x7'));var sox=require(_0x0baf('0x8'));var csv=require(_0x0baf('0x9'));var ejs=require(_0x0baf('0xa'));var fs=require('fs');var fs_extra=require(_0x0baf('0xb'));var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x0baf('0x1b'));function respondWithStatusCode(_0xe4378c,_0x5db689){_0x5db689=_0x5db689||0xcc;return function(_0x13df17){if(_0x13df17){return _0xe4378c['sendStatus'](_0x5db689);}return _0xe4378c[_0x0baf('0x1c')](_0x5db689)['end']();};}function respondWithResult(_0x1c76a8,_0x1f50c3){_0x1f50c3=_0x1f50c3||0xc8;return function(_0x7fbf67){if(_0x7fbf67){return _0x1c76a8[_0x0baf('0x1c')](_0x1f50c3)[_0x0baf('0x1d')](_0x7fbf67);}};}function respondWithFilteredResult(_0x469599,_0x4f80a8){return function(_0x4cd79d){if(_0x4cd79d){var _0x2312c7=typeof _0x4f80a8[_0x0baf('0x1e')]===_0x0baf('0x1f')&&typeof _0x4f80a8[_0x0baf('0x20')]===_0x0baf('0x1f');var _0x288a98=_0x4cd79d['count'];var _0x63c820=_0x2312c7?0x0:_0x4f80a8[_0x0baf('0x1e')];var _0x1ef0e5=_0x2312c7?_0x4cd79d[_0x0baf('0x21')]:_0x4f80a8[_0x0baf('0x1e')]+_0x4f80a8[_0x0baf('0x20')];var _0x4ff793;if(_0x1ef0e5>=_0x288a98){_0x1ef0e5=_0x288a98;_0x4ff793=0xc8;}else{_0x4ff793=0xce;}_0x469599['status'](_0x4ff793);return _0x469599[_0x0baf('0x22')](_0x0baf('0x23'),_0x63c820+'-'+_0x1ef0e5+'/'+_0x288a98)[_0x0baf('0x1d')](_0x4cd79d);}return null;};}function patchUpdates(_0x1848e8){return function(_0x1fa92b){try{jsonpatch[_0x0baf('0x24')](_0x1fa92b,_0x1848e8,!![]);}catch(_0x210cd8){return BPromise[_0x0baf('0x25')](_0x210cd8);}return _0x1fa92b[_0x0baf('0x26')]();};}function saveUpdates(_0x15a2c3,_0x54f2fa){return function(_0x334bd6){if(_0x334bd6){return _0x334bd6['update'](_0x15a2c3)[_0x0baf('0x27')](function(_0x5dbf00){return _0x5dbf00;});}return null;};}function removeEntity(_0x4de74c,_0x2ef0aa){return function(_0x48a0e9){if(_0x48a0e9){return _0x48a0e9['destroy']()[_0x0baf('0x27')](function(){_0x4de74c[_0x0baf('0x1c')](0xcc)[_0x0baf('0x28')]();});}};}function handleEntityNotFound(_0x19d9fd,_0x3a1ba1){return function(_0x56b299){if(!_0x56b299){_0x19d9fd[_0x0baf('0x29')](0x194);}return _0x56b299;};}function handleError(_0x4681c5,_0x1ca35a){_0x1ca35a=_0x1ca35a||0x1f4;return function(_0x366e71){logger[_0x0baf('0x2a')](_0x366e71[_0x0baf('0x2b')]);if(_0x366e71[_0x0baf('0x2c')]){delete _0x366e71['name'];}_0x4681c5[_0x0baf('0x1c')](_0x1ca35a)[_0x0baf('0x2d')](_0x366e71);};}exports[_0x0baf('0x2e')]=function(_0x265915,_0x55c715){var _0x29dbdf={},_0x34a58a={},_0x5d9d7f={'count':0x0,'rows':[]};var _0x44ec31=_[_0x0baf('0x2f')](db[_0x0baf('0x30')][_0x0baf('0x31')],function(_0xd14f0f){return{'name':_0xd14f0f[_0x0baf('0x32')],'type':_0xd14f0f[_0x0baf('0x33')]['key']};});_0x34a58a[_0x0baf('0x34')]=_[_0x0baf('0x2f')](_0x44ec31,_0x0baf('0x2c'));_0x34a58a[_0x0baf('0x35')]=_[_0x0baf('0x36')](_0x265915[_0x0baf('0x35')]);_0x34a58a[_0x0baf('0x37')]=_[_0x0baf('0x38')](_0x34a58a[_0x0baf('0x34')],_0x34a58a[_0x0baf('0x35')]);_0x29dbdf[_0x0baf('0x39')]=_[_0x0baf('0x38')](_0x34a58a[_0x0baf('0x34')],qs[_0x0baf('0x3a')](_0x265915['query'][_0x0baf('0x3a')]));_0x29dbdf['attributes']=_0x29dbdf[_0x0baf('0x39')][_0x0baf('0x3b')]?_0x29dbdf[_0x0baf('0x39')]:_0x34a58a[_0x0baf('0x34')];if(!_0x265915['query'][_0x0baf('0x3c')](_0x0baf('0x3d'))){_0x29dbdf['limit']=qs[_0x0baf('0x20')](_0x265915[_0x0baf('0x35')][_0x0baf('0x20')]);_0x29dbdf[_0x0baf('0x1e')]=qs[_0x0baf('0x1e')](_0x265915[_0x0baf('0x35')][_0x0baf('0x1e')]);}_0x29dbdf[_0x0baf('0x3e')]=qs['sort'](_0x265915[_0x0baf('0x35')][_0x0baf('0x3f')]);_0x29dbdf['where']=qs[_0x0baf('0x37')](_['pick'](_0x265915['query'],_0x34a58a[_0x0baf('0x37')]),_0x44ec31);if(_0x265915[_0x0baf('0x35')]['filter']){_0x29dbdf['where']=_[_0x0baf('0x40')](_0x29dbdf[_0x0baf('0x41')],{'$or':_[_0x0baf('0x2f')](_0x44ec31,function(_0xb2d9ab){if(_0xb2d9ab[_0x0baf('0x33')]!==_0x0baf('0x42')){var _0x290464={};_0x290464[_0xb2d9ab[_0x0baf('0x2c')]]={'$like':'%'+_0x265915[_0x0baf('0x35')][_0x0baf('0x43')]+'%'};return _0x290464;}})});}_0x29dbdf=_[_0x0baf('0x40')]({},_0x29dbdf,_0x265915[_0x0baf('0x44')]);var _0x354cb1={'where':_0x29dbdf[_0x0baf('0x41')]};return db['ZendeskAccount'][_0x0baf('0x21')](_0x354cb1)[_0x0baf('0x27')](function(_0x4f1de9){_0x5d9d7f[_0x0baf('0x21')]=_0x4f1de9;if(_0x265915[_0x0baf('0x35')][_0x0baf('0x45')]){_0x29dbdf[_0x0baf('0x46')]=[{'all':!![]}];}return db[_0x0baf('0x30')][_0x0baf('0x47')](_0x29dbdf);})['then'](function(_0x23ad34){_0x5d9d7f[_0x0baf('0x48')]=_0x23ad34;return _0x5d9d7f;})['then'](respondWithFilteredResult(_0x55c715,_0x29dbdf))[_0x0baf('0x49')](handleError(_0x55c715,null));};exports[_0x0baf('0x4a')]=function(_0x45c6aa,_0x57903e){var _0x504031={'raw':![],'where':{'id':_0x45c6aa[_0x0baf('0x4b')]['id']}},_0x193fd3={};_0x193fd3[_0x0baf('0x34')]=_[_0x0baf('0x36')](db[_0x0baf('0x30')][_0x0baf('0x31')]);_0x193fd3[_0x0baf('0x35')]=_[_0x0baf('0x36')](_0x45c6aa[_0x0baf('0x35')]);_0x193fd3[_0x0baf('0x37')]=_['intersection'](_0x193fd3[_0x0baf('0x34')],_0x193fd3[_0x0baf('0x35')]);_0x504031[_0x0baf('0x39')]=_[_0x0baf('0x38')](_0x193fd3[_0x0baf('0x34')],qs['fields'](_0x45c6aa[_0x0baf('0x35')][_0x0baf('0x3a')]));_0x504031[_0x0baf('0x39')]=_0x504031[_0x0baf('0x39')][_0x0baf('0x3b')]?_0x504031['attributes']:_0x193fd3[_0x0baf('0x34')];if(_0x45c6aa[_0x0baf('0x35')][_0x0baf('0x45')]){_0x504031[_0x0baf('0x46')]=[{'all':!![]}];}_0x504031=_[_0x0baf('0x40')]({},_0x504031,_0x45c6aa[_0x0baf('0x44')]);return db[_0x0baf('0x30')]['find'](_0x504031)[_0x0baf('0x27')](handleEntityNotFound(_0x57903e,null))[_0x0baf('0x27')](respondWithResult(_0x57903e,null))[_0x0baf('0x49')](handleError(_0x57903e,null));};exports['create']=function(_0x3c9de3,_0x2222b6){return db[_0x0baf('0x30')][_0x0baf('0x4c')](_0x3c9de3[_0x0baf('0x4d')],{})[_0x0baf('0x27')](respondWithResult(_0x2222b6,0xc9))[_0x0baf('0x49')](handleError(_0x2222b6,null));};exports['update']=function(_0x22c451,_0x428c9b){if(_0x22c451[_0x0baf('0x4d')]['id']){delete _0x22c451[_0x0baf('0x4d')]['id'];}return db[_0x0baf('0x30')][_0x0baf('0x4e')]({'where':{'id':_0x22c451[_0x0baf('0x4b')]['id']}})[_0x0baf('0x27')](handleEntityNotFound(_0x428c9b,null))[_0x0baf('0x27')](saveUpdates(_0x22c451[_0x0baf('0x4d')],null))[_0x0baf('0x27')](respondWithResult(_0x428c9b,null))['catch'](handleError(_0x428c9b,null));};exports['destroy']=function(_0x354329,_0x3d6b19){return db[_0x0baf('0x30')][_0x0baf('0x4e')]({'where':{'id':_0x354329[_0x0baf('0x4b')]['id']}})[_0x0baf('0x27')](handleEntityNotFound(_0x3d6b19,null))[_0x0baf('0x27')](removeEntity(_0x3d6b19,null))['catch'](handleError(_0x3d6b19,null));};exports[_0x0baf('0x4f')]=function(_0x2ef4c1,_0xf2424,_0x16d9fb){var _0x3fdb41={};var _0x1e2671={};var _0x5e1849;var _0x3eebe5;return db['ZendeskAccount'][_0x0baf('0x50')]({'where':{'id':_0x2ef4c1['params']['id']}})[_0x0baf('0x27')](handleEntityNotFound(_0xf2424,null))['then'](function(_0x35b1a5){if(_0x35b1a5){_0x5e1849=_0x35b1a5;_0x1e2671['model']=_[_0x0baf('0x36')](db[_0x0baf('0x51')][_0x0baf('0x31')]);_0x1e2671[_0x0baf('0x35')]=_[_0x0baf('0x36')](_0x2ef4c1['query']);_0x1e2671[_0x0baf('0x37')]=_[_0x0baf('0x38')](_0x1e2671[_0x0baf('0x34')],_0x1e2671[_0x0baf('0x35')]);_0x3fdb41[_0x0baf('0x39')]=_[_0x0baf('0x38')](_0x1e2671['model'],qs[_0x0baf('0x3a')](_0x2ef4c1[_0x0baf('0x35')][_0x0baf('0x3a')]));_0x3fdb41[_0x0baf('0x39')]=_0x3fdb41[_0x0baf('0x39')][_0x0baf('0x3b')]?_0x3fdb41[_0x0baf('0x39')]:_0x1e2671['model'];_0x3fdb41['order']=qs[_0x0baf('0x3f')](_0x2ef4c1[_0x0baf('0x35')][_0x0baf('0x3f')]);_0x3fdb41[_0x0baf('0x41')]=qs[_0x0baf('0x37')](_[_0x0baf('0x52')](_0x2ef4c1[_0x0baf('0x35')],_0x1e2671[_0x0baf('0x37')]));if(_0x2ef4c1[_0x0baf('0x35')]['filter']){_0x3fdb41[_0x0baf('0x41')]=_[_0x0baf('0x40')](_0x3fdb41[_0x0baf('0x41')],{'$or':_[_0x0baf('0x2f')](_0x3fdb41[_0x0baf('0x39')],function(_0xebfc0c){var _0x26f5c9={};_0x26f5c9[_0xebfc0c]={'$like':'%'+_0x2ef4c1['query'][_0x0baf('0x43')]+'%'};return _0x26f5c9;})});}_0x3fdb41=_[_0x0baf('0x40')]({},_0x3fdb41,_0x2ef4c1[_0x0baf('0x44')]);return _0x5e1849[_0x0baf('0x4f')](_0x3fdb41);}})[_0x0baf('0x27')](function(_0x1a6d22){if(_0x1a6d22){_0x3eebe5=_0x1a6d22[_0x0baf('0x3b')];if(!_0x2ef4c1[_0x0baf('0x35')]['hasOwnProperty'](_0x0baf('0x3d'))){_0x3fdb41['limit']=qs[_0x0baf('0x20')](_0x2ef4c1['query']['limit']);_0x3fdb41[_0x0baf('0x1e')]=qs['offset'](_0x2ef4c1[_0x0baf('0x35')][_0x0baf('0x1e')]);}return _0x5e1849['getConfigurations'](_0x3fdb41);}})[_0x0baf('0x27')](function(_0xfb6708){if(_0xfb6708){return _0xfb6708?{'count':_0x3eebe5,'rows':_0xfb6708}:null;}})[_0x0baf('0x27')](respondWithResult(_0xf2424,null))['catch'](handleError(_0xf2424,null));};exports['addConfiguration']=function(_0x2438df,_0x7e8946,_0x6d789f){if(_0x2438df[_0x0baf('0x4d')]['id']){delete _0x2438df[_0x0baf('0x4d')]['id'];}return db['ZendeskAccount'][_0x0baf('0x50')]({'where':{'id':_0x2438df['params']['id']}})['then'](handleEntityNotFound(_0x7e8946,null))['then'](function(_0x427ed1){if(_0x427ed1){_0x2438df['body']['AccountId']=_0x427ed1['id'];_0x2438df[_0x0baf('0x4d')][_0x0baf('0x53')]=integrations[_0x0baf('0x54')](_0x2438df[_0x0baf('0x4d')][_0x0baf('0x55')],_0x2438df[_0x0baf('0x4d')]['type']);_0x2438df[_0x0baf('0x4d')][_0x0baf('0x56')]=integrations[_0x0baf('0x57')](_0x2438df[_0x0baf('0x4d')][_0x0baf('0x55')],_0x2438df[_0x0baf('0x4d')]['type']);return db[_0x0baf('0x51')][_0x0baf('0x4c')](_0x2438df[_0x0baf('0x4d')],{'include':[{'model':db['ZendeskField'],'as':_0x0baf('0x53')},{'model':db[_0x0baf('0x58')],'as':_0x0baf('0x56')}]});}return null;})[_0x0baf('0x27')](respondWithResult(_0x7e8946,null))[_0x0baf('0x49')](handleError(_0x7e8946,null));};exports[_0x0baf('0x59')]=function(_0x4cc046,_0x5874cc,_0x54353a){var _0x4b7caa='';return db[_0x0baf('0x30')][_0x0baf('0x50')]({'where':{'id':_0x4cc046[_0x0baf('0x4b')]['id']},'attributes':['id',_0x0baf('0x5a'),_0x0baf('0x5b'),_0x0baf('0x5c'),'authType','remoteUri']})[_0x0baf('0x27')](handleEntityNotFound(_0x5874cc,null))['then'](function(_0x22cd07){if(_0x22cd07){_0x4b7caa=_0x22cd07[_0x0baf('0x5d')];var _0x4cca39=_0x4b7caa[_0x0baf('0x5e')](-0x1);if(_0x4cca39==='/'){_0x4b7caa=_0x4b7caa[_0x0baf('0x5f')](0x0,_0x4b7caa[_0x0baf('0x60')](_0x4cca39));}var _0xb1d719={'method':_0x0baf('0x61'),'uri':util[_0x0baf('0x62')](_0x0baf('0x63'),_0x4b7caa,_0x0baf('0x64')),'json':!![]};switch(_0x22cd07[_0x0baf('0x65')]){case'password':_0xb1d719['headers']={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x0baf('0x66'),_0x22cd07[_0x0baf('0x5a')],_0x22cd07[_0x0baf('0x5b')]))[_0x0baf('0x67')]('base64'))};break;case _0x0baf('0x5c'):_0xb1d719[_0x0baf('0x68')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x0baf('0x62')](_0x0baf('0x69'),_0x22cd07[_0x0baf('0x5a')],_0x22cd07[_0x0baf('0x5c')]))[_0x0baf('0x67')](_0x0baf('0x6a')))};break;default:throw new db[(_0x0baf('0x6b'))][(_0x0baf('0x6c'))]('Unknown\x20authentication\x20type');}return rp(_0xb1d719);}})[_0x0baf('0x27')](function(_0x1a3b7b){if(_0x1a3b7b){var _0x560c0f=[_0x0baf('0x6d'),_0x0baf('0x6e'),'group',_0x0baf('0x6f')];_[_0x0baf('0x70')](_0x1a3b7b[_0x0baf('0x64')],function(_0x2baede){return _0x560c0f[_0x0baf('0x71')](_0x2baede['type']);});return{'count':_0x1a3b7b['ticket_fields'][_0x0baf('0x3b')],'rows':_[_0x0baf('0x2f')](_0x1a3b7b['ticket_fields'],function(_0x28bc1c){return{'id':_0x28bc1c['id'],'name':_0x28bc1c[_0x0baf('0x72')]>0x7?_0x28bc1c[_0x0baf('0x73')]:_0x28bc1c['type'],'custom':_0x28bc1c[_0x0baf('0x72')]>0x7?!![]:![],'options':_0x28bc1c[_0x0baf('0x74')]?_0x28bc1c[_0x0baf('0x74')]:_0x28bc1c['custom_field_options']?_0x28bc1c[_0x0baf('0x75')]:[]};})};}})['then'](respondWithResult(_0x5874cc,null))[_0x0baf('0x49')](function(_0x3fee46){var _0x3fd039=_0x4cc046[_0x0baf('0x35')][_0x0baf('0x76')]?0x1f4:_0x3fee46['statusCode']||0x1f4;logger[_0x0baf('0x2a')](_0x0baf('0x77'),'getFields',_0x3fd039,JSON[_0x0baf('0x78')](_0x3fee46));delete _0x3fee46[_0x0baf('0x2c')];if(_0x3fd039===0x191){_0x3fd039=0x190;}_0x5874cc[_0x0baf('0x1c')](_0x3fd039)[_0x0baf('0x2d')](_0x4cc046[_0x0baf('0x35')][_0x0baf('0x76')]?{'message':_0x0baf('0x79'),'statusCode':_0x3fee46[_0x0baf('0x7a')]}:_0x3fee46);});}; \ No newline at end of file +var _0x5ec6=['Sequelize','ValidationError','Unknown\x20authentication\x20type','description','remove','includes','title','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','body','findOne','ZendeskConfiguration','length','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','Basic\x20%s','%s:%s','toString','base64','headers'];(function(_0x5c2aa6,_0x21c6d1){var _0x16b380=function(_0x243ea9){while(--_0x243ea9){_0x5c2aa6['push'](_0x5c2aa6['shift']());}};_0x16b380(++_0x21c6d1);}(_0x5ec6,0x7f));var _0x65ec=function(_0x78ee46,_0x3c3a0c){_0x78ee46=_0x78ee46-0x0;var _0x57438a=_0x5ec6[_0x78ee46];return _0x57438a;};'use strict';var emlformat=require(_0x65ec('0x0'));var rimraf=require(_0x65ec('0x1'));var zipdir=require(_0x65ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x65ec('0x3'));var moment=require('moment');var BPromise=require(_0x65ec('0x4'));var Mustache=require('mustache');var util=require(_0x65ec('0x5'));var path=require('path');var sox=require(_0x65ec('0x6'));var csv=require('to-csv');var ejs=require(_0x65ec('0x7'));var fs=require('fs');var fs_extra=require(_0x65ec('0x8'));var _=require('lodash');var squel=require(_0x65ec('0x9'));var crypto=require(_0x65ec('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x65ec('0xb'));var toCsv=require(_0x65ec('0xc'));var querystring=require(_0x65ec('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65ec('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x65ec('0xf'));var hardwareService=require(_0x65ec('0x10'));var logger=require('../../config/logger')(_0x65ec('0x11'));var utils=require(_0x65ec('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x65ec('0x13'));var db=require(_0x65ec('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3e52c8,_0x2af7d6){_0x2af7d6=_0x2af7d6||0xcc;return function(_0x411a7b){if(_0x411a7b){return _0x3e52c8[_0x65ec('0x15')](_0x2af7d6);}return _0x3e52c8[_0x65ec('0x16')](_0x2af7d6)[_0x65ec('0x17')]();};}function respondWithResult(_0x344724,_0x3edbfd){_0x3edbfd=_0x3edbfd||0xc8;return function(_0x58c81f){if(_0x58c81f){return _0x344724[_0x65ec('0x16')](_0x3edbfd)[_0x65ec('0x18')](_0x58c81f);}};}function respondWithFilteredResult(_0x35d06b,_0x4bbe88){return function(_0x5a0442){if(_0x5a0442){var _0x25cdd4=typeof _0x4bbe88[_0x65ec('0x19')]===_0x65ec('0x1a')&&typeof _0x4bbe88['limit']===_0x65ec('0x1a');var _0x286eac=_0x5a0442[_0x65ec('0x1b')];var _0xb4ed90=_0x25cdd4?0x0:_0x4bbe88[_0x65ec('0x19')];var _0xd81ed3=_0x25cdd4?_0x5a0442[_0x65ec('0x1b')]:_0x4bbe88[_0x65ec('0x19')]+_0x4bbe88[_0x65ec('0x1c')];var _0x441ad0;if(_0xd81ed3>=_0x286eac){_0xd81ed3=_0x286eac;_0x441ad0=0xc8;}else{_0x441ad0=0xce;}_0x35d06b[_0x65ec('0x16')](_0x441ad0);return _0x35d06b[_0x65ec('0x1d')](_0x65ec('0x1e'),_0xb4ed90+'-'+_0xd81ed3+'/'+_0x286eac)[_0x65ec('0x18')](_0x5a0442);}return null;};}function patchUpdates(_0x3804a4){return function(_0x1d538c){try{jsonpatch[_0x65ec('0x1f')](_0x1d538c,_0x3804a4,!![]);}catch(_0x130d4e){return BPromise[_0x65ec('0x20')](_0x130d4e);}return _0x1d538c['save']();};}function saveUpdates(_0x170703,_0x297fba){return function(_0x89e640){if(_0x89e640){return _0x89e640[_0x65ec('0x21')](_0x170703)[_0x65ec('0x22')](function(_0x163e55){return _0x163e55;});}return null;};}function removeEntity(_0x47288d,_0x58239f){return function(_0xf1ff97){if(_0xf1ff97){return _0xf1ff97[_0x65ec('0x23')]()[_0x65ec('0x22')](function(){_0x47288d[_0x65ec('0x16')](0xcc)[_0x65ec('0x17')]();});}};}function handleEntityNotFound(_0x156793,_0x21426b){return function(_0xf5adc7){if(!_0xf5adc7){_0x156793[_0x65ec('0x15')](0x194);}return _0xf5adc7;};}function handleError(_0x4c846b,_0x10baef){_0x10baef=_0x10baef||0x1f4;return function(_0x30f0cf){logger[_0x65ec('0x24')](_0x30f0cf[_0x65ec('0x25')]);if(_0x30f0cf['name']){delete _0x30f0cf[_0x65ec('0x26')];}_0x4c846b['status'](_0x10baef)[_0x65ec('0x27')](_0x30f0cf);};}exports[_0x65ec('0x28')]=function(_0x1d0b5c,_0x30366c){var _0x14431d={},_0x46d4c1={},_0x46bf66={'count':0x0,'rows':[]};var _0x39410f=_[_0x65ec('0x29')](db[_0x65ec('0x2a')][_0x65ec('0x2b')],function(_0x4b435c){return{'name':_0x4b435c['fieldName'],'type':_0x4b435c[_0x65ec('0x2c')]['key']};});_0x46d4c1[_0x65ec('0x2d')]=_[_0x65ec('0x29')](_0x39410f,'name');_0x46d4c1[_0x65ec('0x2e')]=_[_0x65ec('0x2f')](_0x1d0b5c[_0x65ec('0x2e')]);_0x46d4c1[_0x65ec('0x30')]=_['intersection'](_0x46d4c1[_0x65ec('0x2d')],_0x46d4c1[_0x65ec('0x2e')]);_0x14431d[_0x65ec('0x31')]=_[_0x65ec('0x32')](_0x46d4c1[_0x65ec('0x2d')],qs[_0x65ec('0x33')](_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x33')]));_0x14431d[_0x65ec('0x31')]=_0x14431d[_0x65ec('0x31')]['length']?_0x14431d[_0x65ec('0x31')]:_0x46d4c1[_0x65ec('0x2d')];if(!_0x1d0b5c['query'][_0x65ec('0x34')](_0x65ec('0x35'))){_0x14431d[_0x65ec('0x1c')]=qs[_0x65ec('0x1c')](_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x1c')]);_0x14431d[_0x65ec('0x19')]=qs['offset'](_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x19')]);}_0x14431d[_0x65ec('0x36')]=qs[_0x65ec('0x37')](_0x1d0b5c['query'][_0x65ec('0x37')]);_0x14431d[_0x65ec('0x38')]=qs[_0x65ec('0x30')](_[_0x65ec('0x39')](_0x1d0b5c['query'],_0x46d4c1['filters']),_0x39410f);if(_0x1d0b5c[_0x65ec('0x2e')]['filter']){_0x14431d[_0x65ec('0x38')]=_[_0x65ec('0x3a')](_0x14431d['where'],{'$or':_[_0x65ec('0x29')](_0x39410f,function(_0x1fbc2b){if(_0x1fbc2b[_0x65ec('0x2c')]!==_0x65ec('0x3b')){var _0x3cffbf={};_0x3cffbf[_0x1fbc2b[_0x65ec('0x26')]]={'$like':'%'+_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x3c')]+'%'};return _0x3cffbf;}})});}_0x14431d=_[_0x65ec('0x3a')]({},_0x14431d,_0x1d0b5c[_0x65ec('0x3d')]);var _0x3561ef={'where':_0x14431d['where']};return db[_0x65ec('0x2a')]['count'](_0x3561ef)[_0x65ec('0x22')](function(_0x278d43){_0x46bf66[_0x65ec('0x1b')]=_0x278d43;if(_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x3e')]){_0x14431d[_0x65ec('0x3f')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x65ec('0x40')](_0x14431d);})['then'](function(_0x5d8d57){_0x46bf66[_0x65ec('0x41')]=_0x5d8d57;return _0x46bf66;})[_0x65ec('0x22')](respondWithFilteredResult(_0x30366c,_0x14431d))[_0x65ec('0x42')](handleError(_0x30366c,null));};exports[_0x65ec('0x43')]=function(_0x1d475e,_0x524235){var _0x4843ca={'raw':![],'where':{'id':_0x1d475e[_0x65ec('0x44')]['id']}},_0x1aef6d={};_0x1aef6d[_0x65ec('0x2d')]=_[_0x65ec('0x2f')](db[_0x65ec('0x2a')]['rawAttributes']);_0x1aef6d['query']=_[_0x65ec('0x2f')](_0x1d475e[_0x65ec('0x2e')]);_0x1aef6d[_0x65ec('0x30')]=_[_0x65ec('0x32')](_0x1aef6d[_0x65ec('0x2d')],_0x1aef6d[_0x65ec('0x2e')]);_0x4843ca[_0x65ec('0x31')]=_['intersection'](_0x1aef6d[_0x65ec('0x2d')],qs[_0x65ec('0x33')](_0x1d475e[_0x65ec('0x2e')]['fields']));_0x4843ca[_0x65ec('0x31')]=_0x4843ca[_0x65ec('0x31')]['length']?_0x4843ca[_0x65ec('0x31')]:_0x1aef6d[_0x65ec('0x2d')];if(_0x1d475e[_0x65ec('0x2e')][_0x65ec('0x3e')]){_0x4843ca[_0x65ec('0x3f')]=[{'all':!![]}];}_0x4843ca=_['merge']({},_0x4843ca,_0x1d475e[_0x65ec('0x3d')]);return db[_0x65ec('0x2a')][_0x65ec('0x45')](_0x4843ca)[_0x65ec('0x22')](handleEntityNotFound(_0x524235,null))['then'](respondWithResult(_0x524235,null))[_0x65ec('0x42')](handleError(_0x524235,null));};exports['create']=function(_0x1ed0f9,_0x169890){return db[_0x65ec('0x2a')]['create'](_0x1ed0f9['body'],{})[_0x65ec('0x22')](respondWithResult(_0x169890,0xc9))[_0x65ec('0x42')](handleError(_0x169890,null));};exports[_0x65ec('0x21')]=function(_0x2111af,_0x1b3732){if(_0x2111af[_0x65ec('0x46')]['id']){delete _0x2111af[_0x65ec('0x46')]['id'];}return db[_0x65ec('0x2a')][_0x65ec('0x45')]({'where':{'id':_0x2111af[_0x65ec('0x44')]['id']}})[_0x65ec('0x22')](handleEntityNotFound(_0x1b3732,null))[_0x65ec('0x22')](saveUpdates(_0x2111af[_0x65ec('0x46')],null))[_0x65ec('0x22')](respondWithResult(_0x1b3732,null))[_0x65ec('0x42')](handleError(_0x1b3732,null));};exports[_0x65ec('0x23')]=function(_0x22c28c,_0x5eb6d3){return db[_0x65ec('0x2a')][_0x65ec('0x45')]({'where':{'id':_0x22c28c['params']['id']}})[_0x65ec('0x22')](handleEntityNotFound(_0x5eb6d3,null))[_0x65ec('0x22')](removeEntity(_0x5eb6d3,null))[_0x65ec('0x42')](handleError(_0x5eb6d3,null));};exports['getConfigurations']=function(_0x3eee1e,_0x2b2756,_0x27843b){var _0x50f1c3={};var _0xabb4e3={};var _0x5e5e48;var _0x4c9905;return db[_0x65ec('0x2a')][_0x65ec('0x47')]({'where':{'id':_0x3eee1e[_0x65ec('0x44')]['id']}})['then'](handleEntityNotFound(_0x2b2756,null))[_0x65ec('0x22')](function(_0x28a686){if(_0x28a686){_0x5e5e48=_0x28a686;_0xabb4e3[_0x65ec('0x2d')]=_[_0x65ec('0x2f')](db[_0x65ec('0x48')][_0x65ec('0x2b')]);_0xabb4e3[_0x65ec('0x2e')]=_[_0x65ec('0x2f')](_0x3eee1e[_0x65ec('0x2e')]);_0xabb4e3['filters']=_['intersection'](_0xabb4e3[_0x65ec('0x2d')],_0xabb4e3['query']);_0x50f1c3[_0x65ec('0x31')]=_['intersection'](_0xabb4e3[_0x65ec('0x2d')],qs[_0x65ec('0x33')](_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x33')]));_0x50f1c3[_0x65ec('0x31')]=_0x50f1c3[_0x65ec('0x31')][_0x65ec('0x49')]?_0x50f1c3['attributes']:_0xabb4e3[_0x65ec('0x2d')];_0x50f1c3[_0x65ec('0x36')]=qs[_0x65ec('0x37')](_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x37')]);_0x50f1c3['where']=qs[_0x65ec('0x30')](_[_0x65ec('0x39')](_0x3eee1e[_0x65ec('0x2e')],_0xabb4e3[_0x65ec('0x30')]));if(_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x3c')]){_0x50f1c3[_0x65ec('0x38')]=_[_0x65ec('0x3a')](_0x50f1c3['where'],{'$or':_[_0x65ec('0x29')](_0x50f1c3[_0x65ec('0x31')],function(_0x12bb9b){var _0x233b9b={};_0x233b9b[_0x12bb9b]={'$like':'%'+_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x3c')]+'%'};return _0x233b9b;})});}_0x50f1c3=_[_0x65ec('0x3a')]({},_0x50f1c3,_0x3eee1e['options']);return _0x5e5e48['getConfigurations'](_0x50f1c3);}})[_0x65ec('0x22')](function(_0x56dd47){if(_0x56dd47){_0x4c9905=_0x56dd47[_0x65ec('0x49')];if(!_0x3eee1e[_0x65ec('0x2e')]['hasOwnProperty'](_0x65ec('0x35'))){_0x50f1c3[_0x65ec('0x1c')]=qs[_0x65ec('0x1c')](_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x1c')]);_0x50f1c3[_0x65ec('0x19')]=qs[_0x65ec('0x19')](_0x3eee1e['query']['offset']);}return _0x5e5e48[_0x65ec('0x4a')](_0x50f1c3);}})[_0x65ec('0x22')](function(_0xd14e5){if(_0xd14e5){return _0xd14e5?{'count':_0x4c9905,'rows':_0xd14e5}:null;}})['then'](respondWithResult(_0x2b2756,null))[_0x65ec('0x42')](handleError(_0x2b2756,null));};exports[_0x65ec('0x4b')]=function(_0x17059d,_0x3d761f,_0x21096d){if(_0x17059d[_0x65ec('0x46')]['id']){delete _0x17059d[_0x65ec('0x46')]['id'];}return db['ZendeskAccount'][_0x65ec('0x47')]({'where':{'id':_0x17059d[_0x65ec('0x44')]['id']}})[_0x65ec('0x22')](handleEntityNotFound(_0x3d761f,null))[_0x65ec('0x22')](function(_0x3da824){if(_0x3da824){_0x17059d[_0x65ec('0x46')][_0x65ec('0x4c')]=_0x3da824['id'];_0x17059d[_0x65ec('0x46')][_0x65ec('0x4d')]=integrations['getSubjects'](_0x17059d['body'][_0x65ec('0x4e')],_0x17059d['body']['type']);_0x17059d[_0x65ec('0x46')][_0x65ec('0x4f')]=integrations[_0x65ec('0x50')](_0x17059d['body']['channel'],_0x17059d[_0x65ec('0x46')]['type']);return db['ZendeskConfiguration']['create'](_0x17059d[_0x65ec('0x46')],{'include':[{'model':db['ZendeskField'],'as':_0x65ec('0x4d')},{'model':db[_0x65ec('0x51')],'as':_0x65ec('0x4f')}]});}return null;})['then'](respondWithResult(_0x3d761f,null))['catch'](handleError(_0x3d761f,null));};exports[_0x65ec('0x52')]=function(_0x54f1cb,_0x244d12,_0x1c2972){var _0xf78f6a='';return db[_0x65ec('0x2a')][_0x65ec('0x47')]({'where':{'id':_0x54f1cb[_0x65ec('0x44')]['id']},'attributes':['id',_0x65ec('0x53'),_0x65ec('0x54'),_0x65ec('0x55'),_0x65ec('0x56'),'remoteUri']})[_0x65ec('0x22')](handleEntityNotFound(_0x244d12,null))['then'](function(_0x46e454){if(_0x46e454){_0xf78f6a=_0x46e454[_0x65ec('0x57')];var _0x292f81=_0xf78f6a[_0x65ec('0x58')](-0x1);if(_0x292f81==='/'){_0xf78f6a=_0xf78f6a['substring'](0x0,_0xf78f6a[_0x65ec('0x59')](_0x292f81));}var _0x556c5e={'method':_0x65ec('0x5a'),'uri':util[_0x65ec('0x5b')](_0x65ec('0x5c'),_0xf78f6a,_0x65ec('0x5d')),'json':!![]};switch(_0x46e454['authType']){case'password':_0x556c5e['headers']={'Authorization':util[_0x65ec('0x5b')](_0x65ec('0x5e'),new Buffer(util[_0x65ec('0x5b')](_0x65ec('0x5f'),_0x46e454[_0x65ec('0x53')],_0x46e454[_0x65ec('0x54')]))[_0x65ec('0x60')](_0x65ec('0x61')))};break;case _0x65ec('0x55'):_0x556c5e[_0x65ec('0x62')]={'Authorization':util[_0x65ec('0x5b')](_0x65ec('0x5e'),new Buffer(util[_0x65ec('0x5b')]('%s/token:%s',_0x46e454[_0x65ec('0x53')],_0x46e454[_0x65ec('0x55')]))[_0x65ec('0x60')](_0x65ec('0x61')))};break;default:throw new db[(_0x65ec('0x63'))][(_0x65ec('0x64'))](_0x65ec('0x65'));}return rp(_0x556c5e);}})[_0x65ec('0x22')](function(_0x3b5640){if(_0x3b5640){var _0x26ac0e=['subject',_0x65ec('0x66'),'group','assignee'];_[_0x65ec('0x67')](_0x3b5640[_0x65ec('0x5d')],function(_0x272432){return _0x26ac0e[_0x65ec('0x68')](_0x272432[_0x65ec('0x2c')]);});return{'count':_0x3b5640[_0x65ec('0x5d')][_0x65ec('0x49')],'rows':_[_0x65ec('0x29')](_0x3b5640['ticket_fields'],function(_0x1f5fe7){return{'id':_0x1f5fe7['id'],'name':_0x1f5fe7['position']>0x7?_0x1f5fe7[_0x65ec('0x69')]:_0x1f5fe7[_0x65ec('0x2c')],'custom':_0x1f5fe7[_0x65ec('0x6a')]>0x7?!![]:![],'options':_0x1f5fe7['system_field_options']?_0x1f5fe7[_0x65ec('0x6b')]:_0x1f5fe7[_0x65ec('0x6c')]?_0x1f5fe7[_0x65ec('0x6c')]:[]};})};}})[_0x65ec('0x22')](respondWithResult(_0x244d12,null))[_0x65ec('0x42')](function(_0x77ebd2){var _0x1172f3=_0x54f1cb['query'][_0x65ec('0x6d')]?0x1f4:_0x77ebd2[_0x65ec('0x6e')]||0x1f4;logger[_0x65ec('0x24')](_0x65ec('0x6f'),'getFields',_0x1172f3,JSON['stringify'](_0x77ebd2));delete _0x77ebd2[_0x65ec('0x26')];if(_0x1172f3===0x191){_0x1172f3=0x190;}_0x244d12[_0x65ec('0x16')](_0x1172f3)[_0x65ec('0x27')](_0x54f1cb[_0x65ec('0x2e')][_0x65ec('0x6d')]?{'message':_0x65ec('0x70'),'statusCode':_0x77ebd2['statusCode']}:_0x77ebd2);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index f49acf7..4b4104a 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 _0xfbb9=['api','moment','bluebird','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xfbb9,0xc1));var _0x9fbb=function(_0x1463a8,_0x576608){_0x1463a8=_0x1463a8-0x0;var _0x390de9=_0xfbb9[_0x1463a8];return _0x390de9;};'use strict';var _=require(_0x9fbb('0x0'));var util=require('util');var logger=require(_0x9fbb('0x1'))(_0x9fbb('0x2'));var moment=require(_0x9fbb('0x3'));var BPromise=require(_0x9fbb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9fbb('0x5'));var rimraf=require(_0x9fbb('0x6'));var config=require('../../config/environment');var attributes=require(_0x9fbb('0x7'));var integrations=require(_0x9fbb('0x8'));module[_0x9fbb('0x9')]=function(_0xa9ff1,_0x552219){return _0xa9ff1[_0x9fbb('0xa')](_0x9fbb('0xb'),attributes,{'tableName':_0x9fbb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc180=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','lodash'];(function(_0x1f635d,_0xfdd12b){var _0x1c2f4c=function(_0x190c69){while(--_0x190c69){_0x1f635d['push'](_0x1f635d['shift']());}};_0x1c2f4c(++_0xfdd12b);}(_0xc180,0x15e));var _0x0c18=function(_0x31cc93,_0x5e326a){_0x31cc93=_0x31cc93-0x0;var _0x10af8c=_0xc180[_0x31cc93];return _0x10af8c;};'use strict';var _=require(_0x0c18('0x0'));var util=require(_0x0c18('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0c18('0x2'));var BPromise=require(_0x0c18('0x3'));var rp=require(_0x0c18('0x4'));var fs=require('fs');var path=require(_0x0c18('0x5'));var rimraf=require(_0x0c18('0x6'));var config=require(_0x0c18('0x7'));var attributes=require(_0x0c18('0x8'));var integrations=require(_0x0c18('0x9'));module[_0x0c18('0xa')]=function(_0x1e678f,_0x10d321){return _0x1e678f[_0x0c18('0xb')](_0x0c18('0xc'),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 0743b57..a274edc 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 _0x2369=['catch','GetZendeskAccount','findAll','options','attributes','limit','map','include','model','ShowZendeskAccount','raw','where','then','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x55cdc5,_0x2b2297){var _0x29acd5=function(_0x405234){while(--_0x405234){_0x55cdc5['push'](_0x55cdc5['shift']());}};_0x29acd5(++_0x2b2297);}(_0x2369,0xed));var _0x9236=function(_0x336f5d,_0x7770c2){_0x336f5d=_0x336f5d-0x0;var _0x1d8289=_0x2369[_0x336f5d];return _0x1d8289;};'use strict';var _=require('lodash');var util=require(_0x9236('0x0'));var moment=require(_0x9236('0x1'));var BPromise=require(_0x9236('0x2'));var rs=require(_0x9236('0x3'));var fs=require('fs');var Redis=require(_0x9236('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9236('0x5'));var logger=require('../../config/logger')(_0x9236('0x6'));var config=require(_0x9236('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9236('0x8')][_0x9236('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f44e2,_0x15e19,_0x28227c){return new BPromise(function(_0x5be788,_0x331421){return client[_0x9236('0xa')](_0x5f44e2,_0x28227c)['then'](function(_0xa80215){logger[_0x9236('0xb')](_0x9236('0xc'),_0x15e19,_0x9236('0xd'));logger[_0x9236('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x15e19,'request\x20sent',JSON[_0x9236('0xf')](_0xa80215));if(_0xa80215[_0x9236('0x10')]){if(_0xa80215[_0x9236('0x10')][_0x9236('0x11')]===0x1f4){logger[_0x9236('0x10')](_0x9236('0xc'),_0x15e19,_0xa80215[_0x9236('0x10')][_0x9236('0x12')]);return _0x331421(_0xa80215['error'][_0x9236('0x12')]);}logger[_0x9236('0x10')](_0x9236('0xc'),_0x15e19,_0xa80215[_0x9236('0x10')][_0x9236('0x12')]);return _0x5be788(_0xa80215[_0x9236('0x10')]['message']);}else{logger[_0x9236('0xb')](_0x9236('0xc'),_0x15e19,'request\x20sent');_0x5be788(_0xa80215['result'][_0x9236('0x12')]);}})[_0x9236('0x13')](function(_0x43254a){logger[_0x9236('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x15e19,_0x43254a);_0x331421(_0x43254a);});});}exports[_0x9236('0x14')]=function(_0x18877d){var _0x4a8598=this;return new Promise(function(_0x44d522,_0x4596ef){return db['ZendeskAccount'][_0x9236('0x15')]({'raw':_0x18877d[_0x9236('0x16')]?_0x18877d[_0x9236('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x18877d[_0x9236('0x16')]?_0x18877d[_0x9236('0x16')]['where']||null:null,'attributes':_0x18877d['options']?_0x18877d[_0x9236('0x16')][_0x9236('0x17')]||null:null,'limit':_0x18877d['options']?_0x18877d['options'][_0x9236('0x18')]||null:null,'include':_0x18877d[_0x9236('0x16')]?_0x18877d[_0x9236('0x16')]['include']?_[_0x9236('0x19')](_0x18877d[_0x9236('0x16')][_0x9236('0x1a')],function(_0x121df4){return{'model':db[_0x121df4['model']],'as':_0x121df4['as'],'attributes':_0x121df4[_0x9236('0x17')],'include':_0x121df4[_0x9236('0x1a')]?_['map'](_0x121df4[_0x9236('0x1a')],function(_0x4ea62b){return{'model':db[_0x4ea62b[_0x9236('0x1b')]],'as':_0x4ea62b['as'],'attributes':_0x4ea62b[_0x9236('0x17')],'include':_0x4ea62b['include']?_[_0x9236('0x19')](_0x4ea62b[_0x9236('0x1a')],function(_0x2d6b4c){return{'model':db[_0x2d6b4c[_0x9236('0x1b')]],'as':_0x2d6b4c['as'],'attributes':_0x2d6b4c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x40b71d){logger[_0x9236('0xb')](_0x9236('0x14'),_0x18877d);logger[_0x9236('0xe')]('GetZendeskAccount',_0x18877d,JSON[_0x9236('0xf')](_0x40b71d));_0x44d522(_0x40b71d);})[_0x9236('0x13')](function(_0x3cf298){logger['error'](_0x9236('0x14'),_0x3cf298[_0x9236('0x12')],_0x18877d);_0x4596ef(_0x4a8598[_0x9236('0x10')](0x1f4,_0x3cf298[_0x9236('0x12')]));});});};exports[_0x9236('0x1c')]=function(_0x5ed298){var _0x1dbf79=this;return new Promise(function(_0x5684df,_0x1ae291){return db['ZendeskAccount']['find']({'raw':_0x5ed298[_0x9236('0x16')]?_0x5ed298[_0x9236('0x16')][_0x9236('0x1d')]===undefined?!![]:![]:!![],'where':_0x5ed298[_0x9236('0x16')]?_0x5ed298[_0x9236('0x16')][_0x9236('0x1e')]||null:null,'attributes':_0x5ed298[_0x9236('0x16')]?_0x5ed298[_0x9236('0x16')][_0x9236('0x17')]||null:null,'include':_0x5ed298['options']?_0x5ed298[_0x9236('0x16')][_0x9236('0x1a')]?_[_0x9236('0x19')](_0x5ed298[_0x9236('0x16')][_0x9236('0x1a')],function(_0x5e6ddd){return{'model':db[_0x5e6ddd[_0x9236('0x1b')]],'as':_0x5e6ddd['as'],'attributes':_0x5e6ddd[_0x9236('0x17')],'include':_0x5e6ddd[_0x9236('0x1a')]?_[_0x9236('0x19')](_0x5e6ddd[_0x9236('0x1a')],function(_0x3ea1eb){return{'model':db[_0x3ea1eb[_0x9236('0x1b')]],'as':_0x3ea1eb['as'],'attributes':_0x3ea1eb[_0x9236('0x17')],'include':_0x3ea1eb[_0x9236('0x1a')]?_[_0x9236('0x19')](_0x3ea1eb[_0x9236('0x1a')],function(_0x306596){return{'model':db[_0x306596[_0x9236('0x1b')]],'as':_0x306596['as'],'attributes':_0x306596[_0x9236('0x17')]};}):[]};}):[]};}):[]:[]})[_0x9236('0x1f')](function(_0x1e350f){logger[_0x9236('0xb')](_0x9236('0x1c'),_0x5ed298);logger[_0x9236('0xe')](_0x9236('0x1c'),_0x5ed298,JSON[_0x9236('0xf')](_0x1e350f));_0x5684df(_0x1e350f);})[_0x9236('0x13')](function(_0x2adc04){logger['error'](_0x9236('0x1c'),_0x2adc04['message'],_0x5ed298);_0x1ae291(_0x1dbf79[_0x9236('0x10')](0x1f4,_0x2adc04[_0x9236('0x12')]));});});}; \ No newline at end of file +var _0xd4f7=['raw','where','attributes','limit','include','map','model','ShowZendeskAccount','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options'];(function(_0xee2e7a,_0x58354d){var _0x319dd3=function(_0xa99240){while(--_0xa99240){_0xee2e7a['push'](_0xee2e7a['shift']());}};_0x319dd3(++_0x58354d);}(_0xd4f7,0x8c));var _0x7d4f=function(_0x541a67,_0x50728d){_0x541a67=_0x541a67-0x0;var _0x45da2a=_0xd4f7[_0x541a67];return _0x45da2a;};'use strict';var _=require(_0x7d4f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7d4f('0x1'));var rs=require(_0x7d4f('0x2'));var fs=require('fs');var Redis=require(_0x7d4f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7d4f('0x4'));var logger=require('../../config/logger')(_0x7d4f('0x5'));var config=require('../../config/environment');var jayson=require(_0x7d4f('0x6'));var client=jayson[_0x7d4f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4115f2,_0x322c03,_0x11da9c){return new BPromise(function(_0x250c28,_0x80ba6a){return client[_0x7d4f('0x8')](_0x4115f2,_0x11da9c)[_0x7d4f('0x9')](function(_0x173fd7){logger[_0x7d4f('0xa')]('ZendeskAccount,\x20%s,\x20%s',_0x322c03,_0x7d4f('0xb'));logger[_0x7d4f('0xc')](_0x7d4f('0xd'),_0x322c03,_0x7d4f('0xb'),JSON[_0x7d4f('0xe')](_0x173fd7));if(_0x173fd7[_0x7d4f('0xf')]){if(_0x173fd7[_0x7d4f('0xf')][_0x7d4f('0x10')]===0x1f4){logger[_0x7d4f('0xf')](_0x7d4f('0x11'),_0x322c03,_0x173fd7[_0x7d4f('0xf')]['message']);return _0x80ba6a(_0x173fd7[_0x7d4f('0xf')][_0x7d4f('0x12')]);}logger[_0x7d4f('0xf')](_0x7d4f('0x11'),_0x322c03,_0x173fd7['error'][_0x7d4f('0x12')]);return _0x250c28(_0x173fd7[_0x7d4f('0xf')][_0x7d4f('0x12')]);}else{logger[_0x7d4f('0xa')](_0x7d4f('0x11'),_0x322c03,_0x7d4f('0xb'));_0x250c28(_0x173fd7[_0x7d4f('0x13')][_0x7d4f('0x12')]);}})[_0x7d4f('0x14')](function(_0xa9a282){logger['error'](_0x7d4f('0x11'),_0x322c03,_0xa9a282);_0x80ba6a(_0xa9a282);});});}exports[_0x7d4f('0x15')]=function(_0x4233fd){var _0x3042e5=this;return new Promise(function(_0x48afa9,_0x555507){return db[_0x7d4f('0x16')][_0x7d4f('0x17')]({'raw':_0x4233fd[_0x7d4f('0x18')]?_0x4233fd['options'][_0x7d4f('0x19')]===undefined?!![]:![]:!![],'where':_0x4233fd['options']?_0x4233fd[_0x7d4f('0x18')][_0x7d4f('0x1a')]||null:null,'attributes':_0x4233fd[_0x7d4f('0x18')]?_0x4233fd[_0x7d4f('0x18')][_0x7d4f('0x1b')]||null:null,'limit':_0x4233fd[_0x7d4f('0x18')]?_0x4233fd[_0x7d4f('0x18')][_0x7d4f('0x1c')]||null:null,'include':_0x4233fd[_0x7d4f('0x18')]?_0x4233fd[_0x7d4f('0x18')][_0x7d4f('0x1d')]?_[_0x7d4f('0x1e')](_0x4233fd[_0x7d4f('0x18')][_0x7d4f('0x1d')],function(_0x37faaf){return{'model':db[_0x37faaf[_0x7d4f('0x1f')]],'as':_0x37faaf['as'],'attributes':_0x37faaf['attributes'],'include':_0x37faaf['include']?_[_0x7d4f('0x1e')](_0x37faaf[_0x7d4f('0x1d')],function(_0x265d84){return{'model':db[_0x265d84[_0x7d4f('0x1f')]],'as':_0x265d84['as'],'attributes':_0x265d84[_0x7d4f('0x1b')],'include':_0x265d84['include']?_[_0x7d4f('0x1e')](_0x265d84['include'],function(_0x1791ea){return{'model':db[_0x1791ea[_0x7d4f('0x1f')]],'as':_0x1791ea['as'],'attributes':_0x1791ea['attributes']};}):[]};}):[]};}):[]:[]})[_0x7d4f('0x9')](function(_0x342dd7){logger[_0x7d4f('0xa')]('GetZendeskAccount',_0x4233fd);logger[_0x7d4f('0xc')]('GetZendeskAccount',_0x4233fd,JSON[_0x7d4f('0xe')](_0x342dd7));_0x48afa9(_0x342dd7);})[_0x7d4f('0x14')](function(_0x1cb327){logger[_0x7d4f('0xf')]('GetZendeskAccount',_0x1cb327[_0x7d4f('0x12')],_0x4233fd);_0x555507(_0x3042e5[_0x7d4f('0xf')](0x1f4,_0x1cb327['message']));});});};exports['ShowZendeskAccount']=function(_0x22934e){var _0x49f18b=this;return new Promise(function(_0x135d41,_0x25e177){return db[_0x7d4f('0x16')]['find']({'raw':_0x22934e[_0x7d4f('0x18')]?_0x22934e['options'][_0x7d4f('0x19')]===undefined?!![]:![]:!![],'where':_0x22934e['options']?_0x22934e[_0x7d4f('0x18')][_0x7d4f('0x1a')]||null:null,'attributes':_0x22934e[_0x7d4f('0x18')]?_0x22934e['options'][_0x7d4f('0x1b')]||null:null,'include':_0x22934e['options']?_0x22934e[_0x7d4f('0x18')][_0x7d4f('0x1d')]?_[_0x7d4f('0x1e')](_0x22934e[_0x7d4f('0x18')][_0x7d4f('0x1d')],function(_0x5865db){return{'model':db[_0x5865db[_0x7d4f('0x1f')]],'as':_0x5865db['as'],'attributes':_0x5865db['attributes'],'include':_0x5865db['include']?_[_0x7d4f('0x1e')](_0x5865db['include'],function(_0xc8acea){return{'model':db[_0xc8acea['model']],'as':_0xc8acea['as'],'attributes':_0xc8acea[_0x7d4f('0x1b')],'include':_0xc8acea[_0x7d4f('0x1d')]?_[_0x7d4f('0x1e')](_0xc8acea[_0x7d4f('0x1d')],function(_0x28f464){return{'model':db[_0x28f464[_0x7d4f('0x1f')]],'as':_0x28f464['as'],'attributes':_0x28f464['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4cbc9d){logger[_0x7d4f('0xa')]('ShowZendeskAccount',_0x22934e);logger[_0x7d4f('0xc')](_0x7d4f('0x20'),_0x22934e,JSON['stringify'](_0x4cbc9d));_0x135d41(_0x4cbc9d);})[_0x7d4f('0x14')](function(_0x2afd03){logger[_0x7d4f('0xf')](_0x7d4f('0x20'),_0x2afd03[_0x7d4f('0x12')],_0x22934e);_0x25e177(_0x49f18b[_0x7d4f('0xf')](0x1f4,_0x2afd03[_0x7d4f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 373b118..4ffaf16 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 _0xb688=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','update','exports','util'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xb688,0xcf));var _0x8b68=function(_0x5b6987,_0x3a42e0){_0x5b6987=_0x5b6987-0x0;var _0x4e7fe9=_0xb688[_0x5b6987];return _0x4e7fe9;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0x9')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x9')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x9')](_0x8b68('0x12'),auth['isAuthenticated'](),controller[_0x8b68('0x13')]);router[_0x8b68('0x9')](_0x8b68('0x14'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x15')]);router[_0x8b68('0x16')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0x17')]);router[_0x8b68('0x16')]('/:id/tags',auth[_0x8b68('0xc')](),controller['setTags']);router['put'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x18')]);router['delete']('/:id',auth[_0x8b68('0xc')](),controller['destroy']);module[_0x8b68('0x19')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','post','create','setTags','put','/:id','delete','destroy','exports','multer','util'];(function(_0xea4633,_0x595928){var _0x2e7e83=function(_0x100b6a){while(--_0x100b6a){_0xea4633['push'](_0xea4633['shift']());}};_0x2e7e83(++_0x595928);}(_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('./intZendeskConfiguration.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x9')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x9')]('/:id/descriptions',auth[_0x0d8b('0x7')](),controller['getDescriptions']);router[_0x0d8b('0x9')](_0x0d8b('0xf'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0x11')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0xf'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller['update']);router[_0x0d8b('0x16')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x17')]);module[_0x0d8b('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 19fedcd..df33e13 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 _0x36e7=['STRING','sequelize'];(function(_0xeebcbd,_0x446988){var _0x1523d0=function(_0x50a625){while(--_0x50a625){_0xeebcbd['push'](_0xeebcbd['shift']());}};_0x1523d0(++_0x446988);}(_0x36e7,0x95));var _0x736e=function(_0x3135d6,_0x381da2){_0x3135d6=_0x3135d6-0x0;var _0x31808d=_0x36e7[_0x3135d6];return _0x31808d;};'use strict';var Sequelize=require(_0x736e('0x0'));module['exports']={'name':{'type':Sequelize[_0x736e('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa08c=['exports'];(function(_0x1e4a8e,_0x18022b){var _0x5408f9=function(_0x4ef2ed){while(--_0x4ef2ed){_0x1e4a8e['push'](_0x1e4a8e['shift']());}};_0x5408f9(++_0x18022b);}(_0xa08c,0x6a));var _0xca08=function(_0x379720,_0x5b60ca){_0x379720=_0x379720-0x0;var _0x314c70=_0xa08c[_0x379720];return _0x314c70;};'use strict';var Sequelize=require('sequelize');module[_0xca08('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 11ad59a..a523e92 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 _0x1ab8=['includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','create','body','find','findOne','ZendeskField','order','getFields','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','ZendeskConfiguration','type','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','pick','filter','where','merge','options'];(function(_0x417ca4,_0x1322cf){var _0x19daef=function(_0x17ed16){while(--_0x17ed16){_0x417ca4['push'](_0x417ca4['shift']());}};_0x19daef(++_0x1322cf);}(_0x1ab8,0x15f));var _0x81ab=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x1ab8[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x81ab('0x0'));var rimraf=require(_0x81ab('0x1'));var zipdir=require(_0x81ab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x81ab('0x3'));var moment=require('moment');var BPromise=require(_0x81ab('0x4'));var Mustache=require(_0x81ab('0x5'));var util=require(_0x81ab('0x6'));var path=require(_0x81ab('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x81ab('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x81ab('0x9'));var crypto=require(_0x81ab('0xa'));var jsforce=require(_0x81ab('0xb'));var deskjs=require(_0x81ab('0xc'));var toCsv=require('to-csv');var querystring=require(_0x81ab('0xd'));var Papa=require(_0x81ab('0xe'));var Redis=require('ioredis');var authService=require(_0x81ab('0xf'));var qs=require(_0x81ab('0x10'));var as=require(_0x81ab('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x81ab('0x12'))(_0x81ab('0x13'));var utils=require(_0x81ab('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x81ab('0x15'))['db'];function respondWithStatusCode(_0x74a392,_0x40fc7b){_0x40fc7b=_0x40fc7b||0xcc;return function(_0x45fd1a){if(_0x45fd1a){return _0x74a392[_0x81ab('0x16')](_0x40fc7b);}return _0x74a392['status'](_0x40fc7b)[_0x81ab('0x17')]();};}function respondWithResult(_0x19b258,_0x26c037){_0x26c037=_0x26c037||0xc8;return function(_0x9a96e1){if(_0x9a96e1){return _0x19b258[_0x81ab('0x18')](_0x26c037)[_0x81ab('0x19')](_0x9a96e1);}};}function respondWithFilteredResult(_0x5735c7,_0x2922f8){return function(_0x2d14ca){if(_0x2d14ca){var _0x7ffedf=typeof _0x2922f8[_0x81ab('0x1a')]==='undefined'&&typeof _0x2922f8[_0x81ab('0x1b')]===_0x81ab('0x1c');var _0x5c3d2a=_0x2d14ca[_0x81ab('0x1d')];var _0x3898b7=_0x7ffedf?0x0:_0x2922f8[_0x81ab('0x1a')];var _0x6eb754=_0x7ffedf?_0x2d14ca[_0x81ab('0x1d')]:_0x2922f8[_0x81ab('0x1a')]+_0x2922f8['limit'];var _0x270f83;if(_0x6eb754>=_0x5c3d2a){_0x6eb754=_0x5c3d2a;_0x270f83=0xc8;}else{_0x270f83=0xce;}_0x5735c7['status'](_0x270f83);return _0x5735c7[_0x81ab('0x1e')](_0x81ab('0x1f'),_0x3898b7+'-'+_0x6eb754+'/'+_0x5c3d2a)['json'](_0x2d14ca);}return null;};}function patchUpdates(_0xe33227){return function(_0xed40f7){try{jsonpatch[_0x81ab('0x20')](_0xed40f7,_0xe33227,!![]);}catch(_0x349613){return BPromise[_0x81ab('0x21')](_0x349613);}return _0xed40f7[_0x81ab('0x22')]();};}function saveUpdates(_0x80c18a,_0x3eeff5){return function(_0x2eae7a){if(_0x2eae7a){return _0x2eae7a[_0x81ab('0x23')](_0x80c18a)[_0x81ab('0x24')](function(_0x47b21d){return _0x47b21d;});}return null;};}function removeEntity(_0xc36a7,_0x14b65c){return function(_0x21fd1f){if(_0x21fd1f){return _0x21fd1f[_0x81ab('0x25')]()[_0x81ab('0x24')](function(){_0xc36a7[_0x81ab('0x18')](0xcc)[_0x81ab('0x17')]();});}};}function handleEntityNotFound(_0x268a07,_0x542314){return function(_0x27f9a9){if(!_0x27f9a9){_0x268a07[_0x81ab('0x16')](0x194);}return _0x27f9a9;};}function handleError(_0x442e06,_0xcdc20){_0xcdc20=_0xcdc20||0x1f4;return function(_0x533d64){logger['error'](_0x533d64[_0x81ab('0x26')]);if(_0x533d64[_0x81ab('0x27')]){delete _0x533d64[_0x81ab('0x27')];}_0x442e06[_0x81ab('0x18')](_0xcdc20)[_0x81ab('0x28')](_0x533d64);};}exports[_0x81ab('0x29')]=function(_0x4eee5c,_0x3be026){var _0x5698c2={},_0x4f5bcd={},_0x207fd3={'count':0x0,'rows':[]};var _0x503950=_[_0x81ab('0x2a')](db[_0x81ab('0x2b')]['rawAttributes'],function(_0xd4df09){return{'name':_0xd4df09['fieldName'],'type':_0xd4df09[_0x81ab('0x2c')]['key']};});_0x4f5bcd[_0x81ab('0x2d')]=_[_0x81ab('0x2a')](_0x503950,_0x81ab('0x27'));_0x4f5bcd[_0x81ab('0x2e')]=_[_0x81ab('0x2f')](_0x4eee5c[_0x81ab('0x2e')]);_0x4f5bcd[_0x81ab('0x30')]=_[_0x81ab('0x31')](_0x4f5bcd[_0x81ab('0x2d')],_0x4f5bcd[_0x81ab('0x2e')]);_0x5698c2['attributes']=_[_0x81ab('0x31')](_0x4f5bcd[_0x81ab('0x2d')],qs[_0x81ab('0x32')](_0x4eee5c[_0x81ab('0x2e')][_0x81ab('0x32')]));_0x5698c2[_0x81ab('0x33')]=_0x5698c2[_0x81ab('0x33')]['length']?_0x5698c2['attributes']:_0x4f5bcd[_0x81ab('0x2d')];if(!_0x4eee5c[_0x81ab('0x2e')]['hasOwnProperty'](_0x81ab('0x34'))){_0x5698c2[_0x81ab('0x1b')]=qs[_0x81ab('0x1b')](_0x4eee5c[_0x81ab('0x2e')][_0x81ab('0x1b')]);_0x5698c2['offset']=qs[_0x81ab('0x1a')](_0x4eee5c['query']['offset']);}_0x5698c2['order']=qs['sort'](_0x4eee5c[_0x81ab('0x2e')][_0x81ab('0x35')]);_0x5698c2['where']=qs[_0x81ab('0x30')](_[_0x81ab('0x36')](_0x4eee5c[_0x81ab('0x2e')],_0x4f5bcd[_0x81ab('0x30')]),_0x503950);if(_0x4eee5c[_0x81ab('0x2e')][_0x81ab('0x37')]){_0x5698c2[_0x81ab('0x38')]=_[_0x81ab('0x39')](_0x5698c2[_0x81ab('0x38')],{'$or':_[_0x81ab('0x2a')](_0x503950,function(_0x3dcea4){if(_0x3dcea4[_0x81ab('0x2c')]!=='VIRTUAL'){var _0x5ae769={};_0x5ae769[_0x3dcea4['name']]={'$like':'%'+_0x4eee5c[_0x81ab('0x2e')][_0x81ab('0x37')]+'%'};return _0x5ae769;}})});}_0x5698c2=_[_0x81ab('0x39')]({},_0x5698c2,_0x4eee5c[_0x81ab('0x3a')]);var _0x1a7e0f={'where':_0x5698c2[_0x81ab('0x38')]};return db[_0x81ab('0x2b')][_0x81ab('0x1d')](_0x1a7e0f)[_0x81ab('0x24')](function(_0x1c74f7){_0x207fd3[_0x81ab('0x1d')]=_0x1c74f7;if(_0x4eee5c[_0x81ab('0x2e')][_0x81ab('0x3b')]){_0x5698c2[_0x81ab('0x3c')]=[{'all':!![]}];}return db[_0x81ab('0x2b')][_0x81ab('0x3d')](_0x5698c2);})[_0x81ab('0x24')](function(_0x2aeb91){_0x207fd3[_0x81ab('0x3e')]=_0x2aeb91;return _0x207fd3;})[_0x81ab('0x24')](respondWithFilteredResult(_0x3be026,_0x5698c2))[_0x81ab('0x3f')](handleError(_0x3be026,null));};exports[_0x81ab('0x40')]=function(_0x28b7cd,_0x43ee02){var _0x154369={'raw':![],'where':{'id':_0x28b7cd[_0x81ab('0x41')]['id']}},_0x59980d={};_0x59980d[_0x81ab('0x2d')]=_['keys'](db[_0x81ab('0x2b')][_0x81ab('0x42')]);_0x59980d[_0x81ab('0x2e')]=_['keys'](_0x28b7cd[_0x81ab('0x2e')]);_0x59980d[_0x81ab('0x30')]=_[_0x81ab('0x31')](_0x59980d[_0x81ab('0x2d')],_0x59980d['query']);_0x154369[_0x81ab('0x33')]=_[_0x81ab('0x31')](_0x59980d[_0x81ab('0x2d')],qs[_0x81ab('0x32')](_0x28b7cd[_0x81ab('0x2e')][_0x81ab('0x32')]));_0x154369[_0x81ab('0x33')]=_0x154369[_0x81ab('0x33')][_0x81ab('0x43')]?_0x154369[_0x81ab('0x33')]:_0x59980d['model'];if(_0x28b7cd[_0x81ab('0x2e')]['includeAll']){_0x154369['include']=[{'all':!![]}];}_0x154369=_[_0x81ab('0x39')]({},_0x154369,_0x28b7cd[_0x81ab('0x3a')]);return db[_0x81ab('0x2b')]['find'](_0x154369)[_0x81ab('0x24')](handleEntityNotFound(_0x43ee02,null))[_0x81ab('0x24')](respondWithResult(_0x43ee02,null))[_0x81ab('0x3f')](handleError(_0x43ee02,null));};exports[_0x81ab('0x44')]=function(_0x273b0a,_0x234cbe){return db['ZendeskConfiguration'][_0x81ab('0x44')](_0x273b0a['body'],{})[_0x81ab('0x24')](respondWithResult(_0x234cbe,0xc9))['catch'](handleError(_0x234cbe,null));};exports[_0x81ab('0x23')]=function(_0x42784d,_0x1ee648){if(_0x42784d['body']['id']){delete _0x42784d[_0x81ab('0x45')]['id'];}return db['ZendeskConfiguration'][_0x81ab('0x46')]({'where':{'id':_0x42784d['params']['id']}})[_0x81ab('0x24')](handleEntityNotFound(_0x1ee648,null))[_0x81ab('0x24')](saveUpdates(_0x42784d[_0x81ab('0x45')],null))['then'](respondWithResult(_0x1ee648,null))[_0x81ab('0x3f')](handleError(_0x1ee648,null));};exports[_0x81ab('0x25')]=function(_0x48d508,_0x171383){return db['ZendeskConfiguration'][_0x81ab('0x46')]({'where':{'id':_0x48d508['params']['id']}})[_0x81ab('0x24')](handleEntityNotFound(_0x171383,null))[_0x81ab('0x24')](removeEntity(_0x171383,null))[_0x81ab('0x3f')](handleError(_0x171383,null));};exports['getFields']=function(_0x386cf7,_0x3c939c,_0x1bdcc4){var _0xa11732={};var _0x226f44={};var _0x4be79e;var _0x331953;return db['ZendeskConfiguration'][_0x81ab('0x47')]({'where':{'id':_0x386cf7[_0x81ab('0x41')]['id']}})[_0x81ab('0x24')](handleEntityNotFound(_0x3c939c,null))[_0x81ab('0x24')](function(_0x13d27e){if(_0x13d27e){_0x4be79e=_0x13d27e;_0x226f44['model']=_[_0x81ab('0x2f')](db[_0x81ab('0x48')][_0x81ab('0x42')]);_0x226f44[_0x81ab('0x2e')]=_[_0x81ab('0x2f')](_0x386cf7['query']);_0x226f44[_0x81ab('0x30')]=_[_0x81ab('0x31')](_0x226f44[_0x81ab('0x2d')],_0x226f44[_0x81ab('0x2e')]);_0xa11732[_0x81ab('0x33')]=_[_0x81ab('0x31')](_0x226f44[_0x81ab('0x2d')],qs[_0x81ab('0x32')](_0x386cf7[_0x81ab('0x2e')][_0x81ab('0x32')]));_0xa11732[_0x81ab('0x33')]=_0xa11732[_0x81ab('0x33')][_0x81ab('0x43')]?_0xa11732[_0x81ab('0x33')]:_0x226f44[_0x81ab('0x2d')];_0xa11732[_0x81ab('0x49')]=qs[_0x81ab('0x35')](_0x386cf7[_0x81ab('0x2e')][_0x81ab('0x35')]);_0xa11732['where']=qs[_0x81ab('0x30')](_[_0x81ab('0x36')](_0x386cf7['query'],_0x226f44[_0x81ab('0x30')]));if(_0x386cf7[_0x81ab('0x2e')][_0x81ab('0x37')]){_0xa11732[_0x81ab('0x38')]=_[_0x81ab('0x39')](_0xa11732[_0x81ab('0x38')],{'$or':_[_0x81ab('0x2a')](_0xa11732[_0x81ab('0x33')],function(_0x5e9450){var _0x512249={};_0x512249[_0x5e9450]={'$like':'%'+_0x386cf7[_0x81ab('0x2e')][_0x81ab('0x37')]+'%'};return _0x512249;})});}_0xa11732=_[_0x81ab('0x39')]({},_0xa11732,_0x386cf7[_0x81ab('0x3a')]);return _0x4be79e[_0x81ab('0x4a')](_0xa11732);}})['then'](function(_0x497300){if(_0x497300){_0x331953=_0x497300[_0x81ab('0x43')];if(!_0x386cf7[_0x81ab('0x2e')][_0x81ab('0x4b')](_0x81ab('0x34'))){_0xa11732['limit']=qs[_0x81ab('0x1b')](_0x386cf7[_0x81ab('0x2e')][_0x81ab('0x1b')]);_0xa11732['offset']=qs['offset'](_0x386cf7[_0x81ab('0x2e')][_0x81ab('0x1a')]);}return _0x4be79e['getFields'](_0xa11732);}})['then'](function(_0x1bc8b8){if(_0x1bc8b8){return _0x1bc8b8?{'count':_0x331953,'rows':_0x1bc8b8}:null;}})[_0x81ab('0x24')](respondWithResult(_0x3c939c,null))[_0x81ab('0x3f')](handleError(_0x3c939c,null));};exports[_0x81ab('0x4c')]=function(_0xae1d67,_0x570991,_0x348963){var _0x3bc853={};var _0x4064b8={};var _0x1e227d;var _0x317eb9;return db[_0x81ab('0x2b')][_0x81ab('0x47')]({'where':{'id':_0xae1d67[_0x81ab('0x41')]['id']}})[_0x81ab('0x24')](handleEntityNotFound(_0x570991,null))[_0x81ab('0x24')](function(_0x380477){if(_0x380477){_0x1e227d=_0x380477;_0x4064b8[_0x81ab('0x2d')]=_[_0x81ab('0x2f')](db['ZendeskField']['rawAttributes']);_0x4064b8['query']=_['keys'](_0xae1d67[_0x81ab('0x2e')]);_0x4064b8['filters']=_[_0x81ab('0x31')](_0x4064b8[_0x81ab('0x2d')],_0x4064b8[_0x81ab('0x2e')]);_0x3bc853[_0x81ab('0x33')]=_[_0x81ab('0x31')](_0x4064b8[_0x81ab('0x2d')],qs[_0x81ab('0x32')](_0xae1d67['query'][_0x81ab('0x32')]));_0x3bc853['attributes']=_0x3bc853['attributes'][_0x81ab('0x43')]?_0x3bc853[_0x81ab('0x33')]:_0x4064b8[_0x81ab('0x2d')];_0x3bc853[_0x81ab('0x49')]=qs[_0x81ab('0x35')](_0xae1d67['query']['sort']);_0x3bc853[_0x81ab('0x38')]=qs['filters'](_['pick'](_0xae1d67[_0x81ab('0x2e')],_0x4064b8[_0x81ab('0x30')]));if(_0xae1d67[_0x81ab('0x2e')][_0x81ab('0x37')]){_0x3bc853[_0x81ab('0x38')]=_['merge'](_0x3bc853[_0x81ab('0x38')],{'$or':_[_0x81ab('0x2a')](_0x3bc853[_0x81ab('0x33')],function(_0x623aa7){var _0xd011d3={};_0xd011d3[_0x623aa7]={'$like':'%'+_0xae1d67[_0x81ab('0x2e')]['filter']+'%'};return _0xd011d3;})});}_0x3bc853=_[_0x81ab('0x39')]({},_0x3bc853,_0xae1d67[_0x81ab('0x3a')]);return _0x1e227d[_0x81ab('0x4c')](_0x3bc853);}})['then'](function(_0x514499){if(_0x514499){_0x317eb9=_0x514499[_0x81ab('0x43')];if(!_0xae1d67[_0x81ab('0x2e')][_0x81ab('0x4b')](_0x81ab('0x34'))){_0x3bc853['limit']=qs[_0x81ab('0x1b')](_0xae1d67['query'][_0x81ab('0x1b')]);_0x3bc853[_0x81ab('0x1a')]=qs[_0x81ab('0x1a')](_0xae1d67['query'][_0x81ab('0x1a')]);}return _0x1e227d[_0x81ab('0x4c')](_0x3bc853);}})[_0x81ab('0x24')](function(_0x54e7d9){if(_0x54e7d9){return _0x54e7d9?{'count':_0x317eb9,'rows':_0x54e7d9}:null;}})[_0x81ab('0x24')](respondWithResult(_0x570991,null))['catch'](handleError(_0x570991,null));};exports[_0x81ab('0x4d')]=function(_0x3da26d,_0x481747,_0x4b8cb8){var _0x45b90a={};var _0x21bff8={};var _0x5b22db;var _0x4107e1;return db[_0x81ab('0x2b')][_0x81ab('0x47')]({'where':{'id':_0x3da26d[_0x81ab('0x41')]['id']}})[_0x81ab('0x24')](handleEntityNotFound(_0x481747,null))[_0x81ab('0x24')](function(_0x2a8a35){if(_0x2a8a35){_0x5b22db=_0x2a8a35;_0x21bff8[_0x81ab('0x2d')]=_[_0x81ab('0x2f')](db[_0x81ab('0x48')][_0x81ab('0x42')]);_0x21bff8[_0x81ab('0x2e')]=_[_0x81ab('0x2f')](_0x3da26d[_0x81ab('0x2e')]);_0x21bff8['filters']=_['intersection'](_0x21bff8[_0x81ab('0x2d')],_0x21bff8[_0x81ab('0x2e')]);_0x45b90a[_0x81ab('0x33')]=_[_0x81ab('0x31')](_0x21bff8['model'],qs[_0x81ab('0x32')](_0x3da26d[_0x81ab('0x2e')]['fields']));_0x45b90a[_0x81ab('0x33')]=_0x45b90a[_0x81ab('0x33')]['length']?_0x45b90a[_0x81ab('0x33')]:_0x21bff8[_0x81ab('0x2d')];_0x45b90a[_0x81ab('0x49')]=qs[_0x81ab('0x35')](_0x3da26d[_0x81ab('0x2e')]['sort']);_0x45b90a[_0x81ab('0x38')]=qs[_0x81ab('0x30')](_['pick'](_0x3da26d['query'],_0x21bff8[_0x81ab('0x30')]));if(_0x3da26d[_0x81ab('0x2e')][_0x81ab('0x37')]){_0x45b90a[_0x81ab('0x38')]=_[_0x81ab('0x39')](_0x45b90a['where'],{'$or':_[_0x81ab('0x2a')](_0x45b90a['attributes'],function(_0x3b64db){var _0x3c0da8={};_0x3c0da8[_0x3b64db]={'$like':'%'+_0x3da26d[_0x81ab('0x2e')]['filter']+'%'};return _0x3c0da8;})});}_0x45b90a=_[_0x81ab('0x39')]({},_0x45b90a,_0x3da26d[_0x81ab('0x3a')]);return _0x5b22db['getDescriptions'](_0x45b90a);}})[_0x81ab('0x24')](function(_0x41e76a){if(_0x41e76a){_0x4107e1=_0x41e76a['length'];if(!_0x3da26d[_0x81ab('0x2e')][_0x81ab('0x4b')](_0x81ab('0x34'))){_0x45b90a[_0x81ab('0x1b')]=qs['limit'](_0x3da26d[_0x81ab('0x2e')][_0x81ab('0x1b')]);_0x45b90a[_0x81ab('0x1a')]=qs[_0x81ab('0x1a')](_0x3da26d[_0x81ab('0x2e')][_0x81ab('0x1a')]);}return _0x5b22db[_0x81ab('0x4d')](_0x45b90a);}})[_0x81ab('0x24')](function(_0x4c9e89){if(_0x4c9e89){return _0x4c9e89?{'count':_0x4107e1,'rows':_0x4c9e89}:null;}})[_0x81ab('0x24')](respondWithResult(_0x481747,null))[_0x81ab('0x3f')](handleError(_0x481747,null));};exports[_0x81ab('0x4e')]=function(_0x20fb5b,_0x3085d2,_0xc0c72f){var _0x47109f={};var _0x18efb1={};var _0x150c99;var _0x5530cc;return db['ZendeskConfiguration'][_0x81ab('0x47')]({'where':{'id':_0x20fb5b['params']['id']}})[_0x81ab('0x24')](handleEntityNotFound(_0x3085d2,null))[_0x81ab('0x24')](function(_0x59d08d){if(_0x59d08d){_0x150c99=_0x59d08d;_0x18efb1[_0x81ab('0x2d')]=_['keys'](db[_0x81ab('0x4f')][_0x81ab('0x42')]);_0x18efb1['query']=_['keys'](_0x20fb5b['query']);_0x18efb1[_0x81ab('0x30')]=_['intersection'](_0x18efb1['model'],_0x18efb1[_0x81ab('0x2e')]);_0x47109f[_0x81ab('0x33')]=_[_0x81ab('0x31')](_0x18efb1[_0x81ab('0x2d')],qs[_0x81ab('0x32')](_0x20fb5b['query'][_0x81ab('0x32')]));_0x47109f[_0x81ab('0x33')]=_0x47109f['attributes'][_0x81ab('0x43')]?_0x47109f['attributes']:_0x18efb1[_0x81ab('0x2d')];_0x47109f[_0x81ab('0x49')]=qs[_0x81ab('0x35')](_0x20fb5b[_0x81ab('0x2e')][_0x81ab('0x35')]);_0x47109f['where']=qs[_0x81ab('0x30')](_[_0x81ab('0x36')](_0x20fb5b[_0x81ab('0x2e')],_0x18efb1['filters']));if(_0x20fb5b[_0x81ab('0x2e')][_0x81ab('0x37')]){_0x47109f[_0x81ab('0x38')]=_[_0x81ab('0x39')](_0x47109f['where'],{'$or':_['map'](_0x47109f['attributes'],function(_0x5ffe05){var _0x18024e={};_0x18024e[_0x5ffe05]={'$like':'%'+_0x20fb5b['query'][_0x81ab('0x37')]+'%'};return _0x18024e;})});}_0x47109f=_[_0x81ab('0x39')]({},_0x47109f,_0x20fb5b[_0x81ab('0x3a')]);return _0x150c99['getTags'](_0x47109f);}})['then'](function(_0x5c9ee6){if(_0x5c9ee6){_0x5530cc=_0x5c9ee6[_0x81ab('0x43')];if(!_0x20fb5b[_0x81ab('0x2e')]['hasOwnProperty'](_0x81ab('0x34'))){_0x47109f['limit']=qs[_0x81ab('0x1b')](_0x20fb5b['query'][_0x81ab('0x1b')]);_0x47109f[_0x81ab('0x1a')]=qs[_0x81ab('0x1a')](_0x20fb5b['query']['offset']);}return _0x150c99[_0x81ab('0x4e')](_0x47109f);}})[_0x81ab('0x24')](function(_0x4f6f28){if(_0x4f6f28){return _0x4f6f28?{'count':_0x5530cc,'rows':_0x4f6f28}:null;}})['then'](respondWithResult(_0x3085d2,null))[_0x81ab('0x3f')](handleError(_0x3085d2,null));};exports['setTags']=function(_0x52c690,_0x4d4841,_0xc1d8e0){if(_0x52c690[_0x81ab('0x45')]['id']){delete _0x52c690['body']['id'];}return db[_0x81ab('0x2b')][_0x81ab('0x47')]({'where':{'id':_0x52c690[_0x81ab('0x41')]['id']}})[_0x81ab('0x24')](handleEntityNotFound(_0x4d4841,null))['then'](function(_0x3f46e6){if(_0x3f46e6){return _0x3f46e6[_0x81ab('0x50')](_0x52c690['body'][_0x81ab('0x51')]||[]);}return null;})[_0x81ab('0x24')](respondWithResult(_0x4d4841,null))[_0x81ab('0x3f')](handleError(_0x4d4841,null));}; \ No newline at end of file +var _0x8fd1=['bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','end','error','stack','name','send','index','ZendeskConfiguration','rawAttributes','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','map','VIRTUAL','merge','options','includeAll','include','rows','show','params','length','find','catch','create','body','update','getFields','findOne','ZendeskField','pick','filter','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x328d58,_0x516c53){var _0x3b4bba=function(_0x16d5af){while(--_0x16d5af){_0x328d58['push'](_0x328d58['shift']());}};_0x3b4bba(++_0x516c53);}(_0x8fd1,0x14f));var _0x18fd=function(_0x212b5d,_0x318113){_0x212b5d=_0x212b5d-0x0;var _0xd29835=_0x8fd1[_0x212b5d];return _0xd29835;};'use strict';var emlformat=require(_0x18fd('0x0'));var rimraf=require(_0x18fd('0x1'));var zipdir=require(_0x18fd('0x2'));var jsonpatch=require(_0x18fd('0x3'));var rp=require('request-promise');var moment=require(_0x18fd('0x4'));var BPromise=require(_0x18fd('0x5'));var Mustache=require('mustache');var util=require(_0x18fd('0x6'));var path=require(_0x18fd('0x7'));var sox=require(_0x18fd('0x8'));var csv=require(_0x18fd('0x9'));var ejs=require(_0x18fd('0xa'));var fs=require('fs');var fs_extra=require(_0x18fd('0xb'));var _=require(_0x18fd('0xc'));var squel=require(_0x18fd('0xd'));var crypto=require(_0x18fd('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x18fd('0x9'));var querystring=require(_0x18fd('0xf'));var Papa=require(_0x18fd('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x18fd('0x11'));var as=require(_0x18fd('0x12'));var hardwareService=require(_0x18fd('0x13'));var logger=require(_0x18fd('0x14'))(_0x18fd('0x15'));var utils=require(_0x18fd('0x16'));var config=require(_0x18fd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x18fd('0x18'))['db'];function respondWithStatusCode(_0x1f44a4,_0x345ad8){_0x345ad8=_0x345ad8||0xcc;return function(_0x4d642d){if(_0x4d642d){return _0x1f44a4[_0x18fd('0x19')](_0x345ad8);}return _0x1f44a4[_0x18fd('0x1a')](_0x345ad8)['end']();};}function respondWithResult(_0x486f20,_0x49ec22){_0x49ec22=_0x49ec22||0xc8;return function(_0x43b42f){if(_0x43b42f){return _0x486f20[_0x18fd('0x1a')](_0x49ec22)['json'](_0x43b42f);}};}function respondWithFilteredResult(_0x36163f,_0x284447){return function(_0x50cc80){if(_0x50cc80){var _0x494617=typeof _0x284447[_0x18fd('0x1b')]===_0x18fd('0x1c')&&typeof _0x284447[_0x18fd('0x1d')]==='undefined';var _0x5cb40b=_0x50cc80[_0x18fd('0x1e')];var _0x2118f2=_0x494617?0x0:_0x284447['offset'];var _0x1ddff1=_0x494617?_0x50cc80[_0x18fd('0x1e')]:_0x284447['offset']+_0x284447[_0x18fd('0x1d')];var _0x43ce5a;if(_0x1ddff1>=_0x5cb40b){_0x1ddff1=_0x5cb40b;_0x43ce5a=0xc8;}else{_0x43ce5a=0xce;}_0x36163f[_0x18fd('0x1a')](_0x43ce5a);return _0x36163f[_0x18fd('0x1f')](_0x18fd('0x20'),_0x2118f2+'-'+_0x1ddff1+'/'+_0x5cb40b)[_0x18fd('0x21')](_0x50cc80);}return null;};}function patchUpdates(_0x4f7fe2){return function(_0x2ac7d1){try{jsonpatch[_0x18fd('0x22')](_0x2ac7d1,_0x4f7fe2,!![]);}catch(_0x6dadb8){return BPromise[_0x18fd('0x23')](_0x6dadb8);}return _0x2ac7d1[_0x18fd('0x24')]();};}function saveUpdates(_0x136bca,_0x211988){return function(_0x5c68f1){if(_0x5c68f1){return _0x5c68f1['update'](_0x136bca)[_0x18fd('0x25')](function(_0xedb18f){return _0xedb18f;});}return null;};}function removeEntity(_0x128811,_0xf02181){return function(_0x43d36e){if(_0x43d36e){return _0x43d36e[_0x18fd('0x26')]()[_0x18fd('0x25')](function(){_0x128811['status'](0xcc)[_0x18fd('0x27')]();});}};}function handleEntityNotFound(_0x5e762f,_0x1b2828){return function(_0x54b0c9){if(!_0x54b0c9){_0x5e762f[_0x18fd('0x19')](0x194);}return _0x54b0c9;};}function handleError(_0x53ae35,_0x553fef){_0x553fef=_0x553fef||0x1f4;return function(_0x352095){logger[_0x18fd('0x28')](_0x352095[_0x18fd('0x29')]);if(_0x352095[_0x18fd('0x2a')]){delete _0x352095[_0x18fd('0x2a')];}_0x53ae35[_0x18fd('0x1a')](_0x553fef)[_0x18fd('0x2b')](_0x352095);};}exports[_0x18fd('0x2c')]=function(_0x243ba5,_0x41310d){var _0xb84502={},_0x507760={},_0x53cb88={'count':0x0,'rows':[]};var _0xd00df7=_['map'](db[_0x18fd('0x2d')][_0x18fd('0x2e')],function(_0x5814b0){return{'name':_0x5814b0['fieldName'],'type':_0x5814b0['type']['key']};});_0x507760[_0x18fd('0x2f')]=_['map'](_0xd00df7,_0x18fd('0x2a'));_0x507760['query']=_[_0x18fd('0x30')](_0x243ba5[_0x18fd('0x31')]);_0x507760[_0x18fd('0x32')]=_[_0x18fd('0x33')](_0x507760[_0x18fd('0x2f')],_0x507760[_0x18fd('0x31')]);_0xb84502[_0x18fd('0x34')]=_[_0x18fd('0x33')](_0x507760[_0x18fd('0x2f')],qs[_0x18fd('0x35')](_0x243ba5[_0x18fd('0x31')][_0x18fd('0x35')]));_0xb84502[_0x18fd('0x34')]=_0xb84502['attributes']['length']?_0xb84502[_0x18fd('0x34')]:_0x507760[_0x18fd('0x2f')];if(!_0x243ba5['query']['hasOwnProperty'](_0x18fd('0x36'))){_0xb84502['limit']=qs['limit'](_0x243ba5[_0x18fd('0x31')]['limit']);_0xb84502[_0x18fd('0x1b')]=qs[_0x18fd('0x1b')](_0x243ba5[_0x18fd('0x31')][_0x18fd('0x1b')]);}_0xb84502[_0x18fd('0x37')]=qs[_0x18fd('0x38')](_0x243ba5[_0x18fd('0x31')][_0x18fd('0x38')]);_0xb84502[_0x18fd('0x39')]=qs['filters'](_['pick'](_0x243ba5[_0x18fd('0x31')],_0x507760[_0x18fd('0x32')]),_0xd00df7);if(_0x243ba5[_0x18fd('0x31')]['filter']){_0xb84502[_0x18fd('0x39')]=_['merge'](_0xb84502[_0x18fd('0x39')],{'$or':_[_0x18fd('0x3a')](_0xd00df7,function(_0x39a942){if(_0x39a942['type']!==_0x18fd('0x3b')){var _0x5c85eb={};_0x5c85eb[_0x39a942['name']]={'$like':'%'+_0x243ba5[_0x18fd('0x31')]['filter']+'%'};return _0x5c85eb;}})});}_0xb84502=_[_0x18fd('0x3c')]({},_0xb84502,_0x243ba5[_0x18fd('0x3d')]);var _0x49e264={'where':_0xb84502[_0x18fd('0x39')]};return db[_0x18fd('0x2d')][_0x18fd('0x1e')](_0x49e264)['then'](function(_0x111472){_0x53cb88[_0x18fd('0x1e')]=_0x111472;if(_0x243ba5[_0x18fd('0x31')][_0x18fd('0x3e')]){_0xb84502[_0x18fd('0x3f')]=[{'all':!![]}];}return db[_0x18fd('0x2d')]['findAll'](_0xb84502);})[_0x18fd('0x25')](function(_0x4c37b5){_0x53cb88[_0x18fd('0x40')]=_0x4c37b5;return _0x53cb88;})[_0x18fd('0x25')](respondWithFilteredResult(_0x41310d,_0xb84502))['catch'](handleError(_0x41310d,null));};exports[_0x18fd('0x41')]=function(_0x1eb322,_0x10699e){var _0x51f34f={'raw':![],'where':{'id':_0x1eb322[_0x18fd('0x42')]['id']}},_0xe31ff2={};_0xe31ff2[_0x18fd('0x2f')]=_['keys'](db[_0x18fd('0x2d')][_0x18fd('0x2e')]);_0xe31ff2['query']=_[_0x18fd('0x30')](_0x1eb322['query']);_0xe31ff2[_0x18fd('0x32')]=_['intersection'](_0xe31ff2[_0x18fd('0x2f')],_0xe31ff2[_0x18fd('0x31')]);_0x51f34f[_0x18fd('0x34')]=_[_0x18fd('0x33')](_0xe31ff2[_0x18fd('0x2f')],qs[_0x18fd('0x35')](_0x1eb322[_0x18fd('0x31')]['fields']));_0x51f34f[_0x18fd('0x34')]=_0x51f34f[_0x18fd('0x34')][_0x18fd('0x43')]?_0x51f34f['attributes']:_0xe31ff2['model'];if(_0x1eb322['query']['includeAll']){_0x51f34f[_0x18fd('0x3f')]=[{'all':!![]}];}_0x51f34f=_[_0x18fd('0x3c')]({},_0x51f34f,_0x1eb322[_0x18fd('0x3d')]);return db[_0x18fd('0x2d')][_0x18fd('0x44')](_0x51f34f)[_0x18fd('0x25')](handleEntityNotFound(_0x10699e,null))[_0x18fd('0x25')](respondWithResult(_0x10699e,null))[_0x18fd('0x45')](handleError(_0x10699e,null));};exports[_0x18fd('0x46')]=function(_0x492764,_0x32dbf0){return db[_0x18fd('0x2d')][_0x18fd('0x46')](_0x492764[_0x18fd('0x47')],{})[_0x18fd('0x25')](respondWithResult(_0x32dbf0,0xc9))['catch'](handleError(_0x32dbf0,null));};exports[_0x18fd('0x48')]=function(_0x5e72ed,_0x582113){if(_0x5e72ed['body']['id']){delete _0x5e72ed[_0x18fd('0x47')]['id'];}return db[_0x18fd('0x2d')]['find']({'where':{'id':_0x5e72ed[_0x18fd('0x42')]['id']}})[_0x18fd('0x25')](handleEntityNotFound(_0x582113,null))[_0x18fd('0x25')](saveUpdates(_0x5e72ed['body'],null))[_0x18fd('0x25')](respondWithResult(_0x582113,null))[_0x18fd('0x45')](handleError(_0x582113,null));};exports[_0x18fd('0x26')]=function(_0x18545a,_0x4e3305){return db[_0x18fd('0x2d')][_0x18fd('0x44')]({'where':{'id':_0x18545a['params']['id']}})[_0x18fd('0x25')](handleEntityNotFound(_0x4e3305,null))[_0x18fd('0x25')](removeEntity(_0x4e3305,null))[_0x18fd('0x45')](handleError(_0x4e3305,null));};exports[_0x18fd('0x49')]=function(_0x58e6af,_0x474879,_0x25b7cd){var _0x2a542f={};var _0x3c7dfe={};var _0xa8ff42;var _0x265bbd;return db[_0x18fd('0x2d')][_0x18fd('0x4a')]({'where':{'id':_0x58e6af[_0x18fd('0x42')]['id']}})['then'](handleEntityNotFound(_0x474879,null))[_0x18fd('0x25')](function(_0x295d0e){if(_0x295d0e){_0xa8ff42=_0x295d0e;_0x3c7dfe[_0x18fd('0x2f')]=_['keys'](db[_0x18fd('0x4b')][_0x18fd('0x2e')]);_0x3c7dfe[_0x18fd('0x31')]=_['keys'](_0x58e6af['query']);_0x3c7dfe[_0x18fd('0x32')]=_[_0x18fd('0x33')](_0x3c7dfe[_0x18fd('0x2f')],_0x3c7dfe[_0x18fd('0x31')]);_0x2a542f[_0x18fd('0x34')]=_[_0x18fd('0x33')](_0x3c7dfe[_0x18fd('0x2f')],qs[_0x18fd('0x35')](_0x58e6af[_0x18fd('0x31')][_0x18fd('0x35')]));_0x2a542f[_0x18fd('0x34')]=_0x2a542f['attributes']['length']?_0x2a542f['attributes']:_0x3c7dfe['model'];_0x2a542f[_0x18fd('0x37')]=qs[_0x18fd('0x38')](_0x58e6af[_0x18fd('0x31')]['sort']);_0x2a542f[_0x18fd('0x39')]=qs[_0x18fd('0x32')](_[_0x18fd('0x4c')](_0x58e6af[_0x18fd('0x31')],_0x3c7dfe[_0x18fd('0x32')]));if(_0x58e6af[_0x18fd('0x31')]['filter']){_0x2a542f[_0x18fd('0x39')]=_['merge'](_0x2a542f['where'],{'$or':_[_0x18fd('0x3a')](_0x2a542f[_0x18fd('0x34')],function(_0x57c7a1){var _0x1a6375={};_0x1a6375[_0x57c7a1]={'$like':'%'+_0x58e6af[_0x18fd('0x31')][_0x18fd('0x4d')]+'%'};return _0x1a6375;})});}_0x2a542f=_['merge']({},_0x2a542f,_0x58e6af[_0x18fd('0x3d')]);return _0xa8ff42['getFields'](_0x2a542f);}})[_0x18fd('0x25')](function(_0x26e3a5){if(_0x26e3a5){_0x265bbd=_0x26e3a5['length'];if(!_0x58e6af[_0x18fd('0x31')][_0x18fd('0x4e')]('nolimit')){_0x2a542f['limit']=qs[_0x18fd('0x1d')](_0x58e6af[_0x18fd('0x31')][_0x18fd('0x1d')]);_0x2a542f[_0x18fd('0x1b')]=qs[_0x18fd('0x1b')](_0x58e6af[_0x18fd('0x31')][_0x18fd('0x1b')]);}return _0xa8ff42[_0x18fd('0x49')](_0x2a542f);}})[_0x18fd('0x25')](function(_0xcb9296){if(_0xcb9296){return _0xcb9296?{'count':_0x265bbd,'rows':_0xcb9296}:null;}})[_0x18fd('0x25')](respondWithResult(_0x474879,null))['catch'](handleError(_0x474879,null));};exports[_0x18fd('0x4f')]=function(_0x1ba693,_0x10ee60,_0x2d3619){var _0x2b942e={};var _0x377a5e={};var _0x18ec62;var _0x2816b7;return db[_0x18fd('0x2d')]['findOne']({'where':{'id':_0x1ba693[_0x18fd('0x42')]['id']}})[_0x18fd('0x25')](handleEntityNotFound(_0x10ee60,null))[_0x18fd('0x25')](function(_0x2449b6){if(_0x2449b6){_0x18ec62=_0x2449b6;_0x377a5e[_0x18fd('0x2f')]=_[_0x18fd('0x30')](db[_0x18fd('0x4b')]['rawAttributes']);_0x377a5e[_0x18fd('0x31')]=_[_0x18fd('0x30')](_0x1ba693[_0x18fd('0x31')]);_0x377a5e[_0x18fd('0x32')]=_[_0x18fd('0x33')](_0x377a5e[_0x18fd('0x2f')],_0x377a5e[_0x18fd('0x31')]);_0x2b942e[_0x18fd('0x34')]=_[_0x18fd('0x33')](_0x377a5e[_0x18fd('0x2f')],qs[_0x18fd('0x35')](_0x1ba693['query'][_0x18fd('0x35')]));_0x2b942e[_0x18fd('0x34')]=_0x2b942e[_0x18fd('0x34')][_0x18fd('0x43')]?_0x2b942e[_0x18fd('0x34')]:_0x377a5e[_0x18fd('0x2f')];_0x2b942e[_0x18fd('0x37')]=qs[_0x18fd('0x38')](_0x1ba693['query'][_0x18fd('0x38')]);_0x2b942e[_0x18fd('0x39')]=qs['filters'](_[_0x18fd('0x4c')](_0x1ba693[_0x18fd('0x31')],_0x377a5e[_0x18fd('0x32')]));if(_0x1ba693[_0x18fd('0x31')][_0x18fd('0x4d')]){_0x2b942e[_0x18fd('0x39')]=_[_0x18fd('0x3c')](_0x2b942e[_0x18fd('0x39')],{'$or':_[_0x18fd('0x3a')](_0x2b942e[_0x18fd('0x34')],function(_0x405ca0){var _0x26d288={};_0x26d288[_0x405ca0]={'$like':'%'+_0x1ba693['query'][_0x18fd('0x4d')]+'%'};return _0x26d288;})});}_0x2b942e=_[_0x18fd('0x3c')]({},_0x2b942e,_0x1ba693['options']);return _0x18ec62[_0x18fd('0x4f')](_0x2b942e);}})[_0x18fd('0x25')](function(_0x2f8041){if(_0x2f8041){_0x2816b7=_0x2f8041['length'];if(!_0x1ba693['query']['hasOwnProperty'](_0x18fd('0x36'))){_0x2b942e[_0x18fd('0x1d')]=qs[_0x18fd('0x1d')](_0x1ba693['query'][_0x18fd('0x1d')]);_0x2b942e[_0x18fd('0x1b')]=qs[_0x18fd('0x1b')](_0x1ba693[_0x18fd('0x31')][_0x18fd('0x1b')]);}return _0x18ec62[_0x18fd('0x4f')](_0x2b942e);}})[_0x18fd('0x25')](function(_0x59fc49){if(_0x59fc49){return _0x59fc49?{'count':_0x2816b7,'rows':_0x59fc49}:null;}})['then'](respondWithResult(_0x10ee60,null))[_0x18fd('0x45')](handleError(_0x10ee60,null));};exports['getDescriptions']=function(_0x4126b9,_0x2d4009,_0x406e95){var _0x2f5512={};var _0x2d488f={};var _0x5f2d56;var _0x464393;return db[_0x18fd('0x2d')]['findOne']({'where':{'id':_0x4126b9[_0x18fd('0x42')]['id']}})[_0x18fd('0x25')](handleEntityNotFound(_0x2d4009,null))['then'](function(_0x10832d){if(_0x10832d){_0x5f2d56=_0x10832d;_0x2d488f[_0x18fd('0x2f')]=_[_0x18fd('0x30')](db[_0x18fd('0x4b')][_0x18fd('0x2e')]);_0x2d488f[_0x18fd('0x31')]=_[_0x18fd('0x30')](_0x4126b9[_0x18fd('0x31')]);_0x2d488f[_0x18fd('0x32')]=_[_0x18fd('0x33')](_0x2d488f['model'],_0x2d488f['query']);_0x2f5512[_0x18fd('0x34')]=_[_0x18fd('0x33')](_0x2d488f[_0x18fd('0x2f')],qs[_0x18fd('0x35')](_0x4126b9[_0x18fd('0x31')]['fields']));_0x2f5512['attributes']=_0x2f5512[_0x18fd('0x34')]['length']?_0x2f5512['attributes']:_0x2d488f['model'];_0x2f5512['order']=qs['sort'](_0x4126b9['query']['sort']);_0x2f5512['where']=qs['filters'](_[_0x18fd('0x4c')](_0x4126b9[_0x18fd('0x31')],_0x2d488f[_0x18fd('0x32')]));if(_0x4126b9[_0x18fd('0x31')][_0x18fd('0x4d')]){_0x2f5512[_0x18fd('0x39')]=_['merge'](_0x2f5512[_0x18fd('0x39')],{'$or':_[_0x18fd('0x3a')](_0x2f5512[_0x18fd('0x34')],function(_0x499449){var _0x37d937={};_0x37d937[_0x499449]={'$like':'%'+_0x4126b9[_0x18fd('0x31')][_0x18fd('0x4d')]+'%'};return _0x37d937;})});}_0x2f5512=_[_0x18fd('0x3c')]({},_0x2f5512,_0x4126b9[_0x18fd('0x3d')]);return _0x5f2d56[_0x18fd('0x50')](_0x2f5512);}})[_0x18fd('0x25')](function(_0x211ff8){if(_0x211ff8){_0x464393=_0x211ff8['length'];if(!_0x4126b9['query'][_0x18fd('0x4e')](_0x18fd('0x36'))){_0x2f5512[_0x18fd('0x1d')]=qs[_0x18fd('0x1d')](_0x4126b9[_0x18fd('0x31')]['limit']);_0x2f5512[_0x18fd('0x1b')]=qs[_0x18fd('0x1b')](_0x4126b9[_0x18fd('0x31')][_0x18fd('0x1b')]);}return _0x5f2d56[_0x18fd('0x50')](_0x2f5512);}})[_0x18fd('0x25')](function(_0x10179e){if(_0x10179e){return _0x10179e?{'count':_0x464393,'rows':_0x10179e}:null;}})[_0x18fd('0x25')](respondWithResult(_0x2d4009,null))['catch'](handleError(_0x2d4009,null));};exports['getTags']=function(_0x57ff5c,_0x3b91ec,_0x40f481){var _0x32b675={};var _0x55b1e8={};var _0x90cc36;var _0x4d11e5;return db['ZendeskConfiguration'][_0x18fd('0x4a')]({'where':{'id':_0x57ff5c[_0x18fd('0x42')]['id']}})['then'](handleEntityNotFound(_0x3b91ec,null))[_0x18fd('0x25')](function(_0x34df23){if(_0x34df23){_0x90cc36=_0x34df23;_0x55b1e8[_0x18fd('0x2f')]=_['keys'](db[_0x18fd('0x51')][_0x18fd('0x2e')]);_0x55b1e8[_0x18fd('0x31')]=_[_0x18fd('0x30')](_0x57ff5c[_0x18fd('0x31')]);_0x55b1e8[_0x18fd('0x32')]=_[_0x18fd('0x33')](_0x55b1e8[_0x18fd('0x2f')],_0x55b1e8[_0x18fd('0x31')]);_0x32b675[_0x18fd('0x34')]=_[_0x18fd('0x33')](_0x55b1e8[_0x18fd('0x2f')],qs['fields'](_0x57ff5c[_0x18fd('0x31')][_0x18fd('0x35')]));_0x32b675['attributes']=_0x32b675[_0x18fd('0x34')][_0x18fd('0x43')]?_0x32b675['attributes']:_0x55b1e8[_0x18fd('0x2f')];_0x32b675[_0x18fd('0x37')]=qs[_0x18fd('0x38')](_0x57ff5c['query'][_0x18fd('0x38')]);_0x32b675['where']=qs['filters'](_['pick'](_0x57ff5c[_0x18fd('0x31')],_0x55b1e8[_0x18fd('0x32')]));if(_0x57ff5c[_0x18fd('0x31')][_0x18fd('0x4d')]){_0x32b675[_0x18fd('0x39')]=_['merge'](_0x32b675[_0x18fd('0x39')],{'$or':_[_0x18fd('0x3a')](_0x32b675[_0x18fd('0x34')],function(_0x5be73c){var _0x5cffd7={};_0x5cffd7[_0x5be73c]={'$like':'%'+_0x57ff5c[_0x18fd('0x31')][_0x18fd('0x4d')]+'%'};return _0x5cffd7;})});}_0x32b675=_[_0x18fd('0x3c')]({},_0x32b675,_0x57ff5c['options']);return _0x90cc36['getTags'](_0x32b675);}})[_0x18fd('0x25')](function(_0x55c35f){if(_0x55c35f){_0x4d11e5=_0x55c35f[_0x18fd('0x43')];if(!_0x57ff5c[_0x18fd('0x31')][_0x18fd('0x4e')]('nolimit')){_0x32b675[_0x18fd('0x1d')]=qs[_0x18fd('0x1d')](_0x57ff5c[_0x18fd('0x31')][_0x18fd('0x1d')]);_0x32b675[_0x18fd('0x1b')]=qs[_0x18fd('0x1b')](_0x57ff5c[_0x18fd('0x31')][_0x18fd('0x1b')]);}return _0x90cc36[_0x18fd('0x52')](_0x32b675);}})['then'](function(_0xfd43e0){if(_0xfd43e0){return _0xfd43e0?{'count':_0x4d11e5,'rows':_0xfd43e0}:null;}})[_0x18fd('0x25')](respondWithResult(_0x3b91ec,null))[_0x18fd('0x45')](handleError(_0x3b91ec,null));};exports[_0x18fd('0x53')]=function(_0x5b0816,_0x3b9fd9,_0x574b7e){if(_0x5b0816[_0x18fd('0x47')]['id']){delete _0x5b0816[_0x18fd('0x47')]['id'];}return db[_0x18fd('0x2d')][_0x18fd('0x4a')]({'where':{'id':_0x5b0816[_0x18fd('0x42')]['id']}})[_0x18fd('0x25')](handleEntityNotFound(_0x3b9fd9,null))['then'](function(_0x4957be){if(_0x4957be){return _0x4957be['setTags'](_0x5b0816[_0x18fd('0x47')][_0x18fd('0x54')]||[]);}return null;})[_0x18fd('0x25')](respondWithResult(_0x3b9fd9,null))[_0x18fd('0x45')](handleError(_0x3b9fd9,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 356e9d9..10bcdd4 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 _0x373d=['define','ZendeskConfiguration','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x373d,0x1e2));var _0xd373=function(_0x1ad790,_0x2ac345){_0x1ad790=_0x1ad790-0x0;var _0x2f3f9b=_0x373d[_0x1ad790];return _0x2f3f9b;};'use strict';var _=require(_0xd373('0x0'));var util=require('util');var logger=require(_0xd373('0x1'))(_0xd373('0x2'));var moment=require(_0xd373('0x3'));var BPromise=require(_0xd373('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd373('0x5'));var rimraf=require(_0xd373('0x6'));var config=require(_0xd373('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x31a0fb,_0x3e4443){return _0x31a0fb[_0xd373('0x8')](_0xd373('0x9'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x160f=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','int_zendesk_configurations'];(function(_0x108fa5,_0x115aaf){var _0x3cffff=function(_0x456dec){while(--_0x456dec){_0x108fa5['push'](_0x108fa5['shift']());}};_0x3cffff(++_0x115aaf);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var logger=require(_0xf160('0x2'))(_0xf160('0x3'));var moment=require('moment');var BPromise=require(_0xf160('0x4'));var rp=require(_0xf160('0x5'));var fs=require('fs');var path=require(_0xf160('0x6'));var rimraf=require(_0xf160('0x7'));var config=require(_0xf160('0x8'));var attributes=require(_0xf160('0x9'));module['exports']=function(_0x311d63,_0x11902f){return _0x311d63['define']('ZendeskConfiguration',attributes,{'tableName':_0xf160('0xa'),'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 9f2f726..ca4f2ce 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 _0x1522=['debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1522,0xf7));var _0x2152=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1522[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2152('0x0'));var util=require('util');var moment=require(_0x2152('0x1'));var BPromise=require(_0x2152('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2152('0x3'));var db=require(_0x2152('0x4'))['db'];var utils=require(_0x2152('0x5'));var logger=require(_0x2152('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2152('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2b78b8,_0x592243,_0x34abc3){return new BPromise(function(_0x4e76d0,_0x5423e0){return client[_0x2152('0x8')](_0x2b78b8,_0x34abc3)[_0x2152('0x9')](function(_0x14ee13){logger[_0x2152('0xa')](_0x2152('0xb'),_0x592243,_0x2152('0xc'));logger[_0x2152('0xd')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x592243,'request\x20sent',JSON[_0x2152('0xe')](_0x14ee13));if(_0x14ee13['error']){if(_0x14ee13[_0x2152('0xf')][_0x2152('0x10')]===0x1f4){logger[_0x2152('0xf')](_0x2152('0xb'),_0x592243,_0x14ee13[_0x2152('0xf')][_0x2152('0x11')]);return _0x5423e0(_0x14ee13[_0x2152('0xf')]['message']);}logger[_0x2152('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x592243,_0x14ee13['error'][_0x2152('0x11')]);return _0x4e76d0(_0x14ee13[_0x2152('0xf')][_0x2152('0x11')]);}else{logger[_0x2152('0xa')]('ZendeskConfiguration,\x20%s,\x20%s',_0x592243,_0x2152('0xc'));_0x4e76d0(_0x14ee13[_0x2152('0x12')]['message']);}})[_0x2152('0x13')](function(_0x592bef){logger[_0x2152('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x592243,_0x592bef);_0x5423e0(_0x592bef);});});} \ No newline at end of file +var _0xad5a=['info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x23e859,_0x419ccc){var _0xe4964=function(_0x2e2501){while(--_0x2e2501){_0x23e859['push'](_0x23e859['shift']());}};_0xe4964(++_0x419ccc);}(_0xad5a,0x93));var _0xaad5=function(_0x26a2d8,_0x1f8168){_0x26a2d8=_0x26a2d8-0x0;var _0x7a6a0b=_0xad5a[_0x26a2d8];return _0x7a6a0b;};'use strict';var _=require(_0xaad5('0x0'));var util=require(_0xaad5('0x1'));var moment=require('moment');var BPromise=require(_0xaad5('0x2'));var rs=require(_0xaad5('0x3'));var fs=require('fs');var Redis=require(_0xaad5('0x4'));var db=require(_0xaad5('0x5'))['db'];var utils=require(_0xaad5('0x6'));var logger=require('../../config/logger')(_0xaad5('0x7'));var config=require(_0xaad5('0x8'));var jayson=require(_0xaad5('0x9'));var client=jayson[_0xaad5('0xa')][_0xaad5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1507be,_0x52c055,_0x191608){return new BPromise(function(_0x14dc4a,_0x3f799f){return client[_0xaad5('0xc')](_0x1507be,_0x191608)[_0xaad5('0xd')](function(_0x2a061b){logger[_0xaad5('0xe')](_0xaad5('0xf'),_0x52c055,'request\x20sent');logger[_0xaad5('0x10')](_0xaad5('0x11'),_0x52c055,_0xaad5('0x12'),JSON[_0xaad5('0x13')](_0x2a061b));if(_0x2a061b['error']){if(_0x2a061b['error']['code']===0x1f4){logger[_0xaad5('0x14')](_0xaad5('0xf'),_0x52c055,_0x2a061b[_0xaad5('0x14')]['message']);return _0x3f799f(_0x2a061b[_0xaad5('0x14')]['message']);}logger[_0xaad5('0x14')](_0xaad5('0xf'),_0x52c055,_0x2a061b[_0xaad5('0x14')][_0xaad5('0x15')]);return _0x14dc4a(_0x2a061b[_0xaad5('0x14')][_0xaad5('0x15')]);}else{logger['info'](_0xaad5('0xf'),_0x52c055,'request\x20sent');_0x14dc4a(_0x2a061b[_0xaad5('0x16')][_0xaad5('0x15')]);}})['catch'](function(_0x158cb6){logger['error'](_0xaad5('0xf'),_0x52c055,_0x158cb6);_0x3f799f(_0x158cb6);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index fa54eeb..0beefad 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 _0x8558=['express','Router','fs-extra','../../config/environment','get','isAuthenticated','/:id','show','post','put','update','destroy','exports','multer','path','connect-timeout'];(function(_0x41ccb1,_0x3702a1){var _0x4aac45=function(_0x1e73e5){while(--_0x1e73e5){_0x41ccb1['push'](_0x41ccb1['shift']());}};_0x4aac45(++_0x3702a1);}(_0x8558,0x14d));var _0x8855=function(_0x22dda1,_0x5679c0){_0x22dda1=_0x22dda1-0x0;var _0x86e5d0=_0x8558[_0x22dda1];return _0x86e5d0;};'use strict';var multer=require(_0x8855('0x0'));var util=require('util');var path=require(_0x8855('0x1'));var timeout=require(_0x8855('0x2'));var express=require(_0x8855('0x3'));var router=express[_0x8855('0x4')]();var fs_extra=require(_0x8855('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8855('0x6'));var controller=require('./intZendeskField.controller');router[_0x8855('0x7')]('/',auth[_0x8855('0x8')](),controller['index']);router[_0x8855('0x7')](_0x8855('0x9'),auth['isAuthenticated'](),controller[_0x8855('0xa')]);router[_0x8855('0xb')]('/',auth[_0x8855('0x8')](),controller['create']);router[_0x8855('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x8855('0xd')]);router['delete'](_0x8855('0x9'),auth[_0x8855('0x8')](),controller[_0x8855('0xe')]);module[_0x8855('0xf')]=router; \ No newline at end of file +var _0xcb3f=['./intZendeskField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x143a91,_0x235332){var _0x1906f5=function(_0xd27eeb){while(--_0xd27eeb){_0x143a91['push'](_0x143a91['shift']());}};_0x1906f5(++_0x235332);}(_0xcb3f,0x11c));var _0xfcb3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcb3f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfcb3('0x0'));var util=require(_0xfcb3('0x1'));var path=require(_0xfcb3('0x2'));var timeout=require(_0xfcb3('0x3'));var express=require(_0xfcb3('0x4'));var router=express[_0xfcb3('0x5')]();var fs_extra=require(_0xfcb3('0x6'));var auth=require(_0xfcb3('0x7'));var interaction=require(_0xfcb3('0x8'));var config=require(_0xfcb3('0x9'));var controller=require(_0xfcb3('0xa'));router[_0xfcb3('0xb')]('/',auth['isAuthenticated'](),controller[_0xfcb3('0xc')]);router[_0xfcb3('0xb')](_0xfcb3('0xd'),auth[_0xfcb3('0xe')](),controller[_0xfcb3('0xf')]);router[_0xfcb3('0x10')]('/',auth['isAuthenticated'](),controller[_0xfcb3('0x11')]);router[_0xfcb3('0x12')](_0xfcb3('0xd'),auth['isAuthenticated'](),controller[_0xfcb3('0x13')]);router['delete'](_0xfcb3('0xd'),auth[_0xfcb3('0xe')](),controller['destroy']);module[_0xfcb3('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index f8f8b99..a841bf8 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 _0x3246=['sequelize','exports','string','variable','customVariable','keyValue','STRING','ENUM'];(function(_0x301fda,_0x1ccf54){var _0x58db63=function(_0x5dfe8d){while(--_0x5dfe8d){_0x301fda['push'](_0x301fda['shift']());}};_0x58db63(++_0x1ccf54);}(_0x3246,0xe0));var _0x6324=function(_0x22b9b3,_0x2d70f7){_0x22b9b3=_0x22b9b3-0x0;var _0x3d00bc=_0x3246[_0x22b9b3];return _0x3d00bc;};'use strict';var Sequelize=require(_0x6324('0x0'));module[_0x6324('0x1')]={'type':{'type':Sequelize['ENUM'](_0x6324('0x2'),_0x6324('0x3'),_0x6324('0x4'),_0x6324('0x5'),'picklist'),'defaultValue':_0x6324('0x2')},'content':{'type':Sequelize[_0x6324('0x6')]},'key':{'type':Sequelize[_0x6324('0x6')]},'keyType':{'type':Sequelize[_0x6324('0x7')](_0x6324('0x2'),_0x6324('0x3'),_0x6324('0x4'))},'keyContent':{'type':Sequelize[_0x6324('0x6')]},'idField':{'type':Sequelize[_0x6324('0x6')]},'nameField':{'type':Sequelize[_0x6324('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6324('0x6')]}}; \ No newline at end of file +var _0xef73=['picklist','STRING','variable','sequelize','exports','string','customVariable','keyValue'];(function(_0x177a37,_0x5de515){var _0x3df087=function(_0x21f5bf){while(--_0x21f5bf){_0x177a37['push'](_0x177a37['shift']());}};_0x3df087(++_0x5de515);}(_0xef73,0x143));var _0x3ef7=function(_0x1399d6,_0x2c1661){_0x1399d6=_0x1399d6-0x0;var _0x4a9db4=_0xef73[_0x1399d6];return _0x4a9db4;};'use strict';var Sequelize=require(_0x3ef7('0x0'));module[_0x3ef7('0x1')]={'type':{'type':Sequelize['ENUM'](_0x3ef7('0x2'),'variable',_0x3ef7('0x3'),_0x3ef7('0x4'),_0x3ef7('0x5')),'defaultValue':_0x3ef7('0x2')},'content':{'type':Sequelize[_0x3ef7('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x3ef7('0x7'),_0x3ef7('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3ef7('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 1fac67c..f63cf16 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 _0x5981=['params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','index','ZendeskField','rawAttributes','fieldName','key','model','map','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x39bfb6,_0x4272c8){var _0x23fef9=function(_0x5f83c1){while(--_0x5f83c1){_0x39bfb6['push'](_0x39bfb6['shift']());}};_0x23fef9(++_0x4272c8);}(_0x5981,0xa7));var _0x1598=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5981[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1598('0x0'));var rimraf=require(_0x1598('0x1'));var zipdir=require(_0x1598('0x2'));var jsonpatch=require(_0x1598('0x3'));var rp=require(_0x1598('0x4'));var moment=require(_0x1598('0x5'));var BPromise=require(_0x1598('0x6'));var Mustache=require(_0x1598('0x7'));var util=require(_0x1598('0x8'));var path=require(_0x1598('0x9'));var sox=require('sox');var csv=require(_0x1598('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1598('0xb'));var _=require(_0x1598('0xc'));var squel=require(_0x1598('0xd'));var crypto=require(_0x1598('0xe'));var jsforce=require(_0x1598('0xf'));var deskjs=require(_0x1598('0x10'));var toCsv=require(_0x1598('0xa'));var querystring=require(_0x1598('0x11'));var Papa=require(_0x1598('0x12'));var Redis=require(_0x1598('0x13'));var authService=require(_0x1598('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x1598('0x15'));var hardwareService=require(_0x1598('0x16'));var logger=require(_0x1598('0x17'))(_0x1598('0x18'));var utils=require(_0x1598('0x19'));var config=require(_0x1598('0x1a'));var licenseUtil=require(_0x1598('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cab3e,_0x54bf09){_0x54bf09=_0x54bf09||0xcc;return function(_0xa31ee3){if(_0xa31ee3){return _0x1cab3e[_0x1598('0x1c')](_0x54bf09);}return _0x1cab3e[_0x1598('0x1d')](_0x54bf09)[_0x1598('0x1e')]();};}function respondWithResult(_0xb18a75,_0x142c30){_0x142c30=_0x142c30||0xc8;return function(_0xf22672){if(_0xf22672){return _0xb18a75[_0x1598('0x1d')](_0x142c30)[_0x1598('0x1f')](_0xf22672);}};}function respondWithFilteredResult(_0x56c25a,_0x2b9898){return function(_0xc19b97){if(_0xc19b97){var _0xff7ff9=typeof _0x2b9898[_0x1598('0x20')]===_0x1598('0x21')&&typeof _0x2b9898[_0x1598('0x22')]===_0x1598('0x21');var _0x25799e=_0xc19b97[_0x1598('0x23')];var _0x47afe8=_0xff7ff9?0x0:_0x2b9898['offset'];var _0x201168=_0xff7ff9?_0xc19b97[_0x1598('0x23')]:_0x2b9898[_0x1598('0x20')]+_0x2b9898[_0x1598('0x22')];var _0xf04503;if(_0x201168>=_0x25799e){_0x201168=_0x25799e;_0xf04503=0xc8;}else{_0xf04503=0xce;}_0x56c25a[_0x1598('0x1d')](_0xf04503);return _0x56c25a['set'](_0x1598('0x24'),_0x47afe8+'-'+_0x201168+'/'+_0x25799e)[_0x1598('0x1f')](_0xc19b97);}return null;};}function patchUpdates(_0x3f2e50){return function(_0x2f0c85){try{jsonpatch[_0x1598('0x25')](_0x2f0c85,_0x3f2e50,!![]);}catch(_0x8b7aae){return BPromise[_0x1598('0x26')](_0x8b7aae);}return _0x2f0c85[_0x1598('0x27')]();};}function saveUpdates(_0x441375,_0x36ca74){return function(_0x58aac1){if(_0x58aac1){return _0x58aac1[_0x1598('0x28')](_0x441375)['then'](function(_0xdcf273){return _0xdcf273;});}return null;};}function removeEntity(_0x474fc8,_0x45a699){return function(_0x2b9d81){if(_0x2b9d81){return _0x2b9d81['destroy']()[_0x1598('0x29')](function(){_0x474fc8[_0x1598('0x1d')](0xcc)[_0x1598('0x1e')]();});}};}function handleEntityNotFound(_0xe8cfb5,_0x3f0d08){return function(_0x125d16){if(!_0x125d16){_0xe8cfb5[_0x1598('0x1c')](0x194);}return _0x125d16;};}function handleError(_0x49b092,_0x16936d){_0x16936d=_0x16936d||0x1f4;return function(_0x1ffb51){logger[_0x1598('0x2a')](_0x1ffb51[_0x1598('0x2b')]);if(_0x1ffb51['name']){delete _0x1ffb51[_0x1598('0x2c')];}_0x49b092[_0x1598('0x1d')](_0x16936d)['send'](_0x1ffb51);};}exports[_0x1598('0x2d')]=function(_0x520de3,_0x37e30b){var _0x5b2aef={},_0x512b43={},_0x2ad8ed={'count':0x0,'rows':[]};var _0x924754=_['map'](db[_0x1598('0x2e')][_0x1598('0x2f')],function(_0x5874dd){return{'name':_0x5874dd[_0x1598('0x30')],'type':_0x5874dd['type'][_0x1598('0x31')]};});_0x512b43[_0x1598('0x32')]=_[_0x1598('0x33')](_0x924754,_0x1598('0x2c'));_0x512b43['query']=_[_0x1598('0x34')](_0x520de3['query']);_0x512b43['filters']=_[_0x1598('0x35')](_0x512b43[_0x1598('0x32')],_0x512b43[_0x1598('0x36')]);_0x5b2aef[_0x1598('0x37')]=_['intersection'](_0x512b43[_0x1598('0x32')],qs[_0x1598('0x38')](_0x520de3[_0x1598('0x36')]['fields']));_0x5b2aef['attributes']=_0x5b2aef['attributes'][_0x1598('0x39')]?_0x5b2aef[_0x1598('0x37')]:_0x512b43[_0x1598('0x32')];if(!_0x520de3[_0x1598('0x36')][_0x1598('0x3a')](_0x1598('0x3b'))){_0x5b2aef[_0x1598('0x22')]=qs['limit'](_0x520de3[_0x1598('0x36')][_0x1598('0x22')]);_0x5b2aef['offset']=qs[_0x1598('0x20')](_0x520de3['query']['offset']);}_0x5b2aef[_0x1598('0x3c')]=qs['sort'](_0x520de3[_0x1598('0x36')][_0x1598('0x3d')]);_0x5b2aef[_0x1598('0x3e')]=qs[_0x1598('0x3f')](_[_0x1598('0x40')](_0x520de3[_0x1598('0x36')],_0x512b43[_0x1598('0x3f')]),_0x924754);if(_0x520de3['query'][_0x1598('0x41')]){_0x5b2aef[_0x1598('0x3e')]=_[_0x1598('0x42')](_0x5b2aef['where'],{'$or':_[_0x1598('0x33')](_0x924754,function(_0x209d1a){if(_0x209d1a[_0x1598('0x43')]!==_0x1598('0x44')){var _0x9c3bd8={};_0x9c3bd8[_0x209d1a['name']]={'$like':'%'+_0x520de3['query'][_0x1598('0x41')]+'%'};return _0x9c3bd8;}})});}_0x5b2aef=_[_0x1598('0x42')]({},_0x5b2aef,_0x520de3[_0x1598('0x45')]);var _0x203a24={'where':_0x5b2aef['where']};return db[_0x1598('0x2e')]['count'](_0x203a24)[_0x1598('0x29')](function(_0x23b191){_0x2ad8ed['count']=_0x23b191;if(_0x520de3[_0x1598('0x36')][_0x1598('0x46')]){_0x5b2aef[_0x1598('0x47')]=[{'all':!![]}];}return db[_0x1598('0x2e')][_0x1598('0x48')](_0x5b2aef);})['then'](function(_0x208d11){_0x2ad8ed[_0x1598('0x49')]=_0x208d11;return _0x2ad8ed;})['then'](respondWithFilteredResult(_0x37e30b,_0x5b2aef))[_0x1598('0x4a')](handleError(_0x37e30b,null));};exports[_0x1598('0x4b')]=function(_0x155025,_0x30a57b){var _0x30f5ea={'raw':!![],'where':{'id':_0x155025[_0x1598('0x4c')]['id']}},_0x4bbecc={};_0x4bbecc['model']=_['keys'](db['ZendeskField'][_0x1598('0x2f')]);_0x4bbecc[_0x1598('0x36')]=_[_0x1598('0x34')](_0x155025[_0x1598('0x36')]);_0x4bbecc[_0x1598('0x3f')]=_['intersection'](_0x4bbecc['model'],_0x4bbecc[_0x1598('0x36')]);_0x30f5ea['attributes']=_[_0x1598('0x35')](_0x4bbecc[_0x1598('0x32')],qs[_0x1598('0x38')](_0x155025['query'][_0x1598('0x38')]));_0x30f5ea[_0x1598('0x37')]=_0x30f5ea['attributes']['length']?_0x30f5ea['attributes']:_0x4bbecc['model'];if(_0x155025[_0x1598('0x36')][_0x1598('0x46')]){_0x30f5ea[_0x1598('0x47')]=[{'all':!![]}];}_0x30f5ea=_[_0x1598('0x42')]({},_0x30f5ea,_0x155025['options']);return db[_0x1598('0x2e')][_0x1598('0x4d')](_0x30f5ea)[_0x1598('0x29')](handleEntityNotFound(_0x30a57b,null))[_0x1598('0x29')](respondWithResult(_0x30a57b,null))[_0x1598('0x4a')](handleError(_0x30a57b,null));};exports[_0x1598('0x4e')]=function(_0x25957c,_0x2442d2){return db[_0x1598('0x2e')]['create'](_0x25957c['body'],{})[_0x1598('0x29')](respondWithResult(_0x2442d2,0xc9))[_0x1598('0x4a')](handleError(_0x2442d2,null));};exports[_0x1598('0x28')]=function(_0x9988c,_0x4e408e){if(_0x9988c[_0x1598('0x4f')]['id']){delete _0x9988c[_0x1598('0x4f')]['id'];}return db['ZendeskField'][_0x1598('0x4d')]({'where':{'id':_0x9988c[_0x1598('0x4c')]['id']}})[_0x1598('0x29')](handleEntityNotFound(_0x4e408e,null))['then'](saveUpdates(_0x9988c['body'],null))[_0x1598('0x29')](respondWithResult(_0x4e408e,null))[_0x1598('0x4a')](handleError(_0x4e408e,null));};exports[_0x1598('0x50')]=function(_0x2fefe0,_0x12e5be){return db[_0x1598('0x2e')][_0x1598('0x4d')]({'where':{'id':_0x2fefe0[_0x1598('0x4c')]['id']}})[_0x1598('0x29')](handleEntityNotFound(_0x12e5be,null))[_0x1598('0x29')](removeEntity(_0x12e5be,null))[_0x1598('0x4a')](handleError(_0x12e5be,null));}; \ No newline at end of file +var _0x46b2=['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','json','limit','count','offset','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','query','intersection','attributes','model','fields','nolimit','sort','where','pick','filter','merge','ZendeskField','include','findAll','rows','catch','show','params','keys','length','includeAll','options','find','create','body','rimraf','zip-dir','moment','bluebird','mustache','util','path','fs-extra'];(function(_0x59b354,_0x43bda7){var _0x4f78a0=function(_0x45cf7a){while(--_0x45cf7a){_0x59b354['push'](_0x59b354['shift']());}};_0x4f78a0(++_0x43bda7);}(_0x46b2,0x114));var _0x246b=function(_0x1447e6,_0xbf0325){_0x1447e6=_0x1447e6-0x0;var _0x2b3ec0=_0x46b2[_0x1447e6];return _0x2b3ec0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x246b('0x0'));var zipdir=require(_0x246b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x246b('0x2'));var BPromise=require(_0x246b('0x3'));var Mustache=require(_0x246b('0x4'));var util=require(_0x246b('0x5'));var path=require(_0x246b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x246b('0x7'));var _=require(_0x246b('0x8'));var squel=require(_0x246b('0x9'));var crypto=require(_0x246b('0xa'));var jsforce=require(_0x246b('0xb'));var deskjs=require(_0x246b('0xc'));var toCsv=require(_0x246b('0xd'));var querystring=require(_0x246b('0xe'));var Papa=require(_0x246b('0xf'));var Redis=require('ioredis');var authService=require(_0x246b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x246b('0x11'));var hardwareService=require(_0x246b('0x12'));var logger=require(_0x246b('0x13'))(_0x246b('0x14'));var utils=require(_0x246b('0x15'));var config=require(_0x246b('0x16'));var licenseUtil=require(_0x246b('0x17'));var db=require(_0x246b('0x18'))['db'];function respondWithStatusCode(_0x99e605,_0x1ffb56){_0x1ffb56=_0x1ffb56||0xcc;return function(_0x1a59d0){if(_0x1a59d0){return _0x99e605[_0x246b('0x19')](_0x1ffb56);}return _0x99e605[_0x246b('0x1a')](_0x1ffb56)['end']();};}function respondWithResult(_0x138988,_0x5ae82d){_0x5ae82d=_0x5ae82d||0xc8;return function(_0x20759c){if(_0x20759c){return _0x138988[_0x246b('0x1a')](_0x5ae82d)[_0x246b('0x1b')](_0x20759c);}};}function respondWithFilteredResult(_0x118c72,_0x27145c){return function(_0xd52853){if(_0xd52853){var _0x2b15f2=typeof _0x27145c['offset']==='undefined'&&typeof _0x27145c[_0x246b('0x1c')]==='undefined';var _0x37af5a=_0xd52853[_0x246b('0x1d')];var _0x2663bf=_0x2b15f2?0x0:_0x27145c['offset'];var _0x6233d=_0x2b15f2?_0xd52853['count']:_0x27145c[_0x246b('0x1e')]+_0x27145c['limit'];var _0x1fa153;if(_0x6233d>=_0x37af5a){_0x6233d=_0x37af5a;_0x1fa153=0xc8;}else{_0x1fa153=0xce;}_0x118c72[_0x246b('0x1a')](_0x1fa153);return _0x118c72['set']('Content-Range',_0x2663bf+'-'+_0x6233d+'/'+_0x37af5a)['json'](_0xd52853);}return null;};}function patchUpdates(_0x11ccdc){return function(_0x510af3){try{jsonpatch[_0x246b('0x1f')](_0x510af3,_0x11ccdc,!![]);}catch(_0x5bca1f){return BPromise[_0x246b('0x20')](_0x5bca1f);}return _0x510af3[_0x246b('0x21')]();};}function saveUpdates(_0x41f0a8,_0x4065bb){return function(_0x3f3358){if(_0x3f3358){return _0x3f3358[_0x246b('0x22')](_0x41f0a8)[_0x246b('0x23')](function(_0xcc5219){return _0xcc5219;});}return null;};}function removeEntity(_0x2354fb,_0x4684fa){return function(_0x13696f){if(_0x13696f){return _0x13696f[_0x246b('0x24')]()[_0x246b('0x23')](function(){_0x2354fb['status'](0xcc)[_0x246b('0x25')]();});}};}function handleEntityNotFound(_0x18dbdc,_0x5f511a){return function(_0x4c2533){if(!_0x4c2533){_0x18dbdc['sendStatus'](0x194);}return _0x4c2533;};}function handleError(_0x38a236,_0x104d62){_0x104d62=_0x104d62||0x1f4;return function(_0x83a46d){logger[_0x246b('0x26')](_0x83a46d[_0x246b('0x27')]);if(_0x83a46d[_0x246b('0x28')]){delete _0x83a46d[_0x246b('0x28')];}_0x38a236[_0x246b('0x1a')](_0x104d62)['send'](_0x83a46d);};}exports[_0x246b('0x29')]=function(_0x59c1a8,_0x5dbe06){var _0x31282e={},_0x5e1276={},_0x57387b={'count':0x0,'rows':[]};var _0x39e225=_[_0x246b('0x2a')](db['ZendeskField'][_0x246b('0x2b')],function(_0x29fc78){return{'name':_0x29fc78[_0x246b('0x2c')],'type':_0x29fc78[_0x246b('0x2d')]['key']};});_0x5e1276['model']=_[_0x246b('0x2a')](_0x39e225,_0x246b('0x28'));_0x5e1276[_0x246b('0x2e')]=_['keys'](_0x59c1a8[_0x246b('0x2e')]);_0x5e1276['filters']=_[_0x246b('0x2f')](_0x5e1276['model'],_0x5e1276[_0x246b('0x2e')]);_0x31282e[_0x246b('0x30')]=_[_0x246b('0x2f')](_0x5e1276[_0x246b('0x31')],qs[_0x246b('0x32')](_0x59c1a8[_0x246b('0x2e')]['fields']));_0x31282e['attributes']=_0x31282e['attributes']['length']?_0x31282e[_0x246b('0x30')]:_0x5e1276[_0x246b('0x31')];if(!_0x59c1a8[_0x246b('0x2e')]['hasOwnProperty'](_0x246b('0x33'))){_0x31282e['limit']=qs[_0x246b('0x1c')](_0x59c1a8[_0x246b('0x2e')]['limit']);_0x31282e[_0x246b('0x1e')]=qs[_0x246b('0x1e')](_0x59c1a8['query']['offset']);}_0x31282e['order']=qs[_0x246b('0x34')](_0x59c1a8['query']['sort']);_0x31282e[_0x246b('0x35')]=qs['filters'](_[_0x246b('0x36')](_0x59c1a8[_0x246b('0x2e')],_0x5e1276['filters']),_0x39e225);if(_0x59c1a8[_0x246b('0x2e')][_0x246b('0x37')]){_0x31282e['where']=_[_0x246b('0x38')](_0x31282e['where'],{'$or':_[_0x246b('0x2a')](_0x39e225,function(_0x4f1297){if(_0x4f1297[_0x246b('0x2d')]!=='VIRTUAL'){var _0x3237c2={};_0x3237c2[_0x4f1297[_0x246b('0x28')]]={'$like':'%'+_0x59c1a8[_0x246b('0x2e')][_0x246b('0x37')]+'%'};return _0x3237c2;}})});}_0x31282e=_[_0x246b('0x38')]({},_0x31282e,_0x59c1a8['options']);var _0x1fd7c1={'where':_0x31282e[_0x246b('0x35')]};return db[_0x246b('0x39')][_0x246b('0x1d')](_0x1fd7c1)[_0x246b('0x23')](function(_0x1b2cf0){_0x57387b[_0x246b('0x1d')]=_0x1b2cf0;if(_0x59c1a8[_0x246b('0x2e')]['includeAll']){_0x31282e[_0x246b('0x3a')]=[{'all':!![]}];}return db[_0x246b('0x39')][_0x246b('0x3b')](_0x31282e);})[_0x246b('0x23')](function(_0x366da1){_0x57387b[_0x246b('0x3c')]=_0x366da1;return _0x57387b;})[_0x246b('0x23')](respondWithFilteredResult(_0x5dbe06,_0x31282e))[_0x246b('0x3d')](handleError(_0x5dbe06,null));};exports[_0x246b('0x3e')]=function(_0xc31b18,_0x24e6f4){var _0x3c3542={'raw':!![],'where':{'id':_0xc31b18[_0x246b('0x3f')]['id']}},_0x540dfc={};_0x540dfc[_0x246b('0x31')]=_[_0x246b('0x40')](db[_0x246b('0x39')][_0x246b('0x2b')]);_0x540dfc[_0x246b('0x2e')]=_[_0x246b('0x40')](_0xc31b18[_0x246b('0x2e')]);_0x540dfc['filters']=_['intersection'](_0x540dfc[_0x246b('0x31')],_0x540dfc['query']);_0x3c3542[_0x246b('0x30')]=_[_0x246b('0x2f')](_0x540dfc[_0x246b('0x31')],qs['fields'](_0xc31b18[_0x246b('0x2e')]['fields']));_0x3c3542[_0x246b('0x30')]=_0x3c3542[_0x246b('0x30')][_0x246b('0x41')]?_0x3c3542[_0x246b('0x30')]:_0x540dfc[_0x246b('0x31')];if(_0xc31b18[_0x246b('0x2e')][_0x246b('0x42')]){_0x3c3542[_0x246b('0x3a')]=[{'all':!![]}];}_0x3c3542=_[_0x246b('0x38')]({},_0x3c3542,_0xc31b18[_0x246b('0x43')]);return db['ZendeskField'][_0x246b('0x44')](_0x3c3542)['then'](handleEntityNotFound(_0x24e6f4,null))[_0x246b('0x23')](respondWithResult(_0x24e6f4,null))['catch'](handleError(_0x24e6f4,null));};exports[_0x246b('0x45')]=function(_0x146e91,_0x49ce94){return db[_0x246b('0x39')][_0x246b('0x45')](_0x146e91[_0x246b('0x46')],{})[_0x246b('0x23')](respondWithResult(_0x49ce94,0xc9))[_0x246b('0x3d')](handleError(_0x49ce94,null));};exports['update']=function(_0x250ba8,_0x27757b){if(_0x250ba8[_0x246b('0x46')]['id']){delete _0x250ba8[_0x246b('0x46')]['id'];}return db[_0x246b('0x39')][_0x246b('0x44')]({'where':{'id':_0x250ba8[_0x246b('0x3f')]['id']}})[_0x246b('0x23')](handleEntityNotFound(_0x27757b,null))[_0x246b('0x23')](saveUpdates(_0x250ba8['body'],null))[_0x246b('0x23')](respondWithResult(_0x27757b,null))[_0x246b('0x3d')](handleError(_0x27757b,null));};exports[_0x246b('0x24')]=function(_0xc74eab,_0x395b43){return db['ZendeskField'][_0x246b('0x44')]({'where':{'id':_0xc74eab[_0x246b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x395b43,null))[_0x246b('0x23')](removeEntity(_0x395b43,null))[_0x246b('0x3d')](handleError(_0x395b43,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index f326c98..f717e65 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 _0x9311=['idField','FieldId','lodash','util','../../config/logger','request-promise','path','rimraf','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x9311,0x1a2));var _0x1931=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9311[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1931('0x0'));var util=require(_0x1931('0x1'));var logger=require(_0x1931('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1931('0x3'));var fs=require('fs');var path=require(_0x1931('0x4'));var rimraf=require(_0x1931('0x5'));var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module[_0x1931('0x6')]=function(_0x271523,_0x2b4068){return _0x271523[_0x1931('0x7')](_0x1931('0x8'),attributes,{'tableName':_0x1931('0x9'),'paranoid':![],'indexes':[{'name':_0x1931('0xa'),'fields':[_0x1931('0xb'),_0x1931('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaae2=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','define','zendesk_unique_index','idField','FieldId','lodash'];(function(_0x545a3a,_0x3123aa){var _0x5a5493=function(_0x4e6bce){while(--_0x4e6bce){_0x545a3a['push'](_0x545a3a['shift']());}};_0x5a5493(++_0x3123aa);}(_0xaae2,0xfb));var _0x2aae=function(_0x4d22b1,_0xb1b3c3){_0x4d22b1=_0x4d22b1-0x0;var _0x21c320=_0xaae2[_0x4d22b1];return _0x21c320;};'use strict';var _=require(_0x2aae('0x0'));var util=require(_0x2aae('0x1'));var logger=require('../../config/logger')(_0x2aae('0x2'));var moment=require(_0x2aae('0x3'));var BPromise=require(_0x2aae('0x4'));var rp=require(_0x2aae('0x5'));var fs=require('fs');var path=require(_0x2aae('0x6'));var rimraf=require(_0x2aae('0x7'));var config=require(_0x2aae('0x8'));var attributes=require(_0x2aae('0x9'));module['exports']=function(_0x4a245c,_0x51ac66){return _0x4a245c[_0x2aae('0xa')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x2aae('0xb'),'fields':[_0x2aae('0xc'),_0x2aae('0xd')],'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 66ae9fc..8b14348 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 _0x271e=['catch','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','info','result'];(function(_0x1d7973,_0x357676){var _0x43190c=function(_0x4dd797){while(--_0x4dd797){_0x1d7973['push'](_0x1d7973['shift']());}};_0x43190c(++_0x357676);}(_0x271e,0x14b));var _0xe271=function(_0x3687f1,_0x4fbdb8){_0x3687f1=_0x3687f1-0x0;var _0x216eee=_0x271e[_0x3687f1];return _0x216eee;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe271('0x0'));var BPromise=require(_0xe271('0x1'));var rs=require(_0xe271('0x2'));var fs=require('fs');var Redis=require(_0xe271('0x3'));var db=require(_0xe271('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe271('0x5'));var config=require(_0xe271('0x6'));var jayson=require(_0xe271('0x7'));var client=jayson[_0xe271('0x8')][_0xe271('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33c148,_0x1c895a,_0x3113a7){return new BPromise(function(_0x4ffa99,_0x25d41a){return client[_0xe271('0xa')](_0x33c148,_0x3113a7)[_0xe271('0xb')](function(_0x305259){logger['info']('ZendeskField,\x20%s,\x20%s',_0x1c895a,_0xe271('0xc'));logger[_0xe271('0xd')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x1c895a,_0xe271('0xc'),JSON[_0xe271('0xe')](_0x305259));if(_0x305259[_0xe271('0xf')]){if(_0x305259['error'][_0xe271('0x10')]===0x1f4){logger[_0xe271('0xf')](_0xe271('0x11'),_0x1c895a,_0x305259[_0xe271('0xf')][_0xe271('0x12')]);return _0x25d41a(_0x305259['error'][_0xe271('0x12')]);}logger[_0xe271('0xf')](_0xe271('0x11'),_0x1c895a,_0x305259['error'][_0xe271('0x12')]);return _0x4ffa99(_0x305259['error']['message']);}else{logger[_0xe271('0x13')](_0xe271('0x11'),_0x1c895a,_0xe271('0xc'));_0x4ffa99(_0x305259[_0xe271('0x14')][_0xe271('0x12')]);}})[_0xe271('0x15')](function(_0x11c633){logger['error'](_0xe271('0x11'),_0x1c895a,_0x11c633);_0x25d41a(_0x11c633);});});} \ No newline at end of file +var _0x8878=['../../config/environment','jayson/promise','http','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0x8878,0x86));var _0x8887=function(_0x2920dd,_0x19d049){_0x2920dd=_0x2920dd-0x0;var _0x5d4e52=_0x8878[_0x2920dd];return _0x5d4e52;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8887('0x0'));var BPromise=require(_0x8887('0x1'));var rs=require(_0x8887('0x2'));var fs=require('fs');var Redis=require(_0x8887('0x3'));var db=require(_0x8887('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8887('0x5'));var config=require(_0x8887('0x6'));var jayson=require(_0x8887('0x7'));var client=jayson['client'][_0x8887('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4908f0,_0x214286,_0xfb3df1){return new BPromise(function(_0x1d34cc,_0x1a8457){return client[_0x8887('0x9')](_0x4908f0,_0xfb3df1)['then'](function(_0x544217){logger[_0x8887('0xa')](_0x8887('0xb'),_0x214286,_0x8887('0xc'));logger[_0x8887('0xd')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x214286,'request\x20sent',JSON[_0x8887('0xe')](_0x544217));if(_0x544217['error']){if(_0x544217[_0x8887('0xf')][_0x8887('0x10')]===0x1f4){logger[_0x8887('0xf')](_0x8887('0xb'),_0x214286,_0x544217[_0x8887('0xf')][_0x8887('0x11')]);return _0x1a8457(_0x544217[_0x8887('0xf')][_0x8887('0x11')]);}logger[_0x8887('0xf')](_0x8887('0xb'),_0x214286,_0x544217[_0x8887('0xf')]['message']);return _0x1d34cc(_0x544217[_0x8887('0xf')]['message']);}else{logger[_0x8887('0xa')]('ZendeskField,\x20%s,\x20%s',_0x214286,'request\x20sent');_0x1d34cc(_0x544217[_0x8887('0x12')][_0x8887('0x11')]);}})[_0x8887('0x13')](function(_0x19b70e){logger[_0x8887('0xf')](_0x8887('0xb'),_0x214286,_0x19b70e);_0x1a8457(_0x19b70e);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 6c2fb99..ea04b43 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 _0x0d72=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','isAuthenticated','index','get','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x39da0f,_0x1af81a){var _0x100b0f=function(_0x597b52){while(--_0x597b52){_0x39da0f['push'](_0x39da0f['shift']());}};_0x100b0f(++_0x1af81a);}(_0x0d72,0x74));var _0x20d7=function(_0x5c31de,_0x52974a){_0x5c31de=_0x5c31de-0x0;var _0x401eeb=_0x0d72[_0x5c31de];return _0x401eeb;};'use strict';var multer=require(_0x20d7('0x0'));var util=require(_0x20d7('0x1'));var path=require('path');var timeout=require(_0x20d7('0x2'));var express=require(_0x20d7('0x3'));var router=express[_0x20d7('0x4')]();var fs_extra=require(_0x20d7('0x5'));var auth=require(_0x20d7('0x6'));var interaction=require(_0x20d7('0x7'));var config=require('../../config/environment');var controller=require(_0x20d7('0x8'));router['get']('/',auth[_0x20d7('0x9')](),controller[_0x20d7('0xa')]);router[_0x20d7('0xb')]('/:id',auth[_0x20d7('0x9')](),controller[_0x20d7('0xc')]);router[_0x20d7('0xb')]('/:id/configurations',auth[_0x20d7('0x9')](),controller[_0x20d7('0xd')]);router[_0x20d7('0xb')]('/:id/fields',auth[_0x20d7('0x9')](),controller[_0x20d7('0xe')]);router[_0x20d7('0xf')]('/',auth[_0x20d7('0x9')](),controller[_0x20d7('0x10')]);router[_0x20d7('0xf')](_0x20d7('0x11'),auth[_0x20d7('0x9')](),controller[_0x20d7('0x12')]);router[_0x20d7('0x13')](_0x20d7('0x14'),auth[_0x20d7('0x9')](),controller['update']);router[_0x20d7('0x15')](_0x20d7('0x14'),auth['isAuthenticated'](),controller[_0x20d7('0x16')]);module[_0x20d7('0x17')]=router; \ No newline at end of file +var _0x11e3=['get','isAuthenticated','index','getConfigurations','/:id/fields','post','/:id/configurations','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x202d7a,_0x3b318d){var _0x37f59d=function(_0x23ccc9){while(--_0x23ccc9){_0x202d7a['push'](_0x202d7a['shift']());}};_0x37f59d(++_0x3b318d);}(_0x11e3,0x188));var _0x311e=function(_0x300876,_0x12540c){_0x300876=_0x300876-0x0;var _0x4685fe=_0x11e3[_0x300876];return _0x4685fe;};'use strict';var multer=require(_0x311e('0x0'));var util=require(_0x311e('0x1'));var path=require(_0x311e('0x2'));var timeout=require(_0x311e('0x3'));var express=require('express');var router=express[_0x311e('0x4')]();var fs_extra=require(_0x311e('0x5'));var auth=require(_0x311e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x311e('0x7'));var controller=require('./intZohoAccount.controller');router[_0x311e('0x8')]('/',auth[_0x311e('0x9')](),controller[_0x311e('0xa')]);router[_0x311e('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x311e('0x8')]('/:id/configurations',auth[_0x311e('0x9')](),controller[_0x311e('0xb')]);router[_0x311e('0x8')](_0x311e('0xc'),auth[_0x311e('0x9')](),controller['getFields']);router[_0x311e('0xd')]('/',auth[_0x311e('0x9')](),controller['create']);router[_0x311e('0xd')](_0x311e('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x311e('0xf')](_0x311e('0x10'),auth[_0x311e('0x9')](),controller[_0x311e('0x11')]);router[_0x311e('0x12')](_0x311e('0x10'),auth[_0x311e('0x9')](),controller['destroy']);module[_0x311e('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 db71bfc..298115e 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 _0x6c76=['STRING','sequelize','exports'];(function(_0x250d15,_0x4ee72b){var _0x549de7=function(_0x3a02ee){while(--_0x3a02ee){_0x250d15['push'](_0x250d15['shift']());}};_0x549de7(++_0x4ee72b);}(_0x6c76,0x184));var _0x66c7=function(_0x4ab757,_0x387214){_0x4ab757=_0x4ab757-0x0;var _0x38125e=_0x6c76[_0x4ab757];return _0x38125e;};'use strict';var Sequelize=require(_0x66c7('0x0'));module[_0x66c7('0x1')]={'name':{'type':Sequelize[_0x66c7('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x66c7('0x2')]},'zone':{'type':Sequelize[_0x66c7('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x66c7('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x66c7('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbec5=['STRING','sequelize','exports'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xbec5,0xe5));var _0x5bec=function(_0x416cdc,_0x213b87){_0x416cdc=_0x416cdc-0x0;var _0x1931ce=_0xbec5[_0x416cdc];return _0x1931ce;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5bec('0x2')]},'host':{'type':Sequelize[_0x5bec('0x2')]},'zone':{'type':Sequelize[_0x5bec('0x2')]},'clientId':{'type':Sequelize[_0x5bec('0x2')]},'clientSecret':{'type':Sequelize[_0x5bec('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0x5bec('0x2')]},'refreshToken':{'type':Sequelize[_0x5bec('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index f1eef36..2969e6a 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 _0xe4de=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','ZohoAccount','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','refreshToken','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Type','includes','api_name','system_mandatory','push','data_type','picklist','pick_list_values','test','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce'];(function(_0x4b2c57,_0x2d8cd9){var _0x10ac0b=function(_0x48de8b){while(--_0x48de8b){_0x4b2c57['push'](_0x4b2c57['shift']());}};_0x10ac0b(++_0x2d8cd9);}(_0xe4de,0x16e));var _0xee4d=function(_0x52afd3,_0x59b079){_0x52afd3=_0x52afd3-0x0;var _0x162d2d=_0xe4de[_0x52afd3];return _0x162d2d;};'use strict';var emlformat=require(_0xee4d('0x0'));var rimraf=require(_0xee4d('0x1'));var zipdir=require(_0xee4d('0x2'));var jsonpatch=require(_0xee4d('0x3'));var rp=require('request-promise');var moment=require(_0xee4d('0x4'));var BPromise=require(_0xee4d('0x5'));var Mustache=require(_0xee4d('0x6'));var util=require(_0xee4d('0x7'));var path=require(_0xee4d('0x8'));var sox=require(_0xee4d('0x9'));var csv=require('to-csv');var ejs=require(_0xee4d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee4d('0xb'));var squel=require(_0xee4d('0xc'));var crypto=require(_0xee4d('0xd'));var jsforce=require(_0xee4d('0xe'));var deskjs=require(_0xee4d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xee4d('0x10'));var Redis=require(_0xee4d('0x11'));var authService=require(_0xee4d('0x12'));var qs=require(_0xee4d('0x13'));var as=require(_0xee4d('0x14'));var hardwareService=require(_0xee4d('0x15'));var logger=require('../../config/logger')(_0xee4d('0x16'));var utils=require('../../config/utils');var config=require(_0xee4d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xee4d('0x18'));function respondWithStatusCode(_0x22c899,_0x2ea665){_0x2ea665=_0x2ea665||0xcc;return function(_0x22ae9d){if(_0x22ae9d){return _0x22c899[_0xee4d('0x19')](_0x2ea665);}return _0x22c899[_0xee4d('0x1a')](_0x2ea665)[_0xee4d('0x1b')]();};}function respondWithResult(_0xf89dd3,_0x3b03ff){_0x3b03ff=_0x3b03ff||0xc8;return function(_0x686450){if(_0x686450){return _0xf89dd3[_0xee4d('0x1a')](_0x3b03ff)[_0xee4d('0x1c')](_0x686450);}};}function respondWithFilteredResult(_0x1b272b,_0x31179c){return function(_0x5e192d){if(_0x5e192d){var _0x50ca80=typeof _0x31179c['offset']===_0xee4d('0x1d')&&typeof _0x31179c[_0xee4d('0x1e')]==='undefined';var _0x4f6022=_0x5e192d[_0xee4d('0x1f')];var _0x323830=_0x50ca80?0x0:_0x31179c[_0xee4d('0x20')];var _0x260efc=_0x50ca80?_0x5e192d[_0xee4d('0x1f')]:_0x31179c['offset']+_0x31179c[_0xee4d('0x1e')];var _0x5f2172;if(_0x260efc>=_0x4f6022){_0x260efc=_0x4f6022;_0x5f2172=0xc8;}else{_0x5f2172=0xce;}_0x1b272b['status'](_0x5f2172);return _0x1b272b[_0xee4d('0x21')](_0xee4d('0x22'),_0x323830+'-'+_0x260efc+'/'+_0x4f6022)[_0xee4d('0x1c')](_0x5e192d);}return null;};}function patchUpdates(_0x210cad){return function(_0x19b35f){try{jsonpatch[_0xee4d('0x23')](_0x19b35f,_0x210cad,!![]);}catch(_0x38b40c){return BPromise[_0xee4d('0x24')](_0x38b40c);}return _0x19b35f[_0xee4d('0x25')]();};}function saveUpdates(_0x3964ac,_0xc4f2c4){return function(_0xb030f2){if(_0xb030f2){return _0xb030f2[_0xee4d('0x26')](_0x3964ac)[_0xee4d('0x27')](function(_0x44a151){return _0x44a151;});}return null;};}function removeEntity(_0x18f6a3,_0xb0cf51){return function(_0x34eeda){if(_0x34eeda){return _0x34eeda[_0xee4d('0x28')]()[_0xee4d('0x27')](function(){_0x18f6a3[_0xee4d('0x1a')](0xcc)[_0xee4d('0x1b')]();});}};}function handleEntityNotFound(_0x469f0a,_0x337bf8){return function(_0x3d7964){if(!_0x3d7964){_0x469f0a[_0xee4d('0x19')](0x194);}return _0x3d7964;};}function handleError(_0x257705,_0xc66113){_0xc66113=_0xc66113||0x1f4;return function(_0x1b765e){logger[_0xee4d('0x29')](_0x1b765e[_0xee4d('0x2a')]);if(_0x1b765e[_0xee4d('0x2b')]){delete _0x1b765e['name'];}_0x257705[_0xee4d('0x1a')](_0xc66113)[_0xee4d('0x2c')](_0x1b765e);};}exports['index']=function(_0x91b9c6,_0x481369){var _0x150fe7={},_0x2ce18b={},_0x20c44d={'count':0x0,'rows':[]};var _0x2772f9=_[_0xee4d('0x2d')](db['ZohoAccount'][_0xee4d('0x2e')],function(_0xaeb7b7){return{'name':_0xaeb7b7[_0xee4d('0x2f')],'type':_0xaeb7b7[_0xee4d('0x30')]['key']};});_0x2ce18b['model']=_[_0xee4d('0x2d')](_0x2772f9,'name');_0x2ce18b[_0xee4d('0x31')]=_[_0xee4d('0x32')](_0x91b9c6[_0xee4d('0x31')]);_0x2ce18b[_0xee4d('0x33')]=_[_0xee4d('0x34')](_0x2ce18b[_0xee4d('0x35')],_0x2ce18b['query']);_0x150fe7[_0xee4d('0x36')]=_[_0xee4d('0x34')](_0x2ce18b['model'],qs[_0xee4d('0x37')](_0x91b9c6[_0xee4d('0x31')][_0xee4d('0x37')]));_0x150fe7[_0xee4d('0x36')]=_0x150fe7[_0xee4d('0x36')][_0xee4d('0x38')]?_0x150fe7['attributes']:_0x2ce18b['model'];if(!_0x91b9c6[_0xee4d('0x31')][_0xee4d('0x39')](_0xee4d('0x3a'))){_0x150fe7[_0xee4d('0x1e')]=qs[_0xee4d('0x1e')](_0x91b9c6['query']['limit']);_0x150fe7[_0xee4d('0x20')]=qs['offset'](_0x91b9c6[_0xee4d('0x31')][_0xee4d('0x20')]);}_0x150fe7[_0xee4d('0x3b')]=qs[_0xee4d('0x3c')](_0x91b9c6['query']['sort']);_0x150fe7[_0xee4d('0x3d')]=qs[_0xee4d('0x33')](_['pick'](_0x91b9c6[_0xee4d('0x31')],_0x2ce18b[_0xee4d('0x33')]),_0x2772f9);if(_0x91b9c6[_0xee4d('0x31')][_0xee4d('0x3e')]){_0x150fe7['where']=_[_0xee4d('0x3f')](_0x150fe7[_0xee4d('0x3d')],{'$or':_['map'](_0x2772f9,function(_0x54f6dd){if(_0x54f6dd[_0xee4d('0x30')]!=='VIRTUAL'){var _0x166942={};_0x166942[_0x54f6dd['name']]={'$like':'%'+_0x91b9c6[_0xee4d('0x31')][_0xee4d('0x3e')]+'%'};return _0x166942;}})});}_0x150fe7=_[_0xee4d('0x3f')]({},_0x150fe7,_0x91b9c6[_0xee4d('0x40')]);var _0x385920={'where':_0x150fe7[_0xee4d('0x3d')]};return db[_0xee4d('0x41')][_0xee4d('0x1f')](_0x385920)['then'](function(_0x5cb859){_0x20c44d['count']=_0x5cb859;if(_0x91b9c6[_0xee4d('0x31')][_0xee4d('0x42')]){_0x150fe7[_0xee4d('0x43')]=[{'all':!![]}];}return db[_0xee4d('0x41')][_0xee4d('0x44')](_0x150fe7);})[_0xee4d('0x27')](function(_0x5bdef9){_0x20c44d[_0xee4d('0x45')]=_0x5bdef9;return _0x20c44d;})['then'](respondWithFilteredResult(_0x481369,_0x150fe7))[_0xee4d('0x46')](handleError(_0x481369,null));};exports[_0xee4d('0x47')]=function(_0x3d2766,_0x521a6d){var _0x5a3e7b={'raw':![],'where':{'id':_0x3d2766[_0xee4d('0x48')]['id']}},_0x6804b1={};_0x6804b1[_0xee4d('0x35')]=_['keys'](db[_0xee4d('0x41')][_0xee4d('0x2e')]);_0x6804b1[_0xee4d('0x31')]=_[_0xee4d('0x32')](_0x3d2766[_0xee4d('0x31')]);_0x6804b1[_0xee4d('0x33')]=_[_0xee4d('0x34')](_0x6804b1[_0xee4d('0x35')],_0x6804b1['query']);_0x5a3e7b[_0xee4d('0x36')]=_[_0xee4d('0x34')](_0x6804b1[_0xee4d('0x35')],qs[_0xee4d('0x37')](_0x3d2766['query']['fields']));_0x5a3e7b[_0xee4d('0x36')]=_0x5a3e7b[_0xee4d('0x36')][_0xee4d('0x38')]?_0x5a3e7b[_0xee4d('0x36')]:_0x6804b1[_0xee4d('0x35')];if(_0x3d2766[_0xee4d('0x31')][_0xee4d('0x42')]){_0x5a3e7b[_0xee4d('0x43')]=[{'all':!![]}];}_0x5a3e7b=_[_0xee4d('0x3f')]({},_0x5a3e7b,_0x3d2766[_0xee4d('0x40')]);return db[_0xee4d('0x41')][_0xee4d('0x49')](_0x5a3e7b)['then'](handleEntityNotFound(_0x521a6d,null))['then'](respondWithResult(_0x521a6d,null))['catch'](handleError(_0x521a6d,null));};exports[_0xee4d('0x4a')]=function(_0x3f4e91,_0x176bc5){return db['ZohoAccount'][_0xee4d('0x4a')](_0x3f4e91['body'],{})[_0xee4d('0x27')](respondWithResult(_0x176bc5,0xc9))[_0xee4d('0x46')](handleError(_0x176bc5,null));};exports[_0xee4d('0x26')]=function(_0x499fcd,_0x1939c4){if(_0x499fcd['body']['id']){delete _0x499fcd[_0xee4d('0x4b')]['id'];}return db[_0xee4d('0x41')]['find']({'where':{'id':_0x499fcd[_0xee4d('0x48')]['id']}})[_0xee4d('0x27')](handleEntityNotFound(_0x1939c4,null))['then'](saveUpdates(_0x499fcd['body'],null))[_0xee4d('0x27')](respondWithResult(_0x1939c4,null))['catch'](handleError(_0x1939c4,null));};exports[_0xee4d('0x28')]=function(_0x3b8289,_0x31fb8b){return db[_0xee4d('0x41')][_0xee4d('0x49')]({'where':{'id':_0x3b8289[_0xee4d('0x48')]['id']}})[_0xee4d('0x27')](handleEntityNotFound(_0x31fb8b,null))[_0xee4d('0x27')](removeEntity(_0x31fb8b,null))[_0xee4d('0x46')](handleError(_0x31fb8b,null));};exports[_0xee4d('0x4c')]=function(_0x5d3ba6,_0x34f84b,_0x3f2bd3){var _0x5ad4ee={};var _0x5a7767={};var _0x156640;var _0x42a75a;return db[_0xee4d('0x41')]['findOne']({'where':{'id':_0x5d3ba6[_0xee4d('0x48')]['id']}})['then'](handleEntityNotFound(_0x34f84b,null))[_0xee4d('0x27')](function(_0x40fdcd){if(_0x40fdcd){_0x156640=_0x40fdcd;_0x5a7767[_0xee4d('0x35')]=_[_0xee4d('0x32')](db['ZohoConfiguration'][_0xee4d('0x2e')]);_0x5a7767[_0xee4d('0x31')]=_[_0xee4d('0x32')](_0x5d3ba6[_0xee4d('0x31')]);_0x5a7767['filters']=_[_0xee4d('0x34')](_0x5a7767['model'],_0x5a7767['query']);_0x5ad4ee[_0xee4d('0x36')]=_['intersection'](_0x5a7767['model'],qs[_0xee4d('0x37')](_0x5d3ba6[_0xee4d('0x31')]['fields']));_0x5ad4ee[_0xee4d('0x36')]=_0x5ad4ee['attributes'][_0xee4d('0x38')]?_0x5ad4ee['attributes']:_0x5a7767[_0xee4d('0x35')];_0x5ad4ee[_0xee4d('0x3b')]=qs[_0xee4d('0x3c')](_0x5d3ba6[_0xee4d('0x31')][_0xee4d('0x3c')]);_0x5ad4ee['where']=qs[_0xee4d('0x33')](_['pick'](_0x5d3ba6[_0xee4d('0x31')],_0x5a7767['filters']));if(_0x5d3ba6['query']['filter']){_0x5ad4ee[_0xee4d('0x3d')]=_[_0xee4d('0x3f')](_0x5ad4ee[_0xee4d('0x3d')],{'$or':_[_0xee4d('0x2d')](_0x5ad4ee[_0xee4d('0x36')],function(_0x18b60b){var _0x13e46d={};_0x13e46d[_0x18b60b]={'$like':'%'+_0x5d3ba6[_0xee4d('0x31')][_0xee4d('0x3e')]+'%'};return _0x13e46d;})});}_0x5ad4ee=_[_0xee4d('0x3f')]({},_0x5ad4ee,_0x5d3ba6[_0xee4d('0x40')]);return _0x156640['getConfigurations'](_0x5ad4ee);}})['then'](function(_0x4bdee7){if(_0x4bdee7){_0x42a75a=_0x4bdee7[_0xee4d('0x38')];if(!_0x5d3ba6[_0xee4d('0x31')][_0xee4d('0x39')](_0xee4d('0x3a'))){_0x5ad4ee[_0xee4d('0x1e')]=qs['limit'](_0x5d3ba6[_0xee4d('0x31')][_0xee4d('0x1e')]);_0x5ad4ee[_0xee4d('0x20')]=qs[_0xee4d('0x20')](_0x5d3ba6[_0xee4d('0x31')][_0xee4d('0x20')]);}return _0x156640[_0xee4d('0x4c')](_0x5ad4ee);}})[_0xee4d('0x27')](function(_0x42950a){if(_0x42950a){return _0x42950a?{'count':_0x42a75a,'rows':_0x42950a}:null;}})[_0xee4d('0x27')](respondWithResult(_0x34f84b,null))['catch'](handleError(_0x34f84b,null));};exports[_0xee4d('0x4d')]=function(_0x144aec,_0x545373,_0x357584){if(_0x144aec[_0xee4d('0x4b')]['id']){delete _0x144aec[_0xee4d('0x4b')]['id'];}return db[_0xee4d('0x41')][_0xee4d('0x4e')]({'where':{'id':_0x144aec[_0xee4d('0x48')]['id']}})[_0xee4d('0x27')](handleEntityNotFound(_0x545373,null))[_0xee4d('0x27')](function(_0x559094){if(_0x559094){_0x144aec[_0xee4d('0x4b')][_0xee4d('0x4f')]=_0x559094['id'];_0x144aec[_0xee4d('0x4b')][_0xee4d('0x50')]=integrations[_0xee4d('0x51')](_0x144aec[_0xee4d('0x4b')][_0xee4d('0x52')],_0x144aec['body']['type']);_0x144aec[_0xee4d('0x4b')][_0xee4d('0x53')]=integrations['getDescriptions'](_0x144aec[_0xee4d('0x4b')][_0xee4d('0x52')],_0x144aec[_0xee4d('0x4b')][_0xee4d('0x30')]);return db[_0xee4d('0x54')][_0xee4d('0x4a')](_0x144aec['body'],{'include':[{'model':db[_0xee4d('0x55')],'as':_0xee4d('0x50')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0xee4d('0x27')](respondWithResult(_0x545373,null))[_0xee4d('0x46')](handleError(_0x545373,null));};function getAccessToken(_0xe96072){return new Promise(function(_0x4f7bab,_0x44d888){var _0x41b658;switch(_0xe96072[_0xee4d('0x56')]){case'US':_0x41b658=_0xee4d('0x57');break;case'AU':_0x41b658=_0xee4d('0x58');break;case'EU':_0x41b658=_0xee4d('0x59');break;case'IN':_0x41b658=_0xee4d('0x5a');break;case'CN':_0x41b658=_0xee4d('0x5b');break;default:_0x41b658=_0xee4d('0x59');break;}var _0x582ea1={'method':'POST','uri':_0x41b658+'/oauth/v2/token','qs':{'refresh_token':_0xe96072[_0xee4d('0x5c')],'client_id':_0xe96072['clientId'],'client_secret':_0xe96072[_0xee4d('0x5d')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x582ea1)['then'](function(_0x378d92){if(_0x378d92[_0xee4d('0x5e')]){_0x4f7bab(_0x378d92['access_token']);}else{_0x44d888(_0xee4d('0x5f'));}})['catch'](function(_0x38dd63){_0x44d888(_0x38dd63);});});}exports[_0xee4d('0x60')]=function(_0x16d608,_0x541659,_0x10df2f){var _0x495ac7,_0x23ac07,_0x4d0ed6,_0x1e2d9a,_0x13656a;return db['ZohoAccount']['findOne']({'where':{'id':_0x16d608['params']['id']},'attributes':['id',_0xee4d('0x61'),_0xee4d('0x56'),'clientId',_0xee4d('0x5d'),_0xee4d('0x62'),'code','refreshToken']})[_0xee4d('0x27')](handleEntityNotFound(_0x541659,null))[_0xee4d('0x27')](function(_0x29f59c){_0x13656a=_0x29f59c;_0x495ac7=_0x13656a[_0xee4d('0x61')];_0x23ac07=_0x495ac7===_0xee4d('0x63')?'eu':_0xee4d('0x64');_0x4d0ed6=_0x13656a[_0xee4d('0x62')];var _0x2fabfe=_0x4d0ed6[_0xee4d('0x65')](-0x1);if(_0x2fabfe==='/'||_0x2fabfe==='\x5c'||_0x2fabfe===':'){_0x4d0ed6=_0x4d0ed6[_0xee4d('0x66')](0x0,_0x4d0ed6[_0xee4d('0x67')](_0x2fabfe));}if(!_0x13656a['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x13656a);})[_0xee4d('0x27')](function(_0x5b5b33){if(_0x5b5b33){return rp({'method':_0xee4d('0x68'),'uri':util[_0xee4d('0x69')](_0xee4d('0x6a'),_0x23ac07),'qs':{'module':_0xee4d('0x6b')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5b5b33},'json':!![]});}})[_0xee4d('0x27')](function(_0xd5c3ce){if(_0xd5c3ce){if(_0xd5c3ce[_0xee4d('0x6c')]&&_0xd5c3ce[_0xee4d('0x6c')][_0xee4d('0x29')]){throw new Error(_0xd5c3ce[_0xee4d('0x6c')][_0xee4d('0x29')][_0xee4d('0x6d')]);}var _0x4983d6=[];var _0x254ba7=[];var _0x77eb61=[_0xee4d('0x6e'),_0xee4d('0x6f'),_0xee4d('0x70'),_0xee4d('0x71'),_0xee4d('0x72'),'Call_Result','Call_Start_Time',_0xee4d('0x73')];_0x254ba7=_['remove'](_0xd5c3ce[_0xee4d('0x37')],function(_0x33d7be){return _0x77eb61[_0xee4d('0x74')](_0x33d7be[_0xee4d('0x75')]);});for(var _0x16625d=0x0;_0x16625d<_0x254ba7[_0xee4d('0x38')];_0x16625d++){if(_0x254ba7[_0x16625d][_0xee4d('0x76')]===![]){_0x4983d6[_0xee4d('0x77')]({'id':_0x254ba7[_0x16625d]['id'],'name':_0x254ba7[_0x16625d]['display_label'],'custom':_0x254ba7[_0x16625d]['custom_field'],'options':_0x254ba7[_0x16625d][_0xee4d('0x78')]===_0xee4d('0x79')&&_0x254ba7[_0x16625d][_0xee4d('0x7a')][_0xee4d('0x38')]>-0x1?_[_0xee4d('0x2d')](_0x254ba7[_0x16625d]['pick_list_values'],function(_0x109514){return{'name':_0x109514,'value':_0x109514};}):[]});}}return{'count':_0x4983d6[_0xee4d('0x38')],'rows':_0x4983d6};}else{return{'count':0x0,'rows':[]};}})[_0xee4d('0x27')](respondWithResult(_0x541659,null))[_0xee4d('0x46')](function(_0x3d64fc){var _0x376a1f=_0x16d608['query'][_0xee4d('0x7b')]?0x1f4:_0x3d64fc['statusCode']||0x1f4;logger[_0xee4d('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0xee4d('0x60'),_0x376a1f,JSON[_0xee4d('0x7c')](_0x3d64fc));delete _0x3d64fc[_0xee4d('0x2b')];if(_0x376a1f===0x191){_0x376a1f=0x190;}_0x541659['status'](_0x376a1f)[_0xee4d('0x2c')](_0x16d608[_0xee4d('0x31')][_0xee4d('0x7b')]?{'message':_0xee4d('0x7d'),'statusCode':_0x3d64fc[_0xee4d('0x7e')]}:_0x3d64fc);});}; \ No newline at end of file +var _0x40c6=['refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','error','message','Owner','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','system_mandatory','display_label','custom_field','data_type','pick_list_values','test','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','query','filters','intersection','attributes','model','fields','length','nolimit','sort','pick','where','merge','type','VIRTUAL','options','ZohoAccount','include','findAll','catch','params','keys','includeAll','find','create','body','getConfigurations','findOne','ZohoConfiguration','order','filter','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret'];(function(_0x373f3c,_0x44e12b){var _0x555326=function(_0x5dd8d9){while(--_0x5dd8d9){_0x373f3c['push'](_0x373f3c['shift']());}};_0x555326(++_0x44e12b);}(_0x40c6,0x9d));var _0x640c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x40c6[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x640c('0x0'));var rimraf=require(_0x640c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x640c('0x2'));var rp=require(_0x640c('0x3'));var moment=require(_0x640c('0x4'));var BPromise=require(_0x640c('0x5'));var Mustache=require(_0x640c('0x6'));var util=require(_0x640c('0x7'));var path=require(_0x640c('0x8'));var sox=require(_0x640c('0x9'));var csv=require(_0x640c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x640c('0xb'));var crypto=require('crypto');var jsforce=require(_0x640c('0xc'));var deskjs=require(_0x640c('0xd'));var toCsv=require(_0x640c('0xa'));var querystring=require('querystring');var Papa=require(_0x640c('0xe'));var Redis=require(_0x640c('0xf'));var authService=require(_0x640c('0x10'));var qs=require(_0x640c('0x11'));var as=require(_0x640c('0x12'));var hardwareService=require(_0x640c('0x13'));var logger=require('../../config/logger')(_0x640c('0x14'));var utils=require(_0x640c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x640c('0x16'));var db=require(_0x640c('0x17'))['db'];var integrations=require(_0x640c('0x18'));function respondWithStatusCode(_0x479e13,_0x118b90){_0x118b90=_0x118b90||0xcc;return function(_0x330a44){if(_0x330a44){return _0x479e13['sendStatus'](_0x118b90);}return _0x479e13['status'](_0x118b90)[_0x640c('0x19')]();};}function respondWithResult(_0x31df47,_0x47108f){_0x47108f=_0x47108f||0xc8;return function(_0x345c9b){if(_0x345c9b){return _0x31df47[_0x640c('0x1a')](_0x47108f)[_0x640c('0x1b')](_0x345c9b);}};}function respondWithFilteredResult(_0x4a67aa,_0x37a4ad){return function(_0x3094b4){if(_0x3094b4){var _0x497a51=typeof _0x37a4ad[_0x640c('0x1c')]===_0x640c('0x1d')&&typeof _0x37a4ad[_0x640c('0x1e')]===_0x640c('0x1d');var _0x173da7=_0x3094b4[_0x640c('0x1f')];var _0x3f31b3=_0x497a51?0x0:_0x37a4ad[_0x640c('0x1c')];var _0xfc5dda=_0x497a51?_0x3094b4[_0x640c('0x1f')]:_0x37a4ad['offset']+_0x37a4ad[_0x640c('0x1e')];var _0x59cb25;if(_0xfc5dda>=_0x173da7){_0xfc5dda=_0x173da7;_0x59cb25=0xc8;}else{_0x59cb25=0xce;}_0x4a67aa[_0x640c('0x1a')](_0x59cb25);return _0x4a67aa[_0x640c('0x20')](_0x640c('0x21'),_0x3f31b3+'-'+_0xfc5dda+'/'+_0x173da7)[_0x640c('0x1b')](_0x3094b4);}return null;};}function patchUpdates(_0x1aaf7c){return function(_0x32e6d4){try{jsonpatch[_0x640c('0x22')](_0x32e6d4,_0x1aaf7c,!![]);}catch(_0x1397c3){return BPromise['reject'](_0x1397c3);}return _0x32e6d4[_0x640c('0x23')]();};}function saveUpdates(_0x4f9d58,_0x16828e){return function(_0x5daf98){if(_0x5daf98){return _0x5daf98[_0x640c('0x24')](_0x4f9d58)[_0x640c('0x25')](function(_0x4e26a5){return _0x4e26a5;});}return null;};}function removeEntity(_0x4d43bd,_0x4200bd){return function(_0x32aa01){if(_0x32aa01){return _0x32aa01[_0x640c('0x26')]()[_0x640c('0x25')](function(){_0x4d43bd[_0x640c('0x1a')](0xcc)[_0x640c('0x19')]();});}};}function handleEntityNotFound(_0x4c0500,_0x1f7502){return function(_0x36a190){if(!_0x36a190){_0x4c0500[_0x640c('0x27')](0x194);}return _0x36a190;};}function handleError(_0x31ca2c,_0x34db53){_0x34db53=_0x34db53||0x1f4;return function(_0x3fb088){logger['error'](_0x3fb088['stack']);if(_0x3fb088[_0x640c('0x28')]){delete _0x3fb088['name'];}_0x31ca2c[_0x640c('0x1a')](_0x34db53)[_0x640c('0x29')](_0x3fb088);};}exports[_0x640c('0x2a')]=function(_0x4fec99,_0x4145f6){var _0x1bb944={},_0x400cf2={},_0x47f568={'count':0x0,'rows':[]};var _0x45989d=_[_0x640c('0x2b')](db['ZohoAccount'][_0x640c('0x2c')],function(_0x45b469){return{'name':_0x45b469[_0x640c('0x2d')],'type':_0x45b469['type']['key']};});_0x400cf2['model']=_[_0x640c('0x2b')](_0x45989d,_0x640c('0x28'));_0x400cf2[_0x640c('0x2e')]=_['keys'](_0x4fec99['query']);_0x400cf2[_0x640c('0x2f')]=_[_0x640c('0x30')](_0x400cf2['model'],_0x400cf2[_0x640c('0x2e')]);_0x1bb944[_0x640c('0x31')]=_[_0x640c('0x30')](_0x400cf2[_0x640c('0x32')],qs[_0x640c('0x33')](_0x4fec99[_0x640c('0x2e')]['fields']));_0x1bb944[_0x640c('0x31')]=_0x1bb944[_0x640c('0x31')][_0x640c('0x34')]?_0x1bb944[_0x640c('0x31')]:_0x400cf2[_0x640c('0x32')];if(!_0x4fec99[_0x640c('0x2e')]['hasOwnProperty'](_0x640c('0x35'))){_0x1bb944['limit']=qs[_0x640c('0x1e')](_0x4fec99[_0x640c('0x2e')][_0x640c('0x1e')]);_0x1bb944[_0x640c('0x1c')]=qs[_0x640c('0x1c')](_0x4fec99[_0x640c('0x2e')][_0x640c('0x1c')]);}_0x1bb944['order']=qs[_0x640c('0x36')](_0x4fec99[_0x640c('0x2e')][_0x640c('0x36')]);_0x1bb944['where']=qs[_0x640c('0x2f')](_[_0x640c('0x37')](_0x4fec99[_0x640c('0x2e')],_0x400cf2[_0x640c('0x2f')]),_0x45989d);if(_0x4fec99['query']['filter']){_0x1bb944[_0x640c('0x38')]=_[_0x640c('0x39')](_0x1bb944[_0x640c('0x38')],{'$or':_['map'](_0x45989d,function(_0x2755d6){if(_0x2755d6[_0x640c('0x3a')]!==_0x640c('0x3b')){var _0x274898={};_0x274898[_0x2755d6[_0x640c('0x28')]]={'$like':'%'+_0x4fec99['query']['filter']+'%'};return _0x274898;}})});}_0x1bb944=_['merge']({},_0x1bb944,_0x4fec99[_0x640c('0x3c')]);var _0x198c9e={'where':_0x1bb944[_0x640c('0x38')]};return db[_0x640c('0x3d')]['count'](_0x198c9e)[_0x640c('0x25')](function(_0x2f240c){_0x47f568['count']=_0x2f240c;if(_0x4fec99[_0x640c('0x2e')]['includeAll']){_0x1bb944[_0x640c('0x3e')]=[{'all':!![]}];}return db['ZohoAccount'][_0x640c('0x3f')](_0x1bb944);})['then'](function(_0x13ffb9){_0x47f568['rows']=_0x13ffb9;return _0x47f568;})[_0x640c('0x25')](respondWithFilteredResult(_0x4145f6,_0x1bb944))[_0x640c('0x40')](handleError(_0x4145f6,null));};exports['show']=function(_0x339302,_0x297699){var _0x4cef17={'raw':![],'where':{'id':_0x339302[_0x640c('0x41')]['id']}},_0x1aa8e0={};_0x1aa8e0[_0x640c('0x32')]=_['keys'](db[_0x640c('0x3d')][_0x640c('0x2c')]);_0x1aa8e0[_0x640c('0x2e')]=_[_0x640c('0x42')](_0x339302[_0x640c('0x2e')]);_0x1aa8e0[_0x640c('0x2f')]=_[_0x640c('0x30')](_0x1aa8e0[_0x640c('0x32')],_0x1aa8e0['query']);_0x4cef17[_0x640c('0x31')]=_[_0x640c('0x30')](_0x1aa8e0[_0x640c('0x32')],qs[_0x640c('0x33')](_0x339302['query'][_0x640c('0x33')]));_0x4cef17[_0x640c('0x31')]=_0x4cef17[_0x640c('0x31')]['length']?_0x4cef17[_0x640c('0x31')]:_0x1aa8e0[_0x640c('0x32')];if(_0x339302[_0x640c('0x2e')][_0x640c('0x43')]){_0x4cef17[_0x640c('0x3e')]=[{'all':!![]}];}_0x4cef17=_[_0x640c('0x39')]({},_0x4cef17,_0x339302[_0x640c('0x3c')]);return db['ZohoAccount'][_0x640c('0x44')](_0x4cef17)['then'](handleEntityNotFound(_0x297699,null))['then'](respondWithResult(_0x297699,null))['catch'](handleError(_0x297699,null));};exports[_0x640c('0x45')]=function(_0xf23461,_0x55d17d){return db[_0x640c('0x3d')]['create'](_0xf23461[_0x640c('0x46')],{})['then'](respondWithResult(_0x55d17d,0xc9))['catch'](handleError(_0x55d17d,null));};exports[_0x640c('0x24')]=function(_0x3a05f9,_0x1ab4fb){if(_0x3a05f9[_0x640c('0x46')]['id']){delete _0x3a05f9[_0x640c('0x46')]['id'];}return db[_0x640c('0x3d')][_0x640c('0x44')]({'where':{'id':_0x3a05f9[_0x640c('0x41')]['id']}})['then'](handleEntityNotFound(_0x1ab4fb,null))[_0x640c('0x25')](saveUpdates(_0x3a05f9[_0x640c('0x46')],null))[_0x640c('0x25')](respondWithResult(_0x1ab4fb,null))['catch'](handleError(_0x1ab4fb,null));};exports[_0x640c('0x26')]=function(_0x46fff1,_0x345576){return db[_0x640c('0x3d')][_0x640c('0x44')]({'where':{'id':_0x46fff1[_0x640c('0x41')]['id']}})[_0x640c('0x25')](handleEntityNotFound(_0x345576,null))[_0x640c('0x25')](removeEntity(_0x345576,null))[_0x640c('0x40')](handleError(_0x345576,null));};exports[_0x640c('0x47')]=function(_0x29768c,_0x3fa964,_0x1f5243){var _0x449c9d={};var _0x45025d={};var _0xe87554;var _0x121a19;return db['ZohoAccount'][_0x640c('0x48')]({'where':{'id':_0x29768c[_0x640c('0x41')]['id']}})[_0x640c('0x25')](handleEntityNotFound(_0x3fa964,null))[_0x640c('0x25')](function(_0x16640e){if(_0x16640e){_0xe87554=_0x16640e;_0x45025d[_0x640c('0x32')]=_['keys'](db[_0x640c('0x49')][_0x640c('0x2c')]);_0x45025d[_0x640c('0x2e')]=_[_0x640c('0x42')](_0x29768c[_0x640c('0x2e')]);_0x45025d[_0x640c('0x2f')]=_['intersection'](_0x45025d[_0x640c('0x32')],_0x45025d['query']);_0x449c9d[_0x640c('0x31')]=_[_0x640c('0x30')](_0x45025d[_0x640c('0x32')],qs[_0x640c('0x33')](_0x29768c[_0x640c('0x2e')]['fields']));_0x449c9d[_0x640c('0x31')]=_0x449c9d[_0x640c('0x31')][_0x640c('0x34')]?_0x449c9d[_0x640c('0x31')]:_0x45025d[_0x640c('0x32')];_0x449c9d[_0x640c('0x4a')]=qs[_0x640c('0x36')](_0x29768c['query'][_0x640c('0x36')]);_0x449c9d['where']=qs['filters'](_[_0x640c('0x37')](_0x29768c[_0x640c('0x2e')],_0x45025d[_0x640c('0x2f')]));if(_0x29768c[_0x640c('0x2e')][_0x640c('0x4b')]){_0x449c9d[_0x640c('0x38')]=_[_0x640c('0x39')](_0x449c9d['where'],{'$or':_[_0x640c('0x2b')](_0x449c9d['attributes'],function(_0x68baa1){var _0x152ca9={};_0x152ca9[_0x68baa1]={'$like':'%'+_0x29768c['query']['filter']+'%'};return _0x152ca9;})});}_0x449c9d=_[_0x640c('0x39')]({},_0x449c9d,_0x29768c[_0x640c('0x3c')]);return _0xe87554[_0x640c('0x47')](_0x449c9d);}})[_0x640c('0x25')](function(_0xdaa408){if(_0xdaa408){_0x121a19=_0xdaa408[_0x640c('0x34')];if(!_0x29768c['query']['hasOwnProperty']('nolimit')){_0x449c9d[_0x640c('0x1e')]=qs['limit'](_0x29768c['query'][_0x640c('0x1e')]);_0x449c9d['offset']=qs[_0x640c('0x1c')](_0x29768c['query'][_0x640c('0x1c')]);}return _0xe87554[_0x640c('0x47')](_0x449c9d);}})['then'](function(_0xd014d9){if(_0xd014d9){return _0xd014d9?{'count':_0x121a19,'rows':_0xd014d9}:null;}})[_0x640c('0x25')](respondWithResult(_0x3fa964,null))[_0x640c('0x40')](handleError(_0x3fa964,null));};exports['addConfiguration']=function(_0x56417f,_0x300be9,_0x36463c){if(_0x56417f[_0x640c('0x46')]['id']){delete _0x56417f[_0x640c('0x46')]['id'];}return db[_0x640c('0x3d')]['findOne']({'where':{'id':_0x56417f[_0x640c('0x41')]['id']}})['then'](handleEntityNotFound(_0x300be9,null))[_0x640c('0x25')](function(_0x4f8a7f){if(_0x4f8a7f){_0x56417f['body']['AccountId']=_0x4f8a7f['id'];_0x56417f[_0x640c('0x46')][_0x640c('0x4c')]=integrations[_0x640c('0x4d')](_0x56417f[_0x640c('0x46')]['channel'],_0x56417f[_0x640c('0x46')][_0x640c('0x3a')]);_0x56417f[_0x640c('0x46')][_0x640c('0x4e')]=integrations[_0x640c('0x4f')](_0x56417f['body'][_0x640c('0x50')],_0x56417f['body'][_0x640c('0x3a')]);return db[_0x640c('0x49')][_0x640c('0x45')](_0x56417f[_0x640c('0x46')],{'include':[{'model':db[_0x640c('0x51')],'as':_0x640c('0x4c')},{'model':db['ZohoField'],'as':_0x640c('0x4e')}]});}return null;})[_0x640c('0x25')](respondWithResult(_0x300be9,null))['catch'](handleError(_0x300be9,null));};function getAccessToken(_0x65c79c){return new Promise(function(_0x4071a5,_0x364c5e){var _0x491848;switch(_0x65c79c[_0x640c('0x52')]){case'US':_0x491848=_0x640c('0x53');break;case'AU':_0x491848=_0x640c('0x54');break;case'EU':_0x491848=_0x640c('0x55');break;case'IN':_0x491848=_0x640c('0x56');break;case'CN':_0x491848=_0x640c('0x57');break;default:_0x491848=_0x640c('0x55');break;}var _0x529ddb={'method':_0x640c('0x58'),'uri':_0x491848+_0x640c('0x59'),'qs':{'refresh_token':_0x65c79c[_0x640c('0x5a')],'client_id':_0x65c79c[_0x640c('0x5b')],'client_secret':_0x65c79c[_0x640c('0x5c')],'grant_type':_0x640c('0x5d')},'json':!![]};return rp(_0x529ddb)[_0x640c('0x25')](function(_0x1cfd93){if(_0x1cfd93[_0x640c('0x5e')]){_0x4071a5(_0x1cfd93[_0x640c('0x5e')]);}else{_0x364c5e(_0x640c('0x5f'));}})[_0x640c('0x40')](function(_0x1042b1){_0x364c5e(_0x1042b1);});});}exports[_0x640c('0x60')]=function(_0x4dd51d,_0x1141f8,_0xfae06){var _0x2badfd,_0x18cf44,_0x4852dd,_0x6dc10c,_0xa33ec2;return db['ZohoAccount'][_0x640c('0x48')]({'where':{'id':_0x4dd51d[_0x640c('0x41')]['id']},'attributes':['id',_0x640c('0x61'),_0x640c('0x52'),'clientId',_0x640c('0x5c'),_0x640c('0x62'),'code','refreshToken']})['then'](handleEntityNotFound(_0x1141f8,null))[_0x640c('0x25')](function(_0x176e29){_0xa33ec2=_0x176e29;_0x2badfd=_0xa33ec2['host'];_0x18cf44=_0x2badfd==='zoho.eu'?'eu':_0x640c('0x63');_0x4852dd=_0xa33ec2[_0x640c('0x62')];var _0xe4d820=_0x4852dd['slice'](-0x1);if(_0xe4d820==='/'||_0xe4d820==='\x5c'||_0xe4d820===':'){_0x4852dd=_0x4852dd[_0x640c('0x64')](0x0,_0x4852dd[_0x640c('0x65')](_0xe4d820));}if(!_0xa33ec2[_0x640c('0x5a')]){throw new Error(_0x640c('0x66'));}return getAccessToken(_0xa33ec2);})['then'](function(_0x2f258b){if(_0x2f258b){return rp({'method':_0x640c('0x67'),'uri':util[_0x640c('0x68')](_0x640c('0x69'),_0x18cf44),'qs':{'module':_0x640c('0x6a')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2f258b},'json':!![]});}})['then'](function(_0x27a321){if(_0x27a321){if(_0x27a321[_0x640c('0x6b')]&&_0x27a321[_0x640c('0x6b')]['error']){throw new Error(_0x27a321[_0x640c('0x6b')][_0x640c('0x6c')][_0x640c('0x6d')]);}var _0x140259=[];var _0x47aa16=[];var _0x68e314=[_0x640c('0x6e'),'Subject','Description','WhoId',_0x640c('0x6f'),_0x640c('0x70'),_0x640c('0x71'),_0x640c('0x72')];_0x47aa16=_['remove'](_0x27a321[_0x640c('0x33')],function(_0x2b7380){return _0x68e314[_0x640c('0x73')](_0x2b7380['api_name']);});for(var _0x5bb4b8=0x0;_0x5bb4b8<_0x47aa16['length'];_0x5bb4b8++){if(_0x47aa16[_0x5bb4b8][_0x640c('0x74')]===![]){_0x140259['push']({'id':_0x47aa16[_0x5bb4b8]['id'],'name':_0x47aa16[_0x5bb4b8][_0x640c('0x75')],'custom':_0x47aa16[_0x5bb4b8][_0x640c('0x76')],'options':_0x47aa16[_0x5bb4b8][_0x640c('0x77')]==='picklist'&&_0x47aa16[_0x5bb4b8][_0x640c('0x78')][_0x640c('0x34')]>-0x1?_[_0x640c('0x2b')](_0x47aa16[_0x5bb4b8]['pick_list_values'],function(_0x4a4fe0){return{'name':_0x4a4fe0,'value':_0x4a4fe0};}):[]});}}return{'count':_0x140259['length'],'rows':_0x140259};}else{return{'count':0x0,'rows':[]};}})[_0x640c('0x25')](respondWithResult(_0x1141f8,null))[_0x640c('0x40')](function(_0x523db6){var _0x245f10=_0x4dd51d['query'][_0x640c('0x79')]?0x1f4:_0x523db6['statusCode']||0x1f4;logger[_0x640c('0x6c')]('getFields,\x20%s,\x20%s,\x20%s',_0x640c('0x60'),_0x245f10,JSON[_0x640c('0x7a')](_0x523db6));delete _0x523db6[_0x640c('0x28')];if(_0x245f10===0x191){_0x245f10=0x190;}_0x1141f8['status'](_0x245f10)[_0x640c('0x29')](_0x4dd51d[_0x640c('0x2e')]['test']?{'message':_0x640c('0x7b'),'statusCode':_0x523db6[_0x640c('0x7c')]}:_0x523db6);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index d94bef7..aa2d43b 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 _0xf571=['authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','https://accounts.zoho.com.au','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','changed','zone','serverUrl','clientId','clientSecret','code','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0xf571,0x1b3));var _0x1f57=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf571[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1f57('0x0'));var util=require(_0x1f57('0x1'));var logger=require(_0x1f57('0x2'))(_0x1f57('0x3'));var moment=require(_0x1f57('0x4'));var BPromise=require('bluebird');var rp=require(_0x1f57('0x5'));var fs=require('fs');var path=require(_0x1f57('0x6'));var rimraf=require(_0x1f57('0x7'));var config=require('../../config/environment');var attributes=require(_0x1f57('0x8'));var integrations=require(_0x1f57('0x9'));module[_0x1f57('0xa')]=function(_0xeac159,_0x558217){return _0xeac159[_0x1f57('0xb')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x298e6b,_0x46d6cb,_0x51a3f8){if(_0x298e6b[_0x1f57('0xc')](_0x1f57('0xd'))||_0x298e6b[_0x1f57('0xc')](_0x1f57('0xe'))||_0x298e6b[_0x1f57('0xc')](_0x1f57('0xf'))||_0x298e6b[_0x1f57('0xc')](_0x1f57('0x10'))||_0x298e6b['changed'](_0x1f57('0x11'))||_0x298e6b[_0x1f57('0xc')]('host')){var _0x125bd1,_0x2798c9;_0x125bd1=_0x298e6b[_0x1f57('0xe')];var _0x5c5d2a=_0x125bd1[_0x1f57('0x12')](-0x1);if(_0x5c5d2a==='/'||_0x5c5d2a==='\x5c'||_0x5c5d2a===':'){_0x125bd1=_0x125bd1[_0x1f57('0x13')](0x0,_0x125bd1[_0x1f57('0x14')](_0x5c5d2a));}switch(_0x298e6b[_0x1f57('0xd')]){case'US':_0x2798c9=_0x1f57('0x15');break;case'AU':_0x2798c9='https://accounts.zoho.com.au';break;case'IN':_0x2798c9=_0x1f57('0x16');break;case'CN':_0x2798c9=_0x1f57('0x17');break;default:_0x2798c9=_0x1f57('0x18');break;}var _0x26ef34={'method':_0x1f57('0x19'),'uri':_0x2798c9+_0x1f57('0x1a'),'form':{'grant_type':_0x1f57('0x1b'),'client_id':_0x298e6b[_0x1f57('0xf')],'client_secret':_0x298e6b['clientSecret'],'redirect_uri':_0x298e6b[_0x1f57('0xe')],'code':_0x298e6b[_0x1f57('0x11')]},'headers':{'Content-Type':_0x1f57('0x1c')}};return rp(_0x26ef34)[_0x1f57('0x1d')](function(_0x538d04){var _0x1de424=JSON[_0x1f57('0x1e')](_0x538d04);if(_0x1de424[_0x1f57('0x1f')]){_0x298e6b[_0x1f57('0x20')]=_0x1de424[_0x1f57('0x1f')];logger[_0x1f57('0x21')](util[_0x1f57('0x22')](_0x1f57('0x23'),_0x298e6b['name'],_0x298e6b['id']));}else{logger[_0x1f57('0x24')](util['format'](_0x1f57('0x25'),_0x298e6b[_0x1f57('0x26')],_0x298e6b['id']),util[_0x1f57('0x27')](_0x1de424,{'showHidden':![],'depth':null}));}return _0x51a3f8(null,_0x46d6cb);})[_0x1f57('0x28')](function(_0x4367aa){logger['error'](util['format'](_0x1f57('0x25'),_0x298e6b[_0x1f57('0x26')],_0x298e6b['id']),util[_0x1f57('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x51a3f8(_0x4367aa);});}else{return _0x51a3f8(null,_0x46d6cb);}},'beforeUpdate':function(_0x4042e0,_0x5c7f9a,_0xffe16d){if(_0x4042e0[_0x1f57('0xc')](_0x1f57('0xd'))||_0x4042e0[_0x1f57('0xc')](_0x1f57('0xe'))||_0x4042e0['changed']('clientId')||_0x4042e0['changed'](_0x1f57('0x10'))||_0x4042e0['changed'](_0x1f57('0x11'))||_0x4042e0[_0x1f57('0xc')]('host')){var _0x537219,_0x4570d1;_0x537219=_0x4042e0[_0x1f57('0xe')];var _0x4f419d=_0x537219[_0x1f57('0x12')](-0x1);if(_0x4f419d==='/'||_0x4f419d==='\x5c'||_0x4f419d===':'){_0x537219=_0x537219[_0x1f57('0x13')](0x0,_0x537219[_0x1f57('0x14')](_0x4f419d));}switch(_0x4042e0[_0x1f57('0xd')]){case'US':_0x4570d1=_0x1f57('0x15');break;case'AU':_0x4570d1=_0x1f57('0x29');break;case'IN':_0x4570d1='https://accounts.zoho.in';break;case'CN':_0x4570d1='https://accounts.zoho.com.cn';break;default:_0x4570d1='https://accounts.zoho.eu';break;}var _0x524356={'method':_0x1f57('0x19'),'uri':_0x4570d1+_0x1f57('0x1a'),'form':{'grant_type':'authorization_code','client_id':_0x4042e0[_0x1f57('0xf')],'client_secret':_0x4042e0['clientSecret'],'redirect_uri':_0x4042e0['serverUrl'],'code':_0x4042e0['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x524356)[_0x1f57('0x1d')](function(_0x4b579f){var _0x3e2152=JSON[_0x1f57('0x1e')](_0x4b579f);if(_0x3e2152['refresh_token']){_0x4042e0[_0x1f57('0x20')]=_0x3e2152[_0x1f57('0x1f')];logger[_0x1f57('0x21')](util[_0x1f57('0x22')](_0x1f57('0x23'),_0x4042e0[_0x1f57('0x26')],_0x4042e0['id']));}else{logger[_0x1f57('0x24')](util[_0x1f57('0x22')](_0x1f57('0x25'),_0x4042e0[_0x1f57('0x26')],_0x4042e0['id']),util[_0x1f57('0x27')](_0x3e2152,{'showHidden':![],'depth':null}));}return _0xffe16d(null,_0x5c7f9a);})[_0x1f57('0x28')](function(_0x372ee2){logger[_0x1f57('0x24')](util['format'](_0x1f57('0x25'),_0x4042e0[_0x1f57('0x26')],_0x4042e0['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0xffe16d(_0x372ee2);});}else{return _0xffe16d(null,_0x5c7f9a);}}}});}; \ No newline at end of file +var _0xe3b2=['substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','error','slice','POST','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','zone','clientId','clientSecret','code','host','serverUrl'];(function(_0x47242d,_0x13f993){var _0x30273a=function(_0x322cd2){while(--_0x322cd2){_0x47242d['push'](_0x47242d['shift']());}};_0x30273a(++_0x13f993);}(_0xe3b2,0x9b));var _0x2e3b=function(_0x9d4ce4,_0x510f23){_0x9d4ce4=_0x9d4ce4-0x0;var _0x555e00=_0xe3b2[_0x9d4ce4];return _0x555e00;};'use strict';var _=require(_0x2e3b('0x0'));var util=require(_0x2e3b('0x1'));var logger=require(_0x2e3b('0x2'))(_0x2e3b('0x3'));var moment=require(_0x2e3b('0x4'));var BPromise=require(_0x2e3b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e3b('0x6'));var rimraf=require(_0x2e3b('0x7'));var config=require(_0x2e3b('0x8'));var attributes=require(_0x2e3b('0x9'));var integrations=require(_0x2e3b('0xa'));module[_0x2e3b('0xb')]=function(_0x4d5fea,_0x14d258){return _0x4d5fea['define'](_0x2e3b('0xc'),attributes,{'tableName':_0x2e3b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x52b98e,_0x3a016b,_0x24b076){if(_0x52b98e[_0x2e3b('0xe')](_0x2e3b('0xf'))||_0x52b98e[_0x2e3b('0xe')]('serverUrl')||_0x52b98e[_0x2e3b('0xe')](_0x2e3b('0x10'))||_0x52b98e['changed'](_0x2e3b('0x11'))||_0x52b98e[_0x2e3b('0xe')](_0x2e3b('0x12'))||_0x52b98e[_0x2e3b('0xe')](_0x2e3b('0x13'))){var _0x1522a9,_0x421e45;_0x1522a9=_0x52b98e[_0x2e3b('0x14')];var _0x41b611=_0x1522a9['slice'](-0x1);if(_0x41b611==='/'||_0x41b611==='\x5c'||_0x41b611===':'){_0x1522a9=_0x1522a9[_0x2e3b('0x15')](0x0,_0x1522a9[_0x2e3b('0x16')](_0x41b611));}switch(_0x52b98e[_0x2e3b('0xf')]){case'US':_0x421e45=_0x2e3b('0x17');break;case'AU':_0x421e45=_0x2e3b('0x18');break;case'IN':_0x421e45='https://accounts.zoho.in';break;case'CN':_0x421e45=_0x2e3b('0x19');break;default:_0x421e45=_0x2e3b('0x1a');break;}var _0xec8d49={'method':'POST','uri':_0x421e45+_0x2e3b('0x1b'),'form':{'grant_type':_0x2e3b('0x1c'),'client_id':_0x52b98e[_0x2e3b('0x10')],'client_secret':_0x52b98e['clientSecret'],'redirect_uri':_0x52b98e[_0x2e3b('0x14')],'code':_0x52b98e[_0x2e3b('0x12')]},'headers':{'Content-Type':_0x2e3b('0x1d')}};return rp(_0xec8d49)[_0x2e3b('0x1e')](function(_0xe00e9f){var _0x3bc66e=JSON[_0x2e3b('0x1f')](_0xe00e9f);if(_0x3bc66e[_0x2e3b('0x20')]){_0x52b98e[_0x2e3b('0x21')]=_0x3bc66e[_0x2e3b('0x20')];logger[_0x2e3b('0x22')](util[_0x2e3b('0x23')](_0x2e3b('0x24'),_0x52b98e[_0x2e3b('0x25')],_0x52b98e['id']));}else{logger['error'](util[_0x2e3b('0x23')](_0x2e3b('0x26'),_0x52b98e[_0x2e3b('0x25')],_0x52b98e['id']),util[_0x2e3b('0x27')](_0x3bc66e,{'showHidden':![],'depth':null}));}return _0x24b076(null,_0x3a016b);})[_0x2e3b('0x28')](function(_0x2d195f){logger[_0x2e3b('0x29')](util[_0x2e3b('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x52b98e[_0x2e3b('0x25')],_0x52b98e['id']),util[_0x2e3b('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x24b076(_0x2d195f);});}else{return _0x24b076(null,_0x3a016b);}},'beforeUpdate':function(_0x2e7626,_0x4b5184,_0x411af6){if(_0x2e7626[_0x2e3b('0xe')](_0x2e3b('0xf'))||_0x2e7626['changed'](_0x2e3b('0x14'))||_0x2e7626['changed'](_0x2e3b('0x10'))||_0x2e7626[_0x2e3b('0xe')](_0x2e3b('0x11'))||_0x2e7626[_0x2e3b('0xe')](_0x2e3b('0x12'))||_0x2e7626[_0x2e3b('0xe')](_0x2e3b('0x13'))){var _0x3da981,_0x935c8d;_0x3da981=_0x2e7626[_0x2e3b('0x14')];var _0x5143af=_0x3da981[_0x2e3b('0x2a')](-0x1);if(_0x5143af==='/'||_0x5143af==='\x5c'||_0x5143af===':'){_0x3da981=_0x3da981['substring'](0x0,_0x3da981[_0x2e3b('0x16')](_0x5143af));}switch(_0x2e7626[_0x2e3b('0xf')]){case'US':_0x935c8d=_0x2e3b('0x17');break;case'AU':_0x935c8d=_0x2e3b('0x18');break;case'IN':_0x935c8d='https://accounts.zoho.in';break;case'CN':_0x935c8d=_0x2e3b('0x19');break;default:_0x935c8d=_0x2e3b('0x1a');break;}var _0x3547ce={'method':_0x2e3b('0x2b'),'uri':_0x935c8d+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x2e7626[_0x2e3b('0x10')],'client_secret':_0x2e7626[_0x2e3b('0x11')],'redirect_uri':_0x2e7626[_0x2e3b('0x14')],'code':_0x2e7626[_0x2e3b('0x12')]},'headers':{'Content-Type':_0x2e3b('0x1d')}};return rp(_0x3547ce)[_0x2e3b('0x1e')](function(_0x52d0b1){var _0x266ade=JSON[_0x2e3b('0x1f')](_0x52d0b1);if(_0x266ade['refresh_token']){_0x2e7626[_0x2e3b('0x21')]=_0x266ade[_0x2e3b('0x20')];logger['info'](util[_0x2e3b('0x23')](_0x2e3b('0x24'),_0x2e7626['name'],_0x2e7626['id']));}else{logger[_0x2e3b('0x29')](util[_0x2e3b('0x23')](_0x2e3b('0x26'),_0x2e7626[_0x2e3b('0x25')],_0x2e7626['id']),util['inspect'](_0x266ade,{'showHidden':![],'depth':null}));}return _0x411af6(null,_0x4b5184);})[_0x2e3b('0x28')](function(_0xce347d){logger['error'](util[_0x2e3b('0x23')](_0x2e3b('0x26'),_0x2e7626[_0x2e3b('0x25')],_0x2e7626['id']),util[_0x2e3b('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x411af6(_0xce347d);});}else{return _0x411af6(null,_0x4b5184);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index b41ea10..b2ecb43 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 _0xc6c0=['map','ShowZohoAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','include','model'];(function(_0x580e2d,_0x321477){var _0x2e06ab=function(_0x4028aa){while(--_0x4028aa){_0x580e2d['push'](_0x580e2d['shift']());}};_0x2e06ab(++_0x321477);}(_0xc6c0,0x13e));var _0x0c6c=function(_0x3e2489,_0x41d9dd){_0x3e2489=_0x3e2489-0x0;var _0x2254ce=_0xc6c0[_0x3e2489];return _0x2254ce;};'use strict';var _=require(_0x0c6c('0x0'));var util=require('util');var moment=require(_0x0c6c('0x1'));var BPromise=require(_0x0c6c('0x2'));var rs=require(_0x0c6c('0x3'));var fs=require('fs');var Redis=require(_0x0c6c('0x4'));var db=require(_0x0c6c('0x5'))['db'];var utils=require(_0x0c6c('0x6'));var logger=require(_0x0c6c('0x7'))(_0x0c6c('0x8'));var config=require(_0x0c6c('0x9'));var jayson=require(_0x0c6c('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1791cb,_0x223b4f,_0x51208d){return new BPromise(function(_0x2e0cd9,_0x15c862){return client[_0x0c6c('0xb')](_0x1791cb,_0x51208d)[_0x0c6c('0xc')](function(_0x317bcf){logger[_0x0c6c('0xd')](_0x0c6c('0xe'),_0x223b4f,_0x0c6c('0xf'));logger[_0x0c6c('0x10')](_0x0c6c('0x11'),_0x223b4f,_0x0c6c('0xf'),JSON[_0x0c6c('0x12')](_0x317bcf));if(_0x317bcf['error']){if(_0x317bcf[_0x0c6c('0x13')]['code']===0x1f4){logger[_0x0c6c('0x13')](_0x0c6c('0xe'),_0x223b4f,_0x317bcf['error'][_0x0c6c('0x14')]);return _0x15c862(_0x317bcf[_0x0c6c('0x13')][_0x0c6c('0x14')]);}logger[_0x0c6c('0x13')](_0x0c6c('0xe'),_0x223b4f,_0x317bcf['error'][_0x0c6c('0x14')]);return _0x2e0cd9(_0x317bcf[_0x0c6c('0x13')][_0x0c6c('0x14')]);}else{logger[_0x0c6c('0xd')](_0x0c6c('0xe'),_0x223b4f,_0x0c6c('0xf'));_0x2e0cd9(_0x317bcf[_0x0c6c('0x15')]['message']);}})[_0x0c6c('0x16')](function(_0x527ade){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x223b4f,_0x527ade);_0x15c862(_0x527ade);});});}exports[_0x0c6c('0x17')]=function(_0x530333){var _0x9463e8=this;return new Promise(function(_0x50be43,_0x316dbe){return db[_0x0c6c('0x18')][_0x0c6c('0x19')]({'raw':_0x530333[_0x0c6c('0x1a')]?_0x530333['options'][_0x0c6c('0x1b')]===undefined?!![]:![]:!![],'where':_0x530333[_0x0c6c('0x1a')]?_0x530333[_0x0c6c('0x1a')][_0x0c6c('0x1c')]||null:null,'attributes':_0x530333[_0x0c6c('0x1a')]?_0x530333[_0x0c6c('0x1a')][_0x0c6c('0x1d')]||null:null,'limit':_0x530333[_0x0c6c('0x1a')]?_0x530333[_0x0c6c('0x1a')]['limit']||null:null,'include':_0x530333[_0x0c6c('0x1a')]?_0x530333[_0x0c6c('0x1a')][_0x0c6c('0x1e')]?_['map'](_0x530333[_0x0c6c('0x1a')]['include'],function(_0x76992){return{'model':db[_0x76992[_0x0c6c('0x1f')]],'as':_0x76992['as'],'attributes':_0x76992[_0x0c6c('0x1d')],'include':_0x76992['include']?_[_0x0c6c('0x20')](_0x76992[_0x0c6c('0x1e')],function(_0x200a47){return{'model':db[_0x200a47[_0x0c6c('0x1f')]],'as':_0x200a47['as'],'attributes':_0x200a47[_0x0c6c('0x1d')],'include':_0x200a47[_0x0c6c('0x1e')]?_[_0x0c6c('0x20')](_0x200a47[_0x0c6c('0x1e')],function(_0x194637){return{'model':db[_0x194637[_0x0c6c('0x1f')]],'as':_0x194637['as'],'attributes':_0x194637['attributes']};}):[]};}):[]};}):[]:[]})[_0x0c6c('0xc')](function(_0x557046){logger[_0x0c6c('0xd')]('GetZohoAccount',_0x530333);logger[_0x0c6c('0x10')](_0x0c6c('0x17'),_0x530333,JSON[_0x0c6c('0x12')](_0x557046));_0x50be43(_0x557046);})[_0x0c6c('0x16')](function(_0x2cbfc7){logger[_0x0c6c('0x13')](_0x0c6c('0x17'),_0x2cbfc7[_0x0c6c('0x14')],_0x530333);_0x316dbe(_0x9463e8['error'](0x1f4,_0x2cbfc7[_0x0c6c('0x14')]));});});};exports[_0x0c6c('0x21')]=function(_0x5ec5bc){var _0x40d708=this;return new Promise(function(_0x556dad,_0x37357b){return db[_0x0c6c('0x18')][_0x0c6c('0x22')]({'raw':_0x5ec5bc[_0x0c6c('0x1a')]?_0x5ec5bc[_0x0c6c('0x1a')][_0x0c6c('0x1b')]===undefined?!![]:![]:!![],'where':_0x5ec5bc[_0x0c6c('0x1a')]?_0x5ec5bc[_0x0c6c('0x1a')][_0x0c6c('0x1c')]||null:null,'attributes':_0x5ec5bc['options']?_0x5ec5bc['options'][_0x0c6c('0x1d')]||null:null,'include':_0x5ec5bc[_0x0c6c('0x1a')]?_0x5ec5bc[_0x0c6c('0x1a')][_0x0c6c('0x1e')]?_[_0x0c6c('0x20')](_0x5ec5bc[_0x0c6c('0x1a')]['include'],function(_0x3c97d1){return{'model':db[_0x3c97d1['model']],'as':_0x3c97d1['as'],'attributes':_0x3c97d1[_0x0c6c('0x1d')],'include':_0x3c97d1['include']?_[_0x0c6c('0x20')](_0x3c97d1[_0x0c6c('0x1e')],function(_0x5951f2){return{'model':db[_0x5951f2['model']],'as':_0x5951f2['as'],'attributes':_0x5951f2[_0x0c6c('0x1d')],'include':_0x5951f2[_0x0c6c('0x1e')]?_[_0x0c6c('0x20')](_0x5951f2[_0x0c6c('0x1e')],function(_0x4ed556){return{'model':db[_0x4ed556[_0x0c6c('0x1f')]],'as':_0x4ed556['as'],'attributes':_0x4ed556[_0x0c6c('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9d6ee8){logger[_0x0c6c('0xd')](_0x0c6c('0x21'),_0x5ec5bc);logger['debug'](_0x0c6c('0x21'),_0x5ec5bc,JSON[_0x0c6c('0x12')](_0x9d6ee8));_0x556dad(_0x9d6ee8);})[_0x0c6c('0x16')](function(_0x93e98a){logger[_0x0c6c('0x13')](_0x0c6c('0x21'),_0x93e98a[_0x0c6c('0x14')],_0x5ec5bc);_0x37357b(_0x40d708[_0x0c6c('0x13')](0x1f4,_0x93e98a[_0x0c6c('0x14')]));});});}; \ No newline at end of file +var _0xf3f9=['find','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','info','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','map','model','attributes','include','ShowZohoAccount'];(function(_0x5ea87d,_0x2f57e8){var _0x34a52b=function(_0x46e92e){while(--_0x46e92e){_0x5ea87d['push'](_0x5ea87d['shift']());}};_0x34a52b(++_0x2f57e8);}(_0xf3f9,0x1de));var _0x9f3f=function(_0x3b81fb,_0x11ab55){_0x3b81fb=_0x3b81fb-0x0;var _0x89444e=_0xf3f9[_0x3b81fb];return _0x89444e;};'use strict';var _=require(_0x9f3f('0x0'));var util=require(_0x9f3f('0x1'));var moment=require('moment');var BPromise=require(_0x9f3f('0x2'));var rs=require(_0x9f3f('0x3'));var fs=require('fs');var Redis=require(_0x9f3f('0x4'));var db=require(_0x9f3f('0x5'))['db'];var utils=require(_0x9f3f('0x6'));var logger=require(_0x9f3f('0x7'))(_0x9f3f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9f3f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17b150,_0x4a9a17,_0x373b80){return new BPromise(function(_0xa6b3ae,_0x223546){return client['request'](_0x17b150,_0x373b80)[_0x9f3f('0xa')](function(_0x588c31){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x4a9a17,'request\x20sent');logger[_0x9f3f('0xb')](_0x9f3f('0xc'),_0x4a9a17,_0x9f3f('0xd'),JSON[_0x9f3f('0xe')](_0x588c31));if(_0x588c31[_0x9f3f('0xf')]){if(_0x588c31[_0x9f3f('0xf')][_0x9f3f('0x10')]===0x1f4){logger[_0x9f3f('0xf')](_0x9f3f('0x11'),_0x4a9a17,_0x588c31[_0x9f3f('0xf')][_0x9f3f('0x12')]);return _0x223546(_0x588c31[_0x9f3f('0xf')]['message']);}logger[_0x9f3f('0xf')](_0x9f3f('0x11'),_0x4a9a17,_0x588c31['error']['message']);return _0xa6b3ae(_0x588c31[_0x9f3f('0xf')][_0x9f3f('0x12')]);}else{logger[_0x9f3f('0x13')](_0x9f3f('0x11'),_0x4a9a17,_0x9f3f('0xd'));_0xa6b3ae(_0x588c31[_0x9f3f('0x14')]['message']);}})[_0x9f3f('0x15')](function(_0x75ecdb){logger[_0x9f3f('0xf')](_0x9f3f('0x11'),_0x4a9a17,_0x75ecdb);_0x223546(_0x75ecdb);});});}exports[_0x9f3f('0x16')]=function(_0x153b2f){var _0x5d3fc9=this;return new Promise(function(_0x115b23,_0x542670){return db[_0x9f3f('0x17')][_0x9f3f('0x18')]({'raw':_0x153b2f['options']?_0x153b2f[_0x9f3f('0x19')][_0x9f3f('0x1a')]===undefined?!![]:![]:!![],'where':_0x153b2f[_0x9f3f('0x19')]?_0x153b2f[_0x9f3f('0x19')]['where']||null:null,'attributes':_0x153b2f['options']?_0x153b2f[_0x9f3f('0x19')]['attributes']||null:null,'limit':_0x153b2f[_0x9f3f('0x19')]?_0x153b2f['options']['limit']||null:null,'include':_0x153b2f[_0x9f3f('0x19')]?_0x153b2f[_0x9f3f('0x19')]['include']?_[_0x9f3f('0x1b')](_0x153b2f['options']['include'],function(_0x1193a1){return{'model':db[_0x1193a1[_0x9f3f('0x1c')]],'as':_0x1193a1['as'],'attributes':_0x1193a1[_0x9f3f('0x1d')],'include':_0x1193a1[_0x9f3f('0x1e')]?_['map'](_0x1193a1[_0x9f3f('0x1e')],function(_0x5d67f3){return{'model':db[_0x5d67f3[_0x9f3f('0x1c')]],'as':_0x5d67f3['as'],'attributes':_0x5d67f3[_0x9f3f('0x1d')],'include':_0x5d67f3[_0x9f3f('0x1e')]?_['map'](_0x5d67f3[_0x9f3f('0x1e')],function(_0x55a094){return{'model':db[_0x55a094[_0x9f3f('0x1c')]],'as':_0x55a094['as'],'attributes':_0x55a094[_0x9f3f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9f3f('0xa')](function(_0x5c4f15){logger['info'](_0x9f3f('0x16'),_0x153b2f);logger['debug'](_0x9f3f('0x16'),_0x153b2f,JSON[_0x9f3f('0xe')](_0x5c4f15));_0x115b23(_0x5c4f15);})['catch'](function(_0xcfd381){logger['error']('GetZohoAccount',_0xcfd381['message'],_0x153b2f);_0x542670(_0x5d3fc9['error'](0x1f4,_0xcfd381[_0x9f3f('0x12')]));});});};exports[_0x9f3f('0x1f')]=function(_0x4c496e){var _0x3a5be4=this;return new Promise(function(_0xf848ef,_0x2d01cd){return db[_0x9f3f('0x17')][_0x9f3f('0x20')]({'raw':_0x4c496e['options']?_0x4c496e[_0x9f3f('0x19')][_0x9f3f('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c496e[_0x9f3f('0x19')]?_0x4c496e[_0x9f3f('0x19')][_0x9f3f('0x21')]||null:null,'attributes':_0x4c496e[_0x9f3f('0x19')]?_0x4c496e[_0x9f3f('0x19')][_0x9f3f('0x1d')]||null:null,'include':_0x4c496e[_0x9f3f('0x19')]?_0x4c496e['options'][_0x9f3f('0x1e')]?_[_0x9f3f('0x1b')](_0x4c496e[_0x9f3f('0x19')][_0x9f3f('0x1e')],function(_0xf9c607){return{'model':db[_0xf9c607[_0x9f3f('0x1c')]],'as':_0xf9c607['as'],'attributes':_0xf9c607[_0x9f3f('0x1d')],'include':_0xf9c607[_0x9f3f('0x1e')]?_[_0x9f3f('0x1b')](_0xf9c607['include'],function(_0x4bec53){return{'model':db[_0x4bec53[_0x9f3f('0x1c')]],'as':_0x4bec53['as'],'attributes':_0x4bec53[_0x9f3f('0x1d')],'include':_0x4bec53[_0x9f3f('0x1e')]?_[_0x9f3f('0x1b')](_0x4bec53[_0x9f3f('0x1e')],function(_0xd5a1ce){return{'model':db[_0xd5a1ce[_0x9f3f('0x1c')]],'as':_0xd5a1ce['as'],'attributes':_0xd5a1ce[_0x9f3f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9f3f('0xa')](function(_0x53c633){logger['info'](_0x9f3f('0x1f'),_0x4c496e);logger[_0x9f3f('0xb')]('ShowZohoAccount',_0x4c496e,JSON['stringify'](_0x53c633));_0xf848ef(_0x53c633);})[_0x9f3f('0x15')](function(_0x1a818a){logger[_0x9f3f('0xf')](_0x9f3f('0x1f'),_0x1a818a[_0x9f3f('0x12')],_0x4c496e);_0x2d01cd(_0x3a5be4[_0x9f3f('0xf')](0x1f4,_0x1a818a['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 37e66e4..7628713 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 _0x5040=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x148dad,_0x4530bd){var _0x3852c5=function(_0x3ceb4a){while(--_0x3ceb4a){_0x148dad['push'](_0x148dad['shift']());}};_0x3852c5(++_0x4530bd);}(_0x5040,0x165));var _0x0504=function(_0x28d90c,_0x569329){_0x28d90c=_0x28d90c-0x0;var _0x3727b8=_0x5040[_0x28d90c];return _0x3727b8;};'use strict';var multer=require('multer');var util=require(_0x0504('0x0'));var path=require(_0x0504('0x1'));var timeout=require(_0x0504('0x2'));var express=require(_0x0504('0x3'));var router=express[_0x0504('0x4')]();var fs_extra=require(_0x0504('0x5'));var auth=require(_0x0504('0x6'));var interaction=require(_0x0504('0x7'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0x0504('0x8')]('/',auth[_0x0504('0x9')](),controller[_0x0504('0xa')]);router[_0x0504('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0504('0xb')]);router[_0x0504('0x8')](_0x0504('0xc'),auth[_0x0504('0x9')](),controller[_0x0504('0xd')]);router[_0x0504('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x0504('0xe')]);router[_0x0504('0x8')](_0x0504('0xf'),auth[_0x0504('0x9')](),controller[_0x0504('0x10')]);router[_0x0504('0x11')]('/',auth[_0x0504('0x9')](),controller['create']);router[_0x0504('0x12')](_0x0504('0x13'),auth[_0x0504('0x9')](),controller[_0x0504('0x14')]);router[_0x0504('0x15')](_0x0504('0x13'),auth['isAuthenticated'](),controller[_0x0504('0x16')]);module[_0x0504('0x17')]=router; \ No newline at end of file +var _0x033b=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getDescriptions','post','create','delete','exports'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x033b,0x64));var _0xb033=function(_0x528699,_0x1ec77b){_0x528699=_0x528699-0x0;var _0x12fae3=_0x033b[_0x528699];return _0x12fae3;};'use strict';var multer=require(_0xb033('0x0'));var util=require('util');var path=require(_0xb033('0x1'));var timeout=require(_0xb033('0x2'));var express=require(_0xb033('0x3'));var router=express[_0xb033('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb033('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb033('0x6'));var controller=require(_0xb033('0x7'));router[_0xb033('0x8')]('/',auth[_0xb033('0x9')](),controller[_0xb033('0xa')]);router[_0xb033('0x8')](_0xb033('0xb'),auth[_0xb033('0x9')](),controller[_0xb033('0xc')]);router['get'](_0xb033('0xd'),auth[_0xb033('0x9')](),controller['getFields']);router[_0xb033('0x8')](_0xb033('0xe'),auth[_0xb033('0x9')](),controller['getSubjects']);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0xb033('0xf')]);router[_0xb033('0x10')]('/',auth[_0xb033('0x9')](),controller[_0xb033('0x11')]);router['put']('/:id',auth[_0xb033('0x9')](),controller['update']);router[_0xb033('0x12')](_0xb033('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xb033('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 16eb0c8..a49fbe9 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 _0x8eef=['exports','ENUM','lead','contact','nothing','contact_lead','sequelize'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x8eef,0x6f));var _0xf8ee=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x8eef[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0xf8ee('0x0'));module[_0xf8ee('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xf8ee('0x2')](_0xf8ee('0x3'),_0xf8ee('0x4'),_0xf8ee('0x5')),'defaultValue':_0xf8ee('0x3')},'moduleSearch':{'type':Sequelize[_0xf8ee('0x2')](_0xf8ee('0x6'),_0xf8ee('0x4'),_0xf8ee('0x3')),'defaultValue':_0xf8ee('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5607=['STRING','contact','lead','ENUM','contact_lead','exports'];(function(_0x308791,_0xf1200c){var _0x54e969=function(_0x3958bd){while(--_0x3958bd){_0x308791['push'](_0x308791['shift']());}};_0x54e969(++_0xf1200c);}(_0x5607,0x8f));var _0x7560=function(_0x584278,_0x300a71){_0x584278=_0x584278-0x0;var _0x2c3ec2=_0x5607[_0x584278];return _0x2c3ec2;};'use strict';var Sequelize=require('sequelize');module[_0x7560('0x0')]={'name':{'type':Sequelize[_0x7560('0x1')]},'moduleCreate':{'type':Sequelize['ENUM']('lead',_0x7560('0x2'),'nothing'),'defaultValue':_0x7560('0x3')},'moduleSearch':{'type':Sequelize[_0x7560('0x4')](_0x7560('0x5'),'contact',_0x7560('0x3')),'defaultValue':_0x7560('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index bebd044..5f43300 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 _0x107e=['body','update','find','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','stack','name','send','index','map','ZohoConfiguration','rawAttributes','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','catch','show','params','includeAll','create'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x107e,0x1d0));var _0xe107=function(_0x56c6ca,_0x5bf55a){_0x56c6ca=_0x56c6ca-0x0;var _0xb19d75=_0x107e[_0x56c6ca];return _0xb19d75;};'use strict';var emlformat=require(_0xe107('0x0'));var rimraf=require(_0xe107('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe107('0x2'));var rp=require(_0xe107('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe107('0x4'));var path=require(_0xe107('0x5'));var sox=require('sox');var csv=require(_0xe107('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe107('0x7'));var _=require(_0xe107('0x8'));var squel=require(_0xe107('0x9'));var crypto=require(_0xe107('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe107('0xb'));var toCsv=require('to-csv');var querystring=require(_0xe107('0xc'));var Papa=require(_0xe107('0xd'));var Redis=require(_0xe107('0xe'));var authService=require(_0xe107('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe107('0x10'));var logger=require('../../config/logger')(_0xe107('0x11'));var utils=require(_0xe107('0x12'));var config=require(_0xe107('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xe107('0x14'))['db'];function respondWithStatusCode(_0x146c1f,_0x39da18){_0x39da18=_0x39da18||0xcc;return function(_0x162877){if(_0x162877){return _0x146c1f[_0xe107('0x15')](_0x39da18);}return _0x146c1f[_0xe107('0x16')](_0x39da18)[_0xe107('0x17')]();};}function respondWithResult(_0x504da7,_0x414b74){_0x414b74=_0x414b74||0xc8;return function(_0x248db8){if(_0x248db8){return _0x504da7[_0xe107('0x16')](_0x414b74)[_0xe107('0x18')](_0x248db8);}};}function respondWithFilteredResult(_0x1c62ea,_0x44bd8a){return function(_0xcb963b){if(_0xcb963b){var _0x36d27b=typeof _0x44bd8a[_0xe107('0x19')]===_0xe107('0x1a')&&typeof _0x44bd8a[_0xe107('0x1b')]==='undefined';var _0x53add0=_0xcb963b[_0xe107('0x1c')];var _0x18c526=_0x36d27b?0x0:_0x44bd8a[_0xe107('0x19')];var _0x12c6cd=_0x36d27b?_0xcb963b['count']:_0x44bd8a['offset']+_0x44bd8a[_0xe107('0x1b')];var _0x41d3d4;if(_0x12c6cd>=_0x53add0){_0x12c6cd=_0x53add0;_0x41d3d4=0xc8;}else{_0x41d3d4=0xce;}_0x1c62ea[_0xe107('0x16')](_0x41d3d4);return _0x1c62ea[_0xe107('0x1d')](_0xe107('0x1e'),_0x18c526+'-'+_0x12c6cd+'/'+_0x53add0)[_0xe107('0x18')](_0xcb963b);}return null;};}function patchUpdates(_0x360de2){return function(_0x4c245a){try{jsonpatch['apply'](_0x4c245a,_0x360de2,!![]);}catch(_0x105f09){return BPromise[_0xe107('0x1f')](_0x105f09);}return _0x4c245a[_0xe107('0x20')]();};}function saveUpdates(_0x285891,_0x257648){return function(_0x4c8887){if(_0x4c8887){return _0x4c8887['update'](_0x285891)[_0xe107('0x21')](function(_0x390d9a){return _0x390d9a;});}return null;};}function removeEntity(_0x3c13ba,_0x27eda7){return function(_0x553d5c){if(_0x553d5c){return _0x553d5c[_0xe107('0x22')]()[_0xe107('0x21')](function(){_0x3c13ba[_0xe107('0x16')](0xcc)[_0xe107('0x17')]();});}};}function handleEntityNotFound(_0x585dfe,_0x3ffd21){return function(_0x145f68){if(!_0x145f68){_0x585dfe[_0xe107('0x15')](0x194);}return _0x145f68;};}function handleError(_0x430892,_0x1c777e){_0x1c777e=_0x1c777e||0x1f4;return function(_0x448bba){logger['error'](_0x448bba[_0xe107('0x23')]);if(_0x448bba[_0xe107('0x24')]){delete _0x448bba[_0xe107('0x24')];}_0x430892[_0xe107('0x16')](_0x1c777e)[_0xe107('0x25')](_0x448bba);};}exports[_0xe107('0x26')]=function(_0x495d65,_0x1e4cb3){var _0x3379f0={},_0xc367a7={},_0x3600f4={'count':0x0,'rows':[]};var _0x3ae165=_[_0xe107('0x27')](db[_0xe107('0x28')][_0xe107('0x29')],function(_0x4c3b66){return{'name':_0x4c3b66['fieldName'],'type':_0x4c3b66[_0xe107('0x2a')][_0xe107('0x2b')]};});_0xc367a7['model']=_[_0xe107('0x27')](_0x3ae165,_0xe107('0x24'));_0xc367a7['query']=_[_0xe107('0x2c')](_0x495d65[_0xe107('0x2d')]);_0xc367a7['filters']=_[_0xe107('0x2e')](_0xc367a7[_0xe107('0x2f')],_0xc367a7[_0xe107('0x2d')]);_0x3379f0[_0xe107('0x30')]=_[_0xe107('0x2e')](_0xc367a7[_0xe107('0x2f')],qs[_0xe107('0x31')](_0x495d65[_0xe107('0x2d')]['fields']));_0x3379f0['attributes']=_0x3379f0['attributes'][_0xe107('0x32')]?_0x3379f0['attributes']:_0xc367a7[_0xe107('0x2f')];if(!_0x495d65[_0xe107('0x2d')][_0xe107('0x33')](_0xe107('0x34'))){_0x3379f0[_0xe107('0x1b')]=qs[_0xe107('0x1b')](_0x495d65[_0xe107('0x2d')]['limit']);_0x3379f0[_0xe107('0x19')]=qs['offset'](_0x495d65['query'][_0xe107('0x19')]);}_0x3379f0[_0xe107('0x35')]=qs[_0xe107('0x36')](_0x495d65[_0xe107('0x2d')][_0xe107('0x36')]);_0x3379f0[_0xe107('0x37')]=qs[_0xe107('0x38')](_[_0xe107('0x39')](_0x495d65['query'],_0xc367a7[_0xe107('0x38')]),_0x3ae165);if(_0x495d65[_0xe107('0x2d')]['filter']){_0x3379f0['where']=_[_0xe107('0x3a')](_0x3379f0[_0xe107('0x37')],{'$or':_['map'](_0x3ae165,function(_0x975079){if(_0x975079[_0xe107('0x2a')]!==_0xe107('0x3b')){var _0x25b5ab={};_0x25b5ab[_0x975079[_0xe107('0x24')]]={'$like':'%'+_0x495d65[_0xe107('0x2d')][_0xe107('0x3c')]+'%'};return _0x25b5ab;}})});}_0x3379f0=_[_0xe107('0x3a')]({},_0x3379f0,_0x495d65[_0xe107('0x3d')]);var _0x536e4b={'where':_0x3379f0['where']};return db[_0xe107('0x28')][_0xe107('0x1c')](_0x536e4b)[_0xe107('0x21')](function(_0x5a59c9){_0x3600f4[_0xe107('0x1c')]=_0x5a59c9;if(_0x495d65[_0xe107('0x2d')]['includeAll']){_0x3379f0[_0xe107('0x3e')]=[{'all':!![]}];}return db[_0xe107('0x28')]['findAll'](_0x3379f0);})[_0xe107('0x21')](function(_0x4641d0){_0x3600f4['rows']=_0x4641d0;return _0x3600f4;})[_0xe107('0x21')](respondWithFilteredResult(_0x1e4cb3,_0x3379f0))[_0xe107('0x3f')](handleError(_0x1e4cb3,null));};exports[_0xe107('0x40')]=function(_0x451b4a,_0x70cc8d){var _0x8d7a10={'raw':![],'where':{'id':_0x451b4a[_0xe107('0x41')]['id']}},_0x53cd98={};_0x53cd98['model']=_[_0xe107('0x2c')](db[_0xe107('0x28')]['rawAttributes']);_0x53cd98[_0xe107('0x2d')]=_[_0xe107('0x2c')](_0x451b4a[_0xe107('0x2d')]);_0x53cd98[_0xe107('0x38')]=_[_0xe107('0x2e')](_0x53cd98[_0xe107('0x2f')],_0x53cd98[_0xe107('0x2d')]);_0x8d7a10['attributes']=_[_0xe107('0x2e')](_0x53cd98[_0xe107('0x2f')],qs['fields'](_0x451b4a[_0xe107('0x2d')][_0xe107('0x31')]));_0x8d7a10[_0xe107('0x30')]=_0x8d7a10[_0xe107('0x30')][_0xe107('0x32')]?_0x8d7a10[_0xe107('0x30')]:_0x53cd98[_0xe107('0x2f')];if(_0x451b4a[_0xe107('0x2d')][_0xe107('0x42')]){_0x8d7a10[_0xe107('0x3e')]=[{'all':!![]}];}_0x8d7a10=_[_0xe107('0x3a')]({},_0x8d7a10,_0x451b4a['options']);return db[_0xe107('0x28')]['find'](_0x8d7a10)[_0xe107('0x21')](handleEntityNotFound(_0x70cc8d,null))[_0xe107('0x21')](respondWithResult(_0x70cc8d,null))[_0xe107('0x3f')](handleError(_0x70cc8d,null));};exports[_0xe107('0x43')]=function(_0x250baa,_0x1be750){return db[_0xe107('0x28')][_0xe107('0x43')](_0x250baa[_0xe107('0x44')],{})[_0xe107('0x21')](respondWithResult(_0x1be750,0xc9))['catch'](handleError(_0x1be750,null));};exports[_0xe107('0x45')]=function(_0x282649,_0x35de10){if(_0x282649[_0xe107('0x44')]['id']){delete _0x282649['body']['id'];}return db[_0xe107('0x28')]['find']({'where':{'id':_0x282649[_0xe107('0x41')]['id']}})[_0xe107('0x21')](handleEntityNotFound(_0x35de10,null))['then'](saveUpdates(_0x282649[_0xe107('0x44')],null))[_0xe107('0x21')](respondWithResult(_0x35de10,null))['catch'](handleError(_0x35de10,null));};exports[_0xe107('0x22')]=function(_0x40b581,_0x4ee50e){return db['ZohoConfiguration'][_0xe107('0x46')]({'where':{'id':_0x40b581['params']['id']}})[_0xe107('0x21')](handleEntityNotFound(_0x4ee50e,null))[_0xe107('0x21')](removeEntity(_0x4ee50e,null))['catch'](handleError(_0x4ee50e,null));};exports[_0xe107('0x47')]=function(_0x35017b,_0x3c96ae,_0x960716){var _0x16ba56={};var _0x26ac32={};var _0x36f1be;var _0x3db4cf;return db[_0xe107('0x28')][_0xe107('0x48')]({'where':{'id':_0x35017b[_0xe107('0x41')]['id']}})[_0xe107('0x21')](handleEntityNotFound(_0x3c96ae,null))[_0xe107('0x21')](function(_0x3769c0){if(_0x3769c0){_0x36f1be=_0x3769c0;_0x26ac32[_0xe107('0x2f')]=_[_0xe107('0x2c')](db[_0xe107('0x49')][_0xe107('0x29')]);_0x26ac32[_0xe107('0x2d')]=_['keys'](_0x35017b[_0xe107('0x2d')]);_0x26ac32['filters']=_[_0xe107('0x2e')](_0x26ac32['model'],_0x26ac32[_0xe107('0x2d')]);_0x16ba56[_0xe107('0x30')]=_['intersection'](_0x26ac32[_0xe107('0x2f')],qs['fields'](_0x35017b[_0xe107('0x2d')][_0xe107('0x31')]));_0x16ba56['attributes']=_0x16ba56[_0xe107('0x30')][_0xe107('0x32')]?_0x16ba56[_0xe107('0x30')]:_0x26ac32[_0xe107('0x2f')];_0x16ba56[_0xe107('0x35')]=qs[_0xe107('0x36')](_0x35017b[_0xe107('0x2d')][_0xe107('0x36')]);_0x16ba56[_0xe107('0x37')]=qs[_0xe107('0x38')](_[_0xe107('0x39')](_0x35017b['query'],_0x26ac32[_0xe107('0x38')]));if(_0x35017b[_0xe107('0x2d')][_0xe107('0x3c')]){_0x16ba56[_0xe107('0x37')]=_[_0xe107('0x3a')](_0x16ba56[_0xe107('0x37')],{'$or':_[_0xe107('0x27')](_0x16ba56[_0xe107('0x30')],function(_0x4087ac){var _0x4373f9={};_0x4373f9[_0x4087ac]={'$like':'%'+_0x35017b['query']['filter']+'%'};return _0x4373f9;})});}_0x16ba56=_[_0xe107('0x3a')]({},_0x16ba56,_0x35017b[_0xe107('0x3d')]);return _0x36f1be[_0xe107('0x47')](_0x16ba56);}})[_0xe107('0x21')](function(_0x1ce361){if(_0x1ce361){_0x3db4cf=_0x1ce361[_0xe107('0x32')];if(!_0x35017b['query']['hasOwnProperty']('nolimit')){_0x16ba56[_0xe107('0x1b')]=qs[_0xe107('0x1b')](_0x35017b['query']['limit']);_0x16ba56['offset']=qs[_0xe107('0x19')](_0x35017b[_0xe107('0x2d')][_0xe107('0x19')]);}return _0x36f1be['getFields'](_0x16ba56);}})[_0xe107('0x21')](function(_0xc7e206){if(_0xc7e206){return _0xc7e206?{'count':_0x3db4cf,'rows':_0xc7e206}:null;}})['then'](respondWithResult(_0x3c96ae,null))[_0xe107('0x3f')](handleError(_0x3c96ae,null));};exports[_0xe107('0x4a')]=function(_0x1f0b79,_0x215bf4,_0x5335be){var _0x3616ba={};var _0x28ed5a={};var _0x5c26d8;var _0x229a20;return db['ZohoConfiguration'][_0xe107('0x48')]({'where':{'id':_0x1f0b79[_0xe107('0x41')]['id']}})[_0xe107('0x21')](handleEntityNotFound(_0x215bf4,null))[_0xe107('0x21')](function(_0x352eb9){if(_0x352eb9){_0x5c26d8=_0x352eb9;_0x28ed5a[_0xe107('0x2f')]=_[_0xe107('0x2c')](db[_0xe107('0x49')][_0xe107('0x29')]);_0x28ed5a[_0xe107('0x2d')]=_[_0xe107('0x2c')](_0x1f0b79[_0xe107('0x2d')]);_0x28ed5a[_0xe107('0x38')]=_[_0xe107('0x2e')](_0x28ed5a[_0xe107('0x2f')],_0x28ed5a[_0xe107('0x2d')]);_0x3616ba[_0xe107('0x30')]=_[_0xe107('0x2e')](_0x28ed5a[_0xe107('0x2f')],qs['fields'](_0x1f0b79['query'][_0xe107('0x31')]));_0x3616ba['attributes']=_0x3616ba[_0xe107('0x30')]['length']?_0x3616ba[_0xe107('0x30')]:_0x28ed5a[_0xe107('0x2f')];_0x3616ba[_0xe107('0x35')]=qs[_0xe107('0x36')](_0x1f0b79['query'][_0xe107('0x36')]);_0x3616ba[_0xe107('0x37')]=qs['filters'](_[_0xe107('0x39')](_0x1f0b79['query'],_0x28ed5a['filters']));if(_0x1f0b79[_0xe107('0x2d')]['filter']){_0x3616ba[_0xe107('0x37')]=_['merge'](_0x3616ba[_0xe107('0x37')],{'$or':_[_0xe107('0x27')](_0x3616ba['attributes'],function(_0xabc6bb){var _0x1cd12d={};_0x1cd12d[_0xabc6bb]={'$like':'%'+_0x1f0b79['query']['filter']+'%'};return _0x1cd12d;})});}_0x3616ba=_[_0xe107('0x3a')]({},_0x3616ba,_0x1f0b79[_0xe107('0x3d')]);return _0x5c26d8[_0xe107('0x4a')](_0x3616ba);}})[_0xe107('0x21')](function(_0x1eaec7){if(_0x1eaec7){_0x229a20=_0x1eaec7['length'];if(!_0x1f0b79[_0xe107('0x2d')][_0xe107('0x33')](_0xe107('0x34'))){_0x3616ba[_0xe107('0x1b')]=qs[_0xe107('0x1b')](_0x1f0b79['query'][_0xe107('0x1b')]);_0x3616ba['offset']=qs[_0xe107('0x19')](_0x1f0b79['query'][_0xe107('0x19')]);}return _0x5c26d8[_0xe107('0x4a')](_0x3616ba);}})[_0xe107('0x21')](function(_0x368b5a){if(_0x368b5a){return _0x368b5a?{'count':_0x229a20,'rows':_0x368b5a}:null;}})[_0xe107('0x21')](respondWithResult(_0x215bf4,null))[_0xe107('0x3f')](handleError(_0x215bf4,null));};exports['getDescriptions']=function(_0x505101,_0x50670d,_0x1eae77){var _0x169e34={};var _0x541fab={};var _0x5b9d5e;var _0x2b4364;return db[_0xe107('0x28')][_0xe107('0x48')]({'where':{'id':_0x505101[_0xe107('0x41')]['id']}})['then'](handleEntityNotFound(_0x50670d,null))[_0xe107('0x21')](function(_0x3782d5){if(_0x3782d5){_0x5b9d5e=_0x3782d5;_0x541fab[_0xe107('0x2f')]=_[_0xe107('0x2c')](db[_0xe107('0x49')][_0xe107('0x29')]);_0x541fab['query']=_[_0xe107('0x2c')](_0x505101[_0xe107('0x2d')]);_0x541fab['filters']=_['intersection'](_0x541fab['model'],_0x541fab['query']);_0x169e34['attributes']=_[_0xe107('0x2e')](_0x541fab['model'],qs[_0xe107('0x31')](_0x505101[_0xe107('0x2d')][_0xe107('0x31')]));_0x169e34['attributes']=_0x169e34[_0xe107('0x30')][_0xe107('0x32')]?_0x169e34[_0xe107('0x30')]:_0x541fab[_0xe107('0x2f')];_0x169e34[_0xe107('0x35')]=qs['sort'](_0x505101[_0xe107('0x2d')][_0xe107('0x36')]);_0x169e34[_0xe107('0x37')]=qs[_0xe107('0x38')](_['pick'](_0x505101[_0xe107('0x2d')],_0x541fab[_0xe107('0x38')]));if(_0x505101['query']['filter']){_0x169e34[_0xe107('0x37')]=_[_0xe107('0x3a')](_0x169e34[_0xe107('0x37')],{'$or':_['map'](_0x169e34[_0xe107('0x30')],function(_0x35a7be){var _0x5952c1={};_0x5952c1[_0x35a7be]={'$like':'%'+_0x505101[_0xe107('0x2d')][_0xe107('0x3c')]+'%'};return _0x5952c1;})});}_0x169e34=_[_0xe107('0x3a')]({},_0x169e34,_0x505101[_0xe107('0x3d')]);return _0x5b9d5e[_0xe107('0x4b')](_0x169e34);}})[_0xe107('0x21')](function(_0x221171){if(_0x221171){_0x2b4364=_0x221171[_0xe107('0x32')];if(!_0x505101[_0xe107('0x2d')][_0xe107('0x33')](_0xe107('0x34'))){_0x169e34['limit']=qs[_0xe107('0x1b')](_0x505101[_0xe107('0x2d')]['limit']);_0x169e34[_0xe107('0x19')]=qs[_0xe107('0x19')](_0x505101[_0xe107('0x2d')]['offset']);}return _0x5b9d5e[_0xe107('0x4b')](_0x169e34);}})['then'](function(_0x5d7f84){if(_0x5d7f84){return _0x5d7f84?{'count':_0x2b4364,'rows':_0x5d7f84}:null;}})[_0xe107('0x21')](respondWithResult(_0x50670d,null))[_0xe107('0x3f')](handleError(_0x50670d,null));}; \ No newline at end of file +var _0xcaf3=['path','sox','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','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','map','ZohoConfiguration','rawAttributes','type','keys','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','intersection','options','find','create','body','params','getFields','findOne','ZohoField','pick','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x2a8b7d,_0x28a986){var _0x3ef411=function(_0x24f0d9){while(--_0x24f0d9){_0x2a8b7d['push'](_0x2a8b7d['shift']());}};_0x3ef411(++_0x28a986);}(_0xcaf3,0x185));var _0x3caf=function(_0x40aaa4,_0x3b22f4){_0x40aaa4=_0x40aaa4-0x0;var _0x4e21e5=_0xcaf3[_0x40aaa4];return _0x4e21e5;};'use strict';var emlformat=require(_0x3caf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3caf('0x1'));var jsonpatch=require(_0x3caf('0x2'));var rp=require(_0x3caf('0x3'));var moment=require(_0x3caf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3caf('0x5'));var util=require('util');var path=require(_0x3caf('0x6'));var sox=require(_0x3caf('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3caf('0x8'));var squel=require(_0x3caf('0x9'));var crypto=require(_0x3caf('0xa'));var jsforce=require(_0x3caf('0xb'));var deskjs=require(_0x3caf('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3caf('0xd'));var Papa=require(_0x3caf('0xe'));var Redis=require(_0x3caf('0xf'));var authService=require(_0x3caf('0x10'));var qs=require(_0x3caf('0x11'));var as=require(_0x3caf('0x12'));var hardwareService=require(_0x3caf('0x13'));var logger=require(_0x3caf('0x14'))('api');var utils=require(_0x3caf('0x15'));var config=require(_0x3caf('0x16'));var licenseUtil=require(_0x3caf('0x17'));var db=require(_0x3caf('0x18'))['db'];function respondWithStatusCode(_0xc0811c,_0x281442){_0x281442=_0x281442||0xcc;return function(_0x3cbc10){if(_0x3cbc10){return _0xc0811c['sendStatus'](_0x281442);}return _0xc0811c[_0x3caf('0x19')](_0x281442)[_0x3caf('0x1a')]();};}function respondWithResult(_0x32c9f4,_0x5eb431){_0x5eb431=_0x5eb431||0xc8;return function(_0x5e0e9b){if(_0x5e0e9b){return _0x32c9f4[_0x3caf('0x19')](_0x5eb431)[_0x3caf('0x1b')](_0x5e0e9b);}};}function respondWithFilteredResult(_0x593d62,_0x232d85){return function(_0x4b9e10){if(_0x4b9e10){var _0x229127=typeof _0x232d85[_0x3caf('0x1c')]===_0x3caf('0x1d')&&typeof _0x232d85[_0x3caf('0x1e')]==='undefined';var _0x573f76=_0x4b9e10[_0x3caf('0x1f')];var _0x2025ba=_0x229127?0x0:_0x232d85[_0x3caf('0x1c')];var _0x158eb3=_0x229127?_0x4b9e10[_0x3caf('0x1f')]:_0x232d85['offset']+_0x232d85['limit'];var _0x2ee36f;if(_0x158eb3>=_0x573f76){_0x158eb3=_0x573f76;_0x2ee36f=0xc8;}else{_0x2ee36f=0xce;}_0x593d62[_0x3caf('0x19')](_0x2ee36f);return _0x593d62['set'](_0x3caf('0x20'),_0x2025ba+'-'+_0x158eb3+'/'+_0x573f76)[_0x3caf('0x1b')](_0x4b9e10);}return null;};}function patchUpdates(_0x164f2e){return function(_0x1890a6){try{jsonpatch[_0x3caf('0x21')](_0x1890a6,_0x164f2e,!![]);}catch(_0x120c01){return BPromise[_0x3caf('0x22')](_0x120c01);}return _0x1890a6[_0x3caf('0x23')]();};}function saveUpdates(_0x53922f,_0x3bca3f){return function(_0x37cc7a){if(_0x37cc7a){return _0x37cc7a[_0x3caf('0x24')](_0x53922f)[_0x3caf('0x25')](function(_0xede82d){return _0xede82d;});}return null;};}function removeEntity(_0x574fc2,_0x47a162){return function(_0x483cad){if(_0x483cad){return _0x483cad['destroy']()[_0x3caf('0x25')](function(){_0x574fc2['status'](0xcc)[_0x3caf('0x1a')]();});}};}function handleEntityNotFound(_0x28656c,_0x35e35a){return function(_0x18e55c){if(!_0x18e55c){_0x28656c[_0x3caf('0x26')](0x194);}return _0x18e55c;};}function handleError(_0x2edc97,_0x1ded68){_0x1ded68=_0x1ded68||0x1f4;return function(_0x44b263){logger[_0x3caf('0x27')](_0x44b263['stack']);if(_0x44b263[_0x3caf('0x28')]){delete _0x44b263[_0x3caf('0x28')];}_0x2edc97[_0x3caf('0x19')](_0x1ded68)[_0x3caf('0x29')](_0x44b263);};}exports['index']=function(_0x521762,_0x1fa382){var _0x21f19={},_0x1a15c7={},_0x2abdff={'count':0x0,'rows':[]};var _0x595939=_[_0x3caf('0x2a')](db[_0x3caf('0x2b')][_0x3caf('0x2c')],function(_0x3dcdbb){return{'name':_0x3dcdbb['fieldName'],'type':_0x3dcdbb[_0x3caf('0x2d')]['key']};});_0x1a15c7['model']=_[_0x3caf('0x2a')](_0x595939,_0x3caf('0x28'));_0x1a15c7['query']=_[_0x3caf('0x2e')](_0x521762[_0x3caf('0x2f')]);_0x1a15c7[_0x3caf('0x30')]=_['intersection'](_0x1a15c7[_0x3caf('0x31')],_0x1a15c7[_0x3caf('0x2f')]);_0x21f19[_0x3caf('0x32')]=_['intersection'](_0x1a15c7['model'],qs[_0x3caf('0x33')](_0x521762[_0x3caf('0x2f')]['fields']));_0x21f19[_0x3caf('0x32')]=_0x21f19['attributes'][_0x3caf('0x34')]?_0x21f19[_0x3caf('0x32')]:_0x1a15c7[_0x3caf('0x31')];if(!_0x521762['query'][_0x3caf('0x35')](_0x3caf('0x36'))){_0x21f19[_0x3caf('0x1e')]=qs[_0x3caf('0x1e')](_0x521762[_0x3caf('0x2f')][_0x3caf('0x1e')]);_0x21f19[_0x3caf('0x1c')]=qs['offset'](_0x521762[_0x3caf('0x2f')][_0x3caf('0x1c')]);}_0x21f19[_0x3caf('0x37')]=qs[_0x3caf('0x38')](_0x521762['query']['sort']);_0x21f19[_0x3caf('0x39')]=qs[_0x3caf('0x30')](_['pick'](_0x521762[_0x3caf('0x2f')],_0x1a15c7[_0x3caf('0x30')]),_0x595939);if(_0x521762[_0x3caf('0x2f')]['filter']){_0x21f19[_0x3caf('0x39')]=_['merge'](_0x21f19[_0x3caf('0x39')],{'$or':_['map'](_0x595939,function(_0x3b83a0){if(_0x3b83a0[_0x3caf('0x2d')]!==_0x3caf('0x3a')){var _0x57b6a5={};_0x57b6a5[_0x3b83a0[_0x3caf('0x28')]]={'$like':'%'+_0x521762[_0x3caf('0x2f')][_0x3caf('0x3b')]+'%'};return _0x57b6a5;}})});}_0x21f19=_[_0x3caf('0x3c')]({},_0x21f19,_0x521762['options']);var _0x44db3d={'where':_0x21f19[_0x3caf('0x39')]};return db['ZohoConfiguration'][_0x3caf('0x1f')](_0x44db3d)[_0x3caf('0x25')](function(_0xdd28ac){_0x2abdff[_0x3caf('0x1f')]=_0xdd28ac;if(_0x521762[_0x3caf('0x2f')][_0x3caf('0x3d')]){_0x21f19[_0x3caf('0x3e')]=[{'all':!![]}];}return db[_0x3caf('0x2b')][_0x3caf('0x3f')](_0x21f19);})[_0x3caf('0x25')](function(_0x346b8d){_0x2abdff[_0x3caf('0x40')]=_0x346b8d;return _0x2abdff;})[_0x3caf('0x25')](respondWithFilteredResult(_0x1fa382,_0x21f19))[_0x3caf('0x41')](handleError(_0x1fa382,null));};exports[_0x3caf('0x42')]=function(_0x562803,_0x1b2608){var _0x78cb85={'raw':![],'where':{'id':_0x562803['params']['id']}},_0xe36d99={};_0xe36d99[_0x3caf('0x31')]=_[_0x3caf('0x2e')](db['ZohoConfiguration']['rawAttributes']);_0xe36d99[_0x3caf('0x2f')]=_[_0x3caf('0x2e')](_0x562803['query']);_0xe36d99[_0x3caf('0x30')]=_[_0x3caf('0x43')](_0xe36d99[_0x3caf('0x31')],_0xe36d99[_0x3caf('0x2f')]);_0x78cb85[_0x3caf('0x32')]=_[_0x3caf('0x43')](_0xe36d99[_0x3caf('0x31')],qs['fields'](_0x562803[_0x3caf('0x2f')][_0x3caf('0x33')]));_0x78cb85[_0x3caf('0x32')]=_0x78cb85[_0x3caf('0x32')][_0x3caf('0x34')]?_0x78cb85[_0x3caf('0x32')]:_0xe36d99[_0x3caf('0x31')];if(_0x562803[_0x3caf('0x2f')][_0x3caf('0x3d')]){_0x78cb85['include']=[{'all':!![]}];}_0x78cb85=_[_0x3caf('0x3c')]({},_0x78cb85,_0x562803[_0x3caf('0x44')]);return db[_0x3caf('0x2b')][_0x3caf('0x45')](_0x78cb85)[_0x3caf('0x25')](handleEntityNotFound(_0x1b2608,null))[_0x3caf('0x25')](respondWithResult(_0x1b2608,null))[_0x3caf('0x41')](handleError(_0x1b2608,null));};exports[_0x3caf('0x46')]=function(_0x2a59f6,_0x4a5922){return db[_0x3caf('0x2b')]['create'](_0x2a59f6[_0x3caf('0x47')],{})['then'](respondWithResult(_0x4a5922,0xc9))[_0x3caf('0x41')](handleError(_0x4a5922,null));};exports[_0x3caf('0x24')]=function(_0x5084e2,_0x5ebb6e){if(_0x5084e2[_0x3caf('0x47')]['id']){delete _0x5084e2[_0x3caf('0x47')]['id'];}return db[_0x3caf('0x2b')][_0x3caf('0x45')]({'where':{'id':_0x5084e2[_0x3caf('0x48')]['id']}})['then'](handleEntityNotFound(_0x5ebb6e,null))[_0x3caf('0x25')](saveUpdates(_0x5084e2[_0x3caf('0x47')],null))[_0x3caf('0x25')](respondWithResult(_0x5ebb6e,null))[_0x3caf('0x41')](handleError(_0x5ebb6e,null));};exports['destroy']=function(_0x491545,_0x4a3815){return db['ZohoConfiguration'][_0x3caf('0x45')]({'where':{'id':_0x491545['params']['id']}})[_0x3caf('0x25')](handleEntityNotFound(_0x4a3815,null))[_0x3caf('0x25')](removeEntity(_0x4a3815,null))[_0x3caf('0x41')](handleError(_0x4a3815,null));};exports[_0x3caf('0x49')]=function(_0x1988a9,_0x454e6c,_0x1fd562){var _0x403933={};var _0x4194f3={};var _0x48f3bb;var _0x3f0d8d;return db[_0x3caf('0x2b')][_0x3caf('0x4a')]({'where':{'id':_0x1988a9[_0x3caf('0x48')]['id']}})[_0x3caf('0x25')](handleEntityNotFound(_0x454e6c,null))[_0x3caf('0x25')](function(_0x31fc91){if(_0x31fc91){_0x48f3bb=_0x31fc91;_0x4194f3['model']=_[_0x3caf('0x2e')](db[_0x3caf('0x4b')][_0x3caf('0x2c')]);_0x4194f3[_0x3caf('0x2f')]=_[_0x3caf('0x2e')](_0x1988a9[_0x3caf('0x2f')]);_0x4194f3[_0x3caf('0x30')]=_[_0x3caf('0x43')](_0x4194f3[_0x3caf('0x31')],_0x4194f3[_0x3caf('0x2f')]);_0x403933[_0x3caf('0x32')]=_[_0x3caf('0x43')](_0x4194f3[_0x3caf('0x31')],qs[_0x3caf('0x33')](_0x1988a9[_0x3caf('0x2f')]['fields']));_0x403933[_0x3caf('0x32')]=_0x403933[_0x3caf('0x32')][_0x3caf('0x34')]?_0x403933[_0x3caf('0x32')]:_0x4194f3[_0x3caf('0x31')];_0x403933[_0x3caf('0x37')]=qs[_0x3caf('0x38')](_0x1988a9[_0x3caf('0x2f')][_0x3caf('0x38')]);_0x403933[_0x3caf('0x39')]=qs[_0x3caf('0x30')](_[_0x3caf('0x4c')](_0x1988a9[_0x3caf('0x2f')],_0x4194f3[_0x3caf('0x30')]));if(_0x1988a9[_0x3caf('0x2f')][_0x3caf('0x3b')]){_0x403933[_0x3caf('0x39')]=_['merge'](_0x403933['where'],{'$or':_[_0x3caf('0x2a')](_0x403933[_0x3caf('0x32')],function(_0xe45441){var _0x52008f={};_0x52008f[_0xe45441]={'$like':'%'+_0x1988a9['query'][_0x3caf('0x3b')]+'%'};return _0x52008f;})});}_0x403933=_['merge']({},_0x403933,_0x1988a9['options']);return _0x48f3bb[_0x3caf('0x49')](_0x403933);}})[_0x3caf('0x25')](function(_0x1845aa){if(_0x1845aa){_0x3f0d8d=_0x1845aa[_0x3caf('0x34')];if(!_0x1988a9[_0x3caf('0x2f')][_0x3caf('0x35')](_0x3caf('0x36'))){_0x403933['limit']=qs[_0x3caf('0x1e')](_0x1988a9[_0x3caf('0x2f')][_0x3caf('0x1e')]);_0x403933[_0x3caf('0x1c')]=qs[_0x3caf('0x1c')](_0x1988a9[_0x3caf('0x2f')][_0x3caf('0x1c')]);}return _0x48f3bb[_0x3caf('0x49')](_0x403933);}})[_0x3caf('0x25')](function(_0xc8b36){if(_0xc8b36){return _0xc8b36?{'count':_0x3f0d8d,'rows':_0xc8b36}:null;}})[_0x3caf('0x25')](respondWithResult(_0x454e6c,null))[_0x3caf('0x41')](handleError(_0x454e6c,null));};exports[_0x3caf('0x4d')]=function(_0x1fba8e,_0x3992a7,_0x478109){var _0x270b8a={};var _0x5d9a0a={};var _0xfb65b2;var _0x340e53;return db[_0x3caf('0x2b')][_0x3caf('0x4a')]({'where':{'id':_0x1fba8e[_0x3caf('0x48')]['id']}})[_0x3caf('0x25')](handleEntityNotFound(_0x3992a7,null))['then'](function(_0x93fdb0){if(_0x93fdb0){_0xfb65b2=_0x93fdb0;_0x5d9a0a[_0x3caf('0x31')]=_[_0x3caf('0x2e')](db[_0x3caf('0x4b')][_0x3caf('0x2c')]);_0x5d9a0a[_0x3caf('0x2f')]=_[_0x3caf('0x2e')](_0x1fba8e[_0x3caf('0x2f')]);_0x5d9a0a[_0x3caf('0x30')]=_[_0x3caf('0x43')](_0x5d9a0a[_0x3caf('0x31')],_0x5d9a0a[_0x3caf('0x2f')]);_0x270b8a[_0x3caf('0x32')]=_['intersection'](_0x5d9a0a[_0x3caf('0x31')],qs[_0x3caf('0x33')](_0x1fba8e['query'][_0x3caf('0x33')]));_0x270b8a[_0x3caf('0x32')]=_0x270b8a[_0x3caf('0x32')][_0x3caf('0x34')]?_0x270b8a[_0x3caf('0x32')]:_0x5d9a0a[_0x3caf('0x31')];_0x270b8a[_0x3caf('0x37')]=qs[_0x3caf('0x38')](_0x1fba8e[_0x3caf('0x2f')][_0x3caf('0x38')]);_0x270b8a[_0x3caf('0x39')]=qs['filters'](_[_0x3caf('0x4c')](_0x1fba8e[_0x3caf('0x2f')],_0x5d9a0a[_0x3caf('0x30')]));if(_0x1fba8e['query'][_0x3caf('0x3b')]){_0x270b8a[_0x3caf('0x39')]=_[_0x3caf('0x3c')](_0x270b8a[_0x3caf('0x39')],{'$or':_[_0x3caf('0x2a')](_0x270b8a[_0x3caf('0x32')],function(_0x4b3f3f){var _0x4863cd={};_0x4863cd[_0x4b3f3f]={'$like':'%'+_0x1fba8e[_0x3caf('0x2f')]['filter']+'%'};return _0x4863cd;})});}_0x270b8a=_[_0x3caf('0x3c')]({},_0x270b8a,_0x1fba8e[_0x3caf('0x44')]);return _0xfb65b2[_0x3caf('0x4d')](_0x270b8a);}})['then'](function(_0x12a26f){if(_0x12a26f){_0x340e53=_0x12a26f[_0x3caf('0x34')];if(!_0x1fba8e[_0x3caf('0x2f')][_0x3caf('0x35')]('nolimit')){_0x270b8a[_0x3caf('0x1e')]=qs[_0x3caf('0x1e')](_0x1fba8e['query'][_0x3caf('0x1e')]);_0x270b8a[_0x3caf('0x1c')]=qs[_0x3caf('0x1c')](_0x1fba8e[_0x3caf('0x2f')][_0x3caf('0x1c')]);}return _0xfb65b2[_0x3caf('0x4d')](_0x270b8a);}})['then'](function(_0x5e9332){if(_0x5e9332){return _0x5e9332?{'count':_0x340e53,'rows':_0x5e9332}:null;}})['then'](respondWithResult(_0x3992a7,null))['catch'](handleError(_0x3992a7,null));};exports[_0x3caf('0x4e')]=function(_0x3a5ad7,_0x263b6b,_0x130137){var _0x159a24={};var _0xc7d04a={};var _0x4fb44d;var _0x5f1bf5;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x3a5ad7[_0x3caf('0x48')]['id']}})[_0x3caf('0x25')](handleEntityNotFound(_0x263b6b,null))[_0x3caf('0x25')](function(_0x41d2de){if(_0x41d2de){_0x4fb44d=_0x41d2de;_0xc7d04a[_0x3caf('0x31')]=_[_0x3caf('0x2e')](db[_0x3caf('0x4b')][_0x3caf('0x2c')]);_0xc7d04a[_0x3caf('0x2f')]=_['keys'](_0x3a5ad7[_0x3caf('0x2f')]);_0xc7d04a[_0x3caf('0x30')]=_['intersection'](_0xc7d04a[_0x3caf('0x31')],_0xc7d04a['query']);_0x159a24[_0x3caf('0x32')]=_[_0x3caf('0x43')](_0xc7d04a['model'],qs['fields'](_0x3a5ad7[_0x3caf('0x2f')]['fields']));_0x159a24[_0x3caf('0x32')]=_0x159a24[_0x3caf('0x32')][_0x3caf('0x34')]?_0x159a24[_0x3caf('0x32')]:_0xc7d04a['model'];_0x159a24[_0x3caf('0x37')]=qs[_0x3caf('0x38')](_0x3a5ad7[_0x3caf('0x2f')][_0x3caf('0x38')]);_0x159a24[_0x3caf('0x39')]=qs['filters'](_[_0x3caf('0x4c')](_0x3a5ad7[_0x3caf('0x2f')],_0xc7d04a[_0x3caf('0x30')]));if(_0x3a5ad7[_0x3caf('0x2f')][_0x3caf('0x3b')]){_0x159a24['where']=_[_0x3caf('0x3c')](_0x159a24[_0x3caf('0x39')],{'$or':_[_0x3caf('0x2a')](_0x159a24[_0x3caf('0x32')],function(_0x208605){var _0x1e6a62={};_0x1e6a62[_0x208605]={'$like':'%'+_0x3a5ad7[_0x3caf('0x2f')]['filter']+'%'};return _0x1e6a62;})});}_0x159a24=_[_0x3caf('0x3c')]({},_0x159a24,_0x3a5ad7[_0x3caf('0x44')]);return _0x4fb44d['getDescriptions'](_0x159a24);}})[_0x3caf('0x25')](function(_0xfc25e5){if(_0xfc25e5){_0x5f1bf5=_0xfc25e5[_0x3caf('0x34')];if(!_0x3a5ad7[_0x3caf('0x2f')][_0x3caf('0x35')](_0x3caf('0x36'))){_0x159a24[_0x3caf('0x1e')]=qs[_0x3caf('0x1e')](_0x3a5ad7['query'][_0x3caf('0x1e')]);_0x159a24[_0x3caf('0x1c')]=qs[_0x3caf('0x1c')](_0x3a5ad7[_0x3caf('0x2f')][_0x3caf('0x1c')]);}return _0x4fb44d[_0x3caf('0x4e')](_0x159a24);}})['then'](function(_0x382db2){if(_0x382db2){return _0x382db2?{'count':_0x5f1bf5,'rows':_0x382db2}:null;}})[_0x3caf('0x25')](respondWithResult(_0x263b6b,null))[_0x3caf('0x41')](handleError(_0x263b6b,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index de8e369..9a2bd42 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 _0xc6da=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','lodash','util'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc6da,0x9a));var _0xac6d=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xc6da[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0xac6d('0x0'));var util=require(_0xac6d('0x1'));var logger=require(_0xac6d('0x2'))(_0xac6d('0x3'));var moment=require(_0xac6d('0x4'));var BPromise=require('bluebird');var rp=require(_0xac6d('0x5'));var fs=require('fs');var path=require(_0xac6d('0x6'));var rimraf=require(_0xac6d('0x7'));var config=require(_0xac6d('0x8'));var attributes=require(_0xac6d('0x9'));module['exports']=function(_0x454ed0,_0x4132b8){return _0x454ed0[_0xac6d('0xa')](_0xac6d('0xb'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf6c=['./intZohoConfiguration.attributes','define','int_zoho_configurations','util','../../config/logger','moment','path','rimraf'];(function(_0xb16225,_0x3f50f8){var _0x4c917a=function(_0x57336d){while(--_0x57336d){_0xb16225['push'](_0xb16225['shift']());}};_0x4c917a(++_0x3f50f8);}(_0xbf6c,0x6b));var _0xcbf6=function(_0x24ca1a,_0x1643ba){_0x24ca1a=_0x24ca1a-0x0;var _0x420117=_0xbf6c[_0x24ca1a];return _0x420117;};'use strict';var _=require('lodash');var util=require(_0xcbf6('0x0'));var logger=require(_0xcbf6('0x1'))('api');var moment=require(_0xcbf6('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcbf6('0x3'));var rimraf=require(_0xcbf6('0x4'));var config=require('../../config/environment');var attributes=require(_0xcbf6('0x5'));module['exports']=function(_0x5afb20,_0x4ea627){return _0x5afb20[_0xcbf6('0x6')]('ZohoConfiguration',attributes,{'tableName':_0xcbf6('0x7'),'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 baffb6a..65f51f6 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 _0x66dc=['error','code','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x41ed29,_0x1c4e80){var _0x2b50df=function(_0x38881c){while(--_0x38881c){_0x41ed29['push'](_0x41ed29['shift']());}};_0x2b50df(++_0x1c4e80);}(_0x66dc,0x11a));var _0xc66d=function(_0x4e66d8,_0x22a5a6){_0x4e66d8=_0x4e66d8-0x0;var _0x22336a=_0x66dc[_0x4e66d8];return _0x22336a;};'use strict';var _=require(_0xc66d('0x0'));var util=require(_0xc66d('0x1'));var moment=require(_0xc66d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc66d('0x3'));var db=require(_0xc66d('0x4'))['db'];var utils=require(_0xc66d('0x5'));var logger=require(_0xc66d('0x6'))(_0xc66d('0x7'));var config=require(_0xc66d('0x8'));var jayson=require(_0xc66d('0x9'));var client=jayson[_0xc66d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55f90c,_0x2adb93,_0x249b0b){return new BPromise(function(_0x33a6cc,_0x99a559){return client[_0xc66d('0xb')](_0x55f90c,_0x249b0b)['then'](function(_0x4dc96f){logger['info'](_0xc66d('0xc'),_0x2adb93,_0xc66d('0xd'));logger[_0xc66d('0xe')](_0xc66d('0xf'),_0x2adb93,_0xc66d('0xd'),JSON[_0xc66d('0x10')](_0x4dc96f));if(_0x4dc96f[_0xc66d('0x11')]){if(_0x4dc96f[_0xc66d('0x11')][_0xc66d('0x12')]===0x1f4){logger[_0xc66d('0x11')](_0xc66d('0xc'),_0x2adb93,_0x4dc96f['error'][_0xc66d('0x13')]);return _0x99a559(_0x4dc96f['error']['message']);}logger[_0xc66d('0x11')](_0xc66d('0xc'),_0x2adb93,_0x4dc96f[_0xc66d('0x11')]['message']);return _0x33a6cc(_0x4dc96f[_0xc66d('0x11')][_0xc66d('0x13')]);}else{logger[_0xc66d('0x14')](_0xc66d('0xc'),_0x2adb93,'request\x20sent');_0x33a6cc(_0x4dc96f[_0xc66d('0x15')]['message']);}})[_0xc66d('0x16')](function(_0x2de08f){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x2adb93,_0x2de08f);_0x99a559(_0x2de08f);});});} \ No newline at end of file +var _0x235c=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','lodash','util','moment'];(function(_0x1f50b7,_0x3832ab){var _0xfc3517=function(_0x385068){while(--_0x385068){_0x1f50b7['push'](_0x1f50b7['shift']());}};_0xfc3517(++_0x3832ab);}(_0x235c,0x1c5));var _0xc235=function(_0xf95577,_0x54d436){_0xf95577=_0xf95577-0x0;var _0x3485d4=_0x235c[_0xf95577];return _0x3485d4;};'use strict';var _=require(_0xc235('0x0'));var util=require(_0xc235('0x1'));var moment=require(_0xc235('0x2'));var BPromise=require(_0xc235('0x3'));var rs=require(_0xc235('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc235('0x5'))['db'];var utils=require(_0xc235('0x6'));var logger=require(_0xc235('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc235('0x8'));var client=jayson['client'][_0xc235('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x411337,_0xe1c034,_0x1c7724){return new BPromise(function(_0x2abd96,_0x590b51){return client[_0xc235('0xa')](_0x411337,_0x1c7724)[_0xc235('0xb')](function(_0x5a96bc){logger[_0xc235('0xc')](_0xc235('0xd'),_0xe1c034,_0xc235('0xe'));logger[_0xc235('0xf')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0xe1c034,_0xc235('0xe'),JSON[_0xc235('0x10')](_0x5a96bc));if(_0x5a96bc['error']){if(_0x5a96bc[_0xc235('0x11')]['code']===0x1f4){logger[_0xc235('0x11')](_0xc235('0xd'),_0xe1c034,_0x5a96bc['error'][_0xc235('0x12')]);return _0x590b51(_0x5a96bc['error'][_0xc235('0x12')]);}logger[_0xc235('0x11')](_0xc235('0xd'),_0xe1c034,_0x5a96bc[_0xc235('0x11')][_0xc235('0x12')]);return _0x2abd96(_0x5a96bc[_0xc235('0x11')][_0xc235('0x12')]);}else{logger[_0xc235('0xc')](_0xc235('0xd'),_0xe1c034,_0xc235('0xe'));_0x2abd96(_0x5a96bc['result']['message']);}})['catch'](function(_0x3d4b31){logger[_0xc235('0x11')](_0xc235('0xd'),_0xe1c034,_0x3d4b31);_0x590b51(_0x3d4b31);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index b278116..1d58ed3 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 _0xb186=['/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get'];(function(_0x251e8c,_0x277c33){var _0x1e0c1d=function(_0x20b89c){while(--_0x20b89c){_0x251e8c['push'](_0x251e8c['shift']());}};_0x1e0c1d(++_0x277c33);}(_0xb186,0x184));var _0x6b18=function(_0x27856d,_0x13b764){_0x27856d=_0x27856d-0x0;var _0x3a80b8=_0xb186[_0x27856d];return _0x3a80b8;};'use strict';var multer=require(_0x6b18('0x0'));var util=require(_0x6b18('0x1'));var path=require(_0x6b18('0x2'));var timeout=require(_0x6b18('0x3'));var express=require(_0x6b18('0x4'));var router=express['Router']();var fs_extra=require(_0x6b18('0x5'));var auth=require(_0x6b18('0x6'));var interaction=require(_0x6b18('0x7'));var config=require('../../config/environment');var controller=require('./intZohoField.controller');router['get']('/',auth[_0x6b18('0x8')](),controller[_0x6b18('0x9')]);router[_0x6b18('0xa')](_0x6b18('0xb'),auth['isAuthenticated'](),controller[_0x6b18('0xc')]);router[_0x6b18('0xd')]('/',auth['isAuthenticated'](),controller[_0x6b18('0xe')]);router[_0x6b18('0xf')](_0x6b18('0xb'),auth[_0x6b18('0x8')](),controller[_0x6b18('0x10')]);router[_0x6b18('0x11')](_0x6b18('0xb'),auth[_0x6b18('0x8')](),controller[_0x6b18('0x12')]);module['exports']=router; \ No newline at end of file +var _0x40c0=['/:id','isAuthenticated','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','get','index'];(function(_0x17f22b,_0x4bc736){var _0x4cde5e=function(_0x17913e){while(--_0x17913e){_0x17f22b['push'](_0x17f22b['shift']());}};_0x4cde5e(++_0x4bc736);}(_0x40c0,0xc5));var _0x040c=function(_0x518635,_0x453393){_0x518635=_0x518635-0x0;var _0x1de62d=_0x40c0[_0x518635];return _0x1de62d;};'use strict';var multer=require(_0x040c('0x0'));var util=require(_0x040c('0x1'));var path=require(_0x040c('0x2'));var timeout=require(_0x040c('0x3'));var express=require(_0x040c('0x4'));var router=express[_0x040c('0x5')]();var fs_extra=require(_0x040c('0x6'));var auth=require(_0x040c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x040c('0x8'));var controller=require(_0x040c('0x9'));router[_0x040c('0xa')]('/',auth['isAuthenticated'](),controller[_0x040c('0xb')]);router[_0x040c('0xa')](_0x040c('0xc'),auth[_0x040c('0xd')](),controller['show']);router['post']('/',auth[_0x040c('0xd')](),controller[_0x040c('0xe')]);router['put'](_0x040c('0xc'),auth[_0x040c('0xd')](),controller[_0x040c('0xf')]);router[_0x040c('0x10')]('/:id',auth[_0x040c('0xd')](),controller[_0x040c('0x11')]);module[_0x040c('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 0e70654..b5af66d 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 _0x2839=['variable','customVariable','picklist','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x59e850,_0x57fce7){var _0x534fc4=function(_0x1f9b78){while(--_0x1f9b78){_0x59e850['push'](_0x59e850['shift']());}};_0x534fc4(++_0x57fce7);}(_0x2839,0x135));var _0x9283=function(_0x5e7402,_0x4d620b){_0x5e7402=_0x5e7402-0x0;var _0x5e5a27=_0x2839[_0x5e7402];return _0x5e5a27;};'use strict';var Sequelize=require(_0x9283('0x0'));module['exports']={'type':{'type':Sequelize[_0x9283('0x1')](_0x9283('0x2'),_0x9283('0x3'),_0x9283('0x4'),'keyValue',_0x9283('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9283('0x6')]},'key':{'type':Sequelize[_0x9283('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x9283('0x2'),_0x9283('0x3'),_0x9283('0x4'))},'keyContent':{'type':Sequelize[_0x9283('0x6')]},'idField':{'type':Sequelize[_0x9283('0x6')]},'nameField':{'type':Sequelize[_0x9283('0x6')]},'customField':{'type':Sequelize[_0x9283('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9283('0x6')]}}; \ No newline at end of file +var _0x617e=['sequelize','exports','string','variable','customVariable','picklist','STRING','ENUM','BOOLEAN'];(function(_0x38d980,_0xe476e5){var _0x3f156a=function(_0x357467){while(--_0x357467){_0x38d980['push'](_0x38d980['shift']());}};_0x3f156a(++_0xe476e5);}(_0x617e,0x14d));var _0xe617=function(_0x48dd5e,_0x5bf851){_0x48dd5e=_0x48dd5e-0x0;var _0x2f68ed=_0x617e[_0x48dd5e];return _0x2f68ed;};'use strict';var Sequelize=require(_0xe617('0x0'));module[_0xe617('0x1')]={'type':{'type':Sequelize['ENUM'](_0xe617('0x2'),_0xe617('0x3'),_0xe617('0x4'),'keyValue',_0xe617('0x5')),'defaultValue':_0xe617('0x2')},'content':{'type':Sequelize[_0xe617('0x6')]},'key':{'type':Sequelize[_0xe617('0x6')]},'keyType':{'type':Sequelize[_0xe617('0x7')](_0xe617('0x2'),_0xe617('0x3'),_0xe617('0x4'))},'keyContent':{'type':Sequelize[_0xe617('0x6')]},'idField':{'type':Sequelize[_0xe617('0x6')]},'nameField':{'type':Sequelize[_0xe617('0x6')]},'customField':{'type':Sequelize[_0xe617('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe617('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 3583304..f1a7bf7 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 _0xd688=['mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','reject','save','update','then','destroy','error','stack','send','ZohoField','rawAttributes','fieldName','key','model','map','name','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0xd688,0x16b));var _0x8d68=function(_0x27e6f2,_0x413871){_0x27e6f2=_0x27e6f2-0x0;var _0x2ac6ed=_0xd688[_0x27e6f2];return _0x2ac6ed;};'use strict';var emlformat=require(_0x8d68('0x0'));var rimraf=require(_0x8d68('0x1'));var zipdir=require(_0x8d68('0x2'));var jsonpatch=require(_0x8d68('0x3'));var rp=require(_0x8d68('0x4'));var moment=require(_0x8d68('0x5'));var BPromise=require(_0x8d68('0x6'));var Mustache=require(_0x8d68('0x7'));var util=require('util');var path=require(_0x8d68('0x8'));var sox=require(_0x8d68('0x9'));var csv=require(_0x8d68('0xa'));var ejs=require(_0x8d68('0xb'));var fs=require('fs');var fs_extra=require(_0x8d68('0xc'));var _=require(_0x8d68('0xd'));var squel=require(_0x8d68('0xe'));var crypto=require('crypto');var jsforce=require(_0x8d68('0xf'));var deskjs=require(_0x8d68('0x10'));var toCsv=require(_0x8d68('0xa'));var querystring=require('querystring');var Papa=require(_0x8d68('0x11'));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('../../config/license/hardware');var logger=require('../../config/logger')(_0x8d68('0x12'));var utils=require(_0x8d68('0x13'));var config=require(_0x8d68('0x14'));var licenseUtil=require(_0x8d68('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x269797,_0x19026c){_0x19026c=_0x19026c||0xcc;return function(_0x33a42f){if(_0x33a42f){return _0x269797[_0x8d68('0x16')](_0x19026c);}return _0x269797['status'](_0x19026c)[_0x8d68('0x17')]();};}function respondWithResult(_0x19b48c,_0x53210e){_0x53210e=_0x53210e||0xc8;return function(_0x2c0d6d){if(_0x2c0d6d){return _0x19b48c['status'](_0x53210e)[_0x8d68('0x18')](_0x2c0d6d);}};}function respondWithFilteredResult(_0x450642,_0x3485b8){return function(_0xeb8484){if(_0xeb8484){var _0x336780=typeof _0x3485b8['offset']===_0x8d68('0x19')&&typeof _0x3485b8[_0x8d68('0x1a')]==='undefined';var _0x5f48d2=_0xeb8484[_0x8d68('0x1b')];var _0x49ab84=_0x336780?0x0:_0x3485b8[_0x8d68('0x1c')];var _0x125021=_0x336780?_0xeb8484['count']:_0x3485b8[_0x8d68('0x1c')]+_0x3485b8[_0x8d68('0x1a')];var _0x46c9a5;if(_0x125021>=_0x5f48d2){_0x125021=_0x5f48d2;_0x46c9a5=0xc8;}else{_0x46c9a5=0xce;}_0x450642[_0x8d68('0x1d')](_0x46c9a5);return _0x450642[_0x8d68('0x1e')](_0x8d68('0x1f'),_0x49ab84+'-'+_0x125021+'/'+_0x5f48d2)[_0x8d68('0x18')](_0xeb8484);}return null;};}function patchUpdates(_0x5725ec){return function(_0x143aa8){try{jsonpatch['apply'](_0x143aa8,_0x5725ec,!![]);}catch(_0x264b21){return BPromise[_0x8d68('0x20')](_0x264b21);}return _0x143aa8[_0x8d68('0x21')]();};}function saveUpdates(_0x25183a,_0x204816){return function(_0xe285c7){if(_0xe285c7){return _0xe285c7[_0x8d68('0x22')](_0x25183a)[_0x8d68('0x23')](function(_0x1d49ea){return _0x1d49ea;});}return null;};}function removeEntity(_0x4b4fd6,_0x523c3b){return function(_0x499bda){if(_0x499bda){return _0x499bda[_0x8d68('0x24')]()[_0x8d68('0x23')](function(){_0x4b4fd6[_0x8d68('0x1d')](0xcc)[_0x8d68('0x17')]();});}};}function handleEntityNotFound(_0x361c8b,_0x8c4b55){return function(_0x429d2b){if(!_0x429d2b){_0x361c8b['sendStatus'](0x194);}return _0x429d2b;};}function handleError(_0x19f8d6,_0x58b6a4){_0x58b6a4=_0x58b6a4||0x1f4;return function(_0x1e715a){logger[_0x8d68('0x25')](_0x1e715a[_0x8d68('0x26')]);if(_0x1e715a['name']){delete _0x1e715a['name'];}_0x19f8d6[_0x8d68('0x1d')](_0x58b6a4)[_0x8d68('0x27')](_0x1e715a);};}exports['index']=function(_0x3cc343,_0x42a6f8){var _0x39e865={},_0x914a0d={},_0x4e89b0={'count':0x0,'rows':[]};var _0x56a057=_['map'](db[_0x8d68('0x28')][_0x8d68('0x29')],function(_0x41e205){return{'name':_0x41e205[_0x8d68('0x2a')],'type':_0x41e205['type'][_0x8d68('0x2b')]};});_0x914a0d[_0x8d68('0x2c')]=_[_0x8d68('0x2d')](_0x56a057,_0x8d68('0x2e'));_0x914a0d[_0x8d68('0x2f')]=_[_0x8d68('0x30')](_0x3cc343[_0x8d68('0x2f')]);_0x914a0d[_0x8d68('0x31')]=_['intersection'](_0x914a0d[_0x8d68('0x2c')],_0x914a0d['query']);_0x39e865[_0x8d68('0x32')]=_[_0x8d68('0x33')](_0x914a0d[_0x8d68('0x2c')],qs[_0x8d68('0x34')](_0x3cc343[_0x8d68('0x2f')][_0x8d68('0x34')]));_0x39e865[_0x8d68('0x32')]=_0x39e865[_0x8d68('0x32')][_0x8d68('0x35')]?_0x39e865[_0x8d68('0x32')]:_0x914a0d[_0x8d68('0x2c')];if(!_0x3cc343[_0x8d68('0x2f')]['hasOwnProperty'](_0x8d68('0x36'))){_0x39e865[_0x8d68('0x1a')]=qs[_0x8d68('0x1a')](_0x3cc343['query'][_0x8d68('0x1a')]);_0x39e865[_0x8d68('0x1c')]=qs[_0x8d68('0x1c')](_0x3cc343[_0x8d68('0x2f')][_0x8d68('0x1c')]);}_0x39e865[_0x8d68('0x37')]=qs[_0x8d68('0x38')](_0x3cc343[_0x8d68('0x2f')][_0x8d68('0x38')]);_0x39e865[_0x8d68('0x39')]=qs[_0x8d68('0x31')](_[_0x8d68('0x3a')](_0x3cc343[_0x8d68('0x2f')],_0x914a0d[_0x8d68('0x31')]),_0x56a057);if(_0x3cc343['query'][_0x8d68('0x3b')]){_0x39e865[_0x8d68('0x39')]=_['merge'](_0x39e865[_0x8d68('0x39')],{'$or':_[_0x8d68('0x2d')](_0x56a057,function(_0x4391f7){if(_0x4391f7[_0x8d68('0x3c')]!==_0x8d68('0x3d')){var _0xe8a438={};_0xe8a438[_0x4391f7[_0x8d68('0x2e')]]={'$like':'%'+_0x3cc343[_0x8d68('0x2f')][_0x8d68('0x3b')]+'%'};return _0xe8a438;}})});}_0x39e865=_[_0x8d68('0x3e')]({},_0x39e865,_0x3cc343[_0x8d68('0x3f')]);var _0x440d4e={'where':_0x39e865[_0x8d68('0x39')]};return db[_0x8d68('0x28')][_0x8d68('0x1b')](_0x440d4e)['then'](function(_0x508783){_0x4e89b0[_0x8d68('0x1b')]=_0x508783;if(_0x3cc343['query'][_0x8d68('0x40')]){_0x39e865[_0x8d68('0x41')]=[{'all':!![]}];}return db['ZohoField'][_0x8d68('0x42')](_0x39e865);})[_0x8d68('0x23')](function(_0x36eca8){_0x4e89b0[_0x8d68('0x43')]=_0x36eca8;return _0x4e89b0;})['then'](respondWithFilteredResult(_0x42a6f8,_0x39e865))[_0x8d68('0x44')](handleError(_0x42a6f8,null));};exports[_0x8d68('0x45')]=function(_0x42acfb,_0x459887){var _0x478e40={'raw':!![],'where':{'id':_0x42acfb[_0x8d68('0x46')]['id']}},_0x58066f={};_0x58066f['model']=_[_0x8d68('0x30')](db[_0x8d68('0x28')]['rawAttributes']);_0x58066f[_0x8d68('0x2f')]=_['keys'](_0x42acfb[_0x8d68('0x2f')]);_0x58066f[_0x8d68('0x31')]=_[_0x8d68('0x33')](_0x58066f[_0x8d68('0x2c')],_0x58066f[_0x8d68('0x2f')]);_0x478e40[_0x8d68('0x32')]=_[_0x8d68('0x33')](_0x58066f[_0x8d68('0x2c')],qs[_0x8d68('0x34')](_0x42acfb['query'][_0x8d68('0x34')]));_0x478e40[_0x8d68('0x32')]=_0x478e40['attributes'][_0x8d68('0x35')]?_0x478e40[_0x8d68('0x32')]:_0x58066f['model'];if(_0x42acfb[_0x8d68('0x2f')][_0x8d68('0x40')]){_0x478e40['include']=[{'all':!![]}];}_0x478e40=_[_0x8d68('0x3e')]({},_0x478e40,_0x42acfb[_0x8d68('0x3f')]);return db[_0x8d68('0x28')][_0x8d68('0x47')](_0x478e40)[_0x8d68('0x23')](handleEntityNotFound(_0x459887,null))[_0x8d68('0x23')](respondWithResult(_0x459887,null))['catch'](handleError(_0x459887,null));};exports[_0x8d68('0x48')]=function(_0x3066e6,_0x53014b){return db[_0x8d68('0x28')][_0x8d68('0x48')](_0x3066e6[_0x8d68('0x49')],{})[_0x8d68('0x23')](respondWithResult(_0x53014b,0xc9))[_0x8d68('0x44')](handleError(_0x53014b,null));};exports[_0x8d68('0x22')]=function(_0x60d5,_0x2d5b41){if(_0x60d5[_0x8d68('0x49')]['id']){delete _0x60d5[_0x8d68('0x49')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x60d5[_0x8d68('0x46')]['id']}})['then'](handleEntityNotFound(_0x2d5b41,null))['then'](saveUpdates(_0x60d5[_0x8d68('0x49')],null))['then'](respondWithResult(_0x2d5b41,null))[_0x8d68('0x44')](handleError(_0x2d5b41,null));};exports[_0x8d68('0x24')]=function(_0x2481a3,_0xce9617){return db[_0x8d68('0x28')][_0x8d68('0x47')]({'where':{'id':_0x2481a3['params']['id']}})[_0x8d68('0x23')](handleEntityNotFound(_0xce9617,null))['then'](removeEntity(_0xce9617,null))['catch'](handleError(_0xce9617,null));}; \ No newline at end of file +var _0x5cad=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','offset','count','set','apply','reject','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','catch','params','ZohoField','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring'];(function(_0x58643f,_0x4b5455){var _0x16f91e=function(_0x18be78){while(--_0x18be78){_0x58643f['push'](_0x58643f['shift']());}};_0x16f91e(++_0x4b5455);}(_0x5cad,0x116));var _0xd5ca=function(_0x5e8c35,_0x158b3a){_0x5e8c35=_0x5e8c35-0x0;var _0x546803=_0x5cad[_0x5e8c35];return _0x546803;};'use strict';var emlformat=require(_0xd5ca('0x0'));var rimraf=require(_0xd5ca('0x1'));var zipdir=require(_0xd5ca('0x2'));var jsonpatch=require(_0xd5ca('0x3'));var rp=require(_0xd5ca('0x4'));var moment=require(_0xd5ca('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd5ca('0x6'));var util=require(_0xd5ca('0x7'));var path=require(_0xd5ca('0x8'));var sox=require(_0xd5ca('0x9'));var csv=require('to-csv');var ejs=require(_0xd5ca('0xa'));var fs=require('fs');var fs_extra=require(_0xd5ca('0xb'));var _=require(_0xd5ca('0xc'));var squel=require(_0xd5ca('0xd'));var crypto=require('crypto');var jsforce=require(_0xd5ca('0xe'));var deskjs=require(_0xd5ca('0xf'));var toCsv=require(_0xd5ca('0x10'));var querystring=require(_0xd5ca('0x11'));var Papa=require('papaparse');var Redis=require(_0xd5ca('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd5ca('0x13'));var as=require(_0xd5ca('0x14'));var hardwareService=require(_0xd5ca('0x15'));var logger=require(_0xd5ca('0x16'))(_0xd5ca('0x17'));var utils=require(_0xd5ca('0x18'));var config=require(_0xd5ca('0x19'));var licenseUtil=require(_0xd5ca('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c407e,_0x4fa8bc){_0x4fa8bc=_0x4fa8bc||0xcc;return function(_0x499ad6){if(_0x499ad6){return _0x2c407e[_0xd5ca('0x1b')](_0x4fa8bc);}return _0x2c407e[_0xd5ca('0x1c')](_0x4fa8bc)[_0xd5ca('0x1d')]();};}function respondWithResult(_0x24f19c,_0x34e64c){_0x34e64c=_0x34e64c||0xc8;return function(_0xc6b61f){if(_0xc6b61f){return _0x24f19c[_0xd5ca('0x1c')](_0x34e64c)[_0xd5ca('0x1e')](_0xc6b61f);}};}function respondWithFilteredResult(_0xa82739,_0x3b18eb){return function(_0x294678){if(_0x294678){var _0x276d9d=typeof _0x3b18eb['offset']==='undefined'&&typeof _0x3b18eb[_0xd5ca('0x1f')]===_0xd5ca('0x20');var _0x4fa3fd=_0x294678['count'];var _0x8aef50=_0x276d9d?0x0:_0x3b18eb[_0xd5ca('0x21')];var _0x2bbf23=_0x276d9d?_0x294678[_0xd5ca('0x22')]:_0x3b18eb[_0xd5ca('0x21')]+_0x3b18eb['limit'];var _0x40c9db;if(_0x2bbf23>=_0x4fa3fd){_0x2bbf23=_0x4fa3fd;_0x40c9db=0xc8;}else{_0x40c9db=0xce;}_0xa82739['status'](_0x40c9db);return _0xa82739[_0xd5ca('0x23')]('Content-Range',_0x8aef50+'-'+_0x2bbf23+'/'+_0x4fa3fd)[_0xd5ca('0x1e')](_0x294678);}return null;};}function patchUpdates(_0x48c1d8){return function(_0x9abdbc){try{jsonpatch[_0xd5ca('0x24')](_0x9abdbc,_0x48c1d8,!![]);}catch(_0x1cc747){return BPromise[_0xd5ca('0x25')](_0x1cc747);}return _0x9abdbc['save']();};}function saveUpdates(_0x583437,_0x19ec54){return function(_0x2496d8){if(_0x2496d8){return _0x2496d8['update'](_0x583437)[_0xd5ca('0x26')](function(_0x322d81){return _0x322d81;});}return null;};}function removeEntity(_0x4d8d6f,_0x3f510f){return function(_0x3b1825){if(_0x3b1825){return _0x3b1825[_0xd5ca('0x27')]()[_0xd5ca('0x26')](function(){_0x4d8d6f[_0xd5ca('0x1c')](0xcc)[_0xd5ca('0x1d')]();});}};}function handleEntityNotFound(_0x4075a1,_0x3afb22){return function(_0x1cef81){if(!_0x1cef81){_0x4075a1[_0xd5ca('0x1b')](0x194);}return _0x1cef81;};}function handleError(_0x46c3b8,_0x34b272){_0x34b272=_0x34b272||0x1f4;return function(_0x5d453b){logger['error'](_0x5d453b[_0xd5ca('0x28')]);if(_0x5d453b['name']){delete _0x5d453b[_0xd5ca('0x29')];}_0x46c3b8['status'](_0x34b272)[_0xd5ca('0x2a')](_0x5d453b);};}exports[_0xd5ca('0x2b')]=function(_0x4724b2,_0x17e34e){var _0x118d3a={},_0x423751={},_0x170f01={'count':0x0,'rows':[]};var _0x4ee911=_['map'](db['ZohoField'][_0xd5ca('0x2c')],function(_0x1d3eb1){return{'name':_0x1d3eb1[_0xd5ca('0x2d')],'type':_0x1d3eb1[_0xd5ca('0x2e')][_0xd5ca('0x2f')]};});_0x423751[_0xd5ca('0x30')]=_[_0xd5ca('0x31')](_0x4ee911,'name');_0x423751['query']=_[_0xd5ca('0x32')](_0x4724b2[_0xd5ca('0x33')]);_0x423751[_0xd5ca('0x34')]=_[_0xd5ca('0x35')](_0x423751[_0xd5ca('0x30')],_0x423751['query']);_0x118d3a['attributes']=_['intersection'](_0x423751[_0xd5ca('0x30')],qs['fields'](_0x4724b2[_0xd5ca('0x33')][_0xd5ca('0x36')]));_0x118d3a[_0xd5ca('0x37')]=_0x118d3a[_0xd5ca('0x37')][_0xd5ca('0x38')]?_0x118d3a[_0xd5ca('0x37')]:_0x423751[_0xd5ca('0x30')];if(!_0x4724b2[_0xd5ca('0x33')]['hasOwnProperty']('nolimit')){_0x118d3a[_0xd5ca('0x1f')]=qs[_0xd5ca('0x1f')](_0x4724b2[_0xd5ca('0x33')]['limit']);_0x118d3a[_0xd5ca('0x21')]=qs[_0xd5ca('0x21')](_0x4724b2[_0xd5ca('0x33')][_0xd5ca('0x21')]);}_0x118d3a[_0xd5ca('0x39')]=qs[_0xd5ca('0x3a')](_0x4724b2[_0xd5ca('0x33')]['sort']);_0x118d3a['where']=qs[_0xd5ca('0x34')](_[_0xd5ca('0x3b')](_0x4724b2[_0xd5ca('0x33')],_0x423751[_0xd5ca('0x34')]),_0x4ee911);if(_0x4724b2[_0xd5ca('0x33')]['filter']){_0x118d3a[_0xd5ca('0x3c')]=_[_0xd5ca('0x3d')](_0x118d3a[_0xd5ca('0x3c')],{'$or':_['map'](_0x4ee911,function(_0x1a3412){if(_0x1a3412['type']!==_0xd5ca('0x3e')){var _0x3cafd1={};_0x3cafd1[_0x1a3412[_0xd5ca('0x29')]]={'$like':'%'+_0x4724b2[_0xd5ca('0x33')][_0xd5ca('0x3f')]+'%'};return _0x3cafd1;}})});}_0x118d3a=_[_0xd5ca('0x3d')]({},_0x118d3a,_0x4724b2[_0xd5ca('0x40')]);var _0x3752ce={'where':_0x118d3a[_0xd5ca('0x3c')]};return db['ZohoField'][_0xd5ca('0x22')](_0x3752ce)['then'](function(_0x540a43){_0x170f01['count']=_0x540a43;if(_0x4724b2['query'][_0xd5ca('0x41')]){_0x118d3a[_0xd5ca('0x42')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x118d3a);})[_0xd5ca('0x26')](function(_0x347b14){_0x170f01['rows']=_0x347b14;return _0x170f01;})[_0xd5ca('0x26')](respondWithFilteredResult(_0x17e34e,_0x118d3a))[_0xd5ca('0x43')](handleError(_0x17e34e,null));};exports['show']=function(_0x30e5d0,_0x37dcc0){var _0x50f85a={'raw':!![],'where':{'id':_0x30e5d0[_0xd5ca('0x44')]['id']}},_0x23e73e={};_0x23e73e[_0xd5ca('0x30')]=_['keys'](db['ZohoField'][_0xd5ca('0x2c')]);_0x23e73e[_0xd5ca('0x33')]=_[_0xd5ca('0x32')](_0x30e5d0[_0xd5ca('0x33')]);_0x23e73e[_0xd5ca('0x34')]=_[_0xd5ca('0x35')](_0x23e73e[_0xd5ca('0x30')],_0x23e73e[_0xd5ca('0x33')]);_0x50f85a[_0xd5ca('0x37')]=_[_0xd5ca('0x35')](_0x23e73e[_0xd5ca('0x30')],qs[_0xd5ca('0x36')](_0x30e5d0['query'][_0xd5ca('0x36')]));_0x50f85a[_0xd5ca('0x37')]=_0x50f85a[_0xd5ca('0x37')]['length']?_0x50f85a['attributes']:_0x23e73e[_0xd5ca('0x30')];if(_0x30e5d0[_0xd5ca('0x33')][_0xd5ca('0x41')]){_0x50f85a[_0xd5ca('0x42')]=[{'all':!![]}];}_0x50f85a=_[_0xd5ca('0x3d')]({},_0x50f85a,_0x30e5d0[_0xd5ca('0x40')]);return db[_0xd5ca('0x45')]['find'](_0x50f85a)['then'](handleEntityNotFound(_0x37dcc0,null))[_0xd5ca('0x26')](respondWithResult(_0x37dcc0,null))[_0xd5ca('0x43')](handleError(_0x37dcc0,null));};exports[_0xd5ca('0x46')]=function(_0xe0fb0b,_0xb23923){return db[_0xd5ca('0x45')][_0xd5ca('0x46')](_0xe0fb0b[_0xd5ca('0x47')],{})['then'](respondWithResult(_0xb23923,0xc9))[_0xd5ca('0x43')](handleError(_0xb23923,null));};exports[_0xd5ca('0x48')]=function(_0x8be6b0,_0x2ce579){if(_0x8be6b0[_0xd5ca('0x47')]['id']){delete _0x8be6b0[_0xd5ca('0x47')]['id'];}return db[_0xd5ca('0x45')][_0xd5ca('0x49')]({'where':{'id':_0x8be6b0[_0xd5ca('0x44')]['id']}})[_0xd5ca('0x26')](handleEntityNotFound(_0x2ce579,null))[_0xd5ca('0x26')](saveUpdates(_0x8be6b0[_0xd5ca('0x47')],null))['then'](respondWithResult(_0x2ce579,null))[_0xd5ca('0x43')](handleError(_0x2ce579,null));};exports[_0xd5ca('0x27')]=function(_0x84b0ae,_0x17bc1f){return db[_0xd5ca('0x45')][_0xd5ca('0x49')]({'where':{'id':_0x84b0ae[_0xd5ca('0x44')]['id']}})[_0xd5ca('0x26')](handleEntityNotFound(_0x17bc1f,null))[_0xd5ca('0x26')](removeEntity(_0x17bc1f,null))['catch'](handleError(_0x17bc1f,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 896173b..b1a5036 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 _0x9f0e=['../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x1ade05,_0xe2acd2){var _0x27ffc7=function(_0x52a647){while(--_0x52a647){_0x1ade05['push'](_0x1ade05['shift']());}};_0x27ffc7(++_0xe2acd2);}(_0x9f0e,0x116));var _0xe9f0=function(_0xd9ea16,_0x50a377){_0xd9ea16=_0xd9ea16-0x0;var _0x2063ac=_0x9f0e[_0xd9ea16];return _0x2063ac;};'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 +var _0x33af=['moment','bluebird','request-promise','path','rimraf','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','util','api'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x33af,0xec));var _0xf33a=function(_0x25b4a4,_0x2e081b){_0x25b4a4=_0x25b4a4-0x0;var _0x707267=_0x33af[_0x25b4a4];return _0x707267;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var logger=require('../../config/logger')(_0xf33a('0x1'));var moment=require(_0xf33a('0x2'));var BPromise=require(_0xf33a('0x3'));var rp=require(_0xf33a('0x4'));var fs=require('fs');var path=require(_0xf33a('0x5'));var rimraf=require(_0xf33a('0x6'));var config=require('../../config/environment');var attributes=require(_0xf33a('0x7'));module[_0xf33a('0x8')]=function(_0x583e54,_0xc0dd13){return _0x583e54[_0xf33a('0x9')](_0xf33a('0xa'),attributes,{'tableName':_0xf33a('0xb'),'paranoid':![],'indexes':[{'name':_0xf33a('0xc'),'fields':[_0xf33a('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index fbbfdca..02ae1ae 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 _0x315e=['../../config/utils','../../config/logger','jayson/promise','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x2746f4,_0x262058){var _0x4ec4b7=function(_0x5b36c4){while(--_0x5b36c4){_0x2746f4['push'](_0x2746f4['shift']());}};_0x4ec4b7(++_0x262058);}(_0x315e,0x177));var _0xe315=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x315e[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xe315('0x0'));var util=require(_0xe315('0x1'));var moment=require('moment');var BPromise=require(_0xe315('0x2'));var rs=require(_0xe315('0x3'));var fs=require('fs');var Redis=require(_0xe315('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe315('0x5'));var logger=require(_0xe315('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe315('0x7'));var client=jayson['client'][_0xe315('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x306344,_0x47bc49,_0x559980){return new BPromise(function(_0x5bdf14,_0x2ccc65){return client[_0xe315('0x9')](_0x306344,_0x559980)['then'](function(_0x5a24bc){logger[_0xe315('0xa')](_0xe315('0xb'),_0x47bc49,_0xe315('0xc'));logger[_0xe315('0xd')](_0xe315('0xe'),_0x47bc49,_0xe315('0xc'),JSON[_0xe315('0xf')](_0x5a24bc));if(_0x5a24bc[_0xe315('0x10')]){if(_0x5a24bc[_0xe315('0x10')][_0xe315('0x11')]===0x1f4){logger[_0xe315('0x10')](_0xe315('0xb'),_0x47bc49,_0x5a24bc[_0xe315('0x10')][_0xe315('0x12')]);return _0x2ccc65(_0x5a24bc['error'][_0xe315('0x12')]);}logger['error'](_0xe315('0xb'),_0x47bc49,_0x5a24bc[_0xe315('0x10')]['message']);return _0x5bdf14(_0x5a24bc[_0xe315('0x10')][_0xe315('0x12')]);}else{logger[_0xe315('0xa')]('ZohoField,\x20%s,\x20%s',_0x47bc49,'request\x20sent');_0x5bdf14(_0x5a24bc['result'][_0xe315('0x12')]);}})[_0xe315('0x13')](function(_0xb47518){logger[_0xe315('0x10')]('ZohoField,\x20%s,\x20%s',_0x47bc49,_0xb47518);_0x2ccc65(_0xb47518);});});} \ No newline at end of file +var _0x2c04=['debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent'];(function(_0x5728d2,_0xed4ba0){var _0x599cc6=function(_0x4bac3a){while(--_0x4bac3a){_0x5728d2['push'](_0x5728d2['shift']());}};_0x599cc6(++_0xed4ba0);}(_0x2c04,0x176));var _0x42c0=function(_0x58b607,_0x3a831d){_0x58b607=_0x58b607-0x0;var _0x3236bf=_0x2c04[_0x58b607];return _0x3236bf;};'use strict';var _=require(_0x42c0('0x0'));var util=require(_0x42c0('0x1'));var moment=require(_0x42c0('0x2'));var BPromise=require(_0x42c0('0x3'));var rs=require(_0x42c0('0x4'));var fs=require('fs');var Redis=require(_0x42c0('0x5'));var db=require(_0x42c0('0x6'))['db'];var utils=require(_0x42c0('0x7'));var logger=require(_0x42c0('0x8'))('rpc');var config=require(_0x42c0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x42c0('0xa')][_0x42c0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x466ba3,_0x2c5cd5,_0x278be3){return new BPromise(function(_0x2bb078,_0x5e04e9){return client[_0x42c0('0xc')](_0x466ba3,_0x278be3)[_0x42c0('0xd')](function(_0x4ea0e1){logger[_0x42c0('0xe')](_0x42c0('0xf'),_0x2c5cd5,_0x42c0('0x10'));logger[_0x42c0('0x11')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x2c5cd5,_0x42c0('0x10'),JSON['stringify'](_0x4ea0e1));if(_0x4ea0e1[_0x42c0('0x12')]){if(_0x4ea0e1[_0x42c0('0x12')][_0x42c0('0x13')]===0x1f4){logger[_0x42c0('0x12')](_0x42c0('0xf'),_0x2c5cd5,_0x4ea0e1[_0x42c0('0x12')][_0x42c0('0x14')]);return _0x5e04e9(_0x4ea0e1[_0x42c0('0x12')][_0x42c0('0x14')]);}logger['error'](_0x42c0('0xf'),_0x2c5cd5,_0x4ea0e1[_0x42c0('0x12')]['message']);return _0x2bb078(_0x4ea0e1[_0x42c0('0x12')]['message']);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x2c5cd5,_0x42c0('0x10'));_0x2bb078(_0x4ea0e1[_0x42c0('0x15')][_0x42c0('0x14')]);}})[_0x42c0('0x16')](function(_0x369aa3){logger[_0x42c0('0x12')](_0x42c0('0xf'),_0x2c5cd5,_0x369aa3);_0x5e04e9(_0x369aa3);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 37d9621..be167a2 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x333159,_0x68262e){var _0x2e29ac=function(_0xf4f1f){while(--_0xf4f1f){_0x333159['push'](_0x333159['shift']());}};_0x2e29ac(++_0x68262e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x48dfc7,_0x28410f){var _0x553cbf=function(_0x56f3f7){while(--_0x56f3f7){_0x48dfc7['push'](_0x48dfc7['shift']());}};_0x553cbf(++_0x28410f);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 0675dc7..031e646 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 _0xb49e=['app.js','INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x3962f3,_0x771961){var _0x44623c=function(_0x589e0a){while(--_0x589e0a){_0x3962f3['push'](_0x3962f3['shift']());}};_0x44623c(++_0x771961);}(_0xb49e,0x84));var _0xeb49=function(_0x1a0e81,_0x230f48){_0x1a0e81=_0x1a0e81-0x0;var _0x5216b0=_0xb49e[_0x1a0e81];return _0x5216b0;};'use strict';var Sequelize=require(_0xeb49('0x0'));module[_0xeb49('0x1')]={'name':{'type':Sequelize[_0xeb49('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xeb49('0x2')],'allowNull':![],'unique':_0xeb49('0x3')},'main':{'type':Sequelize[_0xeb49('0x2')],'defaultValue':_0xeb49('0x4')},'filename':{'type':Sequelize[_0xeb49('0x2')]},'path':{'type':Sequelize[_0xeb49('0x2')]},'type':{'type':Sequelize[_0xeb49('0x2')]},'size':{'type':Sequelize[_0xeb49('0x5')]},'active':{'type':Sequelize[_0xeb49('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xeb49('0x2')]},'logo':{'type':Sequelize[_0xeb49('0x2')]},'state':{'type':Sequelize[_0xeb49('0x2')],'unique':_0xeb49('0x7')},'description':{'type':Sequelize[_0xeb49('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xeb49('0x2')]},'link':{'type':Sequelize[_0xeb49('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xb6fc=['BOOLEAN','state','sequelize','exports','unique_name_and_version','app.js','STRING','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb6fc,0x72));var _0xcb6f=function(_0x10932d,_0x5875e7){_0x10932d=_0x10932d-0x0;var _0xd02033=_0xb6fc[_0x10932d];return _0xd02033;};'use strict';var Sequelize=require(_0xcb6f('0x0'));module[_0xcb6f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcb6f('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0xcb6f('0x3')},'filename':{'type':Sequelize[_0xcb6f('0x4')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xcb6f('0x4')]},'size':{'type':Sequelize[_0xcb6f('0x5')]},'active':{'type':Sequelize[_0xcb6f('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xcb6f('0x4')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xcb6f('0x4')],'unique':_0xcb6f('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xcb6f('0x4')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xcb6f('0x4')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index c1d41ec..59f9889 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 _0x1a37=['stack','name','send','index','map','Integration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x1a37,0xb4));var _0x71a3=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x1a37[_0x397cfb];return _0x15fed9;};'use strict';var emlformat=require(_0x71a3('0x0'));var rimraf=require(_0x71a3('0x1'));var zipdir=require(_0x71a3('0x2'));var jsonpatch=require(_0x71a3('0x3'));var rp=require(_0x71a3('0x4'));var moment=require(_0x71a3('0x5'));var BPromise=require(_0x71a3('0x6'));var Mustache=require(_0x71a3('0x7'));var util=require(_0x71a3('0x8'));var path=require(_0x71a3('0x9'));var sox=require('sox');var csv=require(_0x71a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71a3('0xb'));var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];function respondWithStatusCode(_0x3830cb,_0x27e46d){_0x27e46d=_0x27e46d||0xcc;return function(_0x229134){if(_0x229134){return _0x3830cb[_0x71a3('0x18')](_0x27e46d);}return _0x3830cb[_0x71a3('0x19')](_0x27e46d)[_0x71a3('0x1a')]();};}function respondWithResult(_0x3b256c,_0x4dc4ed){_0x4dc4ed=_0x4dc4ed||0xc8;return function(_0x203ee1){if(_0x203ee1){return _0x3b256c[_0x71a3('0x19')](_0x4dc4ed)['json'](_0x203ee1);}};}function respondWithFilteredResult(_0x1743d7,_0x32591a){return function(_0x59021f){if(_0x59021f){var _0x4aa918=typeof _0x32591a[_0x71a3('0x1b')]===_0x71a3('0x1c')&&typeof _0x32591a[_0x71a3('0x1d')]===_0x71a3('0x1c');var _0x1af1bc=_0x59021f[_0x71a3('0x1e')];var _0x5d4dee=_0x4aa918?0x0:_0x32591a[_0x71a3('0x1b')];var _0x27bfb4=_0x4aa918?_0x59021f['count']:_0x32591a['offset']+_0x32591a[_0x71a3('0x1d')];var _0x250db3;if(_0x27bfb4>=_0x1af1bc){_0x27bfb4=_0x1af1bc;_0x250db3=0xc8;}else{_0x250db3=0xce;}_0x1743d7[_0x71a3('0x19')](_0x250db3);return _0x1743d7[_0x71a3('0x1f')](_0x71a3('0x20'),_0x5d4dee+'-'+_0x27bfb4+'/'+_0x1af1bc)['json'](_0x59021f);}return null;};}function patchUpdates(_0x1ab947){return function(_0x4156e1){try{jsonpatch[_0x71a3('0x21')](_0x4156e1,_0x1ab947,!![]);}catch(_0x3ea036){return BPromise[_0x71a3('0x22')](_0x3ea036);}return _0x4156e1['save']();};}function saveUpdates(_0x1af24b,_0x5bbaee){return function(_0x3bf78e){if(_0x3bf78e){return _0x3bf78e[_0x71a3('0x23')](_0x1af24b)[_0x71a3('0x24')](function(_0x21899d){return _0x21899d;});}return null;};}function removeEntity(_0x452bc4,_0x2847b4){return function(_0x5f33c5){if(_0x5f33c5){return _0x5f33c5[_0x71a3('0x25')]()[_0x71a3('0x24')](function(){_0x452bc4[_0x71a3('0x19')](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0xb0f3aa,_0x4fd214){return function(_0x107fbd){if(!_0x107fbd){_0xb0f3aa[_0x71a3('0x18')](0x194);}return _0x107fbd;};}function handleError(_0x4c1a3d,_0x412746){_0x412746=_0x412746||0x1f4;return function(_0x515519){logger[_0x71a3('0x26')](_0x515519[_0x71a3('0x27')]);if(_0x515519[_0x71a3('0x28')]){delete _0x515519[_0x71a3('0x28')];}_0x4c1a3d[_0x71a3('0x19')](_0x412746)[_0x71a3('0x29')](_0x515519);};}exports[_0x71a3('0x2a')]=function(_0x242b85,_0x305eb1){var _0x3fc578={},_0x3ea7aa={},_0x228afa={'count':0x0,'rows':[]};var _0x51cde3=_[_0x71a3('0x2b')](db[_0x71a3('0x2c')][_0x71a3('0x2d')],function(_0x23ae85){return{'name':_0x23ae85['fieldName'],'type':_0x23ae85[_0x71a3('0x2e')][_0x71a3('0x2f')]};});_0x3ea7aa[_0x71a3('0x30')]=_[_0x71a3('0x2b')](_0x51cde3,_0x71a3('0x28'));_0x3ea7aa[_0x71a3('0x31')]=_[_0x71a3('0x32')](_0x242b85['query']);_0x3ea7aa[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],_0x3ea7aa[_0x71a3('0x31')]);_0x3fc578[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x36')]));_0x3fc578[_0x71a3('0x35')]=_0x3fc578[_0x71a3('0x35')][_0x71a3('0x37')]?_0x3fc578['attributes']:_0x3ea7aa['model'];if(!_0x242b85[_0x71a3('0x31')][_0x71a3('0x38')]('nolimit')){_0x3fc578[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x242b85['query'][_0x71a3('0x1d')]);_0x3fc578[_0x71a3('0x1b')]=qs[_0x71a3('0x1b')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x1b')]);}_0x3fc578[_0x71a3('0x39')]=qs[_0x71a3('0x3a')](_0x242b85['query'][_0x71a3('0x3a')]);_0x3fc578[_0x71a3('0x3b')]=qs[_0x71a3('0x33')](_['pick'](_0x242b85[_0x71a3('0x31')],_0x3ea7aa[_0x71a3('0x33')]),_0x51cde3);if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]){_0x3fc578[_0x71a3('0x3b')]=_['merge'](_0x3fc578['where'],{'$or':_[_0x71a3('0x2b')](_0x51cde3,function(_0x2b3197){if(_0x2b3197[_0x71a3('0x2e')]!==_0x71a3('0x3d')){var _0x36ed2e={};_0x36ed2e[_0x2b3197['name']]={'$like':'%'+_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]+'%'};return _0x36ed2e;}})});}_0x3fc578=_[_0x71a3('0x3e')]({},_0x3fc578,_0x242b85['options']);var _0x17c467={'where':_0x3fc578['where']};return db[_0x71a3('0x2c')][_0x71a3('0x1e')](_0x17c467)[_0x71a3('0x24')](function(_0x43c6d1){_0x228afa[_0x71a3('0x1e')]=_0x43c6d1;if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x3fc578[_0x71a3('0x40')]=[{'all':!![]}];}return db[_0x71a3('0x2c')][_0x71a3('0x41')](_0x3fc578);})['then'](function(_0xa49846){_0x228afa['rows']=_0xa49846;return _0x228afa;})[_0x71a3('0x24')](respondWithFilteredResult(_0x305eb1,_0x3fc578))[_0x71a3('0x42')](handleError(_0x305eb1,null));};exports[_0x71a3('0x43')]=function(_0x18974c,_0x59c7c9){var _0x412bce={'raw':![],'where':{'id':_0x18974c['params']['id']}},_0x4b4fde={};_0x4b4fde[_0x71a3('0x30')]=_[_0x71a3('0x32')](db[_0x71a3('0x2c')][_0x71a3('0x2d')]);_0x4b4fde['query']=_[_0x71a3('0x32')](_0x18974c[_0x71a3('0x31')]);_0x4b4fde[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],_0x4b4fde[_0x71a3('0x31')]);_0x412bce[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x18974c[_0x71a3('0x31')][_0x71a3('0x36')]));_0x412bce[_0x71a3('0x35')]=_0x412bce[_0x71a3('0x35')][_0x71a3('0x37')]?_0x412bce[_0x71a3('0x35')]:_0x4b4fde['model'];if(_0x18974c[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x412bce['include']=[{'all':!![]}];}_0x412bce=_[_0x71a3('0x3e')]({},_0x412bce,_0x18974c[_0x71a3('0x44')]);return db[_0x71a3('0x2c')][_0x71a3('0x45')](_0x412bce)[_0x71a3('0x24')](handleEntityNotFound(_0x59c7c9,null))['then'](respondWithResult(_0x59c7c9,null))['catch'](handleError(_0x59c7c9,null));};exports[_0x71a3('0x46')]=function(_0x4305ee,_0x51d20d){return db[_0x71a3('0x2c')][_0x71a3('0x46')](_0x4305ee[_0x71a3('0x47')],{})[_0x71a3('0x24')](respondWithResult(_0x51d20d,0xc9))[_0x71a3('0x42')](handleError(_0x51d20d,null));};exports[_0x71a3('0x23')]=function(_0x501a62,_0x1c9ba6){if(_0x501a62['body']['id']){delete _0x501a62[_0x71a3('0x47')]['id'];}return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x501a62[_0x71a3('0x48')]['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x1c9ba6,null))['then'](saveUpdates(_0x501a62[_0x71a3('0x47')],null))[_0x71a3('0x24')](respondWithResult(_0x1c9ba6,null))[_0x71a3('0x42')](handleError(_0x1c9ba6,null));};exports['destroy']=function(_0x6c34,_0x4e6423){return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x6c34['params']['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x4e6423,null))[_0x71a3('0x24')](removeEntity(_0x4e6423,null))[_0x71a3('0x42')](handleError(_0x4e6423,null));}; \ No newline at end of file +var _0xacf4=['VIRTUAL','merge','options','include','findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body','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','reject','update','then','destroy','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type'];(function(_0x55b874,_0x1d3a26){var _0x288fbf=function(_0x42d268){while(--_0x42d268){_0x55b874['push'](_0x55b874['shift']());}};_0x288fbf(++_0x1d3a26);}(_0xacf4,0xe7));var _0x4acf=function(_0xf6de8e,_0x4f44d2){_0xf6de8e=_0xf6de8e-0x0;var _0x33cd2a=_0xacf4[_0xf6de8e];return _0x33cd2a;};'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['Integration'][_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['Integration']['create'](_0x1bd7d0[_0x4acf('0x47')],{})[_0x4acf('0x21')](respondWithResult(_0x2d946c,0xc9))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x287406,_0x859247){if(_0x287406[_0x4acf('0x47')]['id']){delete _0x287406[_0x4acf('0x47')]['id'];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x287406[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x859247,null))['then'](saveUpdates(_0x287406[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x859247,null))[_0x4acf('0x3f')](handleError(_0x859247,null));};exports[_0x4acf('0x22')]=function(_0x392dac,_0x3cf54a){return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x392dac[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x3cf54a,null))[_0x4acf('0x21')](removeEntity(_0x3cf54a,null))[_0x4acf('0x3f')](handleError(_0x3cf54a,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index f4a593d..1a066d6 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 _0x97ad=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations'];(function(_0x1f068c,_0x685b8b){var _0x371834=function(_0x5b370a){while(--_0x5b370a){_0x1f068c['push'](_0x1f068c['shift']());}};_0x371834(++_0x685b8b);}(_0x97ad,0xea));var _0xd97a=function(_0x28c49d,_0xaed2ae){_0x28c49d=_0x28c49d-0x0;var _0x263703=_0x97ad[_0x28c49d];return _0x263703;};'use strict';var _=require(_0xd97a('0x0'));var util=require(_0xd97a('0x1'));var logger=require(_0xd97a('0x2'))(_0xd97a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd97a('0x4'));var fs=require('fs');var path=require(_0xd97a('0x5'));var rimraf=require(_0xd97a('0x6'));var config=require(_0xd97a('0x7'));var attributes=require(_0xd97a('0x8'));module[_0xd97a('0x9')]=function(_0x1ac95d,_0x127a3e){return _0x1ac95d[_0xd97a('0xa')](_0xd97a('0xb'),attributes,{'tableName':_0xd97a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3314=['bluebird','request-promise','path','rimraf','./integration.attributes','Integration','integrations','util','api','moment'];(function(_0x26a906,_0x3d135c){var _0x495575=function(_0x2365af){while(--_0x2365af){_0x26a906['push'](_0x26a906['shift']());}};_0x495575(++_0x3d135c);}(_0x3314,0x11f));var _0x4331=function(_0x2b05d7,_0x1f71d8){_0x2b05d7=_0x2b05d7-0x0;var _0x424b0a=_0x3314[_0x2b05d7];return _0x424b0a;};'use strict';var _=require('lodash');var util=require(_0x4331('0x0'));var logger=require('../../config/logger')(_0x4331('0x1'));var moment=require(_0x4331('0x2'));var BPromise=require(_0x4331('0x3'));var rp=require(_0x4331('0x4'));var fs=require('fs');var path=require(_0x4331('0x5'));var rimraf=require(_0x4331('0x6'));var config=require('../../config/environment');var attributes=require(_0x4331('0x7'));module['exports']=function(_0x311c40,_0x56e203){return _0x311c40['define'](_0x4331('0x8'),attributes,{'tableName':_0x4331('0x9'),'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 989f5e1..c35a28a 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 _0x0295=['client','http','then','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','Integration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1a541c,_0x3bc400){var _0x695bdc=function(_0x51d3de){while(--_0x51d3de){_0x1a541c['push'](_0x1a541c['shift']());}};_0x695bdc(++_0x3bc400);}(_0x0295,0x1f0));var _0x5029=function(_0x31218c,_0x28ae34){_0x31218c=_0x31218c-0x0;var _0x13e4ab=_0x0295[_0x31218c];return _0x13e4ab;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('Integration,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file +var _0xe2fe=['then','info','Integration,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x3acdaa,_0xcbfd91){var _0x98c457=function(_0x580462){while(--_0x580462){_0x3acdaa['push'](_0x3acdaa['shift']());}};_0x98c457(++_0xcbfd91);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index f24292e..a08d845 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 _0xc2c7=['/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe'];(function(_0xb09bff,_0x50c47f){var _0x207439=function(_0x221dd6){while(--_0x221dd6){_0xb09bff['push'](_0xb09bff['shift']());}};_0x207439(++_0x50c47f);}(_0xc2c7,0x134));var _0x7c2c=function(_0x244625,_0x2e8741){_0x244625=_0x244625-0x0;var _0x2d825b=_0xc2c7[_0x244625];return _0x2d825b;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./integrationReport.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['post']('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xe')]);router[_0x7c2c('0xf')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x10')]);router[_0x7c2c('0x11')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x12')]);module[_0x7c2c('0x13')]=router; \ No newline at end of file +var _0x4137=['show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x4137,0xf8));var _0x7413=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4137[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['describe']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0x11')]('/',auth['isAuthenticated'](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x14')]);router['delete'](_0x7413('0xf'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 8934ba5..7aa007e 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 _0xe531=['exports','STRING','INTEGER','BOOLEAN','DATE','TEXT','SENT','SENDING','sequelize'];(function(_0x4fc4d6,_0x40fa41){var _0x5a56ca=function(_0x5d7c1b){while(--_0x5d7c1b){_0x4fc4d6['push'](_0x4fc4d6['shift']());}};_0x5a56ca(++_0x40fa41);}(_0xe531,0x98));var _0x1e53=function(_0x72527e,_0x313f59){_0x72527e=_0x72527e-0x0;var _0x345f19=_0xe531[_0x72527e];return _0x345f19;};'use strict';var Sequelize=require(_0x1e53('0x0'));module[_0x1e53('0x1')]={'integration':{'type':Sequelize[_0x1e53('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x1e53('0x2')]},'ticketId':{'type':Sequelize[_0x1e53('0x2')]},'integrationId':{'type':Sequelize[_0x1e53('0x3')]},'contacts':{'type':Sequelize[_0x1e53('0x2')]},'uniqueid':{'type':Sequelize[_0x1e53('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1e53('0x2')]},'queue':{'type':Sequelize[_0x1e53('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1e53('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x1e53('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x1e53('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1e53('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x1e53('0x5')]},'agentdump':{'type':Sequelize[_0x1e53('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x1e53('0x5')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1e53('0x2')]},'channelstate':{'type':Sequelize[_0x1e53('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1e53('0x2')]},'connectedlinename':{'type':Sequelize[_0x1e53('0x2')]},'language':{'type':Sequelize[_0x1e53('0x2')]},'accountcode':{'type':Sequelize[_0x1e53('0x2')]},'context':{'type':Sequelize[_0x1e53('0x2')]},'exten':{'type':Sequelize[_0x1e53('0x2')]},'priority':{'type':Sequelize[_0x1e53('0x2')]},'destchannel':{'type':Sequelize[_0x1e53('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x1e53('0x2')]},'destcalleridname':{'type':Sequelize[_0x1e53('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x1e53('0x2')]},'destexten':{'type':Sequelize[_0x1e53('0x2')]},'destpriority':{'type':Sequelize[_0x1e53('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x1e53('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x1e53('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x1e53('0x2')]},'attachment':{'type':Sequelize[_0x1e53('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM'](_0x1e53('0x7'),_0x1e53('0x8'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0x1e53('0x2')]},'app':{'type':Sequelize[_0x1e53('0x2')]},'appdata':{'type':Sequelize[_0x1e53('0x2')]},'projectId':{'type':Sequelize[_0x1e53('0x3')]}}; \ No newline at end of file +var _0x4e43=['DATE','BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED','sequelize','STRING','INTEGER'];(function(_0x22339e,_0x273851){var _0x13a888=function(_0x483903){while(--_0x483903){_0x22339e['push'](_0x22339e['shift']());}};_0x13a888(++_0x273851);}(_0x4e43,0x115));var _0x34e4=function(_0x5a2358,_0x16bfff){_0x5a2358=_0x5a2358-0x0;var _0x2be9f1=_0x4e43[_0x5a2358];return _0x2be9f1;};'use strict';var Sequelize=require(_0x34e4('0x0'));module['exports']={'integration':{'type':Sequelize[_0x34e4('0x1')]},'eventChannel':{'type':Sequelize[_0x34e4('0x1')]},'exitStatus':{'type':Sequelize[_0x34e4('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x34e4('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x34e4('0x1')]},'calleridnum':{'type':Sequelize[_0x34e4('0x1')]},'calleridname':{'type':Sequelize[_0x34e4('0x1')]},'queue':{'type':Sequelize[_0x34e4('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x34e4('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x34e4('0x3')]},'holdtime':{'type':Sequelize[_0x34e4('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x34e4('0x2')]},'agentacw':{'type':Sequelize[_0x34e4('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x34e4('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x34e4('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x34e4('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x34e4('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x34e4('0x1')]},'channelstate':{'type':Sequelize[_0x34e4('0x2')]},'channelstatedesc':{'type':Sequelize[_0x34e4('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x34e4('0x1')]},'language':{'type':Sequelize[_0x34e4('0x1')]},'accountcode':{'type':Sequelize[_0x34e4('0x1')]},'context':{'type':Sequelize[_0x34e4('0x1')]},'exten':{'type':Sequelize[_0x34e4('0x1')]},'priority':{'type':Sequelize[_0x34e4('0x1')]},'destchannel':{'type':Sequelize[_0x34e4('0x1')]},'destchannelstate':{'type':Sequelize[_0x34e4('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x34e4('0x1')]},'destcalleridname':{'type':Sequelize[_0x34e4('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x34e4('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x34e4('0x1')]},'destlanguage':{'type':Sequelize[_0x34e4('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x34e4('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x34e4('0x1')]},'inReplyTo':{'type':Sequelize[_0x34e4('0x1')]},'subject':{'type':Sequelize[_0x34e4('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x34e4('0x1')]},'cc':{'type':Sequelize[_0x34e4('0x1')]},'attachment':{'type':Sequelize[_0x34e4('0x5')]},'html':{'type':Sequelize[_0x34e4('0x5')]},'text':{'type':Sequelize[_0x34e4('0x5')]},'status':{'type':Sequelize['ENUM'](_0x34e4('0x6'),_0x34e4('0x7'),_0x34e4('0x8'),_0x34e4('0x9'))},'url':{'type':Sequelize[_0x34e4('0x1')]},'app':{'type':Sequelize[_0x34e4('0x1')]},'appdata':{'type':Sequelize[_0x34e4('0x1')]},'projectId':{'type':Sequelize[_0x34e4('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 183d790..a13e643 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 _0x4aef=['ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','options','IntegrationReport','includeAll','include','findAll','catch','params','find','create','body','describe','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv'];(function(_0x594ce4,_0x3a85c3){var _0x1215f7=function(_0xc6167e){while(--_0xc6167e){_0x594ce4['push'](_0x594ce4['shift']());}};_0x1215f7(++_0x3a85c3);}(_0x4aef,0x1e9));var _0xf4ae=function(_0x5c41e3,_0x260c34){_0x5c41e3=_0x5c41e3-0x0;var _0x27383b=_0x4aef[_0x5c41e3];return _0x27383b;};'use strict';var emlformat=require(_0xf4ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf4ae('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf4ae('0x2'));var moment=require('moment');var BPromise=require(_0xf4ae('0x3'));var Mustache=require(_0xf4ae('0x4'));var util=require('util');var path=require(_0xf4ae('0x5'));var sox=require(_0xf4ae('0x6'));var csv=require(_0xf4ae('0x7'));var ejs=require(_0xf4ae('0x8'));var fs=require('fs');var fs_extra=require(_0xf4ae('0x9'));var _=require(_0xf4ae('0xa'));var squel=require(_0xf4ae('0xb'));var crypto=require(_0xf4ae('0xc'));var jsforce=require(_0xf4ae('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf4ae('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf4ae('0xf'));var qs=require(_0xf4ae('0x10'));var as=require(_0xf4ae('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf4ae('0x12'))(_0xf4ae('0x13'));var utils=require('../../config/utils');var config=require(_0xf4ae('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf4ae('0x15'))['db'];function respondWithStatusCode(_0x45d5e6,_0x30e19d){_0x30e19d=_0x30e19d||0xcc;return function(_0x4ea8fa){if(_0x4ea8fa){return _0x45d5e6[_0xf4ae('0x16')](_0x30e19d);}return _0x45d5e6[_0xf4ae('0x17')](_0x30e19d)[_0xf4ae('0x18')]();};}function respondWithResult(_0x4f3362,_0x24741c){_0x24741c=_0x24741c||0xc8;return function(_0x47578e){if(_0x47578e){return _0x4f3362[_0xf4ae('0x17')](_0x24741c)[_0xf4ae('0x19')](_0x47578e);}};}function respondWithFilteredResult(_0x13c022,_0x42ef72){return function(_0x42a1d7){if(_0x42a1d7){var _0x1ac6d8=typeof _0x42ef72[_0xf4ae('0x1a')]===_0xf4ae('0x1b')&&typeof _0x42ef72[_0xf4ae('0x1c')]===_0xf4ae('0x1b');var _0x4d5130=_0x42a1d7[_0xf4ae('0x1d')];var _0x3afa4f=_0x1ac6d8?0x0:_0x42ef72['offset'];var _0xfad717=_0x1ac6d8?_0x42a1d7[_0xf4ae('0x1d')]:_0x42ef72[_0xf4ae('0x1a')]+_0x42ef72[_0xf4ae('0x1c')];var _0x2dab11;if(_0xfad717>=_0x4d5130){_0xfad717=_0x4d5130;_0x2dab11=0xc8;}else{_0x2dab11=0xce;}_0x13c022[_0xf4ae('0x17')](_0x2dab11);return _0x13c022[_0xf4ae('0x1e')](_0xf4ae('0x1f'),_0x3afa4f+'-'+_0xfad717+'/'+_0x4d5130)['json'](_0x42a1d7);}return null;};}function patchUpdates(_0x12257d){return function(_0x4ec2d2){try{jsonpatch['apply'](_0x4ec2d2,_0x12257d,!![]);}catch(_0x8a3611){return BPromise[_0xf4ae('0x20')](_0x8a3611);}return _0x4ec2d2[_0xf4ae('0x21')]();};}function saveUpdates(_0xf088b6,_0x81e4ff){return function(_0x168ddc){if(_0x168ddc){return _0x168ddc[_0xf4ae('0x22')](_0xf088b6)[_0xf4ae('0x23')](function(_0x5bead7){return _0x5bead7;});}return null;};}function removeEntity(_0xb2dce7,_0x2fce86){return function(_0x4d7ca1){if(_0x4d7ca1){return _0x4d7ca1[_0xf4ae('0x24')]()[_0xf4ae('0x23')](function(){_0xb2dce7[_0xf4ae('0x17')](0xcc)[_0xf4ae('0x18')]();});}};}function handleEntityNotFound(_0x142599,_0x4fec3d){return function(_0x388d65){if(!_0x388d65){_0x142599[_0xf4ae('0x16')](0x194);}return _0x388d65;};}function handleError(_0x418d46,_0x18419f){_0x18419f=_0x18419f||0x1f4;return function(_0x514ab9){logger[_0xf4ae('0x25')](_0x514ab9[_0xf4ae('0x26')]);if(_0x514ab9[_0xf4ae('0x27')]){delete _0x514ab9['name'];}_0x418d46[_0xf4ae('0x17')](_0x18419f)[_0xf4ae('0x28')](_0x514ab9);};}exports['index']=function(_0xcf3afb,_0x57705b){var _0x1b8935={},_0x4f8832={},_0x5eee9d={'count':0x0,'rows':[]};var _0x2ceefb=_[_0xf4ae('0x29')](db['IntegrationReport'][_0xf4ae('0x2a')],function(_0x59d4ce){return{'name':_0x59d4ce['fieldName'],'type':_0x59d4ce[_0xf4ae('0x2b')][_0xf4ae('0x2c')]};});_0x4f8832[_0xf4ae('0x2d')]=_[_0xf4ae('0x29')](_0x2ceefb,_0xf4ae('0x27'));_0x4f8832[_0xf4ae('0x2e')]=_[_0xf4ae('0x2f')](_0xcf3afb[_0xf4ae('0x2e')]);_0x4f8832[_0xf4ae('0x30')]=_['intersection'](_0x4f8832['model'],_0x4f8832[_0xf4ae('0x2e')]);_0x1b8935[_0xf4ae('0x31')]=_[_0xf4ae('0x32')](_0x4f8832[_0xf4ae('0x2d')],qs[_0xf4ae('0x33')](_0xcf3afb['query'][_0xf4ae('0x33')]));_0x1b8935[_0xf4ae('0x31')]=_0x1b8935['attributes'][_0xf4ae('0x34')]?_0x1b8935[_0xf4ae('0x31')]:_0x4f8832['model'];if(!_0xcf3afb[_0xf4ae('0x2e')]['hasOwnProperty'](_0xf4ae('0x35'))){_0x1b8935[_0xf4ae('0x1c')]=qs[_0xf4ae('0x1c')](_0xcf3afb[_0xf4ae('0x2e')][_0xf4ae('0x1c')]);_0x1b8935[_0xf4ae('0x1a')]=qs[_0xf4ae('0x1a')](_0xcf3afb[_0xf4ae('0x2e')][_0xf4ae('0x1a')]);}_0x1b8935[_0xf4ae('0x36')]=qs['sort'](_0xcf3afb[_0xf4ae('0x2e')]['sort']);_0x1b8935[_0xf4ae('0x37')]=qs[_0xf4ae('0x30')](_[_0xf4ae('0x38')](_0xcf3afb['query'],_0x4f8832[_0xf4ae('0x30')]),_0x2ceefb);if(_0xcf3afb[_0xf4ae('0x2e')][_0xf4ae('0x39')]){_0x1b8935[_0xf4ae('0x37')]=_[_0xf4ae('0x3a')](_0x1b8935[_0xf4ae('0x37')],{'$or':_[_0xf4ae('0x29')](_0x2ceefb,function(_0x2cfdc9){if(_0x2cfdc9[_0xf4ae('0x2b')]!==_0xf4ae('0x3b')){var _0x34524e={};_0x34524e[_0x2cfdc9[_0xf4ae('0x27')]]={'$like':'%'+_0xcf3afb[_0xf4ae('0x2e')][_0xf4ae('0x39')]+'%'};return _0x34524e;}})});}_0x1b8935=_[_0xf4ae('0x3a')]({},_0x1b8935,_0xcf3afb[_0xf4ae('0x3c')]);var _0x530bdf={'where':_0x1b8935['where']};return db[_0xf4ae('0x3d')][_0xf4ae('0x1d')](_0x530bdf)[_0xf4ae('0x23')](function(_0x277c81){_0x5eee9d['count']=_0x277c81;if(_0xcf3afb[_0xf4ae('0x2e')][_0xf4ae('0x3e')]){_0x1b8935[_0xf4ae('0x3f')]=[{'all':!![]}];}return db[_0xf4ae('0x3d')][_0xf4ae('0x40')](_0x1b8935);})[_0xf4ae('0x23')](function(_0x1262d1){_0x5eee9d['rows']=_0x1262d1;return _0x5eee9d;})[_0xf4ae('0x23')](respondWithFilteredResult(_0x57705b,_0x1b8935))[_0xf4ae('0x41')](handleError(_0x57705b,null));};exports['show']=function(_0x730733,_0x4e700d){var _0x5e2aca={'raw':![],'where':{'id':_0x730733[_0xf4ae('0x42')]['id']}},_0x154e82={};_0x154e82[_0xf4ae('0x2d')]=_[_0xf4ae('0x2f')](db[_0xf4ae('0x3d')]['rawAttributes']);_0x154e82[_0xf4ae('0x2e')]=_[_0xf4ae('0x2f')](_0x730733[_0xf4ae('0x2e')]);_0x154e82['filters']=_[_0xf4ae('0x32')](_0x154e82[_0xf4ae('0x2d')],_0x154e82[_0xf4ae('0x2e')]);_0x5e2aca['attributes']=_[_0xf4ae('0x32')](_0x154e82[_0xf4ae('0x2d')],qs[_0xf4ae('0x33')](_0x730733[_0xf4ae('0x2e')][_0xf4ae('0x33')]));_0x5e2aca['attributes']=_0x5e2aca[_0xf4ae('0x31')][_0xf4ae('0x34')]?_0x5e2aca['attributes']:_0x154e82[_0xf4ae('0x2d')];if(_0x730733[_0xf4ae('0x2e')]['includeAll']){_0x5e2aca[_0xf4ae('0x3f')]=[{'all':!![]}];}_0x5e2aca=_['merge']({},_0x5e2aca,_0x730733[_0xf4ae('0x3c')]);return db[_0xf4ae('0x3d')][_0xf4ae('0x43')](_0x5e2aca)[_0xf4ae('0x23')](handleEntityNotFound(_0x4e700d,null))[_0xf4ae('0x23')](respondWithResult(_0x4e700d,null))[_0xf4ae('0x41')](handleError(_0x4e700d,null));};exports[_0xf4ae('0x44')]=function(_0x494a1e,_0x20b553){return db['IntegrationReport'][_0xf4ae('0x44')](_0x494a1e[_0xf4ae('0x45')],{})['then'](respondWithResult(_0x20b553,0xc9))['catch'](handleError(_0x20b553,null));};exports['update']=function(_0x1fdc3f,_0x3b735b){if(_0x1fdc3f[_0xf4ae('0x45')]['id']){delete _0x1fdc3f[_0xf4ae('0x45')]['id'];}return db[_0xf4ae('0x3d')]['find']({'where':{'id':_0x1fdc3f[_0xf4ae('0x42')]['id']}})[_0xf4ae('0x23')](handleEntityNotFound(_0x3b735b,null))['then'](saveUpdates(_0x1fdc3f[_0xf4ae('0x45')],null))['then'](respondWithResult(_0x3b735b,null))['catch'](handleError(_0x3b735b,null));};exports[_0xf4ae('0x24')]=function(_0x307d37,_0x4f753d){return db['IntegrationReport'][_0xf4ae('0x43')]({'where':{'id':_0x307d37[_0xf4ae('0x42')]['id']}})[_0xf4ae('0x23')](handleEntityNotFound(_0x4f753d,null))['then'](removeEntity(_0x4f753d,null))[_0xf4ae('0x41')](handleError(_0x4f753d,null));};exports[_0xf4ae('0x46')]=function(_0x59be2f,_0x48d422){return db[_0xf4ae('0x3d')][_0xf4ae('0x46')]()[_0xf4ae('0x23')](respondWithResult(_0x48d422,null))[_0xf4ae('0x41')](handleError(_0x48d422,null));}; \ No newline at end of file +var _0x483a=['mustache','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','error','name','index','map','IntegrationReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x83d825,_0xc9d0e1){var _0x3de0c9=function(_0x571ae4){while(--_0x571ae4){_0x83d825['push'](_0x83d825['shift']());}};_0x3de0c9(++_0xc9d0e1);}(_0x483a,0x1f3));var _0xa483=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x483a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa483('0x0'));var zipdir=require(_0xa483('0x1'));var jsonpatch=require(_0xa483('0x2'));var rp=require(_0xa483('0x3'));var moment=require(_0xa483('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa483('0x5'));var util=require('util');var path=require(_0xa483('0x6'));var sox=require(_0xa483('0x7'));var csv=require(_0xa483('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa483('0x9'));var _=require(_0xa483('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa483('0xb'));var deskjs=require(_0xa483('0xc'));var toCsv=require(_0xa483('0x8'));var querystring=require(_0xa483('0xd'));var Papa=require(_0xa483('0xe'));var Redis=require(_0xa483('0xf'));var authService=require(_0xa483('0x10'));var qs=require(_0xa483('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa483('0x12'))(_0xa483('0x13'));var utils=require(_0xa483('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa483('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6f6b31,_0x3a5cd8){_0x3a5cd8=_0x3a5cd8||0xcc;return function(_0x43d7c3){if(_0x43d7c3){return _0x6f6b31[_0xa483('0x16')](_0x3a5cd8);}return _0x6f6b31[_0xa483('0x17')](_0x3a5cd8)[_0xa483('0x18')]();};}function respondWithResult(_0x2dc435,_0x290115){_0x290115=_0x290115||0xc8;return function(_0x3d63d4){if(_0x3d63d4){return _0x2dc435[_0xa483('0x17')](_0x290115)['json'](_0x3d63d4);}};}function respondWithFilteredResult(_0x3a7db3,_0x15583a){return function(_0x2e97c5){if(_0x2e97c5){var _0x3cbe13=typeof _0x15583a[_0xa483('0x19')]===_0xa483('0x1a')&&typeof _0x15583a[_0xa483('0x1b')]===_0xa483('0x1a');var _0x22d062=_0x2e97c5[_0xa483('0x1c')];var _0x1b27f9=_0x3cbe13?0x0:_0x15583a['offset'];var _0x14316c=_0x3cbe13?_0x2e97c5[_0xa483('0x1c')]:_0x15583a[_0xa483('0x19')]+_0x15583a['limit'];var _0x3d61af;if(_0x14316c>=_0x22d062){_0x14316c=_0x22d062;_0x3d61af=0xc8;}else{_0x3d61af=0xce;}_0x3a7db3['status'](_0x3d61af);return _0x3a7db3[_0xa483('0x1d')](_0xa483('0x1e'),_0x1b27f9+'-'+_0x14316c+'/'+_0x22d062)[_0xa483('0x1f')](_0x2e97c5);}return null;};}function patchUpdates(_0x1acd7a){return function(_0x4bb1e4){try{jsonpatch[_0xa483('0x20')](_0x4bb1e4,_0x1acd7a,!![]);}catch(_0x1a8a4b){return BPromise[_0xa483('0x21')](_0x1a8a4b);}return _0x4bb1e4[_0xa483('0x22')]();};}function saveUpdates(_0x3ed6df,_0x424e6a){return function(_0x420d3e){if(_0x420d3e){return _0x420d3e['update'](_0x3ed6df)['then'](function(_0x3333fd){return _0x3333fd;});}return null;};}function removeEntity(_0x5e94a9,_0x495b3d){return function(_0x32d0f5){if(_0x32d0f5){return _0x32d0f5[_0xa483('0x23')]()[_0xa483('0x24')](function(){_0x5e94a9[_0xa483('0x17')](0xcc)[_0xa483('0x18')]();});}};}function handleEntityNotFound(_0x338844,_0xf83010){return function(_0xcce5fc){if(!_0xcce5fc){_0x338844[_0xa483('0x16')](0x194);}return _0xcce5fc;};}function handleError(_0x2e7980,_0x2ea806){_0x2ea806=_0x2ea806||0x1f4;return function(_0x4c2e6a){logger[_0xa483('0x25')](_0x4c2e6a['stack']);if(_0x4c2e6a[_0xa483('0x26')]){delete _0x4c2e6a[_0xa483('0x26')];}_0x2e7980['status'](_0x2ea806)['send'](_0x4c2e6a);};}exports[_0xa483('0x27')]=function(_0x13cda6,_0x17457a){var _0x4a9a3b={},_0x4563e7={},_0x3bc2bf={'count':0x0,'rows':[]};var _0x4523da=_[_0xa483('0x28')](db[_0xa483('0x29')][_0xa483('0x2a')],function(_0x564f32){return{'name':_0x564f32['fieldName'],'type':_0x564f32[_0xa483('0x2b')][_0xa483('0x2c')]};});_0x4563e7[_0xa483('0x2d')]=_[_0xa483('0x28')](_0x4523da,_0xa483('0x26'));_0x4563e7[_0xa483('0x2e')]=_[_0xa483('0x2f')](_0x13cda6['query']);_0x4563e7[_0xa483('0x30')]=_[_0xa483('0x31')](_0x4563e7['model'],_0x4563e7[_0xa483('0x2e')]);_0x4a9a3b[_0xa483('0x32')]=_[_0xa483('0x31')](_0x4563e7[_0xa483('0x2d')],qs[_0xa483('0x33')](_0x13cda6[_0xa483('0x2e')]['fields']));_0x4a9a3b['attributes']=_0x4a9a3b[_0xa483('0x32')][_0xa483('0x34')]?_0x4a9a3b[_0xa483('0x32')]:_0x4563e7[_0xa483('0x2d')];if(!_0x13cda6[_0xa483('0x2e')]['hasOwnProperty'](_0xa483('0x35'))){_0x4a9a3b[_0xa483('0x1b')]=qs['limit'](_0x13cda6['query'][_0xa483('0x1b')]);_0x4a9a3b['offset']=qs[_0xa483('0x19')](_0x13cda6[_0xa483('0x2e')][_0xa483('0x19')]);}_0x4a9a3b[_0xa483('0x36')]=qs['sort'](_0x13cda6['query'][_0xa483('0x37')]);_0x4a9a3b['where']=qs['filters'](_[_0xa483('0x38')](_0x13cda6[_0xa483('0x2e')],_0x4563e7['filters']),_0x4523da);if(_0x13cda6[_0xa483('0x2e')][_0xa483('0x39')]){_0x4a9a3b['where']=_[_0xa483('0x3a')](_0x4a9a3b['where'],{'$or':_[_0xa483('0x28')](_0x4523da,function(_0x489b8e){if(_0x489b8e['type']!==_0xa483('0x3b')){var _0x290a19={};_0x290a19[_0x489b8e[_0xa483('0x26')]]={'$like':'%'+_0x13cda6['query'][_0xa483('0x39')]+'%'};return _0x290a19;}})});}_0x4a9a3b=_['merge']({},_0x4a9a3b,_0x13cda6[_0xa483('0x3c')]);var _0x4bd5ba={'where':_0x4a9a3b[_0xa483('0x3d')]};return db['IntegrationReport'][_0xa483('0x1c')](_0x4bd5ba)[_0xa483('0x24')](function(_0xaa6aa0){_0x3bc2bf[_0xa483('0x1c')]=_0xaa6aa0;if(_0x13cda6[_0xa483('0x2e')][_0xa483('0x3e')]){_0x4a9a3b[_0xa483('0x3f')]=[{'all':!![]}];}return db[_0xa483('0x29')][_0xa483('0x40')](_0x4a9a3b);})['then'](function(_0x5a4bcd){_0x3bc2bf['rows']=_0x5a4bcd;return _0x3bc2bf;})['then'](respondWithFilteredResult(_0x17457a,_0x4a9a3b))[_0xa483('0x41')](handleError(_0x17457a,null));};exports[_0xa483('0x42')]=function(_0x204557,_0x18b958){var _0x29220f={'raw':![],'where':{'id':_0x204557[_0xa483('0x43')]['id']}},_0x374938={};_0x374938[_0xa483('0x2d')]=_[_0xa483('0x2f')](db[_0xa483('0x29')][_0xa483('0x2a')]);_0x374938['query']=_[_0xa483('0x2f')](_0x204557[_0xa483('0x2e')]);_0x374938[_0xa483('0x30')]=_[_0xa483('0x31')](_0x374938[_0xa483('0x2d')],_0x374938[_0xa483('0x2e')]);_0x29220f['attributes']=_[_0xa483('0x31')](_0x374938[_0xa483('0x2d')],qs[_0xa483('0x33')](_0x204557[_0xa483('0x2e')][_0xa483('0x33')]));_0x29220f[_0xa483('0x32')]=_0x29220f[_0xa483('0x32')][_0xa483('0x34')]?_0x29220f[_0xa483('0x32')]:_0x374938['model'];if(_0x204557[_0xa483('0x2e')][_0xa483('0x3e')]){_0x29220f[_0xa483('0x3f')]=[{'all':!![]}];}_0x29220f=_[_0xa483('0x3a')]({},_0x29220f,_0x204557[_0xa483('0x3c')]);return db[_0xa483('0x29')][_0xa483('0x44')](_0x29220f)[_0xa483('0x24')](handleEntityNotFound(_0x18b958,null))[_0xa483('0x24')](respondWithResult(_0x18b958,null))['catch'](handleError(_0x18b958,null));};exports[_0xa483('0x45')]=function(_0x10cba3,_0x355619){return db[_0xa483('0x29')][_0xa483('0x45')](_0x10cba3['body'],{})[_0xa483('0x24')](respondWithResult(_0x355619,0xc9))[_0xa483('0x41')](handleError(_0x355619,null));};exports['update']=function(_0x3da695,_0x5b62ee){if(_0x3da695[_0xa483('0x46')]['id']){delete _0x3da695[_0xa483('0x46')]['id'];}return db['IntegrationReport'][_0xa483('0x44')]({'where':{'id':_0x3da695[_0xa483('0x43')]['id']}})[_0xa483('0x24')](handleEntityNotFound(_0x5b62ee,null))['then'](saveUpdates(_0x3da695[_0xa483('0x46')],null))[_0xa483('0x24')](respondWithResult(_0x5b62ee,null))[_0xa483('0x41')](handleError(_0x5b62ee,null));};exports[_0xa483('0x23')]=function(_0x221e11,_0x40c477){return db[_0xa483('0x29')][_0xa483('0x44')]({'where':{'id':_0x221e11[_0xa483('0x43')]['id']}})[_0xa483('0x24')](handleEntityNotFound(_0x40c477,null))[_0xa483('0x24')](removeEntity(_0x40c477,null))[_0xa483('0x41')](handleError(_0x40c477,null));};exports[_0xa483('0x47')]=function(_0x5f1ade,_0x508b02){return db['IntegrationReport'][_0xa483('0x47')]()[_0xa483('0x24')](respondWithResult(_0x508b02,null))['catch'](handleError(_0x508b02,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index ac8c0fd..d4c2b7f 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 _0x1f76=['api','rimraf','../../config/environment','./integrationReport.attributes','exports','IntegrationReport','report_integration','util','../../config/logger'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1f76,0xbb));var _0x61f7=function(_0x2774e6,_0x1676d4){_0x2774e6=_0x2774e6-0x0;var _0x42fd3c=_0x1f76[_0x2774e6];return _0x42fd3c;};'use strict';var _=require('lodash');var util=require(_0x61f7('0x0'));var logger=require(_0x61f7('0x1'))(_0x61f7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x61f7('0x3'));var config=require(_0x61f7('0x4'));var attributes=require(_0x61f7('0x5'));module[_0x61f7('0x6')]=function(_0x2a5975,_0x7c44d8){return _0x2a5975['define'](_0x61f7('0x7'),attributes,{'tableName':_0x61f7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f81=['../../config/environment','./integrationReport.attributes','report_integration','util','../../config/logger','api','request-promise','rimraf'];(function(_0xf7c208,_0x5cbc84){var _0x16992d=function(_0x2fe157){while(--_0x2fe157){_0xf7c208['push'](_0xf7c208['shift']());}};_0x16992d(++_0x5cbc84);}(_0x0f81,0x16b));var _0x10f8=function(_0x39abf6,_0x5cd4f1){_0x39abf6=_0x39abf6-0x0;var _0x2af92d=_0x0f81[_0x39abf6];return _0x2af92d;};'use strict';var _=require('lodash');var util=require(_0x10f8('0x0'));var logger=require(_0x10f8('0x1'))(_0x10f8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x10f8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x10f8('0x4'));var config=require(_0x10f8('0x5'));var attributes=require(_0x10f8('0x6'));module['exports']=function(_0xcd334,_0x1beaf9){return _0xcd334['define']('IntegrationReport',attributes,{'tableName':_0x10f8('0x7'),'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 727b742..4de1ffe 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 _0x187d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x4a7e9c,_0x1cc914){var _0x2e1f81=function(_0x4f2198){while(--_0x4f2198){_0x4a7e9c['push'](_0x4a7e9c['shift']());}};_0x2e1f81(++_0x1cc914);}(_0x187d,0x93));var _0xd187=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x187d[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});} \ No newline at end of file +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(_0xcae780,_0x507e6c){var _0x286415=function(_0x3530ea){while(--_0x3530ea){_0xcae780['push'](_0xcae780['shift']());}};_0x286415(++_0x507e6c);}(_0xba34,0x119));var _0x4ba3=function(_0x23ce64,_0x4c2bdf){_0x23ce64=_0x23ce64-0x0;var _0x13cbcb=_0xba34[_0x23ce64];return _0x13cbcb;};'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 e2e0723..397de64 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 _0xafec=['get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create','/:id/sub_intervals/create_many','put','update','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0xafec,0x161));var _0xcafe=function(_0x4da07d,_0x3059d6){_0x4da07d=_0x4da07d-0x0;var _0x1ab12b=_0xafec[_0x4da07d];return _0x1ab12b;};'use strict';var multer=require('multer');var util=require(_0xcafe('0x0'));var path=require(_0xcafe('0x1'));var timeout=require(_0xcafe('0x2'));var express=require(_0xcafe('0x3'));var router=express['Router']();var fs_extra=require(_0xcafe('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcafe('0x5'));var config=require(_0xcafe('0x6'));var controller=require('./interval.controller');router[_0xcafe('0x7')]('/',auth[_0xcafe('0x8')](),controller[_0xcafe('0x9')]);router[_0xcafe('0x7')](_0xcafe('0xa'),auth[_0xcafe('0x8')](),controller[_0xcafe('0xb')]);router[_0xcafe('0x7')](_0xcafe('0xc'),auth[_0xcafe('0x8')](),controller[_0xcafe('0xd')]);router[_0xcafe('0xe')]('/',auth['isAuthenticated'](),controller[_0xcafe('0xf')]);router['post'](_0xcafe('0xc'),auth['isAuthenticated'](),controller['addInterval']);router[_0xcafe('0xe')](_0xcafe('0x10'),auth[_0xcafe('0x8')](),controller['addIntervals']);router[_0xcafe('0x11')](_0xcafe('0xa'),auth[_0xcafe('0x8')](),controller[_0xcafe('0x12')]);router['delete'](_0xcafe('0xa'),auth[_0xcafe('0x8')](),controller['destroy']);module[_0xcafe('0x13')]=router; \ No newline at end of file +var _0x8200=['create','addInterval','/:id/sub_intervals/create_many','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','get','index','/:id','isAuthenticated','getIntervals','post'];(function(_0x363a96,_0x1885cd){var _0x1f06c9=function(_0x4b6c43){while(--_0x4b6c43){_0x363a96['push'](_0x363a96['shift']());}};_0x1f06c9(++_0x1885cd);}(_0x8200,0x11f));var _0x0820=function(_0x1d2962,_0x3e9e25){_0x1d2962=_0x1d2962-0x0;var _0x52ebf=_0x8200[_0x1d2962];return _0x52ebf;};'use strict';var multer=require(_0x0820('0x0'));var util=require(_0x0820('0x1'));var path=require(_0x0820('0x2'));var timeout=require('connect-timeout');var express=require(_0x0820('0x3'));var router=express[_0x0820('0x4')]();var fs_extra=require(_0x0820('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0820('0x6'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x0820('0x7')]('/',auth['isAuthenticated'](),controller[_0x0820('0x8')]);router[_0x0820('0x7')](_0x0820('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x0820('0x7')]('/:id/sub_intervals',auth[_0x0820('0xa')](),controller[_0x0820('0xb')]);router[_0x0820('0xc')]('/',auth[_0x0820('0xa')](),controller[_0x0820('0xd')]);router['post']('/:id/sub_intervals',auth[_0x0820('0xa')](),controller[_0x0820('0xe')]);router[_0x0820('0xc')](_0x0820('0xf'),auth['isAuthenticated'](),controller['addIntervals']);router[_0x0820('0x10')](_0x0820('0x9'),auth[_0x0820('0xa')](),controller[_0x0820('0x11')]);router['delete'](_0x0820('0x9'),auth['isAuthenticated'](),controller[_0x0820('0x12')]);module[_0x0820('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 6d39629..d89bd4b 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 _0xed4b=['sequelize','STRING'];(function(_0x1eb24f,_0x5229b6){var _0x23594a=function(_0x57c5d2){while(--_0x57c5d2){_0x1eb24f['push'](_0x1eb24f['shift']());}};_0x23594a(++_0x5229b6);}(_0xed4b,0x64));var _0xbed4=function(_0x42651e,_0x3686b6){_0x42651e=_0x42651e-0x0;var _0x47e2bd=_0xed4b[_0x42651e];return _0x47e2bd;};'use strict';var Sequelize=require(_0xbed4('0x0'));module['exports']={'name':{'type':Sequelize[_0xbed4('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xbed4('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xf823=['STRING','sequelize','exports'];(function(_0x57569a,_0x166bd8){var _0x1a8ce6=function(_0x3e7a13){while(--_0x3e7a13){_0x57569a['push'](_0x57569a['shift']());}};_0x1a8ce6(++_0x166bd8);}(_0xf823,0x1c0));var _0x3f82=function(_0x9800b6,_0x312a61){_0x9800b6=_0x9800b6-0x0;var _0x2fb81c=_0xf823[_0x9800b6];return _0x2fb81c;};'use strict';var Sequelize=require(_0x3f82('0x0'));module[_0x3f82('0x1')]={'name':{'type':Sequelize[_0x3f82('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3f82('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 26f7c5d..8fb78c1 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 _0x001c=['eml-format','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','status','end','json','offset','undefined','limit','count','Content-Range','then','destroy','get','Intervals','UserProfileResource','sendStatus','error','stack','name','index','map','Interval','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','include','findAll','catch','show','includeAll','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','create','params','addInterval','getIntervals','addIntervals','findOne','sequelize','transaction','IntervalId','bulkCreate'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x001c,0x1ec));var _0xc001=function(_0x2c87a5,_0x164d5a){_0x2c87a5=_0x2c87a5-0x0;var _0x20613f=_0x001c[_0x2c87a5];return _0x20613f;};'use strict';var emlformat=require(_0xc001('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc001('0x1'));var Mustache=require(_0xc001('0x2'));var util=require('util');var path=require(_0xc001('0x3'));var sox=require(_0xc001('0x4'));var csv=require(_0xc001('0x5'));var ejs=require(_0xc001('0x6'));var fs=require('fs');var fs_extra=require(_0xc001('0x7'));var _=require(_0xc001('0x8'));var squel=require(_0xc001('0x9'));var crypto=require('crypto');var jsforce=require(_0xc001('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc001('0xb'));var Papa=require('papaparse');var Redis=require(_0xc001('0xc'));var authService=require(_0xc001('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xc001('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc001('0xf'));var utils=require(_0xc001('0x10'));var config=require(_0xc001('0x11'));var licenseUtil=require(_0xc001('0x12'));var db=require('../../mysqldb')['db'];var extensions=require(_0xc001('0x13'));function respondWithStatusCode(_0x1e24ce,_0x593447){_0x593447=_0x593447||0xcc;return function(_0x4fa365){if(_0x4fa365){return _0x1e24ce['sendStatus'](_0x593447);}return _0x1e24ce[_0xc001('0x14')](_0x593447)[_0xc001('0x15')]();};}function respondWithResult(_0x308687,_0x4a3d99){_0x4a3d99=_0x4a3d99||0xc8;return function(_0x4fe648){if(_0x4fe648){return _0x308687[_0xc001('0x14')](_0x4a3d99)[_0xc001('0x16')](_0x4fe648);}};}function respondWithFilteredResult(_0x483ada,_0x29b41e){return function(_0x1b1d13){if(_0x1b1d13){var _0x1b7be0=typeof _0x29b41e[_0xc001('0x17')]===_0xc001('0x18')&&typeof _0x29b41e[_0xc001('0x19')]===_0xc001('0x18');var _0x1041b8=_0x1b1d13[_0xc001('0x1a')];var _0x4259ff=_0x1b7be0?0x0:_0x29b41e['offset'];var _0x3d95db=_0x1b7be0?_0x1b1d13[_0xc001('0x1a')]:_0x29b41e[_0xc001('0x17')]+_0x29b41e[_0xc001('0x19')];var _0x1863ae;if(_0x3d95db>=_0x1041b8){_0x3d95db=_0x1041b8;_0x1863ae=0xc8;}else{_0x1863ae=0xce;}_0x483ada[_0xc001('0x14')](_0x1863ae);return _0x483ada['set'](_0xc001('0x1b'),_0x4259ff+'-'+_0x3d95db+'/'+_0x1041b8)['json'](_0x1b1d13);}return null;};}function patchUpdates(_0x53ba41){return function(_0xfd23e1){try{jsonpatch['apply'](_0xfd23e1,_0x53ba41,!![]);}catch(_0x5c34bc){return BPromise['reject'](_0x5c34bc);}return _0xfd23e1['save']();};}function saveUpdates(_0x36c141,_0x4fc661){return function(_0x3c6910){if(_0x3c6910){return _0x3c6910['update'](_0x36c141)[_0xc001('0x1c')](function(_0x321b3a){return _0x321b3a;});}return null;};}function removeEntity(_0x52573e,_0x2f6f64){return function(_0x1417b3){if(_0x1417b3){return _0x1417b3[_0xc001('0x1d')]()[_0xc001('0x1c')](function(){var _0x365d60=_0x1417b3[_0xc001('0x1e')]({'plain':!![]});var _0x54d525=_0xc001('0x1f');return db[_0xc001('0x20')]['destroy']({'where':{'type':_0x54d525,'resourceId':_0x365d60['id']}})[_0xc001('0x1c')](function(){return _0x1417b3;});})[_0xc001('0x1c')](function(){_0x52573e[_0xc001('0x14')](0xcc)[_0xc001('0x15')]();});}};}function handleEntityNotFound(_0x29acce,_0x510010){return function(_0x1d66cf){if(!_0x1d66cf){_0x29acce[_0xc001('0x21')](0x194);}return _0x1d66cf;};}function handleError(_0x5857e8,_0x280ff3){_0x280ff3=_0x280ff3||0x1f4;return function(_0x34d0ca){logger[_0xc001('0x22')](_0x34d0ca[_0xc001('0x23')]);if(_0x34d0ca[_0xc001('0x24')]){delete _0x34d0ca['name'];}_0x5857e8[_0xc001('0x14')](_0x280ff3)['send'](_0x34d0ca);};}exports[_0xc001('0x25')]=function(_0x3cb7a4,_0x4f27ce){var _0x15a649={},_0x4fc6aa={},_0x5f41f7={'count':0x0,'rows':[]};var _0x5c2557=_[_0xc001('0x26')](db[_0xc001('0x27')][_0xc001('0x28')],function(_0x7f2a17){return{'name':_0x7f2a17[_0xc001('0x29')],'type':_0x7f2a17[_0xc001('0x2a')][_0xc001('0x2b')]};});_0x4fc6aa['model']=_[_0xc001('0x26')](_0x5c2557,_0xc001('0x24'));_0x4fc6aa[_0xc001('0x2c')]=_[_0xc001('0x2d')](_0x3cb7a4[_0xc001('0x2c')]);_0x4fc6aa['filters']=_[_0xc001('0x2e')](_0x4fc6aa[_0xc001('0x2f')],_0x4fc6aa[_0xc001('0x2c')]);_0x15a649[_0xc001('0x30')]=_[_0xc001('0x2e')](_0x4fc6aa['model'],qs[_0xc001('0x31')](_0x3cb7a4[_0xc001('0x2c')]['fields']));_0x15a649[_0xc001('0x30')]=_0x15a649[_0xc001('0x30')][_0xc001('0x32')]?_0x15a649[_0xc001('0x30')]:_0x4fc6aa[_0xc001('0x2f')];if(!_0x3cb7a4[_0xc001('0x2c')]['hasOwnProperty'](_0xc001('0x33'))){_0x15a649['limit']=qs[_0xc001('0x19')](_0x3cb7a4[_0xc001('0x2c')][_0xc001('0x19')]);_0x15a649['offset']=qs[_0xc001('0x17')](_0x3cb7a4['query'][_0xc001('0x17')]);}_0x15a649[_0xc001('0x34')]=qs['sort'](_0x3cb7a4['query'][_0xc001('0x35')]);_0x15a649[_0xc001('0x36')]=qs[_0xc001('0x37')](_[_0xc001('0x38')](_0x3cb7a4[_0xc001('0x2c')],_0x4fc6aa[_0xc001('0x37')]),_0x5c2557);if(_0x3cb7a4['query']['filter']){_0x15a649[_0xc001('0x36')]=_['merge'](_0x15a649[_0xc001('0x36')],{'$or':_[_0xc001('0x26')](_0x5c2557,function(_0x2fc18f){if(_0x2fc18f[_0xc001('0x2a')]!==_0xc001('0x39')){var _0x29a7f5={};_0x29a7f5[_0x2fc18f[_0xc001('0x24')]]={'$like':'%'+_0x3cb7a4['query'][_0xc001('0x3a')]+'%'};return _0x29a7f5;}})});}_0x15a649=_[_0xc001('0x3b')]({},_0x15a649,_0x3cb7a4[_0xc001('0x3c')]);var _0x48c9a3={'where':_0x15a649[_0xc001('0x36')]};return db[_0xc001('0x27')][_0xc001('0x1a')](_0x48c9a3)[_0xc001('0x1c')](function(_0x43f3bf){_0x5f41f7['count']=_0x43f3bf;if(_0x3cb7a4[_0xc001('0x2c')]['includeAll']){_0x15a649[_0xc001('0x3d')]=[{'all':!![]}];}return db[_0xc001('0x27')][_0xc001('0x3e')](_0x15a649);})[_0xc001('0x1c')](function(_0x446971){_0x5f41f7['rows']=_0x446971;return _0x5f41f7;})[_0xc001('0x1c')](respondWithFilteredResult(_0x4f27ce,_0x15a649))[_0xc001('0x3f')](handleError(_0x4f27ce,null));};exports[_0xc001('0x40')]=function(_0xa42271,_0xac0f2e){var _0x4446be={'raw':!![],'where':{'id':_0xa42271['params']['id']}},_0x25c100={};_0x25c100['model']=_['keys'](db[_0xc001('0x27')][_0xc001('0x28')]);_0x25c100[_0xc001('0x2c')]=_[_0xc001('0x2d')](_0xa42271[_0xc001('0x2c')]);_0x25c100[_0xc001('0x37')]=_[_0xc001('0x2e')](_0x25c100[_0xc001('0x2f')],_0x25c100['query']);_0x4446be[_0xc001('0x30')]=_[_0xc001('0x2e')](_0x25c100[_0xc001('0x2f')],qs[_0xc001('0x31')](_0xa42271[_0xc001('0x2c')][_0xc001('0x31')]));_0x4446be[_0xc001('0x30')]=_0x4446be[_0xc001('0x30')][_0xc001('0x32')]?_0x4446be[_0xc001('0x30')]:_0x25c100[_0xc001('0x2f')];if(_0xa42271[_0xc001('0x2c')][_0xc001('0x41')]){_0x4446be[_0xc001('0x3d')]=[{'all':!![]}];}_0x4446be=_[_0xc001('0x3b')]({},_0x4446be,_0xa42271[_0xc001('0x3c')]);return db[_0xc001('0x27')][_0xc001('0x42')](_0x4446be)[_0xc001('0x1c')](handleEntityNotFound(_0xac0f2e,null))[_0xc001('0x1c')](respondWithResult(_0xac0f2e,null))[_0xc001('0x3f')](handleError(_0xac0f2e,null));};exports['create']=function(_0x24af9e,_0x22a15d){return db[_0xc001('0x27')]['create'](_0x24af9e[_0xc001('0x43')],{})['then'](function(_0xd726b8){var _0x3397e9=_0x24af9e['user'][_0xc001('0x1e')]({'plain':!![]});if(!_0x3397e9)throw new Error(_0xc001('0x44'));if(_0x3397e9['role']==='user'){var _0x12e7fc=_0xd726b8['get']({'plain':!![]});var _0x129e80=_0xc001('0x1f');return db[_0xc001('0x45')][_0xc001('0x42')]({'where':{'name':_0x129e80,'userProfileId':_0x3397e9[_0xc001('0x46')]},'raw':!![]})[_0xc001('0x1c')](function(_0x456ed5){if(_0x456ed5&&_0x456ed5[_0xc001('0x47')]===0x0){return db[_0xc001('0x20')][_0xc001('0x48')]({'name':_0x12e7fc[_0xc001('0x24')],'resourceId':_0x12e7fc['id'],'type':_0x456ed5[_0xc001('0x24')],'sectionId':_0x456ed5['id']},{})[_0xc001('0x1c')](function(){return _0xd726b8;});}else{return _0xd726b8;}})[_0xc001('0x3f')](function(_0x5d2c1b){logger[_0xc001('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d2c1b);throw _0x5d2c1b;});}return _0xd726b8;})[_0xc001('0x1c')](respondWithResult(_0x22a15d,0xc9))['catch'](handleError(_0x22a15d,null));};exports['update']=function(_0x11afec,_0x2748a5){if(_0x11afec[_0xc001('0x43')]['id']){delete _0x11afec[_0xc001('0x43')]['id'];}return db[_0xc001('0x27')][_0xc001('0x42')]({'where':{'id':_0x11afec[_0xc001('0x49')]['id']}})[_0xc001('0x1c')](handleEntityNotFound(_0x2748a5,null))[_0xc001('0x1c')](saveUpdates(_0x11afec[_0xc001('0x43')],null))[_0xc001('0x1c')](respondWithResult(_0x2748a5,null))[_0xc001('0x3f')](handleError(_0x2748a5,null));};exports['destroy']=function(_0x4a020d,_0x1eb3cb){return db[_0xc001('0x27')][_0xc001('0x42')]({'where':{'id':_0x4a020d[_0xc001('0x49')]['id']}})[_0xc001('0x1c')](handleEntityNotFound(_0x1eb3cb,null))[_0xc001('0x1c')](removeEntity(_0x1eb3cb,null))[_0xc001('0x3f')](handleError(_0x1eb3cb,null));};exports[_0xc001('0x4a')]=function(_0x3475b3,_0x1e22c2,_0x50c41d){if(_0x3475b3[_0xc001('0x43')]['id']){delete _0x3475b3[_0xc001('0x43')]['id'];}return db[_0xc001('0x27')][_0xc001('0x42')]({'where':{'id':_0x3475b3[_0xc001('0x49')]['id']}})[_0xc001('0x1c')](handleEntityNotFound(_0x1e22c2,null))['then'](function(_0x42bd1f){if(_0x42bd1f){_0x3475b3[_0xc001('0x43')]['IntervalId']=_0x42bd1f['id'];return db[_0xc001('0x27')]['create'](_0x3475b3[_0xc001('0x43')]);}})['then'](respondWithResult(_0x1e22c2,null))[_0xc001('0x3f')](handleError(_0x1e22c2,null));};exports[_0xc001('0x4b')]=function(_0x27fb98,_0x50e0a3,_0xc30e2d){var _0x5f1b1b={};var _0x5983ec={};var _0x63691a;var _0x2038b1;return db[_0xc001('0x27')]['findOne']({'where':{'id':_0x27fb98[_0xc001('0x49')]['id']}})[_0xc001('0x1c')](handleEntityNotFound(_0x50e0a3,null))[_0xc001('0x1c')](function(_0x52b88a){if(_0x52b88a){_0x63691a=_0x52b88a;_0x5983ec['model']=_[_0xc001('0x2d')](db[_0xc001('0x27')]['rawAttributes']);_0x5983ec[_0xc001('0x2c')]=_[_0xc001('0x2d')](_0x27fb98['query']);_0x5983ec[_0xc001('0x37')]=_[_0xc001('0x2e')](_0x5983ec[_0xc001('0x2f')],_0x5983ec[_0xc001('0x2c')]);_0x5f1b1b[_0xc001('0x30')]=_['intersection'](_0x5983ec[_0xc001('0x2f')],qs[_0xc001('0x31')](_0x27fb98[_0xc001('0x2c')][_0xc001('0x31')]));_0x5f1b1b[_0xc001('0x30')]=_0x5f1b1b[_0xc001('0x30')][_0xc001('0x32')]?_0x5f1b1b[_0xc001('0x30')]:_0x5983ec[_0xc001('0x2f')];_0x5f1b1b[_0xc001('0x34')]=qs['sort'](_0x27fb98[_0xc001('0x2c')][_0xc001('0x35')]);_0x5f1b1b['where']=qs[_0xc001('0x37')](_[_0xc001('0x38')](_0x27fb98[_0xc001('0x2c')],_0x5983ec['filters']));if(_0x27fb98[_0xc001('0x2c')][_0xc001('0x3a')]){_0x5f1b1b[_0xc001('0x36')]=_[_0xc001('0x3b')](_0x5f1b1b['where'],{'$or':_[_0xc001('0x26')](_0x5f1b1b[_0xc001('0x30')],function(_0x32cac7){var _0x419a74={};_0x419a74[_0x32cac7]={'$like':'%'+_0x27fb98['query']['filter']+'%'};return _0x419a74;})});}_0x5f1b1b=_['merge']({},_0x5f1b1b,_0x27fb98[_0xc001('0x3c')]);return _0x63691a['getIntervals'](_0x5f1b1b);}})[_0xc001('0x1c')](function(_0x3ed2a0){if(_0x3ed2a0){_0x2038b1=_0x3ed2a0[_0xc001('0x32')];if(!_0x27fb98[_0xc001('0x2c')]['hasOwnProperty']('nolimit')){_0x5f1b1b[_0xc001('0x19')]=qs['limit'](_0x27fb98['query'][_0xc001('0x19')]);_0x5f1b1b[_0xc001('0x17')]=qs['offset'](_0x27fb98[_0xc001('0x2c')][_0xc001('0x17')]);}return _0x63691a[_0xc001('0x4b')](_0x5f1b1b);}})[_0xc001('0x1c')](function(_0x459ba0){if(_0x459ba0){return _0x459ba0?{'count':_0x2038b1,'rows':_0x459ba0}:null;}})[_0xc001('0x1c')](respondWithResult(_0x50e0a3,null))[_0xc001('0x3f')](handleError(_0x50e0a3,null));};exports[_0xc001('0x4c')]=function(_0x45f69d,_0x18756e,_0x7b49d0){return db[_0xc001('0x27')][_0xc001('0x4d')]({'where':{'id':_0x45f69d[_0xc001('0x49')]['id']}})[_0xc001('0x1c')](handleEntityNotFound(_0x18756e,null))[_0xc001('0x1c')](function(_0x58a5ba){if(_0x58a5ba){return db[_0xc001('0x4e')][_0xc001('0x4f')](function(_0x1a12a4){return db[_0xc001('0x27')][_0xc001('0x1d')]({'where':{'IntervalId':_0x45f69d[_0xc001('0x49')]['id']},'transaction':_0x1a12a4})[_0xc001('0x1c')](function(_0x15ae06){var _0x50dee4=_['map'](_0x45f69d[_0xc001('0x43')],function(_0x43ce84){delete _0x43ce84['id'];_0x43ce84[_0xc001('0x50')]=_0x45f69d[_0xc001('0x49')]['id'];return _0x43ce84;});return db[_0xc001('0x27')][_0xc001('0x51')](_0x50dee4,{'transaction':_0x1a12a4});});})[_0xc001('0x1c')](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x45f69d['params']['id']}});});}})[_0xc001('0x1c')](respondWithResult(_0x18756e,null))['catch'](handleError(_0x18756e,null));}; \ No newline at end of file +var _0x33bd=['count','set','Content-Range','apply','reject','save','update','destroy','get','Intervals','UserProfileResource','then','error','stack','name','send','map','Interval','rawAttributes','fieldName','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','keys','include','options','find','catch','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','findOne','order','nolimit','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','json','offset','limit'];(function(_0x239904,_0x4b11e2){var _0x259609=function(_0x41d52a){while(--_0x41d52a){_0x239904['push'](_0x239904['shift']());}};_0x259609(++_0x4b11e2);}(_0x33bd,0x156));var _0xd33b=function(_0x41100a,_0x2caee1){_0x41100a=_0x41100a-0x0;var _0x5dbd27=_0x33bd[_0x41100a];return _0x5dbd27;};'use strict';var emlformat=require(_0xd33b('0x0'));var rimraf=require(_0xd33b('0x1'));var zipdir=require(_0xd33b('0x2'));var jsonpatch=require(_0xd33b('0x3'));var rp=require(_0xd33b('0x4'));var moment=require(_0xd33b('0x5'));var BPromise=require(_0xd33b('0x6'));var Mustache=require(_0xd33b('0x7'));var util=require(_0xd33b('0x8'));var path=require(_0xd33b('0x9'));var sox=require(_0xd33b('0xa'));var csv=require(_0xd33b('0xb'));var ejs=require(_0xd33b('0xc'));var fs=require('fs');var fs_extra=require(_0xd33b('0xd'));var _=require('lodash');var squel=require(_0xd33b('0xe'));var crypto=require(_0xd33b('0xf'));var jsforce=require(_0xd33b('0x10'));var deskjs=require(_0xd33b('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd33b('0x12'));var authService=require(_0xd33b('0x13'));var qs=require(_0xd33b('0x14'));var as=require(_0xd33b('0x15'));var hardwareService=require(_0xd33b('0x16'));var logger=require(_0xd33b('0x17'))(_0xd33b('0x18'));var utils=require(_0xd33b('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xd33b('0x1a'));var db=require(_0xd33b('0x1b'))['db'];var extensions=require(_0xd33b('0x1c'));function respondWithStatusCode(_0x5eb2ab,_0x409903){_0x409903=_0x409903||0xcc;return function(_0x2acca3){if(_0x2acca3){return _0x5eb2ab['sendStatus'](_0x409903);}return _0x5eb2ab[_0xd33b('0x1d')](_0x409903)[_0xd33b('0x1e')]();};}function respondWithResult(_0x4fdd9f,_0x2c6bb3){_0x2c6bb3=_0x2c6bb3||0xc8;return function(_0x1a2fc2){if(_0x1a2fc2){return _0x4fdd9f[_0xd33b('0x1d')](_0x2c6bb3)[_0xd33b('0x1f')](_0x1a2fc2);}};}function respondWithFilteredResult(_0x3e2ffa,_0x530d4b){return function(_0x1ecec6){if(_0x1ecec6){var _0x5cc231=typeof _0x530d4b[_0xd33b('0x20')]==='undefined'&&typeof _0x530d4b[_0xd33b('0x21')]==='undefined';var _0x6d4285=_0x1ecec6['count'];var _0x14f46e=_0x5cc231?0x0:_0x530d4b[_0xd33b('0x20')];var _0x2f4518=_0x5cc231?_0x1ecec6[_0xd33b('0x22')]:_0x530d4b[_0xd33b('0x20')]+_0x530d4b['limit'];var _0x48c6a0;if(_0x2f4518>=_0x6d4285){_0x2f4518=_0x6d4285;_0x48c6a0=0xc8;}else{_0x48c6a0=0xce;}_0x3e2ffa[_0xd33b('0x1d')](_0x48c6a0);return _0x3e2ffa[_0xd33b('0x23')](_0xd33b('0x24'),_0x14f46e+'-'+_0x2f4518+'/'+_0x6d4285)[_0xd33b('0x1f')](_0x1ecec6);}return null;};}function patchUpdates(_0x2c6400){return function(_0x2f891c){try{jsonpatch[_0xd33b('0x25')](_0x2f891c,_0x2c6400,!![]);}catch(_0x107101){return BPromise[_0xd33b('0x26')](_0x107101);}return _0x2f891c[_0xd33b('0x27')]();};}function saveUpdates(_0x2024f8,_0x4c2cf5){return function(_0x877a91){if(_0x877a91){return _0x877a91[_0xd33b('0x28')](_0x2024f8)['then'](function(_0x14f9c8){return _0x14f9c8;});}return null;};}function removeEntity(_0x1ac471,_0x4a32a){return function(_0x5edee7){if(_0x5edee7){return _0x5edee7[_0xd33b('0x29')]()['then'](function(){var _0xc650fb=_0x5edee7[_0xd33b('0x2a')]({'plain':!![]});var _0x2df3ec=_0xd33b('0x2b');return db[_0xd33b('0x2c')][_0xd33b('0x29')]({'where':{'type':_0x2df3ec,'resourceId':_0xc650fb['id']}})[_0xd33b('0x2d')](function(){return _0x5edee7;});})[_0xd33b('0x2d')](function(){_0x1ac471[_0xd33b('0x1d')](0xcc)[_0xd33b('0x1e')]();});}};}function handleEntityNotFound(_0x3027e6,_0x11619d){return function(_0x1e0376){if(!_0x1e0376){_0x3027e6['sendStatus'](0x194);}return _0x1e0376;};}function handleError(_0x10851a,_0x69afed){_0x69afed=_0x69afed||0x1f4;return function(_0x1e45e9){logger[_0xd33b('0x2e')](_0x1e45e9[_0xd33b('0x2f')]);if(_0x1e45e9['name']){delete _0x1e45e9[_0xd33b('0x30')];}_0x10851a['status'](_0x69afed)[_0xd33b('0x31')](_0x1e45e9);};}exports['index']=function(_0x28eded,_0x26f9de){var _0x5072f5={},_0x2695fa={},_0x4fa558={'count':0x0,'rows':[]};var _0x38cab6=_[_0xd33b('0x32')](db[_0xd33b('0x33')][_0xd33b('0x34')],function(_0xf1b3a7){return{'name':_0xf1b3a7[_0xd33b('0x35')],'type':_0xf1b3a7['type']['key']};});_0x2695fa['model']=_[_0xd33b('0x32')](_0x38cab6,_0xd33b('0x30'));_0x2695fa['query']=_['keys'](_0x28eded[_0xd33b('0x36')]);_0x2695fa[_0xd33b('0x37')]=_[_0xd33b('0x38')](_0x2695fa['model'],_0x2695fa[_0xd33b('0x36')]);_0x5072f5[_0xd33b('0x39')]=_[_0xd33b('0x38')](_0x2695fa[_0xd33b('0x3a')],qs[_0xd33b('0x3b')](_0x28eded[_0xd33b('0x36')][_0xd33b('0x3b')]));_0x5072f5['attributes']=_0x5072f5[_0xd33b('0x39')][_0xd33b('0x3c')]?_0x5072f5[_0xd33b('0x39')]:_0x2695fa[_0xd33b('0x3a')];if(!_0x28eded[_0xd33b('0x36')][_0xd33b('0x3d')]('nolimit')){_0x5072f5[_0xd33b('0x21')]=qs['limit'](_0x28eded['query'][_0xd33b('0x21')]);_0x5072f5['offset']=qs[_0xd33b('0x20')](_0x28eded[_0xd33b('0x36')][_0xd33b('0x20')]);}_0x5072f5['order']=qs[_0xd33b('0x3e')](_0x28eded[_0xd33b('0x36')][_0xd33b('0x3e')]);_0x5072f5[_0xd33b('0x3f')]=qs[_0xd33b('0x37')](_[_0xd33b('0x40')](_0x28eded[_0xd33b('0x36')],_0x2695fa['filters']),_0x38cab6);if(_0x28eded[_0xd33b('0x36')][_0xd33b('0x41')]){_0x5072f5[_0xd33b('0x3f')]=_[_0xd33b('0x42')](_0x5072f5[_0xd33b('0x3f')],{'$or':_['map'](_0x38cab6,function(_0x3cd368){if(_0x3cd368['type']!==_0xd33b('0x43')){var _0x99320c={};_0x99320c[_0x3cd368[_0xd33b('0x30')]]={'$like':'%'+_0x28eded[_0xd33b('0x36')][_0xd33b('0x41')]+'%'};return _0x99320c;}})});}_0x5072f5=_['merge']({},_0x5072f5,_0x28eded['options']);var _0x4d03b0={'where':_0x5072f5['where']};return db[_0xd33b('0x33')][_0xd33b('0x22')](_0x4d03b0)[_0xd33b('0x2d')](function(_0x5156ec){_0x4fa558[_0xd33b('0x22')]=_0x5156ec;if(_0x28eded['query'][_0xd33b('0x44')]){_0x5072f5['include']=[{'all':!![]}];}return db[_0xd33b('0x33')][_0xd33b('0x45')](_0x5072f5);})[_0xd33b('0x2d')](function(_0x212a28){_0x4fa558[_0xd33b('0x46')]=_0x212a28;return _0x4fa558;})[_0xd33b('0x2d')](respondWithFilteredResult(_0x26f9de,_0x5072f5))['catch'](handleError(_0x26f9de,null));};exports[_0xd33b('0x47')]=function(_0x2e3ac1,_0x97672f){var _0x2131e5={'raw':!![],'where':{'id':_0x2e3ac1[_0xd33b('0x48')]['id']}},_0x5a63c3={};_0x5a63c3['model']=_[_0xd33b('0x49')](db[_0xd33b('0x33')]['rawAttributes']);_0x5a63c3[_0xd33b('0x36')]=_[_0xd33b('0x49')](_0x2e3ac1[_0xd33b('0x36')]);_0x5a63c3[_0xd33b('0x37')]=_[_0xd33b('0x38')](_0x5a63c3['model'],_0x5a63c3[_0xd33b('0x36')]);_0x2131e5[_0xd33b('0x39')]=_[_0xd33b('0x38')](_0x5a63c3['model'],qs[_0xd33b('0x3b')](_0x2e3ac1[_0xd33b('0x36')][_0xd33b('0x3b')]));_0x2131e5[_0xd33b('0x39')]=_0x2131e5[_0xd33b('0x39')][_0xd33b('0x3c')]?_0x2131e5[_0xd33b('0x39')]:_0x5a63c3[_0xd33b('0x3a')];if(_0x2e3ac1[_0xd33b('0x36')][_0xd33b('0x44')]){_0x2131e5[_0xd33b('0x4a')]=[{'all':!![]}];}_0x2131e5=_[_0xd33b('0x42')]({},_0x2131e5,_0x2e3ac1[_0xd33b('0x4b')]);return db[_0xd33b('0x33')][_0xd33b('0x4c')](_0x2131e5)[_0xd33b('0x2d')](handleEntityNotFound(_0x97672f,null))[_0xd33b('0x2d')](respondWithResult(_0x97672f,null))[_0xd33b('0x4d')](handleError(_0x97672f,null));};exports[_0xd33b('0x4e')]=function(_0x159506,_0x5b0925){return db['Interval'][_0xd33b('0x4e')](_0x159506[_0xd33b('0x4f')],{})[_0xd33b('0x2d')](function(_0x27f61a){var _0x391353=_0x159506[_0xd33b('0x50')][_0xd33b('0x2a')]({'plain':!![]});if(!_0x391353)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x391353['role']===_0xd33b('0x50')){var _0x25e03f=_0x27f61a[_0xd33b('0x2a')]({'plain':!![]});var _0x1ed53e=_0xd33b('0x2b');return db[_0xd33b('0x51')][_0xd33b('0x4c')]({'where':{'name':_0x1ed53e,'userProfileId':_0x391353[_0xd33b('0x52')]},'raw':!![]})[_0xd33b('0x2d')](function(_0x1e2bea){if(_0x1e2bea&&_0x1e2bea[_0xd33b('0x53')]===0x0){return db['UserProfileResource'][_0xd33b('0x4e')]({'name':_0x25e03f[_0xd33b('0x30')],'resourceId':_0x25e03f['id'],'type':_0x1e2bea[_0xd33b('0x30')],'sectionId':_0x1e2bea['id']},{})['then'](function(){return _0x27f61a;});}else{return _0x27f61a;}})[_0xd33b('0x4d')](function(_0xca2c3f){logger[_0xd33b('0x2e')](_0xd33b('0x54'),_0xca2c3f);throw _0xca2c3f;});}return _0x27f61a;})[_0xd33b('0x2d')](respondWithResult(_0x5b0925,0xc9))[_0xd33b('0x4d')](handleError(_0x5b0925,null));};exports[_0xd33b('0x28')]=function(_0x118e8e,_0x38f46f){if(_0x118e8e[_0xd33b('0x4f')]['id']){delete _0x118e8e['body']['id'];}return db[_0xd33b('0x33')]['find']({'where':{'id':_0x118e8e[_0xd33b('0x48')]['id']}})[_0xd33b('0x2d')](handleEntityNotFound(_0x38f46f,null))['then'](saveUpdates(_0x118e8e[_0xd33b('0x4f')],null))[_0xd33b('0x2d')](respondWithResult(_0x38f46f,null))[_0xd33b('0x4d')](handleError(_0x38f46f,null));};exports[_0xd33b('0x29')]=function(_0x3a33f3,_0x303a31){return db[_0xd33b('0x33')][_0xd33b('0x4c')]({'where':{'id':_0x3a33f3['params']['id']}})[_0xd33b('0x2d')](handleEntityNotFound(_0x303a31,null))[_0xd33b('0x2d')](removeEntity(_0x303a31,null))[_0xd33b('0x4d')](handleError(_0x303a31,null));};exports[_0xd33b('0x55')]=function(_0x1a5cef,_0x1f38ca,_0xeef4c0){if(_0x1a5cef[_0xd33b('0x4f')]['id']){delete _0x1a5cef[_0xd33b('0x4f')]['id'];}return db[_0xd33b('0x33')][_0xd33b('0x4c')]({'where':{'id':_0x1a5cef[_0xd33b('0x48')]['id']}})[_0xd33b('0x2d')](handleEntityNotFound(_0x1f38ca,null))[_0xd33b('0x2d')](function(_0x43f743){if(_0x43f743){_0x1a5cef[_0xd33b('0x4f')]['IntervalId']=_0x43f743['id'];return db['Interval']['create'](_0x1a5cef['body']);}})[_0xd33b('0x2d')](respondWithResult(_0x1f38ca,null))[_0xd33b('0x4d')](handleError(_0x1f38ca,null));};exports[_0xd33b('0x56')]=function(_0xb8cabd,_0xaa2384,_0x3a2797){var _0x38fcd7={};var _0x1136bc={};var _0x5ce4f9;var _0x2670ed;return db[_0xd33b('0x33')][_0xd33b('0x57')]({'where':{'id':_0xb8cabd[_0xd33b('0x48')]['id']}})[_0xd33b('0x2d')](handleEntityNotFound(_0xaa2384,null))[_0xd33b('0x2d')](function(_0x3d33a8){if(_0x3d33a8){_0x5ce4f9=_0x3d33a8;_0x1136bc[_0xd33b('0x3a')]=_[_0xd33b('0x49')](db[_0xd33b('0x33')]['rawAttributes']);_0x1136bc[_0xd33b('0x36')]=_[_0xd33b('0x49')](_0xb8cabd[_0xd33b('0x36')]);_0x1136bc[_0xd33b('0x37')]=_[_0xd33b('0x38')](_0x1136bc[_0xd33b('0x3a')],_0x1136bc[_0xd33b('0x36')]);_0x38fcd7['attributes']=_['intersection'](_0x1136bc[_0xd33b('0x3a')],qs[_0xd33b('0x3b')](_0xb8cabd[_0xd33b('0x36')]['fields']));_0x38fcd7[_0xd33b('0x39')]=_0x38fcd7[_0xd33b('0x39')]['length']?_0x38fcd7[_0xd33b('0x39')]:_0x1136bc[_0xd33b('0x3a')];_0x38fcd7[_0xd33b('0x58')]=qs['sort'](_0xb8cabd['query'][_0xd33b('0x3e')]);_0x38fcd7[_0xd33b('0x3f')]=qs[_0xd33b('0x37')](_[_0xd33b('0x40')](_0xb8cabd[_0xd33b('0x36')],_0x1136bc[_0xd33b('0x37')]));if(_0xb8cabd[_0xd33b('0x36')][_0xd33b('0x41')]){_0x38fcd7[_0xd33b('0x3f')]=_['merge'](_0x38fcd7[_0xd33b('0x3f')],{'$or':_[_0xd33b('0x32')](_0x38fcd7[_0xd33b('0x39')],function(_0x43f6f6){var _0x23fba1={};_0x23fba1[_0x43f6f6]={'$like':'%'+_0xb8cabd[_0xd33b('0x36')][_0xd33b('0x41')]+'%'};return _0x23fba1;})});}_0x38fcd7=_['merge']({},_0x38fcd7,_0xb8cabd['options']);return _0x5ce4f9[_0xd33b('0x56')](_0x38fcd7);}})[_0xd33b('0x2d')](function(_0x220b36){if(_0x220b36){_0x2670ed=_0x220b36[_0xd33b('0x3c')];if(!_0xb8cabd['query'][_0xd33b('0x3d')](_0xd33b('0x59'))){_0x38fcd7[_0xd33b('0x21')]=qs['limit'](_0xb8cabd['query'][_0xd33b('0x21')]);_0x38fcd7['offset']=qs[_0xd33b('0x20')](_0xb8cabd['query'][_0xd33b('0x20')]);}return _0x5ce4f9[_0xd33b('0x56')](_0x38fcd7);}})[_0xd33b('0x2d')](function(_0x1b920e){if(_0x1b920e){return _0x1b920e?{'count':_0x2670ed,'rows':_0x1b920e}:null;}})[_0xd33b('0x2d')](respondWithResult(_0xaa2384,null))['catch'](handleError(_0xaa2384,null));};exports[_0xd33b('0x5a')]=function(_0x19d95a,_0x32728f,_0x106919){return db[_0xd33b('0x33')]['findOne']({'where':{'id':_0x19d95a[_0xd33b('0x48')]['id']}})[_0xd33b('0x2d')](handleEntityNotFound(_0x32728f,null))[_0xd33b('0x2d')](function(_0x535bd4){if(_0x535bd4){return db[_0xd33b('0x5b')][_0xd33b('0x5c')](function(_0x1ac399){return db[_0xd33b('0x33')]['destroy']({'where':{'IntervalId':_0x19d95a[_0xd33b('0x48')]['id']},'transaction':_0x1ac399})[_0xd33b('0x2d')](function(_0x4bafd8){var _0x503db6=_[_0xd33b('0x32')](_0x19d95a[_0xd33b('0x4f')],function(_0x4865c1){delete _0x4865c1['id'];_0x4865c1['IntervalId']=_0x19d95a['params']['id'];return _0x4865c1;});return db[_0xd33b('0x33')][_0xd33b('0x5d')](_0x503db6,{'transaction':_0x1ac399});});})[_0xd33b('0x2d')](function(){return db[_0xd33b('0x33')]['findAll']({'where':{'IntervalId':_0x19d95a['params']['id']}});});}})[_0xd33b('0x2d')](respondWithResult(_0x32728f,null))[_0xd33b('0x4d')](handleError(_0x32728f,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 775198a..a876d04 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 _0x20c7=['tools_intervals','rewrite','interval','getIntervals','then','all','map','ifTime','reduce','../../components/extensions/rewrite','../../utils/iftime','exports','define','Interval'];(function(_0x2714ec,_0x36daa4){var _0x2608e5=function(_0x408468){while(--_0x408468){_0x2714ec['push'](_0x2714ec['shift']());}};_0x2608e5(++_0x36daa4);}(_0x20c7,0x12f));var _0x720c=function(_0x3babd0,_0x29a8b7){_0x3babd0=_0x3babd0-0x0;var _0x4417b8=_0x20c7[_0x3babd0];return _0x4417b8;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x720c('0x0'));var iftime=require(_0x720c('0x1'))['iftime'];module[_0x720c('0x2')]=function(_0x49f4c7){return _0x49f4c7[_0x720c('0x3')](_0x720c('0x4'),attributes,{'tableName':_0x720c('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2398e0){extensions['rewrite'](_0x49f4c7,_0x2398e0);},'afterBulkCreate':function(_0x72003c,_0x1ccb1b,_0x59606d){_0x59606d();extensions[_0x720c('0x6')](_0x49f4c7,_0x72003c[0x0]);},'afterUpdate':function(_0x3e997b){extensions[_0x720c('0x6')](_0x49f4c7,_0x3e997b);},'afterDestroy':function(_0x2e8d85){extensions[_0x720c('0x6')](_0x49f4c7,_0x2e8d85);}},'instanceMethods':{'ifTime':function(_0x4bdc68=undefined,_0x18f9f6=new Date()){if(typeof this[_0x720c('0x7')]==='string'){return iftime(this[_0x720c('0x7')],_0x4bdc68,_0x18f9f6);}else{return this[_0x720c('0x8')]()[_0x720c('0x9')](function(_0x214616){return Promise[_0x720c('0xa')](_0x214616[_0x720c('0xb')](function(_0x6b6d24){return _0x6b6d24[_0x720c('0xc')](_0x4bdc68,_0x18f9f6);}));})[_0x720c('0x9')](function(_0x4c0c02){return _0x4c0c02[_0x720c('0xd')](function(_0x4bd12a,_0x3fbcfe){return _0x4bd12a||_0x3fbcfe;},![]);});}}}});}; \ No newline at end of file +var _0xbe02=['all','map','ifTime','iftime','exports','Interval','rewrite','interval','string','getIntervals','then'];(function(_0x81d45e,_0x1bfc87){var _0x3250de=function(_0x567e6a){while(--_0x567e6a){_0x81d45e['push'](_0x81d45e['shift']());}};_0x3250de(++_0x1bfc87);}(_0xbe02,0x71));var _0x2be0=function(_0x3a82e3,_0x3ec7cb){_0x3a82e3=_0x3a82e3-0x0;var _0x5f27bd=_0xbe02[_0x3a82e3];return _0x5f27bd;};'use strict';var attributes=require('./interval.attributes');var extensions=require('../../components/extensions/rewrite');var iftime=require('../../utils/iftime')[_0x2be0('0x0')];module[_0x2be0('0x1')]=function(_0x524731){return _0x524731['define'](_0x2be0('0x2'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b0c95){extensions['rewrite'](_0x524731,_0x4b0c95);},'afterBulkCreate':function(_0x6ef0b5,_0x3e02e4,_0x3c9474){_0x3c9474();extensions[_0x2be0('0x3')](_0x524731,_0x6ef0b5[0x0]);},'afterUpdate':function(_0x5abaf1){extensions['rewrite'](_0x524731,_0x5abaf1);},'afterDestroy':function(_0x7942b7){extensions[_0x2be0('0x3')](_0x524731,_0x7942b7);}},'instanceMethods':{'ifTime':function(_0x1ab80f=undefined,_0x21f8ef=new Date()){if(typeof this[_0x2be0('0x4')]===_0x2be0('0x5')){return iftime(this['interval'],_0x1ab80f,_0x21f8ef);}else{return this[_0x2be0('0x6')]()[_0x2be0('0x7')](function(_0x27e906){return Promise[_0x2be0('0x8')](_0x27e906[_0x2be0('0x9')](function(_0x3bc83f){return _0x3bc83f[_0x2be0('0xa')](_0x1ab80f,_0x21f8ef);}));})[_0x2be0('0x7')](function(_0x27ae0f){return _0x27ae0f['reduce'](function(_0x44a6b3,_0x464195){return _0x44a6b3||_0x464195;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 901eec5..15b6f60 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 _0xde0a=['format','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','IntervalIftime','intervalIds','intervals','string','length','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','reduce','lodash','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','find','raw','where','ShowInterval','ifTime'];(function(_0x2deead,_0x44fcbe){var _0x2a901e=function(_0x3691f9){while(--_0x3691f9){_0x2deead['push'](_0x2deead['shift']());}};_0x2a901e(++_0x44fcbe);}(_0xde0a,0x16c));var _0xade0=function(_0x2fd0fd,_0x4d3cef){_0x2fd0fd=_0x2fd0fd-0x0;var _0x3a04a9=_0xde0a[_0x2fd0fd];return _0x3a04a9;};'use strict';var _=require(_0xade0('0x0'));var util=require('util');var db=require('../../mysqldb')['db'];var iftime=require(_0xade0('0x1'))[_0xade0('0x2')];var logger=require(_0xade0('0x3'))(_0xade0('0x4'));exports[_0xade0('0x5')]=function(_0x176822){var _0x2ab5c5=this;return new Promise(function(_0x2a5393,_0x5dec31){return db[_0xade0('0x6')][_0xade0('0x7')]({'raw':_0x176822[_0xade0('0x8')]?_0x176822[_0xade0('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x176822[_0xade0('0x8')]?_0x176822[_0xade0('0x8')]['where']||null:null,'attributes':_0x176822[_0xade0('0x8')]?_0x176822[_0xade0('0x8')][_0xade0('0x9')]||null:null,'limit':_0x176822[_0xade0('0x8')]?_0x176822['options'][_0xade0('0xa')]||null:null,'include':_0x176822[_0xade0('0x8')]?_0x176822['options'][_0xade0('0xb')]?_[_0xade0('0xc')](_0x176822[_0xade0('0x8')][_0xade0('0xb')],function(_0x2b43c8){return{'model':db[_0x2b43c8['model']],'as':_0x2b43c8['as'],'attributes':_0x2b43c8[_0xade0('0x9')],'include':_0x2b43c8[_0xade0('0xb')]?_['map'](_0x2b43c8[_0xade0('0xb')],function(_0x400438){return{'model':db[_0x400438[_0xade0('0xd')]],'as':_0x400438['as'],'attributes':_0x400438[_0xade0('0x9')],'include':_0x400438['include']?_[_0xade0('0xc')](_0x400438[_0xade0('0xb')],function(_0x232afa){return{'model':db[_0x232afa['model']],'as':_0x232afa['as'],'attributes':_0x232afa[_0xade0('0x9')]};}):[]};}):[]};}):[]:[]})[_0xade0('0xe')](function(_0x57b0de){logger[_0xade0('0xf')]('GetInterval',_0x176822);logger[_0xade0('0x10')](_0xade0('0x5'),_0x176822,JSON[_0xade0('0x11')](_0x57b0de));_0x2a5393(_0x57b0de);})[_0xade0('0x12')](function(_0x256530){logger['error']('GetInterval',_0x256530['message'],_0x176822);_0x5dec31(_0x2ab5c5[_0xade0('0x13')](0x1f4,_0x256530[_0xade0('0x14')]));});});};exports['ShowInterval']=function(_0x32f0ac){var _0x4a85b3=this;return new Promise(function(_0x5a2980,_0x1c93eb){return db[_0xade0('0x6')][_0xade0('0x15')]({'raw':_0x32f0ac[_0xade0('0x8')]?_0x32f0ac[_0xade0('0x8')][_0xade0('0x16')]===undefined?!![]:![]:!![],'where':_0x32f0ac['options']?_0x32f0ac[_0xade0('0x8')][_0xade0('0x17')]||null:null,'attributes':_0x32f0ac[_0xade0('0x8')]?_0x32f0ac[_0xade0('0x8')]['attributes']||null:null,'include':_0x32f0ac[_0xade0('0x8')]?_0x32f0ac[_0xade0('0x8')][_0xade0('0xb')]?_[_0xade0('0xc')](_0x32f0ac[_0xade0('0x8')][_0xade0('0xb')],function(_0x4066dd){return{'model':db[_0x4066dd[_0xade0('0xd')]],'as':_0x4066dd['as'],'attributes':_0x4066dd[_0xade0('0x9')],'include':_0x4066dd[_0xade0('0xb')]?_['map'](_0x4066dd[_0xade0('0xb')],function(_0x5fa727){return{'model':db[_0x5fa727['model']],'as':_0x5fa727['as'],'attributes':_0x5fa727[_0xade0('0x9')],'include':_0x5fa727[_0xade0('0xb')]?_[_0xade0('0xc')](_0x5fa727[_0xade0('0xb')],function(_0x4dabf8){return{'model':db[_0x4dabf8['model']],'as':_0x4dabf8['as'],'attributes':_0x4dabf8['attributes']};}):[]};}):[]};}):[]:[]})[_0xade0('0xe')](function(_0x3e07ff){logger[_0xade0('0xf')](_0xade0('0x18'),_0x32f0ac);logger[_0xade0('0x10')](_0xade0('0x18'),_0x32f0ac,JSON['stringify'](_0x3e07ff));_0x5a2980(_0x3e07ff);})['catch'](function(_0x4d61f3){logger[_0xade0('0x13')](_0xade0('0x18'),_0x4d61f3[_0xade0('0x14')],_0x32f0ac);_0x1c93eb(_0x4a85b3[_0xade0('0x13')](0x1f4,_0x4d61f3[_0xade0('0x14')]));});});};function checkArrayOfIntervals(_0x1e6ea6,_0x285929){var _0x3347ff=[];return db[_0xade0('0x6')][_0xade0('0x7')]({'where':{'id':_0x1e6ea6}})['then'](function(_0x414599){_0x3347ff=_0x414599;return Promise['all'](_0x3347ff[_0xade0('0xc')](function(_0x3eb544){return _0x3eb544[_0xade0('0x19')](_0x285929);}));})['then'](function(_0x477323){var _0x3d3193=_0x477323['reduce'](function(_0x408231,_0x2fbd51){return _0x408231||_0x2fbd51;},![]);logger['info'](util[_0xade0('0x1a')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x3347ff[_0xade0('0xc')](function(_0x4dac8e){return _0x4dac8e['name'];})[_0xade0('0x1b')](',\x20'),_0x3347ff['map'](function(_0x5ecc07){return _0x5ecc07['id'];})['join'](',\x20')));return _0x3d3193;});}function checkSingleInterval(_0x3e9921,_0x589327){return db[_0xade0('0x6')]['findById'](_0x3e9921)[_0xade0('0xe')](function(_0x15cc46){if(_0x15cc46){logger[_0xade0('0xf')](util[_0xade0('0x1a')](_0xade0('0x1c'),_0x15cc46[_0xade0('0x1d')],_0x15cc46['id']));return _0x15cc46['ifTime'](_0x589327);}});}exports[_0xade0('0x1e')]=function(_0x2916e6){var _0x22c769=_0x2916e6[_0xade0('0x1f')];var _0x3f7240=Array['isArray'](_0x2916e6['intervals'])?_0x2916e6[_0xade0('0x20')]:typeof _0x2916e6[_0xade0('0x20')]===_0xade0('0x21')?[_0x2916e6['intervals']]:[];var _0x31be25=_0x2916e6['timezone']||undefined;var _0x16720f=![];if(_0x3f7240[_0xade0('0x22')]){logger[_0xade0('0xf')](util[_0xade0('0x1a')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x3f7240[_0xade0('0x1b')](';\x20')));}if(_0x31be25){logger[_0xade0('0xf')](util[_0xade0('0x1a')](_0xade0('0x23'),_0x31be25));}logger[_0xade0('0x10')](_0xade0('0x24'),_0x16720f);logger[_0xade0('0x25')]('IntervalIftime',_0x2916e6);return Promise['resolve']()[_0xade0('0xe')](function(){if(Array['isArray'](_0x22c769)){return checkArrayOfIntervals(_0x22c769,_0x31be25);}else if(_0x22c769){return checkSingleInterval(_0x22c769,_0x31be25);}})[_0xade0('0xe')](function(_0x4af715){var _0x23fa90=_0x3f7240[_0xade0('0x26')](function(_0x53763d,_0x1d34de){return _0x53763d||iftime(_0x1d34de,_0x31be25);},![]);_0x16720f=_0x4af715||_0x23fa90;return _0x16720f;})['catch'](function(_0x190781){logger[_0xade0('0x13')](_0xade0('0x1e'),_0x2916e6,_0x190781);throw this[_0xade0('0x13')](0x1f4,_0x190781[_0xade0('0x14')]);});}; \ No newline at end of file +var _0x6818=['util','../../mysqldb','rpc','GetInterval','findAll','options','raw','where','attributes','include','map','model','then','info','stringify','catch','error','message','ShowInterval','Interval','debug','all','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','ifTime','IntervalIftime','intervalIds','isArray','intervals','string','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','resolve'];(function(_0x1da398,_0x4647db){var _0x36bca0=function(_0x5115c6){while(--_0x5115c6){_0x1da398['push'](_0x1da398['shift']());}};_0x36bca0(++_0x4647db);}(_0x6818,0xe4));var _0x8681=function(_0x10514c,_0x3dd2d4){_0x10514c=_0x10514c-0x0;var _0x30d165=_0x6818[_0x10514c];return _0x30d165;};'use strict';var _=require('lodash');var util=require(_0x8681('0x0'));var db=require(_0x8681('0x1'))['db'];var iftime=require('../../utils/iftime')['iftime'];var logger=require('../../config/logger')(_0x8681('0x2'));exports[_0x8681('0x3')]=function(_0x343f33){var _0x21b061=this;return new Promise(function(_0x48bdb1,_0x2829af){return db['Interval'][_0x8681('0x4')]({'raw':_0x343f33[_0x8681('0x5')]?_0x343f33[_0x8681('0x5')][_0x8681('0x6')]===undefined?!![]:![]:!![],'where':_0x343f33[_0x8681('0x5')]?_0x343f33['options'][_0x8681('0x7')]||null:null,'attributes':_0x343f33[_0x8681('0x5')]?_0x343f33[_0x8681('0x5')][_0x8681('0x8')]||null:null,'limit':_0x343f33[_0x8681('0x5')]?_0x343f33['options']['limit']||null:null,'include':_0x343f33['options']?_0x343f33['options']['include']?_['map'](_0x343f33['options']['include'],function(_0x5ebc24){return{'model':db[_0x5ebc24['model']],'as':_0x5ebc24['as'],'attributes':_0x5ebc24[_0x8681('0x8')],'include':_0x5ebc24[_0x8681('0x9')]?_[_0x8681('0xa')](_0x5ebc24[_0x8681('0x9')],function(_0x17b619){return{'model':db[_0x17b619[_0x8681('0xb')]],'as':_0x17b619['as'],'attributes':_0x17b619[_0x8681('0x8')],'include':_0x17b619[_0x8681('0x9')]?_['map'](_0x17b619[_0x8681('0x9')],function(_0x20a019){return{'model':db[_0x20a019[_0x8681('0xb')]],'as':_0x20a019['as'],'attributes':_0x20a019['attributes']};}):[]};}):[]};}):[]:[]})[_0x8681('0xc')](function(_0x2182fe){logger[_0x8681('0xd')](_0x8681('0x3'),_0x343f33);logger['debug'](_0x8681('0x3'),_0x343f33,JSON[_0x8681('0xe')](_0x2182fe));_0x48bdb1(_0x2182fe);})[_0x8681('0xf')](function(_0x40d86a){logger[_0x8681('0x10')](_0x8681('0x3'),_0x40d86a[_0x8681('0x11')],_0x343f33);_0x2829af(_0x21b061[_0x8681('0x10')](0x1f4,_0x40d86a[_0x8681('0x11')]));});});};exports[_0x8681('0x12')]=function(_0x40d65a){var _0x3522e=this;return new Promise(function(_0x5b430a,_0x3a717a){return db[_0x8681('0x13')]['find']({'raw':_0x40d65a['options']?_0x40d65a[_0x8681('0x5')]['raw']===undefined?!![]:![]:!![],'where':_0x40d65a[_0x8681('0x5')]?_0x40d65a[_0x8681('0x5')][_0x8681('0x7')]||null:null,'attributes':_0x40d65a[_0x8681('0x5')]?_0x40d65a[_0x8681('0x5')][_0x8681('0x8')]||null:null,'include':_0x40d65a[_0x8681('0x5')]?_0x40d65a[_0x8681('0x5')][_0x8681('0x9')]?_[_0x8681('0xa')](_0x40d65a[_0x8681('0x5')][_0x8681('0x9')],function(_0x2410d0){return{'model':db[_0x2410d0['model']],'as':_0x2410d0['as'],'attributes':_0x2410d0['attributes'],'include':_0x2410d0[_0x8681('0x9')]?_[_0x8681('0xa')](_0x2410d0[_0x8681('0x9')],function(_0x2438d7){return{'model':db[_0x2438d7[_0x8681('0xb')]],'as':_0x2438d7['as'],'attributes':_0x2438d7['attributes'],'include':_0x2438d7['include']?_['map'](_0x2438d7[_0x8681('0x9')],function(_0x5b73d2){return{'model':db[_0x5b73d2[_0x8681('0xb')]],'as':_0x5b73d2['as'],'attributes':_0x5b73d2[_0x8681('0x8')]};}):[]};}):[]};}):[]:[]})[_0x8681('0xc')](function(_0x1eec93){logger[_0x8681('0xd')](_0x8681('0x12'),_0x40d65a);logger[_0x8681('0x14')](_0x8681('0x12'),_0x40d65a,JSON[_0x8681('0xe')](_0x1eec93));_0x5b430a(_0x1eec93);})['catch'](function(_0x40e6c1){logger[_0x8681('0x10')](_0x8681('0x12'),_0x40e6c1[_0x8681('0x11')],_0x40d65a);_0x3a717a(_0x3522e['error'](0x1f4,_0x40e6c1[_0x8681('0x11')]));});});};function checkArrayOfIntervals(_0x5e11dc,_0x2ae7d4){var _0x340780=[];return db[_0x8681('0x13')][_0x8681('0x4')]({'where':{'id':_0x5e11dc}})[_0x8681('0xc')](function(_0x1d2ef6){_0x340780=_0x1d2ef6;return Promise[_0x8681('0x15')](_0x340780[_0x8681('0xa')](function(_0x41737c){return _0x41737c['ifTime'](_0x2ae7d4);}));})[_0x8681('0xc')](function(_0x2b9e6a){var _0x5f0578=_0x2b9e6a['reduce'](function(_0x3ab177,_0x4648fe){return _0x3ab177||_0x4648fe;},![]);logger[_0x8681('0xd')](util['format'](_0x8681('0x16'),_0x340780[_0x8681('0xa')](function(_0x2b325c){return _0x2b325c[_0x8681('0x17')];})[_0x8681('0x18')](',\x20'),_0x340780[_0x8681('0xa')](function(_0x357e46){return _0x357e46['id'];})[_0x8681('0x18')](',\x20')));return _0x5f0578;});}function checkSingleInterval(_0x569d03,_0x2f6614){return db[_0x8681('0x13')][_0x8681('0x19')](_0x569d03)['then'](function(_0x2ff2f8){if(_0x2ff2f8){logger['info'](util[_0x8681('0x1a')](_0x8681('0x1b'),_0x2ff2f8[_0x8681('0x17')],_0x2ff2f8['id']));return _0x2ff2f8[_0x8681('0x1c')](_0x2f6614);}});}exports[_0x8681('0x1d')]=function(_0x582665){var _0x1e45f9=_0x582665[_0x8681('0x1e')];var _0x22f6bd=Array[_0x8681('0x1f')](_0x582665['intervals'])?_0x582665[_0x8681('0x20')]:typeof _0x582665['intervals']===_0x8681('0x21')?[_0x582665[_0x8681('0x20')]]:[];var _0x476c9d=_0x582665[_0x8681('0x22')]||undefined;var _0x33af2a=![];if(_0x22f6bd['length']){logger[_0x8681('0xd')](util[_0x8681('0x1a')](_0x8681('0x23'),_0x22f6bd[_0x8681('0x18')](';\x20')));}if(_0x476c9d){logger[_0x8681('0xd')](util[_0x8681('0x1a')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x476c9d));}logger[_0x8681('0x14')](_0x8681('0x24'),_0x33af2a);logger['silly'](_0x8681('0x1d'),_0x582665);return Promise[_0x8681('0x25')]()[_0x8681('0xc')](function(){if(Array[_0x8681('0x1f')](_0x1e45f9)){return checkArrayOfIntervals(_0x1e45f9,_0x476c9d);}else if(_0x1e45f9){return checkSingleInterval(_0x1e45f9,_0x476c9d);}})[_0x8681('0xc')](function(_0x219c5f){var _0x5d5233=_0x22f6bd['reduce'](function(_0x2a26c6,_0x2009bf){return _0x2a26c6||iftime(_0x2009bf,_0x476c9d);},![]);_0x33af2a=_0x219c5f||_0x5d5233;return _0x33af2a;})['catch'](function(_0x2f75fd){logger[_0x8681('0x10')](_0x8681('0x1d'),_0x582665,_0x2f75fd);throw this['error'](0x1f4,_0x2f75fd[_0x8681('0x11')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 49f4f3d..f89be37 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 _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x1283c2,_0x5c975d){var _0x67cc6d=function(_0x279daf){while(--_0x279daf){_0x1283c2['push'](_0x1283c2['shift']());}};_0x67cc6d(++_0x5c975d);}(_0x2032,0xd9));var _0x2203=function(_0x2c0ae9,_0x40e5ed){_0x2c0ae9=_0x2c0ae9-0x0;var _0x27e05d=_0x2032[_0x2c0ae9];return _0x27e05d;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x463d7c,_0x54ced4){var _0x2854d7=function(_0x5c4c4a){while(--_0x5c4c4a){_0x463d7c['push'](_0x463d7c['shift']());}};_0x2854d7(++_0x54ced4);}(_0x2032,0xd9));var _0x2203=function(_0x72643c,_0x7ee9d3){_0x72643c=_0x72643c-0x0;var _0xb7da70=_0x2032[_0x72643c];return _0xb7da70;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index ea55f57..764cecd 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 _0x7db1=['body','headers','x-forwarded-for','socket','remoteAddress','connection','bluebird','https','../../config/logger','api','support','key','MOTGUI','Report','\x20from\x20','description','stringify','issuetype','fields','customfield_11500','customfield_11501','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','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','openIssue','send'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0x7db1,0x66));var _0x17db=function(_0x131604,_0x475a68){_0x131604=_0x131604-0x0;var _0x4a2aea=_0x7db1[_0x131604];return _0x4a2aea;};'use strict';var BPromise=require(_0x17db('0x0'));var https=require(_0x17db('0x1'));var logger=require(_0x17db('0x2'))(_0x17db('0x3'));var USERNAME=_0x17db('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0xc18875,_0x5549bc){var _0x36d4d2={'fields':{'project':{'key':_0xc18875[_0x17db('0x5')]||_0x17db('0x6')},'summary':(_0xc18875['summary']||_0x17db('0x7'))+_0x17db('0x8')+_0xc18875['ip'],'description':_0xc18875[_0x17db('0x9')]||JSON[_0x17db('0xa')](_0xc18875),'issuetype':{'name':_0xc18875[_0x17db('0xb')]||'Bug'}}};_0x36d4d2[_0x17db('0xc')][_0x17db('0xd')]=_0xc18875['email'];_0x36d4d2['fields'][_0x17db('0xe')]=_0xc18875['oldToken'];_0x36d4d2[_0x17db('0xc')]['customfield_11502']=_0xc18875[_0x17db('0xf')];_0x36d4d2[_0x17db('0xc')][_0x17db('0x10')]=_0xc18875[_0x17db('0x11')];_0x36d4d2['fields'][_0x17db('0x12')]=_0xc18875[_0x17db('0x13')];_0x36d4d2[_0x17db('0xc')][_0x17db('0x14')]=_0xc18875['ip'];var _0x48e8b3={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x17db('0x15'),'method':_0x17db('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x17db('0x17'),'Authorization':_0x17db('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x17db('0x19')](_0x17db('0x1a'))}};var _0x2fefe7=JSON[_0x17db('0xa')](_0x36d4d2);var _0x4f4364=https[_0x17db('0x1b')](_0x48e8b3,function(_0x638d4d){_0x638d4d[_0x17db('0x1c')](_0x17db('0x1d'));var _0x5db513='';_0x638d4d['on'](_0x17db('0x1e'),function(_0x5a11b3){_0x5db513+=_0x5a11b3;});_0x638d4d['on'](_0x17db('0x1f'),function(){if(_0x5549bc){return _0x5549bc[_0x17db('0x20')](_0x638d4d[_0x17db('0x21')])[_0x17db('0x22')](JSON[_0x17db('0x23')](_0x5db513));}});});_0x4f4364['on'](_0x17db('0x24'),function(_0x1ee22d){if(_0x5549bc){return _0x5549bc[_0x17db('0x20')](0x1f4)['json']({'errors':[{'message':_0x17db('0x25'),'type':_0x17db('0x26')}]});}});_0x4f4364[_0x17db('0x27')](_0x2fefe7);_0x4f4364[_0x17db('0x1f')]();}exports[_0x17db('0x28')]=openIssue;exports[_0x17db('0x29')]=function(_0x35c89c,_0x4e8761){_0x35c89c[_0x17db('0x2a')]['ip']=_0x35c89c[_0x17db('0x2b')][_0x17db('0x2c')]||_0x35c89c['connection']['remoteAddress']||_0x35c89c[_0x17db('0x2d')][_0x17db('0x2e')]||_0x35c89c[_0x17db('0x2f')]['socket'][_0x17db('0x2e')];return openIssue(_0x35c89c[_0x17db('0x2a')],_0x4e8761);}; \ No newline at end of file +var _0xfbcb=['write','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','summary','stringify','issuetype','Bug','fields','customfield_11500','customfield_11501','customfield_11502','newToken','customfield_11503','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','base64','setEncoding','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira'];(function(_0x383db0,_0x508fda){var _0x184948=function(_0x3a262c){while(--_0x3a262c){_0x383db0['push'](_0x383db0['shift']());}};_0x184948(++_0x508fda);}(_0xfbcb,0xa5));var _0xbfbc=function(_0x376721,_0x42972c){_0x376721=_0x376721-0x0;var _0x5b81d4=_0xfbcb[_0x376721];return _0x5b81d4;};'use strict';var BPromise=require(_0xbfbc('0x0'));var https=require('https');var logger=require(_0xbfbc('0x1'))('api');var USERNAME=_0xbfbc('0x2');var PASSWORD=_0xbfbc('0x3');function openIssue(_0x244475,_0xd62240){var _0x1b7ae1={'fields':{'project':{'key':_0x244475[_0xbfbc('0x4')]||_0xbfbc('0x5')},'summary':(_0x244475[_0xbfbc('0x6')]||'Report')+'\x20from\x20'+_0x244475['ip'],'description':_0x244475['description']||JSON[_0xbfbc('0x7')](_0x244475),'issuetype':{'name':_0x244475[_0xbfbc('0x8')]||_0xbfbc('0x9')}}};_0x1b7ae1[_0xbfbc('0xa')][_0xbfbc('0xb')]=_0x244475['email'];_0x1b7ae1[_0xbfbc('0xa')][_0xbfbc('0xc')]=_0x244475['oldToken'];_0x1b7ae1[_0xbfbc('0xa')][_0xbfbc('0xd')]=_0x244475[_0xbfbc('0xe')];_0x1b7ae1[_0xbfbc('0xa')][_0xbfbc('0xf')]=_0x244475['name'];_0x1b7ae1[_0xbfbc('0xa')]['customfield_11504']=_0x244475['reason'];_0x1b7ae1[_0xbfbc('0xa')][_0xbfbc('0x10')]=_0x244475['ip'];var _0x4ea2f5={'host':_0xbfbc('0x11'),'port':0x1bb,'path':_0xbfbc('0x12'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xbfbc('0x13'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xbfbc('0x14'))}};var _0x2e3ee8=JSON[_0xbfbc('0x7')](_0x1b7ae1);var _0x5166c1=https['request'](_0x4ea2f5,function(_0x2d8b2a){_0x2d8b2a[_0xbfbc('0x15')]('utf8');var _0x561366='';_0x2d8b2a['on']('data',function(_0x4820a1){_0x561366+=_0x4820a1;});_0x2d8b2a['on'](_0xbfbc('0x16'),function(){if(_0xd62240){return _0xd62240[_0xbfbc('0x17')](_0x2d8b2a[_0xbfbc('0x18')])[_0xbfbc('0x19')](JSON[_0xbfbc('0x1a')](_0x561366));}});});_0x5166c1['on'](_0xbfbc('0x1b'),function(_0x1c0bb5){if(_0xd62240){return _0xd62240['status'](0x1f4)['json']({'errors':[{'message':_0xbfbc('0x1c'),'type':_0xbfbc('0x1d')}]});}});_0x5166c1[_0xbfbc('0x1e')](_0x2e3ee8);_0x5166c1[_0xbfbc('0x16')]();}exports[_0xbfbc('0x1f')]=openIssue;exports[_0xbfbc('0x20')]=function(_0x1fe998,_0x5a5ff5){_0x1fe998['body']['ip']=_0x1fe998[_0xbfbc('0x21')][_0xbfbc('0x22')]||_0x1fe998[_0xbfbc('0x23')][_0xbfbc('0x24')]||_0x1fe998['socket']['remoteAddress']||_0x1fe998[_0xbfbc('0x23')][_0xbfbc('0x25')][_0xbfbc('0x24')];return openIssue(_0x1fe998[_0xbfbc('0x26')],_0x5a5ff5);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index cb91705..e4eab6f 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 _0xcb91=['get','index','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller'];(function(_0x42ae0c,_0x2391ce){var _0x376d64=function(_0x42919e){while(--_0x42919e){_0x42ae0c['push'](_0x42ae0c['shift']());}};_0x376d64(++_0x2391ce);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5ebc04,_0x14a363){_0x5ebc04=_0x5ebc04-0x0;var _0x17845c=_0xcb91[_0x5ebc04];return _0x17845c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')](_0x1cb9('0xb'),auth['isAuthenticated'](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0bb5=['describe','show','post','put','/:id','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','/describe','isAuthenticated'];(function(_0x52a8e5,_0x1e500a){var _0x3933db=function(_0x1c0c0d){while(--_0x1c0c0d){_0x52a8e5['push'](_0x52a8e5['shift']());}};_0x3933db(++_0x1e500a);}(_0x0bb5,0x148));var _0x50bb=function(_0x25908d,_0x307b62){_0x25908d=_0x25908d-0x0;var _0x26a343=_0x0bb5[_0x25908d];return _0x26a343;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['get']('/:id',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0xe')]('/',auth[_0x50bb('0xb')](),controller['create']);router[_0x50bb('0xf')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x12')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller['destroy']);module[_0x50bb('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 42ff061..8231299 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(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x7a54,0x106));var _0x47a5=function(_0x491efd,_0xa5dc63){_0x491efd=_0x491efd-0x0;var _0x1f6d05=_0x7a54[_0x491efd];return _0x1f6d05;};'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(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7a54,0x106));var _0x47a5=function(_0x256a20,_0x15b898){_0x256a20=_0x256a20-0x0;var _0x5a6dce=_0x7a54[_0x256a20];return _0x5a6dce;};'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 0cd4dfc..a07720f 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 _0x41fe=['fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','catch','show','keys','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x470736,_0x16cab7){var _0x483480=function(_0x2bb0be){while(--_0x2bb0be){_0x470736['push'](_0x470736['shift']());}};_0x483480(++_0x16cab7);}(_0x41fe,0xd1));var _0xe41f=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x41fe[_0x342700];return _0x53406f;};'use strict';var emlformat=require(_0xe41f('0x0'));var rimraf=require(_0xe41f('0x1'));var zipdir=require(_0xe41f('0x2'));var jsonpatch=require(_0xe41f('0x3'));var rp=require(_0xe41f('0x4'));var moment=require(_0xe41f('0x5'));var BPromise=require(_0xe41f('0x6'));var Mustache=require(_0xe41f('0x7'));var util=require(_0xe41f('0x8'));var path=require(_0xe41f('0x9'));var sox=require(_0xe41f('0xa'));var csv=require(_0xe41f('0xb'));var ejs=require(_0xe41f('0xc'));var fs=require('fs');var fs_extra=require(_0xe41f('0xd'));var _=require(_0xe41f('0xe'));var squel=require(_0xe41f('0xf'));var crypto=require(_0xe41f('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xe41f('0x11'));var toCsv=require(_0xe41f('0xb'));var querystring=require('querystring');var Papa=require(_0xe41f('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe41f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe41f('0x14'));var config=require(_0xe41f('0x15'));var licenseUtil=require(_0xe41f('0x16'));var db=require(_0xe41f('0x17'))['db'];function respondWithStatusCode(_0x2ed268,_0x139162){_0x139162=_0x139162||0xcc;return function(_0x34ae3a){if(_0x34ae3a){return _0x2ed268[_0xe41f('0x18')](_0x139162);}return _0x2ed268[_0xe41f('0x19')](_0x139162)[_0xe41f('0x1a')]();};}function respondWithResult(_0x53e2f6,_0x445e1c){_0x445e1c=_0x445e1c||0xc8;return function(_0x13a2dd){if(_0x13a2dd){return _0x53e2f6['status'](_0x445e1c)[_0xe41f('0x1b')](_0x13a2dd);}};}function respondWithFilteredResult(_0x9cb27c,_0x3b5992){return function(_0x1fb373){if(_0x1fb373){var _0x194653=typeof _0x3b5992[_0xe41f('0x1c')]===_0xe41f('0x1d')&&typeof _0x3b5992['limit']==='undefined';var _0x2b5688=_0x1fb373['count'];var _0x5b5dd7=_0x194653?0x0:_0x3b5992[_0xe41f('0x1c')];var _0x15f6c1=_0x194653?_0x1fb373[_0xe41f('0x1e')]:_0x3b5992[_0xe41f('0x1c')]+_0x3b5992[_0xe41f('0x1f')];var _0x5bd220;if(_0x15f6c1>=_0x2b5688){_0x15f6c1=_0x2b5688;_0x5bd220=0xc8;}else{_0x5bd220=0xce;}_0x9cb27c[_0xe41f('0x19')](_0x5bd220);return _0x9cb27c['set'](_0xe41f('0x20'),_0x5b5dd7+'-'+_0x15f6c1+'/'+_0x2b5688)[_0xe41f('0x1b')](_0x1fb373);}return null;};}function patchUpdates(_0x4dcb21){return function(_0x3ce4d8){try{jsonpatch[_0xe41f('0x21')](_0x3ce4d8,_0x4dcb21,!![]);}catch(_0x171851){return BPromise['reject'](_0x171851);}return _0x3ce4d8[_0xe41f('0x22')]();};}function saveUpdates(_0x3666c3,_0x37fce9){return function(_0x10ee63){if(_0x10ee63){return _0x10ee63[_0xe41f('0x23')](_0x3666c3)[_0xe41f('0x24')](function(_0x9c0c33){return _0x9c0c33;});}return null;};}function removeEntity(_0x520136,_0x18c6ba){return function(_0x5a443f){if(_0x5a443f){return _0x5a443f['destroy']()[_0xe41f('0x24')](function(){_0x520136[_0xe41f('0x19')](0xcc)[_0xe41f('0x1a')]();});}};}function handleEntityNotFound(_0x4f7965,_0x1ac25a){return function(_0x573b3){if(!_0x573b3){_0x4f7965[_0xe41f('0x18')](0x194);}return _0x573b3;};}function handleError(_0x479387,_0x15ccae){_0x15ccae=_0x15ccae||0x1f4;return function(_0x5790ae){logger[_0xe41f('0x25')](_0x5790ae[_0xe41f('0x26')]);if(_0x5790ae['name']){delete _0x5790ae[_0xe41f('0x27')];}_0x479387[_0xe41f('0x19')](_0x15ccae)[_0xe41f('0x28')](_0x5790ae);};}exports[_0xe41f('0x29')]=function(_0x348531,_0x2a7bf4){var _0x1a182b={},_0x4438cf={},_0x6ec664={'count':0x0,'rows':[]};var _0x1c3c38=_[_0xe41f('0x2a')](db[_0xe41f('0x2b')][_0xe41f('0x2c')],function(_0xbca5b0){return{'name':_0xbca5b0[_0xe41f('0x2d')],'type':_0xbca5b0['type'][_0xe41f('0x2e')]};});_0x4438cf[_0xe41f('0x2f')]=_[_0xe41f('0x2a')](_0x1c3c38,_0xe41f('0x27'));_0x4438cf[_0xe41f('0x30')]=_['keys'](_0x348531[_0xe41f('0x30')]);_0x4438cf[_0xe41f('0x31')]=_[_0xe41f('0x32')](_0x4438cf[_0xe41f('0x2f')],_0x4438cf['query']);_0x1a182b['attributes']=_['intersection'](_0x4438cf[_0xe41f('0x2f')],qs[_0xe41f('0x33')](_0x348531[_0xe41f('0x30')]['fields']));_0x1a182b[_0xe41f('0x34')]=_0x1a182b[_0xe41f('0x34')][_0xe41f('0x35')]?_0x1a182b[_0xe41f('0x34')]:_0x4438cf[_0xe41f('0x2f')];if(!_0x348531[_0xe41f('0x30')][_0xe41f('0x36')](_0xe41f('0x37'))){_0x1a182b[_0xe41f('0x1f')]=qs[_0xe41f('0x1f')](_0x348531[_0xe41f('0x30')][_0xe41f('0x1f')]);_0x1a182b['offset']=qs[_0xe41f('0x1c')](_0x348531['query'][_0xe41f('0x1c')]);}_0x1a182b['order']=qs[_0xe41f('0x38')](_0x348531['query']['sort']);_0x1a182b[_0xe41f('0x39')]=qs[_0xe41f('0x31')](_[_0xe41f('0x3a')](_0x348531[_0xe41f('0x30')],_0x4438cf[_0xe41f('0x31')]),_0x1c3c38);if(_0x348531['query'][_0xe41f('0x3b')]){_0x1a182b[_0xe41f('0x39')]=_[_0xe41f('0x3c')](_0x1a182b[_0xe41f('0x39')],{'$or':_[_0xe41f('0x2a')](_0x1c3c38,function(_0x10083c){if(_0x10083c[_0xe41f('0x3d')]!=='VIRTUAL'){var _0x438ead={};_0x438ead[_0x10083c[_0xe41f('0x27')]]={'$like':'%'+_0x348531[_0xe41f('0x30')][_0xe41f('0x3b')]+'%'};return _0x438ead;}})});}_0x1a182b=_[_0xe41f('0x3c')]({},_0x1a182b,_0x348531[_0xe41f('0x3e')]);var _0x2d0cf7={'where':_0x1a182b[_0xe41f('0x39')]};return db[_0xe41f('0x2b')]['count'](_0x2d0cf7)['then'](function(_0x537fbf){_0x6ec664['count']=_0x537fbf;if(_0x348531[_0xe41f('0x30')][_0xe41f('0x3f')]){_0x1a182b[_0xe41f('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xe41f('0x41')](_0x1a182b);})[_0xe41f('0x24')](function(_0x55bf6f){_0x6ec664['rows']=_0x55bf6f;return _0x6ec664;})[_0xe41f('0x24')](respondWithFilteredResult(_0x2a7bf4,_0x1a182b))[_0xe41f('0x42')](handleError(_0x2a7bf4,null));};exports[_0xe41f('0x43')]=function(_0x384001,_0x27bdee){var _0x56e180={'raw':!![],'where':{'id':_0x384001['params']['id']}},_0x82727b={};_0x82727b[_0xe41f('0x2f')]=_[_0xe41f('0x44')](db['JscriptyAnswerReport'][_0xe41f('0x2c')]);_0x82727b['query']=_[_0xe41f('0x44')](_0x384001[_0xe41f('0x30')]);_0x82727b[_0xe41f('0x31')]=_['intersection'](_0x82727b[_0xe41f('0x2f')],_0x82727b['query']);_0x56e180[_0xe41f('0x34')]=_[_0xe41f('0x32')](_0x82727b[_0xe41f('0x2f')],qs[_0xe41f('0x33')](_0x384001[_0xe41f('0x30')][_0xe41f('0x33')]));_0x56e180[_0xe41f('0x34')]=_0x56e180[_0xe41f('0x34')]['length']?_0x56e180[_0xe41f('0x34')]:_0x82727b['model'];if(_0x384001[_0xe41f('0x30')]['includeAll']){_0x56e180[_0xe41f('0x40')]=[{'all':!![]}];}_0x56e180=_[_0xe41f('0x3c')]({},_0x56e180,_0x384001[_0xe41f('0x3e')]);return db[_0xe41f('0x2b')]['find'](_0x56e180)[_0xe41f('0x24')](handleEntityNotFound(_0x27bdee,null))['then'](respondWithResult(_0x27bdee,null))[_0xe41f('0x42')](handleError(_0x27bdee,null));};exports[_0xe41f('0x45')]=function(_0x6154a,_0x3a5974){return db['JscriptyAnswerReport'][_0xe41f('0x45')](_0x6154a['body'],{})['then'](respondWithResult(_0x3a5974,0xc9))['catch'](handleError(_0x3a5974,null));};exports[_0xe41f('0x23')]=function(_0x25b374,_0x59ef57){if(_0x25b374[_0xe41f('0x46')]['id']){delete _0x25b374[_0xe41f('0x46')]['id'];}return db[_0xe41f('0x2b')][_0xe41f('0x47')]({'where':{'id':_0x25b374[_0xe41f('0x48')]['id']}})[_0xe41f('0x24')](handleEntityNotFound(_0x59ef57,null))[_0xe41f('0x24')](saveUpdates(_0x25b374[_0xe41f('0x46')],null))[_0xe41f('0x24')](respondWithResult(_0x59ef57,null))[_0xe41f('0x42')](handleError(_0x59ef57,null));};exports['destroy']=function(_0x119e32,_0x97c6c6){return db[_0xe41f('0x2b')]['find']({'where':{'id':_0x119e32[_0xe41f('0x48')]['id']}})[_0xe41f('0x24')](handleEntityNotFound(_0x97c6c6,null))[_0xe41f('0x24')](removeEntity(_0x97c6c6,null))[_0xe41f('0x42')](handleError(_0x97c6c6,null));};exports[_0xe41f('0x49')]=function(_0x4f8f47,_0x23cb73){return db[_0xe41f('0x2b')]['describe']()['then'](respondWithResult(_0x23cb73,null))['catch'](handleError(_0x23cb73,null));}; \ No newline at end of file +var _0x6f47=['undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','JscriptyAnswerReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','length','find','create','body','params','describe','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset'];(function(_0x511c73,_0x18515b){var _0x419a0f=function(_0x15d73a){while(--_0x15d73a){_0x511c73['push'](_0x511c73['shift']());}};_0x419a0f(++_0x18515b);}(_0x6f47,0xc7));var _0x76f4=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x6f47[_0x173441];return _0x2423a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76f4('0x0'));var zipdir=require(_0x76f4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76f4('0x2'));var moment=require('moment');var BPromise=require(_0x76f4('0x3'));var Mustache=require('mustache');var util=require(_0x76f4('0x4'));var path=require(_0x76f4('0x5'));var sox=require(_0x76f4('0x6'));var csv=require(_0x76f4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x76f4('0x8'));var _=require(_0x76f4('0x9'));var squel=require(_0x76f4('0xa'));var crypto=require('crypto');var jsforce=require(_0x76f4('0xb'));var deskjs=require(_0x76f4('0xc'));var toCsv=require(_0x76f4('0x7'));var querystring=require(_0x76f4('0xd'));var Papa=require(_0x76f4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x76f4('0xf'));var as=require(_0x76f4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x76f4('0x11'));var utils=require(_0x76f4('0x12'));var config=require(_0x76f4('0x13'));var licenseUtil=require(_0x76f4('0x14'));var db=require(_0x76f4('0x15'))['db'];function respondWithStatusCode(_0xafd21e,_0xf7e347){_0xf7e347=_0xf7e347||0xcc;return function(_0x3ec740){if(_0x3ec740){return _0xafd21e[_0x76f4('0x16')](_0xf7e347);}return _0xafd21e['status'](_0xf7e347)[_0x76f4('0x17')]();};}function respondWithResult(_0x30dabf,_0x5da1ff){_0x5da1ff=_0x5da1ff||0xc8;return function(_0x4b6021){if(_0x4b6021){return _0x30dabf['status'](_0x5da1ff)[_0x76f4('0x18')](_0x4b6021);}};}function respondWithFilteredResult(_0x3dd240,_0x979946){return function(_0x40252d){if(_0x40252d){var _0x3d8f5a=typeof _0x979946[_0x76f4('0x19')]===_0x76f4('0x1a')&&typeof _0x979946[_0x76f4('0x1b')]===_0x76f4('0x1a');var _0xb159a9=_0x40252d[_0x76f4('0x1c')];var _0x2d4bd1=_0x3d8f5a?0x0:_0x979946[_0x76f4('0x19')];var _0x38450e=_0x3d8f5a?_0x40252d[_0x76f4('0x1c')]:_0x979946[_0x76f4('0x19')]+_0x979946[_0x76f4('0x1b')];var _0x3e809f;if(_0x38450e>=_0xb159a9){_0x38450e=_0xb159a9;_0x3e809f=0xc8;}else{_0x3e809f=0xce;}_0x3dd240[_0x76f4('0x1d')](_0x3e809f);return _0x3dd240[_0x76f4('0x1e')](_0x76f4('0x1f'),_0x2d4bd1+'-'+_0x38450e+'/'+_0xb159a9)[_0x76f4('0x18')](_0x40252d);}return null;};}function patchUpdates(_0x5bf3d5){return function(_0x262937){try{jsonpatch['apply'](_0x262937,_0x5bf3d5,!![]);}catch(_0x13f3b1){return BPromise[_0x76f4('0x20')](_0x13f3b1);}return _0x262937[_0x76f4('0x21')]();};}function saveUpdates(_0x517c00,_0x567f2a){return function(_0x52da65){if(_0x52da65){return _0x52da65[_0x76f4('0x22')](_0x517c00)[_0x76f4('0x23')](function(_0x14bfe5){return _0x14bfe5;});}return null;};}function removeEntity(_0x2b6d51,_0x42ef70){return function(_0x4786c9){if(_0x4786c9){return _0x4786c9[_0x76f4('0x24')]()['then'](function(){_0x2b6d51['status'](0xcc)[_0x76f4('0x17')]();});}};}function handleEntityNotFound(_0x497913,_0x288365){return function(_0x5355bd){if(!_0x5355bd){_0x497913['sendStatus'](0x194);}return _0x5355bd;};}function handleError(_0x4f6087,_0x470242){_0x470242=_0x470242||0x1f4;return function(_0x38300d){logger[_0x76f4('0x25')](_0x38300d[_0x76f4('0x26')]);if(_0x38300d[_0x76f4('0x27')]){delete _0x38300d[_0x76f4('0x27')];}_0x4f6087['status'](_0x470242)[_0x76f4('0x28')](_0x38300d);};}exports['index']=function(_0x5346be,_0x5b3f07){var _0x10ddb4={},_0x30f02e={},_0x41dea4={'count':0x0,'rows':[]};var _0x1dea0e=_['map'](db[_0x76f4('0x29')]['rawAttributes'],function(_0x259c26){return{'name':_0x259c26[_0x76f4('0x2a')],'type':_0x259c26[_0x76f4('0x2b')][_0x76f4('0x2c')]};});_0x30f02e[_0x76f4('0x2d')]=_['map'](_0x1dea0e,'name');_0x30f02e[_0x76f4('0x2e')]=_[_0x76f4('0x2f')](_0x5346be[_0x76f4('0x2e')]);_0x30f02e[_0x76f4('0x30')]=_[_0x76f4('0x31')](_0x30f02e[_0x76f4('0x2d')],_0x30f02e[_0x76f4('0x2e')]);_0x10ddb4[_0x76f4('0x32')]=_[_0x76f4('0x31')](_0x30f02e[_0x76f4('0x2d')],qs[_0x76f4('0x33')](_0x5346be[_0x76f4('0x2e')]['fields']));_0x10ddb4['attributes']=_0x10ddb4['attributes']['length']?_0x10ddb4[_0x76f4('0x32')]:_0x30f02e[_0x76f4('0x2d')];if(!_0x5346be[_0x76f4('0x2e')][_0x76f4('0x34')](_0x76f4('0x35'))){_0x10ddb4['limit']=qs[_0x76f4('0x1b')](_0x5346be[_0x76f4('0x2e')][_0x76f4('0x1b')]);_0x10ddb4[_0x76f4('0x19')]=qs[_0x76f4('0x19')](_0x5346be[_0x76f4('0x2e')][_0x76f4('0x19')]);}_0x10ddb4[_0x76f4('0x36')]=qs[_0x76f4('0x37')](_0x5346be[_0x76f4('0x2e')][_0x76f4('0x37')]);_0x10ddb4[_0x76f4('0x38')]=qs[_0x76f4('0x30')](_[_0x76f4('0x39')](_0x5346be[_0x76f4('0x2e')],_0x30f02e[_0x76f4('0x30')]),_0x1dea0e);if(_0x5346be[_0x76f4('0x2e')][_0x76f4('0x3a')]){_0x10ddb4['where']=_[_0x76f4('0x3b')](_0x10ddb4[_0x76f4('0x38')],{'$or':_[_0x76f4('0x3c')](_0x1dea0e,function(_0x589637){if(_0x589637['type']!==_0x76f4('0x3d')){var _0x487926={};_0x487926[_0x589637[_0x76f4('0x27')]]={'$like':'%'+_0x5346be['query'][_0x76f4('0x3a')]+'%'};return _0x487926;}})});}_0x10ddb4=_[_0x76f4('0x3b')]({},_0x10ddb4,_0x5346be[_0x76f4('0x3e')]);var _0x378675={'where':_0x10ddb4[_0x76f4('0x38')]};return db[_0x76f4('0x29')][_0x76f4('0x1c')](_0x378675)[_0x76f4('0x23')](function(_0x16779e){_0x41dea4[_0x76f4('0x1c')]=_0x16779e;if(_0x5346be['query']['includeAll']){_0x10ddb4[_0x76f4('0x3f')]=[{'all':!![]}];}return db[_0x76f4('0x29')][_0x76f4('0x40')](_0x10ddb4);})[_0x76f4('0x23')](function(_0x2b7dc8){_0x41dea4[_0x76f4('0x41')]=_0x2b7dc8;return _0x41dea4;})[_0x76f4('0x23')](respondWithFilteredResult(_0x5b3f07,_0x10ddb4))[_0x76f4('0x42')](handleError(_0x5b3f07,null));};exports[_0x76f4('0x43')]=function(_0x5b667b,_0xbc3d7e){var _0xe744af={'raw':!![],'where':{'id':_0x5b667b['params']['id']}},_0x4f0d1a={};_0x4f0d1a[_0x76f4('0x2d')]=_[_0x76f4('0x2f')](db[_0x76f4('0x29')][_0x76f4('0x44')]);_0x4f0d1a[_0x76f4('0x2e')]=_['keys'](_0x5b667b[_0x76f4('0x2e')]);_0x4f0d1a[_0x76f4('0x30')]=_[_0x76f4('0x31')](_0x4f0d1a[_0x76f4('0x2d')],_0x4f0d1a[_0x76f4('0x2e')]);_0xe744af[_0x76f4('0x32')]=_['intersection'](_0x4f0d1a[_0x76f4('0x2d')],qs[_0x76f4('0x33')](_0x5b667b[_0x76f4('0x2e')]['fields']));_0xe744af['attributes']=_0xe744af[_0x76f4('0x32')][_0x76f4('0x45')]?_0xe744af[_0x76f4('0x32')]:_0x4f0d1a[_0x76f4('0x2d')];if(_0x5b667b[_0x76f4('0x2e')]['includeAll']){_0xe744af['include']=[{'all':!![]}];}_0xe744af=_[_0x76f4('0x3b')]({},_0xe744af,_0x5b667b['options']);return db[_0x76f4('0x29')][_0x76f4('0x46')](_0xe744af)['then'](handleEntityNotFound(_0xbc3d7e,null))['then'](respondWithResult(_0xbc3d7e,null))[_0x76f4('0x42')](handleError(_0xbc3d7e,null));};exports[_0x76f4('0x47')]=function(_0x3f35ce,_0x217d3a){return db['JscriptyAnswerReport'][_0x76f4('0x47')](_0x3f35ce[_0x76f4('0x48')],{})[_0x76f4('0x23')](respondWithResult(_0x217d3a,0xc9))['catch'](handleError(_0x217d3a,null));};exports[_0x76f4('0x22')]=function(_0x6bbcf2,_0x535eca){if(_0x6bbcf2['body']['id']){delete _0x6bbcf2[_0x76f4('0x48')]['id'];}return db[_0x76f4('0x29')][_0x76f4('0x46')]({'where':{'id':_0x6bbcf2[_0x76f4('0x49')]['id']}})[_0x76f4('0x23')](handleEntityNotFound(_0x535eca,null))['then'](saveUpdates(_0x6bbcf2[_0x76f4('0x48')],null))['then'](respondWithResult(_0x535eca,null))[_0x76f4('0x42')](handleError(_0x535eca,null));};exports[_0x76f4('0x24')]=function(_0x270baf,_0x5e9a45){return db[_0x76f4('0x29')][_0x76f4('0x46')]({'where':{'id':_0x270baf['params']['id']}})[_0x76f4('0x23')](handleEntityNotFound(_0x5e9a45,null))[_0x76f4('0x23')](removeEntity(_0x5e9a45,null))[_0x76f4('0x42')](handleError(_0x5e9a45,null));};exports[_0x76f4('0x4a')]=function(_0x40ff20,_0x479c4b){return db[_0x76f4('0x29')]['describe']()[_0x76f4('0x23')](respondWithResult(_0x479c4b,null))[_0x76f4('0x42')](handleError(_0x479c4b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 3164699..018dc96 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 _0x1c00=['exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','request-promise','path','./jscriptyAnswerReport.attributes'];(function(_0x53811d,_0xf7084f){var _0x1188d8=function(_0x64aceb){while(--_0x64aceb){_0x53811d['push'](_0x53811d['shift']());}};_0x1188d8(++_0xf7084f);}(_0x1c00,0x90));var _0x01c0=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x1c00[_0x5c9307];return _0x373e29;};'use strict';var _=require(_0x01c0('0x0'));var util=require(_0x01c0('0x1'));var logger=require(_0x01c0('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x01c0('0x3'));var fs=require('fs');var path=require(_0x01c0('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x01c0('0x5'));module[_0x01c0('0x6')]=function(_0x36170f,_0x241231){return _0x36170f[_0x01c0('0x7')](_0x01c0('0x8'),attributes,{'tableName':_0x01c0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d26=['bluebird','request-promise','path','../../config/environment','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment'];(function(_0x3bb4f6,_0x1cc17d){var _0x8bbf67=function(_0x486254){while(--_0x486254){_0x3bb4f6['push'](_0x3bb4f6['shift']());}};_0x8bbf67(++_0x1cc17d);}(_0x4d26,0x1a8));var _0x64d2=function(_0x339f9e,_0xafb49a){_0x339f9e=_0x339f9e-0x0;var _0x73545f=_0x4d26[_0x339f9e];return _0x73545f;};'use strict';var _=require(_0x64d2('0x0'));var util=require(_0x64d2('0x1'));var logger=require(_0x64d2('0x2'))(_0x64d2('0x3'));var moment=require(_0x64d2('0x4'));var BPromise=require(_0x64d2('0x5'));var rp=require(_0x64d2('0x6'));var fs=require('fs');var path=require(_0x64d2('0x7'));var rimraf=require('rimraf');var config=require(_0x64d2('0x8'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x64d2('0x9')]=function(_0x5e3bd1,_0x2a5bf0){return _0x5e3bd1[_0x64d2('0xa')](_0x64d2('0xb'),attributes,{'tableName':_0x64d2('0xc'),'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 5dd6e10..0f6e656 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 _0xcc5f=['rpc','../../config/environment','jayson/promise','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc5f,0x87));var _0xfcc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc5f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xfcc5('0x0'));var moment=require(_0xfcc5('0x1'));var BPromise=require(_0xfcc5('0x2'));var rs=require(_0xfcc5('0x3'));var fs=require('fs');var Redis=require(_0xfcc5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfcc5('0x5'));var config=require(_0xfcc5('0x6'));var jayson=require(_0xfcc5('0x7'));var client=jayson['client'][_0xfcc5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x269cf9,_0x22b5df,_0x3be9c9){return new BPromise(function(_0x4306f2,_0xc2202b){return client['request'](_0x269cf9,_0x3be9c9)[_0xfcc5('0x9')](function(_0x5f5a6a){logger[_0xfcc5('0xa')](_0xfcc5('0xb'),_0x22b5df,_0xfcc5('0xc'));logger['debug'](_0xfcc5('0xd'),_0x22b5df,'request\x20sent',JSON[_0xfcc5('0xe')](_0x5f5a6a));if(_0x5f5a6a['error']){if(_0x5f5a6a[_0xfcc5('0xf')][_0xfcc5('0x10')]===0x1f4){logger[_0xfcc5('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x22b5df,_0x5f5a6a[_0xfcc5('0xf')][_0xfcc5('0x11')]);return _0xc2202b(_0x5f5a6a['error'][_0xfcc5('0x11')]);}logger[_0xfcc5('0xf')](_0xfcc5('0xb'),_0x22b5df,_0x5f5a6a['error'][_0xfcc5('0x11')]);return _0x4306f2(_0x5f5a6a[_0xfcc5('0xf')][_0xfcc5('0x11')]);}else{logger[_0xfcc5('0xa')](_0xfcc5('0xb'),_0x22b5df,_0xfcc5('0xc'));_0x4306f2(_0x5f5a6a[_0xfcc5('0x12')]['message']);}})[_0xfcc5('0x13')](function(_0xd4c0b9){logger['error'](_0xfcc5('0xb'),_0x22b5df,_0xd4c0b9);_0xc2202b(_0xd4c0b9);});});} \ No newline at end of file +var _0xfdd1=['stringify','error','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xfdd1,0x90));var _0x1fdd=function(_0x469c7c,_0x4a54c6){_0x469c7c=_0x469c7c-0x0;var _0x4b8ffa=_0xfdd1[_0x469c7c];return _0x4b8ffa;};'use strict';var _=require('lodash');var util=require(_0x1fdd('0x0'));var moment=require(_0x1fdd('0x1'));var BPromise=require('bluebird');var rs=require(_0x1fdd('0x2'));var fs=require('fs');var Redis=require(_0x1fdd('0x3'));var db=require(_0x1fdd('0x4'))['db'];var utils=require(_0x1fdd('0x5'));var logger=require(_0x1fdd('0x6'))('rpc');var config=require(_0x1fdd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1fdd('0x8')][_0x1fdd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37ecd5,_0x4f4341,_0x29ddf8){return new BPromise(function(_0x3db7e9,_0x31ee9a){return client[_0x1fdd('0xa')](_0x37ecd5,_0x29ddf8)[_0x1fdd('0xb')](function(_0x2a2f1e){logger['info'](_0x1fdd('0xc'),_0x4f4341,_0x1fdd('0xd'));logger[_0x1fdd('0xe')](_0x1fdd('0xf'),_0x4f4341,'request\x20sent',JSON[_0x1fdd('0x10')](_0x2a2f1e));if(_0x2a2f1e['error']){if(_0x2a2f1e[_0x1fdd('0x11')]['code']===0x1f4){logger[_0x1fdd('0x11')](_0x1fdd('0xc'),_0x4f4341,_0x2a2f1e['error'][_0x1fdd('0x12')]);return _0x31ee9a(_0x2a2f1e[_0x1fdd('0x11')]['message']);}logger[_0x1fdd('0x11')](_0x1fdd('0xc'),_0x4f4341,_0x2a2f1e['error']['message']);return _0x3db7e9(_0x2a2f1e['error'][_0x1fdd('0x12')]);}else{logger['info'](_0x1fdd('0xc'),_0x4f4341,_0x1fdd('0xd'));_0x3db7e9(_0x2a2f1e[_0x1fdd('0x13')][_0x1fdd('0x12')]);}})['catch'](function(_0x32bac2){logger['error'](_0x1fdd('0xc'),_0x4f4341,_0x32bac2);_0x31ee9a(_0x32bac2);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 671eac4..da6c13f 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 _0xae0b=['../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','create','put','update','delete','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x4a1794,_0x5c4c1f){var _0x46858a=function(_0x183b8d){while(--_0x183b8d){_0x4a1794['push'](_0x4a1794['shift']());}};_0x46858a(++_0x5c4c1f);}(_0xae0b,0xa2));var _0xbae0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xae0b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbae0('0x0'));var util=require(_0xbae0('0x1'));var path=require('path');var timeout=require(_0xbae0('0x2'));var express=require(_0xbae0('0x3'));var router=express[_0xbae0('0x4')]();var fs_extra=require(_0xbae0('0x5'));var auth=require(_0xbae0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbae0('0x7'));var controller=require(_0xbae0('0x8'));router[_0xbae0('0x9')]('/',auth[_0xbae0('0xa')](),controller[_0xbae0('0xb')]);router[_0xbae0('0x9')](_0xbae0('0xc'),auth['isAuthenticated'](),controller[_0xbae0('0xd')]);router[_0xbae0('0x9')](_0xbae0('0xe'),auth[_0xbae0('0xa')](),controller['getSessions']);router['get'](_0xbae0('0xf'),auth[_0xbae0('0xa')](),controller[_0xbae0('0x10')]);router[_0xbae0('0x9')](_0xbae0('0x11'),auth[_0xbae0('0xa')](),timeout('30s'),controller[_0xbae0('0x12')]);router[_0xbae0('0x13')]('/',auth['isAuthenticated'](),controller[_0xbae0('0x14')]);router[_0xbae0('0x13')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0xbae0('0x15')](_0xbae0('0xc'),auth[_0xbae0('0xa')](),controller[_0xbae0('0x16')]);router[_0xbae0('0x17')](_0xbae0('0xc'),auth[_0xbae0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4cbe=['./jscriptyProject.controller','get','isAuthenticated','getSessions','/:id/answers','/:id/summary','getSummary','post','/:id/clone','clone','put','/:id','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x23b87c,_0x3132ac){var _0x3d15d6=function(_0x335323){while(--_0x335323){_0x23b87c['push'](_0x23b87c['shift']());}};_0x3d15d6(++_0x3132ac);}(_0x4cbe,0x17f));var _0xe4cb=function(_0x5e4ffc,_0x751a36){_0x5e4ffc=_0x5e4ffc-0x0;var _0x46c9ed=_0x4cbe[_0x5e4ffc];return _0x46c9ed;};'use strict';var multer=require(_0xe4cb('0x0'));var util=require(_0xe4cb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe4cb('0x2'));var router=express[_0xe4cb('0x3')]();var fs_extra=require(_0xe4cb('0x4'));var auth=require(_0xe4cb('0x5'));var interaction=require(_0xe4cb('0x6'));var config=require(_0xe4cb('0x7'));var controller=require(_0xe4cb('0x8'));router[_0xe4cb('0x9')]('/',auth[_0xe4cb('0xa')](),controller['index']);router[_0xe4cb('0x9')]('/:id',auth[_0xe4cb('0xa')](),controller['show']);router[_0xe4cb('0x9')]('/:id/sessions',auth[_0xe4cb('0xa')](),controller[_0xe4cb('0xb')]);router[_0xe4cb('0x9')](_0xe4cb('0xc'),auth[_0xe4cb('0xa')](),controller['getAnswers']);router[_0xe4cb('0x9')](_0xe4cb('0xd'),auth[_0xe4cb('0xa')](),timeout('30s'),controller[_0xe4cb('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe4cb('0xf')](_0xe4cb('0x10'),auth[_0xe4cb('0xa')](),controller[_0xe4cb('0x11')]);router[_0xe4cb('0x12')](_0xe4cb('0x13'),auth[_0xe4cb('0xa')](),controller[_0xe4cb('0x14')]);router['delete'](_0xe4cb('0x13'),auth[_0xe4cb('0xa')](),controller[_0xe4cb('0x15')]);module[_0xe4cb('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index c337e5c..85381b7 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 _0x65a4=['isString','format','getDataValue','BOOLEAN','sequelize','lodash','name','STRING','TEXT','long','isObjectLike','setDataValue','formData','stringify'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x65a4,0x17e));var _0x465a=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x65a4[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x465a('0x0'));var _=require(_0x465a('0x1'));var util=require('util');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x465a('0x2')},'description':{'type':Sequelize[_0x465a('0x3')]},'formData':{'type':Sequelize[_0x465a('0x4')](_0x465a('0x5')),'set':function(_0x938b10){if(_[_0x465a('0x6')](_0x938b10)){this[_0x465a('0x7')](_0x465a('0x8'),JSON[_0x465a('0x9')](_0x938b10));}else if(_[_0x465a('0xa')](_0x938b10)){this[_0x465a('0x7')](_0x465a('0x8'),_0x938b10);}else{this['setDataValue'](_0x465a('0x8'),util[_0x465a('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0x465a('0x2'))||'',this[_0x465a('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x465a('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x465a('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x879f=['isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify'];(function(_0x558099,_0x4be744){var _0x18ac2e=function(_0x1e1e9b){while(--_0x1e1e9b){_0x558099['push'](_0x558099['shift']());}};_0x18ac2e(++_0x4be744);}(_0x879f,0xf5));var _0xf879=function(_0x527441,_0x5eed69){_0x527441=_0x527441-0x0;var _0x23dc0c=_0x879f[_0x527441];return _0x23dc0c;};'use strict';var Sequelize=require(_0xf879('0x0'));var _=require(_0xf879('0x1'));var util=require(_0xf879('0x2'));module['exports']={'name':{'type':Sequelize[_0xf879('0x3')],'unique':_0xf879('0x4')},'description':{'type':Sequelize[_0xf879('0x3')]},'formData':{'type':Sequelize[_0xf879('0x5')](_0xf879('0x6')),'set':function(_0x5beeb7){if(_[_0xf879('0x7')](_0x5beeb7)){this[_0xf879('0x8')](_0xf879('0x9'),JSON[_0xf879('0xa')](_0x5beeb7));}else if(_[_0xf879('0xb')](_0x5beeb7)){this[_0xf879('0x8')]('formData',_0x5beeb7);}else{this[_0xf879('0x8')](_0xf879('0x9'),util['format'](_0xf879('0xc'),this[_0xf879('0xd')](_0xf879('0x4'))||'',this[_0xf879('0xd')](_0xf879('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xf879('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xf879('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index a80f77b..03a165d 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 _0xb78e=['error','stack','name','send','index','JscriptyProject','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','omit','updatedAt','createdAt','role','update','getSessions','findOne','JscriptySessionReport','pick','ProjectId','JscriptyAnswerReport','number','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','download','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','sendStatus','status','end','offset','undefined','count','json','apply','reject','save','destroy','Projects','UserProfileResource','then'];(function(_0x3be004,_0x49c209){var _0x262593=function(_0xd79653){while(--_0xd79653){_0x3be004['push'](_0x3be004['shift']());}};_0x262593(++_0x49c209);}(_0xb78e,0x1c9));var _0xeb78=function(_0x312c4f,_0x82111a){_0x312c4f=_0x312c4f-0x0;var _0x1fc598=_0xb78e[_0x312c4f];return _0x1fc598;};'use strict';var emlformat=require(_0xeb78('0x0'));var rimraf=require(_0xeb78('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb78('0x2'));var rp=require(_0xeb78('0x3'));var moment=require(_0xeb78('0x4'));var BPromise=require(_0xeb78('0x5'));var Mustache=require(_0xeb78('0x6'));var util=require(_0xeb78('0x7'));var path=require(_0xeb78('0x8'));var sox=require(_0xeb78('0x9'));var csv=require('to-csv');var ejs=require(_0xeb78('0xa'));var fs=require('fs');var fs_extra=require(_0xeb78('0xb'));var _=require(_0xeb78('0xc'));var squel=require(_0xeb78('0xd'));var crypto=require(_0xeb78('0xe'));var jsforce=require(_0xeb78('0xf'));var deskjs=require(_0xeb78('0x10'));var toCsv=require('to-csv');var querystring=require(_0xeb78('0x11'));var Papa=require(_0xeb78('0x12'));var Redis=require(_0xeb78('0x13'));var authService=require(_0xeb78('0x14'));var qs=require(_0xeb78('0x15'));var as=require(_0xeb78('0x16'));var hardwareService=require(_0xeb78('0x17'));var logger=require(_0xeb78('0x18'))(_0xeb78('0x19'));var utils=require('../../config/utils');var config=require(_0xeb78('0x1a'));var licenseUtil=require(_0xeb78('0x1b'));var db=require(_0xeb78('0x1c'))['db'];function respondWithStatusCode(_0x259df2,_0x9dbe51){_0x9dbe51=_0x9dbe51||0xcc;return function(_0x28c58c){if(_0x28c58c){return _0x259df2[_0xeb78('0x1d')](_0x9dbe51);}return _0x259df2[_0xeb78('0x1e')](_0x9dbe51)[_0xeb78('0x1f')]();};}function respondWithResult(_0x9bcc79,_0x5d50cf){_0x5d50cf=_0x5d50cf||0xc8;return function(_0x315914){if(_0x315914){return _0x9bcc79[_0xeb78('0x1e')](_0x5d50cf)['json'](_0x315914);}};}function respondWithFilteredResult(_0x538485,_0x53be89){return function(_0x23a0d0){if(_0x23a0d0){var _0x50ebae=typeof _0x53be89[_0xeb78('0x20')]===_0xeb78('0x21')&&typeof _0x53be89['limit']===_0xeb78('0x21');var _0x53c811=_0x23a0d0[_0xeb78('0x22')];var _0x92e410=_0x50ebae?0x0:_0x53be89['offset'];var _0x45176e=_0x50ebae?_0x23a0d0[_0xeb78('0x22')]:_0x53be89[_0xeb78('0x20')]+_0x53be89['limit'];var _0x24d845;if(_0x45176e>=_0x53c811){_0x45176e=_0x53c811;_0x24d845=0xc8;}else{_0x24d845=0xce;}_0x538485[_0xeb78('0x1e')](_0x24d845);return _0x538485['set']('Content-Range',_0x92e410+'-'+_0x45176e+'/'+_0x53c811)[_0xeb78('0x23')](_0x23a0d0);}return null;};}function patchUpdates(_0x106c5d){return function(_0x42eacb){try{jsonpatch[_0xeb78('0x24')](_0x42eacb,_0x106c5d,!![]);}catch(_0x432b18){return BPromise[_0xeb78('0x25')](_0x432b18);}return _0x42eacb[_0xeb78('0x26')]();};}function saveUpdates(_0x3ea071,_0x18f08d){return function(_0x52b8c1){if(_0x52b8c1){return _0x52b8c1['update'](_0x3ea071)['then'](function(_0x5c9e0d){return _0x5c9e0d;});}return null;};}function removeEntity(_0x3c8e66,_0x5b15d8){return function(_0x2159c1){if(_0x2159c1){return _0x2159c1[_0xeb78('0x27')]()['then'](function(){var _0x777ca3=_0x2159c1['get']({'plain':!![]});var _0x9a00b=_0xeb78('0x28');return db[_0xeb78('0x29')][_0xeb78('0x27')]({'where':{'type':_0x9a00b,'resourceId':_0x777ca3['id']}})['then'](function(){return _0x2159c1;});})[_0xeb78('0x2a')](function(){_0x3c8e66['status'](0xcc)[_0xeb78('0x1f')]();});}};}function handleEntityNotFound(_0x23295a,_0x4493bb){return function(_0x5263fc){if(!_0x5263fc){_0x23295a[_0xeb78('0x1d')](0x194);}return _0x5263fc;};}function handleError(_0x1e7d56,_0x1c04dd){_0x1c04dd=_0x1c04dd||0x1f4;return function(_0x381b2f){logger[_0xeb78('0x2b')](_0x381b2f[_0xeb78('0x2c')]);if(_0x381b2f[_0xeb78('0x2d')]){delete _0x381b2f[_0xeb78('0x2d')];}_0x1e7d56[_0xeb78('0x1e')](_0x1c04dd)[_0xeb78('0x2e')](_0x381b2f);};}exports[_0xeb78('0x2f')]=function(_0x505468,_0x555d89){var _0x4d12a3={},_0xb3a935={},_0x4253ea={'count':0x0,'rows':[]};var _0x15327f=_['map'](db[_0xeb78('0x30')][_0xeb78('0x31')],function(_0x3de59f){return{'name':_0x3de59f[_0xeb78('0x32')],'type':_0x3de59f[_0xeb78('0x33')][_0xeb78('0x34')]};});_0xb3a935[_0xeb78('0x35')]=_[_0xeb78('0x36')](_0x15327f,_0xeb78('0x2d'));_0xb3a935['query']=_[_0xeb78('0x37')](_0x505468['query']);_0xb3a935[_0xeb78('0x38')]=_[_0xeb78('0x39')](_0xb3a935[_0xeb78('0x35')],_0xb3a935[_0xeb78('0x3a')]);_0x4d12a3[_0xeb78('0x3b')]=_[_0xeb78('0x39')](_0xb3a935['model'],qs['fields'](_0x505468[_0xeb78('0x3a')][_0xeb78('0x3c')]));_0x4d12a3[_0xeb78('0x3b')]=_0x4d12a3[_0xeb78('0x3b')][_0xeb78('0x3d')]?_0x4d12a3['attributes']:_0xb3a935[_0xeb78('0x35')];if(!_0x505468[_0xeb78('0x3a')][_0xeb78('0x3e')](_0xeb78('0x3f'))){_0x4d12a3[_0xeb78('0x40')]=qs[_0xeb78('0x40')](_0x505468['query']['limit']);_0x4d12a3['offset']=qs['offset'](_0x505468[_0xeb78('0x3a')][_0xeb78('0x20')]);}_0x4d12a3[_0xeb78('0x41')]=qs['sort'](_0x505468[_0xeb78('0x3a')][_0xeb78('0x42')]);_0x4d12a3['where']=qs['filters'](_['pick'](_0x505468[_0xeb78('0x3a')],_0xb3a935[_0xeb78('0x38')]),_0x15327f);if(_0x505468[_0xeb78('0x3a')]['filter']){_0x4d12a3[_0xeb78('0x43')]=_[_0xeb78('0x44')](_0x4d12a3[_0xeb78('0x43')],{'$or':_['map'](_0x15327f,function(_0xf0f13c){if(_0xf0f13c[_0xeb78('0x33')]!==_0xeb78('0x45')){var _0x437590={};_0x437590[_0xf0f13c['name']]={'$like':'%'+_0x505468['query'][_0xeb78('0x46')]+'%'};return _0x437590;}})});}_0x4d12a3=_[_0xeb78('0x44')]({},_0x4d12a3,_0x505468[_0xeb78('0x47')]);var _0x183095={'where':_0x4d12a3[_0xeb78('0x43')]};return db[_0xeb78('0x30')][_0xeb78('0x22')](_0x183095)[_0xeb78('0x2a')](function(_0x47567d){_0x4253ea['count']=_0x47567d;if(_0x505468[_0xeb78('0x3a')][_0xeb78('0x48')]){_0x4d12a3[_0xeb78('0x49')]=[{'all':!![]}];}return db['JscriptyProject'][_0xeb78('0x4a')](_0x4d12a3);})['then'](function(_0x21f81b){_0x4253ea[_0xeb78('0x4b')]=_0x21f81b;return _0x4253ea;})[_0xeb78('0x2a')](respondWithFilteredResult(_0x555d89,_0x4d12a3))['catch'](handleError(_0x555d89,null));};exports[_0xeb78('0x4c')]=function(_0x3ab487,_0x390051){var _0x2944d8={'raw':![],'where':{'id':_0x3ab487['params']['id']}},_0x2dc9f7={};_0x2dc9f7[_0xeb78('0x35')]=_[_0xeb78('0x37')](db['JscriptyProject'][_0xeb78('0x31')]);_0x2dc9f7[_0xeb78('0x3a')]=_[_0xeb78('0x37')](_0x3ab487['query']);_0x2dc9f7[_0xeb78('0x38')]=_[_0xeb78('0x39')](_0x2dc9f7[_0xeb78('0x35')],_0x2dc9f7[_0xeb78('0x3a')]);_0x2944d8[_0xeb78('0x3b')]=_[_0xeb78('0x39')](_0x2dc9f7['model'],qs['fields'](_0x3ab487[_0xeb78('0x3a')][_0xeb78('0x3c')]));_0x2944d8['attributes']=_0x2944d8[_0xeb78('0x3b')][_0xeb78('0x3d')]?_0x2944d8[_0xeb78('0x3b')]:_0x2dc9f7[_0xeb78('0x35')];if(_0x3ab487[_0xeb78('0x3a')][_0xeb78('0x48')]){_0x2944d8[_0xeb78('0x49')]=[{'all':!![]}];}_0x2944d8=_[_0xeb78('0x44')]({},_0x2944d8,_0x3ab487[_0xeb78('0x47')]);return db[_0xeb78('0x30')][_0xeb78('0x4d')](_0x2944d8)[_0xeb78('0x2a')](handleEntityNotFound(_0x390051,null))[_0xeb78('0x2a')](respondWithResult(_0x390051,null))[_0xeb78('0x4e')](handleError(_0x390051,null));};exports[_0xeb78('0x4f')]=function(_0x58e361,_0x2c4616){return db[_0xeb78('0x30')][_0xeb78('0x4f')](_0x58e361[_0xeb78('0x50')],{})['then'](function(_0x35cedb){var _0x135106=_0x58e361[_0xeb78('0x51')][_0xeb78('0x52')]({'plain':!![]});if(!_0x135106)throw new Error(_0xeb78('0x53'));if(_0x135106['role']==='user'){var _0x553f6d=_0x35cedb[_0xeb78('0x52')]({'plain':!![]});var _0x21ee21='Projects';return db[_0xeb78('0x54')][_0xeb78('0x4d')]({'where':{'name':_0x21ee21,'userProfileId':_0x135106[_0xeb78('0x55')]},'raw':!![]})['then'](function(_0x4d6a21){if(_0x4d6a21&&_0x4d6a21[_0xeb78('0x56')]===0x0){return db[_0xeb78('0x29')][_0xeb78('0x4f')]({'name':_0x553f6d['name'],'resourceId':_0x553f6d['id'],'type':_0x4d6a21[_0xeb78('0x2d')],'sectionId':_0x4d6a21['id']},{})[_0xeb78('0x2a')](function(){return _0x35cedb;});}else{return _0x35cedb;}})[_0xeb78('0x4e')](function(_0x4a3c91){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a3c91);throw _0x4a3c91;});}return _0x35cedb;})[_0xeb78('0x2a')](respondWithResult(_0x2c4616,0xc9))[_0xeb78('0x4e')](handleError(_0x2c4616,null));};exports['clone']=function(_0x2b42f6,_0x31eb10){var _0x2a77c8={'where':{'id':_0x2b42f6[_0xeb78('0x57')]['id']}},_0x52534f={};_0x52534f['model']=_[_0xeb78('0x37')](db[_0xeb78('0x30')][_0xeb78('0x31')]);_0x2a77c8['attributes']=_['intersection'](_0x52534f['model'],qs['fields'](_0x2b42f6[_0xeb78('0x3a')]['fields']));_0x2a77c8[_0xeb78('0x3b')]=_0x2a77c8[_0xeb78('0x3b')][_0xeb78('0x3d')]?_0x2a77c8[_0xeb78('0x3b')]:_0x52534f[_0xeb78('0x35')];if(_0x2b42f6[_0xeb78('0x3a')]['includeAll']){_0x2a77c8['include']=[{'all':!![]}];}_0x2a77c8=_[_0xeb78('0x44')]({},_0x2a77c8,_0x2b42f6[_0xeb78('0x47')]);return db[_0xeb78('0x30')][_0xeb78('0x4d')](_0x2a77c8)['then'](handleEntityNotFound(_0x31eb10,null))[_0xeb78('0x2a')](function(_0x511d01){if(_0x511d01){var _0x4cb7e6=_0x511d01[_0xeb78('0x52')]({'plain':!![]});_0x4cb7e6=qs[_0xeb78('0x58')](_0x4cb7e6,['id','createdAt',_0xeb78('0x59')]);_0x2b42f6[_0xeb78('0x50')]=_['omit'](_0x2b42f6['body'],['id',_0xeb78('0x5a'),_0xeb78('0x59')]);return db['JscriptyProject'][_0xeb78('0x4f')](_[_0xeb78('0x44')](_0x4cb7e6,_0x2b42f6['body']),{'include':_0x2b42f6['query'][_0xeb78('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x539ad7){var _0x2029ea=_0x2b42f6['user'][_0xeb78('0x52')]({'plain':!![]});if(!_0x2029ea)throw new Error(_0xeb78('0x53'));if(_0x2029ea[_0xeb78('0x5b')]==='user'){var _0x2029ce=_0x539ad7[_0xeb78('0x52')]({'plain':!![]});var _0x1eb889='Projects';return db[_0xeb78('0x54')][_0xeb78('0x4d')]({'where':{'name':_0x1eb889,'userProfileId':_0x2029ea[_0xeb78('0x55')]},'raw':!![]})[_0xeb78('0x2a')](function(_0x45aeaf){if(_0x45aeaf&&_0x45aeaf[_0xeb78('0x56')]===0x0){return db['UserProfileResource'][_0xeb78('0x4f')]({'name':_0x2029ce['name'],'resourceId':_0x2029ce['id'],'type':_0x45aeaf[_0xeb78('0x2d')],'sectionId':_0x45aeaf['id']},{})[_0xeb78('0x2a')](function(){return _0x539ad7;});}else{return _0x539ad7;}})[_0xeb78('0x4e')](function(_0x442fa7){logger[_0xeb78('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x442fa7);throw _0x442fa7;});}return _0x539ad7;});}})[_0xeb78('0x2a')](respondWithResult(_0x31eb10,0xc9))[_0xeb78('0x4e')](handleError(_0x31eb10,null));};exports[_0xeb78('0x5c')]=function(_0x22aa3a,_0x3eb9c5){if(_0x22aa3a[_0xeb78('0x50')]['id']){delete _0x22aa3a[_0xeb78('0x50')]['id'];}return db[_0xeb78('0x30')][_0xeb78('0x4d')]({'where':{'id':_0x22aa3a[_0xeb78('0x57')]['id']}})[_0xeb78('0x2a')](handleEntityNotFound(_0x3eb9c5,null))[_0xeb78('0x2a')](saveUpdates(_0x22aa3a[_0xeb78('0x50')],null))[_0xeb78('0x2a')](respondWithResult(_0x3eb9c5,null))[_0xeb78('0x4e')](handleError(_0x3eb9c5,null));};exports[_0xeb78('0x27')]=function(_0x545c78,_0x155a4b){return db[_0xeb78('0x30')][_0xeb78('0x4d')]({'where':{'id':_0x545c78['params']['id']}})[_0xeb78('0x2a')](handleEntityNotFound(_0x155a4b,null))[_0xeb78('0x2a')](removeEntity(_0x155a4b,null))[_0xeb78('0x4e')](handleError(_0x155a4b,null));};exports[_0xeb78('0x5d')]=function(_0xe88f54,_0x2d6f67,_0xed6de9){var _0xb4b5bd={'raw':!![],'where':{}};var _0x411252={};var _0x4f7714={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xeb78('0x5e')]({'where':{'id':_0xe88f54[_0xeb78('0x57')]['id']}})[_0xeb78('0x2a')](handleEntityNotFound(_0x2d6f67,null))[_0xeb78('0x2a')](function(_0x355baa){if(_0x355baa){_0x411252[_0xeb78('0x35')]=_[_0xeb78('0x37')](db[_0xeb78('0x5f')][_0xeb78('0x31')]);_0x411252[_0xeb78('0x3a')]=_['keys'](_0xe88f54[_0xeb78('0x3a')]);_0x411252[_0xeb78('0x38')]=_[_0xeb78('0x39')](_0x411252['model'],_0x411252['query']);_0xb4b5bd['attributes']=_['intersection'](_0x411252[_0xeb78('0x35')],qs[_0xeb78('0x3c')](_0xe88f54[_0xeb78('0x3a')][_0xeb78('0x3c')]));_0xb4b5bd[_0xeb78('0x3b')]=_0xb4b5bd[_0xeb78('0x3b')][_0xeb78('0x3d')]?_0xb4b5bd[_0xeb78('0x3b')]:_0x411252[_0xeb78('0x35')];if(!_0xe88f54[_0xeb78('0x3a')][_0xeb78('0x3e')]('nolimit')){_0xb4b5bd[_0xeb78('0x40')]=qs['limit'](_0xe88f54[_0xeb78('0x3a')]['limit']);_0xb4b5bd[_0xeb78('0x20')]=qs[_0xeb78('0x20')](_0xe88f54[_0xeb78('0x3a')][_0xeb78('0x20')]);}_0xb4b5bd[_0xeb78('0x41')]=qs['sort'](_0xe88f54[_0xeb78('0x3a')][_0xeb78('0x42')]);_0xb4b5bd[_0xeb78('0x43')]=qs[_0xeb78('0x38')](_[_0xeb78('0x60')](_0xe88f54[_0xeb78('0x3a')],_0x411252[_0xeb78('0x38')]));_0xb4b5bd[_0xeb78('0x43')][_0xeb78('0x61')]=_0x355baa['id'];if(_0xe88f54[_0xeb78('0x3a')]['filter']){_0xb4b5bd[_0xeb78('0x43')]=_[_0xeb78('0x44')](_0xb4b5bd[_0xeb78('0x43')],{'$or':_[_0xeb78('0x36')](_0xb4b5bd[_0xeb78('0x3b')],function(_0x1ad543){var _0x37217c={};_0x37217c[_0x1ad543]={'$like':'%'+_0xe88f54['query'][_0xeb78('0x46')]+'%'};return _0x37217c;})});}_0xb4b5bd=_['merge']({},_0xb4b5bd,_0xe88f54[_0xeb78('0x47')]);return db[_0xeb78('0x5f')][_0xeb78('0x22')]({'where':_0xb4b5bd['where']})[_0xeb78('0x2a')](function(_0x45fead){_0x4f7714['count']=_0x45fead;if(_0xe88f54[_0xeb78('0x3a')][_0xeb78('0x48')]){_0xb4b5bd['include']=[{'all':!![]}];}return db[_0xeb78('0x5f')][_0xeb78('0x4a')](_0xb4b5bd);})[_0xeb78('0x2a')](function(_0x557361){_0x4f7714[_0xeb78('0x4b')]=_0x557361;return _0x4f7714;});}})[_0xeb78('0x2a')](respondWithFilteredResult(_0x2d6f67,_0xb4b5bd))[_0xeb78('0x4e')](handleError(_0x2d6f67,null));};exports['getAnswers']=function(_0x45e8e5,_0x348aaa,_0x48d142){var _0x5ec703={'raw':!![],'where':{}};var _0x5bd3cb={};var _0x4e73fb={'count':0x0,'rows':[]};return db[_0xeb78('0x30')][_0xeb78('0x5e')]({'where':{'id':_0x45e8e5[_0xeb78('0x57')]['id']}})[_0xeb78('0x2a')](handleEntityNotFound(_0x348aaa,null))[_0xeb78('0x2a')](function(_0x468483){if(_0x468483){_0x5bd3cb[_0xeb78('0x35')]=_[_0xeb78('0x37')](db[_0xeb78('0x62')][_0xeb78('0x31')]);_0x5bd3cb[_0xeb78('0x3a')]=_[_0xeb78('0x37')](_0x45e8e5[_0xeb78('0x3a')]);_0x5bd3cb['filters']=_['intersection'](_0x5bd3cb[_0xeb78('0x35')],_0x5bd3cb[_0xeb78('0x3a')]);_0x5ec703[_0xeb78('0x3b')]=_[_0xeb78('0x39')](_0x5bd3cb[_0xeb78('0x35')],qs[_0xeb78('0x3c')](_0x45e8e5['query'][_0xeb78('0x3c')]));_0x5ec703[_0xeb78('0x3b')]=_0x5ec703['attributes'][_0xeb78('0x3d')]?_0x5ec703[_0xeb78('0x3b')]:_0x5bd3cb[_0xeb78('0x35')];if(!_0x45e8e5[_0xeb78('0x3a')][_0xeb78('0x3e')](_0xeb78('0x3f'))){_0x5ec703[_0xeb78('0x40')]=qs['limit'](_0x45e8e5[_0xeb78('0x3a')]['limit']);_0x5ec703[_0xeb78('0x20')]=qs[_0xeb78('0x20')](_0x45e8e5[_0xeb78('0x3a')][_0xeb78('0x20')]);}_0x5ec703['order']=qs[_0xeb78('0x42')](_0x45e8e5['query']['sort']);_0x5ec703[_0xeb78('0x43')]=qs[_0xeb78('0x38')](_[_0xeb78('0x60')](_0x45e8e5[_0xeb78('0x3a')],_0x5bd3cb[_0xeb78('0x38')]));_0x5ec703[_0xeb78('0x43')][_0xeb78('0x61')]=_0x468483['id'];if(_0x45e8e5[_0xeb78('0x3a')][_0xeb78('0x46')]){_0x5ec703['where']=_['merge'](_0x5ec703[_0xeb78('0x43')],{'$or':_[_0xeb78('0x36')](_0x5ec703[_0xeb78('0x3b')],function(_0x49936c){var _0x42bf41={};_0x42bf41[_0x49936c]={'$like':'%'+_0x45e8e5[_0xeb78('0x3a')][_0xeb78('0x46')]+'%'};return _0x42bf41;})});}_0x5ec703=_[_0xeb78('0x44')]({},_0x5ec703,_0x45e8e5['options']);return db['JscriptyAnswerReport']['count']({'where':_0x5ec703['where']})[_0xeb78('0x2a')](function(_0x2ae0b8){_0x4e73fb[_0xeb78('0x22')]=_0x2ae0b8;if(_0x45e8e5[_0xeb78('0x3a')][_0xeb78('0x48')]){_0x5ec703[_0xeb78('0x49')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xeb78('0x4a')](_0x5ec703);})[_0xeb78('0x2a')](function(_0x464ec6){_0x4e73fb[_0xeb78('0x4b')]=_0x464ec6;return _0x4e73fb;});}})[_0xeb78('0x2a')](respondWithFilteredResult(_0x348aaa,_0x5ec703))[_0xeb78('0x4e')](handleError(_0x348aaa,null));};function char(_0x51a349){return _0xeb78('0x63')===typeof _0x51a349?String['fromCharCode'][_0xeb78('0x24')](null,arguments):_0x51a349;}function needsEncapsulation(_0x506734){return!!_0x506734&&(_0x506734[_0xeb78('0x64')]()[_0xeb78('0x65')](char(0xd))>=0x0||_0x506734[_0xeb78('0x64')]()[_0xeb78('0x65')](char(0xa))>=0x0||_0x506734[_0xeb78('0x64')]()['indexOf'](char(0x2c))>=0x0||_0x506734[_0xeb78('0x64')]()[_0xeb78('0x65')](char(0x22))>=0x0);}function encapsulate(_0x4bcaf8){var _0x296d86=char(0x22),_0x500131='\x5c'+char(0x22),_0x2e9eb9=_0x4bcaf8['toString']()[_0xeb78('0x66')](new RegExp(_0x296d86,'g'),_0x500131);return _0x296d86+_0x2e9eb9+_0x296d86;}exports[_0xeb78('0x67')]=function(_0x298285,_0x3ec7ec,_0x29e34a){var _0x1cf3eb,_0x289f13;var _0x2d6102={'where':{'ProjectId':_0x298285['params']['id']}};if(_0x298285[_0xeb78('0x3a')][_0xeb78('0x68')]){_0x2d6102['where'][_0xeb78('0x69')]=JSON[_0xeb78('0x6a')](_0x298285[_0xeb78('0x3a')][_0xeb78('0x68')]);}return db[_0xeb78('0x5f')]['findAll'](_0x2d6102)[_0xeb78('0x2a')](handleEntityNotFound(_0x3ec7ec,null))[_0xeb78('0x2a')](function(_0x4bf717){if(_0x4bf717){_0x1cf3eb=_0x4bf717;return db[_0xeb78('0x6b')][_0xeb78('0x4a')]({'where':{'SessionId':{'$in':_['map'](_0x1cf3eb,'id')},'ProjectId':_0x298285[_0xeb78('0x57')]['id']},'order':_0xeb78('0x6c')});}})['then'](handleEntityNotFound(_0x3ec7ec,null))[_0xeb78('0x2a')](function(_0x587ba3){if(_0x587ba3){_0x289f13=_0x587ba3;var _0x4ed5a1={};for(var _0x45e264=0x0,_0x185988=_0x289f13[_0xeb78('0x3d')];_0x45e264<_0x185988;_0x45e264++){if(!_0x4ed5a1[_0xeb78('0x3e')](_0x289f13[_0x45e264][_0xeb78('0x6d')])){_0x4ed5a1[_0x289f13[_0x45e264][_0xeb78('0x6d')]]=needsEncapsulation(_0x289f13[_0x45e264][_0xeb78('0x6e')])?encapsulate(_0x289f13[_0x45e264][_0xeb78('0x6e')]):_0x289f13[_0x45e264][_0xeb78('0x6e')];}}var _0x9af194=[],_0x5496b1={};for(var _0x4e8675=0x0,_0x1c3304=_0x1cf3eb[_0xeb78('0x3d')];_0x4e8675<_0x1c3304;_0x4e8675++){_0x5496b1={'ProjectId':_0x298285[_0xeb78('0x57')]['id'],'SessionId':_0x1cf3eb[_0x4e8675]['id'],'StartTime':moment(_0x1cf3eb[_0x4e8675][_0xeb78('0x69')])[_0xeb78('0x6f')](_0xeb78('0x70'))};for(var _0x4507bb=0x0,_0x20d34c=_0x289f13[_0xeb78('0x3d')];_0x4507bb<_0x20d34c;_0x4507bb++){if(_0x289f13[_0x4507bb][_0xeb78('0x71')]==_0x1cf3eb[_0x4e8675]['id']&&_0x4ed5a1[_0xeb78('0x3e')](_0x289f13[_0x4507bb][_0xeb78('0x6d')])){_0x5496b1[_0x4ed5a1[_0x289f13[_0x4507bb]['questionId']]]=_0x289f13[_0x4507bb]['answer'];}}for(var _0x350f52 in _0x4ed5a1){if(!_0x5496b1['hasOwnProperty'](_0x4ed5a1[_0x350f52])){_0x5496b1[_0x4ed5a1[_0x350f52]]=null;}}_0x9af194[_0xeb78('0x72')](_0x5496b1);}return _0x9af194;}})['then'](function(_0x577f5f){if(!_[_0xeb78('0x73')](_0x577f5f)){var _0x2befb3=toCsv(_0x577f5f);var _0x172599=Date[_0xeb78('0x74')]();fs[_0xeb78('0x75')](util[_0xeb78('0x6f')](_0xeb78('0x76'),_0x298285[_0xeb78('0x57')]['id'],_0x172599),_0x2befb3);_0x3ec7ec['setHeader'](_0xeb78('0x77'),_0xeb78('0x78')+util['format'](_0xeb78('0x79'),_0x298285[_0xeb78('0x57')]['id'],_0x172599));_0x3ec7ec[_0xeb78('0x7a')](_0xeb78('0x7b'),'text/csv');return _0x3ec7ec[_0xeb78('0x7c')](util['format'](_0xeb78('0x76'),_0x298285[_0xeb78('0x57')]['id'],_0x172599));}else{return _0x3ec7ec[_0xeb78('0x1d')](0xcc);}})['catch'](handleError(_0x3ec7ec,null));}; \ No newline at end of file +var _0xc5df=['push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','count','apply','reject','save','destroy','then','get','Projects','UserProfileResource','sendStatus','stack','name','send','index','JscriptyProject','rawAttributes','type','key','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','options','includeAll','include','catch','show','params','merge','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','length','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','getSessions','JscriptySessionReport','pick','findAll','rows','getAnswers','findOne','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer'];(function(_0x4c6627,_0x3f10df){var _0x4c47fc=function(_0x428c15){while(--_0x428c15){_0x4c6627['push'](_0x4c6627['shift']());}};_0x4c47fc(++_0x3f10df);}(_0xc5df,0x80));var _0xfc5d=function(_0x40316b,_0x2db629){_0x40316b=_0x40316b-0x0;var _0x45a02f=_0xc5df[_0x40316b];return _0x45a02f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfc5d('0x0'));var jsonpatch=require(_0xfc5d('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfc5d('0x2'));var Mustache=require(_0xfc5d('0x3'));var util=require(_0xfc5d('0x4'));var path=require(_0xfc5d('0x5'));var sox=require(_0xfc5d('0x6'));var csv=require('to-csv');var ejs=require(_0xfc5d('0x7'));var fs=require('fs');var fs_extra=require(_0xfc5d('0x8'));var _=require(_0xfc5d('0x9'));var squel=require(_0xfc5d('0xa'));var crypto=require(_0xfc5d('0xb'));var jsforce=require(_0xfc5d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfc5d('0xd'));var querystring=require(_0xfc5d('0xe'));var Papa=require('papaparse');var Redis=require(_0xfc5d('0xf'));var authService=require(_0xfc5d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfc5d('0x11'));var hardwareService=require(_0xfc5d('0x12'));var logger=require(_0xfc5d('0x13'))(_0xfc5d('0x14'));var utils=require('../../config/utils');var config=require(_0xfc5d('0x15'));var licenseUtil=require(_0xfc5d('0x16'));var db=require(_0xfc5d('0x17'))['db'];function respondWithStatusCode(_0x4f364c,_0x37eadc){_0x37eadc=_0x37eadc||0xcc;return function(_0x30530b){if(_0x30530b){return _0x4f364c['sendStatus'](_0x37eadc);}return _0x4f364c[_0xfc5d('0x18')](_0x37eadc)['end']();};}function respondWithResult(_0xddf605,_0x514fc1){_0x514fc1=_0x514fc1||0xc8;return function(_0x248498){if(_0x248498){return _0xddf605[_0xfc5d('0x18')](_0x514fc1)[_0xfc5d('0x19')](_0x248498);}};}function respondWithFilteredResult(_0x105bea,_0x1271c1){return function(_0x561131){if(_0x561131){var _0x44d245=typeof _0x1271c1[_0xfc5d('0x1a')]==='undefined'&&typeof _0x1271c1[_0xfc5d('0x1b')]==='undefined';var _0x438729=_0x561131['count'];var _0x4783d5=_0x44d245?0x0:_0x1271c1[_0xfc5d('0x1a')];var _0x1b8c0d=_0x44d245?_0x561131[_0xfc5d('0x1c')]:_0x1271c1[_0xfc5d('0x1a')]+_0x1271c1['limit'];var _0x5e5023;if(_0x1b8c0d>=_0x438729){_0x1b8c0d=_0x438729;_0x5e5023=0xc8;}else{_0x5e5023=0xce;}_0x105bea[_0xfc5d('0x18')](_0x5e5023);return _0x105bea['set']('Content-Range',_0x4783d5+'-'+_0x1b8c0d+'/'+_0x438729)['json'](_0x561131);}return null;};}function patchUpdates(_0x2fe92b){return function(_0x59254c){try{jsonpatch[_0xfc5d('0x1d')](_0x59254c,_0x2fe92b,!![]);}catch(_0x4fa971){return BPromise[_0xfc5d('0x1e')](_0x4fa971);}return _0x59254c[_0xfc5d('0x1f')]();};}function saveUpdates(_0x43e7f2,_0x269cc2){return function(_0x47e6c2){if(_0x47e6c2){return _0x47e6c2['update'](_0x43e7f2)['then'](function(_0x469e4){return _0x469e4;});}return null;};}function removeEntity(_0x8c2b1b,_0x3c0ec4){return function(_0x4ce3dd){if(_0x4ce3dd){return _0x4ce3dd[_0xfc5d('0x20')]()[_0xfc5d('0x21')](function(){var _0x37f692=_0x4ce3dd[_0xfc5d('0x22')]({'plain':!![]});var _0x2036b3=_0xfc5d('0x23');return db[_0xfc5d('0x24')]['destroy']({'where':{'type':_0x2036b3,'resourceId':_0x37f692['id']}})['then'](function(){return _0x4ce3dd;});})[_0xfc5d('0x21')](function(){_0x8c2b1b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ecb16,_0x5d4470){return function(_0x1c9fd7){if(!_0x1c9fd7){_0x1ecb16[_0xfc5d('0x25')](0x194);}return _0x1c9fd7;};}function handleError(_0x4e5b48,_0xf9156d){_0xf9156d=_0xf9156d||0x1f4;return function(_0x5bc69c){logger['error'](_0x5bc69c[_0xfc5d('0x26')]);if(_0x5bc69c[_0xfc5d('0x27')]){delete _0x5bc69c[_0xfc5d('0x27')];}_0x4e5b48[_0xfc5d('0x18')](_0xf9156d)[_0xfc5d('0x28')](_0x5bc69c);};}exports[_0xfc5d('0x29')]=function(_0x366313,_0x560198){var _0x82f10a={},_0x5eb75f={},_0x3eb6e3={'count':0x0,'rows':[]};var _0xf44fdc=_['map'](db[_0xfc5d('0x2a')][_0xfc5d('0x2b')],function(_0x116272){return{'name':_0x116272['fieldName'],'type':_0x116272[_0xfc5d('0x2c')][_0xfc5d('0x2d')]};});_0x5eb75f['model']=_[_0xfc5d('0x2e')](_0xf44fdc,'name');_0x5eb75f[_0xfc5d('0x2f')]=_[_0xfc5d('0x30')](_0x366313[_0xfc5d('0x2f')]);_0x5eb75f[_0xfc5d('0x31')]=_[_0xfc5d('0x32')](_0x5eb75f[_0xfc5d('0x33')],_0x5eb75f[_0xfc5d('0x2f')]);_0x82f10a['attributes']=_['intersection'](_0x5eb75f['model'],qs['fields'](_0x366313[_0xfc5d('0x2f')][_0xfc5d('0x34')]));_0x82f10a[_0xfc5d('0x35')]=_0x82f10a[_0xfc5d('0x35')]['length']?_0x82f10a['attributes']:_0x5eb75f[_0xfc5d('0x33')];if(!_0x366313[_0xfc5d('0x2f')][_0xfc5d('0x36')](_0xfc5d('0x37'))){_0x82f10a['limit']=qs['limit'](_0x366313[_0xfc5d('0x2f')][_0xfc5d('0x1b')]);_0x82f10a[_0xfc5d('0x1a')]=qs[_0xfc5d('0x1a')](_0x366313[_0xfc5d('0x2f')][_0xfc5d('0x1a')]);}_0x82f10a[_0xfc5d('0x38')]=qs[_0xfc5d('0x39')](_0x366313[_0xfc5d('0x2f')]['sort']);_0x82f10a[_0xfc5d('0x3a')]=qs[_0xfc5d('0x31')](_['pick'](_0x366313[_0xfc5d('0x2f')],_0x5eb75f[_0xfc5d('0x31')]),_0xf44fdc);if(_0x366313['query']['filter']){_0x82f10a['where']=_['merge'](_0x82f10a['where'],{'$or':_[_0xfc5d('0x2e')](_0xf44fdc,function(_0x4ca856){if(_0x4ca856[_0xfc5d('0x2c')]!==_0xfc5d('0x3b')){var _0x4dac1b={};_0x4dac1b[_0x4ca856[_0xfc5d('0x27')]]={'$like':'%'+_0x366313['query'][_0xfc5d('0x3c')]+'%'};return _0x4dac1b;}})});}_0x82f10a=_['merge']({},_0x82f10a,_0x366313[_0xfc5d('0x3d')]);var _0x2893dd={'where':_0x82f10a[_0xfc5d('0x3a')]};return db[_0xfc5d('0x2a')]['count'](_0x2893dd)[_0xfc5d('0x21')](function(_0x1f35fe){_0x3eb6e3[_0xfc5d('0x1c')]=_0x1f35fe;if(_0x366313[_0xfc5d('0x2f')][_0xfc5d('0x3e')]){_0x82f10a[_0xfc5d('0x3f')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x82f10a);})[_0xfc5d('0x21')](function(_0x463386){_0x3eb6e3['rows']=_0x463386;return _0x3eb6e3;})[_0xfc5d('0x21')](respondWithFilteredResult(_0x560198,_0x82f10a))[_0xfc5d('0x40')](handleError(_0x560198,null));};exports[_0xfc5d('0x41')]=function(_0x522fd5,_0x116e72){var _0x1c1cae={'raw':![],'where':{'id':_0x522fd5[_0xfc5d('0x42')]['id']}},_0xd9d449={};_0xd9d449[_0xfc5d('0x33')]=_[_0xfc5d('0x30')](db[_0xfc5d('0x2a')][_0xfc5d('0x2b')]);_0xd9d449[_0xfc5d('0x2f')]=_['keys'](_0x522fd5[_0xfc5d('0x2f')]);_0xd9d449['filters']=_['intersection'](_0xd9d449[_0xfc5d('0x33')],_0xd9d449[_0xfc5d('0x2f')]);_0x1c1cae[_0xfc5d('0x35')]=_[_0xfc5d('0x32')](_0xd9d449[_0xfc5d('0x33')],qs[_0xfc5d('0x34')](_0x522fd5['query'][_0xfc5d('0x34')]));_0x1c1cae[_0xfc5d('0x35')]=_0x1c1cae[_0xfc5d('0x35')]['length']?_0x1c1cae['attributes']:_0xd9d449[_0xfc5d('0x33')];if(_0x522fd5[_0xfc5d('0x2f')][_0xfc5d('0x3e')]){_0x1c1cae[_0xfc5d('0x3f')]=[{'all':!![]}];}_0x1c1cae=_[_0xfc5d('0x43')]({},_0x1c1cae,_0x522fd5[_0xfc5d('0x3d')]);return db['JscriptyProject'][_0xfc5d('0x44')](_0x1c1cae)[_0xfc5d('0x21')](handleEntityNotFound(_0x116e72,null))[_0xfc5d('0x21')](respondWithResult(_0x116e72,null))[_0xfc5d('0x40')](handleError(_0x116e72,null));};exports[_0xfc5d('0x45')]=function(_0x4e8313,_0x235e68){return db[_0xfc5d('0x2a')][_0xfc5d('0x45')](_0x4e8313[_0xfc5d('0x46')],{})['then'](function(_0x4a80bd){var _0x39fdee=_0x4e8313[_0xfc5d('0x47')]['get']({'plain':!![]});if(!_0x39fdee)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39fdee[_0xfc5d('0x48')]===_0xfc5d('0x47')){var _0x57d088=_0x4a80bd[_0xfc5d('0x22')]({'plain':!![]});var _0x4a73dd='Projects';return db[_0xfc5d('0x49')][_0xfc5d('0x44')]({'where':{'name':_0x4a73dd,'userProfileId':_0x39fdee[_0xfc5d('0x4a')]},'raw':!![]})['then'](function(_0xae255d){if(_0xae255d&&_0xae255d[_0xfc5d('0x4b')]===0x0){return db[_0xfc5d('0x24')][_0xfc5d('0x45')]({'name':_0x57d088[_0xfc5d('0x27')],'resourceId':_0x57d088['id'],'type':_0xae255d[_0xfc5d('0x27')],'sectionId':_0xae255d['id']},{})[_0xfc5d('0x21')](function(){return _0x4a80bd;});}else{return _0x4a80bd;}})['catch'](function(_0x4df226){logger[_0xfc5d('0x4c')](_0xfc5d('0x4d'),_0x4df226);throw _0x4df226;});}return _0x4a80bd;})['then'](respondWithResult(_0x235e68,0xc9))[_0xfc5d('0x40')](handleError(_0x235e68,null));};exports['clone']=function(_0x231140,_0x3edc83){var _0x2c7a8f={'where':{'id':_0x231140[_0xfc5d('0x42')]['id']}},_0x1d93bd={};_0x1d93bd[_0xfc5d('0x33')]=_[_0xfc5d('0x30')](db[_0xfc5d('0x2a')][_0xfc5d('0x2b')]);_0x2c7a8f[_0xfc5d('0x35')]=_[_0xfc5d('0x32')](_0x1d93bd[_0xfc5d('0x33')],qs['fields'](_0x231140[_0xfc5d('0x2f')][_0xfc5d('0x34')]));_0x2c7a8f[_0xfc5d('0x35')]=_0x2c7a8f[_0xfc5d('0x35')][_0xfc5d('0x4e')]?_0x2c7a8f['attributes']:_0x1d93bd[_0xfc5d('0x33')];if(_0x231140[_0xfc5d('0x2f')][_0xfc5d('0x3e')]){_0x2c7a8f[_0xfc5d('0x3f')]=[{'all':!![]}];}_0x2c7a8f=_[_0xfc5d('0x43')]({},_0x2c7a8f,_0x231140[_0xfc5d('0x3d')]);return db['JscriptyProject'][_0xfc5d('0x44')](_0x2c7a8f)[_0xfc5d('0x21')](handleEntityNotFound(_0x3edc83,null))[_0xfc5d('0x21')](function(_0x327932){if(_0x327932){var _0x3532c4=_0x327932[_0xfc5d('0x22')]({'plain':!![]});_0x3532c4=qs[_0xfc5d('0x4f')](_0x3532c4,['id',_0xfc5d('0x50'),_0xfc5d('0x51')]);_0x231140['body']=_[_0xfc5d('0x4f')](_0x231140[_0xfc5d('0x46')],['id',_0xfc5d('0x50'),_0xfc5d('0x51')]);return db[_0xfc5d('0x2a')][_0xfc5d('0x45')](_[_0xfc5d('0x43')](_0x3532c4,_0x231140['body']),{'include':_0x231140[_0xfc5d('0x2f')][_0xfc5d('0x3e')]?[{'all':!![]}]:undefined})[_0xfc5d('0x21')](function(_0x16915c){var _0x5a378d=_0x231140[_0xfc5d('0x47')][_0xfc5d('0x22')]({'plain':!![]});if(!_0x5a378d)throw new Error(_0xfc5d('0x52'));if(_0x5a378d[_0xfc5d('0x48')]===_0xfc5d('0x47')){var _0x1a6df0=_0x16915c[_0xfc5d('0x22')]({'plain':!![]});var _0xd53e3a=_0xfc5d('0x23');return db[_0xfc5d('0x49')][_0xfc5d('0x44')]({'where':{'name':_0xd53e3a,'userProfileId':_0x5a378d['userProfileId']},'raw':!![]})['then'](function(_0x29f0e1){if(_0x29f0e1&&_0x29f0e1['autoAssociation']===0x0){return db['UserProfileResource'][_0xfc5d('0x45')]({'name':_0x1a6df0[_0xfc5d('0x27')],'resourceId':_0x1a6df0['id'],'type':_0x29f0e1[_0xfc5d('0x27')],'sectionId':_0x29f0e1['id']},{})['then'](function(){return _0x16915c;});}else{return _0x16915c;}})['catch'](function(_0x3bb091){logger[_0xfc5d('0x4c')](_0xfc5d('0x4d'),_0x3bb091);throw _0x3bb091;});}return _0x16915c;});}})[_0xfc5d('0x21')](respondWithResult(_0x3edc83,0xc9))['catch'](handleError(_0x3edc83,null));};exports[_0xfc5d('0x53')]=function(_0x29bf3d,_0x10f808){if(_0x29bf3d['body']['id']){delete _0x29bf3d['body']['id'];}return db[_0xfc5d('0x2a')]['find']({'where':{'id':_0x29bf3d['params']['id']}})[_0xfc5d('0x21')](handleEntityNotFound(_0x10f808,null))[_0xfc5d('0x21')](saveUpdates(_0x29bf3d[_0xfc5d('0x46')],null))[_0xfc5d('0x21')](respondWithResult(_0x10f808,null))[_0xfc5d('0x40')](handleError(_0x10f808,null));};exports[_0xfc5d('0x20')]=function(_0x187f2f,_0x4b4baf){return db['JscriptyProject']['find']({'where':{'id':_0x187f2f[_0xfc5d('0x42')]['id']}})[_0xfc5d('0x21')](handleEntityNotFound(_0x4b4baf,null))['then'](removeEntity(_0x4b4baf,null))[_0xfc5d('0x40')](handleError(_0x4b4baf,null));};exports[_0xfc5d('0x54')]=function(_0x4795ed,_0x50cf3c,_0x2e2d7f){var _0xd9a63e={'raw':!![],'where':{}};var _0x12ff26={};var _0x2cf11b={'count':0x0,'rows':[]};return db[_0xfc5d('0x2a')]['findOne']({'where':{'id':_0x4795ed[_0xfc5d('0x42')]['id']}})['then'](handleEntityNotFound(_0x50cf3c,null))[_0xfc5d('0x21')](function(_0x5155fb){if(_0x5155fb){_0x12ff26['model']=_[_0xfc5d('0x30')](db[_0xfc5d('0x55')][_0xfc5d('0x2b')]);_0x12ff26[_0xfc5d('0x2f')]=_['keys'](_0x4795ed[_0xfc5d('0x2f')]);_0x12ff26[_0xfc5d('0x31')]=_[_0xfc5d('0x32')](_0x12ff26[_0xfc5d('0x33')],_0x12ff26['query']);_0xd9a63e[_0xfc5d('0x35')]=_[_0xfc5d('0x32')](_0x12ff26[_0xfc5d('0x33')],qs[_0xfc5d('0x34')](_0x4795ed[_0xfc5d('0x2f')][_0xfc5d('0x34')]));_0xd9a63e['attributes']=_0xd9a63e['attributes'][_0xfc5d('0x4e')]?_0xd9a63e['attributes']:_0x12ff26[_0xfc5d('0x33')];if(!_0x4795ed[_0xfc5d('0x2f')][_0xfc5d('0x36')](_0xfc5d('0x37'))){_0xd9a63e[_0xfc5d('0x1b')]=qs[_0xfc5d('0x1b')](_0x4795ed[_0xfc5d('0x2f')]['limit']);_0xd9a63e[_0xfc5d('0x1a')]=qs[_0xfc5d('0x1a')](_0x4795ed[_0xfc5d('0x2f')]['offset']);}_0xd9a63e[_0xfc5d('0x38')]=qs[_0xfc5d('0x39')](_0x4795ed[_0xfc5d('0x2f')]['sort']);_0xd9a63e[_0xfc5d('0x3a')]=qs[_0xfc5d('0x31')](_[_0xfc5d('0x56')](_0x4795ed['query'],_0x12ff26[_0xfc5d('0x31')]));_0xd9a63e[_0xfc5d('0x3a')]['ProjectId']=_0x5155fb['id'];if(_0x4795ed[_0xfc5d('0x2f')][_0xfc5d('0x3c')]){_0xd9a63e[_0xfc5d('0x3a')]=_[_0xfc5d('0x43')](_0xd9a63e[_0xfc5d('0x3a')],{'$or':_[_0xfc5d('0x2e')](_0xd9a63e[_0xfc5d('0x35')],function(_0x413773){var _0x8608b7={};_0x8608b7[_0x413773]={'$like':'%'+_0x4795ed['query'][_0xfc5d('0x3c')]+'%'};return _0x8608b7;})});}_0xd9a63e=_['merge']({},_0xd9a63e,_0x4795ed[_0xfc5d('0x3d')]);return db[_0xfc5d('0x55')][_0xfc5d('0x1c')]({'where':_0xd9a63e['where']})['then'](function(_0x31283e){_0x2cf11b[_0xfc5d('0x1c')]=_0x31283e;if(_0x4795ed[_0xfc5d('0x2f')][_0xfc5d('0x3e')]){_0xd9a63e[_0xfc5d('0x3f')]=[{'all':!![]}];}return db[_0xfc5d('0x55')][_0xfc5d('0x57')](_0xd9a63e);})[_0xfc5d('0x21')](function(_0x4ea3c8){_0x2cf11b[_0xfc5d('0x58')]=_0x4ea3c8;return _0x2cf11b;});}})[_0xfc5d('0x21')](respondWithFilteredResult(_0x50cf3c,_0xd9a63e))[_0xfc5d('0x40')](handleError(_0x50cf3c,null));};exports[_0xfc5d('0x59')]=function(_0x7b31ff,_0x3c029f,_0x379ff1){var _0x220545={'raw':!![],'where':{}};var _0x30b6ad={};var _0x470f03={'count':0x0,'rows':[]};return db[_0xfc5d('0x2a')][_0xfc5d('0x5a')]({'where':{'id':_0x7b31ff[_0xfc5d('0x42')]['id']}})[_0xfc5d('0x21')](handleEntityNotFound(_0x3c029f,null))[_0xfc5d('0x21')](function(_0x60a13a){if(_0x60a13a){_0x30b6ad['model']=_[_0xfc5d('0x30')](db['JscriptyAnswerReport']['rawAttributes']);_0x30b6ad[_0xfc5d('0x2f')]=_[_0xfc5d('0x30')](_0x7b31ff[_0xfc5d('0x2f')]);_0x30b6ad['filters']=_['intersection'](_0x30b6ad[_0xfc5d('0x33')],_0x30b6ad[_0xfc5d('0x2f')]);_0x220545[_0xfc5d('0x35')]=_[_0xfc5d('0x32')](_0x30b6ad[_0xfc5d('0x33')],qs['fields'](_0x7b31ff[_0xfc5d('0x2f')][_0xfc5d('0x34')]));_0x220545[_0xfc5d('0x35')]=_0x220545['attributes'][_0xfc5d('0x4e')]?_0x220545[_0xfc5d('0x35')]:_0x30b6ad['model'];if(!_0x7b31ff[_0xfc5d('0x2f')][_0xfc5d('0x36')](_0xfc5d('0x37'))){_0x220545[_0xfc5d('0x1b')]=qs[_0xfc5d('0x1b')](_0x7b31ff[_0xfc5d('0x2f')][_0xfc5d('0x1b')]);_0x220545[_0xfc5d('0x1a')]=qs[_0xfc5d('0x1a')](_0x7b31ff[_0xfc5d('0x2f')]['offset']);}_0x220545[_0xfc5d('0x38')]=qs[_0xfc5d('0x39')](_0x7b31ff[_0xfc5d('0x2f')][_0xfc5d('0x39')]);_0x220545[_0xfc5d('0x3a')]=qs[_0xfc5d('0x31')](_['pick'](_0x7b31ff['query'],_0x30b6ad[_0xfc5d('0x31')]));_0x220545[_0xfc5d('0x3a')][_0xfc5d('0x5b')]=_0x60a13a['id'];if(_0x7b31ff[_0xfc5d('0x2f')][_0xfc5d('0x3c')]){_0x220545[_0xfc5d('0x3a')]=_[_0xfc5d('0x43')](_0x220545[_0xfc5d('0x3a')],{'$or':_[_0xfc5d('0x2e')](_0x220545['attributes'],function(_0x1a9e05){var _0x1396aa={};_0x1396aa[_0x1a9e05]={'$like':'%'+_0x7b31ff[_0xfc5d('0x2f')][_0xfc5d('0x3c')]+'%'};return _0x1396aa;})});}_0x220545=_['merge']({},_0x220545,_0x7b31ff[_0xfc5d('0x3d')]);return db[_0xfc5d('0x5c')]['count']({'where':_0x220545[_0xfc5d('0x3a')]})[_0xfc5d('0x21')](function(_0x168fdf){_0x470f03['count']=_0x168fdf;if(_0x7b31ff[_0xfc5d('0x2f')]['includeAll']){_0x220545[_0xfc5d('0x3f')]=[{'all':!![]}];}return db[_0xfc5d('0x5c')][_0xfc5d('0x57')](_0x220545);})[_0xfc5d('0x21')](function(_0x26f702){_0x470f03[_0xfc5d('0x58')]=_0x26f702;return _0x470f03;});}})[_0xfc5d('0x21')](respondWithFilteredResult(_0x3c029f,_0x220545))[_0xfc5d('0x40')](handleError(_0x3c029f,null));};function char(_0x5ecfd8){return _0xfc5d('0x5d')===typeof _0x5ecfd8?String[_0xfc5d('0x5e')]['apply'](null,arguments):_0x5ecfd8;}function needsEncapsulation(_0x134112){return!!_0x134112&&(_0x134112[_0xfc5d('0x5f')]()['indexOf'](char(0xd))>=0x0||_0x134112[_0xfc5d('0x5f')]()[_0xfc5d('0x60')](char(0xa))>=0x0||_0x134112[_0xfc5d('0x5f')]()[_0xfc5d('0x60')](char(0x2c))>=0x0||_0x134112['toString']()[_0xfc5d('0x60')](char(0x22))>=0x0);}function encapsulate(_0x9390f7){var _0x24c024=char(0x22),_0x38cfac='\x5c'+char(0x22),_0x309328=_0x9390f7[_0xfc5d('0x5f')]()[_0xfc5d('0x61')](new RegExp(_0x24c024,'g'),_0x38cfac);return _0x24c024+_0x309328+_0x24c024;}exports[_0xfc5d('0x62')]=function(_0xa450d0,_0x4a3e0c,_0x7b09c2){var _0x34fcc0,_0x24473b;var _0x5e828b={'where':{'ProjectId':_0xa450d0[_0xfc5d('0x42')]['id']}};if(_0xa450d0[_0xfc5d('0x2f')][_0xfc5d('0x63')]){_0x5e828b['where'][_0xfc5d('0x64')]=JSON['parse'](_0xa450d0[_0xfc5d('0x2f')]['startTime']);}return db[_0xfc5d('0x55')][_0xfc5d('0x57')](_0x5e828b)[_0xfc5d('0x21')](handleEntityNotFound(_0x4a3e0c,null))[_0xfc5d('0x21')](function(_0x1625cd){if(_0x1625cd){_0x34fcc0=_0x1625cd;return db[_0xfc5d('0x65')]['findAll']({'where':{'SessionId':{'$in':_[_0xfc5d('0x2e')](_0x34fcc0,'id')},'ProjectId':_0xa450d0['params']['id']},'order':'-createdAt'});}})[_0xfc5d('0x21')](handleEntityNotFound(_0x4a3e0c,null))['then'](function(_0x140254){if(_0x140254){_0x24473b=_0x140254;var _0x10123c={};for(var _0x532ab8=0x0,_0x36c51b=_0x24473b[_0xfc5d('0x4e')];_0x532ab8<_0x36c51b;_0x532ab8++){if(!_0x10123c[_0xfc5d('0x36')](_0x24473b[_0x532ab8][_0xfc5d('0x66')])){_0x10123c[_0x24473b[_0x532ab8][_0xfc5d('0x66')]]=needsEncapsulation(_0x24473b[_0x532ab8][_0xfc5d('0x67')])?encapsulate(_0x24473b[_0x532ab8][_0xfc5d('0x67')]):_0x24473b[_0x532ab8]['question'];}}var _0x13843b=[],_0x5d26d3={};for(var _0x487a27=0x0,_0x2f4595=_0x34fcc0[_0xfc5d('0x4e')];_0x487a27<_0x2f4595;_0x487a27++){_0x5d26d3={'ProjectId':_0xa450d0[_0xfc5d('0x42')]['id'],'SessionId':_0x34fcc0[_0x487a27]['id'],'StartTime':moment(_0x34fcc0[_0x487a27][_0xfc5d('0x64')])[_0xfc5d('0x68')](_0xfc5d('0x69'))};for(var _0x1b0e7b=0x0,_0x343a07=_0x24473b[_0xfc5d('0x4e')];_0x1b0e7b<_0x343a07;_0x1b0e7b++){if(_0x24473b[_0x1b0e7b][_0xfc5d('0x6a')]==_0x34fcc0[_0x487a27]['id']&&_0x10123c[_0xfc5d('0x36')](_0x24473b[_0x1b0e7b]['questionId'])){_0x5d26d3[_0x10123c[_0x24473b[_0x1b0e7b][_0xfc5d('0x66')]]]=_0x24473b[_0x1b0e7b][_0xfc5d('0x6b')];}}for(var _0x107341 in _0x10123c){if(!_0x5d26d3[_0xfc5d('0x36')](_0x10123c[_0x107341])){_0x5d26d3[_0x10123c[_0x107341]]=null;}}_0x13843b[_0xfc5d('0x6c')](_0x5d26d3);}return _0x13843b;}})['then'](function(_0x33d5d6){if(!_['isEmpty'](_0x33d5d6)){var _0x1f6358=toCsv(_0x33d5d6);var _0xb387db=Date[_0xfc5d('0x6d')]();fs[_0xfc5d('0x6e')](util[_0xfc5d('0x68')](_0xfc5d('0x6f'),_0xa450d0[_0xfc5d('0x42')]['id'],_0xb387db),_0x1f6358);_0x4a3e0c['setHeader'](_0xfc5d('0x70'),'attachment;\x20filename='+util[_0xfc5d('0x68')](_0xfc5d('0x71'),_0xa450d0[_0xfc5d('0x42')]['id'],_0xb387db));_0x4a3e0c[_0xfc5d('0x72')](_0xfc5d('0x73'),_0xfc5d('0x74'));return _0x4a3e0c[_0xfc5d('0x75')](util[_0xfc5d('0x68')](_0xfc5d('0x6f'),_0xa450d0[_0xfc5d('0x42')]['id'],_0xb387db));}else{return _0x4a3e0c[_0xfc5d('0x25')](0xcc);}})['catch'](handleError(_0x4a3e0c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 39944dc..94e5cf0 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 _0xf3be=['jscripty_projects','lodash','util','../../config/logger','api','bluebird','./jscriptyProject.attributes','exports','define','JscriptyProject'];(function(_0x5ace4d,_0x1c9cfc){var _0x5b3607=function(_0x34c0d4){while(--_0x34c0d4){_0x5ace4d['push'](_0x5ace4d['shift']());}};_0x5b3607(++_0x1c9cfc);}(_0xf3be,0x1e1));var _0xef3b=function(_0x3df4bf,_0x53f093){_0x3df4bf=_0x3df4bf-0x0;var _0x313138=_0xf3be[_0x3df4bf];return _0x313138;};'use strict';var _=require(_0xef3b('0x0'));var util=require(_0xef3b('0x1'));var logger=require(_0xef3b('0x2'))(_0xef3b('0x3'));var moment=require('moment');var BPromise=require(_0xef3b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xef3b('0x5'));module[_0xef3b('0x6')]=function(_0x48f499,_0x3dfcc2){return _0x48f499[_0xef3b('0x7')](_0xef3b('0x8'),attributes,{'tableName':_0xef3b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90b5=['exports','JscriptyProject','jscripty_projects','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x464609,_0x4b4c38){var _0x4258fc=function(_0x3d6900){while(--_0x3d6900){_0x464609['push'](_0x464609['shift']());}};_0x4258fc(++_0x4b4c38);}(_0x90b5,0x139));var _0x590b=function(_0x107741,_0x135bfd){_0x107741=_0x107741-0x0;var _0x42f9e1=_0x90b5[_0x107741];return _0x42f9e1;};'use strict';var _=require(_0x590b('0x0'));var util=require('util');var logger=require(_0x590b('0x1'))(_0x590b('0x2'));var moment=require(_0x590b('0x3'));var BPromise=require(_0x590b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x590b('0x5'));var config=require(_0x590b('0x6'));var attributes=require('./jscriptyProject.attributes');module[_0x590b('0x7')]=function(_0x2059e4,_0x88a5f9){return _0x2059e4['define'](_0x590b('0x8'),attributes,{'tableName':_0x590b('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 5ef1a9d..a855aaa 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 _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xac4a,0x13f));var _0xaac4=function(_0x125b07,_0x211329){_0x125b07=_0x125b07-0x0;var _0x235a98=_0xac4a[_0x125b07];return _0x235a98;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x2fcf18,_0x10009a){var _0x4c68cc=function(_0x444002){while(--_0x444002){_0x2fcf18['push'](_0x2fcf18['shift']());}};_0x4c68cc(++_0x10009a);}(_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 moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index f57c3ca..9f8555f 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 _0x5050=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','index','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5050,0xc6));var _0x0505=function(_0x27fa9f,_0xe86119){_0x27fa9f=_0x27fa9f-0x0;var _0x3a4134=_0x5050[_0x27fa9f];return _0x3a4134;};'use strict';var multer=require('multer');var util=require(_0x0505('0x0'));var path=require(_0x0505('0x1'));var timeout=require(_0x0505('0x2'));var express=require('express');var router=express[_0x0505('0x3')]();var fs_extra=require(_0x0505('0x4'));var auth=require(_0x0505('0x5'));var interaction=require(_0x0505('0x6'));var config=require(_0x0505('0x7'));var controller=require(_0x0505('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0505('0x9')]);router[_0x0505('0xa')](_0x0505('0xb'),auth[_0x0505('0xc')](),controller['describe']);router[_0x0505('0xa')](_0x0505('0xd'),auth[_0x0505('0xc')](),controller[_0x0505('0xe')]);router[_0x0505('0xf')]('/',auth[_0x0505('0xc')](),controller[_0x0505('0x10')]);router[_0x0505('0x11')](_0x0505('0xd'),auth[_0x0505('0xc')](),controller[_0x0505('0x12')]);router[_0x0505('0x13')](_0x0505('0xd'),auth['isAuthenticated'](),controller[_0x0505('0x14')]);module[_0x0505('0x15')]=router; \ No newline at end of file +var _0xd772=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','index','get','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x689739,_0x5db9f){var _0x497a9a=function(_0x817af){while(--_0x817af){_0x689739['push'](_0x689739['shift']());}};_0x497a9a(++_0x5db9f);}(_0xd772,0x19e));var _0x2d77=function(_0x95df57,_0x2cb57e){_0x95df57=_0x95df57-0x0;var _0x4c3157=_0xd772[_0x95df57];return _0x4c3157;};'use strict';var multer=require(_0x2d77('0x0'));var util=require('util');var path=require(_0x2d77('0x1'));var timeout=require(_0x2d77('0x2'));var express=require(_0x2d77('0x3'));var router=express[_0x2d77('0x4')]();var fs_extra=require(_0x2d77('0x5'));var auth=require(_0x2d77('0x6'));var interaction=require(_0x2d77('0x7'));var config=require(_0x2d77('0x8'));var controller=require(_0x2d77('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x2d77('0xa')]);router[_0x2d77('0xb')](_0x2d77('0xc'),auth[_0x2d77('0xd')](),controller[_0x2d77('0xe')]);router['get'](_0x2d77('0xf'),auth[_0x2d77('0xd')](),controller['show']);router[_0x2d77('0x10')]('/',auth['isAuthenticated'](),controller[_0x2d77('0x11')]);router[_0x2d77('0x12')]('/:id',auth[_0x2d77('0xd')](),controller[_0x2d77('0x13')]);router[_0x2d77('0x14')]('/:id',auth[_0x2d77('0xd')](),controller[_0x2d77('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 0e37df5..43331b1 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(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x7a54,0x106));var _0x47a5=function(_0x4ede5e,_0x38b9ec){_0x4ede5e=_0x4ede5e-0x0;var _0x53218f=_0x7a54[_0x4ede5e];return _0x53218f;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7a54,0x106));var _0x47a5=function(_0x15b33f,_0x2e5740){_0x15b33f=_0x15b33f-0x0;var _0x104ae0=_0x7a54[_0x15b33f];return _0x104ae0;};'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 48e7e39..f0e9fcc 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 _0x4bab=['create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../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','save','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find'];(function(_0x45f07e,_0x31e307){var _0x545270=function(_0x2cea7a){while(--_0x2cea7a){_0x45f07e['push'](_0x45f07e['shift']());}};_0x545270(++_0x31e307);}(_0x4bab,0x14f));var _0xb4ba=function(_0x39843f,_0x1d9754){_0x39843f=_0x39843f-0x0;var _0x3574a3=_0x4bab[_0x39843f];return _0x3574a3;};'use strict';var emlformat=require(_0xb4ba('0x0'));var rimraf=require(_0xb4ba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb4ba('0x2'));var rp=require(_0xb4ba('0x3'));var moment=require(_0xb4ba('0x4'));var BPromise=require(_0xb4ba('0x5'));var Mustache=require(_0xb4ba('0x6'));var util=require(_0xb4ba('0x7'));var path=require(_0xb4ba('0x8'));var sox=require(_0xb4ba('0x9'));var csv=require(_0xb4ba('0xa'));var ejs=require(_0xb4ba('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb4ba('0xc'));var squel=require(_0xb4ba('0xd'));var crypto=require(_0xb4ba('0xe'));var jsforce=require(_0xb4ba('0xf'));var deskjs=require(_0xb4ba('0x10'));var toCsv=require(_0xb4ba('0xa'));var querystring=require(_0xb4ba('0x11'));var Papa=require(_0xb4ba('0x12'));var Redis=require(_0xb4ba('0x13'));var authService=require(_0xb4ba('0x14'));var qs=require(_0xb4ba('0x15'));var as=require(_0xb4ba('0x16'));var hardwareService=require(_0xb4ba('0x17'));var logger=require(_0xb4ba('0x18'))(_0xb4ba('0x19'));var utils=require(_0xb4ba('0x1a'));var config=require(_0xb4ba('0x1b'));var licenseUtil=require(_0xb4ba('0x1c'));var db=require(_0xb4ba('0x1d'))['db'];function respondWithStatusCode(_0x51a235,_0xec6523){_0xec6523=_0xec6523||0xcc;return function(_0x67a674){if(_0x67a674){return _0x51a235[_0xb4ba('0x1e')](_0xec6523);}return _0x51a235['status'](_0xec6523)[_0xb4ba('0x1f')]();};}function respondWithResult(_0x205f2a,_0xe87c74){_0xe87c74=_0xe87c74||0xc8;return function(_0x38179c){if(_0x38179c){return _0x205f2a[_0xb4ba('0x20')](_0xe87c74)[_0xb4ba('0x21')](_0x38179c);}};}function respondWithFilteredResult(_0x2841c6,_0x573e15){return function(_0x4af8ab){if(_0x4af8ab){var _0x5c2d12=typeof _0x573e15[_0xb4ba('0x22')]===_0xb4ba('0x23')&&typeof _0x573e15[_0xb4ba('0x24')]===_0xb4ba('0x23');var _0x4e18f5=_0x4af8ab[_0xb4ba('0x25')];var _0x27e7d9=_0x5c2d12?0x0:_0x573e15[_0xb4ba('0x22')];var _0x1b8415=_0x5c2d12?_0x4af8ab['count']:_0x573e15[_0xb4ba('0x22')]+_0x573e15[_0xb4ba('0x24')];var _0x43feab;if(_0x1b8415>=_0x4e18f5){_0x1b8415=_0x4e18f5;_0x43feab=0xc8;}else{_0x43feab=0xce;}_0x2841c6['status'](_0x43feab);return _0x2841c6[_0xb4ba('0x26')](_0xb4ba('0x27'),_0x27e7d9+'-'+_0x1b8415+'/'+_0x4e18f5)[_0xb4ba('0x21')](_0x4af8ab);}return null;};}function patchUpdates(_0x27b04d){return function(_0x517021){try{jsonpatch[_0xb4ba('0x28')](_0x517021,_0x27b04d,!![]);}catch(_0x5eeee3){return BPromise['reject'](_0x5eeee3);}return _0x517021[_0xb4ba('0x29')]();};}function saveUpdates(_0x2ab2ce,_0x2a053d){return function(_0x295ccc){if(_0x295ccc){return _0x295ccc[_0xb4ba('0x2a')](_0x2ab2ce)[_0xb4ba('0x2b')](function(_0x4de9c1){return _0x4de9c1;});}return null;};}function removeEntity(_0x3c95ac,_0x50f93d){return function(_0x574577){if(_0x574577){return _0x574577[_0xb4ba('0x2c')]()[_0xb4ba('0x2b')](function(){_0x3c95ac[_0xb4ba('0x20')](0xcc)[_0xb4ba('0x1f')]();});}};}function handleEntityNotFound(_0x73c51c,_0x262a5f){return function(_0x2a0a79){if(!_0x2a0a79){_0x73c51c[_0xb4ba('0x1e')](0x194);}return _0x2a0a79;};}function handleError(_0x4acf68,_0x5c6d71){_0x5c6d71=_0x5c6d71||0x1f4;return function(_0x183cdb){logger[_0xb4ba('0x2d')](_0x183cdb[_0xb4ba('0x2e')]);if(_0x183cdb[_0xb4ba('0x2f')]){delete _0x183cdb['name'];}_0x4acf68[_0xb4ba('0x20')](_0x5c6d71)[_0xb4ba('0x30')](_0x183cdb);};}exports[_0xb4ba('0x31')]=function(_0xb46edc,_0x55b321){var _0x117036={},_0x102204={},_0x3d9b33={'count':0x0,'rows':[]};var _0xbcff6=_[_0xb4ba('0x32')](db[_0xb4ba('0x33')][_0xb4ba('0x34')],function(_0x508781){return{'name':_0x508781[_0xb4ba('0x35')],'type':_0x508781[_0xb4ba('0x36')][_0xb4ba('0x37')]};});_0x102204['model']=_[_0xb4ba('0x32')](_0xbcff6,_0xb4ba('0x2f'));_0x102204[_0xb4ba('0x38')]=_[_0xb4ba('0x39')](_0xb46edc[_0xb4ba('0x38')]);_0x102204[_0xb4ba('0x3a')]=_['intersection'](_0x102204['model'],_0x102204['query']);_0x117036['attributes']=_[_0xb4ba('0x3b')](_0x102204[_0xb4ba('0x3c')],qs[_0xb4ba('0x3d')](_0xb46edc[_0xb4ba('0x38')][_0xb4ba('0x3d')]));_0x117036[_0xb4ba('0x3e')]=_0x117036[_0xb4ba('0x3e')][_0xb4ba('0x3f')]?_0x117036['attributes']:_0x102204['model'];if(!_0xb46edc[_0xb4ba('0x38')][_0xb4ba('0x40')](_0xb4ba('0x41'))){_0x117036[_0xb4ba('0x24')]=qs[_0xb4ba('0x24')](_0xb46edc[_0xb4ba('0x38')][_0xb4ba('0x24')]);_0x117036[_0xb4ba('0x22')]=qs['offset'](_0xb46edc[_0xb4ba('0x38')][_0xb4ba('0x22')]);}_0x117036['order']=qs['sort'](_0xb46edc[_0xb4ba('0x38')]['sort']);_0x117036[_0xb4ba('0x42')]=qs[_0xb4ba('0x3a')](_[_0xb4ba('0x43')](_0xb46edc[_0xb4ba('0x38')],_0x102204[_0xb4ba('0x3a')]),_0xbcff6);if(_0xb46edc[_0xb4ba('0x38')][_0xb4ba('0x44')]){_0x117036[_0xb4ba('0x42')]=_[_0xb4ba('0x45')](_0x117036[_0xb4ba('0x42')],{'$or':_['map'](_0xbcff6,function(_0x2f2867){if(_0x2f2867[_0xb4ba('0x36')]!==_0xb4ba('0x46')){var _0x1aa877={};_0x1aa877[_0x2f2867[_0xb4ba('0x2f')]]={'$like':'%'+_0xb46edc['query'][_0xb4ba('0x44')]+'%'};return _0x1aa877;}})});}_0x117036=_[_0xb4ba('0x45')]({},_0x117036,_0xb46edc[_0xb4ba('0x47')]);var _0x101773={'where':_0x117036['where']};return db[_0xb4ba('0x33')][_0xb4ba('0x25')](_0x101773)['then'](function(_0x3e23e5){_0x3d9b33[_0xb4ba('0x25')]=_0x3e23e5;if(_0xb46edc[_0xb4ba('0x38')][_0xb4ba('0x48')]){_0x117036[_0xb4ba('0x49')]=[{'all':!![]}];}return db[_0xb4ba('0x33')][_0xb4ba('0x4a')](_0x117036);})[_0xb4ba('0x2b')](function(_0x5aa31f){_0x3d9b33[_0xb4ba('0x4b')]=_0x5aa31f;return _0x3d9b33;})[_0xb4ba('0x2b')](respondWithFilteredResult(_0x55b321,_0x117036))[_0xb4ba('0x4c')](handleError(_0x55b321,null));};exports[_0xb4ba('0x4d')]=function(_0x15dbfb,_0x4a59b5){var _0x5d84a4={'raw':!![],'where':{'id':_0x15dbfb[_0xb4ba('0x4e')]['id']}},_0x4699af={};_0x4699af[_0xb4ba('0x3c')]=_['keys'](db['JscriptyQuestionReport'][_0xb4ba('0x34')]);_0x4699af[_0xb4ba('0x38')]=_[_0xb4ba('0x39')](_0x15dbfb['query']);_0x4699af[_0xb4ba('0x3a')]=_[_0xb4ba('0x3b')](_0x4699af[_0xb4ba('0x3c')],_0x4699af[_0xb4ba('0x38')]);_0x5d84a4[_0xb4ba('0x3e')]=_[_0xb4ba('0x3b')](_0x4699af['model'],qs[_0xb4ba('0x3d')](_0x15dbfb[_0xb4ba('0x38')][_0xb4ba('0x3d')]));_0x5d84a4[_0xb4ba('0x3e')]=_0x5d84a4['attributes'][_0xb4ba('0x3f')]?_0x5d84a4[_0xb4ba('0x3e')]:_0x4699af[_0xb4ba('0x3c')];if(_0x15dbfb['query'][_0xb4ba('0x48')]){_0x5d84a4[_0xb4ba('0x49')]=[{'all':!![]}];}_0x5d84a4=_['merge']({},_0x5d84a4,_0x15dbfb[_0xb4ba('0x47')]);return db[_0xb4ba('0x33')][_0xb4ba('0x4f')](_0x5d84a4)[_0xb4ba('0x2b')](handleEntityNotFound(_0x4a59b5,null))[_0xb4ba('0x2b')](respondWithResult(_0x4a59b5,null))[_0xb4ba('0x4c')](handleError(_0x4a59b5,null));};exports[_0xb4ba('0x50')]=function(_0x4c309d,_0x29a52f){return db[_0xb4ba('0x33')]['create'](_0x4c309d[_0xb4ba('0x51')],{})[_0xb4ba('0x2b')](respondWithResult(_0x29a52f,0xc9))['catch'](handleError(_0x29a52f,null));};exports[_0xb4ba('0x2a')]=function(_0x41ee8e,_0x5aa357){if(_0x41ee8e[_0xb4ba('0x51')]['id']){delete _0x41ee8e[_0xb4ba('0x51')]['id'];}return db[_0xb4ba('0x33')][_0xb4ba('0x4f')]({'where':{'id':_0x41ee8e['params']['id']}})[_0xb4ba('0x2b')](handleEntityNotFound(_0x5aa357,null))[_0xb4ba('0x2b')](saveUpdates(_0x41ee8e[_0xb4ba('0x51')],null))['then'](respondWithResult(_0x5aa357,null))['catch'](handleError(_0x5aa357,null));};exports['destroy']=function(_0x186ed5,_0x46e03c){return db[_0xb4ba('0x33')]['find']({'where':{'id':_0x186ed5['params']['id']}})[_0xb4ba('0x2b')](handleEntityNotFound(_0x46e03c,null))['then'](removeEntity(_0x46e03c,null))[_0xb4ba('0x4c')](handleError(_0x46e03c,null));};exports[_0xb4ba('0x52')]=function(_0x5c69b3,_0x5d9a44){return db[_0xb4ba('0x33')][_0xb4ba('0x52')]()[_0xb4ba('0x2b')](respondWithResult(_0x5d9a44,null))[_0xb4ba('0x4c')](handleError(_0x5d9a44,null));}; \ No newline at end of file +var _0xf122=['params','destroy','describe','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','sendStatus','error','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','nolimit','order','sort','filter','merge','VIRTUAL','options','JscriptyQuestionReport','includeAll','rows','show','length','find','catch','create','body'];(function(_0xec919c,_0x45c528){var _0x516869=function(_0x155b36){while(--_0x155b36){_0xec919c['push'](_0xec919c['shift']());}};_0x516869(++_0x45c528);}(_0xf122,0x17f));var _0x2f12=function(_0xab9b5,_0x4a9adb){_0xab9b5=_0xab9b5-0x0;var _0x46954b=_0xf122[_0xab9b5];return _0x46954b;};'use strict';var emlformat=require(_0x2f12('0x0'));var rimraf=require(_0x2f12('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2f12('0x2'));var rp=require(_0x2f12('0x3'));var moment=require(_0x2f12('0x4'));var BPromise=require(_0x2f12('0x5'));var Mustache=require(_0x2f12('0x6'));var util=require(_0x2f12('0x7'));var path=require(_0x2f12('0x8'));var sox=require(_0x2f12('0x9'));var csv=require('to-csv');var ejs=require(_0x2f12('0xa'));var fs=require('fs');var fs_extra=require(_0x2f12('0xb'));var _=require(_0x2f12('0xc'));var squel=require(_0x2f12('0xd'));var crypto=require(_0x2f12('0xe'));var jsforce=require(_0x2f12('0xf'));var deskjs=require(_0x2f12('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2f12('0x11'));var Papa=require(_0x2f12('0x12'));var Redis=require(_0x2f12('0x13'));var authService=require(_0x2f12('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2f12('0x15'));var hardwareService=require(_0x2f12('0x16'));var logger=require(_0x2f12('0x17'))(_0x2f12('0x18'));var utils=require(_0x2f12('0x19'));var config=require(_0x2f12('0x1a'));var licenseUtil=require(_0x2f12('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bd4a5,_0x30e6af){_0x30e6af=_0x30e6af||0xcc;return function(_0x1f2a0d){if(_0x1f2a0d){return _0x4bd4a5['sendStatus'](_0x30e6af);}return _0x4bd4a5[_0x2f12('0x1c')](_0x30e6af)[_0x2f12('0x1d')]();};}function respondWithResult(_0xd6dc94,_0x37f1ef){_0x37f1ef=_0x37f1ef||0xc8;return function(_0x4e13e5){if(_0x4e13e5){return _0xd6dc94[_0x2f12('0x1c')](_0x37f1ef)[_0x2f12('0x1e')](_0x4e13e5);}};}function respondWithFilteredResult(_0x4b99ed,_0x50c1e2){return function(_0x53aadd){if(_0x53aadd){var _0x31f91f=typeof _0x50c1e2[_0x2f12('0x1f')]===_0x2f12('0x20')&&typeof _0x50c1e2[_0x2f12('0x21')]===_0x2f12('0x20');var _0x47dd44=_0x53aadd[_0x2f12('0x22')];var _0x1e49df=_0x31f91f?0x0:_0x50c1e2[_0x2f12('0x1f')];var _0x48aa5a=_0x31f91f?_0x53aadd[_0x2f12('0x22')]:_0x50c1e2[_0x2f12('0x1f')]+_0x50c1e2[_0x2f12('0x21')];var _0x434680;if(_0x48aa5a>=_0x47dd44){_0x48aa5a=_0x47dd44;_0x434680=0xc8;}else{_0x434680=0xce;}_0x4b99ed[_0x2f12('0x1c')](_0x434680);return _0x4b99ed[_0x2f12('0x23')](_0x2f12('0x24'),_0x1e49df+'-'+_0x48aa5a+'/'+_0x47dd44)[_0x2f12('0x1e')](_0x53aadd);}return null;};}function patchUpdates(_0x271cf6){return function(_0x2285cc){try{jsonpatch['apply'](_0x2285cc,_0x271cf6,!![]);}catch(_0x5f16ff){return BPromise[_0x2f12('0x25')](_0x5f16ff);}return _0x2285cc[_0x2f12('0x26')]();};}function saveUpdates(_0x3c31e1,_0x222aa3){return function(_0x26f46e){if(_0x26f46e){return _0x26f46e[_0x2f12('0x27')](_0x3c31e1)[_0x2f12('0x28')](function(_0x82ce){return _0x82ce;});}return null;};}function removeEntity(_0x3f16e8,_0x4528f6){return function(_0x3777a4){if(_0x3777a4){return _0x3777a4['destroy']()[_0x2f12('0x28')](function(){_0x3f16e8[_0x2f12('0x1c')](0xcc)[_0x2f12('0x1d')]();});}};}function handleEntityNotFound(_0x2e31af,_0x35372b){return function(_0x30c2ff){if(!_0x30c2ff){_0x2e31af[_0x2f12('0x29')](0x194);}return _0x30c2ff;};}function handleError(_0xa54784,_0x9dd56d){_0x9dd56d=_0x9dd56d||0x1f4;return function(_0xfcdb4b){logger[_0x2f12('0x2a')](_0xfcdb4b['stack']);if(_0xfcdb4b[_0x2f12('0x2b')]){delete _0xfcdb4b[_0x2f12('0x2b')];}_0xa54784[_0x2f12('0x1c')](_0x9dd56d)[_0x2f12('0x2c')](_0xfcdb4b);};}exports[_0x2f12('0x2d')]=function(_0x19f1d6,_0x3f6642){var _0x559c19={},_0x5d2a20={},_0x20a0f9={'count':0x0,'rows':[]};var _0x50093e=_[_0x2f12('0x2e')](db['JscriptyQuestionReport'][_0x2f12('0x2f')],function(_0x37ccfe){return{'name':_0x37ccfe['fieldName'],'type':_0x37ccfe[_0x2f12('0x30')][_0x2f12('0x31')]};});_0x5d2a20['model']=_['map'](_0x50093e,'name');_0x5d2a20[_0x2f12('0x32')]=_[_0x2f12('0x33')](_0x19f1d6[_0x2f12('0x32')]);_0x5d2a20[_0x2f12('0x34')]=_[_0x2f12('0x35')](_0x5d2a20['model'],_0x5d2a20[_0x2f12('0x32')]);_0x559c19[_0x2f12('0x36')]=_[_0x2f12('0x35')](_0x5d2a20[_0x2f12('0x37')],qs[_0x2f12('0x38')](_0x19f1d6['query'][_0x2f12('0x38')]));_0x559c19[_0x2f12('0x36')]=_0x559c19[_0x2f12('0x36')]['length']?_0x559c19[_0x2f12('0x36')]:_0x5d2a20['model'];if(!_0x19f1d6['query']['hasOwnProperty'](_0x2f12('0x39'))){_0x559c19[_0x2f12('0x21')]=qs[_0x2f12('0x21')](_0x19f1d6['query']['limit']);_0x559c19[_0x2f12('0x1f')]=qs['offset'](_0x19f1d6[_0x2f12('0x32')]['offset']);}_0x559c19[_0x2f12('0x3a')]=qs['sort'](_0x19f1d6[_0x2f12('0x32')][_0x2f12('0x3b')]);_0x559c19['where']=qs['filters'](_['pick'](_0x19f1d6['query'],_0x5d2a20[_0x2f12('0x34')]),_0x50093e);if(_0x19f1d6[_0x2f12('0x32')][_0x2f12('0x3c')]){_0x559c19['where']=_[_0x2f12('0x3d')](_0x559c19['where'],{'$or':_[_0x2f12('0x2e')](_0x50093e,function(_0xb7af19){if(_0xb7af19['type']!==_0x2f12('0x3e')){var _0x15e77a={};_0x15e77a[_0xb7af19[_0x2f12('0x2b')]]={'$like':'%'+_0x19f1d6[_0x2f12('0x32')]['filter']+'%'};return _0x15e77a;}})});}_0x559c19=_[_0x2f12('0x3d')]({},_0x559c19,_0x19f1d6[_0x2f12('0x3f')]);var _0x39e7b9={'where':_0x559c19['where']};return db[_0x2f12('0x40')][_0x2f12('0x22')](_0x39e7b9)['then'](function(_0x1782fc){_0x20a0f9[_0x2f12('0x22')]=_0x1782fc;if(_0x19f1d6['query'][_0x2f12('0x41')]){_0x559c19['include']=[{'all':!![]}];}return db[_0x2f12('0x40')]['findAll'](_0x559c19);})[_0x2f12('0x28')](function(_0xbc250a){_0x20a0f9[_0x2f12('0x42')]=_0xbc250a;return _0x20a0f9;})[_0x2f12('0x28')](respondWithFilteredResult(_0x3f6642,_0x559c19))['catch'](handleError(_0x3f6642,null));};exports[_0x2f12('0x43')]=function(_0x1dc0cb,_0x5c5fe8){var _0x31dd02={'raw':!![],'where':{'id':_0x1dc0cb['params']['id']}},_0x4f2f7d={};_0x4f2f7d[_0x2f12('0x37')]=_[_0x2f12('0x33')](db['JscriptyQuestionReport'][_0x2f12('0x2f')]);_0x4f2f7d[_0x2f12('0x32')]=_[_0x2f12('0x33')](_0x1dc0cb[_0x2f12('0x32')]);_0x4f2f7d[_0x2f12('0x34')]=_['intersection'](_0x4f2f7d[_0x2f12('0x37')],_0x4f2f7d[_0x2f12('0x32')]);_0x31dd02[_0x2f12('0x36')]=_[_0x2f12('0x35')](_0x4f2f7d[_0x2f12('0x37')],qs[_0x2f12('0x38')](_0x1dc0cb[_0x2f12('0x32')][_0x2f12('0x38')]));_0x31dd02['attributes']=_0x31dd02[_0x2f12('0x36')][_0x2f12('0x44')]?_0x31dd02['attributes']:_0x4f2f7d['model'];if(_0x1dc0cb['query'][_0x2f12('0x41')]){_0x31dd02['include']=[{'all':!![]}];}_0x31dd02=_[_0x2f12('0x3d')]({},_0x31dd02,_0x1dc0cb[_0x2f12('0x3f')]);return db['JscriptyQuestionReport'][_0x2f12('0x45')](_0x31dd02)[_0x2f12('0x28')](handleEntityNotFound(_0x5c5fe8,null))['then'](respondWithResult(_0x5c5fe8,null))[_0x2f12('0x46')](handleError(_0x5c5fe8,null));};exports[_0x2f12('0x47')]=function(_0xd40842,_0x40107c){return db[_0x2f12('0x40')][_0x2f12('0x47')](_0xd40842[_0x2f12('0x48')],{})[_0x2f12('0x28')](respondWithResult(_0x40107c,0xc9))['catch'](handleError(_0x40107c,null));};exports[_0x2f12('0x27')]=function(_0x2f0548,_0x1d4fd4){if(_0x2f0548[_0x2f12('0x48')]['id']){delete _0x2f0548[_0x2f12('0x48')]['id'];}return db['JscriptyQuestionReport'][_0x2f12('0x45')]({'where':{'id':_0x2f0548[_0x2f12('0x49')]['id']}})[_0x2f12('0x28')](handleEntityNotFound(_0x1d4fd4,null))[_0x2f12('0x28')](saveUpdates(_0x2f0548['body'],null))[_0x2f12('0x28')](respondWithResult(_0x1d4fd4,null))[_0x2f12('0x46')](handleError(_0x1d4fd4,null));};exports[_0x2f12('0x4a')]=function(_0x2fd33a,_0x5e7093){return db[_0x2f12('0x40')][_0x2f12('0x45')]({'where':{'id':_0x2fd33a[_0x2f12('0x49')]['id']}})[_0x2f12('0x28')](handleEntityNotFound(_0x5e7093,null))[_0x2f12('0x28')](removeEntity(_0x5e7093,null))[_0x2f12('0x46')](handleError(_0x5e7093,null));};exports['describe']=function(_0x3b6f79,_0x2846b3){return db['JscriptyQuestionReport'][_0x2f12('0x4b')]()[_0x2f12('0x28')](respondWithResult(_0x2846b3,null))[_0x2f12('0x46')](handleError(_0x2846b3,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index de59ca1..5091a3a 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 _0x753b=['./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x753b,0x164));var _0xb753=function(_0x500439,_0x24b02e){_0x500439=_0x500439-0x0;var _0x476501=_0x753b[_0x500439];return _0x476501;};'use strict';var _=require(_0xb753('0x0'));var util=require(_0xb753('0x1'));var logger=require(_0xb753('0x2'))(_0xb753('0x3'));var moment=require(_0xb753('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb753('0x5'));var rimraf=require(_0xb753('0x6'));var config=require(_0xb753('0x7'));var attributes=require(_0xb753('0x8'));module[_0xb753('0x9')]=function(_0x239d40,_0x450387){return _0x239d40[_0xb753('0xa')](_0xb753('0xb'),attributes,{'tableName':_0xb753('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe81e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','lodash','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe81e,0x75));var _0xee81=function(_0x30cc6c,_0x52e872){_0x30cc6c=_0x30cc6c-0x0;var _0x55168d=_0xe81e[_0x30cc6c];return _0x55168d;};'use strict';var _=require(_0xee81('0x0'));var util=require('util');var logger=require(_0xee81('0x1'))(_0xee81('0x2'));var moment=require(_0xee81('0x3'));var BPromise=require(_0xee81('0x4'));var rp=require(_0xee81('0x5'));var fs=require('fs');var path=require(_0xee81('0x6'));var rimraf=require(_0xee81('0x7'));var config=require(_0xee81('0x8'));var attributes=require(_0xee81('0x9'));module[_0xee81('0xa')]=function(_0x53861d,_0x1ce68b){return _0x53861d[_0xee81('0xb')]('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 0da700d..5e8d3fc 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 _0xb458=['info','JscriptyQuestionReport,\x20%s,\x20%s','stringify','error','code','request\x20sent','result','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb458,0x161));var _0x8b45=function(_0x1ee41b,_0x1874af){_0x1ee41b=_0x1ee41b-0x0;var _0x1f5200=_0xb458[_0x1ee41b];return _0x1f5200;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require(_0x8b45('0x3'));var rs=require(_0x8b45('0x4'));var fs=require('fs');var Redis=require(_0x8b45('0x5'));var db=require(_0x8b45('0x6'))['db'];var utils=require(_0x8b45('0x7'));var logger=require(_0x8b45('0x8'))(_0x8b45('0x9'));var config=require(_0x8b45('0xa'));var jayson=require(_0x8b45('0xb'));var client=jayson[_0x8b45('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1de88b,_0x282820,_0x237086){return new BPromise(function(_0x5c65ef,_0x477252){return client[_0x8b45('0xd')](_0x1de88b,_0x237086)[_0x8b45('0xe')](function(_0x16b78f){logger[_0x8b45('0xf')](_0x8b45('0x10'),_0x282820,'request\x20sent');logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x282820,'request\x20sent',JSON[_0x8b45('0x11')](_0x16b78f));if(_0x16b78f[_0x8b45('0x12')]){if(_0x16b78f['error'][_0x8b45('0x13')]===0x1f4){logger[_0x8b45('0x12')](_0x8b45('0x10'),_0x282820,_0x16b78f[_0x8b45('0x12')]['message']);return _0x477252(_0x16b78f[_0x8b45('0x12')]['message']);}logger['error'](_0x8b45('0x10'),_0x282820,_0x16b78f[_0x8b45('0x12')]['message']);return _0x5c65ef(_0x16b78f[_0x8b45('0x12')]['message']);}else{logger[_0x8b45('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x282820,_0x8b45('0x14'));_0x5c65ef(_0x16b78f[_0x8b45('0x15')][_0x8b45('0x16')]);}})['catch'](function(_0x5d04b3){logger[_0x8b45('0x12')](_0x8b45('0x10'),_0x282820,_0x5d04b3);_0x477252(_0x5d04b3);});});} \ No newline at end of file +var _0x385b=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x4e9322,_0x193f0a){var _0x541652=function(_0x118abb){while(--_0x118abb){_0x4e9322['push'](_0x4e9322['shift']());}};_0x541652(++_0x193f0a);}(_0x385b,0x8e));var _0xb385=function(_0x20b0bd,_0x26e296){_0x20b0bd=_0x20b0bd-0x0;var _0x2051c8=_0x385b[_0x20b0bd];return _0x2051c8;};'use strict';var _=require(_0xb385('0x0'));var util=require('util');var moment=require(_0xb385('0x1'));var BPromise=require(_0xb385('0x2'));var rs=require(_0xb385('0x3'));var fs=require('fs');var Redis=require(_0xb385('0x4'));var db=require(_0xb385('0x5'))['db'];var utils=require(_0xb385('0x6'));var logger=require(_0xb385('0x7'))(_0xb385('0x8'));var config=require('../../config/environment');var jayson=require(_0xb385('0x9'));var client=jayson[_0xb385('0xa')][_0xb385('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41f5f8,_0x27096d,_0x4738ab){return new BPromise(function(_0x54aeb1,_0x10144c){return client['request'](_0x41f5f8,_0x4738ab)[_0xb385('0xc')](function(_0x5c901b){logger[_0xb385('0xd')](_0xb385('0xe'),_0x27096d,_0xb385('0xf'));logger[_0xb385('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x27096d,_0xb385('0xf'),JSON[_0xb385('0x11')](_0x5c901b));if(_0x5c901b['error']){if(_0x5c901b['error'][_0xb385('0x12')]===0x1f4){logger[_0xb385('0x13')](_0xb385('0xe'),_0x27096d,_0x5c901b['error'][_0xb385('0x14')]);return _0x10144c(_0x5c901b['error']['message']);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x27096d,_0x5c901b[_0xb385('0x13')][_0xb385('0x14')]);return _0x54aeb1(_0x5c901b[_0xb385('0x13')][_0xb385('0x14')]);}else{logger['info'](_0xb385('0xe'),_0x27096d,_0xb385('0xf'));_0x54aeb1(_0x5c901b[_0xb385('0x15')][_0xb385('0x14')]);}})[_0xb385('0x16')](function(_0xf31883){logger['error'](_0xb385('0xe'),_0x27096d,_0xf31883);_0x10144c(_0xf31883);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 8c7c4b0..7710f8f 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 _0xd312=['../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/questions','getQuestions','post','put','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x4fe5c0,_0xfa2a3a){var _0x2f4af4=function(_0x23e20a){while(--_0x23e20a){_0x4fe5c0['push'](_0x4fe5c0['shift']());}};_0x2f4af4(++_0xfa2a3a);}(_0xd312,0x14b));var _0x2d31=function(_0x47de8d,_0x5e03ff){_0x47de8d=_0x47de8d-0x0;var _0x2bd7b9=_0xd312[_0x47de8d];return _0x2bd7b9;};'use strict';var multer=require(_0x2d31('0x0'));var util=require(_0x2d31('0x1'));var path=require(_0x2d31('0x2'));var timeout=require('connect-timeout');var express=require(_0x2d31('0x3'));var router=express[_0x2d31('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2d31('0x5'));var controller=require(_0x2d31('0x6'));router[_0x2d31('0x7')]('/',auth[_0x2d31('0x8')](),controller[_0x2d31('0x9')]);router['get'](_0x2d31('0xa'),auth[_0x2d31('0x8')](),controller[_0x2d31('0xb')]);router[_0x2d31('0x7')](_0x2d31('0xc'),auth[_0x2d31('0x8')](),controller['show']);router['get'](_0x2d31('0xd'),auth[_0x2d31('0x8')](),controller[_0x2d31('0xe')]);router[_0x2d31('0xf')]('/',auth[_0x2d31('0x8')](),controller['create']);router[_0x2d31('0x10')](_0x2d31('0xc'),auth[_0x2d31('0x8')](),controller[_0x2d31('0x11')]);router[_0x2d31('0x12')](_0x2d31('0xc'),auth[_0x2d31('0x8')](),controller[_0x2d31('0x13')]);module[_0x2d31('0x14')]=router; \ No newline at end of file +var _0x1eb8=['exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/questions','put','/:id','update','delete','destroy'];(function(_0x41d75b,_0x1fa73f){var _0x3e1048=function(_0x1f4645){while(--_0x1f4645){_0x41d75b['push'](_0x41d75b['shift']());}};_0x3e1048(++_0x1fa73f);}(_0x1eb8,0x1e4));var _0x81eb=function(_0xa44212,_0x1af18b){_0xa44212=_0xa44212-0x0;var _0x452d35=_0x1eb8[_0xa44212];return _0x452d35;};'use strict';var multer=require(_0x81eb('0x0'));var util=require(_0x81eb('0x1'));var path=require(_0x81eb('0x2'));var timeout=require('connect-timeout');var express=require(_0x81eb('0x3'));var router=express[_0x81eb('0x4')]();var fs_extra=require(_0x81eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x81eb('0x6'));var config=require(_0x81eb('0x7'));var controller=require('./jscriptySessionReport.controller');router[_0x81eb('0x8')]('/',auth[_0x81eb('0x9')](),controller[_0x81eb('0xa')]);router[_0x81eb('0x8')](_0x81eb('0xb'),auth['isAuthenticated'](),controller[_0x81eb('0xc')]);router[_0x81eb('0x8')]('/:id',auth[_0x81eb('0x9')](),controller[_0x81eb('0xd')]);router['get'](_0x81eb('0xe'),auth[_0x81eb('0x9')](),controller['getQuestions']);router['post']('/',auth[_0x81eb('0x9')](),controller['create']);router[_0x81eb('0xf')](_0x81eb('0x10'),auth['isAuthenticated'](),controller[_0x81eb('0x11')]);router[_0x81eb('0x12')](_0x81eb('0x10'),auth[_0x81eb('0x9')](),controller[_0x81eb('0x13')]);module[_0x81eb('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index ade466d..0d3b448 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 _0x571a=['format','DATE','STRING','moment','sequelize','exports','setDataValue','starttime','endtime'];(function(_0x12b449,_0x2b8a36){var _0x4e3784=function(_0xf2848c){while(--_0xf2848c){_0x12b449['push'](_0x12b449['shift']());}};_0x4e3784(++_0x2b8a36);}(_0x571a,0xf6));var _0xa571=function(_0x398644,_0x17a2e3){_0x398644=_0x398644-0x0;var _0x582316=_0x571a[_0x398644];return _0x582316;};'use strict';var moment=require(_0xa571('0x0'));var Sequelize=require(_0xa571('0x1'));module[_0xa571('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x47a606){this[_0xa571('0x3')](_0xa571('0x4'),_0x47a606);this['setDataValue'](_0xa571('0x5'),moment()[_0xa571('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xa571('0x7')]},'membername':{'type':Sequelize[_0xa571('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xa571('0x8')]},'calleridname':{'type':Sequelize[_0xa571('0x8')]},'calleridnum':{'type':Sequelize[_0xa571('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5bee=['endtime','format','STRING','BOOLEAN','moment','sequelize','exports','DATE','starttime','setDataValue'];(function(_0x3c307c,_0x1b06c4){var _0x32cf08=function(_0x371144){while(--_0x371144){_0x3c307c['push'](_0x3c307c['shift']());}};_0x32cf08(++_0x1b06c4);}(_0x5bee,0xe0));var _0xe5be=function(_0x52a742,_0x402e3d){_0x52a742=_0x52a742-0x0;var _0x47d29c=_0x5bee[_0x52a742];return _0x47d29c;};'use strict';var moment=require(_0xe5be('0x0'));var Sequelize=require(_0xe5be('0x1'));module[_0xe5be('0x2')]={'starttime':{'type':Sequelize[_0xe5be('0x3')],'set':function(_0x3249d8){this['setDataValue'](_0xe5be('0x4'),_0x3249d8);this[_0xe5be('0x5')](_0xe5be('0x6'),moment()[_0xe5be('0x7')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xe5be('0x8')]},'projectname':{'type':Sequelize[_0xe5be('0x8')]},'queue':{'type':Sequelize[_0xe5be('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe5be('0x8')]},'completed':{'type':Sequelize[_0xe5be('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 528d0c8..d2eb855 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 _0x283b=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','end','stack','name','send','index','map','JscriptySessionReport','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','body','describe','JscriptyQuestionReport','nolimit','order','SessionId','eml-format','zip-dir'];(function(_0x5e0cd6,_0x9fc0f3){var _0x24619c=function(_0x3b11ae){while(--_0x3b11ae){_0x5e0cd6['push'](_0x5e0cd6['shift']());}};_0x24619c(++_0x9fc0f3);}(_0x283b,0x9c));var _0xb283=function(_0xe2d8c4,_0x4e3b34){_0xe2d8c4=_0xe2d8c4-0x0;var _0x5e539a=_0x283b[_0xe2d8c4];return _0x5e539a;};'use strict';var emlformat=require(_0xb283('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb283('0x1'));var jsonpatch=require(_0xb283('0x2'));var rp=require(_0xb283('0x3'));var moment=require(_0xb283('0x4'));var BPromise=require(_0xb283('0x5'));var Mustache=require(_0xb283('0x6'));var util=require(_0xb283('0x7'));var path=require(_0xb283('0x8'));var sox=require(_0xb283('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb283('0xa'));var _=require(_0xb283('0xb'));var squel=require('squel');var crypto=require(_0xb283('0xc'));var jsforce=require(_0xb283('0xd'));var deskjs=require(_0xb283('0xe'));var toCsv=require(_0xb283('0xf'));var querystring=require(_0xb283('0x10'));var Papa=require(_0xb283('0x11'));var Redis=require(_0xb283('0x12'));var authService=require(_0xb283('0x13'));var qs=require(_0xb283('0x14'));var as=require(_0xb283('0x15'));var hardwareService=require(_0xb283('0x16'));var logger=require('../../config/logger')(_0xb283('0x17'));var utils=require(_0xb283('0x18'));var config=require(_0xb283('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb283('0x1a'))['db'];function respondWithStatusCode(_0x33aa4a,_0x4783b1){_0x4783b1=_0x4783b1||0xcc;return function(_0x32bc07){if(_0x32bc07){return _0x33aa4a[_0xb283('0x1b')](_0x4783b1);}return _0x33aa4a[_0xb283('0x1c')](_0x4783b1)['end']();};}function respondWithResult(_0x3c5ff3,_0x4c1141){_0x4c1141=_0x4c1141||0xc8;return function(_0x2d8a67){if(_0x2d8a67){return _0x3c5ff3[_0xb283('0x1c')](_0x4c1141)['json'](_0x2d8a67);}};}function respondWithFilteredResult(_0x335f7a,_0x5406c9){return function(_0x228113){if(_0x228113){var _0x5c9fd5=typeof _0x5406c9['offset']==='undefined'&&typeof _0x5406c9[_0xb283('0x1d')]==='undefined';var _0x3ef26a=_0x228113[_0xb283('0x1e')];var _0x11feec=_0x5c9fd5?0x0:_0x5406c9[_0xb283('0x1f')];var _0x3be706=_0x5c9fd5?_0x228113[_0xb283('0x1e')]:_0x5406c9[_0xb283('0x1f')]+_0x5406c9[_0xb283('0x1d')];var _0x4003c1;if(_0x3be706>=_0x3ef26a){_0x3be706=_0x3ef26a;_0x4003c1=0xc8;}else{_0x4003c1=0xce;}_0x335f7a['status'](_0x4003c1);return _0x335f7a[_0xb283('0x20')](_0xb283('0x21'),_0x11feec+'-'+_0x3be706+'/'+_0x3ef26a)[_0xb283('0x22')](_0x228113);}return null;};}function patchUpdates(_0x57df95){return function(_0x4e4359){try{jsonpatch['apply'](_0x4e4359,_0x57df95,!![]);}catch(_0x42990c){return BPromise[_0xb283('0x23')](_0x42990c);}return _0x4e4359[_0xb283('0x24')]();};}function saveUpdates(_0x185285,_0x44e857){return function(_0x1de8be){if(_0x1de8be){return _0x1de8be[_0xb283('0x25')](_0x185285)[_0xb283('0x26')](function(_0xbe615f){return _0xbe615f;});}return null;};}function removeEntity(_0x25bbd2,_0x81eaf7){return function(_0x32c622){if(_0x32c622){return _0x32c622[_0xb283('0x27')]()[_0xb283('0x26')](function(){_0x25bbd2['status'](0xcc)[_0xb283('0x28')]();});}};}function handleEntityNotFound(_0x191af3,_0x1b634d){return function(_0x386fa7){if(!_0x386fa7){_0x191af3['sendStatus'](0x194);}return _0x386fa7;};}function handleError(_0x18e6f7,_0x13b04b){_0x13b04b=_0x13b04b||0x1f4;return function(_0x6e9e37){logger['error'](_0x6e9e37[_0xb283('0x29')]);if(_0x6e9e37[_0xb283('0x2a')]){delete _0x6e9e37[_0xb283('0x2a')];}_0x18e6f7[_0xb283('0x1c')](_0x13b04b)[_0xb283('0x2b')](_0x6e9e37);};}exports[_0xb283('0x2c')]=function(_0x2d58e7,_0x4cd239){var _0x14f4d4={},_0x30eab7={},_0x506507={'count':0x0,'rows':[]};var _0x229fcb=_[_0xb283('0x2d')](db[_0xb283('0x2e')][_0xb283('0x2f')],function(_0x166f8b){return{'name':_0x166f8b['fieldName'],'type':_0x166f8b[_0xb283('0x30')]['key']};});_0x30eab7[_0xb283('0x31')]=_[_0xb283('0x2d')](_0x229fcb,_0xb283('0x2a'));_0x30eab7[_0xb283('0x32')]=_['keys'](_0x2d58e7[_0xb283('0x32')]);_0x30eab7[_0xb283('0x33')]=_[_0xb283('0x34')](_0x30eab7[_0xb283('0x31')],_0x30eab7[_0xb283('0x32')]);_0x14f4d4[_0xb283('0x35')]=_[_0xb283('0x34')](_0x30eab7[_0xb283('0x31')],qs[_0xb283('0x36')](_0x2d58e7['query'][_0xb283('0x36')]));_0x14f4d4['attributes']=_0x14f4d4[_0xb283('0x35')][_0xb283('0x37')]?_0x14f4d4['attributes']:_0x30eab7[_0xb283('0x31')];if(!_0x2d58e7[_0xb283('0x32')][_0xb283('0x38')]('nolimit')){_0x14f4d4[_0xb283('0x1d')]=qs[_0xb283('0x1d')](_0x2d58e7[_0xb283('0x32')][_0xb283('0x1d')]);_0x14f4d4[_0xb283('0x1f')]=qs['offset'](_0x2d58e7[_0xb283('0x32')][_0xb283('0x1f')]);}_0x14f4d4['order']=qs[_0xb283('0x39')](_0x2d58e7[_0xb283('0x32')][_0xb283('0x39')]);_0x14f4d4[_0xb283('0x3a')]=qs[_0xb283('0x33')](_[_0xb283('0x3b')](_0x2d58e7[_0xb283('0x32')],_0x30eab7['filters']),_0x229fcb);if(_0x2d58e7['query'][_0xb283('0x3c')]){_0x14f4d4[_0xb283('0x3a')]=_[_0xb283('0x3d')](_0x14f4d4[_0xb283('0x3a')],{'$or':_['map'](_0x229fcb,function(_0x3ee126){if(_0x3ee126[_0xb283('0x30')]!==_0xb283('0x3e')){var _0x193a08={};_0x193a08[_0x3ee126[_0xb283('0x2a')]]={'$like':'%'+_0x2d58e7['query'][_0xb283('0x3c')]+'%'};return _0x193a08;}})});}_0x14f4d4=_[_0xb283('0x3d')]({},_0x14f4d4,_0x2d58e7[_0xb283('0x3f')]);var _0x4482b1={'where':_0x14f4d4[_0xb283('0x3a')]};return db[_0xb283('0x2e')][_0xb283('0x1e')](_0x4482b1)[_0xb283('0x26')](function(_0x47f17a){_0x506507[_0xb283('0x1e')]=_0x47f17a;if(_0x2d58e7['query'][_0xb283('0x40')]){_0x14f4d4['include']=[{'all':!![]}];}return db[_0xb283('0x2e')][_0xb283('0x41')](_0x14f4d4);})[_0xb283('0x26')](function(_0x38f199){_0x506507[_0xb283('0x42')]=_0x38f199;return _0x506507;})[_0xb283('0x26')](respondWithFilteredResult(_0x4cd239,_0x14f4d4))[_0xb283('0x43')](handleError(_0x4cd239,null));};exports[_0xb283('0x44')]=function(_0x3cc74e,_0x496cf2){var _0x356752={'raw':!![],'where':{'id':_0x3cc74e[_0xb283('0x45')]['id']}},_0x12932f={};_0x12932f[_0xb283('0x31')]=_[_0xb283('0x46')](db[_0xb283('0x2e')]['rawAttributes']);_0x12932f[_0xb283('0x32')]=_[_0xb283('0x46')](_0x3cc74e[_0xb283('0x32')]);_0x12932f['filters']=_[_0xb283('0x34')](_0x12932f[_0xb283('0x31')],_0x12932f['query']);_0x356752[_0xb283('0x35')]=_[_0xb283('0x34')](_0x12932f['model'],qs[_0xb283('0x36')](_0x3cc74e[_0xb283('0x32')]['fields']));_0x356752['attributes']=_0x356752[_0xb283('0x35')][_0xb283('0x37')]?_0x356752['attributes']:_0x12932f[_0xb283('0x31')];if(_0x3cc74e['query'][_0xb283('0x40')]){_0x356752[_0xb283('0x47')]=[{'all':!![]}];}_0x356752=_[_0xb283('0x3d')]({},_0x356752,_0x3cc74e[_0xb283('0x3f')]);return db[_0xb283('0x2e')][_0xb283('0x48')](_0x356752)[_0xb283('0x26')](handleEntityNotFound(_0x496cf2,null))[_0xb283('0x26')](respondWithResult(_0x496cf2,null))[_0xb283('0x43')](handleError(_0x496cf2,null));};exports['create']=function(_0x87df46,_0x4e8c59){return db[_0xb283('0x2e')]['create'](_0x87df46[_0xb283('0x49')],{})[_0xb283('0x26')](respondWithResult(_0x4e8c59,0xc9))['catch'](handleError(_0x4e8c59,null));};exports['update']=function(_0x198b2f,_0x7c8b1d){if(_0x198b2f[_0xb283('0x49')]['id']){delete _0x198b2f['body']['id'];}return db[_0xb283('0x2e')][_0xb283('0x48')]({'where':{'id':_0x198b2f[_0xb283('0x45')]['id']}})[_0xb283('0x26')](handleEntityNotFound(_0x7c8b1d,null))[_0xb283('0x26')](saveUpdates(_0x198b2f['body'],null))['then'](respondWithResult(_0x7c8b1d,null))['catch'](handleError(_0x7c8b1d,null));};exports[_0xb283('0x27')]=function(_0xed20f5,_0x3f44aa){return db['JscriptySessionReport']['find']({'where':{'id':_0xed20f5['params']['id']}})['then'](handleEntityNotFound(_0x3f44aa,null))[_0xb283('0x26')](removeEntity(_0x3f44aa,null))[_0xb283('0x43')](handleError(_0x3f44aa,null));};exports[_0xb283('0x4a')]=function(_0x4a7baa,_0x5468e6){return db[_0xb283('0x2e')][_0xb283('0x4a')]()[_0xb283('0x26')](respondWithResult(_0x5468e6,null))['catch'](handleError(_0x5468e6,null));};exports['getQuestions']=function(_0x5d1a32,_0x2aeaed,_0x1c38bc){var _0x3c5c5b={'raw':!![],'where':{}};var _0x47abbd={};var _0x54df73={'count':0x0,'rows':[]};return db[_0xb283('0x2e')]['findOne']({'where':{'id':_0x5d1a32[_0xb283('0x45')]['id']}})[_0xb283('0x26')](handleEntityNotFound(_0x2aeaed,null))[_0xb283('0x26')](function(_0x45fbc6){if(_0x45fbc6){_0x47abbd[_0xb283('0x31')]=_[_0xb283('0x46')](db[_0xb283('0x4b')][_0xb283('0x2f')]);_0x47abbd['query']=_['keys'](_0x5d1a32['query']);_0x47abbd[_0xb283('0x33')]=_[_0xb283('0x34')](_0x47abbd[_0xb283('0x31')],_0x47abbd[_0xb283('0x32')]);_0x3c5c5b['attributes']=_[_0xb283('0x34')](_0x47abbd[_0xb283('0x31')],qs['fields'](_0x5d1a32[_0xb283('0x32')][_0xb283('0x36')]));_0x3c5c5b[_0xb283('0x35')]=_0x3c5c5b[_0xb283('0x35')][_0xb283('0x37')]?_0x3c5c5b[_0xb283('0x35')]:_0x47abbd[_0xb283('0x31')];if(!_0x5d1a32[_0xb283('0x32')][_0xb283('0x38')](_0xb283('0x4c'))){_0x3c5c5b[_0xb283('0x1d')]=qs['limit'](_0x5d1a32[_0xb283('0x32')][_0xb283('0x1d')]);_0x3c5c5b['offset']=qs[_0xb283('0x1f')](_0x5d1a32[_0xb283('0x32')][_0xb283('0x1f')]);}_0x3c5c5b[_0xb283('0x4d')]=qs[_0xb283('0x39')](_0x5d1a32['query'][_0xb283('0x39')]);_0x3c5c5b[_0xb283('0x3a')]=qs[_0xb283('0x33')](_[_0xb283('0x3b')](_0x5d1a32[_0xb283('0x32')],_0x47abbd[_0xb283('0x33')]));_0x3c5c5b['where'][_0xb283('0x4e')]=_0x45fbc6['id'];if(_0x5d1a32[_0xb283('0x32')][_0xb283('0x3c')]){_0x3c5c5b[_0xb283('0x3a')]=_[_0xb283('0x3d')](_0x3c5c5b[_0xb283('0x3a')],{'$or':_[_0xb283('0x2d')](_0x3c5c5b[_0xb283('0x35')],function(_0xe8820f){var _0x3dd8a1={};_0x3dd8a1[_0xe8820f]={'$like':'%'+_0x5d1a32[_0xb283('0x32')][_0xb283('0x3c')]+'%'};return _0x3dd8a1;})});}_0x3c5c5b=_[_0xb283('0x3d')]({},_0x3c5c5b,_0x5d1a32['options']);return db['JscriptyQuestionReport']['count']({'where':_0x3c5c5b[_0xb283('0x3a')]})[_0xb283('0x26')](function(_0x2aee5c){_0x54df73[_0xb283('0x1e')]=_0x2aee5c;if(_0x5d1a32['query'][_0xb283('0x40')]){_0x3c5c5b[_0xb283('0x47')]=[{'all':!![]}];}return db[_0xb283('0x4b')]['findAll'](_0x3c5c5b);})['then'](function(_0x86c4dd){_0x54df73['rows']=_0x86c4dd;return _0x54df73;});}})[_0xb283('0x26')](respondWithFilteredResult(_0x2aeaed,_0x3c5c5b))['catch'](handleError(_0x2aeaed,null));}; \ No newline at end of file +var _0x1fbc=['count','offset','set','Content-Range','apply','save','update','then','destroy','end','error','name','send','map','JscriptySessionReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','show','params','find','catch','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','undefined'];(function(_0x1748d0,_0x35f2bd){var _0x214929=function(_0x30c04a){while(--_0x30c04a){_0x1748d0['push'](_0x1748d0['shift']());}};_0x214929(++_0x35f2bd);}(_0x1fbc,0x17a));var _0xc1fb=function(_0x305d3b,_0xa70bd5){_0x305d3b=_0x305d3b-0x0;var _0x49057b=_0x1fbc[_0x305d3b];return _0x49057b;};'use strict';var emlformat=require(_0xc1fb('0x0'));var rimraf=require(_0xc1fb('0x1'));var zipdir=require(_0xc1fb('0x2'));var jsonpatch=require(_0xc1fb('0x3'));var rp=require(_0xc1fb('0x4'));var moment=require(_0xc1fb('0x5'));var BPromise=require(_0xc1fb('0x6'));var Mustache=require(_0xc1fb('0x7'));var util=require(_0xc1fb('0x8'));var path=require(_0xc1fb('0x9'));var sox=require(_0xc1fb('0xa'));var csv=require(_0xc1fb('0xb'));var ejs=require(_0xc1fb('0xc'));var fs=require('fs');var fs_extra=require(_0xc1fb('0xd'));var _=require(_0xc1fb('0xe'));var squel=require(_0xc1fb('0xf'));var crypto=require('crypto');var jsforce=require(_0xc1fb('0x10'));var deskjs=require(_0xc1fb('0x11'));var toCsv=require(_0xc1fb('0xb'));var querystring=require(_0xc1fb('0x12'));var Papa=require(_0xc1fb('0x13'));var Redis=require(_0xc1fb('0x14'));var authService=require(_0xc1fb('0x15'));var qs=require(_0xc1fb('0x16'));var as=require(_0xc1fb('0x17'));var hardwareService=require(_0xc1fb('0x18'));var logger=require(_0xc1fb('0x19'))(_0xc1fb('0x1a'));var utils=require('../../config/utils');var config=require(_0xc1fb('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e32c6,_0x26a459){_0x26a459=_0x26a459||0xcc;return function(_0x472f4b){if(_0x472f4b){return _0x2e32c6[_0xc1fb('0x1c')](_0x26a459);}return _0x2e32c6[_0xc1fb('0x1d')](_0x26a459)['end']();};}function respondWithResult(_0x962e62,_0x29421b){_0x29421b=_0x29421b||0xc8;return function(_0x2e6af4){if(_0x2e6af4){return _0x962e62[_0xc1fb('0x1d')](_0x29421b)[_0xc1fb('0x1e')](_0x2e6af4);}};}function respondWithFilteredResult(_0x50fcde,_0x22f62d){return function(_0x5afa05){if(_0x5afa05){var _0x662cf3=typeof _0x22f62d['offset']===_0xc1fb('0x1f')&&typeof _0x22f62d['limit']==='undefined';var _0x1b4aa7=_0x5afa05[_0xc1fb('0x20')];var _0x17663a=_0x662cf3?0x0:_0x22f62d[_0xc1fb('0x21')];var _0x3a92c5=_0x662cf3?_0x5afa05[_0xc1fb('0x20')]:_0x22f62d[_0xc1fb('0x21')]+_0x22f62d['limit'];var _0x467ecf;if(_0x3a92c5>=_0x1b4aa7){_0x3a92c5=_0x1b4aa7;_0x467ecf=0xc8;}else{_0x467ecf=0xce;}_0x50fcde[_0xc1fb('0x1d')](_0x467ecf);return _0x50fcde[_0xc1fb('0x22')](_0xc1fb('0x23'),_0x17663a+'-'+_0x3a92c5+'/'+_0x1b4aa7)[_0xc1fb('0x1e')](_0x5afa05);}return null;};}function patchUpdates(_0x4e5ba8){return function(_0x2afeae){try{jsonpatch[_0xc1fb('0x24')](_0x2afeae,_0x4e5ba8,!![]);}catch(_0x3411da){return BPromise['reject'](_0x3411da);}return _0x2afeae[_0xc1fb('0x25')]();};}function saveUpdates(_0x430da1,_0x587170){return function(_0x4abd85){if(_0x4abd85){return _0x4abd85[_0xc1fb('0x26')](_0x430da1)[_0xc1fb('0x27')](function(_0x2a6f96){return _0x2a6f96;});}return null;};}function removeEntity(_0x5d7b66,_0x1c7d52){return function(_0x31158b){if(_0x31158b){return _0x31158b[_0xc1fb('0x28')]()['then'](function(){_0x5d7b66[_0xc1fb('0x1d')](0xcc)[_0xc1fb('0x29')]();});}};}function handleEntityNotFound(_0x5a8fc3,_0x51ad6b){return function(_0x23b126){if(!_0x23b126){_0x5a8fc3[_0xc1fb('0x1c')](0x194);}return _0x23b126;};}function handleError(_0x5aec21,_0x265f75){_0x265f75=_0x265f75||0x1f4;return function(_0x32e38d){logger[_0xc1fb('0x2a')](_0x32e38d['stack']);if(_0x32e38d[_0xc1fb('0x2b')]){delete _0x32e38d[_0xc1fb('0x2b')];}_0x5aec21['status'](_0x265f75)[_0xc1fb('0x2c')](_0x32e38d);};}exports['index']=function(_0x2d6889,_0x2fb80e){var _0x52b7d0={},_0xad8a53={},_0xd3785a={'count':0x0,'rows':[]};var _0x4fc377=_[_0xc1fb('0x2d')](db[_0xc1fb('0x2e')][_0xc1fb('0x2f')],function(_0x1a33ae){return{'name':_0x1a33ae[_0xc1fb('0x30')],'type':_0x1a33ae[_0xc1fb('0x31')]['key']};});_0xad8a53[_0xc1fb('0x32')]=_['map'](_0x4fc377,_0xc1fb('0x2b'));_0xad8a53[_0xc1fb('0x33')]=_[_0xc1fb('0x34')](_0x2d6889['query']);_0xad8a53[_0xc1fb('0x35')]=_[_0xc1fb('0x36')](_0xad8a53[_0xc1fb('0x32')],_0xad8a53[_0xc1fb('0x33')]);_0x52b7d0[_0xc1fb('0x37')]=_['intersection'](_0xad8a53['model'],qs[_0xc1fb('0x38')](_0x2d6889['query'][_0xc1fb('0x38')]));_0x52b7d0['attributes']=_0x52b7d0[_0xc1fb('0x37')][_0xc1fb('0x39')]?_0x52b7d0[_0xc1fb('0x37')]:_0xad8a53['model'];if(!_0x2d6889['query'][_0xc1fb('0x3a')](_0xc1fb('0x3b'))){_0x52b7d0['limit']=qs[_0xc1fb('0x3c')](_0x2d6889[_0xc1fb('0x33')][_0xc1fb('0x3c')]);_0x52b7d0[_0xc1fb('0x21')]=qs[_0xc1fb('0x21')](_0x2d6889[_0xc1fb('0x33')][_0xc1fb('0x21')]);}_0x52b7d0[_0xc1fb('0x3d')]=qs[_0xc1fb('0x3e')](_0x2d6889[_0xc1fb('0x33')][_0xc1fb('0x3e')]);_0x52b7d0[_0xc1fb('0x3f')]=qs['filters'](_[_0xc1fb('0x40')](_0x2d6889[_0xc1fb('0x33')],_0xad8a53[_0xc1fb('0x35')]),_0x4fc377);if(_0x2d6889['query']['filter']){_0x52b7d0[_0xc1fb('0x3f')]=_[_0xc1fb('0x41')](_0x52b7d0['where'],{'$or':_[_0xc1fb('0x2d')](_0x4fc377,function(_0x42679e){if(_0x42679e[_0xc1fb('0x31')]!=='VIRTUAL'){var _0x45a392={};_0x45a392[_0x42679e[_0xc1fb('0x2b')]]={'$like':'%'+_0x2d6889[_0xc1fb('0x33')][_0xc1fb('0x42')]+'%'};return _0x45a392;}})});}_0x52b7d0=_[_0xc1fb('0x41')]({},_0x52b7d0,_0x2d6889[_0xc1fb('0x43')]);var _0x48b98f={'where':_0x52b7d0[_0xc1fb('0x3f')]};return db[_0xc1fb('0x2e')][_0xc1fb('0x20')](_0x48b98f)['then'](function(_0x27a389){_0xd3785a[_0xc1fb('0x20')]=_0x27a389;if(_0x2d6889[_0xc1fb('0x33')][_0xc1fb('0x44')]){_0x52b7d0['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0xc1fb('0x45')](_0x52b7d0);})['then'](function(_0x8c4d14){_0xd3785a[_0xc1fb('0x46')]=_0x8c4d14;return _0xd3785a;})['then'](respondWithFilteredResult(_0x2fb80e,_0x52b7d0))['catch'](handleError(_0x2fb80e,null));};exports[_0xc1fb('0x47')]=function(_0x287776,_0x127a5a){var _0x23187c={'raw':!![],'where':{'id':_0x287776[_0xc1fb('0x48')]['id']}},_0x22cd61={};_0x22cd61['model']=_['keys'](db[_0xc1fb('0x2e')]['rawAttributes']);_0x22cd61[_0xc1fb('0x33')]=_[_0xc1fb('0x34')](_0x287776['query']);_0x22cd61[_0xc1fb('0x35')]=_[_0xc1fb('0x36')](_0x22cd61['model'],_0x22cd61['query']);_0x23187c[_0xc1fb('0x37')]=_[_0xc1fb('0x36')](_0x22cd61[_0xc1fb('0x32')],qs[_0xc1fb('0x38')](_0x287776[_0xc1fb('0x33')][_0xc1fb('0x38')]));_0x23187c[_0xc1fb('0x37')]=_0x23187c['attributes'][_0xc1fb('0x39')]?_0x23187c[_0xc1fb('0x37')]:_0x22cd61[_0xc1fb('0x32')];if(_0x287776[_0xc1fb('0x33')][_0xc1fb('0x44')]){_0x23187c['include']=[{'all':!![]}];}_0x23187c=_['merge']({},_0x23187c,_0x287776[_0xc1fb('0x43')]);return db[_0xc1fb('0x2e')][_0xc1fb('0x49')](_0x23187c)[_0xc1fb('0x27')](handleEntityNotFound(_0x127a5a,null))[_0xc1fb('0x27')](respondWithResult(_0x127a5a,null))[_0xc1fb('0x4a')](handleError(_0x127a5a,null));};exports[_0xc1fb('0x4b')]=function(_0x3343c7,_0x57021a){return db[_0xc1fb('0x2e')][_0xc1fb('0x4b')](_0x3343c7[_0xc1fb('0x4c')],{})['then'](respondWithResult(_0x57021a,0xc9))[_0xc1fb('0x4a')](handleError(_0x57021a,null));};exports['update']=function(_0x67f31b,_0x2a976e){if(_0x67f31b[_0xc1fb('0x4c')]['id']){delete _0x67f31b[_0xc1fb('0x4c')]['id'];}return db[_0xc1fb('0x2e')][_0xc1fb('0x49')]({'where':{'id':_0x67f31b[_0xc1fb('0x48')]['id']}})[_0xc1fb('0x27')](handleEntityNotFound(_0x2a976e,null))[_0xc1fb('0x27')](saveUpdates(_0x67f31b['body'],null))[_0xc1fb('0x27')](respondWithResult(_0x2a976e,null))[_0xc1fb('0x4a')](handleError(_0x2a976e,null));};exports[_0xc1fb('0x28')]=function(_0x2d3c5f,_0x2e22e6){return db[_0xc1fb('0x2e')]['find']({'where':{'id':_0x2d3c5f[_0xc1fb('0x48')]['id']}})[_0xc1fb('0x27')](handleEntityNotFound(_0x2e22e6,null))[_0xc1fb('0x27')](removeEntity(_0x2e22e6,null))[_0xc1fb('0x4a')](handleError(_0x2e22e6,null));};exports[_0xc1fb('0x4d')]=function(_0x1b21ac,_0x298ecb){return db['JscriptySessionReport'][_0xc1fb('0x4d')]()[_0xc1fb('0x27')](respondWithResult(_0x298ecb,null))[_0xc1fb('0x4a')](handleError(_0x298ecb,null));};exports[_0xc1fb('0x4e')]=function(_0x36f8ac,_0x38bc84,_0x3ff7a6){var _0x2f05a8={'raw':!![],'where':{}};var _0x3246c7={};var _0x21d7b6={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xc1fb('0x4f')]({'where':{'id':_0x36f8ac[_0xc1fb('0x48')]['id']}})[_0xc1fb('0x27')](handleEntityNotFound(_0x38bc84,null))['then'](function(_0x48c429){if(_0x48c429){_0x3246c7[_0xc1fb('0x32')]=_[_0xc1fb('0x34')](db[_0xc1fb('0x50')]['rawAttributes']);_0x3246c7[_0xc1fb('0x33')]=_['keys'](_0x36f8ac['query']);_0x3246c7[_0xc1fb('0x35')]=_[_0xc1fb('0x36')](_0x3246c7[_0xc1fb('0x32')],_0x3246c7['query']);_0x2f05a8['attributes']=_[_0xc1fb('0x36')](_0x3246c7['model'],qs['fields'](_0x36f8ac['query'][_0xc1fb('0x38')]));_0x2f05a8[_0xc1fb('0x37')]=_0x2f05a8[_0xc1fb('0x37')]['length']?_0x2f05a8[_0xc1fb('0x37')]:_0x3246c7[_0xc1fb('0x32')];if(!_0x36f8ac[_0xc1fb('0x33')][_0xc1fb('0x3a')](_0xc1fb('0x3b'))){_0x2f05a8[_0xc1fb('0x3c')]=qs[_0xc1fb('0x3c')](_0x36f8ac[_0xc1fb('0x33')][_0xc1fb('0x3c')]);_0x2f05a8['offset']=qs[_0xc1fb('0x21')](_0x36f8ac['query'][_0xc1fb('0x21')]);}_0x2f05a8[_0xc1fb('0x3d')]=qs[_0xc1fb('0x3e')](_0x36f8ac[_0xc1fb('0x33')][_0xc1fb('0x3e')]);_0x2f05a8[_0xc1fb('0x3f')]=qs[_0xc1fb('0x35')](_['pick'](_0x36f8ac[_0xc1fb('0x33')],_0x3246c7[_0xc1fb('0x35')]));_0x2f05a8[_0xc1fb('0x3f')][_0xc1fb('0x51')]=_0x48c429['id'];if(_0x36f8ac[_0xc1fb('0x33')][_0xc1fb('0x42')]){_0x2f05a8['where']=_[_0xc1fb('0x41')](_0x2f05a8[_0xc1fb('0x3f')],{'$or':_[_0xc1fb('0x2d')](_0x2f05a8[_0xc1fb('0x37')],function(_0x4f9d99){var _0x9daad3={};_0x9daad3[_0x4f9d99]={'$like':'%'+_0x36f8ac[_0xc1fb('0x33')][_0xc1fb('0x42')]+'%'};return _0x9daad3;})});}_0x2f05a8=_[_0xc1fb('0x41')]({},_0x2f05a8,_0x36f8ac[_0xc1fb('0x43')]);return db['JscriptyQuestionReport']['count']({'where':_0x2f05a8['where']})[_0xc1fb('0x27')](function(_0x5692bc){_0x21d7b6[_0xc1fb('0x20')]=_0x5692bc;if(_0x36f8ac['query'][_0xc1fb('0x44')]){_0x2f05a8['include']=[{'all':!![]}];}return db[_0xc1fb('0x50')][_0xc1fb('0x45')](_0x2f05a8);})[_0xc1fb('0x27')](function(_0x2607a4){_0x21d7b6[_0xc1fb('0x46')]=_0x2607a4;return _0x21d7b6;});}})['then'](respondWithFilteredResult(_0x38bc84,_0x2f05a8))[_0xc1fb('0x4a')](handleError(_0x38bc84,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 6cbc982..1c98dff 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 _0xe2fe=['../../config/environment','exports','define','JscriptySessionReport','lodash','api','bluebird','request-promise','path','rimraf'];(function(_0x1646fa,_0x4e5bd7){var _0x5a47a5=function(_0x2db820){while(--_0x2db820){_0x1646fa['push'](_0x1646fa['shift']());}};_0x5a47a5(++_0x4e5bd7);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./jscriptySessionReport.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe015=['lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','report_jscripty_sessions'];(function(_0x4144af,_0x4a385a){var _0xf3e13d=function(_0x1fb45a){while(--_0x1fb45a){_0x4144af['push'](_0x4144af['shift']());}};_0xf3e13d(++_0x4a385a);}(_0xe015,0x13b));var _0x5e01=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xe015[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var logger=require(_0x5e01('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5e01('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e01('0x4'));var rimraf=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var attributes=require(_0x5e01('0x7'));module['exports']=function(_0x1814cb,_0x3d2da2){return _0x1814cb['define']('JscriptySessionReport',attributes,{'tableName':_0x5e01('0x8'),'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 4a56a13..6081e23 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 _0x5430=['ioredis','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5430,0x10c));var _0x0543=function(_0x3f700a,_0x44556f){_0x3f700a=_0x3f700a-0x0;var _0x2e3072=_0x5430[_0x3f700a];return _0x2e3072;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var BPromise=require(_0x0543('0x3'));var rs=require(_0x0543('0x4'));var fs=require('fs');var Redis=require(_0x0543('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0543('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0543('0x7'));var client=jayson[_0x0543('0x8')][_0x0543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319568,_0x46bca7,_0x5ac352){return new BPromise(function(_0x372974,_0x7b8280){return client[_0x0543('0xa')](_0x319568,_0x5ac352)[_0x0543('0xb')](function(_0x2fb723){logger[_0x0543('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'));logger[_0x0543('0xe')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'),JSON[_0x0543('0xf')](_0x2fb723));if(_0x2fb723[_0x0543('0x10')]){if(_0x2fb723[_0x0543('0x10')][_0x0543('0x11')]===0x1f4){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x7b8280(_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);}logger[_0x0543('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x372974(_0x2fb723['error']['message']);}else{logger[_0x0543('0xc')](_0x0543('0x12'),_0x46bca7,_0x0543('0xd'));_0x372974(_0x2fb723[_0x0543('0x14')][_0x0543('0x13')]);}})['catch'](function(_0xe69a3d){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0xe69a3d);_0x7b8280(_0xe69a3d);});});} \ 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','JscriptySessionReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x97d718,_0x3b9e79){var _0x376dfa=function(_0x57b90f){while(--_0x57b90f){_0x97d718['push'](_0x97d718['shift']());}};_0x376dfa(++_0x3b9e79);}(_0x5f2f,0x73));var _0xf5f2=function(_0x7f5b03,_0x41b85a){_0x7f5b03=_0x7f5b03-0x0;var _0x3e5c14=_0x5f2f[_0x7f5b03];return _0x3e5c14;};'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')]('JscriptySessionReport,\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/license/index.js b/server/api/license/index.js index b470c53..859129b 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 _0x2b26=['isAuthenticated','downloadLogFile','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./license.controller','update','/download_log_file'];(function(_0x215775,_0x15bc76){var _0x2c189d=function(_0x287040){while(--_0x287040){_0x215775['push'](_0x215775['shift']());}};_0x2c189d(++_0x15bc76);}(_0x2b26,0x1f1));var _0x62b2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2b26[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require(_0x62b2('0x0'));var path=require(_0x62b2('0x1'));var timeout=require('connect-timeout');var express=require(_0x62b2('0x2'));var router=express[_0x62b2('0x3')]();var fs_extra=require(_0x62b2('0x4'));var auth=require(_0x62b2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x62b2('0x6'));var controller=require(_0x62b2('0x7'));router['get']('/',controller['index']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x62b2('0x8')]);router['get'](_0x62b2('0x9'),auth[_0x62b2('0xa')](),controller[_0x62b2('0xb')]);module[_0x62b2('0xc')]=router; \ No newline at end of file +var _0x0773=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','put','update','/download_log_file','isAuthenticated','downloadLogFile','exports','multer','util'];(function(_0x2074db,_0x10b81b){var _0x27324c=function(_0x5c3d5c){while(--_0x5c3d5c){_0x2074db['push'](_0x2074db['shift']());}};_0x27324c(++_0x10b81b);}(_0x0773,0x1c9));var _0x3077=function(_0xe29e0c,_0x24f0ea){_0xe29e0c=_0xe29e0c-0x0;var _0x55e481=_0x0773[_0xe29e0c];return _0x55e481;};'use strict';var multer=require(_0x3077('0x0'));var util=require(_0x3077('0x1'));var path=require(_0x3077('0x2'));var timeout=require(_0x3077('0x3'));var express=require(_0x3077('0x4'));var router=express['Router']();var fs_extra=require(_0x3077('0x5'));var auth=require(_0x3077('0x6'));var interaction=require(_0x3077('0x7'));var config=require(_0x3077('0x8'));var controller=require('./license.controller');router[_0x3077('0x9')]('/',controller[_0x3077('0xa')]);router[_0x3077('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x3077('0xc')]);router[_0x3077('0x9')](_0x3077('0xd'),auth[_0x3077('0xe')](),controller[_0x3077('0xf')]);module[_0x3077('0x10')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 7d8b172..f0a91cb 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 _0x4e10=['sequelize','exports','TEXT','STRING','INTEGER'];(function(_0x26d4f9,_0x328753){var _0x12e090=function(_0x3a6eb9){while(--_0x3a6eb9){_0x26d4f9['push'](_0x26d4f9['shift']());}};_0x12e090(++_0x328753);}(_0x4e10,0x1d1));var _0x04e1=function(_0x58847d,_0x314b36){_0x58847d=_0x58847d-0x0;var _0x1e739e=_0x4e10[_0x58847d];return _0x1e739e;};'use strict';var Sequelize=require(_0x04e1('0x0'));module[_0x04e1('0x1')]={'license':{'type':Sequelize[_0x04e1('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x04e1('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x04e1('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb7f9=['sequelize','exports','STRING'];(function(_0x4bd67a,_0x4f9725){var _0x2be5fb=function(_0x33e132){while(--_0x33e132){_0x4bd67a['push'](_0x4bd67a['shift']());}};_0x2be5fb(++_0x4f9725);}(_0xb7f9,0x189));var _0x9b7f=function(_0x29dfa5,_0xd3078e){_0x29dfa5=_0x29dfa5-0x0;var _0x41c15a=_0xb7f9[_0x29dfa5];return _0x41c15a;};'use strict';var Sequelize=require(_0x9b7f('0x0'));module[_0x9b7f('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x9b7f('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 117e1c9..54fd0ab 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 _0xaaca=['keys','rawAttributes','query','intersection','attributes','fields','length','merge','getLicense','catch','body','License','find','get','checkLicense','key','downloadLogFile','join','/var','log','xcally','Content-disposition','attachment;\x20filename=','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','index','model'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xaaca,0x1a4));var _0xaaac=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0xaaca[_0x49d41c];return _0xb64c5f;};'use strict';var emlformat=require(_0xaaac('0x0'));var rimraf=require(_0xaaac('0x1'));var zipdir=require(_0xaaac('0x2'));var jsonpatch=require(_0xaaac('0x3'));var rp=require('request-promise');var moment=require(_0xaaac('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaaac('0x5'));var util=require(_0xaaac('0x6'));var path=require('path');var sox=require(_0xaaac('0x7'));var csv=require(_0xaaac('0x8'));var ejs=require(_0xaaac('0x9'));var fs=require('fs');var fs_extra=require(_0xaaac('0xa'));var _=require(_0xaaac('0xb'));var squel=require(_0xaaac('0xc'));var crypto=require(_0xaaac('0xd'));var jsforce=require(_0xaaac('0xe'));var deskjs=require(_0xaaac('0xf'));var toCsv=require(_0xaaac('0x8'));var querystring=require('querystring');var Papa=require(_0xaaac('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaaac('0x11'));var as=require(_0xaaac('0x12'));var hardwareService=require(_0xaaac('0x13'));var logger=require(_0xaaac('0x14'))('api');var utils=require(_0xaaac('0x15'));var config=require(_0xaaac('0x16'));var licenseUtil=require(_0xaaac('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14bcf2,_0x455dc2){_0x455dc2=_0x455dc2||0xcc;return function(_0xf51b22){if(_0xf51b22){return _0x14bcf2[_0xaaac('0x18')](_0x455dc2);}return _0x14bcf2[_0xaaac('0x19')](_0x455dc2)['end']();};}function respondWithResult(_0x13fa7f,_0x5aa687){_0x5aa687=_0x5aa687||0xc8;return function(_0x448faf){if(_0x448faf){return _0x13fa7f[_0xaaac('0x19')](_0x5aa687)[_0xaaac('0x1a')](_0x448faf);}};}function respondWithFilteredResult(_0x3bb2fb,_0x3c5eb9){return function(_0x1b0df5){if(_0x1b0df5){var _0x1ff4ec=typeof _0x3c5eb9[_0xaaac('0x1b')]===_0xaaac('0x1c')&&typeof _0x3c5eb9[_0xaaac('0x1d')]==='undefined';var _0x15ebb9=_0x1b0df5[_0xaaac('0x1e')];var _0xdf98e1=_0x1ff4ec?0x0:_0x3c5eb9[_0xaaac('0x1b')];var _0x33ca5e=_0x1ff4ec?_0x1b0df5[_0xaaac('0x1e')]:_0x3c5eb9[_0xaaac('0x1b')]+_0x3c5eb9[_0xaaac('0x1d')];var _0x23381e;if(_0x33ca5e>=_0x15ebb9){_0x33ca5e=_0x15ebb9;_0x23381e=0xc8;}else{_0x23381e=0xce;}_0x3bb2fb['status'](_0x23381e);return _0x3bb2fb[_0xaaac('0x1f')]('Content-Range',_0xdf98e1+'-'+_0x33ca5e+'/'+_0x15ebb9)[_0xaaac('0x1a')](_0x1b0df5);}return null;};}function patchUpdates(_0x58efb0){return function(_0x1d7d5d){try{jsonpatch[_0xaaac('0x20')](_0x1d7d5d,_0x58efb0,!![]);}catch(_0x3312a8){return BPromise['reject'](_0x3312a8);}return _0x1d7d5d[_0xaaac('0x21')]();};}function saveUpdates(_0x411e66,_0x378f36){return function(_0x466458){if(_0x466458){return _0x466458[_0xaaac('0x22')](_0x411e66)[_0xaaac('0x23')](function(_0x3fd7b7){return _0x3fd7b7;});}return null;};}function removeEntity(_0x832e27,_0x38b1bb){return function(_0x247402){if(_0x247402){return _0x247402[_0xaaac('0x24')]()[_0xaaac('0x23')](function(){_0x832e27[_0xaaac('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29d6e8,_0x277695){return function(_0xa8c45c){if(!_0xa8c45c){_0x29d6e8[_0xaaac('0x18')](0x194);}return _0xa8c45c;};}function handleError(_0x2ec38d,_0x2d79e7){_0x2d79e7=_0x2d79e7||0x1f4;return function(_0x5a6344){logger[_0xaaac('0x25')](_0x5a6344['stack']);if(_0x5a6344['name']){delete _0x5a6344[_0xaaac('0x26')];}_0x2ec38d[_0xaaac('0x19')](_0x2d79e7)[_0xaaac('0x27')](_0x5a6344);};}var utilLicense=require('../../config/license/util');exports[_0xaaac('0x28')]=function(_0x2321c7,_0x56d9ff){var _0x12a79b={'raw':!![],'where':{'id':0x1}},_0x98b9d8={};_0x98b9d8[_0xaaac('0x29')]=_[_0xaaac('0x2a')](db['License'][_0xaaac('0x2b')]);_0x98b9d8[_0xaaac('0x2c')]=_[_0xaaac('0x2a')](_0x2321c7[_0xaaac('0x2c')]);_0x98b9d8['filters']=_[_0xaaac('0x2d')](_0x98b9d8[_0xaaac('0x29')],_0x98b9d8['query']);_0x12a79b[_0xaaac('0x2e')]=_[_0xaaac('0x2d')](_0x98b9d8[_0xaaac('0x29')],qs[_0xaaac('0x2f')](_0x2321c7['query'][_0xaaac('0x2f')]));_0x12a79b[_0xaaac('0x2e')]=_0x12a79b[_0xaaac('0x2e')][_0xaaac('0x30')]?_0x12a79b[_0xaaac('0x2e')]:_0x98b9d8[_0xaaac('0x29')];_0x12a79b=_[_0xaaac('0x31')]({},_0x12a79b,_0x2321c7['options']);return utilLicense[_0xaaac('0x32')](_0x12a79b)[_0xaaac('0x23')](respondWithResult(_0x56d9ff,null))[_0xaaac('0x33')](handleError(_0x56d9ff,null));};exports[_0xaaac('0x22')]=function(_0x4d1ba5,_0x36ec63){if(_0x4d1ba5[_0xaaac('0x34')]['id']){delete _0x4d1ba5[_0xaaac('0x34')]['id'];}return db[_0xaaac('0x35')][_0xaaac('0x36')]({'where':{'id':_0x4d1ba5['params']['id']}})['then'](handleEntityNotFound(_0x36ec63,null))[_0xaaac('0x23')](function(_0x499d80){var _0x2ebe3d=_0x499d80[_0xaaac('0x37')]({'plain':!![]});return utilLicense[_0xaaac('0x38')](_0x2ebe3d,_0x4d1ba5[_0xaaac('0x34')][_0xaaac('0x39')]);})['then'](function(_0x4ed431){if(!_0x4ed431['demo']){return saveUpdates(_0x4d1ba5[_0xaaac('0x34')],null);}return _0x4ed431;})[_0xaaac('0x23')](respondWithResult(_0x36ec63,null))[_0xaaac('0x33')](handleError(_0x36ec63,null));};exports[_0xaaac('0x3a')]=function(_0x562441,_0x1d6305){var _0x36a616='license-info.log';var _0x21bf03=path[_0xaaac('0x3b')](_0xaaac('0x3c'),_0xaaac('0x3d'),_0xaaac('0x3e'),_0x36a616);_0x1d6305['setHeader'](_0xaaac('0x3f'),_0xaaac('0x40')+_0x36a616);_0x1d6305[_0xaaac('0x1f')]('Content-Type',_0xaaac('0x41'));_0x1d6305['download'](_0x21bf03);}; \ No newline at end of file +var _0x96f3=['offset','Content-Range','apply','reject','then','end','error','stack','name','send','index','model','keys','License','rawAttributes','query','intersection','attributes','fields','merge','options','catch','update','body','params','get','checkLicense','key','license-info.log','join','/var','log','setHeader','attachment;\x20filename=','set','Content-Type','text/plain','download','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count'];(function(_0x59700a,_0x26ae33){var _0x108ab7=function(_0x1ebb4e){while(--_0x1ebb4e){_0x59700a['push'](_0x59700a['shift']());}};_0x108ab7(++_0x26ae33);}(_0x96f3,0x175));var _0x396f=function(_0x4401b1,_0x4794dd){_0x4401b1=_0x4401b1-0x0;var _0x59d5ba=_0x96f3[_0x4401b1];return _0x59d5ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x396f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x396f('0x1'));var rp=require(_0x396f('0x2'));var moment=require(_0x396f('0x3'));var BPromise=require(_0x396f('0x4'));var Mustache=require(_0x396f('0x5'));var util=require(_0x396f('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x396f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x396f('0x8'));var _=require(_0x396f('0x9'));var squel=require(_0x396f('0xa'));var crypto=require('crypto');var jsforce=require(_0x396f('0xb'));var deskjs=require(_0x396f('0xc'));var toCsv=require(_0x396f('0x7'));var querystring=require(_0x396f('0xd'));var Papa=require(_0x396f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x396f('0xf'));var as=require(_0x396f('0x10'));var hardwareService=require(_0x396f('0x11'));var logger=require('../../config/logger')(_0x396f('0x12'));var utils=require(_0x396f('0x13'));var config=require(_0x396f('0x14'));var licenseUtil=require(_0x396f('0x15'));var db=require(_0x396f('0x16'))['db'];function respondWithStatusCode(_0x2d7a2f,_0x52c48a){_0x52c48a=_0x52c48a||0xcc;return function(_0x356340){if(_0x356340){return _0x2d7a2f[_0x396f('0x17')](_0x52c48a);}return _0x2d7a2f[_0x396f('0x18')](_0x52c48a)['end']();};}function respondWithResult(_0x3a443f,_0x3a827b){_0x3a827b=_0x3a827b||0xc8;return function(_0x3f67ca){if(_0x3f67ca){return _0x3a443f[_0x396f('0x18')](_0x3a827b)[_0x396f('0x19')](_0x3f67ca);}};}function respondWithFilteredResult(_0x4bad23,_0x1f0dbf){return function(_0xce1a27){if(_0xce1a27){var _0x4f5712=typeof _0x1f0dbf['offset']==='undefined'&&typeof _0x1f0dbf[_0x396f('0x1a')]===_0x396f('0x1b');var _0xbf56f0=_0xce1a27[_0x396f('0x1c')];var _0x1ff1c1=_0x4f5712?0x0:_0x1f0dbf[_0x396f('0x1d')];var _0x424082=_0x4f5712?_0xce1a27[_0x396f('0x1c')]:_0x1f0dbf[_0x396f('0x1d')]+_0x1f0dbf[_0x396f('0x1a')];var _0x1ca9a1;if(_0x424082>=_0xbf56f0){_0x424082=_0xbf56f0;_0x1ca9a1=0xc8;}else{_0x1ca9a1=0xce;}_0x4bad23['status'](_0x1ca9a1);return _0x4bad23['set'](_0x396f('0x1e'),_0x1ff1c1+'-'+_0x424082+'/'+_0xbf56f0)[_0x396f('0x19')](_0xce1a27);}return null;};}function patchUpdates(_0x3ab9df){return function(_0x30a056){try{jsonpatch[_0x396f('0x1f')](_0x30a056,_0x3ab9df,!![]);}catch(_0x5af973){return BPromise[_0x396f('0x20')](_0x5af973);}return _0x30a056['save']();};}function saveUpdates(_0x9065e9,_0x4ccc40){return function(_0xb2d610){if(_0xb2d610){return _0xb2d610['update'](_0x9065e9)[_0x396f('0x21')](function(_0x80f950){return _0x80f950;});}return null;};}function removeEntity(_0x2dc6fc,_0x269aca){return function(_0x446fca){if(_0x446fca){return _0x446fca['destroy']()['then'](function(){_0x2dc6fc[_0x396f('0x18')](0xcc)[_0x396f('0x22')]();});}};}function handleEntityNotFound(_0x3cfb4d,_0x2113d2){return function(_0x32f68b){if(!_0x32f68b){_0x3cfb4d[_0x396f('0x17')](0x194);}return _0x32f68b;};}function handleError(_0x520837,_0x4b2023){_0x4b2023=_0x4b2023||0x1f4;return function(_0x401d89){logger[_0x396f('0x23')](_0x401d89[_0x396f('0x24')]);if(_0x401d89[_0x396f('0x25')]){delete _0x401d89[_0x396f('0x25')];}_0x520837[_0x396f('0x18')](_0x4b2023)[_0x396f('0x26')](_0x401d89);};}var utilLicense=require(_0x396f('0x15'));exports[_0x396f('0x27')]=function(_0x2937ca,_0x5dfb16){var _0x5c9854={'raw':!![],'where':{'id':0x1}},_0x53bbc9={};_0x53bbc9[_0x396f('0x28')]=_[_0x396f('0x29')](db[_0x396f('0x2a')][_0x396f('0x2b')]);_0x53bbc9['query']=_[_0x396f('0x29')](_0x2937ca[_0x396f('0x2c')]);_0x53bbc9['filters']=_[_0x396f('0x2d')](_0x53bbc9[_0x396f('0x28')],_0x53bbc9['query']);_0x5c9854[_0x396f('0x2e')]=_[_0x396f('0x2d')](_0x53bbc9[_0x396f('0x28')],qs[_0x396f('0x2f')](_0x2937ca[_0x396f('0x2c')][_0x396f('0x2f')]));_0x5c9854['attributes']=_0x5c9854['attributes']['length']?_0x5c9854['attributes']:_0x53bbc9['model'];_0x5c9854=_[_0x396f('0x30')]({},_0x5c9854,_0x2937ca[_0x396f('0x31')]);return utilLicense['getLicense'](_0x5c9854)[_0x396f('0x21')](respondWithResult(_0x5dfb16,null))[_0x396f('0x32')](handleError(_0x5dfb16,null));};exports[_0x396f('0x33')]=function(_0x5aa52e,_0x245007){if(_0x5aa52e[_0x396f('0x34')]['id']){delete _0x5aa52e[_0x396f('0x34')]['id'];}return db[_0x396f('0x2a')]['find']({'where':{'id':_0x5aa52e[_0x396f('0x35')]['id']}})[_0x396f('0x21')](handleEntityNotFound(_0x245007,null))[_0x396f('0x21')](function(_0x1d0ea1){var _0x19010b=_0x1d0ea1[_0x396f('0x36')]({'plain':!![]});return utilLicense[_0x396f('0x37')](_0x19010b,_0x5aa52e['body'][_0x396f('0x38')]);})[_0x396f('0x21')](function(_0x47cd85){if(!_0x47cd85['demo']){return saveUpdates(_0x5aa52e[_0x396f('0x34')],null);}return _0x47cd85;})['then'](respondWithResult(_0x245007,null))[_0x396f('0x32')](handleError(_0x245007,null));};exports['downloadLogFile']=function(_0xb8418,_0x204f62){var _0x471fff=_0x396f('0x39');var _0x4b10b2=path[_0x396f('0x3a')](_0x396f('0x3b'),_0x396f('0x3c'),'xcally',_0x471fff);_0x204f62[_0x396f('0x3d')]('Content-disposition',_0x396f('0x3e')+_0x471fff);_0x204f62[_0x396f('0x3f')](_0x396f('0x40'),_0x396f('0x41'));_0x204f62[_0x396f('0x42')](_0x4b10b2);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 4ba6e1f..b8d6bf6 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 _0x57ad=['lodash','api','moment','bluebird','path','rimraf','../../config/environment','./license.attributes','exports','define','License','license'];(function(_0x5276f1,_0x1fcf3f){var _0xa2d451=function(_0x59de19){while(--_0x59de19){_0x5276f1['push'](_0x5276f1['shift']());}};_0xa2d451(++_0x1fcf3f);}(_0x57ad,0xb4));var _0xd57a=function(_0x2865f1,_0xfda6a3){_0x2865f1=_0x2865f1-0x0;var _0x521799=_0x57ad[_0x2865f1];return _0x521799;};'use strict';var _=require(_0xd57a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd57a('0x1'));var moment=require(_0xd57a('0x2'));var BPromise=require(_0xd57a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd57a('0x4'));var rimraf=require(_0xd57a('0x5'));var config=require(_0xd57a('0x6'));var attributes=require(_0xd57a('0x7'));module[_0xd57a('0x8')]=function(_0x58daf1,_0x3fa791){return _0x58daf1[_0xd57a('0x9')](_0xd57a('0xa'),attributes,{'tableName':_0xd57a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59f2=['license','lodash','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','exports'];(function(_0x27817a,_0x10c434){var _0x4022a6=function(_0x2138c4){while(--_0x2138c4){_0x27817a['push'](_0x27817a['shift']());}};_0x4022a6(++_0x10c434);}(_0x59f2,0x118));var _0x259f=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x59f2[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x259f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x259f('0x1'));var BPromise=require('bluebird');var rp=require(_0x259f('0x2'));var fs=require('fs');var path=require(_0x259f('0x3'));var rimraf=require(_0x259f('0x4'));var config=require(_0x259f('0x5'));var attributes=require(_0x259f('0x6'));module[_0x259f('0x7')]=function(_0x21a37b,_0x2367a4){return _0x21a37b['define']('License',attributes,{'tableName':_0x259f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 80770a6..716e48e 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 _0x7e76=['info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','License,\x20%s,\x20%s','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e76,0x129));var _0x67e7=function(_0x5e677f,_0x3c681d){_0x5e677f=_0x5e677f-0x0;var _0x473265=_0x7e76[_0x5e677f];return _0x473265;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x67e7('0x0'));var rs=require(_0x67e7('0x1'));var fs=require('fs');var Redis=require(_0x67e7('0x2'));var db=require(_0x67e7('0x3'))['db'];var utils=require(_0x67e7('0x4'));var logger=require('../../config/logger')(_0x67e7('0x5'));var config=require('../../config/environment');var jayson=require(_0x67e7('0x6'));var client=jayson[_0x67e7('0x7')][_0x67e7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3aba03,_0x476fd8,_0x10b48f){return new BPromise(function(_0x43a701,_0x105474){return client['request'](_0x3aba03,_0x10b48f)['then'](function(_0x35f23a){logger[_0x67e7('0x9')]('License,\x20%s,\x20%s',_0x476fd8,_0x67e7('0xa'));logger[_0x67e7('0xb')](_0x67e7('0xc'),_0x476fd8,'request\x20sent',JSON['stringify'](_0x35f23a));if(_0x35f23a['error']){if(_0x35f23a[_0x67e7('0xd')][_0x67e7('0xe')]===0x1f4){logger[_0x67e7('0xd')]('License,\x20%s,\x20%s',_0x476fd8,_0x35f23a['error'][_0x67e7('0xf')]);return _0x105474(_0x35f23a[_0x67e7('0xd')]['message']);}logger['error'](_0x67e7('0x10'),_0x476fd8,_0x35f23a[_0x67e7('0xd')][_0x67e7('0xf')]);return _0x43a701(_0x35f23a['error'][_0x67e7('0xf')]);}else{logger['info'](_0x67e7('0x10'),_0x476fd8,_0x67e7('0xa'));_0x43a701(_0x35f23a['result'][_0x67e7('0xf')]);}})['catch'](function(_0xfd01d3){logger[_0x67e7('0xd')](_0x67e7('0x10'),_0x476fd8,_0xfd01d3);_0x105474(_0xfd01d3);});});} \ No newline at end of file +var _0xf2b1=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x5054d7,_0x1c44a0){var _0x457df1=function(_0x26b729){while(--_0x26b729){_0x5054d7['push'](_0x5054d7['shift']());}};_0x457df1(++_0x1c44a0);}(_0xf2b1,0x1a0));var _0x1f2b=function(_0x4d21ff,_0x19d202){_0x4d21ff=_0x4d21ff-0x0;var _0x22b554=_0xf2b1[_0x4d21ff];return _0x22b554;};'use strict';var _=require(_0x1f2b('0x0'));var util=require(_0x1f2b('0x1'));var moment=require(_0x1f2b('0x2'));var BPromise=require(_0x1f2b('0x3'));var rs=require(_0x1f2b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f2b('0x5'))['db'];var utils=require(_0x1f2b('0x6'));var logger=require(_0x1f2b('0x7'))(_0x1f2b('0x8'));var config=require(_0x1f2b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1f2b('0xa')][_0x1f2b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x216e34,_0x1e1f14,_0x3f1db6){return new BPromise(function(_0x121812,_0x3491fd){return client['request'](_0x216e34,_0x3f1db6)['then'](function(_0x27a825){logger[_0x1f2b('0xc')](_0x1f2b('0xd'),_0x1e1f14,_0x1f2b('0xe'));logger[_0x1f2b('0xf')](_0x1f2b('0x10'),_0x1e1f14,_0x1f2b('0xe'),JSON[_0x1f2b('0x11')](_0x27a825));if(_0x27a825['error']){if(_0x27a825[_0x1f2b('0x12')][_0x1f2b('0x13')]===0x1f4){logger['error'](_0x1f2b('0xd'),_0x1e1f14,_0x27a825[_0x1f2b('0x12')][_0x1f2b('0x14')]);return _0x3491fd(_0x27a825[_0x1f2b('0x12')][_0x1f2b('0x14')]);}logger['error'](_0x1f2b('0xd'),_0x1e1f14,_0x27a825[_0x1f2b('0x12')][_0x1f2b('0x14')]);return _0x121812(_0x27a825[_0x1f2b('0x12')][_0x1f2b('0x14')]);}else{logger[_0x1f2b('0xc')](_0x1f2b('0xd'),_0x1e1f14,_0x1f2b('0xe'));_0x121812(_0x27a825['result'][_0x1f2b('0x14')]);}})[_0x1f2b('0x15')](function(_0x3381bb){logger[_0x1f2b('0x12')](_0x1f2b('0xd'),_0x1e1f14,_0x3381bb);_0x3491fd(_0x3381bb);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 5201688..91a6063 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 _0x7290=['/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','getAgents','addDisposition','addAnswer','create','post','/:id/in_servers','addImap','/:id/interactions','addApplications','/:id/send','send','put','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/auth/service','./mailAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions'];(function(_0x41b077,_0x34805d){var _0x19c3f0=function(_0x3d488c){while(--_0x3d488c){_0x41b077['push'](_0x41b077['shift']());}};_0x19c3f0(++_0x34805d);}(_0x7290,0xce));var _0x0729=function(_0xf2662b,_0x4d8f41){_0xf2662b=_0xf2662b-0x0;var _0x257dc7=_0x7290[_0xf2662b];return _0x257dc7;};'use strict';var multer=require(_0x0729('0x0'));var util=require('util');var path=require(_0x0729('0x1'));var timeout=require('connect-timeout');var express=require(_0x0729('0x2'));var router=express[_0x0729('0x3')]();var fs_extra=require(_0x0729('0x4'));var auth=require(_0x0729('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0729('0x6'));router[_0x0729('0x7')]('/',auth[_0x0729('0x8')](),controller['index']);router[_0x0729('0x7')](_0x0729('0x9'),auth[_0x0729('0x8')](),controller[_0x0729('0xa')]);router[_0x0729('0x7')](_0x0729('0xb'),auth['isAuthenticated'](),controller[_0x0729('0xc')]);router[_0x0729('0x7')](_0x0729('0xd'),auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0x0729('0xe'),auth['isAuthenticated'](),controller[_0x0729('0xf')]);router[_0x0729('0x7')]('/:id/in_servers',auth[_0x0729('0x8')](),controller[_0x0729('0x10')]);router[_0x0729('0x7')](_0x0729('0x11'),auth[_0x0729('0x8')](),controller[_0x0729('0x12')]);router['get']('/:id/interactions',auth[_0x0729('0x8')](),controller['getInteractions']);router[_0x0729('0x7')](_0x0729('0x13'),auth[_0x0729('0x8')](),controller[_0x0729('0x14')]);router['get'](_0x0729('0x15'),auth[_0x0729('0x8')](),controller[_0x0729('0x16')]);router[_0x0729('0x7')]('/:id/verify',auth['isAuthenticated'](),controller[_0x0729('0x17')]);router[_0x0729('0x7')](_0x0729('0x18'),auth['isAuthenticated'](),controller[_0x0729('0x19')]);router['post'](_0x0729('0xd'),auth[_0x0729('0x8')](),controller[_0x0729('0x1a')]);router['post'](_0x0729('0xe'),auth[_0x0729('0x8')](),controller[_0x0729('0x1b')]);router['post']('/',auth[_0x0729('0x8')](),controller[_0x0729('0x1c')]);router[_0x0729('0x1d')](_0x0729('0x1e'),auth['isAuthenticated'](),controller[_0x0729('0x1f')]);router['post'](_0x0729('0x11'),auth['isAuthenticated'](),controller['addSmtp']);router[_0x0729('0x1d')](_0x0729('0x20'),auth[_0x0729('0x8')](),controller['addInteraction']);router['post'](_0x0729('0x13'),auth[_0x0729('0x8')](),controller[_0x0729('0x21')]);router[_0x0729('0x1d')](_0x0729('0x22'),auth[_0x0729('0x8')](),controller[_0x0729('0x23')]);router[_0x0729('0x1d')](_0x0729('0x18'),auth[_0x0729('0x8')](),controller['addAgents']);router[_0x0729('0x24')](_0x0729('0xb'),auth[_0x0729('0x8')](),controller['update']);router[_0x0729('0x25')](_0x0729('0xd'),auth[_0x0729('0x8')](),controller[_0x0729('0x26')]);router[_0x0729('0x25')](_0x0729('0xe'),auth[_0x0729('0x8')](),controller[_0x0729('0x27')]);router[_0x0729('0x25')]('/:id/in_servers',auth[_0x0729('0x8')](),controller[_0x0729('0x28')]);router[_0x0729('0x25')]('/:id/out_servers',auth[_0x0729('0x8')](),controller[_0x0729('0x29')]);router[_0x0729('0x25')](_0x0729('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0x0729('0x25')](_0x0729('0x18'),auth[_0x0729('0x8')](),controller[_0x0729('0x2a')]);module[_0x0729('0x2b')]=router; \ No newline at end of file +var _0x4947=['/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','addDisposition','addAnswer','create','post','/:id/applications','addAgents','/:id','update','delete','removeDispositions','/:id/canned_answers','removeAnswers','removeImap','removeSmtp','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getAnswers'];(function(_0x52c044,_0x3786f9){var _0x4dbc5d=function(_0x5f01e1){while(--_0x5f01e1){_0x52c044['push'](_0x52c044['shift']());}};_0x4dbc5d(++_0x3786f9);}(_0x4947,0x1a7));var _0x7494=function(_0x36f243,_0x188505){_0x36f243=_0x36f243-0x0;var _0x426436=_0x4947[_0x36f243];return _0x426436;};'use strict';var multer=require(_0x7494('0x0'));var util=require(_0x7494('0x1'));var path=require(_0x7494('0x2'));var timeout=require('connect-timeout');var express=require(_0x7494('0x3'));var router=express[_0x7494('0x4')]();var fs_extra=require(_0x7494('0x5'));var auth=require(_0x7494('0x6'));var interaction=require(_0x7494('0x7'));var config=require(_0x7494('0x8'));var controller=require(_0x7494('0x9'));router[_0x7494('0xa')]('/',auth[_0x7494('0xb')](),controller[_0x7494('0xc')]);router['get'](_0x7494('0xd'),auth['isAuthenticated'](),controller[_0x7494('0xe')]);router[_0x7494('0xa')]('/:id',auth[_0x7494('0xb')](),controller['show']);router[_0x7494('0xa')](_0x7494('0xf'),auth[_0x7494('0xb')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0x7494('0xb')](),controller[_0x7494('0x10')]);router[_0x7494('0xa')](_0x7494('0x11'),auth[_0x7494('0xb')](),controller[_0x7494('0x12')]);router['get'](_0x7494('0x13'),auth[_0x7494('0xb')](),controller['getSmtp']);router[_0x7494('0xa')](_0x7494('0x14'),auth[_0x7494('0xb')](),controller[_0x7494('0x15')]);router['get']('/:id/applications',auth[_0x7494('0xb')](),controller[_0x7494('0x16')]);router['get'](_0x7494('0x17'),auth[_0x7494('0xb')](),controller[_0x7494('0x18')]);router[_0x7494('0xa')](_0x7494('0x19'),auth[_0x7494('0xb')](),controller[_0x7494('0x1a')]);router['get'](_0x7494('0x1b'),auth[_0x7494('0xb')](),controller[_0x7494('0x1c')]);router['post'](_0x7494('0xf'),auth[_0x7494('0xb')](),controller[_0x7494('0x1d')]);router['post']('/:id/canned_answers',auth[_0x7494('0xb')](),controller[_0x7494('0x1e')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7494('0x1f')]);router['post'](_0x7494('0x11'),auth[_0x7494('0xb')](),controller['addImap']);router[_0x7494('0x20')]('/:id/out_servers',auth['isAuthenticated'](),controller['addSmtp']);router['post']('/:id/interactions',auth[_0x7494('0xb')](),controller['addInteraction']);router[_0x7494('0x20')](_0x7494('0x21'),auth[_0x7494('0xb')](),controller['addApplications']);router[_0x7494('0x20')]('/:id/send',auth[_0x7494('0xb')](),controller['send']);router[_0x7494('0x20')](_0x7494('0x1b'),auth['isAuthenticated'](),controller[_0x7494('0x22')]);router['put'](_0x7494('0x23'),auth[_0x7494('0xb')](),controller[_0x7494('0x24')]);router[_0x7494('0x25')](_0x7494('0xf'),auth[_0x7494('0xb')](),controller[_0x7494('0x26')]);router[_0x7494('0x25')](_0x7494('0x27'),auth[_0x7494('0xb')](),controller[_0x7494('0x28')]);router['delete'](_0x7494('0x11'),auth['isAuthenticated'](),controller[_0x7494('0x29')]);router[_0x7494('0x25')](_0x7494('0x13'),auth['isAuthenticated'](),controller[_0x7494('0x2a')]);router[_0x7494('0x25')](_0x7494('0x23'),auth[_0x7494('0xb')](),controller['destroy']);router[_0x7494('0x25')](_0x7494('0x1b'),auth[_0x7494('0xb')](),controller[_0x7494('0x2b')]);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 3030b67..894b61e 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 _0x7c30=['mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x3fc684,_0x598bae){var _0x38dc02=function(_0x25dc2f){while(--_0x25dc2f){_0x3fc684['push'](_0x3fc684['shift']());}};_0x38dc02(++_0x598bae);}(_0x7c30,0x97));var _0x07c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7c30[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x07c3('0x0'));module[_0x07c3('0x1')]={'description':{'type':Sequelize[_0x07c3('0x2')]},'name':{'type':Sequelize[_0x07c3('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x07c3('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x07c3('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x07c3('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x07c3('0x4')]},'markAsUnread':{'type':Sequelize[_0x07c3('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x07c3('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x07c3('0x5')](0x2)[_0x07c3('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x07c3('0x4')],'defaultValue':function(){return _0x07c3('0x7');}},'notificationSound':{'type':Sequelize[_0x07c3('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x07c3('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x07c3('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x07c3('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x07c3('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x07c3('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x07c3('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x07c3('0x3')],'defaultValue':![],'comment':_0x07c3('0x9'),'set':function(_0x21f14c){if(!_0x21f14c)this[_0x07c3('0xa')](_0x07c3('0xb'),null);this[_0x07c3('0xa')](_0x07c3('0xc'),_0x21f14c);}},'provider':{'type':Sequelize[_0x07c3('0xd')](_0x07c3('0xe'),'hotmail','yahoo','outlook365'),'defaultValue':null,'get':function(){if(!this[_0x07c3('0xf')](_0x07c3('0x10')))return _0x07c3('0x11');return this[_0x07c3('0xf')](_0x07c3('0x10'));},'set':function(_0x7e566a){if(_0x7e566a===_0x07c3('0x11'))_0x7e566a=null;return this[_0x07c3('0xa')](_0x07c3('0x10'),_0x7e566a);}}}; \ No newline at end of file +var _0x60e8=['ENUM','gmail','hotmail','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x4adcc2,_0x587c91){var _0x55f111=function(_0x25495b){while(--_0x25495b){_0x4adcc2['push'](_0x4adcc2['shift']());}};_0x55f111(++_0x587c91);}(_0x60e8,0x66));var _0x860e=function(_0x48d278,_0xe3673f){_0x48d278=_0x48d278-0x0;var _0x4ef4fe=_0x60e8[_0x48d278];return _0x4ef4fe;};'use strict';var Sequelize=require(_0x860e('0x0'));module[_0x860e('0x1')]={'description':{'type':Sequelize[_0x860e('0x2')]},'name':{'type':Sequelize[_0x860e('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x860e('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x860e('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x860e('0x4')]},'markAsUnread':{'type':Sequelize[_0x860e('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x860e('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x860e('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x860e('0x4')],'defaultValue':function(){return _0x860e('0x7');}},'notificationSound':{'type':Sequelize[_0x860e('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x860e('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x860e('0x8')],'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[_0x860e('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x860e('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x860e('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x502f18){if(!_0x502f18)this[_0x860e('0x9')](_0x860e('0xa'),null);this[_0x860e('0x9')](_0x860e('0xb'),_0x502f18);}},'provider':{'type':Sequelize[_0x860e('0xc')](_0x860e('0xd'),_0x860e('0xe'),'yahoo',_0x860e('0xf')),'defaultValue':null,'get':function(){if(!this[_0x860e('0x10')](_0x860e('0x11')))return _0x860e('0x12');return this[_0x860e('0x10')]('provider');},'set':function(_0x17dd96){if(_0x17dd96===_0x860e('0x12'))_0x17dd96=null;return this[_0x860e('0x9')]('provider',_0x17dd96);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index efd5fec..a029417 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 _0xe05b=['transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','send','getApplications','getMessages','MailMessage','$gte','format','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','%s\x20<%s>','attachments','join','root','server/files/attachments','sendMail','List\x20not\x20found','messageId','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','./mailAccount.socket','client','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','undefined','count','limit','set','json','update','then','destroy','get','MailAccounts','UserProfileResource','stack','name','gmail','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp-mail.outlook.com','username','password','pass','modernAuthentication','CloudProviderId','port','host','secure','service','authentication','user','Imap','Smtp','MailServerOut','Pause','fieldName','type','key','model','map','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','MailAccount','include','findAll','rows','show','params','mandatoryDispositionPause','rawAttributes','keys','includeAll','find','body','provider','custom','MailServerIn','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','length','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','email','ListId','active','description','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','removeSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize'];(function(_0x199c03,_0x3254aa){var _0x11a7d4=function(_0x49e1da){while(--_0x49e1da){_0x199c03['push'](_0x199c03['shift']());}};_0x11a7d4(++_0x3254aa);}(_0xe05b,0xf0));var _0xbe05=function(_0x39ae7b,_0x2111c4){_0x39ae7b=_0x39ae7b-0x0;var _0x4f5652=_0xe05b[_0x39ae7b];return _0x4f5652;};'use strict';var moment=require(_0xbe05('0x0'));var BPromise=require(_0xbe05('0x1'));var util=require(_0xbe05('0x2'));var path=require(_0xbe05('0x3'));var _=require(_0xbe05('0x4'));var juice=require(_0xbe05('0x5'));var Redis=require(_0xbe05('0x6'));var qs=require(_0xbe05('0x7'));var logger=require(_0xbe05('0x8'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xbe05('0x9')]=_[_0xbe05('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbe05('0x9')]));require(_0xbe05('0xb'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xbe05('0xc')]['http']({'port':0x232b});function respondWithRpcPromise(_0x4eaddb,_0x10abee,_0x1e6284,_0xaaea4){return new BPromise(function(_0x23c0f1,_0x13c226){var _0x1f2dec=_0xaaea4||client;return _0x1f2dec[_0xbe05('0xd')](_0x4eaddb,_0x1e6284)['then'](function(_0x431074){logger[_0xbe05('0xe')](_0xbe05('0xf'),_0x10abee,_0xbe05('0x10'));logger['debug'](_0xbe05('0x11'),_0x10abee,'request\x20sent',JSON[_0xbe05('0x12')](_0x431074));if(_0x431074[_0xbe05('0x13')]){if(_0x431074['error'][_0xbe05('0x14')]===0x1f4){logger['error'](_0xbe05('0xf'),_0x10abee,_0x431074[_0xbe05('0x13')]['message']);return _0x13c226(_0x431074[_0xbe05('0x13')][_0xbe05('0x15')]);}logger[_0xbe05('0x13')](_0xbe05('0xf'),_0x10abee,_0x431074[_0xbe05('0x13')][_0xbe05('0x15')]);return _0x23c0f1(_0x431074[_0xbe05('0x13')]['message']);}else{logger[_0xbe05('0xe')]('MailAccount,\x20%s,\x20%s',_0x10abee,_0xbe05('0x10'));_0x23c0f1(_0x431074['result']['message']);}})[_0xbe05('0x16')](function(_0x39ef3e){logger[_0xbe05('0x13')](_0xbe05('0xf'),_0x10abee,_0x39ef3e);_0x13c226(_0x39ef3e);});});}function respondWithStatusCode(_0x358047,_0x98813){_0x98813=_0x98813||0xcc;return function(_0x1731c5){if(_0x1731c5){return _0x358047[_0xbe05('0x17')](_0x98813);}return _0x358047[_0xbe05('0x18')](_0x98813)[_0xbe05('0x19')]();};}function respondWithResult(_0x43a7cb,_0x56592e){_0x56592e=_0x56592e||0xc8;return function(_0x3c04c3){if(_0x3c04c3){return _0x43a7cb[_0xbe05('0x18')](_0x56592e)['json'](_0x3c04c3);}};}function respondWithFilteredResult(_0x3e2293,_0x3f1d9d){return function(_0x1961cb){if(_0x1961cb){var _0x57040c=typeof _0x3f1d9d[_0xbe05('0x1a')]===_0xbe05('0x1b')&&typeof _0x3f1d9d['limit']===_0xbe05('0x1b');var _0x24271e=_0x1961cb[_0xbe05('0x1c')];var _0x518ed9=_0x57040c?0x0:_0x3f1d9d['offset'];var _0x3201c8=_0x57040c?_0x1961cb[_0xbe05('0x1c')]:_0x3f1d9d[_0xbe05('0x1a')]+_0x3f1d9d[_0xbe05('0x1d')];var _0x2163ed;if(_0x3201c8>=_0x24271e){_0x3201c8=_0x24271e;_0x2163ed=0xc8;}else{_0x2163ed=0xce;}_0x3e2293[_0xbe05('0x18')](_0x2163ed);return _0x3e2293[_0xbe05('0x1e')]('Content-Range',_0x518ed9+'-'+_0x3201c8+'/'+_0x24271e)[_0xbe05('0x1f')](_0x1961cb);}return null;};}function saveUpdates(_0x2044b9){return function(_0x1498c8){if(_0x1498c8){return _0x1498c8[_0xbe05('0x20')](_0x2044b9)[_0xbe05('0x21')](function(_0x44d5ed){return _0x44d5ed;});}return null;};}function removeEntity(_0x40508d){return function(_0x15972b){if(_0x15972b){return _0x15972b[_0xbe05('0x22')]()[_0xbe05('0x21')](function(){var _0x189818=_0x15972b[_0xbe05('0x23')]({'plain':!![]});var _0x28ee26=_0xbe05('0x24');return db[_0xbe05('0x25')]['destroy']({'where':{'type':_0x28ee26,'resourceId':_0x189818['id']}})[_0xbe05('0x21')](function(){return _0x15972b;});})[_0xbe05('0x21')](function(){_0x40508d['status'](0xcc)[_0xbe05('0x19')]();});}};}function handleEntityNotFound(_0x439f5d){return function(_0x3451f4){if(!_0x3451f4){_0x439f5d['sendStatus'](0x194);}return _0x3451f4;};}function handleError(_0x13a173,_0x3f2885){_0x3f2885=_0x3f2885||0x1f4;return function(_0x2d8d77){logger[_0xbe05('0x13')](_0x2d8d77[_0xbe05('0x26')]);if(_0x2d8d77[_0xbe05('0x27')]){delete _0x2d8d77['name'];}_0x13a173[_0xbe05('0x18')](_0x3f2885)['send'](_0x2d8d77);};}function getImapHost(_0x4262ec){switch(_0x4262ec){case _0xbe05('0x28'):return'imap.gmail.com';case _0xbe05('0x29'):return'imap.mail.yahoo.com';case _0xbe05('0x2a'):return _0xbe05('0x2b');case _0xbe05('0x2c'):return _0xbe05('0x2d');}throw new Error(_0xbe05('0x2e'),_0x4262ec);}function getSmtpHost(_0x341dc8){switch(_0x341dc8){case _0xbe05('0x28'):return _0xbe05('0x2f');case _0xbe05('0x29'):return'smtp.mail.yahoo.com';case _0xbe05('0x2a'):return _0xbe05('0x30');case _0xbe05('0x2c'):return'smtp.office365.com';}throw new Error(_0xbe05('0x2e'),_0x341dc8);}function getAuthenticationOptions(_0x4a8d91,_0x53e56e){var _0x3ea969={};var _0x21401e={};if(_0x4a8d91){_0x3ea969['user']=_0x21401e['user']=_0x53e56e[_0xbe05('0x31')];_0x3ea969[_0xbe05('0x32')]=_0x21401e[_0xbe05('0x33')]=_0x53e56e[_0xbe05('0x32')];if(_0x53e56e[_0xbe05('0x34')]){_0x3ea969[_0xbe05('0x34')]=_0x21401e[_0xbe05('0x34')]=!![];_0x3ea969[_0xbe05('0x35')]=_0x21401e[_0xbe05('0x35')]=_0x53e56e['CloudProviderId'];_0x3ea969[_0xbe05('0x32')]=_0x21401e[_0xbe05('0x33')]=null;}else{_0x3ea969[_0xbe05('0x35')]=_0x21401e[_0xbe05('0x35')]=null;}_0x3ea969['host']=getImapHost(_0x4a8d91);_0x3ea969[_0xbe05('0x36')]=0x3e1;_0x21401e[_0xbe05('0x37')]=getSmtpHost(_0x4a8d91);_0x21401e[_0xbe05('0x36')]=0x24b;_0x21401e[_0xbe05('0x38')]=![];_0x3ea969[_0xbe05('0x39')]=_0x21401e[_0xbe05('0x39')]=null;}else{if(_0x53e56e[_0xbe05('0x3a')]){_0x3ea969[_0xbe05('0x3b')]=_0x21401e[_0xbe05('0x3b')]=_0x53e56e['username'];_0x3ea969[_0xbe05('0x32')]=_0x21401e[_0xbe05('0x33')]=_0x53e56e[_0xbe05('0x32')];}else{_0x3ea969[_0xbe05('0x3a')]=_0x21401e['authentication']=![];_0x3ea969['user']=_0x21401e[_0xbe05('0x3b')]=null;_0x3ea969[_0xbe05('0x32')]=_0x21401e[_0xbe05('0x33')]=null;}_0x3ea969[_0xbe05('0x37')]=_0x53e56e[_0xbe05('0x3c')][_0xbe05('0x37')];_0x3ea969[_0xbe05('0x36')]=_0x53e56e['Imap'][_0xbe05('0x36')];_0x21401e['host']=_0x53e56e[_0xbe05('0x3d')][_0xbe05('0x37')];_0x21401e[_0xbe05('0x36')]=_0x53e56e[_0xbe05('0x3d')][_0xbe05('0x36')];}return{'Imap':_0x3ea969,'Smtp':_0x21401e};}exports['index']=function(_0x7924cf,_0x124271){var _0x3bf8cc={'include':[{'model':db['MailServerIn'],'as':_0xbe05('0x3c')},{'model':db[_0xbe05('0x3e')],'as':_0xbe05('0x3d')},{'model':db[_0xbe05('0x3f')],'as':'mandatoryDispositionPause'}]},_0x3b59f3={},_0x191db3={'count':0x0,'rows':[]};var _0x20408a=_['map'](db['MailAccount']['rawAttributes'],function(_0x57324e){return{'name':_0x57324e[_0xbe05('0x40')],'type':_0x57324e[_0xbe05('0x41')][_0xbe05('0x42')]};});_0x3b59f3[_0xbe05('0x43')]=_[_0xbe05('0x44')](_0x20408a,_0xbe05('0x27'));_0x3b59f3[_0xbe05('0x45')]=_['keys'](_0x7924cf[_0xbe05('0x45')]);_0x3b59f3['filters']=_['intersection'](_0x3b59f3['model'],_0x3b59f3[_0xbe05('0x45')]);_0x3bf8cc[_0xbe05('0x46')]=_[_0xbe05('0x47')](_0x3b59f3[_0xbe05('0x43')],qs[_0xbe05('0x48')](_0x7924cf[_0xbe05('0x45')]['fields']));_0x3bf8cc[_0xbe05('0x46')]=_0x3bf8cc[_0xbe05('0x46')]['length']?_0x3bf8cc[_0xbe05('0x46')]:_0x3b59f3[_0xbe05('0x43')];if(!_0x7924cf[_0xbe05('0x45')][_0xbe05('0x49')](_0xbe05('0x4a'))){_0x3bf8cc[_0xbe05('0x1d')]=qs['limit'](_0x7924cf[_0xbe05('0x45')][_0xbe05('0x1d')]);_0x3bf8cc[_0xbe05('0x1a')]=qs[_0xbe05('0x1a')](_0x7924cf[_0xbe05('0x45')]['offset']);}_0x3bf8cc[_0xbe05('0x4b')]=qs['sort'](_0x7924cf[_0xbe05('0x45')][_0xbe05('0x4c')]);_0x3bf8cc[_0xbe05('0x4d')]=qs[_0xbe05('0x4e')](_[_0xbe05('0x4f')](_0x7924cf[_0xbe05('0x45')],_0x3b59f3[_0xbe05('0x4e')]),_0x20408a);if(_0x7924cf[_0xbe05('0x45')][_0xbe05('0x50')]){_0x3bf8cc[_0xbe05('0x4d')]=_[_0xbe05('0x51')](_0x3bf8cc[_0xbe05('0x4d')],{'$or':_[_0xbe05('0x44')](_0x20408a,function(_0x390ab7){if(_0x390ab7[_0xbe05('0x41')]!=='VIRTUAL'){var _0x41c6df={};_0x41c6df[_0x390ab7[_0xbe05('0x27')]]={'$like':'%'+_0x7924cf['query'][_0xbe05('0x50')]+'%'};return _0x41c6df;}})});}_0x3bf8cc=_[_0xbe05('0x51')]({},_0x3bf8cc,_0x7924cf[_0xbe05('0x52')]);var _0x2c8836={'where':_0x3bf8cc[_0xbe05('0x4d')]};return db[_0xbe05('0x53')][_0xbe05('0x1c')](_0x2c8836)['then'](function(_0x2b88f4){_0x191db3[_0xbe05('0x1c')]=_0x2b88f4;if(_0x7924cf[_0xbe05('0x45')]['includeAll']){_0x3bf8cc[_0xbe05('0x54')]=[{'all':!![]}];}return db[_0xbe05('0x53')][_0xbe05('0x55')](_0x3bf8cc);})['then'](function(_0x5860c6){_0x191db3[_0xbe05('0x56')]=_0x5860c6;return _0x191db3;})[_0xbe05('0x21')](respondWithFilteredResult(_0x124271,_0x3bf8cc))[_0xbe05('0x16')](handleError(_0x124271,null));};exports[_0xbe05('0x57')]=function(_0x1d4165,_0x5b7d9d){var _0x2fad92={'raw':![],'where':{'id':_0x1d4165[_0xbe05('0x58')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xbe05('0x3c')},{'model':db[_0xbe05('0x3e')],'as':_0xbe05('0x3d')},{'model':db['Pause'],'as':_0xbe05('0x59')}]},_0x21acda={};_0x21acda[_0xbe05('0x43')]=_['keys'](db[_0xbe05('0x53')][_0xbe05('0x5a')]);_0x21acda[_0xbe05('0x45')]=_[_0xbe05('0x5b')](_0x1d4165[_0xbe05('0x45')]);_0x21acda[_0xbe05('0x4e')]=_[_0xbe05('0x47')](_0x21acda[_0xbe05('0x43')],_0x21acda[_0xbe05('0x45')]);_0x2fad92['attributes']=_[_0xbe05('0x47')](_0x21acda[_0xbe05('0x43')],qs[_0xbe05('0x48')](_0x1d4165['query'][_0xbe05('0x48')]));_0x2fad92[_0xbe05('0x46')]=_0x2fad92[_0xbe05('0x46')]['length']?_0x2fad92[_0xbe05('0x46')]:_0x21acda[_0xbe05('0x43')];if(_0x1d4165[_0xbe05('0x45')][_0xbe05('0x5c')]){_0x2fad92['include']=[{'all':!![]}];}_0x2fad92=_[_0xbe05('0x51')]({},_0x2fad92,_0x1d4165[_0xbe05('0x52')]);return db[_0xbe05('0x53')][_0xbe05('0x5d')](_0x2fad92)['then'](handleEntityNotFound(_0x5b7d9d,null))['then'](respondWithResult(_0x5b7d9d,null))[_0xbe05('0x16')](handleError(_0x5b7d9d,null));};exports['update']=function(_0x293f18,_0x2fe5d3){if(_0x293f18[_0xbe05('0x5e')]['id']){delete _0x293f18[_0xbe05('0x5e')]['id'];}var _0x24253d=_0x293f18[_0xbe05('0x5e')][_0xbe05('0x5f')]===_0xbe05('0x60')?null:_0x293f18[_0xbe05('0x5e')][_0xbe05('0x5f')];var _0x4a5b5a=_0x293f18[_0xbe05('0x5e')][_0xbe05('0x3c')]||{};var _0x26fc13=_0x293f18[_0xbe05('0x5e')][_0xbe05('0x3d')]||{};if(_0x24253d){_0x4a5b5a[_0xbe05('0x37')]=getImapHost(_0x24253d);_0x4a5b5a[_0xbe05('0x36')]=0x3e1;_0x26fc13[_0xbe05('0x37')]=getSmtpHost(_0x24253d);_0x26fc13[_0xbe05('0x36')]=0x24b;_0x26fc13['secure']=![];}if(_0x26fc13[_0xbe05('0x34')]){_0x26fc13[_0xbe05('0x38')]=![];}else{_0x26fc13['CloudProviderId']=null;}if(!_0x4a5b5a[_0xbe05('0x34')])_0x4a5b5a[_0xbe05('0x35')]=null;_0x293f18[_0xbe05('0x5e')][_0xbe05('0x3c')]=_0x4a5b5a;_0x293f18[_0xbe05('0x5e')][_0xbe05('0x3d')]=_0x26fc13;return db[_0xbe05('0x53')]['find']({'where':{'id':_0x293f18[_0xbe05('0x58')]['id']},'include':[{'model':db[_0xbe05('0x61')],'as':'Imap'},{'model':db[_0xbe05('0x3e')],'as':_0xbe05('0x3d')},{'model':db[_0xbe05('0x3f')],'as':_0xbe05('0x59')}]})[_0xbe05('0x21')](handleEntityNotFound(_0x2fe5d3,null))[_0xbe05('0x21')](function(_0x39b80d){if(!_0x39b80d)throw new Error(_0xbe05('0x62'));if(_0x39b80d[_0xbe05('0x39')])delete _0x293f18[_0xbe05('0x5e')][_0xbe05('0x3c')];return _0x39b80d;})['then'](saveUpdates(_0x293f18['body'],null))['then'](function(_0x1de425){if(!_0x293f18['body']['Imap'])return _0x1de425;return db['MailServerIn'][_0xbe05('0x20')](_0x293f18['body'][_0xbe05('0x3c')],{'where':{'MailAccountId':_0x1de425['id']}})['then'](function(){return _0x1de425;});})[_0xbe05('0x21')](function(_0x1ba091){if(!_0x293f18[_0xbe05('0x5e')][_0xbe05('0x3d')])return _0x1ba091;return db[_0xbe05('0x3e')][_0xbe05('0x20')](_0x293f18[_0xbe05('0x5e')][_0xbe05('0x3d')],{'where':{'MailAccountId':_0x1ba091['id']}})[_0xbe05('0x21')](function(){return _0x1ba091;});})[_0xbe05('0x21')](respondWithResult(_0x2fe5d3,null))[_0xbe05('0x16')](handleError(_0x2fe5d3,null));};exports[_0xbe05('0x63')]=function(_0x2a3ca7,_0x524487){return db[_0xbe05('0x53')]['describe']()[_0xbe05('0x21')](respondWithResult(_0x524487,null))[_0xbe05('0x16')](handleError(_0x524487,null));};exports[_0xbe05('0x64')]=function(_0x450367,_0x18756f){if(_0x450367[_0xbe05('0x5e')]['id']){delete _0x450367[_0xbe05('0x5e')]['id'];}return db[_0xbe05('0x53')][_0xbe05('0x5d')]({'where':{'id':_0x450367[_0xbe05('0x58')]['id']}})['then'](handleEntityNotFound(_0x18756f,null))['then'](function(_0x275c7c){if(_0x275c7c){_0x450367['body'][_0xbe05('0x65')]=_0x275c7c['id'];return db[_0xbe05('0x66')][_0xbe05('0x67')](_0x450367[_0xbe05('0x5e')]);}})[_0xbe05('0x21')](respondWithResult(_0x18756f,null))[_0xbe05('0x16')](handleError(_0x18756f,null));};exports[_0xbe05('0x68')]=function(_0x22633d,_0x5ef729){var _0x440088={'raw':![],'where':{}};var _0x14fbaa={};var _0x5f84fd={'count':0x0,'rows':[]};return db[_0xbe05('0x53')][_0xbe05('0x69')]({'where':{'id':_0x22633d[_0xbe05('0x58')]['id']}})[_0xbe05('0x21')](handleEntityNotFound(_0x5ef729,null))['then'](function(_0x5b294e){if(_0x5b294e){_0x14fbaa['model']=_[_0xbe05('0x5b')](db[_0xbe05('0x66')][_0xbe05('0x5a')]);_0x14fbaa[_0xbe05('0x45')]=_[_0xbe05('0x5b')](_0x22633d['query']);_0x14fbaa[_0xbe05('0x4e')]=_[_0xbe05('0x47')](_0x14fbaa[_0xbe05('0x43')],_0x14fbaa[_0xbe05('0x45')]);_0x440088[_0xbe05('0x46')]=_[_0xbe05('0x47')](_0x14fbaa[_0xbe05('0x43')],qs[_0xbe05('0x48')](_0x22633d[_0xbe05('0x45')][_0xbe05('0x48')]));_0x440088[_0xbe05('0x46')]=_0x440088[_0xbe05('0x46')][_0xbe05('0x6a')]?_0x440088[_0xbe05('0x46')]:_0x14fbaa['model'];if(!_0x22633d[_0xbe05('0x45')]['hasOwnProperty'](_0xbe05('0x4a'))){_0x440088[_0xbe05('0x1d')]=qs[_0xbe05('0x1d')](_0x22633d[_0xbe05('0x45')]['limit']);_0x440088['offset']=qs[_0xbe05('0x1a')](_0x22633d['query'][_0xbe05('0x1a')]);}_0x440088[_0xbe05('0x4b')]=qs[_0xbe05('0x4c')](_0x22633d['query'][_0xbe05('0x4c')]);_0x440088['where']=qs[_0xbe05('0x4e')](_['pick'](_0x22633d[_0xbe05('0x45')],_0x14fbaa['filters']));_0x440088[_0xbe05('0x4d')][_0xbe05('0x65')]=_0x5b294e['id'];if(_0x22633d[_0xbe05('0x45')][_0xbe05('0x50')]){_0x440088['where']=_[_0xbe05('0x51')](_0x440088[_0xbe05('0x4d')],{'$or':_['map'](_0x440088[_0xbe05('0x46')],function(_0x3a5741){var _0x47b554={};_0x47b554[_0x3a5741]={'$like':'%'+_0x22633d[_0xbe05('0x45')][_0xbe05('0x50')]+'%'};return _0x47b554;})});}_0x440088=_[_0xbe05('0x51')]({},_0x440088,_0x22633d[_0xbe05('0x52')]);return db['Disposition'][_0xbe05('0x1c')]({'where':_0x440088[_0xbe05('0x4d')]})[_0xbe05('0x21')](function(_0x38510b){_0x5f84fd[_0xbe05('0x1c')]=_0x38510b;if(_0x22633d[_0xbe05('0x45')]['includeAll']){_0x440088[_0xbe05('0x54')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x440088);})['then'](function(_0x368723){_0x5f84fd[_0xbe05('0x56')]=_0x368723;return _0x5f84fd;});}})[_0xbe05('0x21')](respondWithFilteredResult(_0x5ef729,_0x440088))['catch'](handleError(_0x5ef729,null));};exports[_0xbe05('0x6b')]=function(_0x5977e0,_0x239d90){return db[_0xbe05('0x53')][_0xbe05('0x5d')]({'where':{'id':_0x5977e0[_0xbe05('0x58')]['id']}})[_0xbe05('0x21')](handleEntityNotFound(_0x239d90,null))[_0xbe05('0x21')](function(_0x3f5789){if(_0x3f5789){return _0x3f5789['removeDispositions'](_0x5977e0[_0xbe05('0x45')][_0xbe05('0x6c')]);}})[_0xbe05('0x21')](respondWithStatusCode(_0x239d90,null))[_0xbe05('0x16')](handleError(_0x239d90,null));};exports[_0xbe05('0x6d')]=function(_0x347e05,_0x5a8f05){if(_0x347e05[_0xbe05('0x5e')]['id']){delete _0x347e05[_0xbe05('0x5e')]['id'];}return db[_0xbe05('0x53')][_0xbe05('0x5d')]({'where':{'id':_0x347e05[_0xbe05('0x58')]['id']}})[_0xbe05('0x21')](handleEntityNotFound(_0x5a8f05,null))['then'](function(_0x3cf961){if(_0x3cf961){_0x347e05['body']['MailAccountId']=_0x3cf961['id'];return db['CannedAnswer'][_0xbe05('0x67')](_0x347e05[_0xbe05('0x5e')]);}})[_0xbe05('0x21')](respondWithResult(_0x5a8f05,null))[_0xbe05('0x16')](handleError(_0x5a8f05,null));};exports[_0xbe05('0x6e')]=function(_0x46409d,_0x146db4){var _0x5365f9={'raw':![],'where':{}};var _0x174ddf={};var _0x4d0371={'count':0x0,'rows':[]};return db[_0xbe05('0x53')][_0xbe05('0x69')]({'where':{'id':_0x46409d[_0xbe05('0x58')]['id']}})[_0xbe05('0x21')](handleEntityNotFound(_0x146db4,null))[_0xbe05('0x21')](function(_0x569d5b){if(_0x569d5b){_0x174ddf['model']=_[_0xbe05('0x5b')](db[_0xbe05('0x6f')][_0xbe05('0x5a')]);_0x174ddf[_0xbe05('0x45')]=_['keys'](_0x46409d[_0xbe05('0x45')]);_0x174ddf[_0xbe05('0x4e')]=_[_0xbe05('0x47')](_0x174ddf[_0xbe05('0x43')],_0x174ddf['query']);_0x5365f9[_0xbe05('0x46')]=_['intersection'](_0x174ddf[_0xbe05('0x43')],qs['fields'](_0x46409d[_0xbe05('0x45')]['fields']));_0x5365f9[_0xbe05('0x46')]=_0x5365f9[_0xbe05('0x46')][_0xbe05('0x6a')]?_0x5365f9[_0xbe05('0x46')]:_0x174ddf[_0xbe05('0x43')];if(!_0x46409d['query']['hasOwnProperty'](_0xbe05('0x4a'))){_0x5365f9[_0xbe05('0x1d')]=qs[_0xbe05('0x1d')](_0x46409d['query'][_0xbe05('0x1d')]);_0x5365f9[_0xbe05('0x1a')]=qs['offset'](_0x46409d[_0xbe05('0x45')][_0xbe05('0x1a')]);}_0x5365f9['order']=qs[_0xbe05('0x4c')](_0x46409d[_0xbe05('0x45')][_0xbe05('0x4c')]);_0x5365f9[_0xbe05('0x4d')]=qs[_0xbe05('0x4e')](_[_0xbe05('0x4f')](_0x46409d['query'],_0x174ddf[_0xbe05('0x4e')]));_0x5365f9[_0xbe05('0x4d')]['MailAccountId']=_0x569d5b['id'];if(_0x46409d[_0xbe05('0x45')][_0xbe05('0x50')]){_0x5365f9[_0xbe05('0x4d')]=_['merge'](_0x5365f9[_0xbe05('0x4d')],{'$or':_['map'](_0x5365f9[_0xbe05('0x46')],function(_0x2fdf81){var _0x22e011={};_0x22e011[_0x2fdf81]={'$like':'%'+_0x46409d['query'][_0xbe05('0x50')]+'%'};return _0x22e011;})});}_0x5365f9=_[_0xbe05('0x51')]({},_0x5365f9,_0x46409d['options']);return db[_0xbe05('0x6f')][_0xbe05('0x1c')]({'where':_0x5365f9[_0xbe05('0x4d')]})[_0xbe05('0x21')](function(_0x40adc1){_0x4d0371[_0xbe05('0x1c')]=_0x40adc1;if(_0x46409d['query']['includeAll']){_0x5365f9[_0xbe05('0x54')]=[{'all':!![]}];}return db[_0xbe05('0x6f')][_0xbe05('0x55')](_0x5365f9);})['then'](function(_0x16cf40){_0x4d0371[_0xbe05('0x56')]=_0x16cf40;return _0x4d0371;});}})[_0xbe05('0x21')](respondWithFilteredResult(_0x146db4,_0x5365f9))[_0xbe05('0x16')](handleError(_0x146db4,null));};exports['removeAnswers']=function(_0x31397b,_0x221231){return db[_0xbe05('0x53')][_0xbe05('0x5d')]({'where':{'id':_0x31397b['params']['id']}})['then'](handleEntityNotFound(_0x221231,null))[_0xbe05('0x21')](function(_0x32a15c){if(_0x32a15c){return _0x32a15c[_0xbe05('0x70')](_0x31397b[_0xbe05('0x45')]['ids']);}})[_0xbe05('0x21')](respondWithStatusCode(_0x221231,null))[_0xbe05('0x16')](handleError(_0x221231,null));};exports[_0xbe05('0x67')]=function(_0x3a1287,_0x348ad2){var _0x54148a={'name':_0x3a1287['body'][_0xbe05('0x27')],'key':_0x3a1287[_0xbe05('0x5e')]['key'],'provider':_0x3a1287[_0xbe05('0x5e')][_0xbe05('0x5f')]===_0xbe05('0x60')?null:_0x3a1287[_0xbe05('0x5e')]['provider'],'email':_0x3a1287[_0xbe05('0x5e')][_0xbe05('0x71')],'ListId':_0x3a1287[_0xbe05('0x5e')][_0xbe05('0x72')],'active':!_['isNil'](_0x3a1287[_0xbe05('0x5e')][_0xbe05('0x73')])?_0x3a1287['body']['active']:!![],'description':_0x3a1287[_0xbe05('0x5e')][_0xbe05('0x74')]||null};var _0x5bfce8=getAuthenticationOptions(_0x54148a[_0xbe05('0x5f')],_0x3a1287[_0xbe05('0x5e')]);_0x54148a[_0xbe05('0x3c')]=_0x5bfce8['Imap'];_0x54148a[_0xbe05('0x3d')]=_0x5bfce8[_0xbe05('0x3d')];return db['MailAccount']['create'](_0x54148a,{'include':[{'model':db[_0xbe05('0x3e')],'as':_0xbe05('0x3d')},{'model':db[_0xbe05('0x61')],'as':_0xbe05('0x3c')}]})['then'](function(_0x54ae04){var _0xe7a6e3=_0x3a1287[_0xbe05('0x3b')]['get']({'plain':!![]});if(!_0xe7a6e3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe7a6e3[_0xbe05('0x75')]==='user'){var _0x92940f=_0x54ae04[_0xbe05('0x23')]({'plain':!![]});return db[_0xbe05('0x76')]['find']({'where':{'name':'MailAccounts','userProfileId':_0xe7a6e3[_0xbe05('0x77')]},'raw':!![]})[_0xbe05('0x21')](function(_0x187f41){if(_0x187f41&&_0x187f41[_0xbe05('0x78')]===0x0){return db['UserProfileResource'][_0xbe05('0x67')]({'name':_0x92940f[_0xbe05('0x27')],'resourceId':_0x92940f['id'],'type':_0x187f41[_0xbe05('0x27')],'sectionId':_0x187f41['id']},{})[_0xbe05('0x21')](function(){return _0x54ae04;});}else{return _0x54ae04;}})[_0xbe05('0x16')](function(_0x4292b5){logger[_0xbe05('0x13')](_0xbe05('0x79'),_0x4292b5);throw _0x4292b5;});}return _0x54ae04;})[_0xbe05('0x21')](respondWithResult(_0x348ad2,0xc9))['catch'](handleError(_0x348ad2,null));};exports['getImap']=function(_0x39ba35,_0x2859d8){return db[_0xbe05('0x53')]['findOne']({'where':{'id':_0x39ba35[_0xbe05('0x58')]['id']}})[_0xbe05('0x21')](handleEntityNotFound(_0x2859d8,null))[_0xbe05('0x21')](function(_0x4ecc61){if(_0x4ecc61){return _0x4ecc61[_0xbe05('0x7a')]();}return null;})[_0xbe05('0x21')](respondWithResult(_0x2859d8,null))['catch'](handleError(_0x2859d8,null));};exports['addImap']=function(_0x2902ec,_0x2662fa){if(_0x2902ec['body']['id']){delete _0x2902ec['body']['id'];}return db['MailAccount'][_0xbe05('0x5d')]({'where':{'id':_0x2902ec[_0xbe05('0x58')]['id']}})['then'](handleEntityNotFound(_0x2662fa,null))[_0xbe05('0x21')](function(_0x24fb61){if(_0x24fb61){_0x2902ec['body']['MailAccountId']=_0x24fb61['id'];return db['MailServerIn'][_0xbe05('0x67')](_0x2902ec[_0xbe05('0x5e')]);}})[_0xbe05('0x21')](respondWithResult(_0x2662fa,null))[_0xbe05('0x16')](handleError(_0x2662fa,null));};exports[_0xbe05('0x7b')]=function(_0x33b0f1,_0x460d0d){return db[_0xbe05('0x53')][_0xbe05('0x69')]({'where':{'id':_0x33b0f1['params']['id']}})[_0xbe05('0x21')](handleEntityNotFound(_0x460d0d,null))[_0xbe05('0x21')](function(_0x1d3b51){if(_0x1d3b51){return _0x1d3b51[_0xbe05('0x7c')](null);}return null;})[_0xbe05('0x21')](respondWithStatusCode(_0x460d0d,null))[_0xbe05('0x16')](handleError(_0x460d0d,null));};exports[_0xbe05('0x7d')]=function(_0x360810,_0x4814fd){return db[_0xbe05('0x53')][_0xbe05('0x69')]({'where':{'id':_0x360810[_0xbe05('0x58')]['id']}})['then'](handleEntityNotFound(_0x4814fd,null))[_0xbe05('0x21')](function(_0xebc4c0){if(_0xebc4c0){return _0xebc4c0[_0xbe05('0x7d')]();}return null;})[_0xbe05('0x21')](respondWithResult(_0x4814fd,null))[_0xbe05('0x16')](handleError(_0x4814fd,null));};exports['addSmtp']=function(_0xe12b25,_0x199d2d){if(_0xe12b25[_0xbe05('0x5e')]['id']){delete _0xe12b25[_0xbe05('0x5e')]['id'];}return db[_0xbe05('0x53')][_0xbe05('0x5d')]({'where':{'id':_0xe12b25[_0xbe05('0x58')]['id']}})['then'](handleEntityNotFound(_0x199d2d,null))[_0xbe05('0x21')](function(_0x4e3cfd){if(_0x4e3cfd){_0xe12b25['body'][_0xbe05('0x65')]=_0x4e3cfd['id'];return db[_0xbe05('0x3e')][_0xbe05('0x67')](_0xe12b25[_0xbe05('0x5e')]);}})['then'](respondWithResult(_0x199d2d,null))[_0xbe05('0x16')](handleError(_0x199d2d,null));};exports[_0xbe05('0x7e')]=function(_0x6a9220,_0x5207de){return db[_0xbe05('0x53')][_0xbe05('0x69')]({'where':{'id':_0x6a9220[_0xbe05('0x58')]['id']}})[_0xbe05('0x21')](handleEntityNotFound(_0x5207de,null))['then'](function(_0xd5103a){if(_0xd5103a){return _0xd5103a['setSmtp'](null);}return null;})[_0xbe05('0x21')](respondWithStatusCode(_0x5207de,null))[_0xbe05('0x16')](handleError(_0x5207de,null));};exports[_0xbe05('0x7f')]=function(_0x243778,_0x4ddd18){return db[_0xbe05('0x80')][_0xbe05('0x5d')]({'where':{'id':_0x243778[_0xbe05('0x58')]['id']}})[_0xbe05('0x21')](handleEntityNotFound(_0x4ddd18,null))[_0xbe05('0x21')](function(_0x18a11d){if(_0x18a11d){return _0x18a11d[_0xbe05('0x7f')](_0x243778[_0xbe05('0x5e')][_0xbe05('0x6c')],_[_0xbe05('0x81')](_0x243778[_0xbe05('0x5e')],[_0xbe05('0x6c'),'id'])||{});}})[_0xbe05('0x21')](respondWithResult(_0x4ddd18,null))['catch'](handleError(_0x4ddd18,null));};exports[_0xbe05('0x82')]=function(_0x49e576,_0xa794f4){var _0x1d3fff={'raw':![],'where':{}};var _0xd5d105={};var _0x539b1f={'count':0x0,'rows':[]};return db[_0xbe05('0x53')][_0xbe05('0x69')]({'where':{'id':_0x49e576[_0xbe05('0x58')]['id']}})['then'](handleEntityNotFound(_0xa794f4,null))[_0xbe05('0x21')](function(_0x25d620){if(_0x25d620){_0xd5d105[_0xbe05('0x43')]=_['keys'](db['MailInteraction'][_0xbe05('0x5a')]);_0xd5d105[_0xbe05('0x45')]=_[_0xbe05('0x5b')](_0x49e576['query']);_0xd5d105['filters']=_[_0xbe05('0x47')](_0xd5d105[_0xbe05('0x43')],_0xd5d105['query']);_0x1d3fff[_0xbe05('0x46')]=_[_0xbe05('0x47')](_0xd5d105[_0xbe05('0x43')],qs[_0xbe05('0x48')](_0x49e576[_0xbe05('0x45')][_0xbe05('0x48')]));_0x1d3fff[_0xbe05('0x46')]=_0x1d3fff['attributes'][_0xbe05('0x6a')]?_0x1d3fff[_0xbe05('0x46')]:_0xd5d105['model'];if(!_0x49e576[_0xbe05('0x45')][_0xbe05('0x49')]('nolimit')){_0x1d3fff['limit']=qs[_0xbe05('0x1d')](_0x49e576[_0xbe05('0x45')]['limit']);_0x1d3fff[_0xbe05('0x1a')]=qs[_0xbe05('0x1a')](_0x49e576[_0xbe05('0x45')][_0xbe05('0x1a')]);}_0x1d3fff[_0xbe05('0x4b')]=qs[_0xbe05('0x4c')](_0x49e576[_0xbe05('0x45')][_0xbe05('0x4c')]);_0x1d3fff[_0xbe05('0x4d')]=qs[_0xbe05('0x4e')](_[_0xbe05('0x4f')](_0x49e576[_0xbe05('0x45')],_0xd5d105[_0xbe05('0x4e')]));_0x1d3fff[_0xbe05('0x4d')][_0xbe05('0x65')]=_0x25d620['id'];if(_0x49e576[_0xbe05('0x45')][_0xbe05('0x50')]){_0x1d3fff[_0xbe05('0x4d')]=_[_0xbe05('0x51')](_0x1d3fff['where'],{'$or':_[_0xbe05('0x44')](_0x1d3fff[_0xbe05('0x46')],function(_0xbd0a81){var _0x4b01a4={};_0x4b01a4[_0xbd0a81]={'$like':'%'+_0x49e576['query'][_0xbe05('0x50')]+'%'};return _0x4b01a4;})});}_0x1d3fff=_[_0xbe05('0x51')]({},_0x1d3fff,_0x49e576[_0xbe05('0x52')]);return db[_0xbe05('0x80')]['count']({'where':_0x1d3fff[_0xbe05('0x4d')]})['then'](function(_0x454c0a){_0x539b1f[_0xbe05('0x1c')]=_0x454c0a;if(_0x49e576[_0xbe05('0x45')][_0xbe05('0x5c')]){_0x1d3fff[_0xbe05('0x54')]=[{'model':db[_0xbe05('0x83')],'as':_0xbe05('0x84'),'required':![]},{'model':db[_0xbe05('0x85')],'as':_0xbe05('0x86'),'attributes':[_0xbe05('0x27'),_0xbe05('0x87'),_0xbe05('0x88')],'required':![]},{'model':db[_0xbe05('0x89')],'as':_0xbe05('0x8a'),'attributes':['id',_0xbe05('0x27'),'color'],'where':_0x49e576['query'][_0xbe05('0x8b')]?{'id':_0x49e576[_0xbe05('0x45')]['tag']}:undefined,'required':_0x49e576['query']['tag']?!![]:![]}];}return db[_0xbe05('0x80')][_0xbe05('0x55')](_0x1d3fff);})[_0xbe05('0x21')](function(_0x4b992a){_0x539b1f[_0xbe05('0x56')]=_0x4b992a;return _0x539b1f;});}})[_0xbe05('0x21')](respondWithFilteredResult(_0xa794f4,_0x1d3fff))[_0xbe05('0x16')](handleError(_0xa794f4,null));};exports[_0xbe05('0x8c')]=function addApplications(_0x4bd3a3,_0x205503){var _0x56dfc6=_0x4bd3a3['params']['id'];var _0x2fe78b=_0x4bd3a3['body'];var _0x4cce44=0xc8;var _0x283324=null;return db[_0xbe05('0x8d')][_0xbe05('0x8e')]({'isolationLevel':db[_0xbe05('0x8d')]['Transaction'][_0xbe05('0x8f')][_0xbe05('0x90')]},function(_0x400e8b){return db[_0xbe05('0x53')][_0xbe05('0x69')]({'where':{'id':_0x56dfc6},'transaction':_0x400e8b})[_0xbe05('0x21')](function(_0x512aea){if(_0x512aea){return db[_0xbe05('0x91')][_0xbe05('0x22')]({'where':{'MailAccountId':_0x56dfc6},'transaction':_0x400e8b})[_0xbe05('0x21')](function(){var _0x36fdfc=_[_0xbe05('0x44')](_0x2fe78b,function(_0x1ff026){_0x1ff026[_0xbe05('0x65')]=_0x56dfc6;return _0x1ff026;});return db[_0xbe05('0x91')]['bulkCreate'](_0x36fdfc,{'transaction':_0x400e8b});});}else{_0x4cce44=0x194;_0x283324=[];}});})[_0xbe05('0x21')](function(){if(_0x4cce44!==0x194){return db[_0xbe05('0x91')][_0xbe05('0x92')]({'where':{'MailAccountId':_0x56dfc6},'order':_0xbe05('0x93')})[_0xbe05('0x21')](function(_0x1225a8){_0x283324=_0x1225a8;});}})['catch'](function(_0xecbde4){_0x4cce44=0x1f4;logger[_0xbe05('0x13')](_0xecbde4[_0xbe05('0x26')]);if(_0xecbde4[_0xbe05('0x27')]){delete _0xecbde4[_0xbe05('0x27')];}_0x283324=_0xecbde4;})[_0xbe05('0x94')](function(){if(_0x283324===null){_0x205503['sendStatus'](_0x4cce44);}else{if(_0x4cce44===0x1f4){_0x205503[_0xbe05('0x18')](_0x4cce44)[_0xbe05('0x95')](_0x283324);}else{_0x205503[_0xbe05('0x18')](_0x4cce44)[_0xbe05('0x1f')](_0x283324);}}});};exports[_0xbe05('0x96')]=function(_0x515128,_0x1550e3){var _0x4880c9={};var _0x899366={};var _0x4e9593;var _0x25c267;return db[_0xbe05('0x53')]['findOne']({'where':{'id':_0x515128[_0xbe05('0x58')]['id']}})[_0xbe05('0x21')](handleEntityNotFound(_0x1550e3,null))[_0xbe05('0x21')](function(_0x4353bc){if(_0x4353bc){_0x4e9593=_0x4353bc;_0x899366['model']=_[_0xbe05('0x5b')](db[_0xbe05('0x91')][_0xbe05('0x5a')]);_0x899366['query']=_['keys'](_0x515128[_0xbe05('0x45')]);_0x899366[_0xbe05('0x4e')]=_[_0xbe05('0x47')](_0x899366[_0xbe05('0x43')],_0x899366[_0xbe05('0x45')]);_0x4880c9[_0xbe05('0x46')]=_[_0xbe05('0x47')](_0x899366['model'],qs[_0xbe05('0x48')](_0x515128[_0xbe05('0x45')]['fields']));_0x4880c9['attributes']=_0x4880c9[_0xbe05('0x46')][_0xbe05('0x6a')]?_0x4880c9[_0xbe05('0x46')]:_0x899366['model'];_0x4880c9[_0xbe05('0x4b')]=qs[_0xbe05('0x4c')](_0x515128[_0xbe05('0x45')]['sort']);_0x4880c9[_0xbe05('0x4d')]=qs[_0xbe05('0x4e')](_[_0xbe05('0x4f')](_0x515128['query'],_0x899366['filters']));if(_0x515128['query'][_0xbe05('0x50')]){_0x4880c9[_0xbe05('0x4d')]=_[_0xbe05('0x51')](_0x4880c9[_0xbe05('0x4d')],{'$or':_[_0xbe05('0x44')](_0x4880c9[_0xbe05('0x46')],function(_0x4c7b65){var _0xc2ceee={};_0xc2ceee[_0x4c7b65]={'$like':'%'+_0x515128[_0xbe05('0x45')]['filter']+'%'};return _0xc2ceee;})});}_0x4880c9=_[_0xbe05('0x51')]({},_0x4880c9,_0x515128[_0xbe05('0x52')]);return _0x4e9593[_0xbe05('0x96')](_0x4880c9);}})['then'](function(_0x751d13){if(_0x751d13){_0x25c267=_0x751d13['length'];if(!_0x515128[_0xbe05('0x45')][_0xbe05('0x49')](_0xbe05('0x4a'))){_0x4880c9['limit']=qs[_0xbe05('0x1d')](_0x515128['query'][_0xbe05('0x1d')]);_0x4880c9['offset']=qs['offset'](_0x515128['query'][_0xbe05('0x1a')]);}return _0x4e9593[_0xbe05('0x96')](_0x4880c9);}})[_0xbe05('0x21')](function(_0xf4aeb4){if(_0xf4aeb4){return _0xf4aeb4?{'count':_0x25c267,'rows':_0xf4aeb4}:null;}})[_0xbe05('0x21')](respondWithResult(_0x1550e3,null))[_0xbe05('0x16')](handleError(_0x1550e3,null));};exports[_0xbe05('0x97')]=function(_0x4cc88f,_0x9a5bce){var _0x1b9364={'raw':!![],'where':{}};var _0x45b120={};var _0x572f15={'count':0x0,'rows':[]};return db['MailAccount'][_0xbe05('0x69')]({'where':{'id':_0x4cc88f[_0xbe05('0x58')]['id']}})[_0xbe05('0x21')](handleEntityNotFound(_0x9a5bce,null))[_0xbe05('0x21')](function(_0x40fce5){if(_0x40fce5){_0x45b120[_0xbe05('0x43')]=_[_0xbe05('0x5b')](db[_0xbe05('0x98')][_0xbe05('0x5a')]);_0x45b120[_0xbe05('0x45')]=_[_0xbe05('0x5b')](_0x4cc88f[_0xbe05('0x45')]);_0x45b120[_0xbe05('0x4e')]=_[_0xbe05('0x47')](_0x45b120[_0xbe05('0x43')],_0x45b120[_0xbe05('0x45')]);_0x1b9364[_0xbe05('0x46')]=_['intersection'](_0x45b120['model'],qs['fields'](_0x4cc88f[_0xbe05('0x45')]['fields']));_0x1b9364['attributes']=_0x1b9364[_0xbe05('0x46')]['length']?_0x1b9364[_0xbe05('0x46')]:_0x45b120['model'];if(!_0x4cc88f[_0xbe05('0x45')]['hasOwnProperty'](_0xbe05('0x4a'))){_0x1b9364['limit']=qs[_0xbe05('0x1d')](_0x4cc88f[_0xbe05('0x45')]['limit']);_0x1b9364[_0xbe05('0x1a')]=qs[_0xbe05('0x1a')](_0x4cc88f[_0xbe05('0x45')][_0xbe05('0x1a')]);}_0x1b9364[_0xbe05('0x4b')]=qs['sort'](_0x4cc88f[_0xbe05('0x45')][_0xbe05('0x4c')]);_0x1b9364[_0xbe05('0x4d')]=qs['filters'](_[_0xbe05('0x4f')](_0x4cc88f[_0xbe05('0x45')],_0x45b120[_0xbe05('0x4e')]));_0x1b9364['where'][_0xbe05('0x65')]=_0x40fce5['id'];if(_0x4cc88f[_0xbe05('0x45')][_0xbe05('0x50')]){_0x1b9364[_0xbe05('0x4d')]=_['merge'](_0x1b9364[_0xbe05('0x4d')],{'$or':_['map'](_0x1b9364['attributes'],function(_0x5c6a51){var _0x7ed327={};_0x7ed327[_0x5c6a51]={'$like':'%'+_0x4cc88f['query']['filter']+'%'};return _0x7ed327;})});}if(_0x4cc88f[_0xbe05('0x45')][_0xbe05('0x99')]){var _0x54c1a2=_0x4cc88f[_0xbe05('0x45')][_0xbe05('0x99')]['split'](',');var _0x3c9e2b={};_0x3c9e2b[_0x54c1a2[0x0]]={'$gte':moment(_0x54c1a2[0x1])[_0xbe05('0x9a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1b9364['where']=_[_0xbe05('0x51')](_0x1b9364['where'],_0x3c9e2b);}_0x1b9364=_['merge']({},_0x1b9364,_0x4cc88f[_0xbe05('0x52')]);return db[_0xbe05('0x98')]['count']({'where':_0x1b9364[_0xbe05('0x4d')]})[_0xbe05('0x21')](function(_0x2e4953){_0x572f15[_0xbe05('0x1c')]=_0x2e4953;if(_0x4cc88f[_0xbe05('0x45')][_0xbe05('0x5c')]){_0x1b9364[_0xbe05('0x54')]=[{'all':!![]}];}return db[_0xbe05('0x98')][_0xbe05('0x55')](_0x1b9364);})['then'](function(_0x4a4a46){if(_0x4cc88f['query'][_0xbe05('0x9b')]===_0xbe05('0x9c')){for(var _0x8650f7=0x0;_0x8650f7<_0x4a4a46['length'];_0x8650f7++){_0x4a4a46[_0x8650f7][_0xbe05('0x5e')]=juice(_0x4a4a46[_0x8650f7]['body']);}}_0x572f15[_0xbe05('0x56')]=_0x4a4a46;return _0x572f15;});}})[_0xbe05('0x21')](respondWithFilteredResult(_0x9a5bce,_0x1b9364))[_0xbe05('0x16')](handleError(_0x9a5bce,null));};exports[_0xbe05('0x95')]=function(_0x29a790,_0x312980){var _0x3abbf3,_0x2110ad={},_0xc50ea0;if(_0x29a790['body']['to']){_0xc50ea0=_0x29a790['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0xbe05('0x5d')]({'where':{'id':_0x29a790[_0xbe05('0x58')]['id']},'include':[{'model':db[_0xbe05('0x9d')],'as':_0xbe05('0x9e'),'include':[{'model':db['CmContact'],'as':_0xbe05('0x9f'),'where':{'email':_0xc50ea0},'limit':0x1,'order':[[_0xbe05('0xa0'),_0xbe05('0xa1')]]}]},{'model':db[_0xbe05('0x3e')],'as':_0xbe05('0x3d'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xbe05('0xa2'),'raw':!![]}]}]})[_0xbe05('0x21')](handleEntityNotFound(_0x312980,null))[_0xbe05('0x21')](function(_0x5c62d5){if(!_0x5c62d5)return;_0x3abbf3=_0x5c62d5;if(!_0x5c62d5[_0xbe05('0x3d')])throw new Error(_0xbe05('0xa3'));if(_[_0xbe05('0xa4')](_0x29a790[_0xbe05('0x5e')]['from'])){_0x29a790['body'][_0xbe05('0xa5')]=util[_0xbe05('0x9a')](_0xbe05('0xa6'),_0x5c62d5['name'],_0x5c62d5[_0xbe05('0x71')]||_0x5c62d5[_0xbe05('0x3d')][_0xbe05('0x3b')]);}if(_0x29a790[_0xbe05('0x5e')][_0xbe05('0xa7')]&&_0x29a790['body']['attachments'][_0xbe05('0x6a')]){for(var _0x5abc06=0x0;_0x5abc06<_0x29a790[_0xbe05('0x5e')][_0xbe05('0xa7')][_0xbe05('0x6a')];_0x5abc06+=0x1){_0x29a790[_0xbe05('0x5e')]['attachments'][_0x5abc06]={'filename':_0x29a790[_0xbe05('0x5e')][_0xbe05('0xa7')][_0x5abc06][_0xbe05('0x27')],'path':path[_0xbe05('0xa8')](config[_0xbe05('0xa9')],_0xbe05('0xaa'),_0x29a790[_0xbe05('0x5e')]['attachments'][_0x5abc06]['basename'])};}}var _0x562f9c=_0x5c62d5['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0xbe05('0xab'),{'account':_0x562f9c,'message':_0x29a790[_0xbe05('0x5e')]});})[_0xbe05('0x21')](function(_0x1a8eeb){if(!_0x1a8eeb)return;_0x2110ad=_0x1a8eeb;if(!_0x3abbf3['List'])throw new Error(_0xbe05('0xac'));if(_0x3abbf3[_0xbe05('0x9e')]['Contacts'][_0xbe05('0x6a')])return _0x3abbf3[_0xbe05('0x9e')]['Contacts'][0x0];return db['CmContact'][_0xbe05('0x67')](_['defaults'](_0x29a790[_0xbe05('0x5e')],{'firstName':_0x29a790[_0xbe05('0x5e')]['to'],'email':_0x29a790[_0xbe05('0x5e')]['to'],'phone':_0x29a790['body']['to'],'ListId':_0x3abbf3[_0xbe05('0x72')]}));})[_0xbe05('0x21')](function(_0xb0168a){if(!_0xb0168a)return;var _0x5709d9={'UserId':_0x29a790[_0xbe05('0x3b')]['id'],'ContactId':_0xb0168a['id'],'MailAccountId':_0x3abbf3['id'],'inReplyTo':_0x2110ad[_0xbe05('0xad')],'to':_0x29a790[_0xbe05('0x5e')]['from'],'cc':_0x29a790[_0xbe05('0x5e')]['cc'],'subject':_0x29a790[_0xbe05('0x5e')]['subject'],'attach':_0x29a790[_0xbe05('0x5e')]['attach'],'firstMsgDirection':_0xbe05('0xae'),'lastMsgAt':moment()[_0xbe05('0x9a')](_0xbe05('0xaf')),'lastMsgDirection':_0xbe05('0xae'),'Messages':[_[_0xbe05('0x51')](_0x29a790[_0xbe05('0x5e')],{'messageId':_0x2110ad[_0xbe05('0xad')],'sentAt':moment()[_0xbe05('0x9a')](_0xbe05('0xaf')),'read':!![],'MailAccountId':_0x3abbf3['id'],'UserId':_0x29a790[_0xbe05('0x3b')]['id'],'ContactId':_0xb0168a['id']})]};if(_0x29a790[_0xbe05('0x5e')][_0xbe05('0xb0')]){_0x5709d9=_[_0xbe05('0x51')](_0x5709d9,_0x29a790['body']['Interaction']);}return db[_0xbe05('0x80')]['create'](_0x5709d9,{'include':[{'model':db[_0xbe05('0x98')],'as':_0xbe05('0xb1')}]});})[_0xbe05('0x21')](respondWithResult(_0x312980,null))[_0xbe05('0x16')](handleError(_0x312980,null));};exports[_0xbe05('0xb2')]=function(_0x846515,_0x2d0f3d){return db[_0xbe05('0x53')][_0xbe05('0x5d')]({'where':{'id':_0x846515[_0xbe05('0x58')]['id']},'include':[{'model':db[_0xbe05('0x3e')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0xbe05('0x21')](handleEntityNotFound(_0x2d0f3d,null))[_0xbe05('0x21')](function(_0x4e7b1c){if(!_0x4e7b1c['Smtp'])return;var _0x2dbd13=_0x4e7b1c[_0xbe05('0xb3')]();return respondWithRpcPromise(_0xbe05('0xb4'),_0xbe05('0xb2'),{'account':_0x2dbd13});})['then'](respondWithResult(_0x2d0f3d,null))[_0xbe05('0x16')](handleError(_0x2d0f3d,null));};exports[_0xbe05('0x22')]=function(_0xadfaa4,_0x14e35c){return db[_0xbe05('0x53')][_0xbe05('0x5d')]({'where':{'id':_0xadfaa4['params']['id']}})[_0xbe05('0x21')](handleEntityNotFound(_0x14e35c,null))['then'](function(_0x34f0f7){if(_0x34f0f7&&_0x34f0f7[_0xbe05('0x39')]){throw new db[(_0xbe05('0xb5'))]['ValidationError'](_0xbe05('0xb6'));}return _0x34f0f7;})[_0xbe05('0x21')](removeEntity(_0x14e35c,null))[_0xbe05('0x16')](handleError(_0x14e35c,null));};exports[_0xbe05('0xb7')]=function(_0x2962b1,_0xde8a68){return db[_0xbe05('0x53')]['find']({'where':{'id':_0x2962b1['params']['id']}})[_0xbe05('0x21')](handleEntityNotFound(_0xde8a68,null))[_0xbe05('0x21')](function(_0x3be203){if(_0x3be203){return _0x3be203[_0xbe05('0xb7')](_0x2962b1['body'][_0xbe05('0x6c')],_[_0xbe05('0x81')](_0x2962b1[_0xbe05('0x5e')],[_0xbe05('0x6c'),'id'])||{})[_0xbe05('0xb8')](function(_0x1faa13){for(var _0x4d8915=0x0;_0x4d8915<_0x2962b1[_0xbe05('0x5e')][_0xbe05('0x6c')][_0xbe05('0x6a')];_0x4d8915+=0x1){socket[_0xbe05('0xb9')](_0xbe05('0xba'),{'UserId':Number(_0x2962b1['body']['ids'][_0x4d8915]),'MailAccountId':Number(_0x2962b1[_0xbe05('0x58')]['id'])});}return _0x1faa13;});}})[_0xbe05('0x21')](respondWithResult(_0xde8a68,null))[_0xbe05('0x16')](handleError(_0xde8a68,null));};exports[_0xbe05('0xbb')]=function(_0x5d92e8,_0x188acb){return db[_0xbe05('0x53')][_0xbe05('0x5d')]({'where':{'id':_0x5d92e8['params']['id']}})[_0xbe05('0x21')](handleEntityNotFound(_0x188acb,null))[_0xbe05('0x21')](function(_0x3e1193){if(_0x3e1193){return _0x3e1193[_0xbe05('0xbb')](_0x5d92e8[_0xbe05('0x45')][_0xbe05('0x6c')])[_0xbe05('0x21')](function(){if(_[_0xbe05('0xbc')](_0x5d92e8['query']['ids'])){for(var _0x42a74a=0x0;_0x42a74a<_0x5d92e8[_0xbe05('0x45')][_0xbe05('0x6c')][_0xbe05('0x6a')];_0x42a74a+=0x1){socket[_0xbe05('0xb9')]('userMailAccount:remove',{'UserId':Number(_0x5d92e8[_0xbe05('0x45')][_0xbe05('0x6c')][_0x42a74a]),'MailAccountId':Number(_0x5d92e8[_0xbe05('0x58')]['id'])});}}else{socket['emit'](_0xbe05('0xbd'),{'UserId':Number(_0x5d92e8['query'][_0xbe05('0x6c')]),'MailAccountId':Number(_0x5d92e8[_0xbe05('0x58')]['id'])});}});}})[_0xbe05('0x21')](respondWithStatusCode(_0x188acb,null))[_0xbe05('0x16')](handleError(_0x188acb,null));};exports[_0xbe05('0xbe')]=function(_0x200b9b,_0x59e188){var _0x4a16e0={};var _0x428f76={};var _0x52b361;var _0x5cf8ca;return db['MailAccount'][_0xbe05('0x69')]({'where':{'id':_0x200b9b[_0xbe05('0x58')]['id']}})[_0xbe05('0x21')](handleEntityNotFound(_0x59e188,null))['then'](function(_0x2cabbf){if(_0x2cabbf){_0x52b361=_0x2cabbf;_0x428f76[_0xbe05('0x43')]=_['keys'](db[_0xbe05('0x85')][_0xbe05('0x5a')]);_0x428f76[_0xbe05('0x45')]=_[_0xbe05('0x5b')](_0x200b9b[_0xbe05('0x45')]);_0x428f76[_0xbe05('0x4e')]=_[_0xbe05('0x47')](_0x428f76[_0xbe05('0x43')],_0x428f76[_0xbe05('0x45')]);_0x4a16e0[_0xbe05('0x46')]=_[_0xbe05('0x47')](_0x428f76['model'],qs[_0xbe05('0x48')](_0x200b9b['query'][_0xbe05('0x48')]));_0x4a16e0['attributes']=_0x4a16e0[_0xbe05('0x46')][_0xbe05('0x6a')]?_0x4a16e0[_0xbe05('0x46')]:_0x428f76['model'];_0x4a16e0[_0xbe05('0x4b')]=qs['sort'](_0x200b9b['query'][_0xbe05('0x4c')]);_0x4a16e0['where']=qs[_0xbe05('0x4e')](_[_0xbe05('0x4f')](_0x200b9b['query'],_0x428f76['filters']));if(_0x200b9b[_0xbe05('0x45')][_0xbe05('0x50')]){_0x4a16e0['where']=_['merge'](_0x4a16e0[_0xbe05('0x4d')],{'$or':_[_0xbe05('0x44')](_0x4a16e0['attributes'],function(_0x9d2c01){var _0x2cffd8={};_0x2cffd8[_0x9d2c01]={'$like':'%'+_0x200b9b[_0xbe05('0x45')]['filter']+'%'};return _0x2cffd8;})});}_0x4a16e0=_[_0xbe05('0x51')]({},_0x4a16e0,_0x200b9b['options']);return _0x52b361[_0xbe05('0xbe')](_0x4a16e0);}})[_0xbe05('0x21')](function(_0x5c2b6e){if(_0x5c2b6e){_0x5cf8ca=_0x5c2b6e[_0xbe05('0x6a')];if(!_0x200b9b[_0xbe05('0x45')]['hasOwnProperty'](_0xbe05('0x4a'))){_0x4a16e0['limit']=qs[_0xbe05('0x1d')](_0x200b9b[_0xbe05('0x45')][_0xbe05('0x1d')]);_0x4a16e0[_0xbe05('0x1a')]=qs[_0xbe05('0x1a')](_0x200b9b['query'][_0xbe05('0x1a')]);}return _0x52b361[_0xbe05('0xbe')](_0x4a16e0);}})[_0xbe05('0x21')](function(_0x5d6e99){if(_0x5d6e99){return _0x5d6e99?{'count':_0x5cf8ca,'rows':_0x5d6e99}:null;}})[_0xbe05('0x21')](respondWithResult(_0x59e188,null))['catch'](handleError(_0x59e188,null));}; \ No newline at end of file +var _0x8740=['find','update','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','create','Disposition','hasOwnProperty','nolimit','order','include','rows','ids','addAnswer','CannedAnswer','removeAnswers','email','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','findOne','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','transaction','Transaction','ISOLATION_LEVELS','MailApplication','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','inlineCss','true','send','CmList','updatedAt','DESC','CloudProvider','from','format','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','SendMail','List','Contacts','ListId','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','getSmtpOptions','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','omit','spread','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','emit','getAgents','moment','util','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','./mailAccount.socket','register','jayson/promise','http','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','status','end','offset','undefined','limit','count','set','Content-Range','json','destroy','get','MailAccounts','UserProfileResource','sendStatus','stack','name','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','gmail','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','smtp.office365.com','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','user','username','authentication','Imap','Smtp','MailServerIn','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','key','query','filters','intersection','model','attributes','fields','length','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','MailServerOut','keys','rawAttributes'];(function(_0x299d43,_0x4ebe75){var _0x2173b6=function(_0x588394){while(--_0x588394){_0x299d43['push'](_0x299d43['shift']());}};_0x2173b6(++_0x4ebe75);}(_0x8740,0x129));var _0x0874=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x8740[_0x263a74];return _0x2aa86c;};'use strict';var moment=require(_0x0874('0x0'));var BPromise=require('bluebird');var util=require(_0x0874('0x1'));var path=require('path');var _=require(_0x0874('0x2'));var juice=require(_0x0874('0x3'));var Redis=require(_0x0874('0x4'));var qs=require(_0x0874('0x5'));var logger=require(_0x0874('0x6'))(_0x0874('0x7'));var config=require(_0x0874('0x8'));var db=require('../../mysqldb')['db'];config[_0x0874('0x9')]=_[_0x0874('0xa')](config[_0x0874('0x9')],{'host':_0x0874('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0874('0x9')]));require(_0x0874('0xc'))[_0x0874('0xd')](socket);var jayson=require(_0x0874('0xe'));var client=jayson['client'][_0x0874('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x32c719,_0x18441d,_0x2cd1e6,_0x31d019){return new BPromise(function(_0x5b7433,_0x56798c){var _0x3b8357=_0x31d019||client;return _0x3b8357[_0x0874('0x10')](_0x32c719,_0x2cd1e6)[_0x0874('0x11')](function(_0x362e57){logger[_0x0874('0x12')](_0x0874('0x13'),_0x18441d,'request\x20sent');logger[_0x0874('0x14')](_0x0874('0x15'),_0x18441d,'request\x20sent',JSON[_0x0874('0x16')](_0x362e57));if(_0x362e57[_0x0874('0x17')]){if(_0x362e57[_0x0874('0x17')][_0x0874('0x18')]===0x1f4){logger['error'](_0x0874('0x13'),_0x18441d,_0x362e57['error'][_0x0874('0x19')]);return _0x56798c(_0x362e57[_0x0874('0x17')][_0x0874('0x19')]);}logger[_0x0874('0x17')]('MailAccount,\x20%s,\x20%s',_0x18441d,_0x362e57[_0x0874('0x17')]['message']);return _0x5b7433(_0x362e57['error'][_0x0874('0x19')]);}else{logger[_0x0874('0x12')]('MailAccount,\x20%s,\x20%s',_0x18441d,_0x0874('0x1a'));_0x5b7433(_0x362e57[_0x0874('0x1b')][_0x0874('0x19')]);}})['catch'](function(_0x56b6fa){logger['error']('MailAccount,\x20%s,\x20%s',_0x18441d,_0x56b6fa);_0x56798c(_0x56b6fa);});});}function respondWithStatusCode(_0x2d6c33,_0x522893){_0x522893=_0x522893||0xcc;return function(_0x100cfe){if(_0x100cfe){return _0x2d6c33['sendStatus'](_0x522893);}return _0x2d6c33[_0x0874('0x1c')](_0x522893)[_0x0874('0x1d')]();};}function respondWithResult(_0x1e1104,_0x5e7ea9){_0x5e7ea9=_0x5e7ea9||0xc8;return function(_0x60685d){if(_0x60685d){return _0x1e1104[_0x0874('0x1c')](_0x5e7ea9)['json'](_0x60685d);}};}function respondWithFilteredResult(_0x1a7114,_0x58c743){return function(_0x2a21bf){if(_0x2a21bf){var _0x4dbf86=typeof _0x58c743[_0x0874('0x1e')]===_0x0874('0x1f')&&typeof _0x58c743[_0x0874('0x20')]===_0x0874('0x1f');var _0x4be50c=_0x2a21bf[_0x0874('0x21')];var _0x1e230f=_0x4dbf86?0x0:_0x58c743[_0x0874('0x1e')];var _0x3aead5=_0x4dbf86?_0x2a21bf[_0x0874('0x21')]:_0x58c743['offset']+_0x58c743[_0x0874('0x20')];var _0x3c80cd;if(_0x3aead5>=_0x4be50c){_0x3aead5=_0x4be50c;_0x3c80cd=0xc8;}else{_0x3c80cd=0xce;}_0x1a7114[_0x0874('0x1c')](_0x3c80cd);return _0x1a7114[_0x0874('0x22')](_0x0874('0x23'),_0x1e230f+'-'+_0x3aead5+'/'+_0x4be50c)[_0x0874('0x24')](_0x2a21bf);}return null;};}function saveUpdates(_0x554674){return function(_0x269103){if(_0x269103){return _0x269103['update'](_0x554674)['then'](function(_0x162e5b){return _0x162e5b;});}return null;};}function removeEntity(_0x3ccce2){return function(_0x506610){if(_0x506610){return _0x506610[_0x0874('0x25')]()['then'](function(){var _0x8194bd=_0x506610[_0x0874('0x26')]({'plain':!![]});var _0x2e6ffb=_0x0874('0x27');return db[_0x0874('0x28')][_0x0874('0x25')]({'where':{'type':_0x2e6ffb,'resourceId':_0x8194bd['id']}})['then'](function(){return _0x506610;});})[_0x0874('0x11')](function(){_0x3ccce2[_0x0874('0x1c')](0xcc)[_0x0874('0x1d')]();});}};}function handleEntityNotFound(_0x1dc09a){return function(_0x3840bf){if(!_0x3840bf){_0x1dc09a[_0x0874('0x29')](0x194);}return _0x3840bf;};}function handleError(_0x164bf3,_0x4dd208){_0x4dd208=_0x4dd208||0x1f4;return function(_0x4f34be){logger[_0x0874('0x17')](_0x4f34be[_0x0874('0x2a')]);if(_0x4f34be[_0x0874('0x2b')]){delete _0x4f34be[_0x0874('0x2b')];}_0x164bf3['status'](_0x4dd208)['send'](_0x4f34be);};}function getImapHost(_0x5778f0){switch(_0x5778f0){case'gmail':return _0x0874('0x2c');case'yahoo':return _0x0874('0x2d');case _0x0874('0x2e'):return _0x0874('0x2f');case'outlook365':return _0x0874('0x30');}throw new Error(_0x0874('0x31'),_0x5778f0);}function getSmtpHost(_0x11fb4f){switch(_0x11fb4f){case _0x0874('0x32'):return _0x0874('0x33');case _0x0874('0x34'):return _0x0874('0x35');case _0x0874('0x2e'):return _0x0874('0x36');case _0x0874('0x37'):return _0x0874('0x38');}throw new Error(_0x0874('0x31'),_0x11fb4f);}function getAuthenticationOptions(_0x5a1d71,_0x421097){var _0x4d20fd={};var _0x14c658={};if(_0x5a1d71){_0x4d20fd['user']=_0x14c658['user']=_0x421097['username'];_0x4d20fd[_0x0874('0x39')]=_0x14c658[_0x0874('0x3a')]=_0x421097['password'];if(_0x421097[_0x0874('0x3b')]){_0x4d20fd['modernAuthentication']=_0x14c658[_0x0874('0x3b')]=!![];_0x4d20fd[_0x0874('0x3c')]=_0x14c658['CloudProviderId']=_0x421097[_0x0874('0x3c')];_0x4d20fd[_0x0874('0x39')]=_0x14c658[_0x0874('0x3a')]=null;}else{_0x4d20fd['CloudProviderId']=_0x14c658[_0x0874('0x3c')]=null;}_0x4d20fd[_0x0874('0x3d')]=getImapHost(_0x5a1d71);_0x4d20fd[_0x0874('0x3e')]=0x3e1;_0x14c658['host']=getSmtpHost(_0x5a1d71);_0x14c658[_0x0874('0x3e')]=0x24b;_0x14c658[_0x0874('0x3f')]=![];_0x4d20fd['service']=_0x14c658[_0x0874('0x40')]=null;}else{if(_0x421097['authentication']){_0x4d20fd[_0x0874('0x41')]=_0x14c658[_0x0874('0x41')]=_0x421097[_0x0874('0x42')];_0x4d20fd[_0x0874('0x39')]=_0x14c658[_0x0874('0x3a')]=_0x421097['password'];}else{_0x4d20fd[_0x0874('0x43')]=_0x14c658[_0x0874('0x43')]=![];_0x4d20fd[_0x0874('0x41')]=_0x14c658['user']=null;_0x4d20fd[_0x0874('0x39')]=_0x14c658['pass']=null;}_0x4d20fd['host']=_0x421097[_0x0874('0x44')][_0x0874('0x3d')];_0x4d20fd[_0x0874('0x3e')]=_0x421097[_0x0874('0x44')]['port'];_0x14c658[_0x0874('0x3d')]=_0x421097[_0x0874('0x45')]['host'];_0x14c658['port']=_0x421097[_0x0874('0x45')][_0x0874('0x3e')];}return{'Imap':_0x4d20fd,'Smtp':_0x14c658};}exports['index']=function(_0x5db11b,_0x6eb391){var _0x3e2cfc={'include':[{'model':db[_0x0874('0x46')],'as':_0x0874('0x44')},{'model':db['MailServerOut'],'as':_0x0874('0x45')},{'model':db[_0x0874('0x47')],'as':_0x0874('0x48')}]},_0x567c85={},_0x345efa={'count':0x0,'rows':[]};var _0x182ff6=_[_0x0874('0x49')](db[_0x0874('0x4a')]['rawAttributes'],function(_0xe9655f){return{'name':_0xe9655f[_0x0874('0x4b')],'type':_0xe9655f['type'][_0x0874('0x4c')]};});_0x567c85['model']=_[_0x0874('0x49')](_0x182ff6,_0x0874('0x2b'));_0x567c85[_0x0874('0x4d')]=_['keys'](_0x5db11b[_0x0874('0x4d')]);_0x567c85[_0x0874('0x4e')]=_[_0x0874('0x4f')](_0x567c85[_0x0874('0x50')],_0x567c85[_0x0874('0x4d')]);_0x3e2cfc[_0x0874('0x51')]=_[_0x0874('0x4f')](_0x567c85['model'],qs[_0x0874('0x52')](_0x5db11b[_0x0874('0x4d')][_0x0874('0x52')]));_0x3e2cfc[_0x0874('0x51')]=_0x3e2cfc[_0x0874('0x51')][_0x0874('0x53')]?_0x3e2cfc[_0x0874('0x51')]:_0x567c85['model'];if(!_0x5db11b[_0x0874('0x4d')]['hasOwnProperty']('nolimit')){_0x3e2cfc[_0x0874('0x20')]=qs[_0x0874('0x20')](_0x5db11b[_0x0874('0x4d')][_0x0874('0x20')]);_0x3e2cfc[_0x0874('0x1e')]=qs[_0x0874('0x1e')](_0x5db11b['query'][_0x0874('0x1e')]);}_0x3e2cfc['order']=qs['sort'](_0x5db11b['query'][_0x0874('0x54')]);_0x3e2cfc['where']=qs[_0x0874('0x4e')](_[_0x0874('0x55')](_0x5db11b[_0x0874('0x4d')],_0x567c85['filters']),_0x182ff6);if(_0x5db11b[_0x0874('0x4d')][_0x0874('0x56')]){_0x3e2cfc[_0x0874('0x57')]=_[_0x0874('0x58')](_0x3e2cfc[_0x0874('0x57')],{'$or':_[_0x0874('0x49')](_0x182ff6,function(_0x553d3c){if(_0x553d3c['type']!==_0x0874('0x59')){var _0x1a9651={};_0x1a9651[_0x553d3c['name']]={'$like':'%'+_0x5db11b['query']['filter']+'%'};return _0x1a9651;}})});}_0x3e2cfc=_['merge']({},_0x3e2cfc,_0x5db11b[_0x0874('0x5a')]);var _0x34cf8c={'where':_0x3e2cfc[_0x0874('0x57')]};return db[_0x0874('0x4a')][_0x0874('0x21')](_0x34cf8c)['then'](function(_0x13b101){_0x345efa[_0x0874('0x21')]=_0x13b101;if(_0x5db11b[_0x0874('0x4d')][_0x0874('0x5b')]){_0x3e2cfc['include']=[{'all':!![]}];}return db[_0x0874('0x4a')][_0x0874('0x5c')](_0x3e2cfc);})[_0x0874('0x11')](function(_0x115572){_0x345efa['rows']=_0x115572;return _0x345efa;})[_0x0874('0x11')](respondWithFilteredResult(_0x6eb391,_0x3e2cfc))[_0x0874('0x5d')](handleError(_0x6eb391,null));};exports[_0x0874('0x5e')]=function(_0x1a5989,_0x1947c7){var _0x230adc={'raw':![],'where':{'id':_0x1a5989[_0x0874('0x5f')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x0874('0x44')},{'model':db[_0x0874('0x60')],'as':_0x0874('0x45')},{'model':db[_0x0874('0x47')],'as':_0x0874('0x48')}]},_0x3df341={};_0x3df341[_0x0874('0x50')]=_[_0x0874('0x61')](db[_0x0874('0x4a')][_0x0874('0x62')]);_0x3df341[_0x0874('0x4d')]=_['keys'](_0x1a5989[_0x0874('0x4d')]);_0x3df341[_0x0874('0x4e')]=_['intersection'](_0x3df341[_0x0874('0x50')],_0x3df341[_0x0874('0x4d')]);_0x230adc[_0x0874('0x51')]=_[_0x0874('0x4f')](_0x3df341[_0x0874('0x50')],qs['fields'](_0x1a5989['query'][_0x0874('0x52')]));_0x230adc[_0x0874('0x51')]=_0x230adc[_0x0874('0x51')][_0x0874('0x53')]?_0x230adc[_0x0874('0x51')]:_0x3df341['model'];if(_0x1a5989[_0x0874('0x4d')][_0x0874('0x5b')]){_0x230adc['include']=[{'all':!![]}];}_0x230adc=_['merge']({},_0x230adc,_0x1a5989[_0x0874('0x5a')]);return db[_0x0874('0x4a')][_0x0874('0x63')](_0x230adc)['then'](handleEntityNotFound(_0x1947c7,null))[_0x0874('0x11')](respondWithResult(_0x1947c7,null))[_0x0874('0x5d')](handleError(_0x1947c7,null));};exports[_0x0874('0x64')]=function(_0x50e87f,_0x595600){if(_0x50e87f[_0x0874('0x65')]['id']){delete _0x50e87f[_0x0874('0x65')]['id'];}var _0x58e6d1=_0x50e87f['body'][_0x0874('0x66')]===_0x0874('0x67')?null:_0x50e87f[_0x0874('0x65')][_0x0874('0x66')];var _0x2cdd3d=_0x50e87f[_0x0874('0x65')][_0x0874('0x44')]||{};var _0xe7fa8d=_0x50e87f[_0x0874('0x65')][_0x0874('0x45')]||{};if(_0x58e6d1){_0x2cdd3d[_0x0874('0x3d')]=getImapHost(_0x58e6d1);_0x2cdd3d[_0x0874('0x3e')]=0x3e1;_0xe7fa8d[_0x0874('0x3d')]=getSmtpHost(_0x58e6d1);_0xe7fa8d[_0x0874('0x3e')]=0x24b;_0xe7fa8d['secure']=![];}if(_0xe7fa8d['modernAuthentication']){_0xe7fa8d['secure']=![];}else{_0xe7fa8d['CloudProviderId']=null;}if(!_0x2cdd3d['modernAuthentication'])_0x2cdd3d[_0x0874('0x3c')]=null;_0x50e87f['body'][_0x0874('0x44')]=_0x2cdd3d;_0x50e87f['body'][_0x0874('0x45')]=_0xe7fa8d;return db['MailAccount'][_0x0874('0x63')]({'where':{'id':_0x50e87f['params']['id']},'include':[{'model':db[_0x0874('0x46')],'as':_0x0874('0x44')},{'model':db['MailServerOut'],'as':_0x0874('0x45')},{'model':db['Pause'],'as':_0x0874('0x48')}]})[_0x0874('0x11')](handleEntityNotFound(_0x595600,null))[_0x0874('0x11')](function(_0x74353d){if(!_0x74353d)throw new Error(_0x0874('0x68'));if(_0x74353d[_0x0874('0x40')])delete _0x50e87f[_0x0874('0x65')][_0x0874('0x44')];return _0x74353d;})[_0x0874('0x11')](saveUpdates(_0x50e87f[_0x0874('0x65')],null))[_0x0874('0x11')](function(_0x3a9782){if(!_0x50e87f[_0x0874('0x65')][_0x0874('0x44')])return _0x3a9782;return db[_0x0874('0x46')]['update'](_0x50e87f[_0x0874('0x65')][_0x0874('0x44')],{'where':{'MailAccountId':_0x3a9782['id']}})[_0x0874('0x11')](function(){return _0x3a9782;});})[_0x0874('0x11')](function(_0x58b1a1){if(!_0x50e87f['body']['Smtp'])return _0x58b1a1;return db['MailServerOut']['update'](_0x50e87f['body'][_0x0874('0x45')],{'where':{'MailAccountId':_0x58b1a1['id']}})[_0x0874('0x11')](function(){return _0x58b1a1;});})[_0x0874('0x11')](respondWithResult(_0x595600,null))[_0x0874('0x5d')](handleError(_0x595600,null));};exports[_0x0874('0x69')]=function(_0x162451,_0x38cf70){return db[_0x0874('0x4a')][_0x0874('0x69')]()['then'](respondWithResult(_0x38cf70,null))[_0x0874('0x5d')](handleError(_0x38cf70,null));};exports[_0x0874('0x6a')]=function(_0x8399c4,_0x5b0bc1){if(_0x8399c4['body']['id']){delete _0x8399c4[_0x0874('0x65')]['id'];}return db[_0x0874('0x4a')][_0x0874('0x63')]({'where':{'id':_0x8399c4[_0x0874('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5b0bc1,null))['then'](function(_0x46ed45){if(_0x46ed45){_0x8399c4[_0x0874('0x65')][_0x0874('0x6b')]=_0x46ed45['id'];return db['Disposition'][_0x0874('0x6c')](_0x8399c4[_0x0874('0x65')]);}})[_0x0874('0x11')](respondWithResult(_0x5b0bc1,null))[_0x0874('0x5d')](handleError(_0x5b0bc1,null));};exports['getDispositions']=function(_0x3ba3f8,_0x410ebf){var _0x3355b6={'raw':![],'where':{}};var _0x5103ae={};var _0x324a3e={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x3ba3f8['params']['id']}})[_0x0874('0x11')](handleEntityNotFound(_0x410ebf,null))[_0x0874('0x11')](function(_0x5e2cf9){if(_0x5e2cf9){_0x5103ae[_0x0874('0x50')]=_[_0x0874('0x61')](db[_0x0874('0x6d')][_0x0874('0x62')]);_0x5103ae['query']=_[_0x0874('0x61')](_0x3ba3f8[_0x0874('0x4d')]);_0x5103ae['filters']=_['intersection'](_0x5103ae[_0x0874('0x50')],_0x5103ae[_0x0874('0x4d')]);_0x3355b6[_0x0874('0x51')]=_[_0x0874('0x4f')](_0x5103ae[_0x0874('0x50')],qs['fields'](_0x3ba3f8[_0x0874('0x4d')][_0x0874('0x52')]));_0x3355b6['attributes']=_0x3355b6['attributes']['length']?_0x3355b6[_0x0874('0x51')]:_0x5103ae['model'];if(!_0x3ba3f8[_0x0874('0x4d')][_0x0874('0x6e')](_0x0874('0x6f'))){_0x3355b6[_0x0874('0x20')]=qs[_0x0874('0x20')](_0x3ba3f8[_0x0874('0x4d')][_0x0874('0x20')]);_0x3355b6[_0x0874('0x1e')]=qs[_0x0874('0x1e')](_0x3ba3f8['query'][_0x0874('0x1e')]);}_0x3355b6[_0x0874('0x70')]=qs[_0x0874('0x54')](_0x3ba3f8['query'][_0x0874('0x54')]);_0x3355b6[_0x0874('0x57')]=qs[_0x0874('0x4e')](_[_0x0874('0x55')](_0x3ba3f8[_0x0874('0x4d')],_0x5103ae[_0x0874('0x4e')]));_0x3355b6['where'][_0x0874('0x6b')]=_0x5e2cf9['id'];if(_0x3ba3f8[_0x0874('0x4d')][_0x0874('0x56')]){_0x3355b6[_0x0874('0x57')]=_['merge'](_0x3355b6[_0x0874('0x57')],{'$or':_['map'](_0x3355b6['attributes'],function(_0x5a583d){var _0x44137b={};_0x44137b[_0x5a583d]={'$like':'%'+_0x3ba3f8[_0x0874('0x4d')][_0x0874('0x56')]+'%'};return _0x44137b;})});}_0x3355b6=_['merge']({},_0x3355b6,_0x3ba3f8[_0x0874('0x5a')]);return db[_0x0874('0x6d')]['count']({'where':_0x3355b6[_0x0874('0x57')]})[_0x0874('0x11')](function(_0x560cd4){_0x324a3e[_0x0874('0x21')]=_0x560cd4;if(_0x3ba3f8[_0x0874('0x4d')][_0x0874('0x5b')]){_0x3355b6[_0x0874('0x71')]=[{'all':!![]}];}return db[_0x0874('0x6d')][_0x0874('0x5c')](_0x3355b6);})[_0x0874('0x11')](function(_0x402eb0){_0x324a3e[_0x0874('0x72')]=_0x402eb0;return _0x324a3e;});}})[_0x0874('0x11')](respondWithFilteredResult(_0x410ebf,_0x3355b6))[_0x0874('0x5d')](handleError(_0x410ebf,null));};exports['removeDispositions']=function(_0xc6c732,_0x1b3ed1){return db[_0x0874('0x4a')][_0x0874('0x63')]({'where':{'id':_0xc6c732[_0x0874('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1b3ed1,null))[_0x0874('0x11')](function(_0x25ef7c){if(_0x25ef7c){return _0x25ef7c['removeDispositions'](_0xc6c732['query'][_0x0874('0x73')]);}})['then'](respondWithStatusCode(_0x1b3ed1,null))[_0x0874('0x5d')](handleError(_0x1b3ed1,null));};exports[_0x0874('0x74')]=function(_0x2818e8,_0x17cea5){if(_0x2818e8[_0x0874('0x65')]['id']){delete _0x2818e8[_0x0874('0x65')]['id'];}return db[_0x0874('0x4a')][_0x0874('0x63')]({'where':{'id':_0x2818e8[_0x0874('0x5f')]['id']}})[_0x0874('0x11')](handleEntityNotFound(_0x17cea5,null))[_0x0874('0x11')](function(_0x32c49a){if(_0x32c49a){_0x2818e8['body'][_0x0874('0x6b')]=_0x32c49a['id'];return db['CannedAnswer'][_0x0874('0x6c')](_0x2818e8[_0x0874('0x65')]);}})[_0x0874('0x11')](respondWithResult(_0x17cea5,null))['catch'](handleError(_0x17cea5,null));};exports['getAnswers']=function(_0xe8ff,_0x3bdb2f){var _0x543c9e={'raw':![],'where':{}};var _0x5f5c9c={};var _0x2543b7={'count':0x0,'rows':[]};return db[_0x0874('0x4a')]['findOne']({'where':{'id':_0xe8ff['params']['id']}})[_0x0874('0x11')](handleEntityNotFound(_0x3bdb2f,null))['then'](function(_0x482173){if(_0x482173){_0x5f5c9c['model']=_[_0x0874('0x61')](db[_0x0874('0x75')][_0x0874('0x62')]);_0x5f5c9c[_0x0874('0x4d')]=_['keys'](_0xe8ff[_0x0874('0x4d')]);_0x5f5c9c['filters']=_[_0x0874('0x4f')](_0x5f5c9c['model'],_0x5f5c9c['query']);_0x543c9e['attributes']=_['intersection'](_0x5f5c9c[_0x0874('0x50')],qs['fields'](_0xe8ff[_0x0874('0x4d')][_0x0874('0x52')]));_0x543c9e[_0x0874('0x51')]=_0x543c9e[_0x0874('0x51')][_0x0874('0x53')]?_0x543c9e['attributes']:_0x5f5c9c[_0x0874('0x50')];if(!_0xe8ff[_0x0874('0x4d')][_0x0874('0x6e')](_0x0874('0x6f'))){_0x543c9e[_0x0874('0x20')]=qs[_0x0874('0x20')](_0xe8ff[_0x0874('0x4d')][_0x0874('0x20')]);_0x543c9e[_0x0874('0x1e')]=qs[_0x0874('0x1e')](_0xe8ff[_0x0874('0x4d')][_0x0874('0x1e')]);}_0x543c9e[_0x0874('0x70')]=qs[_0x0874('0x54')](_0xe8ff['query']['sort']);_0x543c9e[_0x0874('0x57')]=qs[_0x0874('0x4e')](_[_0x0874('0x55')](_0xe8ff[_0x0874('0x4d')],_0x5f5c9c[_0x0874('0x4e')]));_0x543c9e[_0x0874('0x57')][_0x0874('0x6b')]=_0x482173['id'];if(_0xe8ff['query'][_0x0874('0x56')]){_0x543c9e[_0x0874('0x57')]=_[_0x0874('0x58')](_0x543c9e[_0x0874('0x57')],{'$or':_[_0x0874('0x49')](_0x543c9e[_0x0874('0x51')],function(_0x4e5503){var _0x35dd1d={};_0x35dd1d[_0x4e5503]={'$like':'%'+_0xe8ff['query'][_0x0874('0x56')]+'%'};return _0x35dd1d;})});}_0x543c9e=_[_0x0874('0x58')]({},_0x543c9e,_0xe8ff['options']);return db[_0x0874('0x75')][_0x0874('0x21')]({'where':_0x543c9e[_0x0874('0x57')]})[_0x0874('0x11')](function(_0x377984){_0x2543b7[_0x0874('0x21')]=_0x377984;if(_0xe8ff[_0x0874('0x4d')][_0x0874('0x5b')]){_0x543c9e[_0x0874('0x71')]=[{'all':!![]}];}return db[_0x0874('0x75')][_0x0874('0x5c')](_0x543c9e);})[_0x0874('0x11')](function(_0x56557c){_0x2543b7[_0x0874('0x72')]=_0x56557c;return _0x2543b7;});}})[_0x0874('0x11')](respondWithFilteredResult(_0x3bdb2f,_0x543c9e))[_0x0874('0x5d')](handleError(_0x3bdb2f,null));};exports[_0x0874('0x76')]=function(_0x4ffa3e,_0xff0cda){return db[_0x0874('0x4a')]['find']({'where':{'id':_0x4ffa3e[_0x0874('0x5f')]['id']}})[_0x0874('0x11')](handleEntityNotFound(_0xff0cda,null))[_0x0874('0x11')](function(_0x45957d){if(_0x45957d){return _0x45957d['removeAnswers'](_0x4ffa3e[_0x0874('0x4d')]['ids']);}})[_0x0874('0x11')](respondWithStatusCode(_0xff0cda,null))[_0x0874('0x5d')](handleError(_0xff0cda,null));};exports['create']=function(_0x39ae2f,_0x38d757){var _0x44e7e7={'name':_0x39ae2f[_0x0874('0x65')]['name'],'key':_0x39ae2f['body'][_0x0874('0x4c')],'provider':_0x39ae2f[_0x0874('0x65')][_0x0874('0x66')]==='custom'?null:_0x39ae2f[_0x0874('0x65')][_0x0874('0x66')],'email':_0x39ae2f['body'][_0x0874('0x77')],'ListId':_0x39ae2f[_0x0874('0x65')]['ListId'],'active':!_['isNil'](_0x39ae2f['body'][_0x0874('0x78')])?_0x39ae2f[_0x0874('0x65')][_0x0874('0x78')]:!![],'description':_0x39ae2f[_0x0874('0x65')][_0x0874('0x79')]||null};var _0x22a99e=getAuthenticationOptions(_0x44e7e7[_0x0874('0x66')],_0x39ae2f[_0x0874('0x65')]);_0x44e7e7[_0x0874('0x44')]=_0x22a99e['Imap'];_0x44e7e7[_0x0874('0x45')]=_0x22a99e[_0x0874('0x45')];return db[_0x0874('0x4a')][_0x0874('0x6c')](_0x44e7e7,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x0874('0x46')],'as':_0x0874('0x44')}]})['then'](function(_0x21684d){var _0x5d6a7f=_0x39ae2f[_0x0874('0x41')]['get']({'plain':!![]});if(!_0x5d6a7f)throw new Error(_0x0874('0x7a'));if(_0x5d6a7f[_0x0874('0x7b')]==='user'){var _0x158a0b=_0x21684d[_0x0874('0x26')]({'plain':!![]});return db[_0x0874('0x7c')][_0x0874('0x63')]({'where':{'name':_0x0874('0x27'),'userProfileId':_0x5d6a7f[_0x0874('0x7d')]},'raw':!![]})[_0x0874('0x11')](function(_0x30d924){if(_0x30d924&&_0x30d924[_0x0874('0x7e')]===0x0){return db['UserProfileResource'][_0x0874('0x6c')]({'name':_0x158a0b[_0x0874('0x2b')],'resourceId':_0x158a0b['id'],'type':_0x30d924[_0x0874('0x2b')],'sectionId':_0x30d924['id']},{})[_0x0874('0x11')](function(){return _0x21684d;});}else{return _0x21684d;}})[_0x0874('0x5d')](function(_0x297313){logger[_0x0874('0x17')](_0x0874('0x7f'),_0x297313);throw _0x297313;});}return _0x21684d;})[_0x0874('0x11')](respondWithResult(_0x38d757,0xc9))['catch'](handleError(_0x38d757,null));};exports[_0x0874('0x80')]=function(_0x1cf7f1,_0x1bed78){return db['MailAccount'][_0x0874('0x81')]({'where':{'id':_0x1cf7f1['params']['id']}})['then'](handleEntityNotFound(_0x1bed78,null))[_0x0874('0x11')](function(_0x33a59a){if(_0x33a59a){return _0x33a59a[_0x0874('0x80')]();}return null;})[_0x0874('0x11')](respondWithResult(_0x1bed78,null))[_0x0874('0x5d')](handleError(_0x1bed78,null));};exports[_0x0874('0x82')]=function(_0x46cd12,_0x5db1cf){if(_0x46cd12[_0x0874('0x65')]['id']){delete _0x46cd12[_0x0874('0x65')]['id'];}return db['MailAccount'][_0x0874('0x63')]({'where':{'id':_0x46cd12['params']['id']}})[_0x0874('0x11')](handleEntityNotFound(_0x5db1cf,null))[_0x0874('0x11')](function(_0x2afa40){if(_0x2afa40){_0x46cd12[_0x0874('0x65')][_0x0874('0x6b')]=_0x2afa40['id'];return db['MailServerIn'][_0x0874('0x6c')](_0x46cd12[_0x0874('0x65')]);}})[_0x0874('0x11')](respondWithResult(_0x5db1cf,null))['catch'](handleError(_0x5db1cf,null));};exports[_0x0874('0x83')]=function(_0x11f2bc,_0x57e80b){return db[_0x0874('0x4a')][_0x0874('0x81')]({'where':{'id':_0x11f2bc['params']['id']}})[_0x0874('0x11')](handleEntityNotFound(_0x57e80b,null))[_0x0874('0x11')](function(_0x383e4f){if(_0x383e4f){return _0x383e4f['setImap'](null);}return null;})[_0x0874('0x11')](respondWithStatusCode(_0x57e80b,null))[_0x0874('0x5d')](handleError(_0x57e80b,null));};exports[_0x0874('0x84')]=function(_0x4327fb,_0x1f7f8c){return db[_0x0874('0x4a')]['findOne']({'where':{'id':_0x4327fb['params']['id']}})['then'](handleEntityNotFound(_0x1f7f8c,null))[_0x0874('0x11')](function(_0x4a7855){if(_0x4a7855){return _0x4a7855['getSmtp']();}return null;})[_0x0874('0x11')](respondWithResult(_0x1f7f8c,null))['catch'](handleError(_0x1f7f8c,null));};exports[_0x0874('0x85')]=function(_0xd13532,_0x37bc26){if(_0xd13532[_0x0874('0x65')]['id']){delete _0xd13532[_0x0874('0x65')]['id'];}return db[_0x0874('0x4a')][_0x0874('0x63')]({'where':{'id':_0xd13532['params']['id']}})[_0x0874('0x11')](handleEntityNotFound(_0x37bc26,null))[_0x0874('0x11')](function(_0x5a463b){if(_0x5a463b){_0xd13532[_0x0874('0x65')][_0x0874('0x6b')]=_0x5a463b['id'];return db[_0x0874('0x60')][_0x0874('0x6c')](_0xd13532[_0x0874('0x65')]);}})[_0x0874('0x11')](respondWithResult(_0x37bc26,null))[_0x0874('0x5d')](handleError(_0x37bc26,null));};exports[_0x0874('0x86')]=function(_0x336e93,_0x283b1d){return db[_0x0874('0x4a')]['findOne']({'where':{'id':_0x336e93[_0x0874('0x5f')]['id']}})['then'](handleEntityNotFound(_0x283b1d,null))[_0x0874('0x11')](function(_0x5bf4db){if(_0x5bf4db){return _0x5bf4db[_0x0874('0x87')](null);}return null;})[_0x0874('0x11')](respondWithStatusCode(_0x283b1d,null))[_0x0874('0x5d')](handleError(_0x283b1d,null));};exports[_0x0874('0x88')]=function(_0x4e2500,_0xa43f25){return db[_0x0874('0x89')][_0x0874('0x63')]({'where':{'id':_0x4e2500[_0x0874('0x5f')]['id']}})[_0x0874('0x11')](handleEntityNotFound(_0xa43f25,null))[_0x0874('0x11')](function(_0x248946){if(_0x248946){return _0x248946[_0x0874('0x88')](_0x4e2500[_0x0874('0x65')][_0x0874('0x73')],_['omit'](_0x4e2500[_0x0874('0x65')],['ids','id'])||{});}})['then'](respondWithResult(_0xa43f25,null))[_0x0874('0x5d')](handleError(_0xa43f25,null));};exports[_0x0874('0x8a')]=function(_0x5e1394,_0x17a6ac){var _0x119fde={'raw':![],'where':{}};var _0x22d34d={};var _0x3dcda1={'count':0x0,'rows':[]};return db[_0x0874('0x4a')][_0x0874('0x81')]({'where':{'id':_0x5e1394[_0x0874('0x5f')]['id']}})[_0x0874('0x11')](handleEntityNotFound(_0x17a6ac,null))['then'](function(_0x126386){if(_0x126386){_0x22d34d[_0x0874('0x50')]=_[_0x0874('0x61')](db[_0x0874('0x89')][_0x0874('0x62')]);_0x22d34d[_0x0874('0x4d')]=_['keys'](_0x5e1394['query']);_0x22d34d[_0x0874('0x4e')]=_[_0x0874('0x4f')](_0x22d34d[_0x0874('0x50')],_0x22d34d[_0x0874('0x4d')]);_0x119fde[_0x0874('0x51')]=_[_0x0874('0x4f')](_0x22d34d['model'],qs['fields'](_0x5e1394['query'][_0x0874('0x52')]));_0x119fde[_0x0874('0x51')]=_0x119fde[_0x0874('0x51')][_0x0874('0x53')]?_0x119fde[_0x0874('0x51')]:_0x22d34d[_0x0874('0x50')];if(!_0x5e1394[_0x0874('0x4d')][_0x0874('0x6e')](_0x0874('0x6f'))){_0x119fde[_0x0874('0x20')]=qs[_0x0874('0x20')](_0x5e1394['query'][_0x0874('0x20')]);_0x119fde['offset']=qs[_0x0874('0x1e')](_0x5e1394[_0x0874('0x4d')][_0x0874('0x1e')]);}_0x119fde['order']=qs['sort'](_0x5e1394['query'][_0x0874('0x54')]);_0x119fde[_0x0874('0x57')]=qs['filters'](_[_0x0874('0x55')](_0x5e1394[_0x0874('0x4d')],_0x22d34d['filters']));_0x119fde['where']['MailAccountId']=_0x126386['id'];if(_0x5e1394[_0x0874('0x4d')]['filter']){_0x119fde['where']=_[_0x0874('0x58')](_0x119fde[_0x0874('0x57')],{'$or':_['map'](_0x119fde[_0x0874('0x51')],function(_0x4113aa){var _0xba9648={};_0xba9648[_0x4113aa]={'$like':'%'+_0x5e1394[_0x0874('0x4d')][_0x0874('0x56')]+'%'};return _0xba9648;})});}_0x119fde=_[_0x0874('0x58')]({},_0x119fde,_0x5e1394[_0x0874('0x5a')]);return db[_0x0874('0x89')][_0x0874('0x21')]({'where':_0x119fde[_0x0874('0x57')]})[_0x0874('0x11')](function(_0x4efa01){_0x3dcda1[_0x0874('0x21')]=_0x4efa01;if(_0x5e1394[_0x0874('0x4d')][_0x0874('0x5b')]){_0x119fde['include']=[{'model':db[_0x0874('0x8b')],'as':_0x0874('0x8c'),'required':![]},{'model':db[_0x0874('0x8d')],'as':_0x0874('0x8e'),'attributes':['name','fullname',_0x0874('0x8f')],'required':![]},{'model':db[_0x0874('0x90')],'as':_0x0874('0x91'),'attributes':['id',_0x0874('0x2b'),_0x0874('0x92')],'where':_0x5e1394[_0x0874('0x4d')]['tag']?{'id':_0x5e1394[_0x0874('0x4d')][_0x0874('0x93')]}:undefined,'required':_0x5e1394['query'][_0x0874('0x93')]?!![]:![]}];}return db['MailInteraction'][_0x0874('0x5c')](_0x119fde);})['then'](function(_0x5f37cf){_0x3dcda1[_0x0874('0x72')]=_0x5f37cf;return _0x3dcda1;});}})[_0x0874('0x11')](respondWithFilteredResult(_0x17a6ac,_0x119fde))[_0x0874('0x5d')](handleError(_0x17a6ac,null));};exports['addApplications']=function addApplications(_0x592855,_0x333218){var _0x5ca0ae=_0x592855['params']['id'];var _0x2cd18c=_0x592855[_0x0874('0x65')];var _0x41ab2c=0xc8;var _0x4c6510=null;return db['sequelize'][_0x0874('0x94')]({'isolationLevel':db['sequelize'][_0x0874('0x95')][_0x0874('0x96')]['READ_COMMITTED']},function(_0x35560a){return db[_0x0874('0x4a')][_0x0874('0x81')]({'where':{'id':_0x5ca0ae},'transaction':_0x35560a})[_0x0874('0x11')](function(_0x5ba36d){if(_0x5ba36d){return db[_0x0874('0x97')]['destroy']({'where':{'MailAccountId':_0x5ca0ae},'transaction':_0x35560a})[_0x0874('0x11')](function(){var _0x572caf=_[_0x0874('0x49')](_0x2cd18c,function(_0xd65415){_0xd65415[_0x0874('0x6b')]=_0x5ca0ae;return _0xd65415;});return db['MailApplication']['bulkCreate'](_0x572caf,{'transaction':_0x35560a});});}else{_0x41ab2c=0x194;_0x4c6510=[];}});})[_0x0874('0x11')](function(){if(_0x41ab2c!==0x194){return db[_0x0874('0x97')][_0x0874('0x98')]({'where':{'MailAccountId':_0x5ca0ae},'order':_0x0874('0x99')})[_0x0874('0x11')](function(_0x36742c){_0x4c6510=_0x36742c;});}})[_0x0874('0x5d')](function(_0x3c8f84){_0x41ab2c=0x1f4;logger[_0x0874('0x17')](_0x3c8f84[_0x0874('0x2a')]);if(_0x3c8f84[_0x0874('0x2b')]){delete _0x3c8f84['name'];}_0x4c6510=_0x3c8f84;})['finally'](function(){if(_0x4c6510===null){_0x333218[_0x0874('0x29')](_0x41ab2c);}else{if(_0x41ab2c===0x1f4){_0x333218[_0x0874('0x1c')](_0x41ab2c)['send'](_0x4c6510);}else{_0x333218[_0x0874('0x1c')](_0x41ab2c)[_0x0874('0x24')](_0x4c6510);}}});};exports['getApplications']=function(_0x33e3fc,_0x189b36){var _0x1864eb={};var _0x4a1224={};var _0xf9c4b3;var _0x5ae7c9;return db['MailAccount'][_0x0874('0x81')]({'where':{'id':_0x33e3fc[_0x0874('0x5f')]['id']}})['then'](handleEntityNotFound(_0x189b36,null))[_0x0874('0x11')](function(_0x3fa7bc){if(_0x3fa7bc){_0xf9c4b3=_0x3fa7bc;_0x4a1224[_0x0874('0x50')]=_[_0x0874('0x61')](db[_0x0874('0x97')]['rawAttributes']);_0x4a1224['query']=_['keys'](_0x33e3fc[_0x0874('0x4d')]);_0x4a1224[_0x0874('0x4e')]=_[_0x0874('0x4f')](_0x4a1224['model'],_0x4a1224[_0x0874('0x4d')]);_0x1864eb[_0x0874('0x51')]=_[_0x0874('0x4f')](_0x4a1224['model'],qs[_0x0874('0x52')](_0x33e3fc['query']['fields']));_0x1864eb[_0x0874('0x51')]=_0x1864eb[_0x0874('0x51')][_0x0874('0x53')]?_0x1864eb[_0x0874('0x51')]:_0x4a1224[_0x0874('0x50')];_0x1864eb[_0x0874('0x70')]=qs[_0x0874('0x54')](_0x33e3fc[_0x0874('0x4d')]['sort']);_0x1864eb[_0x0874('0x57')]=qs[_0x0874('0x4e')](_[_0x0874('0x55')](_0x33e3fc[_0x0874('0x4d')],_0x4a1224[_0x0874('0x4e')]));if(_0x33e3fc[_0x0874('0x4d')][_0x0874('0x56')]){_0x1864eb[_0x0874('0x57')]=_[_0x0874('0x58')](_0x1864eb['where'],{'$or':_[_0x0874('0x49')](_0x1864eb['attributes'],function(_0x33e39a){var _0xcf21f8={};_0xcf21f8[_0x33e39a]={'$like':'%'+_0x33e3fc['query'][_0x0874('0x56')]+'%'};return _0xcf21f8;})});}_0x1864eb=_[_0x0874('0x58')]({},_0x1864eb,_0x33e3fc[_0x0874('0x5a')]);return _0xf9c4b3[_0x0874('0x9a')](_0x1864eb);}})[_0x0874('0x11')](function(_0x1d23e9){if(_0x1d23e9){_0x5ae7c9=_0x1d23e9['length'];if(!_0x33e3fc['query'][_0x0874('0x6e')](_0x0874('0x6f'))){_0x1864eb['limit']=qs[_0x0874('0x20')](_0x33e3fc[_0x0874('0x4d')][_0x0874('0x20')]);_0x1864eb[_0x0874('0x1e')]=qs[_0x0874('0x1e')](_0x33e3fc[_0x0874('0x4d')][_0x0874('0x1e')]);}return _0xf9c4b3[_0x0874('0x9a')](_0x1864eb);}})[_0x0874('0x11')](function(_0x1c8325){if(_0x1c8325){return _0x1c8325?{'count':_0x5ae7c9,'rows':_0x1c8325}:null;}})[_0x0874('0x11')](respondWithResult(_0x189b36,null))[_0x0874('0x5d')](handleError(_0x189b36,null));};exports[_0x0874('0x9b')]=function(_0xdc2f83,_0x49efb6){var _0x520ad7={'raw':!![],'where':{}};var _0x300fbd={};var _0x55be33={'count':0x0,'rows':[]};return db[_0x0874('0x4a')][_0x0874('0x81')]({'where':{'id':_0xdc2f83['params']['id']}})[_0x0874('0x11')](handleEntityNotFound(_0x49efb6,null))['then'](function(_0x42aa93){if(_0x42aa93){_0x300fbd[_0x0874('0x50')]=_[_0x0874('0x61')](db[_0x0874('0x9c')][_0x0874('0x62')]);_0x300fbd[_0x0874('0x4d')]=_['keys'](_0xdc2f83['query']);_0x300fbd['filters']=_[_0x0874('0x4f')](_0x300fbd[_0x0874('0x50')],_0x300fbd['query']);_0x520ad7[_0x0874('0x51')]=_['intersection'](_0x300fbd[_0x0874('0x50')],qs[_0x0874('0x52')](_0xdc2f83[_0x0874('0x4d')][_0x0874('0x52')]));_0x520ad7[_0x0874('0x51')]=_0x520ad7['attributes']['length']?_0x520ad7[_0x0874('0x51')]:_0x300fbd[_0x0874('0x50')];if(!_0xdc2f83[_0x0874('0x4d')][_0x0874('0x6e')](_0x0874('0x6f'))){_0x520ad7['limit']=qs[_0x0874('0x20')](_0xdc2f83[_0x0874('0x4d')][_0x0874('0x20')]);_0x520ad7['offset']=qs[_0x0874('0x1e')](_0xdc2f83[_0x0874('0x4d')][_0x0874('0x1e')]);}_0x520ad7[_0x0874('0x70')]=qs[_0x0874('0x54')](_0xdc2f83['query'][_0x0874('0x54')]);_0x520ad7['where']=qs[_0x0874('0x4e')](_[_0x0874('0x55')](_0xdc2f83[_0x0874('0x4d')],_0x300fbd['filters']));_0x520ad7[_0x0874('0x57')][_0x0874('0x6b')]=_0x42aa93['id'];if(_0xdc2f83[_0x0874('0x4d')]['filter']){_0x520ad7[_0x0874('0x57')]=_[_0x0874('0x58')](_0x520ad7['where'],{'$or':_[_0x0874('0x49')](_0x520ad7[_0x0874('0x51')],function(_0x33390b){var _0x33687b={};_0x33687b[_0x33390b]={'$like':'%'+_0xdc2f83[_0x0874('0x4d')][_0x0874('0x56')]+'%'};return _0x33687b;})});}if(_0xdc2f83[_0x0874('0x4d')]['$gte']){var _0xc9c924=_0xdc2f83['query'][_0x0874('0x9d')][_0x0874('0x9e')](',');var _0x45ee07={};_0x45ee07[_0xc9c924[0x0]]={'$gte':moment(_0xc9c924[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x520ad7[_0x0874('0x57')]=_['merge'](_0x520ad7[_0x0874('0x57')],_0x45ee07);}_0x520ad7=_[_0x0874('0x58')]({},_0x520ad7,_0xdc2f83[_0x0874('0x5a')]);return db['MailMessage'][_0x0874('0x21')]({'where':_0x520ad7[_0x0874('0x57')]})[_0x0874('0x11')](function(_0x20794e){_0x55be33[_0x0874('0x21')]=_0x20794e;if(_0xdc2f83[_0x0874('0x4d')][_0x0874('0x5b')]){_0x520ad7[_0x0874('0x71')]=[{'all':!![]}];}return db[_0x0874('0x9c')]['findAll'](_0x520ad7);})[_0x0874('0x11')](function(_0x16ac9c){if(_0xdc2f83[_0x0874('0x4d')][_0x0874('0x9f')]===_0x0874('0xa0')){for(var _0x40c1ba=0x0;_0x40c1ba<_0x16ac9c[_0x0874('0x53')];_0x40c1ba++){_0x16ac9c[_0x40c1ba][_0x0874('0x65')]=juice(_0x16ac9c[_0x40c1ba][_0x0874('0x65')]);}}_0x55be33[_0x0874('0x72')]=_0x16ac9c;return _0x55be33;});}})[_0x0874('0x11')](respondWithFilteredResult(_0x49efb6,_0x520ad7))[_0x0874('0x5d')](handleError(_0x49efb6,null));};exports[_0x0874('0xa1')]=function(_0x6ceb3d,_0x46561e){var _0xdd1da4,_0x29210c={},_0x1763f2;if(_0x6ceb3d[_0x0874('0x65')]['to']){_0x1763f2=_0x6ceb3d[_0x0874('0x65')]['to']['split'](',')[0x0];}return db[_0x0874('0x4a')][_0x0874('0x63')]({'where':{'id':_0x6ceb3d['params']['id']},'include':[{'model':db[_0x0874('0xa2')],'as':'List','include':[{'model':db[_0x0874('0x8b')],'as':'Contacts','where':{'email':_0x1763f2},'limit':0x1,'order':[[_0x0874('0xa3'),_0x0874('0xa4')]]}]},{'model':db[_0x0874('0x60')],'as':_0x0874('0x45'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x0874('0xa5'),'raw':!![]}]}]})[_0x0874('0x11')](handleEntityNotFound(_0x46561e,null))[_0x0874('0x11')](function(_0xfbbb17){if(!_0xfbbb17)return;_0xdd1da4=_0xfbbb17;if(!_0xfbbb17['Smtp'])throw new Error('Smtp\x20configuration\x20not\x20found');if(_['isNil'](_0x6ceb3d[_0x0874('0x65')]['from'])){_0x6ceb3d['body'][_0x0874('0xa6')]=util[_0x0874('0xa7')](_0x0874('0xa8'),_0xfbbb17[_0x0874('0x2b')],_0xfbbb17[_0x0874('0x77')]||_0xfbbb17[_0x0874('0x45')][_0x0874('0x41')]);}if(_0x6ceb3d[_0x0874('0x65')][_0x0874('0xa9')]&&_0x6ceb3d[_0x0874('0x65')]['attachments'][_0x0874('0x53')]){for(var _0x2e7afd=0x0;_0x2e7afd<_0x6ceb3d[_0x0874('0x65')][_0x0874('0xa9')][_0x0874('0x53')];_0x2e7afd+=0x1){_0x6ceb3d['body'][_0x0874('0xa9')][_0x2e7afd]={'filename':_0x6ceb3d[_0x0874('0x65')][_0x0874('0xa9')][_0x2e7afd]['name'],'path':path[_0x0874('0xaa')](config[_0x0874('0xab')],_0x0874('0xac'),_0x6ceb3d[_0x0874('0x65')]['attachments'][_0x2e7afd][_0x0874('0xad')])};}}var _0x169f87=_0xfbbb17['getSmtpOptions']();return respondWithRpcPromise(_0x0874('0xae'),'sendMail',{'account':_0x169f87,'message':_0x6ceb3d['body']});})[_0x0874('0x11')](function(_0x407673){if(!_0x407673)return;_0x29210c=_0x407673;if(!_0xdd1da4[_0x0874('0xaf')])throw new Error('List\x20not\x20found');if(_0xdd1da4[_0x0874('0xaf')][_0x0874('0xb0')][_0x0874('0x53')])return _0xdd1da4[_0x0874('0xaf')][_0x0874('0xb0')][0x0];return db[_0x0874('0x8b')][_0x0874('0x6c')](_['defaults'](_0x6ceb3d[_0x0874('0x65')],{'firstName':_0x6ceb3d[_0x0874('0x65')]['to'],'email':_0x6ceb3d[_0x0874('0x65')]['to'],'phone':_0x6ceb3d['body']['to'],'ListId':_0xdd1da4[_0x0874('0xb1')]}));})[_0x0874('0x11')](function(_0x168222){if(!_0x168222)return;var _0x141450={'UserId':_0x6ceb3d[_0x0874('0x41')]['id'],'ContactId':_0x168222['id'],'MailAccountId':_0xdd1da4['id'],'inReplyTo':_0x29210c[_0x0874('0xb2')],'to':_0x6ceb3d[_0x0874('0x65')][_0x0874('0xa6')],'cc':_0x6ceb3d[_0x0874('0x65')]['cc'],'subject':_0x6ceb3d[_0x0874('0x65')][_0x0874('0xb3')],'attach':_0x6ceb3d[_0x0874('0x65')][_0x0874('0xb4')],'firstMsgDirection':_0x0874('0xb5'),'lastMsgAt':moment()[_0x0874('0xa7')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_[_0x0874('0x58')](_0x6ceb3d[_0x0874('0x65')],{'messageId':_0x29210c[_0x0874('0xb2')],'sentAt':moment()[_0x0874('0xa7')](_0x0874('0xb6')),'read':!![],'MailAccountId':_0xdd1da4['id'],'UserId':_0x6ceb3d[_0x0874('0x41')]['id'],'ContactId':_0x168222['id']})]};if(_0x6ceb3d[_0x0874('0x65')][_0x0874('0xb7')]){_0x141450=_[_0x0874('0x58')](_0x141450,_0x6ceb3d[_0x0874('0x65')][_0x0874('0xb7')]);}return db[_0x0874('0x89')]['create'](_0x141450,{'include':[{'model':db[_0x0874('0x9c')],'as':'Messages'}]});})[_0x0874('0x11')](respondWithResult(_0x46561e,null))[_0x0874('0x5d')](handleError(_0x46561e,null));};exports['verifySmtp']=function(_0x4b688e,_0x1538a2){return db[_0x0874('0x4a')][_0x0874('0x63')]({'where':{'id':_0x4b688e[_0x0874('0x5f')]['id']},'include':[{'model':db[_0x0874('0x60')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x0874('0xa5')],'as':_0x0874('0xa5'),'raw':!![]}]}]})[_0x0874('0x11')](handleEntityNotFound(_0x1538a2,null))[_0x0874('0x11')](function(_0x307e84){if(!_0x307e84[_0x0874('0x45')])return;var _0x49e651=_0x307e84[_0x0874('0xb8')]();return respondWithRpcPromise(_0x0874('0xb9'),_0x0874('0xba'),{'account':_0x49e651});})[_0x0874('0x11')](respondWithResult(_0x1538a2,null))[_0x0874('0x5d')](handleError(_0x1538a2,null));};exports['destroy']=function(_0x17c2d4,_0x254a72){return db[_0x0874('0x4a')]['find']({'where':{'id':_0x17c2d4[_0x0874('0x5f')]['id']}})[_0x0874('0x11')](handleEntityNotFound(_0x254a72,null))[_0x0874('0x11')](function(_0x4b743a){if(_0x4b743a&&_0x4b743a[_0x0874('0x40')]){throw new db[(_0x0874('0xbb'))][(_0x0874('0xbc'))](_0x0874('0xbd'));}return _0x4b743a;})[_0x0874('0x11')](removeEntity(_0x254a72,null))[_0x0874('0x5d')](handleError(_0x254a72,null));};exports['addAgents']=function(_0x258d8f,_0x20eee3){return db[_0x0874('0x4a')][_0x0874('0x63')]({'where':{'id':_0x258d8f['params']['id']}})[_0x0874('0x11')](handleEntityNotFound(_0x20eee3,null))['then'](function(_0x4c70b7){if(_0x4c70b7){return _0x4c70b7['addAgents'](_0x258d8f[_0x0874('0x65')][_0x0874('0x73')],_[_0x0874('0xbe')](_0x258d8f['body'],['ids','id'])||{})[_0x0874('0xbf')](function(_0x142739){for(var _0x218b63=0x0;_0x218b63<_0x258d8f['body'][_0x0874('0x73')]['length'];_0x218b63+=0x1){socket['emit'](_0x0874('0xc0'),{'UserId':Number(_0x258d8f[_0x0874('0x65')]['ids'][_0x218b63]),'MailAccountId':Number(_0x258d8f[_0x0874('0x5f')]['id'])});}return _0x142739;});}})[_0x0874('0x11')](respondWithResult(_0x20eee3,null))[_0x0874('0x5d')](handleError(_0x20eee3,null));};exports[_0x0874('0xc1')]=function(_0x5cbbe4,_0x302a80){return db['MailAccount']['find']({'where':{'id':_0x5cbbe4[_0x0874('0x5f')]['id']}})[_0x0874('0x11')](handleEntityNotFound(_0x302a80,null))['then'](function(_0x5b0902){if(_0x5b0902){return _0x5b0902[_0x0874('0xc1')](_0x5cbbe4[_0x0874('0x4d')][_0x0874('0x73')])['then'](function(){if(_[_0x0874('0xc2')](_0x5cbbe4[_0x0874('0x4d')]['ids'])){for(var _0xeee8ba=0x0;_0xeee8ba<_0x5cbbe4[_0x0874('0x4d')][_0x0874('0x73')][_0x0874('0x53')];_0xeee8ba+=0x1){socket['emit'](_0x0874('0xc3'),{'UserId':Number(_0x5cbbe4[_0x0874('0x4d')]['ids'][_0xeee8ba]),'MailAccountId':Number(_0x5cbbe4[_0x0874('0x5f')]['id'])});}}else{socket[_0x0874('0xc4')]('userMailAccount:remove',{'UserId':Number(_0x5cbbe4[_0x0874('0x4d')]['ids']),'MailAccountId':Number(_0x5cbbe4[_0x0874('0x5f')]['id'])});}});}})[_0x0874('0x11')](respondWithStatusCode(_0x302a80,null))[_0x0874('0x5d')](handleError(_0x302a80,null));};exports[_0x0874('0xc5')]=function(_0x55e71f,_0x5531c0){var _0x17904e={};var _0x42e598={};var _0x3709cf;var _0x59695e;return db['MailAccount'][_0x0874('0x81')]({'where':{'id':_0x55e71f['params']['id']}})['then'](handleEntityNotFound(_0x5531c0,null))[_0x0874('0x11')](function(_0x5d8e5c){if(_0x5d8e5c){_0x3709cf=_0x5d8e5c;_0x42e598['model']=_[_0x0874('0x61')](db[_0x0874('0x8d')][_0x0874('0x62')]);_0x42e598[_0x0874('0x4d')]=_[_0x0874('0x61')](_0x55e71f['query']);_0x42e598[_0x0874('0x4e')]=_[_0x0874('0x4f')](_0x42e598[_0x0874('0x50')],_0x42e598['query']);_0x17904e[_0x0874('0x51')]=_[_0x0874('0x4f')](_0x42e598[_0x0874('0x50')],qs[_0x0874('0x52')](_0x55e71f['query'][_0x0874('0x52')]));_0x17904e['attributes']=_0x17904e[_0x0874('0x51')][_0x0874('0x53')]?_0x17904e[_0x0874('0x51')]:_0x42e598[_0x0874('0x50')];_0x17904e[_0x0874('0x70')]=qs[_0x0874('0x54')](_0x55e71f['query'][_0x0874('0x54')]);_0x17904e[_0x0874('0x57')]=qs['filters'](_[_0x0874('0x55')](_0x55e71f['query'],_0x42e598['filters']));if(_0x55e71f[_0x0874('0x4d')][_0x0874('0x56')]){_0x17904e[_0x0874('0x57')]=_[_0x0874('0x58')](_0x17904e[_0x0874('0x57')],{'$or':_[_0x0874('0x49')](_0x17904e['attributes'],function(_0x3151ff){var _0x535e46={};_0x535e46[_0x3151ff]={'$like':'%'+_0x55e71f[_0x0874('0x4d')][_0x0874('0x56')]+'%'};return _0x535e46;})});}_0x17904e=_[_0x0874('0x58')]({},_0x17904e,_0x55e71f[_0x0874('0x5a')]);return _0x3709cf['getAgents'](_0x17904e);}})['then'](function(_0x2ca08f){if(_0x2ca08f){_0x59695e=_0x2ca08f[_0x0874('0x53')];if(!_0x55e71f[_0x0874('0x4d')][_0x0874('0x6e')](_0x0874('0x6f'))){_0x17904e[_0x0874('0x20')]=qs['limit'](_0x55e71f[_0x0874('0x4d')][_0x0874('0x20')]);_0x17904e['offset']=qs[_0x0874('0x1e')](_0x55e71f[_0x0874('0x4d')]['offset']);}return _0x3709cf['getAgents'](_0x17904e);}})[_0x0874('0x11')](function(_0x251512){if(_0x251512){return _0x251512?{'count':_0x59695e,'rows':_0x251512}:null;}})['then'](respondWithResult(_0x5531c0,null))['catch'](handleError(_0x5531c0,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index c29f705..b3e0f9c 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 _0xd61c=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount'];(function(_0x119078,_0xcd6fb1){var _0x23d755=function(_0x4d93ac){while(--_0x4d93ac){_0x119078['push'](_0x119078['shift']());}};_0x23d755(++_0xcd6fb1);}(_0xd61c,0xb1));var _0xcd61=function(_0x3eb61f,_0x7d044d){_0x3eb61f=_0x3eb61f-0x0;var _0x334350=_0xd61c[_0x3eb61f];return _0x334350;};'use strict';var EventEmitter=require(_0xcd61('0x0'));var MailAccount=require(_0xcd61('0x1'))['db'][_0xcd61('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcd61('0x3'),'afterUpdate':'update','afterDestroy':_0xcd61('0x4')};function emitEvent(_0x244dad){return function(_0x26b81a,_0x3be823,_0x16c4c3){MailAccountEvents[_0xcd61('0x5')](_0x244dad+':'+_0x26b81a['id'],_0x26b81a);MailAccountEvents[_0xcd61('0x5')](_0x244dad,_0x26b81a);_0x16c4c3(null);};}for(var e in events){if(events[_0xcd61('0x6')](e)){var event=events[e];MailAccount[_0xcd61('0x7')](e,emitEvent(event));}}module[_0xcd61('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x0967=['update','remove','emit','hasOwnProperty','hook','exports','events','MailAccount','setMaxListeners','save'];(function(_0xe9ce81,_0x4d48bb){var _0x27c089=function(_0x27a214){while(--_0x27a214){_0xe9ce81['push'](_0xe9ce81['shift']());}};_0x27c089(++_0x4d48bb);}(_0x0967,0x100));var _0x7096=function(_0x352832,_0x5e4af7){_0x352832=_0x352832-0x0;var _0x54013c=_0x0967[_0x352832];return _0x54013c;};'use strict';var EventEmitter=require(_0x7096('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x7096('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7096('0x2')](0x0);var events={'afterCreate':_0x7096('0x3'),'afterUpdate':_0x7096('0x4'),'afterDestroy':_0x7096('0x5')};function emitEvent(_0xe41170){return function(_0x4106a2,_0x2a50e2,_0x4eba77){MailAccountEvents[_0x7096('0x6')](_0xe41170+':'+_0x4106a2['id'],_0x4106a2);MailAccountEvents[_0x7096('0x6')](_0xe41170,_0x4106a2);_0x4eba77(null);};}for(var e in events){if(events[_0x7096('0x7')](e)){var event=events[e];MailAccount[_0x7096('0x8')](e,emitEvent(event));}}module[_0x7096('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 9c30805..2af73be 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 _0x0086=['custom','service','host','port','Smtp','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','data5','user','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider'];(function(_0x280ae7,_0x456fb1){var _0x418b9e=function(_0x4d730d){while(--_0x4d730d){_0x280ae7['push'](_0x280ae7['shift']());}};_0x418b9e(++_0x456fb1);}(_0x0086,0x112));var _0x6008=function(_0x1a83c3,_0x145946){_0x1a83c3=_0x1a83c3-0x0;var _0xf6df70=_0x0086[_0x1a83c3];return _0xf6df70;};'use strict';var attributes=require(_0x6008('0x0'));module[_0x6008('0x1')]=function(_0x39a01f){return _0x39a01f[_0x6008('0x2')](_0x6008('0x3'),attributes,{'tableName':_0x6008('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x7706e4=this;var _0x47ab45={'id':_0x7706e4['id'],'tls':{'rejectUnauthorized':![]}};if(_0x7706e4[_0x6008('0x5')]!==_0x6008('0x6')){_0x47ab45[_0x6008('0x7')]=_0x7706e4[_0x6008('0x5')];}else{_0x47ab45[_0x6008('0x8')]=_0x7706e4['Smtp'][_0x6008('0x8')];_0x47ab45[_0x6008('0x9')]=_0x7706e4[_0x6008('0xa')]['port'];_0x47ab45['secure']=_0x7706e4[_0x6008('0xa')][_0x6008('0xb')];}if(_0x7706e4[_0x6008('0xa')][_0x6008('0xc')]){if(_0x7706e4[_0x6008('0xa')][_0x6008('0xd')]){if(!_0x7706e4['Smtp'][_0x6008('0xe')])throw new Error(_0x6008('0xf'));_0x47ab45[_0x6008('0x10')]={'type':'OAuth2','user':_0x7706e4['Smtp']['user'],'accessToken':_0x7706e4[_0x6008('0xa')][_0x6008('0xe')][_0x6008('0x11')]};}else{_0x47ab45['auth']={'user':_0x7706e4[_0x6008('0xa')][_0x6008('0x12')],'pass':_0x7706e4['Smtp'][_0x6008('0x13')]};}}return _0x47ab45;}}});}; \ No newline at end of file +var _0x8abc=['data5','auth','user','pass','./mailAccount.attributes','mail_accounts','provider','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x8abc,0x18a));var _0xc8ab=function(_0x1928b0,_0x376040){_0x1928b0=_0x1928b0-0x0;var _0x259304=_0x8abc[_0x1928b0];return _0x259304;};'use strict';var attributes=require(_0xc8ab('0x0'));module['exports']=function(_0x4f9921){return _0x4f9921['define']('MailAccount',attributes,{'tableName':_0xc8ab('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x5204a0=this;var _0x90924d={'id':_0x5204a0['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5204a0[_0xc8ab('0x2')]!=='custom'){_0x90924d['service']=_0x5204a0[_0xc8ab('0x2')];}else{_0x90924d[_0xc8ab('0x3')]=_0x5204a0['Smtp'][_0xc8ab('0x3')];_0x90924d['port']=_0x5204a0[_0xc8ab('0x4')][_0xc8ab('0x5')];_0x90924d[_0xc8ab('0x6')]=_0x5204a0['Smtp'][_0xc8ab('0x6')];}if(_0x5204a0[_0xc8ab('0x4')][_0xc8ab('0x7')]){if(_0x5204a0[_0xc8ab('0x4')][_0xc8ab('0x8')]){if(!_0x5204a0['Smtp'][_0xc8ab('0x9')])throw new Error(_0xc8ab('0xa'));_0x90924d['auth']={'type':'OAuth2','user':_0x5204a0['Smtp']['user'],'accessToken':_0x5204a0[_0xc8ab('0x4')][_0xc8ab('0x9')][_0xc8ab('0xb')]};}else{_0x90924d[_0xc8ab('0xc')]={'user':_0x5204a0['Smtp'][_0xc8ab('0xd')],'pass':_0x5204a0[_0xc8ab('0x4')][_0xc8ab('0xe')]};}}return _0x90924d;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 573409f..36d0530 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 _0xda2d=['CloudProvider','List','get','Applications','getSmtpOptions','list','applications','orderBy','priority','asc','autoclose','push','length','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','format','interaction','originTo','originCc','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','attributes','limit','include','map','model','debug','ShowMailAccount','find','where','setDataValue','smtpOptions','mail','difference','keys','CmContact','rawAttributes','updatedAt','ListId','body','isNil','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','account','CmList','Contacts','MailApplication','MailServerOut'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xda2d,0x102));var _0xdda2=function(_0x400b92,_0x57adbf){_0x400b92=_0x400b92-0x0;var _0x4292ac=_0xda2d[_0x400b92];return _0x4292ac;};'use strict';var _=require('lodash');var moment=require(_0xdda2('0x0'));var BPromise=require(_0xdda2('0x1'));var rs=require(_0xdda2('0x2'));var Redis=require(_0xdda2('0x3'));var db=require(_0xdda2('0x4'))['db'];var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xdda2('0x5'));var client=jayson[_0xdda2('0x6')][_0xdda2('0x7')]({'port':0x232c});config[_0xdda2('0x8')]=_[_0xdda2('0x9')](config[_0xdda2('0x8')],{'host':_0xdda2('0xa'),'port':0x18eb});var socket=require(_0xdda2('0xb'))(new Redis(config[_0xdda2('0x8')]));require(_0xdda2('0xc'))['register'](socket);function respondWithRpcPromise(_0x1a774e,_0x22c6e5,_0x4df6b8){return new BPromise(function(_0x1c11b2,_0x2f3454){return client[_0xdda2('0xd')](_0x1a774e,_0x4df6b8)[_0xdda2('0xe')](function(_0x171123){logger[_0xdda2('0xf')](_0xdda2('0x10'),_0x22c6e5,_0xdda2('0x11'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x22c6e5,'request\x20sent',JSON[_0xdda2('0x12')](_0x171123));if(_0x171123[_0xdda2('0x13')]){if(_0x171123[_0xdda2('0x13')][_0xdda2('0x14')]===0x1f4){logger[_0xdda2('0x13')](_0xdda2('0x10'),_0x22c6e5,_0x171123[_0xdda2('0x13')]['message']);return _0x2f3454(_0x171123[_0xdda2('0x13')]['message']);}logger[_0xdda2('0x13')](_0xdda2('0x10'),_0x22c6e5,_0x171123[_0xdda2('0x13')][_0xdda2('0x15')]);return _0x1c11b2(_0x171123[_0xdda2('0x13')]['message']);}else{logger['info'](_0xdda2('0x10'),_0x22c6e5,'request\x20sent');_0x1c11b2(_0x171123[_0xdda2('0x16')][_0xdda2('0x15')]);}})[_0xdda2('0x17')](function(_0x2b6ee8){logger[_0xdda2('0x13')](_0xdda2('0x10'),_0x22c6e5,_0x2b6ee8);_0x2f3454(_0x2b6ee8);});});}exports[_0xdda2('0x18')]=function(_0x351151){var _0x3c02a4=this;return new Promise(function(_0x337b0b,_0x312ef1){return db[_0xdda2('0x19')]['findAll']({'raw':_0x351151[_0xdda2('0x1a')]?_0x351151['options'][_0xdda2('0x1b')]===undefined?!![]:![]:!![],'where':_0x351151[_0xdda2('0x1a')]?_0x351151[_0xdda2('0x1a')]['where']||null:null,'attributes':_0x351151[_0xdda2('0x1a')]?_0x351151['options'][_0xdda2('0x1c')]||null:null,'limit':_0x351151[_0xdda2('0x1a')]?_0x351151['options'][_0xdda2('0x1d')]||null:null,'include':_0x351151[_0xdda2('0x1a')]?_0x351151[_0xdda2('0x1a')][_0xdda2('0x1e')]?_[_0xdda2('0x1f')](_0x351151['options'][_0xdda2('0x1e')],function(_0x4be5ea){return{'model':db[_0x4be5ea[_0xdda2('0x20')]],'as':_0x4be5ea['as'],'attributes':_0x4be5ea[_0xdda2('0x1c')],'include':_0x4be5ea['include']?_['map'](_0x4be5ea[_0xdda2('0x1e')],function(_0x4567e7){return{'model':db[_0x4567e7[_0xdda2('0x20')]],'as':_0x4567e7['as'],'attributes':_0x4567e7['attributes'],'include':_0x4567e7[_0xdda2('0x1e')]?_[_0xdda2('0x1f')](_0x4567e7[_0xdda2('0x1e')],function(_0xe53dee){return{'model':db[_0xe53dee[_0xdda2('0x20')]],'as':_0xe53dee['as'],'attributes':_0xe53dee[_0xdda2('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24c37d){logger[_0xdda2('0xf')]('GetMailAccount',_0x351151);logger[_0xdda2('0x21')](_0xdda2('0x18'),_0x351151,JSON[_0xdda2('0x12')](_0x24c37d));_0x337b0b(_0x24c37d);})[_0xdda2('0x17')](function(_0x5540e5){logger[_0xdda2('0x13')](_0xdda2('0x18'),_0x5540e5['message'],_0x351151);_0x312ef1(_0x3c02a4[_0xdda2('0x13')](0x1f4,_0x5540e5['message']));});});};exports[_0xdda2('0x22')]=function(_0x55809a){var _0x53ff76=this;return new Promise(function(_0x510b7b,_0x239c25){return db['MailAccount'][_0xdda2('0x23')]({'raw':_0x55809a['options']?_0x55809a['options']['raw']===undefined?!![]:![]:!![],'where':_0x55809a[_0xdda2('0x1a')]?_0x55809a[_0xdda2('0x1a')][_0xdda2('0x24')]||null:null,'attributes':_0x55809a[_0xdda2('0x1a')]?_0x55809a[_0xdda2('0x1a')][_0xdda2('0x1c')]||null:null,'include':_0x55809a[_0xdda2('0x1a')]?_0x55809a[_0xdda2('0x1a')][_0xdda2('0x1e')]?_[_0xdda2('0x1f')](_0x55809a['options'][_0xdda2('0x1e')],function(_0x4212da){return{'model':db[_0x4212da[_0xdda2('0x20')]],'as':_0x4212da['as'],'attributes':_0x4212da[_0xdda2('0x1c')],'include':_0x4212da[_0xdda2('0x1e')]?_[_0xdda2('0x1f')](_0x4212da[_0xdda2('0x1e')],function(_0x5835cd){return{'model':db[_0x5835cd['model']],'as':_0x5835cd['as'],'attributes':_0x5835cd[_0xdda2('0x1c')],'include':_0x5835cd[_0xdda2('0x1e')]?_[_0xdda2('0x1f')](_0x5835cd['include'],function(_0x54e211){return{'model':db[_0x54e211[_0xdda2('0x20')]],'as':_0x54e211['as'],'attributes':_0x54e211[_0xdda2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdda2('0xe')](function(_0x11f1f6){if(_0x55809a[_0xdda2('0x1a')]['smtp']===!![])_0x11f1f6[_0xdda2('0x25')](_0xdda2('0x26'),_0x11f1f6['getSmtpOptions']());logger['info'](_0xdda2('0x22'),_0x55809a);logger[_0xdda2('0x21')](_0xdda2('0x22'),_0x55809a,JSON[_0xdda2('0x12')](_0x11f1f6));_0x510b7b(_0x11f1f6);})[_0xdda2('0x17')](function(_0x585eba){logger[_0xdda2('0x13')](_0xdda2('0x22'),_0x585eba[_0xdda2('0x15')],_0x55809a);_0x239c25(_0x53ff76[_0xdda2('0x13')](0x1f4,_0x585eba['message']));});});};exports['NotifyMailAccount']=function(_0x203972){var _0x2e0524=this;return new Promise(function(_0x7a25fe,_0x5a92e9){var _0x1bb2a7={'body':_0x203972['body'],'channel':_0xdda2('0x27')};var _0x4c68d7=_[_0xdda2('0x28')](_[_0xdda2('0x29')](db[_0xdda2('0x2a')][_0xdda2('0x2b')]),['createdAt',_0xdda2('0x2c'),'CompanyId',_0xdda2('0x2d')]);var _0x4d3b78=![];if(_0x203972[_0xdda2('0x2e')]['id']){delete _0x203972[_0xdda2('0x2e')]['id'];}if(_[_0xdda2('0x2f')](_0x203972[_0xdda2('0x2e')][_0xdda2('0x30')])){return _0x5a92e9(_0x2e0524['error'](0x1f4,_0xdda2('0x31')));}if(_[_0xdda2('0x2f')](_0x203972['body'][_0xdda2('0x2e')])||_0x203972['body'][_0xdda2('0x2e')]===''){return _0x5a92e9(_0x2e0524[_0xdda2('0x13')](0x1f4,_0xdda2('0x32')));}if(_[_0xdda2('0x2f')](_0x203972[_0xdda2('0x2e')][_0xdda2('0x33')])){return _0x5a92e9(_0x2e0524[_0xdda2('0x13')](0x1f4,_0xdda2('0x34')+_0x4c68d7));}if(!_[_0xdda2('0x35')](_0x4c68d7,_0x203972[_0xdda2('0x2e')][_0xdda2('0x33')])){return _0x5a92e9(_0x2e0524[_0xdda2('0x13')](0x1f4,_0xdda2('0x36')+_0x4c68d7));}var _0x4d22b3={};_0x4d22b3[_0x203972['body']['mapKey']]=_0x203972[_0xdda2('0x2e')][_0xdda2('0x30')];return db['MailAccount'][_0xdda2('0x23')]({'where':{'id':_0x203972[_0xdda2('0x37')]['id']},'include':[{'model':db[_0xdda2('0x38')],'as':'List','include':[{'model':db[_0xdda2('0x2a')],'as':_0xdda2('0x39'),'where':_0x4d22b3,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xdda2('0x3a')],'as':'Applications'},{'model':db[_0xdda2('0x3b')],'as':'Smtp','include':[{'model':db[_0xdda2('0x3c')],'as':_0xdda2('0x3c')}]}]})['then'](function(_0x585665){if(_0x585665&&_0x585665[_0xdda2('0x3d')]){var _0x413f8a=_0x585665[_0xdda2('0x3e')]({'plain':!![]});_0x1bb2a7[_0xdda2('0x37')]=_['omit'](_0x413f8a,[_0xdda2('0x3f'),_0xdda2('0x3d')]);_0x1bb2a7[_0xdda2('0x37')][_0xdda2('0x26')]=_0x585665[_0xdda2('0x40')]();_0x1bb2a7['applications']=_0x413f8a[_0xdda2('0x3f')];_0x1bb2a7[_0xdda2('0x41')]=_0x413f8a['List'];_0x1bb2a7[_0xdda2('0x42')]=_[_0xdda2('0x43')](_0x1bb2a7[_0xdda2('0x42')],[_0xdda2('0x44')],[_0xdda2('0x45')]);if(_0x1bb2a7[_0xdda2('0x37')]&&_0x1bb2a7['account'][_0xdda2('0x46')]){_0x1bb2a7['applications'][_0xdda2('0x47')]({'id':0x0,'priority':_0x1bb2a7['applications'][_0xdda2('0x48')]+0x1,'app':'close','appdata':_0xdda2('0x46'),'interval':_0xdda2('0x49')});}if(_0x1bb2a7[_0xdda2('0x37')][_0xdda2('0x3f')]){delete _0x1bb2a7[_0xdda2('0x37')][_0xdda2('0x3f')];}if(_0x1bb2a7[_0xdda2('0x37')][_0xdda2('0x3d')]){delete _0x1bb2a7['account'][_0xdda2('0x3d')];}if(_0x413f8a[_0xdda2('0x3d')][_0xdda2('0x39')]['length']){return _0x413f8a[_0xdda2('0x3d')][_0xdda2('0x39')][0x0];}var _0x56ddf2=_[_0xdda2('0x9')](_0x203972['body'],{'firstName':_0x203972[_0xdda2('0x2e')][_0xdda2('0x30')],'ListId':_0x413f8a[_0xdda2('0x2d')]});_0x56ddf2[_0x203972[_0xdda2('0x2e')][_0xdda2('0x33')]]=_0x203972['body']['from'];return db['CmContact'][_0xdda2('0x4a')](_0x56ddf2);}else{throw new Error(_0xdda2('0x4b'));}})['then'](function(_0x44637d){_0x1bb2a7[_0xdda2('0x4c')]=_0x44637d;if(_0x44637d){if(!_0x203972[_0xdda2('0x2e')]['message'][_0xdda2('0x4d')]){_0x203972[_0xdda2('0x2e')][_0xdda2('0x15')]['messageId']=rs[_0xdda2('0x4e')]()+'\x20'+_0x203972[_0xdda2('0x2e')][_0xdda2('0x15')][_0xdda2('0x30')];}var _0x5d8602={'ContactId':_0x44637d['id'],'MailAccountId':_0x203972[_0xdda2('0x37')]['id'],'inReplyTo':_0x203972['body']['message']['messageId'],'to':_0x203972[_0xdda2('0x2e')][_0xdda2('0x15')][_0xdda2('0x30')],'cc':_0x203972[_0xdda2('0x2e')][_0xdda2('0x15')]['cc'],'subject':_0x203972[_0xdda2('0x2e')][_0xdda2('0x15')][_0xdda2('0x4f')],'attach':_0x203972[_0xdda2('0x2e')][_0xdda2('0x15')][_0xdda2('0x50')],'lastMsgAt':moment()['format'](_0xdda2('0x51')),'lastMsgDirection':'in'};return db[_0xdda2('0x52')][_0xdda2('0x23')]({'where':{'closed':![],'MailAccountId':_0x203972[_0xdda2('0x37')]['id']},'include':[{'model':db[_0xdda2('0x53')],'as':_0xdda2('0x54'),'attributes':[_0xdda2('0x4d')],'where':{'messageId':_0x203972['body'][_0xdda2('0x15')][_0xdda2('0x55')]}}]})[_0xdda2('0xe')](function(_0xe8d81a){if(_0xe8d81a){return[_0xe8d81a,![]];}return db[_0xdda2('0x52')]['create'](_0x5d8602)[_0xdda2('0xe')](function(_0x145d45){return[_0x145d45,!![]];});});}else{throw new Error(_0xdda2('0x56'));}})[_0xdda2('0x57')](function(_0x21d0e4,_0x4a6f28){if(_0x21d0e4){_0x4d3b78=_0x4a6f28;if(!_0x4a6f28){return _0x21d0e4[_0xdda2('0x58')]({'inReplyTo':_0x203972[_0xdda2('0x2e')][_0xdda2('0x15')][_0xdda2('0x4d')],'to':_0x203972[_0xdda2('0x2e')]['message'][_0xdda2('0x30')],'cc':_0x203972[_0xdda2('0x2e')][_0xdda2('0x15')]['cc'],'subject':_0x203972['body'][_0xdda2('0x15')]['subject'],'attach':_0x21d0e4[_0xdda2('0x50')]?_0x21d0e4[_0xdda2('0x50')]:_0x203972[_0xdda2('0x2e')]['message'][_0xdda2('0x50')],'substatus':null,'substatusAt':moment()[_0xdda2('0x59')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0xdda2('0x59')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x21d0e4;}}})[_0xdda2('0xe')](function(_0xc97cb1){_0x1bb2a7[_0xdda2('0x5a')]=_0xc97cb1[_0xdda2('0x3e')]({'plain':!![]});_0x1bb2a7[_0xdda2('0x5a')]['created']=_0x4d3b78;return db['MailMessage'][_0xdda2('0x4a')]({'body':_0x203972[_0xdda2('0x2e')]['body'],'MailAccountId':_0x203972['account']['id'],'MailInteractionId':_0xc97cb1['id'],'direction':'in','ContactId':_0x1bb2a7[_0xdda2('0x4c')]['id'],'messageId':_0x203972['body'][_0xdda2('0x15')][_0xdda2('0x4d')],'from':_0x203972['body'][_0xdda2('0x15')][_0xdda2('0x30')],'to':_0x203972[_0xdda2('0x2e')][_0xdda2('0x15')]['to'],'cc':_0x203972[_0xdda2('0x2e')][_0xdda2('0x15')]['cc'],'subject':_0x203972['body'][_0xdda2('0x15')][_0xdda2('0x4f')],'attach':_0x203972[_0xdda2('0x2e')]['message'][_0xdda2('0x50')],'Attachments':_0x203972[_0xdda2('0x2e')]['message']['attachments'],'originTo':_0x203972[_0xdda2('0x2e')][_0xdda2('0x15')][_0xdda2('0x5b')],'originCc':_0x203972['body']['message'][_0xdda2('0x5c')],'bcc':_0x203972['body'][_0xdda2('0x15')][_0xdda2('0x5d')],'ChatWebsiteId':_0x203972[_0xdda2('0x2e')][_0xdda2('0x15')][_0xdda2('0x5e')]||null,'originChannel':_0x203972[_0xdda2('0x2e')]['message']['originChannel']||_0xdda2('0x5f'),'ChatOfflineMessageId':_0x203972['body'][_0xdda2('0x15')][_0xdda2('0x60')]||null},{'include':[{'model':db[_0xdda2('0x61')],'as':_0xdda2('0x62')}]});})[_0xdda2('0xe')](function(_0x104024){_0x1bb2a7[_0xdda2('0x15')]=_0x104024;if(_0x1bb2a7[_0xdda2('0x5a')][_0xdda2('0x63')]){return db['User'][_0xdda2('0x23')]({'attributes':['id',_0xdda2('0x64')],'where':{'id':_0x1bb2a7[_0xdda2('0x5a')][_0xdda2('0x63')]}})['then'](function(_0x3b535d){if(_0x3b535d){_0x1bb2a7[_0xdda2('0x42')][_0xdda2('0x65')]({'id':0x0,'priority':0x0,'app':_0xdda2('0x66'),'appdata':_0x3b535d['name']+','+(_0x1bb2a7['account'][_0xdda2('0x67')]||0xa),'interval':_0xdda2('0x49')});}return respondWithRpcPromise(_0xdda2('0x68'),_0xdda2('0x69'),_0x1bb2a7);});}return respondWithRpcPromise('Start',_0xdda2('0x69'),_0x1bb2a7);})[_0xdda2('0xe')](function(_0x17656d){_0x7a25fe(_0x17656d);})[_0xdda2('0x17')](function(_0x2dda16){_0x5a92e9(_0x2e0524[_0xdda2('0x13')](0x1f4,_0x2dda16[_0xdda2('0x15')]));});});}; \ No newline at end of file +var _0x57ca=['setDataValue','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','Contacts','updatedAt','DESC','MailApplication','Applications','List','omit','applications','list','orderBy','asc','push','length','close','*,*,*,*','ListId','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','MailInteraction','create','Contact\x20not\x20found','spread','update','interaction','get','created','originCc','bcc','Email','Attachment','Attachments','UserId','User','unshift','name','waitForTheAssignedAgent','startRouting','Start','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailAccount','findAll','options','raw','where','attributes','limit','include','map','model','info','ShowMailAccount','MailAccount','find'];(function(_0x911784,_0x4e1704){var _0x6b9ffe=function(_0x30ac5a){while(--_0x30ac5a){_0x911784['push'](_0x911784['shift']());}};_0x6b9ffe(++_0x4e1704);}(_0x57ca,0x108));var _0xa57c=function(_0x45aa3a,_0x22462b){_0x45aa3a=_0x45aa3a-0x0;var _0x1cd721=_0x57ca[_0x45aa3a];return _0x1cd721;};'use strict';var _=require('lodash');var moment=require(_0xa57c('0x0'));var BPromise=require(_0xa57c('0x1'));var rs=require('randomstring');var Redis=require(_0xa57c('0x2'));var db=require(_0xa57c('0x3'))['db'];var logger=require(_0xa57c('0x4'))(_0xa57c('0x5'));var config=require(_0xa57c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa57c('0x7')][_0xa57c('0x8')]({'port':0x232c});config[_0xa57c('0x9')]=_[_0xa57c('0xa')](config[_0xa57c('0x9')],{'host':_0xa57c('0xb'),'port':0x18eb});var socket=require(_0xa57c('0xc'))(new Redis(config[_0xa57c('0x9')]));require('./mailAccount.socket')[_0xa57c('0xd')](socket);function respondWithRpcPromise(_0x4b51d8,_0x46ba92,_0x932dcc){return new BPromise(function(_0x4fa5ed,_0x156bca){return client['request'](_0x4b51d8,_0x932dcc)[_0xa57c('0xe')](function(_0x44b221){logger['info'](_0xa57c('0xf'),_0x46ba92,'request\x20sent');logger[_0xa57c('0x10')](_0xa57c('0x11'),_0x46ba92,_0xa57c('0x12'),JSON[_0xa57c('0x13')](_0x44b221));if(_0x44b221[_0xa57c('0x14')]){if(_0x44b221['error'][_0xa57c('0x15')]===0x1f4){logger['error'](_0xa57c('0xf'),_0x46ba92,_0x44b221[_0xa57c('0x14')][_0xa57c('0x16')]);return _0x156bca(_0x44b221[_0xa57c('0x14')][_0xa57c('0x16')]);}logger[_0xa57c('0x14')](_0xa57c('0xf'),_0x46ba92,_0x44b221['error'][_0xa57c('0x16')]);return _0x4fa5ed(_0x44b221[_0xa57c('0x14')][_0xa57c('0x16')]);}else{logger['info'](_0xa57c('0xf'),_0x46ba92,'request\x20sent');_0x4fa5ed(_0x44b221[_0xa57c('0x17')][_0xa57c('0x16')]);}})[_0xa57c('0x18')](function(_0xe3d505){logger[_0xa57c('0x14')](_0xa57c('0xf'),_0x46ba92,_0xe3d505);_0x156bca(_0xe3d505);});});}exports[_0xa57c('0x19')]=function(_0x595c7a){var _0x4e4399=this;return new Promise(function(_0x8a8856,_0x4a53ab){return db['MailAccount'][_0xa57c('0x1a')]({'raw':_0x595c7a[_0xa57c('0x1b')]?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x1c')]===undefined?!![]:![]:!![],'where':_0x595c7a['options']?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x1d')]||null:null,'attributes':_0x595c7a[_0xa57c('0x1b')]?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x1e')]||null:null,'limit':_0x595c7a[_0xa57c('0x1b')]?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x1f')]||null:null,'include':_0x595c7a[_0xa57c('0x1b')]?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x20')]?_[_0xa57c('0x21')](_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x20')],function(_0x431bec){return{'model':db[_0x431bec['model']],'as':_0x431bec['as'],'attributes':_0x431bec[_0xa57c('0x1e')],'include':_0x431bec[_0xa57c('0x20')]?_[_0xa57c('0x21')](_0x431bec[_0xa57c('0x20')],function(_0x315ad7){return{'model':db[_0x315ad7[_0xa57c('0x22')]],'as':_0x315ad7['as'],'attributes':_0x315ad7[_0xa57c('0x1e')],'include':_0x315ad7[_0xa57c('0x20')]?_[_0xa57c('0x21')](_0x315ad7[_0xa57c('0x20')],function(_0x57ebe0){return{'model':db[_0x57ebe0[_0xa57c('0x22')]],'as':_0x57ebe0['as'],'attributes':_0x57ebe0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x257661){logger[_0xa57c('0x23')]('GetMailAccount',_0x595c7a);logger[_0xa57c('0x10')](_0xa57c('0x19'),_0x595c7a,JSON[_0xa57c('0x13')](_0x257661));_0x8a8856(_0x257661);})['catch'](function(_0xd779f1){logger['error'](_0xa57c('0x19'),_0xd779f1['message'],_0x595c7a);_0x4a53ab(_0x4e4399[_0xa57c('0x14')](0x1f4,_0xd779f1['message']));});});};exports[_0xa57c('0x24')]=function(_0x532164){var _0x9e02bb=this;return new Promise(function(_0x1d82d9,_0x43c8f3){return db[_0xa57c('0x25')][_0xa57c('0x26')]({'raw':_0x532164[_0xa57c('0x1b')]?_0x532164[_0xa57c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x532164[_0xa57c('0x1b')]?_0x532164['options'][_0xa57c('0x1d')]||null:null,'attributes':_0x532164[_0xa57c('0x1b')]?_0x532164[_0xa57c('0x1b')]['attributes']||null:null,'include':_0x532164[_0xa57c('0x1b')]?_0x532164['options'][_0xa57c('0x20')]?_['map'](_0x532164[_0xa57c('0x1b')]['include'],function(_0x433116){return{'model':db[_0x433116[_0xa57c('0x22')]],'as':_0x433116['as'],'attributes':_0x433116['attributes'],'include':_0x433116[_0xa57c('0x20')]?_['map'](_0x433116[_0xa57c('0x20')],function(_0x5c56d3){return{'model':db[_0x5c56d3[_0xa57c('0x22')]],'as':_0x5c56d3['as'],'attributes':_0x5c56d3[_0xa57c('0x1e')],'include':_0x5c56d3[_0xa57c('0x20')]?_[_0xa57c('0x21')](_0x5c56d3[_0xa57c('0x20')],function(_0x44350f){return{'model':db[_0x44350f['model']],'as':_0x44350f['as'],'attributes':_0x44350f['attributes']};}):[]};}):[]};}):[]:[]})[_0xa57c('0xe')](function(_0x13e390){if(_0x532164[_0xa57c('0x1b')]['smtp']===!![])_0x13e390[_0xa57c('0x27')]('smtpOptions',_0x13e390[_0xa57c('0x28')]());logger[_0xa57c('0x23')]('ShowMailAccount',_0x532164);logger['debug']('ShowMailAccount',_0x532164,JSON[_0xa57c('0x13')](_0x13e390));_0x1d82d9(_0x13e390);})[_0xa57c('0x18')](function(_0x269a19){logger[_0xa57c('0x14')](_0xa57c('0x24'),_0x269a19[_0xa57c('0x16')],_0x532164);_0x43c8f3(_0x9e02bb['error'](0x1f4,_0x269a19[_0xa57c('0x16')]));});});};exports[_0xa57c('0x29')]=function(_0x5a5490){var _0x5ed42d=this;return new Promise(function(_0x5e10b,_0x203375){var _0x5af5e9={'body':_0x5a5490[_0xa57c('0x2a')],'channel':_0xa57c('0x2b')};var _0x2112b7=_[_0xa57c('0x2c')](_[_0xa57c('0x2d')](db[_0xa57c('0x2e')]['rawAttributes']),[_0xa57c('0x2f'),'updatedAt','CompanyId','ListId']);var _0x520383=![];if(_0x5a5490['body']['id']){delete _0x5a5490[_0xa57c('0x2a')]['id'];}if(_[_0xa57c('0x30')](_0x5a5490[_0xa57c('0x2a')]['from'])){return _0x203375(_0x5ed42d['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xa57c('0x30')](_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x2a')])||_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x2a')]===''){return _0x203375(_0x5ed42d[_0xa57c('0x14')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xa57c('0x30')](_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x31')])){return _0x203375(_0x5ed42d[_0xa57c('0x14')](0x1f4,_0xa57c('0x32')+_0x2112b7));}if(!_[_0xa57c('0x33')](_0x2112b7,_0x5a5490['body'][_0xa57c('0x31')])){return _0x203375(_0x5ed42d[_0xa57c('0x14')](0x1f4,_0xa57c('0x34')+_0x2112b7));}var _0x14e943={};_0x14e943[_0x5a5490[_0xa57c('0x2a')]['mapKey']]=_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x35')];return db[_0xa57c('0x25')][_0xa57c('0x26')]({'where':{'id':_0x5a5490[_0xa57c('0x36')]['id']},'include':[{'model':db[_0xa57c('0x37')],'as':'List','include':[{'model':db[_0xa57c('0x2e')],'as':_0xa57c('0x38'),'where':_0x14e943,'limit':0x1,'order':[[_0xa57c('0x39'),_0xa57c('0x3a')]]}]},{'model':db[_0xa57c('0x3b')],'as':_0xa57c('0x3c')},{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})[_0xa57c('0xe')](function(_0x49492f){if(_0x49492f&&_0x49492f[_0xa57c('0x3d')]){var _0xae87=_0x49492f['get']({'plain':!![]});_0x5af5e9[_0xa57c('0x36')]=_[_0xa57c('0x3e')](_0xae87,[_0xa57c('0x3c'),_0xa57c('0x3d')]);_0x5af5e9[_0xa57c('0x36')]['smtpOptions']=_0x49492f[_0xa57c('0x28')]();_0x5af5e9[_0xa57c('0x3f')]=_0xae87[_0xa57c('0x3c')];_0x5af5e9[_0xa57c('0x40')]=_0xae87[_0xa57c('0x3d')];_0x5af5e9['applications']=_[_0xa57c('0x41')](_0x5af5e9['applications'],['priority'],[_0xa57c('0x42')]);if(_0x5af5e9[_0xa57c('0x36')]&&_0x5af5e9[_0xa57c('0x36')]['autoclose']){_0x5af5e9['applications'][_0xa57c('0x43')]({'id':0x0,'priority':_0x5af5e9[_0xa57c('0x3f')][_0xa57c('0x44')]+0x1,'app':_0xa57c('0x45'),'appdata':'autoclose','interval':_0xa57c('0x46')});}if(_0x5af5e9[_0xa57c('0x36')][_0xa57c('0x3c')]){delete _0x5af5e9['account']['Applications'];}if(_0x5af5e9[_0xa57c('0x36')][_0xa57c('0x3d')]){delete _0x5af5e9['account'][_0xa57c('0x3d')];}if(_0xae87[_0xa57c('0x3d')][_0xa57c('0x38')][_0xa57c('0x44')]){return _0xae87[_0xa57c('0x3d')][_0xa57c('0x38')][0x0];}var _0x4fc413=_['defaults'](_0x5a5490['body'],{'firstName':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x35')],'ListId':_0xae87[_0xa57c('0x47')]});_0x4fc413[_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x31')]]=_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x35')];return db[_0xa57c('0x2e')]['create'](_0x4fc413);}else{throw new Error('List\x20not\x20found');}})[_0xa57c('0xe')](function(_0x4e18ad){_0x5af5e9[_0xa57c('0x48')]=_0x4e18ad;if(_0x4e18ad){if(!_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['messageId']){_0x5a5490[_0xa57c('0x2a')]['message'][_0xa57c('0x49')]=rs['generate']()+'\x20'+_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x35')];}var _0x26a8e1={'ContactId':_0x4e18ad['id'],'MailAccountId':_0x5a5490['account']['id'],'inReplyTo':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x49')],'to':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['from'],'cc':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['cc'],'subject':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4a')],'attach':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4b')],'lastMsgAt':moment()[_0xa57c('0x4c')](_0xa57c('0x4d')),'lastMsgDirection':'in'};return db['MailInteraction'][_0xa57c('0x26')]({'where':{'closed':![],'MailAccountId':_0x5a5490[_0xa57c('0x36')]['id']},'include':[{'model':db[_0xa57c('0x4e')],'as':_0xa57c('0x4f'),'attributes':[_0xa57c('0x49')],'where':{'messageId':_0x5a5490[_0xa57c('0x2a')]['message'][_0xa57c('0x50')]}}]})[_0xa57c('0xe')](function(_0x521acc){if(_0x521acc){return[_0x521acc,![]];}return db[_0xa57c('0x51')][_0xa57c('0x52')](_0x26a8e1)[_0xa57c('0xe')](function(_0xa78a75){return[_0xa78a75,!![]];});});}else{throw new Error(_0xa57c('0x53'));}})[_0xa57c('0x54')](function(_0x24efa0,_0x5e1103){if(_0x24efa0){_0x520383=_0x5e1103;if(!_0x5e1103){return _0x24efa0[_0xa57c('0x55')]({'inReplyTo':_0x5a5490['body'][_0xa57c('0x16')]['messageId'],'to':_0x5a5490[_0xa57c('0x2a')]['message'][_0xa57c('0x35')],'cc':_0x5a5490[_0xa57c('0x2a')]['message']['cc'],'subject':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4a')],'attach':_0x24efa0[_0xa57c('0x4b')]?_0x24efa0['attach']:_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4b')],'substatus':null,'substatusAt':moment()[_0xa57c('0x4c')](_0xa57c('0x4d')),'lastMsgAt':moment()[_0xa57c('0x4c')](_0xa57c('0x4d')),'lastMsgDirection':'in'});}else{return _0x24efa0;}}})[_0xa57c('0xe')](function(_0x11c13e){_0x5af5e9[_0xa57c('0x56')]=_0x11c13e[_0xa57c('0x57')]({'plain':!![]});_0x5af5e9[_0xa57c('0x56')][_0xa57c('0x58')]=_0x520383;return db[_0xa57c('0x4e')][_0xa57c('0x52')]({'body':_0x5a5490[_0xa57c('0x2a')]['body'],'MailAccountId':_0x5a5490[_0xa57c('0x36')]['id'],'MailInteractionId':_0x11c13e['id'],'direction':'in','ContactId':_0x5af5e9['contact']['id'],'messageId':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x49')],'from':_0x5a5490['body'][_0xa57c('0x16')][_0xa57c('0x35')],'to':_0x5a5490[_0xa57c('0x2a')]['message']['to'],'cc':_0x5a5490['body'][_0xa57c('0x16')]['cc'],'subject':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4a')],'attach':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4b')],'Attachments':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['attachments'],'originTo':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['originTo'],'originCc':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x59')],'bcc':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x5a')],'ChatWebsiteId':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['ChatWebsiteId']||null,'originChannel':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['originChannel']||_0xa57c('0x5b'),'ChatOfflineMessageId':_0x5a5490[_0xa57c('0x2a')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xa57c('0x5c')],'as':_0xa57c('0x5d')}]});})[_0xa57c('0xe')](function(_0x1604d6){_0x5af5e9[_0xa57c('0x16')]=_0x1604d6;if(_0x5af5e9['interaction'][_0xa57c('0x5e')]){return db[_0xa57c('0x5f')][_0xa57c('0x26')]({'attributes':['id','name'],'where':{'id':_0x5af5e9[_0xa57c('0x56')]['UserId']}})[_0xa57c('0xe')](function(_0x2963cb){if(_0x2963cb){_0x5af5e9[_0xa57c('0x3f')][_0xa57c('0x60')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2963cb[_0xa57c('0x61')]+','+(_0x5af5e9[_0xa57c('0x36')][_0xa57c('0x62')]||0xa),'interval':_0xa57c('0x46')});}return respondWithRpcPromise('Start',_0xa57c('0x63'),_0x5af5e9);});}return respondWithRpcPromise(_0xa57c('0x64'),_0xa57c('0x63'),_0x5af5e9);})['then'](function(_0x3da413){_0x5e10b(_0x3da413);})[_0xa57c('0x18')](function(_0x2ed4f4){_0x203375(_0x5ed42d['error'](0x1f4,_0x2ed4f4[_0xa57c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 9f188db..fda6805 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 _0x7dbc=['./mailAccount.events','save','remove','emit','removeListener','length','mailAccount:'];(function(_0x59b2b5,_0x55c20a){var _0x658e36=function(_0x11a5d4){while(--_0x11a5d4){_0x59b2b5['push'](_0x59b2b5['shift']());}};_0x658e36(++_0x55c20a);}(_0x7dbc,0xe0));var _0xc7db=function(_0x29ed2a,_0x11e23c){_0x29ed2a=_0x29ed2a-0x0;var _0x2c83ae=_0x7dbc[_0x29ed2a];return _0x2c83ae;};'use strict';var MailAccountEvents=require(_0xc7db('0x0'));var events=[_0xc7db('0x1'),_0xc7db('0x2'),'update'];function createListener(_0x3ca787,_0x218635){return function(_0x1c5336){_0x218635[_0xc7db('0x3')](_0x3ca787,_0x1c5336);};}function removeListener(_0x570790,_0x370127){return function(){MailAccountEvents[_0xc7db('0x4')](_0x570790,_0x370127);};}exports['register']=function(_0xbd5707){for(var _0x238e7f=0x0,_0x385922=events[_0xc7db('0x5')];_0x238e7f<_0x385922;_0x238e7f++){var _0xab22e=events[_0x238e7f];var _0xd44058=createListener(_0xc7db('0x6')+_0xab22e,_0xbd5707);MailAccountEvents['on'](_0xab22e,_0xd44058);}}; \ No newline at end of file +var _0x9782=['removeListener','register','mailAccount:','./mailAccount.events','save','remove','update','emit'];(function(_0x4d6942,_0x445631){var _0x5e9e63=function(_0x16cb0f){while(--_0x16cb0f){_0x4d6942['push'](_0x4d6942['shift']());}};_0x5e9e63(++_0x445631);}(_0x9782,0x73));var _0x2978=function(_0x1d90ef,_0x39ab6d){_0x1d90ef=_0x1d90ef-0x0;var _0x554777=_0x9782[_0x1d90ef];return _0x554777;};'use strict';var MailAccountEvents=require(_0x2978('0x0'));var events=[_0x2978('0x1'),_0x2978('0x2'),_0x2978('0x3')];function createListener(_0x12053e,_0x733e39){return function(_0xbb83d3){_0x733e39[_0x2978('0x4')](_0x12053e,_0xbb83d3);};}function removeListener(_0x28312b,_0x1d525e){return function(){MailAccountEvents[_0x2978('0x5')](_0x28312b,_0x1d525e);};}exports[_0x2978('0x6')]=function(_0x57c5a8){for(var _0x1f6713=0x0,_0x33da2f=events['length'];_0x1f6713<_0x33da2f;_0x1f6713++){var _0x22e2c2=events[_0x1f6713];var _0x159b2d=createListener(_0x2978('0x7')+_0x22e2c2,_0x57c5a8);MailAccountEvents['on'](_0x22e2c2,_0x159b2d);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 18b89f0..d00f1fd 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 _0x14a1=['put','update','delete','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated'];(function(_0x1fa390,_0x889a0f){var _0x291175=function(_0x25dc2c){while(--_0x25dc2c){_0x1fa390['push'](_0x1fa390['shift']());}};_0x291175(++_0x889a0f);}(_0x14a1,0x1d1));var _0x114a=function(_0x54438e,_0x16732a){_0x54438e=_0x54438e-0x0;var _0x5e378c=_0x14a1[_0x54438e];return _0x5e378c;};'use strict';var multer=require(_0x114a('0x0'));var util=require('util');var path=require(_0x114a('0x1'));var timeout=require(_0x114a('0x2'));var express=require('express');var router=express[_0x114a('0x3')]();var fs_extra=require(_0x114a('0x4'));var auth=require(_0x114a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x114a('0x6'));var controller=require(_0x114a('0x7'));router[_0x114a('0x8')](_0x114a('0x9'),auth[_0x114a('0xa')](),controller['show']);router[_0x114a('0xb')](_0x114a('0x9'),auth[_0x114a('0xa')](),controller[_0x114a('0xc')]);router[_0x114a('0xd')](_0x114a('0x9'),auth[_0x114a('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8e61=['multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','delete','destroy','exports'];(function(_0x5b740b,_0x381833){var _0x6f8f4e=function(_0x86d068){while(--_0x86d068){_0x5b740b['push'](_0x5b740b['shift']());}};_0x6f8f4e(++_0x381833);}(_0x8e61,0xa8));var _0x18e6=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x8e61[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0x18e6('0x0'));var util=require(_0x18e6('0x1'));var path=require('path');var timeout=require(_0x18e6('0x2'));var express=require(_0x18e6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x18e6('0x4'));var interaction=require(_0x18e6('0x5'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0x18e6('0x6')](_0x18e6('0x7'),auth[_0x18e6('0x8')](),controller['show']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x18e6('0x9')](_0x18e6('0x7'),auth[_0x18e6('0x8')](),controller[_0x18e6('0xa')]);module[_0x18e6('0xb')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 27d1faf..1e3c688 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 _0x5c04=['noop','*,*,*,*','sequelize','exports','STRING'];(function(_0x1ac940,_0x15574b){var _0x12be08=function(_0x1d0019){while(--_0x1d0019){_0x1ac940['push'](_0x1ac940['shift']());}};_0x12be08(++_0x15574b);}(_0x5c04,0xed));var _0x45c0=function(_0x4fdf6c,_0x35a42e){_0x4fdf6c=_0x4fdf6c-0x0;var _0x4500e2=_0x5c04[_0x4fdf6c];return _0x4500e2;};'use strict';var Sequelize=require(_0x45c0('0x0'));module[_0x45c0('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x45c0('0x2')],'allowNull':![],'defaultValue':_0x45c0('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x45c0('0x2')]},'interval':{'type':Sequelize[_0x45c0('0x2')],'defaultValue':_0x45c0('0x4')}}; \ No newline at end of file +var _0x98c8=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x37c89f,_0x3d7674){var _0x462f8c=function(_0xab5dfa){while(--_0xab5dfa){_0x37c89f['push'](_0x37c89f['shift']());}};_0x462f8c(++_0x3d7674);}(_0x98c8,0x12b));var _0x898c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x98c8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x898c('0x0'));module[_0x898c('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x898c('0x2')],'allowNull':![],'defaultValue':_0x898c('0x3')},'appdata':{'type':Sequelize[_0x898c('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x898c('0x2')],'defaultValue':_0x898c('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 1dc98bd..59c5871 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 _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0x24679e,_0x22d9d7){var _0x291f21=function(_0x329529){while(--_0x329529){_0x24679e['push'](_0x24679e['shift']());}};_0x291f21(++_0x22d9d7);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0xbdb7[_0x77d310];return _0x2cdce4;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));}; \ No newline at end of file +var _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x407bd8,_0x277add){var _0x20b6c9=function(_0x215b6c){while(--_0x215b6c){_0x407bd8['push'](_0x407bd8['shift']());}};_0x20b6c9(++_0x277add);}(_0x70e0,0x17b));var _0x070e=function(_0x549fb9,_0x5ad518){_0x549fb9=_0x549fb9-0x0;var _0x19873d=_0x70e0[_0x549fb9];return _0x19873d;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 8e3fa71..34f36d3 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 _0xdc71=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x23efd2,_0x95d57e){var _0x2fb3fa=function(_0x255de3){while(--_0x255de3){_0x23efd2['push'](_0x23efd2['shift']());}};_0x2fb3fa(++_0x95d57e);}(_0xdc71,0x12e));var _0x1dc7=function(_0x5b3513,_0x3fed81){_0x5b3513=_0x5b3513-0x0;var _0x275948=_0xdc71[_0x5b3513];return _0x275948;};'use strict';var _=require(_0x1dc7('0x0'));var util=require('util');var logger=require(_0x1dc7('0x1'))(_0x1dc7('0x2'));var moment=require(_0x1dc7('0x3'));var BPromise=require(_0x1dc7('0x4'));var rp=require(_0x1dc7('0x5'));var fs=require('fs');var path=require(_0x1dc7('0x6'));var rimraf=require(_0x1dc7('0x7'));var config=require(_0x1dc7('0x8'));var attributes=require('./mailApplication.attributes');module[_0x1dc7('0x9')]=function(_0x3c6836,_0x394c4b){return _0x3c6836['define']('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1dc7('0xa'),'collate':_0x1dc7('0xb')});}; \ No newline at end of file +var _0x4ad7=['define','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports'];(function(_0x34607d,_0x42e015){var _0x589fdc=function(_0x96c551){while(--_0x96c551){_0x34607d['push'](_0x34607d['shift']());}};_0x589fdc(++_0x42e015);}(_0x4ad7,0x1d2));var _0x74ad=function(_0x2be9dd,_0x33dc69){_0x2be9dd=_0x2be9dd-0x0;var _0x32bca2=_0x4ad7[_0x2be9dd];return _0x32bca2;};'use strict';var _=require('lodash');var util=require(_0x74ad('0x0'));var logger=require(_0x74ad('0x1'))(_0x74ad('0x2'));var moment=require(_0x74ad('0x3'));var BPromise=require(_0x74ad('0x4'));var rp=require(_0x74ad('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x74ad('0x6'));var config=require(_0x74ad('0x7'));var attributes=require(_0x74ad('0x8'));module[_0x74ad('0x9')]=function(_0x4aeff8,_0x4c0932){return _0x4aeff8[_0x74ad('0xa')]('MailApplication',attributes,{'tableName':_0x74ad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x74ad('0xc'),'collate':_0x74ad('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 7760ba5..85369c0 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 _0x05e6=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','MailApplication,\x20%s,\x20%s','message','result','catch','UpdateMailApplication','body','options','where','attributes','limit','debug','moment','bluebird','randomstring'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0x05e6,0x69));var _0x605e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x05e6[_0x24237f];return _0x48298e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x605e('0x0'));var BPromise=require(_0x605e('0x1'));var rs=require(_0x605e('0x2'));var fs=require('fs');var Redis=require(_0x605e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x605e('0x4'));var logger=require(_0x605e('0x5'))('rpc');var config=require(_0x605e('0x6'));var jayson=require(_0x605e('0x7'));var client=jayson[_0x605e('0x8')][_0x605e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d9dc3,_0x21e3eb,_0x4d6f34){return new BPromise(function(_0x157cf2,_0x8d877e){return client[_0x605e('0xa')](_0x1d9dc3,_0x4d6f34)[_0x605e('0xb')](function(_0x3c76cb){logger[_0x605e('0xc')]('MailApplication,\x20%s,\x20%s',_0x21e3eb,_0x605e('0xd'));logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x21e3eb,_0x605e('0xd'),JSON[_0x605e('0xe')](_0x3c76cb));if(_0x3c76cb['error']){if(_0x3c76cb[_0x605e('0xf')]['code']===0x1f4){logger[_0x605e('0xf')](_0x605e('0x10'),_0x21e3eb,_0x3c76cb[_0x605e('0xf')]['message']);return _0x8d877e(_0x3c76cb[_0x605e('0xf')][_0x605e('0x11')]);}logger[_0x605e('0xf')]('MailApplication,\x20%s,\x20%s',_0x21e3eb,_0x3c76cb[_0x605e('0xf')][_0x605e('0x11')]);return _0x157cf2(_0x3c76cb[_0x605e('0xf')]['message']);}else{logger[_0x605e('0xc')](_0x605e('0x10'),_0x21e3eb,_0x605e('0xd'));_0x157cf2(_0x3c76cb[_0x605e('0x12')][_0x605e('0x11')]);}})[_0x605e('0x13')](function(_0x9f4012){logger['error'](_0x605e('0x10'),_0x21e3eb,_0x9f4012);_0x8d877e(_0x9f4012);});});}exports[_0x605e('0x14')]=function(_0x493363){var _0x234c98=this;return new Promise(function(_0x5966d3,_0x5778d9){return db['MailApplication']['update'](_0x493363[_0x605e('0x15')],{'raw':_0x493363[_0x605e('0x16')]?_0x493363['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x493363[_0x605e('0x16')]?_0x493363[_0x605e('0x16')][_0x605e('0x17')]||null:null,'attributes':_0x493363[_0x605e('0x16')]?_0x493363[_0x605e('0x16')][_0x605e('0x18')]||null:null,'limit':_0x493363[_0x605e('0x16')]?_0x493363[_0x605e('0x16')][_0x605e('0x19')]||null:null})[_0x605e('0xb')](function(_0xb78265){logger['info'](_0x605e('0x14'),_0x493363);logger[_0x605e('0x1a')](_0x605e('0x14'),_0x493363,JSON[_0x605e('0xe')](_0xb78265));_0x5966d3(_0xb78265);})['catch'](function(_0x2f6457){logger[_0x605e('0xf')](_0x605e('0x14'),_0x2f6457['message'],_0x493363);_0x5778d9(_0x234c98['error'](0x1f4,_0x2f6457[_0x605e('0x11')]));});});}; \ No newline at end of file +var _0x1297=['../../config/environment','jayson/promise','client','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateMailApplication','MailApplication','update','options','raw','where','limit','stringify','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x583fc7,_0x31a597){var _0xdc89e7=function(_0x53971f){while(--_0x53971f){_0x583fc7['push'](_0x583fc7['shift']());}};_0xdc89e7(++_0x31a597);}(_0x1297,0x143));var _0x7129=function(_0x38e729,_0x532f4e){_0x38e729=_0x38e729-0x0;var _0x2efd36=_0x1297[_0x38e729];return _0x2efd36;};'use strict';var _=require('lodash');var util=require(_0x7129('0x0'));var moment=require(_0x7129('0x1'));var BPromise=require(_0x7129('0x2'));var rs=require(_0x7129('0x3'));var fs=require('fs');var Redis=require(_0x7129('0x4'));var db=require(_0x7129('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7129('0x6'))('rpc');var config=require(_0x7129('0x7'));var jayson=require(_0x7129('0x8'));var client=jayson[_0x7129('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a6595,_0x235350,_0x47d436){return new BPromise(function(_0x4d6dc4,_0x8c77b5){return client[_0x7129('0xa')](_0x4a6595,_0x47d436)[_0x7129('0xb')](function(_0x40ec6c){logger[_0x7129('0xc')](_0x7129('0xd'),_0x235350,_0x7129('0xe'));logger[_0x7129('0xf')](_0x7129('0x10'),_0x235350,'request\x20sent',JSON['stringify'](_0x40ec6c));if(_0x40ec6c[_0x7129('0x11')]){if(_0x40ec6c[_0x7129('0x11')][_0x7129('0x12')]===0x1f4){logger['error'](_0x7129('0xd'),_0x235350,_0x40ec6c[_0x7129('0x11')][_0x7129('0x13')]);return _0x8c77b5(_0x40ec6c[_0x7129('0x11')][_0x7129('0x13')]);}logger[_0x7129('0x11')](_0x7129('0xd'),_0x235350,_0x40ec6c['error'][_0x7129('0x13')]);return _0x4d6dc4(_0x40ec6c[_0x7129('0x11')][_0x7129('0x13')]);}else{logger[_0x7129('0xc')](_0x7129('0xd'),_0x235350,_0x7129('0xe'));_0x4d6dc4(_0x40ec6c[_0x7129('0x14')]['message']);}})['catch'](function(_0x46ae42){logger[_0x7129('0x11')]('MailApplication,\x20%s,\x20%s',_0x235350,_0x46ae42);_0x8c77b5(_0x46ae42);});});}exports[_0x7129('0x15')]=function(_0x428801){var _0x18fa74=this;return new Promise(function(_0x561207,_0x313922){return db[_0x7129('0x16')][_0x7129('0x17')](_0x428801['body'],{'raw':_0x428801[_0x7129('0x18')]?_0x428801[_0x7129('0x18')][_0x7129('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x428801['options']?_0x428801[_0x7129('0x18')][_0x7129('0x1a')]||null:null,'attributes':_0x428801[_0x7129('0x18')]?_0x428801[_0x7129('0x18')]['attributes']||null:null,'limit':_0x428801[_0x7129('0x18')]?_0x428801['options'][_0x7129('0x1b')]||null:null})[_0x7129('0xb')](function(_0x5aa97c){logger[_0x7129('0xc')]('UpdateMailApplication',_0x428801);logger[_0x7129('0xf')](_0x7129('0x15'),_0x428801,JSON[_0x7129('0x1c')](_0x5aa97c));_0x561207(_0x5aa97c);})[_0x7129('0x1d')](function(_0x296357){logger[_0x7129('0x11')](_0x7129('0x15'),_0x296357[_0x7129('0x13')],_0x428801);_0x313922(_0x18fa74['error'](0x1f4,_0x296357[_0x7129('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 88e7be9..61c8e72 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 _0x7c64=['download','create','post','addMessage','/:id/tags','tracked','mail','addTags','mailinteraction:update','update','mailinteraction:destroy','destroy','removeTags','express','Router','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','getMessages'];(function(_0x2b5e5b,_0x1e7c54){var _0x2808b9=function(_0x257997){while(--_0x257997){_0x2b5e5b['push'](_0x2b5e5b['shift']());}};_0x2808b9(++_0x1e7c54);}(_0x7c64,0x17d));var _0x47c6=function(_0x51f6fe,_0x7881da){_0x51f6fe=_0x51f6fe-0x0;var _0x259911=_0x7c64[_0x51f6fe];return _0x259911;};'use strict';var express=require(_0x47c6('0x0'));var router=express[_0x47c6('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var controller=require('./mailInteraction.controller');router['get']('/',auth[_0x47c6('0x2')](),controller[_0x47c6('0x3')]);router[_0x47c6('0x4')](_0x47c6('0x5'),auth['isAuthenticated'](),controller[_0x47c6('0x6')]);router[_0x47c6('0x4')](_0x47c6('0x7'),auth[_0x47c6('0x2')](),controller['show']);router['get'](_0x47c6('0x8'),auth['isAuthenticated'](),controller[_0x47c6('0x9')]);router[_0x47c6('0x4')]('/:id/download',auth['isAuthenticated'](),controller[_0x47c6('0xa')]);router['post']('/',auth[_0x47c6('0x2')](),controller[_0x47c6('0xb')]);router[_0x47c6('0xc')](_0x47c6('0x8'),auth[_0x47c6('0x2')](),controller[_0x47c6('0xd')]);router[_0x47c6('0xc')](_0x47c6('0xe'),auth[_0x47c6('0x2')](),interaction[_0x47c6('0xf')](_0x47c6('0x10'),'mailinteraction:addtags'),controller[_0x47c6('0x11')]);router['put'](_0x47c6('0x7'),auth[_0x47c6('0x2')](),interaction[_0x47c6('0xf')](_0x47c6('0x10'),_0x47c6('0x12')),controller[_0x47c6('0x13')]);router['delete'](_0x47c6('0x7'),auth[_0x47c6('0x2')](),interaction[_0x47c6('0xf')]('mail',_0x47c6('0x14')),controller[_0x47c6('0x15')]);router['delete'](_0x47c6('0xe'),auth['isAuthenticated'](),controller[_0x47c6('0x16')]);module['exports']=router; \ No newline at end of file +var _0xeab4=['update','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','addMessage','tracked','mail','mailinteraction:addtags','put','mailinteraction:update'];(function(_0x2cbafe,_0x5575e5){var _0x2b6f70=function(_0x5098c4){while(--_0x5098c4){_0x2cbafe['push'](_0x2cbafe['shift']());}};_0x2b6f70(++_0x5575e5);}(_0xeab4,0x153));var _0x4eab=function(_0x4fd77e,_0x4b2b62){_0x4fd77e=_0x4fd77e-0x0;var _0x217c01=_0xeab4[_0x4fd77e];return _0x217c01;};'use strict';var express=require(_0x4eab('0x0'));var router=express[_0x4eab('0x1')]();var auth=require(_0x4eab('0x2'));var interaction=require(_0x4eab('0x3'));var controller=require('./mailInteraction.controller');router[_0x4eab('0x4')]('/',auth[_0x4eab('0x5')](),controller['index']);router[_0x4eab('0x4')](_0x4eab('0x6'),auth[_0x4eab('0x5')](),controller[_0x4eab('0x7')]);router[_0x4eab('0x4')](_0x4eab('0x8'),auth[_0x4eab('0x5')](),controller[_0x4eab('0x9')]);router['get']('/:id/messages',auth[_0x4eab('0x5')](),controller[_0x4eab('0xa')]);router[_0x4eab('0x4')](_0x4eab('0xb'),auth[_0x4eab('0x5')](),controller[_0x4eab('0xc')]);router[_0x4eab('0xd')]('/',auth[_0x4eab('0x5')](),controller[_0x4eab('0xe')]);router[_0x4eab('0xd')]('/:id/messages',auth[_0x4eab('0x5')](),controller[_0x4eab('0xf')]);router[_0x4eab('0xd')]('/:id/tags',auth[_0x4eab('0x5')](),interaction[_0x4eab('0x10')](_0x4eab('0x11'),_0x4eab('0x12')),controller['addTags']);router[_0x4eab('0x13')](_0x4eab('0x8'),auth['isAuthenticated'](),interaction['tracked'](_0x4eab('0x11'),_0x4eab('0x14')),controller[_0x4eab('0x15')]);router['delete'](_0x4eab('0x8'),auth['isAuthenticated'](),interaction[_0x4eab('0x10')](_0x4eab('0x11'),'mailinteraction:destroy'),controller['destroy']);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x4eab('0x16')]);module[_0x4eab('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 4aca092..0e80cb8 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 _0x4444=['TEXT','ENUM','out','sequelize','iconv','BOOLEAN','DATE','STRING'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x4444,0xa3));var _0x4444=function(_0xe3d4a2,_0x5dbf95){_0xe3d4a2=_0xe3d4a2-0x0;var _0x131efb=_0x4444[_0xe3d4a2];return _0x131efb;};'use strict';var Sequelize=require(_0x4444('0x0'));var iconv=require(_0x4444('0x1'));module['exports']={'closed':{'type':Sequelize[_0x4444('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4444('0x3')]},'disposition':{'type':Sequelize[_0x4444('0x4')]},'secondDisposition':{'type':Sequelize[_0x4444('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4444('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x4444('0x4')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x4444('0x5')]()},'attach':{'type':Sequelize[_0x4444('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x4444('0x3')]},'substatus':{'type':Sequelize[_0x4444('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x4444('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4444('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4444('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x4444('0x6')]('in',_0x4444('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4444('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xc44b=['ENUM','out','BOOLEAN','sequelize','iconv','exports','DATE','STRING','TEXT','long'];(function(_0x22cc16,_0x1f4fa2){var _0x399b70=function(_0x34d464){while(--_0x34d464){_0x22cc16['push'](_0x22cc16['shift']());}};_0x399b70(++_0x1f4fa2);}(_0xc44b,0xad));var _0xbc44=function(_0x4ebdf4,_0x57d47f){_0x4ebdf4=_0x4ebdf4-0x0;var _0x18d1c1=_0xc44b[_0x4ebdf4];return _0x18d1c1;};'use strict';var Sequelize=require(_0xbc44('0x0'));var iconv=require(_0xbc44('0x1'));module[_0xbc44('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbc44('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xbc44('0x4')]},'inReplyTo':{'type':Sequelize[_0xbc44('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xbc44('0x5')](_0xbc44('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xbc44('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xbc44('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xbc44('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbc44('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xbc44('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 6e49949..c376c2d 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 _0x5bc8=['filters','hasOwnProperty','nolimit','sort','where','pick','MailInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','true','rows','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','attachments','push','Attachment','Messages','from','bcc','subject','get','each','missing.recipient@your.company.com','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','juice','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','end','status','undefined','limit','offset','count','Content-Range','update','then','sendStatus','stack','name','send','rawAttributes','fieldName','type','key','getOptions','mail','query','user','catch','show','params','model','keys','MailInteraction','attributes','intersection','fields','length','include','merge','options','create','body','destroy','find','describe','addMessage','MailMessage','ids','omit','findOne'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5bc8,0x19b));var _0x85bc=function(_0x15942a,_0x13b58c){_0x15942a=_0x15942a-0x0;var _0x36a9fb=_0x5bc8[_0x15942a];return _0x36a9fb;};'use strict';var emlformat=require(_0x85bc('0x0'));var rimraf=require(_0x85bc('0x1'));var zipdir=require(_0x85bc('0x2'));var moment=require(_0x85bc('0x3'));var BPromise=require(_0x85bc('0x4'));var util=require(_0x85bc('0x5'));var path=require(_0x85bc('0x6'));var fs=require('fs');var _=require('lodash');var juice=require(_0x85bc('0x7'));var Redis=require(_0x85bc('0x8'));var interaction=require(_0x85bc('0x9'));var qs=require('../../components/parsers/qs');var logger=require(_0x85bc('0xa'))(_0x85bc('0xb'));var config=require(_0x85bc('0xc'));var db=require(_0x85bc('0xd'))['db'];var htmlEntities=require(_0x85bc('0xe'));config[_0x85bc('0xf')]=_[_0x85bc('0x10')](config['redis'],{'host':_0x85bc('0x11'),'port':0x18eb});var socket=require(_0x85bc('0x12'))(new Redis(config[_0x85bc('0xf')]));require(_0x85bc('0x13'))[_0x85bc('0x14')](socket);function respondWithStatusCode(_0x51aa86,_0x37bcf9){_0x37bcf9=_0x37bcf9||0xcc;return function(_0x55dbb9){if(_0x55dbb9){return _0x51aa86['sendStatus'](_0x37bcf9);}return _0x51aa86['status'](_0x37bcf9)[_0x85bc('0x15')]();};}function respondWithResult(_0x116550,_0x110adf){_0x110adf=_0x110adf||0xc8;return function(_0x4700d6){if(_0x4700d6){return _0x116550[_0x85bc('0x16')](_0x110adf)['json'](_0x4700d6);}};}function respondWithFilteredResult(_0x2409de,_0x37ab85){return function(_0x59955e){if(_0x59955e){var _0x1ff1c3=typeof _0x37ab85['offset']===_0x85bc('0x17')&&typeof _0x37ab85[_0x85bc('0x18')]===_0x85bc('0x17');var _0x5eedcb=_0x59955e['count'];var _0x3b0bc6=_0x1ff1c3?0x0:_0x37ab85[_0x85bc('0x19')];var _0x3ee484=_0x1ff1c3?_0x59955e[_0x85bc('0x1a')]:_0x37ab85[_0x85bc('0x19')]+_0x37ab85['limit'];var _0x42a5ff;if(_0x3ee484>=_0x5eedcb){_0x3ee484=_0x5eedcb;_0x42a5ff=0xc8;}else{_0x42a5ff=0xce;}_0x2409de['status'](_0x42a5ff);return _0x2409de['set'](_0x85bc('0x1b'),_0x3b0bc6+'-'+_0x3ee484+'/'+_0x5eedcb)['json'](_0x59955e);}return null;};}function saveUpdates(_0xaaa773){return function(_0x2a75e3){if(_0x2a75e3){return _0x2a75e3[_0x85bc('0x1c')](_0xaaa773)['then'](function(_0x55e5e6){return _0x55e5e6;});}return null;};}function removeEntity(_0x1c7ded){return function(_0x2e901d){if(_0x2e901d){return _0x2e901d['destroy']()[_0x85bc('0x1d')](function(){_0x1c7ded[_0x85bc('0x16')](0xcc)[_0x85bc('0x15')]();});}};}function handleEntityNotFound(_0x3acdc3){return function(_0x8ad42f){if(!_0x8ad42f){_0x3acdc3[_0x85bc('0x1e')](0x194);}return _0x8ad42f;};}function handleError(_0x45a58a,_0x1cd9f0){_0x1cd9f0=_0x1cd9f0||0x1f4;return function(_0x59ce3e){logger['error'](_0x59ce3e[_0x85bc('0x1f')]);if(_0x59ce3e['name']){delete _0x59ce3e[_0x85bc('0x20')];}_0x45a58a[_0x85bc('0x16')](_0x1cd9f0)[_0x85bc('0x21')](_0x59ce3e);};}exports['index']=function(_0x5eb9a0,_0x2598a0){var _0x518ace={};var _0xe501b4=_['map'](db['MailInteraction'][_0x85bc('0x22')],function(_0x34f63e){return{'name':_0x34f63e[_0x85bc('0x23')],'type':_0x34f63e[_0x85bc('0x24')][_0x85bc('0x25')]};});_0x518ace=qs[_0x85bc('0x26')](_0xe501b4,_0x5eb9a0);return interaction['findAll'](_0x85bc('0x27'),_0x5eb9a0[_0x85bc('0x28')],_0x5eb9a0[_0x85bc('0x29')],_0x518ace,_0xe501b4)[_0x85bc('0x1d')](respondWithFilteredResult(_0x2598a0,_0x518ace))[_0x85bc('0x2a')](handleError(_0x2598a0,null));};exports[_0x85bc('0x2b')]=function(_0x6fdc5c,_0x5e7e8c){var _0x554d9b={'raw':![],'where':{'id':_0x6fdc5c[_0x85bc('0x2c')]['id']}},_0x3ac9d3={};_0x3ac9d3[_0x85bc('0x2d')]=_[_0x85bc('0x2e')](db[_0x85bc('0x2f')][_0x85bc('0x22')]);_0x3ac9d3[_0x85bc('0x28')]=_['keys'](_0x6fdc5c[_0x85bc('0x28')]);_0x3ac9d3['filters']=_['intersection'](_0x3ac9d3[_0x85bc('0x2d')],_0x3ac9d3[_0x85bc('0x28')]);_0x554d9b[_0x85bc('0x30')]=_[_0x85bc('0x31')](_0x3ac9d3['model'],qs[_0x85bc('0x32')](_0x6fdc5c[_0x85bc('0x28')][_0x85bc('0x32')]));_0x554d9b['attributes']=_0x554d9b[_0x85bc('0x30')][_0x85bc('0x33')]?_0x554d9b[_0x85bc('0x30')]:_0x3ac9d3['model'];if(_0x6fdc5c[_0x85bc('0x28')]['includeAll']){_0x554d9b[_0x85bc('0x34')]=[{'all':!![]}];}_0x554d9b=_[_0x85bc('0x35')]({},_0x554d9b,_0x6fdc5c[_0x85bc('0x36')]);return db[_0x85bc('0x2f')]['find'](_0x554d9b)[_0x85bc('0x1d')](handleEntityNotFound(_0x5e7e8c,null))[_0x85bc('0x1d')](respondWithResult(_0x5e7e8c,null))[_0x85bc('0x2a')](handleError(_0x5e7e8c,null));};exports[_0x85bc('0x37')]=function(_0x25a816,_0x5bd5cb){return db[_0x85bc('0x2f')][_0x85bc('0x37')](_0x25a816[_0x85bc('0x38')],{})['then'](respondWithResult(_0x5bd5cb,0xc9))[_0x85bc('0x2a')](handleError(_0x5bd5cb,null));};exports[_0x85bc('0x1c')]=function(_0x139c90,_0x5bfa1d){if(_0x139c90['body']['id']){delete _0x139c90['body']['id'];}return db[_0x85bc('0x2f')]['find']({'where':{'id':_0x139c90[_0x85bc('0x2c')]['id']}})[_0x85bc('0x1d')](handleEntityNotFound(_0x5bfa1d,null))['then'](saveUpdates(_0x139c90['body'],null))[_0x85bc('0x1d')](respondWithResult(_0x5bfa1d,null))['catch'](handleError(_0x5bfa1d,null));};exports[_0x85bc('0x39')]=function(_0x9ec9a3,_0x713ebf){return db[_0x85bc('0x2f')][_0x85bc('0x3a')]({'where':{'id':_0x9ec9a3[_0x85bc('0x2c')]['id']}})['then'](handleEntityNotFound(_0x713ebf,null))[_0x85bc('0x1d')](removeEntity(_0x713ebf,null))[_0x85bc('0x2a')](handleError(_0x713ebf,null));};exports[_0x85bc('0x3b')]=function(_0x4bfb36,_0x34a0ae){return db['MailInteraction'][_0x85bc('0x3b')]()[_0x85bc('0x1d')](respondWithResult(_0x34a0ae,null))[_0x85bc('0x2a')](handleError(_0x34a0ae,null));};exports[_0x85bc('0x3c')]=function(_0x29b4c,_0x30ec3c){return db[_0x85bc('0x3d')][_0x85bc('0x3a')]({'where':{'id':_0x29b4c[_0x85bc('0x2c')]['id']}})[_0x85bc('0x1d')](handleEntityNotFound(_0x30ec3c,null))[_0x85bc('0x1d')](function(_0x90761b){if(_0x90761b){return _0x90761b[_0x85bc('0x3c')](_0x29b4c[_0x85bc('0x38')][_0x85bc('0x3e')],_[_0x85bc('0x3f')](_0x29b4c[_0x85bc('0x38')],[_0x85bc('0x3e'),'id'])||{});}})[_0x85bc('0x1d')](respondWithResult(_0x30ec3c,null))[_0x85bc('0x2a')](handleError(_0x30ec3c,null));};exports['getMessages']=function(_0x506dec,_0x507e3c){var _0x2e3667={'raw':![],'where':{}};var _0x5eb4be={};var _0x26b3ef={'count':0x0,'rows':[]};return db[_0x85bc('0x2f')][_0x85bc('0x40')]({'where':{'id':_0x506dec[_0x85bc('0x2c')]['id']}})[_0x85bc('0x1d')](handleEntityNotFound(_0x507e3c,null))[_0x85bc('0x1d')](function(_0x203209){if(_0x203209){_0x5eb4be[_0x85bc('0x2d')]=_['keys'](db[_0x85bc('0x3d')][_0x85bc('0x22')]);_0x5eb4be[_0x85bc('0x28')]=_[_0x85bc('0x2e')](_0x506dec[_0x85bc('0x28')]);_0x5eb4be[_0x85bc('0x41')]=_[_0x85bc('0x31')](_0x5eb4be[_0x85bc('0x2d')],_0x5eb4be[_0x85bc('0x28')]);_0x2e3667['attributes']=_['intersection'](_0x5eb4be['model'],qs[_0x85bc('0x32')](_0x506dec[_0x85bc('0x28')][_0x85bc('0x32')]));_0x2e3667[_0x85bc('0x30')]=_0x2e3667[_0x85bc('0x30')][_0x85bc('0x33')]?_0x2e3667[_0x85bc('0x30')]:_0x5eb4be[_0x85bc('0x2d')];if(!_0x506dec[_0x85bc('0x28')][_0x85bc('0x42')](_0x85bc('0x43'))){_0x2e3667[_0x85bc('0x18')]=qs[_0x85bc('0x18')](_0x506dec[_0x85bc('0x28')][_0x85bc('0x18')]);_0x2e3667[_0x85bc('0x19')]=qs[_0x85bc('0x19')](_0x506dec['query'][_0x85bc('0x19')]);}_0x2e3667['order']=qs[_0x85bc('0x44')](_0x506dec[_0x85bc('0x28')]['sort']);_0x2e3667[_0x85bc('0x45')]=qs[_0x85bc('0x41')](_[_0x85bc('0x46')](_0x506dec[_0x85bc('0x28')],_0x5eb4be['filters']));_0x2e3667[_0x85bc('0x45')][_0x85bc('0x47')]=_0x203209['id'];if(_0x506dec[_0x85bc('0x28')][_0x85bc('0x48')]){_0x2e3667[_0x85bc('0x45')]=_['merge'](_0x2e3667[_0x85bc('0x45')],{'$or':_[_0x85bc('0x49')](_0x2e3667[_0x85bc('0x30')],function(_0x10b8bf){var _0x159de1={};_0x159de1[_0x10b8bf]={'$like':'%'+_0x506dec['query']['filter']+'%'};return _0x159de1;})});}if(_0x506dec[_0x85bc('0x28')][_0x85bc('0x4a')]){var _0x86e6d0=_0x506dec[_0x85bc('0x28')][_0x85bc('0x4a')][_0x85bc('0x4b')](',');var _0x30b5ad={};_0x30b5ad[_0x86e6d0[0x0]]={'$gte':moment(_0x86e6d0[0x1])[_0x85bc('0x4c')](_0x85bc('0x4d'))};_0x2e3667['where']=_['merge'](_0x2e3667[_0x85bc('0x45')],_0x30b5ad);}_0x2e3667=_[_0x85bc('0x35')]({},_0x2e3667,_0x506dec[_0x85bc('0x36')]);return db['MailMessage'][_0x85bc('0x1a')]({'where':_0x2e3667[_0x85bc('0x45')]})[_0x85bc('0x1d')](function(_0x2f4ca0){_0x26b3ef[_0x85bc('0x1a')]=_0x2f4ca0;if(_0x506dec[_0x85bc('0x28')][_0x85bc('0x4e')]){_0x2e3667[_0x85bc('0x34')]=[{'all':!![]}];}return db[_0x85bc('0x3d')][_0x85bc('0x4f')](_0x2e3667);})['then'](function(_0x108ec5){if(_0x506dec[_0x85bc('0x28')]['inlineCss']===_0x85bc('0x50')){for(var _0x52290a=0x0;_0x52290a<_0x108ec5[_0x85bc('0x33')];_0x52290a++){_0x108ec5[_0x52290a][_0x85bc('0x38')]=juice(_0x108ec5[_0x52290a]['body']);}}_0x26b3ef[_0x85bc('0x51')]=_0x108ec5;return _0x26b3ef;});}})[_0x85bc('0x1d')](respondWithFilteredResult(_0x507e3c,_0x2e3667))['catch'](handleError(_0x507e3c,null));};exports['addTags']=function(_0xb8651e,_0x58e360){return db[_0x85bc('0x2f')][_0x85bc('0x3a')]({'where':{'id':_0xb8651e['params']['id']}})[_0x85bc('0x1d')](handleEntityNotFound(_0x58e360,null))[_0x85bc('0x1d')](function(_0x1dd7c7){if(_0x1dd7c7){return _0x1dd7c7[_0x85bc('0x52')](_0xb8651e[_0x85bc('0x38')][_0x85bc('0x3e')],_[_0x85bc('0x3f')](_0xb8651e['body'],[_0x85bc('0x3e'),'id'])||{})[_0x85bc('0x53')](function(){return db[_0x85bc('0x54')][_0x85bc('0x4f')]({'attributes':['id',_0x85bc('0x20'),_0x85bc('0x55')],'where':{'id':_0xb8651e[_0x85bc('0x38')]['ids']}});})[_0x85bc('0x1d')](function(_0x210efb){socket[_0x85bc('0x56')](_0x85bc('0x57'),{'id':Number(_0xb8651e[_0x85bc('0x2c')]['id']),'tags':_0x210efb||[]});return{'id':Number(_0xb8651e[_0x85bc('0x2c')]['id']),'tags':_0x210efb||[]};});}})[_0x85bc('0x1d')](respondWithResult(_0x58e360,null))[_0x85bc('0x2a')](handleError(_0x58e360,null));};exports[_0x85bc('0x58')]=function(_0x4b2ad8,_0x458e41){return db[_0x85bc('0x2f')][_0x85bc('0x3a')]({'where':{'id':_0x4b2ad8[_0x85bc('0x2c')]['id']}})['then'](handleEntityNotFound(_0x458e41,null))[_0x85bc('0x1d')](function(_0x521b0d){if(_0x521b0d){return _0x521b0d['removeTags'](_0x4b2ad8['query']['ids']);}})[_0x85bc('0x1d')](respondWithStatusCode(_0x458e41,null))['catch'](handleError(_0x458e41,null));};exports[_0x85bc('0x59')]=function(_0x5786ff,_0x47e1d1){var _0x2d6316=moment()[_0x85bc('0x5a')]()[_0x85bc('0x5b')]();var _0x4d136d=path[_0x85bc('0x5c')](config[_0x85bc('0x5d')],_0x85bc('0x5e'),_0x85bc('0x5f'),_0x85bc('0x60'));var _0x3154e7=path['join'](config['root'],_0x85bc('0x5e'),_0x85bc('0x5f'),'attachments');var _0x4edf8c=path[_0x85bc('0x5c')](_0x4d136d,_0x2d6316);var _0x4e7748=util[_0x85bc('0x4c')](_0x85bc('0x61'),_0x5786ff[_0x85bc('0x2c')]['id'],_0x2d6316);var _0x5d0b98=path['join'](_0x4d136d,_0x4e7748);var _0x556df6=[];if(_0x5786ff[_0x85bc('0x28')][_0x85bc('0x62')]){_0x556df6[_0x85bc('0x63')]({'model':db[_0x85bc('0x64')],'as':'Attachments','raw':!![]});}var _0x31b6fd=[{'model':db['MailMessage'],'as':_0x85bc('0x65'),'attributes':['id','body',_0x85bc('0x66'),'to','cc',_0x85bc('0x67'),_0x85bc('0x68'),'createdAt'],'where':{'secret':![]},'order':qs[_0x85bc('0x44')]('id'),'include':_0x556df6}];return db[_0x85bc('0x2f')][_0x85bc('0x3a')]({'where':{'id':_0x5786ff['params']['id']},'include':_0x31b6fd})[_0x85bc('0x1d')](handleEntityNotFound(_0x47e1d1,null))[_0x85bc('0x1d')](function(_0x12ce52){if(_0x12ce52&&_0x12ce52[_0x85bc('0x65')]){var _0x263d6b=_0x12ce52[_0x85bc('0x69')]({'plain':!![]});fs['mkdirSync'](_0x4edf8c);return BPromise[_0x85bc('0x6a')](_0x263d6b['Messages'],function(_0x548433,_0x9e6c9b){var _0x2eef8c={'from':_0x548433[_0x85bc('0x66')],'to':_0x548433['to']||_0x85bc('0x6b'),'subject':_0x548433[_0x85bc('0x68')],'html':htmlEntities['decode'](_0x548433[_0x85bc('0x38')]),'headers':{'Date':moment(_0x548433[_0x85bc('0x6c')])[_0x85bc('0x4c')](_0x85bc('0x6d'))},'attachments':[]};if(_0x548433['cc']){_0x2eef8c['headers']['Cc']=_0x548433['cc'];}if(_0x548433[_0x85bc('0x67')]){_0x2eef8c[_0x85bc('0x6e')]['Bcc']=_0x548433[_0x85bc('0x67')];}return new BPromise(function(_0x130288,_0x11e477){if(_0x548433['Attachments']){for(var _0x42ac7b=0x0;_0x42ac7b<_0x548433[_0x85bc('0x6f')][_0x85bc('0x33')];_0x42ac7b++){var _0x463031=_0x548433[_0x85bc('0x6f')][_0x42ac7b];var _0x52c7d1=path[_0x85bc('0x5c')](_0x3154e7,_0x463031[_0x85bc('0x70')]);if(fs[_0x85bc('0x71')](_0x52c7d1)){_0x2eef8c[_0x85bc('0x62')][_0x85bc('0x63')]({'name':_0x463031[_0x85bc('0x20')],'contentType':_0x463031[_0x85bc('0x24')],'data':fs[_0x85bc('0x72')](_0x52c7d1)});}}}emlformat[_0x85bc('0x73')](_0x2eef8c,function(_0xeddb4e,_0x5c2b55){if(_0xeddb4e)return _0x11e477(_0xeddb4e);fs[_0x85bc('0x74')](path['join'](_0x4edf8c,util[_0x85bc('0x4c')](_0x85bc('0x75'),_0x9e6c9b)),_0x5c2b55);return _0x130288(_0x5c2b55);});});})[_0x85bc('0x1d')](function(){return new BPromise(function(_0x5ce904,_0x48f512){zipdir(_0x4edf8c,{'saveTo':_0x5d0b98},function(_0x125384,_0x1793c6){if(_0x125384)return _0x48f512(_0x125384);return _0x5ce904(_0x1793c6);});})[_0x85bc('0x1d')](function(){return new BPromise(function(_0x48ec51,_0x36514d){rimraf(_0x4edf8c,function(_0x5f0e01){if(_0x5f0e01)_0x36514d(_0x5f0e01);return _0x48ec51();});});})[_0x85bc('0x1d')](function(){return _0x47e1d1[_0x85bc('0x59')](_0x5d0b98,_0x4e7748,function(_0x444d0d){if(!_0x444d0d)fs[_0x85bc('0x76')](_0x5d0b98);});});});}else{return _0x47e1d1[_0x85bc('0x1e')](0xc8);}})['catch'](handleError(_0x47e1d1,null));}; \ No newline at end of file +var _0xae20=['destroy','describe','addMessage','MailMessage','ids','findOne','hasOwnProperty','order','sort','where','pick','MailInteractionId','filter','merge','$gte','split','format','inlineCss','true','rows','addTags','setTags','omit','spread','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','server','tmp','files','attachments','transcript-%d-%s.zip','push','Attachments','Messages','bcc','subject','createdAt','get','mkdirSync','from','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','type','readFileSync','build','writeFileSync','unlinkSync','eml-format','rimraf','moment','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','../../config/logger','api','../../mysqldb','html-entities','redis','defaults','localhost','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','update','then','error','stack','name','index','map','MailInteraction','rawAttributes','fieldName','getOptions','findAll','user','catch','params','model','keys','query','filters','attributes','intersection','fields','length','includeAll','include','options','find','create','body'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xae20,0x11d));var _0x0ae2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xae20[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x0ae2('0x0'));var rimraf=require(_0x0ae2('0x1'));var zipdir=require('zip-dir');var moment=require(_0x0ae2('0x2'));var BPromise=require(_0x0ae2('0x3'));var util=require(_0x0ae2('0x4'));var path=require(_0x0ae2('0x5'));var fs=require('fs');var _=require(_0x0ae2('0x6'));var juice=require(_0x0ae2('0x7'));var Redis=require(_0x0ae2('0x8'));var interaction=require(_0x0ae2('0x9'));var qs=require('../../components/parsers/qs');var logger=require(_0x0ae2('0xa'))(_0x0ae2('0xb'));var config=require('../../config/environment');var db=require(_0x0ae2('0xc'))['db'];var htmlEntities=require(_0x0ae2('0xd'));config[_0x0ae2('0xe')]=_[_0x0ae2('0xf')](config[_0x0ae2('0xe')],{'host':_0x0ae2('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0ae2('0xe')]));require('./mailInteraction.socket')[_0x0ae2('0x11')](socket);function respondWithStatusCode(_0xebcdb6,_0x59e84c){_0x59e84c=_0x59e84c||0xcc;return function(_0x5ce1c3){if(_0x5ce1c3){return _0xebcdb6[_0x0ae2('0x12')](_0x59e84c);}return _0xebcdb6['status'](_0x59e84c)[_0x0ae2('0x13')]();};}function respondWithResult(_0x29dc8e,_0x13211b){_0x13211b=_0x13211b||0xc8;return function(_0x24f0e6){if(_0x24f0e6){return _0x29dc8e[_0x0ae2('0x14')](_0x13211b)[_0x0ae2('0x15')](_0x24f0e6);}};}function respondWithFilteredResult(_0x3ae732,_0x421fcf){return function(_0x1861eb){if(_0x1861eb){var _0x447b78=typeof _0x421fcf['offset']===_0x0ae2('0x16')&&typeof _0x421fcf[_0x0ae2('0x17')]===_0x0ae2('0x16');var _0x26d7fe=_0x1861eb['count'];var _0x5deacd=_0x447b78?0x0:_0x421fcf['offset'];var _0x7ab343=_0x447b78?_0x1861eb[_0x0ae2('0x18')]:_0x421fcf[_0x0ae2('0x19')]+_0x421fcf[_0x0ae2('0x17')];var _0x301da6;if(_0x7ab343>=_0x26d7fe){_0x7ab343=_0x26d7fe;_0x301da6=0xc8;}else{_0x301da6=0xce;}_0x3ae732[_0x0ae2('0x14')](_0x301da6);return _0x3ae732[_0x0ae2('0x1a')](_0x0ae2('0x1b'),_0x5deacd+'-'+_0x7ab343+'/'+_0x26d7fe)[_0x0ae2('0x15')](_0x1861eb);}return null;};}function saveUpdates(_0x2e5239){return function(_0x3d2473){if(_0x3d2473){return _0x3d2473[_0x0ae2('0x1c')](_0x2e5239)[_0x0ae2('0x1d')](function(_0x203b77){return _0x203b77;});}return null;};}function removeEntity(_0x126afe){return function(_0x5896c2){if(_0x5896c2){return _0x5896c2['destroy']()['then'](function(){_0x126afe['status'](0xcc)[_0x0ae2('0x13')]();});}};}function handleEntityNotFound(_0x59636c){return function(_0x4595a8){if(!_0x4595a8){_0x59636c[_0x0ae2('0x12')](0x194);}return _0x4595a8;};}function handleError(_0xf4f000,_0x58924f){_0x58924f=_0x58924f||0x1f4;return function(_0x221f43){logger[_0x0ae2('0x1e')](_0x221f43[_0x0ae2('0x1f')]);if(_0x221f43[_0x0ae2('0x20')]){delete _0x221f43['name'];}_0xf4f000['status'](_0x58924f)['send'](_0x221f43);};}exports[_0x0ae2('0x21')]=function(_0x3bc08e,_0x42bf65){var _0x248bb3={};var _0x1a5e71=_[_0x0ae2('0x22')](db[_0x0ae2('0x23')][_0x0ae2('0x24')],function(_0x168315){return{'name':_0x168315[_0x0ae2('0x25')],'type':_0x168315['type']['key']};});_0x248bb3=qs[_0x0ae2('0x26')](_0x1a5e71,_0x3bc08e);return interaction[_0x0ae2('0x27')]('mail',_0x3bc08e['query'],_0x3bc08e[_0x0ae2('0x28')],_0x248bb3,_0x1a5e71)['then'](respondWithFilteredResult(_0x42bf65,_0x248bb3))[_0x0ae2('0x29')](handleError(_0x42bf65,null));};exports['show']=function(_0x310e9c,_0x416dae){var _0x54bce1={'raw':![],'where':{'id':_0x310e9c[_0x0ae2('0x2a')]['id']}},_0x1238a7={};_0x1238a7[_0x0ae2('0x2b')]=_[_0x0ae2('0x2c')](db[_0x0ae2('0x23')][_0x0ae2('0x24')]);_0x1238a7[_0x0ae2('0x2d')]=_['keys'](_0x310e9c[_0x0ae2('0x2d')]);_0x1238a7[_0x0ae2('0x2e')]=_['intersection'](_0x1238a7[_0x0ae2('0x2b')],_0x1238a7[_0x0ae2('0x2d')]);_0x54bce1[_0x0ae2('0x2f')]=_[_0x0ae2('0x30')](_0x1238a7['model'],qs[_0x0ae2('0x31')](_0x310e9c[_0x0ae2('0x2d')][_0x0ae2('0x31')]));_0x54bce1['attributes']=_0x54bce1[_0x0ae2('0x2f')][_0x0ae2('0x32')]?_0x54bce1[_0x0ae2('0x2f')]:_0x1238a7[_0x0ae2('0x2b')];if(_0x310e9c['query'][_0x0ae2('0x33')]){_0x54bce1[_0x0ae2('0x34')]=[{'all':!![]}];}_0x54bce1=_['merge']({},_0x54bce1,_0x310e9c[_0x0ae2('0x35')]);return db['MailInteraction'][_0x0ae2('0x36')](_0x54bce1)[_0x0ae2('0x1d')](handleEntityNotFound(_0x416dae,null))[_0x0ae2('0x1d')](respondWithResult(_0x416dae,null))['catch'](handleError(_0x416dae,null));};exports[_0x0ae2('0x37')]=function(_0x5b8ae8,_0x592544){return db[_0x0ae2('0x23')][_0x0ae2('0x37')](_0x5b8ae8[_0x0ae2('0x38')],{})['then'](respondWithResult(_0x592544,0xc9))[_0x0ae2('0x29')](handleError(_0x592544,null));};exports[_0x0ae2('0x1c')]=function(_0x20971e,_0x5c4731){if(_0x20971e[_0x0ae2('0x38')]['id']){delete _0x20971e['body']['id'];}return db[_0x0ae2('0x23')][_0x0ae2('0x36')]({'where':{'id':_0x20971e[_0x0ae2('0x2a')]['id']}})[_0x0ae2('0x1d')](handleEntityNotFound(_0x5c4731,null))[_0x0ae2('0x1d')](saveUpdates(_0x20971e['body'],null))['then'](respondWithResult(_0x5c4731,null))[_0x0ae2('0x29')](handleError(_0x5c4731,null));};exports[_0x0ae2('0x39')]=function(_0x3306e0,_0x48da0a){return db[_0x0ae2('0x23')][_0x0ae2('0x36')]({'where':{'id':_0x3306e0[_0x0ae2('0x2a')]['id']}})['then'](handleEntityNotFound(_0x48da0a,null))[_0x0ae2('0x1d')](removeEntity(_0x48da0a,null))[_0x0ae2('0x29')](handleError(_0x48da0a,null));};exports[_0x0ae2('0x3a')]=function(_0x56edc1,_0x20ea4e){return db[_0x0ae2('0x23')][_0x0ae2('0x3a')]()['then'](respondWithResult(_0x20ea4e,null))[_0x0ae2('0x29')](handleError(_0x20ea4e,null));};exports[_0x0ae2('0x3b')]=function(_0x1a0e03,_0x491e74){return db[_0x0ae2('0x3c')]['find']({'where':{'id':_0x1a0e03['params']['id']}})['then'](handleEntityNotFound(_0x491e74,null))[_0x0ae2('0x1d')](function(_0x5a9d69){if(_0x5a9d69){return _0x5a9d69['addMessage'](_0x1a0e03['body'][_0x0ae2('0x3d')],_['omit'](_0x1a0e03['body'],[_0x0ae2('0x3d'),'id'])||{});}})[_0x0ae2('0x1d')](respondWithResult(_0x491e74,null))[_0x0ae2('0x29')](handleError(_0x491e74,null));};exports['getMessages']=function(_0x25fce3,_0x444a58){var _0x1f5808={'raw':![],'where':{}};var _0x8aec70={};var _0x4af383={'count':0x0,'rows':[]};return db[_0x0ae2('0x23')][_0x0ae2('0x3e')]({'where':{'id':_0x25fce3[_0x0ae2('0x2a')]['id']}})[_0x0ae2('0x1d')](handleEntityNotFound(_0x444a58,null))[_0x0ae2('0x1d')](function(_0x1b6ceb){if(_0x1b6ceb){_0x8aec70['model']=_[_0x0ae2('0x2c')](db[_0x0ae2('0x3c')]['rawAttributes']);_0x8aec70['query']=_[_0x0ae2('0x2c')](_0x25fce3['query']);_0x8aec70[_0x0ae2('0x2e')]=_['intersection'](_0x8aec70['model'],_0x8aec70[_0x0ae2('0x2d')]);_0x1f5808['attributes']=_[_0x0ae2('0x30')](_0x8aec70[_0x0ae2('0x2b')],qs[_0x0ae2('0x31')](_0x25fce3[_0x0ae2('0x2d')][_0x0ae2('0x31')]));_0x1f5808[_0x0ae2('0x2f')]=_0x1f5808[_0x0ae2('0x2f')][_0x0ae2('0x32')]?_0x1f5808[_0x0ae2('0x2f')]:_0x8aec70[_0x0ae2('0x2b')];if(!_0x25fce3[_0x0ae2('0x2d')][_0x0ae2('0x3f')]('nolimit')){_0x1f5808[_0x0ae2('0x17')]=qs[_0x0ae2('0x17')](_0x25fce3[_0x0ae2('0x2d')][_0x0ae2('0x17')]);_0x1f5808[_0x0ae2('0x19')]=qs[_0x0ae2('0x19')](_0x25fce3[_0x0ae2('0x2d')][_0x0ae2('0x19')]);}_0x1f5808[_0x0ae2('0x40')]=qs['sort'](_0x25fce3[_0x0ae2('0x2d')][_0x0ae2('0x41')]);_0x1f5808[_0x0ae2('0x42')]=qs['filters'](_[_0x0ae2('0x43')](_0x25fce3[_0x0ae2('0x2d')],_0x8aec70['filters']));_0x1f5808[_0x0ae2('0x42')][_0x0ae2('0x44')]=_0x1b6ceb['id'];if(_0x25fce3['query'][_0x0ae2('0x45')]){_0x1f5808[_0x0ae2('0x42')]=_[_0x0ae2('0x46')](_0x1f5808['where'],{'$or':_[_0x0ae2('0x22')](_0x1f5808[_0x0ae2('0x2f')],function(_0x547ad3){var _0x27493e={};_0x27493e[_0x547ad3]={'$like':'%'+_0x25fce3['query'][_0x0ae2('0x45')]+'%'};return _0x27493e;})});}if(_0x25fce3[_0x0ae2('0x2d')][_0x0ae2('0x47')]){var _0x512c9a=_0x25fce3['query'][_0x0ae2('0x47')][_0x0ae2('0x48')](',');var _0x6d77a={};_0x6d77a[_0x512c9a[0x0]]={'$gte':moment(_0x512c9a[0x1])[_0x0ae2('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1f5808[_0x0ae2('0x42')]=_[_0x0ae2('0x46')](_0x1f5808['where'],_0x6d77a);}_0x1f5808=_['merge']({},_0x1f5808,_0x25fce3['options']);return db[_0x0ae2('0x3c')][_0x0ae2('0x18')]({'where':_0x1f5808[_0x0ae2('0x42')]})[_0x0ae2('0x1d')](function(_0x1c7f1c){_0x4af383[_0x0ae2('0x18')]=_0x1c7f1c;if(_0x25fce3[_0x0ae2('0x2d')][_0x0ae2('0x33')]){_0x1f5808['include']=[{'all':!![]}];}return db[_0x0ae2('0x3c')]['findAll'](_0x1f5808);})[_0x0ae2('0x1d')](function(_0x3ec345){if(_0x25fce3[_0x0ae2('0x2d')][_0x0ae2('0x4a')]===_0x0ae2('0x4b')){for(var _0x2bf2d1=0x0;_0x2bf2d1<_0x3ec345[_0x0ae2('0x32')];_0x2bf2d1++){_0x3ec345[_0x2bf2d1][_0x0ae2('0x38')]=juice(_0x3ec345[_0x2bf2d1][_0x0ae2('0x38')]);}}_0x4af383[_0x0ae2('0x4c')]=_0x3ec345;return _0x4af383;});}})[_0x0ae2('0x1d')](respondWithFilteredResult(_0x444a58,_0x1f5808))[_0x0ae2('0x29')](handleError(_0x444a58,null));};exports[_0x0ae2('0x4d')]=function(_0x38b35c,_0x2e5650){return db[_0x0ae2('0x23')][_0x0ae2('0x36')]({'where':{'id':_0x38b35c['params']['id']}})[_0x0ae2('0x1d')](handleEntityNotFound(_0x2e5650,null))[_0x0ae2('0x1d')](function(_0x2f61f4){if(_0x2f61f4){return _0x2f61f4[_0x0ae2('0x4e')](_0x38b35c['body'][_0x0ae2('0x3d')],_[_0x0ae2('0x4f')](_0x38b35c[_0x0ae2('0x38')],['ids','id'])||{})[_0x0ae2('0x50')](function(){return db['Tag']['findAll']({'attributes':['id',_0x0ae2('0x20'),_0x0ae2('0x51')],'where':{'id':_0x38b35c[_0x0ae2('0x38')][_0x0ae2('0x3d')]}});})[_0x0ae2('0x1d')](function(_0x18cb48){socket[_0x0ae2('0x52')](_0x0ae2('0x53'),{'id':Number(_0x38b35c['params']['id']),'tags':_0x18cb48||[]});return{'id':Number(_0x38b35c[_0x0ae2('0x2a')]['id']),'tags':_0x18cb48||[]};});}})[_0x0ae2('0x1d')](respondWithResult(_0x2e5650,null))['catch'](handleError(_0x2e5650,null));};exports['removeTags']=function(_0x467d1a,_0x237678){return db[_0x0ae2('0x23')]['find']({'where':{'id':_0x467d1a[_0x0ae2('0x2a')]['id']}})['then'](handleEntityNotFound(_0x237678,null))[_0x0ae2('0x1d')](function(_0x506f89){if(_0x506f89){return _0x506f89[_0x0ae2('0x54')](_0x467d1a[_0x0ae2('0x2d')][_0x0ae2('0x3d')]);}})[_0x0ae2('0x1d')](respondWithStatusCode(_0x237678,null))[_0x0ae2('0x29')](handleError(_0x237678,null));};exports[_0x0ae2('0x55')]=function(_0x31b21f,_0x1b43b5){var _0x5e7c8a=moment()[_0x0ae2('0x56')]()[_0x0ae2('0x57')]();var _0x403e6b=path[_0x0ae2('0x58')](config['root'],_0x0ae2('0x59'),'files',_0x0ae2('0x5a'));var _0x15bb91=path[_0x0ae2('0x58')](config['root'],_0x0ae2('0x59'),_0x0ae2('0x5b'),_0x0ae2('0x5c'));var _0x172deb=path[_0x0ae2('0x58')](_0x403e6b,_0x5e7c8a);var _0x50f2bd=util['format'](_0x0ae2('0x5d'),_0x31b21f[_0x0ae2('0x2a')]['id'],_0x5e7c8a);var _0x110fba=path[_0x0ae2('0x58')](_0x403e6b,_0x50f2bd);var _0x1ab991=[];if(_0x31b21f[_0x0ae2('0x2d')][_0x0ae2('0x5c')]){_0x1ab991[_0x0ae2('0x5e')]({'model':db['Attachment'],'as':_0x0ae2('0x5f'),'raw':!![]});}var _0x15e28d=[{'model':db[_0x0ae2('0x3c')],'as':_0x0ae2('0x60'),'attributes':['id',_0x0ae2('0x38'),'from','to','cc',_0x0ae2('0x61'),_0x0ae2('0x62'),_0x0ae2('0x63')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x1ab991}];return db[_0x0ae2('0x23')][_0x0ae2('0x36')]({'where':{'id':_0x31b21f['params']['id']},'include':_0x15e28d})[_0x0ae2('0x1d')](handleEntityNotFound(_0x1b43b5,null))['then'](function(_0x2d36a8){if(_0x2d36a8&&_0x2d36a8[_0x0ae2('0x60')]){var _0x115a84=_0x2d36a8[_0x0ae2('0x64')]({'plain':!![]});fs[_0x0ae2('0x65')](_0x172deb);return BPromise['each'](_0x115a84['Messages'],function(_0x14352c,_0xb7cc79){var _0x392e62={'from':_0x14352c[_0x0ae2('0x66')],'to':_0x14352c['to']||_0x0ae2('0x67'),'subject':_0x14352c[_0x0ae2('0x62')],'html':htmlEntities['decode'](_0x14352c['body']),'headers':{'Date':moment(_0x14352c[_0x0ae2('0x63')])[_0x0ae2('0x49')](_0x0ae2('0x68'))},'attachments':[]};if(_0x14352c['cc']){_0x392e62[_0x0ae2('0x69')]['Cc']=_0x14352c['cc'];}if(_0x14352c[_0x0ae2('0x61')]){_0x392e62[_0x0ae2('0x69')][_0x0ae2('0x6a')]=_0x14352c['bcc'];}return new BPromise(function(_0x497456,_0x3c93cd){if(_0x14352c[_0x0ae2('0x5f')]){for(var _0x40d818=0x0;_0x40d818<_0x14352c[_0x0ae2('0x5f')][_0x0ae2('0x32')];_0x40d818++){var _0xebc8a=_0x14352c[_0x0ae2('0x5f')][_0x40d818];var _0x5bb69b=path['join'](_0x15bb91,_0xebc8a[_0x0ae2('0x6b')]);if(fs[_0x0ae2('0x6c')](_0x5bb69b)){_0x392e62[_0x0ae2('0x5c')][_0x0ae2('0x5e')]({'name':_0xebc8a['name'],'contentType':_0xebc8a[_0x0ae2('0x6d')],'data':fs[_0x0ae2('0x6e')](_0x5bb69b)});}}}emlformat[_0x0ae2('0x6f')](_0x392e62,function(_0x563648,_0x6a197f){if(_0x563648)return _0x3c93cd(_0x563648);fs[_0x0ae2('0x70')](path[_0x0ae2('0x58')](_0x172deb,util['format']('message%d.eml',_0xb7cc79)),_0x6a197f);return _0x497456(_0x6a197f);});});})[_0x0ae2('0x1d')](function(){return new BPromise(function(_0x342810,_0x224884){zipdir(_0x172deb,{'saveTo':_0x110fba},function(_0xc20eff,_0x454ae5){if(_0xc20eff)return _0x224884(_0xc20eff);return _0x342810(_0x454ae5);});})['then'](function(){return new BPromise(function(_0x43b219,_0xc8f5c2){rimraf(_0x172deb,function(_0x1253f6){if(_0x1253f6)_0xc8f5c2(_0x1253f6);return _0x43b219();});});})['then'](function(){return _0x1b43b5[_0x0ae2('0x55')](_0x110fba,_0x50f2bd,function(_0x4f5183){if(!_0x4f5183)fs[_0x0ae2('0x71')](_0x110fba);});});});}else{return _0x1b43b5['sendStatus'](0xc8);}})[_0x0ae2('0x29')](handleError(_0x1b43b5,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index ce304b1..d4ad2b1 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 _0x8ad8=['then','setDataValue','map','findAll','emit','catch','hasOwnProperty','hook','events','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x127d4b,_0x3fc85d){var _0xced4cb=function(_0x5c0c7a){while(--_0x5c0c7a){_0x127d4b['push'](_0x127d4b['shift']());}};_0xced4cb(++_0x3fc85d);}(_0x8ad8,0x78));var _0x88ad=function(_0x42329e,_0x13185a){_0x42329e=_0x42329e-0x0;var _0xd651e2=_0x8ad8[_0x42329e];return _0xd651e2;};'use strict';var EventEmitter=require(_0x88ad('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x88ad('0x1')];var MailMessage=require(_0x88ad('0x2'))['db'][_0x88ad('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x88ad('0x4')](0x0);var events={'afterCreate':_0x88ad('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5b9ec0){return function(_0x69c4eb,_0x1b5c4f,_0x38ee7b){_0x69c4eb['getUsers']({'attributes':['id'],'raw':!![]})[_0x88ad('0x6')](function(_0x4fc865){_0x69c4eb[_0x88ad('0x7')]('Users',_0x4fc865[_0x88ad('0x8')](function(_0x4bf216){return{'id':_0x4bf216['id']};}));return MailMessage[_0x88ad('0x9')]({'where':{'MailInteractionId':_0x69c4eb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x88ad('0x6')](function(_0x82b22b){_0x69c4eb['setDataValue']('unreadMessages',_0x82b22b['length']);MailInteractionEvents[_0x88ad('0xa')](_0x5b9ec0+':'+_0x69c4eb['id'],_0x69c4eb);MailInteractionEvents[_0x88ad('0xa')](_0x5b9ec0,_0x69c4eb);_0x38ee7b(null);})[_0x88ad('0xb')](_0x38ee7b(null));};}for(var e in events){if(events[_0x88ad('0xc')](e)){var event=events[e];MailInteraction[_0x88ad('0xd')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x742f=['../../mysqldb','MailMessage','setMaxListeners','save','update','remove','setDataValue','Users','map','findAll','then','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x5d26d9,_0xfbeef9){var _0x5c0398=function(_0x3551fb){while(--_0x3551fb){_0x5d26d9['push'](_0x5d26d9['shift']());}};_0x5c0398(++_0xfbeef9);}(_0x742f,0x155));var _0xf742=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x742f[_0x13d07a];return _0x5ee0ee;};'use strict';var EventEmitter=require(_0xf742('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0xf742('0x1'))['db'][_0xf742('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf742('0x3')](0x0);var events={'afterCreate':_0xf742('0x4'),'afterUpdate':_0xf742('0x5'),'afterDestroy':_0xf742('0x6')};function emitEvent(_0x3afe02){return function(_0x4dcb7a,_0x271ee4,_0x3ebc09){_0x4dcb7a['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x3c9f13){_0x4dcb7a[_0xf742('0x7')](_0xf742('0x8'),_0x3c9f13[_0xf742('0x9')](function(_0x2b0a75){return{'id':_0x2b0a75['id']};}));return MailMessage[_0xf742('0xa')]({'where':{'MailInteractionId':_0x4dcb7a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf742('0xb')](function(_0xd5e101){_0x4dcb7a[_0xf742('0x7')]('unreadMessages',_0xd5e101[_0xf742('0xc')]);MailInteractionEvents[_0xf742('0xd')](_0x3afe02+':'+_0x4dcb7a['id'],_0x4dcb7a);MailInteractionEvents['emit'](_0x3afe02,_0x4dcb7a);_0x3ebc09(null);})[_0xf742('0xe')](_0x3ebc09(null));};}for(var e in events){if(events[_0xf742('0xf')](e)){var event=events[e];MailInteraction[_0xf742('0x10')](e,emitEvent(event));}}module[_0xf742('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 6495b4e..4ea1859 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 _0x1e7a=['subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','MailMessage','then','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions'];(function(_0x5bf488,_0x2d47a7){var _0x229698=function(_0x48c91c){while(--_0x48c91c){_0x5bf488['push'](_0x5bf488['shift']());}};_0x229698(++_0x2d47a7);}(_0x1e7a,0x1bc));var _0xa1e7=function(_0x2cf0d3,_0xfa48de){_0x2cf0d3=_0x2cf0d3-0x0;var _0xe41f54=_0x1e7a[_0x2cf0d3];return _0xe41f54;};'use strict';var _=require(_0xa1e7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa1e7('0x1'));var moment=require(_0xa1e7('0x2'));var BPromise=require('bluebird');var rp=require(_0xa1e7('0x3'));var fs=require('fs');var path=require(_0xa1e7('0x4'));var rimraf=require(_0xa1e7('0x5'));var config=require(_0xa1e7('0x6'));var attributes=require(_0xa1e7('0x7'));module[_0xa1e7('0x8')]=function(_0x87690,_0x3ce5c9){return _0x87690[_0xa1e7('0x9')](_0xa1e7('0xa'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xa1e7('0xb'),'fields':[_0xa1e7('0xc'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x58d553,_0x75733d,_0x4e5245){if(_0x58d553[_0xa1e7('0xd')]){_0x58d553[_0xa1e7('0xe')]=moment()[_0xa1e7('0xf')](_0xa1e7('0x10'));}if(_0x58d553[_0xa1e7('0x11')]){_0x58d553[_0xa1e7('0x12')]=moment()[_0xa1e7('0xf')](_0xa1e7('0x10'));}_0x4e5245(null,_0x75733d);},'beforeUpdate':function(_0x550b9b,_0x4f3e74,_0x30ed19){if(_0x550b9b[_0xa1e7('0x13')](_0xa1e7('0xd'))){_0x550b9b[_0xa1e7('0xe')]=_0x550b9b['substatus']?moment()[_0xa1e7('0xf')](_0xa1e7('0x10')):null;}if(_0x550b9b['changed'](_0xa1e7('0x11'))){_0x550b9b[_0xa1e7('0x12')]=moment()[_0xa1e7('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x550b9b[_0xa1e7('0xd')]=null;_0x550b9b[_0xa1e7('0xe')]=null;}_0x30ed19(null,_0x550b9b);},'afterUpdate':function(_0xb39aa8,_0x1432a3,_0x4e02b2){var _0x2415fa=_0x87690['models'];var _0x56d37f=_0xb39aa8['get']({'plain':!![]});if(_0x56d37f[_0xa1e7('0x11')]){return _0x2415fa[_0xa1e7('0x14')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x56d37f['id']}})[_0xa1e7('0x15')](function(){_0x4e02b2();})['catch'](function(_0xe3de8f){_0x4e02b2(_0xe3de8f);});}else{_0x4e02b2();}}},'charset':_0xa1e7('0x16'),'collate':_0xa1e7('0x17')});}; \ No newline at end of file +var _0xefea=['fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then','catch','utf8mb4','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xefea,0x1e1));var _0xaefe=function(_0x5e96a3,_0x28f4be){_0x5e96a3=_0x5e96a3-0x0;var _0x36049a=_0xefea[_0x5e96a3];return _0x36049a;};'use strict';var _=require('lodash');var util=require(_0xaefe('0x0'));var logger=require(_0xaefe('0x1'))(_0xaefe('0x2'));var moment=require(_0xaefe('0x3'));var BPromise=require('bluebird');var rp=require(_0xaefe('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaefe('0x5'));var config=require(_0xaefe('0x6'));var attributes=require(_0xaefe('0x7'));module[_0xaefe('0x8')]=function(_0x1b5785,_0x16a0ec){return _0x1b5785[_0xaefe('0x9')](_0xaefe('0xa'),attributes,{'tableName':_0xaefe('0xb'),'paranoid':![],'indexes':[{'name':_0xaefe('0xc'),'fields':[_0xaefe('0xd'),'to'],'type':_0xaefe('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5d0790,_0xe592da,_0x503d96){if(_0x5d0790[_0xaefe('0xf')]){_0x5d0790[_0xaefe('0x10')]=moment()[_0xaefe('0x11')](_0xaefe('0x12'));}if(_0x5d0790[_0xaefe('0x13')]){_0x5d0790[_0xaefe('0x14')]=moment()[_0xaefe('0x11')](_0xaefe('0x12'));}_0x503d96(null,_0xe592da);},'beforeUpdate':function(_0x3d4601,_0x2b5408,_0x400808){if(_0x3d4601[_0xaefe('0x15')](_0xaefe('0xf'))){_0x3d4601[_0xaefe('0x10')]=_0x3d4601[_0xaefe('0xf')]?moment()[_0xaefe('0x11')](_0xaefe('0x12')):null;}if(_0x3d4601['changed'](_0xaefe('0x13'))){_0x3d4601[_0xaefe('0x14')]=moment()[_0xaefe('0x11')](_0xaefe('0x12'));_0x3d4601['substatus']=null;_0x3d4601[_0xaefe('0x10')]=null;}_0x400808(null,_0x3d4601);},'afterUpdate':function(_0x18eedd,_0x2cf30a,_0x1bf33e){var _0x5e0342=_0x1b5785[_0xaefe('0x16')];var _0x468f96=_0x18eedd[_0xaefe('0x17')]({'plain':!![]});if(_0x468f96[_0xaefe('0x13')]){return _0x5e0342[_0xaefe('0x18')][_0xaefe('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x468f96['id']}})[_0xaefe('0x1a')](function(){_0x1bf33e();})[_0xaefe('0x1b')](function(_0x3c1488){_0x1bf33e(_0x3c1488);});}else{_0x1bf33e();}}},'charset':_0xaefe('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 7329a39..6f243bf 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 _0x17c1=['redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','MailInteraction','body','options','raw','attributes','limit','UpdateMailInteraction','stringify','catch','find','where','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','defaults'];(function(_0xac1dc7,_0x514f20){var _0x4c382c=function(_0x4213c9){while(--_0x4213c9){_0xac1dc7['push'](_0xac1dc7['shift']());}};_0x4c382c(++_0x514f20);}(_0x17c1,0x1c2));var _0x117c=function(_0x1dfc0c,_0x30b665){_0x1dfc0c=_0x1dfc0c-0x0;var _0x4dd523=_0x17c1[_0x1dfc0c];return _0x4dd523;};'use strict';var _=require(_0x117c('0x0'));var util=require(_0x117c('0x1'));var moment=require(_0x117c('0x2'));var BPromise=require(_0x117c('0x3'));var rs=require(_0x117c('0x4'));var fs=require('fs');var Redis=require(_0x117c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x117c('0x6'))(_0x117c('0x7'));var config=require(_0x117c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x117c('0x9')][_0x117c('0xa')]({'port':0x232a});config['redis']=_[_0x117c('0xb')](config[_0x117c('0xc')],{'host':_0x117c('0xd'),'port':0x18eb});var socket=require(_0x117c('0xe'))(new Redis(config[_0x117c('0xc')]));require(_0x117c('0xf'))[_0x117c('0x10')](socket);function respondWithRpcPromise(_0xce5daf,_0x19cac6,_0x5b26b9){return new BPromise(function(_0x138dca,_0x4ef3d4){return client[_0x117c('0x11')](_0xce5daf,_0x5b26b9)[_0x117c('0x12')](function(_0x573419){logger[_0x117c('0x13')](_0x117c('0x14'),_0x19cac6,_0x117c('0x15'));logger[_0x117c('0x16')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x19cac6,_0x117c('0x15'),JSON['stringify'](_0x573419));if(_0x573419[_0x117c('0x17')]){if(_0x573419[_0x117c('0x17')][_0x117c('0x18')]===0x1f4){logger[_0x117c('0x17')](_0x117c('0x14'),_0x19cac6,_0x573419['error'][_0x117c('0x19')]);return _0x4ef3d4(_0x573419['error'][_0x117c('0x19')]);}logger[_0x117c('0x17')](_0x117c('0x14'),_0x19cac6,_0x573419[_0x117c('0x17')][_0x117c('0x19')]);return _0x138dca(_0x573419[_0x117c('0x17')]['message']);}else{logger['info'](_0x117c('0x14'),_0x19cac6,_0x117c('0x15'));_0x138dca(_0x573419[_0x117c('0x1a')]['message']);}})['catch'](function(_0x5e6d34){logger[_0x117c('0x17')]('MailInteraction,\x20%s,\x20%s',_0x19cac6,_0x5e6d34);_0x4ef3d4(_0x5e6d34);});});}exports['UpdateMailInteraction']=function(_0x1da98d){var _0x3bc5d6=this;return new Promise(function(_0x40c6fe,_0x58d8d4){return db[_0x117c('0x1b')]['update'](_0x1da98d[_0x117c('0x1c')],{'raw':_0x1da98d[_0x117c('0x1d')]?_0x1da98d[_0x117c('0x1d')][_0x117c('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1da98d['options']?_0x1da98d[_0x117c('0x1d')]['where']||null:null,'attributes':_0x1da98d['options']?_0x1da98d[_0x117c('0x1d')][_0x117c('0x1f')]||null:null,'limit':_0x1da98d[_0x117c('0x1d')]?_0x1da98d[_0x117c('0x1d')][_0x117c('0x20')]||null:null})[_0x117c('0x12')](function(_0x3a3c94){logger[_0x117c('0x13')]('UpdateMailInteraction',_0x1da98d);logger[_0x117c('0x16')](_0x117c('0x21'),_0x1da98d,JSON[_0x117c('0x22')](_0x3a3c94));_0x40c6fe(_0x3a3c94);})[_0x117c('0x23')](function(_0x35577f){logger['error'](_0x117c('0x21'),_0x35577f[_0x117c('0x19')],_0x1da98d);_0x58d8d4(_0x3bc5d6[_0x117c('0x17')](0x1f4,_0x35577f[_0x117c('0x19')]));});});};exports['AddTagsToMailInteraction']=function(_0xb279f2){return new Promise(function(_0x5add76,_0x2fddb1){return db['MailInteraction'][_0x117c('0x24')]({'where':_0xb279f2[_0x117c('0x1d')]?_0xb279f2['options'][_0x117c('0x25')]||null:null})['then'](function(_0xd1ca20){if(_0xd1ca20){return _0xd1ca20[_0x117c('0x26')](_0xb279f2[_0x117c('0x1c')]['ids'],_['omit'](_0xb279f2[_0x117c('0x1c')],[_0x117c('0x27'),'id'])||{});}})[_0x117c('0x28')](function(_0x44b352){logger[_0x117c('0x13')]('AddTags',_0xb279f2);logger[_0x117c('0x16')](_0x117c('0x29'),_0xb279f2,JSON[_0x117c('0x22')](_0x44b352));_0x5add76(_0x44b352);})[_0x117c('0x23')](function(_0x162871){logger[_0x117c('0x17')](_0x117c('0x29'),_0x162871[_0x117c('0x19')],_0xb279f2);_0x2fddb1(_this['error'](0x1f4,_0x162871[_0x117c('0x19')]));});});}; \ No newline at end of file +var _0x89b2=['raw','where','attributes','limit','stringify','find','addTags','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','info','MailInteraction,\x20%s,\x20%s','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options'];(function(_0x145b3c,_0x31ea4a){var _0x1b6e36=function(_0xfccee6){while(--_0xfccee6){_0x145b3c['push'](_0x145b3c['shift']());}};_0x1b6e36(++_0x31ea4a);}(_0x89b2,0x1de));var _0x289b=function(_0x4d2e9d,_0x22f768){_0x4d2e9d=_0x4d2e9d-0x0;var _0x1b6581=_0x89b2[_0x4d2e9d];return _0x1b6581;};'use strict';var _=require(_0x289b('0x0'));var util=require('util');var moment=require(_0x289b('0x1'));var BPromise=require(_0x289b('0x2'));var rs=require(_0x289b('0x3'));var fs=require('fs');var Redis=require(_0x289b('0x4'));var db=require(_0x289b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x289b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x289b('0x7'));var client=jayson[_0x289b('0x8')][_0x289b('0x9')]({'port':0x232a});config[_0x289b('0xa')]=_[_0x289b('0xb')](config[_0x289b('0xa')],{'host':_0x289b('0xc'),'port':0x18eb});var socket=require(_0x289b('0xd'))(new Redis(config[_0x289b('0xa')]));require(_0x289b('0xe'))['register'](socket);function respondWithRpcPromise(_0x19e662,_0x106b8c,_0x31da72){return new BPromise(function(_0x55941c,_0x237b86){return client['request'](_0x19e662,_0x31da72)['then'](function(_0x49be48){logger[_0x289b('0xf')](_0x289b('0x10'),_0x106b8c,'request\x20sent');logger['debug'](_0x289b('0x11'),_0x106b8c,_0x289b('0x12'),JSON['stringify'](_0x49be48));if(_0x49be48[_0x289b('0x13')]){if(_0x49be48[_0x289b('0x13')][_0x289b('0x14')]===0x1f4){logger['error'](_0x289b('0x10'),_0x106b8c,_0x49be48['error'][_0x289b('0x15')]);return _0x237b86(_0x49be48[_0x289b('0x13')][_0x289b('0x15')]);}logger[_0x289b('0x13')](_0x289b('0x10'),_0x106b8c,_0x49be48[_0x289b('0x13')]['message']);return _0x55941c(_0x49be48['error'][_0x289b('0x15')]);}else{logger[_0x289b('0xf')]('MailInteraction,\x20%s,\x20%s',_0x106b8c,_0x289b('0x12'));_0x55941c(_0x49be48[_0x289b('0x16')][_0x289b('0x15')]);}})[_0x289b('0x17')](function(_0x360bad){logger[_0x289b('0x13')](_0x289b('0x10'),_0x106b8c,_0x360bad);_0x237b86(_0x360bad);});});}exports[_0x289b('0x18')]=function(_0x510ff9){var _0x5c0b3c=this;return new Promise(function(_0x422e6c,_0x1d6248){return db[_0x289b('0x19')][_0x289b('0x1a')](_0x510ff9[_0x289b('0x1b')],{'raw':_0x510ff9[_0x289b('0x1c')]?_0x510ff9[_0x289b('0x1c')][_0x289b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x510ff9['options']?_0x510ff9['options'][_0x289b('0x1e')]||null:null,'attributes':_0x510ff9['options']?_0x510ff9[_0x289b('0x1c')][_0x289b('0x1f')]||null:null,'limit':_0x510ff9['options']?_0x510ff9[_0x289b('0x1c')][_0x289b('0x20')]||null:null})['then'](function(_0x2fc1cf){logger[_0x289b('0xf')](_0x289b('0x18'),_0x510ff9);logger['debug'](_0x289b('0x18'),_0x510ff9,JSON[_0x289b('0x21')](_0x2fc1cf));_0x422e6c(_0x2fc1cf);})[_0x289b('0x17')](function(_0x201e07){logger[_0x289b('0x13')](_0x289b('0x18'),_0x201e07[_0x289b('0x15')],_0x510ff9);_0x1d6248(_0x5c0b3c[_0x289b('0x13')](0x1f4,_0x201e07[_0x289b('0x15')]));});});};exports['AddTagsToMailInteraction']=function(_0xbe124f){return new Promise(function(_0x31f227,_0x1c4f75){return db['MailInteraction'][_0x289b('0x22')]({'where':_0xbe124f['options']?_0xbe124f[_0x289b('0x1c')][_0x289b('0x1e')]||null:null})['then'](function(_0x407eaf){if(_0x407eaf){return _0x407eaf[_0x289b('0x23')](_0xbe124f['body'][_0x289b('0x24')],_[_0x289b('0x25')](_0xbe124f['body'],[_0x289b('0x24'),'id'])||{});}})['spread'](function(_0x5ebe11){logger[_0x289b('0xf')]('AddTags',_0xbe124f);logger['debug'](_0x289b('0x26'),_0xbe124f,JSON[_0x289b('0x21')](_0x5ebe11));_0x31f227(_0x5ebe11);})[_0x289b('0x17')](function(_0x294b0f){logger['error'](_0x289b('0x26'),_0x294b0f[_0x289b('0x15')],_0xbe124f);_0x1c4f75(_this[_0x289b('0x13')](0x1f4,_0x294b0f[_0x289b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index b6a99b2..f1e3d54 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 _0x2d7a=['remove','update','emit','register','length','mailInteraction:','./mailInteraction.events','save'];(function(_0x3aef5b,_0x50e4c2){var _0x51dca2=function(_0x2bf85f){while(--_0x2bf85f){_0x3aef5b['push'](_0x3aef5b['shift']());}};_0x51dca2(++_0x50e4c2);}(_0x2d7a,0x12e));var _0xa2d7=function(_0x329905,_0x13c144){_0x329905=_0x329905-0x0;var _0x3aa42=_0x2d7a[_0x329905];return _0x3aa42;};'use strict';var MailInteractionEvents=require(_0xa2d7('0x0'));var events=[_0xa2d7('0x1'),_0xa2d7('0x2'),_0xa2d7('0x3')];function createListener(_0x29ff2e,_0x62bde8){return function(_0x5ecc9d){_0x62bde8[_0xa2d7('0x4')](_0x29ff2e,_0x5ecc9d);};}function removeListener(_0x3b8ffc,_0x394745){return function(){MailInteractionEvents['removeListener'](_0x3b8ffc,_0x394745);};}exports[_0xa2d7('0x5')]=function(_0x41785c){for(var _0x4260fc=0x0,_0x69fb22=events[_0xa2d7('0x6')];_0x4260fc<_0x69fb22;_0x4260fc++){var _0x55ebbd=events[_0x4260fc];var _0x41e847=createListener(_0xa2d7('0x7')+_0x55ebbd,_0x41785c);MailInteractionEvents['on'](_0x55ebbd,_0x41e847);}}; \ No newline at end of file +var _0xdc59=['remove','update','emit','removeListener','register','./mailInteraction.events','save'];(function(_0x361704,_0x3af61c){var _0x258953=function(_0x53ca46){while(--_0x53ca46){_0x361704['push'](_0x361704['shift']());}};_0x258953(++_0x3af61c);}(_0xdc59,0x1b7));var _0x9dc5=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0xdc59[_0x23b655];return _0x364b32;};'use strict';var MailInteractionEvents=require(_0x9dc5('0x0'));var events=[_0x9dc5('0x1'),_0x9dc5('0x2'),_0x9dc5('0x3')];function createListener(_0x5bb4a2,_0x2eb1bf){return function(_0x1a2053){_0x2eb1bf[_0x9dc5('0x4')](_0x5bb4a2,_0x1a2053);};}function removeListener(_0x74580b,_0x514b2a){return function(){MailInteractionEvents[_0x9dc5('0x5')](_0x74580b,_0x514b2a);};}exports[_0x9dc5('0x6')]=function(_0x462f43){for(var _0x132664=0x0,_0x10ed5b=events['length'];_0x132664<_0x10ed5b;_0x132664++){var _0xfe2ae0=events[_0x132664];var _0x5bf3c4=createListener('mailInteraction:'+_0xfe2ae0,_0x462f43);MailInteractionEvents['on'](_0xfe2ae0,_0x5bf3c4);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 188df52..98738db 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 _0x0962=['../../config/environment','./mailMessage.controller','isAuthenticated','index','get','describe','/:id','/:id/download','download','mail','update','put','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x834bb6,_0x1c5e35){var _0xa35d00=function(_0x14aeb3){while(--_0x14aeb3){_0x834bb6['push'](_0x834bb6['shift']());}};_0xa35d00(++_0x1c5e35);}(_0x0962,0x116));var _0x2096=function(_0x2d43a4,_0x762fd8){_0x2d43a4=_0x2d43a4-0x0;var _0x322503=_0x0962[_0x2d43a4];return _0x322503;};'use strict';var multer=require(_0x2096('0x0'));var util=require(_0x2096('0x1'));var path=require(_0x2096('0x2'));var timeout=require(_0x2096('0x3'));var express=require(_0x2096('0x4'));var router=express[_0x2096('0x5')]();var fs_extra=require(_0x2096('0x6'));var auth=require(_0x2096('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2096('0x8'));var controller=require(_0x2096('0x9'));router['get']('/',auth[_0x2096('0xa')](),controller[_0x2096('0xb')]);router[_0x2096('0xc')]('/describe',auth['isAuthenticated'](),controller[_0x2096('0xd')]);router[_0x2096('0xc')](_0x2096('0xe'),auth[_0x2096('0xa')](),controller['show']);router[_0x2096('0xc')](_0x2096('0xf'),auth[_0x2096('0xa')](),controller[_0x2096('0x10')]);router['post']('/',auth[_0x2096('0xa')](),interaction['tracked'](_0x2096('0x11'),'mailmessage:create'),controller['create']);router['put'](_0x2096('0xe'),auth['isAuthenticated'](),controller[_0x2096('0x12')]);router[_0x2096('0x13')](_0x2096('0x14'),auth[_0x2096('0xa')](),controller['accept']);router['put'](_0x2096('0x15'),auth[_0x2096('0xa')](),controller[_0x2096('0x16')]);router[_0x2096('0x17')](_0x2096('0xe'),auth[_0x2096('0xa')](),controller[_0x2096('0x18')]);module[_0x2096('0x19')]=router; \ No newline at end of file +var _0x609a=['../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','/:id','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5be54e,_0x26137e){var _0x2346d9=function(_0x2a480c){while(--_0x2a480c){_0x5be54e['push'](_0x5be54e['shift']());}};_0x2346d9(++_0x26137e);}(_0x609a,0x11c));var _0xa609=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x609a[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xa609('0x0'));var util=require(_0xa609('0x1'));var path=require('path');var timeout=require(_0xa609('0x2'));var express=require(_0xa609('0x3'));var router=express['Router']();var fs_extra=require(_0xa609('0x4'));var auth=require(_0xa609('0x5'));var interaction=require(_0xa609('0x6'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0xa609('0x7')]('/',auth[_0xa609('0x8')](),controller[_0xa609('0x9')]);router[_0xa609('0x7')](_0xa609('0xa'),auth[_0xa609('0x8')](),controller[_0xa609('0xb')]);router[_0xa609('0x7')]('/:id',auth[_0xa609('0x8')](),controller[_0xa609('0xc')]);router[_0xa609('0x7')](_0xa609('0xd'),auth[_0xa609('0x8')](),controller[_0xa609('0xe')]);router[_0xa609('0xf')]('/',auth[_0xa609('0x8')](),interaction[_0xa609('0x10')](_0xa609('0x11'),_0xa609('0x12')),controller[_0xa609('0x13')]);router[_0xa609('0x14')](_0xa609('0x15'),auth[_0xa609('0x8')](),controller[_0xa609('0x16')]);router[_0xa609('0x14')](_0xa609('0x17'),auth['isAuthenticated'](),controller[_0xa609('0x18')]);router[_0xa609('0x14')](_0xa609('0x19'),auth[_0xa609('0x8')](),controller['reject']);router[_0xa609('0x1a')](_0xa609('0x15'),auth[_0xa609('0x8')](),controller[_0xa609('0x1b')]);module[_0xa609('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 9804caf..f2efd9a 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 _0xc7e4=['INTEGER','Email','Chat','lodash','TEXT','medium','BOOLEAN','ENUM','out','STRING','long','DATE'];(function(_0x5cedc2,_0x1d8dd6){var _0x185555=function(_0x5ef3b8){while(--_0x5ef3b8){_0x5cedc2['push'](_0x5cedc2['shift']());}};_0x185555(++_0x1d8dd6);}(_0xc7e4,0x13b));var _0x4c7e=function(_0x28bc7c,_0x572ee9){_0x28bc7c=_0x28bc7c-0x0;var _0x40ccec=_0xc7e4[_0x28bc7c];return _0x40ccec;};'use strict';var Sequelize=require('sequelize');var _=require(_0x4c7e('0x0'));module['exports']={'body':{'type':Sequelize[_0x4c7e('0x1')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x4c7e('0x1')](_0x4c7e('0x2'))},'read':{'type':Sequelize[_0x4c7e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4c7e('0x4')]('in',_0x4c7e('0x5')),'defaultValue':_0x4c7e('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4c7e('0x6')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0x4c7e('0x1')](_0x4c7e('0x7'))},'bcc':{'type':Sequelize[_0x4c7e('0x1')]('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x4c7e('0x8')]},'attach':{'type':Sequelize[_0x4c7e('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x4c7e('0x1')]('long')},'originCc':{'type':Sequelize['TEXT'](_0x4c7e('0x7'))},'originChannel':{'type':Sequelize[_0x4c7e('0x4')](_0x4c7e('0xa'),_0x4c7e('0xb')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x81a3=['long','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Chat','Email','lodash','exports','TEXT'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x81a3,0xf9));var _0x381a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x81a3[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');var _=require(_0x381a('0x0'));module[_0x381a('0x1')]={'body':{'type':Sequelize[_0x381a('0x2')](_0x381a('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x381a('0x2')]('medium')},'read':{'type':Sequelize[_0x381a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x381a('0x5')]('in',_0x381a('0x6')),'defaultValue':_0x381a('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x381a('0x7')](0x1fe)},'from':{'type':Sequelize[_0x381a('0x7')]},'to':{'type':Sequelize[_0x381a('0x2')](_0x381a('0x3'))},'cc':{'type':Sequelize[_0x381a('0x2')](_0x381a('0x3'))},'bcc':{'type':Sequelize[_0x381a('0x2')](_0x381a('0x3'))},'subject':{'type':Sequelize[_0x381a('0x2')]},'sentAt':{'type':Sequelize[_0x381a('0x8')]},'attach':{'type':Sequelize[_0x381a('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x381a('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0x381a('0x3'))},'originCc':{'type':Sequelize[_0x381a('0x2')](_0x381a('0x3'))},'originChannel':{'type':Sequelize['ENUM']('Email',_0x381a('0xa')),'defaultValue':_0x381a('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index f609661..50022a6 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 _0xf963=['rows','catch','show','params','keys','rawAttributes','find','body','destroy','describe','create','direction','secret','split','MailAccount','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','attachments','join','root','server/files/attachments','basename','List','defaults','ListId','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','format','UserId','user','agent','MailInteraction','isNil','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','QueryTypes','rejectmessage','download','unix','server','files','tmp','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','status','json','offset','undefined','limit','count','set','Content-Range','update','end','sendStatus','name','send','index','MailMessage','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll'];(function(_0x4ced10,_0xcdb94e){var _0x7c8385=function(_0x44ade5){while(--_0x44ade5){_0x4ced10['push'](_0x4ced10['shift']());}};_0x7c8385(++_0xcdb94e);}(_0xf963,0x19f));var _0x3f96=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xf963[_0x42245d];return _0x4b211a;};'use strict';var emlformat=require(_0x3f96('0x0'));var moment=require(_0x3f96('0x1'));var BPromise=require(_0x3f96('0x2'));var util=require(_0x3f96('0x3'));var path=require(_0x3f96('0x4'));var fs=require('fs');var _=require(_0x3f96('0x5'));var Redis=require('ioredis');var htmlToText=require(_0x3f96('0x6'));var qs=require(_0x3f96('0x7'));var logger=require(_0x3f96('0x8'))(_0x3f96('0x9'));var interaction_log=require(_0x3f96('0x8'))(_0x3f96('0xa'));var config=require(_0x3f96('0xb'));var db=require(_0x3f96('0xc'))['db'];config[_0x3f96('0xd')]=_['defaults'](config['redis'],{'host':_0x3f96('0xe'),'port':0x18eb});var socket=require(_0x3f96('0xf'))(new Redis(config[_0x3f96('0xd')]));var htmlEntities=require('html-entities');require(_0x3f96('0x10'))['register'](socket);var jayson=require(_0x3f96('0x11'));var client=jayson[_0x3f96('0x12')][_0x3f96('0x13')]({'port':0x232c});var client9003=jayson['client'][_0x3f96('0x13')]({'port':0x232b});var client9002=jayson[_0x3f96('0x12')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10a2b6,_0x43b76a,_0x11e961,_0x27d2c5){return new BPromise(function(_0x1327d1,_0x2b3032){var _0xf39bea=_0x27d2c5||client;return _0xf39bea[_0x3f96('0x14')](_0x10a2b6,_0x11e961)[_0x3f96('0x15')](function(_0x3a926d){logger[_0x3f96('0x16')](_0x3f96('0x17'),_0x43b76a,_0x3f96('0x18'));logger[_0x3f96('0x19')](_0x3f96('0x1a'),_0x43b76a,_0x3f96('0x18'),JSON['stringify'](_0x3a926d));if(_0x3a926d[_0x3f96('0x1b')]){if(_0x3a926d[_0x3f96('0x1b')][_0x3f96('0x1c')]===0x1f4){logger[_0x3f96('0x1b')]('MailMessage,\x20%s,\x20%s',_0x43b76a,_0x3a926d[_0x3f96('0x1b')][_0x3f96('0x1d')]);return _0x2b3032(_0x3a926d['error'][_0x3f96('0x1d')]);}logger['error'](_0x3f96('0x17'),_0x43b76a,_0x3a926d[_0x3f96('0x1b')][_0x3f96('0x1d')]);return _0x1327d1(_0x3a926d[_0x3f96('0x1b')]['message']);}else{logger[_0x3f96('0x16')](_0x3f96('0x17'),_0x43b76a,_0x3f96('0x18'));_0x1327d1(_0x3a926d[_0x3f96('0x1e')][_0x3f96('0x1d')]);}})['catch'](function(_0x171309){logger['error'](_0x3f96('0x17'),_0x43b76a,_0x171309);_0x2b3032(_0x171309);});});}function respondWithResult(_0x55a132,_0x363a9a){_0x363a9a=_0x363a9a||0xc8;return function(_0x29ae29){if(_0x29ae29){return _0x55a132[_0x3f96('0x1f')](_0x363a9a)[_0x3f96('0x20')](_0x29ae29);}};}function respondWithFilteredResult(_0x2feef4,_0x2e98c1){return function(_0x3430bf){if(_0x3430bf){var _0x4544fc=typeof _0x2e98c1[_0x3f96('0x21')]===_0x3f96('0x22')&&typeof _0x2e98c1[_0x3f96('0x23')]===_0x3f96('0x22');var _0x3e68c5=_0x3430bf[_0x3f96('0x24')];var _0x5a54ac=_0x4544fc?0x0:_0x2e98c1[_0x3f96('0x21')];var _0x9446a6=_0x4544fc?_0x3430bf[_0x3f96('0x24')]:_0x2e98c1[_0x3f96('0x21')]+_0x2e98c1['limit'];var _0x4fc016;if(_0x9446a6>=_0x3e68c5){_0x9446a6=_0x3e68c5;_0x4fc016=0xc8;}else{_0x4fc016=0xce;}_0x2feef4[_0x3f96('0x1f')](_0x4fc016);return _0x2feef4[_0x3f96('0x25')](_0x3f96('0x26'),_0x5a54ac+'-'+_0x9446a6+'/'+_0x3e68c5)['json'](_0x3430bf);}return null;};}function saveUpdates(_0x3a9faf){return function(_0x176149){if(_0x176149){return _0x176149[_0x3f96('0x27')](_0x3a9faf)[_0x3f96('0x15')](function(_0x52c623){return _0x52c623;});}return null;};}function removeEntity(_0x44cf0f){return function(_0x417fe2){if(_0x417fe2){return _0x417fe2['destroy']()[_0x3f96('0x15')](function(){_0x44cf0f[_0x3f96('0x1f')](0xcc)[_0x3f96('0x28')]();});}};}function handleEntityNotFound(_0x1da497){return function(_0x361ef0){if(!_0x361ef0){_0x1da497[_0x3f96('0x29')](0x194);}return _0x361ef0;};}function handleError(_0x33e778,_0x156ff2){_0x156ff2=_0x156ff2||0x1f4;return function(_0x4e901f){logger['error'](_0x4e901f['stack']);if(_0x4e901f[_0x3f96('0x2a')]){delete _0x4e901f[_0x3f96('0x2a')];}_0x33e778[_0x3f96('0x1f')](_0x156ff2)[_0x3f96('0x2b')](_0x4e901f);};}exports[_0x3f96('0x2c')]=function(_0x4ef303,_0x166163){var _0x460b08={},_0x2c596d={},_0x5bcfeb={'count':0x0,'rows':[]};var _0x160678=_['map'](db[_0x3f96('0x2d')]['rawAttributes'],function(_0x269f22){return{'name':_0x269f22['fieldName'],'type':_0x269f22['type']['key']};});_0x2c596d[_0x3f96('0x2e')]=_['map'](_0x160678,_0x3f96('0x2a'));_0x2c596d[_0x3f96('0x2f')]=_['keys'](_0x4ef303['query']);_0x2c596d[_0x3f96('0x30')]=_[_0x3f96('0x31')](_0x2c596d[_0x3f96('0x2e')],_0x2c596d[_0x3f96('0x2f')]);_0x460b08[_0x3f96('0x32')]=_[_0x3f96('0x31')](_0x2c596d[_0x3f96('0x2e')],qs[_0x3f96('0x33')](_0x4ef303[_0x3f96('0x2f')][_0x3f96('0x33')]));_0x460b08[_0x3f96('0x32')]=_0x460b08['attributes'][_0x3f96('0x34')]?_0x460b08[_0x3f96('0x32')]:_0x2c596d['model'];if(!_0x4ef303[_0x3f96('0x2f')][_0x3f96('0x35')]('nolimit')){_0x460b08[_0x3f96('0x23')]=qs['limit'](_0x4ef303[_0x3f96('0x2f')][_0x3f96('0x23')]);_0x460b08[_0x3f96('0x21')]=qs['offset'](_0x4ef303[_0x3f96('0x2f')]['offset']);}_0x460b08[_0x3f96('0x36')]=qs[_0x3f96('0x37')](_0x4ef303['query'][_0x3f96('0x37')]);_0x460b08[_0x3f96('0x38')]=qs[_0x3f96('0x30')](_[_0x3f96('0x39')](_0x4ef303['query'],_0x2c596d['filters']),_0x160678);if(_0x4ef303[_0x3f96('0x2f')][_0x3f96('0x3a')]){_0x460b08[_0x3f96('0x38')]=_[_0x3f96('0x3b')](_0x460b08['where'],{'$or':_['map'](_0x160678,function(_0x441bed){if(_0x441bed[_0x3f96('0x3c')]!==_0x3f96('0x3d')){var _0x3cfd50={};_0x3cfd50[_0x441bed[_0x3f96('0x2a')]]={'$like':'%'+_0x4ef303['query'][_0x3f96('0x3a')]+'%'};return _0x3cfd50;}})});}_0x460b08=_['merge']({},_0x460b08,_0x4ef303[_0x3f96('0x3e')]);var _0x3c472a={'where':_0x460b08[_0x3f96('0x38')]};return db[_0x3f96('0x2d')]['count'](_0x3c472a)['then'](function(_0x3e9f62){_0x5bcfeb[_0x3f96('0x24')]=_0x3e9f62;if(_0x4ef303['query']['includeAll']){_0x460b08[_0x3f96('0x3f')]=[{'all':!![]}];}return db[_0x3f96('0x2d')][_0x3f96('0x40')](_0x460b08);})[_0x3f96('0x15')](function(_0x5179a0){_0x5bcfeb[_0x3f96('0x41')]=_0x5179a0;return _0x5bcfeb;})[_0x3f96('0x15')](respondWithFilteredResult(_0x166163,_0x460b08))[_0x3f96('0x42')](handleError(_0x166163,null));};exports[_0x3f96('0x43')]=function(_0xecf915,_0x10e7d2){var _0xf00daa={'raw':!![],'where':{'id':_0xecf915[_0x3f96('0x44')]['id']}},_0x3f22fc={};_0x3f22fc[_0x3f96('0x2e')]=_[_0x3f96('0x45')](db[_0x3f96('0x2d')][_0x3f96('0x46')]);_0x3f22fc[_0x3f96('0x2f')]=_[_0x3f96('0x45')](_0xecf915['query']);_0x3f22fc[_0x3f96('0x30')]=_[_0x3f96('0x31')](_0x3f22fc[_0x3f96('0x2e')],_0x3f22fc[_0x3f96('0x2f')]);_0xf00daa[_0x3f96('0x32')]=_[_0x3f96('0x31')](_0x3f22fc[_0x3f96('0x2e')],qs['fields'](_0xecf915[_0x3f96('0x2f')][_0x3f96('0x33')]));_0xf00daa[_0x3f96('0x32')]=_0xf00daa['attributes'][_0x3f96('0x34')]?_0xf00daa[_0x3f96('0x32')]:_0x3f22fc[_0x3f96('0x2e')];if(_0xecf915['query']['includeAll']){_0xf00daa[_0x3f96('0x3f')]=[{'all':!![]}];}_0xf00daa=_['merge']({},_0xf00daa,_0xecf915[_0x3f96('0x3e')]);return db[_0x3f96('0x2d')][_0x3f96('0x47')](_0xf00daa)[_0x3f96('0x15')](handleEntityNotFound(_0x10e7d2,null))[_0x3f96('0x15')](respondWithResult(_0x10e7d2,null))['catch'](handleError(_0x10e7d2,null));};exports['update']=function(_0x4d1571,_0x2730d5){if(_0x4d1571[_0x3f96('0x48')]['id']){delete _0x4d1571[_0x3f96('0x48')]['id'];}return db[_0x3f96('0x2d')][_0x3f96('0x47')]({'where':{'id':_0x4d1571[_0x3f96('0x44')]['id']}})['then'](handleEntityNotFound(_0x2730d5,null))[_0x3f96('0x15')](saveUpdates(_0x4d1571[_0x3f96('0x48')],null))['then'](respondWithResult(_0x2730d5,null))[_0x3f96('0x42')](handleError(_0x2730d5,null));};exports[_0x3f96('0x49')]=function(_0x5708b9,_0x4a70bd){return db['MailMessage']['find']({'where':{'id':_0x5708b9[_0x3f96('0x44')]['id']}})[_0x3f96('0x15')](handleEntityNotFound(_0x4a70bd,null))[_0x3f96('0x15')](removeEntity(_0x4a70bd,null))[_0x3f96('0x42')](handleError(_0x4a70bd,null));};exports[_0x3f96('0x4a')]=function(_0x2dc8f9,_0x39e66a){return db[_0x3f96('0x2d')]['describe']()['then'](respondWithResult(_0x39e66a,null))[_0x3f96('0x42')](handleError(_0x39e66a,null));};exports[_0x3f96('0x4b')]=function(_0x567cb1,_0x40e8d0){return db[_0x3f96('0x2d')]['create'](_0x567cb1[_0x3f96('0x48')])[_0x3f96('0x15')](function(_0x5b5d8f){if(_0x5b5d8f){if(_0x5b5d8f[_0x3f96('0x4c')]==='out'&&!_0x5b5d8f[_0x3f96('0x4d')]){var _0x1df2f0,_0x53997e,_0x2a29b1;if(_0x567cb1[_0x3f96('0x48')]['to']){_0x53997e=_0x567cb1[_0x3f96('0x48')]['to'][_0x3f96('0x4e')](',')[0x0];}return db[_0x3f96('0x4f')]['findOne']({'where':{'id':_0x5b5d8f[_0x3f96('0x50')]},'include':[{'model':db[_0x3f96('0x51')],'as':'List','include':[{'model':db[_0x3f96('0x52')],'as':_0x3f96('0x53'),'where':{'email':_0x53997e},'limit':0x1,'order':[[_0x3f96('0x54'),_0x3f96('0x55')]]}]},{'model':db[_0x3f96('0x56')],'as':_0x3f96('0x57'),'raw':!![],'include':[{'model':db[_0x3f96('0x58')],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x1d526e){_0x1df2f0=_0x1d526e;if(!_0x1df2f0||!_0x1df2f0[_0x3f96('0x57')])return;var _0x16b16b=_0x1df2f0['getSmtpOptions']();if(_0x567cb1[_0x3f96('0x48')][_0x3f96('0x59')]&&_0x567cb1[_0x3f96('0x48')][_0x3f96('0x59')][_0x3f96('0x34')]){for(var _0x5e357d=0x0;_0x5e357d<_0x567cb1[_0x3f96('0x48')][_0x3f96('0x59')][_0x3f96('0x34')];_0x5e357d+=0x1){_0x567cb1['body'][_0x3f96('0x59')][_0x5e357d]={'filename':_0x567cb1[_0x3f96('0x48')][_0x3f96('0x59')][_0x5e357d][_0x3f96('0x2a')],'path':path[_0x3f96('0x5a')](config[_0x3f96('0x5b')],_0x3f96('0x5c'),_0x567cb1['body'][_0x3f96('0x59')][_0x5e357d][_0x3f96('0x5d')])};}}_0x2a29b1={'account':_0x16b16b,'message':_0x567cb1[_0x3f96('0x48')]};return;})['then'](function(){if(_0x1df2f0[_0x3f96('0x5e')]){if(_0x1df2f0['List'][_0x3f96('0x53')][_0x3f96('0x34')]){return _0x1df2f0[_0x3f96('0x5e')][_0x3f96('0x53')][0x0];}else{return db[_0x3f96('0x52')]['create'](_[_0x3f96('0x5f')](_0x567cb1[_0x3f96('0x48')],{'firstName':_0x567cb1[_0x3f96('0x48')]['to'],'email':_0x567cb1['body']['to'],'phone':_0x567cb1[_0x3f96('0x48')]['to'],'ListId':_0x1df2f0[_0x3f96('0x60')]}));}}else{throw new Error(_0x3f96('0x61'));}})[_0x3f96('0x15')](function(){if(_0x2a29b1){return respondWithRpcPromise(_0x3f96('0x62'),_0x3f96('0x63'),_0x2a29b1,client9003)[_0x3f96('0x15')](function(_0x5a381d){return _0x5b5d8f[_0x3f96('0x27')]({'read':!![],'messageId':_0x5a381d[_0x3f96('0x64')],'sentAt':moment()['format'](_0x3f96('0x65'))});})[_0x3f96('0x42')](function(_0x1ae233){logger[_0x3f96('0x1b')]('%s',JSON['stringify'](_0x1ae233));return _0x5b5d8f;});}return _0x5b5d8f;});}return _0x5b5d8f;}})[_0x3f96('0x15')](respondWithResult(_0x40e8d0,0xc9))[_0x3f96('0x42')](handleError(_0x40e8d0,null));};exports[_0x3f96('0x66')]=function(_0x5ad5ac,_0x2a54e1){var _0xf15332={'agent':{},'channel':'mail'};if(_0x5ad5ac[_0x3f96('0x48')]['id']){delete _0x5ad5ac[_0x3f96('0x48')]['id'];}_0x5ad5ac[_0x3f96('0x48')][_0x3f96('0x67')]=!![];_0x5ad5ac[_0x3f96('0x48')][_0x3f96('0x68')]=moment()[_0x3f96('0x69')](_0x3f96('0x65'));_0x5ad5ac['body'][_0x3f96('0x6a')]=_0x5ad5ac[_0x3f96('0x48')][_0x3f96('0x6a')]||_0x5ad5ac[_0x3f96('0x6b')]['id'];_0xf15332[_0x3f96('0x6c')]['id']=_0x5ad5ac[_0x3f96('0x48')][_0x3f96('0x6a')];return db[_0x3f96('0x2d')][_0x3f96('0x47')]({'where':{'id':_0x5ad5ac[_0x3f96('0x44')]['id'],'UserId':null}})[_0x3f96('0x15')](handleEntityNotFound(_0x2a54e1,null))[_0x3f96('0x15')](saveUpdates(_0x5ad5ac['body'],null))[_0x3f96('0x15')](function(_0x4cf355){if(_0x4cf355){_0xf15332['message']=_0x4cf355['get']({'plain':!![]});return db[_0x3f96('0x6d')]['find']({'where':{'id':_0x4cf355['MailInteractionId']}});}return null;})[_0x3f96('0x15')](handleEntityNotFound(_0x2a54e1,null))[_0x3f96('0x15')](function(_0x12e663){if(_0x12e663){return _0x12e663['update']({'UserId':_0x5ad5ac[_0x3f96('0x48')][_0x3f96('0x6a')],'read1stAt':_[_0x3f96('0x6e')](_0x12e663[_0x3f96('0x6f')])?moment()[_0x3f96('0x69')](_0x3f96('0x65')):undefined});}return null;})[_0x3f96('0x15')](function(_0x1bcf05){if(_0x1bcf05){_0xf15332[_0x3f96('0x70')]=_0x1bcf05[_0x3f96('0x71')]({'plain':!![]});interaction_log[_0x3f96('0x16')](_0x3f96('0x72'),_0x5ad5ac[_0x3f96('0x6b')]['id'],_0x5ad5ac['user'][_0x3f96('0x2a')],_0x5ad5ac[_0x3f96('0x6b')][_0x3f96('0x73')],_0xf15332[_0x3f96('0x70')]['id'],_0x5ad5ac[_0x3f96('0x48')]?JSON[_0x3f96('0x74')](_0x5ad5ac['body']):_0x3f96('0x75'));return respondWithRpcPromise(_0x3f96('0x76'),_0x3f96('0x77'),_0xf15332);}return null;})[_0x3f96('0x15')](function(_0xfba808){var _0x312289=_0x3f96('0x78')+_0xfba808[_0x3f96('0x1d')][_0x3f96('0x79')];return db['sequelize'][_0x3f96('0x2f')](_0x312289,{'type':db[_0x3f96('0x7a')]['QueryTypes'][_0x3f96('0x7b')],'raw':!![]})[_0x3f96('0x15')](function(_0x17470d){return _0x17470d;});})[_0x3f96('0x15')](function(_0x9b0ff8){if(_0x9b0ff8){_0xf15332['message'][_0x3f96('0x7c')]=_0x9b0ff8[0x0];if(!_0x5ad5ac[_0x3f96('0x48')][_0x3f96('0x6a')])return;return db[_0x3f96('0x7d')][_0x3f96('0x47')]({'where':{'id':_0x5ad5ac[_0x3f96('0x48')][_0x3f96('0x6a')],'role':_0x3f96('0x6c')},'attributes':['id','name',_0x3f96('0x7e'),_0x3f96('0x7f'),_0x3f96('0x80')],'raw':!![]});}return null;})[_0x3f96('0x15')](function(_0x54cab1){if(!_0x54cab1)return null;_0xf15332[_0x3f96('0x1d')][_0x3f96('0x6c')]=_0x54cab1;return _0xf15332;})[_0x3f96('0x15')](function(_0x44b323){if(_0x44b323){if(_0x5ad5ac[_0x3f96('0x48')][_0x3f96('0x81')]){_0xf15332[_0x3f96('0x1d')][_0x3f96('0x82')]=util[_0x3f96('0x69')](_0x3f96('0x83'),_0x5ad5ac[_0x3f96('0x6b')][_0x3f96('0x2a')]);_0xf15332[_0x3f96('0x1d')][_0x3f96('0x84')]=_0xf15332[_0x3f96('0x84')];_0xf15332[_0x3f96('0x1d')][_0x3f96('0x85')]=_0xf15332[_0x3f96('0x84')];_0xf15332['message'][_0x3f96('0x86')]=_0x3f96('0x66');_0xf15332[_0x3f96('0x1d')][_0x3f96('0x48')]=htmlToText[_0x3f96('0x87')](_0xf15332[_0x3f96('0x1d')]['body']);return respondWithRpcPromise(_0x3f96('0x88'),_0x3f96('0x88'),{'event':'acceptmessage','message':_0xf15332[_0x3f96('0x1d')]},client9002)[_0x3f96('0x15')](function(){return _0xf15332;});}return _0xf15332;}return null;})[_0x3f96('0x15')](respondWithResult(_0x2a54e1,null))['catch'](handleError(_0x2a54e1,null));};exports['reject']=function(_0x53545e,_0x1d402f){var _0x137dae={'agent':{},'channel':'mail'};if(_0x53545e['body']['id']){delete _0x53545e[_0x3f96('0x48')]['id'];}_0x53545e['body'][_0x3f96('0x6a')]=_0x53545e[_0x3f96('0x48')][_0x3f96('0x6a')]||_0x53545e['user']['id'];_0x137dae[_0x3f96('0x6c')]['id']=_0x53545e[_0x3f96('0x48')][_0x3f96('0x6a')];return db['MailMessage'][_0x3f96('0x47')]({'where':{'id':_0x53545e['params']['id'],'UserId':null}})[_0x3f96('0x15')](handleEntityNotFound(_0x1d402f,null))[_0x3f96('0x15')](function(_0x557bfc){if(_0x557bfc){_0x137dae[_0x3f96('0x1d')]=_0x557bfc[_0x3f96('0x71')]({'plain':!![]});return db[_0x3f96('0x6d')][_0x3f96('0x47')]({'where':{'id':_0x557bfc[_0x3f96('0x89')]}});}return null;})[_0x3f96('0x15')](handleEntityNotFound(_0x1d402f,null))[_0x3f96('0x15')](function(_0x6a010a){if(_0x6a010a){_0x137dae[_0x3f96('0x70')]=_0x6a010a['get']({'plain':!![]});interaction_log[_0x3f96('0x16')](_0x3f96('0x8a'),_0x53545e[_0x3f96('0x6b')]['id'],_0x53545e['user'][_0x3f96('0x2a')],_0x53545e[_0x3f96('0x6b')][_0x3f96('0x73')],_0x137dae[_0x3f96('0x70')]['id'],_0x53545e['body']?JSON[_0x3f96('0x74')](_0x53545e[_0x3f96('0x48')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x137dae);}return null;})['then'](function(_0x461b59){var _0x124e75='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x461b59[_0x3f96('0x1d')][_0x3f96('0x79')];return db['sequelize'][_0x3f96('0x2f')](_0x124e75,{'type':db[_0x3f96('0x7a')][_0x3f96('0x8b')][_0x3f96('0x7b')],'raw':!![]})[_0x3f96('0x15')](function(_0x12a731){return _0x12a731;});})[_0x3f96('0x15')](function(_0x39fce8){if(_0x39fce8){_0x137dae[_0x3f96('0x1d')][_0x3f96('0x7c')]=_0x39fce8[0x0];if(!_0x53545e[_0x3f96('0x48')][_0x3f96('0x6a')])return;return db[_0x3f96('0x7d')]['find']({'where':{'id':_0x53545e['body']['UserId'],'role':_0x3f96('0x6c')},'attributes':['id',_0x3f96('0x2a'),'fullname','email',_0x3f96('0x80')],'raw':!![]});}return null;})[_0x3f96('0x15')](function(_0x5d300f){if(!_0x5d300f)return null;_0x137dae[_0x3f96('0x1d')][_0x3f96('0x6c')]=_0x5d300f;return _0x137dae;})['then'](function(_0x2e768f){if(_0x2e768f){_0x2e768f['message'][_0x3f96('0x82')]=util[_0x3f96('0x69')]('SIP/%s',_0x53545e[_0x3f96('0x6b')][_0x3f96('0x2a')]);_0x2e768f['message'][_0x3f96('0x84')]=_0x137dae[_0x3f96('0x84')];_0x2e768f['message'][_0x3f96('0x85')]=_0x137dae['channel'];_0x2e768f[_0x3f96('0x1d')][_0x3f96('0x86')]='reject';_0x2e768f['message'][_0x3f96('0x48')]=htmlToText[_0x3f96('0x87')](_0x137dae['message'][_0x3f96('0x48')]);respondWithRpcPromise(_0x3f96('0x88'),'EventManager',{'event':_0x3f96('0x8c'),'message':_0x2e768f['message']},client9002);return _0x137dae;}return null;})[_0x3f96('0x15')](respondWithResult(_0x1d402f,null))['catch'](handleError(_0x1d402f,null));};exports[_0x3f96('0x8d')]=function(_0x42d103,_0x47fa10){var _0x199969=moment()[_0x3f96('0x8e')]()['toString']();var _0x25967d=path[_0x3f96('0x5a')](config['root'],_0x3f96('0x8f'),_0x3f96('0x90'),_0x3f96('0x91'));var _0x13499e=path[_0x3f96('0x5a')](config[_0x3f96('0x5b')],_0x3f96('0x8f'),_0x3f96('0x90'),'attachments');var _0x5b1159=util[_0x3f96('0x69')]('message-%s.eml',_0x199969);return db[_0x3f96('0x2d')]['find']({'where':{'id':_0x42d103[_0x3f96('0x44')]['id']},'attributes':['id',_0x3f96('0x48'),_0x3f96('0x92'),'to','cc',_0x3f96('0x93'),_0x3f96('0x94'),_0x3f96('0x95')],'include':_0x42d103[_0x3f96('0x2f')][_0x3f96('0x59')]?[{'model':db[_0x3f96('0x96')],'as':_0x3f96('0x97')}]:undefined})[_0x3f96('0x15')](handleEntityNotFound(_0x47fa10,null))['then'](function(_0x16bb88){if(_0x16bb88){var _0x2f55f3=_0x16bb88;var _0x147ecc={'from':_0x2f55f3[_0x3f96('0x92')],'to':_0x2f55f3['to'],'subject':_0x2f55f3[_0x3f96('0x94')],'html':htmlEntities[_0x3f96('0x98')](_0x2f55f3[_0x3f96('0x48')]),'headers':{'Date':moment(_0x2f55f3['createdAt'])[_0x3f96('0x69')](_0x3f96('0x99'))},'attachments':[]};if(_0x16bb88['cc']){_0x147ecc[_0x3f96('0x9a')]['Cc']=_0x16bb88['cc'];}if(_0x16bb88[_0x3f96('0x93')]){_0x147ecc[_0x3f96('0x9a')][_0x3f96('0x9b')]=_0x16bb88['bcc'];}return new BPromise(function(_0x289507,_0x72cfe0){if(_0x16bb88['Attachments']){for(var _0x9bee15=0x0;_0x9bee15<_0x16bb88[_0x3f96('0x97')][_0x3f96('0x34')];_0x9bee15++){var _0x696c94=_0x16bb88[_0x3f96('0x97')][_0x9bee15];var _0x4a8970=path[_0x3f96('0x5a')](_0x13499e,_0x696c94[_0x3f96('0x5d')]);if(fs[_0x3f96('0x9c')](_0x4a8970)){_0x147ecc[_0x3f96('0x59')][_0x3f96('0x9d')]({'name':_0x696c94[_0x3f96('0x2a')],'contentType':_0x696c94['type'],'data':fs['readFileSync'](_0x4a8970)});}}}emlformat['build'](_0x147ecc,function(_0x4ea67a,_0x5d8ff2){if(_0x4ea67a)return _0x72cfe0(_0x4ea67a);fs[_0x3f96('0x9e')](path[_0x3f96('0x5a')](_0x25967d,_0x5b1159),_0x5d8ff2);return _0x289507(_0x5d8ff2);});});}})['then'](function(_0x46cecd){if(_0x46cecd){return _0x47fa10['download'](path[_0x3f96('0x5a')](_0x25967d,_0x5b1159),_0x5b1159,function(_0x819ca9){if(!_0x819ca9)fs[_0x3f96('0x9f')](path['join'](_0x25967d,_0x5b1159));});}})['catch'](handleError(_0x47fa10,null));}; \ No newline at end of file +var _0xad1b=['find','body','describe','create','direction','secret','split','MailAccount','findOne','MailAccountId','CmList','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','basename','List','Contacts','CmContact','ListId','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','mail','UserId','agent','get','MailInteraction','MailInteractionId','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','fullname','internal','manual','SIP/%s','channel','accept','fromString','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','QueryTypes','contact','email','interface','motionChannel','event','EventManager','rejectmessage','download','toString','root','server','tmp','message-%s.eml','from','bcc','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','push','writeFileSync','eml-format','bluebird','util','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','json','offset','undefined','count','limit','status','set','Content-Range','update','then','destroy','end','sendStatus','name','send','index','map','MailMessage','rawAttributes','fieldName','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','options','include','rows','show','params','keys','includeAll'];(function(_0x3fd3a3,_0x36c863){var _0xa3e4d5=function(_0x1fd03b){while(--_0x1fd03b){_0x3fd3a3['push'](_0x3fd3a3['shift']());}};_0xa3e4d5(++_0x36c863);}(_0xad1b,0x189));var _0xbad1=function(_0x3e89f0,_0x11e31b){_0x3e89f0=_0x3e89f0-0x0;var _0xc947a1=_0xad1b[_0x3e89f0];return _0xc947a1;};'use strict';var emlformat=require(_0xbad1('0x0'));var moment=require('moment');var BPromise=require(_0xbad1('0x1'));var util=require(_0xbad1('0x2'));var path=require(_0xbad1('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xbad1('0x4'));var htmlToText=require(_0xbad1('0x5'));var qs=require(_0xbad1('0x6'));var logger=require(_0xbad1('0x7'))(_0xbad1('0x8'));var interaction_log=require(_0xbad1('0x7'))(_0xbad1('0x9'));var config=require(_0xbad1('0xa'));var db=require(_0xbad1('0xb'))['db'];config[_0xbad1('0xc')]=_[_0xbad1('0xd')](config[_0xbad1('0xc')],{'host':_0xbad1('0xe'),'port':0x18eb});var socket=require(_0xbad1('0xf'))(new Redis(config['redis']));var htmlEntities=require(_0xbad1('0x10'));require(_0xbad1('0x11'))[_0xbad1('0x12')](socket);var jayson=require(_0xbad1('0x13'));var client=jayson[_0xbad1('0x14')][_0xbad1('0x15')]({'port':0x232c});var client9003=jayson['client'][_0xbad1('0x15')]({'port':0x232b});var client9002=jayson[_0xbad1('0x14')][_0xbad1('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x51035a,_0x5be876,_0x1150ab,_0x18052d){return new BPromise(function(_0x72446f,_0x3c09c6){var _0x1ca977=_0x18052d||client;return _0x1ca977[_0xbad1('0x16')](_0x51035a,_0x1150ab)['then'](function(_0x4dffe2){logger[_0xbad1('0x17')](_0xbad1('0x18'),_0x5be876,_0xbad1('0x19'));logger['debug'](_0xbad1('0x1a'),_0x5be876,_0xbad1('0x19'),JSON[_0xbad1('0x1b')](_0x4dffe2));if(_0x4dffe2[_0xbad1('0x1c')]){if(_0x4dffe2['error'][_0xbad1('0x1d')]===0x1f4){logger[_0xbad1('0x1c')](_0xbad1('0x18'),_0x5be876,_0x4dffe2[_0xbad1('0x1c')][_0xbad1('0x1e')]);return _0x3c09c6(_0x4dffe2[_0xbad1('0x1c')][_0xbad1('0x1e')]);}logger['error'](_0xbad1('0x18'),_0x5be876,_0x4dffe2[_0xbad1('0x1c')][_0xbad1('0x1e')]);return _0x72446f(_0x4dffe2[_0xbad1('0x1c')]['message']);}else{logger[_0xbad1('0x17')](_0xbad1('0x18'),_0x5be876,_0xbad1('0x19'));_0x72446f(_0x4dffe2[_0xbad1('0x1f')][_0xbad1('0x1e')]);}})[_0xbad1('0x20')](function(_0x59f3db){logger['error'](_0xbad1('0x18'),_0x5be876,_0x59f3db);_0x3c09c6(_0x59f3db);});});}function respondWithResult(_0x28d356,_0x2d633a){_0x2d633a=_0x2d633a||0xc8;return function(_0xd937df){if(_0xd937df){return _0x28d356['status'](_0x2d633a)[_0xbad1('0x21')](_0xd937df);}};}function respondWithFilteredResult(_0x40ff8e,_0x25b689){return function(_0x4894af){if(_0x4894af){var _0x1dadb2=typeof _0x25b689[_0xbad1('0x22')]===_0xbad1('0x23')&&typeof _0x25b689['limit']===_0xbad1('0x23');var _0x3737ad=_0x4894af[_0xbad1('0x24')];var _0x17b2dd=_0x1dadb2?0x0:_0x25b689[_0xbad1('0x22')];var _0x12e1a6=_0x1dadb2?_0x4894af[_0xbad1('0x24')]:_0x25b689[_0xbad1('0x22')]+_0x25b689[_0xbad1('0x25')];var _0x3ff66e;if(_0x12e1a6>=_0x3737ad){_0x12e1a6=_0x3737ad;_0x3ff66e=0xc8;}else{_0x3ff66e=0xce;}_0x40ff8e[_0xbad1('0x26')](_0x3ff66e);return _0x40ff8e[_0xbad1('0x27')](_0xbad1('0x28'),_0x17b2dd+'-'+_0x12e1a6+'/'+_0x3737ad)[_0xbad1('0x21')](_0x4894af);}return null;};}function saveUpdates(_0x1e5cb7){return function(_0x3f93ea){if(_0x3f93ea){return _0x3f93ea[_0xbad1('0x29')](_0x1e5cb7)[_0xbad1('0x2a')](function(_0x89c1f7){return _0x89c1f7;});}return null;};}function removeEntity(_0x18c184){return function(_0x1b3d0a){if(_0x1b3d0a){return _0x1b3d0a[_0xbad1('0x2b')]()[_0xbad1('0x2a')](function(){_0x18c184[_0xbad1('0x26')](0xcc)[_0xbad1('0x2c')]();});}};}function handleEntityNotFound(_0x406d76){return function(_0x58c180){if(!_0x58c180){_0x406d76[_0xbad1('0x2d')](0x194);}return _0x58c180;};}function handleError(_0x5f7212,_0x5c9892){_0x5c9892=_0x5c9892||0x1f4;return function(_0x1a4fd8){logger[_0xbad1('0x1c')](_0x1a4fd8['stack']);if(_0x1a4fd8[_0xbad1('0x2e')]){delete _0x1a4fd8[_0xbad1('0x2e')];}_0x5f7212['status'](_0x5c9892)[_0xbad1('0x2f')](_0x1a4fd8);};}exports[_0xbad1('0x30')]=function(_0x3ca194,_0x4c7053){var _0x5b4e0e={},_0x55237a={},_0x4c78aa={'count':0x0,'rows':[]};var _0x1e756b=_[_0xbad1('0x31')](db[_0xbad1('0x32')][_0xbad1('0x33')],function(_0x198971){return{'name':_0x198971[_0xbad1('0x34')],'type':_0x198971['type']['key']};});_0x55237a['model']=_['map'](_0x1e756b,'name');_0x55237a['query']=_['keys'](_0x3ca194['query']);_0x55237a[_0xbad1('0x35')]=_[_0xbad1('0x36')](_0x55237a['model'],_0x55237a[_0xbad1('0x37')]);_0x5b4e0e[_0xbad1('0x38')]=_['intersection'](_0x55237a[_0xbad1('0x39')],qs[_0xbad1('0x3a')](_0x3ca194[_0xbad1('0x37')][_0xbad1('0x3a')]));_0x5b4e0e[_0xbad1('0x38')]=_0x5b4e0e[_0xbad1('0x38')][_0xbad1('0x3b')]?_0x5b4e0e[_0xbad1('0x38')]:_0x55237a[_0xbad1('0x39')];if(!_0x3ca194[_0xbad1('0x37')][_0xbad1('0x3c')](_0xbad1('0x3d'))){_0x5b4e0e[_0xbad1('0x25')]=qs['limit'](_0x3ca194[_0xbad1('0x37')][_0xbad1('0x25')]);_0x5b4e0e['offset']=qs[_0xbad1('0x22')](_0x3ca194['query'][_0xbad1('0x22')]);}_0x5b4e0e[_0xbad1('0x3e')]=qs[_0xbad1('0x3f')](_0x3ca194[_0xbad1('0x37')][_0xbad1('0x3f')]);_0x5b4e0e['where']=qs['filters'](_[_0xbad1('0x40')](_0x3ca194['query'],_0x55237a['filters']),_0x1e756b);if(_0x3ca194['query']['filter']){_0x5b4e0e[_0xbad1('0x41')]=_[_0xbad1('0x42')](_0x5b4e0e['where'],{'$or':_[_0xbad1('0x31')](_0x1e756b,function(_0x193772){if(_0x193772[_0xbad1('0x43')]!=='VIRTUAL'){var _0x63e19a={};_0x63e19a[_0x193772[_0xbad1('0x2e')]]={'$like':'%'+_0x3ca194[_0xbad1('0x37')]['filter']+'%'};return _0x63e19a;}})});}_0x5b4e0e=_[_0xbad1('0x42')]({},_0x5b4e0e,_0x3ca194[_0xbad1('0x44')]);var _0x5794f7={'where':_0x5b4e0e[_0xbad1('0x41')]};return db[_0xbad1('0x32')][_0xbad1('0x24')](_0x5794f7)['then'](function(_0x1c63d9){_0x4c78aa[_0xbad1('0x24')]=_0x1c63d9;if(_0x3ca194[_0xbad1('0x37')]['includeAll']){_0x5b4e0e[_0xbad1('0x45')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x5b4e0e);})[_0xbad1('0x2a')](function(_0x32f096){_0x4c78aa[_0xbad1('0x46')]=_0x32f096;return _0x4c78aa;})[_0xbad1('0x2a')](respondWithFilteredResult(_0x4c7053,_0x5b4e0e))['catch'](handleError(_0x4c7053,null));};exports[_0xbad1('0x47')]=function(_0x1ba146,_0x23bf3c){var _0xc0fc3c={'raw':!![],'where':{'id':_0x1ba146[_0xbad1('0x48')]['id']}},_0x2d89d0={};_0x2d89d0[_0xbad1('0x39')]=_[_0xbad1('0x49')](db[_0xbad1('0x32')][_0xbad1('0x33')]);_0x2d89d0[_0xbad1('0x37')]=_[_0xbad1('0x49')](_0x1ba146[_0xbad1('0x37')]);_0x2d89d0['filters']=_['intersection'](_0x2d89d0[_0xbad1('0x39')],_0x2d89d0[_0xbad1('0x37')]);_0xc0fc3c[_0xbad1('0x38')]=_[_0xbad1('0x36')](_0x2d89d0[_0xbad1('0x39')],qs[_0xbad1('0x3a')](_0x1ba146[_0xbad1('0x37')][_0xbad1('0x3a')]));_0xc0fc3c[_0xbad1('0x38')]=_0xc0fc3c[_0xbad1('0x38')][_0xbad1('0x3b')]?_0xc0fc3c[_0xbad1('0x38')]:_0x2d89d0[_0xbad1('0x39')];if(_0x1ba146[_0xbad1('0x37')][_0xbad1('0x4a')]){_0xc0fc3c[_0xbad1('0x45')]=[{'all':!![]}];}_0xc0fc3c=_[_0xbad1('0x42')]({},_0xc0fc3c,_0x1ba146['options']);return db['MailMessage'][_0xbad1('0x4b')](_0xc0fc3c)[_0xbad1('0x2a')](handleEntityNotFound(_0x23bf3c,null))['then'](respondWithResult(_0x23bf3c,null))[_0xbad1('0x20')](handleError(_0x23bf3c,null));};exports[_0xbad1('0x29')]=function(_0x18aedc,_0x46f851){if(_0x18aedc[_0xbad1('0x4c')]['id']){delete _0x18aedc[_0xbad1('0x4c')]['id'];}return db[_0xbad1('0x32')][_0xbad1('0x4b')]({'where':{'id':_0x18aedc[_0xbad1('0x48')]['id']}})[_0xbad1('0x2a')](handleEntityNotFound(_0x46f851,null))[_0xbad1('0x2a')](saveUpdates(_0x18aedc['body'],null))[_0xbad1('0x2a')](respondWithResult(_0x46f851,null))[_0xbad1('0x20')](handleError(_0x46f851,null));};exports[_0xbad1('0x2b')]=function(_0x50fc33,_0x1918a2){return db[_0xbad1('0x32')][_0xbad1('0x4b')]({'where':{'id':_0x50fc33[_0xbad1('0x48')]['id']}})['then'](handleEntityNotFound(_0x1918a2,null))[_0xbad1('0x2a')](removeEntity(_0x1918a2,null))[_0xbad1('0x20')](handleError(_0x1918a2,null));};exports[_0xbad1('0x4d')]=function(_0x5b1e84,_0x2470a9){return db[_0xbad1('0x32')][_0xbad1('0x4d')]()[_0xbad1('0x2a')](respondWithResult(_0x2470a9,null))[_0xbad1('0x20')](handleError(_0x2470a9,null));};exports[_0xbad1('0x4e')]=function(_0x28c25b,_0x33fcfb){return db[_0xbad1('0x32')][_0xbad1('0x4e')](_0x28c25b[_0xbad1('0x4c')])[_0xbad1('0x2a')](function(_0x24761d){if(_0x24761d){if(_0x24761d[_0xbad1('0x4f')]==='out'&&!_0x24761d[_0xbad1('0x50')]){var _0x7739e8,_0x37d3cf,_0x150141;if(_0x28c25b[_0xbad1('0x4c')]['to']){_0x37d3cf=_0x28c25b['body']['to'][_0xbad1('0x51')](',')[0x0];}return db[_0xbad1('0x52')][_0xbad1('0x53')]({'where':{'id':_0x24761d[_0xbad1('0x54')]},'include':[{'model':db[_0xbad1('0x55')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x37d3cf},'limit':0x1,'order':[[_0xbad1('0x56'),'DESC']]}]},{'model':db[_0xbad1('0x57')],'as':_0xbad1('0x58'),'raw':!![],'include':[{'model':db[_0xbad1('0x59')],'as':_0xbad1('0x59'),'raw':!![]}]}]})[_0xbad1('0x2a')](function(_0x4677a5){_0x7739e8=_0x4677a5;if(!_0x7739e8||!_0x7739e8[_0xbad1('0x58')])return;var _0x11aa56=_0x7739e8[_0xbad1('0x5a')]();if(_0x28c25b['body']['attachments']&&_0x28c25b[_0xbad1('0x4c')][_0xbad1('0x5b')][_0xbad1('0x3b')]){for(var _0x36250f=0x0;_0x36250f<_0x28c25b['body'][_0xbad1('0x5b')][_0xbad1('0x3b')];_0x36250f+=0x1){_0x28c25b[_0xbad1('0x4c')]['attachments'][_0x36250f]={'filename':_0x28c25b[_0xbad1('0x4c')]['attachments'][_0x36250f]['name'],'path':path[_0xbad1('0x5c')](config['root'],_0xbad1('0x5d'),_0x28c25b[_0xbad1('0x4c')]['attachments'][_0x36250f][_0xbad1('0x5e')])};}}_0x150141={'account':_0x11aa56,'message':_0x28c25b[_0xbad1('0x4c')]};return;})[_0xbad1('0x2a')](function(){if(_0x7739e8[_0xbad1('0x5f')]){if(_0x7739e8[_0xbad1('0x5f')][_0xbad1('0x60')][_0xbad1('0x3b')]){return _0x7739e8[_0xbad1('0x5f')][_0xbad1('0x60')][0x0];}else{return db[_0xbad1('0x61')][_0xbad1('0x4e')](_[_0xbad1('0xd')](_0x28c25b[_0xbad1('0x4c')],{'firstName':_0x28c25b[_0xbad1('0x4c')]['to'],'email':_0x28c25b['body']['to'],'phone':_0x28c25b['body']['to'],'ListId':_0x7739e8[_0xbad1('0x62')]}));}}else{throw new Error(_0xbad1('0x63'));}})[_0xbad1('0x2a')](function(){if(_0x150141){return respondWithRpcPromise('SendMail',_0xbad1('0x64'),_0x150141,client9003)[_0xbad1('0x2a')](function(_0x56b219){return _0x24761d[_0xbad1('0x29')]({'read':!![],'messageId':_0x56b219['messageId'],'sentAt':moment()[_0xbad1('0x65')](_0xbad1('0x66'))});})[_0xbad1('0x20')](function(_0x1623b3){logger[_0xbad1('0x1c')]('%s',JSON[_0xbad1('0x1b')](_0x1623b3));return _0x24761d;});}return _0x24761d;});}return _0x24761d;}})['then'](respondWithResult(_0x33fcfb,0xc9))['catch'](handleError(_0x33fcfb,null));};exports['accept']=function(_0x1265dd,_0x57806f){var _0x212469={'agent':{},'channel':_0xbad1('0x67')};if(_0x1265dd[_0xbad1('0x4c')]['id']){delete _0x1265dd[_0xbad1('0x4c')]['id'];}_0x1265dd[_0xbad1('0x4c')]['read']=!![];_0x1265dd['body']['readAt']=moment()[_0xbad1('0x65')](_0xbad1('0x66'));_0x1265dd[_0xbad1('0x4c')][_0xbad1('0x68')]=_0x1265dd[_0xbad1('0x4c')]['UserId']||_0x1265dd['user']['id'];_0x212469[_0xbad1('0x69')]['id']=_0x1265dd[_0xbad1('0x4c')][_0xbad1('0x68')];return db[_0xbad1('0x32')]['find']({'where':{'id':_0x1265dd[_0xbad1('0x48')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x57806f,null))[_0xbad1('0x2a')](saveUpdates(_0x1265dd[_0xbad1('0x4c')],null))['then'](function(_0x1c5da7){if(_0x1c5da7){_0x212469[_0xbad1('0x1e')]=_0x1c5da7[_0xbad1('0x6a')]({'plain':!![]});return db[_0xbad1('0x6b')][_0xbad1('0x4b')]({'where':{'id':_0x1c5da7[_0xbad1('0x6c')]}});}return null;})['then'](handleEntityNotFound(_0x57806f,null))[_0xbad1('0x2a')](function(_0x2811e5){if(_0x2811e5){return _0x2811e5[_0xbad1('0x29')]({'UserId':_0x1265dd[_0xbad1('0x4c')][_0xbad1('0x68')],'read1stAt':_['isNil'](_0x2811e5['read1stAt'])?moment()[_0xbad1('0x65')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xbad1('0x2a')](function(_0x1eeb83){if(_0x1eeb83){_0x212469[_0xbad1('0x6d')]=_0x1eeb83[_0xbad1('0x6a')]({'plain':!![]});interaction_log[_0xbad1('0x17')](_0xbad1('0x6e'),_0x1265dd[_0xbad1('0x6f')]['id'],_0x1265dd[_0xbad1('0x6f')][_0xbad1('0x2e')],_0x1265dd[_0xbad1('0x6f')][_0xbad1('0x70')],_0x212469[_0xbad1('0x6d')]['id'],_0x1265dd[_0xbad1('0x4c')]?JSON[_0xbad1('0x1b')](_0x1265dd['body']):_0xbad1('0x71'));return respondWithRpcPromise(_0xbad1('0x72'),'acceptMessage',_0x212469);}return null;})[_0xbad1('0x2a')](function(_0x2c66e4){var _0xd94ba4=_0xbad1('0x73')+_0x2c66e4[_0xbad1('0x1e')][_0xbad1('0x74')];return db[_0xbad1('0x75')]['query'](_0xd94ba4,{'type':db[_0xbad1('0x76')]['QueryTypes'][_0xbad1('0x77')],'raw':!![]})[_0xbad1('0x2a')](function(_0x1d8a21){return _0x1d8a21;});})[_0xbad1('0x2a')](function(_0x4b5421){if(_0x4b5421){_0x212469[_0xbad1('0x1e')]['contact']=_0x4b5421[0x0];if(!_0x1265dd[_0xbad1('0x4c')][_0xbad1('0x68')])return;return db[_0xbad1('0x78')][_0xbad1('0x4b')]({'where':{'id':_0x1265dd[_0xbad1('0x4c')][_0xbad1('0x68')],'role':_0xbad1('0x69')},'attributes':['id',_0xbad1('0x2e'),_0xbad1('0x79'),'email',_0xbad1('0x7a')],'raw':!![]});}return null;})[_0xbad1('0x2a')](function(_0x56ea8f){if(!_0x56ea8f)return null;_0x212469[_0xbad1('0x1e')]['agent']=_0x56ea8f;return _0x212469;})[_0xbad1('0x2a')](function(_0x3bb7bb){if(_0x3bb7bb){if(_0x1265dd['body'][_0xbad1('0x7b')]){_0x212469['message']['interface']=util[_0xbad1('0x65')](_0xbad1('0x7c'),_0x1265dd[_0xbad1('0x6f')][_0xbad1('0x2e')]);_0x212469[_0xbad1('0x1e')][_0xbad1('0x7d')]=_0x212469[_0xbad1('0x7d')];_0x212469[_0xbad1('0x1e')]['motionChannel']=_0x212469[_0xbad1('0x7d')];_0x212469[_0xbad1('0x1e')]['event']=_0xbad1('0x7e');_0x212469[_0xbad1('0x1e')][_0xbad1('0x4c')]=htmlToText[_0xbad1('0x7f')](_0x212469[_0xbad1('0x1e')][_0xbad1('0x4c')]);return respondWithRpcPromise('EventManager','EventManager',{'event':_0xbad1('0x80'),'message':_0x212469['message']},client9002)[_0xbad1('0x2a')](function(){return _0x212469;});}return _0x212469;}return null;})[_0xbad1('0x2a')](respondWithResult(_0x57806f,null))[_0xbad1('0x20')](handleError(_0x57806f,null));};exports[_0xbad1('0x81')]=function(_0x20e5a4,_0x16b41d){var _0x5c5886={'agent':{},'channel':_0xbad1('0x67')};if(_0x20e5a4['body']['id']){delete _0x20e5a4[_0xbad1('0x4c')]['id'];}_0x20e5a4[_0xbad1('0x4c')][_0xbad1('0x68')]=_0x20e5a4[_0xbad1('0x4c')][_0xbad1('0x68')]||_0x20e5a4[_0xbad1('0x6f')]['id'];_0x5c5886['agent']['id']=_0x20e5a4['body'][_0xbad1('0x68')];return db[_0xbad1('0x32')][_0xbad1('0x4b')]({'where':{'id':_0x20e5a4[_0xbad1('0x48')]['id'],'UserId':null}})[_0xbad1('0x2a')](handleEntityNotFound(_0x16b41d,null))[_0xbad1('0x2a')](function(_0x1d829e){if(_0x1d829e){_0x5c5886[_0xbad1('0x1e')]=_0x1d829e['get']({'plain':!![]});return db[_0xbad1('0x6b')]['find']({'where':{'id':_0x1d829e['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x16b41d,null))[_0xbad1('0x2a')](function(_0x5e9d1d){if(_0x5e9d1d){_0x5c5886[_0xbad1('0x6d')]=_0x5e9d1d[_0xbad1('0x6a')]({'plain':!![]});interaction_log[_0xbad1('0x17')](_0xbad1('0x82'),_0x20e5a4[_0xbad1('0x6f')]['id'],_0x20e5a4[_0xbad1('0x6f')][_0xbad1('0x2e')],_0x20e5a4[_0xbad1('0x6f')][_0xbad1('0x70')],_0x5c5886[_0xbad1('0x6d')]['id'],_0x20e5a4[_0xbad1('0x4c')]?JSON['stringify'](_0x20e5a4['body']):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x5c5886);}return null;})[_0xbad1('0x2a')](function(_0x45a7d4){var _0x26c251=_0xbad1('0x73')+_0x45a7d4[_0xbad1('0x1e')][_0xbad1('0x74')];return db[_0xbad1('0x75')][_0xbad1('0x37')](_0x26c251,{'type':db[_0xbad1('0x76')][_0xbad1('0x83')][_0xbad1('0x77')],'raw':!![]})['then'](function(_0x22d71f){return _0x22d71f;});})[_0xbad1('0x2a')](function(_0x5ad399){if(_0x5ad399){_0x5c5886['message'][_0xbad1('0x84')]=_0x5ad399[0x0];if(!_0x20e5a4[_0xbad1('0x4c')]['UserId'])return;return db['User'][_0xbad1('0x4b')]({'where':{'id':_0x20e5a4[_0xbad1('0x4c')][_0xbad1('0x68')],'role':_0xbad1('0x69')},'attributes':['id','name',_0xbad1('0x79'),_0xbad1('0x85'),'internal'],'raw':!![]});}return null;})['then'](function(_0x27976e){if(!_0x27976e)return null;_0x5c5886[_0xbad1('0x1e')][_0xbad1('0x69')]=_0x27976e;return _0x5c5886;})['then'](function(_0x42db06){if(_0x42db06){_0x42db06['message'][_0xbad1('0x86')]=util[_0xbad1('0x65')]('SIP/%s',_0x20e5a4[_0xbad1('0x6f')][_0xbad1('0x2e')]);_0x42db06['message'][_0xbad1('0x7d')]=_0x5c5886['channel'];_0x42db06['message'][_0xbad1('0x87')]=_0x5c5886[_0xbad1('0x7d')];_0x42db06[_0xbad1('0x1e')][_0xbad1('0x88')]=_0xbad1('0x81');_0x42db06['message'][_0xbad1('0x4c')]=htmlToText['fromString'](_0x5c5886[_0xbad1('0x1e')][_0xbad1('0x4c')]);respondWithRpcPromise('EventManager',_0xbad1('0x89'),{'event':_0xbad1('0x8a'),'message':_0x42db06[_0xbad1('0x1e')]},client9002);return _0x5c5886;}return null;})['then'](respondWithResult(_0x16b41d,null))[_0xbad1('0x20')](handleError(_0x16b41d,null));};exports[_0xbad1('0x8b')]=function(_0x3be6f4,_0x549a32){var _0xd1acb6=moment()['unix']()[_0xbad1('0x8c')]();var _0x139d5a=path[_0xbad1('0x5c')](config[_0xbad1('0x8d')],_0xbad1('0x8e'),'files',_0xbad1('0x8f'));var _0x105e16=path[_0xbad1('0x5c')](config['root'],'server','files','attachments');var _0xb8181=util['format'](_0xbad1('0x90'),_0xd1acb6);return db[_0xbad1('0x32')][_0xbad1('0x4b')]({'where':{'id':_0x3be6f4[_0xbad1('0x48')]['id']},'attributes':['id',_0xbad1('0x4c'),_0xbad1('0x91'),'to','cc',_0xbad1('0x92'),'subject','createdAt'],'include':_0x3be6f4[_0xbad1('0x37')]['attachments']?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})[_0xbad1('0x2a')](handleEntityNotFound(_0x549a32,null))['then'](function(_0x74572a){if(_0x74572a){var _0x29b2a0=_0x74572a;var _0xff4335={'from':_0x29b2a0[_0xbad1('0x91')],'to':_0x29b2a0['to'],'subject':_0x29b2a0[_0xbad1('0x93')],'html':htmlEntities[_0xbad1('0x94')](_0x29b2a0['body']),'headers':{'Date':moment(_0x29b2a0['createdAt'])[_0xbad1('0x65')](_0xbad1('0x95'))},'attachments':[]};if(_0x74572a['cc']){_0xff4335[_0xbad1('0x96')]['Cc']=_0x74572a['cc'];}if(_0x74572a[_0xbad1('0x92')]){_0xff4335[_0xbad1('0x96')][_0xbad1('0x97')]=_0x74572a[_0xbad1('0x92')];}return new BPromise(function(_0x403b91,_0x46f357){if(_0x74572a[_0xbad1('0x98')]){for(var _0x403f75=0x0;_0x403f75<_0x74572a[_0xbad1('0x98')][_0xbad1('0x3b')];_0x403f75++){var _0x461165=_0x74572a[_0xbad1('0x98')][_0x403f75];var _0x1b4a6b=path[_0xbad1('0x5c')](_0x105e16,_0x461165[_0xbad1('0x5e')]);if(fs[_0xbad1('0x99')](_0x1b4a6b)){_0xff4335[_0xbad1('0x5b')][_0xbad1('0x9a')]({'name':_0x461165['name'],'contentType':_0x461165['type'],'data':fs['readFileSync'](_0x1b4a6b)});}}}emlformat['build'](_0xff4335,function(_0x3d2cf6,_0x870581){if(_0x3d2cf6)return _0x46f357(_0x3d2cf6);fs[_0xbad1('0x9b')](path[_0xbad1('0x5c')](_0x139d5a,_0xb8181),_0x870581);return _0x403b91(_0x870581);});});}})[_0xbad1('0x2a')](function(_0xd51568){if(_0xd51568){return _0x549a32[_0xbad1('0x8b')](path['join'](_0x139d5a,_0xb8181),_0xb8181,function(_0x4dbfed){if(!_0x4dbfed)fs['unlinkSync'](path[_0xbad1('0x5c')](_0x139d5a,_0xb8181));});}})[_0xbad1('0x20')](handleError(_0x549a32,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index deb9ddd..48e872d 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 _0x6e3f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0x6e3f,0xdd));var _0xf6e3=function(_0x46dd97,_0x554f97){_0x46dd97=_0x46dd97-0x0;var _0x2696b0=_0x6e3f[_0x46dd97];return _0x2696b0;};'use strict';var EventEmitter=require(_0xf6e3('0x0'));var MailMessage=require(_0xf6e3('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xf6e3('0x2')](0x0);var events={'afterCreate':_0xf6e3('0x3'),'afterUpdate':'update','afterDestroy':_0xf6e3('0x4')};function emitEvent(_0x1e2356){return function(_0x3f1b46,_0xced424,_0x2c2778){MailMessageEvents['emit'](_0x1e2356+':'+_0x3f1b46['id'],_0x3f1b46);MailMessageEvents[_0xf6e3('0x5')](_0x1e2356,_0x3f1b46);_0x2c2778(null);};}for(var e in events){if(events[_0xf6e3('0x6')](e)){var event=events[e];MailMessage[_0xf6e3('0x7')](e,emitEvent(event));}}module[_0xf6e3('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x8e92=['hook','events','../../mysqldb','MailMessage','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x5e1f4b,_0x50b208){var _0x5ce7b4=function(_0x53d04f){while(--_0x53d04f){_0x5e1f4b['push'](_0x5e1f4b['shift']());}};_0x5ce7b4(++_0x50b208);}(_0x8e92,0x1b9));var _0x28e9=function(_0x4b8c5f,_0x39e096){_0x4b8c5f=_0x4b8c5f-0x0;var _0x38b01e=_0x8e92[_0x4b8c5f];return _0x38b01e;};'use strict';var EventEmitter=require(_0x28e9('0x0'));var MailMessage=require(_0x28e9('0x1'))['db'][_0x28e9('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x28e9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x28e9('0x4')};function emitEvent(_0x1e185f){return function(_0x5afcf4,_0x3cbd78,_0x33a64e){MailMessageEvents[_0x28e9('0x5')](_0x1e185f+':'+_0x5afcf4['id'],_0x5afcf4);MailMessageEvents[_0x28e9('0x5')](_0x1e185f,_0x5afcf4);_0x33a64e(null);};}for(var e in events){if(events[_0x28e9('0x6')](e)){var event=events[e];MailMessage[_0x28e9('0x7')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index caca59f..2548322 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 _0xb3a0=['get','direction','toLowerCase','out','UserId','MailInteraction','then','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','MailMessage','messageId','subject','body','models'];(function(_0x46fd66,_0x4859c0){var _0x170d03=function(_0x1d456b){while(--_0x1d456b){_0x46fd66['push'](_0x46fd66['shift']());}};_0x170d03(++_0x4859c0);}(_0xb3a0,0x1e9));var _0x0b3a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb3a0[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x0b3a('0x0'));var util=require(_0x0b3a('0x1'));var logger=require(_0x0b3a('0x2'))('api');var moment=require(_0x0b3a('0x3'));var BPromise=require(_0x0b3a('0x4'));var rp=require('request-promise');var htmlToText=require(_0x0b3a('0x5'));var fs=require('fs');var path=require(_0x0b3a('0x6'));var rimraf=require(_0x0b3a('0x7'));var config=require(_0x0b3a('0x8'));var attributes=require(_0x0b3a('0x9'));module['exports']=function(_0x4afc03,_0x3a1fac){return _0x4afc03['define'](_0x0b3a('0xa'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x0b3a('0xb')]},{'name':'fti_mail_messages','fields':['plainBody',_0x0b3a('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4a112b,_0x1545d6,_0x4300db){if(_0x4a112b[_0x0b3a('0xd')]){_0x4a112b['plainBody']=htmlToText['fromString'](_0x4a112b['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4300db(null,_0x1545d6);},'afterCreate':function(_0x39b32f,_0x2d7b99,_0xaf2606){var _0x446eb4=_0x4afc03[_0x0b3a('0xe')];var _0x3501b9=_0x39b32f[_0x0b3a('0xf')]({'plain':!![]});if(_0x3501b9[_0x0b3a('0x10')]['toLowerCase']()==='in'||_0x3501b9[_0x0b3a('0x10')][_0x0b3a('0x11')]()===_0x0b3a('0x12')&&!_0x3501b9['secret']&&!_['isNil'](_0x3501b9[_0x0b3a('0x13')])){_0x446eb4[_0x0b3a('0x14')]['findOne']({'where':{'id':_0x3501b9['MailInteractionId']}})[_0x0b3a('0x15')](function(_0x15a660){if(_0x15a660){_0x15a660['update']({'lastMsgAt':_0x3501b9['createdAt'],'lastMsgDirection':_0x3501b9[_0x0b3a('0x10')][_0x0b3a('0x11')]()});}})['catch'](function(_0x23de6c){console[_0x0b3a('0x16')](_0x23de6c);});}_0xaf2606();}},'charset':'utf8mb4','collate':_0x0b3a('0x17')});}; \ No newline at end of file +var _0x5c7e=['get','direction','toLowerCase','out','secret','isNil','MailInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','api','bluebird','html-to-text','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','plainBody','body','fromString'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x5c7e,0xb5));var _0xe5c7=function(_0x31a938,_0x4daec6){_0x31a938=_0x31a938-0x0;var _0x1bf341=_0x5c7e[_0x31a938];return _0x1bf341;};'use strict';var _=require(_0xe5c7('0x0'));var util=require(_0xe5c7('0x1'));var logger=require('../../config/logger')(_0xe5c7('0x2'));var moment=require('moment');var BPromise=require(_0xe5c7('0x3'));var rp=require('request-promise');var htmlToText=require(_0xe5c7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe5c7('0x5'));var attributes=require(_0xe5c7('0x6'));module[_0xe5c7('0x7')]=function(_0x38a4ff,_0x4a316d){return _0x38a4ff[_0xe5c7('0x8')](_0xe5c7('0x9'),attributes,{'tableName':_0xe5c7('0xa'),'paranoid':![],'indexes':[{'name':_0xe5c7('0xb'),'fields':[_0xe5c7('0xb')]},{'name':'fti_mail_messages','fields':[_0xe5c7('0xc'),'subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x53fbf9,_0x2b2372,_0x2be640){if(_0x53fbf9[_0xe5c7('0xd')]){_0x53fbf9[_0xe5c7('0xc')]=htmlToText[_0xe5c7('0xe')](_0x53fbf9[_0xe5c7('0xd')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2be640(null,_0x2b2372);},'afterCreate':function(_0x8104ad,_0x5d6999,_0xf4e4cb){var _0x1eeb22=_0x38a4ff['models'];var _0x4908bd=_0x8104ad[_0xe5c7('0xf')]({'plain':!![]});if(_0x4908bd[_0xe5c7('0x10')][_0xe5c7('0x11')]()==='in'||_0x4908bd[_0xe5c7('0x10')][_0xe5c7('0x11')]()===_0xe5c7('0x12')&&!_0x4908bd[_0xe5c7('0x13')]&&!_[_0xe5c7('0x14')](_0x4908bd['UserId'])){_0x1eeb22['MailInteraction']['findOne']({'where':{'id':_0x4908bd[_0xe5c7('0x15')]}})[_0xe5c7('0x16')](function(_0x41d255){if(_0x41d255){_0x41d255[_0xe5c7('0x17')]({'lastMsgAt':_0x4908bd[_0xe5c7('0x18')],'lastMsgDirection':_0x4908bd[_0xe5c7('0x10')][_0xe5c7('0x11')]()});}})[_0xe5c7('0x19')](function(_0x2983b9){console[_0xe5c7('0x1a')](_0x2983b9);});}_0xf4e4cb();}},'charset':'utf8mb4','collate':_0xe5c7('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 14f7e19..46d5107 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 _0x583c=['request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailMessage,\x20%s,\x20%s','result','CreateMailMessage','MailMessage','create','body','options','raw','then','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register'];(function(_0x5875ad,_0x3597b8){var _0x32a922=function(_0x2175fd){while(--_0x2175fd){_0x5875ad['push'](_0x5875ad['shift']());}};_0x32a922(++_0x3597b8);}(_0x583c,0x12b));var _0xc583=function(_0x17a32f,_0x5a51a){_0x17a32f=_0x17a32f-0x0;var _0x15a293=_0x583c[_0x17a32f];return _0x15a293;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var moment=require(_0xc583('0x2'));var BPromise=require(_0xc583('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc583('0x4'));var db=require(_0xc583('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc583('0x6'));var config=require(_0xc583('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc583('0x8')][_0xc583('0x9')]({'port':0x232a});config[_0xc583('0xa')]=_[_0xc583('0xb')](config['redis'],{'host':_0xc583('0xc'),'port':0x18eb});var socket=require(_0xc583('0xd'))(new Redis(config['redis']));require(_0xc583('0xe'))[_0xc583('0xf')](socket);function respondWithRpcPromise(_0x25f8d3,_0xb23f07,_0x2d99ca){return new BPromise(function(_0x550b1e,_0x3437be){return client[_0xc583('0x10')](_0x25f8d3,_0x2d99ca)['then'](function(_0x23c51a){logger[_0xc583('0x11')]('MailMessage,\x20%s,\x20%s',_0xb23f07,_0xc583('0x12'));logger[_0xc583('0x13')](_0xc583('0x14'),_0xb23f07,_0xc583('0x12'),JSON[_0xc583('0x15')](_0x23c51a));if(_0x23c51a[_0xc583('0x16')]){if(_0x23c51a[_0xc583('0x16')][_0xc583('0x17')]===0x1f4){logger[_0xc583('0x16')]('MailMessage,\x20%s,\x20%s',_0xb23f07,_0x23c51a[_0xc583('0x16')]['message']);return _0x3437be(_0x23c51a[_0xc583('0x16')][_0xc583('0x18')]);}logger['error'](_0xc583('0x19'),_0xb23f07,_0x23c51a[_0xc583('0x16')]['message']);return _0x550b1e(_0x23c51a[_0xc583('0x16')][_0xc583('0x18')]);}else{logger['info'](_0xc583('0x19'),_0xb23f07,_0xc583('0x12'));_0x550b1e(_0x23c51a[_0xc583('0x1a')][_0xc583('0x18')]);}})['catch'](function(_0x3dd3cc){logger['error'](_0xc583('0x19'),_0xb23f07,_0x3dd3cc);_0x3437be(_0x3dd3cc);});});}exports[_0xc583('0x1b')]=function(_0xfd9a60){var _0x774f4c=this;return new Promise(function(_0x1052b5,_0x12b910){return db[_0xc583('0x1c')][_0xc583('0x1d')](_0xfd9a60[_0xc583('0x1e')],{'raw':_0xfd9a60[_0xc583('0x1f')]?_0xfd9a60[_0xc583('0x1f')][_0xc583('0x20')]===undefined?!![]:![]:!![]})[_0xc583('0x21')](function(_0x478ee1){logger['info'](_0xc583('0x1b'),_0xfd9a60);logger[_0xc583('0x13')](_0xc583('0x1b'),_0xfd9a60,JSON['stringify'](_0x478ee1));_0x1052b5(_0x478ee1);})[_0xc583('0x22')](function(_0x959500){logger[_0xc583('0x16')](_0xc583('0x1b'),_0x959500[_0xc583('0x18')],_0xfd9a60);_0x12b910(_0x774f4c['error'](0x1f4,_0x959500['message']));});});}; \ No newline at end of file +var _0x0598=['CreateMailMessage','lodash','util','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','then','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','info','result','catch','MailMessage','create','body','raw'];(function(_0x491ec2,_0x540c00){var _0x1748db=function(_0x5a6258){while(--_0x5a6258){_0x491ec2['push'](_0x491ec2['shift']());}};_0x1748db(++_0x540c00);}(_0x0598,0x92));var _0x8059=function(_0x51bae7,_0x19c14c){_0x51bae7=_0x51bae7-0x0;var _0x543b9a=_0x0598[_0x51bae7];return _0x543b9a;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var moment=require('moment');var BPromise=require(_0x8059('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8059('0x3'))['db'];var utils=require(_0x8059('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8059('0x5'));var client=jayson[_0x8059('0x6')]['http']({'port':0x232a});config['redis']=_[_0x8059('0x7')](config[_0x8059('0x8')],{'host':_0x8059('0x9'),'port':0x18eb});var socket=require(_0x8059('0xa'))(new Redis(config['redis']));require('./mailMessage.socket')[_0x8059('0xb')](socket);function respondWithRpcPromise(_0x1bf5fd,_0x336f85,_0x5097d6){return new BPromise(function(_0x283b63,_0x52a60d){return client['request'](_0x1bf5fd,_0x5097d6)[_0x8059('0xc')](function(_0x4109a9){logger['info']('MailMessage,\x20%s,\x20%s',_0x336f85,'request\x20sent');logger[_0x8059('0xd')](_0x8059('0xe'),_0x336f85,_0x8059('0xf'),JSON[_0x8059('0x10')](_0x4109a9));if(_0x4109a9[_0x8059('0x11')]){if(_0x4109a9['error'][_0x8059('0x12')]===0x1f4){logger['error'](_0x8059('0x13'),_0x336f85,_0x4109a9['error'][_0x8059('0x14')]);return _0x52a60d(_0x4109a9[_0x8059('0x11')][_0x8059('0x14')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x336f85,_0x4109a9['error'][_0x8059('0x14')]);return _0x283b63(_0x4109a9[_0x8059('0x11')][_0x8059('0x14')]);}else{logger[_0x8059('0x15')](_0x8059('0x13'),_0x336f85,'request\x20sent');_0x283b63(_0x4109a9[_0x8059('0x16')][_0x8059('0x14')]);}})[_0x8059('0x17')](function(_0x1c4566){logger['error'](_0x8059('0x13'),_0x336f85,_0x1c4566);_0x52a60d(_0x1c4566);});});}exports['CreateMailMessage']=function(_0x113f42){var _0x493825=this;return new Promise(function(_0x1857c1,_0x56d794){return db[_0x8059('0x18')][_0x8059('0x19')](_0x113f42[_0x8059('0x1a')],{'raw':_0x113f42['options']?_0x113f42['options'][_0x8059('0x1b')]===undefined?!![]:![]:!![]})[_0x8059('0xc')](function(_0x32aeda){logger[_0x8059('0x15')]('CreateMailMessage',_0x113f42);logger[_0x8059('0xd')](_0x8059('0x1c'),_0x113f42,JSON[_0x8059('0x10')](_0x32aeda));_0x1857c1(_0x32aeda);})['catch'](function(_0xe9a72d){logger[_0x8059('0x11')](_0x8059('0x1c'),_0xe9a72d[_0x8059('0x14')],_0x113f42);_0x56d794(_0x493825['error'](0x1f4,_0xe9a72d[_0x8059('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 6b8aaa3..f1231ef 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 _0xb0bf=['./mailMessage.events','remove','update','emit','register','length','mailMessage:'];(function(_0x3ada85,_0x26240a){var _0x201350=function(_0x5d0d17){while(--_0x5d0d17){_0x3ada85['push'](_0x3ada85['shift']());}};_0x201350(++_0x26240a);}(_0xb0bf,0x69));var _0xfb0b=function(_0x2f0122,_0x33cc0d){_0x2f0122=_0x2f0122-0x0;var _0x4e8cc9=_0xb0bf[_0x2f0122];return _0x4e8cc9;};'use strict';var MailMessageEvents=require(_0xfb0b('0x0'));var events=['save',_0xfb0b('0x1'),_0xfb0b('0x2')];function createListener(_0x43856d,_0x3f9d27){return function(_0xe10922){_0x3f9d27[_0xfb0b('0x3')](_0x43856d,_0xe10922);};}function removeListener(_0x5b8de6,_0x1c7fe6){return function(){MailMessageEvents['removeListener'](_0x5b8de6,_0x1c7fe6);};}exports[_0xfb0b('0x4')]=function(_0x2faa08){for(var _0x30bbe5=0x0,_0x400f86=events[_0xfb0b('0x5')];_0x30bbe5<_0x400f86;_0x30bbe5++){var _0x1eaf21=events[_0x30bbe5];var _0x20bb4=createListener(_0xfb0b('0x6')+_0x1eaf21,_0x2faa08);MailMessageEvents['on'](_0x1eaf21,_0x20bb4);}}; \ No newline at end of file +var _0x34eb=['update','emit','removeListener','register','length','mailMessage:','./mailMessage.events','save','remove'];(function(_0x1200fc,_0x138686){var _0x212aca=function(_0x26667f){while(--_0x26667f){_0x1200fc['push'](_0x1200fc['shift']());}};_0x212aca(++_0x138686);}(_0x34eb,0x180));var _0xb34e=function(_0x445c3c,_0x2fdf40){_0x445c3c=_0x445c3c-0x0;var _0x386c80=_0x34eb[_0x445c3c];return _0x386c80;};'use strict';var MailMessageEvents=require(_0xb34e('0x0'));var events=[_0xb34e('0x1'),_0xb34e('0x2'),_0xb34e('0x3')];function createListener(_0x5ec082,_0x48cc9d){return function(_0x508fa0){_0x48cc9d[_0xb34e('0x4')](_0x5ec082,_0x508fa0);};}function removeListener(_0x2dd2f8,_0x2e0a90){return function(){MailMessageEvents[_0xb34e('0x5')](_0x2dd2f8,_0x2e0a90);};}exports[_0xb34e('0x6')]=function(_0x18651f){for(var _0x471943=0x0,_0x4d8687=events[_0xb34e('0x7')];_0x471943<_0x4d8687;_0x471943++){var _0x41b795=events[_0x471943];var _0x46fabe=createListener(_0xb34e('0x8')+_0x41b795,_0x18651f);MailMessageEvents['on'](_0x41b795,_0x46fabe);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 66f1726..8f672c8 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 _0x88f2=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','/:id','/:id/members','getMembers','/:id/teams','getAgents','post','addAgents','put','update','delete','/:id/users','removeAgents'];(function(_0x15d79b,_0xa61f8a){var _0x22818c=function(_0x4864e8){while(--_0x4864e8){_0x15d79b['push'](_0x15d79b['shift']());}};_0x22818c(++_0xa61f8a);}(_0x88f2,0xd0));var _0x288f=function(_0x3fa39f,_0x13843e){_0x3fa39f=_0x3fa39f-0x0;var _0x5f1ab9=_0x88f2[_0x3fa39f];return _0x5f1ab9;};'use strict';var multer=require(_0x288f('0x0'));var util=require(_0x288f('0x1'));var path=require(_0x288f('0x2'));var timeout=require(_0x288f('0x3'));var express=require(_0x288f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x288f('0x5'));var interaction=require(_0x288f('0x6'));var config=require('../../config/environment');var controller=require(_0x288f('0x7'));router[_0x288f('0x8')]('/',auth[_0x288f('0x9')](),controller['index']);router[_0x288f('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x288f('0x8')](_0x288f('0xa'),auth[_0x288f('0x9')](),controller['show']);router[_0x288f('0x8')](_0x288f('0xb'),auth[_0x288f('0x9')](),controller[_0x288f('0xc')]);router['get'](_0x288f('0xd'),auth[_0x288f('0x9')](),controller['getTeams']);router[_0x288f('0x8')]('/:id/users',auth[_0x288f('0x9')](),controller[_0x288f('0xe')]);router['post']('/',auth[_0x288f('0x9')](),controller['create']);router['post'](_0x288f('0xd'),auth[_0x288f('0x9')](),controller['addTeams']);router[_0x288f('0xf')]('/:id/users',auth[_0x288f('0x9')](),controller[_0x288f('0x10')]);router[_0x288f('0x11')](_0x288f('0xa'),auth['isAuthenticated'](),controller[_0x288f('0x12')]);router['delete'](_0x288f('0xa'),auth[_0x288f('0x9')](),controller['destroy']);router[_0x288f('0x13')](_0x288f('0xd'),auth[_0x288f('0x9')](),controller['removeTeams']);router[_0x288f('0x13')](_0x288f('0x14'),auth[_0x288f('0x9')](),controller[_0x288f('0x15')]);module[_0x288f('0x16')]=router; \ No newline at end of file +var _0x02a8=['describe','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x02a8,0xfe));var _0x802a=function(_0x1b2c22,_0x532650){_0x1b2c22=_0x1b2c22-0x0;var _0x2b6c12=_0x02a8[_0x1b2c22];return _0x2b6c12;};'use strict';var multer=require('multer');var util=require(_0x802a('0x0'));var path=require('path');var timeout=require(_0x802a('0x1'));var express=require(_0x802a('0x2'));var router=express[_0x802a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x802a('0x4'));var interaction=require(_0x802a('0x5'));var config=require(_0x802a('0x6'));var controller=require('./mailQueue.controller');router[_0x802a('0x7')]('/',auth[_0x802a('0x8')](),controller[_0x802a('0x9')]);router['get']('/describe',auth[_0x802a('0x8')](),controller[_0x802a('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/members',auth[_0x802a('0x8')](),controller['getMembers']);router[_0x802a('0x7')](_0x802a('0xb'),auth[_0x802a('0x8')](),controller[_0x802a('0xc')]);router[_0x802a('0x7')](_0x802a('0xd'),auth[_0x802a('0x8')](),controller[_0x802a('0xe')]);router[_0x802a('0xf')]('/',auth[_0x802a('0x8')](),controller[_0x802a('0x10')]);router[_0x802a('0xf')](_0x802a('0xb'),auth[_0x802a('0x8')](),controller['addTeams']);router[_0x802a('0xf')](_0x802a('0xd'),auth['isAuthenticated'](),controller[_0x802a('0x11')]);router[_0x802a('0x12')](_0x802a('0x13'),auth['isAuthenticated'](),controller[_0x802a('0x14')]);router[_0x802a('0x15')](_0x802a('0x13'),auth[_0x802a('0x8')](),controller[_0x802a('0x16')]);router['delete'](_0x802a('0xb'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x802a('0x15')](_0x802a('0xd'),auth[_0x802a('0x8')](),controller['removeAgents']);module[_0x802a('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 2d3f9fb..e3ad21f 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 _0x2689=['sequelize','STRING','name','INTEGER','ENUM','roundrobin'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x2689,0xd2));var _0x9268=function(_0x1afbdf,_0x246ae2){_0x1afbdf=_0x1afbdf-0x0;var _0x4e3f52=_0x2689[_0x1afbdf];return _0x4e3f52;};'use strict';var Sequelize=require(_0x9268('0x0'));module['exports']={'name':{'type':Sequelize[_0x9268('0x1')],'unique':_0x9268('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9268('0x1')]},'timeout':{'type':Sequelize[_0x9268('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9268('0x4')]('rrmemory','beepall',_0x9268('0x5'))}}; \ No newline at end of file +var _0x37fb=['ENUM','beepall','sequelize','exports','STRING','INTEGER'];(function(_0x5358cd,_0x293fd6){var _0xc144e2=function(_0x18c1fc){while(--_0x18c1fc){_0x5358cd['push'](_0x5358cd['shift']());}};_0xc144e2(++_0x293fd6);}(_0x37fb,0xce));var _0xb37f=function(_0x5c6da4,_0x132eb1){_0x5c6da4=_0x5c6da4-0x0;var _0x209cac=_0x37fb[_0x5c6da4];return _0x209cac;};'use strict';var Sequelize=require(_0xb37f('0x0'));module[_0xb37f('0x1')]={'name':{'type':Sequelize[_0xb37f('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb37f('0x2')]},'timeout':{'type':Sequelize[_0xb37f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb37f('0x4')]('rrmemory',_0xb37f('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 6e73e2b..5f0470a 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 _0x74dd=['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','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','count','set','Content-Range','apply','reject','save','then','destroy','get','MailQueues','UserProfileResource','stack','name','send','map','MailQueue','fieldName','key','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','options','includeAll','include','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','rawAttributes','intersection','User','findAndCountAll','agent','createdAt','rows','format','%s/%s','SIP','mailPause','updatedAt','getTeams','findOne','Team','addTeams','ids','findAll','voicePause','interface','flatMap','Agents','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','userMailQueue:remove','addAgents','removeAgents','isArray','getAgents'];(function(_0x3ae34a,_0x143082){var _0x4c9edc=function(_0x2796c8){while(--_0x2796c8){_0x3ae34a['push'](_0x3ae34a['shift']());}};_0x4c9edc(++_0x143082);}(_0x74dd,0x90));var _0xd74d=function(_0x3ec122,_0x55150a){_0x3ec122=_0x3ec122-0x0;var _0x4ecf41=_0x74dd[_0x3ec122];return _0x4ecf41;};'use strict';var emlformat=require(_0xd74d('0x0'));var rimraf=require(_0xd74d('0x1'));var zipdir=require(_0xd74d('0x2'));var jsonpatch=require(_0xd74d('0x3'));var rp=require(_0xd74d('0x4'));var moment=require(_0xd74d('0x5'));var BPromise=require(_0xd74d('0x6'));var Mustache=require(_0xd74d('0x7'));var util=require(_0xd74d('0x8'));var path=require(_0xd74d('0x9'));var sox=require(_0xd74d('0xa'));var csv=require(_0xd74d('0xb'));var ejs=require(_0xd74d('0xc'));var fs=require('fs');var fs_extra=require(_0xd74d('0xd'));var _=require(_0xd74d('0xe'));var squel=require(_0xd74d('0xf'));var crypto=require('crypto');var jsforce=require(_0xd74d('0x10'));var deskjs=require(_0xd74d('0x11'));var toCsv=require('to-csv');var querystring=require(_0xd74d('0x12'));var Papa=require(_0xd74d('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd74d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd74d('0x15'))(_0xd74d('0x16'));var utils=require(_0xd74d('0x17'));var config=require(_0xd74d('0x18'));var licenseUtil=require(_0xd74d('0x19'));var db=require(_0xd74d('0x1a'))['db'];config[_0xd74d('0x1b')]=_[_0xd74d('0x1c')](config[_0xd74d('0x1b')],{'host':_0xd74d('0x1d'),'port':0x18eb});var socket=require(_0xd74d('0x1e'))(new Redis(config[_0xd74d('0x1b')]));require('./mailQueue.socket')[_0xd74d('0x1f')](socket);function respondWithStatusCode(_0x598c80,_0x9aecfd){_0x9aecfd=_0x9aecfd||0xcc;return function(_0x23208d){if(_0x23208d){return _0x598c80[_0xd74d('0x20')](_0x9aecfd);}return _0x598c80['status'](_0x9aecfd)[_0xd74d('0x21')]();};}function respondWithResult(_0x51eaa6,_0x36c91c){_0x36c91c=_0x36c91c||0xc8;return function(_0x33cc98){if(_0x33cc98){return _0x51eaa6[_0xd74d('0x22')](_0x36c91c)[_0xd74d('0x23')](_0x33cc98);}};}function respondWithFilteredResult(_0x82dfaa,_0x532b08){return function(_0x8c9328){if(_0x8c9328){var _0x2215ef=typeof _0x532b08[_0xd74d('0x24')]==='undefined'&&typeof _0x532b08['limit']==='undefined';var _0x3a9678=_0x8c9328[_0xd74d('0x25')];var _0x136c87=_0x2215ef?0x0:_0x532b08[_0xd74d('0x24')];var _0x4bbd29=_0x2215ef?_0x8c9328[_0xd74d('0x25')]:_0x532b08['offset']+_0x532b08['limit'];var _0x1a2630;if(_0x4bbd29>=_0x3a9678){_0x4bbd29=_0x3a9678;_0x1a2630=0xc8;}else{_0x1a2630=0xce;}_0x82dfaa[_0xd74d('0x22')](_0x1a2630);return _0x82dfaa[_0xd74d('0x26')](_0xd74d('0x27'),_0x136c87+'-'+_0x4bbd29+'/'+_0x3a9678)[_0xd74d('0x23')](_0x8c9328);}return null;};}function patchUpdates(_0x211449){return function(_0x4c59de){try{jsonpatch[_0xd74d('0x28')](_0x4c59de,_0x211449,!![]);}catch(_0x27c485){return BPromise[_0xd74d('0x29')](_0x27c485);}return _0x4c59de[_0xd74d('0x2a')]();};}function saveUpdates(_0x211fef,_0xdec9f4){return function(_0x30ed4f){if(_0x30ed4f){return _0x30ed4f['update'](_0x211fef)[_0xd74d('0x2b')](function(_0x46028f){return _0x46028f;});}return null;};}function removeEntity(_0x14fe7f,_0x2ed363){return function(_0x22306b){if(_0x22306b){return _0x22306b[_0xd74d('0x2c')]()[_0xd74d('0x2b')](function(){var _0x5abbd0=_0x22306b[_0xd74d('0x2d')]({'plain':!![]});var _0x2339a2=_0xd74d('0x2e');return db[_0xd74d('0x2f')]['destroy']({'where':{'type':_0x2339a2,'resourceId':_0x5abbd0['id']}})['then'](function(){return _0x22306b;});})[_0xd74d('0x2b')](function(){_0x14fe7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x14d195,_0x5eac23){return function(_0x543f1f){if(!_0x543f1f){_0x14d195[_0xd74d('0x20')](0x194);}return _0x543f1f;};}function handleError(_0x5b9642,_0x4c6a00){_0x4c6a00=_0x4c6a00||0x1f4;return function(_0x22bc94){logger['error'](_0x22bc94[_0xd74d('0x30')]);if(_0x22bc94['name']){delete _0x22bc94[_0xd74d('0x31')];}_0x5b9642[_0xd74d('0x22')](_0x4c6a00)[_0xd74d('0x32')](_0x22bc94);};}exports['index']=function(_0x19d58e,_0x2593d7){var _0x7910a0={},_0x285a3c={},_0x59c152={'count':0x0,'rows':[]};var _0x2ccb7f=_[_0xd74d('0x33')](db[_0xd74d('0x34')]['rawAttributes'],function(_0x5ddfdb){return{'name':_0x5ddfdb[_0xd74d('0x35')],'type':_0x5ddfdb['type'][_0xd74d('0x36')]};});_0x285a3c['model']=_[_0xd74d('0x33')](_0x2ccb7f,_0xd74d('0x31'));_0x285a3c[_0xd74d('0x37')]=_['keys'](_0x19d58e[_0xd74d('0x37')]);_0x285a3c[_0xd74d('0x38')]=_['intersection'](_0x285a3c[_0xd74d('0x39')],_0x285a3c[_0xd74d('0x37')]);_0x7910a0[_0xd74d('0x3a')]=_['intersection'](_0x285a3c[_0xd74d('0x39')],qs[_0xd74d('0x3b')](_0x19d58e[_0xd74d('0x37')]['fields']));_0x7910a0[_0xd74d('0x3a')]=_0x7910a0[_0xd74d('0x3a')][_0xd74d('0x3c')]?_0x7910a0['attributes']:_0x285a3c[_0xd74d('0x39')];if(!_0x19d58e[_0xd74d('0x37')][_0xd74d('0x3d')](_0xd74d('0x3e'))){_0x7910a0[_0xd74d('0x3f')]=qs[_0xd74d('0x3f')](_0x19d58e['query'][_0xd74d('0x3f')]);_0x7910a0['offset']=qs['offset'](_0x19d58e[_0xd74d('0x37')][_0xd74d('0x24')]);}_0x7910a0[_0xd74d('0x40')]=qs[_0xd74d('0x41')](_0x19d58e[_0xd74d('0x37')][_0xd74d('0x41')]);_0x7910a0[_0xd74d('0x42')]=qs['filters'](_[_0xd74d('0x43')](_0x19d58e['query'],_0x285a3c[_0xd74d('0x38')]),_0x2ccb7f);if(_0x19d58e[_0xd74d('0x37')][_0xd74d('0x44')]){_0x7910a0['where']=_[_0xd74d('0x45')](_0x7910a0[_0xd74d('0x42')],{'$or':_[_0xd74d('0x33')](_0x2ccb7f,function(_0x1a8c22){if(_0x1a8c22[_0xd74d('0x46')]!=='VIRTUAL'){var _0x5eea88={};_0x5eea88[_0x1a8c22[_0xd74d('0x31')]]={'$like':'%'+_0x19d58e[_0xd74d('0x37')][_0xd74d('0x44')]+'%'};return _0x5eea88;}})});}_0x7910a0=_[_0xd74d('0x45')]({},_0x7910a0,_0x19d58e[_0xd74d('0x47')]);var _0x25a125={'where':_0x7910a0[_0xd74d('0x42')]};return db['MailQueue'][_0xd74d('0x25')](_0x25a125)[_0xd74d('0x2b')](function(_0x34347e){_0x59c152[_0xd74d('0x25')]=_0x34347e;if(_0x19d58e[_0xd74d('0x37')][_0xd74d('0x48')]){_0x7910a0[_0xd74d('0x49')]=[{'all':!![]}];}return db[_0xd74d('0x34')]['findAll'](_0x7910a0);})['then'](function(_0x1a05a6){_0x59c152['rows']=_0x1a05a6;return _0x59c152;})[_0xd74d('0x2b')](respondWithFilteredResult(_0x2593d7,_0x7910a0))[_0xd74d('0x4a')](handleError(_0x2593d7,null));};exports[_0xd74d('0x4b')]=function(_0x18c1a5,_0x3c6cd2){var _0x59360f={'raw':!![],'where':{'id':_0x18c1a5[_0xd74d('0x4c')]['id']}},_0x3f8281={};_0x3f8281[_0xd74d('0x39')]=_[_0xd74d('0x4d')](db[_0xd74d('0x34')]['rawAttributes']);_0x3f8281[_0xd74d('0x37')]=_[_0xd74d('0x4d')](_0x18c1a5[_0xd74d('0x37')]);_0x3f8281['filters']=_['intersection'](_0x3f8281[_0xd74d('0x39')],_0x3f8281[_0xd74d('0x37')]);_0x59360f['attributes']=_['intersection'](_0x3f8281['model'],qs[_0xd74d('0x3b')](_0x18c1a5['query']['fields']));_0x59360f['attributes']=_0x59360f[_0xd74d('0x3a')]['length']?_0x59360f[_0xd74d('0x3a')]:_0x3f8281[_0xd74d('0x39')];if(_0x18c1a5[_0xd74d('0x37')]['includeAll']){_0x59360f[_0xd74d('0x49')]=[{'all':!![]}];}_0x59360f=_['merge']({},_0x59360f,_0x18c1a5['options']);return db['MailQueue']['find'](_0x59360f)['then'](handleEntityNotFound(_0x3c6cd2,null))[_0xd74d('0x2b')](respondWithResult(_0x3c6cd2,null))[_0xd74d('0x4a')](handleError(_0x3c6cd2,null));};exports[_0xd74d('0x4e')]=function(_0x4c9aa1,_0x4bd9c0){return db['MailQueue']['create'](_0x4c9aa1[_0xd74d('0x4f')],{})[_0xd74d('0x2b')](function(_0x3e4cd9){var _0x2e07d9=_0x4c9aa1[_0xd74d('0x50')][_0xd74d('0x2d')]({'plain':!![]});if(!_0x2e07d9)throw new Error(_0xd74d('0x51'));if(_0x2e07d9['role']===_0xd74d('0x50')){var _0x172f21=_0x3e4cd9['get']({'plain':!![]});var _0x3a3d61=_0xd74d('0x2e');return db[_0xd74d('0x52')][_0xd74d('0x53')]({'where':{'name':_0x3a3d61,'userProfileId':_0x2e07d9[_0xd74d('0x54')]},'raw':!![]})[_0xd74d('0x2b')](function(_0x57c124){if(_0x57c124&&_0x57c124[_0xd74d('0x55')]===0x0){return db[_0xd74d('0x2f')]['create']({'name':_0x172f21[_0xd74d('0x31')],'resourceId':_0x172f21['id'],'type':_0x57c124[_0xd74d('0x31')],'sectionId':_0x57c124['id']},{})[_0xd74d('0x2b')](function(){return _0x3e4cd9;});}else{return _0x3e4cd9;}})[_0xd74d('0x4a')](function(_0x329670){logger[_0xd74d('0x56')](_0xd74d('0x57'),_0x329670);throw _0x329670;});}return _0x3e4cd9;})[_0xd74d('0x2b')](respondWithResult(_0x4bd9c0,0xc9))[_0xd74d('0x4a')](handleError(_0x4bd9c0,null));};exports['update']=function(_0x17aa23,_0x779223){if(_0x17aa23[_0xd74d('0x4f')]['id']){delete _0x17aa23[_0xd74d('0x4f')]['id'];}return db[_0xd74d('0x34')]['find']({'where':{'id':_0x17aa23[_0xd74d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x779223,null))[_0xd74d('0x2b')](saveUpdates(_0x17aa23['body'],null))[_0xd74d('0x2b')](respondWithResult(_0x779223,null))[_0xd74d('0x4a')](handleError(_0x779223,null));};exports[_0xd74d('0x2c')]=function(_0x366079,_0x13aee1){return db[_0xd74d('0x34')][_0xd74d('0x53')]({'where':{'id':_0x366079[_0xd74d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x13aee1,null))[_0xd74d('0x2b')](removeEntity(_0x13aee1,null))[_0xd74d('0x4a')](handleError(_0x13aee1,null));};exports[_0xd74d('0x58')]=function(_0x4df3de,_0xf5374e){return db[_0xd74d('0x34')][_0xd74d('0x58')]()[_0xd74d('0x2b')](respondWithResult(_0xf5374e,null))[_0xd74d('0x4a')](handleError(_0xf5374e,null));};exports[_0xd74d('0x59')]=function(_0x1e837d,_0x33de72,_0x3b2edc){var _0x404399={'raw':!![],'where':{}},_0x3e3bdb={},_0x405a6b;return db[_0xd74d('0x34')]['findOne']({'where':{'id':_0x1e837d['params']['id']}})['then'](handleEntityNotFound(_0x33de72,null))['then'](function(_0x3a0fc9){if(_0x3a0fc9){_0x405a6b=_0x3a0fc9[_0xd74d('0x2d')]({'plain':!![]});_0x3e3bdb[_0xd74d('0x39')]=_['keys'](db[_0xd74d('0x5a')][_0xd74d('0x5b')]);_0x3e3bdb[_0xd74d('0x37')]=_['keys'](_0x1e837d[_0xd74d('0x37')]);_0x3e3bdb['filters']=_[_0xd74d('0x5c')](_0x3e3bdb['model'],_0x3e3bdb['query']);_0x404399['attributes']=_[_0xd74d('0x5c')](_0x3e3bdb['model'],qs[_0xd74d('0x3b')](_0x1e837d['query']['fields']));_0x404399[_0xd74d('0x3a')]=_0x404399[_0xd74d('0x3a')][_0xd74d('0x3c')]?_0x404399[_0xd74d('0x3a')]:_0x3e3bdb['model'];if(!_0x1e837d[_0xd74d('0x37')][_0xd74d('0x3d')]('nolimit')){_0x404399[_0xd74d('0x3f')]=qs[_0xd74d('0x3f')](_0x1e837d[_0xd74d('0x37')][_0xd74d('0x3f')]);_0x404399[_0xd74d('0x24')]=qs['offset'](_0x1e837d[_0xd74d('0x37')][_0xd74d('0x24')]);}_0x404399[_0xd74d('0x40')]=qs['sort'](_0x1e837d[_0xd74d('0x37')][_0xd74d('0x41')]);_0x404399[_0xd74d('0x42')]=qs[_0xd74d('0x38')](_[_0xd74d('0x43')](_0x1e837d['query'],_0x3e3bdb[_0xd74d('0x38')]));_0x404399[_0xd74d('0x42')]['MailQueueId']=_0x3a0fc9['id'];if(_0x1e837d['query'][_0xd74d('0x44')]){_0x404399[_0xd74d('0x42')]=_[_0xd74d('0x45')](_0x404399[_0xd74d('0x42')],{'$or':_[_0xd74d('0x33')](_0x404399[_0xd74d('0x3a')],function(_0x4b2389){var _0x54962c={};_0x54962c[_0x4b2389]={'$like':'%'+_0x1e837d[_0xd74d('0x37')][_0xd74d('0x44')]+'%'};return _0x54962c;})});}_0x404399=_[_0xd74d('0x45')]({},_0x404399,_0x1e837d[_0xd74d('0x47')]);return db[_0xd74d('0x5a')]['findAll'](_0x404399);}})['then'](function(_0x65abb5){if(_0x65abb5){return db[_0xd74d('0x5d')][_0xd74d('0x5e')]({'where':{'id':_[_0xd74d('0x33')](_0x65abb5,'UserId'),'role':_0xd74d('0x5f')},'attributes':['id',_0xd74d('0x31'),'mailPause','updatedAt',_0xd74d('0x60')]});}})[_0xd74d('0x2b')](function(_0xc548fa){if(_0xc548fa){return{'count':_0xc548fa['count'],'rows':_[_0xd74d('0x33')](_0xc548fa[_0xd74d('0x61')],function(_0x4dccfd){return{'membername':_0x4dccfd['name'],'UserId':_0x4dccfd['id'],'queue_name':_0x405a6b[_0xd74d('0x31')],'MailQueueId':_0x405a6b['id'],'interface':util[_0xd74d('0x62')](_0xd74d('0x63'),_0xd74d('0x64'),_0x4dccfd[_0xd74d('0x31')]),'penalty':0x0,'paused':_0x4dccfd[_0xd74d('0x65')],'createdAt':_0x4dccfd[_0xd74d('0x60')],'updatedAt':_0x4dccfd[_0xd74d('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd74d('0x2b')](respondWithFilteredResult(_0x33de72,_0x404399))['catch'](handleError(_0x33de72,null));};exports[_0xd74d('0x67')]=function(_0x484cf1,_0x56efa2,_0x230268){var _0x2a635e={};var _0x14512b={};var _0x57f17d;var _0x409b8a;return db[_0xd74d('0x34')][_0xd74d('0x68')]({'where':{'id':_0x484cf1[_0xd74d('0x4c')]['id']}})[_0xd74d('0x2b')](handleEntityNotFound(_0x56efa2,null))[_0xd74d('0x2b')](function(_0x398776){if(_0x398776){_0x57f17d=_0x398776;_0x14512b[_0xd74d('0x39')]=_[_0xd74d('0x4d')](db[_0xd74d('0x69')]['rawAttributes']);_0x14512b['query']=_[_0xd74d('0x4d')](_0x484cf1[_0xd74d('0x37')]);_0x14512b[_0xd74d('0x38')]=_[_0xd74d('0x5c')](_0x14512b[_0xd74d('0x39')],_0x14512b[_0xd74d('0x37')]);_0x2a635e[_0xd74d('0x3a')]=_['intersection'](_0x14512b[_0xd74d('0x39')],qs[_0xd74d('0x3b')](_0x484cf1[_0xd74d('0x37')]['fields']));_0x2a635e[_0xd74d('0x3a')]=_0x2a635e['attributes'][_0xd74d('0x3c')]?_0x2a635e[_0xd74d('0x3a')]:_0x14512b[_0xd74d('0x39')];_0x2a635e['order']=qs[_0xd74d('0x41')](_0x484cf1['query'][_0xd74d('0x41')]);_0x2a635e[_0xd74d('0x42')]=qs[_0xd74d('0x38')](_[_0xd74d('0x43')](_0x484cf1[_0xd74d('0x37')],_0x14512b['filters']));if(_0x484cf1[_0xd74d('0x37')][_0xd74d('0x44')]){_0x2a635e[_0xd74d('0x42')]=_[_0xd74d('0x45')](_0x2a635e[_0xd74d('0x42')],{'$or':_[_0xd74d('0x33')](_0x2a635e['attributes'],function(_0x343928){var _0x16b17b={};_0x16b17b[_0x343928]={'$like':'%'+_0x484cf1[_0xd74d('0x37')][_0xd74d('0x44')]+'%'};return _0x16b17b;})});}_0x2a635e=_[_0xd74d('0x45')]({},_0x2a635e,_0x484cf1[_0xd74d('0x47')]);return _0x57f17d['getTeams'](_0x2a635e);}})[_0xd74d('0x2b')](function(_0x24b407){if(_0x24b407){_0x409b8a=_0x24b407[_0xd74d('0x3c')];if(!_0x484cf1['query'][_0xd74d('0x3d')](_0xd74d('0x3e'))){_0x2a635e[_0xd74d('0x3f')]=qs['limit'](_0x484cf1[_0xd74d('0x37')][_0xd74d('0x3f')]);_0x2a635e[_0xd74d('0x24')]=qs[_0xd74d('0x24')](_0x484cf1[_0xd74d('0x37')][_0xd74d('0x24')]);}return _0x57f17d[_0xd74d('0x67')](_0x2a635e);}})[_0xd74d('0x2b')](function(_0x3c715d){if(_0x3c715d){return _0x3c715d?{'count':_0x409b8a,'rows':_0x3c715d}:null;}})[_0xd74d('0x2b')](respondWithResult(_0x56efa2,null))[_0xd74d('0x4a')](handleError(_0x56efa2,null));};exports[_0xd74d('0x6a')]=function(_0x172082,_0xbd3b7c,_0x43b409){var _0x1e97b7=_0x172082[_0xd74d('0x4f')][_0xd74d('0x6b')];return db[_0xd74d('0x69')][_0xd74d('0x6c')]({'where':{'id':_0x1e97b7},'attributes':['id'],'include':[{'model':db[_0xd74d('0x5d')],'as':'Agents','attributes':['id',_0xd74d('0x31'),'online',_0xd74d('0x6d'),_0xd74d('0x6e')],'raw':!![]}]})[_0xd74d('0x2b')](function(_0x514e2d){if(_0x514e2d){var _0x2d8251=_[_0xd74d('0x6f')](_0x514e2d,function(_0x552904){var _0x5d603b=_0x552904['get']({'plain':!![]});return _0x5d603b[_0xd74d('0x70')];});return db['MailQueue'][_0xd74d('0x53')]({'where':{'id':_0x172082[_0xd74d('0x4c')]['id']}})[_0xd74d('0x2b')](function(_0x14a80d){return db['sequelize'][_0xd74d('0x71')](function(_0x20df57){return _0x14a80d[_0xd74d('0x6a')](_0x1e97b7,{'transaction':_0x20df57})[_0xd74d('0x2b')](function(){return BPromise[_0xd74d('0x72')](_0x2d8251,function(_0xdd38f1){return db[_0xd74d('0x5a')][_0xd74d('0x73')]({'where':{'UserId':_0xdd38f1['id'],'MailQueueId':_0x172082[_0xd74d('0x4c')]['id']},'transaction':_0x20df57});});})['then'](function(){_0x2d8251[_0xd74d('0x74')](function(_0x143cab){socket[_0xd74d('0x75')](_0xd74d('0x76'),{'UserId':_0x143cab['id'],'MailQueueId':_0x14a80d['id']});});});});});}})[_0xd74d('0x2b')](respondWithStatusCode(_0xbd3b7c,null))[_0xd74d('0x4a')](handleError(_0xbd3b7c,null));};exports[_0xd74d('0x77')]=function(_0x3a7960,_0x19844f,_0x23a9a1){return db[_0xd74d('0x69')][_0xd74d('0x6c')]({'where':{'id':_0x3a7960[_0xd74d('0x37')][_0xd74d('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xd74d('0x5d')],'as':_0xd74d('0x70'),'attributes':['id'],'raw':!![]}]})[_0xd74d('0x2b')](handleEntityNotFound(_0x19844f,null))[_0xd74d('0x2b')](function(_0x4cf4c7){var _0x44d5dc=_[_0xd74d('0x33')](_0x4cf4c7,'id');var _0x1822af=[];var _0x150940=[];var _0x5763b9=squel[_0xd74d('0x78')]();_0x5763b9[_0xd74d('0x79')](_0xd74d('0x7a'))['from'](_0xd74d('0x7b'),'tq')[_0xd74d('0x7c')](_0xd74d('0x7d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xd74d('0x42')](_0xd74d('0x7e'),_0x3a7960[_0xd74d('0x4c')]['id']);for(var _0x263b3b=0x0;_0x263b3b<_0x4cf4c7[_0xd74d('0x3c')];_0x263b3b+=0x1){let _0xc66111=_0x4cf4c7[_0x263b3b];for(var _0x5401e2=0x0;_0x5401e2<_0xc66111[_0xd74d('0x70')][_0xd74d('0x3c')];_0x5401e2+=0x1){let _0x4b0e11=_0xc66111[_0xd74d('0x70')][_0x5401e2];var _0x1cced7=_0x5763b9[_0xd74d('0x7f')]();_0x1cced7[_0xd74d('0x42')](_0xd74d('0x80'),_0x4b0e11['id']);_0x150940['push'](db[_0xd74d('0x81')][_0xd74d('0x37')](_0x1cced7[_0xd74d('0x82')](),{'type':db['sequelize'][_0xd74d('0x83')][_0xd74d('0x84')]})['then'](function(_0xb7a23c){if(_0xb7a23c[_0xd74d('0x3c')]===0x1){return _0x4b0e11['id'];}else{var _0x4473ec=_[_0xd74d('0x85')](_[_0xd74d('0x33')](_0xb7a23c,_0xd74d('0x86')),function(_0x4e3070){return _['includes'](_0x44d5dc,_0x4e3070);});if(_0x4473ec){return _0x4b0e11['id'];}}}));}}return BPromise[_0xd74d('0x87')](_0x150940)[_0xd74d('0x2b')](function(_0x5f3592){_0x1822af=_(_0x1822af)[_0xd74d('0x88')](_0x5f3592)[_0xd74d('0x89')]()[_0xd74d('0x8a')]();return db['MailQueue'][_0xd74d('0x53')]({'where':{'id':_0x3a7960[_0xd74d('0x4c')]['id']}})[_0xd74d('0x2b')](function(_0x11010a){return db[_0xd74d('0x81')][_0xd74d('0x71')](function(_0x47e43f){return _0x11010a[_0xd74d('0x77')](_0x3a7960[_0xd74d('0x37')]['ids'],{'transaction':_0x47e43f})[_0xd74d('0x2b')](function(){if(!_['isEmpty'](_0x1822af)){return _0x11010a['removeAgents'](_0x1822af,{'transaction':_0x47e43f});}})[_0xd74d('0x2b')](function(){_0x1822af[_0xd74d('0x74')](function(_0x1fdf10){socket['emit'](_0xd74d('0x8b'),{'UserId':_0x1fdf10,'MailQueueId':_0x11010a['id']});});});});});});})[_0xd74d('0x2b')](respondWithStatusCode(_0x19844f,null))['catch'](handleError(_0x19844f,null));};exports[_0xd74d('0x8c')]=function(_0x25f608,_0x3c17e6,_0x1f2133){return db[_0xd74d('0x34')][_0xd74d('0x53')]({'where':{'id':_0x25f608[_0xd74d('0x4c')]['id']}})[_0xd74d('0x2b')](handleEntityNotFound(_0x3c17e6,null))['then'](function(_0x125472){if(_0x125472){return _0x125472[_0xd74d('0x8c')](_0x25f608['body'][_0xd74d('0x6b')],_['omit'](_0x25f608[_0xd74d('0x4f')],[_0xd74d('0x6b'),'id'])||{})['spread'](function(_0xc482c2){for(var _0x320ea7=0x0;_0x320ea7<_0x25f608[_0xd74d('0x4f')]['ids'][_0xd74d('0x3c')];_0x320ea7+=0x1){socket[_0xd74d('0x75')](_0xd74d('0x76'),{'UserId':Number(_0x25f608[_0xd74d('0x4f')][_0xd74d('0x6b')][_0x320ea7]),'MailQueueId':Number(_0x25f608['params']['id'])});}return _0xc482c2;});}})[_0xd74d('0x2b')](respondWithResult(_0x3c17e6,null))[_0xd74d('0x4a')](handleError(_0x3c17e6,null));};exports[_0xd74d('0x8d')]=function(_0x576899,_0x597cc7,_0x52583a){return db['MailQueue'][_0xd74d('0x53')]({'where':{'id':_0x576899[_0xd74d('0x4c')]['id']}})[_0xd74d('0x2b')](handleEntityNotFound(_0x597cc7,null))['then'](function(_0x126b82){if(_0x126b82){return _0x126b82[_0xd74d('0x8d')](_0x576899[_0xd74d('0x37')][_0xd74d('0x6b')])['then'](function(){if(_[_0xd74d('0x8e')](_0x576899[_0xd74d('0x37')][_0xd74d('0x6b')])){for(var _0x6f8295=0x0;_0x6f8295<_0x576899[_0xd74d('0x37')][_0xd74d('0x6b')][_0xd74d('0x3c')];_0x6f8295+=0x1){socket[_0xd74d('0x75')]('userMailQueue:remove',{'UserId':Number(_0x576899[_0xd74d('0x37')]['ids'][_0x6f8295]),'MailQueueId':Number(_0x576899[_0xd74d('0x4c')]['id'])});}}else{socket[_0xd74d('0x75')](_0xd74d('0x8b'),{'UserId':Number(_0x576899[_0xd74d('0x37')]['ids']),'MailQueueId':Number(_0x576899['params']['id'])});}});}})[_0xd74d('0x2b')](respondWithStatusCode(_0x597cc7,null))['catch'](handleError(_0x597cc7,null));};exports[_0xd74d('0x8f')]=function(_0x4dd7b1,_0x3f1c63,_0x4d2d75){var _0x1da643={};var _0x5a1616={};var _0x42e2d4;var _0x9acff4;return db['MailQueue'][_0xd74d('0x68')]({'where':{'id':_0x4dd7b1[_0xd74d('0x4c')]['id']}})[_0xd74d('0x2b')](handleEntityNotFound(_0x3f1c63,null))[_0xd74d('0x2b')](function(_0x1db918){if(_0x1db918){_0x42e2d4=_0x1db918;_0x5a1616[_0xd74d('0x39')]=_[_0xd74d('0x4d')](db[_0xd74d('0x5d')][_0xd74d('0x5b')]);_0x5a1616[_0xd74d('0x37')]=_[_0xd74d('0x4d')](_0x4dd7b1[_0xd74d('0x37')]);_0x5a1616[_0xd74d('0x38')]=_['intersection'](_0x5a1616['model'],_0x5a1616[_0xd74d('0x37')]);_0x1da643['attributes']=_[_0xd74d('0x5c')](_0x5a1616[_0xd74d('0x39')],qs[_0xd74d('0x3b')](_0x4dd7b1[_0xd74d('0x37')]['fields']));_0x1da643[_0xd74d('0x3a')]=_0x1da643[_0xd74d('0x3a')][_0xd74d('0x3c')]?_0x1da643[_0xd74d('0x3a')]:_0x5a1616[_0xd74d('0x39')];_0x1da643[_0xd74d('0x40')]=qs[_0xd74d('0x41')](_0x4dd7b1[_0xd74d('0x37')][_0xd74d('0x41')]);_0x1da643[_0xd74d('0x42')]=qs[_0xd74d('0x38')](_['pick'](_0x4dd7b1[_0xd74d('0x37')],_0x5a1616['filters']));if(_0x4dd7b1[_0xd74d('0x37')]['filter']){_0x1da643[_0xd74d('0x42')]=_[_0xd74d('0x45')](_0x1da643[_0xd74d('0x42')],{'$or':_['map'](_0x1da643[_0xd74d('0x3a')],function(_0x2628db){var _0xe9bfaf={};_0xe9bfaf[_0x2628db]={'$like':'%'+_0x4dd7b1[_0xd74d('0x37')][_0xd74d('0x44')]+'%'};return _0xe9bfaf;})});}_0x1da643=_[_0xd74d('0x45')]({},_0x1da643,_0x4dd7b1['options']);return _0x42e2d4['getAgents'](_0x1da643);}})['then'](function(_0x1ebadb){if(_0x1ebadb){_0x9acff4=_0x1ebadb[_0xd74d('0x3c')];if(!_0x4dd7b1[_0xd74d('0x37')][_0xd74d('0x3d')](_0xd74d('0x3e'))){_0x1da643[_0xd74d('0x3f')]=qs['limit'](_0x4dd7b1['query'][_0xd74d('0x3f')]);_0x1da643['offset']=qs['offset'](_0x4dd7b1[_0xd74d('0x37')][_0xd74d('0x24')]);}return _0x42e2d4[_0xd74d('0x8f')](_0x1da643);}})[_0xd74d('0x2b')](function(_0x3336c0){if(_0x3336c0){return _0x3336c0?{'count':_0x9acff4,'rows':_0x3336c0}:null;}})[_0xd74d('0x2b')](respondWithResult(_0x3f1c63,null))[_0xd74d('0x4a')](handleError(_0x3f1c63,null));}; \ No newline at end of file +var _0x736b=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','offset','undefined','limit','Content-Range','json','reject','save','update','then','MailQueues','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','MailQueue','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserMailQueue','hasOwnProperty','nolimit','order','MailQueueId','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','User','online','interface','transaction','each','forEach','emit','userMailQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','every','union','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents'];(function(_0x3f4a1d,_0x14bfbb){var _0x5b0ecc=function(_0x4678ca){while(--_0x4678ca){_0x3f4a1d['push'](_0x3f4a1d['shift']());}};_0x5b0ecc(++_0x14bfbb);}(_0x736b,0x8a));var _0xb736=function(_0x249746,_0x2601f3){_0x249746=_0x249746-0x0;var _0x3a4339=_0x736b[_0x249746];return _0x3a4339;};'use strict';var emlformat=require(_0xb736('0x0'));var rimraf=require(_0xb736('0x1'));var zipdir=require(_0xb736('0x2'));var jsonpatch=require(_0xb736('0x3'));var rp=require(_0xb736('0x4'));var moment=require(_0xb736('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb736('0x6'));var util=require(_0xb736('0x7'));var path=require(_0xb736('0x8'));var sox=require(_0xb736('0x9'));var csv=require(_0xb736('0xa'));var ejs=require(_0xb736('0xb'));var fs=require('fs');var fs_extra=require(_0xb736('0xc'));var _=require(_0xb736('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb736('0xe'));var deskjs=require(_0xb736('0xf'));var toCsv=require(_0xb736('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb736('0x10'));var authService=require(_0xb736('0x11'));var qs=require(_0xb736('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb736('0x13'))('api');var utils=require(_0xb736('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb736('0x15'));var db=require(_0xb736('0x16'))['db'];config[_0xb736('0x17')]=_[_0xb736('0x18')](config[_0xb736('0x17')],{'host':_0xb736('0x19'),'port':0x18eb});var socket=require(_0xb736('0x1a'))(new Redis(config[_0xb736('0x17')]));require(_0xb736('0x1b'))[_0xb736('0x1c')](socket);function respondWithStatusCode(_0xea9652,_0x24441c){_0x24441c=_0x24441c||0xcc;return function(_0x5d335d){if(_0x5d335d){return _0xea9652['sendStatus'](_0x24441c);}return _0xea9652[_0xb736('0x1d')](_0x24441c)['end']();};}function respondWithResult(_0x1f4299,_0xbc42b0){_0xbc42b0=_0xbc42b0||0xc8;return function(_0x5bc285){if(_0x5bc285){return _0x1f4299[_0xb736('0x1d')](_0xbc42b0)['json'](_0x5bc285);}};}function respondWithFilteredResult(_0xb7ec77,_0x34effb){return function(_0x48d62a){if(_0x48d62a){var _0x229fa7=typeof _0x34effb[_0xb736('0x1e')]===_0xb736('0x1f')&&typeof _0x34effb[_0xb736('0x20')]===_0xb736('0x1f');var _0xbb2c47=_0x48d62a['count'];var _0x204b0b=_0x229fa7?0x0:_0x34effb['offset'];var _0x3c1e56=_0x229fa7?_0x48d62a['count']:_0x34effb[_0xb736('0x1e')]+_0x34effb['limit'];var _0x50b99b;if(_0x3c1e56>=_0xbb2c47){_0x3c1e56=_0xbb2c47;_0x50b99b=0xc8;}else{_0x50b99b=0xce;}_0xb7ec77['status'](_0x50b99b);return _0xb7ec77['set'](_0xb736('0x21'),_0x204b0b+'-'+_0x3c1e56+'/'+_0xbb2c47)[_0xb736('0x22')](_0x48d62a);}return null;};}function patchUpdates(_0x1b6664){return function(_0x3527d5){try{jsonpatch['apply'](_0x3527d5,_0x1b6664,!![]);}catch(_0x3d01e4){return BPromise[_0xb736('0x23')](_0x3d01e4);}return _0x3527d5[_0xb736('0x24')]();};}function saveUpdates(_0xf6d8cc,_0x3a30e6){return function(_0x1389f6){if(_0x1389f6){return _0x1389f6[_0xb736('0x25')](_0xf6d8cc)[_0xb736('0x26')](function(_0x4eca54){return _0x4eca54;});}return null;};}function removeEntity(_0x348867,_0x5a3e1f){return function(_0x5af324){if(_0x5af324){return _0x5af324['destroy']()['then'](function(){var _0x3a7f60=_0x5af324['get']({'plain':!![]});var _0x187df6=_0xb736('0x27');return db[_0xb736('0x28')][_0xb736('0x29')]({'where':{'type':_0x187df6,'resourceId':_0x3a7f60['id']}})[_0xb736('0x26')](function(){return _0x5af324;});})[_0xb736('0x26')](function(){_0x348867[_0xb736('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dba5f,_0x419288){return function(_0x26d4fa){if(!_0x26d4fa){_0x2dba5f[_0xb736('0x2a')](0x194);}return _0x26d4fa;};}function handleError(_0xeb46e4,_0x3015ff){_0x3015ff=_0x3015ff||0x1f4;return function(_0x4f2f49){logger['error'](_0x4f2f49[_0xb736('0x2b')]);if(_0x4f2f49[_0xb736('0x2c')]){delete _0x4f2f49[_0xb736('0x2c')];}_0xeb46e4[_0xb736('0x1d')](_0x3015ff)[_0xb736('0x2d')](_0x4f2f49);};}exports[_0xb736('0x2e')]=function(_0x96e197,_0x36af7f){var _0x23862a={},_0x595b03={},_0x4b96d8={'count':0x0,'rows':[]};var _0x331bbc=_[_0xb736('0x2f')](db[_0xb736('0x30')]['rawAttributes'],function(_0x21d1f9){return{'name':_0x21d1f9[_0xb736('0x31')],'type':_0x21d1f9['type'][_0xb736('0x32')]};});_0x595b03[_0xb736('0x33')]=_['map'](_0x331bbc,_0xb736('0x2c'));_0x595b03[_0xb736('0x34')]=_[_0xb736('0x35')](_0x96e197[_0xb736('0x34')]);_0x595b03[_0xb736('0x36')]=_[_0xb736('0x37')](_0x595b03[_0xb736('0x33')],_0x595b03[_0xb736('0x34')]);_0x23862a[_0xb736('0x38')]=_[_0xb736('0x37')](_0x595b03[_0xb736('0x33')],qs['fields'](_0x96e197[_0xb736('0x34')][_0xb736('0x39')]));_0x23862a[_0xb736('0x38')]=_0x23862a['attributes'][_0xb736('0x3a')]?_0x23862a[_0xb736('0x38')]:_0x595b03[_0xb736('0x33')];if(!_0x96e197[_0xb736('0x34')]['hasOwnProperty']('nolimit')){_0x23862a[_0xb736('0x20')]=qs[_0xb736('0x20')](_0x96e197[_0xb736('0x34')][_0xb736('0x20')]);_0x23862a[_0xb736('0x1e')]=qs[_0xb736('0x1e')](_0x96e197[_0xb736('0x34')][_0xb736('0x1e')]);}_0x23862a['order']=qs[_0xb736('0x3b')](_0x96e197[_0xb736('0x34')][_0xb736('0x3b')]);_0x23862a[_0xb736('0x3c')]=qs['filters'](_[_0xb736('0x3d')](_0x96e197['query'],_0x595b03[_0xb736('0x36')]),_0x331bbc);if(_0x96e197[_0xb736('0x34')][_0xb736('0x3e')]){_0x23862a[_0xb736('0x3c')]=_[_0xb736('0x3f')](_0x23862a[_0xb736('0x3c')],{'$or':_['map'](_0x331bbc,function(_0x520399){if(_0x520399['type']!==_0xb736('0x40')){var _0xe736cd={};_0xe736cd[_0x520399['name']]={'$like':'%'+_0x96e197['query']['filter']+'%'};return _0xe736cd;}})});}_0x23862a=_[_0xb736('0x3f')]({},_0x23862a,_0x96e197[_0xb736('0x41')]);var _0x1db12f={'where':_0x23862a[_0xb736('0x3c')]};return db[_0xb736('0x30')][_0xb736('0x42')](_0x1db12f)['then'](function(_0x2db525){_0x4b96d8[_0xb736('0x42')]=_0x2db525;if(_0x96e197[_0xb736('0x34')][_0xb736('0x43')]){_0x23862a[_0xb736('0x44')]=[{'all':!![]}];}return db[_0xb736('0x30')][_0xb736('0x45')](_0x23862a);})[_0xb736('0x26')](function(_0x3fde4a){_0x4b96d8[_0xb736('0x46')]=_0x3fde4a;return _0x4b96d8;})['then'](respondWithFilteredResult(_0x36af7f,_0x23862a))[_0xb736('0x47')](handleError(_0x36af7f,null));};exports[_0xb736('0x48')]=function(_0x322dc1,_0x55e395){var _0x1f23f4={'raw':!![],'where':{'id':_0x322dc1[_0xb736('0x49')]['id']}},_0x137a62={};_0x137a62['model']=_[_0xb736('0x35')](db[_0xb736('0x30')][_0xb736('0x4a')]);_0x137a62['query']=_[_0xb736('0x35')](_0x322dc1[_0xb736('0x34')]);_0x137a62[_0xb736('0x36')]=_[_0xb736('0x37')](_0x137a62[_0xb736('0x33')],_0x137a62[_0xb736('0x34')]);_0x1f23f4[_0xb736('0x38')]=_['intersection'](_0x137a62[_0xb736('0x33')],qs[_0xb736('0x39')](_0x322dc1[_0xb736('0x34')]['fields']));_0x1f23f4[_0xb736('0x38')]=_0x1f23f4[_0xb736('0x38')][_0xb736('0x3a')]?_0x1f23f4[_0xb736('0x38')]:_0x137a62[_0xb736('0x33')];if(_0x322dc1[_0xb736('0x34')]['includeAll']){_0x1f23f4[_0xb736('0x44')]=[{'all':!![]}];}_0x1f23f4=_[_0xb736('0x3f')]({},_0x1f23f4,_0x322dc1['options']);return db[_0xb736('0x30')][_0xb736('0x4b')](_0x1f23f4)[_0xb736('0x26')](handleEntityNotFound(_0x55e395,null))[_0xb736('0x26')](respondWithResult(_0x55e395,null))[_0xb736('0x47')](handleError(_0x55e395,null));};exports[_0xb736('0x4c')]=function(_0x11342f,_0x18098f){return db[_0xb736('0x30')]['create'](_0x11342f[_0xb736('0x4d')],{})[_0xb736('0x26')](function(_0x119be5){var _0x21025f=_0x11342f['user'][_0xb736('0x4e')]({'plain':!![]});if(!_0x21025f)throw new Error(_0xb736('0x4f'));if(_0x21025f[_0xb736('0x50')]==='user'){var _0x1c85f4=_0x119be5[_0xb736('0x4e')]({'plain':!![]});var _0x30092d=_0xb736('0x27');return db[_0xb736('0x51')]['find']({'where':{'name':_0x30092d,'userProfileId':_0x21025f[_0xb736('0x52')]},'raw':!![]})['then'](function(_0x5148cb){if(_0x5148cb&&_0x5148cb['autoAssociation']===0x0){return db[_0xb736('0x28')]['create']({'name':_0x1c85f4['name'],'resourceId':_0x1c85f4['id'],'type':_0x5148cb['name'],'sectionId':_0x5148cb['id']},{})['then'](function(){return _0x119be5;});}else{return _0x119be5;}})[_0xb736('0x47')](function(_0xeb8228){logger[_0xb736('0x53')](_0xb736('0x54'),_0xeb8228);throw _0xeb8228;});}return _0x119be5;})[_0xb736('0x26')](respondWithResult(_0x18098f,0xc9))[_0xb736('0x47')](handleError(_0x18098f,null));};exports['update']=function(_0x392a7b,_0x269fc5){if(_0x392a7b[_0xb736('0x4d')]['id']){delete _0x392a7b[_0xb736('0x4d')]['id'];}return db[_0xb736('0x30')][_0xb736('0x4b')]({'where':{'id':_0x392a7b[_0xb736('0x49')]['id']}})[_0xb736('0x26')](handleEntityNotFound(_0x269fc5,null))['then'](saveUpdates(_0x392a7b[_0xb736('0x4d')],null))[_0xb736('0x26')](respondWithResult(_0x269fc5,null))[_0xb736('0x47')](handleError(_0x269fc5,null));};exports['destroy']=function(_0x152b6e,_0xc832dc){return db[_0xb736('0x30')]['find']({'where':{'id':_0x152b6e[_0xb736('0x49')]['id']}})['then'](handleEntityNotFound(_0xc832dc,null))[_0xb736('0x26')](removeEntity(_0xc832dc,null))['catch'](handleError(_0xc832dc,null));};exports[_0xb736('0x55')]=function(_0x3aecf9,_0x31f5ef){return db['MailQueue'][_0xb736('0x55')]()[_0xb736('0x26')](respondWithResult(_0x31f5ef,null))[_0xb736('0x47')](handleError(_0x31f5ef,null));};exports['getMembers']=function(_0x1bf389,_0x40640c,_0x1a817c){var _0x36e386={'raw':!![],'where':{}},_0x14aa2a={},_0x508241;return db[_0xb736('0x30')][_0xb736('0x56')]({'where':{'id':_0x1bf389[_0xb736('0x49')]['id']}})[_0xb736('0x26')](handleEntityNotFound(_0x40640c,null))['then'](function(_0x52474a){if(_0x52474a){_0x508241=_0x52474a[_0xb736('0x4e')]({'plain':!![]});_0x14aa2a[_0xb736('0x33')]=_[_0xb736('0x35')](db[_0xb736('0x57')][_0xb736('0x4a')]);_0x14aa2a[_0xb736('0x34')]=_[_0xb736('0x35')](_0x1bf389[_0xb736('0x34')]);_0x14aa2a[_0xb736('0x36')]=_[_0xb736('0x37')](_0x14aa2a[_0xb736('0x33')],_0x14aa2a['query']);_0x36e386[_0xb736('0x38')]=_[_0xb736('0x37')](_0x14aa2a[_0xb736('0x33')],qs['fields'](_0x1bf389[_0xb736('0x34')]['fields']));_0x36e386[_0xb736('0x38')]=_0x36e386[_0xb736('0x38')][_0xb736('0x3a')]?_0x36e386[_0xb736('0x38')]:_0x14aa2a['model'];if(!_0x1bf389[_0xb736('0x34')][_0xb736('0x58')](_0xb736('0x59'))){_0x36e386[_0xb736('0x20')]=qs[_0xb736('0x20')](_0x1bf389['query'][_0xb736('0x20')]);_0x36e386[_0xb736('0x1e')]=qs['offset'](_0x1bf389['query'][_0xb736('0x1e')]);}_0x36e386[_0xb736('0x5a')]=qs[_0xb736('0x3b')](_0x1bf389['query'][_0xb736('0x3b')]);_0x36e386['where']=qs[_0xb736('0x36')](_[_0xb736('0x3d')](_0x1bf389[_0xb736('0x34')],_0x14aa2a[_0xb736('0x36')]));_0x36e386[_0xb736('0x3c')][_0xb736('0x5b')]=_0x52474a['id'];if(_0x1bf389[_0xb736('0x34')][_0xb736('0x3e')]){_0x36e386[_0xb736('0x3c')]=_[_0xb736('0x3f')](_0x36e386[_0xb736('0x3c')],{'$or':_[_0xb736('0x2f')](_0x36e386[_0xb736('0x38')],function(_0x4cb524){var _0x2de064={};_0x2de064[_0x4cb524]={'$like':'%'+_0x1bf389[_0xb736('0x34')][_0xb736('0x3e')]+'%'};return _0x2de064;})});}_0x36e386=_[_0xb736('0x3f')]({},_0x36e386,_0x1bf389[_0xb736('0x41')]);return db[_0xb736('0x57')]['findAll'](_0x36e386);}})['then'](function(_0x4a0e65){if(_0x4a0e65){return db['User']['findAndCountAll']({'where':{'id':_[_0xb736('0x2f')](_0x4a0e65,_0xb736('0x5c')),'role':_0xb736('0x5d')},'attributes':['id',_0xb736('0x2c'),_0xb736('0x5e'),_0xb736('0x5f'),_0xb736('0x60')]});}})[_0xb736('0x26')](function(_0x48f335){if(_0x48f335){return{'count':_0x48f335[_0xb736('0x42')],'rows':_['map'](_0x48f335['rows'],function(_0x10a9c8){return{'membername':_0x10a9c8['name'],'UserId':_0x10a9c8['id'],'queue_name':_0x508241[_0xb736('0x2c')],'MailQueueId':_0x508241['id'],'interface':util[_0xb736('0x61')](_0xb736('0x62'),_0xb736('0x63'),_0x10a9c8['name']),'penalty':0x0,'paused':_0x10a9c8[_0xb736('0x5e')],'createdAt':_0x10a9c8[_0xb736('0x60')],'updatedAt':_0x10a9c8['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x40640c,_0x36e386))['catch'](handleError(_0x40640c,null));};exports['getTeams']=function(_0x5eb164,_0x4e15a1,_0x36b376){var _0x7ce863={};var _0x381e2e={};var _0x44986a;var _0x34fb3b;return db['MailQueue'][_0xb736('0x56')]({'where':{'id':_0x5eb164[_0xb736('0x49')]['id']}})[_0xb736('0x26')](handleEntityNotFound(_0x4e15a1,null))[_0xb736('0x26')](function(_0x358bf5){if(_0x358bf5){_0x44986a=_0x358bf5;_0x381e2e['model']=_[_0xb736('0x35')](db[_0xb736('0x64')][_0xb736('0x4a')]);_0x381e2e[_0xb736('0x34')]=_[_0xb736('0x35')](_0x5eb164[_0xb736('0x34')]);_0x381e2e['filters']=_[_0xb736('0x37')](_0x381e2e[_0xb736('0x33')],_0x381e2e['query']);_0x7ce863[_0xb736('0x38')]=_['intersection'](_0x381e2e[_0xb736('0x33')],qs['fields'](_0x5eb164[_0xb736('0x34')][_0xb736('0x39')]));_0x7ce863[_0xb736('0x38')]=_0x7ce863[_0xb736('0x38')][_0xb736('0x3a')]?_0x7ce863[_0xb736('0x38')]:_0x381e2e['model'];_0x7ce863[_0xb736('0x5a')]=qs[_0xb736('0x3b')](_0x5eb164[_0xb736('0x34')][_0xb736('0x3b')]);_0x7ce863[_0xb736('0x3c')]=qs[_0xb736('0x36')](_[_0xb736('0x3d')](_0x5eb164['query'],_0x381e2e[_0xb736('0x36')]));if(_0x5eb164[_0xb736('0x34')][_0xb736('0x3e')]){_0x7ce863[_0xb736('0x3c')]=_[_0xb736('0x3f')](_0x7ce863[_0xb736('0x3c')],{'$or':_[_0xb736('0x2f')](_0x7ce863[_0xb736('0x38')],function(_0x25426d){var _0x4787ee={};_0x4787ee[_0x25426d]={'$like':'%'+_0x5eb164[_0xb736('0x34')]['filter']+'%'};return _0x4787ee;})});}_0x7ce863=_[_0xb736('0x3f')]({},_0x7ce863,_0x5eb164['options']);return _0x44986a[_0xb736('0x65')](_0x7ce863);}})[_0xb736('0x26')](function(_0x435b7c){if(_0x435b7c){_0x34fb3b=_0x435b7c['length'];if(!_0x5eb164[_0xb736('0x34')][_0xb736('0x58')](_0xb736('0x59'))){_0x7ce863['limit']=qs[_0xb736('0x20')](_0x5eb164[_0xb736('0x34')][_0xb736('0x20')]);_0x7ce863[_0xb736('0x1e')]=qs[_0xb736('0x1e')](_0x5eb164[_0xb736('0x34')]['offset']);}return _0x44986a['getTeams'](_0x7ce863);}})[_0xb736('0x26')](function(_0x1b3f87){if(_0x1b3f87){return _0x1b3f87?{'count':_0x34fb3b,'rows':_0x1b3f87}:null;}})[_0xb736('0x26')](respondWithResult(_0x4e15a1,null))[_0xb736('0x47')](handleError(_0x4e15a1,null));};exports[_0xb736('0x66')]=function(_0xaa639,_0x21e9d2,_0x187887){var _0x55e952=_0xaa639[_0xb736('0x4d')][_0xb736('0x67')];return db[_0xb736('0x64')][_0xb736('0x45')]({'where':{'id':_0x55e952},'attributes':['id'],'include':[{'model':db[_0xb736('0x68')],'as':'Agents','attributes':['id','name',_0xb736('0x69'),'voicePause',_0xb736('0x6a')],'raw':!![]}]})[_0xb736('0x26')](function(_0x728a25){if(_0x728a25){var _0x34bfe8=_['flatMap'](_0x728a25,function(_0x344d2b){var _0x8a31bc=_0x344d2b[_0xb736('0x4e')]({'plain':!![]});return _0x8a31bc['Agents'];});return db[_0xb736('0x30')][_0xb736('0x4b')]({'where':{'id':_0xaa639[_0xb736('0x49')]['id']}})['then'](function(_0x4c6e70){return db['sequelize'][_0xb736('0x6b')](function(_0x50f9f7){return _0x4c6e70[_0xb736('0x66')](_0x55e952,{'transaction':_0x50f9f7})['then'](function(){return BPromise[_0xb736('0x6c')](_0x34bfe8,function(_0x3c4083){return db[_0xb736('0x57')]['findOrCreate']({'where':{'UserId':_0x3c4083['id'],'MailQueueId':_0xaa639[_0xb736('0x49')]['id']},'transaction':_0x50f9f7});});})['then'](function(){_0x34bfe8[_0xb736('0x6d')](function(_0x5c325e){socket[_0xb736('0x6e')](_0xb736('0x6f'),{'UserId':_0x5c325e['id'],'MailQueueId':_0x4c6e70['id']});});});});});}})['then'](respondWithStatusCode(_0x21e9d2,null))['catch'](handleError(_0x21e9d2,null));};exports[_0xb736('0x70')]=function(_0xfca020,_0x43df33,_0x4ccc09){return db[_0xb736('0x64')][_0xb736('0x45')]({'where':{'id':_0xfca020[_0xb736('0x34')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb736('0x71'),'attributes':['id'],'raw':!![]}]})[_0xb736('0x26')](handleEntityNotFound(_0x43df33,null))[_0xb736('0x26')](function(_0x3fddf6){var _0x29038c=_['map'](_0x3fddf6,'id');var _0x1515b7=[];var _0xf138f6=[];var _0x48c7b5=squel[_0xb736('0x72')]();_0x48c7b5[_0xb736('0x73')](_0xb736('0x74'))[_0xb736('0x75')](_0xb736('0x76'),'tq')[_0xb736('0x77')](_0xb736('0x78'),'ut',_0xb736('0x79'))[_0xb736('0x3c')](_0xb736('0x7a'),_0xfca020[_0xb736('0x49')]['id']);for(var _0x48c0f8=0x0;_0x48c0f8<_0x3fddf6[_0xb736('0x3a')];_0x48c0f8+=0x1){let _0x464d03=_0x3fddf6[_0x48c0f8];for(var _0x2dcd92=0x0;_0x2dcd92<_0x464d03['Agents'][_0xb736('0x3a')];_0x2dcd92+=0x1){let _0x989742=_0x464d03[_0xb736('0x71')][_0x2dcd92];var _0x17f54a=_0x48c7b5[_0xb736('0x7b')]();_0x17f54a[_0xb736('0x3c')](_0xb736('0x7c'),_0x989742['id']);_0xf138f6['push'](db['sequelize']['query'](_0x17f54a['toString'](),{'type':db[_0xb736('0x7d')][_0xb736('0x7e')]['SELECT']})[_0xb736('0x26')](function(_0x1e269b){if(_0x1e269b['length']===0x1){return _0x989742['id'];}else{var _0x958ce5=_[_0xb736('0x7f')](_['map'](_0x1e269b,'TeamId'),function(_0x284b58){return _['includes'](_0x29038c,_0x284b58);});if(_0x958ce5){return _0x989742['id'];}}}));}}return BPromise['all'](_0xf138f6)[_0xb736('0x26')](function(_0xd5c527){_0x1515b7=_(_0x1515b7)[_0xb736('0x80')](_0xd5c527)['compact']()[_0xb736('0x81')]();return db[_0xb736('0x30')][_0xb736('0x4b')]({'where':{'id':_0xfca020['params']['id']}})['then'](function(_0x31b75b){return db[_0xb736('0x7d')]['transaction'](function(_0x5cb633){return _0x31b75b['removeTeams'](_0xfca020['query'][_0xb736('0x67')],{'transaction':_0x5cb633})[_0xb736('0x26')](function(){if(!_[_0xb736('0x82')](_0x1515b7)){return _0x31b75b[_0xb736('0x83')](_0x1515b7,{'transaction':_0x5cb633});}})[_0xb736('0x26')](function(){_0x1515b7[_0xb736('0x6d')](function(_0x3aa012){socket[_0xb736('0x6e')](_0xb736('0x84'),{'UserId':_0x3aa012,'MailQueueId':_0x31b75b['id']});});});});});});})[_0xb736('0x26')](respondWithStatusCode(_0x43df33,null))['catch'](handleError(_0x43df33,null));};exports[_0xb736('0x85')]=function(_0x2d16b3,_0x2bb522,_0xb7c45a){return db[_0xb736('0x30')]['find']({'where':{'id':_0x2d16b3['params']['id']}})[_0xb736('0x26')](handleEntityNotFound(_0x2bb522,null))[_0xb736('0x26')](function(_0x7ba16b){if(_0x7ba16b){return _0x7ba16b[_0xb736('0x85')](_0x2d16b3['body'][_0xb736('0x67')],_[_0xb736('0x86')](_0x2d16b3['body'],[_0xb736('0x67'),'id'])||{})[_0xb736('0x87')](function(_0xead7e8){for(var _0x2201fc=0x0;_0x2201fc<_0x2d16b3['body'][_0xb736('0x67')][_0xb736('0x3a')];_0x2201fc+=0x1){socket[_0xb736('0x6e')](_0xb736('0x6f'),{'UserId':Number(_0x2d16b3[_0xb736('0x4d')][_0xb736('0x67')][_0x2201fc]),'MailQueueId':Number(_0x2d16b3[_0xb736('0x49')]['id'])});}return _0xead7e8;});}})[_0xb736('0x26')](respondWithResult(_0x2bb522,null))['catch'](handleError(_0x2bb522,null));};exports[_0xb736('0x83')]=function(_0x58cd4e,_0x19c992,_0x17cbcd){return db[_0xb736('0x30')][_0xb736('0x4b')]({'where':{'id':_0x58cd4e['params']['id']}})['then'](handleEntityNotFound(_0x19c992,null))['then'](function(_0x66b835){if(_0x66b835){return _0x66b835['removeAgents'](_0x58cd4e[_0xb736('0x34')][_0xb736('0x67')])[_0xb736('0x26')](function(){if(_[_0xb736('0x88')](_0x58cd4e['query'][_0xb736('0x67')])){for(var _0x16f64f=0x0;_0x16f64f<_0x58cd4e['query'][_0xb736('0x67')][_0xb736('0x3a')];_0x16f64f+=0x1){socket[_0xb736('0x6e')]('userMailQueue:remove',{'UserId':Number(_0x58cd4e[_0xb736('0x34')][_0xb736('0x67')][_0x16f64f]),'MailQueueId':Number(_0x58cd4e[_0xb736('0x49')]['id'])});}}else{socket[_0xb736('0x6e')](_0xb736('0x84'),{'UserId':Number(_0x58cd4e[_0xb736('0x34')][_0xb736('0x67')]),'MailQueueId':Number(_0x58cd4e[_0xb736('0x49')]['id'])});}});}})[_0xb736('0x26')](respondWithStatusCode(_0x19c992,null))[_0xb736('0x47')](handleError(_0x19c992,null));};exports[_0xb736('0x89')]=function(_0x3bf2f0,_0x1158d8,_0x481263){var _0x56acb1={};var _0x49dbdb={};var _0x2ed05d;var _0xc9c2a4;return db[_0xb736('0x30')][_0xb736('0x56')]({'where':{'id':_0x3bf2f0[_0xb736('0x49')]['id']}})['then'](handleEntityNotFound(_0x1158d8,null))['then'](function(_0x3fac3a){if(_0x3fac3a){_0x2ed05d=_0x3fac3a;_0x49dbdb['model']=_[_0xb736('0x35')](db['User'][_0xb736('0x4a')]);_0x49dbdb['query']=_[_0xb736('0x35')](_0x3bf2f0['query']);_0x49dbdb[_0xb736('0x36')]=_[_0xb736('0x37')](_0x49dbdb[_0xb736('0x33')],_0x49dbdb[_0xb736('0x34')]);_0x56acb1[_0xb736('0x38')]=_[_0xb736('0x37')](_0x49dbdb[_0xb736('0x33')],qs['fields'](_0x3bf2f0[_0xb736('0x34')][_0xb736('0x39')]));_0x56acb1[_0xb736('0x38')]=_0x56acb1[_0xb736('0x38')]['length']?_0x56acb1[_0xb736('0x38')]:_0x49dbdb['model'];_0x56acb1['order']=qs['sort'](_0x3bf2f0['query'][_0xb736('0x3b')]);_0x56acb1[_0xb736('0x3c')]=qs[_0xb736('0x36')](_[_0xb736('0x3d')](_0x3bf2f0[_0xb736('0x34')],_0x49dbdb[_0xb736('0x36')]));if(_0x3bf2f0[_0xb736('0x34')][_0xb736('0x3e')]){_0x56acb1['where']=_['merge'](_0x56acb1[_0xb736('0x3c')],{'$or':_[_0xb736('0x2f')](_0x56acb1[_0xb736('0x38')],function(_0x260a8d){var _0x2605ed={};_0x2605ed[_0x260a8d]={'$like':'%'+_0x3bf2f0[_0xb736('0x34')][_0xb736('0x3e')]+'%'};return _0x2605ed;})});}_0x56acb1=_[_0xb736('0x3f')]({},_0x56acb1,_0x3bf2f0[_0xb736('0x41')]);return _0x2ed05d[_0xb736('0x89')](_0x56acb1);}})['then'](function(_0x567d8e){if(_0x567d8e){_0xc9c2a4=_0x567d8e['length'];if(!_0x3bf2f0[_0xb736('0x34')]['hasOwnProperty'](_0xb736('0x59'))){_0x56acb1['limit']=qs[_0xb736('0x20')](_0x3bf2f0[_0xb736('0x34')][_0xb736('0x20')]);_0x56acb1['offset']=qs[_0xb736('0x1e')](_0x3bf2f0[_0xb736('0x34')]['offset']);}return _0x2ed05d['getAgents'](_0x56acb1);}})[_0xb736('0x26')](function(_0x568174){if(_0x568174){return _0x568174?{'count':_0xc9c2a4,'rows':_0x568174}:null;}})['then'](respondWithResult(_0x1158d8,null))[_0xb736('0x47')](handleError(_0x1158d8,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 2478550..96fe38d 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 _0xafa5=['hasOwnProperty','hook','../../mysqldb','MailQueue','save','update','remove','emit'];(function(_0x1db831,_0x42b7b5){var _0x39ba56=function(_0x2c2dd3){while(--_0x2c2dd3){_0x1db831['push'](_0x1db831['shift']());}};_0x39ba56(++_0x42b7b5);}(_0xafa5,0x1b2));var _0x5afa=function(_0x4938c8,_0x313088){_0x4938c8=_0x4938c8-0x0;var _0x1355f3=_0xafa5[_0x4938c8];return _0x1355f3;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x5afa('0x0'))['db'][_0x5afa('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5afa('0x2'),'afterUpdate':_0x5afa('0x3'),'afterDestroy':_0x5afa('0x4')};function emitEvent(_0x10892d){return function(_0x573c68,_0x50ff68,_0x7b1b6e){MailQueueEvents[_0x5afa('0x5')](_0x10892d+':'+_0x573c68['id'],_0x573c68);MailQueueEvents[_0x5afa('0x5')](_0x10892d,_0x573c68);_0x7b1b6e(null);};}for(var e in events){if(events[_0x5afa('0x6')](e)){var event=events[e];MailQueue[_0x5afa('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0xe8e3=['update','remove','hasOwnProperty','hook','exports','../../mysqldb','MailQueue','save'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xe8e3,0x1c5));var _0x3e8e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe8e3[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x3e8e('0x0'))['db'][_0x3e8e('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3e8e('0x2'),'afterUpdate':_0x3e8e('0x3'),'afterDestroy':_0x3e8e('0x4')};function emitEvent(_0x3749d3){return function(_0x2bc01e,_0x2cb246,_0x2a467f){MailQueueEvents['emit'](_0x3749d3+':'+_0x2bc01e['id'],_0x2bc01e);MailQueueEvents['emit'](_0x3749d3,_0x2bc01e);_0x2a467f(null);};}for(var e in events){if(events[_0x3e8e('0x5')](e)){var event=events[e];MailQueue[_0x3e8e('0x6')](e,emitEvent(event));}}module[_0x3e8e('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 31259e0..d30aa4b 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 _0x2aaf=['request-promise','path','rimraf','../../config/environment','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x2aaf,0x120));var _0xf2aa=function(_0x1da22b,_0x1173ae){_0x1da22b=_0x1da22b-0x0;var _0x10cc46=_0x2aaf[_0x1da22b];return _0x10cc46;};'use strict';var _=require(_0xf2aa('0x0'));var util=require(_0xf2aa('0x1'));var logger=require(_0xf2aa('0x2'))(_0xf2aa('0x3'));var moment=require(_0xf2aa('0x4'));var BPromise=require(_0xf2aa('0x5'));var rp=require(_0xf2aa('0x6'));var fs=require('fs');var path=require(_0xf2aa('0x7'));var rimraf=require(_0xf2aa('0x8'));var config=require(_0xf2aa('0x9'));var attributes=require('./mailQueue.attributes');module[_0xf2aa('0xa')]=function(_0x53ff68,_0x4c8ad7){return _0x53ff68[_0xf2aa('0xb')](_0xf2aa('0xc'),attributes,{'tableName':_0xf2aa('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ae4=['request-promise','path','../../config/environment','./mailQueue.attributes','exports','MailQueue','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5a2837,_0x9e9907){var _0x3ecb8a=function(_0x53d58f){while(--_0x53d58f){_0x5a2837['push'](_0x5a2837['shift']());}};_0x3ecb8a(++_0x9e9907);}(_0x6ae4,0x95));var _0x46ae=function(_0x108de4,_0xf7cfbe){_0x108de4=_0x108de4-0x0;var _0x1455ab=_0x6ae4[_0x108de4];return _0x1455ab;};'use strict';var _=require(_0x46ae('0x0'));var util=require('util');var logger=require(_0x46ae('0x1'))(_0x46ae('0x2'));var moment=require(_0x46ae('0x3'));var BPromise=require(_0x46ae('0x4'));var rp=require(_0x46ae('0x5'));var fs=require('fs');var path=require(_0x46ae('0x6'));var rimraf=require('rimraf');var config=require(_0x46ae('0x7'));var attributes=require(_0x46ae('0x8'));module[_0x46ae('0x9')]=function(_0x140e4f,_0x502622){return _0x140e4f['define'](_0x46ae('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 3b75eb0..26f5a73 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 _0xe480=['GetMailQueue','MailQueue','findAll','options','where','attributes','limit','include','map','model','ShowMailQueue','find','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','request','then','info','request\x20sent','debug','error','code','MailQueue,\x20%s,\x20%s','message','result','catch'];(function(_0x5a5f51,_0x4195f1){var _0x221e01=function(_0x202c05){while(--_0x202c05){_0x5a5f51['push'](_0x5a5f51['shift']());}};_0x221e01(++_0x4195f1);}(_0xe480,0x17f));var _0x0e48=function(_0x2dd511,_0x6fe693){_0x2dd511=_0x2dd511-0x0;var _0xc2aafc=_0xe480[_0x2dd511];return _0xc2aafc;};'use strict';var _=require('lodash');var util=require(_0x0e48('0x0'));var moment=require(_0x0e48('0x1'));var BPromise=require(_0x0e48('0x2'));var rs=require(_0x0e48('0x3'));var fs=require('fs');var Redis=require(_0x0e48('0x4'));var db=require(_0x0e48('0x5'))['db'];var utils=require(_0x0e48('0x6'));var logger=require(_0x0e48('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x0e48('0x8')]=_[_0x0e48('0x9')](config[_0x0e48('0x8')],{'host':_0x0e48('0xa'),'port':0x18eb});var socket=require(_0x0e48('0xb'))(new Redis(config[_0x0e48('0x8')]));require(_0x0e48('0xc'))['register'](socket);function respondWithRpcPromise(_0x141bdc,_0x12c475,_0x10f93e){return new BPromise(function(_0x2cd2ea,_0x352fd6){return client[_0x0e48('0xd')](_0x141bdc,_0x10f93e)[_0x0e48('0xe')](function(_0x1baf40){logger[_0x0e48('0xf')]('MailQueue,\x20%s,\x20%s',_0x12c475,_0x0e48('0x10'));logger[_0x0e48('0x11')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x12c475,'request\x20sent',JSON['stringify'](_0x1baf40));if(_0x1baf40[_0x0e48('0x12')]){if(_0x1baf40[_0x0e48('0x12')][_0x0e48('0x13')]===0x1f4){logger[_0x0e48('0x12')](_0x0e48('0x14'),_0x12c475,_0x1baf40[_0x0e48('0x12')][_0x0e48('0x15')]);return _0x352fd6(_0x1baf40[_0x0e48('0x12')]['message']);}logger[_0x0e48('0x12')](_0x0e48('0x14'),_0x12c475,_0x1baf40[_0x0e48('0x12')]['message']);return _0x2cd2ea(_0x1baf40['error'][_0x0e48('0x15')]);}else{logger[_0x0e48('0xf')](_0x0e48('0x14'),_0x12c475,_0x0e48('0x10'));_0x2cd2ea(_0x1baf40[_0x0e48('0x16')][_0x0e48('0x15')]);}})[_0x0e48('0x17')](function(_0x25168a){logger[_0x0e48('0x12')](_0x0e48('0x14'),_0x12c475,_0x25168a);_0x352fd6(_0x25168a);});});}exports[_0x0e48('0x18')]=function(_0x393af0){var _0x4c3b4e=this;return new Promise(function(_0x1650d5,_0x356cb7){return db[_0x0e48('0x19')][_0x0e48('0x1a')]({'raw':_0x393af0[_0x0e48('0x1b')]?_0x393af0[_0x0e48('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x393af0['options']?_0x393af0['options'][_0x0e48('0x1c')]||null:null,'attributes':_0x393af0['options']?_0x393af0[_0x0e48('0x1b')][_0x0e48('0x1d')]||null:null,'limit':_0x393af0['options']?_0x393af0[_0x0e48('0x1b')][_0x0e48('0x1e')]||null:null,'include':_0x393af0[_0x0e48('0x1b')]?_0x393af0[_0x0e48('0x1b')][_0x0e48('0x1f')]?_[_0x0e48('0x20')](_0x393af0[_0x0e48('0x1b')][_0x0e48('0x1f')],function(_0x539c72){return{'model':db[_0x539c72[_0x0e48('0x21')]],'as':_0x539c72['as'],'attributes':_0x539c72[_0x0e48('0x1d')],'include':_0x539c72['include']?_['map'](_0x539c72[_0x0e48('0x1f')],function(_0x5079cc){return{'model':db[_0x5079cc[_0x0e48('0x21')]],'as':_0x5079cc['as'],'attributes':_0x5079cc[_0x0e48('0x1d')],'include':_0x5079cc[_0x0e48('0x1f')]?_[_0x0e48('0x20')](_0x5079cc[_0x0e48('0x1f')],function(_0x510e73){return{'model':db[_0x510e73['model']],'as':_0x510e73['as'],'attributes':_0x510e73[_0x0e48('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0e48('0xe')](function(_0x53ee62){logger[_0x0e48('0xf')](_0x0e48('0x18'),_0x393af0);logger[_0x0e48('0x11')](_0x0e48('0x18'),_0x393af0,JSON['stringify'](_0x53ee62));_0x1650d5(_0x53ee62);})[_0x0e48('0x17')](function(_0x57e3bb){logger[_0x0e48('0x12')](_0x0e48('0x18'),_0x57e3bb['message'],_0x393af0);_0x356cb7(_0x4c3b4e[_0x0e48('0x12')](0x1f4,_0x57e3bb[_0x0e48('0x15')]));});});};exports[_0x0e48('0x22')]=function(_0x933a9e){var _0x5a6101=this;return new Promise(function(_0x1aab21,_0x537e13){return db[_0x0e48('0x19')][_0x0e48('0x23')]({'raw':_0x933a9e[_0x0e48('0x1b')]?_0x933a9e[_0x0e48('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x933a9e[_0x0e48('0x1b')]?_0x933a9e[_0x0e48('0x1b')][_0x0e48('0x1c')]||null:null,'attributes':_0x933a9e['options']?_0x933a9e['options'][_0x0e48('0x1d')]||null:null,'include':_0x933a9e['options']?_0x933a9e['options']['include']?_[_0x0e48('0x20')](_0x933a9e['options'][_0x0e48('0x1f')],function(_0x194de7){return{'model':db[_0x194de7[_0x0e48('0x21')]],'as':_0x194de7['as'],'attributes':_0x194de7[_0x0e48('0x1d')],'include':_0x194de7['include']?_['map'](_0x194de7[_0x0e48('0x1f')],function(_0x54bf6a){return{'model':db[_0x54bf6a[_0x0e48('0x21')]],'as':_0x54bf6a['as'],'attributes':_0x54bf6a[_0x0e48('0x1d')],'include':_0x54bf6a['include']?_[_0x0e48('0x20')](_0x54bf6a['include'],function(_0x56a1b1){return{'model':db[_0x56a1b1[_0x0e48('0x21')]],'as':_0x56a1b1['as'],'attributes':_0x56a1b1[_0x0e48('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0e48('0xe')](function(_0x3d332e){logger['info'](_0x0e48('0x22'),_0x933a9e);logger[_0x0e48('0x11')]('ShowMailQueue',_0x933a9e,JSON[_0x0e48('0x24')](_0x3d332e));_0x1aab21(_0x3d332e);})[_0x0e48('0x17')](function(_0x1726f5){logger[_0x0e48('0x12')](_0x0e48('0x22'),_0x1726f5[_0x0e48('0x15')],_0x933a9e);_0x537e13(_0x5a6101[_0x0e48('0x12')](0x1f4,_0x1726f5[_0x0e48('0x15')]));});});}; \ No newline at end of file +var _0x552d=['request\x20sent','debug','stringify','code','error','message','info','result','GetMailQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch','MailQueue','find','ShowMailQueue','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x552d,0xbe));var _0xd552=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x552d[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0xd552('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd552('0x1'));var rs=require(_0xd552('0x2'));var fs=require('fs');var Redis=require(_0xd552('0x3'));var db=require(_0xd552('0x4'))['db'];var utils=require(_0xd552('0x5'));var logger=require(_0xd552('0x6'))(_0xd552('0x7'));var config=require(_0xd552('0x8'));var jayson=require(_0xd552('0x9'));var client=jayson['client'][_0xd552('0xa')]({'port':0x232a});config[_0xd552('0xb')]=_[_0xd552('0xc')](config[_0xd552('0xb')],{'host':_0xd552('0xd'),'port':0x18eb});var socket=require(_0xd552('0xe'))(new Redis(config['redis']));require(_0xd552('0xf'))[_0xd552('0x10')](socket);function respondWithRpcPromise(_0x2063a2,_0x49cd85,_0x3efaca){return new BPromise(function(_0x356cc2,_0x588e21){return client[_0xd552('0x11')](_0x2063a2,_0x3efaca)[_0xd552('0x12')](function(_0x3484a4){logger['info'](_0xd552('0x13'),_0x49cd85,_0xd552('0x14'));logger[_0xd552('0x15')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x49cd85,_0xd552('0x14'),JSON[_0xd552('0x16')](_0x3484a4));if(_0x3484a4['error']){if(_0x3484a4['error'][_0xd552('0x17')]===0x1f4){logger[_0xd552('0x18')](_0xd552('0x13'),_0x49cd85,_0x3484a4['error'][_0xd552('0x19')]);return _0x588e21(_0x3484a4[_0xd552('0x18')]['message']);}logger[_0xd552('0x18')](_0xd552('0x13'),_0x49cd85,_0x3484a4['error'][_0xd552('0x19')]);return _0x356cc2(_0x3484a4[_0xd552('0x18')][_0xd552('0x19')]);}else{logger[_0xd552('0x1a')](_0xd552('0x13'),_0x49cd85,_0xd552('0x14'));_0x356cc2(_0x3484a4[_0xd552('0x1b')]['message']);}})['catch'](function(_0x4eaf38){logger[_0xd552('0x18')]('MailQueue,\x20%s,\x20%s',_0x49cd85,_0x4eaf38);_0x588e21(_0x4eaf38);});});}exports[_0xd552('0x1c')]=function(_0x406b5d){var _0x207d0e=this;return new Promise(function(_0x5de25c,_0x497ca5){return db['MailQueue'][_0xd552('0x1d')]({'raw':_0x406b5d[_0xd552('0x1e')]?_0x406b5d['options'][_0xd552('0x1f')]===undefined?!![]:![]:!![],'where':_0x406b5d[_0xd552('0x1e')]?_0x406b5d[_0xd552('0x1e')][_0xd552('0x20')]||null:null,'attributes':_0x406b5d['options']?_0x406b5d[_0xd552('0x1e')][_0xd552('0x21')]||null:null,'limit':_0x406b5d['options']?_0x406b5d[_0xd552('0x1e')][_0xd552('0x22')]||null:null,'include':_0x406b5d['options']?_0x406b5d[_0xd552('0x1e')][_0xd552('0x23')]?_[_0xd552('0x24')](_0x406b5d[_0xd552('0x1e')][_0xd552('0x23')],function(_0x3085b9){return{'model':db[_0x3085b9[_0xd552('0x25')]],'as':_0x3085b9['as'],'attributes':_0x3085b9[_0xd552('0x21')],'include':_0x3085b9[_0xd552('0x23')]?_[_0xd552('0x24')](_0x3085b9[_0xd552('0x23')],function(_0x4cc2db){return{'model':db[_0x4cc2db['model']],'as':_0x4cc2db['as'],'attributes':_0x4cc2db['attributes'],'include':_0x4cc2db[_0xd552('0x23')]?_[_0xd552('0x24')](_0x4cc2db[_0xd552('0x23')],function(_0x12539d){return{'model':db[_0x12539d[_0xd552('0x25')]],'as':_0x12539d['as'],'attributes':_0x12539d[_0xd552('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd552('0x12')](function(_0x36f095){logger[_0xd552('0x1a')](_0xd552('0x1c'),_0x406b5d);logger[_0xd552('0x15')](_0xd552('0x1c'),_0x406b5d,JSON['stringify'](_0x36f095));_0x5de25c(_0x36f095);})[_0xd552('0x26')](function(_0x11ea96){logger[_0xd552('0x18')](_0xd552('0x1c'),_0x11ea96[_0xd552('0x19')],_0x406b5d);_0x497ca5(_0x207d0e['error'](0x1f4,_0x11ea96[_0xd552('0x19')]));});});};exports['ShowMailQueue']=function(_0x53a293){var _0x30fbed=this;return new Promise(function(_0x4c6e4a,_0x5c9f7a){return db[_0xd552('0x27')][_0xd552('0x28')]({'raw':_0x53a293[_0xd552('0x1e')]?_0x53a293['options']['raw']===undefined?!![]:![]:!![],'where':_0x53a293[_0xd552('0x1e')]?_0x53a293['options'][_0xd552('0x20')]||null:null,'attributes':_0x53a293[_0xd552('0x1e')]?_0x53a293['options'][_0xd552('0x21')]||null:null,'include':_0x53a293[_0xd552('0x1e')]?_0x53a293[_0xd552('0x1e')]['include']?_['map'](_0x53a293['options'][_0xd552('0x23')],function(_0x126f1a){return{'model':db[_0x126f1a[_0xd552('0x25')]],'as':_0x126f1a['as'],'attributes':_0x126f1a['attributes'],'include':_0x126f1a[_0xd552('0x23')]?_[_0xd552('0x24')](_0x126f1a[_0xd552('0x23')],function(_0x16242d){return{'model':db[_0x16242d['model']],'as':_0x16242d['as'],'attributes':_0x16242d['attributes'],'include':_0x16242d[_0xd552('0x23')]?_[_0xd552('0x24')](_0x16242d[_0xd552('0x23')],function(_0x1b9fbb){return{'model':db[_0x1b9fbb['model']],'as':_0x1b9fbb['as'],'attributes':_0x1b9fbb[_0xd552('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd552('0x12')](function(_0x30881f){logger[_0xd552('0x1a')]('ShowMailQueue',_0x53a293);logger['debug'](_0xd552('0x29'),_0x53a293,JSON[_0xd552('0x16')](_0x30881f));_0x4c6e4a(_0x30881f);})[_0xd552('0x26')](function(_0x5a7646){logger[_0xd552('0x18')](_0xd552('0x29'),_0x5a7646[_0xd552('0x19')],_0x53a293);_0x5c9f7a(_0x30fbed[_0xd552('0x18')](0x1f4,_0x5a7646[_0xd552('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index f8fa4d0..ce8169c 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 _0x79ea=['mailQueue:','./mailQueue.events','save','remove','emit','length'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0x79ea,0xbb));var _0xa79e=function(_0x4d6298,_0x502f6b){_0x4d6298=_0x4d6298-0x0;var _0x57ccf0=_0x79ea[_0x4d6298];return _0x57ccf0;};'use strict';var MailQueueEvents=require(_0xa79e('0x0'));var events=[_0xa79e('0x1'),_0xa79e('0x2'),'update'];function createListener(_0x339539,_0x66d61e){return function(_0x304689){_0x66d61e[_0xa79e('0x3')](_0x339539,_0x304689);};}function removeListener(_0x3ec1d9,_0x3fb797){return function(){MailQueueEvents['removeListener'](_0x3ec1d9,_0x3fb797);};}exports['register']=function(_0x2c1774){for(var _0x36c9bf=0x0,_0x6b017f=events[_0xa79e('0x4')];_0x36c9bf<_0x6b017f;_0x36c9bf++){var _0x6cc776=events[_0x36c9bf];var _0xa88b0d=createListener(_0xa79e('0x5')+_0x6cc776,_0x2c1774);MailQueueEvents['on'](_0x6cc776,_0xa88b0d);}}; \ No newline at end of file +var _0x9536=['./mailQueue.events','save','update','mailQueue:'];(function(_0x1242e3,_0x25067a){var _0x101405=function(_0x4fcb5e){while(--_0x4fcb5e){_0x1242e3['push'](_0x1242e3['shift']());}};_0x101405(++_0x25067a);}(_0x9536,0x188));var _0x6953=function(_0x49fcfb,_0x504dec){_0x49fcfb=_0x49fcfb-0x0;var _0x964926=_0x9536[_0x49fcfb];return _0x964926;};'use strict';var MailQueueEvents=require(_0x6953('0x0'));var events=[_0x6953('0x1'),'remove',_0x6953('0x2')];function createListener(_0x1bd3af,_0x4f269f){return function(_0x24106a){_0x4f269f['emit'](_0x1bd3af,_0x24106a);};}function removeListener(_0x1ec6d4,_0x2bbade){return function(){MailQueueEvents['removeListener'](_0x1ec6d4,_0x2bbade);};}exports['register']=function(_0x5e9215){for(var _0x4599fe=0x0,_0x54522f=events['length'];_0x4599fe<_0x54522f;_0x4599fe++){var _0x3a8c50=events[_0x4599fe];var _0xd7c6a=createListener(_0x6953('0x3')+_0x3a8c50,_0x5e9215);MailQueueEvents['on'](_0x3a8c50,_0xd7c6a);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 3809ee2..5e574f2 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 _0x5af6=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update','destroy','multer'];(function(_0x358fb5,_0x4407b8){var _0x4abfeb=function(_0x55c45d){while(--_0x55c45d){_0x358fb5['push'](_0x358fb5['shift']());}};_0x4abfeb(++_0x4407b8);}(_0x5af6,0xd0));var _0x65af=function(_0x452f86,_0x8d61bf){_0x452f86=_0x452f86-0x0;var _0x4f3fc0=_0x5af6[_0x452f86];return _0x4f3fc0;};'use strict';var multer=require(_0x65af('0x0'));var util=require(_0x65af('0x1'));var path=require(_0x65af('0x2'));var timeout=require(_0x65af('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x65af('0x4'));var auth=require(_0x65af('0x5'));var interaction=require(_0x65af('0x6'));var config=require(_0x65af('0x7'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0x65af('0x8')](),controller[_0x65af('0x9')]);router[_0x65af('0xa')](_0x65af('0xb'),auth[_0x65af('0x8')](),controller[_0x65af('0xc')]);router[_0x65af('0xa')](_0x65af('0xd'),auth[_0x65af('0x8')](),controller['show']);router[_0x65af('0xe')]('/',auth[_0x65af('0x8')](),controller[_0x65af('0xf')]);router[_0x65af('0x10')](_0x65af('0xd'),auth[_0x65af('0x8')](),controller[_0x65af('0x11')]);router['delete'](_0x65af('0xd'),auth['isAuthenticated'](),controller[_0x65af('0x12')]);module['exports']=router; \ No newline at end of file +var _0xce66=['put','/:id','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','index','/describe','describe','show','isAuthenticated','create'];(function(_0x409787,_0x14cc52){var _0x3b4f7a=function(_0x431de0){while(--_0x431de0){_0x409787['push'](_0x409787['shift']());}};_0x3b4f7a(++_0x14cc52);}(_0xce66,0x68));var _0x6ce6=function(_0x4695ba,_0x5a7f2a){_0x4695ba=_0x4695ba-0x0;var _0x524b7d=_0xce66[_0x4695ba];return _0x524b7d;};'use strict';var multer=require(_0x6ce6('0x0'));var util=require(_0x6ce6('0x1'));var path=require(_0x6ce6('0x2'));var timeout=require('connect-timeout');var express=require(_0x6ce6('0x3'));var router=express[_0x6ce6('0x4')]();var fs_extra=require(_0x6ce6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6ce6('0x6'));var config=require(_0x6ce6('0x7'));var controller=require(_0x6ce6('0x8'));router[_0x6ce6('0x9')]('/',auth['isAuthenticated'](),controller[_0x6ce6('0xa')]);router[_0x6ce6('0x9')](_0x6ce6('0xb'),auth['isAuthenticated'](),controller[_0x6ce6('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6ce6('0xd')]);router['post']('/',auth[_0x6ce6('0xe')](),controller[_0x6ce6('0xf')]);router[_0x6ce6('0x10')](_0x6ce6('0x11'),auth[_0x6ce6('0xe')](),controller['update']);router[_0x6ce6('0x12')](_0x6ce6('0x11'),auth[_0x6ce6('0xe')](),controller[_0x6ce6('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 27e7f1f..95487d2 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 _0xb111=['DATE','moment','sequelize','STRING'];(function(_0xb76da5,_0x1abd74){var _0x48dc32=function(_0x50e4db){while(--_0x50e4db){_0xb76da5['push'](_0xb76da5['shift']());}};_0x48dc32(++_0x1abd74);}(_0xb111,0x189));var _0x1b11=function(_0x51a30a,_0x5ba86e){_0x51a30a=_0x51a30a-0x0;var _0xe7661f=_0xb111[_0x51a30a];return _0xe7661f;};'use strict';var moment=require(_0x1b11('0x0'));var Sequelize=require(_0x1b11('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x1b11('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x1b11('0x2')]},'joinAt':{'type':Sequelize[_0x1b11('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x1b11('0x3')]},'exitAt':{'type':Sequelize[_0x1b11('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8cd5=['DATE','sequelize','exports','STRING'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x8cd5,0x141));var _0x58cd=function(_0x2c01fa,_0x5cfd46){_0x2c01fa=_0x2c01fa-0x0;var _0x146a9d=_0x8cd5[_0x2c01fa];return _0x146a9d;};'use strict';var moment=require('moment');var Sequelize=require(_0x58cd('0x0'));module[_0x58cd('0x1')]={'uniqueid':{'type':Sequelize[_0x58cd('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x58cd('0x2')]},'joinAt':{'type':Sequelize[_0x58cd('0x3')]},'leaveAt':{'type':Sequelize[_0x58cd('0x3')]},'acceptAt':{'type':Sequelize[_0x58cd('0x3')]},'exitAt':{'type':Sequelize[_0x58cd('0x3')]},'reason':{'type':Sequelize[_0x58cd('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 2773991..1406716 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 _0x77d4=['save','update','then','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','filter','options','includeAll','findAll','rows','catch','show','params','include','merge','find','create','body','describe','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject'];(function(_0x57eadc,_0x353afb){var _0xbbbf50=function(_0x4edd12){while(--_0x4edd12){_0x57eadc['push'](_0x57eadc['shift']());}};_0xbbbf50(++_0x353afb);}(_0x77d4,0x108));var _0x477d=function(_0x4e3992,_0x40cb82){_0x4e3992=_0x4e3992-0x0;var _0x90b49f=_0x77d4[_0x4e3992];return _0x90b49f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x477d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x477d('0x1'));var rp=require('request-promise');var moment=require(_0x477d('0x2'));var BPromise=require(_0x477d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x477d('0x4'));var sox=require(_0x477d('0x5'));var csv=require(_0x477d('0x6'));var ejs=require(_0x477d('0x7'));var fs=require('fs');var fs_extra=require(_0x477d('0x8'));var _=require(_0x477d('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x477d('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x477d('0xb'));var Papa=require(_0x477d('0xc'));var Redis=require(_0x477d('0xd'));var authService=require(_0x477d('0xe'));var qs=require(_0x477d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x477d('0x10'));var logger=require('../../config/logger')(_0x477d('0x11'));var utils=require(_0x477d('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x477d('0x13'));var db=require(_0x477d('0x14'))['db'];function respondWithStatusCode(_0x5a190c,_0x5dd33c){_0x5dd33c=_0x5dd33c||0xcc;return function(_0x6ff724){if(_0x6ff724){return _0x5a190c[_0x477d('0x15')](_0x5dd33c);}return _0x5a190c['status'](_0x5dd33c)[_0x477d('0x16')]();};}function respondWithResult(_0x1d5699,_0x48c73a){_0x48c73a=_0x48c73a||0xc8;return function(_0x4b2021){if(_0x4b2021){return _0x1d5699[_0x477d('0x17')](_0x48c73a)['json'](_0x4b2021);}};}function respondWithFilteredResult(_0x30481f,_0x234b99){return function(_0x25fc02){if(_0x25fc02){var _0x5985b5=typeof _0x234b99[_0x477d('0x18')]===_0x477d('0x19')&&typeof _0x234b99[_0x477d('0x1a')]===_0x477d('0x19');var _0x57b38e=_0x25fc02[_0x477d('0x1b')];var _0x5d5553=_0x5985b5?0x0:_0x234b99[_0x477d('0x18')];var _0x1399d7=_0x5985b5?_0x25fc02[_0x477d('0x1b')]:_0x234b99[_0x477d('0x18')]+_0x234b99[_0x477d('0x1a')];var _0x2145ce;if(_0x1399d7>=_0x57b38e){_0x1399d7=_0x57b38e;_0x2145ce=0xc8;}else{_0x2145ce=0xce;}_0x30481f['status'](_0x2145ce);return _0x30481f[_0x477d('0x1c')]('Content-Range',_0x5d5553+'-'+_0x1399d7+'/'+_0x57b38e)[_0x477d('0x1d')](_0x25fc02);}return null;};}function patchUpdates(_0x24a6d5){return function(_0x40256e){try{jsonpatch[_0x477d('0x1e')](_0x40256e,_0x24a6d5,!![]);}catch(_0x27b3aa){return BPromise[_0x477d('0x1f')](_0x27b3aa);}return _0x40256e[_0x477d('0x20')]();};}function saveUpdates(_0x17154d,_0x45a8bd){return function(_0x5981a){if(_0x5981a){return _0x5981a[_0x477d('0x21')](_0x17154d)[_0x477d('0x22')](function(_0x43c845){return _0x43c845;});}return null;};}function removeEntity(_0x1f3868,_0x4e6a44){return function(_0x4481b0){if(_0x4481b0){return _0x4481b0['destroy']()[_0x477d('0x22')](function(){_0x1f3868[_0x477d('0x17')](0xcc)[_0x477d('0x16')]();});}};}function handleEntityNotFound(_0x2287b4,_0x4bb50e){return function(_0xd6dca5){if(!_0xd6dca5){_0x2287b4[_0x477d('0x15')](0x194);}return _0xd6dca5;};}function handleError(_0x1ca4fe,_0x48ee5e){_0x48ee5e=_0x48ee5e||0x1f4;return function(_0x585648){logger[_0x477d('0x23')](_0x585648[_0x477d('0x24')]);if(_0x585648[_0x477d('0x25')]){delete _0x585648['name'];}_0x1ca4fe[_0x477d('0x17')](_0x48ee5e)[_0x477d('0x26')](_0x585648);};}exports[_0x477d('0x27')]=function(_0xe4dd40,_0x37b332){var _0x537fc4={},_0x2fc959={},_0xeb02f5={'count':0x0,'rows':[]};var _0x17dd16=_[_0x477d('0x28')](db[_0x477d('0x29')][_0x477d('0x2a')],function(_0x180046){return{'name':_0x180046[_0x477d('0x2b')],'type':_0x180046[_0x477d('0x2c')][_0x477d('0x2d')]};});_0x2fc959[_0x477d('0x2e')]=_[_0x477d('0x28')](_0x17dd16,_0x477d('0x25'));_0x2fc959[_0x477d('0x2f')]=_[_0x477d('0x30')](_0xe4dd40[_0x477d('0x2f')]);_0x2fc959[_0x477d('0x31')]=_[_0x477d('0x32')](_0x2fc959[_0x477d('0x2e')],_0x2fc959[_0x477d('0x2f')]);_0x537fc4['attributes']=_[_0x477d('0x32')](_0x2fc959['model'],qs[_0x477d('0x33')](_0xe4dd40[_0x477d('0x2f')][_0x477d('0x33')]));_0x537fc4['attributes']=_0x537fc4[_0x477d('0x34')][_0x477d('0x35')]?_0x537fc4[_0x477d('0x34')]:_0x2fc959[_0x477d('0x2e')];if(!_0xe4dd40[_0x477d('0x2f')][_0x477d('0x36')](_0x477d('0x37'))){_0x537fc4[_0x477d('0x1a')]=qs[_0x477d('0x1a')](_0xe4dd40[_0x477d('0x2f')]['limit']);_0x537fc4[_0x477d('0x18')]=qs[_0x477d('0x18')](_0xe4dd40[_0x477d('0x2f')]['offset']);}_0x537fc4[_0x477d('0x38')]=qs[_0x477d('0x39')](_0xe4dd40[_0x477d('0x2f')]['sort']);_0x537fc4['where']=qs[_0x477d('0x31')](_[_0x477d('0x3a')](_0xe4dd40[_0x477d('0x2f')],_0x2fc959[_0x477d('0x31')]),_0x17dd16);if(_0xe4dd40[_0x477d('0x2f')]['filter']){_0x537fc4[_0x477d('0x3b')]=_['merge'](_0x537fc4[_0x477d('0x3b')],{'$or':_[_0x477d('0x28')](_0x17dd16,function(_0x356f41){if(_0x356f41['type']!=='VIRTUAL'){var _0x184d50={};_0x184d50[_0x356f41[_0x477d('0x25')]]={'$like':'%'+_0xe4dd40[_0x477d('0x2f')][_0x477d('0x3c')]+'%'};return _0x184d50;}})});}_0x537fc4=_['merge']({},_0x537fc4,_0xe4dd40[_0x477d('0x3d')]);var _0xc091e={'where':_0x537fc4[_0x477d('0x3b')]};return db[_0x477d('0x29')][_0x477d('0x1b')](_0xc091e)['then'](function(_0x472149){_0xeb02f5[_0x477d('0x1b')]=_0x472149;if(_0xe4dd40['query'][_0x477d('0x3e')]){_0x537fc4['include']=[{'all':!![]}];}return db[_0x477d('0x29')][_0x477d('0x3f')](_0x537fc4);})[_0x477d('0x22')](function(_0x335b2a){_0xeb02f5[_0x477d('0x40')]=_0x335b2a;return _0xeb02f5;})[_0x477d('0x22')](respondWithFilteredResult(_0x37b332,_0x537fc4))[_0x477d('0x41')](handleError(_0x37b332,null));};exports[_0x477d('0x42')]=function(_0x43ffd1,_0x4c22f5){var _0x5759f={'raw':!![],'where':{'id':_0x43ffd1[_0x477d('0x43')]['id']}},_0x31c9a1={};_0x31c9a1[_0x477d('0x2e')]=_['keys'](db['MailQueueReport'][_0x477d('0x2a')]);_0x31c9a1[_0x477d('0x2f')]=_['keys'](_0x43ffd1[_0x477d('0x2f')]);_0x31c9a1['filters']=_['intersection'](_0x31c9a1[_0x477d('0x2e')],_0x31c9a1[_0x477d('0x2f')]);_0x5759f[_0x477d('0x34')]=_[_0x477d('0x32')](_0x31c9a1[_0x477d('0x2e')],qs[_0x477d('0x33')](_0x43ffd1['query'][_0x477d('0x33')]));_0x5759f[_0x477d('0x34')]=_0x5759f[_0x477d('0x34')][_0x477d('0x35')]?_0x5759f[_0x477d('0x34')]:_0x31c9a1['model'];if(_0x43ffd1['query'][_0x477d('0x3e')]){_0x5759f[_0x477d('0x44')]=[{'all':!![]}];}_0x5759f=_[_0x477d('0x45')]({},_0x5759f,_0x43ffd1['options']);return db[_0x477d('0x29')][_0x477d('0x46')](_0x5759f)[_0x477d('0x22')](handleEntityNotFound(_0x4c22f5,null))[_0x477d('0x22')](respondWithResult(_0x4c22f5,null))[_0x477d('0x41')](handleError(_0x4c22f5,null));};exports[_0x477d('0x47')]=function(_0x13f606,_0x4d4e19){return db[_0x477d('0x29')][_0x477d('0x47')](_0x13f606[_0x477d('0x48')],{})[_0x477d('0x22')](respondWithResult(_0x4d4e19,0xc9))[_0x477d('0x41')](handleError(_0x4d4e19,null));};exports[_0x477d('0x21')]=function(_0x2aad84,_0x30e474){if(_0x2aad84[_0x477d('0x48')]['id']){delete _0x2aad84[_0x477d('0x48')]['id'];}return db[_0x477d('0x29')][_0x477d('0x46')]({'where':{'id':_0x2aad84[_0x477d('0x43')]['id']}})[_0x477d('0x22')](handleEntityNotFound(_0x30e474,null))[_0x477d('0x22')](saveUpdates(_0x2aad84['body'],null))[_0x477d('0x22')](respondWithResult(_0x30e474,null))[_0x477d('0x41')](handleError(_0x30e474,null));};exports['destroy']=function(_0x566ba0,_0x5cb3ca){return db[_0x477d('0x29')][_0x477d('0x46')]({'where':{'id':_0x566ba0[_0x477d('0x43')]['id']}})[_0x477d('0x22')](handleEntityNotFound(_0x5cb3ca,null))[_0x477d('0x22')](removeEntity(_0x5cb3ca,null))[_0x477d('0x41')](handleError(_0x5cb3ca,null));};exports[_0x477d('0x49')]=function(_0x342f18,_0x593faf){return db[_0x477d('0x29')][_0x477d('0x49')]()[_0x477d('0x22')](respondWithResult(_0x593faf,null))[_0x477d('0x41')](handleError(_0x593faf,null));}; \ No newline at end of file +var _0x0b0e=['merge','where','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','params','describe','eml-format','zip-dir','request-promise','moment','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','MailQueueReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter'];(function(_0x22671d,_0x5162b0){var _0x4ec432=function(_0x3af150){while(--_0x3af150){_0x22671d['push'](_0x22671d['shift']());}};_0x4ec432(++_0x5162b0);}(_0x0b0e,0x187));var _0xe0b0=function(_0x101134,_0x1ed1d3){_0x101134=_0x101134-0x0;var _0xc47acc=_0x0b0e[_0x101134];return _0xc47acc;};'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['MailQueueReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'all':!![]}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x41')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x402a0e){_0x36d137[_0xe0b0('0x42')]=_0x402a0e;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))[_0xe0b0('0x43')](handleError(_0x5b7a64,null));};exports[_0xe0b0('0x44')]=function(_0x52ffe4,_0x2aad80){var _0x309bbf={'raw':!![],'where':{'id':_0x52ffe4['params']['id']}},_0x528818={};_0x528818[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db['MailQueueReport'][_0xe0b0('0x2b')]);_0x528818[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x52ffe4[_0xe0b0('0x2e')]);_0x528818[_0xe0b0('0x39')]=_['intersection'](_0x528818['model'],_0x528818['query']);_0x309bbf[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x528818['model'],qs[_0xe0b0('0x33')](_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x309bbf[_0xe0b0('0x32')]=_0x309bbf[_0xe0b0('0x32')]['length']?_0x309bbf['attributes']:_0x528818[_0xe0b0('0x31')];if(_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x309bbf[_0xe0b0('0x45')]=[{'all':!![]}];}_0x309bbf=_[_0xe0b0('0x3b')]({},_0x309bbf,_0x52ffe4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x46')](_0x309bbf)['then'](handleEntityNotFound(_0x2aad80,null))['then'](respondWithResult(_0x2aad80,null))['catch'](handleError(_0x2aad80,null));};exports[_0xe0b0('0x47')]=function(_0x2184d3,_0x2419ce){return db[_0xe0b0('0x2a')]['create'](_0x2184d3[_0xe0b0('0x48')],{})[_0xe0b0('0x23')](respondWithResult(_0x2419ce,0xc9))['catch'](handleError(_0x2419ce,null));};exports['update']=function(_0x2365be,_0x1bc6e0){if(_0x2365be['body']['id']){delete _0x2365be[_0xe0b0('0x48')]['id'];}return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x2365be['params']['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x1bc6e0,null))['then'](saveUpdates(_0x2365be[_0xe0b0('0x48')],null))[_0xe0b0('0x23')](respondWithResult(_0x1bc6e0,null))[_0xe0b0('0x43')](handleError(_0x1bc6e0,null));};exports[_0xe0b0('0x24')]=function(_0x19ee71,_0xf9e694){return db['MailQueueReport']['find']({'where':{'id':_0x19ee71[_0xe0b0('0x49')]['id']}})['then'](handleEntityNotFound(_0xf9e694,null))['then'](removeEntity(_0xf9e694,null))[_0xe0b0('0x43')](handleError(_0xf9e694,null));};exports[_0xe0b0('0x4a')]=function(_0x54cf7b,_0x4b65d1){return db[_0xe0b0('0x2a')][_0xe0b0('0x4a')]()[_0xe0b0('0x23')](respondWithResult(_0x4b65d1,null))[_0xe0b0('0x43')](handleError(_0x4b65d1,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index a0ca227..d1ec9a1 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 _0xbd0a=['uniqueid','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','report_mail_queue'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x1666a9,_0xca5662){_0x1666a9=_0x1666a9-0x0;var _0x21203d=_0xbd0a[_0x1666a9];return _0x21203d;};'use strict';var _=require(_0xabd0('0x0'));var util=require('util');var logger=require(_0xabd0('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xabd0('0x2'));var fs=require('fs');var path=require(_0xabd0('0x3'));var rimraf=require(_0xabd0('0x4'));var config=require(_0xabd0('0x5'));var attributes=require(_0xabd0('0x6'));module[_0xabd0('0x7')]=function(_0x221368,_0xb41697){return _0x221368[_0xabd0('0x8')]('MailQueueReport',attributes,{'tableName':_0xabd0('0x9'),'paranoid':![],'indexes':[{'name':_0xabd0('0xa'),'fields':[_0xabd0('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa01e=['MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api','request-promise','rimraf','./mailQueueReport.attributes','exports','define'];(function(_0x189f59,_0x58b2c8){var _0x3acc2d=function(_0x16ea49){while(--_0x16ea49){_0x189f59['push'](_0x189f59['shift']());}};_0x3acc2d(++_0x58b2c8);}(_0xa01e,0x1f2));var _0xea01=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xa01e[_0x53cf8e];return _0x459197;};'use strict';var _=require(_0xea01('0x0'));var util=require('util');var logger=require(_0xea01('0x1'))(_0xea01('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xea01('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea01('0x4'));var config=require('../../config/environment');var attributes=require(_0xea01('0x5'));module[_0xea01('0x6')]=function(_0x2d0fe7,_0x4dd906){return _0x2d0fe7[_0xea01('0x7')](_0xea01('0x8'),attributes,{'tableName':_0xea01('0x9'),'paranoid':![],'indexes':[{'name':_0xea01('0xa'),'fields':[_0xea01('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index ade990e..0057b48 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(_0x2ff238,_0x1811d2){var _0x204a56=function(_0x5bf2e1){while(--_0x5bf2e1){_0x2ff238['push'](_0x2ff238['shift']());}};_0x204a56(++_0x1811d2);}(_0x2ef3,0xba));var _0x32ef=function(_0x2c2286,_0x2fbb5f){_0x2c2286=_0x2c2286-0x0;var _0x273e79=_0x2ef3[_0x2c2286];return _0x273e79;};'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 _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x185983,_0x446531){var _0x465143=function(_0x40024a){while(--_0x40024a){_0x185983['push'](_0x185983['shift']());}};_0x465143(++_0x446531);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xc4aa[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 8377f3c..1a4da29 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3d0329,_0x2c1986){var _0x7e78e3=function(_0x1a6cac){while(--_0x1a6cac){_0x3d0329['push'](_0x3d0329['shift']());}};_0x7e78e3(++_0x2c1986);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2952cd,_0x23523d){var _0x24d076=function(_0x3e573f){while(--_0x3e573f){_0x2952cd['push'](_0x2952cd['shift']());}};_0x24d076(++_0x23523d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0xcb91[_0x1cd47d];return _0x29d52f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 44a0bce..246cffc 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 _0xb682=['INBOX','exports','STRING','BOOLEAN','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb682,0x79));var _0x2b68=function(_0x4090cd,_0x55a2f0){_0x4090cd=_0x4090cd-0x0;var _0x522fbe=_0xb682[_0x4090cd];return _0x522fbe;};'use strict';var Sequelize=require('sequelize');module[_0x2b68('0x0')]={'description':{'type':Sequelize[_0x2b68('0x1')]},'host':{'type':Sequelize[_0x2b68('0x1')]},'authentication':{'type':Sequelize[_0x2b68('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x2b68('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x2b68('0x3')]},'tls':{'type':Sequelize[_0x2b68('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x2b68('0x1')],'defaultValue':_0x2b68('0x4')},'connTimeout':{'type':Sequelize[_0x2b68('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x2b68('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x9cc4=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x9cc4,0x1b4));var _0x49cc=function(_0x7c0f74,_0x115cff){_0x7c0f74=_0x7c0f74-0x0;var _0x97cfd7=_0x9cc4[_0x7c0f74];return _0x97cfd7;};'use strict';var Sequelize=require(_0x49cc('0x0'));module[_0x49cc('0x1')]={'description':{'type':Sequelize[_0x49cc('0x2')]},'host':{'type':Sequelize[_0x49cc('0x2')]},'authentication':{'type':Sequelize[_0x49cc('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x49cc('0x2')]},'password':{'type':Sequelize[_0x49cc('0x2')]},'port':{'type':Sequelize[_0x49cc('0x4')]},'tls':{'type':Sequelize[_0x49cc('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x49cc('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x49cc('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x49cc('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 491c035..9489ad8 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 _0xc6c3=['rimraf','../../config/environment','./mailServerIn.attributes','exports','mail_servers_in','../../config/logger','moment','bluebird','path'];(function(_0x1e7fbc,_0x435c09){var _0x167333=function(_0x488345){while(--_0x488345){_0x1e7fbc['push'](_0x1e7fbc['shift']());}};_0x167333(++_0x435c09);}(_0xc6c3,0x1ac));var _0x3c6c=function(_0x486fae,_0x1e81e4){_0x486fae=_0x486fae-0x0;var _0xbeb80a=_0xc6c3[_0x486fae];return _0xbeb80a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3c6c('0x0'))('api');var moment=require(_0x3c6c('0x1'));var BPromise=require(_0x3c6c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c6c('0x3'));var rimraf=require(_0x3c6c('0x4'));var config=require(_0x3c6c('0x5'));var attributes=require(_0x3c6c('0x6'));module[_0x3c6c('0x7')]=function(_0x51634c,_0x509a50){return _0x51634c['define']('MailServerIn',attributes,{'tableName':_0x3c6c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd921=['MailServerIn','mail_servers_in','util','api','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x419e17,_0x7fe78c){var _0x1f2044=function(_0x3723e6){while(--_0x3723e6){_0x419e17['push'](_0x419e17['shift']());}};_0x1f2044(++_0x7fe78c);}(_0xd921,0x84));var _0x1d92=function(_0x299755,_0x3e7fcd){_0x299755=_0x299755-0x0;var _0x39c698=_0xd921[_0x299755];return _0x39c698;};'use strict';var _=require('lodash');var util=require(_0x1d92('0x0'));var logger=require('../../config/logger')(_0x1d92('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1d92('0x2'));var fs=require('fs');var path=require(_0x1d92('0x3'));var rimraf=require(_0x1d92('0x4'));var config=require(_0x1d92('0x5'));var attributes=require('./mailServerIn.attributes');module[_0x1d92('0x6')]=function(_0x2597cd,_0x2649ef){return _0x2597cd[_0x1d92('0x7')](_0x1d92('0x8'),attributes,{'tableName':_0x1d92('0x9'),'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 042f1ef..1764fe5 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 _0xda79=['map','model','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','where','attributes','limit','include'];(function(_0x21f87a,_0x3b40f3){var _0x401bde=function(_0xfe6447){while(--_0xfe6447){_0x21f87a['push'](_0x21f87a['shift']());}};_0x401bde(++_0x3b40f3);}(_0xda79,0x82));var _0x9da7=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xda79[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x9da7('0x0'));var util=require(_0x9da7('0x1'));var moment=require('moment');var BPromise=require(_0x9da7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9da7('0x3'));var db=require(_0x9da7('0x4'))['db'];var utils=require(_0x9da7('0x5'));var logger=require('../../config/logger')(_0x9da7('0x6'));var config=require(_0x9da7('0x7'));var jayson=require(_0x9da7('0x8'));var client=jayson[_0x9da7('0x9')][_0x9da7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1cfb66,_0x3fc0ba,_0x558307){return new BPromise(function(_0x5cd11e,_0x116acf){return client['request'](_0x1cfb66,_0x558307)[_0x9da7('0xb')](function(_0x3b65f6){logger[_0x9da7('0xc')](_0x9da7('0xd'),_0x3fc0ba,_0x9da7('0xe'));logger[_0x9da7('0xf')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x3fc0ba,_0x9da7('0xe'),JSON[_0x9da7('0x10')](_0x3b65f6));if(_0x3b65f6[_0x9da7('0x11')]){if(_0x3b65f6['error'][_0x9da7('0x12')]===0x1f4){logger[_0x9da7('0x11')](_0x9da7('0xd'),_0x3fc0ba,_0x3b65f6[_0x9da7('0x11')][_0x9da7('0x13')]);return _0x116acf(_0x3b65f6[_0x9da7('0x11')][_0x9da7('0x13')]);}logger[_0x9da7('0x11')]('MailServerIn,\x20%s,\x20%s',_0x3fc0ba,_0x3b65f6[_0x9da7('0x11')][_0x9da7('0x13')]);return _0x5cd11e(_0x3b65f6[_0x9da7('0x11')]['message']);}else{logger[_0x9da7('0xc')](_0x9da7('0xd'),_0x3fc0ba,_0x9da7('0xe'));_0x5cd11e(_0x3b65f6[_0x9da7('0x14')][_0x9da7('0x13')]);}})[_0x9da7('0x15')](function(_0x1c9068){logger['error'](_0x9da7('0xd'),_0x3fc0ba,_0x1c9068);_0x116acf(_0x1c9068);});});}exports[_0x9da7('0x16')]=function(_0x5b481d){var _0x29f89c=this;return new Promise(function(_0xbe32c5,_0x128245){return db[_0x9da7('0x17')][_0x9da7('0x18')]({'raw':_0x5b481d[_0x9da7('0x19')]?_0x5b481d[_0x9da7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5b481d['options']?_0x5b481d[_0x9da7('0x19')][_0x9da7('0x1a')]||null:null,'attributes':_0x5b481d['options']?_0x5b481d[_0x9da7('0x19')][_0x9da7('0x1b')]||null:null,'limit':_0x5b481d[_0x9da7('0x19')]?_0x5b481d[_0x9da7('0x19')][_0x9da7('0x1c')]||null:null,'include':_0x5b481d['options']?_0x5b481d[_0x9da7('0x19')][_0x9da7('0x1d')]?_[_0x9da7('0x1e')](_0x5b481d['options']['include'],function(_0x4e979e){return{'model':db[_0x4e979e[_0x9da7('0x1f')]],'as':_0x4e979e['as'],'attributes':_0x4e979e['attributes'],'include':_0x4e979e['include']?_['map'](_0x4e979e[_0x9da7('0x1d')],function(_0x7d3d44){return{'model':db[_0x7d3d44[_0x9da7('0x1f')]],'as':_0x7d3d44['as'],'attributes':_0x7d3d44[_0x9da7('0x1b')],'include':_0x7d3d44[_0x9da7('0x1d')]?_[_0x9da7('0x1e')](_0x7d3d44['include'],function(_0x252373){return{'model':db[_0x252373[_0x9da7('0x1f')]],'as':_0x252373['as'],'attributes':_0x252373[_0x9da7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9da7('0xb')](function(_0x5bd6d3){logger[_0x9da7('0xc')]('GetMailServerIn',_0x5b481d);logger[_0x9da7('0xf')](_0x9da7('0x16'),_0x5b481d,JSON[_0x9da7('0x10')](_0x5bd6d3));_0xbe32c5(_0x5bd6d3);})[_0x9da7('0x15')](function(_0x413156){logger[_0x9da7('0x11')](_0x9da7('0x16'),_0x413156['message'],_0x5b481d);_0x128245(_0x29f89c[_0x9da7('0x11')](0x1f4,_0x413156[_0x9da7('0x13')]));});});}; \ No newline at end of file +var _0x609a=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','options','raw','where','attributes','limit','include','map','model','lodash','util','moment'];(function(_0x99ff94,_0x47a1b1){var _0x1b5bc0=function(_0x25821f){while(--_0x25821f){_0x99ff94['push'](_0x99ff94['shift']());}};_0x1b5bc0(++_0x47a1b1);}(_0x609a,0x1ec));var _0xa609=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x609a[_0x432682];return _0x463d05;};'use strict';var _=require(_0xa609('0x0'));var util=require(_0xa609('0x1'));var moment=require(_0xa609('0x2'));var BPromise=require(_0xa609('0x3'));var rs=require(_0xa609('0x4'));var fs=require('fs');var Redis=require(_0xa609('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa609('0x6'));var logger=require('../../config/logger')(_0xa609('0x7'));var config=require(_0xa609('0x8'));var jayson=require(_0xa609('0x9'));var client=jayson[_0xa609('0xa')][_0xa609('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x409f8d,_0x394cde,_0x269447){return new BPromise(function(_0x29f23a,_0x3b5da3){return client[_0xa609('0xc')](_0x409f8d,_0x269447)[_0xa609('0xd')](function(_0x52e06a){logger[_0xa609('0xe')]('MailServerIn,\x20%s,\x20%s',_0x394cde,_0xa609('0xf'));logger[_0xa609('0x10')](_0xa609('0x11'),_0x394cde,_0xa609('0xf'),JSON['stringify'](_0x52e06a));if(_0x52e06a[_0xa609('0x12')]){if(_0x52e06a[_0xa609('0x12')][_0xa609('0x13')]===0x1f4){logger['error'](_0xa609('0x14'),_0x394cde,_0x52e06a[_0xa609('0x12')][_0xa609('0x15')]);return _0x3b5da3(_0x52e06a[_0xa609('0x12')][_0xa609('0x15')]);}logger[_0xa609('0x12')](_0xa609('0x14'),_0x394cde,_0x52e06a[_0xa609('0x12')][_0xa609('0x15')]);return _0x29f23a(_0x52e06a[_0xa609('0x12')][_0xa609('0x15')]);}else{logger['info'](_0xa609('0x14'),_0x394cde,_0xa609('0xf'));_0x29f23a(_0x52e06a[_0xa609('0x16')][_0xa609('0x15')]);}})[_0xa609('0x17')](function(_0x44bab4){logger[_0xa609('0x12')](_0xa609('0x14'),_0x394cde,_0x44bab4);_0x3b5da3(_0x44bab4);});});}exports[_0xa609('0x18')]=function(_0x1c9bed){var _0x26b4ea=this;return new Promise(function(_0x3e6eac,_0x338be7){return db['MailServerIn']['findAll']({'raw':_0x1c9bed[_0xa609('0x19')]?_0x1c9bed[_0xa609('0x19')][_0xa609('0x1a')]===undefined?!![]:![]:!![],'where':_0x1c9bed[_0xa609('0x19')]?_0x1c9bed[_0xa609('0x19')][_0xa609('0x1b')]||null:null,'attributes':_0x1c9bed['options']?_0x1c9bed[_0xa609('0x19')][_0xa609('0x1c')]||null:null,'limit':_0x1c9bed['options']?_0x1c9bed[_0xa609('0x19')][_0xa609('0x1d')]||null:null,'include':_0x1c9bed['options']?_0x1c9bed[_0xa609('0x19')][_0xa609('0x1e')]?_[_0xa609('0x1f')](_0x1c9bed[_0xa609('0x19')][_0xa609('0x1e')],function(_0x210943){return{'model':db[_0x210943[_0xa609('0x20')]],'as':_0x210943['as'],'attributes':_0x210943['attributes'],'include':_0x210943[_0xa609('0x1e')]?_[_0xa609('0x1f')](_0x210943['include'],function(_0x33673c){return{'model':db[_0x33673c[_0xa609('0x20')]],'as':_0x33673c['as'],'attributes':_0x33673c['attributes'],'include':_0x33673c[_0xa609('0x1e')]?_[_0xa609('0x1f')](_0x33673c[_0xa609('0x1e')],function(_0x495b95){return{'model':db[_0x495b95[_0xa609('0x20')]],'as':_0x495b95['as'],'attributes':_0x495b95[_0xa609('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa609('0xd')](function(_0x1c46b0){logger[_0xa609('0xe')](_0xa609('0x18'),_0x1c9bed);logger[_0xa609('0x10')](_0xa609('0x18'),_0x1c9bed,JSON['stringify'](_0x1c46b0));_0x3e6eac(_0x1c46b0);})[_0xa609('0x17')](function(_0x816a3b){logger['error'](_0xa609('0x18'),_0x816a3b[_0xa609('0x15')],_0x1c9bed);_0x338be7(_0x26b4ea[_0xa609('0x12')](0x1f4,_0x816a3b[_0xa609('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index daaa6c0..0803723 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index f7a835a..774d484 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 _0x0bb5=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0bb5,0x148));var _0x50bb=function(_0x1c3c37,_0x440c5d){_0x1c3c37=_0x1c3c37-0x0;var _0x59ca38=_0x0bb5[_0x1c3c37];return _0x59ca38;};'use strict';var Sequelize=require(_0x50bb('0x0'));module[_0x50bb('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x50bb('0x2')]},'pass':{'type':Sequelize[_0x50bb('0x2')]},'port':{'type':Sequelize[_0x50bb('0x3')]},'secure':{'type':Sequelize[_0x50bb('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x50bb('0x2')]},'authentication':{'type':Sequelize[_0x50bb('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x50bb('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x0972=['exports','STRING','INTEGER','BOOLEAN'];(function(_0x44ca57,_0x190d2c){var _0x3aa7ae=function(_0x1babbe){while(--_0x1babbe){_0x44ca57['push'](_0x44ca57['shift']());}};_0x3aa7ae(++_0x190d2c);}(_0x0972,0x64));var _0x2097=function(_0x2492a2,_0x40faab){_0x2492a2=_0x2492a2-0x0;var _0x2e0be7=_0x0972[_0x2492a2];return _0x2e0be7;};'use strict';var Sequelize=require('sequelize');module[_0x2097('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x2097('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x2097('0x1')]},'port':{'type':Sequelize[_0x2097('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x2097('0x1')]},'authentication':{'type':Sequelize[_0x2097('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x2097('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index f51caef..0a05ce2 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 _0x7b35=['then','error','stack','name','send','index','map','MailServerOut','rawAttributes','type','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update'];(function(_0x582d0b,_0x28f609){var _0x2e93e1=function(_0xb6a81c){while(--_0xb6a81c){_0x582d0b['push'](_0x582d0b['shift']());}};_0x2e93e1(++_0x28f609);}(_0x7b35,0x70));var _0x57b3=function(_0x2f348e,_0x48bd08){_0x2f348e=_0x2f348e-0x0;var _0x2c6283=_0x7b35[_0x2f348e];return _0x2c6283;};'use strict';var emlformat=require(_0x57b3('0x0'));var rimraf=require(_0x57b3('0x1'));var zipdir=require(_0x57b3('0x2'));var jsonpatch=require(_0x57b3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x57b3('0x4'));var Mustache=require(_0x57b3('0x5'));var util=require('util');var path=require(_0x57b3('0x6'));var sox=require(_0x57b3('0x7'));var csv=require(_0x57b3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x57b3('0x9'));var _=require(_0x57b3('0xa'));var squel=require(_0x57b3('0xb'));var crypto=require(_0x57b3('0xc'));var jsforce=require(_0x57b3('0xd'));var deskjs=require(_0x57b3('0xe'));var toCsv=require(_0x57b3('0x8'));var querystring=require(_0x57b3('0xf'));var Papa=require('papaparse');var Redis=require(_0x57b3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x57b3('0x11'));var as=require(_0x57b3('0x12'));var hardwareService=require(_0x57b3('0x13'));var logger=require(_0x57b3('0x14'))(_0x57b3('0x15'));var utils=require(_0x57b3('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x57b3('0x17'))['db'];function respondWithStatusCode(_0x240cab,_0x2830f5){_0x2830f5=_0x2830f5||0xcc;return function(_0x4db73a){if(_0x4db73a){return _0x240cab[_0x57b3('0x18')](_0x2830f5);}return _0x240cab['status'](_0x2830f5)[_0x57b3('0x19')]();};}function respondWithResult(_0x3d7794,_0x181b3c){_0x181b3c=_0x181b3c||0xc8;return function(_0x41c524){if(_0x41c524){return _0x3d7794[_0x57b3('0x1a')](_0x181b3c)[_0x57b3('0x1b')](_0x41c524);}};}function respondWithFilteredResult(_0xb6a0d8,_0x14cd1f){return function(_0x967432){if(_0x967432){var _0x5ea562=typeof _0x14cd1f['offset']===_0x57b3('0x1c')&&typeof _0x14cd1f['limit']===_0x57b3('0x1c');var _0x524bda=_0x967432['count'];var _0x302d02=_0x5ea562?0x0:_0x14cd1f[_0x57b3('0x1d')];var _0x778489=_0x5ea562?_0x967432[_0x57b3('0x1e')]:_0x14cd1f[_0x57b3('0x1d')]+_0x14cd1f[_0x57b3('0x1f')];var _0x5c0f98;if(_0x778489>=_0x524bda){_0x778489=_0x524bda;_0x5c0f98=0xc8;}else{_0x5c0f98=0xce;}_0xb6a0d8[_0x57b3('0x1a')](_0x5c0f98);return _0xb6a0d8[_0x57b3('0x20')](_0x57b3('0x21'),_0x302d02+'-'+_0x778489+'/'+_0x524bda)['json'](_0x967432);}return null;};}function patchUpdates(_0x5e381c){return function(_0x383b08){try{jsonpatch[_0x57b3('0x22')](_0x383b08,_0x5e381c,!![]);}catch(_0x201ee7){return BPromise[_0x57b3('0x23')](_0x201ee7);}return _0x383b08[_0x57b3('0x24')]();};}function saveUpdates(_0xb4561c,_0xd8ab26){return function(_0x4482f6){if(_0x4482f6){return _0x4482f6[_0x57b3('0x25')](_0xb4561c)[_0x57b3('0x26')](function(_0x3f4745){return _0x3f4745;});}return null;};}function removeEntity(_0x2427fd,_0x26b8c0){return function(_0x15aa25){if(_0x15aa25){return _0x15aa25['destroy']()[_0x57b3('0x26')](function(){_0x2427fd['status'](0xcc)[_0x57b3('0x19')]();});}};}function handleEntityNotFound(_0x20d923,_0x2e7855){return function(_0x121a5e){if(!_0x121a5e){_0x20d923[_0x57b3('0x18')](0x194);}return _0x121a5e;};}function handleError(_0x21c3f3,_0x47dfe4){_0x47dfe4=_0x47dfe4||0x1f4;return function(_0x8b7394){logger[_0x57b3('0x27')](_0x8b7394[_0x57b3('0x28')]);if(_0x8b7394[_0x57b3('0x29')]){delete _0x8b7394[_0x57b3('0x29')];}_0x21c3f3[_0x57b3('0x1a')](_0x47dfe4)[_0x57b3('0x2a')](_0x8b7394);};}exports[_0x57b3('0x2b')]=function(_0x34d977,_0x520457){var _0x59da51={},_0x203160={},_0x248b57={'count':0x0,'rows':[]};var _0x14f763=_[_0x57b3('0x2c')](db[_0x57b3('0x2d')][_0x57b3('0x2e')],function(_0x2d0fbd){return{'name':_0x2d0fbd['fieldName'],'type':_0x2d0fbd[_0x57b3('0x2f')]['key']};});_0x203160[_0x57b3('0x30')]=_[_0x57b3('0x2c')](_0x14f763,_0x57b3('0x29'));_0x203160[_0x57b3('0x31')]=_[_0x57b3('0x32')](_0x34d977[_0x57b3('0x31')]);_0x203160[_0x57b3('0x33')]=_[_0x57b3('0x34')](_0x203160[_0x57b3('0x30')],_0x203160['query']);_0x59da51['attributes']=_[_0x57b3('0x34')](_0x203160[_0x57b3('0x30')],qs['fields'](_0x34d977[_0x57b3('0x31')][_0x57b3('0x35')]));_0x59da51['attributes']=_0x59da51['attributes'][_0x57b3('0x36')]?_0x59da51[_0x57b3('0x37')]:_0x203160[_0x57b3('0x30')];if(!_0x34d977[_0x57b3('0x31')][_0x57b3('0x38')](_0x57b3('0x39'))){_0x59da51[_0x57b3('0x1f')]=qs['limit'](_0x34d977[_0x57b3('0x31')][_0x57b3('0x1f')]);_0x59da51['offset']=qs['offset'](_0x34d977['query'][_0x57b3('0x1d')]);}_0x59da51['order']=qs[_0x57b3('0x3a')](_0x34d977[_0x57b3('0x31')][_0x57b3('0x3a')]);_0x59da51[_0x57b3('0x3b')]=qs['filters'](_[_0x57b3('0x3c')](_0x34d977['query'],_0x203160[_0x57b3('0x33')]),_0x14f763);if(_0x34d977[_0x57b3('0x31')][_0x57b3('0x3d')]){_0x59da51[_0x57b3('0x3b')]=_[_0x57b3('0x3e')](_0x59da51[_0x57b3('0x3b')],{'$or':_[_0x57b3('0x2c')](_0x14f763,function(_0x408110){if(_0x408110[_0x57b3('0x2f')]!==_0x57b3('0x3f')){var _0x509f50={};_0x509f50[_0x408110[_0x57b3('0x29')]]={'$like':'%'+_0x34d977[_0x57b3('0x31')][_0x57b3('0x3d')]+'%'};return _0x509f50;}})});}_0x59da51=_[_0x57b3('0x3e')]({},_0x59da51,_0x34d977[_0x57b3('0x40')]);var _0x4be235={'where':_0x59da51[_0x57b3('0x3b')]};return db[_0x57b3('0x2d')][_0x57b3('0x1e')](_0x4be235)['then'](function(_0x4054fc){_0x248b57['count']=_0x4054fc;if(_0x34d977[_0x57b3('0x31')][_0x57b3('0x41')]){_0x59da51[_0x57b3('0x42')]=[{'all':!![]}];}return db[_0x57b3('0x2d')][_0x57b3('0x43')](_0x59da51);})[_0x57b3('0x26')](function(_0x2873bd){_0x248b57['rows']=_0x2873bd;return _0x248b57;})[_0x57b3('0x26')](respondWithFilteredResult(_0x520457,_0x59da51))[_0x57b3('0x44')](handleError(_0x520457,null));};exports[_0x57b3('0x45')]=function(_0x4423a1,_0x4842c1){var _0x597f80={'raw':!![],'where':{'id':_0x4423a1[_0x57b3('0x46')]['id']}},_0x59a21f={};_0x59a21f[_0x57b3('0x30')]=_[_0x57b3('0x32')](db['MailServerOut'][_0x57b3('0x2e')]);_0x59a21f[_0x57b3('0x31')]=_['keys'](_0x4423a1[_0x57b3('0x31')]);_0x59a21f[_0x57b3('0x33')]=_[_0x57b3('0x34')](_0x59a21f[_0x57b3('0x30')],_0x59a21f[_0x57b3('0x31')]);_0x597f80['attributes']=_[_0x57b3('0x34')](_0x59a21f[_0x57b3('0x30')],qs[_0x57b3('0x35')](_0x4423a1[_0x57b3('0x31')]['fields']));_0x597f80[_0x57b3('0x37')]=_0x597f80['attributes'][_0x57b3('0x36')]?_0x597f80['attributes']:_0x59a21f[_0x57b3('0x30')];if(_0x4423a1[_0x57b3('0x31')]['includeAll']){_0x597f80[_0x57b3('0x42')]=[{'all':!![]}];}_0x597f80=_[_0x57b3('0x3e')]({},_0x597f80,_0x4423a1['options']);return db[_0x57b3('0x2d')][_0x57b3('0x47')](_0x597f80)[_0x57b3('0x26')](handleEntityNotFound(_0x4842c1,null))[_0x57b3('0x26')](respondWithResult(_0x4842c1,null))[_0x57b3('0x44')](handleError(_0x4842c1,null));};exports[_0x57b3('0x48')]=function(_0x2a37cf,_0x34f4c7){return db[_0x57b3('0x2d')]['create'](_0x2a37cf[_0x57b3('0x49')],{})['then'](respondWithResult(_0x34f4c7,0xc9))[_0x57b3('0x44')](handleError(_0x34f4c7,null));};exports[_0x57b3('0x25')]=function(_0x1bfaa5,_0x396d1f){if(_0x1bfaa5[_0x57b3('0x49')]['id']){delete _0x1bfaa5['body']['id'];}return db[_0x57b3('0x2d')]['find']({'where':{'id':_0x1bfaa5['params']['id']}})[_0x57b3('0x26')](handleEntityNotFound(_0x396d1f,null))[_0x57b3('0x26')](saveUpdates(_0x1bfaa5[_0x57b3('0x49')],null))[_0x57b3('0x26')](respondWithResult(_0x396d1f,null))['catch'](handleError(_0x396d1f,null));};exports[_0x57b3('0x4a')]=function(_0x1982bd,_0x5b9f0f){return db['MailServerOut'][_0x57b3('0x47')]({'where':{'id':_0x1982bd[_0x57b3('0x46')]['id']}})[_0x57b3('0x26')](handleEntityNotFound(_0x5b9f0f,null))[_0x57b3('0x26')](removeEntity(_0x5b9f0f,null))[_0x57b3('0x44')](handleError(_0x5b9f0f,null));}; \ No newline at end of file +var _0xb5a3=['sort','where','pick','filter','merge','MailServerOut','includeAll','include','rows','catch','show','params','options','find','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x509aed,_0x166ac5){var _0x333200=function(_0x403d43){while(--_0x403d43){_0x509aed['push'](_0x509aed['shift']());}};_0x333200(++_0x166ac5);}(_0xb5a3,0xa1));var _0x3b5a=function(_0x2652ef,_0x234230){_0x2652ef=_0x2652ef-0x0;var _0x2db578=_0xb5a3[_0x2652ef];return _0x2db578;};'use strict';var emlformat=require(_0x3b5a('0x0'));var rimraf=require(_0x3b5a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3b5a('0x2'));var moment=require(_0x3b5a('0x3'));var BPromise=require(_0x3b5a('0x4'));var Mustache=require(_0x3b5a('0x5'));var util=require(_0x3b5a('0x6'));var path=require('path');var sox=require(_0x3b5a('0x7'));var csv=require(_0x3b5a('0x8'));var ejs=require(_0x3b5a('0x9'));var fs=require('fs');var fs_extra=require(_0x3b5a('0xa'));var _=require(_0x3b5a('0xb'));var squel=require(_0x3b5a('0xc'));var crypto=require('crypto');var jsforce=require(_0x3b5a('0xd'));var deskjs=require(_0x3b5a('0xe'));var toCsv=require(_0x3b5a('0x8'));var querystring=require(_0x3b5a('0xf'));var Papa=require(_0x3b5a('0x10'));var Redis=require(_0x3b5a('0x11'));var authService=require(_0x3b5a('0x12'));var qs=require(_0x3b5a('0x13'));var as=require(_0x3b5a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3b5a('0x15'))(_0x3b5a('0x16'));var utils=require(_0x3b5a('0x17'));var config=require(_0x3b5a('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b4d04,_0x11c5d9){_0x11c5d9=_0x11c5d9||0xcc;return function(_0x12ad9a){if(_0x12ad9a){return _0x5b4d04['sendStatus'](_0x11c5d9);}return _0x5b4d04[_0x3b5a('0x19')](_0x11c5d9)[_0x3b5a('0x1a')]();};}function respondWithResult(_0x4595a6,_0x33c8a9){_0x33c8a9=_0x33c8a9||0xc8;return function(_0x367aaa){if(_0x367aaa){return _0x4595a6['status'](_0x33c8a9)[_0x3b5a('0x1b')](_0x367aaa);}};}function respondWithFilteredResult(_0x46364d,_0x3b25b9){return function(_0x3412f8){if(_0x3412f8){var _0x363286=typeof _0x3b25b9[_0x3b5a('0x1c')]===_0x3b5a('0x1d')&&typeof _0x3b25b9[_0x3b5a('0x1e')]==='undefined';var _0x2ef4ca=_0x3412f8[_0x3b5a('0x1f')];var _0x5eaa75=_0x363286?0x0:_0x3b25b9[_0x3b5a('0x1c')];var _0xb8257a=_0x363286?_0x3412f8[_0x3b5a('0x1f')]:_0x3b25b9['offset']+_0x3b25b9['limit'];var _0x4d1c48;if(_0xb8257a>=_0x2ef4ca){_0xb8257a=_0x2ef4ca;_0x4d1c48=0xc8;}else{_0x4d1c48=0xce;}_0x46364d[_0x3b5a('0x19')](_0x4d1c48);return _0x46364d[_0x3b5a('0x20')](_0x3b5a('0x21'),_0x5eaa75+'-'+_0xb8257a+'/'+_0x2ef4ca)[_0x3b5a('0x1b')](_0x3412f8);}return null;};}function patchUpdates(_0x10aafd){return function(_0x3237df){try{jsonpatch[_0x3b5a('0x22')](_0x3237df,_0x10aafd,!![]);}catch(_0x33b734){return BPromise[_0x3b5a('0x23')](_0x33b734);}return _0x3237df['save']();};}function saveUpdates(_0x43187d,_0x1c68e9){return function(_0x22d0e7){if(_0x22d0e7){return _0x22d0e7[_0x3b5a('0x24')](_0x43187d)[_0x3b5a('0x25')](function(_0x3b31c7){return _0x3b31c7;});}return null;};}function removeEntity(_0x12f252,_0x225cd9){return function(_0x35bd2d){if(_0x35bd2d){return _0x35bd2d[_0x3b5a('0x26')]()[_0x3b5a('0x25')](function(){_0x12f252[_0x3b5a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17bb19,_0x5e778d){return function(_0x500aa0){if(!_0x500aa0){_0x17bb19['sendStatus'](0x194);}return _0x500aa0;};}function handleError(_0x1e7771,_0x1d787f){_0x1d787f=_0x1d787f||0x1f4;return function(_0x587204){logger[_0x3b5a('0x27')](_0x587204[_0x3b5a('0x28')]);if(_0x587204[_0x3b5a('0x29')]){delete _0x587204[_0x3b5a('0x29')];}_0x1e7771[_0x3b5a('0x19')](_0x1d787f)[_0x3b5a('0x2a')](_0x587204);};}exports[_0x3b5a('0x2b')]=function(_0x2fb1d2,_0x29f7a2){var _0x4dddda={},_0x22482d={},_0x50fa9f={'count':0x0,'rows':[]};var _0x3e0ac0=_[_0x3b5a('0x2c')](db['MailServerOut'][_0x3b5a('0x2d')],function(_0x4452c7){return{'name':_0x4452c7[_0x3b5a('0x2e')],'type':_0x4452c7[_0x3b5a('0x2f')][_0x3b5a('0x30')]};});_0x22482d[_0x3b5a('0x31')]=_[_0x3b5a('0x2c')](_0x3e0ac0,'name');_0x22482d[_0x3b5a('0x32')]=_[_0x3b5a('0x33')](_0x2fb1d2[_0x3b5a('0x32')]);_0x22482d[_0x3b5a('0x34')]=_[_0x3b5a('0x35')](_0x22482d['model'],_0x22482d[_0x3b5a('0x32')]);_0x4dddda[_0x3b5a('0x36')]=_[_0x3b5a('0x35')](_0x22482d[_0x3b5a('0x31')],qs['fields'](_0x2fb1d2[_0x3b5a('0x32')][_0x3b5a('0x37')]));_0x4dddda['attributes']=_0x4dddda[_0x3b5a('0x36')][_0x3b5a('0x38')]?_0x4dddda['attributes']:_0x22482d[_0x3b5a('0x31')];if(!_0x2fb1d2[_0x3b5a('0x32')]['hasOwnProperty'](_0x3b5a('0x39'))){_0x4dddda['limit']=qs[_0x3b5a('0x1e')](_0x2fb1d2[_0x3b5a('0x32')][_0x3b5a('0x1e')]);_0x4dddda[_0x3b5a('0x1c')]=qs['offset'](_0x2fb1d2[_0x3b5a('0x32')][_0x3b5a('0x1c')]);}_0x4dddda['order']=qs[_0x3b5a('0x3a')](_0x2fb1d2[_0x3b5a('0x32')][_0x3b5a('0x3a')]);_0x4dddda[_0x3b5a('0x3b')]=qs[_0x3b5a('0x34')](_[_0x3b5a('0x3c')](_0x2fb1d2['query'],_0x22482d[_0x3b5a('0x34')]),_0x3e0ac0);if(_0x2fb1d2[_0x3b5a('0x32')][_0x3b5a('0x3d')]){_0x4dddda['where']=_[_0x3b5a('0x3e')](_0x4dddda[_0x3b5a('0x3b')],{'$or':_[_0x3b5a('0x2c')](_0x3e0ac0,function(_0x151229){if(_0x151229[_0x3b5a('0x2f')]!=='VIRTUAL'){var _0x8700c7={};_0x8700c7[_0x151229[_0x3b5a('0x29')]]={'$like':'%'+_0x2fb1d2[_0x3b5a('0x32')][_0x3b5a('0x3d')]+'%'};return _0x8700c7;}})});}_0x4dddda=_['merge']({},_0x4dddda,_0x2fb1d2['options']);var _0x3347ce={'where':_0x4dddda[_0x3b5a('0x3b')]};return db[_0x3b5a('0x3f')]['count'](_0x3347ce)[_0x3b5a('0x25')](function(_0xccfd09){_0x50fa9f['count']=_0xccfd09;if(_0x2fb1d2[_0x3b5a('0x32')][_0x3b5a('0x40')]){_0x4dddda[_0x3b5a('0x41')]=[{'all':!![]}];}return db[_0x3b5a('0x3f')]['findAll'](_0x4dddda);})[_0x3b5a('0x25')](function(_0x9a4884){_0x50fa9f[_0x3b5a('0x42')]=_0x9a4884;return _0x50fa9f;})['then'](respondWithFilteredResult(_0x29f7a2,_0x4dddda))[_0x3b5a('0x43')](handleError(_0x29f7a2,null));};exports[_0x3b5a('0x44')]=function(_0x35fd66,_0x3ce9a9){var _0x57c49b={'raw':!![],'where':{'id':_0x35fd66[_0x3b5a('0x45')]['id']}},_0x2af6d7={};_0x2af6d7['model']=_[_0x3b5a('0x33')](db[_0x3b5a('0x3f')][_0x3b5a('0x2d')]);_0x2af6d7[_0x3b5a('0x32')]=_[_0x3b5a('0x33')](_0x35fd66[_0x3b5a('0x32')]);_0x2af6d7[_0x3b5a('0x34')]=_[_0x3b5a('0x35')](_0x2af6d7['model'],_0x2af6d7[_0x3b5a('0x32')]);_0x57c49b['attributes']=_[_0x3b5a('0x35')](_0x2af6d7[_0x3b5a('0x31')],qs['fields'](_0x35fd66[_0x3b5a('0x32')]['fields']));_0x57c49b[_0x3b5a('0x36')]=_0x57c49b[_0x3b5a('0x36')][_0x3b5a('0x38')]?_0x57c49b[_0x3b5a('0x36')]:_0x2af6d7['model'];if(_0x35fd66[_0x3b5a('0x32')]['includeAll']){_0x57c49b['include']=[{'all':!![]}];}_0x57c49b=_['merge']({},_0x57c49b,_0x35fd66[_0x3b5a('0x46')]);return db[_0x3b5a('0x3f')][_0x3b5a('0x47')](_0x57c49b)[_0x3b5a('0x25')](handleEntityNotFound(_0x3ce9a9,null))[_0x3b5a('0x25')](respondWithResult(_0x3ce9a9,null))[_0x3b5a('0x43')](handleError(_0x3ce9a9,null));};exports['create']=function(_0x3a622a,_0x4505fe){return db[_0x3b5a('0x3f')]['create'](_0x3a622a['body'],{})[_0x3b5a('0x25')](respondWithResult(_0x4505fe,0xc9))[_0x3b5a('0x43')](handleError(_0x4505fe,null));};exports['update']=function(_0x10ffca,_0x5b65e8){if(_0x10ffca[_0x3b5a('0x48')]['id']){delete _0x10ffca[_0x3b5a('0x48')]['id'];}return db[_0x3b5a('0x3f')][_0x3b5a('0x47')]({'where':{'id':_0x10ffca['params']['id']}})[_0x3b5a('0x25')](handleEntityNotFound(_0x5b65e8,null))[_0x3b5a('0x25')](saveUpdates(_0x10ffca[_0x3b5a('0x48')],null))[_0x3b5a('0x25')](respondWithResult(_0x5b65e8,null))[_0x3b5a('0x43')](handleError(_0x5b65e8,null));};exports['destroy']=function(_0x4181fd,_0x5bf117){return db['MailServerOut']['find']({'where':{'id':_0x4181fd['params']['id']}})[_0x3b5a('0x25')](handleEntityNotFound(_0x5bf117,null))[_0x3b5a('0x25')](removeEntity(_0x5bf117,null))['catch'](handleError(_0x5bf117,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 3b193c2..2268872 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 _0x9c96=['exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./mailServerOut.attributes'];(function(_0x3b2f56,_0xe12feb){var _0x5024c6=function(_0x3b50ba){while(--_0x3b50ba){_0x3b2f56['push'](_0x3b2f56['shift']());}};_0x5024c6(++_0xe12feb);}(_0x9c96,0x148));var _0x69c9=function(_0x1bac76,_0xd24a08){_0x1bac76=_0x1bac76-0x0;var _0x4aaf4d=_0x9c96[_0x1bac76];return _0x4aaf4d;};'use strict';var _=require(_0x69c9('0x0'));var util=require(_0x69c9('0x1'));var logger=require(_0x69c9('0x2'))(_0x69c9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x69c9('0x4'));var fs=require('fs');var path=require(_0x69c9('0x5'));var rimraf=require('rimraf');var config=require(_0x69c9('0x6'));var attributes=require(_0x69c9('0x7'));module[_0x69c9('0x8')]=function(_0x25bedb,_0x22fb6c){return _0x25bedb[_0x69c9('0x9')](_0x69c9('0xa'),attributes,{'tableName':_0x69c9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf382=['../../config/environment','./mailServerOut.attributes','MailServerOut','mail_servers_out','lodash','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x517738,_0x542477){var _0x2f40e0=function(_0x9511e){while(--_0x9511e){_0x517738['push'](_0x517738['shift']());}};_0x2f40e0(++_0x542477);}(_0xf382,0x90));var _0x2f38=function(_0x273f92,_0x5e6ea2){_0x273f92=_0x273f92-0x0;var _0x38b53c=_0xf382[_0x273f92];return _0x38b53c;};'use strict';var _=require(_0x2f38('0x0'));var util=require('util');var logger=require(_0x2f38('0x1'))('api');var moment=require(_0x2f38('0x2'));var BPromise=require(_0x2f38('0x3'));var rp=require(_0x2f38('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2f38('0x5'));var config=require(_0x2f38('0x6'));var attributes=require(_0x2f38('0x7'));module['exports']=function(_0x43f226,_0x5c4d9f){return _0x43f226['define'](_0x2f38('0x8'),attributes,{'tableName':_0x2f38('0x9'),'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 eabae25..f25c257 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x45d5ef,_0x10c29b){var _0x474d19=function(_0xc182bf){while(--_0xc182bf){_0x45d5ef['push'](_0x45d5ef['shift']());}};_0x474d19(++_0x10c29b);}(_0x2ef3,0xba));var _0x32ef=function(_0x49fb08,_0x22fa64){_0x49fb08=_0x49fb08-0x0;var _0x202055=_0x2ef3[_0x49fb08];return _0x202055;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x554f23,_0x3a8149){_0x554f23=_0x554f23-0x0;var _0x18c506=_0x7a54[_0x554f23];return _0x18c506;};'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 62d6f24..bac9721 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 _0xb413=['isAuthenticated','index','/describe','describe','get','/:id','show','post','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./mailSubstatus.controller'];(function(_0x4b76c2,_0x200f46){var _0x361dbb=function(_0x3b99c7){while(--_0x3b99c7){_0x4b76c2['push'](_0x4b76c2['shift']());}};_0x361dbb(++_0x200f46);}(_0xb413,0x75));var _0x3b41=function(_0x31ad53,_0x105567){_0x31ad53=_0x31ad53-0x0;var _0x41c1f0=_0xb413[_0x31ad53];return _0x41c1f0;};'use strict';var multer=require(_0x3b41('0x0'));var util=require(_0x3b41('0x1'));var path=require(_0x3b41('0x2'));var timeout=require(_0x3b41('0x3'));var express=require(_0x3b41('0x4'));var router=express[_0x3b41('0x5')]();var fs_extra=require(_0x3b41('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3b41('0x7'));var controller=require(_0x3b41('0x8'));router['get']('/',auth[_0x3b41('0x9')](),controller[_0x3b41('0xa')]);router['get'](_0x3b41('0xb'),auth['isAuthenticated'](),controller[_0x3b41('0xc')]);router[_0x3b41('0xd')](_0x3b41('0xe'),auth[_0x3b41('0x9')](),controller[_0x3b41('0xf')]);router[_0x3b41('0x10')]('/',auth[_0x3b41('0x9')](),controller['create']);router['put'](_0x3b41('0xe'),auth[_0x3b41('0x9')](),controller['update']);router['delete']('/:id',auth[_0x3b41('0x9')](),controller[_0x3b41('0x11')]);module['exports']=router; \ No newline at end of file +var _0x275c=['../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3514da,_0x565b4e){var _0x4cb423=function(_0x4f9049){while(--_0x4f9049){_0x3514da['push'](_0x3514da['shift']());}};_0x4cb423(++_0x565b4e);}(_0x275c,0x78));var _0xc275=function(_0x4239ac,_0x502c85){_0x4239ac=_0x4239ac-0x0;var _0x20dcb9=_0x275c[_0x4239ac];return _0x20dcb9;};'use strict';var multer=require('multer');var util=require(_0xc275('0x0'));var path=require(_0xc275('0x1'));var timeout=require(_0xc275('0x2'));var express=require(_0xc275('0x3'));var router=express['Router']();var fs_extra=require(_0xc275('0x4'));var auth=require(_0xc275('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc275('0x6'));var controller=require(_0xc275('0x7'));router[_0xc275('0x8')]('/',auth[_0xc275('0x9')](),controller[_0xc275('0xa')]);router[_0xc275('0x8')](_0xc275('0xb'),auth['isAuthenticated'](),controller[_0xc275('0xc')]);router[_0xc275('0x8')](_0xc275('0xd'),auth[_0xc275('0x9')](),controller[_0xc275('0xe')]);router[_0xc275('0xf')]('/',auth[_0xc275('0x9')](),controller[_0xc275('0x10')]);router['put']('/:id',auth[_0xc275('0x9')](),controller[_0xc275('0x11')]);router['delete'](_0xc275('0xd'),auth[_0xc275('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index fbaaf7c..64cedd9 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 _0xc1c6=['STRING','sequelize','exports'];(function(_0x2552e2,_0x4fb60a){var _0x27922b=function(_0x3ff1cb){while(--_0x3ff1cb){_0x2552e2['push'](_0x2552e2['shift']());}};_0x27922b(++_0x4fb60a);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x5656b2,_0x4a8824){_0x5656b2=_0x5656b2-0x0;var _0x3c9b22=_0xc1c6[_0x5656b2];return _0x3c9b22;};'use strict';var Sequelize=require(_0x6c1c('0x0'));module[_0x6c1c('0x1')]={'name':{'type':Sequelize[_0x6c1c('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6c1c('0x2')]}}; \ No newline at end of file +var _0xc4aa=['exports','STRING','name','sequelize'];(function(_0x5a04dd,_0x8e379c){var _0x4a2af9=function(_0x38884d){while(--_0x38884d){_0x5a04dd['push'](_0x5a04dd['shift']());}};_0x4a2af9(++_0x8e379c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xc4aa[_0x2064e5];return _0x21a233;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'name':{'type':Sequelize[_0xac4a('0x2')],'unique':_0xac4a('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xac4a('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 0c89a06..9e235b9 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 _0x77d4=['../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','end','sendStatus','error','stack','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x30715a,_0x3ce2ba){var _0x1b6b7f=function(_0x38c1c3){while(--_0x38c1c3){_0x30715a['push'](_0x30715a['shift']());}};_0x1b6b7f(++_0x3ce2ba);}(_0x77d4,0x1b1));var _0x477d=function(_0x2f25c9,_0xabd53a){_0x2f25c9=_0x2f25c9-0x0;var _0x58c8f8=_0x77d4[_0x2f25c9];return _0x58c8f8;};'use strict';var emlformat=require(_0x477d('0x0'));var rimraf=require(_0x477d('0x1'));var zipdir=require(_0x477d('0x2'));var jsonpatch=require(_0x477d('0x3'));var rp=require('request-promise');var moment=require(_0x477d('0x4'));var BPromise=require(_0x477d('0x5'));var Mustache=require('mustache');var util=require(_0x477d('0x6'));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(_0x477d('0x7'));var _=require(_0x477d('0x8'));var squel=require(_0x477d('0x9'));var crypto=require(_0x477d('0xa'));var jsforce=require(_0x477d('0xb'));var deskjs=require(_0x477d('0xc'));var toCsv=require(_0x477d('0xd'));var querystring=require(_0x477d('0xe'));var Papa=require('papaparse');var Redis=require(_0x477d('0xf'));var authService=require(_0x477d('0x10'));var qs=require(_0x477d('0x11'));var as=require(_0x477d('0x12'));var hardwareService=require(_0x477d('0x13'));var logger=require(_0x477d('0x14'))(_0x477d('0x15'));var utils=require(_0x477d('0x16'));var config=require(_0x477d('0x17'));var licenseUtil=require(_0x477d('0x18'));var db=require(_0x477d('0x19'))['db'];function respondWithStatusCode(_0x3da388,_0x43faf2){_0x43faf2=_0x43faf2||0xcc;return function(_0x5b41ee){if(_0x5b41ee){return _0x3da388['sendStatus'](_0x43faf2);}return _0x3da388[_0x477d('0x1a')](_0x43faf2)['end']();};}function respondWithResult(_0x1dbeb1,_0x3a1a79){_0x3a1a79=_0x3a1a79||0xc8;return function(_0x3431d2){if(_0x3431d2){return _0x1dbeb1[_0x477d('0x1a')](_0x3a1a79)[_0x477d('0x1b')](_0x3431d2);}};}function respondWithFilteredResult(_0xc5dacf,_0x3f0d88){return function(_0x3cc8ea){if(_0x3cc8ea){var _0x4fc3c1=typeof _0x3f0d88[_0x477d('0x1c')]===_0x477d('0x1d')&&typeof _0x3f0d88[_0x477d('0x1e')]==='undefined';var _0x4f30ba=_0x3cc8ea[_0x477d('0x1f')];var _0x4f52d0=_0x4fc3c1?0x0:_0x3f0d88['offset'];var _0x37837a=_0x4fc3c1?_0x3cc8ea['count']:_0x3f0d88['offset']+_0x3f0d88[_0x477d('0x1e')];var _0x41ddc5;if(_0x37837a>=_0x4f30ba){_0x37837a=_0x4f30ba;_0x41ddc5=0xc8;}else{_0x41ddc5=0xce;}_0xc5dacf[_0x477d('0x1a')](_0x41ddc5);return _0xc5dacf[_0x477d('0x20')](_0x477d('0x21'),_0x4f52d0+'-'+_0x37837a+'/'+_0x4f30ba)[_0x477d('0x1b')](_0x3cc8ea);}return null;};}function patchUpdates(_0x555c75){return function(_0x4b11d4){try{jsonpatch['apply'](_0x4b11d4,_0x555c75,!![]);}catch(_0x5ebce3){return BPromise['reject'](_0x5ebce3);}return _0x4b11d4[_0x477d('0x22')]();};}function saveUpdates(_0x433b4b,_0x3b0ed4){return function(_0x41b7e8){if(_0x41b7e8){return _0x41b7e8[_0x477d('0x23')](_0x433b4b)[_0x477d('0x24')](function(_0x233ff2){return _0x233ff2;});}return null;};}function removeEntity(_0xaa81a5,_0x427711){return function(_0x362f7f){if(_0x362f7f){return _0x362f7f['destroy']()[_0x477d('0x24')](function(){_0xaa81a5[_0x477d('0x1a')](0xcc)[_0x477d('0x25')]();});}};}function handleEntityNotFound(_0x15ded6,_0xbdd93f){return function(_0x413ee4){if(!_0x413ee4){_0x15ded6[_0x477d('0x26')](0x194);}return _0x413ee4;};}function handleError(_0x8f11bb,_0x3af65a){_0x3af65a=_0x3af65a||0x1f4;return function(_0xe5b8){logger[_0x477d('0x27')](_0xe5b8[_0x477d('0x28')]);if(_0xe5b8['name']){delete _0xe5b8['name'];}_0x8f11bb['status'](_0x3af65a)[_0x477d('0x29')](_0xe5b8);};}exports[_0x477d('0x2a')]=function(_0x5ed8c1,_0x27eb11){var _0x30c88b={},_0x41c4ac={},_0xe40003={'count':0x0,'rows':[]};var _0x35bb15=_[_0x477d('0x2b')](db[_0x477d('0x2c')][_0x477d('0x2d')],function(_0x24dbb6){return{'name':_0x24dbb6[_0x477d('0x2e')],'type':_0x24dbb6[_0x477d('0x2f')][_0x477d('0x30')]};});_0x41c4ac[_0x477d('0x31')]=_[_0x477d('0x2b')](_0x35bb15,'name');_0x41c4ac[_0x477d('0x32')]=_[_0x477d('0x33')](_0x5ed8c1[_0x477d('0x32')]);_0x41c4ac[_0x477d('0x34')]=_[_0x477d('0x35')](_0x41c4ac[_0x477d('0x31')],_0x41c4ac[_0x477d('0x32')]);_0x30c88b[_0x477d('0x36')]=_[_0x477d('0x35')](_0x41c4ac['model'],qs['fields'](_0x5ed8c1[_0x477d('0x32')][_0x477d('0x37')]));_0x30c88b[_0x477d('0x36')]=_0x30c88b[_0x477d('0x36')][_0x477d('0x38')]?_0x30c88b[_0x477d('0x36')]:_0x41c4ac[_0x477d('0x31')];if(!_0x5ed8c1[_0x477d('0x32')][_0x477d('0x39')](_0x477d('0x3a'))){_0x30c88b['limit']=qs['limit'](_0x5ed8c1[_0x477d('0x32')][_0x477d('0x1e')]);_0x30c88b['offset']=qs[_0x477d('0x1c')](_0x5ed8c1['query'][_0x477d('0x1c')]);}_0x30c88b[_0x477d('0x3b')]=qs[_0x477d('0x3c')](_0x5ed8c1['query']['sort']);_0x30c88b[_0x477d('0x3d')]=qs['filters'](_[_0x477d('0x3e')](_0x5ed8c1[_0x477d('0x32')],_0x41c4ac['filters']),_0x35bb15);if(_0x5ed8c1[_0x477d('0x32')]['filter']){_0x30c88b[_0x477d('0x3d')]=_[_0x477d('0x3f')](_0x30c88b['where'],{'$or':_['map'](_0x35bb15,function(_0x1771cb){if(_0x1771cb[_0x477d('0x2f')]!==_0x477d('0x40')){var _0x45797c={};_0x45797c[_0x1771cb['name']]={'$like':'%'+_0x5ed8c1['query'][_0x477d('0x41')]+'%'};return _0x45797c;}})});}_0x30c88b=_[_0x477d('0x3f')]({},_0x30c88b,_0x5ed8c1[_0x477d('0x42')]);var _0x3d1a8a={'where':_0x30c88b[_0x477d('0x3d')]};return db[_0x477d('0x2c')][_0x477d('0x1f')](_0x3d1a8a)['then'](function(_0x545708){_0xe40003[_0x477d('0x1f')]=_0x545708;if(_0x5ed8c1[_0x477d('0x32')][_0x477d('0x43')]){_0x30c88b[_0x477d('0x44')]=[{'all':!![]}];}return db[_0x477d('0x2c')]['findAll'](_0x30c88b);})[_0x477d('0x24')](function(_0x1c5e43){_0xe40003[_0x477d('0x45')]=_0x1c5e43;return _0xe40003;})[_0x477d('0x24')](respondWithFilteredResult(_0x27eb11,_0x30c88b))[_0x477d('0x46')](handleError(_0x27eb11,null));};exports['show']=function(_0x423f4a,_0x1990a7){var _0x25675f={'raw':!![],'where':{'id':_0x423f4a[_0x477d('0x47')]['id']}},_0x42171e={};_0x42171e[_0x477d('0x31')]=_[_0x477d('0x33')](db[_0x477d('0x2c')]['rawAttributes']);_0x42171e['query']=_[_0x477d('0x33')](_0x423f4a['query']);_0x42171e[_0x477d('0x34')]=_[_0x477d('0x35')](_0x42171e[_0x477d('0x31')],_0x42171e[_0x477d('0x32')]);_0x25675f[_0x477d('0x36')]=_[_0x477d('0x35')](_0x42171e['model'],qs[_0x477d('0x37')](_0x423f4a[_0x477d('0x32')][_0x477d('0x37')]));_0x25675f[_0x477d('0x36')]=_0x25675f['attributes'][_0x477d('0x38')]?_0x25675f[_0x477d('0x36')]:_0x42171e['model'];if(_0x423f4a['query'][_0x477d('0x43')]){_0x25675f[_0x477d('0x44')]=[{'all':!![]}];}_0x25675f=_[_0x477d('0x3f')]({},_0x25675f,_0x423f4a[_0x477d('0x42')]);return db['MailSubstatus'][_0x477d('0x48')](_0x25675f)[_0x477d('0x24')](handleEntityNotFound(_0x1990a7,null))[_0x477d('0x24')](respondWithResult(_0x1990a7,null))['catch'](handleError(_0x1990a7,null));};exports[_0x477d('0x49')]=function(_0xca0768,_0x346a94){return db[_0x477d('0x2c')][_0x477d('0x49')](_0xca0768[_0x477d('0x4a')],{})[_0x477d('0x24')](respondWithResult(_0x346a94,0xc9))[_0x477d('0x46')](handleError(_0x346a94,null));};exports[_0x477d('0x23')]=function(_0xcd2a5d,_0x325830){if(_0xcd2a5d[_0x477d('0x4a')]['id']){delete _0xcd2a5d['body']['id'];}return db[_0x477d('0x2c')][_0x477d('0x48')]({'where':{'id':_0xcd2a5d[_0x477d('0x47')]['id']}})[_0x477d('0x24')](handleEntityNotFound(_0x325830,null))[_0x477d('0x24')](saveUpdates(_0xcd2a5d[_0x477d('0x4a')],null))[_0x477d('0x24')](respondWithResult(_0x325830,null))[_0x477d('0x46')](handleError(_0x325830,null));};exports['destroy']=function(_0x34c21a,_0x18bcf8){return db[_0x477d('0x2c')]['find']({'where':{'id':_0x34c21a[_0x477d('0x47')]['id']}})['then'](handleEntityNotFound(_0x18bcf8,null))[_0x477d('0x24')](removeEntity(_0x18bcf8,null))[_0x477d('0x46')](handleError(_0x18bcf8,null));};exports[_0x477d('0x4b')]=function(_0x3034bd,_0x349dee){return db[_0x477d('0x2c')][_0x477d('0x4b')]()[_0x477d('0x24')](respondWithResult(_0x349dee,null))[_0x477d('0x46')](handleError(_0x349dee,null));}; \ No newline at end of file +var _0x2428=['undefined','count','limit','status','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','map','MailSubstatus','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset'];(function(_0x3a8d4b,_0x5a32ee){var _0x462ec0=function(_0x32bfde){while(--_0x32bfde){_0x3a8d4b['push'](_0x3a8d4b['shift']());}};_0x462ec0(++_0x5a32ee);}(_0x2428,0x7d));var _0x8242=function(_0x2f96de,_0x17d207){_0x2f96de=_0x2f96de-0x0;var _0x7fb131=_0x2428[_0x2f96de];return _0x7fb131;};'use strict';var emlformat=require(_0x8242('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8242('0x1'));var jsonpatch=require(_0x8242('0x2'));var rp=require(_0x8242('0x3'));var moment=require('moment');var BPromise=require(_0x8242('0x4'));var Mustache=require(_0x8242('0x5'));var util=require('util');var path=require('path');var sox=require(_0x8242('0x6'));var csv=require(_0x8242('0x7'));var ejs=require(_0x8242('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8242('0x9'));var squel=require(_0x8242('0xa'));var crypto=require(_0x8242('0xb'));var jsforce=require(_0x8242('0xc'));var deskjs=require(_0x8242('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8242('0xe'));var Papa=require('papaparse');var Redis=require(_0x8242('0xf'));var authService=require(_0x8242('0x10'));var qs=require(_0x8242('0x11'));var as=require(_0x8242('0x12'));var hardwareService=require(_0x8242('0x13'));var logger=require('../../config/logger')(_0x8242('0x14'));var utils=require('../../config/utils');var config=require(_0x8242('0x15'));var licenseUtil=require(_0x8242('0x16'));var db=require(_0x8242('0x17'))['db'];function respondWithStatusCode(_0x10b0ac,_0x13817b){_0x13817b=_0x13817b||0xcc;return function(_0x54a17b){if(_0x54a17b){return _0x10b0ac[_0x8242('0x18')](_0x13817b);}return _0x10b0ac['status'](_0x13817b)['end']();};}function respondWithResult(_0x437d2e,_0x18bcac){_0x18bcac=_0x18bcac||0xc8;return function(_0x2d3cb0){if(_0x2d3cb0){return _0x437d2e['status'](_0x18bcac)[_0x8242('0x19')](_0x2d3cb0);}};}function respondWithFilteredResult(_0x25189b,_0xc2989a){return function(_0x3b416f){if(_0x3b416f){var _0xa45d35=typeof _0xc2989a[_0x8242('0x1a')]===_0x8242('0x1b')&&typeof _0xc2989a['limit']===_0x8242('0x1b');var _0x50893e=_0x3b416f[_0x8242('0x1c')];var _0x2b4fc2=_0xa45d35?0x0:_0xc2989a['offset'];var _0x7e535d=_0xa45d35?_0x3b416f[_0x8242('0x1c')]:_0xc2989a[_0x8242('0x1a')]+_0xc2989a[_0x8242('0x1d')];var _0x44db69;if(_0x7e535d>=_0x50893e){_0x7e535d=_0x50893e;_0x44db69=0xc8;}else{_0x44db69=0xce;}_0x25189b[_0x8242('0x1e')](_0x44db69);return _0x25189b[_0x8242('0x1f')](_0x8242('0x20'),_0x2b4fc2+'-'+_0x7e535d+'/'+_0x50893e)['json'](_0x3b416f);}return null;};}function patchUpdates(_0x1cc2f2){return function(_0x376446){try{jsonpatch[_0x8242('0x21')](_0x376446,_0x1cc2f2,!![]);}catch(_0x4be05d){return BPromise[_0x8242('0x22')](_0x4be05d);}return _0x376446['save']();};}function saveUpdates(_0x2da50f,_0x1b1ab9){return function(_0x827d45){if(_0x827d45){return _0x827d45[_0x8242('0x23')](_0x2da50f)[_0x8242('0x24')](function(_0x50dd7d){return _0x50dd7d;});}return null;};}function removeEntity(_0x33d218,_0x33362e){return function(_0x3d8cf6){if(_0x3d8cf6){return _0x3d8cf6[_0x8242('0x25')]()[_0x8242('0x24')](function(){_0x33d218[_0x8242('0x1e')](0xcc)[_0x8242('0x26')]();});}};}function handleEntityNotFound(_0x514a1a,_0x446334){return function(_0x1dab39){if(!_0x1dab39){_0x514a1a['sendStatus'](0x194);}return _0x1dab39;};}function handleError(_0x21ba8a,_0x1ea88c){_0x1ea88c=_0x1ea88c||0x1f4;return function(_0x19f916){logger[_0x8242('0x27')](_0x19f916[_0x8242('0x28')]);if(_0x19f916[_0x8242('0x29')]){delete _0x19f916[_0x8242('0x29')];}_0x21ba8a['status'](_0x1ea88c)['send'](_0x19f916);};}exports[_0x8242('0x2a')]=function(_0x1e2dbe,_0x4efa3f){var _0x538e82={},_0x4c40ed={},_0x3b654c={'count':0x0,'rows':[]};var _0x11d5ec=_[_0x8242('0x2b')](db[_0x8242('0x2c')]['rawAttributes'],function(_0x16406e){return{'name':_0x16406e[_0x8242('0x2d')],'type':_0x16406e[_0x8242('0x2e')][_0x8242('0x2f')]};});_0x4c40ed[_0x8242('0x30')]=_[_0x8242('0x2b')](_0x11d5ec,_0x8242('0x29'));_0x4c40ed[_0x8242('0x31')]=_[_0x8242('0x32')](_0x1e2dbe[_0x8242('0x31')]);_0x4c40ed[_0x8242('0x33')]=_[_0x8242('0x34')](_0x4c40ed[_0x8242('0x30')],_0x4c40ed[_0x8242('0x31')]);_0x538e82[_0x8242('0x35')]=_[_0x8242('0x34')](_0x4c40ed[_0x8242('0x30')],qs[_0x8242('0x36')](_0x1e2dbe[_0x8242('0x31')][_0x8242('0x36')]));_0x538e82[_0x8242('0x35')]=_0x538e82[_0x8242('0x35')][_0x8242('0x37')]?_0x538e82['attributes']:_0x4c40ed['model'];if(!_0x1e2dbe[_0x8242('0x31')][_0x8242('0x38')]('nolimit')){_0x538e82[_0x8242('0x1d')]=qs[_0x8242('0x1d')](_0x1e2dbe['query'][_0x8242('0x1d')]);_0x538e82[_0x8242('0x1a')]=qs[_0x8242('0x1a')](_0x1e2dbe[_0x8242('0x31')][_0x8242('0x1a')]);}_0x538e82[_0x8242('0x39')]=qs['sort'](_0x1e2dbe[_0x8242('0x31')]['sort']);_0x538e82[_0x8242('0x3a')]=qs[_0x8242('0x33')](_[_0x8242('0x3b')](_0x1e2dbe[_0x8242('0x31')],_0x4c40ed[_0x8242('0x33')]),_0x11d5ec);if(_0x1e2dbe[_0x8242('0x31')][_0x8242('0x3c')]){_0x538e82['where']=_[_0x8242('0x3d')](_0x538e82[_0x8242('0x3a')],{'$or':_[_0x8242('0x2b')](_0x11d5ec,function(_0x541a3f){if(_0x541a3f[_0x8242('0x2e')]!==_0x8242('0x3e')){var _0x5c3d62={};_0x5c3d62[_0x541a3f[_0x8242('0x29')]]={'$like':'%'+_0x1e2dbe[_0x8242('0x31')][_0x8242('0x3c')]+'%'};return _0x5c3d62;}})});}_0x538e82=_[_0x8242('0x3d')]({},_0x538e82,_0x1e2dbe[_0x8242('0x3f')]);var _0xb61b6f={'where':_0x538e82[_0x8242('0x3a')]};return db[_0x8242('0x2c')][_0x8242('0x1c')](_0xb61b6f)[_0x8242('0x24')](function(_0x1e18e0){_0x3b654c[_0x8242('0x1c')]=_0x1e18e0;if(_0x1e2dbe['query'][_0x8242('0x40')]){_0x538e82['include']=[{'all':!![]}];}return db[_0x8242('0x2c')][_0x8242('0x41')](_0x538e82);})[_0x8242('0x24')](function(_0xe09b9d){_0x3b654c[_0x8242('0x42')]=_0xe09b9d;return _0x3b654c;})[_0x8242('0x24')](respondWithFilteredResult(_0x4efa3f,_0x538e82))[_0x8242('0x43')](handleError(_0x4efa3f,null));};exports[_0x8242('0x44')]=function(_0x5d5f30,_0x330057){var _0x2215a7={'raw':!![],'where':{'id':_0x5d5f30[_0x8242('0x45')]['id']}},_0x238d69={};_0x238d69['model']=_[_0x8242('0x32')](db[_0x8242('0x2c')][_0x8242('0x46')]);_0x238d69[_0x8242('0x31')]=_[_0x8242('0x32')](_0x5d5f30['query']);_0x238d69[_0x8242('0x33')]=_[_0x8242('0x34')](_0x238d69[_0x8242('0x30')],_0x238d69[_0x8242('0x31')]);_0x2215a7[_0x8242('0x35')]=_[_0x8242('0x34')](_0x238d69[_0x8242('0x30')],qs[_0x8242('0x36')](_0x5d5f30[_0x8242('0x31')][_0x8242('0x36')]));_0x2215a7[_0x8242('0x35')]=_0x2215a7[_0x8242('0x35')]['length']?_0x2215a7[_0x8242('0x35')]:_0x238d69[_0x8242('0x30')];if(_0x5d5f30[_0x8242('0x31')][_0x8242('0x40')]){_0x2215a7[_0x8242('0x47')]=[{'all':!![]}];}_0x2215a7=_[_0x8242('0x3d')]({},_0x2215a7,_0x5d5f30[_0x8242('0x3f')]);return db[_0x8242('0x2c')][_0x8242('0x48')](_0x2215a7)[_0x8242('0x24')](handleEntityNotFound(_0x330057,null))['then'](respondWithResult(_0x330057,null))[_0x8242('0x43')](handleError(_0x330057,null));};exports[_0x8242('0x49')]=function(_0x1a0504,_0xd2c545){return db['MailSubstatus']['create'](_0x1a0504[_0x8242('0x4a')],{})[_0x8242('0x24')](respondWithResult(_0xd2c545,0xc9))[_0x8242('0x43')](handleError(_0xd2c545,null));};exports[_0x8242('0x23')]=function(_0x33df00,_0x269ed9){if(_0x33df00[_0x8242('0x4a')]['id']){delete _0x33df00[_0x8242('0x4a')]['id'];}return db[_0x8242('0x2c')][_0x8242('0x48')]({'where':{'id':_0x33df00['params']['id']}})[_0x8242('0x24')](handleEntityNotFound(_0x269ed9,null))[_0x8242('0x24')](saveUpdates(_0x33df00[_0x8242('0x4a')],null))[_0x8242('0x24')](respondWithResult(_0x269ed9,null))[_0x8242('0x43')](handleError(_0x269ed9,null));};exports['destroy']=function(_0x26ad15,_0xcdc23f){return db[_0x8242('0x2c')][_0x8242('0x48')]({'where':{'id':_0x26ad15[_0x8242('0x45')]['id']}})[_0x8242('0x24')](handleEntityNotFound(_0xcdc23f,null))[_0x8242('0x24')](removeEntity(_0xcdc23f,null))['catch'](handleError(_0xcdc23f,null));};exports[_0x8242('0x4b')]=function(_0x65a82c,_0x4ddd64){return db[_0x8242('0x2c')][_0x8242('0x4b')]()[_0x8242('0x24')](respondWithResult(_0x4ddd64,null))[_0x8242('0x43')](handleError(_0x4ddd64,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 1df4143..a2e25cb 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 _0x2dd1=['hook','exports','MailSubstatus','setMaxListeners','update','hasOwnProperty'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2dd1,0xb0));var _0x12dd=function(_0x14a5d1,_0x4fd53e){_0x14a5d1=_0x14a5d1-0x0;var _0x160ab1=_0x2dd1[_0x14a5d1];return _0x160ab1;};'use strict';var EventEmitter=require('events');var MailSubstatus=require('../../mysqldb')['db'][_0x12dd('0x0')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x12dd('0x1')](0x0);var events={'afterUpdate':_0x12dd('0x2')};function emitEvent(_0x203377){return function(_0x357cd2,_0x403ccc,_0xe3519a){MailSubstatusEvents['emit'](_0x203377+':'+_0x357cd2['id'],_0x357cd2);MailSubstatusEvents['emit'](_0x203377,_0x357cd2);_0xe3519a(null);};}for(var e in events){if(events[_0x12dd('0x3')](e)){var event=events[e];MailSubstatus[_0x12dd('0x4')](e,emitEvent(event));}}module[_0x12dd('0x5')]=MailSubstatusEvents; \ No newline at end of file +var _0x1c3c=['events','MailSubstatus','setMaxListeners','hasOwnProperty','exports'];(function(_0x5d4702,_0x6680c9){var _0x24590c=function(_0x175024){while(--_0x175024){_0x5d4702['push'](_0x5d4702['shift']());}};_0x24590c(++_0x6680c9);}(_0x1c3c,0x1b8));var _0xc1c3=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x1c3c[_0x4ed520];return _0x4415a6;};'use strict';var EventEmitter=require(_0xc1c3('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0xc1c3('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xc1c3('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x481118){return function(_0x2123b3,_0x22da87,_0x220fe3){MailSubstatusEvents['emit'](_0x481118+':'+_0x2123b3['id'],_0x2123b3);MailSubstatusEvents['emit'](_0x481118,_0x2123b3);_0x220fe3(null);};}for(var e in events){if(events[_0xc1c3('0x3')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0xc1c3('0x4')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 09e1bfa..66df96a 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 _0x5485=['define','MailSubstatus','Condition','update','name','then','catch','./mailSubstatus.attributes','exports'];(function(_0x3d5311,_0x38f31e){var _0x461aba=function(_0x553644){while(--_0x553644){_0x3d5311['push'](_0x3d5311['shift']());}};_0x461aba(++_0x38f31e);}(_0x5485,0x127));var _0x5548=function(_0x243a5e,_0x1efc35){_0x243a5e=_0x243a5e-0x0;var _0x23437a=_0x5485[_0x243a5e];return _0x23437a;};'use strict';var attributes=require(_0x5548('0x0'));module[_0x5548('0x1')]=function(_0x3906cf){var _0x35f698=_0x3906cf['models'];return _0x3906cf[_0x5548('0x2')](_0x5548('0x3'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x1b8e74,_0x182858,_0x28c641){return _0x35f698[_0x5548('0x4')][_0x5548('0x5')]({'value':_0x1b8e74[_0x5548('0x6')]},{'where':{'field':'mailSubstatus','value':_0x1b8e74['_previousDataValues'][_0x5548('0x6')]}})[_0x5548('0x7')](function(){_0x28c641();})[_0x5548('0x8')](function(_0x1c17ed){_0x28c641(_0x1c17ed);});}}});}; \ No newline at end of file +var _0xb3f7=['update','name','mailSubstatus','_previousDataValues','then','./mailSubstatus.attributes','exports','models','define','mail_substatuses','Condition'];(function(_0x343d12,_0x18037e){var _0x21f5a0=function(_0x1853d6){while(--_0x1853d6){_0x343d12['push'](_0x343d12['shift']());}};_0x21f5a0(++_0x18037e);}(_0xb3f7,0x118));var _0x7b3f=function(_0x3ca968,_0x3bae45){_0x3ca968=_0x3ca968-0x0;var _0xbc230e=_0xb3f7[_0x3ca968];return _0xbc230e;};'use strict';var attributes=require(_0x7b3f('0x0'));module[_0x7b3f('0x1')]=function(_0x152d9f){var _0x21b808=_0x152d9f[_0x7b3f('0x2')];return _0x152d9f[_0x7b3f('0x3')]('MailSubstatus',attributes,{'tableName':_0x7b3f('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x107951,_0x10fa41,_0x413529){return _0x21b808[_0x7b3f('0x5')][_0x7b3f('0x6')]({'value':_0x107951[_0x7b3f('0x7')]},{'where':{'field':_0x7b3f('0x8'),'value':_0x107951[_0x7b3f('0x9')][_0x7b3f('0x7')]}})[_0x7b3f('0xa')](function(){_0x413529();})['catch'](function(_0xf206fe){_0x413529(_0xf206fe);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index d852e3b..39b3c37 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 _0x21f1=['ioredis','../../config/utils','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x1d6d74,_0x1ee985){var _0x5e2af6=function(_0x470249){while(--_0x470249){_0x1d6d74['push'](_0x1d6d74['shift']());}};_0x5e2af6(++_0x1ee985);}(_0x21f1,0x80));var _0x121f=function(_0x300112,_0x13b1cc){_0x300112=_0x300112-0x0;var _0x10dc9d=_0x21f1[_0x300112];return _0x10dc9d;};'use strict';var _=require(_0x121f('0x0'));var util=require(_0x121f('0x1'));var moment=require(_0x121f('0x2'));var BPromise=require(_0x121f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x121f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x121f('0x5'));var logger=require('../../config/logger')(_0x121f('0x6'));var config=require(_0x121f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x121f('0x8')][_0x121f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b80a3,_0x3ab727,_0x5d57bc){return new BPromise(function(_0xbd2778,_0x51a2ae){return client[_0x121f('0xa')](_0x2b80a3,_0x5d57bc)['then'](function(_0x2430c8){logger[_0x121f('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x3ab727,_0x121f('0xc'));logger[_0x121f('0xd')](_0x121f('0xe'),_0x3ab727,'request\x20sent',JSON[_0x121f('0xf')](_0x2430c8));if(_0x2430c8['error']){if(_0x2430c8[_0x121f('0x10')][_0x121f('0x11')]===0x1f4){logger['error'](_0x121f('0x12'),_0x3ab727,_0x2430c8[_0x121f('0x10')][_0x121f('0x13')]);return _0x51a2ae(_0x2430c8['error'][_0x121f('0x13')]);}logger[_0x121f('0x10')](_0x121f('0x12'),_0x3ab727,_0x2430c8['error'][_0x121f('0x13')]);return _0xbd2778(_0x2430c8[_0x121f('0x10')][_0x121f('0x13')]);}else{logger[_0x121f('0xb')](_0x121f('0x12'),_0x3ab727,'request\x20sent');_0xbd2778(_0x2430c8[_0x121f('0x14')][_0x121f('0x13')]);}})[_0x121f('0x15')](function(_0x366324){logger[_0x121f('0x10')](_0x121f('0x12'),_0x3ab727,_0x366324);_0x51a2ae(_0x366324);});});} \ No newline at end of file +var _0x3c17=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','MailSubstatus,\x20%s,\x20%s','message','lodash','util'];(function(_0x3263e6,_0x153212){var _0x12beb8=function(_0x485e14){while(--_0x485e14){_0x3263e6['push'](_0x3263e6['shift']());}};_0x12beb8(++_0x153212);}(_0x3c17,0x8a));var _0x73c1=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x3c17[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x73c1('0x0'));var util=require(_0x73c1('0x1'));var moment=require('moment');var BPromise=require(_0x73c1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73c1('0x3'))['db'];var utils=require(_0x73c1('0x4'));var logger=require(_0x73c1('0x5'))(_0x73c1('0x6'));var config=require(_0x73c1('0x7'));var jayson=require(_0x73c1('0x8'));var client=jayson[_0x73c1('0x9')][_0x73c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5411f8,_0x3b1e46,_0x4d4061){return new BPromise(function(_0xb255a3,_0x5e1a8e){return client[_0x73c1('0xb')](_0x5411f8,_0x4d4061)[_0x73c1('0xc')](function(_0x271ad3){logger[_0x73c1('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x3b1e46,_0x73c1('0xe'));logger[_0x73c1('0xf')](_0x73c1('0x10'),_0x3b1e46,_0x73c1('0xe'),JSON['stringify'](_0x271ad3));if(_0x271ad3[_0x73c1('0x11')]){if(_0x271ad3['error']['code']===0x1f4){logger[_0x73c1('0x11')](_0x73c1('0x12'),_0x3b1e46,_0x271ad3['error'][_0x73c1('0x13')]);return _0x5e1a8e(_0x271ad3[_0x73c1('0x11')][_0x73c1('0x13')]);}logger[_0x73c1('0x11')](_0x73c1('0x12'),_0x3b1e46,_0x271ad3[_0x73c1('0x11')][_0x73c1('0x13')]);return _0xb255a3(_0x271ad3[_0x73c1('0x11')][_0x73c1('0x13')]);}else{logger[_0x73c1('0xd')](_0x73c1('0x12'),_0x3b1e46,_0x73c1('0xe'));_0xb255a3(_0x271ad3['result']['message']);}})['catch'](function(_0x3f46ea){logger[_0x73c1('0x11')](_0x73c1('0x12'),_0x3b1e46,_0x3f46ea);_0x5e1a8e(_0x3f46ea);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 740240c..9f779ba 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 _0xcaa1=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','get','/describe','/:id','show','post','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcaa1,0x19f));var _0x1caa=function(_0x19b0f1,_0x2017af){_0x19b0f1=_0x19b0f1-0x0;var _0xd26308=_0xcaa1[_0x19b0f1];return _0xd26308;};'use strict';var multer=require(_0x1caa('0x0'));var util=require('util');var path=require(_0x1caa('0x1'));var timeout=require(_0x1caa('0x2'));var express=require(_0x1caa('0x3'));var router=express[_0x1caa('0x4')]();var fs_extra=require(_0x1caa('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1caa('0x6'));var config=require(_0x1caa('0x7'));var controller=require(_0x1caa('0x8'));router['get']('/',auth[_0x1caa('0x9')](),controller['index']);router[_0x1caa('0xa')](_0x1caa('0xb'),auth[_0x1caa('0x9')](),controller['describe']);router[_0x1caa('0xa')](_0x1caa('0xc'),auth[_0x1caa('0x9')](),controller[_0x1caa('0xd')]);router[_0x1caa('0xe')]('/',auth[_0x1caa('0x9')](),controller['create']);router['put'](_0x1caa('0xc'),auth[_0x1caa('0x9')](),controller[_0x1caa('0xf')]);router[_0x1caa('0x10')](_0x1caa('0xc'),auth[_0x1caa('0x9')](),controller[_0x1caa('0x11')]);module[_0x1caa('0x12')]=router; \ No newline at end of file +var _0xc5b4=['get','/:id','show','post','create','put','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','isAuthenticated','/describe','describe'];(function(_0x3a38e4,_0x297052){var _0x19ae27=function(_0x53b81e){while(--_0x53b81e){_0x3a38e4['push'](_0x3a38e4['shift']());}};_0x19ae27(++_0x297052);}(_0xc5b4,0x1ab));var _0x4c5b=function(_0x33266e,_0x3458ba){_0x33266e=_0x33266e-0x0;var _0x31de04=_0xc5b4[_0x33266e];return _0x31de04;};'use strict';var multer=require('multer');var util=require(_0x4c5b('0x0'));var path=require('path');var timeout=require(_0x4c5b('0x1'));var express=require(_0x4c5b('0x2'));var router=express[_0x4c5b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4c5b('0x4'));var interaction=require(_0x4c5b('0x5'));var config=require('../../config/environment');var controller=require(_0x4c5b('0x6'));router['get']('/',auth[_0x4c5b('0x7')](),controller['index']);router['get'](_0x4c5b('0x8'),auth[_0x4c5b('0x7')](),controller[_0x4c5b('0x9')]);router[_0x4c5b('0xa')](_0x4c5b('0xb'),auth[_0x4c5b('0x7')](),controller[_0x4c5b('0xc')]);router[_0x4c5b('0xd')]('/',auth['isAuthenticated'](),controller[_0x4c5b('0xe')]);router[_0x4c5b('0xf')](_0x4c5b('0xb'),auth[_0x4c5b('0x7')](),controller['update']);router[_0x4c5b('0x10')](_0x4c5b('0xb'),auth[_0x4c5b('0x7')](),controller[_0x4c5b('0x11')]);module[_0x4c5b('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index c982887..4d659cd 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x267f16,_0x71189f){var _0x297df3=function(_0x4f437a){while(--_0x4f437a){_0x267f16['push'](_0x267f16['shift']());}};_0x297df3(++_0x71189f);}(_0xedd9,0xfc));var _0x9edd=function(_0xa8d001,_0x53a535){_0xa8d001=_0xa8d001-0x0;var _0x22dd0e=_0xedd9[_0xa8d001];return _0x22dd0e;};'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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x3f1ad3,_0x46bf02){var _0x3bc9ea=function(_0x330759){while(--_0x330759){_0x3f1ad3['push'](_0x3f1ad3['shift']());}};_0x3bc9ea(++_0x46bf02);}(_0x00bb,0x1d8));var _0xb00b=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x00bb[_0x3ff085];return _0x2b68c3;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index e345245..61d30f2 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 _0x2e41=['../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','save','update','then','destroy','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse'];(function(_0x54cb82,_0x16d914){var _0x3a033a=function(_0x3bed63){while(--_0x3bed63){_0x54cb82['push'](_0x54cb82['shift']());}};_0x3a033a(++_0x16d914);}(_0x2e41,0x152));var _0x12e4=function(_0x48d12f,_0x5b66db){_0x48d12f=_0x48d12f-0x0;var _0x47fadc=_0x2e41[_0x48d12f];return _0x47fadc;};'use strict';var emlformat=require(_0x12e4('0x0'));var rimraf=require(_0x12e4('0x1'));var zipdir=require(_0x12e4('0x2'));var jsonpatch=require(_0x12e4('0x3'));var rp=require('request-promise');var moment=require(_0x12e4('0x4'));var BPromise=require(_0x12e4('0x5'));var Mustache=require('mustache');var util=require(_0x12e4('0x6'));var path=require(_0x12e4('0x7'));var sox=require(_0x12e4('0x8'));var csv=require(_0x12e4('0x9'));var ejs=require(_0x12e4('0xa'));var fs=require('fs');var fs_extra=require(_0x12e4('0xb'));var _=require(_0x12e4('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x12e4('0xd'));var deskjs=require(_0x12e4('0xe'));var toCsv=require(_0x12e4('0x9'));var querystring=require(_0x12e4('0xf'));var Papa=require(_0x12e4('0x10'));var Redis=require('ioredis');var authService=require(_0x12e4('0x11'));var qs=require(_0x12e4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x12e4('0x13'))(_0x12e4('0x14'));var utils=require(_0x12e4('0x15'));var config=require(_0x12e4('0x16'));var licenseUtil=require(_0x12e4('0x17'));var db=require(_0x12e4('0x18'))['db'];function respondWithStatusCode(_0x9a5ffa,_0x20caa9){_0x20caa9=_0x20caa9||0xcc;return function(_0x402380){if(_0x402380){return _0x9a5ffa[_0x12e4('0x19')](_0x20caa9);}return _0x9a5ffa[_0x12e4('0x1a')](_0x20caa9)['end']();};}function respondWithResult(_0xe2dcb2,_0x4a5db1){_0x4a5db1=_0x4a5db1||0xc8;return function(_0x5d06c0){if(_0x5d06c0){return _0xe2dcb2[_0x12e4('0x1a')](_0x4a5db1)['json'](_0x5d06c0);}};}function respondWithFilteredResult(_0x2e0191,_0x17c807){return function(_0x1ef34f){if(_0x1ef34f){var _0x4ae493=typeof _0x17c807[_0x12e4('0x1b')]===_0x12e4('0x1c')&&typeof _0x17c807[_0x12e4('0x1d')]===_0x12e4('0x1c');var _0x5d5a47=_0x1ef34f[_0x12e4('0x1e')];var _0x527847=_0x4ae493?0x0:_0x17c807['offset'];var _0x2948ab=_0x4ae493?_0x1ef34f[_0x12e4('0x1e')]:_0x17c807[_0x12e4('0x1b')]+_0x17c807[_0x12e4('0x1d')];var _0x4f20d1;if(_0x2948ab>=_0x5d5a47){_0x2948ab=_0x5d5a47;_0x4f20d1=0xc8;}else{_0x4f20d1=0xce;}_0x2e0191[_0x12e4('0x1a')](_0x4f20d1);return _0x2e0191['set'](_0x12e4('0x1f'),_0x527847+'-'+_0x2948ab+'/'+_0x5d5a47)[_0x12e4('0x20')](_0x1ef34f);}return null;};}function patchUpdates(_0x14f55b){return function(_0x1fce52){try{jsonpatch['apply'](_0x1fce52,_0x14f55b,!![]);}catch(_0x53a314){return BPromise['reject'](_0x53a314);}return _0x1fce52[_0x12e4('0x21')]();};}function saveUpdates(_0x10853e,_0x4d624d){return function(_0x5b0f69){if(_0x5b0f69){return _0x5b0f69[_0x12e4('0x22')](_0x10853e)[_0x12e4('0x23')](function(_0xc03e5c){return _0xc03e5c;});}return null;};}function removeEntity(_0x17fc62,_0x51da68){return function(_0x131500){if(_0x131500){return _0x131500[_0x12e4('0x24')]()[_0x12e4('0x23')](function(){_0x17fc62[_0x12e4('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x377ca1,_0xe2d428){return function(_0x72c810){if(!_0x72c810){_0x377ca1[_0x12e4('0x19')](0x194);}return _0x72c810;};}function handleError(_0x4d66da,_0x29c596){_0x29c596=_0x29c596||0x1f4;return function(_0x2cadac){logger['error'](_0x2cadac['stack']);if(_0x2cadac[_0x12e4('0x25')]){delete _0x2cadac[_0x12e4('0x25')];}_0x4d66da[_0x12e4('0x1a')](_0x29c596)[_0x12e4('0x26')](_0x2cadac);};}exports[_0x12e4('0x27')]=function(_0x2527d6,_0x153243){var _0x2a8946={},_0x216d9f={},_0x7ff12d={'count':0x0,'rows':[]};var _0x5173ff=_[_0x12e4('0x28')](db[_0x12e4('0x29')][_0x12e4('0x2a')],function(_0x51bedc){return{'name':_0x51bedc[_0x12e4('0x2b')],'type':_0x51bedc[_0x12e4('0x2c')][_0x12e4('0x2d')]};});_0x216d9f['model']=_['map'](_0x5173ff,_0x12e4('0x25'));_0x216d9f[_0x12e4('0x2e')]=_[_0x12e4('0x2f')](_0x2527d6[_0x12e4('0x2e')]);_0x216d9f[_0x12e4('0x30')]=_[_0x12e4('0x31')](_0x216d9f[_0x12e4('0x32')],_0x216d9f[_0x12e4('0x2e')]);_0x2a8946[_0x12e4('0x33')]=_[_0x12e4('0x31')](_0x216d9f['model'],qs[_0x12e4('0x34')](_0x2527d6['query'][_0x12e4('0x34')]));_0x2a8946[_0x12e4('0x33')]=_0x2a8946[_0x12e4('0x33')][_0x12e4('0x35')]?_0x2a8946[_0x12e4('0x33')]:_0x216d9f[_0x12e4('0x32')];if(!_0x2527d6[_0x12e4('0x2e')][_0x12e4('0x36')]('nolimit')){_0x2a8946['limit']=qs['limit'](_0x2527d6[_0x12e4('0x2e')][_0x12e4('0x1d')]);_0x2a8946[_0x12e4('0x1b')]=qs[_0x12e4('0x1b')](_0x2527d6[_0x12e4('0x2e')][_0x12e4('0x1b')]);}_0x2a8946[_0x12e4('0x37')]=qs['sort'](_0x2527d6[_0x12e4('0x2e')][_0x12e4('0x38')]);_0x2a8946[_0x12e4('0x39')]=qs['filters'](_[_0x12e4('0x3a')](_0x2527d6[_0x12e4('0x2e')],_0x216d9f[_0x12e4('0x30')]),_0x5173ff);if(_0x2527d6[_0x12e4('0x2e')][_0x12e4('0x3b')]){_0x2a8946[_0x12e4('0x39')]=_[_0x12e4('0x3c')](_0x2a8946['where'],{'$or':_['map'](_0x5173ff,function(_0x57704c){if(_0x57704c[_0x12e4('0x2c')]!==_0x12e4('0x3d')){var _0x5eb0a4={};_0x5eb0a4[_0x57704c['name']]={'$like':'%'+_0x2527d6['query'][_0x12e4('0x3b')]+'%'};return _0x5eb0a4;}})});}_0x2a8946=_[_0x12e4('0x3c')]({},_0x2a8946,_0x2527d6[_0x12e4('0x3e')]);var _0x117c71={'where':_0x2a8946[_0x12e4('0x39')]};return db[_0x12e4('0x29')][_0x12e4('0x1e')](_0x117c71)[_0x12e4('0x23')](function(_0x8f342f){_0x7ff12d[_0x12e4('0x1e')]=_0x8f342f;if(_0x2527d6[_0x12e4('0x2e')][_0x12e4('0x3f')]){_0x2a8946['include']=[{'all':!![]}];}return db['MailTransferReport'][_0x12e4('0x40')](_0x2a8946);})[_0x12e4('0x23')](function(_0x445daf){_0x7ff12d['rows']=_0x445daf;return _0x7ff12d;})['then'](respondWithFilteredResult(_0x153243,_0x2a8946))[_0x12e4('0x41')](handleError(_0x153243,null));};exports['show']=function(_0x53aa11,_0x585ce6){var _0x13f26c={'raw':!![],'where':{'id':_0x53aa11[_0x12e4('0x42')]['id']}},_0x3121c1={};_0x3121c1[_0x12e4('0x32')]=_['keys'](db[_0x12e4('0x29')][_0x12e4('0x2a')]);_0x3121c1[_0x12e4('0x2e')]=_[_0x12e4('0x2f')](_0x53aa11[_0x12e4('0x2e')]);_0x3121c1[_0x12e4('0x30')]=_[_0x12e4('0x31')](_0x3121c1[_0x12e4('0x32')],_0x3121c1['query']);_0x13f26c[_0x12e4('0x33')]=_[_0x12e4('0x31')](_0x3121c1[_0x12e4('0x32')],qs[_0x12e4('0x34')](_0x53aa11[_0x12e4('0x2e')][_0x12e4('0x34')]));_0x13f26c[_0x12e4('0x33')]=_0x13f26c[_0x12e4('0x33')]['length']?_0x13f26c[_0x12e4('0x33')]:_0x3121c1[_0x12e4('0x32')];if(_0x53aa11['query'][_0x12e4('0x3f')]){_0x13f26c['include']=[{'all':!![]}];}_0x13f26c=_[_0x12e4('0x3c')]({},_0x13f26c,_0x53aa11[_0x12e4('0x3e')]);return db[_0x12e4('0x29')][_0x12e4('0x43')](_0x13f26c)['then'](handleEntityNotFound(_0x585ce6,null))['then'](respondWithResult(_0x585ce6,null))[_0x12e4('0x41')](handleError(_0x585ce6,null));};exports[_0x12e4('0x44')]=function(_0xc23bfb,_0xfd7163){return db[_0x12e4('0x29')][_0x12e4('0x44')](_0xc23bfb[_0x12e4('0x45')],{})[_0x12e4('0x23')](respondWithResult(_0xfd7163,0xc9))[_0x12e4('0x41')](handleError(_0xfd7163,null));};exports[_0x12e4('0x22')]=function(_0x18790b,_0x2d88f9){if(_0x18790b['body']['id']){delete _0x18790b[_0x12e4('0x45')]['id'];}return db[_0x12e4('0x29')][_0x12e4('0x43')]({'where':{'id':_0x18790b[_0x12e4('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d88f9,null))[_0x12e4('0x23')](saveUpdates(_0x18790b[_0x12e4('0x45')],null))[_0x12e4('0x23')](respondWithResult(_0x2d88f9,null))[_0x12e4('0x41')](handleError(_0x2d88f9,null));};exports[_0x12e4('0x24')]=function(_0x117be0,_0xfe1d88){return db[_0x12e4('0x29')][_0x12e4('0x43')]({'where':{'id':_0x117be0[_0x12e4('0x42')]['id']}})[_0x12e4('0x23')](handleEntityNotFound(_0xfe1d88,null))[_0x12e4('0x23')](removeEntity(_0xfe1d88,null))[_0x12e4('0x41')](handleError(_0xfe1d88,null));};exports[_0x12e4('0x46')]=function(_0x1627e8,_0xf60d4a){return db[_0x12e4('0x29')][_0x12e4('0x46')]()[_0x12e4('0x23')](respondWithResult(_0xf60d4a,null))[_0x12e4('0x41')](handleError(_0xf60d4a,null));}; \ No newline at end of file +var _0x2659=['then','destroy','end','error','stack','name','index','MailTransferReport','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','show','params','keys','includeAll','catch','create','find','body','describe','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','undefined','offset','count','limit','set','Content-Range','apply','reject','update'];(function(_0x395237,_0x1657fc){var _0x22949e=function(_0x1b07c5){while(--_0x1b07c5){_0x395237['push'](_0x395237['shift']());}};_0x22949e(++_0x1657fc);}(_0x2659,0x1de));var _0x9265=function(_0x54fc1f,_0x1703c2){_0x54fc1f=_0x54fc1f-0x0;var _0x53f699=_0x2659[_0x54fc1f];return _0x53f699;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9265('0x0'));var zipdir=require(_0x9265('0x1'));var jsonpatch=require(_0x9265('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9265('0x3'));var Mustache=require('mustache');var util=require(_0x9265('0x4'));var path=require(_0x9265('0x5'));var sox=require(_0x9265('0x6'));var csv=require('to-csv');var ejs=require(_0x9265('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9265('0x8'));var squel=require(_0x9265('0x9'));var crypto=require(_0x9265('0xa'));var jsforce=require(_0x9265('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9265('0xc'));var querystring=require(_0x9265('0xd'));var Papa=require(_0x9265('0xe'));var Redis=require(_0x9265('0xf'));var authService=require(_0x9265('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9265('0x11'));var hardwareService=require(_0x9265('0x12'));var logger=require(_0x9265('0x13'))('api');var utils=require(_0x9265('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9265('0x15'))['db'];function respondWithStatusCode(_0x2590e8,_0x5415c5){_0x5415c5=_0x5415c5||0xcc;return function(_0x2a1b63){if(_0x2a1b63){return _0x2590e8[_0x9265('0x16')](_0x5415c5);}return _0x2590e8[_0x9265('0x17')](_0x5415c5)['end']();};}function respondWithResult(_0x42f1ea,_0x12aa2e){_0x12aa2e=_0x12aa2e||0xc8;return function(_0x3dcb37){if(_0x3dcb37){return _0x42f1ea[_0x9265('0x17')](_0x12aa2e)['json'](_0x3dcb37);}};}function respondWithFilteredResult(_0x3d3040,_0x54fea3){return function(_0x268ddc){if(_0x268ddc){var _0x2190ba=typeof _0x54fea3['offset']===_0x9265('0x18')&&typeof _0x54fea3['limit']===_0x9265('0x18');var _0x40ec60=_0x268ddc['count'];var _0x5c3384=_0x2190ba?0x0:_0x54fea3[_0x9265('0x19')];var _0x4e2b5b=_0x2190ba?_0x268ddc[_0x9265('0x1a')]:_0x54fea3['offset']+_0x54fea3[_0x9265('0x1b')];var _0x63c14f;if(_0x4e2b5b>=_0x40ec60){_0x4e2b5b=_0x40ec60;_0x63c14f=0xc8;}else{_0x63c14f=0xce;}_0x3d3040[_0x9265('0x17')](_0x63c14f);return _0x3d3040[_0x9265('0x1c')](_0x9265('0x1d'),_0x5c3384+'-'+_0x4e2b5b+'/'+_0x40ec60)['json'](_0x268ddc);}return null;};}function patchUpdates(_0x1b77e6){return function(_0x46577d){try{jsonpatch[_0x9265('0x1e')](_0x46577d,_0x1b77e6,!![]);}catch(_0x2a018d){return BPromise[_0x9265('0x1f')](_0x2a018d);}return _0x46577d['save']();};}function saveUpdates(_0x3a25c1,_0x7b33e1){return function(_0x402ae5){if(_0x402ae5){return _0x402ae5[_0x9265('0x20')](_0x3a25c1)[_0x9265('0x21')](function(_0x139c83){return _0x139c83;});}return null;};}function removeEntity(_0x3daafa,_0x260a19){return function(_0xb550f6){if(_0xb550f6){return _0xb550f6[_0x9265('0x22')]()[_0x9265('0x21')](function(){_0x3daafa[_0x9265('0x17')](0xcc)[_0x9265('0x23')]();});}};}function handleEntityNotFound(_0x4b6107,_0x2f7292){return function(_0x3c9858){if(!_0x3c9858){_0x4b6107[_0x9265('0x16')](0x194);}return _0x3c9858;};}function handleError(_0x547cbb,_0x836e75){_0x836e75=_0x836e75||0x1f4;return function(_0x11835e){logger[_0x9265('0x24')](_0x11835e[_0x9265('0x25')]);if(_0x11835e[_0x9265('0x26')]){delete _0x11835e[_0x9265('0x26')];}_0x547cbb[_0x9265('0x17')](_0x836e75)['send'](_0x11835e);};}exports[_0x9265('0x27')]=function(_0x4f0715,_0x6ca291){var _0x448ea7={},_0x47cd1b={},_0x3b46b8={'count':0x0,'rows':[]};var _0x21e71e=_['map'](db[_0x9265('0x28')][_0x9265('0x29')],function(_0x1f9e08){return{'name':_0x1f9e08[_0x9265('0x2a')],'type':_0x1f9e08[_0x9265('0x2b')][_0x9265('0x2c')]};});_0x47cd1b['model']=_['map'](_0x21e71e,_0x9265('0x26'));_0x47cd1b[_0x9265('0x2d')]=_['keys'](_0x4f0715[_0x9265('0x2d')]);_0x47cd1b['filters']=_[_0x9265('0x2e')](_0x47cd1b[_0x9265('0x2f')],_0x47cd1b[_0x9265('0x2d')]);_0x448ea7[_0x9265('0x30')]=_[_0x9265('0x2e')](_0x47cd1b[_0x9265('0x2f')],qs[_0x9265('0x31')](_0x4f0715['query'][_0x9265('0x31')]));_0x448ea7[_0x9265('0x30')]=_0x448ea7[_0x9265('0x30')][_0x9265('0x32')]?_0x448ea7['attributes']:_0x47cd1b[_0x9265('0x2f')];if(!_0x4f0715['query'][_0x9265('0x33')](_0x9265('0x34'))){_0x448ea7[_0x9265('0x1b')]=qs['limit'](_0x4f0715['query'][_0x9265('0x1b')]);_0x448ea7[_0x9265('0x19')]=qs[_0x9265('0x19')](_0x4f0715['query'][_0x9265('0x19')]);}_0x448ea7[_0x9265('0x35')]=qs[_0x9265('0x36')](_0x4f0715[_0x9265('0x2d')][_0x9265('0x36')]);_0x448ea7[_0x9265('0x37')]=qs[_0x9265('0x38')](_[_0x9265('0x39')](_0x4f0715[_0x9265('0x2d')],_0x47cd1b[_0x9265('0x38')]),_0x21e71e);if(_0x4f0715[_0x9265('0x2d')][_0x9265('0x3a')]){_0x448ea7[_0x9265('0x37')]=_[_0x9265('0x3b')](_0x448ea7[_0x9265('0x37')],{'$or':_['map'](_0x21e71e,function(_0x5656db){if(_0x5656db[_0x9265('0x2b')]!==_0x9265('0x3c')){var _0x3f19ea={};_0x3f19ea[_0x5656db[_0x9265('0x26')]]={'$like':'%'+_0x4f0715[_0x9265('0x2d')][_0x9265('0x3a')]+'%'};return _0x3f19ea;}})});}_0x448ea7=_[_0x9265('0x3b')]({},_0x448ea7,_0x4f0715[_0x9265('0x3d')]);var _0x5263db={'where':_0x448ea7[_0x9265('0x37')]};return db[_0x9265('0x28')][_0x9265('0x1a')](_0x5263db)[_0x9265('0x21')](function(_0x5770d9){_0x3b46b8['count']=_0x5770d9;if(_0x4f0715[_0x9265('0x2d')]['includeAll']){_0x448ea7[_0x9265('0x3e')]=[{'all':!![]}];}return db[_0x9265('0x28')]['findAll'](_0x448ea7);})[_0x9265('0x21')](function(_0x24848a){_0x3b46b8[_0x9265('0x3f')]=_0x24848a;return _0x3b46b8;})[_0x9265('0x21')](respondWithFilteredResult(_0x6ca291,_0x448ea7))['catch'](handleError(_0x6ca291,null));};exports[_0x9265('0x40')]=function(_0xe635fa,_0x406205){var _0x28b26c={'raw':!![],'where':{'id':_0xe635fa[_0x9265('0x41')]['id']}},_0x1d739b={};_0x1d739b[_0x9265('0x2f')]=_[_0x9265('0x42')](db[_0x9265('0x28')]['rawAttributes']);_0x1d739b[_0x9265('0x2d')]=_['keys'](_0xe635fa['query']);_0x1d739b['filters']=_[_0x9265('0x2e')](_0x1d739b[_0x9265('0x2f')],_0x1d739b[_0x9265('0x2d')]);_0x28b26c[_0x9265('0x30')]=_[_0x9265('0x2e')](_0x1d739b['model'],qs['fields'](_0xe635fa[_0x9265('0x2d')]['fields']));_0x28b26c[_0x9265('0x30')]=_0x28b26c[_0x9265('0x30')][_0x9265('0x32')]?_0x28b26c[_0x9265('0x30')]:_0x1d739b[_0x9265('0x2f')];if(_0xe635fa['query'][_0x9265('0x43')]){_0x28b26c[_0x9265('0x3e')]=[{'all':!![]}];}_0x28b26c=_[_0x9265('0x3b')]({},_0x28b26c,_0xe635fa[_0x9265('0x3d')]);return db[_0x9265('0x28')]['find'](_0x28b26c)[_0x9265('0x21')](handleEntityNotFound(_0x406205,null))['then'](respondWithResult(_0x406205,null))[_0x9265('0x44')](handleError(_0x406205,null));};exports['create']=function(_0x59832f,_0x2bec6b){return db['MailTransferReport'][_0x9265('0x45')](_0x59832f['body'],{})[_0x9265('0x21')](respondWithResult(_0x2bec6b,0xc9))['catch'](handleError(_0x2bec6b,null));};exports[_0x9265('0x20')]=function(_0x28cb0d,_0x11a440){if(_0x28cb0d['body']['id']){delete _0x28cb0d['body']['id'];}return db[_0x9265('0x28')][_0x9265('0x46')]({'where':{'id':_0x28cb0d['params']['id']}})['then'](handleEntityNotFound(_0x11a440,null))[_0x9265('0x21')](saveUpdates(_0x28cb0d[_0x9265('0x47')],null))[_0x9265('0x21')](respondWithResult(_0x11a440,null))[_0x9265('0x44')](handleError(_0x11a440,null));};exports[_0x9265('0x22')]=function(_0x31afe7,_0x2413eb){return db[_0x9265('0x28')][_0x9265('0x46')]({'where':{'id':_0x31afe7[_0x9265('0x41')]['id']}})['then'](handleEntityNotFound(_0x2413eb,null))[_0x9265('0x21')](removeEntity(_0x2413eb,null))[_0x9265('0x44')](handleError(_0x2413eb,null));};exports[_0x9265('0x48')]=function(_0x40d371,_0x505681){return db[_0x9265('0x28')][_0x9265('0x48')]()[_0x9265('0x21')](respondWithResult(_0x505681,null))[_0x9265('0x44')](handleError(_0x505681,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index aba4493..919e062 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 _0x7118=['../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x342465,_0x3aa51b){var _0x4a4da7=function(_0x1047e1){while(--_0x1047e1){_0x342465['push'](_0x342465['shift']());}};_0x4a4da7(++_0x3aa51b);}(_0x7118,0x159));var _0x8711=function(_0x4d1a47,_0x4ab51d){_0x4d1a47=_0x4d1a47-0x0;var _0x550b0b=_0x7118[_0x4d1a47];return _0x550b0b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8711('0x0'))(_0x8711('0x1'));var moment=require('moment');var BPromise=require(_0x8711('0x2'));var rp=require(_0x8711('0x3'));var fs=require('fs');var path=require(_0x8711('0x4'));var rimraf=require(_0x8711('0x5'));var config=require(_0x8711('0x6'));var attributes=require(_0x8711('0x7'));module[_0x8711('0x8')]=function(_0x54885e,_0x385033){return _0x54885e[_0x8711('0x9')](_0x8711('0xa'),attributes,{'tableName':_0x8711('0xb'),'paranoid':![],'indexes':[{'name':_0x8711('0xc'),'fields':[_0x8711('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4a06=['MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define'];(function(_0x2d06b1,_0x3aef78){var _0x40532d=function(_0x262c1a){while(--_0x262c1a){_0x2d06b1['push'](_0x2d06b1['shift']());}};_0x40532d(++_0x3aef78);}(_0x4a06,0x1f2));var _0x64a0=function(_0x2deb45,_0x3304ef){_0x2deb45=_0x2deb45-0x0;var _0x4b177d=_0x4a06[_0x2deb45];return _0x4b177d;};'use strict';var _=require(_0x64a0('0x0'));var util=require(_0x64a0('0x1'));var logger=require(_0x64a0('0x2'))(_0x64a0('0x3'));var moment=require(_0x64a0('0x4'));var BPromise=require(_0x64a0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x64a0('0x6'));var rimraf=require(_0x64a0('0x7'));var config=require(_0x64a0('0x8'));var attributes=require(_0x64a0('0x9'));module[_0x64a0('0xa')]=function(_0xba1d8f,_0x37464e){return _0xba1d8f[_0x64a0('0xb')](_0x64a0('0xc'),attributes,{'tableName':_0x64a0('0xd'),'paranoid':![],'indexes':[{'name':_0x64a0('0xe'),'fields':[_0x64a0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 58fce10..d6b6264 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 _0x2079=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','ioredis'];(function(_0x36b8d6,_0x164896){var _0x49e6a5=function(_0x296fad){while(--_0x296fad){_0x36b8d6['push'](_0x36b8d6['shift']());}};_0x49e6a5(++_0x164896);}(_0x2079,0xd8));var _0x9207=function(_0x291657,_0x4cccd7){_0x291657=_0x291657-0x0;var _0x535e3c=_0x2079[_0x291657];return _0x535e3c;};'use strict';var _=require('lodash');var util=require(_0x9207('0x0'));var moment=require(_0x9207('0x1'));var BPromise=require(_0x9207('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9207('0x3'));var db=require(_0x9207('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9207('0x5'))(_0x9207('0x6'));var config=require(_0x9207('0x7'));var jayson=require(_0x9207('0x8'));var client=jayson[_0x9207('0x9')][_0x9207('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x599461,_0x42cb03,_0x294a5a){return new BPromise(function(_0x28b81e,_0x28f662){return client[_0x9207('0xb')](_0x599461,_0x294a5a)[_0x9207('0xc')](function(_0x4d040b){logger[_0x9207('0xd')](_0x9207('0xe'),_0x42cb03,_0x9207('0xf'));logger['debug'](_0x9207('0x10'),_0x42cb03,_0x9207('0xf'),JSON['stringify'](_0x4d040b));if(_0x4d040b[_0x9207('0x11')]){if(_0x4d040b['error'][_0x9207('0x12')]===0x1f4){logger['error'](_0x9207('0xe'),_0x42cb03,_0x4d040b[_0x9207('0x11')]['message']);return _0x28f662(_0x4d040b[_0x9207('0x11')][_0x9207('0x13')]);}logger[_0x9207('0x11')](_0x9207('0xe'),_0x42cb03,_0x4d040b[_0x9207('0x11')]['message']);return _0x28b81e(_0x4d040b[_0x9207('0x11')]['message']);}else{logger[_0x9207('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x42cb03,_0x9207('0xf'));_0x28b81e(_0x4d040b[_0x9207('0x14')][_0x9207('0x13')]);}})[_0x9207('0x15')](function(_0xfed483){logger[_0x9207('0x11')](_0x9207('0xe'),_0x42cb03,_0xfed483);_0x28f662(_0xfed483);});});} \ No newline at end of file +var _0xb486=['../../config/environment','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5a92ad,_0x2219a6){var _0x2466f8=function(_0x4ad04e){while(--_0x4ad04e){_0x5a92ad['push'](_0x5a92ad['shift']());}};_0x2466f8(++_0x2219a6);}(_0xb486,0x1b0));var _0x6b48=function(_0x2b6467,_0x317356){_0x2b6467=_0x2b6467-0x0;var _0x39069b=_0xb486[_0x2b6467];return _0x39069b;};'use strict';var _=require(_0x6b48('0x0'));var util=require(_0x6b48('0x1'));var moment=require('moment');var BPromise=require(_0x6b48('0x2'));var rs=require(_0x6b48('0x3'));var fs=require('fs');var Redis=require(_0x6b48('0x4'));var db=require(_0x6b48('0x5'))['db'];var utils=require(_0x6b48('0x6'));var logger=require('../../config/logger')(_0x6b48('0x7'));var config=require(_0x6b48('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a9aff,_0x2ffa72,_0xe39f4a){return new BPromise(function(_0x19b58a,_0x25a05c){return client[_0x6b48('0x9')](_0x2a9aff,_0xe39f4a)[_0x6b48('0xa')](function(_0x4b8a96){logger[_0x6b48('0xb')](_0x6b48('0xc'),_0x2ffa72,_0x6b48('0xd'));logger[_0x6b48('0xe')](_0x6b48('0xf'),_0x2ffa72,_0x6b48('0xd'),JSON[_0x6b48('0x10')](_0x4b8a96));if(_0x4b8a96['error']){if(_0x4b8a96[_0x6b48('0x11')][_0x6b48('0x12')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x2ffa72,_0x4b8a96[_0x6b48('0x11')][_0x6b48('0x13')]);return _0x25a05c(_0x4b8a96[_0x6b48('0x11')][_0x6b48('0x13')]);}logger[_0x6b48('0x11')](_0x6b48('0xc'),_0x2ffa72,_0x4b8a96[_0x6b48('0x11')][_0x6b48('0x13')]);return _0x19b58a(_0x4b8a96['error'][_0x6b48('0x13')]);}else{logger['info'](_0x6b48('0xc'),_0x2ffa72,_0x6b48('0xd'));_0x19b58a(_0x4b8a96[_0x6b48('0x14')][_0x6b48('0x13')]);}})[_0x6b48('0x15')](function(_0x5d6cbd){logger[_0x6b48('0x11')](_0x6b48('0xc'),_0x2ffa72,_0x5d6cbd);_0x25a05c(_0x5d6cbd);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 484872c..2ab1029 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 _0x2fbb=['show','post','create','put','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','/:id'];(function(_0x5215bd,_0x422a2f){var _0x4d227a=function(_0x2135c8){while(--_0x2135c8){_0x5215bd['push'](_0x5215bd['shift']());}};_0x4d227a(++_0x422a2f);}(_0x2fbb,0x1bf));var _0xb2fb=function(_0x54dccf,_0x113006){_0x54dccf=_0x54dccf-0x0;var _0x316acf=_0x2fbb[_0x54dccf];return _0x316acf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb2fb('0x0'));var timeout=require(_0xb2fb('0x1'));var express=require(_0xb2fb('0x2'));var router=express[_0xb2fb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb2fb('0x4'));var interaction=require(_0xb2fb('0x5'));var config=require(_0xb2fb('0x6'));var controller=require(_0xb2fb('0x7'));router[_0xb2fb('0x8')]('/',auth[_0xb2fb('0x9')](),controller['index']);router['get'](_0xb2fb('0xa'),auth[_0xb2fb('0x9')](),controller['describe']);router[_0xb2fb('0x8')](_0xb2fb('0xb'),auth[_0xb2fb('0x9')](),controller[_0xb2fb('0xc')]);router[_0xb2fb('0xd')]('/',auth['isAuthenticated'](),controller[_0xb2fb('0xe')]);router[_0xb2fb('0xf')]('/:id',auth[_0xb2fb('0x9')](),controller['update']);router['delete'](_0xb2fb('0xb'),auth[_0xb2fb('0x9')](),controller['destroy']);module[_0xb2fb('0x10')]=router; \ No newline at end of file +var _0x29a4=['post','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x29a4,0x6a));var _0x429a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x29a4[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x429a('0x0'));var util=require(_0x429a('0x1'));var path=require(_0x429a('0x2'));var timeout=require('connect-timeout');var express=require(_0x429a('0x3'));var router=express[_0x429a('0x4')]();var fs_extra=require(_0x429a('0x5'));var auth=require(_0x429a('0x6'));var interaction=require(_0x429a('0x7'));var config=require(_0x429a('0x8'));var controller=require('./memberReport.controller');router[_0x429a('0x9')]('/',auth[_0x429a('0xa')](),controller[_0x429a('0xb')]);router[_0x429a('0x9')]('/describe',auth[_0x429a('0xa')](),controller['describe']);router[_0x429a('0x9')](_0x429a('0xc'),auth[_0x429a('0xa')](),controller[_0x429a('0xd')]);router[_0x429a('0xe')]('/',auth[_0x429a('0xa')](),controller[_0x429a('0xf')]);router['put'](_0x429a('0xc'),auth[_0x429a('0xa')](),controller[_0x429a('0x10')]);router[_0x429a('0x11')](_0x429a('0xc'),auth[_0x429a('0xa')](),controller[_0x429a('0x12')]);module[_0x429a('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 0039d36..2d2b196 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 _0x391b=['talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','enterAt','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]'];(function(_0x3d4ea9,_0x1814bb){var _0x22a94a=function(_0x5522ce){while(--_0x5522ce){_0x3d4ea9['push'](_0x3d4ea9['shift']());}};_0x22a94a(++_0x1814bb);}(_0x391b,0x1cd));var _0xb391=function(_0x80f51a,_0x32e95e){_0x80f51a=_0x80f51a-0x0;var _0x327148=_0x391b[_0x80f51a];return _0x327148;};'use strict';var Sequelize=require(_0xb391('0x0'));var moment=require(_0xb391('0x1'));module[_0xb391('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xb391('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb391('0x3')],'defaultValue':_0xb391('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xb391('0x5')]},'enterAt':{'type':Sequelize[_0xb391('0x6')]},'exitAt':{'type':Sequelize[_0xb391('0x6')],'set':function(_0x1c19c2){var _0x2188d9=moment(_0x1c19c2);var _0x35400c=moment(this['getDataValue'](_0xb391('0x7')));var _0x202e7c=_0x2188d9[_0xb391('0x8')](_0x35400c,_0xb391('0x9'));this[_0xb391('0xa')](_0xb391('0xb'),_0x1c19c2);this[_0xb391('0xa')]('duration',_0x202e7c>=0x0?_0x202e7c:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xb391('0xc')},'data2':{'type':Sequelize[_0xb391('0x3')],'comment':_0xb391('0xd')},'data3':{'type':Sequelize[_0xb391('0x3')],'comment':_0xb391('0xe')},'data4':{'type':Sequelize[_0xb391('0x3')],'comment':_0xb391('0xf')},'data5':{'type':Sequelize[_0xb391('0x3')],'comment':_0xb391('0x10')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xb391('0x3')]}}; \ No newline at end of file +var _0x69ec=['STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[start]','talk:[dial\x20string]','talk:[queue]','moment','exports'];(function(_0x34dbcf,_0x327b9a){var _0x3ebd20=function(_0x4517bd){while(--_0x4517bd){_0x34dbcf['push'](_0x34dbcf['shift']());}};_0x3ebd20(++_0x327b9a);}(_0x69ec,0xbe));var _0xc69e=function(_0xa80908,_0x1fbb08){_0xa80908=_0xa80908-0x0;var _0x1e8bed=_0x69ec[_0xa80908];return _0x1e8bed;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc69e('0x0'));module[_0xc69e('0x1')]={'channel':{'type':Sequelize[_0xc69e('0x2')]},'membername':{'type':Sequelize[_0xc69e('0x2')]},'interface':{'type':Sequelize[_0xc69e('0x2')]},'type':{'type':Sequelize[_0xc69e('0x2')],'defaultValue':_0xc69e('0x3'),'comment':_0xc69e('0x4')},'duration':{'type':Sequelize[_0xc69e('0x5')]},'enterAt':{'type':Sequelize[_0xc69e('0x6')]},'exitAt':{'type':Sequelize[_0xc69e('0x6')],'set':function(_0x4aaf35){var _0x573547=moment(_0x4aaf35);var _0x452419=moment(this['getDataValue'](_0xc69e('0x7')));var _0x42c120=_0x573547[_0xc69e('0x8')](_0x452419,_0xc69e('0x9'));this[_0xc69e('0xa')](_0xc69e('0xb'),_0x4aaf35);this[_0xc69e('0xa')](_0xc69e('0xc'),_0x42c120>=0x0?_0x42c120:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0xc69e('0xd')},'data3':{'type':Sequelize[_0xc69e('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xc69e('0x2')],'comment':_0xc69e('0xe')},'data5':{'type':Sequelize[_0xc69e('0x2')],'comment':_0xc69e('0xf')},'role':{'type':Sequelize[_0xc69e('0x2')]},'internal':{'type':Sequelize[_0xc69e('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index ff66f32..d07c4b0 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 _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x55ca,0x126));var _0xa55c=function(_0x5713b5,_0x423f83){_0x5713b5=_0x5713b5-0x0;var _0x2f795d=_0x55ca[_0x5713b5];return _0x2f795d;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file +var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xedd9,0xfc));var _0x9edd=function(_0x5c7fee,_0x18241b){_0x5c7fee=_0x5c7fee-0x0;var _0x17586c=_0xedd9[_0x5c7fee];return _0x17586c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 06caa59..ad063e4 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 _0x339d=['request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','interface','util','../../config/logger','api','moment'];(function(_0x226a2c,_0xa380e2){var _0x41e188=function(_0x380164){while(--_0x380164){_0x226a2c['push'](_0x226a2c['shift']());}};_0x41e188(++_0xa380e2);}(_0x339d,0x14c));var _0xd339=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0x339d[_0x100e36];return _0x1df0c9;};'use strict';var _=require('lodash');var util=require(_0xd339('0x0'));var logger=require(_0xd339('0x1'))(_0xd339('0x2'));var moment=require(_0xd339('0x3'));var BPromise=require('bluebird');var rp=require(_0xd339('0x4'));var fs=require('fs');var path=require(_0xd339('0x5'));var rimraf=require(_0xd339('0x6'));var config=require(_0xd339('0x7'));var attributes=require(_0xd339('0x8'));module[_0xd339('0x9')]=function(_0x8de76,_0x38a80e){return _0x8de76[_0xd339('0xa')](_0xd339('0xb'),attributes,{'tableName':_0xd339('0xc'),'paranoid':![],'indexes':[{'name':_0xd339('0xd'),'fields':[_0xd339('0xe'),_0xd339('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2319=['membername_interface','interface','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','MemberReport','report_member'];(function(_0x3e2270,_0x179bdb){var _0xd2d669=function(_0x298726){while(--_0x298726){_0x3e2270['push'](_0x3e2270['shift']());}};_0xd2d669(++_0x179bdb);}(_0x2319,0x144));var _0x9231=function(_0xab6069,_0x3d7b7e){_0xab6069=_0xab6069-0x0;var _0x1c7402=_0x2319[_0xab6069];return _0x1c7402;};'use strict';var _=require(_0x9231('0x0'));var util=require(_0x9231('0x1'));var logger=require(_0x9231('0x2'))('api');var moment=require(_0x9231('0x3'));var BPromise=require(_0x9231('0x4'));var rp=require(_0x9231('0x5'));var fs=require('fs');var path=require(_0x9231('0x6'));var rimraf=require('rimraf');var config=require(_0x9231('0x7'));var attributes=require('./memberReport.attributes');module[_0x9231('0x8')]=function(_0x16b979,_0x367a40){return _0x16b979[_0x9231('0x9')](_0x9231('0xa'),attributes,{'tableName':_0x9231('0xb'),'paranoid':![],'indexes':[{'name':_0x9231('0xc'),'fields':['membername',_0x9231('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 36622c3..30710bb 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 _0x8c46=['findAll','options','raw','where','attributes','limit','include','model','map','then','catch','CreateMemberReport','create','body','debug','update','UpdateMemberReport','stringify','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetMemberReport','MemberReport'];(function(_0x503444,_0x392264){var _0x38d77e=function(_0xf2ad19){while(--_0xf2ad19){_0x503444['push'](_0x503444['shift']());}};_0x38d77e(++_0x392264);}(_0x8c46,0x171));var _0x68c4=function(_0x2a2137,_0x280212){_0x2a2137=_0x2a2137-0x0;var _0x466f22=_0x8c46[_0x2a2137];return _0x466f22;};'use strict';var _=require(_0x68c4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x68c4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x68c4('0x2'))['db'];var utils=require(_0x68c4('0x3'));var logger=require(_0x68c4('0x4'))(_0x68c4('0x5'));var config=require(_0x68c4('0x6'));var jayson=require(_0x68c4('0x7'));var client=jayson[_0x68c4('0x8')][_0x68c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3da9c3,_0x458a2b,_0x5e57ce){return new BPromise(function(_0x1754d7,_0x1d40a3){return client[_0x68c4('0xa')](_0x3da9c3,_0x5e57ce)['then'](function(_0x356698){logger[_0x68c4('0xb')](_0x68c4('0xc'),_0x458a2b,'request\x20sent');logger['debug'](_0x68c4('0xd'),_0x458a2b,_0x68c4('0xe'),JSON['stringify'](_0x356698));if(_0x356698['error']){if(_0x356698[_0x68c4('0xf')][_0x68c4('0x10')]===0x1f4){logger[_0x68c4('0xf')]('MemberReport,\x20%s,\x20%s',_0x458a2b,_0x356698[_0x68c4('0xf')][_0x68c4('0x11')]);return _0x1d40a3(_0x356698[_0x68c4('0xf')]['message']);}logger[_0x68c4('0xf')](_0x68c4('0xc'),_0x458a2b,_0x356698[_0x68c4('0xf')]['message']);return _0x1754d7(_0x356698[_0x68c4('0xf')][_0x68c4('0x11')]);}else{logger['info'](_0x68c4('0xc'),_0x458a2b,'request\x20sent');_0x1754d7(_0x356698[_0x68c4('0x12')]['message']);}})['catch'](function(_0xc2ea2f){logger[_0x68c4('0xf')]('MemberReport,\x20%s,\x20%s',_0x458a2b,_0xc2ea2f);_0x1d40a3(_0xc2ea2f);});});}exports[_0x68c4('0x13')]=function(_0x1d757c){var _0x38ac38=this;return new Promise(function(_0x33c5c5,_0x3a6300){return db[_0x68c4('0x14')][_0x68c4('0x15')]({'raw':_0x1d757c[_0x68c4('0x16')]?_0x1d757c[_0x68c4('0x16')][_0x68c4('0x17')]===undefined?!![]:![]:!![],'where':_0x1d757c[_0x68c4('0x16')]?_0x1d757c['options'][_0x68c4('0x18')]||null:null,'attributes':_0x1d757c['options']?_0x1d757c['options'][_0x68c4('0x19')]||null:null,'limit':_0x1d757c[_0x68c4('0x16')]?_0x1d757c[_0x68c4('0x16')][_0x68c4('0x1a')]||null:null,'include':_0x1d757c['options']?_0x1d757c[_0x68c4('0x16')][_0x68c4('0x1b')]?_['map'](_0x1d757c[_0x68c4('0x16')][_0x68c4('0x1b')],function(_0x45f9be){return{'model':db[_0x45f9be[_0x68c4('0x1c')]],'as':_0x45f9be['as'],'attributes':_0x45f9be[_0x68c4('0x19')],'include':_0x45f9be[_0x68c4('0x1b')]?_[_0x68c4('0x1d')](_0x45f9be['include'],function(_0x2ff4a5){return{'model':db[_0x2ff4a5['model']],'as':_0x2ff4a5['as'],'attributes':_0x2ff4a5[_0x68c4('0x19')],'include':_0x2ff4a5[_0x68c4('0x1b')]?_[_0x68c4('0x1d')](_0x2ff4a5['include'],function(_0x1e14db){return{'model':db[_0x1e14db[_0x68c4('0x1c')]],'as':_0x1e14db['as'],'attributes':_0x1e14db[_0x68c4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x68c4('0x1e')](function(_0x3b62a3){logger[_0x68c4('0xb')](_0x68c4('0x13'),_0x1d757c);logger['debug'](_0x68c4('0x13'),_0x1d757c,JSON['stringify'](_0x3b62a3));_0x33c5c5(_0x3b62a3);})[_0x68c4('0x1f')](function(_0x1442ba){logger['error'](_0x68c4('0x13'),_0x1442ba[_0x68c4('0x11')],_0x1d757c);_0x3a6300(_0x38ac38['error'](0x1f4,_0x1442ba[_0x68c4('0x11')]));});});};exports[_0x68c4('0x20')]=function(_0xc3131c){var _0x1d2b40=this;return new Promise(function(_0x233cea,_0x586dec){return db[_0x68c4('0x14')][_0x68c4('0x21')](_0xc3131c[_0x68c4('0x22')],{'raw':_0xc3131c[_0x68c4('0x16')]?_0xc3131c[_0x68c4('0x16')][_0x68c4('0x17')]===undefined?!![]:![]:!![]})[_0x68c4('0x1e')](function(_0x1ad882){logger[_0x68c4('0xb')](_0x68c4('0x20'),_0xc3131c);logger[_0x68c4('0x23')](_0x68c4('0x20'),_0xc3131c,JSON['stringify'](_0x1ad882));_0x233cea(_0x1ad882);})[_0x68c4('0x1f')](function(_0x194217){logger[_0x68c4('0xf')](_0x68c4('0x20'),_0x194217[_0x68c4('0x11')],_0xc3131c);_0x586dec(_0x1d2b40['error'](0x1f4,_0x194217[_0x68c4('0x11')]));});});};exports['UpdateMemberReport']=function(_0x586e9c){var _0x4dcd5b=this;return new Promise(function(_0xb86553,_0x3cc88f){return db[_0x68c4('0x14')][_0x68c4('0x24')](_0x586e9c['body'],{'raw':_0x586e9c[_0x68c4('0x16')]?_0x586e9c[_0x68c4('0x16')][_0x68c4('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x586e9c['options']?_0x586e9c[_0x68c4('0x16')][_0x68c4('0x18')]||null:null,'attributes':_0x586e9c[_0x68c4('0x16')]?_0x586e9c[_0x68c4('0x16')][_0x68c4('0x19')]||null:null,'limit':_0x586e9c[_0x68c4('0x16')]?_0x586e9c[_0x68c4('0x16')][_0x68c4('0x1a')]||null:null})[_0x68c4('0x1e')](function(_0x54fdbe){logger['info']('UpdateMemberReport',_0x586e9c);logger[_0x68c4('0x23')](_0x68c4('0x25'),_0x586e9c,JSON[_0x68c4('0x26')](_0x54fdbe));_0xb86553(_0x54fdbe);})[_0x68c4('0x1f')](function(_0x260abf){logger[_0x68c4('0xf')](_0x68c4('0x25'),_0x260abf[_0x68c4('0x11')],_0x586e9c);_0x3cc88f(_0x4dcd5b[_0x68c4('0xf')](0x1f4,_0x260abf[_0x68c4('0x11')]));});});}; \ No newline at end of file +var _0x0845=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','model','map','then','stringify','catch','CreateMemberReport','create','body','UpdateMemberReport','update','lodash','bluebird','randomstring'];(function(_0x5e74de,_0x4effa9){var _0xa52957=function(_0x8889d5){while(--_0x8889d5){_0x5e74de['push'](_0x5e74de['shift']());}};_0xa52957(++_0x4effa9);}(_0x0845,0x125));var _0x5084=function(_0x5335e1,_0x23cad2){_0x5335e1=_0x5335e1-0x0;var _0x1fcd3c=_0x0845[_0x5335e1];return _0x1fcd3c;};'use strict';var _=require(_0x5084('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5084('0x1'));var rs=require(_0x5084('0x2'));var fs=require('fs');var Redis=require(_0x5084('0x3'));var db=require(_0x5084('0x4'))['db'];var utils=require(_0x5084('0x5'));var logger=require(_0x5084('0x6'))('rpc');var config=require(_0x5084('0x7'));var jayson=require(_0x5084('0x8'));var client=jayson[_0x5084('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f3d8f,_0x5a999b,_0x212120){return new BPromise(function(_0x439176,_0x14e571){return client['request'](_0x5f3d8f,_0x212120)['then'](function(_0xbbddf0){logger[_0x5084('0xa')](_0x5084('0xb'),_0x5a999b,'request\x20sent');logger[_0x5084('0xc')](_0x5084('0xd'),_0x5a999b,_0x5084('0xe'),JSON['stringify'](_0xbbddf0));if(_0xbbddf0['error']){if(_0xbbddf0[_0x5084('0xf')][_0x5084('0x10')]===0x1f4){logger[_0x5084('0xf')](_0x5084('0xb'),_0x5a999b,_0xbbddf0[_0x5084('0xf')][_0x5084('0x11')]);return _0x14e571(_0xbbddf0[_0x5084('0xf')][_0x5084('0x11')]);}logger['error'](_0x5084('0xb'),_0x5a999b,_0xbbddf0[_0x5084('0xf')][_0x5084('0x11')]);return _0x439176(_0xbbddf0['error'][_0x5084('0x11')]);}else{logger[_0x5084('0xa')](_0x5084('0xb'),_0x5a999b,_0x5084('0xe'));_0x439176(_0xbbddf0['result'][_0x5084('0x11')]);}})['catch'](function(_0x326ca0){logger[_0x5084('0xf')](_0x5084('0xb'),_0x5a999b,_0x326ca0);_0x14e571(_0x326ca0);});});}exports[_0x5084('0x12')]=function(_0x2072b8){var _0x425c46=this;return new Promise(function(_0x369fb5,_0x10a27c){return db[_0x5084('0x13')][_0x5084('0x14')]({'raw':_0x2072b8[_0x5084('0x15')]?_0x2072b8[_0x5084('0x15')][_0x5084('0x16')]===undefined?!![]:![]:!![],'where':_0x2072b8[_0x5084('0x15')]?_0x2072b8[_0x5084('0x15')][_0x5084('0x17')]||null:null,'attributes':_0x2072b8[_0x5084('0x15')]?_0x2072b8[_0x5084('0x15')][_0x5084('0x18')]||null:null,'limit':_0x2072b8[_0x5084('0x15')]?_0x2072b8['options'][_0x5084('0x19')]||null:null,'include':_0x2072b8[_0x5084('0x15')]?_0x2072b8[_0x5084('0x15')]['include']?_['map'](_0x2072b8['options'][_0x5084('0x1a')],function(_0x224c29){return{'model':db[_0x224c29['model']],'as':_0x224c29['as'],'attributes':_0x224c29[_0x5084('0x18')],'include':_0x224c29[_0x5084('0x1a')]?_['map'](_0x224c29[_0x5084('0x1a')],function(_0xfe242a){return{'model':db[_0xfe242a[_0x5084('0x1b')]],'as':_0xfe242a['as'],'attributes':_0xfe242a[_0x5084('0x18')],'include':_0xfe242a[_0x5084('0x1a')]?_[_0x5084('0x1c')](_0xfe242a['include'],function(_0x11b910){return{'model':db[_0x11b910[_0x5084('0x1b')]],'as':_0x11b910['as'],'attributes':_0x11b910['attributes']};}):[]};}):[]};}):[]:[]})[_0x5084('0x1d')](function(_0xe21c3c){logger['info']('GetMemberReport',_0x2072b8);logger['debug'](_0x5084('0x12'),_0x2072b8,JSON[_0x5084('0x1e')](_0xe21c3c));_0x369fb5(_0xe21c3c);})[_0x5084('0x1f')](function(_0x5760e2){logger[_0x5084('0xf')]('GetMemberReport',_0x5760e2[_0x5084('0x11')],_0x2072b8);_0x10a27c(_0x425c46[_0x5084('0xf')](0x1f4,_0x5760e2[_0x5084('0x11')]));});});};exports[_0x5084('0x20')]=function(_0x17268f){var _0x292a54=this;return new Promise(function(_0x3bd529,_0x40541f){return db[_0x5084('0x13')][_0x5084('0x21')](_0x17268f[_0x5084('0x22')],{'raw':_0x17268f[_0x5084('0x15')]?_0x17268f['options'][_0x5084('0x16')]===undefined?!![]:![]:!![]})[_0x5084('0x1d')](function(_0x4c2978){logger['info'](_0x5084('0x20'),_0x17268f);logger[_0x5084('0xc')](_0x5084('0x20'),_0x17268f,JSON['stringify'](_0x4c2978));_0x3bd529(_0x4c2978);})[_0x5084('0x1f')](function(_0x5da13e){logger[_0x5084('0xf')](_0x5084('0x20'),_0x5da13e['message'],_0x17268f);_0x40541f(_0x292a54[_0x5084('0xf')](0x1f4,_0x5da13e[_0x5084('0x11')]));});});};exports[_0x5084('0x23')]=function(_0x3f86bf){var _0x20df84=this;return new Promise(function(_0x5bcfbe,_0xae716c){return db[_0x5084('0x13')][_0x5084('0x24')](_0x3f86bf['body'],{'raw':_0x3f86bf[_0x5084('0x15')]?_0x3f86bf[_0x5084('0x15')][_0x5084('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f86bf[_0x5084('0x15')]?_0x3f86bf[_0x5084('0x15')]['where']||null:null,'attributes':_0x3f86bf[_0x5084('0x15')]?_0x3f86bf[_0x5084('0x15')][_0x5084('0x18')]||null:null,'limit':_0x3f86bf['options']?_0x3f86bf[_0x5084('0x15')][_0x5084('0x19')]||null:null})[_0x5084('0x1d')](function(_0x36fdd8){logger[_0x5084('0xa')]('UpdateMemberReport',_0x3f86bf);logger['debug'](_0x5084('0x23'),_0x3f86bf,JSON['stringify'](_0x36fdd8));_0x5bcfbe(_0x36fdd8);})['catch'](function(_0x463dc2){logger['error']('UpdateMemberReport',_0x463dc2[_0x5084('0x11')],_0x3f86bf);_0xae716c(_0x20df84[_0x5084('0xf')](0x1f4,_0x463dc2[_0x5084('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 7e7c48b..7328932 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 _0xb66b=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','index','exports'];(function(_0x5c5eac,_0x29510c){var _0x39c3dc=function(_0x2f8ee5){while(--_0x2f8ee5){_0x5c5eac['push'](_0x5c5eac['shift']());}};_0x39c3dc(++_0x29510c);}(_0xb66b,0x9a));var _0xbb66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb66b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xbb66('0x0'));var path=require(_0xbb66('0x1'));var timeout=require(_0xbb66('0x2'));var express=require(_0xbb66('0x3'));var router=express['Router']();var fs_extra=require(_0xbb66('0x4'));var auth=require(_0xbb66('0x5'));var interaction=require(_0xbb66('0x6'));var config=require(_0xbb66('0x7'));var controller=require(_0xbb66('0x8'));router['get']('/',controller[_0xbb66('0x9')]);module[_0xbb66('0xa')]=router; \ No newline at end of file +var _0xf69b=['../../config/environment','get','index','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xf69b,0x1e8));var _0xbf69=function(_0x32a259,_0x4e22b8){_0x32a259=_0x32a259-0x0;var _0x4afd47=_0xf69b[_0x32a259];return _0x4afd47;};'use strict';var multer=require('multer');var util=require(_0xbf69('0x0'));var path=require(_0xbf69('0x1'));var timeout=require(_0xbf69('0x2'));var express=require(_0xbf69('0x3'));var router=express[_0xbf69('0x4')]();var fs_extra=require(_0xbf69('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbf69('0x6'));var config=require(_0xbf69('0x7'));var controller=require('./migration.controller');router[_0xbf69('0x8')]('/',controller[_0xbf69('0x9')]);module[_0xbf69('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 57c740c..da156a1 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 _0x1256=['version','sequelize','STRING'];(function(_0x5568ed,_0x61f3be){var _0x406c98=function(_0x3cc9a7){while(--_0x3cc9a7){_0x5568ed['push'](_0x5568ed['shift']());}};_0x406c98(++_0x61f3be);}(_0x1256,0x82));var _0x6125=function(_0x291b8c,_0x6b7ed8){_0x291b8c=_0x291b8c-0x0;var _0x22ba34=_0x1256[_0x291b8c];return _0x22ba34;};'use strict';var Sequelize=require(_0x6125('0x0'));module['exports']={'version':{'type':Sequelize[_0x6125('0x1')],'unique':_0x6125('0x2')}}; \ No newline at end of file +var _0x3944=['exports','STRING','version'];(function(_0x4310e8,_0x3ba783){var _0x301445=function(_0x5907ee){while(--_0x5907ee){_0x4310e8['push'](_0x4310e8['shift']());}};_0x301445(++_0x3ba783);}(_0x3944,0xf0));var _0x4394=function(_0x5e5587,_0x441063){_0x5e5587=_0x5e5587-0x0;var _0x5794e3=_0x3944[_0x5e5587];return _0x5794e3;};'use strict';var Sequelize=require('sequelize');module[_0x4394('0x0')]={'version':{'type':Sequelize[_0x4394('0x1')],'unique':_0x4394('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index ff74e9d..e09d818 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 _0x31e9=['querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','index','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','Migration','findAll','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x449e7f,_0x1a97bc){var _0x5380c1=function(_0x54a218){while(--_0x54a218){_0x449e7f['push'](_0x449e7f['shift']());}};_0x5380c1(++_0x1a97bc);}(_0x31e9,0x78));var _0x931e=function(_0x1c1fb9,_0x580559){_0x1c1fb9=_0x1c1fb9-0x0;var _0x3efd80=_0x31e9[_0x1c1fb9];return _0x3efd80;};'use strict';var emlformat=require(_0x931e('0x0'));var rimraf=require(_0x931e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x931e('0x2'));var rp=require(_0x931e('0x3'));var moment=require(_0x931e('0x4'));var BPromise=require(_0x931e('0x5'));var Mustache=require(_0x931e('0x6'));var util=require(_0x931e('0x7'));var path=require('path');var sox=require(_0x931e('0x8'));var csv=require(_0x931e('0x9'));var ejs=require(_0x931e('0xa'));var fs=require('fs');var fs_extra=require(_0x931e('0xb'));var _=require(_0x931e('0xc'));var squel=require(_0x931e('0xd'));var crypto=require(_0x931e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x931e('0xf'));var toCsv=require(_0x931e('0x9'));var querystring=require(_0x931e('0x10'));var Papa=require('papaparse');var Redis=require(_0x931e('0x11'));var authService=require(_0x931e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x931e('0x13'));var hardwareService=require(_0x931e('0x14'));var logger=require(_0x931e('0x15'))('api');var utils=require(_0x931e('0x16'));var config=require(_0x931e('0x17'));var licenseUtil=require(_0x931e('0x18'));var db=require(_0x931e('0x19'))['db'];function respondWithStatusCode(_0x133858,_0x14e3db){_0x14e3db=_0x14e3db||0xcc;return function(_0x130ecf){if(_0x130ecf){return _0x133858[_0x931e('0x1a')](_0x14e3db);}return _0x133858['status'](_0x14e3db)['end']();};}function respondWithResult(_0x710a6d,_0x480e56){_0x480e56=_0x480e56||0xc8;return function(_0xe3748f){if(_0xe3748f){return _0x710a6d[_0x931e('0x1b')](_0x480e56)['json'](_0xe3748f);}};}function respondWithFilteredResult(_0x4ad87f,_0x34a757){return function(_0x12da4f){if(_0x12da4f){var _0x567e68=typeof _0x34a757[_0x931e('0x1c')]===_0x931e('0x1d')&&typeof _0x34a757[_0x931e('0x1e')]===_0x931e('0x1d');var _0x44b24f=_0x12da4f[_0x931e('0x1f')];var _0x4b3379=_0x567e68?0x0:_0x34a757[_0x931e('0x1c')];var _0x4b443f=_0x567e68?_0x12da4f[_0x931e('0x1f')]:_0x34a757[_0x931e('0x1c')]+_0x34a757[_0x931e('0x1e')];var _0x4b8e6e;if(_0x4b443f>=_0x44b24f){_0x4b443f=_0x44b24f;_0x4b8e6e=0xc8;}else{_0x4b8e6e=0xce;}_0x4ad87f[_0x931e('0x1b')](_0x4b8e6e);return _0x4ad87f[_0x931e('0x20')](_0x931e('0x21'),_0x4b3379+'-'+_0x4b443f+'/'+_0x44b24f)['json'](_0x12da4f);}return null;};}function patchUpdates(_0x185ee5){return function(_0x3169ba){try{jsonpatch[_0x931e('0x22')](_0x3169ba,_0x185ee5,!![]);}catch(_0x32903d){return BPromise[_0x931e('0x23')](_0x32903d);}return _0x3169ba['save']();};}function saveUpdates(_0x5e107f,_0x258f48){return function(_0x920c49){if(_0x920c49){return _0x920c49[_0x931e('0x24')](_0x5e107f)['then'](function(_0x3b59de){return _0x3b59de;});}return null;};}function removeEntity(_0x296459,_0xa53908){return function(_0x361c1f){if(_0x361c1f){return _0x361c1f[_0x931e('0x25')]()[_0x931e('0x26')](function(){_0x296459[_0x931e('0x1b')](0xcc)[_0x931e('0x27')]();});}};}function handleEntityNotFound(_0x3a8dec,_0x1de9a0){return function(_0x407190){if(!_0x407190){_0x3a8dec[_0x931e('0x1a')](0x194);}return _0x407190;};}function handleError(_0x2bf582,_0x40cf1d){_0x40cf1d=_0x40cf1d||0x1f4;return function(_0x33c42f){logger[_0x931e('0x28')](_0x33c42f[_0x931e('0x29')]);if(_0x33c42f['name']){delete _0x33c42f[_0x931e('0x2a')];}_0x2bf582[_0x931e('0x1b')](_0x40cf1d)['send'](_0x33c42f);};}exports[_0x931e('0x2b')]=function(_0xac90ca,_0x27fd96){var _0x187d82={},_0x22db21={},_0x520038={'count':0x0,'rows':[]};var _0x7a6aaa=_['map'](db['Migration']['rawAttributes'],function(_0x3999d9){return{'name':_0x3999d9[_0x931e('0x2c')],'type':_0x3999d9[_0x931e('0x2d')]['key']};});_0x22db21[_0x931e('0x2e')]=_[_0x931e('0x2f')](_0x7a6aaa,_0x931e('0x2a'));_0x22db21[_0x931e('0x30')]=_[_0x931e('0x31')](_0xac90ca[_0x931e('0x30')]);_0x22db21[_0x931e('0x32')]=_[_0x931e('0x33')](_0x22db21['model'],_0x22db21['query']);_0x187d82[_0x931e('0x34')]=_[_0x931e('0x33')](_0x22db21[_0x931e('0x2e')],qs[_0x931e('0x35')](_0xac90ca['query']['fields']));_0x187d82[_0x931e('0x34')]=_0x187d82[_0x931e('0x34')][_0x931e('0x36')]?_0x187d82[_0x931e('0x34')]:_0x22db21[_0x931e('0x2e')];if(!_0xac90ca[_0x931e('0x30')][_0x931e('0x37')](_0x931e('0x38'))){_0x187d82[_0x931e('0x1e')]=qs['limit'](_0xac90ca[_0x931e('0x30')][_0x931e('0x1e')]);_0x187d82['offset']=qs[_0x931e('0x1c')](_0xac90ca[_0x931e('0x30')][_0x931e('0x1c')]);}_0x187d82[_0x931e('0x39')]=qs[_0x931e('0x3a')](_0xac90ca[_0x931e('0x30')][_0x931e('0x3a')]);_0x187d82[_0x931e('0x3b')]=qs[_0x931e('0x32')](_[_0x931e('0x3c')](_0xac90ca[_0x931e('0x30')],_0x22db21[_0x931e('0x32')]),_0x7a6aaa);if(_0xac90ca[_0x931e('0x30')][_0x931e('0x3d')]){_0x187d82['where']=_[_0x931e('0x3e')](_0x187d82[_0x931e('0x3b')],{'$or':_['map'](_0x7a6aaa,function(_0x353c5b){if(_0x353c5b['type']!==_0x931e('0x3f')){var _0x2121cf={};_0x2121cf[_0x353c5b['name']]={'$like':'%'+_0xac90ca[_0x931e('0x30')]['filter']+'%'};return _0x2121cf;}})});}_0x187d82=_[_0x931e('0x3e')]({},_0x187d82,_0xac90ca[_0x931e('0x40')]);var _0x47f81d={'where':_0x187d82[_0x931e('0x3b')]};return db['Migration']['count'](_0x47f81d)['then'](function(_0x2dd707){_0x520038[_0x931e('0x1f')]=_0x2dd707;if(_0xac90ca[_0x931e('0x30')][_0x931e('0x41')]){_0x187d82['include']=[{'all':!![]}];}return db[_0x931e('0x42')][_0x931e('0x43')](_0x187d82);})[_0x931e('0x26')](function(_0x32d8aa){_0x520038['rows']=_0x32d8aa;return _0x520038;})[_0x931e('0x26')](respondWithFilteredResult(_0x27fd96,_0x187d82))['catch'](handleError(_0x27fd96,null));}; \ No newline at end of file +var _0xc96c=['../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','map','Migration','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','sort','where','pick','VIRTUAL','filter','merge','includeAll','rows','catch','eml-format','rimraf','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc96c,0xca));var _0xcc96=function(_0x1eb7d0,_0x298541){_0x1eb7d0=_0x1eb7d0-0x0;var _0x572da5=_0xc96c[_0x1eb7d0];return _0x572da5;};'use strict';var emlformat=require(_0xcc96('0x0'));var rimraf=require(_0xcc96('0x1'));var zipdir=require('zip-dir');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('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcc96('0x2'));var fs=require('fs');var fs_extra=require(_0xcc96('0x3'));var _=require(_0xcc96('0x4'));var squel=require(_0xcc96('0x5'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcc96('0x6'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcc96('0x7'));var Redis=require(_0xcc96('0x8'));var authService=require(_0xcc96('0x9'));var qs=require(_0xcc96('0xa'));var as=require(_0xcc96('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc96('0xc'))(_0xcc96('0xd'));var utils=require(_0xcc96('0xe'));var config=require(_0xcc96('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc96('0x10'))['db'];function respondWithStatusCode(_0xaea3b5,_0x5adc57){_0x5adc57=_0x5adc57||0xcc;return function(_0x5a3f18){if(_0x5a3f18){return _0xaea3b5['sendStatus'](_0x5adc57);}return _0xaea3b5['status'](_0x5adc57)[_0xcc96('0x11')]();};}function respondWithResult(_0x483d57,_0x2d0710){_0x2d0710=_0x2d0710||0xc8;return function(_0x35d940){if(_0x35d940){return _0x483d57[_0xcc96('0x12')](_0x2d0710)[_0xcc96('0x13')](_0x35d940);}};}function respondWithFilteredResult(_0x4391cd,_0x40b432){return function(_0x244cea){if(_0x244cea){var _0x2e10f8=typeof _0x40b432[_0xcc96('0x14')]===_0xcc96('0x15')&&typeof _0x40b432[_0xcc96('0x16')]===_0xcc96('0x15');var _0x42fb46=_0x244cea[_0xcc96('0x17')];var _0xac2fc7=_0x2e10f8?0x0:_0x40b432[_0xcc96('0x14')];var _0x1a8674=_0x2e10f8?_0x244cea['count']:_0x40b432['offset']+_0x40b432[_0xcc96('0x16')];var _0x21b85e;if(_0x1a8674>=_0x42fb46){_0x1a8674=_0x42fb46;_0x21b85e=0xc8;}else{_0x21b85e=0xce;}_0x4391cd['status'](_0x21b85e);return _0x4391cd[_0xcc96('0x18')](_0xcc96('0x19'),_0xac2fc7+'-'+_0x1a8674+'/'+_0x42fb46)[_0xcc96('0x13')](_0x244cea);}return null;};}function patchUpdates(_0x1735d9){return function(_0x17ca8f){try{jsonpatch[_0xcc96('0x1a')](_0x17ca8f,_0x1735d9,!![]);}catch(_0x4eaeac){return BPromise[_0xcc96('0x1b')](_0x4eaeac);}return _0x17ca8f[_0xcc96('0x1c')]();};}function saveUpdates(_0x5730f1,_0x1032cc){return function(_0x2eef5a){if(_0x2eef5a){return _0x2eef5a['update'](_0x5730f1)[_0xcc96('0x1d')](function(_0x570d06){return _0x570d06;});}return null;};}function removeEntity(_0x55db6b,_0xe9f2cd){return function(_0x4df46f){if(_0x4df46f){return _0x4df46f[_0xcc96('0x1e')]()[_0xcc96('0x1d')](function(){_0x55db6b[_0xcc96('0x12')](0xcc)[_0xcc96('0x11')]();});}};}function handleEntityNotFound(_0x864b3,_0x46ba9c){return function(_0xa91c12){if(!_0xa91c12){_0x864b3['sendStatus'](0x194);}return _0xa91c12;};}function handleError(_0x52f3cd,_0x4171a0){_0x4171a0=_0x4171a0||0x1f4;return function(_0x4c85aa){logger[_0xcc96('0x1f')](_0x4c85aa['stack']);if(_0x4c85aa[_0xcc96('0x20')]){delete _0x4c85aa[_0xcc96('0x20')];}_0x52f3cd[_0xcc96('0x12')](_0x4171a0)[_0xcc96('0x21')](_0x4c85aa);};}exports['index']=function(_0x381bab,_0x2d6424){var _0x2b5cf9={},_0x19cbf2={},_0x2c4155={'count':0x0,'rows':[]};var _0x4d4f91=_[_0xcc96('0x22')](db[_0xcc96('0x23')][_0xcc96('0x24')],function(_0x30dc64){return{'name':_0x30dc64[_0xcc96('0x25')],'type':_0x30dc64[_0xcc96('0x26')]['key']};});_0x19cbf2[_0xcc96('0x27')]=_['map'](_0x4d4f91,'name');_0x19cbf2['query']=_[_0xcc96('0x28')](_0x381bab[_0xcc96('0x29')]);_0x19cbf2[_0xcc96('0x2a')]=_[_0xcc96('0x2b')](_0x19cbf2['model'],_0x19cbf2[_0xcc96('0x29')]);_0x2b5cf9['attributes']=_['intersection'](_0x19cbf2['model'],qs[_0xcc96('0x2c')](_0x381bab[_0xcc96('0x29')][_0xcc96('0x2c')]));_0x2b5cf9['attributes']=_0x2b5cf9['attributes']['length']?_0x2b5cf9['attributes']:_0x19cbf2['model'];if(!_0x381bab[_0xcc96('0x29')]['hasOwnProperty']('nolimit')){_0x2b5cf9[_0xcc96('0x16')]=qs[_0xcc96('0x16')](_0x381bab['query'][_0xcc96('0x16')]);_0x2b5cf9[_0xcc96('0x14')]=qs[_0xcc96('0x14')](_0x381bab[_0xcc96('0x29')]['offset']);}_0x2b5cf9['order']=qs[_0xcc96('0x2d')](_0x381bab[_0xcc96('0x29')][_0xcc96('0x2d')]);_0x2b5cf9[_0xcc96('0x2e')]=qs['filters'](_[_0xcc96('0x2f')](_0x381bab[_0xcc96('0x29')],_0x19cbf2[_0xcc96('0x2a')]),_0x4d4f91);if(_0x381bab[_0xcc96('0x29')]['filter']){_0x2b5cf9['where']=_['merge'](_0x2b5cf9[_0xcc96('0x2e')],{'$or':_[_0xcc96('0x22')](_0x4d4f91,function(_0x12b192){if(_0x12b192[_0xcc96('0x26')]!==_0xcc96('0x30')){var _0x27c02b={};_0x27c02b[_0x12b192[_0xcc96('0x20')]]={'$like':'%'+_0x381bab[_0xcc96('0x29')][_0xcc96('0x31')]+'%'};return _0x27c02b;}})});}_0x2b5cf9=_[_0xcc96('0x32')]({},_0x2b5cf9,_0x381bab['options']);var _0x5be29a={'where':_0x2b5cf9[_0xcc96('0x2e')]};return db[_0xcc96('0x23')][_0xcc96('0x17')](_0x5be29a)[_0xcc96('0x1d')](function(_0x4debae){_0x2c4155[_0xcc96('0x17')]=_0x4debae;if(_0x381bab[_0xcc96('0x29')][_0xcc96('0x33')]){_0x2b5cf9['include']=[{'all':!![]}];}return db['Migration']['findAll'](_0x2b5cf9);})[_0xcc96('0x1d')](function(_0x377c1f){_0x2c4155[_0xcc96('0x34')]=_0x377c1f;return _0x2c4155;})[_0xcc96('0x1d')](respondWithFilteredResult(_0x2d6424,_0x2b5cf9))[_0xcc96('0x35')](handleError(_0x2d6424,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index bdd7bf7..4e3ab5b 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 _0xecea=['api','moment','bluebird','path','../../config/environment','define','Migration','migrations','lodash','util'];(function(_0x19da56,_0x4702b3){var _0x488ede=function(_0x11f071){while(--_0x11f071){_0x19da56['push'](_0x19da56['shift']());}};_0x488ede(++_0x4702b3);}(_0xecea,0xa8));var _0xaece=function(_0x5e02b2,_0x4ff198){_0x5e02b2=_0x5e02b2-0x0;var _0x286dda=_0xecea[_0x5e02b2];return _0x286dda;};'use strict';var _=require(_0xaece('0x0'));var util=require(_0xaece('0x1'));var logger=require('../../config/logger')(_0xaece('0x2'));var moment=require(_0xaece('0x3'));var BPromise=require(_0xaece('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaece('0x5'));var rimraf=require('rimraf');var config=require(_0xaece('0x6'));var attributes=require('./migration.attributes');module['exports']=function(_0x330fb8,_0x35ab25){return _0x330fb8[_0xaece('0x7')](_0xaece('0x8'),attributes,{'tableName':_0xaece('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e2c=['Migration','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define'];(function(_0x9d9107,_0x5d81c7){var _0x5ba330=function(_0x2f778e){while(--_0x2f778e){_0x9d9107['push'](_0x9d9107['shift']());}};_0x5ba330(++_0x5d81c7);}(_0x3e2c,0xd9));var _0xc3e2=function(_0x19d3c0,_0x560544){_0x19d3c0=_0x19d3c0-0x0;var _0x56e32a=_0x3e2c[_0x19d3c0];return _0x56e32a;};'use strict';var _=require(_0xc3e2('0x0'));var util=require(_0xc3e2('0x1'));var logger=require(_0xc3e2('0x2'))(_0xc3e2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc3e2('0x4'));var fs=require('fs');var path=require(_0xc3e2('0x5'));var rimraf=require(_0xc3e2('0x6'));var config=require(_0xc3e2('0x7'));var attributes=require(_0xc3e2('0x8'));module[_0xc3e2('0x9')]=function(_0x556d2c,_0x331d44){return _0x556d2c[_0xc3e2('0xa')](_0xc3e2('0xb'),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 4b8c33a..9e495e8 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 _0x26bc=['Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x1b891b,_0x35e413){var _0x50f53d=function(_0x57bbcb){while(--_0x57bbcb){_0x1b891b['push'](_0x1b891b['shift']());}};_0x50f53d(++_0x35e413);}(_0x26bc,0x162));var _0xc26b=function(_0x58d757,_0x40cbfc){_0x58d757=_0x58d757-0x0;var _0xba2697=_0x26bc[_0x58d757];return _0xba2697;};'use strict';var _=require(_0xc26b('0x0'));var util=require(_0xc26b('0x1'));var moment=require(_0xc26b('0x2'));var BPromise=require(_0xc26b('0x3'));var rs=require(_0xc26b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc26b('0x5'))['db'];var utils=require(_0xc26b('0x6'));var logger=require(_0xc26b('0x7'))('rpc');var config=require(_0xc26b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc26b('0x9')][_0xc26b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13d90e,_0x5c2f6f,_0x11c6f5){return new BPromise(function(_0x453491,_0x465c89){return client[_0xc26b('0xb')](_0x13d90e,_0x11c6f5)[_0xc26b('0xc')](function(_0x1fb2b5){logger[_0xc26b('0xd')](_0xc26b('0xe'),_0x5c2f6f,_0xc26b('0xf'));logger[_0xc26b('0x10')]('Migration,\x20%s,\x20%s,\x20%s',_0x5c2f6f,_0xc26b('0xf'),JSON[_0xc26b('0x11')](_0x1fb2b5));if(_0x1fb2b5[_0xc26b('0x12')]){if(_0x1fb2b5[_0xc26b('0x12')][_0xc26b('0x13')]===0x1f4){logger[_0xc26b('0x12')]('Migration,\x20%s,\x20%s',_0x5c2f6f,_0x1fb2b5[_0xc26b('0x12')]['message']);return _0x465c89(_0x1fb2b5['error'][_0xc26b('0x14')]);}logger[_0xc26b('0x12')](_0xc26b('0xe'),_0x5c2f6f,_0x1fb2b5[_0xc26b('0x12')]['message']);return _0x453491(_0x1fb2b5[_0xc26b('0x12')][_0xc26b('0x14')]);}else{logger[_0xc26b('0xd')](_0xc26b('0xe'),_0x5c2f6f,_0xc26b('0xf'));_0x453491(_0x1fb2b5[_0xc26b('0x15')]['message']);}})[_0xc26b('0x16')](function(_0x2713f6){logger['error'](_0xc26b('0xe'),_0x5c2f6f,_0x2713f6);_0x465c89(_0x2713f6);});});} \ No newline at end of file +var _0x1b73=['debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x1b73,0x1d5));var _0x31b7=function(_0x5ac81c,_0xb5a2e5){_0x5ac81c=_0x5ac81c-0x0;var _0x4f88be=_0x1b73[_0x5ac81c];return _0x4f88be;};'use strict';var _=require('lodash');var util=require(_0x31b7('0x0'));var moment=require(_0x31b7('0x1'));var BPromise=require(_0x31b7('0x2'));var rs=require(_0x31b7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31b7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x31b7('0x5'))(_0x31b7('0x6'));var config=require('../../config/environment');var jayson=require(_0x31b7('0x7'));var client=jayson[_0x31b7('0x8')][_0x31b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x502838,_0x445dbe,_0x1a730f){return new BPromise(function(_0x86ef8e,_0x19b92a){return client[_0x31b7('0xa')](_0x502838,_0x1a730f)[_0x31b7('0xb')](function(_0x3d2b41){logger['info'](_0x31b7('0xc'),_0x445dbe,_0x31b7('0xd'));logger[_0x31b7('0xe')](_0x31b7('0xf'),_0x445dbe,_0x31b7('0xd'),JSON[_0x31b7('0x10')](_0x3d2b41));if(_0x3d2b41[_0x31b7('0x11')]){if(_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x12')]===0x1f4){logger[_0x31b7('0x11')]('Migration,\x20%s,\x20%s',_0x445dbe,_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x13')]);return _0x19b92a(_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x13')]);}logger[_0x31b7('0x11')](_0x31b7('0xc'),_0x445dbe,_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x13')]);return _0x86ef8e(_0x3d2b41[_0x31b7('0x11')]['message']);}else{logger[_0x31b7('0x14')]('Migration,\x20%s,\x20%s',_0x445dbe,_0x31b7('0xd'));_0x86ef8e(_0x3d2b41[_0x31b7('0x15')]['message']);}})[_0x31b7('0x16')](function(_0x3c71ae){logger[_0x31b7('0x11')](_0x31b7('0xc'),_0x445dbe,_0x3c71ae);_0x19b92a(_0x3c71ae);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index e60d48b..3fc079a 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 _0x896e=['show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id','isAuthenticated'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x896e,0x1e9));var _0xe896=function(_0x4588fb,_0x4e2469){_0x4588fb=_0x4588fb-0x0;var _0x38a755=_0x896e[_0x4588fb];return _0x38a755;};'use strict';var multer=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var path=require(_0xe896('0x2'));var timeout=require(_0xe896('0x3'));var express=require(_0xe896('0x4'));var router=express[_0xe896('0x5')]();var fs_extra=require(_0xe896('0x6'));var auth=require(_0xe896('0x7'));var interaction=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var controller=require(_0xe896('0xa'));router[_0xe896('0xb')]('/',auth['isAuthenticated'](),controller[_0xe896('0xc')]);router[_0xe896('0xb')](_0xe896('0xd'),auth[_0xe896('0xe')](),controller[_0xe896('0xf')]);router['post']('/',auth[_0xe896('0xe')](),controller[_0xe896('0x10')]);router[_0xe896('0x11')]('/:id',auth[_0xe896('0xe')](),controller['update']);router[_0xe896('0x12')]('/:id',auth[_0xe896('0xe')](),controller[_0xe896('0x13')]);module[_0xe896('0x14')]=router; \ No newline at end of file +var _0x9e54=['../../components/auth/service','../../config/environment','./network.controller','isAuthenticated','/:id','show','post','update','delete','destroy','multer','util','Router','fs-extra'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x9e54,0x88));var _0x49e5=function(_0x397f37,_0x3cf86d){_0x397f37=_0x397f37-0x0;var _0x31cae6=_0x9e54[_0x397f37];return _0x31cae6;};'use strict';var multer=require(_0x49e5('0x0'));var util=require(_0x49e5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x49e5('0x2')]();var fs_extra=require(_0x49e5('0x3'));var auth=require(_0x49e5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x49e5('0x5'));var controller=require(_0x49e5('0x6'));router['get']('/',auth[_0x49e5('0x7')](),controller['index']);router['get'](_0x49e5('0x8'),auth['isAuthenticated'](),controller[_0x49e5('0x9')]);router[_0x49e5('0xa')]('/',auth[_0x49e5('0x7')](),controller['create']);router['put'](_0x49e5('0x8'),auth['isAuthenticated'](),controller[_0x49e5('0xb')]);router[_0x49e5('0xc')](_0x49e5('0x8'),auth[_0x49e5('0x7')](),controller[_0x49e5('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 119d7ff..2f61e9a 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 _0x03b6=['turn','STRING','exports','ENUM','localnet'];(function(_0x4bc428,_0xf56dd9){var _0x3ca37f=function(_0x39db20){while(--_0x39db20){_0x4bc428['push'](_0x4bc428['shift']());}};_0x3ca37f(++_0xf56dd9);}(_0x03b6,0x19c));var _0x603b=function(_0xf1155d,_0xa1dd35){_0xf1155d=_0xf1155d-0x0;var _0x519468=_0x03b6[_0xf1155d];return _0x519468;};'use strict';var Sequelize=require('sequelize');module[_0x603b('0x0')]={'type':{'type':Sequelize[_0x603b('0x1')](_0x603b('0x2'),'externip','stun',_0x603b('0x3'))},'value':{'type':Sequelize[_0x603b('0x4')]},'username':{'type':Sequelize[_0x603b('0x4')]},'password':{'type':Sequelize[_0x603b('0x4')]}}; \ No newline at end of file +var _0x2ae9=['sequelize','ENUM','localnet','externip','stun','turn','STRING'];(function(_0x201b94,_0x5cada6){var _0x49da82=function(_0x503bea){while(--_0x503bea){_0x201b94['push'](_0x201b94['shift']());}};_0x49da82(++_0x5cada6);}(_0x2ae9,0x70));var _0x92ae=function(_0x1f9503,_0x8e450b){_0x1f9503=_0x1f9503-0x0;var _0xaab94f=_0x2ae9[_0x1f9503];return _0xaab94f;};'use strict';var Sequelize=require(_0x92ae('0x0'));module['exports']={'type':{'type':Sequelize[_0x92ae('0x1')](_0x92ae('0x2'),_0x92ae('0x3'),_0x92ae('0x4'),_0x92ae('0x5'))},'value':{'type':Sequelize[_0x92ae('0x6')]},'username':{'type':Sequelize[_0x92ae('0x6')]},'password':{'type':Sequelize[_0x92ae('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 40b3f71..a00253e 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 _0x3355=['request','then','info','Network,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','rows','find','create','body','toUpperCase','STUN','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','readFileSync','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','root','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','params','findAll','format','chan_sip.so','util','path','ejs','lodash','../../config/logger','api','../../config/environment','client'];(function(_0x296dd7,_0x143c78){var _0x2858f6=function(_0x555467){while(--_0x555467){_0x296dd7['push'](_0x296dd7['shift']());}};_0x2858f6(++_0x143c78);}(_0x3355,0x150));var _0x5335=function(_0x2742bc,_0x2f84da){_0x2742bc=_0x2742bc-0x0;var _0x22c91a=_0x3355[_0x2742bc];return _0x22c91a;};'use strict';var util=require(_0x5335('0x0'));var path=require(_0x5335('0x1'));var ejs=require(_0x5335('0x2'));var fs=require('fs');var _=require(_0x5335('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x5335('0x4'))(_0x5335('0x5'));var config=require(_0x5335('0x6'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x5335('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55d90b,_0x1191f4,_0x15c403,_0x24d8eb){return new Promise(function(_0x2a9219,_0x352134){var _0x251bb0=_0x24d8eb||client;return _0x251bb0[_0x5335('0x8')](_0x55d90b,_0x15c403)[_0x5335('0x9')](function(_0xe04d17){logger[_0x5335('0xa')](_0x5335('0xb'),_0x1191f4,'request\x20sent');logger[_0x5335('0xc')]('Network,\x20%s,\x20%s,\x20%s',_0x1191f4,_0x5335('0xd'),JSON[_0x5335('0xe')](_0xe04d17));if(_0xe04d17[_0x5335('0xf')]){if(_0xe04d17['error'][_0x5335('0x10')]===0x1f4){logger[_0x5335('0xf')](_0x5335('0xb'),_0x1191f4,_0xe04d17[_0x5335('0xf')][_0x5335('0x11')]);return _0x352134(_0xe04d17[_0x5335('0xf')][_0x5335('0x11')]);}logger[_0x5335('0xf')](_0x5335('0xb'),_0x1191f4,_0xe04d17[_0x5335('0xf')][_0x5335('0x11')]);return _0x2a9219(_0xe04d17[_0x5335('0xf')][_0x5335('0x11')]);}else{logger[_0x5335('0xa')](_0x5335('0xb'),_0x1191f4,_0x5335('0xd'));_0x2a9219(_0xe04d17[_0x5335('0x12')][_0x5335('0x11')]);}})[_0x5335('0x13')](function(_0x4e312f){logger['error'](_0x5335('0xb'),_0x1191f4,_0x4e312f);_0x352134(_0x4e312f);});});}function respondWithResult(_0x1bac62,_0x4dfca6){_0x4dfca6=_0x4dfca6||0xc8;return function(_0x154ce8){if(_0x154ce8){return _0x1bac62[_0x5335('0x14')](_0x4dfca6)['json'](_0x154ce8);}};}function respondWithFilteredResult(_0xf4780,_0xdd3084){return function(_0x17e51e){if(_0x17e51e){var _0x5dece6=typeof _0xdd3084[_0x5335('0x15')]===_0x5335('0x16')&&typeof _0xdd3084[_0x5335('0x17')]===_0x5335('0x16');var _0x5803a1=_0x17e51e[_0x5335('0x18')];var _0x32906b=_0x5dece6?0x0:_0xdd3084[_0x5335('0x15')];var _0x3ace00=_0x5dece6?_0x17e51e[_0x5335('0x18')]:_0xdd3084[_0x5335('0x15')]+_0xdd3084['limit'];var _0x399473;if(_0x3ace00>=_0x5803a1){_0x3ace00=_0x5803a1;_0x399473=0xc8;}else{_0x399473=0xce;}_0xf4780[_0x5335('0x14')](_0x399473);return _0xf4780[_0x5335('0x19')](_0x5335('0x1a'),_0x32906b+'-'+_0x3ace00+'/'+_0x5803a1)[_0x5335('0x1b')](_0x17e51e);}return null;};}function saveUpdates(_0x99f682){return function(_0xb2c206){if(_0xb2c206){return _0xb2c206[_0x5335('0x1c')](_0x99f682)[_0x5335('0x9')](function(_0x424b39){return _0x424b39;});}return null;};}function removeEntity(_0x16ce9e){return function(_0x22901b){if(_0x22901b){return _0x22901b[_0x5335('0x1d')]()[_0x5335('0x9')](function(){_0x16ce9e[_0x5335('0x14')](0xcc)[_0x5335('0x1e')]();});}};}function handleEntityNotFound(_0x38c60b){return function(_0x565d51){if(!_0x565d51){_0x38c60b[_0x5335('0x1f')](0x194);}return _0x565d51;};}function handleError(_0x22ae2f,_0x3e5084){_0x3e5084=_0x3e5084||0x1f4;return function(_0x481f5f){logger[_0x5335('0xf')](_0x481f5f[_0x5335('0x20')]);if(_0x481f5f[_0x5335('0x21')]){delete _0x481f5f[_0x5335('0x21')];}_0x22ae2f[_0x5335('0x14')](_0x3e5084)[_0x5335('0x22')](_0x481f5f);};}exports[_0x5335('0x23')]=function(_0x4cc996,_0x1b44b0){var _0x195533={},_0x4f039d={},_0x2d0bb9={'count':0x0,'rows':[]};var _0x53e5d5=_[_0x5335('0x24')](db[_0x5335('0x25')][_0x5335('0x26')],function(_0x4756f5){return{'name':_0x4756f5[_0x5335('0x27')],'type':_0x4756f5[_0x5335('0x28')][_0x5335('0x29')]};});_0x4f039d[_0x5335('0x2a')]=_[_0x5335('0x24')](_0x53e5d5,_0x5335('0x21'));_0x4f039d['query']=_[_0x5335('0x2b')](_0x4cc996[_0x5335('0x2c')]);_0x4f039d[_0x5335('0x2d')]=_[_0x5335('0x2e')](_0x4f039d[_0x5335('0x2a')],_0x4f039d['query']);_0x195533['attributes']=_[_0x5335('0x2e')](_0x4f039d[_0x5335('0x2a')],qs['fields'](_0x4cc996[_0x5335('0x2c')][_0x5335('0x2f')]));_0x195533['attributes']=_0x195533[_0x5335('0x30')]['length']?_0x195533['attributes']:_0x4f039d[_0x5335('0x2a')];if(!_0x4cc996[_0x5335('0x2c')][_0x5335('0x31')](_0x5335('0x32'))){_0x195533['limit']=qs[_0x5335('0x17')](_0x4cc996[_0x5335('0x2c')][_0x5335('0x17')]);_0x195533['offset']=qs[_0x5335('0x15')](_0x4cc996[_0x5335('0x2c')][_0x5335('0x15')]);}_0x195533[_0x5335('0x33')]=qs[_0x5335('0x34')](_0x4cc996[_0x5335('0x2c')]['sort']);_0x195533[_0x5335('0x35')]=qs[_0x5335('0x2d')](_[_0x5335('0x36')](_0x4cc996[_0x5335('0x2c')],_0x4f039d[_0x5335('0x2d')]),_0x53e5d5);if(_0x4cc996[_0x5335('0x2c')]['filter']){_0x195533['where']=_['merge'](_0x195533['where'],{'$or':_[_0x5335('0x24')](_0x53e5d5,function(_0x4d4f35){if(_0x4d4f35[_0x5335('0x28')]!==_0x5335('0x37')){var _0x2c128c={};_0x2c128c[_0x4d4f35[_0x5335('0x21')]]={'$like':'%'+_0x4cc996[_0x5335('0x2c')]['filter']+'%'};return _0x2c128c;}})});}_0x195533=_[_0x5335('0x38')]({},_0x195533,_0x4cc996[_0x5335('0x39')]);var _0x53ec6b={'where':_0x195533['where']};return db[_0x5335('0x25')][_0x5335('0x18')](_0x53ec6b)[_0x5335('0x9')](function(_0xc7e526){_0x2d0bb9[_0x5335('0x18')]=_0xc7e526;if(_0x4cc996[_0x5335('0x2c')][_0x5335('0x3a')]){_0x195533[_0x5335('0x3b')]=[{'all':!![]}];}return db[_0x5335('0x25')]['findAll'](_0x195533);})[_0x5335('0x9')](function(_0x26ecf6){_0x2d0bb9[_0x5335('0x3c')]=_0x26ecf6;return _0x2d0bb9;})[_0x5335('0x9')](respondWithFilteredResult(_0x1b44b0,_0x195533))[_0x5335('0x13')](handleError(_0x1b44b0,null));};exports['show']=function(_0x58b787,_0x5a2ef5){var _0x58c5b7={'raw':!![],'where':{'id':_0x58b787['params']['id']}},_0x696e65={};_0x696e65[_0x5335('0x2a')]=_['keys'](db[_0x5335('0x25')]['rawAttributes']);_0x696e65[_0x5335('0x2c')]=_[_0x5335('0x2b')](_0x58b787[_0x5335('0x2c')]);_0x696e65[_0x5335('0x2d')]=_[_0x5335('0x2e')](_0x696e65[_0x5335('0x2a')],_0x696e65[_0x5335('0x2c')]);_0x58c5b7[_0x5335('0x30')]=_[_0x5335('0x2e')](_0x696e65[_0x5335('0x2a')],qs[_0x5335('0x2f')](_0x58b787['query'][_0x5335('0x2f')]));_0x58c5b7['attributes']=_0x58c5b7[_0x5335('0x30')]['length']?_0x58c5b7['attributes']:_0x696e65['model'];if(_0x58b787[_0x5335('0x2c')][_0x5335('0x3a')]){_0x58c5b7[_0x5335('0x3b')]=[{'all':!![]}];}_0x58c5b7=_[_0x5335('0x38')]({},_0x58c5b7,_0x58b787['options']);return db[_0x5335('0x25')][_0x5335('0x3d')](_0x58c5b7)[_0x5335('0x9')](handleEntityNotFound(_0x5a2ef5,null))[_0x5335('0x9')](respondWithResult(_0x5a2ef5,null))[_0x5335('0x13')](handleError(_0x5a2ef5,null));};exports[_0x5335('0x3e')]=function(_0x1e3e1b,_0x4096f5){var _0x193ce7;return db[_0x5335('0x25')][_0x5335('0x3e')](_0x1e3e1b[_0x5335('0x3f')],{'raw':!![]})[_0x5335('0x9')](function(_0xe3cdd7){_0x193ce7=_0xe3cdd7;return db[_0x5335('0x25')]['findAll']({'where':{'type':_0x1e3e1b['body'][_0x5335('0x28')]},'raw':!![]});})[_0x5335('0x9')](function(_0x45e1ef){if(_0x193ce7[_0x5335('0x28')][_0x5335('0x40')]()==_0x5335('0x41')){var _0x5d3eee=fs['readFileSync'](path[_0x5335('0x42')](config['root'],_0x5335('0x43')),_0x5335('0x44'));var _0x35133c=ejs[_0x5335('0x45')](_0x5d3eee,{'networks':_0x45e1ef||[]});fs[_0x5335('0x46')](_0x5335('0x47'),_0x35133c);return respondWithRpcPromise(_0x5335('0x48'),_0x5335('0x3e'),{'module':'res_stun_monitor.so'});}else if(_0x193ce7[_0x5335('0x28')][_0x5335('0x40')]()==_0x5335('0x49')){var _0x25de0d=fs[_0x5335('0x4a')](path['join'](config['root'],_0x5335('0x4b')),_0x5335('0x44'));var _0x20145c=ejs[_0x5335('0x45')](_0x25de0d,{'networks':_0x45e1ef||[]});fs[_0x5335('0x46')](_0x5335('0x4c'),_0x20145c);return respondWithRpcPromise(_0x5335('0x48'),'create',{'module':_0x5335('0x4d')});}else{var _0x2c6cff=fs[_0x5335('0x4a')](path[_0x5335('0x42')](config[_0x5335('0x4e')],_0x5335('0x4f')),_0x5335('0x44'));var _0x23d3e1=ejs[_0x5335('0x45')](_0x2c6cff,{'networks':_0x45e1ef||[]});fs[_0x5335('0x46')](util['format'](_0x5335('0x50'),_0x1e3e1b[_0x5335('0x3f')][_0x5335('0x28')][_0x5335('0x51')]()),_0x23d3e1);return respondWithRpcPromise(_0x5335('0x48'),'create',{'module':'chan_sip.so'});}})['then'](function(){return _0x193ce7;})[_0x5335('0x9')](respondWithResult(_0x4096f5,0xc9))[_0x5335('0x13')](handleError(_0x4096f5,null));};exports[_0x5335('0x1c')]=function(_0x150514,_0x27ff9e){var _0x44fde5;return db[_0x5335('0x25')][_0x5335('0x3d')]({'where':{'id':_0x150514[_0x5335('0x52')]['id']}})[_0x5335('0x9')](handleEntityNotFound(_0x27ff9e,null))[_0x5335('0x9')](saveUpdates(_0x150514[_0x5335('0x3f')],null))[_0x5335('0x9')](function(_0x326bc1){if(_0x326bc1){_0x44fde5=_0x326bc1;return db[_0x5335('0x25')][_0x5335('0x53')]({'where':{'type':_0x44fde5[_0x5335('0x28')]},'raw':!![]});}return null;})[_0x5335('0x9')](function(_0x1cbb74){if(_0x44fde5[_0x5335('0x28')][_0x5335('0x40')]()=='STUN'){var _0xe70b97=fs[_0x5335('0x4a')](path['join'](config['root'],_0x5335('0x43')),_0x5335('0x44'));var _0x48696c=ejs[_0x5335('0x45')](_0xe70b97,{'networks':_0x1cbb74||[]});fs[_0x5335('0x46')](_0x5335('0x47'),_0x48696c);return respondWithRpcPromise(_0x5335('0x48'),_0x5335('0x1c'),{'module':'res_stun_monitor.so'});}else if(_0x44fde5[_0x5335('0x28')][_0x5335('0x40')]()==_0x5335('0x49')){var _0x6861ad=fs['readFileSync'](path['join'](config['root'],_0x5335('0x4b')),_0x5335('0x44'));var _0x478eae=ejs['render'](_0x6861ad,{'networks':_0x1cbb74||[]});fs[_0x5335('0x46')]('/etc/asterisk/turn_xcally.conf',_0x478eae);return respondWithRpcPromise(_0x5335('0x48'),_0x5335('0x1c'),{'module':_0x5335('0x4d')});}else{var _0x3cf72e=fs['readFileSync'](path[_0x5335('0x42')](config[_0x5335('0x4e')],_0x5335('0x4f')),'utf8');var _0x17b589=ejs[_0x5335('0x45')](_0x3cf72e,{'networks':_0x1cbb74||[]});fs['writeFileSync'](util[_0x5335('0x54')](_0x5335('0x50'),_0x150514['body'][_0x5335('0x28')]['toLowerCase']()),_0x17b589);return respondWithRpcPromise(_0x5335('0x48'),_0x5335('0x1c'),{'module':_0x5335('0x55')});}})[_0x5335('0x9')](function(_0x32ebab){if(_0x32ebab){return _0x44fde5;}return null;})[_0x5335('0x9')](respondWithResult(_0x27ff9e,null))['catch'](handleError(_0x27ff9e,null));};exports['destroy']=function(_0x51da2d,_0x566fa2){var _0x1aa2c2;return db[_0x5335('0x25')]['find']({'where':{'id':_0x51da2d['params']['id']}})[_0x5335('0x9')](function(_0x1edded){_0x1aa2c2=_0x1edded;return _0x1edded;})[_0x5335('0x9')](handleEntityNotFound(_0x566fa2,null))[_0x5335('0x9')](removeEntity(_0x566fa2,null))['then'](function(){if(_0x1aa2c2){return db['Network']['findAll']({'where':{'type':_0x1aa2c2[_0x5335('0x28')]},'raw':!![]});}})[_0x5335('0x9')](function(_0x5a2d09){if(_0x1aa2c2[_0x5335('0x28')][_0x5335('0x40')]()=='STUN'){var _0x4f7ef7=fs[_0x5335('0x4a')](path['join'](config[_0x5335('0x4e')],'server/files/templates/stun_multiple.ejs'),_0x5335('0x44'));var _0x4e99bd=ejs[_0x5335('0x45')](_0x4f7ef7,{'networks':_0x5a2d09||[]});fs['writeFileSync'](_0x5335('0x47'),_0x4e99bd);return respondWithRpcPromise(_0x5335('0x48'),'destroy',{'module':_0x5335('0x4d')});}else if(_0x1aa2c2['type'][_0x5335('0x40')]()=='TURN'){var _0x32091f=fs[_0x5335('0x4a')](path[_0x5335('0x42')](config[_0x5335('0x4e')],_0x5335('0x4b')),_0x5335('0x44'));var _0x171d17=ejs[_0x5335('0x45')](_0x32091f,{'networks':_0x5a2d09||[]});fs[_0x5335('0x46')](_0x5335('0x4c'),_0x171d17);return respondWithRpcPromise(_0x5335('0x48'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x5abbb9=fs[_0x5335('0x4a')](path[_0x5335('0x42')](config[_0x5335('0x4e')],_0x5335('0x4f')),_0x5335('0x44'));var _0x39fa79=ejs[_0x5335('0x45')](_0x5abbb9,{'networks':_0x5a2d09||[]});fs['writeFileSync'](util['format'](_0x5335('0x50'),_0x1aa2c2['type'][_0x5335('0x51')]()),_0x39fa79);return respondWithRpcPromise(_0x5335('0x48'),_0x5335('0x1d'),{'module':_0x5335('0x55')});}})[_0x5335('0x13')](handleError(_0x566fa2,null));}; \ No newline at end of file +var _0x86ef=['includeAll','create','body','toUpperCase','readFileSync','join','root','utf8','writeFileSync','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','format','find','STUN','server/files/templates/stun_multiple.ejs','/etc/asterisk/stun_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','destroy','chan_sip.so','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','jayson/promise','http','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','status','json','offset','undefined','count','limit','Content-Range','update','sendStatus','name','send','index','map','Network','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','include','findAll','catch','params'];(function(_0x56a127,_0x53cf2d){var _0x5e671a=function(_0x2f9ada){while(--_0x2f9ada){_0x56a127['push'](_0x56a127['shift']());}};_0x5e671a(++_0x53cf2d);}(_0x86ef,0x112));var _0xf86e=function(_0x301903,_0x106ae7){_0x301903=_0x301903-0x0;var _0x855e93=_0x86ef[_0x301903];return _0x855e93;};'use strict';var util=require(_0xf86e('0x0'));var path=require(_0xf86e('0x1'));var ejs=require(_0xf86e('0x2'));var fs=require('fs');var _=require(_0xf86e('0x3'));var qs=require(_0xf86e('0x4'));var logger=require(_0xf86e('0x5'))(_0xf86e('0x6'));var config=require(_0xf86e('0x7'));var db=require('../../mysqldb')['db'];var jayson=require(_0xf86e('0x8'));var client=jayson['client'][_0xf86e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d1a26,_0x1afd2f,_0x3b6dee,_0x31c004){return new Promise(function(_0x3c66a3,_0x1af6c3){var _0x21d98c=_0x31c004||client;return _0x21d98c['request'](_0x2d1a26,_0x3b6dee)[_0xf86e('0xa')](function(_0x503c2a){logger[_0xf86e('0xb')](_0xf86e('0xc'),_0x1afd2f,'request\x20sent');logger[_0xf86e('0xd')](_0xf86e('0xe'),_0x1afd2f,_0xf86e('0xf'),JSON[_0xf86e('0x10')](_0x503c2a));if(_0x503c2a[_0xf86e('0x11')]){if(_0x503c2a[_0xf86e('0x11')][_0xf86e('0x12')]===0x1f4){logger[_0xf86e('0x11')]('Network,\x20%s,\x20%s',_0x1afd2f,_0x503c2a[_0xf86e('0x11')][_0xf86e('0x13')]);return _0x1af6c3(_0x503c2a[_0xf86e('0x11')][_0xf86e('0x13')]);}logger[_0xf86e('0x11')](_0xf86e('0xc'),_0x1afd2f,_0x503c2a[_0xf86e('0x11')][_0xf86e('0x13')]);return _0x3c66a3(_0x503c2a[_0xf86e('0x11')][_0xf86e('0x13')]);}else{logger[_0xf86e('0xb')]('Network,\x20%s,\x20%s',_0x1afd2f,_0xf86e('0xf'));_0x3c66a3(_0x503c2a[_0xf86e('0x14')][_0xf86e('0x13')]);}})['catch'](function(_0x45fbe7){logger[_0xf86e('0x11')](_0xf86e('0xc'),_0x1afd2f,_0x45fbe7);_0x1af6c3(_0x45fbe7);});});}function respondWithResult(_0x3a393c,_0x1e214f){_0x1e214f=_0x1e214f||0xc8;return function(_0x5f113d){if(_0x5f113d){return _0x3a393c[_0xf86e('0x15')](_0x1e214f)[_0xf86e('0x16')](_0x5f113d);}};}function respondWithFilteredResult(_0xb10ec0,_0x1c9422){return function(_0x39df29){if(_0x39df29){var _0xd10961=typeof _0x1c9422[_0xf86e('0x17')]===_0xf86e('0x18')&&typeof _0x1c9422['limit']===_0xf86e('0x18');var _0x2b6261=_0x39df29['count'];var _0x1b3e63=_0xd10961?0x0:_0x1c9422[_0xf86e('0x17')];var _0x4864ee=_0xd10961?_0x39df29[_0xf86e('0x19')]:_0x1c9422[_0xf86e('0x17')]+_0x1c9422[_0xf86e('0x1a')];var _0x598173;if(_0x4864ee>=_0x2b6261){_0x4864ee=_0x2b6261;_0x598173=0xc8;}else{_0x598173=0xce;}_0xb10ec0[_0xf86e('0x15')](_0x598173);return _0xb10ec0['set'](_0xf86e('0x1b'),_0x1b3e63+'-'+_0x4864ee+'/'+_0x2b6261)[_0xf86e('0x16')](_0x39df29);}return null;};}function saveUpdates(_0x5693c0){return function(_0x481be8){if(_0x481be8){return _0x481be8[_0xf86e('0x1c')](_0x5693c0)[_0xf86e('0xa')](function(_0x3a6891){return _0x3a6891;});}return null;};}function removeEntity(_0x499439){return function(_0x54173e){if(_0x54173e){return _0x54173e['destroy']()['then'](function(){_0x499439[_0xf86e('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x296c5e){return function(_0x3dea13){if(!_0x3dea13){_0x296c5e[_0xf86e('0x1d')](0x194);}return _0x3dea13;};}function handleError(_0x126dc3,_0x12d3bf){_0x12d3bf=_0x12d3bf||0x1f4;return function(_0x1d5413){logger['error'](_0x1d5413['stack']);if(_0x1d5413[_0xf86e('0x1e')]){delete _0x1d5413[_0xf86e('0x1e')];}_0x126dc3['status'](_0x12d3bf)[_0xf86e('0x1f')](_0x1d5413);};}exports[_0xf86e('0x20')]=function(_0x30d303,_0x30f4d3){var _0x1e234c={},_0x3b05b9={},_0x4565d7={'count':0x0,'rows':[]};var _0x4a9aec=_[_0xf86e('0x21')](db[_0xf86e('0x22')][_0xf86e('0x23')],function(_0x1f5543){return{'name':_0x1f5543[_0xf86e('0x24')],'type':_0x1f5543[_0xf86e('0x25')][_0xf86e('0x26')]};});_0x3b05b9['model']=_[_0xf86e('0x21')](_0x4a9aec,_0xf86e('0x1e'));_0x3b05b9[_0xf86e('0x27')]=_[_0xf86e('0x28')](_0x30d303[_0xf86e('0x27')]);_0x3b05b9[_0xf86e('0x29')]=_[_0xf86e('0x2a')](_0x3b05b9[_0xf86e('0x2b')],_0x3b05b9[_0xf86e('0x27')]);_0x1e234c['attributes']=_[_0xf86e('0x2a')](_0x3b05b9['model'],qs[_0xf86e('0x2c')](_0x30d303[_0xf86e('0x27')][_0xf86e('0x2c')]));_0x1e234c[_0xf86e('0x2d')]=_0x1e234c['attributes'][_0xf86e('0x2e')]?_0x1e234c[_0xf86e('0x2d')]:_0x3b05b9[_0xf86e('0x2b')];if(!_0x30d303[_0xf86e('0x27')][_0xf86e('0x2f')](_0xf86e('0x30'))){_0x1e234c[_0xf86e('0x1a')]=qs[_0xf86e('0x1a')](_0x30d303[_0xf86e('0x27')][_0xf86e('0x1a')]);_0x1e234c[_0xf86e('0x17')]=qs[_0xf86e('0x17')](_0x30d303[_0xf86e('0x27')][_0xf86e('0x17')]);}_0x1e234c[_0xf86e('0x31')]=qs[_0xf86e('0x32')](_0x30d303[_0xf86e('0x27')][_0xf86e('0x32')]);_0x1e234c[_0xf86e('0x33')]=qs[_0xf86e('0x29')](_['pick'](_0x30d303['query'],_0x3b05b9['filters']),_0x4a9aec);if(_0x30d303[_0xf86e('0x27')][_0xf86e('0x34')]){_0x1e234c['where']=_[_0xf86e('0x35')](_0x1e234c[_0xf86e('0x33')],{'$or':_[_0xf86e('0x21')](_0x4a9aec,function(_0x58f6f8){if(_0x58f6f8[_0xf86e('0x25')]!=='VIRTUAL'){var _0x49bfbe={};_0x49bfbe[_0x58f6f8[_0xf86e('0x1e')]]={'$like':'%'+_0x30d303[_0xf86e('0x27')]['filter']+'%'};return _0x49bfbe;}})});}_0x1e234c=_[_0xf86e('0x35')]({},_0x1e234c,_0x30d303['options']);var _0x398b04={'where':_0x1e234c[_0xf86e('0x33')]};return db[_0xf86e('0x22')][_0xf86e('0x19')](_0x398b04)[_0xf86e('0xa')](function(_0x253095){_0x4565d7['count']=_0x253095;if(_0x30d303[_0xf86e('0x27')]['includeAll']){_0x1e234c[_0xf86e('0x36')]=[{'all':!![]}];}return db['Network'][_0xf86e('0x37')](_0x1e234c);})[_0xf86e('0xa')](function(_0x3280a4){_0x4565d7['rows']=_0x3280a4;return _0x4565d7;})[_0xf86e('0xa')](respondWithFilteredResult(_0x30f4d3,_0x1e234c))[_0xf86e('0x38')](handleError(_0x30f4d3,null));};exports['show']=function(_0x6a80bc,_0x273199){var _0x5f25a3={'raw':!![],'where':{'id':_0x6a80bc[_0xf86e('0x39')]['id']}},_0x455fcb={};_0x455fcb[_0xf86e('0x2b')]=_['keys'](db[_0xf86e('0x22')][_0xf86e('0x23')]);_0x455fcb[_0xf86e('0x27')]=_['keys'](_0x6a80bc['query']);_0x455fcb['filters']=_[_0xf86e('0x2a')](_0x455fcb[_0xf86e('0x2b')],_0x455fcb[_0xf86e('0x27')]);_0x5f25a3['attributes']=_[_0xf86e('0x2a')](_0x455fcb[_0xf86e('0x2b')],qs[_0xf86e('0x2c')](_0x6a80bc[_0xf86e('0x27')][_0xf86e('0x2c')]));_0x5f25a3['attributes']=_0x5f25a3[_0xf86e('0x2d')][_0xf86e('0x2e')]?_0x5f25a3[_0xf86e('0x2d')]:_0x455fcb['model'];if(_0x6a80bc[_0xf86e('0x27')][_0xf86e('0x3a')]){_0x5f25a3[_0xf86e('0x36')]=[{'all':!![]}];}_0x5f25a3=_[_0xf86e('0x35')]({},_0x5f25a3,_0x6a80bc['options']);return db[_0xf86e('0x22')]['find'](_0x5f25a3)['then'](handleEntityNotFound(_0x273199,null))[_0xf86e('0xa')](respondWithResult(_0x273199,null))[_0xf86e('0x38')](handleError(_0x273199,null));};exports['create']=function(_0x5d4999,_0x9794ba){var _0x467ef2;return db[_0xf86e('0x22')][_0xf86e('0x3b')](_0x5d4999[_0xf86e('0x3c')],{'raw':!![]})['then'](function(_0xd56aad){_0x467ef2=_0xd56aad;return db[_0xf86e('0x22')]['findAll']({'where':{'type':_0x5d4999[_0xf86e('0x3c')][_0xf86e('0x25')]},'raw':!![]});})[_0xf86e('0xa')](function(_0x557d5f){if(_0x467ef2[_0xf86e('0x25')][_0xf86e('0x3d')]()=='STUN'){var _0x517cee=fs[_0xf86e('0x3e')](path[_0xf86e('0x3f')](config[_0xf86e('0x40')],'server/files/templates/stun_multiple.ejs'),_0xf86e('0x41'));var _0x59c73e=ejs['render'](_0x517cee,{'networks':_0x557d5f||[]});fs[_0xf86e('0x42')]('/etc/asterisk/stun_xcally.conf',_0x59c73e);return respondWithRpcPromise(_0xf86e('0x43'),'create',{'module':_0xf86e('0x44')});}else if(_0x467ef2[_0xf86e('0x25')][_0xf86e('0x3d')]()==_0xf86e('0x45')){var _0x374ab5=fs['readFileSync'](path[_0xf86e('0x3f')](config[_0xf86e('0x40')],_0xf86e('0x46')),_0xf86e('0x41'));var _0x1d0a58=ejs[_0xf86e('0x47')](_0x374ab5,{'networks':_0x557d5f||[]});fs[_0xf86e('0x42')](_0xf86e('0x48'),_0x1d0a58);return respondWithRpcPromise(_0xf86e('0x43'),_0xf86e('0x3b'),{'module':_0xf86e('0x44')});}else{var _0x2152c3=fs['readFileSync'](path[_0xf86e('0x3f')](config[_0xf86e('0x40')],'server/files/templates/network.ejs'),_0xf86e('0x41'));var _0x4a893f=ejs[_0xf86e('0x47')](_0x2152c3,{'networks':_0x557d5f||[]});fs[_0xf86e('0x42')](util[_0xf86e('0x49')]('/etc/asterisk/sip_xcally_%s.conf',_0x5d4999[_0xf86e('0x3c')]['type']['toLowerCase']()),_0x4a893f);return respondWithRpcPromise(_0xf86e('0x43'),_0xf86e('0x3b'),{'module':'chan_sip.so'});}})['then'](function(){return _0x467ef2;})[_0xf86e('0xa')](respondWithResult(_0x9794ba,0xc9))['catch'](handleError(_0x9794ba,null));};exports['update']=function(_0x3d328c,_0x232464){var _0x472f09;return db[_0xf86e('0x22')][_0xf86e('0x4a')]({'where':{'id':_0x3d328c[_0xf86e('0x39')]['id']}})[_0xf86e('0xa')](handleEntityNotFound(_0x232464,null))['then'](saveUpdates(_0x3d328c['body'],null))[_0xf86e('0xa')](function(_0x18a954){if(_0x18a954){_0x472f09=_0x18a954;return db['Network'][_0xf86e('0x37')]({'where':{'type':_0x472f09[_0xf86e('0x25')]},'raw':!![]});}return null;})[_0xf86e('0xa')](function(_0x4a06cf){if(_0x472f09[_0xf86e('0x25')][_0xf86e('0x3d')]()==_0xf86e('0x4b')){var _0x343626=fs[_0xf86e('0x3e')](path['join'](config['root'],_0xf86e('0x4c')),'utf8');var _0x3ff8b8=ejs['render'](_0x343626,{'networks':_0x4a06cf||[]});fs[_0xf86e('0x42')](_0xf86e('0x4d'),_0x3ff8b8);return respondWithRpcPromise(_0xf86e('0x43'),_0xf86e('0x1c'),{'module':'res_stun_monitor.so'});}else if(_0x472f09[_0xf86e('0x25')][_0xf86e('0x3d')]()==_0xf86e('0x45')){var _0x3489c0=fs[_0xf86e('0x3e')](path[_0xf86e('0x3f')](config['root'],_0xf86e('0x46')),_0xf86e('0x41'));var _0x2dfe72=ejs[_0xf86e('0x47')](_0x3489c0,{'networks':_0x4a06cf||[]});fs[_0xf86e('0x42')](_0xf86e('0x48'),_0x2dfe72);return respondWithRpcPromise(_0xf86e('0x43'),_0xf86e('0x1c'),{'module':'res_stun_monitor.so'});}else{var _0x31267f=fs[_0xf86e('0x3e')](path[_0xf86e('0x3f')](config[_0xf86e('0x40')],_0xf86e('0x4e')),_0xf86e('0x41'));var _0x1273b7=ejs[_0xf86e('0x47')](_0x31267f,{'networks':_0x4a06cf||[]});fs['writeFileSync'](util['format'](_0xf86e('0x4f'),_0x3d328c[_0xf86e('0x3c')][_0xf86e('0x25')][_0xf86e('0x50')]()),_0x1273b7);return respondWithRpcPromise(_0xf86e('0x43'),_0xf86e('0x1c'),{'module':'chan_sip.so'});}})['then'](function(_0x1c3b05){if(_0x1c3b05){return _0x472f09;}return null;})['then'](respondWithResult(_0x232464,null))[_0xf86e('0x38')](handleError(_0x232464,null));};exports[_0xf86e('0x51')]=function(_0x3a3c58,_0x214b54){var _0x2579cd;return db['Network'][_0xf86e('0x4a')]({'where':{'id':_0x3a3c58[_0xf86e('0x39')]['id']}})[_0xf86e('0xa')](function(_0x571288){_0x2579cd=_0x571288;return _0x571288;})[_0xf86e('0xa')](handleEntityNotFound(_0x214b54,null))[_0xf86e('0xa')](removeEntity(_0x214b54,null))[_0xf86e('0xa')](function(){if(_0x2579cd){return db[_0xf86e('0x22')][_0xf86e('0x37')]({'where':{'type':_0x2579cd[_0xf86e('0x25')]},'raw':!![]});}})[_0xf86e('0xa')](function(_0x328a54){if(_0x2579cd[_0xf86e('0x25')][_0xf86e('0x3d')]()=='STUN'){var _0x23e842=fs[_0xf86e('0x3e')](path[_0xf86e('0x3f')](config['root'],_0xf86e('0x4c')),_0xf86e('0x41'));var _0x11bf3f=ejs[_0xf86e('0x47')](_0x23e842,{'networks':_0x328a54||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x11bf3f);return respondWithRpcPromise(_0xf86e('0x43'),_0xf86e('0x51'),{'module':_0xf86e('0x44')});}else if(_0x2579cd[_0xf86e('0x25')][_0xf86e('0x3d')]()=='TURN'){var _0x4cafb0=fs[_0xf86e('0x3e')](path[_0xf86e('0x3f')](config[_0xf86e('0x40')],_0xf86e('0x46')),'utf8');var _0x5c4880=ejs[_0xf86e('0x47')](_0x4cafb0,{'networks':_0x328a54||[]});fs[_0xf86e('0x42')](_0xf86e('0x48'),_0x5c4880);return respondWithRpcPromise(_0xf86e('0x43'),_0xf86e('0x51'),{'module':_0xf86e('0x44')});}else{var _0x458f65=fs[_0xf86e('0x3e')](path[_0xf86e('0x3f')](config[_0xf86e('0x40')],_0xf86e('0x4e')),_0xf86e('0x41'));var _0x1f8a9e=ejs['render'](_0x458f65,{'networks':_0x328a54||[]});fs[_0xf86e('0x42')](util[_0xf86e('0x49')](_0xf86e('0x4f'),_0x2579cd[_0xf86e('0x25')][_0xf86e('0x50')]()),_0x1f8a9e);return respondWithRpcPromise(_0xf86e('0x43'),_0xf86e('0x51'),{'module':_0xf86e('0x52')});}})[_0xf86e('0x38')](handleError(_0x214b54,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index db00d1f..5c8d5ba 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 _0x0427=['api','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','../../config/logger'];(function(_0xdbbb14,_0x140263){var _0x3c3585=function(_0x5a4b33){while(--_0x5a4b33){_0xdbbb14['push'](_0xdbbb14['shift']());}};_0x3c3585(++_0x140263);}(_0x0427,0x137));var _0x7042=function(_0xc4be90,_0x4cb9fc){_0xc4be90=_0xc4be90-0x0;var _0x570f39=_0x0427[_0xc4be90];return _0x570f39;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7042('0x0'))(_0x7042('0x1'));var moment=require('moment');var BPromise=require(_0x7042('0x2'));var rp=require(_0x7042('0x3'));var fs=require('fs');var path=require(_0x7042('0x4'));var rimraf=require(_0x7042('0x5'));var config=require(_0x7042('0x6'));var attributes=require(_0x7042('0x7'));module[_0x7042('0x8')]=function(_0x53ab81,_0x37a35b){return _0x53ab81[_0x7042('0x9')](_0x7042('0xa'),attributes,{'tableName':_0x7042('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c81=['moment','../../config/environment','./network.attributes','exports','define','Network','lodash','util','api'];(function(_0x11f2d8,_0x118383){var _0x240c2f=function(_0x5af61e){while(--_0x5af61e){_0x11f2d8['push'](_0x11f2d8['shift']());}};_0x240c2f(++_0x118383);}(_0x3c81,0x102));var _0x13c8=function(_0x501fae,_0x4bca96){_0x501fae=_0x501fae-0x0;var _0x225ca4=_0x3c81[_0x501fae];return _0x225ca4;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var logger=require('../../config/logger')(_0x13c8('0x2'));var moment=require(_0x13c8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x13c8('0x4'));var attributes=require(_0x13c8('0x5'));module[_0x13c8('0x6')]=function(_0x1c16f1,_0x2a4d66){return _0x1c16f1[_0x13c8('0x7')](_0x13c8('0x8'),attributes,{'tableName':'network','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 0ef8c3b..38cf8ec 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x37c2b2,_0x28680e){_0x37c2b2=_0x37c2b2-0x0;var _0x44de44=_0x7a54[_0x37c2b2];return _0x44de44;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x5a20e9,_0x33942c){_0x5a20e9=_0x5a20e9-0x0;var _0x30b24b=_0x7a54[_0x5a20e9];return _0x30b24b;};'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 021a9d4..54f8065 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 _0xd8a9=['get','isAuthenticated','/describe','describe','show','getDispositions','getAnswers','/:id/applications','getApplications','getInteractions','getAgents','post','create','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','addAgents','send','put','/:id','delete','removeDispositions','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller'];(function(_0x15d1ca,_0x509468){var _0x2796de=function(_0x26a31b){while(--_0x26a31b){_0x15d1ca['push'](_0x15d1ca['shift']());}};_0x2796de(++_0x509468);}(_0xd8a9,0x1a3));var _0x9d8a=function(_0x3b8db4,_0x2bf569){_0x3b8db4=_0x3b8db4-0x0;var _0x18ad3f=_0xd8a9[_0x3b8db4];return _0x18ad3f;};'use strict';var multer=require(_0x9d8a('0x0'));var util=require(_0x9d8a('0x1'));var path=require(_0x9d8a('0x2'));var timeout=require(_0x9d8a('0x3'));var express=require(_0x9d8a('0x4'));var router=express[_0x9d8a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9d8a('0x6'));var interaction=require(_0x9d8a('0x7'));var config=require(_0x9d8a('0x8'));var controller=require(_0x9d8a('0x9'));router[_0x9d8a('0xa')]('/',auth[_0x9d8a('0xb')](),controller['index']);router[_0x9d8a('0xa')](_0x9d8a('0xc'),auth[_0x9d8a('0xb')](),controller[_0x9d8a('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9d8a('0xe')]);router[_0x9d8a('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9d8a('0xf')]);router[_0x9d8a('0xa')]('/:id/canned_answers',auth[_0x9d8a('0xb')](),controller[_0x9d8a('0x10')]);router[_0x9d8a('0xa')](_0x9d8a('0x11'),auth['isAuthenticated'](),controller[_0x9d8a('0x12')]);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x9d8a('0x13')]);router['get']('/:id/users',auth[_0x9d8a('0xb')](),controller[_0x9d8a('0x14')]);router[_0x9d8a('0x15')]('/',auth[_0x9d8a('0xb')](),controller[_0x9d8a('0x16')]);router[_0x9d8a('0x15')](_0x9d8a('0x17'),auth[_0x9d8a('0xb')](),controller[_0x9d8a('0x18')]);router[_0x9d8a('0x15')](_0x9d8a('0x19'),auth[_0x9d8a('0xb')](),controller[_0x9d8a('0x1a')]);router[_0x9d8a('0x15')](_0x9d8a('0x1b'),controller[_0x9d8a('0x1c')]);router['post'](_0x9d8a('0x11'),auth[_0x9d8a('0xb')](),controller[_0x9d8a('0x1d')]);router[_0x9d8a('0x15')]('/:id/users',auth[_0x9d8a('0xb')](),controller[_0x9d8a('0x1e')]);router[_0x9d8a('0x15')]('/:id/send',auth[_0x9d8a('0xb')](),controller[_0x9d8a('0x1f')]);router[_0x9d8a('0x20')]('/:id',auth[_0x9d8a('0xb')](),controller['update']);router['delete'](_0x9d8a('0x21'),auth[_0x9d8a('0xb')](),controller['destroy']);router[_0x9d8a('0x22')](_0x9d8a('0x17'),auth[_0x9d8a('0xb')](),controller[_0x9d8a('0x23')]);router[_0x9d8a('0x22')](_0x9d8a('0x19'),auth[_0x9d8a('0xb')](),controller['removeAnswers']);router[_0x9d8a('0x22')](_0x9d8a('0x24'),auth[_0x9d8a('0xb')](),controller[_0x9d8a('0x25')]);module[_0x9d8a('0x26')]=router; \ No newline at end of file +var _0xf379=['send','put','/:id','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','show','/:id/dispositions','getDispositions','/:id/canned_answers','getApplications','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','addAgents','/:id/send'];(function(_0x4c2b96,_0x17ab0d){var _0x2a62bf=function(_0x6069bd){while(--_0x6069bd){_0x4c2b96['push'](_0x4c2b96['shift']());}};_0x2a62bf(++_0x17ab0d);}(_0xf379,0x1ad));var _0x9f37=function(_0x1ff804,_0x263135){_0x1ff804=_0x1ff804-0x0;var _0x3454b8=_0xf379[_0x1ff804];return _0x3454b8;};'use strict';var multer=require(_0x9f37('0x0'));var util=require(_0x9f37('0x1'));var path=require('path');var timeout=require(_0x9f37('0x2'));var express=require(_0x9f37('0x3'));var router=express['Router']();var fs_extra=require(_0x9f37('0x4'));var auth=require(_0x9f37('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9f37('0x6'));var controller=require(_0x9f37('0x7'));router[_0x9f37('0x8')]('/',auth[_0x9f37('0x9')](),controller[_0x9f37('0xa')]);router[_0x9f37('0x8')]('/describe',auth[_0x9f37('0x9')](),controller['describe']);router[_0x9f37('0x8')]('/:id',auth[_0x9f37('0x9')](),controller[_0x9f37('0xb')]);router['get'](_0x9f37('0xc'),auth[_0x9f37('0x9')](),controller[_0x9f37('0xd')]);router[_0x9f37('0x8')](_0x9f37('0xe'),auth[_0x9f37('0x9')](),controller['getAnswers']);router['get']('/:id/applications',auth[_0x9f37('0x9')](),controller[_0x9f37('0xf')]);router[_0x9f37('0x8')]('/:id/interactions',auth[_0x9f37('0x9')](),controller[_0x9f37('0x10')]);router[_0x9f37('0x8')](_0x9f37('0x11'),auth[_0x9f37('0x9')](),controller[_0x9f37('0x12')]);router[_0x9f37('0x13')]('/',auth['isAuthenticated'](),controller[_0x9f37('0x14')]);router['post'](_0x9f37('0xc'),auth[_0x9f37('0x9')](),controller[_0x9f37('0x15')]);router['post']('/:id/canned_answers',auth[_0x9f37('0x9')](),controller[_0x9f37('0x16')]);router[_0x9f37('0x13')](_0x9f37('0x17'),controller['notify']);router['post']('/:id/applications',auth[_0x9f37('0x9')](),controller['addApplications']);router[_0x9f37('0x13')]('/:id/users',auth[_0x9f37('0x9')](),controller[_0x9f37('0x18')]);router['post'](_0x9f37('0x19'),auth[_0x9f37('0x9')](),controller[_0x9f37('0x1a')]);router[_0x9f37('0x1b')](_0x9f37('0x1c'),auth['isAuthenticated'](),controller['update']);router[_0x9f37('0x1d')]('/:id',auth[_0x9f37('0x9')](),controller[_0x9f37('0x1e')]);router[_0x9f37('0x1d')](_0x9f37('0xc'),auth[_0x9f37('0x9')](),controller[_0x9f37('0x1f')]);router[_0x9f37('0x1d')](_0x9f37('0xe'),auth[_0x9f37('0x9')](),controller[_0x9f37('0x20')]);router[_0x9f37('0x1d')](_0x9f37('0x11'),auth[_0x9f37('0x9')](),controller[_0x9f37('0x21')]);module[_0x9f37('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 982d4a0..ae4c93f 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 _0x9012=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','name','generate'];(function(_0xba7840,_0x36fac8){var _0x532b9a=function(_0x47bb03){while(--_0x47bb03){_0xba7840['push'](_0xba7840['shift']());}};_0x532b9a(++_0x36fac8);}(_0x9012,0x14f));var _0x2901=function(_0x15fc3c,_0x35665b){_0x15fc3c=_0x15fc3c-0x0;var _0x94c5c8=_0x9012[_0x15fc3c];return _0x94c5c8;};'use strict';var Sequelize=require(_0x2901('0x0'));var rs=require(_0x2901('0x1'));module['exports']={'name':{'type':Sequelize[_0x2901('0x2')],'unique':_0x2901('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2901('0x2')]},'token':{'type':Sequelize[_0x2901('0x2')],'defaultValue':function(){return rs[_0x2901('0x4')]();}},'replyUri':{'type':Sequelize[_0x2901('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x2901('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x2901('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2901('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x2901('0x2')]},'queueTransfer':{'type':Sequelize[_0x2901('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2901('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2901('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2901('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x2901('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x40a443){if(!_0x40a443)this[_0x2901('0x8')]('mandatoryDispositionPauseId',null);this[_0x2901('0x8')](_0x2901('0x9'),_0x40a443);}}}; \ No newline at end of file +var _0x90bf=['name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports'];(function(_0x434fff,_0x260e84){var _0x19e121=function(_0x5b3c35){while(--_0x5b3c35){_0x434fff['push'](_0x434fff['shift']());}};_0x19e121(++_0x260e84);}(_0x90bf,0xa7));var _0xf90b=function(_0x563c54,_0x29afe4){_0x563c54=_0x563c54-0x0;var _0x1b5a36=_0x90bf[_0x563c54];return _0x1b5a36;};'use strict';var Sequelize=require(_0xf90b('0x0'));var rs=require('randomstring');module[_0xf90b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xf90b('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xf90b('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xf90b('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xf90b('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf90b('0x5')],'defaultValue':function(){return _0xf90b('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xf90b('0x3')]},'queueTransfer':{'type':Sequelize[_0xf90b('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf90b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf90b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf90b('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xf90b('0x7')],'defaultValue':![],'comment':_0xf90b('0x9'),'set':function(_0x4e78be){if(!_0x4e78be)this[_0xf90b('0xa')](_0xf90b('0xb'),null);this[_0xf90b('0xa')](_0xf90b('0xc'),_0x4e78be);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index e9e9d21..c0166fd 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 _0x53f7=['nolimit','limit','order','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','sort','removeDispositions','addAnswer','CannedAnswer','getAnswers','ids','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','from','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','OpenchannelApplication','account','applications','orderBy','priority','Applications','Contacts','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','push','close','unmanaged','*,*,*,*','AttachmentId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','addAgents','omit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','ListId','out','OpenchannelMessage','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','catch','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x3718f2,_0x2e711){var _0x8bab7c=function(_0x44ff8c){while(--_0x44ff8c){_0x3718f2['push'](_0x3718f2['shift']());}};_0x8bab7c(++_0x2e711);}(_0x53f7,0x12c));var _0x753f=function(_0x25a0b9,_0x86e28f){_0x25a0b9=_0x25a0b9-0x0;var _0x30b9ab=_0x53f7[_0x25a0b9];return _0x30b9ab;};'use strict';var emlformat=require(_0x753f('0x0'));var rimraf=require(_0x753f('0x1'));var zipdir=require(_0x753f('0x2'));var jsonpatch=require(_0x753f('0x3'));var rp=require(_0x753f('0x4'));var moment=require(_0x753f('0x5'));var BPromise=require(_0x753f('0x6'));var Mustache=require('mustache');var util=require(_0x753f('0x7'));var path=require(_0x753f('0x8'));var sox=require(_0x753f('0x9'));var csv=require(_0x753f('0xa'));var ejs=require(_0x753f('0xb'));var fs=require('fs');var fs_extra=require(_0x753f('0xc'));var _=require(_0x753f('0xd'));var squel=require(_0x753f('0xe'));var crypto=require(_0x753f('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x753f('0x10'));var Papa=require(_0x753f('0x11'));var Redis=require(_0x753f('0x12'));var authService=require(_0x753f('0x13'));var qs=require(_0x753f('0x14'));var as=require(_0x753f('0x15'));var hardwareService=require(_0x753f('0x16'));var logger=require(_0x753f('0x17'))(_0x753f('0x18'));var utils=require('../../config/utils');var config=require(_0x753f('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x753f('0x1a'))['db'];config[_0x753f('0x1b')]=_[_0x753f('0x1c')](config[_0x753f('0x1b')],{'host':_0x753f('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x753f('0x1b')]));require(_0x753f('0x1e'))[_0x753f('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x753f('0x20')][_0x753f('0x21')]({'port':0x232c});var client9002=jayson[_0x753f('0x20')][_0x753f('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x17c22b,_0x20dff1,_0x4f2917,_0x53be13){return new BPromise(function(_0x20f89a,_0xd32265){var _0x22aca4=_0x53be13||client;return _0x22aca4[_0x753f('0x22')](_0x17c22b,_0x4f2917)[_0x753f('0x23')](function(_0x4d1c44){logger[_0x753f('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x20dff1,'request\x20sent');logger['debug'](_0x753f('0x25'),_0x20dff1,'request\x20sent',JSON[_0x753f('0x26')](_0x4d1c44));if(_0x4d1c44['error']){if(_0x4d1c44['error'][_0x753f('0x27')]===0x1f4){logger[_0x753f('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x20dff1,_0x4d1c44[_0x753f('0x28')]['message']);return _0xd32265(_0x4d1c44[_0x753f('0x28')][_0x753f('0x29')]);}logger[_0x753f('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x20dff1,_0x4d1c44['error'][_0x753f('0x29')]);return _0x20f89a(_0x4d1c44[_0x753f('0x28')]['message']);}else{logger['info'](_0x753f('0x2a'),_0x20dff1,_0x753f('0x2b'));_0x20f89a(_0x4d1c44['result'][_0x753f('0x29')]);}})[_0x753f('0x2c')](function(_0x4c1673){logger['error'](_0x753f('0x2a'),_0x20dff1,_0x4c1673);_0xd32265(_0x4c1673);});});}function respondWithStatusCode(_0x555cfb,_0x6b4669){_0x6b4669=_0x6b4669||0xcc;return function(_0x45f0d5){if(_0x45f0d5){return _0x555cfb[_0x753f('0x2d')](_0x6b4669);}return _0x555cfb['status'](_0x6b4669)['end']();};}function respondWithResult(_0x304c79,_0x43ab0e){_0x43ab0e=_0x43ab0e||0xc8;return function(_0x271267){if(_0x271267){return _0x304c79[_0x753f('0x2e')](_0x43ab0e)[_0x753f('0x2f')](_0x271267);}};}function respondWithFilteredResult(_0x101559,_0x4623ab){return function(_0x3560f9){if(_0x3560f9){var _0x22947a=typeof _0x4623ab[_0x753f('0x30')]===_0x753f('0x31')&&typeof _0x4623ab['limit']===_0x753f('0x31');var _0x23c36a=_0x3560f9[_0x753f('0x32')];var _0x3eb34d=_0x22947a?0x0:_0x4623ab[_0x753f('0x30')];var _0x1fb17a=_0x22947a?_0x3560f9[_0x753f('0x32')]:_0x4623ab[_0x753f('0x30')]+_0x4623ab['limit'];var _0x2fcd6b;if(_0x1fb17a>=_0x23c36a){_0x1fb17a=_0x23c36a;_0x2fcd6b=0xc8;}else{_0x2fcd6b=0xce;}_0x101559[_0x753f('0x2e')](_0x2fcd6b);return _0x101559[_0x753f('0x33')](_0x753f('0x34'),_0x3eb34d+'-'+_0x1fb17a+'/'+_0x23c36a)[_0x753f('0x2f')](_0x3560f9);}return null;};}function patchUpdates(_0x2039f6){return function(_0x2a1b19){try{jsonpatch['apply'](_0x2a1b19,_0x2039f6,!![]);}catch(_0x359c46){return BPromise['reject'](_0x359c46);}return _0x2a1b19[_0x753f('0x35')]();};}function saveUpdates(_0xe168af,_0x35d05f){return function(_0x21064e){if(_0x21064e){return _0x21064e[_0x753f('0x36')](_0xe168af)['then'](function(_0x1b8248){return _0x1b8248;});}return null;};}function removeEntity(_0x502474,_0x24b6c4){return function(_0x32f2b6){if(_0x32f2b6){return _0x32f2b6[_0x753f('0x37')]()['then'](function(){var _0x161082=_0x32f2b6[_0x753f('0x38')]({'plain':!![]});var _0x26af0e=_0x753f('0x39');return db[_0x753f('0x3a')][_0x753f('0x37')]({'where':{'type':_0x26af0e,'resourceId':_0x161082['id']}})['then'](function(){return _0x32f2b6;});})['then'](function(){_0x502474['status'](0xcc)[_0x753f('0x3b')]();});}};}function handleEntityNotFound(_0x3a75ca,_0xbef6c6){return function(_0x39f061){if(!_0x39f061){_0x3a75ca['sendStatus'](0x194);}return _0x39f061;};}function handleError(_0x530420,_0x1e34a1){_0x1e34a1=_0x1e34a1||0x1f4;return function(_0x36a73e){logger[_0x753f('0x28')](_0x36a73e[_0x753f('0x3c')]);if(_0x36a73e[_0x753f('0x3d')]){delete _0x36a73e[_0x753f('0x3d')];}_0x530420[_0x753f('0x2e')](_0x1e34a1)[_0x753f('0x3e')](_0x36a73e);};}exports[_0x753f('0x3f')]=function(_0xcd989e,_0x89daa3){var _0x4e676c={'include':[{'model':db[_0x753f('0x40')],'as':_0x753f('0x41')}]},_0x551b47={},_0x10d549={'count':0x0,'rows':[]};var _0x1ca6f1=_[_0x753f('0x42')](db[_0x753f('0x43')][_0x753f('0x44')],function(_0x3f52a1){return{'name':_0x3f52a1[_0x753f('0x45')],'type':_0x3f52a1[_0x753f('0x46')][_0x753f('0x47')]};});_0x551b47['model']=_[_0x753f('0x42')](_0x1ca6f1,_0x753f('0x3d'));_0x551b47[_0x753f('0x48')]=_['keys'](_0xcd989e[_0x753f('0x48')]);_0x551b47[_0x753f('0x49')]=_[_0x753f('0x4a')](_0x551b47[_0x753f('0x4b')],_0x551b47['query']);_0x4e676c[_0x753f('0x4c')]=_['intersection'](_0x551b47['model'],qs['fields'](_0xcd989e['query'][_0x753f('0x4d')]));_0x4e676c[_0x753f('0x4c')]=_0x4e676c['attributes'][_0x753f('0x4e')]?_0x4e676c[_0x753f('0x4c')]:_0x551b47['model'];if(!_0xcd989e[_0x753f('0x48')][_0x753f('0x4f')](_0x753f('0x50'))){_0x4e676c[_0x753f('0x51')]=qs[_0x753f('0x51')](_0xcd989e[_0x753f('0x48')][_0x753f('0x51')]);_0x4e676c[_0x753f('0x30')]=qs[_0x753f('0x30')](_0xcd989e[_0x753f('0x48')][_0x753f('0x30')]);}_0x4e676c[_0x753f('0x52')]=qs['sort'](_0xcd989e['query']['sort']);_0x4e676c[_0x753f('0x53')]=qs[_0x753f('0x49')](_[_0x753f('0x54')](_0xcd989e[_0x753f('0x48')],_0x551b47[_0x753f('0x49')]),_0x1ca6f1);if(_0xcd989e[_0x753f('0x48')][_0x753f('0x55')]){_0x4e676c[_0x753f('0x53')]=_['merge'](_0x4e676c[_0x753f('0x53')],{'$or':_[_0x753f('0x42')](_0x1ca6f1,function(_0xb6beb7){if(_0xb6beb7[_0x753f('0x46')]!==_0x753f('0x56')){var _0x4b0dd9={};_0x4b0dd9[_0xb6beb7['name']]={'$like':'%'+_0xcd989e[_0x753f('0x48')][_0x753f('0x55')]+'%'};return _0x4b0dd9;}})});}_0x4e676c=_['merge']({},_0x4e676c,_0xcd989e[_0x753f('0x57')]);var _0x38243f={'where':_0x4e676c['where']};return db['OpenchannelAccount'][_0x753f('0x32')](_0x38243f)[_0x753f('0x23')](function(_0x1c8bd4){_0x10d549[_0x753f('0x32')]=_0x1c8bd4;if(_0xcd989e[_0x753f('0x48')][_0x753f('0x58')]){_0x4e676c[_0x753f('0x59')]=[{'all':!![]}];}return db[_0x753f('0x43')][_0x753f('0x5a')](_0x4e676c);})[_0x753f('0x23')](function(_0x527421){_0x10d549[_0x753f('0x5b')]=_0x527421;return _0x10d549;})[_0x753f('0x23')](respondWithFilteredResult(_0x89daa3,_0x4e676c))[_0x753f('0x2c')](handleError(_0x89daa3,null));};exports[_0x753f('0x5c')]=function(_0x163dc8,_0x545c77){var _0x38ee5e={'raw':![],'where':{'id':_0x163dc8[_0x753f('0x5d')]['id']},'include':[{'model':db[_0x753f('0x40')],'as':_0x753f('0x41')}]},_0x43f412={};_0x43f412['model']=_[_0x753f('0x5e')](db[_0x753f('0x43')]['rawAttributes']);_0x43f412[_0x753f('0x48')]=_[_0x753f('0x5e')](_0x163dc8['query']);_0x43f412[_0x753f('0x49')]=_[_0x753f('0x4a')](_0x43f412['model'],_0x43f412[_0x753f('0x48')]);_0x38ee5e[_0x753f('0x4c')]=_[_0x753f('0x4a')](_0x43f412['model'],qs[_0x753f('0x4d')](_0x163dc8[_0x753f('0x48')]['fields']));_0x38ee5e[_0x753f('0x4c')]=_0x38ee5e[_0x753f('0x4c')][_0x753f('0x4e')]?_0x38ee5e['attributes']:_0x43f412[_0x753f('0x4b')];if(_0x163dc8['query'][_0x753f('0x58')]){_0x38ee5e[_0x753f('0x59')]=[{'all':!![]}];}_0x38ee5e=_[_0x753f('0x5f')]({},_0x38ee5e,_0x163dc8['options']);return db[_0x753f('0x43')][_0x753f('0x60')](_0x38ee5e)['then'](handleEntityNotFound(_0x545c77,null))['then'](respondWithResult(_0x545c77,null))[_0x753f('0x2c')](handleError(_0x545c77,null));};exports[_0x753f('0x61')]=function(_0x4fb02d,_0x4102cd){return db[_0x753f('0x43')]['create'](_0x4fb02d[_0x753f('0x62')],{})['then'](function(_0x3d6665){var _0x294f6a=_0x4fb02d[_0x753f('0x63')][_0x753f('0x38')]({'plain':!![]});if(!_0x294f6a)throw new Error(_0x753f('0x64'));if(_0x294f6a[_0x753f('0x65')]===_0x753f('0x63')){var _0x4503a7=_0x3d6665[_0x753f('0x38')]({'plain':!![]});var _0x411f89='OpenchannelAccounts';return db[_0x753f('0x66')][_0x753f('0x60')]({'where':{'name':_0x411f89,'userProfileId':_0x294f6a['userProfileId']},'raw':!![]})['then'](function(_0x1ee6dd){if(_0x1ee6dd&&_0x1ee6dd['autoAssociation']===0x0){return db['UserProfileResource'][_0x753f('0x61')]({'name':_0x4503a7['name'],'resourceId':_0x4503a7['id'],'type':_0x1ee6dd[_0x753f('0x3d')],'sectionId':_0x1ee6dd['id']},{})[_0x753f('0x23')](function(){return _0x3d6665;});}else{return _0x3d6665;}})['catch'](function(_0x4ee3bb){logger[_0x753f('0x28')](_0x753f('0x67'),_0x4ee3bb);throw _0x4ee3bb;});}return _0x3d6665;})[_0x753f('0x23')](respondWithResult(_0x4102cd,0xc9))[_0x753f('0x2c')](handleError(_0x4102cd,null));};exports['update']=function(_0x54b887,_0x17de13){if(_0x54b887[_0x753f('0x62')]['id']){delete _0x54b887['body']['id'];}return db[_0x753f('0x43')]['find']({'where':{'id':_0x54b887[_0x753f('0x5d')]['id']},'include':[{'model':db[_0x753f('0x40')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x17de13,null))[_0x753f('0x23')](saveUpdates(_0x54b887['body'],null))['then'](respondWithResult(_0x17de13,null))[_0x753f('0x2c')](handleError(_0x17de13,null));};exports[_0x753f('0x37')]=function(_0x1dfd86,_0x44435e){return db[_0x753f('0x43')]['find']({'where':{'id':_0x1dfd86['params']['id']}})[_0x753f('0x23')](handleEntityNotFound(_0x44435e,null))[_0x753f('0x23')](removeEntity(_0x44435e,null))[_0x753f('0x2c')](handleError(_0x44435e,null));};exports[_0x753f('0x68')]=function(_0x429258,_0x1aaf60){return db[_0x753f('0x43')]['describe']()[_0x753f('0x23')](respondWithResult(_0x1aaf60,null))[_0x753f('0x2c')](handleError(_0x1aaf60,null));};exports['addDisposition']=function(_0x2463ff,_0x130f21,_0x3ce55d){if(_0x2463ff[_0x753f('0x62')]['id']){delete _0x2463ff['body']['id'];}return db['OpenchannelAccount'][_0x753f('0x60')]({'where':{'id':_0x2463ff[_0x753f('0x5d')]['id']}})[_0x753f('0x23')](handleEntityNotFound(_0x130f21,null))[_0x753f('0x23')](function(_0x43c3e5){if(_0x43c3e5){_0x2463ff[_0x753f('0x62')][_0x753f('0x69')]=_0x43c3e5['id'];return db[_0x753f('0x6a')]['create'](_0x2463ff[_0x753f('0x62')]);}})[_0x753f('0x23')](respondWithResult(_0x130f21,null))[_0x753f('0x2c')](handleError(_0x130f21,null));};exports[_0x753f('0x6b')]=function(_0x14e6ac,_0x50a937,_0x26b246){var _0x13150d={'raw':![],'where':{}};var _0x4da496={};var _0x4db0ff={'count':0x0,'rows':[]};return db[_0x753f('0x43')][_0x753f('0x6c')]({'where':{'id':_0x14e6ac['params']['id']}})[_0x753f('0x23')](handleEntityNotFound(_0x50a937,null))[_0x753f('0x23')](function(_0x12361e){if(_0x12361e){_0x4da496[_0x753f('0x4b')]=_[_0x753f('0x5e')](db['Disposition'][_0x753f('0x44')]);_0x4da496[_0x753f('0x48')]=_[_0x753f('0x5e')](_0x14e6ac[_0x753f('0x48')]);_0x4da496['filters']=_[_0x753f('0x4a')](_0x4da496[_0x753f('0x4b')],_0x4da496[_0x753f('0x48')]);_0x13150d[_0x753f('0x4c')]=_[_0x753f('0x4a')](_0x4da496[_0x753f('0x4b')],qs[_0x753f('0x4d')](_0x14e6ac[_0x753f('0x48')]['fields']));_0x13150d[_0x753f('0x4c')]=_0x13150d['attributes'][_0x753f('0x4e')]?_0x13150d[_0x753f('0x4c')]:_0x4da496[_0x753f('0x4b')];if(!_0x14e6ac['query'][_0x753f('0x4f')]('nolimit')){_0x13150d['limit']=qs[_0x753f('0x51')](_0x14e6ac[_0x753f('0x48')][_0x753f('0x51')]);_0x13150d[_0x753f('0x30')]=qs[_0x753f('0x30')](_0x14e6ac[_0x753f('0x48')][_0x753f('0x30')]);}_0x13150d[_0x753f('0x52')]=qs[_0x753f('0x6d')](_0x14e6ac['query'][_0x753f('0x6d')]);_0x13150d[_0x753f('0x53')]=qs[_0x753f('0x49')](_[_0x753f('0x54')](_0x14e6ac[_0x753f('0x48')],_0x4da496[_0x753f('0x49')]));_0x13150d[_0x753f('0x53')][_0x753f('0x69')]=_0x12361e['id'];if(_0x14e6ac[_0x753f('0x48')][_0x753f('0x55')]){_0x13150d[_0x753f('0x53')]=_[_0x753f('0x5f')](_0x13150d[_0x753f('0x53')],{'$or':_[_0x753f('0x42')](_0x13150d[_0x753f('0x4c')],function(_0x379a05){var _0x2ba3df={};_0x2ba3df[_0x379a05]={'$like':'%'+_0x14e6ac[_0x753f('0x48')]['filter']+'%'};return _0x2ba3df;})});}_0x13150d=_['merge']({},_0x13150d,_0x14e6ac[_0x753f('0x57')]);return db[_0x753f('0x6a')][_0x753f('0x32')]({'where':_0x13150d[_0x753f('0x53')]})[_0x753f('0x23')](function(_0x2ecd41){_0x4db0ff[_0x753f('0x32')]=_0x2ecd41;if(_0x14e6ac[_0x753f('0x48')][_0x753f('0x58')]){_0x13150d[_0x753f('0x59')]=[{'all':!![]}];}return db[_0x753f('0x6a')][_0x753f('0x5a')](_0x13150d);})[_0x753f('0x23')](function(_0x47f3d7){_0x4db0ff['rows']=_0x47f3d7;return _0x4db0ff;});}})[_0x753f('0x23')](respondWithFilteredResult(_0x50a937,_0x13150d))['catch'](handleError(_0x50a937,null));};exports[_0x753f('0x6e')]=function(_0x40b99c,_0x55a4f9,_0x881686){return db[_0x753f('0x43')][_0x753f('0x60')]({'where':{'id':_0x40b99c['params']['id']}})[_0x753f('0x23')](handleEntityNotFound(_0x55a4f9,null))[_0x753f('0x23')](function(_0x1e62a1){if(_0x1e62a1){return _0x1e62a1[_0x753f('0x6e')](_0x40b99c[_0x753f('0x48')]['ids']);}})[_0x753f('0x23')](respondWithStatusCode(_0x55a4f9,null))['catch'](handleError(_0x55a4f9,null));};exports[_0x753f('0x6f')]=function(_0x1867e4,_0x4f19fc,_0x584330){if(_0x1867e4['body']['id']){delete _0x1867e4[_0x753f('0x62')]['id'];}return db[_0x753f('0x43')][_0x753f('0x60')]({'where':{'id':_0x1867e4[_0x753f('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4f19fc,null))[_0x753f('0x23')](function(_0x51dc85){if(_0x51dc85){_0x1867e4[_0x753f('0x62')][_0x753f('0x69')]=_0x51dc85['id'];return db[_0x753f('0x70')]['create'](_0x1867e4[_0x753f('0x62')]);}})['then'](respondWithResult(_0x4f19fc,null))['catch'](handleError(_0x4f19fc,null));};exports[_0x753f('0x71')]=function(_0x4fbd01,_0x2eb175,_0x27a4ff){var _0x20889a={'raw':![],'where':{}};var _0xd5df6e={};var _0x321c9d={'count':0x0,'rows':[]};return db[_0x753f('0x43')][_0x753f('0x6c')]({'where':{'id':_0x4fbd01[_0x753f('0x5d')]['id']}})[_0x753f('0x23')](handleEntityNotFound(_0x2eb175,null))[_0x753f('0x23')](function(_0x3de809){if(_0x3de809){_0xd5df6e[_0x753f('0x4b')]=_[_0x753f('0x5e')](db[_0x753f('0x70')][_0x753f('0x44')]);_0xd5df6e[_0x753f('0x48')]=_['keys'](_0x4fbd01[_0x753f('0x48')]);_0xd5df6e[_0x753f('0x49')]=_[_0x753f('0x4a')](_0xd5df6e[_0x753f('0x4b')],_0xd5df6e[_0x753f('0x48')]);_0x20889a[_0x753f('0x4c')]=_['intersection'](_0xd5df6e[_0x753f('0x4b')],qs[_0x753f('0x4d')](_0x4fbd01['query'][_0x753f('0x4d')]));_0x20889a['attributes']=_0x20889a[_0x753f('0x4c')]['length']?_0x20889a['attributes']:_0xd5df6e[_0x753f('0x4b')];if(!_0x4fbd01[_0x753f('0x48')][_0x753f('0x4f')](_0x753f('0x50'))){_0x20889a[_0x753f('0x51')]=qs['limit'](_0x4fbd01[_0x753f('0x48')][_0x753f('0x51')]);_0x20889a[_0x753f('0x30')]=qs[_0x753f('0x30')](_0x4fbd01[_0x753f('0x48')][_0x753f('0x30')]);}_0x20889a['order']=qs[_0x753f('0x6d')](_0x4fbd01['query'][_0x753f('0x6d')]);_0x20889a[_0x753f('0x53')]=qs[_0x753f('0x49')](_['pick'](_0x4fbd01[_0x753f('0x48')],_0xd5df6e[_0x753f('0x49')]));_0x20889a[_0x753f('0x53')][_0x753f('0x69')]=_0x3de809['id'];if(_0x4fbd01['query'][_0x753f('0x55')]){_0x20889a[_0x753f('0x53')]=_[_0x753f('0x5f')](_0x20889a[_0x753f('0x53')],{'$or':_['map'](_0x20889a[_0x753f('0x4c')],function(_0x103179){var _0x2a3ae9={};_0x2a3ae9[_0x103179]={'$like':'%'+_0x4fbd01[_0x753f('0x48')]['filter']+'%'};return _0x2a3ae9;})});}_0x20889a=_[_0x753f('0x5f')]({},_0x20889a,_0x4fbd01[_0x753f('0x57')]);return db[_0x753f('0x70')][_0x753f('0x32')]({'where':_0x20889a['where']})[_0x753f('0x23')](function(_0x466e49){_0x321c9d['count']=_0x466e49;if(_0x4fbd01[_0x753f('0x48')][_0x753f('0x58')]){_0x20889a[_0x753f('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0x753f('0x5a')](_0x20889a);})['then'](function(_0x25d8ec){_0x321c9d[_0x753f('0x5b')]=_0x25d8ec;return _0x321c9d;});}})[_0x753f('0x23')](respondWithFilteredResult(_0x2eb175,_0x20889a))[_0x753f('0x2c')](handleError(_0x2eb175,null));};exports['removeAnswers']=function(_0x5376d8,_0x3faefe,_0x327178){return db[_0x753f('0x43')]['find']({'where':{'id':_0x5376d8[_0x753f('0x5d')]['id']}})[_0x753f('0x23')](handleEntityNotFound(_0x3faefe,null))[_0x753f('0x23')](function(_0x559d74){if(_0x559d74){return _0x559d74['removeAnswers'](_0x5376d8['query'][_0x753f('0x72')]);}})['then'](respondWithStatusCode(_0x3faefe,null))[_0x753f('0x2c')](handleError(_0x3faefe,null));};exports[_0x753f('0x73')]=function(_0x287665,_0x4b5a0c,_0x2c2c9b){var _0x51140b={'body':_0x287665[_0x753f('0x62')],'channel':_0x753f('0x74')};var _0x81705e=[];var _0x1bde4b=[];var _0x18d63a={};var _0x4e94df=![];return db[_0x753f('0x75')][_0x753f('0x68')]()['then'](function(_0x26b638){if(!_0x26b638){throw new db[(_0x753f('0x76'))][(_0x753f('0x77'))](_0x753f('0x78'));}_0x81705e=_['difference'](_[_0x753f('0x5e')](_0x26b638),[_0x753f('0x79'),_0x753f('0x7a')]);_0x1bde4b=_[_0x753f('0x7b')](_[_0x753f('0x5e')](_0x26b638),['createdAt','updatedAt','CompanyId','ListId']);if(_0x287665[_0x753f('0x62')]['id']){delete _0x287665[_0x753f('0x62')]['id'];}if(_['isNil'](_0x287665[_0x753f('0x62')][_0x753f('0x7c')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0x753f('0x7d')](_0x287665[_0x753f('0x62')][_0x753f('0x62')])||_0x287665[_0x753f('0x62')]['body']===''){throw new db['Sequelize'][(_0x753f('0x77'))](_0x753f('0x7e'));}if(_['isNil'](_0x287665[_0x753f('0x62')][_0x753f('0x7f')])){throw new db[(_0x753f('0x76'))][(_0x753f('0x77'))](_0x753f('0x80')+_0x1bde4b);}if(!_[_0x753f('0x81')](_0x1bde4b,_0x287665[_0x753f('0x62')]['mapKey'])){throw new db[(_0x753f('0x76'))][(_0x753f('0x77'))](_0x753f('0x82')+_0x1bde4b);}_0x18d63a[_0x287665[_0x753f('0x62')]['mapKey']]=_0x287665['body'][_0x753f('0x7c')];})[_0x753f('0x23')](function(){return db[_0x753f('0x43')]['find']({'where':{'id':_0x287665['params']['id']},'include':[{'model':db[_0x753f('0x83')],'as':_0x753f('0x84'),'include':[{'model':db[_0x753f('0x75')],'as':'Contacts','where':_0x18d63a,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x753f('0x85')],'as':'Applications'}]});})[_0x753f('0x23')](handleEntityNotFound(_0x4b5a0c,null))[_0x753f('0x23')](function(_0x5d85b4){if(_0x5d85b4&&_0x5d85b4[_0x753f('0x84')]){_0x51140b[_0x753f('0x86')]=_0x5d85b4;_0x51140b[_0x753f('0x87')]=_0x5d85b4['Applications'];_0x51140b['list']=_0x5d85b4[_0x753f('0x84')];_0x51140b['applications']=_[_0x753f('0x88')](_0x51140b['applications'],[_0x753f('0x89')],['asc']);if(_0x51140b[_0x753f('0x86')]['Applications']){delete _0x51140b[_0x753f('0x86')][_0x753f('0x8a')];}if(_0x51140b[_0x753f('0x86')][_0x753f('0x84')]&&_0x51140b['account'][_0x753f('0x84')][_0x753f('0x8b')][_0x753f('0x4e')]){return _0x51140b[_0x753f('0x86')][_0x753f('0x84')][_0x753f('0x8b')][0x0];}var _0x22fced=_[_0x753f('0x1c')](_0x287665[_0x753f('0x62')],{'firstName':_0x287665[_0x753f('0x62')][_0x753f('0x7c')],'ListId':_0x5d85b4['ListId']});_0x22fced[_0x287665[_0x753f('0x62')]['mapKey']]=_0x287665[_0x753f('0x62')][_0x753f('0x7c')];return db[_0x753f('0x75')][_0x753f('0x61')](_0x22fced,{'fields':_0x81705e,'raw':!![]});}})[_0x753f('0x23')](handleEntityNotFound(_0x4b5a0c,null))[_0x753f('0x23')](function(_0x34bb4b){_0x51140b[_0x753f('0x8c')]=_0x34bb4b;if(_0x34bb4b){var _0x35c938={'ContactId':_0x34bb4b['id'],'OpenchannelAccountId':_0x287665['params']['id'],'from':(_0x34bb4b['firstName']||'')+'\x20'+(_0x34bb4b[_0x753f('0x8d')]||'')};var _0x275539={'OpenchannelAccountId':_0x287665['params']['id'],'closed':![]};if(_0x287665[_0x753f('0x62')][_0x753f('0x8e')]){_0x275539[_0x753f('0x8e')]=_0x287665[_0x753f('0x62')][_0x753f('0x8e')];return db[_0x753f('0x8f')][_0x753f('0x60')]({'where':_0x275539})[_0x753f('0x23')](function(_0x1d642d){if(_0x1d642d){return[_0x1d642d,![]];}_0x35c938[_0x753f('0x8e')]=_0x287665[_0x753f('0x62')][_0x753f('0x8e')];_0x35c938['externalUrl']=_0x287665[_0x753f('0x62')][_0x753f('0x90')];return db['OpenchannelInteraction']['create'](_0x35c938)[_0x753f('0x23')](function(_0x367d96){return[_0x367d96,!![]];});});}else{_0x275539[_0x753f('0x8e')]=null;}_0x275539[_0x753f('0x91')]=_0x34bb4b['id'];return db[_0x753f('0x8f')]['find']({'where':_0x275539})[_0x753f('0x23')](function(_0x2df52c){if(_0x2df52c){return[_0x2df52c,![]];}return db[_0x753f('0x8f')][_0x753f('0x61')](_0x35c938)['then'](function(_0x10b194){return[_0x10b194,!![]];});});}})[_0x753f('0x92')](function(_0x4eb643,_0x56c25f){if(_0x4eb643){_0x4e94df=_0x56c25f;if(!_0x56c25f){var _0x10829d={'from':(_0x51140b[_0x753f('0x8c')]['firstName']||'')+'\x20'+(_0x51140b[_0x753f('0x8c')][_0x753f('0x8d')]||'')};if(_0x287665[_0x753f('0x62')][_0x753f('0x8e')]&&_0x287665['body'][_0x753f('0x93')]&&_0x287665['body'][_0x753f('0x8e')]!=_0x287665[_0x753f('0x62')]['messageId']){_0x10829d[_0x753f('0x8e')]=_0x287665[_0x753f('0x62')][_0x753f('0x93')];}return _0x4eb643[_0x753f('0x36')](_0x10829d);}else{return _0x4eb643;}}})[_0x753f('0x23')](function(_0x5d69a6){_0x51140b[_0x753f('0x94')]=_0x5d69a6[_0x753f('0x38')]({'plain':!![]});_0x51140b[_0x753f('0x94')][_0x753f('0x95')]=_0x4e94df;if(_0x51140b['interaction']['created']){if(_0x51140b[_0x753f('0x86')]['autoclose']){_0x51140b[_0x753f('0x87')][_0x753f('0x96')]({'id':0x0,'priority':_0x51140b[_0x753f('0x87')][_0x753f('0x4e')]+0x1,'app':_0x753f('0x97'),'appdata':_0x753f('0x98'),'interval':_0x753f('0x99')});}}return db['OpenchannelMessage'][_0x753f('0x61')]({'body':_0x287665['body'][_0x753f('0x62')],'OpenchannelAccountId':_0x287665[_0x753f('0x5d')]['id'],'OpenchannelInteractionId':_0x5d69a6['id'],'direction':'in','ContactId':_0x51140b[_0x753f('0x8c')]['id'],'AttachmentId':_0x287665[_0x753f('0x62')][_0x753f('0x9a')]});})[_0x753f('0x23')](function(_0xec405e){_0x51140b[_0x753f('0x29')]=_0xec405e;if(_0x51140b[_0x753f('0x94')]['UserId']){return db[_0x753f('0x9b')][_0x753f('0x60')]({'attributes':['id',_0x753f('0x3d')],'where':{'id':_0x51140b[_0x753f('0x94')]['UserId']}})[_0x753f('0x23')](function(_0x5e4dc2){if(_0x5e4dc2){_0x51140b[_0x753f('0x87')][_0x753f('0x9c')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5e4dc2['name']+','+(_0x51140b[_0x753f('0x86')][_0x753f('0x9d')]||0xa),'interval':'*,*,*,*'});_0x51140b[_0x753f('0x9e')]=![];}return respondWithRpcPromise(_0x753f('0x9f'),_0x753f('0xa0'),_0x51140b);});}return respondWithRpcPromise(_0x753f('0x9f'),_0x753f('0xa0'),_0x51140b);})['then'](function(_0x33dd21){respondWithRpcPromise(_0x753f('0xa1'),'EventManager',{'event':_0x753f('0x73'),'message':_0x33dd21},client9002);return _0x33dd21;})[_0x753f('0x23')](respondWithResult(_0x4b5a0c,null))[_0x753f('0x2c')](handleError(_0x4b5a0c,null));};exports[_0x753f('0xa2')]=function(_0x19bd0b,_0x4d1757){var _0x9b5929=_0x19bd0b[_0x753f('0x5d')]['id'];var _0x4ef7fa=_0x19bd0b[_0x753f('0x62')];var _0x48d559=0xc8;var _0x381c74=null;return db[_0x753f('0xa3')]['transaction']({'isolationLevel':db[_0x753f('0xa3')][_0x753f('0xa4')][_0x753f('0xa5')][_0x753f('0xa6')]},function(_0x538cc3){return db[_0x753f('0x43')][_0x753f('0x6c')]({'where':{'id':_0x9b5929},'transaction':_0x538cc3})['then'](function(_0x4aa134){if(_0x4aa134){return db['OpenchannelApplication'][_0x753f('0x37')]({'where':{'OpenchannelAccountId':_0x9b5929},'transaction':_0x538cc3})['then'](function(){var _0x512033=_[_0x753f('0x42')](_0x4ef7fa,function(_0x321c49){_0x321c49[_0x753f('0x69')]=_0x9b5929;return _0x321c49;});return db[_0x753f('0x85')][_0x753f('0xa7')](_0x512033,{'transaction':_0x538cc3});});}else{_0x48d559=0x194;_0x381c74=[];}});})['then'](function(){if(_0x48d559!==0x194){return db[_0x753f('0x85')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x9b5929},'order':_0x753f('0x89')})[_0x753f('0x23')](function(_0x4092c5){_0x381c74=_0x4092c5;});}})[_0x753f('0x2c')](function(_0x531e40){_0x48d559=0x1f4;logger['error'](_0x531e40[_0x753f('0x3c')]);if(_0x531e40['name']){delete _0x531e40['name'];}_0x381c74=_0x531e40;})[_0x753f('0xa8')](function(){if(_0x381c74===null){_0x4d1757[_0x753f('0x2d')](_0x48d559);}else{if(_0x48d559===0x1f4){_0x4d1757[_0x753f('0x2e')](_0x48d559)[_0x753f('0x3e')](_0x381c74);}else{_0x4d1757[_0x753f('0x2e')](_0x48d559)[_0x753f('0x2f')](_0x381c74);}}});};exports[_0x753f('0xa9')]=function(_0x13e82c,_0x4e7c32,_0x2b69f3){var _0x5494fb={};var _0x340c42={};var _0x2ae9f3;var _0x52d1c6;return db[_0x753f('0x43')][_0x753f('0x6c')]({'where':{'id':_0x13e82c[_0x753f('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4e7c32,null))['then'](function(_0x3a1df9){if(_0x3a1df9){_0x2ae9f3=_0x3a1df9;_0x340c42[_0x753f('0x4b')]=_[_0x753f('0x5e')](db['OpenchannelApplication'][_0x753f('0x44')]);_0x340c42[_0x753f('0x48')]=_['keys'](_0x13e82c[_0x753f('0x48')]);_0x340c42['filters']=_[_0x753f('0x4a')](_0x340c42['model'],_0x340c42[_0x753f('0x48')]);_0x5494fb['attributes']=_[_0x753f('0x4a')](_0x340c42[_0x753f('0x4b')],qs[_0x753f('0x4d')](_0x13e82c[_0x753f('0x48')]['fields']));_0x5494fb[_0x753f('0x4c')]=_0x5494fb['attributes'][_0x753f('0x4e')]?_0x5494fb['attributes']:_0x340c42[_0x753f('0x4b')];_0x5494fb[_0x753f('0x52')]=qs[_0x753f('0x6d')](_0x13e82c[_0x753f('0x48')][_0x753f('0x6d')]);_0x5494fb[_0x753f('0x53')]=qs[_0x753f('0x49')](_[_0x753f('0x54')](_0x13e82c[_0x753f('0x48')],_0x340c42[_0x753f('0x49')]));if(_0x13e82c[_0x753f('0x48')][_0x753f('0x55')]){_0x5494fb[_0x753f('0x53')]=_[_0x753f('0x5f')](_0x5494fb[_0x753f('0x53')],{'$or':_['map'](_0x5494fb[_0x753f('0x4c')],function(_0x5f52a6){var _0x2b8119={};_0x2b8119[_0x5f52a6]={'$like':'%'+_0x13e82c[_0x753f('0x48')]['filter']+'%'};return _0x2b8119;})});}_0x5494fb=_[_0x753f('0x5f')]({},_0x5494fb,_0x13e82c[_0x753f('0x57')]);return _0x2ae9f3[_0x753f('0xa9')](_0x5494fb);}})[_0x753f('0x23')](function(_0xd889df){if(_0xd889df){_0x52d1c6=_0xd889df[_0x753f('0x4e')];if(!_0x13e82c['query']['hasOwnProperty'](_0x753f('0x50'))){_0x5494fb[_0x753f('0x51')]=qs[_0x753f('0x51')](_0x13e82c[_0x753f('0x48')][_0x753f('0x51')]);_0x5494fb[_0x753f('0x30')]=qs[_0x753f('0x30')](_0x13e82c[_0x753f('0x48')][_0x753f('0x30')]);}return _0x2ae9f3[_0x753f('0xa9')](_0x5494fb);}})['then'](function(_0x2031c6){if(_0x2031c6){return _0x2031c6?{'count':_0x52d1c6,'rows':_0x2031c6}:null;}})[_0x753f('0x23')](respondWithResult(_0x4e7c32,null))[_0x753f('0x2c')](handleError(_0x4e7c32,null));};exports[_0x753f('0xaa')]=function(_0x4b6b61,_0x49fb14,_0x347216){var _0x18ae69={'raw':![],'where':{}};var _0x2d23df={};var _0x20894a={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x753f('0x6c')]({'where':{'id':_0x4b6b61[_0x753f('0x5d')]['id']}})[_0x753f('0x23')](handleEntityNotFound(_0x49fb14,null))['then'](function(_0x468ced){if(_0x468ced){_0x2d23df[_0x753f('0x4b')]=_[_0x753f('0x5e')](db[_0x753f('0x8f')][_0x753f('0x44')]);_0x2d23df[_0x753f('0x48')]=_[_0x753f('0x5e')](_0x4b6b61[_0x753f('0x48')]);_0x2d23df[_0x753f('0x49')]=_[_0x753f('0x4a')](_0x2d23df[_0x753f('0x4b')],_0x2d23df[_0x753f('0x48')]);_0x18ae69['attributes']=_[_0x753f('0x4a')](_0x2d23df['model'],qs[_0x753f('0x4d')](_0x4b6b61[_0x753f('0x48')][_0x753f('0x4d')]));_0x18ae69[_0x753f('0x4c')]=_0x18ae69[_0x753f('0x4c')][_0x753f('0x4e')]?_0x18ae69[_0x753f('0x4c')]:_0x2d23df[_0x753f('0x4b')];if(!_0x4b6b61[_0x753f('0x48')][_0x753f('0x4f')]('nolimit')){_0x18ae69[_0x753f('0x51')]=qs['limit'](_0x4b6b61[_0x753f('0x48')][_0x753f('0x51')]);_0x18ae69['offset']=qs['offset'](_0x4b6b61[_0x753f('0x48')][_0x753f('0x30')]);}_0x18ae69[_0x753f('0x52')]=qs[_0x753f('0x6d')](_0x4b6b61['query'][_0x753f('0x6d')]);_0x18ae69[_0x753f('0x53')]=qs[_0x753f('0x49')](_[_0x753f('0x54')](_0x4b6b61['query'],_0x2d23df[_0x753f('0x49')]));_0x18ae69[_0x753f('0x53')][_0x753f('0x69')]=_0x468ced['id'];if(_0x4b6b61[_0x753f('0x48')][_0x753f('0x55')]){_0x18ae69[_0x753f('0x53')]=_[_0x753f('0x5f')](_0x18ae69[_0x753f('0x53')],{'$or':_['map'](_0x18ae69[_0x753f('0x4c')],function(_0x17dd72){var _0x584703={};_0x584703[_0x17dd72]={'$like':'%'+_0x4b6b61[_0x753f('0x48')][_0x753f('0x55')]+'%'};return _0x584703;})});}_0x18ae69=_[_0x753f('0x5f')]({},_0x18ae69,_0x4b6b61[_0x753f('0x57')]);return db[_0x753f('0x8f')][_0x753f('0x32')]({'where':_0x18ae69[_0x753f('0x53')]})['then'](function(_0x46be28){_0x20894a[_0x753f('0x32')]=_0x46be28;if(_0x4b6b61[_0x753f('0x48')]['includeAll']){_0x18ae69[_0x753f('0x59')]=[{'model':db['CmContact'],'as':_0x753f('0xab'),'required':![]},{'model':db[_0x753f('0x9b')],'as':_0x753f('0xac'),'attributes':['name',_0x753f('0xad'),'internal'],'required':![]},{'model':db[_0x753f('0xae')],'as':_0x753f('0xaf'),'attributes':['id',_0x753f('0x3d'),_0x753f('0xb0')],'where':_0x4b6b61[_0x753f('0x48')][_0x753f('0xb1')]?{'id':_0x4b6b61[_0x753f('0x48')]['tag']}:undefined,'required':_0x4b6b61[_0x753f('0x48')][_0x753f('0xb1')]?!![]:![]}];}return db[_0x753f('0x8f')][_0x753f('0x5a')](_0x18ae69);})[_0x753f('0x23')](function(_0x4980ce){_0x20894a['rows']=_0x4980ce;return _0x20894a;});}})[_0x753f('0x23')](respondWithFilteredResult(_0x49fb14,_0x18ae69))['catch'](handleError(_0x49fb14,null));};exports['addAgents']=function(_0x35145f,_0xcbc0d1,_0x421c00){return db[_0x753f('0x43')][_0x753f('0x60')]({'where':{'id':_0x35145f['params']['id']}})['then'](handleEntityNotFound(_0xcbc0d1,null))[_0x753f('0x23')](function(_0xe64d03){if(_0xe64d03){return _0xe64d03[_0x753f('0xb2')](_0x35145f[_0x753f('0x62')][_0x753f('0x72')],_[_0x753f('0xb3')](_0x35145f['body'],[_0x753f('0x72'),'id'])||{})['spread'](function(_0x988362){for(var _0x2e15bf=0x0;_0x2e15bf<_0x35145f[_0x753f('0x62')]['ids'][_0x753f('0x4e')];_0x2e15bf+=0x1){socket['emit']('userOpenchannelAccount:save',{'UserId':Number(_0x35145f[_0x753f('0x62')][_0x753f('0x72')][_0x2e15bf]),'OpenchannelAccountId':Number(_0x35145f[_0x753f('0x5d')]['id'])});}return _0x988362;});}})['then'](respondWithResult(_0xcbc0d1,null))[_0x753f('0x2c')](handleError(_0xcbc0d1,null));};exports[_0x753f('0xb4')]=function(_0x4daf63,_0x52a461,_0x3d585a){return db[_0x753f('0x43')][_0x753f('0x60')]({'where':{'id':_0x4daf63[_0x753f('0x5d')]['id']}})[_0x753f('0x23')](handleEntityNotFound(_0x52a461,null))[_0x753f('0x23')](function(_0x36eabb){if(_0x36eabb){return _0x36eabb[_0x753f('0xb4')](_0x4daf63[_0x753f('0x48')]['ids'])[_0x753f('0x23')](function(){if(_[_0x753f('0xb5')](_0x4daf63[_0x753f('0x48')][_0x753f('0x72')])){for(var _0x10b6b4=0x0;_0x10b6b4<_0x4daf63[_0x753f('0x48')][_0x753f('0x72')][_0x753f('0x4e')];_0x10b6b4+=0x1){socket['emit'](_0x753f('0xb6'),{'UserId':Number(_0x4daf63['query'][_0x753f('0x72')][_0x10b6b4]),'OpenchannelAccountId':Number(_0x4daf63[_0x753f('0x5d')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x4daf63['query']['ids']),'OpenchannelAccountId':Number(_0x4daf63[_0x753f('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x52a461,null))['catch'](handleError(_0x52a461,null));};exports[_0x753f('0xb7')]=function(_0x4edc04,_0x30f55e,_0x3509c7){var _0x348c78={};var _0x5a3635={};var _0x38ff19;var _0x2205c5;return db[_0x753f('0x43')]['findOne']({'where':{'id':_0x4edc04['params']['id']}})['then'](handleEntityNotFound(_0x30f55e,null))[_0x753f('0x23')](function(_0x4aa588){if(_0x4aa588){_0x38ff19=_0x4aa588;_0x5a3635[_0x753f('0x4b')]=_[_0x753f('0x5e')](db['User'][_0x753f('0x44')]);_0x5a3635[_0x753f('0x48')]=_['keys'](_0x4edc04[_0x753f('0x48')]);_0x5a3635[_0x753f('0x49')]=_[_0x753f('0x4a')](_0x5a3635[_0x753f('0x4b')],_0x5a3635[_0x753f('0x48')]);_0x348c78[_0x753f('0x4c')]=_[_0x753f('0x4a')](_0x5a3635[_0x753f('0x4b')],qs['fields'](_0x4edc04[_0x753f('0x48')]['fields']));_0x348c78[_0x753f('0x4c')]=_0x348c78['attributes']['length']?_0x348c78[_0x753f('0x4c')]:_0x5a3635[_0x753f('0x4b')];_0x348c78['order']=qs[_0x753f('0x6d')](_0x4edc04[_0x753f('0x48')][_0x753f('0x6d')]);_0x348c78['where']=qs[_0x753f('0x49')](_[_0x753f('0x54')](_0x4edc04['query'],_0x5a3635['filters']));if(_0x4edc04[_0x753f('0x48')][_0x753f('0x55')]){_0x348c78[_0x753f('0x53')]=_[_0x753f('0x5f')](_0x348c78[_0x753f('0x53')],{'$or':_[_0x753f('0x42')](_0x348c78[_0x753f('0x4c')],function(_0x4e8b72){var _0x133ea2={};_0x133ea2[_0x4e8b72]={'$like':'%'+_0x4edc04[_0x753f('0x48')][_0x753f('0x55')]+'%'};return _0x133ea2;})});}_0x348c78=_['merge']({},_0x348c78,_0x4edc04[_0x753f('0x57')]);return _0x38ff19[_0x753f('0xb7')](_0x348c78);}})[_0x753f('0x23')](function(_0x8f1b81){if(_0x8f1b81){_0x2205c5=_0x8f1b81['length'];if(!_0x4edc04[_0x753f('0x48')]['hasOwnProperty'](_0x753f('0x50'))){_0x348c78['limit']=qs[_0x753f('0x51')](_0x4edc04['query'][_0x753f('0x51')]);_0x348c78[_0x753f('0x30')]=qs[_0x753f('0x30')](_0x4edc04[_0x753f('0x48')][_0x753f('0x30')]);}return _0x38ff19['getAgents'](_0x348c78);}})['then'](function(_0x106083){if(_0x106083){return _0x106083?{'count':_0x2205c5,'rows':_0x106083}:null;}})[_0x753f('0x23')](respondWithResult(_0x30f55e,null))[_0x753f('0x2c')](handleError(_0x30f55e,null));};exports[_0x753f('0x3e')]=function(_0xb84222,_0x25dbdf,_0x15b89a){var _0x39fddf,_0x3e7ccd,_0x49bc7b;if(_[_0x753f('0x7d')](_0xb84222[_0x753f('0x62')]['body'])||_0xb84222['body'][_0x753f('0x62')]===''){throw new db[(_0x753f('0x76'))][(_0x753f('0x77'))](_0x753f('0x7e'));}if(_[_0x753f('0x7d')](_0xb84222[_0x753f('0x62')]['to'])){}_0x39fddf=_0xb84222[_0x753f('0x62')]['to'];return db['OpenchannelAccount'][_0x753f('0x6c')]({'where':{'id':_0xb84222[_0x753f('0x5d')]['id']}})['then'](handleEntityNotFound(_0x25dbdf,null))[_0x753f('0x23')](function(_0x221396){if(_0x221396){return db[_0x753f('0x43')][_0x753f('0x60')]({'where':{'id':_0x221396['id']},'include':[{'model':db['CmList'],'as':_0x753f('0x84'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0x221396[_0x753f('0x7f')]]:_0x39fddf},'limit':0x1,'order':[[_0x753f('0x7a'),_0x753f('0xb8')]]}]}]})['then'](handleEntityNotFound(_0x25dbdf,null))[_0x753f('0x23')](function(_0xda29a){if(_0xda29a&&_0xda29a[_0x753f('0x84')]){_0x3e7ccd=_0xda29a[_0x753f('0x38')]({'plain':!![]});if(_0x3e7ccd[_0x753f('0x84')]&&_0x3e7ccd['List'][_0x753f('0x8b')][_0x753f('0x4e')]){return _0x3e7ccd['List'][_0x753f('0x8b')][0x0];}return db['CmContact'][_0x753f('0x61')](_[_0x753f('0x1c')](_0xb84222[_0x753f('0x62')],{'firstName':_0x39fddf,[_0xda29a[_0x753f('0x7f')]]:_0x39fddf,'phone':_0x39fddf,'ListId':_0x3e7ccd[_0x753f('0xb9')]}));}})[_0x753f('0x23')](handleEntityNotFound(_0x25dbdf,null))[_0x753f('0x23')](function(_0x31a7d7){if(_0x31a7d7){_0x49bc7b=_0x31a7d7;return db[_0x753f('0x8f')]['find']({'where':{'ContactId':_0x49bc7b['id'],'closed':![],'OpenchannelAccountId':_0x3e7ccd['id']}})[_0x753f('0x23')](function(_0x318f4f){if(_0x318f4f){return[_0x318f4f,![]];}return db['OpenchannelInteraction'][_0x753f('0x61')]({'UserId':_0xb84222[_0x753f('0x63')]['id'],'ContactId':_0x49bc7b['id'],'OpenchannelAccountId':_0x3e7ccd['id'],'lastMsgDirection':_0x753f('0xba'),'firstMsgDirection':_0x753f('0xba'),'Messages':[_[_0x753f('0x5f')](_0xb84222['body'],{'read':![],'body':_0xb84222[_0x753f('0x62')]['body'],'OpenchannelAccountId':_0x3e7ccd['id'],'UserId':_0xb84222[_0x753f('0x63')]['id'],'ContactId':_0x49bc7b['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0x753f('0x23')](function(_0x7205dd){return[_0x7205dd,!![]];});});}})[_0x753f('0x92')](function(_0x8613eb,_0x2a93b0){if(_0x2a93b0){return _0x8613eb;}return db[_0x753f('0xbb')][_0x753f('0x61')](_[_0x753f('0x5f')](_0xb84222[_0x753f('0x62')],{'read':![],'body':_0xb84222['body'][_0x753f('0x62')],'OpenchannelAccountId':_0x3e7ccd['id'],'OpenchannelInteractionId':_0x8613eb['id'],'UserId':_0xb84222['user']['id'],'ContactId':_0x49bc7b['id']}))['then'](function(_0x56175d){_0x8613eb[_0x753f('0xbc')][_0x753f('0xbd')]=[];_0x8613eb[_0x753f('0xbc')][_0x753f('0xbd')]['push'](_0x56175d['dataValues']);return _0x8613eb;});});}})[_0x753f('0x23')](respondWithResult(_0x25dbdf,null))['catch'](handleError(_0x25dbdf,null));}; \ No newline at end of file +var _0x84e1=['create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','body','describe','addDisposition','OpenchannelAccountId','findOne','hasOwnProperty','Disposition','includeAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','difference','updatedAt','createdAt','isNil','from','ValidationError','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','list','applications','orderBy','priority','ListId','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','stack','getApplications','getInteractions','Owner','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','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/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','OpenchannelAccounts','UserProfileResource','sendStatus','name','send','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','findAll','show','params','include','find'];(function(_0x47041d,_0x42153f){var _0x5022bd=function(_0x1dbb9a){while(--_0x1dbb9a){_0x47041d['push'](_0x47041d['shift']());}};_0x5022bd(++_0x42153f);}(_0x84e1,0x1dc));var _0x184e=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x84e1[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x184e('0x0'));var rimraf=require(_0x184e('0x1'));var zipdir=require(_0x184e('0x2'));var jsonpatch=require(_0x184e('0x3'));var rp=require(_0x184e('0x4'));var moment=require(_0x184e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x184e('0x6'));var util=require(_0x184e('0x7'));var path=require(_0x184e('0x8'));var sox=require(_0x184e('0x9'));var csv=require(_0x184e('0xa'));var ejs=require(_0x184e('0xb'));var fs=require('fs');var fs_extra=require(_0x184e('0xc'));var _=require('lodash');var squel=require(_0x184e('0xd'));var crypto=require(_0x184e('0xe'));var jsforce=require(_0x184e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x184e('0xa'));var querystring=require(_0x184e('0x10'));var Papa=require(_0x184e('0x11'));var Redis=require(_0x184e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x184e('0x13'));var as=require(_0x184e('0x14'));var hardwareService=require(_0x184e('0x15'));var logger=require(_0x184e('0x16'))(_0x184e('0x17'));var utils=require(_0x184e('0x18'));var config=require(_0x184e('0x19'));var licenseUtil=require(_0x184e('0x1a'));var db=require(_0x184e('0x1b'))['db'];config[_0x184e('0x1c')]=_[_0x184e('0x1d')](config[_0x184e('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x184e('0x1e'))(new Redis(config['redis']));require(_0x184e('0x1f'))[_0x184e('0x20')](socket);var jayson=require(_0x184e('0x21'));var client=jayson[_0x184e('0x22')][_0x184e('0x23')]({'port':0x232c});var client9002=jayson[_0x184e('0x22')][_0x184e('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x374153,_0x10b179,_0x4c5442,_0x1f3d61){return new BPromise(function(_0x5d3a36,_0x3c561a){var _0x4ce10a=_0x1f3d61||client;return _0x4ce10a['request'](_0x374153,_0x4c5442)[_0x184e('0x24')](function(_0x12d361){logger[_0x184e('0x25')](_0x184e('0x26'),_0x10b179,_0x184e('0x27'));logger[_0x184e('0x28')](_0x184e('0x29'),_0x10b179,_0x184e('0x27'),JSON['stringify'](_0x12d361));if(_0x12d361['error']){if(_0x12d361[_0x184e('0x2a')][_0x184e('0x2b')]===0x1f4){logger[_0x184e('0x2a')](_0x184e('0x26'),_0x10b179,_0x12d361[_0x184e('0x2a')]['message']);return _0x3c561a(_0x12d361[_0x184e('0x2a')][_0x184e('0x2c')]);}logger[_0x184e('0x2a')](_0x184e('0x26'),_0x10b179,_0x12d361[_0x184e('0x2a')][_0x184e('0x2c')]);return _0x5d3a36(_0x12d361[_0x184e('0x2a')][_0x184e('0x2c')]);}else{logger[_0x184e('0x25')](_0x184e('0x26'),_0x10b179,_0x184e('0x27'));_0x5d3a36(_0x12d361['result'][_0x184e('0x2c')]);}})[_0x184e('0x2d')](function(_0x5f24cf){logger[_0x184e('0x2a')](_0x184e('0x26'),_0x10b179,_0x5f24cf);_0x3c561a(_0x5f24cf);});});}function respondWithStatusCode(_0x31bf1d,_0x43637a){_0x43637a=_0x43637a||0xcc;return function(_0x3a8f05){if(_0x3a8f05){return _0x31bf1d['sendStatus'](_0x43637a);}return _0x31bf1d[_0x184e('0x2e')](_0x43637a)['end']();};}function respondWithResult(_0x1c5bde,_0x25eed5){_0x25eed5=_0x25eed5||0xc8;return function(_0x55e987){if(_0x55e987){return _0x1c5bde[_0x184e('0x2e')](_0x25eed5)[_0x184e('0x2f')](_0x55e987);}};}function respondWithFilteredResult(_0x42a11e,_0x424f62){return function(_0x5600cc){if(_0x5600cc){var _0x5753ea=typeof _0x424f62[_0x184e('0x30')]===_0x184e('0x31')&&typeof _0x424f62[_0x184e('0x32')]===_0x184e('0x31');var _0x23385e=_0x5600cc[_0x184e('0x33')];var _0x1159cb=_0x5753ea?0x0:_0x424f62[_0x184e('0x30')];var _0x5cb999=_0x5753ea?_0x5600cc[_0x184e('0x33')]:_0x424f62[_0x184e('0x30')]+_0x424f62['limit'];var _0x24eae5;if(_0x5cb999>=_0x23385e){_0x5cb999=_0x23385e;_0x24eae5=0xc8;}else{_0x24eae5=0xce;}_0x42a11e[_0x184e('0x2e')](_0x24eae5);return _0x42a11e[_0x184e('0x34')]('Content-Range',_0x1159cb+'-'+_0x5cb999+'/'+_0x23385e)[_0x184e('0x2f')](_0x5600cc);}return null;};}function patchUpdates(_0x4da4cb){return function(_0x535fdb){try{jsonpatch[_0x184e('0x35')](_0x535fdb,_0x4da4cb,!![]);}catch(_0x444de4){return BPromise['reject'](_0x444de4);}return _0x535fdb[_0x184e('0x36')]();};}function saveUpdates(_0x169dd5,_0x2bd604){return function(_0x9f3c29){if(_0x9f3c29){return _0x9f3c29[_0x184e('0x37')](_0x169dd5)[_0x184e('0x24')](function(_0xfc3abc){return _0xfc3abc;});}return null;};}function removeEntity(_0x243c29,_0x3195a8){return function(_0x514472){if(_0x514472){return _0x514472[_0x184e('0x38')]()[_0x184e('0x24')](function(){var _0x342274=_0x514472['get']({'plain':!![]});var _0x531bd9=_0x184e('0x39');return db[_0x184e('0x3a')][_0x184e('0x38')]({'where':{'type':_0x531bd9,'resourceId':_0x342274['id']}})[_0x184e('0x24')](function(){return _0x514472;});})[_0x184e('0x24')](function(){_0x243c29[_0x184e('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x120148,_0x4da188){return function(_0x204019){if(!_0x204019){_0x120148[_0x184e('0x3b')](0x194);}return _0x204019;};}function handleError(_0x457f79,_0x45831b){_0x45831b=_0x45831b||0x1f4;return function(_0x608f95){logger[_0x184e('0x2a')](_0x608f95['stack']);if(_0x608f95[_0x184e('0x3c')]){delete _0x608f95[_0x184e('0x3c')];}_0x457f79[_0x184e('0x2e')](_0x45831b)[_0x184e('0x3d')](_0x608f95);};}exports['index']=function(_0x44ba87,_0x4c0dc0){var _0x28d422={'include':[{'model':db[_0x184e('0x3e')],'as':_0x184e('0x3f')}]},_0x257b61={},_0x34e332={'count':0x0,'rows':[]};var _0x527eac=_['map'](db[_0x184e('0x40')][_0x184e('0x41')],function(_0x56b652){return{'name':_0x56b652[_0x184e('0x42')],'type':_0x56b652[_0x184e('0x43')][_0x184e('0x44')]};});_0x257b61[_0x184e('0x45')]=_[_0x184e('0x46')](_0x527eac,_0x184e('0x3c'));_0x257b61['query']=_[_0x184e('0x47')](_0x44ba87[_0x184e('0x48')]);_0x257b61[_0x184e('0x49')]=_[_0x184e('0x4a')](_0x257b61[_0x184e('0x45')],_0x257b61[_0x184e('0x48')]);_0x28d422[_0x184e('0x4b')]=_[_0x184e('0x4a')](_0x257b61[_0x184e('0x45')],qs[_0x184e('0x4c')](_0x44ba87[_0x184e('0x48')][_0x184e('0x4c')]));_0x28d422[_0x184e('0x4b')]=_0x28d422[_0x184e('0x4b')][_0x184e('0x4d')]?_0x28d422[_0x184e('0x4b')]:_0x257b61['model'];if(!_0x44ba87['query']['hasOwnProperty'](_0x184e('0x4e'))){_0x28d422[_0x184e('0x32')]=qs[_0x184e('0x32')](_0x44ba87[_0x184e('0x48')][_0x184e('0x32')]);_0x28d422[_0x184e('0x30')]=qs[_0x184e('0x30')](_0x44ba87[_0x184e('0x48')]['offset']);}_0x28d422[_0x184e('0x4f')]=qs['sort'](_0x44ba87[_0x184e('0x48')][_0x184e('0x50')]);_0x28d422[_0x184e('0x51')]=qs[_0x184e('0x49')](_[_0x184e('0x52')](_0x44ba87[_0x184e('0x48')],_0x257b61[_0x184e('0x49')]),_0x527eac);if(_0x44ba87['query'][_0x184e('0x53')]){_0x28d422['where']=_['merge'](_0x28d422[_0x184e('0x51')],{'$or':_[_0x184e('0x46')](_0x527eac,function(_0x5b787d){if(_0x5b787d[_0x184e('0x43')]!=='VIRTUAL'){var _0x25a961={};_0x25a961[_0x5b787d['name']]={'$like':'%'+_0x44ba87['query']['filter']+'%'};return _0x25a961;}})});}_0x28d422=_[_0x184e('0x54')]({},_0x28d422,_0x44ba87[_0x184e('0x55')]);var _0x14a72c={'where':_0x28d422[_0x184e('0x51')]};return db[_0x184e('0x40')][_0x184e('0x33')](_0x14a72c)['then'](function(_0x1cf8ad){_0x34e332[_0x184e('0x33')]=_0x1cf8ad;if(_0x44ba87[_0x184e('0x48')]['includeAll']){_0x28d422['include']=[{'all':!![]}];}return db[_0x184e('0x40')][_0x184e('0x56')](_0x28d422);})[_0x184e('0x24')](function(_0x2616db){_0x34e332['rows']=_0x2616db;return _0x34e332;})['then'](respondWithFilteredResult(_0x4c0dc0,_0x28d422))['catch'](handleError(_0x4c0dc0,null));};exports[_0x184e('0x57')]=function(_0x49267d,_0x1f796b){var _0x4e5861={'raw':![],'where':{'id':_0x49267d[_0x184e('0x58')]['id']},'include':[{'model':db[_0x184e('0x3e')],'as':'mandatoryDispositionPause'}]},_0x279a12={};_0x279a12[_0x184e('0x45')]=_['keys'](db[_0x184e('0x40')][_0x184e('0x41')]);_0x279a12[_0x184e('0x48')]=_['keys'](_0x49267d[_0x184e('0x48')]);_0x279a12[_0x184e('0x49')]=_['intersection'](_0x279a12[_0x184e('0x45')],_0x279a12[_0x184e('0x48')]);_0x4e5861['attributes']=_[_0x184e('0x4a')](_0x279a12[_0x184e('0x45')],qs[_0x184e('0x4c')](_0x49267d[_0x184e('0x48')][_0x184e('0x4c')]));_0x4e5861['attributes']=_0x4e5861[_0x184e('0x4b')][_0x184e('0x4d')]?_0x4e5861['attributes']:_0x279a12['model'];if(_0x49267d[_0x184e('0x48')]['includeAll']){_0x4e5861[_0x184e('0x59')]=[{'all':!![]}];}_0x4e5861=_[_0x184e('0x54')]({},_0x4e5861,_0x49267d[_0x184e('0x55')]);return db['OpenchannelAccount'][_0x184e('0x5a')](_0x4e5861)['then'](handleEntityNotFound(_0x1f796b,null))[_0x184e('0x24')](respondWithResult(_0x1f796b,null))[_0x184e('0x2d')](handleError(_0x1f796b,null));};exports[_0x184e('0x5b')]=function(_0xeb7106,_0x498281){return db[_0x184e('0x40')]['create'](_0xeb7106['body'],{})[_0x184e('0x24')](function(_0x4d8a2b){var _0x1b8fb6=_0xeb7106[_0x184e('0x5c')][_0x184e('0x5d')]({'plain':!![]});if(!_0x1b8fb6)throw new Error(_0x184e('0x5e'));if(_0x1b8fb6[_0x184e('0x5f')]==='user'){var _0x33cb65=_0x4d8a2b[_0x184e('0x5d')]({'plain':!![]});var _0x937e46=_0x184e('0x39');return db[_0x184e('0x60')][_0x184e('0x5a')]({'where':{'name':_0x937e46,'userProfileId':_0x1b8fb6['userProfileId']},'raw':!![]})['then'](function(_0x5f754){if(_0x5f754&&_0x5f754[_0x184e('0x61')]===0x0){return db['UserProfileResource'][_0x184e('0x5b')]({'name':_0x33cb65[_0x184e('0x3c')],'resourceId':_0x33cb65['id'],'type':_0x5f754[_0x184e('0x3c')],'sectionId':_0x5f754['id']},{})[_0x184e('0x24')](function(){return _0x4d8a2b;});}else{return _0x4d8a2b;}})[_0x184e('0x2d')](function(_0x24f97a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24f97a);throw _0x24f97a;});}return _0x4d8a2b;})[_0x184e('0x24')](respondWithResult(_0x498281,0xc9))[_0x184e('0x2d')](handleError(_0x498281,null));};exports[_0x184e('0x37')]=function(_0x1e59e2,_0x1ade39){if(_0x1e59e2['body']['id']){delete _0x1e59e2[_0x184e('0x62')]['id'];}return db['OpenchannelAccount'][_0x184e('0x5a')]({'where':{'id':_0x1e59e2[_0x184e('0x58')]['id']},'include':[{'model':db[_0x184e('0x3e')],'as':_0x184e('0x3f')}]})[_0x184e('0x24')](handleEntityNotFound(_0x1ade39,null))[_0x184e('0x24')](saveUpdates(_0x1e59e2[_0x184e('0x62')],null))[_0x184e('0x24')](respondWithResult(_0x1ade39,null))[_0x184e('0x2d')](handleError(_0x1ade39,null));};exports[_0x184e('0x38')]=function(_0x325fe5,_0x3d5f88){return db[_0x184e('0x40')]['find']({'where':{'id':_0x325fe5[_0x184e('0x58')]['id']}})[_0x184e('0x24')](handleEntityNotFound(_0x3d5f88,null))[_0x184e('0x24')](removeEntity(_0x3d5f88,null))[_0x184e('0x2d')](handleError(_0x3d5f88,null));};exports[_0x184e('0x63')]=function(_0x1f4b69,_0x494af5){return db[_0x184e('0x40')][_0x184e('0x63')]()[_0x184e('0x24')](respondWithResult(_0x494af5,null))['catch'](handleError(_0x494af5,null));};exports[_0x184e('0x64')]=function(_0x6b5550,_0x56769b,_0x5f067d){if(_0x6b5550['body']['id']){delete _0x6b5550[_0x184e('0x62')]['id'];}return db[_0x184e('0x40')][_0x184e('0x5a')]({'where':{'id':_0x6b5550[_0x184e('0x58')]['id']}})[_0x184e('0x24')](handleEntityNotFound(_0x56769b,null))[_0x184e('0x24')](function(_0x258de6){if(_0x258de6){_0x6b5550['body'][_0x184e('0x65')]=_0x258de6['id'];return db['Disposition']['create'](_0x6b5550[_0x184e('0x62')]);}})[_0x184e('0x24')](respondWithResult(_0x56769b,null))[_0x184e('0x2d')](handleError(_0x56769b,null));};exports['getDispositions']=function(_0xb5e928,_0x5e5038,_0x5b211e){var _0x286de8={'raw':![],'where':{}};var _0x1df37b={};var _0x42a1b0={'count':0x0,'rows':[]};return db[_0x184e('0x40')][_0x184e('0x66')]({'where':{'id':_0xb5e928[_0x184e('0x58')]['id']}})['then'](handleEntityNotFound(_0x5e5038,null))['then'](function(_0x1d4c61){if(_0x1d4c61){_0x1df37b[_0x184e('0x45')]=_[_0x184e('0x47')](db['Disposition'][_0x184e('0x41')]);_0x1df37b[_0x184e('0x48')]=_[_0x184e('0x47')](_0xb5e928[_0x184e('0x48')]);_0x1df37b[_0x184e('0x49')]=_[_0x184e('0x4a')](_0x1df37b[_0x184e('0x45')],_0x1df37b[_0x184e('0x48')]);_0x286de8['attributes']=_['intersection'](_0x1df37b[_0x184e('0x45')],qs['fields'](_0xb5e928[_0x184e('0x48')]['fields']));_0x286de8[_0x184e('0x4b')]=_0x286de8[_0x184e('0x4b')][_0x184e('0x4d')]?_0x286de8[_0x184e('0x4b')]:_0x1df37b['model'];if(!_0xb5e928[_0x184e('0x48')][_0x184e('0x67')](_0x184e('0x4e'))){_0x286de8['limit']=qs['limit'](_0xb5e928['query']['limit']);_0x286de8[_0x184e('0x30')]=qs[_0x184e('0x30')](_0xb5e928[_0x184e('0x48')][_0x184e('0x30')]);}_0x286de8[_0x184e('0x4f')]=qs['sort'](_0xb5e928[_0x184e('0x48')]['sort']);_0x286de8[_0x184e('0x51')]=qs[_0x184e('0x49')](_['pick'](_0xb5e928[_0x184e('0x48')],_0x1df37b['filters']));_0x286de8[_0x184e('0x51')][_0x184e('0x65')]=_0x1d4c61['id'];if(_0xb5e928['query'][_0x184e('0x53')]){_0x286de8[_0x184e('0x51')]=_['merge'](_0x286de8[_0x184e('0x51')],{'$or':_[_0x184e('0x46')](_0x286de8[_0x184e('0x4b')],function(_0x16c4b4){var _0x73e67f={};_0x73e67f[_0x16c4b4]={'$like':'%'+_0xb5e928[_0x184e('0x48')]['filter']+'%'};return _0x73e67f;})});}_0x286de8=_['merge']({},_0x286de8,_0xb5e928[_0x184e('0x55')]);return db[_0x184e('0x68')]['count']({'where':_0x286de8[_0x184e('0x51')]})['then'](function(_0xb30cf0){_0x42a1b0[_0x184e('0x33')]=_0xb30cf0;if(_0xb5e928[_0x184e('0x48')][_0x184e('0x69')]){_0x286de8[_0x184e('0x59')]=[{'all':!![]}];}return db[_0x184e('0x68')][_0x184e('0x56')](_0x286de8);})['then'](function(_0x2f1687){_0x42a1b0[_0x184e('0x6a')]=_0x2f1687;return _0x42a1b0;});}})[_0x184e('0x24')](respondWithFilteredResult(_0x5e5038,_0x286de8))['catch'](handleError(_0x5e5038,null));};exports[_0x184e('0x6b')]=function(_0x467f93,_0x475b11,_0xc34083){return db['OpenchannelAccount'][_0x184e('0x5a')]({'where':{'id':_0x467f93['params']['id']}})[_0x184e('0x24')](handleEntityNotFound(_0x475b11,null))[_0x184e('0x24')](function(_0x4d168e){if(_0x4d168e){return _0x4d168e[_0x184e('0x6b')](_0x467f93['query'][_0x184e('0x6c')]);}})['then'](respondWithStatusCode(_0x475b11,null))[_0x184e('0x2d')](handleError(_0x475b11,null));};exports[_0x184e('0x6d')]=function(_0x267a14,_0x2e8912,_0x1f4968){if(_0x267a14[_0x184e('0x62')]['id']){delete _0x267a14['body']['id'];}return db[_0x184e('0x40')][_0x184e('0x5a')]({'where':{'id':_0x267a14[_0x184e('0x58')]['id']}})[_0x184e('0x24')](handleEntityNotFound(_0x2e8912,null))[_0x184e('0x24')](function(_0x1e5791){if(_0x1e5791){_0x267a14['body']['OpenchannelAccountId']=_0x1e5791['id'];return db[_0x184e('0x6e')][_0x184e('0x5b')](_0x267a14['body']);}})[_0x184e('0x24')](respondWithResult(_0x2e8912,null))['catch'](handleError(_0x2e8912,null));};exports['getAnswers']=function(_0x1ca0db,_0x4d06fe,_0x25df2f){var _0x140555={'raw':![],'where':{}};var _0x4ba70b={};var _0x58d4cb={'count':0x0,'rows':[]};return db[_0x184e('0x40')][_0x184e('0x66')]({'where':{'id':_0x1ca0db['params']['id']}})['then'](handleEntityNotFound(_0x4d06fe,null))[_0x184e('0x24')](function(_0x31e14e){if(_0x31e14e){_0x4ba70b['model']=_['keys'](db[_0x184e('0x6e')][_0x184e('0x41')]);_0x4ba70b[_0x184e('0x48')]=_[_0x184e('0x47')](_0x1ca0db[_0x184e('0x48')]);_0x4ba70b[_0x184e('0x49')]=_[_0x184e('0x4a')](_0x4ba70b[_0x184e('0x45')],_0x4ba70b[_0x184e('0x48')]);_0x140555[_0x184e('0x4b')]=_['intersection'](_0x4ba70b['model'],qs[_0x184e('0x4c')](_0x1ca0db['query']['fields']));_0x140555['attributes']=_0x140555[_0x184e('0x4b')]['length']?_0x140555['attributes']:_0x4ba70b[_0x184e('0x45')];if(!_0x1ca0db[_0x184e('0x48')][_0x184e('0x67')](_0x184e('0x4e'))){_0x140555[_0x184e('0x32')]=qs[_0x184e('0x32')](_0x1ca0db[_0x184e('0x48')][_0x184e('0x32')]);_0x140555['offset']=qs['offset'](_0x1ca0db[_0x184e('0x48')][_0x184e('0x30')]);}_0x140555[_0x184e('0x4f')]=qs[_0x184e('0x50')](_0x1ca0db[_0x184e('0x48')]['sort']);_0x140555[_0x184e('0x51')]=qs[_0x184e('0x49')](_[_0x184e('0x52')](_0x1ca0db['query'],_0x4ba70b[_0x184e('0x49')]));_0x140555[_0x184e('0x51')][_0x184e('0x65')]=_0x31e14e['id'];if(_0x1ca0db['query']['filter']){_0x140555[_0x184e('0x51')]=_[_0x184e('0x54')](_0x140555[_0x184e('0x51')],{'$or':_[_0x184e('0x46')](_0x140555[_0x184e('0x4b')],function(_0x1c62d8){var _0x43f752={};_0x43f752[_0x1c62d8]={'$like':'%'+_0x1ca0db[_0x184e('0x48')][_0x184e('0x53')]+'%'};return _0x43f752;})});}_0x140555=_[_0x184e('0x54')]({},_0x140555,_0x1ca0db['options']);return db['CannedAnswer'][_0x184e('0x33')]({'where':_0x140555[_0x184e('0x51')]})[_0x184e('0x24')](function(_0x4673bc){_0x58d4cb['count']=_0x4673bc;if(_0x1ca0db['query'][_0x184e('0x69')]){_0x140555[_0x184e('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0x184e('0x56')](_0x140555);})['then'](function(_0x76c287){_0x58d4cb[_0x184e('0x6a')]=_0x76c287;return _0x58d4cb;});}})[_0x184e('0x24')](respondWithFilteredResult(_0x4d06fe,_0x140555))[_0x184e('0x2d')](handleError(_0x4d06fe,null));};exports['removeAnswers']=function(_0x4e063d,_0x10f925,_0x48d1bc){return db['OpenchannelAccount']['find']({'where':{'id':_0x4e063d[_0x184e('0x58')]['id']}})[_0x184e('0x24')](handleEntityNotFound(_0x10f925,null))[_0x184e('0x24')](function(_0x56b849){if(_0x56b849){return _0x56b849[_0x184e('0x6f')](_0x4e063d[_0x184e('0x48')][_0x184e('0x6c')]);}})[_0x184e('0x24')](respondWithStatusCode(_0x10f925,null))[_0x184e('0x2d')](handleError(_0x10f925,null));};exports[_0x184e('0x70')]=function(_0x3dc1d0,_0xc205fc,_0x3d140c){var _0x10021f={'body':_0x3dc1d0['body'],'channel':_0x184e('0x71')};var _0xd856c3=[];var _0x4695d6=[];var _0x1c2add={};var _0x4cbf17=![];return db[_0x184e('0x72')][_0x184e('0x63')]()['then'](function(_0x3683e5){if(!_0x3683e5){throw new db[(_0x184e('0x73'))]['ValidationError']('no\x20available\x20attributes');}_0xd856c3=_[_0x184e('0x74')](_[_0x184e('0x47')](_0x3683e5),['createdAt',_0x184e('0x75')]);_0x4695d6=_[_0x184e('0x74')](_[_0x184e('0x47')](_0x3683e5),[_0x184e('0x76'),'updatedAt','CompanyId','ListId']);if(_0x3dc1d0[_0x184e('0x62')]['id']){delete _0x3dc1d0[_0x184e('0x62')]['id'];}if(_[_0x184e('0x77')](_0x3dc1d0['body'][_0x184e('0x78')])){throw new db[(_0x184e('0x73'))][(_0x184e('0x79'))]('from\x20is\x20mandatory');}if(_[_0x184e('0x77')](_0x3dc1d0['body'][_0x184e('0x62')])||_0x3dc1d0[_0x184e('0x62')][_0x184e('0x62')]===''){throw new db[(_0x184e('0x73'))][(_0x184e('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x184e('0x77')](_0x3dc1d0[_0x184e('0x62')][_0x184e('0x7a')])){throw new db[(_0x184e('0x73'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4695d6);}if(!_[_0x184e('0x7b')](_0x4695d6,_0x3dc1d0[_0x184e('0x62')]['mapKey'])){throw new db[(_0x184e('0x73'))][(_0x184e('0x79'))](_0x184e('0x7c')+_0x4695d6);}_0x1c2add[_0x3dc1d0[_0x184e('0x62')][_0x184e('0x7a')]]=_0x3dc1d0['body'][_0x184e('0x78')];})[_0x184e('0x24')](function(){return db['OpenchannelAccount'][_0x184e('0x5a')]({'where':{'id':_0x3dc1d0[_0x184e('0x58')]['id']},'include':[{'model':db[_0x184e('0x7d')],'as':_0x184e('0x7e'),'include':[{'model':db['CmContact'],'as':_0x184e('0x7f'),'where':_0x1c2add,'limit':0x1,'order':[[_0x184e('0x75'),_0x184e('0x80')]]}]},{'model':db[_0x184e('0x81')],'as':_0x184e('0x82')}]});})['then'](handleEntityNotFound(_0xc205fc,null))[_0x184e('0x24')](function(_0x1127af){if(_0x1127af&&_0x1127af['List']){_0x10021f[_0x184e('0x83')]=_0x1127af;_0x10021f['applications']=_0x1127af[_0x184e('0x82')];_0x10021f[_0x184e('0x84')]=_0x1127af[_0x184e('0x7e')];_0x10021f[_0x184e('0x85')]=_[_0x184e('0x86')](_0x10021f[_0x184e('0x85')],[_0x184e('0x87')],['asc']);if(_0x10021f[_0x184e('0x83')][_0x184e('0x82')]){delete _0x10021f[_0x184e('0x83')][_0x184e('0x82')];}if(_0x10021f['account'][_0x184e('0x7e')]&&_0x10021f[_0x184e('0x83')][_0x184e('0x7e')][_0x184e('0x7f')][_0x184e('0x4d')]){return _0x10021f[_0x184e('0x83')]['List'][_0x184e('0x7f')][0x0];}var _0x2d4e05=_['defaults'](_0x3dc1d0[_0x184e('0x62')],{'firstName':_0x3dc1d0['body'][_0x184e('0x78')],'ListId':_0x1127af[_0x184e('0x88')]});_0x2d4e05[_0x3dc1d0[_0x184e('0x62')][_0x184e('0x7a')]]=_0x3dc1d0[_0x184e('0x62')][_0x184e('0x78')];return db[_0x184e('0x72')]['create'](_0x2d4e05,{'fields':_0xd856c3,'raw':!![]});}})[_0x184e('0x24')](handleEntityNotFound(_0xc205fc,null))['then'](function(_0x37d4ac){_0x10021f['contact']=_0x37d4ac;if(_0x37d4ac){var _0x1b8965={'ContactId':_0x37d4ac['id'],'OpenchannelAccountId':_0x3dc1d0[_0x184e('0x58')]['id'],'from':(_0x37d4ac[_0x184e('0x89')]||'')+'\x20'+(_0x37d4ac[_0x184e('0x8a')]||'')};var _0x211bc7={'OpenchannelAccountId':_0x3dc1d0[_0x184e('0x58')]['id'],'closed':![]};if(_0x3dc1d0[_0x184e('0x62')][_0x184e('0x8b')]){_0x211bc7[_0x184e('0x8b')]=_0x3dc1d0[_0x184e('0x62')][_0x184e('0x8b')];return db[_0x184e('0x8c')]['find']({'where':_0x211bc7})['then'](function(_0x44f4dd){if(_0x44f4dd){return[_0x44f4dd,![]];}_0x1b8965[_0x184e('0x8b')]=_0x3dc1d0[_0x184e('0x62')]['threadId'];_0x1b8965[_0x184e('0x8d')]=_0x3dc1d0[_0x184e('0x62')][_0x184e('0x8d')];return db[_0x184e('0x8c')][_0x184e('0x5b')](_0x1b8965)[_0x184e('0x24')](function(_0x503e2e){return[_0x503e2e,!![]];});});}else{_0x211bc7[_0x184e('0x8b')]=null;}_0x211bc7[_0x184e('0x8e')]=_0x37d4ac['id'];return db[_0x184e('0x8c')][_0x184e('0x5a')]({'where':_0x211bc7})['then'](function(_0x93835){if(_0x93835){return[_0x93835,![]];}return db['OpenchannelInteraction'][_0x184e('0x5b')](_0x1b8965)[_0x184e('0x24')](function(_0x306f8c){return[_0x306f8c,!![]];});});}})[_0x184e('0x8f')](function(_0x140dd3,_0x2bdc62){if(_0x140dd3){_0x4cbf17=_0x2bdc62;if(!_0x2bdc62){var _0x2cf7fa={'from':(_0x10021f[_0x184e('0x90')][_0x184e('0x89')]||'')+'\x20'+(_0x10021f[_0x184e('0x90')][_0x184e('0x8a')]||'')};if(_0x3dc1d0[_0x184e('0x62')][_0x184e('0x8b')]&&_0x3dc1d0[_0x184e('0x62')][_0x184e('0x91')]&&_0x3dc1d0[_0x184e('0x62')][_0x184e('0x8b')]!=_0x3dc1d0['body'][_0x184e('0x91')]){_0x2cf7fa['threadId']=_0x3dc1d0[_0x184e('0x62')][_0x184e('0x91')];}return _0x140dd3[_0x184e('0x37')](_0x2cf7fa);}else{return _0x140dd3;}}})[_0x184e('0x24')](function(_0x2b88ff){_0x10021f['interaction']=_0x2b88ff[_0x184e('0x5d')]({'plain':!![]});_0x10021f[_0x184e('0x92')][_0x184e('0x93')]=_0x4cbf17;if(_0x10021f[_0x184e('0x92')][_0x184e('0x93')]){if(_0x10021f[_0x184e('0x83')][_0x184e('0x94')]){_0x10021f['applications'][_0x184e('0x95')]({'id':0x0,'priority':_0x10021f['applications'][_0x184e('0x4d')]+0x1,'app':_0x184e('0x96'),'appdata':_0x184e('0x97'),'interval':_0x184e('0x98')});}}return db['OpenchannelMessage'][_0x184e('0x5b')]({'body':_0x3dc1d0[_0x184e('0x62')][_0x184e('0x62')],'OpenchannelAccountId':_0x3dc1d0[_0x184e('0x58')]['id'],'OpenchannelInteractionId':_0x2b88ff['id'],'direction':'in','ContactId':_0x10021f[_0x184e('0x90')]['id'],'AttachmentId':_0x3dc1d0[_0x184e('0x62')]['AttachmentId']});})[_0x184e('0x24')](function(_0x29ad22){_0x10021f[_0x184e('0x2c')]=_0x29ad22;if(_0x10021f['interaction']['UserId']){return db[_0x184e('0x99')][_0x184e('0x5a')]({'attributes':['id',_0x184e('0x3c')],'where':{'id':_0x10021f[_0x184e('0x92')][_0x184e('0x9a')]}})[_0x184e('0x24')](function(_0x90e5ba){if(_0x90e5ba){_0x10021f[_0x184e('0x85')][_0x184e('0x9b')]({'id':0x0,'priority':0x0,'app':_0x184e('0x9c'),'appdata':_0x90e5ba['name']+','+(_0x10021f[_0x184e('0x83')][_0x184e('0x9d')]||0xa),'interval':_0x184e('0x98')});_0x10021f[_0x184e('0x9e')]=![];}return respondWithRpcPromise(_0x184e('0x9f'),_0x184e('0xa0'),_0x10021f);});}return respondWithRpcPromise(_0x184e('0x9f'),_0x184e('0xa0'),_0x10021f);})[_0x184e('0x24')](function(_0x1fe666){respondWithRpcPromise(_0x184e('0xa1'),_0x184e('0xa1'),{'event':_0x184e('0x70'),'message':_0x1fe666},client9002);return _0x1fe666;})['then'](respondWithResult(_0xc205fc,null))[_0x184e('0x2d')](handleError(_0xc205fc,null));};exports[_0x184e('0xa2')]=function(_0x5694c1,_0x43cea3){var _0x30ccfc=_0x5694c1[_0x184e('0x58')]['id'];var _0x588580=_0x5694c1[_0x184e('0x62')];var _0x2a5ca9=0xc8;var _0x3e6e75=null;return db['sequelize'][_0x184e('0xa3')]({'isolationLevel':db[_0x184e('0xa4')][_0x184e('0xa5')][_0x184e('0xa6')]['READ_COMMITTED']},function(_0x4e5bdd){return db[_0x184e('0x40')][_0x184e('0x66')]({'where':{'id':_0x30ccfc},'transaction':_0x4e5bdd})[_0x184e('0x24')](function(_0xb3b7f2){if(_0xb3b7f2){return db[_0x184e('0x81')][_0x184e('0x38')]({'where':{'OpenchannelAccountId':_0x30ccfc},'transaction':_0x4e5bdd})[_0x184e('0x24')](function(){var _0x396431=_[_0x184e('0x46')](_0x588580,function(_0x541c6c){_0x541c6c[_0x184e('0x65')]=_0x30ccfc;return _0x541c6c;});return db['OpenchannelApplication'][_0x184e('0xa7')](_0x396431,{'transaction':_0x4e5bdd});});}else{_0x2a5ca9=0x194;_0x3e6e75=[];}});})[_0x184e('0x24')](function(){if(_0x2a5ca9!==0x194){return db[_0x184e('0x81')][_0x184e('0xa8')]({'where':{'OpenchannelAccountId':_0x30ccfc},'order':_0x184e('0x87')})[_0x184e('0x24')](function(_0xaa55e){_0x3e6e75=_0xaa55e;});}})[_0x184e('0x2d')](function(_0x2dd739){_0x2a5ca9=0x1f4;logger[_0x184e('0x2a')](_0x2dd739[_0x184e('0xa9')]);if(_0x2dd739[_0x184e('0x3c')]){delete _0x2dd739[_0x184e('0x3c')];}_0x3e6e75=_0x2dd739;})['finally'](function(){if(_0x3e6e75===null){_0x43cea3[_0x184e('0x3b')](_0x2a5ca9);}else{if(_0x2a5ca9===0x1f4){_0x43cea3[_0x184e('0x2e')](_0x2a5ca9)[_0x184e('0x3d')](_0x3e6e75);}else{_0x43cea3[_0x184e('0x2e')](_0x2a5ca9)[_0x184e('0x2f')](_0x3e6e75);}}});};exports[_0x184e('0xaa')]=function(_0xfba7b4,_0x5a57e5,_0x49000a){var _0x27d89e={};var _0x471265={};var _0x35822c;var _0x3026dc;return db[_0x184e('0x40')][_0x184e('0x66')]({'where':{'id':_0xfba7b4[_0x184e('0x58')]['id']}})[_0x184e('0x24')](handleEntityNotFound(_0x5a57e5,null))[_0x184e('0x24')](function(_0x5b8da5){if(_0x5b8da5){_0x35822c=_0x5b8da5;_0x471265[_0x184e('0x45')]=_['keys'](db[_0x184e('0x81')][_0x184e('0x41')]);_0x471265[_0x184e('0x48')]=_['keys'](_0xfba7b4[_0x184e('0x48')]);_0x471265[_0x184e('0x49')]=_[_0x184e('0x4a')](_0x471265[_0x184e('0x45')],_0x471265['query']);_0x27d89e['attributes']=_[_0x184e('0x4a')](_0x471265[_0x184e('0x45')],qs[_0x184e('0x4c')](_0xfba7b4[_0x184e('0x48')]['fields']));_0x27d89e[_0x184e('0x4b')]=_0x27d89e[_0x184e('0x4b')]['length']?_0x27d89e[_0x184e('0x4b')]:_0x471265[_0x184e('0x45')];_0x27d89e[_0x184e('0x4f')]=qs[_0x184e('0x50')](_0xfba7b4[_0x184e('0x48')]['sort']);_0x27d89e['where']=qs[_0x184e('0x49')](_['pick'](_0xfba7b4[_0x184e('0x48')],_0x471265[_0x184e('0x49')]));if(_0xfba7b4[_0x184e('0x48')][_0x184e('0x53')]){_0x27d89e['where']=_[_0x184e('0x54')](_0x27d89e[_0x184e('0x51')],{'$or':_['map'](_0x27d89e[_0x184e('0x4b')],function(_0x3eab0b){var _0x2d17be={};_0x2d17be[_0x3eab0b]={'$like':'%'+_0xfba7b4[_0x184e('0x48')][_0x184e('0x53')]+'%'};return _0x2d17be;})});}_0x27d89e=_[_0x184e('0x54')]({},_0x27d89e,_0xfba7b4[_0x184e('0x55')]);return _0x35822c[_0x184e('0xaa')](_0x27d89e);}})[_0x184e('0x24')](function(_0x52d66d){if(_0x52d66d){_0x3026dc=_0x52d66d[_0x184e('0x4d')];if(!_0xfba7b4[_0x184e('0x48')][_0x184e('0x67')](_0x184e('0x4e'))){_0x27d89e[_0x184e('0x32')]=qs[_0x184e('0x32')](_0xfba7b4[_0x184e('0x48')][_0x184e('0x32')]);_0x27d89e[_0x184e('0x30')]=qs[_0x184e('0x30')](_0xfba7b4[_0x184e('0x48')][_0x184e('0x30')]);}return _0x35822c['getApplications'](_0x27d89e);}})[_0x184e('0x24')](function(_0x2b7ad9){if(_0x2b7ad9){return _0x2b7ad9?{'count':_0x3026dc,'rows':_0x2b7ad9}:null;}})[_0x184e('0x24')](respondWithResult(_0x5a57e5,null))[_0x184e('0x2d')](handleError(_0x5a57e5,null));};exports[_0x184e('0xab')]=function(_0x1ba59e,_0x2a90d8,_0x5298d3){var _0x12d854={'raw':![],'where':{}};var _0x25c408={};var _0x29608c={'count':0x0,'rows':[]};return db[_0x184e('0x40')][_0x184e('0x66')]({'where':{'id':_0x1ba59e[_0x184e('0x58')]['id']}})[_0x184e('0x24')](handleEntityNotFound(_0x2a90d8,null))[_0x184e('0x24')](function(_0x13d91b){if(_0x13d91b){_0x25c408[_0x184e('0x45')]=_[_0x184e('0x47')](db[_0x184e('0x8c')][_0x184e('0x41')]);_0x25c408['query']=_[_0x184e('0x47')](_0x1ba59e['query']);_0x25c408['filters']=_[_0x184e('0x4a')](_0x25c408[_0x184e('0x45')],_0x25c408[_0x184e('0x48')]);_0x12d854[_0x184e('0x4b')]=_['intersection'](_0x25c408[_0x184e('0x45')],qs[_0x184e('0x4c')](_0x1ba59e[_0x184e('0x48')][_0x184e('0x4c')]));_0x12d854[_0x184e('0x4b')]=_0x12d854[_0x184e('0x4b')][_0x184e('0x4d')]?_0x12d854[_0x184e('0x4b')]:_0x25c408['model'];if(!_0x1ba59e['query'][_0x184e('0x67')](_0x184e('0x4e'))){_0x12d854[_0x184e('0x32')]=qs[_0x184e('0x32')](_0x1ba59e[_0x184e('0x48')][_0x184e('0x32')]);_0x12d854[_0x184e('0x30')]=qs['offset'](_0x1ba59e[_0x184e('0x48')][_0x184e('0x30')]);}_0x12d854[_0x184e('0x4f')]=qs[_0x184e('0x50')](_0x1ba59e['query'][_0x184e('0x50')]);_0x12d854[_0x184e('0x51')]=qs[_0x184e('0x49')](_[_0x184e('0x52')](_0x1ba59e[_0x184e('0x48')],_0x25c408[_0x184e('0x49')]));_0x12d854[_0x184e('0x51')][_0x184e('0x65')]=_0x13d91b['id'];if(_0x1ba59e[_0x184e('0x48')]['filter']){_0x12d854[_0x184e('0x51')]=_[_0x184e('0x54')](_0x12d854[_0x184e('0x51')],{'$or':_[_0x184e('0x46')](_0x12d854['attributes'],function(_0x305153){var _0x1de446={};_0x1de446[_0x305153]={'$like':'%'+_0x1ba59e[_0x184e('0x48')][_0x184e('0x53')]+'%'};return _0x1de446;})});}_0x12d854=_['merge']({},_0x12d854,_0x1ba59e[_0x184e('0x55')]);return db[_0x184e('0x8c')][_0x184e('0x33')]({'where':_0x12d854['where']})[_0x184e('0x24')](function(_0x33e848){_0x29608c[_0x184e('0x33')]=_0x33e848;if(_0x1ba59e[_0x184e('0x48')][_0x184e('0x69')]){_0x12d854[_0x184e('0x59')]=[{'model':db[_0x184e('0x72')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x184e('0xac'),'attributes':[_0x184e('0x3c'),'fullname','internal'],'required':![]},{'model':db[_0x184e('0xad')],'as':_0x184e('0xae'),'attributes':['id',_0x184e('0x3c'),_0x184e('0xaf')],'where':_0x1ba59e['query'][_0x184e('0xb0')]?{'id':_0x1ba59e[_0x184e('0x48')]['tag']}:undefined,'required':_0x1ba59e[_0x184e('0x48')][_0x184e('0xb0')]?!![]:![]}];}return db[_0x184e('0x8c')]['findAll'](_0x12d854);})['then'](function(_0xbecf4){_0x29608c['rows']=_0xbecf4;return _0x29608c;});}})[_0x184e('0x24')](respondWithFilteredResult(_0x2a90d8,_0x12d854))[_0x184e('0x2d')](handleError(_0x2a90d8,null));};exports[_0x184e('0xb1')]=function(_0x2ba8d7,_0x4d1738,_0x1ef692){return db['OpenchannelAccount']['find']({'where':{'id':_0x2ba8d7[_0x184e('0x58')]['id']}})['then'](handleEntityNotFound(_0x4d1738,null))[_0x184e('0x24')](function(_0x50776d){if(_0x50776d){return _0x50776d[_0x184e('0xb1')](_0x2ba8d7['body'][_0x184e('0x6c')],_[_0x184e('0xb2')](_0x2ba8d7['body'],[_0x184e('0x6c'),'id'])||{})[_0x184e('0x8f')](function(_0x4ed1ae){for(var _0xf4640e=0x0;_0xf4640e<_0x2ba8d7[_0x184e('0x62')][_0x184e('0x6c')][_0x184e('0x4d')];_0xf4640e+=0x1){socket[_0x184e('0xb3')](_0x184e('0xb4'),{'UserId':Number(_0x2ba8d7[_0x184e('0x62')][_0x184e('0x6c')][_0xf4640e]),'OpenchannelAccountId':Number(_0x2ba8d7[_0x184e('0x58')]['id'])});}return _0x4ed1ae;});}})['then'](respondWithResult(_0x4d1738,null))['catch'](handleError(_0x4d1738,null));};exports[_0x184e('0xb5')]=function(_0x3008bb,_0x21d912,_0x41ca10){return db[_0x184e('0x40')][_0x184e('0x5a')]({'where':{'id':_0x3008bb[_0x184e('0x58')]['id']}})[_0x184e('0x24')](handleEntityNotFound(_0x21d912,null))[_0x184e('0x24')](function(_0x142acd){if(_0x142acd){return _0x142acd[_0x184e('0xb5')](_0x3008bb[_0x184e('0x48')][_0x184e('0x6c')])[_0x184e('0x24')](function(){if(_[_0x184e('0xb6')](_0x3008bb[_0x184e('0x48')][_0x184e('0x6c')])){for(var _0xcf7066=0x0;_0xcf7066<_0x3008bb[_0x184e('0x48')][_0x184e('0x6c')][_0x184e('0x4d')];_0xcf7066+=0x1){socket[_0x184e('0xb3')]('userOpenchannelAccount:remove',{'UserId':Number(_0x3008bb['query'][_0x184e('0x6c')][_0xcf7066]),'OpenchannelAccountId':Number(_0x3008bb[_0x184e('0x58')]['id'])});}}else{socket[_0x184e('0xb3')]('userOpenchannelAccount:remove',{'UserId':Number(_0x3008bb[_0x184e('0x48')][_0x184e('0x6c')]),'OpenchannelAccountId':Number(_0x3008bb[_0x184e('0x58')]['id'])});}});}})[_0x184e('0x24')](respondWithStatusCode(_0x21d912,null))[_0x184e('0x2d')](handleError(_0x21d912,null));};exports[_0x184e('0xb7')]=function(_0x2d2bff,_0x15e55b,_0x14c5a0){var _0x45a6c9={};var _0x1ae122={};var _0x41076a;var _0x8b5e66;return db[_0x184e('0x40')][_0x184e('0x66')]({'where':{'id':_0x2d2bff['params']['id']}})[_0x184e('0x24')](handleEntityNotFound(_0x15e55b,null))['then'](function(_0x5e6531){if(_0x5e6531){_0x41076a=_0x5e6531;_0x1ae122[_0x184e('0x45')]=_[_0x184e('0x47')](db['User']['rawAttributes']);_0x1ae122[_0x184e('0x48')]=_[_0x184e('0x47')](_0x2d2bff[_0x184e('0x48')]);_0x1ae122[_0x184e('0x49')]=_[_0x184e('0x4a')](_0x1ae122['model'],_0x1ae122[_0x184e('0x48')]);_0x45a6c9[_0x184e('0x4b')]=_[_0x184e('0x4a')](_0x1ae122['model'],qs['fields'](_0x2d2bff[_0x184e('0x48')][_0x184e('0x4c')]));_0x45a6c9[_0x184e('0x4b')]=_0x45a6c9[_0x184e('0x4b')][_0x184e('0x4d')]?_0x45a6c9[_0x184e('0x4b')]:_0x1ae122[_0x184e('0x45')];_0x45a6c9[_0x184e('0x4f')]=qs['sort'](_0x2d2bff['query'][_0x184e('0x50')]);_0x45a6c9[_0x184e('0x51')]=qs[_0x184e('0x49')](_[_0x184e('0x52')](_0x2d2bff[_0x184e('0x48')],_0x1ae122[_0x184e('0x49')]));if(_0x2d2bff[_0x184e('0x48')]['filter']){_0x45a6c9['where']=_[_0x184e('0x54')](_0x45a6c9[_0x184e('0x51')],{'$or':_[_0x184e('0x46')](_0x45a6c9[_0x184e('0x4b')],function(_0x5c28c3){var _0x508d64={};_0x508d64[_0x5c28c3]={'$like':'%'+_0x2d2bff[_0x184e('0x48')]['filter']+'%'};return _0x508d64;})});}_0x45a6c9=_[_0x184e('0x54')]({},_0x45a6c9,_0x2d2bff['options']);return _0x41076a[_0x184e('0xb7')](_0x45a6c9);}})[_0x184e('0x24')](function(_0x232233){if(_0x232233){_0x8b5e66=_0x232233[_0x184e('0x4d')];if(!_0x2d2bff[_0x184e('0x48')]['hasOwnProperty']('nolimit')){_0x45a6c9['limit']=qs[_0x184e('0x32')](_0x2d2bff['query'][_0x184e('0x32')]);_0x45a6c9[_0x184e('0x30')]=qs[_0x184e('0x30')](_0x2d2bff[_0x184e('0x48')][_0x184e('0x30')]);}return _0x41076a[_0x184e('0xb7')](_0x45a6c9);}})[_0x184e('0x24')](function(_0xfc5d75){if(_0xfc5d75){return _0xfc5d75?{'count':_0x8b5e66,'rows':_0xfc5d75}:null;}})[_0x184e('0x24')](respondWithResult(_0x15e55b,null))[_0x184e('0x2d')](handleError(_0x15e55b,null));};exports[_0x184e('0x3d')]=function(_0xd8f1d6,_0x1e6a77,_0x4b67f9){var _0x3f6e2b,_0x2e3fb2,_0x253566;if(_[_0x184e('0x77')](_0xd8f1d6[_0x184e('0x62')]['body'])||_0xd8f1d6[_0x184e('0x62')][_0x184e('0x62')]===''){throw new db[(_0x184e('0x73'))]['ValidationError'](_0x184e('0xb8'));}if(_[_0x184e('0x77')](_0xd8f1d6['body']['to'])){}_0x3f6e2b=_0xd8f1d6['body']['to'];return db[_0x184e('0x40')][_0x184e('0x66')]({'where':{'id':_0xd8f1d6[_0x184e('0x58')]['id']}})['then'](handleEntityNotFound(_0x1e6a77,null))[_0x184e('0x24')](function(_0x275dd0){if(_0x275dd0){return db[_0x184e('0x40')][_0x184e('0x5a')]({'where':{'id':_0x275dd0['id']},'include':[{'model':db[_0x184e('0x7d')],'as':'List','include':[{'model':db[_0x184e('0x72')],'as':_0x184e('0x7f'),'where':{[_0x275dd0['mapKey']]:_0x3f6e2b},'limit':0x1,'order':[[_0x184e('0x75'),'DESC']]}]}]})[_0x184e('0x24')](handleEntityNotFound(_0x1e6a77,null))[_0x184e('0x24')](function(_0x3965c9){if(_0x3965c9&&_0x3965c9[_0x184e('0x7e')]){_0x2e3fb2=_0x3965c9[_0x184e('0x5d')]({'plain':!![]});if(_0x2e3fb2[_0x184e('0x7e')]&&_0x2e3fb2[_0x184e('0x7e')][_0x184e('0x7f')][_0x184e('0x4d')]){return _0x2e3fb2[_0x184e('0x7e')][_0x184e('0x7f')][0x0];}return db[_0x184e('0x72')]['create'](_[_0x184e('0x1d')](_0xd8f1d6[_0x184e('0x62')],{'firstName':_0x3f6e2b,[_0x3965c9['mapKey']]:_0x3f6e2b,'phone':_0x3f6e2b,'ListId':_0x2e3fb2['ListId']}));}})[_0x184e('0x24')](handleEntityNotFound(_0x1e6a77,null))[_0x184e('0x24')](function(_0x1d3c7c){if(_0x1d3c7c){_0x253566=_0x1d3c7c;return db[_0x184e('0x8c')][_0x184e('0x5a')]({'where':{'ContactId':_0x253566['id'],'closed':![],'OpenchannelAccountId':_0x2e3fb2['id']}})[_0x184e('0x24')](function(_0x5e0028){if(_0x5e0028){return[_0x5e0028,![]];}return db[_0x184e('0x8c')][_0x184e('0x5b')]({'UserId':_0xd8f1d6[_0x184e('0x5c')]['id'],'ContactId':_0x253566['id'],'OpenchannelAccountId':_0x2e3fb2['id'],'lastMsgDirection':_0x184e('0xb9'),'firstMsgDirection':'out','Messages':[_[_0x184e('0x54')](_0xd8f1d6['body'],{'read':![],'body':_0xd8f1d6['body']['body'],'OpenchannelAccountId':_0x2e3fb2['id'],'UserId':_0xd8f1d6['user']['id'],'ContactId':_0x253566['id']})]},{'include':[{'model':db[_0x184e('0xba')],'as':_0x184e('0xbb')}]})[_0x184e('0x24')](function(_0x467a8b){return[_0x467a8b,!![]];});});}})[_0x184e('0x8f')](function(_0x226399,_0x5cdc9b){if(_0x5cdc9b){return _0x226399;}return db[_0x184e('0xba')][_0x184e('0x5b')](_[_0x184e('0x54')](_0xd8f1d6['body'],{'read':![],'body':_0xd8f1d6[_0x184e('0x62')][_0x184e('0x62')],'OpenchannelAccountId':_0x2e3fb2['id'],'OpenchannelInteractionId':_0x226399['id'],'UserId':_0xd8f1d6[_0x184e('0x5c')]['id'],'ContactId':_0x253566['id']}))[_0x184e('0x24')](function(_0x57142d){_0x226399[_0x184e('0xbc')][_0x184e('0xbb')]=[];_0x226399[_0x184e('0xbc')][_0x184e('0xbb')][_0x184e('0x95')](_0x57142d['dataValues']);return _0x226399;});});}})['then'](respondWithResult(_0x1e6a77,null))['catch'](handleError(_0x1e6a77,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 7d358a9..ec62475 100644 --- a/server/api/openchannelAccount/openchannelAccount.events.js +++ b/server/api/openchannelAccount/openchannelAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1be1=['OpenchannelAccount','setMaxListeners','update','remove','emit','hook'];(function(_0x4f537c,_0x3dcf81){var _0x1cf903=function(_0xa5748c){while(--_0xa5748c){_0x4f537c['push'](_0x4f537c['shift']());}};_0x1cf903(++_0x3dcf81);}(_0x1be1,0x192));var _0x11be=function(_0x213f2c,_0x150069){_0x213f2c=_0x213f2c-0x0;var _0x100341=_0x1be1[_0x213f2c];return _0x100341;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x11be('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x11be('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x11be('0x2'),'afterDestroy':_0x11be('0x3')};function emitEvent(_0x200b2a){return function(_0x318d41,_0x504d3a,_0x3ce56d){OpenchannelAccountEvents[_0x11be('0x4')](_0x200b2a+':'+_0x318d41['id'],_0x318d41);OpenchannelAccountEvents[_0x11be('0x4')](_0x200b2a,_0x318d41);_0x3ce56d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x11be('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xda3f=['exports','../../mysqldb','OpenchannelAccount','remove','emit'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xda3f,0xec));var _0xfda3=function(_0x45fda2,_0x1526f6){_0x45fda2=_0x45fda2-0x0;var _0x3d1301=_0xda3f[_0x45fda2];return _0x3d1301;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xfda3('0x0'))['db'][_0xfda3('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xfda3('0x2')};function emitEvent(_0x581693){return function(_0x36dc71,_0x22187d,_0x516500){OpenchannelAccountEvents[_0xfda3('0x3')](_0x581693+':'+_0x36dc71['id'],_0x36dc71);OpenchannelAccountEvents[_0xfda3('0x3')](_0x581693,_0x36dc71);_0x516500(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xfda3('0x4')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index e3a36ff..34e0563 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(_0x1f7334,_0x5314d0){var _0x1a5e75=function(_0xeda1b1){while(--_0xeda1b1){_0x1f7334['push'](_0x1f7334['shift']());}};_0x1a5e75(++_0x5314d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x4b180f,_0x4d9af2){var _0x51c7f2=function(_0x15a67e){while(--_0x15a67e){_0x4b180f['push'](_0x4b180f['shift']());}};_0x51c7f2(++_0x4d9af2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 19f146e..6d1a8d3 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 _0x5c00=['code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x24e78d,_0x67e440){var _0x3be825=function(_0x41f2d4){while(--_0x41f2d4){_0x24e78d['push'](_0x24e78d['shift']());}};_0x3be825(++_0x67e440);}(_0x5c00,0x17e));var _0x05c0=function(_0x2867d8,_0xef3ee0){_0x2867d8=_0x2867d8-0x0;var _0x3b8176=_0x5c00[_0x2867d8];return _0x3b8176;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var moment=require(_0x05c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x05c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05c0('0x4'))['db'];var utils=require(_0x05c0('0x5'));var logger=require(_0x05c0('0x6'))(_0x05c0('0x7'));var config=require('../../config/environment');var jayson=require(_0x05c0('0x8'));var client=jayson[_0x05c0('0x9')][_0x05c0('0xa')]({'port':0x232a});config[_0x05c0('0xb')]=_['defaults'](config[_0x05c0('0xb')],{'host':_0x05c0('0xc'),'port':0x18eb});var socket=require(_0x05c0('0xd'))(new Redis(config['redis']));require(_0x05c0('0xe'))[_0x05c0('0xf')](socket);function respondWithRpcPromise(_0x996d6b,_0x321c09,_0x273b2d){return new BPromise(function(_0x1edbb,_0x5226c5){return client['request'](_0x996d6b,_0x273b2d)[_0x05c0('0x10')](function(_0x516a66){logger[_0x05c0('0x11')](_0x05c0('0x12'),_0x321c09,_0x05c0('0x13'));logger['debug'](_0x05c0('0x14'),_0x321c09,'request\x20sent',JSON[_0x05c0('0x15')](_0x516a66));if(_0x516a66[_0x05c0('0x16')]){if(_0x516a66[_0x05c0('0x16')][_0x05c0('0x17')]===0x1f4){logger[_0x05c0('0x16')](_0x05c0('0x12'),_0x321c09,_0x516a66[_0x05c0('0x16')][_0x05c0('0x18')]);return _0x5226c5(_0x516a66['error'][_0x05c0('0x18')]);}logger[_0x05c0('0x16')](_0x05c0('0x12'),_0x321c09,_0x516a66[_0x05c0('0x16')][_0x05c0('0x18')]);return _0x1edbb(_0x516a66[_0x05c0('0x16')][_0x05c0('0x18')]);}else{logger[_0x05c0('0x11')](_0x05c0('0x12'),_0x321c09,'request\x20sent');_0x1edbb(_0x516a66[_0x05c0('0x19')][_0x05c0('0x18')]);}})[_0x05c0('0x1a')](function(_0x54fef0){logger[_0x05c0('0x16')](_0x05c0('0x12'),_0x321c09,_0x54fef0);_0x5226c5(_0x54fef0);});});} \ No newline at end of file +var _0x263f=['../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','then','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x263f,0x182));var _0xf263=function(_0x6794ac,_0x7f90e2){_0x6794ac=_0x6794ac-0x0;var _0x4dfed4=_0x263f[_0x6794ac];return _0x4dfed4;};'use strict';var _=require(_0xf263('0x0'));var util=require(_0xf263('0x1'));var moment=require(_0xf263('0x2'));var BPromise=require(_0xf263('0x3'));var rs=require(_0xf263('0x4'));var fs=require('fs');var Redis=require(_0xf263('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf263('0x6'));var logger=require(_0xf263('0x7'))(_0xf263('0x8'));var config=require('../../config/environment');var jayson=require(_0xf263('0x9'));var client=jayson[_0xf263('0xa')]['http']({'port':0x232a});config['redis']=_[_0xf263('0xb')](config[_0xf263('0xc')],{'host':_0xf263('0xd'),'port':0x18eb});var socket=require(_0xf263('0xe'))(new Redis(config['redis']));require(_0xf263('0xf'))[_0xf263('0x10')](socket);function respondWithRpcPromise(_0x3d8092,_0x34c634,_0xb9fb31){return new BPromise(function(_0x4fc090,_0x1e9057){return client['request'](_0x3d8092,_0xb9fb31)[_0xf263('0x11')](function(_0x48e586){logger[_0xf263('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x34c634,'request\x20sent');logger[_0xf263('0x13')](_0xf263('0x14'),_0x34c634,_0xf263('0x15'),JSON[_0xf263('0x16')](_0x48e586));if(_0x48e586[_0xf263('0x17')]){if(_0x48e586[_0xf263('0x17')][_0xf263('0x18')]===0x1f4){logger['error'](_0xf263('0x19'),_0x34c634,_0x48e586['error'][_0xf263('0x1a')]);return _0x1e9057(_0x48e586[_0xf263('0x17')][_0xf263('0x1a')]);}logger[_0xf263('0x17')](_0xf263('0x19'),_0x34c634,_0x48e586[_0xf263('0x17')][_0xf263('0x1a')]);return _0x4fc090(_0x48e586['error']['message']);}else{logger[_0xf263('0x12')](_0xf263('0x19'),_0x34c634,_0xf263('0x15'));_0x4fc090(_0x48e586[_0xf263('0x1b')][_0xf263('0x1a')]);}})['catch'](function(_0x1adb66){logger['error'](_0xf263('0x19'),_0x34c634,_0x1adb66);_0x1e9057(_0x1adb66);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 2a23e5e..69fbadd 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 _0x54ef=['remove','emit','removeListener','length','./openchannelAccount.events','save'];(function(_0x3176bf,_0x4e6834){var _0x355328=function(_0x27ae38){while(--_0x27ae38){_0x3176bf['push'](_0x3176bf['shift']());}};_0x355328(++_0x4e6834);}(_0x54ef,0x112));var _0xf54e=function(_0x17cff5,_0xf098aa){_0x17cff5=_0x17cff5-0x0;var _0x3379f4=_0x54ef[_0x17cff5];return _0x3379f4;};'use strict';var OpenchannelAccountEvents=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(){OpenchannelAccountEvents[_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('openchannelAccount:'+_0x561870,_0x55e611);OpenchannelAccountEvents['on'](_0x561870,_0x27e69b);}}; \ No newline at end of file +var _0x4198=['openchannelAccount:','./openchannelAccount.events','remove','update','emit','removeListener','register','length'];(function(_0x222679,_0x1fe90b){var _0x1dc21a=function(_0x4f4b8b){while(--_0x4f4b8b){_0x222679['push'](_0x222679['shift']());}};_0x1dc21a(++_0x1fe90b);}(_0x4198,0x69));var _0x8419=function(_0x50e2ae,_0x18f609){_0x50e2ae=_0x50e2ae-0x0;var _0x1fb96a=_0x4198[_0x50e2ae];return _0x1fb96a;};'use strict';var OpenchannelAccountEvents=require(_0x8419('0x0'));var events=['save',_0x8419('0x1'),_0x8419('0x2')];function createListener(_0x29612a,_0x1e7a2f){return function(_0x182359){_0x1e7a2f[_0x8419('0x3')](_0x29612a,_0x182359);};}function removeListener(_0x1eaff0,_0xc19396){return function(){OpenchannelAccountEvents[_0x8419('0x4')](_0x1eaff0,_0xc19396);};}exports[_0x8419('0x5')]=function(_0x502e00){for(var _0x1f5bfe=0x0,_0x839abf=events[_0x8419('0x6')];_0x1f5bfe<_0x839abf;_0x1f5bfe++){var _0x2043cd=events[_0x1f5bfe];var _0x45c2b5=createListener(_0x8419('0x7')+_0x2043cd,_0x502e00);OpenchannelAccountEvents['on'](_0x2043cd,_0x45c2b5);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index c8a4f8c..53626c6 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 _0x968d=['delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','post','create','put','/:id'];(function(_0x2bdbd1,_0x57de67){var _0x110ebd=function(_0x39dc18){while(--_0x39dc18){_0x2bdbd1['push'](_0x2bdbd1['shift']());}};_0x110ebd(++_0x57de67);}(_0x968d,0x1e2));var _0xd968=function(_0x215499,_0xc2ac8b){_0x215499=_0x215499-0x0;var _0x4724d2=_0x968d[_0x215499];return _0x4724d2;};'use strict';var multer=require(_0xd968('0x0'));var util=require(_0xd968('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd968('0x2')]();var fs_extra=require(_0xd968('0x3'));var auth=require(_0xd968('0x4'));var interaction=require(_0xd968('0x5'));var config=require(_0xd968('0x6'));var controller=require(_0xd968('0x7'));router[_0xd968('0x8')]('/',auth[_0xd968('0x9')](),controller['index']);router[_0xd968('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xd968('0xa')]('/',auth['isAuthenticated'](),controller[_0xd968('0xb')]);router[_0xd968('0xc')](_0xd968('0xd'),auth[_0xd968('0x9')](),controller['update']);router[_0xd968('0xe')](_0xd968('0xd'),auth[_0xd968('0x9')](),controller[_0xd968('0xf')]);module['exports']=router; \ No newline at end of file +var _0x18d3=['post','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x18d3,0x6f));var _0x318d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x18d3[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x318d('0x0'));var util=require(_0x318d('0x1'));var path=require('path');var timeout=require(_0x318d('0x2'));var express=require(_0x318d('0x3'));var router=express[_0x318d('0x4')]();var fs_extra=require(_0x318d('0x5'));var auth=require(_0x318d('0x6'));var interaction=require(_0x318d('0x7'));var config=require(_0x318d('0x8'));var controller=require(_0x318d('0x9'));router[_0x318d('0xa')]('/',auth[_0x318d('0xb')](),controller[_0x318d('0xc')]);router[_0x318d('0xa')](_0x318d('0xd'),auth[_0x318d('0xb')](),controller[_0x318d('0xe')]);router[_0x318d('0xf')]('/',auth[_0x318d('0xb')](),controller['create']);router['put'](_0x318d('0xd'),auth[_0x318d('0xb')](),controller['update']);router['delete']('/:id',auth[_0x318d('0xb')](),controller[_0x318d('0x10')]);module[_0x318d('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 87a3014..3426cbf 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 _0xc128=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x160248,_0x2a57e6){var _0x4e589d=function(_0x1ba722){while(--_0x1ba722){_0x160248['push'](_0x160248['shift']());}};_0x4e589d(++_0x2a57e6);}(_0xc128,0xd3));var _0x8c12=function(_0x586685,_0x2f1af6){_0x586685=_0x586685-0x0;var _0x42e993=_0xc128[_0x586685];return _0x42e993;};'use strict';var Sequelize=require(_0x8c12('0x0'));module[_0x8c12('0x1')]={'priority':{'type':Sequelize[_0x8c12('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8c12('0x3')],'allowNull':![],'defaultValue':_0x8c12('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x8c12('0x3')]},'interval':{'type':Sequelize[_0x8c12('0x3')],'defaultValue':_0x8c12('0x5')}}; \ No newline at end of file +var _0xf9a1=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x36a469,_0x59d84c){var _0x3347fc=function(_0x3860e7){while(--_0x3860e7){_0x36a469['push'](_0x36a469['shift']());}};_0x3347fc(++_0x59d84c);}(_0xf9a1,0x1b8));var _0x1f9a=function(_0x224222,_0xb3d80f){_0x224222=_0x224222-0x0;var _0x57a537=_0xf9a1[_0x224222];return _0x57a537;};'use strict';var Sequelize=require(_0x1f9a('0x0'));module[_0x1f9a('0x1')]={'priority':{'type':Sequelize[_0x1f9a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1f9a('0x3')],'allowNull':![],'defaultValue':_0x1f9a('0x4')},'appdata':{'type':Sequelize[_0x1f9a('0x5')]()},'description':{'type':Sequelize[_0x1f9a('0x3')]},'interval':{'type':Sequelize[_0x1f9a('0x3')],'defaultValue':_0x1f9a('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 9b7d9df..250b39c 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 _0x2888=['attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','lodash','squel','crypto','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','end','json','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','OpenchannelApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection'];(function(_0x403f5f,_0x283f67){var _0x15b1cd=function(_0x238cab){while(--_0x238cab){_0x403f5f['push'](_0x403f5f['shift']());}};_0x15b1cd(++_0x283f67);}(_0x2888,0x1d2));var _0x8288=function(_0x36a61b,_0x4a5bda){_0x36a61b=_0x36a61b-0x0;var _0x3ba671=_0x2888[_0x36a61b];return _0x3ba671;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8288('0x0'));var jsonpatch=require(_0x8288('0x1'));var rp=require(_0x8288('0x2'));var moment=require(_0x8288('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8288('0x4'));var path=require(_0x8288('0x5'));var sox=require(_0x8288('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8288('0x7'));var _=require(_0x8288('0x8'));var squel=require(_0x8288('0x9'));var crypto=require(_0x8288('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8288('0xb'));var querystring=require(_0x8288('0xc'));var Papa=require(_0x8288('0xd'));var Redis=require('ioredis');var authService=require(_0x8288('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8288('0xf'));var hardwareService=require(_0x8288('0x10'));var logger=require(_0x8288('0x11'))(_0x8288('0x12'));var utils=require(_0x8288('0x13'));var config=require(_0x8288('0x14'));var licenseUtil=require(_0x8288('0x15'));var db=require(_0x8288('0x16'))['db'];function respondWithStatusCode(_0x55def3,_0x1c8271){_0x1c8271=_0x1c8271||0xcc;return function(_0x516c4d){if(_0x516c4d){return _0x55def3[_0x8288('0x17')](_0x1c8271);}return _0x55def3[_0x8288('0x18')](_0x1c8271)[_0x8288('0x19')]();};}function respondWithResult(_0x7e6d42,_0x1eb8f4){_0x1eb8f4=_0x1eb8f4||0xc8;return function(_0x27b5c2){if(_0x27b5c2){return _0x7e6d42['status'](_0x1eb8f4)[_0x8288('0x1a')](_0x27b5c2);}};}function respondWithFilteredResult(_0x2da42f,_0x5095b7){return function(_0x4e4f20){if(_0x4e4f20){var _0x1546bf=typeof _0x5095b7[_0x8288('0x1b')]==='undefined'&&typeof _0x5095b7['limit']==='undefined';var _0x30e30d=_0x4e4f20[_0x8288('0x1c')];var _0x389ade=_0x1546bf?0x0:_0x5095b7['offset'];var _0x1b28b7=_0x1546bf?_0x4e4f20['count']:_0x5095b7['offset']+_0x5095b7['limit'];var _0x549e1a;if(_0x1b28b7>=_0x30e30d){_0x1b28b7=_0x30e30d;_0x549e1a=0xc8;}else{_0x549e1a=0xce;}_0x2da42f['status'](_0x549e1a);return _0x2da42f[_0x8288('0x1d')](_0x8288('0x1e'),_0x389ade+'-'+_0x1b28b7+'/'+_0x30e30d)[_0x8288('0x1a')](_0x4e4f20);}return null;};}function patchUpdates(_0x4e9064){return function(_0x1c51fd){try{jsonpatch[_0x8288('0x1f')](_0x1c51fd,_0x4e9064,!![]);}catch(_0xa3898a){return BPromise[_0x8288('0x20')](_0xa3898a);}return _0x1c51fd[_0x8288('0x21')]();};}function saveUpdates(_0x5e79fe,_0x599d67){return function(_0x50602b){if(_0x50602b){return _0x50602b[_0x8288('0x22')](_0x5e79fe)[_0x8288('0x23')](function(_0x4f6cfd){return _0x4f6cfd;});}return null;};}function removeEntity(_0x174604,_0x8130ea){return function(_0x3c1b3f){if(_0x3c1b3f){return _0x3c1b3f[_0x8288('0x24')]()[_0x8288('0x23')](function(){_0x174604[_0x8288('0x18')](0xcc)[_0x8288('0x19')]();});}};}function handleEntityNotFound(_0x6207a5,_0x4ab0d1){return function(_0xdd3ba2){if(!_0xdd3ba2){_0x6207a5[_0x8288('0x17')](0x194);}return _0xdd3ba2;};}function handleError(_0x4db932,_0x152587){_0x152587=_0x152587||0x1f4;return function(_0x4c8041){logger[_0x8288('0x25')](_0x4c8041[_0x8288('0x26')]);if(_0x4c8041['name']){delete _0x4c8041[_0x8288('0x27')];}_0x4db932['status'](_0x152587)[_0x8288('0x28')](_0x4c8041);};}exports['index']=function(_0x135c64,_0x4cc7bc){var _0x45c0a7={},_0x522f87={},_0xbb38fc={'count':0x0,'rows':[]};var _0x2d97f0=_['map'](db[_0x8288('0x29')][_0x8288('0x2a')],function(_0x10f0d8){return{'name':_0x10f0d8[_0x8288('0x2b')],'type':_0x10f0d8[_0x8288('0x2c')][_0x8288('0x2d')]};});_0x522f87[_0x8288('0x2e')]=_[_0x8288('0x2f')](_0x2d97f0,_0x8288('0x27'));_0x522f87[_0x8288('0x30')]=_[_0x8288('0x31')](_0x135c64[_0x8288('0x30')]);_0x522f87[_0x8288('0x32')]=_[_0x8288('0x33')](_0x522f87['model'],_0x522f87[_0x8288('0x30')]);_0x45c0a7[_0x8288('0x34')]=_[_0x8288('0x33')](_0x522f87['model'],qs['fields'](_0x135c64[_0x8288('0x30')][_0x8288('0x35')]));_0x45c0a7['attributes']=_0x45c0a7['attributes'][_0x8288('0x36')]?_0x45c0a7[_0x8288('0x34')]:_0x522f87['model'];if(!_0x135c64[_0x8288('0x30')][_0x8288('0x37')](_0x8288('0x38'))){_0x45c0a7[_0x8288('0x39')]=qs[_0x8288('0x39')](_0x135c64['query'][_0x8288('0x39')]);_0x45c0a7[_0x8288('0x1b')]=qs[_0x8288('0x1b')](_0x135c64[_0x8288('0x30')][_0x8288('0x1b')]);}_0x45c0a7[_0x8288('0x3a')]=qs[_0x8288('0x3b')](_0x135c64['query']['sort']);_0x45c0a7[_0x8288('0x3c')]=qs['filters'](_['pick'](_0x135c64[_0x8288('0x30')],_0x522f87['filters']),_0x2d97f0);if(_0x135c64[_0x8288('0x30')][_0x8288('0x3d')]){_0x45c0a7['where']=_[_0x8288('0x3e')](_0x45c0a7[_0x8288('0x3c')],{'$or':_[_0x8288('0x2f')](_0x2d97f0,function(_0x25859c){if(_0x25859c[_0x8288('0x2c')]!=='VIRTUAL'){var _0x81232c={};_0x81232c[_0x25859c[_0x8288('0x27')]]={'$like':'%'+_0x135c64[_0x8288('0x30')][_0x8288('0x3d')]+'%'};return _0x81232c;}})});}_0x45c0a7=_[_0x8288('0x3e')]({},_0x45c0a7,_0x135c64[_0x8288('0x3f')]);var _0x6eb883={'where':_0x45c0a7['where']};return db[_0x8288('0x29')][_0x8288('0x1c')](_0x6eb883)[_0x8288('0x23')](function(_0x2a5955){_0xbb38fc[_0x8288('0x1c')]=_0x2a5955;if(_0x135c64[_0x8288('0x30')]['includeAll']){_0x45c0a7[_0x8288('0x40')]=[{'all':!![]}];}return db[_0x8288('0x29')][_0x8288('0x41')](_0x45c0a7);})[_0x8288('0x23')](function(_0x239850){_0xbb38fc[_0x8288('0x42')]=_0x239850;return _0xbb38fc;})[_0x8288('0x23')](respondWithFilteredResult(_0x4cc7bc,_0x45c0a7))[_0x8288('0x43')](handleError(_0x4cc7bc,null));};exports[_0x8288('0x44')]=function(_0x4a14e4,_0x364810){var _0x1012fe={'raw':!![],'where':{'id':_0x4a14e4['params']['id']}},_0x585c88={};_0x585c88[_0x8288('0x2e')]=_[_0x8288('0x31')](db[_0x8288('0x29')][_0x8288('0x2a')]);_0x585c88[_0x8288('0x30')]=_['keys'](_0x4a14e4['query']);_0x585c88[_0x8288('0x32')]=_[_0x8288('0x33')](_0x585c88[_0x8288('0x2e')],_0x585c88[_0x8288('0x30')]);_0x1012fe[_0x8288('0x34')]=_['intersection'](_0x585c88['model'],qs[_0x8288('0x35')](_0x4a14e4[_0x8288('0x30')][_0x8288('0x35')]));_0x1012fe['attributes']=_0x1012fe[_0x8288('0x34')][_0x8288('0x36')]?_0x1012fe[_0x8288('0x34')]:_0x585c88[_0x8288('0x2e')];if(_0x4a14e4['query'][_0x8288('0x45')]){_0x1012fe[_0x8288('0x40')]=[{'all':!![]}];}_0x1012fe=_[_0x8288('0x3e')]({},_0x1012fe,_0x4a14e4[_0x8288('0x3f')]);return db[_0x8288('0x29')][_0x8288('0x46')](_0x1012fe)[_0x8288('0x23')](handleEntityNotFound(_0x364810,null))[_0x8288('0x23')](respondWithResult(_0x364810,null))[_0x8288('0x43')](handleError(_0x364810,null));};exports[_0x8288('0x47')]=function(_0x50f153,_0x192cbe){return db[_0x8288('0x29')][_0x8288('0x47')](_0x50f153[_0x8288('0x48')],{})[_0x8288('0x23')](respondWithResult(_0x192cbe,0xc9))[_0x8288('0x43')](handleError(_0x192cbe,null));};exports[_0x8288('0x22')]=function(_0x1bb2aa,_0x176cf7){if(_0x1bb2aa['body']['id']){delete _0x1bb2aa['body']['id'];}return db[_0x8288('0x29')][_0x8288('0x46')]({'where':{'id':_0x1bb2aa[_0x8288('0x49')]['id']}})[_0x8288('0x23')](handleEntityNotFound(_0x176cf7,null))[_0x8288('0x23')](saveUpdates(_0x1bb2aa[_0x8288('0x48')],null))[_0x8288('0x23')](respondWithResult(_0x176cf7,null))['catch'](handleError(_0x176cf7,null));};exports[_0x8288('0x24')]=function(_0x2e123a,_0x461a4c){return db[_0x8288('0x29')]['find']({'where':{'id':_0x2e123a[_0x8288('0x49')]['id']}})[_0x8288('0x23')](handleEntityNotFound(_0x461a4c,null))[_0x8288('0x23')](removeEntity(_0x461a4c,null))[_0x8288('0x43')](handleError(_0x461a4c,null));}; \ No newline at end of file +var _0xed2c=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','merge','options','OpenchannelApplication','includeAll','include','findAll','rows','catch','show','then','create','body','find','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x27ff4d,_0x41a7d6){var _0x803d72=function(_0x4767cc){while(--_0x4767cc){_0x27ff4d['push'](_0x27ff4d['shift']());}};_0x803d72(++_0x41a7d6);}(_0xed2c,0x15a));var _0xced2=function(_0xa3400,_0x3a980a){_0xa3400=_0xa3400-0x0;var _0x33dba2=_0xed2c[_0xa3400];return _0x33dba2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xced2('0x0'));var rp=require(_0xced2('0x1'));var moment=require(_0xced2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xced2('0x3'));var util=require(_0xced2('0x4'));var path=require(_0xced2('0x5'));var sox=require('sox');var csv=require(_0xced2('0x6'));var ejs=require(_0xced2('0x7'));var fs=require('fs');var fs_extra=require(_0xced2('0x8'));var _=require(_0xced2('0x9'));var squel=require(_0xced2('0xa'));var crypto=require(_0xced2('0xb'));var jsforce=require(_0xced2('0xc'));var deskjs=require(_0xced2('0xd'));var toCsv=require(_0xced2('0x6'));var querystring=require(_0xced2('0xe'));var Papa=require(_0xced2('0xf'));var Redis=require('ioredis');var authService=require(_0xced2('0x10'));var qs=require(_0xced2('0x11'));var as=require(_0xced2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xced2('0x13'))(_0xced2('0x14'));var utils=require('../../config/utils');var config=require(_0xced2('0x15'));var licenseUtil=require(_0xced2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2008fa,_0x4881ee){_0x4881ee=_0x4881ee||0xcc;return function(_0x5c1fd9){if(_0x5c1fd9){return _0x2008fa[_0xced2('0x17')](_0x4881ee);}return _0x2008fa['status'](_0x4881ee)['end']();};}function respondWithResult(_0x4ce5eb,_0x416ab3){_0x416ab3=_0x416ab3||0xc8;return function(_0x2f3612){if(_0x2f3612){return _0x4ce5eb[_0xced2('0x18')](_0x416ab3)['json'](_0x2f3612);}};}function respondWithFilteredResult(_0x52cf85,_0x3d32a0){return function(_0x1763c1){if(_0x1763c1){var _0x3970c0=typeof _0x3d32a0[_0xced2('0x19')]===_0xced2('0x1a')&&typeof _0x3d32a0[_0xced2('0x1b')]==='undefined';var _0x40d3c8=_0x1763c1['count'];var _0xc6eddb=_0x3970c0?0x0:_0x3d32a0[_0xced2('0x19')];var _0xddb97d=_0x3970c0?_0x1763c1[_0xced2('0x1c')]:_0x3d32a0[_0xced2('0x19')]+_0x3d32a0[_0xced2('0x1b')];var _0x3fb4f0;if(_0xddb97d>=_0x40d3c8){_0xddb97d=_0x40d3c8;_0x3fb4f0=0xc8;}else{_0x3fb4f0=0xce;}_0x52cf85[_0xced2('0x18')](_0x3fb4f0);return _0x52cf85[_0xced2('0x1d')](_0xced2('0x1e'),_0xc6eddb+'-'+_0xddb97d+'/'+_0x40d3c8)['json'](_0x1763c1);}return null;};}function patchUpdates(_0x127669){return function(_0x5c87c5){try{jsonpatch[_0xced2('0x1f')](_0x5c87c5,_0x127669,!![]);}catch(_0x3fb4dd){return BPromise[_0xced2('0x20')](_0x3fb4dd);}return _0x5c87c5[_0xced2('0x21')]();};}function saveUpdates(_0x1e4b9b,_0x544a52){return function(_0x4e1c98){if(_0x4e1c98){return _0x4e1c98['update'](_0x1e4b9b)['then'](function(_0x2df03c){return _0x2df03c;});}return null;};}function removeEntity(_0x35336d,_0x2ef8de){return function(_0x42c65a){if(_0x42c65a){return _0x42c65a[_0xced2('0x22')]()['then'](function(){_0x35336d[_0xced2('0x18')](0xcc)[_0xced2('0x23')]();});}};}function handleEntityNotFound(_0x46c4de,_0x12647f){return function(_0x312dfa){if(!_0x312dfa){_0x46c4de['sendStatus'](0x194);}return _0x312dfa;};}function handleError(_0x381e57,_0x22eaae){_0x22eaae=_0x22eaae||0x1f4;return function(_0x20835f){logger[_0xced2('0x24')](_0x20835f[_0xced2('0x25')]);if(_0x20835f[_0xced2('0x26')]){delete _0x20835f[_0xced2('0x26')];}_0x381e57[_0xced2('0x18')](_0x22eaae)[_0xced2('0x27')](_0x20835f);};}exports[_0xced2('0x28')]=function(_0x27b095,_0x5f6cbb){var _0x5123b={},_0x2e23aa={},_0x38bd37={'count':0x0,'rows':[]};var _0x2b54b8=_['map'](db['OpenchannelApplication'][_0xced2('0x29')],function(_0x18ed45){return{'name':_0x18ed45[_0xced2('0x2a')],'type':_0x18ed45[_0xced2('0x2b')]['key']};});_0x2e23aa[_0xced2('0x2c')]=_['map'](_0x2b54b8,_0xced2('0x26'));_0x2e23aa[_0xced2('0x2d')]=_[_0xced2('0x2e')](_0x27b095[_0xced2('0x2d')]);_0x2e23aa[_0xced2('0x2f')]=_[_0xced2('0x30')](_0x2e23aa[_0xced2('0x2c')],_0x2e23aa[_0xced2('0x2d')]);_0x5123b[_0xced2('0x31')]=_['intersection'](_0x2e23aa[_0xced2('0x2c')],qs[_0xced2('0x32')](_0x27b095['query'][_0xced2('0x32')]));_0x5123b[_0xced2('0x31')]=_0x5123b[_0xced2('0x31')][_0xced2('0x33')]?_0x5123b[_0xced2('0x31')]:_0x2e23aa[_0xced2('0x2c')];if(!_0x27b095['query'][_0xced2('0x34')](_0xced2('0x35'))){_0x5123b['limit']=qs[_0xced2('0x1b')](_0x27b095[_0xced2('0x2d')][_0xced2('0x1b')]);_0x5123b['offset']=qs[_0xced2('0x19')](_0x27b095[_0xced2('0x2d')][_0xced2('0x19')]);}_0x5123b['order']=qs[_0xced2('0x36')](_0x27b095[_0xced2('0x2d')][_0xced2('0x36')]);_0x5123b[_0xced2('0x37')]=qs[_0xced2('0x2f')](_[_0xced2('0x38')](_0x27b095[_0xced2('0x2d')],_0x2e23aa[_0xced2('0x2f')]),_0x2b54b8);if(_0x27b095['query'][_0xced2('0x39')]){_0x5123b[_0xced2('0x37')]=_['merge'](_0x5123b[_0xced2('0x37')],{'$or':_[_0xced2('0x3a')](_0x2b54b8,function(_0x5e94df){if(_0x5e94df[_0xced2('0x2b')]!=='VIRTUAL'){var _0x47f915={};_0x47f915[_0x5e94df['name']]={'$like':'%'+_0x27b095['query'][_0xced2('0x39')]+'%'};return _0x47f915;}})});}_0x5123b=_[_0xced2('0x3b')]({},_0x5123b,_0x27b095[_0xced2('0x3c')]);var _0x257e94={'where':_0x5123b['where']};return db[_0xced2('0x3d')][_0xced2('0x1c')](_0x257e94)['then'](function(_0x43c121){_0x38bd37[_0xced2('0x1c')]=_0x43c121;if(_0x27b095[_0xced2('0x2d')][_0xced2('0x3e')]){_0x5123b[_0xced2('0x3f')]=[{'all':!![]}];}return db[_0xced2('0x3d')][_0xced2('0x40')](_0x5123b);})['then'](function(_0x1e6b5c){_0x38bd37[_0xced2('0x41')]=_0x1e6b5c;return _0x38bd37;})['then'](respondWithFilteredResult(_0x5f6cbb,_0x5123b))[_0xced2('0x42')](handleError(_0x5f6cbb,null));};exports[_0xced2('0x43')]=function(_0x15f5e2,_0x4da1d2){var _0x247ad6={'raw':!![],'where':{'id':_0x15f5e2['params']['id']}},_0x2c564e={};_0x2c564e[_0xced2('0x2c')]=_[_0xced2('0x2e')](db['OpenchannelApplication'][_0xced2('0x29')]);_0x2c564e[_0xced2('0x2d')]=_[_0xced2('0x2e')](_0x15f5e2[_0xced2('0x2d')]);_0x2c564e['filters']=_['intersection'](_0x2c564e['model'],_0x2c564e[_0xced2('0x2d')]);_0x247ad6['attributes']=_['intersection'](_0x2c564e[_0xced2('0x2c')],qs['fields'](_0x15f5e2[_0xced2('0x2d')][_0xced2('0x32')]));_0x247ad6[_0xced2('0x31')]=_0x247ad6[_0xced2('0x31')]['length']?_0x247ad6[_0xced2('0x31')]:_0x2c564e['model'];if(_0x15f5e2[_0xced2('0x2d')][_0xced2('0x3e')]){_0x247ad6['include']=[{'all':!![]}];}_0x247ad6=_[_0xced2('0x3b')]({},_0x247ad6,_0x15f5e2[_0xced2('0x3c')]);return db['OpenchannelApplication']['find'](_0x247ad6)[_0xced2('0x44')](handleEntityNotFound(_0x4da1d2,null))[_0xced2('0x44')](respondWithResult(_0x4da1d2,null))[_0xced2('0x42')](handleError(_0x4da1d2,null));};exports[_0xced2('0x45')]=function(_0x225409,_0x42b4dd){return db['OpenchannelApplication'][_0xced2('0x45')](_0x225409['body'],{})[_0xced2('0x44')](respondWithResult(_0x42b4dd,0xc9))['catch'](handleError(_0x42b4dd,null));};exports['update']=function(_0x53a6c3,_0x2281a2){if(_0x53a6c3[_0xced2('0x46')]['id']){delete _0x53a6c3[_0xced2('0x46')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x53a6c3['params']['id']}})['then'](handleEntityNotFound(_0x2281a2,null))[_0xced2('0x44')](saveUpdates(_0x53a6c3[_0xced2('0x46')],null))['then'](respondWithResult(_0x2281a2,null))[_0xced2('0x42')](handleError(_0x2281a2,null));};exports[_0xced2('0x22')]=function(_0x835b56,_0x3cd5ac){return db['OpenchannelApplication'][_0xced2('0x47')]({'where':{'id':_0x835b56['params']['id']}})[_0xced2('0x44')](handleEntityNotFound(_0x3cd5ac,null))[_0xced2('0x44')](removeEntity(_0x3cd5ac,null))['catch'](handleError(_0x3cd5ac,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index e648d7f..2ede03c 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 _0x5398=['rimraf','./openchannelApplication.attributes','exports','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','path'];(function(_0x32c5c4,_0x26fe3a){var _0x2b238e=function(_0x443231){while(--_0x443231){_0x32c5c4['push'](_0x32c5c4['shift']());}};_0x2b238e(++_0x26fe3a);}(_0x5398,0x1b3));var _0x8539=function(_0x166cec,_0x328fcc){_0x166cec=_0x166cec-0x0;var _0x18e145=_0x5398[_0x166cec];return _0x18e145;};'use strict';var _=require(_0x8539('0x0'));var util=require('util');var logger=require(_0x8539('0x1'))(_0x8539('0x2'));var moment=require(_0x8539('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8539('0x4'));var rimraf=require(_0x8539('0x5'));var config=require('../../config/environment');var attributes=require(_0x8539('0x6'));module[_0x8539('0x7')]=function(_0x414628,_0x271b8e){return _0x414628['define'](_0x8539('0x8'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8539('0x9'),'collate':_0x8539('0xa')});}; \ No newline at end of file +var _0x60b9=['rimraf','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise'];(function(_0x5adaa9,_0x55fa73){var _0x28abdf=function(_0x5238b1){while(--_0x5238b1){_0x5adaa9['push'](_0x5adaa9['shift']());}};_0x28abdf(++_0x55fa73);}(_0x60b9,0x103));var _0x960b=function(_0x112f76,_0x49aa36){_0x112f76=_0x112f76-0x0;var _0x2e4194=_0x60b9[_0x112f76];return _0x2e4194;};'use strict';var _=require(_0x960b('0x0'));var util=require(_0x960b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x960b('0x2'));var BPromise=require(_0x960b('0x3'));var rp=require(_0x960b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x960b('0x5'));var config=require(_0x960b('0x6'));var attributes=require(_0x960b('0x7'));module[_0x960b('0x8')]=function(_0x5cfe69,_0x1ad206){return _0x5cfe69['define'](_0x960b('0x9'),attributes,{'tableName':_0x960b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x960b('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index dd25699..5597d3b 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 _0x7834=['../../config/environment','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelApplication','update','body','options','attributes','limit','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x5d8631,_0x44944b){var _0x34c15e=function(_0x4448f8){while(--_0x4448f8){_0x5d8631['push'](_0x5d8631['shift']());}};_0x34c15e(++_0x44944b);}(_0x7834,0x180));var _0x4783=function(_0x6c0f5f,_0x1deead){_0x6c0f5f=_0x6c0f5f-0x0;var _0x23980f=_0x7834[_0x6c0f5f];return _0x23980f;};'use strict';var _=require(_0x4783('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4783('0x1'));var rs=require(_0x4783('0x2'));var fs=require('fs');var Redis=require(_0x4783('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4783('0x4'));var logger=require('../../config/logger')(_0x4783('0x5'));var config=require(_0x4783('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4783('0x7')][_0x4783('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10b413,_0x99c7d0,_0x47be3e){return new BPromise(function(_0xb69434,_0x5e0d1e){return client['request'](_0x10b413,_0x47be3e)[_0x4783('0x9')](function(_0x44da75){logger[_0x4783('0xa')](_0x4783('0xb'),_0x99c7d0,_0x4783('0xc'));logger[_0x4783('0xd')](_0x4783('0xe'),_0x99c7d0,_0x4783('0xc'),JSON[_0x4783('0xf')](_0x44da75));if(_0x44da75['error']){if(_0x44da75[_0x4783('0x10')][_0x4783('0x11')]===0x1f4){logger[_0x4783('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x99c7d0,_0x44da75[_0x4783('0x10')][_0x4783('0x12')]);return _0x5e0d1e(_0x44da75[_0x4783('0x10')]['message']);}logger[_0x4783('0x10')](_0x4783('0xb'),_0x99c7d0,_0x44da75[_0x4783('0x10')][_0x4783('0x12')]);return _0xb69434(_0x44da75[_0x4783('0x10')][_0x4783('0x12')]);}else{logger[_0x4783('0xa')](_0x4783('0xb'),_0x99c7d0,_0x4783('0xc'));_0xb69434(_0x44da75[_0x4783('0x13')][_0x4783('0x12')]);}})['catch'](function(_0x54b9c2){logger[_0x4783('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x99c7d0,_0x54b9c2);_0x5e0d1e(_0x54b9c2);});});}exports[_0x4783('0x14')]=function(_0x1a2460){var _0x567574=this;return new Promise(function(_0x34dfa0,_0x3ef4f4){return db['OpenchannelApplication'][_0x4783('0x15')](_0x1a2460[_0x4783('0x16')],{'raw':_0x1a2460[_0x4783('0x17')]?_0x1a2460[_0x4783('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a2460[_0x4783('0x17')]?_0x1a2460[_0x4783('0x17')]['where']||null:null,'attributes':_0x1a2460[_0x4783('0x17')]?_0x1a2460[_0x4783('0x17')][_0x4783('0x18')]||null:null,'limit':_0x1a2460[_0x4783('0x17')]?_0x1a2460[_0x4783('0x17')][_0x4783('0x19')]||null:null})[_0x4783('0x9')](function(_0x199476){logger[_0x4783('0xa')]('UpdateOpenchannelApplication',_0x1a2460);logger[_0x4783('0xd')]('UpdateOpenchannelApplication',_0x1a2460,JSON[_0x4783('0xf')](_0x199476));_0x34dfa0(_0x199476);})['catch'](function(_0x3ae1f0){logger[_0x4783('0x10')](_0x4783('0x14'),_0x3ae1f0['message'],_0x1a2460);_0x3ef4f4(_0x567574[_0x4783('0x10')](0x1f4,_0x3ae1f0['message']));});});}; \ No newline at end of file +var _0x40de=['error','code','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','then','debug','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x465573,_0x59982f){var _0x4e7a2f=function(_0x3c24ec){while(--_0x3c24ec){_0x465573['push'](_0x465573['shift']());}};_0x4e7a2f(++_0x59982f);}(_0x40de,0x126));var _0xe40d=function(_0x290181,_0x46db3e){_0x290181=_0x290181-0x0;var _0x2dc9dc=_0x40de[_0x290181];return _0x2dc9dc;};'use strict';var _=require(_0xe40d('0x0'));var util=require('util');var moment=require(_0xe40d('0x1'));var BPromise=require(_0xe40d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe40d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe40d('0x4'));var logger=require(_0xe40d('0x5'))(_0xe40d('0x6'));var config=require(_0xe40d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe40d('0x8')][_0xe40d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x310434,_0x31cd99,_0x2c6445){return new BPromise(function(_0x52cba5,_0x5ab4b1){return client[_0xe40d('0xa')](_0x310434,_0x2c6445)['then'](function(_0x2f426c){logger[_0xe40d('0xb')](_0xe40d('0xc'),_0x31cd99,_0xe40d('0xd'));logger['debug'](_0xe40d('0xe'),_0x31cd99,_0xe40d('0xd'),JSON[_0xe40d('0xf')](_0x2f426c));if(_0x2f426c['error']){if(_0x2f426c[_0xe40d('0x10')][_0xe40d('0x11')]===0x1f4){logger[_0xe40d('0x10')](_0xe40d('0xc'),_0x31cd99,_0x2f426c[_0xe40d('0x10')][_0xe40d('0x12')]);return _0x5ab4b1(_0x2f426c[_0xe40d('0x10')][_0xe40d('0x12')]);}logger[_0xe40d('0x10')](_0xe40d('0xc'),_0x31cd99,_0x2f426c[_0xe40d('0x10')]['message']);return _0x52cba5(_0x2f426c['error'][_0xe40d('0x12')]);}else{logger[_0xe40d('0xb')](_0xe40d('0xc'),_0x31cd99,'request\x20sent');_0x52cba5(_0x2f426c[_0xe40d('0x13')][_0xe40d('0x12')]);}})['catch'](function(_0x50a6b7){logger[_0xe40d('0x10')](_0xe40d('0xc'),_0x31cd99,_0x50a6b7);_0x5ab4b1(_0x50a6b7);});});}exports[_0xe40d('0x14')]=function(_0x193aac){var _0x19984f=this;return new Promise(function(_0x3985cc,_0x1f9c24){return db[_0xe40d('0x15')][_0xe40d('0x16')](_0x193aac[_0xe40d('0x17')],{'raw':_0x193aac[_0xe40d('0x18')]?_0x193aac[_0xe40d('0x18')][_0xe40d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x193aac[_0xe40d('0x18')]?_0x193aac[_0xe40d('0x18')][_0xe40d('0x1a')]||null:null,'attributes':_0x193aac[_0xe40d('0x18')]?_0x193aac[_0xe40d('0x18')][_0xe40d('0x1b')]||null:null,'limit':_0x193aac[_0xe40d('0x18')]?_0x193aac[_0xe40d('0x18')]['limit']||null:null})[_0xe40d('0x1c')](function(_0x383811){logger[_0xe40d('0xb')](_0xe40d('0x14'),_0x193aac);logger[_0xe40d('0x1d')](_0xe40d('0x14'),_0x193aac,JSON['stringify'](_0x383811));_0x3985cc(_0x383811);})[_0xe40d('0x1e')](function(_0x3f51d8){logger[_0xe40d('0x10')]('UpdateOpenchannelApplication',_0x3f51d8[_0xe40d('0x12')],_0x193aac);_0x1f9c24(_0x19984f[_0xe40d('0x10')](0x1f4,_0x3f51d8['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 4c651e7..111f049 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 _0xd869=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd869,0x159));var _0x9d86=function(_0x55d829,_0x43f06c){_0x55d829=_0x55d829-0x0;var _0x52163b=_0xd869[_0x55d829];return _0x52163b;};'use strict';var multer=require(_0x9d86('0x0'));var util=require(_0x9d86('0x1'));var path=require('path');var timeout=require(_0x9d86('0x2'));var express=require(_0x9d86('0x3'));var router=express[_0x9d86('0x4')]();var fs_extra=require(_0x9d86('0x5'));var auth=require(_0x9d86('0x6'));var interaction=require(_0x9d86('0x7'));var config=require(_0x9d86('0x8'));var controller=require('./openchannelInteraction.controller');router[_0x9d86('0x9')]('/',auth[_0x9d86('0xa')](),controller[_0x9d86('0xb')]);router[_0x9d86('0x9')](_0x9d86('0xc'),auth[_0x9d86('0xa')](),controller[_0x9d86('0xd')]);router[_0x9d86('0x9')](_0x9d86('0xe'),auth['isAuthenticated'](),controller[_0x9d86('0xf')]);router['get'](_0x9d86('0x10'),auth[_0x9d86('0xa')](),controller[_0x9d86('0x11')]);router[_0x9d86('0x9')](_0x9d86('0x12'),auth[_0x9d86('0xa')](),controller[_0x9d86('0x13')]);router[_0x9d86('0x14')]('/',auth[_0x9d86('0xa')](),controller['create']);router['post'](_0x9d86('0x10'),auth[_0x9d86('0xa')](),controller[_0x9d86('0x15')]);router[_0x9d86('0x14')](_0x9d86('0x16'),auth[_0x9d86('0xa')](),interaction[_0x9d86('0x17')](_0x9d86('0x18'),_0x9d86('0x19')),controller[_0x9d86('0x1a')]);router[_0x9d86('0x1b')](_0x9d86('0xe'),auth['isAuthenticated'](),interaction[_0x9d86('0x17')](_0x9d86('0x18'),_0x9d86('0x1c')),controller[_0x9d86('0x1d')]);router[_0x9d86('0x1e')](_0x9d86('0xe'),auth[_0x9d86('0xa')](),interaction[_0x9d86('0x17')]('openchannel','openchannelinteraction:destroy'),controller['destroy']);router[_0x9d86('0x1e')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module[_0x9d86('0x1f')]=router; \ No newline at end of file +var _0xe1cf=['/:id','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannel','removeTags','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','/describe'];(function(_0x276468,_0x29685a){var _0x36dc3a=function(_0x291f0a){while(--_0x291f0a){_0x276468['push'](_0x276468['shift']());}};_0x36dc3a(++_0x29685a);}(_0xe1cf,0x1c5));var _0xfe1c=function(_0x3846ac,_0x731421){_0x3846ac=_0x3846ac-0x0;var _0x1482df=_0xe1cf[_0x3846ac];return _0x1482df;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfe1c('0x0'));var timeout=require(_0xfe1c('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfe1c('0x2'));var auth=require(_0xfe1c('0x3'));var interaction=require(_0xfe1c('0x4'));var config=require(_0xfe1c('0x5'));var controller=require(_0xfe1c('0x6'));router['get']('/',auth[_0xfe1c('0x7')](),controller[_0xfe1c('0x8')]);router[_0xfe1c('0x9')](_0xfe1c('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xfe1c('0xb'),auth['isAuthenticated'](),controller[_0xfe1c('0xc')]);router['get'](_0xfe1c('0xd'),auth[_0xfe1c('0x7')](),controller[_0xfe1c('0xe')]);router[_0xfe1c('0x9')](_0xfe1c('0xf'),auth['isAuthenticated'](),controller['download']);router[_0xfe1c('0x10')]('/',auth[_0xfe1c('0x7')](),controller['create']);router['post'](_0xfe1c('0xd'),auth['isAuthenticated'](),controller[_0xfe1c('0x11')]);router[_0xfe1c('0x10')](_0xfe1c('0x12'),auth[_0xfe1c('0x7')](),interaction[_0xfe1c('0x13')]('openchannel',_0xfe1c('0x14')),controller[_0xfe1c('0x15')]);router[_0xfe1c('0x16')](_0xfe1c('0xb'),auth['isAuthenticated'](),interaction[_0xfe1c('0x13')]('openchannel',_0xfe1c('0x17')),controller[_0xfe1c('0x18')]);router[_0xfe1c('0x19')]('/:id',auth[_0xfe1c('0x7')](),interaction[_0xfe1c('0x13')](_0xfe1c('0x1a'),'openchannelinteraction:destroy'),controller['destroy']);router[_0xfe1c('0x19')](_0xfe1c('0x12'),auth[_0xfe1c('0x7')](),controller[_0xfe1c('0x1b')]);module[_0xfe1c('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 07cdc8b..5734ceb 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 _0xa25a=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x3dfb30,_0x4588ec){var _0x46cee4=function(_0x3288d9){while(--_0x3288d9){_0x3dfb30['push'](_0x3dfb30['shift']());}};_0x46cee4(++_0x4588ec);}(_0xa25a,0x160));var _0xaa25=function(_0x273713,_0x435ebd){_0x273713=_0x273713-0x0;var _0x2b4385=_0xa25a[_0x273713];return _0x2b4385;};'use strict';var Sequelize=require(_0xaa25('0x0'));module[_0xaa25('0x1')]={'closed':{'type':Sequelize[_0xaa25('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xaa25('0x3')]},'disposition':{'type':Sequelize[_0xaa25('0x4')]},'secondDisposition':{'type':Sequelize[_0xaa25('0x4')]},'thirdDisposition':{'type':Sequelize[_0xaa25('0x4')]},'note':{'type':Sequelize[_0xaa25('0x4')]},'read1stAt':{'type':Sequelize[_0xaa25('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xaa25('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xaa25('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xaa25('0x5')]('in',_0xaa25('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x9b9b=['exports','STRING','DATE','ENUM','out','BOOLEAN'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x9b9b,0x114));var _0xb9b9=function(_0x152136,_0x4f14f1){_0x152136=_0x152136-0x0;var _0x20df44=_0x9b9b[_0x152136];return _0x20df44;};'use strict';var Sequelize=require('sequelize');module[_0xb9b9('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb9b9('0x1')]},'secondDisposition':{'type':Sequelize[_0xb9b9('0x1')]},'thirdDisposition':{'type':Sequelize[_0xb9b9('0x1')]},'note':{'type':Sequelize[_0xb9b9('0x1')]},'read1stAt':{'type':Sequelize[_0xb9b9('0x2')]},'threadId':{'type':Sequelize[_0xb9b9('0x1')]},'externalUrl':{'type':Sequelize[_0xb9b9('0x1')]},'lastMsgAt':{'type':Sequelize[_0xb9b9('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xb9b9('0x3')]('in',_0xb9b9('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xb9b9('0x3')]('in',_0xb9b9('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xb9b9('0x1')]},'autoreplyExecuted':{'type':Sequelize[_0xb9b9('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index fa2610e..aab1c06 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 _0x1bf2=['error','stack','name','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','findAll','openchannel','query','user','catch','from','params','model','filters','intersection','attributes','fields','length','include','merge','find','create','body','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','order','pick','where','OpenchannelInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','rows','addTags','setTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','attachments','format','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','createdAt','closedAt','threadId','Public','Private','basename','existsSync','createReadStream','createWriteStream','direction','System','out','value','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','unlinkSync','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./openchannelInteraction.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','sendStatus'];(function(_0x1b9d04,_0x31b1f7){var _0x27bb14=function(_0x29d27b){while(--_0x29d27b){_0x1b9d04['push'](_0x1b9d04['shift']());}};_0x27bb14(++_0x31b1f7);}(_0x1bf2,0xe4));var _0x21bf=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x1bf2[_0x487b0c];return _0x1adbdc;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x21bf('0x0'));var moment=require(_0x21bf('0x1'));var util=require(_0x21bf('0x2'));var path=require(_0x21bf('0x3'));var ejs=require(_0x21bf('0x4'));var fs=require('fs');var _=require(_0x21bf('0x5'));var Redis=require(_0x21bf('0x6'));var interaction=require(_0x21bf('0x7'));var qs=require(_0x21bf('0x8'));var pdf=require(_0x21bf('0x9'));var logger=require(_0x21bf('0xa'))(_0x21bf('0xb'));var config=require(_0x21bf('0xc'));var db=require(_0x21bf('0xd'))['db'];config[_0x21bf('0xe')]=_[_0x21bf('0xf')](config[_0x21bf('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x21bf('0xe')]));require(_0x21bf('0x10'))['register'](socket);function respondWithStatusCode(_0x316f24,_0x16e020){_0x16e020=_0x16e020||0xcc;return function(_0x354c3d){if(_0x354c3d){return _0x316f24['sendStatus'](_0x16e020);}return _0x316f24[_0x21bf('0x11')](_0x16e020)[_0x21bf('0x12')]();};}function respondWithResult(_0x17e385,_0x569265){_0x569265=_0x569265||0xc8;return function(_0x53ad87){if(_0x53ad87){return _0x17e385[_0x21bf('0x11')](_0x569265)[_0x21bf('0x13')](_0x53ad87);}};}function respondWithFilteredResult(_0xd21709,_0xf45e8c){return function(_0x45a0a1){if(_0x45a0a1){var _0x429808=typeof _0xf45e8c[_0x21bf('0x14')]===_0x21bf('0x15')&&typeof _0xf45e8c[_0x21bf('0x16')]===_0x21bf('0x15');var _0x5e83ba=_0x45a0a1[_0x21bf('0x17')];var _0x47499a=_0x429808?0x0:_0xf45e8c[_0x21bf('0x14')];var _0xfbc298=_0x429808?_0x45a0a1[_0x21bf('0x17')]:_0xf45e8c[_0x21bf('0x14')]+_0xf45e8c[_0x21bf('0x16')];var _0x5829ca;if(_0xfbc298>=_0x5e83ba){_0xfbc298=_0x5e83ba;_0x5829ca=0xc8;}else{_0x5829ca=0xce;}_0xd21709[_0x21bf('0x11')](_0x5829ca);return _0xd21709[_0x21bf('0x18')](_0x21bf('0x19'),_0x47499a+'-'+_0xfbc298+'/'+_0x5e83ba)[_0x21bf('0x13')](_0x45a0a1);}return null;};}function saveUpdates(_0x177a03){return function(_0x1208d9){if(_0x1208d9){return _0x1208d9[_0x21bf('0x1a')](_0x177a03)[_0x21bf('0x1b')](function(_0x27ab80){return _0x27ab80;});}return null;};}function removeEntity(_0x57f408){return function(_0x8894c2){if(_0x8894c2){return _0x8894c2[_0x21bf('0x1c')]()[_0x21bf('0x1b')](function(){_0x57f408[_0x21bf('0x11')](0xcc)[_0x21bf('0x12')]();});}};}function handleEntityNotFound(_0x4d57c4){return function(_0x2deffd){if(!_0x2deffd){_0x4d57c4[_0x21bf('0x1d')](0x194);}return _0x2deffd;};}function handleError(_0x5c3d00,_0x144603){_0x144603=_0x144603||0x1f4;return function(_0x1b0042){logger[_0x21bf('0x1e')](_0x1b0042[_0x21bf('0x1f')]);if(_0x1b0042['name']){delete _0x1b0042[_0x21bf('0x20')];}_0x5c3d00[_0x21bf('0x11')](_0x144603)['send'](_0x1b0042);};}exports[_0x21bf('0x21')]=function(_0x2cec85,_0x544eec){var _0x3b0ee2={};var _0x19a97b=_[_0x21bf('0x22')](db[_0x21bf('0x23')][_0x21bf('0x24')],function(_0x180dd8){return{'name':_0x180dd8[_0x21bf('0x25')],'type':_0x180dd8[_0x21bf('0x26')][_0x21bf('0x27')]};});_0x3b0ee2=qs['getOptions'](_0x19a97b,_0x2cec85);return interaction[_0x21bf('0x28')](_0x21bf('0x29'),_0x2cec85[_0x21bf('0x2a')],_0x2cec85[_0x21bf('0x2b')],_0x3b0ee2,_0x19a97b)[_0x21bf('0x1b')](respondWithFilteredResult(_0x544eec,_0x3b0ee2))[_0x21bf('0x2c')](handleError(_0x544eec,null));};exports['show']=function(_0x542179,_0x1ae9dc){var _0x3f972f={};if(_0x542179['query'][_0x21bf('0x26')]&&_0x542179[_0x21bf('0x2a')][_0x21bf('0x26')]===_0x21bf('0x2d')){_0x3f972f[_0x21bf('0x2d')]=_0x542179['params']['id'];}else{_0x3f972f['id']=_0x542179[_0x21bf('0x2e')]['id'];}var _0xe8331a={'raw':![],'where':_0x3f972f},_0x25c2d6={};_0x25c2d6[_0x21bf('0x2f')]=_['keys'](db[_0x21bf('0x23')][_0x21bf('0x24')]);_0x25c2d6[_0x21bf('0x2a')]=_['keys'](_0x542179[_0x21bf('0x2a')]);_0x25c2d6[_0x21bf('0x30')]=_[_0x21bf('0x31')](_0x25c2d6[_0x21bf('0x2f')],_0x25c2d6[_0x21bf('0x2a')]);_0xe8331a[_0x21bf('0x32')]=_['intersection'](_0x25c2d6[_0x21bf('0x2f')],qs[_0x21bf('0x33')](_0x542179[_0x21bf('0x2a')][_0x21bf('0x33')]));_0xe8331a[_0x21bf('0x32')]=_0xe8331a[_0x21bf('0x32')][_0x21bf('0x34')]?_0xe8331a['attributes']:_0x25c2d6[_0x21bf('0x2f')];if(_0x542179[_0x21bf('0x2a')]['includeAll']){_0xe8331a[_0x21bf('0x35')]=[{'all':!![]}];}_0xe8331a=_[_0x21bf('0x36')]({},_0xe8331a,_0x542179['options']);return db[_0x21bf('0x23')][_0x21bf('0x37')](_0xe8331a)['then'](handleEntityNotFound(_0x1ae9dc,null))[_0x21bf('0x1b')](respondWithResult(_0x1ae9dc,null))[_0x21bf('0x2c')](handleError(_0x1ae9dc,null));};exports[_0x21bf('0x38')]=function(_0x13172f,_0x3dde71){return db[_0x21bf('0x23')][_0x21bf('0x38')](_0x13172f[_0x21bf('0x39')],{})[_0x21bf('0x1b')](respondWithResult(_0x3dde71,0xc9))[_0x21bf('0x2c')](handleError(_0x3dde71,null));};exports[_0x21bf('0x1a')]=function(_0xfbe643,_0x3375e0){if(_0xfbe643[_0x21bf('0x39')]['id']){delete _0xfbe643[_0x21bf('0x39')]['id'];}return db['OpenchannelInteraction'][_0x21bf('0x37')]({'where':{'id':_0xfbe643[_0x21bf('0x2e')]['id']}})[_0x21bf('0x1b')](handleEntityNotFound(_0x3375e0,null))['then'](saveUpdates(_0xfbe643[_0x21bf('0x39')],null))[_0x21bf('0x1b')](respondWithResult(_0x3375e0,null))['catch'](handleError(_0x3375e0,null));};exports[_0x21bf('0x1c')]=function(_0x3843db,_0x624ff2){return db[_0x21bf('0x23')][_0x21bf('0x37')]({'where':{'id':_0x3843db['params']['id']}})[_0x21bf('0x1b')](handleEntityNotFound(_0x624ff2,null))[_0x21bf('0x1b')](removeEntity(_0x624ff2,null))[_0x21bf('0x2c')](handleError(_0x624ff2,null));};exports[_0x21bf('0x3a')]=function(_0x50b8c6,_0x2225f0){return db[_0x21bf('0x23')]['describe']()[_0x21bf('0x1b')](respondWithResult(_0x2225f0,null))[_0x21bf('0x2c')](handleError(_0x2225f0,null));};exports[_0x21bf('0x3b')]=function(_0x1689c0,_0x27d927){return db[_0x21bf('0x3c')][_0x21bf('0x37')]({'where':{'id':_0x1689c0[_0x21bf('0x2e')]['id']}})[_0x21bf('0x1b')](handleEntityNotFound(_0x27d927,null))[_0x21bf('0x1b')](function(_0x5719c6){if(_0x5719c6){return _0x5719c6['addMessage'](_0x1689c0[_0x21bf('0x39')][_0x21bf('0x3d')],_['omit'](_0x1689c0[_0x21bf('0x39')],[_0x21bf('0x3d'),'id'])||{});}})['then'](respondWithResult(_0x27d927,null))[_0x21bf('0x2c')](handleError(_0x27d927,null));};exports[_0x21bf('0x3e')]=function(_0x2b7739,_0x185414){var _0xa9bec1={'raw':![],'where':{}};var _0x2812d7={};var _0x137d34={'count':0x0,'rows':[]};return db[_0x21bf('0x23')][_0x21bf('0x3f')]({'where':{'id':_0x2b7739['params']['id']}})[_0x21bf('0x1b')](handleEntityNotFound(_0x185414,null))['then'](function(_0x1aed1f){if(_0x1aed1f){_0x2812d7[_0x21bf('0x2f')]=_['keys'](db['OpenchannelMessage']['rawAttributes']);_0x2812d7[_0x21bf('0x2a')]=_['keys'](_0x2b7739[_0x21bf('0x2a')]);_0x2812d7[_0x21bf('0x30')]=_[_0x21bf('0x31')](_0x2812d7[_0x21bf('0x2f')],_0x2812d7[_0x21bf('0x2a')]);_0xa9bec1['attributes']=_['intersection'](_0x2812d7[_0x21bf('0x2f')],qs[_0x21bf('0x33')](_0x2b7739[_0x21bf('0x2a')]['fields']));_0xa9bec1[_0x21bf('0x32')]=_0xa9bec1['attributes'][_0x21bf('0x34')]?_0xa9bec1[_0x21bf('0x32')]:_0x2812d7[_0x21bf('0x2f')];if(!_0x2b7739['query'][_0x21bf('0x40')](_0x21bf('0x41'))){_0xa9bec1[_0x21bf('0x16')]=qs[_0x21bf('0x16')](_0x2b7739[_0x21bf('0x2a')]['limit']);_0xa9bec1[_0x21bf('0x14')]=qs[_0x21bf('0x14')](_0x2b7739[_0x21bf('0x2a')][_0x21bf('0x14')]);}_0xa9bec1[_0x21bf('0x42')]=qs['sort'](_0x2b7739[_0x21bf('0x2a')]['sort']);_0xa9bec1['where']=qs[_0x21bf('0x30')](_[_0x21bf('0x43')](_0x2b7739['query'],_0x2812d7[_0x21bf('0x30')]));_0xa9bec1[_0x21bf('0x44')][_0x21bf('0x45')]=_0x1aed1f['id'];if(_0x2b7739[_0x21bf('0x2a')][_0x21bf('0x46')]){_0xa9bec1[_0x21bf('0x44')]=_[_0x21bf('0x36')](_0xa9bec1[_0x21bf('0x44')],{'$or':_[_0x21bf('0x22')](_0xa9bec1[_0x21bf('0x32')],function(_0x27721c){var _0x4b4668={};_0x4b4668[_0x27721c]={'$like':'%'+_0x2b7739[_0x21bf('0x2a')][_0x21bf('0x46')]+'%'};return _0x4b4668;})});}if(_0x2b7739[_0x21bf('0x2a')]['$gte']){var _0x8e4e01=_0x2b7739[_0x21bf('0x2a')][_0x21bf('0x47')][_0x21bf('0x48')](',');var _0x2ccb75={};_0x2ccb75[_0x8e4e01[0x0]]={'$gte':moment(_0x8e4e01[0x1])['format'](_0x21bf('0x49'))};_0xa9bec1[_0x21bf('0x44')]=_[_0x21bf('0x36')](_0xa9bec1[_0x21bf('0x44')],_0x2ccb75);}_0xa9bec1=_[_0x21bf('0x36')]({},_0xa9bec1,_0x2b7739[_0x21bf('0x4a')]);return db[_0x21bf('0x3c')][_0x21bf('0x17')]({'where':_0xa9bec1[_0x21bf('0x44')]})[_0x21bf('0x1b')](function(_0x13dfb4){_0x137d34[_0x21bf('0x17')]=_0x13dfb4;if(_0x2b7739[_0x21bf('0x2a')][_0x21bf('0x4b')]){_0xa9bec1['include']=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0xa9bec1);})[_0x21bf('0x1b')](function(_0x1b09e0){_0x137d34[_0x21bf('0x4c')]=_0x1b09e0;return _0x137d34;});}})[_0x21bf('0x1b')](respondWithFilteredResult(_0x185414,_0xa9bec1))[_0x21bf('0x2c')](handleError(_0x185414,null));};exports[_0x21bf('0x4d')]=function(_0x48e034,_0x513f1){return db[_0x21bf('0x23')][_0x21bf('0x37')]({'where':{'id':_0x48e034[_0x21bf('0x2e')]['id']}})[_0x21bf('0x1b')](handleEntityNotFound(_0x513f1,null))[_0x21bf('0x1b')](function(_0x4d38dc){if(_0x4d38dc){return _0x4d38dc[_0x21bf('0x4e')](_0x48e034['body'][_0x21bf('0x3d')],_['omit'](_0x48e034[_0x21bf('0x39')],[_0x21bf('0x3d'),'id'])||{})[_0x21bf('0x4f')](function(){return db['Tag']['findAll']({'attributes':['id',_0x21bf('0x20'),_0x21bf('0x50')],'where':{'id':_0x48e034['body'][_0x21bf('0x3d')]}});})[_0x21bf('0x1b')](function(_0x1ed64a){socket[_0x21bf('0x51')](_0x21bf('0x52'),{'id':Number(_0x48e034[_0x21bf('0x2e')]['id']),'tags':_0x1ed64a||[]});return{'id':Number(_0x48e034['params']['id']),'tags':_0x1ed64a||[]};});}})[_0x21bf('0x1b')](respondWithResult(_0x513f1,null))[_0x21bf('0x2c')](handleError(_0x513f1,null));};exports[_0x21bf('0x53')]=function(_0x52e71d,_0x5ee29a){return db[_0x21bf('0x23')][_0x21bf('0x37')]({'where':{'id':_0x52e71d[_0x21bf('0x2e')]['id']}})[_0x21bf('0x1b')](handleEntityNotFound(_0x5ee29a,null))[_0x21bf('0x1b')](function(_0x418365){if(_0x418365){return _0x418365[_0x21bf('0x53')](_0x52e71d[_0x21bf('0x2a')]['ids']);}})[_0x21bf('0x1b')](respondWithStatusCode(_0x5ee29a,null))[_0x21bf('0x2c')](handleError(_0x5ee29a,null));};exports[_0x21bf('0x54')]=function(_0x1970a3,_0x95f379){var _0xd395b4=moment()[_0x21bf('0x55')]()[_0x21bf('0x56')]();var _0x3d6692=path[_0x21bf('0x57')](config[_0x21bf('0x58')],_0x21bf('0x59'),'files','tmp');var _0xb71b7a=path['join'](config[_0x21bf('0x58')],'server','files',_0x21bf('0x5a'));var _0x26c9f5=path[_0x21bf('0x57')](_0x3d6692,_0xd395b4);var _0x31c442=util[_0x21bf('0x5b')](_0x21bf('0x5c'),_0x1970a3['params']['id'],_0xd395b4);var _0x23056c=path[_0x21bf('0x57')](_0x3d6692,_0x31c442);var _0x2ae83e=[];_0x2ae83e[_0x21bf('0x5d')]({'model':db[_0x21bf('0x5e')],'as':_0x21bf('0x5e'),'attributes':['id',_0x21bf('0x5f')],'raw':!![]});_0x2ae83e[_0x21bf('0x5d')]({'model':db[_0x21bf('0x60')],'as':_0x21bf('0x61'),'attributes':['id',_0x21bf('0x62'),_0x21bf('0x63')],'raw':!![]});if(_0x1970a3[_0x21bf('0x2a')][_0x21bf('0x5a')]){_0x2ae83e[_0x21bf('0x5d')]({'model':db[_0x21bf('0x64')],'as':_0x21bf('0x64'),'raw':!![]});}var _0x5bfe61=[{'model':db[_0x21bf('0x3c')],'as':_0x21bf('0x65'),'attributes':['id',_0x21bf('0x39'),'createdAt','direction',_0x21bf('0x66'),_0x21bf('0x67')],'include':_0x2ae83e}];_0x5bfe61['push']({'model':db[_0x21bf('0x68')],'as':_0x21bf('0x69'),'attributes':['id','name']});_0x5bfe61[_0x21bf('0x5d')]({'model':db['User'],'as':_0x21bf('0x6a'),'attributes':['id','fullname']});return db[_0x21bf('0x23')][_0x21bf('0x37')]({'where':{'id':_0x1970a3[_0x21bf('0x2e')]['id']},'include':_0x5bfe61})[_0x21bf('0x1b')](handleEntityNotFound(_0x95f379,null))[_0x21bf('0x1b')](function(_0x224d21){if(_0x224d21){var _0x55ccdd=_0x224d21[_0x21bf('0x6b')]({'plain':!![]});fs[_0x21bf('0x6c')](_0x26c9f5);var _0x3fae59={'channel':_0x21bf('0x6d'),'account':_0x55ccdd[_0x21bf('0x69')][_0x21bf('0x20')],'agent':_0x55ccdd[_0x21bf('0x6a')]?_0x55ccdd[_0x21bf('0x6a')][_0x21bf('0x5f')]:_0x21bf('0x6e'),'createdAt':moment(_0x55ccdd[_0x21bf('0x6f')])[_0x21bf('0x5b')]('YYYY-MM-DD\x20HH:mm:ss')[_0x21bf('0x56')](),'closedAt':_0x55ccdd['closed']?moment(_0x55ccdd[_0x21bf('0x70')])[_0x21bf('0x5b')](_0x21bf('0x49'))[_0x21bf('0x56')]():'','disposition':_0x55ccdd['disposition'],'visibility':_0x55ccdd[_0x21bf('0x71')]?_0x21bf('0x72'):_0x21bf('0x73'),'messages':_(_0x55ccdd[_0x21bf('0x65')])[_0x21bf('0x46')]({'secret':![]})[_0x21bf('0x22')](function(_0x4200f3){if(_0x4200f3[_0x21bf('0x64')]){var _0x4b6102=path[_0x21bf('0x57')](_0xb71b7a,_0x4200f3[_0x21bf('0x64')][_0x21bf('0x74')]);if(fs[_0x21bf('0x75')](_0x4b6102)){fs[_0x21bf('0x76')](_0x4b6102)['pipe'](fs[_0x21bf('0x77')](path[_0x21bf('0x57')](_0x26c9f5,_0x4200f3[_0x21bf('0x64')][_0x21bf('0x74')])));}}return{'date':moment(_0x4200f3[_0x21bf('0x6f')])[_0x21bf('0x5b')](_0x21bf('0x49'))[_0x21bf('0x56')](),'sender':_0x4200f3[_0x21bf('0x78')]==='out'?_0x4200f3[_0x21bf('0x5e')]?_0x4200f3[_0x21bf('0x5e')]['fullname']:_0x21bf('0x79'):_0x4200f3[_0x21bf('0x61')][_0x21bf('0x62')]+(_0x4200f3['Contact'][_0x21bf('0x63')]?'\x20'+_0x4200f3[_0x21bf('0x61')][_0x21bf('0x63')]:''),'body':_0x4200f3[_0x21bf('0x64')]?_0x4200f3[_0x21bf('0x64')][_0x21bf('0x74')]:_0x4200f3[_0x21bf('0x39')],'direction':_0x4200f3[_0x21bf('0x78')]===_0x21bf('0x7a')?'A':'C','secret':_0x4200f3[_0x21bf('0x66')],'read':_0x4200f3[_0x21bf('0x67')],'attachment':_0x4200f3[_0x21bf('0x64')]};})[_0x21bf('0x7b')]()};return ejs[_0x21bf('0x7c')](path['join'](config[_0x21bf('0x58')],'server','views',_0x21bf('0x7d')),{'interaction':_0x3fae59})[_0x21bf('0x1b')](function(_0x27b746){var _0x52e9f4=path[_0x21bf('0x57')](_0x26c9f5,_0x21bf('0x7e')+_0x55ccdd['id']+'-'+_0xd395b4+'.pdf');var _0x4ac2f6={'path':_0x52e9f4,'channel':_0x21bf('0x6d'),'interactionId':_0x55ccdd['id']};return pdf[_0x21bf('0x7f')](_0x27b746,_0x4ac2f6);})[_0x21bf('0x1b')](function(){return new Promise(function(_0x49bd4a,_0x927eca){zipdir(_0x26c9f5,{'saveTo':_0x23056c},function(_0x20be2e,_0x7dc989){if(_0x20be2e)return _0x927eca(_0x20be2e);return _0x49bd4a(_0x7dc989);});})['then'](function(){return new Promise(function(_0x33a034,_0x29f268){rimraf(_0x26c9f5,function(_0x577e48){if(_0x577e48)_0x29f268(_0x577e48);return _0x33a034();});});})[_0x21bf('0x1b')](function(){return _0x95f379[_0x21bf('0x54')](_0x23056c,_0x31c442,function(_0x25820a){if(_0x25820a){logger[_0x21bf('0x1e')]('Unable\x20to\x20delete\x20zip\x20file',_0x25820a);}else{fs[_0x21bf('0x80')](_0x23056c);}});});});}else{return _0x95f379[_0x21bf('0x1d')](0xc8);}})['catch'](handleError(_0x95f379,null));}; \ No newline at end of file +var _0xe9e1=['ids','omit','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','push','User','Contact','firstName','lastName','Messages','createdAt','direction','read','Account','fullname','get','mkdirSync','Owner','N.A.','closed','disposition','threadId','Public','Private','Attachment','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','secret','value','views','downloadInteraction.ejs','transcript-','.pdf','Openchannel','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','then','error','name','send','OpenchannelInteraction','rawAttributes','fieldName','type','key','findAll','openchannel','query','show','from','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','options','find','catch','create','body','describe','addMessage','OpenchannelMessage'];(function(_0x23dda5,_0x221860){var _0x32c24e=function(_0x431a9d){while(--_0x431a9d){_0x23dda5['push'](_0x23dda5['shift']());}};_0x32c24e(++_0x221860);}(_0xe9e1,0x14d));var _0x1e9e=function(_0x10fb97,_0x16a900){_0x10fb97=_0x10fb97-0x0;var _0x3bf5fb=_0xe9e1[_0x10fb97];return _0x3bf5fb;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x1e9e('0x0'));var moment=require(_0x1e9e('0x1'));var util=require(_0x1e9e('0x2'));var path=require(_0x1e9e('0x3'));var ejs=require(_0x1e9e('0x4'));var fs=require('fs');var _=require(_0x1e9e('0x5'));var Redis=require(_0x1e9e('0x6'));var interaction=require(_0x1e9e('0x7'));var qs=require(_0x1e9e('0x8'));var pdf=require(_0x1e9e('0x9'));var logger=require(_0x1e9e('0xa'))(_0x1e9e('0xb'));var config=require(_0x1e9e('0xc'));var db=require(_0x1e9e('0xd'))['db'];config['redis']=_[_0x1e9e('0xe')](config[_0x1e9e('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0x1e9e('0x10'))(new Redis(config[_0x1e9e('0xf')]));require(_0x1e9e('0x11'))[_0x1e9e('0x12')](socket);function respondWithStatusCode(_0x39b1a2,_0x315259){_0x315259=_0x315259||0xcc;return function(_0x2dcb0b){if(_0x2dcb0b){return _0x39b1a2[_0x1e9e('0x13')](_0x315259);}return _0x39b1a2[_0x1e9e('0x14')](_0x315259)[_0x1e9e('0x15')]();};}function respondWithResult(_0x51cd51,_0x30e70a){_0x30e70a=_0x30e70a||0xc8;return function(_0x4cabcd){if(_0x4cabcd){return _0x51cd51['status'](_0x30e70a)[_0x1e9e('0x16')](_0x4cabcd);}};}function respondWithFilteredResult(_0x3fc8a5,_0x2fce35){return function(_0x14c9ed){if(_0x14c9ed){var _0x13cb0a=typeof _0x2fce35[_0x1e9e('0x17')]===_0x1e9e('0x18')&&typeof _0x2fce35['limit']==='undefined';var _0x2db740=_0x14c9ed[_0x1e9e('0x19')];var _0x3a4d0d=_0x13cb0a?0x0:_0x2fce35['offset'];var _0x2547af=_0x13cb0a?_0x14c9ed['count']:_0x2fce35[_0x1e9e('0x17')]+_0x2fce35[_0x1e9e('0x1a')];var _0x47d6a5;if(_0x2547af>=_0x2db740){_0x2547af=_0x2db740;_0x47d6a5=0xc8;}else{_0x47d6a5=0xce;}_0x3fc8a5[_0x1e9e('0x14')](_0x47d6a5);return _0x3fc8a5[_0x1e9e('0x1b')](_0x1e9e('0x1c'),_0x3a4d0d+'-'+_0x2547af+'/'+_0x2db740)['json'](_0x14c9ed);}return null;};}function saveUpdates(_0x4887a2){return function(_0x147ba9){if(_0x147ba9){return _0x147ba9[_0x1e9e('0x1d')](_0x4887a2)['then'](function(_0x50e565){return _0x50e565;});}return null;};}function removeEntity(_0x438062){return function(_0x30cad3){if(_0x30cad3){return _0x30cad3[_0x1e9e('0x1e')]()[_0x1e9e('0x1f')](function(){_0x438062[_0x1e9e('0x14')](0xcc)[_0x1e9e('0x15')]();});}};}function handleEntityNotFound(_0x337815){return function(_0x320a91){if(!_0x320a91){_0x337815['sendStatus'](0x194);}return _0x320a91;};}function handleError(_0x3eb7e2,_0x223746){_0x223746=_0x223746||0x1f4;return function(_0x3e6fc5){logger[_0x1e9e('0x20')](_0x3e6fc5['stack']);if(_0x3e6fc5['name']){delete _0x3e6fc5[_0x1e9e('0x21')];}_0x3eb7e2[_0x1e9e('0x14')](_0x223746)[_0x1e9e('0x22')](_0x3e6fc5);};}exports['index']=function(_0x4a4000,_0x45b321){var _0x25063b={};var _0x595ab0=_['map'](db[_0x1e9e('0x23')][_0x1e9e('0x24')],function(_0x187f7f){return{'name':_0x187f7f[_0x1e9e('0x25')],'type':_0x187f7f[_0x1e9e('0x26')][_0x1e9e('0x27')]};});_0x25063b=qs['getOptions'](_0x595ab0,_0x4a4000);return interaction[_0x1e9e('0x28')](_0x1e9e('0x29'),_0x4a4000[_0x1e9e('0x2a')],_0x4a4000['user'],_0x25063b,_0x595ab0)['then'](respondWithFilteredResult(_0x45b321,_0x25063b))['catch'](handleError(_0x45b321,null));};exports[_0x1e9e('0x2b')]=function(_0x2cd3d7,_0x157fd5){var _0x27baef={};if(_0x2cd3d7[_0x1e9e('0x2a')][_0x1e9e('0x26')]&&_0x2cd3d7[_0x1e9e('0x2a')][_0x1e9e('0x26')]===_0x1e9e('0x2c')){_0x27baef[_0x1e9e('0x2c')]=_0x2cd3d7[_0x1e9e('0x2d')]['id'];}else{_0x27baef['id']=_0x2cd3d7[_0x1e9e('0x2d')]['id'];}var _0x1c8d95={'raw':![],'where':_0x27baef},_0x1b3883={};_0x1b3883[_0x1e9e('0x2e')]=_[_0x1e9e('0x2f')](db[_0x1e9e('0x23')]['rawAttributes']);_0x1b3883['query']=_[_0x1e9e('0x2f')](_0x2cd3d7[_0x1e9e('0x2a')]);_0x1b3883[_0x1e9e('0x30')]=_[_0x1e9e('0x31')](_0x1b3883[_0x1e9e('0x2e')],_0x1b3883[_0x1e9e('0x2a')]);_0x1c8d95['attributes']=_[_0x1e9e('0x31')](_0x1b3883[_0x1e9e('0x2e')],qs[_0x1e9e('0x32')](_0x2cd3d7[_0x1e9e('0x2a')][_0x1e9e('0x32')]));_0x1c8d95[_0x1e9e('0x33')]=_0x1c8d95['attributes'][_0x1e9e('0x34')]?_0x1c8d95[_0x1e9e('0x33')]:_0x1b3883[_0x1e9e('0x2e')];if(_0x2cd3d7[_0x1e9e('0x2a')][_0x1e9e('0x35')]){_0x1c8d95[_0x1e9e('0x36')]=[{'all':!![]}];}_0x1c8d95=_['merge']({},_0x1c8d95,_0x2cd3d7[_0x1e9e('0x37')]);return db[_0x1e9e('0x23')][_0x1e9e('0x38')](_0x1c8d95)['then'](handleEntityNotFound(_0x157fd5,null))[_0x1e9e('0x1f')](respondWithResult(_0x157fd5,null))[_0x1e9e('0x39')](handleError(_0x157fd5,null));};exports[_0x1e9e('0x3a')]=function(_0x1c39d4,_0x388002){return db[_0x1e9e('0x23')][_0x1e9e('0x3a')](_0x1c39d4['body'],{})['then'](respondWithResult(_0x388002,0xc9))['catch'](handleError(_0x388002,null));};exports[_0x1e9e('0x1d')]=function(_0x274478,_0x27863c){if(_0x274478[_0x1e9e('0x3b')]['id']){delete _0x274478[_0x1e9e('0x3b')]['id'];}return db[_0x1e9e('0x23')][_0x1e9e('0x38')]({'where':{'id':_0x274478[_0x1e9e('0x2d')]['id']}})[_0x1e9e('0x1f')](handleEntityNotFound(_0x27863c,null))[_0x1e9e('0x1f')](saveUpdates(_0x274478['body'],null))['then'](respondWithResult(_0x27863c,null))[_0x1e9e('0x39')](handleError(_0x27863c,null));};exports['destroy']=function(_0xb91703,_0x247942){return db[_0x1e9e('0x23')][_0x1e9e('0x38')]({'where':{'id':_0xb91703[_0x1e9e('0x2d')]['id']}})['then'](handleEntityNotFound(_0x247942,null))['then'](removeEntity(_0x247942,null))[_0x1e9e('0x39')](handleError(_0x247942,null));};exports[_0x1e9e('0x3c')]=function(_0x3e8a8a,_0x57c822){return db[_0x1e9e('0x23')][_0x1e9e('0x3c')]()['then'](respondWithResult(_0x57c822,null))['catch'](handleError(_0x57c822,null));};exports[_0x1e9e('0x3d')]=function(_0x21b12a,_0xd882){return db[_0x1e9e('0x3e')]['find']({'where':{'id':_0x21b12a[_0x1e9e('0x2d')]['id']}})['then'](handleEntityNotFound(_0xd882,null))['then'](function(_0x4efc12){if(_0x4efc12){return _0x4efc12['addMessage'](_0x21b12a[_0x1e9e('0x3b')][_0x1e9e('0x3f')],_[_0x1e9e('0x40')](_0x21b12a[_0x1e9e('0x3b')],[_0x1e9e('0x3f'),'id'])||{});}})['then'](respondWithResult(_0xd882,null))['catch'](handleError(_0xd882,null));};exports['getMessages']=function(_0x213161,_0x444e80){var _0x2bce9b={'raw':![],'where':{}};var _0xb042d6={};var _0x55ff41={'count':0x0,'rows':[]};return db['OpenchannelInteraction']['findOne']({'where':{'id':_0x213161[_0x1e9e('0x2d')]['id']}})[_0x1e9e('0x1f')](handleEntityNotFound(_0x444e80,null))[_0x1e9e('0x1f')](function(_0x13bc06){if(_0x13bc06){_0xb042d6['model']=_[_0x1e9e('0x2f')](db[_0x1e9e('0x3e')]['rawAttributes']);_0xb042d6[_0x1e9e('0x2a')]=_[_0x1e9e('0x2f')](_0x213161['query']);_0xb042d6[_0x1e9e('0x30')]=_[_0x1e9e('0x31')](_0xb042d6[_0x1e9e('0x2e')],_0xb042d6[_0x1e9e('0x2a')]);_0x2bce9b[_0x1e9e('0x33')]=_[_0x1e9e('0x31')](_0xb042d6[_0x1e9e('0x2e')],qs[_0x1e9e('0x32')](_0x213161[_0x1e9e('0x2a')][_0x1e9e('0x32')]));_0x2bce9b['attributes']=_0x2bce9b['attributes']['length']?_0x2bce9b['attributes']:_0xb042d6[_0x1e9e('0x2e')];if(!_0x213161[_0x1e9e('0x2a')][_0x1e9e('0x41')](_0x1e9e('0x42'))){_0x2bce9b['limit']=qs[_0x1e9e('0x1a')](_0x213161[_0x1e9e('0x2a')][_0x1e9e('0x1a')]);_0x2bce9b[_0x1e9e('0x17')]=qs[_0x1e9e('0x17')](_0x213161['query'][_0x1e9e('0x17')]);}_0x2bce9b[_0x1e9e('0x43')]=qs[_0x1e9e('0x44')](_0x213161[_0x1e9e('0x2a')][_0x1e9e('0x44')]);_0x2bce9b['where']=qs[_0x1e9e('0x30')](_[_0x1e9e('0x45')](_0x213161['query'],_0xb042d6[_0x1e9e('0x30')]));_0x2bce9b[_0x1e9e('0x46')]['OpenchannelInteractionId']=_0x13bc06['id'];if(_0x213161['query'][_0x1e9e('0x47')]){_0x2bce9b[_0x1e9e('0x46')]=_[_0x1e9e('0x48')](_0x2bce9b[_0x1e9e('0x46')],{'$or':_[_0x1e9e('0x49')](_0x2bce9b[_0x1e9e('0x33')],function(_0x5bd15d){var _0x14ee69={};_0x14ee69[_0x5bd15d]={'$like':'%'+_0x213161[_0x1e9e('0x2a')][_0x1e9e('0x47')]+'%'};return _0x14ee69;})});}if(_0x213161[_0x1e9e('0x2a')][_0x1e9e('0x4a')]){var _0x103da0=_0x213161[_0x1e9e('0x2a')]['$gte'][_0x1e9e('0x4b')](',');var _0x300cec={};_0x300cec[_0x103da0[0x0]]={'$gte':moment(_0x103da0[0x1])[_0x1e9e('0x4c')](_0x1e9e('0x4d'))};_0x2bce9b[_0x1e9e('0x46')]=_[_0x1e9e('0x48')](_0x2bce9b[_0x1e9e('0x46')],_0x300cec);}_0x2bce9b=_[_0x1e9e('0x48')]({},_0x2bce9b,_0x213161['options']);return db['OpenchannelMessage'][_0x1e9e('0x19')]({'where':_0x2bce9b[_0x1e9e('0x46')]})[_0x1e9e('0x1f')](function(_0x123c3b){_0x55ff41[_0x1e9e('0x19')]=_0x123c3b;if(_0x213161[_0x1e9e('0x2a')][_0x1e9e('0x35')]){_0x2bce9b['include']=[{'all':!![]}];}return db[_0x1e9e('0x3e')][_0x1e9e('0x28')](_0x2bce9b);})[_0x1e9e('0x1f')](function(_0x47bbbe){_0x55ff41[_0x1e9e('0x4e')]=_0x47bbbe;return _0x55ff41;});}})[_0x1e9e('0x1f')](respondWithFilteredResult(_0x444e80,_0x2bce9b))[_0x1e9e('0x39')](handleError(_0x444e80,null));};exports['addTags']=function(_0xf51f50,_0xee114d){return db[_0x1e9e('0x23')][_0x1e9e('0x38')]({'where':{'id':_0xf51f50[_0x1e9e('0x2d')]['id']}})[_0x1e9e('0x1f')](handleEntityNotFound(_0xee114d,null))[_0x1e9e('0x1f')](function(_0x1bb96d){if(_0x1bb96d){return _0x1bb96d[_0x1e9e('0x4f')](_0xf51f50[_0x1e9e('0x3b')]['ids'],_[_0x1e9e('0x40')](_0xf51f50[_0x1e9e('0x3b')],['ids','id'])||{})['spread'](function(){return db[_0x1e9e('0x50')]['findAll']({'attributes':['id',_0x1e9e('0x21'),'color'],'where':{'id':_0xf51f50['body'][_0x1e9e('0x3f')]}});})[_0x1e9e('0x1f')](function(_0x2f5381){socket[_0x1e9e('0x51')](_0x1e9e('0x52'),{'id':Number(_0xf51f50[_0x1e9e('0x2d')]['id']),'tags':_0x2f5381||[]});return{'id':Number(_0xf51f50['params']['id']),'tags':_0x2f5381||[]};});}})[_0x1e9e('0x1f')](respondWithResult(_0xee114d,null))[_0x1e9e('0x39')](handleError(_0xee114d,null));};exports['removeTags']=function(_0x40126a,_0x361fdd){return db[_0x1e9e('0x23')][_0x1e9e('0x38')]({'where':{'id':_0x40126a['params']['id']}})[_0x1e9e('0x1f')](handleEntityNotFound(_0x361fdd,null))[_0x1e9e('0x1f')](function(_0x2cdd36){if(_0x2cdd36){return _0x2cdd36[_0x1e9e('0x53')](_0x40126a[_0x1e9e('0x2a')][_0x1e9e('0x3f')]);}})[_0x1e9e('0x1f')](respondWithStatusCode(_0x361fdd,null))[_0x1e9e('0x39')](handleError(_0x361fdd,null));};exports[_0x1e9e('0x54')]=function(_0x20e1fc,_0x294a57){var _0x4a74ba=moment()[_0x1e9e('0x55')]()[_0x1e9e('0x56')]();var _0xb0bfb5=path[_0x1e9e('0x57')](config['root'],_0x1e9e('0x58'),_0x1e9e('0x59'),_0x1e9e('0x5a'));var _0x55bc63=path[_0x1e9e('0x57')](config[_0x1e9e('0x5b')],_0x1e9e('0x58'),_0x1e9e('0x59'),_0x1e9e('0x5c'));var _0x1f7609=path['join'](_0xb0bfb5,_0x4a74ba);var _0x5a6414=util[_0x1e9e('0x4c')](_0x1e9e('0x5d'),_0x20e1fc[_0x1e9e('0x2d')]['id'],_0x4a74ba);var _0x266ab5=path['join'](_0xb0bfb5,_0x5a6414);var _0x460f95=[];_0x460f95[_0x1e9e('0x5e')]({'model':db[_0x1e9e('0x5f')],'as':_0x1e9e('0x5f'),'attributes':['id','fullname'],'raw':!![]});_0x460f95[_0x1e9e('0x5e')]({'model':db['CmContact'],'as':_0x1e9e('0x60'),'attributes':['id',_0x1e9e('0x61'),_0x1e9e('0x62')],'raw':!![]});if(_0x20e1fc[_0x1e9e('0x2a')][_0x1e9e('0x5c')]){_0x460f95[_0x1e9e('0x5e')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x1c6556=[{'model':db[_0x1e9e('0x3e')],'as':_0x1e9e('0x63'),'attributes':['id',_0x1e9e('0x3b'),_0x1e9e('0x64'),_0x1e9e('0x65'),'secret',_0x1e9e('0x66')],'include':_0x460f95}];_0x1c6556['push']({'model':db['OpenchannelAccount'],'as':_0x1e9e('0x67'),'attributes':['id','name']});_0x1c6556[_0x1e9e('0x5e')]({'model':db[_0x1e9e('0x5f')],'as':'Owner','attributes':['id',_0x1e9e('0x68')]});return db[_0x1e9e('0x23')][_0x1e9e('0x38')]({'where':{'id':_0x20e1fc[_0x1e9e('0x2d')]['id']},'include':_0x1c6556})['then'](handleEntityNotFound(_0x294a57,null))[_0x1e9e('0x1f')](function(_0x4520ac){if(_0x4520ac){var _0x53abd0=_0x4520ac[_0x1e9e('0x69')]({'plain':!![]});fs[_0x1e9e('0x6a')](_0x1f7609);var _0x14b2a2={'channel':'Openchannel','account':_0x53abd0[_0x1e9e('0x67')][_0x1e9e('0x21')],'agent':_0x53abd0[_0x1e9e('0x6b')]?_0x53abd0['Owner'][_0x1e9e('0x68')]:_0x1e9e('0x6c'),'createdAt':moment(_0x53abd0[_0x1e9e('0x64')])[_0x1e9e('0x4c')](_0x1e9e('0x4d'))[_0x1e9e('0x56')](),'closedAt':_0x53abd0[_0x1e9e('0x6d')]?moment(_0x53abd0['closedAt'])['format'](_0x1e9e('0x4d'))[_0x1e9e('0x56')]():'','disposition':_0x53abd0[_0x1e9e('0x6e')],'visibility':_0x53abd0[_0x1e9e('0x6f')]?_0x1e9e('0x70'):_0x1e9e('0x71'),'messages':_(_0x53abd0['Messages'])[_0x1e9e('0x47')]({'secret':![]})[_0x1e9e('0x49')](function(_0x46589a){if(_0x46589a[_0x1e9e('0x72')]){var _0x37b289=path[_0x1e9e('0x57')](_0x55bc63,_0x46589a[_0x1e9e('0x72')][_0x1e9e('0x73')]);if(fs[_0x1e9e('0x74')](_0x37b289)){fs[_0x1e9e('0x75')](_0x37b289)[_0x1e9e('0x76')](fs[_0x1e9e('0x77')](path[_0x1e9e('0x57')](_0x1f7609,_0x46589a[_0x1e9e('0x72')][_0x1e9e('0x73')])));}}return{'date':moment(_0x46589a[_0x1e9e('0x64')])[_0x1e9e('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1e9e('0x56')](),'sender':_0x46589a[_0x1e9e('0x65')]===_0x1e9e('0x78')?_0x46589a[_0x1e9e('0x5f')]?_0x46589a[_0x1e9e('0x5f')][_0x1e9e('0x68')]:_0x1e9e('0x79'):_0x46589a['Contact'][_0x1e9e('0x61')]+(_0x46589a[_0x1e9e('0x60')][_0x1e9e('0x62')]?'\x20'+_0x46589a[_0x1e9e('0x60')]['lastName']:''),'body':_0x46589a['Attachment']?_0x46589a[_0x1e9e('0x72')][_0x1e9e('0x73')]:_0x46589a[_0x1e9e('0x3b')],'direction':_0x46589a[_0x1e9e('0x65')]===_0x1e9e('0x78')?'A':'C','secret':_0x46589a[_0x1e9e('0x7a')],'read':_0x46589a[_0x1e9e('0x66')],'attachment':_0x46589a['Attachment']};})[_0x1e9e('0x7b')]()};return ejs['renderFile'](path['join'](config['root'],_0x1e9e('0x58'),_0x1e9e('0x7c'),_0x1e9e('0x7d')),{'interaction':_0x14b2a2})[_0x1e9e('0x1f')](function(_0x52bb5e){var _0x84dc6d=path[_0x1e9e('0x57')](_0x1f7609,_0x1e9e('0x7e')+_0x53abd0['id']+'-'+_0x4a74ba+_0x1e9e('0x7f'));var _0x1bb982={'path':_0x84dc6d,'channel':_0x1e9e('0x80'),'interactionId':_0x53abd0['id']};return pdf[_0x1e9e('0x81')](_0x52bb5e,_0x1bb982);})[_0x1e9e('0x1f')](function(){return new Promise(function(_0x354929,_0x396411){zipdir(_0x1f7609,{'saveTo':_0x266ab5},function(_0x257a6b,_0x5c3a87){if(_0x257a6b)return _0x396411(_0x257a6b);return _0x354929(_0x5c3a87);});})[_0x1e9e('0x1f')](function(){return new Promise(function(_0x3513d4,_0x484e09){rimraf(_0x1f7609,function(_0x394c86){if(_0x394c86)_0x484e09(_0x394c86);return _0x3513d4();});});})[_0x1e9e('0x1f')](function(){return _0x294a57[_0x1e9e('0x54')](_0x266ab5,_0x5a6414,function(_0x4b686a){if(_0x4b686a){logger[_0x1e9e('0x20')](_0x1e9e('0x82'),_0x4b686a);}else{fs[_0x1e9e('0x83')](_0x266ab5);}});});});}else{return _0x294a57[_0x1e9e('0x13')](0xc8);}})['catch'](handleError(_0x294a57,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 271a97a..210a083 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 _0xb400=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch'];(function(_0x41ece3,_0x3a298a){var _0x34b232=function(_0x5d4a57){while(--_0x5d4a57){_0x41ece3['push'](_0x41ece3['shift']());}};_0x34b232(++_0x3a298a);}(_0xb400,0xc3));var _0x0b40=function(_0x3ca621,_0x1f953d){_0x3ca621=_0x3ca621-0x0;var _0x1b5b71=_0xb400[_0x3ca621];return _0x1b5b71;};'use strict';var EventEmitter=require(_0x0b40('0x0'));var OpenchannelInteraction=require(_0x0b40('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x0b40('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x0b40('0x2')](0x0);var events={'afterCreate':_0x0b40('0x3'),'afterUpdate':'update','afterDestroy':_0x0b40('0x4')};function emitEvent(_0x4e2af4){return function(_0x226403,_0x40352e,_0x9ec0e8){_0x226403['getUsers']({'attributes':['id'],'raw':!![]})[_0x0b40('0x5')](function(_0x48f088){_0x226403[_0x0b40('0x6')](_0x0b40('0x7'),_0x48f088[_0x0b40('0x8')](function(_0x1e4b8e){return{'id':_0x1e4b8e['id']};}));return OpenchannelMessage[_0x0b40('0x9')]({'where':{'OpenchannelInteractionId':_0x226403['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0b40('0x5')](function(_0x2f7664){_0x226403[_0x0b40('0x6')](_0x0b40('0xa'),_0x2f7664['length']);OpenchannelInteractionEvents['emit'](_0x4e2af4+':'+_0x226403['id'],_0x226403);OpenchannelInteractionEvents[_0x0b40('0xb')](_0x4e2af4,_0x226403);_0x9ec0e8(null);})[_0x0b40('0xc')](_0x9ec0e8(null));};}for(var e in events){if(events[_0x0b40('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x0b40('0xe')](e,emitEvent(event));}}module[_0x0b40('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x1f23=['hook','events','../../mysqldb','setMaxListeners','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x1f23,0x6a));var _0x31f2=function(_0x439fb9,_0x44c41d){_0x439fb9=_0x439fb9-0x0;var _0x595889=_0x1f23[_0x439fb9];return _0x595889;};'use strict';var EventEmitter=require(_0x31f2('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x31f2('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x31f2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x31f2('0x3')};function emitEvent(_0x4b376a){return function(_0x3a756d,_0x17fb35,_0x115302){_0x3a756d[_0x31f2('0x4')]({'attributes':['id'],'raw':!![]})[_0x31f2('0x5')](function(_0x57fe2d){_0x3a756d[_0x31f2('0x6')](_0x31f2('0x7'),_0x57fe2d[_0x31f2('0x8')](function(_0x51b28b){return{'id':_0x51b28b['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x3a756d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x31f2('0x5')](function(_0x28d792){_0x3a756d[_0x31f2('0x6')](_0x31f2('0x9'),_0x28d792[_0x31f2('0xa')]);OpenchannelInteractionEvents[_0x31f2('0xb')](_0x4b376a+':'+_0x3a756d['id'],_0x3a756d);OpenchannelInteractionEvents[_0x31f2('0xb')](_0x4b376a,_0x3a756d);_0x115302(null);})[_0x31f2('0xc')](_0x115302(null));};}for(var e in events){if(events[_0x31f2('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x31f2('0xe')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 9465352..ba3e0ee 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 _0xe0d6=['utf8mb4_unicode_ci','changed','closedAt','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions'];(function(_0x2aab8e,_0x5d1e76){var _0x1211f3=function(_0xca2613){while(--_0xca2613){_0x2aab8e['push'](_0x2aab8e['shift']());}};_0x1211f3(++_0x5d1e76);}(_0xe0d6,0xa3));var _0x6e0d=function(_0x11fdb4,_0x126ff0){_0x11fdb4=_0x11fdb4-0x0;var _0x7a2344=_0xe0d6[_0x11fdb4];return _0x7a2344;};'use strict';var _=require('lodash');var util=require(_0x6e0d('0x0'));var logger=require(_0x6e0d('0x1'))(_0x6e0d('0x2'));var moment=require(_0x6e0d('0x3'));var BPromise=require(_0x6e0d('0x4'));var rp=require(_0x6e0d('0x5'));var fs=require('fs');var path=require(_0x6e0d('0x6'));var rimraf=require(_0x6e0d('0x7'));var config=require(_0x6e0d('0x8'));var attributes=require('./openchannelInteraction.attributes');module[_0x6e0d('0x9')]=function(_0x5bc3b2,_0x1db4f0){return _0x5bc3b2[_0x6e0d('0xa')](_0x6e0d('0xb'),attributes,{'tableName':_0x6e0d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6e0d('0xd'),'hooks':{'beforeUpdate':function(_0x4ff11c,_0x1b9229,_0x5f5a73){if(_0x4ff11c[_0x6e0d('0xe')]('closed')){_0x4ff11c[_0x6e0d('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x5f5a73(null,_0x4ff11c);}}});}; \ No newline at end of file +var _0xef50=['OpenchannelInteraction','openchannel_interactions','utf8mb4','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','define'];(function(_0x21fce2,_0x1bd31c){var _0x59e0da=function(_0x2c1bef){while(--_0x2c1bef){_0x21fce2['push'](_0x21fce2['shift']());}};_0x59e0da(++_0x1bd31c);}(_0xef50,0xc3));var _0x0ef5=function(_0x1bc947,_0x52b158){_0x1bc947=_0x1bc947-0x0;var _0xbadbff=_0xef50[_0x1bc947];return _0xbadbff;};'use strict';var _=require(_0x0ef5('0x0'));var util=require(_0x0ef5('0x1'));var logger=require(_0x0ef5('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0ef5('0x3'));var fs=require('fs');var path=require(_0x0ef5('0x4'));var rimraf=require(_0x0ef5('0x5'));var config=require('../../config/environment');var attributes=require(_0x0ef5('0x6'));module[_0x0ef5('0x7')]=function(_0x1ff3ae,_0xbe5cae){return _0x1ff3ae[_0x0ef5('0x8')](_0x0ef5('0x9'),attributes,{'tableName':_0x0ef5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0ef5('0xb'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x151758,_0x2d6493,_0x2aa2f6){if(_0x151758[_0x0ef5('0xc')](_0x0ef5('0xd'))){_0x151758[_0x0ef5('0xe')]=moment()[_0x0ef5('0xf')](_0x0ef5('0x10'));}_0x2aa2f6(null,_0x151758);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 31ec2ab..dab5ad8 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 _0x2ea1=['jayson/promise','client','http','redis','defaults','./openchannelInteraction.socket','register','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','UpdateOpenchannelInteraction','body','options','where','attributes','limit','then','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','ids','omit','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x2ea1,0x70));var _0x12ea=function(_0xa54b97,_0x39c756){_0xa54b97=_0xa54b97-0x0;var _0x2bbe70=_0x2ea1[_0xa54b97];return _0x2bbe70;};'use strict';var _=require(_0x12ea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x12ea('0x1'));var rs=require(_0x12ea('0x2'));var fs=require('fs');var Redis=require(_0x12ea('0x3'));var db=require(_0x12ea('0x4'))['db'];var utils=require(_0x12ea('0x5'));var logger=require('../../config/logger')(_0x12ea('0x6'));var config=require(_0x12ea('0x7'));var jayson=require(_0x12ea('0x8'));var client=jayson[_0x12ea('0x9')][_0x12ea('0xa')]({'port':0x232a});config[_0x12ea('0xb')]=_[_0x12ea('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x12ea('0xb')]));require(_0x12ea('0xd'))[_0x12ea('0xe')](socket);function respondWithRpcPromise(_0x64cfbf,_0x56cf2b,_0x588940){return new BPromise(function(_0x5d6cc2,_0x4d35e8){return client['request'](_0x64cfbf,_0x588940)['then'](function(_0x52416d){logger[_0x12ea('0xf')](_0x12ea('0x10'),_0x56cf2b,'request\x20sent');logger[_0x12ea('0x11')](_0x12ea('0x12'),_0x56cf2b,_0x12ea('0x13'),JSON[_0x12ea('0x14')](_0x52416d));if(_0x52416d['error']){if(_0x52416d['error'][_0x12ea('0x15')]===0x1f4){logger[_0x12ea('0x16')](_0x12ea('0x10'),_0x56cf2b,_0x52416d[_0x12ea('0x16')][_0x12ea('0x17')]);return _0x4d35e8(_0x52416d[_0x12ea('0x16')][_0x12ea('0x17')]);}logger[_0x12ea('0x16')](_0x12ea('0x10'),_0x56cf2b,_0x52416d['error']['message']);return _0x5d6cc2(_0x52416d[_0x12ea('0x16')][_0x12ea('0x17')]);}else{logger[_0x12ea('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x56cf2b,'request\x20sent');_0x5d6cc2(_0x52416d[_0x12ea('0x18')][_0x12ea('0x17')]);}})[_0x12ea('0x19')](function(_0x5802ae){logger['error'](_0x12ea('0x10'),_0x56cf2b,_0x5802ae);_0x4d35e8(_0x5802ae);});});}exports[_0x12ea('0x1a')]=function(_0x732dc7){var _0x54c2d1=this;return new Promise(function(_0xa9fe99,_0x5b2a04){return db['OpenchannelInteraction']['update'](_0x732dc7[_0x12ea('0x1b')],{'raw':_0x732dc7['options']?_0x732dc7[_0x12ea('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x732dc7[_0x12ea('0x1c')]?_0x732dc7[_0x12ea('0x1c')][_0x12ea('0x1d')]||null:null,'attributes':_0x732dc7['options']?_0x732dc7['options'][_0x12ea('0x1e')]||null:null,'limit':_0x732dc7[_0x12ea('0x1c')]?_0x732dc7[_0x12ea('0x1c')][_0x12ea('0x1f')]||null:null})[_0x12ea('0x20')](function(_0xaa16cf){logger[_0x12ea('0xf')](_0x12ea('0x1a'),_0x732dc7);logger[_0x12ea('0x11')](_0x12ea('0x1a'),_0x732dc7,JSON[_0x12ea('0x14')](_0xaa16cf));_0xa9fe99(_0xaa16cf);})['catch'](function(_0x20e644){logger[_0x12ea('0x16')](_0x12ea('0x1a'),_0x20e644[_0x12ea('0x17')],_0x732dc7);_0x5b2a04(_0x54c2d1['error'](0x1f4,_0x20e644['message']));});});};exports[_0x12ea('0x21')]=function(_0x331c15){return new Promise(function(_0x470254,_0x36ab62){return db[_0x12ea('0x22')][_0x12ea('0x23')]({'where':_0x331c15[_0x12ea('0x1c')]?_0x331c15[_0x12ea('0x1c')][_0x12ea('0x1d')]||null:null})[_0x12ea('0x20')](function(_0x3362eb){if(_0x3362eb){return _0x3362eb['addTags'](_0x331c15['body'][_0x12ea('0x24')],_[_0x12ea('0x25')](_0x331c15[_0x12ea('0x1b')],['ids','id'])||{});}})[_0x12ea('0x26')](function(_0x107d93){logger[_0x12ea('0xf')](_0x12ea('0x27'),_0x331c15);logger['debug'](_0x12ea('0x27'),_0x331c15,JSON[_0x12ea('0x14')](_0x107d93));_0x470254(_0x107d93);})[_0x12ea('0x19')](function(_0x46b31b){logger['error'](_0x12ea('0x27'),_0x46b31b[_0x12ea('0x17')],_0x331c15);_0x36ab62(_this[_0x12ea('0x16')](0x1f4,_0x46b31b[_0x12ea('0x17')]));});});}; \ No newline at end of file +var _0x7770=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','stringify','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','AddTags'];(function(_0x2d3145,_0x2e57e3){var _0x1d0d68=function(_0x12d355){while(--_0x12d355){_0x2d3145['push'](_0x2d3145['shift']());}};_0x1d0d68(++_0x2e57e3);}(_0x7770,0x1d9));var _0x0777=function(_0x52a3c6,_0x44bb67){_0x52a3c6=_0x52a3c6-0x0;var _0x5bda86=_0x7770[_0x52a3c6];return _0x5bda86;};'use strict';var _=require(_0x0777('0x0'));var util=require(_0x0777('0x1'));var moment=require(_0x0777('0x2'));var BPromise=require(_0x0777('0x3'));var rs=require(_0x0777('0x4'));var fs=require('fs');var Redis=require(_0x0777('0x5'));var db=require(_0x0777('0x6'))['db'];var utils=require(_0x0777('0x7'));var logger=require('../../config/logger')(_0x0777('0x8'));var config=require(_0x0777('0x9'));var jayson=require(_0x0777('0xa'));var client=jayson[_0x0777('0xb')]['http']({'port':0x232a});config[_0x0777('0xc')]=_[_0x0777('0xd')](config[_0x0777('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0777('0xe'))(new Redis(config[_0x0777('0xc')]));require(_0x0777('0xf'))[_0x0777('0x10')](socket);function respondWithRpcPromise(_0x547b18,_0x5c9d2d,_0x410241){return new BPromise(function(_0x20c59d,_0x49726a){return client['request'](_0x547b18,_0x410241)[_0x0777('0x11')](function(_0x349095){logger[_0x0777('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x5c9d2d,_0x0777('0x13'));logger[_0x0777('0x14')](_0x0777('0x15'),_0x5c9d2d,'request\x20sent',JSON['stringify'](_0x349095));if(_0x349095[_0x0777('0x16')]){if(_0x349095[_0x0777('0x16')][_0x0777('0x17')]===0x1f4){logger[_0x0777('0x16')](_0x0777('0x18'),_0x5c9d2d,_0x349095[_0x0777('0x16')]['message']);return _0x49726a(_0x349095[_0x0777('0x16')][_0x0777('0x19')]);}logger[_0x0777('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x5c9d2d,_0x349095[_0x0777('0x16')][_0x0777('0x19')]);return _0x20c59d(_0x349095[_0x0777('0x16')]['message']);}else{logger[_0x0777('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x5c9d2d,'request\x20sent');_0x20c59d(_0x349095[_0x0777('0x1a')][_0x0777('0x19')]);}})[_0x0777('0x1b')](function(_0x2b71d2){logger['error'](_0x0777('0x18'),_0x5c9d2d,_0x2b71d2);_0x49726a(_0x2b71d2);});});}exports[_0x0777('0x1c')]=function(_0x3553c3){var _0x2e035f=this;return new Promise(function(_0x2019f4,_0x5ad9d3){return db[_0x0777('0x1d')][_0x0777('0x1e')](_0x3553c3[_0x0777('0x1f')],{'raw':_0x3553c3[_0x0777('0x20')]?_0x3553c3[_0x0777('0x20')][_0x0777('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3553c3[_0x0777('0x20')]?_0x3553c3[_0x0777('0x20')][_0x0777('0x22')]||null:null,'attributes':_0x3553c3[_0x0777('0x20')]?_0x3553c3[_0x0777('0x20')][_0x0777('0x23')]||null:null,'limit':_0x3553c3[_0x0777('0x20')]?_0x3553c3[_0x0777('0x20')]['limit']||null:null})[_0x0777('0x11')](function(_0x4c2caf){logger['info'](_0x0777('0x1c'),_0x3553c3);logger['debug'](_0x0777('0x1c'),_0x3553c3,JSON[_0x0777('0x24')](_0x4c2caf));_0x2019f4(_0x4c2caf);})[_0x0777('0x1b')](function(_0xe66c98){logger[_0x0777('0x16')](_0x0777('0x1c'),_0xe66c98[_0x0777('0x19')],_0x3553c3);_0x5ad9d3(_0x2e035f[_0x0777('0x16')](0x1f4,_0xe66c98[_0x0777('0x19')]));});});};exports[_0x0777('0x25')]=function(_0x2149d0){return new Promise(function(_0x3c3b38,_0x54b7ec){return db['OpenchannelInteraction'][_0x0777('0x26')]({'where':_0x2149d0[_0x0777('0x20')]?_0x2149d0['options'][_0x0777('0x22')]||null:null})[_0x0777('0x11')](function(_0x53cf0c){if(_0x53cf0c){return _0x53cf0c[_0x0777('0x27')](_0x2149d0['body'][_0x0777('0x28')],_[_0x0777('0x29')](_0x2149d0['body'],['ids','id'])||{});}})['spread'](function(_0xe97432){logger['info'](_0x0777('0x2a'),_0x2149d0);logger[_0x0777('0x14')]('AddTags',_0x2149d0,JSON[_0x0777('0x24')](_0xe97432));_0x3c3b38(_0xe97432);})['catch'](function(_0xf522be){logger['error'](_0x0777('0x2a'),_0xf522be[_0x0777('0x19')],_0x2149d0);_0x54b7ec(_this[_0x0777('0x16')](0x1f4,_0xf522be[_0x0777('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index f3fa7cf..37a6d2a 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 _0xad2a=['length','openchannelInteraction:','./openchannelInteraction.events','save','update','register'];(function(_0x37d0bc,_0x109b96){var _0x170e60=function(_0xae2ad){while(--_0xae2ad){_0x37d0bc['push'](_0x37d0bc['shift']());}};_0x170e60(++_0x109b96);}(_0xad2a,0x74));var _0xaad2=function(_0x2bfbd3,_0x27267c){_0x2bfbd3=_0x2bfbd3-0x0;var _0x20df01=_0xad2a[_0x2bfbd3];return _0x20df01;};'use strict';var OpenchannelInteractionEvents=require(_0xaad2('0x0'));var events=[_0xaad2('0x1'),'remove',_0xaad2('0x2')];function createListener(_0x3832fa,_0x496da9){return function(_0x1c0272){_0x496da9['emit'](_0x3832fa,_0x1c0272);};}function removeListener(_0x3fb034,_0x903d73){return function(){OpenchannelInteractionEvents['removeListener'](_0x3fb034,_0x903d73);};}exports[_0xaad2('0x3')]=function(_0x56fd1b){for(var _0x494c09=0x0,_0xe5c6e=events[_0xaad2('0x4')];_0x494c09<_0xe5c6e;_0x494c09++){var _0x270f3f=events[_0x494c09];var _0x143145=createListener(_0xaad2('0x5')+_0x270f3f,_0x56fd1b);OpenchannelInteractionEvents['on'](_0x270f3f,_0x143145);}}; \ No newline at end of file +var _0xa090=['removeListener','register','length','./openchannelInteraction.events','remove','update','emit'];(function(_0x4ae947,_0x150ee7){var _0x80e75c=function(_0x48d43e){while(--_0x48d43e){_0x4ae947['push'](_0x4ae947['shift']());}};_0x80e75c(++_0x150ee7);}(_0xa090,0x88));var _0x0a09=function(_0x555b2f,_0x43b622){_0x555b2f=_0x555b2f-0x0;var _0x81c0a6=_0xa090[_0x555b2f];return _0x81c0a6;};'use strict';var OpenchannelInteractionEvents=require(_0x0a09('0x0'));var events=['save',_0x0a09('0x1'),_0x0a09('0x2')];function createListener(_0x411741,_0x5f0702){return function(_0x33e18b){_0x5f0702[_0x0a09('0x3')](_0x411741,_0x33e18b);};}function removeListener(_0x5a9a2,_0x72010b){return function(){OpenchannelInteractionEvents[_0x0a09('0x4')](_0x5a9a2,_0x72010b);};}exports[_0x0a09('0x5')]=function(_0x2edc7c){for(var _0x543af3=0x0,_0x1b6eb3=events[_0x0a09('0x6')];_0x543af3<_0x1b6eb3;_0x543af3++){var _0x511a43=events[_0x543af3];var _0x54991d=createListener('openchannelInteraction:'+_0x511a43,_0x2edc7c);OpenchannelInteractionEvents['on'](_0x511a43,_0x54991d);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index ce3af27..8989cf0 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(_0x17c579,_0x1968f3){var _0xe506d7=function(_0x218d99){while(--_0x218d99){_0x17c579['push'](_0x17c579['shift']());}};_0xe506d7(++_0x1968f3);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');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 _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x4ccf96,_0x34978e){var _0xd103b7=function(_0x55736b){while(--_0x55736b){_0x4ccf96['push'](_0x4ccf96['shift']());}};_0xd103b7(++_0x34978e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0xcb91[_0x5951e8];return _0x20a1f5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 1f1d87e..e4a43fe 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 _0x2884=['STRING','sequelize','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x44b8db,_0x4ce099){var _0x1a9600=function(_0x2cf559){while(--_0x2cf559){_0x44b8db['push'](_0x44b8db['shift']());}};_0x1a9600(++_0x4ce099);}(_0x2884,0x1eb));var _0x4288=function(_0x50cfc3,_0x526cc6){_0x50cfc3=_0x50cfc3-0x0;var _0x5c11ef=_0x2884[_0x50cfc3];return _0x5c11ef;};'use strict';var Sequelize=require(_0x4288('0x0'));module['exports']={'body':{'type':Sequelize[_0x4288('0x1')](_0x4288('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4288('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4288('0x4')]('in',_0x4288('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x4288('0x6')]},'providerResponse':{'type':Sequelize[_0x4288('0x1')]}}; \ No newline at end of file +var _0x8a5c=['TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize','exports'];(function(_0x3d026c,_0x157afb){var _0x14c5d4=function(_0x39122d){while(--_0x39122d){_0x3d026c['push'](_0x3d026c['shift']());}};_0x14c5d4(++_0x157afb);}(_0x8a5c,0x136));var _0xc8a5=function(_0x4a58ba,_0x49b665){_0x4a58ba=_0x4a58ba-0x0;var _0x44187f=_0x8a5c[_0x4a58ba];return _0x44187f;};'use strict';var Sequelize=require(_0xc8a5('0x0'));module[_0xc8a5('0x1')]={'body':{'type':Sequelize[_0xc8a5('0x2')](_0xc8a5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xc8a5('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc8a5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc8a5('0x5')]('in',_0xc8a5('0x6')),'defaultValue':_0xc8a5('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xc8a5('0x7')]},'providerResponse':{'type':Sequelize[_0xc8a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index f228b9e..dafa046 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 _0xbd85=['VIRTUAL','options','include','findAll','params','keys','rawAttributes','create','body','find','describe','openchannel-interactions','accept','openchannel','read','readAt','format','UserId','user','agent','OpenchannelInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','SELECT','contact','User','fullname','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','OpenchannelInteraction','get','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','ContactId','QueryTypes','email','interface','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','defaults','localhost','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','update','stack','name','index','OpenchannelMessage','fieldName','type','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge'];(function(_0x4f2918,_0x50aef2){var _0x2dde27=function(_0x479066){while(--_0x479066){_0x4f2918['push'](_0x4f2918['shift']());}};_0x2dde27(++_0x50aef2);}(_0xbd85,0x1f4));var _0x5bd8=function(_0xce6f11,_0x3c3137){_0xce6f11=_0xce6f11-0x0;var _0x35b709=_0xbd85[_0xce6f11];return _0x35b709;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5bd8('0x0'));var zipdir=require(_0x5bd8('0x1'));var jsonpatch=require(_0x5bd8('0x2'));var rp=require('request-promise');var moment=require(_0x5bd8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5bd8('0x4'));var util=require(_0x5bd8('0x5'));var path=require('path');var sox=require(_0x5bd8('0x6'));var csv=require(_0x5bd8('0x7'));var ejs=require(_0x5bd8('0x8'));var fs=require('fs');var fs_extra=require(_0x5bd8('0x9'));var _=require(_0x5bd8('0xa'));var squel=require('squel');var crypto=require(_0x5bd8('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5bd8('0x7'));var querystring=require('querystring');var Papa=require(_0x5bd8('0xc'));var Redis=require('ioredis');var authService=require(_0x5bd8('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x5bd8('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5bd8('0xf'))(_0x5bd8('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5bd8('0x11'))['db'];config[_0x5bd8('0x12')]=_[_0x5bd8('0x13')](config[_0x5bd8('0x12')],{'host':_0x5bd8('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5bd8('0x12')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x5bd8('0x15')]['http']({'port':0x232c});var client9002=jayson[_0x5bd8('0x15')][_0x5bd8('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x59e54d,_0x26ba74,_0x21dab6,_0x19145a){return new BPromise(function(_0x1595aa,_0x6ccbc7){var _0x241bf4=_0x19145a||client;return _0x241bf4[_0x5bd8('0x17')](_0x59e54d,_0x21dab6)[_0x5bd8('0x18')](function(_0x12323f){logger[_0x5bd8('0x19')](_0x5bd8('0x1a'),_0x26ba74,'request\x20sent');logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x26ba74,_0x5bd8('0x1b'),JSON[_0x5bd8('0x1c')](_0x12323f));if(_0x12323f[_0x5bd8('0x1d')]){if(_0x12323f[_0x5bd8('0x1d')]['code']===0x1f4){logger[_0x5bd8('0x1d')](_0x5bd8('0x1a'),_0x26ba74,_0x12323f[_0x5bd8('0x1d')][_0x5bd8('0x1e')]);return _0x6ccbc7(_0x12323f['error'][_0x5bd8('0x1e')]);}logger['error'](_0x5bd8('0x1a'),_0x26ba74,_0x12323f[_0x5bd8('0x1d')][_0x5bd8('0x1e')]);return _0x1595aa(_0x12323f[_0x5bd8('0x1d')][_0x5bd8('0x1e')]);}else{logger[_0x5bd8('0x19')]('OpenchannelMessage,\x20%s,\x20%s',_0x26ba74,'request\x20sent');_0x1595aa(_0x12323f[_0x5bd8('0x1f')][_0x5bd8('0x1e')]);}})[_0x5bd8('0x20')](function(_0x466727){logger[_0x5bd8('0x1d')](_0x5bd8('0x1a'),_0x26ba74,_0x466727);_0x6ccbc7(_0x466727);});});}function respondWithStatusCode(_0xa0c722,_0xcaa2fd){_0xcaa2fd=_0xcaa2fd||0xcc;return function(_0x5905df){if(_0x5905df){return _0xa0c722[_0x5bd8('0x21')](_0xcaa2fd);}return _0xa0c722[_0x5bd8('0x22')](_0xcaa2fd)[_0x5bd8('0x23')]();};}function respondWithResult(_0x4af9b8,_0x19c49e){_0x19c49e=_0x19c49e||0xc8;return function(_0x581b96){if(_0x581b96){return _0x4af9b8[_0x5bd8('0x22')](_0x19c49e)[_0x5bd8('0x24')](_0x581b96);}};}function respondWithFilteredResult(_0x5a6edd,_0x334c53){return function(_0x10e238){if(_0x10e238){var _0x5abf50=typeof _0x334c53[_0x5bd8('0x25')]==='undefined'&&typeof _0x334c53[_0x5bd8('0x26')]===_0x5bd8('0x27');var _0x121761=_0x10e238[_0x5bd8('0x28')];var _0x2482b0=_0x5abf50?0x0:_0x334c53[_0x5bd8('0x25')];var _0x25cffc=_0x5abf50?_0x10e238[_0x5bd8('0x28')]:_0x334c53[_0x5bd8('0x25')]+_0x334c53[_0x5bd8('0x26')];var _0x42940b;if(_0x25cffc>=_0x121761){_0x25cffc=_0x121761;_0x42940b=0xc8;}else{_0x42940b=0xce;}_0x5a6edd[_0x5bd8('0x22')](_0x42940b);return _0x5a6edd['set'](_0x5bd8('0x29'),_0x2482b0+'-'+_0x25cffc+'/'+_0x121761)[_0x5bd8('0x24')](_0x10e238);}return null;};}function patchUpdates(_0x14706d){return function(_0xd67b7){try{jsonpatch['apply'](_0xd67b7,_0x14706d,!![]);}catch(_0x1fb24e){return BPromise[_0x5bd8('0x2a')](_0x1fb24e);}return _0xd67b7['save']();};}function saveUpdates(_0x1ffaac,_0x38ecc6){return function(_0x2bf771){if(_0x2bf771){return _0x2bf771[_0x5bd8('0x2b')](_0x1ffaac)[_0x5bd8('0x18')](function(_0x2b0451){return _0x2b0451;});}return null;};}function removeEntity(_0x2cbaa9,_0x45adea){return function(_0x4ed70d){if(_0x4ed70d){return _0x4ed70d['destroy']()['then'](function(){_0x2cbaa9['status'](0xcc)[_0x5bd8('0x23')]();});}};}function handleEntityNotFound(_0x22fad3,_0x5a0d98){return function(_0x13f32a){if(!_0x13f32a){_0x22fad3[_0x5bd8('0x21')](0x194);}return _0x13f32a;};}function handleError(_0x120012,_0x5d7e10){_0x5d7e10=_0x5d7e10||0x1f4;return function(_0x3d9a24){logger[_0x5bd8('0x1d')](_0x3d9a24[_0x5bd8('0x2c')]);if(_0x3d9a24[_0x5bd8('0x2d')]){delete _0x3d9a24[_0x5bd8('0x2d')];}_0x120012['status'](_0x5d7e10)['send'](_0x3d9a24);};}exports[_0x5bd8('0x2e')]=function(_0x2427bc,_0x54d298){var _0x5a6ddc={},_0x27d5a6={},_0x5e4d83={'count':0x0,'rows':[]};var _0x36b949=_['map'](db[_0x5bd8('0x2f')]['rawAttributes'],function(_0x2c6c53){return{'name':_0x2c6c53[_0x5bd8('0x30')],'type':_0x2c6c53[_0x5bd8('0x31')]['key']};});_0x27d5a6['model']=_[_0x5bd8('0x32')](_0x36b949,'name');_0x27d5a6[_0x5bd8('0x33')]=_['keys'](_0x2427bc[_0x5bd8('0x33')]);_0x27d5a6[_0x5bd8('0x34')]=_[_0x5bd8('0x35')](_0x27d5a6[_0x5bd8('0x36')],_0x27d5a6[_0x5bd8('0x33')]);_0x5a6ddc['attributes']=_[_0x5bd8('0x35')](_0x27d5a6['model'],qs['fields'](_0x2427bc[_0x5bd8('0x33')][_0x5bd8('0x37')]));_0x5a6ddc[_0x5bd8('0x38')]=_0x5a6ddc[_0x5bd8('0x38')][_0x5bd8('0x39')]?_0x5a6ddc[_0x5bd8('0x38')]:_0x27d5a6[_0x5bd8('0x36')];if(!_0x2427bc[_0x5bd8('0x33')]['hasOwnProperty'](_0x5bd8('0x3a'))){_0x5a6ddc['limit']=qs[_0x5bd8('0x26')](_0x2427bc[_0x5bd8('0x33')]['limit']);_0x5a6ddc[_0x5bd8('0x25')]=qs[_0x5bd8('0x25')](_0x2427bc[_0x5bd8('0x33')][_0x5bd8('0x25')]);}_0x5a6ddc[_0x5bd8('0x3b')]=qs[_0x5bd8('0x3c')](_0x2427bc[_0x5bd8('0x33')][_0x5bd8('0x3c')]);_0x5a6ddc[_0x5bd8('0x3d')]=qs['filters'](_[_0x5bd8('0x3e')](_0x2427bc[_0x5bd8('0x33')],_0x27d5a6[_0x5bd8('0x34')]),_0x36b949);if(_0x2427bc[_0x5bd8('0x33')][_0x5bd8('0x3f')]){_0x5a6ddc[_0x5bd8('0x3d')]=_[_0x5bd8('0x40')](_0x5a6ddc[_0x5bd8('0x3d')],{'$or':_['map'](_0x36b949,function(_0x6c5511){if(_0x6c5511['type']!==_0x5bd8('0x41')){var _0x448cea={};_0x448cea[_0x6c5511[_0x5bd8('0x2d')]]={'$like':'%'+_0x2427bc[_0x5bd8('0x33')]['filter']+'%'};return _0x448cea;}})});}_0x5a6ddc=_[_0x5bd8('0x40')]({},_0x5a6ddc,_0x2427bc[_0x5bd8('0x42')]);var _0x1c3708={'where':_0x5a6ddc[_0x5bd8('0x3d')]};return db[_0x5bd8('0x2f')][_0x5bd8('0x28')](_0x1c3708)[_0x5bd8('0x18')](function(_0x4852cc){_0x5e4d83[_0x5bd8('0x28')]=_0x4852cc;if(_0x2427bc['query']['includeAll']){_0x5a6ddc[_0x5bd8('0x43')]=[{'all':!![]}];}return db[_0x5bd8('0x2f')][_0x5bd8('0x44')](_0x5a6ddc);})[_0x5bd8('0x18')](function(_0x5e79e8){_0x5e4d83['rows']=_0x5e79e8;return _0x5e4d83;})[_0x5bd8('0x18')](respondWithFilteredResult(_0x54d298,_0x5a6ddc))['catch'](handleError(_0x54d298,null));};exports['show']=function(_0x34c26e,_0x2e09d9){var _0x4d30e2={'raw':!![],'where':{'id':_0x34c26e[_0x5bd8('0x45')]['id']}},_0x58026d={};_0x58026d[_0x5bd8('0x36')]=_[_0x5bd8('0x46')](db['OpenchannelMessage'][_0x5bd8('0x47')]);_0x58026d[_0x5bd8('0x33')]=_[_0x5bd8('0x46')](_0x34c26e[_0x5bd8('0x33')]);_0x58026d['filters']=_[_0x5bd8('0x35')](_0x58026d[_0x5bd8('0x36')],_0x58026d[_0x5bd8('0x33')]);_0x4d30e2[_0x5bd8('0x38')]=_['intersection'](_0x58026d['model'],qs[_0x5bd8('0x37')](_0x34c26e[_0x5bd8('0x33')][_0x5bd8('0x37')]));_0x4d30e2[_0x5bd8('0x38')]=_0x4d30e2[_0x5bd8('0x38')]['length']?_0x4d30e2[_0x5bd8('0x38')]:_0x58026d[_0x5bd8('0x36')];if(_0x34c26e[_0x5bd8('0x33')]['includeAll']){_0x4d30e2[_0x5bd8('0x43')]=[{'all':!![]}];}_0x4d30e2=_[_0x5bd8('0x40')]({},_0x4d30e2,_0x34c26e[_0x5bd8('0x42')]);return db[_0x5bd8('0x2f')]['find'](_0x4d30e2)[_0x5bd8('0x18')](handleEntityNotFound(_0x2e09d9,null))['then'](respondWithResult(_0x2e09d9,null))[_0x5bd8('0x20')](handleError(_0x2e09d9,null));};exports[_0x5bd8('0x48')]=function(_0x3b2ad4,_0x22b727){return db[_0x5bd8('0x2f')]['create'](_0x3b2ad4['body'],{})[_0x5bd8('0x18')](respondWithResult(_0x22b727,0xc9))['catch'](handleError(_0x22b727,null));};exports[_0x5bd8('0x2b')]=function(_0x52adf1,_0x46cb8e){if(_0x52adf1[_0x5bd8('0x49')]['id']){delete _0x52adf1[_0x5bd8('0x49')]['id'];}return db[_0x5bd8('0x2f')][_0x5bd8('0x4a')]({'where':{'id':_0x52adf1[_0x5bd8('0x45')]['id']}})[_0x5bd8('0x18')](handleEntityNotFound(_0x46cb8e,null))[_0x5bd8('0x18')](saveUpdates(_0x52adf1[_0x5bd8('0x49')],null))[_0x5bd8('0x18')](respondWithResult(_0x46cb8e,null))['catch'](handleError(_0x46cb8e,null));};exports['destroy']=function(_0x8fe1fc,_0x4f6f03){return db['OpenchannelMessage']['find']({'where':{'id':_0x8fe1fc[_0x5bd8('0x45')]['id']}})[_0x5bd8('0x18')](handleEntityNotFound(_0x4f6f03,null))[_0x5bd8('0x18')](removeEntity(_0x4f6f03,null))['catch'](handleError(_0x4f6f03,null));};exports[_0x5bd8('0x4b')]=function(_0x38c40d,_0x2cd572){return db[_0x5bd8('0x2f')][_0x5bd8('0x4b')]()['then'](respondWithResult(_0x2cd572,null))[_0x5bd8('0x20')](handleError(_0x2cd572,null));};var interaction_log=require(_0x5bd8('0xf'))(_0x5bd8('0x4c'));exports[_0x5bd8('0x4d')]=function(_0x85ef97,_0x216808,_0x47bfdc){var _0x1f8f13={'agent':{},'channel':_0x5bd8('0x4e')};if(_0x85ef97[_0x5bd8('0x49')]['id']){delete _0x85ef97[_0x5bd8('0x49')]['id'];}_0x85ef97[_0x5bd8('0x49')][_0x5bd8('0x4f')]=!![];_0x85ef97['body'][_0x5bd8('0x50')]=moment()[_0x5bd8('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x85ef97['body'][_0x5bd8('0x52')]=_0x85ef97['body']['UserId']||_0x85ef97[_0x5bd8('0x53')]['id'];_0x1f8f13[_0x5bd8('0x54')]['id']=_0x85ef97[_0x5bd8('0x49')]['UserId'];return db[_0x5bd8('0x2f')][_0x5bd8('0x4a')]({'where':{'id':_0x85ef97[_0x5bd8('0x45')]['id'],'UserId':null}})[_0x5bd8('0x18')](handleEntityNotFound(_0x216808,null))[_0x5bd8('0x18')](saveUpdates(_0x85ef97[_0x5bd8('0x49')],null))[_0x5bd8('0x18')](function(_0x1eee62){if(_0x1eee62){_0x1f8f13[_0x5bd8('0x1e')]=_0x1eee62['get']({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x1eee62[_0x5bd8('0x55')]}});}return null;})[_0x5bd8('0x18')](handleEntityNotFound(_0x216808,null))[_0x5bd8('0x18')](function(_0x571f83){if(_0x571f83){return _0x571f83[_0x5bd8('0x2b')]({'UserId':_0x85ef97[_0x5bd8('0x49')]['UserId'],'read1stAt':_['isNil'](_0x571f83[_0x5bd8('0x56')])?moment()[_0x5bd8('0x51')](_0x5bd8('0x57')):undefined});}return null;})['then'](function(_0x1cb00f){if(_0x1cb00f){_0x1f8f13['interaction']=_0x1cb00f['get']({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x85ef97[_0x5bd8('0x53')]['id'],_0x85ef97[_0x5bd8('0x53')][_0x5bd8('0x2d')],_0x85ef97[_0x5bd8('0x53')]['role'],_0x1f8f13[_0x5bd8('0x58')]['id'],_0x85ef97[_0x5bd8('0x49')]?JSON[_0x5bd8('0x1c')](_0x85ef97[_0x5bd8('0x49')]):_0x5bd8('0x59'));return respondWithRpcPromise(_0x5bd8('0x5a'),'acceptMessage',_0x1f8f13);}return null;})['then'](function(_0x13768b){var _0x547dd1=_0x5bd8('0x5b')+_0x13768b[_0x5bd8('0x1e')]['ContactId'];return db[_0x5bd8('0x5c')][_0x5bd8('0x33')](_0x547dd1,{'type':db['Sequelize']['QueryTypes'][_0x5bd8('0x5d')],'raw':!![]})[_0x5bd8('0x18')](function(_0x132ccc){return _0x132ccc;});})[_0x5bd8('0x18')](function(_0x41e28c){if(_0x41e28c){_0x1f8f13[_0x5bd8('0x1e')][_0x5bd8('0x5e')]=_0x41e28c[0x0];if(!_0x85ef97[_0x5bd8('0x49')][_0x5bd8('0x52')])return;return db[_0x5bd8('0x5f')][_0x5bd8('0x4a')]({'where':{'id':_0x85ef97[_0x5bd8('0x49')][_0x5bd8('0x52')],'role':_0x5bd8('0x54')},'attributes':['id',_0x5bd8('0x2d'),_0x5bd8('0x60'),'email',_0x5bd8('0x61')],'raw':!![]});}return null;})['then'](function(_0xb80133){if(!_0xb80133)return null;_0x1f8f13[_0x5bd8('0x1e')][_0x5bd8('0x54')]=_0xb80133;return _0x1f8f13;})[_0x5bd8('0x18')](function(_0x201957){if(_0x201957){if(_0x85ef97['body'][_0x5bd8('0x62')]){_0x1f8f13[_0x5bd8('0x1e')]['interface']=util[_0x5bd8('0x51')](_0x5bd8('0x63'),_0x85ef97['user']['name']);_0x1f8f13['message'][_0x5bd8('0x64')]=_0x1f8f13[_0x5bd8('0x64')];_0x1f8f13[_0x5bd8('0x1e')][_0x5bd8('0x65')]=_0x1f8f13['channel'];_0x1f8f13['message'][_0x5bd8('0x66')]=_0x5bd8('0x4d');return respondWithRpcPromise(_0x5bd8('0x67'),_0x5bd8('0x67'),{'event':_0x5bd8('0x68'),'message':_0x1f8f13[_0x5bd8('0x1e')]},client9002)[_0x5bd8('0x18')](function(){return _0x1f8f13;});}return _0x1f8f13;}return null;})[_0x5bd8('0x18')](respondWithResult(_0x216808,null))['catch'](handleError(_0x216808,null));};var interaction_log=require(_0x5bd8('0xf'))(_0x5bd8('0x4c'));exports[_0x5bd8('0x2a')]=function(_0x63b72f,_0x5b7953,_0x18a1df){var _0xb17ca4={'agent':{},'channel':'openchannel'};if(_0x63b72f[_0x5bd8('0x49')]['id']){delete _0x63b72f[_0x5bd8('0x49')]['id'];}_0x63b72f['body']['UserId']=_0x63b72f[_0x5bd8('0x49')][_0x5bd8('0x52')]||_0x63b72f[_0x5bd8('0x53')]['id'];_0xb17ca4[_0x5bd8('0x54')]['id']=_0x63b72f[_0x5bd8('0x49')][_0x5bd8('0x52')];return db[_0x5bd8('0x2f')]['find']({'where':{'id':_0x63b72f[_0x5bd8('0x45')]['id'],'UserId':null}})[_0x5bd8('0x18')](handleEntityNotFound(_0x5b7953,null))[_0x5bd8('0x18')](function(_0x2d71b3){if(_0x2d71b3){_0xb17ca4[_0x5bd8('0x1e')]=_0x2d71b3['get']({'plain':!![]});return db[_0x5bd8('0x69')][_0x5bd8('0x4a')]({'where':{'id':_0x2d71b3[_0x5bd8('0x55')]}});}return null;})['then'](handleEntityNotFound(_0x5b7953,null))[_0x5bd8('0x18')](function(_0x598d7b){if(_0x598d7b){_0xb17ca4[_0x5bd8('0x58')]=_0x598d7b[_0x5bd8('0x6a')]({'plain':!![]});interaction_log['info'](_0x5bd8('0x6b'),_0x63b72f[_0x5bd8('0x53')]['id'],_0x63b72f[_0x5bd8('0x53')][_0x5bd8('0x2d')],_0x63b72f['user'][_0x5bd8('0x6c')],_0xb17ca4[_0x5bd8('0x58')]['id'],_0x63b72f[_0x5bd8('0x49')]?JSON[_0x5bd8('0x1c')](_0x63b72f[_0x5bd8('0x49')]):_0x5bd8('0x59'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0xb17ca4);}return null;})[_0x5bd8('0x18')](function(_0x51b85f){var _0x360251='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x51b85f[_0x5bd8('0x1e')][_0x5bd8('0x6d')];return db[_0x5bd8('0x5c')][_0x5bd8('0x33')](_0x360251,{'type':db['Sequelize'][_0x5bd8('0x6e')][_0x5bd8('0x5d')],'raw':!![]})['then'](function(_0x59bb78){return _0x59bb78;});})['then'](function(_0x5114ed){if(_0x5114ed){_0xb17ca4['message']['contact']=_0x5114ed[0x0];if(!_0x63b72f[_0x5bd8('0x49')][_0x5bd8('0x52')])return;return db['User'][_0x5bd8('0x4a')]({'where':{'id':_0x63b72f[_0x5bd8('0x49')][_0x5bd8('0x52')],'role':_0x5bd8('0x54')},'attributes':['id',_0x5bd8('0x2d'),_0x5bd8('0x60'),_0x5bd8('0x6f'),_0x5bd8('0x61')],'raw':!![]});}return null;})['then'](function(_0x4b9ae2){if(!_0x4b9ae2)return null;_0xb17ca4['message']['agent']=_0x4b9ae2;return _0xb17ca4;})[_0x5bd8('0x18')](function(_0x3beffe){if(_0x3beffe){_0x3beffe[_0x5bd8('0x1e')][_0x5bd8('0x70')]=util[_0x5bd8('0x51')]('SIP/%s',_0x63b72f[_0x5bd8('0x53')][_0x5bd8('0x2d')]);_0x3beffe[_0x5bd8('0x1e')]['channel']=_0xb17ca4[_0x5bd8('0x64')];_0x3beffe[_0x5bd8('0x1e')][_0x5bd8('0x65')]=_0xb17ca4[_0x5bd8('0x64')];_0x3beffe[_0x5bd8('0x1e')][_0x5bd8('0x66')]='reject';respondWithRpcPromise(_0x5bd8('0x67'),_0x5bd8('0x67'),{'event':'rejectmessage','message':_0x3beffe['message']},client9002);return _0xb17ca4;}return null;})[_0x5bd8('0x18')](respondWithResult(_0x5b7953,null))[_0x5bd8('0x20')](handleError(_0x5b7953,null));}; \ No newline at end of file +var _0x1315=['http','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','update','stack','name','send','index','map','OpenchannelMessage','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','options','create','body','find','destroy','describe','openchannel-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','isNil','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User','fullname','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','reject','openchannel','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','email','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register'];(function(_0x21b293,_0x352a44){var _0xd73e84=function(_0x16916b){while(--_0x16916b){_0x21b293['push'](_0x21b293['shift']());}};_0xd73e84(++_0x352a44);}(_0x1315,0xdd));var _0x5131=function(_0x1c3c47,_0x59fd36){_0x1c3c47=_0x1c3c47-0x0;var _0x1582b9=_0x1315[_0x1c3c47];return _0x1582b9;};'use strict';var emlformat=require(_0x5131('0x0'));var rimraf=require(_0x5131('0x1'));var zipdir=require(_0x5131('0x2'));var jsonpatch=require(_0x5131('0x3'));var rp=require(_0x5131('0x4'));var moment=require(_0x5131('0x5'));var BPromise=require(_0x5131('0x6'));var Mustache=require(_0x5131('0x7'));var util=require(_0x5131('0x8'));var path=require('path');var sox=require(_0x5131('0x9'));var csv=require(_0x5131('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5131('0xb'));var _=require(_0x5131('0xc'));var squel=require(_0x5131('0xd'));var crypto=require(_0x5131('0xe'));var jsforce=require(_0x5131('0xf'));var deskjs=require(_0x5131('0x10'));var toCsv=require(_0x5131('0xa'));var querystring=require(_0x5131('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5131('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5131('0x13'));var logger=require(_0x5131('0x14'))(_0x5131('0x15'));var utils=require(_0x5131('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5131('0x17'));var db=require('../../mysqldb')['db'];config[_0x5131('0x18')]=_[_0x5131('0x19')](config[_0x5131('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x5131('0x1a'))(new Redis(config[_0x5131('0x18')]));require(_0x5131('0x1b'))[_0x5131('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x5131('0x1d')]({'port':0x232c});var client9002=jayson[_0x5131('0x1e')][_0x5131('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x41c302,_0x1f2bbb,_0x3037a1,_0x25c190){return new BPromise(function(_0x36af09,_0x34fcf7){var _0xd20735=_0x25c190||client;return _0xd20735[_0x5131('0x1f')](_0x41c302,_0x3037a1)[_0x5131('0x20')](function(_0xa54628){logger[_0x5131('0x21')](_0x5131('0x22'),_0x1f2bbb,_0x5131('0x23'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x1f2bbb,_0x5131('0x23'),JSON[_0x5131('0x24')](_0xa54628));if(_0xa54628[_0x5131('0x25')]){if(_0xa54628['error']['code']===0x1f4){logger[_0x5131('0x25')](_0x5131('0x22'),_0x1f2bbb,_0xa54628[_0x5131('0x25')]['message']);return _0x34fcf7(_0xa54628[_0x5131('0x25')][_0x5131('0x26')]);}logger['error'](_0x5131('0x22'),_0x1f2bbb,_0xa54628[_0x5131('0x25')]['message']);return _0x36af09(_0xa54628[_0x5131('0x25')]['message']);}else{logger[_0x5131('0x21')](_0x5131('0x22'),_0x1f2bbb,_0x5131('0x23'));_0x36af09(_0xa54628[_0x5131('0x27')]['message']);}})['catch'](function(_0x54c870){logger[_0x5131('0x25')](_0x5131('0x22'),_0x1f2bbb,_0x54c870);_0x34fcf7(_0x54c870);});});}function respondWithStatusCode(_0x334e56,_0xd32345){_0xd32345=_0xd32345||0xcc;return function(_0x1dff5d){if(_0x1dff5d){return _0x334e56[_0x5131('0x28')](_0xd32345);}return _0x334e56['status'](_0xd32345)[_0x5131('0x29')]();};}function respondWithResult(_0x2ef7b9,_0x339246){_0x339246=_0x339246||0xc8;return function(_0x416f72){if(_0x416f72){return _0x2ef7b9['status'](_0x339246)[_0x5131('0x2a')](_0x416f72);}};}function respondWithFilteredResult(_0x1245a7,_0x1f7d06){return function(_0x387a00){if(_0x387a00){var _0x1384b2=typeof _0x1f7d06[_0x5131('0x2b')]===_0x5131('0x2c')&&typeof _0x1f7d06['limit']===_0x5131('0x2c');var _0x51dbcf=_0x387a00[_0x5131('0x2d')];var _0x22a3a4=_0x1384b2?0x0:_0x1f7d06[_0x5131('0x2b')];var _0x235b3b=_0x1384b2?_0x387a00[_0x5131('0x2d')]:_0x1f7d06[_0x5131('0x2b')]+_0x1f7d06[_0x5131('0x2e')];var _0xb5f449;if(_0x235b3b>=_0x51dbcf){_0x235b3b=_0x51dbcf;_0xb5f449=0xc8;}else{_0xb5f449=0xce;}_0x1245a7[_0x5131('0x2f')](_0xb5f449);return _0x1245a7[_0x5131('0x30')](_0x5131('0x31'),_0x22a3a4+'-'+_0x235b3b+'/'+_0x51dbcf)[_0x5131('0x2a')](_0x387a00);}return null;};}function patchUpdates(_0x5740eb){return function(_0x4b262a){try{jsonpatch[_0x5131('0x32')](_0x4b262a,_0x5740eb,!![]);}catch(_0x50dd1d){return BPromise['reject'](_0x50dd1d);}return _0x4b262a['save']();};}function saveUpdates(_0x245b4c,_0x319df4){return function(_0x44e056){if(_0x44e056){return _0x44e056[_0x5131('0x33')](_0x245b4c)[_0x5131('0x20')](function(_0x48fe64){return _0x48fe64;});}return null;};}function removeEntity(_0x29ecca,_0x1ce514){return function(_0x205814){if(_0x205814){return _0x205814['destroy']()['then'](function(){_0x29ecca['status'](0xcc)[_0x5131('0x29')]();});}};}function handleEntityNotFound(_0x32db9d,_0x40439c){return function(_0x1d200e){if(!_0x1d200e){_0x32db9d[_0x5131('0x28')](0x194);}return _0x1d200e;};}function handleError(_0x81b7c0,_0x4e4bd4){_0x4e4bd4=_0x4e4bd4||0x1f4;return function(_0x4bd94f){logger['error'](_0x4bd94f[_0x5131('0x34')]);if(_0x4bd94f[_0x5131('0x35')]){delete _0x4bd94f[_0x5131('0x35')];}_0x81b7c0[_0x5131('0x2f')](_0x4e4bd4)[_0x5131('0x36')](_0x4bd94f);};}exports[_0x5131('0x37')]=function(_0x4cf92d,_0x3ed2ee){var _0x36fff9={},_0xff1bd2={},_0x17d749={'count':0x0,'rows':[]};var _0x4a6a60=_[_0x5131('0x38')](db[_0x5131('0x39')][_0x5131('0x3a')],function(_0x6126e7){return{'name':_0x6126e7['fieldName'],'type':_0x6126e7[_0x5131('0x3b')]['key']};});_0xff1bd2[_0x5131('0x3c')]=_[_0x5131('0x38')](_0x4a6a60,_0x5131('0x35'));_0xff1bd2[_0x5131('0x3d')]=_[_0x5131('0x3e')](_0x4cf92d[_0x5131('0x3d')]);_0xff1bd2[_0x5131('0x3f')]=_['intersection'](_0xff1bd2[_0x5131('0x3c')],_0xff1bd2['query']);_0x36fff9[_0x5131('0x40')]=_[_0x5131('0x41')](_0xff1bd2['model'],qs[_0x5131('0x42')](_0x4cf92d['query'][_0x5131('0x42')]));_0x36fff9[_0x5131('0x40')]=_0x36fff9[_0x5131('0x40')][_0x5131('0x43')]?_0x36fff9[_0x5131('0x40')]:_0xff1bd2[_0x5131('0x3c')];if(!_0x4cf92d[_0x5131('0x3d')]['hasOwnProperty'](_0x5131('0x44'))){_0x36fff9['limit']=qs['limit'](_0x4cf92d['query']['limit']);_0x36fff9['offset']=qs['offset'](_0x4cf92d[_0x5131('0x3d')]['offset']);}_0x36fff9[_0x5131('0x45')]=qs[_0x5131('0x46')](_0x4cf92d[_0x5131('0x3d')][_0x5131('0x46')]);_0x36fff9[_0x5131('0x47')]=qs['filters'](_['pick'](_0x4cf92d[_0x5131('0x3d')],_0xff1bd2['filters']),_0x4a6a60);if(_0x4cf92d[_0x5131('0x3d')]['filter']){_0x36fff9[_0x5131('0x47')]=_[_0x5131('0x48')](_0x36fff9[_0x5131('0x47')],{'$or':_[_0x5131('0x38')](_0x4a6a60,function(_0x15838b){if(_0x15838b[_0x5131('0x3b')]!==_0x5131('0x49')){var _0x35aa29={};_0x35aa29[_0x15838b[_0x5131('0x35')]]={'$like':'%'+_0x4cf92d[_0x5131('0x3d')][_0x5131('0x4a')]+'%'};return _0x35aa29;}})});}_0x36fff9=_[_0x5131('0x48')]({},_0x36fff9,_0x4cf92d['options']);var _0x5f44dd={'where':_0x36fff9['where']};return db[_0x5131('0x39')][_0x5131('0x2d')](_0x5f44dd)[_0x5131('0x20')](function(_0x3a13e5){_0x17d749['count']=_0x3a13e5;if(_0x4cf92d[_0x5131('0x3d')][_0x5131('0x4b')]){_0x36fff9[_0x5131('0x4c')]=[{'all':!![]}];}return db[_0x5131('0x39')]['findAll'](_0x36fff9);})[_0x5131('0x20')](function(_0x5e2297){_0x17d749[_0x5131('0x4d')]=_0x5e2297;return _0x17d749;})['then'](respondWithFilteredResult(_0x3ed2ee,_0x36fff9))[_0x5131('0x4e')](handleError(_0x3ed2ee,null));};exports[_0x5131('0x4f')]=function(_0x465a96,_0x3b98d3){var _0x21fb45={'raw':!![],'where':{'id':_0x465a96[_0x5131('0x50')]['id']}},_0x1cd36c={};_0x1cd36c[_0x5131('0x3c')]=_['keys'](db['OpenchannelMessage'][_0x5131('0x3a')]);_0x1cd36c[_0x5131('0x3d')]=_[_0x5131('0x3e')](_0x465a96[_0x5131('0x3d')]);_0x1cd36c[_0x5131('0x3f')]=_[_0x5131('0x41')](_0x1cd36c['model'],_0x1cd36c[_0x5131('0x3d')]);_0x21fb45[_0x5131('0x40')]=_[_0x5131('0x41')](_0x1cd36c['model'],qs['fields'](_0x465a96['query'][_0x5131('0x42')]));_0x21fb45[_0x5131('0x40')]=_0x21fb45[_0x5131('0x40')]['length']?_0x21fb45[_0x5131('0x40')]:_0x1cd36c[_0x5131('0x3c')];if(_0x465a96[_0x5131('0x3d')]['includeAll']){_0x21fb45[_0x5131('0x4c')]=[{'all':!![]}];}_0x21fb45=_[_0x5131('0x48')]({},_0x21fb45,_0x465a96[_0x5131('0x51')]);return db['OpenchannelMessage']['find'](_0x21fb45)['then'](handleEntityNotFound(_0x3b98d3,null))[_0x5131('0x20')](respondWithResult(_0x3b98d3,null))[_0x5131('0x4e')](handleError(_0x3b98d3,null));};exports['create']=function(_0x559141,_0x219571){return db[_0x5131('0x39')][_0x5131('0x52')](_0x559141[_0x5131('0x53')],{})[_0x5131('0x20')](respondWithResult(_0x219571,0xc9))[_0x5131('0x4e')](handleError(_0x219571,null));};exports['update']=function(_0x1bb408,_0x1425bb){if(_0x1bb408['body']['id']){delete _0x1bb408[_0x5131('0x53')]['id'];}return db[_0x5131('0x39')][_0x5131('0x54')]({'where':{'id':_0x1bb408['params']['id']}})[_0x5131('0x20')](handleEntityNotFound(_0x1425bb,null))[_0x5131('0x20')](saveUpdates(_0x1bb408[_0x5131('0x53')],null))['then'](respondWithResult(_0x1425bb,null))[_0x5131('0x4e')](handleError(_0x1425bb,null));};exports[_0x5131('0x55')]=function(_0x13ce7a,_0x577ef2){return db[_0x5131('0x39')][_0x5131('0x54')]({'where':{'id':_0x13ce7a[_0x5131('0x50')]['id']}})['then'](handleEntityNotFound(_0x577ef2,null))[_0x5131('0x20')](removeEntity(_0x577ef2,null))[_0x5131('0x4e')](handleError(_0x577ef2,null));};exports[_0x5131('0x56')]=function(_0x5c99a0,_0x27c11e){return db[_0x5131('0x39')][_0x5131('0x56')]()[_0x5131('0x20')](respondWithResult(_0x27c11e,null))['catch'](handleError(_0x27c11e,null));};var interaction_log=require(_0x5131('0x14'))(_0x5131('0x57'));exports[_0x5131('0x58')]=function(_0x4297ca,_0x35ce2b,_0x2de753){var _0x4f1626={'agent':{},'channel':'openchannel'};if(_0x4297ca['body']['id']){delete _0x4297ca[_0x5131('0x53')]['id'];}_0x4297ca[_0x5131('0x53')][_0x5131('0x59')]=!![];_0x4297ca['body'][_0x5131('0x5a')]=moment()[_0x5131('0x5b')](_0x5131('0x5c'));_0x4297ca['body'][_0x5131('0x5d')]=_0x4297ca[_0x5131('0x53')][_0x5131('0x5d')]||_0x4297ca[_0x5131('0x5e')]['id'];_0x4f1626[_0x5131('0x5f')]['id']=_0x4297ca[_0x5131('0x53')]['UserId'];return db[_0x5131('0x39')][_0x5131('0x54')]({'where':{'id':_0x4297ca[_0x5131('0x50')]['id'],'UserId':null}})[_0x5131('0x20')](handleEntityNotFound(_0x35ce2b,null))[_0x5131('0x20')](saveUpdates(_0x4297ca[_0x5131('0x53')],null))['then'](function(_0x68808b){if(_0x68808b){_0x4f1626[_0x5131('0x26')]=_0x68808b[_0x5131('0x60')]({'plain':!![]});return db[_0x5131('0x61')]['find']({'where':{'id':_0x68808b['OpenchannelInteractionId']}});}return null;})[_0x5131('0x20')](handleEntityNotFound(_0x35ce2b,null))[_0x5131('0x20')](function(_0x1ee55b){if(_0x1ee55b){return _0x1ee55b['update']({'UserId':_0x4297ca[_0x5131('0x53')][_0x5131('0x5d')],'read1stAt':_[_0x5131('0x62')](_0x1ee55b['read1stAt'])?moment()[_0x5131('0x5b')](_0x5131('0x5c')):undefined});}return null;})['then'](function(_0x40021c){if(_0x40021c){_0x4f1626['interaction']=_0x40021c['get']({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4297ca['user']['id'],_0x4297ca[_0x5131('0x5e')][_0x5131('0x35')],_0x4297ca[_0x5131('0x5e')][_0x5131('0x63')],_0x4f1626['interaction']['id'],_0x4297ca[_0x5131('0x53')]?JSON['stringify'](_0x4297ca[_0x5131('0x53')]):_0x5131('0x64'));return respondWithRpcPromise(_0x5131('0x65'),'acceptMessage',_0x4f1626);}return null;})['then'](function(_0x328232){var _0xbe859c=_0x5131('0x66')+_0x328232['message'][_0x5131('0x67')];return db[_0x5131('0x68')][_0x5131('0x3d')](_0xbe859c,{'type':db['Sequelize'][_0x5131('0x69')][_0x5131('0x6a')],'raw':!![]})[_0x5131('0x20')](function(_0x38cb57){return _0x38cb57;});})[_0x5131('0x20')](function(_0x5ceb6b){if(_0x5ceb6b){_0x4f1626[_0x5131('0x26')]['contact']=_0x5ceb6b[0x0];if(!_0x4297ca['body']['UserId'])return;return db[_0x5131('0x6b')][_0x5131('0x54')]({'where':{'id':_0x4297ca[_0x5131('0x53')][_0x5131('0x5d')],'role':_0x5131('0x5f')},'attributes':['id','name',_0x5131('0x6c'),'email',_0x5131('0x6d')],'raw':!![]});}return null;})[_0x5131('0x20')](function(_0x25afde){if(!_0x25afde)return null;_0x4f1626[_0x5131('0x26')][_0x5131('0x5f')]=_0x25afde;return _0x4f1626;})[_0x5131('0x20')](function(_0x463735){if(_0x463735){if(_0x4297ca[_0x5131('0x53')]['manual']){_0x4f1626[_0x5131('0x26')][_0x5131('0x6e')]=util[_0x5131('0x5b')](_0x5131('0x6f'),_0x4297ca['user'][_0x5131('0x35')]);_0x4f1626[_0x5131('0x26')]['channel']=_0x4f1626[_0x5131('0x70')];_0x4f1626[_0x5131('0x26')][_0x5131('0x71')]=_0x4f1626['channel'];_0x4f1626[_0x5131('0x26')][_0x5131('0x72')]=_0x5131('0x58');return respondWithRpcPromise(_0x5131('0x73'),'EventManager',{'event':'acceptmessage','message':_0x4f1626[_0x5131('0x26')]},client9002)[_0x5131('0x20')](function(){return _0x4f1626;});}return _0x4f1626;}return null;})[_0x5131('0x20')](respondWithResult(_0x35ce2b,null))[_0x5131('0x4e')](handleError(_0x35ce2b,null));};var interaction_log=require(_0x5131('0x14'))('openchannel-interactions');exports[_0x5131('0x74')]=function(_0xb0d261,_0xb35ae2,_0x4a5cd8){var _0x802f7e={'agent':{},'channel':_0x5131('0x75')};if(_0xb0d261[_0x5131('0x53')]['id']){delete _0xb0d261[_0x5131('0x53')]['id'];}_0xb0d261[_0x5131('0x53')][_0x5131('0x5d')]=_0xb0d261[_0x5131('0x53')][_0x5131('0x5d')]||_0xb0d261[_0x5131('0x5e')]['id'];_0x802f7e['agent']['id']=_0xb0d261[_0x5131('0x53')][_0x5131('0x5d')];return db[_0x5131('0x39')][_0x5131('0x54')]({'where':{'id':_0xb0d261[_0x5131('0x50')]['id'],'UserId':null}})[_0x5131('0x20')](handleEntityNotFound(_0xb35ae2,null))[_0x5131('0x20')](function(_0x16a586){if(_0x16a586){_0x802f7e[_0x5131('0x26')]=_0x16a586[_0x5131('0x60')]({'plain':!![]});return db[_0x5131('0x61')][_0x5131('0x54')]({'where':{'id':_0x16a586['OpenchannelInteractionId']}});}return null;})[_0x5131('0x20')](handleEntityNotFound(_0xb35ae2,null))[_0x5131('0x20')](function(_0x2fc03a){if(_0x2fc03a){_0x802f7e[_0x5131('0x76')]=_0x2fc03a[_0x5131('0x60')]({'plain':!![]});interaction_log[_0x5131('0x21')](_0x5131('0x77'),_0xb0d261['user']['id'],_0xb0d261[_0x5131('0x5e')][_0x5131('0x35')],_0xb0d261['user'][_0x5131('0x63')],_0x802f7e[_0x5131('0x76')]['id'],_0xb0d261[_0x5131('0x53')]?JSON[_0x5131('0x24')](_0xb0d261['body']):_0x5131('0x64'));return respondWithRpcPromise(_0x5131('0x78'),_0x5131('0x79'),_0x802f7e);}return null;})['then'](function(_0x34eb81){var _0x481f8e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x34eb81[_0x5131('0x26')][_0x5131('0x67')];return db[_0x5131('0x68')][_0x5131('0x3d')](_0x481f8e,{'type':db[_0x5131('0x7a')]['QueryTypes'][_0x5131('0x6a')],'raw':!![]})[_0x5131('0x20')](function(_0x9b311c){return _0x9b311c;});})[_0x5131('0x20')](function(_0x3a7a60){if(_0x3a7a60){_0x802f7e[_0x5131('0x26')]['contact']=_0x3a7a60[0x0];if(!_0xb0d261['body'][_0x5131('0x5d')])return;return db[_0x5131('0x6b')][_0x5131('0x54')]({'where':{'id':_0xb0d261[_0x5131('0x53')][_0x5131('0x5d')],'role':'agent'},'attributes':['id','name',_0x5131('0x6c'),_0x5131('0x7b'),'internal'],'raw':!![]});}return null;})[_0x5131('0x20')](function(_0x794be6){if(!_0x794be6)return null;_0x802f7e[_0x5131('0x26')][_0x5131('0x5f')]=_0x794be6;return _0x802f7e;})['then'](function(_0x238616){if(_0x238616){_0x238616[_0x5131('0x26')][_0x5131('0x6e')]=util[_0x5131('0x5b')]('SIP/%s',_0xb0d261[_0x5131('0x5e')][_0x5131('0x35')]);_0x238616[_0x5131('0x26')][_0x5131('0x70')]=_0x802f7e[_0x5131('0x70')];_0x238616['message']['motionChannel']=_0x802f7e[_0x5131('0x70')];_0x238616[_0x5131('0x26')][_0x5131('0x72')]=_0x5131('0x74');respondWithRpcPromise(_0x5131('0x73'),_0x5131('0x73'),{'event':_0x5131('0x7c'),'message':_0x238616[_0x5131('0x26')]},client9002);return _0x802f7e;}return null;})['then'](respondWithResult(_0xb35ae2,null))[_0x5131('0x4e')](handleError(_0xb35ae2,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index f3c960b..a4dd8ba 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 _0xfeaa=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit'];(function(_0x4e08dd,_0x576d41){var _0x5f307f=function(_0x53abb0){while(--_0x53abb0){_0x4e08dd['push'](_0x4e08dd['shift']());}};_0x5f307f(++_0x576d41);}(_0xfeaa,0x18f));var _0xafea=function(_0x427b89,_0x509440){_0x427b89=_0x427b89-0x0;var _0x30d092=_0xfeaa[_0x427b89];return _0x30d092;};'use strict';var EventEmitter=require(_0xafea('0x0'));var OpenchannelMessage=require(_0xafea('0x1'))['db'][_0xafea('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xafea('0x3')](0x0);var events={'afterCreate':_0xafea('0x4'),'afterUpdate':_0xafea('0x5'),'afterDestroy':_0xafea('0x6')};function emitEvent(_0x5dc3d6){return function(_0x15ac4f,_0x174a81,_0x5398f2){OpenchannelMessageEvents[_0xafea('0x7')](_0x5dc3d6+':'+_0x15ac4f['id'],_0x15ac4f);OpenchannelMessageEvents[_0xafea('0x7')](_0x5dc3d6,_0x15ac4f);_0x5398f2(null);};}for(var e in events){if(events[_0xafea('0x8')](e)){var event=events[e];OpenchannelMessage[_0xafea('0x9')](e,emitEvent(event));}}module[_0xafea('0xa')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xec17=['save','update','emit','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xec17,0x104));var _0x7ec1=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xec17[_0x4565bf];return _0x5610ba;};'use strict';var EventEmitter=require(_0x7ec1('0x0'));var OpenchannelMessage=require(_0x7ec1('0x1'))['db'][_0x7ec1('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x7ec1('0x3')](0x0);var events={'afterCreate':_0x7ec1('0x4'),'afterUpdate':_0x7ec1('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5319c4){return function(_0x1af3d5,_0x51ed53,_0x594c1c){OpenchannelMessageEvents[_0x7ec1('0x6')](_0x5319c4+':'+_0x1af3d5['id'],_0x1af3d5);OpenchannelMessageEvents[_0x7ec1('0x6')](_0x5319c4,_0x1af3d5);_0x594c1c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x7ec1('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 647bc90..d6db881 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 _0x221a=['Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','Contact','GET','POST','body','info','threadId','catch','inspect','finally','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','keys','get','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format'];(function(_0x5967d3,_0x1e1dcb){var _0x398aeb=function(_0x1804af){while(--_0x1804af){_0x5967d3['push'](_0x5967d3['shift']());}};_0x398aeb(++_0x1e1dcb);}(_0x221a,0x1b5));var _0xa221=function(_0x1ca5a3,_0x40b024){_0x1ca5a3=_0x1ca5a3-0x0;var _0xc8acbf=_0x221a[_0x1ca5a3];return _0xc8acbf;};'use strict';var _=require(_0xa221('0x0'));var util=require(_0xa221('0x1'));var logger=require(_0xa221('0x2'))(_0xa221('0x3'));var moment=require('moment');var BPromise=require(_0xa221('0x4'));var rp=require(_0xa221('0x5'));var fs=require('fs');var path=require(_0xa221('0x6'));var rimraf=require(_0xa221('0x7'));var config=require(_0xa221('0x8'));var attributes=require(_0xa221('0x9'));module[_0xa221('0xa')]=function(_0x5b6d0c,_0x34ef68){return _0x5b6d0c['define'](_0xa221('0xb'),attributes,{'tableName':_0xa221('0xc'),'paranoid':![],'indexes':[{'name':_0xa221('0xd'),'fields':['body'],'type':_0xa221('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b10e4,_0x35e536,_0x591f2b){var _0x1ba245=_0x5b6d0c[_0xa221('0xf')];var _0x17e7d8=_0x3b10e4['get']({'plain':!![]});if(_0x17e7d8[_0xa221('0x10')][_0xa221('0x11')]()==='in'||_0x17e7d8[_0xa221('0x10')][_0xa221('0x11')]()===_0xa221('0x12')&&!_0x17e7d8[_0xa221('0x13')]&&!_['isNil'](_0x17e7d8[_0xa221('0x14')])){_0x1ba245[_0xa221('0x15')][_0xa221('0x16')]({'where':{'id':_0x17e7d8[_0xa221('0x17')]}})[_0xa221('0x18')](function(_0xf0baf5){if(_0xf0baf5){_0xf0baf5[_0xa221('0x19')]({'lastMsgAt':_0x17e7d8[_0xa221('0x1a')],'lastMsgDirection':_0x17e7d8[_0xa221('0x10')]['toLowerCase']()});}})['catch'](function(_0x14298a){console[_0xa221('0x1b')](_0x14298a);});}if(_0x17e7d8[_0xa221('0x10')]===_0xa221('0x12')&&!_0x17e7d8[_0xa221('0x13')]){var _0x1dcd32;_0x1ba245[_0xa221('0x1c')][_0xa221('0x1d')]()[_0xa221('0x18')](function(_0x5ba33b){return _0x1ba245[_0xa221('0x1e')][_0xa221('0x1f')]({'where':{'id':_0x17e7d8[_0xa221('0x20')]},'include':[{'model':_0x1ba245[_0xa221('0x15')],'as':_0xa221('0x21'),'where':{'id':_0x17e7d8[_0xa221('0x17')]},'limit':0x1,'include':[{'model':_0x1ba245[_0xa221('0x1c')],'as':'Contact','attributes':_[_0xa221('0x22')](_0x5ba33b)}]}]});})[_0xa221('0x18')](function(_0x4d96da){_0x1dcd32=_0x4d96da[_0xa221('0x23')]({'plain':!![]});if(_0x1dcd32&&_0x1dcd32[_0xa221('0x24')]){logger['info'](_0xa221('0x25'),_0xa221('0x26'),util[_0xa221('0x27')](_0xa221('0x28'),_0x17e7d8['id'],_0x1dcd32[_0xa221('0x24')]));if(_0x1dcd32['Interactions']&&_0x1dcd32[_0xa221('0x21')][_0xa221('0x29')]){_0x17e7d8[_0xa221('0x2a')]=_[_0xa221('0x2b')](_0x1dcd32[_0xa221('0x21')][0x0],_0xa221('0x2c'));_0x17e7d8['Contact']=_0x1dcd32[_0xa221('0x21')][0x0][_0xa221('0x2c')];}var _0x35e536={'method':'POST','uri':encodeURI(_0x1dcd32['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x35e536['method']){case _0xa221('0x2d'):_0x35e536['qs']=_0x17e7d8;break;case _0xa221('0x2e'):_0x35e536[_0xa221('0x2f')]=_0x17e7d8;break;}return rp(_0x35e536)[_0xa221('0x18')](function(_0x32621d){logger[_0xa221('0x30')](_0xa221('0x25'),'afterCreate',util[_0xa221('0x27')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x17e7d8['id'],_0x1dcd32['replyUri']));if(_0x32621d['body'][_0xa221('0x31')]&&_0x32621d[_0xa221('0x2f')][_0xa221('0x31')]!=_0x17e7d8[_0xa221('0x2a')][_0xa221('0x31')]){return _0x1ba245[_0xa221('0x15')]['update']({'threadId':_0x32621d[_0xa221('0x2f')][_0xa221('0x31')]},{'where':{'id':_0x17e7d8[_0xa221('0x2a')]['id']}});}else{return;}})['then'](function(){return _0x3b10e4[_0xa221('0x19')]({'read':!![]});})[_0xa221('0x32')](function(_0x293a57){logger['error'](_0xa221('0x25'),_0xa221('0x26'),util[_0xa221('0x33')](_0x293a57,{'showHidden':![],'depth':null}));_0x591f2b();});}else{_0x591f2b();}})[_0xa221('0x34')](function(){_0x591f2b();});}else{_0x591f2b();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8868=['info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','Contact','POST','method','GET','body','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','inspect','finally','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','../../config/environment','./openchannelMessage.attributes','exports','define','fti_openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','OpenchannelInteraction','OpenchannelInteractionId','then','createdAt','catch','error','out','describe','OpenchannelAccount','OpenchannelAccountId','Interactions','CmContact','replyUri'];(function(_0x247cc6,_0x1c0c01){var _0x25ea5a=function(_0x3a7574){while(--_0x3a7574){_0x247cc6['push'](_0x247cc6['shift']());}};_0x25ea5a(++_0x1c0c01);}(_0x8868,0x72));var _0x8886=function(_0x1dab0f,_0x4af1cb){_0x1dab0f=_0x1dab0f-0x0;var _0x32f459=_0x8868[_0x1dab0f];return _0x32f459;};'use strict';var _=require(_0x8886('0x0'));var util=require(_0x8886('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8886('0x2'));var BPromise=require(_0x8886('0x3'));var rp=require(_0x8886('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8886('0x5'));var attributes=require(_0x8886('0x6'));module[_0x8886('0x7')]=function(_0x12141f,_0x25f008){return _0x12141f[_0x8886('0x8')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x8886('0x9'),'fields':['body'],'type':_0x8886('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x438545,_0x91b973,_0x33f834){var _0x308d49=_0x12141f[_0x8886('0xb')];var _0x7d7459=_0x438545[_0x8886('0xc')]({'plain':!![]});if(_0x7d7459[_0x8886('0xd')][_0x8886('0xe')]()==='in'||_0x7d7459[_0x8886('0xd')][_0x8886('0xe')]()==='out'&&!_0x7d7459[_0x8886('0xf')]&&!_[_0x8886('0x10')](_0x7d7459['UserId'])){_0x308d49[_0x8886('0x11')]['findOne']({'where':{'id':_0x7d7459[_0x8886('0x12')]}})[_0x8886('0x13')](function(_0x4bd7f0){if(_0x4bd7f0){_0x4bd7f0['update']({'lastMsgAt':_0x7d7459[_0x8886('0x14')],'lastMsgDirection':_0x7d7459[_0x8886('0xd')][_0x8886('0xe')]()});}})[_0x8886('0x15')](function(_0x4ab9fe){console[_0x8886('0x16')](_0x4ab9fe);});}if(_0x7d7459[_0x8886('0xd')]===_0x8886('0x17')&&!_0x7d7459[_0x8886('0xf')]){var _0x4c1dbf;_0x308d49['CmContact'][_0x8886('0x18')]()['then'](function(_0x1f0a4d){return _0x308d49[_0x8886('0x19')]['find']({'where':{'id':_0x7d7459[_0x8886('0x1a')]},'include':[{'model':_0x308d49[_0x8886('0x11')],'as':_0x8886('0x1b'),'where':{'id':_0x7d7459['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x308d49[_0x8886('0x1c')],'as':'Contact','attributes':_['keys'](_0x1f0a4d)}]}]});})[_0x8886('0x13')](function(_0x1af2ad){_0x4c1dbf=_0x1af2ad[_0x8886('0xc')]({'plain':!![]});if(_0x4c1dbf&&_0x4c1dbf[_0x8886('0x1d')]){logger[_0x8886('0x1e')](_0x8886('0x1f'),_0x8886('0x20'),util[_0x8886('0x21')](_0x8886('0x22'),_0x7d7459['id'],_0x4c1dbf[_0x8886('0x1d')]));if(_0x4c1dbf[_0x8886('0x1b')]&&_0x4c1dbf['Interactions'][_0x8886('0x23')]){_0x7d7459[_0x8886('0x24')]=_['omit'](_0x4c1dbf['Interactions'][0x0],_0x8886('0x25'));_0x7d7459['Contact']=_0x4c1dbf[_0x8886('0x1b')][0x0][_0x8886('0x25')];}var _0x91b973={'method':_0x8886('0x26'),'uri':encodeURI(_0x4c1dbf[_0x8886('0x1d')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x91b973[_0x8886('0x27')]){case _0x8886('0x28'):_0x91b973['qs']=_0x7d7459;break;case _0x8886('0x26'):_0x91b973[_0x8886('0x29')]=_0x7d7459;break;}return rp(_0x91b973)[_0x8886('0x13')](function(_0x49af1d){logger[_0x8886('0x1e')](_0x8886('0x1f'),_0x8886('0x20'),util[_0x8886('0x21')](_0x8886('0x2a'),_0x7d7459['id'],_0x4c1dbf[_0x8886('0x1d')]));if(_0x49af1d[_0x8886('0x29')][_0x8886('0x2b')]&&_0x49af1d[_0x8886('0x29')]['threadId']!=_0x7d7459['Interaction']['threadId']){return _0x308d49['OpenchannelInteraction'][_0x8886('0x2c')]({'threadId':_0x49af1d['body']['threadId']},{'where':{'id':_0x7d7459[_0x8886('0x24')]['id']}});}else{return;}})[_0x8886('0x13')](function(){return _0x438545[_0x8886('0x2c')]({'read':!![]});})[_0x8886('0x15')](function(_0x42cc3c){logger[_0x8886('0x16')](_0x8886('0x1f'),_0x8886('0x20'),util[_0x8886('0x2d')](_0x42cc3c,{'showHidden':![],'depth':null}));_0x33f834();});}else{_0x33f834();}})[_0x8886('0x2e')](function(){_0x33f834();});}else{_0x33f834();}}},'charset':'utf8mb4','collate':_0x8886('0x2f')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 853e7b8..14a4169 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 _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(_0x2cf431,_0x229d97){var _0x4dfe6a=function(_0x7e85cc){while(--_0x7e85cc){_0x2cf431['push'](_0x2cf431['shift']());}};_0x4dfe6a(++_0x229d97);}(_0x2ef3,0xba));var _0x32ef=function(_0x3164ef,_0x39bf38){_0x3164ef=_0x3164ef-0x0;var _0x5c1eac=_0x2ef3[_0x3164ef];return _0x5c1eac;};'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 +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(_0x36d732,_0x2076d9){var _0x108020=function(_0x158912){while(--_0x158912){_0x36d732['push'](_0x36d732['shift']());}};_0x108020(++_0x2076d9);}(_0xadb5,0xad));var _0x5adb=function(_0x7221a7,_0x1f55aa){_0x7221a7=_0x7221a7-0x0;var _0x2454e2=_0xadb5[_0x7221a7];return _0x2454e2;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 39fe203..96b1936 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 _0x34f2=['removeListener','register','length','./openchannelMessage.events','save','update','emit'];(function(_0x2d55a1,_0x30cb10){var _0x39ed86=function(_0x1df22a){while(--_0x1df22a){_0x2d55a1['push'](_0x2d55a1['shift']());}};_0x39ed86(++_0x30cb10);}(_0x34f2,0x15a));var _0x234f=function(_0x31ad4e,_0x1dffb0){_0x31ad4e=_0x31ad4e-0x0;var _0x2a97c2=_0x34f2[_0x31ad4e];return _0x2a97c2;};'use strict';var OpenchannelMessageEvents=require(_0x234f('0x0'));var events=[_0x234f('0x1'),'remove',_0x234f('0x2')];function createListener(_0x7e69ec,_0x274040){return function(_0x3e8aaf){_0x274040[_0x234f('0x3')](_0x7e69ec,_0x3e8aaf);};}function removeListener(_0xf83fc2,_0x2dc34b){return function(){OpenchannelMessageEvents[_0x234f('0x4')](_0xf83fc2,_0x2dc34b);};}exports[_0x234f('0x5')]=function(_0x2c7b3f){for(var _0x2adf40=0x0,_0x254f37=events[_0x234f('0x6')];_0x2adf40<_0x254f37;_0x2adf40++){var _0x477918=events[_0x2adf40];var _0x691793=createListener('openchannelMessage:'+_0x477918,_0x2c7b3f);OpenchannelMessageEvents['on'](_0x477918,_0x691793);}}; \ No newline at end of file +var _0x9655=['save','remove','update','register'];(function(_0x3a29a8,_0x42151e){var _0x1bba8f=function(_0x26cc76){while(--_0x26cc76){_0x3a29a8['push'](_0x3a29a8['shift']());}};_0x1bba8f(++_0x42151e);}(_0x9655,0x160));var _0x5965=function(_0x39623e,_0x301451){_0x39623e=_0x39623e-0x0;var _0x56fa5b=_0x9655[_0x39623e];return _0x56fa5b;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x5965('0x0'),_0x5965('0x1'),_0x5965('0x2')];function createListener(_0x19baf7,_0x44f8e2){return function(_0x319dfa){_0x44f8e2['emit'](_0x19baf7,_0x319dfa);};}function removeListener(_0x41e7f0,_0x17b3e3){return function(){OpenchannelMessageEvents['removeListener'](_0x41e7f0,_0x17b3e3);};}exports[_0x5965('0x3')]=function(_0x322461){for(var _0x112481=0x0,_0x367f27=events['length'];_0x112481<_0x367f27;_0x112481++){var _0x2937b5=events[_0x112481];var _0x23490d=createListener('openchannelMessage:'+_0x2937b5,_0x322461);OpenchannelMessageEvents['on'](_0x2937b5,_0x23490d);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 5b28122..5016f08 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 _0x5a2b=['/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams'];(function(_0xa302bf,_0x451271){var _0x4ff8aa=function(_0x34f461){while(--_0x34f461){_0xa302bf['push'](_0xa302bf['shift']());}};_0x4ff8aa(++_0x451271);}(_0x5a2b,0xb1));var _0xb5a2=function(_0x416c95,_0x231569){_0x416c95=_0x416c95-0x0;var _0x40655e=_0x5a2b[_0x416c95];return _0x40655e;};'use strict';var multer=require(_0xb5a2('0x0'));var util=require(_0xb5a2('0x1'));var path=require(_0xb5a2('0x2'));var timeout=require(_0xb5a2('0x3'));var express=require(_0xb5a2('0x4'));var router=express[_0xb5a2('0x5')]();var fs_extra=require(_0xb5a2('0x6'));var auth=require(_0xb5a2('0x7'));var interaction=require(_0xb5a2('0x8'));var config=require(_0xb5a2('0x9'));var controller=require('./openchannelQueue.controller');router[_0xb5a2('0xa')]('/',auth['isAuthenticated'](),controller[_0xb5a2('0xb')]);router[_0xb5a2('0xa')](_0xb5a2('0xc'),auth[_0xb5a2('0xd')](),controller[_0xb5a2('0xe')]);router['get'](_0xb5a2('0xf'),auth['isAuthenticated'](),controller[_0xb5a2('0x10')]);router[_0xb5a2('0xa')](_0xb5a2('0x11'),auth[_0xb5a2('0xd')](),controller[_0xb5a2('0x12')]);router[_0xb5a2('0xa')](_0xb5a2('0x13'),auth[_0xb5a2('0xd')](),controller[_0xb5a2('0x14')]);router[_0xb5a2('0xa')](_0xb5a2('0x15'),auth[_0xb5a2('0xd')](),controller[_0xb5a2('0x16')]);router[_0xb5a2('0x17')]('/',auth[_0xb5a2('0xd')](),controller[_0xb5a2('0x18')]);router[_0xb5a2('0x17')](_0xb5a2('0x13'),auth[_0xb5a2('0xd')](),controller[_0xb5a2('0x19')]);router[_0xb5a2('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xb5a2('0x1a')]);router[_0xb5a2('0x1b')](_0xb5a2('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xb5a2('0x1c')](_0xb5a2('0xf'),auth[_0xb5a2('0xd')](),controller[_0xb5a2('0x1d')]);router[_0xb5a2('0x1c')](_0xb5a2('0x13'),auth[_0xb5a2('0xd')](),controller[_0xb5a2('0x1e')]);router[_0xb5a2('0x1c')](_0xb5a2('0x15'),auth['isAuthenticated'](),controller[_0xb5a2('0x1f')]);module[_0xb5a2('0x20')]=router; \ No newline at end of file +var _0x8c0c=['exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','/:id','show','getMembers','/:id/teams','getTeams','post','create','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents'];(function(_0x317924,_0x16c7d4){var _0x47b270=function(_0x431028){while(--_0x431028){_0x317924['push'](_0x317924['shift']());}};_0x47b270(++_0x16c7d4);}(_0x8c0c,0x15d));var _0xc8c0=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x8c0c[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xc8c0('0x0'));var util=require(_0xc8c0('0x1'));var path=require(_0xc8c0('0x2'));var timeout=require(_0xc8c0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc8c0('0x4'));var interaction=require(_0xc8c0('0x5'));var config=require(_0xc8c0('0x6'));var controller=require(_0xc8c0('0x7'));router[_0xc8c0('0x8')]('/',auth[_0xc8c0('0x9')](),controller[_0xc8c0('0xa')]);router[_0xc8c0('0x8')](_0xc8c0('0xb'),auth[_0xc8c0('0x9')](),controller['describe']);router['get'](_0xc8c0('0xc'),auth['isAuthenticated'](),controller[_0xc8c0('0xd')]);router['get']('/:id/members',auth[_0xc8c0('0x9')](),controller[_0xc8c0('0xe')]);router[_0xc8c0('0x8')](_0xc8c0('0xf'),auth[_0xc8c0('0x9')](),controller[_0xc8c0('0x10')]);router[_0xc8c0('0x8')]('/:id/users',auth[_0xc8c0('0x9')](),controller['getAgents']);router[_0xc8c0('0x11')]('/',auth[_0xc8c0('0x9')](),controller[_0xc8c0('0x12')]);router['post']('/:id/teams',auth[_0xc8c0('0x9')](),controller[_0xc8c0('0x13')]);router[_0xc8c0('0x11')](_0xc8c0('0x14'),auth['isAuthenticated'](),controller[_0xc8c0('0x15')]);router[_0xc8c0('0x16')](_0xc8c0('0xc'),auth[_0xc8c0('0x9')](),controller[_0xc8c0('0x17')]);router[_0xc8c0('0x18')](_0xc8c0('0xc'),auth['isAuthenticated'](),controller[_0xc8c0('0x19')]);router['delete'](_0xc8c0('0xf'),auth[_0xc8c0('0x9')](),controller[_0xc8c0('0x1a')]);router[_0xc8c0('0x18')](_0xc8c0('0x14'),auth[_0xc8c0('0x9')](),controller[_0xc8c0('0x1b')]);module[_0xc8c0('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 0c959cb..227afca 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 _0x5452=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x5906da,_0x451737){var _0x3b5c7e=function(_0x27f0a5){while(--_0x27f0a5){_0x5906da['push'](_0x5906da['shift']());}};_0x3b5c7e(++_0x451737);}(_0x5452,0x125));var _0x2545=function(_0x3deee7,_0x1054d7){_0x3deee7=_0x3deee7-0x0;var _0x369178=_0x5452[_0x3deee7];return _0x369178;};'use strict';var Sequelize=require(_0x2545('0x0'));module[_0x2545('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2545('0x2')]},'timeout':{'type':Sequelize[_0x2545('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2545('0x4')](_0x2545('0x5'),_0x2545('0x6'),_0x2545('0x7'))}}; \ No newline at end of file +var _0x950a=['ENUM','rrmemory','exports','STRING'];(function(_0x482fcc,_0x448923){var _0x16ab21=function(_0x468a99){while(--_0x468a99){_0x482fcc['push'](_0x482fcc['shift']());}};_0x16ab21(++_0x448923);}(_0x950a,0x1e6));var _0xa950=function(_0x5e950b,_0x20ad1e){_0x5e950b=_0x5e950b-0x0;var _0x4043d2=_0x950a[_0x5e950b];return _0x4043d2;};'use strict';var Sequelize=require('sequelize');module[_0xa950('0x0')]={'name':{'type':Sequelize[_0xa950('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa950('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa950('0x2')](_0xa950('0x3'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 6442a10..3a333de 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 _0xa622=['clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','union','compact','value','isEmpty','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','socket.io-emitter','redis','./openchannelQueue.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','save','update','then','destroy','get','OpenchannelQueues','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','type','filter','includeAll','include','findAll','rows','show','keys','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMembers','findOne','UserOpenchannelQueue','pick','OpenchannelQueueId','User','agent','openchannelPause','createdAt','format','%s/%s','SIP','Team','order','getTeams','Agents','online','voicePause','interface','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId'];(function(_0x2468e8,_0x2671fa){var _0x352857=function(_0x54e369){while(--_0x54e369){_0x2468e8['push'](_0x2468e8['shift']());}};_0x352857(++_0x2671fa);}(_0xa622,0x12c));var _0x2a62=function(_0x464ba0,_0x177323){_0x464ba0=_0x464ba0-0x0;var _0x1edf8e=_0xa622[_0x464ba0];return _0x1edf8e;};'use strict';var emlformat=require(_0x2a62('0x0'));var rimraf=require(_0x2a62('0x1'));var zipdir=require(_0x2a62('0x2'));var jsonpatch=require(_0x2a62('0x3'));var rp=require(_0x2a62('0x4'));var moment=require('moment');var BPromise=require(_0x2a62('0x5'));var Mustache=require(_0x2a62('0x6'));var util=require(_0x2a62('0x7'));var path=require(_0x2a62('0x8'));var sox=require(_0x2a62('0x9'));var csv=require(_0x2a62('0xa'));var ejs=require(_0x2a62('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2a62('0xc'));var squel=require(_0x2a62('0xd'));var crypto=require('crypto');var jsforce=require(_0x2a62('0xe'));var deskjs=require(_0x2a62('0xf'));var toCsv=require(_0x2a62('0xa'));var querystring=require(_0x2a62('0x10'));var Papa=require(_0x2a62('0x11'));var Redis=require('ioredis');var authService=require(_0x2a62('0x12'));var qs=require(_0x2a62('0x13'));var as=require(_0x2a62('0x14'));var hardwareService=require(_0x2a62('0x15'));var logger=require(_0x2a62('0x16'))(_0x2a62('0x17'));var utils=require(_0x2a62('0x18'));var config=require(_0x2a62('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x2a62('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2a62('0x1b'))(new Redis(config[_0x2a62('0x1c')]));require(_0x2a62('0x1d'))[_0x2a62('0x1e')](socket);function respondWithStatusCode(_0x2bec89,_0x5d9975){_0x5d9975=_0x5d9975||0xcc;return function(_0x4ec06b){if(_0x4ec06b){return _0x2bec89[_0x2a62('0x1f')](_0x5d9975);}return _0x2bec89[_0x2a62('0x20')](_0x5d9975)[_0x2a62('0x21')]();};}function respondWithResult(_0x1b122f,_0x435dfd){_0x435dfd=_0x435dfd||0xc8;return function(_0x379001){if(_0x379001){return _0x1b122f[_0x2a62('0x20')](_0x435dfd)[_0x2a62('0x22')](_0x379001);}};}function respondWithFilteredResult(_0x237304,_0x1f9d97){return function(_0x48c25b){if(_0x48c25b){var _0x4d9189=typeof _0x1f9d97['offset']==='undefined'&&typeof _0x1f9d97['limit']===_0x2a62('0x23');var _0x4c637a=_0x48c25b[_0x2a62('0x24')];var _0x1a4d4d=_0x4d9189?0x0:_0x1f9d97[_0x2a62('0x25')];var _0x1b93ca=_0x4d9189?_0x48c25b['count']:_0x1f9d97[_0x2a62('0x25')]+_0x1f9d97[_0x2a62('0x26')];var _0x4b00b3;if(_0x1b93ca>=_0x4c637a){_0x1b93ca=_0x4c637a;_0x4b00b3=0xc8;}else{_0x4b00b3=0xce;}_0x237304[_0x2a62('0x20')](_0x4b00b3);return _0x237304[_0x2a62('0x27')](_0x2a62('0x28'),_0x1a4d4d+'-'+_0x1b93ca+'/'+_0x4c637a)[_0x2a62('0x22')](_0x48c25b);}return null;};}function patchUpdates(_0x6eea6f){return function(_0x38f9c4){try{jsonpatch['apply'](_0x38f9c4,_0x6eea6f,!![]);}catch(_0x217764){return BPromise['reject'](_0x217764);}return _0x38f9c4[_0x2a62('0x29')]();};}function saveUpdates(_0x5bba7f,_0x4035f6){return function(_0x7f9657){if(_0x7f9657){return _0x7f9657[_0x2a62('0x2a')](_0x5bba7f)[_0x2a62('0x2b')](function(_0x2bbf33){return _0x2bbf33;});}return null;};}function removeEntity(_0x2227c0,_0x498531){return function(_0x21decc){if(_0x21decc){return _0x21decc[_0x2a62('0x2c')]()[_0x2a62('0x2b')](function(){var _0xd2d7e5=_0x21decc[_0x2a62('0x2d')]({'plain':!![]});var _0x545209=_0x2a62('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x545209,'resourceId':_0xd2d7e5['id']}})[_0x2a62('0x2b')](function(){return _0x21decc;});})[_0x2a62('0x2b')](function(){_0x2227c0[_0x2a62('0x20')](0xcc)[_0x2a62('0x21')]();});}};}function handleEntityNotFound(_0x3a7a6e,_0x284487){return function(_0x5da371){if(!_0x5da371){_0x3a7a6e[_0x2a62('0x1f')](0x194);}return _0x5da371;};}function handleError(_0x1c3b72,_0x37d7fb){_0x37d7fb=_0x37d7fb||0x1f4;return function(_0x4d3cd5){logger['error'](_0x4d3cd5[_0x2a62('0x2f')]);if(_0x4d3cd5[_0x2a62('0x30')]){delete _0x4d3cd5[_0x2a62('0x30')];}_0x1c3b72[_0x2a62('0x20')](_0x37d7fb)[_0x2a62('0x31')](_0x4d3cd5);};}exports[_0x2a62('0x32')]=function(_0x7a56a7,_0x1a644c){var _0x127d00={},_0x2ed34e={},_0x234385={'count':0x0,'rows':[]};var _0x5904cf=_[_0x2a62('0x33')](db[_0x2a62('0x34')][_0x2a62('0x35')],function(_0x3b393e){return{'name':_0x3b393e[_0x2a62('0x36')],'type':_0x3b393e['type'][_0x2a62('0x37')]};});_0x2ed34e['model']=_['map'](_0x5904cf,_0x2a62('0x30'));_0x2ed34e[_0x2a62('0x38')]=_['keys'](_0x7a56a7[_0x2a62('0x38')]);_0x2ed34e['filters']=_['intersection'](_0x2ed34e[_0x2a62('0x39')],_0x2ed34e['query']);_0x127d00[_0x2a62('0x3a')]=_[_0x2a62('0x3b')](_0x2ed34e[_0x2a62('0x39')],qs[_0x2a62('0x3c')](_0x7a56a7[_0x2a62('0x38')][_0x2a62('0x3c')]));_0x127d00['attributes']=_0x127d00[_0x2a62('0x3a')][_0x2a62('0x3d')]?_0x127d00['attributes']:_0x2ed34e['model'];if(!_0x7a56a7[_0x2a62('0x38')][_0x2a62('0x3e')](_0x2a62('0x3f'))){_0x127d00[_0x2a62('0x26')]=qs[_0x2a62('0x26')](_0x7a56a7['query'][_0x2a62('0x26')]);_0x127d00[_0x2a62('0x25')]=qs[_0x2a62('0x25')](_0x7a56a7[_0x2a62('0x38')][_0x2a62('0x25')]);}_0x127d00['order']=qs[_0x2a62('0x40')](_0x7a56a7['query'][_0x2a62('0x40')]);_0x127d00[_0x2a62('0x41')]=qs['filters'](_['pick'](_0x7a56a7[_0x2a62('0x38')],_0x2ed34e[_0x2a62('0x42')]),_0x5904cf);if(_0x7a56a7[_0x2a62('0x38')]['filter']){_0x127d00[_0x2a62('0x41')]=_[_0x2a62('0x43')](_0x127d00[_0x2a62('0x41')],{'$or':_[_0x2a62('0x33')](_0x5904cf,function(_0x56cfeb){if(_0x56cfeb[_0x2a62('0x44')]!=='VIRTUAL'){var _0x169d15={};_0x169d15[_0x56cfeb[_0x2a62('0x30')]]={'$like':'%'+_0x7a56a7[_0x2a62('0x38')][_0x2a62('0x45')]+'%'};return _0x169d15;}})});}_0x127d00=_[_0x2a62('0x43')]({},_0x127d00,_0x7a56a7['options']);var _0x473d3d={'where':_0x127d00[_0x2a62('0x41')]};return db[_0x2a62('0x34')][_0x2a62('0x24')](_0x473d3d)[_0x2a62('0x2b')](function(_0x6b5896){_0x234385[_0x2a62('0x24')]=_0x6b5896;if(_0x7a56a7[_0x2a62('0x38')][_0x2a62('0x46')]){_0x127d00[_0x2a62('0x47')]=[{'all':!![]}];}return db[_0x2a62('0x34')][_0x2a62('0x48')](_0x127d00);})['then'](function(_0x4252aa){_0x234385[_0x2a62('0x49')]=_0x4252aa;return _0x234385;})[_0x2a62('0x2b')](respondWithFilteredResult(_0x1a644c,_0x127d00))['catch'](handleError(_0x1a644c,null));};exports[_0x2a62('0x4a')]=function(_0x7b1049,_0x2b9c06){var _0x17097d={'raw':!![],'where':{'id':_0x7b1049['params']['id']}},_0x534813={};_0x534813[_0x2a62('0x39')]=_[_0x2a62('0x4b')](db['OpenchannelQueue'][_0x2a62('0x35')]);_0x534813[_0x2a62('0x38')]=_[_0x2a62('0x4b')](_0x7b1049[_0x2a62('0x38')]);_0x534813['filters']=_[_0x2a62('0x3b')](_0x534813[_0x2a62('0x39')],_0x534813[_0x2a62('0x38')]);_0x17097d[_0x2a62('0x3a')]=_['intersection'](_0x534813[_0x2a62('0x39')],qs[_0x2a62('0x3c')](_0x7b1049[_0x2a62('0x38')][_0x2a62('0x3c')]));_0x17097d[_0x2a62('0x3a')]=_0x17097d['attributes'][_0x2a62('0x3d')]?_0x17097d['attributes']:_0x534813['model'];if(_0x7b1049[_0x2a62('0x38')][_0x2a62('0x46')]){_0x17097d[_0x2a62('0x47')]=[{'all':!![]}];}_0x17097d=_[_0x2a62('0x43')]({},_0x17097d,_0x7b1049[_0x2a62('0x4c')]);return db[_0x2a62('0x34')][_0x2a62('0x4d')](_0x17097d)[_0x2a62('0x2b')](handleEntityNotFound(_0x2b9c06,null))['then'](respondWithResult(_0x2b9c06,null))[_0x2a62('0x4e')](handleError(_0x2b9c06,null));};exports['create']=function(_0x35ded1,_0x432e80){return db[_0x2a62('0x34')][_0x2a62('0x4f')](_0x35ded1[_0x2a62('0x50')],{})[_0x2a62('0x2b')](function(_0x23c616){var _0xab649a=_0x35ded1[_0x2a62('0x51')][_0x2a62('0x2d')]({'plain':!![]});if(!_0xab649a)throw new Error(_0x2a62('0x52'));if(_0xab649a[_0x2a62('0x53')]===_0x2a62('0x51')){var _0x2198dd=_0x23c616[_0x2a62('0x2d')]({'plain':!![]});var _0x412454=_0x2a62('0x2e');return db['UserProfileSection'][_0x2a62('0x4d')]({'where':{'name':_0x412454,'userProfileId':_0xab649a['userProfileId']},'raw':!![]})['then'](function(_0x489d57){if(_0x489d57&&_0x489d57[_0x2a62('0x54')]===0x0){return db['UserProfileResource'][_0x2a62('0x4f')]({'name':_0x2198dd[_0x2a62('0x30')],'resourceId':_0x2198dd['id'],'type':_0x489d57['name'],'sectionId':_0x489d57['id']},{})[_0x2a62('0x2b')](function(){return _0x23c616;});}else{return _0x23c616;}})[_0x2a62('0x4e')](function(_0x5258d4){logger[_0x2a62('0x55')](_0x2a62('0x56'),_0x5258d4);throw _0x5258d4;});}return _0x23c616;})[_0x2a62('0x2b')](respondWithResult(_0x432e80,0xc9))[_0x2a62('0x4e')](handleError(_0x432e80,null));};exports[_0x2a62('0x2a')]=function(_0x5263f6,_0x55fa07){if(_0x5263f6[_0x2a62('0x50')]['id']){delete _0x5263f6[_0x2a62('0x50')]['id'];}return db[_0x2a62('0x34')][_0x2a62('0x4d')]({'where':{'id':_0x5263f6[_0x2a62('0x57')]['id']}})[_0x2a62('0x2b')](handleEntityNotFound(_0x55fa07,null))[_0x2a62('0x2b')](saveUpdates(_0x5263f6[_0x2a62('0x50')],null))[_0x2a62('0x2b')](respondWithResult(_0x55fa07,null))['catch'](handleError(_0x55fa07,null));};exports['destroy']=function(_0x2bd50b,_0x7437a4){return db['OpenchannelQueue'][_0x2a62('0x4d')]({'where':{'id':_0x2bd50b[_0x2a62('0x57')]['id']}})[_0x2a62('0x2b')](handleEntityNotFound(_0x7437a4,null))[_0x2a62('0x2b')](removeEntity(_0x7437a4,null))[_0x2a62('0x4e')](handleError(_0x7437a4,null));};exports['describe']=function(_0xaab401,_0x36f946){return db[_0x2a62('0x34')]['describe']()[_0x2a62('0x2b')](respondWithResult(_0x36f946,null))[_0x2a62('0x4e')](handleError(_0x36f946,null));};exports[_0x2a62('0x58')]=function(_0x3418cc,_0x4be07c,_0x415e3f){var _0x173091={'raw':!![],'where':{}},_0xba40a6={},_0x186377;return db[_0x2a62('0x34')][_0x2a62('0x59')]({'where':{'id':_0x3418cc['params']['id']}})['then'](handleEntityNotFound(_0x4be07c,null))['then'](function(_0x4369ed){if(_0x4369ed){_0x186377=_0x4369ed[_0x2a62('0x2d')]({'plain':!![]});_0xba40a6[_0x2a62('0x39')]=_['keys'](db[_0x2a62('0x5a')][_0x2a62('0x35')]);_0xba40a6[_0x2a62('0x38')]=_[_0x2a62('0x4b')](_0x3418cc['query']);_0xba40a6[_0x2a62('0x42')]=_[_0x2a62('0x3b')](_0xba40a6[_0x2a62('0x39')],_0xba40a6['query']);_0x173091[_0x2a62('0x3a')]=_[_0x2a62('0x3b')](_0xba40a6[_0x2a62('0x39')],qs[_0x2a62('0x3c')](_0x3418cc[_0x2a62('0x38')]['fields']));_0x173091['attributes']=_0x173091[_0x2a62('0x3a')]['length']?_0x173091['attributes']:_0xba40a6[_0x2a62('0x39')];if(!_0x3418cc[_0x2a62('0x38')][_0x2a62('0x3e')]('nolimit')){_0x173091[_0x2a62('0x26')]=qs['limit'](_0x3418cc['query'][_0x2a62('0x26')]);_0x173091['offset']=qs[_0x2a62('0x25')](_0x3418cc['query'][_0x2a62('0x25')]);}_0x173091['order']=qs['sort'](_0x3418cc['query'][_0x2a62('0x40')]);_0x173091['where']=qs[_0x2a62('0x42')](_[_0x2a62('0x5b')](_0x3418cc[_0x2a62('0x38')],_0xba40a6[_0x2a62('0x42')]));_0x173091['where'][_0x2a62('0x5c')]=_0x4369ed['id'];if(_0x3418cc['query'][_0x2a62('0x45')]){_0x173091[_0x2a62('0x41')]=_[_0x2a62('0x43')](_0x173091[_0x2a62('0x41')],{'$or':_[_0x2a62('0x33')](_0x173091[_0x2a62('0x3a')],function(_0x359184){var _0x176d4e={};_0x176d4e[_0x359184]={'$like':'%'+_0x3418cc[_0x2a62('0x38')]['filter']+'%'};return _0x176d4e;})});}_0x173091=_[_0x2a62('0x43')]({},_0x173091,_0x3418cc['options']);return db['UserOpenchannelQueue'][_0x2a62('0x48')](_0x173091);}})[_0x2a62('0x2b')](function(_0x318a74){if(_0x318a74){return db[_0x2a62('0x5d')]['findAndCountAll']({'where':{'id':_[_0x2a62('0x33')](_0x318a74,'UserId'),'role':_0x2a62('0x5e')},'attributes':['id','name',_0x2a62('0x5f'),'updatedAt',_0x2a62('0x60')]});}})['then'](function(_0x52bbf7){if(_0x52bbf7){return{'count':_0x52bbf7['count'],'rows':_[_0x2a62('0x33')](_0x52bbf7['rows'],function(_0x499294){return{'membername':_0x499294[_0x2a62('0x30')],'UserId':_0x499294['id'],'queue_name':_0x186377[_0x2a62('0x30')],'OpenchannelQueueId':_0x186377['id'],'interface':util[_0x2a62('0x61')](_0x2a62('0x62'),_0x2a62('0x63'),_0x499294['name']),'penalty':0x0,'paused':_0x499294[_0x2a62('0x5f')],'createdAt':_0x499294[_0x2a62('0x60')],'updatedAt':_0x499294['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4be07c,_0x173091))[_0x2a62('0x4e')](handleError(_0x4be07c,null));};exports['getTeams']=function(_0x19707f,_0x42de72,_0x57ffb6){var _0x4a54bf={};var _0x9f4db0={};var _0xf99fc2;var _0x27fca4;return db[_0x2a62('0x34')][_0x2a62('0x59')]({'where':{'id':_0x19707f[_0x2a62('0x57')]['id']}})[_0x2a62('0x2b')](handleEntityNotFound(_0x42de72,null))[_0x2a62('0x2b')](function(_0x22456a){if(_0x22456a){_0xf99fc2=_0x22456a;_0x9f4db0[_0x2a62('0x39')]=_[_0x2a62('0x4b')](db[_0x2a62('0x64')][_0x2a62('0x35')]);_0x9f4db0[_0x2a62('0x38')]=_[_0x2a62('0x4b')](_0x19707f[_0x2a62('0x38')]);_0x9f4db0[_0x2a62('0x42')]=_[_0x2a62('0x3b')](_0x9f4db0[_0x2a62('0x39')],_0x9f4db0[_0x2a62('0x38')]);_0x4a54bf[_0x2a62('0x3a')]=_['intersection'](_0x9f4db0[_0x2a62('0x39')],qs['fields'](_0x19707f[_0x2a62('0x38')][_0x2a62('0x3c')]));_0x4a54bf[_0x2a62('0x3a')]=_0x4a54bf[_0x2a62('0x3a')][_0x2a62('0x3d')]?_0x4a54bf[_0x2a62('0x3a')]:_0x9f4db0[_0x2a62('0x39')];_0x4a54bf[_0x2a62('0x65')]=qs[_0x2a62('0x40')](_0x19707f[_0x2a62('0x38')]['sort']);_0x4a54bf[_0x2a62('0x41')]=qs['filters'](_[_0x2a62('0x5b')](_0x19707f[_0x2a62('0x38')],_0x9f4db0[_0x2a62('0x42')]));if(_0x19707f[_0x2a62('0x38')]['filter']){_0x4a54bf[_0x2a62('0x41')]=_['merge'](_0x4a54bf[_0x2a62('0x41')],{'$or':_[_0x2a62('0x33')](_0x4a54bf[_0x2a62('0x3a')],function(_0x40378f){var _0x4038d8={};_0x4038d8[_0x40378f]={'$like':'%'+_0x19707f[_0x2a62('0x38')][_0x2a62('0x45')]+'%'};return _0x4038d8;})});}_0x4a54bf=_['merge']({},_0x4a54bf,_0x19707f[_0x2a62('0x4c')]);return _0xf99fc2['getTeams'](_0x4a54bf);}})[_0x2a62('0x2b')](function(_0x20c2f6){if(_0x20c2f6){_0x27fca4=_0x20c2f6[_0x2a62('0x3d')];if(!_0x19707f['query'][_0x2a62('0x3e')](_0x2a62('0x3f'))){_0x4a54bf['limit']=qs[_0x2a62('0x26')](_0x19707f[_0x2a62('0x38')][_0x2a62('0x26')]);_0x4a54bf[_0x2a62('0x25')]=qs['offset'](_0x19707f[_0x2a62('0x38')][_0x2a62('0x25')]);}return _0xf99fc2[_0x2a62('0x66')](_0x4a54bf);}})[_0x2a62('0x2b')](function(_0x2820bd){if(_0x2820bd){return _0x2820bd?{'count':_0x27fca4,'rows':_0x2820bd}:null;}})['then'](respondWithResult(_0x42de72,null))[_0x2a62('0x4e')](handleError(_0x42de72,null));};exports['addTeams']=function(_0x112f21,_0x58cd00,_0x4e68f2){var _0xd471ec=_0x112f21[_0x2a62('0x50')]['ids'];return db['Team'][_0x2a62('0x48')]({'where':{'id':_0xd471ec},'attributes':['id'],'include':[{'model':db[_0x2a62('0x5d')],'as':_0x2a62('0x67'),'attributes':['id',_0x2a62('0x30'),_0x2a62('0x68'),_0x2a62('0x69'),_0x2a62('0x6a')],'raw':!![]}]})[_0x2a62('0x2b')](function(_0x164537){if(_0x164537){var _0x5c2b40=_['flatMap'](_0x164537,function(_0xb59c4){var _0x5c45b2=_0xb59c4[_0x2a62('0x2d')]({'plain':!![]});return _0x5c45b2[_0x2a62('0x67')];});return db[_0x2a62('0x34')][_0x2a62('0x4d')]({'where':{'id':_0x112f21['params']['id']}})['then'](function(_0x407e5e){return db[_0x2a62('0x6b')][_0x2a62('0x6c')](function(_0x3863c4){return _0x407e5e[_0x2a62('0x6d')](_0xd471ec,{'transaction':_0x3863c4})[_0x2a62('0x2b')](function(){return BPromise['each'](_0x5c2b40,function(_0x7fb634){return db[_0x2a62('0x5a')][_0x2a62('0x6e')]({'where':{'UserId':_0x7fb634['id'],'OpenchannelQueueId':_0x112f21[_0x2a62('0x57')]['id']},'transaction':_0x3863c4});});})[_0x2a62('0x2b')](function(){_0x5c2b40[_0x2a62('0x6f')](function(_0x55b2c1){socket[_0x2a62('0x70')](_0x2a62('0x71'),{'UserId':_0x55b2c1['id'],'OpenchannelQueueId':_0x407e5e['id']});});});});});}})['then'](respondWithStatusCode(_0x58cd00,null))['catch'](handleError(_0x58cd00,null));};exports[_0x2a62('0x72')]=function(_0x15aa75,_0xd682ab,_0x21e251){return db[_0x2a62('0x64')]['findAll']({'where':{'id':_0x15aa75[_0x2a62('0x38')][_0x2a62('0x73')]},'attributes':['id'],'include':[{'model':db[_0x2a62('0x5d')],'as':_0x2a62('0x67'),'attributes':['id'],'raw':!![]}]})[_0x2a62('0x2b')](handleEntityNotFound(_0xd682ab,null))[_0x2a62('0x2b')](function(_0x378803){var _0x3f420a=_[_0x2a62('0x33')](_0x378803,'id');var _0x1493eb=[];var _0x1abe90=[];var _0xfbf943=squel[_0x2a62('0x74')]();_0xfbf943[_0x2a62('0x75')](_0x2a62('0x76'))['from'](_0x2a62('0x77'),'tq')[_0x2a62('0x78')](_0x2a62('0x79'),'ut',_0x2a62('0x7a'))['where']('OpenchannelQueueId\x20=\x20?',_0x15aa75[_0x2a62('0x57')]['id']);for(var _0x4432bd=0x0;_0x4432bd<_0x378803[_0x2a62('0x3d')];_0x4432bd+=0x1){let _0x66b94e=_0x378803[_0x4432bd];for(var _0x119c71=0x0;_0x119c71<_0x66b94e['Agents']['length'];_0x119c71+=0x1){let _0x493709=_0x66b94e[_0x2a62('0x67')][_0x119c71];var _0x23336b=_0xfbf943[_0x2a62('0x7b')]();_0x23336b['where'](_0x2a62('0x7c'),_0x493709['id']);_0x1abe90[_0x2a62('0x7d')](db[_0x2a62('0x6b')][_0x2a62('0x38')](_0x23336b[_0x2a62('0x7e')](),{'type':db['sequelize'][_0x2a62('0x7f')][_0x2a62('0x80')]})[_0x2a62('0x2b')](function(_0x3eec76){if(_0x3eec76[_0x2a62('0x3d')]===0x1){return _0x493709['id'];}else{var _0x540e2f=_['every'](_['map'](_0x3eec76,'TeamId'),function(_0x2ce4ed){return _[_0x2a62('0x81')](_0x3f420a,_0x2ce4ed);});if(_0x540e2f){return _0x493709['id'];}}}));}}return BPromise[_0x2a62('0x82')](_0x1abe90)[_0x2a62('0x2b')](function(_0x5a4231){_0x1493eb=_(_0x1493eb)[_0x2a62('0x83')](_0x5a4231)[_0x2a62('0x84')]()[_0x2a62('0x85')]();return db[_0x2a62('0x34')][_0x2a62('0x4d')]({'where':{'id':_0x15aa75[_0x2a62('0x57')]['id']}})[_0x2a62('0x2b')](function(_0x269192){return db[_0x2a62('0x6b')][_0x2a62('0x6c')](function(_0x51b6ac){return _0x269192[_0x2a62('0x72')](_0x15aa75[_0x2a62('0x38')][_0x2a62('0x73')],{'transaction':_0x51b6ac})['then'](function(){if(!_[_0x2a62('0x86')](_0x1493eb)){return _0x269192['removeAgents'](_0x1493eb,{'transaction':_0x51b6ac});}})[_0x2a62('0x2b')](function(){_0x1493eb['forEach'](function(_0x420e2f){socket[_0x2a62('0x70')](_0x2a62('0x87'),{'UserId':_0x420e2f,'OpenchannelQueueId':_0x269192['id']});});});});});});})[_0x2a62('0x2b')](respondWithStatusCode(_0xd682ab,null))[_0x2a62('0x4e')](handleError(_0xd682ab,null));};exports['addAgents']=function(_0x336fa7,_0x420f6a,_0x2efa21){return db[_0x2a62('0x34')][_0x2a62('0x4d')]({'where':{'id':_0x336fa7[_0x2a62('0x57')]['id']}})[_0x2a62('0x2b')](handleEntityNotFound(_0x420f6a,null))[_0x2a62('0x2b')](function(_0x30c7e9){if(_0x30c7e9){return _0x30c7e9[_0x2a62('0x88')](_0x336fa7[_0x2a62('0x50')]['ids'],_[_0x2a62('0x89')](_0x336fa7[_0x2a62('0x50')],[_0x2a62('0x73'),'id'])||{})[_0x2a62('0x8a')](function(_0x5106a3){for(var _0x379994=0x0;_0x379994<_0x336fa7['body']['ids']['length'];_0x379994+=0x1){socket['emit'](_0x2a62('0x71'),{'UserId':Number(_0x336fa7[_0x2a62('0x50')][_0x2a62('0x73')][_0x379994]),'OpenchannelQueueId':Number(_0x336fa7[_0x2a62('0x57')]['id'])});}return _0x5106a3;});}})['then'](respondWithResult(_0x420f6a,null))['catch'](handleError(_0x420f6a,null));};exports[_0x2a62('0x8b')]=function(_0x2949cd,_0x2338be,_0x91a802){return db[_0x2a62('0x34')][_0x2a62('0x4d')]({'where':{'id':_0x2949cd[_0x2a62('0x57')]['id']}})[_0x2a62('0x2b')](handleEntityNotFound(_0x2338be,null))['then'](function(_0x11aaba){if(_0x11aaba){return _0x11aaba['removeAgents'](_0x2949cd['query']['ids'])[_0x2a62('0x2b')](function(){if(_['isArray'](_0x2949cd[_0x2a62('0x38')][_0x2a62('0x73')])){for(var _0xc53716=0x0;_0xc53716<_0x2949cd[_0x2a62('0x38')][_0x2a62('0x73')]['length'];_0xc53716+=0x1){socket[_0x2a62('0x70')]('userOpenchannelQueue:remove',{'UserId':Number(_0x2949cd[_0x2a62('0x38')][_0x2a62('0x73')][_0xc53716]),'OpenchannelQueueId':Number(_0x2949cd[_0x2a62('0x57')]['id'])});}}else{socket['emit'](_0x2a62('0x87'),{'UserId':Number(_0x2949cd[_0x2a62('0x38')]['ids']),'OpenchannelQueueId':Number(_0x2949cd[_0x2a62('0x57')]['id'])});}});}})[_0x2a62('0x2b')](respondWithStatusCode(_0x2338be,null))[_0x2a62('0x4e')](handleError(_0x2338be,null));};exports['getAgents']=function(_0xe46859,_0x4480c5,_0x447f91){var _0x294ef2={};var _0x31687a={};var _0x3904d7;var _0x36e154;return db['OpenchannelQueue'][_0x2a62('0x59')]({'where':{'id':_0xe46859[_0x2a62('0x57')]['id']}})[_0x2a62('0x2b')](handleEntityNotFound(_0x4480c5,null))[_0x2a62('0x2b')](function(_0x1081b3){if(_0x1081b3){_0x3904d7=_0x1081b3;_0x31687a[_0x2a62('0x39')]=_['keys'](db[_0x2a62('0x5d')][_0x2a62('0x35')]);_0x31687a[_0x2a62('0x38')]=_[_0x2a62('0x4b')](_0xe46859['query']);_0x31687a[_0x2a62('0x42')]=_[_0x2a62('0x3b')](_0x31687a[_0x2a62('0x39')],_0x31687a[_0x2a62('0x38')]);_0x294ef2[_0x2a62('0x3a')]=_[_0x2a62('0x3b')](_0x31687a[_0x2a62('0x39')],qs[_0x2a62('0x3c')](_0xe46859[_0x2a62('0x38')][_0x2a62('0x3c')]));_0x294ef2[_0x2a62('0x3a')]=_0x294ef2[_0x2a62('0x3a')][_0x2a62('0x3d')]?_0x294ef2[_0x2a62('0x3a')]:_0x31687a[_0x2a62('0x39')];_0x294ef2[_0x2a62('0x65')]=qs['sort'](_0xe46859[_0x2a62('0x38')][_0x2a62('0x40')]);_0x294ef2[_0x2a62('0x41')]=qs[_0x2a62('0x42')](_[_0x2a62('0x5b')](_0xe46859['query'],_0x31687a['filters']));if(_0xe46859[_0x2a62('0x38')]['filter']){_0x294ef2[_0x2a62('0x41')]=_[_0x2a62('0x43')](_0x294ef2[_0x2a62('0x41')],{'$or':_[_0x2a62('0x33')](_0x294ef2[_0x2a62('0x3a')],function(_0x330e30){var _0x5e30a5={};_0x5e30a5[_0x330e30]={'$like':'%'+_0xe46859['query'][_0x2a62('0x45')]+'%'};return _0x5e30a5;})});}_0x294ef2=_['merge']({},_0x294ef2,_0xe46859['options']);return _0x3904d7[_0x2a62('0x8c')](_0x294ef2);}})[_0x2a62('0x2b')](function(_0x13dfe2){if(_0x13dfe2){_0x36e154=_0x13dfe2[_0x2a62('0x3d')];if(!_0xe46859['query']['hasOwnProperty']('nolimit')){_0x294ef2[_0x2a62('0x26')]=qs[_0x2a62('0x26')](_0xe46859['query'][_0x2a62('0x26')]);_0x294ef2[_0x2a62('0x25')]=qs[_0x2a62('0x25')](_0xe46859[_0x2a62('0x38')]['offset']);}return _0x3904d7['getAgents'](_0x294ef2);}})[_0x2a62('0x2b')](function(_0x5c757c){if(_0x5c757c){return _0x5c757c?{'count':_0x36e154,'rows':_0x5c757c}:null;}})[_0x2a62('0x2b')](respondWithResult(_0x4480c5,null))[_0x2a62('0x4e')](handleError(_0x4480c5,null));}; \ No newline at end of file +var _0xcaa8=['userOpenchannelQueue:remove','addAgents','omit','removeAgents','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','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','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','OpenchannelQueues','UserProfileResource','then','error','stack','name','send','index','map','OpenchannelQueue','type','key','keys','query','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','each','forEach','emit','userOpenchannelQueue:save','removeTeams','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','every','TeamId','all','union','compact','value'];(function(_0xe4ff17,_0x578673){var _0x3909da=function(_0xb6943f){while(--_0xb6943f){_0xe4ff17['push'](_0xe4ff17['shift']());}};_0x3909da(++_0x578673);}(_0xcaa8,0x125));var _0x8caa=function(_0x2765f3,_0x3a3928){_0x2765f3=_0x2765f3-0x0;var _0x11785e=_0xcaa8[_0x2765f3];return _0x11785e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8caa('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8caa('0x1'));var rp=require(_0x8caa('0x2'));var moment=require(_0x8caa('0x3'));var BPromise=require(_0x8caa('0x4'));var Mustache=require('mustache');var util=require(_0x8caa('0x5'));var path=require(_0x8caa('0x6'));var sox=require(_0x8caa('0x7'));var csv=require(_0x8caa('0x8'));var ejs=require(_0x8caa('0x9'));var fs=require('fs');var fs_extra=require(_0x8caa('0xa'));var _=require(_0x8caa('0xb'));var squel=require(_0x8caa('0xc'));var crypto=require(_0x8caa('0xd'));var jsforce=require(_0x8caa('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8caa('0xf'));var Papa=require(_0x8caa('0x10'));var Redis=require(_0x8caa('0x11'));var authService=require(_0x8caa('0x12'));var qs=require(_0x8caa('0x13'));var as=require(_0x8caa('0x14'));var hardwareService=require(_0x8caa('0x15'));var logger=require('../../config/logger')(_0x8caa('0x16'));var utils=require(_0x8caa('0x17'));var config=require(_0x8caa('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8caa('0x19')]=_[_0x8caa('0x1a')](config[_0x8caa('0x19')],{'host':_0x8caa('0x1b'),'port':0x18eb});var socket=require(_0x8caa('0x1c'))(new Redis(config[_0x8caa('0x19')]));require(_0x8caa('0x1d'))[_0x8caa('0x1e')](socket);function respondWithStatusCode(_0x99a72a,_0x583748){_0x583748=_0x583748||0xcc;return function(_0xa62e71){if(_0xa62e71){return _0x99a72a[_0x8caa('0x1f')](_0x583748);}return _0x99a72a['status'](_0x583748)[_0x8caa('0x20')]();};}function respondWithResult(_0xd0c80e,_0x5dcaf4){_0x5dcaf4=_0x5dcaf4||0xc8;return function(_0x65238){if(_0x65238){return _0xd0c80e[_0x8caa('0x21')](_0x5dcaf4)[_0x8caa('0x22')](_0x65238);}};}function respondWithFilteredResult(_0x15d3f5,_0x31073b){return function(_0x5678c6){if(_0x5678c6){var _0x340ec1=typeof _0x31073b[_0x8caa('0x23')]===_0x8caa('0x24')&&typeof _0x31073b[_0x8caa('0x25')]==='undefined';var _0x30dbe5=_0x5678c6[_0x8caa('0x26')];var _0x250c6f=_0x340ec1?0x0:_0x31073b[_0x8caa('0x23')];var _0x1be087=_0x340ec1?_0x5678c6[_0x8caa('0x26')]:_0x31073b['offset']+_0x31073b[_0x8caa('0x25')];var _0x47a61e;if(_0x1be087>=_0x30dbe5){_0x1be087=_0x30dbe5;_0x47a61e=0xc8;}else{_0x47a61e=0xce;}_0x15d3f5[_0x8caa('0x21')](_0x47a61e);return _0x15d3f5[_0x8caa('0x27')](_0x8caa('0x28'),_0x250c6f+'-'+_0x1be087+'/'+_0x30dbe5)[_0x8caa('0x22')](_0x5678c6);}return null;};}function patchUpdates(_0x4dd681){return function(_0x494599){try{jsonpatch[_0x8caa('0x29')](_0x494599,_0x4dd681,!![]);}catch(_0x4d55b2){return BPromise[_0x8caa('0x2a')](_0x4d55b2);}return _0x494599[_0x8caa('0x2b')]();};}function saveUpdates(_0x1b31fc,_0x25b79e){return function(_0x3a6dd3){if(_0x3a6dd3){return _0x3a6dd3[_0x8caa('0x2c')](_0x1b31fc)['then'](function(_0x8ce297){return _0x8ce297;});}return null;};}function removeEntity(_0x105817,_0x294337){return function(_0x4f34fa){if(_0x4f34fa){return _0x4f34fa[_0x8caa('0x2d')]()['then'](function(){var _0x3bb4d7=_0x4f34fa['get']({'plain':!![]});var _0x458def=_0x8caa('0x2e');return db[_0x8caa('0x2f')][_0x8caa('0x2d')]({'where':{'type':_0x458def,'resourceId':_0x3bb4d7['id']}})[_0x8caa('0x30')](function(){return _0x4f34fa;});})[_0x8caa('0x30')](function(){_0x105817['status'](0xcc)[_0x8caa('0x20')]();});}};}function handleEntityNotFound(_0x325b2c,_0x534de9){return function(_0xf7a821){if(!_0xf7a821){_0x325b2c[_0x8caa('0x1f')](0x194);}return _0xf7a821;};}function handleError(_0x487c8b,_0x4c19dd){_0x4c19dd=_0x4c19dd||0x1f4;return function(_0x8163b7){logger[_0x8caa('0x31')](_0x8163b7[_0x8caa('0x32')]);if(_0x8163b7[_0x8caa('0x33')]){delete _0x8163b7['name'];}_0x487c8b[_0x8caa('0x21')](_0x4c19dd)[_0x8caa('0x34')](_0x8163b7);};}exports[_0x8caa('0x35')]=function(_0x1059af,_0x4239d5){var _0x3f4b04={},_0x3e096f={},_0x5800fd={'count':0x0,'rows':[]};var _0x484399=_[_0x8caa('0x36')](db[_0x8caa('0x37')]['rawAttributes'],function(_0x4aea39){return{'name':_0x4aea39['fieldName'],'type':_0x4aea39[_0x8caa('0x38')][_0x8caa('0x39')]};});_0x3e096f['model']=_[_0x8caa('0x36')](_0x484399,'name');_0x3e096f['query']=_[_0x8caa('0x3a')](_0x1059af[_0x8caa('0x3b')]);_0x3e096f['filters']=_['intersection'](_0x3e096f['model'],_0x3e096f[_0x8caa('0x3b')]);_0x3f4b04[_0x8caa('0x3c')]=_[_0x8caa('0x3d')](_0x3e096f[_0x8caa('0x3e')],qs['fields'](_0x1059af[_0x8caa('0x3b')][_0x8caa('0x3f')]));_0x3f4b04[_0x8caa('0x3c')]=_0x3f4b04['attributes'][_0x8caa('0x40')]?_0x3f4b04[_0x8caa('0x3c')]:_0x3e096f[_0x8caa('0x3e')];if(!_0x1059af[_0x8caa('0x3b')][_0x8caa('0x41')](_0x8caa('0x42'))){_0x3f4b04['limit']=qs[_0x8caa('0x25')](_0x1059af[_0x8caa('0x3b')][_0x8caa('0x25')]);_0x3f4b04[_0x8caa('0x23')]=qs[_0x8caa('0x23')](_0x1059af[_0x8caa('0x3b')][_0x8caa('0x23')]);}_0x3f4b04[_0x8caa('0x43')]=qs['sort'](_0x1059af[_0x8caa('0x3b')][_0x8caa('0x44')]);_0x3f4b04[_0x8caa('0x45')]=qs[_0x8caa('0x46')](_[_0x8caa('0x47')](_0x1059af[_0x8caa('0x3b')],_0x3e096f[_0x8caa('0x46')]),_0x484399);if(_0x1059af[_0x8caa('0x3b')]['filter']){_0x3f4b04[_0x8caa('0x45')]=_[_0x8caa('0x48')](_0x3f4b04[_0x8caa('0x45')],{'$or':_[_0x8caa('0x36')](_0x484399,function(_0x2abcdb){if(_0x2abcdb[_0x8caa('0x38')]!==_0x8caa('0x49')){var _0xebeb2c={};_0xebeb2c[_0x2abcdb['name']]={'$like':'%'+_0x1059af['query'][_0x8caa('0x4a')]+'%'};return _0xebeb2c;}})});}_0x3f4b04=_[_0x8caa('0x48')]({},_0x3f4b04,_0x1059af[_0x8caa('0x4b')]);var _0x3c4f9c={'where':_0x3f4b04[_0x8caa('0x45')]};return db[_0x8caa('0x37')]['count'](_0x3c4f9c)[_0x8caa('0x30')](function(_0x22af55){_0x5800fd['count']=_0x22af55;if(_0x1059af[_0x8caa('0x3b')][_0x8caa('0x4c')]){_0x3f4b04['include']=[{'all':!![]}];}return db['OpenchannelQueue'][_0x8caa('0x4d')](_0x3f4b04);})[_0x8caa('0x30')](function(_0x22a88f){_0x5800fd[_0x8caa('0x4e')]=_0x22a88f;return _0x5800fd;})[_0x8caa('0x30')](respondWithFilteredResult(_0x4239d5,_0x3f4b04))[_0x8caa('0x4f')](handleError(_0x4239d5,null));};exports[_0x8caa('0x50')]=function(_0x2ee098,_0x53fff0){var _0x14d08d={'raw':!![],'where':{'id':_0x2ee098[_0x8caa('0x51')]['id']}},_0x29fa62={};_0x29fa62[_0x8caa('0x3e')]=_['keys'](db[_0x8caa('0x37')][_0x8caa('0x52')]);_0x29fa62[_0x8caa('0x3b')]=_[_0x8caa('0x3a')](_0x2ee098[_0x8caa('0x3b')]);_0x29fa62[_0x8caa('0x46')]=_[_0x8caa('0x3d')](_0x29fa62[_0x8caa('0x3e')],_0x29fa62[_0x8caa('0x3b')]);_0x14d08d[_0x8caa('0x3c')]=_[_0x8caa('0x3d')](_0x29fa62[_0x8caa('0x3e')],qs[_0x8caa('0x3f')](_0x2ee098[_0x8caa('0x3b')]['fields']));_0x14d08d[_0x8caa('0x3c')]=_0x14d08d[_0x8caa('0x3c')][_0x8caa('0x40')]?_0x14d08d[_0x8caa('0x3c')]:_0x29fa62['model'];if(_0x2ee098['query'][_0x8caa('0x4c')]){_0x14d08d[_0x8caa('0x53')]=[{'all':!![]}];}_0x14d08d=_[_0x8caa('0x48')]({},_0x14d08d,_0x2ee098[_0x8caa('0x4b')]);return db['OpenchannelQueue'][_0x8caa('0x54')](_0x14d08d)[_0x8caa('0x30')](handleEntityNotFound(_0x53fff0,null))[_0x8caa('0x30')](respondWithResult(_0x53fff0,null))[_0x8caa('0x4f')](handleError(_0x53fff0,null));};exports[_0x8caa('0x55')]=function(_0x7c7d46,_0x370bfc){return db['OpenchannelQueue'][_0x8caa('0x55')](_0x7c7d46[_0x8caa('0x56')],{})[_0x8caa('0x30')](function(_0x28fd07){var _0x379dbd=_0x7c7d46[_0x8caa('0x57')][_0x8caa('0x58')]({'plain':!![]});if(!_0x379dbd)throw new Error(_0x8caa('0x59'));if(_0x379dbd['role']==='user'){var _0x2e3db1=_0x28fd07[_0x8caa('0x58')]({'plain':!![]});var _0x285ef9=_0x8caa('0x2e');return db[_0x8caa('0x5a')][_0x8caa('0x54')]({'where':{'name':_0x285ef9,'userProfileId':_0x379dbd[_0x8caa('0x5b')]},'raw':!![]})[_0x8caa('0x30')](function(_0x48d66c){if(_0x48d66c&&_0x48d66c['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2e3db1[_0x8caa('0x33')],'resourceId':_0x2e3db1['id'],'type':_0x48d66c[_0x8caa('0x33')],'sectionId':_0x48d66c['id']},{})[_0x8caa('0x30')](function(){return _0x28fd07;});}else{return _0x28fd07;}})[_0x8caa('0x4f')](function(_0x4c9a34){logger[_0x8caa('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c9a34);throw _0x4c9a34;});}return _0x28fd07;})['then'](respondWithResult(_0x370bfc,0xc9))[_0x8caa('0x4f')](handleError(_0x370bfc,null));};exports[_0x8caa('0x2c')]=function(_0x481e63,_0x5abed3){if(_0x481e63['body']['id']){delete _0x481e63[_0x8caa('0x56')]['id'];}return db[_0x8caa('0x37')][_0x8caa('0x54')]({'where':{'id':_0x481e63[_0x8caa('0x51')]['id']}})[_0x8caa('0x30')](handleEntityNotFound(_0x5abed3,null))[_0x8caa('0x30')](saveUpdates(_0x481e63['body'],null))[_0x8caa('0x30')](respondWithResult(_0x5abed3,null))[_0x8caa('0x4f')](handleError(_0x5abed3,null));};exports['destroy']=function(_0x391963,_0x27f7e4){return db[_0x8caa('0x37')][_0x8caa('0x54')]({'where':{'id':_0x391963[_0x8caa('0x51')]['id']}})['then'](handleEntityNotFound(_0x27f7e4,null))[_0x8caa('0x30')](removeEntity(_0x27f7e4,null))[_0x8caa('0x4f')](handleError(_0x27f7e4,null));};exports[_0x8caa('0x5c')]=function(_0xd0e4db,_0x39582f){return db['OpenchannelQueue']['describe']()[_0x8caa('0x30')](respondWithResult(_0x39582f,null))['catch'](handleError(_0x39582f,null));};exports[_0x8caa('0x5d')]=function(_0x4d6cf8,_0x3b8670,_0x5c089d){var _0x567a17={'raw':!![],'where':{}},_0x2b0740={},_0x4d665c;return db[_0x8caa('0x37')][_0x8caa('0x5e')]({'where':{'id':_0x4d6cf8[_0x8caa('0x51')]['id']}})['then'](handleEntityNotFound(_0x3b8670,null))[_0x8caa('0x30')](function(_0x364a43){if(_0x364a43){_0x4d665c=_0x364a43['get']({'plain':!![]});_0x2b0740[_0x8caa('0x3e')]=_[_0x8caa('0x3a')](db[_0x8caa('0x5f')][_0x8caa('0x52')]);_0x2b0740[_0x8caa('0x3b')]=_[_0x8caa('0x3a')](_0x4d6cf8['query']);_0x2b0740['filters']=_[_0x8caa('0x3d')](_0x2b0740[_0x8caa('0x3e')],_0x2b0740[_0x8caa('0x3b')]);_0x567a17['attributes']=_[_0x8caa('0x3d')](_0x2b0740['model'],qs[_0x8caa('0x3f')](_0x4d6cf8[_0x8caa('0x3b')]['fields']));_0x567a17[_0x8caa('0x3c')]=_0x567a17[_0x8caa('0x3c')]['length']?_0x567a17[_0x8caa('0x3c')]:_0x2b0740['model'];if(!_0x4d6cf8[_0x8caa('0x3b')]['hasOwnProperty'](_0x8caa('0x42'))){_0x567a17['limit']=qs[_0x8caa('0x25')](_0x4d6cf8[_0x8caa('0x3b')][_0x8caa('0x25')]);_0x567a17[_0x8caa('0x23')]=qs['offset'](_0x4d6cf8[_0x8caa('0x3b')][_0x8caa('0x23')]);}_0x567a17['order']=qs[_0x8caa('0x44')](_0x4d6cf8['query']['sort']);_0x567a17[_0x8caa('0x45')]=qs[_0x8caa('0x46')](_[_0x8caa('0x47')](_0x4d6cf8['query'],_0x2b0740['filters']));_0x567a17['where'][_0x8caa('0x60')]=_0x364a43['id'];if(_0x4d6cf8[_0x8caa('0x3b')][_0x8caa('0x4a')]){_0x567a17['where']=_[_0x8caa('0x48')](_0x567a17[_0x8caa('0x45')],{'$or':_[_0x8caa('0x36')](_0x567a17[_0x8caa('0x3c')],function(_0x3b2ada){var _0x2bffba={};_0x2bffba[_0x3b2ada]={'$like':'%'+_0x4d6cf8['query'][_0x8caa('0x4a')]+'%'};return _0x2bffba;})});}_0x567a17=_['merge']({},_0x567a17,_0x4d6cf8[_0x8caa('0x4b')]);return db['UserOpenchannelQueue'][_0x8caa('0x4d')](_0x567a17);}})[_0x8caa('0x30')](function(_0x911bcb){if(_0x911bcb){return db[_0x8caa('0x61')]['findAndCountAll']({'where':{'id':_[_0x8caa('0x36')](_0x911bcb,_0x8caa('0x62')),'role':_0x8caa('0x63')},'attributes':['id','name',_0x8caa('0x64'),_0x8caa('0x65'),_0x8caa('0x66')]});}})['then'](function(_0x3e1256){if(_0x3e1256){return{'count':_0x3e1256[_0x8caa('0x26')],'rows':_[_0x8caa('0x36')](_0x3e1256['rows'],function(_0x5b8d51){return{'membername':_0x5b8d51['name'],'UserId':_0x5b8d51['id'],'queue_name':_0x4d665c[_0x8caa('0x33')],'OpenchannelQueueId':_0x4d665c['id'],'interface':util[_0x8caa('0x67')](_0x8caa('0x68'),_0x8caa('0x69'),_0x5b8d51[_0x8caa('0x33')]),'penalty':0x0,'paused':_0x5b8d51['openchannelPause'],'createdAt':_0x5b8d51[_0x8caa('0x66')],'updatedAt':_0x5b8d51[_0x8caa('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8caa('0x30')](respondWithFilteredResult(_0x3b8670,_0x567a17))[_0x8caa('0x4f')](handleError(_0x3b8670,null));};exports[_0x8caa('0x6a')]=function(_0x413dd8,_0x51f671,_0x576a25){var _0x1663dd={};var _0x400880={};var _0x3cedbd;var _0x485b07;return db[_0x8caa('0x37')]['findOne']({'where':{'id':_0x413dd8[_0x8caa('0x51')]['id']}})[_0x8caa('0x30')](handleEntityNotFound(_0x51f671,null))['then'](function(_0x2cf115){if(_0x2cf115){_0x3cedbd=_0x2cf115;_0x400880[_0x8caa('0x3e')]=_[_0x8caa('0x3a')](db['Team']['rawAttributes']);_0x400880[_0x8caa('0x3b')]=_[_0x8caa('0x3a')](_0x413dd8[_0x8caa('0x3b')]);_0x400880[_0x8caa('0x46')]=_[_0x8caa('0x3d')](_0x400880['model'],_0x400880[_0x8caa('0x3b')]);_0x1663dd['attributes']=_[_0x8caa('0x3d')](_0x400880['model'],qs[_0x8caa('0x3f')](_0x413dd8[_0x8caa('0x3b')][_0x8caa('0x3f')]));_0x1663dd[_0x8caa('0x3c')]=_0x1663dd[_0x8caa('0x3c')]['length']?_0x1663dd[_0x8caa('0x3c')]:_0x400880[_0x8caa('0x3e')];_0x1663dd[_0x8caa('0x43')]=qs['sort'](_0x413dd8[_0x8caa('0x3b')][_0x8caa('0x44')]);_0x1663dd[_0x8caa('0x45')]=qs[_0x8caa('0x46')](_['pick'](_0x413dd8[_0x8caa('0x3b')],_0x400880[_0x8caa('0x46')]));if(_0x413dd8[_0x8caa('0x3b')][_0x8caa('0x4a')]){_0x1663dd[_0x8caa('0x45')]=_['merge'](_0x1663dd[_0x8caa('0x45')],{'$or':_[_0x8caa('0x36')](_0x1663dd[_0x8caa('0x3c')],function(_0x4f3fc4){var _0x1d5f66={};_0x1d5f66[_0x4f3fc4]={'$like':'%'+_0x413dd8['query'][_0x8caa('0x4a')]+'%'};return _0x1d5f66;})});}_0x1663dd=_[_0x8caa('0x48')]({},_0x1663dd,_0x413dd8['options']);return _0x3cedbd[_0x8caa('0x6a')](_0x1663dd);}})[_0x8caa('0x30')](function(_0x316994){if(_0x316994){_0x485b07=_0x316994[_0x8caa('0x40')];if(!_0x413dd8[_0x8caa('0x3b')][_0x8caa('0x41')]('nolimit')){_0x1663dd[_0x8caa('0x25')]=qs[_0x8caa('0x25')](_0x413dd8['query']['limit']);_0x1663dd[_0x8caa('0x23')]=qs[_0x8caa('0x23')](_0x413dd8['query']['offset']);}return _0x3cedbd[_0x8caa('0x6a')](_0x1663dd);}})['then'](function(_0x4f494b){if(_0x4f494b){return _0x4f494b?{'count':_0x485b07,'rows':_0x4f494b}:null;}})[_0x8caa('0x30')](respondWithResult(_0x51f671,null))[_0x8caa('0x4f')](handleError(_0x51f671,null));};exports[_0x8caa('0x6b')]=function(_0x1407f5,_0x4e5199,_0x204bd5){var _0x57394e=_0x1407f5[_0x8caa('0x56')][_0x8caa('0x6c')];return db[_0x8caa('0x6d')][_0x8caa('0x4d')]({'where':{'id':_0x57394e},'attributes':['id'],'include':[{'model':db[_0x8caa('0x61')],'as':_0x8caa('0x6e'),'attributes':['id',_0x8caa('0x33'),_0x8caa('0x6f'),_0x8caa('0x70'),_0x8caa('0x71')],'raw':!![]}]})[_0x8caa('0x30')](function(_0x194ce7){if(_0x194ce7){var _0x5dcc25=_[_0x8caa('0x72')](_0x194ce7,function(_0x46280c){var _0x16b145=_0x46280c[_0x8caa('0x58')]({'plain':!![]});return _0x16b145['Agents'];});return db[_0x8caa('0x37')]['find']({'where':{'id':_0x1407f5[_0x8caa('0x51')]['id']}})[_0x8caa('0x30')](function(_0x30cf44){return db['sequelize']['transaction'](function(_0x46e13b){return _0x30cf44[_0x8caa('0x6b')](_0x57394e,{'transaction':_0x46e13b})[_0x8caa('0x30')](function(){return BPromise[_0x8caa('0x73')](_0x5dcc25,function(_0x1c6ead){return db[_0x8caa('0x5f')]['findOrCreate']({'where':{'UserId':_0x1c6ead['id'],'OpenchannelQueueId':_0x1407f5[_0x8caa('0x51')]['id']},'transaction':_0x46e13b});});})[_0x8caa('0x30')](function(){_0x5dcc25[_0x8caa('0x74')](function(_0x510690){socket[_0x8caa('0x75')](_0x8caa('0x76'),{'UserId':_0x510690['id'],'OpenchannelQueueId':_0x30cf44['id']});});});});});}})[_0x8caa('0x30')](respondWithStatusCode(_0x4e5199,null))['catch'](handleError(_0x4e5199,null));};exports[_0x8caa('0x77')]=function(_0x13f9fc,_0x4dae35,_0xadfb26){return db[_0x8caa('0x6d')]['findAll']({'where':{'id':_0x13f9fc['query'][_0x8caa('0x6c')]},'attributes':['id'],'include':[{'model':db[_0x8caa('0x61')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8caa('0x30')](handleEntityNotFound(_0x4dae35,null))[_0x8caa('0x30')](function(_0x5f4502){var _0x3a6444=_[_0x8caa('0x36')](_0x5f4502,'id');var _0x4b4a2b=[];var _0x4cd8c7=[];var _0x4e3d31=squel['select']();_0x4e3d31['field'](_0x8caa('0x78'))[_0x8caa('0x79')](_0x8caa('0x7a'),'tq')[_0x8caa('0x7b')](_0x8caa('0x7c'),'ut',_0x8caa('0x7d'))['where'](_0x8caa('0x7e'),_0x13f9fc[_0x8caa('0x51')]['id']);for(var _0xb70873=0x0;_0xb70873<_0x5f4502[_0x8caa('0x40')];_0xb70873+=0x1){let _0x17a6c2=_0x5f4502[_0xb70873];for(var _0xef9acf=0x0;_0xef9acf<_0x17a6c2[_0x8caa('0x6e')]['length'];_0xef9acf+=0x1){let _0x1e7b91=_0x17a6c2[_0x8caa('0x6e')][_0xef9acf];var _0x14e811=_0x4e3d31[_0x8caa('0x7f')]();_0x14e811[_0x8caa('0x45')](_0x8caa('0x80'),_0x1e7b91['id']);_0x4cd8c7[_0x8caa('0x81')](db['sequelize']['query'](_0x14e811[_0x8caa('0x82')](),{'type':db[_0x8caa('0x83')][_0x8caa('0x84')]['SELECT']})[_0x8caa('0x30')](function(_0x5166bb){if(_0x5166bb[_0x8caa('0x40')]===0x1){return _0x1e7b91['id'];}else{var _0x410774=_[_0x8caa('0x85')](_['map'](_0x5166bb,_0x8caa('0x86')),function(_0x301f77){return _['includes'](_0x3a6444,_0x301f77);});if(_0x410774){return _0x1e7b91['id'];}}}));}}return BPromise[_0x8caa('0x87')](_0x4cd8c7)[_0x8caa('0x30')](function(_0x2d4311){_0x4b4a2b=_(_0x4b4a2b)[_0x8caa('0x88')](_0x2d4311)[_0x8caa('0x89')]()[_0x8caa('0x8a')]();return db['OpenchannelQueue'][_0x8caa('0x54')]({'where':{'id':_0x13f9fc[_0x8caa('0x51')]['id']}})[_0x8caa('0x30')](function(_0x4f0b9f){return db[_0x8caa('0x83')]['transaction'](function(_0x3d9e7e){return _0x4f0b9f[_0x8caa('0x77')](_0x13f9fc[_0x8caa('0x3b')][_0x8caa('0x6c')],{'transaction':_0x3d9e7e})[_0x8caa('0x30')](function(){if(!_['isEmpty'](_0x4b4a2b)){return _0x4f0b9f['removeAgents'](_0x4b4a2b,{'transaction':_0x3d9e7e});}})[_0x8caa('0x30')](function(){_0x4b4a2b[_0x8caa('0x74')](function(_0x18fcad){socket['emit'](_0x8caa('0x8b'),{'UserId':_0x18fcad,'OpenchannelQueueId':_0x4f0b9f['id']});});});});});});})[_0x8caa('0x30')](respondWithStatusCode(_0x4dae35,null))['catch'](handleError(_0x4dae35,null));};exports['addAgents']=function(_0x5ece37,_0x55654d,_0x1eee06){return db['OpenchannelQueue'][_0x8caa('0x54')]({'where':{'id':_0x5ece37[_0x8caa('0x51')]['id']}})['then'](handleEntityNotFound(_0x55654d,null))[_0x8caa('0x30')](function(_0x3cb0f4){if(_0x3cb0f4){return _0x3cb0f4[_0x8caa('0x8c')](_0x5ece37['body'][_0x8caa('0x6c')],_[_0x8caa('0x8d')](_0x5ece37[_0x8caa('0x56')],[_0x8caa('0x6c'),'id'])||{})['spread'](function(_0xd7a4ce){for(var _0x2358d5=0x0;_0x2358d5<_0x5ece37[_0x8caa('0x56')][_0x8caa('0x6c')][_0x8caa('0x40')];_0x2358d5+=0x1){socket[_0x8caa('0x75')](_0x8caa('0x76'),{'UserId':Number(_0x5ece37[_0x8caa('0x56')]['ids'][_0x2358d5]),'OpenchannelQueueId':Number(_0x5ece37[_0x8caa('0x51')]['id'])});}return _0xd7a4ce;});}})[_0x8caa('0x30')](respondWithResult(_0x55654d,null))[_0x8caa('0x4f')](handleError(_0x55654d,null));};exports[_0x8caa('0x8e')]=function(_0x2d9ac3,_0x2e3c9d,_0x16002e){return db[_0x8caa('0x37')][_0x8caa('0x54')]({'where':{'id':_0x2d9ac3['params']['id']}})[_0x8caa('0x30')](handleEntityNotFound(_0x2e3c9d,null))['then'](function(_0x1c1f52){if(_0x1c1f52){return _0x1c1f52[_0x8caa('0x8e')](_0x2d9ac3[_0x8caa('0x3b')][_0x8caa('0x6c')])[_0x8caa('0x30')](function(){if(_['isArray'](_0x2d9ac3[_0x8caa('0x3b')][_0x8caa('0x6c')])){for(var _0x25ad01=0x0;_0x25ad01<_0x2d9ac3[_0x8caa('0x3b')][_0x8caa('0x6c')][_0x8caa('0x40')];_0x25ad01+=0x1){socket[_0x8caa('0x75')](_0x8caa('0x8b'),{'UserId':Number(_0x2d9ac3[_0x8caa('0x3b')][_0x8caa('0x6c')][_0x25ad01]),'OpenchannelQueueId':Number(_0x2d9ac3['params']['id'])});}}else{socket[_0x8caa('0x75')](_0x8caa('0x8b'),{'UserId':Number(_0x2d9ac3['query'][_0x8caa('0x6c')]),'OpenchannelQueueId':Number(_0x2d9ac3[_0x8caa('0x51')]['id'])});}});}})[_0x8caa('0x30')](respondWithStatusCode(_0x2e3c9d,null))[_0x8caa('0x4f')](handleError(_0x2e3c9d,null));};exports[_0x8caa('0x8f')]=function(_0x48bf82,_0x4de4ac,_0x3d2960){var _0x276bfd={};var _0x1181a5={};var _0x50dc3d;var _0x33933f;return db[_0x8caa('0x37')]['findOne']({'where':{'id':_0x48bf82[_0x8caa('0x51')]['id']}})[_0x8caa('0x30')](handleEntityNotFound(_0x4de4ac,null))[_0x8caa('0x30')](function(_0x28e653){if(_0x28e653){_0x50dc3d=_0x28e653;_0x1181a5['model']=_['keys'](db[_0x8caa('0x61')][_0x8caa('0x52')]);_0x1181a5['query']=_[_0x8caa('0x3a')](_0x48bf82[_0x8caa('0x3b')]);_0x1181a5[_0x8caa('0x46')]=_[_0x8caa('0x3d')](_0x1181a5[_0x8caa('0x3e')],_0x1181a5[_0x8caa('0x3b')]);_0x276bfd[_0x8caa('0x3c')]=_[_0x8caa('0x3d')](_0x1181a5[_0x8caa('0x3e')],qs['fields'](_0x48bf82[_0x8caa('0x3b')][_0x8caa('0x3f')]));_0x276bfd[_0x8caa('0x3c')]=_0x276bfd['attributes'][_0x8caa('0x40')]?_0x276bfd[_0x8caa('0x3c')]:_0x1181a5[_0x8caa('0x3e')];_0x276bfd[_0x8caa('0x43')]=qs['sort'](_0x48bf82[_0x8caa('0x3b')][_0x8caa('0x44')]);_0x276bfd[_0x8caa('0x45')]=qs[_0x8caa('0x46')](_[_0x8caa('0x47')](_0x48bf82[_0x8caa('0x3b')],_0x1181a5[_0x8caa('0x46')]));if(_0x48bf82['query'][_0x8caa('0x4a')]){_0x276bfd[_0x8caa('0x45')]=_[_0x8caa('0x48')](_0x276bfd['where'],{'$or':_[_0x8caa('0x36')](_0x276bfd[_0x8caa('0x3c')],function(_0x3b9f00){var _0x539546={};_0x539546[_0x3b9f00]={'$like':'%'+_0x48bf82[_0x8caa('0x3b')][_0x8caa('0x4a')]+'%'};return _0x539546;})});}_0x276bfd=_['merge']({},_0x276bfd,_0x48bf82[_0x8caa('0x4b')]);return _0x50dc3d[_0x8caa('0x8f')](_0x276bfd);}})['then'](function(_0x215f58){if(_0x215f58){_0x33933f=_0x215f58[_0x8caa('0x40')];if(!_0x48bf82[_0x8caa('0x3b')]['hasOwnProperty'](_0x8caa('0x42'))){_0x276bfd[_0x8caa('0x25')]=qs[_0x8caa('0x25')](_0x48bf82[_0x8caa('0x3b')]['limit']);_0x276bfd['offset']=qs[_0x8caa('0x23')](_0x48bf82[_0x8caa('0x3b')][_0x8caa('0x23')]);}return _0x50dc3d[_0x8caa('0x8f')](_0x276bfd);}})[_0x8caa('0x30')](function(_0x10e146){if(_0x10e146){return _0x10e146?{'count':_0x33933f,'rows':_0x10e146}:null;}})[_0x8caa('0x30')](respondWithResult(_0x4de4ac,null))['catch'](handleError(_0x4de4ac,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 541891f..3398520 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 _0xfd23=['hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x34e106,_0x1c19df){var _0x49e92b=function(_0x5e630e){while(--_0x5e630e){_0x34e106['push'](_0x34e106['shift']());}};_0x49e92b(++_0x1c19df);}(_0xfd23,0x156));var _0x3fd2=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xfd23[_0x5ddaac];return _0x2a9c58;};'use strict';var EventEmitter=require(_0x3fd2('0x0'));var OpenchannelQueue=require(_0x3fd2('0x1'))['db'][_0x3fd2('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x3fd2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3fd2('0x4'),'afterDestroy':_0x3fd2('0x5')};function emitEvent(_0x426b9b){return function(_0x397cd1,_0x1aacb3,_0x2cd91f){OpenchannelQueueEvents[_0x3fd2('0x6')](_0x426b9b+':'+_0x397cd1['id'],_0x397cd1);OpenchannelQueueEvents[_0x3fd2('0x6')](_0x426b9b,_0x397cd1);_0x2cd91f(null);};}for(var e in events){if(events[_0x3fd2('0x7')](e)){var event=events[e];OpenchannelQueue[_0x3fd2('0x8')](e,emitEvent(event));}}module[_0x3fd2('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x0029=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','save','update','remove','emit'];(function(_0x491a6f,_0x3f69d5){var _0x1d1787=function(_0x5c03df){while(--_0x5c03df){_0x491a6f['push'](_0x491a6f['shift']());}};_0x1d1787(++_0x3f69d5);}(_0x0029,0x1a7));var _0x9002=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x0029[_0x618414];return _0x21c19a;};'use strict';var EventEmitter=require(_0x9002('0x0'));var OpenchannelQueue=require(_0x9002('0x1'))['db'][_0x9002('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9002('0x3'),'afterUpdate':_0x9002('0x4'),'afterDestroy':_0x9002('0x5')};function emitEvent(_0x2e64e5){return function(_0x4b3ca7,_0x3eb132,_0x366a8e){OpenchannelQueueEvents[_0x9002('0x6')](_0x2e64e5+':'+_0x4b3ca7['id'],_0x4b3ca7);OpenchannelQueueEvents['emit'](_0x2e64e5,_0x4b3ca7);_0x366a8e(null);};}for(var e in events){if(events[_0x9002('0x7')](e)){var event=events[e];OpenchannelQueue[_0x9002('0x8')](e,emitEvent(event));}}module[_0x9002('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index d2645c9..afdee4f 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 _0x2106=['./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x2106,0xd7));var _0x6210=function(_0x263587,_0x7006b5){_0x263587=_0x263587-0x0;var _0xbfd6a5=_0x2106[_0x263587];return _0xbfd6a5;};'use strict';var _=require(_0x6210('0x0'));var util=require(_0x6210('0x1'));var logger=require(_0x6210('0x2'))(_0x6210('0x3'));var moment=require(_0x6210('0x4'));var BPromise=require(_0x6210('0x5'));var rp=require(_0x6210('0x6'));var fs=require('fs');var path=require(_0x6210('0x7'));var rimraf=require(_0x6210('0x8'));var config=require(_0x6210('0x9'));var attributes=require(_0x6210('0xa'));module[_0x6210('0xb')]=function(_0x343800,_0x5ef809){return _0x343800[_0x6210('0xc')](_0x6210('0xd'),attributes,{'tableName':_0x6210('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b85=['lodash','util','api','bluebird','request-promise','rimraf','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues'];(function(_0x32f941,_0x7fd669){var _0x2f953e=function(_0x2333d8){while(--_0x2333d8){_0x32f941['push'](_0x32f941['shift']());}};_0x2f953e(++_0x7fd669);}(_0x2b85,0xfd));var _0x52b8=function(_0x377e08,_0x2eb9b3){_0x377e08=_0x377e08-0x0;var _0x3e43f8=_0x2b85[_0x377e08];return _0x3e43f8;};'use strict';var _=require(_0x52b8('0x0'));var util=require(_0x52b8('0x1'));var logger=require('../../config/logger')(_0x52b8('0x2'));var moment=require('moment');var BPromise=require(_0x52b8('0x3'));var rp=require(_0x52b8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x52b8('0x5'));var config=require('../../config/environment');var attributes=require(_0x52b8('0x6'));module[_0x52b8('0x7')]=function(_0x30ce70,_0x157533){return _0x30ce70[_0x52b8('0x8')](_0x52b8('0x9'),attributes,{'tableName':_0x52b8('0xa'),'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 a7cae17..2f74c57 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 _0xd87e=['ShowOpenchannelQueue','find','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','register','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','limit','map','include','model','attributes'];(function(_0x2cdec6,_0x39d4c8){var _0xa36703=function(_0x6bb8d4){while(--_0x6bb8d4){_0x2cdec6['push'](_0x2cdec6['shift']());}};_0xa36703(++_0x39d4c8);}(_0xd87e,0x161));var _0xed87=function(_0x182e09,_0x5cb1f1){_0x182e09=_0x182e09-0x0;var _0x5bb657=_0xd87e[_0x182e09];return _0x5bb657;};'use strict';var _=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var moment=require(_0xed87('0x2'));var BPromise=require(_0xed87('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed87('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed87('0x5'));var logger=require(_0xed87('0x6'))(_0xed87('0x7'));var config=require(_0xed87('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xed87('0x9')]['http']({'port':0x232a});config[_0xed87('0xa')]=_['defaults'](config[_0xed87('0xa')],{'host':_0xed87('0xb'),'port':0x18eb});var socket=require(_0xed87('0xc'))(new Redis(config[_0xed87('0xa')]));require('./openchannelQueue.socket')[_0xed87('0xd')](socket);function respondWithRpcPromise(_0x3b83b3,_0x41cfb1,_0x3c7328){return new BPromise(function(_0x56a0ee,_0x324520){return client[_0xed87('0xe')](_0x3b83b3,_0x3c7328)[_0xed87('0xf')](function(_0xbe65ff){logger['info'](_0xed87('0x10'),_0x41cfb1,_0xed87('0x11'));logger[_0xed87('0x12')](_0xed87('0x13'),_0x41cfb1,_0xed87('0x11'),JSON[_0xed87('0x14')](_0xbe65ff));if(_0xbe65ff[_0xed87('0x15')]){if(_0xbe65ff[_0xed87('0x15')]['code']===0x1f4){logger[_0xed87('0x15')](_0xed87('0x10'),_0x41cfb1,_0xbe65ff[_0xed87('0x15')][_0xed87('0x16')]);return _0x324520(_0xbe65ff[_0xed87('0x15')][_0xed87('0x16')]);}logger[_0xed87('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x41cfb1,_0xbe65ff[_0xed87('0x15')][_0xed87('0x16')]);return _0x56a0ee(_0xbe65ff[_0xed87('0x15')][_0xed87('0x16')]);}else{logger[_0xed87('0x17')](_0xed87('0x10'),_0x41cfb1,'request\x20sent');_0x56a0ee(_0xbe65ff[_0xed87('0x18')][_0xed87('0x16')]);}})[_0xed87('0x19')](function(_0x27bf2a){logger[_0xed87('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x41cfb1,_0x27bf2a);_0x324520(_0x27bf2a);});});}exports[_0xed87('0x1a')]=function(_0x23dd27){var _0x35b63a=this;return new Promise(function(_0x4beba7,_0x3bfd87){return db[_0xed87('0x1b')][_0xed87('0x1c')]({'raw':_0x23dd27[_0xed87('0x1d')]?_0x23dd27[_0xed87('0x1d')][_0xed87('0x1e')]===undefined?!![]:![]:!![],'where':_0x23dd27['options']?_0x23dd27['options'][_0xed87('0x1f')]||null:null,'attributes':_0x23dd27['options']?_0x23dd27[_0xed87('0x1d')]['attributes']||null:null,'limit':_0x23dd27[_0xed87('0x1d')]?_0x23dd27[_0xed87('0x1d')][_0xed87('0x20')]||null:null,'include':_0x23dd27[_0xed87('0x1d')]?_0x23dd27[_0xed87('0x1d')]['include']?_[_0xed87('0x21')](_0x23dd27[_0xed87('0x1d')][_0xed87('0x22')],function(_0x44522c){return{'model':db[_0x44522c[_0xed87('0x23')]],'as':_0x44522c['as'],'attributes':_0x44522c['attributes'],'include':_0x44522c[_0xed87('0x22')]?_[_0xed87('0x21')](_0x44522c[_0xed87('0x22')],function(_0x1d4744){return{'model':db[_0x1d4744['model']],'as':_0x1d4744['as'],'attributes':_0x1d4744[_0xed87('0x24')],'include':_0x1d4744[_0xed87('0x22')]?_[_0xed87('0x21')](_0x1d4744[_0xed87('0x22')],function(_0x1ba0d2){return{'model':db[_0x1ba0d2[_0xed87('0x23')]],'as':_0x1ba0d2['as'],'attributes':_0x1ba0d2[_0xed87('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59b27f){logger[_0xed87('0x17')](_0xed87('0x1a'),_0x23dd27);logger[_0xed87('0x12')](_0xed87('0x1a'),_0x23dd27,JSON[_0xed87('0x14')](_0x59b27f));_0x4beba7(_0x59b27f);})['catch'](function(_0x39d6b9){logger[_0xed87('0x15')](_0xed87('0x1a'),_0x39d6b9[_0xed87('0x16')],_0x23dd27);_0x3bfd87(_0x35b63a[_0xed87('0x15')](0x1f4,_0x39d6b9[_0xed87('0x16')]));});});};exports[_0xed87('0x25')]=function(_0x30656c){var _0xae90eb=this;return new Promise(function(_0x264e20,_0x52363d){return db[_0xed87('0x1b')][_0xed87('0x26')]({'raw':_0x30656c[_0xed87('0x1d')]?_0x30656c[_0xed87('0x1d')][_0xed87('0x1e')]===undefined?!![]:![]:!![],'where':_0x30656c[_0xed87('0x1d')]?_0x30656c[_0xed87('0x1d')]['where']||null:null,'attributes':_0x30656c[_0xed87('0x1d')]?_0x30656c[_0xed87('0x1d')][_0xed87('0x24')]||null:null,'include':_0x30656c[_0xed87('0x1d')]?_0x30656c[_0xed87('0x1d')]['include']?_[_0xed87('0x21')](_0x30656c[_0xed87('0x1d')][_0xed87('0x22')],function(_0x3222ba){return{'model':db[_0x3222ba['model']],'as':_0x3222ba['as'],'attributes':_0x3222ba['attributes'],'include':_0x3222ba[_0xed87('0x22')]?_['map'](_0x3222ba['include'],function(_0x58f5ab){return{'model':db[_0x58f5ab[_0xed87('0x23')]],'as':_0x58f5ab['as'],'attributes':_0x58f5ab[_0xed87('0x24')],'include':_0x58f5ab[_0xed87('0x22')]?_[_0xed87('0x21')](_0x58f5ab['include'],function(_0x13b2ff){return{'model':db[_0x13b2ff[_0xed87('0x23')]],'as':_0x13b2ff['as'],'attributes':_0x13b2ff['attributes']};}):[]};}):[]};}):[]:[]})[_0xed87('0xf')](function(_0x2d148c){logger[_0xed87('0x17')](_0xed87('0x25'),_0x30656c);logger[_0xed87('0x12')](_0xed87('0x25'),_0x30656c,JSON['stringify'](_0x2d148c));_0x264e20(_0x2d148c);})[_0xed87('0x19')](function(_0x37d138){logger['error'](_0xed87('0x25'),_0x37d138['message'],_0x30656c);_0x52363d(_0xae90eb[_0xed87('0x15')](0x1f4,_0x37d138[_0xed87('0x16')]));});});}; \ No newline at end of file +var _0x2ba9=['then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','limit','map','include','attributes','model','stringify','ShowOpenchannelQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request'];(function(_0x6cf037,_0x3de4c4){var _0x148102=function(_0x1f384f){while(--_0x1f384f){_0x6cf037['push'](_0x6cf037['shift']());}};_0x148102(++_0x3de4c4);}(_0x2ba9,0x191));var _0x92ba=function(_0x107887,_0x387644){_0x107887=_0x107887-0x0;var _0x25dbb1=_0x2ba9[_0x107887];return _0x25dbb1;};'use strict';var _=require(_0x92ba('0x0'));var util=require(_0x92ba('0x1'));var moment=require('moment');var BPromise=require(_0x92ba('0x2'));var rs=require(_0x92ba('0x3'));var fs=require('fs');var Redis=require(_0x92ba('0x4'));var db=require(_0x92ba('0x5'))['db'];var utils=require(_0x92ba('0x6'));var logger=require(_0x92ba('0x7'))(_0x92ba('0x8'));var config=require(_0x92ba('0x9'));var jayson=require(_0x92ba('0xa'));var client=jayson[_0x92ba('0xb')]['http']({'port':0x232a});config[_0x92ba('0xc')]=_[_0x92ba('0xd')](config['redis'],{'host':_0x92ba('0xe'),'port':0x18eb});var socket=require(_0x92ba('0xf'))(new Redis(config[_0x92ba('0xc')]));require(_0x92ba('0x10'))[_0x92ba('0x11')](socket);function respondWithRpcPromise(_0x3e1444,_0x240917,_0xd8863a){return new BPromise(function(_0x3fc586,_0xc3e735){return client[_0x92ba('0x12')](_0x3e1444,_0xd8863a)[_0x92ba('0x13')](function(_0xe32473){logger[_0x92ba('0x14')](_0x92ba('0x15'),_0x240917,_0x92ba('0x16'));logger[_0x92ba('0x17')](_0x92ba('0x18'),_0x240917,_0x92ba('0x16'),JSON['stringify'](_0xe32473));if(_0xe32473[_0x92ba('0x19')]){if(_0xe32473[_0x92ba('0x19')]['code']===0x1f4){logger[_0x92ba('0x19')](_0x92ba('0x15'),_0x240917,_0xe32473['error'][_0x92ba('0x1a')]);return _0xc3e735(_0xe32473[_0x92ba('0x19')][_0x92ba('0x1a')]);}logger[_0x92ba('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x240917,_0xe32473[_0x92ba('0x19')][_0x92ba('0x1a')]);return _0x3fc586(_0xe32473['error']['message']);}else{logger['info'](_0x92ba('0x15'),_0x240917,'request\x20sent');_0x3fc586(_0xe32473['result'][_0x92ba('0x1a')]);}})[_0x92ba('0x1b')](function(_0x24e258){logger[_0x92ba('0x19')](_0x92ba('0x15'),_0x240917,_0x24e258);_0xc3e735(_0x24e258);});});}exports[_0x92ba('0x1c')]=function(_0x1fd5a2){var _0x143398=this;return new Promise(function(_0x4af0eb,_0x5ee01c){return db[_0x92ba('0x1d')][_0x92ba('0x1e')]({'raw':_0x1fd5a2['options']?_0x1fd5a2[_0x92ba('0x1f')][_0x92ba('0x20')]===undefined?!![]:![]:!![],'where':_0x1fd5a2[_0x92ba('0x1f')]?_0x1fd5a2['options'][_0x92ba('0x21')]||null:null,'attributes':_0x1fd5a2[_0x92ba('0x1f')]?_0x1fd5a2[_0x92ba('0x1f')]['attributes']||null:null,'limit':_0x1fd5a2[_0x92ba('0x1f')]?_0x1fd5a2['options'][_0x92ba('0x22')]||null:null,'include':_0x1fd5a2['options']?_0x1fd5a2[_0x92ba('0x1f')]['include']?_[_0x92ba('0x23')](_0x1fd5a2[_0x92ba('0x1f')][_0x92ba('0x24')],function(_0x4bbb6){return{'model':db[_0x4bbb6['model']],'as':_0x4bbb6['as'],'attributes':_0x4bbb6[_0x92ba('0x25')],'include':_0x4bbb6[_0x92ba('0x24')]?_[_0x92ba('0x23')](_0x4bbb6[_0x92ba('0x24')],function(_0x23743f){return{'model':db[_0x23743f['model']],'as':_0x23743f['as'],'attributes':_0x23743f[_0x92ba('0x25')],'include':_0x23743f[_0x92ba('0x24')]?_['map'](_0x23743f[_0x92ba('0x24')],function(_0x1dff48){return{'model':db[_0x1dff48[_0x92ba('0x26')]],'as':_0x1dff48['as'],'attributes':_0x1dff48[_0x92ba('0x25')]};}):[]};}):[]};}):[]:[]})[_0x92ba('0x13')](function(_0x2a209a){logger['info'](_0x92ba('0x1c'),_0x1fd5a2);logger[_0x92ba('0x17')](_0x92ba('0x1c'),_0x1fd5a2,JSON[_0x92ba('0x27')](_0x2a209a));_0x4af0eb(_0x2a209a);})['catch'](function(_0x58518){logger[_0x92ba('0x19')](_0x92ba('0x1c'),_0x58518[_0x92ba('0x1a')],_0x1fd5a2);_0x5ee01c(_0x143398['error'](0x1f4,_0x58518[_0x92ba('0x1a')]));});});};exports[_0x92ba('0x28')]=function(_0x35c996){var _0x4bc978=this;return new Promise(function(_0x167e74,_0x371746){return db[_0x92ba('0x1d')][_0x92ba('0x29')]({'raw':_0x35c996[_0x92ba('0x1f')]?_0x35c996[_0x92ba('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x35c996[_0x92ba('0x1f')]?_0x35c996[_0x92ba('0x1f')]['where']||null:null,'attributes':_0x35c996[_0x92ba('0x1f')]?_0x35c996[_0x92ba('0x1f')][_0x92ba('0x25')]||null:null,'include':_0x35c996[_0x92ba('0x1f')]?_0x35c996[_0x92ba('0x1f')][_0x92ba('0x24')]?_['map'](_0x35c996['options'][_0x92ba('0x24')],function(_0x5698af){return{'model':db[_0x5698af['model']],'as':_0x5698af['as'],'attributes':_0x5698af['attributes'],'include':_0x5698af[_0x92ba('0x24')]?_[_0x92ba('0x23')](_0x5698af[_0x92ba('0x24')],function(_0xfdc203){return{'model':db[_0xfdc203[_0x92ba('0x26')]],'as':_0xfdc203['as'],'attributes':_0xfdc203[_0x92ba('0x25')],'include':_0xfdc203['include']?_['map'](_0xfdc203[_0x92ba('0x24')],function(_0x3c7fa7){return{'model':db[_0x3c7fa7['model']],'as':_0x3c7fa7['as'],'attributes':_0x3c7fa7[_0x92ba('0x25')]};}):[]};}):[]};}):[]:[]})[_0x92ba('0x13')](function(_0x4f800d){logger[_0x92ba('0x14')](_0x92ba('0x28'),_0x35c996);logger[_0x92ba('0x17')](_0x92ba('0x28'),_0x35c996,JSON[_0x92ba('0x27')](_0x4f800d));_0x167e74(_0x4f800d);})[_0x92ba('0x1b')](function(_0x42b8f0){logger['error'](_0x92ba('0x28'),_0x42b8f0['message'],_0x35c996);_0x371746(_0x4bc978[_0x92ba('0x19')](0x1f4,_0x42b8f0[_0x92ba('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 749abc7..17243cc 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 _0x9409=['length','./openchannelQueue.events','save','remove','update','removeListener','register'];(function(_0x281820,_0x47572b){var _0x2d05f6=function(_0x539948){while(--_0x539948){_0x281820['push'](_0x281820['shift']());}};_0x2d05f6(++_0x47572b);}(_0x9409,0x6a));var _0x9940=function(_0x4b727f,_0x47e390){_0x4b727f=_0x4b727f-0x0;var _0xe51025=_0x9409[_0x4b727f];return _0xe51025;};'use strict';var OpenchannelQueueEvents=require(_0x9940('0x0'));var events=[_0x9940('0x1'),_0x9940('0x2'),_0x9940('0x3')];function createListener(_0x5e925a,_0x2afc01){return function(_0x2096e6){_0x2afc01['emit'](_0x5e925a,_0x2096e6);};}function removeListener(_0x57fe3e,_0x59ed50){return function(){OpenchannelQueueEvents[_0x9940('0x4')](_0x57fe3e,_0x59ed50);};}exports[_0x9940('0x5')]=function(_0x4feb05){for(var _0x3d64f6=0x0,_0x209e13=events[_0x9940('0x6')];_0x3d64f6<_0x209e13;_0x3d64f6++){var _0x32e58e=events[_0x3d64f6];var _0x56f751=createListener('openchannelQueue:'+_0x32e58e,_0x4feb05);OpenchannelQueueEvents['on'](_0x32e58e,_0x56f751);}}; \ No newline at end of file +var _0xd830=['remove','update','emit','./openchannelQueue.events','save'];(function(_0x1d30f8,_0x5c9f5f){var _0x464d17=function(_0x1f6efd){while(--_0x1f6efd){_0x1d30f8['push'](_0x1d30f8['shift']());}};_0x464d17(++_0x5c9f5f);}(_0xd830,0x120));var _0x0d83=function(_0x1b3ea6,_0xbc1832){_0x1b3ea6=_0x1b3ea6-0x0;var _0xf5da66=_0xd830[_0x1b3ea6];return _0xf5da66;};'use strict';var OpenchannelQueueEvents=require(_0x0d83('0x0'));var events=[_0x0d83('0x1'),_0x0d83('0x2'),_0x0d83('0x3')];function createListener(_0x53d84a,_0x5a3067){return function(_0x5778b2){_0x5a3067[_0x0d83('0x4')](_0x53d84a,_0x5778b2);};}function removeListener(_0x1e1331,_0x4a832e){return function(){OpenchannelQueueEvents['removeListener'](_0x1e1331,_0x4a832e);};}exports['register']=function(_0x48e2c5){for(var _0x20dec1=0x0,_0x926771=events['length'];_0x20dec1<_0x926771;_0x20dec1++){var _0x2d8a8d=events[_0x20dec1];var _0x10bc1b=createListener('openchannelQueue:'+_0x2d8a8d,_0x48e2c5);OpenchannelQueueEvents['on'](_0x2d8a8d,_0x10bc1b);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 242a584..d1cd72d 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 _0x79c0=['fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x79c0,0x93));var _0x079c=function(_0x59c958,_0x4da20b){_0x59c958=_0x59c958-0x0;var _0x26fa61=_0x79c0[_0x59c958];return _0x26fa61;};'use strict';var multer=require(_0x079c('0x0'));var util=require(_0x079c('0x1'));var path=require(_0x079c('0x2'));var timeout=require(_0x079c('0x3'));var express=require(_0x079c('0x4'));var router=express['Router']();var fs_extra=require(_0x079c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x079c('0x6'));var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router[_0x079c('0x7')]('/',auth[_0x079c('0x8')](),controller[_0x079c('0x9')]);router['get'](_0x079c('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x079c('0x7')](_0x079c('0xb'),auth[_0x079c('0x8')](),controller[_0x079c('0xc')]);router[_0x079c('0xd')]('/',auth[_0x079c('0x8')](),controller[_0x079c('0xe')]);router[_0x079c('0xf')](_0x079c('0xb'),auth[_0x079c('0x8')](),controller[_0x079c('0x10')]);router[_0x079c('0x11')]('/:id',auth[_0x079c('0x8')](),controller['destroy']);module[_0x079c('0x12')]=router; \ No newline at end of file +var _0x85dd=['multer','util','path','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x323d87,_0x4ef3f9){var _0x5e8f74=function(_0x185735){while(--_0x185735){_0x323d87['push'](_0x323d87['shift']());}};_0x5e8f74(++_0x4ef3f9);}(_0x85dd,0x1b5));var _0xd85d=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x85dd[_0x47e7cb];return _0x2a8874;};'use strict';var multer=require(_0xd85d('0x0'));var util=require(_0xd85d('0x1'));var path=require(_0xd85d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd85d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd85d('0x4'));var interaction=require(_0xd85d('0x5'));var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router[_0xd85d('0x6')]('/',auth[_0xd85d('0x7')](),controller[_0xd85d('0x8')]);router['get'](_0xd85d('0x9'),auth[_0xd85d('0x7')](),controller[_0xd85d('0xa')]);router[_0xd85d('0x6')](_0xd85d('0xb'),auth[_0xd85d('0x7')](),controller[_0xd85d('0xc')]);router[_0xd85d('0xd')]('/',auth[_0xd85d('0x7')](),controller[_0xd85d('0xe')]);router['put']('/:id',auth[_0xd85d('0x7')](),controller[_0xd85d('0xf')]);router[_0xd85d('0x10')](_0xd85d('0xb'),auth['isAuthenticated'](),controller[_0xd85d('0x11')]);module[_0xd85d('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index df9b413..f2e6518 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 _0x08e0=['DATE','moment','sequelize','exports','STRING'];(function(_0x5b16c0,_0x4f266e){var _0x43d022=function(_0x1a2dc9){while(--_0x1a2dc9){_0x5b16c0['push'](_0x5b16c0['shift']());}};_0x43d022(++_0x4f266e);}(_0x08e0,0x92));var _0x008e=function(_0x3fe393,_0x234a3a){_0x3fe393=_0x3fe393-0x0;var _0x534d14=_0x08e0[_0x3fe393];return _0x534d14;};'use strict';var moment=require(_0x008e('0x0'));var Sequelize=require(_0x008e('0x1'));module[_0x008e('0x2')]={'uniqueid':{'type':Sequelize[_0x008e('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x008e('0x4')]},'leaveAt':{'type':Sequelize[_0x008e('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x008e('0x4')]},'reason':{'type':Sequelize[_0x008e('0x3')]}}; \ No newline at end of file +var _0x8dfa=['DATE','moment','sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8dfa,0x155));var _0xa8df=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0x8dfa[_0x3f4891];return _0x54f2d8;};'use strict';var moment=require(_0xa8df('0x0'));var Sequelize=require(_0xa8df('0x1'));module[_0xa8df('0x2')]={'uniqueid':{'type':Sequelize[_0xa8df('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa8df('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa8df('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa8df('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index a4757b1..888a37c 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 _0x9d34=['query','keys','filters','intersection','attributes','fields','nolimit','order','where','merge','filter','includeAll','include','findAll','rows','catch','show','length','options','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','end','stack','name','index','OpenchannelQueueReport','rawAttributes','type','key','model','map'];(function(_0x40f586,_0x1710a2){var _0x2a855d=function(_0x4e73cb){while(--_0x4e73cb){_0x40f586['push'](_0x40f586['shift']());}};_0x2a855d(++_0x1710a2);}(_0x9d34,0x9d));var _0x49d3=function(_0x237dfd,_0x138284){_0x237dfd=_0x237dfd-0x0;var _0x34eb74=_0x9d34[_0x237dfd];return _0x34eb74;};'use strict';var emlformat=require(_0x49d3('0x0'));var rimraf=require(_0x49d3('0x1'));var zipdir=require(_0x49d3('0x2'));var jsonpatch=require(_0x49d3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x49d3('0x4'));var sox=require('sox');var csv=require(_0x49d3('0x5'));var ejs=require(_0x49d3('0x6'));var fs=require('fs');var fs_extra=require(_0x49d3('0x7'));var _=require(_0x49d3('0x8'));var squel=require('squel');var crypto=require(_0x49d3('0x9'));var jsforce=require(_0x49d3('0xa'));var deskjs=require(_0x49d3('0xb'));var toCsv=require(_0x49d3('0x5'));var querystring=require('querystring');var Papa=require(_0x49d3('0xc'));var Redis=require(_0x49d3('0xd'));var authService=require(_0x49d3('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x49d3('0xf'))(_0x49d3('0x10'));var utils=require(_0x49d3('0x11'));var config=require(_0x49d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x49d3('0x13'))['db'];function respondWithStatusCode(_0x1c31c6,_0x39eea7){_0x39eea7=_0x39eea7||0xcc;return function(_0x48193e){if(_0x48193e){return _0x1c31c6[_0x49d3('0x14')](_0x39eea7);}return _0x1c31c6[_0x49d3('0x15')](_0x39eea7)['end']();};}function respondWithResult(_0x9081f7,_0x4bc608){_0x4bc608=_0x4bc608||0xc8;return function(_0x1f4e16){if(_0x1f4e16){return _0x9081f7['status'](_0x4bc608)[_0x49d3('0x16')](_0x1f4e16);}};}function respondWithFilteredResult(_0x3d713d,_0x242834){return function(_0x3555d4){if(_0x3555d4){var _0x4c62fa=typeof _0x242834[_0x49d3('0x17')]===_0x49d3('0x18')&&typeof _0x242834[_0x49d3('0x19')]===_0x49d3('0x18');var _0x49e405=_0x3555d4[_0x49d3('0x1a')];var _0x2dc4c7=_0x4c62fa?0x0:_0x242834[_0x49d3('0x17')];var _0x3b728e=_0x4c62fa?_0x3555d4['count']:_0x242834[_0x49d3('0x17')]+_0x242834[_0x49d3('0x19')];var _0x16e855;if(_0x3b728e>=_0x49e405){_0x3b728e=_0x49e405;_0x16e855=0xc8;}else{_0x16e855=0xce;}_0x3d713d['status'](_0x16e855);return _0x3d713d[_0x49d3('0x1b')](_0x49d3('0x1c'),_0x2dc4c7+'-'+_0x3b728e+'/'+_0x49e405)[_0x49d3('0x16')](_0x3555d4);}return null;};}function patchUpdates(_0xd80cb5){return function(_0x4d67fa){try{jsonpatch['apply'](_0x4d67fa,_0xd80cb5,!![]);}catch(_0x8bb4fd){return BPromise[_0x49d3('0x1d')](_0x8bb4fd);}return _0x4d67fa[_0x49d3('0x1e')]();};}function saveUpdates(_0x4ea25c,_0xafa4d1){return function(_0xbbcb50){if(_0xbbcb50){return _0xbbcb50[_0x49d3('0x1f')](_0x4ea25c)['then'](function(_0xba7503){return _0xba7503;});}return null;};}function removeEntity(_0x2b073e,_0x457976){return function(_0x3ad7db){if(_0x3ad7db){return _0x3ad7db[_0x49d3('0x20')]()[_0x49d3('0x21')](function(){_0x2b073e['status'](0xcc)[_0x49d3('0x22')]();});}};}function handleEntityNotFound(_0x39ed38,_0x18b452){return function(_0x13a3bc){if(!_0x13a3bc){_0x39ed38[_0x49d3('0x14')](0x194);}return _0x13a3bc;};}function handleError(_0x4a4dfc,_0x9e775f){_0x9e775f=_0x9e775f||0x1f4;return function(_0xf3f124){logger['error'](_0xf3f124[_0x49d3('0x23')]);if(_0xf3f124[_0x49d3('0x24')]){delete _0xf3f124['name'];}_0x4a4dfc[_0x49d3('0x15')](_0x9e775f)['send'](_0xf3f124);};}exports[_0x49d3('0x25')]=function(_0x4deffb,_0x4f156b){var _0x496901={},_0x1c4223={},_0x228a6f={'count':0x0,'rows':[]};var _0x450ad2=_['map'](db[_0x49d3('0x26')][_0x49d3('0x27')],function(_0x2b2f3f){return{'name':_0x2b2f3f['fieldName'],'type':_0x2b2f3f[_0x49d3('0x28')][_0x49d3('0x29')]};});_0x1c4223[_0x49d3('0x2a')]=_[_0x49d3('0x2b')](_0x450ad2,'name');_0x1c4223[_0x49d3('0x2c')]=_[_0x49d3('0x2d')](_0x4deffb[_0x49d3('0x2c')]);_0x1c4223[_0x49d3('0x2e')]=_[_0x49d3('0x2f')](_0x1c4223[_0x49d3('0x2a')],_0x1c4223[_0x49d3('0x2c')]);_0x496901[_0x49d3('0x30')]=_[_0x49d3('0x2f')](_0x1c4223['model'],qs['fields'](_0x4deffb[_0x49d3('0x2c')][_0x49d3('0x31')]));_0x496901[_0x49d3('0x30')]=_0x496901[_0x49d3('0x30')]['length']?_0x496901[_0x49d3('0x30')]:_0x1c4223['model'];if(!_0x4deffb[_0x49d3('0x2c')]['hasOwnProperty'](_0x49d3('0x32'))){_0x496901[_0x49d3('0x19')]=qs[_0x49d3('0x19')](_0x4deffb['query']['limit']);_0x496901[_0x49d3('0x17')]=qs['offset'](_0x4deffb[_0x49d3('0x2c')][_0x49d3('0x17')]);}_0x496901[_0x49d3('0x33')]=qs['sort'](_0x4deffb[_0x49d3('0x2c')]['sort']);_0x496901['where']=qs[_0x49d3('0x2e')](_['pick'](_0x4deffb[_0x49d3('0x2c')],_0x1c4223['filters']),_0x450ad2);if(_0x4deffb['query']['filter']){_0x496901[_0x49d3('0x34')]=_[_0x49d3('0x35')](_0x496901[_0x49d3('0x34')],{'$or':_[_0x49d3('0x2b')](_0x450ad2,function(_0x25a6a8){if(_0x25a6a8[_0x49d3('0x28')]!=='VIRTUAL'){var _0x1d2cee={};_0x1d2cee[_0x25a6a8[_0x49d3('0x24')]]={'$like':'%'+_0x4deffb[_0x49d3('0x2c')][_0x49d3('0x36')]+'%'};return _0x1d2cee;}})});}_0x496901=_[_0x49d3('0x35')]({},_0x496901,_0x4deffb['options']);var _0x17fed0={'where':_0x496901['where']};return db['OpenchannelQueueReport'][_0x49d3('0x1a')](_0x17fed0)[_0x49d3('0x21')](function(_0x185050){_0x228a6f[_0x49d3('0x1a')]=_0x185050;if(_0x4deffb['query'][_0x49d3('0x37')]){_0x496901[_0x49d3('0x38')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x49d3('0x39')](_0x496901);})[_0x49d3('0x21')](function(_0x9237c6){_0x228a6f[_0x49d3('0x3a')]=_0x9237c6;return _0x228a6f;})[_0x49d3('0x21')](respondWithFilteredResult(_0x4f156b,_0x496901))[_0x49d3('0x3b')](handleError(_0x4f156b,null));};exports[_0x49d3('0x3c')]=function(_0x37e856,_0x40e1d8){var _0x404434={'raw':!![],'where':{'id':_0x37e856['params']['id']}},_0x4bd3cc={};_0x4bd3cc[_0x49d3('0x2a')]=_['keys'](db[_0x49d3('0x26')]['rawAttributes']);_0x4bd3cc['query']=_[_0x49d3('0x2d')](_0x37e856[_0x49d3('0x2c')]);_0x4bd3cc['filters']=_['intersection'](_0x4bd3cc[_0x49d3('0x2a')],_0x4bd3cc[_0x49d3('0x2c')]);_0x404434[_0x49d3('0x30')]=_[_0x49d3('0x2f')](_0x4bd3cc[_0x49d3('0x2a')],qs[_0x49d3('0x31')](_0x37e856[_0x49d3('0x2c')][_0x49d3('0x31')]));_0x404434[_0x49d3('0x30')]=_0x404434[_0x49d3('0x30')][_0x49d3('0x3d')]?_0x404434[_0x49d3('0x30')]:_0x4bd3cc[_0x49d3('0x2a')];if(_0x37e856['query'][_0x49d3('0x37')]){_0x404434[_0x49d3('0x38')]=[{'all':!![]}];}_0x404434=_[_0x49d3('0x35')]({},_0x404434,_0x37e856[_0x49d3('0x3e')]);return db[_0x49d3('0x26')][_0x49d3('0x3f')](_0x404434)[_0x49d3('0x21')](handleEntityNotFound(_0x40e1d8,null))[_0x49d3('0x21')](respondWithResult(_0x40e1d8,null))[_0x49d3('0x3b')](handleError(_0x40e1d8,null));};exports['create']=function(_0x173a06,_0x1aa4c8){return db['OpenchannelQueueReport']['create'](_0x173a06['body'],{})['then'](respondWithResult(_0x1aa4c8,0xc9))[_0x49d3('0x3b')](handleError(_0x1aa4c8,null));};exports[_0x49d3('0x1f')]=function(_0x236096,_0x4b00d9){if(_0x236096[_0x49d3('0x40')]['id']){delete _0x236096[_0x49d3('0x40')]['id'];}return db[_0x49d3('0x26')]['find']({'where':{'id':_0x236096[_0x49d3('0x41')]['id']}})[_0x49d3('0x21')](handleEntityNotFound(_0x4b00d9,null))[_0x49d3('0x21')](saveUpdates(_0x236096['body'],null))[_0x49d3('0x21')](respondWithResult(_0x4b00d9,null))[_0x49d3('0x3b')](handleError(_0x4b00d9,null));};exports[_0x49d3('0x20')]=function(_0x3fd176,_0xa4e514){return db[_0x49d3('0x26')]['find']({'where':{'id':_0x3fd176[_0x49d3('0x41')]['id']}})['then'](handleEntityNotFound(_0xa4e514,null))['then'](removeEntity(_0xa4e514,null))['catch'](handleError(_0xa4e514,null));};exports['describe']=function(_0x2e722c,_0x16131e){return db['OpenchannelQueueReport'][_0x49d3('0x42')]()[_0x49d3('0x21')](respondWithResult(_0x16131e,null))['catch'](handleError(_0x16131e,null));}; \ No newline at end of file +var _0xefd2=['then','destroy','end','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','show','params','find','catch','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','apply','reject','save'];(function(_0x40316f,_0x450751){var _0x53025d=function(_0x1d09ed){while(--_0x1d09ed){_0x40316f['push'](_0x40316f['shift']());}};_0x53025d(++_0x450751);}(_0xefd2,0x158));var _0x2efd=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xefd2[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require(_0x2efd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2efd('0x1'));var jsonpatch=require(_0x2efd('0x2'));var rp=require(_0x2efd('0x3'));var moment=require(_0x2efd('0x4'));var BPromise=require(_0x2efd('0x5'));var Mustache=require(_0x2efd('0x6'));var util=require(_0x2efd('0x7'));var path=require(_0x2efd('0x8'));var sox=require(_0x2efd('0x9'));var csv=require('to-csv');var ejs=require(_0x2efd('0xa'));var fs=require('fs');var fs_extra=require(_0x2efd('0xb'));var _=require(_0x2efd('0xc'));var squel=require('squel');var crypto=require(_0x2efd('0xd'));var jsforce=require(_0x2efd('0xe'));var deskjs=require(_0x2efd('0xf'));var toCsv=require(_0x2efd('0x10'));var querystring=require(_0x2efd('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2efd('0x12'));var qs=require(_0x2efd('0x13'));var as=require(_0x2efd('0x14'));var hardwareService=require(_0x2efd('0x15'));var logger=require('../../config/logger')(_0x2efd('0x16'));var utils=require('../../config/utils');var config=require(_0x2efd('0x17'));var licenseUtil=require(_0x2efd('0x18'));var db=require(_0x2efd('0x19'))['db'];function respondWithStatusCode(_0x4e5885,_0x458a0b){_0x458a0b=_0x458a0b||0xcc;return function(_0x10ef6a){if(_0x10ef6a){return _0x4e5885[_0x2efd('0x1a')](_0x458a0b);}return _0x4e5885[_0x2efd('0x1b')](_0x458a0b)['end']();};}function respondWithResult(_0x161365,_0x177af4){_0x177af4=_0x177af4||0xc8;return function(_0x374341){if(_0x374341){return _0x161365[_0x2efd('0x1b')](_0x177af4)[_0x2efd('0x1c')](_0x374341);}};}function respondWithFilteredResult(_0x234b23,_0x56fb5e){return function(_0x1b7ecc){if(_0x1b7ecc){var _0x2a789b=typeof _0x56fb5e[_0x2efd('0x1d')]===_0x2efd('0x1e')&&typeof _0x56fb5e[_0x2efd('0x1f')]===_0x2efd('0x1e');var _0x43b19e=_0x1b7ecc['count'];var _0x372b2c=_0x2a789b?0x0:_0x56fb5e[_0x2efd('0x1d')];var _0x4e055a=_0x2a789b?_0x1b7ecc['count']:_0x56fb5e[_0x2efd('0x1d')]+_0x56fb5e['limit'];var _0x2480fe;if(_0x4e055a>=_0x43b19e){_0x4e055a=_0x43b19e;_0x2480fe=0xc8;}else{_0x2480fe=0xce;}_0x234b23[_0x2efd('0x1b')](_0x2480fe);return _0x234b23[_0x2efd('0x20')]('Content-Range',_0x372b2c+'-'+_0x4e055a+'/'+_0x43b19e)[_0x2efd('0x1c')](_0x1b7ecc);}return null;};}function patchUpdates(_0x25e7ae){return function(_0x84b2ca){try{jsonpatch[_0x2efd('0x21')](_0x84b2ca,_0x25e7ae,!![]);}catch(_0x5a10a3){return BPromise[_0x2efd('0x22')](_0x5a10a3);}return _0x84b2ca[_0x2efd('0x23')]();};}function saveUpdates(_0x588c5d,_0x31f828){return function(_0x15c215){if(_0x15c215){return _0x15c215['update'](_0x588c5d)[_0x2efd('0x24')](function(_0x190a0a){return _0x190a0a;});}return null;};}function removeEntity(_0x391570,_0x424b7f){return function(_0xd29ad5){if(_0xd29ad5){return _0xd29ad5[_0x2efd('0x25')]()[_0x2efd('0x24')](function(){_0x391570['status'](0xcc)[_0x2efd('0x26')]();});}};}function handleEntityNotFound(_0x2f53e1,_0x4ff938){return function(_0x1ef02c){if(!_0x1ef02c){_0x2f53e1[_0x2efd('0x1a')](0x194);}return _0x1ef02c;};}function handleError(_0x48177b,_0x419b50){_0x419b50=_0x419b50||0x1f4;return function(_0x363e2f){logger[_0x2efd('0x27')](_0x363e2f[_0x2efd('0x28')]);if(_0x363e2f[_0x2efd('0x29')]){delete _0x363e2f['name'];}_0x48177b[_0x2efd('0x1b')](_0x419b50)['send'](_0x363e2f);};}exports[_0x2efd('0x2a')]=function(_0x2c1176,_0x4bc92d){var _0x5f3241={},_0x39d917={},_0xd536c9={'count':0x0,'rows':[]};var _0x368ec3=_[_0x2efd('0x2b')](db[_0x2efd('0x2c')][_0x2efd('0x2d')],function(_0x307851){return{'name':_0x307851[_0x2efd('0x2e')],'type':_0x307851[_0x2efd('0x2f')]['key']};});_0x39d917[_0x2efd('0x30')]=_[_0x2efd('0x2b')](_0x368ec3,_0x2efd('0x29'));_0x39d917[_0x2efd('0x31')]=_[_0x2efd('0x32')](_0x2c1176[_0x2efd('0x31')]);_0x39d917[_0x2efd('0x33')]=_[_0x2efd('0x34')](_0x39d917[_0x2efd('0x30')],_0x39d917[_0x2efd('0x31')]);_0x5f3241['attributes']=_[_0x2efd('0x34')](_0x39d917[_0x2efd('0x30')],qs[_0x2efd('0x35')](_0x2c1176[_0x2efd('0x31')][_0x2efd('0x35')]));_0x5f3241[_0x2efd('0x36')]=_0x5f3241[_0x2efd('0x36')][_0x2efd('0x37')]?_0x5f3241['attributes']:_0x39d917[_0x2efd('0x30')];if(!_0x2c1176[_0x2efd('0x31')][_0x2efd('0x38')](_0x2efd('0x39'))){_0x5f3241[_0x2efd('0x1f')]=qs[_0x2efd('0x1f')](_0x2c1176[_0x2efd('0x31')][_0x2efd('0x1f')]);_0x5f3241['offset']=qs['offset'](_0x2c1176['query'][_0x2efd('0x1d')]);}_0x5f3241['order']=qs['sort'](_0x2c1176[_0x2efd('0x31')][_0x2efd('0x3a')]);_0x5f3241['where']=qs[_0x2efd('0x33')](_[_0x2efd('0x3b')](_0x2c1176[_0x2efd('0x31')],_0x39d917[_0x2efd('0x33')]),_0x368ec3);if(_0x2c1176[_0x2efd('0x31')][_0x2efd('0x3c')]){_0x5f3241[_0x2efd('0x3d')]=_[_0x2efd('0x3e')](_0x5f3241[_0x2efd('0x3d')],{'$or':_[_0x2efd('0x2b')](_0x368ec3,function(_0x1a1f65){if(_0x1a1f65[_0x2efd('0x2f')]!==_0x2efd('0x3f')){var _0xc3c22d={};_0xc3c22d[_0x1a1f65['name']]={'$like':'%'+_0x2c1176[_0x2efd('0x31')][_0x2efd('0x3c')]+'%'};return _0xc3c22d;}})});}_0x5f3241=_[_0x2efd('0x3e')]({},_0x5f3241,_0x2c1176[_0x2efd('0x40')]);var _0x2d8e27={'where':_0x5f3241[_0x2efd('0x3d')]};return db[_0x2efd('0x2c')][_0x2efd('0x41')](_0x2d8e27)[_0x2efd('0x24')](function(_0x509245){_0xd536c9[_0x2efd('0x41')]=_0x509245;if(_0x2c1176[_0x2efd('0x31')][_0x2efd('0x42')]){_0x5f3241[_0x2efd('0x43')]=[{'all':!![]}];}return db[_0x2efd('0x2c')]['findAll'](_0x5f3241);})[_0x2efd('0x24')](function(_0x85f492){_0xd536c9['rows']=_0x85f492;return _0xd536c9;})[_0x2efd('0x24')](respondWithFilteredResult(_0x4bc92d,_0x5f3241))['catch'](handleError(_0x4bc92d,null));};exports[_0x2efd('0x44')]=function(_0x347be5,_0x2a6c67){var _0x44aefb={'raw':!![],'where':{'id':_0x347be5[_0x2efd('0x45')]['id']}},_0x2fcaf8={};_0x2fcaf8[_0x2efd('0x30')]=_[_0x2efd('0x32')](db[_0x2efd('0x2c')][_0x2efd('0x2d')]);_0x2fcaf8[_0x2efd('0x31')]=_[_0x2efd('0x32')](_0x347be5[_0x2efd('0x31')]);_0x2fcaf8[_0x2efd('0x33')]=_[_0x2efd('0x34')](_0x2fcaf8[_0x2efd('0x30')],_0x2fcaf8[_0x2efd('0x31')]);_0x44aefb[_0x2efd('0x36')]=_['intersection'](_0x2fcaf8[_0x2efd('0x30')],qs[_0x2efd('0x35')](_0x347be5['query'][_0x2efd('0x35')]));_0x44aefb[_0x2efd('0x36')]=_0x44aefb[_0x2efd('0x36')][_0x2efd('0x37')]?_0x44aefb['attributes']:_0x2fcaf8[_0x2efd('0x30')];if(_0x347be5[_0x2efd('0x31')][_0x2efd('0x42')]){_0x44aefb[_0x2efd('0x43')]=[{'all':!![]}];}_0x44aefb=_[_0x2efd('0x3e')]({},_0x44aefb,_0x347be5['options']);return db[_0x2efd('0x2c')][_0x2efd('0x46')](_0x44aefb)['then'](handleEntityNotFound(_0x2a6c67,null))[_0x2efd('0x24')](respondWithResult(_0x2a6c67,null))[_0x2efd('0x47')](handleError(_0x2a6c67,null));};exports[_0x2efd('0x48')]=function(_0x10dc00,_0x26ca7c){return db[_0x2efd('0x2c')][_0x2efd('0x48')](_0x10dc00[_0x2efd('0x49')],{})[_0x2efd('0x24')](respondWithResult(_0x26ca7c,0xc9))['catch'](handleError(_0x26ca7c,null));};exports[_0x2efd('0x4a')]=function(_0x429261,_0x22983d){if(_0x429261[_0x2efd('0x49')]['id']){delete _0x429261[_0x2efd('0x49')]['id'];}return db[_0x2efd('0x2c')][_0x2efd('0x46')]({'where':{'id':_0x429261[_0x2efd('0x45')]['id']}})[_0x2efd('0x24')](handleEntityNotFound(_0x22983d,null))[_0x2efd('0x24')](saveUpdates(_0x429261[_0x2efd('0x49')],null))['then'](respondWithResult(_0x22983d,null))['catch'](handleError(_0x22983d,null));};exports['destroy']=function(_0x4b9afd,_0x180c11){return db[_0x2efd('0x2c')]['find']({'where':{'id':_0x4b9afd[_0x2efd('0x45')]['id']}})[_0x2efd('0x24')](handleEntityNotFound(_0x180c11,null))[_0x2efd('0x24')](removeEntity(_0x180c11,null))[_0x2efd('0x47')](handleError(_0x180c11,null));};exports[_0x2efd('0x4b')]=function(_0x131061,_0x3a428b){return db[_0x2efd('0x2c')][_0x2efd('0x4b')]()[_0x2efd('0x24')](respondWithResult(_0x3a428b,null))[_0x2efd('0x47')](handleError(_0x3a428b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index da68ea3..d1dc378 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 _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0xe7a090,_0x43f686){var _0x28551b=function(_0x4209f8){while(--_0x4209f8){_0xe7a090['push'](_0xe7a090['shift']());}};_0x28551b(++_0x43f686);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xc4aa[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x814b,0x1a2));var _0xb814=function(_0x380b8f,_0x32271d){_0x380b8f=_0x380b8f-0x0;var _0x646c69=_0x814b[_0x380b8f];return _0x646c69;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 899d335..b9e708c 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 _0x1b0e=['create','options','raw','stringify','OpenchannelQueueReport','update','attributes','limit','UpdateOpenchannelQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateOpenchannelQueueReport'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x1b0e,0x132));var _0xe1b0=function(_0x368e82,_0x4063ab){_0x368e82=_0x368e82-0x0;var _0x3ca63c=_0x1b0e[_0x368e82];return _0x3ca63c;};'use strict';var _=require(_0xe1b0('0x0'));var util=require(_0xe1b0('0x1'));var moment=require(_0xe1b0('0x2'));var BPromise=require(_0xe1b0('0x3'));var rs=require(_0xe1b0('0x4'));var fs=require('fs');var Redis=require(_0xe1b0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe1b0('0x6'))(_0xe1b0('0x7'));var config=require('../../config/environment');var jayson=require(_0xe1b0('0x8'));var client=jayson[_0xe1b0('0x9')][_0xe1b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52e806,_0x36f5cd,_0x1eef2a){return new BPromise(function(_0x5aacc2,_0x123268){return client[_0xe1b0('0xb')](_0x52e806,_0x1eef2a)[_0xe1b0('0xc')](function(_0x400eee){logger[_0xe1b0('0xd')](_0xe1b0('0xe'),_0x36f5cd,_0xe1b0('0xf'));logger[_0xe1b0('0x10')](_0xe1b0('0x11'),_0x36f5cd,_0xe1b0('0xf'),JSON['stringify'](_0x400eee));if(_0x400eee[_0xe1b0('0x12')]){if(_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x13')]===0x1f4){logger[_0xe1b0('0x12')](_0xe1b0('0xe'),_0x36f5cd,_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);return _0x123268(_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);}logger['error'](_0xe1b0('0xe'),_0x36f5cd,_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);return _0x5aacc2(_0x400eee['error']['message']);}else{logger[_0xe1b0('0xd')](_0xe1b0('0xe'),_0x36f5cd,_0xe1b0('0xf'));_0x5aacc2(_0x400eee[_0xe1b0('0x15')][_0xe1b0('0x14')]);}})[_0xe1b0('0x16')](function(_0x5dfd78){logger[_0xe1b0('0x12')](_0xe1b0('0xe'),_0x36f5cd,_0x5dfd78);_0x123268(_0x5dfd78);});});}exports[_0xe1b0('0x17')]=function(_0x2928b6){var _0x349f90=this;return new Promise(function(_0x5c195f,_0x5b300e){return db['OpenchannelQueueReport'][_0xe1b0('0x18')](_0x2928b6['body'],{'raw':_0x2928b6[_0xe1b0('0x19')]?_0x2928b6[_0xe1b0('0x19')][_0xe1b0('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3e0a89){logger[_0xe1b0('0xd')]('CreateOpenchannelQueueReport',_0x2928b6);logger[_0xe1b0('0x10')](_0xe1b0('0x17'),_0x2928b6,JSON[_0xe1b0('0x1b')](_0x3e0a89));_0x5c195f(_0x3e0a89);})['catch'](function(_0x3c0824){logger['error']('CreateOpenchannelQueueReport',_0x3c0824['message'],_0x2928b6);_0x5b300e(_0x349f90['error'](0x1f4,_0x3c0824[_0xe1b0('0x14')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x289ed3){var _0x28e39a=this;return new Promise(function(_0x37d006,_0x55a2be){return db[_0xe1b0('0x1c')][_0xe1b0('0x1d')](_0x289ed3['body'],{'raw':_0x289ed3[_0xe1b0('0x19')]?_0x289ed3[_0xe1b0('0x19')][_0xe1b0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x289ed3[_0xe1b0('0x19')]?_0x289ed3[_0xe1b0('0x19')]['where']||null:null,'attributes':_0x289ed3[_0xe1b0('0x19')]?_0x289ed3[_0xe1b0('0x19')][_0xe1b0('0x1e')]||null:null,'limit':_0x289ed3[_0xe1b0('0x19')]?_0x289ed3[_0xe1b0('0x19')][_0xe1b0('0x1f')]||null:null})[_0xe1b0('0xc')](function(_0x1c19cd){logger['info'](_0xe1b0('0x20'),_0x289ed3);logger[_0xe1b0('0x10')]('UpdateOpenchannelQueueReport',_0x289ed3,JSON[_0xe1b0('0x1b')](_0x1c19cd));_0x37d006(_0x1c19cd);})[_0xe1b0('0x16')](function(_0x4a01d8){logger['error'](_0xe1b0('0x20'),_0x4a01d8[_0xe1b0('0x14')],_0x289ed3);_0x55a2be(_0x28e39a[_0xe1b0('0x12')](0x1f4,_0x4a01d8[_0xe1b0('0x14')]));});});}; \ No newline at end of file +var _0x09df=['info','request\x20sent','debug','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','catch','UpdateOpenchannelQueueReport','update','raw','where','limit','lodash','util','bluebird','../../mysqldb','rpc','../../config/environment','request','then'];(function(_0x5f009c,_0xe8f3f4){var _0x6745d7=function(_0x47af0e){while(--_0x47af0e){_0x5f009c['push'](_0x5f009c['shift']());}};_0x6745d7(++_0xe8f3f4);}(_0x09df,0x164));var _0xf09d=function(_0x264d4d,_0x118fb5){_0x264d4d=_0x264d4d-0x0;var _0xc917e2=_0x09df[_0x264d4d];return _0xc917e2;};'use strict';var _=require(_0xf09d('0x0'));var util=require(_0xf09d('0x1'));var moment=require('moment');var BPromise=require(_0xf09d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf09d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf09d('0x4'));var config=require(_0xf09d('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x284a42,_0x48b82f,_0x28c91c){return new BPromise(function(_0x2555c7,_0x2f1810){return client[_0xf09d('0x6')](_0x284a42,_0x28c91c)[_0xf09d('0x7')](function(_0x2a59a8){logger[_0xf09d('0x8')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x48b82f,_0xf09d('0x9'));logger[_0xf09d('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x48b82f,_0xf09d('0x9'),JSON['stringify'](_0x2a59a8));if(_0x2a59a8[_0xf09d('0xb')]){if(_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xc')]===0x1f4){logger[_0xf09d('0xb')](_0xf09d('0xd'),_0x48b82f,_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xe')]);return _0x2f1810(_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xe')]);}logger['error'](_0xf09d('0xd'),_0x48b82f,_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xe')]);return _0x2555c7(_0x2a59a8['error']['message']);}else{logger[_0xf09d('0x8')](_0xf09d('0xd'),_0x48b82f,_0xf09d('0x9'));_0x2555c7(_0x2a59a8['result'][_0xf09d('0xe')]);}})['catch'](function(_0x3614f7){logger[_0xf09d('0xb')](_0xf09d('0xd'),_0x48b82f,_0x3614f7);_0x2f1810(_0x3614f7);});});}exports[_0xf09d('0xf')]=function(_0x57e3f8){var _0x38083e=this;return new Promise(function(_0xc4b380,_0x106fb0){return db[_0xf09d('0x10')][_0xf09d('0x11')](_0x57e3f8[_0xf09d('0x12')],{'raw':_0x57e3f8['options']?_0x57e3f8[_0xf09d('0x13')]['raw']===undefined?!![]:![]:!![]})[_0xf09d('0x7')](function(_0x342e14){logger[_0xf09d('0x8')](_0xf09d('0xf'),_0x57e3f8);logger[_0xf09d('0xa')](_0xf09d('0xf'),_0x57e3f8,JSON['stringify'](_0x342e14));_0xc4b380(_0x342e14);})[_0xf09d('0x14')](function(_0x2ab436){logger[_0xf09d('0xb')](_0xf09d('0xf'),_0x2ab436[_0xf09d('0xe')],_0x57e3f8);_0x106fb0(_0x38083e[_0xf09d('0xb')](0x1f4,_0x2ab436[_0xf09d('0xe')]));});});};exports[_0xf09d('0x15')]=function(_0x507484){var _0x394934=this;return new Promise(function(_0x59f232,_0x383ff6){return db['OpenchannelQueueReport'][_0xf09d('0x16')](_0x507484[_0xf09d('0x12')],{'raw':_0x507484[_0xf09d('0x13')]?_0x507484[_0xf09d('0x13')][_0xf09d('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x507484[_0xf09d('0x13')]?_0x507484['options'][_0xf09d('0x18')]||null:null,'attributes':_0x507484[_0xf09d('0x13')]?_0x507484[_0xf09d('0x13')]['attributes']||null:null,'limit':_0x507484['options']?_0x507484['options'][_0xf09d('0x19')]||null:null})[_0xf09d('0x7')](function(_0x28eb98){logger[_0xf09d('0x8')](_0xf09d('0x15'),_0x507484);logger[_0xf09d('0xa')](_0xf09d('0x15'),_0x507484,JSON['stringify'](_0x28eb98));_0x59f232(_0x28eb98);})[_0xf09d('0x14')](function(_0x4b20f5){logger['error'](_0xf09d('0x15'),_0x4b20f5[_0xf09d('0xe')],_0x507484);_0x383ff6(_0x394934['error'](0x1f4,_0x4b20f5[_0xf09d('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index c0e9d75..441592f 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 _0x74c7=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','update','delete','exports','multer'];(function(_0xee8cef,_0x26741a){var _0x42ec07=function(_0x49dcb8){while(--_0x49dcb8){_0xee8cef['push'](_0xee8cef['shift']());}};_0x42ec07(++_0x26741a);}(_0x74c7,0x142));var _0x774c=function(_0x1f8d4c,_0x2dcb49){_0x1f8d4c=_0x1f8d4c-0x0;var _0x337bb7=_0x74c7[_0x1f8d4c];return _0x337bb7;};'use strict';var multer=require(_0x774c('0x0'));var util=require(_0x774c('0x1'));var path=require(_0x774c('0x2'));var timeout=require(_0x774c('0x3'));var express=require(_0x774c('0x4'));var router=express[_0x774c('0x5')]();var fs_extra=require(_0x774c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x774c('0x7'));var config=require(_0x774c('0x8'));var controller=require(_0x774c('0x9'));router[_0x774c('0xa')]('/',auth[_0x774c('0xb')](),controller['index']);router[_0x774c('0xa')](_0x774c('0xc'),auth[_0x774c('0xb')](),controller[_0x774c('0xd')]);router[_0x774c('0xa')](_0x774c('0xe'),auth['isAuthenticated'](),controller[_0x774c('0xf')]);router['post']('/',auth[_0x774c('0xb')](),controller['create']);router['put'](_0x774c('0xe'),auth['isAuthenticated'](),controller[_0x774c('0x10')]);router[_0x774c('0x11')](_0x774c('0xe'),auth[_0x774c('0xb')](),controller['destroy']);module[_0x774c('0x12')]=router; \ No newline at end of file +var _0xdc81=['path','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','post','put','update','destroy','multer'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xdc81,0xed));var _0x1dc8=function(_0x2e4327,_0x472755){_0x2e4327=_0x2e4327-0x0;var _0x3c1fdb=_0xdc81[_0x2e4327];return _0x3c1fdb;};'use strict';var multer=require(_0x1dc8('0x0'));var util=require('util');var path=require(_0x1dc8('0x1'));var timeout=require('connect-timeout');var express=require(_0x1dc8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1dc8('0x3'));var interaction=require(_0x1dc8('0x4'));var config=require('../../config/environment');var controller=require('./openchannelTransferReport.controller');router[_0x1dc8('0x5')]('/',auth[_0x1dc8('0x6')](),controller['index']);router[_0x1dc8('0x5')](_0x1dc8('0x7'),auth[_0x1dc8('0x6')](),controller[_0x1dc8('0x8')]);router[_0x1dc8('0x5')](_0x1dc8('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x1dc8('0xa')]('/',auth[_0x1dc8('0x6')](),controller['create']);router[_0x1dc8('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x1dc8('0xc')]);router['delete'](_0x1dc8('0x9'),auth[_0x1dc8('0x6')](),controller[_0x1dc8('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index f640576..5d7ea0b 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x233d54,_0x261e9c){var _0x25bd27=function(_0x38e897){while(--_0x38e897){_0x233d54['push'](_0x233d54['shift']());}};_0x25bd27(++_0x261e9c);}(_0x70e0,0x17b));var _0x070e=function(_0x3d434d,_0x247336){_0x3d434d=_0x3d434d-0x0;var _0x1a1666=_0x70e0[_0x3d434d];return _0x1a1666;};'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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x41c5df,_0x54abea){var _0x4102e5=function(_0x375510){while(--_0x375510){_0x41c5df['push'](_0x41c5df['shift']());}};_0x4102e5(++_0x54abea);}(_0xedd9,0xfc));var _0x9edd=function(_0x4a46ad,_0x5d0428){_0x4a46ad=_0x4a46ad-0x0;var _0x29ab8e=_0xedd9[_0x4a46ad];return _0x29ab8e;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index d617dd5..1731e3e 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 _0x1d50=['../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','key','keys','filters','intersection','model','attributes','query','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','fields','length','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x146feb,_0x3159f0){var _0x5edb7e=function(_0x4ff67c){while(--_0x4ff67c){_0x146feb['push'](_0x146feb['shift']());}};_0x5edb7e(++_0x3159f0);}(_0x1d50,0x125));var _0x01d5=function(_0x368ffd,_0x34b8c7){_0x368ffd=_0x368ffd-0x0;var _0x16e2bc=_0x1d50[_0x368ffd];return _0x16e2bc;};'use strict';var emlformat=require(_0x01d5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x01d5('0x1'));var jsonpatch=require(_0x01d5('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x01d5('0x3'));var Mustache=require(_0x01d5('0x4'));var util=require('util');var path=require(_0x01d5('0x5'));var sox=require(_0x01d5('0x6'));var csv=require(_0x01d5('0x7'));var ejs=require(_0x01d5('0x8'));var fs=require('fs');var fs_extra=require(_0x01d5('0x9'));var _=require('lodash');var squel=require(_0x01d5('0xa'));var crypto=require(_0x01d5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x01d5('0xc'));var toCsv=require(_0x01d5('0x7'));var querystring=require('querystring');var Papa=require(_0x01d5('0xd'));var Redis=require(_0x01d5('0xe'));var authService=require(_0x01d5('0xf'));var qs=require(_0x01d5('0x10'));var as=require(_0x01d5('0x11'));var hardwareService=require(_0x01d5('0x12'));var logger=require('../../config/logger')(_0x01d5('0x13'));var utils=require(_0x01d5('0x14'));var config=require(_0x01d5('0x15'));var licenseUtil=require(_0x01d5('0x16'));var db=require(_0x01d5('0x17'))['db'];function respondWithStatusCode(_0x2f5ee2,_0x48520f){_0x48520f=_0x48520f||0xcc;return function(_0x16a205){if(_0x16a205){return _0x2f5ee2[_0x01d5('0x18')](_0x48520f);}return _0x2f5ee2[_0x01d5('0x19')](_0x48520f)[_0x01d5('0x1a')]();};}function respondWithResult(_0xe81222,_0xaa16b0){_0xaa16b0=_0xaa16b0||0xc8;return function(_0x2937a1){if(_0x2937a1){return _0xe81222[_0x01d5('0x19')](_0xaa16b0)[_0x01d5('0x1b')](_0x2937a1);}};}function respondWithFilteredResult(_0x510fb7,_0x5d9fc7){return function(_0x274829){if(_0x274829){var _0x56c9c4=typeof _0x5d9fc7['offset']===_0x01d5('0x1c')&&typeof _0x5d9fc7[_0x01d5('0x1d')]==='undefined';var _0x52c236=_0x274829[_0x01d5('0x1e')];var _0x666930=_0x56c9c4?0x0:_0x5d9fc7[_0x01d5('0x1f')];var _0x29f42d=_0x56c9c4?_0x274829['count']:_0x5d9fc7[_0x01d5('0x1f')]+_0x5d9fc7['limit'];var _0x5ea9d3;if(_0x29f42d>=_0x52c236){_0x29f42d=_0x52c236;_0x5ea9d3=0xc8;}else{_0x5ea9d3=0xce;}_0x510fb7[_0x01d5('0x19')](_0x5ea9d3);return _0x510fb7[_0x01d5('0x20')](_0x01d5('0x21'),_0x666930+'-'+_0x29f42d+'/'+_0x52c236)[_0x01d5('0x1b')](_0x274829);}return null;};}function patchUpdates(_0x586dd3){return function(_0x156a06){try{jsonpatch[_0x01d5('0x22')](_0x156a06,_0x586dd3,!![]);}catch(_0x17756a){return BPromise[_0x01d5('0x23')](_0x17756a);}return _0x156a06[_0x01d5('0x24')]();};}function saveUpdates(_0x2c640c,_0x1fd5af){return function(_0x564dc7){if(_0x564dc7){return _0x564dc7['update'](_0x2c640c)['then'](function(_0x299a2c){return _0x299a2c;});}return null;};}function removeEntity(_0x658f6a,_0x3d28e0){return function(_0x1d3589){if(_0x1d3589){return _0x1d3589[_0x01d5('0x25')]()[_0x01d5('0x26')](function(){_0x658f6a[_0x01d5('0x19')](0xcc)[_0x01d5('0x1a')]();});}};}function handleEntityNotFound(_0x3e80f1,_0x478dea){return function(_0xee3ff7){if(!_0xee3ff7){_0x3e80f1['sendStatus'](0x194);}return _0xee3ff7;};}function handleError(_0x58b75b,_0x2a332c){_0x2a332c=_0x2a332c||0x1f4;return function(_0x5aa204){logger[_0x01d5('0x27')](_0x5aa204[_0x01d5('0x28')]);if(_0x5aa204[_0x01d5('0x29')]){delete _0x5aa204[_0x01d5('0x29')];}_0x58b75b[_0x01d5('0x19')](_0x2a332c)[_0x01d5('0x2a')](_0x5aa204);};}exports[_0x01d5('0x2b')]=function(_0x277735,_0x1267a5){var _0x541258={},_0x24df69={},_0x233bab={'count':0x0,'rows':[]};var _0x1abb5a=_[_0x01d5('0x2c')](db[_0x01d5('0x2d')][_0x01d5('0x2e')],function(_0x457987){return{'name':_0x457987[_0x01d5('0x2f')],'type':_0x457987['type'][_0x01d5('0x30')]};});_0x24df69['model']=_[_0x01d5('0x2c')](_0x1abb5a,_0x01d5('0x29'));_0x24df69['query']=_[_0x01d5('0x31')](_0x277735['query']);_0x24df69[_0x01d5('0x32')]=_[_0x01d5('0x33')](_0x24df69[_0x01d5('0x34')],_0x24df69['query']);_0x541258[_0x01d5('0x35')]=_[_0x01d5('0x33')](_0x24df69[_0x01d5('0x34')],qs['fields'](_0x277735[_0x01d5('0x36')]['fields']));_0x541258[_0x01d5('0x35')]=_0x541258[_0x01d5('0x35')]['length']?_0x541258['attributes']:_0x24df69[_0x01d5('0x34')];if(!_0x277735[_0x01d5('0x36')][_0x01d5('0x37')](_0x01d5('0x38'))){_0x541258[_0x01d5('0x1d')]=qs['limit'](_0x277735[_0x01d5('0x36')][_0x01d5('0x1d')]);_0x541258[_0x01d5('0x1f')]=qs[_0x01d5('0x1f')](_0x277735[_0x01d5('0x36')][_0x01d5('0x1f')]);}_0x541258[_0x01d5('0x39')]=qs[_0x01d5('0x3a')](_0x277735['query'][_0x01d5('0x3a')]);_0x541258[_0x01d5('0x3b')]=qs['filters'](_[_0x01d5('0x3c')](_0x277735[_0x01d5('0x36')],_0x24df69[_0x01d5('0x32')]),_0x1abb5a);if(_0x277735['query'][_0x01d5('0x3d')]){_0x541258['where']=_[_0x01d5('0x3e')](_0x541258[_0x01d5('0x3b')],{'$or':_[_0x01d5('0x2c')](_0x1abb5a,function(_0x255619){if(_0x255619[_0x01d5('0x3f')]!==_0x01d5('0x40')){var _0x45742a={};_0x45742a[_0x255619[_0x01d5('0x29')]]={'$like':'%'+_0x277735[_0x01d5('0x36')][_0x01d5('0x3d')]+'%'};return _0x45742a;}})});}_0x541258=_[_0x01d5('0x3e')]({},_0x541258,_0x277735[_0x01d5('0x41')]);var _0xb36c57={'where':_0x541258[_0x01d5('0x3b')]};return db[_0x01d5('0x2d')][_0x01d5('0x1e')](_0xb36c57)[_0x01d5('0x26')](function(_0x140356){_0x233bab[_0x01d5('0x1e')]=_0x140356;if(_0x277735[_0x01d5('0x36')][_0x01d5('0x42')]){_0x541258[_0x01d5('0x43')]=[{'all':!![]}];}return db[_0x01d5('0x2d')][_0x01d5('0x44')](_0x541258);})[_0x01d5('0x26')](function(_0x46b8a7){_0x233bab['rows']=_0x46b8a7;return _0x233bab;})[_0x01d5('0x26')](respondWithFilteredResult(_0x1267a5,_0x541258))[_0x01d5('0x45')](handleError(_0x1267a5,null));};exports[_0x01d5('0x46')]=function(_0x1fb5ba,_0x33a723){var _0x1cc058={'raw':!![],'where':{'id':_0x1fb5ba[_0x01d5('0x47')]['id']}},_0x343bb2={};_0x343bb2['model']=_[_0x01d5('0x31')](db[_0x01d5('0x2d')][_0x01d5('0x2e')]);_0x343bb2[_0x01d5('0x36')]=_[_0x01d5('0x31')](_0x1fb5ba[_0x01d5('0x36')]);_0x343bb2[_0x01d5('0x32')]=_['intersection'](_0x343bb2[_0x01d5('0x34')],_0x343bb2[_0x01d5('0x36')]);_0x1cc058['attributes']=_[_0x01d5('0x33')](_0x343bb2[_0x01d5('0x34')],qs['fields'](_0x1fb5ba[_0x01d5('0x36')][_0x01d5('0x48')]));_0x1cc058[_0x01d5('0x35')]=_0x1cc058[_0x01d5('0x35')][_0x01d5('0x49')]?_0x1cc058['attributes']:_0x343bb2['model'];if(_0x1fb5ba[_0x01d5('0x36')][_0x01d5('0x42')]){_0x1cc058[_0x01d5('0x43')]=[{'all':!![]}];}_0x1cc058=_[_0x01d5('0x3e')]({},_0x1cc058,_0x1fb5ba[_0x01d5('0x41')]);return db[_0x01d5('0x2d')][_0x01d5('0x4a')](_0x1cc058)[_0x01d5('0x26')](handleEntityNotFound(_0x33a723,null))['then'](respondWithResult(_0x33a723,null))['catch'](handleError(_0x33a723,null));};exports[_0x01d5('0x4b')]=function(_0xfcc74b,_0x3f18ee){return db['OpenchannelTransferReport'][_0x01d5('0x4b')](_0xfcc74b[_0x01d5('0x4c')],{})[_0x01d5('0x26')](respondWithResult(_0x3f18ee,0xc9))[_0x01d5('0x45')](handleError(_0x3f18ee,null));};exports[_0x01d5('0x4d')]=function(_0x127745,_0xe644a){if(_0x127745[_0x01d5('0x4c')]['id']){delete _0x127745[_0x01d5('0x4c')]['id'];}return db['OpenchannelTransferReport'][_0x01d5('0x4a')]({'where':{'id':_0x127745['params']['id']}})[_0x01d5('0x26')](handleEntityNotFound(_0xe644a,null))[_0x01d5('0x26')](saveUpdates(_0x127745[_0x01d5('0x4c')],null))[_0x01d5('0x26')](respondWithResult(_0xe644a,null))['catch'](handleError(_0xe644a,null));};exports[_0x01d5('0x25')]=function(_0x3cc9cf,_0x14fc7e){return db[_0x01d5('0x2d')][_0x01d5('0x4a')]({'where':{'id':_0x3cc9cf[_0x01d5('0x47')]['id']}})[_0x01d5('0x26')](handleEntityNotFound(_0x14fc7e,null))['then'](removeEntity(_0x14fc7e,null))['catch'](handleError(_0x14fc7e,null));};exports[_0x01d5('0x4e')]=function(_0x5abe5e,_0x404ba7){return db[_0x01d5('0x2d')]['describe']()[_0x01d5('0x26')](respondWithResult(_0x404ba7,null))[_0x01d5('0x45')](handleError(_0x404ba7,null));}; \ No newline at end of file +var _0xf3aa=['lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','OpenchannelTransferReport','then','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra'];(function(_0xc79c25,_0x14fbb5){var _0x44a468=function(_0x50b834){while(--_0x50b834){_0xc79c25['push'](_0xc79c25['shift']());}};_0x44a468(++_0x14fbb5);}(_0xf3aa,0xe7));var _0xaf3a=function(_0x333798,_0x9f6561){_0x333798=_0x333798-0x0;var _0x389f4e=_0xf3aa[_0x333798];return _0x389f4e;};'use strict';var emlformat=require(_0xaf3a('0x0'));var rimraf=require(_0xaf3a('0x1'));var zipdir=require(_0xaf3a('0x2'));var jsonpatch=require(_0xaf3a('0x3'));var rp=require(_0xaf3a('0x4'));var moment=require('moment');var BPromise=require(_0xaf3a('0x5'));var Mustache=require(_0xaf3a('0x6'));var util=require(_0xaf3a('0x7'));var path=require(_0xaf3a('0x8'));var sox=require(_0xaf3a('0x9'));var csv=require(_0xaf3a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaf3a('0xb'));var _=require(_0xaf3a('0xc'));var squel=require(_0xaf3a('0xd'));var crypto=require(_0xaf3a('0xe'));var jsforce=require(_0xaf3a('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaf3a('0x10'));var Papa=require(_0xaf3a('0x11'));var Redis=require(_0xaf3a('0x12'));var authService=require(_0xaf3a('0x13'));var qs=require(_0xaf3a('0x14'));var as=require(_0xaf3a('0x15'));var hardwareService=require(_0xaf3a('0x16'));var logger=require(_0xaf3a('0x17'))(_0xaf3a('0x18'));var utils=require(_0xaf3a('0x19'));var config=require(_0xaf3a('0x1a'));var licenseUtil=require(_0xaf3a('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2585ef,_0x49d1d2){_0x49d1d2=_0x49d1d2||0xcc;return function(_0x2b78f7){if(_0x2b78f7){return _0x2585ef[_0xaf3a('0x1c')](_0x49d1d2);}return _0x2585ef[_0xaf3a('0x1d')](_0x49d1d2)[_0xaf3a('0x1e')]();};}function respondWithResult(_0x535551,_0x36958d){_0x36958d=_0x36958d||0xc8;return function(_0x424391){if(_0x424391){return _0x535551[_0xaf3a('0x1d')](_0x36958d)[_0xaf3a('0x1f')](_0x424391);}};}function respondWithFilteredResult(_0x566ce2,_0x173fc8){return function(_0x4357bd){if(_0x4357bd){var _0x3ffea6=typeof _0x173fc8[_0xaf3a('0x20')]===_0xaf3a('0x21')&&typeof _0x173fc8[_0xaf3a('0x22')]===_0xaf3a('0x21');var _0x29997c=_0x4357bd[_0xaf3a('0x23')];var _0x1b022f=_0x3ffea6?0x0:_0x173fc8[_0xaf3a('0x20')];var _0x4ba42a=_0x3ffea6?_0x4357bd[_0xaf3a('0x23')]:_0x173fc8[_0xaf3a('0x20')]+_0x173fc8[_0xaf3a('0x22')];var _0x25e8a3;if(_0x4ba42a>=_0x29997c){_0x4ba42a=_0x29997c;_0x25e8a3=0xc8;}else{_0x25e8a3=0xce;}_0x566ce2['status'](_0x25e8a3);return _0x566ce2[_0xaf3a('0x24')]('Content-Range',_0x1b022f+'-'+_0x4ba42a+'/'+_0x29997c)[_0xaf3a('0x1f')](_0x4357bd);}return null;};}function patchUpdates(_0x453fb4){return function(_0x511f76){try{jsonpatch[_0xaf3a('0x25')](_0x511f76,_0x453fb4,!![]);}catch(_0x3f72d8){return BPromise[_0xaf3a('0x26')](_0x3f72d8);}return _0x511f76[_0xaf3a('0x27')]();};}function saveUpdates(_0x4bea2c,_0x5bb58c){return function(_0x3ddbfc){if(_0x3ddbfc){return _0x3ddbfc[_0xaf3a('0x28')](_0x4bea2c)['then'](function(_0x28cbd3){return _0x28cbd3;});}return null;};}function removeEntity(_0x511abb,_0x4d6008){return function(_0x5b80ed){if(_0x5b80ed){return _0x5b80ed[_0xaf3a('0x29')]()['then'](function(){_0x511abb[_0xaf3a('0x1d')](0xcc)[_0xaf3a('0x1e')]();});}};}function handleEntityNotFound(_0x12504a,_0x804fac){return function(_0x527394){if(!_0x527394){_0x12504a[_0xaf3a('0x1c')](0x194);}return _0x527394;};}function handleError(_0x39d637,_0xb5db33){_0xb5db33=_0xb5db33||0x1f4;return function(_0x5f3b81){logger[_0xaf3a('0x2a')](_0x5f3b81[_0xaf3a('0x2b')]);if(_0x5f3b81[_0xaf3a('0x2c')]){delete _0x5f3b81[_0xaf3a('0x2c')];}_0x39d637[_0xaf3a('0x1d')](_0xb5db33)[_0xaf3a('0x2d')](_0x5f3b81);};}exports[_0xaf3a('0x2e')]=function(_0xcc95ed,_0x7277c){var _0x37b9f2={},_0x126d05={},_0x1ffb37={'count':0x0,'rows':[]};var _0x125219=_[_0xaf3a('0x2f')](db['OpenchannelTransferReport'][_0xaf3a('0x30')],function(_0x5401ea){return{'name':_0x5401ea[_0xaf3a('0x31')],'type':_0x5401ea[_0xaf3a('0x32')][_0xaf3a('0x33')]};});_0x126d05[_0xaf3a('0x34')]=_[_0xaf3a('0x2f')](_0x125219,_0xaf3a('0x2c'));_0x126d05[_0xaf3a('0x35')]=_[_0xaf3a('0x36')](_0xcc95ed[_0xaf3a('0x35')]);_0x126d05[_0xaf3a('0x37')]=_[_0xaf3a('0x38')](_0x126d05[_0xaf3a('0x34')],_0x126d05['query']);_0x37b9f2[_0xaf3a('0x39')]=_[_0xaf3a('0x38')](_0x126d05[_0xaf3a('0x34')],qs['fields'](_0xcc95ed['query'][_0xaf3a('0x3a')]));_0x37b9f2['attributes']=_0x37b9f2[_0xaf3a('0x39')]['length']?_0x37b9f2[_0xaf3a('0x39')]:_0x126d05[_0xaf3a('0x34')];if(!_0xcc95ed[_0xaf3a('0x35')][_0xaf3a('0x3b')](_0xaf3a('0x3c'))){_0x37b9f2['limit']=qs[_0xaf3a('0x22')](_0xcc95ed['query'][_0xaf3a('0x22')]);_0x37b9f2[_0xaf3a('0x20')]=qs[_0xaf3a('0x20')](_0xcc95ed[_0xaf3a('0x35')]['offset']);}_0x37b9f2[_0xaf3a('0x3d')]=qs[_0xaf3a('0x3e')](_0xcc95ed[_0xaf3a('0x35')][_0xaf3a('0x3e')]);_0x37b9f2['where']=qs[_0xaf3a('0x37')](_['pick'](_0xcc95ed[_0xaf3a('0x35')],_0x126d05[_0xaf3a('0x37')]),_0x125219);if(_0xcc95ed[_0xaf3a('0x35')][_0xaf3a('0x3f')]){_0x37b9f2[_0xaf3a('0x40')]=_[_0xaf3a('0x41')](_0x37b9f2[_0xaf3a('0x40')],{'$or':_[_0xaf3a('0x2f')](_0x125219,function(_0x5671bb){if(_0x5671bb[_0xaf3a('0x32')]!==_0xaf3a('0x42')){var _0x45b6b2={};_0x45b6b2[_0x5671bb[_0xaf3a('0x2c')]]={'$like':'%'+_0xcc95ed['query']['filter']+'%'};return _0x45b6b2;}})});}_0x37b9f2=_[_0xaf3a('0x41')]({},_0x37b9f2,_0xcc95ed[_0xaf3a('0x43')]);var _0x4ff3e7={'where':_0x37b9f2[_0xaf3a('0x40')]};return db[_0xaf3a('0x44')][_0xaf3a('0x23')](_0x4ff3e7)[_0xaf3a('0x45')](function(_0x249c1b){_0x1ffb37['count']=_0x249c1b;if(_0xcc95ed[_0xaf3a('0x35')][_0xaf3a('0x46')]){_0x37b9f2[_0xaf3a('0x47')]=[{'all':!![]}];}return db[_0xaf3a('0x44')][_0xaf3a('0x48')](_0x37b9f2);})[_0xaf3a('0x45')](function(_0x55c23e){_0x1ffb37[_0xaf3a('0x49')]=_0x55c23e;return _0x1ffb37;})[_0xaf3a('0x45')](respondWithFilteredResult(_0x7277c,_0x37b9f2))[_0xaf3a('0x4a')](handleError(_0x7277c,null));};exports['show']=function(_0x5c9e02,_0x3985c4){var _0x4a4460={'raw':!![],'where':{'id':_0x5c9e02[_0xaf3a('0x4b')]['id']}},_0xae4a58={};_0xae4a58[_0xaf3a('0x34')]=_['keys'](db['OpenchannelTransferReport']['rawAttributes']);_0xae4a58[_0xaf3a('0x35')]=_[_0xaf3a('0x36')](_0x5c9e02[_0xaf3a('0x35')]);_0xae4a58[_0xaf3a('0x37')]=_['intersection'](_0xae4a58['model'],_0xae4a58[_0xaf3a('0x35')]);_0x4a4460[_0xaf3a('0x39')]=_[_0xaf3a('0x38')](_0xae4a58['model'],qs[_0xaf3a('0x3a')](_0x5c9e02['query'][_0xaf3a('0x3a')]));_0x4a4460[_0xaf3a('0x39')]=_0x4a4460[_0xaf3a('0x39')][_0xaf3a('0x4c')]?_0x4a4460[_0xaf3a('0x39')]:_0xae4a58['model'];if(_0x5c9e02['query'][_0xaf3a('0x46')]){_0x4a4460[_0xaf3a('0x47')]=[{'all':!![]}];}_0x4a4460=_[_0xaf3a('0x41')]({},_0x4a4460,_0x5c9e02[_0xaf3a('0x43')]);return db[_0xaf3a('0x44')][_0xaf3a('0x4d')](_0x4a4460)[_0xaf3a('0x45')](handleEntityNotFound(_0x3985c4,null))[_0xaf3a('0x45')](respondWithResult(_0x3985c4,null))[_0xaf3a('0x4a')](handleError(_0x3985c4,null));};exports[_0xaf3a('0x4e')]=function(_0x2d00b1,_0x10bce2){return db[_0xaf3a('0x44')]['create'](_0x2d00b1['body'],{})[_0xaf3a('0x45')](respondWithResult(_0x10bce2,0xc9))[_0xaf3a('0x4a')](handleError(_0x10bce2,null));};exports[_0xaf3a('0x28')]=function(_0x415289,_0xb2d845){if(_0x415289[_0xaf3a('0x4f')]['id']){delete _0x415289[_0xaf3a('0x4f')]['id'];}return db['OpenchannelTransferReport'][_0xaf3a('0x4d')]({'where':{'id':_0x415289[_0xaf3a('0x4b')]['id']}})[_0xaf3a('0x45')](handleEntityNotFound(_0xb2d845,null))[_0xaf3a('0x45')](saveUpdates(_0x415289[_0xaf3a('0x4f')],null))['then'](respondWithResult(_0xb2d845,null))['catch'](handleError(_0xb2d845,null));};exports[_0xaf3a('0x29')]=function(_0x45825e,_0x425d2e){return db[_0xaf3a('0x44')]['find']({'where':{'id':_0x45825e['params']['id']}})[_0xaf3a('0x45')](handleEntityNotFound(_0x425d2e,null))[_0xaf3a('0x45')](removeEntity(_0x425d2e,null))[_0xaf3a('0x4a')](handleError(_0x425d2e,null));};exports['describe']=function(_0x101421,_0x56d75e){return db['OpenchannelTransferReport'][_0xaf3a('0x50')]()[_0xaf3a('0x45')](respondWithResult(_0x56d75e,null))[_0xaf3a('0x4a')](handleError(_0x56d75e,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index c0cda5a..e4a5ea3 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 _0xe377=['../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','api','request-promise','path'];(function(_0x10b48a,_0x1a0a3f){var _0x2c4533=function(_0x5e4be6){while(--_0x5e4be6){_0x10b48a['push'](_0x10b48a['shift']());}};_0x2c4533(++_0x1a0a3f);}(_0xe377,0x80));var _0x7e37=function(_0x128db1,_0x4fdfdd){_0x128db1=_0x128db1-0x0;var _0x1542b1=_0xe377[_0x128db1];return _0x1542b1;};'use strict';var _=require(_0x7e37('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7e37('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7e37('0x2'));var fs=require('fs');var path=require(_0x7e37('0x3'));var rimraf=require('rimraf');var config=require(_0x7e37('0x4'));var attributes=require(_0x7e37('0x5'));module[_0x7e37('0x6')]=function(_0xb1bd37,_0x3404cb){return _0xb1bd37[_0x7e37('0x7')](_0x7e37('0x8'),attributes,{'tableName':_0x7e37('0x9'),'paranoid':![],'indexes':[{'name':_0x7e37('0xa'),'fields':[_0x7e37('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5c37=['OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define'];(function(_0x2be5c4,_0x2760aa){var _0x463ea5=function(_0x16e7b1){while(--_0x16e7b1){_0x2be5c4['push'](_0x2be5c4['shift']());}};_0x463ea5(++_0x2760aa);}(_0x5c37,0x129));var _0x75c3=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0x5c37[_0x519756];return _0x37047e;};'use strict';var _=require(_0x75c3('0x0'));var util=require(_0x75c3('0x1'));var logger=require(_0x75c3('0x2'))(_0x75c3('0x3'));var moment=require(_0x75c3('0x4'));var BPromise=require(_0x75c3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x75c3('0x6'));var config=require(_0x75c3('0x7'));var attributes=require(_0x75c3('0x8'));module[_0x75c3('0x9')]=function(_0x2a9cce,_0x53208a){return _0x2a9cce[_0x75c3('0xa')](_0x75c3('0xb'),attributes,{'tableName':_0x75c3('0xc'),'paranoid':![],'indexes':[{'name':_0x75c3('0xd'),'fields':[_0x75c3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 35a7862..28a626f 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 _0x8958=['client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x2967c1,_0x202a72){var _0x103397=function(_0x14b5cc){while(--_0x14b5cc){_0x2967c1['push'](_0x2967c1['shift']());}};_0x103397(++_0x202a72);}(_0x8958,0x93));var _0x8895=function(_0x46492c,_0x1f0d97){_0x46492c=_0x46492c-0x0;var _0x56c2a0=_0x8958[_0x46492c];return _0x56c2a0;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8895('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x8895('0x2'))(_0x8895('0x3'));var config=require(_0x8895('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x8895('0x5')][_0x8895('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x124e1e,_0x40cec6,_0x33013a){return new BPromise(function(_0x51376b,_0xe018b8){return client[_0x8895('0x7')](_0x124e1e,_0x33013a)[_0x8895('0x8')](function(_0x24fe49){logger[_0x8895('0x9')](_0x8895('0xa'),_0x40cec6,_0x8895('0xb'));logger[_0x8895('0xc')](_0x8895('0xd'),_0x40cec6,_0x8895('0xb'),JSON['stringify'](_0x24fe49));if(_0x24fe49[_0x8895('0xe')]){if(_0x24fe49[_0x8895('0xe')][_0x8895('0xf')]===0x1f4){logger[_0x8895('0xe')](_0x8895('0xa'),_0x40cec6,_0x24fe49[_0x8895('0xe')]['message']);return _0xe018b8(_0x24fe49[_0x8895('0xe')][_0x8895('0x10')]);}logger[_0x8895('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x40cec6,_0x24fe49['error'][_0x8895('0x10')]);return _0x51376b(_0x24fe49['error'][_0x8895('0x10')]);}else{logger[_0x8895('0x9')](_0x8895('0xa'),_0x40cec6,_0x8895('0xb'));_0x51376b(_0x24fe49[_0x8895('0x11')]['message']);}})[_0x8895('0x12')](function(_0x100fc8){logger[_0x8895('0xe')](_0x8895('0xa'),_0x40cec6,_0x100fc8);_0xe018b8(_0x100fc8);});});} \ No newline at end of file +var _0x826a=['debug','error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x826a,0x1aa));var _0xa826=function(_0xcb1f05,_0x213604){_0xcb1f05=_0xcb1f05-0x0;var _0x218eb0=_0x826a[_0xcb1f05];return _0x218eb0;};'use strict';var _=require('lodash');var util=require(_0xa826('0x0'));var moment=require('moment');var BPromise=require(_0xa826('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa826('0x2'));var db=require(_0xa826('0x3'))['db'];var utils=require(_0xa826('0x4'));var logger=require(_0xa826('0x5'))('rpc');var config=require(_0xa826('0x6'));var jayson=require(_0xa826('0x7'));var client=jayson[_0xa826('0x8')][_0xa826('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45154f,_0x4124f5,_0x4339f9){return new BPromise(function(_0x14c2ba,_0xc348d2){return client[_0xa826('0xa')](_0x45154f,_0x4339f9)[_0xa826('0xb')](function(_0x1005e6){logger[_0xa826('0xc')](_0xa826('0xd'),_0x4124f5,_0xa826('0xe'));logger[_0xa826('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x4124f5,_0xa826('0xe'),JSON['stringify'](_0x1005e6));if(_0x1005e6[_0xa826('0x10')]){if(_0x1005e6[_0xa826('0x10')][_0xa826('0x11')]===0x1f4){logger[_0xa826('0x10')](_0xa826('0xd'),_0x4124f5,_0x1005e6[_0xa826('0x10')][_0xa826('0x12')]);return _0xc348d2(_0x1005e6['error'][_0xa826('0x12')]);}logger['error'](_0xa826('0xd'),_0x4124f5,_0x1005e6[_0xa826('0x10')]['message']);return _0x14c2ba(_0x1005e6['error']['message']);}else{logger[_0xa826('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4124f5,'request\x20sent');_0x14c2ba(_0x1005e6[_0xa826('0x13')][_0xa826('0x12')]);}})[_0xa826('0x14')](function(_0x5832b9){logger[_0xa826('0x10')](_0xa826('0xd'),_0x4124f5,_0x5832b9);_0xc348d2(_0x5832b9);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index bd5929f..76367ec 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 _0xbae7=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x314403,_0x475b63){var _0xd652dd=function(_0x119efa){while(--_0x119efa){_0x314403['push'](_0x314403['shift']());}};_0xd652dd(++_0x475b63);}(_0xbae7,0x146));var _0x7bae=function(_0x1fbc06,_0x4cfe7a){_0x1fbc06=_0x1fbc06-0x0;var _0x143c60=_0xbae7[_0x1fbc06];return _0x143c60;};'use strict';var multer=require(_0x7bae('0x0'));var util=require(_0x7bae('0x1'));var path=require(_0x7bae('0x2'));var timeout=require(_0x7bae('0x3'));var express=require(_0x7bae('0x4'));var router=express[_0x7bae('0x5')]();var fs_extra=require(_0x7bae('0x6'));var auth=require(_0x7bae('0x7'));var interaction=require(_0x7bae('0x8'));var config=require(_0x7bae('0x9'));var controller=require(_0x7bae('0xa'));router[_0x7bae('0xb')]('/',auth[_0x7bae('0xc')](),controller[_0x7bae('0xd')]);router[_0x7bae('0xb')](_0x7bae('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x7bae('0xf')]('/',auth[_0x7bae('0xc')](),controller[_0x7bae('0x10')]);router[_0x7bae('0x11')](_0x7bae('0xe'),auth[_0x7bae('0xc')](),controller[_0x7bae('0x12')]);router[_0x7bae('0x13')](_0x7bae('0xe'),auth[_0x7bae('0xc')](),controller[_0x7bae('0x14')]);module[_0x7bae('0x15')]=router; \ No newline at end of file +var _0x7052=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x41ed8b,_0x552f0e){var _0xc0d831=function(_0x3cdcf){while(--_0x3cdcf){_0x41ed8b['push'](_0x41ed8b['shift']());}};_0xc0d831(++_0x552f0e);}(_0x7052,0x162));var _0x2705=function(_0x23f8c8,_0xb536b9){_0x23f8c8=_0x23f8c8-0x0;var _0x3dc718=_0x7052[_0x23f8c8];return _0x3dc718;};'use strict';var multer=require(_0x2705('0x0'));var util=require(_0x2705('0x1'));var path=require('path');var timeout=require(_0x2705('0x2'));var express=require(_0x2705('0x3'));var router=express[_0x2705('0x4')]();var fs_extra=require(_0x2705('0x5'));var auth=require(_0x2705('0x6'));var interaction=require(_0x2705('0x7'));var config=require(_0x2705('0x8'));var controller=require('./pause.controller');router[_0x2705('0x9')]('/',auth[_0x2705('0xa')](),controller[_0x2705('0xb')]);router[_0x2705('0x9')](_0x2705('0xc'),auth['isAuthenticated'](),controller[_0x2705('0xd')]);router[_0x2705('0xe')]('/',auth[_0x2705('0xa')](),controller['create']);router[_0x2705('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x2705('0x10')]);router[_0x2705('0x11')](_0x2705('0xc'),auth[_0x2705('0xa')](),controller['destroy']);module[_0x2705('0x12')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index fe4e70a..f37a578 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 _0xa4f9=['name','sequelize','STRING'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa4f9,0x1c0));var _0x9a4f=function(_0xc0728b,_0x13bc1a){_0xc0728b=_0xc0728b-0x0;var _0x381a97=_0xa4f9[_0xc0728b];return _0x381a97;};'use strict';var Sequelize=require(_0x9a4f('0x0'));module['exports']={'name':{'type':Sequelize[_0x9a4f('0x1')],'unique':_0x9a4f('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9a4f('0x1')]}}; \ No newline at end of file +var _0x5831=['name','STRING','exports'];(function(_0x20aae1,_0x51efd4){var _0x510601=function(_0x20895f){while(--_0x20895f){_0x20aae1['push'](_0x20aae1['shift']());}};_0x510601(++_0x51efd4);}(_0x5831,0x1ac));var _0x1583=function(_0x3f1710,_0x3877a2){_0x3f1710=_0x3f1710-0x0;var _0x528458=_0x5831[_0x3f1710];return _0x528458;};'use strict';var Sequelize=require('sequelize');module[_0x1583('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x1583('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x1583('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 3d80411..79bf01b 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 _0x00b5=['find','destroy','eml-format','zip-dir','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','Pauses','UserProfileResource','sendStatus','name','send','index','map','Pause','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','error'];(function(_0x57d6c3,_0x5ac8b8){var _0x4c101c=function(_0x445ef6){while(--_0x445ef6){_0x57d6c3['push'](_0x57d6c3['shift']());}};_0x4c101c(++_0x5ac8b8);}(_0x00b5,0x19c));var _0x500b=function(_0x488e18,_0x3915d3){_0x488e18=_0x488e18-0x0;var _0x90f9cd=_0x00b5[_0x488e18];return _0x90f9cd;};'use strict';var emlformat=require(_0x500b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x500b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x500b('0x2'));var moment=require(_0x500b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x500b('0x4'));var util=require('util');var path=require(_0x500b('0x5'));var sox=require('sox');var csv=require(_0x500b('0x6'));var ejs=require(_0x500b('0x7'));var fs=require('fs');var fs_extra=require(_0x500b('0x8'));var _=require(_0x500b('0x9'));var squel=require('squel');var crypto=require(_0x500b('0xa'));var jsforce=require(_0x500b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x500b('0x6'));var querystring=require('querystring');var Papa=require(_0x500b('0xc'));var Redis=require(_0x500b('0xd'));var authService=require(_0x500b('0xe'));var qs=require(_0x500b('0xf'));var as=require(_0x500b('0x10'));var hardwareService=require(_0x500b('0x11'));var logger=require(_0x500b('0x12'))(_0x500b('0x13'));var utils=require(_0x500b('0x14'));var config=require(_0x500b('0x15'));var licenseUtil=require(_0x500b('0x16'));var db=require(_0x500b('0x17'))['db'];function respondWithStatusCode(_0x58a557,_0x17f9bc){_0x17f9bc=_0x17f9bc||0xcc;return function(_0x2d0f46){if(_0x2d0f46){return _0x58a557['sendStatus'](_0x17f9bc);}return _0x58a557['status'](_0x17f9bc)[_0x500b('0x18')]();};}function respondWithResult(_0x25348b,_0x3ea262){_0x3ea262=_0x3ea262||0xc8;return function(_0x3f56c0){if(_0x3f56c0){return _0x25348b[_0x500b('0x19')](_0x3ea262)[_0x500b('0x1a')](_0x3f56c0);}};}function respondWithFilteredResult(_0x4ce5c8,_0x498fe8){return function(_0x45622b){if(_0x45622b){var _0x359844=typeof _0x498fe8[_0x500b('0x1b')]==='undefined'&&typeof _0x498fe8[_0x500b('0x1c')]===_0x500b('0x1d');var _0x1f08e7=_0x45622b[_0x500b('0x1e')];var _0x3247b1=_0x359844?0x0:_0x498fe8[_0x500b('0x1b')];var _0x504871=_0x359844?_0x45622b[_0x500b('0x1e')]:_0x498fe8[_0x500b('0x1b')]+_0x498fe8[_0x500b('0x1c')];var _0x4f663;if(_0x504871>=_0x1f08e7){_0x504871=_0x1f08e7;_0x4f663=0xc8;}else{_0x4f663=0xce;}_0x4ce5c8[_0x500b('0x19')](_0x4f663);return _0x4ce5c8[_0x500b('0x1f')](_0x500b('0x20'),_0x3247b1+'-'+_0x504871+'/'+_0x1f08e7)[_0x500b('0x1a')](_0x45622b);}return null;};}function patchUpdates(_0x35a6f4){return function(_0xce9ea1){try{jsonpatch[_0x500b('0x21')](_0xce9ea1,_0x35a6f4,!![]);}catch(_0x3ccf43){return BPromise['reject'](_0x3ccf43);}return _0xce9ea1['save']();};}function saveUpdates(_0x33c87b,_0x4d29ee){return function(_0x4c42e8){if(_0x4c42e8){return _0x4c42e8[_0x500b('0x22')](_0x33c87b)['then'](function(_0x3a3d6a){return _0x3a3d6a;});}return null;};}function removeEntity(_0x44223a,_0x5e4ca9){return function(_0x3e0431){if(_0x3e0431){return _0x3e0431['destroy']()[_0x500b('0x23')](function(){var _0x23f3d9=_0x3e0431['get']({'plain':!![]});var _0x1b127c=_0x500b('0x24');return db[_0x500b('0x25')]['destroy']({'where':{'type':_0x1b127c,'resourceId':_0x23f3d9['id']}})[_0x500b('0x23')](function(){return _0x3e0431;});})['then'](function(){_0x44223a[_0x500b('0x19')](0xcc)[_0x500b('0x18')]();});}};}function handleEntityNotFound(_0x46e8e2,_0x2f5c5d){return function(_0x528a72){if(!_0x528a72){_0x46e8e2[_0x500b('0x26')](0x194);}return _0x528a72;};}function handleError(_0x284fae,_0x26d2a0){_0x26d2a0=_0x26d2a0||0x1f4;return function(_0x298463){logger['error'](_0x298463['stack']);if(_0x298463[_0x500b('0x27')]){delete _0x298463[_0x500b('0x27')];}_0x284fae[_0x500b('0x19')](_0x26d2a0)[_0x500b('0x28')](_0x298463);};}exports[_0x500b('0x29')]=function(_0x2615ae,_0x3ab1c4){var _0x1b0ece={},_0x445491={},_0xa29014={'count':0x0,'rows':[]};var _0x220e05=_[_0x500b('0x2a')](db[_0x500b('0x2b')][_0x500b('0x2c')],function(_0x33cc76){return{'name':_0x33cc76['fieldName'],'type':_0x33cc76[_0x500b('0x2d')][_0x500b('0x2e')]};});_0x445491[_0x500b('0x2f')]=_['map'](_0x220e05,_0x500b('0x27'));_0x445491[_0x500b('0x30')]=_[_0x500b('0x31')](_0x2615ae[_0x500b('0x30')]);_0x445491['filters']=_['intersection'](_0x445491[_0x500b('0x2f')],_0x445491[_0x500b('0x30')]);_0x1b0ece['attributes']=_[_0x500b('0x32')](_0x445491[_0x500b('0x2f')],qs[_0x500b('0x33')](_0x2615ae[_0x500b('0x30')][_0x500b('0x33')]));_0x1b0ece[_0x500b('0x34')]=_0x1b0ece[_0x500b('0x34')][_0x500b('0x35')]?_0x1b0ece[_0x500b('0x34')]:_0x445491[_0x500b('0x2f')];if(!_0x2615ae[_0x500b('0x30')][_0x500b('0x36')](_0x500b('0x37'))){_0x1b0ece[_0x500b('0x1c')]=qs[_0x500b('0x1c')](_0x2615ae['query'][_0x500b('0x1c')]);_0x1b0ece[_0x500b('0x1b')]=qs[_0x500b('0x1b')](_0x2615ae['query']['offset']);}_0x1b0ece['order']=qs[_0x500b('0x38')](_0x2615ae[_0x500b('0x30')][_0x500b('0x38')]);_0x1b0ece[_0x500b('0x39')]=qs[_0x500b('0x3a')](_[_0x500b('0x3b')](_0x2615ae[_0x500b('0x30')],_0x445491[_0x500b('0x3a')]),_0x220e05);if(_0x2615ae[_0x500b('0x30')]['filter']){_0x1b0ece[_0x500b('0x39')]=_['merge'](_0x1b0ece['where'],{'$or':_[_0x500b('0x2a')](_0x220e05,function(_0x2daceb){if(_0x2daceb['type']!=='VIRTUAL'){var _0x3aecd9={};_0x3aecd9[_0x2daceb[_0x500b('0x27')]]={'$like':'%'+_0x2615ae[_0x500b('0x30')][_0x500b('0x3c')]+'%'};return _0x3aecd9;}})});}_0x1b0ece=_[_0x500b('0x3d')]({},_0x1b0ece,_0x2615ae[_0x500b('0x3e')]);var _0x2bd679={'where':_0x1b0ece[_0x500b('0x39')]};return db['Pause'][_0x500b('0x1e')](_0x2bd679)['then'](function(_0x27f6c3){_0xa29014['count']=_0x27f6c3;if(_0x2615ae[_0x500b('0x30')][_0x500b('0x3f')]){_0x1b0ece[_0x500b('0x40')]=[{'all':!![]}];}return db[_0x500b('0x2b')][_0x500b('0x41')](_0x1b0ece);})[_0x500b('0x23')](function(_0x182ac1){_0xa29014[_0x500b('0x42')]=_0x182ac1;return _0xa29014;})[_0x500b('0x23')](respondWithFilteredResult(_0x3ab1c4,_0x1b0ece))[_0x500b('0x43')](handleError(_0x3ab1c4,null));};exports[_0x500b('0x44')]=function(_0x35b244,_0x58f9a1){var _0x51fb19={'raw':!![],'where':{'id':_0x35b244[_0x500b('0x45')]['id']}},_0x2c8c15={};_0x2c8c15[_0x500b('0x2f')]=_[_0x500b('0x31')](db[_0x500b('0x2b')][_0x500b('0x2c')]);_0x2c8c15[_0x500b('0x30')]=_['keys'](_0x35b244[_0x500b('0x30')]);_0x2c8c15[_0x500b('0x3a')]=_['intersection'](_0x2c8c15[_0x500b('0x2f')],_0x2c8c15[_0x500b('0x30')]);_0x51fb19['attributes']=_[_0x500b('0x32')](_0x2c8c15[_0x500b('0x2f')],qs[_0x500b('0x33')](_0x35b244[_0x500b('0x30')][_0x500b('0x33')]));_0x51fb19[_0x500b('0x34')]=_0x51fb19[_0x500b('0x34')][_0x500b('0x35')]?_0x51fb19['attributes']:_0x2c8c15[_0x500b('0x2f')];if(_0x35b244[_0x500b('0x30')][_0x500b('0x3f')]){_0x51fb19['include']=[{'all':!![]}];}_0x51fb19=_[_0x500b('0x3d')]({},_0x51fb19,_0x35b244[_0x500b('0x3e')]);return db[_0x500b('0x2b')]['find'](_0x51fb19)[_0x500b('0x23')](handleEntityNotFound(_0x58f9a1,null))['then'](respondWithResult(_0x58f9a1,null))['catch'](handleError(_0x58f9a1,null));};exports['create']=function(_0x45f9c7,_0x464b5a){return db['Pause']['create'](_0x45f9c7[_0x500b('0x46')],{})[_0x500b('0x23')](function(_0x10e66f){var _0x6fe20a=_0x45f9c7[_0x500b('0x47')][_0x500b('0x48')]({'plain':!![]});if(!_0x6fe20a)throw new Error(_0x500b('0x49'));if(_0x6fe20a[_0x500b('0x4a')]===_0x500b('0x47')){var _0x1c5de9=_0x10e66f[_0x500b('0x48')]({'plain':!![]});var _0x25a57a='Pauses';return db[_0x500b('0x4b')]['find']({'where':{'name':_0x25a57a,'userProfileId':_0x6fe20a[_0x500b('0x4c')]},'raw':!![]})['then'](function(_0x4c6a43){if(_0x4c6a43&&_0x4c6a43[_0x500b('0x4d')]===0x0){return db[_0x500b('0x25')][_0x500b('0x4e')]({'name':_0x1c5de9[_0x500b('0x27')],'resourceId':_0x1c5de9['id'],'type':_0x4c6a43[_0x500b('0x27')],'sectionId':_0x4c6a43['id']},{})[_0x500b('0x23')](function(){return _0x10e66f;});}else{return _0x10e66f;}})[_0x500b('0x43')](function(_0x1c54d7){logger[_0x500b('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c54d7);throw _0x1c54d7;});}return _0x10e66f;})[_0x500b('0x23')](respondWithResult(_0x464b5a,0xc9))['catch'](handleError(_0x464b5a,null));};exports[_0x500b('0x22')]=function(_0xee442d,_0x190a85){if(_0xee442d[_0x500b('0x46')]['id']){delete _0xee442d[_0x500b('0x46')]['id'];}return db[_0x500b('0x2b')][_0x500b('0x50')]({'where':{'id':_0xee442d[_0x500b('0x45')]['id']}})[_0x500b('0x23')](handleEntityNotFound(_0x190a85,null))[_0x500b('0x23')](saveUpdates(_0xee442d[_0x500b('0x46')],null))['then'](respondWithResult(_0x190a85,null))[_0x500b('0x43')](handleError(_0x190a85,null));};exports[_0x500b('0x51')]=function(_0x47ddf2,_0x756f0){return db[_0x500b('0x2b')]['find']({'where':{'id':_0x47ddf2['params']['id']}})[_0x500b('0x23')](handleEntityNotFound(_0x756f0,null))[_0x500b('0x23')](removeEntity(_0x756f0,null))['catch'](handleError(_0x756f0,null));}; \ No newline at end of file +var _0x9d8d=['request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','update','then','get','Pauses','UserProfileResource','destroy','error','name','send','index','Pause','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','length','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','rimraf','zip-dir','fast-json-patch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9d8d,0x192));var _0xd9d8=function(_0x1580f7,_0xf2b31c){_0x1580f7=_0x1580f7-0x0;var _0x2a5b4f=_0x9d8d[_0x1580f7];return _0x2a5b4f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd9d8('0x0'));var zipdir=require(_0xd9d8('0x1'));var jsonpatch=require(_0xd9d8('0x2'));var rp=require(_0xd9d8('0x3'));var moment=require(_0xd9d8('0x4'));var BPromise=require(_0xd9d8('0x5'));var Mustache=require('mustache');var util=require(_0xd9d8('0x6'));var path=require(_0xd9d8('0x7'));var sox=require(_0xd9d8('0x8'));var csv=require(_0xd9d8('0x9'));var ejs=require(_0xd9d8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd9d8('0xb'));var squel=require(_0xd9d8('0xc'));var crypto=require(_0xd9d8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd9d8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd9d8('0xf'));var Papa=require(_0xd9d8('0x10'));var Redis=require(_0xd9d8('0x11'));var authService=require(_0xd9d8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd9d8('0x13'));var hardwareService=require(_0xd9d8('0x14'));var logger=require('../../config/logger')(_0xd9d8('0x15'));var utils=require('../../config/utils');var config=require(_0xd9d8('0x16'));var licenseUtil=require(_0xd9d8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5baed1,_0x12ff0d){_0x12ff0d=_0x12ff0d||0xcc;return function(_0x4bd46a){if(_0x4bd46a){return _0x5baed1[_0xd9d8('0x18')](_0x12ff0d);}return _0x5baed1[_0xd9d8('0x19')](_0x12ff0d)[_0xd9d8('0x1a')]();};}function respondWithResult(_0x146bdd,_0x595e03){_0x595e03=_0x595e03||0xc8;return function(_0x4a8601){if(_0x4a8601){return _0x146bdd['status'](_0x595e03)['json'](_0x4a8601);}};}function respondWithFilteredResult(_0x171b20,_0x444dff){return function(_0x5ba7ae){if(_0x5ba7ae){var _0x54cbe7=typeof _0x444dff['offset']===_0xd9d8('0x1b')&&typeof _0x444dff[_0xd9d8('0x1c')]===_0xd9d8('0x1b');var _0x52c0b3=_0x5ba7ae[_0xd9d8('0x1d')];var _0x12655e=_0x54cbe7?0x0:_0x444dff['offset'];var _0x59ecfc=_0x54cbe7?_0x5ba7ae['count']:_0x444dff[_0xd9d8('0x1e')]+_0x444dff['limit'];var _0x5266e0;if(_0x59ecfc>=_0x52c0b3){_0x59ecfc=_0x52c0b3;_0x5266e0=0xc8;}else{_0x5266e0=0xce;}_0x171b20[_0xd9d8('0x19')](_0x5266e0);return _0x171b20[_0xd9d8('0x1f')](_0xd9d8('0x20'),_0x12655e+'-'+_0x59ecfc+'/'+_0x52c0b3)[_0xd9d8('0x21')](_0x5ba7ae);}return null;};}function patchUpdates(_0x48b014){return function(_0x31e4a5){try{jsonpatch[_0xd9d8('0x22')](_0x31e4a5,_0x48b014,!![]);}catch(_0x14e024){return BPromise['reject'](_0x14e024);}return _0x31e4a5['save']();};}function saveUpdates(_0x116110,_0x525000){return function(_0x563292){if(_0x563292){return _0x563292[_0xd9d8('0x23')](_0x116110)[_0xd9d8('0x24')](function(_0x50ebe7){return _0x50ebe7;});}return null;};}function removeEntity(_0x322f26,_0xc93d1c){return function(_0x5eff97){if(_0x5eff97){return _0x5eff97['destroy']()[_0xd9d8('0x24')](function(){var _0x43273f=_0x5eff97[_0xd9d8('0x25')]({'plain':!![]});var _0x2d8f03=_0xd9d8('0x26');return db[_0xd9d8('0x27')][_0xd9d8('0x28')]({'where':{'type':_0x2d8f03,'resourceId':_0x43273f['id']}})[_0xd9d8('0x24')](function(){return _0x5eff97;});})[_0xd9d8('0x24')](function(){_0x322f26[_0xd9d8('0x19')](0xcc)[_0xd9d8('0x1a')]();});}};}function handleEntityNotFound(_0x46025c,_0xf2e101){return function(_0x449bf7){if(!_0x449bf7){_0x46025c['sendStatus'](0x194);}return _0x449bf7;};}function handleError(_0x1ba0d2,_0x5c1e64){_0x5c1e64=_0x5c1e64||0x1f4;return function(_0x597e83){logger[_0xd9d8('0x29')](_0x597e83['stack']);if(_0x597e83[_0xd9d8('0x2a')]){delete _0x597e83[_0xd9d8('0x2a')];}_0x1ba0d2[_0xd9d8('0x19')](_0x5c1e64)[_0xd9d8('0x2b')](_0x597e83);};}exports[_0xd9d8('0x2c')]=function(_0x6bc7fa,_0x26662f){var _0x58d8c9={},_0x435151={},_0x3f23fe={'count':0x0,'rows':[]};var _0x330571=_['map'](db[_0xd9d8('0x2d')][_0xd9d8('0x2e')],function(_0x2d4179){return{'name':_0x2d4179[_0xd9d8('0x2f')],'type':_0x2d4179[_0xd9d8('0x30')]['key']};});_0x435151[_0xd9d8('0x31')]=_[_0xd9d8('0x32')](_0x330571,'name');_0x435151[_0xd9d8('0x33')]=_['keys'](_0x6bc7fa[_0xd9d8('0x33')]);_0x435151[_0xd9d8('0x34')]=_[_0xd9d8('0x35')](_0x435151[_0xd9d8('0x31')],_0x435151[_0xd9d8('0x33')]);_0x58d8c9['attributes']=_[_0xd9d8('0x35')](_0x435151['model'],qs[_0xd9d8('0x36')](_0x6bc7fa[_0xd9d8('0x33')][_0xd9d8('0x36')]));_0x58d8c9['attributes']=_0x58d8c9[_0xd9d8('0x37')]['length']?_0x58d8c9[_0xd9d8('0x37')]:_0x435151[_0xd9d8('0x31')];if(!_0x6bc7fa[_0xd9d8('0x33')][_0xd9d8('0x38')](_0xd9d8('0x39'))){_0x58d8c9[_0xd9d8('0x1c')]=qs[_0xd9d8('0x1c')](_0x6bc7fa[_0xd9d8('0x33')]['limit']);_0x58d8c9[_0xd9d8('0x1e')]=qs[_0xd9d8('0x1e')](_0x6bc7fa[_0xd9d8('0x33')][_0xd9d8('0x1e')]);}_0x58d8c9[_0xd9d8('0x3a')]=qs[_0xd9d8('0x3b')](_0x6bc7fa[_0xd9d8('0x33')][_0xd9d8('0x3b')]);_0x58d8c9['where']=qs['filters'](_[_0xd9d8('0x3c')](_0x6bc7fa[_0xd9d8('0x33')],_0x435151[_0xd9d8('0x34')]),_0x330571);if(_0x6bc7fa['query']['filter']){_0x58d8c9[_0xd9d8('0x3d')]=_[_0xd9d8('0x3e')](_0x58d8c9[_0xd9d8('0x3d')],{'$or':_[_0xd9d8('0x32')](_0x330571,function(_0x2a8d10){if(_0x2a8d10[_0xd9d8('0x30')]!==_0xd9d8('0x3f')){var _0x152bcd={};_0x152bcd[_0x2a8d10[_0xd9d8('0x2a')]]={'$like':'%'+_0x6bc7fa[_0xd9d8('0x33')][_0xd9d8('0x40')]+'%'};return _0x152bcd;}})});}_0x58d8c9=_['merge']({},_0x58d8c9,_0x6bc7fa['options']);var _0xdee8b9={'where':_0x58d8c9[_0xd9d8('0x3d')]};return db['Pause'][_0xd9d8('0x1d')](_0xdee8b9)['then'](function(_0x5cbb45){_0x3f23fe[_0xd9d8('0x1d')]=_0x5cbb45;if(_0x6bc7fa[_0xd9d8('0x33')][_0xd9d8('0x41')]){_0x58d8c9[_0xd9d8('0x42')]=[{'all':!![]}];}return db[_0xd9d8('0x2d')]['findAll'](_0x58d8c9);})['then'](function(_0x14c2be){_0x3f23fe[_0xd9d8('0x43')]=_0x14c2be;return _0x3f23fe;})[_0xd9d8('0x24')](respondWithFilteredResult(_0x26662f,_0x58d8c9))[_0xd9d8('0x44')](handleError(_0x26662f,null));};exports[_0xd9d8('0x45')]=function(_0x21db47,_0x549b98){var _0x20cd0f={'raw':!![],'where':{'id':_0x21db47[_0xd9d8('0x46')]['id']}},_0x150dcc={};_0x150dcc['model']=_['keys'](db[_0xd9d8('0x2d')]['rawAttributes']);_0x150dcc[_0xd9d8('0x33')]=_['keys'](_0x21db47['query']);_0x150dcc['filters']=_[_0xd9d8('0x35')](_0x150dcc[_0xd9d8('0x31')],_0x150dcc[_0xd9d8('0x33')]);_0x20cd0f[_0xd9d8('0x37')]=_[_0xd9d8('0x35')](_0x150dcc[_0xd9d8('0x31')],qs['fields'](_0x21db47[_0xd9d8('0x33')]['fields']));_0x20cd0f[_0xd9d8('0x37')]=_0x20cd0f['attributes'][_0xd9d8('0x47')]?_0x20cd0f[_0xd9d8('0x37')]:_0x150dcc[_0xd9d8('0x31')];if(_0x21db47[_0xd9d8('0x33')]['includeAll']){_0x20cd0f[_0xd9d8('0x42')]=[{'all':!![]}];}_0x20cd0f=_[_0xd9d8('0x3e')]({},_0x20cd0f,_0x21db47[_0xd9d8('0x48')]);return db['Pause'][_0xd9d8('0x49')](_0x20cd0f)['then'](handleEntityNotFound(_0x549b98,null))[_0xd9d8('0x24')](respondWithResult(_0x549b98,null))[_0xd9d8('0x44')](handleError(_0x549b98,null));};exports['create']=function(_0x4d070c,_0x5b78c7){return db[_0xd9d8('0x2d')][_0xd9d8('0x4a')](_0x4d070c[_0xd9d8('0x4b')],{})[_0xd9d8('0x24')](function(_0xe52f0f){var _0x284476=_0x4d070c[_0xd9d8('0x4c')][_0xd9d8('0x25')]({'plain':!![]});if(!_0x284476)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x284476[_0xd9d8('0x4d')]==='user'){var _0x38b622=_0xe52f0f['get']({'plain':!![]});var _0x4e5c52=_0xd9d8('0x26');return db[_0xd9d8('0x4e')][_0xd9d8('0x49')]({'where':{'name':_0x4e5c52,'userProfileId':_0x284476[_0xd9d8('0x4f')]},'raw':!![]})[_0xd9d8('0x24')](function(_0x164b13){if(_0x164b13&&_0x164b13[_0xd9d8('0x50')]===0x0){return db[_0xd9d8('0x27')]['create']({'name':_0x38b622[_0xd9d8('0x2a')],'resourceId':_0x38b622['id'],'type':_0x164b13[_0xd9d8('0x2a')],'sectionId':_0x164b13['id']},{})[_0xd9d8('0x24')](function(){return _0xe52f0f;});}else{return _0xe52f0f;}})[_0xd9d8('0x44')](function(_0x1ebd7b){logger[_0xd9d8('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ebd7b);throw _0x1ebd7b;});}return _0xe52f0f;})[_0xd9d8('0x24')](respondWithResult(_0x5b78c7,0xc9))[_0xd9d8('0x44')](handleError(_0x5b78c7,null));};exports[_0xd9d8('0x23')]=function(_0x3e7855,_0x5455f8){if(_0x3e7855[_0xd9d8('0x4b')]['id']){delete _0x3e7855[_0xd9d8('0x4b')]['id'];}return db['Pause'][_0xd9d8('0x49')]({'where':{'id':_0x3e7855['params']['id']}})[_0xd9d8('0x24')](handleEntityNotFound(_0x5455f8,null))[_0xd9d8('0x24')](saveUpdates(_0x3e7855[_0xd9d8('0x4b')],null))[_0xd9d8('0x24')](respondWithResult(_0x5455f8,null))[_0xd9d8('0x44')](handleError(_0x5455f8,null));};exports['destroy']=function(_0x47c06f,_0xe59e99){return db[_0xd9d8('0x2d')][_0xd9d8('0x49')]({'where':{'id':_0x47c06f[_0xd9d8('0x46')]['id']}})[_0xd9d8('0x24')](handleEntityNotFound(_0xe59e99,null))[_0xd9d8('0x24')](removeEntity(_0xe59e99,null))['catch'](handleError(_0xe59e99,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 5cc6834..2cbcba5 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 _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x10aff3,_0x323205){var _0x377148=function(_0x16f24e){while(--_0x16f24e){_0x10aff3['push'](_0x10aff3['shift']());}};_0x377148(++_0x323205);}(_0x814b,0x1a2));var _0xb814=function(_0x407461,_0x1cf61c){_0x407461=_0x407461-0x0;var _0x2b3ffa=_0x814b[_0x407461];return _0x2b3ffa;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x3219e9,_0x31aa4e){var _0x1fbe22=function(_0x59d5aa){while(--_0x59d5aa){_0x3219e9['push'](_0x3219e9['shift']());}};_0x1fbe22(++_0x31aa4e);}(_0x8ef6,0xf2));var _0x68ef=function(_0x5c4d8b,_0x199012){_0x5c4d8b=_0x5c4d8b-0x0;var _0x52ff7a=_0x8ef6[_0x5c4d8b];return _0x52ff7a;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 7ef2087..f1284da 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(_0x59d530,_0x51f665){var _0x35fd0b=function(_0x1bffcc){while(--_0x1bffcc){_0x59d530['push'](_0x59d530['shift']());}};_0x35fd0b(++_0x51f665);}(_0xb10b,0x12a));var _0xbb10=function(_0x45c569,_0x255cd0){_0x45c569=_0x45c569-0x0;var _0x1cc195=_0xb10b[_0x45c569];return _0x1cc195;};'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(_0x22f91f,_0x43dfc9){var _0xd1a8e=function(_0x4ba4c5){while(--_0x4ba4c5){_0x22f91f['push'](_0x22f91f['shift']());}};_0xd1a8e(++_0x43dfc9);}(_0x7a54,0x106));var _0x47a5=function(_0x54011d,_0x518be8){_0x54011d=_0x54011d-0x0;var _0x32659e=_0x7a54[_0x54011d];return _0x32659e;};'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 cce0876..feb8adc 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 _0xa37e=['../../config/environment','./plugin.controller','get','/:id','isAuthenticated','show','/:id/download','download','join','server/files/plugins','originalname','format','basename','extname','now','post','upload','/webhook','webhookPost','delete','exports','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x302998,_0x3cc0e2){var _0x7bce0c=function(_0x3259f5){while(--_0x3259f5){_0x302998['push'](_0x302998['shift']());}};_0x7bce0c(++_0x3cc0e2);}(_0xa37e,0x97));var _0xea37=function(_0x1f9420,_0x30cc13){_0x1f9420=_0x1f9420-0x0;var _0x3001de=_0xa37e[_0x1f9420];return _0x3001de;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xea37('0x0'));var timeout=require(_0xea37('0x1'));var express=require(_0xea37('0x2'));var router=express[_0xea37('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xea37('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xea37('0x5'));var controller=require(_0xea37('0x6'));router[_0xea37('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xea37('0x7')]('/webhook',controller['webhookGet']);router[_0xea37('0x7')](_0xea37('0x8'),auth[_0xea37('0x9')](),controller[_0xea37('0xa')]);router['get'](_0xea37('0xb'),auth[_0xea37('0x9')](),controller[_0xea37('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5060cd,_0x9a39cd,_0x117ce1){_0x117ce1(null,path[_0xea37('0xd')](config['root'],_0xea37('0xe')));},'filename':function(_0x2a0460,_0x2a2bcd,_0x589a61){_0x2a2bcd[_0xea37('0xf')]=_0x2a2bcd[_0xea37('0xf')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x589a61(null,util[_0xea37('0x10')]('%s-%s%s',path[_0xea37('0x11')](_0x2a2bcd['originalname'],path[_0xea37('0x12')](_0x2a2bcd[_0xea37('0xf')])),Date[_0xea37('0x13')](),path[_0xea37('0x12')](_0x2a2bcd['originalname'])));}})});router[_0xea37('0x14')]('/',upload['single']('file'),controller[_0xea37('0x15')]);router['post'](_0xea37('0x16'),controller[_0xea37('0x17')]);router['put'](_0xea37('0x8'),auth[_0xea37('0x9')](),controller['update']);router[_0xea37('0x18')](_0xea37('0x8'),auth[_0xea37('0x9')](),controller[_0xea37('0x18')]);module[_0xea37('0x19')]=router; \ No newline at end of file +var _0x207c=['file','upload','post','webhookPost','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','/webhook','/:id','isAuthenticated','/:id/download','download','diskStorage','root','originalname','replace','format','%s-%s%s','extname','now','single'];(function(_0x4534f7,_0x4324d0){var _0x26d3c1=function(_0x3c20ee){while(--_0x3c20ee){_0x4534f7['push'](_0x4534f7['shift']());}};_0x26d3c1(++_0x4324d0);}(_0x207c,0x1e8));var _0xc207=function(_0x5d1df9,_0x4a95bf){_0x5d1df9=_0x5d1df9-0x0;var _0x5d4feb=_0x207c[_0x5d1df9];return _0x5d4feb;};'use strict';var multer=require('multer');var util=require(_0xc207('0x0'));var path=require(_0xc207('0x1'));var timeout=require(_0xc207('0x2'));var express=require(_0xc207('0x3'));var router=express[_0xc207('0x4')]();var fs_extra=require(_0xc207('0x5'));var auth=require(_0xc207('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc207('0x7'));var controller=require('./plugin.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc207('0x8')]);router[_0xc207('0x9')](_0xc207('0xa'),controller['webhookGet']);router[_0xc207('0x9')](_0xc207('0xb'),auth[_0xc207('0xc')](),controller['show']);router[_0xc207('0x9')](_0xc207('0xd'),auth[_0xc207('0xc')](),controller[_0xc207('0xe')]);var upload=multer({'storage':multer[_0xc207('0xf')]({'destination':function(_0x347549,_0x487d95,_0x574425){_0x574425(null,path['join'](config[_0xc207('0x10')],'server/files/plugins'));},'filename':function(_0x2741f3,_0x2782ce,_0x59d401){_0x2782ce[_0xc207('0x11')]=_0x2782ce[_0xc207('0x11')][_0xc207('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59d401(null,util[_0xc207('0x13')](_0xc207('0x14'),path['basename'](_0x2782ce[_0xc207('0x11')],path[_0xc207('0x15')](_0x2782ce[_0xc207('0x11')])),Date[_0xc207('0x16')](),path['extname'](_0x2782ce['originalname'])));}})});router['post']('/',upload[_0xc207('0x17')](_0xc207('0x18')),controller[_0xc207('0x19')]);router[_0xc207('0x1a')]('/webhook',controller[_0xc207('0x1b')]);router[_0xc207('0x1c')](_0xc207('0xb'),auth['isAuthenticated'](),controller[_0xc207('0x1d')]);router['delete'](_0xc207('0xb'),auth[_0xc207('0xc')](),controller[_0xc207('0x1e')]);module[_0xc207('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 1295b0f..c9a5e43 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 _0xb665=['STRING','ENUM','script','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports'];(function(_0x1a3a22,_0x3f5b4c){var _0x40b037=function(_0x3797f3){while(--_0x3797f3){_0x1a3a22['push'](_0x1a3a22['shift']());}};_0x40b037(++_0x3f5b4c);}(_0xb665,0x177));var _0x5b66=function(_0x1be5aa,_0x42fefb){_0x1be5aa=_0x1be5aa-0x0;var _0x8848c1=_0xb665[_0x1be5aa];return _0x8848c1;};'use strict';var Sequelize=require(_0x5b66('0x0'));module[_0x5b66('0x1')]={'name':{'type':Sequelize[_0x5b66('0x2')]},'type':{'type':Sequelize[_0x5b66('0x3')]('html',_0x5b66('0x4'))},'description':{'type':Sequelize[_0x5b66('0x5')]},'version':{'type':Sequelize[_0x5b66('0x5')]},'path':{'type':Sequelize[_0x5b66('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x5b66('0x6')],'defaultValue':0x0,'comment':_0x5b66('0x7')},'sidebar':{'type':Sequelize[_0x5b66('0x3')](_0x5b66('0x8'),_0x5b66('0x9'),_0x5b66('0xa'),_0x5b66('0xb')),'defaultValue':'always','comment':_0x5b66('0xc')},'icon':{'type':Sequelize[_0x5b66('0x2')]},'adminUrl':{'type':Sequelize[_0x5b66('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x5b66('0x2')]},'scriptPath':{'type':Sequelize[_0x5b66('0x2')]}}; \ No newline at end of file +var _0xea8a=['STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports'];(function(_0x4a423e,_0x59ba7b){var _0x4ad91f=function(_0x55e261){while(--_0x55e261){_0x4a423e['push'](_0x4a423e['shift']());}};_0x4ad91f(++_0x59ba7b);}(_0xea8a,0x16a));var _0xaea8=function(_0x8c8221,_0x317726){_0x8c8221=_0x8c8221-0x0;var _0x3da609=_0xea8a[_0x8c8221];return _0x3da609;};'use strict';var Sequelize=require(_0xaea8('0x0'));module[_0xaea8('0x1')]={'name':{'type':Sequelize[_0xaea8('0x2')]},'type':{'type':Sequelize[_0xaea8('0x3')](_0xaea8('0x4'),_0xaea8('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xaea8('0x6')]},'path':{'type':Sequelize[_0xaea8('0x2')],'comment':_0xaea8('0x7')},'active':{'type':Sequelize[_0xaea8('0x8')],'defaultValue':0x0,'comment':_0xaea8('0x9')},'sidebar':{'type':Sequelize[_0xaea8('0x3')]('adminOnly','agentOnly',_0xaea8('0xa'),_0xaea8('0xb')),'defaultValue':_0xaea8('0xa'),'comment':_0xaea8('0xc')},'icon':{'type':Sequelize[_0xaea8('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xaea8('0x2')]},'scriptName':{'type':Sequelize[_0xaea8('0x2')]},'scriptPath':{'type':Sequelize[_0xaea8('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 54f64d8..04e414b 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 _0xf7d9=['query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','find','download','path','join','root','server/files/plugins','format','%s.zip','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','**/*','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','length','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','update','destroy','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','set','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','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/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','limit','undefined','count','offset','reject','then','get','Plugins','UserProfileResource','end','error','stack','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','name'];(function(_0x5ca7d,_0x3423dc){var _0x50b318=function(_0x2e70f4){while(--_0x2e70f4){_0x5ca7d['push'](_0x5ca7d['shift']());}};_0x50b318(++_0x3423dc);}(_0xf7d9,0x119));var _0x9f7d=function(_0x475e2c,_0x3edf91){_0x475e2c=_0x475e2c-0x0;var _0x387a5a=_0xf7d9[_0x475e2c];return _0x387a5a;};'use strict';var emlformat=require(_0x9f7d('0x0'));var rimraf=require(_0x9f7d('0x1'));var zipdir=require(_0x9f7d('0x2'));var jsonpatch=require(_0x9f7d('0x3'));var rp=require(_0x9f7d('0x4'));var moment=require(_0x9f7d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9f7d('0x6'));var util=require(_0x9f7d('0x7'));var path=require('path');var sox=require(_0x9f7d('0x8'));var csv=require(_0x9f7d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f7d('0xa'));var _=require(_0x9f7d('0xb'));var squel=require(_0x9f7d('0xc'));var crypto=require(_0x9f7d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9f7d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9f7d('0xf'));var Papa=require(_0x9f7d('0x10'));var extract=require('extract-zip');var rimraf=require(_0x9f7d('0x1'));var archiver=require('archiver');var Redis=require(_0x9f7d('0x11'));var authService=require(_0x9f7d('0x12'));var qs=require(_0x9f7d('0x13'));var as=require(_0x9f7d('0x14'));var hardwareService=require(_0x9f7d('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9f7d('0x16'));var licenseUtil=require(_0x9f7d('0x17'));var db=require(_0x9f7d('0x18'))['db'];config[_0x9f7d('0x19')]=_[_0x9f7d('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9f7d('0x1b'))(new Redis(config[_0x9f7d('0x19')]));require(_0x9f7d('0x1c'))[_0x9f7d('0x1d')](socket);function respondWithStatusCode(_0x42aa8c,_0x48d789){_0x48d789=_0x48d789||0xcc;return function(_0x5a9cd1){if(_0x5a9cd1){return _0x42aa8c[_0x9f7d('0x1e')](_0x48d789);}return _0x42aa8c[_0x9f7d('0x1f')](_0x48d789)['end']();};}function respondWithResult(_0x472dc6,_0x2c20c5){_0x2c20c5=_0x2c20c5||0xc8;return function(_0x346d5e){if(_0x346d5e){return _0x472dc6[_0x9f7d('0x1f')](_0x2c20c5)[_0x9f7d('0x20')](_0x346d5e);}};}function respondWithFilteredResult(_0x3f5ad0,_0x1e0ecb){return function(_0x1e98d4){if(_0x1e98d4){var _0x47b26a=typeof _0x1e0ecb['offset']==='undefined'&&typeof _0x1e0ecb[_0x9f7d('0x21')]===_0x9f7d('0x22');var _0x44497f=_0x1e98d4[_0x9f7d('0x23')];var _0x5b53fa=_0x47b26a?0x0:_0x1e0ecb[_0x9f7d('0x24')];var _0x12445d=_0x47b26a?_0x1e98d4[_0x9f7d('0x23')]:_0x1e0ecb[_0x9f7d('0x24')]+_0x1e0ecb['limit'];var _0x1b3bba;if(_0x12445d>=_0x44497f){_0x12445d=_0x44497f;_0x1b3bba=0xc8;}else{_0x1b3bba=0xce;}_0x3f5ad0[_0x9f7d('0x1f')](_0x1b3bba);return _0x3f5ad0['set']('Content-Range',_0x5b53fa+'-'+_0x12445d+'/'+_0x44497f)['json'](_0x1e98d4);}return null;};}function patchUpdates(_0x535951){return function(_0x2c257d){try{jsonpatch['apply'](_0x2c257d,_0x535951,!![]);}catch(_0x1cb7e9){return BPromise[_0x9f7d('0x25')](_0x1cb7e9);}return _0x2c257d['save']();};}function saveUpdates(_0x380865,_0x49539f){return function(_0xcc9da7){if(_0xcc9da7){return _0xcc9da7['update'](_0x380865)[_0x9f7d('0x26')](function(_0x186ef7){return _0x186ef7;});}return null;};}function removeEntity(_0x9ea6d0,_0x20f010){return function(_0xec4b3e){if(_0xec4b3e){return _0xec4b3e['destroy']()[_0x9f7d('0x26')](function(){var _0x7ad745=_0xec4b3e[_0x9f7d('0x27')]({'plain':!![]});var _0x5f2fcf=_0x9f7d('0x28');return db[_0x9f7d('0x29')]['destroy']({'where':{'type':_0x5f2fcf,'resourceId':_0x7ad745['id']}})[_0x9f7d('0x26')](function(){return _0xec4b3e;});})[_0x9f7d('0x26')](function(){_0x9ea6d0['status'](0xcc)[_0x9f7d('0x2a')]();});}};}function handleEntityNotFound(_0x38426c,_0x5ee1da){return function(_0x215dfc){if(!_0x215dfc){_0x38426c[_0x9f7d('0x1e')](0x194);}return _0x215dfc;};}function handleError(_0x4675fb,_0xa70ae3){_0xa70ae3=_0xa70ae3||0x1f4;return function(_0x25a1f2){logger[_0x9f7d('0x2b')](_0x25a1f2[_0x9f7d('0x2c')]);if(_0x25a1f2['name']){delete _0x25a1f2['name'];}_0x4675fb[_0x9f7d('0x1f')](_0xa70ae3)[_0x9f7d('0x2d')](_0x25a1f2);};}exports[_0x9f7d('0x2e')]=function(_0x4470f3,_0x173f90){var _0x124b9c={},_0x391b46={},_0x1dd4a8={'count':0x0,'rows':[]};var _0x1f1294=_[_0x9f7d('0x2f')](db[_0x9f7d('0x30')][_0x9f7d('0x31')],function(_0x1d0406){return{'name':_0x1d0406[_0x9f7d('0x32')],'type':_0x1d0406[_0x9f7d('0x33')][_0x9f7d('0x34')]};});_0x391b46[_0x9f7d('0x35')]=_[_0x9f7d('0x2f')](_0x1f1294,_0x9f7d('0x36'));_0x391b46[_0x9f7d('0x37')]=_[_0x9f7d('0x38')](_0x4470f3[_0x9f7d('0x37')]);_0x391b46[_0x9f7d('0x39')]=_[_0x9f7d('0x3a')](_0x391b46['model'],_0x391b46[_0x9f7d('0x37')]);_0x124b9c[_0x9f7d('0x3b')]=_[_0x9f7d('0x3a')](_0x391b46[_0x9f7d('0x35')],qs[_0x9f7d('0x3c')](_0x4470f3[_0x9f7d('0x37')][_0x9f7d('0x3c')]));_0x124b9c[_0x9f7d('0x3b')]=_0x124b9c[_0x9f7d('0x3b')]['length']?_0x124b9c['attributes']:_0x391b46[_0x9f7d('0x35')];if(!_0x4470f3[_0x9f7d('0x37')][_0x9f7d('0x3d')](_0x9f7d('0x3e'))){_0x124b9c[_0x9f7d('0x21')]=qs[_0x9f7d('0x21')](_0x4470f3[_0x9f7d('0x37')][_0x9f7d('0x21')]);_0x124b9c['offset']=qs[_0x9f7d('0x24')](_0x4470f3[_0x9f7d('0x37')][_0x9f7d('0x24')]);}_0x124b9c['order']=qs[_0x9f7d('0x3f')](_0x4470f3[_0x9f7d('0x37')][_0x9f7d('0x3f')]);_0x124b9c[_0x9f7d('0x40')]=qs[_0x9f7d('0x39')](_['pick'](_0x4470f3[_0x9f7d('0x37')],_0x391b46[_0x9f7d('0x39')]),_0x1f1294);if(_0x4470f3['query'][_0x9f7d('0x41')]){_0x124b9c['where']=_[_0x9f7d('0x42')](_0x124b9c[_0x9f7d('0x40')],{'$or':_[_0x9f7d('0x2f')](_0x1f1294,function(_0x4af5ee){if(_0x4af5ee[_0x9f7d('0x33')]!=='VIRTUAL'){var _0x84a98={};_0x84a98[_0x4af5ee[_0x9f7d('0x36')]]={'$like':'%'+_0x4470f3[_0x9f7d('0x37')][_0x9f7d('0x41')]+'%'};return _0x84a98;}})});}_0x124b9c=_[_0x9f7d('0x42')]({},_0x124b9c,_0x4470f3[_0x9f7d('0x43')]);var _0x5eebc5={'where':_0x124b9c[_0x9f7d('0x40')]};return db[_0x9f7d('0x30')][_0x9f7d('0x23')](_0x5eebc5)['then'](function(_0x512e10){_0x1dd4a8['count']=_0x512e10;if(_0x4470f3[_0x9f7d('0x37')][_0x9f7d('0x44')]){_0x124b9c[_0x9f7d('0x45')]=[{'all':!![]}];}return db[_0x9f7d('0x30')]['findAll'](_0x124b9c);})[_0x9f7d('0x26')](function(_0x3f7ef9){_0x1dd4a8[_0x9f7d('0x46')]=_0x3f7ef9;return _0x1dd4a8;})[_0x9f7d('0x26')](respondWithFilteredResult(_0x173f90,_0x124b9c))[_0x9f7d('0x47')](handleError(_0x173f90,null));};exports[_0x9f7d('0x48')]=function(_0x192b44,_0xec921e){var _0x4612a9={'raw':!![],'where':{'id':_0x192b44[_0x9f7d('0x49')]['id']}},_0xe549fc={};_0xe549fc['model']=_[_0x9f7d('0x38')](db[_0x9f7d('0x30')]['rawAttributes']);_0xe549fc['query']=_['keys'](_0x192b44[_0x9f7d('0x37')]);_0xe549fc[_0x9f7d('0x39')]=_[_0x9f7d('0x3a')](_0xe549fc['model'],_0xe549fc[_0x9f7d('0x37')]);_0x4612a9[_0x9f7d('0x3b')]=_['intersection'](_0xe549fc['model'],qs[_0x9f7d('0x3c')](_0x192b44[_0x9f7d('0x37')][_0x9f7d('0x3c')]));_0x4612a9[_0x9f7d('0x3b')]=_0x4612a9[_0x9f7d('0x3b')]['length']?_0x4612a9[_0x9f7d('0x3b')]:_0xe549fc[_0x9f7d('0x35')];if(_0x192b44[_0x9f7d('0x37')]['includeAll']){_0x4612a9['include']=[{'all':!![]}];}_0x4612a9=_[_0x9f7d('0x42')]({},_0x4612a9,_0x192b44[_0x9f7d('0x43')]);return db['Plugin'][_0x9f7d('0x4a')](_0x4612a9)[_0x9f7d('0x26')](handleEntityNotFound(_0xec921e,null))[_0x9f7d('0x26')](respondWithResult(_0xec921e,null))['catch'](handleError(_0xec921e,null));};exports[_0x9f7d('0x4b')]=function(_0x37c959,_0x271e47,_0x813925){return db['Plugin']['find']({'where':{'id':_0x37c959['params']['id']},'attributes':[_0x9f7d('0x36'),_0x9f7d('0x4c')],'raw':!![]})[_0x9f7d('0x26')](handleEntityNotFound(_0x271e47,null))[_0x9f7d('0x26')](function(_0xebdbb){if(_0xebdbb){var _0x5384c9=path[_0x9f7d('0x4d')](config[_0x9f7d('0x4e')],_0x9f7d('0x4f'),util[_0x9f7d('0x50')](_0x9f7d('0x51'),path['basename'](_0xebdbb[_0x9f7d('0x4c')])));var _0x3f68aa=fs[_0x9f7d('0x52')](_0x5384c9);var _0x3df5d6=archiver('zip',{'zlib':{'level':0x9}});_0x3df5d6['on'](_0x9f7d('0x53'),function(_0x11471b){if(_0x11471b[_0x9f7d('0x54')]===_0x9f7d('0x55')){logger[_0x9f7d('0x2b')](_0x11471b);}else{throw new db[(_0x9f7d('0x56'))][(_0x9f7d('0x57'))](_0x9f7d('0x58'));}});_0x3df5d6['on'](_0x9f7d('0x2b'),function(_0x374d60){throw new db['Sequelize'][(_0x9f7d('0x57'))](_0x9f7d('0x58'));});_0x3df5d6['pipe'](_0x3f68aa);_0x3df5d6['glob'](_0x9f7d('0x59'),{'cwd':path[_0x9f7d('0x4d')](config[_0x9f7d('0x4e')],_0x9f7d('0x4f'),path[_0x9f7d('0x5a')](_0xebdbb[_0x9f7d('0x4c')])),'ignore':[path['join'](path[_0x9f7d('0x5b')](_0xebdbb[_0x9f7d('0x4c')]),_0x9f7d('0x5c')),path[_0x9f7d('0x4d')](path[_0x9f7d('0x5b')](_0xebdbb[_0x9f7d('0x4c')]),_0x9f7d('0x5d'))],'nodir':!![]})[_0x9f7d('0x5e')]();_0x3f68aa['on'](_0x9f7d('0x5f'),function(){if(!fs[_0x9f7d('0x60')](_0x5384c9)){throw new db[(_0x9f7d('0x56'))]['Error'](_0x9f7d('0x61'));}return _0x271e47[_0x9f7d('0x4b')](_0x5384c9,util['format'](_0x9f7d('0x51'),path[_0x9f7d('0x5b')](_0xebdbb[_0x9f7d('0x4c')])),function(_0x2dbea5){if(_0x2dbea5){throw new db[(_0x9f7d('0x56'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x9f7d('0x62')](_0x5384c9);logger[_0x9f7d('0x63')]('Download\x20completed');logger[_0x9f7d('0x63')](_0x9f7d('0x64'));});});}return null;})[_0x9f7d('0x47')](handleError(_0x271e47,null));};exports[_0x9f7d('0x65')]=function(_0x3899df,_0x185881,_0xa8865e){var _0x3c01af=path['basename'](_0x3899df[_0x9f7d('0x66')][_0x9f7d('0x67')],path[_0x9f7d('0x68')](_0x3899df[_0x9f7d('0x66')][_0x9f7d('0x67')]));var _0x3c2604=path[_0x9f7d('0x4d')](config[_0x9f7d('0x4e')],_0x9f7d('0x4f'),_0x3899df[_0x9f7d('0x66')][_0x9f7d('0x67')]);var _0x2e0fc2=path[_0x9f7d('0x4d')](config[_0x9f7d('0x4e')],_0x9f7d('0x4f'),_0x3c01af);logger[_0x9f7d('0x63')](_0x9f7d('0x69'),_0x3c2604);logger['info'](_0x9f7d('0x6a'),_0x2e0fc2);try{fs[_0x9f7d('0x6b')](_0x3c2604,parseInt(_0x9f7d('0x6c'),0x8));extract(_0x3c2604,{'dir':_0x2e0fc2},function(_0x25efc4){if(_0x25efc4){logger[_0x9f7d('0x2b')](_0x25efc4);handleError(_0x25efc4,!![]);};var _0x2eb4dd=fs[_0x9f7d('0x6d')](_0x2e0fc2);if(_0x2eb4dd[_0x9f7d('0x6e')]>0x1){removeReferences(_0x3c2604,_0x2e0fc2);logger[_0x9f7d('0x2b')](_0x9f7d('0x6f'));return _0xa8865e(new Error(_0x9f7d('0x6f')));}var _0x471186=fs[_0x9f7d('0x70')](path['join'](_0x2e0fc2,_0x2eb4dd[0x0]));if(_0x471186[_0x9f7d('0x71')]()){removeReferences(_0x3c2604,_0x2e0fc2);logger[_0x9f7d('0x2b')]('Invalid\x20plugin\x20structure');return _0xa8865e(new Error(_0x9f7d('0x6f')));}if(_0x471186[_0x9f7d('0x72')]()){var _0x7e5a87=fs[_0x9f7d('0x6d')](path[_0x9f7d('0x4d')](_0x2e0fc2,_0x2eb4dd[0x0]));if(_0x7e5a87[_0x9f7d('0x6e')]===0x0){removeReferences(_0x3c2604,_0x2e0fc2);logger['error']('Invalid\x20plugin\x20structure');return _0xa8865e(new Error(_0x9f7d('0x6f')));}var _0x545feb=_0x7e5a87['some'](function(_0x4c3ca3){return _0x4c3ca3===_0x9f7d('0x73');});if(!_0x545feb){return _0xa8865e(new Error('Plugin\x20manifest\x20missing'));}var _0x380471=fs[_0x9f7d('0x74')](path[_0x9f7d('0x4d')](_0x2e0fc2,_0x2eb4dd[0x0],_0x9f7d('0x73')));var _0xcf7a86=JSON[_0x9f7d('0x75')](_0x380471);if(_0x9f7d('0x22')==typeof _0xcf7a86['name']){return _0xa8865e(new Error(_0x9f7d('0x76')));}if('undefined'==typeof _0xcf7a86[_0x9f7d('0x33')]){return _0xa8865e(new Error(_0x9f7d('0x77')));}if(_0x9f7d('0x22')==typeof _0xcf7a86[_0x9f7d('0x78')]){return _0xa8865e(new Error(_0x9f7d('0x79')));}if('undefined'==typeof _0xcf7a86['parameters']){return _0xa8865e(new Error(_0x9f7d('0x7a')));}if(_0xcf7a86[_0x9f7d('0x33')]===_0x9f7d('0x7b')){if('undefined'==typeof _0xcf7a86[_0x9f7d('0x7c')][_0x9f7d('0x7d')]){return _0xa8865e(new Error(_0x9f7d('0x7e')));}if(_0x9f7d('0x22')==typeof _0xcf7a86[_0x9f7d('0x7c')][_0x9f7d('0x7d')][_0x9f7d('0x7f')]&&_0x9f7d('0x22')==typeof _0xcf7a86[_0x9f7d('0x7c')]['views'][_0x9f7d('0x80')]){return _0xa8865e(new Error(_0x9f7d('0x81')));}}else if(_0xcf7a86[_0x9f7d('0x33')]===_0x9f7d('0x82')){if('undefined'==typeof _0xcf7a86[_0x9f7d('0x7c')][_0x9f7d('0x83')]){return _0xa8865e(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x9f7d('0x22')==typeof _0xcf7a86[_0x9f7d('0x7c')]['scriptPath']){return _0xa8865e(new Error(_0x9f7d('0x84')));}}else{return _0xa8865e(new Error(_0x9f7d('0x85')));}var _0x21baef=_0xcf7a86['name'];var _0x25070f=_0xcf7a86[_0x9f7d('0x86')];var _0x51ab1d=_0xcf7a86[_0x9f7d('0x33')];var _0x293133=_0xcf7a86[_0x9f7d('0x87')]?_0xcf7a86[_0x9f7d('0x87')]:_0x9f7d('0x88');var _0x33ceee=_0xcf7a86[_0x9f7d('0x89')]?_0xcf7a86[_0x9f7d('0x89')]:'icon-apps';var _0x2b5fae='';var _0x3dc2bf='';var _0x30857b='';var _0x39cf86='';var _0x10e83d=_0xcf7a86[_0x9f7d('0x78')];if(_0x51ab1d==='html'){if(_0x9f7d('0x22')!=typeof _0xcf7a86[_0x9f7d('0x7c')][_0x9f7d('0x7d')]['admin']){var _0x531d29=_0xcf7a86[_0x9f7d('0x7c')][_0x9f7d('0x7d')][_0x9f7d('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x9f7d('0x8a')](_0x531d29)){_0x2b5fae=path[_0x9f7d('0x4d')](_0x9f7d('0x8b'),_0x3c01af,_0x2eb4dd[0x0],_0x531d29);}else{_0x2b5fae=_0x531d29;}}else{logger[_0x9f7d('0x63')](_0x9f7d('0x8c'));}if(_0x9f7d('0x22')!=typeof _0xcf7a86[_0x9f7d('0x7c')]['views'][_0x9f7d('0x80')]){var _0x15b0c1=_0xcf7a86[_0x9f7d('0x7c')][_0x9f7d('0x7d')][_0x9f7d('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x9f7d('0x8a')](_0x15b0c1)){_0x3dc2bf=path[_0x9f7d('0x4d')]('plugins',_0x3c01af,_0x2eb4dd[0x0],_0x15b0c1);}else{_0x3dc2bf=_0x15b0c1;}}else{logger[_0x9f7d('0x63')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x51ab1d===_0x9f7d('0x82')){_0x30857b=_0xcf7a86[_0x9f7d('0x7c')][_0x9f7d('0x83')];_0x39cf86=_0xcf7a86[_0x9f7d('0x7c')]['scriptPath'];if(_0x9f7d('0x22')!=typeof _0xcf7a86[_0x9f7d('0x7c')]['views']){if(_0x9f7d('0x22')!=typeof _0xcf7a86[_0x9f7d('0x7c')][_0x9f7d('0x7d')]['admin']){var _0x531d29=_0xcf7a86['parameters'][_0x9f7d('0x7d')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x9f7d('0x8a')](_0x531d29)){_0x2b5fae=path['join'](_0x9f7d('0x8b'),_0x3c01af,_0x2eb4dd[0x0],_0x531d29);}else{_0x2b5fae=_0x531d29;}}if('undefined'!=typeof _0xcf7a86[_0x9f7d('0x7c')][_0x9f7d('0x7d')]['agent']){var _0x15b0c1=_0xcf7a86[_0x9f7d('0x7c')]['views'][_0x9f7d('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x9f7d('0x8a')](_0x15b0c1)){_0x3dc2bf=path[_0x9f7d('0x4d')](_0x9f7d('0x8b'),_0x3c01af,_0x2eb4dd[0x0],_0x15b0c1);}else{_0x3dc2bf=_0x15b0c1;}}}}var _0x2260f2={'name':_0x21baef,'description':_0x25070f,'path':path[_0x9f7d('0x4d')](_0x3c01af,_0x2eb4dd[0x0]),'type':_0x51ab1d,'sidebar':_0x293133,'icon':_0x33ceee,'adminUrl':_0x2b5fae,'agentUrl':_0x3dc2bf,'scriptName':_0x30857b,'scriptPath':_0x39cf86,'version':_0x10e83d};removeReferences(_0x3c2604,null);return db[_0x9f7d('0x30')][_0x9f7d('0x8d')](_0x2260f2)[_0x9f7d('0x26')](function(_0x5866cb){var _0x1da9a4={'role':_0x3899df[_0x9f7d('0x8e')]['role'],'userProfileId':_0x3899df[_0x9f7d('0x8e')]['userProfileId']};if(!_0x1da9a4)throw new Error(_0x9f7d('0x8f'));if(_0x1da9a4[_0x9f7d('0x90')]==='user'){var _0x24fc87=_0x5866cb[_0x9f7d('0x27')]({'plain':!![]});return db[_0x9f7d('0x91')][_0x9f7d('0x4a')]({'where':{'name':_0x9f7d('0x28'),'userProfileId':_0x1da9a4[_0x9f7d('0x92')]},'raw':!![]})['then'](function(_0x16b2ba){if(_0x16b2ba&&_0x16b2ba[_0x9f7d('0x93')]===0x0){return db[_0x9f7d('0x29')][_0x9f7d('0x8d')]({'name':_0x24fc87['name'],'resourceId':_0x24fc87['id'],'type':_0x16b2ba[_0x9f7d('0x36')],'sectionId':_0x16b2ba['id']},{})[_0x9f7d('0x26')](function(){return _0x5866cb;});}else{return _0x5866cb;}})[_0x9f7d('0x47')](function(_0x1b78e4){logger[_0x9f7d('0x2b')](_0x9f7d('0x94'),_0x1b78e4);throw _0x1b78e4;});}return _0x5866cb;})[_0x9f7d('0x26')](respondWithResult(_0x185881,null))[_0x9f7d('0x47')](handleError(_0x185881,null));}});}catch(_0x217676){_0x185881['status'](0x1f4)[_0x9f7d('0x2d')](_0x217676);}};function removeReferences(_0x57126c,_0x289667){try{if(_0x57126c){fs[_0x9f7d('0x62')](_0x57126c);logger['info'](_0x9f7d('0x95'));}if(_0x289667){rimraf(_0x289667,function(){});logger[_0x9f7d('0x63')]('Extracted\x20folder\x20removed');}}catch(_0x2d655f){logger['error'](_0x2d655f);}}exports[_0x9f7d('0x96')]=function(_0xfe4958,_0x457d7a,_0x4b309d){return db[_0x9f7d('0x30')][_0x9f7d('0x4a')]({'where':{'id':_0xfe4958['params']['id']}})[_0x9f7d('0x26')](handleEntityNotFound(_0x457d7a,null))[_0x9f7d('0x26')](saveUpdates(_0xfe4958[_0x9f7d('0x8e')],null))[_0x9f7d('0x26')](respondWithResult(_0x457d7a,null))[_0x9f7d('0x47')](handleError(_0x457d7a,null));};exports['delete']=function(_0x409dbe,_0x3381b2,_0x21456c){return db[_0x9f7d('0x30')][_0x9f7d('0x4a')]({'where':{'id':_0x409dbe[_0x9f7d('0x49')]['id']}})['then'](function(_0x409aa2){if(_0x409aa2){return _0x409aa2[_0x9f7d('0x97')]();}})[_0x9f7d('0x26')](function(_0x490153){rimraf(path[_0x9f7d('0x4d')](config[_0x9f7d('0x4e')],_0x9f7d('0x4f'),path[_0x9f7d('0x5a')](_0x490153[_0x9f7d('0x4c')])),function(){});return _0x490153;})[_0x9f7d('0x26')](handleEntityNotFound(_0x3381b2,null))[_0x9f7d('0x26')](respondWithStatusCode(_0x3381b2,null))['catch'](handleError(_0x3381b2,null));};exports[_0x9f7d('0x98')]=function(_0x36e726,_0x22f492,_0xc6de36){return BPromise[_0x9f7d('0x99')]()[_0x9f7d('0x26')](function(){if(!_0x36e726['query']['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x36e726['query'][_0x9f7d('0x9a')]){throw new Error(_0x9f7d('0x9b'));}var _0xb06e93=_0x36e726[_0x9f7d('0x37')][_0x9f7d('0x9c')]?_0x36e726[_0x9f7d('0x37')]['hostname']+':'+_0x36e726[_0x9f7d('0x37')][_0x9f7d('0x9a')]:_0x9f7d('0x9d')+_0x36e726[_0x9f7d('0x37')][_0x9f7d('0x9a')];var _0x11e4ad=_0x36e726[_0x9f7d('0x37')][_0x9f7d('0x20')]?_0x36e726['query'][_0x9f7d('0x20')]:!![];var _0x43f134=_0x36e726[_0x9f7d('0x37')][_0x9f7d('0x9e')]?_0x36e726['query'][_0x9f7d('0x9e')]:null;var _0x16a979={'method':_0x36e726[_0x9f7d('0x9f')],'uri':util[_0x9f7d('0x50')](_0x9f7d('0xa0'),_0xb06e93,_0x36e726[_0x9f7d('0x37')][_0x9f7d('0x4c')]),'json':_0x11e4ad,'resolveWithFullResponse':!![],'encoding':_0x43f134,'qs':_0x36e726[_0x9f7d('0x37')]};if(_0x36e726[_0x9f7d('0xa1')]){_0x16a979[_0x9f7d('0xa1')]=_0x36e726['headers'];if(_0x16a979['headers']['content-length']){delete _0x16a979['headers'][_0x9f7d('0xa2')];}}if(_0x16a979['headers']['content-type']){delete _0x16a979[_0x9f7d('0xa1')][_0x9f7d('0xa3')];}return rp(_0x16a979);})['then'](function(_0x235d68){if(_0x235d68){_0x22f492['set'](_0x235d68[_0x9f7d('0xa1')]);logger[_0x9f7d('0x63')](_0x235d68['body']);if(_[_0x9f7d('0xa4')](_0x36e726[_0x9f7d('0x37')][_0x9f7d('0x4c')],_0x9f7d('0x4b'))&&_0x235d68[_0x9f7d('0xa5')]==0x1f4){return _0x22f492[_0x9f7d('0x1e')](_0x235d68['statusCode']);}else{return _0x22f492[_0x9f7d('0x1f')](_0x235d68['statusCode'])['send'](_0x235d68[_0x9f7d('0x8e')]);}}else{return _0x22f492[_0x9f7d('0x1e')](0xc8);}})['catch'](handleError(_0x22f492,null));};exports[_0x9f7d('0xa6')]=function(_0x4ac2c5,_0x3c8232,_0x2596da){return BPromise['resolve']()['then'](function(){if(!_0x4ac2c5[_0x9f7d('0x37')][_0x9f7d('0x4c')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x4ac2c5[_0x9f7d('0x37')][_0x9f7d('0x9a')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x53f92e=_0x4ac2c5['query']['hostname']?_0x4ac2c5[_0x9f7d('0x37')][_0x9f7d('0x9c')]+':'+_0x4ac2c5[_0x9f7d('0x37')][_0x9f7d('0x9a')]:_0x9f7d('0x9d')+_0x4ac2c5[_0x9f7d('0x37')][_0x9f7d('0x9a')];var _0x1f8a7c=_0x4ac2c5['query'][_0x9f7d('0x20')]?_0x4ac2c5[_0x9f7d('0x37')][_0x9f7d('0x20')]:!![];var _0x4512cb=_0x4ac2c5[_0x9f7d('0x37')]['encoding']?_0x4ac2c5[_0x9f7d('0x37')][_0x9f7d('0x9e')]:null;var _0x353f1e={'method':_0x4ac2c5['method'],'uri':util[_0x9f7d('0x50')](_0x9f7d('0xa0'),_0x53f92e,_0x4ac2c5[_0x9f7d('0x37')][_0x9f7d('0x4c')]),'json':_0x1f8a7c,'resolveWithFullResponse':!![],'encoding':_0x4512cb,'body':_0x4ac2c5[_0x9f7d('0x8e')]};if(_0x4ac2c5[_0x9f7d('0xa1')]){_0x353f1e[_0x9f7d('0xa1')]=_0x4ac2c5[_0x9f7d('0xa1')];if(_0x353f1e[_0x9f7d('0xa1')][_0x9f7d('0xa2')]){delete _0x353f1e[_0x9f7d('0xa1')][_0x9f7d('0xa2')];}}if(_0x353f1e[_0x9f7d('0xa1')][_0x9f7d('0xa3')]){delete _0x353f1e[_0x9f7d('0xa1')]['content-type'];}return rp(_0x353f1e);})[_0x9f7d('0x26')](function(_0x14e478){if(_0x14e478){_0x3c8232[_0x9f7d('0xa7')](_0x14e478[_0x9f7d('0xa1')]);logger[_0x9f7d('0x63')](_0x14e478[_0x9f7d('0x8e')]);return _0x3c8232[_0x9f7d('0x1f')](_0x14e478['statusCode'])[_0x9f7d('0x2d')](_0x14e478['body']);}else{return _0x3c8232[_0x9f7d('0x1e')](0xc8);}})['catch'](handleError(_0x3c8232,null));}; \ No newline at end of file +var _0x94d9=['content-length','content-type','endsWith','statusCode','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./plugin.socket','register','sendStatus','status','offset','limit','undefined','count','set','json','apply','save','update','then','destroy','get','Plugins','UserProfileResource','end','error','stack','name','send','map','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','type','VIRTUAL','merge','options','Plugin','findAll','rows','catch','params','keys','rawAttributes','length','includeAll','find','download','join','server/files/plugins','%s.zip','path','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','root','dirname','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','basename','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','Invalid\x20manifest:\x20no\x20view\x20specified','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','always','icon','icon-apps','version','admin','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','test','script','scriptName','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','unlinkSync','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x94d9,0x152));var _0x994d=function(_0x240b47,_0x133aba){_0x240b47=_0x240b47-0x0;var _0x41ef61=_0x94d9[_0x240b47];return _0x41ef61;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x994d('0x0'));var zipdir=require(_0x994d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x994d('0x2'));var moment=require(_0x994d('0x3'));var BPromise=require(_0x994d('0x4'));var Mustache=require(_0x994d('0x5'));var util=require(_0x994d('0x6'));var path=require('path');var sox=require(_0x994d('0x7'));var csv=require('to-csv');var ejs=require(_0x994d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x994d('0x9'));var crypto=require(_0x994d('0xa'));var jsforce=require(_0x994d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x994d('0xc'));var querystring=require('querystring');var Papa=require(_0x994d('0xd'));var extract=require(_0x994d('0xe'));var rimraf=require(_0x994d('0x0'));var archiver=require(_0x994d('0xf'));var Redis=require(_0x994d('0x10'));var authService=require(_0x994d('0x11'));var qs=require(_0x994d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x994d('0x13'));var logger=require(_0x994d('0x14'))('api');var utils=require(_0x994d('0x15'));var config=require(_0x994d('0x16'));var licenseUtil=require(_0x994d('0x17'));var db=require('../../mysqldb')['db'];config[_0x994d('0x18')]=_[_0x994d('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x994d('0x1a'))(new Redis(config[_0x994d('0x18')]));require(_0x994d('0x1b'))[_0x994d('0x1c')](socket);function respondWithStatusCode(_0x5cd89d,_0x3b33b5){_0x3b33b5=_0x3b33b5||0xcc;return function(_0x42e6d9){if(_0x42e6d9){return _0x5cd89d[_0x994d('0x1d')](_0x3b33b5);}return _0x5cd89d[_0x994d('0x1e')](_0x3b33b5)['end']();};}function respondWithResult(_0x4ea9ac,_0x526832){_0x526832=_0x526832||0xc8;return function(_0x235eb1){if(_0x235eb1){return _0x4ea9ac[_0x994d('0x1e')](_0x526832)['json'](_0x235eb1);}};}function respondWithFilteredResult(_0x1a5843,_0x36ed12){return function(_0x52ab56){if(_0x52ab56){var _0x9f529e=typeof _0x36ed12[_0x994d('0x1f')]==='undefined'&&typeof _0x36ed12[_0x994d('0x20')]===_0x994d('0x21');var _0xc52841=_0x52ab56[_0x994d('0x22')];var _0x4770e=_0x9f529e?0x0:_0x36ed12[_0x994d('0x1f')];var _0x40b81e=_0x9f529e?_0x52ab56['count']:_0x36ed12[_0x994d('0x1f')]+_0x36ed12[_0x994d('0x20')];var _0x3e549a;if(_0x40b81e>=_0xc52841){_0x40b81e=_0xc52841;_0x3e549a=0xc8;}else{_0x3e549a=0xce;}_0x1a5843['status'](_0x3e549a);return _0x1a5843[_0x994d('0x23')]('Content-Range',_0x4770e+'-'+_0x40b81e+'/'+_0xc52841)[_0x994d('0x24')](_0x52ab56);}return null;};}function patchUpdates(_0x5a0c18){return function(_0x1377a7){try{jsonpatch[_0x994d('0x25')](_0x1377a7,_0x5a0c18,!![]);}catch(_0x10bcd7){return BPromise['reject'](_0x10bcd7);}return _0x1377a7[_0x994d('0x26')]();};}function saveUpdates(_0x5303b0,_0x5e9d3a){return function(_0x77c8ca){if(_0x77c8ca){return _0x77c8ca[_0x994d('0x27')](_0x5303b0)[_0x994d('0x28')](function(_0x4e7122){return _0x4e7122;});}return null;};}function removeEntity(_0x194926,_0x57023c){return function(_0x3b4deb){if(_0x3b4deb){return _0x3b4deb[_0x994d('0x29')]()[_0x994d('0x28')](function(){var _0x38726a=_0x3b4deb[_0x994d('0x2a')]({'plain':!![]});var _0x39a533=_0x994d('0x2b');return db[_0x994d('0x2c')][_0x994d('0x29')]({'where':{'type':_0x39a533,'resourceId':_0x38726a['id']}})['then'](function(){return _0x3b4deb;});})[_0x994d('0x28')](function(){_0x194926[_0x994d('0x1e')](0xcc)[_0x994d('0x2d')]();});}};}function handleEntityNotFound(_0x18a737,_0x5be0c4){return function(_0x2d60c5){if(!_0x2d60c5){_0x18a737['sendStatus'](0x194);}return _0x2d60c5;};}function handleError(_0xf335d,_0x533b2a){_0x533b2a=_0x533b2a||0x1f4;return function(_0x3bd033){logger[_0x994d('0x2e')](_0x3bd033[_0x994d('0x2f')]);if(_0x3bd033[_0x994d('0x30')]){delete _0x3bd033['name'];}_0xf335d[_0x994d('0x1e')](_0x533b2a)[_0x994d('0x31')](_0x3bd033);};}exports['index']=function(_0x4d1e27,_0x173af2){var _0xd6b5fb={},_0x5928b0={},_0x2da6e6={'count':0x0,'rows':[]};var _0x2a17e2=_[_0x994d('0x32')](db['Plugin']['rawAttributes'],function(_0x12b285){return{'name':_0x12b285['fieldName'],'type':_0x12b285['type'][_0x994d('0x33')]};});_0x5928b0[_0x994d('0x34')]=_[_0x994d('0x32')](_0x2a17e2,_0x994d('0x30'));_0x5928b0[_0x994d('0x35')]=_['keys'](_0x4d1e27[_0x994d('0x35')]);_0x5928b0['filters']=_[_0x994d('0x36')](_0x5928b0['model'],_0x5928b0[_0x994d('0x35')]);_0xd6b5fb[_0x994d('0x37')]=_[_0x994d('0x36')](_0x5928b0['model'],qs[_0x994d('0x38')](_0x4d1e27[_0x994d('0x35')][_0x994d('0x38')]));_0xd6b5fb[_0x994d('0x37')]=_0xd6b5fb[_0x994d('0x37')]['length']?_0xd6b5fb['attributes']:_0x5928b0[_0x994d('0x34')];if(!_0x4d1e27['query'][_0x994d('0x39')](_0x994d('0x3a'))){_0xd6b5fb[_0x994d('0x20')]=qs[_0x994d('0x20')](_0x4d1e27[_0x994d('0x35')][_0x994d('0x20')]);_0xd6b5fb[_0x994d('0x1f')]=qs[_0x994d('0x1f')](_0x4d1e27[_0x994d('0x35')][_0x994d('0x1f')]);}_0xd6b5fb[_0x994d('0x3b')]=qs[_0x994d('0x3c')](_0x4d1e27[_0x994d('0x35')][_0x994d('0x3c')]);_0xd6b5fb['where']=qs['filters'](_[_0x994d('0x3d')](_0x4d1e27[_0x994d('0x35')],_0x5928b0[_0x994d('0x3e')]),_0x2a17e2);if(_0x4d1e27['query'][_0x994d('0x3f')]){_0xd6b5fb[_0x994d('0x40')]=_['merge'](_0xd6b5fb[_0x994d('0x40')],{'$or':_[_0x994d('0x32')](_0x2a17e2,function(_0xb6ef07){if(_0xb6ef07[_0x994d('0x41')]!==_0x994d('0x42')){var _0x406677={};_0x406677[_0xb6ef07[_0x994d('0x30')]]={'$like':'%'+_0x4d1e27[_0x994d('0x35')][_0x994d('0x3f')]+'%'};return _0x406677;}})});}_0xd6b5fb=_[_0x994d('0x43')]({},_0xd6b5fb,_0x4d1e27[_0x994d('0x44')]);var _0x1b412b={'where':_0xd6b5fb['where']};return db[_0x994d('0x45')][_0x994d('0x22')](_0x1b412b)[_0x994d('0x28')](function(_0x2809a9){_0x2da6e6['count']=_0x2809a9;if(_0x4d1e27[_0x994d('0x35')]['includeAll']){_0xd6b5fb['include']=[{'all':!![]}];}return db[_0x994d('0x45')][_0x994d('0x46')](_0xd6b5fb);})[_0x994d('0x28')](function(_0x5bfde7){_0x2da6e6[_0x994d('0x47')]=_0x5bfde7;return _0x2da6e6;})[_0x994d('0x28')](respondWithFilteredResult(_0x173af2,_0xd6b5fb))[_0x994d('0x48')](handleError(_0x173af2,null));};exports['show']=function(_0x52a8be,_0x157d39){var _0x356b6f={'raw':!![],'where':{'id':_0x52a8be[_0x994d('0x49')]['id']}},_0x520a44={};_0x520a44[_0x994d('0x34')]=_[_0x994d('0x4a')](db['Plugin'][_0x994d('0x4b')]);_0x520a44[_0x994d('0x35')]=_[_0x994d('0x4a')](_0x52a8be['query']);_0x520a44['filters']=_[_0x994d('0x36')](_0x520a44['model'],_0x520a44[_0x994d('0x35')]);_0x356b6f[_0x994d('0x37')]=_[_0x994d('0x36')](_0x520a44[_0x994d('0x34')],qs['fields'](_0x52a8be[_0x994d('0x35')]['fields']));_0x356b6f[_0x994d('0x37')]=_0x356b6f['attributes'][_0x994d('0x4c')]?_0x356b6f[_0x994d('0x37')]:_0x520a44[_0x994d('0x34')];if(_0x52a8be['query'][_0x994d('0x4d')]){_0x356b6f['include']=[{'all':!![]}];}_0x356b6f=_[_0x994d('0x43')]({},_0x356b6f,_0x52a8be['options']);return db['Plugin'][_0x994d('0x4e')](_0x356b6f)['then'](handleEntityNotFound(_0x157d39,null))[_0x994d('0x28')](respondWithResult(_0x157d39,null))[_0x994d('0x48')](handleError(_0x157d39,null));};exports[_0x994d('0x4f')]=function(_0x20109f,_0x1dbaf0,_0x526184){return db[_0x994d('0x45')]['find']({'where':{'id':_0x20109f[_0x994d('0x49')]['id']},'attributes':[_0x994d('0x30'),'path'],'raw':!![]})[_0x994d('0x28')](handleEntityNotFound(_0x1dbaf0,null))[_0x994d('0x28')](function(_0x4598f2){if(_0x4598f2){var _0x1fcb1c=path[_0x994d('0x50')](config['root'],_0x994d('0x51'),util['format'](_0x994d('0x52'),path['basename'](_0x4598f2[_0x994d('0x53')])));var _0x4e778e=fs['createWriteStream'](_0x1fcb1c);var _0xbae743=archiver(_0x994d('0x54'),{'zlib':{'level':0x9}});_0xbae743['on'](_0x994d('0x55'),function(_0x189beb){if(_0x189beb[_0x994d('0x56')]===_0x994d('0x57')){logger[_0x994d('0x2e')](_0x189beb);}else{throw new db[(_0x994d('0x58'))][(_0x994d('0x59'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0xbae743['on'](_0x994d('0x2e'),function(_0x45ca38){throw new db['Sequelize'][(_0x994d('0x59'))](_0x994d('0x5a'));});_0xbae743[_0x994d('0x5b')](_0x4e778e);_0xbae743[_0x994d('0x5c')](_0x994d('0x5d'),{'cwd':path['join'](config[_0x994d('0x5e')],_0x994d('0x51'),path[_0x994d('0x5f')](_0x4598f2[_0x994d('0x53')])),'ignore':[path[_0x994d('0x50')](path['basename'](_0x4598f2[_0x994d('0x53')]),'node_modules/**/*'),path[_0x994d('0x50')](path['basename'](_0x4598f2[_0x994d('0x53')]),_0x994d('0x60'))],'nodir':!![]})[_0x994d('0x61')]();_0x4e778e['on'](_0x994d('0x62'),function(){if(!fs[_0x994d('0x63')](_0x1fcb1c)){throw new db[(_0x994d('0x58'))][(_0x994d('0x59'))](_0x994d('0x64'));}return _0x1dbaf0[_0x994d('0x4f')](_0x1fcb1c,util[_0x994d('0x65')](_0x994d('0x52'),path[_0x994d('0x66')](_0x4598f2[_0x994d('0x53')])),function(_0x126e56){if(_0x126e56){throw new db[(_0x994d('0x58'))][(_0x994d('0x59'))](_0x994d('0x67'));}fs['unlinkSync'](_0x1fcb1c);logger[_0x994d('0x68')](_0x994d('0x69'));logger['info'](_0x994d('0x6a'));});});}return null;})[_0x994d('0x48')](handleError(_0x1dbaf0,null));};exports['upload']=function(_0x352881,_0x20835e,_0x33a83f){var _0x4beb1b=path[_0x994d('0x66')](_0x352881[_0x994d('0x6b')][_0x994d('0x6c')],path['extname'](_0x352881['file'][_0x994d('0x6c')]));var _0x489f4d=path[_0x994d('0x50')](config[_0x994d('0x5e')],_0x994d('0x51'),_0x352881[_0x994d('0x6b')][_0x994d('0x6c')]);var _0x3953c3=path['join'](config[_0x994d('0x5e')],_0x994d('0x51'),_0x4beb1b);logger[_0x994d('0x68')](_0x994d('0x6d'),_0x489f4d);logger[_0x994d('0x68')](_0x994d('0x6e'),_0x3953c3);try{fs['chmodSync'](_0x489f4d,parseInt(_0x994d('0x6f'),0x8));extract(_0x489f4d,{'dir':_0x3953c3},function(_0x3db08f){if(_0x3db08f){logger[_0x994d('0x2e')](_0x3db08f);handleError(_0x3db08f,!![]);};var _0x286220=fs[_0x994d('0x70')](_0x3953c3);if(_0x286220[_0x994d('0x4c')]>0x1){removeReferences(_0x489f4d,_0x3953c3);logger[_0x994d('0x2e')](_0x994d('0x71'));return _0x33a83f(new Error('Invalid\x20plugin\x20structure'));}var _0x3e1bee=fs[_0x994d('0x72')](path['join'](_0x3953c3,_0x286220[0x0]));if(_0x3e1bee[_0x994d('0x73')]()){removeReferences(_0x489f4d,_0x3953c3);logger[_0x994d('0x2e')](_0x994d('0x71'));return _0x33a83f(new Error('Invalid\x20plugin\x20structure'));}if(_0x3e1bee[_0x994d('0x74')]()){var _0x37ae14=fs[_0x994d('0x70')](path[_0x994d('0x50')](_0x3953c3,_0x286220[0x0]));if(_0x37ae14[_0x994d('0x4c')]===0x0){removeReferences(_0x489f4d,_0x3953c3);logger[_0x994d('0x2e')]('Invalid\x20plugin\x20structure');return _0x33a83f(new Error('Invalid\x20plugin\x20structure'));}var _0x3d5e1b=_0x37ae14['some'](function(_0x280237){return _0x280237==='manifest.json';});if(!_0x3d5e1b){return _0x33a83f(new Error(_0x994d('0x75')));}var _0x42717c=fs[_0x994d('0x76')](path[_0x994d('0x50')](_0x3953c3,_0x286220[0x0],'manifest.json'));var _0x3c7039=JSON[_0x994d('0x77')](_0x42717c);if(_0x994d('0x21')==typeof _0x3c7039[_0x994d('0x30')]){return _0x33a83f(new Error(_0x994d('0x78')));}if('undefined'==typeof _0x3c7039[_0x994d('0x41')]){return _0x33a83f(new Error(_0x994d('0x79')));}if(_0x994d('0x21')==typeof _0x3c7039['version']){return _0x33a83f(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x994d('0x21')==typeof _0x3c7039[_0x994d('0x7a')]){return _0x33a83f(new Error(_0x994d('0x7b')));}if(_0x3c7039['type']===_0x994d('0x7c')){if(_0x994d('0x21')==typeof _0x3c7039[_0x994d('0x7a')][_0x994d('0x7d')]){return _0x33a83f(new Error(_0x994d('0x7e')));}if(_0x994d('0x21')==typeof _0x3c7039[_0x994d('0x7a')][_0x994d('0x7d')]['admin']&&'undefined'==typeof _0x3c7039[_0x994d('0x7a')][_0x994d('0x7d')]['agent']){return _0x33a83f(new Error(_0x994d('0x7f')));}}else if(_0x3c7039[_0x994d('0x41')]==='script'){if(_0x994d('0x21')==typeof _0x3c7039[_0x994d('0x7a')]['scriptName']){return _0x33a83f(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x994d('0x21')==typeof _0x3c7039['parameters'][_0x994d('0x80')]){return _0x33a83f(new Error(_0x994d('0x81')));}}else{return _0x33a83f(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x2be1e2=_0x3c7039[_0x994d('0x30')];var _0x5c7e94=_0x3c7039['description'];var _0x3a37fa=_0x3c7039['type'];var _0x1f0859=_0x3c7039[_0x994d('0x82')]?_0x3c7039['sidebar']:_0x994d('0x83');var _0x41214d=_0x3c7039['icon']?_0x3c7039[_0x994d('0x84')]:_0x994d('0x85');var _0x3eae5e='';var _0x20f863='';var _0x53d3d9='';var _0x742433='';var _0x8194ee=_0x3c7039[_0x994d('0x86')];if(_0x3a37fa==='html'){if('undefined'!=typeof _0x3c7039[_0x994d('0x7a')][_0x994d('0x7d')]['admin']){var _0x4ae9a2=_0x3c7039[_0x994d('0x7a')][_0x994d('0x7d')][_0x994d('0x87')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4ae9a2)){_0x3eae5e=path[_0x994d('0x50')](_0x994d('0x88'),_0x4beb1b,_0x286220[0x0],_0x4ae9a2);}else{_0x3eae5e=_0x4ae9a2;}}else{logger[_0x994d('0x68')](_0x994d('0x89'));}if(_0x994d('0x21')!=typeof _0x3c7039[_0x994d('0x7a')]['views'][_0x994d('0x8a')]){var _0xf65833=_0x3c7039['parameters'][_0x994d('0x7d')][_0x994d('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0x994d('0x8b')](_0xf65833)){_0x20f863=path[_0x994d('0x50')](_0x994d('0x88'),_0x4beb1b,_0x286220[0x0],_0xf65833);}else{_0x20f863=_0xf65833;}}else{logger[_0x994d('0x68')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x3a37fa===_0x994d('0x8c')){_0x53d3d9=_0x3c7039[_0x994d('0x7a')][_0x994d('0x8d')];_0x742433=_0x3c7039[_0x994d('0x7a')][_0x994d('0x80')];if(_0x994d('0x21')!=typeof _0x3c7039[_0x994d('0x7a')][_0x994d('0x7d')]){if('undefined'!=typeof _0x3c7039[_0x994d('0x7a')][_0x994d('0x7d')][_0x994d('0x87')]){var _0x4ae9a2=_0x3c7039[_0x994d('0x7a')]['views'][_0x994d('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x994d('0x8b')](_0x4ae9a2)){_0x3eae5e=path['join'](_0x994d('0x88'),_0x4beb1b,_0x286220[0x0],_0x4ae9a2);}else{_0x3eae5e=_0x4ae9a2;}}if(_0x994d('0x21')!=typeof _0x3c7039[_0x994d('0x7a')]['views'][_0x994d('0x8a')]){var _0xf65833=_0x3c7039[_0x994d('0x7a')][_0x994d('0x7d')][_0x994d('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0x994d('0x8b')](_0xf65833)){_0x20f863=path[_0x994d('0x50')](_0x994d('0x88'),_0x4beb1b,_0x286220[0x0],_0xf65833);}else{_0x20f863=_0xf65833;}}}}var _0x1b0f6b={'name':_0x2be1e2,'description':_0x5c7e94,'path':path['join'](_0x4beb1b,_0x286220[0x0]),'type':_0x3a37fa,'sidebar':_0x1f0859,'icon':_0x41214d,'adminUrl':_0x3eae5e,'agentUrl':_0x20f863,'scriptName':_0x53d3d9,'scriptPath':_0x742433,'version':_0x8194ee};removeReferences(_0x489f4d,null);return db[_0x994d('0x45')][_0x994d('0x8e')](_0x1b0f6b)[_0x994d('0x28')](function(_0x18e23c){var _0x32d7ae={'role':_0x352881[_0x994d('0x8f')][_0x994d('0x90')],'userProfileId':_0x352881[_0x994d('0x8f')][_0x994d('0x91')]};if(!_0x32d7ae)throw new Error(_0x994d('0x92'));if(_0x32d7ae['role']===_0x994d('0x93')){var _0x224ba4=_0x18e23c[_0x994d('0x2a')]({'plain':!![]});return db[_0x994d('0x94')]['find']({'where':{'name':_0x994d('0x2b'),'userProfileId':_0x32d7ae[_0x994d('0x91')]},'raw':!![]})[_0x994d('0x28')](function(_0x5e1fb1){if(_0x5e1fb1&&_0x5e1fb1[_0x994d('0x95')]===0x0){return db['UserProfileResource'][_0x994d('0x8e')]({'name':_0x224ba4[_0x994d('0x30')],'resourceId':_0x224ba4['id'],'type':_0x5e1fb1[_0x994d('0x30')],'sectionId':_0x5e1fb1['id']},{})[_0x994d('0x28')](function(){return _0x18e23c;});}else{return _0x18e23c;}})[_0x994d('0x48')](function(_0x5f4387){logger[_0x994d('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5f4387);throw _0x5f4387;});}return _0x18e23c;})['then'](respondWithResult(_0x20835e,null))[_0x994d('0x48')](handleError(_0x20835e,null));}});}catch(_0x101551){_0x20835e[_0x994d('0x1e')](0x1f4)[_0x994d('0x31')](_0x101551);}};function removeReferences(_0x4a0260,_0x1bb5d3){try{if(_0x4a0260){fs[_0x994d('0x96')](_0x4a0260);logger[_0x994d('0x68')]('Zip\x20archive\x20removed');}if(_0x1bb5d3){rimraf(_0x1bb5d3,function(){});logger[_0x994d('0x68')]('Extracted\x20folder\x20removed');}}catch(_0x332ec6){logger[_0x994d('0x2e')](_0x332ec6);}}exports[_0x994d('0x27')]=function(_0x220d22,_0x33d15d,_0x34ae72){return db[_0x994d('0x45')][_0x994d('0x4e')]({'where':{'id':_0x220d22['params']['id']}})['then'](handleEntityNotFound(_0x33d15d,null))[_0x994d('0x28')](saveUpdates(_0x220d22[_0x994d('0x8f')],null))[_0x994d('0x28')](respondWithResult(_0x33d15d,null))[_0x994d('0x48')](handleError(_0x33d15d,null));};exports[_0x994d('0x97')]=function(_0x2c1819,_0x262684,_0x3c0375){return db[_0x994d('0x45')]['find']({'where':{'id':_0x2c1819[_0x994d('0x49')]['id']}})['then'](function(_0x1ef6ca){if(_0x1ef6ca){return _0x1ef6ca[_0x994d('0x29')]();}})[_0x994d('0x28')](function(_0x27a095){rimraf(path[_0x994d('0x50')](config[_0x994d('0x5e')],_0x994d('0x51'),path[_0x994d('0x5f')](_0x27a095[_0x994d('0x53')])),function(){});return _0x27a095;})[_0x994d('0x28')](handleEntityNotFound(_0x262684,null))[_0x994d('0x28')](respondWithStatusCode(_0x262684,null))[_0x994d('0x48')](handleError(_0x262684,null));};exports[_0x994d('0x98')]=function(_0x49762c,_0x286719,_0x2eb87a){return BPromise[_0x994d('0x99')]()[_0x994d('0x28')](function(){if(!_0x49762c['query'][_0x994d('0x53')]){throw new Error(_0x994d('0x9a'));}if(!_0x49762c['query']['port']){throw new Error(_0x994d('0x9b'));}var _0x9a8d07=_0x49762c['query'][_0x994d('0x9c')]?_0x49762c[_0x994d('0x35')][_0x994d('0x9c')]+':'+_0x49762c[_0x994d('0x35')][_0x994d('0x9d')]:_0x994d('0x9e')+_0x49762c[_0x994d('0x35')][_0x994d('0x9d')];var _0x1e4485=_0x49762c[_0x994d('0x35')][_0x994d('0x24')]?_0x49762c['query'][_0x994d('0x24')]:!![];var _0x57a581=_0x49762c['query'][_0x994d('0x9f')]?_0x49762c[_0x994d('0x35')][_0x994d('0x9f')]:null;var _0x440cde={'method':_0x49762c[_0x994d('0xa0')],'uri':util[_0x994d('0x65')](_0x994d('0xa1'),_0x9a8d07,_0x49762c[_0x994d('0x35')][_0x994d('0x53')]),'json':_0x1e4485,'resolveWithFullResponse':!![],'encoding':_0x57a581,'qs':_0x49762c[_0x994d('0x35')]};if(_0x49762c[_0x994d('0xa2')]){_0x440cde['headers']=_0x49762c[_0x994d('0xa2')];if(_0x440cde['headers'][_0x994d('0xa3')]){delete _0x440cde[_0x994d('0xa2')][_0x994d('0xa3')];}}if(_0x440cde[_0x994d('0xa2')][_0x994d('0xa4')]){delete _0x440cde[_0x994d('0xa2')][_0x994d('0xa4')];}return rp(_0x440cde);})['then'](function(_0x3bd593){if(_0x3bd593){_0x286719[_0x994d('0x23')](_0x3bd593['headers']);logger['info'](_0x3bd593[_0x994d('0x8f')]);if(_[_0x994d('0xa5')](_0x49762c[_0x994d('0x35')][_0x994d('0x53')],_0x994d('0x4f'))&&_0x3bd593[_0x994d('0xa6')]==0x1f4){return _0x286719[_0x994d('0x1d')](_0x3bd593['statusCode']);}else{return _0x286719[_0x994d('0x1e')](_0x3bd593['statusCode'])[_0x994d('0x31')](_0x3bd593['body']);}}else{return _0x286719['sendStatus'](0xc8);}})['catch'](handleError(_0x286719,null));};exports['webhookPost']=function(_0x14f16a,_0x4f097d,_0x1029ed){return BPromise[_0x994d('0x99')]()[_0x994d('0x28')](function(){if(!_0x14f16a[_0x994d('0x35')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x14f16a[_0x994d('0x35')][_0x994d('0x9d')]){throw new Error(_0x994d('0x9b'));}var _0x43cb8c=_0x14f16a[_0x994d('0x35')]['hostname']?_0x14f16a[_0x994d('0x35')][_0x994d('0x9c')]+':'+_0x14f16a['query'][_0x994d('0x9d')]:_0x994d('0x9e')+_0x14f16a['query'][_0x994d('0x9d')];var _0x50865d=_0x14f16a[_0x994d('0x35')]['json']?_0x14f16a[_0x994d('0x35')]['json']:!![];var _0x419855=_0x14f16a[_0x994d('0x35')][_0x994d('0x9f')]?_0x14f16a[_0x994d('0x35')]['encoding']:null;var _0x5eea18={'method':_0x14f16a['method'],'uri':util[_0x994d('0x65')](_0x994d('0xa1'),_0x43cb8c,_0x14f16a[_0x994d('0x35')][_0x994d('0x53')]),'json':_0x50865d,'resolveWithFullResponse':!![],'encoding':_0x419855,'body':_0x14f16a[_0x994d('0x8f')]};if(_0x14f16a[_0x994d('0xa2')]){_0x5eea18[_0x994d('0xa2')]=_0x14f16a[_0x994d('0xa2')];if(_0x5eea18[_0x994d('0xa2')]['content-length']){delete _0x5eea18[_0x994d('0xa2')][_0x994d('0xa3')];}}if(_0x5eea18[_0x994d('0xa2')][_0x994d('0xa4')]){delete _0x5eea18[_0x994d('0xa2')][_0x994d('0xa4')];}return rp(_0x5eea18);})['then'](function(_0xd97809){if(_0xd97809){_0x4f097d[_0x994d('0x23')](_0xd97809[_0x994d('0xa2')]);logger[_0x994d('0x68')](_0xd97809['body']);return _0x4f097d[_0x994d('0x1e')](_0xd97809[_0x994d('0xa6')])[_0x994d('0x31')](_0xd97809[_0x994d('0x8f')]);}else{return _0x4f097d['sendStatus'](0xc8);}})[_0x994d('0x48')](handleError(_0x4f097d,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 256d8f1..45bf430 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 _0x6bb4=['update','emit','exports','events','../../mysqldb','Plugin','save'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6bb4,0x1a7));var _0x46bb=function(_0x1496cf,_0xe4050b){_0x1496cf=_0x1496cf-0x0;var _0x2c3722=_0x6bb4[_0x1496cf];return _0x2c3722;};'use strict';var EventEmitter=require(_0x46bb('0x0'));var Plugin=require(_0x46bb('0x1'))['db'][_0x46bb('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x46bb('0x3'),'afterUpdate':_0x46bb('0x4'),'afterDestroy':'remove'};function emitEvent(_0x74054){return function(_0x100be2,_0x2eefcc,_0x3c8bef){PluginEvents[_0x46bb('0x5')](_0x74054+':'+_0x100be2['id'],_0x100be2);PluginEvents[_0x46bb('0x5')](_0x74054,_0x100be2);_0x3c8bef(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x46bb('0x6')]=PluginEvents; \ No newline at end of file +var _0x326f=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x326f,0xd1));var _0xf326=function(_0x2febeb,_0x358bc2){_0x2febeb=_0x2febeb-0x0;var _0x5c04c8=_0x326f[_0x2febeb];return _0x5c04c8;};'use strict';var EventEmitter=require(_0xf326('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xf326('0x1')](0x0);var events={'afterCreate':_0xf326('0x2'),'afterUpdate':_0xf326('0x3'),'afterDestroy':_0xf326('0x4')};function emitEvent(_0x27e8d7){return function(_0x120a26,_0x9445c6,_0xf1c243){PluginEvents[_0xf326('0x5')](_0x27e8d7+':'+_0x120a26['id'],_0x120a26);PluginEvents[_0xf326('0x5')](_0x27e8d7,_0x120a26);_0xf1c243(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xf326('0x6')](e,emitEvent(event));}}module[_0xf326('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 2f33ff7..f8cb552 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 _0xb757=['../../config/environment','./plugin.attributes','define','Plugin','plugins','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x374320,_0x55464d){var _0x6a96c9=function(_0x3231a8){while(--_0x3231a8){_0x374320['push'](_0x374320['shift']());}};_0x6a96c9(++_0x55464d);}(_0xb757,0x1d9));var _0x7b75=function(_0x55efaa,_0x22e9fa){_0x55efaa=_0x55efaa-0x0;var _0x47ffbf=_0xb757[_0x55efaa];return _0x47ffbf;};'use strict';var _=require(_0x7b75('0x0'));var util=require(_0x7b75('0x1'));var logger=require(_0x7b75('0x2'))('api');var moment=require(_0x7b75('0x3'));var BPromise=require(_0x7b75('0x4'));var rp=require(_0x7b75('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b75('0x6'));var config=require(_0x7b75('0x7'));var attributes=require(_0x7b75('0x8'));module['exports']=function(_0x49a7cd,_0x26665b){return _0x49a7cd[_0x7b75('0x9')](_0x7b75('0xa'),attributes,{'tableName':_0x7b75('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21d1=['Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./plugin.attributes','exports','define'];(function(_0x2cd2f0,_0x2c1a55){var _0x137160=function(_0x62979c){while(--_0x62979c){_0x2cd2f0['push'](_0x2cd2f0['shift']());}};_0x137160(++_0x2c1a55);}(_0x21d1,0x1c9));var _0x121d=function(_0x4c914e,_0x47feaa){_0x4c914e=_0x4c914e-0x0;var _0x17ad0d=_0x21d1[_0x4c914e];return _0x17ad0d;};'use strict';var _=require(_0x121d('0x0'));var util=require(_0x121d('0x1'));var logger=require(_0x121d('0x2'))(_0x121d('0x3'));var moment=require(_0x121d('0x4'));var BPromise=require(_0x121d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x121d('0x6'));var config=require(_0x121d('0x7'));var attributes=require(_0x121d('0x8'));module[_0x121d('0x9')]=function(_0x2f3987,_0x4c47ee){return _0x2f3987[_0x121d('0xa')](_0x121d('0xb'),attributes,{'tableName':_0x121d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index d3661d3..b56a21a 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 _0xf398=['then','CreatePlugin','debug','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./plugin.socket','request','info','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','catch','Plugin','create','body','options','raw'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf398,0x7f));var _0x8f39=function(_0x15acf1,_0xe6d116){_0x15acf1=_0x15acf1-0x0;var _0x1a1312=_0xf398[_0x15acf1];return _0x1a1312;};'use strict';var _=require(_0x8f39('0x0'));var util=require(_0x8f39('0x1'));var moment=require(_0x8f39('0x2'));var BPromise=require(_0x8f39('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f39('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8f39('0x5'))(_0x8f39('0x6'));var config=require('../../config/environment');var jayson=require(_0x8f39('0x7'));var client=jayson[_0x8f39('0x8')]['http']({'port':0x232a});config[_0x8f39('0x9')]=_['defaults'](config['redis'],{'host':_0x8f39('0xa'),'port':0x18eb});var socket=require(_0x8f39('0xb'))(new Redis(config[_0x8f39('0x9')]));require(_0x8f39('0xc'))['register'](socket);function respondWithRpcPromise(_0x4170d1,_0x1a6f9a,_0x121eda){return new BPromise(function(_0x19830e,_0x30c22c){return client[_0x8f39('0xd')](_0x4170d1,_0x121eda)['then'](function(_0xf8100){logger[_0x8f39('0xe')]('Plugin,\x20%s,\x20%s',_0x1a6f9a,_0x8f39('0xf'));logger['debug'](_0x8f39('0x10'),_0x1a6f9a,_0x8f39('0xf'),JSON[_0x8f39('0x11')](_0xf8100));if(_0xf8100[_0x8f39('0x12')]){if(_0xf8100['error'][_0x8f39('0x13')]===0x1f4){logger[_0x8f39('0x12')](_0x8f39('0x14'),_0x1a6f9a,_0xf8100[_0x8f39('0x12')]['message']);return _0x30c22c(_0xf8100[_0x8f39('0x12')]['message']);}logger[_0x8f39('0x12')](_0x8f39('0x14'),_0x1a6f9a,_0xf8100['error'][_0x8f39('0x15')]);return _0x19830e(_0xf8100[_0x8f39('0x12')][_0x8f39('0x15')]);}else{logger[_0x8f39('0xe')]('Plugin,\x20%s,\x20%s',_0x1a6f9a,_0x8f39('0xf'));_0x19830e(_0xf8100['result']['message']);}})[_0x8f39('0x16')](function(_0x4b2da1){logger[_0x8f39('0x12')](_0x8f39('0x14'),_0x1a6f9a,_0x4b2da1);_0x30c22c(_0x4b2da1);});});}exports['CreatePlugin']=function(_0x35088c){var _0x95562f=this;return new Promise(function(_0x376172,_0xac3554){return db[_0x8f39('0x17')][_0x8f39('0x18')](_0x35088c[_0x8f39('0x19')],{'raw':_0x35088c[_0x8f39('0x1a')]?_0x35088c['options'][_0x8f39('0x1b')]===undefined?!![]:![]:!![]})[_0x8f39('0x1c')](function(_0xc0d0b9){logger[_0x8f39('0xe')](_0x8f39('0x1d'),_0x35088c);logger[_0x8f39('0x1e')](_0x8f39('0x1d'),_0x35088c,JSON['stringify'](_0xc0d0b9));_0x376172(_0xc0d0b9);})['catch'](function(_0x44f549){logger[_0x8f39('0x12')]('CreatePlugin',_0x44f549['message'],_0x35088c);_0xac3554(_0x95562f[_0x8f39('0x12')](0x1f4,_0x44f549[_0x8f39('0x15')]));});});}; \ No newline at end of file +var _0xa74b=['lodash','util','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','info','request\x20sent','debug','stringify','error','code','message','Plugin,\x20%s,\x20%s','result','CreatePlugin','Plugin','create','body','options','raw','then','catch'];(function(_0x1b187b,_0x8cbf86){var _0x3ee29e=function(_0x9b549a){while(--_0x9b549a){_0x1b187b['push'](_0x1b187b['shift']());}};_0x3ee29e(++_0x8cbf86);}(_0xa74b,0x140));var _0xba74=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xa74b[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xba74('0x0'));var util=require(_0xba74('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba74('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xba74('0x3'))(_0xba74('0x4'));var config=require('../../config/environment');var jayson=require(_0xba74('0x5'));var client=jayson[_0xba74('0x6')][_0xba74('0x7')]({'port':0x232a});config[_0xba74('0x8')]=_[_0xba74('0x9')](config[_0xba74('0x8')],{'host':_0xba74('0xa'),'port':0x18eb});var socket=require(_0xba74('0xb'))(new Redis(config[_0xba74('0x8')]));require(_0xba74('0xc'))[_0xba74('0xd')](socket);function respondWithRpcPromise(_0x26c8a6,_0x3dbb25,_0x37819a){return new BPromise(function(_0x1a45a7,_0xd20e64){return client[_0xba74('0xe')](_0x26c8a6,_0x37819a)['then'](function(_0x503d16){logger[_0xba74('0xf')]('Plugin,\x20%s,\x20%s',_0x3dbb25,_0xba74('0x10'));logger[_0xba74('0x11')]('Plugin,\x20%s,\x20%s,\x20%s',_0x3dbb25,_0xba74('0x10'),JSON[_0xba74('0x12')](_0x503d16));if(_0x503d16[_0xba74('0x13')]){if(_0x503d16[_0xba74('0x13')][_0xba74('0x14')]===0x1f4){logger[_0xba74('0x13')]('Plugin,\x20%s,\x20%s',_0x3dbb25,_0x503d16[_0xba74('0x13')][_0xba74('0x15')]);return _0xd20e64(_0x503d16[_0xba74('0x13')][_0xba74('0x15')]);}logger['error']('Plugin,\x20%s,\x20%s',_0x3dbb25,_0x503d16[_0xba74('0x13')]['message']);return _0x1a45a7(_0x503d16[_0xba74('0x13')][_0xba74('0x15')]);}else{logger[_0xba74('0xf')](_0xba74('0x16'),_0x3dbb25,'request\x20sent');_0x1a45a7(_0x503d16[_0xba74('0x17')]['message']);}})['catch'](function(_0x1c31d6){logger[_0xba74('0x13')]('Plugin,\x20%s,\x20%s',_0x3dbb25,_0x1c31d6);_0xd20e64(_0x1c31d6);});});}exports[_0xba74('0x18')]=function(_0x2f1d2f){var _0x3f9ed5=this;return new Promise(function(_0x2a4cc1,_0x568a92){return db[_0xba74('0x19')][_0xba74('0x1a')](_0x2f1d2f[_0xba74('0x1b')],{'raw':_0x2f1d2f[_0xba74('0x1c')]?_0x2f1d2f[_0xba74('0x1c')][_0xba74('0x1d')]===undefined?!![]:![]:!![]})[_0xba74('0x1e')](function(_0x3804a3){logger[_0xba74('0xf')](_0xba74('0x18'),_0x2f1d2f);logger['debug'](_0xba74('0x18'),_0x2f1d2f,JSON[_0xba74('0x12')](_0x3804a3));_0x2a4cc1(_0x3804a3);})[_0xba74('0x1f')](function(_0x3069df){logger[_0xba74('0x13')](_0xba74('0x18'),_0x3069df[_0xba74('0x15')],_0x2f1d2f);_0x568a92(_0x3f9ed5[_0xba74('0x13')](0x1f4,_0x3069df[_0xba74('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 15f0dfc..450901e 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 _0xe730=['plugin:','./plugin.events','save','remove','emit','removeListener','register'];(function(_0x156a48,_0x1a0543){var _0x4a654d=function(_0x5b0c46){while(--_0x5b0c46){_0x156a48['push'](_0x156a48['shift']());}};_0x4a654d(++_0x1a0543);}(_0xe730,0x10b));var _0x0e73=function(_0x538fa4,_0x3d8f72){_0x538fa4=_0x538fa4-0x0;var _0x854d2e=_0xe730[_0x538fa4];return _0x854d2e;};'use strict';var PluginEvents=require(_0x0e73('0x0'));var events=[_0x0e73('0x1'),_0x0e73('0x2'),'update'];function createListener(_0x5314ba,_0x11a886){return function(_0xced634){_0x11a886[_0x0e73('0x3')](_0x5314ba,_0xced634);};}function removeListener(_0x4fca6f,_0x5d9aed){return function(){PluginEvents[_0x0e73('0x4')](_0x4fca6f,_0x5d9aed);};}exports[_0x0e73('0x5')]=function(_0x519a50){for(var _0x1de94f=0x0,_0x54b01b=events['length'];_0x1de94f<_0x54b01b;_0x1de94f++){var _0x4e67e7=events[_0x1de94f];var _0x3dc51a=createListener(_0x0e73('0x6')+_0x4e67e7,_0x519a50);PluginEvents['on'](_0x4e67e7,_0x3dc51a);}}; \ No newline at end of file +var _0x4367=['save','remove','emit','removeListener','register','plugin:'];(function(_0x6f209f,_0x449fe8){var _0x3e840b=function(_0x46e925){while(--_0x46e925){_0x6f209f['push'](_0x6f209f['shift']());}};_0x3e840b(++_0x449fe8);}(_0x4367,0x144));var _0x7436=function(_0x80aaee,_0x53dd19){_0x80aaee=_0x80aaee-0x0;var _0x380b69=_0x4367[_0x80aaee];return _0x380b69;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x7436('0x0'),_0x7436('0x1'),'update'];function createListener(_0x4b9b88,_0x421982){return function(_0x28ee6f){_0x421982[_0x7436('0x2')](_0x4b9b88,_0x28ee6f);};}function removeListener(_0x3b74ed,_0x2b7533){return function(){PluginEvents[_0x7436('0x3')](_0x3b74ed,_0x2b7533);};}exports[_0x7436('0x4')]=function(_0x6dab5c){for(var _0x56e31d=0x0,_0x12dff7=events['length'];_0x56e31d<_0x12dff7;_0x56e31d++){var _0x4796f8=events[_0x56e31d];var _0xbcb048=createListener(_0x7436('0x5')+_0x4796f8,_0x6dab5c);PluginEvents['on'](_0x4796f8,_0xbcb048);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 114d641..7d06607 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(_0x2734fe,_0x43ff50){var _0x39bcd2=function(_0x3d79f1){while(--_0x3d79f1){_0x2734fe['push'](_0x2734fe['shift']());}};_0x39bcd2(++_0x43ff50);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x2ba529,_0x125df9){var _0x14d3b5=function(_0xd4677f){while(--_0xd4677f){_0x2ba529['push'](_0x2ba529['shift']());}};_0x14d3b5(++_0x125df9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 46e142a..eecb035 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 _0xbee3=['sendStatus','status','json','error','name','send','info','index','then','reject','length','describe','params','catch','create','body','join','script','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','restart','stop','Unknown\x20id','../../config/pm2','path','child_process','bluebird'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xbee3,0xd5));var _0x3bee=function(_0x2d68bf,_0x47da5f){_0x2d68bf=_0x2d68bf-0x0;var _0x5f1a5b=_0xbee3[_0x2d68bf];return _0x5f1a5b;};'use strict';var _=require('lodash');var pm2=require(_0x3bee('0x0'));var logger=require('../../config/logger')('api');var path=require(_0x3bee('0x1'));var exec=require(_0x3bee('0x2'))['exec'];var BPromise=require(_0x3bee('0x3'));function handleEntityNotFound(_0x1956c1,_0x1cf379){return function(_0x507c6a){if(!_0x507c6a){_0x1956c1[_0x3bee('0x4')](0x194);;}return _0x507c6a;};}function respondWithResult(_0x3baf77,_0x4c5ef5){_0x4c5ef5=_0x4c5ef5||0xc8;return function(_0x2fdeec){if(_0x2fdeec){return _0x3baf77[_0x3bee('0x5')](_0x4c5ef5)[_0x3bee('0x6')](_0x2fdeec);}return null;};}function handleError(_0x339223,_0xbdd5d5){_0xbdd5d5=_0xbdd5d5||0x1f4;return function(_0x9aab05){logger[_0x3bee('0x7')](_0x9aab05['stack']);if(_0x9aab05[_0x3bee('0x8')]){delete _0x9aab05[_0x3bee('0x8')];}_0x339223[_0x3bee('0x5')](_0xbdd5d5)[_0x3bee('0x9')](_0x9aab05);};}function execChildProcess(){return new BPromise(function(_0x356fef,_0xc53ada){exec('npm\x20install',function(_0x32c0b,_0x5bb283,_0x2da716){logger[_0x3bee('0xa')](_0x5bb283);logger[_0x3bee('0xa')](_0x2da716);if(_0x32c0b){logger[_0x3bee('0x7')](_0x32c0b);return _0xc53ada(_0x32c0b);}return _0x356fef(_0x5bb283);});});}exports[_0x3bee('0xb')]=function(_0x459129,_0xc8c1f0){return pm2['list']()[_0x3bee('0xc')](function(_0x33504d){if(_0x33504d){var _0x31ac52=_[_0x3bee('0xd')](_0x33504d,function(_0x3a0396){return _0x3a0396['name']==='express'||_0x3a0396[_0x3bee('0x8')]==='motion2';});return{'rows':_0x31ac52,'count':_0x31ac52[_0x3bee('0xe')]};}return null;})[_0x3bee('0xc')](respondWithResult(_0xc8c1f0,null))['catch'](handleError(_0xc8c1f0,null));};exports['show']=function(_0x1582a4,_0x36c5aa){return pm2[_0x3bee('0xf')](_0x1582a4[_0x3bee('0x10')]['id'])['then'](respondWithResult(_0x36c5aa,null))[_0x3bee('0xc')](handleEntityNotFound(_0x36c5aa,null))[_0x3bee('0x11')](handleError(_0x36c5aa,null));};exports[_0x3bee('0x12')]=function(_0x49b32d,_0x33d812){if(_0x49b32d[_0x3bee('0x13')][_0x3bee('0x8')]&&_0x49b32d['body']['script']){var _0x1afd0f=path[_0x3bee('0x14')](__dirname,'../../files/plugins',_0x49b32d[_0x3bee('0x13')][_0x3bee('0x15')]);var _0x2eea75=process[_0x3bee('0x16')]();process[_0x3bee('0x17')](path[_0x3bee('0x18')](_0x1afd0f));return execChildProcess()[_0x3bee('0xc')](function(_0x582fa9){process[_0x3bee('0x17')](_0x2eea75);return pm2[_0x3bee('0x19')]({'name':_0x49b32d[_0x3bee('0x13')][_0x3bee('0x8')],'script':_0x1afd0f});})['then'](function(_0x45249c){pm2[_0x3bee('0x1a')]();return _0x45249c[0x0];})[_0x3bee('0xc')](respondWithResult(_0x33d812,0xc9))['catch'](handleError(_0x33d812,null));}else{return _0x33d812['status'](0x1f4)[_0x3bee('0x9')]({'message':_0x3bee('0x1b')});}};exports['update']=function(_0x2c0e50,_0x1b4ce0){if(_0x2c0e50[_0x3bee('0x13')]['id']){delete _0x2c0e50['body']['id'];}var _0x1984c4={'online':_0x3bee('0x1c'),'stopped':_0x3bee('0x1d')};if(_0x1984c4['hasOwnProperty'](_0x2c0e50[_0x3bee('0x13')][_0x3bee('0x5')])){return pm2[_0x1984c4[_0x2c0e50[_0x3bee('0x13')]['status']]](_0x2c0e50[_0x3bee('0x10')]['id'])[_0x3bee('0xc')](respondWithResult(_0x1b4ce0,0xc8))[_0x3bee('0x11')](handleError(_0x1b4ce0,null));}else{return _0x1b4ce0[_0x3bee('0x5')](0x1f4)[_0x3bee('0x9')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x3fbc8c,_0x1e1529){if(_0x3fbc8c[_0x3bee('0x13')]['id']){delete _0x3fbc8c[_0x3bee('0x13')]['id'];}if(_0x3fbc8c['params']['id']){return pm2['delete'](_0x3fbc8c[_0x3bee('0x10')]['id'])[_0x3bee('0xc')](function(_0x4f5b58){pm2['dump']();return _0x4f5b58[0x0];})[_0x3bee('0xc')](respondWithResult(_0x1e1529,null))[_0x3bee('0x11')](handleError(_0x1e1529,null));}else{return _0x1e1529[_0x3bee('0x5')](0x1f4)[_0x3bee('0x9')]({'message':_0x3bee('0x1e')});}}; \ No newline at end of file +var _0xeffd=['dump','Unknown\x20id','lodash','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','info','then','reject','express','motion2','length','params','catch','create','body','script','cwd','dirname','start','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty'];(function(_0x510a50,_0x47bf51){var _0x4c90c2=function(_0x3ea5c1){while(--_0x3ea5c1){_0x510a50['push'](_0x510a50['shift']());}};_0x4c90c2(++_0x47bf51);}(_0xeffd,0x6b));var _0xdeff=function(_0x27ef8c,_0x17fa0c){_0x27ef8c=_0x27ef8c-0x0;var _0x10da80=_0xeffd[_0x27ef8c];return _0x10da80;};'use strict';var _=require(_0xdeff('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xdeff('0x1'))(_0xdeff('0x2'));var path=require(_0xdeff('0x3'));var exec=require(_0xdeff('0x4'))[_0xdeff('0x5')];var BPromise=require(_0xdeff('0x6'));function handleEntityNotFound(_0x298274,_0x2881fd){return function(_0x8315d4){if(!_0x8315d4){_0x298274[_0xdeff('0x7')](0x194);;}return _0x8315d4;};}function respondWithResult(_0x1ed641,_0x132631){_0x132631=_0x132631||0xc8;return function(_0x281ad7){if(_0x281ad7){return _0x1ed641[_0xdeff('0x8')](_0x132631)[_0xdeff('0x9')](_0x281ad7);}return null;};}function handleError(_0x12e953,_0x24897a){_0x24897a=_0x24897a||0x1f4;return function(_0x540ae6){logger[_0xdeff('0xa')](_0x540ae6[_0xdeff('0xb')]);if(_0x540ae6[_0xdeff('0xc')]){delete _0x540ae6['name'];}_0x12e953[_0xdeff('0x8')](_0x24897a)[_0xdeff('0xd')](_0x540ae6);};}function execChildProcess(){return new BPromise(function(_0x3c1482,_0x192195){exec(_0xdeff('0xe'),function(_0x256b73,_0x2e9783,_0x402075){logger['info'](_0x2e9783);logger[_0xdeff('0xf')](_0x402075);if(_0x256b73){logger[_0xdeff('0xa')](_0x256b73);return _0x192195(_0x256b73);}return _0x3c1482(_0x2e9783);});});}exports['index']=function(_0x2e614c,_0x4e7526){return pm2['list']()[_0xdeff('0x10')](function(_0x47410f){if(_0x47410f){var _0x1585e8=_[_0xdeff('0x11')](_0x47410f,function(_0x48f0e8){return _0x48f0e8[_0xdeff('0xc')]===_0xdeff('0x12')||_0x48f0e8[_0xdeff('0xc')]===_0xdeff('0x13');});return{'rows':_0x1585e8,'count':_0x1585e8[_0xdeff('0x14')]};}return null;})[_0xdeff('0x10')](respondWithResult(_0x4e7526,null))['catch'](handleError(_0x4e7526,null));};exports['show']=function(_0x7440af,_0x4cf724){return pm2['describe'](_0x7440af[_0xdeff('0x15')]['id'])[_0xdeff('0x10')](respondWithResult(_0x4cf724,null))['then'](handleEntityNotFound(_0x4cf724,null))[_0xdeff('0x16')](handleError(_0x4cf724,null));};exports[_0xdeff('0x17')]=function(_0x1ab1fa,_0x3a677a){if(_0x1ab1fa[_0xdeff('0x18')][_0xdeff('0xc')]&&_0x1ab1fa[_0xdeff('0x18')][_0xdeff('0x19')]){var _0x488faa=path['join'](__dirname,'../../files/plugins',_0x1ab1fa[_0xdeff('0x18')]['script']);var _0x189627=process[_0xdeff('0x1a')]();process['chdir'](path[_0xdeff('0x1b')](_0x488faa));return execChildProcess()[_0xdeff('0x10')](function(_0x4eb2a8){process['chdir'](_0x189627);return pm2[_0xdeff('0x1c')]({'name':_0x1ab1fa[_0xdeff('0x18')][_0xdeff('0xc')],'script':_0x488faa});})[_0xdeff('0x10')](function(_0x32add9){pm2['dump']();return _0x32add9[0x0];})[_0xdeff('0x10')](respondWithResult(_0x3a677a,0xc9))[_0xdeff('0x16')](handleError(_0x3a677a,null));}else{return _0x3a677a[_0xdeff('0x8')](0x1f4)[_0xdeff('0xd')]({'message':_0xdeff('0x1d')});}};exports[_0xdeff('0x1e')]=function(_0x3d0111,_0x52ea5d){if(_0x3d0111[_0xdeff('0x18')]['id']){delete _0x3d0111[_0xdeff('0x18')]['id'];}var _0x53b168={'online':'restart','stopped':_0xdeff('0x1f')};if(_0x53b168[_0xdeff('0x20')](_0x3d0111[_0xdeff('0x18')][_0xdeff('0x8')])){return pm2[_0x53b168[_0x3d0111[_0xdeff('0x18')][_0xdeff('0x8')]]](_0x3d0111[_0xdeff('0x15')]['id'])['then'](respondWithResult(_0x52ea5d,0xc8))[_0xdeff('0x16')](handleError(_0x52ea5d,null));}else{return _0x52ea5d[_0xdeff('0x8')](0x1f4)[_0xdeff('0xd')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x346743,_0x505e3f){if(_0x346743[_0xdeff('0x18')]['id']){delete _0x346743[_0xdeff('0x18')]['id'];}if(_0x346743[_0xdeff('0x15')]['id']){return pm2['delete'](_0x346743[_0xdeff('0x15')]['id'])['then'](function(_0x4ba2b2){pm2[_0xdeff('0x21')]();return _0x4ba2b2[0x0];})[_0xdeff('0x10')](respondWithResult(_0x505e3f,null))[_0xdeff('0x16')](handleError(_0x505e3f,null));}else{return _0x505e3f[_0xdeff('0x8')](0x1f4)['send']({'message':_0xdeff('0x22')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 70ebb0f..3e472de 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 _0x9874=['../../components/auth/service','./realtime.controller','get','/agents','getAgents','/queues','getQueues','express','Router'];(function(_0x5eb647,_0x9a3cda){var _0x1c1799=function(_0x4ff061){while(--_0x4ff061){_0x5eb647['push'](_0x5eb647['shift']());}};_0x1c1799(++_0x9a3cda);}(_0x9874,0xa0));var _0x4987=function(_0x5103be,_0x17d217){_0x5103be=_0x5103be-0x0;var _0x222b19=_0x9874[_0x5103be];return _0x222b19;};'use strict';var express=require(_0x4987('0x0'));var router=express[_0x4987('0x1')]();var auth=require(_0x4987('0x2'));var controller=require(_0x4987('0x3'));router[_0x4987('0x4')](_0x4987('0x5'),auth['isAuthenticated'](),controller[_0x4987('0x6')]);router[_0x4987('0x4')](_0x4987('0x7'),auth['isAuthenticated'](),controller[_0x4987('0x8')]);module['exports']=router; \ No newline at end of file +var _0x5d70=['/queues','getQueues','exports','express','Router','../../components/auth/service','get','/agents','isAuthenticated','getAgents'];(function(_0x88620a,_0x1bc1d5){var _0x28983a=function(_0x2fef0c){while(--_0x2fef0c){_0x88620a['push'](_0x88620a['shift']());}};_0x28983a(++_0x1bc1d5);}(_0x5d70,0xad));var _0x05d7=function(_0x13dc6c,_0xa92a5b){_0x13dc6c=_0x13dc6c-0x0;var _0x334b66=_0x5d70[_0x13dc6c];return _0x334b66;};'use strict';var express=require(_0x05d7('0x0'));var router=express[_0x05d7('0x1')]();var auth=require(_0x05d7('0x2'));var controller=require('./realtime.controller');router[_0x05d7('0x3')](_0x05d7('0x4'),auth[_0x05d7('0x5')](),controller[_0x05d7('0x6')]);router[_0x05d7('0x3')](_0x05d7('0x7'),auth[_0x05d7('0x5')](),controller[_0x05d7('0x8')]);module[_0x05d7('0x9')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 554064b..3fc5c53 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 _0x9962=['catch','format','Queue','fieldName','type','name','voice','outbound','dialActive','dialMethod','join','startCase','Queues','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','offset','limit','count','status','set','Content-Range','json','getAgents','globalQueueFilter','query','globalStatusFilter','pause','resolve','then','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','getUpdatedSortOptions','order','getRealtimeAgents','getAgentIdsByStatus','length','map','User','rawAttributes','key','role','agent','online','raw','push','sequelize','FIELD(id,','*pause','forEach','Pause','merge','user','userProfileId','Agents','extraQueryConditions','assign','UserProfile','findAndCountAll','rows','filterAgentAttributes','globalStatus','getAgentStatus','includes','Status','sortAgentsByStatus','fields','pick'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x9962,0x1e3));var _0x2996=function(_0x9f0ed,_0x1ac1fe){_0x9f0ed=_0x9f0ed-0x0;var _0x3a4edc=_0x9962[_0x9f0ed];return _0x3a4edc;};'use strict';var _=require(_0x2996('0x0'));var util=require(_0x2996('0x1'));var rta=require('../../components/realtime/agents');var rtq=require(_0x2996('0x2'));var qs=require(_0x2996('0x3'));var utils=require(_0x2996('0x4'));var db=require(_0x2996('0x5'))['db'];var APIBadRequestError=require(_0x2996('0x6'))[_0x2996('0x7')];var APIHandleError=require(_0x2996('0x6'))['handleError'];function respondWithFilteredResult(_0x20508e,_0x10d770){return function(_0xb28597){if(_0xb28597){var _0x56e84c=typeof _0x10d770[_0x2996('0x8')]==='undefined'&&typeof _0x10d770[_0x2996('0x9')]==='undefined';var _0x46ad79=_0xb28597[_0x2996('0xa')];var _0x531166=_0x56e84c?0x0:_0x10d770[_0x2996('0x8')];var _0x2d2bf0=_0x56e84c?_0xb28597[_0x2996('0xa')]:_0x10d770[_0x2996('0x8')]+_0x10d770['limit'];var _0x14564e;if(_0x2d2bf0>=_0x46ad79){_0x2d2bf0=_0x46ad79;_0x14564e=0xc8;}else{_0x14564e=0xce;}_0x20508e[_0x2996('0xb')](_0x14564e);return _0x20508e[_0x2996('0xc')](_0x2996('0xd'),_0x531166+'-'+_0x2d2bf0+'/'+_0x46ad79)[_0x2996('0xe')](_0xb28597);}return null;};}exports[_0x2996('0xf')]=function(_0xa5a223,_0x29c8cb){var _0x4c225e={'count':0x0,'rows':[]};var _0x1f2404={};var _0x4f0003;var _0x872070=utils['getChannels']();var _0x367df0;var _0x28dee5;var _0x5128f1=_0xa5a223['query'][_0x2996('0x10')];var _0x52271e=_0xa5a223[_0x2996('0x11')][_0x2996('0x12')];var _0x3005b7=_0xa5a223['query']['pauseTypeFilter'];var _0x1089dc=_0x52271e===_0x2996('0x13')||_0x52271e==='*pause'?!![]:![];var _0x49f2ce=[];var _0x3063f1;var _0x58acc8;Promise[_0x2996('0x14')]()[_0x2996('0x15')](function(){if(_0xa5a223[_0x2996('0x11')][_0x2996('0x16')]){if(!utils[_0x2996('0x17')](_0xa5a223[_0x2996('0x11')]['channel'])){throw new APIBadRequestError(util['format'](_0x2996('0x18'),_0xa5a223[_0x2996('0x11')][_0x2996('0x16')]));}_0x4f0003=_0xa5a223[_0x2996('0x11')][_0x2996('0x16')][_0x2996('0x19')]();}if(!_0xa5a223[_0x2996('0x11')]['sort']||!_0xa5a223[_0x2996('0x11')]['sort']['includes']('globalStatus')){_0xa5a223['query'][_0x2996('0x1a')]=rta['validateSortParameter'](_0xa5a223[_0x2996('0x11')]['sort']);return;}var _0x19f616=rta[_0x2996('0x1b')](_0xa5a223[_0x2996('0x11')][_0x2996('0x1a')]);_0xa5a223[_0x2996('0x11')][_0x2996('0x1a')]=_0x19f616['fields']['join'](',');_0x3063f1=_0x19f616[_0x2996('0x1c')];})[_0x2996('0x15')](function(){if(!_0x5128f1){return[];}return rta['getAgentIdsByQueues'](_0x5128f1,_0x4f0003);})[_0x2996('0x15')](function(_0x4e3bb9){_0x49f2ce=_0x4e3bb9;return rta[_0x2996('0x1d')]();})[_0x2996('0x15')](function(_0x568bff){_0x28dee5=_0x568bff['rows'];if((!_0x52271e||_0x1089dc)&&!_0x3063f1){return _0x49f2ce;}if(_0x3063f1&&!_0x52271e){return rta['getSortedAgentsIdsByStatus'](_0x28dee5,_0x49f2ce,_0x3063f1);}else{return rta[_0x2996('0x1e')](_0x28dee5,_0x49f2ce,_0x52271e);}})[_0x2996('0x15')](function(_0x4c8752){_0x49f2ce=_0x4c8752;var _0x1ee8fa=![];if(_0x49f2ce[_0x2996('0x1f')]===0x0){if(_0x5128f1||_0x52271e){_0x1ee8fa=!![];}if(_0x1089dc){_0x1ee8fa=![];}}if(_0x1ee8fa){return _0x4c225e;}var _0x46e28e=_[_0x2996('0x20')](db[_0x2996('0x21')][_0x2996('0x22')],function(_0x112ce4){return{'name':_0x112ce4['fieldName'],'type':_0x112ce4['type'][_0x2996('0x23')]};});_0xa5a223[_0x2996('0x11')][_0x2996('0x24')]=_0x2996('0x25');_0xa5a223[_0x2996('0x11')][_0x2996('0x26')]=!![];_0x1f2404=qs['getOptions'](_0x46e28e,_0xa5a223);_0x1f2404[_0x2996('0x27')]=!![];var _0xfcb8ed=[];if(_0x49f2ce['length']>0x0){_0xfcb8ed[_0x2996('0x28')]({'id':{'$in':_0x49f2ce}});if(_0x3063f1&&!_0x52271e){_0x58acc8=[db[_0x2996('0x29')]['literal'](_0x2996('0x2a')+_0x49f2ce+')')];_0x1f2404['order']=_0x58acc8;}}if(_0x1089dc){_0x872070['forEach'](function(_0xcf4b4a){var _0x28db70=!![];if(_0x52271e===_0x2996('0x2b')&&_0x4f0003!==_0xcf4b4a){_0x28db70=![];}_0xfcb8ed[_0x2996('0x28')]({[_0xcf4b4a+'Pause']:_0x28db70});});if(_0x3005b7){_0xfcb8ed['push']({'pauseType':_0x3005b7});}}else if(_0x52271e){_0x872070[_0x2996('0x2c')](function(_0xc5bc6a){_0xfcb8ed[_0x2996('0x28')]({[_0xc5bc6a+_0x2996('0x2d')]:![]});});}_0x1f2404['where']=_[_0x2996('0x2e')](_0x1f2404['where'],{'$and':_0xfcb8ed});if(_0xa5a223['user']['role']===_0x2996('0x2f')){var _0x1a2b6f={'params':{'id':_0xa5a223[_0x2996('0x2f')][_0x2996('0x30')]},'query':{'section':_0x2996('0x31'),'role':_0x2996('0x25'),'online':!![],'raw':!![],'ids':_0x49f2ce,'customSorting':_0x58acc8}};if(_0x1089dc){_0x1a2b6f['query'][_0x2996('0x32')]=_0xfcb8ed;}_0x1a2b6f[_0x2996('0x11')]=Object[_0x2996('0x33')](_0x1a2b6f['query'],_0xa5a223[_0x2996('0x11')]);delete _0x1a2b6f[_0x2996('0x11')]['id'];return db[_0x2996('0x34')]['getResources'](_0x1a2b6f);}return db[_0x2996('0x21')][_0x2996('0x35')](_0x1f2404);})['then'](function(_0x4f2fa1){_0x4c225e['count']=_0x4f2fa1[_0x2996('0xa')];_0x367df0=_0x4f2fa1[_0x2996('0x36')];return _0x367df0[_0x2996('0x20')](function(_0x5d571f){var _0xaaa108=_['find'](_0x28dee5,['id',_0x5d571f['id']]);if(_0xaaa108){var _0x4bd534=rta[_0x2996('0x37')](_0xaaa108);_[_0x2996('0x2e')](_0x5d571f,_0x4bd534);}_0x5d571f[_0x2996('0x38')]=rta[_0x2996('0x39')](_0x5d571f);if(_0x5d571f[_0x2996('0x38')][_0x2996('0x3a')](_0x2996('0x13'))){_0x872070['forEach'](function(_0x6dd051){if(_0x5d571f[_0x6dd051+'Pause']){_0x5d571f[_0x6dd051+_0x2996('0x3b')]=_0x2996('0x13');}});}return _0x5d571f;});})[_0x2996('0x15')](function(_0xe2eda4){if(!_0x3063f1||_0x58acc8){return _0xe2eda4;}return rta[_0x2996('0x3c')](_0xe2eda4,_0x3063f1);})[_0x2996('0x15')](function(_0x179e57){var _0xf67f87=null;if(_0xa5a223[_0x2996('0x11')][_0x2996('0x3d')]){var _0x2a1759=_0xa5a223['query']['fields']['split'](',');_0xf67f87=_0x179e57[_0x2996('0x20')](function(_0x3e0d78){return _[_0x2996('0x3e')](_0x3e0d78,_0x2a1759);});}_0x4c225e[_0x2996('0x36')]=_0xf67f87||_0x179e57;return _0x4c225e;})[_0x2996('0x15')](respondWithFilteredResult(_0x29c8cb,_0x1f2404))[_0x2996('0x3f')](APIHandleError(_0x29c8cb));};exports['getQueues']=function(_0x228ef2,_0x24bf97){var _0x58a5f6={'count':0x0,'rows':[]};var _0x5ab54c={};var _0x46b389;var _0x223e75;var _0x44acc9;Promise[_0x2996('0x14')]()[_0x2996('0x15')](function(){if(_0x228ef2[_0x2996('0x11')][_0x2996('0x16')]){if(!utils[_0x2996('0x17')](_0x228ef2['query'][_0x2996('0x16')])){throw new APIBadRequestError(util[_0x2996('0x40')](_0x2996('0x18'),_0x228ef2[_0x2996('0x11')][_0x2996('0x16')]));}_0x46b389=_0x228ef2[_0x2996('0x11')][_0x2996('0x16')][_0x2996('0x19')]();}var _0x72d6bd=_['startCase'](_0x46b389)+_0x2996('0x41');var _0x4200e8=_[_0x2996('0x20')](db[_0x72d6bd][_0x2996('0x22')],function(_0x580f0e){return{'name':_0x580f0e[_0x2996('0x42')],'type':_0x580f0e[_0x2996('0x43')]['key']};});if(!_0x228ef2[_0x2996('0x11')][_0x2996('0x3d')]){var _0x3f361f=['id',_0x2996('0x44')];if(_0x46b389===_0x2996('0x45')){_0x3f361f[_0x2996('0x28')](_0x2996('0x43'));if(_0x228ef2[_0x2996('0x11')][_0x2996('0x43')]===_0x2996('0x46')){_0x3f361f['push']([_0x2996('0x47'),_0x2996('0x48')]);}}_0x228ef2['query'][_0x2996('0x3d')]=_0x3f361f[_0x2996('0x49')](',');}_0x5ab54c=qs['getOptions'](_0x4200e8,_0x228ef2);if(_0x228ef2[_0x2996('0x2f')][_0x2996('0x24')]===_0x2996('0x2f')){var _0x57c893={'params':{'id':_0x228ef2[_0x2996('0x2f')][_0x2996('0x30')]},'query':{'section':_0x46b389===_0x2996('0x45')&&_0x228ef2[_0x2996('0x11')][_0x2996('0x43')]===_0x2996('0x46')?'QueueCampaigns':_[_0x2996('0x4a')](_0x46b389)+_0x2996('0x4b'),'type':_0x228ef2[_0x2996('0x11')][_0x2996('0x43')],'nolimit':!![],'sort':_0x2996('0x44'),'filter':_0x228ef2[_0x2996('0x11')]['filter']}};return db['UserProfile']['getResources'](_0x57c893);}return db[_0x72d6bd][_0x2996('0x35')](_0x5ab54c);})[_0x2996('0x15')](function(_0x19d604){_0x58a5f6[_0x2996('0xa')]=_0x19d604['count'];_0x223e75=_0x19d604[_0x2996('0x36')];return rtq[_0x2996('0x4c')](_0x228ef2,_0x46b389);})[_0x2996('0x15')](function(_0xaf6bb2){_0x44acc9=_0xaf6bb2[_0x2996('0x36')];return rtq[_0x2996('0x4d')](_0x223e75,_0x44acc9,_0x46b389,_0x228ef2[_0x2996('0x11')][_0x2996('0x43')]);})['then'](function(_0x3d166d){_0x58a5f6[_0x2996('0x36')]=_0x3d166d;return _0x58a5f6;})[_0x2996('0x15')](respondWithFilteredResult(_0x24bf97,_0x5ab54c))['catch'](APIHandleError(_0x24bf97));}; \ No newline at end of file +var _0x45e3=['push','sequelize','FIELD(id,','forEach','*pause','Pause','where','merge','user','userProfileId','Agents','extraQueryConditions','getResources','findAndCountAll','find','filterAgentAttributes','getAgentStatus','Status','sortAgentsByStatus','split','pick','catch','getQueues','isValidChannel','startCase','map','rawAttributes','key','name','voice','outbound','dialMethod','getOptions','QueueCampaigns','Queues','UserProfile','getRealtimeQueues','initializeQueues','util','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','APIBadRequestError','../../errors/api','handleError','undefined','offset','count','limit','status','set','json','getAgents','getChannels','query','globalStatusFilter','pause','resolve','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','getUpdatedSortOptions','fields','join','order','then','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','length','User','fieldName','type','role','agent','online','raw'];(function(_0x37cc86,_0x235362){var _0x2fba2e=function(_0x4bf8b2){while(--_0x4bf8b2){_0x37cc86['push'](_0x37cc86['shift']());}};_0x2fba2e(++_0x235362);}(_0x45e3,0x16a));var _0x345e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x45e3[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var util=require(_0x345e('0x0'));var rta=require('../../components/realtime/agents');var rtq=require(_0x345e('0x1'));var qs=require(_0x345e('0x2'));var utils=require(_0x345e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require('../../errors/api')[_0x345e('0x4')];var APIHandleError=require(_0x345e('0x5'))[_0x345e('0x6')];function respondWithFilteredResult(_0x27cc87,_0x5f4594){return function(_0x91f8b0){if(_0x91f8b0){var _0x35fa4c=typeof _0x5f4594['offset']===_0x345e('0x7')&&typeof _0x5f4594['limit']===_0x345e('0x7');var _0x4deb7c=_0x91f8b0['count'];var _0x1e9c52=_0x35fa4c?0x0:_0x5f4594[_0x345e('0x8')];var _0x47cb1d=_0x35fa4c?_0x91f8b0[_0x345e('0x9')]:_0x5f4594[_0x345e('0x8')]+_0x5f4594[_0x345e('0xa')];var _0x5b406a;if(_0x47cb1d>=_0x4deb7c){_0x47cb1d=_0x4deb7c;_0x5b406a=0xc8;}else{_0x5b406a=0xce;}_0x27cc87[_0x345e('0xb')](_0x5b406a);return _0x27cc87[_0x345e('0xc')]('Content-Range',_0x1e9c52+'-'+_0x47cb1d+'/'+_0x4deb7c)[_0x345e('0xd')](_0x91f8b0);}return null;};}exports[_0x345e('0xe')]=function(_0x5c3779,_0x230465){var _0x47764e={'count':0x0,'rows':[]};var _0x255f03={};var _0xa02faa;var _0x40b1b8=utils[_0x345e('0xf')]();var _0x11c086;var _0x2c87a4;var _0xb01497=_0x5c3779[_0x345e('0x10')]['globalQueueFilter'];var _0x2aecd1=_0x5c3779[_0x345e('0x10')][_0x345e('0x11')];var _0x463837=_0x5c3779['query']['pauseTypeFilter'];var _0x370d34=_0x2aecd1===_0x345e('0x12')||_0x2aecd1==='*pause'?!![]:![];var _0x8a83c7=[];var _0xbbdbaa;var _0x5c2b9f;Promise[_0x345e('0x13')]()['then'](function(){if(_0x5c3779[_0x345e('0x10')][_0x345e('0x14')]){if(!utils['isValidChannel'](_0x5c3779['query'][_0x345e('0x14')])){throw new APIBadRequestError(util[_0x345e('0x15')](_0x345e('0x16'),_0x5c3779['query'][_0x345e('0x14')]));}_0xa02faa=_0x5c3779[_0x345e('0x10')][_0x345e('0x14')][_0x345e('0x17')]();}if(!_0x5c3779[_0x345e('0x10')]['sort']||!_0x5c3779['query'][_0x345e('0x18')][_0x345e('0x19')](_0x345e('0x1a'))){_0x5c3779['query'][_0x345e('0x18')]=rta['validateSortParameter'](_0x5c3779[_0x345e('0x10')][_0x345e('0x18')]);return;}var _0x231436=rta[_0x345e('0x1b')](_0x5c3779[_0x345e('0x10')][_0x345e('0x18')]);_0x5c3779['query'][_0x345e('0x18')]=_0x231436[_0x345e('0x1c')][_0x345e('0x1d')](',');_0xbbdbaa=_0x231436[_0x345e('0x1e')];})[_0x345e('0x1f')](function(){if(!_0xb01497){return[];}return rta[_0x345e('0x20')](_0xb01497,_0xa02faa);})[_0x345e('0x1f')](function(_0x5406f1){_0x8a83c7=_0x5406f1;return rta['getRealtimeAgents']();})['then'](function(_0x5ad88d){_0x2c87a4=_0x5ad88d[_0x345e('0x21')];if((!_0x2aecd1||_0x370d34)&&!_0xbbdbaa){return _0x8a83c7;}if(_0xbbdbaa&&!_0x2aecd1){return rta[_0x345e('0x22')](_0x2c87a4,_0x8a83c7,_0xbbdbaa);}else{return rta['getAgentIdsByStatus'](_0x2c87a4,_0x8a83c7,_0x2aecd1);}})['then'](function(_0x321af8){_0x8a83c7=_0x321af8;var _0x25469c=![];if(_0x8a83c7[_0x345e('0x23')]===0x0){if(_0xb01497||_0x2aecd1){_0x25469c=!![];}if(_0x370d34){_0x25469c=![];}}if(_0x25469c){return _0x47764e;}var _0x8b50dc=_['map'](db[_0x345e('0x24')]['rawAttributes'],function(_0x45d8b3){return{'name':_0x45d8b3[_0x345e('0x25')],'type':_0x45d8b3[_0x345e('0x26')]['key']};});_0x5c3779[_0x345e('0x10')][_0x345e('0x27')]=_0x345e('0x28');_0x5c3779[_0x345e('0x10')][_0x345e('0x29')]=!![];_0x255f03=qs['getOptions'](_0x8b50dc,_0x5c3779);_0x255f03[_0x345e('0x2a')]=!![];var _0x192bb2=[];if(_0x8a83c7[_0x345e('0x23')]>0x0){_0x192bb2[_0x345e('0x2b')]({'id':{'$in':_0x8a83c7}});if(_0xbbdbaa&&!_0x2aecd1){_0x5c2b9f=[db[_0x345e('0x2c')]['literal'](_0x345e('0x2d')+_0x8a83c7+')')];_0x255f03[_0x345e('0x1e')]=_0x5c2b9f;}}if(_0x370d34){_0x40b1b8[_0x345e('0x2e')](function(_0x3c0aed){var _0x43cc6b=!![];if(_0x2aecd1===_0x345e('0x2f')&&_0xa02faa!==_0x3c0aed){_0x43cc6b=![];}_0x192bb2[_0x345e('0x2b')]({[_0x3c0aed+'Pause']:_0x43cc6b});});if(_0x463837){_0x192bb2[_0x345e('0x2b')]({'pauseType':_0x463837});}}else if(_0x2aecd1){_0x40b1b8[_0x345e('0x2e')](function(_0x2453bb){_0x192bb2[_0x345e('0x2b')]({[_0x2453bb+_0x345e('0x30')]:![]});});}_0x255f03[_0x345e('0x31')]=_[_0x345e('0x32')](_0x255f03[_0x345e('0x31')],{'$and':_0x192bb2});if(_0x5c3779[_0x345e('0x33')][_0x345e('0x27')]===_0x345e('0x33')){var _0x2f5b73={'params':{'id':_0x5c3779[_0x345e('0x33')][_0x345e('0x34')]},'query':{'section':_0x345e('0x35'),'role':_0x345e('0x28'),'online':!![],'raw':!![],'ids':_0x8a83c7,'customSorting':_0x5c2b9f}};if(_0x370d34){_0x2f5b73['query'][_0x345e('0x36')]=_0x192bb2;}_0x2f5b73['query']=Object['assign'](_0x2f5b73[_0x345e('0x10')],_0x5c3779[_0x345e('0x10')]);delete _0x2f5b73[_0x345e('0x10')]['id'];return db['UserProfile'][_0x345e('0x37')](_0x2f5b73);}return db['User'][_0x345e('0x38')](_0x255f03);})[_0x345e('0x1f')](function(_0x109c7f){_0x47764e[_0x345e('0x9')]=_0x109c7f[_0x345e('0x9')];_0x11c086=_0x109c7f[_0x345e('0x21')];return _0x11c086['map'](function(_0x5d90f5){var _0x432461=_[_0x345e('0x39')](_0x2c87a4,['id',_0x5d90f5['id']]);if(_0x432461){var _0x577c63=rta[_0x345e('0x3a')](_0x432461);_[_0x345e('0x32')](_0x5d90f5,_0x577c63);}_0x5d90f5[_0x345e('0x1a')]=rta[_0x345e('0x3b')](_0x5d90f5);if(_0x5d90f5[_0x345e('0x1a')]['includes'](_0x345e('0x12'))){_0x40b1b8[_0x345e('0x2e')](function(_0x13902c){if(_0x5d90f5[_0x13902c+_0x345e('0x30')]){_0x5d90f5[_0x13902c+_0x345e('0x3c')]='pause';}});}return _0x5d90f5;});})[_0x345e('0x1f')](function(_0x410af9){if(!_0xbbdbaa||_0x5c2b9f){return _0x410af9;}return rta[_0x345e('0x3d')](_0x410af9,_0xbbdbaa);})[_0x345e('0x1f')](function(_0x4d7b6e){var _0x4b553a=null;if(_0x5c3779['query'][_0x345e('0x1c')]){var _0x1f126c=_0x5c3779[_0x345e('0x10')][_0x345e('0x1c')][_0x345e('0x3e')](',');_0x4b553a=_0x4d7b6e['map'](function(_0x289b12){return _[_0x345e('0x3f')](_0x289b12,_0x1f126c);});}_0x47764e[_0x345e('0x21')]=_0x4b553a||_0x4d7b6e;return _0x47764e;})[_0x345e('0x1f')](respondWithFilteredResult(_0x230465,_0x255f03))[_0x345e('0x40')](APIHandleError(_0x230465));};exports[_0x345e('0x41')]=function(_0x2ef0d1,_0x50ce66){var _0x1a1f3b={'count':0x0,'rows':[]};var _0x74ba75={};var _0x2b2786;var _0x2d84bb;var _0x157d4a;Promise[_0x345e('0x13')]()[_0x345e('0x1f')](function(){if(_0x2ef0d1[_0x345e('0x10')]['channel']){if(!utils[_0x345e('0x42')](_0x2ef0d1[_0x345e('0x10')][_0x345e('0x14')])){throw new APIBadRequestError(util[_0x345e('0x15')](_0x345e('0x16'),_0x2ef0d1[_0x345e('0x10')][_0x345e('0x14')]));}_0x2b2786=_0x2ef0d1[_0x345e('0x10')][_0x345e('0x14')][_0x345e('0x17')]();}var _0x4c32a4=_[_0x345e('0x43')](_0x2b2786)+'Queue';var _0xb7e83b=_[_0x345e('0x44')](db[_0x4c32a4][_0x345e('0x45')],function(_0x4aebfe){return{'name':_0x4aebfe['fieldName'],'type':_0x4aebfe[_0x345e('0x26')][_0x345e('0x46')]};});if(!_0x2ef0d1['query'][_0x345e('0x1c')]){var _0x32f11c=['id',_0x345e('0x47')];if(_0x2b2786===_0x345e('0x48')){_0x32f11c['push'](_0x345e('0x26'));if(_0x2ef0d1[_0x345e('0x10')]['type']===_0x345e('0x49')){_0x32f11c[_0x345e('0x2b')](['dialActive',_0x345e('0x4a')]);}}_0x2ef0d1[_0x345e('0x10')][_0x345e('0x1c')]=_0x32f11c['join'](',');}_0x74ba75=qs[_0x345e('0x4b')](_0xb7e83b,_0x2ef0d1);if(_0x2ef0d1[_0x345e('0x33')]['role']===_0x345e('0x33')){var _0x3f936c={'params':{'id':_0x2ef0d1[_0x345e('0x33')][_0x345e('0x34')]},'query':{'section':_0x2b2786===_0x345e('0x48')&&_0x2ef0d1[_0x345e('0x10')][_0x345e('0x26')]===_0x345e('0x49')?_0x345e('0x4c'):_[_0x345e('0x43')](_0x2b2786)+_0x345e('0x4d'),'type':_0x2ef0d1[_0x345e('0x10')][_0x345e('0x26')],'nolimit':!![],'sort':_0x345e('0x47'),'filter':_0x2ef0d1[_0x345e('0x10')]['filter']}};return db[_0x345e('0x4e')][_0x345e('0x37')](_0x3f936c);}return db[_0x4c32a4]['findAndCountAll'](_0x74ba75);})[_0x345e('0x1f')](function(_0x242106){_0x1a1f3b['count']=_0x242106[_0x345e('0x9')];_0x2d84bb=_0x242106[_0x345e('0x21')];return rtq[_0x345e('0x4f')](_0x2ef0d1,_0x2b2786);})['then'](function(_0x2514cb){_0x157d4a=_0x2514cb['rows'];return rtq[_0x345e('0x50')](_0x2d84bb,_0x157d4a,_0x2b2786,_0x2ef0d1['query']['type']);})[_0x345e('0x1f')](function(_0x34665a){_0x1a1f3b['rows']=_0x34665a;return _0x1a1f3b;})[_0x345e('0x1f')](respondWithFilteredResult(_0x50ce66,_0x74ba75))['catch'](APIHandleError(_0x50ce66));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 5df555a..e97379c 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(_0x39ad2f,_0x1602bc){var _0x15ea06=function(_0x27424b){while(--_0x27424b){_0x39ad2f['push'](_0x39ad2f['shift']());}};_0x15ea06(++_0x1602bc);}(_0x70e0,0x17b));var _0x070e=function(_0x482819,_0xb3bd83){_0x482819=_0x482819-0x0;var _0x1b36b0=_0x70e0[_0x482819];return _0x1b36b0;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x45471c,_0x19e6fe){var _0x173478=function(_0x28ce62){while(--_0x28ce62){_0x45471c['push'](_0x45471c['shift']());}};_0x173478(++_0x19e6fe);}(_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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 3383b1a..5bd3be1 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 _0x9ca0=['STRING','sequelize','exports','INTEGER','DATE'];(function(_0x2bef9f,_0x39ee4d){var _0x57637c=function(_0x571ab7){while(--_0x571ab7){_0x2bef9f['push'](_0x2bef9f['shift']());}};_0x57637c(++_0x39ee4d);}(_0x9ca0,0x65));var _0x09ca=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x9ca0[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require(_0x09ca('0x0'));module[_0x09ca('0x1')]={'state':{'type':Sequelize[_0x09ca('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x09ca('0x3')]},'uniqueid':{'type':Sequelize[_0x09ca('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x09ca('0x3')]},'ringtime':{'type':Sequelize[_0x09ca('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x09ca('0x4')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5496=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x105598,_0xe7dd46){var _0x1b8b5a=function(_0x3fb5a2){while(--_0x3fb5a2){_0x105598['push'](_0x105598['shift']());}};_0x1b8b5a(++_0xe7dd46);}(_0x5496,0x175));var _0x6549=function(_0x1a6f9f,_0x59f6da){_0x1a6f9f=_0x1a6f9f-0x0;var _0x553329=_0x5496[_0x1a6f9f];return _0x553329;};'use strict';var Sequelize=require(_0x6549('0x0'));module[_0x6549('0x1')]={'state':{'type':Sequelize[_0x6549('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6549('0x3')]},'scheduledat':{'type':Sequelize[_0x6549('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x6549('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x6549('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x6549('0x3')]},'campaigntype':{'type':Sequelize[_0x6549('0x3')]},'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 7a6a0d1..263f857 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 _0x9cb6=['bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','util','api','moment'];(function(_0x234927,_0x4dd007){var _0x13b6d5=function(_0x1541f5){while(--_0x1541f5){_0x234927['push'](_0x234927['shift']());}};_0x13b6d5(++_0x4dd007);}(_0x9cb6,0xda));var _0x69cb=function(_0x50d627,_0x99af84){_0x50d627=_0x50d627-0x0;var _0x2825ab=_0x9cb6[_0x50d627];return _0x2825ab;};'use strict';var _=require('lodash');var util=require(_0x69cb('0x0'));var logger=require('../../config/logger')(_0x69cb('0x1'));var moment=require(_0x69cb('0x2'));var BPromise=require(_0x69cb('0x3'));var rp=require(_0x69cb('0x4'));var fs=require('fs');var path=require(_0x69cb('0x5'));var rimraf=require(_0x69cb('0x6'));var config=require(_0x69cb('0x7'));var attributes=require(_0x69cb('0x8'));module[_0x69cb('0x9')]=function(_0x53fe89,_0x4dc067){return _0x53fe89[_0x69cb('0xa')](_0x69cb('0xb'),attributes,{'tableName':_0x69cb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a28=['request-promise','path','rimraf','../../config/environment','ReportAgentPreview','lodash','util','../../config/logger','api','bluebird'];(function(_0x4a6b7e,_0x11e11b){var _0x4d8f39=function(_0x4f791a){while(--_0x4f791a){_0x4a6b7e['push'](_0x4a6b7e['shift']());}};_0x4d8f39(++_0x11e11b);}(_0x1a28,0x18b));var _0x81a2=function(_0x151418,_0x2cbffa){_0x151418=_0x151418-0x0;var _0x40e29a=_0x1a28[_0x151418];return _0x40e29a;};'use strict';var _=require(_0x81a2('0x0'));var util=require(_0x81a2('0x1'));var logger=require(_0x81a2('0x2'))(_0x81a2('0x3'));var moment=require('moment');var BPromise=require(_0x81a2('0x4'));var rp=require(_0x81a2('0x5'));var fs=require('fs');var path=require(_0x81a2('0x6'));var rimraf=require(_0x81a2('0x7'));var config=require(_0x81a2('0x8'));var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x81073c,_0x298217){return _0x81073c['define'](_0x81a2('0x9'),attributes,{'tableName':'report_agent_preview','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 0df58c1..c3e31b8 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 _0x592a=['rpc','../../config/environment','jayson/promise','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x57b432,_0x1589a0){var _0x2edf2a=function(_0x20edfc){while(--_0x20edfc){_0x57b432['push'](_0x57b432['shift']());}};_0x2edf2a(++_0x1589a0);}(_0x592a,0x6e));var _0xa592=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x592a[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xa592('0x0'));var moment=require('moment');var BPromise=require(_0xa592('0x1'));var rs=require(_0xa592('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa592('0x3'))['db'];var utils=require(_0xa592('0x4'));var logger=require('../../config/logger')(_0xa592('0x5'));var config=require(_0xa592('0x6'));var jayson=require(_0xa592('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59aa96,_0x3f3324,_0x421526){return new BPromise(function(_0x4bcc8f,_0x2c0757){return client['request'](_0x59aa96,_0x421526)['then'](function(_0x52874f){logger['info'](_0xa592('0x8'),_0x3f3324,_0xa592('0x9'));logger[_0xa592('0xa')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x3f3324,_0xa592('0x9'),JSON[_0xa592('0xb')](_0x52874f));if(_0x52874f['error']){if(_0x52874f[_0xa592('0xc')][_0xa592('0xd')]===0x1f4){logger[_0xa592('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x3f3324,_0x52874f[_0xa592('0xc')]['message']);return _0x2c0757(_0x52874f[_0xa592('0xc')][_0xa592('0xe')]);}logger[_0xa592('0xc')](_0xa592('0x8'),_0x3f3324,_0x52874f[_0xa592('0xc')][_0xa592('0xe')]);return _0x4bcc8f(_0x52874f['error'][_0xa592('0xe')]);}else{logger[_0xa592('0xf')](_0xa592('0x8'),_0x3f3324,'request\x20sent');_0x4bcc8f(_0x52874f[_0xa592('0x10')][_0xa592('0xe')]);}})['catch'](function(_0x31df11){logger[_0xa592('0xc')](_0xa592('0x8'),_0x3f3324,_0x31df11);_0x2c0757(_0x31df11);});});}exports[_0xa592('0x11')]=function(_0x5e9134){var _0x2bc17c=this;return new Promise(function(_0x5a5b7c,_0x1f12d8){return db[_0xa592('0x12')][_0xa592('0x13')](_0x5e9134[_0xa592('0x14')],{'raw':_0x5e9134[_0xa592('0x15')]?_0x5e9134[_0xa592('0x15')][_0xa592('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x4b03b3){logger[_0xa592('0xf')](_0xa592('0x11'),_0x5e9134);logger['debug'](_0xa592('0x11'),_0x5e9134,JSON[_0xa592('0xb')](_0x4b03b3));_0x5a5b7c(_0x4b03b3);})['catch'](function(_0x429e68){logger[_0xa592('0xc')](_0xa592('0x11'),_0x429e68[_0xa592('0xe')],_0x5e9134);_0x1f12d8(_0x2bc17c['error'](0x1f4,_0x429e68[_0xa592('0xe')]));});});}; \ No newline at end of file +var _0x3437=['error','code','ReportAgentPreview,\x20%s,\x20%s','message','info','result','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3af0f0,_0x377508){var _0x298a7b=function(_0xe2fe84){while(--_0xe2fe84){_0x3af0f0['push'](_0x3af0f0['shift']());}};_0x298a7b(++_0x377508);}(_0x3437,0x1e0));var _0x7343=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x3437[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7343('0x0'));var util=require(_0x7343('0x1'));var moment=require(_0x7343('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7343('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7343('0x4'));var logger=require(_0x7343('0x5'))('rpc');var config=require(_0x7343('0x6'));var jayson=require(_0x7343('0x7'));var client=jayson['client'][_0x7343('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x391b16,_0x4c8f93,_0x92a82c){return new BPromise(function(_0x62bb88,_0x598059){return client['request'](_0x391b16,_0x92a82c)[_0x7343('0x9')](function(_0x5a7ff8){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x4c8f93,_0x7343('0xa'));logger[_0x7343('0xb')](_0x7343('0xc'),_0x4c8f93,_0x7343('0xa'),JSON[_0x7343('0xd')](_0x5a7ff8));if(_0x5a7ff8[_0x7343('0xe')]){if(_0x5a7ff8[_0x7343('0xe')][_0x7343('0xf')]===0x1f4){logger[_0x7343('0xe')](_0x7343('0x10'),_0x4c8f93,_0x5a7ff8['error'][_0x7343('0x11')]);return _0x598059(_0x5a7ff8[_0x7343('0xe')][_0x7343('0x11')]);}logger['error'](_0x7343('0x10'),_0x4c8f93,_0x5a7ff8[_0x7343('0xe')][_0x7343('0x11')]);return _0x62bb88(_0x5a7ff8[_0x7343('0xe')]['message']);}else{logger[_0x7343('0x12')](_0x7343('0x10'),_0x4c8f93,_0x7343('0xa'));_0x62bb88(_0x5a7ff8[_0x7343('0x13')][_0x7343('0x11')]);}})['catch'](function(_0x4d22b4){logger[_0x7343('0xe')](_0x7343('0x10'),_0x4c8f93,_0x4d22b4);_0x598059(_0x4d22b4);});});}exports[_0x7343('0x14')]=function(_0x5c0648){var _0x340d3d=this;return new Promise(function(_0x5dd801,_0x22c8c7){return db[_0x7343('0x15')]['create'](_0x5c0648[_0x7343('0x16')],{'raw':_0x5c0648[_0x7343('0x17')]?_0x5c0648[_0x7343('0x17')][_0x7343('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x504b75){logger[_0x7343('0x12')](_0x7343('0x14'),_0x5c0648);logger[_0x7343('0xb')](_0x7343('0x14'),_0x5c0648,JSON[_0x7343('0xd')](_0x504b75));_0x5dd801(_0x504b75);})[_0x7343('0x19')](function(_0x25245b){logger[_0x7343('0xe')]('CreateReportAgentPreview',_0x25245b[_0x7343('0x11')],_0x5c0648);_0x22c8c7(_0x340d3d[_0x7343('0xe')](0x1f4,_0x25245b[_0x7343('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 0d57173..9429026 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 _0x4028=['updateVoiceQueue','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','exports','util','path','express','Router','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4028,0x15a));var _0x8402=function(_0x1b1e3c,_0x502b49){_0x1b1e3c=_0x1b1e3c-0x0;var _0x2ba54a=_0x4028[_0x1b1e3c];return _0x2ba54a;};'use strict';var multer=require('multer');var util=require(_0x8402('0x0'));var path=require(_0x8402('0x1'));var express=require(_0x8402('0x2'));var router=express[_0x8402('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0x8402('0x4'));router[_0x8402('0x5')](_0x8402('0x6'),auth[_0x8402('0x7')](),controller[_0x8402('0x8')]);router[_0x8402('0x5')](_0x8402('0x9'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0x8402('0x5')](_0x8402('0xa'),auth[_0x8402('0x7')](),controller[_0x8402('0xb')]);router[_0x8402('0x5')](_0x8402('0xc'),auth[_0x8402('0x7')](),controller[_0x8402('0xd')]);router[_0x8402('0x5')](_0x8402('0xe'),auth[_0x8402('0x7')](),controller[_0x8402('0xf')]);router['get'](_0x8402('0x10'),auth[_0x8402('0x7')](),controller[_0x8402('0x11')]);router[_0x8402('0x5')](_0x8402('0x12'),auth[_0x8402('0x7')](),controller[_0x8402('0x13')]);router[_0x8402('0x5')](_0x8402('0x14'),auth[_0x8402('0x7')](),controller[_0x8402('0x15')]);router[_0x8402('0x5')](_0x8402('0x16'),auth[_0x8402('0x7')](),controller['smsQueues']);router[_0x8402('0x5')](_0x8402('0x17'),auth[_0x8402('0x7')](),controller['whatsappQueues']);router[_0x8402('0x5')](_0x8402('0x18'),auth[_0x8402('0x7')](),controller['faxQueues']);router[_0x8402('0x5')](_0x8402('0x19'),auth[_0x8402('0x7')](),controller[_0x8402('0x1a')]);router[_0x8402('0x5')]('/voice/queues/channels',auth[_0x8402('0x7')](),controller['voiceQueuesChannels']);router[_0x8402('0x5')](_0x8402('0x1b'),auth[_0x8402('0x7')](),controller[_0x8402('0x1c')]);router[_0x8402('0x5')](_0x8402('0x1d'),auth[_0x8402('0x7')](),controller['voiceQueuesChannelHangup']);router[_0x8402('0x5')](_0x8402('0x1e'),auth['isAuthenticated'](),controller[_0x8402('0x1f')]);router[_0x8402('0x5')]('/voice/queues/:id',auth[_0x8402('0x7')](),controller[_0x8402('0x20')]);router[_0x8402('0x21')]('/voice/queues/:id',auth[_0x8402('0x7')](),controller[_0x8402('0x22')]);router[_0x8402('0x5')]('/outbound',auth[_0x8402('0x7')](),controller['outbound']);router[_0x8402('0x5')](_0x8402('0x23'),auth[_0x8402('0x7')](),controller['outboundChannels']);router['get'](_0x8402('0x24'),auth[_0x8402('0x7')](),controller[_0x8402('0x25')]);router[_0x8402('0x21')](_0x8402('0x26'),auth[_0x8402('0x7')](),controller[_0x8402('0x27')]);router[_0x8402('0x5')](_0x8402('0x28'),auth[_0x8402('0x7')](),controller[_0x8402('0x29')]);router[_0x8402('0x5')](_0x8402('0x2a'),auth[_0x8402('0x7')](),controller['trunks']);router[_0x8402('0x5')](_0x8402('0x2b'),auth[_0x8402('0x7')](),controller[_0x8402('0x2c')]);router[_0x8402('0x5')](_0x8402('0x2d'),auth[_0x8402('0x7')](),controller[_0x8402('0x2e')]);router[_0x8402('0x5')]('/chat/queues/waitinginteractions',auth[_0x8402('0x7')](),controller['chatQueuesWaitingInteractions']);router[_0x8402('0x5')]('/mail/queues/waitinginteractions',auth[_0x8402('0x7')](),controller[_0x8402('0x2f')]);router[_0x8402('0x5')](_0x8402('0x30'),auth['isAuthenticated'](),controller[_0x8402('0x31')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller[_0x8402('0x32')]);router[_0x8402('0x5')]('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x8402('0x33')]);router[_0x8402('0x5')]('/whatsapp/queues/waitinginteractions',auth[_0x8402('0x7')](),controller[_0x8402('0x34')]);router['get'](_0x8402('0x35'),auth['isAuthenticated'](),controller[_0x8402('0x36')]);router[_0x8402('0x37')](_0x8402('0x38'),auth[_0x8402('0x7')](),controller[_0x8402('0x39')]('mail'));router['get'](_0x8402('0x3a'),auth[_0x8402('0x7')](),controller['showMailQueues']);router['post'](_0x8402('0x3b'),auth[_0x8402('0x7')](),controller[_0x8402('0x39')](_0x8402('0x3c')));router[_0x8402('0x5')](_0x8402('0x3d'),auth['isAuthenticated'](),controller[_0x8402('0x3e')]);router[_0x8402('0x37')](_0x8402('0x3f'),auth[_0x8402('0x7')](),controller[_0x8402('0x39')]('fax'));router['get'](_0x8402('0x40'),auth[_0x8402('0x7')](),controller[_0x8402('0x41')]);router['post'](_0x8402('0x42'),auth[_0x8402('0x7')](),controller['queueNotify'](_0x8402('0x43')));router[_0x8402('0x5')](_0x8402('0x44'),auth[_0x8402('0x7')](),controller['showOpenchannelQueues']);router[_0x8402('0x37')](_0x8402('0x45'),auth[_0x8402('0x7')](),controller['queueNotify'](_0x8402('0x46')));router[_0x8402('0x37')]('/whatsapp/queues/:id/notify',auth[_0x8402('0x7')](),controller['queueNotify']('whatsapp'));router[_0x8402('0x5')](_0x8402('0x47'),auth[_0x8402('0x7')](),controller[_0x8402('0x48')]);router[_0x8402('0x5')]('/whatsapp/queues/:id',auth[_0x8402('0x7')](),controller[_0x8402('0x49')]);router[_0x8402('0x37')](_0x8402('0x4a'),auth[_0x8402('0x7')](),controller['agentNotify']);module[_0x8402('0x4b')]=router; \ No newline at end of file +var _0xe5b8=['/outbound','/outbound/channels','outboundChannels','agents','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/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','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','express','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put'];(function(_0x3efe38,_0x5a83dd){var _0x28108a=function(_0xe7d760){while(--_0xe7d760){_0x3efe38['push'](_0x3efe38['shift']());}};_0x28108a(++_0x5a83dd);}(_0xe5b8,0x12f));var _0x8e5b=function(_0x3928d9,_0x4736e4){_0x3928d9=_0x3928d9-0x0;var _0x318378=_0xe5b8[_0x3928d9];return _0x318378;};'use strict';var multer=require(_0x8e5b('0x0'));var util=require(_0x8e5b('0x1'));var path=require('path');var express=require(_0x8e5b('0x2'));var router=express['Router']();var auth=require(_0x8e5b('0x3'));var controller=require(_0x8e5b('0x4'));router[_0x8e5b('0x5')](_0x8e5b('0x6'),auth['isAuthenticated'](),controller[_0x8e5b('0x7')]);router[_0x8e5b('0x5')](_0x8e5b('0x8'),auth[_0x8e5b('0x9')](),controller[_0x8e5b('0xa')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x8e5b('0x9')](),controller[_0x8e5b('0xb')]);router[_0x8e5b('0x5')](_0x8e5b('0xc'),auth[_0x8e5b('0x9')](),controller[_0x8e5b('0xd')]);router[_0x8e5b('0x5')](_0x8e5b('0xe'),auth[_0x8e5b('0x9')](),controller[_0x8e5b('0xf')]);router['get'](_0x8e5b('0x10'),auth[_0x8e5b('0x9')](),controller[_0x8e5b('0x11')]);router[_0x8e5b('0x5')](_0x8e5b('0x12'),auth[_0x8e5b('0x9')](),controller[_0x8e5b('0x13')]);router['get'](_0x8e5b('0x14'),auth[_0x8e5b('0x9')](),controller['openchannelQueues']);router[_0x8e5b('0x5')](_0x8e5b('0x15'),auth['isAuthenticated'](),controller[_0x8e5b('0x16')]);router['get'](_0x8e5b('0x17'),auth['isAuthenticated'](),controller[_0x8e5b('0x18')]);router[_0x8e5b('0x5')](_0x8e5b('0x19'),auth['isAuthenticated'](),controller[_0x8e5b('0x1a')]);router['get']('/voice/queues/preview/:id',auth[_0x8e5b('0x9')](),controller[_0x8e5b('0x1b')]);router[_0x8e5b('0x5')](_0x8e5b('0x1c'),auth[_0x8e5b('0x9')](),controller[_0x8e5b('0x1d')]);router[_0x8e5b('0x5')](_0x8e5b('0x1e'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0x8e5b('0x5')](_0x8e5b('0x1f'),auth[_0x8e5b('0x9')](),controller[_0x8e5b('0x20')]);router['get'](_0x8e5b('0x21'),auth[_0x8e5b('0x9')](),controller['voiceQueuesChannelRedirect']);router['get'](_0x8e5b('0x22'),auth[_0x8e5b('0x9')](),controller[_0x8e5b('0x23')]);router[_0x8e5b('0x24')](_0x8e5b('0x22'),auth[_0x8e5b('0x9')](),controller['updateVoiceQueue']);router[_0x8e5b('0x5')](_0x8e5b('0x25'),auth[_0x8e5b('0x9')](),controller['outbound']);router[_0x8e5b('0x5')](_0x8e5b('0x26'),auth[_0x8e5b('0x9')](),controller[_0x8e5b('0x27')]);router[_0x8e5b('0x5')]('/agents',auth['isAuthenticated'](),controller[_0x8e5b('0x28')]);router[_0x8e5b('0x24')]('/agents/:id/capacity',auth['isAuthenticated'](),controller['agentCapacity']);router[_0x8e5b('0x5')](_0x8e5b('0x29'),auth[_0x8e5b('0x9')](),controller[_0x8e5b('0x2a')]);router[_0x8e5b('0x5')](_0x8e5b('0x2b'),auth[_0x8e5b('0x9')](),controller[_0x8e5b('0x2c')]);router[_0x8e5b('0x5')](_0x8e5b('0x2d'),auth[_0x8e5b('0x9')](),controller[_0x8e5b('0x2e')]);router['get'](_0x8e5b('0x2f'),auth['isAuthenticated'](),controller[_0x8e5b('0x30')]);router[_0x8e5b('0x5')](_0x8e5b('0x31'),auth['isAuthenticated'](),controller[_0x8e5b('0x32')]);router['get']('/mail/queues/waitinginteractions',auth[_0x8e5b('0x9')](),controller[_0x8e5b('0x33')]);router[_0x8e5b('0x5')](_0x8e5b('0x34'),auth[_0x8e5b('0x9')](),controller[_0x8e5b('0x35')]);router[_0x8e5b('0x5')]('/openchannel/queues/:id/waitinginteractions',auth[_0x8e5b('0x9')](),controller[_0x8e5b('0x36')]);router[_0x8e5b('0x5')](_0x8e5b('0x37'),auth[_0x8e5b('0x9')](),controller[_0x8e5b('0x38')]);router[_0x8e5b('0x5')](_0x8e5b('0x39'),auth[_0x8e5b('0x9')](),controller[_0x8e5b('0x3a')]);router[_0x8e5b('0x5')](_0x8e5b('0x3b'),auth[_0x8e5b('0x9')](),controller[_0x8e5b('0x3c')]);router[_0x8e5b('0x3d')](_0x8e5b('0x3e'),auth['isAuthenticated'](),controller[_0x8e5b('0x3f')]('mail'));router[_0x8e5b('0x5')](_0x8e5b('0x40'),auth[_0x8e5b('0x9')](),controller[_0x8e5b('0x41')]);router[_0x8e5b('0x3d')](_0x8e5b('0x42'),auth[_0x8e5b('0x9')](),controller[_0x8e5b('0x3f')](_0x8e5b('0x43')));router['get']('/chat/queues/:id',auth[_0x8e5b('0x9')](),controller[_0x8e5b('0x44')]);router['post'](_0x8e5b('0x45'),auth[_0x8e5b('0x9')](),controller[_0x8e5b('0x3f')](_0x8e5b('0x46')));router['get'](_0x8e5b('0x47'),auth[_0x8e5b('0x9')](),controller['showFaxQueues']);router[_0x8e5b('0x3d')](_0x8e5b('0x48'),auth[_0x8e5b('0x9')](),controller['queueNotify'](_0x8e5b('0x49')));router[_0x8e5b('0x5')]('/openchannel/queues/:id',auth[_0x8e5b('0x9')](),controller[_0x8e5b('0x4a')]);router[_0x8e5b('0x3d')](_0x8e5b('0x4b'),auth[_0x8e5b('0x9')](),controller[_0x8e5b('0x3f')](_0x8e5b('0x4c')));router['post'](_0x8e5b('0x4d'),auth['isAuthenticated'](),controller[_0x8e5b('0x3f')](_0x8e5b('0x4e')));router[_0x8e5b('0x5')](_0x8e5b('0x4f'),auth['isAuthenticated'](),controller[_0x8e5b('0x50')]);router[_0x8e5b('0x5')]('/whatsapp/queues/:id',auth[_0x8e5b('0x9')](),controller[_0x8e5b('0x51')]);router[_0x8e5b('0x3d')](_0x8e5b('0x52'),auth['isAuthenticated'](),controller[_0x8e5b('0x53')]);module[_0x8e5b('0x54')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 4654050..c96bf0e 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 _0x55ca=['ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','uniq','value','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','update','MessageId','InteractionId','From','QueueId','create','Start','queue','*,*,*,*','agentNotify','channel','Website','User','Agent\x20not\x20found','Message','\x20Message\x20not\x20found','agentTransferTimeout','bluebird','moment','../../config/logger','api','client','http','request','error','code','message','result','catch','stack','name','status','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','merge','then','voiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','params','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','outboundChannels','agents','Agents','agentCapacity','user','interaction','hasOwnProperty','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','MemberReport','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions'];(function(_0x3e15ee,_0x2ebf1a){var _0xe15522=function(_0x461333){while(--_0x461333){_0x3e15ee['push'](_0x3e15ee['shift']());}};_0xe15522(++_0x2ebf1a);}(_0x55ca,0x126));var _0xa55c=function(_0x5a36dd,_0x5b2d2c){_0x5a36dd=_0x5a36dd-0x0;var _0x15503d=_0x55ca[_0x5a36dd];return _0x15503d;};'use strict';var BPromise=require(_0xa55c('0x0'));var moment=require(_0xa55c('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0xa55c('0x2'))(_0xa55c('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0xa55c('0x4')][_0xa55c('0x5')]({'port':0x232a});var mailClient=jayson[_0xa55c('0x4')][_0xa55c('0x5')]({'port':0x232b});var routingClient=jayson[_0xa55c('0x4')][_0xa55c('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){var _0x291996=_0x2121fd?_0x2121fd:amiClient;return _0x291996[_0xa55c('0x6')](_0x36b623,_0x4d0624)['then'](function(_0x5849ad){if(_0x5849ad[_0xa55c('0x7')]){if(_0x5849ad[_0xa55c('0x7')][_0xa55c('0x8')]===0x1f4){return _0x57e069(_0x5849ad[_0xa55c('0x7')][_0xa55c('0x9')]);}return _0x2537f0(_0x5849ad[_0xa55c('0x7')][_0xa55c('0x9')]);}else{_0x2537f0(_0x5849ad[_0xa55c('0xa')]);}})[_0xa55c('0xb')](function(_0x15eec8){_0x57e069(_0x15eec8);});});}function respondWithResult(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xc8;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['status'](_0x59d84a)['json'](_0x2a35be);}return _0x5d47ff['sendStatus'](0x194);};}function handleError(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0x1f4;return function(_0x462cd6){logger[_0xa55c('0x7')](_0x462cd6[_0xa55c('0xc')]);if(_0x462cd6[_0xa55c('0xd')]){delete _0x462cd6['name'];}_0x18ee85[_0xa55c('0xe')](_0x3930e4)[_0xa55c('0xf')](_0x462cd6);};}function findById(_0x25934f){return function(_0x31e10d){if(!_[_0xa55c('0x10')](_0x25934f)&&!_[_0xa55c('0x10')](_0x31e10d)&&!_[_0xa55c('0x10')](_0x31e10d[_0xa55c('0x11')])){return _[_0xa55c('0x12')](_0x31e10d['rows'],function(_0x3d4c9e){return _0x3d4c9e['id']==_0x25934f;});}return null;};}exports[_0xa55c('0x13')]=function(_0x461284,_0x358b61){return respondWithRpcPromise(_0xa55c('0x14'),_0x461284[_0xa55c('0x15')])['then'](respondWithResult(_0x358b61,null))['catch'](handleError(_0x358b61,null));};exports[_0xa55c('0x16')]=function(_0x3776ac,_0xade4c4){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xa55c('0x17')](_0x3776ac[_0xa55c('0x15')],_0x3776ac['params']))[_0xa55c('0x18')](respondWithResult(_0xade4c4,null))[_0xa55c('0xb')](handleError(_0xade4c4,null));};exports[_0xa55c('0x19')]=function(_0x1965f1,_0x234372){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xa55c('0x17')](_0x1965f1['query'],_0x1965f1['params']))['then'](respondWithResult(_0x234372,null))[_0xa55c('0xb')](handleError(_0x234372,null));};exports['voiceQueues']=function(_0x3ecbe7,_0x190757){return respondWithRpcPromise(_0xa55c('0x1a'),_0x3ecbe7[_0xa55c('0x15')])[_0xa55c('0x18')](respondWithResult(_0x190757,null))[_0xa55c('0xb')](handleError(_0x190757,null));};exports[_0xa55c('0x1b')]=function(_0x11e7f7,_0x192df2){return respondWithRpcPromise(_0xa55c('0x1a'),_0x11e7f7[_0xa55c('0x15')])['then'](findById(_0x11e7f7[_0xa55c('0x1c')]['id']))[_0xa55c('0x18')](respondWithResult(_0x192df2,null))[_0xa55c('0xb')](handleError(_0x192df2,null));};exports[_0xa55c('0x1d')]=function(_0x5d940d,_0x1377b0){return respondWithRpcPromise(_0xa55c('0x1e'),_[_0xa55c('0x17')](_0x5d940d[_0xa55c('0x1f')],_0x5d940d[_0xa55c('0x1c')]))[_0xa55c('0x18')](respondWithResult(_0x1377b0,null))['catch'](handleError(_0x1377b0,null));};exports[_0xa55c('0x20')]=function(_0x490b7d,_0x35c9c2){return respondWithRpcPromise(_0xa55c('0x21'),_[_0xa55c('0x17')](_0x490b7d[_0xa55c('0x15')],_0x490b7d['params']))[_0xa55c('0x18')](respondWithResult(_0x35c9c2,null))[_0xa55c('0xb')](handleError(_0x35c9c2,null));};exports[_0xa55c('0x22')]=function(_0x20da31,_0x10f4b7){return respondWithRpcPromise(_0xa55c('0x23'),_0x20da31[_0xa55c('0x15')])[_0xa55c('0x18')](respondWithResult(_0x10f4b7,null))[_0xa55c('0xb')](handleError(_0x10f4b7,null));};exports[_0xa55c('0x24')]=function(_0x197099,_0x4eb7c4){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xa55c('0x17')](_0x197099[_0xa55c('0x15')],_0x197099['params']))[_0xa55c('0x18')](respondWithResult(_0x4eb7c4,null))[_0xa55c('0xb')](handleError(_0x4eb7c4,null));};exports[_0xa55c('0x25')]=function(_0x1839ac,_0x30d4f8){return respondWithRpcPromise(_0xa55c('0x26'),_[_0xa55c('0x17')](_0x1839ac[_0xa55c('0x15')],_0x1839ac[_0xa55c('0x1c')]))['then'](respondWithResult(_0x30d4f8,null))['catch'](handleError(_0x30d4f8,null));};exports['voiceQueuesChannelRedirect']=function(_0x3fd75f,_0x18e00e){return respondWithRpcPromise(_0xa55c('0x27'),_['merge'](_0x3fd75f[_0xa55c('0x15')],_0x3fd75f['params']))[_0xa55c('0x18')](respondWithResult(_0x18e00e,null))['catch'](handleError(_0x18e00e,null));};exports[_0xa55c('0x28')]=function(_0x39267c,_0x3c0ec1){return respondWithRpcPromise('Outbound',_0x39267c[_0xa55c('0x15')])[_0xa55c('0x18')](respondWithResult(_0x3c0ec1,null))['catch'](handleError(_0x3c0ec1,null));};exports[_0xa55c('0x29')]=function(_0x194e78,_0x4d9083){return respondWithRpcPromise('OutboundChannels',_0x194e78[_0xa55c('0x15')])['then'](respondWithResult(_0x4d9083,null))[_0xa55c('0xb')](handleError(_0x4d9083,null));};exports[_0xa55c('0x2a')]=function(_0x5427bf,_0x542d76){var _0x5e50b6;return respondWithRpcPromise('Agents',_0x5427bf[_0xa55c('0x15')])[_0xa55c('0x18')](function(_0x429336){_0x5e50b6=_0x429336;return respondWithRpcPromise(_0xa55c('0x2b'),_0x5427bf[_0xa55c('0x15')],routingClient);})['then'](function(_0x3d52d8){return _[_0xa55c('0x17')]({},_0x3d52d8,_0x5e50b6);})[_0xa55c('0x18')](respondWithResult(_0x542d76,null))[_0xa55c('0xb')](handleError(_0x542d76,null));};exports[_0xa55c('0x2c')]=function(_0x23cef5,_0x554620){if(_0x23cef5[_0xa55c('0x1f')]&&_0x23cef5['body']['interaction']&&_0x23cef5[_0xa55c('0x2d')]&&_0x23cef5[_0xa55c('0x2d')]['name']){for(var _0x2bd98b in _0x23cef5['body']['interaction']){if(_0x23cef5[_0xa55c('0x1f')][_0xa55c('0x2e')][_0xa55c('0x2f')](_0x2bd98b)){db['MemberReport'][_0xa55c('0x30')]({'where':{'channel':_0x2bd98b,'membername':_0x23cef5[_0xa55c('0x2d')]['name'],'type':_0xa55c('0x31'),'exitAt':null,'uniqueid':_0x23cef5['body'][_0xa55c('0x2e')][_0x2bd98b]&&_0x23cef5[_0xa55c('0x1f')]['interaction'][_0x2bd98b][_0xa55c('0x32')]?{'$notIn':_0x23cef5[_0xa55c('0x1f')]['interaction'][_0x2bd98b]}:{'$ne':null}}})[_0xa55c('0x18')](function(_0x187e09){var _0x204767=moment()['format'](_0xa55c('0x33'));for(var _0x582901=0x0,_0x2f9717=_0x187e09[_0xa55c('0x32')];_0x582901<_0x2f9717;_0x582901+=0x1){_0x187e09[_0x582901][_0xa55c('0x34')]({'exitAt':_0x204767});}});for(var _0x51d663=0x0;_0x51d663<_0x23cef5[_0xa55c('0x1f')][_0xa55c('0x2e')][_0x2bd98b]['length'];_0x51d663+=0x1){db[_0xa55c('0x35')][_0xa55c('0x36')]({'where':{'channel':_0x2bd98b,'membername':_0x23cef5['user'][_0xa55c('0xd')],'type':_0xa55c('0x31'),'uniqueid':_0x23cef5['body'][_0xa55c('0x2e')][_0x2bd98b][_0x51d663],'exitAt':null},'defaults':{'channel':_0x2bd98b,'membername':_0x23cef5[_0xa55c('0x2d')][_0xa55c('0xd')],'interface':_[_0xa55c('0x10')](_0x23cef5['user'][_0xa55c('0x37')])?util['format'](_0xa55c('0x38'),_0x23cef5[_0xa55c('0x2d')][_0xa55c('0xd')]):_0x23cef5['user'][_0xa55c('0x37')],'type':_0xa55c('0x31'),'enterAt':moment()['format'](_0xa55c('0x33')),'role':_0xa55c('0x39'),'internal':_0x23cef5[_0xa55c('0x2d')][_0xa55c('0x3a')],'uniqueid':_0x23cef5[_0xa55c('0x1f')][_0xa55c('0x2e')][_0x2bd98b][_0x51d663]}});}}}}return respondWithRpcPromise(_0xa55c('0x3b'),{'id':_0x23cef5[_0xa55c('0x1c')]['id'],'capacity':_0x23cef5[_0xa55c('0x1f')][_0xa55c('0x3c')]},routingClient)['then'](respondWithResult(_0x554620,null))[_0xa55c('0xb')](handleError(_0x554620,null));};exports[_0xa55c('0x3d')]=function(_0x216de8,_0x4f73b6){return respondWithRpcPromise(_0xa55c('0x3e'),_0x216de8[_0xa55c('0x15')])['then'](respondWithResult(_0x4f73b6,null))[_0xa55c('0xb')](handleError(_0x4f73b6,null));};exports['trunks']=function(_0x2b6a0e,_0x228df4){return respondWithRpcPromise(_0xa55c('0x3f'),_0x2b6a0e[_0xa55c('0x15')])[_0xa55c('0x18')](respondWithResult(_0x228df4,null))['catch'](handleError(_0x228df4,null));};exports[_0xa55c('0x40')]=function(_0x4607ca,_0x4b85cc){return respondWithRpcPromise(_0xa55c('0x41'),_0x4607ca[_0xa55c('0x15')])[_0xa55c('0x18')](respondWithResult(_0x4b85cc,null))[_0xa55c('0xb')](handleError(_0x4b85cc,null));};exports['chatQueues']=function(_0x4def35,_0x267965){return respondWithRpcPromise(_0xa55c('0x42'),_0x4def35[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](respondWithResult(_0x267965,null))['catch'](handleError(_0x267965,null));};exports[_0xa55c('0x43')]=function(_0x5ce463,_0x2742e4){return respondWithRpcPromise(_0xa55c('0x42'),_0x5ce463[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](findById(_0x5ce463[_0xa55c('0x1c')]['id']))['then'](respondWithResult(_0x2742e4,null))[_0xa55c('0xb')](handleError(_0x2742e4,null));};exports['mailQueues']=function(_0x23f67f,_0x157afe){return respondWithRpcPromise(_0xa55c('0x44'),_0x23f67f[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](respondWithResult(_0x157afe,null))[_0xa55c('0xb')](handleError(_0x157afe,null));};exports[_0xa55c('0x45')]=function(_0x53e2be,_0x450567){return respondWithRpcPromise(_0xa55c('0x44'),_0x53e2be[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](findById(_0x53e2be[_0xa55c('0x1c')]['id']))['then'](respondWithResult(_0x450567,null))[_0xa55c('0xb')](handleError(_0x450567,null));};exports[_0xa55c('0x46')]=function(_0x28bac4,_0x20e53c){return respondWithRpcPromise(_0xa55c('0x47'),_0x28bac4['query'],mailClient)[_0xa55c('0x18')](respondWithResult(_0x20e53c,null))[_0xa55c('0xb')](handleError(_0x20e53c,null));};exports[_0xa55c('0x48')]=function(_0x16d9b2,_0x3ba56d){return respondWithRpcPromise('OpenchannelQueues',_0x16d9b2[_0xa55c('0x15')],routingClient)['then'](respondWithResult(_0x3ba56d,null))[_0xa55c('0xb')](handleError(_0x3ba56d,null));};exports['showOpenchannelQueues']=function(_0x3495a7,_0x5a8897){return respondWithRpcPromise(_0xa55c('0x49'),_0x3495a7[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](findById(_0x3495a7[_0xa55c('0x1c')]['id']))[_0xa55c('0x18')](respondWithResult(_0x5a8897,null))[_0xa55c('0xb')](handleError(_0x5a8897,null));};exports[_0xa55c('0x4a')]=function(_0x2f2226,_0x14b515){return respondWithRpcPromise(_0xa55c('0x4b'),_0x2f2226['query'],routingClient)[_0xa55c('0x18')](respondWithResult(_0x14b515,null))[_0xa55c('0xb')](handleError(_0x14b515,null));};exports['showSmsQueues']=function(_0x18b928,_0x2b8b88){return respondWithRpcPromise(_0xa55c('0x4b'),_0x18b928[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](findById(_0x18b928[_0xa55c('0x1c')]['id']))[_0xa55c('0x18')](respondWithResult(_0x2b8b88,null))[_0xa55c('0xb')](handleError(_0x2b8b88,null));};exports['whatsappQueues']=function(_0x1dfaf7,_0x475131){return respondWithRpcPromise(_0xa55c('0x4c'),_0x1dfaf7[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](respondWithResult(_0x475131,null))[_0xa55c('0xb')](handleError(_0x475131,null));};exports[_0xa55c('0x4d')]=function(_0x4249c1,_0x25d5a1){return respondWithRpcPromise('WhatsappQueues',_0x4249c1[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](findById(_0x4249c1[_0xa55c('0x1c')]['id']))[_0xa55c('0x18')](respondWithResult(_0x25d5a1,null))[_0xa55c('0xb')](handleError(_0x25d5a1,null));};exports[_0xa55c('0x4e')]=function(_0x3ea755,_0x3606b2){return respondWithRpcPromise(_0xa55c('0x4f'),_0x3ea755[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](respondWithResult(_0x3606b2,null))['catch'](handleError(_0x3606b2,null));};exports[_0xa55c('0x50')]=function(_0x531eee,_0x1228a4){return respondWithRpcPromise(_0xa55c('0x4f'),_0x531eee[_0xa55c('0x15')],routingClient)['then'](findById(_0x531eee['params']['id']))[_0xa55c('0x18')](respondWithResult(_0x1228a4,null))[_0xa55c('0xb')](handleError(_0x1228a4,null));};exports[_0xa55c('0x51')]=function(_0x42529f,_0x4c7ee1){return respondWithRpcPromise(_0xa55c('0x52'),_0x42529f[_0xa55c('0x15')])[_0xa55c('0x18')](respondWithResult(_0x4c7ee1,null))[_0xa55c('0xb')](handleError(_0x4c7ee1,null));};exports[_0xa55c('0x53')]=function(_0x500968,_0x4b090c){return respondWithRpcPromise(_0xa55c('0x54'),_0x500968[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](respondWithResult(_0x4b090c,null))[_0xa55c('0xb')](handleError(_0x4b090c,null));};exports[_0xa55c('0x55')]=function(_0x4b2032,_0x14febc){return respondWithRpcPromise(_0xa55c('0x56'),_0x4b2032['query'],routingClient)[_0xa55c('0x18')](respondWithResult(_0x14febc,null))[_0xa55c('0xb')](handleError(_0x14febc,null));};exports[_0xa55c('0x57')]=function(_0x4dcb93,_0x1521d5){return respondWithRpcPromise(_0xa55c('0x58'),_0x4dcb93[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](respondWithResult(_0x1521d5,null))[_0xa55c('0xb')](handleError(_0x1521d5,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x25bd5b,_0x2e2cf6){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x25bd5b['query'],routingClient)[_0xa55c('0x18')](function(_0x4e1cbd){if(_0x25bd5b[_0xa55c('0x15')][_0xa55c('0x59')]!==undefined){var _0x2f13db=_(_0x4e1cbd[_0xa55c('0x11')])[_0xa55c('0x5a')]([_0x25bd5b[_0xa55c('0x15')][_0xa55c('0x59')],_0x25bd5b[_0xa55c('0x1c')]['id']])[_0xa55c('0x5b')]('queue_id')[_0xa55c('0x5c')]()[_0xa55c('0x5d')]();return _0x4e1cbd[_0xa55c('0x11')][_0xa55c('0x5a')](function(_0x4f0a26){return _0x2f13db[_0xa55c('0x5e')](_0x4f0a26[_0xa55c('0x5f')])>-0x1;});}else{return _0x4e1cbd[_0xa55c('0x11')][_0xa55c('0x5a')](function(_0x5d766e){return _0x5d766e['queue_id']===parseInt(_0x25bd5b[_0xa55c('0x1c')]['id']);});}})[_0xa55c('0x18')](respondWithResult(_0x2e2cf6,null))[_0xa55c('0xb')](handleError(_0x2e2cf6,null));};exports[_0xa55c('0x60')]=function(_0x5e87cb,_0x55ee0d){return respondWithRpcPromise(_0xa55c('0x61'),_0x5e87cb[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](respondWithResult(_0x55ee0d,null))[_0xa55c('0xb')](handleError(_0x55ee0d,null));};exports[_0xa55c('0x62')]=function(_0x346060,_0x239269){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x346060[_0xa55c('0x15')],routingClient)['then'](respondWithResult(_0x239269,null))[_0xa55c('0xb')](handleError(_0x239269,null));};exports['faxQueuesWaitingInteractions']=function(_0x36ded7,_0x313cdc){return respondWithRpcPromise(_0xa55c('0x63'),_0x36ded7[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](respondWithResult(_0x313cdc,null))[_0xa55c('0xb')](handleError(_0x313cdc,null));};exports[_0xa55c('0x64')]=function(_0x2c71ca){return function(_0x576a1b,_0x59414d){var _0x14cb74,_0x2948b1;var _0xc2ad5c=_[_0xa55c('0x65')](_0x2c71ca);var _0x1622cb=_0x2c71ca===_0xa55c('0x66')?'Website':_0xa55c('0x67');return db[_0xc2ad5c+_0xa55c('0x68')][_0xa55c('0x69')]({'raw':!![],'where':{'id':_0x576a1b[_0xa55c('0x1c')]['id']}})[_0xa55c('0x18')](function(_0x3b1cd7){if(_[_0xa55c('0x10')](_0x3b1cd7)){throw new Error(_0xc2ad5c+_0xa55c('0x6a'));}_0x14cb74=_0x3b1cd7;return db[_0xc2ad5c+'Message'][_0xa55c('0x69')]({'where':{'id':_0x576a1b[_0xa55c('0x1f')][_0xa55c('0x6b')]},'include':[{'model':db[_0xc2ad5c+_0xa55c('0x6c')],'as':_0xa55c('0x6c')},{'model':db[_0xc2ad5c+_0x1622cb],'as':'Account'}]});})[_0xa55c('0x18')](function(_0x2ab1f2){if(_['isNil'](_0x2ab1f2)){throw new Error(_0xc2ad5c+'\x20Message\x20not\x20found');}_0x2948b1=_0x2ab1f2;return _0x2ab1f2[_0xa55c('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa55c('0x18')](function(){var _0x5c2229={'uniqueid':_0x2c71ca+'.'+_0x2948b1['id']+'.'+_0x2948b1['Interaction']['id'],'FromUserId':_0x576a1b['user']['id'],'type':'queue'};_0x5c2229[_0xc2ad5c+_0xa55c('0x6e')]=_0x2948b1['id'];_0x5c2229[_0xc2ad5c+_0xa55c('0x6f')]=_0x2948b1[_0xa55c('0x6c')]['id'];_0x5c2229[_0xa55c('0x70')+_0xc2ad5c+_0x1622cb+'Id']=_0x2948b1[_0xa55c('0x67')]['id'];_0x5c2229['To'+_0xc2ad5c+_0xa55c('0x71')]=_0x14cb74['id'];return db[_0xc2ad5c+'TransferReport'][_0xa55c('0x72')](_0x5c2229);})[_0xa55c('0x18')](function(){return respondWithRpcPromise(_0xa55c('0x73'),{'channel':_0x2c71ca,'interaction':_0x2948b1[_0xa55c('0x6c')],'message':_0x2948b1,'account':_0x2948b1['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xa55c('0x74'),'appdata':_0x14cb74[_0xa55c('0xd')]+','+(_0x2948b1[_0xa55c('0x67')]['queueTransferTimeout']||0x12c),'interval':_0xa55c('0x75')}]},routingClient);})['then'](respondWithResult(_0x59414d,null))['catch'](handleError(_0x59414d,null));};};exports[_0xa55c('0x76')]=function(_0x413b45,_0x1e298d){var _0x249b0c,_0x2544c1;if(_[_0xa55c('0x10')](_0x413b45[_0xa55c('0x1f')]['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x71bd0d=_0x413b45[_0xa55c('0x1f')][_0xa55c('0x77')];var _0x1f4bc8=_[_0xa55c('0x65')](_0x71bd0d);var _0x2a0805=_0x71bd0d===_0xa55c('0x66')?_0xa55c('0x78'):_0xa55c('0x67');return db[_0xa55c('0x79')]['findOne']({'raw':!![],'where':{'id':_0x413b45[_0xa55c('0x1c')]['id'],'role':_0xa55c('0x39')}})['then'](function(_0xb9708){if(_['isNil'](_0xb9708)){throw new Error(_0xa55c('0x7a'));}_0x249b0c=_0xb9708;return db[_0x1f4bc8+_0xa55c('0x7b')][_0xa55c('0x69')]({'where':{'id':_0x413b45[_0xa55c('0x1f')][_0xa55c('0x6b')]},'include':[{'model':db[_0x1f4bc8+'Interaction'],'as':_0xa55c('0x6c')},{'model':db[_0x1f4bc8+_0x2a0805],'as':_0xa55c('0x67')}]});})[_0xa55c('0x18')](function(_0x376c1f){if(_[_0xa55c('0x10')](_0x376c1f)){throw new Error(_0x1f4bc8+_0xa55c('0x7c'));}_0x2544c1=_0x376c1f;return _0x376c1f[_0xa55c('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x49a307={'uniqueid':_0x71bd0d+'.'+_0x2544c1['id']+'.'+_0x2544c1['Interaction']['id'],'FromUserId':_0x413b45[_0xa55c('0x2d')]['id'],'type':'queue','ToUserId':_0x249b0c['id']};_0x49a307[_0x1f4bc8+_0xa55c('0x6e')]=_0x2544c1['id'];_0x49a307[_0x1f4bc8+_0xa55c('0x6f')]=_0x2544c1[_0xa55c('0x6c')]['id'];_0x49a307[_0xa55c('0x70')+_0x1f4bc8+_0x2a0805+'Id']=_0x2544c1[_0xa55c('0x67')]['id'];return db[_0x1f4bc8+'TransferReport'][_0xa55c('0x72')](_0x49a307);})['then'](function(){return respondWithRpcPromise(_0xa55c('0x73'),{'channel':_0x71bd0d,'interaction':_0x2544c1[_0xa55c('0x6c')],'message':_0x2544c1,'account':_0x2544c1[_0xa55c('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa55c('0x39'),'appdata':_0x249b0c['name']+','+(_0x2544c1[_0xa55c('0x67')][_0xa55c('0x7d')]||0x12c),'interval':_0xa55c('0x75')}]},routingClient);})[_0xa55c('0x18')](respondWithResult(_0x1e298d,null))[_0xa55c('0xb')](handleError(_0x1e298d,null));}; \ No newline at end of file +var _0x6f47=['voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','interface','agent','internal','telephones','trunks','Trunks','Campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','Start','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','User','create','moment','lodash','../../mysqldb','api','client','http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel'];(function(_0x2eaceb,_0x41569f){var _0x367db8=function(_0x584daf){while(--_0x584daf){_0x2eaceb['push'](_0x2eaceb['shift']());}};_0x367db8(++_0x41569f);}(_0x6f47,0xc7));var _0x76f4=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x6f47[_0x2ec461];return _0x28603d;};'use strict';var BPromise=require('bluebird');var moment=require(_0x76f4('0x0'));var _=require(_0x76f4('0x1'));var util=require('util');var db=require(_0x76f4('0x2'))['db'];var logger=require('../../config/logger')(_0x76f4('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x76f4('0x4')][_0x76f4('0x5')]({'port':0x232a});var mailClient=jayson[_0x76f4('0x4')][_0x76f4('0x5')]({'port':0x232b});var routingClient=jayson['client'][_0x76f4('0x5')]({'port':0x232c});function respondWithRpcPromise(_0xfc2405,_0x2176a7,_0x497f99){return new BPromise(function(_0x1a3172,_0x25656d){var _0x65d2c7=_0x497f99?_0x497f99:amiClient;return _0x65d2c7[_0x76f4('0x6')](_0xfc2405,_0x2176a7)[_0x76f4('0x7')](function(_0x4c6b5c){if(_0x4c6b5c['error']){if(_0x4c6b5c[_0x76f4('0x8')][_0x76f4('0x9')]===0x1f4){return _0x25656d(_0x4c6b5c['error']['message']);}return _0x1a3172(_0x4c6b5c[_0x76f4('0x8')][_0x76f4('0xa')]);}else{_0x1a3172(_0x4c6b5c[_0x76f4('0xb')]);}})[_0x76f4('0xc')](function(_0x1aee7f){_0x25656d(_0x1aee7f);});});}function respondWithResult(_0xafd21e,_0xf7e347){_0xf7e347=_0xf7e347||0xc8;return function(_0x3ec740){if(_0x3ec740){return _0xafd21e[_0x76f4('0xd')](_0xf7e347)['json'](_0x3ec740);}return _0xafd21e[_0x76f4('0xe')](0x194);};}function handleError(_0x30dabf,_0x5da1ff){_0x5da1ff=_0x5da1ff||0x1f4;return function(_0x4b6021){logger['error'](_0x4b6021[_0x76f4('0xf')]);if(_0x4b6021[_0x76f4('0x10')]){delete _0x4b6021[_0x76f4('0x10')];}_0x30dabf[_0x76f4('0xd')](_0x5da1ff)[_0x76f4('0x11')](_0x4b6021);};}function findById(_0x2b5e23){return function(_0x46ba51){if(!_[_0x76f4('0x12')](_0x2b5e23)&&!_[_0x76f4('0x12')](_0x46ba51)&&!_[_0x76f4('0x12')](_0x46ba51[_0x76f4('0x13')])){return _[_0x76f4('0x14')](_0x46ba51[_0x76f4('0x13')],function(_0x38450e){return _0x38450e['id']==_0x2b5e23;});}return null;};}exports[_0x76f4('0x15')]=function(_0x397360,_0xfedbe4){return respondWithRpcPromise(_0x76f4('0x16'),_0x397360[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0xfedbe4,null))[_0x76f4('0xc')](handleError(_0xfedbe4,null));};exports[_0x76f4('0x18')]=function(_0x5bf3d5,_0x262937){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x76f4('0x19')](_0x5bf3d5[_0x76f4('0x17')],_0x5bf3d5[_0x76f4('0x1a')]))['then'](respondWithResult(_0x262937,null))['catch'](handleError(_0x262937,null));};exports['voiceChannelStopMixMonitor']=function(_0x465240,_0x681d67){return respondWithRpcPromise(_0x76f4('0x1b'),_[_0x76f4('0x19')](_0x465240[_0x76f4('0x17')],_0x465240[_0x76f4('0x1a')]))[_0x76f4('0x7')](respondWithResult(_0x681d67,null))['catch'](handleError(_0x681d67,null));};exports['voiceQueues']=function(_0x3794fa,_0x497913){return respondWithRpcPromise(_0x76f4('0x1c'),_0x3794fa['query'])['then'](respondWithResult(_0x497913,null))['catch'](handleError(_0x497913,null));};exports[_0x76f4('0x1d')]=function(_0x38300d,_0xd368a2){return respondWithRpcPromise(_0x76f4('0x1c'),_0x38300d[_0x76f4('0x17')])[_0x76f4('0x7')](findById(_0x38300d['params']['id']))[_0x76f4('0x7')](respondWithResult(_0xd368a2,null))['catch'](handleError(_0xd368a2,null));};exports['updateVoiceQueue']=function(_0x5b3f07,_0x10ddb4){return respondWithRpcPromise(_0x76f4('0x1e'),_[_0x76f4('0x19')](_0x5b3f07[_0x76f4('0x1f')],_0x5b3f07['params']))[_0x76f4('0x7')](respondWithResult(_0x10ddb4,null))['catch'](handleError(_0x10ddb4,null));};exports[_0x76f4('0x20')]=function(_0x3c7513,_0x43ac4a){return respondWithRpcPromise(_0x76f4('0x21'),_[_0x76f4('0x19')](_0x3c7513['query'],_0x3c7513['params']))[_0x76f4('0x7')](respondWithResult(_0x43ac4a,null))[_0x76f4('0xc')](handleError(_0x43ac4a,null));};exports[_0x76f4('0x22')]=function(_0x281db6,_0x1f2adf){return respondWithRpcPromise(_0x76f4('0x23'),_0x281db6[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0x1f2adf,null))[_0x76f4('0xc')](handleError(_0x1f2adf,null));};exports[_0x76f4('0x24')]=function(_0x308af2,_0x2527a6){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x308af2['query'],_0x308af2['params']))[_0x76f4('0x7')](respondWithResult(_0x2527a6,null))[_0x76f4('0xc')](handleError(_0x2527a6,null));};exports[_0x76f4('0x25')]=function(_0x456b1f,_0x26fdd6){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x76f4('0x19')](_0x456b1f[_0x76f4('0x17')],_0x456b1f[_0x76f4('0x1a')]))[_0x76f4('0x7')](respondWithResult(_0x26fdd6,null))[_0x76f4('0xc')](handleError(_0x26fdd6,null));};exports[_0x76f4('0x26')]=function(_0xb806cc,_0x28d9d6){return respondWithRpcPromise(_0x76f4('0x27'),_[_0x76f4('0x19')](_0xb806cc[_0x76f4('0x17')],_0xb806cc[_0x76f4('0x1a')]))[_0x76f4('0x7')](respondWithResult(_0x28d9d6,null))[_0x76f4('0xc')](handleError(_0x28d9d6,null));};exports[_0x76f4('0x28')]=function(_0x88506b,_0x3308e3){return respondWithRpcPromise(_0x76f4('0x29'),_0x88506b['query'])[_0x76f4('0x7')](respondWithResult(_0x3308e3,null))[_0x76f4('0xc')](handleError(_0x3308e3,null));};exports[_0x76f4('0x2a')]=function(_0x589637,_0x597e83){return respondWithRpcPromise(_0x76f4('0x2b'),_0x589637['query'])[_0x76f4('0x7')](respondWithResult(_0x597e83,null))['catch'](handleError(_0x597e83,null));};exports[_0x76f4('0x2c')]=function(_0x16f36d,_0x312243){var _0x378675;return respondWithRpcPromise(_0x76f4('0x2d'),_0x16f36d[_0x76f4('0x17')])[_0x76f4('0x7')](function(_0x109ad9){_0x378675=_0x109ad9;return respondWithRpcPromise(_0x76f4('0x2d'),_0x16f36d[_0x76f4('0x17')],routingClient);})['then'](function(_0x5b8d2d){return _[_0x76f4('0x19')]({},_0x5b8d2d,_0x378675);})[_0x76f4('0x7')](respondWithResult(_0x312243,null))[_0x76f4('0xc')](handleError(_0x312243,null));};exports[_0x76f4('0x2e')]=function(_0x2b7dc8,_0x2d6068){if(_0x2b7dc8[_0x76f4('0x1f')]&&_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')]&&_0x2b7dc8['user']&&_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')]){for(var _0x4f0d1a in _0x2b7dc8['body'][_0x76f4('0x2f')]){if(_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x76f4('0x31')](_0x4f0d1a)){db[_0x76f4('0x32')]['findAll']({'where':{'channel':_0x4f0d1a,'membername':_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')],'type':_0x76f4('0x33'),'exitAt':null,'uniqueid':_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x4f0d1a]&&_0x2b7dc8[_0x76f4('0x1f')]['interaction'][_0x4f0d1a][_0x76f4('0x34')]?{'$notIn':_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x4f0d1a]}:{'$ne':null}}})['then'](function(_0x571261){var _0x11ea58=moment()[_0x76f4('0x35')](_0x76f4('0x36'));for(var _0x2bea6d=0x0,_0x36fa03=_0x571261['length'];_0x2bea6d<_0x36fa03;_0x2bea6d+=0x1){_0x571261[_0x2bea6d]['updateAttributes']({'exitAt':_0x11ea58});}});for(var _0x8e5b60=0x0;_0x8e5b60<_0x2b7dc8['body'][_0x76f4('0x2f')][_0x4f0d1a][_0x76f4('0x34')];_0x8e5b60+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0x4f0d1a,'membername':_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')],'type':_0x76f4('0x33'),'uniqueid':_0x2b7dc8[_0x76f4('0x1f')]['interaction'][_0x4f0d1a][_0x8e5b60],'exitAt':null},'defaults':{'channel':_0x4f0d1a,'membername':_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')],'interface':_[_0x76f4('0x12')](_0x2b7dc8['user'][_0x76f4('0x37')])?util[_0x76f4('0x35')]('SIP/%s',_0x2b7dc8['user'][_0x76f4('0x10')]):_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x37')],'type':_0x76f4('0x33'),'enterAt':moment()[_0x76f4('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x76f4('0x38'),'internal':_0x2b7dc8['user'][_0x76f4('0x39')],'uniqueid':_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x4f0d1a][_0x8e5b60]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b7dc8[_0x76f4('0x1a')]['id'],'capacity':_0x2b7dc8[_0x76f4('0x1f')]['capacity']},routingClient)[_0x76f4('0x7')](respondWithResult(_0x2d6068,null))[_0x76f4('0xc')](handleError(_0x2d6068,null));};exports[_0x76f4('0x3a')]=function(_0x1c658c,_0x40ff20){return respondWithRpcPromise('Telephones',_0x1c658c[_0x76f4('0x17')])['then'](respondWithResult(_0x40ff20,null))[_0x76f4('0xc')](handleError(_0x40ff20,null));};exports[_0x76f4('0x3b')]=function(_0x154ba,_0x5121ec){return respondWithRpcPromise(_0x76f4('0x3c'),_0x154ba[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0x5121ec,null))[_0x76f4('0xc')](handleError(_0x5121ec,null));};exports['campaigns']=function(_0x2028e9,_0xf11e07){return respondWithRpcPromise(_0x76f4('0x3d'),_0x2028e9[_0x76f4('0x17')])['then'](respondWithResult(_0xf11e07,null))[_0x76f4('0xc')](handleError(_0xf11e07,null));};exports['chatQueues']=function(_0x129048,_0x190c8d){return respondWithRpcPromise('ChatQueues',_0x129048['query'],routingClient)[_0x76f4('0x7')](respondWithResult(_0x190c8d,null))[_0x76f4('0xc')](handleError(_0x190c8d,null));};exports[_0x76f4('0x3e')]=function(_0x596b51,_0x27ba06){return respondWithRpcPromise(_0x76f4('0x3f'),_0x596b51[_0x76f4('0x17')],routingClient)['then'](findById(_0x596b51['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x27ba06,null))[_0x76f4('0xc')](handleError(_0x27ba06,null));};exports['mailQueues']=function(_0x490ced,_0x3f1840){return respondWithRpcPromise(_0x76f4('0x40'),_0x490ced[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x3f1840,null))[_0x76f4('0xc')](handleError(_0x3f1840,null));};exports[_0x76f4('0x41')]=function(_0x97be11,_0x36a52a){return respondWithRpcPromise(_0x76f4('0x40'),_0x97be11['query'],routingClient)['then'](findById(_0x97be11['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x36a52a,null))[_0x76f4('0xc')](handleError(_0x36a52a,null));};exports[_0x76f4('0x42')]=function(_0x3b6c16,_0x4c9d64){return respondWithRpcPromise('MailAccounts',_0x3b6c16[_0x76f4('0x17')],mailClient)['then'](respondWithResult(_0x4c9d64,null))[_0x76f4('0xc')](handleError(_0x4c9d64,null));};exports['openchannelQueues']=function(_0x4285dd,_0x25e510){return respondWithRpcPromise(_0x76f4('0x43'),_0x4285dd[_0x76f4('0x17')],routingClient)['then'](respondWithResult(_0x25e510,null))[_0x76f4('0xc')](handleError(_0x25e510,null));};exports[_0x76f4('0x44')]=function(_0x22a0cc,_0x40c170){return respondWithRpcPromise(_0x76f4('0x43'),_0x22a0cc[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](findById(_0x22a0cc['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x40c170,null))[_0x76f4('0xc')](handleError(_0x40c170,null));};exports[_0x76f4('0x45')]=function(_0x320a87,_0x28cf4c){return respondWithRpcPromise(_0x76f4('0x46'),_0x320a87[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x28cf4c,null))['catch'](handleError(_0x28cf4c,null));};exports['showSmsQueues']=function(_0xa3091a,_0x617924){return respondWithRpcPromise(_0x76f4('0x46'),_0xa3091a['query'],routingClient)[_0x76f4('0x7')](findById(_0xa3091a['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x617924,null))[_0x76f4('0xc')](handleError(_0x617924,null));};exports['whatsappQueues']=function(_0xda0ac2,_0x37b7f7){return respondWithRpcPromise(_0x76f4('0x47'),_0xda0ac2[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x37b7f7,null))[_0x76f4('0xc')](handleError(_0x37b7f7,null));};exports[_0x76f4('0x48')]=function(_0x410d83,_0x1f7257){return respondWithRpcPromise('WhatsappQueues',_0x410d83[_0x76f4('0x17')],routingClient)['then'](findById(_0x410d83[_0x76f4('0x1a')]['id']))[_0x76f4('0x7')](respondWithResult(_0x1f7257,null))[_0x76f4('0xc')](handleError(_0x1f7257,null));};exports[_0x76f4('0x49')]=function(_0xfbb52c,_0x8de630){return respondWithRpcPromise(_0x76f4('0x4a'),_0xfbb52c[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x8de630,null))[_0x76f4('0xc')](handleError(_0x8de630,null));};exports['showFaxQueues']=function(_0x30f3de,_0x6f874d){return respondWithRpcPromise('FaxQueues',_0x30f3de[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](findById(_0x30f3de[_0x76f4('0x1a')]['id']))['then'](respondWithResult(_0x6f874d,null))[_0x76f4('0xc')](handleError(_0x6f874d,null));};exports[_0x76f4('0x4b')]=function(_0x3e829f,_0x52610a){return respondWithRpcPromise(_0x76f4('0x4c'),_0x3e829f[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0x52610a,null))[_0x76f4('0xc')](handleError(_0x52610a,null));};exports[_0x76f4('0x4d')]=function(_0x10ee07,_0x19b99c){return respondWithRpcPromise(_0x76f4('0x4e'),_0x10ee07[_0x76f4('0x17')],routingClient)['then'](respondWithResult(_0x19b99c,null))[_0x76f4('0xc')](handleError(_0x19b99c,null));};exports[_0x76f4('0x4f')]=function(_0x19fdc3,_0x39c9af){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x19fdc3[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x39c9af,null))[_0x76f4('0xc')](handleError(_0x39c9af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x43b44d,_0x1375d5){return respondWithRpcPromise(_0x76f4('0x50'),_0x43b44d[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x1375d5,null))['catch'](handleError(_0x1375d5,null));};exports[_0x76f4('0x51')]=function(_0x4dd41f,_0x2b8467){return respondWithRpcPromise(_0x76f4('0x50'),_0x4dd41f['query'],routingClient)['then'](function(_0x58251e){if(_0x4dd41f[_0x76f4('0x17')][_0x76f4('0x52')]!==undefined){var _0x1e7b6=_(_0x58251e[_0x76f4('0x13')])[_0x76f4('0x53')]([_0x4dd41f[_0x76f4('0x17')]['type'],_0x4dd41f[_0x76f4('0x1a')]['id']])[_0x76f4('0x54')](_0x76f4('0x55'))[_0x76f4('0x56')]()[_0x76f4('0x57')]();return _0x58251e[_0x76f4('0x13')][_0x76f4('0x53')](function(_0x202fc8){return _0x1e7b6['indexOf'](_0x202fc8[_0x76f4('0x55')])>-0x1;});}else{return _0x58251e['rows'][_0x76f4('0x53')](function(_0x30358a){return _0x30358a[_0x76f4('0x55')]===parseInt(_0x4dd41f[_0x76f4('0x1a')]['id']);});}})[_0x76f4('0x7')](respondWithResult(_0x2b8467,null))[_0x76f4('0xc')](handleError(_0x2b8467,null));};exports[_0x76f4('0x58')]=function(_0x2a0491,_0x54729b){return respondWithRpcPromise(_0x76f4('0x59'),_0x2a0491['query'],routingClient)['then'](respondWithResult(_0x54729b,null))['catch'](handleError(_0x54729b,null));};exports[_0x76f4('0x5a')]=function(_0x402209,_0x279040){return respondWithRpcPromise(_0x76f4('0x5b'),_0x402209['query'],routingClient)[_0x76f4('0x7')](respondWithResult(_0x279040,null))[_0x76f4('0xc')](handleError(_0x279040,null));};exports[_0x76f4('0x5c')]=function(_0x5f5c24,_0x12f16e){return respondWithRpcPromise(_0x76f4('0x5d'),_0x5f5c24[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x12f16e,null))[_0x76f4('0xc')](handleError(_0x12f16e,null));};exports[_0x76f4('0x5e')]=function(_0x3b5e15){return function(_0x4b562c,_0x2e991e){var _0xa49e2a,_0x4c7307;var _0x3bc914=_[_0x76f4('0x5f')](_0x3b5e15);var _0x5e6393=_0x3b5e15===_0x76f4('0x60')?_0x76f4('0x61'):_0x76f4('0x62');return db[_0x3bc914+_0x76f4('0x63')][_0x76f4('0x64')]({'raw':!![],'where':{'id':_0x4b562c[_0x76f4('0x1a')]['id']}})['then'](function(_0x2dac86){if(_[_0x76f4('0x12')](_0x2dac86)){throw new Error(_0x3bc914+_0x76f4('0x65'));}_0xa49e2a=_0x2dac86;return db[_0x3bc914+_0x76f4('0x66')]['findOne']({'where':{'id':_0x4b562c[_0x76f4('0x1f')]['messageId']},'include':[{'model':db[_0x3bc914+_0x76f4('0x67')],'as':'Interaction'},{'model':db[_0x3bc914+_0x5e6393],'as':_0x76f4('0x62')}]});})[_0x76f4('0x7')](function(_0x59e9ed){if(_['isNil'](_0x59e9ed)){throw new Error(_0x3bc914+_0x76f4('0x68'));}_0x4c7307=_0x59e9ed;return _0x59e9ed[_0x76f4('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x76f4('0x7')](function(){var _0x4a2969={'uniqueid':_0x3b5e15+'.'+_0x4c7307['id']+'.'+_0x4c7307['Interaction']['id'],'FromUserId':_0x4b562c[_0x76f4('0x30')]['id'],'type':_0x76f4('0x6a')};_0x4a2969[_0x3bc914+_0x76f4('0x6b')]=_0x4c7307['id'];_0x4a2969[_0x3bc914+_0x76f4('0x6c')]=_0x4c7307[_0x76f4('0x67')]['id'];_0x4a2969[_0x76f4('0x6d')+_0x3bc914+_0x5e6393+'Id']=_0x4c7307[_0x76f4('0x62')]['id'];_0x4a2969['To'+_0x3bc914+_0x76f4('0x6e')]=_0xa49e2a['id'];return db[_0x3bc914+'TransferReport']['create'](_0x4a2969);})[_0x76f4('0x7')](function(){return respondWithRpcPromise(_0x76f4('0x6f'),{'channel':_0x3b5e15,'interaction':_0x4c7307[_0x76f4('0x67')],'message':_0x4c7307,'account':_0x4c7307['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x76f4('0x6a'),'appdata':_0xa49e2a[_0x76f4('0x10')]+','+(_0x4c7307[_0x76f4('0x62')][_0x76f4('0x70')]||0x12c),'interval':_0x76f4('0x71')}]},routingClient);})[_0x76f4('0x7')](respondWithResult(_0x2e991e,null))[_0x76f4('0xc')](handleError(_0x2e991e,null));};};exports['agentNotify']=function(_0x13cf2a,_0x316f86){var _0x3e537b,_0x53252e;if(_[_0x76f4('0x12')](_0x13cf2a[_0x76f4('0x1f')][_0x76f4('0x72')])){throw new Error(_0x76f4('0x73'));}var _0x5080a9=_0x13cf2a[_0x76f4('0x1f')]['channel'];var _0xc80d4c=_['capitalize'](_0x5080a9);var _0x238df3=_0x5080a9===_0x76f4('0x60')?_0x76f4('0x61'):'Account';return db[_0x76f4('0x74')][_0x76f4('0x64')]({'raw':!![],'where':{'id':_0x13cf2a[_0x76f4('0x1a')]['id'],'role':'agent'}})[_0x76f4('0x7')](function(_0x460867){if(_['isNil'](_0x460867)){throw new Error('Agent\x20not\x20found');}_0x3e537b=_0x460867;return db[_0xc80d4c+_0x76f4('0x66')][_0x76f4('0x64')]({'where':{'id':_0x13cf2a['body']['messageId']},'include':[{'model':db[_0xc80d4c+_0x76f4('0x67')],'as':_0x76f4('0x67')},{'model':db[_0xc80d4c+_0x238df3],'as':'Account'}]});})[_0x76f4('0x7')](function(_0x54ae6c){if(_['isNil'](_0x54ae6c)){throw new Error(_0xc80d4c+'\x20Message\x20not\x20found');}_0x53252e=_0x54ae6c;return _0x54ae6c[_0x76f4('0x69')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x59265d={'uniqueid':_0x5080a9+'.'+_0x53252e['id']+'.'+_0x53252e[_0x76f4('0x67')]['id'],'FromUserId':_0x13cf2a['user']['id'],'type':'queue','ToUserId':_0x3e537b['id']};_0x59265d[_0xc80d4c+_0x76f4('0x6b')]=_0x53252e['id'];_0x59265d[_0xc80d4c+'InteractionId']=_0x53252e[_0x76f4('0x67')]['id'];_0x59265d[_0x76f4('0x6d')+_0xc80d4c+_0x238df3+'Id']=_0x53252e['Account']['id'];return db[_0xc80d4c+'TransferReport'][_0x76f4('0x75')](_0x59265d);})[_0x76f4('0x7')](function(){return respondWithRpcPromise(_0x76f4('0x6f'),{'channel':_0x5080a9,'interaction':_0x53252e['Interaction'],'message':_0x53252e,'account':_0x53252e[_0x76f4('0x62')],'applications':[{'id':0x0,'priority':0x1,'app':_0x76f4('0x38'),'appdata':_0x3e537b[_0x76f4('0x10')]+','+(_0x53252e[_0x76f4('0x62')]['agentTransferTimeout']||0x12c),'interval':_0x76f4('0x71')}]},routingClient);})[_0x76f4('0x7')](respondWithResult(_0x316f86,null))[_0x76f4('0xc')](handleError(_0x316f86,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 285d414..6d97bcc 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 _0x3577=['delete','destroy','exports','connect-timeout','express','fs-extra','../../components/auth/service','isAuthenticated','get','/:id','/:id/run','run','post','put'];(function(_0x4d2094,_0x4ea3ed){var _0x29de81=function(_0x54696c){while(--_0x54696c){_0x4d2094['push'](_0x4d2094['shift']());}};_0x29de81(++_0x4ea3ed);}(_0x3577,0x1d1));var _0x7357=function(_0x5c7da0,_0x173759){_0x5c7da0=_0x5c7da0-0x0;var _0x9c62d6=_0x3577[_0x5c7da0];return _0x9c62d6;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x7357('0x0'));var express=require(_0x7357('0x1'));var router=express['Router']();var fs_extra=require(_0x7357('0x2'));var auth=require(_0x7357('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./schedule.controller');router['get']('/',auth[_0x7357('0x4')](),controller['index']);router[_0x7357('0x5')](_0x7357('0x6'),auth['isAuthenticated'](),controller['show']);router[_0x7357('0x5')](_0x7357('0x7'),auth[_0x7357('0x4')](),controller[_0x7357('0x8')]);router[_0x7357('0x9')]('/',auth[_0x7357('0x4')](),controller['create']);router[_0x7357('0xa')](_0x7357('0x6'),auth['isAuthenticated'](),controller['update']);router[_0x7357('0xb')](_0x7357('0x6'),auth[_0x7357('0x4')](),controller[_0x7357('0xc')]);module[_0x7357('0xd')]=router; \ No newline at end of file +var _0xef5e=['/:id/run','post','create','/:id','update','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','get'];(function(_0x20b975,_0x2cd604){var _0x36aa13=function(_0x297efb){while(--_0x297efb){_0x20b975['push'](_0x20b975['shift']());}};_0x36aa13(++_0x2cd604);}(_0xef5e,0x104));var _0xeef5=function(_0x18a50f,_0x3751e6){_0x18a50f=_0x18a50f-0x0;var _0x567c1e=_0xef5e[_0x18a50f];return _0x567c1e;};'use strict';var multer=require('multer');var util=require(_0xeef5('0x0'));var path=require(_0xeef5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xeef5('0x2')]();var fs_extra=require(_0xeef5('0x3'));var auth=require(_0xeef5('0x4'));var interaction=require(_0xeef5('0x5'));var config=require(_0xeef5('0x6'));var controller=require(_0xeef5('0x7'));router['get']('/',auth[_0xeef5('0x8')](),controller['index']);router[_0xeef5('0x9')]('/:id',auth[_0xeef5('0x8')](),controller['show']);router['get'](_0xeef5('0xa'),auth[_0xeef5('0x8')](),controller['run']);router[_0xeef5('0xb')]('/',auth[_0xeef5('0x8')](),controller[_0xeef5('0xc')]);router['put'](_0xeef5('0xd'),auth[_0xeef5('0x8')](),controller[_0xeef5('0xe')]);router[_0xeef5('0xf')](_0xeef5('0xd'),auth[_0xeef5('0x8')](),controller[_0xeef5('0x10')]);module[_0xeef5('0x11')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index c04d528..77e7ed8 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 _0x581c=['TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','quarters','days','hours','minutes','csv','xlsx','ENUM','custom','default'];(function(_0x468398,_0x456db3){var _0x9afbea=function(_0x5ad17d){while(--_0x5ad17d){_0x468398['push'](_0x468398['shift']());}};_0x9afbea(++_0x456db3);}(_0x581c,0x111));var _0xc581=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x581c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc581('0x0'));module['exports']={'name':{'type':Sequelize[_0xc581('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc581('0x1')]},'active':{'type':Sequelize[_0xc581('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xc581('0x1')],'allowNull':![],'defaultValue':_0xc581('0x3')},'startAt':{'type':Sequelize[_0xc581('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xc581('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xc581('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xc581('0x6'),_0xc581('0x7'),'months','weeks',_0xc581('0x8'),_0xc581('0x9'),_0xc581('0xa')),'allowNull':![],'defaultValue':_0xc581('0x8')},'output':{'type':Sequelize['ENUM'](_0xc581('0xb'),'pdf',_0xc581('0xc')),'allowNull':![],'defaultValue':_0xc581('0xb')},'type':{'type':Sequelize[_0xc581('0xd')](_0xc581('0xe'),_0xc581('0xf')),'allowNull':![],'defaultValue':_0xc581('0xe')},'sendMail':{'type':Sequelize[_0xc581('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xc581('0x1')]},'cc':{'type':Sequelize[_0xc581('0x10')]},'bcc':{'type':Sequelize[_0xc581('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xc581('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6f5d=['custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters','weeks','days','hours','minutes','xlsx'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6f5d,0xb2));var _0xd6f5=function(_0x1f94cd,_0x465037){_0x1f94cd=_0x1f94cd-0x0;var _0x25d6f4=_0x6f5d[_0x1f94cd];return _0x25d6f4;};'use strict';var Sequelize=require(_0xd6f5('0x0'));module[_0xd6f5('0x1')]={'name':{'type':Sequelize[_0xd6f5('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xd6f5('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd6f5('0x4')},'startAt':{'type':Sequelize[_0xd6f5('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xd6f5('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xd6f5('0x6')](_0xd6f5('0x7'),_0xd6f5('0x8'),'months',_0xd6f5('0x9'),_0xd6f5('0xa'),_0xd6f5('0xb'),_0xd6f5('0xc')),'allowNull':![],'defaultValue':_0xd6f5('0xa')},'output':{'type':Sequelize[_0xd6f5('0x6')]('csv','pdf',_0xd6f5('0xd')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xd6f5('0x6')](_0xd6f5('0xe'),'default'),'allowNull':![],'defaultValue':_0xd6f5('0xe')},'sendMail':{'type':Sequelize[_0xd6f5('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xd6f5('0x2')]},'cc':{'type':Sequelize[_0xd6f5('0xf')]},'bcc':{'type':Sequelize[_0xd6f5('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xd6f5('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index a87bd61..64dfc2b 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 _0xb5f8=['params','fields','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','rimraf','zip-dir','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','sendStatus','stack','name','index','map','Schedule','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','show'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xb5f8,0x65));var _0x8b5f=function(_0x5b8ff7,_0x5d5b6c){_0x5b8ff7=_0x5b8ff7-0x0;var _0x85f05e=_0xb5f8[_0x5b8ff7];return _0x85f05e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b5f('0x0'));var zipdir=require(_0x8b5f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8b5f('0x2'));var BPromise=require(_0x8b5f('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8b5f('0x4'));var sox=require(_0x8b5f('0x5'));var csv=require(_0x8b5f('0x6'));var ejs=require(_0x8b5f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8b5f('0x8'));var squel=require('squel');var crypto=require(_0x8b5f('0x9'));var jsforce=require(_0x8b5f('0xa'));var deskjs=require(_0x8b5f('0xb'));var toCsv=require('to-csv');var querystring=require(_0x8b5f('0xc'));var Papa=require('papaparse');var Redis=require(_0x8b5f('0xd'));var authService=require(_0x8b5f('0xe'));var qs=require(_0x8b5f('0xf'));var as=require(_0x8b5f('0x10'));var hardwareService=require(_0x8b5f('0x11'));var logger=require(_0x8b5f('0x12'))(_0x8b5f('0x13'));var utils=require(_0x8b5f('0x14'));var config=require(_0x8b5f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8b5f('0x16'))['db'];function respondWithStatusCode(_0x29d44d,_0x5d65bb){_0x5d65bb=_0x5d65bb||0xcc;return function(_0x15d20e){if(_0x15d20e){return _0x29d44d['sendStatus'](_0x5d65bb);}return _0x29d44d[_0x8b5f('0x17')](_0x5d65bb)[_0x8b5f('0x18')]();};}function respondWithResult(_0x3b5051,_0x481078){_0x481078=_0x481078||0xc8;return function(_0x200a4d){if(_0x200a4d){return _0x3b5051[_0x8b5f('0x17')](_0x481078)[_0x8b5f('0x19')](_0x200a4d);}};}function respondWithFilteredResult(_0x3035ef,_0x6e4225){return function(_0x12488c){if(_0x12488c){var _0x58b6ed=typeof _0x6e4225[_0x8b5f('0x1a')]===_0x8b5f('0x1b')&&typeof _0x6e4225[_0x8b5f('0x1c')]===_0x8b5f('0x1b');var _0x5eede9=_0x12488c[_0x8b5f('0x1d')];var _0x1fd140=_0x58b6ed?0x0:_0x6e4225[_0x8b5f('0x1a')];var _0x3c4b83=_0x58b6ed?_0x12488c[_0x8b5f('0x1d')]:_0x6e4225[_0x8b5f('0x1a')]+_0x6e4225[_0x8b5f('0x1c')];var _0x55700a;if(_0x3c4b83>=_0x5eede9){_0x3c4b83=_0x5eede9;_0x55700a=0xc8;}else{_0x55700a=0xce;}_0x3035ef['status'](_0x55700a);return _0x3035ef[_0x8b5f('0x1e')](_0x8b5f('0x1f'),_0x1fd140+'-'+_0x3c4b83+'/'+_0x5eede9)[_0x8b5f('0x19')](_0x12488c);}return null;};}function patchUpdates(_0x421b67){return function(_0x5b8a72){try{jsonpatch[_0x8b5f('0x20')](_0x5b8a72,_0x421b67,!![]);}catch(_0xb8d377){return BPromise[_0x8b5f('0x21')](_0xb8d377);}return _0x5b8a72[_0x8b5f('0x22')]();};}function saveUpdates(_0x3f1d0e,_0x238ee9){return function(_0x29226d){if(_0x29226d){return _0x29226d[_0x8b5f('0x23')](_0x3f1d0e)['then'](function(_0x29d826){return _0x29d826;});}return null;};}function removeEntity(_0x89c187,_0x5cae3a){return function(_0x8641df){if(_0x8641df){return _0x8641df[_0x8b5f('0x24')]()[_0x8b5f('0x25')](function(){var _0x42737d=_0x8641df[_0x8b5f('0x26')]({'plain':!![]});var _0x3b28aa='Scheduler';return db['UserProfileResource']['destroy']({'where':{'type':_0x3b28aa,'resourceId':_0x42737d['id']}})[_0x8b5f('0x25')](function(){return _0x8641df;});})[_0x8b5f('0x25')](function(){_0x89c187[_0x8b5f('0x17')](0xcc)[_0x8b5f('0x18')]();});}};}function handleEntityNotFound(_0x38948e,_0x1a4098){return function(_0x3191fd){if(!_0x3191fd){_0x38948e[_0x8b5f('0x27')](0x194);}return _0x3191fd;};}function handleError(_0x9b0fcb,_0xff1ee6){_0xff1ee6=_0xff1ee6||0x1f4;return function(_0x318370){logger['error'](_0x318370[_0x8b5f('0x28')]);if(_0x318370['name']){delete _0x318370[_0x8b5f('0x29')];}_0x9b0fcb[_0x8b5f('0x17')](_0xff1ee6)['send'](_0x318370);};}exports[_0x8b5f('0x2a')]=function(_0x2cef84,_0x5213eb){var _0x2e9c2e={},_0x13e338={},_0x178e0e={'count':0x0,'rows':[]};var _0x110edd=_[_0x8b5f('0x2b')](db[_0x8b5f('0x2c')][_0x8b5f('0x2d')],function(_0x32541c){return{'name':_0x32541c[_0x8b5f('0x2e')],'type':_0x32541c[_0x8b5f('0x2f')][_0x8b5f('0x30')]};});_0x13e338['model']=_[_0x8b5f('0x2b')](_0x110edd,'name');_0x13e338['query']=_[_0x8b5f('0x31')](_0x2cef84[_0x8b5f('0x32')]);_0x13e338[_0x8b5f('0x33')]=_[_0x8b5f('0x34')](_0x13e338[_0x8b5f('0x35')],_0x13e338[_0x8b5f('0x32')]);_0x2e9c2e[_0x8b5f('0x36')]=_[_0x8b5f('0x34')](_0x13e338[_0x8b5f('0x35')],qs['fields'](_0x2cef84[_0x8b5f('0x32')]['fields']));_0x2e9c2e[_0x8b5f('0x36')]=_0x2e9c2e[_0x8b5f('0x36')]['length']?_0x2e9c2e['attributes']:_0x13e338[_0x8b5f('0x35')];if(!_0x2cef84[_0x8b5f('0x32')][_0x8b5f('0x37')](_0x8b5f('0x38'))){_0x2e9c2e[_0x8b5f('0x1c')]=qs[_0x8b5f('0x1c')](_0x2cef84[_0x8b5f('0x32')]['limit']);_0x2e9c2e[_0x8b5f('0x1a')]=qs[_0x8b5f('0x1a')](_0x2cef84[_0x8b5f('0x32')][_0x8b5f('0x1a')]);}_0x2e9c2e[_0x8b5f('0x39')]=qs['sort'](_0x2cef84[_0x8b5f('0x32')]['sort']);_0x2e9c2e[_0x8b5f('0x3a')]=qs[_0x8b5f('0x33')](_['pick'](_0x2cef84[_0x8b5f('0x32')],_0x13e338[_0x8b5f('0x33')]),_0x110edd);if(_0x2cef84[_0x8b5f('0x32')][_0x8b5f('0x3b')]){_0x2e9c2e[_0x8b5f('0x3a')]=_[_0x8b5f('0x3c')](_0x2e9c2e[_0x8b5f('0x3a')],{'$or':_[_0x8b5f('0x2b')](_0x110edd,function(_0x5bd60b){if(_0x5bd60b[_0x8b5f('0x2f')]!==_0x8b5f('0x3d')){var _0x4cbb95={};_0x4cbb95[_0x5bd60b[_0x8b5f('0x29')]]={'$like':'%'+_0x2cef84[_0x8b5f('0x32')][_0x8b5f('0x3b')]+'%'};return _0x4cbb95;}})});}_0x2e9c2e=_[_0x8b5f('0x3c')]({},_0x2e9c2e,_0x2cef84[_0x8b5f('0x3e')]);var _0xdb80f0={'where':_0x2e9c2e[_0x8b5f('0x3a')]};return db[_0x8b5f('0x2c')]['count'](_0xdb80f0)[_0x8b5f('0x25')](function(_0x2e7830){_0x178e0e[_0x8b5f('0x1d')]=_0x2e7830;if(_0x2cef84[_0x8b5f('0x32')][_0x8b5f('0x3f')]){_0x2e9c2e['include']=[{'all':!![]}];}return db[_0x8b5f('0x2c')]['findAll'](_0x2e9c2e);})['then'](function(_0x511441){_0x178e0e[_0x8b5f('0x40')]=_0x511441;return _0x178e0e;})[_0x8b5f('0x25')](respondWithFilteredResult(_0x5213eb,_0x2e9c2e))[_0x8b5f('0x41')](handleError(_0x5213eb,null));};exports[_0x8b5f('0x42')]=function(_0x3791d6,_0x2876d3){var _0x492b20={'raw':![],'where':{'id':_0x3791d6[_0x8b5f('0x43')]['id']}},_0x5a3929={};_0x5a3929[_0x8b5f('0x35')]=_[_0x8b5f('0x31')](db['Schedule'][_0x8b5f('0x2d')]);_0x5a3929[_0x8b5f('0x32')]=_[_0x8b5f('0x31')](_0x3791d6[_0x8b5f('0x32')]);_0x5a3929[_0x8b5f('0x33')]=_[_0x8b5f('0x34')](_0x5a3929[_0x8b5f('0x35')],_0x5a3929[_0x8b5f('0x32')]);_0x492b20[_0x8b5f('0x36')]=_[_0x8b5f('0x34')](_0x5a3929[_0x8b5f('0x35')],qs[_0x8b5f('0x44')](_0x3791d6[_0x8b5f('0x32')][_0x8b5f('0x44')]));_0x492b20[_0x8b5f('0x36')]=_0x492b20[_0x8b5f('0x36')][_0x8b5f('0x45')]?_0x492b20[_0x8b5f('0x36')]:_0x5a3929['model'];if(_0x3791d6[_0x8b5f('0x32')][_0x8b5f('0x3f')]){_0x492b20[_0x8b5f('0x46')]=[{'all':!![]}];}_0x492b20=_[_0x8b5f('0x3c')]({},_0x492b20,_0x3791d6[_0x8b5f('0x3e')]);return db['Schedule'][_0x8b5f('0x47')](_0x492b20)['then'](handleEntityNotFound(_0x2876d3,null))[_0x8b5f('0x25')](respondWithResult(_0x2876d3,null))['catch'](handleError(_0x2876d3,null));};exports[_0x8b5f('0x48')]=function(_0x4b25ba,_0x18c641){return db[_0x8b5f('0x2c')][_0x8b5f('0x48')](_0x4b25ba[_0x8b5f('0x49')],{})[_0x8b5f('0x25')](function(_0x1afc83){var _0x48b179=_0x4b25ba[_0x8b5f('0x4a')]['get']({'plain':!![]});if(!_0x48b179)throw new Error(_0x8b5f('0x4b'));if(_0x48b179[_0x8b5f('0x4c')]===_0x8b5f('0x4a')){var _0x165d42=_0x1afc83[_0x8b5f('0x26')]({'plain':!![]});var _0x215789=_0x8b5f('0x4d');return db['UserProfileSection'][_0x8b5f('0x47')]({'where':{'name':_0x215789,'userProfileId':_0x48b179[_0x8b5f('0x4e')]},'raw':!![]})[_0x8b5f('0x25')](function(_0x1b1df2){if(_0x1b1df2&&_0x1b1df2['autoAssociation']===0x0){return db[_0x8b5f('0x4f')]['create']({'name':_0x165d42[_0x8b5f('0x29')],'resourceId':_0x165d42['id'],'type':_0x1b1df2[_0x8b5f('0x29')],'sectionId':_0x1b1df2['id']},{})['then'](function(){return _0x1afc83;});}else{return _0x1afc83;}})[_0x8b5f('0x41')](function(_0x441c39){logger[_0x8b5f('0x50')](_0x8b5f('0x51'),_0x441c39);throw _0x441c39;});}return _0x1afc83;})[_0x8b5f('0x25')](respondWithResult(_0x18c641,0xc9))[_0x8b5f('0x41')](handleError(_0x18c641,null));};exports['update']=function(_0x23963b,_0xdb283b){if(_0x23963b[_0x8b5f('0x49')]['id']){delete _0x23963b['body']['id'];}return db[_0x8b5f('0x2c')][_0x8b5f('0x47')]({'where':{'id':_0x23963b[_0x8b5f('0x43')]['id']}})[_0x8b5f('0x25')](handleEntityNotFound(_0xdb283b,null))[_0x8b5f('0x25')](saveUpdates(_0x23963b[_0x8b5f('0x49')],null))[_0x8b5f('0x25')](respondWithResult(_0xdb283b,null))[_0x8b5f('0x41')](handleError(_0xdb283b,null));};exports[_0x8b5f('0x24')]=function(_0x411421,_0x350702){return db[_0x8b5f('0x2c')][_0x8b5f('0x47')]({'where':{'id':_0x411421[_0x8b5f('0x43')]['id']}})['then'](handleEntityNotFound(_0x350702,null))[_0x8b5f('0x25')](removeEntity(_0x350702,null))[_0x8b5f('0x41')](handleError(_0x350702,null));};exports[_0x8b5f('0x52')]=function(_0x5b4721,_0x3abbdc,_0x518f23){var _0x3147fc=require(_0x8b5f('0x53'));return db[_0x8b5f('0x2c')][_0x8b5f('0x47')]({'where':{'id':_0x5b4721[_0x8b5f('0x43')]['id']},'raw':!![]})[_0x8b5f('0x25')](handleEntityNotFound(_0x3abbdc,null))[_0x8b5f('0x25')](function(){_0x3147fc['run'](_0x5b4721['params']['id']);})[_0x8b5f('0x25')](respondWithStatusCode(_0x3abbdc,null))['catch'](handleError(_0x3abbdc,null));}; \ No newline at end of file +var _0x4f0e=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','Scheduler','UserProfileResource','end','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','type','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','include','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','zip-dir','moment','bluebird'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0x4f0e,0x1be));var _0xe4f0=function(_0x490be3,_0xf0fca3){_0x490be3=_0x490be3-0x0;var _0x3f5140=_0x4f0e[_0x490be3];return _0x3f5140;};'use strict';var emlformat=require(_0xe4f0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4f0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe4f0('0x2'));var BPromise=require(_0xe4f0('0x3'));var Mustache=require(_0xe4f0('0x4'));var util=require(_0xe4f0('0x5'));var path=require(_0xe4f0('0x6'));var sox=require(_0xe4f0('0x7'));var csv=require(_0xe4f0('0x8'));var ejs=require(_0xe4f0('0x9'));var fs=require('fs');var fs_extra=require(_0xe4f0('0xa'));var _=require(_0xe4f0('0xb'));var squel=require(_0xe4f0('0xc'));var crypto=require(_0xe4f0('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe4f0('0xe'));var Papa=require(_0xe4f0('0xf'));var Redis=require('ioredis');var authService=require(_0xe4f0('0x10'));var qs=require(_0xe4f0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4f0('0x12'));var logger=require(_0xe4f0('0x13'))(_0xe4f0('0x14'));var utils=require(_0xe4f0('0x15'));var config=require(_0xe4f0('0x16'));var licenseUtil=require(_0xe4f0('0x17'));var db=require(_0xe4f0('0x18'))['db'];function respondWithStatusCode(_0x20a39c,_0x4ffc29){_0x4ffc29=_0x4ffc29||0xcc;return function(_0x4eac58){if(_0x4eac58){return _0x20a39c[_0xe4f0('0x19')](_0x4ffc29);}return _0x20a39c[_0xe4f0('0x1a')](_0x4ffc29)['end']();};}function respondWithResult(_0x387229,_0x2ad13f){_0x2ad13f=_0x2ad13f||0xc8;return function(_0x34090e){if(_0x34090e){return _0x387229[_0xe4f0('0x1a')](_0x2ad13f)['json'](_0x34090e);}};}function respondWithFilteredResult(_0x2a0f37,_0x5b665e){return function(_0xa8e475){if(_0xa8e475){var _0x4d5305=typeof _0x5b665e['offset']==='undefined'&&typeof _0x5b665e[_0xe4f0('0x1b')]===_0xe4f0('0x1c');var _0x37a5b0=_0xa8e475['count'];var _0x274fd7=_0x4d5305?0x0:_0x5b665e['offset'];var _0x56820a=_0x4d5305?_0xa8e475[_0xe4f0('0x1d')]:_0x5b665e[_0xe4f0('0x1e')]+_0x5b665e[_0xe4f0('0x1b')];var _0x952667;if(_0x56820a>=_0x37a5b0){_0x56820a=_0x37a5b0;_0x952667=0xc8;}else{_0x952667=0xce;}_0x2a0f37[_0xe4f0('0x1a')](_0x952667);return _0x2a0f37[_0xe4f0('0x1f')](_0xe4f0('0x20'),_0x274fd7+'-'+_0x56820a+'/'+_0x37a5b0)[_0xe4f0('0x21')](_0xa8e475);}return null;};}function patchUpdates(_0x511f97){return function(_0x479ebf){try{jsonpatch[_0xe4f0('0x22')](_0x479ebf,_0x511f97,!![]);}catch(_0x47c29d){return BPromise[_0xe4f0('0x23')](_0x47c29d);}return _0x479ebf[_0xe4f0('0x24')]();};}function saveUpdates(_0x320a44,_0x5c8083){return function(_0x391359){if(_0x391359){return _0x391359[_0xe4f0('0x25')](_0x320a44)[_0xe4f0('0x26')](function(_0x46842f){return _0x46842f;});}return null;};}function removeEntity(_0x752b3b,_0x4bf77a){return function(_0x131030){if(_0x131030){return _0x131030[_0xe4f0('0x27')]()[_0xe4f0('0x26')](function(){var _0x1a275d=_0x131030['get']({'plain':!![]});var _0x3c0e4b=_0xe4f0('0x28');return db[_0xe4f0('0x29')][_0xe4f0('0x27')]({'where':{'type':_0x3c0e4b,'resourceId':_0x1a275d['id']}})[_0xe4f0('0x26')](function(){return _0x131030;});})[_0xe4f0('0x26')](function(){_0x752b3b[_0xe4f0('0x1a')](0xcc)[_0xe4f0('0x2a')]();});}};}function handleEntityNotFound(_0x41f726,_0x8ce674){return function(_0x1bba7c){if(!_0x1bba7c){_0x41f726[_0xe4f0('0x19')](0x194);}return _0x1bba7c;};}function handleError(_0x391d46,_0x4fa811){_0x4fa811=_0x4fa811||0x1f4;return function(_0x5671a2){logger[_0xe4f0('0x2b')](_0x5671a2[_0xe4f0('0x2c')]);if(_0x5671a2[_0xe4f0('0x2d')]){delete _0x5671a2[_0xe4f0('0x2d')];}_0x391d46[_0xe4f0('0x1a')](_0x4fa811)[_0xe4f0('0x2e')](_0x5671a2);};}exports[_0xe4f0('0x2f')]=function(_0x46700d,_0x155a5a){var _0x40a25e={},_0x358b28={},_0x17e897={'count':0x0,'rows':[]};var _0x935ae2=_[_0xe4f0('0x30')](db[_0xe4f0('0x31')][_0xe4f0('0x32')],function(_0x4799cb){return{'name':_0x4799cb[_0xe4f0('0x33')],'type':_0x4799cb['type'][_0xe4f0('0x34')]};});_0x358b28[_0xe4f0('0x35')]=_['map'](_0x935ae2,_0xe4f0('0x2d'));_0x358b28['query']=_[_0xe4f0('0x36')](_0x46700d[_0xe4f0('0x37')]);_0x358b28[_0xe4f0('0x38')]=_[_0xe4f0('0x39')](_0x358b28[_0xe4f0('0x35')],_0x358b28['query']);_0x40a25e[_0xe4f0('0x3a')]=_['intersection'](_0x358b28['model'],qs[_0xe4f0('0x3b')](_0x46700d[_0xe4f0('0x37')][_0xe4f0('0x3b')]));_0x40a25e['attributes']=_0x40a25e[_0xe4f0('0x3a')][_0xe4f0('0x3c')]?_0x40a25e[_0xe4f0('0x3a')]:_0x358b28[_0xe4f0('0x35')];if(!_0x46700d['query']['hasOwnProperty'](_0xe4f0('0x3d'))){_0x40a25e[_0xe4f0('0x1b')]=qs[_0xe4f0('0x1b')](_0x46700d[_0xe4f0('0x37')][_0xe4f0('0x1b')]);_0x40a25e[_0xe4f0('0x1e')]=qs[_0xe4f0('0x1e')](_0x46700d[_0xe4f0('0x37')][_0xe4f0('0x1e')]);}_0x40a25e[_0xe4f0('0x3e')]=qs['sort'](_0x46700d[_0xe4f0('0x37')][_0xe4f0('0x3f')]);_0x40a25e[_0xe4f0('0x40')]=qs['filters'](_['pick'](_0x46700d['query'],_0x358b28[_0xe4f0('0x38')]),_0x935ae2);if(_0x46700d['query']['filter']){_0x40a25e['where']=_[_0xe4f0('0x41')](_0x40a25e['where'],{'$or':_[_0xe4f0('0x30')](_0x935ae2,function(_0x5a573f){if(_0x5a573f[_0xe4f0('0x42')]!==_0xe4f0('0x43')){var _0x38b316={};_0x38b316[_0x5a573f[_0xe4f0('0x2d')]]={'$like':'%'+_0x46700d[_0xe4f0('0x37')][_0xe4f0('0x44')]+'%'};return _0x38b316;}})});}_0x40a25e=_['merge']({},_0x40a25e,_0x46700d['options']);var _0x243ed0={'where':_0x40a25e[_0xe4f0('0x40')]};return db[_0xe4f0('0x31')][_0xe4f0('0x1d')](_0x243ed0)[_0xe4f0('0x26')](function(_0x507b0c){_0x17e897['count']=_0x507b0c;if(_0x46700d[_0xe4f0('0x37')][_0xe4f0('0x45')]){_0x40a25e['include']=[{'all':!![]}];}return db[_0xe4f0('0x31')][_0xe4f0('0x46')](_0x40a25e);})[_0xe4f0('0x26')](function(_0x2d310d){_0x17e897[_0xe4f0('0x47')]=_0x2d310d;return _0x17e897;})['then'](respondWithFilteredResult(_0x155a5a,_0x40a25e))[_0xe4f0('0x48')](handleError(_0x155a5a,null));};exports[_0xe4f0('0x49')]=function(_0x1d8ca4,_0x50b696){var _0xffa6c8={'raw':![],'where':{'id':_0x1d8ca4[_0xe4f0('0x4a')]['id']}},_0x7ecc2d={};_0x7ecc2d[_0xe4f0('0x35')]=_['keys'](db[_0xe4f0('0x31')]['rawAttributes']);_0x7ecc2d[_0xe4f0('0x37')]=_[_0xe4f0('0x36')](_0x1d8ca4[_0xe4f0('0x37')]);_0x7ecc2d[_0xe4f0('0x38')]=_[_0xe4f0('0x39')](_0x7ecc2d[_0xe4f0('0x35')],_0x7ecc2d[_0xe4f0('0x37')]);_0xffa6c8[_0xe4f0('0x3a')]=_[_0xe4f0('0x39')](_0x7ecc2d['model'],qs[_0xe4f0('0x3b')](_0x1d8ca4['query'][_0xe4f0('0x3b')]));_0xffa6c8['attributes']=_0xffa6c8[_0xe4f0('0x3a')]['length']?_0xffa6c8[_0xe4f0('0x3a')]:_0x7ecc2d[_0xe4f0('0x35')];if(_0x1d8ca4[_0xe4f0('0x37')]['includeAll']){_0xffa6c8[_0xe4f0('0x4b')]=[{'all':!![]}];}_0xffa6c8=_['merge']({},_0xffa6c8,_0x1d8ca4[_0xe4f0('0x4c')]);return db[_0xe4f0('0x31')]['find'](_0xffa6c8)[_0xe4f0('0x26')](handleEntityNotFound(_0x50b696,null))['then'](respondWithResult(_0x50b696,null))[_0xe4f0('0x48')](handleError(_0x50b696,null));};exports[_0xe4f0('0x4d')]=function(_0x3793a4,_0x54792d){return db['Schedule'][_0xe4f0('0x4d')](_0x3793a4[_0xe4f0('0x4e')],{})[_0xe4f0('0x26')](function(_0x435f07){var _0x52ee2c=_0x3793a4[_0xe4f0('0x4f')][_0xe4f0('0x50')]({'plain':!![]});if(!_0x52ee2c)throw new Error(_0xe4f0('0x51'));if(_0x52ee2c[_0xe4f0('0x52')]===_0xe4f0('0x4f')){var _0xa678b4=_0x435f07[_0xe4f0('0x50')]({'plain':!![]});var _0x94f541=_0xe4f0('0x28');return db[_0xe4f0('0x53')][_0xe4f0('0x54')]({'where':{'name':_0x94f541,'userProfileId':_0x52ee2c[_0xe4f0('0x55')]},'raw':!![]})[_0xe4f0('0x26')](function(_0x5b15b8){if(_0x5b15b8&&_0x5b15b8[_0xe4f0('0x56')]===0x0){return db[_0xe4f0('0x29')][_0xe4f0('0x4d')]({'name':_0xa678b4[_0xe4f0('0x2d')],'resourceId':_0xa678b4['id'],'type':_0x5b15b8[_0xe4f0('0x2d')],'sectionId':_0x5b15b8['id']},{})[_0xe4f0('0x26')](function(){return _0x435f07;});}else{return _0x435f07;}})['catch'](function(_0x22ac43){logger[_0xe4f0('0x2b')](_0xe4f0('0x57'),_0x22ac43);throw _0x22ac43;});}return _0x435f07;})[_0xe4f0('0x26')](respondWithResult(_0x54792d,0xc9))[_0xe4f0('0x48')](handleError(_0x54792d,null));};exports[_0xe4f0('0x25')]=function(_0x1b8971,_0x594cc6){if(_0x1b8971['body']['id']){delete _0x1b8971[_0xe4f0('0x4e')]['id'];}return db[_0xe4f0('0x31')][_0xe4f0('0x54')]({'where':{'id':_0x1b8971[_0xe4f0('0x4a')]['id']}})[_0xe4f0('0x26')](handleEntityNotFound(_0x594cc6,null))[_0xe4f0('0x26')](saveUpdates(_0x1b8971['body'],null))[_0xe4f0('0x26')](respondWithResult(_0x594cc6,null))[_0xe4f0('0x48')](handleError(_0x594cc6,null));};exports[_0xe4f0('0x27')]=function(_0x56aa0c,_0x487afe){return db[_0xe4f0('0x31')][_0xe4f0('0x54')]({'where':{'id':_0x56aa0c[_0xe4f0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x487afe,null))[_0xe4f0('0x26')](removeEntity(_0x487afe,null))['catch'](handleError(_0x487afe,null));};exports[_0xe4f0('0x58')]=function(_0x390e35,_0x44f538,_0x10ef6d){var _0x28494d=require(_0xe4f0('0x59'));return db['Schedule'][_0xe4f0('0x54')]({'where':{'id':_0x390e35[_0xe4f0('0x4a')]['id']},'raw':!![]})[_0xe4f0('0x26')](handleEntityNotFound(_0x44f538,null))[_0xe4f0('0x26')](function(){_0x28494d['run'](_0x390e35[_0xe4f0('0x4a')]['id']);})[_0xe4f0('0x26')](respondWithStatusCode(_0x44f538,null))[_0xe4f0('0x48')](handleError(_0x44f538,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 16092b2..e3ec8a9 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 _0x71c4=['bluebird','rimraf','../../config/environment','./schedule.attributes','define','Schedule','tools_schedules','moment'];(function(_0x554e1b,_0x1a1804){var _0x57a756=function(_0x4a499e){while(--_0x4a499e){_0x554e1b['push'](_0x554e1b['shift']());}};_0x57a756(++_0x1a1804);}(_0x71c4,0x197));var _0x471c=function(_0x5c815f,_0x39e658){_0x5c815f=_0x5c815f-0x0;var _0x15534e=_0x71c4[_0x5c815f];return _0x15534e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x471c('0x0'));var BPromise=require(_0x471c('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x471c('0x2'));var config=require(_0x471c('0x3'));var attributes=require(_0x471c('0x4'));module['exports']=function(_0x378025,_0x55d449){return _0x378025[_0x471c('0x5')](_0x471c('0x6'),attributes,{'tableName':_0x471c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05c6=['rimraf','../../config/environment','./schedule.attributes','Schedule','lodash','../../config/logger','request-promise','path'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x05c6,0xb4));var _0x605c=function(_0x23df2c,_0x5268f3){_0x23df2c=_0x23df2c-0x0;var _0x16e65d=_0x05c6[_0x23df2c];return _0x16e65d;};'use strict';var _=require(_0x605c('0x0'));var util=require('util');var logger=require(_0x605c('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x605c('0x2'));var fs=require('fs');var path=require(_0x605c('0x3'));var rimraf=require(_0x605c('0x4'));var config=require(_0x605c('0x5'));var attributes=require(_0x605c('0x6'));module['exports']=function(_0x47ecb0,_0x1ee261){return _0x47ecb0['define'](_0x605c('0x7'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index da8746e..fb201a7 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 _0x1716=['Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','http','request','info'];(function(_0x20d916,_0x4bfa65){var _0x366417=function(_0xb3c76c){while(--_0xb3c76c){_0x20d916['push'](_0x20d916['shift']());}};_0x366417(++_0x4bfa65);}(_0x1716,0xfa));var _0x6171=function(_0x5d2b0e,_0xb20558){_0x5d2b0e=_0x5d2b0e-0x0;var _0x51fa9d=_0x1716[_0x5d2b0e];return _0x51fa9d;};'use strict';var _=require('lodash');var util=require(_0x6171('0x0'));var moment=require(_0x6171('0x1'));var BPromise=require(_0x6171('0x2'));var rs=require(_0x6171('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6171('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x6171('0x5'));var jayson=require(_0x6171('0x6'));var client=jayson['client'][_0x6171('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x64806a,_0x354a6b,_0x2e5eec){return new BPromise(function(_0x5d3309,_0x2c0e97){return client[_0x6171('0x8')](_0x64806a,_0x2e5eec)['then'](function(_0xe4a5e7){logger[_0x6171('0x9')](_0x6171('0xa'),_0x354a6b,_0x6171('0xb'));logger[_0x6171('0xc')](_0x6171('0xd'),_0x354a6b,_0x6171('0xb'),JSON[_0x6171('0xe')](_0xe4a5e7));if(_0xe4a5e7[_0x6171('0xf')]){if(_0xe4a5e7[_0x6171('0xf')][_0x6171('0x10')]===0x1f4){logger[_0x6171('0xf')](_0x6171('0xa'),_0x354a6b,_0xe4a5e7[_0x6171('0xf')][_0x6171('0x11')]);return _0x2c0e97(_0xe4a5e7[_0x6171('0xf')][_0x6171('0x11')]);}logger[_0x6171('0xf')]('Schedule,\x20%s,\x20%s',_0x354a6b,_0xe4a5e7[_0x6171('0xf')][_0x6171('0x11')]);return _0x5d3309(_0xe4a5e7[_0x6171('0xf')][_0x6171('0x11')]);}else{logger[_0x6171('0x9')](_0x6171('0xa'),_0x354a6b,_0x6171('0xb'));_0x5d3309(_0xe4a5e7[_0x6171('0x12')][_0x6171('0x11')]);}})[_0x6171('0x13')](function(_0x296583){logger[_0x6171('0xf')](_0x6171('0xa'),_0x354a6b,_0x296583);_0x2c0e97(_0x296583);});});} \ No newline at end of file +var _0x48cb=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x48cb,0xee));var _0xb48c=function(_0x36500f,_0x1ffa4d){_0x36500f=_0x36500f-0x0;var _0xea95aa=_0x48cb[_0x36500f];return _0xea95aa;};'use strict';var _=require(_0xb48c('0x0'));var util=require(_0xb48c('0x1'));var moment=require(_0xb48c('0x2'));var BPromise=require(_0xb48c('0x3'));var rs=require(_0xb48c('0x4'));var fs=require('fs');var Redis=require(_0xb48c('0x5'));var db=require(_0xb48c('0x6'))['db'];var utils=require(_0xb48c('0x7'));var logger=require(_0xb48c('0x8'))(_0xb48c('0x9'));var config=require(_0xb48c('0xa'));var jayson=require(_0xb48c('0xb'));var client=jayson[_0xb48c('0xc')][_0xb48c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3a21cb,_0x14a0f0,_0xc2a1d3){return new BPromise(function(_0x33124f,_0xc01025){return client[_0xb48c('0xe')](_0x3a21cb,_0xc2a1d3)[_0xb48c('0xf')](function(_0x5a6eab){logger[_0xb48c('0x10')](_0xb48c('0x11'),_0x14a0f0,_0xb48c('0x12'));logger[_0xb48c('0x13')]('Schedule,\x20%s,\x20%s,\x20%s',_0x14a0f0,_0xb48c('0x12'),JSON[_0xb48c('0x14')](_0x5a6eab));if(_0x5a6eab[_0xb48c('0x15')]){if(_0x5a6eab['error'][_0xb48c('0x16')]===0x1f4){logger['error'](_0xb48c('0x11'),_0x14a0f0,_0x5a6eab['error'][_0xb48c('0x17')]);return _0xc01025(_0x5a6eab['error']['message']);}logger[_0xb48c('0x15')](_0xb48c('0x11'),_0x14a0f0,_0x5a6eab['error'][_0xb48c('0x17')]);return _0x33124f(_0x5a6eab[_0xb48c('0x15')][_0xb48c('0x17')]);}else{logger[_0xb48c('0x10')]('Schedule,\x20%s,\x20%s',_0x14a0f0,_0xb48c('0x12'));_0x33124f(_0x5a6eab[_0xb48c('0x18')][_0xb48c('0x17')]);}})[_0xb48c('0x19')](function(_0x557c52){logger['error'](_0xb48c('0x11'),_0x14a0f0,_0x557c52);_0xc01025(_0x557c52);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 86daad2..ff41c3c 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 _0x4495=['describe','/:id','show','/:id/download','download','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x1e92cd,_0x38dabd){var _0x4f5ffd=function(_0x4b2863){while(--_0x4b2863){_0x1e92cd['push'](_0x1e92cd['shift']());}};_0x4f5ffd(++_0x38dabd);}(_0x4495,0xd1));var _0x5449=function(_0x4da6a5,_0x1f2d6d){_0x4da6a5=_0x4da6a5-0x0;var _0x549f53=_0x4495[_0x4da6a5];return _0x549f53;};'use strict';var multer=require(_0x5449('0x0'));var util=require(_0x5449('0x1'));var path=require(_0x5449('0x2'));var timeout=require(_0x5449('0x3'));var express=require('express');var router=express[_0x5449('0x4')]();var fs_extra=require(_0x5449('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5449('0x6'));var config=require(_0x5449('0x7'));var controller=require('./screenRecording.controller');router[_0x5449('0x8')]('/',auth[_0x5449('0x9')](),controller[_0x5449('0xa')]);router[_0x5449('0x8')]('/describe',auth[_0x5449('0x9')](),controller[_0x5449('0xb')]);router[_0x5449('0x8')](_0x5449('0xc'),auth['isAuthenticated'](),controller[_0x5449('0xd')]);router[_0x5449('0x8')](_0x5449('0xe'),auth[_0x5449('0x9')](),controller[_0x5449('0xf')]);router[_0x5449('0x10')]('/',auth[_0x5449('0x9')](),controller[_0x5449('0x11')]);router[_0x5449('0x12')](_0x5449('0xc'),auth[_0x5449('0x9')](),controller[_0x5449('0x13')]);router['delete'](_0x5449('0xc'),auth[_0x5449('0x9')](),controller[_0x5449('0x14')]);module[_0x5449('0x15')]=router; \ No newline at end of file +var _0xb33b=['destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','download','post','create','put','update','delete'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb33b,0x1d0));var _0xbb33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb33b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xbb33('0x0'));var path=require(_0xbb33('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xbb33('0x2'));var auth=require(_0xbb33('0x3'));var interaction=require(_0xbb33('0x4'));var config=require(_0xbb33('0x5'));var controller=require(_0xbb33('0x6'));router[_0xbb33('0x7')]('/',auth[_0xbb33('0x8')](),controller['index']);router['get'](_0xbb33('0x9'),auth[_0xbb33('0x8')](),controller[_0xbb33('0xa')]);router[_0xbb33('0x7')](_0xbb33('0xb'),auth[_0xbb33('0x8')](),controller[_0xbb33('0xc')]);router[_0xbb33('0x7')]('/:id/download',auth[_0xbb33('0x8')](),controller[_0xbb33('0xd')]);router[_0xbb33('0xe')]('/',auth[_0xbb33('0x8')](),controller[_0xbb33('0xf')]);router[_0xbb33('0x10')](_0xbb33('0xb'),auth['isAuthenticated'](),controller[_0xbb33('0x11')]);router[_0xbb33('0x12')]('/:id',auth[_0xbb33('0x8')](),controller[_0xbb33('0x13')]);module[_0xbb33('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 2b68f27..21126a2 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 _0x1d63=['extname','STRING','setDataValue','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','../../config/environment','exports','getDataValue','value'];(function(_0x33ebf5,_0x258ec6){var _0x66957b=function(_0x49739a){while(--_0x49739a){_0x33ebf5['push'](_0x33ebf5['shift']());}};_0x66957b(++_0x258ec6);}(_0x1d63,0xa4));var _0x31d6=function(_0x56f8f2,_0x53f206){_0x56f8f2=_0x56f8f2-0x0;var _0x232cbd=_0x1d63[_0x56f8f2];return _0x232cbd;};'use strict';var Sequelize=require(_0x31d6('0x0'));var moment=require(_0x31d6('0x1'));var path=require(_0x31d6('0x2'));var config=require(_0x31d6('0x3'));module[_0x31d6('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x31d6('0x5')](_0x31d6('0x6'))?path[_0x31d6('0x7')](this[_0x31d6('0x5')](_0x31d6('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x31d6('0x8')]},'channel':{'type':Sequelize[_0x31d6('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x36b549){var _0x6cc83b=_0x36b549['replace'](/\\/g,'/');this[_0x31d6('0x9')](_0x31d6('0x6'),_0x6cc83b);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x4b32f8){this[_0x31d6('0x9')](_0x31d6('0xa'),moment()[_0x31d6('0xb')](_0x4b32f8,'ms'));this['setDataValue'](_0x31d6('0xc'),moment());this[_0x31d6('0x9')](_0x31d6('0xd'),_0x4b32f8);}},'startedAt':{'type':Sequelize[_0x31d6('0xe')],'get':function(){return moment(this[_0x31d6('0x5')]('startedAt'))[_0x31d6('0xf')](_0x31d6('0x10'))[_0x31d6('0x11')]();}},'closedAt':{'type':Sequelize[_0x31d6('0xe')],'get':function(){return moment(this[_0x31d6('0x5')](_0x31d6('0xc')))['format'](_0x31d6('0x10'))[_0x31d6('0x11')]();}},'createdAt':{'type':Sequelize[_0x31d6('0xe')],'get':function(){return moment(this[_0x31d6('0x5')]('createdAt'))[_0x31d6('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x31d6('0x11')]();}},'updatedAt':{'type':Sequelize[_0x31d6('0xe')],'get':function(){return moment(this[_0x31d6('0x5')](_0x31d6('0x12')))[_0x31d6('0xf')](_0x31d6('0x10'))['toString']();}}}; \ No newline at end of file +var _0xbecf=['duration','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','path','../../config/environment','exports','VIRTUAL','value','extname','getDataValue','STRING','replace','setDataValue','INTEGER','closedAt'];(function(_0x9c4b9e,_0x11f88e){var _0x2b176d=function(_0x348644){while(--_0x348644){_0x9c4b9e['push'](_0x9c4b9e['shift']());}};_0x2b176d(++_0x11f88e);}(_0xbecf,0x15c));var _0xfbec=function(_0x54262b,_0x19235b){_0x54262b=_0x54262b-0x0;var _0x584d72=_0xbecf[_0x54262b];return _0x584d72;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0xfbec('0x0'));var config=require(_0xfbec('0x1'));module[_0xfbec('0x2')]={'format':{'type':Sequelize[_0xfbec('0x3')],'get':function(){return this['getDataValue'](_0xfbec('0x4'))?path[_0xfbec('0x5')](this[_0xfbec('0x6')](_0xfbec('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0xfbec('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xfbec('0x7')],'set':function(_0x34a717){var _0x33c701=_0x34a717[_0xfbec('0x8')](/\\/g,'/');this[_0xfbec('0x9')](_0xfbec('0x4'),_0x33c701);}},'rating':{'type':Sequelize[_0xfbec('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xfbec('0xa')],'set':function(_0x21863f){this['setDataValue']('startedAt',moment()['subtract'](_0x21863f,'ms'));this[_0xfbec('0x9')](_0xfbec('0xb'),moment());this[_0xfbec('0x9')](_0xfbec('0xc'),_0x21863f);}},'startedAt':{'type':Sequelize[_0xfbec('0xd')],'get':function(){return moment(this['getDataValue'](_0xfbec('0xe')))[_0xfbec('0xf')](_0xfbec('0x10'))[_0xfbec('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xfbec('0x6')](_0xfbec('0xb')))[_0xfbec('0xf')](_0xfbec('0x10'))['toString']();}},'createdAt':{'type':Sequelize[_0xfbec('0xd')],'get':function(){return moment(this['getDataValue'](_0xfbec('0x12')))['format'](_0xfbec('0x10'))[_0xfbec('0x11')]();}},'updatedAt':{'type':Sequelize[_0xfbec('0xd')],'get':function(){return moment(this['getDataValue'](_0xfbec('0x13')))[_0xfbec('0xf')](_0xfbec('0x10'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 99605ec..883909f 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 _0x038b=['offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','error','name','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','params','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','root','%s.cypher','decryptFile','secrets','recording','join','server/files/screen_recordings','existsSync','ValidationError','ScreenRecording\x20not\x20found','filename','download','unlink','message','send','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x542475,_0x1ebbd7){var _0x569d71=function(_0x3db980){while(--_0x3db980){_0x542475['push'](_0x542475['shift']());}};_0x569d71(++_0x1ebbd7);}(_0x038b,0x114));var _0xb038=function(_0x375ec8,_0x263527){_0x375ec8=_0x375ec8-0x0;var _0x13986c=_0x038b[_0x375ec8];return _0x13986c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb038('0x0'));var zipdir=require(_0xb038('0x1'));var jsonpatch=require(_0xb038('0x2'));var rp=require('request-promise');var moment=require(_0xb038('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb038('0x4'));var util=require(_0xb038('0x5'));var path=require('path');var sox=require(_0xb038('0x6'));var csv=require(_0xb038('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb038('0x8'));var squel=require(_0xb038('0x9'));var crypto=require(_0xb038('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb038('0x7'));var querystring=require(_0xb038('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb038('0xc'));var qs=require(_0xb038('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb038('0xe'));var logger=require(_0xb038('0xf'))(_0xb038('0x10'));var utils=require(_0xb038('0x11'));var config=require(_0xb038('0x12'));var licenseUtil=require(_0xb038('0x13'));var db=require(_0xb038('0x14'))['db'];function respondWithStatusCode(_0x439751,_0x16e4a3){_0x16e4a3=_0x16e4a3||0xcc;return function(_0x57acd8){if(_0x57acd8){return _0x439751[_0xb038('0x15')](_0x16e4a3);}return _0x439751[_0xb038('0x16')](_0x16e4a3)[_0xb038('0x17')]();};}function respondWithResult(_0x3cc717,_0x3a71a6){_0x3a71a6=_0x3a71a6||0xc8;return function(_0x13acc7){if(_0x13acc7){return _0x3cc717[_0xb038('0x16')](_0x3a71a6)['json'](_0x13acc7);}};}function respondWithFilteredResult(_0xe8aa7c,_0x26e4f2){return function(_0x183141){if(_0x183141){var _0x39323e=typeof _0x26e4f2[_0xb038('0x18')]===_0xb038('0x19')&&typeof _0x26e4f2['limit']===_0xb038('0x19');var _0x3039b0=_0x183141[_0xb038('0x1a')];var _0x3b095a=_0x39323e?0x0:_0x26e4f2['offset'];var _0x49b237=_0x39323e?_0x183141[_0xb038('0x1a')]:_0x26e4f2[_0xb038('0x18')]+_0x26e4f2[_0xb038('0x1b')];var _0x31c348;if(_0x49b237>=_0x3039b0){_0x49b237=_0x3039b0;_0x31c348=0xc8;}else{_0x31c348=0xce;}_0xe8aa7c['status'](_0x31c348);return _0xe8aa7c[_0xb038('0x1c')](_0xb038('0x1d'),_0x3b095a+'-'+_0x49b237+'/'+_0x3039b0)[_0xb038('0x1e')](_0x183141);}return null;};}function patchUpdates(_0x33a377){return function(_0xc6cd61){try{jsonpatch['apply'](_0xc6cd61,_0x33a377,!![]);}catch(_0x2e0369){return BPromise[_0xb038('0x1f')](_0x2e0369);}return _0xc6cd61[_0xb038('0x20')]();};}function saveUpdates(_0x87b899,_0x5f123d){return function(_0x2812c9){if(_0x2812c9){return _0x2812c9[_0xb038('0x21')](_0x87b899)['then'](function(_0x1eb9cd){return _0x1eb9cd;});}return null;};}function removeEntity(_0x43d403,_0x573f93){return function(_0x241329){if(_0x241329){return _0x241329['destroy']()[_0xb038('0x22')](function(){_0x43d403[_0xb038('0x16')](0xcc)[_0xb038('0x17')]();});}};}function handleEntityNotFound(_0x1df7c4,_0x5d4343){return function(_0xe4ceda){if(!_0xe4ceda){_0x1df7c4[_0xb038('0x15')](0x194);}return _0xe4ceda;};}function handleError(_0x576be5,_0xb6d93f){_0xb6d93f=_0xb6d93f||0x1f4;return function(_0x33cf3c){logger[_0xb038('0x23')](_0x33cf3c['stack']);if(_0x33cf3c[_0xb038('0x24')]){delete _0x33cf3c[_0xb038('0x24')];}_0x576be5[_0xb038('0x16')](_0xb6d93f)['send'](_0x33cf3c);};}exports[_0xb038('0x25')]=function(_0x2855a6,_0x28a6a9){var _0x12b3b6={},_0xc387d={},_0x551b55={'count':0x0,'rows':[]};var _0x1783d4=_[_0xb038('0x26')](db[_0xb038('0x27')][_0xb038('0x28')],function(_0x1abe23){return{'name':_0x1abe23[_0xb038('0x29')],'type':_0x1abe23[_0xb038('0x2a')][_0xb038('0x2b')]};});_0xc387d[_0xb038('0x2c')]=_[_0xb038('0x2d')](_[_0xb038('0x26')](_0x1783d4,_0xb038('0x24')),[_0xb038('0x2e')]);_0xc387d['query']=_[_0xb038('0x2f')](_0x2855a6['query']);_0xc387d[_0xb038('0x30')]=_[_0xb038('0x31')](_0xc387d[_0xb038('0x2c')],_0xc387d[_0xb038('0x32')]);_0x12b3b6[_0xb038('0x33')]=_[_0xb038('0x31')](_0xc387d[_0xb038('0x2c')],qs[_0xb038('0x34')](_0x2855a6[_0xb038('0x32')][_0xb038('0x34')]));_0x12b3b6['attributes']=_0x12b3b6[_0xb038('0x33')][_0xb038('0x35')]?_0x12b3b6[_0xb038('0x33')]:_0xc387d['model'];if(!_0x2855a6['query']['hasOwnProperty'](_0xb038('0x36'))){_0x12b3b6[_0xb038('0x1b')]=qs[_0xb038('0x1b')](_0x2855a6[_0xb038('0x32')][_0xb038('0x1b')]);_0x12b3b6[_0xb038('0x18')]=qs['offset'](_0x2855a6[_0xb038('0x32')][_0xb038('0x18')]);}_0x12b3b6[_0xb038('0x37')]=qs[_0xb038('0x38')](_0x2855a6['query'][_0xb038('0x38')]);_0x12b3b6[_0xb038('0x39')]=qs['filters'](_['pick'](_0x2855a6[_0xb038('0x32')],_0xc387d[_0xb038('0x30')]),_0x1783d4);if(_0x2855a6[_0xb038('0x32')][_0xb038('0x3a')]){_0x12b3b6[_0xb038('0x39')]=_['merge'](_0x12b3b6[_0xb038('0x39')],{'$or':_[_0xb038('0x26')](_0x1783d4,function(_0x26d48c){if(_0x26d48c[_0xb038('0x2a')]!=='VIRTUAL'){var _0x793da9={};_0x793da9[_0x26d48c[_0xb038('0x24')]]={'$like':'%'+_0x2855a6[_0xb038('0x32')]['filter']+'%'};return _0x793da9;}})});}_0x12b3b6=_[_0xb038('0x3b')]({},_0x12b3b6,_0x2855a6['options']);var _0x36f281={'where':_0x12b3b6[_0xb038('0x39')]};return db[_0xb038('0x27')]['count'](_0x36f281)[_0xb038('0x22')](function(_0x357c78){_0x551b55[_0xb038('0x1a')]=_0x357c78;if(_0x2855a6['query'][_0xb038('0x3c')]){_0x12b3b6[_0xb038('0x3d')]=[{'all':!![]}];}return db[_0xb038('0x27')][_0xb038('0x3e')](_0x12b3b6);})['then'](function(_0x28b922){_0x551b55[_0xb038('0x3f')]=_0x28b922;return _0x551b55;})[_0xb038('0x22')](respondWithFilteredResult(_0x28a6a9,_0x12b3b6))[_0xb038('0x40')](handleError(_0x28a6a9,null));};exports['show']=function(_0x19dc7b,_0x269c7d){var _0x57816c={'raw':![],'where':{'id':_0x19dc7b[_0xb038('0x41')]['id']}},_0x207fb5={};_0x207fb5[_0xb038('0x2c')]=_['keys'](db[_0xb038('0x27')][_0xb038('0x28')]);_0x207fb5['query']=_['keys'](_0x19dc7b[_0xb038('0x32')]);_0x207fb5[_0xb038('0x30')]=_[_0xb038('0x31')](_0x207fb5[_0xb038('0x2c')],_0x207fb5[_0xb038('0x32')]);_0x57816c[_0xb038('0x33')]=_[_0xb038('0x31')](_0x207fb5[_0xb038('0x2c')],qs['fields'](_0x19dc7b['query']['fields']));_0x57816c[_0xb038('0x33')]=_0x57816c[_0xb038('0x33')]['length']?_0x57816c[_0xb038('0x33')]:_0x207fb5[_0xb038('0x2c')];if(_0x19dc7b[_0xb038('0x32')]['includeAll']){_0x57816c[_0xb038('0x3d')]=[{'all':!![]}];}_0x57816c=_['merge']({},_0x57816c,_0x19dc7b['options']);return db[_0xb038('0x27')][_0xb038('0x42')](_0x57816c)[_0xb038('0x22')](handleEntityNotFound(_0x269c7d,null))[_0xb038('0x22')](respondWithResult(_0x269c7d,null))[_0xb038('0x40')](handleError(_0x269c7d,null));};exports[_0xb038('0x43')]=function(_0x2f053a,_0x473aae){return db[_0xb038('0x27')][_0xb038('0x43')](_0x2f053a['body'],{})[_0xb038('0x22')](respondWithResult(_0x473aae,0xc9))[_0xb038('0x40')](handleError(_0x473aae,null));};exports['update']=function(_0x906c9c,_0x19ab72){if(_0x906c9c['body']['id']){delete _0x906c9c[_0xb038('0x44')]['id'];}delete _0x906c9c[_0xb038('0x44')][_0xb038('0x45')];delete _0x906c9c[_0xb038('0x44')][_0xb038('0x46')];delete _0x906c9c[_0xb038('0x44')][_0xb038('0x47')];delete _0x906c9c[_0xb038('0x44')][_0xb038('0x48')];return db['ScreenRecording'][_0xb038('0x42')]({'where':{'id':_0x906c9c[_0xb038('0x41')]['id']}})[_0xb038('0x22')](handleEntityNotFound(_0x19ab72,null))[_0xb038('0x22')](saveUpdates(_0x906c9c[_0xb038('0x44')],null))[_0xb038('0x22')](respondWithResult(_0x19ab72,null))['catch'](handleError(_0x19ab72,null));};exports[_0xb038('0x49')]=function(_0x2f3622,_0x2b2b4d){return db[_0xb038('0x27')][_0xb038('0x49')]()[_0xb038('0x22')](respondWithResult(_0x2b2b4d,null))[_0xb038('0x40')](handleError(_0x2b2b4d,null));};exports['download']=function(_0x3abe7a,_0x5c4a79,_0x77f211){var _0x1ea8ad=require(_0xb038('0x4a'));var _0x998fe3=![];var _0x1518c4={};if(_0x3abe7a['query']['type']&&_0x3abe7a['query'][_0xb038('0x2a')]===_0xb038('0x4b')){_0x1518c4[_0xb038('0x4b')]=_0x3abe7a[_0xb038('0x41')]['id'];}else{_0x1518c4['id']=_0x3abe7a[_0xb038('0x41')]['id'];}return db[_0xb038('0x27')]['find']({'where':_0x1518c4,'attributes':['id',_0xb038('0x48')],'raw':!![]})[_0xb038('0x22')](handleEntityNotFound(_0x5c4a79,null))['then'](function(_0x5b27d3){if(_0x5b27d3){var _0xf2907b=path['join'](config[_0xb038('0x4c')],'server/files/screen_recordings',_0x5b27d3[_0xb038('0x48')]);var _0x4677b8=util[_0xb038('0x2e')](_0xb038('0x4d'),_0xf2907b);if(fs['existsSync'](_0x4677b8)){_0x998fe3=!![];return _0x1ea8ad[_0xb038('0x4e')](_0x4677b8,_0xf2907b,config[_0xb038('0x4f')][_0xb038('0x50')])[_0xb038('0x22')](function(){return _0x5b27d3;});}return _0x5b27d3;}})[_0xb038('0x22')](function(_0x1246c8){if(_0x1246c8){var _0x14a553=path[_0xb038('0x51')](config[_0xb038('0x4c')],_0xb038('0x52'),_0x1246c8[_0xb038('0x48')]);if(!fs[_0xb038('0x53')](_0x14a553)){throw new db['Sequelize'][(_0xb038('0x54'))](_0xb038('0x55'));}if(_0x1246c8[_0xb038('0x56')]){return _0x5c4a79[_0xb038('0x57')](_0x14a553,_0x1246c8[_0xb038('0x56')]+path['extname'](_0x14a553),function(){if(_0x998fe3){fs[_0xb038('0x58')](_0x14a553);}});}else{return _0x5c4a79['download'](_0x14a553,function(_0xfb3ce6){if(_0x998fe3){fs[_0xb038('0x58')](_0x14a553);}});}}})['catch'](function(_0x15d61c){if(_0x15d61c[_0xb038('0x59')]===_0xb038('0x55')){_0x5c4a79[_0xb038('0x16')](0x194)[_0xb038('0x5a')](_0xb038('0x5b'));}else{return handleError(_0x5c4a79,null);}});};exports[_0xb038('0x5c')]=function(_0xe275b8,_0x769f1e){return db[_0xb038('0x27')]['find']({'where':{'id':_0xe275b8[_0xb038('0x41')]['id']}})['then'](function(_0x189894){if(_[_0xb038('0x5d')](_0x189894)){throw new ReferenceError(_0xb038('0x5e'));}return _0x189894;})[_0xb038('0x22')](function(_0x1f5f3f){var _0x23fb92=path[_0xb038('0x51')](config['root'],'server/files/screen_recordings',_0x1f5f3f[_0xb038('0x48')]);logger[_0xb038('0x5f')](_0xb038('0x60'),_0x23fb92);if(!_['isNil'](_0x1f5f3f['value'])&&fs[_0xb038('0x53')](_0x23fb92)){logger['info'](_0xb038('0x61')+_0x23fb92+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xb038('0x62')](_0x23fb92);}_0x23fb92=_0x23fb92+'.cypher';if(!_[_0xb038('0x5d')](_0x1f5f3f[_0xb038('0x48')])&&fs[_0xb038('0x53')](_0x23fb92)){logger[_0xb038('0x5f')](_0xb038('0x61')+_0x23fb92+_0xb038('0x63'));fs['unlinkSync'](_0x23fb92);}return _0x1f5f3f;})['then'](function(_0x45e628){if(!_0x45e628)throw new InternalError();return _0x45e628['destroy']();})[_0xb038('0x22')](function(){_0x769f1e[_0xb038('0x16')](0xcc)[_0xb038('0x17')]();})['catch'](handleError(_0x769f1e,null));}; \ No newline at end of file +var _0x008c=['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','sendStatus','send','index','ScreenRecording','rawAttributes','key','model','differenceBy','map','name','format','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','type','VIRTUAL','filter','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','duration','createdAt','closedAt','describe','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','decryptFile','secrets','recording','existsSync','ValidationError','filename','download','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x008c,0x188));var _0xc008=function(_0x320839,_0x3a18a5){_0x320839=_0x320839-0x0;var _0x29387e=_0x008c[_0x320839];return _0x29387e;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_[_0xc008('0x2b')](_0x2a7d4f,_0xc008('0x2c')),[_0xc008('0x2d')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x25eae4[_0xc008('0x2e')]);_0x32390d[_0xc008('0x30')]=_[_0xc008('0x31')](_0x32390d[_0xc008('0x29')],_0x32390d['query']);_0x24c14c[_0xc008('0x32')]=_[_0xc008('0x31')](_0x32390d['model'],qs[_0xc008('0x33')](_0x25eae4[_0xc008('0x2e')][_0xc008('0x33')]));_0x24c14c[_0xc008('0x32')]=_0x24c14c[_0xc008('0x32')][_0xc008('0x34')]?_0x24c14c[_0xc008('0x32')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2e')]['hasOwnProperty'](_0xc008('0x35'))){_0x24c14c[_0xc008('0x1d')]=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2e')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4['query'][_0xc008('0x1b')]);}_0x24c14c[_0xc008('0x36')]=qs['sort'](_0x25eae4[_0xc008('0x2e')][_0xc008('0x37')]);_0x24c14c['where']=qs[_0xc008('0x30')](_[_0xc008('0x38')](_0x25eae4[_0xc008('0x2e')],_0x32390d['filters']),_0x2a7d4f);if(_0x25eae4['query']['filter']){_0x24c14c[_0xc008('0x39')]=_['merge'](_0x24c14c[_0xc008('0x39')],{'$or':_[_0xc008('0x2b')](_0x2a7d4f,function(_0x6a4ccb){if(_0x6a4ccb[_0xc008('0x3a')]!==_0xc008('0x3b')){var _0xa381d1={};_0xa381d1[_0x6a4ccb[_0xc008('0x2c')]]={'$like':'%'+_0x25eae4[_0xc008('0x2e')][_0xc008('0x3c')]+'%'};return _0xa381d1;}})});}_0x24c14c=_[_0xc008('0x3d')]({},_0x24c14c,_0x25eae4[_0xc008('0x3e')]);var _0xdfca2e={'where':_0x24c14c[_0xc008('0x39')]};return db[_0xc008('0x26')]['count'](_0xdfca2e)[_0xc008('0x21')](function(_0x23c4db){_0x209591[_0xc008('0x1e')]=_0x23c4db;if(_0x25eae4[_0xc008('0x2e')]['includeAll']){_0x24c14c[_0xc008('0x3f')]=[{'all':!![]}];}return db[_0xc008('0x26')][_0xc008('0x40')](_0x24c14c);})[_0xc008('0x21')](function(_0x2d142d){_0x209591['rows']=_0x2d142d;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))[_0xc008('0x41')](handleError(_0x529961,null));};exports[_0xc008('0x42')]=function(_0x3e9a99,_0x7279e8){var _0x4f93a4={'raw':![],'where':{'id':_0x3e9a99[_0xc008('0x43')]['id']}},_0xf4cc4b={};_0xf4cc4b[_0xc008('0x29')]=_[_0xc008('0x2f')](db['ScreenRecording'][_0xc008('0x27')]);_0xf4cc4b[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x3e9a99['query']);_0xf4cc4b[_0xc008('0x30')]=_['intersection'](_0xf4cc4b[_0xc008('0x29')],_0xf4cc4b['query']);_0x4f93a4[_0xc008('0x32')]=_[_0xc008('0x31')](_0xf4cc4b['model'],qs[_0xc008('0x33')](_0x3e9a99[_0xc008('0x2e')][_0xc008('0x33')]));_0x4f93a4['attributes']=_0x4f93a4[_0xc008('0x32')][_0xc008('0x34')]?_0x4f93a4[_0xc008('0x32')]:_0xf4cc4b[_0xc008('0x29')];if(_0x3e9a99[_0xc008('0x2e')][_0xc008('0x44')]){_0x4f93a4['include']=[{'all':!![]}];}_0x4f93a4=_['merge']({},_0x4f93a4,_0x3e9a99['options']);return db[_0xc008('0x26')][_0xc008('0x45')](_0x4f93a4)[_0xc008('0x21')](handleEntityNotFound(_0x7279e8,null))[_0xc008('0x21')](respondWithResult(_0x7279e8,null))[_0xc008('0x41')](handleError(_0x7279e8,null));};exports[_0xc008('0x46')]=function(_0x2cf641,_0x33be4f){return db['ScreenRecording']['create'](_0x2cf641['body'],{})[_0xc008('0x21')](respondWithResult(_0x33be4f,0xc9))[_0xc008('0x41')](handleError(_0x33be4f,null));};exports[_0xc008('0x20')]=function(_0x511383,_0x28bc33){if(_0x511383[_0xc008('0x47')]['id']){delete _0x511383[_0xc008('0x47')]['id'];}delete _0x511383[_0xc008('0x47')][_0xc008('0x48')];delete _0x511383[_0xc008('0x47')][_0xc008('0x49')];delete _0x511383[_0xc008('0x47')][_0xc008('0x4a')];delete _0x511383[_0xc008('0x47')]['value'];return db['ScreenRecording'][_0xc008('0x45')]({'where':{'id':_0x511383['params']['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x28bc33,null))[_0xc008('0x21')](saveUpdates(_0x511383[_0xc008('0x47')],null))['then'](respondWithResult(_0x28bc33,null))[_0xc008('0x41')](handleError(_0x28bc33,null));};exports[_0xc008('0x4b')]=function(_0xee64,_0x8b9775){return db[_0xc008('0x26')]['describe']()[_0xc008('0x21')](respondWithResult(_0x8b9775,null))[_0xc008('0x41')](handleError(_0x8b9775,null));};exports['download']=function(_0x24f775,_0xfd6d1d,_0x5b5fbf){var _0x51d3dc=require(_0xc008('0x4c'));var _0xd47b74=![];var _0x20947b={};if(_0x24f775[_0xc008('0x2e')][_0xc008('0x3a')]&&_0x24f775['query']['type']===_0xc008('0x4d')){_0x20947b['uniqueid']=_0x24f775[_0xc008('0x43')]['id'];}else{_0x20947b['id']=_0x24f775[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x45')]({'where':_0x20947b,'attributes':['id',_0xc008('0x4e')],'raw':!![]})[_0xc008('0x21')](handleEntityNotFound(_0xfd6d1d,null))['then'](function(_0x2ea742){if(_0x2ea742){var _0xbd7422=path[_0xc008('0x4f')](config[_0xc008('0x50')],_0xc008('0x51'),_0x2ea742['value']);var _0x41fae3=util['format']('%s.cypher',_0xbd7422);if(fs['existsSync'](_0x41fae3)){_0xd47b74=!![];return _0x51d3dc[_0xc008('0x52')](_0x41fae3,_0xbd7422,config[_0xc008('0x53')][_0xc008('0x54')])['then'](function(){return _0x2ea742;});}return _0x2ea742;}})[_0xc008('0x21')](function(_0x2d8361){if(_0x2d8361){var _0x3dda82=path['join'](config[_0xc008('0x50')],_0xc008('0x51'),_0x2d8361[_0xc008('0x4e')]);if(!fs[_0xc008('0x55')](_0x3dda82)){throw new db['Sequelize'][(_0xc008('0x56'))]('ScreenRecording\x20not\x20found');}if(_0x2d8361[_0xc008('0x57')]){return _0xfd6d1d[_0xc008('0x58')](_0x3dda82,_0x2d8361[_0xc008('0x57')]+path[_0xc008('0x59')](_0x3dda82),function(){if(_0xd47b74){fs[_0xc008('0x5a')](_0x3dda82);}});}else{return _0xfd6d1d[_0xc008('0x58')](_0x3dda82,function(_0x4818c7){if(_0xd47b74){fs[_0xc008('0x5a')](_0x3dda82);}});}}})['catch'](function(_0x5bf4a9){if(_0x5bf4a9[_0xc008('0x5b')]===_0xc008('0x5c')){_0xfd6d1d['status'](0x194)[_0xc008('0x24')](_0xc008('0x5d'));}else{return handleError(_0xfd6d1d,null);}});};exports[_0xc008('0x22')]=function(_0x4517c0,_0x21ee6d){return db[_0xc008('0x26')][_0xc008('0x45')]({'where':{'id':_0x4517c0['params']['id']}})[_0xc008('0x21')](function(_0x462e1e){if(_[_0xc008('0x5e')](_0x462e1e)){throw new ReferenceError(_0xc008('0x5f'));}return _0x462e1e;})[_0xc008('0x21')](function(_0x167425){var _0x249898=path[_0xc008('0x4f')](config[_0xc008('0x50')],_0xc008('0x51'),_0x167425[_0xc008('0x4e')]);logger[_0xc008('0x60')](_0xc008('0x61'),_0x249898);if(!_[_0xc008('0x5e')](_0x167425['value'])&&fs[_0xc008('0x55')](_0x249898)){logger[_0xc008('0x60')](_0xc008('0x62')+_0x249898+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc008('0x63')](_0x249898);}_0x249898=_0x249898+_0xc008('0x64');if(!_['isNil'](_0x167425['value'])&&fs[_0xc008('0x55')](_0x249898)){logger[_0xc008('0x60')](_0xc008('0x62')+_0x249898+_0xc008('0x65'));fs[_0xc008('0x63')](_0x249898);}return _0x167425;})[_0xc008('0x21')](function(_0x238852){if(!_0x238852)throw new InternalError();return _0x238852[_0xc008('0x22')]();})[_0xc008('0x21')](function(){_0x21ee6d[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();})['catch'](handleError(_0x21ee6d,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 533c5e7..572b66b 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 _0x7518=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api'];(function(_0x229128,_0x273558){var _0x1875b9=function(_0x275e35){while(--_0x275e35){_0x229128['push'](_0x229128['shift']());}};_0x1875b9(++_0x273558);}(_0x7518,0xb0));var _0x8751=function(_0x4e175a,_0x2bae34){_0x4e175a=_0x4e175a-0x0;var _0x2ff2c4=_0x7518[_0x4e175a];return _0x2ff2c4;};'use strict';var _=require(_0x8751('0x0'));var util=require(_0x8751('0x1'));var logger=require(_0x8751('0x2'))(_0x8751('0x3'));var moment=require(_0x8751('0x4'));var BPromise=require(_0x8751('0x5'));var rp=require(_0x8751('0x6'));var fs=require('fs');var path=require(_0x8751('0x7'));var rimraf=require(_0x8751('0x8'));var config=require(_0x8751('0x9'));var attributes=require(_0x8751('0xa'));module['exports']=function(_0x3b1b14,_0x202276){return _0x3b1b14[_0x8751('0xb')](_0x8751('0xc'),attributes,{'tableName':_0x8751('0xd'),'paranoid':![],'indexes':[{'name':_0x8751('0xe'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x512a=['rimraf','../../config/environment','./screenRecording.attributes','exports','define','screen_recordings','interactionid','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x58dec8,_0x437045){var _0x3c9af8=function(_0x428b50){while(--_0x428b50){_0x58dec8['push'](_0x58dec8['shift']());}};_0x3c9af8(++_0x437045);}(_0x512a,0x1a7));var _0xa512=function(_0x29cc54,_0x13ffe5){_0x29cc54=_0x29cc54-0x0;var _0x3389e8=_0x512a[_0x29cc54];return _0x3389e8;};'use strict';var _=require(_0xa512('0x0'));var util=require(_0xa512('0x1'));var logger=require(_0xa512('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa512('0x3'));var rp=require(_0xa512('0x4'));var fs=require('fs');var path=require(_0xa512('0x5'));var rimraf=require(_0xa512('0x6'));var config=require(_0xa512('0x7'));var attributes=require(_0xa512('0x8'));module[_0xa512('0x9')]=function(_0x3823a7,_0x247892){return _0x3823a7[_0xa512('0xa')]('ScreenRecording',attributes,{'tableName':_0xa512('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xa512('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 695b620..6518dc4 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 _0x0586=['client','http','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x0586,0xe5));var _0x6058=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0586[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6058('0x0'));var util=require(_0x6058('0x1'));var moment=require(_0x6058('0x2'));var BPromise=require(_0x6058('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6058('0x4'));var db=require(_0x6058('0x5'))['db'];var utils=require(_0x6058('0x6'));var logger=require(_0x6058('0x7'))(_0x6058('0x8'));var config=require(_0x6058('0x9'));var jayson=require(_0x6058('0xa'));var client=jayson[_0x6058('0xb')][_0x6058('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1df024,_0x345d33,_0x5ac663){return new BPromise(function(_0x165034,_0x58b8ac){return client['request'](_0x1df024,_0x5ac663)[_0x6058('0xd')](function(_0x520abf){logger[_0x6058('0xe')](_0x6058('0xf'),_0x345d33,_0x6058('0x10'));logger[_0x6058('0x11')](_0x6058('0x12'),_0x345d33,_0x6058('0x10'),JSON['stringify'](_0x520abf));if(_0x520abf[_0x6058('0x13')]){if(_0x520abf[_0x6058('0x13')][_0x6058('0x14')]===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x345d33,_0x520abf['error']['message']);return _0x58b8ac(_0x520abf['error'][_0x6058('0x15')]);}logger[_0x6058('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x345d33,_0x520abf['error']['message']);return _0x165034(_0x520abf['error'][_0x6058('0x15')]);}else{logger[_0x6058('0xe')](_0x6058('0xf'),_0x345d33,_0x6058('0x10'));_0x165034(_0x520abf[_0x6058('0x16')][_0x6058('0x15')]);}})[_0x6058('0x17')](function(_0x483433){logger[_0x6058('0x13')](_0x6058('0xf'),_0x345d33,_0x483433);_0x58b8ac(_0x483433);});});} \ No newline at end of file +var _0x6a48=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird'];(function(_0x532001,_0x871c91){var _0x2b3a49=function(_0x837d1d){while(--_0x837d1d){_0x532001['push'](_0x532001['shift']());}};_0x2b3a49(++_0x871c91);}(_0x6a48,0x131));var _0x86a4=function(_0x16f938,_0xc620c7){_0x16f938=_0x16f938-0x0;var _0x1cc4da=_0x6a48[_0x16f938];return _0x1cc4da;};'use strict';var _=require(_0x86a4('0x0'));var util=require('util');var moment=require(_0x86a4('0x1'));var BPromise=require(_0x86a4('0x2'));var rs=require(_0x86a4('0x3'));var fs=require('fs');var Redis=require(_0x86a4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x86a4('0x5'));var logger=require(_0x86a4('0x6'))(_0x86a4('0x7'));var config=require(_0x86a4('0x8'));var jayson=require(_0x86a4('0x9'));var client=jayson['client'][_0x86a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c1502,_0x240771,_0x380d2c){return new BPromise(function(_0x4f7e98,_0xa3cd14){return client[_0x86a4('0xb')](_0x2c1502,_0x380d2c)[_0x86a4('0xc')](function(_0x717c02){logger[_0x86a4('0xd')](_0x86a4('0xe'),_0x240771,_0x86a4('0xf'));logger['debug'](_0x86a4('0x10'),_0x240771,_0x86a4('0xf'),JSON[_0x86a4('0x11')](_0x717c02));if(_0x717c02[_0x86a4('0x12')]){if(_0x717c02[_0x86a4('0x12')]['code']===0x1f4){logger[_0x86a4('0x12')](_0x86a4('0xe'),_0x240771,_0x717c02[_0x86a4('0x12')]['message']);return _0xa3cd14(_0x717c02[_0x86a4('0x12')][_0x86a4('0x13')]);}logger[_0x86a4('0x12')](_0x86a4('0xe'),_0x240771,_0x717c02[_0x86a4('0x12')][_0x86a4('0x13')]);return _0x4f7e98(_0x717c02[_0x86a4('0x12')][_0x86a4('0x13')]);}else{logger[_0x86a4('0xd')](_0x86a4('0xe'),_0x240771,_0x86a4('0xf'));_0x4f7e98(_0x717c02[_0x86a4('0x14')][_0x86a4('0x13')]);}})[_0x86a4('0x15')](function(_0xd70b62){logger['error'](_0x86a4('0xe'),_0x240771,_0xd70b62);_0xa3cd14(_0xd70b62);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index c2078ab..8851c3b 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 _0x6d5c=['isAuthenticated','index','/now','getDate','/:id','show','getLogo','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','extname','originalname','single','file','%s%s','/:id/logo_login','addLogoLogin','addPreferred','favicon','post','put','exports','multer','util','path','connect-timeout','fs-extra','../../config/environment','get'];(function(_0x5a3d35,_0x20927e){var _0xdb939f=function(_0x127796){while(--_0x127796){_0x5a3d35['push'](_0x5a3d35['shift']());}};_0xdb939f(++_0x20927e);}(_0x6d5c,0xd7));var _0xc6d5=function(_0x4724a3,_0xbf6656){_0x4724a3=_0x4724a3-0x0;var _0x1a547e=_0x6d5c[_0x4724a3];return _0x1a547e;};'use strict';var multer=require(_0xc6d5('0x0'));var util=require(_0xc6d5('0x1'));var path=require(_0xc6d5('0x2'));var timeout=require(_0xc6d5('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc6d5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc6d5('0x5'));var controller=require('./setting.controller');router[_0xc6d5('0x6')]('/',auth[_0xc6d5('0x7')](),controller[_0xc6d5('0x8')]);router[_0xc6d5('0x6')](_0xc6d5('0x9'),controller[_0xc6d5('0xa')]);router[_0xc6d5('0x6')](_0xc6d5('0xb'),controller[_0xc6d5('0xc')]);router['get']('/:id/logo',controller[_0xc6d5('0xd')]);router['get']('/:id/logo_login',controller['getLogoLogin']);router[_0xc6d5('0x6')](_0xc6d5('0xe'),controller['gdpr']);router[_0xc6d5('0x6')](_0xc6d5('0xf'),controller[_0xc6d5('0x10')]);router[_0xc6d5('0x6')](_0xc6d5('0x11'),controller[_0xc6d5('0x12')]);var upload=multer({'storage':multer[_0xc6d5('0x13')]({'destination':function(_0x13371b,_0x3f830f,_0x379050){_0x379050(null,path[_0xc6d5('0x14')](config[_0xc6d5('0x15')],_0xc6d5('0x16')));},'filename':function(_0x11d179,_0x2b58cd,_0x189d87){_0x189d87(null,util[_0xc6d5('0x17')]('%s%s',_0xc6d5('0x18'),path[_0xc6d5('0x19')](_0x2b58cd[_0xc6d5('0x1a')])));}})});router['post']('/:id/logo',upload[_0xc6d5('0x1b')](_0xc6d5('0x1c')),controller['addLogo']);var upload=multer({'storage':multer[_0xc6d5('0x13')]({'destination':function(_0x196a75,_0x9fcd2b,_0x7c6c66){_0x7c6c66(null,path[_0xc6d5('0x14')](config[_0xc6d5('0x15')],_0xc6d5('0x16')));},'filename':function(_0x1ce8cc,_0x13d8e7,_0x1c3d8e){_0x1c3d8e(null,util[_0xc6d5('0x17')](_0xc6d5('0x1d'),'logologin',path[_0xc6d5('0x19')](_0x13d8e7[_0xc6d5('0x1a')])));}})});router['post'](_0xc6d5('0x1e'),upload[_0xc6d5('0x1b')]('file'),controller[_0xc6d5('0x1f')]);var upload=multer({'storage':multer[_0xc6d5('0x13')]({'destination':function(_0x26697b,_0x43a8b3,_0x4fed71){_0x4fed71(null,path[_0xc6d5('0x14')](config[_0xc6d5('0x15')],'server/files/images/logos/'));},'filename':function(_0x38537d,_0xb9c482,_0x56b2bd){_0x56b2bd(null,util[_0xc6d5('0x17')](_0xc6d5('0x1d'),'preferred',path['extname'](_0xb9c482[_0xc6d5('0x1a')])));}})});router['post'](_0xc6d5('0xf'),upload[_0xc6d5('0x1b')](_0xc6d5('0x1c')),controller[_0xc6d5('0x20')]);var upload=multer({'storage':multer[_0xc6d5('0x13')]({'destination':function(_0xd4e1d6,_0x4688d9,_0x4eacd6){_0x4eacd6(null,path[_0xc6d5('0x14')](config['root'],_0xc6d5('0x16')));},'filename':function(_0x1ad008,_0x39bcbc,_0x26f7b6){_0x26f7b6(null,util[_0xc6d5('0x17')](_0xc6d5('0x1d'),_0xc6d5('0x21'),path[_0xc6d5('0x19')](_0x39bcbc[_0xc6d5('0x1a')])));}})});router[_0xc6d5('0x22')](_0xc6d5('0x11'),upload['single'](_0xc6d5('0x1c')),controller['addFavicon']);router[_0xc6d5('0x23')](_0xc6d5('0xb'),auth[_0xc6d5('0x7')](),controller['update']);module[_0xc6d5('0x24')]=router; \ No newline at end of file +var _0xa597=['/:id/gdpr','gdpr','/:id/preferred','join','root','server/files/images/logos/','format','logo','post','single','file','addLogo','%s%s','extname','originalname','addLogoLogin','diskStorage','preferred','addPreferred','favicon','put','update','exports','multer','connect-timeout','express','fs-extra','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0xa597,0x65));var _0x7a59=function(_0x855b1c,_0x131bc8){_0x855b1c=_0x855b1c-0x0;var _0x5b4c9e=_0xa597[_0x855b1c];return _0x5b4c9e;};'use strict';var multer=require(_0x7a59('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7a59('0x1'));var express=require(_0x7a59('0x2'));var router=express['Router']();var fs_extra=require(_0x7a59('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7a59('0x4'));router[_0x7a59('0x5')]('/',auth[_0x7a59('0x6')](),controller[_0x7a59('0x7')]);router[_0x7a59('0x5')](_0x7a59('0x8'),controller[_0x7a59('0x9')]);router['get'](_0x7a59('0xa'),controller[_0x7a59('0xb')]);router[_0x7a59('0x5')](_0x7a59('0xc'),controller[_0x7a59('0xd')]);router[_0x7a59('0x5')](_0x7a59('0xe'),controller[_0x7a59('0xf')]);router['get'](_0x7a59('0x10'),controller[_0x7a59('0x11')]);router[_0x7a59('0x5')](_0x7a59('0x12'),controller['getPreferred']);router[_0x7a59('0x5')]('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x57eda8,_0x3c0704,_0x1d72d6){_0x1d72d6(null,path[_0x7a59('0x13')](config[_0x7a59('0x14')],_0x7a59('0x15')));},'filename':function(_0x496796,_0x287a6d,_0x1fde8){_0x1fde8(null,util[_0x7a59('0x16')]('%s%s',_0x7a59('0x17'),path['extname'](_0x287a6d['originalname'])));}})});router[_0x7a59('0x18')](_0x7a59('0xc'),upload[_0x7a59('0x19')](_0x7a59('0x1a')),controller[_0x7a59('0x1b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1540e7,_0x51c65d,_0x1f8ca0){_0x1f8ca0(null,path['join'](config[_0x7a59('0x14')],_0x7a59('0x15')));},'filename':function(_0x2b6f82,_0x2d924e,_0x1668c9){_0x1668c9(null,util['format'](_0x7a59('0x1c'),'logologin',path[_0x7a59('0x1d')](_0x2d924e[_0x7a59('0x1e')])));}})});router[_0x7a59('0x18')](_0x7a59('0xe'),upload['single'](_0x7a59('0x1a')),controller[_0x7a59('0x1f')]);var upload=multer({'storage':multer[_0x7a59('0x20')]({'destination':function(_0x3216e3,_0x24abf5,_0x1ec4f9){_0x1ec4f9(null,path[_0x7a59('0x13')](config[_0x7a59('0x14')],'server/files/images/logos/'));},'filename':function(_0x32bc56,_0x4a71db,_0x50f850){_0x50f850(null,util[_0x7a59('0x16')](_0x7a59('0x1c'),_0x7a59('0x21'),path[_0x7a59('0x1d')](_0x4a71db[_0x7a59('0x1e')])));}})});router[_0x7a59('0x18')](_0x7a59('0x12'),upload[_0x7a59('0x19')](_0x7a59('0x1a')),controller[_0x7a59('0x22')]);var upload=multer({'storage':multer[_0x7a59('0x20')]({'destination':function(_0x506af9,_0xedb84b,_0x385e58){_0x385e58(null,path[_0x7a59('0x13')](config['root'],_0x7a59('0x15')));},'filename':function(_0x19dbe8,_0x4c18e5,_0x5f4634){_0x5f4634(null,util[_0x7a59('0x16')](_0x7a59('0x1c'),_0x7a59('0x23'),path['extname'](_0x4c18e5[_0x7a59('0x1e')])));}})});router[_0x7a59('0x18')]('/:id/favicon',upload['single']('file'),controller['addFavicon']);router[_0x7a59('0x24')](_0x7a59('0xa'),auth[_0x7a59('0x6')](),controller[_0x7a59('0x25')]);module[_0x7a59('0x26')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index f8e58af..bb99d02 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(_0xc088e0,_0xaee4fb){var _0x54f156=function(_0x25f482){while(--_0x25f482){_0xc088e0['push'](_0xc088e0['shift']());}};_0x54f156(++_0xaee4fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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(_0x19f4a7,_0x505884){var _0x467aed=function(_0x2797c9){while(--_0x2797c9){_0x19f4a7['push'](_0x19f4a7['shift']());}};_0x467aed(++_0x505884);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 49d5f93..0ea2e50 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 _0x83da=['filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','rawAttributes','find','update','body','addLogo','file','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','join','root','toLower','default_logo.svg','default','custom','Sequelize','upperFirst','getLogoLogin','defaultFavicon','default_loginLogo.svg','ValidationError','\x20not\x20found','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','download','getFavicon','default_favicon.ico','getDate','utcOffset','format','eml-format','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','request\x20sent','catch','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','destroy','stack','name','send','index','map','Setting','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x5b51e4,_0x5f15cf){var _0x596f12=function(_0x3661b7){while(--_0x3661b7){_0x5b51e4['push'](_0x5b51e4['shift']());}};_0x596f12(++_0x5f15cf);}(_0x83da,0xac));var _0xa83d=function(_0x4ded72,_0xd97d39){_0x4ded72=_0x4ded72-0x0;var _0x4dbb5e=_0x83da[_0x4ded72];return _0x4dbb5e;};'use strict';var emlformat=require(_0xa83d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa83d('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xa83d('0x2'));var util=require('util');var path=require(_0xa83d('0x3'));var sox=require(_0xa83d('0x4'));var csv=require(_0xa83d('0x5'));var ejs=require(_0xa83d('0x6'));var fs=require('fs');var fs_extra=require(_0xa83d('0x7'));var _=require(_0xa83d('0x8'));var squel=require('squel');var crypto=require(_0xa83d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xa83d('0xa'));var toCsv=require(_0xa83d('0x5'));var querystring=require(_0xa83d('0xb'));var Papa=require(_0xa83d('0xc'));var Redis=require('ioredis');var authService=require(_0xa83d('0xd'));var qs=require(_0xa83d('0xe'));var as=require(_0xa83d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa83d('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xa83d('0x11'));var db=require(_0xa83d('0x12'))['db'];var jayson=require(_0xa83d('0x13'));var client=jayson[_0xa83d('0x14')][_0xa83d('0x15')]({'port':0x232a});function respondWithRpcPromise(_0xedb851,_0x396e88,_0x3ecd84,_0x5ec7e0){return new BPromise(function(_0x5bb1f8,_0x392acc){var _0x1094cb=_0x5ec7e0||client;return _0x1094cb['request'](_0xedb851,_0x3ecd84)[_0xa83d('0x16')](function(_0x43e455){logger[_0xa83d('0x17')]('Setting,\x20%s,\x20%s',_0x396e88,'request\x20sent');logger['debug'](_0xa83d('0x18'),_0x396e88,'request\x20sent',JSON[_0xa83d('0x19')](_0x43e455));if(_0x43e455[_0xa83d('0x1a')]){if(_0x43e455['error'][_0xa83d('0x1b')]===0x1f4){logger[_0xa83d('0x1a')]('Setting,\x20%s,\x20%s',_0x396e88,_0x43e455[_0xa83d('0x1a')]['message']);return _0x392acc(_0x43e455['error']['message']);}logger[_0xa83d('0x1a')](_0xa83d('0x1c'),_0x396e88,_0x43e455[_0xa83d('0x1a')][_0xa83d('0x1d')]);return _0x5bb1f8(_0x43e455[_0xa83d('0x1a')][_0xa83d('0x1d')]);}else{logger[_0xa83d('0x17')](_0xa83d('0x1c'),_0x396e88,_0xa83d('0x1e'));_0x5bb1f8(_0x43e455['result']['message']);}})[_0xa83d('0x1f')](function(_0xc92663){logger[_0xa83d('0x1a')](_0xa83d('0x1c'),_0x396e88,_0xc92663);_0x392acc(_0xc92663);});});}function respondWithStatusCode(_0x38266a,_0x31f0bd){_0x31f0bd=_0x31f0bd||0xcc;return function(_0x3ba0f1){if(_0x3ba0f1){return _0x38266a[_0xa83d('0x20')](_0x31f0bd);}return _0x38266a[_0xa83d('0x21')](_0x31f0bd)['end']();};}function respondWithResult(_0x1f10f1,_0x2060b4){_0x2060b4=_0x2060b4||0xc8;return function(_0x1e926d){if(_0x1e926d){return _0x1f10f1[_0xa83d('0x21')](_0x2060b4)[_0xa83d('0x22')](_0x1e926d);}};}function respondWithFilteredResult(_0x485a17,_0x201454){return function(_0x48238c){if(_0x48238c){var _0x19fa06=typeof _0x201454['offset']===_0xa83d('0x23')&&typeof _0x201454[_0xa83d('0x24')]===_0xa83d('0x23');var _0x269fd9=_0x48238c[_0xa83d('0x25')];var _0x132b42=_0x19fa06?0x0:_0x201454['offset'];var _0x292641=_0x19fa06?_0x48238c[_0xa83d('0x25')]:_0x201454[_0xa83d('0x26')]+_0x201454[_0xa83d('0x24')];var _0x488b7c;if(_0x292641>=_0x269fd9){_0x292641=_0x269fd9;_0x488b7c=0xc8;}else{_0x488b7c=0xce;}_0x485a17[_0xa83d('0x21')](_0x488b7c);return _0x485a17['set'](_0xa83d('0x27'),_0x132b42+'-'+_0x292641+'/'+_0x269fd9)[_0xa83d('0x22')](_0x48238c);}return null;};}function patchUpdates(_0x495181){return function(_0xcbec00){try{jsonpatch[_0xa83d('0x28')](_0xcbec00,_0x495181,!![]);}catch(_0xcac2b6){return BPromise[_0xa83d('0x29')](_0xcac2b6);}return _0xcbec00['save']();};}function saveUpdates(_0x117026,_0x4229e8){return function(_0x3d28b9){if(_0x3d28b9){return _0x3d28b9['update'](_0x117026)[_0xa83d('0x16')](function(_0x493a08){return _0x493a08;});}return null;};}function removeEntity(_0x314c4d,_0x1e3e92){return function(_0x4ba9f6){if(_0x4ba9f6){return _0x4ba9f6[_0xa83d('0x2a')]()[_0xa83d('0x16')](function(){_0x314c4d[_0xa83d('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f86d7,_0x29acc6){return function(_0x16dde3){if(!_0x16dde3){_0x2f86d7[_0xa83d('0x20')](0x194);}return _0x16dde3;};}function handleError(_0x490a83,_0x2ada6b){_0x2ada6b=_0x2ada6b||0x1f4;return function(_0x56d2bd){logger[_0xa83d('0x1a')](_0x56d2bd[_0xa83d('0x2b')]);if(_0x56d2bd[_0xa83d('0x2c')]){delete _0x56d2bd['name'];}_0x490a83[_0xa83d('0x21')](_0x2ada6b)[_0xa83d('0x2d')](_0x56d2bd);};}exports[_0xa83d('0x2e')]=function(_0x44632e,_0x3b53e7){var _0x535d5d={},_0x333f70={},_0x1ecf27={'count':0x0,'rows':[]};var _0x377898=_[_0xa83d('0x2f')](db[_0xa83d('0x30')]['rawAttributes'],function(_0x5417ad){return{'name':_0x5417ad[_0xa83d('0x31')],'type':_0x5417ad[_0xa83d('0x32')][_0xa83d('0x33')]};});_0x333f70[_0xa83d('0x34')]=_['map'](_0x377898,_0xa83d('0x2c'));_0x333f70[_0xa83d('0x35')]=_[_0xa83d('0x36')](_0x44632e[_0xa83d('0x35')]);_0x333f70['filters']=_[_0xa83d('0x37')](_0x333f70[_0xa83d('0x34')],_0x333f70[_0xa83d('0x35')]);_0x535d5d['attributes']=_[_0xa83d('0x37')](_0x333f70[_0xa83d('0x34')],qs['fields'](_0x44632e[_0xa83d('0x35')][_0xa83d('0x38')]));_0x535d5d['attributes']=_0x535d5d[_0xa83d('0x39')][_0xa83d('0x3a')]?_0x535d5d[_0xa83d('0x39')]:_0x333f70[_0xa83d('0x34')];if(!_0x44632e[_0xa83d('0x35')][_0xa83d('0x3b')](_0xa83d('0x3c'))){_0x535d5d[_0xa83d('0x24')]=qs['limit'](_0x44632e[_0xa83d('0x35')][_0xa83d('0x24')]);_0x535d5d[_0xa83d('0x26')]=qs[_0xa83d('0x26')](_0x44632e[_0xa83d('0x35')][_0xa83d('0x26')]);}_0x535d5d[_0xa83d('0x3d')]=qs[_0xa83d('0x3e')](_0x44632e['query']['sort']);_0x535d5d[_0xa83d('0x3f')]=qs[_0xa83d('0x40')](_[_0xa83d('0x41')](_0x44632e[_0xa83d('0x35')],_0x333f70[_0xa83d('0x40')]),_0x377898);if(_0x44632e['query']['filter']){_0x535d5d[_0xa83d('0x3f')]=_[_0xa83d('0x42')](_0x535d5d['where'],{'$or':_[_0xa83d('0x2f')](_0x377898,function(_0x43f684){if(_0x43f684[_0xa83d('0x32')]!==_0xa83d('0x43')){var _0x4a2d64={};_0x4a2d64[_0x43f684['name']]={'$like':'%'+_0x44632e['query'][_0xa83d('0x44')]+'%'};return _0x4a2d64;}})});}_0x535d5d=_[_0xa83d('0x42')]({},_0x535d5d,_0x44632e[_0xa83d('0x45')]);var _0xddaa54={'where':_0x535d5d[_0xa83d('0x3f')]};return db[_0xa83d('0x30')]['count'](_0xddaa54)[_0xa83d('0x16')](function(_0x2ba013){_0x1ecf27[_0xa83d('0x25')]=_0x2ba013;if(_0x44632e[_0xa83d('0x35')][_0xa83d('0x46')]){_0x535d5d[_0xa83d('0x47')]=[{'all':!![]}];}return db['Setting'][_0xa83d('0x48')](_0x535d5d);})[_0xa83d('0x16')](function(_0x2815a2){_0x1ecf27[_0xa83d('0x49')]=_0x2815a2;return _0x1ecf27;})[_0xa83d('0x16')](respondWithFilteredResult(_0x3b53e7,_0x535d5d))['catch'](handleError(_0x3b53e7,null));};exports['show']=function(_0x55705a,_0x39a465){var _0x4d22eb={'raw':![],'where':{'id':_0x55705a[_0xa83d('0x4a')]['id']}},_0x4d9763={};_0x4d9763[_0xa83d('0x34')]=_[_0xa83d('0x36')](db[_0xa83d('0x30')][_0xa83d('0x4b')]);_0x4d9763[_0xa83d('0x35')]=_[_0xa83d('0x36')](_0x55705a[_0xa83d('0x35')]);_0x4d9763[_0xa83d('0x40')]=_[_0xa83d('0x37')](_0x4d9763[_0xa83d('0x34')],_0x4d9763[_0xa83d('0x35')]);_0x4d22eb[_0xa83d('0x39')]=_[_0xa83d('0x37')](_0x4d9763[_0xa83d('0x34')],qs[_0xa83d('0x38')](_0x55705a[_0xa83d('0x35')][_0xa83d('0x38')]));_0x4d22eb[_0xa83d('0x39')]=_0x4d22eb[_0xa83d('0x39')][_0xa83d('0x3a')]?_0x4d22eb[_0xa83d('0x39')]:_0x4d9763['model'];if(_0x55705a['query']['includeAll']){_0x4d22eb['include']=[{'all':!![]}];}_0x4d22eb=_[_0xa83d('0x42')]({},_0x4d22eb,_0x55705a[_0xa83d('0x45')]);return db[_0xa83d('0x30')][_0xa83d('0x4c')](_0x4d22eb)[_0xa83d('0x16')](handleEntityNotFound(_0x39a465,null))[_0xa83d('0x16')](respondWithResult(_0x39a465,null))[_0xa83d('0x1f')](handleError(_0x39a465,null));};exports[_0xa83d('0x4d')]=function(_0x4f857c,_0x27fe54){if(_0x4f857c[_0xa83d('0x4e')]['id']){delete _0x4f857c['body']['id'];}return db[_0xa83d('0x30')][_0xa83d('0x4c')]({'where':{'id':_0x4f857c[_0xa83d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x27fe54,null))[_0xa83d('0x16')](saveUpdates(_0x4f857c['body'],null))[_0xa83d('0x16')](respondWithResult(_0x27fe54,null))['catch'](handleError(_0x27fe54,null));};exports[_0xa83d('0x4f')]=function(_0x58d4de,_0x1a8ca3,_0x24e1ad){if(_0x58d4de['file']&&_0x58d4de[_0xa83d('0x50')]['filename']){_0x58d4de[_0xa83d('0x4e')]['logo']=_0x58d4de[_0xa83d('0x50')][_0xa83d('0x51')];}return db['Setting'][_0xa83d('0x4c')]({'where':{'id':_0x58d4de[_0xa83d('0x4a')]['id']}})[_0xa83d('0x16')](handleEntityNotFound(_0x1a8ca3,null))['then'](saveUpdates(_0x58d4de['body'],null))[_0xa83d('0x16')](respondWithResult(_0x1a8ca3,null))[_0xa83d('0x1f')](handleError(_0x1a8ca3,null));};exports[_0xa83d('0x52')]=function(_0x23c2d8,_0x22618c,_0x38442a){if(_0x23c2d8[_0xa83d('0x50')]&&_0x23c2d8[_0xa83d('0x50')][_0xa83d('0x51')]){_0x23c2d8[_0xa83d('0x4e')][_0xa83d('0x53')]=_0x23c2d8[_0xa83d('0x50')][_0xa83d('0x51')];}return db['Setting']['find']({'where':{'id':_0x23c2d8[_0xa83d('0x4a')]['id']}})[_0xa83d('0x16')](handleEntityNotFound(_0x22618c,null))[_0xa83d('0x16')](saveUpdates(_0x23c2d8['body'],null))['then'](respondWithResult(_0x22618c,null))[_0xa83d('0x1f')](handleError(_0x22618c,null));};var utilLicense=require(_0xa83d('0x11'));exports[_0xa83d('0x54')]=function(_0x142aa7,_0x2ac121,_0x4ae3ac){var _0x59a47b=_0xa83d('0x55');var _0x513944={'custom':![]};return utilLicense[_0xa83d('0x56')]()[_0xa83d('0x16')](function(_0x45d69b){if(_0x45d69b){_0x513944=_0x45d69b;}return db[_0xa83d('0x30')][_0xa83d('0x4c')]({'where':{'id':_0x142aa7[_0xa83d('0x4a')]['id']},'attributes':[_0xa83d('0x57'),'loginLogo',_0xa83d('0x58'),_0xa83d('0x59'),_0xa83d('0x5a'),_0xa83d('0x5b'),_0xa83d('0x5c'),'defaultFavicon'],'raw':!![]});})[_0xa83d('0x16')](handleEntityNotFound(_0x2ac121,null))['then'](function(_0x14ce41){if(_0x14ce41){var _0x2aa1c8=_0x14ce41[_0xa83d('0x57')]&&fs[_0xa83d('0x5d')](path[_0xa83d('0x5e')](config[_0xa83d('0x5f')],_0x59a47b,_[_0xa83d('0x60')](_0x14ce41['logo'])))?path[_0xa83d('0x5e')](config[_0xa83d('0x5f')],_0x59a47b,_[_0xa83d('0x60')](_0x14ce41['logo'])):path[_0xa83d('0x5e')](config[_0xa83d('0x5f')],_0x59a47b,_[_0xa83d('0x60')](_0xa83d('0x61')));var _0x34c137=_0xa83d('0x62')+_['upperFirst'](_0xa83d('0x57'));if(_0x14ce41[_0x34c137]||!_0x513944[_0xa83d('0x63')]){_0x2aa1c8=path[_0xa83d('0x5e')](config[_0xa83d('0x5f')],_0x59a47b,_['toLower'](_0xa83d('0x61')));}if(!fs[_0xa83d('0x5d')](_0x2aa1c8)){throw new db[(_0xa83d('0x64'))]['ValidationError'](_[_0xa83d('0x65')]('logo')+'\x20not\x20found');}return _0x2ac121['download'](_0x2aa1c8);}})[_0xa83d('0x1f')](handleError(_0x2ac121,null));};var utilLicense=require('../../config/license/util');exports[_0xa83d('0x66')]=function(_0x27996d,_0x2a2776,_0x273e0f){var _0x55e68a=_0xa83d('0x55');var _0x5483c7={'custom':![]};return utilLicense['getLicense']()[_0xa83d('0x16')](function(_0x106c97){if(_0x106c97){_0x5483c7=_0x106c97;}return db['Setting']['find']({'where':{'id':_0x27996d[_0xa83d('0x4a')]['id']},'attributes':['logo',_0xa83d('0x53'),'preferred',_0xa83d('0x59'),_0xa83d('0x5a'),_0xa83d('0x5b'),_0xa83d('0x5c'),_0xa83d('0x67')],'raw':!![]});})[_0xa83d('0x16')](handleEntityNotFound(_0x2a2776,null))[_0xa83d('0x16')](function(_0x361b21){if(_0x361b21){var _0x3f5f48=_0x361b21[_0xa83d('0x53')]&&fs[_0xa83d('0x5d')](path['join'](config['root'],_0x55e68a,_[_0xa83d('0x60')](_0x361b21[_0xa83d('0x53')])))?path['join'](config[_0xa83d('0x5f')],_0x55e68a,_[_0xa83d('0x60')](_0x361b21[_0xa83d('0x53')])):path[_0xa83d('0x5e')](config[_0xa83d('0x5f')],_0x55e68a,_[_0xa83d('0x60')](_0xa83d('0x68')));var _0x4e762e=_0xa83d('0x62')+_[_0xa83d('0x65')](_0xa83d('0x53'));if(_0x361b21[_0x4e762e]||!_0x5483c7[_0xa83d('0x63')]){_0x3f5f48=path[_0xa83d('0x5e')](config['root'],_0x55e68a,_[_0xa83d('0x60')](_0xa83d('0x68')));}if(!fs[_0xa83d('0x5d')](_0x3f5f48)){throw new db[(_0xa83d('0x64'))][(_0xa83d('0x69'))](_['upperFirst']('loginLogo')+_0xa83d('0x6a'));}return _0x2a2776['download'](_0x3f5f48);}})[_0xa83d('0x1f')](handleError(_0x2a2776,null));};exports[_0xa83d('0x6b')]=function(_0xd1c40e,_0x9321cf){return db['Setting'][_0xa83d('0x4c')]({'where':{'id':_0xd1c40e[_0xa83d('0x4a')]['id']},'attributes':[_0xa83d('0x6c')]})[_0xa83d('0x16')](respondWithResult(_0x9321cf,null))['catch'](handleError(_0x9321cf,null));};exports[_0xa83d('0x6d')]=function(_0x209b13,_0xf428a0,_0xf4cb8){if(_0x209b13[_0xa83d('0x50')]&&_0x209b13[_0xa83d('0x50')]['filename']){_0x209b13[_0xa83d('0x4e')]['preferred']=_0x209b13['file'][_0xa83d('0x51')];}return db[_0xa83d('0x30')]['find']({'where':{'id':_0x209b13['params']['id']}})['then'](handleEntityNotFound(_0xf428a0,null))[_0xa83d('0x16')](saveUpdates(_0x209b13['body'],null))['then'](respondWithResult(_0xf428a0,null))[_0xa83d('0x1f')](handleError(_0xf428a0,null));};var utilLicense=require('../../config/license/util');exports[_0xa83d('0x6e')]=function(_0x4c3565,_0x14654c,_0x3f8e97){var _0x459975=_0xa83d('0x55');var _0x9e4f78={'custom':![]};return utilLicense['getLicense']()[_0xa83d('0x16')](function(_0x22330d){if(_0x22330d){_0x9e4f78=_0x22330d;}return db[_0xa83d('0x30')][_0xa83d('0x4c')]({'where':{'id':_0x4c3565[_0xa83d('0x4a')]['id']},'attributes':[_0xa83d('0x57'),'loginLogo',_0xa83d('0x58'),_0xa83d('0x59'),_0xa83d('0x5a'),_0xa83d('0x5b'),'defaultPreferred',_0xa83d('0x67')],'raw':!![]});})[_0xa83d('0x16')](handleEntityNotFound(_0x14654c,null))[_0xa83d('0x16')](function(_0x17b5f9){if(_0x17b5f9){var _0xf4987a=_0x17b5f9['preferred']&&fs[_0xa83d('0x5d')](path['join'](config['root'],_0x459975,_[_0xa83d('0x60')](_0x17b5f9[_0xa83d('0x58')])))?path[_0xa83d('0x5e')](config[_0xa83d('0x5f')],_0x459975,_[_0xa83d('0x60')](_0x17b5f9[_0xa83d('0x58')])):path[_0xa83d('0x5e')](config[_0xa83d('0x5f')],_0x459975,_[_0xa83d('0x60')](_0xa83d('0x6f')));var _0x2e270a='default'+_[_0xa83d('0x65')](_0xa83d('0x58'));if(_0x17b5f9[_0x2e270a]||!_0x9e4f78[_0xa83d('0x63')]||!_0x9e4f78['preferred']){_0xf4987a=path['join'](config[_0xa83d('0x5f')],_0x459975,_[_0xa83d('0x60')](_0xa83d('0x6f')));}if(!fs[_0xa83d('0x5d')](_0xf4987a)){throw new db[(_0xa83d('0x64'))][(_0xa83d('0x69'))](_[_0xa83d('0x65')](_0xa83d('0x58'))+_0xa83d('0x6a'));}return _0x14654c[_0xa83d('0x70')](_0xf4987a);}})[_0xa83d('0x1f')](handleError(_0x14654c,null));};exports['addFavicon']=function(_0x5164aa,_0x9fa833,_0x7cad68){if(_0x5164aa[_0xa83d('0x50')]&&_0x5164aa[_0xa83d('0x50')]['filename']){_0x5164aa['body'][_0xa83d('0x59')]=_0x5164aa['file']['filename'];}return db[_0xa83d('0x30')]['find']({'where':{'id':_0x5164aa['params']['id']}})['then'](handleEntityNotFound(_0x9fa833,null))[_0xa83d('0x16')](saveUpdates(_0x5164aa['body'],null))[_0xa83d('0x16')](respondWithResult(_0x9fa833,null))[_0xa83d('0x1f')](handleError(_0x9fa833,null));};var utilLicense=require('../../config/license/util');exports[_0xa83d('0x71')]=function(_0x3bce3e,_0x1b19c2,_0x421a21){var _0x41adf0=_0xa83d('0x55');var _0x4164ec={'custom':![]};return utilLicense[_0xa83d('0x56')]()[_0xa83d('0x16')](function(_0x1f2839){if(_0x1f2839){_0x4164ec=_0x1f2839;}return db[_0xa83d('0x30')][_0xa83d('0x4c')]({'where':{'id':_0x3bce3e[_0xa83d('0x4a')]['id']},'attributes':[_0xa83d('0x57'),_0xa83d('0x53'),'preferred',_0xa83d('0x59'),'defaultLogo',_0xa83d('0x5b'),_0xa83d('0x5c'),_0xa83d('0x67')],'raw':!![]});})['then'](handleEntityNotFound(_0x1b19c2,null))[_0xa83d('0x16')](function(_0xb87e27){if(_0xb87e27){var _0x69ffac=_0xb87e27[_0xa83d('0x59')]&&fs[_0xa83d('0x5d')](path[_0xa83d('0x5e')](config[_0xa83d('0x5f')],_0x41adf0,_[_0xa83d('0x60')](_0xb87e27[_0xa83d('0x59')])))?path['join'](config[_0xa83d('0x5f')],_0x41adf0,_[_0xa83d('0x60')](_0xb87e27[_0xa83d('0x59')])):path[_0xa83d('0x5e')](config[_0xa83d('0x5f')],_0x41adf0,_[_0xa83d('0x60')](_0xa83d('0x72')));var _0x3127c1=_0xa83d('0x62')+_[_0xa83d('0x65')](_0xa83d('0x59'));if(_0xb87e27[_0x3127c1]||!_0x4164ec[_0xa83d('0x63')]){_0x69ffac=path['join'](config[_0xa83d('0x5f')],_0x41adf0,_['toLower']('default_favicon.ico'));}if(!fs[_0xa83d('0x5d')](_0x69ffac)){throw new db[(_0xa83d('0x64'))][(_0xa83d('0x69'))](_[_0xa83d('0x65')](_0xa83d('0x59'))+_0xa83d('0x6a'));}return _0x1b19c2[_0xa83d('0x70')](_0x69ffac);}})[_0xa83d('0x1f')](handleError(_0x1b19c2,null));};exports[_0xa83d('0x73')]=function(_0x80e8a4,_0x23c765){var _0x44767f={'offset':moment()[_0xa83d('0x74')]()};_0x44767f['now']=moment()[_0xa83d('0x74')](_0x44767f[_0xa83d('0x26')])[_0xa83d('0x75')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x23c765[_0xa83d('0x21')](0xc8)['send'](_0x44767f);}; \ No newline at end of file +var _0x1d86=['utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','fast-json-patch','moment','bluebird','util','path','sox','ejs','squel','crypto','desk.js','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','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','Setting','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','includeAll','include','findAll','rows','show','params','find','body','catch','addLogo','file','logo','filename','addLogoLogin','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','defaultLogo','defaultLoginLogo','default_loginLogo.svg','upperFirst','custom','securePassword','addPreferred','getPreferred','default_preferred.png','getFavicon','default_favicon.ico'];(function(_0x11bfcb,_0x1f574b){var _0x4a49c5=function(_0x2c1825){while(--_0x2c1825){_0x11bfcb['push'](_0x11bfcb['shift']());}};_0x4a49c5(++_0x1f574b);}(_0x1d86,0x7e));var _0x61d8=function(_0x978636,_0x515d48){_0x978636=_0x978636-0x0;var _0x2c1f3c=_0x1d86[_0x978636];return _0x2c1f3c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x61d8('0x0'));var rp=require('request-promise');var moment=require(_0x61d8('0x1'));var BPromise=require(_0x61d8('0x2'));var Mustache=require('mustache');var util=require(_0x61d8('0x3'));var path=require(_0x61d8('0x4'));var sox=require(_0x61d8('0x5'));var csv=require('to-csv');var ejs=require(_0x61d8('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x61d8('0x7'));var crypto=require(_0x61d8('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x61d8('0x9'));var toCsv=require(_0x61d8('0xa'));var querystring=require(_0x61d8('0xb'));var Papa=require(_0x61d8('0xc'));var Redis=require(_0x61d8('0xd'));var authService=require(_0x61d8('0xe'));var qs=require(_0x61d8('0xf'));var as=require(_0x61d8('0x10'));var hardwareService=require(_0x61d8('0x11'));var logger=require('../../config/logger')(_0x61d8('0x12'));var utils=require(_0x61d8('0x13'));var config=require(_0x61d8('0x14'));var licenseUtil=require(_0x61d8('0x15'));var db=require(_0x61d8('0x16'))['db'];var jayson=require(_0x61d8('0x17'));var client=jayson[_0x61d8('0x18')][_0x61d8('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x1dc9bf,_0x5d27d8,_0x1949b1,_0x129ef5){return new BPromise(function(_0x39054e,_0x3579a8){var _0x34bb0c=_0x129ef5||client;return _0x34bb0c[_0x61d8('0x1a')](_0x1dc9bf,_0x1949b1)[_0x61d8('0x1b')](function(_0x544dfd){logger[_0x61d8('0x1c')](_0x61d8('0x1d'),_0x5d27d8,_0x61d8('0x1e'));logger['debug'](_0x61d8('0x1f'),_0x5d27d8,_0x61d8('0x1e'),JSON[_0x61d8('0x20')](_0x544dfd));if(_0x544dfd[_0x61d8('0x21')]){if(_0x544dfd[_0x61d8('0x21')][_0x61d8('0x22')]===0x1f4){logger[_0x61d8('0x21')]('Setting,\x20%s,\x20%s',_0x5d27d8,_0x544dfd[_0x61d8('0x21')][_0x61d8('0x23')]);return _0x3579a8(_0x544dfd[_0x61d8('0x21')][_0x61d8('0x23')]);}logger[_0x61d8('0x21')](_0x61d8('0x1d'),_0x5d27d8,_0x544dfd['error'][_0x61d8('0x23')]);return _0x39054e(_0x544dfd[_0x61d8('0x21')][_0x61d8('0x23')]);}else{logger[_0x61d8('0x1c')](_0x61d8('0x1d'),_0x5d27d8,'request\x20sent');_0x39054e(_0x544dfd[_0x61d8('0x24')][_0x61d8('0x23')]);}})['catch'](function(_0xc3c0e){logger[_0x61d8('0x21')]('Setting,\x20%s,\x20%s',_0x5d27d8,_0xc3c0e);_0x3579a8(_0xc3c0e);});});}function respondWithStatusCode(_0x30e6af,_0x56d97f){_0x56d97f=_0x56d97f||0xcc;return function(_0x1ddc52){if(_0x1ddc52){return _0x30e6af[_0x61d8('0x25')](_0x56d97f);}return _0x30e6af[_0x61d8('0x26')](_0x56d97f)['end']();};}function respondWithResult(_0x243298,_0x144405){_0x144405=_0x144405||0xc8;return function(_0x142a87){if(_0x142a87){return _0x243298[_0x61d8('0x26')](_0x144405)[_0x61d8('0x27')](_0x142a87);}};}function respondWithFilteredResult(_0xd7061,_0x234e75){return function(_0x2a525c){if(_0x2a525c){var _0x458c3d=typeof _0x234e75[_0x61d8('0x28')]===_0x61d8('0x29')&&typeof _0x234e75['limit']===_0x61d8('0x29');var _0x1df598=_0x2a525c[_0x61d8('0x2a')];var _0x46953b=_0x458c3d?0x0:_0x234e75[_0x61d8('0x28')];var _0x457d65=_0x458c3d?_0x2a525c[_0x61d8('0x2a')]:_0x234e75[_0x61d8('0x28')]+_0x234e75[_0x61d8('0x2b')];var _0x44e631;if(_0x457d65>=_0x1df598){_0x457d65=_0x1df598;_0x44e631=0xc8;}else{_0x44e631=0xce;}_0xd7061[_0x61d8('0x26')](_0x44e631);return _0xd7061[_0x61d8('0x2c')](_0x61d8('0x2d'),_0x46953b+'-'+_0x457d65+'/'+_0x1df598)[_0x61d8('0x27')](_0x2a525c);}return null;};}function patchUpdates(_0x4c2e12){return function(_0x467a33){try{jsonpatch['apply'](_0x467a33,_0x4c2e12,!![]);}catch(_0x5ee162){return BPromise[_0x61d8('0x2e')](_0x5ee162);}return _0x467a33[_0x61d8('0x2f')]();};}function saveUpdates(_0x1dd542,_0x49757a){return function(_0x36c3f7){if(_0x36c3f7){return _0x36c3f7[_0x61d8('0x30')](_0x1dd542)['then'](function(_0x471baf){return _0x471baf;});}return null;};}function removeEntity(_0x13fa6f,_0x4d3452){return function(_0x45c8a8){if(_0x45c8a8){return _0x45c8a8[_0x61d8('0x31')]()['then'](function(){_0x13fa6f[_0x61d8('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30f532,_0xccff89){return function(_0x427fa6){if(!_0x427fa6){_0x30f532[_0x61d8('0x25')](0x194);}return _0x427fa6;};}function handleError(_0x55b1e7,_0x384097){_0x384097=_0x384097||0x1f4;return function(_0x5a5bcb){logger[_0x61d8('0x21')](_0x5a5bcb[_0x61d8('0x32')]);if(_0x5a5bcb[_0x61d8('0x33')]){delete _0x5a5bcb[_0x61d8('0x33')];}_0x55b1e7['status'](_0x384097)[_0x61d8('0x34')](_0x5a5bcb);};}exports[_0x61d8('0x35')]=function(_0x45d9eb,_0x109c6c){var _0x2e6584={},_0x5481fd={},_0x3b5d8a={'count':0x0,'rows':[]};var _0x207d45=_[_0x61d8('0x36')](db[_0x61d8('0x37')][_0x61d8('0x38')],function(_0x378fcf){return{'name':_0x378fcf[_0x61d8('0x39')],'type':_0x378fcf['type'][_0x61d8('0x3a')]};});_0x5481fd[_0x61d8('0x3b')]=_[_0x61d8('0x36')](_0x207d45,_0x61d8('0x33'));_0x5481fd[_0x61d8('0x3c')]=_[_0x61d8('0x3d')](_0x45d9eb['query']);_0x5481fd[_0x61d8('0x3e')]=_[_0x61d8('0x3f')](_0x5481fd[_0x61d8('0x3b')],_0x5481fd[_0x61d8('0x3c')]);_0x2e6584[_0x61d8('0x40')]=_['intersection'](_0x5481fd[_0x61d8('0x3b')],qs[_0x61d8('0x41')](_0x45d9eb['query'][_0x61d8('0x41')]));_0x2e6584['attributes']=_0x2e6584[_0x61d8('0x40')][_0x61d8('0x42')]?_0x2e6584[_0x61d8('0x40')]:_0x5481fd[_0x61d8('0x3b')];if(!_0x45d9eb['query'][_0x61d8('0x43')](_0x61d8('0x44'))){_0x2e6584[_0x61d8('0x2b')]=qs[_0x61d8('0x2b')](_0x45d9eb[_0x61d8('0x3c')][_0x61d8('0x2b')]);_0x2e6584[_0x61d8('0x28')]=qs[_0x61d8('0x28')](_0x45d9eb[_0x61d8('0x3c')][_0x61d8('0x28')]);}_0x2e6584[_0x61d8('0x45')]=qs[_0x61d8('0x46')](_0x45d9eb[_0x61d8('0x3c')][_0x61d8('0x46')]);_0x2e6584[_0x61d8('0x47')]=qs[_0x61d8('0x3e')](_['pick'](_0x45d9eb[_0x61d8('0x3c')],_0x5481fd[_0x61d8('0x3e')]),_0x207d45);if(_0x45d9eb['query'][_0x61d8('0x48')]){_0x2e6584[_0x61d8('0x47')]=_[_0x61d8('0x49')](_0x2e6584[_0x61d8('0x47')],{'$or':_['map'](_0x207d45,function(_0xa33be0){if(_0xa33be0[_0x61d8('0x4a')]!=='VIRTUAL'){var _0x2ae657={};_0x2ae657[_0xa33be0['name']]={'$like':'%'+_0x45d9eb['query'][_0x61d8('0x48')]+'%'};return _0x2ae657;}})});}_0x2e6584=_[_0x61d8('0x49')]({},_0x2e6584,_0x45d9eb['options']);var _0x1c3ef1={'where':_0x2e6584[_0x61d8('0x47')]};return db[_0x61d8('0x37')][_0x61d8('0x2a')](_0x1c3ef1)[_0x61d8('0x1b')](function(_0x2e69a9){_0x3b5d8a[_0x61d8('0x2a')]=_0x2e69a9;if(_0x45d9eb['query'][_0x61d8('0x4b')]){_0x2e6584[_0x61d8('0x4c')]=[{'all':!![]}];}return db['Setting'][_0x61d8('0x4d')](_0x2e6584);})['then'](function(_0x44fe8f){_0x3b5d8a[_0x61d8('0x4e')]=_0x44fe8f;return _0x3b5d8a;})[_0x61d8('0x1b')](respondWithFilteredResult(_0x109c6c,_0x2e6584))['catch'](handleError(_0x109c6c,null));};exports[_0x61d8('0x4f')]=function(_0x21bc61,_0x6bd176){var _0x3f1999={'raw':![],'where':{'id':_0x21bc61[_0x61d8('0x50')]['id']}},_0x1a2d5d={};_0x1a2d5d['model']=_[_0x61d8('0x3d')](db[_0x61d8('0x37')]['rawAttributes']);_0x1a2d5d[_0x61d8('0x3c')]=_[_0x61d8('0x3d')](_0x21bc61['query']);_0x1a2d5d[_0x61d8('0x3e')]=_[_0x61d8('0x3f')](_0x1a2d5d[_0x61d8('0x3b')],_0x1a2d5d['query']);_0x3f1999[_0x61d8('0x40')]=_[_0x61d8('0x3f')](_0x1a2d5d[_0x61d8('0x3b')],qs[_0x61d8('0x41')](_0x21bc61[_0x61d8('0x3c')]['fields']));_0x3f1999[_0x61d8('0x40')]=_0x3f1999['attributes'][_0x61d8('0x42')]?_0x3f1999[_0x61d8('0x40')]:_0x1a2d5d[_0x61d8('0x3b')];if(_0x21bc61['query']['includeAll']){_0x3f1999[_0x61d8('0x4c')]=[{'all':!![]}];}_0x3f1999=_[_0x61d8('0x49')]({},_0x3f1999,_0x21bc61['options']);return db[_0x61d8('0x37')][_0x61d8('0x51')](_0x3f1999)[_0x61d8('0x1b')](handleEntityNotFound(_0x6bd176,null))['then'](respondWithResult(_0x6bd176,null))['catch'](handleError(_0x6bd176,null));};exports[_0x61d8('0x30')]=function(_0xa7d609,_0x2b220d){if(_0xa7d609[_0x61d8('0x52')]['id']){delete _0xa7d609['body']['id'];}return db['Setting'][_0x61d8('0x51')]({'where':{'id':_0xa7d609['params']['id']}})[_0x61d8('0x1b')](handleEntityNotFound(_0x2b220d,null))['then'](saveUpdates(_0xa7d609['body'],null))[_0x61d8('0x1b')](respondWithResult(_0x2b220d,null))[_0x61d8('0x53')](handleError(_0x2b220d,null));};exports[_0x61d8('0x54')]=function(_0x1ff84c,_0x3a52cc,_0x143580){if(_0x1ff84c[_0x61d8('0x55')]&&_0x1ff84c[_0x61d8('0x55')]['filename']){_0x1ff84c[_0x61d8('0x52')][_0x61d8('0x56')]=_0x1ff84c['file'][_0x61d8('0x57')];}return db[_0x61d8('0x37')][_0x61d8('0x51')]({'where':{'id':_0x1ff84c[_0x61d8('0x50')]['id']}})[_0x61d8('0x1b')](handleEntityNotFound(_0x3a52cc,null))[_0x61d8('0x1b')](saveUpdates(_0x1ff84c[_0x61d8('0x52')],null))[_0x61d8('0x1b')](respondWithResult(_0x3a52cc,null))['catch'](handleError(_0x3a52cc,null));};exports[_0x61d8('0x58')]=function(_0x419a65,_0x2f63d9,_0x3bbce7){if(_0x419a65[_0x61d8('0x55')]&&_0x419a65[_0x61d8('0x55')]['filename']){_0x419a65['body'][_0x61d8('0x59')]=_0x419a65['file']['filename'];}return db[_0x61d8('0x37')][_0x61d8('0x51')]({'where':{'id':_0x419a65[_0x61d8('0x50')]['id']}})[_0x61d8('0x1b')](handleEntityNotFound(_0x2f63d9,null))['then'](saveUpdates(_0x419a65[_0x61d8('0x52')],null))[_0x61d8('0x1b')](respondWithResult(_0x2f63d9,null))['catch'](handleError(_0x2f63d9,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x80a12d,_0x3c2948,_0x11f848){var _0x2fd09d=_0x61d8('0x5a');var _0x5bc3bf={'custom':![]};return utilLicense[_0x61d8('0x5b')]()['then'](function(_0x5575f6){if(_0x5575f6){_0x5bc3bf=_0x5575f6;}return db['Setting'][_0x61d8('0x51')]({'where':{'id':_0x80a12d[_0x61d8('0x50')]['id']},'attributes':[_0x61d8('0x56'),'loginLogo',_0x61d8('0x5c'),_0x61d8('0x5d'),'defaultLogo','defaultLoginLogo',_0x61d8('0x5e'),_0x61d8('0x5f')],'raw':!![]});})[_0x61d8('0x1b')](handleEntityNotFound(_0x3c2948,null))[_0x61d8('0x1b')](function(_0x411023){if(_0x411023){var _0x46cb16=_0x411023[_0x61d8('0x56')]&&fs[_0x61d8('0x60')](path[_0x61d8('0x61')](config[_0x61d8('0x62')],_0x2fd09d,_[_0x61d8('0x63')](_0x411023[_0x61d8('0x56')])))?path[_0x61d8('0x61')](config[_0x61d8('0x62')],_0x2fd09d,_[_0x61d8('0x63')](_0x411023[_0x61d8('0x56')])):path[_0x61d8('0x61')](config[_0x61d8('0x62')],_0x2fd09d,_[_0x61d8('0x63')](_0x61d8('0x64')));var _0x18a824=_0x61d8('0x65')+_['upperFirst']('logo');if(_0x411023[_0x18a824]||!_0x5bc3bf['custom']){_0x46cb16=path[_0x61d8('0x61')](config[_0x61d8('0x62')],_0x2fd09d,_[_0x61d8('0x63')]('default_logo.svg'));}if(!fs[_0x61d8('0x60')](_0x46cb16)){throw new db[(_0x61d8('0x66'))][(_0x61d8('0x67'))](_['upperFirst'](_0x61d8('0x56'))+_0x61d8('0x68'));}return _0x3c2948[_0x61d8('0x69')](_0x46cb16);}})[_0x61d8('0x53')](handleError(_0x3c2948,null));};var utilLicense=require(_0x61d8('0x15'));exports[_0x61d8('0x6a')]=function(_0xd75550,_0x606732,_0x1b7ff8){var _0x1bf232='server/files/images/logos';var _0xef253b={'custom':![]};return utilLicense[_0x61d8('0x5b')]()[_0x61d8('0x1b')](function(_0x47c7e8){if(_0x47c7e8){_0xef253b=_0x47c7e8;}return db[_0x61d8('0x37')][_0x61d8('0x51')]({'where':{'id':_0xd75550[_0x61d8('0x50')]['id']},'attributes':['logo',_0x61d8('0x59'),_0x61d8('0x5c'),'favicon',_0x61d8('0x6b'),_0x61d8('0x6c'),'defaultPreferred',_0x61d8('0x5f')],'raw':!![]});})[_0x61d8('0x1b')](handleEntityNotFound(_0x606732,null))[_0x61d8('0x1b')](function(_0xf1525b){if(_0xf1525b){var _0x98256e=_0xf1525b[_0x61d8('0x59')]&&fs[_0x61d8('0x60')](path[_0x61d8('0x61')](config[_0x61d8('0x62')],_0x1bf232,_['toLower'](_0xf1525b['loginLogo'])))?path[_0x61d8('0x61')](config[_0x61d8('0x62')],_0x1bf232,_[_0x61d8('0x63')](_0xf1525b[_0x61d8('0x59')])):path['join'](config[_0x61d8('0x62')],_0x1bf232,_[_0x61d8('0x63')](_0x61d8('0x6d')));var _0x1dcfd9='default'+_[_0x61d8('0x6e')](_0x61d8('0x59'));if(_0xf1525b[_0x1dcfd9]||!_0xef253b[_0x61d8('0x6f')]){_0x98256e=path['join'](config[_0x61d8('0x62')],_0x1bf232,_[_0x61d8('0x63')](_0x61d8('0x6d')));}if(!fs['existsSync'](_0x98256e)){throw new db['Sequelize'][(_0x61d8('0x67'))](_[_0x61d8('0x6e')]('loginLogo')+_0x61d8('0x68'));}return _0x606732[_0x61d8('0x69')](_0x98256e);}})[_0x61d8('0x53')](handleError(_0x606732,null));};exports['gdpr']=function(_0x2f394f,_0x4950fb){return db[_0x61d8('0x37')][_0x61d8('0x51')]({'where':{'id':_0x2f394f['params']['id']},'attributes':[_0x61d8('0x70')]})[_0x61d8('0x1b')](respondWithResult(_0x4950fb,null))['catch'](handleError(_0x4950fb,null));};exports[_0x61d8('0x71')]=function(_0x37b9df,_0x33eea,_0x3c4151){if(_0x37b9df[_0x61d8('0x55')]&&_0x37b9df[_0x61d8('0x55')][_0x61d8('0x57')]){_0x37b9df[_0x61d8('0x52')][_0x61d8('0x5c')]=_0x37b9df[_0x61d8('0x55')][_0x61d8('0x57')];}return db['Setting'][_0x61d8('0x51')]({'where':{'id':_0x37b9df['params']['id']}})[_0x61d8('0x1b')](handleEntityNotFound(_0x33eea,null))[_0x61d8('0x1b')](saveUpdates(_0x37b9df[_0x61d8('0x52')],null))[_0x61d8('0x1b')](respondWithResult(_0x33eea,null))['catch'](handleError(_0x33eea,null));};var utilLicense=require(_0x61d8('0x15'));exports[_0x61d8('0x72')]=function(_0x1100b5,_0x362200,_0x2a555b){var _0x2ec020='server/files/images/logos';var _0x5afee9={'custom':![]};return utilLicense[_0x61d8('0x5b')]()[_0x61d8('0x1b')](function(_0x53dda1){if(_0x53dda1){_0x5afee9=_0x53dda1;}return db['Setting']['find']({'where':{'id':_0x1100b5[_0x61d8('0x50')]['id']},'attributes':[_0x61d8('0x56'),_0x61d8('0x59'),_0x61d8('0x5c'),_0x61d8('0x5d'),'defaultLogo',_0x61d8('0x6c'),'defaultPreferred',_0x61d8('0x5f')],'raw':!![]});})[_0x61d8('0x1b')](handleEntityNotFound(_0x362200,null))['then'](function(_0x16359b){if(_0x16359b){var _0x1c18e2=_0x16359b[_0x61d8('0x5c')]&&fs[_0x61d8('0x60')](path[_0x61d8('0x61')](config[_0x61d8('0x62')],_0x2ec020,_[_0x61d8('0x63')](_0x16359b['preferred'])))?path[_0x61d8('0x61')](config[_0x61d8('0x62')],_0x2ec020,_[_0x61d8('0x63')](_0x16359b['preferred'])):path[_0x61d8('0x61')](config['root'],_0x2ec020,_[_0x61d8('0x63')](_0x61d8('0x73')));var _0x1de333=_0x61d8('0x65')+_[_0x61d8('0x6e')]('preferred');if(_0x16359b[_0x1de333]||!_0x5afee9[_0x61d8('0x6f')]||!_0x5afee9[_0x61d8('0x5c')]){_0x1c18e2=path[_0x61d8('0x61')](config[_0x61d8('0x62')],_0x2ec020,_[_0x61d8('0x63')](_0x61d8('0x73')));}if(!fs[_0x61d8('0x60')](_0x1c18e2)){throw new db[(_0x61d8('0x66'))][(_0x61d8('0x67'))](_[_0x61d8('0x6e')](_0x61d8('0x5c'))+_0x61d8('0x68'));}return _0x362200[_0x61d8('0x69')](_0x1c18e2);}})[_0x61d8('0x53')](handleError(_0x362200,null));};exports['addFavicon']=function(_0x59317b,_0x184344,_0x3eec03){if(_0x59317b[_0x61d8('0x55')]&&_0x59317b[_0x61d8('0x55')][_0x61d8('0x57')]){_0x59317b[_0x61d8('0x52')][_0x61d8('0x5d')]=_0x59317b[_0x61d8('0x55')]['filename'];}return db[_0x61d8('0x37')]['find']({'where':{'id':_0x59317b[_0x61d8('0x50')]['id']}})['then'](handleEntityNotFound(_0x184344,null))[_0x61d8('0x1b')](saveUpdates(_0x59317b[_0x61d8('0x52')],null))[_0x61d8('0x1b')](respondWithResult(_0x184344,null))['catch'](handleError(_0x184344,null));};var utilLicense=require(_0x61d8('0x15'));exports[_0x61d8('0x74')]=function(_0x4632e2,_0x559ca2,_0x1a9059){var _0x1f4cc5=_0x61d8('0x5a');var _0x508f2c={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x240147){if(_0x240147){_0x508f2c=_0x240147;}return db[_0x61d8('0x37')]['find']({'where':{'id':_0x4632e2[_0x61d8('0x50')]['id']},'attributes':[_0x61d8('0x56'),_0x61d8('0x59'),_0x61d8('0x5c'),'favicon',_0x61d8('0x6b'),_0x61d8('0x6c'),'defaultPreferred',_0x61d8('0x5f')],'raw':!![]});})[_0x61d8('0x1b')](handleEntityNotFound(_0x559ca2,null))[_0x61d8('0x1b')](function(_0x2fcde8){if(_0x2fcde8){var _0x1dca5b=_0x2fcde8[_0x61d8('0x5d')]&&fs['existsSync'](path[_0x61d8('0x61')](config[_0x61d8('0x62')],_0x1f4cc5,_[_0x61d8('0x63')](_0x2fcde8[_0x61d8('0x5d')])))?path['join'](config['root'],_0x1f4cc5,_[_0x61d8('0x63')](_0x2fcde8[_0x61d8('0x5d')])):path[_0x61d8('0x61')](config[_0x61d8('0x62')],_0x1f4cc5,_[_0x61d8('0x63')](_0x61d8('0x75')));var _0xa6ed44=_0x61d8('0x65')+_[_0x61d8('0x6e')](_0x61d8('0x5d'));if(_0x2fcde8[_0xa6ed44]||!_0x508f2c[_0x61d8('0x6f')]){_0x1dca5b=path[_0x61d8('0x61')](config['root'],_0x1f4cc5,_[_0x61d8('0x63')]('default_favicon.ico'));}if(!fs['existsSync'](_0x1dca5b)){throw new db['Sequelize']['ValidationError'](_[_0x61d8('0x6e')](_0x61d8('0x5d'))+_0x61d8('0x68'));}return _0x559ca2[_0x61d8('0x69')](_0x1dca5b);}})[_0x61d8('0x53')](handleError(_0x559ca2,null));};exports['getDate']=function(_0x13e590,_0x3fefda){var _0x50beb6={'offset':moment()[_0x61d8('0x76')]()};_0x50beb6[_0x61d8('0x77')]=moment()[_0x61d8('0x76')](_0x50beb6['offset'])[_0x61d8('0x78')](_0x61d8('0x79'));return _0x3fefda['status'](0xc8)[_0x61d8('0x34')](_0x50beb6);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 1b45ab7..65facac 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 _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x234f64,_0x426b27){var _0x3252e2=function(_0x1f0ac3){while(--_0x1f0ac3){_0x234f64['push'](_0x234f64['shift']());}};_0x3252e2(++_0x426b27);}(_0xedd9,0xfc));var _0x9edd=function(_0x2f1511,_0x46c5c4){_0x2f1511=_0x2f1511-0x0;var _0x1672f4=_0xedd9[_0x2f1511];return _0x1672f4;};'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':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index cb6afe1..65295d9 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 _0xbca2=['stringify','error','code','message','result','catch','find','options','raw','where','attributes','include','map','model','ShowSetting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x21b224,_0x3389c9){var _0x137eff=function(_0x591c2b){while(--_0x591c2b){_0x21b224['push'](_0x21b224['shift']());}};_0x137eff(++_0x3389c9);}(_0xbca2,0x1a7));var _0x2bca=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0xbca2[_0x1e4a8e];return _0x5408f9;};'use strict';var _=require(_0x2bca('0x0'));var util=require(_0x2bca('0x1'));var moment=require(_0x2bca('0x2'));var BPromise=require(_0x2bca('0x3'));var rs=require(_0x2bca('0x4'));var fs=require('fs');var Redis=require(_0x2bca('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2bca('0x6'));var logger=require(_0x2bca('0x7'))(_0x2bca('0x8'));var config=require(_0x2bca('0x9'));var jayson=require(_0x2bca('0xa'));var client=jayson[_0x2bca('0xb')][_0x2bca('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x531073,_0x189838,_0x3c7003){return new BPromise(function(_0x1bbdd8,_0x819fad){return client[_0x2bca('0xd')](_0x531073,_0x3c7003)[_0x2bca('0xe')](function(_0x1f95da){logger['info'](_0x2bca('0xf'),_0x189838,_0x2bca('0x10'));logger[_0x2bca('0x11')](_0x2bca('0x12'),_0x189838,_0x2bca('0x10'),JSON[_0x2bca('0x13')](_0x1f95da));if(_0x1f95da[_0x2bca('0x14')]){if(_0x1f95da[_0x2bca('0x14')][_0x2bca('0x15')]===0x1f4){logger[_0x2bca('0x14')](_0x2bca('0xf'),_0x189838,_0x1f95da['error'][_0x2bca('0x16')]);return _0x819fad(_0x1f95da['error'][_0x2bca('0x16')]);}logger[_0x2bca('0x14')](_0x2bca('0xf'),_0x189838,_0x1f95da[_0x2bca('0x14')][_0x2bca('0x16')]);return _0x1bbdd8(_0x1f95da['error'][_0x2bca('0x16')]);}else{logger['info'](_0x2bca('0xf'),_0x189838,_0x2bca('0x10'));_0x1bbdd8(_0x1f95da[_0x2bca('0x17')][_0x2bca('0x16')]);}})[_0x2bca('0x18')](function(_0x2bcbe9){logger[_0x2bca('0x14')]('Setting,\x20%s,\x20%s',_0x189838,_0x2bcbe9);_0x819fad(_0x2bcbe9);});});}exports['ShowSetting']=function(_0x3ab9bc){var _0x53b02e=this;return new Promise(function(_0x39c45b,_0x11754b){return db['Setting'][_0x2bca('0x19')]({'raw':_0x3ab9bc['options']?_0x3ab9bc[_0x2bca('0x1a')][_0x2bca('0x1b')]===undefined?!![]:![]:!![],'where':_0x3ab9bc[_0x2bca('0x1a')]?_0x3ab9bc['options'][_0x2bca('0x1c')]||null:null,'attributes':_0x3ab9bc[_0x2bca('0x1a')]?_0x3ab9bc[_0x2bca('0x1a')][_0x2bca('0x1d')]||null:null,'include':_0x3ab9bc['options']?_0x3ab9bc['options'][_0x2bca('0x1e')]?_[_0x2bca('0x1f')](_0x3ab9bc[_0x2bca('0x1a')][_0x2bca('0x1e')],function(_0x279041){return{'model':db[_0x279041[_0x2bca('0x20')]],'as':_0x279041['as'],'attributes':_0x279041[_0x2bca('0x1d')],'include':_0x279041[_0x2bca('0x1e')]?_['map'](_0x279041[_0x2bca('0x1e')],function(_0x2fc49e){return{'model':db[_0x2fc49e[_0x2bca('0x20')]],'as':_0x2fc49e['as'],'attributes':_0x2fc49e[_0x2bca('0x1d')],'include':_0x2fc49e[_0x2bca('0x1e')]?_[_0x2bca('0x1f')](_0x2fc49e[_0x2bca('0x1e')],function(_0x365553){return{'model':db[_0x365553[_0x2bca('0x20')]],'as':_0x365553['as'],'attributes':_0x365553['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x48e1eb){logger['info'](_0x2bca('0x21'),_0x3ab9bc);logger[_0x2bca('0x11')](_0x2bca('0x21'),_0x3ab9bc,JSON['stringify'](_0x48e1eb));_0x39c45b(_0x48e1eb);})[_0x2bca('0x18')](function(_0x4b2f0d){logger[_0x2bca('0x14')]('ShowSetting',_0x4b2f0d[_0x2bca('0x16')],_0x3ab9bc);_0x11754b(_0x53b02e[_0x2bca('0x14')](0x1f4,_0x4b2f0d[_0x2bca('0x16')]));});});}; \ No newline at end of file +var _0x44dc=['info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Setting','find','options','raw','attributes','include','map','model','then','ShowSetting','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x44dc,0xe1));var _0xc44d=function(_0x5ca3d6,_0x5c7599){_0x5ca3d6=_0x5ca3d6-0x0;var _0x3a1032=_0x44dc[_0x5ca3d6];return _0x3a1032;};'use strict';var _=require(_0xc44d('0x0'));var util=require(_0xc44d('0x1'));var moment=require(_0xc44d('0x2'));var BPromise=require(_0xc44d('0x3'));var rs=require(_0xc44d('0x4'));var fs=require('fs');var Redis=require(_0xc44d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc44d('0x6'));var logger=require(_0xc44d('0x7'))('rpc');var config=require(_0xc44d('0x8'));var jayson=require(_0xc44d('0x9'));var client=jayson[_0xc44d('0xa')][_0xc44d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19319c,_0x10e3ac,_0x2f40ed){return new BPromise(function(_0x2c32db,_0x4b9ff4){return client[_0xc44d('0xc')](_0x19319c,_0x2f40ed)['then'](function(_0xd41a17){logger[_0xc44d('0xd')](_0xc44d('0xe'),_0x10e3ac,_0xc44d('0xf'));logger[_0xc44d('0x10')](_0xc44d('0x11'),_0x10e3ac,_0xc44d('0xf'),JSON[_0xc44d('0x12')](_0xd41a17));if(_0xd41a17[_0xc44d('0x13')]){if(_0xd41a17['error'][_0xc44d('0x14')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x10e3ac,_0xd41a17[_0xc44d('0x13')]['message']);return _0x4b9ff4(_0xd41a17[_0xc44d('0x13')][_0xc44d('0x15')]);}logger[_0xc44d('0x13')](_0xc44d('0xe'),_0x10e3ac,_0xd41a17[_0xc44d('0x13')][_0xc44d('0x15')]);return _0x2c32db(_0xd41a17[_0xc44d('0x13')][_0xc44d('0x15')]);}else{logger[_0xc44d('0xd')](_0xc44d('0xe'),_0x10e3ac,_0xc44d('0xf'));_0x2c32db(_0xd41a17[_0xc44d('0x16')][_0xc44d('0x15')]);}})['catch'](function(_0xf5849b){logger['error'](_0xc44d('0xe'),_0x10e3ac,_0xf5849b);_0x4b9ff4(_0xf5849b);});});}exports['ShowSetting']=function(_0x4a60df){var _0x238057=this;return new Promise(function(_0x2df407,_0x4fe658){return db[_0xc44d('0x17')][_0xc44d('0x18')]({'raw':_0x4a60df['options']?_0x4a60df[_0xc44d('0x19')][_0xc44d('0x1a')]===undefined?!![]:![]:!![],'where':_0x4a60df['options']?_0x4a60df['options']['where']||null:null,'attributes':_0x4a60df[_0xc44d('0x19')]?_0x4a60df[_0xc44d('0x19')][_0xc44d('0x1b')]||null:null,'include':_0x4a60df[_0xc44d('0x19')]?_0x4a60df[_0xc44d('0x19')][_0xc44d('0x1c')]?_[_0xc44d('0x1d')](_0x4a60df['options'][_0xc44d('0x1c')],function(_0xb54661){return{'model':db[_0xb54661[_0xc44d('0x1e')]],'as':_0xb54661['as'],'attributes':_0xb54661[_0xc44d('0x1b')],'include':_0xb54661['include']?_[_0xc44d('0x1d')](_0xb54661[_0xc44d('0x1c')],function(_0xafb170){return{'model':db[_0xafb170[_0xc44d('0x1e')]],'as':_0xafb170['as'],'attributes':_0xafb170[_0xc44d('0x1b')],'include':_0xafb170[_0xc44d('0x1c')]?_[_0xc44d('0x1d')](_0xafb170['include'],function(_0xa27e18){return{'model':db[_0xa27e18[_0xc44d('0x1e')]],'as':_0xa27e18['as'],'attributes':_0xa27e18[_0xc44d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc44d('0x1f')](function(_0x3a27e5){logger[_0xc44d('0xd')](_0xc44d('0x20'),_0x4a60df);logger[_0xc44d('0x10')](_0xc44d('0x20'),_0x4a60df,JSON[_0xc44d('0x12')](_0x3a27e5));_0x2df407(_0x3a27e5);})[_0xc44d('0x21')](function(_0x329f0a){logger[_0xc44d('0x13')](_0xc44d('0x20'),_0x329f0a[_0xc44d('0x15')],_0x4a60df);_0x4fe658(_0x238057[_0xc44d('0x13')](0x1f4,_0x329f0a['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index b156b83..02fb2fe 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 _0xabce=['/:id/users','getAgents','create','post','addAnswer','/:id/notify','notify','/:id/send','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x482677,_0x3aa83d){var _0x54eeff=function(_0x302a86){while(--_0x302a86){_0x482677['push'](_0x482677['shift']());}};_0x54eeff(++_0x3aa83d);}(_0xabce,0x103));var _0xeabc=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xabce[_0x2df507];return _0x1f7167;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/describe',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0x9')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0x9')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);router[_0xeabc('0x9')](_0xeabc('0x10'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x11')]);router[_0xeabc('0x9')](_0xeabc('0x12'),auth['isAuthenticated'](),controller[_0xeabc('0x13')]);router[_0xeabc('0x9')](_0xeabc('0x14'),controller['statusGet']);router['get'](_0xeabc('0x15'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x16')]);router['post']('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0x17')]);router['post']('/:id/dispositions',auth[_0xeabc('0x8')](),controller['addDisposition']);router[_0xeabc('0x18')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x19')]);router[_0xeabc('0x18')](_0xeabc('0x1a'),controller[_0xeabc('0x1b')]);router[_0xeabc('0x18')]('/:id/applications',auth[_0xeabc('0x8')](),controller['addApplications']);router[_0xeabc('0x18')](_0xeabc('0x1c'),auth['isAuthenticated'](),controller[_0xeabc('0x1d')]);router[_0xeabc('0x18')](_0xeabc('0x14'),controller[_0xeabc('0x1e')]);router[_0xeabc('0x18')]('/:id/users',auth[_0xeabc('0x8')](),controller[_0xeabc('0x1f')]);router[_0xeabc('0x20')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0x21')]);router[_0xeabc('0x22')](_0xeabc('0x23'),auth['isAuthenticated'](),controller[_0xeabc('0x24')]);router['delete'](_0xeabc('0xc'),auth['isAuthenticated'](),controller[_0xeabc('0x25')]);router[_0xeabc('0x22')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x26')]);router[_0xeabc('0x22')](_0xeabc('0x15'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xeabc('0x27')]=router; \ No newline at end of file +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(_0x222054,_0x45620f){var _0x5de492=function(_0x8ee7b4){while(--_0x8ee7b4){_0x222054['push'](_0x222054['shift']());}};_0x5de492(++_0x45620f);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',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 diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 0d01e71..bc685ba 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 _0x7ac8=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','name','generate','ENUM','twilio','connectel','clicksend','plivo','clickatell','csc','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7ac8,0xaf));var _0x87ac=function(_0x1a0557,_0x2a0db7){_0x1a0557=_0x1a0557-0x0;var _0x1ad015=_0x7ac8[_0x1a0557];return _0x1ad015;};'use strict';var Sequelize=require(_0x87ac('0x0'));var rs=require('randomstring');module[_0x87ac('0x1')]={'name':{'type':Sequelize[_0x87ac('0x2')],'unique':_0x87ac('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x87ac('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x87ac('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x87ac('0x2')],'defaultValue':function(){return rs[_0x87ac('0x4')]();}},'phone':{'type':Sequelize[_0x87ac('0x2')]},'type':{'type':Sequelize[_0x87ac('0x5')](_0x87ac('0x6'),'skebby',_0x87ac('0x7'),_0x87ac('0x8'),_0x87ac('0x9'),_0x87ac('0xa'),'bandwidth',_0x87ac('0xb'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0x87ac('0x2')]},'authId':{'type':Sequelize[_0x87ac('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x87ac('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x87ac('0x2')]},'password':{'type':Sequelize[_0x87ac('0x2')]},'apiKey':{'type':Sequelize[_0x87ac('0x2')]},'applicationId':{'type':Sequelize[_0x87ac('0x2')]},'accountId':{'type':Sequelize[_0x87ac('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x87ac('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x87ac('0xc');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x87ac('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x87ac('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x87ac('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x87ac('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x87ac('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x87ac('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x87ac('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x87ac('0xd')],'defaultValue':![],'comment':_0x87ac('0x10'),'set':function(_0x1dd045){if(!_0x1dd045)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x87ac('0x11')](_0x87ac('0x12'),_0x1dd045);}}}; \ No newline at end of file +var _0xe3a8=['skebby','connectel','clickatell','bandwidth','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','generate','ENUM','twilio'];(function(_0x41a36b,_0xe0d4a3){var _0x4d3143=function(_0x5d714b){while(--_0x5d714b){_0x41a36b['push'](_0x41a36b['shift']());}};_0x4d3143(++_0xe0d4a3);}(_0xe3a8,0x1e7));var _0x8e3a=function(_0x1f85e7,_0x34ce96){_0x1f85e7=_0x1f85e7-0x0;var _0x4f61d8=_0xe3a8[_0x1f85e7];return _0x4f61d8;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x8e3a('0x0'));module[_0x8e3a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x8e3a('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x8e3a('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x8e3a('0x2')],'defaultValue':function(){return rs[_0x8e3a('0x3')]();}},'phone':{'type':Sequelize[_0x8e3a('0x2')]},'type':{'type':Sequelize[_0x8e3a('0x4')](_0x8e3a('0x5'),_0x8e3a('0x6'),_0x8e3a('0x7'),'clicksend','plivo',_0x8e3a('0x8'),_0x8e3a('0x9'),'csc','infobip','intelepeer')},'accountSid':{'type':Sequelize[_0x8e3a('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x8e3a('0x2')]},'smsMethod':{'type':Sequelize[_0x8e3a('0x4')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x8e3a('0x2')]},'applicationId':{'type':Sequelize[_0x8e3a('0x2')]},'accountId':{'type':Sequelize[_0x8e3a('0x2')]},'senderString':{'type':Sequelize[_0x8e3a('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x8e3a('0xa')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x8e3a('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8e3a('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8e3a('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8e3a('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x8e3a('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x8e3a('0xb')],'defaultValue':![],'comment':_0x8e3a('0xd'),'set':function(_0xabccd6){if(!_0xabccd6)this[_0x8e3a('0xe')](_0x8e3a('0xf'),null);this[_0x8e3a('0xe')](_0x8e3a('0x10'),_0xabccd6);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index d19288a..b8ae34f 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 _0x2b16=['map','SmsAccount','rawAttributes','fieldName','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','SmsAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','sms','SmsApplication','Applications','applications','account','CmContact','ValidationError','createdAt','updatedAt','twilio','From','Body','MessageSid','from','sender','text','connectel','Text','messageId','infobip','results','csc','clickatell','fromNumber','replyMessageId','bandwidth','refid','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','CmList','ListId','DESC','omit','Contacts','SmsInteraction','interaction','created','autoclose','push','unmanaged','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','set','Content-Type','text/xml','\x0a','addApplications','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','fullname','internal','color','tag','to\x20is\x20mandatory','List','out','Messages','spread','dataValues','SmsAccount,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','skebby','skebby_dispatch_id','requestid','statusInt','clicksend','message_id','status_code','groupName','DELIVERED','intelepeer','redif','inspect','error_code','DELIVERED_TO_GATEWAY','message-delivered','ACCEPTD','message-id','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause'];(function(_0x1f3188,_0x1c0d4f){var _0x479c0a=function(_0x469a5a){while(--_0x469a5a){_0x1f3188['push'](_0x1f3188['shift']());}};_0x479c0a(++_0x1c0d4f);}(_0x2b16,0x17a));var _0x62b1=function(_0x42a405,_0x21d78c){_0x42a405=_0x42a405-0x0;var _0xeac62b=_0x2b16[_0x42a405];return _0xeac62b;};'use strict';var emlformat=require(_0x62b1('0x0'));var rimraf=require(_0x62b1('0x1'));var zipdir=require(_0x62b1('0x2'));var jsonpatch=require(_0x62b1('0x3'));var rp=require(_0x62b1('0x4'));var moment=require('moment');var BPromise=require(_0x62b1('0x5'));var Mustache=require('mustache');var util=require(_0x62b1('0x6'));var path=require(_0x62b1('0x7'));var sox=require(_0x62b1('0x8'));var csv=require('to-csv');var ejs=require(_0x62b1('0x9'));var fs=require('fs');var fs_extra=require(_0x62b1('0xa'));var _=require(_0x62b1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x62b1('0xc'));var deskjs=require(_0x62b1('0xd'));var toCsv=require(_0x62b1('0xe'));var querystring=require(_0x62b1('0xf'));var Papa=require(_0x62b1('0x10'));var Redis=require(_0x62b1('0x11'));var authService=require(_0x62b1('0x12'));var qs=require(_0x62b1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x62b1('0x14'));var logger=require(_0x62b1('0x15'))(_0x62b1('0x16'));var utils=require(_0x62b1('0x17'));var config=require(_0x62b1('0x18'));var licenseUtil=require(_0x62b1('0x19'));var db=require(_0x62b1('0x1a'))['db'];config[_0x62b1('0x1b')]=_[_0x62b1('0x1c')](config['redis'],{'host':_0x62b1('0x1d'),'port':0x18eb});var socket=require(_0x62b1('0x1e'))(new Redis(config[_0x62b1('0x1b')]));require(_0x62b1('0x1f'))['register'](socket);var jayson=require(_0x62b1('0x20'));var client=jayson[_0x62b1('0x21')]['http']({'port':0x232c});function respondWithRpcPromise(_0x13d339,_0x53d716,_0x5e8275,_0x1eca64){return new BPromise(function(_0x29a673,_0x47c483){var _0x22051d=_0x1eca64||client;return _0x22051d[_0x62b1('0x22')](_0x13d339,_0x5e8275)[_0x62b1('0x23')](function(_0x186eff){logger[_0x62b1('0x24')](_0x62b1('0x25'),_0x53d716,_0x62b1('0x26'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x53d716,_0x62b1('0x26'),JSON[_0x62b1('0x27')](_0x186eff));if(_0x186eff[_0x62b1('0x28')]){if(_0x186eff[_0x62b1('0x28')]['code']===0x1f4){logger[_0x62b1('0x28')](_0x62b1('0x25'),_0x53d716,_0x186eff[_0x62b1('0x28')]['message']);return _0x47c483(_0x186eff[_0x62b1('0x28')]['message']);}logger[_0x62b1('0x28')](_0x62b1('0x25'),_0x53d716,_0x186eff[_0x62b1('0x28')]['message']);return _0x29a673(_0x186eff[_0x62b1('0x28')][_0x62b1('0x29')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x53d716,'request\x20sent');_0x29a673(_0x186eff[_0x62b1('0x2a')][_0x62b1('0x29')]);}})[_0x62b1('0x2b')](function(_0x513e1f){logger[_0x62b1('0x28')](_0x62b1('0x25'),_0x53d716,_0x513e1f);_0x47c483(_0x513e1f);});});}function respondWithStatusCode(_0x5bcbf0,_0x421d91){_0x421d91=_0x421d91||0xcc;return function(_0xad9d82){if(_0xad9d82){return _0x5bcbf0[_0x62b1('0x2c')](_0x421d91);}return _0x5bcbf0[_0x62b1('0x2d')](_0x421d91)[_0x62b1('0x2e')]();};}function respondWithResult(_0x4b7cbc,_0x41b303){_0x41b303=_0x41b303||0xc8;return function(_0x3ee242){if(_0x3ee242){return _0x4b7cbc[_0x62b1('0x2d')](_0x41b303)[_0x62b1('0x2f')](_0x3ee242);}};}function respondWithFilteredResult(_0x77c186,_0x502bb6){return function(_0x397c6a){if(_0x397c6a){var _0xc0e4b5=typeof _0x502bb6[_0x62b1('0x30')]===_0x62b1('0x31')&&typeof _0x502bb6[_0x62b1('0x32')]==='undefined';var _0x354a52=_0x397c6a[_0x62b1('0x33')];var _0x4c0367=_0xc0e4b5?0x0:_0x502bb6[_0x62b1('0x30')];var _0x54c437=_0xc0e4b5?_0x397c6a[_0x62b1('0x33')]:_0x502bb6[_0x62b1('0x30')]+_0x502bb6[_0x62b1('0x32')];var _0x34ba70;if(_0x54c437>=_0x354a52){_0x54c437=_0x354a52;_0x34ba70=0xc8;}else{_0x34ba70=0xce;}_0x77c186[_0x62b1('0x2d')](_0x34ba70);return _0x77c186['set'](_0x62b1('0x34'),_0x4c0367+'-'+_0x54c437+'/'+_0x354a52)[_0x62b1('0x2f')](_0x397c6a);}return null;};}function patchUpdates(_0x3ac394){return function(_0x5f0e43){try{jsonpatch[_0x62b1('0x35')](_0x5f0e43,_0x3ac394,!![]);}catch(_0x43099c){return BPromise[_0x62b1('0x36')](_0x43099c);}return _0x5f0e43[_0x62b1('0x37')]();};}function saveUpdates(_0x542615,_0x52a89e){return function(_0x48c901){if(_0x48c901){return _0x48c901['update'](_0x542615)[_0x62b1('0x23')](function(_0x2e9997){return _0x2e9997;});}return null;};}function removeEntity(_0x13b25f,_0x1e19fe){return function(_0x1c129e){if(_0x1c129e){return _0x1c129e[_0x62b1('0x38')]()[_0x62b1('0x23')](function(){var _0x5ceb65=_0x1c129e[_0x62b1('0x39')]({'plain':!![]});var _0x987bef=_0x62b1('0x3a');return db[_0x62b1('0x3b')][_0x62b1('0x38')]({'where':{'type':_0x987bef,'resourceId':_0x5ceb65['id']}})['then'](function(){return _0x1c129e;});})[_0x62b1('0x23')](function(){_0x13b25f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5898a6,_0x33db4d){return function(_0x5a97c5){if(!_0x5a97c5){_0x5898a6['sendStatus'](0x194);}return _0x5a97c5;};}function handleError(_0x476f6b,_0x9b170a){_0x9b170a=_0x9b170a||0x1f4;return function(_0x23c21e){logger[_0x62b1('0x28')](_0x23c21e[_0x62b1('0x3c')]);if(_0x23c21e['name']){delete _0x23c21e[_0x62b1('0x3d')];}_0x476f6b[_0x62b1('0x2d')](_0x9b170a)[_0x62b1('0x3e')](_0x23c21e);};}exports[_0x62b1('0x3f')]=function(_0x528e71,_0x36ec92){var _0x447ae9={'include':[{'model':db[_0x62b1('0x40')],'as':_0x62b1('0x41')}]},_0x1d32bb={},_0x1c958e={'count':0x0,'rows':[]};var _0x409960=_[_0x62b1('0x42')](db[_0x62b1('0x43')][_0x62b1('0x44')],function(_0x49b61d){return{'name':_0x49b61d[_0x62b1('0x45')],'type':_0x49b61d['type'][_0x62b1('0x46')]};});_0x1d32bb[_0x62b1('0x47')]=_['map'](_0x409960,_0x62b1('0x3d'));_0x1d32bb['query']=_[_0x62b1('0x48')](_0x528e71['query']);_0x1d32bb[_0x62b1('0x49')]=_[_0x62b1('0x4a')](_0x1d32bb[_0x62b1('0x47')],_0x1d32bb[_0x62b1('0x4b')]);_0x447ae9['attributes']=_[_0x62b1('0x4a')](_0x1d32bb[_0x62b1('0x47')],qs[_0x62b1('0x4c')](_0x528e71['query']['fields']));_0x447ae9[_0x62b1('0x4d')]=_0x447ae9['attributes']['length']?_0x447ae9[_0x62b1('0x4d')]:_0x1d32bb['model'];if(!_0x528e71[_0x62b1('0x4b')][_0x62b1('0x4e')](_0x62b1('0x4f'))){_0x447ae9['limit']=qs[_0x62b1('0x32')](_0x528e71['query']['limit']);_0x447ae9[_0x62b1('0x30')]=qs[_0x62b1('0x30')](_0x528e71[_0x62b1('0x4b')][_0x62b1('0x30')]);}_0x447ae9[_0x62b1('0x50')]=qs[_0x62b1('0x51')](_0x528e71[_0x62b1('0x4b')][_0x62b1('0x51')]);_0x447ae9[_0x62b1('0x52')]=qs[_0x62b1('0x49')](_[_0x62b1('0x53')](_0x528e71['query'],_0x1d32bb['filters']),_0x409960);if(_0x528e71[_0x62b1('0x4b')]['filter']){_0x447ae9[_0x62b1('0x52')]=_[_0x62b1('0x54')](_0x447ae9[_0x62b1('0x52')],{'$or':_['map'](_0x409960,function(_0x343011){if(_0x343011[_0x62b1('0x55')]!=='VIRTUAL'){var _0x88bb59={};_0x88bb59[_0x343011['name']]={'$like':'%'+_0x528e71[_0x62b1('0x4b')][_0x62b1('0x56')]+'%'};return _0x88bb59;}})});}_0x447ae9=_[_0x62b1('0x54')]({},_0x447ae9,_0x528e71[_0x62b1('0x57')]);var _0x27ea79={'where':_0x447ae9[_0x62b1('0x52')]};return db[_0x62b1('0x43')][_0x62b1('0x33')](_0x27ea79)[_0x62b1('0x23')](function(_0x28a6f9){_0x1c958e['count']=_0x28a6f9;if(_0x528e71['query'][_0x62b1('0x58')]){_0x447ae9[_0x62b1('0x59')]=[{'all':!![]}];}return db[_0x62b1('0x43')][_0x62b1('0x5a')](_0x447ae9);})['then'](function(_0x5c7121){_0x1c958e['rows']=_0x5c7121;return _0x1c958e;})[_0x62b1('0x23')](respondWithFilteredResult(_0x36ec92,_0x447ae9))[_0x62b1('0x2b')](handleError(_0x36ec92,null));};exports[_0x62b1('0x5b')]=function(_0x32e055,_0x58beaf){var _0x23307a={'raw':![],'where':{'id':_0x32e055[_0x62b1('0x5c')]['id']},'include':[{'model':db[_0x62b1('0x40')],'as':_0x62b1('0x41')}]},_0x35e288={};_0x35e288[_0x62b1('0x47')]=_[_0x62b1('0x48')](db[_0x62b1('0x43')]['rawAttributes']);_0x35e288[_0x62b1('0x4b')]=_[_0x62b1('0x48')](_0x32e055[_0x62b1('0x4b')]);_0x35e288[_0x62b1('0x49')]=_['intersection'](_0x35e288['model'],_0x35e288[_0x62b1('0x4b')]);_0x23307a[_0x62b1('0x4d')]=_['intersection'](_0x35e288[_0x62b1('0x47')],qs['fields'](_0x32e055[_0x62b1('0x4b')][_0x62b1('0x4c')]));_0x23307a[_0x62b1('0x4d')]=_0x23307a[_0x62b1('0x4d')][_0x62b1('0x5d')]?_0x23307a[_0x62b1('0x4d')]:_0x35e288[_0x62b1('0x47')];if(_0x32e055[_0x62b1('0x4b')]['includeAll']){_0x23307a['include']=[{'all':!![]}];}_0x23307a=_[_0x62b1('0x54')]({},_0x23307a,_0x32e055[_0x62b1('0x57')]);return db[_0x62b1('0x43')][_0x62b1('0x5e')](_0x23307a)[_0x62b1('0x23')](handleEntityNotFound(_0x58beaf,null))['then'](respondWithResult(_0x58beaf,null))[_0x62b1('0x2b')](handleError(_0x58beaf,null));};exports[_0x62b1('0x5f')]=function(_0x4e7155,_0x10f89d){return db[_0x62b1('0x43')]['create'](_0x4e7155[_0x62b1('0x60')],{})[_0x62b1('0x23')](function(_0x504d4d){var _0x3d657c=_0x4e7155['user'][_0x62b1('0x39')]({'plain':!![]});if(!_0x3d657c)throw new Error(_0x62b1('0x61'));if(_0x3d657c[_0x62b1('0x62')]===_0x62b1('0x63')){var _0x56a76b=_0x504d4d[_0x62b1('0x39')]({'plain':!![]});var _0x30dbe6=_0x62b1('0x3a');return db['UserProfileSection'][_0x62b1('0x5e')]({'where':{'name':_0x30dbe6,'userProfileId':_0x3d657c[_0x62b1('0x64')]},'raw':!![]})[_0x62b1('0x23')](function(_0x2d6adf){if(_0x2d6adf&&_0x2d6adf[_0x62b1('0x65')]===0x0){return db[_0x62b1('0x3b')][_0x62b1('0x5f')]({'name':_0x56a76b[_0x62b1('0x3d')],'resourceId':_0x56a76b['id'],'type':_0x2d6adf['name'],'sectionId':_0x2d6adf['id']},{})['then'](function(){return _0x504d4d;});}else{return _0x504d4d;}})[_0x62b1('0x2b')](function(_0x4eaadc){logger[_0x62b1('0x28')](_0x62b1('0x66'),_0x4eaadc);throw _0x4eaadc;});}return _0x504d4d;})[_0x62b1('0x23')](respondWithResult(_0x10f89d,0xc9))[_0x62b1('0x2b')](handleError(_0x10f89d,null));};exports[_0x62b1('0x67')]=function(_0x106481,_0x42ee39){if(_0x106481[_0x62b1('0x60')]['id']){delete _0x106481[_0x62b1('0x60')]['id'];}return db[_0x62b1('0x43')][_0x62b1('0x5e')]({'where':{'id':_0x106481[_0x62b1('0x5c')]['id']},'include':[{'model':db[_0x62b1('0x40')],'as':_0x62b1('0x41')}]})[_0x62b1('0x23')](handleEntityNotFound(_0x42ee39,null))[_0x62b1('0x23')](saveUpdates(_0x106481[_0x62b1('0x60')],null))['then'](respondWithResult(_0x42ee39,null))[_0x62b1('0x2b')](handleError(_0x42ee39,null));};exports[_0x62b1('0x38')]=function(_0x176fb5,_0x1d8caf){return db['SmsAccount']['find']({'where':{'id':_0x176fb5[_0x62b1('0x5c')]['id']}})[_0x62b1('0x23')](handleEntityNotFound(_0x1d8caf,null))[_0x62b1('0x23')](removeEntity(_0x1d8caf,null))[_0x62b1('0x2b')](handleError(_0x1d8caf,null));};exports[_0x62b1('0x68')]=function(_0xbbc77c,_0x22b490){return db['SmsAccount'][_0x62b1('0x68')]()[_0x62b1('0x23')](respondWithResult(_0x22b490,null))[_0x62b1('0x2b')](handleError(_0x22b490,null));};exports['addDisposition']=function(_0x98593f,_0x13db8e,_0x2755ac){if(_0x98593f[_0x62b1('0x60')]['id']){delete _0x98593f[_0x62b1('0x60')]['id'];}return db['SmsAccount'][_0x62b1('0x5e')]({'where':{'id':_0x98593f[_0x62b1('0x5c')]['id']}})[_0x62b1('0x23')](handleEntityNotFound(_0x13db8e,null))['then'](function(_0x14b6b9){if(_0x14b6b9){_0x98593f[_0x62b1('0x60')][_0x62b1('0x69')]=_0x14b6b9['id'];return db[_0x62b1('0x6a')][_0x62b1('0x5f')](_0x98593f[_0x62b1('0x60')]);}})[_0x62b1('0x23')](respondWithResult(_0x13db8e,null))[_0x62b1('0x2b')](handleError(_0x13db8e,null));};exports[_0x62b1('0x6b')]=function(_0x18f2a2,_0x4eb666,_0x44b459){var _0x748018={'raw':![],'where':{}};var _0x2cbf13={};var _0x31e48f={'count':0x0,'rows':[]};return db['SmsAccount'][_0x62b1('0x6c')]({'where':{'id':_0x18f2a2['params']['id']}})['then'](handleEntityNotFound(_0x4eb666,null))[_0x62b1('0x23')](function(_0x551c10){if(_0x551c10){_0x2cbf13[_0x62b1('0x47')]=_[_0x62b1('0x48')](db[_0x62b1('0x6a')]['rawAttributes']);_0x2cbf13[_0x62b1('0x4b')]=_['keys'](_0x18f2a2['query']);_0x2cbf13[_0x62b1('0x49')]=_[_0x62b1('0x4a')](_0x2cbf13[_0x62b1('0x47')],_0x2cbf13[_0x62b1('0x4b')]);_0x748018[_0x62b1('0x4d')]=_['intersection'](_0x2cbf13[_0x62b1('0x47')],qs[_0x62b1('0x4c')](_0x18f2a2[_0x62b1('0x4b')]['fields']));_0x748018[_0x62b1('0x4d')]=_0x748018[_0x62b1('0x4d')]['length']?_0x748018['attributes']:_0x2cbf13['model'];if(!_0x18f2a2['query']['hasOwnProperty'](_0x62b1('0x4f'))){_0x748018[_0x62b1('0x32')]=qs[_0x62b1('0x32')](_0x18f2a2[_0x62b1('0x4b')][_0x62b1('0x32')]);_0x748018[_0x62b1('0x30')]=qs[_0x62b1('0x30')](_0x18f2a2[_0x62b1('0x4b')]['offset']);}_0x748018[_0x62b1('0x50')]=qs[_0x62b1('0x51')](_0x18f2a2[_0x62b1('0x4b')][_0x62b1('0x51')]);_0x748018[_0x62b1('0x52')]=qs[_0x62b1('0x49')](_[_0x62b1('0x53')](_0x18f2a2['query'],_0x2cbf13[_0x62b1('0x49')]));_0x748018[_0x62b1('0x52')][_0x62b1('0x69')]=_0x551c10['id'];if(_0x18f2a2[_0x62b1('0x4b')][_0x62b1('0x56')]){_0x748018['where']=_[_0x62b1('0x54')](_0x748018['where'],{'$or':_[_0x62b1('0x42')](_0x748018[_0x62b1('0x4d')],function(_0x50851e){var _0x4c8954={};_0x4c8954[_0x50851e]={'$like':'%'+_0x18f2a2[_0x62b1('0x4b')][_0x62b1('0x56')]+'%'};return _0x4c8954;})});}_0x748018=_['merge']({},_0x748018,_0x18f2a2[_0x62b1('0x57')]);return db[_0x62b1('0x6a')][_0x62b1('0x33')]({'where':_0x748018[_0x62b1('0x52')]})[_0x62b1('0x23')](function(_0x53d4ba){_0x31e48f[_0x62b1('0x33')]=_0x53d4ba;if(_0x18f2a2[_0x62b1('0x4b')][_0x62b1('0x58')]){_0x748018[_0x62b1('0x59')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x748018);})[_0x62b1('0x23')](function(_0x4066cb){_0x31e48f[_0x62b1('0x6d')]=_0x4066cb;return _0x31e48f;});}})['then'](respondWithFilteredResult(_0x4eb666,_0x748018))[_0x62b1('0x2b')](handleError(_0x4eb666,null));};exports[_0x62b1('0x6e')]=function(_0x22a109,_0xe7d984,_0x49086c){return db['SmsAccount'][_0x62b1('0x5e')]({'where':{'id':_0x22a109['params']['id']}})['then'](handleEntityNotFound(_0xe7d984,null))[_0x62b1('0x23')](function(_0x4afcc4){if(_0x4afcc4){return _0x4afcc4['removeDispositions'](_0x22a109[_0x62b1('0x4b')][_0x62b1('0x6f')]);}})['then'](respondWithStatusCode(_0xe7d984,null))['catch'](handleError(_0xe7d984,null));};exports[_0x62b1('0x70')]=function(_0x1da349,_0x562753,_0x4a7a02){if(_0x1da349['body']['id']){delete _0x1da349['body']['id'];}return db[_0x62b1('0x43')]['find']({'where':{'id':_0x1da349['params']['id']}})[_0x62b1('0x23')](handleEntityNotFound(_0x562753,null))[_0x62b1('0x23')](function(_0x446c8b){if(_0x446c8b){_0x1da349['body'][_0x62b1('0x69')]=_0x446c8b['id'];return db['CannedAnswer'][_0x62b1('0x5f')](_0x1da349['body']);}})[_0x62b1('0x23')](respondWithResult(_0x562753,null))[_0x62b1('0x2b')](handleError(_0x562753,null));};exports[_0x62b1('0x71')]=function(_0x40779f,_0x18068c,_0x34e087){var _0xf6d555={'raw':![],'where':{}};var _0x5a77ca={};var _0x22d655={'count':0x0,'rows':[]};return db['SmsAccount'][_0x62b1('0x6c')]({'where':{'id':_0x40779f['params']['id']}})[_0x62b1('0x23')](handleEntityNotFound(_0x18068c,null))[_0x62b1('0x23')](function(_0x30ba28){if(_0x30ba28){_0x5a77ca[_0x62b1('0x47')]=_[_0x62b1('0x48')](db[_0x62b1('0x72')][_0x62b1('0x44')]);_0x5a77ca[_0x62b1('0x4b')]=_[_0x62b1('0x48')](_0x40779f['query']);_0x5a77ca[_0x62b1('0x49')]=_['intersection'](_0x5a77ca['model'],_0x5a77ca[_0x62b1('0x4b')]);_0xf6d555['attributes']=_['intersection'](_0x5a77ca['model'],qs[_0x62b1('0x4c')](_0x40779f[_0x62b1('0x4b')][_0x62b1('0x4c')]));_0xf6d555[_0x62b1('0x4d')]=_0xf6d555[_0x62b1('0x4d')][_0x62b1('0x5d')]?_0xf6d555['attributes']:_0x5a77ca[_0x62b1('0x47')];if(!_0x40779f[_0x62b1('0x4b')][_0x62b1('0x4e')](_0x62b1('0x4f'))){_0xf6d555[_0x62b1('0x32')]=qs['limit'](_0x40779f[_0x62b1('0x4b')]['limit']);_0xf6d555[_0x62b1('0x30')]=qs['offset'](_0x40779f['query'][_0x62b1('0x30')]);}_0xf6d555[_0x62b1('0x50')]=qs[_0x62b1('0x51')](_0x40779f[_0x62b1('0x4b')][_0x62b1('0x51')]);_0xf6d555[_0x62b1('0x52')]=qs[_0x62b1('0x49')](_[_0x62b1('0x53')](_0x40779f[_0x62b1('0x4b')],_0x5a77ca[_0x62b1('0x49')]));_0xf6d555[_0x62b1('0x52')][_0x62b1('0x69')]=_0x30ba28['id'];if(_0x40779f[_0x62b1('0x4b')][_0x62b1('0x56')]){_0xf6d555['where']=_[_0x62b1('0x54')](_0xf6d555[_0x62b1('0x52')],{'$or':_['map'](_0xf6d555['attributes'],function(_0x1d22f1){var _0x56461b={};_0x56461b[_0x1d22f1]={'$like':'%'+_0x40779f[_0x62b1('0x4b')][_0x62b1('0x56')]+'%'};return _0x56461b;})});}_0xf6d555=_[_0x62b1('0x54')]({},_0xf6d555,_0x40779f[_0x62b1('0x57')]);return db[_0x62b1('0x72')][_0x62b1('0x33')]({'where':_0xf6d555['where']})['then'](function(_0x2c1950){_0x22d655[_0x62b1('0x33')]=_0x2c1950;if(_0x40779f['query'][_0x62b1('0x58')]){_0xf6d555['include']=[{'all':!![]}];}return db[_0x62b1('0x72')]['findAll'](_0xf6d555);})[_0x62b1('0x23')](function(_0x288af2){_0x22d655[_0x62b1('0x6d')]=_0x288af2;return _0x22d655;});}})[_0x62b1('0x23')](respondWithFilteredResult(_0x18068c,_0xf6d555))[_0x62b1('0x2b')](handleError(_0x18068c,null));};exports['removeAnswers']=function(_0x2e552d,_0x262790,_0x431a3b){return db['SmsAccount'][_0x62b1('0x5e')]({'where':{'id':_0x2e552d['params']['id']}})[_0x62b1('0x23')](handleEntityNotFound(_0x262790,null))[_0x62b1('0x23')](function(_0x5db9cd){if(_0x5db9cd){return _0x5db9cd[_0x62b1('0x73')](_0x2e552d['query'][_0x62b1('0x6f')]);}})['then'](respondWithStatusCode(_0x262790,null))[_0x62b1('0x2b')](handleError(_0x262790,null));};exports['notify']=function(_0x4b27b6,_0x2dd8ed,_0x62b425){var _0x42bfbb={'channel':_0x62b1('0x74')};var _0x5e7802=[];var _0x183575=[];var _0x1c4454={};return db[_0x62b1('0x43')][_0x62b1('0x5e')]({'where':{'id':_0x4b27b6[_0x62b1('0x5c')]['id']},'include':[{'model':db[_0x62b1('0x75')],'as':_0x62b1('0x76')}]})[_0x62b1('0x23')](handleEntityNotFound(_0x2dd8ed,null))[_0x62b1('0x23')](function(_0x49b202){_0x42bfbb['account']=_0x49b202;_0x42bfbb[_0x62b1('0x77')]=_['orderBy'](_0x49b202[_0x62b1('0x76')],['priority'],['asc']);if(_0x42bfbb[_0x62b1('0x78')][_0x62b1('0x76')]){delete _0x42bfbb['account'][_0x62b1('0x76')];}return db[_0x62b1('0x79')]['describe']();})['then'](function(_0x26653e){if(!_0x26653e){throw new db['Sequelize'][(_0x62b1('0x7a'))]('no\x20available\x20attributes');}_0x5e7802=_['difference'](_[_0x62b1('0x48')](_0x26653e),[_0x62b1('0x7b'),_0x62b1('0x7c')]);_0x183575=_['difference'](_['keys'](_0x26653e),[_0x62b1('0x7b'),'updatedAt','CompanyId','ListId']);_0x42bfbb[_0x62b1('0x60')]={'mapKey':'mobile'};if(_0x42bfbb['account'][_0x62b1('0x55')]){switch(_0x42bfbb['account'][_0x62b1('0x55')]){case _0x62b1('0x7d'):_0x42bfbb['body']['from']=_0x4b27b6[_0x62b1('0x60')][_0x62b1('0x7e')];_0x42bfbb[_0x62b1('0x60')][_0x62b1('0x60')]=_0x4b27b6['body'][_0x62b1('0x7f')];_0x42bfbb['body']['messageId']=_0x4b27b6[_0x62b1('0x60')][_0x62b1('0x80')];break;case'skebby':_0x42bfbb[_0x62b1('0x60')][_0x62b1('0x81')]='+'+_0x4b27b6['body'][_0x62b1('0x82')];_0x42bfbb['body']['body']=_0x4b27b6[_0x62b1('0x60')][_0x62b1('0x83')];break;case _0x62b1('0x84'):_0x42bfbb['body']['from']=_0x4b27b6[_0x62b1('0x60')][_0x62b1('0x81')];_0x42bfbb[_0x62b1('0x60')][_0x62b1('0x60')]=_0x4b27b6[_0x62b1('0x60')][_0x62b1('0x29')];break;case'clicksend':_0x42bfbb[_0x62b1('0x60')][_0x62b1('0x81')]=_0x4b27b6[_0x62b1('0x60')][_0x62b1('0x81')];_0x42bfbb['body'][_0x62b1('0x60')]=_0x4b27b6['body'][_0x62b1('0x60')];_0x42bfbb[_0x62b1('0x60')]['messageId']=_0x4b27b6[_0x62b1('0x60')]['message_id'];break;case'plivo':_0x42bfbb[_0x62b1('0x60')]['from']=_0x4b27b6[_0x62b1('0x60')][_0x62b1('0x7e')];_0x42bfbb['body']['body']=_0x4b27b6['body'][_0x62b1('0x85')];_0x42bfbb['body'][_0x62b1('0x86')]=_0x4b27b6[_0x62b1('0x60')]['MessageUUID'];break;case _0x62b1('0x87'):_0x42bfbb[_0x62b1('0x60')][_0x62b1('0x81')]='+'+_0x4b27b6['body'][_0x62b1('0x88')][0x0][_0x62b1('0x81')];_0x42bfbb['body'][_0x62b1('0x60')]=_0x4b27b6['body'][_0x62b1('0x88')][0x0]['text'];_0x42bfbb['body'][_0x62b1('0x86')]=_0x4b27b6[_0x62b1('0x60')][_0x62b1('0x88')][0x0][_0x62b1('0x86')];break;case _0x62b1('0x89'):_0x42bfbb['body'][_0x62b1('0x81')]=_0x4b27b6[_0x62b1('0x60')]['originatingAddress'];_0x42bfbb[_0x62b1('0x60')][_0x62b1('0x60')]=_0x4b27b6['body']['segmentedMessage'][_0x62b1('0x29')];break;case _0x62b1('0x8a'):_0x42bfbb['body'][_0x62b1('0x81')]=_0x4b27b6[_0x62b1('0x60')][_0x62b1('0x8b')];_0x42bfbb['body'][_0x62b1('0x60')]=_0x4b27b6[_0x62b1('0x60')][_0x62b1('0x83')];_0x42bfbb[_0x62b1('0x60')][_0x62b1('0x86')]=_0x4b27b6['body'][_0x62b1('0x8c')];break;case _0x62b1('0x8d'):_0x42bfbb[_0x62b1('0x60')][_0x62b1('0x86')]=_0x4b27b6[_0x62b1('0x60')][0x0]['message']['id'];_0x42bfbb[_0x62b1('0x60')][_0x62b1('0x81')]=_0x4b27b6['body'][0x0][_0x62b1('0x29')][_0x62b1('0x81')];_0x42bfbb[_0x62b1('0x60')][_0x62b1('0x60')]=_0x4b27b6[_0x62b1('0x60')][0x0][_0x62b1('0x29')][_0x62b1('0x83')];break;case'intelepeer':_0x42bfbb[_0x62b1('0x60')]['from']=_0x4b27b6[_0x62b1('0x60')][_0x62b1('0x81')];_0x42bfbb[_0x62b1('0x60')]['body']=_0x4b27b6[_0x62b1('0x60')][_0x62b1('0x29')];_0x42bfbb[_0x62b1('0x60')][_0x62b1('0x86')]=_0x4b27b6[_0x62b1('0x60')][_0x62b1('0x8e')];break;}}if(_0x42bfbb[_0x62b1('0x60')]['id']){delete _0x42bfbb[_0x62b1('0x60')]['id'];}if(_['isNil'](_0x42bfbb['body'][_0x62b1('0x81')])){throw new db[(_0x62b1('0x8f'))][(_0x62b1('0x7a'))](_0x62b1('0x90'));}if(_[_0x62b1('0x91')](_0x42bfbb[_0x62b1('0x60')][_0x62b1('0x60')])||_0x42bfbb[_0x62b1('0x60')][_0x62b1('0x60')]===''){throw new db[(_0x62b1('0x8f'))][(_0x62b1('0x7a'))](_0x62b1('0x92'));}if(_[_0x62b1('0x91')](_0x42bfbb['body'][_0x62b1('0x93')])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x183575);}if(!_['includes'](_0x183575,_0x42bfbb['body']['mapKey'])){throw new db[(_0x62b1('0x8f'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x183575);}_0x1c4454[_0x42bfbb[_0x62b1('0x60')][_0x62b1('0x93')]]=_0x42bfbb[_0x62b1('0x60')][_0x62b1('0x81')];return db[_0x62b1('0x94')]['find']({'where':{'id':_0x42bfbb[_0x62b1('0x78')][_0x62b1('0x95')]},'include':[{'model':db[_0x62b1('0x79')],'as':'Contacts','where':_0x1c4454,'limit':0x1,'order':[[_0x62b1('0x7c'),_0x62b1('0x96')]]}]});})[_0x62b1('0x23')](handleEntityNotFound(_0x2dd8ed,null))[_0x62b1('0x23')](function(_0x17d0b6){if(_0x17d0b6){_0x42bfbb['list']=_[_0x62b1('0x97')](_0x17d0b6,[_0x62b1('0x98')]);if(_0x17d0b6[_0x62b1('0x98')]['length']){return _0x17d0b6[_0x62b1('0x98')][0x0];}var _0x21c69b=_['defaults'](_0x42bfbb['body'],{'firstName':_0x42bfbb[_0x62b1('0x60')][_0x62b1('0x81')],'ListId':_0x17d0b6['id']});_0x21c69b[_0x42bfbb[_0x62b1('0x60')]['mapKey']]=_0x42bfbb[_0x62b1('0x60')][_0x62b1('0x81')];return db['CmContact']['create'](_0x21c69b,{'fields':_0x5e7802,'raw':!![]});}})[_0x62b1('0x23')](handleEntityNotFound(_0x2dd8ed,null))[_0x62b1('0x23')](function(_0x3ac3c4){if(_0x3ac3c4){_0x42bfbb['contact']=_0x3ac3c4;var _0x169f6d={'ContactId':_0x3ac3c4['id'],'phone':_0x42bfbb['body'][_0x62b1('0x81')],'SmsAccountId':_0x4b27b6['params']['id']};var _0x51ba75={'ContactId':_0x3ac3c4['id'],'SmsAccountId':_0x4b27b6[_0x62b1('0x5c')]['id'],'closed':![]};return db['SmsInteraction'][_0x62b1('0x5e')]({'where':_0x51ba75})[_0x62b1('0x23')](function(_0x3b5f00){if(_0x3b5f00){return[_0x3b5f00,![]];}return db[_0x62b1('0x99')][_0x62b1('0x5f')](_0x169f6d)['then'](function(_0x19fdd3){return[_0x19fdd3,!![]];});});}})['spread'](function(_0x178954,_0x2a2e29){_0x42bfbb['interaction']=_0x178954[_0x62b1('0x39')]({'plain':!![]});_0x42bfbb[_0x62b1('0x9a')][_0x62b1('0x9b')]=![];if(_0x2a2e29){if(_0x42bfbb['account'][_0x62b1('0x9c')]){_0x42bfbb['applications'][_0x62b1('0x9d')]({'id':0x0,'priority':_0x42bfbb[_0x62b1('0x77')][_0x62b1('0x5d')]+0x1,'app':'close','appdata':_0x62b1('0x9e'),'interval':'*,*,*,*'});}_0x42bfbb['interaction'][_0x62b1('0x9b')]=!![];}return db[_0x62b1('0x9f')][_0x62b1('0x5f')]({'phone':_0x42bfbb['body'][_0x62b1('0x81')],'messageId':_0x42bfbb['body'][_0x62b1('0x86')],'body':_0x42bfbb[_0x62b1('0x60')][_0x62b1('0x60')],'SmsAccountId':_0x4b27b6[_0x62b1('0x5c')]['id'],'SmsInteractionId':_0x178954['id'],'direction':'in','ContactId':_0x178954[_0x62b1('0xa0')],'AttachmentId':_0x42bfbb[_0x62b1('0x60')][_0x62b1('0xa1')]});})['then'](function(_0x39abf8){_0x42bfbb['message']=_0x39abf8;if(_0x42bfbb[_0x62b1('0x9a')][_0x62b1('0xa2')]){return db[_0x62b1('0xa3')]['find']({'attributes':['id',_0x62b1('0x3d')],'where':{'id':_0x42bfbb[_0x62b1('0x9a')][_0x62b1('0xa2')]}})[_0x62b1('0x23')](function(_0x2ec6cb){if(_0x2ec6cb){_0x42bfbb[_0x62b1('0x77')][_0x62b1('0xa4')]({'id':0x0,'priority':0x0,'app':_0x62b1('0xa5'),'appdata':_0x2ec6cb[_0x62b1('0x3d')]+','+(_0x42bfbb[_0x62b1('0x78')][_0x62b1('0xa6')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x42bfbb);});}return respondWithRpcPromise(_0x62b1('0xa7'),_0x62b1('0xa8'),_0x42bfbb);})['then'](function(_0x2d6ec5){if(_0x2d6ec5){var _0x2393c3=0xc8;var _0x447fc0=_0x62b1('0xa9');logger[_0x62b1('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x447fc0,_0x2393c3,'entity\x20found');logger[_0x62b1('0xaa')](_0x62b1('0xab'),_0x447fc0,_0x2393c3,_0x62b1('0xac'),JSON[_0x62b1('0x27')](_0x2d6ec5));if(_0x42bfbb[_0x62b1('0x78')]['type']==='twilio'){return _0x2dd8ed[_0x62b1('0x2d')](_0x2393c3)[_0x62b1('0xad')](_0x62b1('0xae'),_0x62b1('0xaf'))[_0x62b1('0x3e')](_0x62b1('0xb0'));}else{return _0x2dd8ed[_0x62b1('0x2d')](_0x2393c3)['json'](_0x2d6ec5);}}})['catch'](handleError(_0x2dd8ed,null));};exports[_0x62b1('0xb1')]=function(_0x120801,_0x4bb3c5){var _0x2dda62=_0x120801[_0x62b1('0x5c')]['id'];var _0x21c126=_0x120801[_0x62b1('0x60')];var _0x50fd46=0xc8;var _0x370588=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x62b1('0xb2')][_0x62b1('0xb3')][_0x62b1('0xb4')]['READ_COMMITTED']},function(_0x164c44){return db[_0x62b1('0x43')][_0x62b1('0x6c')]({'where':{'id':_0x2dda62},'transaction':_0x164c44})[_0x62b1('0x23')](function(_0x50c1c6){if(_0x50c1c6){return db[_0x62b1('0x75')]['destroy']({'where':{'SmsAccountId':_0x2dda62},'transaction':_0x164c44})[_0x62b1('0x23')](function(){var _0x19d9f0=_['map'](_0x21c126,function(_0x128fad){_0x128fad[_0x62b1('0x69')]=_0x2dda62;return _0x128fad;});return db[_0x62b1('0x75')][_0x62b1('0xb5')](_0x19d9f0,{'transaction':_0x164c44});});}else{_0x50fd46=0x194;_0x370588=[];}});})[_0x62b1('0x23')](function(){if(_0x50fd46!==0x194){return db[_0x62b1('0x75')][_0x62b1('0xb6')]({'where':{'SmsAccountId':_0x2dda62},'order':_0x62b1('0xb7')})[_0x62b1('0x23')](function(_0x1ec7d3){_0x370588=_0x1ec7d3;});}})[_0x62b1('0x2b')](function(_0x41df3f){_0x50fd46=0x1f4;logger[_0x62b1('0x28')](_0x41df3f[_0x62b1('0x3c')]);if(_0x41df3f[_0x62b1('0x3d')]){delete _0x41df3f[_0x62b1('0x3d')];}_0x370588=_0x41df3f;})['finally'](function(){if(_0x370588===null){_0x4bb3c5[_0x62b1('0x2c')](_0x50fd46);}else{if(_0x50fd46===0x1f4){_0x4bb3c5[_0x62b1('0x2d')](_0x50fd46)[_0x62b1('0x3e')](_0x370588);}else{_0x4bb3c5[_0x62b1('0x2d')](_0x50fd46)[_0x62b1('0x2f')](_0x370588);}}});};exports['getApplications']=function(_0x5f0e0b,_0x41481f,_0x3cd048){var _0x1d2c60={};var _0x17081c={};var _0x7b9fd5;var _0x2f1b32;return db['SmsAccount'][_0x62b1('0x6c')]({'where':{'id':_0x5f0e0b[_0x62b1('0x5c')]['id']}})[_0x62b1('0x23')](handleEntityNotFound(_0x41481f,null))[_0x62b1('0x23')](function(_0xc3a79c){if(_0xc3a79c){_0x7b9fd5=_0xc3a79c;_0x17081c['model']=_[_0x62b1('0x48')](db[_0x62b1('0x75')][_0x62b1('0x44')]);_0x17081c[_0x62b1('0x4b')]=_['keys'](_0x5f0e0b['query']);_0x17081c[_0x62b1('0x49')]=_[_0x62b1('0x4a')](_0x17081c[_0x62b1('0x47')],_0x17081c[_0x62b1('0x4b')]);_0x1d2c60[_0x62b1('0x4d')]=_[_0x62b1('0x4a')](_0x17081c[_0x62b1('0x47')],qs['fields'](_0x5f0e0b[_0x62b1('0x4b')][_0x62b1('0x4c')]));_0x1d2c60['attributes']=_0x1d2c60[_0x62b1('0x4d')][_0x62b1('0x5d')]?_0x1d2c60[_0x62b1('0x4d')]:_0x17081c[_0x62b1('0x47')];_0x1d2c60[_0x62b1('0x50')]=qs['sort'](_0x5f0e0b['query'][_0x62b1('0x51')]);_0x1d2c60[_0x62b1('0x52')]=qs['filters'](_[_0x62b1('0x53')](_0x5f0e0b[_0x62b1('0x4b')],_0x17081c['filters']));if(_0x5f0e0b[_0x62b1('0x4b')][_0x62b1('0x56')]){_0x1d2c60[_0x62b1('0x52')]=_['merge'](_0x1d2c60[_0x62b1('0x52')],{'$or':_[_0x62b1('0x42')](_0x1d2c60[_0x62b1('0x4d')],function(_0x239808){var _0x527baa={};_0x527baa[_0x239808]={'$like':'%'+_0x5f0e0b[_0x62b1('0x4b')][_0x62b1('0x56')]+'%'};return _0x527baa;})});}_0x1d2c60=_[_0x62b1('0x54')]({},_0x1d2c60,_0x5f0e0b[_0x62b1('0x57')]);return _0x7b9fd5['getApplications'](_0x1d2c60);}})[_0x62b1('0x23')](function(_0x1444cc){if(_0x1444cc){_0x2f1b32=_0x1444cc[_0x62b1('0x5d')];if(!_0x5f0e0b[_0x62b1('0x4b')][_0x62b1('0x4e')](_0x62b1('0x4f'))){_0x1d2c60['limit']=qs['limit'](_0x5f0e0b[_0x62b1('0x4b')][_0x62b1('0x32')]);_0x1d2c60[_0x62b1('0x30')]=qs['offset'](_0x5f0e0b[_0x62b1('0x4b')]['offset']);}return _0x7b9fd5[_0x62b1('0xb8')](_0x1d2c60);}})[_0x62b1('0x23')](function(_0x38ccbe){if(_0x38ccbe){return _0x38ccbe?{'count':_0x2f1b32,'rows':_0x38ccbe}:null;}})['then'](respondWithResult(_0x41481f,null))[_0x62b1('0x2b')](handleError(_0x41481f,null));};exports[_0x62b1('0xb9')]=function(_0x149746,_0x3b7ffe,_0x16d7ee){var _0x4d9a7b={'raw':![],'where':{}};var _0x4ee4c6={};var _0x1bfe3d={'count':0x0,'rows':[]};return db[_0x62b1('0x43')]['findOne']({'where':{'id':_0x149746['params']['id']}})[_0x62b1('0x23')](handleEntityNotFound(_0x3b7ffe,null))[_0x62b1('0x23')](function(_0x41c486){if(_0x41c486){_0x4ee4c6[_0x62b1('0x47')]=_['keys'](db['SmsInteraction'][_0x62b1('0x44')]);_0x4ee4c6[_0x62b1('0x4b')]=_[_0x62b1('0x48')](_0x149746['query']);_0x4ee4c6[_0x62b1('0x49')]=_[_0x62b1('0x4a')](_0x4ee4c6[_0x62b1('0x47')],_0x4ee4c6['query']);_0x4d9a7b['attributes']=_['intersection'](_0x4ee4c6['model'],qs[_0x62b1('0x4c')](_0x149746[_0x62b1('0x4b')][_0x62b1('0x4c')]));_0x4d9a7b[_0x62b1('0x4d')]=_0x4d9a7b[_0x62b1('0x4d')]['length']?_0x4d9a7b[_0x62b1('0x4d')]:_0x4ee4c6[_0x62b1('0x47')];if(!_0x149746[_0x62b1('0x4b')][_0x62b1('0x4e')](_0x62b1('0x4f'))){_0x4d9a7b[_0x62b1('0x32')]=qs[_0x62b1('0x32')](_0x149746['query'][_0x62b1('0x32')]);_0x4d9a7b[_0x62b1('0x30')]=qs[_0x62b1('0x30')](_0x149746['query'][_0x62b1('0x30')]);}_0x4d9a7b['order']=qs['sort'](_0x149746[_0x62b1('0x4b')][_0x62b1('0x51')]);_0x4d9a7b[_0x62b1('0x52')]=qs[_0x62b1('0x49')](_['pick'](_0x149746['query'],_0x4ee4c6[_0x62b1('0x49')]));_0x4d9a7b[_0x62b1('0x52')][_0x62b1('0x69')]=_0x41c486['id'];if(_0x149746[_0x62b1('0x4b')][_0x62b1('0x56')]){_0x4d9a7b[_0x62b1('0x52')]=_['merge'](_0x4d9a7b[_0x62b1('0x52')],{'$or':_[_0x62b1('0x42')](_0x4d9a7b[_0x62b1('0x4d')],function(_0x26ef35){var _0x577a9f={};_0x577a9f[_0x26ef35]={'$like':'%'+_0x149746[_0x62b1('0x4b')]['filter']+'%'};return _0x577a9f;})});}_0x4d9a7b=_[_0x62b1('0x54')]({},_0x4d9a7b,_0x149746[_0x62b1('0x57')]);return db[_0x62b1('0x99')][_0x62b1('0x33')]({'where':_0x4d9a7b['where']})[_0x62b1('0x23')](function(_0x5ef872){_0x1bfe3d[_0x62b1('0x33')]=_0x5ef872;if(_0x149746[_0x62b1('0x4b')][_0x62b1('0x58')]){_0x4d9a7b[_0x62b1('0x59')]=[{'model':db[_0x62b1('0x79')],'as':'Contact','required':![]},{'model':db[_0x62b1('0xa3')],'as':'Owner','attributes':['name',_0x62b1('0xba'),_0x62b1('0xbb')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x62b1('0x3d'),_0x62b1('0xbc')],'where':_0x149746[_0x62b1('0x4b')]['tag']?{'id':_0x149746[_0x62b1('0x4b')][_0x62b1('0xbd')]}:undefined,'required':_0x149746[_0x62b1('0x4b')][_0x62b1('0xbd')]?!![]:![]}];}return db['SmsInteraction'][_0x62b1('0x5a')](_0x4d9a7b);})[_0x62b1('0x23')](function(_0x13ff59){_0x1bfe3d[_0x62b1('0x6d')]=_0x13ff59;return _0x1bfe3d;});}})['then'](respondWithFilteredResult(_0x3b7ffe,_0x4d9a7b))[_0x62b1('0x2b')](handleError(_0x3b7ffe,null));};exports[_0x62b1('0x3e')]=function(_0x315a1f,_0x224895,_0x50a6ca){var _0x5508a7,_0x14ca2b,_0x3d691e;if(_['isNil'](_0x315a1f[_0x62b1('0x60')][_0x62b1('0x60')])||_0x315a1f[_0x62b1('0x60')]['body']===''){throw new db[(_0x62b1('0x8f'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x62b1('0x91')](_0x315a1f[_0x62b1('0x60')]['to'])){throw new db['Sequelize']['ValidationError'](_0x62b1('0xbe'));}_0x5508a7=_0x315a1f[_0x62b1('0x60')]['to'];return db[_0x62b1('0x43')]['find']({'where':{'id':_0x315a1f[_0x62b1('0x5c')]['id']},'include':[{'model':db[_0x62b1('0x94')],'as':_0x62b1('0xbf'),'include':[{'model':db[_0x62b1('0x79')],'as':_0x62b1('0x98'),'where':{'mobile':_0x5508a7},'limit':0x1,'order':[[_0x62b1('0x7c'),_0x62b1('0x96')]]}]}]})[_0x62b1('0x23')](handleEntityNotFound(_0x224895,null))[_0x62b1('0x23')](function(_0x59a1a3){if(_0x59a1a3&&_0x59a1a3[_0x62b1('0xbf')]){_0x14ca2b=_0x59a1a3[_0x62b1('0x39')]({'plain':!![]});if(_0x14ca2b[_0x62b1('0xbf')]&&_0x14ca2b['List']['Contacts'][_0x62b1('0x5d')]){return _0x14ca2b[_0x62b1('0xbf')]['Contacts'][0x0];}return db[_0x62b1('0x79')][_0x62b1('0x5f')](_[_0x62b1('0x1c')](_0x315a1f[_0x62b1('0x60')],{'firstName':_0x5508a7,'mobile':_0x5508a7,'phone':_0x5508a7,'ListId':_0x14ca2b[_0x62b1('0x95')]}));}})[_0x62b1('0x23')](handleEntityNotFound(_0x224895,null))[_0x62b1('0x23')](function(_0x52cd0c){if(_0x52cd0c){_0x3d691e=_0x52cd0c;return db['SmsInteraction'][_0x62b1('0x5e')]({'where':{'ContactId':_0x3d691e['id'],'closed':![],'SmsAccountId':_0x14ca2b['id']}})[_0x62b1('0x23')](function(_0x4921cf){if(_0x4921cf){return[_0x4921cf,![]];}return db[_0x62b1('0x99')][_0x62b1('0x5f')]({'UserId':_0x315a1f['user']['id'],'ContactId':_0x3d691e['id'],'SmsAccountId':_0x14ca2b['id'],'phone':_0x5508a7,'firstMsgDirection':_0x62b1('0xc0'),'Messages':[_[_0x62b1('0x54')](_0x315a1f[_0x62b1('0x60')],{'read':![],'body':_0x315a1f[_0x62b1('0x60')][_0x62b1('0x60')],'phone':_0x5508a7,'SmsAccountId':_0x14ca2b['id'],'UserId':_0x315a1f[_0x62b1('0x63')]['id'],'ContactId':_0x3d691e['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x62b1('0xc1')}]})['then'](function(_0x4f7086){return[_0x4f7086,!![]];});});}})[_0x62b1('0xc2')](function(_0x38a32a,_0x194feb){if(_0x194feb){return _0x38a32a;}return db['SmsMessage'][_0x62b1('0x5f')](_[_0x62b1('0x54')](_0x315a1f[_0x62b1('0x60')],{'read':![],'body':_0x315a1f[_0x62b1('0x60')]['body'],'phone':_0x5508a7,'SmsAccountId':_0x14ca2b['id'],'SmsInteractionId':_0x38a32a['id'],'UserId':_0x315a1f[_0x62b1('0x63')]['id'],'ContactId':_0x3d691e['id']}))[_0x62b1('0x23')](function(_0x555e7c){_0x38a32a[_0x62b1('0xc3')][_0x62b1('0xc1')]=[];_0x38a32a[_0x62b1('0xc3')]['Messages'][_0x62b1('0x9d')](_0x555e7c['dataValues']);return _0x38a32a;});})['then'](respondWithResult(_0x224895,null))[_0x62b1('0x2b')](handleError(_0x224895,null));};exports[_0x62b1('0x2d')]=function(_0xdeaa88,_0x4a14ae,_0x5da96b){if(_0xdeaa88[_0x62b1('0x60')]['id']){delete _0xdeaa88[_0x62b1('0x60')]['id'];}var _0x41bc9e,_0x17c4bf,_0x2a4920;return db[_0x62b1('0x43')][_0x62b1('0x5e')]({'where':{'id':_0xdeaa88[_0x62b1('0x5c')]['id']}})[_0x62b1('0x23')](handleEntityNotFound(_0x4a14ae,null))['then'](function(_0x146002){if(_0x146002){_0x2a4920=_0x146002;logger['debug'](_0x62b1('0xc4'),_0x62b1('0x2d'),_0x62b1('0xc5'),_0x146002[_0x62b1('0x55')],util['inspect'](_0xdeaa88['body'],{'showHidden':![],'depth':null}));switch(_0x146002[_0x62b1('0x55')]){case _0x62b1('0xc6'):if(_0xdeaa88['body']['skebby_dispatch_id']&&_0xdeaa88[_0x62b1('0x60')]['status']){_0x17c4bf=_0xdeaa88[_0x62b1('0x60')][_0x62b1('0x2d')];return db[_0x62b1('0x9f')][_0x62b1('0x5e')]({'where':{'messageId':_0xdeaa88[_0x62b1('0x60')][_0x62b1('0xc7')]}});}break;case'connectel':if(_0xdeaa88[_0x62b1('0x60')][_0x62b1('0xc8')]&&_0xdeaa88[_0x62b1('0x60')][_0x62b1('0xc9')]){_0x17c4bf=_0xdeaa88[_0x62b1('0x60')]['statusInt'];return db[_0x62b1('0x9f')]['find']({'where':{'messageId':_0xdeaa88[_0x62b1('0x60')][_0x62b1('0xc8')]}});}break;case _0x62b1('0xca'):if(_0xdeaa88['body'][_0x62b1('0xcb')]&&_0xdeaa88['body'][_0x62b1('0xcc')]){_0x17c4bf=_0xdeaa88[_0x62b1('0x60')]['status_code'];return db[_0x62b1('0x9f')][_0x62b1('0x5e')]({'where':{'messageId':_0xdeaa88['body'][_0x62b1('0xcb')]}});}break;case _0x62b1('0x87'):var _0x425962=_0xdeaa88[_0x62b1('0x60')]['results'][0x0];if(_0x425962['messageId']&&_0x425962[_0x62b1('0x2d')][_0x62b1('0xcd')]===_0x62b1('0xce')){_0x17c4bf=_0x425962[_0x62b1('0x2d')]['groupName'];return db[_0x62b1('0x9f')][_0x62b1('0x5e')]({'where':{'messageId':_0x425962['messageId']}});}break;case _0x62b1('0x8a'):if(_0xdeaa88['body'][_0x62b1('0x86')]&&_0xdeaa88[_0x62b1('0x60')]['status']){_0x17c4bf=_0xdeaa88['body'][_0x62b1('0x2d')];return db[_0x62b1('0x9f')]['find']({'where':{'messageId':_0xdeaa88[_0x62b1('0x60')][_0x62b1('0x86')]}});}break;case'bandwidth':if(_0xdeaa88[_0x62b1('0x60')][0x0][_0x62b1('0x29')]['id']){_0x17c4bf=_0xdeaa88[_0x62b1('0x60')][0x0][_0x62b1('0x55')];return db['SmsMessage']['find']({'where':{'messageId':_0xdeaa88[_0x62b1('0x60')][0x0][_0x62b1('0x29')]['id']}});}break;case _0x62b1('0xcf'):if(_0xdeaa88[_0x62b1('0x60')][_0x62b1('0xd0')]&&_0xdeaa88[_0x62b1('0x60')][_0x62b1('0x2d')]){_0x17c4bf=_0xdeaa88[_0x62b1('0x60')][_0x62b1('0x2d')];return db['SmsMessage'][_0x62b1('0x5e')]({'where':{'messageId':_0xdeaa88[_0x62b1('0x60')][_0x62b1('0xd0')]}});}break;}}})[_0x62b1('0x23')](handleEntityNotFound(_0x4a14ae,null))['then'](function(_0x55252c){if(_0x55252c){_0x41bc9e=_0x55252c;switch(_0x2a4920[_0x62b1('0x55')]){case _0x62b1('0xc6'):if(_0x17c4bf==='DELIVERED'){return _0x41bc9e['update']({'read':!![]});}else{logger[_0x62b1('0x28')](_0x62b1('0xc4'),_0x62b1('0x2d'),'skebby',util[_0x62b1('0xd1')](_0xdeaa88[_0x62b1('0x60')],{'showHidden':![],'depth':null}));}break;case _0x62b1('0x84'):if(_0x17c4bf==='1'){return _0x41bc9e[_0x62b1('0x67')]({'read':!![]});}else{logger[_0x62b1('0x28')](_0x62b1('0xc4'),_0x62b1('0x2d'),_0x62b1('0xc6'),util[_0x62b1('0xd1')](_0xdeaa88[_0x62b1('0x60')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0xdeaa88['body'][_0x62b1('0xd2')]&&_0x17c4bf>=0xc8&&_0x17c4bf<=0xce){return _0x41bc9e[_0x62b1('0x67')]({'read':!![]});}else{logger[_0x62b1('0x28')](_0x62b1('0xc4'),_0x62b1('0x2d'),_0x62b1('0xca'),util[_0x62b1('0xd1')](_0xdeaa88[_0x62b1('0x60')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x147a27=_0xdeaa88[_0x62b1('0x60')][_0x62b1('0x88')][0x0];if(_0x147a27[_0x62b1('0x2d')]['groupName']===_0x62b1('0xce')){return _0x41bc9e[_0x62b1('0x67')]({'read':!![]});}else{logger[_0x62b1('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x62b1('0x2d'),'infobip',util[_0x62b1('0xd1')](_0xdeaa88[_0x62b1('0x60')],{'showHidden':![],'depth':null}));}break;case _0x62b1('0x8a'):if(_0x17c4bf==_0x62b1('0xd3')||_0x17c4bf=='RECEIVED_BY_RECIPIENT'){return _0x41bc9e[_0x62b1('0x67')]({'read':!![]});}else{logger[_0x62b1('0x28')](_0x62b1('0xc4'),_0x62b1('0x2d'),_0x62b1('0x8a'),util['inspect'](_0xdeaa88[_0x62b1('0x60')],{'showHidden':![],'depth':null}));}break;case _0x62b1('0x8d'):if(_0x17c4bf==_0x62b1('0xd4')){return _0x41bc9e[_0x62b1('0x67')]({'read':!![]});}else{logger[_0x62b1('0x28')](_0x62b1('0xc4'),_0x62b1('0x2d'),_0x62b1('0x8d'),util[_0x62b1('0xd1')](_0xdeaa88['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x17c4bf==='DELIVRD'||_0x17c4bf===_0x62b1('0xd5')){return _0x41bc9e[_0x62b1('0x67')]({'read':!![]});}else{logger[_0x62b1('0x28')](_0x62b1('0xc4'),_0x62b1('0x2d'),_0x62b1('0xcf'),util['inspect'](_0xdeaa88[_0x62b1('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x41bc9e;}})[_0x62b1('0x23')](respondWithResult(_0x4a14ae,null))['catch'](handleError(_0x4a14ae,null));};exports['statusGet']=function(_0x389f40,_0x42a540,_0x225ad5){var _0x2c24a6,_0x2ff9b0,_0x50ae27;return db[_0x62b1('0x43')][_0x62b1('0x5e')]({'where':{'id':_0x389f40['params']['id']}})[_0x62b1('0x23')](handleEntityNotFound(_0x42a540,null))[_0x62b1('0x23')](function(_0x532b58){if(_0x532b58){_0x50ae27=_0x532b58;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x62b1('0xc5'),_0x532b58[_0x62b1('0x55')],util['inspect'](_0x389f40[_0x62b1('0x4b')],{'showHidden':![],'depth':null}));switch(_0x532b58['type']){case'csc':if(_0x389f40[_0x62b1('0x4b')]['message-id']&&_0x389f40[_0x62b1('0x4b')]['state']){_0x2ff9b0=_0x389f40[_0x62b1('0x4b')]['state'];return db[_0x62b1('0x9f')]['find']({'where':{'messageId':_0x389f40[_0x62b1('0x4b')][_0x62b1('0xd6')]}});}break;}}})[_0x62b1('0x23')](handleEntityNotFound(_0x42a540,null))[_0x62b1('0x23')](function(_0x4e1045){if(_0x4e1045){_0x2c24a6=_0x4e1045;switch(_0x50ae27[_0x62b1('0x55')]){case'csc':if(_0x2ff9b0==='2'||_0x2ff9b0==='6'){return _0x2c24a6['update']({'read':!![]});}else{logger[_0x62b1('0x28')](_0x62b1('0xc4'),_0x62b1('0x2d'),_0x62b1('0x89'),util['inspect'](_0x389f40[_0x62b1('0x4b')],{'showHidden':![],'depth':null}));};break;}return _0x2c24a6;}})[_0x62b1('0x23')](respondWithResult(_0x42a540,null))[_0x62b1('0x2b')](handleError(_0x42a540,null));};exports[_0x62b1('0xd7')]=function(_0x10d15a,_0x1c1d95,_0x5e136d){return db[_0x62b1('0x43')][_0x62b1('0x5e')]({'where':{'id':_0x10d15a['params']['id']}})[_0x62b1('0x23')](handleEntityNotFound(_0x1c1d95,null))[_0x62b1('0x23')](function(_0x16521e){if(_0x16521e){return _0x16521e[_0x62b1('0xd7')](_0x10d15a[_0x62b1('0x60')][_0x62b1('0x6f')],_[_0x62b1('0x97')](_0x10d15a[_0x62b1('0x60')],['ids','id'])||{})[_0x62b1('0xc2')](function(_0x2d51d9){for(var _0x1a88c3=0x0;_0x1a88c3<_0x10d15a['body'][_0x62b1('0x6f')][_0x62b1('0x5d')];_0x1a88c3+=0x1){socket[_0x62b1('0xd8')](_0x62b1('0xd9'),{'UserId':Number(_0x10d15a[_0x62b1('0x60')]['ids'][_0x1a88c3]),'SmsAccountId':Number(_0x10d15a[_0x62b1('0x5c')]['id'])});}return _0x2d51d9;});}})[_0x62b1('0x23')](respondWithResult(_0x1c1d95,null))[_0x62b1('0x2b')](handleError(_0x1c1d95,null));};exports[_0x62b1('0xda')]=function(_0x24e413,_0xd47a8b,_0x47d80b){return db['SmsAccount']['find']({'where':{'id':_0x24e413[_0x62b1('0x5c')]['id']}})[_0x62b1('0x23')](handleEntityNotFound(_0xd47a8b,null))['then'](function(_0x24b111){if(_0x24b111){return _0x24b111[_0x62b1('0xda')](_0x24e413['query']['ids'])['then'](function(){if(_[_0x62b1('0xdb')](_0x24e413[_0x62b1('0x4b')][_0x62b1('0x6f')])){for(var _0x4f7f62=0x0;_0x4f7f62<_0x24e413[_0x62b1('0x4b')][_0x62b1('0x6f')][_0x62b1('0x5d')];_0x4f7f62+=0x1){socket[_0x62b1('0xd8')](_0x62b1('0xdc'),{'UserId':Number(_0x24e413[_0x62b1('0x4b')][_0x62b1('0x6f')][_0x4f7f62]),'SmsAccountId':Number(_0x24e413[_0x62b1('0x5c')]['id'])});}}else{socket[_0x62b1('0xd8')](_0x62b1('0xdc'),{'UserId':Number(_0x24e413[_0x62b1('0x4b')][_0x62b1('0x6f')]),'SmsAccountId':Number(_0x24e413[_0x62b1('0x5c')]['id'])});}});}})[_0x62b1('0x23')](respondWithStatusCode(_0xd47a8b,null))[_0x62b1('0x2b')](handleError(_0xd47a8b,null));};exports['getAgents']=function(_0xf8583c,_0x51c9c0,_0x8f44ef){var _0x18f4b6={};var _0x2e241c={};var _0x2321f0;var _0x41df46;return db[_0x62b1('0x43')][_0x62b1('0x6c')]({'where':{'id':_0xf8583c[_0x62b1('0x5c')]['id']}})[_0x62b1('0x23')](handleEntityNotFound(_0x51c9c0,null))[_0x62b1('0x23')](function(_0x1e9b4f){if(_0x1e9b4f){_0x2321f0=_0x1e9b4f;_0x2e241c['model']=_[_0x62b1('0x48')](db[_0x62b1('0xa3')][_0x62b1('0x44')]);_0x2e241c[_0x62b1('0x4b')]=_['keys'](_0xf8583c[_0x62b1('0x4b')]);_0x2e241c['filters']=_[_0x62b1('0x4a')](_0x2e241c[_0x62b1('0x47')],_0x2e241c['query']);_0x18f4b6[_0x62b1('0x4d')]=_['intersection'](_0x2e241c[_0x62b1('0x47')],qs[_0x62b1('0x4c')](_0xf8583c['query']['fields']));_0x18f4b6[_0x62b1('0x4d')]=_0x18f4b6[_0x62b1('0x4d')][_0x62b1('0x5d')]?_0x18f4b6[_0x62b1('0x4d')]:_0x2e241c[_0x62b1('0x47')];_0x18f4b6['order']=qs[_0x62b1('0x51')](_0xf8583c[_0x62b1('0x4b')]['sort']);_0x18f4b6[_0x62b1('0x52')]=qs['filters'](_[_0x62b1('0x53')](_0xf8583c[_0x62b1('0x4b')],_0x2e241c[_0x62b1('0x49')]));if(_0xf8583c['query'][_0x62b1('0x56')]){_0x18f4b6[_0x62b1('0x52')]=_[_0x62b1('0x54')](_0x18f4b6['where'],{'$or':_['map'](_0x18f4b6['attributes'],function(_0x47a0b5){var _0x351ebc={};_0x351ebc[_0x47a0b5]={'$like':'%'+_0xf8583c[_0x62b1('0x4b')][_0x62b1('0x56')]+'%'};return _0x351ebc;})});}_0x18f4b6=_[_0x62b1('0x54')]({},_0x18f4b6,_0xf8583c['options']);return _0x2321f0[_0x62b1('0xdd')](_0x18f4b6);}})[_0x62b1('0x23')](function(_0x57a281){if(_0x57a281){_0x41df46=_0x57a281[_0x62b1('0x5d')];if(!_0xf8583c[_0x62b1('0x4b')][_0x62b1('0x4e')](_0x62b1('0x4f'))){_0x18f4b6['limit']=qs['limit'](_0xf8583c[_0x62b1('0x4b')][_0x62b1('0x32')]);_0x18f4b6[_0x62b1('0x30')]=qs[_0x62b1('0x30')](_0xf8583c['query'][_0x62b1('0x30')]);}return _0x2321f0[_0x62b1('0xdd')](_0x18f4b6);}})[_0x62b1('0x23')](function(_0x3794fa){if(_0x3794fa){return _0x3794fa?{'count':_0x41df46,'rows':_0x3794fa}:null;}})[_0x62b1('0x23')](respondWithResult(_0x51c9c0,null))[_0x62b1('0x2b')](handleError(_0x51c9c0,null));}; \ No newline at end of file +var _0x5732=['SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','Content-Range','reject','destroy','get','sendStatus','stack','name','send','index','Pause','map','SmsAccount','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','mandatoryDispositionPause','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','order','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','notify','sms','Applications','applications','orderBy','priority','asc','account','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','mobile','twilio','from','From','MessageSid','sender','connectel','messageId','message_id','plivo','Text','infobip','results','text','csc','originatingAddress','clickatell','replyMessageId','bandwidth','refid','ValidationError','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','omit','contact','SmsInteraction','interaction','created','autoclose','push','*,*,*,*','SmsMessage','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','bulkCreate','getApplications','getInteractions','Contact','User','Owner','internal','Tags','color','tag','List','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','groupName','DELIVERED','intelepeer','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','statusGet','message-id','state','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4e4f0e,_0x1c3892){var _0x1a7219=function(_0x3821ad){while(--_0x3821ad){_0x4e4f0e['push'](_0x4e4f0e['shift']());}};_0x1a7219(++_0x1c3892);}(_0x5732,0x199));var _0x2573=function(_0x3b33b8,_0xc87a01){_0x3b33b8=_0x3b33b8-0x0;var _0xea225f=_0x5732[_0x3b33b8];return _0xea225f;};'use strict';var emlformat=require(_0x2573('0x0'));var rimraf=require(_0x2573('0x1'));var zipdir=require(_0x2573('0x2'));var jsonpatch=require(_0x2573('0x3'));var rp=require(_0x2573('0x4'));var moment=require(_0x2573('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2573('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x2573('0x7'));var ejs=require(_0x2573('0x8'));var fs=require('fs');var fs_extra=require(_0x2573('0x9'));var _=require(_0x2573('0xa'));var squel=require(_0x2573('0xb'));var crypto=require('crypto');var jsforce=require(_0x2573('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2573('0x7'));var querystring=require(_0x2573('0xd'));var Papa=require(_0x2573('0xe'));var Redis=require(_0x2573('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2573('0x10'));var as=require(_0x2573('0x11'));var hardwareService=require(_0x2573('0x12'));var logger=require('../../config/logger')(_0x2573('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2573('0x14'));var db=require(_0x2573('0x15'))['db'];config['redis']=_[_0x2573('0x16')](config[_0x2573('0x17')],{'host':_0x2573('0x18'),'port':0x18eb});var socket=require(_0x2573('0x19'))(new Redis(config[_0x2573('0x17')]));require(_0x2573('0x1a'))[_0x2573('0x1b')](socket);var jayson=require(_0x2573('0x1c'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x5ee6e7,_0x44db15,_0x5e3cac,_0x5c2c13){return new BPromise(function(_0x4b5a22,_0x166683){var _0x34681a=_0x5c2c13||client;return _0x34681a[_0x2573('0x1d')](_0x5ee6e7,_0x5e3cac)[_0x2573('0x1e')](function(_0x24cc7e){logger[_0x2573('0x1f')](_0x2573('0x20'),_0x44db15,_0x2573('0x21'));logger[_0x2573('0x22')](_0x2573('0x23'),_0x44db15,'request\x20sent',JSON[_0x2573('0x24')](_0x24cc7e));if(_0x24cc7e[_0x2573('0x25')]){if(_0x24cc7e['error'][_0x2573('0x26')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x44db15,_0x24cc7e[_0x2573('0x25')]['message']);return _0x166683(_0x24cc7e[_0x2573('0x25')][_0x2573('0x27')]);}logger['error'](_0x2573('0x20'),_0x44db15,_0x24cc7e[_0x2573('0x25')]['message']);return _0x4b5a22(_0x24cc7e[_0x2573('0x25')][_0x2573('0x27')]);}else{logger[_0x2573('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x44db15,_0x2573('0x21'));_0x4b5a22(_0x24cc7e[_0x2573('0x28')]['message']);}})[_0x2573('0x29')](function(_0x112a87){logger[_0x2573('0x25')](_0x2573('0x20'),_0x44db15,_0x112a87);_0x166683(_0x112a87);});});}function respondWithStatusCode(_0x1d6106,_0x4a0133){_0x4a0133=_0x4a0133||0xcc;return function(_0x40d2e5){if(_0x40d2e5){return _0x1d6106['sendStatus'](_0x4a0133);}return _0x1d6106[_0x2573('0x2a')](_0x4a0133)['end']();};}function respondWithResult(_0x2fc723,_0x320562){_0x320562=_0x320562||0xc8;return function(_0x2d1a3d){if(_0x2d1a3d){return _0x2fc723['status'](_0x320562)[_0x2573('0x2b')](_0x2d1a3d);}};}function respondWithFilteredResult(_0x42317b,_0x15384e){return function(_0x1c3244){if(_0x1c3244){var _0x1bace0=typeof _0x15384e[_0x2573('0x2c')]===_0x2573('0x2d')&&typeof _0x15384e['limit']==='undefined';var _0x372b48=_0x1c3244['count'];var _0x4828cf=_0x1bace0?0x0:_0x15384e[_0x2573('0x2c')];var _0x58db49=_0x1bace0?_0x1c3244['count']:_0x15384e[_0x2573('0x2c')]+_0x15384e['limit'];var _0x3e1fea;if(_0x58db49>=_0x372b48){_0x58db49=_0x372b48;_0x3e1fea=0xc8;}else{_0x3e1fea=0xce;}_0x42317b[_0x2573('0x2a')](_0x3e1fea);return _0x42317b['set'](_0x2573('0x2e'),_0x4828cf+'-'+_0x58db49+'/'+_0x372b48)[_0x2573('0x2b')](_0x1c3244);}return null;};}function patchUpdates(_0x3fed90){return function(_0x3e7105){try{jsonpatch['apply'](_0x3e7105,_0x3fed90,!![]);}catch(_0x555af6){return BPromise[_0x2573('0x2f')](_0x555af6);}return _0x3e7105['save']();};}function saveUpdates(_0x3934a9,_0x28dd9f){return function(_0x569b65){if(_0x569b65){return _0x569b65['update'](_0x3934a9)[_0x2573('0x1e')](function(_0x581187){return _0x581187;});}return null;};}function removeEntity(_0x454058,_0x2a351f){return function(_0x3fee43){if(_0x3fee43){return _0x3fee43[_0x2573('0x30')]()[_0x2573('0x1e')](function(){var _0x485216=_0x3fee43[_0x2573('0x31')]({'plain':!![]});var _0x1413ab='SmsAccounts';return db['UserProfileResource'][_0x2573('0x30')]({'where':{'type':_0x1413ab,'resourceId':_0x485216['id']}})[_0x2573('0x1e')](function(){return _0x3fee43;});})[_0x2573('0x1e')](function(){_0x454058[_0x2573('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c3dd8,_0x542347){return function(_0x45bf71){if(!_0x45bf71){_0x5c3dd8[_0x2573('0x32')](0x194);}return _0x45bf71;};}function handleError(_0x32f50a,_0x4049ad){_0x4049ad=_0x4049ad||0x1f4;return function(_0x5214cf){logger[_0x2573('0x25')](_0x5214cf[_0x2573('0x33')]);if(_0x5214cf[_0x2573('0x34')]){delete _0x5214cf['name'];}_0x32f50a[_0x2573('0x2a')](_0x4049ad)[_0x2573('0x35')](_0x5214cf);};}exports[_0x2573('0x36')]=function(_0x572e1a,_0x4f4b70){var _0x58ff7b={'include':[{'model':db[_0x2573('0x37')],'as':'mandatoryDispositionPause'}]},_0x25a494={},_0xb4707b={'count':0x0,'rows':[]};var _0x347f8a=_[_0x2573('0x38')](db[_0x2573('0x39')]['rawAttributes'],function(_0x4cb5d4){return{'name':_0x4cb5d4['fieldName'],'type':_0x4cb5d4['type'][_0x2573('0x3a')]};});_0x25a494[_0x2573('0x3b')]=_[_0x2573('0x38')](_0x347f8a,_0x2573('0x34'));_0x25a494[_0x2573('0x3c')]=_[_0x2573('0x3d')](_0x572e1a[_0x2573('0x3c')]);_0x25a494[_0x2573('0x3e')]=_[_0x2573('0x3f')](_0x25a494[_0x2573('0x3b')],_0x25a494[_0x2573('0x3c')]);_0x58ff7b[_0x2573('0x40')]=_[_0x2573('0x3f')](_0x25a494[_0x2573('0x3b')],qs[_0x2573('0x41')](_0x572e1a[_0x2573('0x3c')][_0x2573('0x41')]));_0x58ff7b[_0x2573('0x40')]=_0x58ff7b[_0x2573('0x40')][_0x2573('0x42')]?_0x58ff7b[_0x2573('0x40')]:_0x25a494['model'];if(!_0x572e1a[_0x2573('0x3c')][_0x2573('0x43')]('nolimit')){_0x58ff7b[_0x2573('0x44')]=qs[_0x2573('0x44')](_0x572e1a[_0x2573('0x3c')]['limit']);_0x58ff7b[_0x2573('0x2c')]=qs[_0x2573('0x2c')](_0x572e1a[_0x2573('0x3c')][_0x2573('0x2c')]);}_0x58ff7b['order']=qs[_0x2573('0x45')](_0x572e1a['query']['sort']);_0x58ff7b[_0x2573('0x46')]=qs['filters'](_[_0x2573('0x47')](_0x572e1a[_0x2573('0x3c')],_0x25a494[_0x2573('0x3e')]),_0x347f8a);if(_0x572e1a[_0x2573('0x3c')][_0x2573('0x48')]){_0x58ff7b['where']=_[_0x2573('0x49')](_0x58ff7b[_0x2573('0x46')],{'$or':_[_0x2573('0x38')](_0x347f8a,function(_0x70d5d8){if(_0x70d5d8[_0x2573('0x4a')]!==_0x2573('0x4b')){var _0x36bddf={};_0x36bddf[_0x70d5d8['name']]={'$like':'%'+_0x572e1a[_0x2573('0x3c')]['filter']+'%'};return _0x36bddf;}})});}_0x58ff7b=_['merge']({},_0x58ff7b,_0x572e1a[_0x2573('0x4c')]);var _0x48c72a={'where':_0x58ff7b[_0x2573('0x46')]};return db[_0x2573('0x39')][_0x2573('0x4d')](_0x48c72a)[_0x2573('0x1e')](function(_0x55bcb4){_0xb4707b[_0x2573('0x4d')]=_0x55bcb4;if(_0x572e1a[_0x2573('0x3c')][_0x2573('0x4e')]){_0x58ff7b[_0x2573('0x4f')]=[{'all':!![]}];}return db[_0x2573('0x39')][_0x2573('0x50')](_0x58ff7b);})[_0x2573('0x1e')](function(_0x540b48){_0xb4707b[_0x2573('0x51')]=_0x540b48;return _0xb4707b;})[_0x2573('0x1e')](respondWithFilteredResult(_0x4f4b70,_0x58ff7b))[_0x2573('0x29')](handleError(_0x4f4b70,null));};exports[_0x2573('0x52')]=function(_0x4f5d1f,_0x5ab61e){var _0x13c1b2={'raw':![],'where':{'id':_0x4f5d1f[_0x2573('0x53')]['id']},'include':[{'model':db[_0x2573('0x37')],'as':'mandatoryDispositionPause'}]},_0x3a031a={};_0x3a031a['model']=_[_0x2573('0x3d')](db[_0x2573('0x39')][_0x2573('0x54')]);_0x3a031a[_0x2573('0x3c')]=_[_0x2573('0x3d')](_0x4f5d1f[_0x2573('0x3c')]);_0x3a031a[_0x2573('0x3e')]=_[_0x2573('0x3f')](_0x3a031a[_0x2573('0x3b')],_0x3a031a['query']);_0x13c1b2[_0x2573('0x40')]=_['intersection'](_0x3a031a[_0x2573('0x3b')],qs[_0x2573('0x41')](_0x4f5d1f[_0x2573('0x3c')][_0x2573('0x41')]));_0x13c1b2[_0x2573('0x40')]=_0x13c1b2[_0x2573('0x40')]['length']?_0x13c1b2[_0x2573('0x40')]:_0x3a031a[_0x2573('0x3b')];if(_0x4f5d1f['query'][_0x2573('0x4e')]){_0x13c1b2[_0x2573('0x4f')]=[{'all':!![]}];}_0x13c1b2=_[_0x2573('0x49')]({},_0x13c1b2,_0x4f5d1f[_0x2573('0x4c')]);return db[_0x2573('0x39')]['find'](_0x13c1b2)[_0x2573('0x1e')](handleEntityNotFound(_0x5ab61e,null))['then'](respondWithResult(_0x5ab61e,null))[_0x2573('0x29')](handleError(_0x5ab61e,null));};exports[_0x2573('0x55')]=function(_0x2e3d0d,_0x2344b4){return db['SmsAccount']['create'](_0x2e3d0d[_0x2573('0x56')],{})[_0x2573('0x1e')](function(_0x310b73){var _0x2134d6=_0x2e3d0d[_0x2573('0x57')][_0x2573('0x31')]({'plain':!![]});if(!_0x2134d6)throw new Error(_0x2573('0x58'));if(_0x2134d6[_0x2573('0x59')]===_0x2573('0x57')){var _0x42249e=_0x310b73[_0x2573('0x31')]({'plain':!![]});var _0x1d2eec=_0x2573('0x5a');return db[_0x2573('0x5b')]['find']({'where':{'name':_0x1d2eec,'userProfileId':_0x2134d6[_0x2573('0x5c')]},'raw':!![]})[_0x2573('0x1e')](function(_0x2a4d31){if(_0x2a4d31&&_0x2a4d31[_0x2573('0x5d')]===0x0){return db[_0x2573('0x5e')][_0x2573('0x55')]({'name':_0x42249e[_0x2573('0x34')],'resourceId':_0x42249e['id'],'type':_0x2a4d31['name'],'sectionId':_0x2a4d31['id']},{})['then'](function(){return _0x310b73;});}else{return _0x310b73;}})[_0x2573('0x29')](function(_0x40ea6e){logger['error'](_0x2573('0x5f'),_0x40ea6e);throw _0x40ea6e;});}return _0x310b73;})['then'](respondWithResult(_0x2344b4,0xc9))[_0x2573('0x29')](handleError(_0x2344b4,null));};exports[_0x2573('0x60')]=function(_0x345508,_0x4d9710){if(_0x345508['body']['id']){delete _0x345508[_0x2573('0x56')]['id'];}return db[_0x2573('0x39')][_0x2573('0x61')]({'where':{'id':_0x345508[_0x2573('0x53')]['id']},'include':[{'model':db[_0x2573('0x37')],'as':_0x2573('0x62')}]})[_0x2573('0x1e')](handleEntityNotFound(_0x4d9710,null))[_0x2573('0x1e')](saveUpdates(_0x345508['body'],null))[_0x2573('0x1e')](respondWithResult(_0x4d9710,null))[_0x2573('0x29')](handleError(_0x4d9710,null));};exports[_0x2573('0x30')]=function(_0x593d0b,_0xf4ec49){return db[_0x2573('0x39')][_0x2573('0x61')]({'where':{'id':_0x593d0b[_0x2573('0x53')]['id']}})[_0x2573('0x1e')](handleEntityNotFound(_0xf4ec49,null))[_0x2573('0x1e')](removeEntity(_0xf4ec49,null))[_0x2573('0x29')](handleError(_0xf4ec49,null));};exports[_0x2573('0x63')]=function(_0x505712,_0x2519a4){return db[_0x2573('0x39')]['describe']()[_0x2573('0x1e')](respondWithResult(_0x2519a4,null))[_0x2573('0x29')](handleError(_0x2519a4,null));};exports[_0x2573('0x64')]=function(_0x1f05bd,_0x57c6a7,_0x1850a4){if(_0x1f05bd[_0x2573('0x56')]['id']){delete _0x1f05bd[_0x2573('0x56')]['id'];}return db[_0x2573('0x39')][_0x2573('0x61')]({'where':{'id':_0x1f05bd[_0x2573('0x53')]['id']}})[_0x2573('0x1e')](handleEntityNotFound(_0x57c6a7,null))[_0x2573('0x1e')](function(_0x4ba956){if(_0x4ba956){_0x1f05bd[_0x2573('0x56')][_0x2573('0x65')]=_0x4ba956['id'];return db[_0x2573('0x66')]['create'](_0x1f05bd[_0x2573('0x56')]);}})[_0x2573('0x1e')](respondWithResult(_0x57c6a7,null))['catch'](handleError(_0x57c6a7,null));};exports[_0x2573('0x67')]=function(_0x2e5a1a,_0x5b2a8d,_0x2ea268){var _0x57548d={'raw':![],'where':{}};var _0x4b2d71={};var _0x3e8288={'count':0x0,'rows':[]};return db[_0x2573('0x39')][_0x2573('0x68')]({'where':{'id':_0x2e5a1a['params']['id']}})[_0x2573('0x1e')](handleEntityNotFound(_0x5b2a8d,null))[_0x2573('0x1e')](function(_0x580531){if(_0x580531){_0x4b2d71[_0x2573('0x3b')]=_[_0x2573('0x3d')](db[_0x2573('0x66')][_0x2573('0x54')]);_0x4b2d71[_0x2573('0x3c')]=_['keys'](_0x2e5a1a[_0x2573('0x3c')]);_0x4b2d71['filters']=_[_0x2573('0x3f')](_0x4b2d71[_0x2573('0x3b')],_0x4b2d71[_0x2573('0x3c')]);_0x57548d['attributes']=_[_0x2573('0x3f')](_0x4b2d71[_0x2573('0x3b')],qs[_0x2573('0x41')](_0x2e5a1a[_0x2573('0x3c')]['fields']));_0x57548d[_0x2573('0x40')]=_0x57548d[_0x2573('0x40')]['length']?_0x57548d[_0x2573('0x40')]:_0x4b2d71['model'];if(!_0x2e5a1a[_0x2573('0x3c')]['hasOwnProperty'](_0x2573('0x69'))){_0x57548d['limit']=qs[_0x2573('0x44')](_0x2e5a1a[_0x2573('0x3c')]['limit']);_0x57548d[_0x2573('0x2c')]=qs[_0x2573('0x2c')](_0x2e5a1a[_0x2573('0x3c')][_0x2573('0x2c')]);}_0x57548d[_0x2573('0x6a')]=qs[_0x2573('0x45')](_0x2e5a1a['query'][_0x2573('0x45')]);_0x57548d['where']=qs[_0x2573('0x3e')](_[_0x2573('0x47')](_0x2e5a1a['query'],_0x4b2d71[_0x2573('0x3e')]));_0x57548d['where'][_0x2573('0x65')]=_0x580531['id'];if(_0x2e5a1a['query'][_0x2573('0x48')]){_0x57548d[_0x2573('0x46')]=_['merge'](_0x57548d[_0x2573('0x46')],{'$or':_[_0x2573('0x38')](_0x57548d[_0x2573('0x40')],function(_0x3e9bee){var _0x12e604={};_0x12e604[_0x3e9bee]={'$like':'%'+_0x2e5a1a[_0x2573('0x3c')][_0x2573('0x48')]+'%'};return _0x12e604;})});}_0x57548d=_[_0x2573('0x49')]({},_0x57548d,_0x2e5a1a[_0x2573('0x4c')]);return db[_0x2573('0x66')][_0x2573('0x4d')]({'where':_0x57548d[_0x2573('0x46')]})[_0x2573('0x1e')](function(_0x2d3497){_0x3e8288[_0x2573('0x4d')]=_0x2d3497;if(_0x2e5a1a[_0x2573('0x3c')][_0x2573('0x4e')]){_0x57548d['include']=[{'all':!![]}];}return db[_0x2573('0x66')][_0x2573('0x50')](_0x57548d);})[_0x2573('0x1e')](function(_0x5c71a8){_0x3e8288[_0x2573('0x51')]=_0x5c71a8;return _0x3e8288;});}})[_0x2573('0x1e')](respondWithFilteredResult(_0x5b2a8d,_0x57548d))[_0x2573('0x29')](handleError(_0x5b2a8d,null));};exports[_0x2573('0x6b')]=function(_0x288d31,_0x1ec6c5,_0xe86a96){return db['SmsAccount'][_0x2573('0x61')]({'where':{'id':_0x288d31[_0x2573('0x53')]['id']}})['then'](handleEntityNotFound(_0x1ec6c5,null))[_0x2573('0x1e')](function(_0x1ae390){if(_0x1ae390){return _0x1ae390[_0x2573('0x6b')](_0x288d31[_0x2573('0x3c')]['ids']);}})[_0x2573('0x1e')](respondWithStatusCode(_0x1ec6c5,null))[_0x2573('0x29')](handleError(_0x1ec6c5,null));};exports[_0x2573('0x6c')]=function(_0x4998fb,_0x4062fb,_0x1d630c){if(_0x4998fb['body']['id']){delete _0x4998fb[_0x2573('0x56')]['id'];}return db[_0x2573('0x39')]['find']({'where':{'id':_0x4998fb[_0x2573('0x53')]['id']}})[_0x2573('0x1e')](handleEntityNotFound(_0x4062fb,null))[_0x2573('0x1e')](function(_0x387886){if(_0x387886){_0x4998fb[_0x2573('0x56')]['SmsAccountId']=_0x387886['id'];return db['CannedAnswer']['create'](_0x4998fb[_0x2573('0x56')]);}})[_0x2573('0x1e')](respondWithResult(_0x4062fb,null))[_0x2573('0x29')](handleError(_0x4062fb,null));};exports['getAnswers']=function(_0x5c3e0d,_0x346bdb,_0x3ecff4){var _0x42b82e={'raw':![],'where':{}};var _0x5cf521={};var _0x458a00={'count':0x0,'rows':[]};return db[_0x2573('0x39')][_0x2573('0x68')]({'where':{'id':_0x5c3e0d[_0x2573('0x53')]['id']}})['then'](handleEntityNotFound(_0x346bdb,null))[_0x2573('0x1e')](function(_0x236979){if(_0x236979){_0x5cf521[_0x2573('0x3b')]=_[_0x2573('0x3d')](db[_0x2573('0x6d')][_0x2573('0x54')]);_0x5cf521[_0x2573('0x3c')]=_['keys'](_0x5c3e0d['query']);_0x5cf521['filters']=_[_0x2573('0x3f')](_0x5cf521[_0x2573('0x3b')],_0x5cf521[_0x2573('0x3c')]);_0x42b82e[_0x2573('0x40')]=_[_0x2573('0x3f')](_0x5cf521[_0x2573('0x3b')],qs[_0x2573('0x41')](_0x5c3e0d['query'][_0x2573('0x41')]));_0x42b82e['attributes']=_0x42b82e[_0x2573('0x40')][_0x2573('0x42')]?_0x42b82e[_0x2573('0x40')]:_0x5cf521[_0x2573('0x3b')];if(!_0x5c3e0d[_0x2573('0x3c')][_0x2573('0x43')](_0x2573('0x69'))){_0x42b82e[_0x2573('0x44')]=qs[_0x2573('0x44')](_0x5c3e0d[_0x2573('0x3c')][_0x2573('0x44')]);_0x42b82e[_0x2573('0x2c')]=qs['offset'](_0x5c3e0d[_0x2573('0x3c')][_0x2573('0x2c')]);}_0x42b82e['order']=qs['sort'](_0x5c3e0d[_0x2573('0x3c')][_0x2573('0x45')]);_0x42b82e[_0x2573('0x46')]=qs[_0x2573('0x3e')](_[_0x2573('0x47')](_0x5c3e0d[_0x2573('0x3c')],_0x5cf521[_0x2573('0x3e')]));_0x42b82e[_0x2573('0x46')]['SmsAccountId']=_0x236979['id'];if(_0x5c3e0d[_0x2573('0x3c')][_0x2573('0x48')]){_0x42b82e['where']=_['merge'](_0x42b82e[_0x2573('0x46')],{'$or':_[_0x2573('0x38')](_0x42b82e[_0x2573('0x40')],function(_0x2a987e){var _0x14847f={};_0x14847f[_0x2a987e]={'$like':'%'+_0x5c3e0d[_0x2573('0x3c')][_0x2573('0x48')]+'%'};return _0x14847f;})});}_0x42b82e=_[_0x2573('0x49')]({},_0x42b82e,_0x5c3e0d[_0x2573('0x4c')]);return db[_0x2573('0x6d')][_0x2573('0x4d')]({'where':_0x42b82e[_0x2573('0x46')]})[_0x2573('0x1e')](function(_0x4142d9){_0x458a00[_0x2573('0x4d')]=_0x4142d9;if(_0x5c3e0d[_0x2573('0x3c')]['includeAll']){_0x42b82e[_0x2573('0x4f')]=[{'all':!![]}];}return db[_0x2573('0x6d')]['findAll'](_0x42b82e);})['then'](function(_0x2ef69c){_0x458a00[_0x2573('0x51')]=_0x2ef69c;return _0x458a00;});}})['then'](respondWithFilteredResult(_0x346bdb,_0x42b82e))[_0x2573('0x29')](handleError(_0x346bdb,null));};exports[_0x2573('0x6e')]=function(_0x1bcf64,_0x4878e9,_0x395aaf){return db['SmsAccount']['find']({'where':{'id':_0x1bcf64[_0x2573('0x53')]['id']}})['then'](handleEntityNotFound(_0x4878e9,null))[_0x2573('0x1e')](function(_0x3ea62c){if(_0x3ea62c){return _0x3ea62c['removeAnswers'](_0x1bcf64[_0x2573('0x3c')][_0x2573('0x6f')]);}})[_0x2573('0x1e')](respondWithStatusCode(_0x4878e9,null))[_0x2573('0x29')](handleError(_0x4878e9,null));};exports[_0x2573('0x70')]=function(_0x2aa84c,_0x130e1a,_0x2c3049){var _0x3be2f3={'channel':_0x2573('0x71')};var _0xc42a6d=[];var _0x1c22ba=[];var _0x2f12d8={};return db[_0x2573('0x39')][_0x2573('0x61')]({'where':{'id':_0x2aa84c[_0x2573('0x53')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x2573('0x72')}]})[_0x2573('0x1e')](handleEntityNotFound(_0x130e1a,null))[_0x2573('0x1e')](function(_0x4748fa){_0x3be2f3['account']=_0x4748fa;_0x3be2f3[_0x2573('0x73')]=_[_0x2573('0x74')](_0x4748fa[_0x2573('0x72')],[_0x2573('0x75')],[_0x2573('0x76')]);if(_0x3be2f3[_0x2573('0x77')][_0x2573('0x72')]){delete _0x3be2f3[_0x2573('0x77')]['Applications'];}return db[_0x2573('0x78')]['describe']();})['then'](function(_0x1e4641){if(!_0x1e4641){throw new db[(_0x2573('0x79'))]['ValidationError'](_0x2573('0x7a'));}_0xc42a6d=_[_0x2573('0x7b')](_[_0x2573('0x3d')](_0x1e4641),[_0x2573('0x7c'),_0x2573('0x7d')]);_0x1c22ba=_[_0x2573('0x7b')](_['keys'](_0x1e4641),[_0x2573('0x7c'),_0x2573('0x7d'),'CompanyId','ListId']);_0x3be2f3[_0x2573('0x56')]={'mapKey':_0x2573('0x7e')};if(_0x3be2f3[_0x2573('0x77')]['type']){switch(_0x3be2f3[_0x2573('0x77')][_0x2573('0x4a')]){case _0x2573('0x7f'):_0x3be2f3[_0x2573('0x56')][_0x2573('0x80')]=_0x2aa84c['body'][_0x2573('0x81')];_0x3be2f3[_0x2573('0x56')][_0x2573('0x56')]=_0x2aa84c[_0x2573('0x56')]['Body'];_0x3be2f3[_0x2573('0x56')]['messageId']=_0x2aa84c[_0x2573('0x56')][_0x2573('0x82')];break;case'skebby':_0x3be2f3['body'][_0x2573('0x80')]='+'+_0x2aa84c[_0x2573('0x56')][_0x2573('0x83')];_0x3be2f3['body'][_0x2573('0x56')]=_0x2aa84c[_0x2573('0x56')]['text'];break;case _0x2573('0x84'):_0x3be2f3[_0x2573('0x56')][_0x2573('0x80')]=_0x2aa84c[_0x2573('0x56')][_0x2573('0x80')];_0x3be2f3['body']['body']=_0x2aa84c[_0x2573('0x56')][_0x2573('0x27')];break;case'clicksend':_0x3be2f3[_0x2573('0x56')][_0x2573('0x80')]=_0x2aa84c[_0x2573('0x56')]['from'];_0x3be2f3[_0x2573('0x56')][_0x2573('0x56')]=_0x2aa84c[_0x2573('0x56')][_0x2573('0x56')];_0x3be2f3['body'][_0x2573('0x85')]=_0x2aa84c[_0x2573('0x56')][_0x2573('0x86')];break;case _0x2573('0x87'):_0x3be2f3[_0x2573('0x56')][_0x2573('0x80')]=_0x2aa84c['body'][_0x2573('0x81')];_0x3be2f3[_0x2573('0x56')][_0x2573('0x56')]=_0x2aa84c[_0x2573('0x56')][_0x2573('0x88')];_0x3be2f3['body'][_0x2573('0x85')]=_0x2aa84c[_0x2573('0x56')]['MessageUUID'];break;case _0x2573('0x89'):_0x3be2f3[_0x2573('0x56')][_0x2573('0x80')]='+'+_0x2aa84c[_0x2573('0x56')][_0x2573('0x8a')][0x0][_0x2573('0x80')];_0x3be2f3[_0x2573('0x56')][_0x2573('0x56')]=_0x2aa84c[_0x2573('0x56')][_0x2573('0x8a')][0x0][_0x2573('0x8b')];_0x3be2f3[_0x2573('0x56')]['messageId']=_0x2aa84c[_0x2573('0x56')][_0x2573('0x8a')][0x0][_0x2573('0x85')];break;case _0x2573('0x8c'):_0x3be2f3['body']['from']=_0x2aa84c[_0x2573('0x56')][_0x2573('0x8d')];_0x3be2f3[_0x2573('0x56')][_0x2573('0x56')]=_0x2aa84c['body']['segmentedMessage'][_0x2573('0x27')];break;case _0x2573('0x8e'):_0x3be2f3[_0x2573('0x56')][_0x2573('0x80')]=_0x2aa84c[_0x2573('0x56')]['fromNumber'];_0x3be2f3[_0x2573('0x56')][_0x2573('0x56')]=_0x2aa84c[_0x2573('0x56')][_0x2573('0x8b')];_0x3be2f3['body'][_0x2573('0x85')]=_0x2aa84c['body'][_0x2573('0x8f')];break;case _0x2573('0x90'):_0x3be2f3[_0x2573('0x56')][_0x2573('0x85')]=_0x2aa84c[_0x2573('0x56')][0x0][_0x2573('0x27')]['id'];_0x3be2f3[_0x2573('0x56')][_0x2573('0x80')]=_0x2aa84c['body'][0x0][_0x2573('0x27')][_0x2573('0x80')];_0x3be2f3[_0x2573('0x56')]['body']=_0x2aa84c[_0x2573('0x56')][0x0]['message'][_0x2573('0x8b')];break;case'intelepeer':_0x3be2f3[_0x2573('0x56')]['from']=_0x2aa84c['body'][_0x2573('0x80')];_0x3be2f3['body']['body']=_0x2aa84c[_0x2573('0x56')][_0x2573('0x27')];_0x3be2f3[_0x2573('0x56')][_0x2573('0x85')]=_0x2aa84c[_0x2573('0x56')][_0x2573('0x91')];break;}}if(_0x3be2f3['body']['id']){delete _0x3be2f3[_0x2573('0x56')]['id'];}if(_['isNil'](_0x3be2f3[_0x2573('0x56')][_0x2573('0x80')])){throw new db[(_0x2573('0x79'))][(_0x2573('0x92'))]('from\x20is\x20mandatory');}if(_[_0x2573('0x93')](_0x3be2f3[_0x2573('0x56')][_0x2573('0x56')])||_0x3be2f3[_0x2573('0x56')][_0x2573('0x56')]===''){throw new db[(_0x2573('0x79'))][(_0x2573('0x92'))](_0x2573('0x94'));}if(_['isNil'](_0x3be2f3[_0x2573('0x56')]['mapKey'])){throw new db[(_0x2573('0x79'))][(_0x2573('0x92'))](_0x2573('0x95')+_0x1c22ba);}if(!_[_0x2573('0x96')](_0x1c22ba,_0x3be2f3['body'][_0x2573('0x97')])){throw new db[(_0x2573('0x79'))][(_0x2573('0x92'))](_0x2573('0x98')+_0x1c22ba);}_0x2f12d8[_0x3be2f3[_0x2573('0x56')][_0x2573('0x97')]]=_0x3be2f3[_0x2573('0x56')]['from'];return db[_0x2573('0x99')][_0x2573('0x61')]({'where':{'id':_0x3be2f3['account'][_0x2573('0x9a')]},'include':[{'model':db[_0x2573('0x78')],'as':_0x2573('0x9b'),'where':_0x2f12d8,'limit':0x1,'order':[['updatedAt',_0x2573('0x9c')]]}]});})[_0x2573('0x1e')](handleEntityNotFound(_0x130e1a,null))[_0x2573('0x1e')](function(_0x52b4ac){if(_0x52b4ac){_0x3be2f3[_0x2573('0x9d')]=_[_0x2573('0x9e')](_0x52b4ac,[_0x2573('0x9b')]);if(_0x52b4ac[_0x2573('0x9b')][_0x2573('0x42')]){return _0x52b4ac[_0x2573('0x9b')][0x0];}var _0x53a9b4=_['defaults'](_0x3be2f3[_0x2573('0x56')],{'firstName':_0x3be2f3[_0x2573('0x56')][_0x2573('0x80')],'ListId':_0x52b4ac['id']});_0x53a9b4[_0x3be2f3[_0x2573('0x56')]['mapKey']]=_0x3be2f3[_0x2573('0x56')][_0x2573('0x80')];return db[_0x2573('0x78')][_0x2573('0x55')](_0x53a9b4,{'fields':_0xc42a6d,'raw':!![]});}})[_0x2573('0x1e')](handleEntityNotFound(_0x130e1a,null))['then'](function(_0x2db0e9){if(_0x2db0e9){_0x3be2f3[_0x2573('0x9f')]=_0x2db0e9;var _0x3005c1={'ContactId':_0x2db0e9['id'],'phone':_0x3be2f3['body']['from'],'SmsAccountId':_0x2aa84c[_0x2573('0x53')]['id']};var _0x5ccabd={'ContactId':_0x2db0e9['id'],'SmsAccountId':_0x2aa84c['params']['id'],'closed':![]};return db[_0x2573('0xa0')]['find']({'where':_0x5ccabd})['then'](function(_0x26672f){if(_0x26672f){return[_0x26672f,![]];}return db['SmsInteraction']['create'](_0x3005c1)[_0x2573('0x1e')](function(_0x476bb1){return[_0x476bb1,!![]];});});}})['spread'](function(_0x5b7687,_0x1ba7fc){_0x3be2f3['interaction']=_0x5b7687[_0x2573('0x31')]({'plain':!![]});_0x3be2f3[_0x2573('0xa1')][_0x2573('0xa2')]=![];if(_0x1ba7fc){if(_0x3be2f3[_0x2573('0x77')][_0x2573('0xa3')]){_0x3be2f3['applications'][_0x2573('0xa4')]({'id':0x0,'priority':_0x3be2f3['applications'][_0x2573('0x42')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x2573('0xa5')});}_0x3be2f3[_0x2573('0xa1')][_0x2573('0xa2')]=!![];}return db[_0x2573('0xa6')][_0x2573('0x55')]({'phone':_0x3be2f3[_0x2573('0x56')][_0x2573('0x80')],'messageId':_0x3be2f3[_0x2573('0x56')][_0x2573('0x85')],'body':_0x3be2f3[_0x2573('0x56')][_0x2573('0x56')],'SmsAccountId':_0x2aa84c[_0x2573('0x53')]['id'],'SmsInteractionId':_0x5b7687['id'],'direction':'in','ContactId':_0x5b7687['ContactId'],'AttachmentId':_0x3be2f3[_0x2573('0x56')]['AttachmentId']});})['then'](function(_0x5b1326){_0x3be2f3[_0x2573('0x27')]=_0x5b1326;if(_0x3be2f3[_0x2573('0xa1')][_0x2573('0xa7')]){return db['User'][_0x2573('0x61')]({'attributes':['id',_0x2573('0x34')],'where':{'id':_0x3be2f3['interaction']['UserId']}})[_0x2573('0x1e')](function(_0x2f209a){if(_0x2f209a){_0x3be2f3[_0x2573('0x73')]['unshift']({'id':0x0,'priority':0x0,'app':_0x2573('0xa8'),'appdata':_0x2f209a['name']+','+(_0x3be2f3[_0x2573('0x77')][_0x2573('0xa9')]||0xa),'interval':_0x2573('0xa5')});}return respondWithRpcPromise(_0x2573('0xaa'),_0x2573('0xab'),_0x3be2f3);});}return respondWithRpcPromise(_0x2573('0xaa'),_0x2573('0xab'),_0x3be2f3);})[_0x2573('0x1e')](function(_0x3f2fc1){if(_0x3f2fc1){var _0x294ff2=0xc8;var _0x2cb4b5=_0x2573('0xac');logger[_0x2573('0x1f')](_0x2573('0x23'),_0x2cb4b5,_0x294ff2,_0x2573('0xad'));logger[_0x2573('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2cb4b5,_0x294ff2,_0x2573('0xad'),JSON[_0x2573('0x24')](_0x3f2fc1));if(_0x3be2f3[_0x2573('0x77')][_0x2573('0x4a')]===_0x2573('0x7f')){return _0x130e1a[_0x2573('0x2a')](_0x294ff2)['set']('Content-Type',_0x2573('0xae'))[_0x2573('0x35')](_0x2573('0xaf'));}else{return _0x130e1a[_0x2573('0x2a')](_0x294ff2)[_0x2573('0x2b')](_0x3f2fc1);}}})[_0x2573('0x29')](handleError(_0x130e1a,null));};exports[_0x2573('0xb0')]=function(_0x55836b,_0x4cad0e){var _0x2ac263=_0x55836b[_0x2573('0x53')]['id'];var _0x60bfed=_0x55836b[_0x2573('0x56')];var _0x598f00=0xc8;var _0x25befc=null;return db[_0x2573('0xb1')][_0x2573('0xb2')]({'isolationLevel':db['sequelize'][_0x2573('0xb3')][_0x2573('0xb4')][_0x2573('0xb5')]},function(_0x68b9bd){return db[_0x2573('0x39')][_0x2573('0x68')]({'where':{'id':_0x2ac263},'transaction':_0x68b9bd})['then'](function(_0x1c7e88){if(_0x1c7e88){return db[_0x2573('0xb6')]['destroy']({'where':{'SmsAccountId':_0x2ac263},'transaction':_0x68b9bd})[_0x2573('0x1e')](function(){var _0x1b7a51=_[_0x2573('0x38')](_0x60bfed,function(_0x5f27d5){_0x5f27d5['SmsAccountId']=_0x2ac263;return _0x5f27d5;});return db[_0x2573('0xb6')][_0x2573('0xb7')](_0x1b7a51,{'transaction':_0x68b9bd});});}else{_0x598f00=0x194;_0x25befc=[];}});})[_0x2573('0x1e')](function(){if(_0x598f00!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x2ac263},'order':_0x2573('0x75')})[_0x2573('0x1e')](function(_0x26a0fc){_0x25befc=_0x26a0fc;});}})[_0x2573('0x29')](function(_0x1bad91){_0x598f00=0x1f4;logger[_0x2573('0x25')](_0x1bad91[_0x2573('0x33')]);if(_0x1bad91[_0x2573('0x34')]){delete _0x1bad91[_0x2573('0x34')];}_0x25befc=_0x1bad91;})['finally'](function(){if(_0x25befc===null){_0x4cad0e['sendStatus'](_0x598f00);}else{if(_0x598f00===0x1f4){_0x4cad0e[_0x2573('0x2a')](_0x598f00)[_0x2573('0x35')](_0x25befc);}else{_0x4cad0e[_0x2573('0x2a')](_0x598f00)[_0x2573('0x2b')](_0x25befc);}}});};exports[_0x2573('0xb8')]=function(_0x597fee,_0x2be820,_0x448d12){var _0x437c77={};var _0x56c0c5={};var _0x2f936c;var _0x3b3c67;return db['SmsAccount'][_0x2573('0x68')]({'where':{'id':_0x597fee[_0x2573('0x53')]['id']}})[_0x2573('0x1e')](handleEntityNotFound(_0x2be820,null))[_0x2573('0x1e')](function(_0x3505f7){if(_0x3505f7){_0x2f936c=_0x3505f7;_0x56c0c5[_0x2573('0x3b')]=_[_0x2573('0x3d')](db[_0x2573('0xb6')][_0x2573('0x54')]);_0x56c0c5['query']=_[_0x2573('0x3d')](_0x597fee['query']);_0x56c0c5[_0x2573('0x3e')]=_['intersection'](_0x56c0c5['model'],_0x56c0c5[_0x2573('0x3c')]);_0x437c77[_0x2573('0x40')]=_[_0x2573('0x3f')](_0x56c0c5[_0x2573('0x3b')],qs[_0x2573('0x41')](_0x597fee[_0x2573('0x3c')][_0x2573('0x41')]));_0x437c77[_0x2573('0x40')]=_0x437c77['attributes'][_0x2573('0x42')]?_0x437c77[_0x2573('0x40')]:_0x56c0c5['model'];_0x437c77['order']=qs[_0x2573('0x45')](_0x597fee['query'][_0x2573('0x45')]);_0x437c77['where']=qs[_0x2573('0x3e')](_[_0x2573('0x47')](_0x597fee['query'],_0x56c0c5[_0x2573('0x3e')]));if(_0x597fee[_0x2573('0x3c')][_0x2573('0x48')]){_0x437c77[_0x2573('0x46')]=_[_0x2573('0x49')](_0x437c77[_0x2573('0x46')],{'$or':_['map'](_0x437c77[_0x2573('0x40')],function(_0x5884bb){var _0x38b174={};_0x38b174[_0x5884bb]={'$like':'%'+_0x597fee[_0x2573('0x3c')][_0x2573('0x48')]+'%'};return _0x38b174;})});}_0x437c77=_[_0x2573('0x49')]({},_0x437c77,_0x597fee[_0x2573('0x4c')]);return _0x2f936c[_0x2573('0xb8')](_0x437c77);}})[_0x2573('0x1e')](function(_0x4e72fa){if(_0x4e72fa){_0x3b3c67=_0x4e72fa['length'];if(!_0x597fee[_0x2573('0x3c')]['hasOwnProperty'](_0x2573('0x69'))){_0x437c77[_0x2573('0x44')]=qs[_0x2573('0x44')](_0x597fee['query'][_0x2573('0x44')]);_0x437c77[_0x2573('0x2c')]=qs[_0x2573('0x2c')](_0x597fee[_0x2573('0x3c')][_0x2573('0x2c')]);}return _0x2f936c[_0x2573('0xb8')](_0x437c77);}})[_0x2573('0x1e')](function(_0x33ce2c){if(_0x33ce2c){return _0x33ce2c?{'count':_0x3b3c67,'rows':_0x33ce2c}:null;}})[_0x2573('0x1e')](respondWithResult(_0x2be820,null))[_0x2573('0x29')](handleError(_0x2be820,null));};exports[_0x2573('0xb9')]=function(_0x529be7,_0x5b05c4,_0x145894){var _0x1d8a7a={'raw':![],'where':{}};var _0x4e795d={};var _0x1283d6={'count':0x0,'rows':[]};return db[_0x2573('0x39')]['findOne']({'where':{'id':_0x529be7[_0x2573('0x53')]['id']}})[_0x2573('0x1e')](handleEntityNotFound(_0x5b05c4,null))[_0x2573('0x1e')](function(_0x526910){if(_0x526910){_0x4e795d['model']=_['keys'](db['SmsInteraction'][_0x2573('0x54')]);_0x4e795d[_0x2573('0x3c')]=_[_0x2573('0x3d')](_0x529be7['query']);_0x4e795d[_0x2573('0x3e')]=_['intersection'](_0x4e795d[_0x2573('0x3b')],_0x4e795d['query']);_0x1d8a7a[_0x2573('0x40')]=_[_0x2573('0x3f')](_0x4e795d[_0x2573('0x3b')],qs[_0x2573('0x41')](_0x529be7[_0x2573('0x3c')][_0x2573('0x41')]));_0x1d8a7a['attributes']=_0x1d8a7a[_0x2573('0x40')][_0x2573('0x42')]?_0x1d8a7a[_0x2573('0x40')]:_0x4e795d[_0x2573('0x3b')];if(!_0x529be7[_0x2573('0x3c')][_0x2573('0x43')](_0x2573('0x69'))){_0x1d8a7a['limit']=qs[_0x2573('0x44')](_0x529be7[_0x2573('0x3c')][_0x2573('0x44')]);_0x1d8a7a[_0x2573('0x2c')]=qs['offset'](_0x529be7[_0x2573('0x3c')][_0x2573('0x2c')]);}_0x1d8a7a[_0x2573('0x6a')]=qs[_0x2573('0x45')](_0x529be7[_0x2573('0x3c')][_0x2573('0x45')]);_0x1d8a7a[_0x2573('0x46')]=qs[_0x2573('0x3e')](_['pick'](_0x529be7[_0x2573('0x3c')],_0x4e795d[_0x2573('0x3e')]));_0x1d8a7a[_0x2573('0x46')][_0x2573('0x65')]=_0x526910['id'];if(_0x529be7[_0x2573('0x3c')]['filter']){_0x1d8a7a['where']=_['merge'](_0x1d8a7a[_0x2573('0x46')],{'$or':_[_0x2573('0x38')](_0x1d8a7a[_0x2573('0x40')],function(_0x54d175){var _0x5cba3f={};_0x5cba3f[_0x54d175]={'$like':'%'+_0x529be7['query'][_0x2573('0x48')]+'%'};return _0x5cba3f;})});}_0x1d8a7a=_[_0x2573('0x49')]({},_0x1d8a7a,_0x529be7['options']);return db[_0x2573('0xa0')][_0x2573('0x4d')]({'where':_0x1d8a7a['where']})[_0x2573('0x1e')](function(_0x20fb9f){_0x1283d6['count']=_0x20fb9f;if(_0x529be7[_0x2573('0x3c')][_0x2573('0x4e')]){_0x1d8a7a['include']=[{'model':db[_0x2573('0x78')],'as':_0x2573('0xba'),'required':![]},{'model':db[_0x2573('0xbb')],'as':_0x2573('0xbc'),'attributes':[_0x2573('0x34'),'fullname',_0x2573('0xbd')],'required':![]},{'model':db['Tag'],'as':_0x2573('0xbe'),'attributes':['id',_0x2573('0x34'),_0x2573('0xbf')],'where':_0x529be7[_0x2573('0x3c')][_0x2573('0xc0')]?{'id':_0x529be7[_0x2573('0x3c')][_0x2573('0xc0')]}:undefined,'required':_0x529be7[_0x2573('0x3c')]['tag']?!![]:![]}];}return db['SmsInteraction'][_0x2573('0x50')](_0x1d8a7a);})[_0x2573('0x1e')](function(_0x3b34db){_0x1283d6[_0x2573('0x51')]=_0x3b34db;return _0x1283d6;});}})[_0x2573('0x1e')](respondWithFilteredResult(_0x5b05c4,_0x1d8a7a))[_0x2573('0x29')](handleError(_0x5b05c4,null));};exports['send']=function(_0x40eba1,_0x27d989,_0x1e8507){var _0x3ce27d,_0x15b2f4,_0x43984b;if(_[_0x2573('0x93')](_0x40eba1[_0x2573('0x56')][_0x2573('0x56')])||_0x40eba1[_0x2573('0x56')][_0x2573('0x56')]===''){throw new db[(_0x2573('0x79'))]['ValidationError'](_0x2573('0x94'));}if(_['isNil'](_0x40eba1[_0x2573('0x56')]['to'])){throw new db['Sequelize'][(_0x2573('0x92'))]('to\x20is\x20mandatory');}_0x3ce27d=_0x40eba1[_0x2573('0x56')]['to'];return db[_0x2573('0x39')][_0x2573('0x61')]({'where':{'id':_0x40eba1[_0x2573('0x53')]['id']},'include':[{'model':db[_0x2573('0x99')],'as':_0x2573('0xc1'),'include':[{'model':db[_0x2573('0x78')],'as':_0x2573('0x9b'),'where':{'mobile':_0x3ce27d},'limit':0x1,'order':[[_0x2573('0x7d'),'DESC']]}]}]})[_0x2573('0x1e')](handleEntityNotFound(_0x27d989,null))[_0x2573('0x1e')](function(_0x25c397){if(_0x25c397&&_0x25c397[_0x2573('0xc1')]){_0x15b2f4=_0x25c397['get']({'plain':!![]});if(_0x15b2f4[_0x2573('0xc1')]&&_0x15b2f4[_0x2573('0xc1')]['Contacts'][_0x2573('0x42')]){return _0x15b2f4['List']['Contacts'][0x0];}return db[_0x2573('0x78')][_0x2573('0x55')](_[_0x2573('0x16')](_0x40eba1['body'],{'firstName':_0x3ce27d,'mobile':_0x3ce27d,'phone':_0x3ce27d,'ListId':_0x15b2f4[_0x2573('0x9a')]}));}})[_0x2573('0x1e')](handleEntityNotFound(_0x27d989,null))[_0x2573('0x1e')](function(_0x266dcf){if(_0x266dcf){_0x43984b=_0x266dcf;return db[_0x2573('0xa0')][_0x2573('0x61')]({'where':{'ContactId':_0x43984b['id'],'closed':![],'SmsAccountId':_0x15b2f4['id']}})[_0x2573('0x1e')](function(_0x48dccc){if(_0x48dccc){return[_0x48dccc,![]];}return db[_0x2573('0xa0')][_0x2573('0x55')]({'UserId':_0x40eba1[_0x2573('0x57')]['id'],'ContactId':_0x43984b['id'],'SmsAccountId':_0x15b2f4['id'],'phone':_0x3ce27d,'firstMsgDirection':'out','Messages':[_[_0x2573('0x49')](_0x40eba1[_0x2573('0x56')],{'read':![],'body':_0x40eba1[_0x2573('0x56')][_0x2573('0x56')],'phone':_0x3ce27d,'SmsAccountId':_0x15b2f4['id'],'UserId':_0x40eba1[_0x2573('0x57')]['id'],'ContactId':_0x43984b['id']})]},{'include':[{'model':db[_0x2573('0xa6')],'as':_0x2573('0xc2')}]})[_0x2573('0x1e')](function(_0x117bcc){return[_0x117bcc,!![]];});});}})[_0x2573('0xc3')](function(_0x5bfd9e,_0x3c665f){if(_0x3c665f){return _0x5bfd9e;}return db[_0x2573('0xa6')]['create'](_[_0x2573('0x49')](_0x40eba1[_0x2573('0x56')],{'read':![],'body':_0x40eba1[_0x2573('0x56')][_0x2573('0x56')],'phone':_0x3ce27d,'SmsAccountId':_0x15b2f4['id'],'SmsInteractionId':_0x5bfd9e['id'],'UserId':_0x40eba1[_0x2573('0x57')]['id'],'ContactId':_0x43984b['id']}))[_0x2573('0x1e')](function(_0x4135d6){_0x5bfd9e['dataValues'][_0x2573('0xc2')]=[];_0x5bfd9e['dataValues'][_0x2573('0xc2')]['push'](_0x4135d6[_0x2573('0xc4')]);return _0x5bfd9e;});})['then'](respondWithResult(_0x27d989,null))[_0x2573('0x29')](handleError(_0x27d989,null));};exports[_0x2573('0x2a')]=function(_0x322309,_0x2b09d0,_0x24f06e){if(_0x322309[_0x2573('0x56')]['id']){delete _0x322309[_0x2573('0x56')]['id'];}var _0xe12f9,_0x331f34,_0x44f3ee;return db[_0x2573('0x39')]['find']({'where':{'id':_0x322309[_0x2573('0x53')]['id']}})['then'](handleEntityNotFound(_0x2b09d0,null))[_0x2573('0x1e')](function(_0x754457){if(_0x754457){_0x44f3ee=_0x754457;logger[_0x2573('0x22')](_0x2573('0x23'),_0x2573('0x2a'),_0x2573('0xc5'),_0x754457[_0x2573('0x4a')],util[_0x2573('0xc6')](_0x322309['body'],{'showHidden':![],'depth':null}));switch(_0x754457[_0x2573('0x4a')]){case _0x2573('0xc7'):if(_0x322309[_0x2573('0x56')][_0x2573('0xc8')]&&_0x322309[_0x2573('0x56')][_0x2573('0x2a')]){_0x331f34=_0x322309[_0x2573('0x56')][_0x2573('0x2a')];return db[_0x2573('0xa6')]['find']({'where':{'messageId':_0x322309['body'][_0x2573('0xc8')]}});}break;case _0x2573('0x84'):if(_0x322309[_0x2573('0x56')][_0x2573('0xc9')]&&_0x322309[_0x2573('0x56')][_0x2573('0xca')]){_0x331f34=_0x322309[_0x2573('0x56')][_0x2573('0xca')];return db['SmsMessage']['find']({'where':{'messageId':_0x322309[_0x2573('0x56')][_0x2573('0xc9')]}});}break;case _0x2573('0xcb'):if(_0x322309[_0x2573('0x56')][_0x2573('0x86')]&&_0x322309[_0x2573('0x56')]['status_code']){_0x331f34=_0x322309['body'][_0x2573('0xcc')];return db['SmsMessage']['find']({'where':{'messageId':_0x322309[_0x2573('0x56')][_0x2573('0x86')]}});}break;case _0x2573('0x89'):var _0x3599d5=_0x322309['body'][_0x2573('0x8a')][0x0];if(_0x3599d5['messageId']&&_0x3599d5[_0x2573('0x2a')][_0x2573('0xcd')]===_0x2573('0xce')){_0x331f34=_0x3599d5['status'][_0x2573('0xcd')];return db['SmsMessage'][_0x2573('0x61')]({'where':{'messageId':_0x3599d5[_0x2573('0x85')]}});}break;case'clickatell':if(_0x322309['body'][_0x2573('0x85')]&&_0x322309['body'][_0x2573('0x2a')]){_0x331f34=_0x322309['body']['status'];return db[_0x2573('0xa6')][_0x2573('0x61')]({'where':{'messageId':_0x322309[_0x2573('0x56')][_0x2573('0x85')]}});}break;case _0x2573('0x90'):if(_0x322309['body'][0x0][_0x2573('0x27')]['id']){_0x331f34=_0x322309[_0x2573('0x56')][0x0][_0x2573('0x4a')];return db[_0x2573('0xa6')][_0x2573('0x61')]({'where':{'messageId':_0x322309['body'][0x0]['message']['id']}});}break;case _0x2573('0xcf'):if(_0x322309[_0x2573('0x56')][_0x2573('0xd0')]&&_0x322309[_0x2573('0x56')][_0x2573('0x2a')]){_0x331f34=_0x322309[_0x2573('0x56')][_0x2573('0x2a')];return db[_0x2573('0xa6')][_0x2573('0x61')]({'where':{'messageId':_0x322309['body'][_0x2573('0xd0')]}});}break;}}})[_0x2573('0x1e')](handleEntityNotFound(_0x2b09d0,null))[_0x2573('0x1e')](function(_0x5b5af3){if(_0x5b5af3){_0xe12f9=_0x5b5af3;switch(_0x44f3ee[_0x2573('0x4a')]){case _0x2573('0xc7'):if(_0x331f34===_0x2573('0xce')){return _0xe12f9[_0x2573('0x60')]({'read':!![]});}else{logger[_0x2573('0x25')](_0x2573('0x23'),_0x2573('0x2a'),_0x2573('0xc7'),util[_0x2573('0xc6')](_0x322309[_0x2573('0x56')],{'showHidden':![],'depth':null}));}break;case _0x2573('0x84'):if(_0x331f34==='1'){return _0xe12f9[_0x2573('0x60')]({'read':!![]});}else{logger['error'](_0x2573('0x23'),_0x2573('0x2a'),'skebby',util[_0x2573('0xc6')](_0x322309[_0x2573('0x56')],{'showHidden':![],'depth':null}));}break;case _0x2573('0xcb'):if(!_0x322309[_0x2573('0x56')][_0x2573('0xd1')]&&_0x331f34>=0xc8&&_0x331f34<=0xce){return _0xe12f9[_0x2573('0x60')]({'read':!![]});}else{logger[_0x2573('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2573('0x2a'),'clicksend',util[_0x2573('0xc6')](_0x322309[_0x2573('0x56')],{'showHidden':![],'depth':null}));}break;case _0x2573('0x89'):var _0xb29d78=_0x322309[_0x2573('0x56')][_0x2573('0x8a')][0x0];if(_0xb29d78['status']['groupName']===_0x2573('0xce')){return _0xe12f9['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2573('0x2a'),'infobip',util[_0x2573('0xc6')](_0x322309[_0x2573('0x56')],{'showHidden':![],'depth':null}));}break;case _0x2573('0x8e'):if(_0x331f34==_0x2573('0xd2')||_0x331f34==_0x2573('0xd3')){return _0xe12f9[_0x2573('0x60')]({'read':!![]});}else{logger[_0x2573('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2573('0x2a'),_0x2573('0x8e'),util[_0x2573('0xc6')](_0x322309[_0x2573('0x56')],{'showHidden':![],'depth':null}));}break;case _0x2573('0x90'):if(_0x331f34==_0x2573('0xd4')){return _0xe12f9[_0x2573('0x60')]({'read':!![]});}else{logger[_0x2573('0x25')](_0x2573('0x23'),_0x2573('0x2a'),'bandwidth',util[_0x2573('0xc6')](_0x322309['body'],{'showHidden':![],'depth':null}));}break;case _0x2573('0xcf'):if(_0x331f34==='DELIVRD'||_0x331f34==='ACCEPTD'){return _0xe12f9[_0x2573('0x60')]({'read':!![]});}else{logger['error'](_0x2573('0x23'),_0x2573('0x2a'),_0x2573('0xcf'),util[_0x2573('0xc6')](_0x322309[_0x2573('0x56')],{'showHidden':![],'depth':null}));}break;}return _0xe12f9;}})[_0x2573('0x1e')](respondWithResult(_0x2b09d0,null))[_0x2573('0x29')](handleError(_0x2b09d0,null));};exports[_0x2573('0xd5')]=function(_0x2e625b,_0x46e158,_0x5a119a){var _0x266732,_0x239a8e,_0x15a131;return db['SmsAccount'][_0x2573('0x61')]({'where':{'id':_0x2e625b[_0x2573('0x53')]['id']}})[_0x2573('0x1e')](handleEntityNotFound(_0x46e158,null))[_0x2573('0x1e')](function(_0x5e4c64){if(_0x5e4c64){_0x15a131=_0x5e4c64;logger[_0x2573('0x22')](_0x2573('0x23'),_0x2573('0x2a'),_0x2573('0xc5'),_0x5e4c64[_0x2573('0x4a')],util[_0x2573('0xc6')](_0x2e625b[_0x2573('0x3c')],{'showHidden':![],'depth':null}));switch(_0x5e4c64['type']){case _0x2573('0x8c'):if(_0x2e625b[_0x2573('0x3c')][_0x2573('0xd6')]&&_0x2e625b[_0x2573('0x3c')][_0x2573('0xd7')]){_0x239a8e=_0x2e625b[_0x2573('0x3c')]['state'];return db[_0x2573('0xa6')]['find']({'where':{'messageId':_0x2e625b[_0x2573('0x3c')][_0x2573('0xd6')]}});}break;}}})[_0x2573('0x1e')](handleEntityNotFound(_0x46e158,null))[_0x2573('0x1e')](function(_0x2b7c5e){if(_0x2b7c5e){_0x266732=_0x2b7c5e;switch(_0x15a131[_0x2573('0x4a')]){case _0x2573('0x8c'):if(_0x239a8e==='2'||_0x239a8e==='6'){return _0x266732[_0x2573('0x60')]({'read':!![]});}else{logger[_0x2573('0x25')](_0x2573('0x23'),_0x2573('0x2a'),_0x2573('0x8c'),util[_0x2573('0xc6')](_0x2e625b[_0x2573('0x3c')],{'showHidden':![],'depth':null}));};break;}return _0x266732;}})[_0x2573('0x1e')](respondWithResult(_0x46e158,null))[_0x2573('0x29')](handleError(_0x46e158,null));};exports[_0x2573('0xd8')]=function(_0x41416c,_0x5391d6,_0x451106){return db['SmsAccount']['find']({'where':{'id':_0x41416c[_0x2573('0x53')]['id']}})[_0x2573('0x1e')](handleEntityNotFound(_0x5391d6,null))['then'](function(_0x1dbad4){if(_0x1dbad4){return _0x1dbad4[_0x2573('0xd8')](_0x41416c[_0x2573('0x56')]['ids'],_[_0x2573('0x9e')](_0x41416c[_0x2573('0x56')],['ids','id'])||{})[_0x2573('0xc3')](function(_0x27fdb6){for(var _0x5827d8=0x0;_0x5827d8<_0x41416c[_0x2573('0x56')][_0x2573('0x6f')][_0x2573('0x42')];_0x5827d8+=0x1){socket[_0x2573('0xd9')]('userSmsAccount:save',{'UserId':Number(_0x41416c[_0x2573('0x56')]['ids'][_0x5827d8]),'SmsAccountId':Number(_0x41416c['params']['id'])});}return _0x27fdb6;});}})['then'](respondWithResult(_0x5391d6,null))[_0x2573('0x29')](handleError(_0x5391d6,null));};exports['removeAgents']=function(_0x8f20e8,_0x13abb8,_0x892164){return db['SmsAccount']['find']({'where':{'id':_0x8f20e8[_0x2573('0x53')]['id']}})[_0x2573('0x1e')](handleEntityNotFound(_0x13abb8,null))[_0x2573('0x1e')](function(_0x503647){if(_0x503647){return _0x503647[_0x2573('0xda')](_0x8f20e8[_0x2573('0x3c')][_0x2573('0x6f')])[_0x2573('0x1e')](function(){if(_[_0x2573('0xdb')](_0x8f20e8['query'][_0x2573('0x6f')])){for(var _0x1601f6=0x0;_0x1601f6<_0x8f20e8[_0x2573('0x3c')][_0x2573('0x6f')][_0x2573('0x42')];_0x1601f6+=0x1){socket[_0x2573('0xd9')](_0x2573('0xdc'),{'UserId':Number(_0x8f20e8[_0x2573('0x3c')][_0x2573('0x6f')][_0x1601f6]),'SmsAccountId':Number(_0x8f20e8['params']['id'])});}}else{socket[_0x2573('0xd9')]('userSmsAccount:remove',{'UserId':Number(_0x8f20e8[_0x2573('0x3c')]['ids']),'SmsAccountId':Number(_0x8f20e8['params']['id'])});}});}})[_0x2573('0x1e')](respondWithStatusCode(_0x13abb8,null))[_0x2573('0x29')](handleError(_0x13abb8,null));};exports[_0x2573('0xdd')]=function(_0x53e7e4,_0x411150,_0x1a8d3e){var _0x22826d={};var _0x94ddb4={};var _0x5a23f3;var _0x279fac;return db['SmsAccount'][_0x2573('0x68')]({'where':{'id':_0x53e7e4[_0x2573('0x53')]['id']}})[_0x2573('0x1e')](handleEntityNotFound(_0x411150,null))[_0x2573('0x1e')](function(_0x4da0c8){if(_0x4da0c8){_0x5a23f3=_0x4da0c8;_0x94ddb4[_0x2573('0x3b')]=_[_0x2573('0x3d')](db[_0x2573('0xbb')][_0x2573('0x54')]);_0x94ddb4[_0x2573('0x3c')]=_[_0x2573('0x3d')](_0x53e7e4[_0x2573('0x3c')]);_0x94ddb4[_0x2573('0x3e')]=_[_0x2573('0x3f')](_0x94ddb4[_0x2573('0x3b')],_0x94ddb4[_0x2573('0x3c')]);_0x22826d[_0x2573('0x40')]=_[_0x2573('0x3f')](_0x94ddb4['model'],qs[_0x2573('0x41')](_0x53e7e4['query'][_0x2573('0x41')]));_0x22826d['attributes']=_0x22826d[_0x2573('0x40')]['length']?_0x22826d[_0x2573('0x40')]:_0x94ddb4[_0x2573('0x3b')];_0x22826d[_0x2573('0x6a')]=qs['sort'](_0x53e7e4[_0x2573('0x3c')][_0x2573('0x45')]);_0x22826d[_0x2573('0x46')]=qs[_0x2573('0x3e')](_['pick'](_0x53e7e4[_0x2573('0x3c')],_0x94ddb4[_0x2573('0x3e')]));if(_0x53e7e4[_0x2573('0x3c')]['filter']){_0x22826d['where']=_['merge'](_0x22826d[_0x2573('0x46')],{'$or':_[_0x2573('0x38')](_0x22826d[_0x2573('0x40')],function(_0x4e17b9){var _0x2fc2df={};_0x2fc2df[_0x4e17b9]={'$like':'%'+_0x53e7e4[_0x2573('0x3c')]['filter']+'%'};return _0x2fc2df;})});}_0x22826d=_[_0x2573('0x49')]({},_0x22826d,_0x53e7e4['options']);return _0x5a23f3[_0x2573('0xdd')](_0x22826d);}})['then'](function(_0x53bbcc){if(_0x53bbcc){_0x279fac=_0x53bbcc[_0x2573('0x42')];if(!_0x53e7e4['query'][_0x2573('0x43')]('nolimit')){_0x22826d['limit']=qs[_0x2573('0x44')](_0x53e7e4[_0x2573('0x3c')][_0x2573('0x44')]);_0x22826d[_0x2573('0x2c')]=qs[_0x2573('0x2c')](_0x53e7e4[_0x2573('0x3c')][_0x2573('0x2c')]);}return _0x5a23f3[_0x2573('0xdd')](_0x22826d);}})['then'](function(_0x109669){if(_0x109669){return _0x109669?{'count':_0x279fac,'rows':_0x109669}:null;}})['then'](respondWithResult(_0x411150,null))[_0x2573('0x29')](handleError(_0x411150,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 04f0552..6e3ccaa 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 _0x697a=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x2ea4f0,_0x420118){var _0x5c5877=function(_0x16f450){while(--_0x16f450){_0x2ea4f0['push'](_0x2ea4f0['shift']());}};_0x5c5877(++_0x420118);}(_0x697a,0x126));var _0xa697=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x697a[_0x550d12];return _0x12103d;};'use strict';var EventEmitter=require(_0xa697('0x0'));var SmsAccount=require(_0xa697('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xa697('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa697('0x3'),'afterDestroy':_0xa697('0x4')};function emitEvent(_0x498f39){return function(_0xb4daa1,_0x339fdb,_0x563b28){SmsAccountEvents[_0xa697('0x5')](_0x498f39+':'+_0xb4daa1['id'],_0xb4daa1);SmsAccountEvents[_0xa697('0x5')](_0x498f39,_0xb4daa1);_0x563b28(null);};}for(var e in events){if(events[_0xa697('0x6')](e)){var event=events[e];SmsAccount[_0xa697('0x7')](e,emitEvent(event));}}module[_0xa697('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0xeca1=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x319cb9,_0x4b8d35){var _0x1735fc=function(_0x43b061){while(--_0x43b061){_0x319cb9['push'](_0x319cb9['shift']());}};_0x1735fc(++_0x4b8d35);}(_0xeca1,0x16b));var _0x1eca=function(_0x3da250,_0x1d90e1){_0x3da250=_0x3da250-0x0;var _0x377e87=_0xeca1[_0x3da250];return _0x377e87;};'use strict';var EventEmitter=require(_0x1eca('0x0'));var SmsAccount=require(_0x1eca('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1eca('0x2'),'afterUpdate':_0x1eca('0x3'),'afterDestroy':_0x1eca('0x4')};function emitEvent(_0x5d15f8){return function(_0x48e92d,_0xc830b8,_0x51595d){SmsAccountEvents['emit'](_0x5d15f8+':'+_0x48e92d['id'],_0x48e92d);SmsAccountEvents[_0x1eca('0x5')](_0x5d15f8,_0x48e92d);_0x51595d(null);};}for(var e in events){if(events[_0x1eca('0x6')](e)){var event=events[e];SmsAccount[_0x1eca('0x7')](e,emitEvent(event));}}module[_0x1eca('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 5cca8fb..d4b344d 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 _0x6488=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','SmsAccount','sms_accounts','lodash','../../config/logger'];(function(_0x3ab13b,_0x45ed44){var _0x57bb03=function(_0x122391){while(--_0x122391){_0x3ab13b['push'](_0x3ab13b['shift']());}};_0x57bb03(++_0x45ed44);}(_0x6488,0x106));var _0x8648=function(_0x3e9402,_0x130b9e){_0x3e9402=_0x3e9402-0x0;var _0x1f5996=_0x6488[_0x3e9402];return _0x1f5996;};'use strict';var _=require(_0x8648('0x0'));var util=require('util');var logger=require(_0x8648('0x1'))(_0x8648('0x2'));var moment=require(_0x8648('0x3'));var BPromise=require(_0x8648('0x4'));var rp=require(_0x8648('0x5'));var fs=require('fs');var path=require(_0x8648('0x6'));var rimraf=require(_0x8648('0x7'));var config=require(_0x8648('0x8'));var attributes=require(_0x8648('0x9'));module['exports']=function(_0x1a6b06,_0x27c21c){return _0x1a6b06['define'](_0x8648('0xa'),attributes,{'tableName':_0x8648('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0b2=['path','rimraf','../../config/environment','./smsAccount.attributes','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x236f66,_0x4b5069){var _0x504dfe=function(_0x10cdc2){while(--_0x10cdc2){_0x236f66['push'](_0x236f66['shift']());}};_0x504dfe(++_0x4b5069);}(_0xd0b2,0x125));var _0x2d0b=function(_0x33a568,_0xb2dbff){_0x33a568=_0x33a568-0x0;var _0x17c5a5=_0xd0b2[_0x33a568];return _0x17c5a5;};'use strict';var _=require(_0x2d0b('0x0'));var util=require(_0x2d0b('0x1'));var logger=require(_0x2d0b('0x2'))('api');var moment=require(_0x2d0b('0x3'));var BPromise=require(_0x2d0b('0x4'));var rp=require(_0x2d0b('0x5'));var fs=require('fs');var path=require(_0x2d0b('0x6'));var rimraf=require(_0x2d0b('0x7'));var config=require(_0x2d0b('0x8'));var attributes=require(_0x2d0b('0x9'));module['exports']=function(_0x25f28e,_0x26152f){return _0x25f28e[_0x2d0b('0xa')](_0x2d0b('0xb'),attributes,{'tableName':_0x2d0b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index dc8ad59..c1cdea3 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 _0x1b91=['model','ShowSmsAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SmsAccount','find','options','raw','attributes','include','map'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x1b91,0x160));var _0x11b9=function(_0x14c6e8,_0x38380d){_0x14c6e8=_0x14c6e8-0x0;var _0x586870=_0x1b91[_0x14c6e8];return _0x586870;};'use strict';var _=require(_0x11b9('0x0'));var util=require(_0x11b9('0x1'));var moment=require(_0x11b9('0x2'));var BPromise=require(_0x11b9('0x3'));var rs=require(_0x11b9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x11b9('0x5'))['db'];var utils=require(_0x11b9('0x6'));var logger=require(_0x11b9('0x7'))(_0x11b9('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x11b9('0x9')][_0x11b9('0xa')]({'port':0x232a});config[_0x11b9('0xb')]=_[_0x11b9('0xc')](config[_0x11b9('0xb')],{'host':_0x11b9('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x5286d7,_0x5439fd,_0x5b7c9d){return new BPromise(function(_0x35bf9e,_0x49d885){return client[_0x11b9('0xe')](_0x5286d7,_0x5b7c9d)[_0x11b9('0xf')](function(_0x5e28e3){logger[_0x11b9('0x10')](_0x11b9('0x11'),_0x5439fd,_0x11b9('0x12'));logger[_0x11b9('0x13')](_0x11b9('0x14'),_0x5439fd,_0x11b9('0x12'),JSON[_0x11b9('0x15')](_0x5e28e3));if(_0x5e28e3['error']){if(_0x5e28e3[_0x11b9('0x16')]['code']===0x1f4){logger[_0x11b9('0x16')]('SmsAccount,\x20%s,\x20%s',_0x5439fd,_0x5e28e3[_0x11b9('0x16')]['message']);return _0x49d885(_0x5e28e3[_0x11b9('0x16')][_0x11b9('0x17')]);}logger[_0x11b9('0x16')]('SmsAccount,\x20%s,\x20%s',_0x5439fd,_0x5e28e3[_0x11b9('0x16')][_0x11b9('0x17')]);return _0x35bf9e(_0x5e28e3[_0x11b9('0x16')][_0x11b9('0x17')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x5439fd,_0x11b9('0x12'));_0x35bf9e(_0x5e28e3[_0x11b9('0x18')][_0x11b9('0x17')]);}})[_0x11b9('0x19')](function(_0x393cc1){logger['error'](_0x11b9('0x11'),_0x5439fd,_0x393cc1);_0x49d885(_0x393cc1);});});}exports['ShowSmsAccount']=function(_0x30def3){var _0x29cb96=this;return new Promise(function(_0x5f2043,_0x34484f){return db[_0x11b9('0x1a')][_0x11b9('0x1b')]({'raw':_0x30def3['options']?_0x30def3[_0x11b9('0x1c')][_0x11b9('0x1d')]===undefined?!![]:![]:!![],'where':_0x30def3[_0x11b9('0x1c')]?_0x30def3['options']['where']||null:null,'attributes':_0x30def3['options']?_0x30def3[_0x11b9('0x1c')][_0x11b9('0x1e')]||null:null,'include':_0x30def3[_0x11b9('0x1c')]?_0x30def3[_0x11b9('0x1c')][_0x11b9('0x1f')]?_[_0x11b9('0x20')](_0x30def3[_0x11b9('0x1c')][_0x11b9('0x1f')],function(_0x5383e4){return{'model':db[_0x5383e4[_0x11b9('0x21')]],'as':_0x5383e4['as'],'attributes':_0x5383e4[_0x11b9('0x1e')],'include':_0x5383e4[_0x11b9('0x1f')]?_[_0x11b9('0x20')](_0x5383e4[_0x11b9('0x1f')],function(_0x2ad12b){return{'model':db[_0x2ad12b[_0x11b9('0x21')]],'as':_0x2ad12b['as'],'attributes':_0x2ad12b['attributes'],'include':_0x2ad12b[_0x11b9('0x1f')]?_[_0x11b9('0x20')](_0x2ad12b['include'],function(_0xac56f9){return{'model':db[_0xac56f9[_0x11b9('0x21')]],'as':_0xac56f9['as'],'attributes':_0xac56f9[_0x11b9('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1932d6){logger[_0x11b9('0x10')](_0x11b9('0x22'),_0x30def3);logger[_0x11b9('0x13')]('ShowSmsAccount',_0x30def3,JSON[_0x11b9('0x15')](_0x1932d6));_0x5f2043(_0x1932d6);})[_0x11b9('0x19')](function(_0x3f233e){logger[_0x11b9('0x16')](_0x11b9('0x22'),_0x3f233e[_0x11b9('0x17')],_0x30def3);_0x34484f(_0x29cb96[_0x11b9('0x16')](0x1f4,_0x3f233e[_0x11b9('0x17')]));});});}; \ No newline at end of file +var _0xdbb4=['SmsAccount,\x20%s,\x20%s','message','catch','find','options','where','attributes','include','map','model','ShowSmsAccount','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./smsAccount.socket','register','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x39e001,_0x33488a){var _0x429a9a=function(_0x1d0b45){while(--_0x1d0b45){_0x39e001['push'](_0x39e001['shift']());}};_0x429a9a(++_0x33488a);}(_0xdbb4,0x146));var _0x4dbb=function(_0x3d1996,_0x1f08f0){_0x3d1996=_0x3d1996-0x0;var _0x550afd=_0xdbb4[_0x3d1996];return _0x550afd;};'use strict';var _=require(_0x4dbb('0x0'));var util=require(_0x4dbb('0x1'));var moment=require(_0x4dbb('0x2'));var BPromise=require('bluebird');var rs=require(_0x4dbb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4dbb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4dbb('0x5'))(_0x4dbb('0x6'));var config=require(_0x4dbb('0x7'));var jayson=require(_0x4dbb('0x8'));var client=jayson[_0x4dbb('0x9')][_0x4dbb('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x4dbb('0xb'),'port':0x18eb});var socket=require(_0x4dbb('0xc'))(new Redis(config[_0x4dbb('0xd')]));require(_0x4dbb('0xe'))[_0x4dbb('0xf')](socket);function respondWithRpcPromise(_0x58847b,_0x3473b0,_0x94144){return new BPromise(function(_0x538f9b,_0x5e7089){return client[_0x4dbb('0x10')](_0x58847b,_0x94144)[_0x4dbb('0x11')](function(_0x3b5a32){logger[_0x4dbb('0x12')]('SmsAccount,\x20%s,\x20%s',_0x3473b0,_0x4dbb('0x13'));logger[_0x4dbb('0x14')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3473b0,_0x4dbb('0x13'),JSON[_0x4dbb('0x15')](_0x3b5a32));if(_0x3b5a32[_0x4dbb('0x16')]){if(_0x3b5a32[_0x4dbb('0x16')][_0x4dbb('0x17')]===0x1f4){logger[_0x4dbb('0x16')](_0x4dbb('0x18'),_0x3473b0,_0x3b5a32[_0x4dbb('0x16')]['message']);return _0x5e7089(_0x3b5a32[_0x4dbb('0x16')][_0x4dbb('0x19')]);}logger['error'](_0x4dbb('0x18'),_0x3473b0,_0x3b5a32['error'][_0x4dbb('0x19')]);return _0x538f9b(_0x3b5a32[_0x4dbb('0x16')][_0x4dbb('0x19')]);}else{logger[_0x4dbb('0x12')]('SmsAccount,\x20%s,\x20%s',_0x3473b0,_0x4dbb('0x13'));_0x538f9b(_0x3b5a32['result'][_0x4dbb('0x19')]);}})[_0x4dbb('0x1a')](function(_0x53ef67){logger[_0x4dbb('0x16')](_0x4dbb('0x18'),_0x3473b0,_0x53ef67);_0x5e7089(_0x53ef67);});});}exports['ShowSmsAccount']=function(_0x5793a3){var _0x191635=this;return new Promise(function(_0x2c7c2c,_0x2b0461){return db['SmsAccount'][_0x4dbb('0x1b')]({'raw':_0x5793a3[_0x4dbb('0x1c')]?_0x5793a3['options']['raw']===undefined?!![]:![]:!![],'where':_0x5793a3[_0x4dbb('0x1c')]?_0x5793a3[_0x4dbb('0x1c')][_0x4dbb('0x1d')]||null:null,'attributes':_0x5793a3[_0x4dbb('0x1c')]?_0x5793a3[_0x4dbb('0x1c')][_0x4dbb('0x1e')]||null:null,'include':_0x5793a3[_0x4dbb('0x1c')]?_0x5793a3[_0x4dbb('0x1c')][_0x4dbb('0x1f')]?_[_0x4dbb('0x20')](_0x5793a3[_0x4dbb('0x1c')]['include'],function(_0x313827){return{'model':db[_0x313827['model']],'as':_0x313827['as'],'attributes':_0x313827[_0x4dbb('0x1e')],'include':_0x313827['include']?_[_0x4dbb('0x20')](_0x313827[_0x4dbb('0x1f')],function(_0x154d5f){return{'model':db[_0x154d5f[_0x4dbb('0x21')]],'as':_0x154d5f['as'],'attributes':_0x154d5f[_0x4dbb('0x1e')],'include':_0x154d5f['include']?_[_0x4dbb('0x20')](_0x154d5f['include'],function(_0x3102b1){return{'model':db[_0x3102b1[_0x4dbb('0x21')]],'as':_0x3102b1['as'],'attributes':_0x3102b1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xd49cc9){logger[_0x4dbb('0x12')]('ShowSmsAccount',_0x5793a3);logger[_0x4dbb('0x14')](_0x4dbb('0x22'),_0x5793a3,JSON[_0x4dbb('0x15')](_0xd49cc9));_0x2c7c2c(_0xd49cc9);})[_0x4dbb('0x1a')](function(_0xb267e2){logger[_0x4dbb('0x16')](_0x4dbb('0x22'),_0xb267e2[_0x4dbb('0x19')],_0x5793a3);_0x2b0461(_0x191635[_0x4dbb('0x16')](0x1f4,_0xb267e2['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index f78e237..f8d4398 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 d99e789..d92fc96 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 _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x104662,_0x53a7a7){var _0x19cba7=function(_0x5a76c0){while(--_0x5a76c0){_0x104662['push'](_0x104662['shift']());}};_0x19cba7(++_0x53a7a7);}(_0x3e74,0x175));var _0x43e7=function(_0x4317ca,_0x362e5f){_0x4317ca=_0x4317ca-0x0;var _0x5caef7=_0x3e74[_0x4317ca];return _0x5caef7;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +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(_0x3b4ce8,_0x451662){var _0x1b101e=function(_0x5a02ca){while(--_0x5a02ca){_0x3b4ce8['push'](_0x3b4ce8['shift']());}};_0x1b101e(++_0x451662);}(_0x55ca,0x126));var _0xa55c=function(_0x9709ce,_0x5765af){_0x9709ce=_0x9709ce-0x0;var _0x414c87=_0x55ca[_0x9709ce];return _0x414c87;};'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 87a939d..5b8a1cb 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 _0x5fc5=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x4c7ca4,_0x1d16c3){var _0x458a46=function(_0x5bed47){while(--_0x5bed47){_0x4c7ca4['push'](_0x4c7ca4['shift']());}};_0x458a46(++_0x1d16c3);}(_0x5fc5,0x114));var _0x55fc=function(_0x39e24a,_0x5403e8){_0x39e24a=_0x39e24a-0x0;var _0x36c11a=_0x5fc5[_0x39e24a];return _0x36c11a;};'use strict';var Sequelize=require(_0x55fc('0x0'));module[_0x55fc('0x1')]={'priority':{'type':Sequelize[_0x55fc('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x55fc('0x3')],'allowNull':![],'defaultValue':_0x55fc('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x55fc('0x3')],'defaultValue':_0x55fc('0x5')}}; \ No newline at end of file +var _0x3d62=['sequelize','STRING','TEXT','*,*,*,*'];(function(_0x1fa387,_0x40e45f){var _0x2f0101=function(_0x55e833){while(--_0x55e833){_0x1fa387['push'](_0x1fa387['shift']());}};_0x2f0101(++_0x40e45f);}(_0x3d62,0x160));var _0x23d6=function(_0x2e1c33,_0x39bb52){_0x2e1c33=_0x2e1c33-0x0;var _0x575939=_0x3d62[_0x2e1c33];return _0x575939;};'use strict';var Sequelize=require(_0x23d6('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x23d6('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x23d6('0x2')]()},'description':{'type':Sequelize[_0x23d6('0x1')]},'interval':{'type':Sequelize[_0x23d6('0x1')],'defaultValue':_0x23d6('0x3')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 5e379c0..5ee6002 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 _0xa599=['../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','SmsApplication','includeAll','include','rows','catch','show','params','keys','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0x546324,_0x4b00c9){var _0x3eb7a1=function(_0x199fe7){while(--_0x199fe7){_0x546324['push'](_0x546324['shift']());}};_0x3eb7a1(++_0x4b00c9);}(_0xa599,0x168));var _0x9a59=function(_0x1cf34a,_0x15f5bc){_0x1cf34a=_0x1cf34a-0x0;var _0x41765f=_0xa599[_0x1cf34a];return _0x41765f;};'use strict';var emlformat=require(_0x9a59('0x0'));var rimraf=require(_0x9a59('0x1'));var zipdir=require(_0x9a59('0x2'));var jsonpatch=require(_0x9a59('0x3'));var rp=require(_0x9a59('0x4'));var moment=require(_0x9a59('0x5'));var BPromise=require(_0x9a59('0x6'));var Mustache=require(_0x9a59('0x7'));var util=require(_0x9a59('0x8'));var path=require(_0x9a59('0x9'));var sox=require(_0x9a59('0xa'));var csv=require(_0x9a59('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a59('0xc'));var _=require(_0x9a59('0xd'));var squel=require(_0x9a59('0xe'));var crypto=require(_0x9a59('0xf'));var jsforce=require(_0x9a59('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9a59('0x11'));var Redis=require(_0x9a59('0x12'));var authService=require(_0x9a59('0x13'));var qs=require(_0x9a59('0x14'));var as=require(_0x9a59('0x15'));var hardwareService=require(_0x9a59('0x16'));var logger=require(_0x9a59('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x9a59('0x18'));var licenseUtil=require(_0x9a59('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35dcdf,_0x330303){_0x330303=_0x330303||0xcc;return function(_0x649cd2){if(_0x649cd2){return _0x35dcdf[_0x9a59('0x1a')](_0x330303);}return _0x35dcdf[_0x9a59('0x1b')](_0x330303)[_0x9a59('0x1c')]();};}function respondWithResult(_0x44dc62,_0x48f67d){_0x48f67d=_0x48f67d||0xc8;return function(_0x3e0e63){if(_0x3e0e63){return _0x44dc62[_0x9a59('0x1b')](_0x48f67d)[_0x9a59('0x1d')](_0x3e0e63);}};}function respondWithFilteredResult(_0x4d92e8,_0x26df92){return function(_0x2e80b5){if(_0x2e80b5){var _0x22fa86=typeof _0x26df92['offset']===_0x9a59('0x1e')&&typeof _0x26df92[_0x9a59('0x1f')]===_0x9a59('0x1e');var _0x4af731=_0x2e80b5[_0x9a59('0x20')];var _0x85ae1=_0x22fa86?0x0:_0x26df92[_0x9a59('0x21')];var _0x26ac08=_0x22fa86?_0x2e80b5[_0x9a59('0x20')]:_0x26df92[_0x9a59('0x21')]+_0x26df92[_0x9a59('0x1f')];var _0x51e30c;if(_0x26ac08>=_0x4af731){_0x26ac08=_0x4af731;_0x51e30c=0xc8;}else{_0x51e30c=0xce;}_0x4d92e8[_0x9a59('0x1b')](_0x51e30c);return _0x4d92e8['set'](_0x9a59('0x22'),_0x85ae1+'-'+_0x26ac08+'/'+_0x4af731)[_0x9a59('0x1d')](_0x2e80b5);}return null;};}function patchUpdates(_0x649290){return function(_0x17caa8){try{jsonpatch[_0x9a59('0x23')](_0x17caa8,_0x649290,!![]);}catch(_0x3bb980){return BPromise[_0x9a59('0x24')](_0x3bb980);}return _0x17caa8[_0x9a59('0x25')]();};}function saveUpdates(_0x3d883e,_0x5c3ce1){return function(_0x5b7cb3){if(_0x5b7cb3){return _0x5b7cb3[_0x9a59('0x26')](_0x3d883e)[_0x9a59('0x27')](function(_0x3ff4bd){return _0x3ff4bd;});}return null;};}function removeEntity(_0x34d450,_0x2b5bd8){return function(_0x236b43){if(_0x236b43){return _0x236b43[_0x9a59('0x28')]()[_0x9a59('0x27')](function(){_0x34d450[_0x9a59('0x1b')](0xcc)[_0x9a59('0x1c')]();});}};}function handleEntityNotFound(_0x55a546,_0x2dd7ba){return function(_0x5b8680){if(!_0x5b8680){_0x55a546[_0x9a59('0x1a')](0x194);}return _0x5b8680;};}function handleError(_0x1d1c12,_0x4fc159){_0x4fc159=_0x4fc159||0x1f4;return function(_0x423bf4){logger[_0x9a59('0x29')](_0x423bf4[_0x9a59('0x2a')]);if(_0x423bf4[_0x9a59('0x2b')]){delete _0x423bf4['name'];}_0x1d1c12[_0x9a59('0x1b')](_0x4fc159)[_0x9a59('0x2c')](_0x423bf4);};}exports[_0x9a59('0x2d')]=function(_0x4a97fa,_0x1aaa65){var _0x4925b6={},_0x967864={},_0x5f1378={'count':0x0,'rows':[]};var _0x3dbead=_[_0x9a59('0x2e')](db['SmsApplication'][_0x9a59('0x2f')],function(_0x412d96){return{'name':_0x412d96['fieldName'],'type':_0x412d96[_0x9a59('0x30')][_0x9a59('0x31')]};});_0x967864[_0x9a59('0x32')]=_['map'](_0x3dbead,_0x9a59('0x2b'));_0x967864[_0x9a59('0x33')]=_['keys'](_0x4a97fa[_0x9a59('0x33')]);_0x967864['filters']=_[_0x9a59('0x34')](_0x967864[_0x9a59('0x32')],_0x967864[_0x9a59('0x33')]);_0x4925b6[_0x9a59('0x35')]=_[_0x9a59('0x34')](_0x967864[_0x9a59('0x32')],qs[_0x9a59('0x36')](_0x4a97fa[_0x9a59('0x33')][_0x9a59('0x36')]));_0x4925b6[_0x9a59('0x35')]=_0x4925b6[_0x9a59('0x35')][_0x9a59('0x37')]?_0x4925b6[_0x9a59('0x35')]:_0x967864[_0x9a59('0x32')];if(!_0x4a97fa[_0x9a59('0x33')][_0x9a59('0x38')](_0x9a59('0x39'))){_0x4925b6[_0x9a59('0x1f')]=qs[_0x9a59('0x1f')](_0x4a97fa['query']['limit']);_0x4925b6[_0x9a59('0x21')]=qs[_0x9a59('0x21')](_0x4a97fa['query'][_0x9a59('0x21')]);}_0x4925b6[_0x9a59('0x3a')]=qs[_0x9a59('0x3b')](_0x4a97fa[_0x9a59('0x33')][_0x9a59('0x3b')]);_0x4925b6['where']=qs[_0x9a59('0x3c')](_[_0x9a59('0x3d')](_0x4a97fa['query'],_0x967864[_0x9a59('0x3c')]),_0x3dbead);if(_0x4a97fa[_0x9a59('0x33')][_0x9a59('0x3e')]){_0x4925b6[_0x9a59('0x3f')]=_[_0x9a59('0x40')](_0x4925b6['where'],{'$or':_['map'](_0x3dbead,function(_0x96da1a){if(_0x96da1a[_0x9a59('0x30')]!=='VIRTUAL'){var _0x42a5b4={};_0x42a5b4[_0x96da1a[_0x9a59('0x2b')]]={'$like':'%'+_0x4a97fa[_0x9a59('0x33')][_0x9a59('0x3e')]+'%'};return _0x42a5b4;}})});}_0x4925b6=_[_0x9a59('0x40')]({},_0x4925b6,_0x4a97fa['options']);var _0x288385={'where':_0x4925b6[_0x9a59('0x3f')]};return db[_0x9a59('0x41')]['count'](_0x288385)[_0x9a59('0x27')](function(_0x226e47){_0x5f1378['count']=_0x226e47;if(_0x4a97fa[_0x9a59('0x33')][_0x9a59('0x42')]){_0x4925b6[_0x9a59('0x43')]=[{'all':!![]}];}return db[_0x9a59('0x41')]['findAll'](_0x4925b6);})[_0x9a59('0x27')](function(_0x2bf7d8){_0x5f1378[_0x9a59('0x44')]=_0x2bf7d8;return _0x5f1378;})[_0x9a59('0x27')](respondWithFilteredResult(_0x1aaa65,_0x4925b6))[_0x9a59('0x45')](handleError(_0x1aaa65,null));};exports[_0x9a59('0x46')]=function(_0x1cd18a,_0x5b8769){var _0x4e8275={'raw':!![],'where':{'id':_0x1cd18a[_0x9a59('0x47')]['id']}},_0x4620a6={};_0x4620a6[_0x9a59('0x32')]=_['keys'](db[_0x9a59('0x41')][_0x9a59('0x2f')]);_0x4620a6[_0x9a59('0x33')]=_[_0x9a59('0x48')](_0x1cd18a['query']);_0x4620a6[_0x9a59('0x3c')]=_[_0x9a59('0x34')](_0x4620a6[_0x9a59('0x32')],_0x4620a6[_0x9a59('0x33')]);_0x4e8275[_0x9a59('0x35')]=_[_0x9a59('0x34')](_0x4620a6[_0x9a59('0x32')],qs[_0x9a59('0x36')](_0x1cd18a[_0x9a59('0x33')]['fields']));_0x4e8275[_0x9a59('0x35')]=_0x4e8275[_0x9a59('0x35')]['length']?_0x4e8275[_0x9a59('0x35')]:_0x4620a6['model'];if(_0x1cd18a[_0x9a59('0x33')][_0x9a59('0x42')]){_0x4e8275['include']=[{'all':!![]}];}_0x4e8275=_[_0x9a59('0x40')]({},_0x4e8275,_0x1cd18a[_0x9a59('0x49')]);return db[_0x9a59('0x41')][_0x9a59('0x4a')](_0x4e8275)[_0x9a59('0x27')](handleEntityNotFound(_0x5b8769,null))['then'](respondWithResult(_0x5b8769,null))[_0x9a59('0x45')](handleError(_0x5b8769,null));};exports['create']=function(_0x4a2f5c,_0x5130aa){return db[_0x9a59('0x41')][_0x9a59('0x4b')](_0x4a2f5c[_0x9a59('0x4c')],{})[_0x9a59('0x27')](respondWithResult(_0x5130aa,0xc9))[_0x9a59('0x45')](handleError(_0x5130aa,null));};exports['update']=function(_0x1b0f2f,_0x1d3993){if(_0x1b0f2f[_0x9a59('0x4c')]['id']){delete _0x1b0f2f[_0x9a59('0x4c')]['id'];}return db[_0x9a59('0x41')]['find']({'where':{'id':_0x1b0f2f[_0x9a59('0x47')]['id']}})[_0x9a59('0x27')](handleEntityNotFound(_0x1d3993,null))[_0x9a59('0x27')](saveUpdates(_0x1b0f2f['body'],null))[_0x9a59('0x27')](respondWithResult(_0x1d3993,null))['catch'](handleError(_0x1d3993,null));};exports[_0x9a59('0x28')]=function(_0x46f6a2,_0x4d67ec){return db[_0x9a59('0x41')][_0x9a59('0x4a')]({'where':{'id':_0x46f6a2[_0x9a59('0x47')]['id']}})[_0x9a59('0x27')](handleEntityNotFound(_0x4d67ec,null))[_0x9a59('0x27')](removeEntity(_0x4d67ec,null))[_0x9a59('0x45')](handleError(_0x4d67ec,null));}; \ No newline at end of file +var _0x834b=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','map','SmsApplication','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs'];(function(_0x2c44f0,_0x360da4){var _0x2cc257=function(_0x28d45e){while(--_0x28d45e){_0x2c44f0['push'](_0x2c44f0['shift']());}};_0x2cc257(++_0x360da4);}(_0x834b,0x81));var _0xb834=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x834b[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xb834('0x0'));var rimraf=require(_0xb834('0x1'));var zipdir=require(_0xb834('0x2'));var jsonpatch=require(_0xb834('0x3'));var rp=require(_0xb834('0x4'));var moment=require(_0xb834('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb834('0x6'));var util=require(_0xb834('0x7'));var path=require(_0xb834('0x8'));var sox=require(_0xb834('0x9'));var csv=require(_0xb834('0xa'));var ejs=require(_0xb834('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb834('0xc'));var squel=require(_0xb834('0xd'));var crypto=require(_0xb834('0xe'));var jsforce=require(_0xb834('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb834('0xa'));var querystring=require('querystring');var Papa=require(_0xb834('0x10'));var Redis=require(_0xb834('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb834('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb834('0x13'));var logger=require(_0xb834('0x14'))(_0xb834('0x15'));var utils=require(_0xb834('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb834('0x17'));var db=require(_0xb834('0x18'))['db'];function respondWithStatusCode(_0x1fefbd,_0x552562){_0x552562=_0x552562||0xcc;return function(_0x4de3dc){if(_0x4de3dc){return _0x1fefbd[_0xb834('0x19')](_0x552562);}return _0x1fefbd[_0xb834('0x1a')](_0x552562)['end']();};}function respondWithResult(_0x329132,_0x58b918){_0x58b918=_0x58b918||0xc8;return function(_0x2ae4ea){if(_0x2ae4ea){return _0x329132[_0xb834('0x1a')](_0x58b918)[_0xb834('0x1b')](_0x2ae4ea);}};}function respondWithFilteredResult(_0xa19fc3,_0x5002b5){return function(_0x5c4161){if(_0x5c4161){var _0x67b060=typeof _0x5002b5['offset']==='undefined'&&typeof _0x5002b5[_0xb834('0x1c')]===_0xb834('0x1d');var _0x2c4f42=_0x5c4161[_0xb834('0x1e')];var _0x15df98=_0x67b060?0x0:_0x5002b5[_0xb834('0x1f')];var _0x214224=_0x67b060?_0x5c4161[_0xb834('0x1e')]:_0x5002b5[_0xb834('0x1f')]+_0x5002b5['limit'];var _0x4d7601;if(_0x214224>=_0x2c4f42){_0x214224=_0x2c4f42;_0x4d7601=0xc8;}else{_0x4d7601=0xce;}_0xa19fc3[_0xb834('0x1a')](_0x4d7601);return _0xa19fc3[_0xb834('0x20')](_0xb834('0x21'),_0x15df98+'-'+_0x214224+'/'+_0x2c4f42)[_0xb834('0x1b')](_0x5c4161);}return null;};}function patchUpdates(_0x3eded8){return function(_0x179e69){try{jsonpatch[_0xb834('0x22')](_0x179e69,_0x3eded8,!![]);}catch(_0x166e2c){return BPromise[_0xb834('0x23')](_0x166e2c);}return _0x179e69['save']();};}function saveUpdates(_0x396917,_0x1bc92c){return function(_0x22b920){if(_0x22b920){return _0x22b920[_0xb834('0x24')](_0x396917)[_0xb834('0x25')](function(_0x36e6d1){return _0x36e6d1;});}return null;};}function removeEntity(_0x210f99,_0x19a054){return function(_0x4d3ee3){if(_0x4d3ee3){return _0x4d3ee3[_0xb834('0x26')]()[_0xb834('0x25')](function(){_0x210f99[_0xb834('0x1a')](0xcc)[_0xb834('0x27')]();});}};}function handleEntityNotFound(_0x5fcf5,_0x36a46c){return function(_0x30261d){if(!_0x30261d){_0x5fcf5[_0xb834('0x19')](0x194);}return _0x30261d;};}function handleError(_0x20d8f9,_0x103ab0){_0x103ab0=_0x103ab0||0x1f4;return function(_0x5ec47c){logger[_0xb834('0x28')](_0x5ec47c[_0xb834('0x29')]);if(_0x5ec47c['name']){delete _0x5ec47c[_0xb834('0x2a')];}_0x20d8f9[_0xb834('0x1a')](_0x103ab0)[_0xb834('0x2b')](_0x5ec47c);};}exports['index']=function(_0x1e89f5,_0x363059){var _0x455aff={},_0x5847fe={},_0x1c1a69={'count':0x0,'rows':[]};var _0x20f07a=_[_0xb834('0x2c')](db[_0xb834('0x2d')]['rawAttributes'],function(_0x32ed2c){return{'name':_0x32ed2c[_0xb834('0x2e')],'type':_0x32ed2c['type']['key']};});_0x5847fe[_0xb834('0x2f')]=_[_0xb834('0x2c')](_0x20f07a,_0xb834('0x2a'));_0x5847fe[_0xb834('0x30')]=_[_0xb834('0x31')](_0x1e89f5['query']);_0x5847fe['filters']=_[_0xb834('0x32')](_0x5847fe[_0xb834('0x2f')],_0x5847fe['query']);_0x455aff[_0xb834('0x33')]=_[_0xb834('0x32')](_0x5847fe[_0xb834('0x2f')],qs[_0xb834('0x34')](_0x1e89f5[_0xb834('0x30')][_0xb834('0x34')]));_0x455aff['attributes']=_0x455aff[_0xb834('0x33')][_0xb834('0x35')]?_0x455aff[_0xb834('0x33')]:_0x5847fe['model'];if(!_0x1e89f5['query'][_0xb834('0x36')]('nolimit')){_0x455aff[_0xb834('0x1c')]=qs[_0xb834('0x1c')](_0x1e89f5[_0xb834('0x30')][_0xb834('0x1c')]);_0x455aff[_0xb834('0x1f')]=qs[_0xb834('0x1f')](_0x1e89f5[_0xb834('0x30')][_0xb834('0x1f')]);}_0x455aff[_0xb834('0x37')]=qs[_0xb834('0x38')](_0x1e89f5[_0xb834('0x30')]['sort']);_0x455aff['where']=qs[_0xb834('0x39')](_['pick'](_0x1e89f5[_0xb834('0x30')],_0x5847fe[_0xb834('0x39')]),_0x20f07a);if(_0x1e89f5[_0xb834('0x30')][_0xb834('0x3a')]){_0x455aff[_0xb834('0x3b')]=_[_0xb834('0x3c')](_0x455aff[_0xb834('0x3b')],{'$or':_[_0xb834('0x2c')](_0x20f07a,function(_0x36f75d){if(_0x36f75d[_0xb834('0x3d')]!==_0xb834('0x3e')){var _0x234713={};_0x234713[_0x36f75d['name']]={'$like':'%'+_0x1e89f5[_0xb834('0x30')][_0xb834('0x3a')]+'%'};return _0x234713;}})});}_0x455aff=_[_0xb834('0x3c')]({},_0x455aff,_0x1e89f5['options']);var _0xb7494={'where':_0x455aff['where']};return db[_0xb834('0x2d')][_0xb834('0x1e')](_0xb7494)['then'](function(_0x55e1cb){_0x1c1a69[_0xb834('0x1e')]=_0x55e1cb;if(_0x1e89f5[_0xb834('0x30')][_0xb834('0x3f')]){_0x455aff[_0xb834('0x40')]=[{'all':!![]}];}return db[_0xb834('0x2d')][_0xb834('0x41')](_0x455aff);})[_0xb834('0x25')](function(_0x77d3b8){_0x1c1a69[_0xb834('0x42')]=_0x77d3b8;return _0x1c1a69;})[_0xb834('0x25')](respondWithFilteredResult(_0x363059,_0x455aff))[_0xb834('0x43')](handleError(_0x363059,null));};exports[_0xb834('0x44')]=function(_0xb88021,_0x4b94ef){var _0x563b98={'raw':!![],'where':{'id':_0xb88021[_0xb834('0x45')]['id']}},_0x43bbff={};_0x43bbff[_0xb834('0x2f')]=_['keys'](db['SmsApplication']['rawAttributes']);_0x43bbff[_0xb834('0x30')]=_[_0xb834('0x31')](_0xb88021[_0xb834('0x30')]);_0x43bbff[_0xb834('0x39')]=_[_0xb834('0x32')](_0x43bbff[_0xb834('0x2f')],_0x43bbff[_0xb834('0x30')]);_0x563b98[_0xb834('0x33')]=_[_0xb834('0x32')](_0x43bbff[_0xb834('0x2f')],qs[_0xb834('0x34')](_0xb88021[_0xb834('0x30')]['fields']));_0x563b98['attributes']=_0x563b98[_0xb834('0x33')][_0xb834('0x35')]?_0x563b98[_0xb834('0x33')]:_0x43bbff[_0xb834('0x2f')];if(_0xb88021[_0xb834('0x30')][_0xb834('0x3f')]){_0x563b98[_0xb834('0x40')]=[{'all':!![]}];}_0x563b98=_['merge']({},_0x563b98,_0xb88021[_0xb834('0x46')]);return db[_0xb834('0x2d')]['find'](_0x563b98)[_0xb834('0x25')](handleEntityNotFound(_0x4b94ef,null))['then'](respondWithResult(_0x4b94ef,null))[_0xb834('0x43')](handleError(_0x4b94ef,null));};exports[_0xb834('0x47')]=function(_0x46ba54,_0x1d3829){return db['SmsApplication'][_0xb834('0x47')](_0x46ba54[_0xb834('0x48')],{})[_0xb834('0x25')](respondWithResult(_0x1d3829,0xc9))['catch'](handleError(_0x1d3829,null));};exports[_0xb834('0x24')]=function(_0x5031b5,_0x1651bb){if(_0x5031b5[_0xb834('0x48')]['id']){delete _0x5031b5[_0xb834('0x48')]['id'];}return db['SmsApplication'][_0xb834('0x49')]({'where':{'id':_0x5031b5[_0xb834('0x45')]['id']}})[_0xb834('0x25')](handleEntityNotFound(_0x1651bb,null))['then'](saveUpdates(_0x5031b5['body'],null))[_0xb834('0x25')](respondWithResult(_0x1651bb,null))['catch'](handleError(_0x1651bb,null));};exports[_0xb834('0x26')]=function(_0x2a0310,_0x54a848){return db[_0xb834('0x2d')][_0xb834('0x49')]({'where':{'id':_0x2a0310[_0xb834('0x45')]['id']}})[_0xb834('0x25')](handleEntityNotFound(_0x54a848,null))['then'](removeEntity(_0x54a848,null))[_0xb834('0x43')](handleError(_0x54a848,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index ce74143..2b56ba4 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 _0x1c00=['utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4'];(function(_0x1ac562,_0x270a2d){var _0x483610=function(_0x1eb389){while(--_0x1eb389){_0x1ac562['push'](_0x1ac562['shift']());}};_0x483610(++_0x270a2d);}(_0x1c00,0x1dd));var _0x01c0=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x1c00[_0xc67528];return _0x38e26d;};'use strict';var _=require(_0x01c0('0x0'));var util=require(_0x01c0('0x1'));var logger=require(_0x01c0('0x2'))('api');var moment=require(_0x01c0('0x3'));var BPromise=require(_0x01c0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x01c0('0x5'));var config=require(_0x01c0('0x6'));var attributes=require(_0x01c0('0x7'));module[_0x01c0('0x8')]=function(_0x47a7ab,_0x231a87){return _0x47a7ab[_0x01c0('0x9')](_0x01c0('0xa'),attributes,{'tableName':_0x01c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x01c0('0xc'),'collate':_0x01c0('0xd')});}; \ No newline at end of file +var _0x4605=['utf8mb4','util','../../config/logger','moment','request-promise','path','./smsApplication.attributes','exports','define','SmsApplication'];(function(_0x4322be,_0x2eb61a){var _0x420514=function(_0x861ad7){while(--_0x861ad7){_0x4322be['push'](_0x4322be['shift']());}};_0x420514(++_0x2eb61a);}(_0x4605,0xb5));var _0x5460=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x4605[_0x59befa];return _0x1dd63d;};'use strict';var _=require('lodash');var util=require(_0x5460('0x0'));var logger=require(_0x5460('0x1'))('api');var moment=require(_0x5460('0x2'));var BPromise=require('bluebird');var rp=require(_0x5460('0x3'));var fs=require('fs');var path=require(_0x5460('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5460('0x5'));module[_0x5460('0x6')]=function(_0xf109af,_0x31ea6d){return _0xf109af[_0x5460('0x7')](_0x5460('0x8'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5460('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index d86fa1b..99b04e7 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 _0xa03c=['info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3a1bff,_0x327872){var _0x3cf7b7=function(_0x470915){while(--_0x470915){_0x3a1bff['push'](_0x3a1bff['shift']());}};_0x3cf7b7(++_0x327872);}(_0xa03c,0x94));var _0xca03=function(_0x30b39e,_0x284078){_0x30b39e=_0x30b39e-0x0;var _0x5d7dfe=_0xa03c[_0x30b39e];return _0x5d7dfe;};'use strict';var _=require(_0xca03('0x0'));var util=require('util');var moment=require(_0xca03('0x1'));var BPromise=require(_0xca03('0x2'));var rs=require(_0xca03('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca03('0x4'))['db'];var utils=require(_0xca03('0x5'));var logger=require(_0xca03('0x6'))('rpc');var config=require(_0xca03('0x7'));var jayson=require(_0xca03('0x8'));var client=jayson[_0xca03('0x9')][_0xca03('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27aac6,_0x9d2b3d,_0x52f12e){return new BPromise(function(_0x1832cc,_0x18ddee){return client[_0xca03('0xb')](_0x27aac6,_0x52f12e)[_0xca03('0xc')](function(_0x31e7be){logger[_0xca03('0xd')](_0xca03('0xe'),_0x9d2b3d,_0xca03('0xf'));logger[_0xca03('0x10')](_0xca03('0x11'),_0x9d2b3d,'request\x20sent',JSON[_0xca03('0x12')](_0x31e7be));if(_0x31e7be[_0xca03('0x13')]){if(_0x31e7be[_0xca03('0x13')][_0xca03('0x14')]===0x1f4){logger[_0xca03('0x13')](_0xca03('0xe'),_0x9d2b3d,_0x31e7be[_0xca03('0x13')][_0xca03('0x15')]);return _0x18ddee(_0x31e7be[_0xca03('0x13')][_0xca03('0x15')]);}logger[_0xca03('0x13')](_0xca03('0xe'),_0x9d2b3d,_0x31e7be[_0xca03('0x13')][_0xca03('0x15')]);return _0x1832cc(_0x31e7be[_0xca03('0x13')][_0xca03('0x15')]);}else{logger[_0xca03('0xd')](_0xca03('0xe'),_0x9d2b3d,_0xca03('0xf'));_0x1832cc(_0x31e7be['result'][_0xca03('0x15')]);}})[_0xca03('0x16')](function(_0x184313){logger[_0xca03('0x13')](_0xca03('0xe'),_0x9d2b3d,_0x184313);_0x18ddee(_0x184313);});});} \ No newline at end of file +var _0x881e=['stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SmsApplication,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x4c710c,_0x2d9560){var _0x229e1b=function(_0x1e432c){while(--_0x1e432c){_0x4c710c['push'](_0x4c710c['shift']());}};_0x229e1b(++_0x2d9560);}(_0x881e,0x146));var _0xe881=function(_0x311d58,_0x2ee6cb){_0x311d58=_0x311d58-0x0;var _0x4e58e6=_0x881e[_0x311d58];return _0x4e58e6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe881('0x0'));var BPromise=require(_0xe881('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe881('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe881('0x3'));var logger=require(_0xe881('0x4'))(_0xe881('0x5'));var config=require(_0xe881('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe881('0x7')][_0xe881('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x561c1c,_0x3f6894,_0x2413dc){return new BPromise(function(_0xe16d23,_0x547217){return client['request'](_0x561c1c,_0x2413dc)[_0xe881('0x9')](function(_0x26e29e){logger[_0xe881('0xa')](_0xe881('0xb'),_0x3f6894,'request\x20sent');logger[_0xe881('0xc')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x3f6894,_0xe881('0xd'),JSON[_0xe881('0xe')](_0x26e29e));if(_0x26e29e[_0xe881('0xf')]){if(_0x26e29e[_0xe881('0xf')][_0xe881('0x10')]===0x1f4){logger[_0xe881('0xf')](_0xe881('0xb'),_0x3f6894,_0x26e29e['error'][_0xe881('0x11')]);return _0x547217(_0x26e29e[_0xe881('0xf')][_0xe881('0x11')]);}logger['error'](_0xe881('0xb'),_0x3f6894,_0x26e29e['error'][_0xe881('0x11')]);return _0xe16d23(_0x26e29e[_0xe881('0xf')][_0xe881('0x11')]);}else{logger[_0xe881('0xa')]('SmsApplication,\x20%s,\x20%s',_0x3f6894,_0xe881('0xd'));_0xe16d23(_0x26e29e[_0xe881('0x12')][_0xe881('0x11')]);}})[_0xe881('0x13')](function(_0x59b441){logger[_0xe881('0xf')](_0xe881('0xb'),_0x3f6894,_0x59b441);_0x547217(_0x59b441);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 5fd3ccd..31e66ce 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 _0x6324=['isAuthenticated','index','describe','show','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','/:id','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get'];(function(_0xa8da9e,_0x15e225){var _0x2ab795=function(_0x47f002){while(--_0x47f002){_0xa8da9e['push'](_0xa8da9e['shift']());}};_0x2ab795(++_0x15e225);}(_0x6324,0x142));var _0x4632=function(_0x47d6dc,_0xc036cc){_0x47d6dc=_0x47d6dc-0x0;var _0x1a1c93=_0x6324[_0x47d6dc];return _0x1a1c93;};'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('./smsInteraction.controller');router[_0x4632('0x7')]('/',auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0x7')]('/describe',auth[_0x4632('0x8')](),controller[_0x4632('0xa')]);router[_0x4632('0x7')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xb')]);router['get']('/:id/messages',auth[_0x4632('0x8')](),controller[_0x4632('0xc')]);router[_0x4632('0x7')](_0x4632('0xd'),auth[_0x4632('0x8')](),controller[_0x4632('0xe')]);router[_0x4632('0xf')]('/',auth[_0x4632('0x8')](),controller['create']);router[_0x4632('0xf')]('/:id/messages',auth[_0x4632('0x8')](),controller[_0x4632('0x10')]);router[_0x4632('0xf')](_0x4632('0x11'),auth['isAuthenticated'](),interaction[_0x4632('0x12')](_0x4632('0x13'),_0x4632('0x14')),controller[_0x4632('0x15')]);router[_0x4632('0x16')]('/:id',auth['isAuthenticated'](),interaction[_0x4632('0x12')](_0x4632('0x13'),_0x4632('0x17')),controller[_0x4632('0x18')]);router['delete'](_0x4632('0x19'),auth[_0x4632('0x8')](),interaction[_0x4632('0x12')]('sms',_0x4632('0x1a')),controller[_0x4632('0x1b')]);router['delete']('/:id/tags',auth[_0x4632('0x8')](),controller[_0x4632('0x1c')]);module[_0x4632('0x1d')]=router; \ No newline at end of file +var _0x4024=['addTags','put','smsinteraction:update','update','delete','destroy','removeTags','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','download','create','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x4024,0x89));var _0x4402=function(_0x38ae31,_0x3b3d51){_0x38ae31=_0x38ae31-0x0;var _0x55589a=_0x4024[_0x38ae31];return _0x55589a;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./smsInteraction.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/describe',auth[_0x4402('0x7')](),controller['describe']);router['get'](_0x4402('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x4402('0x9')]('/:id/messages',auth[_0x4402('0x7')](),controller['getMessages']);router[_0x4402('0x9')]('/:id/download',auth[_0x4402('0x7')](),controller[_0x4402('0xb')]);router['post']('/',auth[_0x4402('0x7')](),controller[_0x4402('0xc')]);router[_0x4402('0xd')]('/:id/messages',auth[_0x4402('0x7')](),controller[_0x4402('0xe')]);router[_0x4402('0xd')](_0x4402('0xf'),auth[_0x4402('0x7')](),interaction[_0x4402('0x10')](_0x4402('0x11'),_0x4402('0x12')),controller[_0x4402('0x13')]);router[_0x4402('0x14')](_0x4402('0xa'),auth[_0x4402('0x7')](),interaction[_0x4402('0x10')](_0x4402('0x11'),_0x4402('0x15')),controller[_0x4402('0x16')]);router[_0x4402('0x17')](_0x4402('0xa'),auth[_0x4402('0x7')](),interaction[_0x4402('0x10')]('sms','smsinteraction:destroy'),controller[_0x4402('0x18')]);router[_0x4402('0x17')]('/:id/tags',auth[_0x4402('0x7')](),controller[_0x4402('0x19')]);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 d132c2e..b538bbe 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 _0x6596=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x270dbc,_0x124068){var _0x430c10=function(_0x20aa8b){while(--_0x20aa8b){_0x270dbc['push'](_0x270dbc['shift']());}};_0x430c10(++_0x124068);}(_0x6596,0x1d3));var _0x6659=function(_0x5468c2,_0x22dd1e){_0x5468c2=_0x5468c2-0x0;var _0x445aa3=_0x6596[_0x5468c2];return _0x445aa3;};'use strict';var Sequelize=require(_0x6659('0x0'));var moment=require(_0x6659('0x1'));module['exports']={'closed':{'type':Sequelize[_0x6659('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6659('0x3')]},'disposition':{'type':Sequelize[_0x6659('0x4')]},'secondDisposition':{'type':Sequelize[_0x6659('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6659('0x4')]},'note':{'type':Sequelize[_0x6659('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x6659('0x5')]('in',_0x6659('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6659('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x6659('0x5')]('in',_0x6659('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8d0a=['STRING','out','ENUM','sequelize','exports','BOOLEAN','DATE'];(function(_0x238f8a,_0x49de01){var _0x176856=function(_0x26966c){while(--_0x26966c){_0x238f8a['push'](_0x238f8a['shift']());}};_0x176856(++_0x49de01);}(_0x8d0a,0x65));var _0xa8d0=function(_0xfb10c3,_0x4eb3dd){_0xfb10c3=_0xfb10c3-0x0;var _0x3b57c7=_0x8d0a[_0xfb10c3];return _0x3b57c7;};'use strict';var Sequelize=require(_0xa8d0('0x0'));var moment=require('moment');module[_0xa8d0('0x1')]={'closed':{'type':Sequelize[_0xa8d0('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa8d0('0x3')]},'disposition':{'type':Sequelize[_0xa8d0('0x4')]},'secondDisposition':{'type':Sequelize[_0xa8d0('0x4')]},'thirdDisposition':{'type':Sequelize[_0xa8d0('0x4')]},'note':{'type':Sequelize[_0xa8d0('0x4')]},'phone':{'type':Sequelize[_0xa8d0('0x4')]},'read1stAt':{'type':Sequelize[_0xa8d0('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xa8d0('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa8d0('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xa8d0('0x6')]('in',_0xa8d0('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa8d0('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 3cded57..173ad4a 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 _0xe2b6=['disposition','Messages','out','lastName','read','renderFile','views','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','bluebird','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','status','end','json','offset','undefined','limit','count','then','destroy','sendStatus','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','include','merge','find','catch','create','body','update','describe','SmsMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','where','pick','filter','$gte','split','format','rows','addTags','setTags','spread','Tag','color','removeTags','download','toString','root','server','files','transcript-%d-%s.zip','join','push','User','fullname','Contact','firstName','createdAt','direction','secret','SmsAccount','Account','Owner','get','Sms','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5265c2,_0x22ed4f){var _0x2e3ef4=function(_0x549bcf){while(--_0x549bcf){_0x5265c2['push'](_0x5265c2['shift']());}};_0x2e3ef4(++_0x22ed4f);}(_0xe2b6,0x1d0));var _0x6e2b=function(_0x3b4b76,_0x597213){_0x3b4b76=_0x3b4b76-0x0;var _0x139509=_0xe2b6[_0x3b4b76];return _0x139509;};'use strict';var rimraf=require(_0x6e2b('0x0'));var zipdir=require(_0x6e2b('0x1'));var moment=require(_0x6e2b('0x2'));var BPromise=require(_0x6e2b('0x3'));var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6e2b('0x4'));var Redis=require(_0x6e2b('0x5'));var interaction=require(_0x6e2b('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0x6e2b('0x7'));var logger=require(_0x6e2b('0x8'))(_0x6e2b('0x9'));var config=require(_0x6e2b('0xa'));var db=require(_0x6e2b('0xb'))['db'];config[_0x6e2b('0xc')]=_[_0x6e2b('0xd')](config[_0x6e2b('0xc')],{'host':_0x6e2b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6e2b('0xc')]));require(_0x6e2b('0xf'))['register'](socket);function respondWithStatusCode(_0x14aa79,_0x53950c){_0x53950c=_0x53950c||0xcc;return function(_0x2cfa6e){if(_0x2cfa6e){return _0x14aa79['sendStatus'](_0x53950c);}return _0x14aa79[_0x6e2b('0x10')](_0x53950c)[_0x6e2b('0x11')]();};}function respondWithResult(_0x512a63,_0x50d8d4){_0x50d8d4=_0x50d8d4||0xc8;return function(_0x183310){if(_0x183310){return _0x512a63[_0x6e2b('0x10')](_0x50d8d4)[_0x6e2b('0x12')](_0x183310);}};}function respondWithFilteredResult(_0x7086e4,_0x1ed109){return function(_0x469769){if(_0x469769){var _0x42000c=typeof _0x1ed109[_0x6e2b('0x13')]===_0x6e2b('0x14')&&typeof _0x1ed109[_0x6e2b('0x15')]===_0x6e2b('0x14');var _0x2936c9=_0x469769['count'];var _0x33fdf7=_0x42000c?0x0:_0x1ed109['offset'];var _0x5b63ea=_0x42000c?_0x469769[_0x6e2b('0x16')]:_0x1ed109['offset']+_0x1ed109['limit'];var _0x5afc8b;if(_0x5b63ea>=_0x2936c9){_0x5b63ea=_0x2936c9;_0x5afc8b=0xc8;}else{_0x5afc8b=0xce;}_0x7086e4[_0x6e2b('0x10')](_0x5afc8b);return _0x7086e4['set']('Content-Range',_0x33fdf7+'-'+_0x5b63ea+'/'+_0x2936c9)[_0x6e2b('0x12')](_0x469769);}return null;};}function saveUpdates(_0x15858c){return function(_0xe8d40b){if(_0xe8d40b){return _0xe8d40b['update'](_0x15858c)[_0x6e2b('0x17')](function(_0x3c0287){return _0x3c0287;});}return null;};}function removeEntity(_0x4d0ef4){return function(_0x164efb){if(_0x164efb){return _0x164efb[_0x6e2b('0x18')]()[_0x6e2b('0x17')](function(){_0x4d0ef4[_0x6e2b('0x10')](0xcc)[_0x6e2b('0x11')]();});}};}function handleEntityNotFound(_0xa6514c){return function(_0x153faf){if(!_0x153faf){_0xa6514c[_0x6e2b('0x19')](0x194);}return _0x153faf;};}function handleError(_0x4435d4,_0x168951){_0x168951=_0x168951||0x1f4;return function(_0x9632){logger[_0x6e2b('0x1a')](_0x9632[_0x6e2b('0x1b')]);if(_0x9632[_0x6e2b('0x1c')]){delete _0x9632[_0x6e2b('0x1c')];}_0x4435d4[_0x6e2b('0x10')](_0x168951)[_0x6e2b('0x1d')](_0x9632);};}exports[_0x6e2b('0x1e')]=function(_0xe2b709,_0xff2430){var _0x41af5a={};var _0x5328d8=_[_0x6e2b('0x1f')](db[_0x6e2b('0x20')][_0x6e2b('0x21')],function(_0xc01528){return{'name':_0xc01528[_0x6e2b('0x22')],'type':_0xc01528[_0x6e2b('0x23')][_0x6e2b('0x24')]};});_0x41af5a=qs[_0x6e2b('0x25')](_0x5328d8,_0xe2b709);return interaction[_0x6e2b('0x26')](_0x6e2b('0x27'),_0xe2b709['query'],_0xe2b709['user'],_0x41af5a,_0x5328d8)['then'](respondWithFilteredResult(_0xff2430,_0x41af5a))['catch'](handleError(_0xff2430,null));};exports[_0x6e2b('0x28')]=function(_0x7dc028,_0x2d34ca){var _0x50d6da={'raw':![],'where':{'id':_0x7dc028[_0x6e2b('0x29')]['id']}},_0x1facad={};_0x1facad[_0x6e2b('0x2a')]=_['keys'](db[_0x6e2b('0x20')]['rawAttributes']);_0x1facad['query']=_[_0x6e2b('0x2b')](_0x7dc028[_0x6e2b('0x2c')]);_0x1facad[_0x6e2b('0x2d')]=_[_0x6e2b('0x2e')](_0x1facad[_0x6e2b('0x2a')],_0x1facad['query']);_0x50d6da[_0x6e2b('0x2f')]=_[_0x6e2b('0x2e')](_0x1facad[_0x6e2b('0x2a')],qs[_0x6e2b('0x30')](_0x7dc028[_0x6e2b('0x2c')][_0x6e2b('0x30')]));_0x50d6da['attributes']=_0x50d6da['attributes']['length']?_0x50d6da[_0x6e2b('0x2f')]:_0x1facad['model'];if(_0x7dc028['query'][_0x6e2b('0x31')]){_0x50d6da[_0x6e2b('0x32')]=[{'all':!![]}];}_0x50d6da=_[_0x6e2b('0x33')]({},_0x50d6da,_0x7dc028['options']);return db['SmsInteraction'][_0x6e2b('0x34')](_0x50d6da)['then'](handleEntityNotFound(_0x2d34ca,null))[_0x6e2b('0x17')](respondWithResult(_0x2d34ca,null))[_0x6e2b('0x35')](handleError(_0x2d34ca,null));};exports[_0x6e2b('0x36')]=function(_0x242678,_0x7582a7){return db[_0x6e2b('0x20')][_0x6e2b('0x36')](_0x242678[_0x6e2b('0x37')],{})[_0x6e2b('0x17')](respondWithResult(_0x7582a7,0xc9))['catch'](handleError(_0x7582a7,null));};exports[_0x6e2b('0x38')]=function(_0x559fa8,_0x29770c){if(_0x559fa8[_0x6e2b('0x37')]['id']){delete _0x559fa8[_0x6e2b('0x37')]['id'];}return db[_0x6e2b('0x20')][_0x6e2b('0x34')]({'where':{'id':_0x559fa8[_0x6e2b('0x29')]['id']}})[_0x6e2b('0x17')](handleEntityNotFound(_0x29770c,null))[_0x6e2b('0x17')](saveUpdates(_0x559fa8[_0x6e2b('0x37')],null))[_0x6e2b('0x17')](respondWithResult(_0x29770c,null))['catch'](handleError(_0x29770c,null));};exports[_0x6e2b('0x18')]=function(_0x5c3f1e,_0x7c30d6){return db['SmsInteraction'][_0x6e2b('0x34')]({'where':{'id':_0x5c3f1e[_0x6e2b('0x29')]['id']}})[_0x6e2b('0x17')](handleEntityNotFound(_0x7c30d6,null))[_0x6e2b('0x17')](removeEntity(_0x7c30d6,null))['catch'](handleError(_0x7c30d6,null));};exports[_0x6e2b('0x39')]=function(_0x4feeca,_0x576504){return db[_0x6e2b('0x20')][_0x6e2b('0x39')]()['then'](respondWithResult(_0x576504,null))[_0x6e2b('0x35')](handleError(_0x576504,null));};exports['addMessage']=function(_0x193102,_0xe4de82){return db[_0x6e2b('0x3a')]['find']({'where':{'id':_0x193102[_0x6e2b('0x29')]['id']}})[_0x6e2b('0x17')](handleEntityNotFound(_0xe4de82,null))['then'](function(_0x44eac7){if(_0x44eac7){return _0x44eac7[_0x6e2b('0x3b')](_0x193102[_0x6e2b('0x37')][_0x6e2b('0x3c')],_[_0x6e2b('0x3d')](_0x193102[_0x6e2b('0x37')],[_0x6e2b('0x3c'),'id'])||{});}})[_0x6e2b('0x17')](respondWithResult(_0xe4de82,null))['catch'](handleError(_0xe4de82,null));};exports[_0x6e2b('0x3e')]=function(_0x551465,_0x232586){var _0x1675cd={'raw':![],'where':{}};var _0x51609f={};var _0x4ed7f3={'count':0x0,'rows':[]};return db[_0x6e2b('0x20')][_0x6e2b('0x3f')]({'where':{'id':_0x551465[_0x6e2b('0x29')]['id']}})[_0x6e2b('0x17')](handleEntityNotFound(_0x232586,null))['then'](function(_0x2234bf){if(_0x2234bf){_0x51609f[_0x6e2b('0x2a')]=_[_0x6e2b('0x2b')](db[_0x6e2b('0x3a')][_0x6e2b('0x21')]);_0x51609f['query']=_[_0x6e2b('0x2b')](_0x551465[_0x6e2b('0x2c')]);_0x51609f[_0x6e2b('0x2d')]=_[_0x6e2b('0x2e')](_0x51609f[_0x6e2b('0x2a')],_0x51609f[_0x6e2b('0x2c')]);_0x1675cd['attributes']=_[_0x6e2b('0x2e')](_0x51609f[_0x6e2b('0x2a')],qs[_0x6e2b('0x30')](_0x551465[_0x6e2b('0x2c')][_0x6e2b('0x30')]));_0x1675cd[_0x6e2b('0x2f')]=_0x1675cd[_0x6e2b('0x2f')]['length']?_0x1675cd[_0x6e2b('0x2f')]:_0x51609f['model'];if(!_0x551465[_0x6e2b('0x2c')][_0x6e2b('0x40')]('nolimit')){_0x1675cd['limit']=qs[_0x6e2b('0x15')](_0x551465[_0x6e2b('0x2c')]['limit']);_0x1675cd[_0x6e2b('0x13')]=qs['offset'](_0x551465[_0x6e2b('0x2c')][_0x6e2b('0x13')]);}_0x1675cd['order']=qs['sort'](_0x551465[_0x6e2b('0x2c')]['sort']);_0x1675cd[_0x6e2b('0x41')]=qs['filters'](_[_0x6e2b('0x42')](_0x551465[_0x6e2b('0x2c')],_0x51609f['filters']));_0x1675cd[_0x6e2b('0x41')]['SmsInteractionId']=_0x2234bf['id'];if(_0x551465[_0x6e2b('0x2c')]['filter']){_0x1675cd[_0x6e2b('0x41')]=_[_0x6e2b('0x33')](_0x1675cd[_0x6e2b('0x41')],{'$or':_[_0x6e2b('0x1f')](_0x1675cd['attributes'],function(_0x4731ca){var _0x718192={};_0x718192[_0x4731ca]={'$like':'%'+_0x551465['query'][_0x6e2b('0x43')]+'%'};return _0x718192;})});}if(_0x551465[_0x6e2b('0x2c')][_0x6e2b('0x44')]){var _0x3872de=_0x551465['query']['$gte'][_0x6e2b('0x45')](',');var _0x194ae7={};_0x194ae7[_0x3872de[0x0]]={'$gte':moment(_0x3872de[0x1])[_0x6e2b('0x46')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1675cd[_0x6e2b('0x41')]=_[_0x6e2b('0x33')](_0x1675cd[_0x6e2b('0x41')],_0x194ae7);}_0x1675cd=_['merge']({},_0x1675cd,_0x551465['options']);return db[_0x6e2b('0x3a')][_0x6e2b('0x16')]({'where':_0x1675cd[_0x6e2b('0x41')]})['then'](function(_0x284743){_0x4ed7f3[_0x6e2b('0x16')]=_0x284743;if(_0x551465[_0x6e2b('0x2c')][_0x6e2b('0x31')]){_0x1675cd['include']=[{'all':!![]}];}return db[_0x6e2b('0x3a')]['findAll'](_0x1675cd);})['then'](function(_0x45b961){_0x4ed7f3[_0x6e2b('0x47')]=_0x45b961;return _0x4ed7f3;});}})['then'](respondWithFilteredResult(_0x232586,_0x1675cd))[_0x6e2b('0x35')](handleError(_0x232586,null));};exports[_0x6e2b('0x48')]=function(_0x51d4fe,_0x2808dd){return db[_0x6e2b('0x20')][_0x6e2b('0x34')]({'where':{'id':_0x51d4fe['params']['id']}})[_0x6e2b('0x17')](handleEntityNotFound(_0x2808dd,null))[_0x6e2b('0x17')](function(_0xa5d8c1){if(_0xa5d8c1){return _0xa5d8c1[_0x6e2b('0x49')](_0x51d4fe[_0x6e2b('0x37')][_0x6e2b('0x3c')],_[_0x6e2b('0x3d')](_0x51d4fe[_0x6e2b('0x37')],[_0x6e2b('0x3c'),'id'])||{})[_0x6e2b('0x4a')](function(){return db[_0x6e2b('0x4b')][_0x6e2b('0x26')]({'attributes':['id',_0x6e2b('0x1c'),_0x6e2b('0x4c')],'where':{'id':_0x51d4fe[_0x6e2b('0x37')]['ids']}});})['then'](function(_0x4252d6){socket['emit']('smsInteractionTags:save',{'id':Number(_0x51d4fe[_0x6e2b('0x29')]['id']),'tags':_0x4252d6||[]});return{'id':Number(_0x51d4fe['params']['id']),'tags':_0x4252d6||[]};});}})['then'](respondWithResult(_0x2808dd,null))[_0x6e2b('0x35')](handleError(_0x2808dd,null));};exports[_0x6e2b('0x4d')]=function(_0x3fb2c6,_0x4e65d1){return db['SmsInteraction'][_0x6e2b('0x34')]({'where':{'id':_0x3fb2c6['params']['id']}})[_0x6e2b('0x17')](handleEntityNotFound(_0x4e65d1,null))['then'](function(_0x3803cb){if(_0x3803cb){return _0x3803cb['removeTags'](_0x3fb2c6[_0x6e2b('0x2c')][_0x6e2b('0x3c')]);}})[_0x6e2b('0x17')](respondWithStatusCode(_0x4e65d1,null))[_0x6e2b('0x35')](handleError(_0x4e65d1,null));};exports[_0x6e2b('0x4e')]=function(_0x575e99,_0x51a9b3){var _0x2119af=moment()['unix']()[_0x6e2b('0x4f')]();var _0x18c11f=path['join'](config[_0x6e2b('0x50')],_0x6e2b('0x51'),_0x6e2b('0x52'),'tmp');var _0x2ce5f2=path['join'](_0x18c11f,_0x2119af);var _0x5a84ca=util['format'](_0x6e2b('0x53'),_0x575e99[_0x6e2b('0x29')]['id'],_0x2119af);var _0x586c1f=path[_0x6e2b('0x54')](_0x18c11f,_0x5a84ca);var _0x26511b=[];_0x26511b[_0x6e2b('0x55')]({'model':db[_0x6e2b('0x56')],'as':'User','attributes':['id',_0x6e2b('0x57')],'raw':!![]});_0x26511b[_0x6e2b('0x55')]({'model':db['CmContact'],'as':_0x6e2b('0x58'),'attributes':['id',_0x6e2b('0x59'),'lastName'],'raw':!![]});var _0x18fa9b=[{'model':db[_0x6e2b('0x3a')],'as':'Messages','attributes':['id',_0x6e2b('0x37'),_0x6e2b('0x5a'),_0x6e2b('0x5b'),_0x6e2b('0x5c'),'read'],'include':_0x26511b}];_0x18fa9b['push']({'model':db[_0x6e2b('0x5d')],'as':_0x6e2b('0x5e'),'attributes':['id',_0x6e2b('0x1c')]});_0x18fa9b['push']({'model':db[_0x6e2b('0x56')],'as':_0x6e2b('0x5f'),'attributes':['id',_0x6e2b('0x57')]});return db['SmsInteraction'][_0x6e2b('0x34')]({'where':{'id':_0x575e99['params']['id']},'include':_0x18fa9b})[_0x6e2b('0x17')](handleEntityNotFound(_0x51a9b3,null))['then'](function(_0x408247){if(_0x408247){var _0x218440=_0x408247[_0x6e2b('0x60')]({'plain':!![]});fs['mkdirSync'](_0x2ce5f2);var _0x5d3c27={'channel':_0x6e2b('0x61'),'account':_0x218440[_0x6e2b('0x5e')][_0x6e2b('0x1c')],'agent':_0x218440[_0x6e2b('0x5f')]?_0x218440['Owner'][_0x6e2b('0x57')]:'N.A.','createdAt':moment(_0x218440[_0x6e2b('0x5a')])[_0x6e2b('0x46')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6e2b('0x4f')](),'closedAt':_0x218440[_0x6e2b('0x62')]?moment(_0x218440[_0x6e2b('0x63')])[_0x6e2b('0x46')](_0x6e2b('0x64'))['toString']():'','disposition':_0x218440[_0x6e2b('0x65')],'messages':_(_0x218440[_0x6e2b('0x66')])[_0x6e2b('0x43')]({'secret':![]})[_0x6e2b('0x1f')](function(_0x54c257){return{'date':moment(_0x54c257['createdAt'])['format'](_0x6e2b('0x64'))['toString'](),'sender':_0x54c257[_0x6e2b('0x5b')]===_0x6e2b('0x67')?_0x54c257['User']?_0x54c257[_0x6e2b('0x56')][_0x6e2b('0x57')]:'System':_0x54c257[_0x6e2b('0x58')][_0x6e2b('0x59')]+(_0x54c257['Contact'][_0x6e2b('0x68')]?'\x20'+_0x54c257['Contact'][_0x6e2b('0x68')]:''),'body':_0x54c257[_0x6e2b('0x37')],'direction':_0x54c257[_0x6e2b('0x5b')]===_0x6e2b('0x67')?'A':'C','secret':_0x54c257[_0x6e2b('0x5c')],'read':_0x54c257[_0x6e2b('0x69')]};})['value']()};return ejs[_0x6e2b('0x6a')](path[_0x6e2b('0x54')](config['root'],_0x6e2b('0x51'),_0x6e2b('0x6b'),'downloadInteraction.ejs'),{'interaction':_0x5d3c27})['then'](function(_0xd72418){var _0x1b00e7=path['join'](_0x2ce5f2,_0x6e2b('0x6c')+_0x218440['id']+'-'+_0x2119af+_0x6e2b('0x6d'));var _0x25d677={'path':_0x1b00e7,'channel':_0x6e2b('0x61'),'interactionId':_0x218440['id']};return pdf[_0x6e2b('0x6e')](_0xd72418,_0x25d677);})['then'](function(){return new BPromise(function(_0x105bd1,_0x2d1672){zipdir(_0x2ce5f2,{'saveTo':_0x586c1f},function(_0xba9a14,_0x4c28fe){if(_0xba9a14)return _0x2d1672(_0xba9a14);return _0x105bd1(_0x4c28fe);});})['then'](function(){return new BPromise(function(_0x2a1129,_0x3c1cc2){rimraf(_0x2ce5f2,function(_0xe4aa32){if(_0xe4aa32)_0x3c1cc2(_0xe4aa32);return _0x2a1129();});});})[_0x6e2b('0x17')](function(){return _0x51a9b3[_0x6e2b('0x4e')](_0x586c1f,_0x5a84ca,function(_0x3c9917){if(_0x3c9917){console['log'](_0x6e2b('0x6f'),_0x3c9917);}else{fs[_0x6e2b('0x70')](_0x586c1f);}});});});}else{return _0x51a9b3[_0x6e2b('0x19')](0xc8);}})[_0x6e2b('0x35')](handleError(_0x51a9b3,null));}; \ No newline at end of file +var _0xf794=['color','emit','smsInteractionTags:save','removeTags','download','toString','join','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','Messages','createdAt','secret','read','Account','Owner','get','mkdirSync','Sms','closed','closedAt','System','Contact','lastName','direction','out','value','renderFile','root','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','sendStatus','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','status','json','offset','undefined','limit','set','Content-Range','update','then','destroy','end','error','stack','name','send','index','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','show','params','keys','filters','model','attributes','intersection','fields','length','includeAll','merge','options','catch','create','body','find','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','where','pick','SmsInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','count','include','rows','addTags','setTags','Tag'];(function(_0x210ff7,_0x520529){var _0x3485f7=function(_0x48c222){while(--_0x48c222){_0x210ff7['push'](_0x210ff7['shift']());}};_0x3485f7(++_0x520529);}(_0xf794,0x129));var _0x4f79=function(_0x47313e,_0x3bace4){_0x47313e=_0x47313e-0x0;var _0x382078=_0xf794[_0x47313e];return _0x382078;};'use strict';var rimraf=require(_0x4f79('0x0'));var zipdir=require(_0x4f79('0x1'));var moment=require(_0x4f79('0x2'));var BPromise=require(_0x4f79('0x3'));var util=require(_0x4f79('0x4'));var path=require(_0x4f79('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4f79('0x6'));var Redis=require(_0x4f79('0x7'));var interaction=require(_0x4f79('0x8'));var qs=require(_0x4f79('0x9'));var pdf=require(_0x4f79('0xa'));var logger=require(_0x4f79('0xb'))('api');var config=require('../../config/environment');var db=require(_0x4f79('0xc'))['db'];config[_0x4f79('0xd')]=_[_0x4f79('0xe')](config['redis'],{'host':_0x4f79('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f79('0xd')]));require(_0x4f79('0x10'))[_0x4f79('0x11')](socket);function respondWithStatusCode(_0x54e77b,_0x4bbb14){_0x4bbb14=_0x4bbb14||0xcc;return function(_0x5c3db3){if(_0x5c3db3){return _0x54e77b['sendStatus'](_0x4bbb14);}return _0x54e77b['status'](_0x4bbb14)['end']();};}function respondWithResult(_0xc049f0,_0x403ca0){_0x403ca0=_0x403ca0||0xc8;return function(_0x583aee){if(_0x583aee){return _0xc049f0[_0x4f79('0x12')](_0x403ca0)[_0x4f79('0x13')](_0x583aee);}};}function respondWithFilteredResult(_0x5c5ca5,_0x2c0e92){return function(_0x138be7){if(_0x138be7){var _0x3d0281=typeof _0x2c0e92[_0x4f79('0x14')]===_0x4f79('0x15')&&typeof _0x2c0e92[_0x4f79('0x16')]===_0x4f79('0x15');var _0x2ed7c1=_0x138be7['count'];var _0x356b6f=_0x3d0281?0x0:_0x2c0e92['offset'];var _0x482eae=_0x3d0281?_0x138be7['count']:_0x2c0e92[_0x4f79('0x14')]+_0x2c0e92['limit'];var _0x4445bb;if(_0x482eae>=_0x2ed7c1){_0x482eae=_0x2ed7c1;_0x4445bb=0xc8;}else{_0x4445bb=0xce;}_0x5c5ca5[_0x4f79('0x12')](_0x4445bb);return _0x5c5ca5[_0x4f79('0x17')](_0x4f79('0x18'),_0x356b6f+'-'+_0x482eae+'/'+_0x2ed7c1)[_0x4f79('0x13')](_0x138be7);}return null;};}function saveUpdates(_0x2de3a2){return function(_0x358a53){if(_0x358a53){return _0x358a53[_0x4f79('0x19')](_0x2de3a2)[_0x4f79('0x1a')](function(_0x47f877){return _0x47f877;});}return null;};}function removeEntity(_0x30dbcc){return function(_0x12e9e0){if(_0x12e9e0){return _0x12e9e0[_0x4f79('0x1b')]()[_0x4f79('0x1a')](function(){_0x30dbcc[_0x4f79('0x12')](0xcc)[_0x4f79('0x1c')]();});}};}function handleEntityNotFound(_0x401614){return function(_0x2233b8){if(!_0x2233b8){_0x401614['sendStatus'](0x194);}return _0x2233b8;};}function handleError(_0x4ee4eb,_0x5e025e){_0x5e025e=_0x5e025e||0x1f4;return function(_0x5d9034){logger[_0x4f79('0x1d')](_0x5d9034[_0x4f79('0x1e')]);if(_0x5d9034['name']){delete _0x5d9034[_0x4f79('0x1f')];}_0x4ee4eb[_0x4f79('0x12')](_0x5e025e)[_0x4f79('0x20')](_0x5d9034);};}exports[_0x4f79('0x21')]=function(_0x2f483a,_0x4e178b){var _0x312613={};var _0x12c990=_['map'](db[_0x4f79('0x22')][_0x4f79('0x23')],function(_0x4ff609){return{'name':_0x4ff609[_0x4f79('0x24')],'type':_0x4ff609[_0x4f79('0x25')][_0x4f79('0x26')]};});_0x312613=qs[_0x4f79('0x27')](_0x12c990,_0x2f483a);return interaction[_0x4f79('0x28')](_0x4f79('0x29'),_0x2f483a[_0x4f79('0x2a')],_0x2f483a['user'],_0x312613,_0x12c990)[_0x4f79('0x1a')](respondWithFilteredResult(_0x4e178b,_0x312613))['catch'](handleError(_0x4e178b,null));};exports[_0x4f79('0x2b')]=function(_0x59500e,_0x461755){var _0x134f57={'raw':![],'where':{'id':_0x59500e[_0x4f79('0x2c')]['id']}},_0x42fad1={};_0x42fad1['model']=_[_0x4f79('0x2d')](db[_0x4f79('0x22')][_0x4f79('0x23')]);_0x42fad1['query']=_[_0x4f79('0x2d')](_0x59500e[_0x4f79('0x2a')]);_0x42fad1[_0x4f79('0x2e')]=_['intersection'](_0x42fad1[_0x4f79('0x2f')],_0x42fad1[_0x4f79('0x2a')]);_0x134f57[_0x4f79('0x30')]=_[_0x4f79('0x31')](_0x42fad1[_0x4f79('0x2f')],qs[_0x4f79('0x32')](_0x59500e[_0x4f79('0x2a')]['fields']));_0x134f57[_0x4f79('0x30')]=_0x134f57[_0x4f79('0x30')][_0x4f79('0x33')]?_0x134f57[_0x4f79('0x30')]:_0x42fad1[_0x4f79('0x2f')];if(_0x59500e[_0x4f79('0x2a')][_0x4f79('0x34')]){_0x134f57['include']=[{'all':!![]}];}_0x134f57=_[_0x4f79('0x35')]({},_0x134f57,_0x59500e[_0x4f79('0x36')]);return db['SmsInteraction']['find'](_0x134f57)[_0x4f79('0x1a')](handleEntityNotFound(_0x461755,null))[_0x4f79('0x1a')](respondWithResult(_0x461755,null))[_0x4f79('0x37')](handleError(_0x461755,null));};exports[_0x4f79('0x38')]=function(_0xcc0fc4,_0x1a6a52){return db[_0x4f79('0x22')][_0x4f79('0x38')](_0xcc0fc4[_0x4f79('0x39')],{})[_0x4f79('0x1a')](respondWithResult(_0x1a6a52,0xc9))[_0x4f79('0x37')](handleError(_0x1a6a52,null));};exports[_0x4f79('0x19')]=function(_0x1a51ac,_0x1ec4d3){if(_0x1a51ac[_0x4f79('0x39')]['id']){delete _0x1a51ac[_0x4f79('0x39')]['id'];}return db['SmsInteraction'][_0x4f79('0x3a')]({'where':{'id':_0x1a51ac[_0x4f79('0x2c')]['id']}})['then'](handleEntityNotFound(_0x1ec4d3,null))[_0x4f79('0x1a')](saveUpdates(_0x1a51ac[_0x4f79('0x39')],null))[_0x4f79('0x1a')](respondWithResult(_0x1ec4d3,null))[_0x4f79('0x37')](handleError(_0x1ec4d3,null));};exports[_0x4f79('0x1b')]=function(_0x29eade,_0x3d47d8){return db['SmsInteraction']['find']({'where':{'id':_0x29eade[_0x4f79('0x2c')]['id']}})[_0x4f79('0x1a')](handleEntityNotFound(_0x3d47d8,null))[_0x4f79('0x1a')](removeEntity(_0x3d47d8,null))[_0x4f79('0x37')](handleError(_0x3d47d8,null));};exports[_0x4f79('0x3b')]=function(_0x116177,_0x116dcd){return db[_0x4f79('0x22')][_0x4f79('0x3b')]()[_0x4f79('0x1a')](respondWithResult(_0x116dcd,null))['catch'](handleError(_0x116dcd,null));};exports[_0x4f79('0x3c')]=function(_0x2bdaec,_0x41cc7c){return db[_0x4f79('0x3d')][_0x4f79('0x3a')]({'where':{'id':_0x2bdaec[_0x4f79('0x2c')]['id']}})['then'](handleEntityNotFound(_0x41cc7c,null))[_0x4f79('0x1a')](function(_0x4f2626){if(_0x4f2626){return _0x4f2626[_0x4f79('0x3c')](_0x2bdaec[_0x4f79('0x39')][_0x4f79('0x3e')],_[_0x4f79('0x3f')](_0x2bdaec[_0x4f79('0x39')],[_0x4f79('0x3e'),'id'])||{});}})[_0x4f79('0x1a')](respondWithResult(_0x41cc7c,null))[_0x4f79('0x37')](handleError(_0x41cc7c,null));};exports[_0x4f79('0x40')]=function(_0x7c3f7b,_0x359ff4){var _0x383093={'raw':![],'where':{}};var _0x48fec1={};var _0x38bc6e={'count':0x0,'rows':[]};return db[_0x4f79('0x22')][_0x4f79('0x41')]({'where':{'id':_0x7c3f7b[_0x4f79('0x2c')]['id']}})[_0x4f79('0x1a')](handleEntityNotFound(_0x359ff4,null))[_0x4f79('0x1a')](function(_0x4a5f1f){if(_0x4a5f1f){_0x48fec1[_0x4f79('0x2f')]=_[_0x4f79('0x2d')](db[_0x4f79('0x3d')][_0x4f79('0x23')]);_0x48fec1[_0x4f79('0x2a')]=_[_0x4f79('0x2d')](_0x7c3f7b[_0x4f79('0x2a')]);_0x48fec1[_0x4f79('0x2e')]=_[_0x4f79('0x31')](_0x48fec1[_0x4f79('0x2f')],_0x48fec1[_0x4f79('0x2a')]);_0x383093[_0x4f79('0x30')]=_[_0x4f79('0x31')](_0x48fec1[_0x4f79('0x2f')],qs['fields'](_0x7c3f7b[_0x4f79('0x2a')][_0x4f79('0x32')]));_0x383093[_0x4f79('0x30')]=_0x383093[_0x4f79('0x30')][_0x4f79('0x33')]?_0x383093[_0x4f79('0x30')]:_0x48fec1[_0x4f79('0x2f')];if(!_0x7c3f7b[_0x4f79('0x2a')][_0x4f79('0x42')](_0x4f79('0x43'))){_0x383093[_0x4f79('0x16')]=qs[_0x4f79('0x16')](_0x7c3f7b[_0x4f79('0x2a')][_0x4f79('0x16')]);_0x383093[_0x4f79('0x14')]=qs[_0x4f79('0x14')](_0x7c3f7b[_0x4f79('0x2a')][_0x4f79('0x14')]);}_0x383093[_0x4f79('0x44')]=qs['sort'](_0x7c3f7b[_0x4f79('0x2a')]['sort']);_0x383093[_0x4f79('0x45')]=qs['filters'](_[_0x4f79('0x46')](_0x7c3f7b[_0x4f79('0x2a')],_0x48fec1[_0x4f79('0x2e')]));_0x383093[_0x4f79('0x45')][_0x4f79('0x47')]=_0x4a5f1f['id'];if(_0x7c3f7b[_0x4f79('0x2a')][_0x4f79('0x48')]){_0x383093[_0x4f79('0x45')]=_[_0x4f79('0x35')](_0x383093[_0x4f79('0x45')],{'$or':_[_0x4f79('0x49')](_0x383093[_0x4f79('0x30')],function(_0x120b3d){var _0x4d2b96={};_0x4d2b96[_0x120b3d]={'$like':'%'+_0x7c3f7b[_0x4f79('0x2a')][_0x4f79('0x48')]+'%'};return _0x4d2b96;})});}if(_0x7c3f7b[_0x4f79('0x2a')]['$gte']){var _0xb021a=_0x7c3f7b[_0x4f79('0x2a')][_0x4f79('0x4a')][_0x4f79('0x4b')](',');var _0x1c15eb={};_0x1c15eb[_0xb021a[0x0]]={'$gte':moment(_0xb021a[0x1])[_0x4f79('0x4c')](_0x4f79('0x4d'))};_0x383093[_0x4f79('0x45')]=_[_0x4f79('0x35')](_0x383093['where'],_0x1c15eb);}_0x383093=_[_0x4f79('0x35')]({},_0x383093,_0x7c3f7b[_0x4f79('0x36')]);return db[_0x4f79('0x3d')][_0x4f79('0x4e')]({'where':_0x383093[_0x4f79('0x45')]})[_0x4f79('0x1a')](function(_0x4e7f3d){_0x38bc6e['count']=_0x4e7f3d;if(_0x7c3f7b[_0x4f79('0x2a')][_0x4f79('0x34')]){_0x383093[_0x4f79('0x4f')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x383093);})[_0x4f79('0x1a')](function(_0x4b22f3){_0x38bc6e[_0x4f79('0x50')]=_0x4b22f3;return _0x38bc6e;});}})[_0x4f79('0x1a')](respondWithFilteredResult(_0x359ff4,_0x383093))[_0x4f79('0x37')](handleError(_0x359ff4,null));};exports[_0x4f79('0x51')]=function(_0x18ef09,_0x4fdd94){return db[_0x4f79('0x22')][_0x4f79('0x3a')]({'where':{'id':_0x18ef09[_0x4f79('0x2c')]['id']}})[_0x4f79('0x1a')](handleEntityNotFound(_0x4fdd94,null))[_0x4f79('0x1a')](function(_0x7ff10d){if(_0x7ff10d){return _0x7ff10d[_0x4f79('0x52')](_0x18ef09[_0x4f79('0x39')]['ids'],_['omit'](_0x18ef09[_0x4f79('0x39')],[_0x4f79('0x3e'),'id'])||{})['spread'](function(){return db[_0x4f79('0x53')][_0x4f79('0x28')]({'attributes':['id',_0x4f79('0x1f'),_0x4f79('0x54')],'where':{'id':_0x18ef09['body'][_0x4f79('0x3e')]}});})[_0x4f79('0x1a')](function(_0x41259e){socket[_0x4f79('0x55')](_0x4f79('0x56'),{'id':Number(_0x18ef09['params']['id']),'tags':_0x41259e||[]});return{'id':Number(_0x18ef09[_0x4f79('0x2c')]['id']),'tags':_0x41259e||[]};});}})['then'](respondWithResult(_0x4fdd94,null))[_0x4f79('0x37')](handleError(_0x4fdd94,null));};exports['removeTags']=function(_0x199388,_0x49be8b){return db[_0x4f79('0x22')]['find']({'where':{'id':_0x199388[_0x4f79('0x2c')]['id']}})[_0x4f79('0x1a')](handleEntityNotFound(_0x49be8b,null))[_0x4f79('0x1a')](function(_0x34bd9f){if(_0x34bd9f){return _0x34bd9f[_0x4f79('0x57')](_0x199388['query']['ids']);}})['then'](respondWithStatusCode(_0x49be8b,null))['catch'](handleError(_0x49be8b,null));};exports[_0x4f79('0x58')]=function(_0x3ed915,_0x2f4249){var _0x2f5a5b=moment()['unix']()[_0x4f79('0x59')]();var _0x390b01=path[_0x4f79('0x5a')](config['root'],_0x4f79('0x5b'),_0x4f79('0x5c'),_0x4f79('0x5d'));var _0x27449e=path[_0x4f79('0x5a')](_0x390b01,_0x2f5a5b);var _0x1e62d3=util[_0x4f79('0x4c')](_0x4f79('0x5e'),_0x3ed915['params']['id'],_0x2f5a5b);var _0x3ad16f=path['join'](_0x390b01,_0x1e62d3);var _0x7a749f=[];_0x7a749f[_0x4f79('0x5f')]({'model':db[_0x4f79('0x60')],'as':_0x4f79('0x60'),'attributes':['id',_0x4f79('0x61')],'raw':!![]});_0x7a749f['push']({'model':db[_0x4f79('0x62')],'as':'Contact','attributes':['id',_0x4f79('0x63'),'lastName'],'raw':!![]});var _0x486018=[{'model':db[_0x4f79('0x3d')],'as':_0x4f79('0x64'),'attributes':['id',_0x4f79('0x39'),_0x4f79('0x65'),'direction',_0x4f79('0x66'),_0x4f79('0x67')],'include':_0x7a749f}];_0x486018[_0x4f79('0x5f')]({'model':db['SmsAccount'],'as':_0x4f79('0x68'),'attributes':['id',_0x4f79('0x1f')]});_0x486018[_0x4f79('0x5f')]({'model':db[_0x4f79('0x60')],'as':_0x4f79('0x69'),'attributes':['id',_0x4f79('0x61')]});return db[_0x4f79('0x22')][_0x4f79('0x3a')]({'where':{'id':_0x3ed915['params']['id']},'include':_0x486018})['then'](handleEntityNotFound(_0x2f4249,null))[_0x4f79('0x1a')](function(_0x47ec45){if(_0x47ec45){var _0xcbb21b=_0x47ec45[_0x4f79('0x6a')]({'plain':!![]});fs[_0x4f79('0x6b')](_0x27449e);var _0x35f6da={'channel':_0x4f79('0x6c'),'account':_0xcbb21b[_0x4f79('0x68')][_0x4f79('0x1f')],'agent':_0xcbb21b[_0x4f79('0x69')]?_0xcbb21b[_0x4f79('0x69')][_0x4f79('0x61')]:'N.A.','createdAt':moment(_0xcbb21b[_0x4f79('0x65')])['format'](_0x4f79('0x4d'))[_0x4f79('0x59')](),'closedAt':_0xcbb21b[_0x4f79('0x6d')]?moment(_0xcbb21b[_0x4f79('0x6e')])['format'](_0x4f79('0x4d'))[_0x4f79('0x59')]():'','disposition':_0xcbb21b['disposition'],'messages':_(_0xcbb21b[_0x4f79('0x64')])[_0x4f79('0x48')]({'secret':![]})[_0x4f79('0x49')](function(_0x3e81a8){return{'date':moment(_0x3e81a8[_0x4f79('0x65')])[_0x4f79('0x4c')](_0x4f79('0x4d'))[_0x4f79('0x59')](),'sender':_0x3e81a8['direction']==='out'?_0x3e81a8[_0x4f79('0x60')]?_0x3e81a8[_0x4f79('0x60')][_0x4f79('0x61')]:_0x4f79('0x6f'):_0x3e81a8[_0x4f79('0x70')]['firstName']+(_0x3e81a8['Contact'][_0x4f79('0x71')]?'\x20'+_0x3e81a8[_0x4f79('0x70')][_0x4f79('0x71')]:''),'body':_0x3e81a8[_0x4f79('0x39')],'direction':_0x3e81a8[_0x4f79('0x72')]===_0x4f79('0x73')?'A':'C','secret':_0x3e81a8[_0x4f79('0x66')],'read':_0x3e81a8[_0x4f79('0x67')]};})[_0x4f79('0x74')]()};return ejs[_0x4f79('0x75')](path['join'](config[_0x4f79('0x76')],_0x4f79('0x5b'),_0x4f79('0x77'),_0x4f79('0x78')),{'interaction':_0x35f6da})[_0x4f79('0x1a')](function(_0x3c0bb5){var _0x59a89a=path[_0x4f79('0x5a')](_0x27449e,_0x4f79('0x79')+_0xcbb21b['id']+'-'+_0x2f5a5b+_0x4f79('0x7a'));var _0x51a3e8={'path':_0x59a89a,'channel':_0x4f79('0x6c'),'interactionId':_0xcbb21b['id']};return pdf[_0x4f79('0x7b')](_0x3c0bb5,_0x51a3e8);})[_0x4f79('0x1a')](function(){return new BPromise(function(_0x26892f,_0x3a7f93){zipdir(_0x27449e,{'saveTo':_0x3ad16f},function(_0x22c007,_0x4a807c){if(_0x22c007)return _0x3a7f93(_0x22c007);return _0x26892f(_0x4a807c);});})[_0x4f79('0x1a')](function(){return new BPromise(function(_0x499d64,_0x279363){rimraf(_0x27449e,function(_0x302b9e){if(_0x302b9e)_0x279363(_0x302b9e);return _0x499d64();});});})[_0x4f79('0x1a')](function(){return _0x2f4249[_0x4f79('0x58')](_0x3ad16f,_0x1e62d3,function(_0x202248){if(_0x202248){console['log'](_0x4f79('0x7c'),_0x202248);}else{fs[_0x4f79('0x7d')](_0x3ad16f);}});});});}else{return _0x2f4249[_0x4f79('0x7e')](0xc8);}})[_0x4f79('0x37')](handleError(_0x2f4249,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 7528689..e5e16a6 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 _0xf2e3=['save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xf2e3[_0x36884e];return _0x1cc367;};'use strict';var EventEmitter=require(_0x3f2e('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x3f2e('0x1')];var SmsMessage=require(_0x3f2e('0x2'))['db'][_0x3f2e('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x3f2e('0x4')](0x0);var events={'afterCreate':_0x3f2e('0x5'),'afterUpdate':_0x3f2e('0x6'),'afterDestroy':_0x3f2e('0x7')};function emitEvent(_0xabcf5c){return function(_0x216b26,_0x5f254a,_0x33a3b7){_0x216b26[_0x3f2e('0x8')]({'attributes':['id'],'raw':!![]})[_0x3f2e('0x9')](function(_0xdf499f){_0x216b26[_0x3f2e('0xa')](_0x3f2e('0xb'),_0xdf499f[_0x3f2e('0xc')](function(_0x434e0c){return{'id':_0x434e0c['id']};}));return SmsMessage[_0x3f2e('0xd')]({'where':{'SmsInteractionId':_0x216b26['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3f2e('0x9')](function(_0x21f22b){_0x216b26[_0x3f2e('0xa')](_0x3f2e('0xe'),_0x21f22b[_0x3f2e('0xf')]);SmsInteractionEvents[_0x3f2e('0x10')](_0xabcf5c+':'+_0x216b26['id'],_0x216b26);SmsInteractionEvents[_0x3f2e('0x10')](_0xabcf5c,_0x216b26);_0x33a3b7(null);})[_0x3f2e('0x11')](_0x33a3b7(null));};}for(var e in events){if(events[_0x3f2e('0x12')](e)){var event=events[e];SmsInteraction[_0x3f2e('0x13')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x0abf=['Users','map','emit','catch','hasOwnProperty','hook','exports','events','SmsInteraction','../../mysqldb','save','remove','getUsers','then','setDataValue'];(function(_0x19207f,_0xacc62a){var _0x3dc2c2=function(_0x5854d0){while(--_0x5854d0){_0x19207f['push'](_0x19207f['shift']());}};_0x3dc2c2(++_0xacc62a);}(_0x0abf,0xe8));var _0xf0ab=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x0abf[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require(_0xf0ab('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xf0ab('0x1')];var SmsMessage=require(_0xf0ab('0x2'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf0ab('0x3'),'afterUpdate':'update','afterDestroy':_0xf0ab('0x4')};function emitEvent(_0x3be05e){return function(_0x2efe43,_0xbb1f91,_0x2ab7d6){_0x2efe43[_0xf0ab('0x5')]({'attributes':['id'],'raw':!![]})[_0xf0ab('0x6')](function(_0x57ff3b){_0x2efe43[_0xf0ab('0x7')](_0xf0ab('0x8'),_0x57ff3b[_0xf0ab('0x9')](function(_0x236b07){return{'id':_0x236b07['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x2efe43['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf0ab('0x6')](function(_0x4688d8){_0x2efe43[_0xf0ab('0x7')]('unreadMessages',_0x4688d8['length']);SmsInteractionEvents[_0xf0ab('0xa')](_0x3be05e+':'+_0x2efe43['id'],_0x2efe43);SmsInteractionEvents['emit'](_0x3be05e,_0x2efe43);_0x2ab7d6(null);})[_0xf0ab('0xb')](_0x2ab7d6(null));};}for(var e in events){if(events[_0xf0ab('0xc')](e)){var event=events[e];SmsInteraction[_0xf0ab('0xd')](e,emitEvent(event));}}module[_0xf0ab('0xe')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index a51a480..266eff8 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 _0xe7d1=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./smsInteraction.attributes','define','sms_interactions'];(function(_0x3f6056,_0x36ff23){var _0x38fb4b=function(_0x5e6540){while(--_0x5e6540){_0x3f6056['push'](_0x3f6056['shift']());}};_0x38fb4b(++_0x36ff23);}(_0xe7d1,0x195));var _0x1e7d=function(_0x56ac6e,_0x2aafdc){_0x56ac6e=_0x56ac6e-0x0;var _0x309209=_0xe7d1[_0x56ac6e];return _0x309209;};'use strict';var _=require(_0x1e7d('0x0'));var util=require(_0x1e7d('0x1'));var logger=require(_0x1e7d('0x2'))(_0x1e7d('0x3'));var moment=require(_0x1e7d('0x4'));var BPromise=require(_0x1e7d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e7d('0x6'));var rimraf=require(_0x1e7d('0x7'));var config=require('../../config/environment');var attributes=require(_0x1e7d('0x8'));module['exports']=function(_0x11a551,_0x2a156c){return _0x11a551[_0x1e7d('0x9')]('SmsInteraction',attributes,{'tableName':_0x1e7d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1ff505,_0x229081,_0x266e45){if(_0x1ff505[_0x1e7d('0xb')](_0x1e7d('0xc'))){_0x1ff505[_0x1e7d('0xd')]=moment()[_0x1e7d('0xe')](_0x1e7d('0xf'));}_0x266e45(null,_0x1ff505);}}});}; \ No newline at end of file +var _0x0c21=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./smsInteraction.attributes','exports','define','SmsInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x5e1efe,_0x88eef1){var _0x43b60e=function(_0x448414){while(--_0x448414){_0x5e1efe['push'](_0x5e1efe['shift']());}};_0x43b60e(++_0x88eef1);}(_0x0c21,0x142));var _0x10c2=function(_0xa6064c,_0x533620){_0xa6064c=_0xa6064c-0x0;var _0x4c202d=_0x0c21[_0xa6064c];return _0x4c202d;};'use strict';var _=require(_0x10c2('0x0'));var util=require(_0x10c2('0x1'));var logger=require(_0x10c2('0x2'))(_0x10c2('0x3'));var moment=require('moment');var BPromise=require(_0x10c2('0x4'));var rp=require(_0x10c2('0x5'));var fs=require('fs');var path=require(_0x10c2('0x6'));var rimraf=require(_0x10c2('0x7'));var config=require('../../config/environment');var attributes=require(_0x10c2('0x8'));module[_0x10c2('0x9')]=function(_0x5e9591,_0xab4bc5){return _0x5e9591[_0x10c2('0xa')](_0x10c2('0xb'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x504d3b,_0x363199,_0x21d893){if(_0x504d3b[_0x10c2('0xc')](_0x10c2('0xd'))){_0x504d3b[_0x10c2('0xe')]=moment()[_0x10c2('0xf')](_0x10c2('0x10'));}_0x21d893(null,_0x504d3b);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 5ec1b11..9516370 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 _0x1a3c=['options','attributes','AddTagsToSmsInteraction','find','addTags','spread','AddTags','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','raw'];(function(_0x3b81b5,_0x5a140d){var _0x27f026=function(_0x44f471){while(--_0x44f471){_0x3b81b5['push'](_0x3b81b5['shift']());}};_0x27f026(++_0x5a140d);}(_0x1a3c,0x7d));var _0xc1a3=function(_0x55ad96,_0x5f2bea){_0x55ad96=_0x55ad96-0x0;var _0x30281e=_0x1a3c[_0x55ad96];return _0x30281e;};'use strict';var _=require('lodash');var util=require(_0xc1a3('0x0'));var moment=require(_0xc1a3('0x1'));var BPromise=require(_0xc1a3('0x2'));var rs=require(_0xc1a3('0x3'));var fs=require('fs');var Redis=require(_0xc1a3('0x4'));var db=require(_0xc1a3('0x5'))['db'];var utils=require(_0xc1a3('0x6'));var logger=require(_0xc1a3('0x7'))(_0xc1a3('0x8'));var config=require(_0xc1a3('0x9'));var jayson=require(_0xc1a3('0xa'));var client=jayson[_0xc1a3('0xb')]['http']({'port':0x232a});config[_0xc1a3('0xc')]=_[_0xc1a3('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc1a3('0xc')]));require(_0xc1a3('0xe'))[_0xc1a3('0xf')](socket);function respondWithRpcPromise(_0xb2550b,_0x5a6208,_0x2353fe){return new BPromise(function(_0x302e9f,_0x9ee188){return client[_0xc1a3('0x10')](_0xb2550b,_0x2353fe)[_0xc1a3('0x11')](function(_0x27f553){logger['info'](_0xc1a3('0x12'),_0x5a6208,_0xc1a3('0x13'));logger[_0xc1a3('0x14')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x5a6208,'request\x20sent',JSON['stringify'](_0x27f553));if(_0x27f553[_0xc1a3('0x15')]){if(_0x27f553['error']['code']===0x1f4){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x5a6208,_0x27f553['error'][_0xc1a3('0x16')]);return _0x9ee188(_0x27f553[_0xc1a3('0x15')]['message']);}logger[_0xc1a3('0x15')](_0xc1a3('0x12'),_0x5a6208,_0x27f553[_0xc1a3('0x15')]['message']);return _0x302e9f(_0x27f553[_0xc1a3('0x15')][_0xc1a3('0x16')]);}else{logger[_0xc1a3('0x17')](_0xc1a3('0x12'),_0x5a6208,'request\x20sent');_0x302e9f(_0x27f553[_0xc1a3('0x18')]['message']);}})[_0xc1a3('0x19')](function(_0x1cc02e){logger[_0xc1a3('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x5a6208,_0x1cc02e);_0x9ee188(_0x1cc02e);});});}exports[_0xc1a3('0x1a')]=function(_0x3c1365){var _0x53210a=this;return new Promise(function(_0x5883e4,_0x297977){return db[_0xc1a3('0x1b')][_0xc1a3('0x1c')](_0x3c1365[_0xc1a3('0x1d')],{'raw':_0x3c1365['options']?_0x3c1365['options'][_0xc1a3('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c1365['options']?_0x3c1365['options']['where']||null:null,'attributes':_0x3c1365['options']?_0x3c1365[_0xc1a3('0x1f')][_0xc1a3('0x20')]||null:null,'limit':_0x3c1365['options']?_0x3c1365['options']['limit']||null:null})[_0xc1a3('0x11')](function(_0x5461cb){logger[_0xc1a3('0x17')](_0xc1a3('0x1a'),_0x3c1365);logger['debug'](_0xc1a3('0x1a'),_0x3c1365,JSON['stringify'](_0x5461cb));_0x5883e4(_0x5461cb);})[_0xc1a3('0x19')](function(_0x10c133){logger[_0xc1a3('0x15')]('UpdateSmsInteraction',_0x10c133[_0xc1a3('0x16')],_0x3c1365);_0x297977(_0x53210a[_0xc1a3('0x15')](0x1f4,_0x10c133[_0xc1a3('0x16')]));});});};exports[_0xc1a3('0x21')]=function(_0x59a92e){return new Promise(function(_0x40868a,_0x323413){return db[_0xc1a3('0x1b')][_0xc1a3('0x22')]({'where':_0x59a92e['options']?_0x59a92e['options']['where']||null:null})['then'](function(_0x234733){if(_0x234733){return _0x234733[_0xc1a3('0x23')](_0x59a92e[_0xc1a3('0x1d')]['ids'],_['omit'](_0x59a92e[_0xc1a3('0x1d')],['ids','id'])||{});}})[_0xc1a3('0x24')](function(_0x52e656){logger[_0xc1a3('0x17')](_0xc1a3('0x25'),_0x59a92e);logger[_0xc1a3('0x14')](_0xc1a3('0x25'),_0x59a92e,JSON[_0xc1a3('0x26')](_0x52e656));_0x40868a(_0x52e656);})[_0xc1a3('0x19')](function(_0x328949){logger['error']('AddTags',_0x328949['message'],_0x59a92e);_0x323413(_this['error'](0x1f4,_0x328949[_0xc1a3('0x16')]));});});}; \ No newline at end of file +var _0x3a0f=['http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','SmsInteraction','body','raw','options','where','then','UpdateSmsInteraction','debug','stringify','catch','AddTagsToSmsInteraction','addTags','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise'];(function(_0x288345,_0x4b5ef6){var _0xd9c635=function(_0x3f6c67){while(--_0x3f6c67){_0x288345['push'](_0x288345['shift']());}};_0xd9c635(++_0x4b5ef6);}(_0x3a0f,0x121));var _0xf3a0=function(_0x5a0650,_0x2ee749){_0x5a0650=_0x5a0650-0x0;var _0x5c0864=_0x3a0f[_0x5a0650];return _0x5c0864;};'use strict';var _=require(_0xf3a0('0x0'));var util=require('util');var moment=require(_0xf3a0('0x1'));var BPromise=require('bluebird');var rs=require(_0xf3a0('0x2'));var fs=require('fs');var Redis=require(_0xf3a0('0x3'));var db=require(_0xf3a0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf3a0('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf3a0('0x6'));var client=jayson['client'][_0xf3a0('0x7')]({'port':0x232a});config[_0xf3a0('0x8')]=_[_0xf3a0('0x9')](config[_0xf3a0('0x8')],{'host':_0xf3a0('0xa'),'port':0x18eb});var socket=require(_0xf3a0('0xb'))(new Redis(config[_0xf3a0('0x8')]));require(_0xf3a0('0xc'))['register'](socket);function respondWithRpcPromise(_0x488763,_0x326e87,_0x5ed9ea){return new BPromise(function(_0x10fbdd,_0x3466c3){return client[_0xf3a0('0xd')](_0x488763,_0x5ed9ea)['then'](function(_0x39541f){logger[_0xf3a0('0xe')](_0xf3a0('0xf'),_0x326e87,_0xf3a0('0x10'));logger['debug'](_0xf3a0('0x11'),_0x326e87,'request\x20sent',JSON['stringify'](_0x39541f));if(_0x39541f[_0xf3a0('0x12')]){if(_0x39541f[_0xf3a0('0x12')][_0xf3a0('0x13')]===0x1f4){logger[_0xf3a0('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x326e87,_0x39541f[_0xf3a0('0x12')][_0xf3a0('0x14')]);return _0x3466c3(_0x39541f[_0xf3a0('0x12')][_0xf3a0('0x14')]);}logger['error'](_0xf3a0('0xf'),_0x326e87,_0x39541f['error']['message']);return _0x10fbdd(_0x39541f[_0xf3a0('0x12')][_0xf3a0('0x14')]);}else{logger[_0xf3a0('0xe')]('SmsInteraction,\x20%s,\x20%s',_0x326e87,_0xf3a0('0x10'));_0x10fbdd(_0x39541f['result'][_0xf3a0('0x14')]);}})['catch'](function(_0x9bc2d1){logger['error'](_0xf3a0('0xf'),_0x326e87,_0x9bc2d1);_0x3466c3(_0x9bc2d1);});});}exports['UpdateSmsInteraction']=function(_0x871536){var _0x7cc93b=this;return new Promise(function(_0x1ddde9,_0xb04935){return db[_0xf3a0('0x15')]['update'](_0x871536[_0xf3a0('0x16')],{'raw':_0x871536['options']?_0x871536['options'][_0xf3a0('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x871536['options']?_0x871536[_0xf3a0('0x18')][_0xf3a0('0x19')]||null:null,'attributes':_0x871536[_0xf3a0('0x18')]?_0x871536[_0xf3a0('0x18')]['attributes']||null:null,'limit':_0x871536['options']?_0x871536['options']['limit']||null:null})[_0xf3a0('0x1a')](function(_0x5c2f18){logger['info'](_0xf3a0('0x1b'),_0x871536);logger[_0xf3a0('0x1c')](_0xf3a0('0x1b'),_0x871536,JSON[_0xf3a0('0x1d')](_0x5c2f18));_0x1ddde9(_0x5c2f18);})[_0xf3a0('0x1e')](function(_0x34dcda){logger[_0xf3a0('0x12')](_0xf3a0('0x1b'),_0x34dcda[_0xf3a0('0x14')],_0x871536);_0xb04935(_0x7cc93b[_0xf3a0('0x12')](0x1f4,_0x34dcda['message']));});});};exports[_0xf3a0('0x1f')]=function(_0x5a2244){return new Promise(function(_0x187c9e,_0x265ca3){return db[_0xf3a0('0x15')]['find']({'where':_0x5a2244[_0xf3a0('0x18')]?_0x5a2244['options'][_0xf3a0('0x19')]||null:null})[_0xf3a0('0x1a')](function(_0x5696be){if(_0x5696be){return _0x5696be[_0xf3a0('0x20')](_0x5a2244[_0xf3a0('0x16')][_0xf3a0('0x21')],_[_0xf3a0('0x22')](_0x5a2244[_0xf3a0('0x16')],[_0xf3a0('0x21'),'id'])||{});}})[_0xf3a0('0x23')](function(_0x452887){logger['info'](_0xf3a0('0x24'),_0x5a2244);logger['debug'](_0xf3a0('0x24'),_0x5a2244,JSON[_0xf3a0('0x1d')](_0x452887));_0x187c9e(_0x452887);})[_0xf3a0('0x1e')](function(_0x39b2be){logger['error']('AddTags',_0x39b2be[_0xf3a0('0x14')],_0x5a2244);_0x265ca3(_this[_0xf3a0('0x12')](0x1f4,_0x39b2be['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index e925961..b4d6a07 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 _0x82ce=['remove','update','emit','register','smsInteraction:','./smsInteraction.events'];(function(_0x461b26,_0x4a359b){var _0x1fab1c=function(_0x175f66){while(--_0x175f66){_0x461b26['push'](_0x461b26['shift']());}};_0x1fab1c(++_0x4a359b);}(_0x82ce,0x19d));var _0xe82c=function(_0x242b51,_0x10889d){_0x242b51=_0x242b51-0x0;var _0x1d08e6=_0x82ce[_0x242b51];return _0x1d08e6;};'use strict';var SmsInteractionEvents=require(_0xe82c('0x0'));var events=['save',_0xe82c('0x1'),_0xe82c('0x2')];function createListener(_0x2e0b4a,_0x184a13){return function(_0x1839e5){_0x184a13[_0xe82c('0x3')](_0x2e0b4a,_0x1839e5);};}function removeListener(_0x17dbc9,_0x5f211a){return function(){SmsInteractionEvents['removeListener'](_0x17dbc9,_0x5f211a);};}exports[_0xe82c('0x4')]=function(_0x282920){for(var _0x207c0e=0x0,_0x58c395=events['length'];_0x207c0e<_0x58c395;_0x207c0e++){var _0xd2b887=events[_0x207c0e];var _0x1a0c75=createListener(_0xe82c('0x5')+_0xd2b887,_0x282920);SmsInteractionEvents['on'](_0xd2b887,_0x1a0c75);}}; \ No newline at end of file +var _0xd821=['emit','removeListener','register','length','smsInteraction:','./smsInteraction.events','save','update'];(function(_0x132e7b,_0x117ea1){var _0x47c67a=function(_0xf807d0){while(--_0xf807d0){_0x132e7b['push'](_0x132e7b['shift']());}};_0x47c67a(++_0x117ea1);}(_0xd821,0x125));var _0x1d82=function(_0xbedc71,_0x55f068){_0xbedc71=_0xbedc71-0x0;var _0x25e78b=_0xd821[_0xbedc71];return _0x25e78b;};'use strict';var SmsInteractionEvents=require(_0x1d82('0x0'));var events=[_0x1d82('0x1'),'remove',_0x1d82('0x2')];function createListener(_0x4f8451,_0x215b96){return function(_0x21850d){_0x215b96[_0x1d82('0x3')](_0x4f8451,_0x21850d);};}function removeListener(_0x44c07e,_0x3c6c78){return function(){SmsInteractionEvents[_0x1d82('0x4')](_0x44c07e,_0x3c6c78);};}exports[_0x1d82('0x5')]=function(_0x572226){for(var _0x49bd2f=0x0,_0x4d77f7=events[_0x1d82('0x6')];_0x49bd2f<_0x4d77f7;_0x49bd2f++){var _0x433fd2=events[_0x49bd2f];var _0x8a6deb=createListener(_0x1d82('0x7')+_0x433fd2,_0x572226);SmsInteractionEvents['on'](_0x433fd2,_0x8a6deb);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 70579fe..f5356d2 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 _0xccf3=['/:id/accept','accept','/:id/reject','delete','/:id','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe','describe','post','tracked','smsmessage:create','/:id/status','update','put'];(function(_0x2a5e54,_0x23f73b){var _0xc7d9a2=function(_0x918fe6){while(--_0x918fe6){_0x2a5e54['push'](_0x2a5e54['shift']());}};_0xc7d9a2(++_0x23f73b);}(_0xccf3,0x1d3));var _0x3ccf=function(_0x59364e,_0x474879){_0x59364e=_0x59364e-0x0;var _0x4d2b73=_0xccf3[_0x59364e];return _0x4d2b73;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3ccf('0x0'));var express=require(_0x3ccf('0x1'));var router=express[_0x3ccf('0x2')]();var fs_extra=require(_0x3ccf('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3ccf('0x4'));var config=require(_0x3ccf('0x5'));var controller=require(_0x3ccf('0x6'));router[_0x3ccf('0x7')]('/',auth[_0x3ccf('0x8')](),controller['index']);router[_0x3ccf('0x7')](_0x3ccf('0x9'),auth[_0x3ccf('0x8')](),controller[_0x3ccf('0xa')]);router['get']('/:id',auth[_0x3ccf('0x8')](),controller['show']);router[_0x3ccf('0xb')]('/',auth[_0x3ccf('0x8')](),interaction[_0x3ccf('0xc')]('sms',_0x3ccf('0xd')),controller['create']);router[_0x3ccf('0xb')](_0x3ccf('0xe'),controller['status']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3ccf('0xf')]);router[_0x3ccf('0x10')](_0x3ccf('0x11'),auth[_0x3ccf('0x8')](),controller[_0x3ccf('0x12')]);router['put'](_0x3ccf('0x13'),auth[_0x3ccf('0x8')](),controller['reject']);router[_0x3ccf('0x14')](_0x3ccf('0x15'),auth[_0x3ccf('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3587=['connect-timeout','fs-extra','../../config/environment','./smsMessage.controller','isAuthenticated','index','get','/describe','describe','show','post','tracked','sms','smsmessage:create','put','/:id','update','/:id/accept','/:id/reject','reject','delete','util','path'];(function(_0xdfb29a,_0x3443b5){var _0x52f21e=function(_0x56598e){while(--_0x56598e){_0xdfb29a['push'](_0xdfb29a['shift']());}};_0x52f21e(++_0x3443b5);}(_0x3587,0x1e1));var _0x7358=function(_0x2962c7,_0x20e76d){_0x2962c7=_0x2962c7-0x0;var _0x2a97ad=_0x3587[_0x2962c7];return _0x2a97ad;};'use strict';var multer=require('multer');var util=require(_0x7358('0x0'));var path=require(_0x7358('0x1'));var timeout=require(_0x7358('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7358('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7358('0x4'));var controller=require(_0x7358('0x5'));router['get']('/',auth[_0x7358('0x6')](),controller[_0x7358('0x7')]);router[_0x7358('0x8')](_0x7358('0x9'),auth['isAuthenticated'](),controller[_0x7358('0xa')]);router[_0x7358('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x7358('0xb')]);router[_0x7358('0xc')]('/',auth['isAuthenticated'](),interaction[_0x7358('0xd')](_0x7358('0xe'),_0x7358('0xf')),controller['create']);router['post']('/:id/status',controller['status']);router[_0x7358('0x10')](_0x7358('0x11'),auth['isAuthenticated'](),controller[_0x7358('0x12')]);router[_0x7358('0x10')](_0x7358('0x13'),auth[_0x7358('0x6')](),controller['accept']);router[_0x7358('0x10')](_0x7358('0x14'),auth[_0x7358('0x6')](),controller[_0x7358('0x15')]);router[_0x7358('0x16')](_0x7358('0x11'),auth[_0x7358('0x6')](),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 07d2e4e..7c0cddd 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 _0xa991=['out','STRING','DATE','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x4cefbc,_0x3ffa6c){var _0x423c86=function(_0x3554eb){while(--_0x3554eb){_0x4cefbc['push'](_0x4cefbc['shift']());}};_0x423c86(++_0x3ffa6c);}(_0xa991,0x143));var _0x1a99=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xa991[_0x88cd7b];return _0x56fcc8;};'use strict';var Sequelize=require(_0x1a99('0x0'));module['exports']={'body':{'type':Sequelize[_0x1a99('0x1')](_0x1a99('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1a99('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1a99('0x4')]('in',_0x1a99('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x1a99('0x6')](0xbe)},'phone':{'type':Sequelize[_0x1a99('0x6')]},'readAt':{'type':Sequelize[_0x1a99('0x7')]},'secret':{'type':Sequelize[_0x1a99('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1a99('0x6')]},'providerResponse':{'type':Sequelize[_0x1a99('0x1')]}}; \ No newline at end of file +var _0xe84e=['exports','TEXT','medium','BOOLEAN','out','STRING','DATE','sequelize'];(function(_0x1f8da0,_0xbb56b0){var _0x3c779c=function(_0x202eb5){while(--_0x202eb5){_0x1f8da0['push'](_0x1f8da0['shift']());}};_0x3c779c(++_0xbb56b0);}(_0xe84e,0xf7));var _0xee84=function(_0x44cd28,_0x1502d9){_0x44cd28=_0x44cd28-0x0;var _0x39356e=_0xe84e[_0x44cd28];return _0x39356e;};'use strict';var Sequelize=require(_0xee84('0x0'));module[_0xee84('0x1')]={'body':{'type':Sequelize[_0xee84('0x2')](_0xee84('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xee84('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xee84('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xee84('0x6')]},'readAt':{'type':Sequelize[_0xee84('0x7')]},'secret':{'type':Sequelize[_0xee84('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xee84('0x6')]},'providerResponse':{'type':Sequelize[_0xee84('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 4a950a7..0c8b778 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 _0x56c8=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','save','update','destroy','name','send','index','map','SmsMessage','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','rawAttributes','length','find','catch','create','body','params','describe','sms-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','agent','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','email','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','results','groupName','DELIVERED','infobip','eml-format'];(function(_0x5bda3b,_0x41160f){var _0x431bb9=function(_0x160122){while(--_0x160122){_0x5bda3b['push'](_0x5bda3b['shift']());}};_0x431bb9(++_0x41160f);}(_0x56c8,0x12f));var _0x856c=function(_0xc3714f,_0x2e405c){_0xc3714f=_0xc3714f-0x0;var _0x320e47=_0x56c8[_0xc3714f];return _0x320e47;};'use strict';var emlformat=require(_0x856c('0x0'));var rimraf=require(_0x856c('0x1'));var zipdir=require(_0x856c('0x2'));var jsonpatch=require(_0x856c('0x3'));var rp=require('request-promise');var moment=require(_0x856c('0x4'));var BPromise=require(_0x856c('0x5'));var Mustache=require(_0x856c('0x6'));var util=require(_0x856c('0x7'));var path=require(_0x856c('0x8'));var sox=require('sox');var csv=require(_0x856c('0x9'));var ejs=require(_0x856c('0xa'));var fs=require('fs');var fs_extra=require(_0x856c('0xb'));var _=require(_0x856c('0xc'));var squel=require(_0x856c('0xd'));var crypto=require(_0x856c('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x856c('0x9'));var querystring=require(_0x856c('0xf'));var Papa=require(_0x856c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x856c('0x11'));var hardwareService=require(_0x856c('0x12'));var logger=require(_0x856c('0x13'))('api');var utils=require(_0x856c('0x14'));var config=require(_0x856c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x856c('0x16'))['db'];config[_0x856c('0x17')]=_[_0x856c('0x18')](config[_0x856c('0x17')],{'host':_0x856c('0x19'),'port':0x18eb});var socket=require(_0x856c('0x1a'))(new Redis(config[_0x856c('0x17')]));require(_0x856c('0x1b'))['register'](socket);var jayson=require(_0x856c('0x1c'));var client=jayson['client'][_0x856c('0x1d')]({'port':0x232c});var client9002=jayson[_0x856c('0x1e')][_0x856c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x20021d,_0x6856e5,_0x13f1ae,_0x26aba6){return new BPromise(function(_0x13b1c6,_0x250996){var _0x1dd26e=_0x26aba6||client;return _0x1dd26e[_0x856c('0x1f')](_0x20021d,_0x13f1ae)[_0x856c('0x20')](function(_0x44cb08){logger[_0x856c('0x21')](_0x856c('0x22'),_0x6856e5,_0x856c('0x23'));logger[_0x856c('0x24')](_0x856c('0x25'),_0x6856e5,_0x856c('0x23'),JSON[_0x856c('0x26')](_0x44cb08));if(_0x44cb08[_0x856c('0x27')]){if(_0x44cb08[_0x856c('0x27')]['code']===0x1f4){logger['error'](_0x856c('0x22'),_0x6856e5,_0x44cb08[_0x856c('0x27')][_0x856c('0x28')]);return _0x250996(_0x44cb08['error'][_0x856c('0x28')]);}logger['error'](_0x856c('0x22'),_0x6856e5,_0x44cb08[_0x856c('0x27')][_0x856c('0x28')]);return _0x13b1c6(_0x44cb08['error'][_0x856c('0x28')]);}else{logger[_0x856c('0x21')](_0x856c('0x22'),_0x6856e5,_0x856c('0x23'));_0x13b1c6(_0x44cb08[_0x856c('0x29')][_0x856c('0x28')]);}})['catch'](function(_0x3a048d){logger[_0x856c('0x27')](_0x856c('0x22'),_0x6856e5,_0x3a048d);_0x250996(_0x3a048d);});});}function respondWithStatusCode(_0x47e45c,_0x1d2e32){_0x1d2e32=_0x1d2e32||0xcc;return function(_0x56caca){if(_0x56caca){return _0x47e45c[_0x856c('0x2a')](_0x1d2e32);}return _0x47e45c['status'](_0x1d2e32)[_0x856c('0x2b')]();};}function respondWithResult(_0x23f53d,_0x4a8107){_0x4a8107=_0x4a8107||0xc8;return function(_0x2b2b95){if(_0x2b2b95){return _0x23f53d['status'](_0x4a8107)[_0x856c('0x2c')](_0x2b2b95);}};}function respondWithFilteredResult(_0x384f5f,_0x21db5d){return function(_0x4f3d41){if(_0x4f3d41){var _0x34429e=typeof _0x21db5d[_0x856c('0x2d')]===_0x856c('0x2e')&&typeof _0x21db5d['limit']==='undefined';var _0x3eaced=_0x4f3d41[_0x856c('0x2f')];var _0x21a868=_0x34429e?0x0:_0x21db5d[_0x856c('0x2d')];var _0x39ab90=_0x34429e?_0x4f3d41[_0x856c('0x2f')]:_0x21db5d['offset']+_0x21db5d[_0x856c('0x30')];var _0x866950;if(_0x39ab90>=_0x3eaced){_0x39ab90=_0x3eaced;_0x866950=0xc8;}else{_0x866950=0xce;}_0x384f5f[_0x856c('0x31')](_0x866950);return _0x384f5f[_0x856c('0x32')](_0x856c('0x33'),_0x21a868+'-'+_0x39ab90+'/'+_0x3eaced)[_0x856c('0x2c')](_0x4f3d41);}return null;};}function patchUpdates(_0x5494c2){return function(_0x11299d){try{jsonpatch[_0x856c('0x34')](_0x11299d,_0x5494c2,!![]);}catch(_0x3df0c6){return BPromise['reject'](_0x3df0c6);}return _0x11299d[_0x856c('0x35')]();};}function saveUpdates(_0x32daae,_0x561486){return function(_0x46108a){if(_0x46108a){return _0x46108a[_0x856c('0x36')](_0x32daae)[_0x856c('0x20')](function(_0x30d142){return _0x30d142;});}return null;};}function removeEntity(_0x45984d,_0x592a4c){return function(_0x203499){if(_0x203499){return _0x203499[_0x856c('0x37')]()[_0x856c('0x20')](function(){_0x45984d[_0x856c('0x31')](0xcc)[_0x856c('0x2b')]();});}};}function handleEntityNotFound(_0x3292b8,_0x106cb3){return function(_0x1b81ba){if(!_0x1b81ba){_0x3292b8[_0x856c('0x2a')](0x194);}return _0x1b81ba;};}function handleError(_0x3b8753,_0x1faa6a){_0x1faa6a=_0x1faa6a||0x1f4;return function(_0x2c67d5){logger['error'](_0x2c67d5['stack']);if(_0x2c67d5[_0x856c('0x38')]){delete _0x2c67d5['name'];}_0x3b8753[_0x856c('0x31')](_0x1faa6a)[_0x856c('0x39')](_0x2c67d5);};}exports[_0x856c('0x3a')]=function(_0x257c00,_0x44ff0a){var _0x54f50b={},_0x39a792={},_0x288a1b={'count':0x0,'rows':[]};var _0xe6722e=_[_0x856c('0x3b')](db[_0x856c('0x3c')]['rawAttributes'],function(_0x295560){return{'name':_0x295560[_0x856c('0x3d')],'type':_0x295560[_0x856c('0x3e')][_0x856c('0x3f')]};});_0x39a792[_0x856c('0x40')]=_['map'](_0xe6722e,'name');_0x39a792[_0x856c('0x41')]=_[_0x856c('0x42')](_0x257c00[_0x856c('0x41')]);_0x39a792['filters']=_[_0x856c('0x43')](_0x39a792[_0x856c('0x40')],_0x39a792['query']);_0x54f50b['attributes']=_[_0x856c('0x43')](_0x39a792[_0x856c('0x40')],qs[_0x856c('0x44')](_0x257c00[_0x856c('0x41')][_0x856c('0x44')]));_0x54f50b[_0x856c('0x45')]=_0x54f50b[_0x856c('0x45')]['length']?_0x54f50b['attributes']:_0x39a792[_0x856c('0x40')];if(!_0x257c00['query'][_0x856c('0x46')](_0x856c('0x47'))){_0x54f50b[_0x856c('0x30')]=qs[_0x856c('0x30')](_0x257c00['query'][_0x856c('0x30')]);_0x54f50b[_0x856c('0x2d')]=qs[_0x856c('0x2d')](_0x257c00[_0x856c('0x41')][_0x856c('0x2d')]);}_0x54f50b[_0x856c('0x48')]=qs[_0x856c('0x49')](_0x257c00[_0x856c('0x41')]['sort']);_0x54f50b[_0x856c('0x4a')]=qs[_0x856c('0x4b')](_[_0x856c('0x4c')](_0x257c00['query'],_0x39a792[_0x856c('0x4b')]),_0xe6722e);if(_0x257c00[_0x856c('0x41')][_0x856c('0x4d')]){_0x54f50b['where']=_[_0x856c('0x4e')](_0x54f50b[_0x856c('0x4a')],{'$or':_['map'](_0xe6722e,function(_0x27a1bb){if(_0x27a1bb[_0x856c('0x3e')]!==_0x856c('0x4f')){var _0x366cdd={};_0x366cdd[_0x27a1bb[_0x856c('0x38')]]={'$like':'%'+_0x257c00[_0x856c('0x41')][_0x856c('0x4d')]+'%'};return _0x366cdd;}})});}_0x54f50b=_[_0x856c('0x4e')]({},_0x54f50b,_0x257c00[_0x856c('0x50')]);var _0x2826d7={'where':_0x54f50b[_0x856c('0x4a')]};return db[_0x856c('0x3c')][_0x856c('0x2f')](_0x2826d7)['then'](function(_0x144f3c){_0x288a1b[_0x856c('0x2f')]=_0x144f3c;if(_0x257c00[_0x856c('0x41')][_0x856c('0x51')]){_0x54f50b[_0x856c('0x52')]=[{'all':!![]}];}return db[_0x856c('0x3c')]['findAll'](_0x54f50b);})[_0x856c('0x20')](function(_0x22dfb6){_0x288a1b[_0x856c('0x53')]=_0x22dfb6;return _0x288a1b;})[_0x856c('0x20')](respondWithFilteredResult(_0x44ff0a,_0x54f50b))['catch'](handleError(_0x44ff0a,null));};exports[_0x856c('0x54')]=function(_0x564e1f,_0x3bb58e){var _0x17de4f={'raw':!![],'where':{'id':_0x564e1f['params']['id']}},_0x49d19b={};_0x49d19b[_0x856c('0x40')]=_['keys'](db['SmsMessage'][_0x856c('0x55')]);_0x49d19b[_0x856c('0x41')]=_[_0x856c('0x42')](_0x564e1f[_0x856c('0x41')]);_0x49d19b[_0x856c('0x4b')]=_[_0x856c('0x43')](_0x49d19b[_0x856c('0x40')],_0x49d19b[_0x856c('0x41')]);_0x17de4f[_0x856c('0x45')]=_[_0x856c('0x43')](_0x49d19b['model'],qs[_0x856c('0x44')](_0x564e1f[_0x856c('0x41')]['fields']));_0x17de4f[_0x856c('0x45')]=_0x17de4f['attributes'][_0x856c('0x56')]?_0x17de4f['attributes']:_0x49d19b[_0x856c('0x40')];if(_0x564e1f[_0x856c('0x41')][_0x856c('0x51')]){_0x17de4f[_0x856c('0x52')]=[{'all':!![]}];}_0x17de4f=_[_0x856c('0x4e')]({},_0x17de4f,_0x564e1f[_0x856c('0x50')]);return db['SmsMessage'][_0x856c('0x57')](_0x17de4f)[_0x856c('0x20')](handleEntityNotFound(_0x3bb58e,null))[_0x856c('0x20')](respondWithResult(_0x3bb58e,null))[_0x856c('0x58')](handleError(_0x3bb58e,null));};exports[_0x856c('0x59')]=function(_0x13faf8,_0x381a63){return db[_0x856c('0x3c')][_0x856c('0x59')](_0x13faf8[_0x856c('0x5a')],{})[_0x856c('0x20')](respondWithResult(_0x381a63,0xc9))[_0x856c('0x58')](handleError(_0x381a63,null));};exports[_0x856c('0x36')]=function(_0x514e0f,_0x19be5b){if(_0x514e0f['body']['id']){delete _0x514e0f[_0x856c('0x5a')]['id'];}return db[_0x856c('0x3c')][_0x856c('0x57')]({'where':{'id':_0x514e0f['params']['id']}})[_0x856c('0x20')](handleEntityNotFound(_0x19be5b,null))['then'](saveUpdates(_0x514e0f['body'],null))['then'](respondWithResult(_0x19be5b,null))[_0x856c('0x58')](handleError(_0x19be5b,null));};exports[_0x856c('0x37')]=function(_0x552702,_0xcbec5b){return db[_0x856c('0x3c')][_0x856c('0x57')]({'where':{'id':_0x552702[_0x856c('0x5b')]['id']}})[_0x856c('0x20')](handleEntityNotFound(_0xcbec5b,null))[_0x856c('0x20')](removeEntity(_0xcbec5b,null))['catch'](handleError(_0xcbec5b,null));};exports[_0x856c('0x5c')]=function(_0x37df56,_0x19bf62){return db[_0x856c('0x3c')][_0x856c('0x5c')]()[_0x856c('0x20')](respondWithResult(_0x19bf62,null))[_0x856c('0x58')](handleError(_0x19bf62,null));};var interaction_log=require('../../config/logger')(_0x856c('0x5d'));exports['accept']=function(_0x3f1d1c,_0x5dda99,_0x22c8f0){var _0x3f6bfb={'agent':{},'channel':'sms'};if(_0x3f1d1c[_0x856c('0x5a')]['id']){delete _0x3f1d1c[_0x856c('0x5a')]['id'];}_0x3f1d1c[_0x856c('0x5a')][_0x856c('0x5e')]=!![];_0x3f1d1c[_0x856c('0x5a')][_0x856c('0x5f')]=moment()[_0x856c('0x60')](_0x856c('0x61'));_0x3f1d1c['body'][_0x856c('0x62')]=_0x3f1d1c[_0x856c('0x5a')][_0x856c('0x62')]||_0x3f1d1c[_0x856c('0x63')]['id'];_0x3f6bfb['agent']['id']=_0x3f1d1c[_0x856c('0x5a')]['UserId'];return db[_0x856c('0x3c')][_0x856c('0x57')]({'where':{'id':_0x3f1d1c[_0x856c('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5dda99,null))[_0x856c('0x20')](saveUpdates(_0x3f1d1c[_0x856c('0x5a')],null))[_0x856c('0x20')](function(_0x2212e4){if(_0x2212e4){_0x3f6bfb[_0x856c('0x28')]=_0x2212e4[_0x856c('0x64')]({'plain':!![]});return db[_0x856c('0x65')][_0x856c('0x57')]({'where':{'id':_0x2212e4[_0x856c('0x66')]}});}return null;})[_0x856c('0x20')](handleEntityNotFound(_0x5dda99,null))[_0x856c('0x20')](function(_0x3c4136){if(_0x3c4136){return _0x3c4136['update']({'UserId':_0x3f1d1c[_0x856c('0x5a')][_0x856c('0x62')],'read1stAt':_[_0x856c('0x67')](_0x3c4136[_0x856c('0x68')])?moment()[_0x856c('0x60')](_0x856c('0x61')):undefined});}return null;})['then'](function(_0x3ff581){if(_0x3ff581){_0x3f6bfb[_0x856c('0x69')]=_0x3ff581[_0x856c('0x64')]({'plain':!![]});interaction_log[_0x856c('0x21')](_0x856c('0x6a'),_0x3f1d1c[_0x856c('0x63')]['id'],_0x3f1d1c[_0x856c('0x63')]['name'],_0x3f1d1c['user'][_0x856c('0x6b')],_0x3f6bfb[_0x856c('0x69')]['id'],_0x3f1d1c[_0x856c('0x5a')]?JSON[_0x856c('0x26')](_0x3f1d1c[_0x856c('0x5a')]):_0x856c('0x6c'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x3f6bfb);}return null;})[_0x856c('0x20')](function(_0x2dfe54){var _0x4afb6a=_0x856c('0x6d')+_0x2dfe54[_0x856c('0x28')][_0x856c('0x6e')];return db[_0x856c('0x6f')][_0x856c('0x41')](_0x4afb6a,{'type':db[_0x856c('0x70')][_0x856c('0x71')][_0x856c('0x72')],'raw':!![]})[_0x856c('0x20')](function(_0x5dea90){return _0x5dea90;});})[_0x856c('0x20')](function(_0x5bbbd0){if(_0x5bbbd0){_0x3f6bfb[_0x856c('0x28')][_0x856c('0x73')]=_0x5bbbd0[0x0];if(!_0x3f1d1c[_0x856c('0x5a')][_0x856c('0x62')])return;return db[_0x856c('0x74')]['find']({'where':{'id':_0x3f1d1c[_0x856c('0x5a')]['UserId'],'role':'agent'},'attributes':['id',_0x856c('0x38'),_0x856c('0x75'),'email',_0x856c('0x76')],'raw':!![]});}return null;})[_0x856c('0x20')](function(_0x5bda9a){if(!_0x5bda9a)return null;_0x3f6bfb[_0x856c('0x28')][_0x856c('0x77')]=_0x5bda9a;return _0x3f6bfb;})[_0x856c('0x20')](function(_0x2ed32d){if(_0x2ed32d){if(_0x3f1d1c[_0x856c('0x5a')]['manual']){_0x3f6bfb['message'][_0x856c('0x78')]=util['format'](_0x856c('0x79'),_0x3f1d1c[_0x856c('0x63')][_0x856c('0x38')]);_0x3f6bfb['message'][_0x856c('0x7a')]=_0x3f6bfb[_0x856c('0x7a')];_0x3f6bfb[_0x856c('0x28')][_0x856c('0x7b')]=_0x3f6bfb[_0x856c('0x7a')];_0x3f6bfb[_0x856c('0x28')][_0x856c('0x7c')]='accept';return respondWithRpcPromise(_0x856c('0x7d'),_0x856c('0x7d'),{'event':_0x856c('0x7e'),'message':_0x3f6bfb[_0x856c('0x28')]},client9002)[_0x856c('0x20')](function(){return _0x3f6bfb;});}return _0x3f6bfb;}return null;})['then'](respondWithResult(_0x5dda99,null))[_0x856c('0x58')](handleError(_0x5dda99,null));};var interaction_log=require(_0x856c('0x13'))(_0x856c('0x5d'));exports[_0x856c('0x7f')]=function(_0x2c630c,_0x4ef88c,_0x3f33dd){var _0x11f8aa={'agent':{},'channel':_0x856c('0x80')};if(_0x2c630c[_0x856c('0x5a')]['id']){delete _0x2c630c[_0x856c('0x5a')]['id'];}_0x2c630c[_0x856c('0x5a')][_0x856c('0x62')]=_0x2c630c[_0x856c('0x5a')][_0x856c('0x62')]||_0x2c630c['user']['id'];_0x11f8aa[_0x856c('0x77')]['id']=_0x2c630c[_0x856c('0x5a')]['UserId'];return db[_0x856c('0x3c')][_0x856c('0x57')]({'where':{'id':_0x2c630c[_0x856c('0x5b')]['id'],'UserId':null}})[_0x856c('0x20')](handleEntityNotFound(_0x4ef88c,null))['then'](function(_0x4ab55f){if(_0x4ab55f){_0x11f8aa[_0x856c('0x28')]=_0x4ab55f[_0x856c('0x64')]({'plain':!![]});return db[_0x856c('0x65')][_0x856c('0x57')]({'where':{'id':_0x4ab55f[_0x856c('0x66')]}});}return null;})[_0x856c('0x20')](handleEntityNotFound(_0x4ef88c,null))['then'](function(_0x437113){if(_0x437113){_0x11f8aa[_0x856c('0x69')]=_0x437113[_0x856c('0x64')]({'plain':!![]});interaction_log[_0x856c('0x21')](_0x856c('0x81'),_0x2c630c[_0x856c('0x63')]['id'],_0x2c630c[_0x856c('0x63')][_0x856c('0x38')],_0x2c630c[_0x856c('0x63')][_0x856c('0x6b')],_0x11f8aa[_0x856c('0x69')]['id'],_0x2c630c[_0x856c('0x5a')]?JSON[_0x856c('0x26')](_0x2c630c[_0x856c('0x5a')]):'null');return respondWithRpcPromise('RejectMessage',_0x856c('0x82'),_0x11f8aa);}return null;})['then'](function(_0x5e6a76){var _0x23f40b=_0x856c('0x6d')+_0x5e6a76[_0x856c('0x28')][_0x856c('0x6e')];return db[_0x856c('0x6f')][_0x856c('0x41')](_0x23f40b,{'type':db[_0x856c('0x70')][_0x856c('0x71')][_0x856c('0x72')],'raw':!![]})[_0x856c('0x20')](function(_0x52a64a){return _0x52a64a;});})[_0x856c('0x20')](function(_0xaf6060){if(_0xaf6060){_0x11f8aa[_0x856c('0x28')][_0x856c('0x73')]=_0xaf6060[0x0];if(!_0x2c630c[_0x856c('0x5a')][_0x856c('0x62')])return;return db['User'][_0x856c('0x57')]({'where':{'id':_0x2c630c[_0x856c('0x5a')][_0x856c('0x62')],'role':'agent'},'attributes':['id',_0x856c('0x38'),'fullname',_0x856c('0x83'),_0x856c('0x76')],'raw':!![]});}return null;})[_0x856c('0x20')](function(_0x5a6702){if(!_0x5a6702)return null;_0x11f8aa[_0x856c('0x28')][_0x856c('0x77')]=_0x5a6702;return _0x11f8aa;})[_0x856c('0x20')](function(_0x114cae){if(_0x114cae){_0x114cae[_0x856c('0x28')]['interface']=util[_0x856c('0x60')](_0x856c('0x79'),_0x2c630c[_0x856c('0x63')]['name']);_0x114cae['message'][_0x856c('0x7a')]=_0x11f8aa[_0x856c('0x7a')];_0x114cae['message'][_0x856c('0x7b')]=_0x11f8aa['channel'];_0x114cae[_0x856c('0x28')][_0x856c('0x7c')]='reject';respondWithRpcPromise('EventManager',_0x856c('0x7d'),{'event':_0x856c('0x84'),'message':_0x114cae[_0x856c('0x28')]},client9002);return _0x11f8aa;}return null;})[_0x856c('0x20')](respondWithResult(_0x4ef88c,null))[_0x856c('0x58')](handleError(_0x4ef88c,null));};exports[_0x856c('0x31')]=function(_0x3c7da4,_0x576945,_0x3a6808){if(_0x3c7da4[_0x856c('0x5a')]['id']){delete _0x3c7da4[_0x856c('0x5a')]['id'];}var _0x7f0811;return db[_0x856c('0x3c')][_0x856c('0x57')]({'where':{'id':_0x3c7da4[_0x856c('0x5b')]['id']}})[_0x856c('0x20')](handleEntityNotFound(_0x576945,null))[_0x856c('0x20')](function(_0x1075ec){if(_0x1075ec){_0x7f0811=_0x1075ec;return db[_0x856c('0x85')][_0x856c('0x57')]({'where':{'id':_0x1075ec[_0x856c('0x86')]}});}})['then'](handleEntityNotFound(_0x576945,null))[_0x856c('0x20')](function(_0x4d48fa){if(_0x4d48fa){logger[_0x856c('0x24')](_0x856c('0x25'),_0x856c('0x31'),_0x856c('0x87'),_0x4d48fa['type'],util['inspect'](_0x3c7da4[_0x856c('0x5a')],{'showHidden':![],'depth':null}));switch(_0x4d48fa[_0x856c('0x3e')]){case _0x856c('0x88'):if(_0x3c7da4[_0x856c('0x5a')][_0x856c('0x89')]&&_0x3c7da4['body'][_0x856c('0x89')]===_0x7f0811[_0x856c('0x8a')]){return _0x7f0811[_0x856c('0x36')]({'read':!![]});}else{logger[_0x856c('0x27')](_0x856c('0x8b'),'status',_0x856c('0x88'),util[_0x856c('0x8c')](_0x3c7da4['body'],{'showHidden':![],'depth':null}));}break;case _0x856c('0x8d'):if(_0x3c7da4['body'][_0x856c('0x8e')]&&_0x3c7da4[_0x856c('0x5a')][_0x856c('0x8e')]===_0x7f0811['messageId']&&_[_0x856c('0x8f')]([_0x856c('0x90'),_0x856c('0x91')],_0x3c7da4[_0x856c('0x5a')][_0x856c('0x92')])>=0x0){return _0x7f0811[_0x856c('0x36')]({'read':!![]});}else{logger[_0x856c('0x27')](_0x856c('0x8b'),_0x856c('0x31'),_0x856c('0x93'),util['inspect'](_0x3c7da4[_0x856c('0x5a')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x439bad=_0x3c7da4[_0x856c('0x5a')][_0x856c('0x94')][0x0];if(_0x439bad[_0x856c('0x31')][_0x856c('0x95')]===_0x856c('0x96')){return _0x7f0811[_0x856c('0x36')]({'read':!![]});}else{logger[_0x856c('0x27')](_0x856c('0x8b'),_0x856c('0x31'),_0x856c('0x97'),util[_0x856c('0x8c')](_0x3c7da4['body'],{'showHidden':![],'depth':null}));}break;}return _0x7f0811;}})['then'](respondWithResult(_0x576945,null))[_0x856c('0x58')](handleError(_0x576945,null));}; \ No newline at end of file +var _0x866a=['include','findAll','show','params','options','find','body','destroy','describe','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','user','role','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','agent','email','internal','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','sms-interactions','RejectMessage','rejectMessage','User','fullname','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','delivered','infobip','results','groupName','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','register','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','json','offset','limit','undefined','count','status','Content-Range','apply','reject','save','update','end','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll'];(function(_0x47781e,_0x1bd3ff){var _0x41e56e=function(_0x4bdf98){while(--_0x4bdf98){_0x47781e['push'](_0x47781e['shift']());}};_0x41e56e(++_0x1bd3ff);}(_0x866a,0x156));var _0xa866=function(_0x5d0725,_0x1ae8ad){_0x5d0725=_0x5d0725-0x0;var _0x157c30=_0x866a[_0x5d0725];return _0x157c30;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa866('0x0'));var zipdir=require(_0xa866('0x1'));var jsonpatch=require(_0xa866('0x2'));var rp=require(_0xa866('0x3'));var moment=require(_0xa866('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa866('0x5'));var util=require(_0xa866('0x6'));var path=require(_0xa866('0x7'));var sox=require('sox');var csv=require(_0xa866('0x8'));var ejs=require(_0xa866('0x9'));var fs=require('fs');var fs_extra=require(_0xa866('0xa'));var _=require(_0xa866('0xb'));var squel=require(_0xa866('0xc'));var crypto=require(_0xa866('0xd'));var jsforce=require(_0xa866('0xe'));var deskjs=require(_0xa866('0xf'));var toCsv=require(_0xa866('0x8'));var querystring=require(_0xa866('0x10'));var Papa=require('papaparse');var Redis=require(_0xa866('0x11'));var authService=require(_0xa866('0x12'));var qs=require(_0xa866('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa866('0x14'));var logger=require(_0xa866('0x15'))(_0xa866('0x16'));var utils=require(_0xa866('0x17'));var config=require(_0xa866('0x18'));var licenseUtil=require(_0xa866('0x19'));var db=require('../../mysqldb')['db'];config[_0xa866('0x1a')]=_[_0xa866('0x1b')](config[_0xa866('0x1a')],{'host':_0xa866('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa866('0x1a')]));require('./smsMessage.socket')[_0xa866('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa866('0x1e')][_0xa866('0x1f')]({'port':0x232c});var client9002=jayson[_0xa866('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x251095,_0x1afbe4,_0x5847ae,_0x2d492d){return new BPromise(function(_0x1e2211,_0xe30e66){var _0x34ca55=_0x2d492d||client;return _0x34ca55[_0xa866('0x20')](_0x251095,_0x5847ae)[_0xa866('0x21')](function(_0x48fd82){logger[_0xa866('0x22')](_0xa866('0x23'),_0x1afbe4,_0xa866('0x24'));logger[_0xa866('0x25')](_0xa866('0x26'),_0x1afbe4,_0xa866('0x24'),JSON[_0xa866('0x27')](_0x48fd82));if(_0x48fd82['error']){if(_0x48fd82[_0xa866('0x28')]['code']===0x1f4){logger['error'](_0xa866('0x23'),_0x1afbe4,_0x48fd82['error'][_0xa866('0x29')]);return _0xe30e66(_0x48fd82[_0xa866('0x28')][_0xa866('0x29')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x1afbe4,_0x48fd82[_0xa866('0x28')][_0xa866('0x29')]);return _0x1e2211(_0x48fd82['error'][_0xa866('0x29')]);}else{logger[_0xa866('0x22')](_0xa866('0x23'),_0x1afbe4,_0xa866('0x24'));_0x1e2211(_0x48fd82['result'][_0xa866('0x29')]);}})[_0xa866('0x2a')](function(_0x35a83d){logger[_0xa866('0x28')](_0xa866('0x23'),_0x1afbe4,_0x35a83d);_0xe30e66(_0x35a83d);});});}function respondWithStatusCode(_0x262ea5,_0x4ed77e){_0x4ed77e=_0x4ed77e||0xcc;return function(_0x34620d){if(_0x34620d){return _0x262ea5[_0xa866('0x2b')](_0x4ed77e);}return _0x262ea5['status'](_0x4ed77e)['end']();};}function respondWithResult(_0x243a3d,_0x25f236){_0x25f236=_0x25f236||0xc8;return function(_0x5c14b2){if(_0x5c14b2){return _0x243a3d['status'](_0x25f236)[_0xa866('0x2c')](_0x5c14b2);}};}function respondWithFilteredResult(_0x1e27ed,_0x47f42b){return function(_0xe83620){if(_0xe83620){var _0x36e73b=typeof _0x47f42b[_0xa866('0x2d')]==='undefined'&&typeof _0x47f42b[_0xa866('0x2e')]===_0xa866('0x2f');var _0x92f73b=_0xe83620[_0xa866('0x30')];var _0x11ec00=_0x36e73b?0x0:_0x47f42b['offset'];var _0x4eb663=_0x36e73b?_0xe83620[_0xa866('0x30')]:_0x47f42b[_0xa866('0x2d')]+_0x47f42b[_0xa866('0x2e')];var _0x2b9c61;if(_0x4eb663>=_0x92f73b){_0x4eb663=_0x92f73b;_0x2b9c61=0xc8;}else{_0x2b9c61=0xce;}_0x1e27ed[_0xa866('0x31')](_0x2b9c61);return _0x1e27ed['set'](_0xa866('0x32'),_0x11ec00+'-'+_0x4eb663+'/'+_0x92f73b)[_0xa866('0x2c')](_0xe83620);}return null;};}function patchUpdates(_0x592100){return function(_0x208fed){try{jsonpatch[_0xa866('0x33')](_0x208fed,_0x592100,!![]);}catch(_0x5c36ad){return BPromise[_0xa866('0x34')](_0x5c36ad);}return _0x208fed[_0xa866('0x35')]();};}function saveUpdates(_0x1abf04,_0x449ce3){return function(_0x46d324){if(_0x46d324){return _0x46d324[_0xa866('0x36')](_0x1abf04)[_0xa866('0x21')](function(_0x171958){return _0x171958;});}return null;};}function removeEntity(_0x1a0453,_0x420b1c){return function(_0x4aaba9){if(_0x4aaba9){return _0x4aaba9['destroy']()[_0xa866('0x21')](function(){_0x1a0453[_0xa866('0x31')](0xcc)[_0xa866('0x37')]();});}};}function handleEntityNotFound(_0x3596fd,_0x3636ed){return function(_0x5de401){if(!_0x5de401){_0x3596fd[_0xa866('0x2b')](0x194);}return _0x5de401;};}function handleError(_0x1ceb57,_0x81655){_0x81655=_0x81655||0x1f4;return function(_0x27c3c3){logger['error'](_0x27c3c3[_0xa866('0x38')]);if(_0x27c3c3[_0xa866('0x39')]){delete _0x27c3c3[_0xa866('0x39')];}_0x1ceb57['status'](_0x81655)[_0xa866('0x3a')](_0x27c3c3);};}exports[_0xa866('0x3b')]=function(_0x69624c,_0x2c2bbf){var _0x592df2={},_0x264e5b={},_0x560efe={'count':0x0,'rows':[]};var _0x2eb8c5=_[_0xa866('0x3c')](db[_0xa866('0x3d')][_0xa866('0x3e')],function(_0x44a0d7){return{'name':_0x44a0d7[_0xa866('0x3f')],'type':_0x44a0d7[_0xa866('0x40')][_0xa866('0x41')]};});_0x264e5b['model']=_[_0xa866('0x3c')](_0x2eb8c5,'name');_0x264e5b[_0xa866('0x42')]=_[_0xa866('0x43')](_0x69624c[_0xa866('0x42')]);_0x264e5b[_0xa866('0x44')]=_[_0xa866('0x45')](_0x264e5b[_0xa866('0x46')],_0x264e5b[_0xa866('0x42')]);_0x592df2['attributes']=_[_0xa866('0x45')](_0x264e5b[_0xa866('0x46')],qs[_0xa866('0x47')](_0x69624c['query'][_0xa866('0x47')]));_0x592df2['attributes']=_0x592df2[_0xa866('0x48')][_0xa866('0x49')]?_0x592df2[_0xa866('0x48')]:_0x264e5b['model'];if(!_0x69624c['query'][_0xa866('0x4a')](_0xa866('0x4b'))){_0x592df2[_0xa866('0x2e')]=qs[_0xa866('0x2e')](_0x69624c['query'][_0xa866('0x2e')]);_0x592df2[_0xa866('0x2d')]=qs[_0xa866('0x2d')](_0x69624c[_0xa866('0x42')][_0xa866('0x2d')]);}_0x592df2[_0xa866('0x4c')]=qs['sort'](_0x69624c[_0xa866('0x42')][_0xa866('0x4d')]);_0x592df2[_0xa866('0x4e')]=qs[_0xa866('0x44')](_[_0xa866('0x4f')](_0x69624c[_0xa866('0x42')],_0x264e5b['filters']),_0x2eb8c5);if(_0x69624c[_0xa866('0x42')][_0xa866('0x50')]){_0x592df2[_0xa866('0x4e')]=_[_0xa866('0x51')](_0x592df2[_0xa866('0x4e')],{'$or':_[_0xa866('0x3c')](_0x2eb8c5,function(_0x5c3ac2){if(_0x5c3ac2[_0xa866('0x40')]!==_0xa866('0x52')){var _0x32d67a={};_0x32d67a[_0x5c3ac2[_0xa866('0x39')]]={'$like':'%'+_0x69624c[_0xa866('0x42')][_0xa866('0x50')]+'%'};return _0x32d67a;}})});}_0x592df2=_[_0xa866('0x51')]({},_0x592df2,_0x69624c['options']);var _0x29d7e1={'where':_0x592df2[_0xa866('0x4e')]};return db['SmsMessage'][_0xa866('0x30')](_0x29d7e1)[_0xa866('0x21')](function(_0x10e782){_0x560efe[_0xa866('0x30')]=_0x10e782;if(_0x69624c[_0xa866('0x42')][_0xa866('0x53')]){_0x592df2[_0xa866('0x54')]=[{'all':!![]}];}return db['SmsMessage'][_0xa866('0x55')](_0x592df2);})[_0xa866('0x21')](function(_0x5ea9fe){_0x560efe['rows']=_0x5ea9fe;return _0x560efe;})['then'](respondWithFilteredResult(_0x2c2bbf,_0x592df2))[_0xa866('0x2a')](handleError(_0x2c2bbf,null));};exports[_0xa866('0x56')]=function(_0x314f9b,_0x2f68d2){var _0x50c88b={'raw':!![],'where':{'id':_0x314f9b[_0xa866('0x57')]['id']}},_0x2f52b1={};_0x2f52b1[_0xa866('0x46')]=_[_0xa866('0x43')](db[_0xa866('0x3d')]['rawAttributes']);_0x2f52b1[_0xa866('0x42')]=_[_0xa866('0x43')](_0x314f9b[_0xa866('0x42')]);_0x2f52b1[_0xa866('0x44')]=_[_0xa866('0x45')](_0x2f52b1[_0xa866('0x46')],_0x2f52b1[_0xa866('0x42')]);_0x50c88b['attributes']=_[_0xa866('0x45')](_0x2f52b1[_0xa866('0x46')],qs[_0xa866('0x47')](_0x314f9b[_0xa866('0x42')][_0xa866('0x47')]));_0x50c88b[_0xa866('0x48')]=_0x50c88b[_0xa866('0x48')]['length']?_0x50c88b[_0xa866('0x48')]:_0x2f52b1[_0xa866('0x46')];if(_0x314f9b[_0xa866('0x42')][_0xa866('0x53')]){_0x50c88b[_0xa866('0x54')]=[{'all':!![]}];}_0x50c88b=_['merge']({},_0x50c88b,_0x314f9b[_0xa866('0x58')]);return db[_0xa866('0x3d')][_0xa866('0x59')](_0x50c88b)['then'](handleEntityNotFound(_0x2f68d2,null))[_0xa866('0x21')](respondWithResult(_0x2f68d2,null))[_0xa866('0x2a')](handleError(_0x2f68d2,null));};exports['create']=function(_0x4b5b7d,_0x5ece26){return db[_0xa866('0x3d')]['create'](_0x4b5b7d[_0xa866('0x5a')],{})[_0xa866('0x21')](respondWithResult(_0x5ece26,0xc9))[_0xa866('0x2a')](handleError(_0x5ece26,null));};exports['update']=function(_0x4ce7cf,_0x4812f9){if(_0x4ce7cf[_0xa866('0x5a')]['id']){delete _0x4ce7cf[_0xa866('0x5a')]['id'];}return db[_0xa866('0x3d')][_0xa866('0x59')]({'where':{'id':_0x4ce7cf['params']['id']}})[_0xa866('0x21')](handleEntityNotFound(_0x4812f9,null))['then'](saveUpdates(_0x4ce7cf[_0xa866('0x5a')],null))[_0xa866('0x21')](respondWithResult(_0x4812f9,null))[_0xa866('0x2a')](handleError(_0x4812f9,null));};exports[_0xa866('0x5b')]=function(_0x35f7c2,_0x1d34e0){return db['SmsMessage'][_0xa866('0x59')]({'where':{'id':_0x35f7c2[_0xa866('0x57')]['id']}})[_0xa866('0x21')](handleEntityNotFound(_0x1d34e0,null))[_0xa866('0x21')](removeEntity(_0x1d34e0,null))['catch'](handleError(_0x1d34e0,null));};exports[_0xa866('0x5c')]=function(_0xc1252,_0x5d1898){return db[_0xa866('0x3d')]['describe']()[_0xa866('0x21')](respondWithResult(_0x5d1898,null))[_0xa866('0x2a')](handleError(_0x5d1898,null));};var interaction_log=require(_0xa866('0x15'))('sms-interactions');exports['accept']=function(_0x312969,_0x1a901a,_0x1e095d){var _0x558091={'agent':{},'channel':_0xa866('0x5d')};if(_0x312969[_0xa866('0x5a')]['id']){delete _0x312969['body']['id'];}_0x312969[_0xa866('0x5a')][_0xa866('0x5e')]=!![];_0x312969[_0xa866('0x5a')]['readAt']=moment()[_0xa866('0x5f')](_0xa866('0x60'));_0x312969[_0xa866('0x5a')][_0xa866('0x61')]=_0x312969[_0xa866('0x5a')][_0xa866('0x61')]||_0x312969['user']['id'];_0x558091['agent']['id']=_0x312969[_0xa866('0x5a')][_0xa866('0x61')];return db[_0xa866('0x3d')][_0xa866('0x59')]({'where':{'id':_0x312969[_0xa866('0x57')]['id'],'UserId':null}})[_0xa866('0x21')](handleEntityNotFound(_0x1a901a,null))[_0xa866('0x21')](saveUpdates(_0x312969['body'],null))[_0xa866('0x21')](function(_0x1e6c71){if(_0x1e6c71){_0x558091[_0xa866('0x29')]=_0x1e6c71[_0xa866('0x62')]({'plain':!![]});return db[_0xa866('0x63')][_0xa866('0x59')]({'where':{'id':_0x1e6c71[_0xa866('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x1a901a,null))['then'](function(_0x583ff4){if(_0x583ff4){return _0x583ff4[_0xa866('0x36')]({'UserId':_0x312969['body'][_0xa866('0x61')],'read1stAt':_[_0xa866('0x65')](_0x583ff4[_0xa866('0x66')])?moment()[_0xa866('0x5f')](_0xa866('0x60')):undefined});}return null;})[_0xa866('0x21')](function(_0x3ea5b3){if(_0x3ea5b3){_0x558091[_0xa866('0x67')]=_0x3ea5b3[_0xa866('0x62')]({'plain':!![]});interaction_log[_0xa866('0x22')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x312969[_0xa866('0x68')]['id'],_0x312969[_0xa866('0x68')]['name'],_0x312969[_0xa866('0x68')][_0xa866('0x69')],_0x558091[_0xa866('0x67')]['id'],_0x312969['body']?JSON[_0xa866('0x27')](_0x312969[_0xa866('0x5a')]):'null');return respondWithRpcPromise(_0xa866('0x6a'),'acceptMessage',_0x558091);}return null;})[_0xa866('0x21')](function(_0x3550ca){var _0x1718e1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3550ca[_0xa866('0x29')][_0xa866('0x6b')];return db[_0xa866('0x6c')][_0xa866('0x42')](_0x1718e1,{'type':db[_0xa866('0x6d')][_0xa866('0x6e')][_0xa866('0x6f')],'raw':!![]})[_0xa866('0x21')](function(_0x452955){return _0x452955;});})[_0xa866('0x21')](function(_0x4cc5d0){if(_0x4cc5d0){_0x558091[_0xa866('0x29')][_0xa866('0x70')]=_0x4cc5d0[0x0];if(!_0x312969[_0xa866('0x5a')][_0xa866('0x61')])return;return db['User'][_0xa866('0x59')]({'where':{'id':_0x312969['body'][_0xa866('0x61')],'role':_0xa866('0x71')},'attributes':['id',_0xa866('0x39'),'fullname',_0xa866('0x72'),_0xa866('0x73')],'raw':!![]});}return null;})[_0xa866('0x21')](function(_0x33c70f){if(!_0x33c70f)return null;_0x558091['message'][_0xa866('0x71')]=_0x33c70f;return _0x558091;})[_0xa866('0x21')](function(_0x24bfa4){if(_0x24bfa4){if(_0x312969[_0xa866('0x5a')]['manual']){_0x558091[_0xa866('0x29')]['interface']=util[_0xa866('0x5f')](_0xa866('0x74'),_0x312969[_0xa866('0x68')][_0xa866('0x39')]);_0x558091[_0xa866('0x29')][_0xa866('0x75')]=_0x558091[_0xa866('0x75')];_0x558091[_0xa866('0x29')][_0xa866('0x76')]=_0x558091[_0xa866('0x75')];_0x558091['message'][_0xa866('0x77')]=_0xa866('0x78');return respondWithRpcPromise('EventManager',_0xa866('0x79'),{'event':_0xa866('0x7a'),'message':_0x558091['message']},client9002)[_0xa866('0x21')](function(){return _0x558091;});}return _0x558091;}return null;})['then'](respondWithResult(_0x1a901a,null))[_0xa866('0x2a')](handleError(_0x1a901a,null));};var interaction_log=require('../../config/logger')(_0xa866('0x7b'));exports[_0xa866('0x34')]=function(_0x255f5b,_0x11b3ab,_0x215a8e){var _0x32452b={'agent':{},'channel':'sms'};if(_0x255f5b[_0xa866('0x5a')]['id']){delete _0x255f5b[_0xa866('0x5a')]['id'];}_0x255f5b['body'][_0xa866('0x61')]=_0x255f5b[_0xa866('0x5a')]['UserId']||_0x255f5b[_0xa866('0x68')]['id'];_0x32452b[_0xa866('0x71')]['id']=_0x255f5b['body'][_0xa866('0x61')];return db[_0xa866('0x3d')][_0xa866('0x59')]({'where':{'id':_0x255f5b[_0xa866('0x57')]['id'],'UserId':null}})[_0xa866('0x21')](handleEntityNotFound(_0x11b3ab,null))[_0xa866('0x21')](function(_0x4c375a){if(_0x4c375a){_0x32452b['message']=_0x4c375a[_0xa866('0x62')]({'plain':!![]});return db[_0xa866('0x63')][_0xa866('0x59')]({'where':{'id':_0x4c375a[_0xa866('0x64')]}});}return null;})[_0xa866('0x21')](handleEntityNotFound(_0x11b3ab,null))['then'](function(_0x5bb986){if(_0x5bb986){_0x32452b[_0xa866('0x67')]=_0x5bb986['get']({'plain':!![]});interaction_log[_0xa866('0x22')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x255f5b[_0xa866('0x68')]['id'],_0x255f5b[_0xa866('0x68')][_0xa866('0x39')],_0x255f5b[_0xa866('0x68')][_0xa866('0x69')],_0x32452b[_0xa866('0x67')]['id'],_0x255f5b[_0xa866('0x5a')]?JSON[_0xa866('0x27')](_0x255f5b['body']):'null');return respondWithRpcPromise(_0xa866('0x7c'),_0xa866('0x7d'),_0x32452b);}return null;})[_0xa866('0x21')](function(_0x4c363b){var _0x5c096d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4c363b['message']['ContactId'];return db[_0xa866('0x6c')][_0xa866('0x42')](_0x5c096d,{'type':db[_0xa866('0x6d')][_0xa866('0x6e')][_0xa866('0x6f')],'raw':!![]})[_0xa866('0x21')](function(_0x4eb597){return _0x4eb597;});})[_0xa866('0x21')](function(_0x49b145){if(_0x49b145){_0x32452b[_0xa866('0x29')][_0xa866('0x70')]=_0x49b145[0x0];if(!_0x255f5b[_0xa866('0x5a')]['UserId'])return;return db[_0xa866('0x7e')][_0xa866('0x59')]({'where':{'id':_0x255f5b[_0xa866('0x5a')]['UserId'],'role':_0xa866('0x71')},'attributes':['id',_0xa866('0x39'),_0xa866('0x7f'),_0xa866('0x72'),_0xa866('0x73')],'raw':!![]});}return null;})[_0xa866('0x21')](function(_0x5237e2){if(!_0x5237e2)return null;_0x32452b[_0xa866('0x29')][_0xa866('0x71')]=_0x5237e2;return _0x32452b;})['then'](function(_0x21c4ca){if(_0x21c4ca){_0x21c4ca[_0xa866('0x29')]['interface']=util[_0xa866('0x5f')](_0xa866('0x74'),_0x255f5b['user'][_0xa866('0x39')]);_0x21c4ca['message'][_0xa866('0x75')]=_0x32452b[_0xa866('0x75')];_0x21c4ca['message'][_0xa866('0x76')]=_0x32452b[_0xa866('0x75')];_0x21c4ca[_0xa866('0x29')][_0xa866('0x77')]=_0xa866('0x34');respondWithRpcPromise('EventManager',_0xa866('0x79'),{'event':_0xa866('0x80'),'message':_0x21c4ca[_0xa866('0x29')]},client9002);return _0x32452b;}return null;})['then'](respondWithResult(_0x11b3ab,null))[_0xa866('0x2a')](handleError(_0x11b3ab,null));};exports[_0xa866('0x31')]=function(_0x209e1c,_0x47b0cc,_0x3a6044){if(_0x209e1c[_0xa866('0x5a')]['id']){delete _0x209e1c[_0xa866('0x5a')]['id'];}var _0x569012;return db[_0xa866('0x3d')][_0xa866('0x59')]({'where':{'id':_0x209e1c[_0xa866('0x57')]['id']}})[_0xa866('0x21')](handleEntityNotFound(_0x47b0cc,null))[_0xa866('0x21')](function(_0x9bc8a3){if(_0x9bc8a3){_0x569012=_0x9bc8a3;return db['SmsAccount'][_0xa866('0x59')]({'where':{'id':_0x9bc8a3[_0xa866('0x81')]}});}})[_0xa866('0x21')](handleEntityNotFound(_0x47b0cc,null))[_0xa866('0x21')](function(_0x21aeba){if(_0x21aeba){logger[_0xa866('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa866('0x31'),_0xa866('0x82'),_0x21aeba[_0xa866('0x40')],util[_0xa866('0x83')](_0x209e1c[_0xa866('0x5a')],{'showHidden':![],'depth':null}));switch(_0x21aeba[_0xa866('0x40')]){case _0xa866('0x84'):if(_0x209e1c[_0xa866('0x5a')]['MessageSid']&&_0x209e1c[_0xa866('0x5a')][_0xa866('0x85')]===_0x569012[_0xa866('0x86')]){return _0x569012['update']({'read':!![]});}else{logger['error'](_0xa866('0x87'),_0xa866('0x31'),_0xa866('0x84'),util[_0xa866('0x83')](_0x209e1c[_0xa866('0x5a')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x209e1c[_0xa866('0x5a')][_0xa866('0x88')]&&_0x209e1c['body']['MessageUUID']===_0x569012[_0xa866('0x86')]&&_[_0xa866('0x89')](['sent',_0xa866('0x8a')],_0x209e1c[_0xa866('0x5a')]['Status'])>=0x0){return _0x569012['update']({'read':!![]});}else{logger[_0xa866('0x28')](_0xa866('0x87'),_0xa866('0x31'),'plivio',util[_0xa866('0x83')](_0x209e1c[_0xa866('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xa866('0x8b'):var _0x16a101=_0x209e1c['body'][_0xa866('0x8c')][0x0];if(_0x16a101['status'][_0xa866('0x8d')]==='DELIVERED'){return _0x569012['update']({'read':!![]});}else{logger[_0xa866('0x28')](_0xa866('0x87'),_0xa866('0x31'),'infobip',util['inspect'](_0x209e1c[_0xa866('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x569012;}})['then'](respondWithResult(_0x47b0cc,null))[_0xa866('0x2a')](handleError(_0x47b0cc,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 504fdb9..4bcbc69 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 _0x4826=['SmsMessage','setMaxListeners','remove','emit','events','../../mysqldb'];(function(_0x28d225,_0x43be18){var _0x1f79e1=function(_0x362c23){while(--_0x362c23){_0x28d225['push'](_0x28d225['shift']());}};_0x1f79e1(++_0x43be18);}(_0x4826,0xd6));var _0x6482=function(_0x577601,_0x113607){_0x577601=_0x577601-0x0;var _0x59b842=_0x4826[_0x577601];return _0x59b842;};'use strict';var EventEmitter=require(_0x6482('0x0'));var SmsMessage=require(_0x6482('0x1'))['db'][_0x6482('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x6482('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6482('0x4')};function emitEvent(_0x139e7c){return function(_0x45eb3f,_0x445523,_0x910a7e){SmsMessageEvents[_0x6482('0x5')](_0x139e7c+':'+_0x45eb3f['id'],_0x45eb3f);SmsMessageEvents[_0x6482('0x5')](_0x139e7c,_0x45eb3f);_0x910a7e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x4073=['SmsMessage','setMaxListeners','update','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x5a9130,_0x1a32f3){var _0x53580d=function(_0x357363){while(--_0x357363){_0x5a9130['push'](_0x5a9130['shift']());}};_0x53580d(++_0x1a32f3);}(_0x4073,0x1be));var _0x3407=function(_0x14feec,_0x4a0079){_0x14feec=_0x14feec-0x0;var _0x107e54=_0x4073[_0x14feec];return _0x107e54;};'use strict';var EventEmitter=require(_0x3407('0x0'));var SmsMessage=require(_0x3407('0x1'))['db'][_0x3407('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x3407('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3407('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2f18f4){return function(_0x239db5,_0xa788dc,_0x3d925b){SmsMessageEvents['emit'](_0x2f18f4+':'+_0x239db5['id'],_0x239db5);SmsMessageEvents['emit'](_0x2f18f4,_0x239db5);_0x3d925b(null);};}for(var e in events){if(events[_0x3407('0x5')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x3407('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 0ed8fb7..02a6d19 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 _0xc749=['get','toLowerCase','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','createdAt','catch','error','direction','out','find','type','twilio','accountSid','authToken','phone','messages','body','remote','sid','update','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','split','sms','POST','user_key','total_sent','internal_order_id','read','SmsMessage,\x20%s,\x20%s,\x20%s','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','data','queued_count','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','/api/sms/messages/','/status?token=','token','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','infobip','/sms/2/text/advanced','application/json','IBSSO\x20','csc','crypto','apiKey','login','timestamp','keys','sort','createHash','md5','digest','hex','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsMessage','messageId','fti_sms_messages','FULLTEXT','models'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc749,0x16a));var _0x9c74=function(_0x5b7fc7,_0x60f01e){_0x5b7fc7=_0x5b7fc7-0x0;var _0x3d0bd2=_0xc749[_0x5b7fc7];return _0x3d0bd2;};'use strict';var _=require(_0x9c74('0x0'));var util=require(_0x9c74('0x1'));var logger=require(_0x9c74('0x2'))(_0x9c74('0x3'));var moment=require('moment');var BPromise=require(_0x9c74('0x4'));var rp=require(_0x9c74('0x5'));var fs=require('fs');var path=require(_0x9c74('0x6'));var rimraf=require(_0x9c74('0x7'));var config=require(_0x9c74('0x8'));var attributes=require('./smsMessage.attributes');module[_0x9c74('0x9')]=function(_0x14ae06,_0x427734){return _0x14ae06[_0x9c74('0xa')](_0x9c74('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x9c74('0xc')]},{'name':_0x9c74('0xd'),'fields':['body'],'type':_0x9c74('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x34ca8f,_0x9a36ce,_0x29c9ce){var _0x47d52d=_0x14ae06[_0x9c74('0xf')];var _0x42ab42=_0x34ca8f[_0x9c74('0x10')]({'plain':!![]});if(_0x42ab42['direction'][_0x9c74('0x11')]()==='in'||_0x42ab42['direction'][_0x9c74('0x11')]()==='out'&&!_0x42ab42[_0x9c74('0x12')]&&!_[_0x9c74('0x13')](_0x42ab42[_0x9c74('0x14')])&&!_['isNil'](_0x42ab42[_0x9c74('0x15')])){_0x47d52d[_0x9c74('0x16')][_0x9c74('0x17')]({'where':{'id':_0x42ab42[_0x9c74('0x15')]}})[_0x9c74('0x18')](function(_0x5ec47a){if(_0x5ec47a){_0x5ec47a['update']({'lastMsgAt':_0x42ab42[_0x9c74('0x19')],'lastMsgDirection':_0x42ab42['direction'][_0x9c74('0x11')]()});}})[_0x9c74('0x1a')](function(_0x108680){console[_0x9c74('0x1b')](_0x108680);});}if(_0x42ab42[_0x9c74('0x1c')]===_0x9c74('0x1d')&&!_0x42ab42[_0x9c74('0x12')]){var _0x2df1f0;_0x47d52d['SmsAccount'][_0x9c74('0x1e')]({'where':{'id':_0x42ab42['SmsAccountId']},'raw':!![]})['then'](function(_0x15fd23){_0x2df1f0=_0x15fd23;if(_0x2df1f0&&_0x2df1f0['type']){switch(_0x2df1f0[_0x9c74('0x1f')]){case _0x9c74('0x20'):var _0x543c17=require(_0x9c74('0x20'));if(_0x2df1f0[_0x9c74('0x21')]&&_0x2df1f0[_0x9c74('0x22')]&&_0x2df1f0[_0x9c74('0x23')]){var _0x245a98=new _0x543c17(_0x2df1f0[_0x9c74('0x21')],_0x2df1f0['authToken']);_0x245a98[_0x9c74('0x24')]['create']({'body':_0x42ab42[_0x9c74('0x25')],'to':_0x42ab42[_0x9c74('0x23')],'from':_0x2df1f0[_0x9c74('0x23')],'statusCallback':_0x2df1f0[_0x9c74('0x26')]+'/api/sms/messages/'+_0x42ab42['id']+'/status?token='+_0x2df1f0['token']})['then'](function(_0x593e03){if(_0x593e03[_0x9c74('0x27')]){return _0x34ca8f[_0x9c74('0x28')]({'messageId':_0x593e03[_0x9c74('0x27')]});}})['catch'](function(_0x52ecfe){logger[_0x9c74('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9c74('0x29'),_0x9c74('0x20'),util[_0x9c74('0x2a')](_0x52ecfe,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9c74('0x29'),_0x9c74('0x20'),_0x9c74('0x2b'));}break;case _0x9c74('0x2c'):var _0x2bee8e=_0x9c74('0x2d');if(_0x2df1f0['username']&&_0x2df1f0[_0x9c74('0x2e')]){var _0x4d6034={'recipient':[_0x42ab42['phone']],'message':_0x42ab42['body'],'message_type':_0x2df1f0[_0x9c74('0x2f')]};if(_0x2df1f0[_0x9c74('0x2f')]&&_0x2df1f0[_0x9c74('0x2f')]!=='SI'){_0x4d6034[_0x9c74('0x30')]=_0x2df1f0[_0x9c74('0x23')];}var _0x5a22ce={'url':_0x2bee8e+_0x9c74('0x31')+_0x2df1f0[_0x9c74('0x32')]+'&password='+_0x2df1f0[_0x9c74('0x2e')],'method':'GET'};rp(_0x5a22ce)[_0x9c74('0x18')](function(_0x3413a6){var _0x2a7840=_0x3413a6[_0x9c74('0x33')](';');var _0x4b4e37={'user_key':_0x2a7840[0x0],'session_key':_0x2a7840[0x1]};_0x5a22ce={'url':_0x2bee8e+_0x9c74('0x34'),'method':_0x9c74('0x35'),'headers':{'user_key':_0x4b4e37[_0x9c74('0x36')],'Session_key':_0x4b4e37['session_key']},'json':!![],'body':_0x4d6034};return rp(_0x5a22ce);})[_0x9c74('0x18')](function(_0x3792f2){if(_0x3792f2[_0x9c74('0x37')]>=0x1){var _0x2a2854={'messageId':_0x3792f2[_0x9c74('0x38')]};if(_0x2df1f0[_0x9c74('0x2f')]!=='GP'||!_0x2df1f0['deliveryReport']){_0x2a2854[_0x9c74('0x39')]=!![];}return _0x34ca8f[_0x9c74('0x28')](_0x2a2854);}else{return logger[_0x9c74('0x1b')](_0x9c74('0x3a'),_0x9c74('0x29'),_0x9c74('0x2c'),util[_0x9c74('0x2a')](_0x3792f2,{'showHidden':![],'depth':null}));}})[_0x9c74('0x1a')](function(_0xf4db8a){return logger[_0x9c74('0x1b')](_0x9c74('0x3a'),_0x9c74('0x29'),'skebby',util[_0x9c74('0x2a')](_0xf4db8a,{'showHidden':![],'depth':null}));});}else{logger[_0x9c74('0x1b')](_0x9c74('0x3a'),_0x9c74('0x29'),_0x9c74('0x2c'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x9c74('0x3b'):if(_0x2df1f0['authToken']){var _0x29479={'recipient':_0x42ab42[_0x9c74('0x23')],'message':_0x42ab42[_0x9c74('0x25')],'sender':_0x2df1f0[_0x9c74('0x3c')]||_0x2df1f0[_0x9c74('0x23')],'authorization':_0x2df1f0[_0x9c74('0x22')]};var _0x9a36ce={'method':'POST','uri':_0x9c74('0x3d'),'body':_0x29479,'json':!![]};rp(_0x9a36ce)[_0x9c74('0x18')](function(_0x479a8c){var _0x1ee807={'messageId':_0x479a8c[_0x9c74('0x3e')]};if(!_0x2df1f0[_0x9c74('0x3f')]){_0x1ee807[_0x9c74('0x39')]=!![];}return _0x34ca8f['update'](_0x1ee807);})[_0x9c74('0x1a')](function(_0x160f39){logger[_0x9c74('0x1b')](_0x9c74('0x3a'),_0x9c74('0x29'),'connectel',util[_0x9c74('0x2a')](_0x160f39,{'showHidden':![],'depth':null}));});}else{logger[_0x9c74('0x1b')](_0x9c74('0x3a'),'afterCreate',_0x9c74('0x3b'),_0x9c74('0x40'));}break;case _0x9c74('0x41'):if(_0x2df1f0[_0x9c74('0x32')]&&_0x2df1f0[_0x9c74('0x2e')]){var _0x29479={'messages':[{'source':_0x9c74('0x42'),'to':_0x42ab42[_0x9c74('0x23')],'body':_0x42ab42['body'],'from':_0x2df1f0[_0x9c74('0x3c')]||_0x2df1f0[_0x9c74('0x23')]}]};var _0x466b3c=util[_0x9c74('0x43')](_0x9c74('0x44'),_0x2df1f0[_0x9c74('0x32')],_0x2df1f0[_0x9c74('0x2e')]);var _0x9a36ce={'method':_0x9c74('0x35'),'uri':_0x9c74('0x45'),'body':_0x29479,'headers':{'Authorization':util['format'](_0x9c74('0x46'),new Buffer(_0x466b3c)[_0x9c74('0x47')](_0x9c74('0x48')))},'json':!![]};rp(_0x9a36ce)['then'](function(_0x205cca){if(_0x205cca['http_code']>=0xc8&&_0x205cca['http_code']<=0xce){if(_0x205cca[_0x9c74('0x49')]&&_0x205cca[_0x9c74('0x49')][_0x9c74('0x4a')]>0x0){var _0x131f81=_['head'](_0x205cca['data'][_0x9c74('0x24')]);var _0x50b366={'messageId':_0x131f81[_0x9c74('0x4b')]};if(!_0x2df1f0['deliveryReport']){_0x50b366[_0x9c74('0x39')]=!![];}return _0x34ca8f['update'](_0x50b366);}else{logger[_0x9c74('0x1b')](_0x9c74('0x3a'),_0x9c74('0x29'),_0x9c74('0x4c'),util['inspect'](_0x205cca,{'showHidden':![],'depth':null}));}}else{logger[_0x9c74('0x1b')](_0x9c74('0x3a'),'afterCreate',_0x9c74('0x4c'),util[_0x9c74('0x2a')](_0x205cca,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3bd1de){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9c74('0x29'),_0x9c74('0x4c'),util['inspect'](_0x3bd1de,{'showHidden':![],'depth':null}));});}else{logger[_0x9c74('0x1b')](_0x9c74('0x3a'),'afterCreate','clickSend',_0x9c74('0x4d'));}break;case _0x9c74('0x4e'):if(_0x2df1f0[_0x9c74('0x4f')]&&_0x2df1f0[_0x9c74('0x22')]){var _0x29479={'dst':_0x42ab42[_0x9c74('0x23')],'text':_0x42ab42[_0x9c74('0x25')],'src':_0x2df1f0[_0x9c74('0x3c')]||_0x2df1f0['phone'],'url':_0x2df1f0[_0x9c74('0x26')]+_0x9c74('0x50')+_0x42ab42['id']+_0x9c74('0x51')+_0x2df1f0[_0x9c74('0x52')]};var _0x466b3c=util[_0x9c74('0x43')](_0x9c74('0x44'),_0x2df1f0[_0x9c74('0x4f')],_0x2df1f0[_0x9c74('0x22')]);var _0x9a36ce={'method':_0x9c74('0x35'),'uri':util[_0x9c74('0x43')](_0x9c74('0x53'),_0x2df1f0['authId']),'body':_0x29479,'headers':{'Authorization':util[_0x9c74('0x43')](_0x9c74('0x46'),new Buffer(_0x466b3c)[_0x9c74('0x47')]('base64'))},'json':!![]};rp(_0x9a36ce)[_0x9c74('0x18')](function(_0x33b325){var _0xb20f14={'messageId':_0x33b325[_0x9c74('0x54')][0x0]};return _0x34ca8f[_0x9c74('0x28')](_0xb20f14);})[_0x9c74('0x1a')](function(_0x482512){logger[_0x9c74('0x1b')](_0x9c74('0x3a'),_0x9c74('0x29'),_0x9c74('0x4e'),util[_0x9c74('0x2a')](_0x482512,{'showHidden':![],'depth':null}));});}else{logger[_0x9c74('0x1b')](_0x9c74('0x3a'),_0x9c74('0x29'),_0x9c74('0x4e'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x9c74('0x55'):if(_0x2df1f0['username']&&_0x2df1f0[_0x9c74('0x2e')]){if(_0x2df1f0['baseUrl']){var _0x41b385={'method':'POST','uri':_0x2df1f0['baseUrl']+'/auth/1/session','body':{'username':_0x2df1f0[_0x9c74('0x32')],'password':_0x2df1f0[_0x9c74('0x2e')]},'json':!![]};return rp(_0x41b385)[_0x9c74('0x18')](function(_0x436a66){var _0x35b44f={'method':'POST','uri':_0x2df1f0['baseUrl']+_0x9c74('0x56'),'body':{'messages':[{'from':_0x2df1f0[_0x9c74('0x23')],'destinations':[{'to':_0x42ab42[_0x9c74('0x23')]}],'text':_0x42ab42[_0x9c74('0x25')],'notifyUrl':_0x2df1f0[_0x9c74('0x26')]+_0x9c74('0x50')+_0x42ab42['id']+_0x9c74('0x51')+_0x2df1f0[_0x9c74('0x52')],'notifyContentType':_0x9c74('0x57'),'callbackData':_0x2df1f0[_0x9c74('0x23')]+';'+_0x42ab42['body']}]},'headers':{'Authorization':_0x9c74('0x58')+_0x436a66['token']},'json':!![]};return rp(_0x35b44f)[_0x9c74('0x18')](function(_0x45e3a6){if(_0x45e3a6[_0x9c74('0x24')]){var _0x10dac8={'messageId':_0x45e3a6[_0x9c74('0x24')][0x0][_0x9c74('0xc')]};if(!_0x2df1f0['deliveryReport']){_0x10dac8[_0x9c74('0x39')]=!![];}return _0x34ca8f['update'](_0x10dac8);}else{return logger['error'](_0x9c74('0x3a'),_0x9c74('0x29'),'infobip',util[_0x9c74('0x2a')](_0x45e3a6,{'showHidden':![],'depth':null}));}});})[_0x9c74('0x1a')](function(_0x16ea9b){return logger[_0x9c74('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9c74('0x29'),_0x9c74('0x55'),util[_0x9c74('0x2a')](_0x16ea9b,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9c74('0x29'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9c74('0x29'),_0x9c74('0x55'),_0x9c74('0x4d'));}break;case _0x9c74('0x59'):var _0x1a1c49=require(_0x9c74('0x5a'));if(_0x2df1f0[_0x9c74('0x5b')]){var _0x249a00={};_0x249a00[_0x9c74('0x5c')]=_0x2df1f0['username'];_0x249a00['phone']=_0x42ab42[_0x9c74('0x23')];_0x249a00[_0x9c74('0x30')]=_0x2df1f0['phone'];_0x249a00['text']=_0x42ab42['body'];_0x249a00[_0x9c74('0x5d')]=+new Date();var _0x1ba80e='';var _0x54a39a='';var _0x1952e8=Object[_0x9c74('0x5e')](_0x249a00);_0x1952e8[_0x9c74('0x5f')]();for(var _0xd6883b=0x0;_0xd6883b<_0x1952e8['length'];_0xd6883b++){if(_0x1ba80e!=''){_0x1ba80e+='&';}_0x1ba80e+=_0x1952e8[_0xd6883b]+'='+encodeURIComponent(_0x249a00[_0x1952e8[_0xd6883b]]);_0x54a39a+=_0x249a00[_0x1952e8[_0xd6883b]];}_0x54a39a+=_0x2df1f0[_0x9c74('0x5b')];_0x54a39a=_0x1a1c49[_0x9c74('0x60')](_0x9c74('0x61'))[_0x9c74('0x28')](_0x54a39a)[_0x9c74('0x62')](_0x9c74('0x63'));if(_0x1ba80e!==''){_0x1ba80e+='&';}_0x1ba80e+=_0x9c74('0x64')+_0x54a39a;var _0x5a22ce={'method':_0x9c74('0x65'),'uri':_0x2df1f0['baseUrl']+_0x9c74('0x66')+_0x1ba80e,'json':!![]};return rp(_0x5a22ce)[_0x9c74('0x18')](function(_0x43acba){var _0xa2e068=Object[_0x9c74('0x5e')](_0x43acba);if(_0x43acba[_0xa2e068[0x0]][_0x9c74('0x1b')]&&parseInt(_0x43acba[_0xa2e068[0x0]]['error'])===0x0){var _0x39c8ef={'messageId':_0x43acba[_0xa2e068[0x0]][_0x9c74('0x67')]};if(!_0x2df1f0[_0x9c74('0x3f')]){_0x39c8ef[_0x9c74('0x39')]=!![];}return _0x34ca8f[_0x9c74('0x28')](_0x39c8ef);}else{return logger['error'](_0x9c74('0x3a'),_0x9c74('0x29'),_0x9c74('0x59'),util[_0x9c74('0x2a')](_0x43acba[_0x9c74('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x161116){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9c74('0x29'),_0x9c74('0x59'),util[_0x9c74('0x2a')](_0x161116,{'showHidden':![],'depth':null}));});}else{logger[_0x9c74('0x1b')](_0x9c74('0x3a'),_0x9c74('0x29'),_0x9c74('0x59'),_0x9c74('0x68'));}break;case _0x9c74('0x69'):if(_0x2df1f0[_0x9c74('0x5b')]){var _0x257987={'method':_0x9c74('0x35'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x2df1f0[_0x9c74('0x5b')]},'body':{'content':_0x42ab42[_0x9c74('0x25')],'to':[_0x42ab42['phone']],'from':_0x2df1f0[_0x9c74('0x23')],'binary':![],'clientMessageId':_0x9c74('0x6a'),'charset':_0x9c74('0x6b')},'json':!![]};rp(_0x257987)[_0x9c74('0x18')](function(_0x476f04){if(!_0x476f04['error']){var _0x39611b={'messageId':_0x476f04[_0x9c74('0x24')][0x0][_0x9c74('0x6c')]};if(!_0x2df1f0[_0x9c74('0x3f')]){_0x39611b[_0x9c74('0x39')]=!![];}return _0x34ca8f[_0x9c74('0x28')](_0x39611b);}else{return logger[_0x9c74('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9c74('0x29'),'clickatell',util[_0x9c74('0x2a')](_0x476f04[_0x9c74('0x1b')],{'showHidden':![],'depth':null}));}})[_0x9c74('0x1a')](function(_0x2247ad){return logger[_0x9c74('0x1b')](_0x9c74('0x3a'),_0x9c74('0x29'),_0x9c74('0x69'),util[_0x9c74('0x2a')](_0x2247ad,{'showHidden':![],'depth':null}));});}else{logger[_0x9c74('0x1b')](_0x9c74('0x3a'),'afterCreate',_0x9c74('0x69'),_0x9c74('0x68'));}break;case _0x9c74('0x6d'):if(_0x2df1f0['username']&&_0x2df1f0[_0x9c74('0x2e')]){var _0x466b3c=util[_0x9c74('0x43')]('%s:%s',_0x2df1f0[_0x9c74('0x32')],_0x2df1f0[_0x9c74('0x2e')]);var _0x9a36ce={'method':'POST','uri':_0x9c74('0x6e')+_0x2df1f0[_0x9c74('0x6f')]+_0x9c74('0x70'),'body':{'to':[_0x42ab42[_0x9c74('0x23')]],'text':_0x42ab42[_0x9c74('0x25')],'from':_0x2df1f0['phone'],'applicationId':_0x2df1f0[_0x9c74('0x71')]},'headers':{'Authorization':util['format'](_0x9c74('0x46'),new Buffer(_0x466b3c)['toString']('base64'))},'json':!![]};rp(_0x9a36ce)['then'](function(_0xe20fde){if(_0xe20fde['id']){var _0x226c9f={'messageId':_0xe20fde['id']};return _0x34ca8f['update'](_0x226c9f);}else{logger['error'](_0x9c74('0x3a'),_0x9c74('0x29'),'bandwidth',util[_0x9c74('0x2a')](_0xe20fde,{'showHidden':![],'depth':null}));}})[_0x9c74('0x1a')](function(_0x5c0c03){logger[_0x9c74('0x1b')](_0x9c74('0x3a'),'afterCreate','bandwidth',util[_0x9c74('0x2a')](_0x5c0c03,{'showHidden':![],'depth':null}));});}else{logger[_0x9c74('0x1b')](_0x9c74('0x3a'),_0x9c74('0x29'),'bandwidth',_0x9c74('0x4d'));}break;case _0x9c74('0x72'):if(_0x2df1f0[_0x9c74('0x5b')]){var _0x4f8379={};var _0x5a22ce={'method':_0x9c74('0x35'),'uri':_0x9c74('0x73'),'headers':{'Authorization':_0x9c74('0x74')+_0x2df1f0[_0x9c74('0x5b')],'Content-Type':_0x9c74('0x57')},'body':{'from':_0x2df1f0[_0x9c74('0x23')],'to':_0x42ab42['phone'],'text':_0x42ab42[_0x9c74('0x25')]},'json':!![]};return rp(_0x5a22ce)[_0x9c74('0x18')](function(_0x114fa7){if(_0x114fa7[_0x9c74('0x75')]==0xca){_0x4f8379[_0x9c74('0x76')]=_0x114fa7;var _0x132454={'method':_0x9c74('0x35'),'uri':_0x9c74('0x77'),'headers':{'Authorization':'Bearer\x20'+_0x2df1f0[_0x9c74('0x5b')],'Content-Type':_0x9c74('0x57')},'body':{'refid':_0x4f8379[_0x9c74('0x76')][_0x9c74('0x78')]},'json':!![]};return rp(_0x132454)[_0x9c74('0x18')](function(_0x22250a){_0x4f8379[_0x9c74('0x79')]=_0x22250a;var _0x537463={'messageId':_0x4f8379[_0x9c74('0x76')][_0x9c74('0x78')],'read':!![]};return _0x34ca8f['update'](_0x537463);});}else{return logger[_0x9c74('0x1b')](_0x9c74('0x3a'),'afterCreate',_0x9c74('0x72'),util[_0x9c74('0x2a')](_0x114fa7,{'showHidden':![],'depth':null}));}})[_0x9c74('0x1a')](function(_0x4dbc78){return logger[_0x9c74('0x1b')](_0x9c74('0x3a'),_0x9c74('0x29'),_0x9c74('0x72'),util[_0x9c74('0x2a')](_0x4dbc78,{'showHidden':![],'depth':null}));});}else{return logger[_0x9c74('0x1b')](_0x9c74('0x3a'),'afterCreate',_0x9c74('0x72'),_0x9c74('0x7a'));}break;}}})[_0x9c74('0x7b')](function(){_0x29c9ce();});}else{_0x29c9ce();}}},'charset':_0x9c74('0x7c'),'collate':_0x9c74('0x7d')});}; \ No newline at end of file +var _0xe30b=['split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','xCALLY\x20Motion','format','%s:%s','Basic\x20%s','toString','base64','http_code','queued_count','head','data','message_id','clickSend','plivo','remote','https://api.plivo.com/v1/Account/%s/Message/','authId','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','keys','length','apiKey','createHash','md5','digest','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','uuid','UTF-8','apiMessageId','clickatell','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','bandwidth','intelepeer','Bearer\x20','message','refid','status','Token\x20not\x20received','finally','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','toLowerCase','direction','out','secret','isNil','SmsInteraction','findOne','SmsInteractionId','then','update','catch','SmsAccount','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','/api/sms/messages/','/status?token=','token','sid','error','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET'];(function(_0x487ff1,_0x3971b5){var _0x4a4678=function(_0x212d68){while(--_0x212d68){_0x487ff1['push'](_0x487ff1['shift']());}};_0x4a4678(++_0x3971b5);}(_0xe30b,0xbb));var _0xbe30=function(_0x1f0679,_0x53d43c){_0x1f0679=_0x1f0679-0x0;var _0x3dc3a4=_0xe30b[_0x1f0679];return _0x3dc3a4;};'use strict';var _=require(_0xbe30('0x0'));var util=require(_0xbe30('0x1'));var logger=require('../../config/logger')(_0xbe30('0x2'));var moment=require(_0xbe30('0x3'));var BPromise=require(_0xbe30('0x4'));var rp=require(_0xbe30('0x5'));var fs=require('fs');var path=require(_0xbe30('0x6'));var rimraf=require(_0xbe30('0x7'));var config=require(_0xbe30('0x8'));var attributes=require(_0xbe30('0x9'));module[_0xbe30('0xa')]=function(_0x898f37,_0x376ce9){return _0x898f37[_0xbe30('0xb')](_0xbe30('0xc'),attributes,{'tableName':_0xbe30('0xd'),'paranoid':![],'indexes':[{'name':_0xbe30('0xe'),'fields':[_0xbe30('0xe')]},{'name':_0xbe30('0xf'),'fields':[_0xbe30('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1d57be,_0x16d60,_0x4cf48c){var _0x45a825=_0x898f37[_0xbe30('0x11')];var _0xe3d224=_0x1d57be['get']({'plain':!![]});if(_0xe3d224['direction'][_0xbe30('0x12')]()==='in'||_0xe3d224[_0xbe30('0x13')][_0xbe30('0x12')]()===_0xbe30('0x14')&&!_0xe3d224[_0xbe30('0x15')]&&!_[_0xbe30('0x16')](_0xe3d224['UserId'])&&!_['isNil'](_0xe3d224['SmsInteractionId'])){_0x45a825[_0xbe30('0x17')][_0xbe30('0x18')]({'where':{'id':_0xe3d224[_0xbe30('0x19')]}})[_0xbe30('0x1a')](function(_0x20a7b5){if(_0x20a7b5){_0x20a7b5[_0xbe30('0x1b')]({'lastMsgAt':_0xe3d224['createdAt'],'lastMsgDirection':_0xe3d224['direction'][_0xbe30('0x12')]()});}})[_0xbe30('0x1c')](function(_0x3bec5e){console['error'](_0x3bec5e);});}if(_0xe3d224[_0xbe30('0x13')]===_0xbe30('0x14')&&!_0xe3d224[_0xbe30('0x15')]){var _0x15be6f;_0x45a825[_0xbe30('0x1d')]['find']({'where':{'id':_0xe3d224[_0xbe30('0x1e')]},'raw':!![]})[_0xbe30('0x1a')](function(_0x21e536){_0x15be6f=_0x21e536;if(_0x15be6f&&_0x15be6f[_0xbe30('0x1f')]){switch(_0x15be6f[_0xbe30('0x1f')]){case'twilio':var _0x3d87bc=require(_0xbe30('0x20'));if(_0x15be6f[_0xbe30('0x21')]&&_0x15be6f['authToken']&&_0x15be6f[_0xbe30('0x22')]){var _0x4739b4=new _0x3d87bc(_0x15be6f['accountSid'],_0x15be6f[_0xbe30('0x23')]);_0x4739b4[_0xbe30('0x24')]['create']({'body':_0xe3d224['body'],'to':_0xe3d224[_0xbe30('0x22')],'from':_0x15be6f[_0xbe30('0x22')],'statusCallback':_0x15be6f['remote']+_0xbe30('0x25')+_0xe3d224['id']+_0xbe30('0x26')+_0x15be6f[_0xbe30('0x27')]})[_0xbe30('0x1a')](function(_0x244446){if(_0x244446[_0xbe30('0x28')]){return _0x1d57be[_0xbe30('0x1b')]({'messageId':_0x244446[_0xbe30('0x28')]});}})[_0xbe30('0x1c')](function(_0x21a10c){logger[_0xbe30('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbe30('0x2a'),_0xbe30('0x20'),util[_0xbe30('0x2b')](_0x21a10c,{'showHidden':![],'depth':null}));});}else{logger[_0xbe30('0x29')](_0xbe30('0x2c'),_0xbe30('0x2a'),_0xbe30('0x20'),_0xbe30('0x2d'));}break;case _0xbe30('0x2e'):var _0x4e9f92=_0xbe30('0x2f');if(_0x15be6f[_0xbe30('0x30')]&&_0x15be6f[_0xbe30('0x31')]){var _0x1644e4={'recipient':[_0xe3d224['phone']],'message':_0xe3d224[_0xbe30('0x10')],'message_type':_0x15be6f[_0xbe30('0x32')]};if(_0x15be6f['smsMethod']&&_0x15be6f['smsMethod']!=='SI'){_0x1644e4[_0xbe30('0x33')]=_0x15be6f[_0xbe30('0x22')];}var _0x3647f0={'url':_0x4e9f92+_0xbe30('0x34')+_0x15be6f[_0xbe30('0x30')]+_0xbe30('0x35')+_0x15be6f[_0xbe30('0x31')],'method':_0xbe30('0x36')};rp(_0x3647f0)['then'](function(_0x1a2520){var _0x3f6747=_0x1a2520[_0xbe30('0x37')](';');var _0x16bf37={'user_key':_0x3f6747[0x0],'session_key':_0x3f6747[0x1]};_0x3647f0={'url':_0x4e9f92+_0xbe30('0x38'),'method':_0xbe30('0x39'),'headers':{'user_key':_0x16bf37['user_key'],'Session_key':_0x16bf37[_0xbe30('0x3a')]},'json':!![],'body':_0x1644e4};return rp(_0x3647f0);})['then'](function(_0x1c2de0){if(_0x1c2de0[_0xbe30('0x3b')]>=0x1){var _0x190ca5={'messageId':_0x1c2de0[_0xbe30('0x3c')]};if(_0x15be6f[_0xbe30('0x32')]!=='GP'||!_0x15be6f[_0xbe30('0x3d')]){_0x190ca5[_0xbe30('0x3e')]=!![];}return _0x1d57be['update'](_0x190ca5);}else{return logger['error'](_0xbe30('0x2c'),_0xbe30('0x2a'),_0xbe30('0x2e'),util[_0xbe30('0x2b')](_0x1c2de0,{'showHidden':![],'depth':null}));}})['catch'](function(_0x442683){return logger['error'](_0xbe30('0x2c'),_0xbe30('0x2a'),_0xbe30('0x2e'),util[_0xbe30('0x2b')](_0x442683,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbe30('0x2c'),_0xbe30('0x2a'),_0xbe30('0x2e'),_0xbe30('0x3f'));}break;case _0xbe30('0x40'):if(_0x15be6f[_0xbe30('0x23')]){var _0x438aa3={'recipient':_0xe3d224[_0xbe30('0x22')],'message':_0xe3d224[_0xbe30('0x10')],'sender':_0x15be6f[_0xbe30('0x41')]||_0x15be6f[_0xbe30('0x22')],'authorization':_0x15be6f['authToken']};var _0x16d60={'method':_0xbe30('0x39'),'uri':_0xbe30('0x42'),'body':_0x438aa3,'json':!![]};rp(_0x16d60)[_0xbe30('0x1a')](function(_0x2362a8){var _0x162193={'messageId':_0x2362a8[_0xbe30('0x43')]};if(!_0x15be6f[_0xbe30('0x3d')]){_0x162193[_0xbe30('0x3e')]=!![];}return _0x1d57be['update'](_0x162193);})[_0xbe30('0x1c')](function(_0x58b5bf){logger[_0xbe30('0x29')](_0xbe30('0x2c'),_0xbe30('0x2a'),_0xbe30('0x40'),util[_0xbe30('0x2b')](_0x58b5bf,{'showHidden':![],'depth':null}));});}else{logger[_0xbe30('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbe30('0x2a'),_0xbe30('0x40'),'Missing\x20parameters:\x20authToken');}break;case _0xbe30('0x44'):if(_0x15be6f[_0xbe30('0x30')]&&_0x15be6f['password']){var _0x438aa3={'messages':[{'source':_0xbe30('0x45'),'to':_0xe3d224[_0xbe30('0x22')],'body':_0xe3d224['body'],'from':_0x15be6f[_0xbe30('0x41')]||_0x15be6f['phone']}]};var _0x33110e=util[_0xbe30('0x46')](_0xbe30('0x47'),_0x15be6f[_0xbe30('0x30')],_0x15be6f[_0xbe30('0x31')]);var _0x16d60={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x438aa3,'headers':{'Authorization':util[_0xbe30('0x46')](_0xbe30('0x48'),new Buffer(_0x33110e)[_0xbe30('0x49')](_0xbe30('0x4a')))},'json':!![]};rp(_0x16d60)[_0xbe30('0x1a')](function(_0x19a841){if(_0x19a841['http_code']>=0xc8&&_0x19a841[_0xbe30('0x4b')]<=0xce){if(_0x19a841['data']&&_0x19a841['data'][_0xbe30('0x4c')]>0x0){var _0x4bff28=_[_0xbe30('0x4d')](_0x19a841[_0xbe30('0x4e')][_0xbe30('0x24')]);var _0x22de3c={'messageId':_0x4bff28[_0xbe30('0x4f')]};if(!_0x15be6f[_0xbe30('0x3d')]){_0x22de3c[_0xbe30('0x3e')]=!![];}return _0x1d57be[_0xbe30('0x1b')](_0x22de3c);}else{logger['error'](_0xbe30('0x2c'),_0xbe30('0x2a'),'clickSend',util[_0xbe30('0x2b')](_0x19a841,{'showHidden':![],'depth':null}));}}else{logger[_0xbe30('0x29')](_0xbe30('0x2c'),_0xbe30('0x2a'),_0xbe30('0x50'),util['inspect'](_0x19a841,{'showHidden':![],'depth':null}));}})[_0xbe30('0x1c')](function(_0x22a287){logger[_0xbe30('0x29')](_0xbe30('0x2c'),_0xbe30('0x2a'),_0xbe30('0x50'),util[_0xbe30('0x2b')](_0x22a287,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbe30('0x2c'),'afterCreate','clickSend',_0xbe30('0x3f'));}break;case _0xbe30('0x51'):if(_0x15be6f['authId']&&_0x15be6f['authToken']){var _0x438aa3={'dst':_0xe3d224[_0xbe30('0x22')],'text':_0xe3d224[_0xbe30('0x10')],'src':_0x15be6f['senderString']||_0x15be6f[_0xbe30('0x22')],'url':_0x15be6f[_0xbe30('0x52')]+_0xbe30('0x25')+_0xe3d224['id']+_0xbe30('0x26')+_0x15be6f[_0xbe30('0x27')]};var _0x33110e=util[_0xbe30('0x46')](_0xbe30('0x47'),_0x15be6f['authId'],_0x15be6f['authToken']);var _0x16d60={'method':'POST','uri':util['format'](_0xbe30('0x53'),_0x15be6f[_0xbe30('0x54')]),'body':_0x438aa3,'headers':{'Authorization':util[_0xbe30('0x46')](_0xbe30('0x48'),new Buffer(_0x33110e)[_0xbe30('0x49')](_0xbe30('0x4a')))},'json':!![]};rp(_0x16d60)[_0xbe30('0x1a')](function(_0x3d7053){var _0x43b565={'messageId':_0x3d7053['message_uuid'][0x0]};return _0x1d57be[_0xbe30('0x1b')](_0x43b565);})[_0xbe30('0x1c')](function(_0x583a65){logger[_0xbe30('0x29')](_0xbe30('0x2c'),_0xbe30('0x2a'),_0xbe30('0x51'),util['inspect'](_0x583a65,{'showHidden':![],'depth':null}));});}else{logger[_0xbe30('0x29')](_0xbe30('0x2c'),_0xbe30('0x2a'),_0xbe30('0x51'),_0xbe30('0x55'));}break;case _0xbe30('0x56'):if(_0x15be6f['username']&&_0x15be6f[_0xbe30('0x31')]){if(_0x15be6f[_0xbe30('0x57')]){var _0x5a8b13={'method':_0xbe30('0x39'),'uri':_0x15be6f['baseUrl']+_0xbe30('0x58'),'body':{'username':_0x15be6f[_0xbe30('0x30')],'password':_0x15be6f[_0xbe30('0x31')]},'json':!![]};return rp(_0x5a8b13)['then'](function(_0x26a8e7){var _0x43ba56={'method':'POST','uri':_0x15be6f['baseUrl']+_0xbe30('0x59'),'body':{'messages':[{'from':_0x15be6f[_0xbe30('0x22')],'destinations':[{'to':_0xe3d224[_0xbe30('0x22')]}],'text':_0xe3d224[_0xbe30('0x10')],'notifyUrl':_0x15be6f[_0xbe30('0x52')]+_0xbe30('0x25')+_0xe3d224['id']+_0xbe30('0x26')+_0x15be6f[_0xbe30('0x27')],'notifyContentType':_0xbe30('0x5a'),'callbackData':_0x15be6f['phone']+';'+_0xe3d224['body']}]},'headers':{'Authorization':_0xbe30('0x5b')+_0x26a8e7['token']},'json':!![]};return rp(_0x43ba56)[_0xbe30('0x1a')](function(_0x538372){if(_0x538372[_0xbe30('0x24')]){var _0x5b3595={'messageId':_0x538372[_0xbe30('0x24')][0x0]['messageId']};if(!_0x15be6f[_0xbe30('0x3d')]){_0x5b3595[_0xbe30('0x3e')]=!![];}return _0x1d57be[_0xbe30('0x1b')](_0x5b3595);}else{return logger[_0xbe30('0x29')](_0xbe30('0x2c'),_0xbe30('0x2a'),_0xbe30('0x56'),util[_0xbe30('0x2b')](_0x538372,{'showHidden':![],'depth':null}));}});})[_0xbe30('0x1c')](function(_0x2cabed){return logger[_0xbe30('0x29')](_0xbe30('0x2c'),_0xbe30('0x2a'),_0xbe30('0x56'),util[_0xbe30('0x2b')](_0x2cabed,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbe30('0x2c'),_0xbe30('0x2a'),_0xbe30('0x56'),_0xbe30('0x5c'));}}else{logger[_0xbe30('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbe30('0x2a'),'infobip',_0xbe30('0x3f'));}break;case'csc':var _0x4fd538=require(_0xbe30('0x5d'));if(_0x15be6f['apiKey']){var _0x29515c={};_0x29515c['login']=_0x15be6f[_0xbe30('0x30')];_0x29515c['phone']=_0xe3d224[_0xbe30('0x22')];_0x29515c['sender']=_0x15be6f[_0xbe30('0x22')];_0x29515c['text']=_0xe3d224[_0xbe30('0x10')];_0x29515c['timestamp']=+new Date();var _0x424a8f='';var _0xcb9626='';var _0x24e628=Object[_0xbe30('0x5e')](_0x29515c);_0x24e628['sort']();for(var _0xeaee2f=0x0;_0xeaee2f<_0x24e628[_0xbe30('0x5f')];_0xeaee2f++){if(_0x424a8f!=''){_0x424a8f+='&';}_0x424a8f+=_0x24e628[_0xeaee2f]+'='+encodeURIComponent(_0x29515c[_0x24e628[_0xeaee2f]]);_0xcb9626+=_0x29515c[_0x24e628[_0xeaee2f]];}_0xcb9626+=_0x15be6f[_0xbe30('0x60')];_0xcb9626=_0x4fd538[_0xbe30('0x61')](_0xbe30('0x62'))[_0xbe30('0x1b')](_0xcb9626)[_0xbe30('0x63')]('hex');if(_0x424a8f!==''){_0x424a8f+='&';}_0x424a8f+='signature='+_0xcb9626;var _0x3647f0={'method':_0xbe30('0x36'),'uri':_0x15be6f['baseUrl']+_0xbe30('0x64')+_0x424a8f,'json':!![]};return rp(_0x3647f0)[_0xbe30('0x1a')](function(_0x54a3d6){var _0x32f1c9=Object[_0xbe30('0x5e')](_0x54a3d6);if(_0x54a3d6[_0x32f1c9[0x0]]['error']&&parseInt(_0x54a3d6[_0x32f1c9[0x0]][_0xbe30('0x29')])===0x0){var _0x2e9660={'messageId':_0x54a3d6[_0x32f1c9[0x0]][_0xbe30('0x65')]};if(!_0x15be6f['deliveryReport']){_0x2e9660[_0xbe30('0x3e')]=!![];}return _0x1d57be[_0xbe30('0x1b')](_0x2e9660);}else{return logger[_0xbe30('0x29')](_0xbe30('0x2c'),_0xbe30('0x2a'),_0xbe30('0x66'),util[_0xbe30('0x2b')](_0x54a3d6[_0xbe30('0x29')],{'showHidden':![],'depth':null}));}})[_0xbe30('0x1c')](function(_0x4e29a1){return logger['error'](_0xbe30('0x2c'),_0xbe30('0x2a'),_0xbe30('0x66'),util[_0xbe30('0x2b')](_0x4e29a1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbe30('0x2c'),'afterCreate','csc',_0xbe30('0x67'));}break;case'clickatell':if(_0x15be6f[_0xbe30('0x60')]){var _0x4b96be={'method':_0xbe30('0x39'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x15be6f[_0xbe30('0x60')]},'body':{'content':_0xe3d224[_0xbe30('0x10')],'to':[_0xe3d224[_0xbe30('0x22')]],'from':_0x15be6f[_0xbe30('0x22')],'binary':![],'clientMessageId':_0xbe30('0x68'),'charset':_0xbe30('0x69')},'json':!![]};rp(_0x4b96be)['then'](function(_0x13016a){if(!_0x13016a[_0xbe30('0x29')]){var _0x14e160={'messageId':_0x13016a[_0xbe30('0x24')][0x0][_0xbe30('0x6a')]};if(!_0x15be6f[_0xbe30('0x3d')]){_0x14e160[_0xbe30('0x3e')]=!![];}return _0x1d57be['update'](_0x14e160);}else{return logger[_0xbe30('0x29')](_0xbe30('0x2c'),_0xbe30('0x2a'),_0xbe30('0x6b'),util['inspect'](_0x13016a[_0xbe30('0x29')],{'showHidden':![],'depth':null}));}})[_0xbe30('0x1c')](function(_0x1d0453){return logger[_0xbe30('0x29')](_0xbe30('0x2c'),_0xbe30('0x2a'),'clickatell',util[_0xbe30('0x2b')](_0x1d0453,{'showHidden':![],'depth':null}));});}else{logger[_0xbe30('0x29')](_0xbe30('0x2c'),'afterCreate',_0xbe30('0x6b'),_0xbe30('0x67'));}break;case'bandwidth':if(_0x15be6f[_0xbe30('0x30')]&&_0x15be6f[_0xbe30('0x31')]){var _0x33110e=util[_0xbe30('0x46')](_0xbe30('0x47'),_0x15be6f[_0xbe30('0x30')],_0x15be6f['password']);var _0x16d60={'method':'POST','uri':_0xbe30('0x6c')+_0x15be6f[_0xbe30('0x6d')]+_0xbe30('0x6e'),'body':{'to':[_0xe3d224[_0xbe30('0x22')]],'text':_0xe3d224[_0xbe30('0x10')],'from':_0x15be6f[_0xbe30('0x22')],'applicationId':_0x15be6f[_0xbe30('0x6f')]},'headers':{'Authorization':util[_0xbe30('0x46')]('Basic\x20%s',new Buffer(_0x33110e)[_0xbe30('0x49')]('base64'))},'json':!![]};rp(_0x16d60)[_0xbe30('0x1a')](function(_0x4dea9c){if(_0x4dea9c['id']){var _0xaf8c90={'messageId':_0x4dea9c['id']};return _0x1d57be[_0xbe30('0x1b')](_0xaf8c90);}else{logger[_0xbe30('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbe30('0x2a'),_0xbe30('0x70'),util[_0xbe30('0x2b')](_0x4dea9c,{'showHidden':![],'depth':null}));}})[_0xbe30('0x1c')](function(_0xf58fe5){logger['error'](_0xbe30('0x2c'),_0xbe30('0x2a'),_0xbe30('0x70'),util[_0xbe30('0x2b')](_0xf58fe5,{'showHidden':![],'depth':null}));});}else{logger[_0xbe30('0x29')](_0xbe30('0x2c'),_0xbe30('0x2a'),'bandwidth',_0xbe30('0x3f'));}break;case _0xbe30('0x71'):if(_0x15be6f['apiKey']){var _0x22bd5a={};var _0x3647f0={'method':_0xbe30('0x39'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xbe30('0x72')+_0x15be6f[_0xbe30('0x60')],'Content-Type':_0xbe30('0x5a')},'body':{'from':_0x15be6f['phone'],'to':_0xe3d224[_0xbe30('0x22')],'text':_0xe3d224['body']},'json':!![]};return rp(_0x3647f0)[_0xbe30('0x1a')](function(_0xbcf3ea){if(_0xbcf3ea['code']==0xca){_0x22bd5a[_0xbe30('0x73')]=_0xbcf3ea;var _0x2f8c95={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xbe30('0x72')+_0x15be6f[_0xbe30('0x60')],'Content-Type':_0xbe30('0x5a')},'body':{'refid':_0x22bd5a[_0xbe30('0x73')][_0xbe30('0x74')]},'json':!![]};return rp(_0x2f8c95)[_0xbe30('0x1a')](function(_0xfdd808){_0x22bd5a[_0xbe30('0x75')]=_0xfdd808;var _0x196af4={'messageId':_0x22bd5a[_0xbe30('0x73')][_0xbe30('0x74')],'read':!![]};return _0x1d57be[_0xbe30('0x1b')](_0x196af4);});}else{return logger[_0xbe30('0x29')](_0xbe30('0x2c'),'afterCreate',_0xbe30('0x71'),util[_0xbe30('0x2b')](_0xbcf3ea,{'showHidden':![],'depth':null}));}})[_0xbe30('0x1c')](function(_0x2132d0){return logger['error'](_0xbe30('0x2c'),_0xbe30('0x2a'),_0xbe30('0x71'),util[_0xbe30('0x2b')](_0x2132d0,{'showHidden':![],'depth':null}));});}else{return logger[_0xbe30('0x29')](_0xbe30('0x2c'),_0xbe30('0x2a'),_0xbe30('0x71'),_0xbe30('0x76'));}break;}}})[_0xbe30('0x77')](function(){_0x4cf48c();});}else{_0x4cf48c();}}},'charset':_0xbe30('0x78'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 2812209..f08f465 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 _0x12a4=['../../config/utils','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','CreateSmsMessage','create','body','options','raw','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xb52880,_0x528b7c){var _0x3a9123=function(_0x37fbc9){while(--_0x37fbc9){_0xb52880['push'](_0xb52880['shift']());}};_0x3a9123(++_0x528b7c);}(_0x12a4,0x130));var _0x412a=function(_0x4f0e62,_0x28e44f){_0x4f0e62=_0x4f0e62-0x0;var _0x117ab8=_0x12a4[_0x4f0e62];return _0x117ab8;};'use strict';var _=require(_0x412a('0x0'));var util=require('util');var moment=require(_0x412a('0x1'));var BPromise=require(_0x412a('0x2'));var rs=require(_0x412a('0x3'));var fs=require('fs');var Redis=require(_0x412a('0x4'));var db=require(_0x412a('0x5'))['db'];var utils=require(_0x412a('0x6'));var logger=require(_0x412a('0x7'))(_0x412a('0x8'));var config=require(_0x412a('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x412a('0xa')]=_['defaults'](config[_0x412a('0xa')],{'host':_0x412a('0xb'),'port':0x18eb});var socket=require(_0x412a('0xc'))(new Redis(config[_0x412a('0xa')]));require('./smsMessage.socket')[_0x412a('0xd')](socket);function respondWithRpcPromise(_0x48a6bf,_0x11b3d1,_0x1cfcb7){return new BPromise(function(_0x56bb68,_0x4b211a){return client[_0x412a('0xe')](_0x48a6bf,_0x1cfcb7)[_0x412a('0xf')](function(_0x3ab229){logger[_0x412a('0x10')]('SmsMessage,\x20%s,\x20%s',_0x11b3d1,_0x412a('0x11'));logger[_0x412a('0x12')](_0x412a('0x13'),_0x11b3d1,_0x412a('0x11'),JSON[_0x412a('0x14')](_0x3ab229));if(_0x3ab229['error']){if(_0x3ab229[_0x412a('0x15')][_0x412a('0x16')]===0x1f4){logger[_0x412a('0x15')](_0x412a('0x17'),_0x11b3d1,_0x3ab229[_0x412a('0x15')][_0x412a('0x18')]);return _0x4b211a(_0x3ab229[_0x412a('0x15')]['message']);}logger['error'](_0x412a('0x17'),_0x11b3d1,_0x3ab229[_0x412a('0x15')][_0x412a('0x18')]);return _0x56bb68(_0x3ab229[_0x412a('0x15')][_0x412a('0x18')]);}else{logger[_0x412a('0x10')](_0x412a('0x17'),_0x11b3d1,_0x412a('0x11'));_0x56bb68(_0x3ab229['result'][_0x412a('0x18')]);}})['catch'](function(_0x51572c){logger[_0x412a('0x15')]('SmsMessage,\x20%s,\x20%s',_0x11b3d1,_0x51572c);_0x4b211a(_0x51572c);});});}exports[_0x412a('0x19')]=function(_0x165141){var _0x22b79c=this;return new Promise(function(_0x1a6d34,_0x540790){return db['SmsMessage'][_0x412a('0x1a')](_0x165141[_0x412a('0x1b')],{'raw':_0x165141[_0x412a('0x1c')]?_0x165141[_0x412a('0x1c')][_0x412a('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x3326f2){logger[_0x412a('0x10')]('CreateSmsMessage',_0x165141);logger[_0x412a('0x12')](_0x412a('0x19'),_0x165141,JSON[_0x412a('0x14')](_0x3326f2));_0x1a6d34(_0x3326f2);})[_0x412a('0x1e')](function(_0x24b546){logger[_0x412a('0x15')](_0x412a('0x19'),_0x24b546[_0x412a('0x18')],_0x165141);_0x540790(_0x22b79c[_0x412a('0x15')](0x1f4,_0x24b546['message']));});});}; \ No newline at end of file +var _0xc1d8=['client','redis','defaults','./smsMessage.socket','register','then','info','debug','error','code','message','request\x20sent','result','catch','SmsMessage,\x20%s,\x20%s','CreateSmsMessage','SmsMessage','create','options','stringify','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x192f00,_0x2ccd5b){var _0x3bab3b=function(_0x578aa9){while(--_0x578aa9){_0x192f00['push'](_0x192f00['shift']());}};_0x3bab3b(++_0x2ccd5b);}(_0xc1d8,0x1b8));var _0x8c1d=function(_0x5a137f,_0x532d37){_0x5a137f=_0x5a137f-0x0;var _0x51204c=_0xc1d8[_0x5a137f];return _0x51204c;};'use strict';var _=require(_0x8c1d('0x0'));var util=require(_0x8c1d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8c1d('0x2'));var fs=require('fs');var Redis=require(_0x8c1d('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8c1d('0x4'))(_0x8c1d('0x5'));var config=require(_0x8c1d('0x6'));var jayson=require(_0x8c1d('0x7'));var client=jayson[_0x8c1d('0x8')]['http']({'port':0x232a});config[_0x8c1d('0x9')]=_[_0x8c1d('0xa')](config[_0x8c1d('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8c1d('0x9')]));require(_0x8c1d('0xb'))[_0x8c1d('0xc')](socket);function respondWithRpcPromise(_0x1ab15d,_0x27f23b,_0x3762e5){return new BPromise(function(_0x2b7be3,_0x489cfe){return client['request'](_0x1ab15d,_0x3762e5)[_0x8c1d('0xd')](function(_0xfe23c8){logger[_0x8c1d('0xe')]('SmsMessage,\x20%s,\x20%s',_0x27f23b,'request\x20sent');logger[_0x8c1d('0xf')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x27f23b,'request\x20sent',JSON['stringify'](_0xfe23c8));if(_0xfe23c8['error']){if(_0xfe23c8[_0x8c1d('0x10')][_0x8c1d('0x11')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x27f23b,_0xfe23c8[_0x8c1d('0x10')][_0x8c1d('0x12')]);return _0x489cfe(_0xfe23c8[_0x8c1d('0x10')][_0x8c1d('0x12')]);}logger[_0x8c1d('0x10')]('SmsMessage,\x20%s,\x20%s',_0x27f23b,_0xfe23c8['error'][_0x8c1d('0x12')]);return _0x2b7be3(_0xfe23c8['error'][_0x8c1d('0x12')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x27f23b,_0x8c1d('0x13'));_0x2b7be3(_0xfe23c8[_0x8c1d('0x14')]['message']);}})[_0x8c1d('0x15')](function(_0x4643dd){logger['error'](_0x8c1d('0x16'),_0x27f23b,_0x4643dd);_0x489cfe(_0x4643dd);});});}exports[_0x8c1d('0x17')]=function(_0x46cb78){var _0x118734=this;return new Promise(function(_0x299614,_0x562173){return db[_0x8c1d('0x18')][_0x8c1d('0x19')](_0x46cb78['body'],{'raw':_0x46cb78[_0x8c1d('0x1a')]?_0x46cb78[_0x8c1d('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x8c1d('0xd')](function(_0x4921d9){logger['info'](_0x8c1d('0x17'),_0x46cb78);logger['debug'](_0x8c1d('0x17'),_0x46cb78,JSON[_0x8c1d('0x1b')](_0x4921d9));_0x299614(_0x4921d9);})[_0x8c1d('0x15')](function(_0x3f2c2c){logger[_0x8c1d('0x10')](_0x8c1d('0x17'),_0x3f2c2c['message'],_0x46cb78);_0x562173(_0x118734['error'](0x1f4,_0x3f2c2c[_0x8c1d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 1e590fa..3ec29d1 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 _0x3d41=['remove','update','emit','register','length','smsMessage:','save'];(function(_0x2125f0,_0x2f23b9){var _0x12d6eb=function(_0x7a43ea){while(--_0x7a43ea){_0x2125f0['push'](_0x2125f0['shift']());}};_0x12d6eb(++_0x2f23b9);}(_0x3d41,0x92));var _0x13d4=function(_0x59f0dc,_0x1e2497){_0x59f0dc=_0x59f0dc-0x0;var _0x5b5445=_0x3d41[_0x59f0dc];return _0x5b5445;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x13d4('0x0'),_0x13d4('0x1'),_0x13d4('0x2')];function createListener(_0xecda54,_0x9bf75c){return function(_0x365795){_0x9bf75c[_0x13d4('0x3')](_0xecda54,_0x365795);};}function removeListener(_0xac0958,_0x4617d6){return function(){SmsMessageEvents['removeListener'](_0xac0958,_0x4617d6);};}exports[_0x13d4('0x4')]=function(_0x54a8c9){for(var _0x2dc0c2=0x0,_0x5d7a92=events[_0x13d4('0x5')];_0x2dc0c2<_0x5d7a92;_0x2dc0c2++){var _0x1cf893=events[_0x2dc0c2];var _0xc9c085=createListener(_0x13d4('0x6')+_0x1cf893,_0x54a8c9);SmsMessageEvents['on'](_0x1cf893,_0xc9c085);}}; \ No newline at end of file +var _0x2660=['emit','removeListener','register','smsMessage:','./smsMessage.events','remove','update'];(function(_0x4c468a,_0x36d016){var _0x313354=function(_0x1b7c37){while(--_0x1b7c37){_0x4c468a['push'](_0x4c468a['shift']());}};_0x313354(++_0x36d016);}(_0x2660,0x170));var _0x0266=function(_0x4b03c9,_0x17ce03){_0x4b03c9=_0x4b03c9-0x0;var _0x161ba2=_0x2660[_0x4b03c9];return _0x161ba2;};'use strict';var SmsMessageEvents=require(_0x0266('0x0'));var events=['save',_0x0266('0x1'),_0x0266('0x2')];function createListener(_0x347765,_0x24060c){return function(_0x443ee8){_0x24060c[_0x0266('0x3')](_0x347765,_0x443ee8);};}function removeListener(_0x2e2942,_0x3795df){return function(){SmsMessageEvents[_0x0266('0x4')](_0x2e2942,_0x3795df);};}exports[_0x0266('0x5')]=function(_0x31f124){for(var _0x2020fc=0x0,_0x1a5577=events['length'];_0x2020fc<_0x1a5577;_0x2020fc++){var _0x1c29f3=events[_0x2020fc];var _0x3ccd4f=createListener(_0x0266('0x6')+_0x1c29f3,_0x31f124);SmsMessageEvents['on'](_0x1c29f3,_0x3ccd4f);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 7970c74..67d85d7 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 _0xb01f=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','util'];(function(_0x49ab33,_0x1534ba){var _0x288fe0=function(_0x3df199){while(--_0x3df199){_0x49ab33['push'](_0x49ab33['shift']());}};_0x288fe0(++_0x1534ba);}(_0xb01f,0xa3));var _0xfb01=function(_0x1c9f05,_0x289507){_0x1c9f05=_0x1c9f05-0x0;var _0x43a59e=_0xb01f[_0x1c9f05];return _0x43a59e;};'use strict';var multer=require(_0xfb01('0x0'));var util=require(_0xfb01('0x1'));var path=require(_0xfb01('0x2'));var timeout=require(_0xfb01('0x3'));var express=require(_0xfb01('0x4'));var router=express[_0xfb01('0x5')]();var fs_extra=require(_0xfb01('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xfb01('0x7'));var config=require(_0xfb01('0x8'));var controller=require(_0xfb01('0x9'));router[_0xfb01('0xa')]('/',auth['isAuthenticated'](),controller[_0xfb01('0xb')]);router[_0xfb01('0xa')](_0xfb01('0xc'),auth[_0xfb01('0xd')](),controller[_0xfb01('0xe')]);router[_0xfb01('0xa')](_0xfb01('0xf'),auth['isAuthenticated'](),controller[_0xfb01('0x10')]);router['get'](_0xfb01('0x11'),auth[_0xfb01('0xd')](),controller[_0xfb01('0x12')]);router[_0xfb01('0xa')](_0xfb01('0x13'),auth['isAuthenticated'](),controller[_0xfb01('0x14')]);router['get'](_0xfb01('0x15'),auth['isAuthenticated'](),controller[_0xfb01('0x16')]);router[_0xfb01('0x17')]('/',auth[_0xfb01('0xd')](),controller[_0xfb01('0x18')]);router['post']('/:id/teams',auth[_0xfb01('0xd')](),controller[_0xfb01('0x19')]);router[_0xfb01('0x17')](_0xfb01('0x15'),auth['isAuthenticated'](),controller['addAgents']);router[_0xfb01('0x1a')](_0xfb01('0xf'),auth[_0xfb01('0xd')](),controller[_0xfb01('0x1b')]);router['delete'](_0xfb01('0xf'),auth['isAuthenticated'](),controller[_0xfb01('0x1c')]);router[_0xfb01('0x1d')]('/:id/teams',auth[_0xfb01('0xd')](),controller[_0xfb01('0x1e')]);router[_0xfb01('0x1d')]('/:id/users',auth[_0xfb01('0xd')](),controller[_0xfb01('0x1f')]);module[_0xfb01('0x20')]=router; \ No newline at end of file +var _0xec6b=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','isAuthenticated','index','get','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','put','delete','removeTeams','removeAgents','exports','multer'];(function(_0x3376bd,_0x4fdb2a){var _0x587b0b=function(_0x2a7006){while(--_0x2a7006){_0x3376bd['push'](_0x3376bd['shift']());}};_0x587b0b(++_0x4fdb2a);}(_0xec6b,0x151));var _0xbec6=function(_0x339e07,_0x3cba6b){_0x339e07=_0x339e07-0x0;var _0xe41a81=_0xec6b[_0x339e07];return _0xe41a81;};'use strict';var multer=require(_0xbec6('0x0'));var util=require(_0xbec6('0x1'));var path=require(_0xbec6('0x2'));var timeout=require('connect-timeout');var express=require(_0xbec6('0x3'));var router=express['Router']();var fs_extra=require(_0xbec6('0x4'));var auth=require(_0xbec6('0x5'));var interaction=require(_0xbec6('0x6'));var config=require('../../config/environment');var controller=require(_0xbec6('0x7'));router['get']('/',auth[_0xbec6('0x8')](),controller[_0xbec6('0x9')]);router[_0xbec6('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xbec6('0xb')]);router[_0xbec6('0xa')](_0xbec6('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xbec6('0xa')](_0xbec6('0xd'),auth[_0xbec6('0x8')](),controller[_0xbec6('0xe')]);router[_0xbec6('0xa')](_0xbec6('0xf'),auth['isAuthenticated'](),controller[_0xbec6('0x10')]);router[_0xbec6('0xa')](_0xbec6('0x11'),auth[_0xbec6('0x8')](),controller[_0xbec6('0x12')]);router[_0xbec6('0x13')]('/',auth[_0xbec6('0x8')](),controller['create']);router[_0xbec6('0x13')](_0xbec6('0xf'),auth[_0xbec6('0x8')](),controller[_0xbec6('0x14')]);router[_0xbec6('0x13')](_0xbec6('0x11'),auth[_0xbec6('0x8')](),controller['addAgents']);router[_0xbec6('0x15')]('/:id',auth[_0xbec6('0x8')](),controller['update']);router[_0xbec6('0x16')](_0xbec6('0xc'),auth[_0xbec6('0x8')](),controller['destroy']);router[_0xbec6('0x16')](_0xbec6('0xf'),auth[_0xbec6('0x8')](),controller[_0xbec6('0x17')]);router[_0xbec6('0x16')](_0xbec6('0x11'),auth[_0xbec6('0x8')](),controller[_0xbec6('0x18')]);module[_0xbec6('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 0e90616..9740eca 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 _0x3151=['name','STRING','INTEGER','ENUM','rrmemory','roundrobin','exports'];(function(_0x2b6720,_0x1db485){var _0xefa23e=function(_0xdb71cd){while(--_0xdb71cd){_0x2b6720['push'](_0x2b6720['shift']());}};_0xefa23e(++_0x1db485);}(_0x3151,0x99));var _0x1315=function(_0x310272,_0x406209){_0x310272=_0x310272-0x0;var _0x46b8cf=_0x3151[_0x310272];return _0x46b8cf;};'use strict';var Sequelize=require('sequelize');module[_0x1315('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x1315('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1315('0x2')]},'timeout':{'type':Sequelize[_0x1315('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1315('0x4')](_0x1315('0x5'),'beepall',_0x1315('0x6'))}}; \ No newline at end of file +var _0xed2e=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0xe896bf,_0x4f8e5e){var _0x4c7a8a=function(_0x410ff2){while(--_0x410ff2){_0xe896bf['push'](_0xe896bf['shift']());}};_0x4c7a8a(++_0x4f8e5e);}(_0xed2e,0x116));var _0xeed2=function(_0x171613,_0x31ec05){_0x171613=_0x171613-0x0;var _0x1b9fd9=_0xed2e[_0x171613];return _0x1b9fd9;};'use strict';var Sequelize=require(_0xeed2('0x0'));module[_0xeed2('0x1')]={'name':{'type':Sequelize[_0xeed2('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xeed2('0x2')]},'timeout':{'type':Sequelize[_0xeed2('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xeed2('0x4')](_0xeed2('0x5'),_0xeed2('0x6'),_0xeed2('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 18492f6..e1bdc18 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 _0xeccf=['util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./smsQueue.socket','register','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','options','SmsQueue','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','getMembers','order','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','format','%s/%s','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','UserSmsQueue','findOrCreate','forEach','userSmsQueue:save','removeTeams','tq.TeamId','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x4d34e8,_0x285b4b){var _0x24300c=function(_0x7f10f0){while(--_0x7f10f0){_0x4d34e8['push'](_0x4d34e8['shift']());}};_0x24300c(++_0x285b4b);}(_0xeccf,0x10c));var _0xfecc=function(_0x4b0409,_0x166de9){_0x4b0409=_0x4b0409-0x0;var _0x46e574=_0xeccf[_0x4b0409];return _0x46e574;};'use strict';var emlformat=require(_0xfecc('0x0'));var rimraf=require(_0xfecc('0x1'));var zipdir=require(_0xfecc('0x2'));var jsonpatch=require(_0xfecc('0x3'));var rp=require(_0xfecc('0x4'));var moment=require(_0xfecc('0x5'));var BPromise=require(_0xfecc('0x6'));var Mustache=require(_0xfecc('0x7'));var util=require(_0xfecc('0x8'));var path=require(_0xfecc('0x9'));var sox=require('sox');var csv=require(_0xfecc('0xa'));var ejs=require(_0xfecc('0xb'));var fs=require('fs');var fs_extra=require(_0xfecc('0xc'));var _=require('lodash');var squel=require(_0xfecc('0xd'));var crypto=require(_0xfecc('0xe'));var jsforce=require(_0xfecc('0xf'));var deskjs=require(_0xfecc('0x10'));var toCsv=require(_0xfecc('0xa'));var querystring=require('querystring');var Papa=require(_0xfecc('0x11'));var Redis=require(_0xfecc('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xfecc('0x13'));var as=require(_0xfecc('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfecc('0x15'))(_0xfecc('0x16'));var utils=require(_0xfecc('0x17'));var config=require(_0xfecc('0x18'));var licenseUtil=require(_0xfecc('0x19'));var db=require('../../mysqldb')['db'];config[_0xfecc('0x1a')]=_[_0xfecc('0x1b')](config[_0xfecc('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xfecc('0x1c'))(new Redis(config['redis']));require(_0xfecc('0x1d'))[_0xfecc('0x1e')](socket);function respondWithStatusCode(_0x16ef10,_0x43f89f){_0x43f89f=_0x43f89f||0xcc;return function(_0x1e9e15){if(_0x1e9e15){return _0x16ef10['sendStatus'](_0x43f89f);}return _0x16ef10['status'](_0x43f89f)[_0xfecc('0x1f')]();};}function respondWithResult(_0x293067,_0x2041e0){_0x2041e0=_0x2041e0||0xc8;return function(_0x24dae7){if(_0x24dae7){return _0x293067['status'](_0x2041e0)[_0xfecc('0x20')](_0x24dae7);}};}function respondWithFilteredResult(_0x28f2b2,_0x270583){return function(_0x5e5253){if(_0x5e5253){var _0x498c0c=typeof _0x270583[_0xfecc('0x21')]===_0xfecc('0x22')&&typeof _0x270583['limit']===_0xfecc('0x22');var _0xa8d40b=_0x5e5253[_0xfecc('0x23')];var _0x3a306d=_0x498c0c?0x0:_0x270583[_0xfecc('0x21')];var _0x1a50ae=_0x498c0c?_0x5e5253[_0xfecc('0x23')]:_0x270583['offset']+_0x270583[_0xfecc('0x24')];var _0x5d7d22;if(_0x1a50ae>=_0xa8d40b){_0x1a50ae=_0xa8d40b;_0x5d7d22=0xc8;}else{_0x5d7d22=0xce;}_0x28f2b2[_0xfecc('0x25')](_0x5d7d22);return _0x28f2b2[_0xfecc('0x26')](_0xfecc('0x27'),_0x3a306d+'-'+_0x1a50ae+'/'+_0xa8d40b)[_0xfecc('0x20')](_0x5e5253);}return null;};}function patchUpdates(_0xdef014){return function(_0x21bc80){try{jsonpatch[_0xfecc('0x28')](_0x21bc80,_0xdef014,!![]);}catch(_0x2d7c5a){return BPromise[_0xfecc('0x29')](_0x2d7c5a);}return _0x21bc80[_0xfecc('0x2a')]();};}function saveUpdates(_0x4b500b,_0x3db4a5){return function(_0xac4877){if(_0xac4877){return _0xac4877[_0xfecc('0x2b')](_0x4b500b)[_0xfecc('0x2c')](function(_0xa9660a){return _0xa9660a;});}return null;};}function removeEntity(_0x4d066f,_0x2d4bcf){return function(_0xc9ddc0){if(_0xc9ddc0){return _0xc9ddc0[_0xfecc('0x2d')]()[_0xfecc('0x2c')](function(){var _0x208587=_0xc9ddc0[_0xfecc('0x2e')]({'plain':!![]});var _0x59e6e1=_0xfecc('0x2f');return db[_0xfecc('0x30')][_0xfecc('0x2d')]({'where':{'type':_0x59e6e1,'resourceId':_0x208587['id']}})[_0xfecc('0x2c')](function(){return _0xc9ddc0;});})[_0xfecc('0x2c')](function(){_0x4d066f['status'](0xcc)[_0xfecc('0x1f')]();});}};}function handleEntityNotFound(_0x681fd0,_0x44acbd){return function(_0xdccb13){if(!_0xdccb13){_0x681fd0[_0xfecc('0x31')](0x194);}return _0xdccb13;};}function handleError(_0x15b399,_0x63754){_0x63754=_0x63754||0x1f4;return function(_0xccc123){logger[_0xfecc('0x32')](_0xccc123[_0xfecc('0x33')]);if(_0xccc123[_0xfecc('0x34')]){delete _0xccc123[_0xfecc('0x34')];}_0x15b399[_0xfecc('0x25')](_0x63754)[_0xfecc('0x35')](_0xccc123);};}exports[_0xfecc('0x36')]=function(_0x33538c,_0x1b5456){var _0x2ff9d9={},_0x306a86={},_0x3916bf={'count':0x0,'rows':[]};var _0x29fc9f=_[_0xfecc('0x37')](db['SmsQueue']['rawAttributes'],function(_0x29ddf4){return{'name':_0x29ddf4[_0xfecc('0x38')],'type':_0x29ddf4[_0xfecc('0x39')]['key']};});_0x306a86[_0xfecc('0x3a')]=_['map'](_0x29fc9f,'name');_0x306a86[_0xfecc('0x3b')]=_[_0xfecc('0x3c')](_0x33538c['query']);_0x306a86['filters']=_[_0xfecc('0x3d')](_0x306a86[_0xfecc('0x3a')],_0x306a86[_0xfecc('0x3b')]);_0x2ff9d9[_0xfecc('0x3e')]=_[_0xfecc('0x3d')](_0x306a86['model'],qs[_0xfecc('0x3f')](_0x33538c[_0xfecc('0x3b')][_0xfecc('0x3f')]));_0x2ff9d9['attributes']=_0x2ff9d9[_0xfecc('0x3e')][_0xfecc('0x40')]?_0x2ff9d9[_0xfecc('0x3e')]:_0x306a86['model'];if(!_0x33538c[_0xfecc('0x3b')][_0xfecc('0x41')](_0xfecc('0x42'))){_0x2ff9d9[_0xfecc('0x24')]=qs[_0xfecc('0x24')](_0x33538c['query']['limit']);_0x2ff9d9['offset']=qs[_0xfecc('0x21')](_0x33538c['query'][_0xfecc('0x21')]);}_0x2ff9d9['order']=qs[_0xfecc('0x43')](_0x33538c['query'][_0xfecc('0x43')]);_0x2ff9d9[_0xfecc('0x44')]=qs['filters'](_[_0xfecc('0x45')](_0x33538c[_0xfecc('0x3b')],_0x306a86[_0xfecc('0x46')]),_0x29fc9f);if(_0x33538c[_0xfecc('0x3b')][_0xfecc('0x47')]){_0x2ff9d9['where']=_[_0xfecc('0x48')](_0x2ff9d9['where'],{'$or':_['map'](_0x29fc9f,function(_0x3ced26){if(_0x3ced26[_0xfecc('0x39')]!=='VIRTUAL'){var _0x20923b={};_0x20923b[_0x3ced26[_0xfecc('0x34')]]={'$like':'%'+_0x33538c[_0xfecc('0x3b')][_0xfecc('0x47')]+'%'};return _0x20923b;}})});}_0x2ff9d9=_[_0xfecc('0x48')]({},_0x2ff9d9,_0x33538c[_0xfecc('0x49')]);var _0x5046ab={'where':_0x2ff9d9[_0xfecc('0x44')]};return db[_0xfecc('0x4a')][_0xfecc('0x23')](_0x5046ab)['then'](function(_0x1023c5){_0x3916bf[_0xfecc('0x23')]=_0x1023c5;if(_0x33538c['query'][_0xfecc('0x4b')]){_0x2ff9d9['include']=[{'all':!![]}];}return db[_0xfecc('0x4a')][_0xfecc('0x4c')](_0x2ff9d9);})[_0xfecc('0x2c')](function(_0x264b1d){_0x3916bf[_0xfecc('0x4d')]=_0x264b1d;return _0x3916bf;})[_0xfecc('0x2c')](respondWithFilteredResult(_0x1b5456,_0x2ff9d9))[_0xfecc('0x4e')](handleError(_0x1b5456,null));};exports[_0xfecc('0x4f')]=function(_0x3fd5f0,_0x4325b3){var _0x31c31e={'raw':!![],'where':{'id':_0x3fd5f0[_0xfecc('0x50')]['id']}},_0x491665={};_0x491665[_0xfecc('0x3a')]=_[_0xfecc('0x3c')](db['SmsQueue'][_0xfecc('0x51')]);_0x491665[_0xfecc('0x3b')]=_[_0xfecc('0x3c')](_0x3fd5f0[_0xfecc('0x3b')]);_0x491665[_0xfecc('0x46')]=_['intersection'](_0x491665[_0xfecc('0x3a')],_0x491665['query']);_0x31c31e[_0xfecc('0x3e')]=_[_0xfecc('0x3d')](_0x491665[_0xfecc('0x3a')],qs[_0xfecc('0x3f')](_0x3fd5f0[_0xfecc('0x3b')][_0xfecc('0x3f')]));_0x31c31e[_0xfecc('0x3e')]=_0x31c31e[_0xfecc('0x3e')][_0xfecc('0x40')]?_0x31c31e['attributes']:_0x491665['model'];if(_0x3fd5f0['query'][_0xfecc('0x4b')]){_0x31c31e[_0xfecc('0x52')]=[{'all':!![]}];}_0x31c31e=_['merge']({},_0x31c31e,_0x3fd5f0[_0xfecc('0x49')]);return db['SmsQueue']['find'](_0x31c31e)[_0xfecc('0x2c')](handleEntityNotFound(_0x4325b3,null))[_0xfecc('0x2c')](respondWithResult(_0x4325b3,null))[_0xfecc('0x4e')](handleError(_0x4325b3,null));};exports['create']=function(_0x52b7b4,_0x275759){return db[_0xfecc('0x4a')][_0xfecc('0x53')](_0x52b7b4['body'],{})[_0xfecc('0x2c')](function(_0x14253c){var _0xa31c8c=_0x52b7b4[_0xfecc('0x54')][_0xfecc('0x2e')]({'plain':!![]});if(!_0xa31c8c)throw new Error(_0xfecc('0x55'));if(_0xa31c8c[_0xfecc('0x56')]===_0xfecc('0x54')){var _0x37ecd7=_0x14253c['get']({'plain':!![]});var _0x1f945c=_0xfecc('0x2f');return db['UserProfileSection']['find']({'where':{'name':_0x1f945c,'userProfileId':_0xa31c8c[_0xfecc('0x57')]},'raw':!![]})[_0xfecc('0x2c')](function(_0x1ee882){if(_0x1ee882&&_0x1ee882['autoAssociation']===0x0){return db[_0xfecc('0x30')][_0xfecc('0x53')]({'name':_0x37ecd7['name'],'resourceId':_0x37ecd7['id'],'type':_0x1ee882[_0xfecc('0x34')],'sectionId':_0x1ee882['id']},{})[_0xfecc('0x2c')](function(){return _0x14253c;});}else{return _0x14253c;}})[_0xfecc('0x4e')](function(_0xe1621c){logger[_0xfecc('0x32')](_0xfecc('0x58'),_0xe1621c);throw _0xe1621c;});}return _0x14253c;})[_0xfecc('0x2c')](respondWithResult(_0x275759,0xc9))[_0xfecc('0x4e')](handleError(_0x275759,null));};exports[_0xfecc('0x2b')]=function(_0x16a7f0,_0x5090c9){if(_0x16a7f0[_0xfecc('0x59')]['id']){delete _0x16a7f0['body']['id'];}return db[_0xfecc('0x4a')][_0xfecc('0x5a')]({'where':{'id':_0x16a7f0['params']['id']}})[_0xfecc('0x2c')](handleEntityNotFound(_0x5090c9,null))[_0xfecc('0x2c')](saveUpdates(_0x16a7f0[_0xfecc('0x59')],null))[_0xfecc('0x2c')](respondWithResult(_0x5090c9,null))[_0xfecc('0x4e')](handleError(_0x5090c9,null));};exports[_0xfecc('0x2d')]=function(_0xc1aee1,_0x491b9e){return db['SmsQueue']['find']({'where':{'id':_0xc1aee1[_0xfecc('0x50')]['id']}})[_0xfecc('0x2c')](handleEntityNotFound(_0x491b9e,null))[_0xfecc('0x2c')](removeEntity(_0x491b9e,null))[_0xfecc('0x4e')](handleError(_0x491b9e,null));};exports[_0xfecc('0x5b')]=function(_0x1d3fb7,_0x22644a){return db[_0xfecc('0x4a')][_0xfecc('0x5b')]()['then'](respondWithResult(_0x22644a,null))[_0xfecc('0x4e')](handleError(_0x22644a,null));};exports[_0xfecc('0x5c')]=function(_0x33f703,_0x53a929,_0x54b740){var _0x4c8c5e={'raw':!![],'where':{}},_0x32412e={},_0x913eb0;return db[_0xfecc('0x4a')]['findOne']({'where':{'id':_0x33f703[_0xfecc('0x50')]['id']}})[_0xfecc('0x2c')](handleEntityNotFound(_0x53a929,null))[_0xfecc('0x2c')](function(_0x17b1fa){if(_0x17b1fa){_0x913eb0=_0x17b1fa[_0xfecc('0x2e')]({'plain':!![]});_0x32412e[_0xfecc('0x3a')]=_[_0xfecc('0x3c')](db['UserSmsQueue']['rawAttributes']);_0x32412e['query']=_[_0xfecc('0x3c')](_0x33f703[_0xfecc('0x3b')]);_0x32412e[_0xfecc('0x46')]=_[_0xfecc('0x3d')](_0x32412e[_0xfecc('0x3a')],_0x32412e[_0xfecc('0x3b')]);_0x4c8c5e[_0xfecc('0x3e')]=_[_0xfecc('0x3d')](_0x32412e[_0xfecc('0x3a')],qs[_0xfecc('0x3f')](_0x33f703[_0xfecc('0x3b')][_0xfecc('0x3f')]));_0x4c8c5e[_0xfecc('0x3e')]=_0x4c8c5e[_0xfecc('0x3e')]['length']?_0x4c8c5e[_0xfecc('0x3e')]:_0x32412e[_0xfecc('0x3a')];if(!_0x33f703['query'][_0xfecc('0x41')]('nolimit')){_0x4c8c5e[_0xfecc('0x24')]=qs[_0xfecc('0x24')](_0x33f703[_0xfecc('0x3b')][_0xfecc('0x24')]);_0x4c8c5e[_0xfecc('0x21')]=qs['offset'](_0x33f703[_0xfecc('0x3b')][_0xfecc('0x21')]);}_0x4c8c5e[_0xfecc('0x5d')]=qs[_0xfecc('0x43')](_0x33f703[_0xfecc('0x3b')]['sort']);_0x4c8c5e[_0xfecc('0x44')]=qs[_0xfecc('0x46')](_[_0xfecc('0x45')](_0x33f703[_0xfecc('0x3b')],_0x32412e[_0xfecc('0x46')]));_0x4c8c5e[_0xfecc('0x44')][_0xfecc('0x5e')]=_0x17b1fa['id'];if(_0x33f703[_0xfecc('0x3b')]['filter']){_0x4c8c5e[_0xfecc('0x44')]=_[_0xfecc('0x48')](_0x4c8c5e[_0xfecc('0x44')],{'$or':_['map'](_0x4c8c5e['attributes'],function(_0x9a1433){var _0x2df75a={};_0x2df75a[_0x9a1433]={'$like':'%'+_0x33f703[_0xfecc('0x3b')][_0xfecc('0x47')]+'%'};return _0x2df75a;})});}_0x4c8c5e=_[_0xfecc('0x48')]({},_0x4c8c5e,_0x33f703['options']);return db['UserSmsQueue'][_0xfecc('0x4c')](_0x4c8c5e);}})[_0xfecc('0x2c')](function(_0x1facf0){if(_0x1facf0){return db[_0xfecc('0x5f')][_0xfecc('0x60')]({'where':{'id':_[_0xfecc('0x37')](_0x1facf0,_0xfecc('0x61')),'role':_0xfecc('0x62')},'attributes':['id',_0xfecc('0x34'),_0xfecc('0x63'),_0xfecc('0x64'),'createdAt']});}})[_0xfecc('0x2c')](function(_0x5dce78){if(_0x5dce78){return{'count':_0x5dce78['count'],'rows':_[_0xfecc('0x37')](_0x5dce78[_0xfecc('0x4d')],function(_0x22f91a){return{'membername':_0x22f91a[_0xfecc('0x34')],'UserId':_0x22f91a['id'],'queue_name':_0x913eb0[_0xfecc('0x34')],'SmsQueueId':_0x913eb0['id'],'interface':util[_0xfecc('0x65')](_0xfecc('0x66'),'SIP',_0x22f91a[_0xfecc('0x34')]),'penalty':0x0,'paused':_0x22f91a[_0xfecc('0x63')],'createdAt':_0x22f91a['createdAt'],'updatedAt':_0x22f91a[_0xfecc('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x53a929,_0x4c8c5e))[_0xfecc('0x4e')](handleError(_0x53a929,null));};exports[_0xfecc('0x67')]=function(_0x28c5fe,_0x8a7a5f,_0x22e850){var _0x571875={};var _0x279cae={};var _0x579193;var _0x4ad5eb;return db[_0xfecc('0x4a')][_0xfecc('0x68')]({'where':{'id':_0x28c5fe['params']['id']}})['then'](handleEntityNotFound(_0x8a7a5f,null))[_0xfecc('0x2c')](function(_0x4881a3){if(_0x4881a3){_0x579193=_0x4881a3;_0x279cae['model']=_['keys'](db[_0xfecc('0x69')]['rawAttributes']);_0x279cae[_0xfecc('0x3b')]=_[_0xfecc('0x3c')](_0x28c5fe[_0xfecc('0x3b')]);_0x279cae[_0xfecc('0x46')]=_[_0xfecc('0x3d')](_0x279cae[_0xfecc('0x3a')],_0x279cae[_0xfecc('0x3b')]);_0x571875['attributes']=_[_0xfecc('0x3d')](_0x279cae[_0xfecc('0x3a')],qs[_0xfecc('0x3f')](_0x28c5fe[_0xfecc('0x3b')][_0xfecc('0x3f')]));_0x571875[_0xfecc('0x3e')]=_0x571875['attributes'][_0xfecc('0x40')]?_0x571875[_0xfecc('0x3e')]:_0x279cae['model'];_0x571875[_0xfecc('0x5d')]=qs[_0xfecc('0x43')](_0x28c5fe[_0xfecc('0x3b')][_0xfecc('0x43')]);_0x571875[_0xfecc('0x44')]=qs[_0xfecc('0x46')](_[_0xfecc('0x45')](_0x28c5fe[_0xfecc('0x3b')],_0x279cae['filters']));if(_0x28c5fe[_0xfecc('0x3b')][_0xfecc('0x47')]){_0x571875[_0xfecc('0x44')]=_[_0xfecc('0x48')](_0x571875[_0xfecc('0x44')],{'$or':_[_0xfecc('0x37')](_0x571875[_0xfecc('0x3e')],function(_0x573077){var _0x57837c={};_0x57837c[_0x573077]={'$like':'%'+_0x28c5fe['query'][_0xfecc('0x47')]+'%'};return _0x57837c;})});}_0x571875=_[_0xfecc('0x48')]({},_0x571875,_0x28c5fe[_0xfecc('0x49')]);return _0x579193['getTeams'](_0x571875);}})[_0xfecc('0x2c')](function(_0x106e2a){if(_0x106e2a){_0x4ad5eb=_0x106e2a[_0xfecc('0x40')];if(!_0x28c5fe[_0xfecc('0x3b')][_0xfecc('0x41')](_0xfecc('0x42'))){_0x571875[_0xfecc('0x24')]=qs['limit'](_0x28c5fe[_0xfecc('0x3b')][_0xfecc('0x24')]);_0x571875['offset']=qs[_0xfecc('0x21')](_0x28c5fe['query'][_0xfecc('0x21')]);}return _0x579193[_0xfecc('0x67')](_0x571875);}})[_0xfecc('0x2c')](function(_0x5c4560){if(_0x5c4560){return _0x5c4560?{'count':_0x4ad5eb,'rows':_0x5c4560}:null;}})[_0xfecc('0x2c')](respondWithResult(_0x8a7a5f,null))[_0xfecc('0x4e')](handleError(_0x8a7a5f,null));};exports[_0xfecc('0x6a')]=function(_0x2b56d4,_0x58c3a3,_0x31235b){var _0x5b91a3=_0x2b56d4['body'][_0xfecc('0x6b')];return db['Team']['findAll']({'where':{'id':_0x5b91a3},'attributes':['id'],'include':[{'model':db[_0xfecc('0x5f')],'as':_0xfecc('0x6c'),'attributes':['id',_0xfecc('0x34'),_0xfecc('0x6d'),_0xfecc('0x6e'),'interface'],'raw':!![]}]})['then'](function(_0x493e42){if(_0x493e42){var _0x1649b2=_[_0xfecc('0x6f')](_0x493e42,function(_0xaacf86){var _0xd943d=_0xaacf86[_0xfecc('0x2e')]({'plain':!![]});return _0xd943d[_0xfecc('0x6c')];});return db['SmsQueue'][_0xfecc('0x5a')]({'where':{'id':_0x2b56d4['params']['id']}})[_0xfecc('0x2c')](function(_0x5ac30d){return db[_0xfecc('0x70')]['transaction'](function(_0x1a5b0f){return _0x5ac30d[_0xfecc('0x6a')](_0x5b91a3,{'transaction':_0x1a5b0f})['then'](function(){return BPromise['each'](_0x1649b2,function(_0x4a7821){return db[_0xfecc('0x71')][_0xfecc('0x72')]({'where':{'UserId':_0x4a7821['id'],'SmsQueueId':_0x2b56d4[_0xfecc('0x50')]['id']},'transaction':_0x1a5b0f});});})[_0xfecc('0x2c')](function(){_0x1649b2[_0xfecc('0x73')](function(_0x10c0af){socket['emit'](_0xfecc('0x74'),{'UserId':_0x10c0af['id'],'SmsQueueId':_0x5ac30d['id']});});});});});}})[_0xfecc('0x2c')](respondWithStatusCode(_0x58c3a3,null))[_0xfecc('0x4e')](handleError(_0x58c3a3,null));};exports[_0xfecc('0x75')]=function(_0x379058,_0x209a05,_0x48ca80){return db[_0xfecc('0x69')][_0xfecc('0x4c')]({'where':{'id':_0x379058[_0xfecc('0x3b')][_0xfecc('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xfecc('0x5f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfecc('0x2c')](handleEntityNotFound(_0x209a05,null))[_0xfecc('0x2c')](function(_0x5868b2){var _0x31ae3f=_['map'](_0x5868b2,'id');var _0x45575c=[];var _0x3b59c1=[];var _0x153a6a=squel['select']();_0x153a6a['field'](_0xfecc('0x76'))['from']('team_has_sms_queues','tq')['join'](_0xfecc('0x77'),'ut',_0xfecc('0x78'))[_0xfecc('0x44')](_0xfecc('0x79'),_0x379058[_0xfecc('0x50')]['id']);for(var _0x106787=0x0;_0x106787<_0x5868b2[_0xfecc('0x40')];_0x106787+=0x1){let _0x4ccc6f=_0x5868b2[_0x106787];for(var _0x3be971=0x0;_0x3be971<_0x4ccc6f[_0xfecc('0x6c')][_0xfecc('0x40')];_0x3be971+=0x1){let _0x29b493=_0x4ccc6f[_0xfecc('0x6c')][_0x3be971];var _0x4110eb=_0x153a6a[_0xfecc('0x7a')]();_0x4110eb['where'](_0xfecc('0x7b'),_0x29b493['id']);_0x3b59c1['push'](db['sequelize'][_0xfecc('0x3b')](_0x4110eb[_0xfecc('0x7c')](),{'type':db[_0xfecc('0x70')][_0xfecc('0x7d')][_0xfecc('0x7e')]})['then'](function(_0x48e43e){if(_0x48e43e[_0xfecc('0x40')]===0x1){return _0x29b493['id'];}else{var _0x2be88d=_[_0xfecc('0x7f')](_[_0xfecc('0x37')](_0x48e43e,'TeamId'),function(_0x34349c){return _[_0xfecc('0x80')](_0x31ae3f,_0x34349c);});if(_0x2be88d){return _0x29b493['id'];}}}));}}return BPromise[_0xfecc('0x81')](_0x3b59c1)[_0xfecc('0x2c')](function(_0x1ba0cf){_0x45575c=_(_0x45575c)[_0xfecc('0x82')](_0x1ba0cf)['compact']()['value']();return db[_0xfecc('0x4a')][_0xfecc('0x5a')]({'where':{'id':_0x379058[_0xfecc('0x50')]['id']}})[_0xfecc('0x2c')](function(_0x50a7d3){return db[_0xfecc('0x70')]['transaction'](function(_0x3066dd){return _0x50a7d3[_0xfecc('0x75')](_0x379058['query'][_0xfecc('0x6b')],{'transaction':_0x3066dd})[_0xfecc('0x2c')](function(){if(!_[_0xfecc('0x83')](_0x45575c)){return _0x50a7d3[_0xfecc('0x84')](_0x45575c,{'transaction':_0x3066dd});}})[_0xfecc('0x2c')](function(){_0x45575c['forEach'](function(_0xa3e0d4){socket[_0xfecc('0x85')](_0xfecc('0x86'),{'UserId':_0xa3e0d4,'SmsQueueId':_0x50a7d3['id']});});});});});});})[_0xfecc('0x2c')](respondWithStatusCode(_0x209a05,null))['catch'](handleError(_0x209a05,null));};exports[_0xfecc('0x87')]=function(_0x22f3ed,_0x4d74eb,_0x288736){return db[_0xfecc('0x4a')][_0xfecc('0x5a')]({'where':{'id':_0x22f3ed[_0xfecc('0x50')]['id']}})[_0xfecc('0x2c')](handleEntityNotFound(_0x4d74eb,null))[_0xfecc('0x2c')](function(_0x5c60d8){if(_0x5c60d8){return _0x5c60d8[_0xfecc('0x87')](_0x22f3ed['body'][_0xfecc('0x6b')],_['omit'](_0x22f3ed[_0xfecc('0x59')],['ids','id'])||{})[_0xfecc('0x88')](function(_0x571df5){for(var _0x51e1a2=0x0;_0x51e1a2<_0x22f3ed[_0xfecc('0x59')][_0xfecc('0x6b')][_0xfecc('0x40')];_0x51e1a2+=0x1){socket[_0xfecc('0x85')](_0xfecc('0x74'),{'UserId':Number(_0x22f3ed[_0xfecc('0x59')][_0xfecc('0x6b')][_0x51e1a2]),'SmsQueueId':Number(_0x22f3ed[_0xfecc('0x50')]['id'])});}return _0x571df5;});}})[_0xfecc('0x2c')](respondWithResult(_0x4d74eb,null))[_0xfecc('0x4e')](handleError(_0x4d74eb,null));};exports[_0xfecc('0x84')]=function(_0x3c8c84,_0x463977,_0x2490df){return db[_0xfecc('0x4a')]['find']({'where':{'id':_0x3c8c84[_0xfecc('0x50')]['id']}})[_0xfecc('0x2c')](handleEntityNotFound(_0x463977,null))['then'](function(_0x1752fb){if(_0x1752fb){return _0x1752fb[_0xfecc('0x84')](_0x3c8c84[_0xfecc('0x3b')]['ids'])[_0xfecc('0x2c')](function(){if(_['isArray'](_0x3c8c84[_0xfecc('0x3b')][_0xfecc('0x6b')])){for(var _0x486fa6=0x0;_0x486fa6<_0x3c8c84['query']['ids'][_0xfecc('0x40')];_0x486fa6+=0x1){socket[_0xfecc('0x85')](_0xfecc('0x86'),{'UserId':Number(_0x3c8c84['query'][_0xfecc('0x6b')][_0x486fa6]),'SmsQueueId':Number(_0x3c8c84[_0xfecc('0x50')]['id'])});}}else{socket[_0xfecc('0x85')](_0xfecc('0x86'),{'UserId':Number(_0x3c8c84[_0xfecc('0x3b')][_0xfecc('0x6b')]),'SmsQueueId':Number(_0x3c8c84[_0xfecc('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x463977,null))[_0xfecc('0x4e')](handleError(_0x463977,null));};exports['getAgents']=function(_0x5375e0,_0x494419,_0x5998f4){var _0x22edf7={};var _0x5a7e88={};var _0x140806;var _0x333a49;return db[_0xfecc('0x4a')]['findOne']({'where':{'id':_0x5375e0[_0xfecc('0x50')]['id']}})[_0xfecc('0x2c')](handleEntityNotFound(_0x494419,null))[_0xfecc('0x2c')](function(_0x4a551c){if(_0x4a551c){_0x140806=_0x4a551c;_0x5a7e88['model']=_[_0xfecc('0x3c')](db[_0xfecc('0x5f')]['rawAttributes']);_0x5a7e88[_0xfecc('0x3b')]=_[_0xfecc('0x3c')](_0x5375e0[_0xfecc('0x3b')]);_0x5a7e88[_0xfecc('0x46')]=_['intersection'](_0x5a7e88[_0xfecc('0x3a')],_0x5a7e88['query']);_0x22edf7[_0xfecc('0x3e')]=_['intersection'](_0x5a7e88['model'],qs[_0xfecc('0x3f')](_0x5375e0[_0xfecc('0x3b')]['fields']));_0x22edf7[_0xfecc('0x3e')]=_0x22edf7[_0xfecc('0x3e')][_0xfecc('0x40')]?_0x22edf7['attributes']:_0x5a7e88[_0xfecc('0x3a')];_0x22edf7[_0xfecc('0x5d')]=qs['sort'](_0x5375e0[_0xfecc('0x3b')][_0xfecc('0x43')]);_0x22edf7[_0xfecc('0x44')]=qs[_0xfecc('0x46')](_[_0xfecc('0x45')](_0x5375e0[_0xfecc('0x3b')],_0x5a7e88[_0xfecc('0x46')]));if(_0x5375e0[_0xfecc('0x3b')][_0xfecc('0x47')]){_0x22edf7[_0xfecc('0x44')]=_[_0xfecc('0x48')](_0x22edf7['where'],{'$or':_[_0xfecc('0x37')](_0x22edf7[_0xfecc('0x3e')],function(_0x1a71b3){var _0x1c630f={};_0x1c630f[_0x1a71b3]={'$like':'%'+_0x5375e0[_0xfecc('0x3b')]['filter']+'%'};return _0x1c630f;})});}_0x22edf7=_[_0xfecc('0x48')]({},_0x22edf7,_0x5375e0['options']);return _0x140806[_0xfecc('0x89')](_0x22edf7);}})[_0xfecc('0x2c')](function(_0x35d160){if(_0x35d160){_0x333a49=_0x35d160['length'];if(!_0x5375e0[_0xfecc('0x3b')][_0xfecc('0x41')](_0xfecc('0x42'))){_0x22edf7[_0xfecc('0x24')]=qs['limit'](_0x5375e0[_0xfecc('0x3b')][_0xfecc('0x24')]);_0x22edf7[_0xfecc('0x21')]=qs[_0xfecc('0x21')](_0x5375e0[_0xfecc('0x3b')]['offset']);}return _0x140806[_0xfecc('0x89')](_0x22edf7);}})[_0xfecc('0x2c')](function(_0x4899c6){if(_0x4899c6){return _0x4899c6?{'count':_0x333a49,'rows':_0x4899c6}:null;}})['then'](respondWithResult(_0x494419,null))[_0xfecc('0x4e')](handleError(_0x494419,null));}; \ No newline at end of file +var _0x6d78=['body','describe','getMembers','UserSmsQueue','hasOwnProperty','SmsQueueId','User','findAndCountAll','UserId','agent','updatedAt','format','%s/%s','SIP','smsPause','createdAt','findOne','Team','getTeams','addTeams','ids','online','voicePause','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','union','compact','removeTeams','userSmsQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','eml-format','rimraf','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','SmsQueue','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','user','userProfileId','autoAssociation'];(function(_0x361ffb,_0x5e80b9){var _0x1b5fe0=function(_0x3775eb){while(--_0x3775eb){_0x361ffb['push'](_0x361ffb['shift']());}};_0x1b5fe0(++_0x5e80b9);}(_0x6d78,0x1c9));var _0x86d7=function(_0x13315d,_0x1d9044){_0x13315d=_0x13315d-0x0;var _0x51d04e=_0x6d78[_0x13315d];return _0x51d04e;};'use strict';var emlformat=require(_0x86d7('0x0'));var rimraf=require(_0x86d7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d7('0x2'));var Mustache=require('mustache');var util=require(_0x86d7('0x3'));var path=require('path');var sox=require(_0x86d7('0x4'));var csv=require(_0x86d7('0x5'));var ejs=require(_0x86d7('0x6'));var fs=require('fs');var fs_extra=require(_0x86d7('0x7'));var _=require(_0x86d7('0x8'));var squel=require('squel');var crypto=require(_0x86d7('0x9'));var jsforce=require(_0x86d7('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x86d7('0x5'));var querystring=require(_0x86d7('0xb'));var Papa=require(_0x86d7('0xc'));var Redis=require(_0x86d7('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x86d7('0xe'));var as=require(_0x86d7('0xf'));var hardwareService=require(_0x86d7('0x10'));var logger=require('../../config/logger')(_0x86d7('0x11'));var utils=require(_0x86d7('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x86d7('0x13'));var db=require(_0x86d7('0x14'))['db'];config[_0x86d7('0x15')]=_[_0x86d7('0x16')](config[_0x86d7('0x15')],{'host':_0x86d7('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x86d7('0x15')]));require(_0x86d7('0x18'))[_0x86d7('0x19')](socket);function respondWithStatusCode(_0x41d5e0,_0x21f065){_0x21f065=_0x21f065||0xcc;return function(_0x17d058){if(_0x17d058){return _0x41d5e0['sendStatus'](_0x21f065);}return _0x41d5e0[_0x86d7('0x1a')](_0x21f065)['end']();};}function respondWithResult(_0x4d3e82,_0x5ecdc8){_0x5ecdc8=_0x5ecdc8||0xc8;return function(_0x5a0c3d){if(_0x5a0c3d){return _0x4d3e82[_0x86d7('0x1a')](_0x5ecdc8)[_0x86d7('0x1b')](_0x5a0c3d);}};}function respondWithFilteredResult(_0x391d30,_0x571a9a){return function(_0x2d32c9){if(_0x2d32c9){var _0x35bae3=typeof _0x571a9a[_0x86d7('0x1c')]===_0x86d7('0x1d')&&typeof _0x571a9a[_0x86d7('0x1e')]===_0x86d7('0x1d');var _0xa6064c=_0x2d32c9[_0x86d7('0x1f')];var _0x5375d0=_0x35bae3?0x0:_0x571a9a[_0x86d7('0x1c')];var _0x174821=_0x35bae3?_0x2d32c9['count']:_0x571a9a[_0x86d7('0x1c')]+_0x571a9a['limit'];var _0x1d393c;if(_0x174821>=_0xa6064c){_0x174821=_0xa6064c;_0x1d393c=0xc8;}else{_0x1d393c=0xce;}_0x391d30['status'](_0x1d393c);return _0x391d30[_0x86d7('0x20')](_0x86d7('0x21'),_0x5375d0+'-'+_0x174821+'/'+_0xa6064c)[_0x86d7('0x1b')](_0x2d32c9);}return null;};}function patchUpdates(_0x4b8bbf){return function(_0x300c41){try{jsonpatch[_0x86d7('0x22')](_0x300c41,_0x4b8bbf,!![]);}catch(_0x1aa8da){return BPromise[_0x86d7('0x23')](_0x1aa8da);}return _0x300c41[_0x86d7('0x24')]();};}function saveUpdates(_0x140163,_0x56ed6e){return function(_0x4e2b52){if(_0x4e2b52){return _0x4e2b52[_0x86d7('0x25')](_0x140163)[_0x86d7('0x26')](function(_0x469700){return _0x469700;});}return null;};}function removeEntity(_0x18b9bc,_0x2342ac){return function(_0x188385){if(_0x188385){return _0x188385[_0x86d7('0x27')]()[_0x86d7('0x26')](function(){var _0xed48ad=_0x188385[_0x86d7('0x28')]({'plain':!![]});var _0x30d828=_0x86d7('0x29');return db[_0x86d7('0x2a')]['destroy']({'where':{'type':_0x30d828,'resourceId':_0xed48ad['id']}})[_0x86d7('0x26')](function(){return _0x188385;});})[_0x86d7('0x26')](function(){_0x18b9bc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x35b05d,_0x4e07a6){return function(_0x152769){if(!_0x152769){_0x35b05d[_0x86d7('0x2b')](0x194);}return _0x152769;};}function handleError(_0x57c90a,_0x275538){_0x275538=_0x275538||0x1f4;return function(_0x582daf){logger[_0x86d7('0x2c')](_0x582daf[_0x86d7('0x2d')]);if(_0x582daf[_0x86d7('0x2e')]){delete _0x582daf[_0x86d7('0x2e')];}_0x57c90a[_0x86d7('0x1a')](_0x275538)[_0x86d7('0x2f')](_0x582daf);};}exports[_0x86d7('0x30')]=function(_0x826735,_0x2b948){var _0x8a224a={},_0x25ef5d={},_0x1c7ee6={'count':0x0,'rows':[]};var _0x70aa80=_[_0x86d7('0x31')](db[_0x86d7('0x32')][_0x86d7('0x33')],function(_0x1eb65e){return{'name':_0x1eb65e['fieldName'],'type':_0x1eb65e['type'][_0x86d7('0x34')]};});_0x25ef5d[_0x86d7('0x35')]=_[_0x86d7('0x31')](_0x70aa80,_0x86d7('0x2e'));_0x25ef5d[_0x86d7('0x36')]=_[_0x86d7('0x37')](_0x826735[_0x86d7('0x36')]);_0x25ef5d[_0x86d7('0x38')]=_[_0x86d7('0x39')](_0x25ef5d['model'],_0x25ef5d[_0x86d7('0x36')]);_0x8a224a[_0x86d7('0x3a')]=_[_0x86d7('0x39')](_0x25ef5d[_0x86d7('0x35')],qs[_0x86d7('0x3b')](_0x826735[_0x86d7('0x36')]['fields']));_0x8a224a[_0x86d7('0x3a')]=_0x8a224a['attributes'][_0x86d7('0x3c')]?_0x8a224a[_0x86d7('0x3a')]:_0x25ef5d['model'];if(!_0x826735['query']['hasOwnProperty'](_0x86d7('0x3d'))){_0x8a224a[_0x86d7('0x1e')]=qs[_0x86d7('0x1e')](_0x826735[_0x86d7('0x36')][_0x86d7('0x1e')]);_0x8a224a[_0x86d7('0x1c')]=qs['offset'](_0x826735[_0x86d7('0x36')][_0x86d7('0x1c')]);}_0x8a224a[_0x86d7('0x3e')]=qs[_0x86d7('0x3f')](_0x826735[_0x86d7('0x36')][_0x86d7('0x3f')]);_0x8a224a[_0x86d7('0x40')]=qs[_0x86d7('0x38')](_[_0x86d7('0x41')](_0x826735[_0x86d7('0x36')],_0x25ef5d[_0x86d7('0x38')]),_0x70aa80);if(_0x826735[_0x86d7('0x36')][_0x86d7('0x42')]){_0x8a224a['where']=_['merge'](_0x8a224a[_0x86d7('0x40')],{'$or':_[_0x86d7('0x31')](_0x70aa80,function(_0x39c79d){if(_0x39c79d[_0x86d7('0x43')]!==_0x86d7('0x44')){var _0x249b81={};_0x249b81[_0x39c79d[_0x86d7('0x2e')]]={'$like':'%'+_0x826735[_0x86d7('0x36')]['filter']+'%'};return _0x249b81;}})});}_0x8a224a=_[_0x86d7('0x45')]({},_0x8a224a,_0x826735[_0x86d7('0x46')]);var _0x63b49c={'where':_0x8a224a['where']};return db[_0x86d7('0x32')][_0x86d7('0x1f')](_0x63b49c)['then'](function(_0x3b42ab){_0x1c7ee6[_0x86d7('0x1f')]=_0x3b42ab;if(_0x826735[_0x86d7('0x36')][_0x86d7('0x47')]){_0x8a224a['include']=[{'all':!![]}];}return db[_0x86d7('0x32')][_0x86d7('0x48')](_0x8a224a);})[_0x86d7('0x26')](function(_0x39fd43){_0x1c7ee6[_0x86d7('0x49')]=_0x39fd43;return _0x1c7ee6;})[_0x86d7('0x26')](respondWithFilteredResult(_0x2b948,_0x8a224a))[_0x86d7('0x4a')](handleError(_0x2b948,null));};exports[_0x86d7('0x4b')]=function(_0x36131f,_0x4f15d2){var _0x56fb11={'raw':!![],'where':{'id':_0x36131f[_0x86d7('0x4c')]['id']}},_0x49a2c7={};_0x49a2c7[_0x86d7('0x35')]=_[_0x86d7('0x37')](db[_0x86d7('0x32')][_0x86d7('0x33')]);_0x49a2c7['query']=_['keys'](_0x36131f[_0x86d7('0x36')]);_0x49a2c7[_0x86d7('0x38')]=_[_0x86d7('0x39')](_0x49a2c7[_0x86d7('0x35')],_0x49a2c7[_0x86d7('0x36')]);_0x56fb11[_0x86d7('0x3a')]=_[_0x86d7('0x39')](_0x49a2c7['model'],qs[_0x86d7('0x3b')](_0x36131f[_0x86d7('0x36')][_0x86d7('0x3b')]));_0x56fb11[_0x86d7('0x3a')]=_0x56fb11[_0x86d7('0x3a')][_0x86d7('0x3c')]?_0x56fb11[_0x86d7('0x3a')]:_0x49a2c7[_0x86d7('0x35')];if(_0x36131f[_0x86d7('0x36')]['includeAll']){_0x56fb11[_0x86d7('0x4d')]=[{'all':!![]}];}_0x56fb11=_['merge']({},_0x56fb11,_0x36131f[_0x86d7('0x46')]);return db[_0x86d7('0x32')][_0x86d7('0x4e')](_0x56fb11)['then'](handleEntityNotFound(_0x4f15d2,null))[_0x86d7('0x26')](respondWithResult(_0x4f15d2,null))[_0x86d7('0x4a')](handleError(_0x4f15d2,null));};exports[_0x86d7('0x4f')]=function(_0x338272,_0x560b4a){return db['SmsQueue'][_0x86d7('0x4f')](_0x338272['body'],{})[_0x86d7('0x26')](function(_0x31d465){var _0x26358b=_0x338272['user']['get']({'plain':!![]});if(!_0x26358b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26358b['role']===_0x86d7('0x50')){var _0x2bef5c=_0x31d465['get']({'plain':!![]});var _0x1d4aa1='SmsQueues';return db['UserProfileSection'][_0x86d7('0x4e')]({'where':{'name':_0x1d4aa1,'userProfileId':_0x26358b[_0x86d7('0x51')]},'raw':!![]})[_0x86d7('0x26')](function(_0x95fa68){if(_0x95fa68&&_0x95fa68[_0x86d7('0x52')]===0x0){return db[_0x86d7('0x2a')][_0x86d7('0x4f')]({'name':_0x2bef5c['name'],'resourceId':_0x2bef5c['id'],'type':_0x95fa68[_0x86d7('0x2e')],'sectionId':_0x95fa68['id']},{})[_0x86d7('0x26')](function(){return _0x31d465;});}else{return _0x31d465;}})['catch'](function(_0x3b5858){logger[_0x86d7('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b5858);throw _0x3b5858;});}return _0x31d465;})[_0x86d7('0x26')](respondWithResult(_0x560b4a,0xc9))['catch'](handleError(_0x560b4a,null));};exports[_0x86d7('0x25')]=function(_0x8dc62b,_0xd95947){if(_0x8dc62b[_0x86d7('0x53')]['id']){delete _0x8dc62b['body']['id'];}return db[_0x86d7('0x32')]['find']({'where':{'id':_0x8dc62b[_0x86d7('0x4c')]['id']}})[_0x86d7('0x26')](handleEntityNotFound(_0xd95947,null))['then'](saveUpdates(_0x8dc62b[_0x86d7('0x53')],null))[_0x86d7('0x26')](respondWithResult(_0xd95947,null))['catch'](handleError(_0xd95947,null));};exports[_0x86d7('0x27')]=function(_0x3bd58f,_0x347972){return db['SmsQueue'][_0x86d7('0x4e')]({'where':{'id':_0x3bd58f[_0x86d7('0x4c')]['id']}})[_0x86d7('0x26')](handleEntityNotFound(_0x347972,null))[_0x86d7('0x26')](removeEntity(_0x347972,null))[_0x86d7('0x4a')](handleError(_0x347972,null));};exports[_0x86d7('0x54')]=function(_0x583164,_0xa21aaf){return db[_0x86d7('0x32')][_0x86d7('0x54')]()[_0x86d7('0x26')](respondWithResult(_0xa21aaf,null))['catch'](handleError(_0xa21aaf,null));};exports[_0x86d7('0x55')]=function(_0x31f0b0,_0x2f6200,_0x5f229d){var _0x13e321={'raw':!![],'where':{}},_0x390d4a={},_0x22a1e2;return db[_0x86d7('0x32')]['findOne']({'where':{'id':_0x31f0b0[_0x86d7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2f6200,null))['then'](function(_0x2eca9f){if(_0x2eca9f){_0x22a1e2=_0x2eca9f[_0x86d7('0x28')]({'plain':!![]});_0x390d4a[_0x86d7('0x35')]=_['keys'](db[_0x86d7('0x56')]['rawAttributes']);_0x390d4a[_0x86d7('0x36')]=_[_0x86d7('0x37')](_0x31f0b0[_0x86d7('0x36')]);_0x390d4a[_0x86d7('0x38')]=_['intersection'](_0x390d4a[_0x86d7('0x35')],_0x390d4a['query']);_0x13e321['attributes']=_[_0x86d7('0x39')](_0x390d4a[_0x86d7('0x35')],qs['fields'](_0x31f0b0[_0x86d7('0x36')]['fields']));_0x13e321[_0x86d7('0x3a')]=_0x13e321[_0x86d7('0x3a')][_0x86d7('0x3c')]?_0x13e321['attributes']:_0x390d4a[_0x86d7('0x35')];if(!_0x31f0b0[_0x86d7('0x36')][_0x86d7('0x57')](_0x86d7('0x3d'))){_0x13e321['limit']=qs[_0x86d7('0x1e')](_0x31f0b0[_0x86d7('0x36')]['limit']);_0x13e321[_0x86d7('0x1c')]=qs['offset'](_0x31f0b0['query'][_0x86d7('0x1c')]);}_0x13e321[_0x86d7('0x3e')]=qs[_0x86d7('0x3f')](_0x31f0b0[_0x86d7('0x36')][_0x86d7('0x3f')]);_0x13e321[_0x86d7('0x40')]=qs[_0x86d7('0x38')](_[_0x86d7('0x41')](_0x31f0b0[_0x86d7('0x36')],_0x390d4a[_0x86d7('0x38')]));_0x13e321[_0x86d7('0x40')][_0x86d7('0x58')]=_0x2eca9f['id'];if(_0x31f0b0[_0x86d7('0x36')][_0x86d7('0x42')]){_0x13e321['where']=_[_0x86d7('0x45')](_0x13e321[_0x86d7('0x40')],{'$or':_[_0x86d7('0x31')](_0x13e321['attributes'],function(_0x206470){var _0x22c14d={};_0x22c14d[_0x206470]={'$like':'%'+_0x31f0b0[_0x86d7('0x36')][_0x86d7('0x42')]+'%'};return _0x22c14d;})});}_0x13e321=_[_0x86d7('0x45')]({},_0x13e321,_0x31f0b0[_0x86d7('0x46')]);return db[_0x86d7('0x56')][_0x86d7('0x48')](_0x13e321);}})['then'](function(_0x30f08c){if(_0x30f08c){return db[_0x86d7('0x59')][_0x86d7('0x5a')]({'where':{'id':_['map'](_0x30f08c,_0x86d7('0x5b')),'role':_0x86d7('0x5c')},'attributes':['id',_0x86d7('0x2e'),'smsPause',_0x86d7('0x5d'),'createdAt']});}})[_0x86d7('0x26')](function(_0x2db7ac){if(_0x2db7ac){return{'count':_0x2db7ac['count'],'rows':_[_0x86d7('0x31')](_0x2db7ac['rows'],function(_0x46ed75){return{'membername':_0x46ed75[_0x86d7('0x2e')],'UserId':_0x46ed75['id'],'queue_name':_0x22a1e2[_0x86d7('0x2e')],'SmsQueueId':_0x22a1e2['id'],'interface':util[_0x86d7('0x5e')](_0x86d7('0x5f'),_0x86d7('0x60'),_0x46ed75[_0x86d7('0x2e')]),'penalty':0x0,'paused':_0x46ed75[_0x86d7('0x61')],'createdAt':_0x46ed75[_0x86d7('0x62')],'updatedAt':_0x46ed75[_0x86d7('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2f6200,_0x13e321))['catch'](handleError(_0x2f6200,null));};exports['getTeams']=function(_0x72782a,_0x536542,_0x2761ad){var _0x4ef136={};var _0x31018e={};var _0x517e67;var _0x5ef900;return db[_0x86d7('0x32')][_0x86d7('0x63')]({'where':{'id':_0x72782a[_0x86d7('0x4c')]['id']}})[_0x86d7('0x26')](handleEntityNotFound(_0x536542,null))['then'](function(_0x14ef6d){if(_0x14ef6d){_0x517e67=_0x14ef6d;_0x31018e[_0x86d7('0x35')]=_[_0x86d7('0x37')](db[_0x86d7('0x64')][_0x86d7('0x33')]);_0x31018e[_0x86d7('0x36')]=_[_0x86d7('0x37')](_0x72782a[_0x86d7('0x36')]);_0x31018e['filters']=_[_0x86d7('0x39')](_0x31018e[_0x86d7('0x35')],_0x31018e[_0x86d7('0x36')]);_0x4ef136[_0x86d7('0x3a')]=_[_0x86d7('0x39')](_0x31018e[_0x86d7('0x35')],qs['fields'](_0x72782a[_0x86d7('0x36')][_0x86d7('0x3b')]));_0x4ef136[_0x86d7('0x3a')]=_0x4ef136[_0x86d7('0x3a')]['length']?_0x4ef136[_0x86d7('0x3a')]:_0x31018e[_0x86d7('0x35')];_0x4ef136[_0x86d7('0x3e')]=qs[_0x86d7('0x3f')](_0x72782a[_0x86d7('0x36')][_0x86d7('0x3f')]);_0x4ef136[_0x86d7('0x40')]=qs[_0x86d7('0x38')](_[_0x86d7('0x41')](_0x72782a[_0x86d7('0x36')],_0x31018e[_0x86d7('0x38')]));if(_0x72782a[_0x86d7('0x36')][_0x86d7('0x42')]){_0x4ef136[_0x86d7('0x40')]=_[_0x86d7('0x45')](_0x4ef136[_0x86d7('0x40')],{'$or':_[_0x86d7('0x31')](_0x4ef136[_0x86d7('0x3a')],function(_0x735d4e){var _0x412d78={};_0x412d78[_0x735d4e]={'$like':'%'+_0x72782a[_0x86d7('0x36')][_0x86d7('0x42')]+'%'};return _0x412d78;})});}_0x4ef136=_[_0x86d7('0x45')]({},_0x4ef136,_0x72782a[_0x86d7('0x46')]);return _0x517e67['getTeams'](_0x4ef136);}})['then'](function(_0x4dbb5e){if(_0x4dbb5e){_0x5ef900=_0x4dbb5e[_0x86d7('0x3c')];if(!_0x72782a[_0x86d7('0x36')][_0x86d7('0x57')](_0x86d7('0x3d'))){_0x4ef136[_0x86d7('0x1e')]=qs[_0x86d7('0x1e')](_0x72782a[_0x86d7('0x36')]['limit']);_0x4ef136[_0x86d7('0x1c')]=qs[_0x86d7('0x1c')](_0x72782a[_0x86d7('0x36')][_0x86d7('0x1c')]);}return _0x517e67[_0x86d7('0x65')](_0x4ef136);}})['then'](function(_0x2ce357){if(_0x2ce357){return _0x2ce357?{'count':_0x5ef900,'rows':_0x2ce357}:null;}})[_0x86d7('0x26')](respondWithResult(_0x536542,null))[_0x86d7('0x4a')](handleError(_0x536542,null));};exports[_0x86d7('0x66')]=function(_0x4d847f,_0xc19248,_0xac0a15){var _0x4ed9c9=_0x4d847f[_0x86d7('0x53')][_0x86d7('0x67')];return db[_0x86d7('0x64')][_0x86d7('0x48')]({'where':{'id':_0x4ed9c9},'attributes':['id'],'include':[{'model':db[_0x86d7('0x59')],'as':'Agents','attributes':['id',_0x86d7('0x2e'),_0x86d7('0x68'),_0x86d7('0x69'),'interface'],'raw':!![]}]})[_0x86d7('0x26')](function(_0x5678f1){if(_0x5678f1){var _0x20e1e1=_['flatMap'](_0x5678f1,function(_0x24d227){var _0x19ae99=_0x24d227['get']({'plain':!![]});return _0x19ae99[_0x86d7('0x6a')];});return db[_0x86d7('0x32')]['find']({'where':{'id':_0x4d847f['params']['id']}})['then'](function(_0xb2565e){return db[_0x86d7('0x6b')][_0x86d7('0x6c')](function(_0x1be121){return _0xb2565e['addTeams'](_0x4ed9c9,{'transaction':_0x1be121})[_0x86d7('0x26')](function(){return BPromise[_0x86d7('0x6d')](_0x20e1e1,function(_0x33ec76){return db[_0x86d7('0x56')][_0x86d7('0x6e')]({'where':{'UserId':_0x33ec76['id'],'SmsQueueId':_0x4d847f[_0x86d7('0x4c')]['id']},'transaction':_0x1be121});});})['then'](function(){_0x20e1e1[_0x86d7('0x6f')](function(_0x470353){socket[_0x86d7('0x70')](_0x86d7('0x71'),{'UserId':_0x470353['id'],'SmsQueueId':_0xb2565e['id']});});});});});}})[_0x86d7('0x26')](respondWithStatusCode(_0xc19248,null))[_0x86d7('0x4a')](handleError(_0xc19248,null));};exports['removeTeams']=function(_0x1ef645,_0x359dc4,_0x1b801a){return db['Team']['findAll']({'where':{'id':_0x1ef645[_0x86d7('0x36')][_0x86d7('0x67')]},'attributes':['id'],'include':[{'model':db[_0x86d7('0x59')],'as':_0x86d7('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x86d7('0x26')](handleEntityNotFound(_0x359dc4,null))[_0x86d7('0x26')](function(_0x57f6cb){var _0x5b48c2=_[_0x86d7('0x31')](_0x57f6cb,'id');var _0x8a065e=[];var _0x35d7e6=[];var _0x53a4d5=squel[_0x86d7('0x72')]();_0x53a4d5[_0x86d7('0x73')](_0x86d7('0x74'))[_0x86d7('0x75')]('team_has_sms_queues','tq')['join'](_0x86d7('0x76'),'ut',_0x86d7('0x77'))['where']('SmsQueueId\x20=\x20?',_0x1ef645[_0x86d7('0x4c')]['id']);for(var _0x2fd76d=0x0;_0x2fd76d<_0x57f6cb[_0x86d7('0x3c')];_0x2fd76d+=0x1){let _0x371d33=_0x57f6cb[_0x2fd76d];for(var _0x36ac2a=0x0;_0x36ac2a<_0x371d33[_0x86d7('0x6a')][_0x86d7('0x3c')];_0x36ac2a+=0x1){let _0x21552c=_0x371d33[_0x86d7('0x6a')][_0x36ac2a];var _0x554910=_0x53a4d5[_0x86d7('0x78')]();_0x554910['where'](_0x86d7('0x79'),_0x21552c['id']);_0x35d7e6[_0x86d7('0x7a')](db[_0x86d7('0x6b')][_0x86d7('0x36')](_0x554910[_0x86d7('0x7b')](),{'type':db[_0x86d7('0x6b')]['QueryTypes'][_0x86d7('0x7c')]})['then'](function(_0xd3fab0){if(_0xd3fab0[_0x86d7('0x3c')]===0x1){return _0x21552c['id'];}else{var _0x1d799b=_['every'](_[_0x86d7('0x31')](_0xd3fab0,_0x86d7('0x7d')),function(_0x4e30ab){return _['includes'](_0x5b48c2,_0x4e30ab);});if(_0x1d799b){return _0x21552c['id'];}}}));}}return BPromise['all'](_0x35d7e6)[_0x86d7('0x26')](function(_0x421311){_0x8a065e=_(_0x8a065e)[_0x86d7('0x7e')](_0x421311)[_0x86d7('0x7f')]()['value']();return db[_0x86d7('0x32')][_0x86d7('0x4e')]({'where':{'id':_0x1ef645[_0x86d7('0x4c')]['id']}})[_0x86d7('0x26')](function(_0x43702c){return db[_0x86d7('0x6b')][_0x86d7('0x6c')](function(_0x3145a0){return _0x43702c[_0x86d7('0x80')](_0x1ef645[_0x86d7('0x36')]['ids'],{'transaction':_0x3145a0})[_0x86d7('0x26')](function(){if(!_['isEmpty'](_0x8a065e)){return _0x43702c['removeAgents'](_0x8a065e,{'transaction':_0x3145a0});}})[_0x86d7('0x26')](function(){_0x8a065e[_0x86d7('0x6f')](function(_0x10095e){socket[_0x86d7('0x70')](_0x86d7('0x81'),{'UserId':_0x10095e,'SmsQueueId':_0x43702c['id']});});});});});});})['then'](respondWithStatusCode(_0x359dc4,null))[_0x86d7('0x4a')](handleError(_0x359dc4,null));};exports[_0x86d7('0x82')]=function(_0x2c34f6,_0x30462c,_0x5601e4){return db[_0x86d7('0x32')][_0x86d7('0x4e')]({'where':{'id':_0x2c34f6[_0x86d7('0x4c')]['id']}})[_0x86d7('0x26')](handleEntityNotFound(_0x30462c,null))[_0x86d7('0x26')](function(_0x41fbda){if(_0x41fbda){return _0x41fbda[_0x86d7('0x82')](_0x2c34f6[_0x86d7('0x53')]['ids'],_[_0x86d7('0x83')](_0x2c34f6[_0x86d7('0x53')],[_0x86d7('0x67'),'id'])||{})['spread'](function(_0x76671e){for(var _0x152df8=0x0;_0x152df8<_0x2c34f6[_0x86d7('0x53')][_0x86d7('0x67')][_0x86d7('0x3c')];_0x152df8+=0x1){socket[_0x86d7('0x70')](_0x86d7('0x71'),{'UserId':Number(_0x2c34f6['body']['ids'][_0x152df8]),'SmsQueueId':Number(_0x2c34f6[_0x86d7('0x4c')]['id'])});}return _0x76671e;});}})[_0x86d7('0x26')](respondWithResult(_0x30462c,null))[_0x86d7('0x4a')](handleError(_0x30462c,null));};exports['removeAgents']=function(_0x12253d,_0x1fd18b,_0x2119b5){return db[_0x86d7('0x32')][_0x86d7('0x4e')]({'where':{'id':_0x12253d[_0x86d7('0x4c')]['id']}})[_0x86d7('0x26')](handleEntityNotFound(_0x1fd18b,null))[_0x86d7('0x26')](function(_0x18e7b6){if(_0x18e7b6){return _0x18e7b6[_0x86d7('0x84')](_0x12253d[_0x86d7('0x36')]['ids'])[_0x86d7('0x26')](function(){if(_[_0x86d7('0x85')](_0x12253d[_0x86d7('0x36')][_0x86d7('0x67')])){for(var _0x218184=0x0;_0x218184<_0x12253d[_0x86d7('0x36')][_0x86d7('0x67')][_0x86d7('0x3c')];_0x218184+=0x1){socket[_0x86d7('0x70')](_0x86d7('0x81'),{'UserId':Number(_0x12253d['query'][_0x86d7('0x67')][_0x218184]),'SmsQueueId':Number(_0x12253d[_0x86d7('0x4c')]['id'])});}}else{socket[_0x86d7('0x70')](_0x86d7('0x81'),{'UserId':Number(_0x12253d['query'][_0x86d7('0x67')]),'SmsQueueId':Number(_0x12253d['params']['id'])});}});}})[_0x86d7('0x26')](respondWithStatusCode(_0x1fd18b,null))[_0x86d7('0x4a')](handleError(_0x1fd18b,null));};exports[_0x86d7('0x86')]=function(_0x45b8cc,_0x571a67,_0x3601f6){var _0x4332b8={};var _0x2e5c2c={};var _0xaeae6a;var _0x404bbc;return db[_0x86d7('0x32')][_0x86d7('0x63')]({'where':{'id':_0x45b8cc[_0x86d7('0x4c')]['id']}})[_0x86d7('0x26')](handleEntityNotFound(_0x571a67,null))[_0x86d7('0x26')](function(_0x274e99){if(_0x274e99){_0xaeae6a=_0x274e99;_0x2e5c2c[_0x86d7('0x35')]=_['keys'](db[_0x86d7('0x59')][_0x86d7('0x33')]);_0x2e5c2c[_0x86d7('0x36')]=_[_0x86d7('0x37')](_0x45b8cc['query']);_0x2e5c2c[_0x86d7('0x38')]=_[_0x86d7('0x39')](_0x2e5c2c[_0x86d7('0x35')],_0x2e5c2c[_0x86d7('0x36')]);_0x4332b8[_0x86d7('0x3a')]=_[_0x86d7('0x39')](_0x2e5c2c['model'],qs[_0x86d7('0x3b')](_0x45b8cc[_0x86d7('0x36')][_0x86d7('0x3b')]));_0x4332b8[_0x86d7('0x3a')]=_0x4332b8['attributes'][_0x86d7('0x3c')]?_0x4332b8[_0x86d7('0x3a')]:_0x2e5c2c[_0x86d7('0x35')];_0x4332b8[_0x86d7('0x3e')]=qs[_0x86d7('0x3f')](_0x45b8cc[_0x86d7('0x36')]['sort']);_0x4332b8[_0x86d7('0x40')]=qs[_0x86d7('0x38')](_[_0x86d7('0x41')](_0x45b8cc[_0x86d7('0x36')],_0x2e5c2c[_0x86d7('0x38')]));if(_0x45b8cc[_0x86d7('0x36')][_0x86d7('0x42')]){_0x4332b8[_0x86d7('0x40')]=_[_0x86d7('0x45')](_0x4332b8[_0x86d7('0x40')],{'$or':_['map'](_0x4332b8[_0x86d7('0x3a')],function(_0x3c75ca){var _0x2f0f22={};_0x2f0f22[_0x3c75ca]={'$like':'%'+_0x45b8cc[_0x86d7('0x36')][_0x86d7('0x42')]+'%'};return _0x2f0f22;})});}_0x4332b8=_['merge']({},_0x4332b8,_0x45b8cc[_0x86d7('0x46')]);return _0xaeae6a[_0x86d7('0x86')](_0x4332b8);}})[_0x86d7('0x26')](function(_0x252ae6){if(_0x252ae6){_0x404bbc=_0x252ae6[_0x86d7('0x3c')];if(!_0x45b8cc['query']['hasOwnProperty'](_0x86d7('0x3d'))){_0x4332b8[_0x86d7('0x1e')]=qs['limit'](_0x45b8cc[_0x86d7('0x36')]['limit']);_0x4332b8[_0x86d7('0x1c')]=qs[_0x86d7('0x1c')](_0x45b8cc[_0x86d7('0x36')][_0x86d7('0x1c')]);}return _0xaeae6a[_0x86d7('0x86')](_0x4332b8);}})[_0x86d7('0x26')](function(_0x5ec9df){if(_0x5ec9df){return _0x5ec9df?{'count':_0x404bbc,'rows':_0x5ec9df}:null;}})[_0x86d7('0x26')](respondWithResult(_0x571a67,null))['catch'](handleError(_0x571a67,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index ff406b7..fdc647c 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 _0xd1d6=['SmsQueue','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x2d4224,_0x394591){var _0x2246fe=function(_0x58793e){while(--_0x58793e){_0x2d4224['push'](_0x2d4224['shift']());}};_0x2246fe(++_0x394591);}(_0xd1d6,0x11f));var _0x6d1d=function(_0x403a0f,_0x2f7b4d){_0x403a0f=_0x403a0f-0x0;var _0x36334c=_0xd1d6[_0x403a0f];return _0x36334c;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x6d1d('0x0'))['db'][_0x6d1d('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x6d1d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6d1d('0x3')};function emitEvent(_0x29b469){return function(_0x2f0dc7,_0x6ed3c2,_0x14d500){SmsQueueEvents[_0x6d1d('0x4')](_0x29b469+':'+_0x2f0dc7['id'],_0x2f0dc7);SmsQueueEvents['emit'](_0x29b469,_0x2f0dc7);_0x14d500(null);};}for(var e in events){if(events[_0x6d1d('0x5')](e)){var event=events[e];SmsQueue[_0x6d1d('0x6')](e,emitEvent(event));}}module[_0x6d1d('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x16c7=['update','remove','hook','exports','events','SmsQueue','setMaxListeners','save'];(function(_0x5be8cc,_0x4a6037){var _0x5f1b7e=function(_0xebd8db){while(--_0xebd8db){_0x5be8cc['push'](_0x5be8cc['shift']());}};_0x5f1b7e(++_0x4a6037);}(_0x16c7,0x12c));var _0x716c=function(_0x110735,_0x5b97d3){_0x110735=_0x110735-0x0;var _0x1e84e7=_0x16c7[_0x110735];return _0x1e84e7;};'use strict';var EventEmitter=require(_0x716c('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x716c('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x716c('0x2')](0x0);var events={'afterCreate':_0x716c('0x3'),'afterUpdate':_0x716c('0x4'),'afterDestroy':_0x716c('0x5')};function emitEvent(_0x288688){return function(_0x5d9b71,_0x4e0d4b,_0x4eeef5){SmsQueueEvents['emit'](_0x288688+':'+_0x5d9b71['id'],_0x5d9b71);SmsQueueEvents['emit'](_0x288688,_0x5d9b71);_0x4eeef5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x716c('0x6')](e,emitEvent(event));}}module[_0x716c('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 76eac7f..00b2d2a 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 _0xcfe2=['api','bluebird','request-promise','path','../../config/environment','./smsQueue.attributes','exports','define','lodash','util'];(function(_0x50f535,_0x138550){var _0x52f569=function(_0x350cd5){while(--_0x350cd5){_0x50f535['push'](_0x50f535['shift']());}};_0x52f569(++_0x138550);}(_0xcfe2,0x1ac));var _0x2cfe=function(_0x10a67f,_0x41a565){_0x10a67f=_0x10a67f-0x0;var _0x4ca98f=_0xcfe2[_0x10a67f];return _0x4ca98f;};'use strict';var _=require(_0x2cfe('0x0'));var util=require(_0x2cfe('0x1'));var logger=require('../../config/logger')(_0x2cfe('0x2'));var moment=require('moment');var BPromise=require(_0x2cfe('0x3'));var rp=require(_0x2cfe('0x4'));var fs=require('fs');var path=require(_0x2cfe('0x5'));var rimraf=require('rimraf');var config=require(_0x2cfe('0x6'));var attributes=require(_0x2cfe('0x7'));module[_0x2cfe('0x8')]=function(_0x32882b,_0x1fa87b){return _0x32882b[_0x2cfe('0x9')]('SmsQueue',attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x658b=['exports','define','sms_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x658b,0xdb));var _0xb658=function(_0xb95121,_0x349501){_0xb95121=_0xb95121-0x0;var _0x3fa03f=_0x658b[_0xb95121];return _0x3fa03f;};'use strict';var _=require('lodash');var util=require(_0xb658('0x0'));var logger=require(_0xb658('0x1'))(_0xb658('0x2'));var moment=require('moment');var BPromise=require(_0xb658('0x3'));var rp=require(_0xb658('0x4'));var fs=require('fs');var path=require(_0xb658('0x5'));var rimraf=require(_0xb658('0x6'));var config=require(_0xb658('0x7'));var attributes=require(_0xb658('0x8'));module[_0xb658('0x9')]=function(_0x338785,_0x17b604){return _0x338785[_0xb658('0xa')]('SmsQueue',attributes,{'tableName':_0xb658('0xb'),'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 518ae1f..4e05963 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 _0x87f6=['socket.io-emitter','redis','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','options','raw','attributes','limit','map','include','model','GetSmsQueue','ShowSmsQueue','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost'];(function(_0x12c413,_0xd491da){var _0x46d286=function(_0x10f6ff){while(--_0x10f6ff){_0x12c413['push'](_0x12c413['shift']());}};_0x46d286(++_0xd491da);}(_0x87f6,0x151));var _0x687f=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x87f6[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x687f('0x0'));var util=require('util');var moment=require(_0x687f('0x1'));var BPromise=require(_0x687f('0x2'));var rs=require(_0x687f('0x3'));var fs=require('fs');var Redis=require(_0x687f('0x4'));var db=require(_0x687f('0x5'))['db'];var utils=require(_0x687f('0x6'));var logger=require('../../config/logger')(_0x687f('0x7'));var config=require(_0x687f('0x8'));var jayson=require(_0x687f('0x9'));var client=jayson[_0x687f('0xa')][_0x687f('0xb')]({'port':0x232a});config['redis']=_[_0x687f('0xc')](config['redis'],{'host':_0x687f('0xd'),'port':0x18eb});var socket=require(_0x687f('0xe'))(new Redis(config[_0x687f('0xf')]));require(_0x687f('0x10'))[_0x687f('0x11')](socket);function respondWithRpcPromise(_0xf02096,_0x1dc230,_0x4804f1){return new BPromise(function(_0x3eec9f,_0x485a2e){return client[_0x687f('0x12')](_0xf02096,_0x4804f1)[_0x687f('0x13')](function(_0x3630e8){logger[_0x687f('0x14')](_0x687f('0x15'),_0x1dc230,'request\x20sent');logger[_0x687f('0x16')](_0x687f('0x17'),_0x1dc230,'request\x20sent',JSON[_0x687f('0x18')](_0x3630e8));if(_0x3630e8['error']){if(_0x3630e8[_0x687f('0x19')]['code']===0x1f4){logger['error'](_0x687f('0x15'),_0x1dc230,_0x3630e8[_0x687f('0x19')]['message']);return _0x485a2e(_0x3630e8[_0x687f('0x19')][_0x687f('0x1a')]);}logger[_0x687f('0x19')](_0x687f('0x15'),_0x1dc230,_0x3630e8['error'][_0x687f('0x1a')]);return _0x3eec9f(_0x3630e8[_0x687f('0x19')][_0x687f('0x1a')]);}else{logger[_0x687f('0x14')](_0x687f('0x15'),_0x1dc230,'request\x20sent');_0x3eec9f(_0x3630e8[_0x687f('0x1b')][_0x687f('0x1a')]);}})[_0x687f('0x1c')](function(_0x301e15){logger[_0x687f('0x19')]('SmsQueue,\x20%s,\x20%s',_0x1dc230,_0x301e15);_0x485a2e(_0x301e15);});});}exports['GetSmsQueue']=function(_0x2e02c6){var _0xff4b48=this;return new Promise(function(_0x3c1de1,_0xca731b){return db['SmsQueue']['findAll']({'raw':_0x2e02c6[_0x687f('0x1d')]?_0x2e02c6[_0x687f('0x1d')][_0x687f('0x1e')]===undefined?!![]:![]:!![],'where':_0x2e02c6[_0x687f('0x1d')]?_0x2e02c6['options']['where']||null:null,'attributes':_0x2e02c6['options']?_0x2e02c6[_0x687f('0x1d')][_0x687f('0x1f')]||null:null,'limit':_0x2e02c6[_0x687f('0x1d')]?_0x2e02c6[_0x687f('0x1d')][_0x687f('0x20')]||null:null,'include':_0x2e02c6[_0x687f('0x1d')]?_0x2e02c6[_0x687f('0x1d')]['include']?_[_0x687f('0x21')](_0x2e02c6[_0x687f('0x1d')][_0x687f('0x22')],function(_0xa84d72){return{'model':db[_0xa84d72[_0x687f('0x23')]],'as':_0xa84d72['as'],'attributes':_0xa84d72[_0x687f('0x1f')],'include':_0xa84d72[_0x687f('0x22')]?_[_0x687f('0x21')](_0xa84d72[_0x687f('0x22')],function(_0x3f5a12){return{'model':db[_0x3f5a12[_0x687f('0x23')]],'as':_0x3f5a12['as'],'attributes':_0x3f5a12[_0x687f('0x1f')],'include':_0x3f5a12['include']?_['map'](_0x3f5a12[_0x687f('0x22')],function(_0x234091){return{'model':db[_0x234091[_0x687f('0x23')]],'as':_0x234091['as'],'attributes':_0x234091[_0x687f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x687f('0x13')](function(_0x50a177){logger[_0x687f('0x14')](_0x687f('0x24'),_0x2e02c6);logger[_0x687f('0x16')](_0x687f('0x24'),_0x2e02c6,JSON[_0x687f('0x18')](_0x50a177));_0x3c1de1(_0x50a177);})['catch'](function(_0x1620da){logger[_0x687f('0x19')](_0x687f('0x24'),_0x1620da[_0x687f('0x1a')],_0x2e02c6);_0xca731b(_0xff4b48[_0x687f('0x19')](0x1f4,_0x1620da['message']));});});};exports[_0x687f('0x25')]=function(_0x3fb16c){var _0x752836=this;return new Promise(function(_0x58851c,_0x51b4fa){return db['SmsQueue']['find']({'raw':_0x3fb16c[_0x687f('0x1d')]?_0x3fb16c['options']['raw']===undefined?!![]:![]:!![],'where':_0x3fb16c[_0x687f('0x1d')]?_0x3fb16c[_0x687f('0x1d')][_0x687f('0x26')]||null:null,'attributes':_0x3fb16c['options']?_0x3fb16c[_0x687f('0x1d')][_0x687f('0x1f')]||null:null,'include':_0x3fb16c[_0x687f('0x1d')]?_0x3fb16c[_0x687f('0x1d')][_0x687f('0x22')]?_[_0x687f('0x21')](_0x3fb16c['options'][_0x687f('0x22')],function(_0x5d1d76){return{'model':db[_0x5d1d76[_0x687f('0x23')]],'as':_0x5d1d76['as'],'attributes':_0x5d1d76[_0x687f('0x1f')],'include':_0x5d1d76[_0x687f('0x22')]?_[_0x687f('0x21')](_0x5d1d76[_0x687f('0x22')],function(_0x350f95){return{'model':db[_0x350f95[_0x687f('0x23')]],'as':_0x350f95['as'],'attributes':_0x350f95[_0x687f('0x1f')],'include':_0x350f95[_0x687f('0x22')]?_['map'](_0x350f95[_0x687f('0x22')],function(_0x5da661){return{'model':db[_0x5da661['model']],'as':_0x5da661['as'],'attributes':_0x5da661['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ace87){logger['info']('ShowSmsQueue',_0x3fb16c);logger['debug'](_0x687f('0x25'),_0x3fb16c,JSON['stringify'](_0x2ace87));_0x58851c(_0x2ace87);})[_0x687f('0x1c')](function(_0x4c0cda){logger[_0x687f('0x19')](_0x687f('0x25'),_0x4c0cda[_0x687f('0x1a')],_0x3fb16c);_0x51b4fa(_0x752836[_0x687f('0x19')](0x1f4,_0x4c0cda[_0x687f('0x1a')]));});});}; \ No newline at end of file +var _0x4f24=['limit','include','model','GetSmsQueue','ShowSmsQueue','find','map','util','moment','bluebird','randomstring','ioredis','jayson/promise','redis','localhost','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SmsQueue','options','raw','where','attributes'];(function(_0x358aaa,_0x5c240a){var _0x11c141=function(_0x40ccbb){while(--_0x40ccbb){_0x358aaa['push'](_0x358aaa['shift']());}};_0x11c141(++_0x5c240a);}(_0x4f24,0x172));var _0x44f2=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x4f24[_0x273c39];return _0x46d6b5;};'use strict';var _=require('lodash');var util=require(_0x44f2('0x0'));var moment=require(_0x44f2('0x1'));var BPromise=require(_0x44f2('0x2'));var rs=require(_0x44f2('0x3'));var fs=require('fs');var Redis=require(_0x44f2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x44f2('0x5'));var client=jayson['client']['http']({'port':0x232a});config[_0x44f2('0x6')]=_['defaults'](config[_0x44f2('0x6')],{'host':_0x44f2('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsQueue.socket')[_0x44f2('0x8')](socket);function respondWithRpcPromise(_0x24846a,_0x81f71a,_0x13546a){return new BPromise(function(_0x5ae43b,_0x1e7a32){return client[_0x44f2('0x9')](_0x24846a,_0x13546a)[_0x44f2('0xa')](function(_0x20b848){logger[_0x44f2('0xb')](_0x44f2('0xc'),_0x81f71a,_0x44f2('0xd'));logger[_0x44f2('0xe')](_0x44f2('0xf'),_0x81f71a,_0x44f2('0xd'),JSON[_0x44f2('0x10')](_0x20b848));if(_0x20b848[_0x44f2('0x11')]){if(_0x20b848[_0x44f2('0x11')]['code']===0x1f4){logger['error'](_0x44f2('0xc'),_0x81f71a,_0x20b848[_0x44f2('0x11')][_0x44f2('0x12')]);return _0x1e7a32(_0x20b848[_0x44f2('0x11')]['message']);}logger[_0x44f2('0x11')](_0x44f2('0xc'),_0x81f71a,_0x20b848[_0x44f2('0x11')][_0x44f2('0x12')]);return _0x5ae43b(_0x20b848['error']['message']);}else{logger['info'](_0x44f2('0xc'),_0x81f71a,'request\x20sent');_0x5ae43b(_0x20b848[_0x44f2('0x13')][_0x44f2('0x12')]);}})[_0x44f2('0x14')](function(_0x4af28d){logger[_0x44f2('0x11')](_0x44f2('0xc'),_0x81f71a,_0x4af28d);_0x1e7a32(_0x4af28d);});});}exports['GetSmsQueue']=function(_0x142a18){var _0xb4038=this;return new Promise(function(_0x1fd88d,_0x316458){return db[_0x44f2('0x15')]['findAll']({'raw':_0x142a18[_0x44f2('0x16')]?_0x142a18[_0x44f2('0x16')][_0x44f2('0x17')]===undefined?!![]:![]:!![],'where':_0x142a18['options']?_0x142a18['options'][_0x44f2('0x18')]||null:null,'attributes':_0x142a18[_0x44f2('0x16')]?_0x142a18[_0x44f2('0x16')][_0x44f2('0x19')]||null:null,'limit':_0x142a18['options']?_0x142a18[_0x44f2('0x16')][_0x44f2('0x1a')]||null:null,'include':_0x142a18[_0x44f2('0x16')]?_0x142a18[_0x44f2('0x16')][_0x44f2('0x1b')]?_['map'](_0x142a18[_0x44f2('0x16')][_0x44f2('0x1b')],function(_0xc3158){return{'model':db[_0xc3158[_0x44f2('0x1c')]],'as':_0xc3158['as'],'attributes':_0xc3158[_0x44f2('0x19')],'include':_0xc3158[_0x44f2('0x1b')]?_['map'](_0xc3158[_0x44f2('0x1b')],function(_0x488b5a){return{'model':db[_0x488b5a[_0x44f2('0x1c')]],'as':_0x488b5a['as'],'attributes':_0x488b5a['attributes'],'include':_0x488b5a['include']?_['map'](_0x488b5a[_0x44f2('0x1b')],function(_0x167f98){return{'model':db[_0x167f98[_0x44f2('0x1c')]],'as':_0x167f98['as'],'attributes':_0x167f98[_0x44f2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x44f2('0xa')](function(_0x98c7cd){logger[_0x44f2('0xb')](_0x44f2('0x1d'),_0x142a18);logger['debug']('GetSmsQueue',_0x142a18,JSON[_0x44f2('0x10')](_0x98c7cd));_0x1fd88d(_0x98c7cd);})[_0x44f2('0x14')](function(_0x126af7){logger[_0x44f2('0x11')](_0x44f2('0x1d'),_0x126af7[_0x44f2('0x12')],_0x142a18);_0x316458(_0xb4038['error'](0x1f4,_0x126af7[_0x44f2('0x12')]));});});};exports[_0x44f2('0x1e')]=function(_0xe4ebf2){var _0x1c45ee=this;return new Promise(function(_0x16228b,_0xf00f51){return db[_0x44f2('0x15')][_0x44f2('0x1f')]({'raw':_0xe4ebf2[_0x44f2('0x16')]?_0xe4ebf2[_0x44f2('0x16')][_0x44f2('0x17')]===undefined?!![]:![]:!![],'where':_0xe4ebf2[_0x44f2('0x16')]?_0xe4ebf2[_0x44f2('0x16')][_0x44f2('0x18')]||null:null,'attributes':_0xe4ebf2['options']?_0xe4ebf2[_0x44f2('0x16')][_0x44f2('0x19')]||null:null,'include':_0xe4ebf2[_0x44f2('0x16')]?_0xe4ebf2[_0x44f2('0x16')][_0x44f2('0x1b')]?_[_0x44f2('0x20')](_0xe4ebf2[_0x44f2('0x16')][_0x44f2('0x1b')],function(_0x31359d){return{'model':db[_0x31359d[_0x44f2('0x1c')]],'as':_0x31359d['as'],'attributes':_0x31359d[_0x44f2('0x19')],'include':_0x31359d[_0x44f2('0x1b')]?_['map'](_0x31359d[_0x44f2('0x1b')],function(_0x1d2f9b){return{'model':db[_0x1d2f9b['model']],'as':_0x1d2f9b['as'],'attributes':_0x1d2f9b[_0x44f2('0x19')],'include':_0x1d2f9b['include']?_['map'](_0x1d2f9b[_0x44f2('0x1b')],function(_0x5d2b4b){return{'model':db[_0x5d2b4b[_0x44f2('0x1c')]],'as':_0x5d2b4b['as'],'attributes':_0x5d2b4b[_0x44f2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x44f2('0xa')](function(_0xcbaa76){logger['info'](_0x44f2('0x1e'),_0xe4ebf2);logger[_0x44f2('0xe')]('ShowSmsQueue',_0xe4ebf2,JSON[_0x44f2('0x10')](_0xcbaa76));_0x16228b(_0xcbaa76);})['catch'](function(_0x1738f3){logger['error'](_0x44f2('0x1e'),_0x1738f3[_0x44f2('0x12')],_0xe4ebf2);_0xf00f51(_0x1c45ee[_0x44f2('0x11')](0x1f4,_0x1738f3[_0x44f2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index ab86107..44d985d 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 _0x128b=['./smsQueue.events','emit','register','smsQueue:'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x128b,0xbc));var _0xb128=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x128b[_0x17d9e3];return _0x14192d;};'use strict';var SmsQueueEvents=require(_0xb128('0x0'));var events=['save','remove','update'];function createListener(_0x50e67b,_0x151442){return function(_0x33505d){_0x151442[_0xb128('0x1')](_0x50e67b,_0x33505d);};}function removeListener(_0x4bf984,_0x5e64ae){return function(){SmsQueueEvents['removeListener'](_0x4bf984,_0x5e64ae);};}exports[_0xb128('0x2')]=function(_0x24da22){for(var _0x2d23a=0x0,_0x260012=events['length'];_0x2d23a<_0x260012;_0x2d23a++){var _0x5847bb=events[_0x2d23a];var _0x4d3832=createListener(_0xb128('0x3')+_0x5847bb,_0x24da22);SmsQueueEvents['on'](_0x5847bb,_0x4d3832);}}; \ No newline at end of file +var _0xaa13=['remove','emit','register','length','./smsQueue.events'];(function(_0x10f088,_0x3fb86d){var _0x32fca5=function(_0x1964bc){while(--_0x1964bc){_0x10f088['push'](_0x10f088['shift']());}};_0x32fca5(++_0x3fb86d);}(_0xaa13,0x11c));var _0x3aa1=function(_0x376038,_0x366412){_0x376038=_0x376038-0x0;var _0x292fbb=_0xaa13[_0x376038];return _0x292fbb;};'use strict';var SmsQueueEvents=require(_0x3aa1('0x0'));var events=['save',_0x3aa1('0x1'),'update'];function createListener(_0x5396e9,_0x4c2299){return function(_0x1a23dd){_0x4c2299[_0x3aa1('0x2')](_0x5396e9,_0x1a23dd);};}function removeListener(_0x2ad148,_0x2102d9){return function(){SmsQueueEvents['removeListener'](_0x2ad148,_0x2102d9);};}exports[_0x3aa1('0x3')]=function(_0x8c90f0){for(var _0x493519=0x0,_0x2c98ec=events[_0x3aa1('0x4')];_0x493519<_0x2c98ec;_0x493519++){var _0x123e5d=events[_0x493519];var _0x2ba87d=createListener('smsQueue:'+_0x123e5d,_0x8c90f0);SmsQueueEvents['on'](_0x123e5d,_0x2ba87d);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index b354d1c..79cbf2b 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 _0xb9a0=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','multer','util','path','connect-timeout'];(function(_0x36ff8f,_0x232e19){var _0x317b04=function(_0x4c5ab8){while(--_0x4c5ab8){_0x36ff8f['push'](_0x36ff8f['shift']());}};_0x317b04(++_0x232e19);}(_0xb9a0,0x146));var _0x0b9a=function(_0x32f530,_0x312fe0){_0x32f530=_0x32f530-0x0;var _0x2a570f=_0xb9a0[_0x32f530];return _0x2a570f;};'use strict';var multer=require(_0x0b9a('0x0'));var util=require(_0x0b9a('0x1'));var path=require(_0x0b9a('0x2'));var timeout=require(_0x0b9a('0x3'));var express=require(_0x0b9a('0x4'));var router=express[_0x0b9a('0x5')]();var fs_extra=require(_0x0b9a('0x6'));var auth=require(_0x0b9a('0x7'));var interaction=require(_0x0b9a('0x8'));var config=require(_0x0b9a('0x9'));var controller=require(_0x0b9a('0xa'));router[_0x0b9a('0xb')]('/',auth[_0x0b9a('0xc')](),controller[_0x0b9a('0xd')]);router[_0x0b9a('0xb')](_0x0b9a('0xe'),auth[_0x0b9a('0xc')](),controller[_0x0b9a('0xf')]);router['get'](_0x0b9a('0x10'),auth[_0x0b9a('0xc')](),controller[_0x0b9a('0x11')]);router['post']('/',auth[_0x0b9a('0xc')](),controller[_0x0b9a('0x12')]);router[_0x0b9a('0x13')](_0x0b9a('0x10'),auth[_0x0b9a('0xc')](),controller[_0x0b9a('0x14')]);router['delete'](_0x0b9a('0x10'),auth[_0x0b9a('0xc')](),controller[_0x0b9a('0x15')]);module['exports']=router; \ No newline at end of file +var _0x6aed=['connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','destroy','exports','util','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6aed,0x10c));var _0xd6ae=function(_0x205202,_0x7cb8a3){_0x205202=_0x205202-0x0;var _0x3369e6=_0x6aed[_0x205202];return _0x3369e6;};'use strict';var multer=require('multer');var util=require(_0xd6ae('0x0'));var path=require(_0xd6ae('0x1'));var timeout=require(_0xd6ae('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd6ae('0x3'));var auth=require(_0xd6ae('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd6ae('0x5'));var controller=require('./smsQueueReport.controller');router[_0xd6ae('0x6')]('/',auth[_0xd6ae('0x7')](),controller[_0xd6ae('0x8')]);router[_0xd6ae('0x6')](_0xd6ae('0x9'),auth[_0xd6ae('0x7')](),controller[_0xd6ae('0xa')]);router['get'](_0xd6ae('0xb'),auth[_0xd6ae('0x7')](),controller[_0xd6ae('0xc')]);router[_0xd6ae('0xd')]('/',auth[_0xd6ae('0x7')](),controller['create']);router[_0xd6ae('0xe')]('/:id',auth[_0xd6ae('0x7')](),controller[_0xd6ae('0xf')]);router['delete'](_0xd6ae('0xb'),auth[_0xd6ae('0x7')](),controller[_0xd6ae('0x10')]);module[_0xd6ae('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index fab6e6a..e610f8f 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 _0xc1bc=['sequelize','STRING','DATE','moment'];(function(_0x49e4ae,_0x176399){var _0x2a9fc6=function(_0xf6a730){while(--_0xf6a730){_0x49e4ae['push'](_0x49e4ae['shift']());}};_0x2a9fc6(++_0x176399);}(_0xc1bc,0x173));var _0xcc1b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc1bc[_0xa464c9];return _0x3d73c4;};'use strict';var moment=require(_0xcc1b('0x0'));var Sequelize=require(_0xcc1b('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xcc1b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xcc1b('0x2')]},'joinAt':{'type':Sequelize[_0xcc1b('0x3')]},'leaveAt':{'type':Sequelize[_0xcc1b('0x3')]},'acceptAt':{'type':Sequelize[_0xcc1b('0x3')]},'exitAt':{'type':Sequelize[_0xcc1b('0x3')]},'reason':{'type':Sequelize[_0xcc1b('0x2')]}}; \ No newline at end of file +var _0x2918=['DATE','sequelize','exports','STRING'];(function(_0x24783a,_0x75041){var _0x227a77=function(_0x2b736d){while(--_0x2b736d){_0x24783a['push'](_0x24783a['shift']());}};_0x227a77(++_0x75041);}(_0x2918,0x1d9));var _0x8291=function(_0x2cb38d,_0x12d690){_0x2cb38d=_0x2cb38d-0x0;var _0xbeefe0=_0x2918[_0x2cb38d];return _0xbeefe0;};'use strict';var moment=require('moment');var Sequelize=require(_0x8291('0x0'));module[_0x8291('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8291('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x8291('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8291('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index a707a00..2ec136d 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 _0x9f69=['end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SmsQueueReport','includeAll','findAll','rows','catch','params','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x2c4a9c,_0x2649c9){var _0x3effe1=function(_0x13ef22){while(--_0x13ef22){_0x2c4a9c['push'](_0x2c4a9c['shift']());}};_0x3effe1(++_0x2649c9);}(_0x9f69,0x119));var _0x99f6=function(_0x4dbcd7,_0x36b306){_0x4dbcd7=_0x4dbcd7-0x0;var _0x2bbbb6=_0x9f69[_0x4dbcd7];return _0x2bbbb6;};'use strict';var emlformat=require(_0x99f6('0x0'));var rimraf=require(_0x99f6('0x1'));var zipdir=require(_0x99f6('0x2'));var jsonpatch=require(_0x99f6('0x3'));var rp=require(_0x99f6('0x4'));var moment=require(_0x99f6('0x5'));var BPromise=require(_0x99f6('0x6'));var Mustache=require(_0x99f6('0x7'));var util=require(_0x99f6('0x8'));var path=require(_0x99f6('0x9'));var sox=require('sox');var csv=require(_0x99f6('0xa'));var ejs=require(_0x99f6('0xb'));var fs=require('fs');var fs_extra=require(_0x99f6('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x99f6('0xd'));var jsforce=require(_0x99f6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x99f6('0xa'));var querystring=require(_0x99f6('0xf'));var Papa=require(_0x99f6('0x10'));var Redis=require(_0x99f6('0x11'));var authService=require(_0x99f6('0x12'));var qs=require(_0x99f6('0x13'));var as=require(_0x99f6('0x14'));var hardwareService=require(_0x99f6('0x15'));var logger=require(_0x99f6('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x99f6('0x17'));var licenseUtil=require(_0x99f6('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30a17a,_0x35fd1c){_0x35fd1c=_0x35fd1c||0xcc;return function(_0x194437){if(_0x194437){return _0x30a17a[_0x99f6('0x19')](_0x35fd1c);}return _0x30a17a[_0x99f6('0x1a')](_0x35fd1c)[_0x99f6('0x1b')]();};}function respondWithResult(_0x39ff12,_0x4ede5e){_0x4ede5e=_0x4ede5e||0xc8;return function(_0x4801a9){if(_0x4801a9){return _0x39ff12[_0x99f6('0x1a')](_0x4ede5e)[_0x99f6('0x1c')](_0x4801a9);}};}function respondWithFilteredResult(_0xbae01c,_0xf52c32){return function(_0x54f05){if(_0x54f05){var _0x1a9571=typeof _0xf52c32['offset']===_0x99f6('0x1d')&&typeof _0xf52c32[_0x99f6('0x1e')]===_0x99f6('0x1d');var _0x55039f=_0x54f05[_0x99f6('0x1f')];var _0x147375=_0x1a9571?0x0:_0xf52c32[_0x99f6('0x20')];var _0x2e18fb=_0x1a9571?_0x54f05[_0x99f6('0x1f')]:_0xf52c32[_0x99f6('0x20')]+_0xf52c32[_0x99f6('0x1e')];var _0x3bdd41;if(_0x2e18fb>=_0x55039f){_0x2e18fb=_0x55039f;_0x3bdd41=0xc8;}else{_0x3bdd41=0xce;}_0xbae01c['status'](_0x3bdd41);return _0xbae01c['set'](_0x99f6('0x21'),_0x147375+'-'+_0x2e18fb+'/'+_0x55039f)[_0x99f6('0x1c')](_0x54f05);}return null;};}function patchUpdates(_0x515b4c){return function(_0x3ddc4d){try{jsonpatch[_0x99f6('0x22')](_0x3ddc4d,_0x515b4c,!![]);}catch(_0x1aac9a){return BPromise[_0x99f6('0x23')](_0x1aac9a);}return _0x3ddc4d[_0x99f6('0x24')]();};}function saveUpdates(_0x15802f,_0x28551a){return function(_0xb14eee){if(_0xb14eee){return _0xb14eee['update'](_0x15802f)[_0x99f6('0x25')](function(_0x2436b4){return _0x2436b4;});}return null;};}function removeEntity(_0xaa85e3,_0x3788e0){return function(_0x4b297e){if(_0x4b297e){return _0x4b297e[_0x99f6('0x26')]()[_0x99f6('0x25')](function(){_0xaa85e3['status'](0xcc)[_0x99f6('0x1b')]();});}};}function handleEntityNotFound(_0x3921af,_0x43ddd0){return function(_0x5e9a9a){if(!_0x5e9a9a){_0x3921af[_0x99f6('0x19')](0x194);}return _0x5e9a9a;};}function handleError(_0x4d2d31,_0x4fc57b){_0x4fc57b=_0x4fc57b||0x1f4;return function(_0x2e561d){logger['error'](_0x2e561d[_0x99f6('0x27')]);if(_0x2e561d[_0x99f6('0x28')]){delete _0x2e561d[_0x99f6('0x28')];}_0x4d2d31[_0x99f6('0x1a')](_0x4fc57b)[_0x99f6('0x29')](_0x2e561d);};}exports[_0x99f6('0x2a')]=function(_0x419b41,_0x3cde9e){var _0x58c034={},_0x4b5093={},_0x124136={'count':0x0,'rows':[]};var _0x37ed8b=_[_0x99f6('0x2b')](db['SmsQueueReport']['rawAttributes'],function(_0x433c00){return{'name':_0x433c00[_0x99f6('0x2c')],'type':_0x433c00[_0x99f6('0x2d')][_0x99f6('0x2e')]};});_0x4b5093[_0x99f6('0x2f')]=_[_0x99f6('0x2b')](_0x37ed8b,_0x99f6('0x28'));_0x4b5093[_0x99f6('0x30')]=_[_0x99f6('0x31')](_0x419b41[_0x99f6('0x30')]);_0x4b5093[_0x99f6('0x32')]=_[_0x99f6('0x33')](_0x4b5093['model'],_0x4b5093[_0x99f6('0x30')]);_0x58c034['attributes']=_['intersection'](_0x4b5093[_0x99f6('0x2f')],qs[_0x99f6('0x34')](_0x419b41[_0x99f6('0x30')][_0x99f6('0x34')]));_0x58c034[_0x99f6('0x35')]=_0x58c034[_0x99f6('0x35')][_0x99f6('0x36')]?_0x58c034['attributes']:_0x4b5093[_0x99f6('0x2f')];if(!_0x419b41[_0x99f6('0x30')][_0x99f6('0x37')](_0x99f6('0x38'))){_0x58c034[_0x99f6('0x1e')]=qs[_0x99f6('0x1e')](_0x419b41['query'][_0x99f6('0x1e')]);_0x58c034['offset']=qs[_0x99f6('0x20')](_0x419b41['query'][_0x99f6('0x20')]);}_0x58c034[_0x99f6('0x39')]=qs[_0x99f6('0x3a')](_0x419b41[_0x99f6('0x30')][_0x99f6('0x3a')]);_0x58c034[_0x99f6('0x3b')]=qs[_0x99f6('0x32')](_[_0x99f6('0x3c')](_0x419b41[_0x99f6('0x30')],_0x4b5093[_0x99f6('0x32')]),_0x37ed8b);if(_0x419b41['query'][_0x99f6('0x3d')]){_0x58c034[_0x99f6('0x3b')]=_[_0x99f6('0x3e')](_0x58c034[_0x99f6('0x3b')],{'$or':_[_0x99f6('0x2b')](_0x37ed8b,function(_0x5e89b5){if(_0x5e89b5[_0x99f6('0x2d')]!==_0x99f6('0x3f')){var _0x548aff={};_0x548aff[_0x5e89b5[_0x99f6('0x28')]]={'$like':'%'+_0x419b41[_0x99f6('0x30')][_0x99f6('0x3d')]+'%'};return _0x548aff;}})});}_0x58c034=_[_0x99f6('0x3e')]({},_0x58c034,_0x419b41[_0x99f6('0x40')]);var _0x5982e5={'where':_0x58c034[_0x99f6('0x3b')]};return db[_0x99f6('0x41')]['count'](_0x5982e5)[_0x99f6('0x25')](function(_0x263f34){_0x124136['count']=_0x263f34;if(_0x419b41[_0x99f6('0x30')][_0x99f6('0x42')]){_0x58c034['include']=[{'all':!![]}];}return db[_0x99f6('0x41')][_0x99f6('0x43')](_0x58c034);})['then'](function(_0x36b62e){_0x124136[_0x99f6('0x44')]=_0x36b62e;return _0x124136;})[_0x99f6('0x25')](respondWithFilteredResult(_0x3cde9e,_0x58c034))[_0x99f6('0x45')](handleError(_0x3cde9e,null));};exports['show']=function(_0x401c5b,_0x1d5bef){var _0x413756={'raw':!![],'where':{'id':_0x401c5b[_0x99f6('0x46')]['id']}},_0x375a37={};_0x375a37[_0x99f6('0x2f')]=_[_0x99f6('0x31')](db[_0x99f6('0x41')]['rawAttributes']);_0x375a37['query']=_[_0x99f6('0x31')](_0x401c5b[_0x99f6('0x30')]);_0x375a37[_0x99f6('0x32')]=_['intersection'](_0x375a37[_0x99f6('0x2f')],_0x375a37[_0x99f6('0x30')]);_0x413756['attributes']=_['intersection'](_0x375a37[_0x99f6('0x2f')],qs[_0x99f6('0x34')](_0x401c5b[_0x99f6('0x30')][_0x99f6('0x34')]));_0x413756[_0x99f6('0x35')]=_0x413756[_0x99f6('0x35')]['length']?_0x413756[_0x99f6('0x35')]:_0x375a37['model'];if(_0x401c5b[_0x99f6('0x30')]['includeAll']){_0x413756[_0x99f6('0x47')]=[{'all':!![]}];}_0x413756=_[_0x99f6('0x3e')]({},_0x413756,_0x401c5b[_0x99f6('0x40')]);return db[_0x99f6('0x41')][_0x99f6('0x48')](_0x413756)['then'](handleEntityNotFound(_0x1d5bef,null))['then'](respondWithResult(_0x1d5bef,null))[_0x99f6('0x45')](handleError(_0x1d5bef,null));};exports[_0x99f6('0x49')]=function(_0x2fbc0c,_0x5b6e7b){return db[_0x99f6('0x41')]['create'](_0x2fbc0c[_0x99f6('0x4a')],{})[_0x99f6('0x25')](respondWithResult(_0x5b6e7b,0xc9))[_0x99f6('0x45')](handleError(_0x5b6e7b,null));};exports[_0x99f6('0x4b')]=function(_0x4a97b2,_0x3a27fa){if(_0x4a97b2['body']['id']){delete _0x4a97b2['body']['id'];}return db['SmsQueueReport'][_0x99f6('0x48')]({'where':{'id':_0x4a97b2[_0x99f6('0x46')]['id']}})[_0x99f6('0x25')](handleEntityNotFound(_0x3a27fa,null))['then'](saveUpdates(_0x4a97b2[_0x99f6('0x4a')],null))[_0x99f6('0x25')](respondWithResult(_0x3a27fa,null))[_0x99f6('0x45')](handleError(_0x3a27fa,null));};exports[_0x99f6('0x26')]=function(_0x56f15d,_0x199faf){return db[_0x99f6('0x41')][_0x99f6('0x48')]({'where':{'id':_0x56f15d[_0x99f6('0x46')]['id']}})[_0x99f6('0x25')](handleEntityNotFound(_0x199faf,null))[_0x99f6('0x25')](removeEntity(_0x199faf,null))[_0x99f6('0x45')](handleError(_0x199faf,null));};exports[_0x99f6('0x4c')]=function(_0x238ef7,_0x474d08){return db[_0x99f6('0x41')][_0x99f6('0x4c')]()[_0x99f6('0x25')](respondWithResult(_0x474d08,null))[_0x99f6('0x45')](handleError(_0x474d08,null));}; \ No newline at end of file +var _0xa362=['save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','SmsQueueReport','fields','create','body','update','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x475aa9,_0x439aab){var _0x360bbc=function(_0x331a22){while(--_0x331a22){_0x475aa9['push'](_0x475aa9['shift']());}};_0x360bbc(++_0x439aab);}(_0xa362,0x16b));var _0x2a36=function(_0x1351a1,_0x2ee658){_0x1351a1=_0x1351a1-0x0;var _0x2ce6cb=_0xa362[_0x1351a1];return _0x2ce6cb;};'use strict';var emlformat=require(_0x2a36('0x0'));var rimraf=require(_0x2a36('0x1'));var zipdir=require(_0x2a36('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2a36('0x3'));var moment=require(_0x2a36('0x4'));var BPromise=require(_0x2a36('0x5'));var Mustache=require('mustache');var util=require(_0x2a36('0x6'));var path=require(_0x2a36('0x7'));var sox=require('sox');var csv=require(_0x2a36('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2a36('0x9'));var _=require(_0x2a36('0xa'));var squel=require(_0x2a36('0xb'));var crypto=require(_0x2a36('0xc'));var jsforce=require(_0x2a36('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2a36('0x8'));var querystring=require(_0x2a36('0xe'));var Papa=require(_0x2a36('0xf'));var Redis=require(_0x2a36('0x10'));var authService=require(_0x2a36('0x11'));var qs=require(_0x2a36('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a36('0x13'));var logger=require(_0x2a36('0x14'))(_0x2a36('0x15'));var utils=require(_0x2a36('0x16'));var config=require(_0x2a36('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a36('0x18'))['db'];function respondWithStatusCode(_0xd62784,_0x21e98d){_0x21e98d=_0x21e98d||0xcc;return function(_0x8f5dcc){if(_0x8f5dcc){return _0xd62784[_0x2a36('0x19')](_0x21e98d);}return _0xd62784[_0x2a36('0x1a')](_0x21e98d)[_0x2a36('0x1b')]();};}function respondWithResult(_0x53776c,_0x34954c){_0x34954c=_0x34954c||0xc8;return function(_0x5ba775){if(_0x5ba775){return _0x53776c[_0x2a36('0x1a')](_0x34954c)[_0x2a36('0x1c')](_0x5ba775);}};}function respondWithFilteredResult(_0x6c3e73,_0x11c805){return function(_0x42b60c){if(_0x42b60c){var _0x330e5c=typeof _0x11c805[_0x2a36('0x1d')]===_0x2a36('0x1e')&&typeof _0x11c805[_0x2a36('0x1f')]===_0x2a36('0x1e');var _0x288e39=_0x42b60c[_0x2a36('0x20')];var _0x1ffd57=_0x330e5c?0x0:_0x11c805['offset'];var _0x4a3803=_0x330e5c?_0x42b60c['count']:_0x11c805[_0x2a36('0x1d')]+_0x11c805[_0x2a36('0x1f')];var _0x27d087;if(_0x4a3803>=_0x288e39){_0x4a3803=_0x288e39;_0x27d087=0xc8;}else{_0x27d087=0xce;}_0x6c3e73[_0x2a36('0x1a')](_0x27d087);return _0x6c3e73[_0x2a36('0x21')](_0x2a36('0x22'),_0x1ffd57+'-'+_0x4a3803+'/'+_0x288e39)[_0x2a36('0x1c')](_0x42b60c);}return null;};}function patchUpdates(_0x4dedfd){return function(_0x4efc58){try{jsonpatch[_0x2a36('0x23')](_0x4efc58,_0x4dedfd,!![]);}catch(_0x556f4d){return BPromise[_0x2a36('0x24')](_0x556f4d);}return _0x4efc58[_0x2a36('0x25')]();};}function saveUpdates(_0x8bc6a5,_0x2b1141){return function(_0x1db341){if(_0x1db341){return _0x1db341['update'](_0x8bc6a5)[_0x2a36('0x26')](function(_0x3e5f66){return _0x3e5f66;});}return null;};}function removeEntity(_0x393d27,_0x2fb2e0){return function(_0xc60a89){if(_0xc60a89){return _0xc60a89[_0x2a36('0x27')]()[_0x2a36('0x26')](function(){_0x393d27[_0x2a36('0x1a')](0xcc)[_0x2a36('0x1b')]();});}};}function handleEntityNotFound(_0x522460,_0x5e019d){return function(_0x1e1555){if(!_0x1e1555){_0x522460[_0x2a36('0x19')](0x194);}return _0x1e1555;};}function handleError(_0x307cdd,_0x4d220b){_0x4d220b=_0x4d220b||0x1f4;return function(_0x17cd69){logger[_0x2a36('0x28')](_0x17cd69[_0x2a36('0x29')]);if(_0x17cd69[_0x2a36('0x2a')]){delete _0x17cd69[_0x2a36('0x2a')];}_0x307cdd[_0x2a36('0x1a')](_0x4d220b)[_0x2a36('0x2b')](_0x17cd69);};}exports[_0x2a36('0x2c')]=function(_0x346295,_0x2ea0d7){var _0x440fd5={},_0x132701={},_0x349854={'count':0x0,'rows':[]};var _0x1c40e9=_[_0x2a36('0x2d')](db['SmsQueueReport'][_0x2a36('0x2e')],function(_0x4fad15){return{'name':_0x4fad15[_0x2a36('0x2f')],'type':_0x4fad15['type'][_0x2a36('0x30')]};});_0x132701[_0x2a36('0x31')]=_[_0x2a36('0x2d')](_0x1c40e9,_0x2a36('0x2a'));_0x132701[_0x2a36('0x32')]=_['keys'](_0x346295[_0x2a36('0x32')]);_0x132701[_0x2a36('0x33')]=_[_0x2a36('0x34')](_0x132701[_0x2a36('0x31')],_0x132701[_0x2a36('0x32')]);_0x440fd5[_0x2a36('0x35')]=_[_0x2a36('0x34')](_0x132701[_0x2a36('0x31')],qs['fields'](_0x346295['query']['fields']));_0x440fd5['attributes']=_0x440fd5['attributes'][_0x2a36('0x36')]?_0x440fd5[_0x2a36('0x35')]:_0x132701[_0x2a36('0x31')];if(!_0x346295[_0x2a36('0x32')]['hasOwnProperty'](_0x2a36('0x37'))){_0x440fd5[_0x2a36('0x1f')]=qs['limit'](_0x346295[_0x2a36('0x32')]['limit']);_0x440fd5['offset']=qs['offset'](_0x346295['query'][_0x2a36('0x1d')]);}_0x440fd5[_0x2a36('0x38')]=qs[_0x2a36('0x39')](_0x346295['query'][_0x2a36('0x39')]);_0x440fd5[_0x2a36('0x3a')]=qs[_0x2a36('0x33')](_[_0x2a36('0x3b')](_0x346295[_0x2a36('0x32')],_0x132701[_0x2a36('0x33')]),_0x1c40e9);if(_0x346295[_0x2a36('0x32')][_0x2a36('0x3c')]){_0x440fd5[_0x2a36('0x3a')]=_[_0x2a36('0x3d')](_0x440fd5['where'],{'$or':_[_0x2a36('0x2d')](_0x1c40e9,function(_0x4d9c49){if(_0x4d9c49[_0x2a36('0x3e')]!==_0x2a36('0x3f')){var _0x544ee4={};_0x544ee4[_0x4d9c49[_0x2a36('0x2a')]]={'$like':'%'+_0x346295[_0x2a36('0x32')][_0x2a36('0x3c')]+'%'};return _0x544ee4;}})});}_0x440fd5=_[_0x2a36('0x3d')]({},_0x440fd5,_0x346295[_0x2a36('0x40')]);var _0x26633c={'where':_0x440fd5[_0x2a36('0x3a')]};return db['SmsQueueReport'][_0x2a36('0x20')](_0x26633c)[_0x2a36('0x26')](function(_0x2e3852){_0x349854[_0x2a36('0x20')]=_0x2e3852;if(_0x346295[_0x2a36('0x32')][_0x2a36('0x41')]){_0x440fd5[_0x2a36('0x42')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x2a36('0x43')](_0x440fd5);})[_0x2a36('0x26')](function(_0x58c9a7){_0x349854[_0x2a36('0x44')]=_0x58c9a7;return _0x349854;})[_0x2a36('0x26')](respondWithFilteredResult(_0x2ea0d7,_0x440fd5))[_0x2a36('0x45')](handleError(_0x2ea0d7,null));};exports[_0x2a36('0x46')]=function(_0xc198c6,_0x59831b){var _0x44e4a9={'raw':!![],'where':{'id':_0xc198c6[_0x2a36('0x47')]['id']}},_0x32f1e7={};_0x32f1e7[_0x2a36('0x31')]=_[_0x2a36('0x48')](db[_0x2a36('0x49')][_0x2a36('0x2e')]);_0x32f1e7[_0x2a36('0x32')]=_[_0x2a36('0x48')](_0xc198c6[_0x2a36('0x32')]);_0x32f1e7[_0x2a36('0x33')]=_[_0x2a36('0x34')](_0x32f1e7[_0x2a36('0x31')],_0x32f1e7['query']);_0x44e4a9['attributes']=_[_0x2a36('0x34')](_0x32f1e7[_0x2a36('0x31')],qs['fields'](_0xc198c6[_0x2a36('0x32')][_0x2a36('0x4a')]));_0x44e4a9[_0x2a36('0x35')]=_0x44e4a9['attributes'][_0x2a36('0x36')]?_0x44e4a9['attributes']:_0x32f1e7['model'];if(_0xc198c6[_0x2a36('0x32')]['includeAll']){_0x44e4a9[_0x2a36('0x42')]=[{'all':!![]}];}_0x44e4a9=_['merge']({},_0x44e4a9,_0xc198c6[_0x2a36('0x40')]);return db[_0x2a36('0x49')]['find'](_0x44e4a9)[_0x2a36('0x26')](handleEntityNotFound(_0x59831b,null))[_0x2a36('0x26')](respondWithResult(_0x59831b,null))[_0x2a36('0x45')](handleError(_0x59831b,null));};exports[_0x2a36('0x4b')]=function(_0x10fd50,_0x3be03d){return db[_0x2a36('0x49')][_0x2a36('0x4b')](_0x10fd50[_0x2a36('0x4c')],{})[_0x2a36('0x26')](respondWithResult(_0x3be03d,0xc9))[_0x2a36('0x45')](handleError(_0x3be03d,null));};exports[_0x2a36('0x4d')]=function(_0x18bb1a,_0x1243ee){if(_0x18bb1a[_0x2a36('0x4c')]['id']){delete _0x18bb1a[_0x2a36('0x4c')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x18bb1a[_0x2a36('0x47')]['id']}})[_0x2a36('0x26')](handleEntityNotFound(_0x1243ee,null))[_0x2a36('0x26')](saveUpdates(_0x18bb1a[_0x2a36('0x4c')],null))[_0x2a36('0x26')](respondWithResult(_0x1243ee,null))[_0x2a36('0x45')](handleError(_0x1243ee,null));};exports['destroy']=function(_0x3ddcdf,_0x264daa){return db[_0x2a36('0x49')][_0x2a36('0x4e')]({'where':{'id':_0x3ddcdf[_0x2a36('0x47')]['id']}})[_0x2a36('0x26')](handleEntityNotFound(_0x264daa,null))[_0x2a36('0x26')](removeEntity(_0x264daa,null))[_0x2a36('0x45')](handleError(_0x264daa,null));};exports[_0x2a36('0x4f')]=function(_0xa004f4,_0x4e6235){return db['SmsQueueReport'][_0x2a36('0x4f')]()[_0x2a36('0x26')](respondWithResult(_0x4e6235,null))[_0x2a36('0x45')](handleError(_0x4e6235,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index be39b2e..1681db3 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(_0x396c4c,_0x2776a6){var _0x308ea7=function(_0x16a88d){while(--_0x16a88d){_0x396c4c['push'](_0x396c4c['shift']());}};_0x308ea7(++_0x2776a6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'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(_0x297eb0,_0x5b1ffc){var _0x134ca6=function(_0x4b8645){while(--_0x4b8645){_0x297eb0['push'](_0x297eb0['shift']());}};_0x134ca6(++_0x5b1ffc);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./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 5b7a272..d5757ee 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 _0x2bab=['update','where','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','SmsQueueReport'];(function(_0x39fe14,_0x26d7bc){var _0x4b8c09=function(_0x30028b){while(--_0x30028b){_0x39fe14['push'](_0x39fe14['shift']());}};_0x4b8c09(++_0x26d7bc);}(_0x2bab,0xc3));var _0xb2ba=function(_0x561894,_0x3be713){_0x561894=_0x561894-0x0;var _0x95fa63=_0x2bab[_0x561894];return _0x95fa63;};'use strict';var _=require(_0xb2ba('0x0'));var util=require(_0xb2ba('0x1'));var moment=require(_0xb2ba('0x2'));var BPromise=require(_0xb2ba('0x3'));var rs=require(_0xb2ba('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2ba('0x5'))['db'];var utils=require(_0xb2ba('0x6'));var logger=require('../../config/logger')(_0xb2ba('0x7'));var config=require(_0xb2ba('0x8'));var jayson=require(_0xb2ba('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xf19a07,_0x52cf8f,_0x103631){return new BPromise(function(_0x53e330,_0x4d85de){return client['request'](_0xf19a07,_0x103631)[_0xb2ba('0xa')](function(_0x12f9b5){logger[_0xb2ba('0xb')](_0xb2ba('0xc'),_0x52cf8f,'request\x20sent');logger[_0xb2ba('0xd')](_0xb2ba('0xe'),_0x52cf8f,_0xb2ba('0xf'),JSON[_0xb2ba('0x10')](_0x12f9b5));if(_0x12f9b5[_0xb2ba('0x11')]){if(_0x12f9b5[_0xb2ba('0x11')][_0xb2ba('0x12')]===0x1f4){logger['error'](_0xb2ba('0xc'),_0x52cf8f,_0x12f9b5[_0xb2ba('0x11')][_0xb2ba('0x13')]);return _0x4d85de(_0x12f9b5['error'][_0xb2ba('0x13')]);}logger[_0xb2ba('0x11')](_0xb2ba('0xc'),_0x52cf8f,_0x12f9b5[_0xb2ba('0x11')]['message']);return _0x53e330(_0x12f9b5[_0xb2ba('0x11')]['message']);}else{logger['info'](_0xb2ba('0xc'),_0x52cf8f,_0xb2ba('0xf'));_0x53e330(_0x12f9b5[_0xb2ba('0x14')][_0xb2ba('0x13')]);}})[_0xb2ba('0x15')](function(_0x373700){logger[_0xb2ba('0x11')](_0xb2ba('0xc'),_0x52cf8f,_0x373700);_0x4d85de(_0x373700);});});}exports[_0xb2ba('0x16')]=function(_0x1bfe7f){var _0x83952f=this;return new Promise(function(_0x66ae79,_0x1fb12e){return db['SmsQueueReport'][_0xb2ba('0x17')](_0x1bfe7f[_0xb2ba('0x18')],{'raw':_0x1bfe7f['options']?_0x1bfe7f[_0xb2ba('0x19')][_0xb2ba('0x1a')]===undefined?!![]:![]:!![]})[_0xb2ba('0xa')](function(_0x725623){logger['info']('CreateSmsQueueReport',_0x1bfe7f);logger[_0xb2ba('0xd')]('CreateSmsQueueReport',_0x1bfe7f,JSON[_0xb2ba('0x10')](_0x725623));_0x66ae79(_0x725623);})[_0xb2ba('0x15')](function(_0x3d4bd5){logger[_0xb2ba('0x11')](_0xb2ba('0x16'),_0x3d4bd5[_0xb2ba('0x13')],_0x1bfe7f);_0x1fb12e(_0x83952f['error'](0x1f4,_0x3d4bd5['message']));});});};exports[_0xb2ba('0x1b')]=function(_0x42d929){var _0x368bec=this;return new Promise(function(_0x459083,_0x2afd33){return db[_0xb2ba('0x1c')][_0xb2ba('0x1d')](_0x42d929[_0xb2ba('0x18')],{'raw':_0x42d929[_0xb2ba('0x19')]?_0x42d929[_0xb2ba('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42d929['options']?_0x42d929[_0xb2ba('0x19')][_0xb2ba('0x1e')]||null:null,'attributes':_0x42d929[_0xb2ba('0x19')]?_0x42d929['options']['attributes']||null:null,'limit':_0x42d929[_0xb2ba('0x19')]?_0x42d929[_0xb2ba('0x19')][_0xb2ba('0x1f')]||null:null})['then'](function(_0x17e90e){logger[_0xb2ba('0xb')](_0xb2ba('0x1b'),_0x42d929);logger['debug'](_0xb2ba('0x1b'),_0x42d929,JSON['stringify'](_0x17e90e));_0x459083(_0x17e90e);})[_0xb2ba('0x15')](function(_0x3821c3){logger[_0xb2ba('0x11')](_0xb2ba('0x1b'),_0x3821c3[_0xb2ba('0x13')],_0x42d929);_0x2afd33(_0x368bec[_0xb2ba('0x11')](0x1f4,_0x3821c3['message']));});});}; \ No newline at end of file +var _0xf90c=['message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','stringify','UpdateSmsQueueReport','update','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x5729a1,_0x4b9da7){var _0x25824b=function(_0x4dda9f){while(--_0x4dda9f){_0x5729a1['push'](_0x5729a1['shift']());}};_0x25824b(++_0x4b9da7);}(_0xf90c,0x16e));var _0xcf90=function(_0x11a134,_0x597273){_0x11a134=_0x11a134-0x0;var _0x3c5ebb=_0xf90c[_0x11a134];return _0x3c5ebb;};'use strict';var _=require('lodash');var util=require(_0xcf90('0x0'));var moment=require('moment');var BPromise=require(_0xcf90('0x1'));var rs=require(_0xcf90('0x2'));var fs=require('fs');var Redis=require(_0xcf90('0x3'));var db=require(_0xcf90('0x4'))['db'];var utils=require(_0xcf90('0x5'));var logger=require('../../config/logger')(_0xcf90('0x6'));var config=require('../../config/environment');var jayson=require(_0xcf90('0x7'));var client=jayson[_0xcf90('0x8')][_0xcf90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x580aa4,_0x25f153,_0x240ed2){return new BPromise(function(_0x5c4b2d,_0x5f523){return client[_0xcf90('0xa')](_0x580aa4,_0x240ed2)[_0xcf90('0xb')](function(_0x33e3c5){logger['info'](_0xcf90('0xc'),_0x25f153,'request\x20sent');logger[_0xcf90('0xd')](_0xcf90('0xe'),_0x25f153,_0xcf90('0xf'),JSON['stringify'](_0x33e3c5));if(_0x33e3c5[_0xcf90('0x10')]){if(_0x33e3c5['error'][_0xcf90('0x11')]===0x1f4){logger['error'](_0xcf90('0xc'),_0x25f153,_0x33e3c5[_0xcf90('0x10')][_0xcf90('0x12')]);return _0x5f523(_0x33e3c5['error'][_0xcf90('0x12')]);}logger[_0xcf90('0x10')](_0xcf90('0xc'),_0x25f153,_0x33e3c5[_0xcf90('0x10')][_0xcf90('0x12')]);return _0x5c4b2d(_0x33e3c5['error'][_0xcf90('0x12')]);}else{logger[_0xcf90('0x13')](_0xcf90('0xc'),_0x25f153,'request\x20sent');_0x5c4b2d(_0x33e3c5[_0xcf90('0x14')][_0xcf90('0x12')]);}})[_0xcf90('0x15')](function(_0xcb14b7){logger[_0xcf90('0x10')](_0xcf90('0xc'),_0x25f153,_0xcb14b7);_0x5f523(_0xcb14b7);});});}exports[_0xcf90('0x16')]=function(_0x182730){var _0x4aedc9=this;return new Promise(function(_0x2c792c,_0x47987e){return db[_0xcf90('0x17')][_0xcf90('0x18')](_0x182730[_0xcf90('0x19')],{'raw':_0x182730[_0xcf90('0x1a')]?_0x182730[_0xcf90('0x1a')][_0xcf90('0x1b')]===undefined?!![]:![]:!![]})[_0xcf90('0xb')](function(_0x36a911){logger[_0xcf90('0x13')](_0xcf90('0x16'),_0x182730);logger[_0xcf90('0xd')]('CreateSmsQueueReport',_0x182730,JSON[_0xcf90('0x1c')](_0x36a911));_0x2c792c(_0x36a911);})[_0xcf90('0x15')](function(_0x402e35){logger[_0xcf90('0x10')](_0xcf90('0x16'),_0x402e35[_0xcf90('0x12')],_0x182730);_0x47987e(_0x4aedc9['error'](0x1f4,_0x402e35['message']));});});};exports[_0xcf90('0x1d')]=function(_0x2dab77){var _0x533c95=this;return new Promise(function(_0x6511e3,_0x47425c){return db[_0xcf90('0x17')][_0xcf90('0x1e')](_0x2dab77['body'],{'raw':_0x2dab77[_0xcf90('0x1a')]?_0x2dab77['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2dab77[_0xcf90('0x1a')]?_0x2dab77[_0xcf90('0x1a')]['where']||null:null,'attributes':_0x2dab77['options']?_0x2dab77[_0xcf90('0x1a')]['attributes']||null:null,'limit':_0x2dab77[_0xcf90('0x1a')]?_0x2dab77[_0xcf90('0x1a')][_0xcf90('0x1f')]||null:null})['then'](function(_0x3b2f00){logger[_0xcf90('0x13')](_0xcf90('0x1d'),_0x2dab77);logger['debug'](_0xcf90('0x1d'),_0x2dab77,JSON[_0xcf90('0x1c')](_0x3b2f00));_0x6511e3(_0x3b2f00);})[_0xcf90('0x15')](function(_0xa279d5){logger['error'](_0xcf90('0x1d'),_0xa279d5[_0xcf90('0x12')],_0x2dab77);_0x47425c(_0x533c95['error'](0x1f4,_0xa279d5[_0xcf90('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index dbe71db..c3347ad 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 _0xdbf5=['show','post','put','update','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x38a126,_0x4e1495){_0x38a126=_0x38a126-0x0;var _0x38653e=_0xdbf5[_0x38a126];return _0x38653e;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var fs_extra=require(_0x5dbf('0x3'));var auth=require(_0x5dbf('0x4'));var interaction=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var controller=require(_0x5dbf('0x7'));router[_0x5dbf('0x8')]('/',auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xa')]);router[_0x5dbf('0x8')](_0x5dbf('0xb'),auth[_0x5dbf('0x9')](),controller['describe']);router[_0x5dbf('0x8')]('/:id',auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xc')]);router[_0x5dbf('0xd')]('/',auth[_0x5dbf('0x9')](),controller['create']);router[_0x5dbf('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x5dbf('0xf')]);router['delete']('/:id',auth[_0x5dbf('0x9')](),controller['destroy']);module[_0x5dbf('0x10')]=router; \ No newline at end of file +var _0x1c9a=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update'];(function(_0x295c10,_0x100766){var _0xde2bed=function(_0x2b2180){while(--_0x2b2180){_0x295c10['push'](_0x295c10['shift']());}};_0xde2bed(++_0x100766);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x4bf833,_0x47fabb){_0x4bf833=_0x4bf833-0x0;var _0x5a923a=_0x1c9a[_0x4bf833];return _0x5a923a;};'use strict';var multer=require(_0xa1c9('0x0'));var util=require(_0xa1c9('0x1'));var path=require('path');var timeout=require(_0xa1c9('0x2'));var express=require(_0xa1c9('0x3'));var router=express[_0xa1c9('0x4')]();var fs_extra=require(_0xa1c9('0x5'));var auth=require(_0xa1c9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa1c9('0x7'));var controller=require('./smsTransferReport.controller');router[_0xa1c9('0x8')]('/',auth[_0xa1c9('0x9')](),controller[_0xa1c9('0xa')]);router[_0xa1c9('0x8')](_0xa1c9('0xb'),auth[_0xa1c9('0x9')](),controller[_0xa1c9('0xc')]);router[_0xa1c9('0x8')](_0xa1c9('0xd'),auth[_0xa1c9('0x9')](),controller[_0xa1c9('0xe')]);router[_0xa1c9('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa1c9('0x10')]('/:id',auth[_0xa1c9('0x9')](),controller[_0xa1c9('0x11')]);router[_0xa1c9('0x12')](_0xa1c9('0xd'),auth[_0xa1c9('0x9')](),controller[_0xa1c9('0x13')]);module[_0xa1c9('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 189600e..4774ace 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0xed6a94,_0x1bd5aa){var _0x23d79c=function(_0x2a5bdb){while(--_0x2a5bdb){_0xed6a94['push'](_0xed6a94['shift']());}};_0x23d79c(++_0x1bd5aa);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xcb91[_0x4fde08];return _0x12e725;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x219d87,_0x1cb6f7){var _0x22823d=function(_0x5357bf){while(--_0x5357bf){_0x219d87['push'](_0x219d87['shift']());}};_0x22823d(++_0x1cb6f7);}(_0x9bde,0xe1));var _0xe9bd=function(_0x568bc7,_0x1607c5){_0x568bc7=_0x568bc7-0x0;var _0x6758c4=_0x9bde[_0x568bc7];return _0x6758c4;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index b85ce07..1932699 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 _0x6c9e=['sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filter','merge','VIRTUAL','options','includeAll','SmsTransferReport','findAll','rows','catch','include','create','body','find','params','describe','eml-format','rimraf','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util'];(function(_0x52d861,_0x21f9b9){var _0x1a2023=function(_0x43d056){while(--_0x43d056){_0x52d861['push'](_0x52d861['shift']());}};_0x1a2023(++_0x21f9b9);}(_0x6c9e,0x1dd));var _0xe6c9=function(_0x58b0e4,_0x525c11){_0x58b0e4=_0x58b0e4-0x0;var _0x1c4c61=_0x6c9e[_0x58b0e4];return _0x1c4c61;};'use strict';var emlformat=require(_0xe6c9('0x0'));var rimraf=require(_0xe6c9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe6c9('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe6c9('0x3'));var path=require(_0xe6c9('0x4'));var sox=require(_0xe6c9('0x5'));var csv=require(_0xe6c9('0x6'));var ejs=require(_0xe6c9('0x7'));var fs=require('fs');var fs_extra=require(_0xe6c9('0x8'));var _=require(_0xe6c9('0x9'));var squel=require(_0xe6c9('0xa'));var crypto=require(_0xe6c9('0xb'));var jsforce=require(_0xe6c9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe6c9('0x6'));var querystring=require(_0xe6c9('0xd'));var Papa=require('papaparse');var Redis=require(_0xe6c9('0xe'));var authService=require(_0xe6c9('0xf'));var qs=require(_0xe6c9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6c9('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xe6c9('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xe6c9('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31f1a2,_0x1853f2){_0x1853f2=_0x1853f2||0xcc;return function(_0x112be0){if(_0x112be0){return _0x31f1a2[_0xe6c9('0x14')](_0x1853f2);}return _0x31f1a2[_0xe6c9('0x15')](_0x1853f2)[_0xe6c9('0x16')]();};}function respondWithResult(_0x285c8f,_0x1fd7f8){_0x1fd7f8=_0x1fd7f8||0xc8;return function(_0x48166e){if(_0x48166e){return _0x285c8f['status'](_0x1fd7f8)['json'](_0x48166e);}};}function respondWithFilteredResult(_0x48922e,_0x3e53db){return function(_0xda9fd8){if(_0xda9fd8){var _0xbe7263=typeof _0x3e53db[_0xe6c9('0x17')]==='undefined'&&typeof _0x3e53db[_0xe6c9('0x18')]===_0xe6c9('0x19');var _0x38fc16=_0xda9fd8[_0xe6c9('0x1a')];var _0x4566ad=_0xbe7263?0x0:_0x3e53db['offset'];var _0x434de3=_0xbe7263?_0xda9fd8['count']:_0x3e53db[_0xe6c9('0x17')]+_0x3e53db[_0xe6c9('0x18')];var _0x45929a;if(_0x434de3>=_0x38fc16){_0x434de3=_0x38fc16;_0x45929a=0xc8;}else{_0x45929a=0xce;}_0x48922e[_0xe6c9('0x15')](_0x45929a);return _0x48922e[_0xe6c9('0x1b')](_0xe6c9('0x1c'),_0x4566ad+'-'+_0x434de3+'/'+_0x38fc16)[_0xe6c9('0x1d')](_0xda9fd8);}return null;};}function patchUpdates(_0x3c3e43){return function(_0x79df7e){try{jsonpatch[_0xe6c9('0x1e')](_0x79df7e,_0x3c3e43,!![]);}catch(_0x5f34c3){return BPromise[_0xe6c9('0x1f')](_0x5f34c3);}return _0x79df7e[_0xe6c9('0x20')]();};}function saveUpdates(_0x1ec659,_0x58e911){return function(_0x2db0bb){if(_0x2db0bb){return _0x2db0bb[_0xe6c9('0x21')](_0x1ec659)[_0xe6c9('0x22')](function(_0x19820f){return _0x19820f;});}return null;};}function removeEntity(_0x3f1ec8,_0x337951){return function(_0x227d87){if(_0x227d87){return _0x227d87[_0xe6c9('0x23')]()[_0xe6c9('0x22')](function(){_0x3f1ec8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5858ff,_0x5a860a){return function(_0x11bafc){if(!_0x11bafc){_0x5858ff[_0xe6c9('0x14')](0x194);}return _0x11bafc;};}function handleError(_0x4a3bf2,_0x187fad){_0x187fad=_0x187fad||0x1f4;return function(_0x4ac42f){logger[_0xe6c9('0x24')](_0x4ac42f['stack']);if(_0x4ac42f['name']){delete _0x4ac42f['name'];}_0x4a3bf2['status'](_0x187fad)[_0xe6c9('0x25')](_0x4ac42f);};}exports[_0xe6c9('0x26')]=function(_0x2adc45,_0x39f335){var _0x44c260={},_0x4d6dc2={},_0x240942={'count':0x0,'rows':[]};var _0x514fda=_[_0xe6c9('0x27')](db['SmsTransferReport'][_0xe6c9('0x28')],function(_0x162237){return{'name':_0x162237[_0xe6c9('0x29')],'type':_0x162237[_0xe6c9('0x2a')][_0xe6c9('0x2b')]};});_0x4d6dc2[_0xe6c9('0x2c')]=_[_0xe6c9('0x27')](_0x514fda,_0xe6c9('0x2d'));_0x4d6dc2[_0xe6c9('0x2e')]=_[_0xe6c9('0x2f')](_0x2adc45['query']);_0x4d6dc2[_0xe6c9('0x30')]=_[_0xe6c9('0x31')](_0x4d6dc2[_0xe6c9('0x2c')],_0x4d6dc2[_0xe6c9('0x2e')]);_0x44c260[_0xe6c9('0x32')]=_[_0xe6c9('0x31')](_0x4d6dc2['model'],qs[_0xe6c9('0x33')](_0x2adc45[_0xe6c9('0x2e')][_0xe6c9('0x33')]));_0x44c260[_0xe6c9('0x32')]=_0x44c260[_0xe6c9('0x32')][_0xe6c9('0x34')]?_0x44c260[_0xe6c9('0x32')]:_0x4d6dc2[_0xe6c9('0x2c')];if(!_0x2adc45[_0xe6c9('0x2e')][_0xe6c9('0x35')](_0xe6c9('0x36'))){_0x44c260[_0xe6c9('0x18')]=qs[_0xe6c9('0x18')](_0x2adc45[_0xe6c9('0x2e')]['limit']);_0x44c260[_0xe6c9('0x17')]=qs[_0xe6c9('0x17')](_0x2adc45[_0xe6c9('0x2e')][_0xe6c9('0x17')]);}_0x44c260['order']=qs['sort'](_0x2adc45[_0xe6c9('0x2e')]['sort']);_0x44c260[_0xe6c9('0x37')]=qs[_0xe6c9('0x30')](_['pick'](_0x2adc45[_0xe6c9('0x2e')],_0x4d6dc2[_0xe6c9('0x30')]),_0x514fda);if(_0x2adc45[_0xe6c9('0x2e')][_0xe6c9('0x38')]){_0x44c260[_0xe6c9('0x37')]=_[_0xe6c9('0x39')](_0x44c260['where'],{'$or':_[_0xe6c9('0x27')](_0x514fda,function(_0x4b16eb){if(_0x4b16eb[_0xe6c9('0x2a')]!==_0xe6c9('0x3a')){var _0x5d286e={};_0x5d286e[_0x4b16eb[_0xe6c9('0x2d')]]={'$like':'%'+_0x2adc45[_0xe6c9('0x2e')][_0xe6c9('0x38')]+'%'};return _0x5d286e;}})});}_0x44c260=_[_0xe6c9('0x39')]({},_0x44c260,_0x2adc45[_0xe6c9('0x3b')]);var _0x3ac46d={'where':_0x44c260[_0xe6c9('0x37')]};return db['SmsTransferReport'][_0xe6c9('0x1a')](_0x3ac46d)[_0xe6c9('0x22')](function(_0x48b1e3){_0x240942[_0xe6c9('0x1a')]=_0x48b1e3;if(_0x2adc45[_0xe6c9('0x2e')][_0xe6c9('0x3c')]){_0x44c260['include']=[{'all':!![]}];}return db[_0xe6c9('0x3d')][_0xe6c9('0x3e')](_0x44c260);})[_0xe6c9('0x22')](function(_0x2d73dc){_0x240942[_0xe6c9('0x3f')]=_0x2d73dc;return _0x240942;})[_0xe6c9('0x22')](respondWithFilteredResult(_0x39f335,_0x44c260))[_0xe6c9('0x40')](handleError(_0x39f335,null));};exports['show']=function(_0x2df7e9,_0x5ed169){var _0x1a0ccc={'raw':!![],'where':{'id':_0x2df7e9['params']['id']}},_0x35ada6={};_0x35ada6[_0xe6c9('0x2c')]=_[_0xe6c9('0x2f')](db[_0xe6c9('0x3d')][_0xe6c9('0x28')]);_0x35ada6[_0xe6c9('0x2e')]=_['keys'](_0x2df7e9['query']);_0x35ada6[_0xe6c9('0x30')]=_[_0xe6c9('0x31')](_0x35ada6[_0xe6c9('0x2c')],_0x35ada6['query']);_0x1a0ccc[_0xe6c9('0x32')]=_['intersection'](_0x35ada6['model'],qs[_0xe6c9('0x33')](_0x2df7e9[_0xe6c9('0x2e')][_0xe6c9('0x33')]));_0x1a0ccc[_0xe6c9('0x32')]=_0x1a0ccc[_0xe6c9('0x32')]['length']?_0x1a0ccc['attributes']:_0x35ada6['model'];if(_0x2df7e9[_0xe6c9('0x2e')][_0xe6c9('0x3c')]){_0x1a0ccc[_0xe6c9('0x41')]=[{'all':!![]}];}_0x1a0ccc=_[_0xe6c9('0x39')]({},_0x1a0ccc,_0x2df7e9[_0xe6c9('0x3b')]);return db[_0xe6c9('0x3d')]['find'](_0x1a0ccc)[_0xe6c9('0x22')](handleEntityNotFound(_0x5ed169,null))['then'](respondWithResult(_0x5ed169,null))[_0xe6c9('0x40')](handleError(_0x5ed169,null));};exports[_0xe6c9('0x42')]=function(_0x479fa7,_0x28eb9d){return db[_0xe6c9('0x3d')][_0xe6c9('0x42')](_0x479fa7[_0xe6c9('0x43')],{})['then'](respondWithResult(_0x28eb9d,0xc9))[_0xe6c9('0x40')](handleError(_0x28eb9d,null));};exports['update']=function(_0x4b86f4,_0x2201c7){if(_0x4b86f4[_0xe6c9('0x43')]['id']){delete _0x4b86f4[_0xe6c9('0x43')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x4b86f4['params']['id']}})[_0xe6c9('0x22')](handleEntityNotFound(_0x2201c7,null))['then'](saveUpdates(_0x4b86f4[_0xe6c9('0x43')],null))[_0xe6c9('0x22')](respondWithResult(_0x2201c7,null))[_0xe6c9('0x40')](handleError(_0x2201c7,null));};exports['destroy']=function(_0xb073f0,_0x5193c0){return db[_0xe6c9('0x3d')][_0xe6c9('0x44')]({'where':{'id':_0xb073f0[_0xe6c9('0x45')]['id']}})[_0xe6c9('0x22')](handleEntityNotFound(_0x5193c0,null))[_0xe6c9('0x22')](removeEntity(_0x5193c0,null))['catch'](handleError(_0x5193c0,null));};exports[_0xe6c9('0x46')]=function(_0x6ff86c,_0x1f2fb9){return db[_0xe6c9('0x3d')][_0xe6c9('0x46')]()[_0xe6c9('0x22')](respondWithResult(_0x1f2fb9,null))[_0xe6c9('0x40')](handleError(_0x1f2fb9,null));}; \ No newline at end of file +var _0x2315=['catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','error','stack','name','send','map','SmsTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows'];(function(_0x49027f,_0x2507de){var _0x16a323=function(_0x5a8abc){while(--_0x5a8abc){_0x49027f['push'](_0x49027f['shift']());}};_0x16a323(++_0x2507de);}(_0x2315,0xa4));var _0x5231=function(_0x5edf23,_0x138cf0){_0x5edf23=_0x5edf23-0x0;var _0x3e3c0f=_0x2315[_0x5edf23];return _0x3e3c0f;};'use strict';var emlformat=require(_0x5231('0x0'));var rimraf=require(_0x5231('0x1'));var zipdir=require(_0x5231('0x2'));var jsonpatch=require(_0x5231('0x3'));var rp=require(_0x5231('0x4'));var moment=require(_0x5231('0x5'));var BPromise=require(_0x5231('0x6'));var Mustache=require('mustache');var util=require(_0x5231('0x7'));var path=require(_0x5231('0x8'));var sox=require(_0x5231('0x9'));var csv=require(_0x5231('0xa'));var ejs=require(_0x5231('0xb'));var fs=require('fs');var fs_extra=require(_0x5231('0xc'));var _=require(_0x5231('0xd'));var squel=require(_0x5231('0xe'));var crypto=require(_0x5231('0xf'));var jsforce=require(_0x5231('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x5231('0xa'));var querystring=require(_0x5231('0x11'));var Papa=require(_0x5231('0x12'));var Redis=require(_0x5231('0x13'));var authService=require(_0x5231('0x14'));var qs=require(_0x5231('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5231('0x16'))(_0x5231('0x17'));var utils=require(_0x5231('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x5231('0x19'));var db=require(_0x5231('0x1a'))['db'];function respondWithStatusCode(_0x159f78,_0xfa31e0){_0xfa31e0=_0xfa31e0||0xcc;return function(_0x1e9542){if(_0x1e9542){return _0x159f78[_0x5231('0x1b')](_0xfa31e0);}return _0x159f78[_0x5231('0x1c')](_0xfa31e0)[_0x5231('0x1d')]();};}function respondWithResult(_0x52b750,_0x9fe294){_0x9fe294=_0x9fe294||0xc8;return function(_0x22a614){if(_0x22a614){return _0x52b750[_0x5231('0x1c')](_0x9fe294)[_0x5231('0x1e')](_0x22a614);}};}function respondWithFilteredResult(_0x35d866,_0x33b6e4){return function(_0x9ee24b){if(_0x9ee24b){var _0x118f4e=typeof _0x33b6e4[_0x5231('0x1f')]===_0x5231('0x20')&&typeof _0x33b6e4['limit']===_0x5231('0x20');var _0x42886b=_0x9ee24b[_0x5231('0x21')];var _0x2644b6=_0x118f4e?0x0:_0x33b6e4[_0x5231('0x1f')];var _0x23ac7e=_0x118f4e?_0x9ee24b[_0x5231('0x21')]:_0x33b6e4['offset']+_0x33b6e4[_0x5231('0x22')];var _0x452fe2;if(_0x23ac7e>=_0x42886b){_0x23ac7e=_0x42886b;_0x452fe2=0xc8;}else{_0x452fe2=0xce;}_0x35d866[_0x5231('0x1c')](_0x452fe2);return _0x35d866['set'](_0x5231('0x23'),_0x2644b6+'-'+_0x23ac7e+'/'+_0x42886b)[_0x5231('0x1e')](_0x9ee24b);}return null;};}function patchUpdates(_0x363118){return function(_0x571bdb){try{jsonpatch[_0x5231('0x24')](_0x571bdb,_0x363118,!![]);}catch(_0x4902ad){return BPromise[_0x5231('0x25')](_0x4902ad);}return _0x571bdb['save']();};}function saveUpdates(_0x31c1d8,_0x142e8a){return function(_0x46a7a0){if(_0x46a7a0){return _0x46a7a0[_0x5231('0x26')](_0x31c1d8)[_0x5231('0x27')](function(_0x6a9b96){return _0x6a9b96;});}return null;};}function removeEntity(_0x2893ab,_0x4cc705){return function(_0x26895e){if(_0x26895e){return _0x26895e['destroy']()['then'](function(){_0x2893ab[_0x5231('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe7e123,_0x5852ef){return function(_0xbd4529){if(!_0xbd4529){_0xe7e123['sendStatus'](0x194);}return _0xbd4529;};}function handleError(_0x17878e,_0x5a52f9){_0x5a52f9=_0x5a52f9||0x1f4;return function(_0x290c4b){logger[_0x5231('0x28')](_0x290c4b[_0x5231('0x29')]);if(_0x290c4b[_0x5231('0x2a')]){delete _0x290c4b[_0x5231('0x2a')];}_0x17878e[_0x5231('0x1c')](_0x5a52f9)[_0x5231('0x2b')](_0x290c4b);};}exports['index']=function(_0xde50cb,_0x2a07cb){var _0xb05378={},_0x498c6e={},_0x4b4b7a={'count':0x0,'rows':[]};var _0x8466f7=_[_0x5231('0x2c')](db[_0x5231('0x2d')][_0x5231('0x2e')],function(_0x30953b){return{'name':_0x30953b[_0x5231('0x2f')],'type':_0x30953b[_0x5231('0x30')][_0x5231('0x31')]};});_0x498c6e['model']=_['map'](_0x8466f7,'name');_0x498c6e[_0x5231('0x32')]=_[_0x5231('0x33')](_0xde50cb['query']);_0x498c6e[_0x5231('0x34')]=_[_0x5231('0x35')](_0x498c6e['model'],_0x498c6e[_0x5231('0x32')]);_0xb05378[_0x5231('0x36')]=_[_0x5231('0x35')](_0x498c6e['model'],qs[_0x5231('0x37')](_0xde50cb[_0x5231('0x32')][_0x5231('0x37')]));_0xb05378[_0x5231('0x36')]=_0xb05378[_0x5231('0x36')][_0x5231('0x38')]?_0xb05378['attributes']:_0x498c6e[_0x5231('0x39')];if(!_0xde50cb[_0x5231('0x32')][_0x5231('0x3a')](_0x5231('0x3b'))){_0xb05378[_0x5231('0x22')]=qs[_0x5231('0x22')](_0xde50cb[_0x5231('0x32')][_0x5231('0x22')]);_0xb05378[_0x5231('0x1f')]=qs['offset'](_0xde50cb['query'][_0x5231('0x1f')]);}_0xb05378['order']=qs['sort'](_0xde50cb[_0x5231('0x32')][_0x5231('0x3c')]);_0xb05378[_0x5231('0x3d')]=qs[_0x5231('0x34')](_[_0x5231('0x3e')](_0xde50cb[_0x5231('0x32')],_0x498c6e['filters']),_0x8466f7);if(_0xde50cb['query'][_0x5231('0x3f')]){_0xb05378[_0x5231('0x3d')]=_[_0x5231('0x40')](_0xb05378['where'],{'$or':_[_0x5231('0x2c')](_0x8466f7,function(_0x546103){if(_0x546103[_0x5231('0x30')]!=='VIRTUAL'){var _0x17f48d={};_0x17f48d[_0x546103['name']]={'$like':'%'+_0xde50cb[_0x5231('0x32')]['filter']+'%'};return _0x17f48d;}})});}_0xb05378=_['merge']({},_0xb05378,_0xde50cb[_0x5231('0x41')]);var _0x43be10={'where':_0xb05378[_0x5231('0x3d')]};return db[_0x5231('0x2d')][_0x5231('0x21')](_0x43be10)[_0x5231('0x27')](function(_0x57a5b9){_0x4b4b7a[_0x5231('0x21')]=_0x57a5b9;if(_0xde50cb['query'][_0x5231('0x42')]){_0xb05378[_0x5231('0x43')]=[{'all':!![]}];}return db[_0x5231('0x2d')][_0x5231('0x44')](_0xb05378);})[_0x5231('0x27')](function(_0x4cf41e){_0x4b4b7a[_0x5231('0x45')]=_0x4cf41e;return _0x4b4b7a;})[_0x5231('0x27')](respondWithFilteredResult(_0x2a07cb,_0xb05378))[_0x5231('0x46')](handleError(_0x2a07cb,null));};exports[_0x5231('0x47')]=function(_0x28a6c6,_0x421e37){var _0x42871b={'raw':!![],'where':{'id':_0x28a6c6[_0x5231('0x48')]['id']}},_0x47076b={};_0x47076b[_0x5231('0x39')]=_[_0x5231('0x33')](db[_0x5231('0x2d')][_0x5231('0x2e')]);_0x47076b[_0x5231('0x32')]=_[_0x5231('0x33')](_0x28a6c6[_0x5231('0x32')]);_0x47076b[_0x5231('0x34')]=_[_0x5231('0x35')](_0x47076b[_0x5231('0x39')],_0x47076b[_0x5231('0x32')]);_0x42871b['attributes']=_['intersection'](_0x47076b['model'],qs[_0x5231('0x37')](_0x28a6c6['query'][_0x5231('0x37')]));_0x42871b[_0x5231('0x36')]=_0x42871b[_0x5231('0x36')][_0x5231('0x38')]?_0x42871b[_0x5231('0x36')]:_0x47076b[_0x5231('0x39')];if(_0x28a6c6[_0x5231('0x32')]['includeAll']){_0x42871b[_0x5231('0x43')]=[{'all':!![]}];}_0x42871b=_[_0x5231('0x40')]({},_0x42871b,_0x28a6c6[_0x5231('0x41')]);return db['SmsTransferReport'][_0x5231('0x49')](_0x42871b)[_0x5231('0x27')](handleEntityNotFound(_0x421e37,null))['then'](respondWithResult(_0x421e37,null))['catch'](handleError(_0x421e37,null));};exports[_0x5231('0x4a')]=function(_0x2e92ed,_0x1ea73b){return db[_0x5231('0x2d')][_0x5231('0x4a')](_0x2e92ed[_0x5231('0x4b')],{})['then'](respondWithResult(_0x1ea73b,0xc9))[_0x5231('0x46')](handleError(_0x1ea73b,null));};exports['update']=function(_0x4b7216,_0x1cdaef){if(_0x4b7216[_0x5231('0x4b')]['id']){delete _0x4b7216[_0x5231('0x4b')]['id'];}return db[_0x5231('0x2d')][_0x5231('0x49')]({'where':{'id':_0x4b7216[_0x5231('0x48')]['id']}})[_0x5231('0x27')](handleEntityNotFound(_0x1cdaef,null))[_0x5231('0x27')](saveUpdates(_0x4b7216[_0x5231('0x4b')],null))['then'](respondWithResult(_0x1cdaef,null))[_0x5231('0x46')](handleError(_0x1cdaef,null));};exports[_0x5231('0x4c')]=function(_0x34b8f5,_0x531047){return db[_0x5231('0x2d')]['find']({'where':{'id':_0x34b8f5[_0x5231('0x48')]['id']}})[_0x5231('0x27')](handleEntityNotFound(_0x531047,null))[_0x5231('0x27')](removeEntity(_0x531047,null))[_0x5231('0x46')](handleError(_0x531047,null));};exports[_0x5231('0x4d')]=function(_0x59bf9c,_0x1ca5eb){return db[_0x5231('0x2d')]['describe']()[_0x5231('0x27')](respondWithResult(_0x1ca5eb,null))['catch'](handleError(_0x1ca5eb,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index c80c9d2..456c913 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 _0x372b=['report_sms_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x372b,0x18a));var _0xb372=function(_0x4d157c,_0xc5511c){_0x4d157c=_0x4d157c-0x0;var _0x406459=_0x372b[_0x4d157c];return _0x406459;};'use strict';var _=require(_0xb372('0x0'));var util=require(_0xb372('0x1'));var logger=require('../../config/logger')(_0xb372('0x2'));var moment=require(_0xb372('0x3'));var BPromise=require(_0xb372('0x4'));var rp=require(_0xb372('0x5'));var fs=require('fs');var path=require(_0xb372('0x6'));var rimraf=require(_0xb372('0x7'));var config=require('../../config/environment');var attributes=require(_0xb372('0x8'));module[_0xb372('0x9')]=function(_0xa1eefa,_0x5c8510){return _0xa1eefa[_0xb372('0xa')](_0xb372('0xb'),attributes,{'tableName':_0xb372('0xc'),'paranoid':![],'indexes':[{'name':_0xb372('0xd'),'fields':[_0xb372('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d37=['rimraf','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x8d37,0xbc));var _0x78d3=function(_0x79c337,_0x5468a1){_0x79c337=_0x79c337-0x0;var _0x2f7d87=_0x8d37[_0x79c337];return _0x2f7d87;};'use strict';var _=require(_0x78d3('0x0'));var util=require('util');var logger=require(_0x78d3('0x1'))(_0x78d3('0x2'));var moment=require(_0x78d3('0x3'));var BPromise=require(_0x78d3('0x4'));var rp=require(_0x78d3('0x5'));var fs=require('fs');var path=require(_0x78d3('0x6'));var rimraf=require(_0x78d3('0x7'));var config=require('../../config/environment');var attributes=require(_0x78d3('0x8'));module[_0x78d3('0x9')]=function(_0x5da972,_0x114e2e){return _0x5da972[_0x78d3('0xa')]('SmsTransferReport',attributes,{'tableName':_0x78d3('0xb'),'paranoid':![],'indexes':[{'name':_0x78d3('0xc'),'fields':[_0x78d3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 118909b..4304d58 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 _0x2fed=['request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x2fed,0x7c));var _0xd2fe=function(_0x1710aa,_0x3b95ef){_0x1710aa=_0x1710aa-0x0;var _0x5efcbd=_0x2fed[_0x1710aa];return _0x5efcbd;};'use strict';var _=require(_0xd2fe('0x0'));var util=require(_0xd2fe('0x1'));var moment=require(_0xd2fe('0x2'));var BPromise=require(_0xd2fe('0x3'));var rs=require(_0xd2fe('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd2fe('0x5'))['db'];var utils=require(_0xd2fe('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd2fe('0x7'));var jayson=require(_0xd2fe('0x8'));var client=jayson[_0xd2fe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f7bf5,_0x44e015,_0x3b6591){return new BPromise(function(_0x42a8fb,_0x47996a){return client[_0xd2fe('0xa')](_0x2f7bf5,_0x3b6591)[_0xd2fe('0xb')](function(_0x815784){logger[_0xd2fe('0xc')](_0xd2fe('0xd'),_0x44e015,_0xd2fe('0xe'));logger[_0xd2fe('0xf')](_0xd2fe('0x10'),_0x44e015,_0xd2fe('0xe'),JSON[_0xd2fe('0x11')](_0x815784));if(_0x815784[_0xd2fe('0x12')]){if(_0x815784[_0xd2fe('0x12')][_0xd2fe('0x13')]===0x1f4){logger[_0xd2fe('0x12')](_0xd2fe('0xd'),_0x44e015,_0x815784[_0xd2fe('0x12')][_0xd2fe('0x14')]);return _0x47996a(_0x815784[_0xd2fe('0x12')]['message']);}logger[_0xd2fe('0x12')](_0xd2fe('0xd'),_0x44e015,_0x815784[_0xd2fe('0x12')]['message']);return _0x42a8fb(_0x815784['error']['message']);}else{logger[_0xd2fe('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x44e015,_0xd2fe('0xe'));_0x42a8fb(_0x815784[_0xd2fe('0x15')][_0xd2fe('0x14')]);}})[_0xd2fe('0x16')](function(_0x303ca2){logger[_0xd2fe('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x44e015,_0x303ca2);_0x47996a(_0x303ca2);});});} \ No newline at end of file +var _0xb2ff=['stringify','error','SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x57b62c,_0x30718f){var _0x4d6baf=function(_0x2cd90e){while(--_0x2cd90e){_0x57b62c['push'](_0x57b62c['shift']());}};_0x4d6baf(++_0x30718f);}(_0xb2ff,0x123));var _0xfb2f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb2ff[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xfb2f('0x0'));var util=require(_0xfb2f('0x1'));var moment=require('moment');var BPromise=require(_0xfb2f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfb2f('0x3'));var logger=require('../../config/logger')(_0xfb2f('0x4'));var config=require(_0xfb2f('0x5'));var jayson=require(_0xfb2f('0x6'));var client=jayson[_0xfb2f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a0fd7,_0x28cb13,_0x4ff2df){return new BPromise(function(_0x34c04e,_0x4588d6){return client[_0xfb2f('0x8')](_0x4a0fd7,_0x4ff2df)[_0xfb2f('0x9')](function(_0x5abcdb){logger[_0xfb2f('0xa')]('SmsTransferReport,\x20%s,\x20%s',_0x28cb13,_0xfb2f('0xb'));logger['debug'](_0xfb2f('0xc'),_0x28cb13,_0xfb2f('0xb'),JSON[_0xfb2f('0xd')](_0x5abcdb));if(_0x5abcdb[_0xfb2f('0xe')]){if(_0x5abcdb[_0xfb2f('0xe')]['code']===0x1f4){logger[_0xfb2f('0xe')](_0xfb2f('0xf'),_0x28cb13,_0x5abcdb[_0xfb2f('0xe')][_0xfb2f('0x10')]);return _0x4588d6(_0x5abcdb[_0xfb2f('0xe')][_0xfb2f('0x10')]);}logger[_0xfb2f('0xe')](_0xfb2f('0xf'),_0x28cb13,_0x5abcdb['error'][_0xfb2f('0x10')]);return _0x34c04e(_0x5abcdb[_0xfb2f('0xe')][_0xfb2f('0x10')]);}else{logger[_0xfb2f('0xa')](_0xfb2f('0xf'),_0x28cb13,'request\x20sent');_0x34c04e(_0x5abcdb[_0xfb2f('0x11')][_0xfb2f('0x10')]);}})[_0xfb2f('0x12')](function(_0x240b79){logger[_0xfb2f('0xe')](_0xfb2f('0xf'),_0x28cb13,_0x240b79);_0x4588d6(_0x240b79);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 933df43..bb9a28a 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 _0x6a73=['/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','file','create','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','get','/:id'];(function(_0x37e532,_0x186c69){var _0x1f2628=function(_0x3e6cb3){while(--_0x3e6cb3){_0x37e532['push'](_0x37e532['shift']());}};_0x1f2628(++_0x186c69);}(_0x6a73,0x198));var _0x36a7=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0x6a73[_0x4c6d6f];return _0x2d4478;};'use strict';var multer=require(_0x36a7('0x0'));var util=require(_0x36a7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x36a7('0x2'));var router=express[_0x36a7('0x3')]();var fs_extra=require(_0x36a7('0x4'));var auth=require(_0x36a7('0x5'));var interaction=require(_0x36a7('0x6'));var config=require(_0x36a7('0x7'));var controller=require(_0x36a7('0x8'));router['get']('/',auth[_0x36a7('0x9')](),controller['index']);router[_0x36a7('0xa')](_0x36a7('0xb'),auth[_0x36a7('0x9')](),controller['show']);router['get'](_0x36a7('0xc'),auth[_0x36a7('0x9')](),controller[_0x36a7('0xd')]);var upload=multer({'storage':multer[_0x36a7('0xe')]({'destination':function(_0x255f86,_0x32aafa,_0x57adb3){_0x57adb3(null,path[_0x36a7('0xf')](config[_0x36a7('0x10')],_0x36a7('0x11')));},'filename':function(_0x566796,_0x4578d4,_0x430d46){_0x4578d4['originalname']=_0x4578d4[_0x36a7('0x12')][_0x36a7('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x430d46(null,util[_0x36a7('0x14')](_0x36a7('0x15'),path[_0x36a7('0x16')](_0x4578d4[_0x36a7('0x12')],path[_0x36a7('0x17')](_0x4578d4['originalname'])),Date[_0x36a7('0x18')](),path['extname'](_0x4578d4['originalname'])));}})});router['post']('/',upload['single'](_0x36a7('0x19')),controller[_0x36a7('0x1a')]);router['put']('/:id',auth[_0x36a7('0x9')](),controller[_0x36a7('0x1b')]);router[_0x36a7('0x1c')](_0x36a7('0xb'),auth[_0x36a7('0x9')](),controller['delete']);module[_0x36a7('0x1d')]=router; \ No newline at end of file +var _0x5f12=['update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','%s-%s%s','put'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0x5f12,0x162));var _0x25f1=function(_0x24ac24,_0x5c28fd){_0x24ac24=_0x24ac24-0x0;var _0xa25a51=_0x5f12[_0x24ac24];return _0xa25a51;};'use strict';var multer=require(_0x25f1('0x0'));var util=require(_0x25f1('0x1'));var path=require(_0x25f1('0x2'));var timeout=require(_0x25f1('0x3'));var express=require('express');var router=express[_0x25f1('0x4')]();var fs_extra=require(_0x25f1('0x5'));var auth=require(_0x25f1('0x6'));var interaction=require(_0x25f1('0x7'));var config=require('../../config/environment');var controller=require('./sound.controller');router[_0x25f1('0x8')]('/',auth[_0x25f1('0x9')](),controller[_0x25f1('0xa')]);router[_0x25f1('0x8')](_0x25f1('0xb'),auth['isAuthenticated'](),controller[_0x25f1('0xc')]);router[_0x25f1('0x8')](_0x25f1('0xd'),auth['isAuthenticated'](),controller[_0x25f1('0xe')]);var upload=multer({'storage':multer[_0x25f1('0xf')]({'destination':function(_0x58fbfc,_0x2dd031,_0x3c59d6){_0x3c59d6(null,path[_0x25f1('0x10')](config['root'],_0x25f1('0x11')));},'filename':function(_0x1ea950,_0x4d7d94,_0x3b44d9){_0x4d7d94['originalname']=_0x4d7d94['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3b44d9(null,util['format'](_0x25f1('0x12'),path['basename'](_0x4d7d94['originalname'],path['extname'](_0x4d7d94['originalname'])),Date['now'](),path['extname'](_0x4d7d94['originalname'])));}})});router['post']('/',upload['single']('file'),controller['create']);router[_0x25f1('0x13')](_0x25f1('0xb'),auth[_0x25f1('0x9')](),controller[_0x25f1('0x14')]);router[_0x25f1('0x15')]('/:id',auth[_0x25f1('0x9')](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 3fd2705..d3dda2d 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 _0x20f2=['sequelize','exports','STRING','FLOAT','INTEGER','BIGINT'];(function(_0x3f837e,_0x44d396){var _0x5e2ec4=function(_0x2df06f){while(--_0x2df06f){_0x3f837e['push'](_0x3f837e['shift']());}};_0x5e2ec4(++_0x44d396);}(_0x20f2,0x9c));var _0x220f=function(_0x667f2b,_0x355499){_0x667f2b=_0x667f2b-0x0;var _0x10cc21=_0x20f2[_0x667f2b];return _0x10cc21;};'use strict';var Sequelize=require(_0x220f('0x0'));module[_0x220f('0x1')]={'name':{'type':Sequelize[_0x220f('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x220f('0x2')]},'display_name':{'type':Sequelize[_0x220f('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x220f('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x220f('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x220f('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x220f('0x4')]},'converted_format':{'type':Sequelize[_0x220f('0x2')]},'converted_duration':{'type':Sequelize[_0x220f('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x220f('0x5')]},'converted_channelCount':{'type':Sequelize[_0x220f('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x220f('0x4')]}}; \ No newline at end of file +var _0xaa9c=['BIGINT','INTEGER','FLOAT','sequelize','exports','name','STRING'];(function(_0x564d57,_0x31827b){var _0x4b67b2=function(_0x553314){while(--_0x553314){_0x564d57['push'](_0x564d57['shift']());}};_0x4b67b2(++_0x31827b);}(_0xaa9c,0x1e6));var _0xcaa9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa9c[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xcaa9('0x0'));module[_0xcaa9('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xcaa9('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xcaa9('0x3')]},'display_name':{'type':Sequelize[_0xcaa9('0x3')],'defaultValue':''},'description':{'type':Sequelize[_0xcaa9('0x3')]},'original_format':{'type':Sequelize[_0xcaa9('0x3')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xcaa9('0x4')]},'original_channelCount':{'type':Sequelize[_0xcaa9('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xcaa9('0x5')]},'converted_format':{'type':Sequelize[_0xcaa9('0x3')]},'converted_duration':{'type':Sequelize[_0xcaa9('0x6')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xcaa9('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 2e842f4..328435c 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 _0x2da9=['undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','end','error','name','send','index','Sound','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','nolimit','order','sort','where','pick','filter','merge','map','includeAll','findAll','rows','catch','show','params','include','options','find','download','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','format','%s.%s','create','file','originalname','extname','basename','filename','substring','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','src','duration','original_sampleCount','sampleCount','original_channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','start','description','delete','original_format','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset'];(function(_0xdd21f5,_0x21c8ce){var _0x4d2165=function(_0x1a9551){while(--_0x1a9551){_0xdd21f5['push'](_0xdd21f5['shift']());}};_0x4d2165(++_0x21c8ce);}(_0x2da9,0x163));var _0x92da=function(_0x2ef34a,_0x5b0169){_0x2ef34a=_0x2ef34a-0x0;var _0x140101=_0x2da9[_0x2ef34a];return _0x140101;};'use strict';var emlformat=require(_0x92da('0x0'));var rimraf=require(_0x92da('0x1'));var zipdir=require(_0x92da('0x2'));var jsonpatch=require(_0x92da('0x3'));var rp=require(_0x92da('0x4'));var moment=require(_0x92da('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x92da('0x6'));var util=require(_0x92da('0x7'));var path=require(_0x92da('0x8'));var sox=require(_0x92da('0x9'));var csv=require(_0x92da('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x92da('0xb'));var _=require(_0x92da('0xc'));var squel=require(_0x92da('0xd'));var crypto=require(_0x92da('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x92da('0xf'));var toCsv=require(_0x92da('0xa'));var querystring=require(_0x92da('0x10'));var Papa=require(_0x92da('0x11'));var Redis=require(_0x92da('0x12'));var authService=require(_0x92da('0x13'));var qs=require(_0x92da('0x14'));var as=require(_0x92da('0x15'));var hardwareService=require(_0x92da('0x16'));var logger=require(_0x92da('0x17'))(_0x92da('0x18'));var utils=require(_0x92da('0x19'));var config=require(_0x92da('0x1a'));var licenseUtil=require(_0x92da('0x1b'));var db=require(_0x92da('0x1c'))['db'];function respondWithStatusCode(_0x598301,_0x51bacc){_0x51bacc=_0x51bacc||0xcc;return function(_0x4790b8){if(_0x4790b8){return _0x598301['sendStatus'](_0x51bacc);}return _0x598301[_0x92da('0x1d')](_0x51bacc)['end']();};}function respondWithResult(_0x3ff1de,_0x144404){_0x144404=_0x144404||0xc8;return function(_0x1df5be){if(_0x1df5be){return _0x3ff1de['status'](_0x144404)[_0x92da('0x1e')](_0x1df5be);}};}function respondWithFilteredResult(_0x3c1813,_0xf0f724){return function(_0x2ac57d){if(_0x2ac57d){var _0x32a6b7=typeof _0xf0f724[_0x92da('0x1f')]==='undefined'&&typeof _0xf0f724['limit']===_0x92da('0x20');var _0x431c42=_0x2ac57d['count'];var _0x44394d=_0x32a6b7?0x0:_0xf0f724[_0x92da('0x1f')];var _0x5c7c1e=_0x32a6b7?_0x2ac57d[_0x92da('0x21')]:_0xf0f724[_0x92da('0x1f')]+_0xf0f724[_0x92da('0x22')];var _0x447e43;if(_0x5c7c1e>=_0x431c42){_0x5c7c1e=_0x431c42;_0x447e43=0xc8;}else{_0x447e43=0xce;}_0x3c1813[_0x92da('0x1d')](_0x447e43);return _0x3c1813[_0x92da('0x23')](_0x92da('0x24'),_0x44394d+'-'+_0x5c7c1e+'/'+_0x431c42)[_0x92da('0x1e')](_0x2ac57d);}return null;};}function patchUpdates(_0x184c9e){return function(_0x2f0ca9){try{jsonpatch[_0x92da('0x25')](_0x2f0ca9,_0x184c9e,!![]);}catch(_0x2cfa41){return BPromise[_0x92da('0x26')](_0x2cfa41);}return _0x2f0ca9[_0x92da('0x27')]();};}function saveUpdates(_0x3ba225,_0x1f641e){return function(_0x2645a8){if(_0x2645a8){return _0x2645a8[_0x92da('0x28')](_0x3ba225)[_0x92da('0x29')](function(_0x337896){return _0x337896;});}return null;};}function removeEntity(_0x2c8372,_0x4285c1){return function(_0x4f82c2){if(_0x4f82c2){return _0x4f82c2[_0x92da('0x2a')]()[_0x92da('0x29')](function(){var _0x12af8a=_0x4f82c2[_0x92da('0x2b')]({'plain':!![]});var _0x222450=_0x92da('0x2c');return db[_0x92da('0x2d')][_0x92da('0x2a')]({'where':{'type':_0x222450,'resourceId':_0x12af8a['id']}})[_0x92da('0x29')](function(){return _0x4f82c2;});})[_0x92da('0x29')](function(){_0x2c8372['status'](0xcc)[_0x92da('0x2e')]();});}};}function handleEntityNotFound(_0x1bd069,_0x28f066){return function(_0x18e7b3){if(!_0x18e7b3){_0x1bd069['sendStatus'](0x194);}return _0x18e7b3;};}function handleError(_0x5b9252,_0x5c6ca7){_0x5c6ca7=_0x5c6ca7||0x1f4;return function(_0x2c70ac){logger[_0x92da('0x2f')](_0x2c70ac['stack']);if(_0x2c70ac[_0x92da('0x30')]){delete _0x2c70ac[_0x92da('0x30')];}_0x5b9252['status'](_0x5c6ca7)[_0x92da('0x31')](_0x2c70ac);};}exports[_0x92da('0x32')]=function(_0x5b6cc9,_0x40384b){var _0x33ce6f={},_0x4f7533={},_0x9624bd={'count':0x0,'rows':[]};var _0x528165=_['map'](db[_0x92da('0x33')][_0x92da('0x34')],function(_0x33339b){return{'name':_0x33339b[_0x92da('0x35')],'type':_0x33339b[_0x92da('0x36')][_0x92da('0x37')]};});_0x4f7533[_0x92da('0x38')]=_['map'](_0x528165,_0x92da('0x30'));_0x4f7533['query']=_[_0x92da('0x39')](_0x5b6cc9['query']);_0x4f7533[_0x92da('0x3a')]=_[_0x92da('0x3b')](_0x4f7533[_0x92da('0x38')],_0x4f7533['query']);_0x33ce6f[_0x92da('0x3c')]=_[_0x92da('0x3b')](_0x4f7533['model'],qs[_0x92da('0x3d')](_0x5b6cc9[_0x92da('0x3e')]['fields']));_0x33ce6f[_0x92da('0x3c')]=_0x33ce6f[_0x92da('0x3c')][_0x92da('0x3f')]?_0x33ce6f[_0x92da('0x3c')]:_0x4f7533[_0x92da('0x38')];if(!_0x5b6cc9['query']['hasOwnProperty'](_0x92da('0x40'))){_0x33ce6f['limit']=qs[_0x92da('0x22')](_0x5b6cc9['query'][_0x92da('0x22')]);_0x33ce6f['offset']=qs['offset'](_0x5b6cc9['query'][_0x92da('0x1f')]);}_0x33ce6f[_0x92da('0x41')]=qs[_0x92da('0x42')](_0x5b6cc9[_0x92da('0x3e')][_0x92da('0x42')]);_0x33ce6f[_0x92da('0x43')]=qs[_0x92da('0x3a')](_[_0x92da('0x44')](_0x5b6cc9['query'],_0x4f7533[_0x92da('0x3a')]),_0x528165);if(_0x5b6cc9[_0x92da('0x3e')][_0x92da('0x45')]){_0x33ce6f['where']=_[_0x92da('0x46')](_0x33ce6f[_0x92da('0x43')],{'$or':_[_0x92da('0x47')](_0x528165,function(_0x80ba2e){if(_0x80ba2e[_0x92da('0x36')]!=='VIRTUAL'){var _0x18e18f={};_0x18e18f[_0x80ba2e['name']]={'$like':'%'+_0x5b6cc9[_0x92da('0x3e')]['filter']+'%'};return _0x18e18f;}})});}_0x33ce6f=_[_0x92da('0x46')]({},_0x33ce6f,_0x5b6cc9['options']);var _0x1cd1a2={'where':_0x33ce6f['where']};return db[_0x92da('0x33')][_0x92da('0x21')](_0x1cd1a2)['then'](function(_0x5a658e){_0x9624bd[_0x92da('0x21')]=_0x5a658e;if(_0x5b6cc9[_0x92da('0x3e')][_0x92da('0x48')]){_0x33ce6f['include']=[{'all':!![]}];}return db[_0x92da('0x33')][_0x92da('0x49')](_0x33ce6f);})[_0x92da('0x29')](function(_0x37d3b0){_0x9624bd[_0x92da('0x4a')]=_0x37d3b0;return _0x9624bd;})['then'](respondWithFilteredResult(_0x40384b,_0x33ce6f))[_0x92da('0x4b')](handleError(_0x40384b,null));};exports[_0x92da('0x4c')]=function(_0x237587,_0x5e069f){var _0x1c3f22={'raw':!![],'where':{'id':_0x237587[_0x92da('0x4d')]['id']}},_0x1e4bec={};_0x1e4bec[_0x92da('0x38')]=_[_0x92da('0x39')](db[_0x92da('0x33')][_0x92da('0x34')]);_0x1e4bec[_0x92da('0x3e')]=_[_0x92da('0x39')](_0x237587[_0x92da('0x3e')]);_0x1e4bec['filters']=_[_0x92da('0x3b')](_0x1e4bec[_0x92da('0x38')],_0x1e4bec[_0x92da('0x3e')]);_0x1c3f22['attributes']=_[_0x92da('0x3b')](_0x1e4bec[_0x92da('0x38')],qs[_0x92da('0x3d')](_0x237587[_0x92da('0x3e')]['fields']));_0x1c3f22[_0x92da('0x3c')]=_0x1c3f22['attributes']['length']?_0x1c3f22[_0x92da('0x3c')]:_0x1e4bec[_0x92da('0x38')];if(_0x237587[_0x92da('0x3e')][_0x92da('0x48')]){_0x1c3f22[_0x92da('0x4e')]=[{'all':!![]}];}_0x1c3f22=_[_0x92da('0x46')]({},_0x1c3f22,_0x237587[_0x92da('0x4f')]);return db[_0x92da('0x33')][_0x92da('0x50')](_0x1c3f22)[_0x92da('0x29')](handleEntityNotFound(_0x5e069f,null))[_0x92da('0x29')](respondWithResult(_0x5e069f,null))['catch'](handleError(_0x5e069f,null));};exports[_0x92da('0x51')]=function(_0x29738a,_0x4e36df,_0xf4553b){return db[_0x92da('0x33')][_0x92da('0x50')]({'where':{'id':_0x29738a[_0x92da('0x4d')]['id']},'attributes':[_0x92da('0x30'),_0x92da('0x52'),_0x92da('0x53')],'raw':!![]})[_0x92da('0x29')](handleEntityNotFound(_0x4e36df,null))[_0x92da('0x29')](function(_0x4b824d){if(_0x4b824d){if(!fs['existsSync'](path[_0x92da('0x54')](config[_0x92da('0x55')],_0x92da('0x56'),_0x4b824d[_0x92da('0x52')]+'.'+_0x4b824d[_0x92da('0x53')]))){throw new db[(_0x92da('0x57'))]['ValidationError']('Sound\x20not\x20found');}return _0x4e36df[_0x92da('0x51')](path[_0x92da('0x54')](config['root'],'server/files/sounds/converted',util[_0x92da('0x58')](_0x92da('0x59'),_0x4b824d[_0x92da('0x52')],_0x4b824d[_0x92da('0x53')])),util[_0x92da('0x58')](_0x92da('0x59'),_0x4b824d[_0x92da('0x30')],_0x4b824d[_0x92da('0x53')]));}return null;})['catch'](handleError(_0x4e36df,null));};exports[_0x92da('0x5a')]=function(_0x484845,_0x551985,_0x21c9f4){var _0x377b45={'name':path['basename'](_0x484845[_0x92da('0x5b')][_0x92da('0x5c')],path[_0x92da('0x5d')](_0x484845['file'][_0x92da('0x5c')])),'save_name':path[_0x92da('0x5e')](_0x484845['file']['filename'],path[_0x92da('0x5d')](_0x484845['file'][_0x92da('0x5f')])),'original_format':path[_0x92da('0x5d')](_0x484845[_0x92da('0x5b')]['originalname'])[_0x92da('0x60')](0x1),'converted_format':'wav'};var _0xf709b6=path['join'](config[_0x92da('0x55')],_0x92da('0x61'),_0x484845['file'][_0x92da('0x5f')]);var _0x5612c9=path[_0x92da('0x54')](config['root'],_0x92da('0x56'),util[_0x92da('0x58')](_0x92da('0x59'),path['basename'](_0x484845[_0x92da('0x5b')][_0x92da('0x5f')],path[_0x92da('0x5d')](_0x484845[_0x92da('0x5b')]['filename'])),_0x377b45['converted_format']));logger['info'](_0x92da('0x62'),_0xf709b6);logger['info'](_0x92da('0x63'),_0x5612c9);try{fs[_0x92da('0x64')](_0xf709b6,parseInt(_0x92da('0x65'),0x8));var _0x5a00fb=sox[_0x92da('0x66')](_0xf709b6,_0x5612c9,{'sampleRate':0x1f40,'format':_0x92da('0x67'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5a00fb['on'](_0x92da('0x2f'),function(_0x33f815){fs['unlinkSync'](_0xf709b6);_0x551985[_0x92da('0x1d')](0x1f4)[_0x92da('0x31')](_0x33f815);});_0x5a00fb['on'](_0x92da('0x68'),function(_0x4135a2){_0x377b45['original_duration']=isNaN(_0x4135a2['duration'])?null:_0x4135a2[_0x92da('0x69')]*0x3e8;_0x377b45[_0x92da('0x6a')]=isNaN(_0x4135a2['sampleCount'])?null:_0x4135a2[_0x92da('0x6b')];_0x377b45[_0x92da('0x6c')]=isNaN(_0x4135a2['channelCount'])?null:_0x4135a2['channelCount'];_0x377b45[_0x92da('0x6d')]=isNaN(_0x4135a2[_0x92da('0x6e')])?null:_0x4135a2[_0x92da('0x6e')];_0x377b45[_0x92da('0x6f')]=isNaN(_0x4135a2[_0x92da('0x70')])?null:_0x4135a2[_0x92da('0x70')];});_0x5a00fb['on']('dest',function(_0x445f84){_0x377b45[_0x92da('0x71')]=isNaN(_0x445f84[_0x92da('0x69')])?null:_0x445f84[_0x92da('0x69')]*0x3e8;_0x377b45[_0x92da('0x72')]=isNaN(_0x445f84[_0x92da('0x6b')])?null:_0x445f84[_0x92da('0x6b')];_0x377b45[_0x92da('0x73')]=isNaN(_0x445f84['channelCount'])?null:_0x445f84['channelCount'];_0x377b45[_0x92da('0x74')]=isNaN(_0x445f84['bitRate'])?null:_0x445f84[_0x92da('0x6e')];_0x377b45[_0x92da('0x75')]=isNaN(_0x445f84['sampleRate'])?null:_0x445f84[_0x92da('0x70')];});_0x5a00fb['on']('end',function(){fs[_0x92da('0x64')](_0x5612c9,parseInt('0777',0x8));return db[_0x92da('0x33')][_0x92da('0x5a')](_0x377b45)[_0x92da('0x29')](function(_0x891521){var _0x99175f={'role':_0x484845[_0x92da('0x76')][_0x92da('0x77')],'userProfileId':_0x484845['body'][_0x92da('0x78')]};if(!_0x99175f)throw new Error(_0x92da('0x79'));if(_0x99175f[_0x92da('0x77')]===_0x92da('0x7a')){var _0x1da334=_0x891521[_0x92da('0x2b')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x92da('0x2c'),'userProfileId':_0x99175f['userProfileId']},'raw':!![]})[_0x92da('0x29')](function(_0x1c586d){if(_0x1c586d&&_0x1c586d[_0x92da('0x7b')]===0x0){return db[_0x92da('0x2d')]['create']({'name':_0x1da334[_0x92da('0x30')],'resourceId':_0x1da334['id'],'type':_0x1c586d[_0x92da('0x30')],'sectionId':_0x1c586d['id']},{})[_0x92da('0x29')](function(){return _0x891521;});}else{return _0x891521;}})[_0x92da('0x4b')](function(_0x49d0cd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49d0cd);throw _0x49d0cd;});}return _0x891521;})[_0x92da('0x29')](respondWithResult(_0x551985,null))[_0x92da('0x4b')](handleError(_0x551985,null));});_0x5a00fb[_0x92da('0x7c')]();}catch(_0x5344a7){_0x551985[_0x92da('0x1d')](0x1f4)[_0x92da('0x31')](_0x5344a7);}};exports['update']=function(_0x39eb31,_0x5d9b78,_0x28b357){return db['Sound'][_0x92da('0x50')]({'where':{'id':_0x39eb31[_0x92da('0x4d')]['id']}})[_0x92da('0x29')](handleEntityNotFound(_0x5d9b78,null))[_0x92da('0x29')](saveUpdates(_[_0x92da('0x44')](_0x39eb31['body'],[_0x92da('0x30'),_0x92da('0x7d')]),null))[_0x92da('0x29')](respondWithResult(_0x5d9b78,null))[_0x92da('0x4b')](handleError(_0x5d9b78,null));};exports[_0x92da('0x7e')]=function(_0xe71de6,_0x176b99,_0x57d7ea){return db[_0x92da('0x33')][_0x92da('0x50')]({'where':{'id':_0xe71de6[_0x92da('0x4d')]['id']}})[_0x92da('0x29')](function(_0x39f98b){if(_0x39f98b){return _0x39f98b[_0x92da('0x2a')]();}})[_0x92da('0x29')](function(_0x5177c2){var _0x156daf=path[_0x92da('0x54')](config[_0x92da('0x55')],_0x92da('0x61'),util[_0x92da('0x58')](_0x92da('0x59'),_0x5177c2[_0x92da('0x52')],_0x5177c2[_0x92da('0x7f')]));var _0x5d8f0d=path[_0x92da('0x54')](config['root'],_0x92da('0x56'),util['format'](_0x92da('0x59'),_0x5177c2['save_name'],_0x5177c2[_0x92da('0x53')]));fs[_0x92da('0x80')](_0x156daf);fs[_0x92da('0x80')](_0x5d8f0d);return _0x5177c2;})['then'](function(_0x8d030f){if(_0x8d030f){return _0x176b99[_0x92da('0x1d')](0xcc)[_0x92da('0x2e')]();}})['then'](handleEntityNotFound(_0x176b99,null))[_0x92da('0x4b')](handleError(_0x176b99,null));}; \ No newline at end of file +var _0x69e8=['stack','name','index','map','Sound','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','download','save_name','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','ValidationError','root','format','%s.%s','create','file','originalname','extname','basename','substring','wav','server/files/sounds/original','filename','info','Sound\x20upload\x20destination:\x20%s','unlinkSync','send','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','bitRate','chmodSync','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','UserProfileResource','start','update','params','description','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','Sounds','error'];(function(_0x52af0b,_0x580c97){var _0x40ed35=function(_0x545038){while(--_0x545038){_0x52af0b['push'](_0x52af0b['shift']());}};_0x40ed35(++_0x580c97);}(_0x69e8,0xd0));var _0x869e=function(_0x542ae4,_0x5b2365){_0x542ae4=_0x542ae4-0x0;var _0x4a0d67=_0x69e8[_0x542ae4];return _0x4a0d67;};'use strict';var emlformat=require(_0x869e('0x0'));var rimraf=require(_0x869e('0x1'));var zipdir=require(_0x869e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x869e('0x3'));var moment=require('moment');var BPromise=require(_0x869e('0x4'));var Mustache=require(_0x869e('0x5'));var util=require(_0x869e('0x6'));var path=require('path');var sox=require(_0x869e('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x869e('0x8'));var _=require(_0x869e('0x9'));var squel=require(_0x869e('0xa'));var crypto=require(_0x869e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x869e('0xc'));var toCsv=require(_0x869e('0xd'));var querystring=require(_0x869e('0xe'));var Papa=require(_0x869e('0xf'));var Redis=require(_0x869e('0x10'));var authService=require(_0x869e('0x11'));var qs=require(_0x869e('0x12'));var as=require(_0x869e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x869e('0x14'))(_0x869e('0x15'));var utils=require(_0x869e('0x16'));var config=require(_0x869e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x869e('0x18'))['db'];function respondWithStatusCode(_0x35c506,_0x1360c3){_0x1360c3=_0x1360c3||0xcc;return function(_0x1828db){if(_0x1828db){return _0x35c506[_0x869e('0x19')](_0x1360c3);}return _0x35c506[_0x869e('0x1a')](_0x1360c3)[_0x869e('0x1b')]();};}function respondWithResult(_0x4de83d,_0x4a5682){_0x4a5682=_0x4a5682||0xc8;return function(_0x3f8bf1){if(_0x3f8bf1){return _0x4de83d['status'](_0x4a5682)[_0x869e('0x1c')](_0x3f8bf1);}};}function respondWithFilteredResult(_0x2fd15d,_0x1f5116){return function(_0xf434c1){if(_0xf434c1){var _0x2f4dde=typeof _0x1f5116[_0x869e('0x1d')]===_0x869e('0x1e')&&typeof _0x1f5116['limit']===_0x869e('0x1e');var _0x23fea1=_0xf434c1[_0x869e('0x1f')];var _0x2c4f93=_0x2f4dde?0x0:_0x1f5116['offset'];var _0x21f564=_0x2f4dde?_0xf434c1['count']:_0x1f5116[_0x869e('0x1d')]+_0x1f5116[_0x869e('0x20')];var _0x783db3;if(_0x21f564>=_0x23fea1){_0x21f564=_0x23fea1;_0x783db3=0xc8;}else{_0x783db3=0xce;}_0x2fd15d[_0x869e('0x1a')](_0x783db3);return _0x2fd15d[_0x869e('0x21')](_0x869e('0x22'),_0x2c4f93+'-'+_0x21f564+'/'+_0x23fea1)[_0x869e('0x1c')](_0xf434c1);}return null;};}function patchUpdates(_0x360e65){return function(_0x55ab59){try{jsonpatch[_0x869e('0x23')](_0x55ab59,_0x360e65,!![]);}catch(_0x3b85c8){return BPromise[_0x869e('0x24')](_0x3b85c8);}return _0x55ab59[_0x869e('0x25')]();};}function saveUpdates(_0x16f2ab,_0x5276c8){return function(_0x2917f8){if(_0x2917f8){return _0x2917f8['update'](_0x16f2ab)[_0x869e('0x26')](function(_0x1665e4){return _0x1665e4;});}return null;};}function removeEntity(_0x5dc8a5,_0x36f519){return function(_0x1f8801){if(_0x1f8801){return _0x1f8801[_0x869e('0x27')]()[_0x869e('0x26')](function(){var _0x6a4ece=_0x1f8801['get']({'plain':!![]});var _0x3ad8a7=_0x869e('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x3ad8a7,'resourceId':_0x6a4ece['id']}})[_0x869e('0x26')](function(){return _0x1f8801;});})[_0x869e('0x26')](function(){_0x5dc8a5[_0x869e('0x1a')](0xcc)[_0x869e('0x1b')]();});}};}function handleEntityNotFound(_0x3cbd33,_0x4781eb){return function(_0x2120a0){if(!_0x2120a0){_0x3cbd33[_0x869e('0x19')](0x194);}return _0x2120a0;};}function handleError(_0x3a3055,_0x44d438){_0x44d438=_0x44d438||0x1f4;return function(_0x4e6624){logger[_0x869e('0x29')](_0x4e6624[_0x869e('0x2a')]);if(_0x4e6624[_0x869e('0x2b')]){delete _0x4e6624[_0x869e('0x2b')];}_0x3a3055['status'](_0x44d438)['send'](_0x4e6624);};}exports[_0x869e('0x2c')]=function(_0x322922,_0x584d55){var _0x574fdb={},_0x458034={},_0x223754={'count':0x0,'rows':[]};var _0x303e34=_[_0x869e('0x2d')](db[_0x869e('0x2e')][_0x869e('0x2f')],function(_0x54fdf5){return{'name':_0x54fdf5['fieldName'],'type':_0x54fdf5[_0x869e('0x30')][_0x869e('0x31')]};});_0x458034[_0x869e('0x32')]=_['map'](_0x303e34,'name');_0x458034[_0x869e('0x33')]=_[_0x869e('0x34')](_0x322922['query']);_0x458034['filters']=_[_0x869e('0x35')](_0x458034[_0x869e('0x32')],_0x458034['query']);_0x574fdb[_0x869e('0x36')]=_[_0x869e('0x35')](_0x458034[_0x869e('0x32')],qs['fields'](_0x322922[_0x869e('0x33')][_0x869e('0x37')]));_0x574fdb['attributes']=_0x574fdb[_0x869e('0x36')][_0x869e('0x38')]?_0x574fdb[_0x869e('0x36')]:_0x458034[_0x869e('0x32')];if(!_0x322922[_0x869e('0x33')][_0x869e('0x39')](_0x869e('0x3a'))){_0x574fdb[_0x869e('0x20')]=qs[_0x869e('0x20')](_0x322922[_0x869e('0x33')]['limit']);_0x574fdb[_0x869e('0x1d')]=qs[_0x869e('0x1d')](_0x322922[_0x869e('0x33')][_0x869e('0x1d')]);}_0x574fdb[_0x869e('0x3b')]=qs[_0x869e('0x3c')](_0x322922[_0x869e('0x33')][_0x869e('0x3c')]);_0x574fdb[_0x869e('0x3d')]=qs[_0x869e('0x3e')](_[_0x869e('0x3f')](_0x322922[_0x869e('0x33')],_0x458034['filters']),_0x303e34);if(_0x322922[_0x869e('0x33')][_0x869e('0x40')]){_0x574fdb[_0x869e('0x3d')]=_[_0x869e('0x41')](_0x574fdb[_0x869e('0x3d')],{'$or':_[_0x869e('0x2d')](_0x303e34,function(_0x487e49){if(_0x487e49[_0x869e('0x30')]!==_0x869e('0x42')){var _0x3a4c40={};_0x3a4c40[_0x487e49[_0x869e('0x2b')]]={'$like':'%'+_0x322922['query'][_0x869e('0x40')]+'%'};return _0x3a4c40;}})});}_0x574fdb=_[_0x869e('0x41')]({},_0x574fdb,_0x322922['options']);var _0x5a93d7={'where':_0x574fdb[_0x869e('0x3d')]};return db['Sound'][_0x869e('0x1f')](_0x5a93d7)[_0x869e('0x26')](function(_0x1ab47f){_0x223754[_0x869e('0x1f')]=_0x1ab47f;if(_0x322922[_0x869e('0x33')][_0x869e('0x43')]){_0x574fdb[_0x869e('0x44')]=[{'all':!![]}];}return db[_0x869e('0x2e')][_0x869e('0x45')](_0x574fdb);})[_0x869e('0x26')](function(_0x3c311f){_0x223754[_0x869e('0x46')]=_0x3c311f;return _0x223754;})[_0x869e('0x26')](respondWithFilteredResult(_0x584d55,_0x574fdb))[_0x869e('0x47')](handleError(_0x584d55,null));};exports[_0x869e('0x48')]=function(_0x551f54,_0x5da65c){var _0xfcb922={'raw':!![],'where':{'id':_0x551f54['params']['id']}},_0x199524={};_0x199524['model']=_[_0x869e('0x34')](db[_0x869e('0x2e')][_0x869e('0x2f')]);_0x199524[_0x869e('0x33')]=_[_0x869e('0x34')](_0x551f54['query']);_0x199524['filters']=_[_0x869e('0x35')](_0x199524[_0x869e('0x32')],_0x199524['query']);_0xfcb922[_0x869e('0x36')]=_[_0x869e('0x35')](_0x199524['model'],qs[_0x869e('0x37')](_0x551f54[_0x869e('0x33')][_0x869e('0x37')]));_0xfcb922[_0x869e('0x36')]=_0xfcb922[_0x869e('0x36')][_0x869e('0x38')]?_0xfcb922[_0x869e('0x36')]:_0x199524[_0x869e('0x32')];if(_0x551f54[_0x869e('0x33')][_0x869e('0x43')]){_0xfcb922[_0x869e('0x44')]=[{'all':!![]}];}_0xfcb922=_[_0x869e('0x41')]({},_0xfcb922,_0x551f54[_0x869e('0x49')]);return db[_0x869e('0x2e')][_0x869e('0x4a')](_0xfcb922)[_0x869e('0x26')](handleEntityNotFound(_0x5da65c,null))['then'](respondWithResult(_0x5da65c,null))['catch'](handleError(_0x5da65c,null));};exports[_0x869e('0x4b')]=function(_0x49248c,_0x15429c,_0x4679c5){return db[_0x869e('0x2e')][_0x869e('0x4a')]({'where':{'id':_0x49248c['params']['id']},'attributes':['name',_0x869e('0x4c'),_0x869e('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x15429c,null))[_0x869e('0x26')](function(_0x1b2357){if(_0x1b2357){if(!fs[_0x869e('0x4e')](path[_0x869e('0x4f')](config['root'],_0x869e('0x50'),_0x1b2357[_0x869e('0x4c')]+'.'+_0x1b2357[_0x869e('0x4d')]))){throw new db[(_0x869e('0x51'))][(_0x869e('0x52'))]('Sound\x20not\x20found');}return _0x15429c[_0x869e('0x4b')](path[_0x869e('0x4f')](config[_0x869e('0x53')],'server/files/sounds/converted',util[_0x869e('0x54')](_0x869e('0x55'),_0x1b2357[_0x869e('0x4c')],_0x1b2357[_0x869e('0x4d')])),util[_0x869e('0x54')](_0x869e('0x55'),_0x1b2357[_0x869e('0x2b')],_0x1b2357[_0x869e('0x4d')]));}return null;})[_0x869e('0x47')](handleError(_0x15429c,null));};exports[_0x869e('0x56')]=function(_0x9f865c,_0x271ece,_0x5c3d4a){var _0x1c6d51={'name':path['basename'](_0x9f865c[_0x869e('0x57')][_0x869e('0x58')],path[_0x869e('0x59')](_0x9f865c['file'][_0x869e('0x58')])),'save_name':path[_0x869e('0x5a')](_0x9f865c[_0x869e('0x57')]['filename'],path[_0x869e('0x59')](_0x9f865c[_0x869e('0x57')]['filename'])),'original_format':path[_0x869e('0x59')](_0x9f865c[_0x869e('0x57')]['originalname'])[_0x869e('0x5b')](0x1),'converted_format':_0x869e('0x5c')};var _0x250dc3=path[_0x869e('0x4f')](config[_0x869e('0x53')],_0x869e('0x5d'),_0x9f865c[_0x869e('0x57')][_0x869e('0x5e')]);var _0x46b83a=path[_0x869e('0x4f')](config[_0x869e('0x53')],_0x869e('0x50'),util[_0x869e('0x54')](_0x869e('0x55'),path[_0x869e('0x5a')](_0x9f865c[_0x869e('0x57')][_0x869e('0x5e')],path[_0x869e('0x59')](_0x9f865c[_0x869e('0x57')][_0x869e('0x5e')])),_0x1c6d51['converted_format']));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x250dc3);logger[_0x869e('0x5f')](_0x869e('0x60'),_0x46b83a);try{fs['chmodSync'](_0x250dc3,parseInt('0777',0x8));var _0x499ebb=sox['transcode'](_0x250dc3,_0x46b83a,{'sampleRate':0x1f40,'format':_0x869e('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x499ebb['on']('error',function(_0x24a459){fs[_0x869e('0x61')](_0x250dc3);_0x271ece['status'](0x1f4)[_0x869e('0x62')](_0x24a459);});_0x499ebb['on']('src',function(_0x28d256){_0x1c6d51['original_duration']=isNaN(_0x28d256['duration'])?null:_0x28d256[_0x869e('0x63')]*0x3e8;_0x1c6d51[_0x869e('0x64')]=isNaN(_0x28d256[_0x869e('0x65')])?null:_0x28d256[_0x869e('0x65')];_0x1c6d51[_0x869e('0x66')]=isNaN(_0x28d256[_0x869e('0x67')])?null:_0x28d256[_0x869e('0x67')];_0x1c6d51[_0x869e('0x68')]=isNaN(_0x28d256['bitRate'])?null:_0x28d256['bitRate'];_0x1c6d51[_0x869e('0x69')]=isNaN(_0x28d256[_0x869e('0x6a')])?null:_0x28d256[_0x869e('0x6a')];});_0x499ebb['on'](_0x869e('0x6b'),function(_0x1e820c){_0x1c6d51['converted_duration']=isNaN(_0x1e820c[_0x869e('0x63')])?null:_0x1e820c[_0x869e('0x63')]*0x3e8;_0x1c6d51[_0x869e('0x6c')]=isNaN(_0x1e820c[_0x869e('0x65')])?null:_0x1e820c[_0x869e('0x65')];_0x1c6d51[_0x869e('0x6d')]=isNaN(_0x1e820c[_0x869e('0x67')])?null:_0x1e820c[_0x869e('0x67')];_0x1c6d51[_0x869e('0x6e')]=isNaN(_0x1e820c[_0x869e('0x6f')])?null:_0x1e820c['bitRate'];_0x1c6d51['converted_sampleRate']=isNaN(_0x1e820c['sampleRate'])?null:_0x1e820c[_0x869e('0x6a')];});_0x499ebb['on'](_0x869e('0x1b'),function(){fs[_0x869e('0x70')](_0x46b83a,parseInt('0777',0x8));return db[_0x869e('0x2e')][_0x869e('0x56')](_0x1c6d51)[_0x869e('0x26')](function(_0x113087){var _0x26605a={'role':_0x9f865c['body'][_0x869e('0x71')],'userProfileId':_0x9f865c[_0x869e('0x72')][_0x869e('0x73')]};if(!_0x26605a)throw new Error(_0x869e('0x74'));if(_0x26605a[_0x869e('0x71')]===_0x869e('0x75')){var _0x300ecb=_0x113087[_0x869e('0x76')]({'plain':!![]});return db[_0x869e('0x77')][_0x869e('0x4a')]({'where':{'name':_0x869e('0x28'),'userProfileId':_0x26605a[_0x869e('0x73')]},'raw':!![]})[_0x869e('0x26')](function(_0x37835d){if(_0x37835d&&_0x37835d['autoAssociation']===0x0){return db[_0x869e('0x78')][_0x869e('0x56')]({'name':_0x300ecb[_0x869e('0x2b')],'resourceId':_0x300ecb['id'],'type':_0x37835d[_0x869e('0x2b')],'sectionId':_0x37835d['id']},{})[_0x869e('0x26')](function(){return _0x113087;});}else{return _0x113087;}})[_0x869e('0x47')](function(_0x27a9e2){logger[_0x869e('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27a9e2);throw _0x27a9e2;});}return _0x113087;})[_0x869e('0x26')](respondWithResult(_0x271ece,null))[_0x869e('0x47')](handleError(_0x271ece,null));});_0x499ebb[_0x869e('0x79')]();}catch(_0x22fa5c){_0x271ece[_0x869e('0x1a')](0x1f4)['send'](_0x22fa5c);}};exports[_0x869e('0x7a')]=function(_0x5d3e3e,_0x24b797,_0x1b7eb1){return db[_0x869e('0x2e')][_0x869e('0x4a')]({'where':{'id':_0x5d3e3e[_0x869e('0x7b')]['id']}})[_0x869e('0x26')](handleEntityNotFound(_0x24b797,null))[_0x869e('0x26')](saveUpdates(_[_0x869e('0x3f')](_0x5d3e3e[_0x869e('0x72')],[_0x869e('0x2b'),_0x869e('0x7c')]),null))[_0x869e('0x26')](respondWithResult(_0x24b797,null))[_0x869e('0x47')](handleError(_0x24b797,null));};exports['delete']=function(_0x1b50b8,_0x4096a6,_0x558409){return db[_0x869e('0x2e')][_0x869e('0x4a')]({'where':{'id':_0x1b50b8[_0x869e('0x7b')]['id']}})['then'](function(_0xea299f){if(_0xea299f){return _0xea299f[_0x869e('0x27')]();}})[_0x869e('0x26')](function(_0x20835a){var _0x459b7a=path[_0x869e('0x4f')](config[_0x869e('0x53')],_0x869e('0x5d'),util[_0x869e('0x54')](_0x869e('0x55'),_0x20835a['save_name'],_0x20835a['original_format']));var _0x5ce16c=path['join'](config[_0x869e('0x53')],_0x869e('0x50'),util[_0x869e('0x54')](_0x869e('0x55'),_0x20835a[_0x869e('0x4c')],_0x20835a[_0x869e('0x4d')]));fs[_0x869e('0x61')](_0x459b7a);fs[_0x869e('0x61')](_0x5ce16c);return _0x20835a;})[_0x869e('0x26')](function(_0x46894e){if(_0x46894e){return _0x4096a6[_0x869e('0x1a')](0xcc)[_0x869e('0x1b')]();}})[_0x869e('0x26')](handleEntityNotFound(_0x4096a6,null))[_0x869e('0x47')](handleError(_0x4096a6,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index c02c0a3..a254ccd 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 _0x300a=['Sound','tools_sounds','lodash','util','../../config/logger','moment','bluebird','../../config/environment','exports'];(function(_0x37430c,_0x485306){var _0x42f0a7=function(_0x1e0fab){while(--_0x1e0fab){_0x37430c['push'](_0x37430c['shift']());}};_0x42f0a7(++_0x485306);}(_0x300a,0x92));var _0xa300=function(_0x4a7b2b,_0x3366e1){_0x4a7b2b=_0x4a7b2b-0x0;var _0x35e381=_0x300a[_0x4a7b2b];return _0x35e381;};'use strict';var _=require(_0xa300('0x0'));var util=require(_0xa300('0x1'));var logger=require(_0xa300('0x2'))('api');var moment=require(_0xa300('0x3'));var BPromise=require(_0xa300('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa300('0x5'));var attributes=require('./sound.attributes');module[_0xa300('0x6')]=function(_0x2e6c99,_0x599573){return _0x2e6c99['define'](_0xa300('0x7'),attributes,{'tableName':_0xa300('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a43=['../../config/logger','api','moment','path','rimraf','./sound.attributes','exports','define','Sound','tools_sounds','util'];(function(_0x12d883,_0x2c955a){var _0x1ba14c=function(_0x2f4c3d){while(--_0x2f4c3d){_0x12d883['push'](_0x12d883['shift']());}};_0x1ba14c(++_0x2c955a);}(_0x3a43,0x175));var _0x33a4=function(_0x5bc5fe,_0x2afaef){_0x5bc5fe=_0x5bc5fe-0x0;var _0x298ea7=_0x3a43[_0x5bc5fe];return _0x298ea7;};'use strict';var _=require('lodash');var util=require(_0x33a4('0x0'));var logger=require(_0x33a4('0x1'))(_0x33a4('0x2'));var moment=require(_0x33a4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x33a4('0x4'));var rimraf=require(_0x33a4('0x5'));var config=require('../../config/environment');var attributes=require(_0x33a4('0x6'));module[_0x33a4('0x7')]=function(_0x5baaf0,_0x2b191c){return _0x5baaf0[_0x33a4('0x8')](_0x33a4('0x9'),attributes,{'tableName':_0x33a4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 7e75862..5b0e357 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 _0xa51c=['info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','Sound','options','raw','where','attributes','map','include','model','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x5a9469,_0x16fa8e){var _0x3ee932=function(_0x3faffd){while(--_0x3faffd){_0x5a9469['push'](_0x5a9469['shift']());}};_0x3ee932(++_0x16fa8e);}(_0xa51c,0x12b));var _0xca51=function(_0x4d60f0,_0x538303){_0x4d60f0=_0x4d60f0-0x0;var _0x2bab3a=_0xa51c[_0x4d60f0];return _0x2bab3a;};'use strict';var _=require(_0xca51('0x0'));var util=require(_0xca51('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xca51('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca51('0x3'))['db'];var utils=require(_0xca51('0x4'));var logger=require(_0xca51('0x5'))('rpc');var config=require(_0xca51('0x6'));var jayson=require(_0xca51('0x7'));var client=jayson[_0xca51('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c7975,_0x2a97fc,_0x342d72){return new BPromise(function(_0x322e49,_0x111f78){return client[_0xca51('0x9')](_0x2c7975,_0x342d72)[_0xca51('0xa')](function(_0x1ce287){logger[_0xca51('0xb')]('Sound,\x20%s,\x20%s',_0x2a97fc,_0xca51('0xc'));logger[_0xca51('0xd')](_0xca51('0xe'),_0x2a97fc,_0xca51('0xc'),JSON[_0xca51('0xf')](_0x1ce287));if(_0x1ce287[_0xca51('0x10')]){if(_0x1ce287[_0xca51('0x10')][_0xca51('0x11')]===0x1f4){logger[_0xca51('0x10')](_0xca51('0x12'),_0x2a97fc,_0x1ce287['error']['message']);return _0x111f78(_0x1ce287[_0xca51('0x10')]['message']);}logger['error'](_0xca51('0x12'),_0x2a97fc,_0x1ce287['error'][_0xca51('0x13')]);return _0x322e49(_0x1ce287['error'][_0xca51('0x13')]);}else{logger['info'](_0xca51('0x12'),_0x2a97fc,_0xca51('0xc'));_0x322e49(_0x1ce287[_0xca51('0x14')][_0xca51('0x13')]);}})[_0xca51('0x15')](function(_0x3fc6db){logger[_0xca51('0x10')](_0xca51('0x12'),_0x2a97fc,_0x3fc6db);_0x111f78(_0x3fc6db);});});}exports[_0xca51('0x16')]=function(_0x22fd3c){var _0x67fa19=this;return new Promise(function(_0x12386b,_0x6a4ab1){return db[_0xca51('0x17')]['find']({'raw':_0x22fd3c['options']?_0x22fd3c[_0xca51('0x18')][_0xca51('0x19')]===undefined?!![]:![]:!![],'where':_0x22fd3c['options']?_0x22fd3c[_0xca51('0x18')][_0xca51('0x1a')]||null:null,'attributes':_0x22fd3c[_0xca51('0x18')]?_0x22fd3c['options'][_0xca51('0x1b')]||null:null,'include':_0x22fd3c[_0xca51('0x18')]?_0x22fd3c[_0xca51('0x18')]['include']?_[_0xca51('0x1c')](_0x22fd3c[_0xca51('0x18')][_0xca51('0x1d')],function(_0x4b8a00){return{'model':db[_0x4b8a00[_0xca51('0x1e')]],'as':_0x4b8a00['as'],'attributes':_0x4b8a00['attributes'],'include':_0x4b8a00[_0xca51('0x1d')]?_[_0xca51('0x1c')](_0x4b8a00[_0xca51('0x1d')],function(_0x43b4d4){return{'model':db[_0x43b4d4[_0xca51('0x1e')]],'as':_0x43b4d4['as'],'attributes':_0x43b4d4[_0xca51('0x1b')],'include':_0x43b4d4[_0xca51('0x1d')]?_[_0xca51('0x1c')](_0x43b4d4[_0xca51('0x1d')],function(_0x3fab8b){return{'model':db[_0x3fab8b[_0xca51('0x1e')]],'as':_0x3fab8b['as'],'attributes':_0x3fab8b['attributes']};}):[]};}):[]};}):[]:[]})[_0xca51('0xa')](function(_0xca6389){logger[_0xca51('0xb')]('ShowSound',_0x22fd3c);logger['debug']('ShowSound',_0x22fd3c,JSON[_0xca51('0xf')](_0xca6389));_0x12386b(_0xca6389);})[_0xca51('0x15')](function(_0x543392){logger['error'](_0xca51('0x16'),_0x543392['message'],_0x22fd3c);_0x6a4ab1(_0x67fa19[_0xca51('0x10')](0x1f4,_0x543392[_0xca51('0x13')]));});});}; \ No newline at end of file +var _0x78ff=['include','map','model','attributes','ShowSound','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','result','find','options','raw'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x78ff,0x7e));var _0xf78f=function(_0x2da72f,_0x3cc558){_0x2da72f=_0x2da72f-0x0;var _0x4b18bf=_0x78ff[_0x2da72f];return _0x4b18bf;};'use strict';var _=require(_0xf78f('0x0'));var util=require('util');var moment=require(_0xf78f('0x1'));var BPromise=require(_0xf78f('0x2'));var rs=require(_0xf78f('0x3'));var fs=require('fs');var Redis=require(_0xf78f('0x4'));var db=require(_0xf78f('0x5'))['db'];var utils=require(_0xf78f('0x6'));var logger=require(_0xf78f('0x7'))('rpc');var config=require(_0xf78f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf78f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x238986,_0x4aafc0,_0x29aab3){return new BPromise(function(_0x263bf8,_0x64263c){return client[_0xf78f('0xa')](_0x238986,_0x29aab3)[_0xf78f('0xb')](function(_0x3858d2){logger[_0xf78f('0xc')](_0xf78f('0xd'),_0x4aafc0,_0xf78f('0xe'));logger[_0xf78f('0xf')](_0xf78f('0x10'),_0x4aafc0,_0xf78f('0xe'),JSON[_0xf78f('0x11')](_0x3858d2));if(_0x3858d2['error']){if(_0x3858d2[_0xf78f('0x12')]['code']===0x1f4){logger['error'](_0xf78f('0xd'),_0x4aafc0,_0x3858d2['error'][_0xf78f('0x13')]);return _0x64263c(_0x3858d2[_0xf78f('0x12')]['message']);}logger[_0xf78f('0x12')](_0xf78f('0xd'),_0x4aafc0,_0x3858d2[_0xf78f('0x12')]['message']);return _0x263bf8(_0x3858d2[_0xf78f('0x12')][_0xf78f('0x13')]);}else{logger[_0xf78f('0xc')](_0xf78f('0xd'),_0x4aafc0,_0xf78f('0xe'));_0x263bf8(_0x3858d2[_0xf78f('0x14')][_0xf78f('0x13')]);}})['catch'](function(_0x25dba4){logger[_0xf78f('0x12')](_0xf78f('0xd'),_0x4aafc0,_0x25dba4);_0x64263c(_0x25dba4);});});}exports['ShowSound']=function(_0x519676){var _0x15abff=this;return new Promise(function(_0x3b7813,_0x3fb077){return db['Sound'][_0xf78f('0x15')]({'raw':_0x519676[_0xf78f('0x16')]?_0x519676[_0xf78f('0x16')][_0xf78f('0x17')]===undefined?!![]:![]:!![],'where':_0x519676[_0xf78f('0x16')]?_0x519676[_0xf78f('0x16')]['where']||null:null,'attributes':_0x519676[_0xf78f('0x16')]?_0x519676[_0xf78f('0x16')]['attributes']||null:null,'include':_0x519676['options']?_0x519676['options'][_0xf78f('0x18')]?_[_0xf78f('0x19')](_0x519676[_0xf78f('0x16')][_0xf78f('0x18')],function(_0x139915){return{'model':db[_0x139915[_0xf78f('0x1a')]],'as':_0x139915['as'],'attributes':_0x139915['attributes'],'include':_0x139915[_0xf78f('0x18')]?_[_0xf78f('0x19')](_0x139915[_0xf78f('0x18')],function(_0x41f9fa){return{'model':db[_0x41f9fa['model']],'as':_0x41f9fa['as'],'attributes':_0x41f9fa['attributes'],'include':_0x41f9fa[_0xf78f('0x18')]?_[_0xf78f('0x19')](_0x41f9fa[_0xf78f('0x18')],function(_0xc37c25){return{'model':db[_0xc37c25['model']],'as':_0xc37c25['as'],'attributes':_0xc37c25[_0xf78f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ea3f4){logger['info'](_0xf78f('0x1c'),_0x519676);logger[_0xf78f('0xf')](_0xf78f('0x1c'),_0x519676,JSON[_0xf78f('0x11')](_0x1ea3f4));_0x3b7813(_0x1ea3f4);})[_0xf78f('0x1d')](function(_0x3c55bc){logger[_0xf78f('0x12')]('ShowSound',_0x3c55bc[_0xf78f('0x13')],_0x519676);_0x3fb077(_0x15abff[_0xf78f('0x12')](0x1f4,_0x3c55bc[_0xf78f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 45e0e6f..28cda47 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 _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x8603,0x190));var _0x3860=function(_0x431f1b,_0x2fbc9e){_0x431f1b=_0x431f1b-0x0;var _0x426266=_0x8603[_0x431f1b];return _0x426266;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file +var _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update','delete','destroy'];(function(_0x5da0d5,_0x1e3c5e){var _0x550720=function(_0xad2bc0){while(--_0xad2bc0){_0x5da0d5['push'](_0x5da0d5['shift']());}};_0x550720(++_0x1e3c5e);}(_0x5f66,0x1a0));var _0x65f6=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x5f66[_0x164eca];return _0x2ce562;};'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('./squareMessage.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0xb')]('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router['put']('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0xe')](_0x65f6('0x9'),auth['isAuthenticated'](),controller[_0x65f6('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 4b997b7..b2efec9 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 _0xd6bf=['medium','ENUM','out','STRING','sequelize','TEXT'];(function(_0x188ae7,_0x3dc0c0){var _0x3c758b=function(_0x238d26){while(--_0x238d26){_0x188ae7['push'](_0x188ae7['shift']());}};_0x3c758b(++_0x3dc0c0);}(_0xd6bf,0x196));var _0xfd6b=function(_0x5d33c2,_0x126a47){_0x5d33c2=_0x5d33c2-0x0;var _0x454d5c=_0xd6bf[_0x5d33c2];return _0x454d5c;};'use strict';var Sequelize=require(_0xfd6b('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xfd6b('0x1')](_0xfd6b('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0xfd6b('0x3')]('in',_0xfd6b('0x4')),'defaultValue':_0xfd6b('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xfd6b('0x5')]},'providerResponse':{'type':Sequelize[_0xfd6b('0x1')]}}; \ No newline at end of file +var _0xf4f0=['out','STRING','sequelize','exports','TEXT','medium','ENUM'];(function(_0x2c8fc5,_0x313ec9){var _0x33b6b1=function(_0x3c9ca3){while(--_0x3c9ca3){_0x2c8fc5['push'](_0x2c8fc5['shift']());}};_0x33b6b1(++_0x313ec9);}(_0xf4f0,0x1bb));var _0x0f4f=function(_0x3c7ec9,_0x5ae336){_0x3c7ec9=_0x3c7ec9-0x0;var _0x505422=_0xf4f0[_0x3c7ec9];return _0x505422;};'use strict';var Sequelize=require(_0x0f4f('0x0'));module[_0x0f4f('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x0f4f('0x2')](_0x0f4f('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x0f4f('0x4')]('in',_0x0f4f('0x5')),'defaultValue':_0x0f4f('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x0f4f('0x6')]},'providerResponse':{'type':Sequelize[_0x0f4f('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index ed9bad3..9b73d86 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 _0x288a=['type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','keys','length','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x288a,0x188));var _0xa288=function(_0x994352,_0x25501c){_0x994352=_0x994352-0x0;var _0x308c96=_0x288a[_0x994352];return _0x308c96;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa288('0x0'));var zipdir=require(_0xa288('0x1'));var jsonpatch=require(_0xa288('0x2'));var rp=require(_0xa288('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa288('0x4'));var util=require('util');var path=require(_0xa288('0x5'));var sox=require(_0xa288('0x6'));var csv=require(_0xa288('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa288('0x8'));var _=require(_0xa288('0x9'));var squel=require(_0xa288('0xa'));var crypto=require('crypto');var jsforce=require(_0xa288('0xb'));var deskjs=require(_0xa288('0xc'));var toCsv=require(_0xa288('0x7'));var querystring=require(_0xa288('0xd'));var Papa=require(_0xa288('0xe'));var Redis=require(_0xa288('0xf'));var authService=require(_0xa288('0x10'));var qs=require(_0xa288('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa288('0x12'));var utils=require(_0xa288('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa288('0x14'));var db=require(_0xa288('0x15'))['db'];function respondWithStatusCode(_0x3ea123,_0x1cabf2){_0x1cabf2=_0x1cabf2||0xcc;return function(_0x17c9f4){if(_0x17c9f4){return _0x3ea123[_0xa288('0x16')](_0x1cabf2);}return _0x3ea123[_0xa288('0x17')](_0x1cabf2)[_0xa288('0x18')]();};}function respondWithResult(_0x3a529f,_0x687ba8){_0x687ba8=_0x687ba8||0xc8;return function(_0x43c808){if(_0x43c808){return _0x3a529f[_0xa288('0x17')](_0x687ba8)[_0xa288('0x19')](_0x43c808);}};}function respondWithFilteredResult(_0x2ab249,_0x21ec88){return function(_0x138b4e){if(_0x138b4e){var _0x571259=typeof _0x21ec88[_0xa288('0x1a')]===_0xa288('0x1b')&&typeof _0x21ec88[_0xa288('0x1c')]===_0xa288('0x1b');var _0x45d1f1=_0x138b4e[_0xa288('0x1d')];var _0x49d93c=_0x571259?0x0:_0x21ec88[_0xa288('0x1a')];var _0x3f14b7=_0x571259?_0x138b4e['count']:_0x21ec88['offset']+_0x21ec88[_0xa288('0x1c')];var _0x301879;if(_0x3f14b7>=_0x45d1f1){_0x3f14b7=_0x45d1f1;_0x301879=0xc8;}else{_0x301879=0xce;}_0x2ab249[_0xa288('0x17')](_0x301879);return _0x2ab249['set'](_0xa288('0x1e'),_0x49d93c+'-'+_0x3f14b7+'/'+_0x45d1f1)[_0xa288('0x19')](_0x138b4e);}return null;};}function patchUpdates(_0x1979d9){return function(_0x4c489e){try{jsonpatch[_0xa288('0x1f')](_0x4c489e,_0x1979d9,!![]);}catch(_0x283523){return BPromise[_0xa288('0x20')](_0x283523);}return _0x4c489e[_0xa288('0x21')]();};}function saveUpdates(_0x32e47d,_0x51c835){return function(_0x56c43b){if(_0x56c43b){return _0x56c43b[_0xa288('0x22')](_0x32e47d)[_0xa288('0x23')](function(_0x37ff1a){return _0x37ff1a;});}return null;};}function removeEntity(_0x2f9465,_0x4895bb){return function(_0x21eebc){if(_0x21eebc){return _0x21eebc[_0xa288('0x24')]()[_0xa288('0x23')](function(){_0x2f9465[_0xa288('0x17')](0xcc)[_0xa288('0x18')]();});}};}function handleEntityNotFound(_0x23f7b8,_0x1ac3c3){return function(_0x19ad60){if(!_0x19ad60){_0x23f7b8[_0xa288('0x16')](0x194);}return _0x19ad60;};}function handleError(_0x54a27b,_0x2cdd34){_0x2cdd34=_0x2cdd34||0x1f4;return function(_0xffc6b4){logger[_0xa288('0x25')](_0xffc6b4[_0xa288('0x26')]);if(_0xffc6b4[_0xa288('0x27')]){delete _0xffc6b4['name'];}_0x54a27b['status'](_0x2cdd34)[_0xa288('0x28')](_0xffc6b4);};}exports[_0xa288('0x29')]=function(_0x19f934,_0x7ea039){var _0x3b2d3e={},_0x3bbbc8={},_0x14919b={'count':0x0,'rows':[]};var _0x382caf=_[_0xa288('0x2a')](db[_0xa288('0x2b')][_0xa288('0x2c')],function(_0x638c78){return{'name':_0x638c78[_0xa288('0x2d')],'type':_0x638c78[_0xa288('0x2e')][_0xa288('0x2f')]};});_0x3bbbc8[_0xa288('0x30')]=_[_0xa288('0x2a')](_0x382caf,'name');_0x3bbbc8[_0xa288('0x31')]=_['keys'](_0x19f934[_0xa288('0x31')]);_0x3bbbc8[_0xa288('0x32')]=_[_0xa288('0x33')](_0x3bbbc8['model'],_0x3bbbc8[_0xa288('0x31')]);_0x3b2d3e[_0xa288('0x34')]=_[_0xa288('0x33')](_0x3bbbc8[_0xa288('0x30')],qs[_0xa288('0x35')](_0x19f934[_0xa288('0x31')][_0xa288('0x35')]));_0x3b2d3e[_0xa288('0x34')]=_0x3b2d3e[_0xa288('0x34')]['length']?_0x3b2d3e['attributes']:_0x3bbbc8['model'];if(!_0x19f934[_0xa288('0x31')]['hasOwnProperty'](_0xa288('0x36'))){_0x3b2d3e[_0xa288('0x1c')]=qs[_0xa288('0x1c')](_0x19f934[_0xa288('0x31')][_0xa288('0x1c')]);_0x3b2d3e[_0xa288('0x1a')]=qs['offset'](_0x19f934['query']['offset']);}_0x3b2d3e[_0xa288('0x37')]=qs[_0xa288('0x38')](_0x19f934['query'][_0xa288('0x38')]);_0x3b2d3e[_0xa288('0x39')]=qs['filters'](_[_0xa288('0x3a')](_0x19f934[_0xa288('0x31')],_0x3bbbc8[_0xa288('0x32')]),_0x382caf);if(_0x19f934[_0xa288('0x31')][_0xa288('0x3b')]){_0x3b2d3e[_0xa288('0x39')]=_['merge'](_0x3b2d3e[_0xa288('0x39')],{'$or':_[_0xa288('0x2a')](_0x382caf,function(_0x1d9195){if(_0x1d9195['type']!==_0xa288('0x3c')){var _0x165851={};_0x165851[_0x1d9195[_0xa288('0x27')]]={'$like':'%'+_0x19f934[_0xa288('0x31')][_0xa288('0x3b')]+'%'};return _0x165851;}})});}_0x3b2d3e=_[_0xa288('0x3d')]({},_0x3b2d3e,_0x19f934[_0xa288('0x3e')]);var _0x5031a6={'where':_0x3b2d3e[_0xa288('0x39')]};return db[_0xa288('0x2b')][_0xa288('0x1d')](_0x5031a6)['then'](function(_0x73e4b8){_0x14919b[_0xa288('0x1d')]=_0x73e4b8;if(_0x19f934['query'][_0xa288('0x3f')]){_0x3b2d3e[_0xa288('0x40')]=[{'all':!![]}];}return db[_0xa288('0x2b')]['findAll'](_0x3b2d3e);})[_0xa288('0x23')](function(_0x2a4ead){_0x14919b['rows']=_0x2a4ead;return _0x14919b;})[_0xa288('0x23')](respondWithFilteredResult(_0x7ea039,_0x3b2d3e))[_0xa288('0x41')](handleError(_0x7ea039,null));};exports[_0xa288('0x42')]=function(_0x439fb4,_0x107551){var _0x48cc1a={'raw':!![],'where':{'id':_0x439fb4[_0xa288('0x43')]['id']}},_0x1c1145={};_0x1c1145[_0xa288('0x30')]=_[_0xa288('0x44')](db[_0xa288('0x2b')][_0xa288('0x2c')]);_0x1c1145[_0xa288('0x31')]=_[_0xa288('0x44')](_0x439fb4[_0xa288('0x31')]);_0x1c1145[_0xa288('0x32')]=_[_0xa288('0x33')](_0x1c1145['model'],_0x1c1145['query']);_0x48cc1a[_0xa288('0x34')]=_[_0xa288('0x33')](_0x1c1145[_0xa288('0x30')],qs['fields'](_0x439fb4['query'][_0xa288('0x35')]));_0x48cc1a[_0xa288('0x34')]=_0x48cc1a['attributes'][_0xa288('0x45')]?_0x48cc1a['attributes']:_0x1c1145['model'];if(_0x439fb4[_0xa288('0x31')][_0xa288('0x3f')]){_0x48cc1a[_0xa288('0x40')]=[{'all':!![]}];}_0x48cc1a=_['merge']({},_0x48cc1a,_0x439fb4[_0xa288('0x3e')]);return db[_0xa288('0x2b')][_0xa288('0x46')](_0x48cc1a)[_0xa288('0x23')](handleEntityNotFound(_0x107551,null))[_0xa288('0x23')](respondWithResult(_0x107551,null))[_0xa288('0x41')](handleError(_0x107551,null));};exports['create']=function(_0x3ca744,_0x5b56f3){return db[_0xa288('0x2b')][_0xa288('0x47')](_0x3ca744[_0xa288('0x48')],{})[_0xa288('0x23')](respondWithResult(_0x5b56f3,0xc9))[_0xa288('0x41')](handleError(_0x5b56f3,null));};exports[_0xa288('0x22')]=function(_0x6b7c7d,_0x1a3dff){if(_0x6b7c7d[_0xa288('0x48')]['id']){delete _0x6b7c7d[_0xa288('0x48')]['id'];}return db[_0xa288('0x2b')][_0xa288('0x46')]({'where':{'id':_0x6b7c7d['params']['id']}})[_0xa288('0x23')](handleEntityNotFound(_0x1a3dff,null))[_0xa288('0x23')](saveUpdates(_0x6b7c7d['body'],null))['then'](respondWithResult(_0x1a3dff,null))[_0xa288('0x41')](handleError(_0x1a3dff,null));};exports[_0xa288('0x24')]=function(_0x44b000,_0x5156c2){return db['SquareMessage'][_0xa288('0x46')]({'where':{'id':_0x44b000[_0xa288('0x43')]['id']}})[_0xa288('0x23')](handleEntityNotFound(_0x5156c2,null))['then'](removeEntity(_0x5156c2,null))[_0xa288('0x41')](handleError(_0x5156c2,null));}; \ No newline at end of file +var _0xf108=['model','fields','attributes','limit','order','sort','merge','type','filter','options','where','includeAll','include','SquareMessage','findAll','rows','catch','show','length','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','destroy','then','sendStatus','error','name','map','rawAttributes','fieldName','key','query','keys','filters','intersection'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf108,0x1d9));var _0x8f10=function(_0x2a1d55,_0x1c2544){_0x2a1d55=_0x2a1d55-0x0;var _0x23821e=_0xf108[_0x2a1d55];return _0x23821e;};'use strict';var emlformat=require(_0x8f10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8f10('0x1'));var jsonpatch=require(_0x8f10('0x2'));var rp=require(_0x8f10('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8f10('0x4'));var path=require(_0x8f10('0x5'));var sox=require(_0x8f10('0x6'));var csv=require(_0x8f10('0x7'));var ejs=require(_0x8f10('0x8'));var fs=require('fs');var fs_extra=require(_0x8f10('0x9'));var _=require(_0x8f10('0xa'));var squel=require(_0x8f10('0xb'));var crypto=require(_0x8f10('0xc'));var jsforce=require(_0x8f10('0xd'));var deskjs=require(_0x8f10('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8f10('0xf'));var Papa=require(_0x8f10('0x10'));var Redis=require(_0x8f10('0x11'));var authService=require(_0x8f10('0x12'));var qs=require(_0x8f10('0x13'));var as=require(_0x8f10('0x14'));var hardwareService=require(_0x8f10('0x15'));var logger=require(_0x8f10('0x16'))(_0x8f10('0x17'));var utils=require(_0x8f10('0x18'));var config=require(_0x8f10('0x19'));var licenseUtil=require(_0x8f10('0x1a'));var db=require(_0x8f10('0x1b'))['db'];function respondWithStatusCode(_0x170036,_0x15f79d){_0x15f79d=_0x15f79d||0xcc;return function(_0x4ae80e){if(_0x4ae80e){return _0x170036['sendStatus'](_0x15f79d);}return _0x170036[_0x8f10('0x1c')](_0x15f79d)[_0x8f10('0x1d')]();};}function respondWithResult(_0x472b6f,_0x9b9e1f){_0x9b9e1f=_0x9b9e1f||0xc8;return function(_0x1eaced){if(_0x1eaced){return _0x472b6f[_0x8f10('0x1c')](_0x9b9e1f)[_0x8f10('0x1e')](_0x1eaced);}};}function respondWithFilteredResult(_0x15bae4,_0x295dfc){return function(_0x4cf096){if(_0x4cf096){var _0x17882d=typeof _0x295dfc[_0x8f10('0x1f')]===_0x8f10('0x20')&&typeof _0x295dfc['limit']===_0x8f10('0x20');var _0x22e5fe=_0x4cf096['count'];var _0xdfd335=_0x17882d?0x0:_0x295dfc[_0x8f10('0x1f')];var _0x255e75=_0x17882d?_0x4cf096[_0x8f10('0x21')]:_0x295dfc['offset']+_0x295dfc['limit'];var _0x266a86;if(_0x255e75>=_0x22e5fe){_0x255e75=_0x22e5fe;_0x266a86=0xc8;}else{_0x266a86=0xce;}_0x15bae4[_0x8f10('0x1c')](_0x266a86);return _0x15bae4[_0x8f10('0x22')](_0x8f10('0x23'),_0xdfd335+'-'+_0x255e75+'/'+_0x22e5fe)[_0x8f10('0x1e')](_0x4cf096);}return null;};}function patchUpdates(_0xfdb66e){return function(_0x468fa9){try{jsonpatch[_0x8f10('0x24')](_0x468fa9,_0xfdb66e,!![]);}catch(_0x7bde34){return BPromise[_0x8f10('0x25')](_0x7bde34);}return _0x468fa9[_0x8f10('0x26')]();};}function saveUpdates(_0x506a8f,_0x2550e1){return function(_0x485e83){if(_0x485e83){return _0x485e83['update'](_0x506a8f)['then'](function(_0x24dacc){return _0x24dacc;});}return null;};}function removeEntity(_0x4cc92f,_0x185f2){return function(_0xdaa7dd){if(_0xdaa7dd){return _0xdaa7dd[_0x8f10('0x27')]()[_0x8f10('0x28')](function(){_0x4cc92f[_0x8f10('0x1c')](0xcc)[_0x8f10('0x1d')]();});}};}function handleEntityNotFound(_0x25d3e3,_0x3f0659){return function(_0x20bdfa){if(!_0x20bdfa){_0x25d3e3[_0x8f10('0x29')](0x194);}return _0x20bdfa;};}function handleError(_0x3458a8,_0x4631ac){_0x4631ac=_0x4631ac||0x1f4;return function(_0x27e2dd){logger[_0x8f10('0x2a')](_0x27e2dd['stack']);if(_0x27e2dd[_0x8f10('0x2b')]){delete _0x27e2dd[_0x8f10('0x2b')];}_0x3458a8['status'](_0x4631ac)['send'](_0x27e2dd);};}exports['index']=function(_0x3c1685,_0x11db52){var _0x41fe92={},_0x31033a={},_0x88b61c={'count':0x0,'rows':[]};var _0x4ae723=_[_0x8f10('0x2c')](db['SquareMessage'][_0x8f10('0x2d')],function(_0x3126ec){return{'name':_0x3126ec[_0x8f10('0x2e')],'type':_0x3126ec['type'][_0x8f10('0x2f')]};});_0x31033a['model']=_['map'](_0x4ae723,_0x8f10('0x2b'));_0x31033a[_0x8f10('0x30')]=_[_0x8f10('0x31')](_0x3c1685[_0x8f10('0x30')]);_0x31033a[_0x8f10('0x32')]=_[_0x8f10('0x33')](_0x31033a[_0x8f10('0x34')],_0x31033a['query']);_0x41fe92['attributes']=_[_0x8f10('0x33')](_0x31033a['model'],qs[_0x8f10('0x35')](_0x3c1685[_0x8f10('0x30')]['fields']));_0x41fe92['attributes']=_0x41fe92[_0x8f10('0x36')]['length']?_0x41fe92[_0x8f10('0x36')]:_0x31033a['model'];if(!_0x3c1685[_0x8f10('0x30')]['hasOwnProperty']('nolimit')){_0x41fe92[_0x8f10('0x37')]=qs['limit'](_0x3c1685[_0x8f10('0x30')][_0x8f10('0x37')]);_0x41fe92[_0x8f10('0x1f')]=qs[_0x8f10('0x1f')](_0x3c1685[_0x8f10('0x30')]['offset']);}_0x41fe92[_0x8f10('0x38')]=qs[_0x8f10('0x39')](_0x3c1685['query'][_0x8f10('0x39')]);_0x41fe92['where']=qs[_0x8f10('0x32')](_['pick'](_0x3c1685[_0x8f10('0x30')],_0x31033a['filters']),_0x4ae723);if(_0x3c1685[_0x8f10('0x30')]['filter']){_0x41fe92['where']=_[_0x8f10('0x3a')](_0x41fe92['where'],{'$or':_[_0x8f10('0x2c')](_0x4ae723,function(_0x31f76e){if(_0x31f76e[_0x8f10('0x3b')]!=='VIRTUAL'){var _0x3df580={};_0x3df580[_0x31f76e[_0x8f10('0x2b')]]={'$like':'%'+_0x3c1685[_0x8f10('0x30')][_0x8f10('0x3c')]+'%'};return _0x3df580;}})});}_0x41fe92=_[_0x8f10('0x3a')]({},_0x41fe92,_0x3c1685[_0x8f10('0x3d')]);var _0x236ad6={'where':_0x41fe92[_0x8f10('0x3e')]};return db['SquareMessage'][_0x8f10('0x21')](_0x236ad6)[_0x8f10('0x28')](function(_0x529a6b){_0x88b61c[_0x8f10('0x21')]=_0x529a6b;if(_0x3c1685['query'][_0x8f10('0x3f')]){_0x41fe92[_0x8f10('0x40')]=[{'all':!![]}];}return db[_0x8f10('0x41')][_0x8f10('0x42')](_0x41fe92);})[_0x8f10('0x28')](function(_0x38b49d){_0x88b61c[_0x8f10('0x43')]=_0x38b49d;return _0x88b61c;})[_0x8f10('0x28')](respondWithFilteredResult(_0x11db52,_0x41fe92))[_0x8f10('0x44')](handleError(_0x11db52,null));};exports[_0x8f10('0x45')]=function(_0x14d527,_0x34299b){var _0x148792={'raw':!![],'where':{'id':_0x14d527['params']['id']}},_0x3bb739={};_0x3bb739[_0x8f10('0x34')]=_[_0x8f10('0x31')](db['SquareMessage'][_0x8f10('0x2d')]);_0x3bb739[_0x8f10('0x30')]=_[_0x8f10('0x31')](_0x14d527[_0x8f10('0x30')]);_0x3bb739[_0x8f10('0x32')]=_[_0x8f10('0x33')](_0x3bb739[_0x8f10('0x34')],_0x3bb739['query']);_0x148792[_0x8f10('0x36')]=_[_0x8f10('0x33')](_0x3bb739[_0x8f10('0x34')],qs['fields'](_0x14d527['query'][_0x8f10('0x35')]));_0x148792[_0x8f10('0x36')]=_0x148792['attributes'][_0x8f10('0x46')]?_0x148792[_0x8f10('0x36')]:_0x3bb739[_0x8f10('0x34')];if(_0x14d527[_0x8f10('0x30')][_0x8f10('0x3f')]){_0x148792[_0x8f10('0x40')]=[{'all':!![]}];}_0x148792=_['merge']({},_0x148792,_0x14d527[_0x8f10('0x3d')]);return db[_0x8f10('0x41')][_0x8f10('0x47')](_0x148792)['then'](handleEntityNotFound(_0x34299b,null))[_0x8f10('0x28')](respondWithResult(_0x34299b,null))[_0x8f10('0x44')](handleError(_0x34299b,null));};exports[_0x8f10('0x48')]=function(_0x455d3a,_0x488b2d){return db[_0x8f10('0x41')][_0x8f10('0x48')](_0x455d3a['body'],{})[_0x8f10('0x28')](respondWithResult(_0x488b2d,0xc9))['catch'](handleError(_0x488b2d,null));};exports['update']=function(_0x414b4b,_0x351b47){if(_0x414b4b[_0x8f10('0x49')]['id']){delete _0x414b4b[_0x8f10('0x49')]['id'];}return db[_0x8f10('0x41')]['find']({'where':{'id':_0x414b4b[_0x8f10('0x4a')]['id']}})[_0x8f10('0x28')](handleEntityNotFound(_0x351b47,null))[_0x8f10('0x28')](saveUpdates(_0x414b4b[_0x8f10('0x49')],null))[_0x8f10('0x28')](respondWithResult(_0x351b47,null))[_0x8f10('0x44')](handleError(_0x351b47,null));};exports[_0x8f10('0x27')]=function(_0x3995a3,_0x3988b5){return db[_0x8f10('0x41')][_0x8f10('0x47')]({'where':{'id':_0x3995a3[_0x8f10('0x4a')]['id']}})[_0x8f10('0x28')](handleEntityNotFound(_0x3988b5,null))['then'](removeEntity(_0x3988b5,null))[_0x8f10('0x44')](handleError(_0x3988b5,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index c0e7a7d..bc84fa9 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 _0xa646=['path','rimraf','../../config/environment','exports','define','square_messages','lodash','../../config/logger','moment','request-promise'];(function(_0xe65129,_0x4675be){var _0x5aa6ff=function(_0xcbb0fc){while(--_0xcbb0fc){_0xe65129['push'](_0xe65129['shift']());}};_0x5aa6ff(++_0x4675be);}(_0xa646,0xa6));var _0x6a64=function(_0x16d1d2,_0x3615b){_0x16d1d2=_0x16d1d2-0x0;var _0x27bd76=_0xa646[_0x16d1d2];return _0x27bd76;};'use strict';var _=require(_0x6a64('0x0'));var util=require('util');var logger=require(_0x6a64('0x1'))('api');var moment=require(_0x6a64('0x2'));var BPromise=require('bluebird');var rp=require(_0x6a64('0x3'));var fs=require('fs');var path=require(_0x6a64('0x4'));var rimraf=require(_0x6a64('0x5'));var config=require(_0x6a64('0x6'));var attributes=require('./squareMessage.attributes');module[_0x6a64('0x7')]=function(_0x1fed20,_0x7297f7){return _0x1fed20[_0x6a64('0x8')]('SquareMessage',attributes,{'tableName':_0x6a64('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x859e=['../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x531351,_0x2d42b9){var _0x2bc96a=function(_0x49e143){while(--_0x49e143){_0x531351['push'](_0x531351['shift']());}};_0x2bc96a(++_0x2d42b9);}(_0x859e,0xc5));var _0xe859=function(_0x3a12a1,_0x11a42e){_0x3a12a1=_0x3a12a1-0x0;var _0x4ebb65=_0x859e[_0x3a12a1];return _0x4ebb65;};'use strict';var _=require(_0xe859('0x0'));var util=require(_0xe859('0x1'));var logger=require(_0xe859('0x2'))('api');var moment=require(_0xe859('0x3'));var BPromise=require(_0xe859('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe859('0x5'));var rimraf=require(_0xe859('0x6'));var config=require(_0xe859('0x7'));var attributes=require(_0xe859('0x8'));module[_0xe859('0x9')]=function(_0x4af65f,_0x3a356c){return _0x4af65f['define'](_0xe859('0xa'),attributes,{'tableName':_0xe859('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index cd4112d..70be351 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 _0xcab5=['stringify','error','code','message','result','catch','SquareMessage','options','raw','CreateSquareMessage','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xcab5,0x1da));var _0x5cab=function(_0x4af9ba,_0x29113c){_0x4af9ba=_0x4af9ba-0x0;var _0x1defe5=_0xcab5[_0x4af9ba];return _0x1defe5;};'use strict';var _=require(_0x5cab('0x0'));var util=require(_0x5cab('0x1'));var moment=require(_0x5cab('0x2'));var BPromise=require('bluebird');var rs=require(_0x5cab('0x3'));var fs=require('fs');var Redis=require(_0x5cab('0x4'));var db=require(_0x5cab('0x5'))['db'];var utils=require(_0x5cab('0x6'));var logger=require(_0x5cab('0x7'))(_0x5cab('0x8'));var config=require(_0x5cab('0x9'));var jayson=require(_0x5cab('0xa'));var client=jayson[_0x5cab('0xb')][_0x5cab('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1052f6,_0x396272,_0x5c0879){return new BPromise(function(_0x3b8dcb,_0x60a159){return client[_0x5cab('0xd')](_0x1052f6,_0x5c0879)[_0x5cab('0xe')](function(_0x3c31e7){logger[_0x5cab('0xf')](_0x5cab('0x10'),_0x396272,_0x5cab('0x11'));logger[_0x5cab('0x12')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x396272,_0x5cab('0x11'),JSON[_0x5cab('0x13')](_0x3c31e7));if(_0x3c31e7[_0x5cab('0x14')]){if(_0x3c31e7[_0x5cab('0x14')][_0x5cab('0x15')]===0x1f4){logger[_0x5cab('0x14')](_0x5cab('0x10'),_0x396272,_0x3c31e7[_0x5cab('0x14')][_0x5cab('0x16')]);return _0x60a159(_0x3c31e7['error'][_0x5cab('0x16')]);}logger['error']('SquareMessage,\x20%s,\x20%s',_0x396272,_0x3c31e7[_0x5cab('0x14')]['message']);return _0x3b8dcb(_0x3c31e7[_0x5cab('0x14')]['message']);}else{logger[_0x5cab('0xf')](_0x5cab('0x10'),_0x396272,'request\x20sent');_0x3b8dcb(_0x3c31e7[_0x5cab('0x17')][_0x5cab('0x16')]);}})[_0x5cab('0x18')](function(_0x2ba6bb){logger[_0x5cab('0x14')](_0x5cab('0x10'),_0x396272,_0x2ba6bb);_0x60a159(_0x2ba6bb);});});}exports['CreateSquareMessage']=function(_0x39dc79){var _0x907f22=this;return new Promise(function(_0x178d52,_0x41355e){return db[_0x5cab('0x19')]['create'](_0x39dc79['body'],{'raw':_0x39dc79[_0x5cab('0x1a')]?_0x39dc79['options'][_0x5cab('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x324037){logger[_0x5cab('0xf')](_0x5cab('0x1c'),_0x39dc79);logger[_0x5cab('0x12')](_0x5cab('0x1c'),_0x39dc79,JSON[_0x5cab('0x13')](_0x324037));_0x178d52(_0x324037);})[_0x5cab('0x18')](function(_0x59bb00){logger[_0x5cab('0x14')](_0x5cab('0x1c'),_0x59bb00[_0x5cab('0x16')],_0x39dc79);_0x41355e(_0x907f22[_0x5cab('0x14')](0x1f4,_0x59bb00[_0x5cab('0x16')]));});});}; \ No newline at end of file +var _0xb711=['catch','CreateSquareMessage','SquareMessage','create','body','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x26b5d2,_0x5de89a){var _0x6b48a=function(_0x305ba0){while(--_0x305ba0){_0x26b5d2['push'](_0x26b5d2['shift']());}};_0x6b48a(++_0x5de89a);}(_0xb711,0x171));var _0x1b71=function(_0x907b82,_0x59f090){_0x907b82=_0x907b82-0x0;var _0xe0c054=_0xb711[_0x907b82];return _0xe0c054;};'use strict';var _=require(_0x1b71('0x0'));var util=require(_0x1b71('0x1'));var moment=require('moment');var BPromise=require(_0x1b71('0x2'));var rs=require(_0x1b71('0x3'));var fs=require('fs');var Redis=require(_0x1b71('0x4'));var db=require(_0x1b71('0x5'))['db'];var utils=require(_0x1b71('0x6'));var logger=require(_0x1b71('0x7'))('rpc');var config=require(_0x1b71('0x8'));var jayson=require(_0x1b71('0x9'));var client=jayson[_0x1b71('0xa')][_0x1b71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d2791,_0x5cfaf3,_0x113fc9){return new BPromise(function(_0x5269ce,_0x516281){return client[_0x1b71('0xc')](_0x5d2791,_0x113fc9)[_0x1b71('0xd')](function(_0x384b62){logger[_0x1b71('0xe')](_0x1b71('0xf'),_0x5cfaf3,_0x1b71('0x10'));logger[_0x1b71('0x11')](_0x1b71('0x12'),_0x5cfaf3,_0x1b71('0x10'),JSON[_0x1b71('0x13')](_0x384b62));if(_0x384b62[_0x1b71('0x14')]){if(_0x384b62['error'][_0x1b71('0x15')]===0x1f4){logger[_0x1b71('0x14')](_0x1b71('0xf'),_0x5cfaf3,_0x384b62[_0x1b71('0x14')][_0x1b71('0x16')]);return _0x516281(_0x384b62['error']['message']);}logger[_0x1b71('0x14')]('SquareMessage,\x20%s,\x20%s',_0x5cfaf3,_0x384b62[_0x1b71('0x14')][_0x1b71('0x16')]);return _0x5269ce(_0x384b62[_0x1b71('0x14')]['message']);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x5cfaf3,_0x1b71('0x10'));_0x5269ce(_0x384b62['result'][_0x1b71('0x16')]);}})[_0x1b71('0x17')](function(_0x24e8f2){logger[_0x1b71('0x14')]('SquareMessage,\x20%s,\x20%s',_0x5cfaf3,_0x24e8f2);_0x516281(_0x24e8f2);});});}exports[_0x1b71('0x18')]=function(_0x276a10){var _0xb7e7a4=this;return new Promise(function(_0xe9538a,_0x2580b5){return db[_0x1b71('0x19')][_0x1b71('0x1a')](_0x276a10[_0x1b71('0x1b')],{'raw':_0x276a10['options']?_0x276a10['options']['raw']===undefined?!![]:![]:!![]})[_0x1b71('0xd')](function(_0x13c8d2){logger[_0x1b71('0xe')](_0x1b71('0x18'),_0x276a10);logger[_0x1b71('0x11')](_0x1b71('0x18'),_0x276a10,JSON[_0x1b71('0x13')](_0x13c8d2));_0xe9538a(_0x13c8d2);})[_0x1b71('0x17')](function(_0x2cc011){logger[_0x1b71('0x14')](_0x1b71('0x18'),_0x2cc011[_0x1b71('0x16')],_0x276a10);_0x2580b5(_0xb7e7a4[_0x1b71('0x14')](0x1f4,_0x2cc011[_0x1b71('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 4913b29..53f8def 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 _0x1692=['../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','15s','test','post','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x1692,0x1f1));var _0x2169=function(_0x5e2b3a,_0x22d5c0){_0x5e2b3a=_0x5e2b3a-0x0;var _0x3bdc59=_0x1692[_0x5e2b3a];return _0x3bdc59;};'use strict';var multer=require(_0x2169('0x0'));var util=require(_0x2169('0x1'));var path=require(_0x2169('0x2'));var timeout=require('connect-timeout');var express=require(_0x2169('0x3'));var router=express[_0x2169('0x4')]();var fs_extra=require(_0x2169('0x5'));var auth=require(_0x2169('0x6'));var interaction=require(_0x2169('0x7'));var config=require(_0x2169('0x8'));var controller=require(_0x2169('0x9'));router[_0x2169('0xa')]('/',auth[_0x2169('0xb')](),controller[_0x2169('0xc')]);router['get'](_0x2169('0xd'),auth[_0x2169('0xb')](),controller['show']);router['get'](_0x2169('0xe'),auth[_0x2169('0xb')](),timeout(_0x2169('0xf')),controller[_0x2169('0x10')]);router[_0x2169('0x11')]('/',auth[_0x2169('0xb')](),controller['create']);router['put'](_0x2169('0xd'),auth['isAuthenticated'](),controller[_0x2169('0x12')]);router[_0x2169('0x13')](_0x2169('0xd'),auth[_0x2169('0xb')](),controller['destroy']);module[_0x2169('0x14')]=router; \ No newline at end of file +var _0x8136=['isAuthenticated','15s','test','create','put','delete','/:id','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x2d5a8e,_0x333734){var _0x3d97f8=function(_0x41b763){while(--_0x41b763){_0x2d5a8e['push'](_0x2d5a8e['shift']());}};_0x3d97f8(++_0x333734);}(_0x8136,0x104));var _0x6813=function(_0x2102c4,_0x1005a2){_0x2102c4=_0x2102c4-0x0;var _0x3dbcb8=_0x8136[_0x2102c4];return _0x3dbcb8;};'use strict';var multer=require(_0x6813('0x0'));var util=require(_0x6813('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6813('0x2'));var router=express[_0x6813('0x3')]();var fs_extra=require(_0x6813('0x4'));var auth=require(_0x6813('0x5'));var interaction=require(_0x6813('0x6'));var config=require(_0x6813('0x7'));var controller=require('./squareOdbc.controller');router[_0x6813('0x8')]('/',auth['isAuthenticated'](),controller[_0x6813('0x9')]);router[_0x6813('0x8')]('/:id',auth[_0x6813('0xa')](),controller['show']);router[_0x6813('0x8')]('/:id/test',auth[_0x6813('0xa')](),timeout(_0x6813('0xb')),controller[_0x6813('0xc')]);router['post']('/',auth[_0x6813('0xa')](),controller[_0x6813('0xd')]);router[_0x6813('0xe')]('/:id',auth[_0x6813('0xa')](),controller['update']);router[_0x6813('0xf')](_0x6813('0x10'),auth[_0x6813('0xa')](),controller[_0x6813('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 8286b84..f4e43e8 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 _0xc672=['sequelize','exports','STRING','name'];(function(_0x26b5e4,_0x4d45a5){var _0x413a11=function(_0x1bbd15){while(--_0x1bbd15){_0x26b5e4['push'](_0x26b5e4['shift']());}};_0x413a11(++_0x4d45a5);}(_0xc672,0x8c));var _0x2c67=function(_0x5466fc,_0x1780e8){_0x5466fc=_0x5466fc-0x0;var _0x2bd240=_0xc672[_0x5466fc];return _0x2bd240;};'use strict';var Sequelize=require(_0x2c67('0x0'));module[_0x2c67('0x1')]={'name':{'type':Sequelize[_0x2c67('0x2')],'unique':_0x2c67('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x2c67('0x2')]},'description':{'type':Sequelize[_0x2c67('0x2')]}}; \ No newline at end of file +var _0x9a5d=['STRING','exports'];(function(_0x347f12,_0x586ebb){var _0x40e9c6=function(_0x43e3ee){while(--_0x43e3ee){_0x347f12['push'](_0x347f12['shift']());}};_0x40e9c6(++_0x586ebb);}(_0x9a5d,0x19f));var _0xd9a5=function(_0xa77a3e,_0x4a0013){_0xa77a3e=_0xa77a3e-0x0;var _0x23abb9=_0x9a5d[_0xa77a3e];return _0x23abb9;};'use strict';var Sequelize=require('sequelize');module[_0xd9a5('0x0')]={'name':{'type':Sequelize[_0xd9a5('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xd9a5('0x1')]},'description':{'type':Sequelize[_0xd9a5('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 0eef8a9..ff50943 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 _0x0586=['fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','intersection','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','openSync','closeSync','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','ODBC','UserProfileResource','destroy','sendStatus','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','key','model','keys','query','filters','attributes'];(function(_0xf2b11,_0x160aee){var _0x5f4210=function(_0x169f26){while(--_0x169f26){_0xf2b11['push'](_0xf2b11['shift']());}};_0x5f4210(++_0x160aee);}(_0x0586,0xcf));var _0x6058=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0586[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6058('0x0'));var zipdir=require(_0x6058('0x1'));var jsonpatch=require(_0x6058('0x2'));var rp=require('request-promise');var moment=require(_0x6058('0x3'));var BPromise=require(_0x6058('0x4'));var Mustache=require(_0x6058('0x5'));var util=require(_0x6058('0x6'));var path=require(_0x6058('0x7'));var sox=require(_0x6058('0x8'));var csv=require(_0x6058('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6058('0xa'));var _=require(_0x6058('0xb'));var squel=require(_0x6058('0xc'));var crypto=require(_0x6058('0xd'));var jsforce=require(_0x6058('0xe'));var deskjs=require(_0x6058('0xf'));var toCsv=require(_0x6058('0x9'));var querystring=require(_0x6058('0x10'));var Papa=require(_0x6058('0x11'));var Redis=require(_0x6058('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6058('0x13'));var hardwareService=require(_0x6058('0x14'));var logger=require(_0x6058('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6058('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x557ac8,_0x416507){_0x416507=_0x416507||0xcc;return function(_0x9332e6){if(_0x9332e6){return _0x557ac8['sendStatus'](_0x416507);}return _0x557ac8[_0x6058('0x17')](_0x416507)[_0x6058('0x18')]();};}function respondWithResult(_0x209474,_0x20dcc1){_0x20dcc1=_0x20dcc1||0xc8;return function(_0x15c3a9){if(_0x15c3a9){return _0x209474['status'](_0x20dcc1)[_0x6058('0x19')](_0x15c3a9);}};}function respondWithFilteredResult(_0x2eb1f1,_0x30c14c){return function(_0x4f1dfb){if(_0x4f1dfb){var _0x51acdb=typeof _0x30c14c[_0x6058('0x1a')]===_0x6058('0x1b')&&typeof _0x30c14c[_0x6058('0x1c')]===_0x6058('0x1b');var _0x1e3757=_0x4f1dfb['count'];var _0xf857b5=_0x51acdb?0x0:_0x30c14c[_0x6058('0x1a')];var _0xa92392=_0x51acdb?_0x4f1dfb[_0x6058('0x1d')]:_0x30c14c[_0x6058('0x1a')]+_0x30c14c[_0x6058('0x1c')];var _0x330b51;if(_0xa92392>=_0x1e3757){_0xa92392=_0x1e3757;_0x330b51=0xc8;}else{_0x330b51=0xce;}_0x2eb1f1['status'](_0x330b51);return _0x2eb1f1[_0x6058('0x1e')]('Content-Range',_0xf857b5+'-'+_0xa92392+'/'+_0x1e3757)[_0x6058('0x19')](_0x4f1dfb);}return null;};}function patchUpdates(_0x343c4e){return function(_0x5178fa){try{jsonpatch[_0x6058('0x1f')](_0x5178fa,_0x343c4e,!![]);}catch(_0x39ab0f){return BPromise[_0x6058('0x20')](_0x39ab0f);}return _0x5178fa[_0x6058('0x21')]();};}function saveUpdates(_0x1eb220,_0xe36fda){return function(_0x50f2d7){if(_0x50f2d7){return _0x50f2d7[_0x6058('0x22')](_0x1eb220)[_0x6058('0x23')](function(_0x48268d){return _0x48268d;});}return null;};}function removeEntity(_0x4d2311,_0x141752){return function(_0x1ce32e){if(_0x1ce32e){return _0x1ce32e['destroy']()[_0x6058('0x23')](function(){var _0x5e2e31=_0x1ce32e[_0x6058('0x24')]({'plain':!![]});var _0x4ad296=_0x6058('0x25');return db[_0x6058('0x26')][_0x6058('0x27')]({'where':{'type':_0x4ad296,'resourceId':_0x5e2e31['id']}})[_0x6058('0x23')](function(){return _0x1ce32e;});})['then'](function(){_0x4d2311[_0x6058('0x17')](0xcc)[_0x6058('0x18')]();});}};}function handleEntityNotFound(_0x5d5429,_0x4afbfb){return function(_0x628271){if(!_0x628271){_0x5d5429[_0x6058('0x28')](0x194);}return _0x628271;};}function handleError(_0x1b84a9,_0x2016c2){_0x2016c2=_0x2016c2||0x1f4;return function(_0x3748af){logger['error'](_0x3748af[_0x6058('0x29')]);if(_0x3748af[_0x6058('0x2a')]){delete _0x3748af[_0x6058('0x2a')];}_0x1b84a9[_0x6058('0x17')](_0x2016c2)['send'](_0x3748af);};}exports[_0x6058('0x2b')]=function(_0x10b1fb,_0x2f4a4c){var _0xf7c2b5={},_0x4e8b53={},_0x2b315e={'count':0x0,'rows':[]};var _0x2a8ac6=_[_0x6058('0x2c')](db[_0x6058('0x2d')][_0x6058('0x2e')],function(_0x36ae7f){return{'name':_0x36ae7f[_0x6058('0x2f')],'type':_0x36ae7f['type'][_0x6058('0x30')]};});_0x4e8b53[_0x6058('0x31')]=_[_0x6058('0x2c')](_0x2a8ac6,_0x6058('0x2a'));_0x4e8b53['query']=_[_0x6058('0x32')](_0x10b1fb[_0x6058('0x33')]);_0x4e8b53[_0x6058('0x34')]=_['intersection'](_0x4e8b53[_0x6058('0x31')],_0x4e8b53[_0x6058('0x33')]);_0xf7c2b5[_0x6058('0x35')]=_['intersection'](_0x4e8b53[_0x6058('0x31')],qs[_0x6058('0x36')](_0x10b1fb[_0x6058('0x33')][_0x6058('0x36')]));_0xf7c2b5['attributes']=_0xf7c2b5[_0x6058('0x35')][_0x6058('0x37')]?_0xf7c2b5[_0x6058('0x35')]:_0x4e8b53[_0x6058('0x31')];if(!_0x10b1fb[_0x6058('0x33')][_0x6058('0x38')](_0x6058('0x39'))){_0xf7c2b5[_0x6058('0x1c')]=qs['limit'](_0x10b1fb[_0x6058('0x33')]['limit']);_0xf7c2b5['offset']=qs['offset'](_0x10b1fb[_0x6058('0x33')]['offset']);}_0xf7c2b5['order']=qs['sort'](_0x10b1fb['query'][_0x6058('0x3a')]);_0xf7c2b5[_0x6058('0x3b')]=qs['filters'](_[_0x6058('0x3c')](_0x10b1fb[_0x6058('0x33')],_0x4e8b53[_0x6058('0x34')]),_0x2a8ac6);if(_0x10b1fb[_0x6058('0x33')][_0x6058('0x3d')]){_0xf7c2b5[_0x6058('0x3b')]=_['merge'](_0xf7c2b5[_0x6058('0x3b')],{'$or':_[_0x6058('0x2c')](_0x2a8ac6,function(_0x573db8){if(_0x573db8[_0x6058('0x3e')]!==_0x6058('0x3f')){var _0x126db7={};_0x126db7[_0x573db8[_0x6058('0x2a')]]={'$like':'%'+_0x10b1fb[_0x6058('0x33')][_0x6058('0x3d')]+'%'};return _0x126db7;}})});}_0xf7c2b5=_[_0x6058('0x40')]({},_0xf7c2b5,_0x10b1fb[_0x6058('0x41')]);var _0x548ce6={'where':_0xf7c2b5[_0x6058('0x3b')]};return db[_0x6058('0x2d')]['count'](_0x548ce6)[_0x6058('0x23')](function(_0x3c10d1){_0x2b315e[_0x6058('0x1d')]=_0x3c10d1;if(_0x10b1fb[_0x6058('0x33')]['includeAll']){_0xf7c2b5[_0x6058('0x42')]=[{'all':!![]}];}return db[_0x6058('0x2d')][_0x6058('0x43')](_0xf7c2b5);})[_0x6058('0x23')](function(_0x4e720d){_0x2b315e[_0x6058('0x44')]=_0x4e720d;return _0x2b315e;})[_0x6058('0x23')](respondWithFilteredResult(_0x2f4a4c,_0xf7c2b5))[_0x6058('0x45')](handleError(_0x2f4a4c,null));};exports[_0x6058('0x46')]=function(_0x5d13c8,_0x39f0d4){var _0x52a8f3={'raw':!![],'where':{'id':_0x5d13c8[_0x6058('0x47')]['id']}},_0x36d1a6={};_0x36d1a6[_0x6058('0x31')]=_['keys'](db[_0x6058('0x2d')][_0x6058('0x2e')]);_0x36d1a6['query']=_[_0x6058('0x32')](_0x5d13c8[_0x6058('0x33')]);_0x36d1a6[_0x6058('0x34')]=_[_0x6058('0x48')](_0x36d1a6[_0x6058('0x31')],_0x36d1a6['query']);_0x52a8f3['attributes']=_['intersection'](_0x36d1a6[_0x6058('0x31')],qs[_0x6058('0x36')](_0x5d13c8[_0x6058('0x33')][_0x6058('0x36')]));_0x52a8f3[_0x6058('0x35')]=_0x52a8f3[_0x6058('0x35')][_0x6058('0x37')]?_0x52a8f3[_0x6058('0x35')]:_0x36d1a6['model'];if(_0x5d13c8[_0x6058('0x33')][_0x6058('0x49')]){_0x52a8f3[_0x6058('0x42')]=[{'all':!![]}];}_0x52a8f3=_[_0x6058('0x40')]({},_0x52a8f3,_0x5d13c8['options']);return db[_0x6058('0x2d')][_0x6058('0x4a')](_0x52a8f3)[_0x6058('0x23')](handleEntityNotFound(_0x39f0d4,null))[_0x6058('0x23')](respondWithResult(_0x39f0d4,null))[_0x6058('0x45')](handleError(_0x39f0d4,null));};exports[_0x6058('0x4b')]=function(_0xd3e1eb,_0x4f4442){return db[_0x6058('0x2d')]['create'](_0xd3e1eb['body'],{})[_0x6058('0x23')](function(_0x2297bf){var _0x47cdcb=_0xd3e1eb[_0x6058('0x4c')][_0x6058('0x24')]({'plain':!![]});if(!_0x47cdcb)throw new Error(_0x6058('0x4d'));if(_0x47cdcb['role']===_0x6058('0x4c')){var _0x474bb3=_0x2297bf['get']({'plain':!![]});var _0x26bbad=_0x6058('0x25');return db[_0x6058('0x4e')]['find']({'where':{'name':_0x26bbad,'userProfileId':_0x47cdcb[_0x6058('0x4f')]},'raw':!![]})[_0x6058('0x23')](function(_0x55b1e7){if(_0x55b1e7&&_0x55b1e7['autoAssociation']===0x0){return db[_0x6058('0x26')][_0x6058('0x4b')]({'name':_0x474bb3[_0x6058('0x2a')],'resourceId':_0x474bb3['id'],'type':_0x55b1e7[_0x6058('0x2a')],'sectionId':_0x55b1e7['id']},{})['then'](function(){return _0x2297bf;});}else{return _0x2297bf;}})[_0x6058('0x45')](function(_0x39b288){logger[_0x6058('0x50')](_0x6058('0x51'),_0x39b288);throw _0x39b288;});}return _0x2297bf;})[_0x6058('0x23')](respondWithResult(_0x4f4442,0xc9))[_0x6058('0x45')](handleError(_0x4f4442,null));};exports[_0x6058('0x22')]=function(_0x4b3e67,_0x58af32){if(_0x4b3e67[_0x6058('0x52')]['id']){delete _0x4b3e67[_0x6058('0x52')]['id'];}return db[_0x6058('0x2d')][_0x6058('0x4a')]({'where':{'id':_0x4b3e67['params']['id']}})[_0x6058('0x23')](handleEntityNotFound(_0x58af32,null))[_0x6058('0x23')](saveUpdates(_0x4b3e67['body'],null))[_0x6058('0x23')](respondWithResult(_0x58af32,null))['catch'](handleError(_0x58af32,null));};exports[_0x6058('0x27')]=function(_0x454ae7,_0x4910c8){return db[_0x6058('0x2d')][_0x6058('0x4a')]({'where':{'id':_0x454ae7[_0x6058('0x47')]['id']}})[_0x6058('0x23')](handleEntityNotFound(_0x4910c8,null))[_0x6058('0x23')](removeEntity(_0x4910c8,null))['catch'](handleError(_0x4910c8,null));};exports[_0x6058('0x53')]=function(_0x5ee0fc,_0x1d95ad,_0x685b4a){var _0x33a011;return db['SquareOdbc'][_0x6058('0x4a')]({'where':{'id':_0x5ee0fc[_0x6058('0x47')]['id']},'attributes':['id',_0x6058('0x54')]})[_0x6058('0x23')](handleEntityNotFound(_0x1d95ad,null))[_0x6058('0x23')](function(_0x45c5b0){if(_0x45c5b0){var _0x55bbc5=require('odbc')();_0x55bbc5[_0x6058('0x55')](_0x45c5b0[_0x6058('0x54')]);_0x55bbc5[_0x6058('0x56')]();return _0x45c5b0;}})[_0x6058('0x23')](respondWithResult(_0x1d95ad,null))[_0x6058('0x45')](handleError(_0x1d95ad,null));}; \ No newline at end of file +var _0xff3b=['filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SquareOdbc','includeAll','include','findAll','show','params','keys','intersection','options','find','catch','create','role','user','ODBC','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save','then','destroy','get','stack','name','send','index','map','rawAttributes','fieldName','type','key','query'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xff3b,0x137));var _0xbff3=function(_0x3508c4,_0xf2f17e){_0x3508c4=_0x3508c4-0x0;var _0xc6e17c=_0xff3b[_0x3508c4];return _0xc6e17c;};'use strict';var emlformat=require(_0xbff3('0x0'));var rimraf=require(_0xbff3('0x1'));var zipdir=require(_0xbff3('0x2'));var jsonpatch=require(_0xbff3('0x3'));var rp=require('request-promise');var moment=require(_0xbff3('0x4'));var BPromise=require(_0xbff3('0x5'));var Mustache=require(_0xbff3('0x6'));var util=require(_0xbff3('0x7'));var path=require(_0xbff3('0x8'));var sox=require(_0xbff3('0x9'));var csv=require(_0xbff3('0xa'));var ejs=require(_0xbff3('0xb'));var fs=require('fs');var fs_extra=require(_0xbff3('0xc'));var _=require(_0xbff3('0xd'));var squel=require(_0xbff3('0xe'));var crypto=require('crypto');var jsforce=require(_0xbff3('0xf'));var deskjs=require(_0xbff3('0x10'));var toCsv=require(_0xbff3('0xa'));var querystring=require(_0xbff3('0x11'));var Papa=require('papaparse');var Redis=require(_0xbff3('0x12'));var authService=require(_0xbff3('0x13'));var qs=require(_0xbff3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbff3('0x15'));var logger=require('../../config/logger')(_0xbff3('0x16'));var utils=require(_0xbff3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbff3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599e3c,_0x321164){_0x321164=_0x321164||0xcc;return function(_0x82b5ef){if(_0x82b5ef){return _0x599e3c[_0xbff3('0x19')](_0x321164);}return _0x599e3c[_0xbff3('0x1a')](_0x321164)[_0xbff3('0x1b')]();};}function respondWithResult(_0x27a912,_0x45867f){_0x45867f=_0x45867f||0xc8;return function(_0x1c75ca){if(_0x1c75ca){return _0x27a912[_0xbff3('0x1a')](_0x45867f)[_0xbff3('0x1c')](_0x1c75ca);}};}function respondWithFilteredResult(_0x9dead4,_0x6b01e7){return function(_0x3bd4c2){if(_0x3bd4c2){var _0x50fcaf=typeof _0x6b01e7[_0xbff3('0x1d')]==='undefined'&&typeof _0x6b01e7[_0xbff3('0x1e')]===_0xbff3('0x1f');var _0x52ac7c=_0x3bd4c2[_0xbff3('0x20')];var _0x10acf2=_0x50fcaf?0x0:_0x6b01e7['offset'];var _0x4adba9=_0x50fcaf?_0x3bd4c2[_0xbff3('0x20')]:_0x6b01e7[_0xbff3('0x1d')]+_0x6b01e7['limit'];var _0x4923b8;if(_0x4adba9>=_0x52ac7c){_0x4adba9=_0x52ac7c;_0x4923b8=0xc8;}else{_0x4923b8=0xce;}_0x9dead4[_0xbff3('0x1a')](_0x4923b8);return _0x9dead4['set']('Content-Range',_0x10acf2+'-'+_0x4adba9+'/'+_0x52ac7c)[_0xbff3('0x1c')](_0x3bd4c2);}return null;};}function patchUpdates(_0x57d511){return function(_0xbc4934){try{jsonpatch[_0xbff3('0x21')](_0xbc4934,_0x57d511,!![]);}catch(_0x21c308){return BPromise[_0xbff3('0x22')](_0x21c308);}return _0xbc4934[_0xbff3('0x23')]();};}function saveUpdates(_0x58d568,_0x15a7c6){return function(_0x383a37){if(_0x383a37){return _0x383a37['update'](_0x58d568)[_0xbff3('0x24')](function(_0x4ab143){return _0x4ab143;});}return null;};}function removeEntity(_0xc064ea,_0x10b2b5){return function(_0x507922){if(_0x507922){return _0x507922[_0xbff3('0x25')]()['then'](function(){var _0x35fe03=_0x507922[_0xbff3('0x26')]({'plain':!![]});var _0x52adb0='ODBC';return db['UserProfileResource']['destroy']({'where':{'type':_0x52adb0,'resourceId':_0x35fe03['id']}})['then'](function(){return _0x507922;});})['then'](function(){_0xc064ea['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x337e04,_0x2c8491){return function(_0x23917c){if(!_0x23917c){_0x337e04[_0xbff3('0x19')](0x194);}return _0x23917c;};}function handleError(_0x2edaf5,_0x2db36e){_0x2db36e=_0x2db36e||0x1f4;return function(_0x1c062e){logger['error'](_0x1c062e[_0xbff3('0x27')]);if(_0x1c062e[_0xbff3('0x28')]){delete _0x1c062e[_0xbff3('0x28')];}_0x2edaf5[_0xbff3('0x1a')](_0x2db36e)[_0xbff3('0x29')](_0x1c062e);};}exports[_0xbff3('0x2a')]=function(_0x5bd536,_0x3aa647){var _0x491c49={},_0xf1d9b8={},_0x2ee5bd={'count':0x0,'rows':[]};var _0x3e60d9=_[_0xbff3('0x2b')](db['SquareOdbc'][_0xbff3('0x2c')],function(_0x4be5a8){return{'name':_0x4be5a8[_0xbff3('0x2d')],'type':_0x4be5a8[_0xbff3('0x2e')][_0xbff3('0x2f')]};});_0xf1d9b8['model']=_[_0xbff3('0x2b')](_0x3e60d9,_0xbff3('0x28'));_0xf1d9b8['query']=_['keys'](_0x5bd536[_0xbff3('0x30')]);_0xf1d9b8[_0xbff3('0x31')]=_['intersection'](_0xf1d9b8[_0xbff3('0x32')],_0xf1d9b8[_0xbff3('0x30')]);_0x491c49[_0xbff3('0x33')]=_['intersection'](_0xf1d9b8[_0xbff3('0x32')],qs[_0xbff3('0x34')](_0x5bd536[_0xbff3('0x30')][_0xbff3('0x34')]));_0x491c49[_0xbff3('0x33')]=_0x491c49['attributes'][_0xbff3('0x35')]?_0x491c49[_0xbff3('0x33')]:_0xf1d9b8[_0xbff3('0x32')];if(!_0x5bd536[_0xbff3('0x30')][_0xbff3('0x36')](_0xbff3('0x37'))){_0x491c49[_0xbff3('0x1e')]=qs[_0xbff3('0x1e')](_0x5bd536['query'][_0xbff3('0x1e')]);_0x491c49[_0xbff3('0x1d')]=qs[_0xbff3('0x1d')](_0x5bd536['query']['offset']);}_0x491c49[_0xbff3('0x38')]=qs[_0xbff3('0x39')](_0x5bd536['query'][_0xbff3('0x39')]);_0x491c49[_0xbff3('0x3a')]=qs['filters'](_[_0xbff3('0x3b')](_0x5bd536[_0xbff3('0x30')],_0xf1d9b8['filters']),_0x3e60d9);if(_0x5bd536[_0xbff3('0x30')][_0xbff3('0x3c')]){_0x491c49[_0xbff3('0x3a')]=_[_0xbff3('0x3d')](_0x491c49[_0xbff3('0x3a')],{'$or':_[_0xbff3('0x2b')](_0x3e60d9,function(_0x3ebe87){if(_0x3ebe87['type']!==_0xbff3('0x3e')){var _0x43371c={};_0x43371c[_0x3ebe87['name']]={'$like':'%'+_0x5bd536[_0xbff3('0x30')]['filter']+'%'};return _0x43371c;}})});}_0x491c49=_[_0xbff3('0x3d')]({},_0x491c49,_0x5bd536['options']);var _0x42b5df={'where':_0x491c49[_0xbff3('0x3a')]};return db[_0xbff3('0x3f')][_0xbff3('0x20')](_0x42b5df)[_0xbff3('0x24')](function(_0x381c0d){_0x2ee5bd['count']=_0x381c0d;if(_0x5bd536[_0xbff3('0x30')][_0xbff3('0x40')]){_0x491c49[_0xbff3('0x41')]=[{'all':!![]}];}return db[_0xbff3('0x3f')][_0xbff3('0x42')](_0x491c49);})[_0xbff3('0x24')](function(_0x5826cc){_0x2ee5bd['rows']=_0x5826cc;return _0x2ee5bd;})[_0xbff3('0x24')](respondWithFilteredResult(_0x3aa647,_0x491c49))['catch'](handleError(_0x3aa647,null));};exports[_0xbff3('0x43')]=function(_0x292314,_0x314fde){var _0x18049c={'raw':!![],'where':{'id':_0x292314[_0xbff3('0x44')]['id']}},_0x47fd2d={};_0x47fd2d[_0xbff3('0x32')]=_[_0xbff3('0x45')](db[_0xbff3('0x3f')][_0xbff3('0x2c')]);_0x47fd2d[_0xbff3('0x30')]=_[_0xbff3('0x45')](_0x292314[_0xbff3('0x30')]);_0x47fd2d[_0xbff3('0x31')]=_[_0xbff3('0x46')](_0x47fd2d[_0xbff3('0x32')],_0x47fd2d[_0xbff3('0x30')]);_0x18049c[_0xbff3('0x33')]=_['intersection'](_0x47fd2d[_0xbff3('0x32')],qs[_0xbff3('0x34')](_0x292314['query'][_0xbff3('0x34')]));_0x18049c[_0xbff3('0x33')]=_0x18049c[_0xbff3('0x33')][_0xbff3('0x35')]?_0x18049c['attributes']:_0x47fd2d['model'];if(_0x292314['query'][_0xbff3('0x40')]){_0x18049c[_0xbff3('0x41')]=[{'all':!![]}];}_0x18049c=_[_0xbff3('0x3d')]({},_0x18049c,_0x292314[_0xbff3('0x47')]);return db['SquareOdbc'][_0xbff3('0x48')](_0x18049c)[_0xbff3('0x24')](handleEntityNotFound(_0x314fde,null))[_0xbff3('0x24')](respondWithResult(_0x314fde,null))[_0xbff3('0x49')](handleError(_0x314fde,null));};exports['create']=function(_0x5c3a2b,_0x3750be){return db[_0xbff3('0x3f')][_0xbff3('0x4a')](_0x5c3a2b['body'],{})[_0xbff3('0x24')](function(_0x496d30){var _0x53c0bf=_0x5c3a2b['user'][_0xbff3('0x26')]({'plain':!![]});if(!_0x53c0bf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53c0bf[_0xbff3('0x4b')]===_0xbff3('0x4c')){var _0x272615=_0x496d30['get']({'plain':!![]});var _0xc0b416=_0xbff3('0x4d');return db[_0xbff3('0x4e')][_0xbff3('0x48')]({'where':{'name':_0xc0b416,'userProfileId':_0x53c0bf[_0xbff3('0x4f')]},'raw':!![]})[_0xbff3('0x24')](function(_0x536a1d){if(_0x536a1d&&_0x536a1d[_0xbff3('0x50')]===0x0){return db[_0xbff3('0x51')][_0xbff3('0x4a')]({'name':_0x272615[_0xbff3('0x28')],'resourceId':_0x272615['id'],'type':_0x536a1d[_0xbff3('0x28')],'sectionId':_0x536a1d['id']},{})[_0xbff3('0x24')](function(){return _0x496d30;});}else{return _0x496d30;}})['catch'](function(_0x4ddd9a){logger['error'](_0xbff3('0x52'),_0x4ddd9a);throw _0x4ddd9a;});}return _0x496d30;})[_0xbff3('0x24')](respondWithResult(_0x3750be,0xc9))[_0xbff3('0x49')](handleError(_0x3750be,null));};exports[_0xbff3('0x53')]=function(_0x3f734c,_0x4c3402){if(_0x3f734c[_0xbff3('0x54')]['id']){delete _0x3f734c[_0xbff3('0x54')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x3f734c[_0xbff3('0x44')]['id']}})[_0xbff3('0x24')](handleEntityNotFound(_0x4c3402,null))[_0xbff3('0x24')](saveUpdates(_0x3f734c[_0xbff3('0x54')],null))[_0xbff3('0x24')](respondWithResult(_0x4c3402,null))[_0xbff3('0x49')](handleError(_0x4c3402,null));};exports[_0xbff3('0x25')]=function(_0x5ce570,_0x260237){return db[_0xbff3('0x3f')][_0xbff3('0x48')]({'where':{'id':_0x5ce570[_0xbff3('0x44')]['id']}})[_0xbff3('0x24')](handleEntityNotFound(_0x260237,null))[_0xbff3('0x24')](removeEntity(_0x260237,null))[_0xbff3('0x49')](handleError(_0x260237,null));};exports[_0xbff3('0x55')]=function(_0x4c79c8,_0x23cdd6,_0x11e363){var _0x3ce308;return db[_0xbff3('0x3f')][_0xbff3('0x48')]({'where':{'id':_0x4c79c8[_0xbff3('0x44')]['id']},'attributes':['id',_0xbff3('0x56')]})[_0xbff3('0x24')](handleEntityNotFound(_0x23cdd6,null))[_0xbff3('0x24')](function(_0x2a7599){if(_0x2a7599){var _0x15579f=require(_0xbff3('0x57'))();_0x15579f[_0xbff3('0x58')](_0x2a7599[_0xbff3('0x56')]);_0x15579f[_0xbff3('0x59')]();return _0x2a7599;}})[_0xbff3('0x24')](respondWithResult(_0x23cdd6,null))[_0xbff3('0x49')](handleError(_0x23cdd6,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index b75c17a..4b82a65 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 _0xdbe3=['square_odbc','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./squareOdbc.attributes','SquareOdbc'];(function(_0x2674da,_0x260820){var _0x3df00e=function(_0x56d91b){while(--_0x56d91b){_0x2674da['push'](_0x2674da['shift']());}};_0x3df00e(++_0x260820);}(_0xdbe3,0xbf));var _0x3dbe=function(_0x36dd6e,_0x322944){_0x36dd6e=_0x36dd6e-0x0;var _0x44176c=_0xdbe3[_0x36dd6e];return _0x44176c;};'use strict';var _=require(_0x3dbe('0x0'));var util=require(_0x3dbe('0x1'));var logger=require(_0x3dbe('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3dbe('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3dbe('0x4'));var rimraf=require(_0x3dbe('0x5'));var config=require(_0x3dbe('0x6'));var attributes=require(_0x3dbe('0x7'));module['exports']=function(_0x4bbea5,_0x1b9bc5){return _0x4bbea5['define'](_0x3dbe('0x8'),attributes,{'tableName':_0x3dbe('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ecc=['./squareOdbc.attributes','define','square_odbc','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x488286,_0x341045){var _0xa27d37=function(_0x39b148){while(--_0x39b148){_0x488286['push'](_0x488286['shift']());}};_0xa27d37(++_0x341045);}(_0x3ecc,0x135));var _0xc3ec=function(_0x330d53,_0x56e815){_0x330d53=_0x330d53-0x0;var _0x1543a7=_0x3ecc[_0x330d53];return _0x1543a7;};'use strict';var _=require(_0xc3ec('0x0'));var util=require('util');var logger=require(_0xc3ec('0x1'))(_0xc3ec('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc3ec('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3ec('0x4'));var config=require(_0xc3ec('0x5'));var attributes=require(_0xc3ec('0x6'));module['exports']=function(_0x4fe332,_0x33d296){return _0x4fe332[_0xc3ec('0x7')]('SquareOdbc',attributes,{'tableName':_0xc3ec('0x8'),'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 281d0d5..b6057b5 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 _0x12c4=['find','options','where','attributes','include','model','map','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','result','catch','ShowSquareOdbc','SquareOdbc'];(function(_0x1ddc29,_0x24ec4c){var _0x24d31b=function(_0x103932){while(--_0x103932){_0x1ddc29['push'](_0x1ddc29['shift']());}};_0x24d31b(++_0x24ec4c);}(_0x12c4,0x1c7));var _0x412c=function(_0x173d98,_0x47d1c0){_0x173d98=_0x173d98-0x0;var _0x410598=_0x12c4[_0x173d98];return _0x410598;};'use strict';var _=require(_0x412c('0x0'));var util=require(_0x412c('0x1'));var moment=require(_0x412c('0x2'));var BPromise=require('bluebird');var rs=require(_0x412c('0x3'));var fs=require('fs');var Redis=require(_0x412c('0x4'));var db=require(_0x412c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x412c('0x6'));var config=require(_0x412c('0x7'));var jayson=require(_0x412c('0x8'));var client=jayson[_0x412c('0x9')][_0x412c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x215727,_0x305996,_0x19c8bd){return new BPromise(function(_0x20c33f,_0x493b0a){return client[_0x412c('0xb')](_0x215727,_0x19c8bd)[_0x412c('0xc')](function(_0x4d259f){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x305996,'request\x20sent');logger[_0x412c('0xd')](_0x412c('0xe'),_0x305996,_0x412c('0xf'),JSON[_0x412c('0x10')](_0x4d259f));if(_0x4d259f['error']){if(_0x4d259f[_0x412c('0x11')][_0x412c('0x12')]===0x1f4){logger[_0x412c('0x11')](_0x412c('0x13'),_0x305996,_0x4d259f[_0x412c('0x11')][_0x412c('0x14')]);return _0x493b0a(_0x4d259f[_0x412c('0x11')][_0x412c('0x14')]);}logger[_0x412c('0x11')](_0x412c('0x13'),_0x305996,_0x4d259f[_0x412c('0x11')][_0x412c('0x14')]);return _0x20c33f(_0x4d259f[_0x412c('0x11')]['message']);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x305996,_0x412c('0xf'));_0x20c33f(_0x4d259f[_0x412c('0x15')][_0x412c('0x14')]);}})[_0x412c('0x16')](function(_0xfd2d6f){logger['error'](_0x412c('0x13'),_0x305996,_0xfd2d6f);_0x493b0a(_0xfd2d6f);});});}exports[_0x412c('0x17')]=function(_0x4ede52){var _0x1bdc06=this;return new Promise(function(_0x27dccf,_0x266939){return db[_0x412c('0x18')][_0x412c('0x19')]({'raw':_0x4ede52[_0x412c('0x1a')]?_0x4ede52['options']['raw']===undefined?!![]:![]:!![],'where':_0x4ede52[_0x412c('0x1a')]?_0x4ede52[_0x412c('0x1a')][_0x412c('0x1b')]||null:null,'attributes':_0x4ede52[_0x412c('0x1a')]?_0x4ede52[_0x412c('0x1a')][_0x412c('0x1c')]||null:null,'include':_0x4ede52['options']?_0x4ede52[_0x412c('0x1a')][_0x412c('0x1d')]?_['map'](_0x4ede52['options'][_0x412c('0x1d')],function(_0x54e7f1){return{'model':db[_0x54e7f1['model']],'as':_0x54e7f1['as'],'attributes':_0x54e7f1[_0x412c('0x1c')],'include':_0x54e7f1[_0x412c('0x1d')]?_['map'](_0x54e7f1['include'],function(_0x11549e){return{'model':db[_0x11549e[_0x412c('0x1e')]],'as':_0x11549e['as'],'attributes':_0x11549e[_0x412c('0x1c')],'include':_0x11549e[_0x412c('0x1d')]?_[_0x412c('0x1f')](_0x11549e['include'],function(_0x2008a8){return{'model':db[_0x2008a8['model']],'as':_0x2008a8['as'],'attributes':_0x2008a8[_0x412c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x412c('0xc')](function(_0x1fb94e){logger['info'](_0x412c('0x17'),_0x4ede52);logger[_0x412c('0xd')](_0x412c('0x17'),_0x4ede52,JSON['stringify'](_0x1fb94e));_0x27dccf(_0x1fb94e);})[_0x412c('0x16')](function(_0x2ccc2d){logger['error']('ShowSquareOdbc',_0x2ccc2d[_0x412c('0x14')],_0x4ede52);_0x266939(_0x1bdc06[_0x412c('0x11')](0x1f4,_0x2ccc2d['message']));});});}; \ No newline at end of file +var _0x3658=['request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','ShowSquareOdbc','SquareOdbc','options','raw','where','map','include','model','attributes','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x20ebf7,_0x255d29){var _0x28be76=function(_0x5dc978){while(--_0x5dc978){_0x20ebf7['push'](_0x20ebf7['shift']());}};_0x28be76(++_0x255d29);}(_0x3658,0x1aa));var _0x8365=function(_0x54d175,_0xd4732a){_0x54d175=_0x54d175-0x0;var _0x455ff7=_0x3658[_0x54d175];return _0x455ff7;};'use strict';var _=require(_0x8365('0x0'));var util=require(_0x8365('0x1'));var moment=require('moment');var BPromise=require(_0x8365('0x2'));var rs=require(_0x8365('0x3'));var fs=require('fs');var Redis=require(_0x8365('0x4'));var db=require(_0x8365('0x5'))['db'];var utils=require(_0x8365('0x6'));var logger=require(_0x8365('0x7'))(_0x8365('0x8'));var config=require(_0x8365('0x9'));var jayson=require(_0x8365('0xa'));var client=jayson[_0x8365('0xb')][_0x8365('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa53a56,_0x43c27c,_0x2f6b56){return new BPromise(function(_0x2c0063,_0x17439e){return client[_0x8365('0xd')](_0xa53a56,_0x2f6b56)[_0x8365('0xe')](function(_0x32b44b){logger[_0x8365('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x43c27c,_0x8365('0x10'));logger['debug'](_0x8365('0x11'),_0x43c27c,'request\x20sent',JSON[_0x8365('0x12')](_0x32b44b));if(_0x32b44b['error']){if(_0x32b44b[_0x8365('0x13')][_0x8365('0x14')]===0x1f4){logger['error'](_0x8365('0x15'),_0x43c27c,_0x32b44b[_0x8365('0x13')][_0x8365('0x16')]);return _0x17439e(_0x32b44b[_0x8365('0x13')]['message']);}logger['error'](_0x8365('0x15'),_0x43c27c,_0x32b44b[_0x8365('0x13')]['message']);return _0x2c0063(_0x32b44b[_0x8365('0x13')]['message']);}else{logger[_0x8365('0xf')](_0x8365('0x15'),_0x43c27c,_0x8365('0x10'));_0x2c0063(_0x32b44b['result'][_0x8365('0x16')]);}})[_0x8365('0x17')](function(_0x2b3dff){logger[_0x8365('0x13')](_0x8365('0x15'),_0x43c27c,_0x2b3dff);_0x17439e(_0x2b3dff);});});}exports[_0x8365('0x18')]=function(_0x22eb42){var _0xf3f352=this;return new Promise(function(_0x3a0e15,_0x2ba47d){return db[_0x8365('0x19')]['find']({'raw':_0x22eb42['options']?_0x22eb42[_0x8365('0x1a')][_0x8365('0x1b')]===undefined?!![]:![]:!![],'where':_0x22eb42[_0x8365('0x1a')]?_0x22eb42[_0x8365('0x1a')][_0x8365('0x1c')]||null:null,'attributes':_0x22eb42[_0x8365('0x1a')]?_0x22eb42[_0x8365('0x1a')]['attributes']||null:null,'include':_0x22eb42[_0x8365('0x1a')]?_0x22eb42[_0x8365('0x1a')]['include']?_[_0x8365('0x1d')](_0x22eb42[_0x8365('0x1a')][_0x8365('0x1e')],function(_0xb45f64){return{'model':db[_0xb45f64[_0x8365('0x1f')]],'as':_0xb45f64['as'],'attributes':_0xb45f64[_0x8365('0x20')],'include':_0xb45f64[_0x8365('0x1e')]?_[_0x8365('0x1d')](_0xb45f64['include'],function(_0x2c1e33){return{'model':db[_0x2c1e33[_0x8365('0x1f')]],'as':_0x2c1e33['as'],'attributes':_0x2c1e33[_0x8365('0x20')],'include':_0x2c1e33[_0x8365('0x1e')]?_[_0x8365('0x1d')](_0x2c1e33[_0x8365('0x1e')],function(_0x545279){return{'model':db[_0x545279[_0x8365('0x1f')]],'as':_0x545279['as'],'attributes':_0x545279[_0x8365('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8365('0xe')](function(_0xa835f0){logger['info'](_0x8365('0x18'),_0x22eb42);logger[_0x8365('0x21')](_0x8365('0x18'),_0x22eb42,JSON[_0x8365('0x12')](_0xa835f0));_0x3a0e15(_0xa835f0);})[_0x8365('0x17')](function(_0x4b3a42){logger['error'](_0x8365('0x18'),_0x4b3a42[_0x8365('0x16')],_0x22eb42);_0x2ba47d(_0xf3f352[_0x8365('0x13')](0x1f4,_0x4b3a42[_0x8365('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 593276e..163e71b 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 _0xaf61=['../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5c7a85,_0x41dd19){var _0x35290f=function(_0x26215b){while(--_0x26215b){_0x5c7a85['push'](_0x5c7a85['shift']());}};_0x35290f(++_0x41dd19);}(_0xaf61,0x186));var _0x1af6=function(_0x2f5689,_0x2010ac){_0x2f5689=_0x2f5689-0x0;var _0x745c37=_0xaf61[_0x2f5689];return _0x745c37;};'use strict';var multer=require(_0x1af6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1af6('0x1'));var express=require(_0x1af6('0x2'));var router=express[_0x1af6('0x3')]();var fs_extra=require(_0x1af6('0x4'));var auth=require(_0x1af6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1af6('0x6'));var controller=require(_0x1af6('0x7'));router[_0x1af6('0x8')]('/',auth[_0x1af6('0x9')](),controller[_0x1af6('0xa')]);router[_0x1af6('0x8')](_0x1af6('0xb'),auth[_0x1af6('0x9')](),controller[_0x1af6('0xc')]);router[_0x1af6('0xd')]('/',auth[_0x1af6('0x9')](),controller[_0x1af6('0xe')]);router['put']('/:id',auth[_0x1af6('0x9')](),controller[_0x1af6('0xf')]);router[_0x1af6('0x10')](_0x1af6('0xb'),auth[_0x1af6('0x9')](),controller[_0x1af6('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1d51=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','/:id','isAuthenticated','show','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x596618,_0x196a78){var _0x2c2d9b=function(_0x177283){while(--_0x177283){_0x596618['push'](_0x596618['shift']());}};_0x2c2d9b(++_0x196a78);}(_0x1d51,0x19d));var _0x11d5=function(_0x5dd303,_0x1d0df3){_0x5dd303=_0x5dd303-0x0;var _0x236a55=_0x1d51[_0x5dd303];return _0x236a55;};'use strict';var multer=require('multer');var util=require(_0x11d5('0x0'));var path=require(_0x11d5('0x1'));var timeout=require(_0x11d5('0x2'));var express=require(_0x11d5('0x3'));var router=express[_0x11d5('0x4')]();var fs_extra=require(_0x11d5('0x5'));var auth=require(_0x11d5('0x6'));var interaction=require(_0x11d5('0x7'));var config=require(_0x11d5('0x8'));var controller=require(_0x11d5('0x9'));router[_0x11d5('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x11d5('0xb'),auth[_0x11d5('0xc')](),controller[_0x11d5('0xd')]);router['post']('/',auth[_0x11d5('0xc')](),controller[_0x11d5('0xe')]);router[_0x11d5('0xf')](_0x11d5('0xb'),auth[_0x11d5('0xc')](),controller['update']);router[_0x11d5('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x11d5('0x11')]);module[_0x11d5('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 55fcfd7..6b5a47d 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 _0x349f=['toString','utf8','production','sequelize','exports','STRING','TEXT','BLOB','long','getDataValue','preproduction'];(function(_0x3092d6,_0xea0310){var _0x2579a3=function(_0x501d88){while(--_0x501d88){_0x3092d6['push'](_0x3092d6['shift']());}};_0x2579a3(++_0xea0310);}(_0x349f,0xa8));var _0xf349=function(_0x48ae70,_0x49cae3){_0x48ae70=_0x48ae70-0x0;var _0x15a0e9=_0x349f[_0x48ae70];return _0x15a0e9;};'use strict';var Sequelize=require(_0xf349('0x0'));module[_0xf349('0x1')]={'name':{'type':Sequelize[_0xf349('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xf349('0x2')]},'notes':{'type':Sequelize[_0xf349('0x3')]},'preproduction':{'type':Sequelize[_0xf349('0x4')](_0xf349('0x5')),'get':function(){if(this[_0xf349('0x6')](_0xf349('0x7'))){return this[_0xf349('0x6')](_0xf349('0x7'))[_0xf349('0x8')](_0xf349('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0xf349('0x5')),'get':function(){if(this[_0xf349('0x6')](_0xf349('0xa'))){return this[_0xf349('0x6')](_0xf349('0xa'))[_0xf349('0x8')](_0xf349('0x9'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x5b5f=['production','utf8','DATE','sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction'];(function(_0x21be8b,_0x45ef84){var _0x239d2b=function(_0x5db9b1){while(--_0x5db9b1){_0x21be8b['push'](_0x21be8b['shift']());}};_0x239d2b(++_0x45ef84);}(_0x5b5f,0x1a7));var _0xf5b5=function(_0xc3f0cd,_0x3886a2){_0xc3f0cd=_0xc3f0cd-0x0;var _0x14a8c4=_0x5b5f[_0xc3f0cd];return _0x14a8c4;};'use strict';var Sequelize=require(_0xf5b5('0x0'));module[_0xf5b5('0x1')]={'name':{'type':Sequelize[_0xf5b5('0x2')],'unique':_0xf5b5('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xf5b5('0x4')]},'preproduction':{'type':Sequelize[_0xf5b5('0x5')](_0xf5b5('0x6')),'get':function(){if(this[_0xf5b5('0x7')](_0xf5b5('0x8'))){return this[_0xf5b5('0x7')](_0xf5b5('0x8'))['toString']('utf8');}}},'production':{'type':Sequelize[_0xf5b5('0x5')](_0xf5b5('0x6')),'get':function(){if(this[_0xf5b5('0x7')](_0xf5b5('0x9'))){return this[_0xf5b5('0x7')](_0xf5b5('0x9'))['toString'](_0xf5b5('0xa'));}}},'savedAt':{'type':Sequelize[_0xf5b5('0xb')]},'publishedAt':{'type':Sequelize[_0xf5b5('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index dfa5345..ba38747 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 _0x00ec=['stack','name','send','SquareProject','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','type','merge','includeAll','include','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','agi','stringify','production','lodash','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','json','undefined','limit','count','offset','Content-Range','update','then','destroy','get','SquareProjects','UserProfileResource','publish','status','end','sendStatus','error'];(function(_0x2633b3,_0x4cd5e5){var _0xdeeefb=function(_0x380ac6){while(--_0x380ac6){_0x2633b3['push'](_0x2633b3['shift']());}};_0xdeeefb(++_0x4cd5e5);}(_0x00ec,0xe1));var _0xc00e=function(_0x31ad84,_0x3a1364){_0x31ad84=_0x31ad84-0x0;var _0x2ab374=_0x00ec[_0x31ad84];return _0x2ab374;};'use strict';var _=require(_0xc00e('0x0'));var Redis=require(_0xc00e('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xc00e('0x2'))(_0xc00e('0x3'));var config=require('../../config/environment');var db=require(_0xc00e('0x4'))['db'];config[_0xc00e('0x5')]=_[_0xc00e('0x6')](config[_0xc00e('0x5')],{'host':_0xc00e('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc00e('0x5')]));require(_0xc00e('0x8'))[_0xc00e('0x9')](socket);function respondWithResult(_0x5af95e,_0x21531e){_0x21531e=_0x21531e||0xc8;return function(_0x67de6a){if(_0x67de6a){return _0x5af95e['status'](_0x21531e)[_0xc00e('0xa')](_0x67de6a);}};}function respondWithFilteredResult(_0x8a1a42,_0x2a1f3b){return function(_0x141e64){if(_0x141e64){var _0x4f00df=typeof _0x2a1f3b['offset']===_0xc00e('0xb')&&typeof _0x2a1f3b[_0xc00e('0xc')]===_0xc00e('0xb');var _0x5d8a2b=_0x141e64[_0xc00e('0xd')];var _0x33454b=_0x4f00df?0x0:_0x2a1f3b[_0xc00e('0xe')];var _0x8debea=_0x4f00df?_0x141e64[_0xc00e('0xd')]:_0x2a1f3b[_0xc00e('0xe')]+_0x2a1f3b[_0xc00e('0xc')];var _0x189633;if(_0x8debea>=_0x5d8a2b){_0x8debea=_0x5d8a2b;_0x189633=0xc8;}else{_0x189633=0xce;}_0x8a1a42['status'](_0x189633);return _0x8a1a42['set'](_0xc00e('0xf'),_0x33454b+'-'+_0x8debea+'/'+_0x5d8a2b)[_0xc00e('0xa')](_0x141e64);}return null;};}function saveUpdates(_0x1e4248){return function(_0x3c3a57){if(_0x3c3a57){return _0x3c3a57[_0xc00e('0x10')](_0x1e4248)[_0xc00e('0x11')](function(_0x1b5eda){return _0x1b5eda;});}return null;};}function removeEntity(_0x206c01){return function(_0x13d6e0){if(_0x13d6e0){return _0x13d6e0[_0xc00e('0x12')]()[_0xc00e('0x11')](function(){var _0x5c51fc=_0x13d6e0[_0xc00e('0x13')]({'plain':!![]});var _0x2e28c3=_0xc00e('0x14');return db[_0xc00e('0x15')][_0xc00e('0x12')]({'where':{'type':_0x2e28c3,'resourceId':_0x5c51fc['id']}})['then'](function(){return _0x13d6e0;});})[_0xc00e('0x11')](function(){var _0x125114=new Redis(config[_0xc00e('0x5')]);_0x125114[_0xc00e('0x16')]('agi',JSON['stringify']({'id':_0x13d6e0['id'],'deleted':!![]}));})['then'](function(){_0x206c01[_0xc00e('0x17')](0xcc)[_0xc00e('0x18')]();});}};}function handleEntityNotFound(_0x124bfd){return function(_0x90954a){if(!_0x90954a){_0x124bfd[_0xc00e('0x19')](0x194);}return _0x90954a;};}function handleError(_0x132a7b,_0x1291dd){_0x1291dd=_0x1291dd||0x1f4;return function(_0x4ea0ec){logger[_0xc00e('0x1a')](_0x4ea0ec[_0xc00e('0x1b')]);if(_0x4ea0ec[_0xc00e('0x1c')]){delete _0x4ea0ec[_0xc00e('0x1c')];}_0x132a7b[_0xc00e('0x17')](_0x1291dd)[_0xc00e('0x1d')](_0x4ea0ec);};}exports['index']=function(_0x295cc6,_0x97244a){var _0x19dc0e={},_0x9e52cc={},_0x7174e8={'count':0x0,'rows':[]};var _0x4cee63=_['map'](db[_0xc00e('0x1e')]['rawAttributes'],function(_0x1b0633){return{'name':_0x1b0633[_0xc00e('0x1f')],'type':_0x1b0633['type'][_0xc00e('0x20')]};});_0x9e52cc[_0xc00e('0x21')]=_['map'](_0x4cee63,_0xc00e('0x1c'));_0x9e52cc['query']=_[_0xc00e('0x22')](_0x295cc6[_0xc00e('0x23')]);_0x9e52cc[_0xc00e('0x24')]=_[_0xc00e('0x25')](_0x9e52cc[_0xc00e('0x21')],_0x9e52cc['query']);_0x19dc0e['attributes']=_[_0xc00e('0x25')](_0x9e52cc[_0xc00e('0x21')],qs[_0xc00e('0x26')](_0x295cc6[_0xc00e('0x23')][_0xc00e('0x26')]));_0x19dc0e['attributes']=_0x19dc0e[_0xc00e('0x27')][_0xc00e('0x28')]?_0x19dc0e[_0xc00e('0x27')]:_0x9e52cc[_0xc00e('0x21')];if(!_0x295cc6['query'][_0xc00e('0x29')](_0xc00e('0x2a'))){_0x19dc0e[_0xc00e('0xc')]=qs['limit'](_0x295cc6[_0xc00e('0x23')][_0xc00e('0xc')]);_0x19dc0e[_0xc00e('0xe')]=qs[_0xc00e('0xe')](_0x295cc6[_0xc00e('0x23')]['offset']);}_0x19dc0e[_0xc00e('0x2b')]=qs[_0xc00e('0x2c')](_0x295cc6[_0xc00e('0x23')][_0xc00e('0x2c')]);_0x19dc0e[_0xc00e('0x2d')]=qs['filters'](_['pick'](_0x295cc6[_0xc00e('0x23')],_0x9e52cc[_0xc00e('0x24')]),_0x4cee63);if(_0x295cc6[_0xc00e('0x23')]['filter']){_0x19dc0e[_0xc00e('0x2d')]=_['merge'](_0x19dc0e[_0xc00e('0x2d')],{'$or':_['map'](_0x4cee63,function(_0x18b964){if(_0x18b964[_0xc00e('0x2e')]!=='VIRTUAL'){var _0x29b7db={};_0x29b7db[_0x18b964['name']]={'$like':'%'+_0x295cc6[_0xc00e('0x23')]['filter']+'%'};return _0x29b7db;}})});}_0x19dc0e=_[_0xc00e('0x2f')]({},_0x19dc0e,_0x295cc6['options']);var _0x4e5e5a={'where':_0x19dc0e['where']};return db[_0xc00e('0x1e')][_0xc00e('0xd')](_0x4e5e5a)['then'](function(_0x79f5be){_0x7174e8[_0xc00e('0xd')]=_0x79f5be;if(_0x295cc6[_0xc00e('0x23')][_0xc00e('0x30')]){_0x19dc0e[_0xc00e('0x31')]=[{'all':!![]}];}return db[_0xc00e('0x1e')]['findAll'](_0x19dc0e);})[_0xc00e('0x11')](function(_0x66c0ed){_0x7174e8['rows']=_0x66c0ed;return _0x7174e8;})[_0xc00e('0x11')](respondWithFilteredResult(_0x97244a,_0x19dc0e))[_0xc00e('0x32')](handleError(_0x97244a,null));};exports[_0xc00e('0x33')]=function(_0x15d923,_0x5dadd3){var _0x185af2={'raw':![],'where':{'id':_0x15d923['params']['id']}},_0x3b0753={};_0x3b0753[_0xc00e('0x21')]=_['keys'](db['SquareProject'][_0xc00e('0x34')]);_0x3b0753[_0xc00e('0x23')]=_['keys'](_0x15d923[_0xc00e('0x23')]);_0x3b0753['filters']=_[_0xc00e('0x25')](_0x3b0753[_0xc00e('0x21')],_0x3b0753[_0xc00e('0x23')]);_0x185af2[_0xc00e('0x27')]=_[_0xc00e('0x25')](_0x3b0753['model'],qs['fields'](_0x15d923['query'][_0xc00e('0x26')]));_0x185af2[_0xc00e('0x27')]=_0x185af2['attributes']['length']?_0x185af2['attributes']:_0x3b0753[_0xc00e('0x21')];if(_0x15d923[_0xc00e('0x23')][_0xc00e('0x30')]){_0x185af2[_0xc00e('0x31')]=[{'all':!![]}];}_0x185af2=_[_0xc00e('0x2f')]({},_0x185af2,_0x15d923['options']);return db[_0xc00e('0x1e')][_0xc00e('0x35')](_0x185af2)[_0xc00e('0x11')](handleEntityNotFound(_0x5dadd3,null))['then'](respondWithResult(_0x5dadd3,null))['catch'](handleError(_0x5dadd3,null));};exports[_0xc00e('0x36')]=function(_0x31721f,_0xaf1ea){return db[_0xc00e('0x1e')]['create'](_0x31721f[_0xc00e('0x37')],{})['then'](function(_0x3dba29){var _0x3c9ad4=_0x31721f[_0xc00e('0x38')][_0xc00e('0x13')]({'plain':!![]});if(!_0x3c9ad4)throw new Error(_0xc00e('0x39'));if(_0x3c9ad4['role']===_0xc00e('0x38')){var _0x334313=_0x3dba29[_0xc00e('0x13')]({'plain':!![]});var _0x2a6e73=_0xc00e('0x14');return db['UserProfileSection'][_0xc00e('0x35')]({'where':{'name':_0x2a6e73,'userProfileId':_0x3c9ad4[_0xc00e('0x3a')]},'raw':!![]})[_0xc00e('0x11')](function(_0x22872e){if(_0x22872e&&_0x22872e[_0xc00e('0x3b')]===0x0){return db[_0xc00e('0x15')][_0xc00e('0x36')]({'name':_0x334313['name'],'resourceId':_0x334313['id'],'type':_0x22872e['name'],'sectionId':_0x22872e['id']},{})[_0xc00e('0x11')](function(){return _0x3dba29;});}else{return _0x3dba29;}})['catch'](function(_0x4be8a1){logger[_0xc00e('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4be8a1);throw _0x4be8a1;});}return _0x3dba29;})[_0xc00e('0x11')](respondWithResult(_0xaf1ea,0xc9))[_0xc00e('0x32')](handleError(_0xaf1ea,null));};exports[_0xc00e('0x10')]=function(_0x122a81,_0x482ba3){if(_0x122a81[_0xc00e('0x37')]['id']){delete _0x122a81[_0xc00e('0x37')]['id'];}return db[_0xc00e('0x1e')][_0xc00e('0x35')]({'where':{'id':_0x122a81['params']['id']}})[_0xc00e('0x11')](handleEntityNotFound(_0x482ba3,null))[_0xc00e('0x11')](saveUpdates(_0x122a81[_0xc00e('0x37')],null))['then'](function(_0x5df10b){if(!_0x5df10b)return;var _0x201545=_0x5df10b['get']({'plain':!![]});return _0x201545;})[_0xc00e('0x11')](function(_0x587fe3){var _0x27e2b6=new Redis(config[_0xc00e('0x5')]);_0x27e2b6[_0xc00e('0x16')](_0xc00e('0x3c'),JSON[_0xc00e('0x3d')](_['pick'](_0x587fe3,['id','name',_0xc00e('0x3e')])));return _0x587fe3;})[_0xc00e('0x11')](respondWithResult(_0x482ba3,null))[_0xc00e('0x32')](handleError(_0x482ba3,null));};exports['destroy']=function(_0x3e6e4e,_0x117ce4){return db['SquareProject']['find']({'where':{'id':_0x3e6e4e['params']['id']}})[_0xc00e('0x11')](handleEntityNotFound(_0x117ce4,null))[_0xc00e('0x11')](removeEntity(_0x117ce4,null))[_0xc00e('0x32')](handleError(_0x117ce4,null));}; \ No newline at end of file +var _0x5d40=['rows','show','params','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','production','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','localhost','socket.io-emitter','register','status','json','offset','undefined','count','limit','set','Content-Range','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','end','error','stack','name','index','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SquareProject','includeAll','include','findAll'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x5d40,0x1a1));var _0x05d4=function(_0x1e2f2a,_0x36bc57){_0x1e2f2a=_0x1e2f2a-0x0;var _0x10401e=_0x5d40[_0x1e2f2a];return _0x10401e;};'use strict';var _=require('lodash');var Redis=require(_0x05d4('0x0'));var qs=require(_0x05d4('0x1'));var logger=require('../../config/logger')(_0x05d4('0x2'));var config=require('../../config/environment');var db=require(_0x05d4('0x3'))['db'];config['redis']=_['defaults'](config[_0x05d4('0x4')],{'host':_0x05d4('0x5'),'port':0x18eb});var socket=require(_0x05d4('0x6'))(new Redis(config[_0x05d4('0x4')]));require('./squareProject.socket')[_0x05d4('0x7')](socket);function respondWithResult(_0x3bd36c,_0x2891ae){_0x2891ae=_0x2891ae||0xc8;return function(_0x44e726){if(_0x44e726){return _0x3bd36c[_0x05d4('0x8')](_0x2891ae)[_0x05d4('0x9')](_0x44e726);}};}function respondWithFilteredResult(_0x292514,_0x24dc12){return function(_0x46299f){if(_0x46299f){var _0x212135=typeof _0x24dc12[_0x05d4('0xa')]===_0x05d4('0xb')&&typeof _0x24dc12['limit']===_0x05d4('0xb');var _0x3d321d=_0x46299f[_0x05d4('0xc')];var _0x12f5ca=_0x212135?0x0:_0x24dc12['offset'];var _0x19ded1=_0x212135?_0x46299f[_0x05d4('0xc')]:_0x24dc12[_0x05d4('0xa')]+_0x24dc12[_0x05d4('0xd')];var _0x43d266;if(_0x19ded1>=_0x3d321d){_0x19ded1=_0x3d321d;_0x43d266=0xc8;}else{_0x43d266=0xce;}_0x292514['status'](_0x43d266);return _0x292514[_0x05d4('0xe')](_0x05d4('0xf'),_0x12f5ca+'-'+_0x19ded1+'/'+_0x3d321d)[_0x05d4('0x9')](_0x46299f);}return null;};}function saveUpdates(_0x49d075){return function(_0x29bee5){if(_0x29bee5){return _0x29bee5['update'](_0x49d075)[_0x05d4('0x10')](function(_0x12047c){return _0x12047c;});}return null;};}function removeEntity(_0x1dbb33){return function(_0x285094){if(_0x285094){return _0x285094[_0x05d4('0x11')]()[_0x05d4('0x10')](function(){var _0x411b18=_0x285094[_0x05d4('0x12')]({'plain':!![]});var _0x2147e2=_0x05d4('0x13');return db[_0x05d4('0x14')]['destroy']({'where':{'type':_0x2147e2,'resourceId':_0x411b18['id']}})['then'](function(){return _0x285094;});})[_0x05d4('0x10')](function(){var _0x6d8b74=new Redis(config['redis']);_0x6d8b74[_0x05d4('0x15')](_0x05d4('0x16'),JSON['stringify']({'id':_0x285094['id'],'deleted':!![]}));})[_0x05d4('0x10')](function(){_0x1dbb33['status'](0xcc)[_0x05d4('0x17')]();});}};}function handleEntityNotFound(_0x3d3012){return function(_0x30259f){if(!_0x30259f){_0x3d3012['sendStatus'](0x194);}return _0x30259f;};}function handleError(_0x190324,_0x5bc9aa){_0x5bc9aa=_0x5bc9aa||0x1f4;return function(_0x1e9f4e){logger[_0x05d4('0x18')](_0x1e9f4e[_0x05d4('0x19')]);if(_0x1e9f4e[_0x05d4('0x1a')]){delete _0x1e9f4e[_0x05d4('0x1a')];}_0x190324[_0x05d4('0x8')](_0x5bc9aa)['send'](_0x1e9f4e);};}exports[_0x05d4('0x1b')]=function(_0x5e323a,_0x54edf1){var _0x21f38d={},_0x199a31={},_0x3a28cb={'count':0x0,'rows':[]};var _0x2d7ad2=_['map'](db['SquareProject'][_0x05d4('0x1c')],function(_0x42be65){return{'name':_0x42be65[_0x05d4('0x1d')],'type':_0x42be65[_0x05d4('0x1e')]['key']};});_0x199a31[_0x05d4('0x1f')]=_[_0x05d4('0x20')](_0x2d7ad2,_0x05d4('0x1a'));_0x199a31['query']=_['keys'](_0x5e323a[_0x05d4('0x21')]);_0x199a31[_0x05d4('0x22')]=_[_0x05d4('0x23')](_0x199a31[_0x05d4('0x1f')],_0x199a31[_0x05d4('0x21')]);_0x21f38d[_0x05d4('0x24')]=_[_0x05d4('0x23')](_0x199a31[_0x05d4('0x1f')],qs[_0x05d4('0x25')](_0x5e323a['query'][_0x05d4('0x25')]));_0x21f38d['attributes']=_0x21f38d[_0x05d4('0x24')][_0x05d4('0x26')]?_0x21f38d[_0x05d4('0x24')]:_0x199a31[_0x05d4('0x1f')];if(!_0x5e323a[_0x05d4('0x21')]['hasOwnProperty'](_0x05d4('0x27'))){_0x21f38d[_0x05d4('0xd')]=qs['limit'](_0x5e323a[_0x05d4('0x21')][_0x05d4('0xd')]);_0x21f38d['offset']=qs[_0x05d4('0xa')](_0x5e323a['query'][_0x05d4('0xa')]);}_0x21f38d[_0x05d4('0x28')]=qs['sort'](_0x5e323a[_0x05d4('0x21')][_0x05d4('0x29')]);_0x21f38d[_0x05d4('0x2a')]=qs[_0x05d4('0x22')](_[_0x05d4('0x2b')](_0x5e323a[_0x05d4('0x21')],_0x199a31[_0x05d4('0x22')]),_0x2d7ad2);if(_0x5e323a[_0x05d4('0x21')]['filter']){_0x21f38d[_0x05d4('0x2a')]=_[_0x05d4('0x2c')](_0x21f38d[_0x05d4('0x2a')],{'$or':_[_0x05d4('0x20')](_0x2d7ad2,function(_0x4a3da2){if(_0x4a3da2['type']!==_0x05d4('0x2d')){var _0x439a5e={};_0x439a5e[_0x4a3da2['name']]={'$like':'%'+_0x5e323a[_0x05d4('0x21')][_0x05d4('0x2e')]+'%'};return _0x439a5e;}})});}_0x21f38d=_['merge']({},_0x21f38d,_0x5e323a[_0x05d4('0x2f')]);var _0x19539b={'where':_0x21f38d[_0x05d4('0x2a')]};return db[_0x05d4('0x30')][_0x05d4('0xc')](_0x19539b)[_0x05d4('0x10')](function(_0x49436a){_0x3a28cb[_0x05d4('0xc')]=_0x49436a;if(_0x5e323a['query'][_0x05d4('0x31')]){_0x21f38d[_0x05d4('0x32')]=[{'all':!![]}];}return db[_0x05d4('0x30')][_0x05d4('0x33')](_0x21f38d);})['then'](function(_0x10ce82){_0x3a28cb[_0x05d4('0x34')]=_0x10ce82;return _0x3a28cb;})[_0x05d4('0x10')](respondWithFilteredResult(_0x54edf1,_0x21f38d))['catch'](handleError(_0x54edf1,null));};exports[_0x05d4('0x35')]=function(_0x4b9438,_0x135521){var _0x211889={'raw':![],'where':{'id':_0x4b9438[_0x05d4('0x36')]['id']}},_0x5958a7={};_0x5958a7[_0x05d4('0x1f')]=_['keys'](db[_0x05d4('0x30')][_0x05d4('0x1c')]);_0x5958a7['query']=_[_0x05d4('0x37')](_0x4b9438[_0x05d4('0x21')]);_0x5958a7[_0x05d4('0x22')]=_['intersection'](_0x5958a7[_0x05d4('0x1f')],_0x5958a7[_0x05d4('0x21')]);_0x211889[_0x05d4('0x24')]=_[_0x05d4('0x23')](_0x5958a7[_0x05d4('0x1f')],qs[_0x05d4('0x25')](_0x4b9438['query'][_0x05d4('0x25')]));_0x211889[_0x05d4('0x24')]=_0x211889[_0x05d4('0x24')][_0x05d4('0x26')]?_0x211889[_0x05d4('0x24')]:_0x5958a7[_0x05d4('0x1f')];if(_0x4b9438[_0x05d4('0x21')][_0x05d4('0x31')]){_0x211889[_0x05d4('0x32')]=[{'all':!![]}];}_0x211889=_[_0x05d4('0x2c')]({},_0x211889,_0x4b9438[_0x05d4('0x2f')]);return db['SquareProject'][_0x05d4('0x38')](_0x211889)[_0x05d4('0x10')](handleEntityNotFound(_0x135521,null))[_0x05d4('0x10')](respondWithResult(_0x135521,null))[_0x05d4('0x39')](handleError(_0x135521,null));};exports[_0x05d4('0x3a')]=function(_0x42ab4a,_0x48e94f){return db[_0x05d4('0x30')][_0x05d4('0x3a')](_0x42ab4a['body'],{})[_0x05d4('0x10')](function(_0x5730bd){var _0x2f0ea3=_0x42ab4a[_0x05d4('0x3b')][_0x05d4('0x12')]({'plain':!![]});if(!_0x2f0ea3)throw new Error(_0x05d4('0x3c'));if(_0x2f0ea3[_0x05d4('0x3d')]===_0x05d4('0x3b')){var _0x5caa33=_0x5730bd['get']({'plain':!![]});var _0x39d801=_0x05d4('0x13');return db['UserProfileSection'][_0x05d4('0x38')]({'where':{'name':_0x39d801,'userProfileId':_0x2f0ea3[_0x05d4('0x3e')]},'raw':!![]})[_0x05d4('0x10')](function(_0x2a5ac3){if(_0x2a5ac3&&_0x2a5ac3['autoAssociation']===0x0){return db[_0x05d4('0x14')][_0x05d4('0x3a')]({'name':_0x5caa33[_0x05d4('0x1a')],'resourceId':_0x5caa33['id'],'type':_0x2a5ac3[_0x05d4('0x1a')],'sectionId':_0x2a5ac3['id']},{})[_0x05d4('0x10')](function(){return _0x5730bd;});}else{return _0x5730bd;}})['catch'](function(_0x45f53a){logger[_0x05d4('0x18')](_0x05d4('0x3f'),_0x45f53a);throw _0x45f53a;});}return _0x5730bd;})[_0x05d4('0x10')](respondWithResult(_0x48e94f,0xc9))[_0x05d4('0x39')](handleError(_0x48e94f,null));};exports[_0x05d4('0x40')]=function(_0x50e08c,_0x2f5ca9){if(_0x50e08c[_0x05d4('0x41')]['id']){delete _0x50e08c[_0x05d4('0x41')]['id'];}return db[_0x05d4('0x30')]['find']({'where':{'id':_0x50e08c['params']['id']}})[_0x05d4('0x10')](handleEntityNotFound(_0x2f5ca9,null))[_0x05d4('0x10')](saveUpdates(_0x50e08c[_0x05d4('0x41')],null))['then'](function(_0x4033c3){if(!_0x4033c3)return;var _0x2b9aac=_0x4033c3['get']({'plain':!![]});return _0x2b9aac;})[_0x05d4('0x10')](function(_0x19c727){var _0x4fd8b8=new Redis(config['redis']);_0x4fd8b8[_0x05d4('0x15')](_0x05d4('0x16'),JSON['stringify'](_[_0x05d4('0x2b')](_0x19c727,['id',_0x05d4('0x1a'),_0x05d4('0x42')])));return _0x19c727;})[_0x05d4('0x10')](respondWithResult(_0x2f5ca9,null))[_0x05d4('0x39')](handleError(_0x2f5ca9,null));};exports['destroy']=function(_0x25508c,_0x515c68){return db[_0x05d4('0x30')]['find']({'where':{'id':_0x25508c[_0x05d4('0x36')]['id']}})[_0x05d4('0x10')](handleEntityNotFound(_0x515c68,null))['then'](removeEntity(_0x515c68,null))[_0x05d4('0x39')](handleError(_0x515c68,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index c492825..21c3eef 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 _0xa6b9=['update','remove','emit','hasOwnProperty','hook','exports','events','SquareProject','setMaxListeners','save'];(function(_0x466708,_0x362174){var _0x5ba02e=function(_0x495443){while(--_0x495443){_0x466708['push'](_0x466708['shift']());}};_0x5ba02e(++_0x362174);}(_0xa6b9,0x9c));var _0x9a6b=function(_0x2732d3,_0x4aac2d){_0x2732d3=_0x2732d3-0x0;var _0x56824d=_0xa6b9[_0x2732d3];return _0x56824d;};'use strict';var EventEmitter=require(_0x9a6b('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x9a6b('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x9a6b('0x2')](0x0);var events={'afterCreate':_0x9a6b('0x3'),'afterUpdate':_0x9a6b('0x4'),'afterDestroy':_0x9a6b('0x5')};function emitEvent(_0x19dbc6){return function(_0x181959,_0x542f27,_0x2298e0){SquareProjectEvents[_0x9a6b('0x6')](_0x19dbc6+':'+_0x181959['id'],_0x181959);SquareProjectEvents[_0x9a6b('0x6')](_0x19dbc6,_0x181959);_0x2298e0(null);};}for(var e in events){if(events[_0x9a6b('0x7')](e)){var event=events[e];SquareProject[_0x9a6b('0x8')](e,emitEvent(event));}}module[_0x9a6b('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0xf281=['exports','SquareProject','remove','emit','hasOwnProperty','hook'];(function(_0x5aef17,_0x592cd4){var _0x43f9d0=function(_0x49ea9c){while(--_0x49ea9c){_0x5aef17['push'](_0x5aef17['shift']());}};_0x43f9d0(++_0x592cd4);}(_0xf281,0x6d));var _0x1f28=function(_0xb76a7,_0x1161ef){_0xb76a7=_0xb76a7-0x0;var _0x152fac=_0xf281[_0xb76a7];return _0x152fac;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0x1f28('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1f28('0x1')};function emitEvent(_0x132b8d){return function(_0x29a473,_0x4bed53,_0x4162b6){SquareProjectEvents[_0x1f28('0x2')](_0x132b8d+':'+_0x29a473['id'],_0x29a473);SquareProjectEvents[_0x1f28('0x2')](_0x132b8d,_0x29a473);_0x4162b6(null);};}for(var e in events){if(events[_0x1f28('0x3')](e)){var event=events[e];SquareProject[_0x1f28('0x4')](e,emitEvent(event));}}module[_0x1f28('0x5')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index d3712f3..2a798ca 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 _0x873d=['savedAt','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash','api','moment','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','changed','preproduction'];(function(_0x358c53,_0x380c29){var _0x57843e=function(_0x565bb7){while(--_0x565bb7){_0x358c53['push'](_0x358c53['shift']());}};_0x57843e(++_0x380c29);}(_0x873d,0x1e4));var _0xd873=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x873d[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xd873('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd873('0x1'));var moment=require(_0xd873('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd873('0x3'));var rimraf=require(_0xd873('0x4'));var config=require(_0xd873('0x5'));var attributes=require(_0xd873('0x6'));module[_0xd873('0x7')]=function(_0x51904a,_0x241e80){return _0x51904a[_0xd873('0x8')](_0xd873('0x9'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1d93f1,_0x4a451d,_0x5ba257){if(_0x1d93f1[_0xd873('0xa')](_0xd873('0xb'))){_0x1d93f1[_0xd873('0xc')]=moment()[_0xd873('0xd')](_0xd873('0xe'));}if(_0x1d93f1[_0xd873('0xa')]('production')){_0x1d93f1[_0xd873('0xf')]=moment()[_0xd873('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5ba257(null,_0x1d93f1);}}});}; \ No newline at end of file +var _0x78c2=['../../config/environment','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x78c2,0x9a));var _0x278c=function(_0x56a012,_0x3d6649){_0x56a012=_0x56a012-0x0;var _0x5f35ba=_0x78c2[_0x56a012];return _0x5f35ba;};'use strict';var _=require(_0x278c('0x0'));var util=require(_0x278c('0x1'));var logger=require(_0x278c('0x2'))(_0x278c('0x3'));var moment=require(_0x278c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x278c('0x5'));var config=require(_0x278c('0x6'));var attributes=require('./squareProject.attributes');module[_0x278c('0x7')]=function(_0x54fe3c,_0x5e86f7){return _0x54fe3c[_0x278c('0x8')](_0x278c('0x9'),attributes,{'tableName':_0x278c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x162693,_0xf905e8,_0x9bb7c2){if(_0x162693[_0x278c('0xb')](_0x278c('0xc'))){_0x162693[_0x278c('0xd')]=moment()[_0x278c('0xe')](_0x278c('0xf'));}if(_0x162693[_0x278c('0xb')]('production')){_0x162693['publishedAt']=moment()[_0x278c('0xe')](_0x278c('0xf'));}_0x9bb7c2(null,_0x162693);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 947315e..12ed5d8 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 _0xd1a0=['SquareProject','findAll','options','where','attributes','limit','include','model','map','then','GetSquareProjects','message','error','ShowSquareProject','find','info','debug','stringify','catch','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xd1a0,0x13f));var _0x0d1a=function(_0xe475ad,_0x58c8e2){_0xe475ad=_0xe475ad-0x0;var _0x515902=_0xd1a0[_0xe475ad];return _0x515902;};'use strict';var _=require('lodash');var Redis=require(_0x0d1a('0x0'));var db=require(_0x0d1a('0x1'))['db'];var logger=require(_0x0d1a('0x2'))(_0x0d1a('0x3'));var config=require(_0x0d1a('0x4'));config[_0x0d1a('0x5')]=_[_0x0d1a('0x6')](config[_0x0d1a('0x5')],{'host':_0x0d1a('0x7'),'port':0x18eb});var socket=require(_0x0d1a('0x8'))(new Redis(config['redis']));require(_0x0d1a('0x9'))[_0x0d1a('0xa')](socket);exports['GetSquareProjects']=function(_0x5d8b7b){var _0x1d4cdc=this;return new Promise(function(_0x5c7d9a,_0x56794f){return db[_0x0d1a('0xb')][_0x0d1a('0xc')]({'raw':_0x5d8b7b[_0x0d1a('0xd')]?_0x5d8b7b[_0x0d1a('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x5d8b7b[_0x0d1a('0xd')]?_0x5d8b7b[_0x0d1a('0xd')][_0x0d1a('0xe')]||null:null,'attributes':_0x5d8b7b['options']?_0x5d8b7b[_0x0d1a('0xd')][_0x0d1a('0xf')]||null:null,'limit':_0x5d8b7b[_0x0d1a('0xd')]?_0x5d8b7b[_0x0d1a('0xd')][_0x0d1a('0x10')]||null:null,'include':_0x5d8b7b[_0x0d1a('0xd')]?_0x5d8b7b[_0x0d1a('0xd')][_0x0d1a('0x11')]?_['map'](_0x5d8b7b['options'][_0x0d1a('0x11')],function(_0x202fd2){return{'model':db[_0x202fd2[_0x0d1a('0x12')]],'as':_0x202fd2['as'],'attributes':_0x202fd2[_0x0d1a('0xf')],'include':_0x202fd2[_0x0d1a('0x11')]?_[_0x0d1a('0x13')](_0x202fd2[_0x0d1a('0x11')],function(_0xa24563){return{'model':db[_0xa24563[_0x0d1a('0x12')]],'as':_0xa24563['as'],'attributes':_0xa24563[_0x0d1a('0xf')],'include':_0xa24563[_0x0d1a('0x11')]?_[_0x0d1a('0x13')](_0xa24563[_0x0d1a('0x11')],function(_0x1c15e4){return{'model':db[_0x1c15e4['model']],'as':_0x1c15e4['as'],'attributes':_0x1c15e4[_0x0d1a('0xf')]};}):[]};}):[]};}):[]:[]})[_0x0d1a('0x14')](function(_0x3c7681){logger['info'](_0x0d1a('0x15'),_0x5d8b7b);logger['debug'](_0x0d1a('0x15'),_0x5d8b7b,JSON['stringify'](_0x3c7681));_0x5c7d9a(_0x3c7681);})['catch'](function(_0x5e4f43){logger['error'](_0x0d1a('0x15'),_0x5e4f43[_0x0d1a('0x16')],_0x5d8b7b);_0x56794f(_0x1d4cdc[_0x0d1a('0x17')](0x1f4,_0x5e4f43[_0x0d1a('0x16')]));});});};exports[_0x0d1a('0x18')]=function(_0x43c7ce){var _0x553fc5=this;return new Promise(function(_0x2843af,_0x3d5e48){return db[_0x0d1a('0xb')][_0x0d1a('0x19')]({'raw':_0x43c7ce[_0x0d1a('0xd')]?_0x43c7ce[_0x0d1a('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x43c7ce[_0x0d1a('0xd')]?_0x43c7ce[_0x0d1a('0xd')][_0x0d1a('0xe')]||null:null,'attributes':_0x43c7ce[_0x0d1a('0xd')]?_0x43c7ce[_0x0d1a('0xd')][_0x0d1a('0xf')]||null:null,'include':_0x43c7ce[_0x0d1a('0xd')]?_0x43c7ce[_0x0d1a('0xd')]['include']?_[_0x0d1a('0x13')](_0x43c7ce[_0x0d1a('0xd')][_0x0d1a('0x11')],function(_0x37175b){return{'model':db[_0x37175b[_0x0d1a('0x12')]],'as':_0x37175b['as'],'attributes':_0x37175b[_0x0d1a('0xf')],'include':_0x37175b[_0x0d1a('0x11')]?_[_0x0d1a('0x13')](_0x37175b[_0x0d1a('0x11')],function(_0x3a1b5a){return{'model':db[_0x3a1b5a['model']],'as':_0x3a1b5a['as'],'attributes':_0x3a1b5a[_0x0d1a('0xf')],'include':_0x3a1b5a['include']?_[_0x0d1a('0x13')](_0x3a1b5a['include'],function(_0x1ee206){return{'model':db[_0x1ee206[_0x0d1a('0x12')]],'as':_0x1ee206['as'],'attributes':_0x1ee206[_0x0d1a('0xf')]};}):[]};}):[]};}):[]:[]})[_0x0d1a('0x14')](function(_0x5957e9){logger[_0x0d1a('0x1a')]('ShowSquareProject',_0x43c7ce);logger[_0x0d1a('0x1b')](_0x0d1a('0x18'),_0x43c7ce,JSON[_0x0d1a('0x1c')](_0x5957e9));_0x2843af(_0x5957e9);})[_0x0d1a('0x1d')](function(_0x593965){logger[_0x0d1a('0x17')](_0x0d1a('0x18'),_0x593965[_0x0d1a('0x16')],_0x43c7ce);_0x3d5e48(_0x553fc5[_0x0d1a('0x17')](0x1f4,_0x593965['message']));});});}; \ No newline at end of file +var _0x90e3=['model','then','info','stringify','catch','error','message','ShowSquareProject','find','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','where','include','map','attributes'];(function(_0x5cf7a6,_0x3abb00){var _0x52e7c3=function(_0x582835){while(--_0x582835){_0x5cf7a6['push'](_0x5cf7a6['shift']());}};_0x52e7c3(++_0x3abb00);}(_0x90e3,0x132));var _0x390e=function(_0x14b4b2,_0x42aed0){_0x14b4b2=_0x14b4b2-0x0;var _0x2710fd=_0x90e3[_0x14b4b2];return _0x2710fd;};'use strict';var _=require(_0x390e('0x0'));var Redis=require(_0x390e('0x1'));var db=require(_0x390e('0x2'))['db'];var logger=require(_0x390e('0x3'))('rpc');var config=require(_0x390e('0x4'));config[_0x390e('0x5')]=_['defaults'](config[_0x390e('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x390e('0x6'))(new Redis(config['redis']));require(_0x390e('0x7'))[_0x390e('0x8')](socket);exports[_0x390e('0x9')]=function(_0x3fdc73){var _0xb7a22f=this;return new Promise(function(_0x419375,_0xbfd6f5){return db[_0x390e('0xa')][_0x390e('0xb')]({'raw':_0x3fdc73[_0x390e('0xc')]?_0x3fdc73['options'][_0x390e('0xd')]===undefined?!![]:![]:!![],'where':_0x3fdc73[_0x390e('0xc')]?_0x3fdc73[_0x390e('0xc')][_0x390e('0xe')]||null:null,'attributes':_0x3fdc73[_0x390e('0xc')]?_0x3fdc73[_0x390e('0xc')]['attributes']||null:null,'limit':_0x3fdc73[_0x390e('0xc')]?_0x3fdc73[_0x390e('0xc')]['limit']||null:null,'include':_0x3fdc73[_0x390e('0xc')]?_0x3fdc73[_0x390e('0xc')][_0x390e('0xf')]?_[_0x390e('0x10')](_0x3fdc73['options'][_0x390e('0xf')],function(_0x476a33){return{'model':db[_0x476a33['model']],'as':_0x476a33['as'],'attributes':_0x476a33[_0x390e('0x11')],'include':_0x476a33['include']?_[_0x390e('0x10')](_0x476a33[_0x390e('0xf')],function(_0x3ad676){return{'model':db[_0x3ad676[_0x390e('0x12')]],'as':_0x3ad676['as'],'attributes':_0x3ad676[_0x390e('0x11')],'include':_0x3ad676[_0x390e('0xf')]?_[_0x390e('0x10')](_0x3ad676[_0x390e('0xf')],function(_0x33efeb){return{'model':db[_0x33efeb[_0x390e('0x12')]],'as':_0x33efeb['as'],'attributes':_0x33efeb[_0x390e('0x11')]};}):[]};}):[]};}):[]:[]})[_0x390e('0x13')](function(_0x42e2f9){logger[_0x390e('0x14')]('GetSquareProjects',_0x3fdc73);logger['debug'](_0x390e('0x9'),_0x3fdc73,JSON[_0x390e('0x15')](_0x42e2f9));_0x419375(_0x42e2f9);})[_0x390e('0x16')](function(_0xa93e7c){logger['error']('GetSquareProjects',_0xa93e7c['message'],_0x3fdc73);_0xbfd6f5(_0xb7a22f[_0x390e('0x17')](0x1f4,_0xa93e7c[_0x390e('0x18')]));});});};exports[_0x390e('0x19')]=function(_0x5dc620){var _0x1f38dc=this;return new Promise(function(_0x39927f,_0xe8dedb){return db['SquareProject'][_0x390e('0x1a')]({'raw':_0x5dc620[_0x390e('0xc')]?_0x5dc620['options'][_0x390e('0xd')]===undefined?!![]:![]:!![],'where':_0x5dc620[_0x390e('0xc')]?_0x5dc620['options'][_0x390e('0xe')]||null:null,'attributes':_0x5dc620[_0x390e('0xc')]?_0x5dc620[_0x390e('0xc')][_0x390e('0x11')]||null:null,'include':_0x5dc620['options']?_0x5dc620[_0x390e('0xc')][_0x390e('0xf')]?_['map'](_0x5dc620[_0x390e('0xc')]['include'],function(_0xc62986){return{'model':db[_0xc62986[_0x390e('0x12')]],'as':_0xc62986['as'],'attributes':_0xc62986[_0x390e('0x11')],'include':_0xc62986[_0x390e('0xf')]?_['map'](_0xc62986[_0x390e('0xf')],function(_0x176194){return{'model':db[_0x176194[_0x390e('0x12')]],'as':_0x176194['as'],'attributes':_0x176194['attributes'],'include':_0x176194[_0x390e('0xf')]?_['map'](_0x176194[_0x390e('0xf')],function(_0x169895){return{'model':db[_0x169895[_0x390e('0x12')]],'as':_0x169895['as'],'attributes':_0x169895[_0x390e('0x11')]};}):[]};}):[]};}):[]:[]})[_0x390e('0x13')](function(_0x653620){logger[_0x390e('0x14')](_0x390e('0x19'),_0x5dc620);logger['debug'](_0x390e('0x19'),_0x5dc620,JSON[_0x390e('0x15')](_0x653620));_0x39927f(_0x653620);})[_0x390e('0x16')](function(_0x461427){logger[_0x390e('0x17')](_0x390e('0x19'),_0x461427[_0x390e('0x18')],_0x5dc620);_0xe8dedb(_0x1f38dc[_0x390e('0x17')](0x1f4,_0x461427[_0x390e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index c290a9e..1c26560 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 _0x0e4c=['emit','register'];(function(_0x4ef6fe,_0x38ca10){var _0xe06a31=function(_0x466678){while(--_0x466678){_0x4ef6fe['push'](_0x4ef6fe['shift']());}};_0xe06a31(++_0x38ca10);}(_0x0e4c,0x1bc));var _0xc0e4=function(_0x3df516,_0x378f3e){_0x3df516=_0x3df516-0x0;var _0x135d41=_0x0e4c[_0x3df516];return _0x135d41;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save','remove','update'];function createListener(_0x4819b5,_0x28127f){return function(_0x53e79e){_0x28127f[_0xc0e4('0x0')](_0x4819b5,_0x53e79e);};}function removeListener(_0x5d4037,_0x2c0712){return function(){SquareProjectEvents['removeListener'](_0x5d4037,_0x2c0712);};}exports[_0xc0e4('0x1')]=function(_0x4f38ee){for(var _0x5535bd=0x0,_0x2970ac=events['length'];_0x5535bd<_0x2970ac;_0x5535bd++){var _0x2beb2c=events[_0x5535bd];var _0x4307bd=createListener('squareProject:'+_0x2beb2c,_0x4f38ee);SquareProjectEvents['on'](_0x2beb2c,_0x4307bd);}}; \ No newline at end of file +var _0x6814=['squareProject:','./squareProject.events','remove','update','register','length'];(function(_0x5b2a4f,_0xc77712){var _0x37908e=function(_0x5d524f){while(--_0x5d524f){_0x5b2a4f['push'](_0x5b2a4f['shift']());}};_0x37908e(++_0xc77712);}(_0x6814,0x15d));var _0x4681=function(_0x25446a,_0x1fc0bf){_0x25446a=_0x25446a-0x0;var _0xe39b14=_0x6814[_0x25446a];return _0xe39b14;};'use strict';var SquareProjectEvents=require(_0x4681('0x0'));var events=['save',_0x4681('0x1'),_0x4681('0x2')];function createListener(_0x8923e2,_0x21c7f8){return function(_0x20ad7b){_0x21c7f8['emit'](_0x8923e2,_0x20ad7b);};}function removeListener(_0x4f1e8c,_0x3aabd6){return function(){SquareProjectEvents['removeListener'](_0x4f1e8c,_0x3aabd6);};}exports[_0x4681('0x3')]=function(_0x4699b8){for(var _0x4e5255=0x0,_0x427a3e=events[_0x4681('0x4')];_0x4e5255<_0x427a3e;_0x4e5255++){var _0x3ac76d=events[_0x4e5255];var _0x18a05c=createListener(_0x4681('0x5')+_0x3ac76d,_0x4699b8);SquareProjectEvents['on'](_0x3ac76d,_0x18a05c);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index e1f3d93..3815952 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 _0xe14b=['Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id','download','post','delete','destroy','exports','multer','util','express'];(function(_0x5d3b94,_0x15c2a5){var _0x51d882=function(_0x5a420a){while(--_0x5a420a){_0x5d3b94['push'](_0x5d3b94['shift']());}};_0x51d882(++_0x15c2a5);}(_0xe14b,0x93));var _0xbe14=function(_0x25a2b4,_0x17713c){_0x25a2b4=_0x25a2b4-0x0;var _0x41450e=_0xe14b[_0x25a2b4];return _0x41450e;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['get']('/:id/download',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xc')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xd')]);module[_0xbe14('0xe')]=router; \ No newline at end of file +var _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x517e6b,_0x1eeff5){var _0x129f3b=function(_0xaa538){while(--_0xaa538){_0x517e6b['push'](_0x517e6b['shift']());}};_0x129f3b(++_0x1eeff5);}(_0xabce,0x103));var _0xeabc=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xabce[_0xdc37a1];return _0x99b4fe;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index f3fdfe1..33a77f0 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 _0x98a8=['exports','STRING','VIRTUAL','savePath','substring','lastIndexOf','sequelize'];(function(_0x2e8889,_0xcd72f9){var _0x19dae6=function(_0x4a7100){while(--_0x4a7100){_0x2e8889['push'](_0x2e8889['shift']());}};_0x19dae6(++_0xcd72f9);}(_0x98a8,0x12c));var _0x898a=function(_0x1390fe,_0x1bae33){_0x1390fe=_0x1390fe-0x0;var _0x33a2c6=_0x98a8[_0x1390fe];return _0x33a2c6;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'uniqueid':{'type':Sequelize[_0x898a('0x2')]},'callerid':{'type':Sequelize[_0x898a('0x2')]},'calleridname':{'type':Sequelize[_0x898a('0x2')]},'context':{'type':Sequelize[_0x898a('0x2')]},'extension':{'type':Sequelize[_0x898a('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x898a('0x2')]},'dnid':{'type':Sequelize[_0x898a('0x2')]},'projectName':{'type':Sequelize[_0x898a('0x2')]},'saveName':{'type':Sequelize[_0x898a('0x2')]},'filename':{'type':Sequelize[_0x898a('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x898a('0x3')],'get':function(){var _0x564583='';var _0xfa8c50=this['getDataValue'](_0x898a('0x4'));if(_0xfa8c50){_0x564583=_0xfa8c50[_0x898a('0x5')](_0xfa8c50[_0x898a('0x6')]('.'));}return _0x564583;}}}; \ No newline at end of file +var _0x33c5=['STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','exports'];(function(_0x50e26b,_0x5b14b4){var _0x3efdc5=function(_0x45ce58){while(--_0x45ce58){_0x50e26b['push'](_0x50e26b['shift']());}};_0x3efdc5(++_0x5b14b4);}(_0x33c5,0xe6));var _0x533c=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0x33c5[_0x3227c1];return _0x31fd48;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'uniqueid':{'type':Sequelize[_0x533c('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x533c('0x1')]},'context':{'type':Sequelize[_0x533c('0x1')]},'extension':{'type':Sequelize[_0x533c('0x1')]},'priority':{'type':Sequelize[_0x533c('0x1')]},'accountcode':{'type':Sequelize[_0x533c('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x533c('0x1')]},'saveName':{'type':Sequelize[_0x533c('0x1')]},'filename':{'type':Sequelize[_0x533c('0x1')]},'savePath':{'type':Sequelize[_0x533c('0x1')]},'format':{'type':Sequelize[_0x533c('0x2')],'get':function(){var _0x1699d5='';var _0x3a009b=this[_0x533c('0x3')](_0x533c('0x4'));if(_0x3a009b){_0x1699d5=_0x3a009b[_0x533c('0x5')](_0x3a009b[_0x533c('0x6')]('.'));}return _0x1699d5;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 246687c..3ab99f9 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 _0xfeed=['findAll','catch','params','keys','length','include','options','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','secrets','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll'];(function(_0x841dc,_0x32bf9f){var _0x335556=function(_0x402700){while(--_0x402700){_0x841dc['push'](_0x841dc['shift']());}};_0x335556(++_0x32bf9f);}(_0xfeed,0x86));var _0xdfee=function(_0x38800c,_0x48baff){_0x38800c=_0x38800c-0x0;var _0x15744c=_0xfeed[_0x38800c];return _0x15744c;};'use strict';var emlformat=require(_0xdfee('0x0'));var rimraf=require(_0xdfee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdfee('0x2'));var rp=require(_0xdfee('0x3'));var moment=require(_0xdfee('0x4'));var BPromise=require(_0xdfee('0x5'));var Mustache=require(_0xdfee('0x6'));var util=require(_0xdfee('0x7'));var path=require(_0xdfee('0x8'));var sox=require(_0xdfee('0x9'));var csv=require(_0xdfee('0xa'));var ejs=require(_0xdfee('0xb'));var fs=require('fs');var fs_extra=require(_0xdfee('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdfee('0xd'));var jsforce=require(_0xdfee('0xe'));var deskjs=require(_0xdfee('0xf'));var toCsv=require(_0xdfee('0xa'));var querystring=require(_0xdfee('0x10'));var Papa=require(_0xdfee('0x11'));var Redis=require(_0xdfee('0x12'));var authService=require(_0xdfee('0x13'));var qs=require(_0xdfee('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdfee('0x15'));var logger=require(_0xdfee('0x16'))(_0xdfee('0x17'));var utils=require('../../config/utils');var config=require(_0xdfee('0x18'));var licenseUtil=require(_0xdfee('0x19'));var db=require(_0xdfee('0x1a'))['db'];function respondWithStatusCode(_0x3c5abd,_0x1400e5){_0x1400e5=_0x1400e5||0xcc;return function(_0xd0e2f1){if(_0xd0e2f1){return _0x3c5abd[_0xdfee('0x1b')](_0x1400e5);}return _0x3c5abd['status'](_0x1400e5)[_0xdfee('0x1c')]();};}function respondWithResult(_0x5dcd1b,_0x4f0437){_0x4f0437=_0x4f0437||0xc8;return function(_0x1f525b){if(_0x1f525b){return _0x5dcd1b[_0xdfee('0x1d')](_0x4f0437)[_0xdfee('0x1e')](_0x1f525b);}};}function respondWithFilteredResult(_0x2ff3d8,_0x16f575){return function(_0x387f56){if(_0x387f56){var _0x5cb1ff=typeof _0x16f575[_0xdfee('0x1f')]===_0xdfee('0x20')&&typeof _0x16f575['limit']===_0xdfee('0x20');var _0x34e997=_0x387f56[_0xdfee('0x21')];var _0x48fc15=_0x5cb1ff?0x0:_0x16f575[_0xdfee('0x1f')];var _0x4db0cb=_0x5cb1ff?_0x387f56[_0xdfee('0x21')]:_0x16f575[_0xdfee('0x1f')]+_0x16f575['limit'];var _0x341687;if(_0x4db0cb>=_0x34e997){_0x4db0cb=_0x34e997;_0x341687=0xc8;}else{_0x341687=0xce;}_0x2ff3d8[_0xdfee('0x1d')](_0x341687);return _0x2ff3d8[_0xdfee('0x22')](_0xdfee('0x23'),_0x48fc15+'-'+_0x4db0cb+'/'+_0x34e997)[_0xdfee('0x1e')](_0x387f56);}return null;};}function patchUpdates(_0x34264a){return function(_0x115e8c){try{jsonpatch[_0xdfee('0x24')](_0x115e8c,_0x34264a,!![]);}catch(_0x4ded64){return BPromise[_0xdfee('0x25')](_0x4ded64);}return _0x115e8c[_0xdfee('0x26')]();};}function saveUpdates(_0x319856,_0x15d2db){return function(_0x2853e6){if(_0x2853e6){return _0x2853e6[_0xdfee('0x27')](_0x319856)[_0xdfee('0x28')](function(_0x1c1a06){return _0x1c1a06;});}return null;};}function removeEntity(_0x4453ec,_0x19a21d){return function(_0x49b245){if(_0x49b245){return _0x49b245[_0xdfee('0x29')]()[_0xdfee('0x28')](function(){_0x4453ec['status'](0xcc)[_0xdfee('0x1c')]();});}};}function handleEntityNotFound(_0x26d87e,_0x542f0b){return function(_0x3d9183){if(!_0x3d9183){_0x26d87e[_0xdfee('0x1b')](0x194);}return _0x3d9183;};}function handleError(_0x1c4791,_0x48b9de){_0x48b9de=_0x48b9de||0x1f4;return function(_0xa5b5fc){logger[_0xdfee('0x2a')](_0xa5b5fc['stack']);if(_0xa5b5fc[_0xdfee('0x2b')]){delete _0xa5b5fc[_0xdfee('0x2b')];}_0x1c4791[_0xdfee('0x1d')](_0x48b9de)[_0xdfee('0x2c')](_0xa5b5fc);};}exports[_0xdfee('0x2d')]=function(_0x13ffb5,_0x4f18dc){var _0x12ee6e={},_0x4fa967={},_0x466273={'count':0x0,'rows':[]};var _0x3bdf5e=_[_0xdfee('0x2e')](db[_0xdfee('0x2f')][_0xdfee('0x30')],function(_0xcd84fb){return{'name':_0xcd84fb[_0xdfee('0x31')],'type':_0xcd84fb[_0xdfee('0x32')]['key']};});_0x4fa967[_0xdfee('0x33')]=_[_0xdfee('0x2e')](_0x3bdf5e,_0xdfee('0x2b'));_0x4fa967[_0xdfee('0x34')]=_['keys'](_0x13ffb5['query']);_0x4fa967[_0xdfee('0x35')]=_[_0xdfee('0x36')](_0x4fa967[_0xdfee('0x33')],_0x4fa967[_0xdfee('0x34')]);_0x12ee6e[_0xdfee('0x37')]=_['intersection'](_0x4fa967['model'],qs[_0xdfee('0x38')](_0x13ffb5[_0xdfee('0x34')][_0xdfee('0x38')]));_0x12ee6e['attributes']=_0x12ee6e[_0xdfee('0x37')]['length']?_0x12ee6e[_0xdfee('0x37')]:_0x4fa967[_0xdfee('0x33')];if(!_0x13ffb5[_0xdfee('0x34')][_0xdfee('0x39')](_0xdfee('0x3a'))){_0x12ee6e['limit']=qs[_0xdfee('0x3b')](_0x13ffb5[_0xdfee('0x34')][_0xdfee('0x3b')]);_0x12ee6e[_0xdfee('0x1f')]=qs[_0xdfee('0x1f')](_0x13ffb5['query']['offset']);}_0x12ee6e[_0xdfee('0x3c')]=qs[_0xdfee('0x3d')](_0x13ffb5[_0xdfee('0x34')][_0xdfee('0x3d')]);_0x12ee6e[_0xdfee('0x3e')]=qs[_0xdfee('0x35')](_[_0xdfee('0x3f')](_0x13ffb5[_0xdfee('0x34')],_0x4fa967['filters']),_0x3bdf5e);if(_0x13ffb5['query'][_0xdfee('0x40')]){_0x12ee6e[_0xdfee('0x3e')]=_['merge'](_0x12ee6e[_0xdfee('0x3e')],{'$or':_['map'](_0x3bdf5e,function(_0x3a4e7a){if(_0x3a4e7a[_0xdfee('0x32')]!==_0xdfee('0x41')){var _0x2f9169={};_0x2f9169[_0x3a4e7a[_0xdfee('0x2b')]]={'$like':'%'+_0x13ffb5[_0xdfee('0x34')][_0xdfee('0x40')]+'%'};return _0x2f9169;}})});}_0x12ee6e=_[_0xdfee('0x42')]({},_0x12ee6e,_0x13ffb5['options']);var _0xb13d3e={'where':_0x12ee6e[_0xdfee('0x3e')]};return db[_0xdfee('0x2f')][_0xdfee('0x21')](_0xb13d3e)[_0xdfee('0x28')](function(_0x31a7ad){_0x466273[_0xdfee('0x21')]=_0x31a7ad;if(_0x13ffb5[_0xdfee('0x34')][_0xdfee('0x43')]){_0x12ee6e['include']=[{'all':!![]}];}return db[_0xdfee('0x2f')][_0xdfee('0x44')](_0x12ee6e);})[_0xdfee('0x28')](function(_0x5c442c){_0x466273['rows']=_0x5c442c;return _0x466273;})[_0xdfee('0x28')](respondWithFilteredResult(_0x4f18dc,_0x12ee6e))[_0xdfee('0x45')](handleError(_0x4f18dc,null));};exports['show']=function(_0x170f34,_0xe9aedd){var _0x49faec={'raw':!![],'where':{'id':_0x170f34[_0xdfee('0x46')]['id']}},_0x578d9d={};_0x578d9d[_0xdfee('0x33')]=_[_0xdfee('0x47')](db[_0xdfee('0x2f')]['rawAttributes']);_0x578d9d[_0xdfee('0x34')]=_[_0xdfee('0x47')](_0x170f34[_0xdfee('0x34')]);_0x578d9d[_0xdfee('0x35')]=_[_0xdfee('0x36')](_0x578d9d[_0xdfee('0x33')],_0x578d9d[_0xdfee('0x34')]);_0x49faec[_0xdfee('0x37')]=_[_0xdfee('0x36')](_0x578d9d[_0xdfee('0x33')],qs[_0xdfee('0x38')](_0x170f34[_0xdfee('0x34')][_0xdfee('0x38')]));_0x49faec[_0xdfee('0x37')]=_0x49faec[_0xdfee('0x37')][_0xdfee('0x48')]?_0x49faec[_0xdfee('0x37')]:_0x578d9d['model'];if(_0x170f34['query'][_0xdfee('0x43')]){_0x49faec[_0xdfee('0x49')]=[{'all':!![]}];}_0x49faec=_[_0xdfee('0x42')]({},_0x49faec,_0x170f34[_0xdfee('0x4a')]);return db[_0xdfee('0x2f')][_0xdfee('0x4b')](_0x49faec)[_0xdfee('0x28')](handleEntityNotFound(_0xe9aedd,null))[_0xdfee('0x28')](respondWithResult(_0xe9aedd,null))[_0xdfee('0x45')](handleError(_0xe9aedd,null));};exports[_0xdfee('0x4c')]=function(_0x3b5424,_0xc9ede7){return db[_0xdfee('0x2f')][_0xdfee('0x4c')](_0x3b5424[_0xdfee('0x4d')],{})[_0xdfee('0x28')](respondWithResult(_0xc9ede7,0xc9))[_0xdfee('0x45')](handleError(_0xc9ede7,null));};exports[_0xdfee('0x27')]=function(_0x26d6d7,_0x4e5e81){if(_0x26d6d7[_0xdfee('0x4d')]['id']){delete _0x26d6d7[_0xdfee('0x4d')]['id'];}return db[_0xdfee('0x2f')][_0xdfee('0x4b')]({'where':{'id':_0x26d6d7[_0xdfee('0x46')]['id']}})['then'](handleEntityNotFound(_0x4e5e81,null))[_0xdfee('0x28')](saveUpdates(_0x26d6d7[_0xdfee('0x4d')],null))['then'](respondWithResult(_0x4e5e81,null))[_0xdfee('0x45')](handleError(_0x4e5e81,null));};exports[_0xdfee('0x4e')]=function(_0x49dfc2,_0x9a9a54,_0xf461a9){var _0xa711ee=require(_0xdfee('0x4f'));var _0x3fd40a=![];var _0x37cf3c={};if(_0x49dfc2[_0xdfee('0x34')]['type']&&_0x49dfc2[_0xdfee('0x34')][_0xdfee('0x32')]===_0xdfee('0x50')){_0x37cf3c[_0xdfee('0x50')]=_0x49dfc2[_0xdfee('0x46')]['id'];}else{_0x37cf3c['id']=_0x49dfc2['params']['id'];}return db[_0xdfee('0x2f')][_0xdfee('0x4b')]({'where':_0x37cf3c,'attributes':['id',_0xdfee('0x51'),_0xdfee('0x52')],'raw':!![]})[_0xdfee('0x28')](handleEntityNotFound(_0x9a9a54,null))[_0xdfee('0x28')](function(_0x54555c){if(_0x54555c){var _0x2c92e5=_0x54555c[_0xdfee('0x51')];var _0x355ed0=util[_0xdfee('0x53')](_0xdfee('0x54'),_0x2c92e5);if(fs['existsSync'](_0x355ed0)){_0x3fd40a=!![];return _0xa711ee['decryptFile'](_0x355ed0,_0x2c92e5,config[_0xdfee('0x55')][_0xdfee('0x56')])[_0xdfee('0x28')](function(){return _0x54555c;});}return _0x54555c;}})['then'](function(_0x2f37d8){if(_0x2f37d8){var _0x5f070f=_0x2f37d8[_0xdfee('0x51')];if(!fs[_0xdfee('0x57')](_0x5f070f)){throw new db[(_0xdfee('0x58'))][(_0xdfee('0x59'))](_0xdfee('0x5a'));}if(_0x2f37d8[_0xdfee('0x52')]){return _0x9a9a54[_0xdfee('0x4e')](_0x5f070f,_0x2f37d8[_0xdfee('0x52')]+path[_0xdfee('0x5b')](_0x5f070f),function(){if(_0x3fd40a){fs[_0xdfee('0x5c')](_0x5f070f);}});}else{return _0x9a9a54[_0xdfee('0x4e')](_0x5f070f,function(_0x502d2b){if(_0x3fd40a){fs[_0xdfee('0x5c')](_0x5f070f);}});}}})['catch'](function(_0x16b376){if(_0x16b376[_0xdfee('0x5d')]===_0xdfee('0x5a')){_0x9a9a54['status'](0x194)[_0xdfee('0x2c')]('Not\x20found');}else{return handleError(_0x9a9a54,null);}});};exports[_0xdfee('0x29')]=function(_0x57aa13,_0x4a4d62){return db[_0xdfee('0x2f')]['find']({'where':{'id':_0x57aa13['params']['id']}})[_0xdfee('0x28')](function(_0x3b5a3a){if(_['isNil'](_0x3b5a3a)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3b5a3a;})[_0xdfee('0x28')](function(_0x259395){var _0xf88bbc=_0x259395[_0xdfee('0x51')];logger['info'](_0xdfee('0x5e'),_0xf88bbc);if(!_[_0xdfee('0x5f')](_0x259395[_0xdfee('0x51')])&&fs[_0xdfee('0x57')](_0xf88bbc)){logger[_0xdfee('0x60')](_0xdfee('0x61')+_0xf88bbc+_0xdfee('0x62'));fs[_0xdfee('0x63')](_0xf88bbc);}_0xf88bbc=_0xf88bbc+_0xdfee('0x64');if(!_[_0xdfee('0x5f')](_0x259395[_0xdfee('0x51')])&&fs[_0xdfee('0x57')](_0xf88bbc)){logger[_0xdfee('0x60')](_0xdfee('0x61')+_0xf88bbc+_0xdfee('0x62'));fs[_0xdfee('0x63')](_0xf88bbc);}return _0x259395;})[_0xdfee('0x28')](function(_0x34298a){if(!_0x34298a)throw new InternalError();return _0x34298a['destroy']();})[_0xdfee('0x28')](function(){_0x4a4d62[_0xdfee('0x1d')](0xcc)[_0xdfee('0x1c')]();})[_0xdfee('0x45')](handleError(_0x4a4d62,null));}; \ No newline at end of file +var _0xce75=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','json','offset','undefined','count','limit','set','reject','save','then','end','sendStatus','error','stack','name','send','index','type','query','keys','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','sort','where','filters','filter','merge','map','VIRTUAL','options','SquareRecording','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','decryptFile','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','download','message','Not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x224beb,_0x283712){var _0x144567=function(_0x546ab6){while(--_0x546ab6){_0x224beb['push'](_0x224beb['shift']());}};_0x144567(++_0x283712);}(_0xce75,0x171));var _0x5ce7=function(_0x5e530f,_0x496a5e){_0x5e530f=_0x5e530f-0x0;var _0x4f3332=_0xce75[_0x5e530f];return _0x4f3332;};'use strict';var emlformat=require(_0x5ce7('0x0'));var rimraf=require(_0x5ce7('0x1'));var zipdir=require(_0x5ce7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5ce7('0x3'));var moment=require(_0x5ce7('0x4'));var BPromise=require(_0x5ce7('0x5'));var Mustache=require(_0x5ce7('0x6'));var util=require(_0x5ce7('0x7'));var path=require(_0x5ce7('0x8'));var sox=require('sox');var csv=require(_0x5ce7('0x9'));var ejs=require(_0x5ce7('0xa'));var fs=require('fs');var fs_extra=require(_0x5ce7('0xb'));var _=require(_0x5ce7('0xc'));var squel=require(_0x5ce7('0xd'));var crypto=require(_0x5ce7('0xe'));var jsforce=require(_0x5ce7('0xf'));var deskjs=require(_0x5ce7('0x10'));var toCsv=require(_0x5ce7('0x9'));var querystring=require(_0x5ce7('0x11'));var Papa=require(_0x5ce7('0x12'));var Redis=require('ioredis');var authService=require(_0x5ce7('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5ce7('0x14'));var hardwareService=require(_0x5ce7('0x15'));var logger=require(_0x5ce7('0x16'))('api');var utils=require(_0x5ce7('0x17'));var config=require(_0x5ce7('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ab688,_0x5c0a13){_0x5c0a13=_0x5c0a13||0xcc;return function(_0xc29e81){if(_0xc29e81){return _0x3ab688['sendStatus'](_0x5c0a13);}return _0x3ab688[_0x5ce7('0x19')](_0x5c0a13)['end']();};}function respondWithResult(_0x5be0de,_0x2c45c1){_0x2c45c1=_0x2c45c1||0xc8;return function(_0x1cf0c4){if(_0x1cf0c4){return _0x5be0de[_0x5ce7('0x19')](_0x2c45c1)[_0x5ce7('0x1a')](_0x1cf0c4);}};}function respondWithFilteredResult(_0x55848a,_0xd19619){return function(_0x33c52c){if(_0x33c52c){var _0x48c508=typeof _0xd19619[_0x5ce7('0x1b')]===_0x5ce7('0x1c')&&typeof _0xd19619['limit']===_0x5ce7('0x1c');var _0x557164=_0x33c52c[_0x5ce7('0x1d')];var _0x58bff5=_0x48c508?0x0:_0xd19619[_0x5ce7('0x1b')];var _0x505d12=_0x48c508?_0x33c52c[_0x5ce7('0x1d')]:_0xd19619[_0x5ce7('0x1b')]+_0xd19619[_0x5ce7('0x1e')];var _0xa2a2d;if(_0x505d12>=_0x557164){_0x505d12=_0x557164;_0xa2a2d=0xc8;}else{_0xa2a2d=0xce;}_0x55848a[_0x5ce7('0x19')](_0xa2a2d);return _0x55848a[_0x5ce7('0x1f')]('Content-Range',_0x58bff5+'-'+_0x505d12+'/'+_0x557164)[_0x5ce7('0x1a')](_0x33c52c);}return null;};}function patchUpdates(_0x643558){return function(_0x4fed8e){try{jsonpatch['apply'](_0x4fed8e,_0x643558,!![]);}catch(_0x65a3b7){return BPromise[_0x5ce7('0x20')](_0x65a3b7);}return _0x4fed8e[_0x5ce7('0x21')]();};}function saveUpdates(_0x349216,_0x390fdc){return function(_0x596ac8){if(_0x596ac8){return _0x596ac8['update'](_0x349216)[_0x5ce7('0x22')](function(_0xf3bbd1){return _0xf3bbd1;});}return null;};}function removeEntity(_0x4888ab,_0x269153){return function(_0x2d667e){if(_0x2d667e){return _0x2d667e['destroy']()[_0x5ce7('0x22')](function(){_0x4888ab[_0x5ce7('0x19')](0xcc)[_0x5ce7('0x23')]();});}};}function handleEntityNotFound(_0x4bfca0,_0x302011){return function(_0x83df28){if(!_0x83df28){_0x4bfca0[_0x5ce7('0x24')](0x194);}return _0x83df28;};}function handleError(_0x26e746,_0x3f3a94){_0x3f3a94=_0x3f3a94||0x1f4;return function(_0x5f38f0){logger[_0x5ce7('0x25')](_0x5f38f0[_0x5ce7('0x26')]);if(_0x5f38f0[_0x5ce7('0x27')]){delete _0x5f38f0[_0x5ce7('0x27')];}_0x26e746[_0x5ce7('0x19')](_0x3f3a94)[_0x5ce7('0x28')](_0x5f38f0);};}exports[_0x5ce7('0x29')]=function(_0x31d7a1,_0x334b8a){var _0x2fd643={},_0x5eaf3f={},_0x47aeb3={'count':0x0,'rows':[]};var _0x201cbd=_['map'](db['SquareRecording']['rawAttributes'],function(_0x162887){return{'name':_0x162887['fieldName'],'type':_0x162887[_0x5ce7('0x2a')]['key']};});_0x5eaf3f['model']=_['map'](_0x201cbd,_0x5ce7('0x27'));_0x5eaf3f[_0x5ce7('0x2b')]=_[_0x5ce7('0x2c')](_0x31d7a1[_0x5ce7('0x2b')]);_0x5eaf3f['filters']=_['intersection'](_0x5eaf3f['model'],_0x5eaf3f[_0x5ce7('0x2b')]);_0x2fd643[_0x5ce7('0x2d')]=_[_0x5ce7('0x2e')](_0x5eaf3f['model'],qs[_0x5ce7('0x2f')](_0x31d7a1[_0x5ce7('0x2b')][_0x5ce7('0x2f')]));_0x2fd643[_0x5ce7('0x2d')]=_0x2fd643[_0x5ce7('0x2d')][_0x5ce7('0x30')]?_0x2fd643[_0x5ce7('0x2d')]:_0x5eaf3f[_0x5ce7('0x31')];if(!_0x31d7a1[_0x5ce7('0x2b')][_0x5ce7('0x32')](_0x5ce7('0x33'))){_0x2fd643[_0x5ce7('0x1e')]=qs[_0x5ce7('0x1e')](_0x31d7a1[_0x5ce7('0x2b')][_0x5ce7('0x1e')]);_0x2fd643['offset']=qs[_0x5ce7('0x1b')](_0x31d7a1[_0x5ce7('0x2b')]['offset']);}_0x2fd643['order']=qs['sort'](_0x31d7a1[_0x5ce7('0x2b')][_0x5ce7('0x34')]);_0x2fd643[_0x5ce7('0x35')]=qs[_0x5ce7('0x36')](_['pick'](_0x31d7a1['query'],_0x5eaf3f[_0x5ce7('0x36')]),_0x201cbd);if(_0x31d7a1['query'][_0x5ce7('0x37')]){_0x2fd643[_0x5ce7('0x35')]=_[_0x5ce7('0x38')](_0x2fd643[_0x5ce7('0x35')],{'$or':_[_0x5ce7('0x39')](_0x201cbd,function(_0x332256){if(_0x332256['type']!==_0x5ce7('0x3a')){var _0x28dffe={};_0x28dffe[_0x332256[_0x5ce7('0x27')]]={'$like':'%'+_0x31d7a1['query'][_0x5ce7('0x37')]+'%'};return _0x28dffe;}})});}_0x2fd643=_[_0x5ce7('0x38')]({},_0x2fd643,_0x31d7a1[_0x5ce7('0x3b')]);var _0x4d9df5={'where':_0x2fd643[_0x5ce7('0x35')]};return db[_0x5ce7('0x3c')][_0x5ce7('0x1d')](_0x4d9df5)[_0x5ce7('0x22')](function(_0x4d974b){_0x47aeb3[_0x5ce7('0x1d')]=_0x4d974b;if(_0x31d7a1[_0x5ce7('0x2b')][_0x5ce7('0x3d')]){_0x2fd643[_0x5ce7('0x3e')]=[{'all':!![]}];}return db[_0x5ce7('0x3c')][_0x5ce7('0x3f')](_0x2fd643);})[_0x5ce7('0x22')](function(_0x5b1e4e){_0x47aeb3[_0x5ce7('0x40')]=_0x5b1e4e;return _0x47aeb3;})['then'](respondWithFilteredResult(_0x334b8a,_0x2fd643))[_0x5ce7('0x41')](handleError(_0x334b8a,null));};exports[_0x5ce7('0x42')]=function(_0x1b16e0,_0x208953){var _0x20002e={'raw':!![],'where':{'id':_0x1b16e0[_0x5ce7('0x43')]['id']}},_0x409c47={};_0x409c47[_0x5ce7('0x31')]=_[_0x5ce7('0x2c')](db['SquareRecording'][_0x5ce7('0x44')]);_0x409c47[_0x5ce7('0x2b')]=_[_0x5ce7('0x2c')](_0x1b16e0[_0x5ce7('0x2b')]);_0x409c47[_0x5ce7('0x36')]=_[_0x5ce7('0x2e')](_0x409c47[_0x5ce7('0x31')],_0x409c47[_0x5ce7('0x2b')]);_0x20002e[_0x5ce7('0x2d')]=_[_0x5ce7('0x2e')](_0x409c47[_0x5ce7('0x31')],qs['fields'](_0x1b16e0[_0x5ce7('0x2b')][_0x5ce7('0x2f')]));_0x20002e[_0x5ce7('0x2d')]=_0x20002e[_0x5ce7('0x2d')][_0x5ce7('0x30')]?_0x20002e[_0x5ce7('0x2d')]:_0x409c47['model'];if(_0x1b16e0[_0x5ce7('0x2b')][_0x5ce7('0x3d')]){_0x20002e[_0x5ce7('0x3e')]=[{'all':!![]}];}_0x20002e=_[_0x5ce7('0x38')]({},_0x20002e,_0x1b16e0[_0x5ce7('0x3b')]);return db[_0x5ce7('0x3c')][_0x5ce7('0x45')](_0x20002e)[_0x5ce7('0x22')](handleEntityNotFound(_0x208953,null))[_0x5ce7('0x22')](respondWithResult(_0x208953,null))[_0x5ce7('0x41')](handleError(_0x208953,null));};exports[_0x5ce7('0x46')]=function(_0x9e4610,_0x2fc394){return db[_0x5ce7('0x3c')]['create'](_0x9e4610[_0x5ce7('0x47')],{})['then'](respondWithResult(_0x2fc394,0xc9))[_0x5ce7('0x41')](handleError(_0x2fc394,null));};exports[_0x5ce7('0x48')]=function(_0x4f4571,_0x1f08f3){if(_0x4f4571[_0x5ce7('0x47')]['id']){delete _0x4f4571[_0x5ce7('0x47')]['id'];}return db[_0x5ce7('0x3c')][_0x5ce7('0x45')]({'where':{'id':_0x4f4571[_0x5ce7('0x43')]['id']}})[_0x5ce7('0x22')](handleEntityNotFound(_0x1f08f3,null))[_0x5ce7('0x22')](saveUpdates(_0x4f4571[_0x5ce7('0x47')],null))[_0x5ce7('0x22')](respondWithResult(_0x1f08f3,null))[_0x5ce7('0x41')](handleError(_0x1f08f3,null));};exports['download']=function(_0x2c529b,_0x3494be,_0x5aa1c8){var _0x13c1dc=require(_0x5ce7('0x49'));var _0x4bca74=![];var _0x5703c3={};if(_0x2c529b[_0x5ce7('0x2b')]['type']&&_0x2c529b[_0x5ce7('0x2b')][_0x5ce7('0x2a')]===_0x5ce7('0x4a')){_0x5703c3['uniqueid']=_0x2c529b['params']['id'];}else{_0x5703c3['id']=_0x2c529b[_0x5ce7('0x43')]['id'];}return db[_0x5ce7('0x3c')][_0x5ce7('0x45')]({'where':_0x5703c3,'attributes':['id',_0x5ce7('0x4b'),_0x5ce7('0x4c')],'raw':!![]})[_0x5ce7('0x22')](handleEntityNotFound(_0x3494be,null))[_0x5ce7('0x22')](function(_0x6415ac){if(_0x6415ac){var _0x3441c1=_0x6415ac[_0x5ce7('0x4b')];var _0x4387dc=util[_0x5ce7('0x4d')]('%s.cypher',_0x3441c1);if(fs[_0x5ce7('0x4e')](_0x4387dc)){_0x4bca74=!![];return _0x13c1dc[_0x5ce7('0x4f')](_0x4387dc,_0x3441c1,config['secrets'][_0x5ce7('0x50')])[_0x5ce7('0x22')](function(){return _0x6415ac;});}return _0x6415ac;}})[_0x5ce7('0x22')](function(_0x416540){if(_0x416540){var _0xa96fc4=_0x416540[_0x5ce7('0x4b')];if(!fs[_0x5ce7('0x4e')](_0xa96fc4)){throw new db[(_0x5ce7('0x51'))][(_0x5ce7('0x52'))](_0x5ce7('0x53'));}if(_0x416540[_0x5ce7('0x4c')]){return _0x3494be['download'](_0xa96fc4,_0x416540['filename']+path[_0x5ce7('0x54')](_0xa96fc4),function(){if(_0x4bca74){fs[_0x5ce7('0x55')](_0xa96fc4);}});}else{return _0x3494be[_0x5ce7('0x56')](_0xa96fc4,function(_0x34370d){if(_0x4bca74){fs[_0x5ce7('0x55')](_0xa96fc4);}});}}})[_0x5ce7('0x41')](function(_0x1a863f){if(_0x1a863f[_0x5ce7('0x57')]==='SquareRecording\x20not\x20found'){_0x3494be['status'](0x194)[_0x5ce7('0x28')](_0x5ce7('0x58'));}else{return handleError(_0x3494be,null);}});};exports[_0x5ce7('0x59')]=function(_0x4f19f2,_0x21efb0){return db[_0x5ce7('0x3c')][_0x5ce7('0x45')]({'where':{'id':_0x4f19f2['params']['id']}})[_0x5ce7('0x22')](function(_0x165fc1){if(_[_0x5ce7('0x5a')](_0x165fc1)){throw new ReferenceError('Entity\x20not\x20found');}return _0x165fc1;})[_0x5ce7('0x22')](function(_0x406553){var _0x2bbb68=_0x406553[_0x5ce7('0x4b')];logger[_0x5ce7('0x5b')](_0x5ce7('0x5c'),_0x2bbb68);if(!_[_0x5ce7('0x5a')](_0x406553[_0x5ce7('0x4b')])&&fs[_0x5ce7('0x4e')](_0x2bbb68)){logger[_0x5ce7('0x5b')]('File:\x20\x22'+_0x2bbb68+_0x5ce7('0x5d'));fs[_0x5ce7('0x5e')](_0x2bbb68);}_0x2bbb68=_0x2bbb68+_0x5ce7('0x5f');if(!_[_0x5ce7('0x5a')](_0x406553['savePath'])&&fs[_0x5ce7('0x4e')](_0x2bbb68)){logger[_0x5ce7('0x5b')](_0x5ce7('0x60')+_0x2bbb68+_0x5ce7('0x5d'));fs[_0x5ce7('0x5e')](_0x2bbb68);}return _0x406553;})['then'](function(_0x46fb20){if(!_0x46fb20)throw new InternalError();return _0x46fb20[_0x5ce7('0x59')]();})[_0x5ce7('0x22')](function(){_0x21efb0[_0x5ce7('0x19')](0xcc)[_0x5ce7('0x23')]();})[_0x5ce7('0x41')](handleError(_0x21efb0,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index c77c205..dafd2d0 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 _0x79a3=['./squareRecording.attributes','exports','lodash','../../config/logger','api','bluebird','../../config/environment'];(function(_0x1fadb9,_0x1a0939){var _0x35100d=function(_0x547095){while(--_0x547095){_0x1fadb9['push'](_0x1fadb9['shift']());}};_0x35100d(++_0x1a0939);}(_0x79a3,0x80));var _0x379a=function(_0x5ba5a0,_0x22a50a){_0x5ba5a0=_0x5ba5a0-0x0;var _0x147187=_0x79a3[_0x5ba5a0];return _0x147187;};'use strict';var _=require(_0x379a('0x0'));var util=require('util');var logger=require(_0x379a('0x1'))(_0x379a('0x2'));var moment=require('moment');var BPromise=require(_0x379a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x379a('0x4'));var attributes=require(_0x379a('0x5'));module[_0x379a('0x6')]=function(_0x14907a,_0x9e6da6){return _0x14907a['define']('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d95=['util','api','moment','bluebird','request-promise','path','../../config/environment','lodash'];(function(_0x32b684,_0x3024e1){var _0x2efe36=function(_0x206fd9){while(--_0x206fd9){_0x32b684['push'](_0x32b684['shift']());}};_0x2efe36(++_0x3024e1);}(_0x5d95,0x77));var _0x55d9=function(_0x5433d0,_0x4d1d4c){_0x5433d0=_0x5433d0-0x0;var _0x3e8ad5=_0x5d95[_0x5433d0];return _0x3e8ad5;};'use strict';var _=require(_0x55d9('0x0'));var util=require(_0x55d9('0x1'));var logger=require('../../config/logger')(_0x55d9('0x2'));var moment=require(_0x55d9('0x3'));var BPromise=require(_0x55d9('0x4'));var rp=require(_0x55d9('0x5'));var fs=require('fs');var path=require(_0x55d9('0x6'));var rimraf=require('rimraf');var config=require(_0x55d9('0x7'));var attributes=require('./squareRecording.attributes');module['exports']=function(_0x25957e,_0x4244b4){return _0x25957e['define']('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 7312ef4..dd9f7d5 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 _0x177e=['error','message','result','catch','CreateSquareRecording','SquareRecording','create','options','raw','stringify','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x177e,0xa6));var _0xe177=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x177e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xe177('0x0'));var moment=require(_0xe177('0x1'));var BPromise=require(_0xe177('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe177('0x3'));var db=require(_0xe177('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe177('0x5'));var config=require('../../config/environment');var jayson=require(_0xe177('0x6'));var client=jayson[_0xe177('0x7')][_0xe177('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x91b2cd,_0x11ca3a,_0xf71fe7){return new BPromise(function(_0x5c66e6,_0x4c86b8){return client[_0xe177('0x9')](_0x91b2cd,_0xf71fe7)[_0xe177('0xa')](function(_0x37030f){logger[_0xe177('0xb')](_0xe177('0xc'),_0x11ca3a,_0xe177('0xd'));logger[_0xe177('0xe')](_0xe177('0xf'),_0x11ca3a,_0xe177('0xd'),JSON['stringify'](_0x37030f));if(_0x37030f[_0xe177('0x10')]){if(_0x37030f[_0xe177('0x10')]['code']===0x1f4){logger[_0xe177('0x10')](_0xe177('0xc'),_0x11ca3a,_0x37030f[_0xe177('0x10')][_0xe177('0x11')]);return _0x4c86b8(_0x37030f[_0xe177('0x10')][_0xe177('0x11')]);}logger[_0xe177('0x10')](_0xe177('0xc'),_0x11ca3a,_0x37030f['error']['message']);return _0x5c66e6(_0x37030f[_0xe177('0x10')][_0xe177('0x11')]);}else{logger[_0xe177('0xb')](_0xe177('0xc'),_0x11ca3a,_0xe177('0xd'));_0x5c66e6(_0x37030f[_0xe177('0x12')]['message']);}})[_0xe177('0x13')](function(_0x1342a4){logger[_0xe177('0x10')](_0xe177('0xc'),_0x11ca3a,_0x1342a4);_0x4c86b8(_0x1342a4);});});}exports[_0xe177('0x14')]=function(_0x157177){var _0x18752e=this;return new Promise(function(_0x26bb0a,_0x1844a1){return db[_0xe177('0x15')][_0xe177('0x16')](_0x157177['body'],{'raw':_0x157177[_0xe177('0x17')]?_0x157177[_0xe177('0x17')][_0xe177('0x18')]===undefined?!![]:![]:!![]})[_0xe177('0xa')](function(_0x31cd33){logger[_0xe177('0xb')](_0xe177('0x14'),_0x157177);logger[_0xe177('0xe')](_0xe177('0x14'),_0x157177,JSON[_0xe177('0x19')](_0x31cd33));_0x26bb0a(_0x31cd33);})[_0xe177('0x13')](function(_0x542460){logger[_0xe177('0x10')](_0xe177('0x14'),_0x542460[_0xe177('0x11')],_0x157177);_0x1844a1(_0x18752e[_0xe177('0x10')](0x1f4,_0x542460[_0xe177('0x11')]));});});}; \ No newline at end of file +var _0x7e3e=['then','CreateSquareRecording','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','SquareRecording','create','body','options'];(function(_0x5d949e,_0x555707){var _0x445c1e=function(_0x160f2a){while(--_0x160f2a){_0x5d949e['push'](_0x5d949e['shift']());}};_0x445c1e(++_0x555707);}(_0x7e3e,0x154));var _0xe7e3=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x7e3e[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xe7e3('0x0'));var util=require(_0xe7e3('0x1'));var moment=require(_0xe7e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xe7e3('0x3'));var fs=require('fs');var Redis=require(_0xe7e3('0x4'));var db=require(_0xe7e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe7e3('0x6'))(_0xe7e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xe7e3('0x8'));var client=jayson[_0xe7e3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18ec34,_0x2027c1,_0x19c1ea){return new BPromise(function(_0x438bae,_0x9af93b){return client[_0xe7e3('0xa')](_0x18ec34,_0x19c1ea)['then'](function(_0x7fdd78){logger[_0xe7e3('0xb')](_0xe7e3('0xc'),_0x2027c1,_0xe7e3('0xd'));logger[_0xe7e3('0xe')](_0xe7e3('0xf'),_0x2027c1,_0xe7e3('0xd'),JSON['stringify'](_0x7fdd78));if(_0x7fdd78[_0xe7e3('0x10')]){if(_0x7fdd78[_0xe7e3('0x10')][_0xe7e3('0x11')]===0x1f4){logger['error'](_0xe7e3('0xc'),_0x2027c1,_0x7fdd78[_0xe7e3('0x10')][_0xe7e3('0x12')]);return _0x9af93b(_0x7fdd78['error'][_0xe7e3('0x12')]);}logger[_0xe7e3('0x10')](_0xe7e3('0xc'),_0x2027c1,_0x7fdd78[_0xe7e3('0x10')]['message']);return _0x438bae(_0x7fdd78['error'][_0xe7e3('0x12')]);}else{logger[_0xe7e3('0xb')](_0xe7e3('0xc'),_0x2027c1,_0xe7e3('0xd'));_0x438bae(_0x7fdd78[_0xe7e3('0x13')]['message']);}})['catch'](function(_0x39b47e){logger[_0xe7e3('0x10')](_0xe7e3('0xc'),_0x2027c1,_0x39b47e);_0x9af93b(_0x39b47e);});});}exports['CreateSquareRecording']=function(_0x3cf9d8){var _0x35b10e=this;return new Promise(function(_0x342689,_0x198890){return db[_0xe7e3('0x14')][_0xe7e3('0x15')](_0x3cf9d8[_0xe7e3('0x16')],{'raw':_0x3cf9d8[_0xe7e3('0x17')]?_0x3cf9d8[_0xe7e3('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xe7e3('0x18')](function(_0x1b4777){logger[_0xe7e3('0xb')](_0xe7e3('0x19'),_0x3cf9d8);logger[_0xe7e3('0xe')](_0xe7e3('0x19'),_0x3cf9d8,JSON[_0xe7e3('0x1a')](_0x1b4777));_0x342689(_0x1b4777);})[_0xe7e3('0x1b')](function(_0x34ad5b){logger[_0xe7e3('0x10')](_0xe7e3('0x19'),_0x34ad5b[_0xe7e3('0x12')],_0x3cf9d8);_0x198890(_0x35b10e['error'](0x1f4,_0x34ad5b[_0xe7e3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 91c7332..5192e16 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x31a938,_0x4daec6){var _0x1bf341=function(_0x514261){while(--_0x514261){_0x31a938['push'](_0x31a938['shift']());}};_0x1bf341(++_0x4daec6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _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(_0x56ce9d,_0x881535){var _0x4776de=function(_0xa3dd90){while(--_0xa3dd90){_0x56ce9d['push'](_0x56ce9d['shift']());}};_0x4776de(++_0x881535);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'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 diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index b07d87b..f2a2bdb 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 _0x7b0d=['STRING','DATE','exports'];(function(_0x453012,_0x4b93ef){var _0x51361f=function(_0x58071f){while(--_0x58071f){_0x453012['push'](_0x453012['shift']());}};_0x51361f(++_0x4b93ef);}(_0x7b0d,0x155));var _0xd7b0=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x7b0d[_0x5447fd];return _0x15b28a;};'use strict';var Sequelize=require('sequelize');module[_0xd7b0('0x0')]={'network':{'type':Sequelize[_0xd7b0('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xd7b0('0x1')]},'channel':{'type':Sequelize[_0xd7b0('0x1')]},'language':{'type':Sequelize[_0xd7b0('0x1')]},'type':{'type':Sequelize[_0xd7b0('0x1')]},'uniqueid':{'type':Sequelize[_0xd7b0('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xd7b0('0x1')]},'calleridname':{'type':Sequelize[_0xd7b0('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xd7b0('0x1')]},'callington':{'type':Sequelize[_0xd7b0('0x1')]},'callingtns':{'type':Sequelize[_0xd7b0('0x1')]},'dnid':{'type':Sequelize[_0xd7b0('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd7b0('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd7b0('0x1')]},'threadid':{'type':Sequelize[_0xd7b0('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd7b0('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb4e2=['DATE','BOOLEAN','sequelize','STRING'];(function(_0x210718,_0x247b55){var _0x541bfc=function(_0x5dbcad){while(--_0x5dbcad){_0x210718['push'](_0x210718['shift']());}};_0x541bfc(++_0x247b55);}(_0xb4e2,0x1aa));var _0x2b4e=function(_0x24fd68,_0x54b730){_0x24fd68=_0x24fd68-0x0;var _0xc09a4c=_0xb4e2[_0x24fd68];return _0xc09a4c;};'use strict';var Sequelize=require(_0x2b4e('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x2b4e('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2b4e('0x1')]},'uniqueid':{'type':Sequelize[_0x2b4e('0x1')]},'version':{'type':Sequelize[_0x2b4e('0x1')]},'callerid':{'type':Sequelize[_0x2b4e('0x1')]},'calleridname':{'type':Sequelize[_0x2b4e('0x1')]},'callingpres':{'type':Sequelize[_0x2b4e('0x1')]},'callingani2':{'type':Sequelize[_0x2b4e('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x2b4e('0x1')]},'dnid':{'type':Sequelize[_0x2b4e('0x1')]},'rdnis':{'type':Sequelize[_0x2b4e('0x1')]},'context':{'type':Sequelize[_0x2b4e('0x1')]},'extension':{'type':Sequelize[_0x2b4e('0x1')]},'priority':{'type':Sequelize[_0x2b4e('0x1')]},'enhanced':{'type':Sequelize[_0x2b4e('0x1')]},'accountcode':{'type':Sequelize[_0x2b4e('0x1')]},'threadid':{'type':Sequelize[_0x2b4e('0x1')]},'project_name':{'type':Sequelize[_0x2b4e('0x1')]},'joinAt':{'type':Sequelize[_0x2b4e('0x2')]},'leaveAt':{'type':Sequelize[_0x2b4e('0x2')]},'bot':{'type':Sequelize[_0x2b4e('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 6a67930..9d0fcd4 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 _0x0270=['jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','SquareReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0xd64649,_0x1d39e7){var _0xab88aa=function(_0x53787f){while(--_0x53787f){_0xd64649['push'](_0xd64649['shift']());}};_0xab88aa(++_0x1d39e7);}(_0x0270,0x1c8));var _0x0027=function(_0x992570,_0x53b38b){_0x992570=_0x992570-0x0;var _0x5ee989=_0x0270[_0x992570];return _0x5ee989;};'use strict';var emlformat=require(_0x0027('0x0'));var rimraf=require(_0x0027('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0027('0x2'));var rp=require(_0x0027('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0027('0x4'));var path=require(_0x0027('0x5'));var sox=require(_0x0027('0x6'));var csv=require(_0x0027('0x7'));var ejs=require(_0x0027('0x8'));var fs=require('fs');var fs_extra=require(_0x0027('0x9'));var _=require(_0x0027('0xa'));var squel=require(_0x0027('0xb'));var crypto=require('crypto');var jsforce=require(_0x0027('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0027('0x7'));var querystring=require(_0x0027('0xd'));var Papa=require('papaparse');var Redis=require(_0x0027('0xe'));var authService=require(_0x0027('0xf'));var qs=require(_0x0027('0x10'));var as=require(_0x0027('0x11'));var hardwareService=require(_0x0027('0x12'));var logger=require(_0x0027('0x13'))('api');var utils=require(_0x0027('0x14'));var config=require(_0x0027('0x15'));var licenseUtil=require(_0x0027('0x16'));var db=require(_0x0027('0x17'))['db'];function respondWithStatusCode(_0x343c47,_0x253595){_0x253595=_0x253595||0xcc;return function(_0x51513f){if(_0x51513f){return _0x343c47[_0x0027('0x18')](_0x253595);}return _0x343c47[_0x0027('0x19')](_0x253595)['end']();};}function respondWithResult(_0x2c42a7,_0x4cd8de){_0x4cd8de=_0x4cd8de||0xc8;return function(_0xa562db){if(_0xa562db){return _0x2c42a7['status'](_0x4cd8de)[_0x0027('0x1a')](_0xa562db);}};}function respondWithFilteredResult(_0x32ee95,_0x4b22e3){return function(_0x577cf5){if(_0x577cf5){var _0x808398=typeof _0x4b22e3['offset']===_0x0027('0x1b')&&typeof _0x4b22e3[_0x0027('0x1c')]===_0x0027('0x1b');var _0x3a06de=_0x577cf5[_0x0027('0x1d')];var _0x18d825=_0x808398?0x0:_0x4b22e3[_0x0027('0x1e')];var _0x205185=_0x808398?_0x577cf5[_0x0027('0x1d')]:_0x4b22e3['offset']+_0x4b22e3[_0x0027('0x1c')];var _0x523389;if(_0x205185>=_0x3a06de){_0x205185=_0x3a06de;_0x523389=0xc8;}else{_0x523389=0xce;}_0x32ee95[_0x0027('0x19')](_0x523389);return _0x32ee95[_0x0027('0x1f')](_0x0027('0x20'),_0x18d825+'-'+_0x205185+'/'+_0x3a06de)['json'](_0x577cf5);}return null;};}function patchUpdates(_0x4a9b8d){return function(_0x24088f){try{jsonpatch[_0x0027('0x21')](_0x24088f,_0x4a9b8d,!![]);}catch(_0x416204){return BPromise[_0x0027('0x22')](_0x416204);}return _0x24088f['save']();};}function saveUpdates(_0x365282,_0x4a2bd8){return function(_0x5ddd1f){if(_0x5ddd1f){return _0x5ddd1f[_0x0027('0x23')](_0x365282)[_0x0027('0x24')](function(_0x345a0b){return _0x345a0b;});}return null;};}function removeEntity(_0x56e537,_0x404677){return function(_0x2b2de2){if(_0x2b2de2){return _0x2b2de2['destroy']()[_0x0027('0x24')](function(){_0x56e537['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1356ba,_0x532f8c){return function(_0x5c03d3){if(!_0x5c03d3){_0x1356ba['sendStatus'](0x194);}return _0x5c03d3;};}function handleError(_0x165955,_0x211f17){_0x211f17=_0x211f17||0x1f4;return function(_0x29854d){logger[_0x0027('0x25')](_0x29854d[_0x0027('0x26')]);if(_0x29854d['name']){delete _0x29854d[_0x0027('0x27')];}_0x165955[_0x0027('0x19')](_0x211f17)[_0x0027('0x28')](_0x29854d);};}exports[_0x0027('0x29')]=function(_0x24c809,_0x33f077){var _0xc32ace={},_0x228cd2={},_0x328176={'count':0x0,'rows':[]};var _0x1c2e18=_[_0x0027('0x2a')](db['SquareReport']['rawAttributes'],function(_0x4b3727){return{'name':_0x4b3727[_0x0027('0x2b')],'type':_0x4b3727[_0x0027('0x2c')][_0x0027('0x2d')]};});_0x228cd2[_0x0027('0x2e')]=_[_0x0027('0x2a')](_0x1c2e18,_0x0027('0x27'));_0x228cd2[_0x0027('0x2f')]=_[_0x0027('0x30')](_0x24c809[_0x0027('0x2f')]);_0x228cd2[_0x0027('0x31')]=_[_0x0027('0x32')](_0x228cd2[_0x0027('0x2e')],_0x228cd2[_0x0027('0x2f')]);_0xc32ace['attributes']=_[_0x0027('0x32')](_0x228cd2[_0x0027('0x2e')],qs['fields'](_0x24c809[_0x0027('0x2f')][_0x0027('0x33')]));_0xc32ace[_0x0027('0x34')]=_0xc32ace[_0x0027('0x34')][_0x0027('0x35')]?_0xc32ace[_0x0027('0x34')]:_0x228cd2[_0x0027('0x2e')];if(!_0x24c809[_0x0027('0x2f')][_0x0027('0x36')](_0x0027('0x37'))){_0xc32ace['limit']=qs[_0x0027('0x1c')](_0x24c809[_0x0027('0x2f')][_0x0027('0x1c')]);_0xc32ace[_0x0027('0x1e')]=qs['offset'](_0x24c809[_0x0027('0x2f')][_0x0027('0x1e')]);}_0xc32ace[_0x0027('0x38')]=qs[_0x0027('0x39')](_0x24c809[_0x0027('0x2f')][_0x0027('0x39')]);_0xc32ace[_0x0027('0x3a')]=qs[_0x0027('0x31')](_[_0x0027('0x3b')](_0x24c809['query'],_0x228cd2[_0x0027('0x31')]),_0x1c2e18);if(_0x24c809[_0x0027('0x2f')][_0x0027('0x3c')]){_0xc32ace[_0x0027('0x3a')]=_['merge'](_0xc32ace['where'],{'$or':_[_0x0027('0x2a')](_0x1c2e18,function(_0x4b0c84){if(_0x4b0c84[_0x0027('0x2c')]!==_0x0027('0x3d')){var _0x58a47a={};_0x58a47a[_0x4b0c84[_0x0027('0x27')]]={'$like':'%'+_0x24c809[_0x0027('0x2f')][_0x0027('0x3c')]+'%'};return _0x58a47a;}})});}_0xc32ace=_[_0x0027('0x3e')]({},_0xc32ace,_0x24c809[_0x0027('0x3f')]);var _0x8071b9={'where':_0xc32ace[_0x0027('0x3a')]};return db[_0x0027('0x40')][_0x0027('0x1d')](_0x8071b9)[_0x0027('0x24')](function(_0x50ff34){_0x328176['count']=_0x50ff34;if(_0x24c809[_0x0027('0x2f')][_0x0027('0x41')]){_0xc32ace[_0x0027('0x42')]=[{'all':!![]}];}return db[_0x0027('0x40')][_0x0027('0x43')](_0xc32ace);})[_0x0027('0x24')](function(_0xbadeeb){_0x328176[_0x0027('0x44')]=_0xbadeeb;return _0x328176;})['then'](respondWithFilteredResult(_0x33f077,_0xc32ace))[_0x0027('0x45')](handleError(_0x33f077,null));};exports[_0x0027('0x46')]=function(_0x5d16d9,_0x361b07){var _0x7f987e={'raw':!![],'where':{'id':_0x5d16d9[_0x0027('0x47')]['id']}},_0x421431={};_0x421431[_0x0027('0x2e')]=_[_0x0027('0x30')](db[_0x0027('0x40')][_0x0027('0x48')]);_0x421431[_0x0027('0x2f')]=_[_0x0027('0x30')](_0x5d16d9[_0x0027('0x2f')]);_0x421431[_0x0027('0x31')]=_[_0x0027('0x32')](_0x421431['model'],_0x421431['query']);_0x7f987e[_0x0027('0x34')]=_[_0x0027('0x32')](_0x421431['model'],qs['fields'](_0x5d16d9[_0x0027('0x2f')][_0x0027('0x33')]));_0x7f987e[_0x0027('0x34')]=_0x7f987e[_0x0027('0x34')][_0x0027('0x35')]?_0x7f987e[_0x0027('0x34')]:_0x421431[_0x0027('0x2e')];if(_0x5d16d9[_0x0027('0x2f')][_0x0027('0x41')]){_0x7f987e[_0x0027('0x42')]=[{'all':!![]}];}_0x7f987e=_[_0x0027('0x3e')]({},_0x7f987e,_0x5d16d9['options']);return db[_0x0027('0x40')][_0x0027('0x49')](_0x7f987e)[_0x0027('0x24')](handleEntityNotFound(_0x361b07,null))[_0x0027('0x24')](respondWithResult(_0x361b07,null))['catch'](handleError(_0x361b07,null));};exports[_0x0027('0x4a')]=function(_0x14ff5c,_0x5a38bc){return db[_0x0027('0x40')]['create'](_0x14ff5c[_0x0027('0x4b')],{})[_0x0027('0x24')](respondWithResult(_0x5a38bc,0xc9))[_0x0027('0x45')](handleError(_0x5a38bc,null));};exports[_0x0027('0x23')]=function(_0x5a32cb,_0xec9134){if(_0x5a32cb[_0x0027('0x4b')]['id']){delete _0x5a32cb[_0x0027('0x4b')]['id'];}return db['SquareReport'][_0x0027('0x49')]({'where':{'id':_0x5a32cb[_0x0027('0x47')]['id']}})[_0x0027('0x24')](handleEntityNotFound(_0xec9134,null))[_0x0027('0x24')](saveUpdates(_0x5a32cb[_0x0027('0x4b')],null))[_0x0027('0x24')](respondWithResult(_0xec9134,null))[_0x0027('0x45')](handleError(_0xec9134,null));};exports[_0x0027('0x4c')]=function(_0x2af2d0,_0x45083b){return db[_0x0027('0x40')][_0x0027('0x49')]({'where':{'id':_0x2af2d0[_0x0027('0x47')]['id']}})[_0x0027('0x24')](handleEntityNotFound(_0x45083b,null))[_0x0027('0x24')](removeEntity(_0x45083b,null))['catch'](handleError(_0x45083b,null));};exports['describe']=function(_0x4903ad,_0x344963){return db[_0x0027('0x40')][_0x0027('0x4d')]()[_0x0027('0x24')](respondWithResult(_0x344963,null))[_0x0027('0x45')](handleError(_0x344963,null));}; \ No newline at end of file +var _0x6dff=['name','send','index','map','SquareReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','find','catch','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','destroy','then','end','error'];(function(_0x54b793,_0x53fa1c){var _0x458208=function(_0x59ab3c){while(--_0x59ab3c){_0x54b793['push'](_0x54b793['shift']());}};_0x458208(++_0x53fa1c);}(_0x6dff,0x6d));var _0xf6df=function(_0x581bf1,_0x1de073){_0x581bf1=_0x581bf1-0x0;var _0x9b461c=_0x6dff[_0x581bf1];return _0x9b461c;};'use strict';var emlformat=require(_0xf6df('0x0'));var rimraf=require(_0xf6df('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf6df('0x2'));var rp=require(_0xf6df('0x3'));var moment=require(_0xf6df('0x4'));var BPromise=require(_0xf6df('0x5'));var Mustache=require(_0xf6df('0x6'));var util=require(_0xf6df('0x7'));var path=require(_0xf6df('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf6df('0x9'));var fs=require('fs');var fs_extra=require(_0xf6df('0xa'));var _=require(_0xf6df('0xb'));var squel=require(_0xf6df('0xc'));var crypto=require(_0xf6df('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf6df('0xe'));var querystring=require(_0xf6df('0xf'));var Papa=require(_0xf6df('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf6df('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf6df('0x12'));var utils=require(_0xf6df('0x13'));var config=require(_0xf6df('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf6df('0x15'))['db'];function respondWithStatusCode(_0x45ec88,_0x491454){_0x491454=_0x491454||0xcc;return function(_0x4b1c1d){if(_0x4b1c1d){return _0x45ec88[_0xf6df('0x16')](_0x491454);}return _0x45ec88['status'](_0x491454)['end']();};}function respondWithResult(_0x36021c,_0xd9d76b){_0xd9d76b=_0xd9d76b||0xc8;return function(_0x46f2a4){if(_0x46f2a4){return _0x36021c[_0xf6df('0x17')](_0xd9d76b)['json'](_0x46f2a4);}};}function respondWithFilteredResult(_0x41a255,_0x5089ea){return function(_0x5a20aa){if(_0x5a20aa){var _0x23fcd2=typeof _0x5089ea[_0xf6df('0x18')]===_0xf6df('0x19')&&typeof _0x5089ea[_0xf6df('0x1a')]===_0xf6df('0x19');var _0x23906b=_0x5a20aa['count'];var _0x48c6e1=_0x23fcd2?0x0:_0x5089ea['offset'];var _0x2b9ad7=_0x23fcd2?_0x5a20aa[_0xf6df('0x1b')]:_0x5089ea[_0xf6df('0x18')]+_0x5089ea[_0xf6df('0x1a')];var _0x5e2292;if(_0x2b9ad7>=_0x23906b){_0x2b9ad7=_0x23906b;_0x5e2292=0xc8;}else{_0x5e2292=0xce;}_0x41a255['status'](_0x5e2292);return _0x41a255['set'](_0xf6df('0x1c'),_0x48c6e1+'-'+_0x2b9ad7+'/'+_0x23906b)[_0xf6df('0x1d')](_0x5a20aa);}return null;};}function patchUpdates(_0x143c44){return function(_0x5e578b){try{jsonpatch[_0xf6df('0x1e')](_0x5e578b,_0x143c44,!![]);}catch(_0x1c5e6b){return BPromise[_0xf6df('0x1f')](_0x1c5e6b);}return _0x5e578b[_0xf6df('0x20')]();};}function saveUpdates(_0x5cd88b,_0xc81cca){return function(_0x2bce06){if(_0x2bce06){return _0x2bce06['update'](_0x5cd88b)['then'](function(_0x4537fe){return _0x4537fe;});}return null;};}function removeEntity(_0x445d05,_0x469b91){return function(_0x2fb54f){if(_0x2fb54f){return _0x2fb54f[_0xf6df('0x21')]()[_0xf6df('0x22')](function(){_0x445d05[_0xf6df('0x17')](0xcc)[_0xf6df('0x23')]();});}};}function handleEntityNotFound(_0x5ecd6e,_0x356da8){return function(_0x22c80b){if(!_0x22c80b){_0x5ecd6e[_0xf6df('0x16')](0x194);}return _0x22c80b;};}function handleError(_0x339898,_0x201a4b){_0x201a4b=_0x201a4b||0x1f4;return function(_0x4eaef9){logger[_0xf6df('0x24')](_0x4eaef9['stack']);if(_0x4eaef9[_0xf6df('0x25')]){delete _0x4eaef9[_0xf6df('0x25')];}_0x339898[_0xf6df('0x17')](_0x201a4b)[_0xf6df('0x26')](_0x4eaef9);};}exports[_0xf6df('0x27')]=function(_0xb97009,_0x1ce020){var _0x49db6d={},_0x543a63={},_0x36142c={'count':0x0,'rows':[]};var _0x34c0aa=_[_0xf6df('0x28')](db[_0xf6df('0x29')][_0xf6df('0x2a')],function(_0x38630d){return{'name':_0x38630d[_0xf6df('0x2b')],'type':_0x38630d[_0xf6df('0x2c')]['key']};});_0x543a63[_0xf6df('0x2d')]=_[_0xf6df('0x28')](_0x34c0aa,_0xf6df('0x25'));_0x543a63[_0xf6df('0x2e')]=_[_0xf6df('0x2f')](_0xb97009[_0xf6df('0x2e')]);_0x543a63[_0xf6df('0x30')]=_[_0xf6df('0x31')](_0x543a63['model'],_0x543a63[_0xf6df('0x2e')]);_0x49db6d[_0xf6df('0x32')]=_[_0xf6df('0x31')](_0x543a63[_0xf6df('0x2d')],qs['fields'](_0xb97009['query']['fields']));_0x49db6d['attributes']=_0x49db6d['attributes']['length']?_0x49db6d['attributes']:_0x543a63[_0xf6df('0x2d')];if(!_0xb97009[_0xf6df('0x2e')][_0xf6df('0x33')]('nolimit')){_0x49db6d[_0xf6df('0x1a')]=qs['limit'](_0xb97009[_0xf6df('0x2e')][_0xf6df('0x1a')]);_0x49db6d[_0xf6df('0x18')]=qs[_0xf6df('0x18')](_0xb97009[_0xf6df('0x2e')][_0xf6df('0x18')]);}_0x49db6d[_0xf6df('0x34')]=qs[_0xf6df('0x35')](_0xb97009[_0xf6df('0x2e')]['sort']);_0x49db6d[_0xf6df('0x36')]=qs['filters'](_[_0xf6df('0x37')](_0xb97009[_0xf6df('0x2e')],_0x543a63['filters']),_0x34c0aa);if(_0xb97009[_0xf6df('0x2e')][_0xf6df('0x38')]){_0x49db6d['where']=_[_0xf6df('0x39')](_0x49db6d['where'],{'$or':_['map'](_0x34c0aa,function(_0xb71cc){if(_0xb71cc[_0xf6df('0x2c')]!==_0xf6df('0x3a')){var _0x10ea40={};_0x10ea40[_0xb71cc[_0xf6df('0x25')]]={'$like':'%'+_0xb97009[_0xf6df('0x2e')][_0xf6df('0x38')]+'%'};return _0x10ea40;}})});}_0x49db6d=_['merge']({},_0x49db6d,_0xb97009[_0xf6df('0x3b')]);var _0x57b38f={'where':_0x49db6d['where']};return db[_0xf6df('0x29')][_0xf6df('0x1b')](_0x57b38f)[_0xf6df('0x22')](function(_0x346222){_0x36142c[_0xf6df('0x1b')]=_0x346222;if(_0xb97009['query'][_0xf6df('0x3c')]){_0x49db6d[_0xf6df('0x3d')]=[{'all':!![]}];}return db['SquareReport'][_0xf6df('0x3e')](_0x49db6d);})[_0xf6df('0x22')](function(_0x5ad3e4){_0x36142c[_0xf6df('0x3f')]=_0x5ad3e4;return _0x36142c;})[_0xf6df('0x22')](respondWithFilteredResult(_0x1ce020,_0x49db6d))['catch'](handleError(_0x1ce020,null));};exports[_0xf6df('0x40')]=function(_0x18886a,_0x990e50){var _0x55a13b={'raw':!![],'where':{'id':_0x18886a[_0xf6df('0x41')]['id']}},_0x5950fa={};_0x5950fa[_0xf6df('0x2d')]=_[_0xf6df('0x2f')](db['SquareReport'][_0xf6df('0x2a')]);_0x5950fa['query']=_[_0xf6df('0x2f')](_0x18886a[_0xf6df('0x2e')]);_0x5950fa[_0xf6df('0x30')]=_[_0xf6df('0x31')](_0x5950fa[_0xf6df('0x2d')],_0x5950fa[_0xf6df('0x2e')]);_0x55a13b[_0xf6df('0x32')]=_[_0xf6df('0x31')](_0x5950fa[_0xf6df('0x2d')],qs[_0xf6df('0x42')](_0x18886a[_0xf6df('0x2e')][_0xf6df('0x42')]));_0x55a13b[_0xf6df('0x32')]=_0x55a13b[_0xf6df('0x32')]['length']?_0x55a13b['attributes']:_0x5950fa[_0xf6df('0x2d')];if(_0x18886a[_0xf6df('0x2e')][_0xf6df('0x3c')]){_0x55a13b['include']=[{'all':!![]}];}_0x55a13b=_[_0xf6df('0x39')]({},_0x55a13b,_0x18886a[_0xf6df('0x3b')]);return db[_0xf6df('0x29')][_0xf6df('0x43')](_0x55a13b)[_0xf6df('0x22')](handleEntityNotFound(_0x990e50,null))[_0xf6df('0x22')](respondWithResult(_0x990e50,null))[_0xf6df('0x44')](handleError(_0x990e50,null));};exports['create']=function(_0x4b1f39,_0x9b52fc){return db['SquareReport'][_0xf6df('0x45')](_0x4b1f39[_0xf6df('0x46')],{})[_0xf6df('0x22')](respondWithResult(_0x9b52fc,0xc9))[_0xf6df('0x44')](handleError(_0x9b52fc,null));};exports[_0xf6df('0x47')]=function(_0x5e1a4e,_0x5f383c){if(_0x5e1a4e[_0xf6df('0x46')]['id']){delete _0x5e1a4e[_0xf6df('0x46')]['id'];}return db['SquareReport'][_0xf6df('0x43')]({'where':{'id':_0x5e1a4e[_0xf6df('0x41')]['id']}})[_0xf6df('0x22')](handleEntityNotFound(_0x5f383c,null))[_0xf6df('0x22')](saveUpdates(_0x5e1a4e[_0xf6df('0x46')],null))[_0xf6df('0x22')](respondWithResult(_0x5f383c,null))[_0xf6df('0x44')](handleError(_0x5f383c,null));};exports['destroy']=function(_0x1afa5f,_0x349f16){return db[_0xf6df('0x29')][_0xf6df('0x43')]({'where':{'id':_0x1afa5f[_0xf6df('0x41')]['id']}})[_0xf6df('0x22')](handleEntityNotFound(_0x349f16,null))['then'](removeEntity(_0x349f16,null))[_0xf6df('0x44')](handleError(_0x349f16,null));};exports['describe']=function(_0x30ccd6,_0x406a95){return db[_0xf6df('0x29')][_0xf6df('0x48')]()[_0xf6df('0x22')](respondWithResult(_0x406a95,null))[_0xf6df('0x44')](handleError(_0x406a95,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 61edf3a..86c51be 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 _0x6261=['exports','SquareReport','report_square','uniqueid','project_name','leaveAt','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes'];(function(_0x2e44cb,_0x53b734){var _0x35d28a=function(_0x58b3ac){while(--_0x58b3ac){_0x2e44cb['push'](_0x2e44cb['shift']());}};_0x35d28a(++_0x53b734);}(_0x6261,0x186));var _0x1626=function(_0x2c17b8,_0x4f5247){_0x2c17b8=_0x2c17b8-0x0;var _0x509293=_0x6261[_0x2c17b8];return _0x509293;};'use strict';var _=require('lodash');var util=require(_0x1626('0x0'));var logger=require(_0x1626('0x1'))(_0x1626('0x2'));var moment=require(_0x1626('0x3'));var BPromise=require(_0x1626('0x4'));var rp=require(_0x1626('0x5'));var fs=require('fs');var path=require(_0x1626('0x6'));var rimraf=require(_0x1626('0x7'));var config=require(_0x1626('0x8'));var attributes=require(_0x1626('0x9'));module[_0x1626('0xa')]=function(_0x1448f2,_0x15716c){return _0x1448f2['define'](_0x1626('0xb'),attributes,{'tableName':_0x1626('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x1626('0xd'),_0x1626('0xe')]},{'name':_0x1626('0xf'),'fields':[_0x1626('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xda82=['project_name','leaveAt','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname'];(function(_0x58dcbf,_0x28ef6f){var _0x271f8e=function(_0x168b4d){while(--_0x168b4d){_0x58dcbf['push'](_0x58dcbf['shift']());}};_0x271f8e(++_0x28ef6f);}(_0xda82,0xe2));var _0x2da8=function(_0xb700ef,_0x4fb7c5){_0xb700ef=_0xb700ef-0x0;var _0x42a655=_0xda82[_0xb700ef];return _0x42a655;};'use strict';var _=require('lodash');var util=require(_0x2da8('0x0'));var logger=require(_0x2da8('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2da8('0x2'));var fs=require('fs');var path=require(_0x2da8('0x3'));var rimraf=require(_0x2da8('0x4'));var config=require(_0x2da8('0x5'));var attributes=require(_0x2da8('0x6'));module[_0x2da8('0x7')]=function(_0x375b64,_0x4e3095){return _0x375b64[_0x2da8('0x8')](_0x2da8('0x9'),attributes,{'tableName':_0x2da8('0xa'),'paranoid':![],'indexes':[{'name':_0x2da8('0xb'),'fields':['uniqueid',_0x2da8('0xc')]},{'name':'leaveAt','fields':[_0x2da8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 83b1596..5cccb19 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 _0x4442=['create','body','options','raw','UpdateSquareReport','SquareReport','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','CreateSquareReport'];(function(_0x35ce45,_0x57c22a){var _0x5cd865=function(_0x1100fd){while(--_0x1100fd){_0x35ce45['push'](_0x35ce45['shift']());}};_0x5cd865(++_0x57c22a);}(_0x4442,0x167));var _0x2444=function(_0x566771,_0x2aca5a){_0x566771=_0x566771-0x0;var _0x3ea858=_0x4442[_0x566771];return _0x3ea858;};'use strict';var _=require(_0x2444('0x0'));var util=require(_0x2444('0x1'));var moment=require(_0x2444('0x2'));var BPromise=require(_0x2444('0x3'));var rs=require(_0x2444('0x4'));var fs=require('fs');var Redis=require(_0x2444('0x5'));var db=require(_0x2444('0x6'))['db'];var utils=require(_0x2444('0x7'));var logger=require('../../config/logger')(_0x2444('0x8'));var config=require(_0x2444('0x9'));var jayson=require(_0x2444('0xa'));var client=jayson[_0x2444('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e4688,_0x1c5502,_0x3e4bd9){return new BPromise(function(_0x1613f9,_0x309381){return client[_0x2444('0xc')](_0x2e4688,_0x3e4bd9)[_0x2444('0xd')](function(_0x130ab8){logger[_0x2444('0xe')]('SquareReport,\x20%s,\x20%s',_0x1c5502,_0x2444('0xf'));logger[_0x2444('0x10')](_0x2444('0x11'),_0x1c5502,_0x2444('0xf'),JSON[_0x2444('0x12')](_0x130ab8));if(_0x130ab8['error']){if(_0x130ab8[_0x2444('0x13')][_0x2444('0x14')]===0x1f4){logger[_0x2444('0x13')](_0x2444('0x15'),_0x1c5502,_0x130ab8[_0x2444('0x13')][_0x2444('0x16')]);return _0x309381(_0x130ab8['error']['message']);}logger[_0x2444('0x13')](_0x2444('0x15'),_0x1c5502,_0x130ab8['error'][_0x2444('0x16')]);return _0x1613f9(_0x130ab8['error']['message']);}else{logger[_0x2444('0xe')](_0x2444('0x15'),_0x1c5502,_0x2444('0xf'));_0x1613f9(_0x130ab8[_0x2444('0x17')]['message']);}})['catch'](function(_0x3e1ad7){logger[_0x2444('0x13')](_0x2444('0x15'),_0x1c5502,_0x3e1ad7);_0x309381(_0x3e1ad7);});});}exports[_0x2444('0x18')]=function(_0x1c609c){var _0x2a9a63=this;return new Promise(function(_0x26bee8,_0x4a0b66){return db['SquareReport'][_0x2444('0x19')](_0x1c609c[_0x2444('0x1a')],{'raw':_0x1c609c[_0x2444('0x1b')]?_0x1c609c[_0x2444('0x1b')][_0x2444('0x1c')]===undefined?!![]:![]:!![]})[_0x2444('0xd')](function(_0x17fa92){logger['info'](_0x2444('0x18'),_0x1c609c);logger[_0x2444('0x10')](_0x2444('0x18'),_0x1c609c,JSON[_0x2444('0x12')](_0x17fa92));_0x26bee8(_0x17fa92);})['catch'](function(_0x200717){logger[_0x2444('0x13')]('CreateSquareReport',_0x200717['message'],_0x1c609c);_0x4a0b66(_0x2a9a63['error'](0x1f4,_0x200717[_0x2444('0x16')]));});});};exports[_0x2444('0x1d')]=function(_0x38985c){var _0x6d62c0=this;return new Promise(function(_0x3a195e,_0x329c7c){return db[_0x2444('0x1e')]['update'](_0x38985c['body'],{'raw':_0x38985c[_0x2444('0x1b')]?_0x38985c[_0x2444('0x1b')][_0x2444('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38985c[_0x2444('0x1b')]?_0x38985c[_0x2444('0x1b')]['where']||null:null,'attributes':_0x38985c[_0x2444('0x1b')]?_0x38985c['options']['attributes']||null:null,'limit':_0x38985c[_0x2444('0x1b')]?_0x38985c[_0x2444('0x1b')]['limit']||null:null})[_0x2444('0xd')](function(_0x502712){logger[_0x2444('0xe')](_0x2444('0x1d'),_0x38985c);logger[_0x2444('0x10')]('UpdateSquareReport',_0x38985c,JSON[_0x2444('0x12')](_0x502712));_0x3a195e(_0x502712);})[_0x2444('0x1f')](function(_0x429e3b){logger[_0x2444('0x13')](_0x2444('0x1d'),_0x429e3b[_0x2444('0x16')],_0x38985c);_0x329c7c(_0x6d62c0[_0x2444('0x13')](0x1f4,_0x429e3b[_0x2444('0x16')]));});});}; \ No newline at end of file +var _0x527e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateSquareReport','create','body','options','debug','catch','UpdateSquareReport','SquareReport','raw','where','attributes','limit','lodash','util','moment'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x527e,0xfd));var _0xe527=function(_0x372ae9,_0x41ebad){_0x372ae9=_0x372ae9-0x0;var _0x123083=_0x527e[_0x372ae9];return _0x123083;};'use strict';var _=require(_0xe527('0x0'));var util=require(_0xe527('0x1'));var moment=require(_0xe527('0x2'));var BPromise=require(_0xe527('0x3'));var rs=require(_0xe527('0x4'));var fs=require('fs');var Redis=require(_0xe527('0x5'));var db=require(_0xe527('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe527('0x7'))('rpc');var config=require(_0xe527('0x8'));var jayson=require(_0xe527('0x9'));var client=jayson[_0xe527('0xa')][_0xe527('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bb8d0,_0xe0afcd,_0xb10d6b){return new BPromise(function(_0x2e7576,_0x3f9535){return client['request'](_0x3bb8d0,_0xb10d6b)[_0xe527('0xc')](function(_0x3ff1d5){logger[_0xe527('0xd')](_0xe527('0xe'),_0xe0afcd,_0xe527('0xf'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0xe0afcd,'request\x20sent',JSON[_0xe527('0x10')](_0x3ff1d5));if(_0x3ff1d5[_0xe527('0x11')]){if(_0x3ff1d5[_0xe527('0x11')]['code']===0x1f4){logger[_0xe527('0x11')](_0xe527('0xe'),_0xe0afcd,_0x3ff1d5['error']['message']);return _0x3f9535(_0x3ff1d5[_0xe527('0x11')]['message']);}logger[_0xe527('0x11')](_0xe527('0xe'),_0xe0afcd,_0x3ff1d5[_0xe527('0x11')][_0xe527('0x12')]);return _0x2e7576(_0x3ff1d5['error'][_0xe527('0x12')]);}else{logger[_0xe527('0xd')](_0xe527('0xe'),_0xe0afcd,_0xe527('0xf'));_0x2e7576(_0x3ff1d5[_0xe527('0x13')]['message']);}})['catch'](function(_0x27ed61){logger[_0xe527('0x11')](_0xe527('0xe'),_0xe0afcd,_0x27ed61);_0x3f9535(_0x27ed61);});});}exports[_0xe527('0x14')]=function(_0x5874a8){var _0x1b0058=this;return new Promise(function(_0x4deee1,_0x2007aa){return db['SquareReport'][_0xe527('0x15')](_0x5874a8[_0xe527('0x16')],{'raw':_0x5874a8[_0xe527('0x17')]?_0x5874a8[_0xe527('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x59e94c){logger[_0xe527('0xd')](_0xe527('0x14'),_0x5874a8);logger[_0xe527('0x18')]('CreateSquareReport',_0x5874a8,JSON[_0xe527('0x10')](_0x59e94c));_0x4deee1(_0x59e94c);})[_0xe527('0x19')](function(_0x311ba){logger[_0xe527('0x11')]('CreateSquareReport',_0x311ba[_0xe527('0x12')],_0x5874a8);_0x2007aa(_0x1b0058[_0xe527('0x11')](0x1f4,_0x311ba[_0xe527('0x12')]));});});};exports[_0xe527('0x1a')]=function(_0x37e4ae){var _0x4face8=this;return new Promise(function(_0x110344,_0x345d5f){return db[_0xe527('0x1b')]['update'](_0x37e4ae[_0xe527('0x16')],{'raw':_0x37e4ae[_0xe527('0x17')]?_0x37e4ae[_0xe527('0x17')][_0xe527('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37e4ae['options']?_0x37e4ae[_0xe527('0x17')][_0xe527('0x1d')]||null:null,'attributes':_0x37e4ae[_0xe527('0x17')]?_0x37e4ae[_0xe527('0x17')][_0xe527('0x1e')]||null:null,'limit':_0x37e4ae['options']?_0x37e4ae[_0xe527('0x17')][_0xe527('0x1f')]||null:null})[_0xe527('0xc')](function(_0x243810){logger['info'](_0xe527('0x1a'),_0x37e4ae);logger[_0xe527('0x18')]('UpdateSquareReport',_0x37e4ae,JSON['stringify'](_0x243810));_0x110344(_0x243810);})[_0xe527('0x19')](function(_0xbf1a7e){logger[_0xe527('0x11')](_0xe527('0x1a'),_0xbf1a7e[_0xe527('0x12')],_0x37e4ae);_0x345d5f(_0x4face8[_0xe527('0x11')](0x1f4,_0xbf1a7e['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index c06be73..e9ff446 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 _0x3416=['../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','/describe','isAuthenticated','describe','/:id','post','create','put','update','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x216799,_0x44b817){var _0x3661c3=function(_0x28f85e){while(--_0x28f85e){_0x216799['push'](_0x216799['shift']());}};_0x3661c3(++_0x44b817);}(_0x3416,0x1e9));var _0x6341=function(_0x540133,_0x41783f){_0x540133=_0x540133-0x0;var _0x26b6e9=_0x3416[_0x540133];return _0x26b6e9;};'use strict';var multer=require(_0x6341('0x0'));var util=require('util');var path=require(_0x6341('0x1'));var timeout=require(_0x6341('0x2'));var express=require('express');var router=express[_0x6341('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6341('0x4'));var interaction=require(_0x6341('0x5'));var config=require(_0x6341('0x6'));var controller=require(_0x6341('0x7'));router[_0x6341('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6341('0x8')](_0x6341('0x9'),auth[_0x6341('0xa')](),controller[_0x6341('0xb')]);router[_0x6341('0x8')](_0x6341('0xc'),auth[_0x6341('0xa')](),controller['show']);router[_0x6341('0xd')]('/',auth[_0x6341('0xa')](),controller[_0x6341('0xe')]);router[_0x6341('0xf')]('/:id',auth[_0x6341('0xa')](),controller[_0x6341('0x10')]);router['delete'](_0x6341('0xc'),auth['isAuthenticated'](),controller[_0x6341('0x11')]);module[_0x6341('0x12')]=router; \ No newline at end of file +var _0x9fcf=['../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x161a52,_0x379d22){var _0x3f55fc=function(_0x5b173){while(--_0x5b173){_0x161a52['push'](_0x161a52['shift']());}};_0x3f55fc(++_0x379d22);}(_0x9fcf,0xdf));var _0xf9fc=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x9fcf[_0x45b034];return _0x509cb0;};'use strict';var multer=require(_0xf9fc('0x0'));var util=require(_0xf9fc('0x1'));var path=require('path');var timeout=require(_0xf9fc('0x2'));var express=require(_0xf9fc('0x3'));var router=express[_0xf9fc('0x4')]();var fs_extra=require(_0xf9fc('0x5'));var auth=require(_0xf9fc('0x6'));var interaction=require(_0xf9fc('0x7'));var config=require(_0xf9fc('0x8'));var controller=require(_0xf9fc('0x9'));router[_0xf9fc('0xa')]('/',auth[_0xf9fc('0xb')](),controller[_0xf9fc('0xc')]);router[_0xf9fc('0xa')](_0xf9fc('0xd'),auth[_0xf9fc('0xb')](),controller['describe']);router[_0xf9fc('0xa')]('/:id',auth[_0xf9fc('0xb')](),controller[_0xf9fc('0xe')]);router[_0xf9fc('0xf')]('/',auth['isAuthenticated'](),controller[_0xf9fc('0x10')]);router[_0xf9fc('0x11')](_0xf9fc('0x12'),auth[_0xf9fc('0xb')](),controller['update']);router[_0xf9fc('0x13')](_0xf9fc('0x12'),auth[_0xf9fc('0xb')](),controller[_0xf9fc('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index c6a5fa9..553b302 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 _0x881b=['STRING','sequelize','exports'];(function(_0x56975e,_0x587d46){var _0x16c8d2=function(_0x2b52e6){while(--_0x2b52e6){_0x56975e['push'](_0x56975e['shift']());}};_0x16c8d2(++_0x587d46);}(_0x881b,0x1a2));var _0xb881=function(_0xd06e0,_0x5543e8){_0xd06e0=_0xd06e0-0x0;var _0x1c4e5b=_0x881b[_0xd06e0];return _0x1c4e5b;};'use strict';var Sequelize=require(_0xb881('0x0'));module[_0xb881('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0xb881('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xb881('0x2')]}}; \ No newline at end of file +var _0x2538=['exports','STRING'];(function(_0x394574,_0x1b1f46){var _0x1757fc=function(_0x2a065d){while(--_0x2a065d){_0x394574['push'](_0x394574['shift']());}};_0x1757fc(++_0x1b1f46);}(_0x2538,0x70));var _0x8253=function(_0x1bd85d,_0xdc683f){_0x1bd85d=_0x1bd85d-0x0;var _0xd40669=_0x2538[_0x1bd85d];return _0xd40669;};'use strict';var Sequelize=require('sequelize');module[_0x8253('0x0')]={'uniqueid':{'type':Sequelize[_0x8253('0x1')]},'node':{'type':Sequelize[_0x8253('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x8253('0x1')]},'callerid':{'type':Sequelize[_0x8253('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 9ef287b..e98c901 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 _0x58fe=['set','Content-Range','apply','reject','save','update','then','stack','name','send','index','SquareDetailsReport','rawAttributes','key','model','map','query','keys','filters','attributes','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','catch','params','intersection','fields','length','options','body','find','destroy','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit'];(function(_0x4d894e,_0x3c50f3){var _0x173130=function(_0xb5120b){while(--_0xb5120b){_0x4d894e['push'](_0x4d894e['shift']());}};_0x173130(++_0x3c50f3);}(_0x58fe,0xbb));var _0xe58f=function(_0x3eb630,_0x552586){_0x3eb630=_0x3eb630-0x0;var _0x1b840d=_0x58fe[_0x3eb630];return _0x1b840d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe58f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe58f('0x1'));var rp=require(_0xe58f('0x2'));var moment=require(_0xe58f('0x3'));var BPromise=require(_0xe58f('0x4'));var Mustache=require(_0xe58f('0x5'));var util=require(_0xe58f('0x6'));var path=require(_0xe58f('0x7'));var sox=require('sox');var csv=require(_0xe58f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe58f('0x9'));var crypto=require(_0xe58f('0xa'));var jsforce=require(_0xe58f('0xb'));var deskjs=require(_0xe58f('0xc'));var toCsv=require(_0xe58f('0x8'));var querystring=require(_0xe58f('0xd'));var Papa=require('papaparse');var Redis=require(_0xe58f('0xe'));var authService=require(_0xe58f('0xf'));var qs=require(_0xe58f('0x10'));var as=require(_0xe58f('0x11'));var hardwareService=require(_0xe58f('0x12'));var logger=require(_0xe58f('0x13'))('api');var utils=require(_0xe58f('0x14'));var config=require(_0xe58f('0x15'));var licenseUtil=require(_0xe58f('0x16'));var db=require(_0xe58f('0x17'))['db'];function respondWithStatusCode(_0x5661de,_0x21b97f){_0x21b97f=_0x21b97f||0xcc;return function(_0x42889b){if(_0x42889b){return _0x5661de[_0xe58f('0x18')](_0x21b97f);}return _0x5661de['status'](_0x21b97f)[_0xe58f('0x19')]();};}function respondWithResult(_0x581e0b,_0x47d01a){_0x47d01a=_0x47d01a||0xc8;return function(_0x4720d5){if(_0x4720d5){return _0x581e0b[_0xe58f('0x1a')](_0x47d01a)[_0xe58f('0x1b')](_0x4720d5);}};}function respondWithFilteredResult(_0x48e7e6,_0xe70f7e){return function(_0x5360b6){if(_0x5360b6){var _0x27a0a6=typeof _0xe70f7e[_0xe58f('0x1c')]===_0xe58f('0x1d')&&typeof _0xe70f7e['limit']===_0xe58f('0x1d');var _0x3caeb1=_0x5360b6[_0xe58f('0x1e')];var _0x3ff1c7=_0x27a0a6?0x0:_0xe70f7e[_0xe58f('0x1c')];var _0x1fa9ae=_0x27a0a6?_0x5360b6[_0xe58f('0x1e')]:_0xe70f7e[_0xe58f('0x1c')]+_0xe70f7e[_0xe58f('0x1f')];var _0x37b34c;if(_0x1fa9ae>=_0x3caeb1){_0x1fa9ae=_0x3caeb1;_0x37b34c=0xc8;}else{_0x37b34c=0xce;}_0x48e7e6['status'](_0x37b34c);return _0x48e7e6[_0xe58f('0x20')](_0xe58f('0x21'),_0x3ff1c7+'-'+_0x1fa9ae+'/'+_0x3caeb1)[_0xe58f('0x1b')](_0x5360b6);}return null;};}function patchUpdates(_0x272f91){return function(_0x5d3c75){try{jsonpatch[_0xe58f('0x22')](_0x5d3c75,_0x272f91,!![]);}catch(_0x10ba45){return BPromise[_0xe58f('0x23')](_0x10ba45);}return _0x5d3c75[_0xe58f('0x24')]();};}function saveUpdates(_0x153841,_0x3b848f){return function(_0x5d5eb3){if(_0x5d5eb3){return _0x5d5eb3[_0xe58f('0x25')](_0x153841)[_0xe58f('0x26')](function(_0x5377d3){return _0x5377d3;});}return null;};}function removeEntity(_0x4defc0,_0x1345c9){return function(_0x3e9fa3){if(_0x3e9fa3){return _0x3e9fa3['destroy']()[_0xe58f('0x26')](function(){_0x4defc0[_0xe58f('0x1a')](0xcc)[_0xe58f('0x19')]();});}};}function handleEntityNotFound(_0x24d5c3,_0x528616){return function(_0x510a84){if(!_0x510a84){_0x24d5c3[_0xe58f('0x18')](0x194);}return _0x510a84;};}function handleError(_0x12bde1,_0x82e599){_0x82e599=_0x82e599||0x1f4;return function(_0x28791f){logger['error'](_0x28791f[_0xe58f('0x27')]);if(_0x28791f[_0xe58f('0x28')]){delete _0x28791f[_0xe58f('0x28')];}_0x12bde1[_0xe58f('0x1a')](_0x82e599)[_0xe58f('0x29')](_0x28791f);};}exports[_0xe58f('0x2a')]=function(_0x7bddfd,_0x22cb04){var _0x56f7d0={},_0x3e71fd={},_0x37ca2d={'count':0x0,'rows':[]};var _0x3bf22a=_['map'](db[_0xe58f('0x2b')][_0xe58f('0x2c')],function(_0x168f7f){return{'name':_0x168f7f['fieldName'],'type':_0x168f7f['type'][_0xe58f('0x2d')]};});_0x3e71fd[_0xe58f('0x2e')]=_[_0xe58f('0x2f')](_0x3bf22a,'name');_0x3e71fd[_0xe58f('0x30')]=_[_0xe58f('0x31')](_0x7bddfd[_0xe58f('0x30')]);_0x3e71fd[_0xe58f('0x32')]=_['intersection'](_0x3e71fd['model'],_0x3e71fd[_0xe58f('0x30')]);_0x56f7d0[_0xe58f('0x33')]=_['intersection'](_0x3e71fd['model'],qs['fields'](_0x7bddfd[_0xe58f('0x30')]['fields']));_0x56f7d0[_0xe58f('0x33')]=_0x56f7d0['attributes']['length']?_0x56f7d0['attributes']:_0x3e71fd[_0xe58f('0x2e')];if(!_0x7bddfd[_0xe58f('0x30')]['hasOwnProperty']('nolimit')){_0x56f7d0['limit']=qs[_0xe58f('0x1f')](_0x7bddfd['query'][_0xe58f('0x1f')]);_0x56f7d0[_0xe58f('0x1c')]=qs[_0xe58f('0x1c')](_0x7bddfd['query'][_0xe58f('0x1c')]);}_0x56f7d0[_0xe58f('0x34')]=qs[_0xe58f('0x35')](_0x7bddfd[_0xe58f('0x30')]['sort']);_0x56f7d0[_0xe58f('0x36')]=qs[_0xe58f('0x32')](_[_0xe58f('0x37')](_0x7bddfd[_0xe58f('0x30')],_0x3e71fd[_0xe58f('0x32')]),_0x3bf22a);if(_0x7bddfd[_0xe58f('0x30')][_0xe58f('0x38')]){_0x56f7d0[_0xe58f('0x36')]=_['merge'](_0x56f7d0[_0xe58f('0x36')],{'$or':_[_0xe58f('0x2f')](_0x3bf22a,function(_0x192657){if(_0x192657[_0xe58f('0x39')]!==_0xe58f('0x3a')){var _0x4667f2={};_0x4667f2[_0x192657[_0xe58f('0x28')]]={'$like':'%'+_0x7bddfd[_0xe58f('0x30')][_0xe58f('0x38')]+'%'};return _0x4667f2;}})});}_0x56f7d0=_[_0xe58f('0x3b')]({},_0x56f7d0,_0x7bddfd['options']);var _0x342af8={'where':_0x56f7d0['where']};return db[_0xe58f('0x2b')][_0xe58f('0x1e')](_0x342af8)[_0xe58f('0x26')](function(_0x49df79){_0x37ca2d['count']=_0x49df79;if(_0x7bddfd['query'][_0xe58f('0x3c')]){_0x56f7d0[_0xe58f('0x3d')]=[{'all':!![]}];}return db[_0xe58f('0x2b')][_0xe58f('0x3e')](_0x56f7d0);})[_0xe58f('0x26')](function(_0x1bc595){_0x37ca2d['rows']=_0x1bc595;return _0x37ca2d;})[_0xe58f('0x26')](respondWithFilteredResult(_0x22cb04,_0x56f7d0))[_0xe58f('0x3f')](handleError(_0x22cb04,null));};exports['show']=function(_0x5892e8,_0x1b5b0d){var _0x1bb792={'raw':!![],'where':{'id':_0x5892e8[_0xe58f('0x40')]['id']}},_0xd1b901={};_0xd1b901[_0xe58f('0x2e')]=_[_0xe58f('0x31')](db[_0xe58f('0x2b')][_0xe58f('0x2c')]);_0xd1b901[_0xe58f('0x30')]=_[_0xe58f('0x31')](_0x5892e8[_0xe58f('0x30')]);_0xd1b901['filters']=_['intersection'](_0xd1b901[_0xe58f('0x2e')],_0xd1b901[_0xe58f('0x30')]);_0x1bb792[_0xe58f('0x33')]=_[_0xe58f('0x41')](_0xd1b901[_0xe58f('0x2e')],qs['fields'](_0x5892e8['query'][_0xe58f('0x42')]));_0x1bb792[_0xe58f('0x33')]=_0x1bb792[_0xe58f('0x33')][_0xe58f('0x43')]?_0x1bb792['attributes']:_0xd1b901[_0xe58f('0x2e')];if(_0x5892e8[_0xe58f('0x30')][_0xe58f('0x3c')]){_0x1bb792['include']=[{'all':!![]}];}_0x1bb792=_['merge']({},_0x1bb792,_0x5892e8[_0xe58f('0x44')]);return db[_0xe58f('0x2b')]['find'](_0x1bb792)[_0xe58f('0x26')](handleEntityNotFound(_0x1b5b0d,null))['then'](respondWithResult(_0x1b5b0d,null))[_0xe58f('0x3f')](handleError(_0x1b5b0d,null));};exports['create']=function(_0x14d613,_0x42f98b){return db[_0xe58f('0x2b')]['create'](_0x14d613[_0xe58f('0x45')],{})['then'](respondWithResult(_0x42f98b,0xc9))[_0xe58f('0x3f')](handleError(_0x42f98b,null));};exports['update']=function(_0x50b355,_0x390c3b){if(_0x50b355['body']['id']){delete _0x50b355[_0xe58f('0x45')]['id'];}return db[_0xe58f('0x2b')][_0xe58f('0x46')]({'where':{'id':_0x50b355[_0xe58f('0x40')]['id']}})[_0xe58f('0x26')](handleEntityNotFound(_0x390c3b,null))[_0xe58f('0x26')](saveUpdates(_0x50b355[_0xe58f('0x45')],null))['then'](respondWithResult(_0x390c3b,null))['catch'](handleError(_0x390c3b,null));};exports[_0xe58f('0x47')]=function(_0x4fbe31,_0x4594ae){return db[_0xe58f('0x2b')][_0xe58f('0x46')]({'where':{'id':_0x4fbe31[_0xe58f('0x40')]['id']}})[_0xe58f('0x26')](handleEntityNotFound(_0x4594ae,null))[_0xe58f('0x26')](removeEntity(_0x4594ae,null))[_0xe58f('0x3f')](handleError(_0x4594ae,null));};exports[_0xe58f('0x48')]=function(_0x334823,_0x409345){return db[_0xe58f('0x2b')][_0xe58f('0x48')]()[_0xe58f('0x26')](respondWithResult(_0x409345,null))['catch'](handleError(_0x409345,null));}; \ No newline at end of file +var _0x3605=['merge','type','VIRTUAL','options','include','findAll','rows','params','keys','includeAll','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','order','sort','where','pick','filter'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0x3605,0xde));var _0x5360=function(_0xdd043a,_0x5785ae){_0xdd043a=_0xdd043a-0x0;var _0x54df97=_0x3605[_0xdd043a];return _0x54df97;};'use strict';var emlformat=require(_0x5360('0x0'));var rimraf=require(_0x5360('0x1'));var zipdir=require(_0x5360('0x2'));var jsonpatch=require(_0x5360('0x3'));var rp=require('request-promise');var moment=require(_0x5360('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5360('0x5'));var csv=require(_0x5360('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5360('0x7'));var _=require('lodash');var squel=require(_0x5360('0x8'));var crypto=require(_0x5360('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x5360('0xa'));var toCsv=require('to-csv');var querystring=require(_0x5360('0xb'));var Papa=require(_0x5360('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5360('0xd'));var as=require(_0x5360('0xe'));var hardwareService=require(_0x5360('0xf'));var logger=require(_0x5360('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x5360('0x11'));var licenseUtil=require(_0x5360('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x349c39,_0x4905ae){_0x4905ae=_0x4905ae||0xcc;return function(_0x4b6a4f){if(_0x4b6a4f){return _0x349c39[_0x5360('0x13')](_0x4905ae);}return _0x349c39[_0x5360('0x14')](_0x4905ae)['end']();};}function respondWithResult(_0x3021c8,_0x3ceee5){_0x3ceee5=_0x3ceee5||0xc8;return function(_0x4aa288){if(_0x4aa288){return _0x3021c8['status'](_0x3ceee5)[_0x5360('0x15')](_0x4aa288);}};}function respondWithFilteredResult(_0x2efa3f,_0xd7ba1d){return function(_0x40c65b){if(_0x40c65b){var _0x440dc6=typeof _0xd7ba1d[_0x5360('0x16')]===_0x5360('0x17')&&typeof _0xd7ba1d[_0x5360('0x18')]===_0x5360('0x17');var _0x3c96e1=_0x40c65b[_0x5360('0x19')];var _0x765def=_0x440dc6?0x0:_0xd7ba1d[_0x5360('0x16')];var _0x3d478d=_0x440dc6?_0x40c65b[_0x5360('0x19')]:_0xd7ba1d['offset']+_0xd7ba1d['limit'];var _0x289612;if(_0x3d478d>=_0x3c96e1){_0x3d478d=_0x3c96e1;_0x289612=0xc8;}else{_0x289612=0xce;}_0x2efa3f['status'](_0x289612);return _0x2efa3f['set'](_0x5360('0x1a'),_0x765def+'-'+_0x3d478d+'/'+_0x3c96e1)[_0x5360('0x15')](_0x40c65b);}return null;};}function patchUpdates(_0x5abf6b){return function(_0x51c8c6){try{jsonpatch[_0x5360('0x1b')](_0x51c8c6,_0x5abf6b,!![]);}catch(_0x4091d5){return BPromise[_0x5360('0x1c')](_0x4091d5);}return _0x51c8c6[_0x5360('0x1d')]();};}function saveUpdates(_0x44f67a,_0x73b961){return function(_0x6ef908){if(_0x6ef908){return _0x6ef908[_0x5360('0x1e')](_0x44f67a)[_0x5360('0x1f')](function(_0x3f92e4){return _0x3f92e4;});}return null;};}function removeEntity(_0x4e9bf5,_0x3c4955){return function(_0x31f94a){if(_0x31f94a){return _0x31f94a[_0x5360('0x20')]()[_0x5360('0x1f')](function(){_0x4e9bf5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28f56b,_0x141a47){return function(_0x53b4ba){if(!_0x53b4ba){_0x28f56b[_0x5360('0x13')](0x194);}return _0x53b4ba;};}function handleError(_0x72e102,_0x5cd990){_0x5cd990=_0x5cd990||0x1f4;return function(_0x9924c7){logger[_0x5360('0x21')](_0x9924c7[_0x5360('0x22')]);if(_0x9924c7[_0x5360('0x23')]){delete _0x9924c7['name'];}_0x72e102[_0x5360('0x14')](_0x5cd990)[_0x5360('0x24')](_0x9924c7);};}exports[_0x5360('0x25')]=function(_0x5f3ba5,_0x3d0a85){var _0x318a30={},_0x1d531c={},_0x4d9098={'count':0x0,'rows':[]};var _0x1e1cec=_[_0x5360('0x26')](db[_0x5360('0x27')][_0x5360('0x28')],function(_0xed4916){return{'name':_0xed4916[_0x5360('0x29')],'type':_0xed4916['type']['key']};});_0x1d531c[_0x5360('0x2a')]=_[_0x5360('0x26')](_0x1e1cec,_0x5360('0x23'));_0x1d531c[_0x5360('0x2b')]=_['keys'](_0x5f3ba5[_0x5360('0x2b')]);_0x1d531c[_0x5360('0x2c')]=_['intersection'](_0x1d531c['model'],_0x1d531c[_0x5360('0x2b')]);_0x318a30[_0x5360('0x2d')]=_[_0x5360('0x2e')](_0x1d531c[_0x5360('0x2a')],qs['fields'](_0x5f3ba5[_0x5360('0x2b')][_0x5360('0x2f')]));_0x318a30['attributes']=_0x318a30['attributes'][_0x5360('0x30')]?_0x318a30[_0x5360('0x2d')]:_0x1d531c[_0x5360('0x2a')];if(!_0x5f3ba5[_0x5360('0x2b')]['hasOwnProperty']('nolimit')){_0x318a30['limit']=qs[_0x5360('0x18')](_0x5f3ba5[_0x5360('0x2b')]['limit']);_0x318a30[_0x5360('0x16')]=qs['offset'](_0x5f3ba5[_0x5360('0x2b')][_0x5360('0x16')]);}_0x318a30[_0x5360('0x31')]=qs[_0x5360('0x32')](_0x5f3ba5[_0x5360('0x2b')][_0x5360('0x32')]);_0x318a30[_0x5360('0x33')]=qs['filters'](_[_0x5360('0x34')](_0x5f3ba5[_0x5360('0x2b')],_0x1d531c[_0x5360('0x2c')]),_0x1e1cec);if(_0x5f3ba5[_0x5360('0x2b')][_0x5360('0x35')]){_0x318a30[_0x5360('0x33')]=_[_0x5360('0x36')](_0x318a30[_0x5360('0x33')],{'$or':_['map'](_0x1e1cec,function(_0x206caf){if(_0x206caf[_0x5360('0x37')]!==_0x5360('0x38')){var _0x4eaae6={};_0x4eaae6[_0x206caf[_0x5360('0x23')]]={'$like':'%'+_0x5f3ba5[_0x5360('0x2b')][_0x5360('0x35')]+'%'};return _0x4eaae6;}})});}_0x318a30=_[_0x5360('0x36')]({},_0x318a30,_0x5f3ba5[_0x5360('0x39')]);var _0x50a175={'where':_0x318a30[_0x5360('0x33')]};return db[_0x5360('0x27')][_0x5360('0x19')](_0x50a175)['then'](function(_0x395b03){_0x4d9098[_0x5360('0x19')]=_0x395b03;if(_0x5f3ba5[_0x5360('0x2b')]['includeAll']){_0x318a30[_0x5360('0x3a')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x5360('0x3b')](_0x318a30);})['then'](function(_0x4b597f){_0x4d9098[_0x5360('0x3c')]=_0x4b597f;return _0x4d9098;})[_0x5360('0x1f')](respondWithFilteredResult(_0x3d0a85,_0x318a30))['catch'](handleError(_0x3d0a85,null));};exports['show']=function(_0xe465cf,_0x1b2a52){var _0x32984={'raw':!![],'where':{'id':_0xe465cf[_0x5360('0x3d')]['id']}},_0x23c47b={};_0x23c47b[_0x5360('0x2a')]=_[_0x5360('0x3e')](db['SquareDetailsReport'][_0x5360('0x28')]);_0x23c47b[_0x5360('0x2b')]=_[_0x5360('0x3e')](_0xe465cf['query']);_0x23c47b[_0x5360('0x2c')]=_[_0x5360('0x2e')](_0x23c47b[_0x5360('0x2a')],_0x23c47b[_0x5360('0x2b')]);_0x32984[_0x5360('0x2d')]=_[_0x5360('0x2e')](_0x23c47b['model'],qs[_0x5360('0x2f')](_0xe465cf[_0x5360('0x2b')][_0x5360('0x2f')]));_0x32984[_0x5360('0x2d')]=_0x32984[_0x5360('0x2d')]['length']?_0x32984[_0x5360('0x2d')]:_0x23c47b[_0x5360('0x2a')];if(_0xe465cf['query'][_0x5360('0x3f')]){_0x32984[_0x5360('0x3a')]=[{'all':!![]}];}_0x32984=_['merge']({},_0x32984,_0xe465cf['options']);return db[_0x5360('0x27')]['find'](_0x32984)[_0x5360('0x1f')](handleEntityNotFound(_0x1b2a52,null))[_0x5360('0x1f')](respondWithResult(_0x1b2a52,null))[_0x5360('0x40')](handleError(_0x1b2a52,null));};exports[_0x5360('0x41')]=function(_0x2701af,_0x2b6ff6){return db['SquareDetailsReport'][_0x5360('0x41')](_0x2701af[_0x5360('0x42')],{})[_0x5360('0x1f')](respondWithResult(_0x2b6ff6,0xc9))[_0x5360('0x40')](handleError(_0x2b6ff6,null));};exports[_0x5360('0x1e')]=function(_0x5249bc,_0x3b9e23){if(_0x5249bc[_0x5360('0x42')]['id']){delete _0x5249bc[_0x5360('0x42')]['id'];}return db[_0x5360('0x27')][_0x5360('0x43')]({'where':{'id':_0x5249bc['params']['id']}})[_0x5360('0x1f')](handleEntityNotFound(_0x3b9e23,null))[_0x5360('0x1f')](saveUpdates(_0x5249bc[_0x5360('0x42')],null))[_0x5360('0x1f')](respondWithResult(_0x3b9e23,null))[_0x5360('0x40')](handleError(_0x3b9e23,null));};exports[_0x5360('0x20')]=function(_0xfc3320,_0x15e867){return db[_0x5360('0x27')][_0x5360('0x43')]({'where':{'id':_0xfc3320[_0x5360('0x3d')]['id']}})[_0x5360('0x1f')](handleEntityNotFound(_0x15e867,null))[_0x5360('0x1f')](removeEntity(_0x15e867,null))[_0x5360('0x40')](handleError(_0x15e867,null));};exports['describe']=function(_0x3fd62d,_0xc5dfb2){return db[_0x5360('0x27')][_0x5360('0x44')]()[_0x5360('0x1f')](respondWithResult(_0xc5dfb2,null))[_0x5360('0x40')](handleError(_0xc5dfb2,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 871c04b..fda6944 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 _0x28a4=['SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x441aff,_0x384ecf){var _0x44588b=function(_0x1923dc){while(--_0x1923dc){_0x441aff['push'](_0x441aff['shift']());}};_0x44588b(++_0x384ecf);}(_0x28a4,0x115));var _0x428a=function(_0x1d4449,_0x495153){_0x1d4449=_0x1d4449-0x0;var _0x4dcde3=_0x28a4[_0x1d4449];return _0x4dcde3;};'use strict';var _=require(_0x428a('0x0'));var util=require(_0x428a('0x1'));var logger=require(_0x428a('0x2'))(_0x428a('0x3'));var moment=require('moment');var BPromise=require(_0x428a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x428a('0x5'));var rimraf=require(_0x428a('0x6'));var config=require(_0x428a('0x7'));var attributes=require('./squareReportDetail.attributes');module[_0x428a('0x8')]=function(_0x436958,_0x1febad){return _0x436958['define'](_0x428a('0x9'),attributes,{'tableName':_0x428a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6d1=['../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x18a65f,_0x45119b){var _0x4b0357=function(_0x81f2fc){while(--_0x81f2fc){_0x18a65f['push'](_0x18a65f['shift']());}};_0x4b0357(++_0x45119b);}(_0xb6d1,0xd7));var _0x1b6d=function(_0x2145c0,_0x549319){_0x2145c0=_0x2145c0-0x0;var _0x4c613a=_0xb6d1[_0x2145c0];return _0x4c613a;};'use strict';var _=require(_0x1b6d('0x0'));var util=require(_0x1b6d('0x1'));var logger=require(_0x1b6d('0x2'))(_0x1b6d('0x3'));var moment=require(_0x1b6d('0x4'));var BPromise=require(_0x1b6d('0x5'));var rp=require(_0x1b6d('0x6'));var fs=require('fs');var path=require(_0x1b6d('0x7'));var rimraf=require(_0x1b6d('0x8'));var config=require(_0x1b6d('0x9'));var attributes=require(_0x1b6d('0xa'));module[_0x1b6d('0xb')]=function(_0x4a7d63,_0x4142ef){return _0x4a7d63[_0x1b6d('0xc')](_0x1b6d('0xd'),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 8c6ab96..dac29e9 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 _0xfef3=['../../config/environment','jayson/promise','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5b6cb6,_0x2f2d81){var _0x5dc9be=function(_0x699fc4){while(--_0x699fc4){_0x5b6cb6['push'](_0x5b6cb6['shift']());}};_0x5dc9be(++_0x2f2d81);}(_0xfef3,0x118));var _0x3fef=function(_0x9f7d4c,_0x28ddbd){_0x9f7d4c=_0x9f7d4c-0x0;var _0x541c20=_0xfef3[_0x9f7d4c];return _0x541c20;};'use strict';var _=require(_0x3fef('0x0'));var util=require('util');var moment=require(_0x3fef('0x1'));var BPromise=require('bluebird');var rs=require(_0x3fef('0x2'));var fs=require('fs');var Redis=require(_0x3fef('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fef('0x4'));var logger=require(_0x3fef('0x5'))('rpc');var config=require(_0x3fef('0x6'));var jayson=require(_0x3fef('0x7'));var client=jayson['client'][_0x3fef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f5b72,_0x800850,_0x33e00a){return new BPromise(function(_0x1fffc5,_0x41960c){return client[_0x3fef('0x9')](_0x5f5b72,_0x33e00a)[_0x3fef('0xa')](function(_0x31c30f){logger[_0x3fef('0xb')](_0x3fef('0xc'),_0x800850,_0x3fef('0xd'));logger[_0x3fef('0xe')](_0x3fef('0xf'),_0x800850,'request\x20sent',JSON[_0x3fef('0x10')](_0x31c30f));if(_0x31c30f[_0x3fef('0x11')]){if(_0x31c30f[_0x3fef('0x11')]['code']===0x1f4){logger[_0x3fef('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x800850,_0x31c30f[_0x3fef('0x11')][_0x3fef('0x12')]);return _0x41960c(_0x31c30f[_0x3fef('0x11')]['message']);}logger[_0x3fef('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x800850,_0x31c30f[_0x3fef('0x11')][_0x3fef('0x12')]);return _0x1fffc5(_0x31c30f['error'][_0x3fef('0x12')]);}else{logger[_0x3fef('0xb')](_0x3fef('0xc'),_0x800850,_0x3fef('0xd'));_0x1fffc5(_0x31c30f[_0x3fef('0x13')][_0x3fef('0x12')]);}})['catch'](function(_0x1cbdbb){logger[_0x3fef('0x11')](_0x3fef('0xc'),_0x800850,_0x1cbdbb);_0x41960c(_0x1cbdbb);});});}exports[_0x3fef('0x14')]=function(_0x1613ad){var _0xaa0ae3=this;return new Promise(function(_0x53d993,_0x36669d){return db[_0x3fef('0x15')]['create'](_0x1613ad[_0x3fef('0x16')],{'raw':_0x1613ad[_0x3fef('0x17')]?_0x1613ad[_0x3fef('0x17')][_0x3fef('0x18')]===undefined?!![]:![]:!![]})[_0x3fef('0xa')](function(_0x2b5226){logger[_0x3fef('0xb')](_0x3fef('0x14'),_0x1613ad);logger[_0x3fef('0xe')](_0x3fef('0x14'),_0x1613ad,JSON[_0x3fef('0x10')](_0x2b5226));_0x53d993(_0x2b5226);})[_0x3fef('0x19')](function(_0x2eb578){logger[_0x3fef('0x11')](_0x3fef('0x14'),_0x2eb578['message'],_0x1613ad);_0x36669d(_0xaa0ae3['error'](0x1f4,_0x2eb578['message']));});});}; \ No newline at end of file +var _0x4e2e=['options','raw','CreateSquareDetailsReport','debug','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','SquareDetailsReport','create','body'];(function(_0x3c6f79,_0x3ed502){var _0x311855=function(_0x35c843){while(--_0x35c843){_0x3c6f79['push'](_0x3c6f79['shift']());}};_0x311855(++_0x3ed502);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x3926a3,_0x26c38f){_0x3926a3=_0x3926a3-0x0;var _0x40a502=_0x4e2e[_0x3926a3];return _0x40a502;};'use strict';var _=require('lodash');var util=require(_0xe4e2('0x0'));var moment=require(_0xe4e2('0x1'));var BPromise=require(_0xe4e2('0x2'));var rs=require(_0xe4e2('0x3'));var fs=require('fs');var Redis=require(_0xe4e2('0x4'));var db=require(_0xe4e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4e2('0x6'))(_0xe4e2('0x7'));var config=require(_0xe4e2('0x8'));var jayson=require(_0xe4e2('0x9'));var client=jayson['client'][_0xe4e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36b1c6,_0x1c4e64,_0x125338){return new BPromise(function(_0x956c75,_0x27304b){return client[_0xe4e2('0xb')](_0x36b1c6,_0x125338)[_0xe4e2('0xc')](function(_0x4912da){logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));logger['debug'](_0xe4e2('0x10'),_0x1c4e64,_0xe4e2('0xf'),JSON[_0xe4e2('0x11')](_0x4912da));if(_0x4912da[_0xe4e2('0x12')]){if(_0x4912da[_0xe4e2('0x12')]['code']===0x1f4){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x27304b(_0x4912da['error'][_0xe4e2('0x13')]);}logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x956c75(_0x4912da['error']['message']);}else{logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));_0x956c75(_0x4912da[_0xe4e2('0x14')][_0xe4e2('0x13')]);}})['catch'](function(_0x754778){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x754778);_0x27304b(_0x754778);});});}exports['CreateSquareDetailsReport']=function(_0x196f16){var _0x54c80b=this;return new Promise(function(_0x1d5e9d,_0x3f313b){return db[_0xe4e2('0x15')][_0xe4e2('0x16')](_0x196f16[_0xe4e2('0x17')],{'raw':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')][_0xe4e2('0x19')]===undefined?!![]:![]:!![]})[_0xe4e2('0xc')](function(_0x362741){logger['info'](_0xe4e2('0x1a'),_0x196f16);logger[_0xe4e2('0x1b')](_0xe4e2('0x1a'),_0x196f16,JSON[_0xe4e2('0x11')](_0x362741));_0x1d5e9d(_0x362741);})[_0xe4e2('0x1c')](function(_0x23b466){logger[_0xe4e2('0x12')]('CreateSquareDetailsReport',_0x23b466[_0xe4e2('0x13')],_0x196f16);_0x3f313b(_0x54c80b[_0xe4e2('0x12')](0x1f4,_0x23b466[_0xe4e2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 644765f..64bb5f4 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 _0xf626=['express','Router','./system.controller','get','index','isAuthenticated','killProcess'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0xf626,0x17a));var _0x6f62=function(_0x10d3b9,_0x3e7f60){_0x10d3b9=_0x10d3b9-0x0;var _0x2fbd0e=_0xf626[_0x10d3b9];return _0x2fbd0e;};'use strict';var express=require(_0x6f62('0x0'));var router=express[_0x6f62('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x6f62('0x2'));router[_0x6f62('0x3')]('/',auth['isAuthenticated'](),controller[_0x6f62('0x4')]);router[_0x6f62('0x3')]('/process/:pid/kill',auth[_0x6f62('0x5')](),controller[_0x6f62('0x6')]);module['exports']=router; \ No newline at end of file +var _0xdde9=['isAuthenticated','index','killProcess','exports','Router','../../components/auth/service','get'];(function(_0x102ebd,_0x51a155){var _0x45d80a=function(_0x3d98e9){while(--_0x3d98e9){_0x102ebd['push'](_0x102ebd['shift']());}};_0x45d80a(++_0x51a155);}(_0xdde9,0x1c4));var _0x9dde=function(_0x4126e4,_0x58af07){_0x4126e4=_0x4126e4-0x0;var _0x1f7a88=_0xdde9[_0x4126e4];return _0x1f7a88;};'use strict';var express=require('express');var router=express[_0x9dde('0x0')]();var auth=require(_0x9dde('0x1'));var controller=require('./system.controller');router[_0x9dde('0x2')]('/',auth[_0x9dde('0x3')](),controller[_0x9dde('0x4')]);router[_0x9dde('0x2')]('/process/:pid/kill',auth[_0x9dde('0x3')](),controller[_0x9dde('0x5')]);module[_0x9dde('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 2dd115e..f342aec 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 _0x2f57=['params','pid','split','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','exec','../../config/logger','api','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','getAllData','json','killProcess','ps\x20-p\x20%s\x20-ww\x20-o\x20args'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x2f57,0x1dd));var _0x72f5=function(_0x22b2a7,_0x149ada){_0x22b2a7=_0x22b2a7-0x0;var _0x328d24=_0x2f57[_0x22b2a7];return _0x328d24;};'use strict';var info=require(_0x72f5('0x0'));var exec=require(_0x72f5('0x1'))[_0x72f5('0x2')];var logger=require(_0x72f5('0x3'))(_0x72f5('0x4'));var util=require(_0x72f5('0x5'));var BPromise=require('bluebird');var _=require(_0x72f5('0x6'));function handleError(_0x25091d,_0x4658f2,_0x15a442){_0x4658f2=_0x4658f2||0x1f4;return function(_0x48f573){logger[_0x72f5('0x7')](_0x72f5('0x8'),_0x15a442,_0x4658f2,util[_0x72f5('0x9')](_0x48f573,{'showHidden':![],'depth':null}));delete _0x48f573[_0x72f5('0xa')];_0x25091d[_0x72f5('0xb')](_0x4658f2)[_0x72f5('0xc')](_0x48f573);};}exports['index']=function(_0x3b388f,_0x143681){return info[_0x72f5('0xd')]()['then'](function(_0x416b02){return _0x143681[_0x72f5('0xb')](0xc8)[_0x72f5('0xe')](_0x416b02);})['catch'](function(_0x5e5a02){return _0x143681[_0x72f5('0xb')](0x1f4)[_0x72f5('0xe')](_0x5e5a02);});};exports[_0x72f5('0xf')]=function(_0x5e8f5c,_0x281d81){var _0xe9f37=['components/import/cm'];return new BPromise(function(_0x5be3ac,_0xe104ad){return exec(util['format'](_0x72f5('0x10'),_0x5e8f5c[_0x72f5('0x11')][_0x72f5('0x12')]),function(_0x1befe9,_0x7c6f7e,_0x37215a){if(_0x1befe9){return _0xe104ad(_0x1befe9);}return _0x5be3ac(_0x7c6f7e);});})['then'](function(_0x2eead7){var _0x2afd1e=![];var _0x58f053=_0x2eead7[_0x72f5('0x13')](/\n/);for(var _0x5ac902=0x0,_0x22726c=_0xe9f37['length'];_0x5ac902<_0x22726c,_0x2afd1e===![];_0x5ac902+=0x1){if(_0x2eead7[_0x72f5('0x14')](_0xe9f37[_0x5ac902])>=0x0){_0x2afd1e=!![];}}if(!_0x2afd1e){throw new Error(util[_0x72f5('0x15')](_0x72f5('0x16'),_0x5e8f5c[_0x72f5('0x11')][_0x72f5('0x12')]));}process['kill'](_0x5e8f5c[_0x72f5('0x11')][_0x72f5('0x12')],_0x72f5('0x17'));return _0x281d81[_0x72f5('0xb')](0xc8)[_0x72f5('0xe')]({'message':util[_0x72f5('0x15')](_0x72f5('0x18'),_0x5e8f5c[_0x72f5('0x11')][_0x72f5('0x12')])});})[_0x72f5('0x19')](handleError(_0x281d81,null,'killProcess'));}; \ No newline at end of file +var _0x9bf1=['getAllData','then','json','catch','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','util','bluebird','lodash','error','name','status','send','index'];(function(_0x14a472,_0x451fa6){var _0x26af6c=function(_0x3d840b){while(--_0x3d840b){_0x14a472['push'](_0x14a472['shift']());}};_0x26af6c(++_0x451fa6);}(_0x9bf1,0xe8));var _0x19bf=function(_0x336376,_0xe4b28d){_0x336376=_0x336376-0x0;var _0x1d2a8e=_0x9bf1[_0x336376];return _0x1d2a8e;};'use strict';var info=require('systeminformation');var exec=require(_0x19bf('0x0'))[_0x19bf('0x1')];var logger=require(_0x19bf('0x2'))('api');var util=require(_0x19bf('0x3'));var BPromise=require(_0x19bf('0x4'));var _=require(_0x19bf('0x5'));function handleError(_0x1c4d3c,_0x2e3851,_0x177ce5){_0x2e3851=_0x2e3851||0x1f4;return function(_0x5b7f85){logger[_0x19bf('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x177ce5,_0x2e3851,util['inspect'](_0x5b7f85,{'showHidden':![],'depth':null}));delete _0x5b7f85[_0x19bf('0x7')];_0x1c4d3c[_0x19bf('0x8')](_0x2e3851)[_0x19bf('0x9')](_0x5b7f85);};}exports[_0x19bf('0xa')]=function(_0x4ab58b,_0x3f098f){return info[_0x19bf('0xb')]()[_0x19bf('0xc')](function(_0x41d88a){return _0x3f098f[_0x19bf('0x8')](0xc8)[_0x19bf('0xd')](_0x41d88a);})[_0x19bf('0xe')](function(_0xae0169){return _0x3f098f[_0x19bf('0x8')](0x1f4)[_0x19bf('0xd')](_0xae0169);});};exports[_0x19bf('0xf')]=function(_0x449e44,_0x4c3c0c){var _0x3c5875=[_0x19bf('0x10')];return new BPromise(function(_0x9507a0,_0x2ee9f3){return exec(util['format'](_0x19bf('0x11'),_0x449e44['params'][_0x19bf('0x12')]),function(_0x516296,_0x489a9e,_0x4698c2){if(_0x516296){return _0x2ee9f3(_0x516296);}return _0x9507a0(_0x489a9e);});})['then'](function(_0x4fc419){var _0x58c76a=![];var _0x53ec38=_0x4fc419[_0x19bf('0x13')](/\n/);for(var _0x51a10b=0x0,_0x396864=_0x3c5875[_0x19bf('0x14')];_0x51a10b<_0x396864,_0x58c76a===![];_0x51a10b+=0x1){if(_0x4fc419[_0x19bf('0x15')](_0x3c5875[_0x51a10b])>=0x0){_0x58c76a=!![];}}if(!_0x58c76a){throw new Error(util[_0x19bf('0x16')](_0x19bf('0x17'),_0x449e44['params'][_0x19bf('0x12')]));}process['kill'](_0x449e44[_0x19bf('0x18')][_0x19bf('0x12')],_0x19bf('0x19'));return _0x4c3c0c[_0x19bf('0x8')](0xc8)['json']({'message':util[_0x19bf('0x16')](_0x19bf('0x1a'),_0x449e44[_0x19bf('0x18')][_0x19bf('0x12')])});})[_0x19bf('0xe')](handleError(_0x4c3c0c,null,_0x19bf('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 17e598c..f028599 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 _0xb8ed=['util','connect-timeout','Router','fs-extra','../../components/auth/service','./tag.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','multer'];(function(_0x3592c6,_0x4ab3b9){var _0x29396b=function(_0x16653d){while(--_0x16653d){_0x3592c6['push'](_0x3592c6['shift']());}};_0x29396b(++_0x4ab3b9);}(_0xb8ed,0xcf));var _0xdb8e=function(_0xe793f,_0x2112e4){_0xe793f=_0xe793f-0x0;var _0x364dc9=_0xb8ed[_0xe793f];return _0x364dc9;};'use strict';var multer=require(_0xdb8e('0x0'));var util=require(_0xdb8e('0x1'));var path=require('path');var timeout=require(_0xdb8e('0x2'));var express=require('express');var router=express[_0xdb8e('0x3')]();var fs_extra=require(_0xdb8e('0x4'));var auth=require(_0xdb8e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdb8e('0x6'));router[_0xdb8e('0x7')]('/',auth[_0xdb8e('0x8')](),controller['index']);router['get'](_0xdb8e('0x9'),auth[_0xdb8e('0x8')](),controller[_0xdb8e('0xa')]);router[_0xdb8e('0xb')]('/',auth[_0xdb8e('0x8')](),controller[_0xdb8e('0xc')]);router[_0xdb8e('0xd')](_0xdb8e('0x9'),auth[_0xdb8e('0x8')](),controller[_0xdb8e('0xe')]);router[_0xdb8e('0xf')](_0xdb8e('0x9'),auth[_0xdb8e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x22a8=['create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','index','get','/:id','isAuthenticated','show','post'];(function(_0x561f25,_0x2d95c1){var _0x150e4c=function(_0x266e99){while(--_0x266e99){_0x561f25['push'](_0x561f25['shift']());}};_0x150e4c(++_0x2d95c1);}(_0x22a8,0x6e));var _0x822a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x22a8[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x822a('0x0'));var util=require(_0x822a('0x1'));var path=require(_0x822a('0x2'));var timeout=require(_0x822a('0x3'));var express=require(_0x822a('0x4'));var router=express[_0x822a('0x5')]();var fs_extra=require(_0x822a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x822a('0x7'));var config=require(_0x822a('0x8'));var controller=require(_0x822a('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x822a('0xa')]);router[_0x822a('0xb')](_0x822a('0xc'),auth[_0x822a('0xd')](),controller[_0x822a('0xe')]);router[_0x822a('0xf')]('/',auth[_0x822a('0xd')](),controller[_0x822a('0x10')]);router[_0x822a('0x11')](_0x822a('0xc'),auth[_0x822a('0xd')](),controller[_0x822a('0x12')]);router[_0x822a('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x822a('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 91870a1..ea53a6f 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 _0x97f5=['STRING','#0091EA','sequelize','exports'];(function(_0x42f55b,_0x1dc3bd){var _0x3a8037=function(_0x76b489){while(--_0x76b489){_0x42f55b['push'](_0x42f55b['shift']());}};_0x3a8037(++_0x1dc3bd);}(_0x97f5,0x72));var _0x597f=function(_0x14582a,_0x2b3a3a){_0x14582a=_0x14582a-0x0;var _0x3ad371=_0x97f5[_0x14582a];return _0x3ad371;};'use strict';var Sequelize=require(_0x597f('0x0'));module[_0x597f('0x1')]={'name':{'type':Sequelize[_0x597f('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x597f('0x3')},'description':{'type':Sequelize[_0x597f('0x2')]}}; \ No newline at end of file +var _0xdc9b=['sequelize','exports','STRING','#0091EA'];(function(_0x3ae2b2,_0x2d936f){var _0x1dbf00=function(_0x4072e9){while(--_0x4072e9){_0x3ae2b2['push'](_0x3ae2b2['shift']());}};_0x1dbf00(++_0x2d936f);}(_0xdc9b,0x70));var _0xbdc9=function(_0x11a0ae,_0x30a81a){_0x11a0ae=_0x11a0ae-0x0;var _0x303d7d=_0xdc9b[_0x11a0ae];return _0x303d7d;};'use strict';var Sequelize=require(_0xbdc9('0x0'));module[_0xbdc9('0x1')]={'name':{'type':Sequelize[_0xbdc9('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xbdc9('0x2')],'defaultValue':_0xbdc9('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 1fd3cdf..d5dbd06 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 _0x55ea=['Tags','UserProfileResource','error','name','index','Tag','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','filter','merge','map','options','include','findAll','rows','catch','params','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','destroy','then','get'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x55ea,0xc9));var _0xa55e=function(_0x45893d,_0x85ca8b){_0x45893d=_0x45893d-0x0;var _0x2a46e1=_0x55ea[_0x45893d];return _0x2a46e1;};'use strict';var emlformat=require(_0xa55e('0x0'));var rimraf=require(_0xa55e('0x1'));var zipdir=require(_0xa55e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa55e('0x3'));var moment=require(_0xa55e('0x4'));var BPromise=require(_0xa55e('0x5'));var Mustache=require(_0xa55e('0x6'));var util=require(_0xa55e('0x7'));var path=require('path');var sox=require(_0xa55e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa55e('0x9'));var crypto=require(_0xa55e('0xa'));var jsforce=require(_0xa55e('0xb'));var deskjs=require(_0xa55e('0xc'));var toCsv=require(_0xa55e('0xd'));var querystring=require(_0xa55e('0xe'));var Papa=require(_0xa55e('0xf'));var Redis=require(_0xa55e('0x10'));var authService=require(_0xa55e('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa55e('0x12'));var logger=require(_0xa55e('0x13'))(_0xa55e('0x14'));var utils=require(_0xa55e('0x15'));var config=require(_0xa55e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa55e('0x17'))['db'];function respondWithStatusCode(_0x5b69cc,_0x3f5178){_0x3f5178=_0x3f5178||0xcc;return function(_0x1d45c1){if(_0x1d45c1){return _0x5b69cc[_0xa55e('0x18')](_0x3f5178);}return _0x5b69cc[_0xa55e('0x19')](_0x3f5178)[_0xa55e('0x1a')]();};}function respondWithResult(_0x20e138,_0x15a283){_0x15a283=_0x15a283||0xc8;return function(_0x27746c){if(_0x27746c){return _0x20e138[_0xa55e('0x19')](_0x15a283)['json'](_0x27746c);}};}function respondWithFilteredResult(_0x1fcee6,_0x30738d){return function(_0x25fa30){if(_0x25fa30){var _0x12895e=typeof _0x30738d[_0xa55e('0x1b')]===_0xa55e('0x1c')&&typeof _0x30738d['limit']===_0xa55e('0x1c');var _0x5dbfe6=_0x25fa30['count'];var _0x4599b9=_0x12895e?0x0:_0x30738d[_0xa55e('0x1b')];var _0x30854e=_0x12895e?_0x25fa30[_0xa55e('0x1d')]:_0x30738d[_0xa55e('0x1b')]+_0x30738d['limit'];var _0x42d2d0;if(_0x30854e>=_0x5dbfe6){_0x30854e=_0x5dbfe6;_0x42d2d0=0xc8;}else{_0x42d2d0=0xce;}_0x1fcee6['status'](_0x42d2d0);return _0x1fcee6['set'](_0xa55e('0x1e'),_0x4599b9+'-'+_0x30854e+'/'+_0x5dbfe6)[_0xa55e('0x1f')](_0x25fa30);}return null;};}function patchUpdates(_0x262f6c){return function(_0x1033c0){try{jsonpatch[_0xa55e('0x20')](_0x1033c0,_0x262f6c,!![]);}catch(_0x438707){return BPromise[_0xa55e('0x21')](_0x438707);}return _0x1033c0[_0xa55e('0x22')]();};}function saveUpdates(_0x9594a3,_0x5b0e74){return function(_0x53a2f9){if(_0x53a2f9){return _0x53a2f9[_0xa55e('0x23')](_0x9594a3)['then'](function(_0xaaf2f1){return _0xaaf2f1;});}return null;};}function removeEntity(_0x31c4ac,_0x801fec){return function(_0x2842a6){if(_0x2842a6){return _0x2842a6[_0xa55e('0x24')]()[_0xa55e('0x25')](function(){var _0x129762=_0x2842a6[_0xa55e('0x26')]({'plain':!![]});var _0x231333=_0xa55e('0x27');return db[_0xa55e('0x28')][_0xa55e('0x24')]({'where':{'type':_0x231333,'resourceId':_0x129762['id']}})[_0xa55e('0x25')](function(){return _0x2842a6;});})[_0xa55e('0x25')](function(){_0x31c4ac[_0xa55e('0x19')](0xcc)[_0xa55e('0x1a')]();});}};}function handleEntityNotFound(_0x2f2579,_0xa1917c){return function(_0x875010){if(!_0x875010){_0x2f2579['sendStatus'](0x194);}return _0x875010;};}function handleError(_0x5c218d,_0x164b55){_0x164b55=_0x164b55||0x1f4;return function(_0x4ebcbd){logger[_0xa55e('0x29')](_0x4ebcbd['stack']);if(_0x4ebcbd[_0xa55e('0x2a')]){delete _0x4ebcbd['name'];}_0x5c218d[_0xa55e('0x19')](_0x164b55)['send'](_0x4ebcbd);};}exports[_0xa55e('0x2b')]=function(_0x71bb8b,_0x4a03ef){var _0x2cdd6c={},_0x242c47={},_0x3569ff={'count':0x0,'rows':[]};var _0x378121=_['map'](db[_0xa55e('0x2c')][_0xa55e('0x2d')],function(_0x5b79d6){return{'name':_0x5b79d6[_0xa55e('0x2e')],'type':_0x5b79d6[_0xa55e('0x2f')][_0xa55e('0x30')]};});_0x242c47[_0xa55e('0x31')]=_['map'](_0x378121,_0xa55e('0x2a'));_0x242c47['query']=_[_0xa55e('0x32')](_0x71bb8b['query']);_0x242c47[_0xa55e('0x33')]=_[_0xa55e('0x34')](_0x242c47[_0xa55e('0x31')],_0x242c47[_0xa55e('0x35')]);_0x2cdd6c['attributes']=_[_0xa55e('0x34')](_0x242c47['model'],qs[_0xa55e('0x36')](_0x71bb8b[_0xa55e('0x35')][_0xa55e('0x36')]));_0x2cdd6c['attributes']=_0x2cdd6c[_0xa55e('0x37')][_0xa55e('0x38')]?_0x2cdd6c[_0xa55e('0x37')]:_0x242c47[_0xa55e('0x31')];if(!_0x71bb8b[_0xa55e('0x35')][_0xa55e('0x39')]('nolimit')){_0x2cdd6c['limit']=qs[_0xa55e('0x3a')](_0x71bb8b[_0xa55e('0x35')][_0xa55e('0x3a')]);_0x2cdd6c[_0xa55e('0x1b')]=qs[_0xa55e('0x1b')](_0x71bb8b[_0xa55e('0x35')][_0xa55e('0x1b')]);}_0x2cdd6c['order']=qs['sort'](_0x71bb8b[_0xa55e('0x35')][_0xa55e('0x3b')]);_0x2cdd6c[_0xa55e('0x3c')]=qs[_0xa55e('0x33')](_[_0xa55e('0x3d')](_0x71bb8b[_0xa55e('0x35')],_0x242c47[_0xa55e('0x33')]),_0x378121);if(_0x71bb8b[_0xa55e('0x35')][_0xa55e('0x3e')]){_0x2cdd6c[_0xa55e('0x3c')]=_[_0xa55e('0x3f')](_0x2cdd6c['where'],{'$or':_[_0xa55e('0x40')](_0x378121,function(_0x3258f3){if(_0x3258f3[_0xa55e('0x2f')]!=='VIRTUAL'){var _0x1e806a={};_0x1e806a[_0x3258f3['name']]={'$like':'%'+_0x71bb8b[_0xa55e('0x35')][_0xa55e('0x3e')]+'%'};return _0x1e806a;}})});}_0x2cdd6c=_[_0xa55e('0x3f')]({},_0x2cdd6c,_0x71bb8b[_0xa55e('0x41')]);var _0x232d5e={'where':_0x2cdd6c[_0xa55e('0x3c')]};return db[_0xa55e('0x2c')]['count'](_0x232d5e)['then'](function(_0x3d9fe9){_0x3569ff[_0xa55e('0x1d')]=_0x3d9fe9;if(_0x71bb8b[_0xa55e('0x35')]['includeAll']){_0x2cdd6c[_0xa55e('0x42')]=[{'all':!![]}];}return db[_0xa55e('0x2c')][_0xa55e('0x43')](_0x2cdd6c);})[_0xa55e('0x25')](function(_0x43c887){_0x3569ff[_0xa55e('0x44')]=_0x43c887;return _0x3569ff;})[_0xa55e('0x25')](respondWithFilteredResult(_0x4a03ef,_0x2cdd6c))[_0xa55e('0x45')](handleError(_0x4a03ef,null));};exports['show']=function(_0x4bd20d,_0x34e7ba){var _0x240bfa={'raw':!![],'where':{'id':_0x4bd20d[_0xa55e('0x46')]['id']}},_0x186dc2={};_0x186dc2[_0xa55e('0x31')]=_[_0xa55e('0x32')](db[_0xa55e('0x2c')][_0xa55e('0x2d')]);_0x186dc2['query']=_['keys'](_0x4bd20d[_0xa55e('0x35')]);_0x186dc2['filters']=_[_0xa55e('0x34')](_0x186dc2['model'],_0x186dc2['query']);_0x240bfa[_0xa55e('0x37')]=_[_0xa55e('0x34')](_0x186dc2['model'],qs['fields'](_0x4bd20d[_0xa55e('0x35')][_0xa55e('0x36')]));_0x240bfa[_0xa55e('0x37')]=_0x240bfa[_0xa55e('0x37')][_0xa55e('0x38')]?_0x240bfa[_0xa55e('0x37')]:_0x186dc2['model'];if(_0x4bd20d['query'][_0xa55e('0x47')]){_0x240bfa[_0xa55e('0x42')]=[{'all':!![]}];}_0x240bfa=_[_0xa55e('0x3f')]({},_0x240bfa,_0x4bd20d[_0xa55e('0x41')]);return db[_0xa55e('0x2c')][_0xa55e('0x48')](_0x240bfa)['then'](handleEntityNotFound(_0x34e7ba,null))[_0xa55e('0x25')](respondWithResult(_0x34e7ba,null))[_0xa55e('0x45')](handleError(_0x34e7ba,null));};exports[_0xa55e('0x49')]=function(_0x1de3a8,_0x338018){return db[_0xa55e('0x2c')]['create'](_0x1de3a8['body'],{})[_0xa55e('0x25')](function(_0x52f526){var _0x2f51d9=_0x1de3a8['user'][_0xa55e('0x26')]({'plain':!![]});if(!_0x2f51d9)throw new Error(_0xa55e('0x4a'));if(_0x2f51d9[_0xa55e('0x4b')]===_0xa55e('0x4c')){var _0x2c35a8=_0x52f526[_0xa55e('0x26')]({'plain':!![]});var _0x1a1053=_0xa55e('0x27');return db['UserProfileSection'][_0xa55e('0x48')]({'where':{'name':_0x1a1053,'userProfileId':_0x2f51d9[_0xa55e('0x4d')]},'raw':!![]})[_0xa55e('0x25')](function(_0x385ce1){if(_0x385ce1&&_0x385ce1[_0xa55e('0x4e')]===0x0){return db[_0xa55e('0x28')]['create']({'name':_0x2c35a8[_0xa55e('0x2a')],'resourceId':_0x2c35a8['id'],'type':_0x385ce1[_0xa55e('0x2a')],'sectionId':_0x385ce1['id']},{})[_0xa55e('0x25')](function(){return _0x52f526;});}else{return _0x52f526;}})[_0xa55e('0x45')](function(_0x4559c8){logger[_0xa55e('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4559c8);throw _0x4559c8;});}return _0x52f526;})[_0xa55e('0x25')](respondWithResult(_0x338018,0xc9))['catch'](handleError(_0x338018,null));};exports[_0xa55e('0x23')]=function(_0x17b18b,_0x8dc49d){if(_0x17b18b[_0xa55e('0x4f')]['id']){delete _0x17b18b[_0xa55e('0x4f')]['id'];}return db[_0xa55e('0x2c')]['find']({'where':{'id':_0x17b18b[_0xa55e('0x46')]['id']}})['then'](handleEntityNotFound(_0x8dc49d,null))[_0xa55e('0x25')](saveUpdates(_0x17b18b[_0xa55e('0x4f')],null))['then'](respondWithResult(_0x8dc49d,null))[_0xa55e('0x45')](handleError(_0x8dc49d,null));};exports[_0xa55e('0x24')]=function(_0x2c8bd5,_0x1f03a8){return db[_0xa55e('0x2c')][_0xa55e('0x48')]({'where':{'id':_0x2c8bd5[_0xa55e('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f03a8,null))[_0xa55e('0x25')](removeEntity(_0x1f03a8,null))[_0xa55e('0x45')](handleError(_0x1f03a8,null));}; \ No newline at end of file +var _0x1be1=['bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Tags','destroy','sendStatus','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','include','findAll','rows','show','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','zip-dir','fast-json-patch','moment'];(function(_0x15016d,_0x6e660){var _0x4e7d07=function(_0xda497d){while(--_0xda497d){_0x15016d['push'](_0x15016d['shift']());}};_0x4e7d07(++_0x6e660);}(_0x1be1,0x192));var _0x11be=function(_0x3ad9bc,_0x5bad38){_0x3ad9bc=_0x3ad9bc-0x0;var _0x2019fb=_0x1be1[_0x3ad9bc];return _0x2019fb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x11be('0x0'));var jsonpatch=require(_0x11be('0x1'));var rp=require('request-promise');var moment=require(_0x11be('0x2'));var BPromise=require(_0x11be('0x3'));var Mustache=require(_0x11be('0x4'));var util=require(_0x11be('0x5'));var path=require('path');var sox=require(_0x11be('0x6'));var csv=require(_0x11be('0x7'));var ejs=require(_0x11be('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11be('0x9'));var squel=require('squel');var crypto=require(_0x11be('0xa'));var jsforce=require(_0x11be('0xb'));var deskjs=require(_0x11be('0xc'));var toCsv=require(_0x11be('0x7'));var querystring=require(_0x11be('0xd'));var Papa=require('papaparse');var Redis=require(_0x11be('0xe'));var authService=require(_0x11be('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x11be('0x10'));var hardwareService=require(_0x11be('0x11'));var logger=require(_0x11be('0x12'))(_0x11be('0x13'));var utils=require('../../config/utils');var config=require(_0x11be('0x14'));var licenseUtil=require(_0x11be('0x15'));var db=require(_0x11be('0x16'))['db'];function respondWithStatusCode(_0x4b36c8,_0x3ff31f){_0x3ff31f=_0x3ff31f||0xcc;return function(_0x2dad05){if(_0x2dad05){return _0x4b36c8['sendStatus'](_0x3ff31f);}return _0x4b36c8[_0x11be('0x17')](_0x3ff31f)['end']();};}function respondWithResult(_0x49228e,_0x569842){_0x569842=_0x569842||0xc8;return function(_0x4b6e7e){if(_0x4b6e7e){return _0x49228e['status'](_0x569842)['json'](_0x4b6e7e);}};}function respondWithFilteredResult(_0x588871,_0x2280e2){return function(_0x52bbef){if(_0x52bbef){var _0x31047c=typeof _0x2280e2[_0x11be('0x18')]===_0x11be('0x19')&&typeof _0x2280e2[_0x11be('0x1a')]==='undefined';var _0x2ed725=_0x52bbef[_0x11be('0x1b')];var _0x56ab61=_0x31047c?0x0:_0x2280e2[_0x11be('0x18')];var _0xc3263c=_0x31047c?_0x52bbef[_0x11be('0x1b')]:_0x2280e2['offset']+_0x2280e2['limit'];var _0x141391;if(_0xc3263c>=_0x2ed725){_0xc3263c=_0x2ed725;_0x141391=0xc8;}else{_0x141391=0xce;}_0x588871[_0x11be('0x17')](_0x141391);return _0x588871[_0x11be('0x1c')](_0x11be('0x1d'),_0x56ab61+'-'+_0xc3263c+'/'+_0x2ed725)['json'](_0x52bbef);}return null;};}function patchUpdates(_0x12a5bd){return function(_0x45136f){try{jsonpatch[_0x11be('0x1e')](_0x45136f,_0x12a5bd,!![]);}catch(_0x452315){return BPromise[_0x11be('0x1f')](_0x452315);}return _0x45136f[_0x11be('0x20')]();};}function saveUpdates(_0xa944ac,_0x17678d){return function(_0x3aea14){if(_0x3aea14){return _0x3aea14[_0x11be('0x21')](_0xa944ac)['then'](function(_0xfe3737){return _0xfe3737;});}return null;};}function removeEntity(_0x46b7c2,_0x2fe43c){return function(_0x5d1690){if(_0x5d1690){return _0x5d1690['destroy']()[_0x11be('0x22')](function(){var _0x10ce04=_0x5d1690[_0x11be('0x23')]({'plain':!![]});var _0x4cb27f=_0x11be('0x24');return db['UserProfileResource'][_0x11be('0x25')]({'where':{'type':_0x4cb27f,'resourceId':_0x10ce04['id']}})['then'](function(){return _0x5d1690;});})[_0x11be('0x22')](function(){_0x46b7c2[_0x11be('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48029b,_0x28b3a0){return function(_0x1d3b5c){if(!_0x1d3b5c){_0x48029b[_0x11be('0x26')](0x194);}return _0x1d3b5c;};}function handleError(_0x30427b,_0x17c67f){_0x17c67f=_0x17c67f||0x1f4;return function(_0xf5a6ac){logger[_0x11be('0x27')](_0xf5a6ac[_0x11be('0x28')]);if(_0xf5a6ac['name']){delete _0xf5a6ac[_0x11be('0x29')];}_0x30427b['status'](_0x17c67f)[_0x11be('0x2a')](_0xf5a6ac);};}exports[_0x11be('0x2b')]=function(_0x510476,_0x584d4c){var _0x49fd5c={},_0x265fc9={},_0x5e8f9a={'count':0x0,'rows':[]};var _0x66316d=_[_0x11be('0x2c')](db[_0x11be('0x2d')][_0x11be('0x2e')],function(_0x25e214){return{'name':_0x25e214[_0x11be('0x2f')],'type':_0x25e214['type'][_0x11be('0x30')]};});_0x265fc9[_0x11be('0x31')]=_[_0x11be('0x2c')](_0x66316d,_0x11be('0x29'));_0x265fc9[_0x11be('0x32')]=_[_0x11be('0x33')](_0x510476['query']);_0x265fc9[_0x11be('0x34')]=_[_0x11be('0x35')](_0x265fc9[_0x11be('0x31')],_0x265fc9[_0x11be('0x32')]);_0x49fd5c[_0x11be('0x36')]=_['intersection'](_0x265fc9[_0x11be('0x31')],qs[_0x11be('0x37')](_0x510476[_0x11be('0x32')]['fields']));_0x49fd5c[_0x11be('0x36')]=_0x49fd5c['attributes']['length']?_0x49fd5c['attributes']:_0x265fc9['model'];if(!_0x510476[_0x11be('0x32')][_0x11be('0x38')](_0x11be('0x39'))){_0x49fd5c['limit']=qs[_0x11be('0x1a')](_0x510476[_0x11be('0x32')]['limit']);_0x49fd5c[_0x11be('0x18')]=qs['offset'](_0x510476[_0x11be('0x32')]['offset']);}_0x49fd5c[_0x11be('0x3a')]=qs[_0x11be('0x3b')](_0x510476[_0x11be('0x32')][_0x11be('0x3b')]);_0x49fd5c['where']=qs[_0x11be('0x34')](_[_0x11be('0x3c')](_0x510476[_0x11be('0x32')],_0x265fc9[_0x11be('0x34')]),_0x66316d);if(_0x510476['query'][_0x11be('0x3d')]){_0x49fd5c[_0x11be('0x3e')]=_[_0x11be('0x3f')](_0x49fd5c[_0x11be('0x3e')],{'$or':_[_0x11be('0x2c')](_0x66316d,function(_0x1b1aac){if(_0x1b1aac[_0x11be('0x40')]!=='VIRTUAL'){var _0x2618f5={};_0x2618f5[_0x1b1aac[_0x11be('0x29')]]={'$like':'%'+_0x510476['query'][_0x11be('0x3d')]+'%'};return _0x2618f5;}})});}_0x49fd5c=_[_0x11be('0x3f')]({},_0x49fd5c,_0x510476['options']);var _0x30b67a={'where':_0x49fd5c['where']};return db[_0x11be('0x2d')]['count'](_0x30b67a)[_0x11be('0x22')](function(_0x30be21){_0x5e8f9a['count']=_0x30be21;if(_0x510476[_0x11be('0x32')]['includeAll']){_0x49fd5c[_0x11be('0x41')]=[{'all':!![]}];}return db[_0x11be('0x2d')][_0x11be('0x42')](_0x49fd5c);})[_0x11be('0x22')](function(_0x2b847a){_0x5e8f9a[_0x11be('0x43')]=_0x2b847a;return _0x5e8f9a;})[_0x11be('0x22')](respondWithFilteredResult(_0x584d4c,_0x49fd5c))['catch'](handleError(_0x584d4c,null));};exports[_0x11be('0x44')]=function(_0x18cddf,_0x9610a1){var _0x317e2d={'raw':!![],'where':{'id':_0x18cddf['params']['id']}},_0x589ac4={};_0x589ac4['model']=_[_0x11be('0x33')](db['Tag'][_0x11be('0x2e')]);_0x589ac4['query']=_[_0x11be('0x33')](_0x18cddf[_0x11be('0x32')]);_0x589ac4[_0x11be('0x34')]=_[_0x11be('0x35')](_0x589ac4[_0x11be('0x31')],_0x589ac4[_0x11be('0x32')]);_0x317e2d[_0x11be('0x36')]=_['intersection'](_0x589ac4[_0x11be('0x31')],qs['fields'](_0x18cddf[_0x11be('0x32')][_0x11be('0x37')]));_0x317e2d[_0x11be('0x36')]=_0x317e2d['attributes']['length']?_0x317e2d['attributes']:_0x589ac4[_0x11be('0x31')];if(_0x18cddf[_0x11be('0x32')]['includeAll']){_0x317e2d['include']=[{'all':!![]}];}_0x317e2d=_['merge']({},_0x317e2d,_0x18cddf[_0x11be('0x45')]);return db[_0x11be('0x2d')][_0x11be('0x46')](_0x317e2d)[_0x11be('0x22')](handleEntityNotFound(_0x9610a1,null))[_0x11be('0x22')](respondWithResult(_0x9610a1,null))[_0x11be('0x47')](handleError(_0x9610a1,null));};exports[_0x11be('0x48')]=function(_0x3f2070,_0x2ce110){return db[_0x11be('0x2d')][_0x11be('0x48')](_0x3f2070['body'],{})[_0x11be('0x22')](function(_0x29f82f){var _0x534ee7=_0x3f2070['user']['get']({'plain':!![]});if(!_0x534ee7)throw new Error(_0x11be('0x49'));if(_0x534ee7['role']===_0x11be('0x4a')){var _0x1c1626=_0x29f82f[_0x11be('0x23')]({'plain':!![]});var _0x1fb48d=_0x11be('0x24');return db[_0x11be('0x4b')][_0x11be('0x46')]({'where':{'name':_0x1fb48d,'userProfileId':_0x534ee7[_0x11be('0x4c')]},'raw':!![]})[_0x11be('0x22')](function(_0x4c873a){if(_0x4c873a&&_0x4c873a[_0x11be('0x4d')]===0x0){return db['UserProfileResource'][_0x11be('0x48')]({'name':_0x1c1626[_0x11be('0x29')],'resourceId':_0x1c1626['id'],'type':_0x4c873a['name'],'sectionId':_0x4c873a['id']},{})[_0x11be('0x22')](function(){return _0x29f82f;});}else{return _0x29f82f;}})[_0x11be('0x47')](function(_0x4c0e37){logger[_0x11be('0x27')](_0x11be('0x4e'),_0x4c0e37);throw _0x4c0e37;});}return _0x29f82f;})['then'](respondWithResult(_0x2ce110,0xc9))['catch'](handleError(_0x2ce110,null));};exports[_0x11be('0x21')]=function(_0x2886ac,_0x50eeab){if(_0x2886ac['body']['id']){delete _0x2886ac[_0x11be('0x4f')]['id'];}return db[_0x11be('0x2d')][_0x11be('0x46')]({'where':{'id':_0x2886ac['params']['id']}})['then'](handleEntityNotFound(_0x50eeab,null))['then'](saveUpdates(_0x2886ac[_0x11be('0x4f')],null))[_0x11be('0x22')](respondWithResult(_0x50eeab,null))[_0x11be('0x47')](handleError(_0x50eeab,null));};exports['destroy']=function(_0x4db963,_0x33409c){return db[_0x11be('0x2d')][_0x11be('0x46')]({'where':{'id':_0x4db963[_0x11be('0x50')]['id']}})['then'](handleEntityNotFound(_0x33409c,null))[_0x11be('0x22')](removeEntity(_0x33409c,null))['catch'](handleError(_0x33409c,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 4c80d27..87808c4 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 _0x5d01=['api','bluebird','request-promise','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','../../config/logger'];(function(_0x2d4843,_0x2b5859){var _0x486c34=function(_0x35dcd6){while(--_0x35dcd6){_0x2d4843['push'](_0x2d4843['shift']());}};_0x486c34(++_0x2b5859);}(_0x5d01,0xe5));var _0x15d0=function(_0x4ed06c,_0x57c579){_0x4ed06c=_0x4ed06c-0x0;var _0x8d80b0=_0x5d01[_0x4ed06c];return _0x8d80b0;};'use strict';var _=require(_0x15d0('0x0'));var util=require('util');var logger=require(_0x15d0('0x1'))(_0x15d0('0x2'));var moment=require('moment');var BPromise=require(_0x15d0('0x3'));var rp=require(_0x15d0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x15d0('0x5'));var attributes=require(_0x15d0('0x6'));module[_0x15d0('0x7')]=function(_0x1b0e27,_0x2af55d){return _0x1b0e27[_0x15d0('0x8')](_0x15d0('0x9'),attributes,{'tableName':_0x15d0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x465a=['Tag','tools_tags','util','api','moment','bluebird','request-promise','../../config/environment','./tag.attributes','exports'];(function(_0x10f043,_0x54c9ef){var _0x2d2d48=function(_0x1372ad){while(--_0x1372ad){_0x10f043['push'](_0x10f043['shift']());}};_0x2d2d48(++_0x54c9ef);}(_0x465a,0x1d8));var _0xa465=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x465a[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xa465('0x0'));var logger=require('../../config/logger')(_0xa465('0x1'));var moment=require(_0xa465('0x2'));var BPromise=require(_0xa465('0x3'));var rp=require(_0xa465('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa465('0x5'));var attributes=require(_0xa465('0x6'));module[_0xa465('0x7')]=function(_0x172043,_0x616511){return _0x172043['define'](_0xa465('0x8'),attributes,{'tableName':_0xa465('0x9'),'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 0f15e83..f680553 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 _0xac55=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x16ae34,_0x1dc6d){var _0x184836=function(_0x1e48b7){while(--_0x1e48b7){_0x16ae34['push'](_0x16ae34['shift']());}};_0x184836(++_0x1dc6d);}(_0xac55,0x1c8));var _0x5ac5=function(_0x45b9e6,_0x6d0f88){_0x45b9e6=_0x45b9e6-0x0;var _0x19bbb9=_0xac55[_0x45b9e6];return _0x19bbb9;};'use strict';var _=require(_0x5ac5('0x0'));var util=require(_0x5ac5('0x1'));var moment=require(_0x5ac5('0x2'));var BPromise=require(_0x5ac5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ac5('0x4'));var db=require(_0x5ac5('0x5'))['db'];var utils=require(_0x5ac5('0x6'));var logger=require(_0x5ac5('0x7'))(_0x5ac5('0x8'));var config=require(_0x5ac5('0x9'));var jayson=require(_0x5ac5('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34093b,_0x247752,_0x2bee03){return new BPromise(function(_0x42551a,_0x455a94){return client[_0x5ac5('0xb')](_0x34093b,_0x2bee03)[_0x5ac5('0xc')](function(_0x5b84a3){logger['info'](_0x5ac5('0xd'),_0x247752,_0x5ac5('0xe'));logger['debug'](_0x5ac5('0xf'),_0x247752,_0x5ac5('0xe'),JSON['stringify'](_0x5b84a3));if(_0x5b84a3[_0x5ac5('0x10')]){if(_0x5b84a3[_0x5ac5('0x10')]['code']===0x1f4){logger[_0x5ac5('0x10')](_0x5ac5('0xd'),_0x247752,_0x5b84a3[_0x5ac5('0x10')][_0x5ac5('0x11')]);return _0x455a94(_0x5b84a3[_0x5ac5('0x10')]['message']);}logger[_0x5ac5('0x10')]('Tag,\x20%s,\x20%s',_0x247752,_0x5b84a3[_0x5ac5('0x10')][_0x5ac5('0x11')]);return _0x42551a(_0x5b84a3['error'][_0x5ac5('0x11')]);}else{logger['info'](_0x5ac5('0xd'),_0x247752,_0x5ac5('0xe'));_0x42551a(_0x5b84a3[_0x5ac5('0x12')][_0x5ac5('0x11')]);}})[_0x5ac5('0x13')](function(_0x3e35e9){logger[_0x5ac5('0x10')]('Tag,\x20%s,\x20%s',_0x247752,_0x3e35e9);_0x455a94(_0x3e35e9);});});} \ No newline at end of file +var _0x1306=['client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x24b6b4,_0x47fca9){var _0x4e1d60=function(_0x45d611){while(--_0x45d611){_0x24b6b4['push'](_0x24b6b4['shift']());}};_0x4e1d60(++_0x47fca9);}(_0x1306,0x17a));var _0x6130=function(_0x69b210,_0x6f0db5){_0x69b210=_0x69b210-0x0;var _0x49bb31=_0x1306[_0x69b210];return _0x49bb31;};'use strict';var _=require(_0x6130('0x0'));var util=require(_0x6130('0x1'));var moment=require(_0x6130('0x2'));var BPromise=require(_0x6130('0x3'));var rs=require(_0x6130('0x4'));var fs=require('fs');var Redis=require(_0x6130('0x5'));var db=require(_0x6130('0x6'))['db'];var utils=require(_0x6130('0x7'));var logger=require(_0x6130('0x8'))(_0x6130('0x9'));var config=require(_0x6130('0xa'));var jayson=require(_0x6130('0xb'));var client=jayson[_0x6130('0xc')][_0x6130('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1db089,_0x25469a,_0x354501){return new BPromise(function(_0x288b1d,_0x13163f){return client[_0x6130('0xe')](_0x1db089,_0x354501)[_0x6130('0xf')](function(_0x33b116){logger[_0x6130('0x10')](_0x6130('0x11'),_0x25469a,_0x6130('0x12'));logger[_0x6130('0x13')](_0x6130('0x14'),_0x25469a,_0x6130('0x12'),JSON[_0x6130('0x15')](_0x33b116));if(_0x33b116['error']){if(_0x33b116[_0x6130('0x16')]['code']===0x1f4){logger[_0x6130('0x16')](_0x6130('0x11'),_0x25469a,_0x33b116['error'][_0x6130('0x17')]);return _0x13163f(_0x33b116[_0x6130('0x16')][_0x6130('0x17')]);}logger[_0x6130('0x16')](_0x6130('0x11'),_0x25469a,_0x33b116[_0x6130('0x16')][_0x6130('0x17')]);return _0x288b1d(_0x33b116[_0x6130('0x16')][_0x6130('0x17')]);}else{logger[_0x6130('0x10')](_0x6130('0x11'),_0x25469a,_0x6130('0x12'));_0x288b1d(_0x33b116[_0x6130('0x18')][_0x6130('0x17')]);}})[_0x6130('0x19')](function(_0x46c2e3){logger['error']('Tag,\x20%s,\x20%s',_0x25469a,_0x46c2e3);_0x13163f(_0x46c2e3);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index b8ba44f..f5087a7 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 6c46909..3623786 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 _0xe706=['STRING','sequelize','exports'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xe706,0xa3));var _0x6e70=function(_0x261153,_0x174df0){_0x261153=_0x261153-0x0;var _0x5402f9=_0xe706[_0x261153];return _0x5402f9;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0xd14a5f,_0x1749af){var _0x2ecb2c=function(_0x4d6f77){while(--_0x4d6f77){_0xd14a5f['push'](_0xd14a5f['shift']());}};_0x2ecb2c(++_0x1749af);}(_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 diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index b748d85..841b446 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 _0x7fb7=['Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','getQueues','findOne','isValidChannel','channel','ValidationError','Unknown\x20channel','Queue','pick','capitalize','toLowerCase','Queues','removeQueues','remove','ids','addAgents','isArray','Voice','Chat','Sms','Openchannel','Whatsapp','transaction','penalty','QueueId','TeamVoiceQueue','User','emit','findAll','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','all','VoicePrefixId','Mail','Queue:remove','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./team.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','update','stack','name','send','map','Team','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','then','include','rows','show','params','rawAttributes','keys','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'];(function(_0x20a7a8,_0x358588){var _0xb10eee=function(_0x8bf4bf){while(--_0x8bf4bf){_0x20a7a8['push'](_0x20a7a8['shift']());}};_0xb10eee(++_0x358588);}(_0x7fb7,0xd8));var _0x77fb=function(_0x5b3b9b,_0x1c71b0){_0x5b3b9b=_0x5b3b9b-0x0;var _0x47c1d7=_0x7fb7[_0x5b3b9b];return _0x47c1d7;};'use strict';var emlformat=require(_0x77fb('0x0'));var rimraf=require(_0x77fb('0x1'));var zipdir=require(_0x77fb('0x2'));var jsonpatch=require(_0x77fb('0x3'));var rp=require(_0x77fb('0x4'));var moment=require(_0x77fb('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x77fb('0x6'));var path=require(_0x77fb('0x7'));var sox=require(_0x77fb('0x8'));var csv=require(_0x77fb('0x9'));var ejs=require(_0x77fb('0xa'));var fs=require('fs');var fs_extra=require(_0x77fb('0xb'));var _=require(_0x77fb('0xc'));var squel=require('squel');var crypto=require(_0x77fb('0xd'));var jsforce=require(_0x77fb('0xe'));var deskjs=require(_0x77fb('0xf'));var toCsv=require(_0x77fb('0x9'));var querystring=require(_0x77fb('0x10'));var Papa=require(_0x77fb('0x11'));var Redis=require(_0x77fb('0x12'));var authService=require(_0x77fb('0x13'));var qs=require(_0x77fb('0x14'));var as=require(_0x77fb('0x15'));var hardwareService=require(_0x77fb('0x16'));var logger=require('../../config/logger')(_0x77fb('0x17'));var utils=require(_0x77fb('0x18'));var config=require(_0x77fb('0x19'));var licenseUtil=require(_0x77fb('0x1a'));var db=require(_0x77fb('0x1b'))['db'];config[_0x77fb('0x1c')]=_[_0x77fb('0x1d')](config[_0x77fb('0x1c')],{'host':_0x77fb('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x77fb('0x1c')]));require(_0x77fb('0x1f'))[_0x77fb('0x20')](socket);function respondWithStatusCode(_0x45bbb1,_0x15db24){_0x15db24=_0x15db24||0xcc;return function(_0x36813f){if(_0x36813f){return _0x45bbb1[_0x77fb('0x21')](_0x15db24);}return _0x45bbb1[_0x77fb('0x22')](_0x15db24)[_0x77fb('0x23')]();};}function respondWithResult(_0x299670,_0x93cb){_0x93cb=_0x93cb||0xc8;return function(_0x1aa46d){if(_0x1aa46d){return _0x299670[_0x77fb('0x22')](_0x93cb)[_0x77fb('0x24')](_0x1aa46d);}};}function respondWithFilteredResult(_0x29eb5d,_0x20b3b2){return function(_0x53f8af){if(_0x53f8af){var _0x2a8794=typeof _0x20b3b2[_0x77fb('0x25')]===_0x77fb('0x26')&&typeof _0x20b3b2['limit']===_0x77fb('0x26');var _0x41f866=_0x53f8af['count'];var _0x38fa15=_0x2a8794?0x0:_0x20b3b2[_0x77fb('0x25')];var _0x55e2a6=_0x2a8794?_0x53f8af[_0x77fb('0x27')]:_0x20b3b2[_0x77fb('0x25')]+_0x20b3b2[_0x77fb('0x28')];var _0x2980f1;if(_0x55e2a6>=_0x41f866){_0x55e2a6=_0x41f866;_0x2980f1=0xc8;}else{_0x2980f1=0xce;}_0x29eb5d[_0x77fb('0x22')](_0x2980f1);return _0x29eb5d['set'](_0x77fb('0x29'),_0x38fa15+'-'+_0x55e2a6+'/'+_0x41f866)[_0x77fb('0x24')](_0x53f8af);}return null;};}function patchUpdates(_0x190ea2){return function(_0x2760d1){try{jsonpatch['apply'](_0x2760d1,_0x190ea2,!![]);}catch(_0x126525){return BPromise['reject'](_0x126525);}return _0x2760d1['save']();};}function saveUpdates(_0x4a2852,_0x20d1ad){return function(_0x3dde84){if(_0x3dde84){return _0x3dde84[_0x77fb('0x2a')](_0x4a2852)['then'](function(_0x129722){return _0x129722;});}return null;};}function handleEntityNotFound(_0x3f7333,_0x2922a8){return function(_0x101dea){if(!_0x101dea){_0x3f7333[_0x77fb('0x21')](0x194);}return _0x101dea;};}function handleError(_0x22e163,_0xc55cc4){_0xc55cc4=_0xc55cc4||0x1f4;return function(_0x1d912f){logger['error'](_0x1d912f[_0x77fb('0x2b')]);if(_0x1d912f[_0x77fb('0x2c')]){delete _0x1d912f['name'];}_0x22e163[_0x77fb('0x22')](_0xc55cc4)[_0x77fb('0x2d')](_0x1d912f);};}exports['index']=function(_0x3528b0,_0x1087d5){var _0x3c5812={},_0x3bdce7={},_0x4c99fa={'count':0x0,'rows':[]};var _0x110d65=_[_0x77fb('0x2e')](db[_0x77fb('0x2f')]['rawAttributes'],function(_0xa4f6a0){return{'name':_0xa4f6a0[_0x77fb('0x30')],'type':_0xa4f6a0[_0x77fb('0x31')][_0x77fb('0x32')]};});_0x3bdce7[_0x77fb('0x33')]=_[_0x77fb('0x2e')](_0x110d65,'name');_0x3bdce7[_0x77fb('0x34')]=_['keys'](_0x3528b0[_0x77fb('0x34')]);_0x3bdce7[_0x77fb('0x35')]=_[_0x77fb('0x36')](_0x3bdce7[_0x77fb('0x33')],_0x3bdce7[_0x77fb('0x34')]);_0x3c5812[_0x77fb('0x37')]=_[_0x77fb('0x36')](_0x3bdce7[_0x77fb('0x33')],qs[_0x77fb('0x38')](_0x3528b0[_0x77fb('0x34')][_0x77fb('0x38')]));_0x3c5812[_0x77fb('0x37')]=_0x3c5812[_0x77fb('0x37')][_0x77fb('0x39')]?_0x3c5812[_0x77fb('0x37')]:_0x3bdce7[_0x77fb('0x33')];if(!_0x3528b0[_0x77fb('0x34')][_0x77fb('0x3a')](_0x77fb('0x3b'))){_0x3c5812['limit']=qs[_0x77fb('0x28')](_0x3528b0[_0x77fb('0x34')]['limit']);_0x3c5812[_0x77fb('0x25')]=qs[_0x77fb('0x25')](_0x3528b0['query'][_0x77fb('0x25')]);}_0x3c5812[_0x77fb('0x3c')]=qs[_0x77fb('0x3d')](_0x3528b0[_0x77fb('0x34')][_0x77fb('0x3d')]);_0x3c5812[_0x77fb('0x3e')]=qs['filters'](_['pick'](_0x3528b0[_0x77fb('0x34')],_0x3bdce7['filters']),_0x110d65);if(_0x3528b0['query']['filter']){_0x3c5812[_0x77fb('0x3e')]=_[_0x77fb('0x3f')](_0x3c5812[_0x77fb('0x3e')],{'$or':_[_0x77fb('0x2e')](_0x110d65,function(_0x247f89){if(_0x247f89[_0x77fb('0x31')]!==_0x77fb('0x40')){var _0x1551a2={};_0x1551a2[_0x247f89['name']]={'$like':'%'+_0x3528b0['query'][_0x77fb('0x41')]+'%'};return _0x1551a2;}})});}_0x3c5812=_[_0x77fb('0x3f')]({},_0x3c5812,_0x3528b0[_0x77fb('0x42')]);var _0x3950d8={'where':_0x3c5812[_0x77fb('0x3e')]};return db[_0x77fb('0x2f')][_0x77fb('0x27')](_0x3950d8)[_0x77fb('0x43')](function(_0xdb1303){_0x4c99fa[_0x77fb('0x27')]=_0xdb1303;if(_0x3528b0[_0x77fb('0x34')]['includeAll']){_0x3c5812[_0x77fb('0x44')]=[{'all':!![]}];}return db[_0x77fb('0x2f')]['findAll'](_0x3c5812);})['then'](function(_0x1838aa){_0x4c99fa[_0x77fb('0x45')]=_0x1838aa;return _0x4c99fa;})[_0x77fb('0x43')](respondWithFilteredResult(_0x1087d5,_0x3c5812))['catch'](handleError(_0x1087d5,null));};exports[_0x77fb('0x46')]=function(_0x1cb0f6,_0x23362d){var _0x2ef2a4={'raw':![],'where':{'id':_0x1cb0f6[_0x77fb('0x47')]['id']}},_0x277a73={};_0x277a73['model']=_['keys'](db[_0x77fb('0x2f')][_0x77fb('0x48')]);_0x277a73[_0x77fb('0x34')]=_[_0x77fb('0x49')](_0x1cb0f6[_0x77fb('0x34')]);_0x277a73[_0x77fb('0x35')]=_[_0x77fb('0x36')](_0x277a73[_0x77fb('0x33')],_0x277a73[_0x77fb('0x34')]);_0x2ef2a4['attributes']=_[_0x77fb('0x36')](_0x277a73[_0x77fb('0x33')],qs[_0x77fb('0x38')](_0x1cb0f6['query']['fields']));_0x2ef2a4[_0x77fb('0x37')]=_0x2ef2a4[_0x77fb('0x37')]['length']?_0x2ef2a4[_0x77fb('0x37')]:_0x277a73[_0x77fb('0x33')];if(_0x1cb0f6['query'][_0x77fb('0x4a')]){_0x2ef2a4[_0x77fb('0x44')]=[{'all':!![]}];}_0x2ef2a4=_[_0x77fb('0x3f')]({},_0x2ef2a4,_0x1cb0f6['options']);return db[_0x77fb('0x2f')]['find'](_0x2ef2a4)[_0x77fb('0x43')](handleEntityNotFound(_0x23362d,null))[_0x77fb('0x43')](respondWithResult(_0x23362d,null))[_0x77fb('0x4b')](handleError(_0x23362d,null));};exports[_0x77fb('0x4c')]=function(_0x377499,_0x47f514){return db[_0x77fb('0x2f')][_0x77fb('0x4c')](_0x377499[_0x77fb('0x4d')],{})['then'](function(_0x4f5eef){var _0x43f976=_0x377499[_0x77fb('0x4e')]['get']({'plain':!![]});if(!_0x43f976)throw new Error(_0x77fb('0x4f'));if(_0x43f976[_0x77fb('0x50')]===_0x77fb('0x4e')){var _0x1648f0=_0x4f5eef[_0x77fb('0x51')]({'plain':!![]});var _0x558ffe=_0x77fb('0x52');return db[_0x77fb('0x53')][_0x77fb('0x54')]({'where':{'name':_0x558ffe,'userProfileId':_0x43f976[_0x77fb('0x55')]},'raw':!![]})[_0x77fb('0x43')](function(_0x7340a0){if(_0x7340a0&&_0x7340a0[_0x77fb('0x56')]===0x0){return db[_0x77fb('0x57')]['create']({'name':_0x1648f0[_0x77fb('0x2c')],'resourceId':_0x1648f0['id'],'type':_0x7340a0['name'],'sectionId':_0x7340a0['id']},{})[_0x77fb('0x43')](function(){return _0x4f5eef;});}else{return _0x4f5eef;}})['catch'](function(_0xd6fded){logger[_0x77fb('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd6fded);throw _0xd6fded;});}return _0x4f5eef;})[_0x77fb('0x43')](respondWithResult(_0x47f514,0xc9))[_0x77fb('0x4b')](handleError(_0x47f514,null));};exports[_0x77fb('0x2a')]=function(_0x2a7c46,_0x1e2b6a){if(_0x2a7c46['body']['id']){delete _0x2a7c46[_0x77fb('0x4d')]['id'];}return db[_0x77fb('0x2f')][_0x77fb('0x54')]({'where':{'id':_0x2a7c46[_0x77fb('0x47')]['id']}})[_0x77fb('0x43')](handleEntityNotFound(_0x1e2b6a,null))[_0x77fb('0x43')](saveUpdates(_0x2a7c46[_0x77fb('0x4d')],null))[_0x77fb('0x43')](respondWithResult(_0x1e2b6a,null))[_0x77fb('0x4b')](handleError(_0x1e2b6a,null));};exports[_0x77fb('0x59')]=function(_0x2c1d2f,_0x25ccce){var _0x2067e2=_0x2c1d2f['params']['id'];var _0x4a1b24=[];return db[_0x77fb('0x5a')]['transaction'](function(_0x3eaec9){var _0x52ba3f=_0x77fb('0x5b')+_0x2067e2;return db['sequelize']['query'](_0x52ba3f,{'type':db[_0x77fb('0x5c')][_0x77fb('0x5d')][_0x77fb('0x5e')],'raw':!![],'transaction':_0x3eaec9})['then'](function(_0x547fd7){_0x4a1b24=_[_0x77fb('0x2e')](_0x547fd7,function(_0x3bcaf4){return Number(_0x3bcaf4[_0x77fb('0x5f')]);});})['then'](function(){var _0x90e774=_0x77fb('0x60')+_0x2067e2;return db[_0x77fb('0x5a')]['query'](_0x90e774,{'type':db[_0x77fb('0x5c')][_0x77fb('0x5d')][_0x77fb('0x5e')],'raw':!![],'transaction':_0x3eaec9});})['then'](function(_0x494a13){var _0x10acd8=_[_0x77fb('0x2e')](_0x494a13,function(_0x3928a7){return Number(_0x3928a7[_0x77fb('0x61')]);});return db['UserVoiceQueue'][_0x77fb('0x59')]({'where':{'UserId':{'$in':_0x4a1b24},'VoiceQueueId':{'$in':_0x10acd8}},'transaction':_0x3eaec9});})[_0x77fb('0x43')](function(){var _0x152749=_0x77fb('0x62')+_0x2067e2;return db['sequelize'][_0x77fb('0x34')](_0x152749,{'type':db[_0x77fb('0x5c')][_0x77fb('0x5d')][_0x77fb('0x5e')],'raw':!![],'transaction':_0x3eaec9});})['then'](function(_0x31c898){var _0x1f92bc=_[_0x77fb('0x2e')](_0x31c898,function(_0x19a942){return Number(_0x19a942[_0x77fb('0x63')]);});return db[_0x77fb('0x64')][_0x77fb('0x59')]({'where':{'UserId':{'$in':_0x4a1b24},'MailQueueId':{'$in':_0x1f92bc}},'transaction':_0x3eaec9});})[_0x77fb('0x43')](function(){var _0x4a32b4='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2067e2;return db[_0x77fb('0x5a')][_0x77fb('0x34')](_0x4a32b4,{'type':db['Sequelize'][_0x77fb('0x5d')][_0x77fb('0x5e')],'raw':!![],'transaction':_0x3eaec9});})[_0x77fb('0x43')](function(_0x319a32){var _0x542dce=_[_0x77fb('0x2e')](_0x319a32,function(_0x2cbb1b){return Number(_0x2cbb1b[_0x77fb('0x65')]);});return db[_0x77fb('0x66')][_0x77fb('0x59')]({'where':{'UserId':{'$in':_0x4a1b24},'SmsQueueId':{'$in':_0x542dce}},'transaction':_0x3eaec9});})['then'](function(){var _0x538a47=_0x77fb('0x67')+_0x2067e2;return db[_0x77fb('0x5a')][_0x77fb('0x34')](_0x538a47,{'type':db['Sequelize'][_0x77fb('0x5d')][_0x77fb('0x5e')],'raw':!![],'transaction':_0x3eaec9});})[_0x77fb('0x43')](function(_0x201766){var _0x100316=_[_0x77fb('0x2e')](_0x201766,function(_0x210d91){return Number(_0x210d91['ChatQueueId']);});return db[_0x77fb('0x68')]['destroy']({'where':{'UserId':{'$in':_0x4a1b24},'ChatQueueId':{'$in':_0x100316}},'transaction':_0x3eaec9});})[_0x77fb('0x43')](function(){var _0x335fae=_0x77fb('0x69')+_0x2067e2;return db[_0x77fb('0x5a')][_0x77fb('0x34')](_0x335fae,{'type':db[_0x77fb('0x5c')][_0x77fb('0x5d')][_0x77fb('0x5e')],'raw':!![],'transaction':_0x3eaec9});})[_0x77fb('0x43')](function(_0x3fa1c3){var _0x1d5aa3=_[_0x77fb('0x2e')](_0x3fa1c3,function(_0x149326){return Number(_0x149326[_0x77fb('0x6a')]);});return db['UserFaxQueue'][_0x77fb('0x59')]({'where':{'UserId':{'$in':_0x4a1b24},'FaxQueueId':{'$in':_0x1d5aa3}},'transaction':_0x3eaec9});})[_0x77fb('0x43')](function(){var _0x187819='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2067e2;return db[_0x77fb('0x5a')][_0x77fb('0x34')](_0x187819,{'type':db[_0x77fb('0x5c')][_0x77fb('0x5d')]['SELECT'],'raw':!![],'transaction':_0x3eaec9});})[_0x77fb('0x43')](function(_0xe3cbe2){var _0x4d97b9=_[_0x77fb('0x2e')](_0xe3cbe2,function(_0x3aabce){return Number(_0x3aabce[_0x77fb('0x6b')]);});return db[_0x77fb('0x6c')]['destroy']({'where':{'UserId':{'$in':_0x4a1b24},'OpenchannelQueueId':{'$in':_0x4d97b9}},'transaction':_0x3eaec9});})[_0x77fb('0x43')](function(){var _0x411f0c=_0x77fb('0x6d')+_0x2067e2;return db[_0x77fb('0x5a')][_0x77fb('0x34')](_0x411f0c,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x3eaec9});})[_0x77fb('0x43')](function(_0x4829aa){var _0x1e52c0=_[_0x77fb('0x2e')](_0x4829aa,function(_0x38b53a){return Number(_0x38b53a[_0x77fb('0x6e')]);});return db[_0x77fb('0x6f')][_0x77fb('0x59')]({'where':{'UserId':{'$in':_0x4a1b24},'WhatsappQueueId':{'$in':_0x1e52c0}},'transaction':_0x3eaec9});})[_0x77fb('0x43')](function(){return db[_0x77fb('0x70')][_0x77fb('0x54')]({'where':{'TeamId':_0x2067e2}});})[_0x77fb('0x43')](function(_0x26b684){if(_0x26b684===null){return;}return db[_0x77fb('0x71')][_0x77fb('0x59')]({'where':{'UserId':{'$in':_0x4a1b24},'VoicePrefixId':_0x26b684['VoicePrefixId']},'transaction':_0x3eaec9});})[_0x77fb('0x43')](function(){return db['Team'][_0x77fb('0x59')]({'where':{'id':_0x2067e2},'cascade':!![],'transaction':_0x3eaec9});})['then'](function(_0x2db799){if(_0x2db799===0x0){_0x25ccce['sendStatus'](0x194);}else{return db['UserProfileResource'][_0x77fb('0x59')]({'where':{'type':_0x77fb('0x52'),'resourceId':_0x2067e2},'cascade':!![],'transaction':_0x3eaec9})[_0x77fb('0x43')](function(){_0x25ccce['status'](0xcc)[_0x77fb('0x23')]();});}})['catch'](function(_0xeb5222){_0x25ccce['status'](0x1f4)[_0x77fb('0x2d')](_0xeb5222);});});};exports[_0x77fb('0x72')]=function(_0x5eed6b,_0x5565c6,_0x62f576){return db[_0x77fb('0x2f')][_0x77fb('0x73')]({'where':{'id':_0x5eed6b[_0x77fb('0x47')]['id']}})[_0x77fb('0x43')](handleEntityNotFound(_0x5565c6,null))[_0x77fb('0x43')](function(_0xc96e65){if(!_0x5eed6b[_0x77fb('0x34')]['channel']||!utils[_0x77fb('0x74')](_0x5eed6b[_0x77fb('0x34')][_0x77fb('0x75')])){throw new db['Sequelize'][(_0x77fb('0x76'))](_0x77fb('0x77'));}var _0x17d903={};var _0x1917ed={};_0x1917ed[_0x77fb('0x33')]=_[_0x77fb('0x49')](db[_['capitalize'](_0x5eed6b[_0x77fb('0x34')][_0x77fb('0x75')]['toLowerCase']())+_0x77fb('0x78')][_0x77fb('0x48')]);_0x1917ed['query']=_['keys'](_0x5eed6b[_0x77fb('0x34')]);_0x1917ed[_0x77fb('0x35')]=_[_0x77fb('0x36')](_0x1917ed[_0x77fb('0x33')],_0x1917ed[_0x77fb('0x34')]);_0x17d903[_0x77fb('0x37')]=_['intersection'](_0x1917ed[_0x77fb('0x33')],qs['fields'](_0x5eed6b[_0x77fb('0x34')][_0x77fb('0x38')]));_0x17d903[_0x77fb('0x37')]=_0x17d903[_0x77fb('0x37')][_0x77fb('0x39')]?_0x17d903[_0x77fb('0x37')]:_0x1917ed[_0x77fb('0x33')];_0x17d903['limit']=qs[_0x77fb('0x28')](_0x5eed6b[_0x77fb('0x34')][_0x77fb('0x28')]);_0x17d903[_0x77fb('0x25')]=qs[_0x77fb('0x25')](_0x5eed6b[_0x77fb('0x34')]['offset']);_0x17d903[_0x77fb('0x3c')]=qs[_0x77fb('0x3d')](_0x5eed6b['query']['sort']);_0x17d903[_0x77fb('0x3e')]=qs['filters'](_[_0x77fb('0x79')](_0x5eed6b[_0x77fb('0x34')],_0x1917ed[_0x77fb('0x35')]));_0x17d903=_['merge']({},_0x17d903,_0x5eed6b[_0x77fb('0x42')]);return _0xc96e65[_0x77fb('0x51')+_[_0x77fb('0x7a')](_0x5eed6b[_0x77fb('0x34')][_0x77fb('0x75')][_0x77fb('0x7b')]())+_0x77fb('0x7c')](_0x17d903);})[_0x77fb('0x43')](respondWithResult(_0x5565c6,null))['catch'](handleError(_0x5565c6,null));};exports['addQueues']=function(_0x40edd1,_0x59b095,_0xa7e61b){return db[_0x77fb('0x2f')][_0x77fb('0x73')]({'where':{'id':_0x40edd1[_0x77fb('0x47')]['id']}})[_0x77fb('0x43')](function(_0xfc4117){if(_0xfc4117){if(!_0x40edd1[_0x77fb('0x4d')][_0x77fb('0x75')]||!utils['isValidChannel'](_0x40edd1[_0x77fb('0x4d')][_0x77fb('0x75')])){throw new db[(_0x77fb('0x5c'))]['ValidationError'](_0x77fb('0x77'));}return _0xfc4117['add'+_[_0x77fb('0x7a')](_0x40edd1[_0x77fb('0x4d')]['channel'][_0x77fb('0x7b')]())+_0x77fb('0x7c')](_0x40edd1[_0x77fb('0x4d')]['ids']);}return null;})[_0x77fb('0x43')](handleEntityNotFound(_0x59b095,null))[_0x77fb('0x43')](respondWithStatusCode(_0x59b095,null))[_0x77fb('0x4b')](handleError(_0x59b095,null));};exports[_0x77fb('0x7d')]=function(_0xa11b58,_0x52fb00,_0x56aa42){return db[_0x77fb('0x2f')][_0x77fb('0x73')]({'where':{'id':_0xa11b58[_0x77fb('0x47')]['id']}})[_0x77fb('0x43')](function(_0x3f40b4){if(_0x3f40b4){if(!_0xa11b58[_0x77fb('0x34')][_0x77fb('0x75')]||!utils[_0x77fb('0x74')](_0xa11b58[_0x77fb('0x34')][_0x77fb('0x75')])){throw new db[(_0x77fb('0x5c'))][(_0x77fb('0x76'))](_0x77fb('0x77'));}return _0x3f40b4[_0x77fb('0x7e')+_['capitalize'](_0xa11b58[_0x77fb('0x34')][_0x77fb('0x75')][_0x77fb('0x7b')]())+_0x77fb('0x7c')](_0xa11b58[_0x77fb('0x34')][_0x77fb('0x7f')]);}return null;})[_0x77fb('0x43')](handleEntityNotFound(_0x52fb00,null))[_0x77fb('0x43')](respondWithStatusCode(_0x52fb00,null))['catch'](handleError(_0x52fb00,null));};exports[_0x77fb('0x80')]=function(_0x5bc615,_0x87edab){var _0x2d89b6=_[_0x77fb('0x81')](_0x5bc615[_0x77fb('0x4d')][_0x77fb('0x7f')])?_0x5bc615[_0x77fb('0x4d')][_0x77fb('0x7f')]:[_0x5bc615[_0x77fb('0x4d')][_0x77fb('0x7f')]];var _0xbc4ce4=_0x5bc615[_0x77fb('0x47')]['id'];return db[_0x77fb('0x2f')]['find']({'where':{'id':_0xbc4ce4}})[_0x77fb('0x43')](handleEntityNotFound(_0x87edab,null))[_0x77fb('0x43')](function(_0x5a81b6){if(_0x5a81b6){var _0x206654=[_0x77fb('0x82'),_0x77fb('0x83'),'Mail',_0x77fb('0x84'),'Fax',_0x77fb('0x85'),_0x77fb('0x86')];return db[_0x77fb('0x5a')][_0x77fb('0x87')](function(_0x33b9c6){var _0x2159b4=_[_0x77fb('0x2e')](_0x206654,function(_0xf706b5){var _0x3b005f={'attributes':['id',_0x77fb('0x2c')]};if(_0xf706b5===_0x77fb('0x82')){_0x3b005f['through']={'attributes':[_0x77fb('0x88')]};}return _0x5a81b6[_0x77fb('0x51')+_0xf706b5+_0x77fb('0x7c')](_0x3b005f)[_0x77fb('0x43')](function(_0x68f886){var _0x2610aa=_['map'](_0x68f886,function(_0x1bc869){var _0x2aaa50=_[_0x77fb('0x2e')](_0x2d89b6,function(_0x34c449){var _0x480e55={'where':{'UserId':_0x34c449,[_0xf706b5+_0x77fb('0x89')]:_0x1bc869['id']},'transaction':_0x33b9c6};if(_0xf706b5===_0x77fb('0x82')){_0x480e55['defaults']={'penalty':_0x1bc869[_0x77fb('0x8a')][_0x77fb('0x88')]};}return db[_0x77fb('0x8b')+_0xf706b5+'Queue']['findOrCreate'](_0x480e55)['then'](function(){socket[_0x77fb('0x8c')](_0x77fb('0x4e')+_0xf706b5+'Queue:save',{'UserId':_0x34c449,[_0xf706b5+_0x77fb('0x89')]:_0x1bc869['id']});if(_0xf706b5!==_0x77fb('0x82')){return;}return db[_0x77fb('0x8b')][_0x77fb('0x8d')]({'where':{'id':_0x2d89b6,'online':0x1},'attributes':['id','name',_0x77fb('0x8e'),_0x77fb('0x8f'),_0x77fb('0x90')],'raw':!![]})['then'](function(_0xbb09a8){var _0x531963=_[_0x77fb('0x2e')](_0xbb09a8,function(_0x4abd6d){return db[_0x77fb('0x91')][_0x77fb('0x92')]({'membername':_0x4abd6d[_0x77fb('0x2c')],'UserId':_0x4abd6d['id'],'queue_name':_0x1bc869[_0x77fb('0x2c')],'VoiceQueueId':_0x1bc869['id'],'interface':_[_0x77fb('0x93')](_0x4abd6d[_0x77fb('0x90')])?util['format']('SIP/%s',_0x4abd6d[_0x77fb('0x2c')]):_0x4abd6d[_0x77fb('0x90')],'paused':_0x4abd6d[_0x77fb('0x8f')]||![],'penalty':_0x1bc869['TeamVoiceQueue'][_0x77fb('0x88')]},{'transaction':_0x33b9c6});});return Promise[_0x77fb('0x94')](_0x531963);});});});return Promise[_0x77fb('0x94')](_0x2aaa50);});return Promise[_0x77fb('0x94')](_0x2610aa);})[_0x77fb('0x43')](function(){return db[_0x77fb('0x70')]['findOne']({'where':{'teamId':_0xbc4ce4}})[_0x77fb('0x43')](function(_0x108447){if(_0x108447){var _0x3f4d8f=_[_0x77fb('0x2e')](_0x2d89b6,function(_0x595ea2){db[_0x77fb('0x71')]['upsert']({'UserId':_0x595ea2,'VoicePrefixId':_0x108447[_0x77fb('0x95')]});});return Promise[_0x77fb('0x94')](_0x3f4d8f);}});});});return Promise[_0x77fb('0x94')](_0x2159b4)[_0x77fb('0x43')](function(){return _0x5a81b6['addAgents'](_0x2d89b6,{'transaction':_0x33b9c6})['spread'](function(_0xe8d88d){return _0xe8d88d;});});});}})[_0x77fb('0x43')](respondWithResult(_0x87edab,null))['catch'](handleError(_0x87edab,null));};exports['removeAgents']=function(_0x531104,_0x5de6c0){var _0x450a35=_[_0x77fb('0x81')](_0x531104[_0x77fb('0x34')][_0x77fb('0x7f')])?_0x531104['query'][_0x77fb('0x7f')]:[_0x531104[_0x77fb('0x34')][_0x77fb('0x7f')]];var _0x54d367=_0x531104['params']['id'];return db['Team'][_0x77fb('0x54')]({'where':{'id':_0x54d367}})[_0x77fb('0x43')](handleEntityNotFound(_0x5de6c0,null))[_0x77fb('0x43')](function(_0x8d68e8){if(_0x8d68e8){var _0x44ac2e=['Voice',_0x77fb('0x83'),_0x77fb('0x96'),_0x77fb('0x84'),'Fax','Openchannel',_0x77fb('0x86')];return db[_0x77fb('0x5a')][_0x77fb('0x87')](function(_0x257df4){var _0x4326cb=_['map'](_0x44ac2e,function(_0x3f773f){var _0x5ece77={'attributes':['id',_0x77fb('0x2c')]};return _0x8d68e8[_0x77fb('0x51')+_0x3f773f+_0x77fb('0x7c')](_0x5ece77)[_0x77fb('0x43')](function(_0x3cbe23){var _0x50996b=_[_0x77fb('0x2e')](_0x3cbe23,function(_0x52bbfd){return _0x52bbfd['removeAgents'](_0x450a35,{'transaction':_0x257df4})[_0x77fb('0x43')](function(){var _0x53d0f3=_['map'](_0x450a35,function(_0xa3e2ab){socket[_0x77fb('0x8c')]('user'+_0x3f773f+_0x77fb('0x97'),{'UserId':Number(_0xa3e2ab),[_0x3f773f+_0x77fb('0x89')]:_0x52bbfd['id']});if(_0x3f773f!==_0x77fb('0x82')){return;}return db[_0x77fb('0x91')][_0x77fb('0x59')]({'where':{'VoiceQueueId':_0x52bbfd['id'],'UserId':_0xa3e2ab},'transaction':_0x257df4});});return Promise[_0x77fb('0x94')](_0x53d0f3);});});return Promise[_0x77fb('0x94')](_0x50996b);});});return Promise[_0x77fb('0x94')](_0x4326cb)['then'](function(){return _0x8d68e8[_0x77fb('0x98')](_0x450a35,{'transaction':_0x257df4});})[_0x77fb('0x43')](function(){return db[_0x77fb('0x70')]['findOne']({'where':{'teamId':_0x54d367}})[_0x77fb('0x43')](function(_0x1af8fc){if(_0x1af8fc){var _0x28e29d=_[_0x77fb('0x2e')](_0x450a35,function(_0x10a59e){db[_0x77fb('0x71')]['destroy']({'where':{'UserId':_0x10a59e,'VoicePrefixId':_0x1af8fc[_0x77fb('0x95')]}});});return Promise[_0x77fb('0x94')](_0x28e29d);}});});});}})[_0x77fb('0x43')](respondWithStatusCode(_0x5de6c0,null))[_0x77fb('0x4b')](handleError(_0x5de6c0,null));};exports[_0x77fb('0x99')]=function(_0x1b4684,_0x1a3c4a,_0x1eb284){var _0x11d1d2={};var _0x16e9e={};var _0x37c634;var _0x573d9e;return db[_0x77fb('0x2f')][_0x77fb('0x73')]({'where':{'id':_0x1b4684[_0x77fb('0x47')]['id']}})[_0x77fb('0x43')](handleEntityNotFound(_0x1a3c4a,null))['then'](function(_0x3ee338){if(_0x3ee338){_0x37c634=_0x3ee338;_0x16e9e[_0x77fb('0x33')]=_[_0x77fb('0x49')](db['User']['rawAttributes']);_0x16e9e[_0x77fb('0x34')]=_[_0x77fb('0x49')](_0x1b4684[_0x77fb('0x34')]);_0x16e9e[_0x77fb('0x35')]=_[_0x77fb('0x36')](_0x16e9e['model'],_0x16e9e[_0x77fb('0x34')]);_0x11d1d2[_0x77fb('0x37')]=_[_0x77fb('0x36')](_0x16e9e['model'],qs['fields'](_0x1b4684[_0x77fb('0x34')][_0x77fb('0x38')]));_0x11d1d2[_0x77fb('0x37')]=_0x11d1d2[_0x77fb('0x37')]['length']?_0x11d1d2[_0x77fb('0x37')]:_0x16e9e['model'];_0x11d1d2[_0x77fb('0x3c')]=qs[_0x77fb('0x3d')](_0x1b4684[_0x77fb('0x34')][_0x77fb('0x3d')]);_0x11d1d2['where']=qs[_0x77fb('0x35')](_[_0x77fb('0x79')](_0x1b4684[_0x77fb('0x34')],_0x16e9e['filters']));if(_0x1b4684[_0x77fb('0x34')][_0x77fb('0x41')]){_0x11d1d2[_0x77fb('0x3e')]=_[_0x77fb('0x3f')](_0x11d1d2[_0x77fb('0x3e')],{'$or':_['map'](_0x11d1d2[_0x77fb('0x37')],function(_0x4cd3c3){var _0x5d91de={};_0x5d91de[_0x4cd3c3]={'$like':'%'+_0x1b4684[_0x77fb('0x34')][_0x77fb('0x41')]+'%'};return _0x5d91de;})});}_0x11d1d2=_['merge']({},_0x11d1d2,_0x1b4684[_0x77fb('0x42')]);return _0x37c634[_0x77fb('0x99')](_0x11d1d2);}})[_0x77fb('0x43')](function(_0x5686bd){if(_0x5686bd){_0x573d9e=_0x5686bd['length'];if(!_0x1b4684['query'][_0x77fb('0x3a')]('nolimit')){_0x11d1d2[_0x77fb('0x28')]=qs['limit'](_0x1b4684[_0x77fb('0x34')][_0x77fb('0x28')]);_0x11d1d2[_0x77fb('0x25')]=qs['offset'](_0x1b4684[_0x77fb('0x34')]['offset']);}return _0x37c634[_0x77fb('0x99')](_0x11d1d2);}})[_0x77fb('0x43')](function(_0x2fa374){if(_0x2fa374){return _0x2fa374?{'count':_0x573d9e,'rows':_0x2fa374}:null;}})[_0x77fb('0x43')](respondWithResult(_0x1a3c4a,null))[_0x77fb('0x4b')](handleError(_0x1a3c4a,null));}; \ No newline at end of file +var _0xeaba=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','error','name','send','map','Team','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SmsQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','capitalize','toLowerCase','Queue','pick','Queues','addQueues','Unknown\x20channel','ids','removeQueues','Voice','Chat','Sms','Fax','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','Queue:save','online','voicePause','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','interface','all','UserVoicePrefix','isArray','Mail','Whatsapp','removeAgents','emit','Queue:remove','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x40c76e,_0x5ee10b){var _0x1231ab=function(_0x3ddb0d){while(--_0x3ddb0d){_0x40c76e['push'](_0x40c76e['shift']());}};_0x1231ab(++_0x5ee10b);}(_0xeaba,0x1b9));var _0xaeab=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xeaba[_0x243b2f];return _0xcb3c2d;};'use strict';var emlformat=require(_0xaeab('0x0'));var rimraf=require(_0xaeab('0x1'));var zipdir=require(_0xaeab('0x2'));var jsonpatch=require(_0xaeab('0x3'));var rp=require(_0xaeab('0x4'));var moment=require(_0xaeab('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xaeab('0x6'));var util=require('util');var path=require('path');var sox=require(_0xaeab('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaeab('0x8'));var _=require(_0xaeab('0x9'));var squel=require(_0xaeab('0xa'));var crypto=require('crypto');var jsforce=require(_0xaeab('0xb'));var deskjs=require(_0xaeab('0xc'));var toCsv=require(_0xaeab('0xd'));var querystring=require(_0xaeab('0xe'));var Papa=require(_0xaeab('0xf'));var Redis=require(_0xaeab('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaeab('0x11'));var hardwareService=require(_0xaeab('0x12'));var logger=require(_0xaeab('0x13'))(_0xaeab('0x14'));var utils=require(_0xaeab('0x15'));var config=require(_0xaeab('0x16'));var licenseUtil=require(_0xaeab('0x17'));var db=require('../../mysqldb')['db'];config[_0xaeab('0x18')]=_[_0xaeab('0x19')](config['redis'],{'host':_0xaeab('0x1a'),'port':0x18eb});var socket=require(_0xaeab('0x1b'))(new Redis(config[_0xaeab('0x18')]));require(_0xaeab('0x1c'))[_0xaeab('0x1d')](socket);function respondWithStatusCode(_0x5a4960,_0x124c5b){_0x124c5b=_0x124c5b||0xcc;return function(_0x1e8e8f){if(_0x1e8e8f){return _0x5a4960[_0xaeab('0x1e')](_0x124c5b);}return _0x5a4960['status'](_0x124c5b)[_0xaeab('0x1f')]();};}function respondWithResult(_0x1feed0,_0x389203){_0x389203=_0x389203||0xc8;return function(_0xab25ea){if(_0xab25ea){return _0x1feed0['status'](_0x389203)[_0xaeab('0x20')](_0xab25ea);}};}function respondWithFilteredResult(_0x3c7ddb,_0x15d3e1){return function(_0x52fd78){if(_0x52fd78){var _0x302ba3=typeof _0x15d3e1[_0xaeab('0x21')]===_0xaeab('0x22')&&typeof _0x15d3e1[_0xaeab('0x23')]===_0xaeab('0x22');var _0x439007=_0x52fd78['count'];var _0x21ab80=_0x302ba3?0x0:_0x15d3e1[_0xaeab('0x21')];var _0x2b60ae=_0x302ba3?_0x52fd78[_0xaeab('0x24')]:_0x15d3e1[_0xaeab('0x21')]+_0x15d3e1['limit'];var _0x373bbc;if(_0x2b60ae>=_0x439007){_0x2b60ae=_0x439007;_0x373bbc=0xc8;}else{_0x373bbc=0xce;}_0x3c7ddb[_0xaeab('0x25')](_0x373bbc);return _0x3c7ddb['set'](_0xaeab('0x26'),_0x21ab80+'-'+_0x2b60ae+'/'+_0x439007)[_0xaeab('0x20')](_0x52fd78);}return null;};}function patchUpdates(_0xa58271){return function(_0x571b62){try{jsonpatch[_0xaeab('0x27')](_0x571b62,_0xa58271,!![]);}catch(_0x53f46c){return BPromise[_0xaeab('0x28')](_0x53f46c);}return _0x571b62[_0xaeab('0x29')]();};}function saveUpdates(_0x5025cb,_0x56df9c){return function(_0x3892c4){if(_0x3892c4){return _0x3892c4[_0xaeab('0x2a')](_0x5025cb)[_0xaeab('0x2b')](function(_0x1a8e43){return _0x1a8e43;});}return null;};}function handleEntityNotFound(_0x11e921,_0x469abe){return function(_0x39825c){if(!_0x39825c){_0x11e921[_0xaeab('0x1e')](0x194);}return _0x39825c;};}function handleError(_0x25c7f5,_0x1ec9f0){_0x1ec9f0=_0x1ec9f0||0x1f4;return function(_0x26d8fe){logger[_0xaeab('0x2c')](_0x26d8fe['stack']);if(_0x26d8fe['name']){delete _0x26d8fe[_0xaeab('0x2d')];}_0x25c7f5[_0xaeab('0x25')](_0x1ec9f0)[_0xaeab('0x2e')](_0x26d8fe);};}exports['index']=function(_0x45520f,_0x16a082){var _0x14285d={},_0x5e4159={},_0x49424c={'count':0x0,'rows':[]};var _0x55a959=_[_0xaeab('0x2f')](db[_0xaeab('0x30')][_0xaeab('0x31')],function(_0xe915c3){return{'name':_0xe915c3[_0xaeab('0x32')],'type':_0xe915c3['type'][_0xaeab('0x33')]};});_0x5e4159[_0xaeab('0x34')]=_[_0xaeab('0x2f')](_0x55a959,_0xaeab('0x2d'));_0x5e4159[_0xaeab('0x35')]=_[_0xaeab('0x36')](_0x45520f[_0xaeab('0x35')]);_0x5e4159[_0xaeab('0x37')]=_[_0xaeab('0x38')](_0x5e4159[_0xaeab('0x34')],_0x5e4159[_0xaeab('0x35')]);_0x14285d[_0xaeab('0x39')]=_[_0xaeab('0x38')](_0x5e4159[_0xaeab('0x34')],qs[_0xaeab('0x3a')](_0x45520f[_0xaeab('0x35')]['fields']));_0x14285d['attributes']=_0x14285d[_0xaeab('0x39')][_0xaeab('0x3b')]?_0x14285d[_0xaeab('0x39')]:_0x5e4159[_0xaeab('0x34')];if(!_0x45520f[_0xaeab('0x35')]['hasOwnProperty'](_0xaeab('0x3c'))){_0x14285d[_0xaeab('0x23')]=qs[_0xaeab('0x23')](_0x45520f['query']['limit']);_0x14285d[_0xaeab('0x21')]=qs[_0xaeab('0x21')](_0x45520f[_0xaeab('0x35')][_0xaeab('0x21')]);}_0x14285d[_0xaeab('0x3d')]=qs[_0xaeab('0x3e')](_0x45520f[_0xaeab('0x35')]['sort']);_0x14285d[_0xaeab('0x3f')]=qs[_0xaeab('0x37')](_['pick'](_0x45520f[_0xaeab('0x35')],_0x5e4159[_0xaeab('0x37')]),_0x55a959);if(_0x45520f['query'][_0xaeab('0x40')]){_0x14285d[_0xaeab('0x3f')]=_[_0xaeab('0x41')](_0x14285d[_0xaeab('0x3f')],{'$or':_['map'](_0x55a959,function(_0x4ea00d){if(_0x4ea00d[_0xaeab('0x42')]!==_0xaeab('0x43')){var _0x34ccfe={};_0x34ccfe[_0x4ea00d[_0xaeab('0x2d')]]={'$like':'%'+_0x45520f[_0xaeab('0x35')][_0xaeab('0x40')]+'%'};return _0x34ccfe;}})});}_0x14285d=_[_0xaeab('0x41')]({},_0x14285d,_0x45520f[_0xaeab('0x44')]);var _0x9c7797={'where':_0x14285d['where']};return db[_0xaeab('0x30')][_0xaeab('0x24')](_0x9c7797)[_0xaeab('0x2b')](function(_0xa32380){_0x49424c[_0xaeab('0x24')]=_0xa32380;if(_0x45520f[_0xaeab('0x35')]['includeAll']){_0x14285d[_0xaeab('0x45')]=[{'all':!![]}];}return db[_0xaeab('0x30')][_0xaeab('0x46')](_0x14285d);})[_0xaeab('0x2b')](function(_0x45152c){_0x49424c[_0xaeab('0x47')]=_0x45152c;return _0x49424c;})[_0xaeab('0x2b')](respondWithFilteredResult(_0x16a082,_0x14285d))['catch'](handleError(_0x16a082,null));};exports[_0xaeab('0x48')]=function(_0x20e6bf,_0x2e37e8){var _0x13b16a={'raw':![],'where':{'id':_0x20e6bf[_0xaeab('0x49')]['id']}},_0x17afce={};_0x17afce[_0xaeab('0x34')]=_['keys'](db[_0xaeab('0x30')][_0xaeab('0x31')]);_0x17afce[_0xaeab('0x35')]=_['keys'](_0x20e6bf[_0xaeab('0x35')]);_0x17afce['filters']=_[_0xaeab('0x38')](_0x17afce['model'],_0x17afce['query']);_0x13b16a[_0xaeab('0x39')]=_[_0xaeab('0x38')](_0x17afce[_0xaeab('0x34')],qs[_0xaeab('0x3a')](_0x20e6bf[_0xaeab('0x35')][_0xaeab('0x3a')]));_0x13b16a['attributes']=_0x13b16a[_0xaeab('0x39')][_0xaeab('0x3b')]?_0x13b16a[_0xaeab('0x39')]:_0x17afce['model'];if(_0x20e6bf[_0xaeab('0x35')][_0xaeab('0x4a')]){_0x13b16a[_0xaeab('0x45')]=[{'all':!![]}];}_0x13b16a=_['merge']({},_0x13b16a,_0x20e6bf[_0xaeab('0x44')]);return db[_0xaeab('0x30')][_0xaeab('0x4b')](_0x13b16a)[_0xaeab('0x2b')](handleEntityNotFound(_0x2e37e8,null))[_0xaeab('0x2b')](respondWithResult(_0x2e37e8,null))[_0xaeab('0x4c')](handleError(_0x2e37e8,null));};exports['create']=function(_0x25ab8f,_0x484f38){return db[_0xaeab('0x30')]['create'](_0x25ab8f[_0xaeab('0x4d')],{})[_0xaeab('0x2b')](function(_0x204937){var _0x114c0f=_0x25ab8f[_0xaeab('0x4e')][_0xaeab('0x4f')]({'plain':!![]});if(!_0x114c0f)throw new Error(_0xaeab('0x50'));if(_0x114c0f[_0xaeab('0x51')]===_0xaeab('0x4e')){var _0x385fb7=_0x204937['get']({'plain':!![]});var _0x1a026f=_0xaeab('0x52');return db[_0xaeab('0x53')]['find']({'where':{'name':_0x1a026f,'userProfileId':_0x114c0f[_0xaeab('0x54')]},'raw':!![]})['then'](function(_0x55e06f){if(_0x55e06f&&_0x55e06f[_0xaeab('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x385fb7[_0xaeab('0x2d')],'resourceId':_0x385fb7['id'],'type':_0x55e06f[_0xaeab('0x2d')],'sectionId':_0x55e06f['id']},{})[_0xaeab('0x2b')](function(){return _0x204937;});}else{return _0x204937;}})['catch'](function(_0x2c1a73){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c1a73);throw _0x2c1a73;});}return _0x204937;})['then'](respondWithResult(_0x484f38,0xc9))[_0xaeab('0x4c')](handleError(_0x484f38,null));};exports[_0xaeab('0x2a')]=function(_0x42b9cc,_0x13a1db){if(_0x42b9cc['body']['id']){delete _0x42b9cc[_0xaeab('0x4d')]['id'];}return db[_0xaeab('0x30')][_0xaeab('0x4b')]({'where':{'id':_0x42b9cc[_0xaeab('0x49')]['id']}})['then'](handleEntityNotFound(_0x13a1db,null))['then'](saveUpdates(_0x42b9cc[_0xaeab('0x4d')],null))[_0xaeab('0x2b')](respondWithResult(_0x13a1db,null))[_0xaeab('0x4c')](handleError(_0x13a1db,null));};exports[_0xaeab('0x56')]=function(_0x179c1d,_0x6531f3){var _0x27e643=_0x179c1d[_0xaeab('0x49')]['id'];var _0xffe877=[];return db[_0xaeab('0x57')][_0xaeab('0x58')](function(_0x8bff94){var _0x198f2b=_0xaeab('0x59')+_0x27e643;return db['sequelize'][_0xaeab('0x35')](_0x198f2b,{'type':db[_0xaeab('0x5a')][_0xaeab('0x5b')][_0xaeab('0x5c')],'raw':!![],'transaction':_0x8bff94})['then'](function(_0x5790f0){_0xffe877=_[_0xaeab('0x2f')](_0x5790f0,function(_0x32c452){return Number(_0x32c452[_0xaeab('0x5d')]);});})[_0xaeab('0x2b')](function(){var _0x457e7e='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x27e643;return db['sequelize']['query'](_0x457e7e,{'type':db[_0xaeab('0x5a')][_0xaeab('0x5b')][_0xaeab('0x5c')],'raw':!![],'transaction':_0x8bff94});})[_0xaeab('0x2b')](function(_0x2664f3){var _0x7e70c7=_[_0xaeab('0x2f')](_0x2664f3,function(_0x5f5c00){return Number(_0x5f5c00[_0xaeab('0x5e')]);});return db[_0xaeab('0x5f')][_0xaeab('0x56')]({'where':{'UserId':{'$in':_0xffe877},'VoiceQueueId':{'$in':_0x7e70c7}},'transaction':_0x8bff94});})[_0xaeab('0x2b')](function(){var _0x3a04a3=_0xaeab('0x60')+_0x27e643;return db[_0xaeab('0x57')][_0xaeab('0x35')](_0x3a04a3,{'type':db[_0xaeab('0x5a')]['QueryTypes'][_0xaeab('0x5c')],'raw':!![],'transaction':_0x8bff94});})[_0xaeab('0x2b')](function(_0x3f6048){var _0x2a521c=_['map'](_0x3f6048,function(_0x5d293f){return Number(_0x5d293f[_0xaeab('0x61')]);});return db[_0xaeab('0x62')]['destroy']({'where':{'UserId':{'$in':_0xffe877},'MailQueueId':{'$in':_0x2a521c}},'transaction':_0x8bff94});})[_0xaeab('0x2b')](function(){var _0x2b0b96='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x27e643;return db[_0xaeab('0x57')][_0xaeab('0x35')](_0x2b0b96,{'type':db[_0xaeab('0x5a')][_0xaeab('0x5b')][_0xaeab('0x5c')],'raw':!![],'transaction':_0x8bff94});})[_0xaeab('0x2b')](function(_0x39199b){var _0x34f832=_[_0xaeab('0x2f')](_0x39199b,function(_0x185ed5){return Number(_0x185ed5[_0xaeab('0x63')]);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0xffe877},'SmsQueueId':{'$in':_0x34f832}},'transaction':_0x8bff94});})[_0xaeab('0x2b')](function(){var _0x2043e3='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x27e643;return db['sequelize']['query'](_0x2043e3,{'type':db[_0xaeab('0x5a')]['QueryTypes'][_0xaeab('0x5c')],'raw':!![],'transaction':_0x8bff94});})[_0xaeab('0x2b')](function(_0x539aff){var _0xec1f0f=_[_0xaeab('0x2f')](_0x539aff,function(_0x4ebf64){return Number(_0x4ebf64['ChatQueueId']);});return db[_0xaeab('0x64')]['destroy']({'where':{'UserId':{'$in':_0xffe877},'ChatQueueId':{'$in':_0xec1f0f}},'transaction':_0x8bff94});})['then'](function(){var _0x3fe0b8=_0xaeab('0x65')+_0x27e643;return db[_0xaeab('0x57')][_0xaeab('0x35')](_0x3fe0b8,{'type':db[_0xaeab('0x5a')][_0xaeab('0x5b')]['SELECT'],'raw':!![],'transaction':_0x8bff94});})[_0xaeab('0x2b')](function(_0x3fb49b){var _0x3df04e=_[_0xaeab('0x2f')](_0x3fb49b,function(_0xa7c6c8){return Number(_0xa7c6c8['FaxQueueId']);});return db[_0xaeab('0x66')][_0xaeab('0x56')]({'where':{'UserId':{'$in':_0xffe877},'FaxQueueId':{'$in':_0x3df04e}},'transaction':_0x8bff94});})[_0xaeab('0x2b')](function(){var _0x369ce3='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x27e643;return db[_0xaeab('0x57')]['query'](_0x369ce3,{'type':db[_0xaeab('0x5a')][_0xaeab('0x5b')]['SELECT'],'raw':!![],'transaction':_0x8bff94});})[_0xaeab('0x2b')](function(_0x4476fe){var _0x2013de=_[_0xaeab('0x2f')](_0x4476fe,function(_0x4806ed){return Number(_0x4806ed[_0xaeab('0x67')]);});return db[_0xaeab('0x68')][_0xaeab('0x56')]({'where':{'UserId':{'$in':_0xffe877},'OpenchannelQueueId':{'$in':_0x2013de}},'transaction':_0x8bff94});})[_0xaeab('0x2b')](function(){var _0x346d83=_0xaeab('0x69')+_0x27e643;return db['sequelize'][_0xaeab('0x35')](_0x346d83,{'type':db['Sequelize'][_0xaeab('0x5b')][_0xaeab('0x5c')],'raw':!![],'transaction':_0x8bff94});})[_0xaeab('0x2b')](function(_0x546c6b){var _0x30205f=_[_0xaeab('0x2f')](_0x546c6b,function(_0x52e3b8){return Number(_0x52e3b8[_0xaeab('0x6a')]);});return db[_0xaeab('0x6b')][_0xaeab('0x56')]({'where':{'UserId':{'$in':_0xffe877},'WhatsappQueueId':{'$in':_0x30205f}},'transaction':_0x8bff94});})['then'](function(){return db[_0xaeab('0x6c')][_0xaeab('0x4b')]({'where':{'TeamId':_0x27e643}});})['then'](function(_0x39196e){if(_0x39196e===null){return;}return db['UserVoicePrefix']['destroy']({'where':{'UserId':{'$in':_0xffe877},'VoicePrefixId':_0x39196e[_0xaeab('0x6d')]},'transaction':_0x8bff94});})[_0xaeab('0x2b')](function(){return db['Team'][_0xaeab('0x56')]({'where':{'id':_0x27e643},'cascade':!![],'transaction':_0x8bff94});})['then'](function(_0x4eeecc){if(_0x4eeecc===0x0){_0x6531f3[_0xaeab('0x1e')](0x194);}else{return db['UserProfileResource'][_0xaeab('0x56')]({'where':{'type':_0xaeab('0x52'),'resourceId':_0x27e643},'cascade':!![],'transaction':_0x8bff94})[_0xaeab('0x2b')](function(){_0x6531f3['status'](0xcc)[_0xaeab('0x1f')]();});}})['catch'](function(_0x15ff7a){_0x6531f3[_0xaeab('0x25')](0x1f4)[_0xaeab('0x2e')](_0x15ff7a);});});};exports[_0xaeab('0x6e')]=function(_0x3f9c46,_0x42fcce,_0x199bf6){return db['Team'][_0xaeab('0x6f')]({'where':{'id':_0x3f9c46[_0xaeab('0x49')]['id']}})[_0xaeab('0x2b')](handleEntityNotFound(_0x42fcce,null))[_0xaeab('0x2b')](function(_0x21ee7f){if(!_0x3f9c46['query'][_0xaeab('0x70')]||!utils[_0xaeab('0x71')](_0x3f9c46[_0xaeab('0x35')][_0xaeab('0x70')])){throw new db[(_0xaeab('0x5a'))][(_0xaeab('0x72'))]('Unknown\x20channel');}var _0x441734={};var _0x31869e={};_0x31869e['model']=_[_0xaeab('0x36')](db[_[_0xaeab('0x73')](_0x3f9c46[_0xaeab('0x35')]['channel'][_0xaeab('0x74')]())+_0xaeab('0x75')][_0xaeab('0x31')]);_0x31869e['query']=_[_0xaeab('0x36')](_0x3f9c46[_0xaeab('0x35')]);_0x31869e[_0xaeab('0x37')]=_[_0xaeab('0x38')](_0x31869e[_0xaeab('0x34')],_0x31869e['query']);_0x441734[_0xaeab('0x39')]=_['intersection'](_0x31869e['model'],qs[_0xaeab('0x3a')](_0x3f9c46[_0xaeab('0x35')][_0xaeab('0x3a')]));_0x441734['attributes']=_0x441734[_0xaeab('0x39')]['length']?_0x441734[_0xaeab('0x39')]:_0x31869e[_0xaeab('0x34')];_0x441734[_0xaeab('0x23')]=qs[_0xaeab('0x23')](_0x3f9c46[_0xaeab('0x35')]['limit']);_0x441734[_0xaeab('0x21')]=qs[_0xaeab('0x21')](_0x3f9c46[_0xaeab('0x35')][_0xaeab('0x21')]);_0x441734[_0xaeab('0x3d')]=qs[_0xaeab('0x3e')](_0x3f9c46[_0xaeab('0x35')]['sort']);_0x441734['where']=qs[_0xaeab('0x37')](_[_0xaeab('0x76')](_0x3f9c46[_0xaeab('0x35')],_0x31869e[_0xaeab('0x37')]));_0x441734=_['merge']({},_0x441734,_0x3f9c46[_0xaeab('0x44')]);return _0x21ee7f[_0xaeab('0x4f')+_[_0xaeab('0x73')](_0x3f9c46[_0xaeab('0x35')][_0xaeab('0x70')]['toLowerCase']())+_0xaeab('0x77')](_0x441734);})[_0xaeab('0x2b')](respondWithResult(_0x42fcce,null))[_0xaeab('0x4c')](handleError(_0x42fcce,null));};exports[_0xaeab('0x78')]=function(_0x2010f8,_0x38481d,_0x26cafd){return db[_0xaeab('0x30')][_0xaeab('0x6f')]({'where':{'id':_0x2010f8['params']['id']}})[_0xaeab('0x2b')](function(_0x292dcd){if(_0x292dcd){if(!_0x2010f8['body'][_0xaeab('0x70')]||!utils[_0xaeab('0x71')](_0x2010f8[_0xaeab('0x4d')][_0xaeab('0x70')])){throw new db[(_0xaeab('0x5a'))]['ValidationError'](_0xaeab('0x79'));}return _0x292dcd['add'+_[_0xaeab('0x73')](_0x2010f8[_0xaeab('0x4d')][_0xaeab('0x70')][_0xaeab('0x74')]())+_0xaeab('0x77')](_0x2010f8[_0xaeab('0x4d')][_0xaeab('0x7a')]);}return null;})['then'](handleEntityNotFound(_0x38481d,null))['then'](respondWithStatusCode(_0x38481d,null))[_0xaeab('0x4c')](handleError(_0x38481d,null));};exports[_0xaeab('0x7b')]=function(_0x57b08f,_0x4f2320,_0x1cdfa3){return db[_0xaeab('0x30')][_0xaeab('0x6f')]({'where':{'id':_0x57b08f['params']['id']}})[_0xaeab('0x2b')](function(_0x4be61e){if(_0x4be61e){if(!_0x57b08f[_0xaeab('0x35')]['channel']||!utils[_0xaeab('0x71')](_0x57b08f[_0xaeab('0x35')][_0xaeab('0x70')])){throw new db[(_0xaeab('0x5a'))][(_0xaeab('0x72'))](_0xaeab('0x79'));}return _0x4be61e['remove'+_['capitalize'](_0x57b08f[_0xaeab('0x35')][_0xaeab('0x70')][_0xaeab('0x74')]())+_0xaeab('0x77')](_0x57b08f[_0xaeab('0x35')]['ids']);}return null;})['then'](handleEntityNotFound(_0x4f2320,null))[_0xaeab('0x2b')](respondWithStatusCode(_0x4f2320,null))[_0xaeab('0x4c')](handleError(_0x4f2320,null));};exports['addAgents']=function(_0x40a621,_0x4f0742){var _0x432296=_['isArray'](_0x40a621[_0xaeab('0x4d')][_0xaeab('0x7a')])?_0x40a621[_0xaeab('0x4d')][_0xaeab('0x7a')]:[_0x40a621[_0xaeab('0x4d')][_0xaeab('0x7a')]];var _0x220002=_0x40a621[_0xaeab('0x49')]['id'];return db[_0xaeab('0x30')][_0xaeab('0x4b')]({'where':{'id':_0x220002}})[_0xaeab('0x2b')](handleEntityNotFound(_0x4f0742,null))[_0xaeab('0x2b')](function(_0x21950b){if(_0x21950b){var _0xfa6b0b=[_0xaeab('0x7c'),_0xaeab('0x7d'),'Mail',_0xaeab('0x7e'),_0xaeab('0x7f'),'Openchannel','Whatsapp'];return db[_0xaeab('0x57')][_0xaeab('0x58')](function(_0x596874){var _0x51f865=_['map'](_0xfa6b0b,function(_0x5eb786){var _0x3e5bb2={'attributes':['id',_0xaeab('0x2d')]};if(_0x5eb786===_0xaeab('0x7c')){_0x3e5bb2[_0xaeab('0x80')]={'attributes':[_0xaeab('0x81')]};}return _0x21950b[_0xaeab('0x4f')+_0x5eb786+_0xaeab('0x77')](_0x3e5bb2)['then'](function(_0x431a4e){var _0x3b3293=_['map'](_0x431a4e,function(_0x152384){var _0x285d16=_['map'](_0x432296,function(_0x52d989){var _0x321c13={'where':{'UserId':_0x52d989,[_0x5eb786+_0xaeab('0x82')]:_0x152384['id']},'transaction':_0x596874};if(_0x5eb786==='Voice'){_0x321c13['defaults']={'penalty':_0x152384[_0xaeab('0x83')]['penalty']};}return db[_0xaeab('0x84')+_0x5eb786+'Queue'][_0xaeab('0x85')](_0x321c13)[_0xaeab('0x2b')](function(){socket['emit']('user'+_0x5eb786+_0xaeab('0x86'),{'UserId':_0x52d989,[_0x5eb786+_0xaeab('0x82')]:_0x152384['id']});if(_0x5eb786!==_0xaeab('0x7c')){return;}return db['User'][_0xaeab('0x46')]({'where':{'id':_0x432296,'online':0x1},'attributes':['id','name',_0xaeab('0x87'),_0xaeab('0x88'),'interface'],'raw':!![]})[_0xaeab('0x2b')](function(_0x382fa6){var _0x2ac0ea=_[_0xaeab('0x2f')](_0x382fa6,function(_0x1c7916){return db[_0xaeab('0x89')][_0xaeab('0x8a')]({'membername':_0x1c7916[_0xaeab('0x2d')],'UserId':_0x1c7916['id'],'queue_name':_0x152384[_0xaeab('0x2d')],'VoiceQueueId':_0x152384['id'],'interface':_[_0xaeab('0x8b')](_0x1c7916['interface'])?util[_0xaeab('0x8c')](_0xaeab('0x8d'),_0x1c7916[_0xaeab('0x2d')]):_0x1c7916[_0xaeab('0x8e')],'paused':_0x1c7916['voicePause']||![],'penalty':_0x152384[_0xaeab('0x83')][_0xaeab('0x81')]},{'transaction':_0x596874});});return Promise[_0xaeab('0x8f')](_0x2ac0ea);});});});return Promise[_0xaeab('0x8f')](_0x285d16);});return Promise[_0xaeab('0x8f')](_0x3b3293);})['then'](function(){return db[_0xaeab('0x6c')][_0xaeab('0x6f')]({'where':{'teamId':_0x220002}})[_0xaeab('0x2b')](function(_0x34f493){if(_0x34f493){var _0x304332=_[_0xaeab('0x2f')](_0x432296,function(_0x138804){db[_0xaeab('0x90')]['upsert']({'UserId':_0x138804,'VoicePrefixId':_0x34f493[_0xaeab('0x6d')]});});return Promise['all'](_0x304332);}});});});return Promise[_0xaeab('0x8f')](_0x51f865)[_0xaeab('0x2b')](function(){return _0x21950b['addAgents'](_0x432296,{'transaction':_0x596874})['spread'](function(_0x1d8fee){return _0x1d8fee;});});});}})['then'](respondWithResult(_0x4f0742,null))[_0xaeab('0x4c')](handleError(_0x4f0742,null));};exports['removeAgents']=function(_0x2dd9e1,_0x1ae8db){var _0x2efbe7=_[_0xaeab('0x91')](_0x2dd9e1[_0xaeab('0x35')][_0xaeab('0x7a')])?_0x2dd9e1[_0xaeab('0x35')]['ids']:[_0x2dd9e1[_0xaeab('0x35')][_0xaeab('0x7a')]];var _0x4ea843=_0x2dd9e1['params']['id'];return db['Team'][_0xaeab('0x4b')]({'where':{'id':_0x4ea843}})[_0xaeab('0x2b')](handleEntityNotFound(_0x1ae8db,null))[_0xaeab('0x2b')](function(_0xe9dcde){if(_0xe9dcde){var _0x2202da=[_0xaeab('0x7c'),_0xaeab('0x7d'),_0xaeab('0x92'),'Sms',_0xaeab('0x7f'),'Openchannel',_0xaeab('0x93')];return db[_0xaeab('0x57')][_0xaeab('0x58')](function(_0x263de2){var _0x2ebf7e=_[_0xaeab('0x2f')](_0x2202da,function(_0x58acf1){var _0x1c8efe={'attributes':['id','name']};return _0xe9dcde[_0xaeab('0x4f')+_0x58acf1+'Queues'](_0x1c8efe)[_0xaeab('0x2b')](function(_0x5b075c){var _0x539579=_[_0xaeab('0x2f')](_0x5b075c,function(_0x1cdd8f){return _0x1cdd8f[_0xaeab('0x94')](_0x2efbe7,{'transaction':_0x263de2})[_0xaeab('0x2b')](function(){var _0x5c633f=_[_0xaeab('0x2f')](_0x2efbe7,function(_0x3cc099){socket[_0xaeab('0x95')](_0xaeab('0x4e')+_0x58acf1+_0xaeab('0x96'),{'UserId':Number(_0x3cc099),[_0x58acf1+_0xaeab('0x82')]:_0x1cdd8f['id']});if(_0x58acf1!==_0xaeab('0x7c')){return;}return db['UserVoiceQueueRt'][_0xaeab('0x56')]({'where':{'VoiceQueueId':_0x1cdd8f['id'],'UserId':_0x3cc099},'transaction':_0x263de2});});return Promise[_0xaeab('0x8f')](_0x5c633f);});});return Promise['all'](_0x539579);});});return Promise['all'](_0x2ebf7e)[_0xaeab('0x2b')](function(){return _0xe9dcde[_0xaeab('0x94')](_0x2efbe7,{'transaction':_0x263de2});})[_0xaeab('0x2b')](function(){return db[_0xaeab('0x6c')][_0xaeab('0x6f')]({'where':{'teamId':_0x4ea843}})['then'](function(_0x3c629d){if(_0x3c629d){var _0x19e389=_[_0xaeab('0x2f')](_0x2efbe7,function(_0x12cc06){db[_0xaeab('0x90')]['destroy']({'where':{'UserId':_0x12cc06,'VoicePrefixId':_0x3c629d[_0xaeab('0x6d')]}});});return Promise[_0xaeab('0x8f')](_0x19e389);}});});});}})[_0xaeab('0x2b')](respondWithStatusCode(_0x1ae8db,null))[_0xaeab('0x4c')](handleError(_0x1ae8db,null));};exports[_0xaeab('0x97')]=function(_0x551416,_0x405f2f,_0x58521c){var _0xe74332={};var _0x189cde={};var _0x42f048;var _0x58e581;return db['Team'][_0xaeab('0x6f')]({'where':{'id':_0x551416[_0xaeab('0x49')]['id']}})['then'](handleEntityNotFound(_0x405f2f,null))['then'](function(_0x562511){if(_0x562511){_0x42f048=_0x562511;_0x189cde[_0xaeab('0x34')]=_[_0xaeab('0x36')](db[_0xaeab('0x84')][_0xaeab('0x31')]);_0x189cde['query']=_[_0xaeab('0x36')](_0x551416[_0xaeab('0x35')]);_0x189cde[_0xaeab('0x37')]=_[_0xaeab('0x38')](_0x189cde[_0xaeab('0x34')],_0x189cde[_0xaeab('0x35')]);_0xe74332['attributes']=_[_0xaeab('0x38')](_0x189cde[_0xaeab('0x34')],qs[_0xaeab('0x3a')](_0x551416[_0xaeab('0x35')][_0xaeab('0x3a')]));_0xe74332[_0xaeab('0x39')]=_0xe74332[_0xaeab('0x39')][_0xaeab('0x3b')]?_0xe74332[_0xaeab('0x39')]:_0x189cde[_0xaeab('0x34')];_0xe74332[_0xaeab('0x3d')]=qs[_0xaeab('0x3e')](_0x551416[_0xaeab('0x35')][_0xaeab('0x3e')]);_0xe74332[_0xaeab('0x3f')]=qs['filters'](_['pick'](_0x551416[_0xaeab('0x35')],_0x189cde[_0xaeab('0x37')]));if(_0x551416[_0xaeab('0x35')][_0xaeab('0x40')]){_0xe74332[_0xaeab('0x3f')]=_['merge'](_0xe74332[_0xaeab('0x3f')],{'$or':_[_0xaeab('0x2f')](_0xe74332['attributes'],function(_0x35ddb3){var _0x916c14={};_0x916c14[_0x35ddb3]={'$like':'%'+_0x551416[_0xaeab('0x35')]['filter']+'%'};return _0x916c14;})});}_0xe74332=_['merge']({},_0xe74332,_0x551416[_0xaeab('0x44')]);return _0x42f048[_0xaeab('0x97')](_0xe74332);}})[_0xaeab('0x2b')](function(_0x19f64c){if(_0x19f64c){_0x58e581=_0x19f64c[_0xaeab('0x3b')];if(!_0x551416['query'][_0xaeab('0x98')](_0xaeab('0x3c'))){_0xe74332['limit']=qs[_0xaeab('0x23')](_0x551416[_0xaeab('0x35')]['limit']);_0xe74332['offset']=qs[_0xaeab('0x21')](_0x551416[_0xaeab('0x35')][_0xaeab('0x21')]);}return _0x42f048[_0xaeab('0x97')](_0xe74332);}})[_0xaeab('0x2b')](function(_0x31e684){if(_0x31e684){return _0x31e684?{'count':_0x58e581,'rows':_0x31e684}:null;}})[_0xaeab('0x2b')](respondWithResult(_0x405f2f,null))[_0xaeab('0x4c')](handleError(_0x405f2f,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index c0dbfdf..9a2fa26 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 _0x8923=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x203746,_0x1492e2){var _0x26b3ee=function(_0x2942fa){while(--_0x2942fa){_0x203746['push'](_0x203746['shift']());}};_0x26b3ee(++_0x1492e2);}(_0x8923,0x7e));var _0x3892=function(_0x18a7a9,_0x3eeaab){_0x18a7a9=_0x18a7a9-0x0;var _0x2c4c7a=_0x8923[_0x18a7a9];return _0x2c4c7a;};'use strict';var EventEmitter=require(_0x3892('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x3892('0x1')](0x0);var events={'afterCreate':_0x3892('0x2'),'afterUpdate':_0x3892('0x3'),'afterDestroy':_0x3892('0x4')};function emitEvent(_0x284992){return function(_0x27bb98,_0x2a061f,_0xfa576d){TeamEvents[_0x3892('0x5')](_0x284992+':'+_0x27bb98['id'],_0x27bb98);TeamEvents[_0x3892('0x5')](_0x284992,_0x27bb98);_0xfa576d(null);};}for(var e in events){if(events[_0x3892('0x6')](e)){var event=events[e];Team[_0x3892('0x7')](e,emitEvent(event));}}module[_0x3892('0x8')]=TeamEvents; \ No newline at end of file +var _0x85b8=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x5341ff,_0x1de6df){var _0x53be58=function(_0x4da0da){while(--_0x4da0da){_0x5341ff['push'](_0x5341ff['shift']());}};_0x53be58(++_0x1de6df);}(_0x85b8,0xc3));var _0x885b=function(_0x2688d8,_0x3f599e){_0x2688d8=_0x2688d8-0x0;var _0x4640ca=_0x85b8[_0x2688d8];return _0x4640ca;};'use strict';var EventEmitter=require(_0x885b('0x0'));var Team=require(_0x885b('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x885b('0x2')](0x0);var events={'afterCreate':_0x885b('0x3'),'afterUpdate':_0x885b('0x4'),'afterDestroy':_0x885b('0x5')};function emitEvent(_0x1c63dd){return function(_0x3a3674,_0x2b3a9f,_0x5a27e8){TeamEvents[_0x885b('0x6')](_0x1c63dd+':'+_0x3a3674['id'],_0x3a3674);TeamEvents[_0x885b('0x6')](_0x1c63dd,_0x3a3674);_0x5a27e8(null);};}for(var e in events){if(events[_0x885b('0x7')](e)){var event=events[e];Team[_0x885b('0x8')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 32b9f02..918c33f 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 _0xc11f=['define','Team','teams','Chat','Fax','Openchannel','Sms','Voice','resolve','all','lodash','./team.attributes','get','Queues','then','map','setDataValue','catch','exports'];(function(_0x5e9c5c,_0x30c837){var _0x323ea5=function(_0x57e328){while(--_0x57e328){_0x5e9c5c['push'](_0x5e9c5c['shift']());}};_0x323ea5(++_0x30c837);}(_0xc11f,0x1d2));var _0xfc11=function(_0x10bad1,_0x71f4cd){_0x10bad1=_0x10bad1-0x0;var _0x268526=_0xc11f[_0x10bad1];return _0x268526;};'use strict';var _=require(_0xfc11('0x0'));var attributes=require(_0xfc11('0x1'));function getQueuesByChannel(_0x15ac2e,_0x29ed81){var _0x76e314=_0xfc11('0x2')+_0x29ed81+_0xfc11('0x3');return _0x15ac2e[_0x76e314]()[_0xfc11('0x4')](function(_0x3d8f1a){return _[_0xfc11('0x5')](_0x3d8f1a,function(_0x271857){_0x271857[_0xfc11('0x6')]('channel',_0x29ed81);return _0x271857;});})[_0xfc11('0x7')](function(_0x4bf9b1){throw _0x4bf9b1;});}module[_0xfc11('0x8')]=function(_0x17e650){return _0x17e650[_0xfc11('0x9')](_0xfc11('0xa'),attributes,{'tableName':_0xfc11('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x31b9dd=this;var _0x444bc8=[_0xfc11('0xc'),_0xfc11('0xd'),'Mail',_0xfc11('0xe'),_0xfc11('0xf'),_0xfc11('0x10'),'Whatsapp'];return Promise[_0xfc11('0x11')]()['then'](function(){var _0x27cc17=_[_0xfc11('0x5')](_0x444bc8,function(_0xbd62df){return getQueuesByChannel(_0x31b9dd,_0xbd62df);});return Promise[_0xfc11('0x12')](_0x27cc17);})[_0xfc11('0x7')](function(_0x37eba9){throw _0x37eba9;});}}});}; \ No newline at end of file +var _0xa416=['exports','Team','teams','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','all','lodash','./team.attributes','get','Queues','then','map','setDataValue','channel','catch'];(function(_0x439499,_0x218449){var _0x1942e8=function(_0x20a585){while(--_0x20a585){_0x439499['push'](_0x439499['shift']());}};_0x1942e8(++_0x218449);}(_0xa416,0x123));var _0x6a41=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa416[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6a41('0x0'));var attributes=require(_0x6a41('0x1'));function getQueuesByChannel(_0x2322b1,_0x100419){var _0x293b6d=_0x6a41('0x2')+_0x100419+_0x6a41('0x3');return _0x2322b1[_0x293b6d]()[_0x6a41('0x4')](function(_0x10dabb){return _[_0x6a41('0x5')](_0x10dabb,function(_0xe0642a){_0xe0642a[_0x6a41('0x6')](_0x6a41('0x7'),_0x100419);return _0xe0642a;});})[_0x6a41('0x8')](function(_0x13cb13){throw _0x13cb13;});}module[_0x6a41('0x9')]=function(_0x1ec1a0){return _0x1ec1a0['define'](_0x6a41('0xa'),attributes,{'tableName':_0x6a41('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x374058=this;var _0x2cc423=['Chat',_0x6a41('0xc'),_0x6a41('0xd'),_0x6a41('0xe'),_0x6a41('0xf'),_0x6a41('0x10'),_0x6a41('0x11')];return Promise[_0x6a41('0x12')]()[_0x6a41('0x4')](function(){var _0x572ca4=_['map'](_0x2cc423,function(_0x477a2c){return getQueuesByChannel(_0x374058,_0x477a2c);});return Promise[_0x6a41('0x13')](_0x572ca4);})[_0x6a41('0x8')](function(_0xd12d47){throw _0xd12d47;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 4157e95..db4f4d1 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 _0xcbdd=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x53ca94,_0x4b231b){var _0x47ee1d=function(_0x4d6723){while(--_0x4d6723){_0x53ca94['push'](_0x53ca94['shift']());}};_0x47ee1d(++_0x4b231b);}(_0xcbdd,0xa8));var _0xdcbd=function(_0xe1650a,_0x112d11){_0xe1650a=_0xe1650a-0x0;var _0x77bcec=_0xcbdd[_0xe1650a];return _0x77bcec;};'use strict';var _=require(_0xdcbd('0x0'));var util=require(_0xdcbd('0x1'));var moment=require(_0xdcbd('0x2'));var BPromise=require(_0xdcbd('0x3'));var rs=require(_0xdcbd('0x4'));var fs=require('fs');var Redis=require(_0xdcbd('0x5'));var db=require(_0xdcbd('0x6'))['db'];var utils=require(_0xdcbd('0x7'));var logger=require(_0xdcbd('0x8'))('rpc');var config=require(_0xdcbd('0x9'));var jayson=require(_0xdcbd('0xa'));var client=jayson[_0xdcbd('0xb')]['http']({'port':0x232a});config[_0xdcbd('0xc')]=_[_0xdcbd('0xd')](config[_0xdcbd('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdcbd('0xc')]));require(_0xdcbd('0xe'))[_0xdcbd('0xf')](socket);function respondWithRpcPromise(_0x529165,_0x58cf5b,_0x4c1941){return new BPromise(function(_0x38bb39,_0x14b2ad){return client[_0xdcbd('0x10')](_0x529165,_0x4c1941)[_0xdcbd('0x11')](function(_0x55ad87){logger['info'](_0xdcbd('0x12'),_0x58cf5b,_0xdcbd('0x13'));logger[_0xdcbd('0x14')](_0xdcbd('0x15'),_0x58cf5b,_0xdcbd('0x13'),JSON[_0xdcbd('0x16')](_0x55ad87));if(_0x55ad87[_0xdcbd('0x17')]){if(_0x55ad87[_0xdcbd('0x17')]['code']===0x1f4){logger[_0xdcbd('0x17')](_0xdcbd('0x12'),_0x58cf5b,_0x55ad87[_0xdcbd('0x17')][_0xdcbd('0x18')]);return _0x14b2ad(_0x55ad87['error'][_0xdcbd('0x18')]);}logger[_0xdcbd('0x17')](_0xdcbd('0x12'),_0x58cf5b,_0x55ad87[_0xdcbd('0x17')][_0xdcbd('0x18')]);return _0x38bb39(_0x55ad87[_0xdcbd('0x17')][_0xdcbd('0x18')]);}else{logger[_0xdcbd('0x19')]('Team,\x20%s,\x20%s',_0x58cf5b,_0xdcbd('0x13'));_0x38bb39(_0x55ad87[_0xdcbd('0x1a')][_0xdcbd('0x18')]);}})[_0xdcbd('0x1b')](function(_0x1c6956){logger[_0xdcbd('0x17')](_0xdcbd('0x12'),_0x58cf5b,_0x1c6956);_0x14b2ad(_0x1c6956);});});} \ No newline at end of file +var _0x819b=['Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Team,\x20%s,\x20%s','message','info','result','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./team.socket','then','debug'];(function(_0x35e92e,_0x21581b){var _0x1205a8=function(_0x4325d8){while(--_0x4325d8){_0x35e92e['push'](_0x35e92e['shift']());}};_0x1205a8(++_0x21581b);}(_0x819b,0xa5));var _0xb819=function(_0x356b7a,_0x34f197){_0x356b7a=_0x356b7a-0x0;var _0x24bc41=_0x819b[_0x356b7a];return _0x24bc41;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb819('0x0'));var BPromise=require(_0xb819('0x1'));var rs=require(_0xb819('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb819('0x3'))['db'];var utils=require(_0xb819('0x4'));var logger=require(_0xb819('0x5'))(_0xb819('0x6'));var config=require('../../config/environment');var jayson=require(_0xb819('0x7'));var client=jayson[_0xb819('0x8')][_0xb819('0x9')]({'port':0x232a});config['redis']=_[_0xb819('0xa')](config[_0xb819('0xb')],{'host':_0xb819('0xc'),'port':0x18eb});var socket=require(_0xb819('0xd'))(new Redis(config[_0xb819('0xb')]));require(_0xb819('0xe'))['register'](socket);function respondWithRpcPromise(_0x181688,_0x4945f1,_0x8d665c){return new BPromise(function(_0x1546ba,_0x44fb6d){return client['request'](_0x181688,_0x8d665c)[_0xb819('0xf')](function(_0x95f819){logger['info']('Team,\x20%s,\x20%s',_0x4945f1,'request\x20sent');logger[_0xb819('0x10')](_0xb819('0x11'),_0x4945f1,_0xb819('0x12'),JSON[_0xb819('0x13')](_0x95f819));if(_0x95f819['error']){if(_0x95f819[_0xb819('0x14')][_0xb819('0x15')]===0x1f4){logger[_0xb819('0x14')](_0xb819('0x16'),_0x4945f1,_0x95f819[_0xb819('0x14')][_0xb819('0x17')]);return _0x44fb6d(_0x95f819[_0xb819('0x14')][_0xb819('0x17')]);}logger[_0xb819('0x14')]('Team,\x20%s,\x20%s',_0x4945f1,_0x95f819[_0xb819('0x14')]['message']);return _0x1546ba(_0x95f819[_0xb819('0x14')][_0xb819('0x17')]);}else{logger[_0xb819('0x18')]('Team,\x20%s,\x20%s',_0x4945f1,_0xb819('0x12'));_0x1546ba(_0x95f819[_0xb819('0x19')][_0xb819('0x17')]);}})['catch'](function(_0xddcb75){logger[_0xb819('0x14')](_0xb819('0x16'),_0x4945f1,_0xddcb75);_0x44fb6d(_0xddcb75);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index ce2f973..e802add 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 _0x2884=['register','length','team:','./team.events','remove','update','emit','removeListener'];(function(_0xe192e0,_0x305cb0){var _0xb8ff84=function(_0xc87633){while(--_0xc87633){_0xe192e0['push'](_0xe192e0['shift']());}};_0xb8ff84(++_0x305cb0);}(_0x2884,0x1eb));var _0x4288=function(_0x392be3,_0xf1d603){_0x392be3=_0x392be3-0x0;var _0x1453b2=_0x2884[_0x392be3];return _0x1453b2;};'use strict';var TeamEvents=require(_0x4288('0x0'));var events=['save',_0x4288('0x1'),_0x4288('0x2')];function createListener(_0x25fbd8,_0x495f38){return function(_0x2a7195){_0x495f38[_0x4288('0x3')](_0x25fbd8,_0x2a7195);};}function removeListener(_0x50417e,_0x4b2323){return function(){TeamEvents[_0x4288('0x4')](_0x50417e,_0x4b2323);};}exports[_0x4288('0x5')]=function(_0x3d67f7){for(var _0x59dffa=0x0,_0x526a07=events[_0x4288('0x6')];_0x59dffa<_0x526a07;_0x59dffa++){var _0x5e4cfc=events[_0x59dffa];var _0x25023a=createListener(_0x4288('0x7')+_0x5e4cfc,_0x3d67f7);TeamEvents['on'](_0x5e4cfc,_0x25023a);}}; \ No newline at end of file +var _0x7006=['remove','update','register','team:','./team.events','save'];(function(_0x112758,_0xe31002){var _0x51d236=function(_0x5ddb8e){while(--_0x5ddb8e){_0x112758['push'](_0x112758['shift']());}};_0x51d236(++_0xe31002);}(_0x7006,0xe8));var _0x6700=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0x7006[_0x2d89ce];return _0x3fad10;};'use strict';var TeamEvents=require(_0x6700('0x0'));var events=[_0x6700('0x1'),_0x6700('0x2'),_0x6700('0x3')];function createListener(_0x172223,_0x36b0b9){return function(_0x4372eb){_0x36b0b9['emit'](_0x172223,_0x4372eb);};}function removeListener(_0x527c05,_0x3f0787){return function(){TeamEvents['removeListener'](_0x527c05,_0x3f0787);};}exports[_0x6700('0x4')]=function(_0x1032f8){for(var _0xead547=0x0,_0x1461af=events['length'];_0xead547<_0x1461af;_0xead547++){var _0xd9c345=events[_0xead547];var _0x4d34f=createListener(_0x6700('0x5')+_0xd9c345,_0x1032f8);TeamEvents['on'](_0xd9c345,_0x4d34f);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index e184c46..f2f6743 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 _0x6c76=['INTEGER','sequelize','exports'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x6c76,0x184));var _0x66c7=function(_0x2af36b,_0x4f8be0){_0x2af36b=_0x2af36b-0x0;var _0x430391=_0x6c76[_0x2af36b];return _0x430391;};'use strict';var Sequelize=require(_0x66c7('0x0'));module[_0x66c7('0x1')]={'TeamId':{'type':Sequelize[_0x66c7('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xdb76=['exports','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb76,0x1be));var _0x6db7=function(_0x386854,_0x228d04){_0x386854=_0x386854-0x0;var _0x5ce28c=_0xdb76[_0x386854];return _0x5ce28c;};'use strict';var Sequelize=require(_0x6db7('0x0'));module[_0x6db7('0x1')]={'TeamId':{'type':Sequelize[_0x6db7('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x6db7('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 59eb607..885e132 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 _0xfd7b=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','TeamVoicePrefix','team_has_voice_prefixes'];(function(_0x206a1f,_0x1497dc){var _0x2db274=function(_0x33de8c){while(--_0x33de8c){_0x206a1f['push'](_0x206a1f['shift']());}};_0x2db274(++_0x1497dc);}(_0xfd7b,0xd1));var _0xbfd7=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xfd7b[_0x5037ab];return _0x512adb;};'use strict';var _=require(_0xbfd7('0x0'));var util=require(_0xbfd7('0x1'));var logger=require(_0xbfd7('0x2'))('api');var moment=require(_0xbfd7('0x3'));var BPromise=require(_0xbfd7('0x4'));var rp=require(_0xbfd7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbfd7('0x6'));var config=require(_0xbfd7('0x7'));var attributes=require(_0xbfd7('0x8'));module['exports']=function(_0x134ee5,_0x3d054f){return _0x134ee5['define'](_0xbfd7('0x9'),attributes,{'tableName':_0xbfd7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa596=['rimraf','../../config/environment','./teamVoicePrefix.attributes','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x27a73d,_0x3eb2d1){var _0x3c068f=function(_0x4dbacc){while(--_0x4dbacc){_0x27a73d['push'](_0x27a73d['shift']());}};_0x3c068f(++_0x3eb2d1);}(_0xa596,0x7b));var _0x6a59=function(_0x14c104,_0x539283){_0x14c104=_0x14c104-0x0;var _0x219f81=_0xa596[_0x14c104];return _0x219f81;};'use strict';var _=require(_0x6a59('0x0'));var util=require(_0x6a59('0x1'));var logger=require('../../config/logger')(_0x6a59('0x2'));var moment=require(_0x6a59('0x3'));var BPromise=require(_0x6a59('0x4'));var rp=require(_0x6a59('0x5'));var fs=require('fs');var path=require(_0x6a59('0x6'));var rimraf=require(_0x6a59('0x7'));var config=require(_0x6a59('0x8'));var attributes=require(_0x6a59('0x9'));module['exports']=function(_0x37d9ef,_0x3fab57){return _0x37d9ef[_0x6a59('0xa')](_0x6a59('0xb'),attributes,{'tableName':_0x6a59('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 033dc7e..1729539 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x39c208,_0x57ddee){var _0x6f0c89=function(_0x823e26){while(--_0x823e26){_0x39c208['push'](_0x39c208['shift']());}};_0x6f0c89(++_0x57ddee);}(_0x70e0,0x17b));var _0x070e=function(_0x3b0980,_0x159ae8){_0x3b0980=_0x3b0980-0x0;var _0x84db14=_0x70e0[_0x3b0980];return _0x84db14;};'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(_0x590a38,_0x2bc65c){var _0xf36626=function(_0x551cd1){while(--_0x551cd1){_0x590a38['push'](_0x590a38['shift']());}};_0xf36626(++_0x2bc65c);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 3c9e7f4..c7dac7c 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 _0xac94=['sequelize'];(function(_0x1842e4,_0x4b67d5){var _0x456a40=function(_0x5058d5){while(--_0x5058d5){_0x1842e4['push'](_0x1842e4['shift']());}};_0x456a40(++_0x4b67d5);}(_0xac94,0x11b));var _0x4ac9=function(_0x35723a,_0x46c956){_0x35723a=_0x35723a-0x0;var _0x2d8de0=_0xac94[_0x35723a];return _0x2d8de0;};'use strict';var Sequelize=require(_0x4ac9('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb00d=['sequelize'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xb00d,0x97));var _0xdb00=function(_0x2dc96f,_0x459058){_0x2dc96f=_0x2dc96f-0x0;var _0xd012da=_0xb00d[_0x2dc96f];return _0xd012da;};'use strict';var Sequelize=require(_0xdb00('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 6ca57ca..e6a0062 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 _0xe644=['path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x54f675,_0x38f8e4){var _0x354855=function(_0x398b8d){while(--_0x398b8d){_0x54f675['push'](_0x54f675['shift']());}};_0x354855(++_0x38f8e4);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4e64('0x0'));var util=require(_0x4e64('0x1'));var logger=require(_0x4e64('0x2'))(_0x4e64('0x3'));var moment=require(_0x4e64('0x4'));var BPromise=require(_0x4e64('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e64('0x6'));var rimraf=require(_0x4e64('0x7'));var config=require(_0x4e64('0x8'));var attributes=require(_0x4e64('0x9'));module[_0x4e64('0xa')]=function(_0x13fa90,_0x55c23b){return _0x13fa90[_0x4e64('0xb')](_0x4e64('0xc'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80fb=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues'];(function(_0x356bef,_0x30690c){var _0xf59506=function(_0x5addae){while(--_0x5addae){_0x356bef['push'](_0x356bef['shift']());}};_0xf59506(++_0x30690c);}(_0x80fb,0x11e));var _0xb80f=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x80fb[_0x5037ab];return _0x512adb;};'use strict';var _=require('lodash');var util=require(_0xb80f('0x0'));var logger=require(_0xb80f('0x1'))('api');var moment=require(_0xb80f('0x2'));var BPromise=require(_0xb80f('0x3'));var rp=require(_0xb80f('0x4'));var fs=require('fs');var path=require(_0xb80f('0x5'));var rimraf=require(_0xb80f('0x6'));var config=require(_0xb80f('0x7'));var attributes=require(_0xb80f('0x8'));module[_0xb80f('0x9')]=function(_0x52d81c,_0x1676a9){return _0x52d81c[_0xb80f('0xa')](_0xb80f('0xb'),attributes,{'tableName':_0xb80f('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 4617542..33f4c8a 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 _0x066a=['request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','TeamVoiceQueue,\x20%s,\x20%s'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x066a,0x9b));var _0xa066=function(_0x156027,_0x3333ae){_0x156027=_0x156027-0x0;var _0x3269cd=_0x066a[_0x156027];return _0x3269cd;};'use strict';var _=require(_0xa066('0x0'));var util=require(_0xa066('0x1'));var moment=require(_0xa066('0x2'));var BPromise=require('bluebird');var rs=require(_0xa066('0x3'));var fs=require('fs');var Redis=require(_0xa066('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa066('0x5'));var logger=require('../../config/logger')(_0xa066('0x6'));var config=require(_0xa066('0x7'));var jayson=require(_0xa066('0x8'));var client=jayson['client'][_0xa066('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf81f82,_0xd19c7a,_0x19c05b){return new BPromise(function(_0xa4c07e,_0x5a9aa1){return client['request'](_0xf81f82,_0x19c05b)[_0xa066('0xa')](function(_0x58740d){logger[_0xa066('0xb')](_0xa066('0xc'),_0xd19c7a,_0xa066('0xd'));logger[_0xa066('0xe')](_0xa066('0xf'),_0xd19c7a,_0xa066('0xd'),JSON[_0xa066('0x10')](_0x58740d));if(_0x58740d['error']){if(_0x58740d[_0xa066('0x11')]['code']===0x1f4){logger['error'](_0xa066('0xc'),_0xd19c7a,_0x58740d[_0xa066('0x11')][_0xa066('0x12')]);return _0x5a9aa1(_0x58740d['error'][_0xa066('0x12')]);}logger['error'](_0xa066('0xc'),_0xd19c7a,_0x58740d[_0xa066('0x11')]['message']);return _0xa4c07e(_0x58740d[_0xa066('0x11')][_0xa066('0x12')]);}else{logger[_0xa066('0xb')](_0xa066('0xc'),_0xd19c7a,_0xa066('0xd'));_0xa4c07e(_0x58740d[_0xa066('0x13')][_0xa066('0x12')]);}})[_0xa066('0x14')](function(_0x141b70){logger[_0xa066('0x11')](_0xa066('0xc'),_0xd19c7a,_0x141b70);_0x5a9aa1(_0x141b70);});});} \ No newline at end of file +var _0xad7c=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','TeamVoiceQueue,\x20%s,\x20%s','message'];(function(_0xc2fcdb,_0x5e225a){var _0x4d7af3=function(_0x56d8eb){while(--_0x56d8eb){_0xc2fcdb['push'](_0xc2fcdb['shift']());}};_0x4d7af3(++_0x5e225a);}(_0xad7c,0x8c));var _0xcad7=function(_0x445083,_0x2175d2){_0x445083=_0x445083-0x0;var _0x3cae84=_0xad7c[_0x445083];return _0x3cae84;};'use strict';var _=require(_0xcad7('0x0'));var util=require(_0xcad7('0x1'));var moment=require(_0xcad7('0x2'));var BPromise=require(_0xcad7('0x3'));var rs=require(_0xcad7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcad7('0x5'))['db'];var utils=require(_0xcad7('0x6'));var logger=require(_0xcad7('0x7'))(_0xcad7('0x8'));var config=require(_0xcad7('0x9'));var jayson=require(_0xcad7('0xa'));var client=jayson[_0xcad7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf9b48e,_0x1f8b66,_0x483fa0){return new BPromise(function(_0x1575a3,_0x42cfa2){return client[_0xcad7('0xc')](_0xf9b48e,_0x483fa0)[_0xcad7('0xd')](function(_0x304136){logger[_0xcad7('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1f8b66,_0xcad7('0xf'));logger[_0xcad7('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x1f8b66,_0xcad7('0xf'),JSON[_0xcad7('0x11')](_0x304136));if(_0x304136[_0xcad7('0x12')]){if(_0x304136[_0xcad7('0x12')]['code']===0x1f4){logger[_0xcad7('0x12')](_0xcad7('0x13'),_0x1f8b66,_0x304136[_0xcad7('0x12')][_0xcad7('0x14')]);return _0x42cfa2(_0x304136['error'][_0xcad7('0x14')]);}logger[_0xcad7('0x12')](_0xcad7('0x13'),_0x1f8b66,_0x304136[_0xcad7('0x12')][_0xcad7('0x14')]);return _0x1575a3(_0x304136[_0xcad7('0x12')][_0xcad7('0x14')]);}else{logger[_0xcad7('0xe')](_0xcad7('0x13'),_0x1f8b66,'request\x20sent');_0x1575a3(_0x304136[_0xcad7('0x15')][_0xcad7('0x14')]);}})[_0xcad7('0x16')](function(_0x28bd02){logger[_0xcad7('0x12')](_0xcad7('0x13'),_0x1f8b66,_0x28bd02);_0x42cfa2(_0x28bd02);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 05d94a8..b8dd4f5 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 _0x1d21=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./template.controller','get','isAuthenticated','index','/:id','post','put','update'];(function(_0x1d83db,_0x89d115){var _0x2dc1d1=function(_0x13fdc3){while(--_0x13fdc3){_0x1d83db['push'](_0x1d83db['shift']());}};_0x2dc1d1(++_0x89d115);}(_0x1d21,0x158));var _0x11d2=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0x1d21[_0x54defc];return _0x1955d3;};'use strict';var multer=require(_0x11d2('0x0'));var util=require(_0x11d2('0x1'));var path=require(_0x11d2('0x2'));var timeout=require(_0x11d2('0x3'));var express=require('express');var router=express[_0x11d2('0x4')]();var fs_extra=require(_0x11d2('0x5'));var auth=require(_0x11d2('0x6'));var interaction=require(_0x11d2('0x7'));var config=require('../../config/environment');var controller=require(_0x11d2('0x8'));router[_0x11d2('0x9')]('/',auth[_0x11d2('0xa')](),controller[_0x11d2('0xb')]);router[_0x11d2('0x9')](_0x11d2('0xc'),auth[_0x11d2('0xa')](),controller['show']);router[_0x11d2('0xd')]('/',auth[_0x11d2('0xa')](),controller['create']);router[_0x11d2('0xe')]('/:id',auth[_0x11d2('0xa')](),controller[_0x11d2('0xf')]);router['delete'](_0x11d2('0xc'),auth[_0x11d2('0xa')](),controller[_0x11d2('0x10')]);module[_0x11d2('0x11')]=router; \ No newline at end of file +var _0x1623=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./template.controller','isAuthenticated','index','/:id','show','post','create','put','delete','destroy'];(function(_0x81e39d,_0x4c3934){var _0x548fbb=function(_0x1adda5){while(--_0x1adda5){_0x81e39d['push'](_0x81e39d['shift']());}};_0x548fbb(++_0x4c3934);}(_0x1623,0xab));var _0x3162=function(_0x1ad56a,_0xcbc110){_0x1ad56a=_0x1ad56a-0x0;var _0x5de0c2=_0x1623[_0x1ad56a];return _0x5de0c2;};'use strict';var multer=require(_0x3162('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3162('0x1'));var express=require(_0x3162('0x2'));var router=express[_0x3162('0x3')]();var fs_extra=require(_0x3162('0x4'));var auth=require(_0x3162('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3162('0x6'));router['get']('/',auth[_0x3162('0x7')](),controller[_0x3162('0x8')]);router['get'](_0x3162('0x9'),auth[_0x3162('0x7')](),controller[_0x3162('0xa')]);router[_0x3162('0xb')]('/',auth[_0x3162('0x7')](),controller[_0x3162('0xc')]);router[_0x3162('0xd')](_0x3162('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x3162('0xe')](_0x3162('0x9'),auth[_0x3162('0x7')](),controller[_0x3162('0xf')]);module[_0x3162('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index a84f23c..6790911 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 _0x6c90=['TEXT','sequelize'];(function(_0x168cf3,_0x5a1e90){var _0x150de1=function(_0x338ad8){while(--_0x338ad8){_0x168cf3['push'](_0x168cf3['shift']());}};_0x150de1(++_0x5a1e90);}(_0x6c90,0xbd));var _0x06c9=function(_0x1261c5,_0x3d1757){_0x1261c5=_0x1261c5-0x0;var _0x43daa4=_0x6c90[_0x1261c5];return _0x43daa4;};'use strict';var Sequelize=require(_0x06c9('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x06c9('0x1')]}}; \ No newline at end of file +var _0xe110=['exports','STRING','TEXT','sequelize'];(function(_0x3f2e87,_0x344523){var _0x4bc2ea=function(_0x410b7b){while(--_0x410b7b){_0x3f2e87['push'](_0x3f2e87['shift']());}};_0x4bc2ea(++_0x344523);}(_0xe110,0x173));var _0x0e11=function(_0x184918,_0x5ecd23){_0x184918=_0x184918-0x0;var _0x502559=_0xe110[_0x184918];return _0x502559;};'use strict';var Sequelize=require(_0x0e11('0x0'));module[_0x0e11('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0e11('0x2')]},'html':{'type':Sequelize[_0x0e11('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 689ece9..25287ba 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 _0x00a5=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','save','then','destroy','get','Templates','UserProfileResource','stack','name','send','index','map','Template','rawAttributes','fieldName','query','keys','filters','intersection','attributes','model','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','fields','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware'];(function(_0x2582e1,_0x3ae46){var _0x5bd04d=function(_0x40a296){while(--_0x40a296){_0x2582e1['push'](_0x2582e1['shift']());}};_0x5bd04d(++_0x3ae46);}(_0x00a5,0xd2));var _0x500a=function(_0x4b3ce6,_0x34249b){_0x4b3ce6=_0x4b3ce6-0x0;var _0x6a9ce5=_0x00a5[_0x4b3ce6];return _0x6a9ce5;};'use strict';var emlformat=require(_0x500a('0x0'));var rimraf=require(_0x500a('0x1'));var zipdir=require(_0x500a('0x2'));var jsonpatch=require(_0x500a('0x3'));var rp=require(_0x500a('0x4'));var moment=require(_0x500a('0x5'));var BPromise=require(_0x500a('0x6'));var Mustache=require(_0x500a('0x7'));var util=require(_0x500a('0x8'));var path=require(_0x500a('0x9'));var sox=require('sox');var csv=require(_0x500a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x500a('0xb'));var squel=require('squel');var crypto=require(_0x500a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x500a('0xd'));var toCsv=require(_0x500a('0xa'));var querystring=require(_0x500a('0xe'));var Papa=require(_0x500a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x500a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x500a('0x11'));var logger=require(_0x500a('0x12'))(_0x500a('0x13'));var utils=require(_0x500a('0x14'));var config=require(_0x500a('0x15'));var licenseUtil=require(_0x500a('0x16'));var db=require(_0x500a('0x17'))['db'];function respondWithStatusCode(_0x4774d5,_0x187f8a){_0x187f8a=_0x187f8a||0xcc;return function(_0x5b0a82){if(_0x5b0a82){return _0x4774d5[_0x500a('0x18')](_0x187f8a);}return _0x4774d5[_0x500a('0x19')](_0x187f8a)[_0x500a('0x1a')]();};}function respondWithResult(_0x3991dd,_0x1dc646){_0x1dc646=_0x1dc646||0xc8;return function(_0x447981){if(_0x447981){return _0x3991dd[_0x500a('0x19')](_0x1dc646)[_0x500a('0x1b')](_0x447981);}};}function respondWithFilteredResult(_0x9f92a5,_0x3b3591){return function(_0x285cd2){if(_0x285cd2){var _0x202605=typeof _0x3b3591['offset']===_0x500a('0x1c')&&typeof _0x3b3591['limit']===_0x500a('0x1c');var _0x267b41=_0x285cd2[_0x500a('0x1d')];var _0x429d1c=_0x202605?0x0:_0x3b3591[_0x500a('0x1e')];var _0x39e1c7=_0x202605?_0x285cd2['count']:_0x3b3591[_0x500a('0x1e')]+_0x3b3591[_0x500a('0x1f')];var _0x142f6a;if(_0x39e1c7>=_0x267b41){_0x39e1c7=_0x267b41;_0x142f6a=0xc8;}else{_0x142f6a=0xce;}_0x9f92a5[_0x500a('0x19')](_0x142f6a);return _0x9f92a5['set'](_0x500a('0x20'),_0x429d1c+'-'+_0x39e1c7+'/'+_0x267b41)[_0x500a('0x1b')](_0x285cd2);}return null;};}function patchUpdates(_0x561771){return function(_0xd5b4e9){try{jsonpatch[_0x500a('0x21')](_0xd5b4e9,_0x561771,!![]);}catch(_0x5dbc46){return BPromise['reject'](_0x5dbc46);}return _0xd5b4e9[_0x500a('0x22')]();};}function saveUpdates(_0x55c6cf,_0x201295){return function(_0x28515b){if(_0x28515b){return _0x28515b['update'](_0x55c6cf)[_0x500a('0x23')](function(_0x2943d2){return _0x2943d2;});}return null;};}function removeEntity(_0x55681c,_0x355f19){return function(_0x5eb547){if(_0x5eb547){return _0x5eb547[_0x500a('0x24')]()[_0x500a('0x23')](function(){var _0x127f52=_0x5eb547[_0x500a('0x25')]({'plain':!![]});var _0x5ddadf=_0x500a('0x26');return db[_0x500a('0x27')][_0x500a('0x24')]({'where':{'type':_0x5ddadf,'resourceId':_0x127f52['id']}})[_0x500a('0x23')](function(){return _0x5eb547;});})[_0x500a('0x23')](function(){_0x55681c[_0x500a('0x19')](0xcc)[_0x500a('0x1a')]();});}};}function handleEntityNotFound(_0x152084,_0x2f84d5){return function(_0xd5cc62){if(!_0xd5cc62){_0x152084[_0x500a('0x18')](0x194);}return _0xd5cc62;};}function handleError(_0x4ee1df,_0x356cce){_0x356cce=_0x356cce||0x1f4;return function(_0x1e3a20){logger['error'](_0x1e3a20[_0x500a('0x28')]);if(_0x1e3a20[_0x500a('0x29')]){delete _0x1e3a20['name'];}_0x4ee1df['status'](_0x356cce)[_0x500a('0x2a')](_0x1e3a20);};}exports[_0x500a('0x2b')]=function(_0x1147b6,_0x8ddcf5){var _0x2a189d={},_0x397993={},_0x4c0c30={'count':0x0,'rows':[]};var _0x2cbce1=_[_0x500a('0x2c')](db[_0x500a('0x2d')][_0x500a('0x2e')],function(_0x539e4e){return{'name':_0x539e4e[_0x500a('0x2f')],'type':_0x539e4e['type']['key']};});_0x397993['model']=_[_0x500a('0x2c')](_0x2cbce1,_0x500a('0x29'));_0x397993[_0x500a('0x30')]=_[_0x500a('0x31')](_0x1147b6[_0x500a('0x30')]);_0x397993[_0x500a('0x32')]=_[_0x500a('0x33')](_0x397993['model'],_0x397993['query']);_0x2a189d[_0x500a('0x34')]=_[_0x500a('0x33')](_0x397993[_0x500a('0x35')],qs['fields'](_0x1147b6[_0x500a('0x30')]['fields']));_0x2a189d[_0x500a('0x34')]=_0x2a189d[_0x500a('0x34')][_0x500a('0x36')]?_0x2a189d[_0x500a('0x34')]:_0x397993[_0x500a('0x35')];if(!_0x1147b6[_0x500a('0x30')][_0x500a('0x37')](_0x500a('0x38'))){_0x2a189d[_0x500a('0x1f')]=qs[_0x500a('0x1f')](_0x1147b6[_0x500a('0x30')][_0x500a('0x1f')]);_0x2a189d['offset']=qs[_0x500a('0x1e')](_0x1147b6[_0x500a('0x30')][_0x500a('0x1e')]);}_0x2a189d['order']=qs[_0x500a('0x39')](_0x1147b6[_0x500a('0x30')]['sort']);_0x2a189d[_0x500a('0x3a')]=qs[_0x500a('0x32')](_[_0x500a('0x3b')](_0x1147b6['query'],_0x397993[_0x500a('0x32')]),_0x2cbce1);if(_0x1147b6['query'][_0x500a('0x3c')]){_0x2a189d['where']=_[_0x500a('0x3d')](_0x2a189d[_0x500a('0x3a')],{'$or':_[_0x500a('0x2c')](_0x2cbce1,function(_0x5c07ca){if(_0x5c07ca['type']!==_0x500a('0x3e')){var _0x313848={};_0x313848[_0x5c07ca[_0x500a('0x29')]]={'$like':'%'+_0x1147b6[_0x500a('0x30')][_0x500a('0x3c')]+'%'};return _0x313848;}})});}_0x2a189d=_['merge']({},_0x2a189d,_0x1147b6[_0x500a('0x3f')]);var _0x174fea={'where':_0x2a189d['where']};return db['Template'][_0x500a('0x1d')](_0x174fea)[_0x500a('0x23')](function(_0x3b1444){_0x4c0c30[_0x500a('0x1d')]=_0x3b1444;if(_0x1147b6[_0x500a('0x30')]['includeAll']){_0x2a189d[_0x500a('0x40')]=[{'all':!![]}];}return db[_0x500a('0x2d')]['findAll'](_0x2a189d);})[_0x500a('0x23')](function(_0x4c520d){_0x4c0c30['rows']=_0x4c520d;return _0x4c0c30;})[_0x500a('0x23')](respondWithFilteredResult(_0x8ddcf5,_0x2a189d))[_0x500a('0x41')](handleError(_0x8ddcf5,null));};exports[_0x500a('0x42')]=function(_0x19fe72,_0x1373e4){var _0x45c9cb={'raw':!![],'where':{'id':_0x19fe72['params']['id']}},_0x383365={};_0x383365['model']=_[_0x500a('0x31')](db[_0x500a('0x2d')][_0x500a('0x2e')]);_0x383365[_0x500a('0x30')]=_['keys'](_0x19fe72[_0x500a('0x30')]);_0x383365[_0x500a('0x32')]=_[_0x500a('0x33')](_0x383365['model'],_0x383365[_0x500a('0x30')]);_0x45c9cb[_0x500a('0x34')]=_[_0x500a('0x33')](_0x383365[_0x500a('0x35')],qs['fields'](_0x19fe72[_0x500a('0x30')][_0x500a('0x43')]));_0x45c9cb[_0x500a('0x34')]=_0x45c9cb[_0x500a('0x34')][_0x500a('0x36')]?_0x45c9cb[_0x500a('0x34')]:_0x383365[_0x500a('0x35')];if(_0x19fe72[_0x500a('0x30')][_0x500a('0x44')]){_0x45c9cb[_0x500a('0x40')]=[{'all':!![]}];}_0x45c9cb=_[_0x500a('0x3d')]({},_0x45c9cb,_0x19fe72[_0x500a('0x3f')]);return db[_0x500a('0x2d')][_0x500a('0x45')](_0x45c9cb)['then'](handleEntityNotFound(_0x1373e4,null))[_0x500a('0x23')](respondWithResult(_0x1373e4,null))[_0x500a('0x41')](handleError(_0x1373e4,null));};exports['create']=function(_0x2af7f8,_0x27d486){return db[_0x500a('0x2d')][_0x500a('0x46')](_0x2af7f8[_0x500a('0x47')],{})[_0x500a('0x23')](function(_0x406458){var _0x5c827a=_0x2af7f8['user'][_0x500a('0x25')]({'plain':!![]});if(!_0x5c827a)throw new Error(_0x500a('0x48'));if(_0x5c827a[_0x500a('0x49')]===_0x500a('0x4a')){var _0x5c79e5=_0x406458['get']({'plain':!![]});var _0x3d0186=_0x500a('0x26');return db['UserProfileSection'][_0x500a('0x45')]({'where':{'name':_0x3d0186,'userProfileId':_0x5c827a[_0x500a('0x4b')]},'raw':!![]})[_0x500a('0x23')](function(_0x345f50){if(_0x345f50&&_0x345f50['autoAssociation']===0x0){return db['UserProfileResource'][_0x500a('0x46')]({'name':_0x5c79e5[_0x500a('0x29')],'resourceId':_0x5c79e5['id'],'type':_0x345f50[_0x500a('0x29')],'sectionId':_0x345f50['id']},{})[_0x500a('0x23')](function(){return _0x406458;});}else{return _0x406458;}})[_0x500a('0x41')](function(_0x432c95){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x432c95);throw _0x432c95;});}return _0x406458;})[_0x500a('0x23')](respondWithResult(_0x27d486,0xc9))[_0x500a('0x41')](handleError(_0x27d486,null));};exports['update']=function(_0x1af56b,_0x311165){if(_0x1af56b['body']['id']){delete _0x1af56b[_0x500a('0x47')]['id'];}return db['Template']['find']({'where':{'id':_0x1af56b['params']['id']}})[_0x500a('0x23')](handleEntityNotFound(_0x311165,null))[_0x500a('0x23')](saveUpdates(_0x1af56b[_0x500a('0x47')],null))[_0x500a('0x23')](respondWithResult(_0x311165,null))['catch'](handleError(_0x311165,null));};exports[_0x500a('0x24')]=function(_0x107339,_0x2be8d0){return db[_0x500a('0x2d')][_0x500a('0x45')]({'where':{'id':_0x107339['params']['id']}})[_0x500a('0x23')](handleEntityNotFound(_0x2be8d0,null))[_0x500a('0x23')](removeEntity(_0x2be8d0,null))[_0x500a('0x41')](handleError(_0x2be8d0,null));}; \ No newline at end of file +var _0x80cf=['save','update','then','destroy','Templates','UserProfileResource','end','error','stack','name','send','map','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','type','Template','includeAll','include','rows','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','eml-format','rimraf','zip-dir','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','reject'];(function(_0x57b4f2,_0x582a17){var _0x421370=function(_0x4c7c7c){while(--_0x4c7c7c){_0x57b4f2['push'](_0x57b4f2['shift']());}};_0x421370(++_0x582a17);}(_0x80cf,0x1b8));var _0xf80c=function(_0x5b4566,_0x30cd71){_0x5b4566=_0x5b4566-0x0;var _0x13dfa5=_0x80cf[_0x5b4566];return _0x13dfa5;};'use strict';var emlformat=require(_0xf80c('0x0'));var rimraf=require(_0xf80c('0x1'));var zipdir=require(_0xf80c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf80c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf80c('0x4'));var util=require(_0xf80c('0x5'));var path=require('path');var sox=require(_0xf80c('0x6'));var csv=require(_0xf80c('0x7'));var ejs=require(_0xf80c('0x8'));var fs=require('fs');var fs_extra=require(_0xf80c('0x9'));var _=require('lodash');var squel=require(_0xf80c('0xa'));var crypto=require(_0xf80c('0xb'));var jsforce=require(_0xf80c('0xc'));var deskjs=require(_0xf80c('0xd'));var toCsv=require(_0xf80c('0x7'));var querystring=require('querystring');var Papa=require(_0xf80c('0xe'));var Redis=require(_0xf80c('0xf'));var authService=require(_0xf80c('0x10'));var qs=require(_0xf80c('0x11'));var as=require(_0xf80c('0x12'));var hardwareService=require(_0xf80c('0x13'));var logger=require(_0xf80c('0x14'))(_0xf80c('0x15'));var utils=require(_0xf80c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf80c('0x17'));var db=require(_0xf80c('0x18'))['db'];function respondWithStatusCode(_0x340bed,_0x2556d1){_0x2556d1=_0x2556d1||0xcc;return function(_0x43d812){if(_0x43d812){return _0x340bed[_0xf80c('0x19')](_0x2556d1);}return _0x340bed[_0xf80c('0x1a')](_0x2556d1)['end']();};}function respondWithResult(_0x27e321,_0x45d94){_0x45d94=_0x45d94||0xc8;return function(_0x49658f){if(_0x49658f){return _0x27e321[_0xf80c('0x1a')](_0x45d94)[_0xf80c('0x1b')](_0x49658f);}};}function respondWithFilteredResult(_0x2e60b7,_0xa388f3){return function(_0xa9df30){if(_0xa9df30){var _0x504872=typeof _0xa388f3[_0xf80c('0x1c')]==='undefined'&&typeof _0xa388f3[_0xf80c('0x1d')]===_0xf80c('0x1e');var _0x57eff7=_0xa9df30[_0xf80c('0x1f')];var _0x5bdcdc=_0x504872?0x0:_0xa388f3['offset'];var _0x433446=_0x504872?_0xa9df30[_0xf80c('0x1f')]:_0xa388f3[_0xf80c('0x1c')]+_0xa388f3[_0xf80c('0x1d')];var _0x13e129;if(_0x433446>=_0x57eff7){_0x433446=_0x57eff7;_0x13e129=0xc8;}else{_0x13e129=0xce;}_0x2e60b7['status'](_0x13e129);return _0x2e60b7[_0xf80c('0x20')]('Content-Range',_0x5bdcdc+'-'+_0x433446+'/'+_0x57eff7)[_0xf80c('0x1b')](_0xa9df30);}return null;};}function patchUpdates(_0xc89359){return function(_0x358f56){try{jsonpatch['apply'](_0x358f56,_0xc89359,!![]);}catch(_0x128c48){return BPromise[_0xf80c('0x21')](_0x128c48);}return _0x358f56[_0xf80c('0x22')]();};}function saveUpdates(_0x3cd1ac,_0x308071){return function(_0xef435c){if(_0xef435c){return _0xef435c[_0xf80c('0x23')](_0x3cd1ac)[_0xf80c('0x24')](function(_0x1f4042){return _0x1f4042;});}return null;};}function removeEntity(_0x2a0303,_0x103e7a){return function(_0x1ca00e){if(_0x1ca00e){return _0x1ca00e[_0xf80c('0x25')]()['then'](function(){var _0x47b572=_0x1ca00e['get']({'plain':!![]});var _0x304077=_0xf80c('0x26');return db[_0xf80c('0x27')][_0xf80c('0x25')]({'where':{'type':_0x304077,'resourceId':_0x47b572['id']}})[_0xf80c('0x24')](function(){return _0x1ca00e;});})['then'](function(){_0x2a0303[_0xf80c('0x1a')](0xcc)[_0xf80c('0x28')]();});}};}function handleEntityNotFound(_0x4cb503,_0x3493fa){return function(_0x3dd135){if(!_0x3dd135){_0x4cb503[_0xf80c('0x19')](0x194);}return _0x3dd135;};}function handleError(_0x514062,_0x129f4a){_0x129f4a=_0x129f4a||0x1f4;return function(_0x288104){logger[_0xf80c('0x29')](_0x288104[_0xf80c('0x2a')]);if(_0x288104[_0xf80c('0x2b')]){delete _0x288104[_0xf80c('0x2b')];}_0x514062[_0xf80c('0x1a')](_0x129f4a)[_0xf80c('0x2c')](_0x288104);};}exports['index']=function(_0x51f296,_0x2755e0){var _0x7338cf={},_0xcc7dff={},_0x357845={'count':0x0,'rows':[]};var _0x10da13=_[_0xf80c('0x2d')](db['Template']['rawAttributes'],function(_0x5d1d44){return{'name':_0x5d1d44['fieldName'],'type':_0x5d1d44['type'][_0xf80c('0x2e')]};});_0xcc7dff[_0xf80c('0x2f')]=_[_0xf80c('0x2d')](_0x10da13,'name');_0xcc7dff[_0xf80c('0x30')]=_[_0xf80c('0x31')](_0x51f296['query']);_0xcc7dff[_0xf80c('0x32')]=_[_0xf80c('0x33')](_0xcc7dff[_0xf80c('0x2f')],_0xcc7dff['query']);_0x7338cf[_0xf80c('0x34')]=_[_0xf80c('0x33')](_0xcc7dff[_0xf80c('0x2f')],qs[_0xf80c('0x35')](_0x51f296[_0xf80c('0x30')]['fields']));_0x7338cf[_0xf80c('0x34')]=_0x7338cf['attributes'][_0xf80c('0x36')]?_0x7338cf[_0xf80c('0x34')]:_0xcc7dff[_0xf80c('0x2f')];if(!_0x51f296[_0xf80c('0x30')]['hasOwnProperty']('nolimit')){_0x7338cf[_0xf80c('0x1d')]=qs['limit'](_0x51f296[_0xf80c('0x30')][_0xf80c('0x1d')]);_0x7338cf[_0xf80c('0x1c')]=qs[_0xf80c('0x1c')](_0x51f296[_0xf80c('0x30')][_0xf80c('0x1c')]);}_0x7338cf[_0xf80c('0x37')]=qs[_0xf80c('0x38')](_0x51f296[_0xf80c('0x30')]['sort']);_0x7338cf[_0xf80c('0x39')]=qs[_0xf80c('0x32')](_[_0xf80c('0x3a')](_0x51f296[_0xf80c('0x30')],_0xcc7dff[_0xf80c('0x32')]),_0x10da13);if(_0x51f296['query'][_0xf80c('0x3b')]){_0x7338cf[_0xf80c('0x39')]=_[_0xf80c('0x3c')](_0x7338cf[_0xf80c('0x39')],{'$or':_[_0xf80c('0x2d')](_0x10da13,function(_0x1bdb8d){if(_0x1bdb8d[_0xf80c('0x3d')]!=='VIRTUAL'){var _0x2eb205={};_0x2eb205[_0x1bdb8d[_0xf80c('0x2b')]]={'$like':'%'+_0x51f296[_0xf80c('0x30')]['filter']+'%'};return _0x2eb205;}})});}_0x7338cf=_[_0xf80c('0x3c')]({},_0x7338cf,_0x51f296['options']);var _0xa9a75e={'where':_0x7338cf[_0xf80c('0x39')]};return db[_0xf80c('0x3e')][_0xf80c('0x1f')](_0xa9a75e)[_0xf80c('0x24')](function(_0x1fc59e){_0x357845['count']=_0x1fc59e;if(_0x51f296[_0xf80c('0x30')][_0xf80c('0x3f')]){_0x7338cf[_0xf80c('0x40')]=[{'all':!![]}];}return db[_0xf80c('0x3e')]['findAll'](_0x7338cf);})[_0xf80c('0x24')](function(_0x2a0351){_0x357845[_0xf80c('0x41')]=_0x2a0351;return _0x357845;})[_0xf80c('0x24')](respondWithFilteredResult(_0x2755e0,_0x7338cf))['catch'](handleError(_0x2755e0,null));};exports['show']=function(_0xa9feee,_0x26a0ff){var _0x535597={'raw':!![],'where':{'id':_0xa9feee[_0xf80c('0x42')]['id']}},_0x4adb2d={};_0x4adb2d[_0xf80c('0x2f')]=_['keys'](db[_0xf80c('0x3e')][_0xf80c('0x43')]);_0x4adb2d[_0xf80c('0x30')]=_[_0xf80c('0x31')](_0xa9feee[_0xf80c('0x30')]);_0x4adb2d['filters']=_[_0xf80c('0x33')](_0x4adb2d['model'],_0x4adb2d['query']);_0x535597[_0xf80c('0x34')]=_[_0xf80c('0x33')](_0x4adb2d['model'],qs[_0xf80c('0x35')](_0xa9feee[_0xf80c('0x30')][_0xf80c('0x35')]));_0x535597[_0xf80c('0x34')]=_0x535597[_0xf80c('0x34')][_0xf80c('0x36')]?_0x535597['attributes']:_0x4adb2d['model'];if(_0xa9feee[_0xf80c('0x30')][_0xf80c('0x3f')]){_0x535597[_0xf80c('0x40')]=[{'all':!![]}];}_0x535597=_[_0xf80c('0x3c')]({},_0x535597,_0xa9feee['options']);return db[_0xf80c('0x3e')][_0xf80c('0x44')](_0x535597)['then'](handleEntityNotFound(_0x26a0ff,null))[_0xf80c('0x24')](respondWithResult(_0x26a0ff,null))['catch'](handleError(_0x26a0ff,null));};exports[_0xf80c('0x45')]=function(_0x3d092f,_0x437246){return db[_0xf80c('0x3e')][_0xf80c('0x45')](_0x3d092f[_0xf80c('0x46')],{})[_0xf80c('0x24')](function(_0x523ce3){var _0x76bb5f=_0x3d092f[_0xf80c('0x47')][_0xf80c('0x48')]({'plain':!![]});if(!_0x76bb5f)throw new Error(_0xf80c('0x49'));if(_0x76bb5f['role']===_0xf80c('0x47')){var _0x5d0793=_0x523ce3[_0xf80c('0x48')]({'plain':!![]});var _0x555406=_0xf80c('0x26');return db[_0xf80c('0x4a')][_0xf80c('0x44')]({'where':{'name':_0x555406,'userProfileId':_0x76bb5f[_0xf80c('0x4b')]},'raw':!![]})[_0xf80c('0x24')](function(_0x52b07a){if(_0x52b07a&&_0x52b07a[_0xf80c('0x4c')]===0x0){return db['UserProfileResource'][_0xf80c('0x45')]({'name':_0x5d0793['name'],'resourceId':_0x5d0793['id'],'type':_0x52b07a[_0xf80c('0x2b')],'sectionId':_0x52b07a['id']},{})[_0xf80c('0x24')](function(){return _0x523ce3;});}else{return _0x523ce3;}})['catch'](function(_0x2ebbe8){logger['error'](_0xf80c('0x4d'),_0x2ebbe8);throw _0x2ebbe8;});}return _0x523ce3;})[_0xf80c('0x24')](respondWithResult(_0x437246,0xc9))['catch'](handleError(_0x437246,null));};exports[_0xf80c('0x23')]=function(_0x3020b6,_0x2a33d8){if(_0x3020b6[_0xf80c('0x46')]['id']){delete _0x3020b6[_0xf80c('0x46')]['id'];}return db['Template'][_0xf80c('0x44')]({'where':{'id':_0x3020b6[_0xf80c('0x42')]['id']}})[_0xf80c('0x24')](handleEntityNotFound(_0x2a33d8,null))[_0xf80c('0x24')](saveUpdates(_0x3020b6[_0xf80c('0x46')],null))['then'](respondWithResult(_0x2a33d8,null))[_0xf80c('0x4e')](handleError(_0x2a33d8,null));};exports['destroy']=function(_0x4c8b2e,_0x3c3015){return db[_0xf80c('0x3e')][_0xf80c('0x44')]({'where':{'id':_0x4c8b2e[_0xf80c('0x42')]['id']}})[_0xf80c('0x24')](handleEntityNotFound(_0x3c3015,null))[_0xf80c('0x24')](removeEntity(_0x3c3015,null))[_0xf80c('0x4e')](handleError(_0x3c3015,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 7d70cd1..c5b1b6d 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 _0xb343=['bluebird','request-promise','path','../../config/environment','./template.attributes','exports','define','tools_templates','util','../../config/logger','api','moment'];(function(_0x33b743,_0x52530c){var _0x488176=function(_0x144750){while(--_0x144750){_0x33b743['push'](_0x33b743['shift']());}};_0x488176(++_0x52530c);}(_0xb343,0xec));var _0x3b34=function(_0x41dc75,_0x3e0cdb){_0x41dc75=_0x41dc75-0x0;var _0x2895a0=_0xb343[_0x41dc75];return _0x2895a0;};'use strict';var _=require('lodash');var util=require(_0x3b34('0x0'));var logger=require(_0x3b34('0x1'))(_0x3b34('0x2'));var moment=require(_0x3b34('0x3'));var BPromise=require(_0x3b34('0x4'));var rp=require(_0x3b34('0x5'));var fs=require('fs');var path=require(_0x3b34('0x6'));var rimraf=require('rimraf');var config=require(_0x3b34('0x7'));var attributes=require(_0x3b34('0x8'));module[_0x3b34('0x9')]=function(_0x4cd488,_0x186b92){return _0x4cd488[_0x3b34('0xa')]('Template',attributes,{'tableName':_0x3b34('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf773=['../../config/environment','./template.attributes','define','Template','tools_templates','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0xf773,0x73));var _0x3f77=function(_0x3c7ab9,_0x2cfaa9){_0x3c7ab9=_0x3c7ab9-0x0;var _0x83330c=_0xf773[_0x3c7ab9];return _0x83330c;};'use strict';var _=require(_0x3f77('0x0'));var util=require(_0x3f77('0x1'));var logger=require(_0x3f77('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3f77('0x3'));var rp=require(_0x3f77('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3f77('0x5'));var config=require(_0x3f77('0x6'));var attributes=require(_0x3f77('0x7'));module['exports']=function(_0x1b21b9,_0x47e2bf){return _0x1b21b9[_0x3f77('0x8')](_0x3f77('0x9'),attributes,{'tableName':_0x3f77('0xa'),'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 2cf841d..646c6c8 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 _0xf2dd=['include','model','catch','lodash','util','bluebird','randomstring','../../config/logger','rpc','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTemplate','Template','findAll','options','raw','where','attributes','limit','map'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0xf2dd,0x1e3));var _0xdf2d=function(_0x4af01e,_0x543f5c){_0x4af01e=_0x4af01e-0x0;var _0x178c11=_0xf2dd[_0x4af01e];return _0x178c11;};'use strict';var _=require(_0xdf2d('0x0'));var util=require(_0xdf2d('0x1'));var moment=require('moment');var BPromise=require(_0xdf2d('0x2'));var rs=require(_0xdf2d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdf2d('0x4'))(_0xdf2d('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdf2d('0x6')][_0xdf2d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3c98db,_0x5ecd66,_0x1d4226){return new BPromise(function(_0x42d16f,_0x3b84fb){return client[_0xdf2d('0x8')](_0x3c98db,_0x1d4226)[_0xdf2d('0x9')](function(_0xe49f02){logger[_0xdf2d('0xa')](_0xdf2d('0xb'),_0x5ecd66,_0xdf2d('0xc'));logger[_0xdf2d('0xd')](_0xdf2d('0xe'),_0x5ecd66,'request\x20sent',JSON[_0xdf2d('0xf')](_0xe49f02));if(_0xe49f02[_0xdf2d('0x10')]){if(_0xe49f02[_0xdf2d('0x10')][_0xdf2d('0x11')]===0x1f4){logger[_0xdf2d('0x10')](_0xdf2d('0xb'),_0x5ecd66,_0xe49f02[_0xdf2d('0x10')][_0xdf2d('0x12')]);return _0x3b84fb(_0xe49f02[_0xdf2d('0x10')][_0xdf2d('0x12')]);}logger[_0xdf2d('0x10')](_0xdf2d('0xb'),_0x5ecd66,_0xe49f02[_0xdf2d('0x10')]['message']);return _0x42d16f(_0xe49f02[_0xdf2d('0x10')][_0xdf2d('0x12')]);}else{logger[_0xdf2d('0xa')](_0xdf2d('0xb'),_0x5ecd66,'request\x20sent');_0x42d16f(_0xe49f02[_0xdf2d('0x13')][_0xdf2d('0x12')]);}})['catch'](function(_0x27d103){logger[_0xdf2d('0x10')]('Template,\x20%s,\x20%s',_0x5ecd66,_0x27d103);_0x3b84fb(_0x27d103);});});}exports[_0xdf2d('0x14')]=function(_0x493e1c){var _0x325e22=this;return new Promise(function(_0x17e1ac,_0x489d7d){return db[_0xdf2d('0x15')][_0xdf2d('0x16')]({'raw':_0x493e1c[_0xdf2d('0x17')]?_0x493e1c[_0xdf2d('0x17')][_0xdf2d('0x18')]===undefined?!![]:![]:!![],'where':_0x493e1c[_0xdf2d('0x17')]?_0x493e1c[_0xdf2d('0x17')][_0xdf2d('0x19')]||null:null,'attributes':_0x493e1c[_0xdf2d('0x17')]?_0x493e1c[_0xdf2d('0x17')][_0xdf2d('0x1a')]||null:null,'limit':_0x493e1c['options']?_0x493e1c['options'][_0xdf2d('0x1b')]||null:null,'include':_0x493e1c[_0xdf2d('0x17')]?_0x493e1c[_0xdf2d('0x17')]['include']?_[_0xdf2d('0x1c')](_0x493e1c[_0xdf2d('0x17')][_0xdf2d('0x1d')],function(_0x4f7480){return{'model':db[_0x4f7480[_0xdf2d('0x1e')]],'as':_0x4f7480['as'],'attributes':_0x4f7480[_0xdf2d('0x1a')],'include':_0x4f7480[_0xdf2d('0x1d')]?_['map'](_0x4f7480[_0xdf2d('0x1d')],function(_0x1875e){return{'model':db[_0x1875e[_0xdf2d('0x1e')]],'as':_0x1875e['as'],'attributes':_0x1875e['attributes'],'include':_0x1875e['include']?_['map'](_0x1875e[_0xdf2d('0x1d')],function(_0x4d51cf){return{'model':db[_0x4d51cf[_0xdf2d('0x1e')]],'as':_0x4d51cf['as'],'attributes':_0x4d51cf[_0xdf2d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdf2d('0x9')](function(_0x154f37){logger[_0xdf2d('0xa')](_0xdf2d('0x14'),_0x493e1c);logger[_0xdf2d('0xd')](_0xdf2d('0x14'),_0x493e1c,JSON[_0xdf2d('0xf')](_0x154f37));_0x17e1ac(_0x154f37);})[_0xdf2d('0x1f')](function(_0x25225d){logger[_0xdf2d('0x10')]('GetTemplate',_0x25225d[_0xdf2d('0x12')],_0x493e1c);_0x489d7d(_0x325e22['error'](0x1f4,_0x25225d[_0xdf2d('0x12')]));});});}; \ No newline at end of file +var _0x85be=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTemplate','Template','options','raw','where','attributes','map','include','model','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x85be,0x1c8));var _0xe85b=function(_0x55c424,_0x3a4940){_0x55c424=_0x55c424-0x0;var _0x4447a2=_0x85be[_0x55c424];return _0x4447a2;};'use strict';var _=require(_0xe85b('0x0'));var util=require(_0xe85b('0x1'));var moment=require('moment');var BPromise=require(_0xe85b('0x2'));var rs=require(_0xe85b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe85b('0x4'))['db'];var utils=require(_0xe85b('0x5'));var logger=require(_0xe85b('0x6'))('rpc');var config=require(_0xe85b('0x7'));var jayson=require(_0xe85b('0x8'));var client=jayson[_0xe85b('0x9')][_0xe85b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xacbcd1,_0x5f1a89,_0x4df83b){return new BPromise(function(_0x1370a2,_0x120acb){return client[_0xe85b('0xb')](_0xacbcd1,_0x4df83b)[_0xe85b('0xc')](function(_0x8addde){logger[_0xe85b('0xd')](_0xe85b('0xe'),_0x5f1a89,_0xe85b('0xf'));logger[_0xe85b('0x10')](_0xe85b('0x11'),_0x5f1a89,_0xe85b('0xf'),JSON[_0xe85b('0x12')](_0x8addde));if(_0x8addde['error']){if(_0x8addde[_0xe85b('0x13')][_0xe85b('0x14')]===0x1f4){logger[_0xe85b('0x13')](_0xe85b('0xe'),_0x5f1a89,_0x8addde['error'][_0xe85b('0x15')]);return _0x120acb(_0x8addde['error'][_0xe85b('0x15')]);}logger[_0xe85b('0x13')](_0xe85b('0xe'),_0x5f1a89,_0x8addde[_0xe85b('0x13')]['message']);return _0x1370a2(_0x8addde['error'][_0xe85b('0x15')]);}else{logger[_0xe85b('0xd')](_0xe85b('0xe'),_0x5f1a89,_0xe85b('0xf'));_0x1370a2(_0x8addde[_0xe85b('0x16')][_0xe85b('0x15')]);}})['catch'](function(_0x22f5f0){logger['error'](_0xe85b('0xe'),_0x5f1a89,_0x22f5f0);_0x120acb(_0x22f5f0);});});}exports[_0xe85b('0x17')]=function(_0xf7f1bd){var _0x4fba96=this;return new Promise(function(_0x3fb089,_0x260b6a){return db[_0xe85b('0x18')]['findAll']({'raw':_0xf7f1bd[_0xe85b('0x19')]?_0xf7f1bd[_0xe85b('0x19')][_0xe85b('0x1a')]===undefined?!![]:![]:!![],'where':_0xf7f1bd[_0xe85b('0x19')]?_0xf7f1bd[_0xe85b('0x19')][_0xe85b('0x1b')]||null:null,'attributes':_0xf7f1bd[_0xe85b('0x19')]?_0xf7f1bd[_0xe85b('0x19')][_0xe85b('0x1c')]||null:null,'limit':_0xf7f1bd[_0xe85b('0x19')]?_0xf7f1bd[_0xe85b('0x19')]['limit']||null:null,'include':_0xf7f1bd['options']?_0xf7f1bd[_0xe85b('0x19')]['include']?_[_0xe85b('0x1d')](_0xf7f1bd[_0xe85b('0x19')][_0xe85b('0x1e')],function(_0x2051e2){return{'model':db[_0x2051e2[_0xe85b('0x1f')]],'as':_0x2051e2['as'],'attributes':_0x2051e2[_0xe85b('0x1c')],'include':_0x2051e2[_0xe85b('0x1e')]?_[_0xe85b('0x1d')](_0x2051e2['include'],function(_0x58aac1){return{'model':db[_0x58aac1['model']],'as':_0x58aac1['as'],'attributes':_0x58aac1[_0xe85b('0x1c')],'include':_0x58aac1[_0xe85b('0x1e')]?_[_0xe85b('0x1d')](_0x58aac1[_0xe85b('0x1e')],function(_0x3a9d73){return{'model':db[_0x3a9d73[_0xe85b('0x1f')]],'as':_0x3a9d73['as'],'attributes':_0x3a9d73[_0xe85b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe85b('0xc')](function(_0x3fcfc4){logger[_0xe85b('0xd')](_0xe85b('0x17'),_0xf7f1bd);logger[_0xe85b('0x10')]('GetTemplate',_0xf7f1bd,JSON[_0xe85b('0x12')](_0x3fcfc4));_0x3fb089(_0x3fcfc4);})[_0xe85b('0x20')](function(_0x57857f){logger[_0xe85b('0x13')](_0xe85b('0x17'),_0x57857f['message'],_0xf7f1bd);_0x260b6a(_0x4fba96[_0xe85b('0x13')](0x1f4,_0x57857f[_0xe85b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 9cce4ae..742b78d 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 _0xd6dc=['getAllConditions','/:id/any_conditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','index','/:id','isAuthenticated'];(function(_0x4f74a5,_0x1fd979){var _0x5be8b2=function(_0x3bb233){while(--_0x3bb233){_0x4f74a5['push'](_0x4f74a5['shift']());}};_0x5be8b2(++_0x1fd979);}(_0xd6dc,0x184));var _0xcd6d=function(_0x26b4e7,_0x20cffe){_0x26b4e7=_0x26b4e7-0x0;var _0x2e3484=_0xd6dc[_0x26b4e7];return _0x2e3484;};'use strict';var multer=require(_0xcd6d('0x0'));var util=require(_0xcd6d('0x1'));var path=require('path');var timeout=require(_0xcd6d('0x2'));var express=require(_0xcd6d('0x3'));var router=express[_0xcd6d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcd6d('0x5'));var interaction=require(_0xcd6d('0x6'));var config=require('../../config/environment');var controller=require(_0xcd6d('0x7'));router[_0xcd6d('0x8')]('/',auth['isAuthenticated'](),controller[_0xcd6d('0x9')]);router['get'](_0xcd6d('0xa'),auth[_0xcd6d('0xb')](),controller['show']);router[_0xcd6d('0x8')]('/:id/all_conditions',auth[_0xcd6d('0xb')](),controller[_0xcd6d('0xc')]);router[_0xcd6d('0x8')](_0xcd6d('0xd'),auth[_0xcd6d('0xb')](),controller['getAnyConditions']);router[_0xcd6d('0x8')](_0xcd6d('0xe'),auth[_0xcd6d('0xb')](),controller[_0xcd6d('0xf')]);router[_0xcd6d('0x10')]('/',auth[_0xcd6d('0xb')](),controller[_0xcd6d('0x11')]);router[_0xcd6d('0x10')]('/:id/all_conditions',auth[_0xcd6d('0xb')](),controller[_0xcd6d('0x12')]);router[_0xcd6d('0x10')](_0xcd6d('0xd'),auth['isAuthenticated'](),controller[_0xcd6d('0x13')]);router[_0xcd6d('0x10')](_0xcd6d('0xe'),auth[_0xcd6d('0xb')](),controller[_0xcd6d('0x14')]);router[_0xcd6d('0x15')](_0xcd6d('0xa'),auth[_0xcd6d('0xb')](),controller[_0xcd6d('0x16')]);router[_0xcd6d('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xcd6d('0x18')]=router; \ No newline at end of file +var _0x1278=['../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','put','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x201170,_0x2810f8){var _0x1c3ec8=function(_0xa5d488){while(--_0xa5d488){_0x201170['push'](_0x201170['shift']());}};_0x1c3ec8(++_0x2810f8);}(_0x1278,0xbe));var _0x8127=function(_0x4f2330,_0x371cd7){_0x4f2330=_0x4f2330-0x0;var _0x38016f=_0x1278[_0x4f2330];return _0x38016f;};'use strict';var multer=require(_0x8127('0x0'));var util=require(_0x8127('0x1'));var path=require('path');var timeout=require(_0x8127('0x2'));var express=require(_0x8127('0x3'));var router=express['Router']();var fs_extra=require(_0x8127('0x4'));var auth=require(_0x8127('0x5'));var interaction=require(_0x8127('0x6'));var config=require(_0x8127('0x7'));var controller=require(_0x8127('0x8'));router[_0x8127('0x9')]('/',auth[_0x8127('0xa')](),controller['index']);router['get'](_0x8127('0xb'),auth[_0x8127('0xa')](),controller[_0x8127('0xc')]);router[_0x8127('0x9')](_0x8127('0xd'),auth[_0x8127('0xa')](),controller[_0x8127('0xe')]);router[_0x8127('0x9')](_0x8127('0xf'),auth[_0x8127('0xa')](),controller[_0x8127('0x10')]);router['get'](_0x8127('0x11'),auth[_0x8127('0xa')](),controller[_0x8127('0x12')]);router[_0x8127('0x13')]('/',auth[_0x8127('0xa')](),controller[_0x8127('0x14')]);router['post'](_0x8127('0xd'),auth[_0x8127('0xa')](),controller[_0x8127('0x15')]);router['post'](_0x8127('0xf'),auth[_0x8127('0xa')](),controller[_0x8127('0x16')]);router[_0x8127('0x13')](_0x8127('0x11'),auth[_0x8127('0xa')](),controller[_0x8127('0x17')]);router[_0x8127('0x18')](_0x8127('0xb'),auth['isAuthenticated'](),controller[_0x8127('0x19')]);router[_0x8127('0x1a')](_0x8127('0xb'),auth['isAuthenticated'](),controller[_0x8127('0x1b')]);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 e832959..a70346e 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 _0x2667=['exports','STRING'];(function(_0x3f8b6d,_0x206079){var _0x154612=function(_0xcc7de3){while(--_0xcc7de3){_0x3f8b6d['push'](_0x3f8b6d['shift']());}};_0x154612(++_0x206079);}(_0x2667,0x76));var _0x7266=function(_0x3aced7,_0x562b6a){_0x3aced7=_0x3aced7-0x0;var _0xbea546=_0x2667[_0x3aced7];return _0xbea546;};'use strict';var Sequelize=require('sequelize');module[_0x7266('0x0')]={'name':{'type':Sequelize[_0x7266('0x1')]},'channel':{'type':Sequelize[_0x7266('0x1')]},'description':{'type':Sequelize[_0x7266('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1718=['STRING','BOOLEAN','sequelize','exports'];(function(_0x175216,_0x10abf5){var _0x45734d=function(_0x1b2954){while(--_0x1b2954){_0x175216['push'](_0x175216['shift']());}};_0x45734d(++_0x10abf5);}(_0x1718,0x1ee));var _0x8171=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1718[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x8171('0x0'));module[_0x8171('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8171('0x2')]},'description':{'type':Sequelize[_0x8171('0x2')]},'status':{'type':Sequelize[_0x8171('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 c6e5236..1ece37c 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 _0xf93a=['Triggers','destroy','name','send','map','Trigger','fieldName','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','includeAll','include','findAll','rows','show','params','rawAttributes','options','catch','create','body','user','get','role','UserProfileSection','find','autoAssociation','UserProfileResource','error','addAllCondition','Condition','getAllConditions','findOne','pick','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then'];(function(_0x1e40df,_0x18b1a5){var _0x4bfb7b=function(_0x3d5ca4){while(--_0x3d5ca4){_0x1e40df['push'](_0x1e40df['shift']());}};_0x4bfb7b(++_0x18b1a5);}(_0xf93a,0x151));var _0xaf93=function(_0x2f1df9,_0x3be3f6){_0x2f1df9=_0x2f1df9-0x0;var _0xe48548=_0xf93a[_0x2f1df9];return _0xe48548;};'use strict';var emlformat=require(_0xaf93('0x0'));var rimraf=require(_0xaf93('0x1'));var zipdir=require(_0xaf93('0x2'));var jsonpatch=require(_0xaf93('0x3'));var rp=require(_0xaf93('0x4'));var moment=require(_0xaf93('0x5'));var BPromise=require(_0xaf93('0x6'));var Mustache=require(_0xaf93('0x7'));var util=require(_0xaf93('0x8'));var path=require(_0xaf93('0x9'));var sox=require(_0xaf93('0xa'));var csv=require(_0xaf93('0xb'));var ejs=require(_0xaf93('0xc'));var fs=require('fs');var fs_extra=require(_0xaf93('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaf93('0xe'));var jsforce=require(_0xaf93('0xf'));var deskjs=require(_0xaf93('0x10'));var toCsv=require('to-csv');var querystring=require(_0xaf93('0x11'));var Papa=require(_0xaf93('0x12'));var Redis=require(_0xaf93('0x13'));var authService=require(_0xaf93('0x14'));var qs=require(_0xaf93('0x15'));var as=require(_0xaf93('0x16'));var hardwareService=require(_0xaf93('0x17'));var logger=require(_0xaf93('0x18'))(_0xaf93('0x19'));var utils=require(_0xaf93('0x1a'));var config=require(_0xaf93('0x1b'));var licenseUtil=require(_0xaf93('0x1c'));var db=require(_0xaf93('0x1d'))['db'];function respondWithStatusCode(_0x2bad0f,_0x44546a){_0x44546a=_0x44546a||0xcc;return function(_0x353d34){if(_0x353d34){return _0x2bad0f[_0xaf93('0x1e')](_0x44546a);}return _0x2bad0f[_0xaf93('0x1f')](_0x44546a)[_0xaf93('0x20')]();};}function respondWithResult(_0x59f923,_0x597065){_0x597065=_0x597065||0xc8;return function(_0x39e35d){if(_0x39e35d){return _0x59f923['status'](_0x597065)[_0xaf93('0x21')](_0x39e35d);}};}function respondWithFilteredResult(_0xfb52ea,_0x28ca48){return function(_0x186b0f){if(_0x186b0f){var _0x460fee=typeof _0x28ca48[_0xaf93('0x22')]===_0xaf93('0x23')&&typeof _0x28ca48[_0xaf93('0x24')]==='undefined';var _0x37af70=_0x186b0f['count'];var _0x181078=_0x460fee?0x0:_0x28ca48['offset'];var _0x327907=_0x460fee?_0x186b0f[_0xaf93('0x25')]:_0x28ca48[_0xaf93('0x22')]+_0x28ca48[_0xaf93('0x24')];var _0x4a9932;if(_0x327907>=_0x37af70){_0x327907=_0x37af70;_0x4a9932=0xc8;}else{_0x4a9932=0xce;}_0xfb52ea[_0xaf93('0x1f')](_0x4a9932);return _0xfb52ea[_0xaf93('0x26')](_0xaf93('0x27'),_0x181078+'-'+_0x327907+'/'+_0x37af70)[_0xaf93('0x21')](_0x186b0f);}return null;};}function patchUpdates(_0x1a7b71){return function(_0x5bd3ce){try{jsonpatch['apply'](_0x5bd3ce,_0x1a7b71,!![]);}catch(_0x48d21b){return BPromise['reject'](_0x48d21b);}return _0x5bd3ce[_0xaf93('0x28')]();};}function saveUpdates(_0x2052fd,_0x455b83){return function(_0x33d34c){if(_0x33d34c){return _0x33d34c[_0xaf93('0x29')](_0x2052fd)[_0xaf93('0x2a')](function(_0x13cd9d){return _0x13cd9d;});}return null;};}function removeEntity(_0x5c28e9,_0x37523f){return function(_0x470d69){if(_0x470d69){return _0x470d69['destroy']()[_0xaf93('0x2a')](function(){var _0xe07ed8=_0x470d69['get']({'plain':!![]});var _0x155f03=_0xaf93('0x2b');return db['UserProfileResource'][_0xaf93('0x2c')]({'where':{'type':_0x155f03,'resourceId':_0xe07ed8['id']}})[_0xaf93('0x2a')](function(){return _0x470d69;});})[_0xaf93('0x2a')](function(){_0x5c28e9[_0xaf93('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa92031,_0x158189){return function(_0xc60c65){if(!_0xc60c65){_0xa92031[_0xaf93('0x1e')](0x194);}return _0xc60c65;};}function handleError(_0x4742bd,_0x3335f7){_0x3335f7=_0x3335f7||0x1f4;return function(_0x47e3e0){logger['error'](_0x47e3e0['stack']);if(_0x47e3e0[_0xaf93('0x2d')]){delete _0x47e3e0[_0xaf93('0x2d')];}_0x4742bd[_0xaf93('0x1f')](_0x3335f7)[_0xaf93('0x2e')](_0x47e3e0);};}exports['index']=function(_0x44fdda,_0x33c06b){var _0x5e3bf8={},_0x491d26={},_0x2a7376={'count':0x0,'rows':[]};var _0x28bdd5=_[_0xaf93('0x2f')](db[_0xaf93('0x30')]['rawAttributes'],function(_0x49c74b){return{'name':_0x49c74b[_0xaf93('0x31')],'type':_0x49c74b['type']['key']};});_0x491d26[_0xaf93('0x32')]=_[_0xaf93('0x2f')](_0x28bdd5,_0xaf93('0x2d'));_0x491d26['query']=_[_0xaf93('0x33')](_0x44fdda[_0xaf93('0x34')]);_0x491d26[_0xaf93('0x35')]=_['intersection'](_0x491d26[_0xaf93('0x32')],_0x491d26[_0xaf93('0x34')]);_0x5e3bf8[_0xaf93('0x36')]=_[_0xaf93('0x37')](_0x491d26['model'],qs[_0xaf93('0x38')](_0x44fdda[_0xaf93('0x34')][_0xaf93('0x38')]));_0x5e3bf8[_0xaf93('0x36')]=_0x5e3bf8[_0xaf93('0x36')][_0xaf93('0x39')]?_0x5e3bf8[_0xaf93('0x36')]:_0x491d26[_0xaf93('0x32')];if(!_0x44fdda[_0xaf93('0x34')][_0xaf93('0x3a')](_0xaf93('0x3b'))){_0x5e3bf8[_0xaf93('0x24')]=qs[_0xaf93('0x24')](_0x44fdda[_0xaf93('0x34')][_0xaf93('0x24')]);_0x5e3bf8['offset']=qs[_0xaf93('0x22')](_0x44fdda[_0xaf93('0x34')]['offset']);}_0x5e3bf8[_0xaf93('0x3c')]=qs['sort'](_0x44fdda[_0xaf93('0x34')][_0xaf93('0x3d')]);_0x5e3bf8[_0xaf93('0x3e')]=qs[_0xaf93('0x35')](_['pick'](_0x44fdda['query'],_0x491d26['filters']),_0x28bdd5);if(_0x44fdda[_0xaf93('0x34')][_0xaf93('0x3f')]){_0x5e3bf8[_0xaf93('0x3e')]=_[_0xaf93('0x40')](_0x5e3bf8[_0xaf93('0x3e')],{'$or':_[_0xaf93('0x2f')](_0x28bdd5,function(_0x30914d){if(_0x30914d[_0xaf93('0x41')]!=='VIRTUAL'){var _0x4bddcc={};_0x4bddcc[_0x30914d[_0xaf93('0x2d')]]={'$like':'%'+_0x44fdda[_0xaf93('0x34')][_0xaf93('0x3f')]+'%'};return _0x4bddcc;}})});}_0x5e3bf8=_['merge']({},_0x5e3bf8,_0x44fdda['options']);var _0x1c8839={'where':_0x5e3bf8[_0xaf93('0x3e')]};return db[_0xaf93('0x30')][_0xaf93('0x25')](_0x1c8839)[_0xaf93('0x2a')](function(_0x309cd6){_0x2a7376[_0xaf93('0x25')]=_0x309cd6;if(_0x44fdda[_0xaf93('0x34')][_0xaf93('0x42')]){_0x5e3bf8[_0xaf93('0x43')]=[{'all':!![]}];}return db[_0xaf93('0x30')][_0xaf93('0x44')](_0x5e3bf8);})[_0xaf93('0x2a')](function(_0x5e1768){_0x2a7376[_0xaf93('0x45')]=_0x5e1768;return _0x2a7376;})[_0xaf93('0x2a')](respondWithFilteredResult(_0x33c06b,_0x5e3bf8))['catch'](handleError(_0x33c06b,null));};exports[_0xaf93('0x46')]=function(_0x18e391,_0x30cdd9){var _0x3d7c2e={'raw':![],'where':{'id':_0x18e391[_0xaf93('0x47')]['id']}},_0x1d1b8b={};_0x1d1b8b[_0xaf93('0x32')]=_[_0xaf93('0x33')](db[_0xaf93('0x30')][_0xaf93('0x48')]);_0x1d1b8b['query']=_[_0xaf93('0x33')](_0x18e391[_0xaf93('0x34')]);_0x1d1b8b[_0xaf93('0x35')]=_['intersection'](_0x1d1b8b[_0xaf93('0x32')],_0x1d1b8b[_0xaf93('0x34')]);_0x3d7c2e[_0xaf93('0x36')]=_[_0xaf93('0x37')](_0x1d1b8b[_0xaf93('0x32')],qs[_0xaf93('0x38')](_0x18e391[_0xaf93('0x34')][_0xaf93('0x38')]));_0x3d7c2e[_0xaf93('0x36')]=_0x3d7c2e[_0xaf93('0x36')][_0xaf93('0x39')]?_0x3d7c2e[_0xaf93('0x36')]:_0x1d1b8b[_0xaf93('0x32')];if(_0x18e391[_0xaf93('0x34')][_0xaf93('0x42')]){_0x3d7c2e[_0xaf93('0x43')]=[{'all':!![]}];}_0x3d7c2e=_['merge']({},_0x3d7c2e,_0x18e391[_0xaf93('0x49')]);return db['Trigger']['find'](_0x3d7c2e)['then'](handleEntityNotFound(_0x30cdd9,null))[_0xaf93('0x2a')](respondWithResult(_0x30cdd9,null))[_0xaf93('0x4a')](handleError(_0x30cdd9,null));};exports[_0xaf93('0x4b')]=function(_0x2d6b11,_0x193650){return db[_0xaf93('0x30')][_0xaf93('0x4b')](_0x2d6b11[_0xaf93('0x4c')],{})[_0xaf93('0x2a')](function(_0x494ed6){var _0x1722ed=_0x2d6b11[_0xaf93('0x4d')][_0xaf93('0x4e')]({'plain':!![]});if(!_0x1722ed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1722ed[_0xaf93('0x4f')]===_0xaf93('0x4d')){var _0x491d96=_0x494ed6[_0xaf93('0x4e')]({'plain':!![]});var _0x540ba1=_0xaf93('0x2b');return db[_0xaf93('0x50')][_0xaf93('0x51')]({'where':{'name':_0x540ba1,'userProfileId':_0x1722ed['userProfileId']},'raw':!![]})['then'](function(_0x2cb249){if(_0x2cb249&&_0x2cb249[_0xaf93('0x52')]===0x0){return db[_0xaf93('0x53')][_0xaf93('0x4b')]({'name':_0x491d96[_0xaf93('0x2d')],'resourceId':_0x491d96['id'],'type':_0x2cb249['name'],'sectionId':_0x2cb249['id']},{})[_0xaf93('0x2a')](function(){return _0x494ed6;});}else{return _0x494ed6;}})['catch'](function(_0x49d8c4){logger[_0xaf93('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49d8c4);throw _0x49d8c4;});}return _0x494ed6;})[_0xaf93('0x2a')](respondWithResult(_0x193650,0xc9))[_0xaf93('0x4a')](handleError(_0x193650,null));};exports['update']=function(_0x12f498,_0x297705){if(_0x12f498[_0xaf93('0x4c')]['id']){delete _0x12f498[_0xaf93('0x4c')]['id'];}return db['Trigger'][_0xaf93('0x51')]({'where':{'id':_0x12f498['params']['id']}})[_0xaf93('0x2a')](handleEntityNotFound(_0x297705,null))[_0xaf93('0x2a')](saveUpdates(_0x12f498['body'],null))[_0xaf93('0x2a')](respondWithResult(_0x297705,null))['catch'](handleError(_0x297705,null));};exports['destroy']=function(_0x5bcc2e,_0x30ab2b){return db[_0xaf93('0x30')][_0xaf93('0x51')]({'where':{'id':_0x5bcc2e[_0xaf93('0x47')]['id']}})[_0xaf93('0x2a')](handleEntityNotFound(_0x30ab2b,null))['then'](removeEntity(_0x30ab2b,null))[_0xaf93('0x4a')](handleError(_0x30ab2b,null));};exports[_0xaf93('0x55')]=function(_0x5e1e21,_0x9923b9,_0x508537){if(_0x5e1e21[_0xaf93('0x4c')]['id']){delete _0x5e1e21[_0xaf93('0x4c')]['id'];}return db[_0xaf93('0x30')]['find']({'where':{'id':_0x5e1e21['params']['id']}})['then'](handleEntityNotFound(_0x9923b9,null))['then'](function(_0x2d00d8){if(_0x2d00d8){_0x5e1e21[_0xaf93('0x4c')]['TriggerAllId']=_0x2d00d8['id'];return db[_0xaf93('0x56')][_0xaf93('0x4b')](_0x5e1e21[_0xaf93('0x4c')]);}})[_0xaf93('0x2a')](respondWithResult(_0x9923b9,null))['catch'](handleError(_0x9923b9,null));};exports['addAnyCondition']=function(_0x57c4ef,_0x1f846a,_0x52992a){if(_0x57c4ef['body']['id']){delete _0x57c4ef[_0xaf93('0x4c')]['id'];}return db['Trigger']['find']({'where':{'id':_0x57c4ef['params']['id']}})[_0xaf93('0x2a')](handleEntityNotFound(_0x1f846a,null))[_0xaf93('0x2a')](function(_0x31ff46){if(_0x31ff46){_0x57c4ef[_0xaf93('0x4c')]['TriggerAnyId']=_0x31ff46['id'];return db[_0xaf93('0x56')]['create'](_0x57c4ef[_0xaf93('0x4c')]);}})[_0xaf93('0x2a')](respondWithResult(_0x1f846a,null))[_0xaf93('0x4a')](handleError(_0x1f846a,null));};exports[_0xaf93('0x57')]=function(_0x29ecc7,_0x2b449e,_0x48bc02){var _0x3e87a3={};var _0x261c65={};var _0x55bd14;var _0x4dae5a;return db[_0xaf93('0x30')][_0xaf93('0x58')]({'where':{'id':_0x29ecc7[_0xaf93('0x47')]['id']}})[_0xaf93('0x2a')](handleEntityNotFound(_0x2b449e,null))[_0xaf93('0x2a')](function(_0xc9c424){if(_0xc9c424){_0x55bd14=_0xc9c424;_0x261c65[_0xaf93('0x32')]=_[_0xaf93('0x33')](db[_0xaf93('0x56')][_0xaf93('0x48')]);_0x261c65['query']=_[_0xaf93('0x33')](_0x29ecc7[_0xaf93('0x34')]);_0x261c65[_0xaf93('0x35')]=_[_0xaf93('0x37')](_0x261c65[_0xaf93('0x32')],_0x261c65[_0xaf93('0x34')]);_0x3e87a3[_0xaf93('0x36')]=_[_0xaf93('0x37')](_0x261c65[_0xaf93('0x32')],qs[_0xaf93('0x38')](_0x29ecc7[_0xaf93('0x34')]['fields']));_0x3e87a3[_0xaf93('0x36')]=_0x3e87a3['attributes'][_0xaf93('0x39')]?_0x3e87a3[_0xaf93('0x36')]:_0x261c65[_0xaf93('0x32')];_0x3e87a3['order']=qs['sort'](_0x29ecc7[_0xaf93('0x34')][_0xaf93('0x3d')]);_0x3e87a3['where']=qs[_0xaf93('0x35')](_[_0xaf93('0x59')](_0x29ecc7['query'],_0x261c65[_0xaf93('0x35')]));if(_0x29ecc7[_0xaf93('0x34')]['filter']){_0x3e87a3['where']=_[_0xaf93('0x40')](_0x3e87a3[_0xaf93('0x3e')],{'$or':_[_0xaf93('0x2f')](_0x3e87a3[_0xaf93('0x36')],function(_0x40e823){var _0x23aa72={};_0x23aa72[_0x40e823]={'$like':'%'+_0x29ecc7['query'][_0xaf93('0x3f')]+'%'};return _0x23aa72;})});}_0x3e87a3=_[_0xaf93('0x40')]({},_0x3e87a3,_0x29ecc7[_0xaf93('0x49')]);return _0x55bd14[_0xaf93('0x57')](_0x3e87a3);}})[_0xaf93('0x2a')](function(_0x2c3f29){if(_0x2c3f29){_0x4dae5a=_0x2c3f29['length'];if(!_0x29ecc7[_0xaf93('0x34')][_0xaf93('0x3a')](_0xaf93('0x3b'))){_0x3e87a3[_0xaf93('0x24')]=qs['limit'](_0x29ecc7[_0xaf93('0x34')][_0xaf93('0x24')]);_0x3e87a3[_0xaf93('0x22')]=qs[_0xaf93('0x22')](_0x29ecc7[_0xaf93('0x34')][_0xaf93('0x22')]);}return _0x55bd14[_0xaf93('0x57')](_0x3e87a3);}})[_0xaf93('0x2a')](function(_0x3edc07){if(_0x3edc07){return _0x3edc07?{'count':_0x4dae5a,'rows':_0x3edc07}:null;}})['then'](respondWithResult(_0x2b449e,null))[_0xaf93('0x4a')](handleError(_0x2b449e,null));};exports[_0xaf93('0x5a')]=function(_0x5c3e79,_0x557aef,_0x4939c4){var _0x448c59={};var _0x62b1b={};var _0xf3bbd9;var _0x19c75c;return db[_0xaf93('0x30')]['findOne']({'where':{'id':_0x5c3e79[_0xaf93('0x47')]['id']}})[_0xaf93('0x2a')](handleEntityNotFound(_0x557aef,null))['then'](function(_0x63c54f){if(_0x63c54f){_0xf3bbd9=_0x63c54f;_0x62b1b['model']=_[_0xaf93('0x33')](db[_0xaf93('0x56')]['rawAttributes']);_0x62b1b['query']=_['keys'](_0x5c3e79[_0xaf93('0x34')]);_0x62b1b[_0xaf93('0x35')]=_[_0xaf93('0x37')](_0x62b1b['model'],_0x62b1b[_0xaf93('0x34')]);_0x448c59['attributes']=_['intersection'](_0x62b1b[_0xaf93('0x32')],qs[_0xaf93('0x38')](_0x5c3e79[_0xaf93('0x34')][_0xaf93('0x38')]));_0x448c59['attributes']=_0x448c59[_0xaf93('0x36')][_0xaf93('0x39')]?_0x448c59['attributes']:_0x62b1b['model'];_0x448c59['order']=qs[_0xaf93('0x3d')](_0x5c3e79[_0xaf93('0x34')][_0xaf93('0x3d')]);_0x448c59[_0xaf93('0x3e')]=qs[_0xaf93('0x35')](_[_0xaf93('0x59')](_0x5c3e79[_0xaf93('0x34')],_0x62b1b[_0xaf93('0x35')]));if(_0x5c3e79[_0xaf93('0x34')][_0xaf93('0x3f')]){_0x448c59[_0xaf93('0x3e')]=_[_0xaf93('0x40')](_0x448c59[_0xaf93('0x3e')],{'$or':_[_0xaf93('0x2f')](_0x448c59['attributes'],function(_0x31aba5){var _0x3114cb={};_0x3114cb[_0x31aba5]={'$like':'%'+_0x5c3e79[_0xaf93('0x34')][_0xaf93('0x3f')]+'%'};return _0x3114cb;})});}_0x448c59=_[_0xaf93('0x40')]({},_0x448c59,_0x5c3e79[_0xaf93('0x49')]);return _0xf3bbd9['getAnyConditions'](_0x448c59);}})['then'](function(_0x45262f){if(_0x45262f){_0x19c75c=_0x45262f['length'];if(!_0x5c3e79[_0xaf93('0x34')][_0xaf93('0x3a')]('nolimit')){_0x448c59[_0xaf93('0x24')]=qs[_0xaf93('0x24')](_0x5c3e79[_0xaf93('0x34')][_0xaf93('0x24')]);_0x448c59[_0xaf93('0x22')]=qs['offset'](_0x5c3e79['query'][_0xaf93('0x22')]);}return _0xf3bbd9[_0xaf93('0x5a')](_0x448c59);}})[_0xaf93('0x2a')](function(_0x265d42){if(_0x265d42){return _0x265d42?{'count':_0x19c75c,'rows':_0x265d42}:null;}})[_0xaf93('0x2a')](respondWithResult(_0x557aef,null))[_0xaf93('0x4a')](handleError(_0x557aef,null));};exports[_0xaf93('0x5b')]=function(_0x2ac8db,_0x25f987,_0x380343){if(_0x2ac8db[_0xaf93('0x4c')]['id']){delete _0x2ac8db[_0xaf93('0x4c')]['id'];}return db[_0xaf93('0x30')][_0xaf93('0x51')]({'where':{'id':_0x2ac8db[_0xaf93('0x47')]['id']}})[_0xaf93('0x2a')](handleEntityNotFound(_0x25f987,null))[_0xaf93('0x2a')](function(_0x4d2493){if(_0x4d2493){_0x2ac8db['body'][_0xaf93('0x5c')]=_0x4d2493['id'];return db[_0xaf93('0x5d')][_0xaf93('0x4b')](_0x2ac8db['body']);}})[_0xaf93('0x2a')](respondWithResult(_0x25f987,null))['catch'](handleError(_0x25f987,null));};exports[_0xaf93('0x5e')]=function(_0x4c0078,_0x1a1303,_0x5317db){var _0x1da4d1={};var _0x2b84f5={};var _0x5c7f23;var _0xbbb54c;return db[_0xaf93('0x30')][_0xaf93('0x58')]({'where':{'id':_0x4c0078['params']['id']}})['then'](handleEntityNotFound(_0x1a1303,null))['then'](function(_0x2500ca){if(_0x2500ca){_0x5c7f23=_0x2500ca;_0x2b84f5[_0xaf93('0x32')]=_[_0xaf93('0x33')](db[_0xaf93('0x5d')][_0xaf93('0x48')]);_0x2b84f5[_0xaf93('0x34')]=_[_0xaf93('0x33')](_0x4c0078[_0xaf93('0x34')]);_0x2b84f5['filters']=_[_0xaf93('0x37')](_0x2b84f5[_0xaf93('0x32')],_0x2b84f5['query']);_0x1da4d1['attributes']=_[_0xaf93('0x37')](_0x2b84f5[_0xaf93('0x32')],qs[_0xaf93('0x38')](_0x4c0078[_0xaf93('0x34')][_0xaf93('0x38')]));_0x1da4d1['attributes']=_0x1da4d1[_0xaf93('0x36')]['length']?_0x1da4d1[_0xaf93('0x36')]:_0x2b84f5['model'];_0x1da4d1[_0xaf93('0x3c')]=qs[_0xaf93('0x3d')](_0x4c0078['query'][_0xaf93('0x3d')]);_0x1da4d1[_0xaf93('0x3e')]=qs[_0xaf93('0x35')](_[_0xaf93('0x59')](_0x4c0078[_0xaf93('0x34')],_0x2b84f5[_0xaf93('0x35')]));if(_0x4c0078[_0xaf93('0x34')][_0xaf93('0x3f')]){_0x1da4d1[_0xaf93('0x3e')]=_[_0xaf93('0x40')](_0x1da4d1[_0xaf93('0x3e')],{'$or':_[_0xaf93('0x2f')](_0x1da4d1[_0xaf93('0x36')],function(_0x3d2afd){var _0x15d185={};_0x15d185[_0x3d2afd]={'$like':'%'+_0x4c0078[_0xaf93('0x34')]['filter']+'%'};return _0x15d185;})});}_0x1da4d1=_[_0xaf93('0x40')]({},_0x1da4d1,_0x4c0078['options']);return _0x5c7f23[_0xaf93('0x5e')](_0x1da4d1);}})['then'](function(_0x1d2a9e){if(_0x1d2a9e){_0xbbb54c=_0x1d2a9e[_0xaf93('0x39')];if(!_0x4c0078['query'][_0xaf93('0x3a')](_0xaf93('0x3b'))){_0x1da4d1['limit']=qs['limit'](_0x4c0078[_0xaf93('0x34')][_0xaf93('0x24')]);_0x1da4d1['offset']=qs[_0xaf93('0x22')](_0x4c0078['query'][_0xaf93('0x22')]);}return _0x5c7f23['getActions'](_0x1da4d1);}})[_0xaf93('0x2a')](function(_0x46a6c4){if(_0x46a6c4){return _0x46a6c4?{'count':_0xbbb54c,'rows':_0x46a6c4}:null;}})[_0xaf93('0x2a')](respondWithResult(_0x1a1303,null))['catch'](handleError(_0x1a1303,null));}; \ No newline at end of file +var _0x13e9=['includeAll','include','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','options','getAnyConditions','findOne','addAction','Action','getActions','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','get','Triggers','UserProfileResource','destroy','error','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x5df834,_0x4474bd){var _0x5e0887=function(_0x4af428){while(--_0x4af428){_0x5df834['push'](_0x5df834['shift']());}};_0x5e0887(++_0x4474bd);}(_0x13e9,0x76));var _0x913e=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x13e9[_0x3511d3];return _0x5d6321;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x913e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x913e('0x1'));var moment=require(_0x913e('0x2'));var BPromise=require(_0x913e('0x3'));var Mustache=require(_0x913e('0x4'));var util=require(_0x913e('0x5'));var path=require(_0x913e('0x6'));var sox=require(_0x913e('0x7'));var csv=require(_0x913e('0x8'));var ejs=require(_0x913e('0x9'));var fs=require('fs');var fs_extra=require(_0x913e('0xa'));var _=require(_0x913e('0xb'));var squel=require(_0x913e('0xc'));var crypto=require('crypto');var jsforce=require(_0x913e('0xd'));var deskjs=require(_0x913e('0xe'));var toCsv=require(_0x913e('0x8'));var querystring=require(_0x913e('0xf'));var Papa=require(_0x913e('0x10'));var Redis=require('ioredis');var authService=require(_0x913e('0x11'));var qs=require(_0x913e('0x12'));var as=require(_0x913e('0x13'));var hardwareService=require(_0x913e('0x14'));var logger=require(_0x913e('0x15'))(_0x913e('0x16'));var utils=require('../../config/utils');var config=require(_0x913e('0x17'));var licenseUtil=require(_0x913e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d6bba,_0x1acfb0){_0x1acfb0=_0x1acfb0||0xcc;return function(_0x2f1431){if(_0x2f1431){return _0x4d6bba[_0x913e('0x19')](_0x1acfb0);}return _0x4d6bba[_0x913e('0x1a')](_0x1acfb0)[_0x913e('0x1b')]();};}function respondWithResult(_0x3cabad,_0x28995f){_0x28995f=_0x28995f||0xc8;return function(_0x2e37ef){if(_0x2e37ef){return _0x3cabad['status'](_0x28995f)[_0x913e('0x1c')](_0x2e37ef);}};}function respondWithFilteredResult(_0x37e380,_0x655370){return function(_0x246916){if(_0x246916){var _0x18473b=typeof _0x655370['offset']==='undefined'&&typeof _0x655370[_0x913e('0x1d')]===_0x913e('0x1e');var _0x5613f2=_0x246916[_0x913e('0x1f')];var _0x1c4064=_0x18473b?0x0:_0x655370['offset'];var _0x3e229d=_0x18473b?_0x246916[_0x913e('0x1f')]:_0x655370[_0x913e('0x20')]+_0x655370[_0x913e('0x1d')];var _0x1f2ab6;if(_0x3e229d>=_0x5613f2){_0x3e229d=_0x5613f2;_0x1f2ab6=0xc8;}else{_0x1f2ab6=0xce;}_0x37e380[_0x913e('0x1a')](_0x1f2ab6);return _0x37e380[_0x913e('0x21')](_0x913e('0x22'),_0x1c4064+'-'+_0x3e229d+'/'+_0x5613f2)[_0x913e('0x1c')](_0x246916);}return null;};}function patchUpdates(_0x56b6f1){return function(_0x2372c2){try{jsonpatch['apply'](_0x2372c2,_0x56b6f1,!![]);}catch(_0x4c4d50){return BPromise[_0x913e('0x23')](_0x4c4d50);}return _0x2372c2[_0x913e('0x24')]();};}function saveUpdates(_0x4ecdb5,_0x4da181){return function(_0x3c2c12){if(_0x3c2c12){return _0x3c2c12[_0x913e('0x25')](_0x4ecdb5)[_0x913e('0x26')](function(_0x4dae57){return _0x4dae57;});}return null;};}function removeEntity(_0x16240e,_0x5c3523){return function(_0xae9fc2){if(_0xae9fc2){return _0xae9fc2['destroy']()['then'](function(){var _0x2a89cc=_0xae9fc2[_0x913e('0x27')]({'plain':!![]});var _0x2fae3d=_0x913e('0x28');return db[_0x913e('0x29')][_0x913e('0x2a')]({'where':{'type':_0x2fae3d,'resourceId':_0x2a89cc['id']}})['then'](function(){return _0xae9fc2;});})[_0x913e('0x26')](function(){_0x16240e[_0x913e('0x1a')](0xcc)[_0x913e('0x1b')]();});}};}function handleEntityNotFound(_0x2c1fc9,_0x2c4e3d){return function(_0x357a5d){if(!_0x357a5d){_0x2c1fc9['sendStatus'](0x194);}return _0x357a5d;};}function handleError(_0xe923c9,_0x559bc3){_0x559bc3=_0x559bc3||0x1f4;return function(_0x1e05b2){logger[_0x913e('0x2b')](_0x1e05b2['stack']);if(_0x1e05b2[_0x913e('0x2c')]){delete _0x1e05b2[_0x913e('0x2c')];}_0xe923c9[_0x913e('0x1a')](_0x559bc3)[_0x913e('0x2d')](_0x1e05b2);};}exports[_0x913e('0x2e')]=function(_0x550350,_0x415501){var _0x5e53d8={},_0x223e3a={},_0x17391d={'count':0x0,'rows':[]};var _0x26e760=_[_0x913e('0x2f')](db[_0x913e('0x30')][_0x913e('0x31')],function(_0x516ce0){return{'name':_0x516ce0[_0x913e('0x32')],'type':_0x516ce0[_0x913e('0x33')][_0x913e('0x34')]};});_0x223e3a[_0x913e('0x35')]=_[_0x913e('0x2f')](_0x26e760,_0x913e('0x2c'));_0x223e3a['query']=_[_0x913e('0x36')](_0x550350[_0x913e('0x37')]);_0x223e3a[_0x913e('0x38')]=_[_0x913e('0x39')](_0x223e3a[_0x913e('0x35')],_0x223e3a[_0x913e('0x37')]);_0x5e53d8[_0x913e('0x3a')]=_[_0x913e('0x39')](_0x223e3a[_0x913e('0x35')],qs[_0x913e('0x3b')](_0x550350[_0x913e('0x37')]['fields']));_0x5e53d8[_0x913e('0x3a')]=_0x5e53d8[_0x913e('0x3a')][_0x913e('0x3c')]?_0x5e53d8['attributes']:_0x223e3a['model'];if(!_0x550350[_0x913e('0x37')][_0x913e('0x3d')](_0x913e('0x3e'))){_0x5e53d8[_0x913e('0x1d')]=qs[_0x913e('0x1d')](_0x550350[_0x913e('0x37')][_0x913e('0x1d')]);_0x5e53d8[_0x913e('0x20')]=qs[_0x913e('0x20')](_0x550350['query'][_0x913e('0x20')]);}_0x5e53d8[_0x913e('0x3f')]=qs[_0x913e('0x40')](_0x550350[_0x913e('0x37')][_0x913e('0x40')]);_0x5e53d8[_0x913e('0x41')]=qs[_0x913e('0x38')](_[_0x913e('0x42')](_0x550350[_0x913e('0x37')],_0x223e3a[_0x913e('0x38')]),_0x26e760);if(_0x550350[_0x913e('0x37')][_0x913e('0x43')]){_0x5e53d8[_0x913e('0x41')]=_[_0x913e('0x44')](_0x5e53d8['where'],{'$or':_[_0x913e('0x2f')](_0x26e760,function(_0x146fb6){if(_0x146fb6[_0x913e('0x33')]!==_0x913e('0x45')){var _0x2bbbbe={};_0x2bbbbe[_0x146fb6['name']]={'$like':'%'+_0x550350[_0x913e('0x37')][_0x913e('0x43')]+'%'};return _0x2bbbbe;}})});}_0x5e53d8=_[_0x913e('0x44')]({},_0x5e53d8,_0x550350['options']);var _0x430eca={'where':_0x5e53d8['where']};return db[_0x913e('0x30')][_0x913e('0x1f')](_0x430eca)[_0x913e('0x26')](function(_0x301076){_0x17391d['count']=_0x301076;if(_0x550350['query'][_0x913e('0x46')]){_0x5e53d8[_0x913e('0x47')]=[{'all':!![]}];}return db[_0x913e('0x30')]['findAll'](_0x5e53d8);})[_0x913e('0x26')](function(_0x438d18){_0x17391d['rows']=_0x438d18;return _0x17391d;})[_0x913e('0x26')](respondWithFilteredResult(_0x415501,_0x5e53d8))[_0x913e('0x48')](handleError(_0x415501,null));};exports['show']=function(_0x60c5e0,_0x396dfc){var _0x52bcc0={'raw':![],'where':{'id':_0x60c5e0['params']['id']}},_0x871167={};_0x871167['model']=_['keys'](db[_0x913e('0x30')][_0x913e('0x31')]);_0x871167['query']=_[_0x913e('0x36')](_0x60c5e0[_0x913e('0x37')]);_0x871167[_0x913e('0x38')]=_['intersection'](_0x871167['model'],_0x871167[_0x913e('0x37')]);_0x52bcc0[_0x913e('0x3a')]=_['intersection'](_0x871167['model'],qs[_0x913e('0x3b')](_0x60c5e0[_0x913e('0x37')][_0x913e('0x3b')]));_0x52bcc0[_0x913e('0x3a')]=_0x52bcc0[_0x913e('0x3a')][_0x913e('0x3c')]?_0x52bcc0[_0x913e('0x3a')]:_0x871167[_0x913e('0x35')];if(_0x60c5e0[_0x913e('0x37')][_0x913e('0x46')]){_0x52bcc0[_0x913e('0x47')]=[{'all':!![]}];}_0x52bcc0=_['merge']({},_0x52bcc0,_0x60c5e0['options']);return db[_0x913e('0x30')][_0x913e('0x49')](_0x52bcc0)['then'](handleEntityNotFound(_0x396dfc,null))[_0x913e('0x26')](respondWithResult(_0x396dfc,null))[_0x913e('0x48')](handleError(_0x396dfc,null));};exports[_0x913e('0x4a')]=function(_0x3c6495,_0x2643bb){return db['Trigger'][_0x913e('0x4a')](_0x3c6495[_0x913e('0x4b')],{})['then'](function(_0x589e33){var _0x44b414=_0x3c6495[_0x913e('0x4c')]['get']({'plain':!![]});if(!_0x44b414)throw new Error(_0x913e('0x4d'));if(_0x44b414[_0x913e('0x4e')]===_0x913e('0x4c')){var _0x46e37d=_0x589e33[_0x913e('0x27')]({'plain':!![]});var _0x360040=_0x913e('0x28');return db[_0x913e('0x4f')][_0x913e('0x49')]({'where':{'name':_0x360040,'userProfileId':_0x44b414[_0x913e('0x50')]},'raw':!![]})[_0x913e('0x26')](function(_0x21d823){if(_0x21d823&&_0x21d823['autoAssociation']===0x0){return db[_0x913e('0x29')]['create']({'name':_0x46e37d[_0x913e('0x2c')],'resourceId':_0x46e37d['id'],'type':_0x21d823[_0x913e('0x2c')],'sectionId':_0x21d823['id']},{})[_0x913e('0x26')](function(){return _0x589e33;});}else{return _0x589e33;}})[_0x913e('0x48')](function(_0x3e8d53){logger['error'](_0x913e('0x51'),_0x3e8d53);throw _0x3e8d53;});}return _0x589e33;})['then'](respondWithResult(_0x2643bb,0xc9))[_0x913e('0x48')](handleError(_0x2643bb,null));};exports[_0x913e('0x25')]=function(_0x4a226c,_0x12e4d9){if(_0x4a226c[_0x913e('0x4b')]['id']){delete _0x4a226c['body']['id'];}return db['Trigger'][_0x913e('0x49')]({'where':{'id':_0x4a226c[_0x913e('0x52')]['id']}})[_0x913e('0x26')](handleEntityNotFound(_0x12e4d9,null))[_0x913e('0x26')](saveUpdates(_0x4a226c[_0x913e('0x4b')],null))[_0x913e('0x26')](respondWithResult(_0x12e4d9,null))[_0x913e('0x48')](handleError(_0x12e4d9,null));};exports[_0x913e('0x2a')]=function(_0x2eb389,_0xfcce1){return db[_0x913e('0x30')][_0x913e('0x49')]({'where':{'id':_0x2eb389[_0x913e('0x52')]['id']}})[_0x913e('0x26')](handleEntityNotFound(_0xfcce1,null))['then'](removeEntity(_0xfcce1,null))[_0x913e('0x48')](handleError(_0xfcce1,null));};exports[_0x913e('0x53')]=function(_0x5ad454,_0x2d82d1,_0x4d7b49){if(_0x5ad454['body']['id']){delete _0x5ad454[_0x913e('0x4b')]['id'];}return db[_0x913e('0x30')][_0x913e('0x49')]({'where':{'id':_0x5ad454[_0x913e('0x52')]['id']}})[_0x913e('0x26')](handleEntityNotFound(_0x2d82d1,null))[_0x913e('0x26')](function(_0x498df8){if(_0x498df8){_0x5ad454[_0x913e('0x4b')][_0x913e('0x54')]=_0x498df8['id'];return db[_0x913e('0x55')][_0x913e('0x4a')](_0x5ad454[_0x913e('0x4b')]);}})['then'](respondWithResult(_0x2d82d1,null))['catch'](handleError(_0x2d82d1,null));};exports['addAnyCondition']=function(_0x5b1883,_0x316956,_0x1dc99a){if(_0x5b1883[_0x913e('0x4b')]['id']){delete _0x5b1883[_0x913e('0x4b')]['id'];}return db['Trigger']['find']({'where':{'id':_0x5b1883[_0x913e('0x52')]['id']}})[_0x913e('0x26')](handleEntityNotFound(_0x316956,null))['then'](function(_0xb45f1c){if(_0xb45f1c){_0x5b1883[_0x913e('0x4b')][_0x913e('0x56')]=_0xb45f1c['id'];return db['Condition'][_0x913e('0x4a')](_0x5b1883[_0x913e('0x4b')]);}})[_0x913e('0x26')](respondWithResult(_0x316956,null))[_0x913e('0x48')](handleError(_0x316956,null));};exports[_0x913e('0x57')]=function(_0x18004a,_0x24b746,_0x52b1cd){var _0x1e94f7={};var _0x133f7f={};var _0x37a9d8;var _0x143724;return db[_0x913e('0x30')]['findOne']({'where':{'id':_0x18004a['params']['id']}})[_0x913e('0x26')](handleEntityNotFound(_0x24b746,null))[_0x913e('0x26')](function(_0x596166){if(_0x596166){_0x37a9d8=_0x596166;_0x133f7f[_0x913e('0x35')]=_[_0x913e('0x36')](db[_0x913e('0x55')]['rawAttributes']);_0x133f7f['query']=_[_0x913e('0x36')](_0x18004a[_0x913e('0x37')]);_0x133f7f[_0x913e('0x38')]=_[_0x913e('0x39')](_0x133f7f[_0x913e('0x35')],_0x133f7f['query']);_0x1e94f7['attributes']=_[_0x913e('0x39')](_0x133f7f[_0x913e('0x35')],qs[_0x913e('0x3b')](_0x18004a[_0x913e('0x37')]['fields']));_0x1e94f7[_0x913e('0x3a')]=_0x1e94f7[_0x913e('0x3a')]['length']?_0x1e94f7['attributes']:_0x133f7f[_0x913e('0x35')];_0x1e94f7['order']=qs['sort'](_0x18004a[_0x913e('0x37')][_0x913e('0x40')]);_0x1e94f7['where']=qs[_0x913e('0x38')](_[_0x913e('0x42')](_0x18004a['query'],_0x133f7f[_0x913e('0x38')]));if(_0x18004a[_0x913e('0x37')][_0x913e('0x43')]){_0x1e94f7['where']=_[_0x913e('0x44')](_0x1e94f7[_0x913e('0x41')],{'$or':_[_0x913e('0x2f')](_0x1e94f7[_0x913e('0x3a')],function(_0x2b645a){var _0x3ee2f0={};_0x3ee2f0[_0x2b645a]={'$like':'%'+_0x18004a[_0x913e('0x37')]['filter']+'%'};return _0x3ee2f0;})});}_0x1e94f7=_[_0x913e('0x44')]({},_0x1e94f7,_0x18004a[_0x913e('0x58')]);return _0x37a9d8[_0x913e('0x57')](_0x1e94f7);}})[_0x913e('0x26')](function(_0x51903e){if(_0x51903e){_0x143724=_0x51903e['length'];if(!_0x18004a[_0x913e('0x37')]['hasOwnProperty'](_0x913e('0x3e'))){_0x1e94f7[_0x913e('0x1d')]=qs[_0x913e('0x1d')](_0x18004a['query'][_0x913e('0x1d')]);_0x1e94f7[_0x913e('0x20')]=qs['offset'](_0x18004a[_0x913e('0x37')]['offset']);}return _0x37a9d8[_0x913e('0x57')](_0x1e94f7);}})['then'](function(_0x353a04){if(_0x353a04){return _0x353a04?{'count':_0x143724,'rows':_0x353a04}:null;}})['then'](respondWithResult(_0x24b746,null))[_0x913e('0x48')](handleError(_0x24b746,null));};exports[_0x913e('0x59')]=function(_0x3970f2,_0x1fc083,_0x5572ec){var _0x137ce5={};var _0x59cdc1={};var _0xfc664f;var _0x191f87;return db[_0x913e('0x30')][_0x913e('0x5a')]({'where':{'id':_0x3970f2['params']['id']}})[_0x913e('0x26')](handleEntityNotFound(_0x1fc083,null))[_0x913e('0x26')](function(_0x412c65){if(_0x412c65){_0xfc664f=_0x412c65;_0x59cdc1[_0x913e('0x35')]=_[_0x913e('0x36')](db[_0x913e('0x55')][_0x913e('0x31')]);_0x59cdc1['query']=_[_0x913e('0x36')](_0x3970f2['query']);_0x59cdc1['filters']=_[_0x913e('0x39')](_0x59cdc1[_0x913e('0x35')],_0x59cdc1['query']);_0x137ce5['attributes']=_[_0x913e('0x39')](_0x59cdc1[_0x913e('0x35')],qs[_0x913e('0x3b')](_0x3970f2['query'][_0x913e('0x3b')]));_0x137ce5['attributes']=_0x137ce5[_0x913e('0x3a')][_0x913e('0x3c')]?_0x137ce5[_0x913e('0x3a')]:_0x59cdc1['model'];_0x137ce5['order']=qs[_0x913e('0x40')](_0x3970f2[_0x913e('0x37')]['sort']);_0x137ce5[_0x913e('0x41')]=qs[_0x913e('0x38')](_[_0x913e('0x42')](_0x3970f2[_0x913e('0x37')],_0x59cdc1[_0x913e('0x38')]));if(_0x3970f2[_0x913e('0x37')]['filter']){_0x137ce5[_0x913e('0x41')]=_['merge'](_0x137ce5[_0x913e('0x41')],{'$or':_[_0x913e('0x2f')](_0x137ce5[_0x913e('0x3a')],function(_0x51a68f){var _0x53e0fa={};_0x53e0fa[_0x51a68f]={'$like':'%'+_0x3970f2[_0x913e('0x37')][_0x913e('0x43')]+'%'};return _0x53e0fa;})});}_0x137ce5=_[_0x913e('0x44')]({},_0x137ce5,_0x3970f2[_0x913e('0x58')]);return _0xfc664f[_0x913e('0x59')](_0x137ce5);}})[_0x913e('0x26')](function(_0xdc9796){if(_0xdc9796){_0x191f87=_0xdc9796[_0x913e('0x3c')];if(!_0x3970f2[_0x913e('0x37')]['hasOwnProperty']('nolimit')){_0x137ce5[_0x913e('0x1d')]=qs['limit'](_0x3970f2[_0x913e('0x37')]['limit']);_0x137ce5['offset']=qs[_0x913e('0x20')](_0x3970f2[_0x913e('0x37')][_0x913e('0x20')]);}return _0xfc664f[_0x913e('0x59')](_0x137ce5);}})[_0x913e('0x26')](function(_0x3c4dc6){if(_0x3c4dc6){return _0x3c4dc6?{'count':_0x191f87,'rows':_0x3c4dc6}:null;}})['then'](respondWithResult(_0x1fc083,null))[_0x913e('0x48')](handleError(_0x1fc083,null));};exports[_0x913e('0x5b')]=function(_0xbb6a35,_0x300fc0,_0x447cfb){if(_0xbb6a35['body']['id']){delete _0xbb6a35[_0x913e('0x4b')]['id'];}return db[_0x913e('0x30')][_0x913e('0x49')]({'where':{'id':_0xbb6a35[_0x913e('0x52')]['id']}})['then'](handleEntityNotFound(_0x300fc0,null))[_0x913e('0x26')](function(_0x472be4){if(_0x472be4){_0xbb6a35[_0x913e('0x4b')]['TriggerId']=_0x472be4['id'];return db[_0x913e('0x5c')][_0x913e('0x4a')](_0xbb6a35['body']);}})[_0x913e('0x26')](respondWithResult(_0x300fc0,null))[_0x913e('0x48')](handleError(_0x300fc0,null));};exports[_0x913e('0x5d')]=function(_0x24b8b8,_0x223cbc,_0x2a188f){var _0x190785={};var _0x361c63={};var _0x4f3d52;var _0x428f3e;return db[_0x913e('0x30')]['findOne']({'where':{'id':_0x24b8b8['params']['id']}})[_0x913e('0x26')](handleEntityNotFound(_0x223cbc,null))[_0x913e('0x26')](function(_0x36c026){if(_0x36c026){_0x4f3d52=_0x36c026;_0x361c63[_0x913e('0x35')]=_[_0x913e('0x36')](db['Action'][_0x913e('0x31')]);_0x361c63['query']=_['keys'](_0x24b8b8[_0x913e('0x37')]);_0x361c63['filters']=_[_0x913e('0x39')](_0x361c63[_0x913e('0x35')],_0x361c63['query']);_0x190785['attributes']=_['intersection'](_0x361c63[_0x913e('0x35')],qs['fields'](_0x24b8b8[_0x913e('0x37')]['fields']));_0x190785['attributes']=_0x190785['attributes'][_0x913e('0x3c')]?_0x190785[_0x913e('0x3a')]:_0x361c63[_0x913e('0x35')];_0x190785[_0x913e('0x3f')]=qs['sort'](_0x24b8b8[_0x913e('0x37')][_0x913e('0x40')]);_0x190785[_0x913e('0x41')]=qs[_0x913e('0x38')](_[_0x913e('0x42')](_0x24b8b8['query'],_0x361c63[_0x913e('0x38')]));if(_0x24b8b8['query'][_0x913e('0x43')]){_0x190785['where']=_[_0x913e('0x44')](_0x190785[_0x913e('0x41')],{'$or':_[_0x913e('0x2f')](_0x190785[_0x913e('0x3a')],function(_0x1ea623){var _0x2860dd={};_0x2860dd[_0x1ea623]={'$like':'%'+_0x24b8b8[_0x913e('0x37')]['filter']+'%'};return _0x2860dd;})});}_0x190785=_['merge']({},_0x190785,_0x24b8b8['options']);return _0x4f3d52[_0x913e('0x5d')](_0x190785);}})[_0x913e('0x26')](function(_0x2289a7){if(_0x2289a7){_0x428f3e=_0x2289a7[_0x913e('0x3c')];if(!_0x24b8b8['query']['hasOwnProperty'](_0x913e('0x3e'))){_0x190785[_0x913e('0x1d')]=qs[_0x913e('0x1d')](_0x24b8b8[_0x913e('0x37')][_0x913e('0x1d')]);_0x190785[_0x913e('0x20')]=qs[_0x913e('0x20')](_0x24b8b8[_0x913e('0x37')]['offset']);}return _0x4f3d52['getActions'](_0x190785);}})['then'](function(_0x3df339){if(_0x3df339){return _0x3df339?{'count':_0x428f3e,'rows':_0x3df339}:null;}})['then'](respondWithResult(_0x223cbc,null))[_0x913e('0x48')](handleError(_0x223cbc,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index c072a5e..ce8879f 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 _0x7e16=['api','request-promise','rimraf','../../config/environment','exports','define','Trigger','lodash','util','../../config/logger'];(function(_0x4cd030,_0x4a3395){var _0x14adab=function(_0xa40e94){while(--_0xa40e94){_0x4cd030['push'](_0x4cd030['shift']());}};_0x14adab(++_0x4a3395);}(_0x7e16,0x16f));var _0x67e1=function(_0x4c7f58,_0x4ed697){_0x4c7f58=_0x4c7f58-0x0;var _0x1c1d34=_0x7e16[_0x4c7f58];return _0x1c1d34;};'use strict';var _=require(_0x67e1('0x0'));var util=require(_0x67e1('0x1'));var logger=require(_0x67e1('0x2'))(_0x67e1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x67e1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x67e1('0x5'));var config=require(_0x67e1('0x6'));var attributes=require('./trigger.attributes');module[_0x67e1('0x7')]=function(_0x3b5769,_0x2e0cb9){return _0x3b5769[_0x67e1('0x8')](_0x67e1('0x9'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4ba=['../../config/logger','api','moment','request-promise','../../config/environment','./trigger.attributes','exports','define','tools_triggers','util'];(function(_0x395199,_0x515152){var _0x4a0d44=function(_0x306ca0){while(--_0x306ca0){_0x395199['push'](_0x395199['shift']());}};_0x4a0d44(++_0x515152);}(_0xa4ba,0x1b7));var _0xaa4b=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xa4ba[_0x5a776b];return _0xbbef59;};'use strict';var _=require('lodash');var util=require(_0xaa4b('0x0'));var logger=require(_0xaa4b('0x1'))(_0xaa4b('0x2'));var moment=require(_0xaa4b('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa4b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaa4b('0x5'));var attributes=require(_0xaa4b('0x6'));module[_0xaa4b('0x7')]=function(_0x146035,_0x4809a9){return _0x146035[_0xaa4b('0x8')]('Trigger',attributes,{'tableName':_0xaa4b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 994bc6c..b209514 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 _0x0794=['ShowTrigger','find','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','include','model','map'];(function(_0x316c42,_0x3391f0){var _0x2b38f7=function(_0x38d2cf){while(--_0x38d2cf){_0x316c42['push'](_0x316c42['shift']());}};_0x2b38f7(++_0x3391f0);}(_0x0794,0x14c));var _0x4079=function(_0x51af2f,_0x2cf8ad){_0x51af2f=_0x51af2f-0x0;var _0x4535d4=_0x0794[_0x51af2f];return _0x4535d4;};'use strict';var _=require(_0x4079('0x0'));var util=require(_0x4079('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4079('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4079('0x3'))['db'];var utils=require(_0x4079('0x4'));var logger=require('../../config/logger')(_0x4079('0x5'));var config=require(_0x4079('0x6'));var jayson=require(_0x4079('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1685c7,_0x51e989,_0x419a12){return new BPromise(function(_0x49f621,_0xd390fd){return client[_0x4079('0x8')](_0x1685c7,_0x419a12)[_0x4079('0x9')](function(_0x52e4f0){logger[_0x4079('0xa')](_0x4079('0xb'),_0x51e989,'request\x20sent');logger[_0x4079('0xc')](_0x4079('0xd'),_0x51e989,_0x4079('0xe'),JSON[_0x4079('0xf')](_0x52e4f0));if(_0x52e4f0['error']){if(_0x52e4f0[_0x4079('0x10')][_0x4079('0x11')]===0x1f4){logger[_0x4079('0x10')](_0x4079('0xb'),_0x51e989,_0x52e4f0['error'][_0x4079('0x12')]);return _0xd390fd(_0x52e4f0[_0x4079('0x10')][_0x4079('0x12')]);}logger[_0x4079('0x10')](_0x4079('0xb'),_0x51e989,_0x52e4f0[_0x4079('0x10')]['message']);return _0x49f621(_0x52e4f0[_0x4079('0x10')][_0x4079('0x12')]);}else{logger[_0x4079('0xa')](_0x4079('0xb'),_0x51e989,_0x4079('0xe'));_0x49f621(_0x52e4f0[_0x4079('0x13')][_0x4079('0x12')]);}})[_0x4079('0x14')](function(_0x3479c1){logger[_0x4079('0x10')](_0x4079('0xb'),_0x51e989,_0x3479c1);_0xd390fd(_0x3479c1);});});}exports[_0x4079('0x15')]=function(_0x132d21){var _0x7fa7df=this;return new Promise(function(_0x1c5f25,_0x264d77){return db[_0x4079('0x16')][_0x4079('0x17')]({'raw':_0x132d21[_0x4079('0x18')]?_0x132d21['options'][_0x4079('0x19')]===undefined?!![]:![]:!![],'where':_0x132d21['options']?_0x132d21['options'][_0x4079('0x1a')]||null:null,'attributes':_0x132d21[_0x4079('0x18')]?_0x132d21[_0x4079('0x18')][_0x4079('0x1b')]||null:null,'limit':_0x132d21['options']?_0x132d21[_0x4079('0x18')]['limit']||null:null,'include':_0x132d21[_0x4079('0x18')]?_0x132d21[_0x4079('0x18')][_0x4079('0x1c')]?_['map'](_0x132d21['options']['include'],function(_0x38fcfb){return{'model':db[_0x38fcfb[_0x4079('0x1d')]],'as':_0x38fcfb['as'],'attributes':_0x38fcfb['attributes'],'include':_0x38fcfb[_0x4079('0x1c')]?_[_0x4079('0x1e')](_0x38fcfb[_0x4079('0x1c')],function(_0x374bdc){return{'model':db[_0x374bdc[_0x4079('0x1d')]],'as':_0x374bdc['as'],'attributes':_0x374bdc[_0x4079('0x1b')],'include':_0x374bdc[_0x4079('0x1c')]?_[_0x4079('0x1e')](_0x374bdc[_0x4079('0x1c')],function(_0x37f570){return{'model':db[_0x37f570['model']],'as':_0x37f570['as'],'attributes':_0x37f570[_0x4079('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4079('0x9')](function(_0x3d011c){logger[_0x4079('0xa')](_0x4079('0x15'),_0x132d21);logger[_0x4079('0xc')](_0x4079('0x15'),_0x132d21,JSON[_0x4079('0xf')](_0x3d011c));_0x1c5f25(_0x3d011c);})['catch'](function(_0x508568){logger['error'](_0x4079('0x15'),_0x508568['message'],_0x132d21);_0x264d77(_0x7fa7df[_0x4079('0x10')](0x1f4,_0x508568[_0x4079('0x12')]));});});};exports[_0x4079('0x1f')]=function(_0x2fbb9d){var _0x263e8b=this;return new Promise(function(_0xb2d417,_0x5e4b76){return db[_0x4079('0x16')][_0x4079('0x20')]({'raw':_0x2fbb9d[_0x4079('0x18')]?_0x2fbb9d['options'][_0x4079('0x19')]===undefined?!![]:![]:!![],'where':_0x2fbb9d[_0x4079('0x18')]?_0x2fbb9d[_0x4079('0x18')][_0x4079('0x1a')]||null:null,'attributes':_0x2fbb9d[_0x4079('0x18')]?_0x2fbb9d[_0x4079('0x18')][_0x4079('0x1b')]||null:null,'include':_0x2fbb9d[_0x4079('0x18')]?_0x2fbb9d[_0x4079('0x18')][_0x4079('0x1c')]?_[_0x4079('0x1e')](_0x2fbb9d[_0x4079('0x18')][_0x4079('0x1c')],function(_0x1ec74){return{'model':db[_0x1ec74['model']],'as':_0x1ec74['as'],'attributes':_0x1ec74[_0x4079('0x1b')],'include':_0x1ec74[_0x4079('0x1c')]?_[_0x4079('0x1e')](_0x1ec74[_0x4079('0x1c')],function(_0x39e65a){return{'model':db[_0x39e65a[_0x4079('0x1d')]],'as':_0x39e65a['as'],'attributes':_0x39e65a[_0x4079('0x1b')],'include':_0x39e65a[_0x4079('0x1c')]?_['map'](_0x39e65a[_0x4079('0x1c')],function(_0x206c44){return{'model':db[_0x206c44[_0x4079('0x1d')]],'as':_0x206c44['as'],'attributes':_0x206c44[_0x4079('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4079('0x9')](function(_0x1cccff){logger[_0x4079('0xa')](_0x4079('0x1f'),_0x2fbb9d);logger['debug'](_0x4079('0x1f'),_0x2fbb9d,JSON['stringify'](_0x1cccff));_0xb2d417(_0x1cccff);})[_0x4079('0x14')](function(_0x356488){logger[_0x4079('0x10')](_0x4079('0x1f'),_0x356488[_0x4079('0x12')],_0x2fbb9d);_0x5e4b76(_0x263e8b[_0x4079('0x10')](0x1f4,_0x356488['message']));});});}; \ No newline at end of file +var _0x350f=['ShowTrigger','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','code','error','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','include','map','model','attributes','debug'];(function(_0x8c6ebe,_0x17297f){var _0x4239f6=function(_0x2898ea){while(--_0x2898ea){_0x8c6ebe['push'](_0x8c6ebe['shift']());}};_0x4239f6(++_0x17297f);}(_0x350f,0x146));var _0xf350=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0x350f[_0x237da8];return _0x558825;};'use strict';var _=require(_0xf350('0x0'));var util=require(_0xf350('0x1'));var moment=require(_0xf350('0x2'));var BPromise=require(_0xf350('0x3'));var rs=require(_0xf350('0x4'));var fs=require('fs');var Redis=require(_0xf350('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf350('0x6'))(_0xf350('0x7'));var config=require(_0xf350('0x8'));var jayson=require(_0xf350('0x9'));var client=jayson[_0xf350('0xa')][_0xf350('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4dff6f,_0x5b0549,_0x4dbb6f){return new BPromise(function(_0xe1c780,_0x24714c){return client['request'](_0x4dff6f,_0x4dbb6f)[_0xf350('0xc')](function(_0x209b4e){logger[_0xf350('0xd')]('Trigger,\x20%s,\x20%s',_0x5b0549,_0xf350('0xe'));logger['debug'](_0xf350('0xf'),_0x5b0549,_0xf350('0xe'),JSON[_0xf350('0x10')](_0x209b4e));if(_0x209b4e['error']){if(_0x209b4e['error'][_0xf350('0x11')]===0x1f4){logger[_0xf350('0x12')](_0xf350('0x13'),_0x5b0549,_0x209b4e[_0xf350('0x12')][_0xf350('0x14')]);return _0x24714c(_0x209b4e[_0xf350('0x12')][_0xf350('0x14')]);}logger[_0xf350('0x12')](_0xf350('0x13'),_0x5b0549,_0x209b4e[_0xf350('0x12')][_0xf350('0x14')]);return _0xe1c780(_0x209b4e['error'][_0xf350('0x14')]);}else{logger['info'](_0xf350('0x13'),_0x5b0549,_0xf350('0xe'));_0xe1c780(_0x209b4e[_0xf350('0x15')][_0xf350('0x14')]);}})[_0xf350('0x16')](function(_0x4c7018){logger[_0xf350('0x12')](_0xf350('0x13'),_0x5b0549,_0x4c7018);_0x24714c(_0x4c7018);});});}exports[_0xf350('0x17')]=function(_0x259df0){var _0x271fc2=this;return new Promise(function(_0x188e69,_0x4a05b7){return db[_0xf350('0x18')][_0xf350('0x19')]({'raw':_0x259df0[_0xf350('0x1a')]?_0x259df0['options'][_0xf350('0x1b')]===undefined?!![]:![]:!![],'where':_0x259df0[_0xf350('0x1a')]?_0x259df0['options'][_0xf350('0x1c')]||null:null,'attributes':_0x259df0['options']?_0x259df0[_0xf350('0x1a')]['attributes']||null:null,'limit':_0x259df0['options']?_0x259df0[_0xf350('0x1a')]['limit']||null:null,'include':_0x259df0[_0xf350('0x1a')]?_0x259df0[_0xf350('0x1a')][_0xf350('0x1d')]?_[_0xf350('0x1e')](_0x259df0[_0xf350('0x1a')][_0xf350('0x1d')],function(_0x1db113){return{'model':db[_0x1db113[_0xf350('0x1f')]],'as':_0x1db113['as'],'attributes':_0x1db113[_0xf350('0x20')],'include':_0x1db113[_0xf350('0x1d')]?_[_0xf350('0x1e')](_0x1db113[_0xf350('0x1d')],function(_0x2e1754){return{'model':db[_0x2e1754[_0xf350('0x1f')]],'as':_0x2e1754['as'],'attributes':_0x2e1754[_0xf350('0x20')],'include':_0x2e1754[_0xf350('0x1d')]?_['map'](_0x2e1754['include'],function(_0x325196){return{'model':db[_0x325196['model']],'as':_0x325196['as'],'attributes':_0x325196[_0xf350('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d4c91){logger[_0xf350('0xd')]('GetTrigger',_0x259df0);logger[_0xf350('0x21')](_0xf350('0x17'),_0x259df0,JSON[_0xf350('0x10')](_0x1d4c91));_0x188e69(_0x1d4c91);})['catch'](function(_0x1cf801){logger['error'](_0xf350('0x17'),_0x1cf801[_0xf350('0x14')],_0x259df0);_0x4a05b7(_0x271fc2[_0xf350('0x12')](0x1f4,_0x1cf801[_0xf350('0x14')]));});});};exports[_0xf350('0x22')]=function(_0x3a82e3){var _0x48eb1f=this;return new Promise(function(_0x5ecf80,_0x96d3d){return db[_0xf350('0x18')][_0xf350('0x23')]({'raw':_0x3a82e3[_0xf350('0x1a')]?_0x3a82e3[_0xf350('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3a82e3[_0xf350('0x1a')]?_0x3a82e3[_0xf350('0x1a')][_0xf350('0x1c')]||null:null,'attributes':_0x3a82e3[_0xf350('0x1a')]?_0x3a82e3[_0xf350('0x1a')][_0xf350('0x20')]||null:null,'include':_0x3a82e3['options']?_0x3a82e3['options'][_0xf350('0x1d')]?_['map'](_0x3a82e3[_0xf350('0x1a')][_0xf350('0x1d')],function(_0x4f7713){return{'model':db[_0x4f7713[_0xf350('0x1f')]],'as':_0x4f7713['as'],'attributes':_0x4f7713[_0xf350('0x20')],'include':_0x4f7713[_0xf350('0x1d')]?_['map'](_0x4f7713['include'],function(_0x5ec133){return{'model':db[_0x5ec133[_0xf350('0x1f')]],'as':_0x5ec133['as'],'attributes':_0x5ec133[_0xf350('0x20')],'include':_0x5ec133['include']?_[_0xf350('0x1e')](_0x5ec133[_0xf350('0x1d')],function(_0xbdb138){return{'model':db[_0xbdb138[_0xf350('0x1f')]],'as':_0xbdb138['as'],'attributes':_0xbdb138[_0xf350('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf350('0xc')](function(_0x3b585e){logger[_0xf350('0xd')](_0xf350('0x22'),_0x3a82e3);logger[_0xf350('0x21')](_0xf350('0x22'),_0x3a82e3,JSON[_0xf350('0x10')](_0x3b585e));_0x5ecf80(_0x3b585e);})[_0xf350('0x16')](function(_0x54f398){logger[_0xf350('0x12')](_0xf350('0x22'),_0x54f398['message'],_0x3a82e3);_0x96d3d(_0x48eb1f['error'](0x1f4,_0x54f398[_0xf350('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index a82554d..1dec8be 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 _0x4689=['create','put','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone'];(function(_0x2d5887,_0xace828){var _0x257084=function(_0x457e3a){while(--_0x457e3a){_0x2d5887['push'](_0x2d5887['shift']());}};_0x257084(++_0xace828);}(_0x4689,0x100));var _0x9468=function(_0x209c71,_0x4dcc64){_0x209c71=_0x209c71-0x0;var _0x17fdf1=_0x4689[_0x209c71];return _0x17fdf1;};'use strict';var multer=require(_0x9468('0x0'));var util=require(_0x9468('0x1'));var path=require(_0x9468('0x2'));var timeout=require(_0x9468('0x3'));var express=require(_0x9468('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9468('0x5'));var interaction=require(_0x9468('0x6'));var config=require(_0x9468('0x7'));var controller=require(_0x9468('0x8'));router[_0x9468('0x9')]('/',auth[_0x9468('0xa')](),controller[_0x9468('0xb')]);router[_0x9468('0x9')](_0x9468('0xc'),auth[_0x9468('0xa')](),controller[_0x9468('0xd')]);router[_0x9468('0xe')](_0x9468('0xf'),auth[_0x9468('0xa')](),controller[_0x9468('0x10')]);router[_0x9468('0xe')]('/',auth['isAuthenticated'](),controller[_0x9468('0x11')]);router[_0x9468('0x12')](_0x9468('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x9468('0xc'),auth[_0x9468('0xa')](),controller[_0x9468('0x13')]);module[_0x9468('0x14')]=router; \ No newline at end of file +var _0xee50=['multer','path','connect-timeout','express','Router','../../components/auth/service','./trunk.controller','isAuthenticated','get','/:id','show','post','clone','create','destroy','exports'];(function(_0xfa9fe7,_0xbf5895){var _0x3de70f=function(_0x1e0a6a){while(--_0x1e0a6a){_0xfa9fe7['push'](_0xfa9fe7['shift']());}};_0x3de70f(++_0xbf5895);}(_0xee50,0xa0));var _0x0ee5=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xee50[_0x342baa];return _0x1208f3;};'use strict';var multer=require(_0x0ee5('0x0'));var util=require('util');var path=require(_0x0ee5('0x1'));var timeout=require(_0x0ee5('0x2'));var express=require(_0x0ee5('0x3'));var router=express[_0x0ee5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0ee5('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0ee5('0x6'));router['get']('/',auth[_0x0ee5('0x7')](),controller['index']);router[_0x0ee5('0x8')](_0x0ee5('0x9'),auth[_0x0ee5('0x7')](),controller[_0x0ee5('0xa')]);router[_0x0ee5('0xb')]('/:id/clone',auth[_0x0ee5('0x7')](),controller[_0x0ee5('0xc')]);router[_0x0ee5('0xb')]('/',auth[_0x0ee5('0x7')](),controller[_0x0ee5('0xd')]);router['put'](_0x0ee5('0x9'),auth[_0x0ee5('0x7')](),controller['update']);router['delete'](_0x0ee5('0x9'),auth['isAuthenticated'](),controller[_0x0ee5('0xe')]);module[_0x0ee5('0xf')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 421f01b..5c7029f 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 _0x3d0e=['auto','update','outgoing','yes','force_rport,comedia','nat','all','ulaw;alaw;gsm','join','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','originate','uas','pai','certificate','active','actpass','dynamic','sequelize','STRING','name','friend','user','peer','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','split','rfc2833','info','shortinfo','inband'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0x3d0e,0x1a0));var _0xe3d0=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x3d0e[_0x47e7cb];return _0x2a8874;};'use strict';var Sequelize=require(_0xe3d0('0x0'));module['exports']={'name':{'type':Sequelize[_0xe3d0('0x1')],'allowNull':![],'unique':_0xe3d0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xe3d0('0x3'),_0xe3d0('0x4'),_0xe3d0('0x5')),'allowNull':![],'defaultValue':_0xe3d0('0x3')},'context':{'type':Sequelize[_0xe3d0('0x1')],'allowNull':![],'defaultValue':_0xe3d0('0x6')},'callingpres':{'type':Sequelize[_0xe3d0('0x7')](_0xe3d0('0x8'),_0xe3d0('0x9'),_0xe3d0('0xa'),_0xe3d0('0xb'),_0xe3d0('0xc'),_0xe3d0('0xd'),_0xe3d0('0xe'),_0xe3d0('0xf'))},'deny':{'type':Sequelize[_0xe3d0('0x1')]},'permit':{'type':Sequelize[_0xe3d0('0x1')]},'secret':{'type':Sequelize[_0xe3d0('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xe3d0('0x1')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xe3d0('0x10'),'set':function(_0x38e292){this[_0xe3d0('0x11')](_0xe3d0('0x12'),_0x38e292?_0x38e292['join'](','):null);},'get':function(){return this[_0xe3d0('0x13')](_0xe3d0('0x12'))?this['getDataValue']('transport')[_0xe3d0('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xe3d0('0x7')](_0xe3d0('0x15'),_0xe3d0('0x16'),_0xe3d0('0x17'),_0xe3d0('0x18'),_0xe3d0('0x19')),'defaultValue':_0xe3d0('0x15')},'directmedia':{'type':Sequelize['ENUM']('yes','no','nonat',_0xe3d0('0x1a'),_0xe3d0('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xe3d0('0x1c'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe3d0('0x1')]},'directmediadeny':{'type':Sequelize[_0xe3d0('0x1')]},'nat':{'type':Sequelize[_0xe3d0('0x1')],'defaultValue':_0xe3d0('0x1d'),'set':function(_0x139cea){this[_0xe3d0('0x11')](_0xe3d0('0x1e'),_0x139cea?_0x139cea['join'](','):null);},'get':function(){return this[_0xe3d0('0x13')](_0xe3d0('0x1e'))?this[_0xe3d0('0x13')](_0xe3d0('0x1e'))[_0xe3d0('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xe3d0('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xe3d0('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xe3d0('0x1')]},'language':{'type':Sequelize[_0xe3d0('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe3d0('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xe3d0('0x1')],'defaultValue':_0xe3d0('0x1f')},'allow':{'type':Sequelize[_0xe3d0('0x1')],'allowNull':![],'defaultValue':_0xe3d0('0x20'),'set':function(_0x296373){this['setDataValue']('allow',_0x296373?_0x296373[_0xe3d0('0x21')](';'):_0xe3d0('0x20'));},'get':function(){return this[_0xe3d0('0x13')](_0xe3d0('0x22'))?this['getDataValue'](_0xe3d0('0x22'))[_0xe3d0('0x14')](';'):null;},'comment':_0xe3d0('0x23')},'autoframing':{'type':Sequelize[_0xe3d0('0x7')](_0xe3d0('0x1c'),'no')},'insecure':{'type':Sequelize[_0xe3d0('0x1')],'defaultValue':_0xe3d0('0x24'),'set':function(_0x1f017b){this[_0xe3d0('0x11')](_0xe3d0('0x25'),_0x1f017b?_0x1f017b[_0xe3d0('0x21')](','):null);},'get':function(){return this['getDataValue'](_0xe3d0('0x25'))?this[_0xe3d0('0x13')](_0xe3d0('0x25'))['split'](','):null;},'comment':_0xe3d0('0x26')},'trustrpid':{'type':Sequelize[_0xe3d0('0x7')](_0xe3d0('0x1c'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe3d0('0x7')](_0xe3d0('0x1c'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe3d0('0x7')](_0xe3d0('0x1c'),'no','never')},'promiscredir':{'type':Sequelize[_0xe3d0('0x7')](_0xe3d0('0x1c'),'no')},'useclientcode':{'type':Sequelize[_0xe3d0('0x7')](_0xe3d0('0x1c'),'no')},'accountcode':{'type':Sequelize[_0xe3d0('0x27')](0xb)},'setvar':{'type':Sequelize[_0xe3d0('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xe3d0('0x28')},'amaflags':{'type':Sequelize[_0xe3d0('0x1')]},'callcounter':{'type':Sequelize[_0xe3d0('0x7')]('yes','no'),'defaultValue':_0xe3d0('0x1c')},'busylevel':{'type':Sequelize[_0xe3d0('0x27')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xe3d0('0x1c'),'no')},'allowsubscribe':{'type':Sequelize[_0xe3d0('0x7')](_0xe3d0('0x1c'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xe3d0('0x1c'),'no')},'subscribecontext':{'type':Sequelize[_0xe3d0('0x1')]},'template':{'type':Sequelize[_0xe3d0('0x1')]},'videosupport':{'type':Sequelize[_0xe3d0('0x7')](_0xe3d0('0x1c'),'no',_0xe3d0('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe3d0('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xe3d0('0x7')](_0xe3d0('0x1c'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xe3d0('0x7')]('accept','refuse',_0xe3d0('0x2a'))},'session_expires':{'type':Sequelize[_0xe3d0('0x27')](0xb)},'session_minse':{'type':Sequelize[_0xe3d0('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0xe3d0('0x7')]('uac',_0xe3d0('0x2b')),'defaultValue':_0xe3d0('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0xe3d0('0x1')]},'regexten':{'type':Sequelize[_0xe3d0('0x1')]},'fromdomain':{'type':Sequelize[_0xe3d0('0x1')]},'fromuser':{'type':Sequelize[_0xe3d0('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xe3d0('0x7')](_0xe3d0('0x1c'),'no'),'defaultValue':_0xe3d0('0x1c')},'keepalive':{'type':Sequelize[_0xe3d0('0x27')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xe3d0('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xe3d0('0x7')](_0xe3d0('0x1c'),'no',_0xe3d0('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe3d0('0x1')]},'callbackextension':{'type':Sequelize[_0xe3d0('0x1')]},'timert1':{'type':Sequelize[_0xe3d0('0x27')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xe3d0('0x1')]},'contactdeny':{'type':Sequelize[_0xe3d0('0x1')]},'contactacl':{'type':Sequelize[_0xe3d0('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xe3d0('0x1')]},'use_q850_reason':{'type':Sequelize[_0xe3d0('0x1')]},'maxforwards':{'type':Sequelize[_0xe3d0('0x27')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xe3d0('0x1c'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe3d0('0x7')](_0xe3d0('0x1c'),'no')},'force_avp':{'type':Sequelize[_0xe3d0('0x7')](_0xe3d0('0x1c'),'no')},'icesupport':{'type':Sequelize[_0xe3d0('0x7')](_0xe3d0('0x1c'),'no')},'dtlsenable':{'type':Sequelize[_0xe3d0('0x7')](_0xe3d0('0x1c'),'no')},'dtlsverify':{'type':Sequelize[_0xe3d0('0x7')]('yes','no','fingerprint',_0xe3d0('0x2d'))},'dtlsrekey':{'type':Sequelize[_0xe3d0('0x27')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xe3d0('0x1')]},'dtlscipher':{'type':Sequelize[_0xe3d0('0x1')]},'dtlscafile':{'type':Sequelize[_0xe3d0('0x1')]},'dtlscapath':{'type':Sequelize[_0xe3d0('0x1')]},'dtlssetup':{'type':Sequelize[_0xe3d0('0x7')](_0xe3d0('0x2e'),'passive',_0xe3d0('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe3d0('0x1')]},'usereqphone':{'type':Sequelize[_0xe3d0('0x7')](_0xe3d0('0x1c'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe3d0('0x1')]},'recordofffeature':{'type':Sequelize[_0xe3d0('0x1')]},'call_limit':{'type':Sequelize[_0xe3d0('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xe3d0('0x7')]('yes','no')},'subscribemwi':{'type':Sequelize[_0xe3d0('0x7')](_0xe3d0('0x1c'),'no')},'vmexten':{'type':Sequelize[_0xe3d0('0x1')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xe3d0('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xe3d0('0x1')],'defaultValue':_0xe3d0('0x30')},'canreinvite':{'type':Sequelize[_0xe3d0('0x7')](_0xe3d0('0x1c'),'no','nonat',_0xe3d0('0x1a'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xe3d0('0x1')]},'otherFields':{'type':Sequelize[_0xe3d0('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xe3d0('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x4078=['INTEGER','\x22\x22\x20<>','accept','refuse','originate','uas','pai','fingerprint','active','passive','actpass','BOOLEAN','sequelize','exports','ENUM','friend','user','peer','STRING','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never'];(function(_0x4b1f6c,_0x3d919f){var _0x3a5b24=function(_0x31c0b8){while(--_0x31c0b8){_0x4b1f6c['push'](_0x4b1f6c['shift']());}};_0x3a5b24(++_0x3d919f);}(_0x4078,0xdc));var _0x8407=function(_0x1c5142,_0x30ea72){_0x1c5142=_0x1c5142-0x0;var _0x1268cb=_0x4078[_0x1c5142];return _0x1268cb;};'use strict';var Sequelize=require(_0x8407('0x0'));module[_0x8407('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8407('0x2')](_0x8407('0x3'),_0x8407('0x4'),_0x8407('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x8407('0x6')],'allowNull':![],'defaultValue':_0x8407('0x7')},'callingpres':{'type':Sequelize[_0x8407('0x2')]('ALLOWED_NOT_SCREENED',_0x8407('0x8'),_0x8407('0x9'),_0x8407('0xa'),_0x8407('0xb'),_0x8407('0xc'),_0x8407('0xd'),_0x8407('0xe'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x8407('0x6')]},'secret':{'type':Sequelize[_0x8407('0x6')]},'md5secret':{'type':Sequelize[_0x8407('0x6')]},'remotesecret':{'type':Sequelize[_0x8407('0x6')]},'transport':{'type':Sequelize[_0x8407('0x6')],'defaultValue':'udp','set':function(_0x18b36b){this[_0x8407('0xf')]('transport',_0x18b36b?_0x18b36b['join'](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x8407('0x10')](_0x8407('0x11'))[_0x8407('0x12')](','):null;},'comment':_0x8407('0x13')},'dtmfmode':{'type':Sequelize[_0x8407('0x2')](_0x8407('0x14'),_0x8407('0x15'),_0x8407('0x16'),_0x8407('0x17'),_0x8407('0x18')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x8407('0x19'),'no',_0x8407('0x1a'),_0x8407('0x1b'),_0x8407('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x8407('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x8407('0x6')]},'nat':{'type':Sequelize[_0x8407('0x6')],'defaultValue':'force_rport,comedia','set':function(_0x1d47fd){this[_0x8407('0xf')](_0x8407('0x1d'),_0x1d47fd?_0x1d47fd[_0x8407('0x1e')](','):null);},'get':function(){return this['getDataValue'](_0x8407('0x1d'))?this[_0x8407('0x10')](_0x8407('0x1d'))[_0x8407('0x12')](','):null;},'comment':_0x8407('0x1f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x8407('0x6')]},'pickupgroup':{'type':Sequelize[_0x8407('0x6')]},'namedpickupgroup':{'type':Sequelize[_0x8407('0x6')]},'language':{'type':Sequelize[_0x8407('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x8407('0x6')],'defaultValue':_0x8407('0x20')},'allow':{'type':Sequelize[_0x8407('0x6')],'allowNull':![],'defaultValue':_0x8407('0x21'),'set':function(_0x3dc280){this[_0x8407('0xf')](_0x8407('0x22'),_0x3dc280?_0x3dc280[_0x8407('0x1e')](';'):_0x8407('0x21'));},'get':function(){return this[_0x8407('0x10')](_0x8407('0x22'))?this[_0x8407('0x10')](_0x8407('0x22'))['split'](';'):null;},'comment':_0x8407('0x23')},'autoframing':{'type':Sequelize[_0x8407('0x2')](_0x8407('0x19'),'no')},'insecure':{'type':Sequelize[_0x8407('0x6')],'defaultValue':_0x8407('0x24'),'set':function(_0x1230e4){this[_0x8407('0xf')](_0x8407('0x25'),_0x1230e4?_0x1230e4['join'](','):null);},'get':function(){return this[_0x8407('0x10')](_0x8407('0x25'))?this['getDataValue'](_0x8407('0x25'))[_0x8407('0x12')](','):null;},'comment':_0x8407('0x26')},'trustrpid':{'type':Sequelize[_0x8407('0x2')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x8407('0x2')](_0x8407('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x8407('0x19'),'no',_0x8407('0x27'))},'promiscredir':{'type':Sequelize[_0x8407('0x2')](_0x8407('0x19'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x8407('0x19'),'no')},'accountcode':{'type':Sequelize[_0x8407('0x28')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x8407('0x29')},'amaflags':{'type':Sequelize[_0x8407('0x6')]},'callcounter':{'type':Sequelize['ENUM'](_0x8407('0x19'),'no'),'defaultValue':_0x8407('0x19')},'busylevel':{'type':Sequelize[_0x8407('0x28')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize[_0x8407('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x8407('0x2')](_0x8407('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x8407('0x6')]},'template':{'type':Sequelize[_0x8407('0x6')]},'videosupport':{'type':Sequelize[_0x8407('0x2')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x8407('0x28')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x8407('0x2')](_0x8407('0x19'),'no')},'mailbox':{'type':Sequelize[_0x8407('0x6')]},'session_timers':{'type':Sequelize[_0x8407('0x2')](_0x8407('0x2a'),_0x8407('0x2b'),_0x8407('0x2c'))},'session_expires':{'type':Sequelize[_0x8407('0x28')](0xb)},'session_minse':{'type':Sequelize[_0x8407('0x28')](0xb)},'session_refresher':{'type':Sequelize[_0x8407('0x2')]('uac',_0x8407('0x2d')),'defaultValue':_0x8407('0x2d')},'t38pt_usertpsource':{'type':Sequelize[_0x8407('0x6')]},'regexten':{'type':Sequelize[_0x8407('0x6')]},'fromdomain':{'type':Sequelize[_0x8407('0x6')]},'fromuser':{'type':Sequelize[_0x8407('0x6')]},'port':{'type':Sequelize[_0x8407('0x28')](0x5)},'qualify':{'type':Sequelize[_0x8407('0x2')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x8407('0x28')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x8407('0x6')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x8407('0x28')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x8407('0x2')](_0x8407('0x19'),'no',_0x8407('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8407('0x6')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x8407('0x28')](0xb)},'timerb':{'type':Sequelize[_0x8407('0x28')](0xb)},'qualifyfreq':{'type':Sequelize[_0x8407('0x28')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x8407('0x6')]},'contactacl':{'type':Sequelize[_0x8407('0x6')]},'unsolicited_mailbox':{'type':Sequelize[_0x8407('0x6')]},'use_q850_reason':{'type':Sequelize[_0x8407('0x6')]},'maxforwards':{'type':Sequelize[_0x8407('0x28')](0xb)},'encryption':{'type':Sequelize[_0x8407('0x2')](_0x8407('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8407('0x2')](_0x8407('0x19'),'no')},'force_avp':{'type':Sequelize[_0x8407('0x2')](_0x8407('0x19'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x8407('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0x8407('0x2')](_0x8407('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x8407('0x2')]('yes','no',_0x8407('0x2f'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x8407('0x28')](0xb)},'dtlscertfile':{'type':Sequelize[_0x8407('0x6')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x8407('0x6')]},'dtlscapath':{'type':Sequelize[_0x8407('0x6')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x8407('0x30'),_0x8407('0x31'),_0x8407('0x32')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x8407('0x6')]},'usereqphone':{'type':Sequelize[_0x8407('0x2')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x8407('0x6')]},'recordofffeature':{'type':Sequelize[_0x8407('0x6')]},'call_limit':{'type':Sequelize[_0x8407('0x28')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x8407('0x2')](_0x8407('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x8407('0x2')](_0x8407('0x19'),'no')},'vmexten':{'type':Sequelize[_0x8407('0x6')]},'mohinterpret':{'type':Sequelize[_0x8407('0x6')]},'mohsuggest':{'type':Sequelize[_0x8407('0x6')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x8407('0x2')](_0x8407('0x19'),'no','nonat',_0x8407('0x1b'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x8407('0x6')]},'otherFields':{'type':Sequelize[_0x8407('0x6')]},'active':{'type':Sequelize[_0x8407('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x8407('0x6')],'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 0fef12c..4daad6f 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 _0x84ab=['../../mysqldb','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','index','map','rawAttributes','fieldName','type','query','keys','intersection','fields','attributes','length','model','order','sort','where','filters','pick','merge','filter','options','Trunk','count','includeAll','rows','params','include','find','createdAt','updatedAt','body','omit','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','userProfileId','autoAssociation','root','chan_sip.so','server/files/templates/trunk.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x458eef,_0x551783){var _0x2fb384=function(_0x28465e){while(--_0x28465e){_0x458eef['push'](_0x458eef['shift']());}};_0x2fb384(++_0x551783);}(_0x84ab,0x12f));var _0xb84a=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0x84ab[_0x2a67fe];return _0x57e726;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb84a('0x16')][_0xb84a('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x39a0df,_0x3c161c,_0x44b26b,_0x11dfe9){return new BPromise(function(_0x12ccab,_0x475b){var _0x3113a2=_0x11dfe9||client;return _0x3113a2[_0xb84a('0x18')](_0x39a0df,_0x44b26b)[_0xb84a('0x19')](function(_0x1251ec){logger['info'](_0xb84a('0x1a'),_0x3c161c,_0xb84a('0x1b'));logger[_0xb84a('0x1c')](_0xb84a('0x1d'),_0x3c161c,_0xb84a('0x1b'),JSON[_0xb84a('0x1e')](_0x1251ec));if(_0x1251ec[_0xb84a('0x1f')]){if(_0x1251ec[_0xb84a('0x1f')][_0xb84a('0x20')]===0x1f4){logger[_0xb84a('0x1f')](_0xb84a('0x1a'),_0x3c161c,_0x1251ec[_0xb84a('0x1f')][_0xb84a('0x21')]);return _0x475b(_0x1251ec[_0xb84a('0x1f')]['message']);}logger[_0xb84a('0x1f')](_0xb84a('0x1a'),_0x3c161c,_0x1251ec['error'][_0xb84a('0x21')]);return _0x12ccab(_0x1251ec[_0xb84a('0x1f')][_0xb84a('0x21')]);}else{logger[_0xb84a('0x22')]('Trunk,\x20%s,\x20%s',_0x3c161c,'request\x20sent');_0x12ccab(_0x1251ec[_0xb84a('0x23')][_0xb84a('0x21')]);}})[_0xb84a('0x24')](function(_0x259f74){logger[_0xb84a('0x1f')](_0xb84a('0x1a'),_0x3c161c,_0x259f74);_0x475b(_0x259f74);});});}function respondWithStatusCode(_0x8b28cd,_0x21d0d3){_0x21d0d3=_0x21d0d3||0xcc;return function(_0x3aa06f){if(_0x3aa06f){return _0x8b28cd[_0xb84a('0x25')](_0x21d0d3);}return _0x8b28cd[_0xb84a('0x26')](_0x21d0d3)[_0xb84a('0x27')]();};}function respondWithResult(_0x218aef,_0x409df0){_0x409df0=_0x409df0||0xc8;return function(_0x19bdfa){if(_0x19bdfa){return _0x218aef[_0xb84a('0x26')](_0x409df0)[_0xb84a('0x28')](_0x19bdfa);}};}function respondWithFilteredResult(_0x3ff0bc,_0x3b6805){return function(_0xd468c3){if(_0xd468c3){var _0x33bf1d=typeof _0x3b6805[_0xb84a('0x29')]===_0xb84a('0x2a')&&typeof _0x3b6805[_0xb84a('0x2b')]===_0xb84a('0x2a');var _0x97d71b=_0xd468c3['count'];var _0x582954=_0x33bf1d?0x0:_0x3b6805[_0xb84a('0x29')];var _0x2c30b0=_0x33bf1d?_0xd468c3['count']:_0x3b6805[_0xb84a('0x29')]+_0x3b6805[_0xb84a('0x2b')];var _0x52c23c;if(_0x2c30b0>=_0x97d71b){_0x2c30b0=_0x97d71b;_0x52c23c=0xc8;}else{_0x52c23c=0xce;}_0x3ff0bc['status'](_0x52c23c);return _0x3ff0bc[_0xb84a('0x2c')](_0xb84a('0x2d'),_0x582954+'-'+_0x2c30b0+'/'+_0x97d71b)['json'](_0xd468c3);}return null;};}function patchUpdates(_0x251778){return function(_0xba1147){try{jsonpatch[_0xb84a('0x2e')](_0xba1147,_0x251778,!![]);}catch(_0x44a405){return BPromise[_0xb84a('0x2f')](_0x44a405);}return _0xba1147[_0xb84a('0x30')]();};}function saveUpdates(_0x34b212,_0xac214f){return function(_0x54ec50){if(_0x54ec50){return _0x54ec50[_0xb84a('0x31')](_0x34b212)['then'](function(_0x4bca85){return _0x4bca85;});}return null;};}function removeEntity(_0x2eea7e,_0x3b4515){return function(_0x47a5b6){if(_0x47a5b6){return _0x47a5b6['destroy']()[_0xb84a('0x19')](function(){var _0x13c167=_0x47a5b6[_0xb84a('0x32')]({'plain':!![]});var _0x308240=_0xb84a('0x33');return db[_0xb84a('0x34')][_0xb84a('0x35')]({'where':{'type':_0x308240,'resourceId':_0x13c167['id']}})[_0xb84a('0x19')](function(){return _0x47a5b6;});})['then'](function(){_0x2eea7e[_0xb84a('0x26')](0xcc)[_0xb84a('0x27')]();});}};}function handleEntityNotFound(_0x10b944,_0xf894a6){return function(_0x36aa07){if(!_0x36aa07){_0x10b944[_0xb84a('0x25')](0x194);}return _0x36aa07;};}function handleError(_0x2a5130,_0x5aa2ae){_0x5aa2ae=_0x5aa2ae||0x1f4;return function(_0x30d22d){logger['error'](_0x30d22d[_0xb84a('0x36')]);if(_0x30d22d[_0xb84a('0x37')]){delete _0x30d22d[_0xb84a('0x37')];}_0x2a5130['status'](_0x5aa2ae)['send'](_0x30d22d);};}exports[_0xb84a('0x38')]=function(_0x75e6e6,_0x4a3737){var _0x2d3e08={},_0xab76ce={},_0x4cb5d4={'count':0x0,'rows':[]};var _0x19aa4c=_[_0xb84a('0x39')](db['Trunk'][_0xb84a('0x3a')],function(_0xe6f19e){return{'name':_0xe6f19e[_0xb84a('0x3b')],'type':_0xe6f19e[_0xb84a('0x3c')]['key']};});_0xab76ce['model']=_['map'](_0x19aa4c,_0xb84a('0x37'));_0xab76ce[_0xb84a('0x3d')]=_[_0xb84a('0x3e')](_0x75e6e6[_0xb84a('0x3d')]);_0xab76ce['filters']=_[_0xb84a('0x3f')](_0xab76ce['model'],_0xab76ce[_0xb84a('0x3d')]);_0x2d3e08['attributes']=_['intersection'](_0xab76ce['model'],qs[_0xb84a('0x40')](_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x40')]));_0x2d3e08[_0xb84a('0x41')]=_0x2d3e08['attributes'][_0xb84a('0x42')]?_0x2d3e08[_0xb84a('0x41')]:_0xab76ce[_0xb84a('0x43')];if(!_0x75e6e6[_0xb84a('0x3d')]['hasOwnProperty']('nolimit')){_0x2d3e08[_0xb84a('0x2b')]=qs[_0xb84a('0x2b')](_0x75e6e6['query'][_0xb84a('0x2b')]);_0x2d3e08[_0xb84a('0x29')]=qs[_0xb84a('0x29')](_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x29')]);}_0x2d3e08[_0xb84a('0x44')]=qs[_0xb84a('0x45')](_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x45')]);_0x2d3e08[_0xb84a('0x46')]=qs[_0xb84a('0x47')](_[_0xb84a('0x48')](_0x75e6e6[_0xb84a('0x3d')],_0xab76ce[_0xb84a('0x47')]),_0x19aa4c);if(_0x75e6e6[_0xb84a('0x3d')]['filter']){_0x2d3e08[_0xb84a('0x46')]=_[_0xb84a('0x49')](_0x2d3e08[_0xb84a('0x46')],{'$or':_[_0xb84a('0x39')](_0x19aa4c,function(_0x37f4fe){if(_0x37f4fe[_0xb84a('0x3c')]!=='VIRTUAL'){var _0xfd2927={};_0xfd2927[_0x37f4fe['name']]={'$like':'%'+_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x4a')]+'%'};return _0xfd2927;}})});}_0x2d3e08=_[_0xb84a('0x49')]({},_0x2d3e08,_0x75e6e6[_0xb84a('0x4b')]);var _0x5e7327={'where':_0x2d3e08[_0xb84a('0x46')]};return db[_0xb84a('0x4c')][_0xb84a('0x4d')](_0x5e7327)['then'](function(_0x55f39f){_0x4cb5d4[_0xb84a('0x4d')]=_0x55f39f;if(_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x4e')]){_0x2d3e08['include']=[{'all':!![]}];}return db['Trunk']['findAll'](_0x2d3e08);})[_0xb84a('0x19')](function(_0x384a0d){_0x4cb5d4[_0xb84a('0x4f')]=_0x384a0d;return _0x4cb5d4;})[_0xb84a('0x19')](respondWithFilteredResult(_0x4a3737,_0x2d3e08))[_0xb84a('0x24')](handleError(_0x4a3737,null));};exports['show']=function(_0x4b40fe,_0x5b853a){var _0x53d4d6={'raw':![],'where':{'id':_0x4b40fe[_0xb84a('0x50')]['id']}},_0x421ba0={};_0x421ba0['model']=_[_0xb84a('0x3e')](db[_0xb84a('0x4c')][_0xb84a('0x3a')]);_0x421ba0[_0xb84a('0x3d')]=_[_0xb84a('0x3e')](_0x4b40fe[_0xb84a('0x3d')]);_0x421ba0['filters']=_['intersection'](_0x421ba0[_0xb84a('0x43')],_0x421ba0['query']);_0x53d4d6[_0xb84a('0x41')]=_['intersection'](_0x421ba0['model'],qs['fields'](_0x4b40fe[_0xb84a('0x3d')][_0xb84a('0x40')]));_0x53d4d6[_0xb84a('0x41')]=_0x53d4d6[_0xb84a('0x41')][_0xb84a('0x42')]?_0x53d4d6[_0xb84a('0x41')]:_0x421ba0[_0xb84a('0x43')];if(_0x4b40fe[_0xb84a('0x3d')]['includeAll']){_0x53d4d6['include']=[{'all':!![]}];}_0x53d4d6=_['merge']({},_0x53d4d6,_0x4b40fe[_0xb84a('0x4b')]);return db[_0xb84a('0x4c')]['find'](_0x53d4d6)[_0xb84a('0x19')](handleEntityNotFound(_0x5b853a,null))['then'](respondWithResult(_0x5b853a,null))['catch'](handleError(_0x5b853a,null));};exports['clone']=function(_0x419e27,_0x172076){var _0x49a0e2={'where':{'id':_0x419e27[_0xb84a('0x50')]['id']}},_0x51c415={};_0x51c415[_0xb84a('0x43')]=_[_0xb84a('0x3e')](db['Trunk'][_0xb84a('0x3a')]);_0x49a0e2['attributes']=_['intersection'](_0x51c415[_0xb84a('0x43')],qs['fields'](_0x419e27[_0xb84a('0x3d')]['fields']));_0x49a0e2[_0xb84a('0x41')]=_0x49a0e2[_0xb84a('0x41')][_0xb84a('0x42')]?_0x49a0e2[_0xb84a('0x41')]:_0x51c415['model'];if(_0x419e27['query']['includeAll']){_0x49a0e2[_0xb84a('0x51')]=[{'all':!![]}];}_0x49a0e2=_[_0xb84a('0x49')]({},_0x49a0e2,_0x419e27['options']);return db['Trunk'][_0xb84a('0x52')](_0x49a0e2)[_0xb84a('0x19')](handleEntityNotFound(_0x172076,null))[_0xb84a('0x19')](function(_0x5f415d){if(_0x5f415d){var _0x29f67f=_0x5f415d[_0xb84a('0x32')]({'plain':!![]});_0x29f67f=qs['omit'](_0x29f67f,['id',_0xb84a('0x53'),_0xb84a('0x54')]);_0x419e27[_0xb84a('0x55')]=_[_0xb84a('0x56')](_0x419e27[_0xb84a('0x55')],['id',_0xb84a('0x53'),_0xb84a('0x54')]);return db['Trunk'][_0xb84a('0x57')](_[_0xb84a('0x49')](_0x29f67f,_0x419e27['body']),{'include':_0x419e27[_0xb84a('0x3d')][_0xb84a('0x4e')]?[{'all':!![]}]:undefined})[_0xb84a('0x19')](function(_0x3e16d8){var _0x347998=_0x419e27[_0xb84a('0x58')][_0xb84a('0x32')]({'plain':!![]});if(!_0x347998)throw new Error(_0xb84a('0x59'));if(_0x347998[_0xb84a('0x5a')]==='user'){var _0x291008=_0x3e16d8['get']({'plain':!![]});var _0x5a2d44=_0xb84a('0x33');return db['UserProfileSection'][_0xb84a('0x52')]({'where':{'name':_0x5a2d44,'userProfileId':_0x347998['userProfileId']},'raw':!![]})[_0xb84a('0x19')](function(_0x44e508){if(_0x44e508&&_0x44e508['autoAssociation']===0x0){return db[_0xb84a('0x34')][_0xb84a('0x57')]({'name':_0x291008[_0xb84a('0x37')],'resourceId':_0x291008['id'],'type':_0x44e508[_0xb84a('0x37')],'sectionId':_0x44e508['id']},{})[_0xb84a('0x19')](function(){return _0x3e16d8;});}else{return _0x3e16d8;}})[_0xb84a('0x24')](function(_0x4514f0){logger['error'](_0xb84a('0x5b'),_0x4514f0);throw _0x4514f0;});}return _0x3e16d8;});}})['then'](respondWithResult(_0x172076,0xc9))['catch'](handleError(_0x172076,null));};exports[_0xb84a('0x57')]=function(_0x2a2dc0,_0x2ee241,_0x32a455){var _0x5612f3;return db['Trunk'][_0xb84a('0x57')](_0x2a2dc0[_0xb84a('0x55')],{'raw':!![]})[_0xb84a('0x19')](function(_0x1a2e1a){_0x5612f3=_0x1a2e1a;return db['Trunk'][_0xb84a('0x5c')]({'raw':!![]});})['then'](function(_0x1eec1f){var _0x57b784=fs[_0xb84a('0x5d')](path['join'](config['root'],'server/files/templates/trunk.ejs'),_0xb84a('0x5e'));var _0xf936f1=fs[_0xb84a('0x5d')](path[_0xb84a('0x5f')](config['root'],_0xb84a('0x60')),_0xb84a('0x5e'));var _0x33d416=ejs[_0xb84a('0x61')](_0x57b784,{'trunks':_0x1eec1f||[]});fs[_0xb84a('0x62')](_0xb84a('0x63'),_0x33d416);if(_0x5612f3[_0xb84a('0x64')]){var _0x542d70=ejs[_0xb84a('0x61')](_0xf936f1,{'trunks':_0x1eec1f||[]});fs[_0xb84a('0x62')](_0xb84a('0x65'),_0x542d70);}})[_0xb84a('0x19')](function(){return respondWithRpcPromise(_0xb84a('0x66'),_0xb84a('0x57'),{'module':'chan_sip.so'});})[_0xb84a('0x19')](function(){var _0x6f8f=_0x2a2dc0[_0xb84a('0x58')][_0xb84a('0x32')]({'plain':!![]});if(!_0x6f8f)throw new Error(_0xb84a('0x59'));if(_0x6f8f['role']===_0xb84a('0x58')){var _0x4b0b18=_0x5612f3[_0xb84a('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xb84a('0x52')]({'where':{'name':_0xb84a('0x33'),'userProfileId':_0x6f8f[_0xb84a('0x67')]},'raw':!![]})['then'](function(_0x121fda){if(_0x121fda&&_0x121fda[_0xb84a('0x68')]===0x0){return db[_0xb84a('0x34')][_0xb84a('0x57')]({'name':_0x4b0b18[_0xb84a('0x37')],'resourceId':_0x4b0b18['id'],'type':_0x121fda['name'],'sectionId':_0x121fda['id']},{})[_0xb84a('0x19')](function(){return _0x5612f3;});}else{return _0x5612f3;}})[_0xb84a('0x24')](function(_0x287d25){logger['error'](_0xb84a('0x5b'),_0x287d25);throw _0x287d25;});}return _0x5612f3;})['then'](respondWithResult(_0x2ee241,0xc9))['catch'](handleError(_0x2ee241,null));};exports[_0xb84a('0x31')]=function(_0x35cb8b,_0x13c7b7,_0x3b2a2d){var _0x2047f5;return db[_0xb84a('0x4c')][_0xb84a('0x52')]({'where':{'id':_0x35cb8b[_0xb84a('0x50')]['id']}})[_0xb84a('0x19')](handleEntityNotFound(_0x13c7b7,null))[_0xb84a('0x19')](saveUpdates(_0x35cb8b[_0xb84a('0x55')],null))[_0xb84a('0x19')](function(_0x3ec1fb){if(_0x3ec1fb){_0x2047f5=_0x3ec1fb;return db[_0xb84a('0x4c')][_0xb84a('0x5c')]({'raw':!![]});}})[_0xb84a('0x19')](function(_0xb18756){if(_0xb18756){var _0x1169d1=fs['readFileSync'](path[_0xb84a('0x5f')](config[_0xb84a('0x69')],'server/files/templates/trunk.ejs'),_0xb84a('0x5e'));var _0x576df5=fs[_0xb84a('0x5d')](path['join'](config[_0xb84a('0x69')],'server/files/templates/registry.ejs'),'utf8');var _0xf3f253=ejs[_0xb84a('0x61')](_0x1169d1,{'trunks':_0xb18756||[]});fs['writeFileSync'](_0xb84a('0x63'),_0xf3f253);var _0xcf9bc2=ejs[_0xb84a('0x61')](_0x576df5,{'trunks':_0xb18756||[]});fs[_0xb84a('0x62')](_0xb84a('0x65'),_0xcf9bc2);return respondWithRpcPromise('Reload',_0xb84a('0x31'),{'module':_0xb84a('0x6a')});}return null;})[_0xb84a('0x19')](function(_0x30f7cd){if(_0x30f7cd){return _0x2047f5;}})['then'](respondWithResult(_0x13c7b7,null))[_0xb84a('0x24')](handleError(_0x13c7b7,null));};exports['destroy']=function(_0x14118c,_0x12d796,_0x54ae3e){var _0xf6765a;return db[_0xb84a('0x4c')][_0xb84a('0x52')]({'where':{'id':_0x14118c['params']['id']}})['then'](handleEntityNotFound(_0x12d796,null))[_0xb84a('0x19')](removeEntity(_0x12d796,null))[_0xb84a('0x19')](function(){return db['Trunk'][_0xb84a('0x5c')]({'raw':!![]});})['then'](function(_0x166d75){var _0x54161c=fs['readFileSync'](path[_0xb84a('0x5f')](config[_0xb84a('0x69')],_0xb84a('0x6b')),_0xb84a('0x5e'));var _0x403a3e=fs['readFileSync'](path['join'](config[_0xb84a('0x69')],_0xb84a('0x60')),'utf8');var _0x305b67=ejs[_0xb84a('0x61')](_0x54161c,{'trunks':_0x166d75});var _0x385a05=ejs[_0xb84a('0x61')](_0x403a3e,{'trunks':_0x166d75});fs['writeFileSync'](_0xb84a('0x63'),_0x305b67);fs['writeFileSync'](_0xb84a('0x65'),_0x385a05);return respondWithRpcPromise(_0xb84a('0x66'),_0xb84a('0x35'),{'module':_0xb84a('0x6a')});})[_0xb84a('0x24')](handleError(_0x12d796,null));}; \ No newline at end of file +var _0x34e8=['limit','count','set','Content-Range','json','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','key','query','keys','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','length','find','clone','rawAttributes','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','render','Reload','chan_sip.so','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','offset','undefined'];(function(_0x194d23,_0x35b80e){var _0x159102=function(_0x220342){while(--_0x220342){_0x194d23['push'](_0x194d23['shift']());}};_0x159102(++_0x35b80e);}(_0x34e8,0x12c));var _0x834e=function(_0x5e0d46,_0x11c38c){_0x5e0d46=_0x5e0d46-0x0;var _0x1b8237=_0x34e8[_0x5e0d46];return _0x1b8237;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];var jayson=require(_0x834e('0x1c'));var client=jayson[_0x834e('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23848e,_0x2d95f2,_0x28e659,_0x21cc0a){return new BPromise(function(_0x50e860,_0x43156c){var _0x302cbd=_0x21cc0a||client;return _0x302cbd['request'](_0x23848e,_0x28e659)[_0x834e('0x1e')](function(_0x4a9cdc){logger[_0x834e('0x1f')](_0x834e('0x20'),_0x2d95f2,'request\x20sent');logger[_0x834e('0x21')](_0x834e('0x22'),_0x2d95f2,_0x834e('0x23'),JSON['stringify'](_0x4a9cdc));if(_0x4a9cdc[_0x834e('0x24')]){if(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x25')]===0x1f4){logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);return _0x43156c(_0x4a9cdc['error'][_0x834e('0x26')]);}logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')]['message']);return _0x50e860(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);}else{logger['info'](_0x834e('0x20'),_0x2d95f2,_0x834e('0x23'));_0x50e860(_0x4a9cdc[_0x834e('0x27')]['message']);}})['catch'](function(_0x231619){logger[_0x834e('0x24')]('Trunk,\x20%s,\x20%s',_0x2d95f2,_0x231619);_0x43156c(_0x231619);});});}function respondWithStatusCode(_0x25ee1d,_0x1dc1e0){_0x1dc1e0=_0x1dc1e0||0xcc;return function(_0x58f4fd){if(_0x58f4fd){return _0x25ee1d[_0x834e('0x28')](_0x1dc1e0);}return _0x25ee1d[_0x834e('0x29')](_0x1dc1e0)[_0x834e('0x2a')]();};}function respondWithResult(_0x561cd2,_0x24fcf7){_0x24fcf7=_0x24fcf7||0xc8;return function(_0x3e310f){if(_0x3e310f){return _0x561cd2['status'](_0x24fcf7)['json'](_0x3e310f);}};}function respondWithFilteredResult(_0x1e713a,_0x508a1d){return function(_0x2826ec){if(_0x2826ec){var _0x3f1b0b=typeof _0x508a1d[_0x834e('0x2b')]===_0x834e('0x2c')&&typeof _0x508a1d[_0x834e('0x2d')]===_0x834e('0x2c');var _0x491919=_0x2826ec['count'];var _0x4dc64a=_0x3f1b0b?0x0:_0x508a1d['offset'];var _0x2c7a8d=_0x3f1b0b?_0x2826ec[_0x834e('0x2e')]:_0x508a1d[_0x834e('0x2b')]+_0x508a1d['limit'];var _0xb5bc06;if(_0x2c7a8d>=_0x491919){_0x2c7a8d=_0x491919;_0xb5bc06=0xc8;}else{_0xb5bc06=0xce;}_0x1e713a[_0x834e('0x29')](_0xb5bc06);return _0x1e713a[_0x834e('0x2f')](_0x834e('0x30'),_0x4dc64a+'-'+_0x2c7a8d+'/'+_0x491919)[_0x834e('0x31')](_0x2826ec);}return null;};}function patchUpdates(_0x390119){return function(_0x3d149d){try{jsonpatch[_0x834e('0x32')](_0x3d149d,_0x390119,!![]);}catch(_0x278db3){return BPromise['reject'](_0x278db3);}return _0x3d149d[_0x834e('0x33')]();};}function saveUpdates(_0x5cad11,_0x2c75c2){return function(_0x3787b0){if(_0x3787b0){return _0x3787b0[_0x834e('0x34')](_0x5cad11)[_0x834e('0x1e')](function(_0x444366){return _0x444366;});}return null;};}function removeEntity(_0x4689c2,_0x4696a1){return function(_0x38cd29){if(_0x38cd29){return _0x38cd29[_0x834e('0x35')]()[_0x834e('0x1e')](function(){var _0x5bd232=_0x38cd29[_0x834e('0x36')]({'plain':!![]});var _0x2f408a=_0x834e('0x37');return db[_0x834e('0x38')]['destroy']({'where':{'type':_0x2f408a,'resourceId':_0x5bd232['id']}})[_0x834e('0x1e')](function(){return _0x38cd29;});})[_0x834e('0x1e')](function(){_0x4689c2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59385a,_0x3e58fa){return function(_0x41bf4d){if(!_0x41bf4d){_0x59385a[_0x834e('0x28')](0x194);}return _0x41bf4d;};}function handleError(_0x34fefb,_0x339e28){_0x339e28=_0x339e28||0x1f4;return function(_0x1b76dd){logger['error'](_0x1b76dd[_0x834e('0x39')]);if(_0x1b76dd['name']){delete _0x1b76dd[_0x834e('0x3a')];}_0x34fefb[_0x834e('0x29')](_0x339e28)['send'](_0x1b76dd);};}exports[_0x834e('0x3b')]=function(_0x2f56c7,_0x491c28){var _0x481f70={},_0x388711={},_0xd0d43a={'count':0x0,'rows':[]};var _0x2e9383=_[_0x834e('0x3c')](db[_0x834e('0x3d')]['rawAttributes'],function(_0x1c5ed6){return{'name':_0x1c5ed6['fieldName'],'type':_0x1c5ed6['type'][_0x834e('0x3e')]};});_0x388711['model']=_[_0x834e('0x3c')](_0x2e9383,_0x834e('0x3a'));_0x388711[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x2f56c7[_0x834e('0x3f')]);_0x388711['filters']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],_0x388711[_0x834e('0x3f')]);_0x481f70['attributes']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],qs['fields'](_0x2f56c7[_0x834e('0x3f')]['fields']));_0x481f70[_0x834e('0x43')]=_0x481f70[_0x834e('0x43')]['length']?_0x481f70['attributes']:_0x388711[_0x834e('0x42')];if(!_0x2f56c7[_0x834e('0x3f')][_0x834e('0x44')](_0x834e('0x45'))){_0x481f70[_0x834e('0x2d')]=qs[_0x834e('0x2d')](_0x2f56c7[_0x834e('0x3f')]['limit']);_0x481f70[_0x834e('0x2b')]=qs['offset'](_0x2f56c7[_0x834e('0x3f')]['offset']);}_0x481f70[_0x834e('0x46')]=qs['sort'](_0x2f56c7[_0x834e('0x3f')][_0x834e('0x47')]);_0x481f70['where']=qs[_0x834e('0x48')](_[_0x834e('0x49')](_0x2f56c7[_0x834e('0x3f')],_0x388711[_0x834e('0x48')]),_0x2e9383);if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]){_0x481f70[_0x834e('0x4b')]=_[_0x834e('0x4c')](_0x481f70[_0x834e('0x4b')],{'$or':_[_0x834e('0x3c')](_0x2e9383,function(_0x5f3943){if(_0x5f3943[_0x834e('0x4d')]!==_0x834e('0x4e')){var _0x47a8a9={};_0x47a8a9[_0x5f3943[_0x834e('0x3a')]]={'$like':'%'+_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]+'%'};return _0x47a8a9;}})});}_0x481f70=_[_0x834e('0x4c')]({},_0x481f70,_0x2f56c7[_0x834e('0x4f')]);var _0x4264b8={'where':_0x481f70['where']};return db['Trunk'][_0x834e('0x2e')](_0x4264b8)[_0x834e('0x1e')](function(_0x30568e){_0xd0d43a[_0x834e('0x2e')]=_0x30568e;if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x50')]){_0x481f70[_0x834e('0x51')]=[{'all':!![]}];}return db[_0x834e('0x3d')][_0x834e('0x52')](_0x481f70);})[_0x834e('0x1e')](function(_0xf02f0d){_0xd0d43a[_0x834e('0x53')]=_0xf02f0d;return _0xd0d43a;})[_0x834e('0x1e')](respondWithFilteredResult(_0x491c28,_0x481f70))[_0x834e('0x54')](handleError(_0x491c28,null));};exports[_0x834e('0x55')]=function(_0x1a3855,_0x3df078){var _0x32b8f7={'raw':![],'where':{'id':_0x1a3855[_0x834e('0x56')]['id']}},_0x420841={};_0x420841['model']=_[_0x834e('0x40')](db[_0x834e('0x3d')]['rawAttributes']);_0x420841[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x1a3855['query']);_0x420841[_0x834e('0x48')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],_0x420841[_0x834e('0x3f')]);_0x32b8f7[_0x834e('0x43')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],qs['fields'](_0x1a3855[_0x834e('0x3f')][_0x834e('0x57')]));_0x32b8f7[_0x834e('0x43')]=_0x32b8f7[_0x834e('0x43')][_0x834e('0x58')]?_0x32b8f7[_0x834e('0x43')]:_0x420841[_0x834e('0x42')];if(_0x1a3855[_0x834e('0x3f')]['includeAll']){_0x32b8f7[_0x834e('0x51')]=[{'all':!![]}];}_0x32b8f7=_['merge']({},_0x32b8f7,_0x1a3855[_0x834e('0x4f')]);return db['Trunk'][_0x834e('0x59')](_0x32b8f7)['then'](handleEntityNotFound(_0x3df078,null))['then'](respondWithResult(_0x3df078,null))[_0x834e('0x54')](handleError(_0x3df078,null));};exports[_0x834e('0x5a')]=function(_0x5291ae,_0x5be43d){var _0x2c8155={'where':{'id':_0x5291ae[_0x834e('0x56')]['id']}},_0x2452b4={};_0x2452b4[_0x834e('0x42')]=_[_0x834e('0x40')](db[_0x834e('0x3d')][_0x834e('0x5b')]);_0x2c8155[_0x834e('0x43')]=_['intersection'](_0x2452b4[_0x834e('0x42')],qs[_0x834e('0x57')](_0x5291ae['query'][_0x834e('0x57')]));_0x2c8155['attributes']=_0x2c8155[_0x834e('0x43')][_0x834e('0x58')]?_0x2c8155['attributes']:_0x2452b4[_0x834e('0x42')];if(_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]){_0x2c8155[_0x834e('0x51')]=[{'all':!![]}];}_0x2c8155=_['merge']({},_0x2c8155,_0x5291ae[_0x834e('0x4f')]);return db[_0x834e('0x3d')][_0x834e('0x59')](_0x2c8155)['then'](handleEntityNotFound(_0x5be43d,null))[_0x834e('0x1e')](function(_0x1fcae9){if(_0x1fcae9){var _0x3a7683=_0x1fcae9[_0x834e('0x36')]({'plain':!![]});_0x3a7683=qs[_0x834e('0x5c')](_0x3a7683,['id',_0x834e('0x5d'),_0x834e('0x5e')]);_0x5291ae[_0x834e('0x5f')]=_[_0x834e('0x5c')](_0x5291ae[_0x834e('0x5f')],['id',_0x834e('0x5d'),_0x834e('0x5e')]);return db[_0x834e('0x3d')][_0x834e('0x60')](_[_0x834e('0x4c')](_0x3a7683,_0x5291ae[_0x834e('0x5f')]),{'include':_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]?[{'all':!![]}]:undefined})[_0x834e('0x1e')](function(_0x3e3467){var _0xed4081=_0x5291ae[_0x834e('0x61')]['get']({'plain':!![]});if(!_0xed4081)throw new Error(_0x834e('0x62'));if(_0xed4081[_0x834e('0x63')]===_0x834e('0x61')){var _0x36cc14=_0x3e3467['get']({'plain':!![]});var _0x30faa8='Trunks';return db['UserProfileSection'][_0x834e('0x59')]({'where':{'name':_0x30faa8,'userProfileId':_0xed4081[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0xe79465){if(_0xe79465&&_0xe79465[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x36cc14[_0x834e('0x3a')],'resourceId':_0x36cc14['id'],'type':_0xe79465['name'],'sectionId':_0xe79465['id']},{})[_0x834e('0x1e')](function(){return _0x3e3467;});}else{return _0x3e3467;}})['catch'](function(_0x17e223){logger[_0x834e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17e223);throw _0x17e223;});}return _0x3e3467;});}})['then'](respondWithResult(_0x5be43d,0xc9))[_0x834e('0x54')](handleError(_0x5be43d,null));};exports[_0x834e('0x60')]=function(_0x363cc2,_0x2cca07,_0x2c41bd){var _0x5a4854;return db[_0x834e('0x3d')][_0x834e('0x60')](_0x363cc2[_0x834e('0x5f')],{'raw':!![]})[_0x834e('0x1e')](function(_0x3181af){_0x5a4854=_0x3181af;return db[_0x834e('0x3d')][_0x834e('0x52')]({'raw':!![]});})[_0x834e('0x1e')](function(_0x376f72){var _0x324f67=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x51cfab=fs[_0x834e('0x6a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x332d8f=ejs['render'](_0x324f67,{'trunks':_0x376f72||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x332d8f);if(_0x5a4854['registry']){var _0x353246=ejs[_0x834e('0x6d')](_0x51cfab,{'trunks':_0x376f72||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x353246);}})[_0x834e('0x1e')](function(){return respondWithRpcPromise(_0x834e('0x6e'),_0x834e('0x60'),{'module':_0x834e('0x6f')});})[_0x834e('0x1e')](function(){var _0x493239=_0x363cc2[_0x834e('0x61')]['get']({'plain':!![]});if(!_0x493239)throw new Error(_0x834e('0x62'));if(_0x493239[_0x834e('0x63')]===_0x834e('0x61')){var _0x5afb41=_0x5a4854[_0x834e('0x36')]({'plain':!![]});return db[_0x834e('0x70')]['find']({'where':{'name':_0x834e('0x37'),'userProfileId':_0x493239[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0x50d0a3){if(_0x50d0a3&&_0x50d0a3[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x5afb41[_0x834e('0x3a')],'resourceId':_0x5afb41['id'],'type':_0x50d0a3[_0x834e('0x3a')],'sectionId':_0x50d0a3['id']},{})[_0x834e('0x1e')](function(){return _0x5a4854;});}else{return _0x5a4854;}})[_0x834e('0x54')](function(_0x23b5d9){logger[_0x834e('0x24')](_0x834e('0x71'),_0x23b5d9);throw _0x23b5d9;});}return _0x5a4854;})['then'](respondWithResult(_0x2cca07,0xc9))['catch'](handleError(_0x2cca07,null));};exports['update']=function(_0x36ede9,_0x1135a5,_0x313c03){var _0x37fa2c;return db[_0x834e('0x3d')]['find']({'where':{'id':_0x36ede9['params']['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x1135a5,null))[_0x834e('0x1e')](saveUpdates(_0x36ede9[_0x834e('0x5f')],null))[_0x834e('0x1e')](function(_0x40a705){if(_0x40a705){_0x37fa2c=_0x40a705;return db['Trunk'][_0x834e('0x52')]({'raw':!![]});}})[_0x834e('0x1e')](function(_0x113714){if(_0x113714){var _0x4e1735=fs[_0x834e('0x6a')](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x585d02=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x509427=ejs[_0x834e('0x6d')](_0x4e1735,{'trunks':_0x113714||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x509427);var _0x53012d=ejs[_0x834e('0x6d')](_0x585d02,{'trunks':_0x113714||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x53012d);return respondWithRpcPromise('Reload',_0x834e('0x34'),{'module':_0x834e('0x6f')});}return null;})[_0x834e('0x1e')](function(_0x1d76c6){if(_0x1d76c6){return _0x37fa2c;}})[_0x834e('0x1e')](respondWithResult(_0x1135a5,null))[_0x834e('0x54')](handleError(_0x1135a5,null));};exports[_0x834e('0x35')]=function(_0x179892,_0x17e61a,_0x53f6e3){var _0x2f775a;return db['Trunk'][_0x834e('0x59')]({'where':{'id':_0x179892[_0x834e('0x56')]['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x17e61a,null))[_0x834e('0x1e')](removeEntity(_0x17e61a,null))[_0x834e('0x1e')](function(){return db[_0x834e('0x3d')]['findAll']({'raw':!![]});})['then'](function(_0xeb096d){var _0x2a854a=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0xc75f5e=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5ede29=ejs[_0x834e('0x6d')](_0x2a854a,{'trunks':_0xeb096d});var _0x1f3e26=ejs['render'](_0xc75f5e,{'trunks':_0xeb096d});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x5ede29);fs['writeFileSync'](_0x834e('0x72'),_0x1f3e26);return respondWithRpcPromise('Reload','destroy',{'module':_0x834e('0x6f')});})[_0x834e('0x54')](handleError(_0x17e61a,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index f38cb7e..1dd82a6 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 _0x5b83=['../../config/environment','exports','define','Trunk','tools_trunks','util','api','moment','request-promise','path','rimraf'];(function(_0xe70da9,_0x32ef62){var _0x15897c=function(_0x3298ab){while(--_0x3298ab){_0xe70da9['push'](_0xe70da9['shift']());}};_0x15897c(++_0x32ef62);}(_0x5b83,0x139));var _0x35b8=function(_0x108785,_0x3e7745){_0x108785=_0x108785-0x0;var _0x584934=_0x5b83[_0x108785];return _0x584934;};'use strict';var _=require('lodash');var util=require(_0x35b8('0x0'));var logger=require('../../config/logger')(_0x35b8('0x1'));var moment=require(_0x35b8('0x2'));var BPromise=require('bluebird');var rp=require(_0x35b8('0x3'));var fs=require('fs');var path=require(_0x35b8('0x4'));var rimraf=require(_0x35b8('0x5'));var config=require(_0x35b8('0x6'));var attributes=require('./trunk.attributes');module[_0x35b8('0x7')]=function(_0x59b83f,_0x1346f6){return _0x59b83f[_0x35b8('0x8')](_0x35b8('0x9'),attributes,{'tableName':_0x35b8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3361=['lodash','api','moment','request-promise','path','../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks'];(function(_0x35cee3,_0xbf1036){var _0x15e9c4=function(_0x4cb750){while(--_0x4cb750){_0x35cee3['push'](_0x35cee3['shift']());}};_0x15e9c4(++_0xbf1036);}(_0x3361,0xb4));var _0x1336=function(_0x4bc79a,_0x967c61){_0x4bc79a=_0x4bc79a-0x0;var _0x2d7316=_0x3361[_0x4bc79a];return _0x2d7316;};'use strict';var _=require(_0x1336('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1336('0x1'));var moment=require(_0x1336('0x2'));var BPromise=require('bluebird');var rp=require(_0x1336('0x3'));var fs=require('fs');var path=require(_0x1336('0x4'));var rimraf=require('rimraf');var config=require(_0x1336('0x5'));var attributes=require(_0x1336('0x6'));module[_0x1336('0x7')]=function(_0x53ac4f,_0x1648e2){return _0x53ac4f['define'](_0x1336('0x8'),attributes,{'tableName':_0x1336('0x9'),'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 b472498..34969dd 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 _0x4626=['findAll','options','where','attributes','limit','map','include','model','ShowTrunk','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','info','request\x20sent','debug','stringify','error','code','message','Trunk,\x20%s,\x20%s','result','catch','GetTrunk','Trunk'];(function(_0x7375fa,_0x4a9ce3){var _0x3d2134=function(_0xdab94f){while(--_0xdab94f){_0x7375fa['push'](_0x7375fa['shift']());}};_0x3d2134(++_0x4a9ce3);}(_0x4626,0x196));var _0x6462=function(_0x4a4a08,_0x53088f){_0x4a4a08=_0x4a4a08-0x0;var _0x119551=_0x4626[_0x4a4a08];return _0x119551;};'use strict';var _=require(_0x6462('0x0'));var util=require(_0x6462('0x1'));var moment=require(_0x6462('0x2'));var BPromise=require(_0x6462('0x3'));var rs=require(_0x6462('0x4'));var fs=require('fs');var Redis=require(_0x6462('0x5'));var db=require(_0x6462('0x6'))['db'];var utils=require(_0x6462('0x7'));var logger=require(_0x6462('0x8'))(_0x6462('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4f665c,_0x357dd3,_0x586aec){return new BPromise(function(_0x1298ed,_0x499405){return client[_0x6462('0xa')](_0x4f665c,_0x586aec)['then'](function(_0x4aca0b){logger[_0x6462('0xb')]('Trunk,\x20%s,\x20%s',_0x357dd3,_0x6462('0xc'));logger[_0x6462('0xd')]('Trunk,\x20%s,\x20%s,\x20%s',_0x357dd3,'request\x20sent',JSON[_0x6462('0xe')](_0x4aca0b));if(_0x4aca0b[_0x6462('0xf')]){if(_0x4aca0b[_0x6462('0xf')][_0x6462('0x10')]===0x1f4){logger[_0x6462('0xf')]('Trunk,\x20%s,\x20%s',_0x357dd3,_0x4aca0b[_0x6462('0xf')][_0x6462('0x11')]);return _0x499405(_0x4aca0b[_0x6462('0xf')][_0x6462('0x11')]);}logger[_0x6462('0xf')](_0x6462('0x12'),_0x357dd3,_0x4aca0b['error'][_0x6462('0x11')]);return _0x1298ed(_0x4aca0b[_0x6462('0xf')][_0x6462('0x11')]);}else{logger[_0x6462('0xb')](_0x6462('0x12'),_0x357dd3,_0x6462('0xc'));_0x1298ed(_0x4aca0b[_0x6462('0x13')]['message']);}})[_0x6462('0x14')](function(_0x2e71a3){logger[_0x6462('0xf')]('Trunk,\x20%s,\x20%s',_0x357dd3,_0x2e71a3);_0x499405(_0x2e71a3);});});}exports[_0x6462('0x15')]=function(_0x52fc06){var _0x29fcb2=this;return new Promise(function(_0x4a40b6,_0x38ede7){return db[_0x6462('0x16')][_0x6462('0x17')]({'raw':_0x52fc06[_0x6462('0x18')]?_0x52fc06[_0x6462('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x52fc06[_0x6462('0x18')]?_0x52fc06[_0x6462('0x18')][_0x6462('0x19')]||null:null,'attributes':_0x52fc06[_0x6462('0x18')]?_0x52fc06[_0x6462('0x18')][_0x6462('0x1a')]||null:null,'limit':_0x52fc06[_0x6462('0x18')]?_0x52fc06['options'][_0x6462('0x1b')]||null:null,'include':_0x52fc06[_0x6462('0x18')]?_0x52fc06['options']['include']?_[_0x6462('0x1c')](_0x52fc06[_0x6462('0x18')][_0x6462('0x1d')],function(_0x4edb58){return{'model':db[_0x4edb58[_0x6462('0x1e')]],'as':_0x4edb58['as'],'attributes':_0x4edb58[_0x6462('0x1a')],'include':_0x4edb58[_0x6462('0x1d')]?_[_0x6462('0x1c')](_0x4edb58[_0x6462('0x1d')],function(_0x5802cf){return{'model':db[_0x5802cf[_0x6462('0x1e')]],'as':_0x5802cf['as'],'attributes':_0x5802cf[_0x6462('0x1a')],'include':_0x5802cf[_0x6462('0x1d')]?_[_0x6462('0x1c')](_0x5802cf[_0x6462('0x1d')],function(_0x6167ca){return{'model':db[_0x6167ca['model']],'as':_0x6167ca['as'],'attributes':_0x6167ca['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x17bd76){logger['info'](_0x6462('0x15'),_0x52fc06);logger[_0x6462('0xd')](_0x6462('0x15'),_0x52fc06,JSON[_0x6462('0xe')](_0x17bd76));_0x4a40b6(_0x17bd76);})[_0x6462('0x14')](function(_0x19ab2a){logger[_0x6462('0xf')](_0x6462('0x15'),_0x19ab2a[_0x6462('0x11')],_0x52fc06);_0x38ede7(_0x29fcb2['error'](0x1f4,_0x19ab2a[_0x6462('0x11')]));});});};exports[_0x6462('0x1f')]=function(_0x55487b){var _0x288b1d=this;return new Promise(function(_0x80baeb,_0x2952dd){return db[_0x6462('0x16')]['find']({'raw':_0x55487b['options']?_0x55487b[_0x6462('0x18')][_0x6462('0x20')]===undefined?!![]:![]:!![],'where':_0x55487b[_0x6462('0x18')]?_0x55487b[_0x6462('0x18')]['where']||null:null,'attributes':_0x55487b['options']?_0x55487b[_0x6462('0x18')][_0x6462('0x1a')]||null:null,'include':_0x55487b[_0x6462('0x18')]?_0x55487b[_0x6462('0x18')][_0x6462('0x1d')]?_[_0x6462('0x1c')](_0x55487b[_0x6462('0x18')][_0x6462('0x1d')],function(_0x5b2712){return{'model':db[_0x5b2712[_0x6462('0x1e')]],'as':_0x5b2712['as'],'attributes':_0x5b2712[_0x6462('0x1a')],'include':_0x5b2712[_0x6462('0x1d')]?_[_0x6462('0x1c')](_0x5b2712[_0x6462('0x1d')],function(_0x37afef){return{'model':db[_0x37afef[_0x6462('0x1e')]],'as':_0x37afef['as'],'attributes':_0x37afef['attributes'],'include':_0x37afef['include']?_['map'](_0x37afef[_0x6462('0x1d')],function(_0x106d41){return{'model':db[_0x106d41[_0x6462('0x1e')]],'as':_0x106d41['as'],'attributes':_0x106d41['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f6215){logger[_0x6462('0xb')](_0x6462('0x1f'),_0x55487b);logger[_0x6462('0xd')](_0x6462('0x1f'),_0x55487b,JSON['stringify'](_0x3f6215));_0x80baeb(_0x3f6215);})[_0x6462('0x14')](function(_0x3f31ae){logger[_0x6462('0xf')](_0x6462('0x1f'),_0x3f31ae['message'],_0x55487b);_0x2952dd(_0x288b1d[_0x6462('0xf')](0x1f4,_0x3f31ae[_0x6462('0x11')]));});});}; \ No newline at end of file +var _0x86ad=['Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','message','info','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','include','map','model','debug','stringify','find','ShowTrunk','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then'];(function(_0x102977,_0x3a99a6){var _0x15c466=function(_0x1a6a12){while(--_0x1a6a12){_0x102977['push'](_0x102977['shift']());}};_0x15c466(++_0x3a99a6);}(_0x86ad,0x155));var _0xd86a=function(_0x57c41a,_0x4827ea){_0x57c41a=_0x57c41a-0x0;var _0x190f48=_0x86ad[_0x57c41a];return _0x190f48;};'use strict';var _=require('lodash');var util=require(_0xd86a('0x0'));var moment=require(_0xd86a('0x1'));var BPromise=require(_0xd86a('0x2'));var rs=require(_0xd86a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd86a('0x4'))['db'];var utils=require(_0xd86a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xd86a('0x6'));var jayson=require(_0xd86a('0x7'));var client=jayson[_0xd86a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3de199,_0x377a89,_0x6325ea){return new BPromise(function(_0x554681,_0x380d05){return client[_0xd86a('0x9')](_0x3de199,_0x6325ea)[_0xd86a('0xa')](function(_0x5a863e){logger['info'](_0xd86a('0xb'),_0x377a89,_0xd86a('0xc'));logger['debug'](_0xd86a('0xd'),_0x377a89,_0xd86a('0xc'),JSON['stringify'](_0x5a863e));if(_0x5a863e[_0xd86a('0xe')]){if(_0x5a863e[_0xd86a('0xe')]['code']===0x1f4){logger['error'](_0xd86a('0xb'),_0x377a89,_0x5a863e[_0xd86a('0xe')][_0xd86a('0xf')]);return _0x380d05(_0x5a863e[_0xd86a('0xe')]['message']);}logger[_0xd86a('0xe')](_0xd86a('0xb'),_0x377a89,_0x5a863e[_0xd86a('0xe')][_0xd86a('0xf')]);return _0x554681(_0x5a863e[_0xd86a('0xe')][_0xd86a('0xf')]);}else{logger[_0xd86a('0x10')](_0xd86a('0xb'),_0x377a89,_0xd86a('0xc'));_0x554681(_0x5a863e['result'][_0xd86a('0xf')]);}})[_0xd86a('0x11')](function(_0x834940){logger[_0xd86a('0xe')](_0xd86a('0xb'),_0x377a89,_0x834940);_0x380d05(_0x834940);});});}exports[_0xd86a('0x12')]=function(_0x2d914c){var _0x47bfd1=this;return new Promise(function(_0x28c9cb,_0x48c990){return db[_0xd86a('0x13')][_0xd86a('0x14')]({'raw':_0x2d914c[_0xd86a('0x15')]?_0x2d914c[_0xd86a('0x15')][_0xd86a('0x16')]===undefined?!![]:![]:!![],'where':_0x2d914c[_0xd86a('0x15')]?_0x2d914c[_0xd86a('0x15')][_0xd86a('0x17')]||null:null,'attributes':_0x2d914c[_0xd86a('0x15')]?_0x2d914c[_0xd86a('0x15')][_0xd86a('0x18')]||null:null,'limit':_0x2d914c[_0xd86a('0x15')]?_0x2d914c[_0xd86a('0x15')]['limit']||null:null,'include':_0x2d914c['options']?_0x2d914c[_0xd86a('0x15')][_0xd86a('0x19')]?_['map'](_0x2d914c[_0xd86a('0x15')][_0xd86a('0x19')],function(_0x3a8312){return{'model':db[_0x3a8312['model']],'as':_0x3a8312['as'],'attributes':_0x3a8312[_0xd86a('0x18')],'include':_0x3a8312[_0xd86a('0x19')]?_[_0xd86a('0x1a')](_0x3a8312['include'],function(_0x4bfbf7){return{'model':db[_0x4bfbf7['model']],'as':_0x4bfbf7['as'],'attributes':_0x4bfbf7[_0xd86a('0x18')],'include':_0x4bfbf7['include']?_[_0xd86a('0x1a')](_0x4bfbf7[_0xd86a('0x19')],function(_0x119e99){return{'model':db[_0x119e99[_0xd86a('0x1b')]],'as':_0x119e99['as'],'attributes':_0x119e99[_0xd86a('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd86a('0xa')](function(_0x2ad2f8){logger[_0xd86a('0x10')](_0xd86a('0x12'),_0x2d914c);logger[_0xd86a('0x1c')]('GetTrunk',_0x2d914c,JSON[_0xd86a('0x1d')](_0x2ad2f8));_0x28c9cb(_0x2ad2f8);})['catch'](function(_0x35ca16){logger[_0xd86a('0xe')](_0xd86a('0x12'),_0x35ca16['message'],_0x2d914c);_0x48c990(_0x47bfd1[_0xd86a('0xe')](0x1f4,_0x35ca16[_0xd86a('0xf')]));});});};exports['ShowTrunk']=function(_0x373a9d){var _0x41dc69=this;return new Promise(function(_0x1c83fa,_0xabf178){return db[_0xd86a('0x13')][_0xd86a('0x1e')]({'raw':_0x373a9d[_0xd86a('0x15')]?_0x373a9d[_0xd86a('0x15')][_0xd86a('0x16')]===undefined?!![]:![]:!![],'where':_0x373a9d[_0xd86a('0x15')]?_0x373a9d['options'][_0xd86a('0x17')]||null:null,'attributes':_0x373a9d[_0xd86a('0x15')]?_0x373a9d[_0xd86a('0x15')][_0xd86a('0x18')]||null:null,'include':_0x373a9d[_0xd86a('0x15')]?_0x373a9d[_0xd86a('0x15')][_0xd86a('0x19')]?_['map'](_0x373a9d[_0xd86a('0x15')][_0xd86a('0x19')],function(_0x4bdd4b){return{'model':db[_0x4bdd4b[_0xd86a('0x1b')]],'as':_0x4bdd4b['as'],'attributes':_0x4bdd4b[_0xd86a('0x18')],'include':_0x4bdd4b['include']?_[_0xd86a('0x1a')](_0x4bdd4b['include'],function(_0x11e8f8){return{'model':db[_0x11e8f8[_0xd86a('0x1b')]],'as':_0x11e8f8['as'],'attributes':_0x11e8f8['attributes'],'include':_0x11e8f8[_0xd86a('0x19')]?_[_0xd86a('0x1a')](_0x11e8f8[_0xd86a('0x19')],function(_0x3cd5da){return{'model':db[_0x3cd5da[_0xd86a('0x1b')]],'as':_0x3cd5da['as'],'attributes':_0x3cd5da[_0xd86a('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd86a('0xa')](function(_0x54d5bb){logger[_0xd86a('0x10')]('ShowTrunk',_0x373a9d);logger['debug'](_0xd86a('0x1f'),_0x373a9d,JSON[_0xd86a('0x1d')](_0x54d5bb));_0x1c83fa(_0x54d5bb);})['catch'](function(_0x1a8101){logger['error']('ShowTrunk',_0x1a8101['message'],_0x373a9d);_0xabf178(_0x41dc69[_0xd86a('0xe')](0x1f4,_0x1a8101[_0xd86a('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 81a2a62..91fc5c8 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 _0x3c5f=['isAuthenticated','update','exports','express','Router','../../components/auth/service','./user-setting.controller','/:id'];(function(_0x20c259,_0x6b43f8){var _0x142205=function(_0x102659){while(--_0x102659){_0x20c259['push'](_0x20c259['shift']());}};_0x142205(++_0x6b43f8);}(_0x3c5f,0x83));var _0xf3c5=function(_0x5e869d,_0x1f542f){_0x5e869d=_0x5e869d-0x0;var _0x3a18b2=_0x3c5f[_0x5e869d];return _0x3a18b2;};'use strict';var express=require(_0xf3c5('0x0'));var router=express[_0xf3c5('0x1')]();var auth=require(_0xf3c5('0x2'));var controller=require(_0xf3c5('0x3'));router['put'](_0xf3c5('0x4'),auth[_0xf3c5('0x5')](),controller[_0xf3c5('0x6')]);module[_0xf3c5('0x7')]=router; \ No newline at end of file +var _0x71a7=['express','../../components/auth/service','put','/:id','update'];(function(_0x1047cd,_0x12b3f0){var _0x21fc0c=function(_0x365e35){while(--_0x365e35){_0x1047cd['push'](_0x1047cd['shift']());}};_0x21fc0c(++_0x12b3f0);}(_0x71a7,0x15e));var _0x771a=function(_0xf909bb,_0x3a811f){_0xf909bb=_0xf909bb-0x0;var _0x2f95a0=_0x71a7[_0xf909bb];return _0x2f95a0;};'use strict';var express=require(_0x771a('0x0'));var router=express['Router']();var auth=require(_0x771a('0x1'));var controller=require('./user-setting.controller');router[_0x771a('0x2')](_0x771a('0x3'),auth['isAuthenticated'](),controller[_0x771a('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index a9c2313..e26d92a 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 _0xb95e=['TEXT','DATE','error','warning','info','debug','exports','ENUM','BOOLEAN'];(function(_0x52c618,_0x570691){var _0x33822d=function(_0x2df107){while(--_0x2df107){_0x52c618['push'](_0x52c618['shift']());}};_0x33822d(++_0x570691);}(_0xb95e,0xa4));var _0xeb95=function(_0xfc3ec3,_0x595f75){_0xfc3ec3=_0xfc3ec3-0x0;var _0xf53627=_0xb95e[_0xfc3ec3];return _0xf53627;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0xeb95('0x0'),_0xeb95('0x1'),_0xeb95('0x2'),_0xeb95('0x3')];module[_0xeb95('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xeb95('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xeb95('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xeb95('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xeb95('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':'UserId'}}; \ No newline at end of file +var _0x2171=['ENUM','error','TEXT','UserId','sequelize','info','debug','exports'];(function(_0x44dfe1,_0x270f23){var _0x6955a9=function(_0x45b97c){while(--_0x45b97c){_0x44dfe1['push'](_0x44dfe1['shift']());}};_0x6955a9(++_0x270f23);}(_0x2171,0x15c));var _0x1217=function(_0x5a0b8f,_0x39d0e7){_0x5a0b8f=_0x5a0b8f-0x0;var _0x439115=_0x2171[_0x5a0b8f];return _0x439115;};'use strict';var Sequelize=require(_0x1217('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error','warning',_0x1217('0x1'),_0x1217('0x2')];module[_0x1217('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x1217('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x1217('0x5'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x1217('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x1217('0x7')}}; \ 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 0ad3b1e..ef277f2 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 _0x3667=['body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','socket.io-emitter','redis','register','defaults','localhost','status','json','update','then','sendStatus','error','stack','name','send','user','role','admin','Unauthorized','Invalid\x20user\x20setting\x20id','UserSetting','find','params'];(function(_0xa783e9,_0x326a8b){var _0x20aad2=function(_0x3bb7f9){while(--_0x3bb7f9){_0xa783e9['push'](_0xa783e9['shift']());}};_0x20aad2(++_0x326a8b);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7366('0x0'));var Redis=require(_0x7366('0x1'));var logger=require(_0x7366('0x2'))(_0x7366('0x3'));var config=require(_0x7366('0x4'));var db=require('../../mysqldb')['db'];var socket=require(_0x7366('0x5'))(new Redis(config[_0x7366('0x6')]));require('./user-setting.socket')[_0x7366('0x7')](socket);config[_0x7366('0x6')]=_[_0x7366('0x8')](config[_0x7366('0x6')],{'host':_0x7366('0x9'),'port':0x18eb});function respondWithResult(_0x589397,_0x28f6c8){_0x28f6c8=_0x28f6c8||0xc8;return function(_0xa1a3c5){if(_0xa1a3c5){return _0x589397[_0x7366('0xa')](_0x28f6c8)[_0x7366('0xb')](_0xa1a3c5);}};}function saveUpdates(_0x171fe2){return function(_0x108455){if(_0x108455){return _0x108455[_0x7366('0xc')](_0x171fe2)[_0x7366('0xd')](function(_0x18aee5){return _0x18aee5;});}return null;};}function handleEntityNotFound(_0x3cb737){return function(_0x7c3c01){if(!_0x7c3c01){_0x3cb737[_0x7366('0xe')](0x194);}return _0x7c3c01;};}function handleError(_0x57ea7f,_0x425ee4){_0x425ee4=_0x425ee4||0x1f4;return function(_0x2694fc){logger[_0x7366('0xf')](_0x2694fc[_0x7366('0x10')]);if(_0x2694fc[_0x7366('0x11')]){delete _0x2694fc[_0x7366('0x11')];}_0x57ea7f[_0x7366('0xa')](_0x425ee4)[_0x7366('0x12')](_0x2694fc);};}exports[_0x7366('0xc')]=function(_0x1813b7,_0x44d163){if(_0x1813b7[_0x7366('0x13')][_0x7366('0x14')]!==_0x7366('0x15'))throw new Error(_0x7366('0x16'));if(isNaN(Number(_0x1813b7['params']['id'])))throw new Error(_0x7366('0x17'));return db[_0x7366('0x18')][_0x7366('0x19')]({'where':{'id':_0x1813b7[_0x7366('0x1a')]['id']}})[_0x7366('0xd')](handleEntityNotFound(_0x44d163,null))[_0x7366('0xd')](saveUpdates(_0x1813b7[_0x7366('0x1b')],null))[_0x7366('0xd')](respondWithResult(_0x44d163,null))[_0x7366('0x1c')](handleError(_0x44d163,null));}; \ No newline at end of file +var _0xeddd=['api','../../mysqldb','redis','./user-setting.socket','defaults','localhost','status','json','update','sendStatus','error','stack','name','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','then','catch','lodash','ioredis','../../config/logger'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xeddd,0x69));var _0xdedd=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xeddd[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xdedd('0x0'));var Redis=require(_0xdedd('0x1'));var logger=require(_0xdedd('0x2'))(_0xdedd('0x3'));var config=require('../../config/environment');var db=require(_0xdedd('0x4'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xdedd('0x5')]));require(_0xdedd('0x6'))['register'](socket);config[_0xdedd('0x5')]=_[_0xdedd('0x7')](config[_0xdedd('0x5')],{'host':_0xdedd('0x8'),'port':0x18eb});function respondWithResult(_0x102b00,_0x41d72f){_0x41d72f=_0x41d72f||0xc8;return function(_0x2aa946){if(_0x2aa946){return _0x102b00[_0xdedd('0x9')](_0x41d72f)[_0xdedd('0xa')](_0x2aa946);}};}function saveUpdates(_0x4225bc){return function(_0x2860c0){if(_0x2860c0){return _0x2860c0[_0xdedd('0xb')](_0x4225bc)['then'](function(_0x3ef3d3){return _0x3ef3d3;});}return null;};}function handleEntityNotFound(_0x3c2f2b){return function(_0xf8662f){if(!_0xf8662f){_0x3c2f2b[_0xdedd('0xc')](0x194);}return _0xf8662f;};}function handleError(_0x5db016,_0x12b842){_0x12b842=_0x12b842||0x1f4;return function(_0x456d53){logger[_0xdedd('0xd')](_0x456d53[_0xdedd('0xe')]);if(_0x456d53[_0xdedd('0xf')]){delete _0x456d53[_0xdedd('0xf')];}_0x5db016[_0xdedd('0x9')](_0x12b842)[_0xdedd('0x10')](_0x456d53);};}exports[_0xdedd('0xb')]=function(_0x1bde81,_0x1a5a11){if(_0x1bde81[_0xdedd('0x11')][_0xdedd('0x12')]!==_0xdedd('0x13'))throw new Error(_0xdedd('0x14'));if(isNaN(Number(_0x1bde81[_0xdedd('0x15')]['id'])))throw new Error(_0xdedd('0x16'));return db[_0xdedd('0x17')][_0xdedd('0x18')]({'where':{'id':_0x1bde81['params']['id']}})[_0xdedd('0x19')](handleEntityNotFound(_0x1a5a11,null))[_0xdedd('0x19')](saveUpdates(_0x1bde81['body'],null))[_0xdedd('0x19')](respondWithResult(_0x1a5a11,null))[_0xdedd('0x1a')](handleError(_0x1a5a11,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 c57a5c0..1a77bad 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 _0x0491=['remove','emit','hasOwnProperty','hook','exports','UserSetting','setMaxListeners','save','update'];(function(_0x2d73ca,_0x20b3cb){var _0x3d2d25=function(_0x2f4c16){while(--_0x2f4c16){_0x2d73ca['push'](_0x2d73ca['shift']());}};_0x3d2d25(++_0x20b3cb);}(_0x0491,0x176));var _0x1049=function(_0x5922f7,_0x23885e){_0x5922f7=_0x5922f7-0x0;var _0x145529=_0x0491[_0x5922f7];return _0x145529;};'use strict';var EventEmitter=require('events');var UserSetting=require('../../mysqldb')['db'][_0x1049('0x0')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x1049('0x1')](0x0);var events={'afterCreate':_0x1049('0x2'),'afterUpdate':_0x1049('0x3'),'afterDestroy':_0x1049('0x4')};function emitEvent(_0x34a52c){return function(_0x21f989,_0x8ab2f8,_0x104e03){UserSettingEvents[_0x1049('0x5')](_0x34a52c+':'+_0x21f989['id'],_0x21f989);UserSettingEvents[_0x1049('0x5')](_0x34a52c,_0x21f989);_0x104e03(null);};}for(var e in events){if(events[_0x1049('0x6')](e)){var event=events[e];UserSetting[_0x1049('0x7')](e,emitEvent(event));}}module[_0x1049('0x8')]=UserSettingEvents; \ No newline at end of file +var _0xb5a8=['hook','exports','events','../../mysqldb','UserSetting','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x2a49ca,_0x334d4e){var _0x33bd86=function(_0x3c5332){while(--_0x3c5332){_0x2a49ca['push'](_0x2a49ca['shift']());}};_0x33bd86(++_0x334d4e);}(_0xb5a8,0xad));var _0x8b5a=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xb5a8[_0x4e1d03];return _0x362d4b;};'use strict';var EventEmitter=require(_0x8b5a('0x0'));var UserSetting=require(_0x8b5a('0x1'))['db'][_0x8b5a('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x8b5a('0x3')](0x0);var events={'afterCreate':_0x8b5a('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4399e7){return function(_0x4d7060,_0x284584,_0x310e2b){UserSettingEvents[_0x8b5a('0x5')](_0x4399e7+':'+_0x4d7060['id'],_0x4d7060);UserSettingEvents[_0x8b5a('0x5')](_0x4399e7,_0x4d7060);_0x310e2b(null);};}for(var e in events){if(events[_0x8b5a('0x6')](e)){var event=events[e];UserSetting[_0x8b5a('0x7')](e,emitEvent(event));}}module[_0x8b5a('0x8')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 73765f2..7230f72 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 _0xaa88=['exports','define','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x58962c,_0x8bc71d){var _0x4d1a4a=function(_0x33199b){while(--_0x33199b){_0x58962c['push'](_0x58962c['shift']());}};_0x4d1a4a(++_0x8bc71d);}(_0xaa88,0x137));var _0x8aa8=function(_0x263a2f,_0x1e81e3){_0x263a2f=_0x263a2f-0x0;var _0x8020e8=_0xaa88[_0x263a2f];return _0x8020e8;};'use strict';var attributes=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]=function(_0x1643a6){return _0x1643a6[_0x8aa8('0x2')]('UserSetting',attributes,{'tableName':_0x8aa8('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3a5b12){if(!_0x3a5b12[_0x8aa8('0x4')])_0x3a5b12[_0x8aa8('0x5')]=null;else if(_0x3a5b12[_0x8aa8('0x5')]===null)_0x3a5b12[_0x8aa8('0x5')]=new Date();}}});}; \ No newline at end of file +var _0x74f4=['./user-setting.attributes','exports','define','UserSetting','clientSideLoggingEnabledSince'];(function(_0x1d211b,_0x475f3b){var _0x47c88b=function(_0x3126f5){while(--_0x3126f5){_0x1d211b['push'](_0x1d211b['shift']());}};_0x47c88b(++_0x475f3b);}(_0x74f4,0xaa));var _0x474f=function(_0x27d271,_0x364840){_0x27d271=_0x27d271-0x0;var _0x14d6e9=_0x74f4[_0x27d271];return _0x14d6e9;};'use strict';var attributes=require(_0x474f('0x0'));module[_0x474f('0x1')]=function(_0x565d2d){return _0x565d2d[_0x474f('0x2')](_0x474f('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x23cf8d){if(!_0x23cf8d['clientSideLoggingEnabled'])_0x23cf8d[_0x474f('0x4')]=null;else if(_0x23cf8d[_0x474f('0x4')]===null)_0x23cf8d[_0x474f('0x4')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 9b6c9d5..bcb2cb7 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 _0x6b0f=['./user-setting.events','save','remove','emit','register','length','user-setting:'];(function(_0x4d0a17,_0x46f9ad){var _0x266701=function(_0x1b5efb){while(--_0x1b5efb){_0x4d0a17['push'](_0x4d0a17['shift']());}};_0x266701(++_0x46f9ad);}(_0x6b0f,0x93));var _0xf6b0=function(_0x57e496,_0x290529){_0x57e496=_0x57e496-0x0;var _0x46f240=_0x6b0f[_0x57e496];return _0x46f240;};'use strict';var UserSettingEvents=require(_0xf6b0('0x0'));var events=[_0xf6b0('0x1'),_0xf6b0('0x2'),'update'];function createListener(_0x382550,_0x92e914){return function(_0x3887b6){_0x92e914[_0xf6b0('0x3')](_0x382550,_0x3887b6);if(_0x382550==='user-setting:update'){_0x92e914['emit']('user-setting:update:user-'+_0x3887b6['UserId'],_0x3887b6);}};}exports[_0xf6b0('0x4')]=function(_0x316523){for(var _0x5a38ee=0x0,_0x51aba2=events[_0xf6b0('0x5')];_0x5a38ee<_0x51aba2;_0x5a38ee++){var _0x2a506d=events[_0x5a38ee];var _0x47ba43=createListener(_0xf6b0('0x6')+_0x2a506d,_0x316523);UserSettingEvents['on'](_0x2a506d,_0x47ba43);}}; \ No newline at end of file +var _0xda90=['save','update','user-setting:update','emit','user-setting:update:user-','UserId','register','length','./user-setting.events'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xda90,0xc5));var _0x0da9=function(_0x1c9a43,_0x53de41){_0x1c9a43=_0x1c9a43-0x0;var _0x11cf63=_0xda90[_0x1c9a43];return _0x11cf63;};'use strict';var UserSettingEvents=require(_0x0da9('0x0'));var events=[_0x0da9('0x1'),'remove',_0x0da9('0x2')];function createListener(_0x14a84a,_0x313441){return function(_0x5af93b){_0x313441['emit'](_0x14a84a,_0x5af93b);if(_0x14a84a===_0x0da9('0x3')){_0x313441[_0x0da9('0x4')](_0x0da9('0x5')+_0x5af93b[_0x0da9('0x6')],_0x5af93b);}};}exports[_0x0da9('0x7')]=function(_0x3e301e){for(var _0x58dcf4=0x0,_0x2a535d=events[_0x0da9('0x8')];_0x58dcf4<_0x2a535d;_0x58dcf4++){var _0x3653ff=events[_0x58dcf4];var _0x4903c9=createListener('user-setting:'+_0x3653ff,_0x3e301e);UserSettingEvents['on'](_0x3653ff,_0x4903c9);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index e67a992..6873b70 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 _0x3451=['%s-%s','now','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','createApiKey','/:id','put','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','describe','/whoami','getPresence','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','/create_many','bulkCreate','addQueues','diskStorage','format'];(function(_0x5ef52c,_0x586f79){var _0x34306e=function(_0x11a6f6){while(--_0x11a6f6){_0x5ef52c['push'](_0x5ef52c['shift']());}};_0x34306e(++_0x586f79);}(_0x3451,0x19a));var _0x1345=function(_0x43406e,_0x42f6ab){_0x43406e=_0x43406e-0x0;var _0x4dccde=_0x3451[_0x43406e];return _0x4dccde;};'use strict';var multer=require(_0x1345('0x0'));var util=require(_0x1345('0x1'));var path=require('path');var timeout=require(_0x1345('0x2'));var express=require(_0x1345('0x3'));var router=express[_0x1345('0x4')]();var fs_extra=require(_0x1345('0x5'));var auth=require(_0x1345('0x6'));var interaction=require(_0x1345('0x7'));var config=require(_0x1345('0x8'));var controller=require(_0x1345('0x9'));router[_0x1345('0xa')]('/',auth[_0x1345('0xb')](),controller[_0x1345('0xc')]);router[_0x1345('0xa')]('/describe',auth[_0x1345('0xb')](),controller[_0x1345('0xd')]);router['get'](_0x1345('0xe'),auth['isAuthenticated'](),controller['whoami']);router[_0x1345('0xa')]('/presence',auth[_0x1345('0xb')](),controller[_0x1345('0xf')]);router['get']('/:id',auth[_0x1345('0xb')](),controller['show']);router[_0x1345('0xa')](_0x1345('0x10'),controller[_0x1345('0x11')]);router[_0x1345('0xa')]('/:id/open_tabs',auth[_0x1345('0xb')](),controller[_0x1345('0x12')]);router[_0x1345('0xa')](_0x1345('0x13'),auth['isAuthenticated'](),controller[_0x1345('0x14')]);router[_0x1345('0xa')](_0x1345('0x15'),auth[_0x1345('0xb')](),controller[_0x1345('0x16')]);router[_0x1345('0xa')](_0x1345('0x17'),auth[_0x1345('0xb')](),controller[_0x1345('0x18')]);router[_0x1345('0xa')](_0x1345('0x19'),auth['isAuthenticated'](),controller['getGroups']);router[_0x1345('0xa')](_0x1345('0x1a'),auth[_0x1345('0xb')](),controller[_0x1345('0x1b')]);router['get'](_0x1345('0x1c'),auth[_0x1345('0xb')](),controller[_0x1345('0x1d')]);router[_0x1345('0xa')](_0x1345('0x1e'),auth[_0x1345('0xb')](),controller[_0x1345('0x1f')]);router[_0x1345('0xa')](_0x1345('0x20'),auth[_0x1345('0xb')](),controller[_0x1345('0x21')]);router['get'](_0x1345('0x22'),auth[_0x1345('0xb')](),controller[_0x1345('0x23')]);router[_0x1345('0xa')](_0x1345('0x24'),auth[_0x1345('0xb')](),controller[_0x1345('0x25')]);router[_0x1345('0xa')](_0x1345('0x26'),auth[_0x1345('0xb')](),controller[_0x1345('0x27')]);router[_0x1345('0xa')](_0x1345('0x28'),auth['isAuthenticated'](),controller[_0x1345('0x29')]);router['get'](_0x1345('0x2a'),auth[_0x1345('0xb')](),controller[_0x1345('0x2b')]);router[_0x1345('0xa')](_0x1345('0x2c'),auth[_0x1345('0xb')](),controller[_0x1345('0x2d')]);router[_0x1345('0xa')](_0x1345('0x2e'),auth[_0x1345('0xb')](),controller[_0x1345('0x2f')]);router[_0x1345('0xa')]('/:id/prefixes',auth[_0x1345('0xb')](),controller['getVoicePrefixes']);router['get'](_0x1345('0x30'),auth[_0x1345('0xb')](),controller[_0x1345('0x31')]);router[_0x1345('0xa')](_0x1345('0x32'),auth['isAuthenticated'](),controller[_0x1345('0x33')]);router[_0x1345('0xa')](_0x1345('0x34'),auth['isAuthenticated'](),controller[_0x1345('0x35')]);router['get']('/:id/sms_accounts',auth[_0x1345('0xb')](),controller[_0x1345('0x36')]);router[_0x1345('0xa')](_0x1345('0x37'),auth['isAuthenticated'](),controller[_0x1345('0x38')]);router[_0x1345('0xa')](_0x1345('0x39'),auth[_0x1345('0xb')](),controller[_0x1345('0x3a')]);router[_0x1345('0xa')](_0x1345('0x3b'),auth[_0x1345('0xb')](),controller[_0x1345('0x3c')]);router[_0x1345('0xa')](_0x1345('0x3d'),auth['isAuthenticated'](),controller[_0x1345('0x3e')]);router[_0x1345('0x3f')](_0x1345('0x13'),auth[_0x1345('0xb')](),controller[_0x1345('0x40')]);router['post']('/',auth[_0x1345('0xb')](),controller['create']);router['post'](_0x1345('0x41'),auth[_0x1345('0xb')](),controller[_0x1345('0x42')]);router['post'](_0x1345('0x15'),auth[_0x1345('0xb')](),controller[_0x1345('0x43')]);var upload=multer({'storage':multer[_0x1345('0x44')]({'destination':function(_0x3cf188,_0x358e97,_0x7ca9c8){_0x7ca9c8(null,path['join'](config['root'],'server/files/images/'));},'filename':function(_0x4e235b,_0x518ef2,_0x30baac){_0x30baac(null,util[_0x1345('0x45')](_0x1345('0x46'),Date[_0x1345('0x47')](),_0x518ef2[_0x1345('0x48')]));}})});router['post']('/:id/avatar',upload[_0x1345('0x49')](_0x1345('0x4a')),controller[_0x1345('0x4b')]);router[_0x1345('0x3f')](_0x1345('0x4c'),auth[_0x1345('0xb')](),controller['login']);router[_0x1345('0x3f')](_0x1345('0x4d'),auth[_0x1345('0xb')](),controller[_0x1345('0x4e')]);router['post'](_0x1345('0x4f'),auth[_0x1345('0xb')](),controller[_0x1345('0x50')]);router['post'](_0x1345('0x51'),auth[_0x1345('0xb')](),controller[_0x1345('0x52')]);router['post'](_0x1345('0x2a'),auth[_0x1345('0xb')](),controller[_0x1345('0x53')]);router[_0x1345('0x3f')](_0x1345('0x54'),auth['isAuthenticated'](),controller[_0x1345('0x55')]);router[_0x1345('0x3f')](_0x1345('0x56'),auth[_0x1345('0xb')](),controller['addMailInteractions']);router[_0x1345('0x3f')](_0x1345('0x57'),auth[_0x1345('0xb')](),controller[_0x1345('0x58')]);router[_0x1345('0x3f')](_0x1345('0x59'),auth[_0x1345('0xb')](),controller[_0x1345('0x5a')]);router[_0x1345('0x3f')](_0x1345('0x5b'),auth[_0x1345('0xb')](),controller[_0x1345('0x5c')]);router[_0x1345('0x3f')](_0x1345('0x5d'),auth[_0x1345('0xb')](),controller[_0x1345('0x5e')]);router['post'](_0x1345('0x30'),auth[_0x1345('0xb')](),controller[_0x1345('0x5f')]);router[_0x1345('0x3f')](_0x1345('0x32'),auth[_0x1345('0xb')](),controller[_0x1345('0x60')]);router[_0x1345('0x3f')](_0x1345('0x34'),auth[_0x1345('0xb')](),controller[_0x1345('0x61')]);router[_0x1345('0x3f')](_0x1345('0x62'),auth['isAuthenticated'](),controller[_0x1345('0x63')]);router['post'](_0x1345('0x37'),auth[_0x1345('0xb')](),controller['addChatWebsites']);router[_0x1345('0x3f')](_0x1345('0x39'),auth[_0x1345('0xb')](),controller['addWhatsappAccounts']);router['post']('/:id/api_key',auth[_0x1345('0xb')](),controller[_0x1345('0x64')]);router['put'](_0x1345('0x65'),auth[_0x1345('0xb')](),controller['update']);router[_0x1345('0x66')]('/:id/password',auth[_0x1345('0xb')](),controller['changePassword']);router[_0x1345('0x67')](_0x1345('0x15'),auth['isAuthenticated'](),controller[_0x1345('0x68')]);router[_0x1345('0x67')]('/:id/teams',auth['isAuthenticated'](),controller[_0x1345('0x69')]);router['delete'](_0x1345('0x65'),auth[_0x1345('0xb')](),controller[_0x1345('0x6a')]);router['delete']('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x1345('0x6b')]);router[_0x1345('0x67')](_0x1345('0x56'),auth[_0x1345('0xb')](),controller['removeMailInteractions']);router[_0x1345('0x67')]('/:id/fax_interactions',auth[_0x1345('0xb')](),controller[_0x1345('0x6c')]);router[_0x1345('0x67')](_0x1345('0x59'),auth[_0x1345('0xb')](),controller[_0x1345('0x6d')]);router[_0x1345('0x67')](_0x1345('0x5b'),auth[_0x1345('0xb')](),controller[_0x1345('0x6e')]);router['delete'](_0x1345('0x5d'),auth[_0x1345('0xb')](),controller[_0x1345('0x6f')]);router[_0x1345('0x67')](_0x1345('0x30'),auth[_0x1345('0xb')](),controller[_0x1345('0x70')]);router[_0x1345('0x67')](_0x1345('0x32'),auth[_0x1345('0xb')](),controller[_0x1345('0x71')]);router[_0x1345('0x67')](_0x1345('0x34'),auth[_0x1345('0xb')](),controller[_0x1345('0x72')]);router[_0x1345('0x67')]('/:id/sms_accounts',auth[_0x1345('0xb')](),controller[_0x1345('0x73')]);router['delete'](_0x1345('0x37'),auth[_0x1345('0xb')](),controller[_0x1345('0x74')]);router['delete'](_0x1345('0x39'),auth[_0x1345('0xb')](),controller[_0x1345('0x75')]);router[_0x1345('0x67')](_0x1345('0x3d'),auth[_0x1345('0xb')](),controller[_0x1345('0x76')]);module[_0x1345('0x77')]=router; \ No newline at end of file +var _0xd957=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','/:id/lists','/:id/agents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','/:id/api_key','post','addContacts','create','/create_many','bulkCreate','diskStorage','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey','exports'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xd957,0x153));var _0x7d95=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd957[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x7d95('0x0'));var util=require(_0x7d95('0x1'));var path=require('path');var timeout=require(_0x7d95('0x2'));var express=require(_0x7d95('0x3'));var router=express['Router']();var fs_extra=require(_0x7d95('0x4'));var auth=require(_0x7d95('0x5'));var interaction=require(_0x7d95('0x6'));var config=require(_0x7d95('0x7'));var controller=require(_0x7d95('0x8'));router[_0x7d95('0x9')]('/',auth[_0x7d95('0xa')](),controller['index']);router[_0x7d95('0x9')](_0x7d95('0xb'),auth['isAuthenticated'](),controller[_0x7d95('0xc')]);router[_0x7d95('0x9')](_0x7d95('0xd'),auth[_0x7d95('0xa')](),controller[_0x7d95('0xe')]);router['get'](_0x7d95('0xf'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x10')]);router[_0x7d95('0x9')](_0x7d95('0x11'),auth['isAuthenticated'](),controller['show']);router[_0x7d95('0x9')](_0x7d95('0x12'),controller['getAvatar']);router[_0x7d95('0x9')](_0x7d95('0x13'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x14')]);router[_0x7d95('0x9')](_0x7d95('0x15'),auth['isAuthenticated'](),controller[_0x7d95('0x16')]);router['get'](_0x7d95('0x17'),auth['isAuthenticated'](),controller[_0x7d95('0x18')]);router['get'](_0x7d95('0x19'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x1a')]);router[_0x7d95('0x9')]('/:id/groups',auth['isAuthenticated'](),controller[_0x7d95('0x1b')]);router[_0x7d95('0x9')](_0x7d95('0x1c'),auth[_0x7d95('0xa')](),controller['getRecordings']);router[_0x7d95('0x9')](_0x7d95('0x1d'),auth['isAuthenticated'](),controller[_0x7d95('0x1e')]);router[_0x7d95('0x9')](_0x7d95('0x1f'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x20')]);router[_0x7d95('0x9')](_0x7d95('0x21'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x22')]);router['get'](_0x7d95('0x23'),auth['isAuthenticated'](),controller[_0x7d95('0x24')]);router['get']('/:id/sms/interactions',auth[_0x7d95('0xa')](),controller[_0x7d95('0x25')]);router[_0x7d95('0x9')]('/:id/fax/interactions',auth[_0x7d95('0xa')](),controller[_0x7d95('0x26')]);router['get'](_0x7d95('0x27'),auth['isAuthenticated'](),controller['getWhatsappInteractions']);router['get'](_0x7d95('0x28'),auth[_0x7d95('0xa')](),controller['getTeams']);router[_0x7d95('0x9')](_0x7d95('0x29'),auth[_0x7d95('0xa')](),controller['getLists']);router[_0x7d95('0x9')](_0x7d95('0x2a'),auth[_0x7d95('0xa')](),controller['getAgents']);router[_0x7d95('0x9')]('/:id/prefixes',auth[_0x7d95('0xa')](),controller[_0x7d95('0x2b')]);router[_0x7d95('0x9')](_0x7d95('0x2c'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x2d')]);router[_0x7d95('0x9')](_0x7d95('0x2e'),auth['isAuthenticated'](),controller[_0x7d95('0x2f')]);router['get'](_0x7d95('0x30'),auth['isAuthenticated'](),controller[_0x7d95('0x31')]);router[_0x7d95('0x9')](_0x7d95('0x32'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x33')]);router[_0x7d95('0x9')]('/:id/chat_websites',auth[_0x7d95('0xa')](),controller[_0x7d95('0x34')]);router[_0x7d95('0x9')](_0x7d95('0x35'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x36')]);router['get'](_0x7d95('0x37'),auth[_0x7d95('0xa')](),controller['getScheduledCalls']);router['get'](_0x7d95('0x38'),auth[_0x7d95('0xa')](),controller['getApiKey']);router[_0x7d95('0x39')](_0x7d95('0x15'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x3a')]);router[_0x7d95('0x39')]('/',auth[_0x7d95('0xa')](),controller[_0x7d95('0x3b')]);router['post'](_0x7d95('0x3c'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x3d')]);router['post'](_0x7d95('0x17'),auth[_0x7d95('0xa')](),controller['addQueues']);var upload=multer({'storage':multer[_0x7d95('0x3e')]({'destination':function(_0x283e74,_0x3e4568,_0x459e65){_0x459e65(null,path['join'](config['root'],'server/files/images/'));},'filename':function(_0x586480,_0x4bf41d,_0x5a64db){_0x5a64db(null,util['format'](_0x7d95('0x3f'),Date[_0x7d95('0x40')](),_0x4bf41d[_0x7d95('0x41')]));}})});router[_0x7d95('0x39')](_0x7d95('0x12'),upload[_0x7d95('0x42')](_0x7d95('0x43')),controller[_0x7d95('0x44')]);router[_0x7d95('0x39')](_0x7d95('0x45'),auth['isAuthenticated'](),controller[_0x7d95('0x46')]);router[_0x7d95('0x39')](_0x7d95('0x47'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x48')]);router[_0x7d95('0x39')](_0x7d95('0x49'),auth[_0x7d95('0xa')](),controller['pause']);router[_0x7d95('0x39')](_0x7d95('0x4a'),auth['isAuthenticated'](),controller[_0x7d95('0x4b')]);router[_0x7d95('0x39')]('/:id/teams',auth[_0x7d95('0xa')](),controller['addTeams']);router['post'](_0x7d95('0x4c'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x4d')]);router[_0x7d95('0x39')](_0x7d95('0x4e'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x4f')]);router[_0x7d95('0x39')](_0x7d95('0x50'),auth['isAuthenticated'](),controller[_0x7d95('0x51')]);router['post'](_0x7d95('0x52'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x53')]);router[_0x7d95('0x39')](_0x7d95('0x54'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x55')]);router[_0x7d95('0x39')](_0x7d95('0x56'),auth[_0x7d95('0xa')](),controller['addWhatsappInteractions']);router[_0x7d95('0x39')](_0x7d95('0x2c'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x57')]);router[_0x7d95('0x39')](_0x7d95('0x2e'),auth['isAuthenticated'](),controller['addMailAccounts']);router[_0x7d95('0x39')](_0x7d95('0x30'),auth['isAuthenticated'](),controller[_0x7d95('0x58')]);router[_0x7d95('0x39')]('/:id/sms_accounts',auth[_0x7d95('0xa')](),controller[_0x7d95('0x59')]);router[_0x7d95('0x39')](_0x7d95('0x5a'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x5b')]);router[_0x7d95('0x39')](_0x7d95('0x35'),auth[_0x7d95('0xa')](),controller['addWhatsappAccounts']);router[_0x7d95('0x39')]('/:id/api_key',auth[_0x7d95('0xa')](),controller['createApiKey']);router[_0x7d95('0x5c')](_0x7d95('0x11'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x5d')]);router[_0x7d95('0x5c')](_0x7d95('0x5e'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x5f')]);router[_0x7d95('0x60')]('/:id/queues',auth[_0x7d95('0xa')](),controller[_0x7d95('0x61')]);router[_0x7d95('0x60')](_0x7d95('0x28'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x62')]);router[_0x7d95('0x60')](_0x7d95('0x11'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x63')]);router[_0x7d95('0x60')](_0x7d95('0x4c'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x64')]);router['delete'](_0x7d95('0x4e'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x65')]);router[_0x7d95('0x60')](_0x7d95('0x50'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x66')]);router[_0x7d95('0x60')](_0x7d95('0x52'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x67')]);router[_0x7d95('0x60')](_0x7d95('0x54'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x68')]);router[_0x7d95('0x60')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x7d95('0x69')]);router[_0x7d95('0x60')](_0x7d95('0x2c'),auth['isAuthenticated'](),controller[_0x7d95('0x6a')]);router[_0x7d95('0x60')](_0x7d95('0x2e'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x6b')]);router[_0x7d95('0x60')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x7d95('0x6c')]);router[_0x7d95('0x60')](_0x7d95('0x32'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x6d')]);router[_0x7d95('0x60')]('/:id/chat_websites',auth[_0x7d95('0xa')](),controller[_0x7d95('0x6e')]);router[_0x7d95('0x60')](_0x7d95('0x35'),auth[_0x7d95('0xa')](),controller['removeWhatsappAccounts']);router[_0x7d95('0x60')](_0x7d95('0x38'),auth[_0x7d95('0xa')](),controller[_0x7d95('0x6f')]);module[_0x7d95('0x70')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 45034c6..a73c7aa 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(_0x337e98,_0x2cd3c1){var _0x2707bd=function(_0x4eba2f){while(--_0x4eba2f){_0x337e98['push'](_0x337e98['shift']());}};_0x2707bd(++_0x2cd3c1);}(_0x34e8,0x12c));var _0x834e=function(_0x1ad57c,_0x47f8ca){_0x1ad57c=_0x1ad57c-0x0;var _0x8672f4=_0x34e8[_0x1ad57c];return _0x8672f4;};'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 _0x9c44=['get','udp','encryption','avpf','force_avp','icesupport','dtlscertfile','dtlsprivatekey','wss','dtlsenable','dtlsverify','dtlssetup','actpass','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','admin','user','telephone','local','INTEGER','internal','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate','active','update,nonat','TEXT'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x49c4('0x0'));var _=require(_0x49c4('0x1'));module[_0x49c4('0x2')]={'name':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2ad237){this['setDataValue']('name',_0x2ad237);this[_0x49c4('0x5')]('defaultuser',_0x2ad237);},'comment':_0x49c4('0x6')},'fullname':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'set':function(_0x69bc41){this[_0x49c4('0x5')](_0x49c4('0x7'),_0x69bc41);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),_0x69bc41,this[_0x49c4('0xb')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0xc'),'validate':{'isEmail':!![]},'set':function(_0x58cad7){if(_0x58cad7){this[_0x49c4('0x5')](_0x49c4('0xc'),_0x58cad7['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x49c4('0xd'),_0x49c4('0xe'),'agent',_0x49c4('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0x10')},'internal':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':![],'unique':_0x49c4('0x12'),'set':function(_0x2decee){this[_0x49c4('0x5')](_0x49c4('0x12'),_0x2decee);this[_0x49c4('0x5')](_0x49c4('0x13'),_0x2decee);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),this[_0x49c4('0xb')](_0x49c4('0x7')),_0x2decee));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x49c4('0x3')]},'mobile':{'type':Sequelize[_0x49c4('0x3')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x49c4('0x3')]},'city':{'type':Sequelize[_0x49c4('0x3')]},'country':{'type':Sequelize[_0x49c4('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x49c4('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':_0x49c4('0x16')},'lastPauseAt':{'type':Sequelize[_0x49c4('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x17')},'ipaddr':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x19'),'user',_0x49c4('0x1a')),'allowNull':!![],'defaultValue':_0x49c4('0x19')},'context':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x1b')},'callingpres':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x1c'),_0x49c4('0x1d'),_0x49c4('0x1e'),_0x49c4('0x1f'),_0x49c4('0x20'),_0x49c4('0x21'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x38ad77){this[_0x49c4('0x5')](_0x49c4('0x22'),_0x38ad77?_0x38ad77[_0x49c4('0x23')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x49c4('0xb')](_0x49c4('0x22'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x25')},'dtmfmode':{'type':Sequelize[_0x49c4('0x18')]('rfc2833',_0x49c4('0x26'),_0x49c4('0x27'),_0x49c4('0x28'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x49c4('0x2d'),'set':function(_0x5b96df){this[_0x49c4('0x5')](_0x49c4('0x2e'),_0x5b96df?_0x5b96df[_0x49c4('0x23')](','):null);},'get':function(){return this[_0x49c4('0xb')]('nat')?this[_0x49c4('0xb')](_0x49c4('0x2e'))[_0x49c4('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedcallgroup':{'type':Sequelize[_0x49c4('0x3')]},'pickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'language':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x49c4('0x3')]},'disallow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x2f')},'allow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x30'),'set':function(_0x1e506a){this['setDataValue'](_0x49c4('0x31'),_0x1e506a?_0x1e506a[_0x49c4('0x23')](';'):_0x49c4('0x30'));},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x31'))?this[_0x49c4('0xb')](_0x49c4('0x31'))[_0x49c4('0x24')](';'):null;},'comment':_0x49c4('0x32')},'autoframing':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'set':function(_0x326142){this['setDataValue'](_0x49c4('0x33'),_0x326142?_0x326142['join'](','):null);},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x33'))?this[_0x49c4('0xb')](_0x49c4('0x33'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x34')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x35')},'amaflags':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x36'),_0x49c4('0x37'),_0x49c4('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x39'),'uas'),'allowNull':!![],'defaultValue':_0x49c4('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x3b'),_0x49c4('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x3d'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x49c4('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x49c4('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x49c4('0x3f')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x10dec7){this[_0x49c4('0x5')]('showWebBar',_0x10dec7);var _0x39c455=this[_0x49c4('0x40')]({'plain':!![]});switch(_0x10dec7){case 0x0:case 0x1:var _0x4f50bf=_0x39c455['transport']?_['isArray'](_0x39c455['transport'])?_0x39c455[_0x49c4('0x22')]['join']():_0x39c455[_0x49c4('0x22')]:_0x49c4('0x41');if(_0x4f50bf==='wss'){_0x4f50bf=_0x49c4('0x41');}this[_0x49c4('0x5')]('transport',_0x4f50bf);this[_0x49c4('0x5')](_0x49c4('0x42'),'no');this[_0x49c4('0x5')](_0x49c4('0x43'),null);this['setDataValue'](_0x49c4('0x44'),null);this[_0x49c4('0x5')](_0x49c4('0x45'),null);this[_0x49c4('0x5')]('dtlsenable',null);this[_0x49c4('0x5')]('dtlsverify',null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0x49c4('0x46'),null);this[_0x49c4('0x5')](_0x49c4('0x47'),null);this[_0x49c4('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x49c4('0x22'),_0x49c4('0x48'));this[_0x49c4('0x5')](_0x49c4('0x42'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x43'),_0x49c4('0x29'));this['setDataValue'](_0x49c4('0x44'),'yes');this[_0x49c4('0x5')](_0x49c4('0x45'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x49'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x4a'),'no');this[_0x49c4('0x5')](_0x49c4('0x4b'),_0x49c4('0x4c'));this[_0x49c4('0x5')](_0x49c4('0x46'),_0x39c455[_0x49c4('0x46')]||_0x49c4('0x4d'));this[_0x49c4('0x5')](_0x49c4('0x47'),_0x39c455[_0x49c4('0x47')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x49c4('0x4e'),_0x49c4('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1a15f3){this[_0x49c4('0x5')](_0x49c4('0x4f'),_0x1a15f3?_0x1a15f3[_0x49c4('0x23')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this[_0x49c4('0xb')](_0x49c4('0x4f'))[_0x49c4('0x24')](','),function(_0x2f4289){return parseInt(_0x2f4289,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x50'))?this[_0x49c4('0xb')](_0x49c4('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x27b77d){if(typeof _0x27b77d===_0x49c4('0x51')){var _0x34870e=_0x27b77d==='1'?!![]:_0x27b77d==='0'?![]:_0x27b77d==='true'?!![]:_0x27b77d===_0x49c4('0x52')?![]:![];this[_0x49c4('0x5')](_0x49c4('0x53'),_0x34870e);}else{this[_0x49c4('0x5')](_0x49c4('0x53'),_0x27b77d);}}},'blocked':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x38b291){this[_0x49c4('0x5')](_0x49c4('0x54'),_0x38b291);if(_0x38b291===!![]){this[_0x49c4('0x5')]('blockedAt',moment());this[_0x49c4('0x5')](_0x49c4('0x55'),0x0);}else{this['setDataValue'](_0x49c4('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x49c4('0x11')](0x5)[_0x49c4('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 129b3fa..e671dbc 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 _0xeda1=['remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','MemberReport','QueuePause','pause','updateAttributes','DEFAULT\x20PAUSE','bulkCreate','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','chatPause','faxPause','openchannelPause','pauseType','lastPauseAt','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','resolve','Query\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','removeAgent','getLists','values','addChatInteractions','omit','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','spread','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','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','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','lastName','Contact','dialActive','getApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','nonce','removeApiKey','apiKeyNonce','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','teams','queues','isEmpty','inbound','flatten','getAgents','lower','col','toString','desc','asc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','client','http','offline','idle','ringing','voiceStatus','busy','toUpperCase','slice','select','ui.','InteractionId','field','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','util','path','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','socket.io-emitter','redis','./user.socket','register','defaults','localhost','request','then','info','request\x20sent','debug','stringify','error','code','message','User,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','emit','userNotification:recalc:','destroy','get','role','admin','user','Agents','Telephones','telephone','filter','ignore','map','value','includes','name','UserProfileResource','stack','send','index','rawAttributes','fieldName','type','key','salt','where','query','includeAll','include','true','UserSetting','attributes','push','User','findAll','rows','openTabs','length','chat','dataValues','sms','fax','mail','openchannel','whatsapp','all','show','params','differenceBy','keys','password','filters','intersection','model','fields','userSetting','merge','options','find','update','body','describe','addContacts','ids','internal','Setting','validatePasswordPattern','max','isNil','min_internal','sequelize','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','agent','permissions','102','103','113','110','104','107','108','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','compact','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','ValidationError','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','updatePasswordsHistory','addQueues','online','loginInPause','voicePause','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','QueueId','Queue:save','voice','VoiceQueue','interface','format','SIP/%s','upsert','removeQueues','channel','remove','isArray','Queue:remove','UserVoiceQueueRt','addAvatar','userpic','file','filename','getAvatar','root','server/files/images/logos/default_profile.png','download','server/files/images/','join','getOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','User\x20with\x20id\x20%s\x20not\x20found','Tag','Tags','color','tag','getQueues','Queue','sort','pick','nolimit','getVoiceQueuesRt','order','ChatGroup','getGroups','hasOwnProperty','getRecordings','VoiceRecording','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','x-forwarded-for','connection'];(function(_0x4d6e36,_0x1aa90b){var _0x170767=function(_0x40d1e7){while(--_0x40d1e7){_0x4d6e36['push'](_0x4d6e36['shift']());}};_0x170767(++_0x1aa90b);}(_0xeda1,0x9c));var _0x1eda=function(_0x133f81,_0x550e62){_0x133f81=_0x133f81-0x0;var _0x2eef30=_0xeda1[_0x133f81];return _0x2eef30;};'use strict';var moment=require(_0x1eda('0x0'));var util=require(_0x1eda('0x1'));var path=require(_0x1eda('0x2'));var fs=require('fs');var _=require(_0x1eda('0x3'));var squel=require(_0x1eda('0x4'));var jayson=require(_0x1eda('0x5'));var Redis=require(_0x1eda('0x6'));var authService=require(_0x1eda('0x7'));var contacts=require('../../components/contacts');var qs=require(_0x1eda('0x8'));var logger=require(_0x1eda('0x9'))(_0x1eda('0xa'));var utils=require('../../config/utils');var config=require(_0x1eda('0xb'));var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0x1eda('0xc'))['APIBadRequestError'];var APINotFoundError=require(_0x1eda('0xc'))['APINotFoundError'];var APIHandleError=require(_0x1eda('0xc'))['handleError'];var db=require('../../mysqldb')['db'];var socket=require(_0x1eda('0xd'))(new Redis(config[_0x1eda('0xe')]));require(_0x1eda('0xf'))[_0x1eda('0x10')](socket);config[_0x1eda('0xe')]=_[_0x1eda('0x11')](config[_0x1eda('0xe')],{'host':_0x1eda('0x12'),'port':0x18eb});var amiClient=jayson['client']['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x1be732,_0x40aa92,_0x2ea591,_0x45d0a1){return new Promise(function(_0x5f516c,_0x4161c0){var _0x56d6a8=_0x45d0a1||amiClient;return _0x56d6a8[_0x1eda('0x13')](_0x1be732,_0x2ea591)[_0x1eda('0x14')](function(_0x2c94d1){logger[_0x1eda('0x15')]('User,\x20%s,\x20%s',_0x40aa92,_0x1eda('0x16'));logger[_0x1eda('0x17')]('User,\x20%s,\x20%s,\x20%s',_0x40aa92,_0x1eda('0x16'),JSON[_0x1eda('0x18')](_0x2c94d1));if(_0x2c94d1['error']){if(_0x2c94d1[_0x1eda('0x19')][_0x1eda('0x1a')]===0x1f4){logger[_0x1eda('0x19')]('User,\x20%s,\x20%s',_0x40aa92,_0x2c94d1[_0x1eda('0x19')]['message']);return _0x4161c0(_0x2c94d1[_0x1eda('0x19')][_0x1eda('0x1b')]);}logger[_0x1eda('0x19')](_0x1eda('0x1c'),_0x40aa92,_0x2c94d1['error'][_0x1eda('0x1b')]);return _0x5f516c(_0x2c94d1['error'][_0x1eda('0x1b')]);}else{logger[_0x1eda('0x15')](_0x1eda('0x1c'),_0x40aa92,_0x1eda('0x16'));_0x5f516c(_0x2c94d1[_0x1eda('0x1d')][_0x1eda('0x1b')]);}})[_0x1eda('0x1e')](function(_0x16fb66){logger[_0x1eda('0x19')](_0x1eda('0x1c'),_0x40aa92,_0x16fb66);_0x4161c0(_0x16fb66);});});}function respondWithStatusCode(_0x1917a0,_0x5e5d9b){_0x5e5d9b=_0x5e5d9b||0xcc;return function(_0x2e769c){if(_0x2e769c){return _0x1917a0[_0x1eda('0x1f')](_0x5e5d9b);}return _0x1917a0[_0x1eda('0x20')](_0x5e5d9b)[_0x1eda('0x21')]();};}function respondWithResult(_0x1e1952,_0x2bd0ac){_0x2bd0ac=_0x2bd0ac||0xc8;return function(_0x352a64){if(_0x352a64){return _0x1e1952[_0x1eda('0x20')](_0x2bd0ac)[_0x1eda('0x22')](_0x352a64);}};}function respondWithFilteredResult(_0xe51ef1,_0x3abd4f){return function(_0x317274){if(_0x317274){var _0x3a8654=typeof _0x3abd4f[_0x1eda('0x23')]==='undefined'&&typeof _0x3abd4f[_0x1eda('0x24')]==='undefined';var _0x32e4da=_0x317274[_0x1eda('0x25')];var _0x2fda7b=_0x3a8654?0x0:_0x3abd4f[_0x1eda('0x23')];var _0x505fc3=_0x3a8654?_0x317274[_0x1eda('0x25')]:_0x3abd4f['offset']+_0x3abd4f['limit'];var _0x4a636f;if(_0x505fc3>=_0x32e4da){_0x505fc3=_0x32e4da;_0x4a636f=0xc8;}else{_0x4a636f=0xce;}_0xe51ef1['status'](_0x4a636f);return _0xe51ef1[_0x1eda('0x26')](_0x1eda('0x27'),_0x2fda7b+'-'+_0x505fc3+'/'+_0x32e4da)['json'](_0x317274);}return null;};}function saveUpdates(_0x434492){return function(_0x10fbc5){if(_0x10fbc5){return _0x10fbc5['update'](_0x434492)[_0x1eda('0x14')](function(_0x5291c){if(_0x5291c['role']==='agent'){socket[_0x1eda('0x28')](_0x1eda('0x29')+_0x5291c['id'],_0x5291c);}return _0x5291c;});}return null;};}function removeEntity(_0x4a3c0c){return function(_0x4c1179){if(_0x4c1179){return _0x4c1179[_0x1eda('0x2a')]()[_0x1eda('0x14')](function(){var _0xb787da=_0x4c1179[_0x1eda('0x2b')]({'plain':!![]});if(_0xb787da[_0x1eda('0x2c')]===_0x1eda('0x2d'))return;var _0x72e167=[{'name':'Users','value':_0x1eda('0x2e'),'ignore':!![]},{'name':_0x1eda('0x2f'),'value':'agent','ignore':![]},{'name':_0x1eda('0x30'),'value':_0x1eda('0x31'),'ignore':![]}];var _0x286188=_(_0x72e167)[_0x1eda('0x32')](_0x1eda('0x33'))[_0x1eda('0x34')](_0x1eda('0x35'))['value']();if(_[_0x1eda('0x36')](_0x286188,_0xb787da[_0x1eda('0x2c')])){return;}var _0x557c90=_['find'](_0x72e167,[_0x1eda('0x35'),_0xb787da[_0x1eda('0x2c')]])[_0x1eda('0x37')];return db[_0x1eda('0x38')][_0x1eda('0x2a')]({'where':{'type':_0x557c90,'resourceId':_0xb787da['id']}})[_0x1eda('0x14')](function(){return _0x4c1179;});})[_0x1eda('0x14')](function(){_0x4a3c0c[_0x1eda('0x20')](0xcc)[_0x1eda('0x21')]();});}};}function handleEntityNotFound(_0x56f022){return function(_0x1a144a){if(!_0x1a144a){_0x56f022[_0x1eda('0x1f')](0x194);}return _0x1a144a;};}function handleError(_0x355d1f,_0x1426c2){_0x1426c2=_0x1426c2||0x1f4;return function(_0x29ef20){logger[_0x1eda('0x19')](_0x29ef20[_0x1eda('0x39')]);if(_0x29ef20[_0x1eda('0x37')]){delete _0x29ef20['name'];}_0x355d1f[_0x1eda('0x20')](_0x1426c2)[_0x1eda('0x3a')](_0x29ef20);};}exports[_0x1eda('0x3b')]=function(_0x296c87,_0x5b60db){var _0x2e0020={},_0x501fe4={'count':0x0,'rows':[]};var _0x61699b=_(db['User'][_0x1eda('0x3c')])['map'](function(_0x4393dd){return{'name':_0x4393dd[_0x1eda('0x3d')],'type':_0x4393dd[_0x1eda('0x3e')][_0x1eda('0x3f')]};})[_0x1eda('0x32')](function(_0x497101){return!_[_0x1eda('0x36')](['password',_0x1eda('0x40')],_0x497101['name']);})['value']();_0x2e0020=qs['getOptions'](_0x61699b,_0x296c87);var _0x444aa9={'where':_0x2e0020[_0x1eda('0x41')]};return db['User'][_0x1eda('0x25')](_0x444aa9)[_0x1eda('0x14')](function(_0x4078a8){_0x501fe4[_0x1eda('0x25')]=_0x4078a8;if(_0x296c87[_0x1eda('0x42')][_0x1eda('0x43')]){_0x2e0020[_0x1eda('0x44')]=[{'all':!![]}];}if(_0x296c87['query']['userSetting']===_0x1eda('0x45')){_0x2e0020['include']=[{'model':db[_0x1eda('0x46')],'as':'userSetting'}];}if(!_['includes'](_0x2e0020[_0x1eda('0x47')],'id')){_0x2e0020['attributes'][_0x1eda('0x48')]('id');}return db[_0x1eda('0x49')][_0x1eda('0x4a')](_0x2e0020);})['then'](function(_0x1ac8f2){_0x501fe4[_0x1eda('0x4b')]=_0x1ac8f2;if(_0x296c87[_0x1eda('0x42')][_0x1eda('0x4c')]==='true'){var _0x51e86f=[];for(var _0xe8cd9=0x0;_0xe8cd9<_0x501fe4[_0x1eda('0x4b')][_0x1eda('0x4d')];_0xe8cd9++){_0x51e86f[_0x1eda('0x48')](get_open_tabs(_0x1eda('0x4e'),_0x501fe4[_0x1eda('0x4b')][_0xe8cd9][_0x1eda('0x4f')]));_0x51e86f[_0x1eda('0x48')](get_open_tabs(_0x1eda('0x50'),_0x501fe4[_0x1eda('0x4b')][_0xe8cd9]['dataValues']));_0x51e86f[_0x1eda('0x48')](get_open_tabs(_0x1eda('0x51'),_0x501fe4[_0x1eda('0x4b')][_0xe8cd9][_0x1eda('0x4f')]));_0x51e86f[_0x1eda('0x48')](get_open_tabs(_0x1eda('0x52'),_0x501fe4[_0x1eda('0x4b')][_0xe8cd9][_0x1eda('0x4f')]));_0x51e86f['push'](get_open_tabs(_0x1eda('0x53'),_0x501fe4[_0x1eda('0x4b')][_0xe8cd9][_0x1eda('0x4f')]));_0x51e86f[_0x1eda('0x48')](get_open_tabs(_0x1eda('0x54'),_0x501fe4[_0x1eda('0x4b')][_0xe8cd9][_0x1eda('0x4f')]));}return Promise[_0x1eda('0x55')](_0x51e86f)[_0x1eda('0x14')](function(){return _0x501fe4;});}else{return _0x501fe4;}})[_0x1eda('0x14')](respondWithFilteredResult(_0x5b60db,_0x2e0020))[_0x1eda('0x1e')](handleError(_0x5b60db,null));};exports[_0x1eda('0x56')]=function(_0x289f23,_0x3c21cb){var _0xa9295e={'raw':![],'where':{'id':_0x289f23[_0x1eda('0x57')]['id']}},_0x4d5845={};_0x4d5845['model']=_[_0x1eda('0x58')](_[_0x1eda('0x59')](db[_0x1eda('0x49')][_0x1eda('0x3c')]),[_0x1eda('0x5a'),_0x1eda('0x40')]);_0x4d5845[_0x1eda('0x42')]=_[_0x1eda('0x59')](_0x289f23[_0x1eda('0x42')]);_0x4d5845[_0x1eda('0x5b')]=_[_0x1eda('0x5c')](_0x4d5845['model'],_0x4d5845['query']);_0xa9295e['attributes']=_['intersection'](_0x4d5845[_0x1eda('0x5d')],qs[_0x1eda('0x5e')](_0x289f23['query']['fields']));_0xa9295e['attributes']=_0xa9295e[_0x1eda('0x47')][_0x1eda('0x4d')]?_0xa9295e[_0x1eda('0x47')]:_0x4d5845[_0x1eda('0x5d')];if(_0x289f23['query'][_0x1eda('0x43')]){_0xa9295e[_0x1eda('0x44')]=[{'all':!![]}];}if(_0x289f23[_0x1eda('0x42')][_0x1eda('0x5f')]===_0x1eda('0x45')){_0xa9295e[_0x1eda('0x44')]=[{'model':db['UserSetting'],'as':'userSetting'}];}_0xa9295e=_[_0x1eda('0x60')]({},_0xa9295e,_0x289f23[_0x1eda('0x61')]);if(!_['includes'](_0xa9295e[_0x1eda('0x47')],'id')){_0xa9295e[_0x1eda('0x47')][_0x1eda('0x48')]('id');}return db['User'][_0x1eda('0x62')](_0xa9295e)[_0x1eda('0x14')](handleEntityNotFound(_0x3c21cb,null))[_0x1eda('0x14')](function(_0x4eb412){var _0x13701e=[];values=_0x4eb412;if(_0x289f23[_0x1eda('0x42')][_0x1eda('0x4c')]==='true'){_0x13701e[_0x1eda('0x48')](get_open_tabs(_0x1eda('0x4e'),_0x4eb412[_0x1eda('0x4f')]));_0x13701e[_0x1eda('0x48')](get_open_tabs(_0x1eda('0x50'),_0x4eb412['dataValues']));_0x13701e['push'](get_open_tabs(_0x1eda('0x53'),_0x4eb412[_0x1eda('0x4f')]));_0x13701e[_0x1eda('0x48')](get_open_tabs(_0x1eda('0x54'),_0x4eb412[_0x1eda('0x4f')]));_0x13701e['push'](get_open_tabs(_0x1eda('0x51'),_0x4eb412['dataValues']));_0x13701e['push'](get_open_tabs(_0x1eda('0x52'),_0x4eb412[_0x1eda('0x4f')]));return Promise['all'](_0x13701e);}else{return values;}})[_0x1eda('0x14')](function(){return values;})[_0x1eda('0x14')](respondWithResult(_0x3c21cb,null))['catch'](handleError(_0x3c21cb,null));};exports[_0x1eda('0x63')]=function(_0x50b05e,_0xa65992){if(_0x50b05e[_0x1eda('0x64')]['id']){delete _0x50b05e['body']['id'];}delete _0x50b05e[_0x1eda('0x64')][_0x1eda('0x2c')];return db['User'][_0x1eda('0x62')]({'where':{'id':_0x50b05e[_0x1eda('0x57')]['id']}})['then'](handleEntityNotFound(_0xa65992,null))['then'](saveUpdates(_0x50b05e[_0x1eda('0x64')],null))[_0x1eda('0x14')](respondWithResult(_0xa65992,null))['catch'](handleError(_0xa65992,null));};exports['describe']=function(_0x6971c4,_0xb58fdd){return db[_0x1eda('0x49')][_0x1eda('0x65')]()[_0x1eda('0x14')](respondWithResult(_0xb58fdd,null))[_0x1eda('0x1e')](handleError(_0xb58fdd,null));};exports[_0x1eda('0x66')]=function(_0x1294ea,_0x97b5c4){return db[_0x1eda('0x49')][_0x1eda('0x62')]({'where':{'id':_0x1294ea[_0x1eda('0x57')]['id']}})[_0x1eda('0x14')](handleEntityNotFound(_0x97b5c4,null))[_0x1eda('0x14')](function(_0x106de6){if(_0x106de6){return _0x106de6[_0x1eda('0x66')](_0x1294ea[_0x1eda('0x64')][_0x1eda('0x67')],_['omit'](_0x1294ea['body'],['ids','id'])||{});}})[_0x1eda('0x14')](respondWithResult(_0x97b5c4,null))[_0x1eda('0x1e')](handleError(_0x97b5c4,null));};function validateUser(_0x321273){return new Promise(function(_0x407a9e,_0x44a18c){if(_0x321273[_0x1eda('0x68')])return _0x407a9e(_0x321273);return db[_0x1eda('0x69')]['findById'](0x1)[_0x1eda('0x14')](function(_0x238c63){if(_0x238c63['securePassword'])authService[_0x1eda('0x6a')](_0x321273['password']);db['User'][_0x1eda('0x6b')]('internal')[_0x1eda('0x14')](function(_0x6ee7cb){if(_[_0x1eda('0x6c')](_0x6ee7cb)){_0x321273['internal']=_0x238c63['min_internal']||0x1;return;}if(_['isNil'](_0x238c63['min_internal'])||_0x238c63[_0x1eda('0x6d')]===_0x6ee7cb){_0x321273[_0x1eda('0x68')]=_0x6ee7cb+0x1;return;}if(_0x238c63[_0x1eda('0x6d')]>_0x6ee7cb){_0x321273[_0x1eda('0x68')]=_0x238c63[_0x1eda('0x6d')];return;}return db[_0x1eda('0x6e')][_0x1eda('0x42')]('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[_0x1eda('0x6e')][_0x1eda('0x6f')][_0x1eda('0x70')]})[_0x1eda('0x14')](function(_0x15e95f){if(_0x15e95f&&_0x15e95f[_0x1eda('0x4d')]){for(var _0xb46193=0x0,_0x1bc7e6=_0x15e95f[_0x1eda('0x4d')];_0xb46193<_0x1bc7e6&&_[_0x1eda('0x6c')](_0x321273[_0x1eda('0x68')]);_0xb46193++){if(_0x238c63[_0x1eda('0x6d')]<=_0x15e95f[_0xb46193]['from']){_0x321273[_0x1eda('0x68')]=_0x15e95f[_0xb46193][_0x1eda('0x71')];}else if(_0x238c63[_0x1eda('0x6d')]>_0x15e95f[_0xb46193][_0x1eda('0x71')]&&_0x238c63['min_internal']<=_0x15e95f[_0xb46193]['to']){_0x321273[_0x1eda('0x68')]=_0x238c63[_0x1eda('0x6d')];}}}if(_[_0x1eda('0x6c')](_0x321273[_0x1eda('0x68')])){_0x321273[_0x1eda('0x68')]=_0x6ee7cb+0x1;}return _0x407a9e(_0x321273);});});})[_0x1eda('0x1e')](function(_0x403002){_0x44a18c(_0x403002);});});}function updateUser(_0x188520){return new Promise(function(_0x37d833,_0x5793f0){try{if(_0x188520[_0x1eda('0x72')]){_0x188520[_0x1eda('0x73')]=_0x188520[_0x1eda('0x68')];_0x188520[_0x1eda('0x74')]={'mailbox':_0x188520[_0x1eda('0x68')],'password':_0x188520[_0x1eda('0x5a')],'fullname':_0x188520[_0x1eda('0x75')],'email':_0x188520['email']};}if(_0x188520[_0x1eda('0x2c')]===_0x1eda('0x76')){if(!_0x188520[_0x1eda('0x77')])_0x188520[_0x1eda('0x77')]=['101',_0x1eda('0x78'),_0x1eda('0x79'),_0x1eda('0x7a'),_0x1eda('0x7b'),_0x1eda('0x7c'),'105','106',_0x1eda('0x7d'),_0x1eda('0x7e'),'109','100',_0x1eda('0x7f'),_0x1eda('0x80'),_0x1eda('0x81')];}_0x37d833(_0x188520);}catch(_0x4a5553){_0x5793f0(_0x4a5553);}});}exports[_0x1eda('0x82')]=function(_0xc0e66a,_0x1445ca){if(_0xc0e66a['user']['role']==='agent')throw new Error(_0x1eda('0x83'));if(_0xc0e66a[_0x1eda('0x64')][_0x1eda('0x2c')]==='user'&&_0xc0e66a[_0x1eda('0x2e')][_0x1eda('0x2c')]!=='admin'){throw new Error(_0x1eda('0x84'));}if(_0xc0e66a[_0x1eda('0x64')]['role']===_0x1eda('0x2d')&&_0xc0e66a[_0x1eda('0x2e')][_0x1eda('0x2c')]!=='admin'){throw new Error(_0x1eda('0x85'));}return licenseUtil[_0x1eda('0x86')]([_0xc0e66a[_0x1eda('0x64')]])[_0x1eda('0x14')](function(){return validateUser(_0xc0e66a[_0x1eda('0x64')]);})[_0x1eda('0x14')](function(_0x10f68a){return updateUser(_0x10f68a)[_0x1eda('0x14')](function(_0x1e7def){if(_0x1e7def[_0x1eda('0x2c')]===_0x1eda('0x2d')){_0x1e7def['settingsEnabled']=_0xc0e66a[_0x1eda('0x2e')]['settingsEnabled'];delete _0x1e7def['userProfileId'];}return _0x1e7def;});})['then'](function(_0x129e35){return db[_0x1eda('0x49')][_0x1eda('0x82')](_0x129e35,{'include':[{'model':db[_0x1eda('0x74')],'as':_0x1eda('0x74')}]});})[_0x1eda('0x14')](function(_0x1ef502){if(_0xc0e66a[_0x1eda('0x64')][_0x1eda('0x2c')]===_0x1eda('0x2e'))return _0x1ef502;if(_0xc0e66a['user']['role']!=='user')return _0x1ef502;return db[_0x1eda('0x87')]['find']({'where':{'name':_0x1ef502[_0x1eda('0x2c')]==='agent'?_0x1eda('0x2f'):'Telephones','userProfileId':_0xc0e66a[_0x1eda('0x2e')][_0x1eda('0x88')]},'raw':!![]})['then'](function(_0xa65591){if(!_0xa65591||_0xa65591[_0x1eda('0x89')]!=0x0)return _0x1ef502;return db['UserProfileResource'][_0x1eda('0x82')]({'name':_0x1ef502['name'],'resourceId':_0x1ef502['id'],'type':_0xa65591['name'],'sectionId':_0xa65591['id']},{})['then'](function(){return _0x1ef502;});})[_0x1eda('0x1e')](function(_0x46441b){logger[_0x1eda('0x19')](_0x1eda('0x8a'),_0x46441b);throw _0x46441b;});})[_0x1eda('0x14')](respondWithResult(_0x1445ca,0xc9))[_0x1eda('0x1e')](handleError(_0x1445ca,null));};exports['bulkCreate']=function(_0x3a9095,_0x34b14f){var _0x3627c9=_0x3a9095[_0x1eda('0x64')];var _0x46cdc7=[];if(_0x3a9095[_0x1eda('0x2e')][_0x1eda('0x2c')]===_0x1eda('0x76'))throw new Error('Unauthorized');if(_[_0x1eda('0x8b')](_0x3627c9,[_0x1eda('0x2c'),_0x1eda('0x2e')])&&_0x3a9095[_0x1eda('0x2e')]['role']!=='admin'){throw new Error(_0x1eda('0x84'));}if(_[_0x1eda('0x8b')](_0x3627c9,['role',_0x1eda('0x2d')])&&_0x3a9095[_0x1eda('0x2e')][_0x1eda('0x2c')]!==_0x1eda('0x2d')){throw new Error(_0x1eda('0x8c'));}return licenseUtil['checkUserLimits'](_0x3627c9)[_0x1eda('0x14')](function(){return validateUser(_0x3627c9[0x0]);})[_0x1eda('0x14')](function(){for(var _0x55db7b=0x1;_0x55db7b<_0x3627c9[_0x1eda('0x4d')];_0x55db7b++){var _0x4a7656=_0x3627c9[_0x55db7b-0x1]['internal'];if(!_0x3627c9[_0x55db7b][_0x1eda('0x68')])_0x3627c9[_0x55db7b][_0x1eda('0x68')]=_0x4a7656+0x1;_0x46cdc7[_0x1eda('0x48')](validateUser(_0x3627c9[_0x55db7b]));}return Promise[_0x1eda('0x55')](_0x46cdc7);})[_0x1eda('0x14')](function(){_0x46cdc7=[];for(var _0x592806=0x0;_0x592806<_0x3627c9[_0x1eda('0x4d')];_0x592806++){_0x46cdc7[_0x1eda('0x48')](updateUser(_0x3627c9[_0x592806]));}return Promise['all'](_0x46cdc7);})[_0x1eda('0x14')](function(){_0x46cdc7=_0x3627c9['map'](function(_0x2cb946){return db[_0x1eda('0x49')][_0x1eda('0x82')](_0x2cb946,{'include':[{'model':db['VoiceMail'],'as':_0x1eda('0x74')}]})['then'](function(_0x4db601){_0x2cb946['id']=_0x4db601['id'];return _0x2cb946;});});return Promise[_0x1eda('0x55')](_0x46cdc7);})['then'](function(_0x514e7c){if(_0x3a9095['body'][_0x1eda('0x2c')]===_0x1eda('0x2e'))return _0x514e7c;if(_0x3a9095['user'][_0x1eda('0x2c')]!==_0x1eda('0x2e'))return _0x514e7c;var _0x39287e=_[_0x1eda('0x8b')](_0x514e7c,function(_0x1d88bb){return _0x1d88bb[_0x1eda('0x2c')]===_0x1eda('0x76')||_0x1d88bb['role']===_0x1eda('0x31');});if(!_0x39287e)return _0x514e7c;return db[_0x1eda('0x87')]['findAll']({'where':{'name':{'$or':[_0x1eda('0x2f'),'Telephones']},'userProfileId':_0x3a9095[_0x1eda('0x2e')][_0x1eda('0x88')]},'raw':!![]})[_0x1eda('0x14')](function(_0x51ef51){if(_['isEmpty'](_0x51ef51)||!_[_0x1eda('0x8b')](_0x51ef51,[_0x1eda('0x89'),0x0]))return _0x514e7c;_0x46cdc7=[];var _0x572dff=_(_0x51ef51)[_0x1eda('0x34')](function(_0x34865c){if(_0x34865c[_0x1eda('0x89')]===0x1)return;return _0x34865c['name']===_0x1eda('0x2f')?_0x1eda('0x76'):_0x1eda('0x31');})[_0x1eda('0x8d')]()[_0x1eda('0x35')]();for(var _0x4b84f3=0x0;_0x4b84f3<_0x514e7c[_0x1eda('0x4d')];_0x4b84f3++){if(!_[_0x1eda('0x36')](_0x572dff,_0x514e7c[_0x4b84f3][_0x1eda('0x2c')]))return;var _0x2b8be0=_0x514e7c[_0x4b84f3][_0x1eda('0x2c')]===_0x1eda('0x76')?_0x1eda('0x2f'):_0x1eda('0x30');_0x46cdc7[_0x1eda('0x48')](db['UserProfileResource']['create']({'name':_0x514e7c[_0x4b84f3][_0x1eda('0x37')],'resourceId':_0x514e7c[_0x4b84f3]['id'],'type':_0x2b8be0,'sectionId':_[_0x1eda('0x62')](_0x51ef51,[_0x1eda('0x37'),_0x2b8be0])['id']},{}));}return Promise[_0x1eda('0x55')](_0x46cdc7);});})[_0x1eda('0x14')](respondWithResult(_0x34b14f,0xc9))[_0x1eda('0x1e')](handleError(_0x34b14f,null));};exports['changePassword']=function(_0x410a28,_0x36ee4f){if(_0x410a28[_0x1eda('0x64')]['id']){delete _0x410a28[_0x1eda('0x64')]['id'];}return db[_0x1eda('0x49')]['find']({'where':{'id':_0x410a28[_0x1eda('0x57')]['id']}})[_0x1eda('0x14')](function(_0x2d5cf1){if(!_0x2d5cf1)return null;if(_0x2d5cf1['id']===_0x410a28['user']['id']){if(!_0x410a28['body'][_0x1eda('0x8e')]||!_0x410a28[_0x1eda('0x64')][_0x1eda('0x8f')]){throw new db[(_0x1eda('0x90'))]['ValidationError'](_0x1eda('0x91'));}if(!_0x2d5cf1[_0x1eda('0x92')](_0x410a28[_0x1eda('0x64')][_0x1eda('0x8e')])){throw new db[(_0x1eda('0x90'))][(_0x1eda('0x93'))]('Wrong\x20credentials');}if(_0x410a28[_0x1eda('0x64')][_0x1eda('0x8e')]===_0x410a28['body']['newPassword']){throw new db['Sequelize'][(_0x1eda('0x93'))](_0x1eda('0x94'));}}else if(_0x410a28[_0x1eda('0x2e')][_0x1eda('0x2c')]===_0x1eda('0x2d')){if(!_0x410a28[_0x1eda('0x64')]['newPassword']){throw new db[(_0x1eda('0x90'))][(_0x1eda('0x93'))](_0x1eda('0x95'));}}else if(_0x410a28[_0x1eda('0x2e')][_0x1eda('0x2c')]==='user'){if(!_0x410a28['body'][_0x1eda('0x8f')]){throw new db[(_0x1eda('0x90'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x2d5cf1[_0x1eda('0x2c')]!==_0x1eda('0x76')){throw new db[(_0x1eda('0x90'))][(_0x1eda('0x93'))](_0x1eda('0x83'));}}else{throw new db[(_0x1eda('0x90'))][(_0x1eda('0x93'))](_0x1eda('0x83'));}return _0x2d5cf1;})[_0x1eda('0x14')](handleEntityNotFound(_0x36ee4f,null))[_0x1eda('0x14')](function(_0x1f556f){return db[_0x1eda('0x69')][_0x1eda('0x96')]({'attributes':['id',_0x1eda('0x97'),_0x1eda('0x98'),_0x1eda('0x99')]})[_0x1eda('0x14')](function(_0x11c2d2){if(_0x11c2d2['securePassword'])authService[_0x1eda('0x6a')](_0x410a28[_0x1eda('0x64')][_0x1eda('0x8f')]);if(!_0x11c2d2[_0x1eda('0x98')]||!_0x1f556f[_0x1eda('0x9a')])return _0x1f556f;authService['validatePasswordHistory'](_0x410a28[_0x1eda('0x64')]['newPassword'],_0x1f556f[_0x1eda('0x9a')],_0x11c2d2['passwordHistoryLimit']);return _0x1f556f;})['then'](saveUpdates({'password':_0x410a28['body']['newPassword'],'passwordResetAt':_0x410a28[_0x1eda('0x2e')]['id']==_0x410a28[_0x1eda('0x57')]['id']?moment():null,'previousPasswords':authService[_0x1eda('0x9b')](_0x410a28[_0x1eda('0x64')][_0x1eda('0x8f')],_0x1f556f['previousPasswords'])},null));})[_0x1eda('0x14')](respondWithResult(_0x36ee4f,null))['catch'](handleError(_0x36ee4f,null));};exports[_0x1eda('0x9c')]=function(_0x15f974,_0x3338b9){var _0x2f24a0=_0x15f974[_0x1eda('0x64')]['channel'];return db[_0x1eda('0x49')][_0x1eda('0x62')]({'where':{'id':_0x15f974['params']['id']},'attributes':['id',_0x1eda('0x37'),_0x1eda('0x2c'),_0x1eda('0x9d'),_0x1eda('0x9e'),_0x1eda('0x9f'),'interface']})[_0x1eda('0x14')](handleEntityNotFound(_0x3338b9,null))['then'](function(_0x36f644){if(_0x36f644){if(!utils[_0x1eda('0xa0')](_0x2f24a0)){throw new db[(_0x1eda('0x90'))]['ValidationError'](_0x1eda('0xa1'));}return _0x36f644[_0x1eda('0xa2')+_[_0x1eda('0xa3')](_0x2f24a0[_0x1eda('0xa4')]())+_0x1eda('0xa5')](_0x15f974[_0x1eda('0x64')][_0x1eda('0x67')],{'penalty':_0x15f974[_0x1eda('0x64')][_0x1eda('0xa6')]||0x0})['spread'](function(_0x4095da){for(var _0x73f97e=0x0;_0x73f97e<_0x15f974[_0x1eda('0x64')][_0x1eda('0x67')][_0x1eda('0x4d')];_0x73f97e+=0x1){var _0x2085a3={'UserId':Number(_0x15f974['params']['id'])};_0x2085a3[_[_0x1eda('0xa3')](_0x2f24a0[_0x1eda('0xa4')]())+_0x1eda('0xa7')]=Number(_0x15f974[_0x1eda('0x64')][_0x1eda('0x67')][_0x73f97e]);socket[_0x1eda('0x28')]('user'+_[_0x1eda('0xa3')](_0x2f24a0['toLowerCase']())+_0x1eda('0xa8'),_0x2085a3);}return _0x4095da;})[_0x1eda('0x14')](function(){if(_0x2f24a0===_0x1eda('0xa9')){return db[_0x1eda('0xaa')][_0x1eda('0x4a')]({'where':{'id':_0x15f974['body']['ids']||[]},'raw':!![],'attributes':['id',_0x1eda('0x37')]});}})[_0x1eda('0x14')](function(_0x59a2cc){var _0x10fd5b=_0x36f644['get']({'plain':!![]});var _0x2b5852=[];if(_0x2f24a0===_0x1eda('0xa9')&&_0x10fd5b[_0x1eda('0x2c')]===_0x1eda('0x76')&&_0x10fd5b[_0x1eda('0x9d')]){for(let _0x3eeb58=0x0;_0x3eeb58<_0x59a2cc[_0x1eda('0x4d')];_0x3eeb58+=0x1){_0x2b5852[_0x1eda('0x48')]({'membername':_0x10fd5b['name'],'UserId':_0x10fd5b['id'],'queue_name':_0x59a2cc[_0x3eeb58][_0x1eda('0x37')],'VoiceQueueId':_0x59a2cc[_0x3eeb58]['id'],'interface':_[_0x1eda('0x6c')](_0x10fd5b[_0x1eda('0xab')])?util[_0x1eda('0xac')](_0x1eda('0xad'),_0x10fd5b[_0x1eda('0x37')]):_0x10fd5b[_0x1eda('0xab')],'paused':_0x10fd5b['voicePause']||![],'penalty':_0x15f974[_0x1eda('0x64')][_0x1eda('0xa6')]||0x0});}return Promise['all'](_0x2b5852[_0x1eda('0x34')](function(_0x11f6ab){return db['UserVoiceQueueRt'][_0x1eda('0xae')](_0x11f6ab);}));}return _0x36f644;});}})[_0x1eda('0x14')](respondWithStatusCode(_0x3338b9,null))[_0x1eda('0x1e')](handleError(_0x3338b9,null));};exports[_0x1eda('0xaf')]=function(_0x175ec6,_0x93e4a4){var _0x40ab6f,_0x4b9032;return db[_0x1eda('0x49')][_0x1eda('0x62')]({'where':{'id':_0x175ec6['params']['id']},'attributes':['id',_0x1eda('0x37'),_0x1eda('0x2c')]})['then'](handleEntityNotFound(_0x93e4a4,null))['then'](function(_0x5e0d06){if(_0x5e0d06){_0x40ab6f=_0x5e0d06;if(!_0x175ec6[_0x1eda('0x42')][_0x1eda('0xb0')]||!utils['isValidChannel'](_0x175ec6[_0x1eda('0x42')][_0x1eda('0xb0')])){throw new db[(_0x1eda('0x90'))]['ValidationError']('Unknown\x20channel');}return _0x5e0d06[_0x1eda('0xb1')+_[_0x1eda('0xa3')](_0x175ec6['query'][_0x1eda('0xb0')][_0x1eda('0xa4')]())+'Queues'](_0x175ec6[_0x1eda('0x42')]['ids']);}})[_0x1eda('0x14')](function(_0x521e4a){if(_[_0x1eda('0xb2')](_0x175ec6[_0x1eda('0x42')]['ids'])){for(var _0x2496a0=0x0;_0x2496a0<_0x175ec6[_0x1eda('0x42')][_0x1eda('0x67')][_0x1eda('0x4d')];_0x2496a0+=0x1){_0x4b9032={'UserId':Number(_0x175ec6[_0x1eda('0x57')]['id'])};_0x4b9032[_[_0x1eda('0xa3')](_0x175ec6['query'][_0x1eda('0xb0')][_0x1eda('0xa4')]())+_0x1eda('0xa7')]=Number(_0x175ec6[_0x1eda('0x42')]['ids'][_0x2496a0]);socket[_0x1eda('0x28')](_0x1eda('0x2e')+_['capitalize'](_0x175ec6[_0x1eda('0x42')]['channel'][_0x1eda('0xa4')]())+_0x1eda('0xb3'),_0x4b9032);}}else{_0x4b9032={'UserId':Number(_0x175ec6['params']['id'])};_0x4b9032[_[_0x1eda('0xa3')](_0x175ec6[_0x1eda('0x42')][_0x1eda('0xb0')][_0x1eda('0xa4')]())+_0x1eda('0xa7')]=Number(_0x175ec6['query'][_0x1eda('0x67')]);socket[_0x1eda('0x28')](_0x1eda('0x2e')+_['capitalize'](_0x175ec6['query']['channel']['toLowerCase']())+_0x1eda('0xb3'),_0x4b9032);}return _0x521e4a;})[_0x1eda('0x14')](function(){if(_0x175ec6[_0x1eda('0x42')][_0x1eda('0xb0')]===_0x1eda('0xa9')){return db[_0x1eda('0xb4')][_0x1eda('0x2a')]({'where':{'UserId':_0x175ec6['params']['id'],'VoiceQueueId':_0x175ec6[_0x1eda('0x42')][_0x1eda('0x67')]},'individualHooks':!![]})[_0x1eda('0x14')](function(){return _0x40ab6f;});}return _0x40ab6f;})[_0x1eda('0x14')](respondWithStatusCode(_0x93e4a4,null))[_0x1eda('0x1e')](handleError(_0x93e4a4,null));};exports[_0x1eda('0xb5')]=function(_0x22ed33,_0x1da2e1){_0x22ed33[_0x1eda('0x64')][_0x1eda('0xb6')]=_0x22ed33[_0x1eda('0xb7')][_0x1eda('0xb8')];return db[_0x1eda('0x49')][_0x1eda('0x62')]({'where':{'id':_0x22ed33[_0x1eda('0x57')]['id']}})[_0x1eda('0x14')](handleEntityNotFound(_0x1da2e1,null))['then'](saveUpdates(_0x22ed33[_0x1eda('0x64')],null))[_0x1eda('0x14')](respondWithResult(_0x1da2e1,null))[_0x1eda('0x1e')](handleError(_0x1da2e1,null));};exports[_0x1eda('0xb9')]=function(_0xd3d7ae,_0x6f3fce){var _0xd33673=path['join'](config[_0x1eda('0xba')],_0x1eda('0xbb'));return db[_0x1eda('0x49')][_0x1eda('0x62')]({'where':{'id':_0xd3d7ae[_0x1eda('0x57')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x6f3fce,null))[_0x1eda('0x14')](function(_0x4fcd50){if(_0x4fcd50){if(_['isNil'](_0x4fcd50[_0x1eda('0xb6')])){return _0x6f3fce[_0x1eda('0xbc')](_0xd33673);}else{if(!fs['existsSync'](path['join'](config[_0x1eda('0xba')],_0x1eda('0xbd'),_0x4fcd50['userpic']))){return _0x6f3fce[_0x1eda('0xbc')](_0xd33673);}return _0x6f3fce['download'](path[_0x1eda('0xbe')](config['root'],_0x1eda('0xbd'),_0x4fcd50[_0x1eda('0xb6')]));}}})[_0x1eda('0x1e')](handleError(_0x6f3fce,null));};exports[_0x1eda('0xbf')]=function(_0x505bd7,_0x237d1b){return db[_0x1eda('0x49')][_0x1eda('0x62')]({'where':{'id':_0x505bd7[_0x1eda('0x57')]['id']},'attributes':['id']})[_0x1eda('0x14')](handleEntityNotFound(_0x237d1b,null))[_0x1eda('0x14')](function(_0x75b612){var _0x1fbd3f=[];values=_0x75b612[_0x1eda('0x4f')];_0x1fbd3f[_0x1eda('0x48')](get_open_tabs(_0x1eda('0x4e'),_0x75b612[_0x1eda('0x4f')]));_0x1fbd3f[_0x1eda('0x48')](get_open_tabs(_0x1eda('0x50'),_0x75b612['dataValues']));_0x1fbd3f[_0x1eda('0x48')](get_open_tabs('openchannel',_0x75b612[_0x1eda('0x4f')]));_0x1fbd3f[_0x1eda('0x48')](get_open_tabs(_0x1eda('0x54'),_0x75b612['dataValues']));_0x1fbd3f[_0x1eda('0x48')](get_open_tabs(_0x1eda('0x51'),_0x75b612[_0x1eda('0x4f')]));_0x1fbd3f[_0x1eda('0x48')](get_open_tabs('mail',_0x75b612['dataValues']));return Promise[_0x1eda('0x55')](_0x1fbd3f);})[_0x1eda('0x14')](function(_0x28eff2){if(_0x28eff2){var _0x3513d8=_['map'](values['ChatOpenTabs'],function(_0x79b0a0){return{'channel':_0x1eda('0xc0'),'id':_0x79b0a0['id'],'createdAt':_0x79b0a0[_0x1eda('0xc1')]};});var _0x595332=_[_0x1eda('0x34')](values[_0x1eda('0xc2')],function(_0xa3d5c2){return{'channel':_0x1eda('0xc3'),'id':_0xa3d5c2['id'],'createdAt':_0xa3d5c2[_0x1eda('0xc1')]};});var _0x42840d=_['map'](values[_0x1eda('0xc4')],function(_0x5c89e2){return{'channel':_0x1eda('0xc5'),'id':_0x5c89e2['id'],'createdAt':_0x5c89e2[_0x1eda('0xc1')]};});var _0x1ea0f2=_[_0x1eda('0x34')](values[_0x1eda('0xc6')],function(_0x287ca1){return{'channel':_0x1eda('0xc7'),'id':_0x287ca1['id'],'createdAt':_0x287ca1[_0x1eda('0xc1')]};});var _0x41df76=_[_0x1eda('0x34')](values[_0x1eda('0xc8')],function(_0x100439){return{'channel':_0x1eda('0xc9'),'id':_0x100439['id'],'createdAt':_0x100439[_0x1eda('0xc1')]};});var _0x5d9c95=_[_0x1eda('0x34')](values[_0x1eda('0xca')],function(_0x3c5301){return{'channel':_0x1eda('0xcb'),'id':_0x3c5301['id'],'createdAt':_0x3c5301[_0x1eda('0xc1')]};});var _0x5b3328=_[_0x1eda('0xcc')](_0x3513d8,_0x595332,_0x42840d,_0x1ea0f2,_0x41df76,_0x5d9c95);var _0x342ba5={'count':_0x5b3328[_0x1eda('0x4d')],'rows':_0x5b3328};return _0x342ba5;}else return null;})['then'](respondWithResult(_0x237d1b,null))[_0x1eda('0x1e')](handleError(_0x237d1b,null));};exports['getContacts']=function(_0x3a5037,_0x489bb4){var _0x4cfae1={};return db[_0x1eda('0x49')][_0x1eda('0x96')]({'where':{'id':_0x3a5037[_0x1eda('0x57')]['id']}})[_0x1eda('0x14')](function(_0xf20461){if(!_0xf20461){throw new APINotFoundError(util[_0x1eda('0xac')](_0x1eda('0xcd'),_0x3a5037['params']['id']));}return contacts[_0x1eda('0x65')]();})[_0x1eda('0x14')](function(_0x3d51f2){_0x3a5037[_0x1eda('0x42')]['User']=_0x3a5037[_0x1eda('0x57')]['id'];_0x4cfae1=qs['getOptions'](_0x3d51f2,_0x3a5037);if(_0x3a5037[_0x1eda('0x42')]['hasOwnProperty'](_0x1eda('0x43'))){_0x4cfae1[_0x1eda('0x44')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db[_0x1eda('0xce')],'as':_0x1eda('0xcf'),'attributes':['id',_0x1eda('0x37'),_0x1eda('0xd0')],'where':_0x3a5037[_0x1eda('0x42')][_0x1eda('0xd1')]?{'id':_0x3a5037[_0x1eda('0x42')][_0x1eda('0xd1')]}:undefined,'required':_0x3a5037['query'][_0x1eda('0xd1')]?!![]:![]}];}return contacts['findAll'](_0x3a5037['query'],_0x3a5037[_0x1eda('0x2e')],_0x4cfae1,_0x3d51f2);})[_0x1eda('0x14')](respondWithFilteredResult(_0x489bb4,_0x4cfae1))[_0x1eda('0x1e')](APIHandleError(_0x489bb4));};exports[_0x1eda('0xd2')]=function(_0xca6344,_0x434f4b){var _0x1965e2;var _0x34dfee={};var _0x4bbbda;return db[_0x1eda('0x49')][_0x1eda('0x96')]({'where':{'id':_0xca6344['params']['id']},'attributes':['id',_0x1eda('0x37'),'role']})[_0x1eda('0x14')](handleEntityNotFound(_0x434f4b,null))['then'](function(_0x5d5bd9){if(!utils[_0x1eda('0xa0')](_0xca6344['query']['channel'])){throw new db['Sequelize'][(_0x1eda('0x93'))](_0x1eda('0xa1'));}_0x1965e2=_0x5d5bd9;var _0x10a7ca={};_0x10a7ca[_0x1eda('0x5d')]=_['keys'](db[_['capitalize'](_0xca6344[_0x1eda('0x42')][_0x1eda('0xb0')])+_0x1eda('0xd3')][_0x1eda('0x3c')]);_0x10a7ca[_0x1eda('0x42')]=_['keys'](_0xca6344[_0x1eda('0x42')]);_0x10a7ca['filters']=_[_0x1eda('0x5c')](_0x10a7ca[_0x1eda('0x5d')],_0x10a7ca[_0x1eda('0x42')]);_0x34dfee['attributes']=_[_0x1eda('0x5c')](_0x10a7ca[_0x1eda('0x5d')],qs[_0x1eda('0x5e')](_0xca6344[_0x1eda('0x42')][_0x1eda('0x5e')]));_0x34dfee[_0x1eda('0x47')]=_0x34dfee[_0x1eda('0x47')][_0x1eda('0x4d')]?_0x34dfee[_0x1eda('0x47')]:_0x10a7ca[_0x1eda('0x5d')];_0x34dfee['order']=qs[_0x1eda('0xd4')](_0xca6344[_0x1eda('0x42')][_0x1eda('0xd4')]);_0x34dfee['where']=qs[_0x1eda('0x5b')](_[_0x1eda('0xd5')](_0xca6344[_0x1eda('0x42')],_0x10a7ca[_0x1eda('0x5b')]));if(_0xca6344[_0x1eda('0x42')][_0x1eda('0x32')]){_0x34dfee[_0x1eda('0x41')]=_[_0x1eda('0x60')](_0x34dfee['where'],{'$or':_[_0x1eda('0x34')](_0x34dfee['attributes'],function(_0x451dee){var _0x98bc25={};_0x98bc25[_0x451dee]={'$like':'%'+_0xca6344['query'][_0x1eda('0x32')]+'%'};return _0x98bc25;})});}_0x34dfee=_['merge']({},_0x34dfee,_0xca6344['options']);switch(_0x1965e2[_0x1eda('0x2c')]){case _0x1eda('0x2d'):return db[_[_0x1eda('0xa3')](_0xca6344[_0x1eda('0x42')][_0x1eda('0xb0')])+_0x1eda('0xd3')]['findAll'](_0x34dfee);case _0x1eda('0x2e'):case _0x1eda('0x76'):return _0x1965e2['get'+_[_0x1eda('0xa3')](_0xca6344['query'][_0x1eda('0xb0')])+_0x1eda('0xa5')](_0x34dfee);default:throw new db[(_0x1eda('0x90'))][(_0x1eda('0x93'))]('Unknown\x20role');}})['then'](function(_0x374830){_0x4bbbda=_0x374830['length'];if(!_0xca6344[_0x1eda('0x42')]['hasOwnProperty'](_0x1eda('0xd6'))){_0x34dfee['limit']=qs[_0x1eda('0x24')](_0xca6344[_0x1eda('0x42')][_0x1eda('0x24')]);_0x34dfee[_0x1eda('0x23')]=qs[_0x1eda('0x23')](_0xca6344['query'][_0x1eda('0x23')]);}switch(_0x1965e2[_0x1eda('0x2c')]){case _0x1eda('0x2d'):return db[_[_0x1eda('0xa3')](_0xca6344['query'][_0x1eda('0xb0')])+_0x1eda('0xd3')][_0x1eda('0x4a')](_0x34dfee);case _0x1eda('0x2e'):case _0x1eda('0x76'):return _0x1965e2['get'+_[_0x1eda('0xa3')](_0xca6344['query'][_0x1eda('0xb0')])+_0x1eda('0xa5')](_0x34dfee);}})[_0x1eda('0x14')](function(_0x81290){return{'count':_0x4bbbda,'rows':_0x81290};})[_0x1eda('0x14')](respondWithResult(_0x434f4b,null))[_0x1eda('0x1e')](handleError(_0x434f4b,null));};exports[_0x1eda('0xd7')]=function(_0x5cb3b7,_0x481123){var _0x56ecce={};var _0x401970={};var _0x5efee9;var _0xe47e69;return db['User'][_0x1eda('0x96')]({'where':{'id':_0x5cb3b7[_0x1eda('0x57')]['id']}})['then'](handleEntityNotFound(_0x481123,null))[_0x1eda('0x14')](function(_0x1475a4){if(_0x1475a4){_0x5efee9=_0x1475a4;_0x401970['model']=_[_0x1eda('0x59')](db['UserVoiceQueueRt'][_0x1eda('0x3c')]);_0x401970[_0x1eda('0x42')]=_['keys'](_0x5cb3b7[_0x1eda('0x42')]);_0x401970[_0x1eda('0x5b')]=_['intersection'](_0x401970['model'],_0x401970[_0x1eda('0x42')]);_0x56ecce[_0x1eda('0x47')]=_[_0x1eda('0x5c')](_0x401970[_0x1eda('0x5d')],qs[_0x1eda('0x5e')](_0x5cb3b7['query'][_0x1eda('0x5e')]));_0x56ecce[_0x1eda('0x47')]=_0x56ecce[_0x1eda('0x47')][_0x1eda('0x4d')]?_0x56ecce['attributes']:_0x401970[_0x1eda('0x5d')];_0x56ecce[_0x1eda('0xd8')]=qs[_0x1eda('0xd4')](_0x5cb3b7[_0x1eda('0x42')][_0x1eda('0xd4')]);_0x56ecce[_0x1eda('0x41')]=qs[_0x1eda('0x5b')](_[_0x1eda('0xd5')](_0x5cb3b7[_0x1eda('0x42')],_0x401970[_0x1eda('0x5b')]));if(_0x5cb3b7['query'][_0x1eda('0x32')]){_0x56ecce[_0x1eda('0x41')]=_[_0x1eda('0x60')](_0x56ecce[_0x1eda('0x41')],{'$or':_[_0x1eda('0x34')](_0x56ecce[_0x1eda('0x47')],function(_0x4d84a9){var _0x4d251b={};_0x4d251b[_0x4d84a9]={'$like':'%'+_0x5cb3b7[_0x1eda('0x42')][_0x1eda('0x32')]+'%'};return _0x4d251b;})});}_0x56ecce=_[_0x1eda('0x60')]({},_0x56ecce,_0x5cb3b7[_0x1eda('0x61')]);return _0x5efee9[_0x1eda('0xd7')](_0x56ecce);}})['then'](function(_0x11766b){if(_0x11766b){_0xe47e69=_0x11766b['length'];if(!_0x5cb3b7['query']['hasOwnProperty'](_0x1eda('0xd6'))){_0x56ecce[_0x1eda('0x24')]=qs[_0x1eda('0x24')](_0x5cb3b7[_0x1eda('0x42')][_0x1eda('0x24')]);_0x56ecce[_0x1eda('0x23')]=qs[_0x1eda('0x23')](_0x5cb3b7[_0x1eda('0x42')][_0x1eda('0x23')]);}return _0x5efee9['getVoiceQueuesRt'](_0x56ecce);}})['then'](function(_0x52fb49){if(_0x52fb49){return _0x52fb49?{'count':_0xe47e69,'rows':_0x52fb49}:null;}})[_0x1eda('0x14')](respondWithResult(_0x481123,null))[_0x1eda('0x1e')](handleError(_0x481123,null));};exports['getGroups']=function(_0x3aca00,_0x52f439){var _0x3a19fc={};var _0xb6f5eb={};var _0x23227e;var _0x21d347;return db[_0x1eda('0x49')][_0x1eda('0x96')]({'where':{'id':_0x3aca00[_0x1eda('0x57')]['id']}})[_0x1eda('0x14')](handleEntityNotFound(_0x52f439,null))[_0x1eda('0x14')](function(_0x4042a2){if(_0x4042a2){_0x23227e=_0x4042a2;_0xb6f5eb['model']=_[_0x1eda('0x59')](db[_0x1eda('0xd9')][_0x1eda('0x3c')]);_0xb6f5eb[_0x1eda('0x42')]=_[_0x1eda('0x59')](_0x3aca00[_0x1eda('0x42')]);_0xb6f5eb['filters']=_[_0x1eda('0x5c')](_0xb6f5eb[_0x1eda('0x5d')],_0xb6f5eb[_0x1eda('0x42')]);_0x3a19fc[_0x1eda('0x47')]=_[_0x1eda('0x5c')](_0xb6f5eb[_0x1eda('0x5d')],qs[_0x1eda('0x5e')](_0x3aca00[_0x1eda('0x42')][_0x1eda('0x5e')]));_0x3a19fc[_0x1eda('0x47')]=_0x3a19fc[_0x1eda('0x47')][_0x1eda('0x4d')]?_0x3a19fc[_0x1eda('0x47')]:_0xb6f5eb[_0x1eda('0x5d')];_0x3a19fc[_0x1eda('0xd8')]=qs[_0x1eda('0xd4')](_0x3aca00[_0x1eda('0x42')][_0x1eda('0xd4')]);_0x3a19fc[_0x1eda('0x41')]=qs['filters'](_[_0x1eda('0xd5')](_0x3aca00[_0x1eda('0x42')],_0xb6f5eb['filters']));if(_0x3aca00['query'][_0x1eda('0x32')]){_0x3a19fc[_0x1eda('0x41')]=_['merge'](_0x3a19fc[_0x1eda('0x41')],{'$or':_[_0x1eda('0x34')](_0x3a19fc['attributes'],function(_0x472c3e){var _0x2c21cb={};_0x2c21cb[_0x472c3e]={'$like':'%'+_0x3aca00[_0x1eda('0x42')]['filter']+'%'};return _0x2c21cb;})});}_0x3a19fc=_['merge']({},_0x3a19fc,_0x3aca00[_0x1eda('0x61')]);return _0x23227e[_0x1eda('0xda')](_0x3a19fc);}})[_0x1eda('0x14')](function(_0x2838f3){if(_0x2838f3){_0x21d347=_0x2838f3[_0x1eda('0x4d')];if(!_0x3aca00['query'][_0x1eda('0xdb')](_0x1eda('0xd6'))){_0x3a19fc[_0x1eda('0x24')]=qs['limit'](_0x3aca00['query'][_0x1eda('0x24')]);_0x3a19fc[_0x1eda('0x23')]=qs[_0x1eda('0x23')](_0x3aca00[_0x1eda('0x42')]['offset']);}return _0x23227e[_0x1eda('0xda')](_0x3a19fc);}})[_0x1eda('0x14')](function(_0x269a79){if(_0x269a79){return _0x269a79?{'count':_0x21d347,'rows':_0x269a79}:null;}})['then'](respondWithResult(_0x52f439,null))['catch'](handleError(_0x52f439,null));};exports[_0x1eda('0xdc')]=function(_0x1b6ff1,_0x302e1c){var _0x29c5b2={'raw':!![],'where':{}};var _0x3b2169={};var _0x5cf4c8={'count':0x0,'rows':[]};return db[_0x1eda('0x49')][_0x1eda('0x96')]({'where':{'id':_0x1b6ff1[_0x1eda('0x57')]['id']}})[_0x1eda('0x14')](handleEntityNotFound(_0x302e1c,null))['then'](function(_0x521d7e){if(_0x521d7e){_0x3b2169[_0x1eda('0x5d')]=_['keys'](db[_0x1eda('0xdd')][_0x1eda('0x3c')]);_0x3b2169['query']=_['keys'](_0x1b6ff1[_0x1eda('0x42')]);_0x3b2169[_0x1eda('0x5b')]=_['intersection'](_0x3b2169[_0x1eda('0x5d')],_0x3b2169[_0x1eda('0x42')]);_0x29c5b2[_0x1eda('0x47')]=_['intersection'](_0x3b2169[_0x1eda('0x5d')],qs[_0x1eda('0x5e')](_0x1b6ff1[_0x1eda('0x42')][_0x1eda('0x5e')]));_0x29c5b2['attributes']=_0x29c5b2[_0x1eda('0x47')]['length']?_0x29c5b2[_0x1eda('0x47')]:_0x3b2169[_0x1eda('0x5d')];if(!_0x1b6ff1[_0x1eda('0x42')][_0x1eda('0xdb')](_0x1eda('0xd6'))){_0x29c5b2[_0x1eda('0x24')]=qs[_0x1eda('0x24')](_0x1b6ff1[_0x1eda('0x42')][_0x1eda('0x24')]);_0x29c5b2[_0x1eda('0x23')]=qs[_0x1eda('0x23')](_0x1b6ff1[_0x1eda('0x42')][_0x1eda('0x23')]);}_0x29c5b2['order']=qs[_0x1eda('0xd4')](_0x1b6ff1[_0x1eda('0x42')][_0x1eda('0xd4')]);_0x29c5b2[_0x1eda('0x41')]=qs[_0x1eda('0x5b')](_[_0x1eda('0xd5')](_0x1b6ff1[_0x1eda('0x42')],_0x3b2169[_0x1eda('0x5b')]));_0x29c5b2[_0x1eda('0x41')]['UserId']=_0x521d7e['id'];if(_0x1b6ff1['query'][_0x1eda('0x32')]){_0x29c5b2[_0x1eda('0x41')]=_[_0x1eda('0x60')](_0x29c5b2[_0x1eda('0x41')],{'$or':_[_0x1eda('0x34')](_0x29c5b2[_0x1eda('0x47')],function(_0x32a0d7){var _0x1d2d87={};_0x1d2d87[_0x32a0d7]={'$like':'%'+_0x1b6ff1[_0x1eda('0x42')][_0x1eda('0x32')]+'%'};return _0x1d2d87;})});}_0x29c5b2=_[_0x1eda('0x60')]({},_0x29c5b2,_0x1b6ff1[_0x1eda('0x61')]);return db[_0x1eda('0xdd')]['count']({'where':_0x29c5b2[_0x1eda('0x41')]})['then'](function(_0x16ffdb){_0x5cf4c8[_0x1eda('0x25')]=_0x16ffdb;if(_0x1b6ff1[_0x1eda('0x42')][_0x1eda('0x43')]){_0x29c5b2[_0x1eda('0x44')]=[{'all':!![]}];}return db[_0x1eda('0xdd')][_0x1eda('0x4a')](_0x29c5b2);})[_0x1eda('0x14')](function(_0x34d6c5){_0x5cf4c8['rows']=_0x34d6c5;return _0x5cf4c8;});}})[_0x1eda('0x14')](respondWithFilteredResult(_0x302e1c,_0x29c5b2))['catch'](handleError(_0x302e1c,null));};exports['getScreenRecordings']=function(_0x3c9c32,_0x4c3ffc){var _0x2e3f42={'raw':!![],'where':{}};var _0x4f5a8a={};var _0xc26c0={'count':0x0,'rows':[]};return db[_0x1eda('0x49')][_0x1eda('0x96')]({'where':{'id':_0x3c9c32[_0x1eda('0x57')]['id']}})[_0x1eda('0x14')](handleEntityNotFound(_0x4c3ffc,null))['then'](function(_0x1d3456){if(_0x1d3456){_0x4f5a8a['model']=_[_0x1eda('0x59')](db['ScreenRecording'][_0x1eda('0x3c')]);_0x4f5a8a[_0x1eda('0x42')]=_[_0x1eda('0x59')](_0x3c9c32['query']);_0x4f5a8a[_0x1eda('0x5b')]=_[_0x1eda('0x5c')](_0x4f5a8a[_0x1eda('0x5d')],_0x4f5a8a[_0x1eda('0x42')]);_0x2e3f42['attributes']=_['intersection'](_0x4f5a8a[_0x1eda('0x5d')],qs['fields'](_0x3c9c32[_0x1eda('0x42')][_0x1eda('0x5e')]));_0x2e3f42[_0x1eda('0x47')]=_0x2e3f42[_0x1eda('0x47')][_0x1eda('0x4d')]?_0x2e3f42[_0x1eda('0x47')]:_0x4f5a8a['model'];if(!_0x3c9c32['query'][_0x1eda('0xdb')](_0x1eda('0xd6'))){_0x2e3f42['limit']=qs[_0x1eda('0x24')](_0x3c9c32['query']['limit']);_0x2e3f42[_0x1eda('0x23')]=qs[_0x1eda('0x23')](_0x3c9c32['query']['offset']);}_0x2e3f42['order']=qs[_0x1eda('0xd4')](_0x3c9c32[_0x1eda('0x42')][_0x1eda('0xd4')]);_0x2e3f42[_0x1eda('0x41')]=qs['filters'](_[_0x1eda('0xd5')](_0x3c9c32[_0x1eda('0x42')],_0x4f5a8a[_0x1eda('0x5b')]));_0x2e3f42[_0x1eda('0x41')]['UserId']=_0x1d3456['id'];if(_0x3c9c32['query'][_0x1eda('0x32')]){_0x2e3f42[_0x1eda('0x41')]=_[_0x1eda('0x60')](_0x2e3f42[_0x1eda('0x41')],{'$or':_[_0x1eda('0x34')](_0x2e3f42[_0x1eda('0x47')],function(_0x1a8d32){var _0x55ee99={};_0x55ee99[_0x1a8d32]={'$like':'%'+_0x3c9c32[_0x1eda('0x42')]['filter']+'%'};return _0x55ee99;})});}_0x2e3f42=_[_0x1eda('0x60')]({},_0x2e3f42,_0x3c9c32[_0x1eda('0x61')]);return db['ScreenRecording'][_0x1eda('0x25')]({'where':_0x2e3f42[_0x1eda('0x41')]})[_0x1eda('0x14')](function(_0x5efd75){_0xc26c0[_0x1eda('0x25')]=_0x5efd75;if(_0x3c9c32[_0x1eda('0x42')][_0x1eda('0x43')]){_0x2e3f42[_0x1eda('0x44')]=[{'all':!![]}];}return db[_0x1eda('0xde')][_0x1eda('0x4a')](_0x2e3f42);})[_0x1eda('0x14')](function(_0x46f58d){_0xc26c0['rows']=_0x46f58d;return _0xc26c0;});}})[_0x1eda('0x14')](respondWithFilteredResult(_0x4c3ffc,_0x2e3f42))[_0x1eda('0x1e')](handleError(_0x4c3ffc,null));};exports['getChatInteractions']=function(_0x613428,_0x728733){var _0x5980ab={};var _0x1056ad={};var _0x36a549;var _0x38c403;return db[_0x1eda('0x49')]['findOne']({'where':{'id':_0x613428[_0x1eda('0x57')]['id']}})[_0x1eda('0x14')](handleEntityNotFound(_0x728733,null))[_0x1eda('0x14')](function(_0x7d7c2){if(_0x7d7c2){_0x36a549=_0x7d7c2;_0x1056ad[_0x1eda('0x5d')]=_[_0x1eda('0x59')](db[_0x1eda('0xdf')][_0x1eda('0x3c')]);_0x1056ad[_0x1eda('0x42')]=_['keys'](_0x613428[_0x1eda('0x42')]);_0x1056ad[_0x1eda('0x5b')]=_[_0x1eda('0x5c')](_0x1056ad[_0x1eda('0x5d')],_0x1056ad[_0x1eda('0x42')]);_0x5980ab['attributes']=_[_0x1eda('0x5c')](_0x1056ad[_0x1eda('0x5d')],qs[_0x1eda('0x5e')](_0x613428['query'][_0x1eda('0x5e')]));_0x5980ab['attributes']=_0x5980ab[_0x1eda('0x47')][_0x1eda('0x4d')]?_0x5980ab[_0x1eda('0x47')]:_0x1056ad['model'];_0x5980ab[_0x1eda('0xd8')]=qs['sort'](_0x613428['query'][_0x1eda('0xd4')]);_0x5980ab['where']=qs['filters'](_['pick'](_0x613428['query'],_0x1056ad[_0x1eda('0x5b')]));if(_0x613428[_0x1eda('0x42')][_0x1eda('0x32')]){_0x5980ab[_0x1eda('0x41')]=_[_0x1eda('0x60')](_0x5980ab[_0x1eda('0x41')],{'$or':_[_0x1eda('0x34')](_0x5980ab[_0x1eda('0x47')],function(_0xa48c70){var _0x1fd5e5={};_0x1fd5e5[_0xa48c70]={'$like':'%'+_0x613428['query'][_0x1eda('0x32')]+'%'};return _0x1fd5e5;})});}_0x5980ab=_[_0x1eda('0x60')]({},_0x5980ab,_0x613428['options']);return _0x36a549[_0x1eda('0xe0')](_0x5980ab);}})['then'](function(_0x41ea2a){if(_0x41ea2a){_0x38c403=_0x41ea2a[_0x1eda('0x4d')];if(!_0x613428['query']['hasOwnProperty']('nolimit')){_0x5980ab[_0x1eda('0x24')]=qs[_0x1eda('0x24')](_0x613428[_0x1eda('0x42')][_0x1eda('0x24')]);_0x5980ab[_0x1eda('0x23')]=qs[_0x1eda('0x23')](_0x613428[_0x1eda('0x42')][_0x1eda('0x23')]);}return _0x36a549[_0x1eda('0xe0')](_0x5980ab);}})[_0x1eda('0x14')](function(_0x326f43){if(_0x326f43){return _0x326f43?{'count':_0x38c403,'rows':_0x326f43}:null;}})['then'](respondWithResult(_0x728733,null))[_0x1eda('0x1e')](handleError(_0x728733,null));};exports[_0x1eda('0xe1')]=function(_0x1ccc3d,_0x12efee){var _0x1325cf={};var _0x1cffda={};var _0x30c775;var _0x262979;return db[_0x1eda('0x49')][_0x1eda('0x96')]({'where':{'id':_0x1ccc3d[_0x1eda('0x57')]['id']}})['then'](handleEntityNotFound(_0x12efee,null))['then'](function(_0x48d464){if(_0x48d464){_0x30c775=_0x48d464;_0x1cffda['model']=_[_0x1eda('0x59')](db[_0x1eda('0xe2')][_0x1eda('0x3c')]);_0x1cffda[_0x1eda('0x42')]=_[_0x1eda('0x59')](_0x1ccc3d[_0x1eda('0x42')]);_0x1cffda[_0x1eda('0x5b')]=_[_0x1eda('0x5c')](_0x1cffda[_0x1eda('0x5d')],_0x1cffda[_0x1eda('0x42')]);_0x1325cf[_0x1eda('0x47')]=_['intersection'](_0x1cffda[_0x1eda('0x5d')],qs[_0x1eda('0x5e')](_0x1ccc3d[_0x1eda('0x42')][_0x1eda('0x5e')]));_0x1325cf[_0x1eda('0x47')]=_0x1325cf['attributes'][_0x1eda('0x4d')]?_0x1325cf[_0x1eda('0x47')]:_0x1cffda[_0x1eda('0x5d')];_0x1325cf[_0x1eda('0xd8')]=qs[_0x1eda('0xd4')](_0x1ccc3d[_0x1eda('0x42')][_0x1eda('0xd4')]);_0x1325cf[_0x1eda('0x41')]=qs[_0x1eda('0x5b')](_[_0x1eda('0xd5')](_0x1ccc3d[_0x1eda('0x42')],_0x1cffda['filters']));if(_0x1ccc3d[_0x1eda('0x42')][_0x1eda('0x32')]){_0x1325cf['where']=_[_0x1eda('0x60')](_0x1325cf['where'],{'$or':_[_0x1eda('0x34')](_0x1325cf[_0x1eda('0x47')],function(_0x11ec57){var _0x24e59e={};_0x24e59e[_0x11ec57]={'$like':'%'+_0x1ccc3d[_0x1eda('0x42')][_0x1eda('0x32')]+'%'};return _0x24e59e;})});}_0x1325cf=_['merge']({},_0x1325cf,_0x1ccc3d[_0x1eda('0x61')]);return _0x30c775[_0x1eda('0xe1')](_0x1325cf);}})[_0x1eda('0x14')](function(_0x1752f5){if(_0x1752f5){_0x262979=_0x1752f5[_0x1eda('0x4d')];if(!_0x1ccc3d[_0x1eda('0x42')][_0x1eda('0xdb')](_0x1eda('0xd6'))){_0x1325cf[_0x1eda('0x24')]=qs[_0x1eda('0x24')](_0x1ccc3d[_0x1eda('0x42')][_0x1eda('0x24')]);_0x1325cf[_0x1eda('0x23')]=qs['offset'](_0x1ccc3d[_0x1eda('0x42')][_0x1eda('0x23')]);}return _0x30c775[_0x1eda('0xe1')](_0x1325cf);}})[_0x1eda('0x14')](function(_0x6271f6){if(_0x6271f6){return _0x6271f6?{'count':_0x262979,'rows':_0x6271f6}:null;}})[_0x1eda('0x14')](respondWithResult(_0x12efee,null))[_0x1eda('0x1e')](handleError(_0x12efee,null));};exports[_0x1eda('0xe3')]=function(_0x513b3d,_0x1a167c){var _0x3aa0d8={'raw':!![],'where':{}};var _0x2d7277={};var _0xb9bd03={'count':0x0,'rows':[]};return db[_0x1eda('0x49')][_0x1eda('0x96')]({'where':{'id':_0x513b3d[_0x1eda('0x57')]['id']}})['then'](handleEntityNotFound(_0x1a167c,null))[_0x1eda('0x14')](function(_0x19cc0f){if(_0x19cc0f){_0x2d7277['model']=_[_0x1eda('0x59')](db[_0x1eda('0xe4')][_0x1eda('0x3c')]);_0x2d7277['query']=_[_0x1eda('0x59')](_0x513b3d['query']);_0x2d7277[_0x1eda('0x5b')]=_[_0x1eda('0x5c')](_0x2d7277[_0x1eda('0x5d')],_0x2d7277[_0x1eda('0x42')]);_0x3aa0d8['attributes']=_['intersection'](_0x2d7277['model'],qs['fields'](_0x513b3d['query']['fields']));_0x3aa0d8[_0x1eda('0x47')]=_0x3aa0d8['attributes'][_0x1eda('0x4d')]?_0x3aa0d8[_0x1eda('0x47')]:_0x2d7277[_0x1eda('0x5d')];if(!_0x513b3d[_0x1eda('0x42')][_0x1eda('0xdb')](_0x1eda('0xd6'))){_0x3aa0d8[_0x1eda('0x24')]=qs['limit'](_0x513b3d['query'][_0x1eda('0x24')]);_0x3aa0d8[_0x1eda('0x23')]=qs[_0x1eda('0x23')](_0x513b3d[_0x1eda('0x42')][_0x1eda('0x23')]);}_0x3aa0d8['order']=qs[_0x1eda('0xd4')](_0x513b3d['query'][_0x1eda('0xd4')]);_0x3aa0d8[_0x1eda('0x41')]=qs[_0x1eda('0x5b')](_['pick'](_0x513b3d['query'],_0x2d7277['filters']));_0x3aa0d8[_0x1eda('0x41')]['UserId']=_0x19cc0f['id'];if(_0x513b3d['query'][_0x1eda('0x32')]){_0x3aa0d8[_0x1eda('0x41')]=_[_0x1eda('0x60')](_0x3aa0d8['where'],{'$or':_['map'](_0x3aa0d8['attributes'],function(_0x28cecf){var _0x419913={};_0x419913[_0x28cecf]={'$like':'%'+_0x513b3d[_0x1eda('0x42')][_0x1eda('0x32')]+'%'};return _0x419913;})});}_0x3aa0d8=_['merge']({},_0x3aa0d8,_0x513b3d[_0x1eda('0x61')]);return db['MailInteraction']['count']({'where':_0x3aa0d8[_0x1eda('0x41')]})[_0x1eda('0x14')](function(_0x4900a3){_0xb9bd03[_0x1eda('0x25')]=_0x4900a3;if(_0x513b3d['query'][_0x1eda('0x43')]){_0x3aa0d8[_0x1eda('0x44')]=[{'all':!![]}];}return db['MailInteraction'][_0x1eda('0x4a')](_0x3aa0d8);})[_0x1eda('0x14')](function(_0x120fc4){_0xb9bd03[_0x1eda('0x4b')]=_0x120fc4;return _0xb9bd03;});}})['then'](respondWithFilteredResult(_0x1a167c,_0x3aa0d8))[_0x1eda('0x1e')](handleError(_0x1a167c,null));};exports['getSmsInteractions']=function(_0xf0d4a1,_0x5b8825){var _0x33a0ab={};var _0x4e7c01={};var _0x577fb3;var _0x27a534;return db[_0x1eda('0x49')][_0x1eda('0x96')]({'where':{'id':_0xf0d4a1[_0x1eda('0x57')]['id']}})['then'](handleEntityNotFound(_0x5b8825,null))[_0x1eda('0x14')](function(_0x414e39){if(_0x414e39){_0x577fb3=_0x414e39;_0x4e7c01['model']=_['keys'](db[_0x1eda('0xe5')]['rawAttributes']);_0x4e7c01[_0x1eda('0x42')]=_[_0x1eda('0x59')](_0xf0d4a1[_0x1eda('0x42')]);_0x4e7c01[_0x1eda('0x5b')]=_['intersection'](_0x4e7c01[_0x1eda('0x5d')],_0x4e7c01[_0x1eda('0x42')]);_0x33a0ab[_0x1eda('0x47')]=_[_0x1eda('0x5c')](_0x4e7c01[_0x1eda('0x5d')],qs[_0x1eda('0x5e')](_0xf0d4a1['query']['fields']));_0x33a0ab[_0x1eda('0x47')]=_0x33a0ab[_0x1eda('0x47')][_0x1eda('0x4d')]?_0x33a0ab[_0x1eda('0x47')]:_0x4e7c01[_0x1eda('0x5d')];_0x33a0ab[_0x1eda('0xd8')]=qs[_0x1eda('0xd4')](_0xf0d4a1[_0x1eda('0x42')][_0x1eda('0xd4')]);_0x33a0ab[_0x1eda('0x41')]=qs['filters'](_[_0x1eda('0xd5')](_0xf0d4a1[_0x1eda('0x42')],_0x4e7c01[_0x1eda('0x5b')]));if(_0xf0d4a1[_0x1eda('0x42')][_0x1eda('0x32')]){_0x33a0ab['where']=_[_0x1eda('0x60')](_0x33a0ab[_0x1eda('0x41')],{'$or':_[_0x1eda('0x34')](_0x33a0ab['attributes'],function(_0x377105){var _0x2acea4={};_0x2acea4[_0x377105]={'$like':'%'+_0xf0d4a1[_0x1eda('0x42')][_0x1eda('0x32')]+'%'};return _0x2acea4;})});}_0x33a0ab=_['merge']({},_0x33a0ab,_0xf0d4a1[_0x1eda('0x61')]);return _0x577fb3[_0x1eda('0xe6')](_0x33a0ab);}})[_0x1eda('0x14')](function(_0x21f441){if(_0x21f441){_0x27a534=_0x21f441[_0x1eda('0x4d')];if(!_0xf0d4a1[_0x1eda('0x42')][_0x1eda('0xdb')]('nolimit')){_0x33a0ab[_0x1eda('0x24')]=qs[_0x1eda('0x24')](_0xf0d4a1[_0x1eda('0x42')][_0x1eda('0x24')]);_0x33a0ab[_0x1eda('0x23')]=qs[_0x1eda('0x23')](_0xf0d4a1['query'][_0x1eda('0x23')]);}return _0x577fb3[_0x1eda('0xe6')](_0x33a0ab);}})[_0x1eda('0x14')](function(_0x31c096){if(_0x31c096){return _0x31c096?{'count':_0x27a534,'rows':_0x31c096}:null;}})['then'](respondWithResult(_0x5b8825,null))[_0x1eda('0x1e')](handleError(_0x5b8825,null));};exports[_0x1eda('0xe7')]=function(_0x1cb9cc,_0x14e748){var _0x53755d={};var _0x96daa1={};var _0x33e3af;var _0x57001b;return db[_0x1eda('0x49')][_0x1eda('0x96')]({'where':{'id':_0x1cb9cc[_0x1eda('0x57')]['id']}})['then'](handleEntityNotFound(_0x14e748,null))[_0x1eda('0x14')](function(_0x2d1770){if(_0x2d1770){_0x33e3af=_0x2d1770;_0x96daa1[_0x1eda('0x5d')]=_['keys'](db['FaxInteraction'][_0x1eda('0x3c')]);_0x96daa1[_0x1eda('0x42')]=_[_0x1eda('0x59')](_0x1cb9cc['query']);_0x96daa1[_0x1eda('0x5b')]=_[_0x1eda('0x5c')](_0x96daa1[_0x1eda('0x5d')],_0x96daa1[_0x1eda('0x42')]);_0x53755d['attributes']=_['intersection'](_0x96daa1[_0x1eda('0x5d')],qs[_0x1eda('0x5e')](_0x1cb9cc[_0x1eda('0x42')][_0x1eda('0x5e')]));_0x53755d[_0x1eda('0x47')]=_0x53755d[_0x1eda('0x47')]['length']?_0x53755d[_0x1eda('0x47')]:_0x96daa1[_0x1eda('0x5d')];_0x53755d[_0x1eda('0xd8')]=qs[_0x1eda('0xd4')](_0x1cb9cc['query'][_0x1eda('0xd4')]);_0x53755d[_0x1eda('0x41')]=qs[_0x1eda('0x5b')](_['pick'](_0x1cb9cc['query'],_0x96daa1[_0x1eda('0x5b')]));if(_0x1cb9cc[_0x1eda('0x42')][_0x1eda('0x32')]){_0x53755d[_0x1eda('0x41')]=_[_0x1eda('0x60')](_0x53755d[_0x1eda('0x41')],{'$or':_[_0x1eda('0x34')](_0x53755d[_0x1eda('0x47')],function(_0x510a12){var _0x3f3788={};_0x3f3788[_0x510a12]={'$like':'%'+_0x1cb9cc['query'][_0x1eda('0x32')]+'%'};return _0x3f3788;})});}_0x53755d=_[_0x1eda('0x60')]({},_0x53755d,_0x1cb9cc[_0x1eda('0x61')]);return _0x33e3af[_0x1eda('0xe7')](_0x53755d);}})[_0x1eda('0x14')](function(_0x188cb6){if(_0x188cb6){_0x57001b=_0x188cb6[_0x1eda('0x4d')];if(!_0x1cb9cc[_0x1eda('0x42')][_0x1eda('0xdb')](_0x1eda('0xd6'))){_0x53755d['limit']=qs[_0x1eda('0x24')](_0x1cb9cc[_0x1eda('0x42')]['limit']);_0x53755d[_0x1eda('0x23')]=qs[_0x1eda('0x23')](_0x1cb9cc[_0x1eda('0x42')]['offset']);}return _0x33e3af[_0x1eda('0xe7')](_0x53755d);}})[_0x1eda('0x14')](function(_0x205f79){if(_0x205f79){return _0x205f79?{'count':_0x57001b,'rows':_0x205f79}:null;}})['then'](respondWithResult(_0x14e748,null))[_0x1eda('0x1e')](handleError(_0x14e748,null));};exports[_0x1eda('0xe8')]=function(_0x224517,_0x59d334){var _0x1db841={};var _0x4e95f8={};var _0x87c851;var _0x1f0811;return db[_0x1eda('0x49')][_0x1eda('0x96')]({'where':{'id':_0x224517[_0x1eda('0x57')]['id']}})['then'](handleEntityNotFound(_0x59d334,null))[_0x1eda('0x14')](function(_0xd8917c){if(_0xd8917c){_0x87c851=_0xd8917c;_0x4e95f8[_0x1eda('0x5d')]=_[_0x1eda('0x59')](db['WhatsappInteraction'][_0x1eda('0x3c')]);_0x4e95f8['query']=_[_0x1eda('0x59')](_0x224517['query']);_0x4e95f8[_0x1eda('0x5b')]=_[_0x1eda('0x5c')](_0x4e95f8['model'],_0x4e95f8[_0x1eda('0x42')]);_0x1db841[_0x1eda('0x47')]=_['intersection'](_0x4e95f8[_0x1eda('0x5d')],qs[_0x1eda('0x5e')](_0x224517[_0x1eda('0x42')][_0x1eda('0x5e')]));_0x1db841['attributes']=_0x1db841[_0x1eda('0x47')][_0x1eda('0x4d')]?_0x1db841[_0x1eda('0x47')]:_0x4e95f8[_0x1eda('0x5d')];_0x1db841[_0x1eda('0xd8')]=qs[_0x1eda('0xd4')](_0x224517[_0x1eda('0x42')][_0x1eda('0xd4')]);_0x1db841[_0x1eda('0x41')]=qs[_0x1eda('0x5b')](_[_0x1eda('0xd5')](_0x224517[_0x1eda('0x42')],_0x4e95f8[_0x1eda('0x5b')]));if(_0x224517['query'][_0x1eda('0x32')]){_0x1db841['where']=_[_0x1eda('0x60')](_0x1db841['where'],{'$or':_['map'](_0x1db841[_0x1eda('0x47')],function(_0x27a117){var _0x46af30={};_0x46af30[_0x27a117]={'$like':'%'+_0x224517[_0x1eda('0x42')]['filter']+'%'};return _0x46af30;})});}_0x1db841=_[_0x1eda('0x60')]({},_0x1db841,_0x224517['options']);return _0x87c851[_0x1eda('0xe8')](_0x1db841);}})['then'](function(_0x5e9ac7){if(_0x5e9ac7){_0x1f0811=_0x5e9ac7[_0x1eda('0x4d')];if(!_0x224517[_0x1eda('0x42')]['hasOwnProperty'](_0x1eda('0xd6'))){_0x1db841[_0x1eda('0x24')]=qs[_0x1eda('0x24')](_0x224517[_0x1eda('0x42')]['limit']);_0x1db841[_0x1eda('0x23')]=qs[_0x1eda('0x23')](_0x224517[_0x1eda('0x42')][_0x1eda('0x23')]);}return _0x87c851[_0x1eda('0xe8')](_0x1db841);}})['then'](function(_0x39b88c){if(_0x39b88c){return _0x39b88c?{'count':_0x1f0811,'rows':_0x39b88c}:null;}})[_0x1eda('0x14')](respondWithResult(_0x59d334,null))[_0x1eda('0x1e')](handleError(_0x59d334,null));};exports[_0x1eda('0xe9')]=function(_0x46dd7f,_0xd21af5,_0x123801){var _0x28304d;var _0x28c54e;var _0x1bedcf;var _0x35cc52=!_['isNil'](_0x46dd7f[_0x1eda('0x57')]['id'])?_0x46dd7f[_0x1eda('0x57')]['id']:!_['isNil'](_0x46dd7f[_0x1eda('0x2e')]['id'])?_0x46dd7f['user']['id']:null;return db[_0x1eda('0x49')][_0x1eda('0x62')]({'where':{'id':_0x35cc52,'role':{'$or':[_0x1eda('0x2d'),'user','agent']}},'attributes':['id','name',_0x1eda('0xea'),_0x1eda('0xeb'),'role','internal',_0x1eda('0x9e')]})['then'](function(_0xf7f97d){if(_0xf7f97d){if(_0xf7f97d['role']==='agent'){_0x28304d=_0xf7f97d;if(_0x46dd7f['body'][_0x1eda('0xab')]){_0x1bedcf=util[_0x1eda('0xac')](_0x1eda('0xec'),_0x28304d[_0x46dd7f['body'][_0x1eda('0xab')]]);}else if(_0x46dd7f['body']['intrf']){_0x1bedcf=util[_0x1eda('0xac')]('SIP/%s',_0x46dd7f['body'][_0x1eda('0xed')]);}else{_0x1bedcf=util[_0x1eda('0xac')]('SIP/%s',_0x28304d[_0x1eda('0x37')]);}socket['to'](util['format'](_0x1eda('0xee'),_0x28304d[_0x1eda('0x37')]))['emit'](_0x1eda('0xef'),{'user':{'id':_0x28304d['id'],'name':_0x28304d[_0x1eda('0x37')]},'ip':_0x46dd7f['headers'][_0x1eda('0xf0')]||_0x46dd7f[_0x1eda('0xf1')][_0x1eda('0xf2')]||_0x46dd7f[_0x1eda('0xf3')][_0x1eda('0xf2')]||_0x46dd7f[_0x1eda('0xf1')]['socket'][_0x1eda('0xf2')]});return db[_0x1eda('0xb4')][_0x1eda('0x2a')]({'where':{'membername':_0x28304d[_0x1eda('0x37')]},'individualHooks':!![]});}}else{throw new db[(_0x1eda('0x90'))][(_0x1eda('0x93'))](_0x1eda('0xf4'));}})[_0x1eda('0x14')](function(){if(_0x28304d){return _0x28304d[_0x1eda('0xf5')]({'raw':!![]});}})['then'](function(_0x3696f5){if(_0x28304d){if(_0x3696f5){_0x28c54e=_0x3696f5;if(_0x28c54e[_0x1eda('0x4d')]){var _0x5b4c73=_0x28c54e['map'](function(_0xd818f1){var _0x5a5f33={'membername':_0x28304d[_0x1eda('0x37')],'UserId':_0x28304d['id'],'queue_name':_0xd818f1[_0x1eda('0x37')],'VoiceQueueId':_0xd818f1['id'],'interface':_0x1bedcf,'paused':_0x28304d[_0x1eda('0x9e')]||![],'penalty':_0xd818f1[_0x1eda('0xf6')]||0x0};return db[_0x1eda('0xb4')]['upsert'](_0x5a5f33);});return Promise['all'](_0x5b4c73);}}}})[_0x1eda('0x14')](function(){if(_0x28304d){return db['MemberReport'][_0x1eda('0x4a')]({'where':{'membername':_0x28304d[_0x1eda('0x37')],'exitAt':null}});}})[_0x1eda('0x14')](function(_0x3b8e16){if(_0x28304d){var _0x1fa081=[];_0x3b8e16[_0x1eda('0xf7')](function(_0x517d82){_0x1fa081['push'](_0x517d82['update']({'exitAt':moment()['format'](_0x1eda('0xf8'))}));});return Promise[_0x1eda('0x55')](_0x1fa081);}})[_0x1eda('0x14')](function(){if(_0x28304d){var _0x21d249=[];var _0x5558a4=[];var _0x2a211f=utils[_0x1eda('0xf9')]();var _0x890b7e={'membername':_0x28304d[_0x1eda('0x37')],'interface':_0x1bedcf,'enterAt':moment()[_0x1eda('0xac')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x28304d['role'],'internal':_0x28304d[_0x1eda('0x68')]};_0x2a211f[_0x1eda('0xf7')](function(_0x5d1ecc){_0x21d249[_0x1eda('0x48')](_['merge']({'channel':_0x5d1ecc,'type':_0x1eda('0xfa'),'data1':_0x46dd7f[_0x1eda('0x64')][_0x1eda('0xfb')],'data2':_0x1bedcf},_0x890b7e));if(_0x28304d['loginInPause']){_0x5558a4[_0x1eda('0x48')](_[_0x1eda('0x60')]({'channel':_0x5d1ecc,'type':_0x1eda('0xfc'),'data1':_0x1eda('0xfd')},_0x890b7e));}});return db[_0x1eda('0xfe')]['bulkCreate'](_0x21d249[_0x1eda('0xcc')](_0x5558a4),{'individualHooks':!![]});}})[_0x1eda('0x14')](function(){if(_0x28304d){return _0x28304d[_0x1eda('0x63')]({'online':!![],'lastLoginAt':moment()[_0x1eda('0xac')](_0x1eda('0xf8')),'voicePause':_0x28304d[_0x1eda('0x9e')]||![],'mailPause':_0x28304d['loginInPause']||![],'chatPause':_0x28304d[_0x1eda('0x9e')]||![],'faxPause':_0x28304d['loginInPause']||![],'smsPause':_0x28304d[_0x1eda('0x9e')]||![],'openchannelPause':_0x28304d['loginInPause']||![],'whatsappPause':_0x28304d[_0x1eda('0x9e')]||![],'pauseType':_0x28304d[_0x1eda('0x9e')]?_0x1eda('0xfd'):null,'interface':_0x1bedcf,'lastPauseAt':moment()[_0x1eda('0xac')](_0x1eda('0xf8'))});}})[_0x1eda('0x14')](function(_0x505848){if(_0x46dd7f['isMiddleware']){return _0x123801();}else{return Promise['resolve'](_0x505848)[_0x1eda('0x14')](respondWithResult(_0xd21af5,null));}})[_0x1eda('0x1e')](handleError(_0xd21af5,null));};exports['logout']=function(_0x13ad61,_0x4164fd){var _0x1a31c;return db['User']['find']({'where':{'id':_0x13ad61['params']['id'],'role':_0x1eda('0x76')},'attributes':['id','name',_0x1eda('0x2c')]})[_0x1eda('0x14')](handleEntityNotFound(_0x4164fd,null))[_0x1eda('0x14')](function(_0x33728b){if(_0x33728b){_0x1a31c=_0x33728b;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x1a31c['name']},'individualHooks':!![]});}})[_0x1eda('0x14')](function(){return db[_0x1eda('0xfe')][_0x1eda('0x4a')]({'where':{'membername':_0x1a31c[_0x1eda('0x37')],'exitAt':null}});})[_0x1eda('0x14')](function(_0x2bd992){var _0x42f377=[];_0x2bd992[_0x1eda('0xf7')](function(_0x3299b6){_0x42f377[_0x1eda('0x48')](_0x3299b6['update']({'exitAt':moment()[_0x1eda('0xac')](_0x1eda('0xf8'))}));});return Promise[_0x1eda('0x55')](_0x42f377);})[_0x1eda('0x14')](function(){return _0x1a31c[_0x1eda('0x63')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x4164fd,null))['catch'](handleError(_0x4164fd,null));};exports['pause']=function(_0x5b5fc5,_0x4da9e7){var _0x3eb61e;return db[_0x1eda('0xb4')][_0x1eda('0x63')]({'paused':0x1},{'where':{'UserId':_0x5b5fc5[_0x1eda('0x57')]['id']},'individualHooks':!![]})[_0x1eda('0x14')](function(){return db[_0x1eda('0x49')][_0x1eda('0x62')]({'where':{'id':_0x5b5fc5[_0x1eda('0x57')]['id'],'role':_0x1eda('0x76')},'attributes':['id',_0x1eda('0x37'),_0x1eda('0x2c'),'internal',_0x1eda('0xab'),_0x1eda('0x9d')]});})[_0x1eda('0x14')](handleEntityNotFound(_0x4da9e7,null))['then'](function(_0x556764){if(_0x556764){_0x3eb61e=_0x556764;return respondWithRpcPromise(_0x1eda('0xff'),_0x1eda('0x100'),{'id':_0x3eb61e['id'],'name':_0x3eb61e[_0x1eda('0x37')],'pause':!![]});}})[_0x1eda('0x14')](function(){if(_0x3eb61e){return db[_0x1eda('0xfe')]['findAll']({'where':{'membername':_0x3eb61e[_0x1eda('0x37')],'type':_0x1eda('0xfc'),'exitAt':null}});}})['then'](function(_0x3088af){if(_0x3088af[_0x1eda('0x4d')]){var _0x32c7a5=moment()[_0x1eda('0xac')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4e6bac=0x0,_0x43e829=_0x3088af[_0x1eda('0x4d')];_0x4e6bac<_0x43e829;_0x4e6bac++){_0x3088af[_0x4e6bac][_0x1eda('0x101')]({'exitAt':_0x32c7a5});}}})[_0x1eda('0x14')](function(){var _0xa1966=[];var _0x2743ed=utils[_0x1eda('0xf9')]();_0x2743ed[_0x1eda('0xf7')](function(_0x39d4de){_0xa1966[_0x1eda('0x48')]({'channel':_0x39d4de,'membername':_0x3eb61e[_0x1eda('0x37')],'interface':_[_0x1eda('0x6c')](_0x3eb61e[_0x1eda('0xab')])?util[_0x1eda('0xac')](_0x1eda('0xad'),_0x3eb61e['name']):_0x3eb61e[_0x1eda('0xab')],'type':'PAUSE','enterAt':moment()[_0x1eda('0xac')](_0x1eda('0xf8')),'data1':_0x5b5fc5[_0x1eda('0x64')][_0x1eda('0x3e')]||_0x1eda('0x102'),'role':_0x3eb61e[_0x1eda('0x2c')],'internal':_0x3eb61e[_0x1eda('0x68')]});});return db[_0x1eda('0xfe')][_0x1eda('0x103')](_0xa1966,{'individualHooks':!![]});})['then'](function(){return _0x3eb61e[_0x1eda('0x63')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5b5fc5[_0x1eda('0x64')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x1eda('0xac')](_0x1eda('0xf8'))});})['then'](respondWithResult(_0x4da9e7,null))[_0x1eda('0x1e')](handleError(_0x4da9e7,null));};exports[_0x1eda('0x104')]=function(_0xc4c7c8,_0x337a40){if(_0xc4c7c8[_0x1eda('0x64')][_0x1eda('0xb0')]&&!utils[_0x1eda('0xa0')](_0xc4c7c8[_0x1eda('0x64')]['channel'])){throw new APIBadRequestError(util[_0x1eda('0xac')](_0x1eda('0x105'),_0xc4c7c8[_0x1eda('0x64')][_0x1eda('0xb0')]));}return db['User']['find']({'where':{'id':_0xc4c7c8[_0x1eda('0x57')]['id']},'attributes':['id',_0x1eda('0x37'),'role',_0x1eda('0x68'),_0x1eda('0xab'),_0x1eda('0x9d'),_0x1eda('0x9f'),'mailPause',_0x1eda('0x106'),_0x1eda('0x107'),_0x1eda('0x108'),'smsPause','whatsappPause',_0x1eda('0x109'),_0x1eda('0x10a')]})['then'](function(_0x4c3fb0){if(!_0x4c3fb0){throw new APINotFoundError(util[_0x1eda('0xac')]('User\x20with\x20id\x20%s\x20not\x20found',_0xc4c7c8['params']['id']));}return _0x4c3fb0['unpause'](_0xc4c7c8['body'][_0x1eda('0xb0')]);})[_0x1eda('0x14')](respondWithResult(_0x337a40,null))[_0x1eda('0x1e')](APIHandleError(_0x337a40));};exports[_0x1eda('0x10b')]=function(_0x15963c,_0x2668b7){var _0x36d1e1={};var _0x211dec={};var _0x5320fc;var _0x3abd5d;return db[_0x1eda('0x49')][_0x1eda('0x96')]({'where':{'id':_0x15963c[_0x1eda('0x57')]['id']}})['then'](handleEntityNotFound(_0x2668b7,null))[_0x1eda('0x14')](function(_0x50aeca){if(_0x50aeca){_0x5320fc=_0x50aeca;_0x211dec[_0x1eda('0x5d')]=_[_0x1eda('0x59')](db[_0x1eda('0x10c')][_0x1eda('0x3c')]);_0x211dec[_0x1eda('0x42')]=_['keys'](_0x15963c[_0x1eda('0x42')]);_0x211dec[_0x1eda('0x5b')]=_[_0x1eda('0x5c')](_0x211dec[_0x1eda('0x5d')],_0x211dec[_0x1eda('0x42')]);_0x36d1e1['attributes']=_[_0x1eda('0x5c')](_0x211dec['model'],qs[_0x1eda('0x5e')](_0x15963c[_0x1eda('0x42')][_0x1eda('0x5e')]));_0x36d1e1[_0x1eda('0x47')]=_0x36d1e1[_0x1eda('0x47')][_0x1eda('0x4d')]?_0x36d1e1[_0x1eda('0x47')]:_0x211dec['model'];_0x36d1e1['order']=qs['sort'](_0x15963c['query']['sort']);_0x36d1e1[_0x1eda('0x41')]=qs[_0x1eda('0x5b')](_[_0x1eda('0xd5')](_0x15963c[_0x1eda('0x42')],_0x211dec['filters']));if(_0x15963c[_0x1eda('0x42')][_0x1eda('0x32')]){_0x36d1e1['where']=_[_0x1eda('0x60')](_0x36d1e1[_0x1eda('0x41')],{'$or':_[_0x1eda('0x34')](_0x36d1e1['attributes'],function(_0x5b6dd9){var _0x121409={};_0x121409[_0x5b6dd9]={'$like':'%'+_0x15963c['query']['filter']+'%'};return _0x121409;})});}_0x36d1e1=_[_0x1eda('0x60')]({},_0x36d1e1,_0x15963c['options']);return _0x5320fc[_0x1eda('0x10b')](_0x36d1e1);}})['then'](function(_0x1ca422){if(_0x1ca422){_0x3abd5d=_0x1ca422['length'];if(!_0x15963c[_0x1eda('0x42')][_0x1eda('0xdb')](_0x1eda('0xd6'))){_0x36d1e1[_0x1eda('0x24')]=qs[_0x1eda('0x24')](_0x15963c[_0x1eda('0x42')][_0x1eda('0x24')]);_0x36d1e1[_0x1eda('0x23')]=qs['offset'](_0x15963c[_0x1eda('0x42')][_0x1eda('0x23')]);}return _0x5320fc['getTeams'](_0x36d1e1);}})['then'](function(_0x194534){if(_0x194534){return _0x194534?{'count':_0x3abd5d,'rows':_0x194534}:null;}})[_0x1eda('0x14')](respondWithResult(_0x2668b7,null))[_0x1eda('0x1e')](handleError(_0x2668b7,null));};exports[_0x1eda('0x10d')]=function(_0x44d4af,_0x3f902d){var _0x279f52=_0x44d4af[_0x1eda('0x57')]['id'];var _0x38e6bd=_0x44d4af[_0x1eda('0x64')]?_0x44d4af[_0x1eda('0x64')]['ids']:null;var _0x30470a=[];return Promise['resolve']()['then'](function(){if(!_0x38e6bd)throw new APIBadRequestError(_0x1eda('0x10e'));})[_0x1eda('0x14')](function(){return db['User'][_0x1eda('0x96')]({'where':{'id':_0x279f52}});})[_0x1eda('0x14')](function(_0x29b948){if(!_0x29b948)throw new APINotFoundError(util['format'](_0x1eda('0xcd'),_0x44d4af[_0x1eda('0x57')]['id']));return db[_0x1eda('0x6e')][_0x1eda('0x10f')](function(_0x4b67d8){return _0x29b948[_0x1eda('0x10d')](_0x38e6bd,{'transaction':_0x4b67d8})[_0x1eda('0x14')](function(){return db['Team'][_0x1eda('0x4a')]({'where':{'id':{'$in':_0x38e6bd}}});})[_0x1eda('0x14')](function(_0xaf0a7){var _0x2803cb=_[_0x1eda('0x34')](_0xaf0a7,function(_0x1878f9){return _0x1878f9['getAssociatedQueues']();});return Promise[_0x1eda('0x55')](_0x2803cb);})[_0x1eda('0x14')](function(_0x326d5b){_0x30470a=_['flattenDeep'](_0x326d5b);var _0x5e29fe=_['map'](_0x30470a,function(_0x46c2ee){return _0x46c2ee['addAgent'](_0x29b948['id'],{'transaction':_0x4b67d8});});return Promise['all'](_0x5e29fe);})[_0x1eda('0x14')](function(){if(!_0x29b948[_0x1eda('0x9d')])return;var _0x4cbf26=_[_0x1eda('0x32')](_0x30470a,function(_0x365007){return _0x365007[_0x1eda('0x110')](_0x1eda('0xb0'))===_0x1eda('0x111');});var _0x52ea76=_[_0x1eda('0x34')](_0x4cbf26,function(_0x887c17){return db['UserVoiceQueueRt'][_0x1eda('0xae')]({'membername':_0x29b948[_0x1eda('0x37')],'UserId':_0x29b948['id'],'queue_name':_0x887c17['name'],'VoiceQueueId':_0x887c17['id'],'interface':_[_0x1eda('0x6c')](_0x29b948[_0x1eda('0xab')])?util['format'](_0x1eda('0xad'),_0x29b948[_0x1eda('0x37')]):_0x29b948[_0x1eda('0xab')],'paused':_0x29b948[_0x1eda('0x9f')]||![],'penalty':_0x29b948[_0x1eda('0xa6')]},{'transaction':_0x4b67d8});});return Promise[_0x1eda('0x55')](_0x52ea76);})[_0x1eda('0x14')](function(){return db[_0x1eda('0x112')][_0x1eda('0x4a')]({'where':{'teamId':{'$in':_0x38e6bd}}});})[_0x1eda('0x14')](function(_0x3877a0){var _0x304574=_[_0x1eda('0x34')](_0x3877a0,function(_0x22bfb6){return db[_0x1eda('0x113')][_0x1eda('0x82')]({'UserId':_0x29b948['id'],'VoicePrefixId':_0x22bfb6[_0x1eda('0x114')]},{'transaction':_0x4b67d8});});return Promise['all'](_0x304574);});});})['then'](function(){for(var _0xea73fe=0x0;_0xea73fe<_0x30470a[_0x1eda('0x4d')];_0xea73fe++){var _0x176b9f=_0x30470a[_0xea73fe]['getDataValue']('channel');var _0x246bba=_0x176b9f+_0x1eda('0xa7');socket[_0x1eda('0x28')]('user'+_0x176b9f+_0x1eda('0xa8'),{'UserId':_0x279f52,['queueField']:_0x30470a[_0xea73fe]['id']});}})['then'](respondWithStatusCode(_0x3f902d,null))[_0x1eda('0x1e')](APIHandleError(_0x3f902d));};exports[_0x1eda('0x115')]=function(_0x17515e,_0x162db8){var _0x2f09e9=_0x17515e[_0x1eda('0x57')]['id'];var _0x24ed0c=null;if(_0x17515e[_0x1eda('0x42')][_0x1eda('0x67')]){_0x24ed0c=_[_0x1eda('0xb2')](_0x17515e['query'][_0x1eda('0x67')])?_0x17515e[_0x1eda('0x42')][_0x1eda('0x67')]:[_0x17515e[_0x1eda('0x42')][_0x1eda('0x67')]];}var _0x41911c=[];return Promise[_0x1eda('0x116')]()[_0x1eda('0x14')](function(){if(!_0x24ed0c)throw new APIBadRequestError(_0x1eda('0x117'));})[_0x1eda('0x14')](function(){return db[_0x1eda('0x49')][_0x1eda('0x96')]({'where':{'id':_0x2f09e9}});})[_0x1eda('0x14')](function(_0x5b21c6){if(!_0x5b21c6)throw new APINotFoundError(util[_0x1eda('0xac')]('User\x20with\x20id\x20%s\x20not\x20found',_0x17515e[_0x1eda('0x57')]['id']));return db[_0x1eda('0x6e')][_0x1eda('0x10f')](function(_0x199bad){return _0x5b21c6[_0x1eda('0x115')](_0x24ed0c,{'transaction':_0x199bad})[_0x1eda('0x14')](function(){return db[_0x1eda('0x10c')][_0x1eda('0x4a')]({'where':{'id':{'$in':_0x24ed0c}}});})[_0x1eda('0x14')](function(_0x497122){var _0x3cbbfa=_[_0x1eda('0x34')](_0x497122,function(_0x1ebf42){return _0x1ebf42['getAssociatedQueues']();});return Promise['all'](_0x3cbbfa);})[_0x1eda('0x14')](function(_0x5b8bf0){_0x41911c=_[_0x1eda('0x118')](_0x5b8bf0);var _0x38483d=_[_0x1eda('0x34')](_0x41911c,function(_0x2a2eef){return _0x2a2eef[_0x1eda('0x119')](_0x5b21c6['id'],{'transaction':_0x199bad});});return Promise[_0x1eda('0x55')](_0x38483d);})[_0x1eda('0x14')](function(){if(!_0x5b21c6['online'])return;var _0x37816c=_[_0x1eda('0x32')](_0x41911c,function(_0x339eec){return _0x339eec[_0x1eda('0x110')]('channel')===_0x1eda('0x111');});var _0x48296a=_[_0x1eda('0x34')](_0x37816c,function(_0x1b2586){return db[_0x1eda('0xb4')]['destroy']({'where':{'VoiceQueueId':_0x1b2586['id'],'UserId':_0x5b21c6['id']},'transaction':_0x199bad});});return Promise['all'](_0x48296a);})[_0x1eda('0x14')](function(){return db[_0x1eda('0x112')][_0x1eda('0x4a')]({'where':{'teamId':{'$in':_0x24ed0c}}});})[_0x1eda('0x14')](function(_0x43603e){var _0xeec585=_[_0x1eda('0x34')](_0x43603e,function(_0x3428fc){return db[_0x1eda('0x113')][_0x1eda('0x2a')]({'where':{'UserId':_0x5b21c6['id'],'VoicePrefixId':_0x3428fc['VoicePrefixId']}},{'transaction':_0x199bad});});return Promise[_0x1eda('0x55')](_0xeec585);});});})[_0x1eda('0x14')](function(){for(var _0x4d55be=0x0;_0x4d55be<_0x41911c[_0x1eda('0x4d')];_0x4d55be++){var _0x4be576=_0x41911c[_0x4d55be][_0x1eda('0x110')]('channel');var _0x4e28d1=_0x4be576+_0x1eda('0xa7');socket[_0x1eda('0x28')](_0x1eda('0x2e')+_0x4be576+_0x1eda('0xb3'),{'UserId':_0x2f09e9,['queueField']:_0x41911c[_0x4d55be]['id']});}})['then'](respondWithStatusCode(_0x162db8,null))['catch'](APIHandleError(_0x162db8));};exports[_0x1eda('0x11a')]=function(_0x98dd98,_0x2d90ea){var _0x2b31dd={};var _0x22ce1f={};var _0x2de269;var _0x1fcb9f;return db['User'][_0x1eda('0x96')]({'where':{'id':_0x98dd98[_0x1eda('0x57')]['id']}})[_0x1eda('0x14')](handleEntityNotFound(_0x2d90ea,null))[_0x1eda('0x14')](function(_0x254c08){if(_0x254c08){_0x2de269=_0x254c08;_0x22ce1f[_0x1eda('0x5d')]=_[_0x1eda('0x59')](db['CmList']['rawAttributes']);_0x22ce1f['query']=_[_0x1eda('0x59')](_0x98dd98[_0x1eda('0x42')]);_0x22ce1f[_0x1eda('0x5b')]=_['intersection'](_0x22ce1f['model'],_0x22ce1f['query']);_0x2b31dd['attributes']=_['intersection'](_0x22ce1f['model'],qs[_0x1eda('0x5e')](_0x98dd98[_0x1eda('0x42')][_0x1eda('0x5e')]));_0x2b31dd['attributes']=_0x2b31dd['attributes']['length']?_0x2b31dd[_0x1eda('0x47')]:_0x22ce1f[_0x1eda('0x5d')];_0x2b31dd[_0x1eda('0xd8')]=qs[_0x1eda('0xd4')](_0x98dd98[_0x1eda('0x42')][_0x1eda('0xd4')]);_0x2b31dd[_0x1eda('0x41')]=qs[_0x1eda('0x5b')](_[_0x1eda('0xd5')](_0x98dd98[_0x1eda('0x42')],_0x22ce1f[_0x1eda('0x5b')]));if(_0x98dd98[_0x1eda('0x42')][_0x1eda('0x32')]){_0x2b31dd[_0x1eda('0x41')]=_[_0x1eda('0x60')](_0x2b31dd['where'],{'$or':_['map'](_0x2b31dd[_0x1eda('0x47')],function(_0x211933){var _0x359903={};_0x359903[_0x211933]={'$like':'%'+_0x98dd98[_0x1eda('0x42')][_0x1eda('0x32')]+'%'};return _0x359903;})});}_0x2b31dd=_[_0x1eda('0x60')]({},_0x2b31dd,_0x98dd98['options']);return _0x2de269[_0x1eda('0x11a')](_0x2b31dd);}})[_0x1eda('0x14')](function(_0x4612c6){if(_0x4612c6){_0x1fcb9f=_0x4612c6[_0x1eda('0x4d')];if(!_0x98dd98[_0x1eda('0x42')][_0x1eda('0xdb')]('nolimit')){_0x2b31dd[_0x1eda('0x24')]=qs[_0x1eda('0x24')](_0x98dd98[_0x1eda('0x42')]['limit']);_0x2b31dd[_0x1eda('0x23')]=qs[_0x1eda('0x23')](_0x98dd98['query']['offset']);}return _0x2de269[_0x1eda('0x11a')](_0x2b31dd);}})[_0x1eda('0x14')](function(_0x4565fd){if(_0x4565fd){return _0x4565fd?{'count':_0x1fcb9f,'rows':_0x4565fd}:null;}})[_0x1eda('0x14')](respondWithResult(_0x2d90ea,null))[_0x1eda('0x1e')](handleError(_0x2d90ea,null));};exports['getAgents']=function(_0x18fe53,_0x32f70d){var _0x4beb86={};var _0x497e54={};var _0x575731;return db[_0x1eda('0x49')][_0x1eda('0x96')]({'where':{'id':_0x18fe53['params']['id']}})[_0x1eda('0x14')](handleEntityNotFound(_0x32f70d,null))[_0x1eda('0x14')](function(_0x4ea034){if(_0x4ea034){_0x575731=_0x4ea034;_0x497e54[_0x1eda('0x5d')]=_[_0x1eda('0x59')](db['User'][_0x1eda('0x3c')]);_0x497e54['query']=_['keys'](_0x18fe53['query']);_0x497e54['filters']=_[_0x1eda('0x5c')](_0x497e54[_0x1eda('0x5d')],_0x497e54['query']);_0x4beb86['attributes']=_['intersection'](_0x497e54[_0x1eda('0x5d')],qs['fields'](_0x18fe53[_0x1eda('0x42')][_0x1eda('0x5e')]));_0x4beb86['attributes']=_0x4beb86[_0x1eda('0x47')][_0x1eda('0x4d')]?_0x4beb86[_0x1eda('0x47')]:_0x497e54[_0x1eda('0x5d')];_0x4beb86[_0x1eda('0xd8')]=qs[_0x1eda('0xd4')](_0x18fe53[_0x1eda('0x42')][_0x1eda('0xd4')]);_0x4beb86[_0x1eda('0x41')]=qs[_0x1eda('0x5b')](_[_0x1eda('0xd5')](_0x18fe53[_0x1eda('0x42')],_0x497e54['filters']));if(_0x18fe53['query'][_0x1eda('0x32')]){_0x4beb86[_0x1eda('0x41')]=_[_0x1eda('0x60')](_0x4beb86[_0x1eda('0x41')],{'$or':_['map'](_0x4beb86[_0x1eda('0x47')],function(_0x264675){var _0x302000={};_0x302000[_0x264675]={'$like':'%'+_0x18fe53[_0x1eda('0x42')][_0x1eda('0x32')]+'%'};return _0x302000;})});}_0x4beb86['model']=db[_0x1eda('0x49')];_0x4beb86['as']='Agents';_0x4beb86=_[_0x1eda('0x60')]({},_0x4beb86,_0x18fe53['options']);return _0x575731[_0x1eda('0xf5')]({'include':[_0x4beb86]});}})[_0x1eda('0x14')](function(_0x588862){if(_0x588862){var _0xb75e40={},_0x1417cf=[];for(var _0x82902a=0x0;_0x82902a<_0x588862[_0x1eda('0x4d')];_0x82902a+=0x1){for(var _0x11c7c9=0x0,_0x530a26;_0x11c7c9<_0x588862[_0x82902a][_0x1eda('0x2f')]['length'];_0x11c7c9+=0x1){_0x530a26=_0x588862[_0x82902a][_0x1eda('0x2f')][_0x11c7c9][_0x1eda('0x2b')]({'plain':!![]});_0xb75e40[_0x530a26['id']]=_0x530a26;}}_0xb75e40=_[_0x1eda('0x11b')](_0xb75e40);for(var _0x37619d=qs[_0x1eda('0x23')](_0x18fe53[_0x1eda('0x42')]['offset']);_0x37619d<_0xb75e40[_0x1eda('0x4d')]&&_0x1417cf[_0x1eda('0x4d')]=_0x95ac6e){_0x5b031b=_0x95ac6e;_0xc9196c=0xc8;}else{_0xc9196c=0xce;}_0x50ce66[_0x6cdb('0x24')](_0xc9196c);return _0x50ce66[_0x6cdb('0x2a')](_0x6cdb('0x2b'),_0x94e56d+'-'+_0x5b031b+'/'+_0x95ac6e)[_0x6cdb('0x26')](_0x3db867);}return null;};}function saveUpdates(_0x114ccf){return function(_0x4af6d2){if(_0x4af6d2){return _0x4af6d2[_0x6cdb('0x2c')](_0x114ccf)[_0x6cdb('0x1a')](function(_0x340138){if(_0x340138[_0x6cdb('0x2d')]===_0x6cdb('0x2e')){socket[_0x6cdb('0x2f')](_0x6cdb('0x30')+_0x340138['id'],_0x340138);}return _0x340138;});}return null;};}function removeEntity(_0xd01503){return function(_0x48aee3){if(_0x48aee3){return _0x48aee3[_0x6cdb('0x31')]()[_0x6cdb('0x1a')](function(){var _0x2bc370=_0x48aee3['get']({'plain':!![]});if(_0x2bc370[_0x6cdb('0x2d')]===_0x6cdb('0x32'))return;var _0x168caf=[{'name':'Users','value':_0x6cdb('0x33'),'ignore':!![]},{'name':'Agents','value':_0x6cdb('0x2e'),'ignore':![]},{'name':_0x6cdb('0x34'),'value':'telephone','ignore':![]}];var _0x4c4a34=_(_0x168caf)[_0x6cdb('0x35')](_0x6cdb('0x36'))[_0x6cdb('0x37')](_0x6cdb('0x38'))[_0x6cdb('0x38')]();if(_[_0x6cdb('0x39')](_0x4c4a34,_0x2bc370[_0x6cdb('0x2d')])){return;}var _0x2ecda1=_[_0x6cdb('0x3a')](_0x168caf,[_0x6cdb('0x38'),_0x2bc370[_0x6cdb('0x2d')]])['name'];return db[_0x6cdb('0x3b')][_0x6cdb('0x31')]({'where':{'type':_0x2ecda1,'resourceId':_0x2bc370['id']}})[_0x6cdb('0x1a')](function(){return _0x48aee3;});})[_0x6cdb('0x1a')](function(){_0xd01503[_0x6cdb('0x24')](0xcc)[_0x6cdb('0x25')]();});}};}function handleEntityNotFound(_0x28c249){return function(_0x246b3b){if(!_0x246b3b){_0x28c249[_0x6cdb('0x23')](0x194);}return _0x246b3b;};}function handleError(_0x3a4ef8,_0x18c0b7){_0x18c0b7=_0x18c0b7||0x1f4;return function(_0x44e4f7){logger[_0x6cdb('0x1f')](_0x44e4f7[_0x6cdb('0x3c')]);if(_0x44e4f7[_0x6cdb('0x3d')]){delete _0x44e4f7['name'];}_0x3a4ef8['status'](_0x18c0b7)[_0x6cdb('0x3e')](_0x44e4f7);};}exports[_0x6cdb('0x3f')]=function(_0x6c4bd6,_0xa2791a){var _0x278306={},_0x50d1de={'count':0x0,'rows':[]};var _0x2b071d=_(db[_0x6cdb('0x40')][_0x6cdb('0x41')])[_0x6cdb('0x37')](function(_0x3d0de5){return{'name':_0x3d0de5[_0x6cdb('0x42')],'type':_0x3d0de5[_0x6cdb('0x43')][_0x6cdb('0x44')]};})['filter'](function(_0x2fbce7){return!_['includes']([_0x6cdb('0x45'),_0x6cdb('0x46')],_0x2fbce7[_0x6cdb('0x3d')]);})[_0x6cdb('0x38')]();_0x278306=qs[_0x6cdb('0x47')](_0x2b071d,_0x6c4bd6);var _0x395545={'where':_0x278306[_0x6cdb('0x48')]};return db[_0x6cdb('0x40')][_0x6cdb('0x28')](_0x395545)[_0x6cdb('0x1a')](function(_0x387c58){_0x50d1de[_0x6cdb('0x28')]=_0x387c58;if(_0x6c4bd6['query'][_0x6cdb('0x49')]){_0x278306[_0x6cdb('0x4a')]=[{'all':!![]}];}if(_0x6c4bd6[_0x6cdb('0x4b')][_0x6cdb('0x4c')]===_0x6cdb('0x4d')){_0x278306[_0x6cdb('0x4a')]=[{'model':db[_0x6cdb('0x4e')],'as':'userSetting'}];}if(!_['includes'](_0x278306['attributes'],'id')){_0x278306['attributes'][_0x6cdb('0x4f')]('id');}return db[_0x6cdb('0x40')][_0x6cdb('0x50')](_0x278306);})[_0x6cdb('0x1a')](function(_0x4378ac){_0x50d1de[_0x6cdb('0x51')]=_0x4378ac;if(_0x6c4bd6[_0x6cdb('0x4b')][_0x6cdb('0x52')]===_0x6cdb('0x4d')){var _0x2aa8b3=[];for(var _0x2b3faf=0x0;_0x2b3faf<_0x50d1de['rows'][_0x6cdb('0x53')];_0x2b3faf++){_0x2aa8b3[_0x6cdb('0x4f')](get_open_tabs(_0x6cdb('0x54'),_0x50d1de[_0x6cdb('0x51')][_0x2b3faf][_0x6cdb('0x55')]));_0x2aa8b3[_0x6cdb('0x4f')](get_open_tabs(_0x6cdb('0x56'),_0x50d1de['rows'][_0x2b3faf][_0x6cdb('0x55')]));_0x2aa8b3[_0x6cdb('0x4f')](get_open_tabs('fax',_0x50d1de[_0x6cdb('0x51')][_0x2b3faf][_0x6cdb('0x55')]));_0x2aa8b3[_0x6cdb('0x4f')](get_open_tabs(_0x6cdb('0x57'),_0x50d1de['rows'][_0x2b3faf][_0x6cdb('0x55')]));_0x2aa8b3[_0x6cdb('0x4f')](get_open_tabs(_0x6cdb('0x58'),_0x50d1de[_0x6cdb('0x51')][_0x2b3faf][_0x6cdb('0x55')]));_0x2aa8b3[_0x6cdb('0x4f')](get_open_tabs(_0x6cdb('0x59'),_0x50d1de['rows'][_0x2b3faf][_0x6cdb('0x55')]));}return Promise[_0x6cdb('0x5a')](_0x2aa8b3)[_0x6cdb('0x1a')](function(){return _0x50d1de;});}else{return _0x50d1de;}})[_0x6cdb('0x1a')](respondWithFilteredResult(_0xa2791a,_0x278306))[_0x6cdb('0x5b')](handleError(_0xa2791a,null));};exports[_0x6cdb('0x5c')]=function(_0x16c807,_0x51f766){var _0x39bb35={'raw':![],'where':{'id':_0x16c807[_0x6cdb('0x5d')]['id']}},_0x2eaa3d={};_0x2eaa3d[_0x6cdb('0x5e')]=_[_0x6cdb('0x5f')](_[_0x6cdb('0x60')](db[_0x6cdb('0x40')]['rawAttributes']),[_0x6cdb('0x45'),'salt']);_0x2eaa3d['query']=_[_0x6cdb('0x60')](_0x16c807['query']);_0x2eaa3d[_0x6cdb('0x61')]=_[_0x6cdb('0x62')](_0x2eaa3d[_0x6cdb('0x5e')],_0x2eaa3d[_0x6cdb('0x4b')]);_0x39bb35[_0x6cdb('0x63')]=_[_0x6cdb('0x62')](_0x2eaa3d['model'],qs[_0x6cdb('0x64')](_0x16c807[_0x6cdb('0x4b')][_0x6cdb('0x64')]));_0x39bb35[_0x6cdb('0x63')]=_0x39bb35[_0x6cdb('0x63')]['length']?_0x39bb35[_0x6cdb('0x63')]:_0x2eaa3d['model'];if(_0x16c807[_0x6cdb('0x4b')][_0x6cdb('0x49')]){_0x39bb35[_0x6cdb('0x4a')]=[{'all':!![]}];}if(_0x16c807[_0x6cdb('0x4b')][_0x6cdb('0x4c')]===_0x6cdb('0x4d')){_0x39bb35[_0x6cdb('0x4a')]=[{'model':db[_0x6cdb('0x4e')],'as':_0x6cdb('0x4c')}];}_0x39bb35=_[_0x6cdb('0x65')]({},_0x39bb35,_0x16c807[_0x6cdb('0x66')]);if(!_['includes'](_0x39bb35['attributes'],'id')){_0x39bb35[_0x6cdb('0x63')]['push']('id');}return db[_0x6cdb('0x40')][_0x6cdb('0x3a')](_0x39bb35)[_0x6cdb('0x1a')](handleEntityNotFound(_0x51f766,null))['then'](function(_0x30653e){var _0x36796c=[];values=_0x30653e;if(_0x16c807[_0x6cdb('0x4b')]['openTabs']===_0x6cdb('0x4d')){_0x36796c['push'](get_open_tabs(_0x6cdb('0x54'),_0x30653e['dataValues']));_0x36796c[_0x6cdb('0x4f')](get_open_tabs('sms',_0x30653e[_0x6cdb('0x55')]));_0x36796c[_0x6cdb('0x4f')](get_open_tabs(_0x6cdb('0x58'),_0x30653e['dataValues']));_0x36796c['push'](get_open_tabs('whatsapp',_0x30653e[_0x6cdb('0x55')]));_0x36796c['push'](get_open_tabs(_0x6cdb('0x67'),_0x30653e['dataValues']));_0x36796c[_0x6cdb('0x4f')](get_open_tabs(_0x6cdb('0x57'),_0x30653e['dataValues']));return Promise[_0x6cdb('0x5a')](_0x36796c);}else{return values;}})[_0x6cdb('0x1a')](function(){return values;})[_0x6cdb('0x1a')](respondWithResult(_0x51f766,null))[_0x6cdb('0x5b')](handleError(_0x51f766,null));};exports['update']=function(_0x14e3cf,_0x2c0d79){if(_0x14e3cf[_0x6cdb('0x68')]['id']){delete _0x14e3cf['body']['id'];}delete _0x14e3cf[_0x6cdb('0x68')]['role'];return db['User'][_0x6cdb('0x3a')]({'where':{'id':_0x14e3cf['params']['id']}})[_0x6cdb('0x1a')](handleEntityNotFound(_0x2c0d79,null))[_0x6cdb('0x1a')](saveUpdates(_0x14e3cf[_0x6cdb('0x68')],null))[_0x6cdb('0x1a')](respondWithResult(_0x2c0d79,null))[_0x6cdb('0x5b')](handleError(_0x2c0d79,null));};exports['describe']=function(_0x5b028b,_0x5966ce){return db['User']['describe']()[_0x6cdb('0x1a')](respondWithResult(_0x5966ce,null))[_0x6cdb('0x5b')](handleError(_0x5966ce,null));};exports[_0x6cdb('0x69')]=function(_0x55d3ba,_0x4c98e6){return db[_0x6cdb('0x40')][_0x6cdb('0x3a')]({'where':{'id':_0x55d3ba[_0x6cdb('0x5d')]['id']}})[_0x6cdb('0x1a')](handleEntityNotFound(_0x4c98e6,null))[_0x6cdb('0x1a')](function(_0x89d9c3){if(_0x89d9c3){return _0x89d9c3[_0x6cdb('0x69')](_0x55d3ba[_0x6cdb('0x68')][_0x6cdb('0x6a')],_['omit'](_0x55d3ba['body'],[_0x6cdb('0x6a'),'id'])||{});}})[_0x6cdb('0x1a')](respondWithResult(_0x4c98e6,null))[_0x6cdb('0x5b')](handleError(_0x4c98e6,null));};function validateUser(_0x366a7f){return new Promise(function(_0x36bb5a,_0x3d271c){if(_0x366a7f['internal'])return _0x36bb5a(_0x366a7f);return db[_0x6cdb('0x6b')]['findById'](0x1)[_0x6cdb('0x1a')](function(_0x19323c){if(_0x19323c['securePassword'])authService['validatePasswordPattern'](_0x366a7f[_0x6cdb('0x45')]);db['User']['max'](_0x6cdb('0x6c'))['then'](function(_0x5c15f6){if(_[_0x6cdb('0x6d')](_0x5c15f6)){_0x366a7f['internal']=_0x19323c[_0x6cdb('0x6e')]||0x1;return;}if(_['isNil'](_0x19323c[_0x6cdb('0x6e')])||_0x19323c[_0x6cdb('0x6e')]===_0x5c15f6){_0x366a7f[_0x6cdb('0x6c')]=_0x5c15f6+0x1;return;}if(_0x19323c['min_internal']>_0x5c15f6){_0x366a7f[_0x6cdb('0x6c')]=_0x19323c[_0x6cdb('0x6e')];return;}return db['sequelize'][_0x6cdb('0x4b')](_0x6cdb('0x6f'),{'type':db[_0x6cdb('0x70')]['QueryTypes']['SELECT']})[_0x6cdb('0x1a')](function(_0x2d1ef0){if(_0x2d1ef0&&_0x2d1ef0[_0x6cdb('0x53')]){for(var _0x545860=0x0,_0x3e5d02=_0x2d1ef0[_0x6cdb('0x53')];_0x545860<_0x3e5d02&&_[_0x6cdb('0x6d')](_0x366a7f['internal']);_0x545860++){if(_0x19323c[_0x6cdb('0x6e')]<=_0x2d1ef0[_0x545860][_0x6cdb('0x71')]){_0x366a7f[_0x6cdb('0x6c')]=_0x2d1ef0[_0x545860][_0x6cdb('0x71')];}else if(_0x19323c[_0x6cdb('0x6e')]>_0x2d1ef0[_0x545860][_0x6cdb('0x71')]&&_0x19323c[_0x6cdb('0x6e')]<=_0x2d1ef0[_0x545860]['to']){_0x366a7f[_0x6cdb('0x6c')]=_0x19323c[_0x6cdb('0x6e')];}}}if(_[_0x6cdb('0x6d')](_0x366a7f[_0x6cdb('0x6c')])){_0x366a7f[_0x6cdb('0x6c')]=_0x5c15f6+0x1;}return _0x36bb5a(_0x366a7f);});});})['catch'](function(_0xca032){_0x3d271c(_0xca032);});});}function updateUser(_0x447f71){return new Promise(function(_0x3e431b,_0x20c832){try{if(_0x447f71[_0x6cdb('0x72')]){_0x447f71['mailbox']=_0x447f71['internal'];_0x447f71['VoiceMail']={'mailbox':_0x447f71[_0x6cdb('0x6c')],'password':_0x447f71[_0x6cdb('0x45')],'fullname':_0x447f71[_0x6cdb('0x73')],'email':_0x447f71[_0x6cdb('0x74')]};}if(_0x447f71[_0x6cdb('0x2d')]==='agent'){if(!_0x447f71[_0x6cdb('0x75')])_0x447f71[_0x6cdb('0x75')]=['101',_0x6cdb('0x76'),'103',_0x6cdb('0x77'),_0x6cdb('0x78'),_0x6cdb('0x79'),_0x6cdb('0x7a'),_0x6cdb('0x7b'),'107',_0x6cdb('0x7c'),_0x6cdb('0x7d'),_0x6cdb('0x7e'),_0x6cdb('0x7f'),_0x6cdb('0x80'),_0x6cdb('0x81')];}_0x3e431b(_0x447f71);}catch(_0x500b8b){_0x20c832(_0x500b8b);}});}exports[_0x6cdb('0x82')]=function(_0x1c3a4f,_0x883b0d){if(_0x1c3a4f[_0x6cdb('0x33')][_0x6cdb('0x2d')]===_0x6cdb('0x2e'))throw new Error(_0x6cdb('0x83'));if(_0x1c3a4f['body'][_0x6cdb('0x2d')]===_0x6cdb('0x33')&&_0x1c3a4f['user'][_0x6cdb('0x2d')]!==_0x6cdb('0x32')){throw new Error(_0x6cdb('0x84'));}if(_0x1c3a4f[_0x6cdb('0x68')][_0x6cdb('0x2d')]===_0x6cdb('0x32')&&_0x1c3a4f[_0x6cdb('0x33')][_0x6cdb('0x2d')]!=='admin'){throw new Error(_0x6cdb('0x85'));}return licenseUtil[_0x6cdb('0x86')]([_0x1c3a4f['body']])['then'](function(){return validateUser(_0x1c3a4f[_0x6cdb('0x68')]);})['then'](function(_0x2ae3fa){return updateUser(_0x2ae3fa)[_0x6cdb('0x1a')](function(_0x29ad1f){if(_0x29ad1f['role']===_0x6cdb('0x32')){_0x29ad1f[_0x6cdb('0x87')]=_0x1c3a4f['user'][_0x6cdb('0x87')];delete _0x29ad1f['userProfileId'];}return _0x29ad1f;});})[_0x6cdb('0x1a')](function(_0x256c34){return db['User'][_0x6cdb('0x82')](_0x256c34,{'include':[{'model':db[_0x6cdb('0x88')],'as':_0x6cdb('0x88')}]});})[_0x6cdb('0x1a')](function(_0x55d7e8){if(_0x1c3a4f[_0x6cdb('0x68')][_0x6cdb('0x2d')]===_0x6cdb('0x33'))return _0x55d7e8;if(_0x1c3a4f[_0x6cdb('0x33')][_0x6cdb('0x2d')]!==_0x6cdb('0x33'))return _0x55d7e8;return db[_0x6cdb('0x89')][_0x6cdb('0x3a')]({'where':{'name':_0x55d7e8[_0x6cdb('0x2d')]===_0x6cdb('0x2e')?_0x6cdb('0x8a'):_0x6cdb('0x34'),'userProfileId':_0x1c3a4f[_0x6cdb('0x33')][_0x6cdb('0x8b')]},'raw':!![]})[_0x6cdb('0x1a')](function(_0x5122a5){if(!_0x5122a5||_0x5122a5['autoAssociation']!=0x0)return _0x55d7e8;return db[_0x6cdb('0x3b')]['create']({'name':_0x55d7e8[_0x6cdb('0x3d')],'resourceId':_0x55d7e8['id'],'type':_0x5122a5['name'],'sectionId':_0x5122a5['id']},{})['then'](function(){return _0x55d7e8;});})[_0x6cdb('0x5b')](function(_0x2142c8){logger[_0x6cdb('0x1f')](_0x6cdb('0x8c'),_0x2142c8);throw _0x2142c8;});})['then'](respondWithResult(_0x883b0d,0xc9))[_0x6cdb('0x5b')](handleError(_0x883b0d,null));};exports[_0x6cdb('0x8d')]=function(_0x4027f8,_0x5ad4dc){var _0x436f3b=_0x4027f8[_0x6cdb('0x68')];var _0x4a249c=[];if(_0x4027f8['user'][_0x6cdb('0x2d')]===_0x6cdb('0x2e'))throw new Error('Unauthorized');if(_[_0x6cdb('0x8e')](_0x436f3b,[_0x6cdb('0x2d'),_0x6cdb('0x33')])&&_0x4027f8[_0x6cdb('0x33')][_0x6cdb('0x2d')]!==_0x6cdb('0x32')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x6cdb('0x8e')](_0x436f3b,[_0x6cdb('0x2d'),_0x6cdb('0x32')])&&_0x4027f8[_0x6cdb('0x33')]['role']!==_0x6cdb('0x32')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x6cdb('0x86')](_0x436f3b)['then'](function(){return validateUser(_0x436f3b[0x0]);})['then'](function(){for(var _0x4254d2=0x1;_0x4254d2<_0x436f3b['length'];_0x4254d2++){var _0x1f509e=_0x436f3b[_0x4254d2-0x1]['internal'];if(!_0x436f3b[_0x4254d2][_0x6cdb('0x6c')])_0x436f3b[_0x4254d2][_0x6cdb('0x6c')]=_0x1f509e+0x1;_0x4a249c[_0x6cdb('0x4f')](validateUser(_0x436f3b[_0x4254d2]));}return Promise[_0x6cdb('0x5a')](_0x4a249c);})[_0x6cdb('0x1a')](function(){_0x4a249c=[];for(var _0x1490bb=0x0;_0x1490bb<_0x436f3b['length'];_0x1490bb++){_0x4a249c[_0x6cdb('0x4f')](updateUser(_0x436f3b[_0x1490bb]));}return Promise[_0x6cdb('0x5a')](_0x4a249c);})[_0x6cdb('0x1a')](function(){_0x4a249c=_0x436f3b[_0x6cdb('0x37')](function(_0x19fee9){return db[_0x6cdb('0x40')][_0x6cdb('0x82')](_0x19fee9,{'include':[{'model':db[_0x6cdb('0x88')],'as':_0x6cdb('0x88')}]})[_0x6cdb('0x1a')](function(_0xbb5989){_0x19fee9['id']=_0xbb5989['id'];return _0x19fee9;});});return Promise[_0x6cdb('0x5a')](_0x4a249c);})['then'](function(_0x5746e6){if(_0x4027f8['body'][_0x6cdb('0x2d')]==='user')return _0x5746e6;if(_0x4027f8[_0x6cdb('0x33')]['role']!==_0x6cdb('0x33'))return _0x5746e6;var _0x137efb=_['some'](_0x5746e6,function(_0x167ef8){return _0x167ef8[_0x6cdb('0x2d')]===_0x6cdb('0x2e')||_0x167ef8[_0x6cdb('0x2d')]==='telephone';});if(!_0x137efb)return _0x5746e6;return db[_0x6cdb('0x89')][_0x6cdb('0x50')]({'where':{'name':{'$or':[_0x6cdb('0x8a'),_0x6cdb('0x34')]},'userProfileId':_0x4027f8[_0x6cdb('0x33')]['userProfileId']},'raw':!![]})[_0x6cdb('0x1a')](function(_0x3f2647){if(_[_0x6cdb('0x8f')](_0x3f2647)||!_['some'](_0x3f2647,[_0x6cdb('0x90'),0x0]))return _0x5746e6;_0x4a249c=[];var _0xf8d8d8=_(_0x3f2647)[_0x6cdb('0x37')](function(_0x5292c0){if(_0x5292c0[_0x6cdb('0x90')]===0x1)return;return _0x5292c0['name']===_0x6cdb('0x8a')?_0x6cdb('0x2e'):'telephone';})[_0x6cdb('0x91')]()[_0x6cdb('0x38')]();for(var _0x4c427d=0x0;_0x4c427d<_0x5746e6[_0x6cdb('0x53')];_0x4c427d++){if(!_[_0x6cdb('0x39')](_0xf8d8d8,_0x5746e6[_0x4c427d][_0x6cdb('0x2d')]))return;var _0x56755e=_0x5746e6[_0x4c427d][_0x6cdb('0x2d')]==='agent'?_0x6cdb('0x8a'):_0x6cdb('0x34');_0x4a249c[_0x6cdb('0x4f')](db['UserProfileResource'][_0x6cdb('0x82')]({'name':_0x5746e6[_0x4c427d]['name'],'resourceId':_0x5746e6[_0x4c427d]['id'],'type':_0x56755e,'sectionId':_['find'](_0x3f2647,['name',_0x56755e])['id']},{}));}return Promise['all'](_0x4a249c);});})['then'](respondWithResult(_0x5ad4dc,0xc9))[_0x6cdb('0x5b')](handleError(_0x5ad4dc,null));};exports['changePassword']=function(_0xb77e0d,_0x322940){if(_0xb77e0d[_0x6cdb('0x68')]['id']){delete _0xb77e0d['body']['id'];}return db[_0x6cdb('0x40')][_0x6cdb('0x3a')]({'where':{'id':_0xb77e0d[_0x6cdb('0x5d')]['id']}})[_0x6cdb('0x1a')](function(_0x3ae9ac){if(!_0x3ae9ac)return null;if(_0x3ae9ac['id']===_0xb77e0d[_0x6cdb('0x33')]['id']){if(!_0xb77e0d[_0x6cdb('0x68')][_0x6cdb('0x92')]||!_0xb77e0d['body'][_0x6cdb('0x93')]){throw new db['Sequelize'][(_0x6cdb('0x94'))](_0x6cdb('0x95'));}if(!_0x3ae9ac[_0x6cdb('0x96')](_0xb77e0d[_0x6cdb('0x68')][_0x6cdb('0x92')])){throw new db['Sequelize'][(_0x6cdb('0x94'))]('Wrong\x20credentials');}if(_0xb77e0d[_0x6cdb('0x68')][_0x6cdb('0x92')]===_0xb77e0d[_0x6cdb('0x68')][_0x6cdb('0x93')]){throw new db[(_0x6cdb('0x97'))][(_0x6cdb('0x94'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0xb77e0d[_0x6cdb('0x33')][_0x6cdb('0x2d')]===_0x6cdb('0x32')){if(!_0xb77e0d[_0x6cdb('0x68')][_0x6cdb('0x93')]){throw new db[(_0x6cdb('0x97'))][(_0x6cdb('0x94'))](_0x6cdb('0x98'));}}else if(_0xb77e0d[_0x6cdb('0x33')][_0x6cdb('0x2d')]===_0x6cdb('0x33')){if(!_0xb77e0d[_0x6cdb('0x68')][_0x6cdb('0x93')]){throw new db[(_0x6cdb('0x97'))][(_0x6cdb('0x94'))](_0x6cdb('0x98'));}if(_0x3ae9ac['role']!==_0x6cdb('0x2e')){throw new db[(_0x6cdb('0x97'))][(_0x6cdb('0x94'))]('Unauthorized');}}else{throw new db[(_0x6cdb('0x97'))]['ValidationError']('Unauthorized');}return _0x3ae9ac;})[_0x6cdb('0x1a')](handleEntityNotFound(_0x322940,null))[_0x6cdb('0x1a')](function(_0x1c8373){return db[_0x6cdb('0x6b')]['findOne']({'attributes':['id','securePassword',_0x6cdb('0x99'),_0x6cdb('0x9a')]})[_0x6cdb('0x1a')](function(_0x5471bd){if(_0x5471bd[_0x6cdb('0x9b')])authService[_0x6cdb('0x9c')](_0xb77e0d['body']['newPassword']);if(!_0x5471bd['enforcePasswordHistory']||!_0x1c8373[_0x6cdb('0x9d')])return _0x1c8373;authService['validatePasswordHistory'](_0xb77e0d[_0x6cdb('0x68')]['newPassword'],_0x1c8373[_0x6cdb('0x9d')],_0x5471bd[_0x6cdb('0x9a')]);return _0x1c8373;})[_0x6cdb('0x1a')](saveUpdates({'password':_0xb77e0d['body'][_0x6cdb('0x93')],'passwordResetAt':_0xb77e0d[_0x6cdb('0x33')]['id']==_0xb77e0d[_0x6cdb('0x5d')]['id']?moment():null,'previousPasswords':authService[_0x6cdb('0x9e')](_0xb77e0d[_0x6cdb('0x68')][_0x6cdb('0x93')],_0x1c8373[_0x6cdb('0x9d')])},null));})[_0x6cdb('0x1a')](respondWithResult(_0x322940,null))[_0x6cdb('0x5b')](handleError(_0x322940,null));};exports[_0x6cdb('0x9f')]=function(_0x5a0d48,_0x16685b){var _0x6f3687=_0x5a0d48[_0x6cdb('0x68')]['channel'];return db['User'][_0x6cdb('0x3a')]({'where':{'id':_0x5a0d48[_0x6cdb('0x5d')]['id']},'attributes':['id','name','role',_0x6cdb('0xa0'),_0x6cdb('0xa1'),'voicePause',_0x6cdb('0xa2')]})[_0x6cdb('0x1a')](handleEntityNotFound(_0x16685b,null))['then'](function(_0x4fab1e){if(_0x4fab1e){if(!utils[_0x6cdb('0xa3')](_0x6f3687)){throw new db[(_0x6cdb('0x97'))][(_0x6cdb('0x94'))](_0x6cdb('0xa4'));}return _0x4fab1e[_0x6cdb('0xa5')+_[_0x6cdb('0xa6')](_0x6f3687[_0x6cdb('0xa7')]())+_0x6cdb('0xa8')](_0x5a0d48[_0x6cdb('0x68')][_0x6cdb('0x6a')],{'penalty':_0x5a0d48[_0x6cdb('0x68')]['penalty']||0x0})[_0x6cdb('0xa9')](function(_0x14147b){for(var _0x148054=0x0;_0x148054<_0x5a0d48['body'][_0x6cdb('0x6a')]['length'];_0x148054+=0x1){var _0x41e7bf={'UserId':Number(_0x5a0d48[_0x6cdb('0x5d')]['id'])};_0x41e7bf[_[_0x6cdb('0xa6')](_0x6f3687[_0x6cdb('0xa7')]())+'QueueId']=Number(_0x5a0d48[_0x6cdb('0x68')][_0x6cdb('0x6a')][_0x148054]);socket['emit']('user'+_[_0x6cdb('0xa6')](_0x6f3687[_0x6cdb('0xa7')]())+'Queue:save',_0x41e7bf);}return _0x14147b;})['then'](function(){if(_0x6f3687==='voice'){return db[_0x6cdb('0xaa')][_0x6cdb('0x50')]({'where':{'id':_0x5a0d48[_0x6cdb('0x68')]['ids']||[]},'raw':!![],'attributes':['id',_0x6cdb('0x3d')]});}})[_0x6cdb('0x1a')](function(_0xc03c63){var _0xe09c70=_0x4fab1e[_0x6cdb('0xab')]({'plain':!![]});var _0xc2b81e=[];if(_0x6f3687===_0x6cdb('0xac')&&_0xe09c70[_0x6cdb('0x2d')]===_0x6cdb('0x2e')&&_0xe09c70[_0x6cdb('0xa0')]){for(let _0x58a665=0x0;_0x58a665<_0xc03c63[_0x6cdb('0x53')];_0x58a665+=0x1){_0xc2b81e['push']({'membername':_0xe09c70[_0x6cdb('0x3d')],'UserId':_0xe09c70['id'],'queue_name':_0xc03c63[_0x58a665][_0x6cdb('0x3d')],'VoiceQueueId':_0xc03c63[_0x58a665]['id'],'interface':_[_0x6cdb('0x6d')](_0xe09c70['interface'])?util['format']('SIP/%s',_0xe09c70[_0x6cdb('0x3d')]):_0xe09c70[_0x6cdb('0xa2')],'paused':_0xe09c70[_0x6cdb('0xad')]||![],'penalty':_0x5a0d48[_0x6cdb('0x68')][_0x6cdb('0xae')]||0x0});}return Promise['all'](_0xc2b81e[_0x6cdb('0x37')](function(_0x208ecd){return db[_0x6cdb('0xaf')][_0x6cdb('0xb0')](_0x208ecd);}));}return _0x4fab1e;});}})[_0x6cdb('0x1a')](respondWithStatusCode(_0x16685b,null))[_0x6cdb('0x5b')](handleError(_0x16685b,null));};exports['removeQueues']=function(_0x139f4f,_0xcf0107){var _0x5d156e,_0x1e29ae;return db[_0x6cdb('0x40')][_0x6cdb('0x3a')]({'where':{'id':_0x139f4f[_0x6cdb('0x5d')]['id']},'attributes':['id',_0x6cdb('0x3d'),'role']})[_0x6cdb('0x1a')](handleEntityNotFound(_0xcf0107,null))[_0x6cdb('0x1a')](function(_0x3df54f){if(_0x3df54f){_0x5d156e=_0x3df54f;if(!_0x139f4f[_0x6cdb('0x4b')][_0x6cdb('0xb1')]||!utils[_0x6cdb('0xa3')](_0x139f4f['query']['channel'])){throw new db[(_0x6cdb('0x97'))][(_0x6cdb('0x94'))]('Unknown\x20channel');}return _0x3df54f['remove'+_[_0x6cdb('0xa6')](_0x139f4f[_0x6cdb('0x4b')]['channel'][_0x6cdb('0xa7')]())+_0x6cdb('0xa8')](_0x139f4f[_0x6cdb('0x4b')][_0x6cdb('0x6a')]);}})[_0x6cdb('0x1a')](function(_0x45ee1e){if(_[_0x6cdb('0xb2')](_0x139f4f[_0x6cdb('0x4b')][_0x6cdb('0x6a')])){for(var _0x1fdc98=0x0;_0x1fdc98<_0x139f4f[_0x6cdb('0x4b')][_0x6cdb('0x6a')]['length'];_0x1fdc98+=0x1){_0x1e29ae={'UserId':Number(_0x139f4f['params']['id'])};_0x1e29ae[_[_0x6cdb('0xa6')](_0x139f4f['query'][_0x6cdb('0xb1')][_0x6cdb('0xa7')]())+'QueueId']=Number(_0x139f4f['query'][_0x6cdb('0x6a')][_0x1fdc98]);socket['emit'](_0x6cdb('0x33')+_[_0x6cdb('0xa6')](_0x139f4f['query'][_0x6cdb('0xb1')][_0x6cdb('0xa7')]())+_0x6cdb('0xb3'),_0x1e29ae);}}else{_0x1e29ae={'UserId':Number(_0x139f4f['params']['id'])};_0x1e29ae[_['capitalize'](_0x139f4f['query'][_0x6cdb('0xb1')][_0x6cdb('0xa7')]())+_0x6cdb('0xb4')]=Number(_0x139f4f[_0x6cdb('0x4b')]['ids']);socket[_0x6cdb('0x2f')](_0x6cdb('0x33')+_[_0x6cdb('0xa6')](_0x139f4f['query'][_0x6cdb('0xb1')][_0x6cdb('0xa7')]())+_0x6cdb('0xb3'),_0x1e29ae);}return _0x45ee1e;})[_0x6cdb('0x1a')](function(){if(_0x139f4f[_0x6cdb('0x4b')][_0x6cdb('0xb1')]===_0x6cdb('0xac')){return db[_0x6cdb('0xaf')][_0x6cdb('0x31')]({'where':{'UserId':_0x139f4f['params']['id'],'VoiceQueueId':_0x139f4f[_0x6cdb('0x4b')][_0x6cdb('0x6a')]},'individualHooks':!![]})[_0x6cdb('0x1a')](function(){return _0x5d156e;});}return _0x5d156e;})[_0x6cdb('0x1a')](respondWithStatusCode(_0xcf0107,null))[_0x6cdb('0x5b')](handleError(_0xcf0107,null));};exports['addAvatar']=function(_0x5d31b5,_0x1d538f){_0x5d31b5[_0x6cdb('0x68')][_0x6cdb('0xb5')]=_0x5d31b5[_0x6cdb('0xb6')]['filename'];return db['User'][_0x6cdb('0x3a')]({'where':{'id':_0x5d31b5[_0x6cdb('0x5d')]['id']}})[_0x6cdb('0x1a')](handleEntityNotFound(_0x1d538f,null))['then'](saveUpdates(_0x5d31b5['body'],null))[_0x6cdb('0x1a')](respondWithResult(_0x1d538f,null))[_0x6cdb('0x5b')](handleError(_0x1d538f,null));};exports['getAvatar']=function(_0x723de5,_0x52f9fb){var _0x5082ca=path[_0x6cdb('0xb7')](config[_0x6cdb('0xb8')],'server/files/images/logos/default_profile.png');return db['User']['find']({'where':{'id':_0x723de5[_0x6cdb('0x5d')]['id']},'attributes':['id',_0x6cdb('0xb5')],'raw':!![]})[_0x6cdb('0x1a')](handleEntityNotFound(_0x52f9fb,null))[_0x6cdb('0x1a')](function(_0x468d55){if(_0x468d55){if(_[_0x6cdb('0x6d')](_0x468d55[_0x6cdb('0xb5')])){return _0x52f9fb[_0x6cdb('0xb9')](_0x5082ca);}else{if(!fs[_0x6cdb('0xba')](path[_0x6cdb('0xb7')](config[_0x6cdb('0xb8')],_0x6cdb('0xbb'),_0x468d55['userpic']))){return _0x52f9fb['download'](_0x5082ca);}return _0x52f9fb['download'](path[_0x6cdb('0xb7')](config[_0x6cdb('0xb8')],_0x6cdb('0xbb'),_0x468d55[_0x6cdb('0xb5')]));}}})['catch'](handleError(_0x52f9fb,null));};exports[_0x6cdb('0xbc')]=function(_0x3a92c7,_0x8a2dbb){return db[_0x6cdb('0x40')]['find']({'where':{'id':_0x3a92c7[_0x6cdb('0x5d')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x8a2dbb,null))['then'](function(_0x414c71){var _0x22cb7f=[];values=_0x414c71[_0x6cdb('0x55')];_0x22cb7f['push'](get_open_tabs('chat',_0x414c71['dataValues']));_0x22cb7f[_0x6cdb('0x4f')](get_open_tabs(_0x6cdb('0x56'),_0x414c71[_0x6cdb('0x55')]));_0x22cb7f[_0x6cdb('0x4f')](get_open_tabs('openchannel',_0x414c71[_0x6cdb('0x55')]));_0x22cb7f[_0x6cdb('0x4f')](get_open_tabs(_0x6cdb('0x59'),_0x414c71[_0x6cdb('0x55')]));_0x22cb7f[_0x6cdb('0x4f')](get_open_tabs(_0x6cdb('0x67'),_0x414c71[_0x6cdb('0x55')]));_0x22cb7f[_0x6cdb('0x4f')](get_open_tabs(_0x6cdb('0x57'),_0x414c71[_0x6cdb('0x55')]));return Promise[_0x6cdb('0x5a')](_0x22cb7f);})[_0x6cdb('0x1a')](function(_0x27f379){if(_0x27f379){var _0x1fe19f=_[_0x6cdb('0x37')](values['ChatOpenTabs'],function(_0x52feed){return{'channel':_0x6cdb('0xbd'),'id':_0x52feed['id'],'createdAt':_0x52feed['createdAt']};});var _0x1b1682=_['map'](values[_0x6cdb('0xbe')],function(_0x5787c1){return{'channel':_0x6cdb('0xbf'),'id':_0x5787c1['id'],'createdAt':_0x5787c1[_0x6cdb('0xc0')]};});var _0x4fff72=_['map'](values['OpenchannelOpenTabs'],function(_0x5259b5){return{'channel':'OPENCHANNEL','id':_0x5259b5['id'],'createdAt':_0x5259b5[_0x6cdb('0xc0')]};});var _0x323582=_['map'](values[_0x6cdb('0xc1')],function(_0x47d5dd){return{'channel':_0x6cdb('0xc2'),'id':_0x47d5dd['id'],'createdAt':_0x47d5dd[_0x6cdb('0xc0')]};});var _0x38b164=_[_0x6cdb('0x37')](values['SmsOpenTabs'],function(_0x2711c8){return{'channel':_0x6cdb('0xc3'),'id':_0x2711c8['id'],'createdAt':_0x2711c8[_0x6cdb('0xc0')]};});var _0x1f0d87=_[_0x6cdb('0x37')](values[_0x6cdb('0xc4')],function(_0x3a3ce3){return{'channel':_0x6cdb('0xc5'),'id':_0x3a3ce3['id'],'createdAt':_0x3a3ce3[_0x6cdb('0xc0')]};});var _0x320436=_[_0x6cdb('0xc6')](_0x1fe19f,_0x1b1682,_0x4fff72,_0x323582,_0x38b164,_0x1f0d87);var _0x448cee={'count':_0x320436['length'],'rows':_0x320436};return _0x448cee;}else return null;})[_0x6cdb('0x1a')](respondWithResult(_0x8a2dbb,null))[_0x6cdb('0x5b')](handleError(_0x8a2dbb,null));};exports[_0x6cdb('0xc7')]=function(_0x12c5d9,_0x1700fe){var _0x59861c={};return db[_0x6cdb('0x40')][_0x6cdb('0xc8')]({'where':{'id':_0x12c5d9[_0x6cdb('0x5d')]['id']}})[_0x6cdb('0x1a')](function(_0x184c7e){if(!_0x184c7e){throw new APINotFoundError(util[_0x6cdb('0xc9')]('User\x20with\x20id\x20%s\x20not\x20found',_0x12c5d9[_0x6cdb('0x5d')]['id']));}return contacts[_0x6cdb('0xca')]();})[_0x6cdb('0x1a')](function(_0x2e0b21){_0x12c5d9[_0x6cdb('0x4b')][_0x6cdb('0x40')]=_0x12c5d9[_0x6cdb('0x5d')]['id'];_0x59861c=qs[_0x6cdb('0x47')](_0x2e0b21,_0x12c5d9);if(_0x12c5d9[_0x6cdb('0x4b')][_0x6cdb('0xcb')](_0x6cdb('0x49'))){_0x59861c['include']=[{'model':db[_0x6cdb('0xcc')],'as':_0x6cdb('0xcd'),'required':![]},{'model':db[_0x6cdb('0xce')],'as':_0x6cdb('0xcf'),'attributes':['id',_0x6cdb('0x3d'),'color'],'where':_0x12c5d9[_0x6cdb('0x4b')][_0x6cdb('0xd0')]?{'id':_0x12c5d9[_0x6cdb('0x4b')][_0x6cdb('0xd0')]}:undefined,'required':_0x12c5d9['query']['tag']?!![]:![]}];}return contacts[_0x6cdb('0x50')](_0x12c5d9[_0x6cdb('0x4b')],_0x12c5d9['user'],_0x59861c,_0x2e0b21);})[_0x6cdb('0x1a')](respondWithFilteredResult(_0x1700fe,_0x59861c))[_0x6cdb('0x5b')](APIHandleError(_0x1700fe));};exports[_0x6cdb('0xd1')]=function(_0x585bcf,_0xf631d7){var _0x15db55;var _0xe44ddf={};var _0x4bf28e;return db[_0x6cdb('0x40')][_0x6cdb('0xc8')]({'where':{'id':_0x585bcf[_0x6cdb('0x5d')]['id']},'attributes':['id','name',_0x6cdb('0x2d')]})[_0x6cdb('0x1a')](handleEntityNotFound(_0xf631d7,null))[_0x6cdb('0x1a')](function(_0x21c45b){if(!utils[_0x6cdb('0xa3')](_0x585bcf[_0x6cdb('0x4b')]['channel'])){throw new db[(_0x6cdb('0x97'))][(_0x6cdb('0x94'))](_0x6cdb('0xa4'));}_0x15db55=_0x21c45b;var _0x42171b={};_0x42171b[_0x6cdb('0x5e')]=_[_0x6cdb('0x60')](db[_[_0x6cdb('0xa6')](_0x585bcf[_0x6cdb('0x4b')]['channel'])+_0x6cdb('0xd2')][_0x6cdb('0x41')]);_0x42171b[_0x6cdb('0x4b')]=_[_0x6cdb('0x60')](_0x585bcf[_0x6cdb('0x4b')]);_0x42171b[_0x6cdb('0x61')]=_[_0x6cdb('0x62')](_0x42171b[_0x6cdb('0x5e')],_0x42171b[_0x6cdb('0x4b')]);_0xe44ddf[_0x6cdb('0x63')]=_[_0x6cdb('0x62')](_0x42171b[_0x6cdb('0x5e')],qs[_0x6cdb('0x64')](_0x585bcf[_0x6cdb('0x4b')][_0x6cdb('0x64')]));_0xe44ddf['attributes']=_0xe44ddf[_0x6cdb('0x63')][_0x6cdb('0x53')]?_0xe44ddf[_0x6cdb('0x63')]:_0x42171b['model'];_0xe44ddf[_0x6cdb('0xd3')]=qs[_0x6cdb('0xd4')](_0x585bcf[_0x6cdb('0x4b')]['sort']);_0xe44ddf['where']=qs['filters'](_[_0x6cdb('0xd5')](_0x585bcf[_0x6cdb('0x4b')],_0x42171b[_0x6cdb('0x61')]));if(_0x585bcf[_0x6cdb('0x4b')]['filter']){_0xe44ddf[_0x6cdb('0x48')]=_['merge'](_0xe44ddf[_0x6cdb('0x48')],{'$or':_[_0x6cdb('0x37')](_0xe44ddf['attributes'],function(_0x1ac13d){var _0x4993a3={};_0x4993a3[_0x1ac13d]={'$like':'%'+_0x585bcf[_0x6cdb('0x4b')][_0x6cdb('0x35')]+'%'};return _0x4993a3;})});}_0xe44ddf=_[_0x6cdb('0x65')]({},_0xe44ddf,_0x585bcf['options']);switch(_0x15db55[_0x6cdb('0x2d')]){case'admin':return db[_[_0x6cdb('0xa6')](_0x585bcf[_0x6cdb('0x4b')][_0x6cdb('0xb1')])+'Queue'][_0x6cdb('0x50')](_0xe44ddf);case'user':case _0x6cdb('0x2e'):return _0x15db55[_0x6cdb('0xab')+_[_0x6cdb('0xa6')](_0x585bcf['query'][_0x6cdb('0xb1')])+'Queues'](_0xe44ddf);default:throw new db['Sequelize']['ValidationError'](_0x6cdb('0xd6'));}})[_0x6cdb('0x1a')](function(_0x4580af){_0x4bf28e=_0x4580af[_0x6cdb('0x53')];if(!_0x585bcf[_0x6cdb('0x4b')][_0x6cdb('0xcb')](_0x6cdb('0xd7'))){_0xe44ddf[_0x6cdb('0xd8')]=qs[_0x6cdb('0xd8')](_0x585bcf[_0x6cdb('0x4b')]['limit']);_0xe44ddf[_0x6cdb('0x29')]=qs[_0x6cdb('0x29')](_0x585bcf[_0x6cdb('0x4b')][_0x6cdb('0x29')]);}switch(_0x15db55[_0x6cdb('0x2d')]){case _0x6cdb('0x32'):return db[_[_0x6cdb('0xa6')](_0x585bcf[_0x6cdb('0x4b')][_0x6cdb('0xb1')])+_0x6cdb('0xd2')][_0x6cdb('0x50')](_0xe44ddf);case _0x6cdb('0x33'):case _0x6cdb('0x2e'):return _0x15db55[_0x6cdb('0xab')+_[_0x6cdb('0xa6')](_0x585bcf['query'][_0x6cdb('0xb1')])+_0x6cdb('0xa8')](_0xe44ddf);}})['then'](function(_0x4934b4){return{'count':_0x4bf28e,'rows':_0x4934b4};})[_0x6cdb('0x1a')](respondWithResult(_0xf631d7,null))[_0x6cdb('0x5b')](handleError(_0xf631d7,null));};exports['getVoiceQueuesRt']=function(_0x120599,_0xab1156){var _0x17eeee={};var _0x4af817={};var _0x56df88;var _0x5cfba7;return db[_0x6cdb('0x40')][_0x6cdb('0xc8')]({'where':{'id':_0x120599[_0x6cdb('0x5d')]['id']}})[_0x6cdb('0x1a')](handleEntityNotFound(_0xab1156,null))[_0x6cdb('0x1a')](function(_0xebd1e1){if(_0xebd1e1){_0x56df88=_0xebd1e1;_0x4af817[_0x6cdb('0x5e')]=_[_0x6cdb('0x60')](db[_0x6cdb('0xaf')]['rawAttributes']);_0x4af817[_0x6cdb('0x4b')]=_[_0x6cdb('0x60')](_0x120599[_0x6cdb('0x4b')]);_0x4af817[_0x6cdb('0x61')]=_[_0x6cdb('0x62')](_0x4af817[_0x6cdb('0x5e')],_0x4af817[_0x6cdb('0x4b')]);_0x17eeee['attributes']=_['intersection'](_0x4af817['model'],qs[_0x6cdb('0x64')](_0x120599[_0x6cdb('0x4b')]['fields']));_0x17eeee[_0x6cdb('0x63')]=_0x17eeee[_0x6cdb('0x63')][_0x6cdb('0x53')]?_0x17eeee['attributes']:_0x4af817['model'];_0x17eeee['order']=qs[_0x6cdb('0xd4')](_0x120599[_0x6cdb('0x4b')][_0x6cdb('0xd4')]);_0x17eeee[_0x6cdb('0x48')]=qs[_0x6cdb('0x61')](_['pick'](_0x120599[_0x6cdb('0x4b')],_0x4af817['filters']));if(_0x120599['query'][_0x6cdb('0x35')]){_0x17eeee[_0x6cdb('0x48')]=_['merge'](_0x17eeee['where'],{'$or':_[_0x6cdb('0x37')](_0x17eeee[_0x6cdb('0x63')],function(_0x881e0a){var _0x40f3c3={};_0x40f3c3[_0x881e0a]={'$like':'%'+_0x120599['query']['filter']+'%'};return _0x40f3c3;})});}_0x17eeee=_[_0x6cdb('0x65')]({},_0x17eeee,_0x120599[_0x6cdb('0x66')]);return _0x56df88[_0x6cdb('0xd9')](_0x17eeee);}})[_0x6cdb('0x1a')](function(_0x1310a5){if(_0x1310a5){_0x5cfba7=_0x1310a5[_0x6cdb('0x53')];if(!_0x120599['query'][_0x6cdb('0xcb')](_0x6cdb('0xd7'))){_0x17eeee[_0x6cdb('0xd8')]=qs['limit'](_0x120599[_0x6cdb('0x4b')][_0x6cdb('0xd8')]);_0x17eeee[_0x6cdb('0x29')]=qs[_0x6cdb('0x29')](_0x120599[_0x6cdb('0x4b')][_0x6cdb('0x29')]);}return _0x56df88[_0x6cdb('0xd9')](_0x17eeee);}})[_0x6cdb('0x1a')](function(_0x50955e){if(_0x50955e){return _0x50955e?{'count':_0x5cfba7,'rows':_0x50955e}:null;}})['then'](respondWithResult(_0xab1156,null))[_0x6cdb('0x5b')](handleError(_0xab1156,null));};exports[_0x6cdb('0xda')]=function(_0x40737b,_0x4dc899){var _0x282bd4={};var _0x212848={};var _0x10385a;var _0x95c942;return db[_0x6cdb('0x40')][_0x6cdb('0xc8')]({'where':{'id':_0x40737b[_0x6cdb('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4dc899,null))[_0x6cdb('0x1a')](function(_0x56f628){if(_0x56f628){_0x10385a=_0x56f628;_0x212848[_0x6cdb('0x5e')]=_[_0x6cdb('0x60')](db['ChatGroup'][_0x6cdb('0x41')]);_0x212848[_0x6cdb('0x4b')]=_[_0x6cdb('0x60')](_0x40737b[_0x6cdb('0x4b')]);_0x212848[_0x6cdb('0x61')]=_['intersection'](_0x212848[_0x6cdb('0x5e')],_0x212848['query']);_0x282bd4[_0x6cdb('0x63')]=_[_0x6cdb('0x62')](_0x212848[_0x6cdb('0x5e')],qs[_0x6cdb('0x64')](_0x40737b['query'][_0x6cdb('0x64')]));_0x282bd4[_0x6cdb('0x63')]=_0x282bd4[_0x6cdb('0x63')][_0x6cdb('0x53')]?_0x282bd4[_0x6cdb('0x63')]:_0x212848['model'];_0x282bd4[_0x6cdb('0xd3')]=qs[_0x6cdb('0xd4')](_0x40737b[_0x6cdb('0x4b')][_0x6cdb('0xd4')]);_0x282bd4['where']=qs[_0x6cdb('0x61')](_['pick'](_0x40737b[_0x6cdb('0x4b')],_0x212848['filters']));if(_0x40737b[_0x6cdb('0x4b')][_0x6cdb('0x35')]){_0x282bd4[_0x6cdb('0x48')]=_[_0x6cdb('0x65')](_0x282bd4[_0x6cdb('0x48')],{'$or':_['map'](_0x282bd4[_0x6cdb('0x63')],function(_0x49986a){var _0xe29176={};_0xe29176[_0x49986a]={'$like':'%'+_0x40737b['query'][_0x6cdb('0x35')]+'%'};return _0xe29176;})});}_0x282bd4=_[_0x6cdb('0x65')]({},_0x282bd4,_0x40737b[_0x6cdb('0x66')]);return _0x10385a['getGroups'](_0x282bd4);}})[_0x6cdb('0x1a')](function(_0x4d8223){if(_0x4d8223){_0x95c942=_0x4d8223[_0x6cdb('0x53')];if(!_0x40737b['query'][_0x6cdb('0xcb')](_0x6cdb('0xd7'))){_0x282bd4[_0x6cdb('0xd8')]=qs[_0x6cdb('0xd8')](_0x40737b[_0x6cdb('0x4b')][_0x6cdb('0xd8')]);_0x282bd4[_0x6cdb('0x29')]=qs['offset'](_0x40737b[_0x6cdb('0x4b')]['offset']);}return _0x10385a[_0x6cdb('0xda')](_0x282bd4);}})[_0x6cdb('0x1a')](function(_0x371dae){if(_0x371dae){return _0x371dae?{'count':_0x95c942,'rows':_0x371dae}:null;}})[_0x6cdb('0x1a')](respondWithResult(_0x4dc899,null))[_0x6cdb('0x5b')](handleError(_0x4dc899,null));};exports[_0x6cdb('0xdb')]=function(_0x468c19,_0x46432e){var _0x1f8e52={'raw':!![],'where':{}};var _0x5abfe1={};var _0x7b2e2f={'count':0x0,'rows':[]};return db[_0x6cdb('0x40')][_0x6cdb('0xc8')]({'where':{'id':_0x468c19[_0x6cdb('0x5d')]['id']}})[_0x6cdb('0x1a')](handleEntityNotFound(_0x46432e,null))[_0x6cdb('0x1a')](function(_0x5476ed){if(_0x5476ed){_0x5abfe1[_0x6cdb('0x5e')]=_[_0x6cdb('0x60')](db[_0x6cdb('0xdc')][_0x6cdb('0x41')]);_0x5abfe1['query']=_[_0x6cdb('0x60')](_0x468c19['query']);_0x5abfe1[_0x6cdb('0x61')]=_['intersection'](_0x5abfe1['model'],_0x5abfe1[_0x6cdb('0x4b')]);_0x1f8e52['attributes']=_['intersection'](_0x5abfe1[_0x6cdb('0x5e')],qs['fields'](_0x468c19['query'][_0x6cdb('0x64')]));_0x1f8e52[_0x6cdb('0x63')]=_0x1f8e52[_0x6cdb('0x63')][_0x6cdb('0x53')]?_0x1f8e52[_0x6cdb('0x63')]:_0x5abfe1[_0x6cdb('0x5e')];if(!_0x468c19[_0x6cdb('0x4b')]['hasOwnProperty'](_0x6cdb('0xd7'))){_0x1f8e52[_0x6cdb('0xd8')]=qs[_0x6cdb('0xd8')](_0x468c19['query'][_0x6cdb('0xd8')]);_0x1f8e52['offset']=qs[_0x6cdb('0x29')](_0x468c19[_0x6cdb('0x4b')][_0x6cdb('0x29')]);}_0x1f8e52[_0x6cdb('0xd3')]=qs[_0x6cdb('0xd4')](_0x468c19[_0x6cdb('0x4b')]['sort']);_0x1f8e52[_0x6cdb('0x48')]=qs[_0x6cdb('0x61')](_[_0x6cdb('0xd5')](_0x468c19[_0x6cdb('0x4b')],_0x5abfe1['filters']));_0x1f8e52[_0x6cdb('0x48')][_0x6cdb('0xdd')]=_0x5476ed['id'];if(_0x468c19[_0x6cdb('0x4b')][_0x6cdb('0x35')]){_0x1f8e52[_0x6cdb('0x48')]=_[_0x6cdb('0x65')](_0x1f8e52[_0x6cdb('0x48')],{'$or':_[_0x6cdb('0x37')](_0x1f8e52[_0x6cdb('0x63')],function(_0x3801b2){var _0x410864={};_0x410864[_0x3801b2]={'$like':'%'+_0x468c19[_0x6cdb('0x4b')]['filter']+'%'};return _0x410864;})});}_0x1f8e52=_['merge']({},_0x1f8e52,_0x468c19[_0x6cdb('0x66')]);return db['VoiceRecording']['count']({'where':_0x1f8e52['where']})['then'](function(_0x4f4d1a){_0x7b2e2f[_0x6cdb('0x28')]=_0x4f4d1a;if(_0x468c19[_0x6cdb('0x4b')][_0x6cdb('0x49')]){_0x1f8e52[_0x6cdb('0x4a')]=[{'all':!![]}];}return db[_0x6cdb('0xdc')]['findAll'](_0x1f8e52);})[_0x6cdb('0x1a')](function(_0x1acd95){_0x7b2e2f[_0x6cdb('0x51')]=_0x1acd95;return _0x7b2e2f;});}})[_0x6cdb('0x1a')](respondWithFilteredResult(_0x46432e,_0x1f8e52))[_0x6cdb('0x5b')](handleError(_0x46432e,null));};exports[_0x6cdb('0xde')]=function(_0x249d98,_0x468a7e){var _0x4eaba7={'raw':!![],'where':{}};var _0x219932={};var _0x421024={'count':0x0,'rows':[]};return db[_0x6cdb('0x40')][_0x6cdb('0xc8')]({'where':{'id':_0x249d98[_0x6cdb('0x5d')]['id']}})[_0x6cdb('0x1a')](handleEntityNotFound(_0x468a7e,null))['then'](function(_0x4a6e13){if(_0x4a6e13){_0x219932[_0x6cdb('0x5e')]=_[_0x6cdb('0x60')](db['ScreenRecording'][_0x6cdb('0x41')]);_0x219932['query']=_[_0x6cdb('0x60')](_0x249d98[_0x6cdb('0x4b')]);_0x219932['filters']=_[_0x6cdb('0x62')](_0x219932[_0x6cdb('0x5e')],_0x219932[_0x6cdb('0x4b')]);_0x4eaba7[_0x6cdb('0x63')]=_[_0x6cdb('0x62')](_0x219932[_0x6cdb('0x5e')],qs['fields'](_0x249d98['query']['fields']));_0x4eaba7[_0x6cdb('0x63')]=_0x4eaba7[_0x6cdb('0x63')][_0x6cdb('0x53')]?_0x4eaba7['attributes']:_0x219932[_0x6cdb('0x5e')];if(!_0x249d98[_0x6cdb('0x4b')][_0x6cdb('0xcb')](_0x6cdb('0xd7'))){_0x4eaba7[_0x6cdb('0xd8')]=qs[_0x6cdb('0xd8')](_0x249d98[_0x6cdb('0x4b')][_0x6cdb('0xd8')]);_0x4eaba7['offset']=qs['offset'](_0x249d98[_0x6cdb('0x4b')][_0x6cdb('0x29')]);}_0x4eaba7[_0x6cdb('0xd3')]=qs[_0x6cdb('0xd4')](_0x249d98['query'][_0x6cdb('0xd4')]);_0x4eaba7[_0x6cdb('0x48')]=qs['filters'](_[_0x6cdb('0xd5')](_0x249d98[_0x6cdb('0x4b')],_0x219932[_0x6cdb('0x61')]));_0x4eaba7[_0x6cdb('0x48')][_0x6cdb('0xdd')]=_0x4a6e13['id'];if(_0x249d98[_0x6cdb('0x4b')][_0x6cdb('0x35')]){_0x4eaba7[_0x6cdb('0x48')]=_['merge'](_0x4eaba7['where'],{'$or':_[_0x6cdb('0x37')](_0x4eaba7[_0x6cdb('0x63')],function(_0x302297){var _0xc65afc={};_0xc65afc[_0x302297]={'$like':'%'+_0x249d98[_0x6cdb('0x4b')][_0x6cdb('0x35')]+'%'};return _0xc65afc;})});}_0x4eaba7=_[_0x6cdb('0x65')]({},_0x4eaba7,_0x249d98[_0x6cdb('0x66')]);return db[_0x6cdb('0xdf')]['count']({'where':_0x4eaba7[_0x6cdb('0x48')]})[_0x6cdb('0x1a')](function(_0x149589){_0x421024[_0x6cdb('0x28')]=_0x149589;if(_0x249d98[_0x6cdb('0x4b')][_0x6cdb('0x49')]){_0x4eaba7['include']=[{'all':!![]}];}return db[_0x6cdb('0xdf')][_0x6cdb('0x50')](_0x4eaba7);})['then'](function(_0x574b8f){_0x421024[_0x6cdb('0x51')]=_0x574b8f;return _0x421024;});}})['then'](respondWithFilteredResult(_0x468a7e,_0x4eaba7))[_0x6cdb('0x5b')](handleError(_0x468a7e,null));};exports[_0x6cdb('0xe0')]=function(_0x1af156,_0x670b2b){var _0x4d8229={};var _0x32f74c={};var _0x222fed;var _0x5b9f03;return db[_0x6cdb('0x40')][_0x6cdb('0xc8')]({'where':{'id':_0x1af156[_0x6cdb('0x5d')]['id']}})[_0x6cdb('0x1a')](handleEntityNotFound(_0x670b2b,null))['then'](function(_0x2b6b86){if(_0x2b6b86){_0x222fed=_0x2b6b86;_0x32f74c['model']=_[_0x6cdb('0x60')](db['ChatInteraction'][_0x6cdb('0x41')]);_0x32f74c['query']=_['keys'](_0x1af156['query']);_0x32f74c['filters']=_['intersection'](_0x32f74c[_0x6cdb('0x5e')],_0x32f74c[_0x6cdb('0x4b')]);_0x4d8229['attributes']=_['intersection'](_0x32f74c[_0x6cdb('0x5e')],qs[_0x6cdb('0x64')](_0x1af156[_0x6cdb('0x4b')][_0x6cdb('0x64')]));_0x4d8229[_0x6cdb('0x63')]=_0x4d8229[_0x6cdb('0x63')][_0x6cdb('0x53')]?_0x4d8229[_0x6cdb('0x63')]:_0x32f74c[_0x6cdb('0x5e')];_0x4d8229[_0x6cdb('0xd3')]=qs[_0x6cdb('0xd4')](_0x1af156[_0x6cdb('0x4b')][_0x6cdb('0xd4')]);_0x4d8229[_0x6cdb('0x48')]=qs['filters'](_[_0x6cdb('0xd5')](_0x1af156[_0x6cdb('0x4b')],_0x32f74c[_0x6cdb('0x61')]));if(_0x1af156[_0x6cdb('0x4b')][_0x6cdb('0x35')]){_0x4d8229[_0x6cdb('0x48')]=_[_0x6cdb('0x65')](_0x4d8229['where'],{'$or':_[_0x6cdb('0x37')](_0x4d8229[_0x6cdb('0x63')],function(_0x2bf681){var _0x105820={};_0x105820[_0x2bf681]={'$like':'%'+_0x1af156[_0x6cdb('0x4b')]['filter']+'%'};return _0x105820;})});}_0x4d8229=_[_0x6cdb('0x65')]({},_0x4d8229,_0x1af156[_0x6cdb('0x66')]);return _0x222fed['getChatInteractions'](_0x4d8229);}})[_0x6cdb('0x1a')](function(_0x5376bc){if(_0x5376bc){_0x5b9f03=_0x5376bc[_0x6cdb('0x53')];if(!_0x1af156[_0x6cdb('0x4b')][_0x6cdb('0xcb')]('nolimit')){_0x4d8229[_0x6cdb('0xd8')]=qs[_0x6cdb('0xd8')](_0x1af156[_0x6cdb('0x4b')][_0x6cdb('0xd8')]);_0x4d8229['offset']=qs['offset'](_0x1af156['query']['offset']);}return _0x222fed['getChatInteractions'](_0x4d8229);}})[_0x6cdb('0x1a')](function(_0x4a754b){if(_0x4a754b){return _0x4a754b?{'count':_0x5b9f03,'rows':_0x4a754b}:null;}})['then'](respondWithResult(_0x670b2b,null))[_0x6cdb('0x5b')](handleError(_0x670b2b,null));};exports['getOpenchannelInteractions']=function(_0x4eba2,_0x567f2c){var _0x246b5e={};var _0x34aead={};var _0x5b0255;var _0x438ca2;return db['User'][_0x6cdb('0xc8')]({'where':{'id':_0x4eba2[_0x6cdb('0x5d')]['id']}})[_0x6cdb('0x1a')](handleEntityNotFound(_0x567f2c,null))[_0x6cdb('0x1a')](function(_0x5668c3){if(_0x5668c3){_0x5b0255=_0x5668c3;_0x34aead[_0x6cdb('0x5e')]=_['keys'](db[_0x6cdb('0xe1')]['rawAttributes']);_0x34aead[_0x6cdb('0x4b')]=_[_0x6cdb('0x60')](_0x4eba2[_0x6cdb('0x4b')]);_0x34aead[_0x6cdb('0x61')]=_['intersection'](_0x34aead[_0x6cdb('0x5e')],_0x34aead[_0x6cdb('0x4b')]);_0x246b5e[_0x6cdb('0x63')]=_['intersection'](_0x34aead[_0x6cdb('0x5e')],qs[_0x6cdb('0x64')](_0x4eba2[_0x6cdb('0x4b')][_0x6cdb('0x64')]));_0x246b5e[_0x6cdb('0x63')]=_0x246b5e[_0x6cdb('0x63')][_0x6cdb('0x53')]?_0x246b5e[_0x6cdb('0x63')]:_0x34aead[_0x6cdb('0x5e')];_0x246b5e[_0x6cdb('0xd3')]=qs[_0x6cdb('0xd4')](_0x4eba2[_0x6cdb('0x4b')][_0x6cdb('0xd4')]);_0x246b5e[_0x6cdb('0x48')]=qs[_0x6cdb('0x61')](_['pick'](_0x4eba2[_0x6cdb('0x4b')],_0x34aead[_0x6cdb('0x61')]));if(_0x4eba2['query'][_0x6cdb('0x35')]){_0x246b5e[_0x6cdb('0x48')]=_['merge'](_0x246b5e[_0x6cdb('0x48')],{'$or':_[_0x6cdb('0x37')](_0x246b5e[_0x6cdb('0x63')],function(_0x4ec9ec){var _0x3634b9={};_0x3634b9[_0x4ec9ec]={'$like':'%'+_0x4eba2[_0x6cdb('0x4b')][_0x6cdb('0x35')]+'%'};return _0x3634b9;})});}_0x246b5e=_[_0x6cdb('0x65')]({},_0x246b5e,_0x4eba2['options']);return _0x5b0255[_0x6cdb('0xe2')](_0x246b5e);}})['then'](function(_0x5c443f){if(_0x5c443f){_0x438ca2=_0x5c443f[_0x6cdb('0x53')];if(!_0x4eba2['query'][_0x6cdb('0xcb')](_0x6cdb('0xd7'))){_0x246b5e[_0x6cdb('0xd8')]=qs[_0x6cdb('0xd8')](_0x4eba2[_0x6cdb('0x4b')][_0x6cdb('0xd8')]);_0x246b5e[_0x6cdb('0x29')]=qs[_0x6cdb('0x29')](_0x4eba2[_0x6cdb('0x4b')][_0x6cdb('0x29')]);}return _0x5b0255[_0x6cdb('0xe2')](_0x246b5e);}})[_0x6cdb('0x1a')](function(_0x1e571c){if(_0x1e571c){return _0x1e571c?{'count':_0x438ca2,'rows':_0x1e571c}:null;}})[_0x6cdb('0x1a')](respondWithResult(_0x567f2c,null))[_0x6cdb('0x5b')](handleError(_0x567f2c,null));};exports[_0x6cdb('0xe3')]=function(_0x3c1a90,_0x3695b1){var _0x1bb17c={'raw':!![],'where':{}};var _0x7a3abc={};var _0x179eca={'count':0x0,'rows':[]};return db[_0x6cdb('0x40')][_0x6cdb('0xc8')]({'where':{'id':_0x3c1a90[_0x6cdb('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3695b1,null))['then'](function(_0x3b4e61){if(_0x3b4e61){_0x7a3abc[_0x6cdb('0x5e')]=_[_0x6cdb('0x60')](db[_0x6cdb('0xe4')][_0x6cdb('0x41')]);_0x7a3abc[_0x6cdb('0x4b')]=_[_0x6cdb('0x60')](_0x3c1a90[_0x6cdb('0x4b')]);_0x7a3abc[_0x6cdb('0x61')]=_[_0x6cdb('0x62')](_0x7a3abc[_0x6cdb('0x5e')],_0x7a3abc[_0x6cdb('0x4b')]);_0x1bb17c[_0x6cdb('0x63')]=_[_0x6cdb('0x62')](_0x7a3abc['model'],qs['fields'](_0x3c1a90[_0x6cdb('0x4b')][_0x6cdb('0x64')]));_0x1bb17c[_0x6cdb('0x63')]=_0x1bb17c['attributes']['length']?_0x1bb17c[_0x6cdb('0x63')]:_0x7a3abc[_0x6cdb('0x5e')];if(!_0x3c1a90[_0x6cdb('0x4b')][_0x6cdb('0xcb')](_0x6cdb('0xd7'))){_0x1bb17c[_0x6cdb('0xd8')]=qs[_0x6cdb('0xd8')](_0x3c1a90[_0x6cdb('0x4b')][_0x6cdb('0xd8')]);_0x1bb17c[_0x6cdb('0x29')]=qs[_0x6cdb('0x29')](_0x3c1a90['query'][_0x6cdb('0x29')]);}_0x1bb17c[_0x6cdb('0xd3')]=qs[_0x6cdb('0xd4')](_0x3c1a90['query']['sort']);_0x1bb17c[_0x6cdb('0x48')]=qs[_0x6cdb('0x61')](_[_0x6cdb('0xd5')](_0x3c1a90[_0x6cdb('0x4b')],_0x7a3abc['filters']));_0x1bb17c[_0x6cdb('0x48')]['UserId']=_0x3b4e61['id'];if(_0x3c1a90[_0x6cdb('0x4b')]['filter']){_0x1bb17c[_0x6cdb('0x48')]=_[_0x6cdb('0x65')](_0x1bb17c[_0x6cdb('0x48')],{'$or':_[_0x6cdb('0x37')](_0x1bb17c[_0x6cdb('0x63')],function(_0x2b51d2){var _0x57ace5={};_0x57ace5[_0x2b51d2]={'$like':'%'+_0x3c1a90['query'][_0x6cdb('0x35')]+'%'};return _0x57ace5;})});}_0x1bb17c=_[_0x6cdb('0x65')]({},_0x1bb17c,_0x3c1a90[_0x6cdb('0x66')]);return db['MailInteraction'][_0x6cdb('0x28')]({'where':_0x1bb17c[_0x6cdb('0x48')]})[_0x6cdb('0x1a')](function(_0xcc6cc5){_0x179eca['count']=_0xcc6cc5;if(_0x3c1a90[_0x6cdb('0x4b')][_0x6cdb('0x49')]){_0x1bb17c[_0x6cdb('0x4a')]=[{'all':!![]}];}return db['MailInteraction'][_0x6cdb('0x50')](_0x1bb17c);})[_0x6cdb('0x1a')](function(_0x266365){_0x179eca['rows']=_0x266365;return _0x179eca;});}})[_0x6cdb('0x1a')](respondWithFilteredResult(_0x3695b1,_0x1bb17c))[_0x6cdb('0x5b')](handleError(_0x3695b1,null));};exports[_0x6cdb('0xe5')]=function(_0x4c7f02,_0x16870d){var _0x497e53={};var _0x1674a5={};var _0x54eac4;var _0x5b52bb;return db[_0x6cdb('0x40')]['findOne']({'where':{'id':_0x4c7f02[_0x6cdb('0x5d')]['id']}})[_0x6cdb('0x1a')](handleEntityNotFound(_0x16870d,null))[_0x6cdb('0x1a')](function(_0x55554c){if(_0x55554c){_0x54eac4=_0x55554c;_0x1674a5[_0x6cdb('0x5e')]=_[_0x6cdb('0x60')](db[_0x6cdb('0xe6')][_0x6cdb('0x41')]);_0x1674a5[_0x6cdb('0x4b')]=_[_0x6cdb('0x60')](_0x4c7f02[_0x6cdb('0x4b')]);_0x1674a5[_0x6cdb('0x61')]=_['intersection'](_0x1674a5['model'],_0x1674a5[_0x6cdb('0x4b')]);_0x497e53[_0x6cdb('0x63')]=_['intersection'](_0x1674a5[_0x6cdb('0x5e')],qs[_0x6cdb('0x64')](_0x4c7f02['query']['fields']));_0x497e53['attributes']=_0x497e53[_0x6cdb('0x63')][_0x6cdb('0x53')]?_0x497e53[_0x6cdb('0x63')]:_0x1674a5[_0x6cdb('0x5e')];_0x497e53['order']=qs[_0x6cdb('0xd4')](_0x4c7f02[_0x6cdb('0x4b')]['sort']);_0x497e53[_0x6cdb('0x48')]=qs[_0x6cdb('0x61')](_[_0x6cdb('0xd5')](_0x4c7f02[_0x6cdb('0x4b')],_0x1674a5['filters']));if(_0x4c7f02[_0x6cdb('0x4b')][_0x6cdb('0x35')]){_0x497e53[_0x6cdb('0x48')]=_[_0x6cdb('0x65')](_0x497e53[_0x6cdb('0x48')],{'$or':_['map'](_0x497e53[_0x6cdb('0x63')],function(_0x1dedb1){var _0x48c8f3={};_0x48c8f3[_0x1dedb1]={'$like':'%'+_0x4c7f02[_0x6cdb('0x4b')]['filter']+'%'};return _0x48c8f3;})});}_0x497e53=_[_0x6cdb('0x65')]({},_0x497e53,_0x4c7f02[_0x6cdb('0x66')]);return _0x54eac4[_0x6cdb('0xe5')](_0x497e53);}})[_0x6cdb('0x1a')](function(_0x2bd85e){if(_0x2bd85e){_0x5b52bb=_0x2bd85e[_0x6cdb('0x53')];if(!_0x4c7f02[_0x6cdb('0x4b')][_0x6cdb('0xcb')](_0x6cdb('0xd7'))){_0x497e53[_0x6cdb('0xd8')]=qs['limit'](_0x4c7f02[_0x6cdb('0x4b')]['limit']);_0x497e53[_0x6cdb('0x29')]=qs[_0x6cdb('0x29')](_0x4c7f02['query']['offset']);}return _0x54eac4[_0x6cdb('0xe5')](_0x497e53);}})[_0x6cdb('0x1a')](function(_0xf6f883){if(_0xf6f883){return _0xf6f883?{'count':_0x5b52bb,'rows':_0xf6f883}:null;}})[_0x6cdb('0x1a')](respondWithResult(_0x16870d,null))[_0x6cdb('0x5b')](handleError(_0x16870d,null));};exports[_0x6cdb('0xe7')]=function(_0x5c83dd,_0x231945){var _0x438b9c={};var _0x5b995a={};var _0x5b34fc;var _0x1fd395;return db[_0x6cdb('0x40')][_0x6cdb('0xc8')]({'where':{'id':_0x5c83dd[_0x6cdb('0x5d')]['id']}})[_0x6cdb('0x1a')](handleEntityNotFound(_0x231945,null))['then'](function(_0x565d20){if(_0x565d20){_0x5b34fc=_0x565d20;_0x5b995a[_0x6cdb('0x5e')]=_[_0x6cdb('0x60')](db[_0x6cdb('0xe8')][_0x6cdb('0x41')]);_0x5b995a[_0x6cdb('0x4b')]=_['keys'](_0x5c83dd[_0x6cdb('0x4b')]);_0x5b995a[_0x6cdb('0x61')]=_[_0x6cdb('0x62')](_0x5b995a['model'],_0x5b995a[_0x6cdb('0x4b')]);_0x438b9c[_0x6cdb('0x63')]=_['intersection'](_0x5b995a[_0x6cdb('0x5e')],qs[_0x6cdb('0x64')](_0x5c83dd['query'][_0x6cdb('0x64')]));_0x438b9c[_0x6cdb('0x63')]=_0x438b9c[_0x6cdb('0x63')]['length']?_0x438b9c[_0x6cdb('0x63')]:_0x5b995a[_0x6cdb('0x5e')];_0x438b9c[_0x6cdb('0xd3')]=qs[_0x6cdb('0xd4')](_0x5c83dd['query'][_0x6cdb('0xd4')]);_0x438b9c[_0x6cdb('0x48')]=qs[_0x6cdb('0x61')](_[_0x6cdb('0xd5')](_0x5c83dd['query'],_0x5b995a[_0x6cdb('0x61')]));if(_0x5c83dd[_0x6cdb('0x4b')]['filter']){_0x438b9c['where']=_[_0x6cdb('0x65')](_0x438b9c[_0x6cdb('0x48')],{'$or':_[_0x6cdb('0x37')](_0x438b9c['attributes'],function(_0x3b81f0){var _0xdead65={};_0xdead65[_0x3b81f0]={'$like':'%'+_0x5c83dd[_0x6cdb('0x4b')]['filter']+'%'};return _0xdead65;})});}_0x438b9c=_['merge']({},_0x438b9c,_0x5c83dd[_0x6cdb('0x66')]);return _0x5b34fc[_0x6cdb('0xe7')](_0x438b9c);}})[_0x6cdb('0x1a')](function(_0x4097cf){if(_0x4097cf){_0x1fd395=_0x4097cf[_0x6cdb('0x53')];if(!_0x5c83dd[_0x6cdb('0x4b')]['hasOwnProperty'](_0x6cdb('0xd7'))){_0x438b9c[_0x6cdb('0xd8')]=qs['limit'](_0x5c83dd[_0x6cdb('0x4b')][_0x6cdb('0xd8')]);_0x438b9c[_0x6cdb('0x29')]=qs[_0x6cdb('0x29')](_0x5c83dd[_0x6cdb('0x4b')][_0x6cdb('0x29')]);}return _0x5b34fc['getFaxInteractions'](_0x438b9c);}})[_0x6cdb('0x1a')](function(_0x474fb0){if(_0x474fb0){return _0x474fb0?{'count':_0x1fd395,'rows':_0x474fb0}:null;}})[_0x6cdb('0x1a')](respondWithResult(_0x231945,null))[_0x6cdb('0x5b')](handleError(_0x231945,null));};exports['getWhatsappInteractions']=function(_0x32ebc2,_0x3a7273){var _0x3052b2={};var _0x475534={};var _0x336912;var _0xdc8bf2;return db['User'][_0x6cdb('0xc8')]({'where':{'id':_0x32ebc2[_0x6cdb('0x5d')]['id']}})[_0x6cdb('0x1a')](handleEntityNotFound(_0x3a7273,null))[_0x6cdb('0x1a')](function(_0x50a47e){if(_0x50a47e){_0x336912=_0x50a47e;_0x475534[_0x6cdb('0x5e')]=_[_0x6cdb('0x60')](db[_0x6cdb('0xe9')][_0x6cdb('0x41')]);_0x475534[_0x6cdb('0x4b')]=_[_0x6cdb('0x60')](_0x32ebc2[_0x6cdb('0x4b')]);_0x475534['filters']=_[_0x6cdb('0x62')](_0x475534[_0x6cdb('0x5e')],_0x475534[_0x6cdb('0x4b')]);_0x3052b2[_0x6cdb('0x63')]=_['intersection'](_0x475534['model'],qs['fields'](_0x32ebc2[_0x6cdb('0x4b')][_0x6cdb('0x64')]));_0x3052b2[_0x6cdb('0x63')]=_0x3052b2[_0x6cdb('0x63')][_0x6cdb('0x53')]?_0x3052b2[_0x6cdb('0x63')]:_0x475534[_0x6cdb('0x5e')];_0x3052b2[_0x6cdb('0xd3')]=qs[_0x6cdb('0xd4')](_0x32ebc2[_0x6cdb('0x4b')]['sort']);_0x3052b2[_0x6cdb('0x48')]=qs[_0x6cdb('0x61')](_[_0x6cdb('0xd5')](_0x32ebc2['query'],_0x475534[_0x6cdb('0x61')]));if(_0x32ebc2['query'][_0x6cdb('0x35')]){_0x3052b2['where']=_['merge'](_0x3052b2[_0x6cdb('0x48')],{'$or':_[_0x6cdb('0x37')](_0x3052b2[_0x6cdb('0x63')],function(_0x1e9958){var _0x4a4e5e={};_0x4a4e5e[_0x1e9958]={'$like':'%'+_0x32ebc2[_0x6cdb('0x4b')][_0x6cdb('0x35')]+'%'};return _0x4a4e5e;})});}_0x3052b2=_[_0x6cdb('0x65')]({},_0x3052b2,_0x32ebc2[_0x6cdb('0x66')]);return _0x336912[_0x6cdb('0xea')](_0x3052b2);}})[_0x6cdb('0x1a')](function(_0x1185d9){if(_0x1185d9){_0xdc8bf2=_0x1185d9[_0x6cdb('0x53')];if(!_0x32ebc2[_0x6cdb('0x4b')]['hasOwnProperty']('nolimit')){_0x3052b2[_0x6cdb('0xd8')]=qs[_0x6cdb('0xd8')](_0x32ebc2[_0x6cdb('0x4b')][_0x6cdb('0xd8')]);_0x3052b2[_0x6cdb('0x29')]=qs[_0x6cdb('0x29')](_0x32ebc2['query']['offset']);}return _0x336912['getWhatsappInteractions'](_0x3052b2);}})[_0x6cdb('0x1a')](function(_0x2df7da){if(_0x2df7da){return _0x2df7da?{'count':_0xdc8bf2,'rows':_0x2df7da}:null;}})[_0x6cdb('0x1a')](respondWithResult(_0x3a7273,null))[_0x6cdb('0x5b')](handleError(_0x3a7273,null));};exports[_0x6cdb('0xeb')]=function(_0x4a2b96,_0x163521,_0x4c542b){var _0x20c67e;var _0x1d875d;var _0x245e08;var _0x5055b3=!_[_0x6cdb('0x6d')](_0x4a2b96[_0x6cdb('0x5d')]['id'])?_0x4a2b96[_0x6cdb('0x5d')]['id']:!_[_0x6cdb('0x6d')](_0x4a2b96['user']['id'])?_0x4a2b96['user']['id']:null;return db[_0x6cdb('0x40')][_0x6cdb('0x3a')]({'where':{'id':_0x5055b3,'role':{'$or':[_0x6cdb('0x32'),_0x6cdb('0x33'),_0x6cdb('0x2e')]}},'attributes':['id',_0x6cdb('0x3d'),_0x6cdb('0xec'),'mobile',_0x6cdb('0x2d'),_0x6cdb('0x6c'),_0x6cdb('0xa1')]})[_0x6cdb('0x1a')](function(_0x2153d2){if(_0x2153d2){if(_0x2153d2[_0x6cdb('0x2d')]===_0x6cdb('0x2e')){_0x20c67e=_0x2153d2;if(_0x4a2b96[_0x6cdb('0x68')][_0x6cdb('0xa2')]){_0x245e08=util[_0x6cdb('0xc9')](_0x6cdb('0xed'),_0x20c67e[_0x4a2b96[_0x6cdb('0x68')][_0x6cdb('0xa2')]]);}else if(_0x4a2b96[_0x6cdb('0x68')][_0x6cdb('0xee')]){_0x245e08=util[_0x6cdb('0xc9')]('SIP/%s',_0x4a2b96[_0x6cdb('0x68')][_0x6cdb('0xee')]);}else{_0x245e08=util[_0x6cdb('0xc9')](_0x6cdb('0xef'),_0x20c67e[_0x6cdb('0x3d')]);}socket['to'](util[_0x6cdb('0xc9')]('user:%s',_0x20c67e[_0x6cdb('0x3d')]))[_0x6cdb('0x2f')](_0x6cdb('0xf0'),{'user':{'id':_0x20c67e['id'],'name':_0x20c67e[_0x6cdb('0x3d')]},'ip':_0x4a2b96[_0x6cdb('0xf1')][_0x6cdb('0xf2')]||_0x4a2b96[_0x6cdb('0xf3')][_0x6cdb('0xf4')]||_0x4a2b96[_0x6cdb('0xf5')][_0x6cdb('0xf4')]||_0x4a2b96[_0x6cdb('0xf3')]['socket'][_0x6cdb('0xf4')]});return db['UserVoiceQueueRt'][_0x6cdb('0x31')]({'where':{'membername':_0x20c67e['name']},'individualHooks':!![]});}}else{throw new db[(_0x6cdb('0x97'))]['ValidationError']('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x6cdb('0x1a')](function(){if(_0x20c67e){return _0x20c67e[_0x6cdb('0xf6')]({'raw':!![]});}})[_0x6cdb('0x1a')](function(_0x588dea){if(_0x20c67e){if(_0x588dea){_0x1d875d=_0x588dea;if(_0x1d875d[_0x6cdb('0x53')]){var _0x2be40c=_0x1d875d[_0x6cdb('0x37')](function(_0x2c88f4){var _0x4324a3={'membername':_0x20c67e[_0x6cdb('0x3d')],'UserId':_0x20c67e['id'],'queue_name':_0x2c88f4[_0x6cdb('0x3d')],'VoiceQueueId':_0x2c88f4['id'],'interface':_0x245e08,'paused':_0x20c67e['loginInPause']||![],'penalty':_0x2c88f4[_0x6cdb('0xf7')]||0x0};return db[_0x6cdb('0xaf')][_0x6cdb('0xb0')](_0x4324a3);});return Promise[_0x6cdb('0x5a')](_0x2be40c);}}}})['then'](function(){if(_0x20c67e){return db[_0x6cdb('0xf8')][_0x6cdb('0x50')]({'where':{'membername':_0x20c67e[_0x6cdb('0x3d')],'exitAt':null}});}})[_0x6cdb('0x1a')](function(_0x39a9d7){if(_0x20c67e){var _0x9bd494=[];_0x39a9d7[_0x6cdb('0xf9')](function(_0x52f4c2){_0x9bd494['push'](_0x52f4c2['update']({'exitAt':moment()[_0x6cdb('0xc9')](_0x6cdb('0xfa'))}));});return Promise['all'](_0x9bd494);}})['then'](function(){if(_0x20c67e){var _0x2c07d2=[];var _0x927aa8=[];var _0x10015f=utils[_0x6cdb('0xfb')]();var _0x5a25ef={'membername':_0x20c67e[_0x6cdb('0x3d')],'interface':_0x245e08,'enterAt':moment()[_0x6cdb('0xc9')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x20c67e['role'],'internal':_0x20c67e[_0x6cdb('0x6c')]};_0x10015f[_0x6cdb('0xf9')](function(_0x1c41b8){_0x2c07d2[_0x6cdb('0x4f')](_[_0x6cdb('0x65')]({'channel':_0x1c41b8,'type':_0x6cdb('0xfc'),'data1':_0x4a2b96[_0x6cdb('0x68')][_0x6cdb('0xfd')],'data2':_0x245e08},_0x5a25ef));if(_0x20c67e[_0x6cdb('0xa1')]){_0x927aa8[_0x6cdb('0x4f')](_[_0x6cdb('0x65')]({'channel':_0x1c41b8,'type':_0x6cdb('0xfe'),'data1':_0x6cdb('0xff')},_0x5a25ef));}});return db[_0x6cdb('0xf8')][_0x6cdb('0x8d')](_0x2c07d2[_0x6cdb('0xc6')](_0x927aa8),{'individualHooks':!![]});}})['then'](function(){if(_0x20c67e){return _0x20c67e[_0x6cdb('0x2c')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x20c67e['loginInPause']||![],'mailPause':_0x20c67e['loginInPause']||![],'chatPause':_0x20c67e['loginInPause']||![],'faxPause':_0x20c67e['loginInPause']||![],'smsPause':_0x20c67e[_0x6cdb('0xa1')]||![],'openchannelPause':_0x20c67e['loginInPause']||![],'whatsappPause':_0x20c67e['loginInPause']||![],'pauseType':_0x20c67e[_0x6cdb('0xa1')]?_0x6cdb('0xff'):null,'interface':_0x245e08,'lastPauseAt':moment()['format'](_0x6cdb('0xfa'))});}})[_0x6cdb('0x1a')](function(_0x3cfb99){if(_0x4a2b96[_0x6cdb('0x100')]){return _0x4c542b();}else{return Promise[_0x6cdb('0x101')](_0x3cfb99)['then'](respondWithResult(_0x163521,null));}})['catch'](handleError(_0x163521,null));};exports['logout']=function(_0x4b786b,_0x2b6afc){var _0xe408e8;return db['User'][_0x6cdb('0x3a')]({'where':{'id':_0x4b786b[_0x6cdb('0x5d')]['id'],'role':_0x6cdb('0x2e')},'attributes':['id','name','role']})[_0x6cdb('0x1a')](handleEntityNotFound(_0x2b6afc,null))[_0x6cdb('0x1a')](function(_0x7efe56){if(_0x7efe56){_0xe408e8=_0x7efe56;return db['UserVoiceQueueRt'][_0x6cdb('0x31')]({'where':{'membername':_0xe408e8[_0x6cdb('0x3d')]},'individualHooks':!![]});}})[_0x6cdb('0x1a')](function(){return db['MemberReport'][_0x6cdb('0x50')]({'where':{'membername':_0xe408e8[_0x6cdb('0x3d')],'exitAt':null}});})[_0x6cdb('0x1a')](function(_0x2f3573){var _0x5ee9eb=[];_0x2f3573['forEach'](function(_0x10d272){_0x5ee9eb[_0x6cdb('0x4f')](_0x10d272[_0x6cdb('0x2c')]({'exitAt':moment()[_0x6cdb('0xc9')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x5ee9eb);})[_0x6cdb('0x1a')](function(){return _0xe408e8[_0x6cdb('0x2c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x6cdb('0x1a')](respondWithResult(_0x2b6afc,null))[_0x6cdb('0x5b')](handleError(_0x2b6afc,null));};exports['pause']=function(_0x179289,_0x524be1){var _0x30829d;return db[_0x6cdb('0xaf')][_0x6cdb('0x2c')]({'paused':0x1},{'where':{'UserId':_0x179289[_0x6cdb('0x5d')]['id']},'individualHooks':!![]})[_0x6cdb('0x1a')](function(){return db['User'][_0x6cdb('0x3a')]({'where':{'id':_0x179289[_0x6cdb('0x5d')]['id'],'role':_0x6cdb('0x2e')},'attributes':['id',_0x6cdb('0x3d'),_0x6cdb('0x2d'),'internal','interface',_0x6cdb('0xa0')]});})[_0x6cdb('0x1a')](handleEntityNotFound(_0x524be1,null))['then'](function(_0x340f3a){if(_0x340f3a){_0x30829d=_0x340f3a;return respondWithRpcPromise('QueuePause','pause',{'id':_0x30829d['id'],'name':_0x30829d[_0x6cdb('0x3d')],'pause':!![]});}})[_0x6cdb('0x1a')](function(){if(_0x30829d){return db[_0x6cdb('0xf8')]['findAll']({'where':{'membername':_0x30829d['name'],'type':_0x6cdb('0xfe'),'exitAt':null}});}})[_0x6cdb('0x1a')](function(_0x35ed1b){if(_0x35ed1b[_0x6cdb('0x53')]){var _0x2444de=moment()[_0x6cdb('0xc9')](_0x6cdb('0xfa'));for(var _0x52233a=0x0,_0x2c6dec=_0x35ed1b[_0x6cdb('0x53')];_0x52233a<_0x2c6dec;_0x52233a++){_0x35ed1b[_0x52233a][_0x6cdb('0x102')]({'exitAt':_0x2444de});}}})[_0x6cdb('0x1a')](function(){var _0x58a232=[];var _0x1c6d8e=utils['getChannels']();_0x1c6d8e[_0x6cdb('0xf9')](function(_0x1f228e){_0x58a232[_0x6cdb('0x4f')]({'channel':_0x1f228e,'membername':_0x30829d['name'],'interface':_[_0x6cdb('0x6d')](_0x30829d[_0x6cdb('0xa2')])?util[_0x6cdb('0xc9')]('SIP/%s',_0x30829d['name']):_0x30829d['interface'],'type':_0x6cdb('0xfe'),'enterAt':moment()[_0x6cdb('0xc9')](_0x6cdb('0xfa')),'data1':_0x179289[_0x6cdb('0x68')]['type']||_0x6cdb('0x103'),'role':_0x30829d[_0x6cdb('0x2d')],'internal':_0x30829d[_0x6cdb('0x6c')]});});return db[_0x6cdb('0xf8')][_0x6cdb('0x8d')](_0x58a232,{'individualHooks':!![]});})['then'](function(){return _0x30829d['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x179289['body'][_0x6cdb('0x43')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x6cdb('0xc9')](_0x6cdb('0xfa'))});})[_0x6cdb('0x1a')](respondWithResult(_0x524be1,null))[_0x6cdb('0x5b')](handleError(_0x524be1,null));};exports[_0x6cdb('0x104')]=function(_0x338d51,_0x30d904){if(_0x338d51[_0x6cdb('0x68')]['channel']&&!utils[_0x6cdb('0xa3')](_0x338d51[_0x6cdb('0x68')]['channel'])){throw new APIBadRequestError(util[_0x6cdb('0xc9')](_0x6cdb('0x105'),_0x338d51['body'][_0x6cdb('0xb1')]));}return db[_0x6cdb('0x40')]['find']({'where':{'id':_0x338d51[_0x6cdb('0x5d')]['id']},'attributes':['id',_0x6cdb('0x3d'),_0x6cdb('0x2d'),_0x6cdb('0x6c'),_0x6cdb('0xa2'),'online','voicePause',_0x6cdb('0x106'),_0x6cdb('0x107'),_0x6cdb('0x108'),_0x6cdb('0x109'),'smsPause','whatsappPause',_0x6cdb('0x10a'),'lastPauseAt']})[_0x6cdb('0x1a')](function(_0x384343){if(!_0x384343){throw new APINotFoundError(util['format'](_0x6cdb('0x10b'),_0x338d51[_0x6cdb('0x5d')]['id']));}return _0x384343[_0x6cdb('0x104')](_0x338d51[_0x6cdb('0x68')][_0x6cdb('0xb1')]);})['then'](respondWithResult(_0x30d904,null))[_0x6cdb('0x5b')](APIHandleError(_0x30d904));};exports[_0x6cdb('0x10c')]=function(_0xe418e,_0x23b61b){var _0x304d07={};var _0xaeee80={};var _0x19af29;var _0x40924a;return db[_0x6cdb('0x40')][_0x6cdb('0xc8')]({'where':{'id':_0xe418e['params']['id']}})[_0x6cdb('0x1a')](handleEntityNotFound(_0x23b61b,null))[_0x6cdb('0x1a')](function(_0xcdf6b){if(_0xcdf6b){_0x19af29=_0xcdf6b;_0xaeee80[_0x6cdb('0x5e')]=_[_0x6cdb('0x60')](db[_0x6cdb('0x10d')][_0x6cdb('0x41')]);_0xaeee80['query']=_[_0x6cdb('0x60')](_0xe418e[_0x6cdb('0x4b')]);_0xaeee80[_0x6cdb('0x61')]=_[_0x6cdb('0x62')](_0xaeee80[_0x6cdb('0x5e')],_0xaeee80['query']);_0x304d07['attributes']=_[_0x6cdb('0x62')](_0xaeee80[_0x6cdb('0x5e')],qs['fields'](_0xe418e['query'][_0x6cdb('0x64')]));_0x304d07[_0x6cdb('0x63')]=_0x304d07[_0x6cdb('0x63')][_0x6cdb('0x53')]?_0x304d07[_0x6cdb('0x63')]:_0xaeee80['model'];_0x304d07[_0x6cdb('0xd3')]=qs[_0x6cdb('0xd4')](_0xe418e[_0x6cdb('0x4b')][_0x6cdb('0xd4')]);_0x304d07['where']=qs[_0x6cdb('0x61')](_[_0x6cdb('0xd5')](_0xe418e[_0x6cdb('0x4b')],_0xaeee80['filters']));if(_0xe418e[_0x6cdb('0x4b')][_0x6cdb('0x35')]){_0x304d07[_0x6cdb('0x48')]=_[_0x6cdb('0x65')](_0x304d07[_0x6cdb('0x48')],{'$or':_[_0x6cdb('0x37')](_0x304d07[_0x6cdb('0x63')],function(_0x214521){var _0x686d92={};_0x686d92[_0x214521]={'$like':'%'+_0xe418e[_0x6cdb('0x4b')]['filter']+'%'};return _0x686d92;})});}_0x304d07=_[_0x6cdb('0x65')]({},_0x304d07,_0xe418e[_0x6cdb('0x66')]);return _0x19af29[_0x6cdb('0x10c')](_0x304d07);}})[_0x6cdb('0x1a')](function(_0x3b58c1){if(_0x3b58c1){_0x40924a=_0x3b58c1[_0x6cdb('0x53')];if(!_0xe418e['query'][_0x6cdb('0xcb')](_0x6cdb('0xd7'))){_0x304d07['limit']=qs[_0x6cdb('0xd8')](_0xe418e['query'][_0x6cdb('0xd8')]);_0x304d07[_0x6cdb('0x29')]=qs[_0x6cdb('0x29')](_0xe418e[_0x6cdb('0x4b')][_0x6cdb('0x29')]);}return _0x19af29[_0x6cdb('0x10c')](_0x304d07);}})['then'](function(_0x37c430){if(_0x37c430){return _0x37c430?{'count':_0x40924a,'rows':_0x37c430}:null;}})[_0x6cdb('0x1a')](respondWithResult(_0x23b61b,null))['catch'](handleError(_0x23b61b,null));};exports[_0x6cdb('0x10e')]=function(_0x5b41be,_0x25575e){var _0x4934a4=_0x5b41be[_0x6cdb('0x5d')]['id'];var _0x3c02bf=_0x5b41be[_0x6cdb('0x68')]?_0x5b41be[_0x6cdb('0x68')][_0x6cdb('0x6a')]:null;var _0x216672=[];return Promise[_0x6cdb('0x101')]()[_0x6cdb('0x1a')](function(){if(!_0x3c02bf)throw new APIBadRequestError(_0x6cdb('0x10f'));})[_0x6cdb('0x1a')](function(){return db[_0x6cdb('0x40')][_0x6cdb('0xc8')]({'where':{'id':_0x4934a4}});})[_0x6cdb('0x1a')](function(_0x119cdb){if(!_0x119cdb)throw new APINotFoundError(util[_0x6cdb('0xc9')]('User\x20with\x20id\x20%s\x20not\x20found',_0x5b41be['params']['id']));return db['sequelize'][_0x6cdb('0x110')](function(_0x3ae6d7){return _0x119cdb[_0x6cdb('0x10e')](_0x3c02bf,{'transaction':_0x3ae6d7})['then'](function(){return db['Team'][_0x6cdb('0x50')]({'where':{'id':{'$in':_0x3c02bf}}});})[_0x6cdb('0x1a')](function(_0x4cb415){var _0x561342=_[_0x6cdb('0x37')](_0x4cb415,function(_0x4d64f2){return _0x4d64f2[_0x6cdb('0x111')]();});return Promise[_0x6cdb('0x5a')](_0x561342);})[_0x6cdb('0x1a')](function(_0x4f3efd){_0x216672=_[_0x6cdb('0x112')](_0x4f3efd);var _0x3ccf2f=_[_0x6cdb('0x37')](_0x216672,function(_0x4708ab){return _0x4708ab['addAgent'](_0x119cdb['id'],{'transaction':_0x3ae6d7});});return Promise[_0x6cdb('0x5a')](_0x3ccf2f);})[_0x6cdb('0x1a')](function(){if(!_0x119cdb[_0x6cdb('0xa0')])return;var _0x2968ed=_[_0x6cdb('0x35')](_0x216672,function(_0x27a852){return _0x27a852[_0x6cdb('0x113')](_0x6cdb('0xb1'))===_0x6cdb('0x114');});var _0x1aee22=_[_0x6cdb('0x37')](_0x2968ed,function(_0x539bce){return db['UserVoiceQueueRt'][_0x6cdb('0xb0')]({'membername':_0x119cdb['name'],'UserId':_0x119cdb['id'],'queue_name':_0x539bce[_0x6cdb('0x3d')],'VoiceQueueId':_0x539bce['id'],'interface':_[_0x6cdb('0x6d')](_0x119cdb['interface'])?util[_0x6cdb('0xc9')](_0x6cdb('0xef'),_0x119cdb['name']):_0x119cdb[_0x6cdb('0xa2')],'paused':_0x119cdb[_0x6cdb('0xad')]||![],'penalty':_0x119cdb[_0x6cdb('0xae')]},{'transaction':_0x3ae6d7});});return Promise[_0x6cdb('0x5a')](_0x1aee22);})['then'](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x3c02bf}}});})[_0x6cdb('0x1a')](function(_0x32d60e){var _0x40ecde=_[_0x6cdb('0x37')](_0x32d60e,function(_0x4551b1){return db[_0x6cdb('0x115')][_0x6cdb('0x82')]({'UserId':_0x119cdb['id'],'VoicePrefixId':_0x4551b1[_0x6cdb('0x116')]},{'transaction':_0x3ae6d7});});return Promise[_0x6cdb('0x5a')](_0x40ecde);});});})[_0x6cdb('0x1a')](function(){for(var _0x264e56=0x0;_0x264e56<_0x216672[_0x6cdb('0x53')];_0x264e56++){var _0x24c250=_0x216672[_0x264e56][_0x6cdb('0x113')](_0x6cdb('0xb1'));var _0x31d914=_0x24c250+'QueueId';socket['emit'](_0x6cdb('0x33')+_0x24c250+_0x6cdb('0x117'),{'UserId':_0x4934a4,['queueField']:_0x216672[_0x264e56]['id']});}})[_0x6cdb('0x1a')](respondWithStatusCode(_0x25575e,null))['catch'](APIHandleError(_0x25575e));};exports[_0x6cdb('0x118')]=function(_0x506d34,_0x2cd615){var _0x42bfdb=_0x506d34[_0x6cdb('0x5d')]['id'];var _0x1df527=null;if(_0x506d34[_0x6cdb('0x4b')]['ids']){_0x1df527=_[_0x6cdb('0xb2')](_0x506d34['query'][_0x6cdb('0x6a')])?_0x506d34['query']['ids']:[_0x506d34[_0x6cdb('0x4b')][_0x6cdb('0x6a')]];}var _0x2d0dfa=[];return Promise['resolve']()[_0x6cdb('0x1a')](function(){if(!_0x1df527)throw new APIBadRequestError(_0x6cdb('0x119'));})['then'](function(){return db[_0x6cdb('0x40')][_0x6cdb('0xc8')]({'where':{'id':_0x42bfdb}});})[_0x6cdb('0x1a')](function(_0x2ae6da){if(!_0x2ae6da)throw new APINotFoundError(util[_0x6cdb('0xc9')](_0x6cdb('0x10b'),_0x506d34[_0x6cdb('0x5d')]['id']));return db[_0x6cdb('0x70')][_0x6cdb('0x110')](function(_0x515b2e){return _0x2ae6da[_0x6cdb('0x118')](_0x1df527,{'transaction':_0x515b2e})[_0x6cdb('0x1a')](function(){return db[_0x6cdb('0x10d')][_0x6cdb('0x50')]({'where':{'id':{'$in':_0x1df527}}});})['then'](function(_0x40405d){var _0x52d775=_[_0x6cdb('0x37')](_0x40405d,function(_0x499508){return _0x499508[_0x6cdb('0x111')]();});return Promise[_0x6cdb('0x5a')](_0x52d775);})[_0x6cdb('0x1a')](function(_0x1a9a15){_0x2d0dfa=_[_0x6cdb('0x112')](_0x1a9a15);var _0x592464=_[_0x6cdb('0x37')](_0x2d0dfa,function(_0x249f6f){return _0x249f6f[_0x6cdb('0x11a')](_0x2ae6da['id'],{'transaction':_0x515b2e});});return Promise[_0x6cdb('0x5a')](_0x592464);})[_0x6cdb('0x1a')](function(){if(!_0x2ae6da[_0x6cdb('0xa0')])return;var _0x55729f=_[_0x6cdb('0x35')](_0x2d0dfa,function(_0x2e45e8){return _0x2e45e8['getDataValue'](_0x6cdb('0xb1'))===_0x6cdb('0x114');});var _0x5d5094=_[_0x6cdb('0x37')](_0x55729f,function(_0x1140c6){return db[_0x6cdb('0xaf')][_0x6cdb('0x31')]({'where':{'VoiceQueueId':_0x1140c6['id'],'UserId':_0x2ae6da['id']},'transaction':_0x515b2e});});return Promise[_0x6cdb('0x5a')](_0x5d5094);})[_0x6cdb('0x1a')](function(){return db[_0x6cdb('0x11b')][_0x6cdb('0x50')]({'where':{'teamId':{'$in':_0x1df527}}});})[_0x6cdb('0x1a')](function(_0x12da45){var _0x402eca=_[_0x6cdb('0x37')](_0x12da45,function(_0x81ed95){return db[_0x6cdb('0x115')]['destroy']({'where':{'UserId':_0x2ae6da['id'],'VoicePrefixId':_0x81ed95[_0x6cdb('0x116')]}},{'transaction':_0x515b2e});});return Promise[_0x6cdb('0x5a')](_0x402eca);});});})[_0x6cdb('0x1a')](function(){for(var _0x3b64c1=0x0;_0x3b64c1<_0x2d0dfa[_0x6cdb('0x53')];_0x3b64c1++){var _0x6ce4fd=_0x2d0dfa[_0x3b64c1][_0x6cdb('0x113')](_0x6cdb('0xb1'));var _0x3fe811=_0x6ce4fd+_0x6cdb('0xb4');socket['emit']('user'+_0x6ce4fd+_0x6cdb('0xb3'),{'UserId':_0x42bfdb,['queueField']:_0x2d0dfa[_0x3b64c1]['id']});}})[_0x6cdb('0x1a')](respondWithStatusCode(_0x2cd615,null))[_0x6cdb('0x5b')](APIHandleError(_0x2cd615));};exports[_0x6cdb('0x11c')]=function(_0x50b931,_0x176f0e){var _0x2ad39a={};var _0x22c9ee={};var _0x3575f9;var _0x2d6e6c;return db[_0x6cdb('0x40')][_0x6cdb('0xc8')]({'where':{'id':_0x50b931['params']['id']}})[_0x6cdb('0x1a')](handleEntityNotFound(_0x176f0e,null))[_0x6cdb('0x1a')](function(_0x23e671){if(_0x23e671){_0x3575f9=_0x23e671;_0x22c9ee[_0x6cdb('0x5e')]=_[_0x6cdb('0x60')](db[_0x6cdb('0xcc')][_0x6cdb('0x41')]);_0x22c9ee[_0x6cdb('0x4b')]=_[_0x6cdb('0x60')](_0x50b931[_0x6cdb('0x4b')]);_0x22c9ee[_0x6cdb('0x61')]=_[_0x6cdb('0x62')](_0x22c9ee[_0x6cdb('0x5e')],_0x22c9ee[_0x6cdb('0x4b')]);_0x2ad39a[_0x6cdb('0x63')]=_[_0x6cdb('0x62')](_0x22c9ee['model'],qs[_0x6cdb('0x64')](_0x50b931[_0x6cdb('0x4b')]['fields']));_0x2ad39a[_0x6cdb('0x63')]=_0x2ad39a[_0x6cdb('0x63')][_0x6cdb('0x53')]?_0x2ad39a[_0x6cdb('0x63')]:_0x22c9ee[_0x6cdb('0x5e')];_0x2ad39a['order']=qs[_0x6cdb('0xd4')](_0x50b931['query']['sort']);_0x2ad39a[_0x6cdb('0x48')]=qs[_0x6cdb('0x61')](_[_0x6cdb('0xd5')](_0x50b931[_0x6cdb('0x4b')],_0x22c9ee[_0x6cdb('0x61')]));if(_0x50b931[_0x6cdb('0x4b')][_0x6cdb('0x35')]){_0x2ad39a[_0x6cdb('0x48')]=_[_0x6cdb('0x65')](_0x2ad39a[_0x6cdb('0x48')],{'$or':_[_0x6cdb('0x37')](_0x2ad39a[_0x6cdb('0x63')],function(_0x137a90){var _0x995b={};_0x995b[_0x137a90]={'$like':'%'+_0x50b931[_0x6cdb('0x4b')][_0x6cdb('0x35')]+'%'};return _0x995b;})});}_0x2ad39a=_[_0x6cdb('0x65')]({},_0x2ad39a,_0x50b931[_0x6cdb('0x66')]);return _0x3575f9[_0x6cdb('0x11c')](_0x2ad39a);}})[_0x6cdb('0x1a')](function(_0x2a9514){if(_0x2a9514){_0x2d6e6c=_0x2a9514[_0x6cdb('0x53')];if(!_0x50b931[_0x6cdb('0x4b')]['hasOwnProperty'](_0x6cdb('0xd7'))){_0x2ad39a['limit']=qs[_0x6cdb('0xd8')](_0x50b931['query'][_0x6cdb('0xd8')]);_0x2ad39a['offset']=qs[_0x6cdb('0x29')](_0x50b931[_0x6cdb('0x4b')][_0x6cdb('0x29')]);}return _0x3575f9['getLists'](_0x2ad39a);}})['then'](function(_0x210908){if(_0x210908){return _0x210908?{'count':_0x2d6e6c,'rows':_0x210908}:null;}})['then'](respondWithResult(_0x176f0e,null))['catch'](handleError(_0x176f0e,null));};exports[_0x6cdb('0x11d')]=function(_0x57b27c,_0x3759b){var _0xbf8f0={};var _0x41c178={};var _0x3e8b1c;return db[_0x6cdb('0x40')][_0x6cdb('0xc8')]({'where':{'id':_0x57b27c[_0x6cdb('0x5d')]['id']}})[_0x6cdb('0x1a')](handleEntityNotFound(_0x3759b,null))['then'](function(_0x29db54){if(_0x29db54){_0x3e8b1c=_0x29db54;_0x41c178[_0x6cdb('0x5e')]=_[_0x6cdb('0x60')](db['User'][_0x6cdb('0x41')]);_0x41c178['query']=_['keys'](_0x57b27c['query']);_0x41c178['filters']=_[_0x6cdb('0x62')](_0x41c178[_0x6cdb('0x5e')],_0x41c178[_0x6cdb('0x4b')]);_0xbf8f0['attributes']=_[_0x6cdb('0x62')](_0x41c178[_0x6cdb('0x5e')],qs[_0x6cdb('0x64')](_0x57b27c[_0x6cdb('0x4b')]['fields']));_0xbf8f0[_0x6cdb('0x63')]=_0xbf8f0[_0x6cdb('0x63')][_0x6cdb('0x53')]?_0xbf8f0[_0x6cdb('0x63')]:_0x41c178['model'];_0xbf8f0[_0x6cdb('0xd3')]=qs[_0x6cdb('0xd4')](_0x57b27c[_0x6cdb('0x4b')][_0x6cdb('0xd4')]);_0xbf8f0['where']=qs[_0x6cdb('0x61')](_[_0x6cdb('0xd5')](_0x57b27c[_0x6cdb('0x4b')],_0x41c178[_0x6cdb('0x61')]));if(_0x57b27c[_0x6cdb('0x4b')][_0x6cdb('0x35')]){_0xbf8f0[_0x6cdb('0x48')]=_[_0x6cdb('0x65')](_0xbf8f0['where'],{'$or':_[_0x6cdb('0x37')](_0xbf8f0[_0x6cdb('0x63')],function(_0x45268a){var _0x4cac0a={};_0x4cac0a[_0x45268a]={'$like':'%'+_0x57b27c['query'][_0x6cdb('0x35')]+'%'};return _0x4cac0a;})});}_0xbf8f0[_0x6cdb('0x5e')]=db['User'];_0xbf8f0['as']=_0x6cdb('0x8a');_0xbf8f0=_[_0x6cdb('0x65')]({},_0xbf8f0,_0x57b27c[_0x6cdb('0x66')]);return _0x3e8b1c['getVoiceQueues']({'include':[_0xbf8f0]});}})[_0x6cdb('0x1a')](function(_0x1718db){if(_0x1718db){var _0x5d1c97={},_0x3fb03c=[];for(var _0x5a4baa=0x0;_0x5a4baa<_0x1718db['length'];_0x5a4baa+=0x1){for(var _0x26981f=0x0,_0x3fdcd4;_0x26981f<_0x1718db[_0x5a4baa][_0x6cdb('0x8a')]['length'];_0x26981f+=0x1){_0x3fdcd4=_0x1718db[_0x5a4baa][_0x6cdb('0x8a')][_0x26981f]['get']({'plain':!![]});_0x5d1c97[_0x3fdcd4['id']]=_0x3fdcd4;}}_0x5d1c97=_[_0x6cdb('0x11e')](_0x5d1c97);for(var _0x2e7638=qs[_0x6cdb('0x29')](_0x57b27c[_0x6cdb('0x4b')][_0x6cdb('0x29')]);_0x2e7638<_0x5d1c97[_0x6cdb('0x53')]&&_0x3fb03c['length']=_0x30e0ed['agents']){throw new Error(_0xa5c5('0x4d'));}})[_0xa5c5('0x18')](function(){if(_0x69f155){return db[_0xa5c5('0x27')][_0xa5c5('0x44')]({'where':{'membername':_0x69f155[_0xa5c5('0x29')]},'individualHooks':!![]});}})['then'](function(){if(_0x69f155){return _0x69f155['getVoiceQueues']({'raw':!![]});}})[_0xa5c5('0x18')](function(_0x5ea540){if(_0x69f155){if(_0x5ea540){var _0x5e4ae9=[];_0x9ada1f=_0x5ea540;if(_0x9ada1f[_0xa5c5('0x2b')]){for(var _0x36409c=0x0;_0x36409c<_0x9ada1f[_0xa5c5('0x2b')];_0x36409c++){_0x5e4ae9['push'](db[_0xa5c5('0x27')][_0xa5c5('0x4e')]({'membername':_0x69f155['name'],'UserId':_0x69f155['id'],'queue_name':_0x9ada1f[_0x36409c][_0xa5c5('0x29')],'VoiceQueueId':_0x9ada1f[_0x36409c]['id'],'interface':_0x235106,'paused':_0x69f155[_0xa5c5('0x4f')]||![],'penalty':_0x9ada1f[_0x36409c]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xa5c5('0x50')](_0x5e4ae9);}}}})[_0xa5c5('0x18')](function(){if(_0x69f155){return db['MemberReport'][_0xa5c5('0xf')]({'where':{'membername':_0x69f155['name'],'exitAt':null}});}})[_0xa5c5('0x18')](function(_0x45845a){if(_0x69f155){if(_0x45845a&&_0x45845a[_0xa5c5('0x2b')]){var _0xef457d=[];_0x45845a['forEach'](function(_0x42cbea){_0xef457d[_0xa5c5('0x30')](_0x42cbea[_0xa5c5('0x45')]({'exitAt':moment()[_0xa5c5('0x25')](_0xa5c5('0x2c'))}));});return BPromise['all'](_0xef457d);}}})[_0xa5c5('0x18')](function(){if(_0x69f155){var _0x355c48=[];var _0x3152ad=[];var _0x57cc76=utils[_0xa5c5('0x2e')]();var _0x44ef0c={'membername':_0x69f155['name'],'interface':_0x235106,'enterAt':moment()[_0xa5c5('0x25')](_0xa5c5('0x2c')),'role':_0x69f155[_0xa5c5('0x34')],'internal':_0x69f155[_0xa5c5('0x23')]};_0x57cc76[_0xa5c5('0x2f')](function(_0x4d9930){_0x355c48[_0xa5c5('0x30')](_[_0xa5c5('0x51')]({'channel':_0x4d9930,'type':_0xa5c5('0x52'),'data1':_0xa5c5('0x53'),'data2':_0x235106},_0x44ef0c));if(_0x69f155[_0xa5c5('0x4f')]){_0x3152ad['push'](_[_0xa5c5('0x51')]({'channel':_0x4d9930,'type':_0xa5c5('0x2a'),'data1':'LOGININPAUSE'},_0x44ef0c));}});return db[_0xa5c5('0x28')]['bulkCreate'](_0x355c48[_0xa5c5('0x54')](_0x3152ad),{'individualHooks':!![]});}})[_0xa5c5('0x18')](function(){if(_0x69f155){return _0x69f155['update']({'online':!![],'lastLoginAt':moment()[_0xa5c5('0x25')](_0xa5c5('0x2c')),'voicePause':_0x69f155[_0xa5c5('0x4f')]||![],'mailPause':_0x69f155[_0xa5c5('0x4f')]||![],'chatPause':_0x69f155['loginInPause']||![],'faxPause':_0x69f155['loginInPause']||![],'smsPause':_0x69f155[_0xa5c5('0x4f')]||![],'openchannelPause':_0x69f155[_0xa5c5('0x4f')]||![],'pauseType':_0x69f155['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xa5c5('0x25')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x235106});}})[_0xa5c5('0x18')](function(_0x46a97d){_0x20ca8e(_0x46a97d);})[_0xa5c5('0x1f')](function(_0x2b61f3){_0x1a7083(_0xbc9b09[_0xa5c5('0x1d')](0x1f4,_0x2b61f3[_0xa5c5('0x1c')]));});});}; \ No newline at end of file +var _0xcf20=['phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','MemberReport','forEach','getChannels','merge','callysquare','LOGININPAUSE','concat','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','./user.socket','register','User','findAll','options','raw','where','attributes','include','map','model','then','info','GetUser','debug','stringify','catch','error','message','find','ShowUser','PauseUser','name','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','UserVoiceQueueRt','update','PAUSE','YYYY-MM-DD\x20HH:mm:ss','length','isNil','SIP/%s','body','type','role','bulkCreate','DEFAULT\x20PAUSE','UnpauseUser','channel','findOne','online','voicePause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','system','destroy','push','all','LoginUser','mobile'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xcf20,0x69));var _0x0cf2=function(_0x443c68,_0x29a580){_0x443c68=_0x443c68-0x0;var _0x58e909=_0xcf20[_0x443c68];return _0x58e909;};'use strict';var _=require(_0x0cf2('0x0'));var util=require('util');var moment=require(_0x0cf2('0x1'));var BPromise=require(_0x0cf2('0x2'));var Redis=require(_0x0cf2('0x3'));var db=require(_0x0cf2('0x4'))['db'];var utils=require(_0x0cf2('0x5'));var logger=require(_0x0cf2('0x6'))(_0x0cf2('0x7'));var config=require(_0x0cf2('0x8'));config[_0x0cf2('0x9')]=_[_0x0cf2('0xa')](config[_0x0cf2('0x9')],{'host':_0x0cf2('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0cf2('0x9')]));require(_0x0cf2('0xc'))[_0x0cf2('0xd')](socket);exports['GetUser']=function(_0x2a1ba3){var _0x87ef27=this;return new Promise(function(_0x3b8918,_0x503c90){return db[_0x0cf2('0xe')][_0x0cf2('0xf')]({'raw':_0x2a1ba3[_0x0cf2('0x10')]?_0x2a1ba3['options'][_0x0cf2('0x11')]===undefined?!![]:![]:!![],'where':_0x2a1ba3[_0x0cf2('0x10')]?_0x2a1ba3['options'][_0x0cf2('0x12')]||null:null,'attributes':_0x2a1ba3[_0x0cf2('0x10')]?_0x2a1ba3[_0x0cf2('0x10')][_0x0cf2('0x13')]||null:null,'limit':_0x2a1ba3[_0x0cf2('0x10')]?_0x2a1ba3[_0x0cf2('0x10')]['limit']||null:null,'include':_0x2a1ba3[_0x0cf2('0x10')]?_0x2a1ba3[_0x0cf2('0x10')][_0x0cf2('0x14')]?_[_0x0cf2('0x15')](_0x2a1ba3[_0x0cf2('0x10')][_0x0cf2('0x14')],function(_0x19c0fc){return{'model':db[_0x19c0fc['model']],'as':_0x19c0fc['as'],'attributes':_0x19c0fc[_0x0cf2('0x13')],'include':_0x19c0fc[_0x0cf2('0x14')]?_[_0x0cf2('0x15')](_0x19c0fc['include'],function(_0x266f53){return{'model':db[_0x266f53[_0x0cf2('0x16')]],'as':_0x266f53['as'],'attributes':_0x266f53[_0x0cf2('0x13')],'include':_0x266f53['include']?_[_0x0cf2('0x15')](_0x266f53['include'],function(_0x3bc5e4){return{'model':db[_0x3bc5e4[_0x0cf2('0x16')]],'as':_0x3bc5e4['as'],'attributes':_0x3bc5e4[_0x0cf2('0x13')]};}):[]};}):[]};}):[]:[]})[_0x0cf2('0x17')](function(_0x582e74){logger[_0x0cf2('0x18')](_0x0cf2('0x19'),_0x2a1ba3);logger[_0x0cf2('0x1a')]('GetUser',_0x2a1ba3,JSON[_0x0cf2('0x1b')](_0x582e74));_0x3b8918(_0x582e74);})[_0x0cf2('0x1c')](function(_0x559303){logger[_0x0cf2('0x1d')]('GetUser',_0x559303[_0x0cf2('0x1e')],_0x2a1ba3);_0x503c90(_0x87ef27[_0x0cf2('0x1d')](0x1f4,_0x559303[_0x0cf2('0x1e')]));});});};exports['ShowUser']=function(_0x262ffa){var _0x35a86a=this;return new Promise(function(_0x5c05e3,_0x555dbf){return db['User'][_0x0cf2('0x1f')]({'raw':_0x262ffa[_0x0cf2('0x10')]?_0x262ffa[_0x0cf2('0x10')][_0x0cf2('0x11')]===undefined?!![]:![]:!![],'where':_0x262ffa[_0x0cf2('0x10')]?_0x262ffa[_0x0cf2('0x10')]['where']||null:null,'attributes':_0x262ffa[_0x0cf2('0x10')]?_0x262ffa[_0x0cf2('0x10')][_0x0cf2('0x13')]||null:null,'include':_0x262ffa['options']?_0x262ffa[_0x0cf2('0x10')][_0x0cf2('0x14')]?_[_0x0cf2('0x15')](_0x262ffa[_0x0cf2('0x10')][_0x0cf2('0x14')],function(_0x160593){return{'model':db[_0x160593[_0x0cf2('0x16')]],'as':_0x160593['as'],'attributes':_0x160593[_0x0cf2('0x13')],'include':_0x160593[_0x0cf2('0x14')]?_[_0x0cf2('0x15')](_0x160593['include'],function(_0x440bcc){return{'model':db[_0x440bcc['model']],'as':_0x440bcc['as'],'attributes':_0x440bcc[_0x0cf2('0x13')],'include':_0x440bcc['include']?_[_0x0cf2('0x15')](_0x440bcc[_0x0cf2('0x14')],function(_0x1a5e8f){return{'model':db[_0x1a5e8f[_0x0cf2('0x16')]],'as':_0x1a5e8f['as'],'attributes':_0x1a5e8f[_0x0cf2('0x13')]};}):[]};}):[]};}):[]:[]})[_0x0cf2('0x17')](function(_0x465feb){logger[_0x0cf2('0x18')](_0x0cf2('0x20'),_0x262ffa);logger[_0x0cf2('0x1a')](_0x0cf2('0x20'),_0x262ffa,JSON[_0x0cf2('0x1b')](_0x465feb));_0x5c05e3(_0x465feb);})[_0x0cf2('0x1c')](function(_0x2b05e6){logger['error'](_0x0cf2('0x20'),_0x2b05e6[_0x0cf2('0x1e')],_0x262ffa);_0x555dbf(_0x35a86a[_0x0cf2('0x1d')](0x1f4,_0x2b05e6[_0x0cf2('0x1e')]));});});};exports[_0x0cf2('0x21')]=function(_0xe7ad89){var _0x3a2b09;return db[_0x0cf2('0xe')][_0x0cf2('0x1f')]({'where':_0xe7ad89[_0x0cf2('0x10')][_0x0cf2('0x12')]||{},'attributes':['id',_0x0cf2('0x22'),'role',_0x0cf2('0x23'),_0x0cf2('0x24')]})['then'](function(_0xaba04b){if(!_0xaba04b){throw new Error(util[_0x0cf2('0x25')](_0x0cf2('0x26'),_0xe7ad89['params']['id']));}_0x3a2b09=_0xaba04b;return db[_0x0cf2('0x27')][_0x0cf2('0x28')]({'paused':0x1},{'where':{'UserId':_0x3a2b09['id']},'individualHooks':!![]});})[_0x0cf2('0x17')](function(){return db['MemberReport'][_0x0cf2('0xf')]({'where':{'membername':_0x3a2b09[_0x0cf2('0x22')],'type':_0x0cf2('0x29'),'exitAt':null}});})[_0x0cf2('0x17')](function(_0x511344){if(_0x511344&&_0x511344['length']){var _0x8e6cd4=moment()[_0x0cf2('0x25')](_0x0cf2('0x2a'));for(var _0x100132=0x0,_0x5c0a80=_0x511344[_0x0cf2('0x2b')];_0x100132<_0x5c0a80;_0x100132++){_0x511344[_0x100132]['updateAttributes']({'exitAt':_0x8e6cd4});}}})['then'](function(){var _0x4d5ee7=[];var _0x233a90=utils['getChannels']();_0x233a90['forEach'](function(_0x227315){_0x4d5ee7['push']({'channel':_0x227315,'membername':_0x3a2b09[_0x0cf2('0x22')],'interface':_[_0x0cf2('0x2c')](_0x3a2b09[_0x0cf2('0x24')])?util[_0x0cf2('0x25')](_0x0cf2('0x2d'),_0x3a2b09[_0x0cf2('0x22')]):_0x3a2b09['interface'],'type':_0x0cf2('0x29'),'enterAt':moment()[_0x0cf2('0x25')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0xe7ad89[_0x0cf2('0x2e')][_0x0cf2('0x2f')]||'DEFAULT\x20PAUSE','role':_0x3a2b09[_0x0cf2('0x30')],'internal':_0x3a2b09[_0x0cf2('0x23')],'uniqueid':_0xe7ad89[_0x0cf2('0x2e')]['uniqueid']||null});});return db['MemberReport'][_0x0cf2('0x31')](_0x4d5ee7,{'individualHooks':!![]});})[_0x0cf2('0x17')](function(){return _0x3a2b09[_0x0cf2('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0xe7ad89['body'][_0x0cf2('0x2f')]||_0x0cf2('0x32'),'lastPauseAt':moment()[_0x0cf2('0x25')](_0x0cf2('0x2a'))});})[_0x0cf2('0x1c')](function(_0x16cfb5){throw _0x16cfb5;});};exports[_0x0cf2('0x33')]=function(_0x3f64bb){return Promise['resolve']()[_0x0cf2('0x17')](function(){if(_0x3f64bb[_0x0cf2('0x2e')]['channel']&&!utils['isValidChannel'](_0x3f64bb[_0x0cf2('0x2e')][_0x0cf2('0x34')])){throw new Error(util[_0x0cf2('0x25')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3f64bb[_0x0cf2('0x2e')][_0x0cf2('0x34')]));}return db[_0x0cf2('0xe')][_0x0cf2('0x35')]({'where':_0x3f64bb[_0x0cf2('0x10')][_0x0cf2('0x12')]||{},'attributes':['id',_0x0cf2('0x22'),_0x0cf2('0x30'),_0x0cf2('0x23'),_0x0cf2('0x24'),_0x0cf2('0x36'),_0x0cf2('0x37'),'mailPause',_0x0cf2('0x38'),_0x0cf2('0x39'),_0x0cf2('0x3a'),_0x0cf2('0x3b'),_0x0cf2('0x3c'),_0x0cf2('0x3d'),_0x0cf2('0x3e')]});})[_0x0cf2('0x17')](function(_0x1b84e9){if(!_0x1b84e9){throw new Error(util[_0x0cf2('0x25')](_0x0cf2('0x26'),_0x3f64bb['params']['id']));}return _0x1b84e9['unpause'](_0x3f64bb[_0x0cf2('0x2e')][_0x0cf2('0x34')],_0x0cf2('0x3f'));})[_0x0cf2('0x1c')](function(_0x55a043){throw _0x55a043;});};exports['LogoutUser']=function(_0x4cc2ed){var _0x5099f6=this;return new Promise(function(_0x13f67c,_0x353b07){var _0x489cca;return db[_0x0cf2('0xe')][_0x0cf2('0x35')]({'where':_0x4cc2ed[_0x0cf2('0x10')][_0x0cf2('0x12')]||{},'attributes':['id',_0x0cf2('0x22')]})[_0x0cf2('0x17')](function(_0x26b1c6){if(_0x26b1c6){_0x489cca=_0x26b1c6;return db[_0x0cf2('0x27')][_0x0cf2('0x40')]({'where':{'membername':_0x489cca[_0x0cf2('0x22')]},'individualHooks':!![]});}})[_0x0cf2('0x17')](function(){if(_0x489cca){return db['MemberReport'][_0x0cf2('0xf')]({'where':{'membername':_0x489cca[_0x0cf2('0x22')],'exitAt':null}});}})[_0x0cf2('0x17')](function(_0x5e190f){if(_0x489cca){if(_0x5e190f&&_0x5e190f[_0x0cf2('0x2b')]){var _0x48c779=[];_0x5e190f['forEach'](function(_0x5da1a0){_0x48c779[_0x0cf2('0x41')](_0x5da1a0['update']({'exitAt':moment()[_0x0cf2('0x25')](_0x0cf2('0x2a'))}));});return BPromise[_0x0cf2('0x42')](_0x48c779);}}})[_0x0cf2('0x17')](function(){if(_0x489cca){return _0x489cca[_0x0cf2('0x28')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x391a3a){_0x13f67c(_0x391a3a);})[_0x0cf2('0x1c')](function(_0x36c8e1){_0x353b07(_0x5099f6[_0x0cf2('0x1d')](0x1f4,_0x36c8e1[_0x0cf2('0x1e')]));});});};exports[_0x0cf2('0x43')]=function(_0x1b8801){var _0x23f4b9=this;return new Promise(function(_0x2effe0,_0x2c4555){var _0x415f35;var _0xa99370;var _0x1af3c8;var _0x1b43d9;return db[_0x0cf2('0xe')][_0x0cf2('0x35')]({'where':_0x1b8801['options'][_0x0cf2('0x12')]||{},'attributes':['id','name',_0x0cf2('0x30'),_0x0cf2('0x44'),_0x0cf2('0x45'),'internal',_0x0cf2('0x46'),'interface']})[_0x0cf2('0x17')](function(_0x482bf3){if(_0x482bf3){_0x415f35=_0x482bf3;_0x1b43d9=_0x1b8801[_0x0cf2('0x2e')][_0x0cf2('0x24')]?_0x1b8801[_0x0cf2('0x2e')][_0x0cf2('0x24')]:util[_0x0cf2('0x25')](_0x0cf2('0x2d'),_0x415f35[_0x0cf2('0x22')]);return db[_0x0cf2('0xe')][_0x0cf2('0x47')]({'where':{'role':_0x0cf2('0x48'),'online':!![],'id':{'$ne':_0x415f35['id']}}});}})[_0x0cf2('0x17')](function(_0x186511){if(_0x186511){_0x1af3c8=_0x186511;return require(_0x0cf2('0x49'))[_0x0cf2('0x4a')]();}})[_0x0cf2('0x17')](function(_0x46f844){if(_0x46f844&&_0x46f844['agents']&&_0x1af3c8>=_0x46f844[_0x0cf2('0x4b')]){throw new Error(_0x0cf2('0x4c'));}})[_0x0cf2('0x17')](function(){if(_0x415f35){return db['UserVoiceQueueRt'][_0x0cf2('0x40')]({'where':{'membername':_0x415f35[_0x0cf2('0x22')]},'individualHooks':!![]});}})[_0x0cf2('0x17')](function(){if(_0x415f35){return _0x415f35[_0x0cf2('0x4d')]({'raw':!![]});}})['then'](function(_0x16a628){if(_0x415f35){if(_0x16a628){var _0x4c594d=[];_0xa99370=_0x16a628;if(_0xa99370[_0x0cf2('0x2b')]){for(var _0x198ea2=0x0;_0x198ea2<_0xa99370[_0x0cf2('0x2b')];_0x198ea2++){_0x4c594d[_0x0cf2('0x41')](db[_0x0cf2('0x27')][_0x0cf2('0x4e')]({'membername':_0x415f35[_0x0cf2('0x22')],'UserId':_0x415f35['id'],'queue_name':_0xa99370[_0x198ea2][_0x0cf2('0x22')],'VoiceQueueId':_0xa99370[_0x198ea2]['id'],'interface':_0x1b43d9,'paused':_0x415f35[_0x0cf2('0x46')]||![],'penalty':_0xa99370[_0x198ea2][_0x0cf2('0x4f')]||0x0}));}return BPromise['all'](_0x4c594d);}}}})[_0x0cf2('0x17')](function(){if(_0x415f35){return db[_0x0cf2('0x50')][_0x0cf2('0xf')]({'where':{'membername':_0x415f35['name'],'exitAt':null}});}})[_0x0cf2('0x17')](function(_0x1543da){if(_0x415f35){if(_0x1543da&&_0x1543da[_0x0cf2('0x2b')]){var _0x1201bf=[];_0x1543da[_0x0cf2('0x51')](function(_0x368ea1){_0x1201bf[_0x0cf2('0x41')](_0x368ea1[_0x0cf2('0x28')]({'exitAt':moment()[_0x0cf2('0x25')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x0cf2('0x42')](_0x1201bf);}}})['then'](function(){if(_0x415f35){var _0x350e99=[];var _0x3ad880=[];var _0x4e81db=utils[_0x0cf2('0x52')]();var _0x564927={'membername':_0x415f35[_0x0cf2('0x22')],'interface':_0x1b43d9,'enterAt':moment()['format'](_0x0cf2('0x2a')),'role':_0x415f35[_0x0cf2('0x30')],'internal':_0x415f35[_0x0cf2('0x23')]};_0x4e81db[_0x0cf2('0x51')](function(_0x3af505){_0x350e99[_0x0cf2('0x41')](_[_0x0cf2('0x53')]({'channel':_0x3af505,'type':'LOGIN','data1':_0x0cf2('0x54'),'data2':_0x1b43d9},_0x564927));if(_0x415f35[_0x0cf2('0x46')]){_0x3ad880[_0x0cf2('0x41')](_[_0x0cf2('0x53')]({'channel':_0x3af505,'type':_0x0cf2('0x29'),'data1':_0x0cf2('0x55')},_0x564927));}});return db[_0x0cf2('0x50')][_0x0cf2('0x31')](_0x350e99[_0x0cf2('0x56')](_0x3ad880),{'individualHooks':!![]});}})[_0x0cf2('0x17')](function(){if(_0x415f35){return _0x415f35[_0x0cf2('0x28')]({'online':!![],'lastLoginAt':moment()[_0x0cf2('0x25')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x415f35['loginInPause']||![],'mailPause':_0x415f35['loginInPause']||![],'chatPause':_0x415f35[_0x0cf2('0x46')]||![],'faxPause':_0x415f35[_0x0cf2('0x46')]||![],'smsPause':_0x415f35[_0x0cf2('0x46')]||![],'openchannelPause':_0x415f35[_0x0cf2('0x46')]||![],'pauseType':_0x415f35['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x0cf2('0x25')](_0x0cf2('0x2a')),'interface':_0x1b43d9});}})[_0x0cf2('0x17')](function(_0x170d14){_0x2effe0(_0x170d14);})[_0x0cf2('0x1c')](function(_0x5629fe){_0x2c4555(_0x23f4b9[_0x0cf2('0x1d')](0x1f4,_0x5629fe[_0x0cf2('0x1e')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index d3ceb6a..976aaa6 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 _0xae85=['user:','save','remove','update','emit','removeListener'];(function(_0x28109b,_0x1a4297){var _0x47a353=function(_0x5210ab){while(--_0x5210ab){_0x28109b['push'](_0x28109b['shift']());}};_0x47a353(++_0x1a4297);}(_0xae85,0x1ab));var _0x5ae8=function(_0x19cf1d,_0x315728){_0x19cf1d=_0x19cf1d-0x0;var _0x17a7b2=_0xae85[_0x19cf1d];return _0x17a7b2;};'use strict';var UserEvents=require('./user.events');var events=[_0x5ae8('0x0'),_0x5ae8('0x1'),_0x5ae8('0x2')];function createListener(_0x4e6f98,_0x1af331){return function(_0x52c79b){_0x1af331[_0x5ae8('0x3')](_0x4e6f98,_0x52c79b);};}function removeListener(_0x29a2e1,_0x19ef78){return function(){UserEvents[_0x5ae8('0x4')](_0x29a2e1,_0x19ef78);};}exports['register']=function(_0x54277e){for(var _0x37e9bd=0x0,_0x55c35f=events['length'];_0x37e9bd<_0x55c35f;_0x37e9bd++){var _0x443a61=events[_0x37e9bd];var _0x38675a=createListener(_0x5ae8('0x5')+_0x443a61,_0x54277e);UserEvents['on'](_0x443a61,_0x38675a);}}; \ No newline at end of file +var _0x4a79=['emit','removeListener','length','user:','./user.events'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4a79,0x95));var _0x94a7=function(_0x5de713,_0x1c1ba1){_0x5de713=_0x5de713-0x0;var _0x1742a4=_0x4a79[_0x5de713];return _0x1742a4;};'use strict';var UserEvents=require(_0x94a7('0x0'));var events=['save','remove','update'];function createListener(_0x52799a,_0x292aa5){return function(_0x155a88){_0x292aa5[_0x94a7('0x1')](_0x52799a,_0x155a88);};}function removeListener(_0x45731f,_0x413a09){return function(){UserEvents[_0x94a7('0x2')](_0x45731f,_0x413a09);};}exports['register']=function(_0x31c992){for(var _0x2d027e=0x0,_0x4a4f33=events[_0x94a7('0x3')];_0x2d027e<_0x4a4f33;_0x2d027e++){var _0x1df589=events[_0x2d027e];var _0x5cf54f=createListener(_0x94a7('0x4')+_0x1df589,_0x31c992);UserEvents['on'](_0x1df589,_0x5cf54f);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 0900d13..9e240fa 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x204992,_0x1464be){var _0x69661c=function(_0x246d4f){while(--_0x246d4f){_0x204992['push'](_0x204992['shift']());}};_0x69661c(++_0x1464be);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x574576,_0x3ac1c3){var _0x2b9d6d=function(_0x171ab5){while(--_0x171ab5){_0x574576['push'](_0x574576['shift']());}};_0x2b9d6d(++_0x3ac1c3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x51bb38,_0x4e57a0){_0x51bb38=_0x51bb38-0x0;var _0x51c09b=_0xcb91[_0x51bb38];return _0x51c09b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index f8823f9..39a6247 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 _0xb66b=['exports','INTEGER'];(function(_0x4acdff,_0x2bf955){var _0xd8c061=function(_0x1e0de2){while(--_0x1e0de2){_0x4acdff['push'](_0x4acdff['shift']());}};_0xd8c061(++_0x2bf955);}(_0xb66b,0x9a));var _0xbb66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb66b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xbb66('0x0')]={'penalty':{'type':Sequelize[_0xbb66('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1af3=['exports','INTEGER','sequelize'];(function(_0x2d81f3,_0x387144){var _0x425fbf=function(_0x19e787){while(--_0x19e787){_0x2d81f3['push'](_0x2d81f3['shift']());}};_0x425fbf(++_0x387144);}(_0x1af3,0x1ca));var _0x31af=function(_0x93942f,_0xb48547){_0x93942f=_0x93942f-0x0;var _0x23fcd8=_0x1af3[_0x93942f];return _0x23fcd8;};'use strict';var Sequelize=require(_0x31af('0x0'));module[_0x31af('0x1')]={'penalty':{'type':Sequelize[_0x31af('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 6eeb5d8..2a22568 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 _0xd5f5=['../../config/environment','./userChatQueue.attributes','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','request-promise','path'];(function(_0x4b35c4,_0x2ee449){var _0x1cd323=function(_0x37f6be){while(--_0x37f6be){_0x4b35c4['push'](_0x4b35c4['shift']());}};_0x1cd323(++_0x2ee449);}(_0xd5f5,0x151));var _0x5d5f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xd5f5[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x5d5f('0x0'));var util=require(_0x5d5f('0x1'));var logger=require(_0x5d5f('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5d5f('0x3'));var fs=require('fs');var path=require(_0x5d5f('0x4'));var rimraf=require('rimraf');var config=require(_0x5d5f('0x5'));var attributes=require(_0x5d5f('0x6'));module['exports']=function(_0x3e2852,_0x4de1ae){return _0x3e2852['define'](_0x5d5f('0x7'),attributes,{'tableName':_0x5d5f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5b2=['path','rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','lodash','util','api','moment','bluebird'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xb5b2,0xc7));var _0x2b5b=function(_0x3d1c05,_0xf5cdb8){_0x3d1c05=_0x3d1c05-0x0;var _0x14d687=_0xb5b2[_0x3d1c05];return _0x14d687;};'use strict';var _=require(_0x2b5b('0x0'));var util=require(_0x2b5b('0x1'));var logger=require('../../config/logger')(_0x2b5b('0x2'));var moment=require(_0x2b5b('0x3'));var BPromise=require(_0x2b5b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b5b('0x5'));var rimraf=require(_0x2b5b('0x6'));var config=require(_0x2b5b('0x7'));var attributes=require(_0x2b5b('0x8'));module[_0x2b5b('0x9')]=function(_0x3f0395,_0x289d7a){return _0x3f0395['define'](_0x2b5b('0xa'),attributes,{'tableName':_0x2b5b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 75657e9..5fd452d 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 _0x6c3c=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x4b1cd1,_0x5c2b36){var _0x574ad1=function(_0x170841){while(--_0x170841){_0x4b1cd1['push'](_0x4b1cd1['shift']());}};_0x574ad1(++_0x5c2b36);}(_0x6c3c,0x1bf));var _0xc6c3=function(_0x35992b,_0x1e9b5f){_0x35992b=_0x35992b-0x0;var _0x3f3086=_0x6c3c[_0x35992b];return _0x3f3086;};'use strict';var _=require(_0xc6c3('0x0'));var util=require(_0xc6c3('0x1'));var moment=require(_0xc6c3('0x2'));var BPromise=require(_0xc6c3('0x3'));var rs=require(_0xc6c3('0x4'));var fs=require('fs');var Redis=require(_0xc6c3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc6c3('0x6'));var logger=require(_0xc6c3('0x7'))(_0xc6c3('0x8'));var config=require(_0xc6c3('0x9'));var jayson=require(_0xc6c3('0xa'));var client=jayson[_0xc6c3('0xb')][_0xc6c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4314fa,_0x21b4e0,_0x27f352){return new BPromise(function(_0x368bce,_0xa1bcac){return client[_0xc6c3('0xd')](_0x4314fa,_0x27f352)[_0xc6c3('0xe')](function(_0x56addf){logger[_0xc6c3('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x21b4e0,_0xc6c3('0x10'));logger[_0xc6c3('0x11')](_0xc6c3('0x12'),_0x21b4e0,_0xc6c3('0x10'),JSON[_0xc6c3('0x13')](_0x56addf));if(_0x56addf[_0xc6c3('0x14')]){if(_0x56addf[_0xc6c3('0x14')][_0xc6c3('0x15')]===0x1f4){logger[_0xc6c3('0x14')](_0xc6c3('0x16'),_0x21b4e0,_0x56addf[_0xc6c3('0x14')][_0xc6c3('0x17')]);return _0xa1bcac(_0x56addf[_0xc6c3('0x14')][_0xc6c3('0x17')]);}logger['error'](_0xc6c3('0x16'),_0x21b4e0,_0x56addf[_0xc6c3('0x14')][_0xc6c3('0x17')]);return _0x368bce(_0x56addf[_0xc6c3('0x14')][_0xc6c3('0x17')]);}else{logger[_0xc6c3('0xf')](_0xc6c3('0x16'),_0x21b4e0,_0xc6c3('0x10'));_0x368bce(_0x56addf['result'][_0xc6c3('0x17')]);}})[_0xc6c3('0x18')](function(_0x4123a3){logger[_0xc6c3('0x14')](_0xc6c3('0x16'),_0x21b4e0,_0x4123a3);_0xa1bcac(_0x4123a3);});});} \ No newline at end of file +var _0x094d=['message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x094d,0x6c));var _0xd094=function(_0x222345,_0x35c43c){_0x222345=_0x222345-0x0;var _0x390b2b=_0x094d[_0x222345];return _0x390b2b;};'use strict';var _=require(_0xd094('0x0'));var util=require('util');var moment=require(_0xd094('0x1'));var BPromise=require(_0xd094('0x2'));var rs=require(_0xd094('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd094('0x4'))['db'];var utils=require(_0xd094('0x5'));var logger=require(_0xd094('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd094('0x7'));var client=jayson['client'][_0xd094('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14c50c,_0x3a2406,_0x35949d){return new BPromise(function(_0x1b1eaf,_0x1e2d5d){return client['request'](_0x14c50c,_0x35949d)[_0xd094('0x9')](function(_0x870f8e){logger[_0xd094('0xa')](_0xd094('0xb'),_0x3a2406,_0xd094('0xc'));logger[_0xd094('0xd')](_0xd094('0xe'),_0x3a2406,'request\x20sent',JSON[_0xd094('0xf')](_0x870f8e));if(_0x870f8e[_0xd094('0x10')]){if(_0x870f8e[_0xd094('0x10')][_0xd094('0x11')]===0x1f4){logger[_0xd094('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x3a2406,_0x870f8e['error'][_0xd094('0x12')]);return _0x1e2d5d(_0x870f8e[_0xd094('0x10')][_0xd094('0x12')]);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x3a2406,_0x870f8e[_0xd094('0x10')][_0xd094('0x12')]);return _0x1b1eaf(_0x870f8e[_0xd094('0x10')]['message']);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x3a2406,_0xd094('0xc'));_0x1b1eaf(_0x870f8e[_0xd094('0x13')][_0xd094('0x12')]);}})[_0xd094('0x14')](function(_0x2ce3d7){logger['error'](_0xd094('0xb'),_0x3a2406,_0x2ce3d7);_0x1e2d5d(_0x2ce3d7);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index f856bd4..836629f 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x28f0b6,_0x290a14){var _0x44156e=function(_0x4e57de){while(--_0x4e57de){_0x28f0b6['push'](_0x28f0b6['shift']());}};_0x44156e(++_0x290a14);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x14a778,_0x4e907){var _0x2ff315=function(_0x2819ac){while(--_0x2819ac){_0x14a778['push'](_0x14a778['shift']());}};_0x2ff315(++_0x4e907);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 057984c..da84b49 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 _0x6fee=['INTEGER','STRING','sequelize','exports'];(function(_0x8e4164,_0x5ba739){var _0x59f08b=function(_0x26d431){while(--_0x26d431){_0x8e4164['push'](_0x8e4164['shift']());}};_0x59f08b(++_0x5ba739);}(_0x6fee,0x126));var _0xe6fe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fee[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe6fe('0x0'));module[_0xe6fe('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xe6fe('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xe6fe('0x3')]}}; \ No newline at end of file +var _0x43cb=['STRING','INTEGER'];(function(_0x13c19c,_0x1d4a84){var _0x594ee4=function(_0x326bb8){while(--_0x326bb8){_0x13c19c['push'](_0x13c19c['shift']());}};_0x594ee4(++_0x1d4a84);}(_0x43cb,0x103));var _0xb43c=function(_0xa62ad2,_0x511ae7){_0xa62ad2=_0xa62ad2-0x0;var _0x1b0be3=_0x43cb[_0xa62ad2];return _0x1b0be3;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xb43c('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb43c('0x0')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xb43c('0x1')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 02cffaa..39ffe22 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 _0x5ee3=['../../config/environment','./userFaxQueue.attributes','exports','define','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x54f126,_0x36ce8b){var _0x5a8c88=function(_0x27b911){while(--_0x27b911){_0x54f126['push'](_0x54f126['shift']());}};_0x5a8c88(++_0x36ce8b);}(_0x5ee3,0x184));var _0x35ee=function(_0x3eaf06,_0x1bf08d){_0x3eaf06=_0x3eaf06-0x0;var _0x4b16d2=_0x5ee3[_0x3eaf06];return _0x4b16d2;};'use strict';var _=require(_0x35ee('0x0'));var util=require(_0x35ee('0x1'));var logger=require(_0x35ee('0x2'))(_0x35ee('0x3'));var moment=require('moment');var BPromise=require(_0x35ee('0x4'));var rp=require(_0x35ee('0x5'));var fs=require('fs');var path=require(_0x35ee('0x6'));var rimraf=require(_0x35ee('0x7'));var config=require(_0x35ee('0x8'));var attributes=require(_0x35ee('0x9'));module[_0x35ee('0xa')]=function(_0x330fc7,_0x45781d){return _0x330fc7[_0x35ee('0xb')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2129=['./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x3cac83,_0x4b4504){var _0x1cb62c=function(_0x51e73b){while(--_0x51e73b){_0x3cac83['push'](_0x3cac83['shift']());}};_0x1cb62c(++_0x4b4504);}(_0x2129,0xa1));var _0x9212=function(_0x16e69c,_0x2645fd){_0x16e69c=_0x16e69c-0x0;var _0x40f7b1=_0x2129[_0x16e69c];return _0x40f7b1;};'use strict';var _=require(_0x9212('0x0'));var util=require(_0x9212('0x1'));var logger=require(_0x9212('0x2'))(_0x9212('0x3'));var moment=require(_0x9212('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9212('0x5'));var rimraf=require(_0x9212('0x6'));var config=require(_0x9212('0x7'));var attributes=require(_0x9212('0x8'));module[_0x9212('0x9')]=function(_0x37fc3a,_0x4eb94c){return _0x37fc3a[_0x9212('0xa')](_0x9212('0xb'),attributes,{'tableName':_0x9212('0xc'),'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 88286b0..bc25433 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 _0xce15=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x4a361a,_0x413703){var _0x4cd941=function(_0x137f79){while(--_0x137f79){_0x4a361a['push'](_0x4a361a['shift']());}};_0x4cd941(++_0x413703);}(_0xce15,0xef));var _0x5ce1=function(_0x2a9f4,_0x25c14a){_0x2a9f4=_0x2a9f4-0x0;var _0x3c39e0=_0xce15[_0x2a9f4];return _0x3c39e0;};'use strict';var _=require(_0x5ce1('0x0'));var util=require(_0x5ce1('0x1'));var moment=require(_0x5ce1('0x2'));var BPromise=require(_0x5ce1('0x3'));var rs=require(_0x5ce1('0x4'));var fs=require('fs');var Redis=require(_0x5ce1('0x5'));var db=require(_0x5ce1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5ce1('0x7'))(_0x5ce1('0x8'));var config=require(_0x5ce1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5ce1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1823c1,_0x355e20,_0x226465){return new BPromise(function(_0x38263b,_0x409d2a){return client[_0x5ce1('0xb')](_0x1823c1,_0x226465)['then'](function(_0x382c7f){logger[_0x5ce1('0xc')](_0x5ce1('0xd'),_0x355e20,_0x5ce1('0xe'));logger['debug'](_0x5ce1('0xf'),_0x355e20,'request\x20sent',JSON[_0x5ce1('0x10')](_0x382c7f));if(_0x382c7f[_0x5ce1('0x11')]){if(_0x382c7f[_0x5ce1('0x11')][_0x5ce1('0x12')]===0x1f4){logger[_0x5ce1('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x355e20,_0x382c7f[_0x5ce1('0x11')][_0x5ce1('0x13')]);return _0x409d2a(_0x382c7f[_0x5ce1('0x11')][_0x5ce1('0x13')]);}logger[_0x5ce1('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x355e20,_0x382c7f['error'][_0x5ce1('0x13')]);return _0x38263b(_0x382c7f[_0x5ce1('0x11')]['message']);}else{logger[_0x5ce1('0xc')](_0x5ce1('0xd'),_0x355e20,_0x5ce1('0xe'));_0x38263b(_0x382c7f[_0x5ce1('0x14')][_0x5ce1('0x13')]);}})[_0x5ce1('0x15')](function(_0x376c5a){logger[_0x5ce1('0x11')](_0x5ce1('0xd'),_0x355e20,_0x376c5a);_0x409d2a(_0x376c5a);});});} \ No newline at end of file +var _0x094d=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','debug','stringify','error','code','message','UserFaxQueue,\x20%s,\x20%s','request\x20sent','result','catch','lodash'];(function(_0x265b2d,_0x899633){var _0x47ea65=function(_0x21e2a3){while(--_0x21e2a3){_0x265b2d['push'](_0x265b2d['shift']());}};_0x47ea65(++_0x899633);}(_0x094d,0x149));var _0xd094=function(_0x3615ff,_0x2890c3){_0x3615ff=_0x3615ff-0x0;var _0x56dc5b=_0x094d[_0x3615ff];return _0x56dc5b;};'use strict';var _=require(_0xd094('0x0'));var util=require(_0xd094('0x1'));var moment=require(_0xd094('0x2'));var BPromise=require(_0xd094('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd094('0x4'));var db=require(_0xd094('0x5'))['db'];var utils=require(_0xd094('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd094('0x7'));var jayson=require(_0xd094('0x8'));var client=jayson[_0xd094('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2bfb98,_0x3d4e79,_0x2577ef){return new BPromise(function(_0xe522d6,_0x23b8e9){return client[_0xd094('0xa')](_0x2bfb98,_0x2577ef)[_0xd094('0xb')](function(_0x5a8ae5){logger[_0xd094('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x3d4e79,'request\x20sent');logger[_0xd094('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x3d4e79,'request\x20sent',JSON[_0xd094('0xe')](_0x5a8ae5));if(_0x5a8ae5['error']){if(_0x5a8ae5[_0xd094('0xf')][_0xd094('0x10')]===0x1f4){logger[_0xd094('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x3d4e79,_0x5a8ae5[_0xd094('0xf')][_0xd094('0x11')]);return _0x23b8e9(_0x5a8ae5['error']['message']);}logger[_0xd094('0xf')](_0xd094('0x12'),_0x3d4e79,_0x5a8ae5['error']['message']);return _0xe522d6(_0x5a8ae5[_0xd094('0xf')][_0xd094('0x11')]);}else{logger['info'](_0xd094('0x12'),_0x3d4e79,_0xd094('0x13'));_0xe522d6(_0x5a8ae5[_0xd094('0x14')]['message']);}})[_0xd094('0x15')](function(_0x3f1aa6){logger[_0xd094('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x3d4e79,_0x3f1aa6);_0x23b8e9(_0x3f1aa6);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index f0b2db2..6a276f3 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1db858,_0x32bb24){var _0x429b5c=function(_0x14b3d4){while(--_0x14b3d4){_0x1db858['push'](_0x1db858['shift']());}};_0x429b5c(++_0x32bb24);}(_0x70e0,0x17b));var _0x070e=function(_0x19ee76,_0x2547b0){_0x19ee76=_0x19ee76-0x0;var _0x33bde1=_0x70e0[_0x19ee76];return _0x33bde1;};'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(_0x5d4510,_0x5aa2c8){var _0x3dfae0=function(_0x5d5587){while(--_0x5d5587){_0x5d4510['push'](_0x5d4510['shift']());}};_0x3dfae0(++_0x5aa2c8);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 68be5cd..ae16102 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 _0x9ea3=['sequelize','exports','INTEGER'];(function(_0x271143,_0x11ee2c){var _0x5e1327=function(_0x386f46){while(--_0x386f46){_0x271143['push'](_0x271143['shift']());}};_0x5e1327(++_0x11ee2c);}(_0x9ea3,0x126));var _0x39ea=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x9ea3[_0x26462c];return _0x509a42;};'use strict';var Sequelize=require(_0x39ea('0x0'));module[_0x39ea('0x1')]={'penalty':{'type':Sequelize[_0x39ea('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1f0d=['sequelize','exports','INTEGER'];(function(_0x313abe,_0x47ec2f){var _0x98dea9=function(_0x378809){while(--_0x378809){_0x313abe['push'](_0x313abe['shift']());}};_0x98dea9(++_0x47ec2f);}(_0x1f0d,0x165));var _0xd1f0=function(_0x4a1fd0,_0x28d14f){_0x4a1fd0=_0x4a1fd0-0x0;var _0x5afafb=_0x1f0d[_0x4a1fd0];return _0x5afafb;};'use strict';var Sequelize=require(_0xd1f0('0x0'));module[_0xd1f0('0x1')]={'penalty':{'type':Sequelize[_0xd1f0('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 36bc2d8..4073504 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 _0x801c=['util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues'];(function(_0x24397a,_0x1c116d){var _0x4356ce=function(_0x34d65a){while(--_0x34d65a){_0x24397a['push'](_0x24397a['shift']());}};_0x4356ce(++_0x1c116d);}(_0x801c,0x1a4));var _0xc801=function(_0x4f2fb4,_0x1a0ca2){_0x4f2fb4=_0x4f2fb4-0x0;var _0x4d3275=_0x801c[_0x4f2fb4];return _0x4d3275;};'use strict';var _=require('lodash');var util=require(_0xc801('0x0'));var logger=require(_0xc801('0x1'))('api');var moment=require(_0xc801('0x2'));var BPromise=require(_0xc801('0x3'));var rp=require(_0xc801('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc801('0x5'));var attributes=require(_0xc801('0x6'));module[_0xc801('0x7')]=function(_0x1dbfce,_0xf05af9){return _0x1dbfce[_0xc801('0x8')]('UserMailQueue',attributes,{'tableName':_0xc801('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88a7=['user_has_mail_queues','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','UserMailQueue'];(function(_0x12d302,_0x32de10){var _0x23756a=function(_0x6a1892){while(--_0x6a1892){_0x12d302['push'](_0x12d302['shift']());}};_0x23756a(++_0x32de10);}(_0x88a7,0x121));var _0x788a=function(_0x53dc2f,_0x352f5f){_0x53dc2f=_0x53dc2f-0x0;var _0x2db8b6=_0x88a7[_0x53dc2f];return _0x2db8b6;};'use strict';var _=require(_0x788a('0x0'));var util=require('util');var logger=require(_0x788a('0x1'))(_0x788a('0x2'));var moment=require('moment');var BPromise=require(_0x788a('0x3'));var rp=require(_0x788a('0x4'));var fs=require('fs');var path=require(_0x788a('0x5'));var rimraf=require(_0x788a('0x6'));var config=require(_0x788a('0x7'));var attributes=require(_0x788a('0x8'));module[_0x788a('0x9')]=function(_0x521023,_0x5bb3f7){return _0x521023['define'](_0x788a('0xa'),attributes,{'tableName':_0x788a('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 3fb52e3..d966d8d 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x3bda83,_0x5a4f47){var _0x43e51e=function(_0x39363d){while(--_0x39363d){_0x3bda83['push'](_0x3bda83['shift']());}};_0x43e51e(++_0x5a4f47);}(_0xe14b,0x93));var _0xbe14=function(_0x561771,_0x358c7c){_0x561771=_0x561771-0x0;var _0x441fa1=_0xe14b[_0x561771];return _0x441fa1;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x2cd651,_0xd086a6){var _0x3523fb=function(_0x55c630){while(--_0x55c630){_0x2cd651['push'](_0x2cd651['shift']());}};_0x3523fb(++_0xd086a6);}(_0x00bb,0x1d8));var _0xb00b=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x00bb[_0x24237f];return _0x48298e;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index b317baf..78d5546 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 _0xf2f9=['../../components/interaction/service','../../config/environment','post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x8b3162,_0x424051){var _0x726919=function(_0x358ae5){while(--_0x358ae5){_0x8b3162['push'](_0x8b3162['shift']());}};_0x726919(++_0x424051);}(_0xf2f9,0x10a));var _0x9f2f=function(_0x4d9bb2,_0x3db50d){_0x4d9bb2=_0x4d9bb2-0x0;var _0x3179fe=_0xf2f9[_0x4d9bb2];return _0x3179fe;};'use strict';var multer=require(_0x9f2f('0x0'));var util=require(_0x9f2f('0x1'));var path=require(_0x9f2f('0x2'));var timeout=require(_0x9f2f('0x3'));var express=require(_0x9f2f('0x4'));var router=express['Router']();var fs_extra=require(_0x9f2f('0x5'));var auth=require(_0x9f2f('0x6'));var interaction=require(_0x9f2f('0x7'));var config=require(_0x9f2f('0x8'));var controller=require('./userNotification.controller');router[_0x9f2f('0x9')]('/',auth[_0x9f2f('0xa')](),controller[_0x9f2f('0xb')]);module[_0x9f2f('0xc')]=router; \ No newline at end of file +var _0x1fd5=['./userNotification.controller','post','isAuthenticated','exports','util','express','Router','fs-extra','../../components/interaction/service'];(function(_0x435044,_0x36ab8e){var _0x33d4c6=function(_0x15efa0){while(--_0x15efa0){_0x435044['push'](_0x435044['shift']());}};_0x33d4c6(++_0x36ab8e);}(_0x1fd5,0x82));var _0x51fd=function(_0xbfe501,_0x279390){_0xbfe501=_0xbfe501-0x0;var _0xab1f4=_0x1fd5[_0xbfe501];return _0xab1f4;};'use strict';var multer=require('multer');var util=require(_0x51fd('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x51fd('0x1'));var router=express[_0x51fd('0x2')]();var fs_extra=require(_0x51fd('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x51fd('0x4'));var config=require('../../config/environment');var controller=require(_0x51fd('0x5'));router[_0x51fd('0x6')]('/',auth[_0x51fd('0x7')](),controller['sendUserNotification']);module[_0x51fd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 49aac76..3622988 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 _0xd3cf=['exports','TEXT','STRING','sequelize'];(function(_0x251b74,_0x371743){var _0x375131=function(_0x31968c){while(--_0x31968c){_0x251b74['push'](_0x251b74['shift']());}};_0x375131(++_0x371743);}(_0xd3cf,0x1e7));var _0xfd3c=function(_0x186a52,_0x1cfa2d){_0x186a52=_0x186a52-0x0;var _0x4a2ba2=_0xd3cf[_0x186a52];return _0x4a2ba2;};'use strict';var Sequelize=require(_0xfd3c('0x0'));module[_0xfd3c('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xfd3c('0x2')]},'recipientsDescription':{'type':Sequelize[_0xfd3c('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xf0aa=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x46420b,_0x1e2349){var _0x375337=function(_0x355e2c){while(--_0x355e2c){_0x46420b['push'](_0x46420b['shift']());}};_0x375337(++_0x1e2349);}(_0xf0aa,0x112));var _0xaf0a=function(_0x22243,_0x5f454d){_0x22243=_0x22243-0x0;var _0x1339d1=_0xf0aa[_0x22243];return _0x1339d1;};'use strict';var Sequelize=require(_0xaf0a('0x0'));module[_0xaf0a('0x1')]={'body':{'type':Sequelize[_0xaf0a('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xaf0a('0x2')]},'recipientsDescription':{'type':Sequelize[_0xaf0a('0x3')]},'beep':{'type':Sequelize[_0xaf0a('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index e09ce32..debdd51 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 _0x41b4=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./userNotification.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','sendUserNotification','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','body','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','user','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','User','union','ids','queue','push','all','flatten','catch','findOne','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse'];(function(_0x7ad123,_0xeeeef3){var _0x37d073=function(_0x51367b){while(--_0x51367b){_0x7ad123['push'](_0x7ad123['shift']());}};_0x37d073(++_0xeeeef3);}(_0x41b4,0x12f));var _0x441b=function(_0x133673,_0x3b50c9){_0x133673=_0x133673-0x0;var _0x6ac4cc=_0x41b4[_0x133673];return _0x6ac4cc;};'use strict';var emlformat=require(_0x441b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x441b('0x1'));var jsonpatch=require(_0x441b('0x2'));var rp=require(_0x441b('0x3'));var moment=require(_0x441b('0x4'));var BPromise=require(_0x441b('0x5'));var Mustache=require(_0x441b('0x6'));var util=require('util');var path=require(_0x441b('0x7'));var sox=require(_0x441b('0x8'));var csv=require('to-csv');var ejs=require(_0x441b('0x9'));var fs=require('fs');var fs_extra=require(_0x441b('0xa'));var _=require(_0x441b('0xb'));var squel=require(_0x441b('0xc'));var crypto=require(_0x441b('0xd'));var jsforce=require(_0x441b('0xe'));var deskjs=require(_0x441b('0xf'));var toCsv=require(_0x441b('0x10'));var querystring=require('querystring');var Papa=require(_0x441b('0x11'));var Redis=require('ioredis');var authService=require(_0x441b('0x12'));var qs=require(_0x441b('0x13'));var as=require(_0x441b('0x14'));var hardwareService=require(_0x441b('0x15'));var logger=require(_0x441b('0x16'))('api');var utils=require(_0x441b('0x17'));var config=require(_0x441b('0x18'));var licenseUtil=require(_0x441b('0x19'));var db=require(_0x441b('0x1a'))['db'];config[_0x441b('0x1b')]=_[_0x441b('0x1c')](config[_0x441b('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x441b('0x1b')]));require(_0x441b('0x1d'))[_0x441b('0x1e')](socket);function respondWithStatusCode(_0x4d003f,_0x16a2a6){_0x16a2a6=_0x16a2a6||0xcc;return function(_0x1cf480){if(_0x1cf480){return _0x4d003f[_0x441b('0x1f')](_0x16a2a6);}return _0x4d003f['status'](_0x16a2a6)['end']();};}function respondWithResult(_0x277fec,_0x2e9b27){_0x2e9b27=_0x2e9b27||0xc8;return function(_0x3e82d8){if(_0x3e82d8){return _0x277fec[_0x441b('0x20')](_0x2e9b27)[_0x441b('0x21')](_0x3e82d8);}};}function respondWithFilteredResult(_0x535a01,_0x3272ba){return function(_0x11c843){if(_0x11c843){var _0x516f51=typeof _0x3272ba[_0x441b('0x22')]===_0x441b('0x23')&&typeof _0x3272ba['limit']==='undefined';var _0x7504ad=_0x11c843[_0x441b('0x24')];var _0x1b87d4=_0x516f51?0x0:_0x3272ba[_0x441b('0x22')];var _0x1f7f13=_0x516f51?_0x11c843['count']:_0x3272ba[_0x441b('0x22')]+_0x3272ba[_0x441b('0x25')];var _0x42c591;if(_0x1f7f13>=_0x7504ad){_0x1f7f13=_0x7504ad;_0x42c591=0xc8;}else{_0x42c591=0xce;}_0x535a01[_0x441b('0x20')](_0x42c591);return _0x535a01[_0x441b('0x26')](_0x441b('0x27'),_0x1b87d4+'-'+_0x1f7f13+'/'+_0x7504ad)[_0x441b('0x21')](_0x11c843);}return null;};}function patchUpdates(_0x1a6f03){return function(_0x2d1fda){try{jsonpatch['apply'](_0x2d1fda,_0x1a6f03,!![]);}catch(_0xfc941){return BPromise[_0x441b('0x28')](_0xfc941);}return _0x2d1fda[_0x441b('0x29')]();};}function saveUpdates(_0x19dd8f,_0x3866da){return function(_0x145f44){if(_0x145f44){return _0x145f44[_0x441b('0x2a')](_0x19dd8f)[_0x441b('0x2b')](function(_0x2a0b97){return _0x2a0b97;});}return null;};}function removeEntity(_0x115043,_0x247168){return function(_0x309869){if(_0x309869){return _0x309869[_0x441b('0x2c')]()[_0x441b('0x2b')](function(){_0x115043[_0x441b('0x20')](0xcc)[_0x441b('0x2d')]();});}};}function handleEntityNotFound(_0x16e620,_0x42731f){return function(_0x4f02e6){if(!_0x4f02e6){_0x16e620[_0x441b('0x1f')](0x194);}return _0x4f02e6;};}function handleError(_0x27aeda,_0x2e32cf){_0x2e32cf=_0x2e32cf||0x1f4;return function(_0x2d240c){logger[_0x441b('0x2e')](_0x2d240c[_0x441b('0x2f')]);if(_0x2d240c[_0x441b('0x30')]){delete _0x2d240c['name'];}_0x27aeda['status'](_0x2e32cf)[_0x441b('0x31')](_0x2d240c);};}exports[_0x441b('0x32')]=function(_0x105179,_0x31a32a,_0xb3e3c1){if(!_0x105179['body'][_0x441b('0x33')](_0x441b('0x34'))&&!_0x105179['body']['hasOwnProperty'](_0x441b('0x35'))){throw new db[(_0x441b('0x36'))][(_0x441b('0x37'))](_0x441b('0x38'));}else{if(_0x105179[_0x441b('0x39')][_0x441b('0x33')](_0x441b('0x35'))&&!_0x105179[_0x441b('0x39')][_0x441b('0x33')](_0x441b('0x3a'))){throw new db[(_0x441b('0x36'))][(_0x441b('0x37'))](_0x441b('0x3b'));}if(!_0x105179[_0x441b('0x39')]['hasOwnProperty'](_0x441b('0x3c'))){throw new db[(_0x441b('0x36'))][(_0x441b('0x37'))](_0x441b('0x3d'));}else{try{var _0x330af0=JSON[_0x441b('0x3e')](_0x105179[_0x441b('0x39')][_0x441b('0x3c')]);}catch(_0x2d5a0b){logger[_0x441b('0x2e')](_0x2d5a0b);throw new db['Sequelize'][(_0x441b('0x37'))](_0x441b('0x3f'));}var _0x1a846f=[_0x441b('0x40'),_0x441b('0x41'),_0x441b('0x42'),_0x441b('0x43'),_0x441b('0x44'),_0x441b('0x45'),'whatsappqueue',_0x441b('0x46'),'user'];if(_[_0x441b('0x47')](_0x330af0,function(_0x4582e0){return!_[_0x441b('0x48')](_0x1a846f,_0x4582e0[_0x441b('0x49')][_0x441b('0x4a')]());})){throw new db[(_0x441b('0x36'))]['ValidationError'](_0x441b('0x4b'));}}}var _0xc2da={};_0xc2da[_0x441b('0x4c')]=_0x105179[_0x441b('0x39')][_0x441b('0x33')](_0x441b('0x4c'))?_0x105179['body'][_0x441b('0x4c')]:_0x105179['user'][_0x441b('0x4d')];_0xc2da[_0x441b('0x4e')]=_[_0x441b('0x4f')](_0x105179['body'][_0x441b('0x4e')])?null:_0x105179[_0x441b('0x39')][_0x441b('0x4e')];_0xc2da[_0x441b('0x50')]=_0x105179[_0x441b('0x39')]['beep']||![];_0xc2da[_0x441b('0x51')]=_0x105179[_0x441b('0x52')]['id'];return getContent(_0x105179['body'])[_0x441b('0x2b')](function(_0x49f047){_0xc2da['body']=_0x49f047;return getRecipients(_0x330af0);})[_0x441b('0x2b')](function(_0x3fe52c){_0xc2da[_0x441b('0x53')]=_[_0x441b('0x54')](_0x3fe52c)[_0x441b('0x55')](',');return db[_0x441b('0x56')][_0x441b('0x57')](function(_0x25d94c){return db[_0x441b('0x58')][_0x441b('0x59')](_0xc2da,{'raw':!![],'transaction':_0x25d94c})[_0x441b('0x2b')](function(_0x5f1ab7){var _0x2aced9={'sender':_0xc2da[_0x441b('0x4c')],'description':_0xc2da['recipientsDescription'],'content':_0xc2da[_0x441b('0x39')],'beep':_0xc2da[_0x441b('0x50')]};_0x3fe52c[_0x441b('0x5a')](function(_0x4fea52){_0x2aced9[_0x441b('0x5b')]=_0x4fea52;socket[_0x441b('0x5c')](_0x441b('0x5d'),_0x2aced9);});return _0x5f1ab7;});});})['then'](respondWithResult(_0x31a32a,0xc9))['catch'](handleError(_0x31a32a,null));};function getContent(_0x34cd7f){return new BPromise(function(_0x212e66,_0x1da4eb){if(_0x34cd7f[_0x441b('0x34')]){_0x212e66(_0x34cd7f['text']);return;}return db['Template']['findOne']({'attributes':[_0x441b('0x5e')],'where':{'id':_0x34cd7f[_0x441b('0x35')]},'raw':!![]})['then'](function(_0x4fb2db){if(!_0x4fb2db)throw new db[(_0x441b('0x36'))]['ValidationError'](_0x441b('0x5f'));var _0x5be5d1=Mustache[_0x441b('0x60')](_0x4fb2db['html'],_0x34cd7f[_0x441b('0x3a')]);_0x212e66(_0x5be5d1);})['catch'](function(_0x520398){_0x1da4eb(_0x520398);});});}function getRecipients(_0xcfbde9){return new BPromise(function(_0x1be683,_0x23c543){var _0x247d96=[];var _0x1c5024=[];_0xcfbde9['forEach'](function(_0x39953e){var _0x455f13=_['startCase'](_0x39953e[_0x441b('0x49')][_0x441b('0x4a')]());if(_0x455f13===_0x441b('0x61')){_0x247d96=_[_0x441b('0x62')](_0x247d96,_0x39953e[_0x441b('0x63')]);}else{if(_[_0x441b('0x48')](_0x455f13,_0x441b('0x64')))_0x455f13=_0x455f13['replace'](_0x441b('0x64'),'Queue');_0x39953e[_0x441b('0x63')][_0x441b('0x5a')](function(_0x2a634b){_0x1c5024[_0x441b('0x65')](getAgents(_0x455f13,_0x2a634b));});}});return BPromise[_0x441b('0x66')](_0x1c5024)[_0x441b('0x2b')](function(_0x4ae30a){_0x247d96=_[_0x441b('0x62')](_0x247d96,_[_0x441b('0x67')](_0x4ae30a));_0x1be683(_0x247d96);})[_0x441b('0x68')](function(_0x31c310){_0x23c543(_0x31c310);});});}function getAgents(_0x31b862,_0x35c41e){return new BPromise(function(_0x213553,_0xf7a9db){return db[_0x31b862][_0x441b('0x69')]({'where':{'id':_0x35c41e}})[_0x441b('0x2b')](function(_0x1a0b04){return _0x1a0b04[_0x441b('0x6a')]({'attributes':['id'],'raw':!![]})[_0x441b('0x2b')](function(_0xb62c15){var _0x278be0=_['map'](_0xb62c15,'id');_0x213553(_0x278be0);});})[_0x441b('0x68')](function(_0x14424e){_0xf7a9db(_0x14424e);});});} \ No newline at end of file +var _0x7f55=['offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sequelize','transaction','UserNotification','create','forEach','emit','userNotification:send','catch','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','startCase','union','ids','queue','replace','Queue','push','all','findOne','getAgents','map','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end'];(function(_0x3b9fda,_0x59349d){var _0x2729fb=function(_0x4b93ed){while(--_0x4b93ed){_0x3b9fda['push'](_0x3b9fda['shift']());}};_0x2729fb(++_0x59349d);}(_0x7f55,0x172));var _0x57f5=function(_0x151721,_0x20d5bc){_0x151721=_0x151721-0x0;var _0x2deaa7=_0x7f55[_0x151721];return _0x2deaa7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57f5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x57f5('0x1'));var moment=require(_0x57f5('0x2'));var BPromise=require(_0x57f5('0x3'));var Mustache=require(_0x57f5('0x4'));var util=require(_0x57f5('0x5'));var path=require(_0x57f5('0x6'));var sox=require(_0x57f5('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x57f5('0x8'));var _=require(_0x57f5('0x9'));var squel=require(_0x57f5('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x57f5('0xb'));var toCsv=require(_0x57f5('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x57f5('0xd'));var authService=require(_0x57f5('0xe'));var qs=require(_0x57f5('0xf'));var as=require(_0x57f5('0x10'));var hardwareService=require(_0x57f5('0x11'));var logger=require(_0x57f5('0x12'))(_0x57f5('0x13'));var utils=require('../../config/utils');var config=require(_0x57f5('0x14'));var licenseUtil=require(_0x57f5('0x15'));var db=require('../../mysqldb')['db'];config[_0x57f5('0x16')]=_[_0x57f5('0x17')](config[_0x57f5('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x57f5('0x18'))(new Redis(config[_0x57f5('0x16')]));require(_0x57f5('0x19'))[_0x57f5('0x1a')](socket);function respondWithStatusCode(_0x44ea61,_0x343019){_0x343019=_0x343019||0xcc;return function(_0x5d2b58){if(_0x5d2b58){return _0x44ea61[_0x57f5('0x1b')](_0x343019);}return _0x44ea61[_0x57f5('0x1c')](_0x343019)[_0x57f5('0x1d')]();};}function respondWithResult(_0x528783,_0x1e6d9f){_0x1e6d9f=_0x1e6d9f||0xc8;return function(_0x551628){if(_0x551628){return _0x528783[_0x57f5('0x1c')](_0x1e6d9f)['json'](_0x551628);}};}function respondWithFilteredResult(_0x4ad54f,_0x36602b){return function(_0x49cf8c){if(_0x49cf8c){var _0x4000a4=typeof _0x36602b[_0x57f5('0x1e')]===_0x57f5('0x1f')&&typeof _0x36602b[_0x57f5('0x20')]===_0x57f5('0x1f');var _0x45c114=_0x49cf8c[_0x57f5('0x21')];var _0x507295=_0x4000a4?0x0:_0x36602b['offset'];var _0x5b245c=_0x4000a4?_0x49cf8c[_0x57f5('0x21')]:_0x36602b[_0x57f5('0x1e')]+_0x36602b['limit'];var _0x3eea68;if(_0x5b245c>=_0x45c114){_0x5b245c=_0x45c114;_0x3eea68=0xc8;}else{_0x3eea68=0xce;}_0x4ad54f[_0x57f5('0x1c')](_0x3eea68);return _0x4ad54f[_0x57f5('0x22')](_0x57f5('0x23'),_0x507295+'-'+_0x5b245c+'/'+_0x45c114)[_0x57f5('0x24')](_0x49cf8c);}return null;};}function patchUpdates(_0x467dfd){return function(_0x27180e){try{jsonpatch[_0x57f5('0x25')](_0x27180e,_0x467dfd,!![]);}catch(_0xc9ae27){return BPromise['reject'](_0xc9ae27);}return _0x27180e[_0x57f5('0x26')]();};}function saveUpdates(_0x1bbc83,_0x5e79cb){return function(_0x552d78){if(_0x552d78){return _0x552d78[_0x57f5('0x27')](_0x1bbc83)[_0x57f5('0x28')](function(_0x1a711b){return _0x1a711b;});}return null;};}function removeEntity(_0x1af9b4,_0x1172d0){return function(_0x170d98){if(_0x170d98){return _0x170d98[_0x57f5('0x29')]()[_0x57f5('0x28')](function(){_0x1af9b4[_0x57f5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fc02a,_0x5445f0){return function(_0x31c00e){if(!_0x31c00e){_0x4fc02a[_0x57f5('0x1b')](0x194);}return _0x31c00e;};}function handleError(_0x11e05f,_0x39f30a){_0x39f30a=_0x39f30a||0x1f4;return function(_0x3a45c4){logger[_0x57f5('0x2a')](_0x3a45c4['stack']);if(_0x3a45c4[_0x57f5('0x2b')]){delete _0x3a45c4[_0x57f5('0x2b')];}_0x11e05f['status'](_0x39f30a)[_0x57f5('0x2c')](_0x3a45c4);};}exports[_0x57f5('0x2d')]=function(_0x6b4e8c,_0x4cd6b2,_0x1b8f13){if(!_0x6b4e8c[_0x57f5('0x2e')][_0x57f5('0x2f')](_0x57f5('0x30'))&&!_0x6b4e8c[_0x57f5('0x2e')][_0x57f5('0x2f')](_0x57f5('0x31'))){throw new db[(_0x57f5('0x32'))][(_0x57f5('0x33'))](_0x57f5('0x34'));}else{if(_0x6b4e8c[_0x57f5('0x2e')]['hasOwnProperty'](_0x57f5('0x31'))&&!_0x6b4e8c[_0x57f5('0x2e')][_0x57f5('0x2f')]('view')){throw new db[(_0x57f5('0x32'))][(_0x57f5('0x33'))](_0x57f5('0x35'));}if(!_0x6b4e8c[_0x57f5('0x2e')][_0x57f5('0x2f')]('recipients')){throw new db[(_0x57f5('0x32'))]['ValidationError'](_0x57f5('0x36'));}else{try{var _0x101543=JSON[_0x57f5('0x37')](_0x6b4e8c[_0x57f5('0x2e')]['recipients']);}catch(_0x9277f8){logger[_0x57f5('0x2a')](_0x9277f8);throw new db['Sequelize']['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x1688df=[_0x57f5('0x38'),_0x57f5('0x39'),_0x57f5('0x3a'),_0x57f5('0x3b'),_0x57f5('0x3c'),_0x57f5('0x3d'),_0x57f5('0x3e'),_0x57f5('0x3f'),_0x57f5('0x40')];if(_[_0x57f5('0x41')](_0x101543,function(_0x327d51){return!_[_0x57f5('0x42')](_0x1688df,_0x327d51[_0x57f5('0x43')][_0x57f5('0x44')]());})){throw new db['Sequelize'][(_0x57f5('0x33'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x253f50={};_0x253f50[_0x57f5('0x45')]=_0x6b4e8c[_0x57f5('0x2e')][_0x57f5('0x2f')](_0x57f5('0x45'))?_0x6b4e8c[_0x57f5('0x2e')][_0x57f5('0x45')]:_0x6b4e8c[_0x57f5('0x40')][_0x57f5('0x46')];_0x253f50[_0x57f5('0x47')]=_[_0x57f5('0x48')](_0x6b4e8c[_0x57f5('0x2e')][_0x57f5('0x47')])?null:_0x6b4e8c[_0x57f5('0x2e')][_0x57f5('0x47')];_0x253f50[_0x57f5('0x49')]=_0x6b4e8c[_0x57f5('0x2e')][_0x57f5('0x49')]||![];_0x253f50[_0x57f5('0x4a')]=_0x6b4e8c[_0x57f5('0x40')]['id'];return getContent(_0x6b4e8c[_0x57f5('0x2e')])[_0x57f5('0x28')](function(_0x21bff7){_0x253f50[_0x57f5('0x2e')]=_0x21bff7;return getRecipients(_0x101543);})['then'](function(_0x52a43c){_0x253f50[_0x57f5('0x4b')]=_['sortBy'](_0x52a43c)['join'](',');return db[_0x57f5('0x4c')][_0x57f5('0x4d')](function(_0x5aa2f5){return db[_0x57f5('0x4e')][_0x57f5('0x4f')](_0x253f50,{'raw':!![],'transaction':_0x5aa2f5})[_0x57f5('0x28')](function(_0xf19564){var _0x3b4753={'sender':_0x253f50[_0x57f5('0x45')],'description':_0x253f50['recipientsDescription'],'content':_0x253f50[_0x57f5('0x2e')],'beep':_0x253f50[_0x57f5('0x49')]};_0x52a43c[_0x57f5('0x50')](function(_0x2dca02){_0x3b4753['recipient']=_0x2dca02;socket[_0x57f5('0x51')](_0x57f5('0x52'),_0x3b4753);});return _0xf19564;});});})['then'](respondWithResult(_0x4cd6b2,0xc9))[_0x57f5('0x53')](handleError(_0x4cd6b2,null));};function getContent(_0x2804a6){return new BPromise(function(_0xb5fa41,_0x2db1ef){if(_0x2804a6['text']){_0xb5fa41(_0x2804a6[_0x57f5('0x30')]);return;}return db[_0x57f5('0x54')]['findOne']({'attributes':[_0x57f5('0x55')],'where':{'id':_0x2804a6[_0x57f5('0x31')]},'raw':!![]})[_0x57f5('0x28')](function(_0x789073){if(!_0x789073)throw new db[(_0x57f5('0x32'))][(_0x57f5('0x33'))](_0x57f5('0x56'));var _0x2f3439=Mustache[_0x57f5('0x57')](_0x789073['html'],_0x2804a6[_0x57f5('0x58')]);_0xb5fa41(_0x2f3439);})[_0x57f5('0x53')](function(_0x59a597){_0x2db1ef(_0x59a597);});});}function getRecipients(_0x44d929){return new BPromise(function(_0x3ff59c,_0x3ee307){var _0x5c2a5e=[];var _0x89a035=[];_0x44d929[_0x57f5('0x50')](function(_0x3defd2){var _0x51fb70=_[_0x57f5('0x59')](_0x3defd2['model']['toLowerCase']());if(_0x51fb70==='User'){_0x5c2a5e=_[_0x57f5('0x5a')](_0x5c2a5e,_0x3defd2[_0x57f5('0x5b')]);}else{if(_[_0x57f5('0x42')](_0x51fb70,_0x57f5('0x5c')))_0x51fb70=_0x51fb70[_0x57f5('0x5d')](_0x57f5('0x5c'),_0x57f5('0x5e'));_0x3defd2['ids']['forEach'](function(_0x14ae1d){_0x89a035[_0x57f5('0x5f')](getAgents(_0x51fb70,_0x14ae1d));});}});return BPromise[_0x57f5('0x60')](_0x89a035)[_0x57f5('0x28')](function(_0x1e1269){_0x5c2a5e=_['union'](_0x5c2a5e,_['flatten'](_0x1e1269));_0x3ff59c(_0x5c2a5e);})[_0x57f5('0x53')](function(_0x27806e){_0x3ee307(_0x27806e);});});}function getAgents(_0x4ec96a,_0x4d08ba){return new BPromise(function(_0x50e8e,_0x29b98a){return db[_0x4ec96a][_0x57f5('0x61')]({'where':{'id':_0x4d08ba}})[_0x57f5('0x28')](function(_0xee850d){return _0xee850d[_0x57f5('0x62')]({'attributes':['id'],'raw':!![]})[_0x57f5('0x28')](function(_0x5b764b){var _0x5aa128=_[_0x57f5('0x63')](_0x5b764b,'id');_0x50e8e(_0x5aa128);});})[_0x57f5('0x53')](function(_0x394044){_0x29b98a(_0x394044);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 52c8c5b..69060eb 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 _0x3718=['save','update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3718,0x165));var _0x8371=function(_0x6afcca,_0x1691cc){_0x6afcca=_0x6afcca-0x0;var _0x49c2e8=_0x3718[_0x6afcca];return _0x49c2e8;};'use strict';var EventEmitter=require(_0x8371('0x0'));var UserNotification=require(_0x8371('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x8371('0x2')](0x0);var events={'afterCreate':_0x8371('0x3'),'afterUpdate':_0x8371('0x4'),'afterDestroy':_0x8371('0x5')};function emitEvent(_0xb06802){return function(_0x2cadf3,_0x31af0b,_0x47dd9c){UserNotificationEvents['emit'](_0xb06802+':'+_0x2cadf3['id'],_0x2cadf3);UserNotificationEvents[_0x8371('0x6')](_0xb06802,_0x2cadf3);_0x47dd9c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x8371('0x7')](e,emitEvent(event));}}module[_0x8371('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x5f8f=['hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x2718c7,_0x5a1636){var _0x59d89c=function(_0x4d4f49){while(--_0x4d4f49){_0x2718c7['push'](_0x2718c7['shift']());}};_0x59d89c(++_0x5a1636);}(_0x5f8f,0x1b0));var _0xf5f8=function(_0x2cd11a,_0x1c6d2f){_0x2cd11a=_0x2cd11a-0x0;var _0x1587f4=_0x5f8f[_0x2cd11a];return _0x1587f4;};'use strict';var EventEmitter=require(_0xf5f8('0x0'));var UserNotification=require(_0xf5f8('0x1'))['db'][_0xf5f8('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xf5f8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf5f8('0x4'),'afterDestroy':_0xf5f8('0x5')};function emitEvent(_0x4a5802){return function(_0x279298,_0x5c9bf5,_0x3012da){UserNotificationEvents[_0xf5f8('0x6')](_0x4a5802+':'+_0x279298['id'],_0x279298);UserNotificationEvents[_0xf5f8('0x6')](_0x4a5802,_0x279298);_0x3012da(null);};}for(var e in events){if(events[_0xf5f8('0x7')](e)){var event=events[e];UserNotification[_0xf5f8('0x8')](e,emitEvent(event));}}module[_0xf5f8('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 96eed57..08a8459 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 _0x9a00=['./userNotification.attributes','define','userNotifications','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x1ecd8e,_0x11e5c1){var _0x1cc94d=function(_0x30939f){while(--_0x30939f){_0x1ecd8e['push'](_0x1ecd8e['shift']());}};_0x1cc94d(++_0x11e5c1);}(_0x9a00,0x1c6));var _0x09a0=function(_0x1c5aff,_0x3cea4b){_0x1c5aff=_0x1c5aff-0x0;var _0x35e23e=_0x9a00[_0x1c5aff];return _0x35e23e;};'use strict';var _=require(_0x09a0('0x0'));var util=require('util');var logger=require(_0x09a0('0x1'))('api');var moment=require('moment');var BPromise=require(_0x09a0('0x2'));var rp=require(_0x09a0('0x3'));var fs=require('fs');var path=require(_0x09a0('0x4'));var rimraf=require('rimraf');var config=require(_0x09a0('0x5'));var attributes=require(_0x09a0('0x6'));module['exports']=function(_0x151653,_0x337d27){return _0x151653[_0x09a0('0x7')]('UserNotification',attributes,{'tableName':_0x09a0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x09a0('0x9')});}; \ No newline at end of file +var _0xa7df=['exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x20a4dc,_0x2bd7c7){var _0x49000f=function(_0x2246e7){while(--_0x2246e7){_0x20a4dc['push'](_0x20a4dc['shift']());}};_0x49000f(++_0x2bd7c7);}(_0xa7df,0x148));var _0xfa7d=function(_0x1fa0f8,_0x2bbf8a){_0x1fa0f8=_0x1fa0f8-0x0;var _0x43e904=_0xa7df[_0x1fa0f8];return _0x43e904;};'use strict';var _=require(_0xfa7d('0x0'));var util=require(_0xfa7d('0x1'));var logger=require(_0xfa7d('0x2'))('api');var moment=require(_0xfa7d('0x3'));var BPromise=require(_0xfa7d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa7d('0x5'));var rimraf=require(_0xfa7d('0x6'));var config=require(_0xfa7d('0x7'));var attributes=require('./userNotification.attributes');module[_0xfa7d('0x8')]=function(_0x3c56f1,_0x3125d6){return _0x3c56f1[_0xfa7d('0x9')](_0xfa7d('0xa'),attributes,{'tableName':_0xfa7d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfa7d('0xc'),'collate':_0xfa7d('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 484a744..44e1950 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 _0x0cda=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x34985c,_0x3f229b){var _0x350d23=function(_0x1ec125){while(--_0x1ec125){_0x34985c['push'](_0x34985c['shift']());}};_0x350d23(++_0x3f229b);}(_0x0cda,0x160));var _0xa0cd=function(_0x3759f0,_0xeda2ff){_0x3759f0=_0x3759f0-0x0;var _0xba1571=_0x0cda[_0x3759f0];return _0xba1571;};'use strict';var _=require(_0xa0cd('0x0'));var util=require(_0xa0cd('0x1'));var moment=require(_0xa0cd('0x2'));var BPromise=require(_0xa0cd('0x3'));var rs=require(_0xa0cd('0x4'));var fs=require('fs');var Redis=require(_0xa0cd('0x5'));var db=require(_0xa0cd('0x6'))['db'];var utils=require(_0xa0cd('0x7'));var logger=require(_0xa0cd('0x8'))('rpc');var config=require(_0xa0cd('0x9'));var jayson=require(_0xa0cd('0xa'));var client=jayson[_0xa0cd('0xb')][_0xa0cd('0xc')]({'port':0x232a});config[_0xa0cd('0xd')]=_['defaults'](config[_0xa0cd('0xd')],{'host':_0xa0cd('0xe'),'port':0x18eb});var socket=require(_0xa0cd('0xf'))(new Redis(config[_0xa0cd('0xd')]));require(_0xa0cd('0x10'))['register'](socket);function respondWithRpcPromise(_0x40cb91,_0x1c1dd2,_0x5553fc){return new BPromise(function(_0x180982,_0x26f8d2){return client[_0xa0cd('0x11')](_0x40cb91,_0x5553fc)['then'](function(_0x4f7085){logger[_0xa0cd('0x12')](_0xa0cd('0x13'),_0x1c1dd2,_0xa0cd('0x14'));logger[_0xa0cd('0x15')](_0xa0cd('0x16'),_0x1c1dd2,'request\x20sent',JSON[_0xa0cd('0x17')](_0x4f7085));if(_0x4f7085[_0xa0cd('0x18')]){if(_0x4f7085[_0xa0cd('0x18')]['code']===0x1f4){logger['error'](_0xa0cd('0x13'),_0x1c1dd2,_0x4f7085[_0xa0cd('0x18')][_0xa0cd('0x19')]);return _0x26f8d2(_0x4f7085[_0xa0cd('0x18')][_0xa0cd('0x19')]);}logger['error'](_0xa0cd('0x13'),_0x1c1dd2,_0x4f7085[_0xa0cd('0x18')][_0xa0cd('0x19')]);return _0x180982(_0x4f7085['error'][_0xa0cd('0x19')]);}else{logger['info'](_0xa0cd('0x13'),_0x1c1dd2,'request\x20sent');_0x180982(_0x4f7085['result']['message']);}})[_0xa0cd('0x1a')](function(_0x3806e7){logger['error'](_0xa0cd('0x13'),_0x1c1dd2,_0x3806e7);_0x26f8d2(_0x3806e7);});});} \ No newline at end of file +var _0x9adc=['socket.io-emitter','redis','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost'];(function(_0x8f68c9,_0x31a84f){var _0x9e4856=function(_0x3b0350){while(--_0x3b0350){_0x8f68c9['push'](_0x8f68c9['shift']());}};_0x9e4856(++_0x31a84f);}(_0x9adc,0x1a5));var _0xc9ad=function(_0x5491ce,_0x10247c){_0x5491ce=_0x5491ce-0x0;var _0x434f7f=_0x9adc[_0x5491ce];return _0x434f7f;};'use strict';var _=require(_0xc9ad('0x0'));var util=require(_0xc9ad('0x1'));var moment=require(_0xc9ad('0x2'));var BPromise=require('bluebird');var rs=require(_0xc9ad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9ad('0x4'))['db'];var utils=require(_0xc9ad('0x5'));var logger=require(_0xc9ad('0x6'))(_0xc9ad('0x7'));var config=require(_0xc9ad('0x8'));var jayson=require(_0xc9ad('0x9'));var client=jayson[_0xc9ad('0xa')][_0xc9ad('0xb')]({'port':0x232a});config['redis']=_[_0xc9ad('0xc')](config['redis'],{'host':_0xc9ad('0xd'),'port':0x18eb});var socket=require(_0xc9ad('0xe'))(new Redis(config[_0xc9ad('0xf')]));require(_0xc9ad('0x10'))[_0xc9ad('0x11')](socket);function respondWithRpcPromise(_0x29ee67,_0x49272a,_0x544d96){return new BPromise(function(_0x4d97d8,_0x74dec){return client[_0xc9ad('0x12')](_0x29ee67,_0x544d96)['then'](function(_0xcfe407){logger[_0xc9ad('0x13')](_0xc9ad('0x14'),_0x49272a,_0xc9ad('0x15'));logger[_0xc9ad('0x16')](_0xc9ad('0x17'),_0x49272a,'request\x20sent',JSON['stringify'](_0xcfe407));if(_0xcfe407[_0xc9ad('0x18')]){if(_0xcfe407[_0xc9ad('0x18')][_0xc9ad('0x19')]===0x1f4){logger[_0xc9ad('0x18')](_0xc9ad('0x14'),_0x49272a,_0xcfe407[_0xc9ad('0x18')][_0xc9ad('0x1a')]);return _0x74dec(_0xcfe407['error'][_0xc9ad('0x1a')]);}logger[_0xc9ad('0x18')]('UserNotification,\x20%s,\x20%s',_0x49272a,_0xcfe407[_0xc9ad('0x18')]['message']);return _0x4d97d8(_0xcfe407['error'][_0xc9ad('0x1a')]);}else{logger[_0xc9ad('0x13')](_0xc9ad('0x14'),_0x49272a,_0xc9ad('0x15'));_0x4d97d8(_0xcfe407[_0xc9ad('0x1b')]['message']);}})[_0xc9ad('0x1c')](function(_0x2e209a){logger[_0xc9ad('0x18')](_0xc9ad('0x14'),_0x49272a,_0x2e209a);_0x74dec(_0x2e209a);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 235abbd..094a3f9 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 _0x5bef=['length','userNotification:','./userNotification.events','save','remove','update','removeListener','register'];(function(_0x33ad64,_0x1d0a32){var _0x2aa9de=function(_0x69265){while(--_0x69265){_0x33ad64['push'](_0x33ad64['shift']());}};_0x2aa9de(++_0x1d0a32);}(_0x5bef,0x1b2));var _0xf5be=function(_0x1404b2,_0x458abd){_0x1404b2=_0x1404b2-0x0;var _0x530122=_0x5bef[_0x1404b2];return _0x530122;};'use strict';var UserNotificationEvents=require(_0xf5be('0x0'));var events=[_0xf5be('0x1'),_0xf5be('0x2'),_0xf5be('0x3')];function createListener(_0x31df20,_0x24ddda){return function(_0x1ec147){_0x24ddda['emit'](_0x31df20,_0x1ec147);};}function removeListener(_0x82a92a,_0x1c0b6c){return function(){UserNotificationEvents[_0xf5be('0x4')](_0x82a92a,_0x1c0b6c);};}exports[_0xf5be('0x5')]=function(_0x2e8646){for(var _0x77c5e7=0x0,_0xb5a052=events[_0xf5be('0x6')];_0x77c5e7<_0xb5a052;_0x77c5e7++){var _0x48cfc9=events[_0x77c5e7];var _0x2e598c=createListener(_0xf5be('0x7')+_0x48cfc9,_0x2e8646);UserNotificationEvents['on'](_0x48cfc9,_0x2e598c);}}; \ No newline at end of file +var _0x94df=['userNotification:','./userNotification.events','save','remove','update','emit','removeListener','register','length'];(function(_0x540edb,_0x2685f0){var _0xba9ee3=function(_0xe34054){while(--_0xe34054){_0x540edb['push'](_0x540edb['shift']());}};_0xba9ee3(++_0x2685f0);}(_0x94df,0x196));var _0xf94d=function(_0x2739e3,_0x2bae3d){_0x2739e3=_0x2739e3-0x0;var _0x105ccb=_0x94df[_0x2739e3];return _0x105ccb;};'use strict';var UserNotificationEvents=require(_0xf94d('0x0'));var events=[_0xf94d('0x1'),_0xf94d('0x2'),_0xf94d('0x3')];function createListener(_0x28419d,_0x4bed59){return function(_0x43d328){_0x4bed59[_0xf94d('0x4')](_0x28419d,_0x43d328);};}function removeListener(_0x36710e,_0x4dff1d){return function(){UserNotificationEvents[_0xf94d('0x5')](_0x36710e,_0x4dff1d);};}exports[_0xf94d('0x6')]=function(_0x57318c){for(var _0x555163=0x0,_0x5e9c8d=events[_0xf94d('0x7')];_0x555163<_0x5e9c8d;_0x555163++){var _0x38f372=events[_0x555163];var _0x298e49=createListener(_0xf94d('0x8')+_0x38f372,_0x57318c);UserNotificationEvents['on'](_0x38f372,_0x298e49);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 1bd8f99..ec24a77 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x232daa,_0x9a9c9b){var _0x4d41a6=function(_0x3c047f){while(--_0x3c047f){_0x232daa['push'](_0x232daa['shift']());}};_0x4d41a6(++_0x9a9c9b);}(_0xe706,0xa3));var _0x6e70=function(_0x53e297,_0x53189b){_0x53e297=_0x53e297-0x0;var _0x4380ff=_0xe706[_0x53e297];return _0x4380ff;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x51c23f,_0x5e51c3){var _0x32a3e1=function(_0x56383f){while(--_0x56383f){_0x51c23f['push'](_0x51c23f['shift']());}};_0x32a3e1(++_0x5e51c3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x241424,_0x25eb5d){_0x241424=_0x241424-0x0;var _0x3da798=_0xcb91[_0x241424];return _0x3da798;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 887f6a8..455912d 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 _0xcc0e=['sequelize','INTEGER'];(function(_0x28d8ff,_0x26d5ea){var _0x3b1974=function(_0x41e7bc){while(--_0x41e7bc){_0x28d8ff['push'](_0x28d8ff['shift']());}};_0x3b1974(++_0x26d5ea);}(_0xcc0e,0x8c));var _0xecc0=function(_0x55a30,_0x1a244b){_0x55a30=_0x55a30-0x0;var _0x4320bf=_0xcc0e[_0x55a30];return _0x4320bf;};'use strict';var Sequelize=require(_0xecc0('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xecc0('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe3be=['exports','INTEGER','sequelize'];(function(_0x2699c8,_0x37a434){var _0x3d7cfb=function(_0x2498f4){while(--_0x2498f4){_0x2699c8['push'](_0x2699c8['shift']());}};_0x3d7cfb(++_0x37a434);}(_0xe3be,0x6b));var _0xee3b=function(_0x4dc990,_0x5586c1){_0x4dc990=_0x4dc990-0x0;var _0xcd98eb=_0xe3be[_0x4dc990];return _0xcd98eb;};'use strict';var Sequelize=require(_0xee3b('0x0'));module[_0xee3b('0x1')]={'penalty':{'type':Sequelize[_0xee3b('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 9707d7b..244c09a 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 _0x4d91=['util','request-promise','path','../../config/environment','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash'];(function(_0x522cfc,_0x17f83a){var _0x4435a0=function(_0x598d51){while(--_0x598d51){_0x522cfc['push'](_0x522cfc['shift']());}};_0x4435a0(++_0x17f83a);}(_0x4d91,0x1c1));var _0x14d9=function(_0x26efac,_0x21ab8a){_0x26efac=_0x26efac-0x0;var _0x8482e4=_0x4d91[_0x26efac];return _0x8482e4;};'use strict';var _=require(_0x14d9('0x0'));var util=require(_0x14d9('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x14d9('0x2'));var fs=require('fs');var path=require(_0x14d9('0x3'));var rimraf=require('rimraf');var config=require(_0x14d9('0x4'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x14d9('0x5')]=function(_0x518476,_0x2039df){return _0x518476[_0x14d9('0x6')](_0x14d9('0x7'),attributes,{'tableName':_0x14d9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x217b=['./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x217b,0x121));var _0xb217=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0x217b[_0x2272b5];return _0x110156;};'use strict';var _=require(_0xb217('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb217('0x1'));var moment=require(_0xb217('0x2'));var BPromise=require(_0xb217('0x3'));var rp=require(_0xb217('0x4'));var fs=require('fs');var path=require(_0xb217('0x5'));var rimraf=require(_0xb217('0x6'));var config=require(_0xb217('0x7'));var attributes=require(_0xb217('0x8'));module['exports']=function(_0x7a04c,_0x519a55){return _0x7a04c[_0xb217('0x9')](_0xb217('0xa'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index ec5d04c..ddc241a 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 _0xe96f=['client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2b163f,_0x2139bb){var _0x2f79ad=function(_0x3c9707){while(--_0x3c9707){_0x2b163f['push'](_0x2b163f['shift']());}};_0x2f79ad(++_0x2139bb);}(_0xe96f,0x199));var _0xfe96=function(_0x18bb22,_0x30aa5e){_0x18bb22=_0x18bb22-0x0;var _0x2c0939=_0xe96f[_0x18bb22];return _0x2c0939;};'use strict';var _=require(_0xfe96('0x0'));var util=require(_0xfe96('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfe96('0x2'));var fs=require('fs');var Redis=require(_0xfe96('0x3'));var db=require(_0xfe96('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe96('0x5'))(_0xfe96('0x6'));var config=require(_0xfe96('0x7'));var jayson=require(_0xfe96('0x8'));var client=jayson[_0xfe96('0x9')][_0xfe96('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc5e51c,_0x47e524,_0x577bd6){return new BPromise(function(_0x5191a1,_0x484ebd){return client[_0xfe96('0xb')](_0xc5e51c,_0x577bd6)[_0xfe96('0xc')](function(_0x184059){logger['info'](_0xfe96('0xd'),_0x47e524,'request\x20sent');logger[_0xfe96('0xe')](_0xfe96('0xf'),_0x47e524,_0xfe96('0x10'),JSON['stringify'](_0x184059));if(_0x184059[_0xfe96('0x11')]){if(_0x184059[_0xfe96('0x11')][_0xfe96('0x12')]===0x1f4){logger[_0xfe96('0x11')](_0xfe96('0xd'),_0x47e524,_0x184059['error'][_0xfe96('0x13')]);return _0x484ebd(_0x184059[_0xfe96('0x11')][_0xfe96('0x13')]);}logger[_0xfe96('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x47e524,_0x184059[_0xfe96('0x11')][_0xfe96('0x13')]);return _0x5191a1(_0x184059[_0xfe96('0x11')][_0xfe96('0x13')]);}else{logger[_0xfe96('0x14')](_0xfe96('0xd'),_0x47e524,_0xfe96('0x10'));_0x5191a1(_0x184059['result']['message']);}})[_0xfe96('0x15')](function(_0x83e548){logger[_0xfe96('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x47e524,_0x83e548);_0x484ebd(_0x83e548);});});} \ No newline at end of file +var _0xd7be=['message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserOpenchannelQueue,\x20%s,\x20%s'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xd7be,0x87));var _0xed7b=function(_0x161e70,_0x51ea47){_0x161e70=_0x161e70-0x0;var _0x2d5d73=_0xd7be[_0x161e70];return _0x2d5d73;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xed7b('0x0'));var BPromise=require(_0xed7b('0x1'));var rs=require(_0xed7b('0x2'));var fs=require('fs');var Redis=require(_0xed7b('0x3'));var db=require(_0xed7b('0x4'))['db'];var utils=require(_0xed7b('0x5'));var logger=require(_0xed7b('0x6'))(_0xed7b('0x7'));var config=require(_0xed7b('0x8'));var jayson=require(_0xed7b('0x9'));var client=jayson[_0xed7b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2828c8,_0x59f02c,_0x474450){return new BPromise(function(_0x36bf93,_0x47f0da){return client[_0xed7b('0xb')](_0x2828c8,_0x474450)['then'](function(_0x13e585){logger[_0xed7b('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x59f02c,_0xed7b('0xd'));logger[_0xed7b('0xe')](_0xed7b('0xf'),_0x59f02c,'request\x20sent',JSON[_0xed7b('0x10')](_0x13e585));if(_0x13e585[_0xed7b('0x11')]){if(_0x13e585[_0xed7b('0x11')]['code']===0x1f4){logger[_0xed7b('0x11')](_0xed7b('0x12'),_0x59f02c,_0x13e585[_0xed7b('0x11')][_0xed7b('0x13')]);return _0x47f0da(_0x13e585[_0xed7b('0x11')][_0xed7b('0x13')]);}logger['error'](_0xed7b('0x12'),_0x59f02c,_0x13e585[_0xed7b('0x11')][_0xed7b('0x13')]);return _0x36bf93(_0x13e585[_0xed7b('0x11')][_0xed7b('0x13')]);}else{logger[_0xed7b('0xc')](_0xed7b('0x12'),_0x59f02c,_0xed7b('0xd'));_0x36bf93(_0x13e585[_0xed7b('0x14')]['message']);}})[_0xed7b('0x15')](function(_0x4045c6){logger['error'](_0xed7b('0x12'),_0x59f02c,_0x4045c6);_0x47f0da(_0x4045c6);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 010f400..7c13d57 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 _0x98a8=['show','/:id/sections','getSections','getResources','post','/:id/clone','clone','addSections','addResources','put','update','delete','destroy','removeSections','/:id/resources','removeResources','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/:id'];(function(_0xa3a0b5,_0x59e9a1){var _0x4257ca=function(_0x12eb43){while(--_0x12eb43){_0xa3a0b5['push'](_0xa3a0b5['shift']());}};_0x4257ca(++_0x59e9a1);}(_0x98a8,0x132));var _0x898a=function(_0x2e3a2e,_0x2ab80a){_0x2e3a2e=_0x2e3a2e-0x0;var _0x46a916=_0x98a8[_0x2e3a2e];return _0x46a916;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require('path');var timeout=require(_0x898a('0x2'));var express=require(_0x898a('0x3'));var router=express[_0x898a('0x4')]();var fs_extra=require(_0x898a('0x5'));var auth=require(_0x898a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x898a('0x7'));var controller=require(_0x898a('0x8'));router[_0x898a('0x9')]('/',auth[_0x898a('0xa')](),controller[_0x898a('0xb')]);router[_0x898a('0x9')]('/describe',auth[_0x898a('0xa')](),controller['describe']);router['get'](_0x898a('0xc'),auth[_0x898a('0xa')](),controller[_0x898a('0xd')]);router['get'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0xf')]);router['get']('/:id/resources',auth[_0x898a('0xa')](),controller[_0x898a('0x10')]);router[_0x898a('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x898a('0x11')](_0x898a('0x12'),auth[_0x898a('0xa')](),controller[_0x898a('0x13')]);router[_0x898a('0x11')](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0x14')]);router[_0x898a('0x11')]('/:id/resources',auth[_0x898a('0xa')](),controller[_0x898a('0x15')]);router[_0x898a('0x16')](_0x898a('0xc'),auth[_0x898a('0xa')](),controller[_0x898a('0x17')]);router[_0x898a('0x18')](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0x19')]);router[_0x898a('0x18')]('/:id/sections',auth[_0x898a('0xa')](),controller[_0x898a('0x1a')]);router[_0x898a('0x18')](_0x898a('0x1b'),auth[_0x898a('0xa')](),controller[_0x898a('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xe404=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/describe','isAuthenticated','describe','get','show','/:id/sections','/:id/resources','post','/:id/clone','clone','addResources','delete','/:id','destroy','removeSections','removeResources','exports','util'];(function(_0x154b31,_0x2d12bc){var _0x1183d8=function(_0x5c9e27){while(--_0x5c9e27){_0x154b31['push'](_0x154b31['shift']());}};_0x1183d8(++_0x2d12bc);}(_0xe404,0x194));var _0x4e40=function(_0x58d937,_0x5d8b34){_0x58d937=_0x58d937-0x0;var _0x1c57a4=_0xe404[_0x58d937];return _0x1c57a4;};'use strict';var multer=require('multer');var util=require(_0x4e40('0x0'));var path=require(_0x4e40('0x1'));var timeout=require(_0x4e40('0x2'));var express=require(_0x4e40('0x3'));var router=express[_0x4e40('0x4')]();var fs_extra=require(_0x4e40('0x5'));var auth=require(_0x4e40('0x6'));var interaction=require(_0x4e40('0x7'));var config=require(_0x4e40('0x8'));var controller=require('./userProfile.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4e40('0x9')]);router['get'](_0x4e40('0xa'),auth[_0x4e40('0xb')](),controller[_0x4e40('0xc')]);router[_0x4e40('0xd')]('/:id',auth[_0x4e40('0xb')](),controller[_0x4e40('0xe')]);router[_0x4e40('0xd')](_0x4e40('0xf'),auth['isAuthenticated'](),controller['getSections']);router[_0x4e40('0xd')](_0x4e40('0x10'),auth['isAuthenticated'](),controller['getResources']);router[_0x4e40('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4e40('0x11')](_0x4e40('0x12'),auth[_0x4e40('0xb')](),controller[_0x4e40('0x13')]);router[_0x4e40('0x11')](_0x4e40('0xf'),auth[_0x4e40('0xb')](),controller['addSections']);router[_0x4e40('0x11')](_0x4e40('0x10'),auth[_0x4e40('0xb')](),controller[_0x4e40('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4e40('0x15')](_0x4e40('0x16'),auth[_0x4e40('0xb')](),controller[_0x4e40('0x17')]);router[_0x4e40('0x15')](_0x4e40('0xf'),auth[_0x4e40('0xb')](),controller[_0x4e40('0x18')]);router['delete'](_0x4e40('0x10'),auth[_0x4e40('0xb')](),controller[_0x4e40('0x19')]);module[_0x4e40('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 43442aa..a562fee 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 _0x0c4b=['BOOLEAN','STRING','name','crudPermissions','join','getDataValue','split'];(function(_0x81fe53,_0x5b8f05){var _0x56f7a7=function(_0x1e7846){while(--_0x1e7846){_0x81fe53['push'](_0x81fe53['shift']());}};_0x56f7a7(++_0x5b8f05);}(_0x0c4b,0x12e));var _0xb0c4=function(_0x16e6ea,_0x44978e){_0x16e6ea=_0x16e6ea-0x0;var _0x29ae3c=_0x0c4b[_0x16e6ea];return _0x29ae3c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb0c4('0x0')],'allowNull':![],'unique':_0xb0c4('0x1')},'crudPermissions':{'type':Sequelize[_0xb0c4('0x0')],'set':function(_0x1a7962){this['setDataValue'](_0xb0c4('0x2'),_0x1a7962?_0x1a7962[_0xb0c4('0x3')](''):[]);},'get':function(){return this[_0xb0c4('0x4')]('crudPermissions')?this[_0xb0c4('0x4')]('crudPermissions')[_0xb0c4('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xb0c4('0x0')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xb0c4('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb0c4('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xb0c4('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xb0c4('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb0c4('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xb0c4('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x053c=['sequelize','exports','STRING','name','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN'];(function(_0x45ab62,_0x5a1ff3){var _0x20b564=function(_0xee8870){while(--_0xee8870){_0x45ab62['push'](_0x45ab62['shift']());}};_0x20b564(++_0x5a1ff3);}(_0x053c,0x186));var _0xc053=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x053c[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0xc053('0x0'));module[_0xc053('0x1')]={'name':{'type':Sequelize[_0xc053('0x2')],'allowNull':![],'unique':_0xc053('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x63c1fe){this[_0xc053('0x4')](_0xc053('0x5'),_0x63c1fe?_0x63c1fe[_0xc053('0x6')](''):[]);},'get':function(){return this[_0xc053('0x7')](_0xc053('0x5'))?this[_0xc053('0x7')](_0xc053('0x5'))[_0xc053('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xc053('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xc053('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xc053('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xc053('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xc053('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xc053('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 100af21..8be55b4 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 _0xdebe=['bulkCreate','removeResources','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','UserProfile','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','create','clone','options','updatedAt','body','createdAt','transaction','get','autoAssociation','UserProfileResource','omit','sectionId','userProfileId','UserProfileSection','describe','addSections','sequelize','Resources','push','removeSections','ids','subsections','includes','enabled','findOne','Dashboard','forEach','resourceId','addResources'];(function(_0x20cb26,_0x3cb087){var _0x3ec4f8=function(_0x13ca31){while(--_0x13ca31){_0x20cb26['push'](_0x20cb26['shift']());}};_0x3ec4f8(++_0x3cb087);}(_0xdebe,0x1ad));var _0xedeb=function(_0x220dab,_0x29a312){_0x220dab=_0x220dab-0x0;var _0xee7296=_0xdebe[_0x220dab];return _0xee7296;};'use strict';var emlformat=require(_0xedeb('0x0'));var rimraf=require(_0xedeb('0x1'));var zipdir=require(_0xedeb('0x2'));var jsonpatch=require(_0xedeb('0x3'));var rp=require('request-promise');var moment=require(_0xedeb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xedeb('0x5'));var util=require(_0xedeb('0x6'));var path=require('path');var sox=require(_0xedeb('0x7'));var csv=require(_0xedeb('0x8'));var ejs=require(_0xedeb('0x9'));var fs=require('fs');var fs_extra=require(_0xedeb('0xa'));var _=require(_0xedeb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xedeb('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xedeb('0x8'));var querystring=require(_0xedeb('0xd'));var Papa=require(_0xedeb('0xe'));var Redis=require(_0xedeb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xedeb('0x10'));var as=require(_0xedeb('0x11'));var hardwareService=require(_0xedeb('0x12'));var logger=require(_0xedeb('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xedeb('0x14'));var db=require(_0xedeb('0x15'))['db'];config[_0xedeb('0x16')]=_['defaults'](config[_0xedeb('0x16')],{'host':_0xedeb('0x17'),'port':0x18eb});var socket=require(_0xedeb('0x18'))(new Redis(config[_0xedeb('0x16')]));require(_0xedeb('0x19'))[_0xedeb('0x1a')](socket);function respondWithStatusCode(_0x31eac3,_0x17da75){_0x17da75=_0x17da75||0xcc;return function(_0x329855){if(_0x329855){return _0x31eac3[_0xedeb('0x1b')](_0x17da75);}return _0x31eac3[_0xedeb('0x1c')](_0x17da75)['end']();};}function respondWithResult(_0x5334cb,_0x25a5e3){_0x25a5e3=_0x25a5e3||0xc8;return function(_0x51cb69){if(_0x51cb69){return _0x5334cb['status'](_0x25a5e3)['json'](_0x51cb69);}};}function respondWithFilteredResult(_0x178339,_0x3eb1c6){return function(_0x208ad2){if(_0x208ad2){var _0x16c2d5=typeof _0x3eb1c6['offset']===_0xedeb('0x1d')&&typeof _0x3eb1c6[_0xedeb('0x1e')]===_0xedeb('0x1d');var _0x40f737=_0x208ad2[_0xedeb('0x1f')];var _0x46eb3f=_0x16c2d5?0x0:_0x3eb1c6[_0xedeb('0x20')];var _0x56a10a=_0x16c2d5?_0x208ad2[_0xedeb('0x1f')]:_0x3eb1c6['offset']+_0x3eb1c6[_0xedeb('0x1e')];var _0x34d1f0;if(_0x56a10a>=_0x40f737){_0x56a10a=_0x40f737;_0x34d1f0=0xc8;}else{_0x34d1f0=0xce;}_0x178339[_0xedeb('0x1c')](_0x34d1f0);return _0x178339['set'](_0xedeb('0x21'),_0x46eb3f+'-'+_0x56a10a+'/'+_0x40f737)[_0xedeb('0x22')](_0x208ad2);}return null;};}function patchUpdates(_0x4e78dd){return function(_0x21d2c1){try{jsonpatch['apply'](_0x21d2c1,_0x4e78dd,!![]);}catch(_0x5b5a13){return BPromise[_0xedeb('0x23')](_0x5b5a13);}return _0x21d2c1[_0xedeb('0x24')]();};}function saveUpdates(_0x1b3633,_0x4f1185){return function(_0x5e6147){if(_0x5e6147){return _0x5e6147[_0xedeb('0x25')](_0x1b3633)[_0xedeb('0x26')](function(_0x2a5e6c){return _0x2a5e6c;});}return null;};}function removeEntity(_0x308615,_0x157a79){return function(_0x597e8b){if(_0x597e8b){return _0x597e8b[_0xedeb('0x27')]()[_0xedeb('0x26')](function(){_0x308615[_0xedeb('0x1c')](0xcc)[_0xedeb('0x28')]();});}};}function handleEntityNotFound(_0x47501c,_0x43df36){return function(_0x1040f8){if(!_0x1040f8){_0x47501c['sendStatus'](0x194);}return _0x1040f8;};}function handleError(_0x28fd3b,_0x2f5329){_0x2f5329=_0x2f5329||0x1f4;return function(_0x383eaa){logger['error'](_0x383eaa['stack']);if(_0x383eaa[_0xedeb('0x29')]){delete _0x383eaa['name'];}_0x28fd3b['status'](_0x2f5329)[_0xedeb('0x2a')](_0x383eaa);};}exports[_0xedeb('0x2b')]=function(_0x3cc2a7,_0x48f218){var _0xcaeb83={},_0x24a39d={},_0x1404a6={'count':0x0,'rows':[]};var _0x16b455=_[_0xedeb('0x2c')](db[_0xedeb('0x2d')]['rawAttributes'],function(_0xa40739){return{'name':_0xa40739['fieldName'],'type':_0xa40739[_0xedeb('0x2e')][_0xedeb('0x2f')]};});_0x24a39d[_0xedeb('0x30')]=_[_0xedeb('0x2c')](_0x16b455,'name');_0x24a39d[_0xedeb('0x31')]=_['keys'](_0x3cc2a7['query']);_0x24a39d[_0xedeb('0x32')]=_[_0xedeb('0x33')](_0x24a39d[_0xedeb('0x30')],_0x24a39d[_0xedeb('0x31')]);_0xcaeb83[_0xedeb('0x34')]=_[_0xedeb('0x33')](_0x24a39d[_0xedeb('0x30')],qs[_0xedeb('0x35')](_0x3cc2a7[_0xedeb('0x31')][_0xedeb('0x35')]));_0xcaeb83[_0xedeb('0x34')]=_0xcaeb83['attributes'][_0xedeb('0x36')]?_0xcaeb83[_0xedeb('0x34')]:_0x24a39d['model'];if(!_0x3cc2a7['query'][_0xedeb('0x37')](_0xedeb('0x38'))){_0xcaeb83[_0xedeb('0x1e')]=qs[_0xedeb('0x1e')](_0x3cc2a7[_0xedeb('0x31')][_0xedeb('0x1e')]);_0xcaeb83[_0xedeb('0x20')]=qs['offset'](_0x3cc2a7[_0xedeb('0x31')][_0xedeb('0x20')]);}_0xcaeb83['order']=qs[_0xedeb('0x39')](_0x3cc2a7[_0xedeb('0x31')][_0xedeb('0x39')]);_0xcaeb83[_0xedeb('0x3a')]=qs['filters'](_[_0xedeb('0x3b')](_0x3cc2a7[_0xedeb('0x31')],_0x24a39d[_0xedeb('0x32')]),_0x16b455);if(_0x3cc2a7['query'][_0xedeb('0x3c')]){_0xcaeb83[_0xedeb('0x3a')]=_[_0xedeb('0x3d')](_0xcaeb83['where'],{'$or':_[_0xedeb('0x2c')](_0x16b455,function(_0x52a38e){if(_0x52a38e['type']!==_0xedeb('0x3e')){var _0xc443c8={};_0xc443c8[_0x52a38e['name']]={'$like':'%'+_0x3cc2a7['query'][_0xedeb('0x3c')]+'%'};return _0xc443c8;}})});}_0xcaeb83=_[_0xedeb('0x3d')]({},_0xcaeb83,_0x3cc2a7['options']);var _0x48d322={'where':_0xcaeb83[_0xedeb('0x3a')]};return db[_0xedeb('0x2d')][_0xedeb('0x1f')](_0x48d322)[_0xedeb('0x26')](function(_0x12adc6){_0x1404a6[_0xedeb('0x1f')]=_0x12adc6;if(_0x3cc2a7['query'][_0xedeb('0x3f')]){_0xcaeb83[_0xedeb('0x40')]=[{'all':!![]}];}return db[_0xedeb('0x2d')][_0xedeb('0x41')](_0xcaeb83);})[_0xedeb('0x26')](function(_0x1174d9){_0x1404a6[_0xedeb('0x42')]=_0x1174d9;return _0x1404a6;})[_0xedeb('0x26')](respondWithFilteredResult(_0x48f218,_0xcaeb83))[_0xedeb('0x43')](handleError(_0x48f218,null));};exports['show']=function(_0x4c63bf,_0x2e837b){var _0x5afd10={'raw':![],'where':{'id':_0x4c63bf[_0xedeb('0x44')]['id']}},_0x3a7caa={};_0x3a7caa[_0xedeb('0x30')]=_[_0xedeb('0x45')](db[_0xedeb('0x2d')][_0xedeb('0x46')]);_0x3a7caa[_0xedeb('0x31')]=_[_0xedeb('0x45')](_0x4c63bf[_0xedeb('0x31')]);_0x3a7caa[_0xedeb('0x32')]=_[_0xedeb('0x33')](_0x3a7caa[_0xedeb('0x30')],_0x3a7caa[_0xedeb('0x31')]);_0x5afd10[_0xedeb('0x34')]=_[_0xedeb('0x33')](_0x3a7caa[_0xedeb('0x30')],qs[_0xedeb('0x35')](_0x4c63bf[_0xedeb('0x31')][_0xedeb('0x35')]));_0x5afd10[_0xedeb('0x34')]=_0x5afd10[_0xedeb('0x34')][_0xedeb('0x36')]?_0x5afd10[_0xedeb('0x34')]:_0x3a7caa[_0xedeb('0x30')];if(_0x4c63bf[_0xedeb('0x31')][_0xedeb('0x3f')]){_0x5afd10[_0xedeb('0x40')]=[{'all':!![]}];}_0x5afd10=_[_0xedeb('0x3d')]({},_0x5afd10,_0x4c63bf['options']);return db[_0xedeb('0x2d')][_0xedeb('0x47')](_0x5afd10)['then'](handleEntityNotFound(_0x2e837b,null))['then'](respondWithResult(_0x2e837b,null))[_0xedeb('0x43')](handleError(_0x2e837b,null));};exports[_0xedeb('0x48')]=function(_0x2661ba,_0x227216){return db[_0xedeb('0x2d')][_0xedeb('0x48')](_0x2661ba['body'],{})[_0xedeb('0x26')](respondWithResult(_0x227216,0xc9))[_0xedeb('0x43')](handleError(_0x227216,null));};exports[_0xedeb('0x49')]=function(_0x264cd6,_0x536e67){var _0x1e49ea={'where':{'id':_0x264cd6[_0xedeb('0x44')]['id']}},_0x1a5085={};_0x1a5085[_0xedeb('0x30')]=_[_0xedeb('0x45')](db[_0xedeb('0x2d')]['rawAttributes']);_0x1e49ea[_0xedeb('0x34')]=_['intersection'](_0x1a5085['model'],qs[_0xedeb('0x35')](_0x264cd6[_0xedeb('0x31')][_0xedeb('0x35')]));_0x1e49ea['attributes']=_0x1e49ea[_0xedeb('0x34')]['length']?_0x1e49ea[_0xedeb('0x34')]:_0x1a5085['model'];if(_0x264cd6['query'][_0xedeb('0x3f')]){_0x1e49ea[_0xedeb('0x40')]=[{'all':!![]}];}_0x1e49ea=_[_0xedeb('0x3d')]({},_0x1e49ea,_0x264cd6[_0xedeb('0x4a')]);return db[_0xedeb('0x2d')][_0xedeb('0x47')](_0x1e49ea)[_0xedeb('0x26')](handleEntityNotFound(_0x536e67,null))[_0xedeb('0x26')](function(_0x45a6ea){if(_0x45a6ea){var _0x5976e5=_0x45a6ea['get']({'plain':!![]});_0x5976e5=qs['omit'](_0x5976e5,['id','createdAt',_0xedeb('0x4b'),'crudPermissions']);_0x264cd6[_0xedeb('0x4c')]=_['omit'](_0x264cd6[_0xedeb('0x4c')],['id',_0xedeb('0x4d'),_0xedeb('0x4b')]);return db['sequelize'][_0xedeb('0x4e')](function(_0x5c07b7){return db[_0xedeb('0x2d')][_0xedeb('0x48')](_[_0xedeb('0x3d')](_0x5976e5,_0x264cd6[_0xedeb('0x4c')]),{'include':_0x264cd6[_0xedeb('0x31')][_0xedeb('0x3f')]?[{'all':!![]}]:undefined,'transaction':_0x5c07b7})[_0xedeb('0x26')](function(_0x435b85){var _0x31969b=_0x435b85[_0xedeb('0x4f')]({'plain':!![]});return db['UserProfileSection'][_0xedeb('0x41')]({'where':{'userProfileId':_0x264cd6[_0xedeb('0x44')]['id']},'raw':!![]})[_0xedeb('0x26')](function(_0x21c917){if(_0x21c917){return BPromise['each'](_0x21c917,function(_0x44894c){return new BPromise(function(_0x8b7eae,_0x2efde3){if(_0x44894c[_0xedeb('0x50')]===null||_0x44894c[_0xedeb('0x50')]===0x1)_0x8b7eae(null);return db[_0xedeb('0x51')][_0xedeb('0x41')]({'where':{'sectionId':_0x44894c['id']},'raw':!![]})[_0xedeb('0x26')](function(_0x3fb1b6){var _0xcdad31=_['map'](_0x3fb1b6,function(_0x1193e5){return qs[_0xedeb('0x52')](_0x1193e5,['id',_0xedeb('0x4d'),_0xedeb('0x4b'),_0xedeb('0x53')]);});_0x8b7eae(_0xcdad31);})[_0xedeb('0x43')](function(_0x192d7a){_0x2efde3(_0x192d7a);});})['then'](function(_0x14c5db){var _0x2d8c29=qs['omit'](_0x44894c,['id',_0xedeb('0x4d'),_0xedeb('0x4b')]);_0x2d8c29[_0xedeb('0x54')]=_0x31969b['id'];if(_0x14c5db)_0x2d8c29['Resources']=_0x14c5db;return _0x2d8c29;})[_0xedeb('0x26')](function(_0x69067d){return db[_0xedeb('0x55')][_0xedeb('0x48')](_0x69067d,{'include':[{'model':db[_0xedeb('0x51')],'as':'Resources'}],'raw':!![],'transaction':_0x5c07b7});});})['then'](function(){return _0x31969b;});}});});});}})[_0xedeb('0x26')](respondWithResult(_0x536e67,0xc9))[_0xedeb('0x43')](handleError(_0x536e67,null));};exports['update']=function(_0x506cd0,_0x8dde81){if(_0x506cd0['body']['id']){delete _0x506cd0[_0xedeb('0x4c')]['id'];}return db[_0xedeb('0x2d')][_0xedeb('0x47')]({'where':{'id':_0x506cd0[_0xedeb('0x44')]['id']}})[_0xedeb('0x26')](handleEntityNotFound(_0x8dde81,null))['then'](saveUpdates(_0x506cd0[_0xedeb('0x4c')],null))[_0xedeb('0x26')](respondWithResult(_0x8dde81,null))[_0xedeb('0x43')](handleError(_0x8dde81,null));};exports[_0xedeb('0x27')]=function(_0x4f9070,_0x401151){return db['UserProfile'][_0xedeb('0x47')]({'where':{'id':_0x4f9070[_0xedeb('0x44')]['id']}})[_0xedeb('0x26')](handleEntityNotFound(_0x401151,null))[_0xedeb('0x26')](removeEntity(_0x401151,null))['catch'](handleError(_0x401151,null));};exports[_0xedeb('0x56')]=function(_0x2ed5a3,_0x2932c4){return db['UserProfile'][_0xedeb('0x56')]()[_0xedeb('0x26')](respondWithResult(_0x2932c4,null))[_0xedeb('0x43')](handleError(_0x2932c4,null));};exports[_0xedeb('0x57')]=function(_0x50bfa3,_0x1942d2){var _0x340c50=_0x50bfa3[_0xedeb('0x4c')];return db[_0xedeb('0x2d')][_0xedeb('0x47')]({'where':{'id':_0x50bfa3[_0xedeb('0x44')]['id']}})[_0xedeb('0x26')](handleEntityNotFound(_0x1942d2,null))[_0xedeb('0x26')](function(_0x238981){if(_0x238981){return db[_0xedeb('0x58')][_0xedeb('0x4e')](function(_0x1c439e){return db[_0xedeb('0x55')][_0xedeb('0x27')]({'where':{'userProfileId':_0x50bfa3[_0xedeb('0x44')]['id'],'sectionId':_['map'](_0x340c50,function(_0x74efe7){return _0x74efe7['sectionId'];})},'transaction':_0x1c439e})['then'](function(){var _0x5b84ea=_['map'](_0x340c50,function(_0x5db032){_0x5db032[_0xedeb('0x54')]=_0x50bfa3[_0xedeb('0x44')]['id'];return _0x5db032;});var _0x42724f=[];return BPromise['each'](_0x5b84ea,function(_0xb0a620){return db[_0xedeb('0x55')][_0xedeb('0x48')](_0xb0a620,{'include':[{'model':db[_0xedeb('0x51')],'as':_0xedeb('0x59')}],'raw':!![],'transaction':_0x1c439e})['then'](function(_0x4c91d0){_0x42724f[_0xedeb('0x5a')](_0x4c91d0['get']({'plain':!![]}));});})[_0xedeb('0x26')](function(){return _0x42724f;});});});}})[_0xedeb('0x26')](function(_0x4a5153){return _0x4a5153;})[_0xedeb('0x26')](respondWithResult(_0x1942d2,null))[_0xedeb('0x43')](handleError(_0x1942d2,null));};exports[_0xedeb('0x5b')]=function(_0x2e71a4,_0x43be7c){var _0x543f6f;return db[_0xedeb('0x2d')][_0xedeb('0x47')]({'where':{'id':_0x2e71a4[_0xedeb('0x44')]['id']},'attributes':['id',_0xedeb('0x29')]})[_0xedeb('0x26')](handleEntityNotFound(_0x43be7c,null))['then'](function(_0x23df4f){if(_0x23df4f){_0x543f6f=_0x23df4f;return db['UserProfileSection'][_0xedeb('0x27')]({'where':{'userProfileId':_0x2e71a4['params']['id'],'sectionId':_0x2e71a4[_0xedeb('0x31')][_0xedeb('0x5c')]}});}})[_0xedeb('0x26')](function(){return _0x543f6f;})['then'](respondWithStatusCode(_0x43be7c,null))[_0xedeb('0x43')](handleError(_0x43be7c,null));};exports['getSections']=function(_0x57ec41,_0x245553){var _0x1cecd=[];var _0x14b750=[];return db[_0xedeb('0x55')]['findAll']({'where':{'userProfileId':_0x57ec41[_0xedeb('0x44')]['id']},'raw':!![]})[_0xedeb('0x26')](function(_0x232710){_0x1cecd=_[_0xedeb('0x3c')](_0x232710,function(_0x3df4c2){return _0x3df4c2['enabled']===0x1||_['includes']([0x3eb,0x709],_0x3df4c2[_0xedeb('0x53')]);});if(!_['isEmpty'](_0x1cecd)){return _[_0xedeb('0x2c')](_0x1cecd,function(_0x2ed1ff){return _0x2ed1ff[_0xedeb('0x53')];});}else{return;}})[_0xedeb('0x26')](function(_0x276f8b){if(_0x276f8b)_0x14b750=_0x276f8b;if(_['includes'](_0x14b750,0x64)){var _0x5ebb37=_[_0xedeb('0x47')](_0x1cecd,{'sectionId':0x64});return hasDefaultDashboard(_0x5ebb37)['then'](function(_0x468d27){return _[_0xedeb('0x2c')](_0x1cecd,function(_0x190b32){if(_0x190b32[_0xedeb('0x53')]===0x64){_0x190b32[_0xedeb('0x5d')]=_0x468d27;}return _0x190b32;});});}else{return;}})[_0xedeb('0x26')](function(_0x43fb8b){if(_0x43fb8b)_0x1cecd=_0x43fb8b;if(_['includes'](_0x14b750,0x3eb)){var _0x343549=_[_0xedeb('0x47')](_0x1cecd,{'sectionId':0x3eb});return getCustomDashboards(_0x343549)['then'](function(_0x2fbeaa){return _[_0xedeb('0x2c')](_0x1cecd,function(_0x559d9d){if(_0x343549['enabled']){if(_0x559d9d[_0xedeb('0x53')]===0x3eb){_0x559d9d['subsections']=_0x2fbeaa;}}else{if(_0x559d9d[_0xedeb('0x53')]===0x64){if(!_0x559d9d[_0xedeb('0x5d')]){_0x559d9d[_0xedeb('0x5d')]=[];}_0x559d9d[_0xedeb('0x5d')]=_0x559d9d[_0xedeb('0x5d')]['concat'](_0x2fbeaa);}}return _0x559d9d;});});}else{return;}})[_0xedeb('0x26')](function(_0x565772){if(_0x565772)_0x1cecd=_0x565772;if(_[_0xedeb('0x5e')](_0x14b750,0x709)){var _0x326762=_[_0xedeb('0x47')](_0x1cecd,{'sectionId':0x709});return getPlugins(_0x326762)[_0xedeb('0x26')](function(_0x6b5573){if(_0x326762[_0xedeb('0x5f')]){return _['map'](_0x1cecd,function(_0x354767){if(_0x354767[_0xedeb('0x53')]===0x709){_0x354767['subsections']=_0x6b5573;}return _0x354767;});}else{var _0x28daf6={'sectionId':0x76c,'enabled':0x1,'subsections':_0x6b5573};var _0x403a16=_[_0xedeb('0x2c')](_0x1cecd);_0x403a16[_0xedeb('0x5a')](_0x28daf6);return _0x403a16;}});}else{return;}})[_0xedeb('0x26')](function(_0x49421c){if(_0x49421c)_0x1cecd=_0x49421c;return _[_0xedeb('0x3c')](_0x1cecd,[_0xedeb('0x5f'),0x1]);})[_0xedeb('0x26')](respondWithResult(_0x245553,null))[_0xedeb('0x43')](handleError(_0x245553,null));};function hasDefaultDashboard(_0x1cca90){var _0x7deeb9=[0x65];return new BPromise(function(_0x25f6cd,_0x341eb8){try{if(_0x1cca90['autoAssociation']){_0x25f6cd(_0x7deeb9);}else{return db[_0xedeb('0x51')][_0xedeb('0x60')]({'where':{'sectionId':_0x1cca90['id']},'raw':!![]})['then'](function(_0x549c44){_0x549c44?_0x25f6cd(_0x7deeb9):_0x25f6cd();});}}catch(_0x2dc85b){_0x341eb8(_0x2dc85b);}});}function getCustomDashboards(_0x2ca9ae){var _0x3dd9d5=[];return new BPromise(function(_0x111d44,_0x4c8c08){try{if(_0x2ca9ae[_0xedeb('0x50')]){return db[_0xedeb('0x61')]['findAll']({'raw':!![]})['then'](function(_0x5ca2db){_0x5ca2db['forEach'](function(_0x1e1359){_0x3dd9d5['push'](_0x1e1359['id']+0x1869f);});_0x111d44(_0x3dd9d5);});}else{return db['UserProfileResource'][_0xedeb('0x41')]({'where':{'sectionId':_0x2ca9ae['id']},'raw':!![]})[_0xedeb('0x26')](function(_0x1fc373){_0x1fc373[_0xedeb('0x62')](function(_0x13d5b9){_0x3dd9d5[_0xedeb('0x5a')](_0x13d5b9[_0xedeb('0x63')]+0x1869f);});_0x111d44(_0x3dd9d5);});}}catch(_0xf4c0be){_0x4c8c08(_0xf4c0be);}});}function getPlugins(_0xeea6bc){var _0x45c38a=[];return new BPromise(function(_0x2e8fd6,_0x2cd22f){try{if(_0xeea6bc[_0xedeb('0x50')]){return db['Plugin'][_0xedeb('0x41')]({'raw':!![]})[_0xedeb('0x26')](function(_0x3fb172){_0x3fb172[_0xedeb('0x62')](function(_0x37de41){_0x45c38a[_0xedeb('0x5a')](_0x37de41['id']+0x15b38);});_0x2e8fd6(_0x45c38a);});}else{return db[_0xedeb('0x51')][_0xedeb('0x41')]({'where':{'sectionId':_0xeea6bc['id']},'raw':!![]})[_0xedeb('0x26')](function(_0x59f81a){_0x59f81a[_0xedeb('0x62')](function(_0x5a0473){_0x45c38a[_0xedeb('0x5a')](_0x5a0473[_0xedeb('0x63')]+0x15b38);});_0x2e8fd6(_0x45c38a);});}}catch(_0x232110){_0x2cd22f(_0x232110);}});}exports[_0xedeb('0x64')]=function(_0x3349a,_0x475243){return db[_0xedeb('0x2d')]['find']({'where':{'id':_0x3349a[_0xedeb('0x44')]['id']}})[_0xedeb('0x26')](handleEntityNotFound(_0x475243,null))[_0xedeb('0x26')](function(_0x3e6890){if(_0x3e6890){return db['sequelize'][_0xedeb('0x4e')](function(_0x1a359a){return db[_0xedeb('0x55')]['findAll']({'where':{'userProfileId':_0x3349a['params']['id']},'attributes':['id'],'raw':!![]})[_0xedeb('0x26')](function(_0x1cf267){if(_0x1cf267){return db['UserProfileSection'][_0xedeb('0x27')]({'where':{'userProfileId':_0x3349a[_0xedeb('0x44')]['id'],'id':_[_0xedeb('0x2c')](_0x1cf267,function(_0x4a8364){return _0x4a8364['id'];})},'transaction':_0x1a359a});}})[_0xedeb('0x26')](function(_0x1e42c4){var _0x1a0f21=_[_0xedeb('0x2c')](_0x3349a[_0xedeb('0x4c')],function(_0xe20264){_0xe20264['userProfileId']=_0x3349a[_0xedeb('0x44')]['id'];return _0xe20264;});return db['UserProfileSection']['bulkCreate'](_0x1a0f21,{'raw':!![],'transaction':_0x1a359a});})[_0xedeb('0x26')](function(_0xe53d45){var _0x404dd5=_[_0xedeb('0x3c')](_[_0xedeb('0x2c')](_0xe53d45,function(_0x1bdf37){return _0x1bdf37[_0xedeb('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x404dd5){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x3349a[_0xedeb('0x44')]['id'],'sectionId':_[_0xedeb('0x2c')](_0x404dd5,function(_0x7c653b){return _0x7c653b[_0xedeb('0x53')];})},'attributes':['id',_0xedeb('0x53')],'raw':!![]})[_0xedeb('0x26')](function(_0x1e2c42){var _0x3112dd=_[_0xedeb('0x2c')](_0x3349a[_0xedeb('0x4c')],function(_0x3379fd){_0x3379fd['userProfileId']=_0x3349a[_0xedeb('0x44')]['id'];return _0x3379fd;});return db[_0xedeb('0x51')][_0xedeb('0x65')](_0x3112dd,{'raw':!![],'transaction':_0x1a359a});});}})[_0xedeb('0x43')](handleError(_0x475243,null));});}})[_0xedeb('0x26')](function(_0x15b9dd){var _0x3f5e35=_['map'](_0x15b9dd,function(_0x4aca11){return _0x4aca11[_0xedeb('0x4f')]({'plain':!![]});});})['then'](respondWithResult(_0x475243,null))[_0xedeb('0x43')](handleError(_0x475243,null));};exports[_0xedeb('0x66')]=function(_0x1da2a6,_0x5c5a7f,_0x5ac92b){return db[_0xedeb('0x2d')][_0xedeb('0x47')]({'where':{'id':_0x1da2a6['params']['id']}})[_0xedeb('0x26')](handleEntityNotFound(_0x5c5a7f,null))[_0xedeb('0x26')](function(_0x25c9f5){if(_0x25c9f5){return _0x25c9f5[_0xedeb('0x66')](_0x1da2a6[_0xedeb('0x31')]['ids']);}})[_0xedeb('0x26')](respondWithStatusCode(_0x5c5a7f,null))['catch'](handleError(_0x5c5a7f,null));};exports['getResources']=function(_0x1b2cf0,_0x4dcc45){var _0x449a4b={};if(!_0x1b2cf0[_0xedeb('0x31')]['section'])throw new Error(_0xedeb('0x67'));if(!_0x1b2cf0[_0xedeb('0x31')][_0xedeb('0x37')](_0xedeb('0x38'))){_0x449a4b[_0xedeb('0x1e')]=qs[_0xedeb('0x1e')](_0x1b2cf0[_0xedeb('0x31')][_0xedeb('0x1e')]);_0x449a4b[_0xedeb('0x20')]=qs[_0xedeb('0x20')](_0x1b2cf0[_0xedeb('0x31')][_0xedeb('0x20')]);}return db[_0xedeb('0x2d')][_0xedeb('0x47')]({'where':{'id':_0x1b2cf0[_0xedeb('0x44')]['id']}})['then'](function(_0x59bda7){if(!_0x59bda7)throw new Error(_0xedeb('0x68')+_0x1b2cf0['params']['id']);return db[_0xedeb('0x2d')][_0xedeb('0x69')](_0x1b2cf0);})[_0xedeb('0x26')](respondWithFilteredResult(_0x4dcc45,_0x449a4b))[_0xedeb('0x43')](handleError(_0x4dcc45,null));}; \ No newline at end of file +var _0xb76c=['where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','create','body','params','rawAttributes','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','find','describe','addSections','push','removeSections','getSections','enabled','includes','isEmpty','subsections','findOne','forEach','resourceId','Plugin','bulkCreate','removeResources','ids','getResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','register','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','UserProfile','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x1b9897,_0x102c7a){var _0x48b7f4=function(_0xf12094){while(--_0xf12094){_0x1b9897['push'](_0x1b9897['shift']());}};_0x48b7f4(++_0x102c7a);}(_0xb76c,0x1e8));var _0xcb76=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0xb76c[_0x1f1a97];return _0x29fc6a;};'use strict';var emlformat=require(_0xcb76('0x0'));var rimraf=require(_0xcb76('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcb76('0x2'));var rp=require('request-promise');var moment=require(_0xcb76('0x3'));var BPromise=require(_0xcb76('0x4'));var Mustache=require(_0xcb76('0x5'));var util=require(_0xcb76('0x6'));var path=require(_0xcb76('0x7'));var sox=require(_0xcb76('0x8'));var csv=require(_0xcb76('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb76('0xa'));var _=require(_0xcb76('0xb'));var squel=require(_0xcb76('0xc'));var crypto=require(_0xcb76('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xcb76('0xe'));var toCsv=require(_0xcb76('0x9'));var querystring=require(_0xcb76('0xf'));var Papa=require(_0xcb76('0x10'));var Redis=require(_0xcb76('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcb76('0x12'));var hardwareService=require(_0xcb76('0x13'));var logger=require(_0xcb76('0x14'))(_0xcb76('0x15'));var utils=require(_0xcb76('0x16'));var config=require(_0xcb76('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcb76('0x18'))['db'];config[_0xcb76('0x19')]=_[_0xcb76('0x1a')](config[_0xcb76('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcb76('0x19')]));require('./userProfile.socket')[_0xcb76('0x1b')](socket);function respondWithStatusCode(_0x11ef67,_0x4c55be){_0x4c55be=_0x4c55be||0xcc;return function(_0x113418){if(_0x113418){return _0x11ef67['sendStatus'](_0x4c55be);}return _0x11ef67[_0xcb76('0x1c')](_0x4c55be)[_0xcb76('0x1d')]();};}function respondWithResult(_0x3dea5d,_0x3b0915){_0x3b0915=_0x3b0915||0xc8;return function(_0x3b8761){if(_0x3b8761){return _0x3dea5d[_0xcb76('0x1c')](_0x3b0915)[_0xcb76('0x1e')](_0x3b8761);}};}function respondWithFilteredResult(_0x548655,_0x59c060){return function(_0x49ce0a){if(_0x49ce0a){var _0x464926=typeof _0x59c060['offset']===_0xcb76('0x1f')&&typeof _0x59c060[_0xcb76('0x20')]===_0xcb76('0x1f');var _0x4393c8=_0x49ce0a[_0xcb76('0x21')];var _0x11ff73=_0x464926?0x0:_0x59c060['offset'];var _0x590746=_0x464926?_0x49ce0a[_0xcb76('0x21')]:_0x59c060[_0xcb76('0x22')]+_0x59c060[_0xcb76('0x20')];var _0x704616;if(_0x590746>=_0x4393c8){_0x590746=_0x4393c8;_0x704616=0xc8;}else{_0x704616=0xce;}_0x548655[_0xcb76('0x1c')](_0x704616);return _0x548655['set'](_0xcb76('0x23'),_0x11ff73+'-'+_0x590746+'/'+_0x4393c8)[_0xcb76('0x1e')](_0x49ce0a);}return null;};}function patchUpdates(_0x207714){return function(_0xd2d4b7){try{jsonpatch[_0xcb76('0x24')](_0xd2d4b7,_0x207714,!![]);}catch(_0x47f751){return BPromise[_0xcb76('0x25')](_0x47f751);}return _0xd2d4b7[_0xcb76('0x26')]();};}function saveUpdates(_0x111b6b,_0x5f4b16){return function(_0x45b845){if(_0x45b845){return _0x45b845[_0xcb76('0x27')](_0x111b6b)[_0xcb76('0x28')](function(_0x2415ac){return _0x2415ac;});}return null;};}function removeEntity(_0x15fcef,_0x19d2d2){return function(_0x4530bf){if(_0x4530bf){return _0x4530bf[_0xcb76('0x29')]()[_0xcb76('0x28')](function(){_0x15fcef['status'](0xcc)[_0xcb76('0x1d')]();});}};}function handleEntityNotFound(_0x30c731,_0x26c19b){return function(_0x1913cb){if(!_0x1913cb){_0x30c731['sendStatus'](0x194);}return _0x1913cb;};}function handleError(_0x557c6b,_0x19b30f){_0x19b30f=_0x19b30f||0x1f4;return function(_0x47d28e){logger[_0xcb76('0x2a')](_0x47d28e[_0xcb76('0x2b')]);if(_0x47d28e[_0xcb76('0x2c')]){delete _0x47d28e['name'];}_0x557c6b[_0xcb76('0x1c')](_0x19b30f)[_0xcb76('0x2d')](_0x47d28e);};}exports['index']=function(_0xf8a8a9,_0x3ab1d6){var _0xc54b52={},_0x3b6f9a={},_0x39c19f={'count':0x0,'rows':[]};var _0x4863d7=_[_0xcb76('0x2e')](db[_0xcb76('0x2f')]['rawAttributes'],function(_0x20a11d){return{'name':_0x20a11d['fieldName'],'type':_0x20a11d[_0xcb76('0x30')][_0xcb76('0x31')]};});_0x3b6f9a['model']=_['map'](_0x4863d7,'name');_0x3b6f9a[_0xcb76('0x32')]=_[_0xcb76('0x33')](_0xf8a8a9['query']);_0x3b6f9a[_0xcb76('0x34')]=_[_0xcb76('0x35')](_0x3b6f9a[_0xcb76('0x36')],_0x3b6f9a[_0xcb76('0x32')]);_0xc54b52[_0xcb76('0x37')]=_['intersection'](_0x3b6f9a[_0xcb76('0x36')],qs[_0xcb76('0x38')](_0xf8a8a9[_0xcb76('0x32')][_0xcb76('0x38')]));_0xc54b52[_0xcb76('0x37')]=_0xc54b52['attributes'][_0xcb76('0x39')]?_0xc54b52['attributes']:_0x3b6f9a[_0xcb76('0x36')];if(!_0xf8a8a9['query'][_0xcb76('0x3a')](_0xcb76('0x3b'))){_0xc54b52[_0xcb76('0x20')]=qs[_0xcb76('0x20')](_0xf8a8a9[_0xcb76('0x32')][_0xcb76('0x20')]);_0xc54b52[_0xcb76('0x22')]=qs['offset'](_0xf8a8a9[_0xcb76('0x32')][_0xcb76('0x22')]);}_0xc54b52[_0xcb76('0x3c')]=qs['sort'](_0xf8a8a9[_0xcb76('0x32')][_0xcb76('0x3d')]);_0xc54b52[_0xcb76('0x3e')]=qs[_0xcb76('0x34')](_[_0xcb76('0x3f')](_0xf8a8a9['query'],_0x3b6f9a[_0xcb76('0x34')]),_0x4863d7);if(_0xf8a8a9[_0xcb76('0x32')]['filter']){_0xc54b52[_0xcb76('0x3e')]=_[_0xcb76('0x40')](_0xc54b52[_0xcb76('0x3e')],{'$or':_[_0xcb76('0x2e')](_0x4863d7,function(_0x3750fc){if(_0x3750fc[_0xcb76('0x30')]!=='VIRTUAL'){var _0x47d669={};_0x47d669[_0x3750fc['name']]={'$like':'%'+_0xf8a8a9[_0xcb76('0x32')][_0xcb76('0x41')]+'%'};return _0x47d669;}})});}_0xc54b52=_[_0xcb76('0x40')]({},_0xc54b52,_0xf8a8a9[_0xcb76('0x42')]);var _0x2ba156={'where':_0xc54b52[_0xcb76('0x3e')]};return db[_0xcb76('0x2f')]['count'](_0x2ba156)[_0xcb76('0x28')](function(_0x2304f1){_0x39c19f[_0xcb76('0x21')]=_0x2304f1;if(_0xf8a8a9['query'][_0xcb76('0x43')]){_0xc54b52[_0xcb76('0x44')]=[{'all':!![]}];}return db['UserProfile'][_0xcb76('0x45')](_0xc54b52);})['then'](function(_0x1239a7){_0x39c19f[_0xcb76('0x46')]=_0x1239a7;return _0x39c19f;})[_0xcb76('0x28')](respondWithFilteredResult(_0x3ab1d6,_0xc54b52))[_0xcb76('0x47')](handleError(_0x3ab1d6,null));};exports['show']=function(_0x455d22,_0x567f5e){var _0x2ef19a={'raw':![],'where':{'id':_0x455d22['params']['id']}},_0x3d336e={};_0x3d336e[_0xcb76('0x36')]=_['keys'](db[_0xcb76('0x2f')]['rawAttributes']);_0x3d336e[_0xcb76('0x32')]=_['keys'](_0x455d22['query']);_0x3d336e[_0xcb76('0x34')]=_[_0xcb76('0x35')](_0x3d336e[_0xcb76('0x36')],_0x3d336e[_0xcb76('0x32')]);_0x2ef19a[_0xcb76('0x37')]=_[_0xcb76('0x35')](_0x3d336e['model'],qs[_0xcb76('0x38')](_0x455d22[_0xcb76('0x32')][_0xcb76('0x38')]));_0x2ef19a[_0xcb76('0x37')]=_0x2ef19a[_0xcb76('0x37')][_0xcb76('0x39')]?_0x2ef19a[_0xcb76('0x37')]:_0x3d336e[_0xcb76('0x36')];if(_0x455d22['query'][_0xcb76('0x43')]){_0x2ef19a['include']=[{'all':!![]}];}_0x2ef19a=_[_0xcb76('0x40')]({},_0x2ef19a,_0x455d22[_0xcb76('0x42')]);return db[_0xcb76('0x2f')]['find'](_0x2ef19a)['then'](handleEntityNotFound(_0x567f5e,null))['then'](respondWithResult(_0x567f5e,null))[_0xcb76('0x47')](handleError(_0x567f5e,null));};exports[_0xcb76('0x48')]=function(_0x5e3fac,_0x2d2f96){return db[_0xcb76('0x2f')]['create'](_0x5e3fac[_0xcb76('0x49')],{})[_0xcb76('0x28')](respondWithResult(_0x2d2f96,0xc9))[_0xcb76('0x47')](handleError(_0x2d2f96,null));};exports['clone']=function(_0x8bd43c,_0x23d30c){var _0x226f7={'where':{'id':_0x8bd43c[_0xcb76('0x4a')]['id']}},_0x248c4d={};_0x248c4d[_0xcb76('0x36')]=_['keys'](db[_0xcb76('0x2f')][_0xcb76('0x4b')]);_0x226f7[_0xcb76('0x37')]=_[_0xcb76('0x35')](_0x248c4d[_0xcb76('0x36')],qs[_0xcb76('0x38')](_0x8bd43c[_0xcb76('0x32')][_0xcb76('0x38')]));_0x226f7[_0xcb76('0x37')]=_0x226f7[_0xcb76('0x37')][_0xcb76('0x39')]?_0x226f7[_0xcb76('0x37')]:_0x248c4d[_0xcb76('0x36')];if(_0x8bd43c[_0xcb76('0x32')][_0xcb76('0x43')]){_0x226f7[_0xcb76('0x44')]=[{'all':!![]}];}_0x226f7=_[_0xcb76('0x40')]({},_0x226f7,_0x8bd43c[_0xcb76('0x42')]);return db['UserProfile']['find'](_0x226f7)['then'](handleEntityNotFound(_0x23d30c,null))[_0xcb76('0x28')](function(_0x48e9a9){if(_0x48e9a9){var _0x1a1b0b=_0x48e9a9[_0xcb76('0x4c')]({'plain':!![]});_0x1a1b0b=qs[_0xcb76('0x4d')](_0x1a1b0b,['id',_0xcb76('0x4e'),_0xcb76('0x4f'),_0xcb76('0x50')]);_0x8bd43c['body']=_['omit'](_0x8bd43c[_0xcb76('0x49')],['id',_0xcb76('0x4e'),_0xcb76('0x4f')]);return db[_0xcb76('0x51')][_0xcb76('0x52')](function(_0x544014){return db['UserProfile'][_0xcb76('0x48')](_[_0xcb76('0x40')](_0x1a1b0b,_0x8bd43c[_0xcb76('0x49')]),{'include':_0x8bd43c[_0xcb76('0x32')][_0xcb76('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x544014})['then'](function(_0x320936){var _0x391cfc=_0x320936[_0xcb76('0x4c')]({'plain':!![]});return db[_0xcb76('0x53')]['findAll']({'where':{'userProfileId':_0x8bd43c['params']['id']},'raw':!![]})[_0xcb76('0x28')](function(_0x244496){if(_0x244496){return BPromise[_0xcb76('0x54')](_0x244496,function(_0x18ea61){return new BPromise(function(_0x2daab,_0x3c40e0){if(_0x18ea61[_0xcb76('0x55')]===null||_0x18ea61[_0xcb76('0x55')]===0x1)_0x2daab(null);return db[_0xcb76('0x56')][_0xcb76('0x45')]({'where':{'sectionId':_0x18ea61['id']},'raw':!![]})[_0xcb76('0x28')](function(_0x293113){var _0x35dfe4=_['map'](_0x293113,function(_0x14fbba){return qs[_0xcb76('0x4d')](_0x14fbba,['id',_0xcb76('0x4e'),_0xcb76('0x4f'),_0xcb76('0x57')]);});_0x2daab(_0x35dfe4);})[_0xcb76('0x47')](function(_0x523f8b){_0x3c40e0(_0x523f8b);});})[_0xcb76('0x28')](function(_0x637ba8){var _0x145762=qs[_0xcb76('0x4d')](_0x18ea61,['id',_0xcb76('0x4e'),_0xcb76('0x4f')]);_0x145762[_0xcb76('0x58')]=_0x391cfc['id'];if(_0x637ba8)_0x145762[_0xcb76('0x59')]=_0x637ba8;return _0x145762;})[_0xcb76('0x28')](function(_0x3f22e4){return db[_0xcb76('0x53')]['create'](_0x3f22e4,{'include':[{'model':db['UserProfileResource'],'as':_0xcb76('0x59')}],'raw':!![],'transaction':_0x544014});});})[_0xcb76('0x28')](function(){return _0x391cfc;});}});});});}})[_0xcb76('0x28')](respondWithResult(_0x23d30c,0xc9))['catch'](handleError(_0x23d30c,null));};exports[_0xcb76('0x27')]=function(_0x1cb745,_0x5c67b3){if(_0x1cb745[_0xcb76('0x49')]['id']){delete _0x1cb745[_0xcb76('0x49')]['id'];}return db['UserProfile'][_0xcb76('0x5a')]({'where':{'id':_0x1cb745[_0xcb76('0x4a')]['id']}})[_0xcb76('0x28')](handleEntityNotFound(_0x5c67b3,null))['then'](saveUpdates(_0x1cb745['body'],null))[_0xcb76('0x28')](respondWithResult(_0x5c67b3,null))[_0xcb76('0x47')](handleError(_0x5c67b3,null));};exports[_0xcb76('0x29')]=function(_0x2c0f67,_0x4bdf9d){return db['UserProfile'][_0xcb76('0x5a')]({'where':{'id':_0x2c0f67[_0xcb76('0x4a')]['id']}})[_0xcb76('0x28')](handleEntityNotFound(_0x4bdf9d,null))[_0xcb76('0x28')](removeEntity(_0x4bdf9d,null))[_0xcb76('0x47')](handleError(_0x4bdf9d,null));};exports[_0xcb76('0x5b')]=function(_0x2f9c58,_0x16197b){return db[_0xcb76('0x2f')]['describe']()[_0xcb76('0x28')](respondWithResult(_0x16197b,null))['catch'](handleError(_0x16197b,null));};exports[_0xcb76('0x5c')]=function(_0x5b6615,_0xf88ffb){var _0x474367=_0x5b6615[_0xcb76('0x49')];return db[_0xcb76('0x2f')][_0xcb76('0x5a')]({'where':{'id':_0x5b6615[_0xcb76('0x4a')]['id']}})[_0xcb76('0x28')](handleEntityNotFound(_0xf88ffb,null))[_0xcb76('0x28')](function(_0x24f24e){if(_0x24f24e){return db[_0xcb76('0x51')][_0xcb76('0x52')](function(_0x2e615e){return db[_0xcb76('0x53')][_0xcb76('0x29')]({'where':{'userProfileId':_0x5b6615[_0xcb76('0x4a')]['id'],'sectionId':_[_0xcb76('0x2e')](_0x474367,function(_0x8a0b13){return _0x8a0b13[_0xcb76('0x57')];})},'transaction':_0x2e615e})['then'](function(){var _0x1a6733=_['map'](_0x474367,function(_0x43bd56){_0x43bd56[_0xcb76('0x58')]=_0x5b6615[_0xcb76('0x4a')]['id'];return _0x43bd56;});var _0x41df3=[];return BPromise[_0xcb76('0x54')](_0x1a6733,function(_0x1476d0){return db['UserProfileSection']['create'](_0x1476d0,{'include':[{'model':db[_0xcb76('0x56')],'as':_0xcb76('0x59')}],'raw':!![],'transaction':_0x2e615e})[_0xcb76('0x28')](function(_0x2b51fa){_0x41df3[_0xcb76('0x5d')](_0x2b51fa[_0xcb76('0x4c')]({'plain':!![]}));});})[_0xcb76('0x28')](function(){return _0x41df3;});});});}})[_0xcb76('0x28')](function(_0x42e716){return _0x42e716;})[_0xcb76('0x28')](respondWithResult(_0xf88ffb,null))[_0xcb76('0x47')](handleError(_0xf88ffb,null));};exports[_0xcb76('0x5e')]=function(_0x5b4077,_0x9ce3a2){var _0x289404;return db['UserProfile'][_0xcb76('0x5a')]({'where':{'id':_0x5b4077[_0xcb76('0x4a')]['id']},'attributes':['id',_0xcb76('0x2c')]})[_0xcb76('0x28')](handleEntityNotFound(_0x9ce3a2,null))[_0xcb76('0x28')](function(_0x4170ea){if(_0x4170ea){_0x289404=_0x4170ea;return db[_0xcb76('0x53')][_0xcb76('0x29')]({'where':{'userProfileId':_0x5b4077[_0xcb76('0x4a')]['id'],'sectionId':_0x5b4077[_0xcb76('0x32')]['ids']}});}})['then'](function(){return _0x289404;})[_0xcb76('0x28')](respondWithStatusCode(_0x9ce3a2,null))[_0xcb76('0x47')](handleError(_0x9ce3a2,null));};exports[_0xcb76('0x5f')]=function(_0x57de79,_0x1ab5e4){var _0x32660b=[];var _0x4edf72=[];return db[_0xcb76('0x53')][_0xcb76('0x45')]({'where':{'userProfileId':_0x57de79[_0xcb76('0x4a')]['id']},'raw':!![]})[_0xcb76('0x28')](function(_0x1ba1c6){_0x32660b=_[_0xcb76('0x41')](_0x1ba1c6,function(_0x78b129){return _0x78b129[_0xcb76('0x60')]===0x1||_[_0xcb76('0x61')]([0x3eb,0x709],_0x78b129[_0xcb76('0x57')]);});if(!_[_0xcb76('0x62')](_0x32660b)){return _[_0xcb76('0x2e')](_0x32660b,function(_0x5e188e){return _0x5e188e[_0xcb76('0x57')];});}else{return;}})[_0xcb76('0x28')](function(_0x35876c){if(_0x35876c)_0x4edf72=_0x35876c;if(_[_0xcb76('0x61')](_0x4edf72,0x64)){var _0x2651b5=_[_0xcb76('0x5a')](_0x32660b,{'sectionId':0x64});return hasDefaultDashboard(_0x2651b5)[_0xcb76('0x28')](function(_0x34862e){return _['map'](_0x32660b,function(_0x2502c8){if(_0x2502c8[_0xcb76('0x57')]===0x64){_0x2502c8[_0xcb76('0x63')]=_0x34862e;}return _0x2502c8;});});}else{return;}})[_0xcb76('0x28')](function(_0x64755){if(_0x64755)_0x32660b=_0x64755;if(_['includes'](_0x4edf72,0x3eb)){var _0x35ab16=_['find'](_0x32660b,{'sectionId':0x3eb});return getCustomDashboards(_0x35ab16)[_0xcb76('0x28')](function(_0x5ab459){return _[_0xcb76('0x2e')](_0x32660b,function(_0x541f06){if(_0x35ab16['enabled']){if(_0x541f06[_0xcb76('0x57')]===0x3eb){_0x541f06[_0xcb76('0x63')]=_0x5ab459;}}else{if(_0x541f06[_0xcb76('0x57')]===0x64){if(!_0x541f06[_0xcb76('0x63')]){_0x541f06[_0xcb76('0x63')]=[];}_0x541f06[_0xcb76('0x63')]=_0x541f06[_0xcb76('0x63')]['concat'](_0x5ab459);}}return _0x541f06;});});}else{return;}})[_0xcb76('0x28')](function(_0x8f99c3){if(_0x8f99c3)_0x32660b=_0x8f99c3;if(_[_0xcb76('0x61')](_0x4edf72,0x709)){var _0x1d1a90=_[_0xcb76('0x5a')](_0x32660b,{'sectionId':0x709});return getPlugins(_0x1d1a90)[_0xcb76('0x28')](function(_0x292750){if(_0x1d1a90['enabled']){return _[_0xcb76('0x2e')](_0x32660b,function(_0x1ab9c0){if(_0x1ab9c0[_0xcb76('0x57')]===0x709){_0x1ab9c0[_0xcb76('0x63')]=_0x292750;}return _0x1ab9c0;});}else{var _0x449dd3={'sectionId':0x76c,'enabled':0x1,'subsections':_0x292750};var _0x6e2e09=_[_0xcb76('0x2e')](_0x32660b);_0x6e2e09['push'](_0x449dd3);return _0x6e2e09;}});}else{return;}})['then'](function(_0x17eed1){if(_0x17eed1)_0x32660b=_0x17eed1;return _[_0xcb76('0x41')](_0x32660b,[_0xcb76('0x60'),0x1]);})[_0xcb76('0x28')](respondWithResult(_0x1ab5e4,null))['catch'](handleError(_0x1ab5e4,null));};function hasDefaultDashboard(_0x5e2f99){var _0x5c7417=[0x65];return new BPromise(function(_0x5609fa,_0x4e5326){try{if(_0x5e2f99[_0xcb76('0x55')]){_0x5609fa(_0x5c7417);}else{return db[_0xcb76('0x56')][_0xcb76('0x64')]({'where':{'sectionId':_0x5e2f99['id']},'raw':!![]})[_0xcb76('0x28')](function(_0x1b6f28){_0x1b6f28?_0x5609fa(_0x5c7417):_0x5609fa();});}}catch(_0x7a479c){_0x4e5326(_0x7a479c);}});}function getCustomDashboards(_0x8df917){var _0x1cbd52=[];return new BPromise(function(_0x242a1d,_0x2137d1){try{if(_0x8df917[_0xcb76('0x55')]){return db['Dashboard'][_0xcb76('0x45')]({'raw':!![]})[_0xcb76('0x28')](function(_0x13abd9){_0x13abd9[_0xcb76('0x65')](function(_0x51d44c){_0x1cbd52[_0xcb76('0x5d')](_0x51d44c['id']+0x1869f);});_0x242a1d(_0x1cbd52);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x8df917['id']},'raw':!![]})['then'](function(_0x2c3a05){_0x2c3a05['forEach'](function(_0x4cb128){_0x1cbd52[_0xcb76('0x5d')](_0x4cb128[_0xcb76('0x66')]+0x1869f);});_0x242a1d(_0x1cbd52);});}}catch(_0x2e00e5){_0x2137d1(_0x2e00e5);}});}function getPlugins(_0x4b733e){var _0x2f64d9=[];return new BPromise(function(_0x6662d3,_0x1c0078){try{if(_0x4b733e[_0xcb76('0x55')]){return db[_0xcb76('0x67')][_0xcb76('0x45')]({'raw':!![]})[_0xcb76('0x28')](function(_0x5c8323){_0x5c8323[_0xcb76('0x65')](function(_0x1b37e0){_0x2f64d9[_0xcb76('0x5d')](_0x1b37e0['id']+0x15b38);});_0x6662d3(_0x2f64d9);});}else{return db[_0xcb76('0x56')][_0xcb76('0x45')]({'where':{'sectionId':_0x4b733e['id']},'raw':!![]})[_0xcb76('0x28')](function(_0x2f56cb){_0x2f56cb[_0xcb76('0x65')](function(_0x11b7b1){_0x2f64d9[_0xcb76('0x5d')](_0x11b7b1[_0xcb76('0x66')]+0x15b38);});_0x6662d3(_0x2f64d9);});}}catch(_0x25bf6b){_0x1c0078(_0x25bf6b);}});}exports['addResources']=function(_0x4d6885,_0xad5655){return db[_0xcb76('0x2f')][_0xcb76('0x5a')]({'where':{'id':_0x4d6885['params']['id']}})[_0xcb76('0x28')](handleEntityNotFound(_0xad5655,null))[_0xcb76('0x28')](function(_0x2b1776){if(_0x2b1776){return db['sequelize']['transaction'](function(_0x277e90){return db[_0xcb76('0x53')]['findAll']({'where':{'userProfileId':_0x4d6885[_0xcb76('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0xcb76('0x28')](function(_0xdbb442){if(_0xdbb442){return db[_0xcb76('0x53')][_0xcb76('0x29')]({'where':{'userProfileId':_0x4d6885[_0xcb76('0x4a')]['id'],'id':_[_0xcb76('0x2e')](_0xdbb442,function(_0x46ebc7){return _0x46ebc7['id'];})},'transaction':_0x277e90});}})[_0xcb76('0x28')](function(_0x3b1b75){var _0x36f503=_['map'](_0x4d6885[_0xcb76('0x49')],function(_0x4f19e7){_0x4f19e7[_0xcb76('0x58')]=_0x4d6885['params']['id'];return _0x4f19e7;});return db['UserProfileSection'][_0xcb76('0x68')](_0x36f503,{'raw':!![],'transaction':_0x277e90});})[_0xcb76('0x28')](function(_0x477249){var _0x53e36f=_[_0xcb76('0x41')](_[_0xcb76('0x2e')](_0x477249,function(_0x5eb3c9){return _0x5eb3c9[_0xcb76('0x4c')]({'plain':!![]});}),{'includeAll':![]});if(_0x53e36f){return db[_0xcb76('0x53')][_0xcb76('0x45')]({'where':{'userProfileId':_0x4d6885['params']['id'],'sectionId':_['map'](_0x53e36f,function(_0x2266b1){return _0x2266b1[_0xcb76('0x57')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x4c08c5){var _0x3cd225=_[_0xcb76('0x2e')](_0x4d6885['body'],function(_0x15753f){_0x15753f[_0xcb76('0x58')]=_0x4d6885[_0xcb76('0x4a')]['id'];return _0x15753f;});return db[_0xcb76('0x56')]['bulkCreate'](_0x3cd225,{'raw':!![],'transaction':_0x277e90});});}})[_0xcb76('0x47')](handleError(_0xad5655,null));});}})[_0xcb76('0x28')](function(_0x5cd635){var _0x35e52b=_[_0xcb76('0x2e')](_0x5cd635,function(_0x32e023){return _0x32e023[_0xcb76('0x4c')]({'plain':!![]});});})[_0xcb76('0x28')](respondWithResult(_0xad5655,null))[_0xcb76('0x47')](handleError(_0xad5655,null));};exports[_0xcb76('0x69')]=function(_0x69b220,_0x125446,_0x342684){return db[_0xcb76('0x2f')][_0xcb76('0x5a')]({'where':{'id':_0x69b220[_0xcb76('0x4a')]['id']}})['then'](handleEntityNotFound(_0x125446,null))[_0xcb76('0x28')](function(_0x578088){if(_0x578088){return _0x578088[_0xcb76('0x69')](_0x69b220[_0xcb76('0x32')][_0xcb76('0x6a')]);}})[_0xcb76('0x28')](respondWithStatusCode(_0x125446,null))[_0xcb76('0x47')](handleError(_0x125446,null));};exports[_0xcb76('0x6b')]=function(_0x1246df,_0x196b75){var _0x538e41={};if(!_0x1246df[_0xcb76('0x32')][_0xcb76('0x6c')])throw new Error('Missing\x20section\x20parameter');if(!_0x1246df[_0xcb76('0x32')][_0xcb76('0x3a')](_0xcb76('0x3b'))){_0x538e41[_0xcb76('0x20')]=qs[_0xcb76('0x20')](_0x1246df[_0xcb76('0x32')][_0xcb76('0x20')]);_0x538e41[_0xcb76('0x22')]=qs[_0xcb76('0x22')](_0x1246df[_0xcb76('0x32')][_0xcb76('0x22')]);}return db[_0xcb76('0x2f')][_0xcb76('0x5a')]({'where':{'id':_0x1246df[_0xcb76('0x4a')]['id']}})[_0xcb76('0x28')](function(_0x5010f7){if(!_0x5010f7)throw new Error(_0xcb76('0x6d')+_0x1246df['params']['id']);return db[_0xcb76('0x2f')][_0xcb76('0x6b')](_0x1246df);})[_0xcb76('0x28')](respondWithFilteredResult(_0x196b75,_0x538e41))[_0xcb76('0x47')](handleError(_0x196b75,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 7257443..2fd6a91 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 _0x6db4=['emit','hasOwnProperty','hook','../../mysqldb','UserProfile','setMaxListeners','save','update','remove'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x6db4,0x111));var _0x46db=function(_0x45e08b,_0x4db300){_0x45e08b=_0x45e08b-0x0;var _0x594276=_0x6db4[_0x45e08b];return _0x594276;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x46db('0x0'))['db'][_0x46db('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x46db('0x2')](0x0);var events={'afterCreate':_0x46db('0x3'),'afterUpdate':_0x46db('0x4'),'afterDestroy':_0x46db('0x5')};function emitEvent(_0x5a9b9c){return function(_0x476ef3,_0x8e4cd8,_0x2a762b){UserProfileEvents[_0x46db('0x6')](_0x5a9b9c+':'+_0x476ef3['id'],_0x476ef3);UserProfileEvents[_0x46db('0x6')](_0x5a9b9c,_0x476ef3);_0x2a762b(null);};}for(var e in events){if(events[_0x46db('0x7')](e)){var event=events[e];UserProfile[_0x46db('0x8')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xc838=['../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc838,0xbd));var _0x8c83=function(_0x1e3c7e,_0x27dd96){_0x1e3c7e=_0x1e3c7e-0x0;var _0x39e009=_0xc838[_0x1e3c7e];return _0x39e009;};'use strict';var EventEmitter=require(_0x8c83('0x0'));var UserProfile=require(_0x8c83('0x1'))['db'][_0x8c83('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x8c83('0x3')](0x0);var events={'afterCreate':_0x8c83('0x4'),'afterUpdate':_0x8c83('0x5'),'afterDestroy':_0x8c83('0x6')};function emitEvent(_0x25a345){return function(_0x2bb018,_0x85c36d,_0x37a3d9){UserProfileEvents[_0x8c83('0x7')](_0x25a345+':'+_0x2bb018['id'],_0x2bb018);UserProfileEvents[_0x8c83('0x7')](_0x25a345,_0x2bb018);_0x37a3d9(null);};}for(var e in events){if(events[_0x8c83('0x8')](e)){var event=events[e];UserProfile[_0x8c83('0x9')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index b78c34b..3b42e32 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 _0x497e=['SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','Users','admin','user','Agents','zendeskaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','intervals','pauses','Pause','scheduler','sounds','Sound','tags','templates','Trigger','trunks','Trunk','variables','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','user_profiles','query','raw','section','mergeResources','Invalid\x20section\x20\x27','length','UserProfileSection','find','params','all','ignore','isEmpty','union','push','keys','filters','intersection','fields','nolimit','limit','offset','order','sort','pick','merge','VIRTUAL','foreignKey','forEach','options','autoAssociation','includeAll','include','reportType','default','DefaultReports','CustomReports','count','rows','ids','customSorting','extraQueryConditions','color','tag','ThroughTags','true','chat','sms','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','models','filter','field','value','findAll','then','map','catch','model','associatedResources','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','squarerecordings','SquareRecording','parentSections','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','name','membername','User','role','agent','Telephones','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x497e,0x132));var _0xe497=function(_0x5a7b47,_0x1b417e){_0x5a7b47=_0x5a7b47-0x0;var _0x196e3a=_0x497e[_0x5a7b47];return _0x196e3a;};'use strict';var _=require(_0xe497('0x0'));var attributes=require(_0xe497('0x1'));var qs=require(_0xe497('0x2'));var squel=require(_0xe497('0x3'));module['exports']=function(_0xb79d3c){var _0x262ca8=_0xb79d3c[_0xe497('0x4')];function _0x573caa(_0x2707b3,_0x3e4f89){return new Promise(function(_0x2564f8,_0x2d81a5){if(!_0x3e4f89)return _0x2564f8(null);var _0x3e4168=_0x3e4f89[_0xe497('0x5')]?{[_0x3e4f89[_0xe497('0x5')][_0xe497('0x6')]]:_0x3e4f89[_0xe497('0x5')][_0xe497('0x7')]}:undefined;return _0x262ca8[_0x2707b3][_0xe497('0x8')]({'where':_0x3e4168,'raw':!![]})[_0xe497('0x9')](function(_0x11e08d){_0x3e4f89['associatedResources']=_[_0xe497('0xa')](_0x11e08d,'id');_0x2564f8(_0x3e4f89);})[_0xe497('0xb')](function(_0x3f8552){_0x2d81a5(_0x3f8552);});});}function _0x4fc836(_0x552fcf,_0x57ad93){return new Promise(function(_0x2e20bf,_0x31e143){var _0x3b012f=_0x552fcf[_0xe497('0x5')]?{[_0x552fcf['filter'][_0xe497('0x6')]]:_0x552fcf[_0xe497('0x5')][_0xe497('0x7')]}:undefined;return _0x262ca8[_0x552fcf[_0xe497('0xc')]]['findAll']({'where':_0x3b012f,'raw':!![]})[_0xe497('0x9')](function(_0x3ff584){_0x57ad93[_0xe497('0xd')]=_[_0xe497('0xa')](_0x3ff584,function(_0x4a346b){return _0x4a346b['name'];});_0x2e20bf(_0x57ad93);})[_0xe497('0xb')](function(_0x28c349){_0x31e143(_0x28c349);});});}function _0x300b27(_0xa068b9,_0x4e60e9,_0x7f5c60){if(!_0x4e60e9)return Promise[_0xe497('0xe')](null);return new Promise(function(_0x2ccf1c,_0x195c97){return _0x262ca8[_0xe497('0xf')][_0xe497('0x8')]({'where':{'sectionId':_0x4e60e9['id']},'raw':!![]})[_0xe497('0x9')](function(_0xc42fac){if(_0xa068b9['field']&&_0xa068b9['field']!=='id'){_0x4e60e9[_0xe497('0xd')]=_['map'](_0xc42fac,function(_0xd09795){return _0xd09795[_0xa068b9[_0xe497('0x6')]];});}else{if(_0x7f5c60===_0xe497('0x10')){_0x4e60e9['associatedResources']=_[_0xe497('0xa')](_0xc42fac,function(_0x3d894e){return{'id':_0x3d894e[_0xe497('0x11')],'type':_0x3d894e['type']};});}else{_0x4e60e9[_0xe497('0xd')]=_[_0xe497('0xa')](_0xc42fac,function(_0x1c1290){return _0x1c1290[_0xe497('0x11')];});}}_0x2ccf1c(_0x4e60e9);})[_0xe497('0xb')](function(_0x48e61b){_0x195c97(_0x48e61b);});});}function _0x14856f(_0x2cfcb7,_0x1769dc){var _0x23ac60={'parentSections':[]};switch(_0x2cfcb7[_0xe497('0x12')]()){case _0xe497('0x13'):_0x23ac60[_0xe497('0x14')]='SquareProject';break;case'odbc':_0x23ac60[_0xe497('0x14')]='SquareOdbc';break;case _0xe497('0x15'):_0x23ac60['childModel']=_0xe497('0x16');_0x23ac60[_0xe497('0x17')]=[{'name':'SquareProjects','field':'name','foreignKey':_0xe497('0x18')}];break;case _0xe497('0x19'):_0x23ac60[_0xe497('0x14')]=_0xe497('0x1a');break;case _0xe497('0x1b'):_0x23ac60[_0xe497('0x14')]=_0xe497('0x1c');_0x23ac60[_0xe497('0x17')]=[{'name':_0xe497('0x1d'),'field':'id','foreignKey':_0xe497('0x1e')}];break;case _0xe497('0x1f'):_0x23ac60[_0xe497('0x14')]=_0xe497('0x20');break;case _0xe497('0x21'):_0x23ac60[_0xe497('0x14')]=_0xe497('0x22');break;case _0xe497('0x23'):_0x23ac60['childModel']=_0xe497('0x24');break;case'chatqueues':_0x23ac60[_0xe497('0x14')]=_0xe497('0x25');break;case _0xe497('0x26'):_0x23ac60[_0xe497('0x14')]='ChatWebsite';break;case'faxqueues':_0x23ac60[_0xe497('0x14')]=_0xe497('0x27');break;case _0xe497('0x28'):_0x23ac60[_0xe497('0x14')]=_0xe497('0x29');break;case _0xe497('0x2a'):case'internalroutes':case _0xe497('0x2b'):_0x23ac60[_0xe497('0x14')]='VoiceExtension';break;case'contexts':_0x23ac60[_0xe497('0x14')]=_0xe497('0x2c');break;case _0xe497('0x2d'):_0x23ac60[_0xe497('0x14')]=_0xe497('0x2e');break;case _0xe497('0x2f'):_0x23ac60['childModel']=_0xe497('0x30');_0x23ac60[_0xe497('0x17')]=[{'name':'Agents','field':_0xe497('0x31'),'foreignKey':_0xe497('0x32'),'model':_0xe497('0x33'),'filter':{'field':_0xe497('0x34'),'value':[_0xe497('0x35')]}},{'name':_0xe497('0x36'),'field':_0xe497('0x31'),'foreignKey':_0xe497('0x32'),'model':_0xe497('0x33'),'filter':{'field':_0xe497('0x34'),'value':['telephone']}},{'name':_0xe497('0x37'),'field':_0xe497('0x31'),'foreignKey':_0xe497('0x38'),'model':_0xe497('0x39'),'filter':{'field':_0xe497('0x3a'),'value':[_0xe497('0x3b')]}},{'name':_0xe497('0x3c'),'field':_0xe497('0x31'),'foreignKey':_0xe497('0x38'),'model':'VoiceQueue','filter':{'field':_0xe497('0x3a'),'value':[_0xe497('0x3d')]}}];break;case _0xe497('0x3e'):_0x23ac60[_0xe497('0x14')]=_0xe497('0x3f');break;case _0xe497('0x40'):_0x23ac60[_0xe497('0x14')]=_0xe497('0x41');break;case'voiceprefixes':_0x23ac60[_0xe497('0x14')]='VoicePrefix';break;case'ivrcampaigns':_0x23ac60[_0xe497('0x14')]='Campaign';break;case'mailqueues':_0x23ac60[_0xe497('0x14')]='MailQueue';break;case'mailaccounts':_0x23ac60[_0xe497('0x14')]='MailAccount';break;case _0xe497('0x42'):_0x23ac60[_0xe497('0x14')]=_0xe497('0x43');break;case _0xe497('0x44'):_0x23ac60[_0xe497('0x14')]=_0xe497('0x45');break;case _0xe497('0x46'):_0x23ac60[_0xe497('0x14')]=_0xe497('0x47');break;case'smsqueues':_0x23ac60[_0xe497('0x14')]=_0xe497('0x48');break;case _0xe497('0x49'):_0x23ac60[_0xe497('0x14')]=_0xe497('0x4a');break;case'whatsappqueues':_0x23ac60['childModel']=_0xe497('0x4b');break;case _0xe497('0x4c'):_0x23ac60[_0xe497('0x14')]=_0xe497('0x4d');break;case _0xe497('0x4e'):_0x23ac60[_0xe497('0x14')]=_0xe497('0x4f');break;case _0xe497('0x50'):case _0xe497('0x51'):_0x23ac60[_0xe497('0x14')]=_0xe497('0x39');if(_0x1769dc){_0x23ac60['parentSections']=[{'name':'VoiceQueues'},{'name':_0xe497('0x3c')}];}break;case _0xe497('0x52'):case _0xe497('0x53'):case'telephones':_0x23ac60[_0xe497('0x14')]=_0xe497('0x33');if(_0x1769dc){_0x23ac60[_0xe497('0x17')]=[{'name':_0xe497('0x54'),'filter':{'field':_0xe497('0x34'),'value':[_0xe497('0x55'),_0xe497('0x56')]},'ignore':!![]},{'name':_0xe497('0x57')},{'name':_0xe497('0x36')}];}break;case _0xe497('0x58'):_0x23ac60['childModel']='ZendeskAccount';break;case'salesforceaccounts':_0x23ac60[_0xe497('0x14')]=_0xe497('0x59');break;case _0xe497('0x5a'):_0x23ac60[_0xe497('0x14')]=_0xe497('0x5b');break;case _0xe497('0x5c'):_0x23ac60[_0xe497('0x14')]=_0xe497('0x5d');break;case'deskaccounts':_0x23ac60[_0xe497('0x14')]=_0xe497('0x5e');break;case'zohoaccounts':_0x23ac60[_0xe497('0x14')]=_0xe497('0x5f');break;case _0xe497('0x60'):_0x23ac60[_0xe497('0x14')]=_0xe497('0x33');break;case _0xe497('0x61'):_0x23ac60[_0xe497('0x14')]='CannedAnswer';break;case _0xe497('0x62'):_0x23ac60[_0xe497('0x14')]=_0xe497('0x63');break;case _0xe497('0x64'):_0x23ac60[_0xe497('0x14')]='Dashboard';break;case _0xe497('0x65'):_0x23ac60[_0xe497('0x14')]='Interval';break;case _0xe497('0x66'):_0x23ac60['childModel']=_0xe497('0x67');break;case _0xe497('0x68'):_0x23ac60[_0xe497('0x14')]='Schedule';break;case _0xe497('0x69'):_0x23ac60[_0xe497('0x14')]=_0xe497('0x6a');break;case _0xe497('0x6b'):_0x23ac60[_0xe497('0x14')]='Tag';break;case _0xe497('0x6c'):_0x23ac60[_0xe497('0x14')]='Template';break;case'triggers':_0x23ac60[_0xe497('0x14')]=_0xe497('0x6d');break;case _0xe497('0x6e'):_0x23ac60['childModel']=_0xe497('0x6f');break;case _0xe497('0x70'):_0x23ac60['childModel']='Variable';break;case _0xe497('0x71'):_0x23ac60[_0xe497('0x14')]=_0xe497('0x72');break;case _0xe497('0x73'):_0x23ac60['childModel']='AnalyticExtractedReport';_0x23ac60[_0xe497('0x17')]=[{'name':_0xe497('0x74'),'field':'id','foreignKey':_0xe497('0x75')}];break;case _0xe497('0x76'):_0x23ac60[_0xe497('0x14')]=_0xe497('0x77');break;}return _0x23ac60;}function _0x12fa50(_0x223a83,_0x1b302c){var _0x271a4c=_0x223a83[_0xe497('0x78')](0x0)[_0xe497('0x79')]()+_0x223a83[_0xe497('0x7a')](0x1);var _0x5b1c09={'type':_0x262ca8[_0xe497('0x7b')][_0xe497('0x7c')][_0xe497('0x7d')],'raw':!![]};return new Promise(function(_0x2670a0,_0x46df30){var _0x1fb682=squel[_0xe497('0x7e')]()[_0xe497('0x6')](_0xe497('0x7f')+_0x271a4c+'InteractionId','id')[_0xe497('0x6')](_0xe497('0x80'))[_0xe497('0x81')](_0xe497('0x82')+_0x223a83+_0xe497('0x83'),'ui')[_0xe497('0x84')](_0xe497('0x85'),_0x1b302c['id']);return _0x262ca8[_0xe497('0x86')]['query'](_0x1fb682[_0xe497('0x87')](),_0x5b1c09)['then'](function(_0x526e0f){_0x1b302c[_0x271a4c+_0xe497('0x88')]=_0x526e0f;_0x2670a0(_0x526e0f);})[_0xe497('0xb')](function(_0xf4b87e){_0x46df30(_0xf4b87e);});});}return _0xb79d3c['define']('UserProfile',attributes,{'tableName':_0xe497('0x89'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1642e6){var _0x263727={'raw':_0x1642e6[_0xe497('0x8a')][_0xe497('0x8b')],'where':{}};var _0x33679b={};var _0x76697c={'count':0x0,'rows':[]};var _0xd38187=_0x1642e6[_0xe497('0x8a')][_0xe497('0x8c')];var _0x393302=_0x1642e6['query'][_0xe497('0x8d')]||![];var _0xa56cfe=_0x14856f(_0xd38187,_0x393302);if(!_0xa56cfe['childModel'])throw new Error(_0xe497('0x8e')+_0xd38187+'\x27');var _0x5c3a73=[{'name':_0xd38187}];if(!_['isEmpty'](_0xa56cfe[_0xe497('0x17')]))_0x5c3a73=_0xa56cfe['parentSections'];var _0x84fd8a=[];for(var _0x596475=0x0;_0x596475<_0x5c3a73[_0xe497('0x8f')];_0x596475++){_0x84fd8a['push'](_0x262ca8[_0xe497('0x90')][_0xe497('0x91')]({'where':{'userProfileId':_0x1642e6[_0xe497('0x92')]['id'],'name':_0x5c3a73[_0x596475]['name']},'raw':!![]}));}return Promise[_0xe497('0x93')](_0x84fd8a)['then'](function(_0x2363d9){var _0x13de7f=_[_0xe497('0x5')](_0x2363d9,function(_0x594466){return _0x594466?_0x594466:undefined;});var _0x16cdc5=_['filter'](_0x5c3a73,[_0xe497('0x94'),!![]]);var _0x7c29e0=_[_0xe497('0x95')](_0x13de7f)&&_[_0xe497('0x95')](_0x16cdc5)?null:_[_0xe497('0x96')](_0x16cdc5,_0x13de7f);if(!_0x7c29e0)return null;var _0x532f5b=[];for(var _0x22790c=0x0;_0x22790c<_0x7c29e0[_0xe497('0x8f')];_0x22790c++){var _0x3f1058=_[_0xe497('0x91')](_0x5c3a73,function(_0x1b8da0){return _0x7c29e0[_0x22790c]?_0x1b8da0[_0xe497('0x31')]===_0x7c29e0[_0x22790c][_0xe497('0x31')]:null;});if(_0x3f1058){if(_0x7c29e0[_0x22790c][_0xe497('0x94')]){_0x532f5b[_0xe497('0x97')](_0x573caa(_0xa56cfe[_0xe497('0x14')],_0x7c29e0[_0x22790c]));}else{if(!_0x7c29e0[_0x22790c]['autoAssociation']){_0x532f5b['push'](_0x300b27(_0x3f1058,_0x7c29e0[_0x22790c],_0xa56cfe[_0xe497('0x14')]));}else{if(_0x3f1058[_0xe497('0xc')]){_0x532f5b[_0xe497('0x97')](_0x4fc836(_0x3f1058,_0x7c29e0[_0x22790c]));}}}}}return Promise['all'](_0x532f5b);})[_0xe497('0x9')](function(_0x5a7222){var _0x3d4a87=_0x5a7222;var _0x317ebe=null;if(_0x3d4a87){_0x317ebe=_0x3d4a87[_0xe497('0x8f')]===0x1?_0x3d4a87[0x0]:null;}if(!_0x317ebe&&!_0x3d4a87)return _0x76697c;var _0x447084=_0x262ca8[_0xa56cfe[_0xe497('0x14')]]['rawAttributes'];_0x33679b['model']=_[_0xe497('0x98')](_0x447084);_0x33679b[_0xe497('0x8a')]=_[_0xe497('0x98')](_0x1642e6[_0xe497('0x8a')]);_0x33679b[_0xe497('0x99')]=_['intersection'](_0x33679b['model'],_0x33679b[_0xe497('0x8a')]);_0x263727['attributes']=_[_0xe497('0x9a')](_0x33679b['model'],qs[_0xe497('0x9b')](_0x1642e6[_0xe497('0x8a')][_0xe497('0x9b')]));_0x263727['attributes']=_0x263727['attributes'][_0xe497('0x8f')]?_0x263727['attributes']:_0x33679b[_0xe497('0xc')];if(!_0x1642e6[_0xe497('0x8a')]['hasOwnProperty'](_0xe497('0x9c'))){_0x263727[_0xe497('0x9d')]=qs[_0xe497('0x9d')](_0x1642e6['query'][_0xe497('0x9d')]);_0x263727[_0xe497('0x9e')]=qs['offset'](_0x1642e6[_0xe497('0x8a')]['offset']);}_0x263727[_0xe497('0x9f')]=qs[_0xe497('0xa0')](_0x1642e6[_0xe497('0x8a')][_0xe497('0xa0')]);_0x263727[_0xe497('0x84')]=qs[_0xe497('0x99')](_[_0xe497('0xa1')](_0x1642e6['query'],_0x33679b[_0xe497('0x99')]));if(_0x1642e6['query'][_0xe497('0x5')]){_0x263727[_0xe497('0x84')]=_[_0xe497('0xa2')](_0x263727['where'],{'$or':_[_0xe497('0xa')](_0x447084,function(_0x24b99f){if(_0x24b99f['type']['key']!==_0xe497('0xa3')){var _0x1aca5c={};_0x1aca5c[_0x24b99f[_0xe497('0x6')]]={'$like':'%'+_0x1642e6[_0xe497('0x8a')][_0xe497('0x5')]+'%'};return _0x1aca5c;}})});}var _0x380207=[];var _0xc3ee76=null;var _0x40ca12={};if(_0x317ebe){_0xc3ee76=_[_0xe497('0x91')](_0x5c3a73,[_0xe497('0x31'),_0x317ebe[_0xe497('0x31')]]);if(_0xc3ee76[_0xe497('0x6')]){_0x40ca12={};if(_0xa56cfe[_0xe497('0x14')]===_0xe497('0x10')){_0x40ca12[_0xc3ee76[_0xe497('0xa4')]]=_[_0xe497('0xa')](_0x317ebe[_0xe497('0xd')],'id');}else{_0x40ca12[_0xc3ee76[_0xe497('0xa4')]]=_0x317ebe[_0xe497('0xd')];}_0x380207[_0xe497('0x97')](_0x40ca12);}else{_0x263727[_0xe497('0x84')]['id']=_0x317ebe[_0xe497('0xd')];}}else{for(var _0x1d0b9c=0x0;_0x1d0b9c<_0x3d4a87['length'];_0x1d0b9c++){_0xc3ee76=_[_0xe497('0x91')](_0x5c3a73,[_0xe497('0x31'),_0x3d4a87[_0x1d0b9c][_0xe497('0x31')]]);if(_0xc3ee76[_0xe497('0x6')]){_0x40ca12={};_0x40ca12[_0xc3ee76[_0xe497('0xa4')]]=_0x3d4a87[_0x1d0b9c]['associatedResources'];_0x380207[_0xe497('0x97')](_0x40ca12);}else{if(!_0x263727[_0xe497('0x84')]['id'])_0x263727['where']['id']=[];_0x3d4a87[_0x1d0b9c]['associatedResources'][_0xe497('0xa5')](function(_0xe627eb){_0x263727['where']['id'][_0xe497('0x97')](_0xe627eb);});}}}if(!_[_0xe497('0x95')](_0x380207)){_0x263727[_0xe497('0x84')]=_[_0xe497('0xa2')](_0x263727['where'],{'$and':{'$or':_0x380207}});}_0x263727=_[_0xe497('0xa2')]({},_0x263727,_0x1642e6[_0xe497('0xa6')]);if(_0x317ebe&&!_0x317ebe[_0xe497('0xa7')]&&_0xa56cfe[_0xe497('0x14')]===_0xe497('0x10')){if(_0x1642e6[_0xe497('0x8a')][_0xe497('0xa8')]){_0x263727[_0xe497('0xa9')]=[{'all':!![]}];}return _0x262ca8[_0xa56cfe['childModel']][_0xe497('0x8')](_0x263727)['then'](function(_0x35ceda){var _0x4634ef=[];_0x35ceda[_0xe497('0xa5')](function(_0x3664a8){var _0xf9cab8;switch(_0x3664a8[_0xe497('0xaa')]){case _0xe497('0xab'):_0xf9cab8=_[_0xe497('0x91')](_0x317ebe[_0xe497('0xd')],function(_0xc877b6){return _0xc877b6['id']===_0x3664a8[_0xe497('0x75')]&&_0xc877b6[_0xe497('0x3a')]===_0xe497('0xac');});break;case'custom':_0xf9cab8=_[_0xe497('0x91')](_0x317ebe['associatedResources'],function(_0x1558d6){return _0x1558d6['id']===_0x3664a8[_0xe497('0x75')]&&_0x1558d6[_0xe497('0x3a')]===_0xe497('0xad');});break;}if(_0xf9cab8)_0x4634ef[_0xe497('0x97')](_0x3664a8);});_0x76697c[_0xe497('0xae')]=_0x4634ef[_0xe497('0x8f')];_0x76697c[_0xe497('0xaf')]=_0x4634ef;return _0x76697c;});}else{if(!_[_0xe497('0x95')](_0x1642e6[_0xe497('0x8a')][_0xe497('0xb0')])){_0x263727[_0xe497('0x84')]['id']=_0x263727[_0xe497('0x84')]['id']?_[_0xe497('0x9a')](_0x263727['where']['id'],_0x1642e6[_0xe497('0x8a')][_0xe497('0xb0')]):_0x1642e6[_0xe497('0x8a')]['ids'];if(_0x1642e6[_0xe497('0x8a')]['customSorting']){_0x263727[_0xe497('0x9f')]=_0x1642e6['query'][_0xe497('0xb1')];}}if(_0x1642e6['query'][_0xe497('0xb2')]){_0x263727[_0xe497('0x84')]=_[_0xe497('0xa2')](_0x263727['where'],{'$and':_0x1642e6['query']['extraQueryConditions']});}return _0x262ca8[_0xa56cfe[_0xe497('0x14')]][_0xe497('0xae')]({'where':_0x263727['where']})[_0xe497('0x9')](function(_0x432e5b){_0x76697c['count']=_0x432e5b;if(_0x1642e6[_0xe497('0x8a')][_0xe497('0xa8')]){if(_0xa56cfe[_0xe497('0x14')]===_0xe497('0x1c')){_0x263727[_0xe497('0xa9')]=[{'model':_0x262ca8['Tag'],'as':'Tags','attributes':['id',_0xe497('0x31'),_0xe497('0xb3')],'required':_0x1642e6[_0xe497('0x8a')][_0xe497('0xb4')]?!![]:![]},{'model':_0x262ca8['Tag'],'as':_0xe497('0xb5'),'attributes':['id','name',_0xe497('0xb3')],'through':_0x1642e6[_0xe497('0x8a')][_0xe497('0xb4')]?{'attributes':[],'where':{'TagId':_0x1642e6['query'][_0xe497('0xb4')]||undefined}}:{},'required':_0x1642e6[_0xe497('0x8a')][_0xe497('0xb4')]?!![]:![]}];}else{_0x263727['include']=[{'all':!![]}];}}return _0x262ca8[_0xa56cfe[_0xe497('0x14')]][_0xe497('0x8')](_0x263727);})[_0xe497('0x9')](function(_0x2b8c53){_0x76697c[_0xe497('0xaf')]=_0x2b8c53;if(_0xd38187===_0xe497('0x57')&&_0x1642e6['query']['openTabs']===_0xe497('0xb6')){var _0xf4e7a9=[];for(var _0x1402f0=0x0;_0x1402f0<_0x76697c[_0xe497('0xaf')][_0xe497('0x8f')];_0x1402f0++){_0xf4e7a9[_0xe497('0x97')](_0x12fa50(_0xe497('0xb7'),_0x76697c[_0xe497('0xaf')][_0x1402f0]['dataValues']));_0xf4e7a9[_0xe497('0x97')](_0x12fa50(_0xe497('0xb8'),_0x76697c['rows'][_0x1402f0][_0xe497('0xb9')]));_0xf4e7a9['push'](_0x12fa50(_0xe497('0xba'),_0x76697c[_0xe497('0xaf')][_0x1402f0][_0xe497('0xb9')]));_0xf4e7a9[_0xe497('0x97')](_0x12fa50(_0xe497('0xbb'),_0x76697c[_0xe497('0xaf')][_0x1402f0][_0xe497('0xb9')]));_0xf4e7a9[_0xe497('0x97')](_0x12fa50(_0xe497('0xbc'),_0x76697c['rows'][_0x1402f0][_0xe497('0xb9')]));_0xf4e7a9[_0xe497('0x97')](_0x12fa50(_0xe497('0xbd'),_0x76697c[_0xe497('0xaf')][_0x1402f0][_0xe497('0xb9')]));}return Promise[_0xe497('0x93')](_0xf4e7a9)[_0xe497('0x9')](function(){return _0x76697c;});}return _0x76697c;});}});}}});}; \ No newline at end of file +var _0x20a1=['teams','queuecampaigns','QueueCampaigns','users','telephones','Users','admin','user','Agents','zendeskaccounts','salesforceaccounts','SalesforceAccount','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses','Pause','scheduler','Schedule','sounds','Tag','templates','triggers','trunks','Trunk','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','toUpperCase','slice','QueryTypes','SELECT','select','ui.','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','define','UserProfile','user_profiles','isEmpty','UserProfileSection','find','params','ignore','push','autoAssociation','all','length','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','key','VIRTUAL','foreignKey','forEach','merge','options','includeAll','include','default','DefaultReports','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','openTabs','true','chat','dataValues','sms','lodash','./userProfile.attributes','exports','models','filter','field','findAll','then','map','catch','value','model','associatedResources','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','childModel','SquareProject','odbc','squarerecordings','SquareRecording','SquareProjects','name','projectName','projects','JscriptyProject','CmContact','parentSections','Lists','ListId','lists','CmList','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','VoiceRecording','membername','User','role','Telephones','queue','VoiceQueue','inbound','type','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','Campaign','mailqueues','mailaccounts','MailSubstatus','openchannelqueues','OpenchannelAccount','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts'];(function(_0x58bf43,_0x3125eb){var _0x2b46a1=function(_0x4ce259){while(--_0x4ce259){_0x58bf43['push'](_0x58bf43['shift']());}};_0x2b46a1(++_0x3125eb);}(_0x20a1,0x121));var _0x120a=function(_0x8022b4,_0x1763b4){_0x8022b4=_0x8022b4-0x0;var _0x26dbaa=_0x20a1[_0x8022b4];return _0x26dbaa;};'use strict';var _=require(_0x120a('0x0'));var attributes=require(_0x120a('0x1'));var qs=require('../../components/parsers/qs');var squel=require('squel');module[_0x120a('0x2')]=function(_0x1c9cc6){var _0x5e5360=_0x1c9cc6[_0x120a('0x3')];function _0x189e8c(_0x25c68e,_0x562725){return new Promise(function(_0x31a6cd,_0x2b17bf){if(!_0x562725)return _0x31a6cd(null);var _0xe9c205=_0x562725[_0x120a('0x4')]?{[_0x562725[_0x120a('0x4')][_0x120a('0x5')]]:_0x562725[_0x120a('0x4')]['value']}:undefined;return _0x5e5360[_0x25c68e][_0x120a('0x6')]({'where':_0xe9c205,'raw':!![]})[_0x120a('0x7')](function(_0x6b10c8){_0x562725['associatedResources']=_[_0x120a('0x8')](_0x6b10c8,'id');_0x31a6cd(_0x562725);})[_0x120a('0x9')](function(_0x551fe4){_0x2b17bf(_0x551fe4);});});}function _0x4edfcd(_0x3ab67a,_0x354c4e){return new Promise(function(_0x427a5f,_0x50ccc1){var _0x401da8=_0x3ab67a[_0x120a('0x4')]?{[_0x3ab67a[_0x120a('0x4')][_0x120a('0x5')]]:_0x3ab67a[_0x120a('0x4')][_0x120a('0xa')]}:undefined;return _0x5e5360[_0x3ab67a[_0x120a('0xb')]][_0x120a('0x6')]({'where':_0x401da8,'raw':!![]})[_0x120a('0x7')](function(_0xa5261a){_0x354c4e[_0x120a('0xc')]=_[_0x120a('0x8')](_0xa5261a,function(_0x2e2d63){return _0x2e2d63['name'];});_0x427a5f(_0x354c4e);})[_0x120a('0x9')](function(_0x26bbdf){_0x50ccc1(_0x26bbdf);});});}function _0x6e6f5b(_0x13b7f1,_0x5392cb,_0x6dc3bf){if(!_0x5392cb)return Promise[_0x120a('0xd')](null);return new Promise(function(_0x53670c,_0x449a3d){return _0x5e5360[_0x120a('0xe')][_0x120a('0x6')]({'where':{'sectionId':_0x5392cb['id']},'raw':!![]})['then'](function(_0x510a27){if(_0x13b7f1[_0x120a('0x5')]&&_0x13b7f1['field']!=='id'){_0x5392cb[_0x120a('0xc')]=_[_0x120a('0x8')](_0x510a27,function(_0x5c1d8b){return _0x5c1d8b[_0x13b7f1[_0x120a('0x5')]];});}else{if(_0x6dc3bf===_0x120a('0xf')){_0x5392cb[_0x120a('0xc')]=_[_0x120a('0x8')](_0x510a27,function(_0xf8495d){return{'id':_0xf8495d[_0x120a('0x10')],'type':_0xf8495d['type']};});}else{_0x5392cb[_0x120a('0xc')]=_[_0x120a('0x8')](_0x510a27,function(_0x36b48f){return _0x36b48f[_0x120a('0x10')];});}}_0x53670c(_0x5392cb);})[_0x120a('0x9')](function(_0x42e28a){_0x449a3d(_0x42e28a);});});}function _0x111d75(_0x2b3242,_0x16a35b){var _0x1ded4c={'parentSections':[]};switch(_0x2b3242[_0x120a('0x11')]()){case'squareprojects':_0x1ded4c[_0x120a('0x12')]=_0x120a('0x13');break;case _0x120a('0x14'):_0x1ded4c[_0x120a('0x12')]='SquareOdbc';break;case _0x120a('0x15'):_0x1ded4c['childModel']=_0x120a('0x16');_0x1ded4c['parentSections']=[{'name':_0x120a('0x17'),'field':_0x120a('0x18'),'foreignKey':_0x120a('0x19')}];break;case _0x120a('0x1a'):_0x1ded4c[_0x120a('0x12')]=_0x120a('0x1b');break;case'contacts':_0x1ded4c[_0x120a('0x12')]=_0x120a('0x1c');_0x1ded4c[_0x120a('0x1d')]=[{'name':_0x120a('0x1e'),'field':'id','foreignKey':_0x120a('0x1f')}];break;case _0x120a('0x20'):_0x1ded4c[_0x120a('0x12')]=_0x120a('0x21');break;case _0x120a('0x22'):_0x1ded4c[_0x120a('0x12')]='CmCompany';break;case _0x120a('0x23'):_0x1ded4c[_0x120a('0x12')]=_0x120a('0x24');break;case _0x120a('0x25'):_0x1ded4c['childModel']=_0x120a('0x26');break;case _0x120a('0x27'):_0x1ded4c['childModel']=_0x120a('0x28');break;case _0x120a('0x29'):_0x1ded4c[_0x120a('0x12')]='FaxQueue';break;case _0x120a('0x2a'):_0x1ded4c[_0x120a('0x12')]=_0x120a('0x2b');break;case _0x120a('0x2c'):case _0x120a('0x2d'):case'outboundroutes':_0x1ded4c[_0x120a('0x12')]=_0x120a('0x2e');break;case _0x120a('0x2f'):_0x1ded4c[_0x120a('0x12')]=_0x120a('0x30');break;case'voicemails':_0x1ded4c[_0x120a('0x12')]=_0x120a('0x31');break;case'voicerecordings':_0x1ded4c[_0x120a('0x12')]=_0x120a('0x32');_0x1ded4c[_0x120a('0x1d')]=[{'name':'Agents','field':'name','foreignKey':_0x120a('0x33'),'model':_0x120a('0x34'),'filter':{'field':_0x120a('0x35'),'value':['agent']}},{'name':_0x120a('0x36'),'field':'name','foreignKey':_0x120a('0x33'),'model':_0x120a('0x34'),'filter':{'field':_0x120a('0x35'),'value':['telephone']}},{'name':'VoiceQueues','field':_0x120a('0x18'),'foreignKey':_0x120a('0x37'),'model':_0x120a('0x38'),'filter':{'field':'type','value':[_0x120a('0x39')]}},{'name':'QueueCampaigns','field':'name','foreignKey':_0x120a('0x37'),'model':'VoiceQueue','filter':{'field':_0x120a('0x3a'),'value':['outbound']}}];break;case _0x120a('0x3b'):_0x1ded4c[_0x120a('0x12')]=_0x120a('0x3c');break;case _0x120a('0x3d'):_0x1ded4c['childModel']=_0x120a('0x3e');break;case _0x120a('0x3f'):_0x1ded4c[_0x120a('0x12')]='VoicePrefix';break;case'ivrcampaigns':_0x1ded4c[_0x120a('0x12')]=_0x120a('0x40');break;case _0x120a('0x41'):_0x1ded4c[_0x120a('0x12')]='MailQueue';break;case _0x120a('0x42'):_0x1ded4c[_0x120a('0x12')]='MailAccount';break;case'mailsubstatuses':_0x1ded4c[_0x120a('0x12')]=_0x120a('0x43');break;case _0x120a('0x44'):_0x1ded4c[_0x120a('0x12')]='OpenchannelQueue';break;case'openchannelaccounts':_0x1ded4c['childModel']=_0x120a('0x45');break;case'smsqueues':_0x1ded4c[_0x120a('0x12')]=_0x120a('0x46');break;case _0x120a('0x47'):_0x1ded4c['childModel']='SmsAccount';break;case _0x120a('0x48'):_0x1ded4c[_0x120a('0x12')]=_0x120a('0x49');break;case _0x120a('0x4a'):_0x1ded4c[_0x120a('0x12')]='WhatsappAccount';break;case _0x120a('0x4b'):_0x1ded4c[_0x120a('0x12')]='Team';break;case'voicequeues':case _0x120a('0x4c'):_0x1ded4c[_0x120a('0x12')]=_0x120a('0x38');if(_0x16a35b){_0x1ded4c[_0x120a('0x1d')]=[{'name':'VoiceQueues'},{'name':_0x120a('0x4d')}];}break;case _0x120a('0x4e'):case'agents':case _0x120a('0x4f'):_0x1ded4c['childModel']=_0x120a('0x34');if(_0x16a35b){_0x1ded4c['parentSections']=[{'name':_0x120a('0x50'),'filter':{'field':_0x120a('0x35'),'value':[_0x120a('0x51'),_0x120a('0x52')]},'ignore':!![]},{'name':_0x120a('0x53')},{'name':_0x120a('0x36')}];}break;case _0x120a('0x54'):_0x1ded4c[_0x120a('0x12')]='ZendeskAccount';break;case _0x120a('0x55'):_0x1ded4c[_0x120a('0x12')]=_0x120a('0x56');break;case'freshdeskaccounts':_0x1ded4c[_0x120a('0x12')]=_0x120a('0x57');break;case'sugarcrmaccounts':_0x1ded4c[_0x120a('0x12')]=_0x120a('0x58');break;case _0x120a('0x59'):_0x1ded4c[_0x120a('0x12')]=_0x120a('0x5a');break;case _0x120a('0x5b'):_0x1ded4c[_0x120a('0x12')]=_0x120a('0x5c');break;case _0x120a('0x5d'):_0x1ded4c[_0x120a('0x12')]=_0x120a('0x34');break;case _0x120a('0x5e'):_0x1ded4c[_0x120a('0x12')]='CannedAnswer';break;case _0x120a('0x5f'):_0x1ded4c[_0x120a('0x12')]=_0x120a('0x60');break;case _0x120a('0x61'):_0x1ded4c['childModel']=_0x120a('0x62');break;case'intervals':_0x1ded4c[_0x120a('0x12')]=_0x120a('0x63');break;case _0x120a('0x64'):_0x1ded4c[_0x120a('0x12')]=_0x120a('0x65');break;case _0x120a('0x66'):_0x1ded4c[_0x120a('0x12')]=_0x120a('0x67');break;case _0x120a('0x68'):_0x1ded4c[_0x120a('0x12')]='Sound';break;case'tags':_0x1ded4c[_0x120a('0x12')]=_0x120a('0x69');break;case _0x120a('0x6a'):_0x1ded4c['childModel']='Template';break;case _0x120a('0x6b'):_0x1ded4c['childModel']='Trigger';break;case _0x120a('0x6c'):_0x1ded4c[_0x120a('0x12')]=_0x120a('0x6d');break;case'variables':_0x1ded4c[_0x120a('0x12')]=_0x120a('0x6e');break;case _0x120a('0x6f'):_0x1ded4c['childModel']=_0x120a('0x70');break;case _0x120a('0x71'):_0x1ded4c[_0x120a('0x12')]=_0x120a('0xf');_0x1ded4c[_0x120a('0x1d')]=[{'name':_0x120a('0x72'),'field':'id','foreignKey':_0x120a('0x73')}];break;case _0x120a('0x74'):_0x1ded4c[_0x120a('0x12')]=_0x120a('0x75');break;}return _0x1ded4c;}function _0x25a6b2(_0x1b8bc1,_0x366380){var _0x47b3b9=_0x1b8bc1['charAt'](0x0)[_0x120a('0x76')]()+_0x1b8bc1[_0x120a('0x77')](0x1);var _0x254a46={'type':_0x5e5360['Sequelize'][_0x120a('0x78')][_0x120a('0x79')],'raw':!![]};return new Promise(function(_0x56dce0,_0x442cd0){var _0x5227d8=squel[_0x120a('0x7a')]()[_0x120a('0x5')](_0x120a('0x7b')+_0x47b3b9+'InteractionId','id')[_0x120a('0x5')](_0x120a('0x7c'))[_0x120a('0x7d')](_0x120a('0x7e')+_0x1b8bc1+_0x120a('0x7f'),'ui')[_0x120a('0x80')](_0x120a('0x81'),_0x366380['id']);return _0x5e5360[_0x120a('0x82')][_0x120a('0x83')](_0x5227d8[_0x120a('0x84')](),_0x254a46)[_0x120a('0x7')](function(_0x479a37){_0x366380[_0x47b3b9+'OpenTabs']=_0x479a37;_0x56dce0(_0x479a37);})[_0x120a('0x9')](function(_0x2ba694){_0x442cd0(_0x2ba694);});});}return _0x1c9cc6[_0x120a('0x85')](_0x120a('0x86'),attributes,{'tableName':_0x120a('0x87'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1ff9e2){var _0x392402={'raw':_0x1ff9e2[_0x120a('0x83')]['raw'],'where':{}};var _0x5af07d={};var _0x3fe4ad={'count':0x0,'rows':[]};var _0xdb68=_0x1ff9e2[_0x120a('0x83')]['section'];var _0x42c1e6=_0x1ff9e2[_0x120a('0x83')]['mergeResources']||![];var _0x91895=_0x111d75(_0xdb68,_0x42c1e6);if(!_0x91895[_0x120a('0x12')])throw new Error('Invalid\x20section\x20\x27'+_0xdb68+'\x27');var _0x31a5bd=[{'name':_0xdb68}];if(!_[_0x120a('0x88')](_0x91895[_0x120a('0x1d')]))_0x31a5bd=_0x91895['parentSections'];var _0x20b038=[];for(var _0x391c2a=0x0;_0x391c2a<_0x31a5bd['length'];_0x391c2a++){_0x20b038['push'](_0x5e5360[_0x120a('0x89')][_0x120a('0x8a')]({'where':{'userProfileId':_0x1ff9e2[_0x120a('0x8b')]['id'],'name':_0x31a5bd[_0x391c2a][_0x120a('0x18')]},'raw':!![]}));}return Promise['all'](_0x20b038)['then'](function(_0xc07a29){var _0x1c0fea=_[_0x120a('0x4')](_0xc07a29,function(_0x42261d){return _0x42261d?_0x42261d:undefined;});var _0x50fe42=_[_0x120a('0x4')](_0x31a5bd,[_0x120a('0x8c'),!![]]);var _0x2592ec=_['isEmpty'](_0x1c0fea)&&_['isEmpty'](_0x50fe42)?null:_['union'](_0x50fe42,_0x1c0fea);if(!_0x2592ec)return null;var _0x39a826=[];for(var _0x3fa700=0x0;_0x3fa700<_0x2592ec['length'];_0x3fa700++){var _0x72a3a8=_[_0x120a('0x8a')](_0x31a5bd,function(_0x5c3cce){return _0x2592ec[_0x3fa700]?_0x5c3cce['name']===_0x2592ec[_0x3fa700][_0x120a('0x18')]:null;});if(_0x72a3a8){if(_0x2592ec[_0x3fa700]['ignore']){_0x39a826[_0x120a('0x8d')](_0x189e8c(_0x91895['childModel'],_0x2592ec[_0x3fa700]));}else{if(!_0x2592ec[_0x3fa700][_0x120a('0x8e')]){_0x39a826['push'](_0x6e6f5b(_0x72a3a8,_0x2592ec[_0x3fa700],_0x91895['childModel']));}else{if(_0x72a3a8[_0x120a('0xb')]){_0x39a826[_0x120a('0x8d')](_0x4edfcd(_0x72a3a8,_0x2592ec[_0x3fa700]));}}}}}return Promise[_0x120a('0x8f')](_0x39a826);})['then'](function(_0x2e2973){var _0x1b6fc0=_0x2e2973;var _0xf979a8=null;if(_0x1b6fc0){_0xf979a8=_0x1b6fc0[_0x120a('0x90')]===0x1?_0x1b6fc0[0x0]:null;}if(!_0xf979a8&&!_0x1b6fc0)return _0x3fe4ad;var _0xa838f1=_0x5e5360[_0x91895['childModel']][_0x120a('0x91')];_0x5af07d[_0x120a('0xb')]=_[_0x120a('0x92')](_0xa838f1);_0x5af07d['query']=_[_0x120a('0x92')](_0x1ff9e2[_0x120a('0x83')]);_0x5af07d[_0x120a('0x93')]=_[_0x120a('0x94')](_0x5af07d[_0x120a('0xb')],_0x5af07d['query']);_0x392402['attributes']=_[_0x120a('0x94')](_0x5af07d[_0x120a('0xb')],qs['fields'](_0x1ff9e2[_0x120a('0x83')][_0x120a('0x95')]));_0x392402[_0x120a('0x96')]=_0x392402[_0x120a('0x96')]['length']?_0x392402[_0x120a('0x96')]:_0x5af07d[_0x120a('0xb')];if(!_0x1ff9e2[_0x120a('0x83')][_0x120a('0x97')](_0x120a('0x98'))){_0x392402[_0x120a('0x99')]=qs['limit'](_0x1ff9e2['query'][_0x120a('0x99')]);_0x392402[_0x120a('0x9a')]=qs[_0x120a('0x9a')](_0x1ff9e2[_0x120a('0x83')]['offset']);}_0x392402[_0x120a('0x9b')]=qs['sort'](_0x1ff9e2[_0x120a('0x83')][_0x120a('0x9c')]);_0x392402[_0x120a('0x80')]=qs[_0x120a('0x93')](_[_0x120a('0x9d')](_0x1ff9e2[_0x120a('0x83')],_0x5af07d[_0x120a('0x93')]));if(_0x1ff9e2['query'][_0x120a('0x4')]){_0x392402[_0x120a('0x80')]=_['merge'](_0x392402['where'],{'$or':_[_0x120a('0x8')](_0xa838f1,function(_0x11823e){if(_0x11823e['type'][_0x120a('0x9e')]!==_0x120a('0x9f')){var _0xe1b918={};_0xe1b918[_0x11823e[_0x120a('0x5')]]={'$like':'%'+_0x1ff9e2[_0x120a('0x83')][_0x120a('0x4')]+'%'};return _0xe1b918;}})});}var _0x28a591=[];var _0x3aca45=null;var _0x54c288={};if(_0xf979a8){_0x3aca45=_[_0x120a('0x8a')](_0x31a5bd,[_0x120a('0x18'),_0xf979a8['name']]);if(_0x3aca45['field']){_0x54c288={};if(_0x91895[_0x120a('0x12')]==='AnalyticExtractedReport'){_0x54c288[_0x3aca45[_0x120a('0xa0')]]=_[_0x120a('0x8')](_0xf979a8[_0x120a('0xc')],'id');}else{_0x54c288[_0x3aca45[_0x120a('0xa0')]]=_0xf979a8[_0x120a('0xc')];}_0x28a591[_0x120a('0x8d')](_0x54c288);}else{_0x392402[_0x120a('0x80')]['id']=_0xf979a8['associatedResources'];}}else{for(var _0x50deb0=0x0;_0x50deb0<_0x1b6fc0[_0x120a('0x90')];_0x50deb0++){_0x3aca45=_[_0x120a('0x8a')](_0x31a5bd,[_0x120a('0x18'),_0x1b6fc0[_0x50deb0]['name']]);if(_0x3aca45[_0x120a('0x5')]){_0x54c288={};_0x54c288[_0x3aca45[_0x120a('0xa0')]]=_0x1b6fc0[_0x50deb0][_0x120a('0xc')];_0x28a591[_0x120a('0x8d')](_0x54c288);}else{if(!_0x392402[_0x120a('0x80')]['id'])_0x392402[_0x120a('0x80')]['id']=[];_0x1b6fc0[_0x50deb0][_0x120a('0xc')][_0x120a('0xa1')](function(_0x254184){_0x392402[_0x120a('0x80')]['id'][_0x120a('0x8d')](_0x254184);});}}}if(!_[_0x120a('0x88')](_0x28a591)){_0x392402['where']=_[_0x120a('0xa2')](_0x392402[_0x120a('0x80')],{'$and':{'$or':_0x28a591}});}_0x392402=_[_0x120a('0xa2')]({},_0x392402,_0x1ff9e2[_0x120a('0xa3')]);if(_0xf979a8&&!_0xf979a8[_0x120a('0x8e')]&&_0x91895[_0x120a('0x12')]===_0x120a('0xf')){if(_0x1ff9e2[_0x120a('0x83')][_0x120a('0xa4')]){_0x392402[_0x120a('0xa5')]=[{'all':!![]}];}return _0x5e5360[_0x91895[_0x120a('0x12')]][_0x120a('0x6')](_0x392402)[_0x120a('0x7')](function(_0x521a43){var _0x43875f=[];_0x521a43[_0x120a('0xa1')](function(_0x320c54){var _0xdc1aab;switch(_0x320c54['reportType']){case _0x120a('0xa6'):_0xdc1aab=_['find'](_0xf979a8[_0x120a('0xc')],function(_0x191875){return _0x191875['id']===_0x320c54[_0x120a('0x73')]&&_0x191875[_0x120a('0x3a')]===_0x120a('0xa7');});break;case'custom':_0xdc1aab=_[_0x120a('0x8a')](_0xf979a8[_0x120a('0xc')],function(_0x1972ed){return _0x1972ed['id']===_0x320c54['reportId']&&_0x1972ed[_0x120a('0x3a')]===_0x120a('0xa8');});break;}if(_0xdc1aab)_0x43875f[_0x120a('0x8d')](_0x320c54);});_0x3fe4ad[_0x120a('0xa9')]=_0x43875f[_0x120a('0x90')];_0x3fe4ad[_0x120a('0xaa')]=_0x43875f;return _0x3fe4ad;});}else{if(!_[_0x120a('0x88')](_0x1ff9e2[_0x120a('0x83')][_0x120a('0xab')])){_0x392402[_0x120a('0x80')]['id']=_0x392402['where']['id']?_[_0x120a('0x94')](_0x392402[_0x120a('0x80')]['id'],_0x1ff9e2['query'][_0x120a('0xab')]):_0x1ff9e2[_0x120a('0x83')][_0x120a('0xab')];if(_0x1ff9e2[_0x120a('0x83')][_0x120a('0xac')]){_0x392402[_0x120a('0x9b')]=_0x1ff9e2['query']['customSorting'];}}if(_0x1ff9e2[_0x120a('0x83')][_0x120a('0xad')]){_0x392402[_0x120a('0x80')]=_[_0x120a('0xa2')](_0x392402[_0x120a('0x80')],{'$and':_0x1ff9e2[_0x120a('0x83')][_0x120a('0xad')]});}return _0x5e5360[_0x91895['childModel']][_0x120a('0xa9')]({'where':_0x392402[_0x120a('0x80')]})['then'](function(_0x1888e0){_0x3fe4ad['count']=_0x1888e0;if(_0x1ff9e2[_0x120a('0x83')][_0x120a('0xa4')]){if(_0x91895[_0x120a('0x12')]===_0x120a('0x1c')){_0x392402['include']=[{'model':_0x5e5360[_0x120a('0x69')],'as':_0x120a('0xae'),'attributes':['id',_0x120a('0x18'),_0x120a('0xaf')],'required':_0x1ff9e2['query'][_0x120a('0xb0')]?!![]:![]},{'model':_0x5e5360[_0x120a('0x69')],'as':'ThroughTags','attributes':['id',_0x120a('0x18'),'color'],'through':_0x1ff9e2[_0x120a('0x83')][_0x120a('0xb0')]?{'attributes':[],'where':{'TagId':_0x1ff9e2[_0x120a('0x83')][_0x120a('0xb0')]||undefined}}:{},'required':_0x1ff9e2[_0x120a('0x83')][_0x120a('0xb0')]?!![]:![]}];}else{_0x392402[_0x120a('0xa5')]=[{'all':!![]}];}}return _0x5e5360[_0x91895['childModel']]['findAll'](_0x392402);})[_0x120a('0x7')](function(_0x1633da){_0x3fe4ad[_0x120a('0xaa')]=_0x1633da;if(_0xdb68===_0x120a('0x53')&&_0x1ff9e2[_0x120a('0x83')][_0x120a('0xb1')]===_0x120a('0xb2')){var _0x158e1f=[];for(var _0x333405=0x0;_0x333405<_0x3fe4ad[_0x120a('0xaa')]['length'];_0x333405++){_0x158e1f['push'](_0x25a6b2(_0x120a('0xb3'),_0x3fe4ad[_0x120a('0xaa')][_0x333405][_0x120a('0xb4')]));_0x158e1f['push'](_0x25a6b2(_0x120a('0xb5'),_0x3fe4ad['rows'][_0x333405][_0x120a('0xb4')]));_0x158e1f[_0x120a('0x8d')](_0x25a6b2('fax',_0x3fe4ad[_0x120a('0xaa')][_0x333405][_0x120a('0xb4')]));_0x158e1f[_0x120a('0x8d')](_0x25a6b2('mail',_0x3fe4ad[_0x120a('0xaa')][_0x333405][_0x120a('0xb4')]));_0x158e1f[_0x120a('0x8d')](_0x25a6b2('openchannel',_0x3fe4ad[_0x120a('0xaa')][_0x333405]['dataValues']));_0x158e1f[_0x120a('0x8d')](_0x25a6b2('whatsapp',_0x3fe4ad[_0x120a('0xaa')][_0x333405]['dataValues']));}return Promise[_0x120a('0x8f')](_0x158e1f)[_0x120a('0x7')](function(){return _0x3fe4ad;});}return _0x3fe4ad;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 6702592..5cfdf33 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 _0x5655=['./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x367eeb,_0x1069ce){var _0x2c3eaf=function(_0x43cb35){while(--_0x43cb35){_0x367eeb['push'](_0x367eeb['shift']());}};_0x2c3eaf(++_0x1069ce);}(_0x5655,0x15e));var _0x5565=function(_0x560d05,_0x597962){_0x560d05=_0x560d05-0x0;var _0x3b7d02=_0x5655[_0x560d05];return _0x3b7d02;};'use strict';var _=require(_0x5565('0x0'));var util=require(_0x5565('0x1'));var moment=require(_0x5565('0x2'));var BPromise=require(_0x5565('0x3'));var rs=require(_0x5565('0x4'));var fs=require('fs');var Redis=require(_0x5565('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5565('0x6'))('rpc');var config=require(_0x5565('0x7'));var jayson=require(_0x5565('0x8'));var client=jayson[_0x5565('0x9')][_0x5565('0xa')]({'port':0x232a});config[_0x5565('0xb')]=_['defaults'](config[_0x5565('0xb')],{'host':_0x5565('0xc'),'port':0x18eb});var socket=require(_0x5565('0xd'))(new Redis(config[_0x5565('0xb')]));require(_0x5565('0xe'))[_0x5565('0xf')](socket);function respondWithRpcPromise(_0x4ac5e3,_0x581dca,_0x367ce8){return new BPromise(function(_0x52db0e,_0x498370){return client[_0x5565('0x10')](_0x4ac5e3,_0x367ce8)[_0x5565('0x11')](function(_0x5d0d99){logger['info'](_0x5565('0x12'),_0x581dca,_0x5565('0x13'));logger[_0x5565('0x14')](_0x5565('0x15'),_0x581dca,_0x5565('0x13'),JSON[_0x5565('0x16')](_0x5d0d99));if(_0x5d0d99[_0x5565('0x17')]){if(_0x5d0d99[_0x5565('0x17')]['code']===0x1f4){logger[_0x5565('0x17')](_0x5565('0x12'),_0x581dca,_0x5d0d99[_0x5565('0x17')][_0x5565('0x18')]);return _0x498370(_0x5d0d99['error'][_0x5565('0x18')]);}logger[_0x5565('0x17')](_0x5565('0x12'),_0x581dca,_0x5d0d99[_0x5565('0x17')][_0x5565('0x18')]);return _0x52db0e(_0x5d0d99['error']['message']);}else{logger[_0x5565('0x19')](_0x5565('0x12'),_0x581dca,'request\x20sent');_0x52db0e(_0x5d0d99[_0x5565('0x1a')][_0x5565('0x18')]);}})[_0x5565('0x1b')](function(_0x5712ad){logger['error']('UserProfile,\x20%s,\x20%s',_0x581dca,_0x5712ad);_0x498370(_0x5712ad);});});} \ No newline at end of file +var _0x9d56=['client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9d56,0x122));var _0x69d5=function(_0x190ef6,_0x3e8243){_0x190ef6=_0x190ef6-0x0;var _0xd9e7f6=_0x9d56[_0x190ef6];return _0xd9e7f6;};'use strict';var _=require(_0x69d5('0x0'));var util=require(_0x69d5('0x1'));var moment=require(_0x69d5('0x2'));var BPromise=require(_0x69d5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x69d5('0x4'));var db=require(_0x69d5('0x5'))['db'];var utils=require(_0x69d5('0x6'));var logger=require(_0x69d5('0x7'))(_0x69d5('0x8'));var config=require('../../config/environment');var jayson=require(_0x69d5('0x9'));var client=jayson[_0x69d5('0xa')][_0x69d5('0xb')]({'port':0x232a});config[_0x69d5('0xc')]=_[_0x69d5('0xd')](config[_0x69d5('0xc')],{'host':_0x69d5('0xe'),'port':0x18eb});var socket=require(_0x69d5('0xf'))(new Redis(config[_0x69d5('0xc')]));require(_0x69d5('0x10'))[_0x69d5('0x11')](socket);function respondWithRpcPromise(_0x3ab86b,_0x5fd33e,_0x3f7383){return new BPromise(function(_0x26783d,_0x1174c0){return client[_0x69d5('0x12')](_0x3ab86b,_0x3f7383)[_0x69d5('0x13')](function(_0x301c5e){logger['info'](_0x69d5('0x14'),_0x5fd33e,_0x69d5('0x15'));logger[_0x69d5('0x16')](_0x69d5('0x17'),_0x5fd33e,_0x69d5('0x15'),JSON['stringify'](_0x301c5e));if(_0x301c5e[_0x69d5('0x18')]){if(_0x301c5e[_0x69d5('0x18')][_0x69d5('0x19')]===0x1f4){logger[_0x69d5('0x18')]('UserProfile,\x20%s,\x20%s',_0x5fd33e,_0x301c5e['error']['message']);return _0x1174c0(_0x301c5e[_0x69d5('0x18')][_0x69d5('0x1a')]);}logger[_0x69d5('0x18')](_0x69d5('0x14'),_0x5fd33e,_0x301c5e[_0x69d5('0x18')]['message']);return _0x26783d(_0x301c5e[_0x69d5('0x18')][_0x69d5('0x1a')]);}else{logger[_0x69d5('0x1b')](_0x69d5('0x14'),_0x5fd33e,_0x69d5('0x15'));_0x26783d(_0x301c5e[_0x69d5('0x1c')][_0x69d5('0x1a')]);}})[_0x69d5('0x1d')](function(_0x54c2a3){logger[_0x69d5('0x18')](_0x69d5('0x14'),_0x5fd33e,_0x54c2a3);_0x1174c0(_0x54c2a3);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e94b691..58aed14 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 _0xe77f=['length','userProfile:','./userProfile.events','remove','emit','removeListener','register'];(function(_0x542f45,_0x37468a){var _0x38c609=function(_0x44259b){while(--_0x44259b){_0x542f45['push'](_0x542f45['shift']());}};_0x38c609(++_0x37468a);}(_0xe77f,0x19f));var _0xfe77=function(_0x218067,_0xb8690b){_0x218067=_0x218067-0x0;var _0x52b2be=_0xe77f[_0x218067];return _0x52b2be;};'use strict';var UserProfileEvents=require(_0xfe77('0x0'));var events=['save',_0xfe77('0x1'),'update'];function createListener(_0x7418b1,_0xdaf76e){return function(_0x1b351e){_0xdaf76e[_0xfe77('0x2')](_0x7418b1,_0x1b351e);};}function removeListener(_0x41d916,_0x1307cd){return function(){UserProfileEvents[_0xfe77('0x3')](_0x41d916,_0x1307cd);};}exports[_0xfe77('0x4')]=function(_0x2a166d){for(var _0x1f5b61=0x0,_0x16b55a=events[_0xfe77('0x5')];_0x1f5b61<_0x16b55a;_0x1f5b61++){var _0x5a117e=events[_0x1f5b61];var _0xe8a0f5=createListener(_0xfe77('0x6')+_0x5a117e,_0x2a166d);UserProfileEvents['on'](_0x5a117e,_0xe8a0f5);}}; \ No newline at end of file +var _0xd788=['register','length','userProfile:','save','update','emit','removeListener'];(function(_0x41c98a,_0x3afaf8){var _0x24963f=function(_0x4c81ea){while(--_0x4c81ea){_0x41c98a['push'](_0x41c98a['shift']());}};_0x24963f(++_0x3afaf8);}(_0xd788,0x8f));var _0x8d78=function(_0x42fe16,_0x9273d){_0x42fe16=_0x42fe16-0x0;var _0x28d673=_0xd788[_0x42fe16];return _0x28d673;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x8d78('0x0'),'remove',_0x8d78('0x1')];function createListener(_0x1d0203,_0x1409a2){return function(_0x1d5300){_0x1409a2[_0x8d78('0x2')](_0x1d0203,_0x1d5300);};}function removeListener(_0x571acb,_0x5dad18){return function(){UserProfileEvents[_0x8d78('0x3')](_0x571acb,_0x5dad18);};}exports[_0x8d78('0x4')]=function(_0x5cf326){for(var _0x278e7b=0x0,_0x5d4727=events[_0x8d78('0x5')];_0x278e7b<_0x5d4727;_0x278e7b++){var _0xcfcef3=events[_0x278e7b];var _0x42e80d=createListener(_0x8d78('0x6')+_0xcfcef3,_0x5cf326);UserProfileEvents['on'](_0xcfcef3,_0x42e80d);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index f70025a..b445c59 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 _0xa846=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','put','update','delete','destroy','exports','multer'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xa846,0x1c7));var _0x6a84=function(_0x89fd9c,_0x162c49){_0x89fd9c=_0x89fd9c-0x0;var _0x3ac332=_0xa846[_0x89fd9c];return _0x3ac332;};'use strict';var multer=require(_0x6a84('0x0'));var util=require(_0x6a84('0x1'));var path=require('path');var timeout=require(_0x6a84('0x2'));var express=require(_0x6a84('0x3'));var router=express['Router']();var fs_extra=require(_0x6a84('0x4'));var auth=require(_0x6a84('0x5'));var interaction=require(_0x6a84('0x6'));var config=require('../../config/environment');var controller=require(_0x6a84('0x7'));router[_0x6a84('0x8')]('/',auth[_0x6a84('0x9')](),controller[_0x6a84('0xa')]);router[_0x6a84('0x8')](_0x6a84('0xb'),auth[_0x6a84('0x9')](),controller[_0x6a84('0xc')]);router[_0x6a84('0x8')](_0x6a84('0xd'),auth[_0x6a84('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6a84('0xe')](_0x6a84('0xd'),auth[_0x6a84('0x9')](),controller[_0x6a84('0xf')]);router[_0x6a84('0x10')](_0x6a84('0xd'),auth['isAuthenticated'](),controller[_0x6a84('0x11')]);module[_0x6a84('0x12')]=router; \ No newline at end of file +var _0x30fe=['describe','/:id','post','put','update','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x1bf942,_0x5eeb7d){var _0x1d1a46=function(_0x1827c5){while(--_0x1827c5){_0x1bf942['push'](_0x1bf942['shift']());}};_0x1d1a46(++_0x5eeb7d);}(_0x30fe,0x149));var _0xe30f=function(_0x146260,_0x3c8013){_0x146260=_0x146260-0x0;var _0x2845e7=_0x30fe[_0x146260];return _0x2845e7;};'use strict';var multer=require('multer');var util=require(_0xe30f('0x0'));var path=require('path');var timeout=require(_0xe30f('0x1'));var express=require('express');var router=express[_0xe30f('0x2')]();var fs_extra=require(_0xe30f('0x3'));var auth=require(_0xe30f('0x4'));var interaction=require(_0xe30f('0x5'));var config=require(_0xe30f('0x6'));var controller=require('./userProfileResource.controller');router[_0xe30f('0x7')]('/',auth[_0xe30f('0x8')](),controller[_0xe30f('0x9')]);router[_0xe30f('0x7')](_0xe30f('0xa'),auth[_0xe30f('0x8')](),controller[_0xe30f('0xb')]);router[_0xe30f('0x7')](_0xe30f('0xc'),auth[_0xe30f('0x8')](),controller['show']);router[_0xe30f('0xd')]('/',auth[_0xe30f('0x8')](),controller['create']);router[_0xe30f('0xe')](_0xe30f('0xc'),auth[_0xe30f('0x8')](),controller[_0xe30f('0xf')]);router['delete'](_0xe30f('0xc'),auth[_0xe30f('0x8')](),controller[_0xe30f('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 263e2a7..b8b566f 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 _0x577f=['sequelize','exports','INTEGER','STRING'];(function(_0x18a9ee,_0x473f2d){var _0x522e15=function(_0x53c89e){while(--_0x53c89e){_0x18a9ee['push'](_0x18a9ee['shift']());}};_0x522e15(++_0x473f2d);}(_0x577f,0x74));var _0xf577=function(_0x441ed5,_0xf28dc0){_0x441ed5=_0x441ed5-0x0;var _0x21a918=_0x577f[_0x441ed5];return _0x21a918;};'use strict';var Sequelize=require(_0xf577('0x0'));module[_0xf577('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xf577('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf577('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x39df=['STRING','exports'];(function(_0x1ad9e2,_0x180a3f){var _0x2e2c86=function(_0x16577f){while(--_0x16577f){_0x1ad9e2['push'](_0x1ad9e2['shift']());}};_0x2e2c86(++_0x180a3f);}(_0x39df,0x1d3));var _0xf39d=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x39df[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require('sequelize');module[_0xf39d('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xf39d('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 1b2586e..8a8363c 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 _0x187d=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','error','stack','name','index','map','UserProfileResource','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','where','filter','merge','includeAll','include','findAll','then','rows','catch','show','params','fields','options','find','create','body','describe','eml-format'];(function(_0xebc48,_0x453e35){var _0x3670b5=function(_0x50e01e){while(--_0x50e01e){_0xebc48['push'](_0xebc48['shift']());}};_0x3670b5(++_0x453e35);}(_0x187d,0x93));var _0xd187=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x187d[_0x46aff0];return _0x9d78cf;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];function respondWithStatusCode(_0x4545cf,_0x32ba07){_0x32ba07=_0x32ba07||0xcc;return function(_0x59ee4a){if(_0x59ee4a){return _0x4545cf[_0xd187('0x1b')](_0x32ba07);}return _0x4545cf[_0xd187('0x1c')](_0x32ba07)[_0xd187('0x1d')]();};}function respondWithResult(_0x126d1a,_0x517b25){_0x517b25=_0x517b25||0xc8;return function(_0x39a927){if(_0x39a927){return _0x126d1a[_0xd187('0x1c')](_0x517b25)[_0xd187('0x1e')](_0x39a927);}};}function respondWithFilteredResult(_0x188cfe,_0x4c8f68){return function(_0x245d3e){if(_0x245d3e){var _0x52a208=typeof _0x4c8f68['offset']===_0xd187('0x1f')&&typeof _0x4c8f68['limit']==='undefined';var _0x207b36=_0x245d3e[_0xd187('0x20')];var _0x374fe0=_0x52a208?0x0:_0x4c8f68[_0xd187('0x21')];var _0x21df74=_0x52a208?_0x245d3e[_0xd187('0x20')]:_0x4c8f68[_0xd187('0x21')]+_0x4c8f68[_0xd187('0x22')];var _0x4f2f88;if(_0x21df74>=_0x207b36){_0x21df74=_0x207b36;_0x4f2f88=0xc8;}else{_0x4f2f88=0xce;}_0x188cfe[_0xd187('0x1c')](_0x4f2f88);return _0x188cfe[_0xd187('0x23')](_0xd187('0x24'),_0x374fe0+'-'+_0x21df74+'/'+_0x207b36)[_0xd187('0x1e')](_0x245d3e);}return null;};}function patchUpdates(_0x5204ee){return function(_0x2f7fb3){try{jsonpatch[_0xd187('0x25')](_0x2f7fb3,_0x5204ee,!![]);}catch(_0xc5bba5){return BPromise['reject'](_0xc5bba5);}return _0x2f7fb3['save']();};}function saveUpdates(_0x57cf1d,_0x435d94){return function(_0x33741d){if(_0x33741d){return _0x33741d[_0xd187('0x26')](_0x57cf1d)['then'](function(_0x2c07c8){return _0x2c07c8;});}return null;};}function removeEntity(_0x57186b,_0x145771){return function(_0x5a7a23){if(_0x5a7a23){return _0x5a7a23[_0xd187('0x27')]()['then'](function(){_0x57186b['status'](0xcc)[_0xd187('0x1d')]();});}};}function handleEntityNotFound(_0x4d992b,_0x12da33){return function(_0x598aa4){if(!_0x598aa4){_0x4d992b['sendStatus'](0x194);}return _0x598aa4;};}function handleError(_0x4eac6a,_0x848ddd){_0x848ddd=_0x848ddd||0x1f4;return function(_0xeff822){logger[_0xd187('0x28')](_0xeff822[_0xd187('0x29')]);if(_0xeff822['name']){delete _0xeff822[_0xd187('0x2a')];}_0x4eac6a[_0xd187('0x1c')](_0x848ddd)['send'](_0xeff822);};}exports[_0xd187('0x2b')]=function(_0x1c87ee,_0x34febe){var _0x4c50a5={},_0x15e2e8={},_0x56e292={'count':0x0,'rows':[]};var _0x263e31=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x489f2e){return{'name':_0x489f2e[_0xd187('0x2f')],'type':_0x489f2e[_0xd187('0x30')]['key']};});_0x15e2e8['model']=_[_0xd187('0x2c')](_0x263e31,_0xd187('0x2a'));_0x15e2e8[_0xd187('0x31')]=_[_0xd187('0x32')](_0x1c87ee[_0xd187('0x31')]);_0x15e2e8[_0xd187('0x33')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],_0x15e2e8['query']);_0x4c50a5[_0xd187('0x36')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],qs['fields'](_0x1c87ee[_0xd187('0x31')]['fields']));_0x4c50a5[_0xd187('0x36')]=_0x4c50a5[_0xd187('0x36')][_0xd187('0x37')]?_0x4c50a5['attributes']:_0x15e2e8['model'];if(!_0x1c87ee[_0xd187('0x31')][_0xd187('0x38')]('nolimit')){_0x4c50a5[_0xd187('0x22')]=qs[_0xd187('0x22')](_0x1c87ee[_0xd187('0x31')]['limit']);_0x4c50a5['offset']=qs[_0xd187('0x21')](_0x1c87ee[_0xd187('0x31')]['offset']);}_0x4c50a5['order']=qs['sort'](_0x1c87ee[_0xd187('0x31')]['sort']);_0x4c50a5[_0xd187('0x39')]=qs[_0xd187('0x33')](_['pick'](_0x1c87ee[_0xd187('0x31')],_0x15e2e8['filters']),_0x263e31);if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]){_0x4c50a5['where']=_[_0xd187('0x3b')](_0x4c50a5[_0xd187('0x39')],{'$or':_['map'](_0x263e31,function(_0x4399a5){if(_0x4399a5['type']!=='VIRTUAL'){var _0x26b06d={};_0x26b06d[_0x4399a5[_0xd187('0x2a')]]={'$like':'%'+_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]+'%'};return _0x26b06d;}})});}_0x4c50a5=_[_0xd187('0x3b')]({},_0x4c50a5,_0x1c87ee['options']);var _0x8860c={'where':_0x4c50a5[_0xd187('0x39')]};return db[_0xd187('0x2d')]['count'](_0x8860c)['then'](function(_0x538c05){_0x56e292['count']=_0x538c05;if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3c')]){_0x4c50a5[_0xd187('0x3d')]=[{'all':!![]}];}return db[_0xd187('0x2d')][_0xd187('0x3e')](_0x4c50a5);})[_0xd187('0x3f')](function(_0x4699e1){_0x56e292[_0xd187('0x40')]=_0x4699e1;return _0x56e292;})['then'](respondWithFilteredResult(_0x34febe,_0x4c50a5))[_0xd187('0x41')](handleError(_0x34febe,null));};exports[_0xd187('0x42')]=function(_0x31d9d2,_0x51c7fc){var _0x21cbf6={'raw':![],'where':{'id':_0x31d9d2[_0xd187('0x43')]['id']}},_0x48c100={};_0x48c100[_0xd187('0x35')]=_[_0xd187('0x32')](db[_0xd187('0x2d')][_0xd187('0x2e')]);_0x48c100['query']=_[_0xd187('0x32')](_0x31d9d2[_0xd187('0x31')]);_0x48c100[_0xd187('0x33')]=_[_0xd187('0x34')](_0x48c100['model'],_0x48c100[_0xd187('0x31')]);_0x21cbf6[_0xd187('0x36')]=_['intersection'](_0x48c100[_0xd187('0x35')],qs[_0xd187('0x44')](_0x31d9d2['query']['fields']));_0x21cbf6[_0xd187('0x36')]=_0x21cbf6[_0xd187('0x36')]['length']?_0x21cbf6['attributes']:_0x48c100['model'];if(_0x31d9d2[_0xd187('0x31')][_0xd187('0x3c')]){_0x21cbf6[_0xd187('0x3d')]=[{'all':!![]}];}_0x21cbf6=_[_0xd187('0x3b')]({},_0x21cbf6,_0x31d9d2[_0xd187('0x45')]);return db[_0xd187('0x2d')][_0xd187('0x46')](_0x21cbf6)['then'](handleEntityNotFound(_0x51c7fc,null))[_0xd187('0x3f')](respondWithResult(_0x51c7fc,null))[_0xd187('0x41')](handleError(_0x51c7fc,null));};exports[_0xd187('0x47')]=function(_0x3ce4a1,_0x3f5def){return db[_0xd187('0x2d')][_0xd187('0x47')](_0x3ce4a1[_0xd187('0x48')],{})['then'](respondWithResult(_0x3f5def,0xc9))[_0xd187('0x41')](handleError(_0x3f5def,null));};exports[_0xd187('0x26')]=function(_0x4523c8,_0x1449d7){if(_0x4523c8[_0xd187('0x48')]['id']){delete _0x4523c8['body']['id'];}return db[_0xd187('0x2d')][_0xd187('0x46')]({'where':{'id':_0x4523c8['params']['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x1449d7,null))[_0xd187('0x3f')](saveUpdates(_0x4523c8['body'],null))['then'](respondWithResult(_0x1449d7,null))['catch'](handleError(_0x1449d7,null));};exports['destroy']=function(_0x473bef,_0x22f432){return db[_0xd187('0x2d')][_0xd187('0x46')]({'where':{'id':_0x473bef[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x22f432,null))[_0xd187('0x3f')](removeEntity(_0x22f432,null))['catch'](handleError(_0x22f432,null));};exports[_0xd187('0x49')]=function(_0x3aaeaa,_0x1b12c4){return db[_0xd187('0x2d')]['describe']()[_0xd187('0x3f')](respondWithResult(_0x1b12c4,null))['catch'](handleError(_0x1b12c4,null));}; \ No newline at end of file +var _0xdb28=['index','UserProfileResource','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','describe','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'];(function(_0x177ff1,_0x493fb3){var _0x1a2909=function(_0xd0045f){while(--_0xd0045f){_0x177ff1['push'](_0x177ff1['shift']());}};_0x1a2909(++_0x493fb3);}(_0xdb28,0x106));var _0x8db2=function(_0x1896c8,_0x30d3e7){_0x1896c8=_0x1896c8-0x0;var _0x35dd37=_0xdb28[_0x1896c8];return _0x35dd37;};'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']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['create']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')](_0x449109['body'],{})['then'](respondWithResult(_0x2ada52,0xc9))[_0x8db2('0x42')](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x164020,_0x4c66e5){if(_0x164020['body']['id']){delete _0x164020['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x164020[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x4c66e5,null))[_0x8db2('0x24')](saveUpdates(_0x164020[_0x8db2('0x4a')],null))[_0x8db2('0x24')](respondWithResult(_0x4c66e5,null))['catch'](handleError(_0x4c66e5,null));};exports['destroy']=function(_0x3d29bc,_0x18c6ef){return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x3d29bc[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x18c6ef,null))[_0x8db2('0x24')](removeEntity(_0x18c6ef,null))[_0x8db2('0x42')](handleError(_0x18c6ef,null));};exports[_0x8db2('0x4b')]=function(_0x426ae0,_0x3bc632){return db[_0x8db2('0x2b')][_0x8db2('0x4b')]()[_0x8db2('0x24')](respondWithResult(_0x3bc632,null))[_0x8db2('0x42')](handleError(_0x3bc632,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 8d9ee48..1f12fe7 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 _0xa785=['path','../../config/environment','exports','UserProfileResource','user_profile_has_resources','resourceId','sectionId','util','moment','bluebird'];(function(_0x550d2a,_0x3b1087){var _0x2009b4=function(_0x182f6d){while(--_0x182f6d){_0x550d2a['push'](_0x550d2a['shift']());}};_0x2009b4(++_0x3b1087);}(_0xa785,0x89));var _0x5a78=function(_0x1305e3,_0x43a724){_0x1305e3=_0x1305e3-0x0;var _0x1068e9=_0xa785[_0x1305e3];return _0x1068e9;};'use strict';var _=require('lodash');var util=require(_0x5a78('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5a78('0x1'));var BPromise=require(_0x5a78('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a78('0x3'));var rimraf=require('rimraf');var config=require(_0x5a78('0x4'));var attributes=require('./userProfileResource.attributes');module[_0x5a78('0x5')]=function(_0x3e0d0e,_0x35069a){return _0x3e0d0e['define'](_0x5a78('0x6'),attributes,{'tableName':_0x5a78('0x7'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x5a78('0x8'),_0x5a78('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa856=['moment','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','user_profile_has_resources','resourceId','../../config/logger','api'];(function(_0x1d40b7,_0x900e8){var _0x31d847=function(_0x5f57bf){while(--_0x5f57bf){_0x1d40b7['push'](_0x1d40b7['shift']());}};_0x31d847(++_0x900e8);}(_0xa856,0x82));var _0x6a85=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa856[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6a85('0x0'))(_0x6a85('0x1'));var moment=require(_0x6a85('0x2'));var BPromise=require('bluebird');var rp=require(_0x6a85('0x3'));var fs=require('fs');var path=require(_0x6a85('0x4'));var rimraf=require(_0x6a85('0x5'));var config=require(_0x6a85('0x6'));var attributes=require(_0x6a85('0x7'));module[_0x6a85('0x8')]=function(_0xcf94d8,_0x1081d5){return _0xcf94d8['define']('UserProfileResource',attributes,{'tableName':_0x6a85('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x6a85('0xa'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index d083152..fa1c432 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 _0x6f67=['lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','UserProfileResource,\x20%s,\x20%s','result'];(function(_0x212866,_0x38175e){var _0x4ca663=function(_0x489b09){while(--_0x489b09){_0x212866['push'](_0x212866['shift']());}};_0x4ca663(++_0x38175e);}(_0x6f67,0xf0));var _0x76f6=function(_0x1cf9d5,_0x3548da){_0x1cf9d5=_0x1cf9d5-0x0;var _0x1cb844=_0x6f67[_0x1cf9d5];return _0x1cb844;};'use strict';var _=require(_0x76f6('0x0'));var util=require(_0x76f6('0x1'));var moment=require(_0x76f6('0x2'));var BPromise=require('bluebird');var rs=require(_0x76f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x76f6('0x5'))(_0x76f6('0x6'));var config=require(_0x76f6('0x7'));var jayson=require(_0x76f6('0x8'));var client=jayson['client'][_0x76f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x352550,_0x2b74d8,_0x2c8884){return new BPromise(function(_0x20e27d,_0x4adf60){return client[_0x76f6('0xa')](_0x352550,_0x2c8884)[_0x76f6('0xb')](function(_0x3b6b96){logger[_0x76f6('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x2b74d8,_0x76f6('0xd'));logger['debug'](_0x76f6('0xe'),_0x2b74d8,'request\x20sent',JSON['stringify'](_0x3b6b96));if(_0x3b6b96[_0x76f6('0xf')]){if(_0x3b6b96[_0x76f6('0xf')][_0x76f6('0x10')]===0x1f4){logger[_0x76f6('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x2b74d8,_0x3b6b96[_0x76f6('0xf')][_0x76f6('0x11')]);return _0x4adf60(_0x3b6b96['error'][_0x76f6('0x11')]);}logger[_0x76f6('0xf')](_0x76f6('0x12'),_0x2b74d8,_0x3b6b96[_0x76f6('0xf')]['message']);return _0x20e27d(_0x3b6b96[_0x76f6('0xf')][_0x76f6('0x11')]);}else{logger[_0x76f6('0xc')](_0x76f6('0x12'),_0x2b74d8,_0x76f6('0xd'));_0x20e27d(_0x3b6b96[_0x76f6('0x13')][_0x76f6('0x11')]);}})['catch'](function(_0x442a85){logger[_0x76f6('0xf')](_0x76f6('0x12'),_0x2b74d8,_0x442a85);_0x4adf60(_0x442a85);});});} \ No newline at end of file +var _0x6940=['util','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x1c90d4,_0x3957e6){var _0x214860=function(_0x2af15c){while(--_0x2af15c){_0x1c90d4['push'](_0x1c90d4['shift']());}};_0x214860(++_0x3957e6);}(_0x6940,0x64));var _0x0694=function(_0x4930b2,_0x2e2a55){_0x4930b2=_0x4930b2-0x0;var _0x13dae8=_0x6940[_0x4930b2];return _0x13dae8;};'use strict';var _=require('lodash');var util=require(_0x0694('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0694('0x1'));var fs=require('fs');var Redis=require(_0x0694('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0694('0x3'));var config=require(_0x0694('0x4'));var jayson=require(_0x0694('0x5'));var client=jayson[_0x0694('0x6')][_0x0694('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2868d0,_0x2d0e72,_0x1d24be){return new BPromise(function(_0x5f257a,_0x2d283d){return client[_0x0694('0x8')](_0x2868d0,_0x1d24be)[_0x0694('0x9')](function(_0x193890){logger[_0x0694('0xa')](_0x0694('0xb'),_0x2d0e72,'request\x20sent');logger[_0x0694('0xc')](_0x0694('0xd'),_0x2d0e72,_0x0694('0xe'),JSON[_0x0694('0xf')](_0x193890));if(_0x193890['error']){if(_0x193890[_0x0694('0x10')][_0x0694('0x11')]===0x1f4){logger[_0x0694('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x2d0e72,_0x193890['error'][_0x0694('0x12')]);return _0x2d283d(_0x193890['error'][_0x0694('0x12')]);}logger[_0x0694('0x10')](_0x0694('0xb'),_0x2d0e72,_0x193890['error'][_0x0694('0x12')]);return _0x5f257a(_0x193890[_0x0694('0x10')][_0x0694('0x12')]);}else{logger[_0x0694('0xa')](_0x0694('0xb'),_0x2d0e72,_0x0694('0xe'));_0x5f257a(_0x193890['result'][_0x0694('0x12')]);}})[_0x0694('0x13')](function(_0x464137){logger['error'](_0x0694('0xb'),_0x2d0e72,_0x464137);_0x2d283d(_0x464137);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 68ad485..b57bbc5 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 _0xdc98=['show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id'];(function(_0x31e9f5,_0x9fc4e0){var _0x5c484a=function(_0x3b7554){while(--_0x3b7554){_0x31e9f5['push'](_0x31e9f5['shift']());}};_0x5c484a(++_0x9fc4e0);}(_0xdc98,0x1c1));var _0x8dc9=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xdc98[_0x9cd4c3];return _0x4c9025;};'use strict';var multer=require(_0x8dc9('0x0'));var util=require('util');var path=require(_0x8dc9('0x1'));var timeout=require(_0x8dc9('0x2'));var express=require(_0x8dc9('0x3'));var router=express[_0x8dc9('0x4')]();var fs_extra=require(_0x8dc9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8dc9('0x6'));var config=require(_0x8dc9('0x7'));var controller=require('./userProfileSection.controller');router[_0x8dc9('0x8')]('/',auth[_0x8dc9('0x9')](),controller['index']);router[_0x8dc9('0x8')](_0x8dc9('0xa'),auth['isAuthenticated'](),controller[_0x8dc9('0xb')]);router['get'](_0x8dc9('0xc'),auth[_0x8dc9('0x9')](),controller[_0x8dc9('0xd')]);router[_0x8dc9('0xe')]('/',auth['isAuthenticated'](),controller[_0x8dc9('0xf')]);router[_0x8dc9('0x10')](_0x8dc9('0xc'),auth[_0x8dc9('0x9')](),controller[_0x8dc9('0x11')]);router[_0x8dc9('0x12')](_0x8dc9('0xc'),auth[_0x8dc9('0x9')](),controller[_0x8dc9('0x13')]);module[_0x8dc9('0x14')]=router; \ No newline at end of file +var _0x8b03=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update','destroy'];(function(_0x164f15,_0x3be829){var _0xae0d2e=function(_0x3faa7e){while(--_0x3faa7e){_0x164f15['push'](_0x164f15['shift']());}};_0xae0d2e(++_0x3be829);}(_0x8b03,0xa1));var _0x38b0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8b03[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x38b0('0x0'));var timeout=require(_0x38b0('0x1'));var express=require(_0x38b0('0x2'));var router=express[_0x38b0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x38b0('0x4'));var interaction=require(_0x38b0('0x5'));var config=require(_0x38b0('0x6'));var controller=require(_0x38b0('0x7'));router['get']('/',auth[_0x38b0('0x8')](),controller[_0x38b0('0x9')]);router[_0x38b0('0xa')](_0x38b0('0xb'),auth['isAuthenticated'](),controller[_0x38b0('0xc')]);router['get'](_0x38b0('0xd'),auth[_0x38b0('0x8')](),controller['show']);router[_0x38b0('0xe')]('/',auth[_0x38b0('0x8')](),controller[_0x38b0('0xf')]);router[_0x38b0('0x10')](_0x38b0('0xd'),auth[_0x38b0('0x8')](),controller[_0x38b0('0x11')]);router['delete'](_0x38b0('0xd'),auth['isAuthenticated'](),controller[_0x38b0('0x12')]);module[_0x38b0('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index c9968fe..a24369b 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 _0x4fc2=['split','sequelize','exports','STRING','BOOLEAN','setDataValue','crudPermissions','getDataValue'];(function(_0x3d27ba,_0x2671a3){var _0xf01885=function(_0x311f5c){while(--_0x311f5c){_0x3d27ba['push'](_0x3d27ba['shift']());}};_0xf01885(++_0x2671a3);}(_0x4fc2,0x111));var _0x24fc=function(_0x10df96,_0x1f62a1){_0x10df96=_0x10df96-0x0;var _0x238069=_0x4fc2[_0x10df96];return _0x238069;};'use strict';var Sequelize=require(_0x24fc('0x0'));module[_0x24fc('0x1')]={'name':{'type':Sequelize[_0x24fc('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x24fc('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x24fc('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x24fc('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x24fc('0x2')],'set':function(_0x541ad2){this[_0x24fc('0x4')](_0x24fc('0x5'),_0x541ad2?_0x541ad2['join'](''):[]);},'get':function(){return this[_0x24fc('0x6')](_0x24fc('0x5'))?this['getDataValue'](_0x24fc('0x5'))[_0x24fc('0x7')](''):[];}}}; \ No newline at end of file +var _0xbc9d=['sequelize','exports','STRING','INTEGER','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0xc01d2,_0x29f146){var _0x17f297=function(_0x24703f){while(--_0x24703f){_0xc01d2['push'](_0xc01d2['shift']());}};_0x17f297(++_0x29f146);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x410602,_0x2b9fda){_0x410602=_0x410602-0x0;var _0x289a75=_0xbc9d[_0x410602];return _0x289a75;};'use strict';var Sequelize=require(_0xdbc9('0x0'));module[_0xdbc9('0x1')]={'name':{'type':Sequelize[_0xdbc9('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xdbc9('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xdbc9('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x2aba48){this[_0xdbc9('0x4')](_0xdbc9('0x5'),_0x2aba48?_0x2aba48[_0xdbc9('0x6')](''):[]);},'get':function(){return this[_0xdbc9('0x7')](_0xdbc9('0x5'))?this[_0xdbc9('0x7')]('crudPermissions')[_0xdbc9('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index dda4a75..669de94 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 _0x5af4=['update','destroy','describe','eml-format','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','map','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','options','UserProfileSection','then','includeAll','include','findAll','rows','catch','params','keys','find','create','body'];(function(_0x18c607,_0x5ec75e){var _0x3d2d77=function(_0x1669a2){while(--_0x1669a2){_0x18c607['push'](_0x18c607['shift']());}};_0x3d2d77(++_0x5ec75e);}(_0x5af4,0x175));var _0x45af=function(_0x3853c6,_0x311605){_0x3853c6=_0x3853c6-0x0;var _0x4a66f0=_0x5af4[_0x3853c6];return _0x4a66f0;};'use strict';var emlformat=require(_0x45af('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x45af('0x1'));var rp=require(_0x45af('0x2'));var moment=require(_0x45af('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x45af('0x4'));var path=require('path');var sox=require(_0x45af('0x5'));var csv=require(_0x45af('0x6'));var ejs=require(_0x45af('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x45af('0x8'));var crypto=require('crypto');var jsforce=require(_0x45af('0x9'));var deskjs=require(_0x45af('0xa'));var toCsv=require(_0x45af('0x6'));var querystring=require(_0x45af('0xb'));var Papa=require('papaparse');var Redis=require(_0x45af('0xc'));var authService=require(_0x45af('0xd'));var qs=require(_0x45af('0xe'));var as=require(_0x45af('0xf'));var hardwareService=require(_0x45af('0x10'));var logger=require(_0x45af('0x11'))(_0x45af('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x45af('0x13'))['db'];function respondWithStatusCode(_0x33efd9,_0x3db769){_0x3db769=_0x3db769||0xcc;return function(_0x597913){if(_0x597913){return _0x33efd9['sendStatus'](_0x3db769);}return _0x33efd9['status'](_0x3db769)[_0x45af('0x14')]();};}function respondWithResult(_0x1a85d9,_0x4e5b4a){_0x4e5b4a=_0x4e5b4a||0xc8;return function(_0x28c017){if(_0x28c017){return _0x1a85d9[_0x45af('0x15')](_0x4e5b4a)['json'](_0x28c017);}};}function respondWithFilteredResult(_0x369260,_0x5ed8aa){return function(_0x24ceca){if(_0x24ceca){var _0x7fed10=typeof _0x5ed8aa[_0x45af('0x16')]===_0x45af('0x17')&&typeof _0x5ed8aa['limit']===_0x45af('0x17');var _0x2ded15=_0x24ceca[_0x45af('0x18')];var _0x1a74ca=_0x7fed10?0x0:_0x5ed8aa[_0x45af('0x16')];var _0x20c66d=_0x7fed10?_0x24ceca['count']:_0x5ed8aa[_0x45af('0x16')]+_0x5ed8aa[_0x45af('0x19')];var _0x227d0f;if(_0x20c66d>=_0x2ded15){_0x20c66d=_0x2ded15;_0x227d0f=0xc8;}else{_0x227d0f=0xce;}_0x369260[_0x45af('0x15')](_0x227d0f);return _0x369260[_0x45af('0x1a')](_0x45af('0x1b'),_0x1a74ca+'-'+_0x20c66d+'/'+_0x2ded15)[_0x45af('0x1c')](_0x24ceca);}return null;};}function patchUpdates(_0x2d8500){return function(_0x360b55){try{jsonpatch[_0x45af('0x1d')](_0x360b55,_0x2d8500,!![]);}catch(_0x503f42){return BPromise[_0x45af('0x1e')](_0x503f42);}return _0x360b55[_0x45af('0x1f')]();};}function saveUpdates(_0x6df36a,_0x23f9f5){return function(_0x200431){if(_0x200431){return _0x200431['update'](_0x6df36a)['then'](function(_0x4d8ae4){return _0x4d8ae4;});}return null;};}function removeEntity(_0x50885a,_0x2de4c4){return function(_0x37c9a0){if(_0x37c9a0){return _0x37c9a0['destroy']()['then'](function(){_0x50885a[_0x45af('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ef212,_0x95a198){return function(_0x52f287){if(!_0x52f287){_0x2ef212[_0x45af('0x20')](0x194);}return _0x52f287;};}function handleError(_0xc1af23,_0x2be1e7){_0x2be1e7=_0x2be1e7||0x1f4;return function(_0x366a66){logger[_0x45af('0x21')](_0x366a66[_0x45af('0x22')]);if(_0x366a66['name']){delete _0x366a66[_0x45af('0x23')];}_0xc1af23[_0x45af('0x15')](_0x2be1e7)[_0x45af('0x24')](_0x366a66);};}exports[_0x45af('0x25')]=function(_0x527671,_0x3e0cf6){var _0x406e07={},_0x26f4c3={},_0x10ec17={'count':0x0,'rows':[]};var _0xc5ca79=_['map'](db['UserProfileSection'][_0x45af('0x26')],function(_0x222ff9){return{'name':_0x222ff9[_0x45af('0x27')],'type':_0x222ff9['type']['key']};});_0x26f4c3['model']=_[_0x45af('0x28')](_0xc5ca79,_0x45af('0x23'));_0x26f4c3['query']=_['keys'](_0x527671['query']);_0x26f4c3['filters']=_[_0x45af('0x29')](_0x26f4c3[_0x45af('0x2a')],_0x26f4c3['query']);_0x406e07[_0x45af('0x2b')]=_[_0x45af('0x29')](_0x26f4c3[_0x45af('0x2a')],qs[_0x45af('0x2c')](_0x527671[_0x45af('0x2d')]['fields']));_0x406e07[_0x45af('0x2b')]=_0x406e07[_0x45af('0x2b')][_0x45af('0x2e')]?_0x406e07[_0x45af('0x2b')]:_0x26f4c3[_0x45af('0x2a')];if(!_0x527671['query'][_0x45af('0x2f')](_0x45af('0x30'))){_0x406e07[_0x45af('0x19')]=qs[_0x45af('0x19')](_0x527671[_0x45af('0x2d')][_0x45af('0x19')]);_0x406e07['offset']=qs[_0x45af('0x16')](_0x527671[_0x45af('0x2d')]['offset']);}_0x406e07[_0x45af('0x31')]=qs[_0x45af('0x32')](_0x527671[_0x45af('0x2d')][_0x45af('0x32')]);_0x406e07['where']=qs[_0x45af('0x33')](_[_0x45af('0x34')](_0x527671[_0x45af('0x2d')],_0x26f4c3[_0x45af('0x33')]),_0xc5ca79);if(_0x527671[_0x45af('0x2d')]['filter']){_0x406e07[_0x45af('0x35')]=_[_0x45af('0x36')](_0x406e07[_0x45af('0x35')],{'$or':_[_0x45af('0x28')](_0xc5ca79,function(_0x55b090){if(_0x55b090[_0x45af('0x37')]!==_0x45af('0x38')){var _0x2250c4={};_0x2250c4[_0x55b090[_0x45af('0x23')]]={'$like':'%'+_0x527671[_0x45af('0x2d')][_0x45af('0x39')]+'%'};return _0x2250c4;}})});}_0x406e07=_['merge']({},_0x406e07,_0x527671[_0x45af('0x3a')]);var _0x310918={'where':_0x406e07[_0x45af('0x35')]};return db[_0x45af('0x3b')][_0x45af('0x18')](_0x310918)[_0x45af('0x3c')](function(_0x3d8d35){_0x10ec17[_0x45af('0x18')]=_0x3d8d35;if(_0x527671[_0x45af('0x2d')][_0x45af('0x3d')]){_0x406e07[_0x45af('0x3e')]=[{'all':!![]}];}return db[_0x45af('0x3b')][_0x45af('0x3f')](_0x406e07);})[_0x45af('0x3c')](function(_0x4eb432){_0x10ec17[_0x45af('0x40')]=_0x4eb432;return _0x10ec17;})[_0x45af('0x3c')](respondWithFilteredResult(_0x3e0cf6,_0x406e07))[_0x45af('0x41')](handleError(_0x3e0cf6,null));};exports['show']=function(_0x4e2020,_0x3a4a06){var _0x5baac5={'raw':![],'where':{'id':_0x4e2020[_0x45af('0x42')]['id']}},_0x5807d9={};_0x5807d9[_0x45af('0x2a')]=_[_0x45af('0x43')](db[_0x45af('0x3b')]['rawAttributes']);_0x5807d9[_0x45af('0x2d')]=_[_0x45af('0x43')](_0x4e2020[_0x45af('0x2d')]);_0x5807d9['filters']=_[_0x45af('0x29')](_0x5807d9['model'],_0x5807d9[_0x45af('0x2d')]);_0x5baac5[_0x45af('0x2b')]=_['intersection'](_0x5807d9[_0x45af('0x2a')],qs['fields'](_0x4e2020[_0x45af('0x2d')][_0x45af('0x2c')]));_0x5baac5[_0x45af('0x2b')]=_0x5baac5[_0x45af('0x2b')][_0x45af('0x2e')]?_0x5baac5[_0x45af('0x2b')]:_0x5807d9[_0x45af('0x2a')];if(_0x4e2020['query'][_0x45af('0x3d')]){_0x5baac5[_0x45af('0x3e')]=[{'all':!![]}];}_0x5baac5=_[_0x45af('0x36')]({},_0x5baac5,_0x4e2020[_0x45af('0x3a')]);return db[_0x45af('0x3b')][_0x45af('0x44')](_0x5baac5)[_0x45af('0x3c')](handleEntityNotFound(_0x3a4a06,null))['then'](respondWithResult(_0x3a4a06,null))[_0x45af('0x41')](handleError(_0x3a4a06,null));};exports[_0x45af('0x45')]=function(_0x411a43,_0x227e5b){return db['UserProfileSection'][_0x45af('0x45')](_0x411a43[_0x45af('0x46')],{})['then'](respondWithResult(_0x227e5b,0xc9))[_0x45af('0x41')](handleError(_0x227e5b,null));};exports[_0x45af('0x47')]=function(_0x28b2c6,_0x36e5cd){if(_0x28b2c6[_0x45af('0x46')]['id']){delete _0x28b2c6[_0x45af('0x46')]['id'];}return db[_0x45af('0x3b')][_0x45af('0x44')]({'where':{'id':_0x28b2c6[_0x45af('0x42')]['id']}})[_0x45af('0x3c')](handleEntityNotFound(_0x36e5cd,null))[_0x45af('0x3c')](saveUpdates(_0x28b2c6[_0x45af('0x46')],null))['then'](respondWithResult(_0x36e5cd,null))[_0x45af('0x41')](handleError(_0x36e5cd,null));};exports[_0x45af('0x48')]=function(_0x32fa21,_0xa04665){return db[_0x45af('0x3b')]['find']({'where':{'id':_0x32fa21[_0x45af('0x42')]['id']}})[_0x45af('0x3c')](handleEntityNotFound(_0xa04665,null))[_0x45af('0x3c')](removeEntity(_0xa04665,null))[_0x45af('0x41')](handleError(_0xa04665,null));};exports[_0x45af('0x49')]=function(_0x4d74f2,_0x16f68c){return db[_0x45af('0x3b')][_0x45af('0x49')]()[_0x45af('0x3c')](respondWithResult(_0x16f68c,null))[_0x45af('0x41')](handleError(_0x16f68c,null));}; \ No newline at end of file +var _0x27c1=['path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','name','index','UserProfileSection','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','order','sort','filter','VIRTUAL','merge','options','where','includeAll','findAll','rows','catch','params','keys','rawAttributes','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x27c1,0x122));var _0x127c=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x27c1[_0xaa1b3e];return _0x454d7d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x127c('0x0'));var zipdir=require(_0x127c('0x1'));var jsonpatch=require(_0x127c('0x2'));var rp=require('request-promise');var moment=require(_0x127c('0x3'));var BPromise=require(_0x127c('0x4'));var Mustache=require(_0x127c('0x5'));var util=require('util');var path=require(_0x127c('0x6'));var sox=require(_0x127c('0x7'));var csv=require(_0x127c('0x8'));var ejs=require(_0x127c('0x9'));var fs=require('fs');var fs_extra=require(_0x127c('0xa'));var _=require(_0x127c('0xb'));var squel=require(_0x127c('0xc'));var crypto=require('crypto');var jsforce=require(_0x127c('0xd'));var deskjs=require(_0x127c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x127c('0xf'));var Papa=require(_0x127c('0x10'));var Redis=require(_0x127c('0x11'));var authService=require(_0x127c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x127c('0x13'));var hardwareService=require(_0x127c('0x14'));var logger=require(_0x127c('0x15'))(_0x127c('0x16'));var utils=require(_0x127c('0x17'));var config=require(_0x127c('0x18'));var licenseUtil=require(_0x127c('0x19'));var db=require(_0x127c('0x1a'))['db'];function respondWithStatusCode(_0x455f50,_0x12b44a){_0x12b44a=_0x12b44a||0xcc;return function(_0x13d770){if(_0x13d770){return _0x455f50[_0x127c('0x1b')](_0x12b44a);}return _0x455f50['status'](_0x12b44a)[_0x127c('0x1c')]();};}function respondWithResult(_0x437cc3,_0x3f8581){_0x3f8581=_0x3f8581||0xc8;return function(_0x42de62){if(_0x42de62){return _0x437cc3[_0x127c('0x1d')](_0x3f8581)[_0x127c('0x1e')](_0x42de62);}};}function respondWithFilteredResult(_0x59363f,_0x2ca59b){return function(_0x21be6f){if(_0x21be6f){var _0x4eea35=typeof _0x2ca59b['offset']==='undefined'&&typeof _0x2ca59b[_0x127c('0x1f')]==='undefined';var _0x29a384=_0x21be6f[_0x127c('0x20')];var _0x341686=_0x4eea35?0x0:_0x2ca59b[_0x127c('0x21')];var _0x4343f9=_0x4eea35?_0x21be6f[_0x127c('0x20')]:_0x2ca59b[_0x127c('0x21')]+_0x2ca59b['limit'];var _0x4c0c2e;if(_0x4343f9>=_0x29a384){_0x4343f9=_0x29a384;_0x4c0c2e=0xc8;}else{_0x4c0c2e=0xce;}_0x59363f['status'](_0x4c0c2e);return _0x59363f[_0x127c('0x22')](_0x127c('0x23'),_0x341686+'-'+_0x4343f9+'/'+_0x29a384)['json'](_0x21be6f);}return null;};}function patchUpdates(_0x465b41){return function(_0x489b5c){try{jsonpatch[_0x127c('0x24')](_0x489b5c,_0x465b41,!![]);}catch(_0x16d77d){return BPromise[_0x127c('0x25')](_0x16d77d);}return _0x489b5c[_0x127c('0x26')]();};}function saveUpdates(_0x20e330,_0x868c9e){return function(_0x4f2130){if(_0x4f2130){return _0x4f2130['update'](_0x20e330)[_0x127c('0x27')](function(_0x68fe09){return _0x68fe09;});}return null;};}function removeEntity(_0x53b266,_0x1e9736){return function(_0x1c44c8){if(_0x1c44c8){return _0x1c44c8[_0x127c('0x28')]()[_0x127c('0x27')](function(){_0x53b266[_0x127c('0x1d')](0xcc)[_0x127c('0x1c')]();});}};}function handleEntityNotFound(_0x4a531e,_0x4f39b8){return function(_0x1dfd7c){if(!_0x1dfd7c){_0x4a531e[_0x127c('0x1b')](0x194);}return _0x1dfd7c;};}function handleError(_0xb7540,_0x46e833){_0x46e833=_0x46e833||0x1f4;return function(_0x477d19){logger['error'](_0x477d19['stack']);if(_0x477d19['name']){delete _0x477d19[_0x127c('0x29')];}_0xb7540[_0x127c('0x1d')](_0x46e833)['send'](_0x477d19);};}exports[_0x127c('0x2a')]=function(_0x145540,_0x5d594e){var _0x7b6282={},_0x1787a9={},_0x203b07={'count':0x0,'rows':[]};var _0x3bee25=_['map'](db[_0x127c('0x2b')]['rawAttributes'],function(_0x4f3733){return{'name':_0x4f3733[_0x127c('0x2c')],'type':_0x4f3733[_0x127c('0x2d')][_0x127c('0x2e')]};});_0x1787a9[_0x127c('0x2f')]=_[_0x127c('0x30')](_0x3bee25,_0x127c('0x29'));_0x1787a9[_0x127c('0x31')]=_['keys'](_0x145540[_0x127c('0x31')]);_0x1787a9[_0x127c('0x32')]=_[_0x127c('0x33')](_0x1787a9[_0x127c('0x2f')],_0x1787a9[_0x127c('0x31')]);_0x7b6282[_0x127c('0x34')]=_['intersection'](_0x1787a9[_0x127c('0x2f')],qs[_0x127c('0x35')](_0x145540[_0x127c('0x31')]['fields']));_0x7b6282[_0x127c('0x34')]=_0x7b6282['attributes'][_0x127c('0x36')]?_0x7b6282[_0x127c('0x34')]:_0x1787a9['model'];if(!_0x145540[_0x127c('0x31')]['hasOwnProperty']('nolimit')){_0x7b6282[_0x127c('0x1f')]=qs[_0x127c('0x1f')](_0x145540[_0x127c('0x31')][_0x127c('0x1f')]);_0x7b6282[_0x127c('0x21')]=qs[_0x127c('0x21')](_0x145540[_0x127c('0x31')][_0x127c('0x21')]);}_0x7b6282[_0x127c('0x37')]=qs[_0x127c('0x38')](_0x145540['query'][_0x127c('0x38')]);_0x7b6282['where']=qs['filters'](_['pick'](_0x145540[_0x127c('0x31')],_0x1787a9[_0x127c('0x32')]),_0x3bee25);if(_0x145540[_0x127c('0x31')][_0x127c('0x39')]){_0x7b6282['where']=_['merge'](_0x7b6282['where'],{'$or':_['map'](_0x3bee25,function(_0x28dfbb){if(_0x28dfbb[_0x127c('0x2d')]!==_0x127c('0x3a')){var _0x5b926={};_0x5b926[_0x28dfbb[_0x127c('0x29')]]={'$like':'%'+_0x145540[_0x127c('0x31')][_0x127c('0x39')]+'%'};return _0x5b926;}})});}_0x7b6282=_[_0x127c('0x3b')]({},_0x7b6282,_0x145540[_0x127c('0x3c')]);var _0x26e6b6={'where':_0x7b6282[_0x127c('0x3d')]};return db['UserProfileSection']['count'](_0x26e6b6)[_0x127c('0x27')](function(_0x7e9dd5){_0x203b07[_0x127c('0x20')]=_0x7e9dd5;if(_0x145540[_0x127c('0x31')][_0x127c('0x3e')]){_0x7b6282['include']=[{'all':!![]}];}return db[_0x127c('0x2b')][_0x127c('0x3f')](_0x7b6282);})['then'](function(_0x5a9612){_0x203b07[_0x127c('0x40')]=_0x5a9612;return _0x203b07;})['then'](respondWithFilteredResult(_0x5d594e,_0x7b6282))[_0x127c('0x41')](handleError(_0x5d594e,null));};exports['show']=function(_0x30ad82,_0x25fbce){var _0x17ff70={'raw':![],'where':{'id':_0x30ad82[_0x127c('0x42')]['id']}},_0x43611f={};_0x43611f[_0x127c('0x2f')]=_[_0x127c('0x43')](db[_0x127c('0x2b')][_0x127c('0x44')]);_0x43611f[_0x127c('0x31')]=_['keys'](_0x30ad82[_0x127c('0x31')]);_0x43611f[_0x127c('0x32')]=_['intersection'](_0x43611f[_0x127c('0x2f')],_0x43611f['query']);_0x17ff70['attributes']=_[_0x127c('0x33')](_0x43611f['model'],qs[_0x127c('0x35')](_0x30ad82[_0x127c('0x31')][_0x127c('0x35')]));_0x17ff70['attributes']=_0x17ff70[_0x127c('0x34')]['length']?_0x17ff70['attributes']:_0x43611f[_0x127c('0x2f')];if(_0x30ad82[_0x127c('0x31')]['includeAll']){_0x17ff70[_0x127c('0x45')]=[{'all':!![]}];}_0x17ff70=_['merge']({},_0x17ff70,_0x30ad82['options']);return db[_0x127c('0x2b')][_0x127c('0x46')](_0x17ff70)[_0x127c('0x27')](handleEntityNotFound(_0x25fbce,null))[_0x127c('0x27')](respondWithResult(_0x25fbce,null))[_0x127c('0x41')](handleError(_0x25fbce,null));};exports[_0x127c('0x47')]=function(_0x44c433,_0x576225){return db['UserProfileSection'][_0x127c('0x47')](_0x44c433[_0x127c('0x48')],{})[_0x127c('0x27')](respondWithResult(_0x576225,0xc9))[_0x127c('0x41')](handleError(_0x576225,null));};exports['update']=function(_0x505524,_0x160905){if(_0x505524[_0x127c('0x48')]['id']){delete _0x505524[_0x127c('0x48')]['id'];}return db[_0x127c('0x2b')][_0x127c('0x46')]({'where':{'id':_0x505524['params']['id']}})[_0x127c('0x27')](handleEntityNotFound(_0x160905,null))['then'](saveUpdates(_0x505524[_0x127c('0x48')],null))[_0x127c('0x27')](respondWithResult(_0x160905,null))[_0x127c('0x41')](handleError(_0x160905,null));};exports[_0x127c('0x28')]=function(_0x4b9aaa,_0x3e1c9e){return db['UserProfileSection'][_0x127c('0x46')]({'where':{'id':_0x4b9aaa[_0x127c('0x42')]['id']}})[_0x127c('0x27')](handleEntityNotFound(_0x3e1c9e,null))[_0x127c('0x27')](removeEntity(_0x3e1c9e,null))[_0x127c('0x41')](handleError(_0x3e1c9e,null));};exports[_0x127c('0x49')]=function(_0x50bf9b,_0x139028){return db[_0x127c('0x2b')][_0x127c('0x49')]()[_0x127c('0x27')](respondWithResult(_0x139028,null))[_0x127c('0x41')](handleError(_0x139028,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 0bbf7d1..f54dad6 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 _0xdede=['define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports'];(function(_0x8fc9d1,_0x55be5e){var _0x445c72=function(_0x3dd633){while(--_0x3dd633){_0x8fc9d1['push'](_0x8fc9d1['shift']());}};_0x445c72(++_0x55be5e);}(_0xdede,0x125));var _0xeded=function(_0x51d35b,_0x156e1a){_0x51d35b=_0x51d35b-0x0;var _0xe307fe=_0xdede[_0x51d35b];return _0xe307fe;};'use strict';var _=require(_0xeded('0x0'));var util=require(_0xeded('0x1'));var logger=require(_0xeded('0x2'))('api');var moment=require(_0xeded('0x3'));var BPromise=require(_0xeded('0x4'));var rp=require(_0xeded('0x5'));var fs=require('fs');var path=require(_0xeded('0x6'));var rimraf=require(_0xeded('0x7'));var config=require(_0xeded('0x8'));var attributes=require(_0xeded('0x9'));module[_0xeded('0xa')]=function(_0x1171c1,_0x428836){return _0x1171c1[_0xeded('0xb')](_0xeded('0xc'),attributes,{'tableName':_0xeded('0xd'),'paranoid':![],'indexes':[{'name':_0xeded('0xe'),'fields':['sectionId',_0xeded('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c7d=['user_profile_has_sections','compositeIndex','userProfileId','lodash','util','path','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection'];(function(_0x101125,_0x2c5953){var _0x40f6b0=function(_0x58a6fc){while(--_0x58a6fc){_0x101125['push'](_0x101125['shift']());}};_0x40f6b0(++_0x2c5953);}(_0x9c7d,0x1f2));var _0xd9c7=function(_0x1428d9,_0xded63c){_0x1428d9=_0x1428d9-0x0;var _0x438019=_0x9c7d[_0x1428d9];return _0x438019;};'use strict';var _=require(_0xd9c7('0x0'));var util=require(_0xd9c7('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd9c7('0x2'));var rimraf=require('rimraf');var config=require(_0xd9c7('0x3'));var attributes=require(_0xd9c7('0x4'));module[_0xd9c7('0x5')]=function(_0x741125,_0x45c14c){return _0x741125[_0xd9c7('0x6')](_0xd9c7('0x7'),attributes,{'tableName':_0xd9c7('0x8'),'paranoid':![],'indexes':[{'name':_0xd9c7('0x9'),'fields':['sectionId',_0xd9c7('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 735900e..5674e86 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 _0xebba=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x150fc8,_0x2ac027){var _0x4771c8=function(_0x36f699){while(--_0x36f699){_0x150fc8['push'](_0x150fc8['shift']());}};_0x4771c8(++_0x2ac027);}(_0xebba,0x14e));var _0xaebb=function(_0x30c644,_0x14efc7){_0x30c644=_0x30c644-0x0;var _0x256156=_0xebba[_0x30c644];return _0x256156;};'use strict';var _=require(_0xaebb('0x0'));var util=require(_0xaebb('0x1'));var moment=require('moment');var BPromise=require(_0xaebb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaebb('0x3'));var db=require(_0xaebb('0x4'))['db'];var utils=require(_0xaebb('0x5'));var logger=require('../../config/logger')(_0xaebb('0x6'));var config=require(_0xaebb('0x7'));var jayson=require(_0xaebb('0x8'));var client=jayson[_0xaebb('0x9')][_0xaebb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x142d6e,_0x45843e,_0x8fb963){return new BPromise(function(_0x529787,_0xd270d8){return client[_0xaebb('0xb')](_0x142d6e,_0x8fb963)[_0xaebb('0xc')](function(_0x195062){logger[_0xaebb('0xd')](_0xaebb('0xe'),_0x45843e,_0xaebb('0xf'));logger[_0xaebb('0x10')](_0xaebb('0x11'),_0x45843e,_0xaebb('0xf'),JSON[_0xaebb('0x12')](_0x195062));if(_0x195062[_0xaebb('0x13')]){if(_0x195062['error'][_0xaebb('0x14')]===0x1f4){logger['error'](_0xaebb('0xe'),_0x45843e,_0x195062[_0xaebb('0x13')]['message']);return _0xd270d8(_0x195062[_0xaebb('0x13')][_0xaebb('0x15')]);}logger[_0xaebb('0x13')](_0xaebb('0xe'),_0x45843e,_0x195062[_0xaebb('0x13')][_0xaebb('0x15')]);return _0x529787(_0x195062[_0xaebb('0x13')][_0xaebb('0x15')]);}else{logger[_0xaebb('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x45843e,_0xaebb('0xf'));_0x529787(_0x195062[_0xaebb('0x16')][_0xaebb('0x15')]);}})[_0xaebb('0x17')](function(_0x33544c){logger[_0xaebb('0x13')](_0xaebb('0xe'),_0x45843e,_0x33544c);_0xd270d8(_0x33544c);});});} \ No newline at end of file +var _0x9942=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x391f30,_0x57ff58){var _0x2694f6=function(_0x922c21){while(--_0x922c21){_0x391f30['push'](_0x391f30['shift']());}};_0x2694f6(++_0x57ff58);}(_0x9942,0x164));var _0x2994=function(_0x96a05,_0x1f4b8c){_0x96a05=_0x96a05-0x0;var _0x253e31=_0x9942[_0x96a05];return _0x253e31;};'use strict';var _=require(_0x2994('0x0'));var util=require(_0x2994('0x1'));var moment=require(_0x2994('0x2'));var BPromise=require(_0x2994('0x3'));var rs=require(_0x2994('0x4'));var fs=require('fs');var Redis=require(_0x2994('0x5'));var db=require(_0x2994('0x6'))['db'];var utils=require(_0x2994('0x7'));var logger=require('../../config/logger')(_0x2994('0x8'));var config=require('../../config/environment');var jayson=require(_0x2994('0x9'));var client=jayson[_0x2994('0xa')][_0x2994('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fb933,_0x6a9b30,_0x593e07){return new BPromise(function(_0x50173d,_0x27917c){return client[_0x2994('0xc')](_0x4fb933,_0x593e07)[_0x2994('0xd')](function(_0x3d4a07){logger[_0x2994('0xe')](_0x2994('0xf'),_0x6a9b30,'request\x20sent');logger[_0x2994('0x10')](_0x2994('0x11'),_0x6a9b30,_0x2994('0x12'),JSON[_0x2994('0x13')](_0x3d4a07));if(_0x3d4a07[_0x2994('0x14')]){if(_0x3d4a07['error']['code']===0x1f4){logger[_0x2994('0x14')](_0x2994('0xf'),_0x6a9b30,_0x3d4a07['error']['message']);return _0x27917c(_0x3d4a07[_0x2994('0x14')][_0x2994('0x15')]);}logger[_0x2994('0x14')](_0x2994('0xf'),_0x6a9b30,_0x3d4a07[_0x2994('0x14')]['message']);return _0x50173d(_0x3d4a07[_0x2994('0x14')][_0x2994('0x15')]);}else{logger[_0x2994('0xe')](_0x2994('0xf'),_0x6a9b30,_0x2994('0x12'));_0x50173d(_0x3d4a07[_0x2994('0x16')][_0x2994('0x15')]);}})[_0x2994('0x17')](function(_0x165ece){logger[_0x2994('0x14')](_0x2994('0xf'),_0x6a9b30,_0x165ece);_0x27917c(_0x165ece);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 2aa4052..2fe02ed 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xef53cf,_0x10e341){var _0x139d45=function(_0x21d91b){while(--_0x21d91b){_0xef53cf['push'](_0xef53cf['shift']());}};_0x139d45(++_0x10e341);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x21bfab,_0x2fee48){_0x21bfab=_0x21bfab-0x0;var _0x4db318=_0xcb91[_0x21bfab];return _0x4db318;};'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(_0x2bf743,_0x2712ce){var _0x5ee3eb=function(_0x3f0f7e){while(--_0x3f0f7e){_0x2bf743['push'](_0x2bf743['shift']());}};_0x5ee3eb(++_0x2712ce);}(_0x70e0,0x17b));var _0x070e=function(_0x2d74ee,_0xfe0055){_0x2d74ee=_0x2d74ee-0x0;var _0x4deb02=_0x70e0[_0x2d74ee];return _0x4deb02;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 080e4d3..3eed37b 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 _0x4215=['exports','sequelize'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x4215,0x19f));var _0x5421=function(_0x5d4ca7,_0x19113b){_0x5d4ca7=_0x5d4ca7-0x0;var _0x3efc03=_0x4215[_0x5d4ca7];return _0x3efc03;};'use strict';var Sequelize=require(_0x5421('0x0'));module[_0x5421('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7393=['exports','INTEGER','sequelize'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7393,0x1dc));var _0x3739=function(_0x289d82,_0x142716){_0x289d82=_0x289d82-0x0;var _0x57b0b0=_0x7393[_0x289d82];return _0x57b0b0;};'use strict';var Sequelize=require(_0x3739('0x0'));module[_0x3739('0x1')]={'penalty':{'type':Sequelize[_0x3739('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 fbf8903..a28052a 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 _0xc9c3=['path','rimraf','../../config/environment','./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues','../../config/logger','moment','bluebird','request-promise'];(function(_0x24618a,_0x2cd0f4){var _0x2e3d64=function(_0x28c59c){while(--_0x28c59c){_0x24618a['push'](_0x24618a['shift']());}};_0x2e3d64(++_0x2cd0f4);}(_0xc9c3,0x96));var _0x3c9c=function(_0x4ea8ad,_0x1b7dea){_0x4ea8ad=_0x4ea8ad-0x0;var _0xc792cf=_0xc9c3[_0x4ea8ad];return _0xc792cf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3c9c('0x0'))('api');var moment=require(_0x3c9c('0x1'));var BPromise=require(_0x3c9c('0x2'));var rp=require(_0x3c9c('0x3'));var fs=require('fs');var path=require(_0x3c9c('0x4'));var rimraf=require(_0x3c9c('0x5'));var config=require(_0x3c9c('0x6'));var attributes=require(_0x3c9c('0x7'));module['exports']=function(_0x48b219,_0x5c86bd){return _0x48b219[_0x3c9c('0x8')](_0x3c9c('0x9'),attributes,{'tableName':_0x3c9c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6b0=['rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','moment','bluebird','request-promise'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x1a3e9b,_0x15979b){_0x1a3e9b=_0x1a3e9b-0x0;var _0x5edb48=_0xa6b0[_0x1a3e9b];return _0x5edb48;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a6b('0x2'));var BPromise=require(_0x0a6b('0x3'));var rp=require(_0x0a6b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var attributes=require(_0x0a6b('0x7'));module[_0x0a6b('0x8')]=function(_0x3dc2b0,_0x3b6967){return _0x3dc2b0[_0x0a6b('0x9')](_0x0a6b('0xa'),attributes,{'tableName':_0x0a6b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 2f50ed6..cd791e5 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 _0xdd42=['debug','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xdd42,0xed));var _0x2dd4=function(_0x3c9974,_0x1c35fe){_0x3c9974=_0x3c9974-0x0;var _0x47100a=_0xdd42[_0x3c9974];return _0x47100a;};'use strict';var _=require(_0x2dd4('0x0'));var util=require(_0x2dd4('0x1'));var moment=require(_0x2dd4('0x2'));var BPromise=require(_0x2dd4('0x3'));var rs=require(_0x2dd4('0x4'));var fs=require('fs');var Redis=require(_0x2dd4('0x5'));var db=require(_0x2dd4('0x6'))['db'];var utils=require(_0x2dd4('0x7'));var logger=require(_0x2dd4('0x8'))('rpc');var config=require(_0x2dd4('0x9'));var jayson=require(_0x2dd4('0xa'));var client=jayson[_0x2dd4('0xb')][_0x2dd4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x43c652,_0x427751,_0x5ac101){return new BPromise(function(_0x2fad3e,_0x154516){return client[_0x2dd4('0xd')](_0x43c652,_0x5ac101)['then'](function(_0x1c341a){logger[_0x2dd4('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x427751,_0x2dd4('0xf'));logger[_0x2dd4('0x10')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x427751,_0x2dd4('0xf'),JSON[_0x2dd4('0x11')](_0x1c341a));if(_0x1c341a[_0x2dd4('0x12')]){if(_0x1c341a['error'][_0x2dd4('0x13')]===0x1f4){logger[_0x2dd4('0x12')](_0x2dd4('0x14'),_0x427751,_0x1c341a[_0x2dd4('0x12')][_0x2dd4('0x15')]);return _0x154516(_0x1c341a[_0x2dd4('0x12')][_0x2dd4('0x15')]);}logger[_0x2dd4('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x427751,_0x1c341a[_0x2dd4('0x12')][_0x2dd4('0x15')]);return _0x2fad3e(_0x1c341a[_0x2dd4('0x12')][_0x2dd4('0x15')]);}else{logger[_0x2dd4('0xe')](_0x2dd4('0x14'),_0x427751,_0x2dd4('0xf'));_0x2fad3e(_0x1c341a[_0x2dd4('0x16')][_0x2dd4('0x15')]);}})['catch'](function(_0x293208){logger[_0x2dd4('0x12')](_0x2dd4('0x14'),_0x427751,_0x293208);_0x154516(_0x293208);});});} \ No newline at end of file +var _0x9923=['error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xee37f4,_0x2846a0){var _0x5207ec=function(_0x4470d2){while(--_0x4470d2){_0xee37f4['push'](_0xee37f4['shift']());}};_0x5207ec(++_0x2846a0);}(_0x9923,0x1d1));var _0x3992=function(_0x3ba566,_0x5e009d){_0x3ba566=_0x3ba566-0x0;var _0x480317=_0x9923[_0x3ba566];return _0x480317;};'use strict';var _=require(_0x3992('0x0'));var util=require('util');var moment=require(_0x3992('0x1'));var BPromise=require(_0x3992('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3992('0x3'));var db=require(_0x3992('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3992('0x5'))('rpc');var config=require(_0x3992('0x6'));var jayson=require(_0x3992('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2cb646,_0x582662,_0x43486a){return new BPromise(function(_0x45f641,_0x59fc6e){return client[_0x3992('0x8')](_0x2cb646,_0x43486a)[_0x3992('0x9')](function(_0x31e2a8){logger[_0x3992('0xa')](_0x3992('0xb'),_0x582662,_0x3992('0xc'));logger['debug'](_0x3992('0xd'),_0x582662,_0x3992('0xc'),JSON[_0x3992('0xe')](_0x31e2a8));if(_0x31e2a8[_0x3992('0xf')]){if(_0x31e2a8[_0x3992('0xf')][_0x3992('0x10')]===0x1f4){logger[_0x3992('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x582662,_0x31e2a8[_0x3992('0xf')][_0x3992('0x11')]);return _0x59fc6e(_0x31e2a8['error'][_0x3992('0x11')]);}logger[_0x3992('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x582662,_0x31e2a8['error']['message']);return _0x45f641(_0x31e2a8['error'][_0x3992('0x11')]);}else{logger[_0x3992('0xa')](_0x3992('0xb'),_0x582662,_0x3992('0xc'));_0x45f641(_0x31e2a8[_0x3992('0x12')][_0x3992('0x11')]);}})[_0x3992('0x13')](function(_0x372496){logger[_0x3992('0xf')](_0x3992('0xb'),_0x582662,_0x372496);_0x59fc6e(_0x372496);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index bd15fdc..5468cb9 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 _0xdf17=['exports','INTEGER'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdf17,0xcc));var _0x7df1=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xdf17[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require('sequelize');module[_0x7df1('0x0')]={'UserId':{'type':Sequelize[_0x7df1('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x7df1('0x1')]}}; \ No newline at end of file +var _0x38ee=['INTEGER','sequelize','exports'];(function(_0x5e24d7,_0x11218f){var _0x10063d=function(_0x39fc21){while(--_0x39fc21){_0x5e24d7['push'](_0x5e24d7['shift']());}};_0x10063d(++_0x11218f);}(_0x38ee,0x6a));var _0xe38e=function(_0x27b7d2,_0x56c091){_0x27b7d2=_0x27b7d2-0x0;var _0x3ef6be=_0x38ee[_0x27b7d2];return _0x3ef6be;};'use strict';var Sequelize=require(_0xe38e('0x0'));module[_0xe38e('0x1')]={'UserId':{'type':Sequelize[_0xe38e('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xe38e('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 7e38998..292233a 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(_0x9e14ab,_0x457573){var _0x23bd04=function(_0x3b16f9){while(--_0x3b16f9){_0x9e14ab['push'](_0x9e14ab['shift']());}};_0x23bd04(++_0x457573);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x28409d,_0x458a30){var _0xb35ec0=function(_0x384ca9){while(--_0x384ca9){_0x28409d['push'](_0x28409d['shift']());}};_0xb35ec0(++_0x458a30);}(_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 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 8f4ef7f..e2e9119 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x46b01f,_0x43dc27){var _0x5b091a=function(_0x2d9713){while(--_0x2d9713){_0x46b01f['push'](_0x46b01f['shift']());}};_0x5b091a(++_0x43dc27);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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(_0x29b4d5,_0x5b94c7){var _0x241d61=function(_0x127991){while(--_0x127991){_0x29b4d5['push'](_0x29b4d5['shift']());}};_0x241d61(++_0x5b94c7);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 3f9ad83..329933e 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 _0xa9e4=['INTEGER','sequelize','exports'];(function(_0x38122a,_0x31372d){var _0x52ef00=function(_0x694fa8){while(--_0x694fa8){_0x38122a['push'](_0x38122a['shift']());}};_0x52ef00(++_0x31372d);}(_0xa9e4,0xbb));var _0x4a9e=function(_0x1a1c17,_0x333d85){_0x1a1c17=_0x1a1c17-0x0;var _0x3c19de=_0xa9e4[_0x1a1c17];return _0x3c19de;};'use strict';var Sequelize=require(_0x4a9e('0x0'));module[_0x4a9e('0x1')]={'penalty':{'type':Sequelize[_0x4a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x16be=['exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x16be,0x146));var _0xe16b=function(_0x65b942,_0x3ac459){_0x65b942=_0x65b942-0x0;var _0x522363=_0x16be[_0x65b942];return _0x522363;};'use strict';var Sequelize=require('sequelize');module[_0xe16b('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'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 b1ac42c..176516b 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 _0x3dbd=['user_has_voice_queues','api','moment','request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports','define'];(function(_0x3d5351,_0x27bc80){var _0x1db4db=function(_0x3f572b){while(--_0x3f572b){_0x3d5351['push'](_0x3d5351['shift']());}};_0x1db4db(++_0x27bc80);}(_0x3dbd,0x160));var _0xd3db=function(_0x3315ff,_0x321860){_0x3315ff=_0x3315ff-0x0;var _0xec5af2=_0x3dbd[_0x3315ff];return _0xec5af2;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd3db('0x0'));var moment=require(_0xd3db('0x1'));var BPromise=require('bluebird');var rp=require(_0xd3db('0x2'));var fs=require('fs');var path=require(_0xd3db('0x3'));var rimraf=require('rimraf');var config=require(_0xd3db('0x4'));var attributes=require(_0xd3db('0x5'));module[_0xd3db('0x6')]=function(_0x5c5dc3,_0x39ee13){return _0x5c5dc3[_0xd3db('0x7')]('UserVoiceQueue',attributes,{'tableName':_0xd3db('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d71=['path','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','util','api','moment','bluebird','request-promise'];(function(_0x45d2cf,_0x16cbd0){var _0x5bfef6=function(_0x461c91){while(--_0x461c91){_0x45d2cf['push'](_0x45d2cf['shift']());}};_0x5bfef6(++_0x16cbd0);}(_0x7d71,0x17c));var _0x17d7=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x7d71[_0x381589];return _0x2a075d;};'use strict';var _=require('lodash');var util=require(_0x17d7('0x0'));var logger=require('../../config/logger')(_0x17d7('0x1'));var moment=require(_0x17d7('0x2'));var BPromise=require(_0x17d7('0x3'));var rp=require(_0x17d7('0x4'));var fs=require('fs');var path=require(_0x17d7('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x17d7('0x6'));module[_0x17d7('0x7')]=function(_0x20ff0e,_0x207381){return _0x20ff0e[_0x17d7('0x8')](_0x17d7('0x9'),attributes,{'tableName':_0x17d7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 799f799..4f08c9d 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 _0xef93=['../../config/utils','../../config/logger','jayson/promise','client','request','then','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserVoiceQueue,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x181777,_0x226350){var _0x43c330=function(_0x4056c4){while(--_0x4056c4){_0x181777['push'](_0x181777['shift']());}};_0x43c330(++_0x226350);}(_0xef93,0x18a));var _0x3ef9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xef93[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3ef9('0x0'));var util=require('util');var moment=require(_0x3ef9('0x1'));var BPromise=require(_0x3ef9('0x2'));var rs=require(_0x3ef9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ef9('0x4'))['db'];var utils=require(_0x3ef9('0x5'));var logger=require(_0x3ef9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3ef9('0x7'));var client=jayson[_0x3ef9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x266e4b,_0x429529,_0x479982){return new BPromise(function(_0x595749,_0x2fa32f){return client[_0x3ef9('0x9')](_0x266e4b,_0x479982)[_0x3ef9('0xa')](function(_0x1a138b){logger[_0x3ef9('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x429529,_0x3ef9('0xc'));logger[_0x3ef9('0xd')](_0x3ef9('0xe'),_0x429529,'request\x20sent',JSON[_0x3ef9('0xf')](_0x1a138b));if(_0x1a138b[_0x3ef9('0x10')]){if(_0x1a138b[_0x3ef9('0x10')][_0x3ef9('0x11')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x429529,_0x1a138b[_0x3ef9('0x10')]['message']);return _0x2fa32f(_0x1a138b['error'][_0x3ef9('0x12')]);}logger[_0x3ef9('0x10')](_0x3ef9('0x13'),_0x429529,_0x1a138b[_0x3ef9('0x10')]['message']);return _0x595749(_0x1a138b[_0x3ef9('0x10')][_0x3ef9('0x12')]);}else{logger[_0x3ef9('0xb')](_0x3ef9('0x13'),_0x429529,_0x3ef9('0xc'));_0x595749(_0x1a138b[_0x3ef9('0x14')][_0x3ef9('0x12')]);}})['catch'](function(_0x5ce812){logger[_0x3ef9('0x10')](_0x3ef9('0x13'),_0x429529,_0x5ce812);_0x2fa32f(_0x5ce812);});});} \ No newline at end of file +var _0x3b74=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','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','lodash','util','bluebird'];(function(_0x141c86,_0x1c83ac){var _0x433f76=function(_0x5aeaef){while(--_0x5aeaef){_0x141c86['push'](_0x141c86['shift']());}};_0x433f76(++_0x1c83ac);}(_0x3b74,0x70));var _0x43b7=function(_0x198885,_0x2f71b6){_0x198885=_0x198885-0x0;var _0x3b0ca0=_0x3b74[_0x198885];return _0x3b0ca0;};'use strict';var _=require(_0x43b7('0x0'));var util=require(_0x43b7('0x1'));var moment=require('moment');var BPromise=require(_0x43b7('0x2'));var rs=require(_0x43b7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43b7('0x4'))['db'];var utils=require(_0x43b7('0x5'));var logger=require(_0x43b7('0x6'))(_0x43b7('0x7'));var config=require('../../config/environment');var jayson=require(_0x43b7('0x8'));var client=jayson[_0x43b7('0x9')][_0x43b7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21565c,_0x461443,_0x3885bf){return new BPromise(function(_0x2dc61d,_0x5b340){return client['request'](_0x21565c,_0x3885bf)[_0x43b7('0xb')](function(_0x1fca57){logger[_0x43b7('0xc')](_0x43b7('0xd'),_0x461443,_0x43b7('0xe'));logger[_0x43b7('0xf')](_0x43b7('0x10'),_0x461443,'request\x20sent',JSON[_0x43b7('0x11')](_0x1fca57));if(_0x1fca57[_0x43b7('0x12')]){if(_0x1fca57[_0x43b7('0x12')][_0x43b7('0x13')]===0x1f4){logger[_0x43b7('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x461443,_0x1fca57[_0x43b7('0x12')]['message']);return _0x5b340(_0x1fca57[_0x43b7('0x12')][_0x43b7('0x14')]);}logger[_0x43b7('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x461443,_0x1fca57[_0x43b7('0x12')][_0x43b7('0x14')]);return _0x2dc61d(_0x1fca57[_0x43b7('0x12')]['message']);}else{logger['info'](_0x43b7('0xd'),_0x461443,_0x43b7('0xe'));_0x2dc61d(_0x1fca57[_0x43b7('0x15')][_0x43b7('0x14')]);}})[_0x43b7('0x16')](function(_0x5989bc){logger[_0x43b7('0x12')](_0x43b7('0xd'),_0x461443,_0x5989bc);_0x5b340(_0x5989bc);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index d6e9992..03841ab 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x550ec7,_0x181ebe){var _0x12b407=function(_0x1c3e92){while(--_0x1c3e92){_0x550ec7['push'](_0x550ec7['shift']());}};_0x12b407(++_0x181ebe);}(_0x70e0,0x17b));var _0x070e=function(_0x1aff7c,_0x305fe5){_0x1aff7c=_0x1aff7c-0x0;var _0x35c370=_0x70e0[_0x1aff7c];return _0x35c370;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3c8891,_0x468cb1){var _0xf0ad17=function(_0x117a0c){while(--_0x117a0c){_0x3c8891['push'](_0x3c8891['shift']());}};_0xf0ad17(++_0x468cb1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x685346,_0x3ef2e5){_0x685346=_0x685346-0x0;var _0x52e15b=_0xcb91[_0x685346];return _0x52e15b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index d4704de..a9cc243 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 _0xb4f2=['queue_interface','sequelize','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0xb4f2,0x196));var _0x2b4f=function(_0x18da1c,_0x404b72){_0x18da1c=_0x18da1c-0x0;var _0x26cbe6=_0xb4f2[_0x18da1c];return _0x26cbe6;};'use strict';var Sequelize=require(_0x2b4f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x2b4f('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x2b4f('0x2')},'membername':{'type':Sequelize[_0x2b4f('0x3')],'allowNull':![],'comment':_0x2b4f('0x2')},'UserId':{'type':Sequelize[_0x2b4f('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x2b4f('0x3')],'allowNull':![],'unique':_0x2b4f('0x4'),'comment':_0x2b4f('0x2')},'VoiceQueueId':{'type':Sequelize[_0x2b4f('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2b4f('0x4'),'comment':_0x2b4f('0x2')},'penalty':{'type':Sequelize[_0x2b4f('0x1')](0xb),'defaultValue':0x0,'comment':_0x2b4f('0x2')},'paused':{'type':Sequelize[_0x2b4f('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x750c=['queue_interface','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x1e4a8e,_0x18022b){var _0x5408f9=function(_0x4ef2ed){while(--_0x4ef2ed){_0x1e4a8e['push'](_0x1e4a8e['shift']());}};_0x5408f9(++_0x18022b);}(_0x750c,0x1d2));var _0xc750=function(_0x120104,_0x47ceb5){_0x120104=_0x120104-0x0;var _0x13fba0=_0x750c[_0x120104];return _0x13fba0;};'use strict';var Sequelize=require('sequelize');module[_0xc750('0x0')]={'uniqueid':{'type':Sequelize[_0xc750('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xc750('0x2')},'membername':{'type':Sequelize[_0xc750('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xc750('0x3')],'allowNull':![],'unique':_0xc750('0x4'),'comment':_0xc750('0x2')},'VoiceQueueId':{'type':Sequelize[_0xc750('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0xc750('0x3')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xc750('0x1')](0xb),'defaultValue':0x0,'comment':_0xc750('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 69fef04..63103e6 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 _0xa740=['save','update','emit','hasOwnProperty','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x36fbef,_0x4ffc84){var _0x45e270=function(_0x32dd95){while(--_0x32dd95){_0x36fbef['push'](_0x36fbef['shift']());}};_0x45e270(++_0x4ffc84);}(_0xa740,0x7c));var _0x0a74=function(_0xca5256,_0x578467){_0xca5256=_0xca5256-0x0;var _0x1fe79d=_0xa740[_0xca5256];return _0x1fe79d;};'use strict';var EventEmitter=require(_0x0a74('0x0'));var UserVoiceQueueRt=require(_0x0a74('0x1'))['db'][_0x0a74('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x0a74('0x3')](0x0);var events={'afterCreate':_0x0a74('0x4'),'afterUpdate':_0x0a74('0x5'),'afterDestroy':'remove'};function emitEvent(_0x22eca3){return function(_0x3e9ba9,_0x2c7f09,_0x5a49c2){UserVoiceQueueRtEvents[_0x0a74('0x6')](_0x22eca3+':'+_0x3e9ba9['id'],_0x3e9ba9);UserVoiceQueueRtEvents[_0x0a74('0x6')](_0x22eca3,_0x3e9ba9);_0x5a49c2(null);};}for(var e in events){if(events[_0x0a74('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xcb79=['exports','events','../../mysqldb','UserVoiceQueueRt','save','emit','hasOwnProperty','hook'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0xcb79,0x1d9));var _0x9cb7=function(_0x16eaba,_0x207897){_0x16eaba=_0x16eaba-0x0;var _0x605552=_0xcb79[_0x16eaba];return _0x605552;};'use strict';var EventEmitter=require(_0x9cb7('0x0'));var UserVoiceQueueRt=require(_0x9cb7('0x1'))['db'][_0x9cb7('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9cb7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x336ada){return function(_0x4aad12,_0x4f644a,_0x379caa){UserVoiceQueueRtEvents[_0x9cb7('0x4')](_0x336ada+':'+_0x4aad12['id'],_0x4aad12);UserVoiceQueueRtEvents['emit'](_0x336ada,_0x4aad12);_0x379caa(null);};}for(var e in events){if(events[_0x9cb7('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x9cb7('0x6')](e,emitEvent(event));}}module[_0x9cb7('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index ad66e41..0d23c57 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 _0x4364=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash'];(function(_0x140df6,_0x397d73){var _0x639fcc=function(_0x25328d){while(--_0x25328d){_0x140df6['push'](_0x140df6['shift']());}};_0x639fcc(++_0x397d73);}(_0x4364,0x12a));var _0x4436=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x4364[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x4436('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4436('0x1'));var moment=require(_0x4436('0x2'));var BPromise=require(_0x4436('0x3'));var rp=require(_0x4436('0x4'));var fs=require('fs');var path=require(_0x4436('0x5'));var rimraf=require(_0x4436('0x6'));var config=require(_0x4436('0x7'));var attributes=require(_0x4436('0x8'));module[_0x4436('0x9')]=function(_0x5769e3,_0x128950){return _0x5769e3[_0x4436('0xa')](_0x4436('0xb'),attributes,{'tableName':_0x4436('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5cc=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe5cc,0x108));var _0xce5c=function(_0x323973,_0x3fc474){_0x323973=_0x323973-0x0;var _0x1c569a=_0xe5cc[_0x323973];return _0x1c569a;};'use strict';var _=require(_0xce5c('0x0'));var util=require(_0xce5c('0x1'));var logger=require(_0xce5c('0x2'))(_0xce5c('0x3'));var moment=require(_0xce5c('0x4'));var BPromise=require(_0xce5c('0x5'));var rp=require(_0xce5c('0x6'));var fs=require('fs');var path=require(_0xce5c('0x7'));var rimraf=require(_0xce5c('0x8'));var config=require(_0xce5c('0x9'));var attributes=require(_0xce5c('0xa'));module[_0xce5c('0xb')]=function(_0x26814b,_0x255fbf){return _0x26814b[_0xce5c('0xc')](_0xce5c('0xd'),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 057f617..47b4fe2 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 _0x393a=['socket.io-emitter','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','literal','outboundQueuePauses','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost'];(function(_0x26013b,_0x23d44e){var _0x16a91f=function(_0x1bb368){while(--_0x1bb368){_0x26013b['push'](_0x26013b['shift']());}};_0x16a91f(++_0x23d44e);}(_0x393a,0x177));var _0xa393=function(_0x2081aa,_0x31d653){_0x2081aa=_0x2081aa-0x0;var _0x36485d=_0x393a[_0x2081aa];return _0x36485d;};'use strict';var _=require('lodash');var util=require(_0xa393('0x0'));var moment=require(_0xa393('0x1'));var BPromise=require(_0xa393('0x2'));var rs=require(_0xa393('0x3'));var fs=require('fs');var Redis=require(_0xa393('0x4'));var db=require(_0xa393('0x5'))['db'];var utils=require(_0xa393('0x6'));var logger=require(_0xa393('0x7'))(_0xa393('0x8'));var config=require(_0xa393('0x9'));var jayson=require(_0xa393('0xa'));var client=jayson[_0xa393('0xb')]['http']({'port':0x232a});config[_0xa393('0xc')]=_[_0xa393('0xd')](config[_0xa393('0xc')],{'host':_0xa393('0xe'),'port':0x18eb});var socket=require(_0xa393('0xf'))(new Redis(config[_0xa393('0xc')]));require(_0xa393('0x10'))['register'](socket);function respondWithRpcPromise(_0x1ad2fb,_0x18e813,_0x18ed76){return new BPromise(function(_0x1908ae,_0x35d6f9){return client[_0xa393('0x11')](_0x1ad2fb,_0x18ed76)[_0xa393('0x12')](function(_0x4c4f5d){logger[_0xa393('0x13')](_0xa393('0x14'),_0x18e813,_0xa393('0x15'));logger[_0xa393('0x16')](_0xa393('0x17'),_0x18e813,_0xa393('0x15'),JSON[_0xa393('0x18')](_0x4c4f5d));if(_0x4c4f5d[_0xa393('0x19')]){if(_0x4c4f5d[_0xa393('0x19')][_0xa393('0x1a')]===0x1f4){logger[_0xa393('0x19')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x18e813,_0x4c4f5d[_0xa393('0x19')]['message']);return _0x35d6f9(_0x4c4f5d[_0xa393('0x19')][_0xa393('0x1b')]);}logger[_0xa393('0x19')](_0xa393('0x14'),_0x18e813,_0x4c4f5d['error'][_0xa393('0x1b')]);return _0x1908ae(_0x4c4f5d[_0xa393('0x19')][_0xa393('0x1b')]);}else{logger[_0xa393('0x13')](_0xa393('0x14'),_0x18e813,_0xa393('0x15'));_0x1908ae(_0x4c4f5d[_0xa393('0x1c')][_0xa393('0x1b')]);}})[_0xa393('0x1d')](function(_0x5cb847){logger[_0xa393('0x19')](_0xa393('0x14'),_0x18e813,_0x5cb847);_0x35d6f9(_0x5cb847);});});}exports[_0xa393('0x1e')]=function(_0xdd9f21){var _0x136bb5=this;return new Promise(function(_0x122672,_0x5d72d0){return db[_0xa393('0x1f')][_0xa393('0x20')]({'raw':_0xdd9f21[_0xa393('0x21')]?_0xdd9f21[_0xa393('0x21')][_0xa393('0x22')]===undefined?!![]:![]:!![],'where':_0xdd9f21[_0xa393('0x21')]?_0xdd9f21['options'][_0xa393('0x23')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa393('0x24')][_0xa393('0x25')]('`paused`\x20=\x201,\x201,\x20null'))),_0xa393('0x26')]]})[_0xa393('0x12')](function(_0x1cd4b5){logger[_0xa393('0x13')](_0xa393('0x1e'),_0xdd9f21);logger[_0xa393('0x16')](_0xa393('0x1e'),_0xdd9f21,JSON[_0xa393('0x18')](_0x1cd4b5));_0x122672(_0x1cd4b5);})[_0xa393('0x1d')](function(_0x5b133d){logger[_0xa393('0x19')]('GetVoiceQueueRtPauses',_0x5b133d['message'],_0xdd9f21);_0x5d72d0(_0x136bb5[_0xa393('0x19')](0x1f4,_0x5b133d['message']));});});}; \ No newline at end of file +var _0xa5fb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','then','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','literal','outboundQueuePauses','info','util','moment','bluebird','randomstring'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa5fb,0x11c));var _0xba5f=function(_0x583b1a,_0x32628f){_0x583b1a=_0x583b1a-0x0;var _0x1ab538=_0xa5fb[_0x583b1a];return _0x1ab538;};'use strict';var _=require('lodash');var util=require(_0xba5f('0x0'));var moment=require(_0xba5f('0x1'));var BPromise=require(_0xba5f('0x2'));var rs=require(_0xba5f('0x3'));var fs=require('fs');var Redis=require(_0xba5f('0x4'));var db=require(_0xba5f('0x5'))['db'];var utils=require(_0xba5f('0x6'));var logger=require(_0xba5f('0x7'))(_0xba5f('0x8'));var config=require(_0xba5f('0x9'));var jayson=require(_0xba5f('0xa'));var client=jayson[_0xba5f('0xb')][_0xba5f('0xc')]({'port':0x232a});config[_0xba5f('0xd')]=_['defaults'](config[_0xba5f('0xd')],{'host':_0xba5f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0xba5f('0xf')](socket);function respondWithRpcPromise(_0x55fb48,_0x3cde82,_0x4e5071){return new BPromise(function(_0xd94fb0,_0x5c659e){return client['request'](_0x55fb48,_0x4e5071)[_0xba5f('0x10')](function(_0x4c5bb7){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x3cde82,_0xba5f('0x11'));logger[_0xba5f('0x12')](_0xba5f('0x13'),_0x3cde82,'request\x20sent',JSON['stringify'](_0x4c5bb7));if(_0x4c5bb7[_0xba5f('0x14')]){if(_0x4c5bb7[_0xba5f('0x14')][_0xba5f('0x15')]===0x1f4){logger[_0xba5f('0x14')](_0xba5f('0x16'),_0x3cde82,_0x4c5bb7[_0xba5f('0x14')][_0xba5f('0x17')]);return _0x5c659e(_0x4c5bb7[_0xba5f('0x14')]['message']);}logger['error'](_0xba5f('0x16'),_0x3cde82,_0x4c5bb7['error'][_0xba5f('0x17')]);return _0xd94fb0(_0x4c5bb7['error'][_0xba5f('0x17')]);}else{logger['info'](_0xba5f('0x16'),_0x3cde82,_0xba5f('0x11'));_0xd94fb0(_0x4c5bb7[_0xba5f('0x18')][_0xba5f('0x17')]);}})[_0xba5f('0x19')](function(_0x2661b6){logger[_0xba5f('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3cde82,_0x2661b6);_0x5c659e(_0x2661b6);});});}exports[_0xba5f('0x1a')]=function(_0x3bffe9){var _0x3f57d2=this;return new Promise(function(_0x5de00f,_0x12dab0){return db[_0xba5f('0x1b')][_0xba5f('0x1c')]({'raw':_0x3bffe9[_0xba5f('0x1d')]?_0x3bffe9[_0xba5f('0x1d')][_0xba5f('0x1e')]===undefined?!![]:![]:!![],'where':_0x3bffe9[_0xba5f('0x1d')]?_0x3bffe9[_0xba5f('0x1d')][_0xba5f('0x1f')]||null:null,'attributes':[[db[_0xba5f('0x20')]['fn']('COUNT',db[_0xba5f('0x20')]['fn']('IF',db[_0xba5f('0x20')][_0xba5f('0x21')]('`paused`\x20=\x201,\x201,\x20null'))),_0xba5f('0x22')]]})[_0xba5f('0x10')](function(_0x163874){logger[_0xba5f('0x23')](_0xba5f('0x1a'),_0x3bffe9);logger[_0xba5f('0x12')](_0xba5f('0x1a'),_0x3bffe9,JSON['stringify'](_0x163874));_0x5de00f(_0x163874);})[_0xba5f('0x19')](function(_0x201e2a){logger[_0xba5f('0x14')](_0xba5f('0x1a'),_0x201e2a[_0xba5f('0x17')],_0x3bffe9);_0x12dab0(_0x3f57d2['error'](0x1f4,_0x201e2a[_0xba5f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index bb7959e..6599c0d 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 _0xbb67=['removeListener','register','userVoiceQueueRt:','save','remove','update','emit'];(function(_0x3a3a20,_0x10bab9){var _0x5927ff=function(_0x3bb001){while(--_0x3bb001){_0x3a3a20['push'](_0x3a3a20['shift']());}};_0x5927ff(++_0x10bab9);}(_0xbb67,0x161));var _0x7bb6=function(_0x9331d9,_0x3c8c33){_0x9331d9=_0x9331d9-0x0;var _0x3235cc=_0xbb67[_0x9331d9];return _0x3235cc;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x7bb6('0x0'),_0x7bb6('0x1'),_0x7bb6('0x2')];function createListener(_0x35c9ba,_0x2a1dcb){return function(_0x5b8771){_0x2a1dcb[_0x7bb6('0x3')](_0x35c9ba,_0x5b8771);};}function removeListener(_0x2c1ddb,_0x1f527c){return function(){UserVoiceQueueRtEvents[_0x7bb6('0x4')](_0x2c1ddb,_0x1f527c);};}exports[_0x7bb6('0x5')]=function(_0x139b0e){for(var _0x4b5232=0x0,_0x2a059b=events['length'];_0x4b5232<_0x2a059b;_0x4b5232++){var _0x45441a=events[_0x4b5232];var _0x15fb32=createListener(_0x7bb6('0x6')+_0x45441a,_0x139b0e);UserVoiceQueueRtEvents['on'](_0x45441a,_0x15fb32);}}; \ No newline at end of file +var _0x36c3=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','update','emit','register'];(function(_0x3e4982,_0x5676bb){var _0x52263c=function(_0x12538e){while(--_0x12538e){_0x3e4982['push'](_0x3e4982['shift']());}};_0x52263c(++_0x5676bb);}(_0x36c3,0x1a6));var _0x336c=function(_0x2bf8ac,_0x4226be){_0x2bf8ac=_0x2bf8ac-0x0;var _0x3ef094=_0x36c3[_0x2bf8ac];return _0x3ef094;};'use strict';var UserVoiceQueueRtEvents=require(_0x336c('0x0'));var events=[_0x336c('0x1'),'remove',_0x336c('0x2')];function createListener(_0x34b4b2,_0x3368c2){return function(_0x194993){_0x3368c2[_0x336c('0x3')](_0x34b4b2,_0x194993);};}function removeListener(_0x2b1194,_0x39ed12){return function(){UserVoiceQueueRtEvents['removeListener'](_0x2b1194,_0x39ed12);};}exports[_0x336c('0x4')]=function(_0x2e0016){for(var _0x2097a8=0x0,_0x29a202=events[_0x336c('0x5')];_0x2097a8<_0x29a202;_0x2097a8++){var _0x4d1e4f=events[_0x2097a8];var _0x108bb0=createListener(_0x336c('0x6')+_0x4d1e4f,_0x2e0016);UserVoiceQueueRtEvents['on'](_0x4d1e4f,_0x108bb0);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index b88d6ad..a08aa3c 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xf1ae72,_0x27d2e2){var _0x1adfe6=function(_0x482204){while(--_0x482204){_0xf1ae72['push'](_0xf1ae72['shift']());}};_0x1adfe6(++_0x27d2e2);}(_0xe706,0xa3));var _0x6e70=function(_0x353a30,_0x50c68a){_0x353a30=_0x353a30-0x0;var _0x213161=_0xe706[_0x353a30];return _0x213161;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5504aa,_0x53d6a8){var _0x228a0e=function(_0x24bf02){while(--_0x24bf02){_0x5504aa['push'](_0x5504aa['shift']());}};_0x228a0e(++_0x53d6a8);}(_0x70e0,0x17b));var _0x070e=function(_0x59aa0b,_0x52b6a2){_0x59aa0b=_0x59aa0b-0x0;var _0x4b1415=_0x70e0[_0x59aa0b];return _0x4b1415;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 0c0ebd2..254f8eb 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 _0xdb26=['sequelize','INTEGER'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xdb26,0x16e));var _0x6db2=function(_0x2287c3,_0x2b34e2){_0x2287c3=_0x2287c3-0x0;var _0x448916=_0xdb26[_0x2287c3];return _0x448916;};'use strict';var Sequelize=require(_0x6db2('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x6db2('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe784=['sequelize','exports','INTEGER'];(function(_0x3d220d,_0x12312e){var _0x28e84e=function(_0xda148e){while(--_0xda148e){_0x3d220d['push'](_0x3d220d['shift']());}};_0x28e84e(++_0x12312e);}(_0xe784,0x1b9));var _0x4e78=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe784[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x4e78('0x0'));module[_0x4e78('0x1')]={'penalty':{'type':Sequelize[_0x4e78('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 dd8f637..ce5896d 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 _0xe5d7=['lodash','util','moment','bluebird','request-promise','path','../../config/environment','exports','define','user_has_whatsapp_queues'];(function(_0xbee717,_0x2aff37){var _0x2c2381=function(_0x5e072f){while(--_0x5e072f){_0xbee717['push'](_0xbee717['shift']());}};_0x2c2381(++_0x2aff37);}(_0xe5d7,0x122));var _0x7e5d=function(_0x39fb63,_0x1b6703){_0x39fb63=_0x39fb63-0x0;var _0x59eb5b=_0xe5d7[_0x39fb63];return _0x59eb5b;};'use strict';var _=require(_0x7e5d('0x0'));var util=require(_0x7e5d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7e5d('0x2'));var BPromise=require(_0x7e5d('0x3'));var rp=require(_0x7e5d('0x4'));var fs=require('fs');var path=require(_0x7e5d('0x5'));var rimraf=require('rimraf');var config=require(_0x7e5d('0x6'));var attributes=require('./userWhatsappQueue.attributes');module[_0x7e5d('0x7')]=function(_0x27d1df,_0x4ef874){return _0x27d1df[_0x7e5d('0x8')]('UserWhatsappQueue',attributes,{'tableName':_0x7e5d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdff8=['../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x4ec7f6,_0x5d143e){var _0xa2d8e4=function(_0x49b298){while(--_0x49b298){_0x4ec7f6['push'](_0x4ec7f6['shift']());}};_0xa2d8e4(++_0x5d143e);}(_0xdff8,0x117));var _0x8dff=function(_0x102789,_0x24217f){_0x102789=_0x102789-0x0;var _0x4aeb4f=_0xdff8[_0x102789];return _0x4aeb4f;};'use strict';var _=require(_0x8dff('0x0'));var util=require(_0x8dff('0x1'));var logger=require(_0x8dff('0x2'))(_0x8dff('0x3'));var moment=require('moment');var BPromise=require(_0x8dff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8dff('0x5'));var rimraf=require(_0x8dff('0x6'));var config=require(_0x8dff('0x7'));var attributes=require(_0x8dff('0x8'));module[_0x8dff('0x9')]=function(_0x5beec1,_0x18d504){return _0x5beec1[_0x8dff('0xa')](_0x8dff('0xb'),attributes,{'tableName':_0x8dff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index b0cf375..db6266a 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 _0x4023=['randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','bluebird'];(function(_0x11f4b5,_0x279f0d){var _0x59d5e0=function(_0x224edd){while(--_0x224edd){_0x11f4b5['push'](_0x11f4b5['shift']());}};_0x59d5e0(++_0x279f0d);}(_0x4023,0x1b3));var _0x3402=function(_0x4059d1,_0x10bb00){_0x4059d1=_0x4059d1-0x0;var _0x52bf17=_0x4023[_0x4059d1];return _0x52bf17;};'use strict';var _=require(_0x3402('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3402('0x1'));var rs=require(_0x3402('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3402('0x3'))(_0x3402('0x4'));var config=require(_0x3402('0x5'));var jayson=require(_0x3402('0x6'));var client=jayson[_0x3402('0x7')][_0x3402('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1281cb,_0x53fbde,_0x24daa7){return new BPromise(function(_0x223075,_0x395329){return client['request'](_0x1281cb,_0x24daa7)[_0x3402('0x9')](function(_0x5e5af4){logger[_0x3402('0xa')](_0x3402('0xb'),_0x53fbde,'request\x20sent');logger[_0x3402('0xc')](_0x3402('0xd'),_0x53fbde,'request\x20sent',JSON['stringify'](_0x5e5af4));if(_0x5e5af4[_0x3402('0xe')]){if(_0x5e5af4[_0x3402('0xe')]['code']===0x1f4){logger[_0x3402('0xe')](_0x3402('0xb'),_0x53fbde,_0x5e5af4['error'][_0x3402('0xf')]);return _0x395329(_0x5e5af4['error'][_0x3402('0xf')]);}logger['error'](_0x3402('0xb'),_0x53fbde,_0x5e5af4[_0x3402('0xe')][_0x3402('0xf')]);return _0x223075(_0x5e5af4['error'][_0x3402('0xf')]);}else{logger[_0x3402('0xa')]('UserWhatsappQueue,\x20%s,\x20%s',_0x53fbde,_0x3402('0x10'));_0x223075(_0x5e5af4[_0x3402('0x11')][_0x3402('0xf')]);}})[_0x3402('0x12')](function(_0x4e9984){logger[_0x3402('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x53fbde,_0x4e9984);_0x395329(_0x4e9984);});});} \ No newline at end of file +var _0x2c27=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x87b2b0,_0x15ff0f){var _0x407d75=function(_0x1eaa1e){while(--_0x1eaa1e){_0x87b2b0['push'](_0x87b2b0['shift']());}};_0x407d75(++_0x15ff0f);}(_0x2c27,0xbc));var _0x72c2=function(_0x33f770,_0x5182e5){_0x33f770=_0x33f770-0x0;var _0x38e162=_0x2c27[_0x33f770];return _0x38e162;};'use strict';var _=require(_0x72c2('0x0'));var util=require(_0x72c2('0x1'));var moment=require('moment');var BPromise=require(_0x72c2('0x2'));var rs=require(_0x72c2('0x3'));var fs=require('fs');var Redis=require(_0x72c2('0x4'));var db=require(_0x72c2('0x5'))['db'];var utils=require(_0x72c2('0x6'));var logger=require(_0x72c2('0x7'))(_0x72c2('0x8'));var config=require(_0x72c2('0x9'));var jayson=require(_0x72c2('0xa'));var client=jayson[_0x72c2('0xb')][_0x72c2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2a3c12,_0x2e347c,_0x110ef0){return new BPromise(function(_0x1649e0,_0x582c9a){return client[_0x72c2('0xd')](_0x2a3c12,_0x110ef0)[_0x72c2('0xe')](function(_0x1786a6){logger[_0x72c2('0xf')](_0x72c2('0x10'),_0x2e347c,_0x72c2('0x11'));logger[_0x72c2('0x12')](_0x72c2('0x13'),_0x2e347c,_0x72c2('0x11'),JSON[_0x72c2('0x14')](_0x1786a6));if(_0x1786a6[_0x72c2('0x15')]){if(_0x1786a6['error'][_0x72c2('0x16')]===0x1f4){logger[_0x72c2('0x15')](_0x72c2('0x10'),_0x2e347c,_0x1786a6['error'][_0x72c2('0x17')]);return _0x582c9a(_0x1786a6['error'][_0x72c2('0x17')]);}logger[_0x72c2('0x15')](_0x72c2('0x10'),_0x2e347c,_0x1786a6['error']['message']);return _0x1649e0(_0x1786a6['error'][_0x72c2('0x17')]);}else{logger[_0x72c2('0xf')](_0x72c2('0x10'),_0x2e347c,_0x72c2('0x11'));_0x1649e0(_0x1786a6[_0x72c2('0x18')]['message']);}})[_0x72c2('0x19')](function(_0x5e87de){logger[_0x72c2('0x15')]('UserWhatsappQueue,\x20%s,\x20%s',_0x2e347c,_0x5e87de);_0x582c9a(_0x5e87de);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index f1cb924..256c469 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 _0x630e=['path','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','post','create','put','delete','destroy','multer'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x630e,0x1af));var _0xe630=function(_0x398841,_0x162e78){_0x398841=_0x398841-0x0;var _0x20e4ae=_0x630e[_0x398841];return _0x20e4ae;};'use strict';var multer=require(_0xe630('0x0'));var util=require('util');var path=require(_0xe630('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe630('0x2')]();var fs_extra=require(_0xe630('0x3'));var auth=require(_0xe630('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe630('0x5'));var controller=require(_0xe630('0x6'));router[_0xe630('0x7')]('/',auth[_0xe630('0x8')](),controller[_0xe630('0x9')]);router['get'](_0xe630('0xa'),auth[_0xe630('0x8')](),controller['show']);router[_0xe630('0xb')]('/',auth['isAuthenticated'](),controller[_0xe630('0xc')]);router[_0xe630('0xd')](_0xe630('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xe630('0xe')](_0xe630('0xa'),auth[_0xe630('0x8')](),controller[_0xe630('0xf')]);module['exports']=router; \ No newline at end of file +var _0xc831=['/:id','isAuthenticated','show','post','put','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','index'];(function(_0x3797f4,_0x58fc3a){var _0x3b9bfb=function(_0x409508){while(--_0x409508){_0x3797f4['push'](_0x3797f4['shift']());}};_0x3b9bfb(++_0x58fc3a);}(_0xc831,0x103));var _0x1c83=function(_0x54ae26,_0x3796b4){_0x54ae26=_0x54ae26-0x0;var _0x10de29=_0xc831[_0x54ae26];return _0x10de29;};'use strict';var multer=require('multer');var util=require(_0x1c83('0x0'));var path=require(_0x1c83('0x1'));var timeout=require(_0x1c83('0x2'));var express=require(_0x1c83('0x3'));var router=express[_0x1c83('0x4')]();var fs_extra=require(_0x1c83('0x5'));var auth=require(_0x1c83('0x6'));var interaction=require(_0x1c83('0x7'));var config=require(_0x1c83('0x8'));var controller=require(_0x1c83('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1c83('0xa')]);router['get'](_0x1c83('0xb'),auth[_0x1c83('0xc')](),controller[_0x1c83('0xd')]);router[_0x1c83('0xe')]('/',auth[_0x1c83('0xc')](),controller['create']);router[_0x1c83('0xf')](_0x1c83('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x1c83('0x10')](_0x1c83('0xb'),auth[_0x1c83('0xc')](),controller['destroy']);module[_0x1c83('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 0cbee15..8975b57 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 _0x4f79=['name','STRING','sequelize','exports'];(function(_0x4a83f4,_0x50f589){var _0x1fc810=function(_0xc651f9){while(--_0xc651f9){_0x4a83f4['push'](_0x4a83f4['shift']());}};_0x1fc810(++_0x50f589);}(_0x4f79,0x1d2));var _0x94f7=function(_0x2e6416,_0x37cb2f){_0x2e6416=_0x2e6416-0x0;var _0x3fb527=_0x4f79[_0x2e6416];return _0x3fb527;};'use strict';var Sequelize=require(_0x94f7('0x0'));module[_0x94f7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x94f7('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x94f7('0x3')]}}; \ No newline at end of file +var _0xa04d=['exports','STRING'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xa04d,0x118));var _0xda04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa04d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xda04('0x0')]={'name':{'type':Sequelize[_0xda04('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xda04('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 98fda87..3baed74 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 _0x4843=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','get','Variables','stack','name','send','map','Variable','fieldName','type','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','rawAttributes','length','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','update','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs'];(function(_0x3a05cc,_0x2ea1f1){var _0x3d63a1=function(_0x537090){while(--_0x537090){_0x3a05cc['push'](_0x3a05cc['shift']());}};_0x3d63a1(++_0x2ea1f1);}(_0x4843,0x1e3));var _0x3484=function(_0x248bbb,_0x178ef3){_0x248bbb=_0x248bbb-0x0;var _0x4f94df=_0x4843[_0x248bbb];return _0x4f94df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3484('0x0'));var zipdir=require(_0x3484('0x1'));var jsonpatch=require(_0x3484('0x2'));var rp=require(_0x3484('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3484('0x4'));var util=require('util');var path=require(_0x3484('0x5'));var sox=require(_0x3484('0x6'));var csv=require(_0x3484('0x7'));var ejs=require(_0x3484('0x8'));var fs=require('fs');var fs_extra=require(_0x3484('0x9'));var _=require(_0x3484('0xa'));var squel=require(_0x3484('0xb'));var crypto=require(_0x3484('0xc'));var jsforce=require(_0x3484('0xd'));var deskjs=require(_0x3484('0xe'));var toCsv=require(_0x3484('0x7'));var querystring=require(_0x3484('0xf'));var Papa=require('papaparse');var Redis=require(_0x3484('0x10'));var authService=require(_0x3484('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3484('0x12'));var hardwareService=require(_0x3484('0x13'));var logger=require(_0x3484('0x14'))(_0x3484('0x15'));var utils=require(_0x3484('0x16'));var config=require(_0x3484('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x395990,_0x361f24){_0x361f24=_0x361f24||0xcc;return function(_0x516e38){if(_0x516e38){return _0x395990['sendStatus'](_0x361f24);}return _0x395990[_0x3484('0x18')](_0x361f24)[_0x3484('0x19')]();};}function respondWithResult(_0x283c46,_0x1ef33c){_0x1ef33c=_0x1ef33c||0xc8;return function(_0x2d667b){if(_0x2d667b){return _0x283c46[_0x3484('0x18')](_0x1ef33c)['json'](_0x2d667b);}};}function respondWithFilteredResult(_0x277c4b,_0x55ec43){return function(_0x11d4e0){if(_0x11d4e0){var _0x5a234c=typeof _0x55ec43[_0x3484('0x1a')]==='undefined'&&typeof _0x55ec43[_0x3484('0x1b')]===_0x3484('0x1c');var _0x4b317c=_0x11d4e0[_0x3484('0x1d')];var _0x5cab12=_0x5a234c?0x0:_0x55ec43[_0x3484('0x1a')];var _0x4a9806=_0x5a234c?_0x11d4e0[_0x3484('0x1d')]:_0x55ec43['offset']+_0x55ec43['limit'];var _0x32a47a;if(_0x4a9806>=_0x4b317c){_0x4a9806=_0x4b317c;_0x32a47a=0xc8;}else{_0x32a47a=0xce;}_0x277c4b['status'](_0x32a47a);return _0x277c4b[_0x3484('0x1e')](_0x3484('0x1f'),_0x5cab12+'-'+_0x4a9806+'/'+_0x4b317c)[_0x3484('0x20')](_0x11d4e0);}return null;};}function patchUpdates(_0x129b2c){return function(_0x3789ee){try{jsonpatch[_0x3484('0x21')](_0x3789ee,_0x129b2c,!![]);}catch(_0x442b4f){return BPromise[_0x3484('0x22')](_0x442b4f);}return _0x3789ee[_0x3484('0x23')]();};}function saveUpdates(_0x1877a6,_0x7b1db5){return function(_0xc45d24){if(_0xc45d24){return _0xc45d24['update'](_0x1877a6)[_0x3484('0x24')](function(_0x3917e2){return _0x3917e2;});}return null;};}function removeEntity(_0x287537,_0x49cf52){return function(_0x148a43){if(_0x148a43){return _0x148a43[_0x3484('0x25')]()[_0x3484('0x24')](function(){var _0x262740=_0x148a43[_0x3484('0x26')]({'plain':!![]});var _0x47c61a=_0x3484('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x47c61a,'resourceId':_0x262740['id']}})[_0x3484('0x24')](function(){return _0x148a43;});})['then'](function(){_0x287537[_0x3484('0x18')](0xcc)[_0x3484('0x19')]();});}};}function handleEntityNotFound(_0x1304cf,_0x2c04fc){return function(_0x41283a){if(!_0x41283a){_0x1304cf['sendStatus'](0x194);}return _0x41283a;};}function handleError(_0x4fd8bb,_0x2eb7f3){_0x2eb7f3=_0x2eb7f3||0x1f4;return function(_0x183119){logger['error'](_0x183119[_0x3484('0x28')]);if(_0x183119[_0x3484('0x29')]){delete _0x183119[_0x3484('0x29')];}_0x4fd8bb[_0x3484('0x18')](_0x2eb7f3)[_0x3484('0x2a')](_0x183119);};}exports['index']=function(_0x298fa3,_0x142a43){var _0x68898a={},_0x56c96b={},_0x463d7a={'count':0x0,'rows':[]};var _0x39e1ce=_[_0x3484('0x2b')](db[_0x3484('0x2c')]['rawAttributes'],function(_0x19f423){return{'name':_0x19f423[_0x3484('0x2d')],'type':_0x19f423[_0x3484('0x2e')]['key']};});_0x56c96b[_0x3484('0x2f')]=_['map'](_0x39e1ce,_0x3484('0x29'));_0x56c96b[_0x3484('0x30')]=_[_0x3484('0x31')](_0x298fa3[_0x3484('0x30')]);_0x56c96b[_0x3484('0x32')]=_[_0x3484('0x33')](_0x56c96b['model'],_0x56c96b[_0x3484('0x30')]);_0x68898a[_0x3484('0x34')]=_[_0x3484('0x33')](_0x56c96b['model'],qs[_0x3484('0x35')](_0x298fa3[_0x3484('0x30')]['fields']));_0x68898a[_0x3484('0x34')]=_0x68898a['attributes']['length']?_0x68898a[_0x3484('0x34')]:_0x56c96b[_0x3484('0x2f')];if(!_0x298fa3['query']['hasOwnProperty']('nolimit')){_0x68898a[_0x3484('0x1b')]=qs[_0x3484('0x1b')](_0x298fa3['query'][_0x3484('0x1b')]);_0x68898a[_0x3484('0x1a')]=qs[_0x3484('0x1a')](_0x298fa3[_0x3484('0x30')]['offset']);}_0x68898a[_0x3484('0x36')]=qs['sort'](_0x298fa3['query'][_0x3484('0x37')]);_0x68898a[_0x3484('0x38')]=qs[_0x3484('0x32')](_[_0x3484('0x39')](_0x298fa3[_0x3484('0x30')],_0x56c96b[_0x3484('0x32')]),_0x39e1ce);if(_0x298fa3[_0x3484('0x30')]['filter']){_0x68898a[_0x3484('0x38')]=_[_0x3484('0x3a')](_0x68898a[_0x3484('0x38')],{'$or':_[_0x3484('0x2b')](_0x39e1ce,function(_0x3ccb34){if(_0x3ccb34[_0x3484('0x2e')]!==_0x3484('0x3b')){var _0x352a3f={};_0x352a3f[_0x3ccb34[_0x3484('0x29')]]={'$like':'%'+_0x298fa3[_0x3484('0x30')][_0x3484('0x3c')]+'%'};return _0x352a3f;}})});}_0x68898a=_[_0x3484('0x3a')]({},_0x68898a,_0x298fa3['options']);var _0x123619={'where':_0x68898a['where']};return db[_0x3484('0x2c')][_0x3484('0x1d')](_0x123619)['then'](function(_0xcd675a){_0x463d7a['count']=_0xcd675a;if(_0x298fa3[_0x3484('0x30')][_0x3484('0x3d')]){_0x68898a['include']=[{'all':!![]}];}return db[_0x3484('0x2c')][_0x3484('0x3e')](_0x68898a);})[_0x3484('0x24')](function(_0x50a452){_0x463d7a[_0x3484('0x3f')]=_0x50a452;return _0x463d7a;})[_0x3484('0x24')](respondWithFilteredResult(_0x142a43,_0x68898a))[_0x3484('0x40')](handleError(_0x142a43,null));};exports[_0x3484('0x41')]=function(_0x53dcd4,_0x2dfb30){var _0x4fd394={'raw':!![],'where':{'id':_0x53dcd4[_0x3484('0x42')]['id']}},_0x5557bf={};_0x5557bf[_0x3484('0x2f')]=_[_0x3484('0x31')](db[_0x3484('0x2c')][_0x3484('0x43')]);_0x5557bf[_0x3484('0x30')]=_[_0x3484('0x31')](_0x53dcd4[_0x3484('0x30')]);_0x5557bf['filters']=_[_0x3484('0x33')](_0x5557bf[_0x3484('0x2f')],_0x5557bf[_0x3484('0x30')]);_0x4fd394[_0x3484('0x34')]=_['intersection'](_0x5557bf[_0x3484('0x2f')],qs['fields'](_0x53dcd4[_0x3484('0x30')][_0x3484('0x35')]));_0x4fd394[_0x3484('0x34')]=_0x4fd394[_0x3484('0x34')][_0x3484('0x44')]?_0x4fd394[_0x3484('0x34')]:_0x5557bf['model'];if(_0x53dcd4['query'][_0x3484('0x3d')]){_0x4fd394['include']=[{'all':!![]}];}_0x4fd394=_[_0x3484('0x3a')]({},_0x4fd394,_0x53dcd4['options']);return db[_0x3484('0x2c')][_0x3484('0x45')](_0x4fd394)['then'](handleEntityNotFound(_0x2dfb30,null))[_0x3484('0x24')](respondWithResult(_0x2dfb30,null))[_0x3484('0x40')](handleError(_0x2dfb30,null));};exports[_0x3484('0x46')]=function(_0x1f328e,_0x341d62){return db['Variable'][_0x3484('0x46')](_0x1f328e[_0x3484('0x47')],{})[_0x3484('0x24')](function(_0x263d0b){var _0x403e1a=_0x1f328e[_0x3484('0x48')][_0x3484('0x26')]({'plain':!![]});if(!_0x403e1a)throw new Error(_0x3484('0x49'));if(_0x403e1a[_0x3484('0x4a')]===_0x3484('0x48')){var _0x33e183=_0x263d0b[_0x3484('0x26')]({'plain':!![]});var _0x24e545=_0x3484('0x27');return db[_0x3484('0x4b')][_0x3484('0x45')]({'where':{'name':_0x24e545,'userProfileId':_0x403e1a[_0x3484('0x4c')]},'raw':!![]})['then'](function(_0x2b2482){if(_0x2b2482&&_0x2b2482[_0x3484('0x4d')]===0x0){return db[_0x3484('0x4e')][_0x3484('0x46')]({'name':_0x33e183['name'],'resourceId':_0x33e183['id'],'type':_0x2b2482[_0x3484('0x29')],'sectionId':_0x2b2482['id']},{})['then'](function(){return _0x263d0b;});}else{return _0x263d0b;}})[_0x3484('0x40')](function(_0x54127d){logger[_0x3484('0x4f')](_0x3484('0x50'),_0x54127d);throw _0x54127d;});}return _0x263d0b;})[_0x3484('0x24')](respondWithResult(_0x341d62,0xc9))[_0x3484('0x40')](handleError(_0x341d62,null));};exports[_0x3484('0x51')]=function(_0x31e1a5,_0x589c9c){if(_0x31e1a5[_0x3484('0x47')]['id']){delete _0x31e1a5[_0x3484('0x47')]['id'];}return db[_0x3484('0x2c')][_0x3484('0x45')]({'where':{'id':_0x31e1a5[_0x3484('0x42')]['id']}})[_0x3484('0x24')](handleEntityNotFound(_0x589c9c,null))[_0x3484('0x24')](saveUpdates(_0x31e1a5[_0x3484('0x47')],null))[_0x3484('0x24')](respondWithResult(_0x589c9c,null))['catch'](handleError(_0x589c9c,null));};exports['destroy']=function(_0x2d1194,_0x2429da){return db[_0x3484('0x2c')][_0x3484('0x45')]({'where':{'id':_0x2d1194['params']['id']}})['then'](handleEntityNotFound(_0x2429da,null))['then'](removeEntity(_0x2429da,null))['catch'](handleError(_0x2429da,null));}; \ No newline at end of file +var _0x881f=['get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','find','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','Variable','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body'];(function(_0xde88ae,_0x3e4d00){var _0x30de19=function(_0x5b7d55){while(--_0x5b7d55){_0xde88ae['push'](_0xde88ae['shift']());}};_0x30de19(++_0x3e4d00);}(_0x881f,0x1b1));var _0xf881=function(_0x640112,_0x42b7f3){_0x640112=_0x640112-0x0;var _0x15c177=_0x881f[_0x640112];return _0x15c177;};'use strict';var emlformat=require(_0xf881('0x0'));var rimraf=require(_0xf881('0x1'));var zipdir=require(_0xf881('0x2'));var jsonpatch=require(_0xf881('0x3'));var rp=require(_0xf881('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf881('0x5'));var util=require(_0xf881('0x6'));var path=require(_0xf881('0x7'));var sox=require(_0xf881('0x8'));var csv=require('to-csv');var ejs=require(_0xf881('0x9'));var fs=require('fs');var fs_extra=require(_0xf881('0xa'));var _=require(_0xf881('0xb'));var squel=require(_0xf881('0xc'));var crypto=require(_0xf881('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf881('0xe'));var toCsv=require(_0xf881('0xf'));var querystring=require('querystring');var Papa=require(_0xf881('0x10'));var Redis=require('ioredis');var authService=require(_0xf881('0x11'));var qs=require(_0xf881('0x12'));var as=require(_0xf881('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf881('0x14'))(_0xf881('0x15'));var utils=require(_0xf881('0x16'));var config=require(_0xf881('0x17'));var licenseUtil=require(_0xf881('0x18'));var db=require(_0xf881('0x19'))['db'];function respondWithStatusCode(_0x2fa3b3,_0x53721d){_0x53721d=_0x53721d||0xcc;return function(_0x1dd19d){if(_0x1dd19d){return _0x2fa3b3['sendStatus'](_0x53721d);}return _0x2fa3b3[_0xf881('0x1a')](_0x53721d)[_0xf881('0x1b')]();};}function respondWithResult(_0x267124,_0x58bc64){_0x58bc64=_0x58bc64||0xc8;return function(_0x1084dc){if(_0x1084dc){return _0x267124['status'](_0x58bc64)[_0xf881('0x1c')](_0x1084dc);}};}function respondWithFilteredResult(_0x10b132,_0x3b5442){return function(_0x327c86){if(_0x327c86){var _0x195ab4=typeof _0x3b5442['offset']==='undefined'&&typeof _0x3b5442[_0xf881('0x1d')]===_0xf881('0x1e');var _0x367e0e=_0x327c86[_0xf881('0x1f')];var _0x1fc794=_0x195ab4?0x0:_0x3b5442[_0xf881('0x20')];var _0x3fc987=_0x195ab4?_0x327c86[_0xf881('0x1f')]:_0x3b5442[_0xf881('0x20')]+_0x3b5442[_0xf881('0x1d')];var _0x2e24d6;if(_0x3fc987>=_0x367e0e){_0x3fc987=_0x367e0e;_0x2e24d6=0xc8;}else{_0x2e24d6=0xce;}_0x10b132['status'](_0x2e24d6);return _0x10b132[_0xf881('0x21')](_0xf881('0x22'),_0x1fc794+'-'+_0x3fc987+'/'+_0x367e0e)['json'](_0x327c86);}return null;};}function patchUpdates(_0x45d05e){return function(_0x4a1399){try{jsonpatch['apply'](_0x4a1399,_0x45d05e,!![]);}catch(_0x12d9a8){return BPromise[_0xf881('0x23')](_0x12d9a8);}return _0x4a1399[_0xf881('0x24')]();};}function saveUpdates(_0x5a7c6e,_0x1b6941){return function(_0x5f375e){if(_0x5f375e){return _0x5f375e[_0xf881('0x25')](_0x5a7c6e)[_0xf881('0x26')](function(_0x140a3f){return _0x140a3f;});}return null;};}function removeEntity(_0x5b7d66,_0x7ab5ce){return function(_0x57e6a7){if(_0x57e6a7){return _0x57e6a7[_0xf881('0x27')]()['then'](function(){var _0x5192ea=_0x57e6a7['get']({'plain':!![]});var _0x1ad631='Variables';return db[_0xf881('0x28')][_0xf881('0x27')]({'where':{'type':_0x1ad631,'resourceId':_0x5192ea['id']}})['then'](function(){return _0x57e6a7;});})[_0xf881('0x26')](function(){_0x5b7d66[_0xf881('0x1a')](0xcc)[_0xf881('0x1b')]();});}};}function handleEntityNotFound(_0x7f6c68,_0x3df0f7){return function(_0xbbaf22){if(!_0xbbaf22){_0x7f6c68[_0xf881('0x29')](0x194);}return _0xbbaf22;};}function handleError(_0x1a0130,_0x415c1b){_0x415c1b=_0x415c1b||0x1f4;return function(_0x407081){logger[_0xf881('0x2a')](_0x407081[_0xf881('0x2b')]);if(_0x407081[_0xf881('0x2c')]){delete _0x407081['name'];}_0x1a0130[_0xf881('0x1a')](_0x415c1b)[_0xf881('0x2d')](_0x407081);};}exports[_0xf881('0x2e')]=function(_0x4a9aa2,_0x218c0d){var _0x262c66={},_0x25a804={},_0x47f7ed={'count':0x0,'rows':[]};var _0x200849=_[_0xf881('0x2f')](db['Variable']['rawAttributes'],function(_0x17a9de){return{'name':_0x17a9de[_0xf881('0x30')],'type':_0x17a9de['type'][_0xf881('0x31')]};});_0x25a804[_0xf881('0x32')]=_[_0xf881('0x2f')](_0x200849,_0xf881('0x2c'));_0x25a804[_0xf881('0x33')]=_[_0xf881('0x34')](_0x4a9aa2['query']);_0x25a804[_0xf881('0x35')]=_[_0xf881('0x36')](_0x25a804[_0xf881('0x32')],_0x25a804['query']);_0x262c66[_0xf881('0x37')]=_[_0xf881('0x36')](_0x25a804['model'],qs[_0xf881('0x38')](_0x4a9aa2['query'][_0xf881('0x38')]));_0x262c66[_0xf881('0x37')]=_0x262c66[_0xf881('0x37')][_0xf881('0x39')]?_0x262c66['attributes']:_0x25a804['model'];if(!_0x4a9aa2['query'][_0xf881('0x3a')](_0xf881('0x3b'))){_0x262c66['limit']=qs[_0xf881('0x1d')](_0x4a9aa2[_0xf881('0x33')][_0xf881('0x1d')]);_0x262c66['offset']=qs[_0xf881('0x20')](_0x4a9aa2[_0xf881('0x33')][_0xf881('0x20')]);}_0x262c66['order']=qs[_0xf881('0x3c')](_0x4a9aa2[_0xf881('0x33')][_0xf881('0x3c')]);_0x262c66[_0xf881('0x3d')]=qs[_0xf881('0x35')](_['pick'](_0x4a9aa2['query'],_0x25a804[_0xf881('0x35')]),_0x200849);if(_0x4a9aa2[_0xf881('0x33')][_0xf881('0x3e')]){_0x262c66[_0xf881('0x3d')]=_[_0xf881('0x3f')](_0x262c66[_0xf881('0x3d')],{'$or':_[_0xf881('0x2f')](_0x200849,function(_0x9f5c02){if(_0x9f5c02[_0xf881('0x40')]!=='VIRTUAL'){var _0x267f63={};_0x267f63[_0x9f5c02['name']]={'$like':'%'+_0x4a9aa2[_0xf881('0x33')][_0xf881('0x3e')]+'%'};return _0x267f63;}})});}_0x262c66=_[_0xf881('0x3f')]({},_0x262c66,_0x4a9aa2['options']);var _0x5aadeb={'where':_0x262c66[_0xf881('0x3d')]};return db[_0xf881('0x41')][_0xf881('0x1f')](_0x5aadeb)[_0xf881('0x26')](function(_0x43d966){_0x47f7ed[_0xf881('0x1f')]=_0x43d966;if(_0x4a9aa2[_0xf881('0x33')][_0xf881('0x42')]){_0x262c66[_0xf881('0x43')]=[{'all':!![]}];}return db[_0xf881('0x41')][_0xf881('0x44')](_0x262c66);})['then'](function(_0x2fba21){_0x47f7ed[_0xf881('0x45')]=_0x2fba21;return _0x47f7ed;})['then'](respondWithFilteredResult(_0x218c0d,_0x262c66))[_0xf881('0x46')](handleError(_0x218c0d,null));};exports[_0xf881('0x47')]=function(_0x492252,_0x3a644c){var _0xa8038a={'raw':!![],'where':{'id':_0x492252[_0xf881('0x48')]['id']}},_0x11efdc={};_0x11efdc[_0xf881('0x32')]=_[_0xf881('0x34')](db[_0xf881('0x41')][_0xf881('0x49')]);_0x11efdc['query']=_[_0xf881('0x34')](_0x492252['query']);_0x11efdc[_0xf881('0x35')]=_[_0xf881('0x36')](_0x11efdc[_0xf881('0x32')],_0x11efdc['query']);_0xa8038a[_0xf881('0x37')]=_[_0xf881('0x36')](_0x11efdc['model'],qs[_0xf881('0x38')](_0x492252[_0xf881('0x33')][_0xf881('0x38')]));_0xa8038a[_0xf881('0x37')]=_0xa8038a['attributes'][_0xf881('0x39')]?_0xa8038a['attributes']:_0x11efdc[_0xf881('0x32')];if(_0x492252[_0xf881('0x33')][_0xf881('0x42')]){_0xa8038a[_0xf881('0x43')]=[{'all':!![]}];}_0xa8038a=_['merge']({},_0xa8038a,_0x492252[_0xf881('0x4a')]);return db['Variable']['find'](_0xa8038a)[_0xf881('0x26')](handleEntityNotFound(_0x3a644c,null))[_0xf881('0x26')](respondWithResult(_0x3a644c,null))[_0xf881('0x46')](handleError(_0x3a644c,null));};exports[_0xf881('0x4b')]=function(_0x4edf16,_0x42c754){return db[_0xf881('0x41')][_0xf881('0x4b')](_0x4edf16[_0xf881('0x4c')],{})[_0xf881('0x26')](function(_0x308f13){var _0x1b3291=_0x4edf16['user'][_0xf881('0x4d')]({'plain':!![]});if(!_0x1b3291)throw new Error(_0xf881('0x4e'));if(_0x1b3291[_0xf881('0x4f')]==='user'){var _0xf93218=_0x308f13[_0xf881('0x4d')]({'plain':!![]});var _0x77f646=_0xf881('0x50');return db[_0xf881('0x51')][_0xf881('0x52')]({'where':{'name':_0x77f646,'userProfileId':_0x1b3291[_0xf881('0x53')]},'raw':!![]})[_0xf881('0x26')](function(_0x24d742){if(_0x24d742&&_0x24d742[_0xf881('0x54')]===0x0){return db[_0xf881('0x28')][_0xf881('0x4b')]({'name':_0xf93218['name'],'resourceId':_0xf93218['id'],'type':_0x24d742[_0xf881('0x2c')],'sectionId':_0x24d742['id']},{})[_0xf881('0x26')](function(){return _0x308f13;});}else{return _0x308f13;}})[_0xf881('0x46')](function(_0x4009a4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4009a4);throw _0x4009a4;});}return _0x308f13;})[_0xf881('0x26')](respondWithResult(_0x42c754,0xc9))[_0xf881('0x46')](handleError(_0x42c754,null));};exports[_0xf881('0x25')]=function(_0x47c47d,_0x5e5a3f){if(_0x47c47d[_0xf881('0x4c')]['id']){delete _0x47c47d[_0xf881('0x4c')]['id'];}return db[_0xf881('0x41')][_0xf881('0x52')]({'where':{'id':_0x47c47d[_0xf881('0x48')]['id']}})[_0xf881('0x26')](handleEntityNotFound(_0x5e5a3f,null))[_0xf881('0x26')](saveUpdates(_0x47c47d[_0xf881('0x4c')],null))[_0xf881('0x26')](respondWithResult(_0x5e5a3f,null))[_0xf881('0x46')](handleError(_0x5e5a3f,null));};exports[_0xf881('0x27')]=function(_0x1073ee,_0x3ba494){return db['Variable'][_0xf881('0x52')]({'where':{'id':_0x1073ee[_0xf881('0x48')]['id']}})[_0xf881('0x26')](handleEntityNotFound(_0x3ba494,null))['then'](removeEntity(_0x3ba494,null))[_0xf881('0x46')](handleError(_0x3ba494,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index c7321de..46c7a2a 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 _0x3c22=['define','Variable','tools_variables','lodash','util','request-promise','path','rimraf','./variable.attributes','exports'];(function(_0x4ae85a,_0x46e5b2){var _0x45a483=function(_0x36b218){while(--_0x36b218){_0x4ae85a['push'](_0x4ae85a['shift']());}};_0x45a483(++_0x46e5b2);}(_0x3c22,0xf3));var _0x23c2=function(_0x55ecfd,_0x5802e7){_0x55ecfd=_0x55ecfd-0x0;var _0x1b23c7=_0x3c22[_0x55ecfd];return _0x1b23c7;};'use strict';var _=require(_0x23c2('0x0'));var util=require(_0x23c2('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x23c2('0x2'));var fs=require('fs');var path=require(_0x23c2('0x3'));var rimraf=require(_0x23c2('0x4'));var config=require('../../config/environment');var attributes=require(_0x23c2('0x5'));module[_0x23c2('0x6')]=function(_0x255840,_0x46f1d6){return _0x255840[_0x23c2('0x7')](_0x23c2('0x8'),attributes,{'tableName':_0x23c2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe858=['../../config/logger','bluebird','rimraf','../../config/environment','exports','define','Variable','tools_variables','util'];(function(_0x3322e2,_0x4b5ab2){var _0x4e72fe=function(_0x19e5a9){while(--_0x19e5a9){_0x3322e2['push'](_0x3322e2['shift']());}};_0x4e72fe(++_0x4b5ab2);}(_0xe858,0xe9));var _0x8e85=function(_0x37ef22,_0x348c92){_0x37ef22=_0x37ef22-0x0;var _0x49eeb3=_0xe858[_0x37ef22];return _0x49eeb3;};'use strict';var _=require('lodash');var util=require(_0x8e85('0x0'));var logger=require(_0x8e85('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8e85('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8e85('0x3'));var config=require(_0x8e85('0x4'));var attributes=require('./variable.attributes');module[_0x8e85('0x5')]=function(_0x1c9c8e,_0x508269){return _0x1c9c8e[_0x8e85('0x6')](_0x8e85('0x7'),attributes,{'tableName':_0x8e85('0x8'),'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 55ee42b..935cdab 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 _0x7217=['where','attributes','map','include','model','ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Variable','find','options','raw'];(function(_0x617783,_0x18e637){var _0x333736=function(_0xa7b8b){while(--_0xa7b8b){_0x617783['push'](_0x617783['shift']());}};_0x333736(++_0x18e637);}(_0x7217,0x19e));var _0x7721=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x7217[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Variable,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Variable,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowVariable']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowVariable',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file +var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x7f70ec,_0x82eb8b){var _0x397ff9=function(_0x51edf4){while(--_0x51edf4){_0x7f70ec['push'](_0x7f70ec['shift']());}};_0x397ff9(++_0x82eb8b);}(_0x55ca,0x126));var _0xa55c=function(_0x2adfb1,_0x406e6e){_0x2adfb1=_0x2adfb1-0x0;var _0xa52d45=_0x55ca[_0x2adfb1];return _0xa52d45;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 98bf08b..a8722da 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 _0x6d5f=['/reset','reset','/pull','isAuthenticated','restart','migrations','exports','express','get','index','canUpdate','fetch'];(function(_0x4405dc,_0x2ce0f5){var _0x9e5ab5=function(_0x4edc4f){while(--_0x4edc4f){_0x4405dc['push'](_0x4405dc['shift']());}};_0x9e5ab5(++_0x2ce0f5);}(_0x6d5f,0x1b7));var _0xf6d5=function(_0x25d092,_0x469bd3){_0x25d092=_0x25d092-0x0;var _0x3d20e5=_0x6d5f[_0x25d092];return _0x3d20e5;};'use strict';var express=require(_0xf6d5('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0xf6d5('0x1')]('/',controller[_0xf6d5('0x2')]);router['get']('/fetch',auth['isAuthenticated'](),auth[_0xf6d5('0x3')](),controller[_0xf6d5('0x4')]);router[_0xf6d5('0x1')](_0xf6d5('0x5'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xf6d5('0x6')]);router[_0xf6d5('0x1')](_0xf6d5('0x7'),auth[_0xf6d5('0x8')](),auth['canUpdate'](),controller['pull']);router[_0xf6d5('0x1')]('/restart',auth[_0xf6d5('0x8')](),controller[_0xf6d5('0x9')]);router[_0xf6d5('0x1')]('/migrations',controller[_0xf6d5('0xa')]);module[_0xf6d5('0xb')]=router; \ No newline at end of file +var _0x6019=['pull','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','index','get','/fetch','isAuthenticated','fetch','/reset','reset','/pull','canUpdate'];(function(_0x4d5114,_0x1fb715){var _0x3d82c9=function(_0x24811e){while(--_0x24811e){_0x4d5114['push'](_0x4d5114['shift']());}};_0x3d82c9(++_0x1fb715);}(_0x6019,0xe2));var _0x9601=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6019[_0x1facfa];return _0x9ec701;};'use strict';var express=require(_0x9601('0x0'));var router=express[_0x9601('0x1')]();var auth=require(_0x9601('0x2'));var controller=require('./version.controller');router['get']('/',controller[_0x9601('0x3')]);router[_0x9601('0x4')](_0x9601('0x5'),auth[_0x9601('0x6')](),auth['canUpdate'](),controller[_0x9601('0x7')]);router[_0x9601('0x4')](_0x9601('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x9601('0x9')]);router[_0x9601('0x4')](_0x9601('0xa'),auth['isAuthenticated'](),auth[_0x9601('0xb')](),controller[_0x9601('0xc')]);router[_0x9601('0x4')]('/restart',auth[_0x9601('0x6')](),controller[_0x9601('0xd')]);router['get'](_0x9601('0xe'),controller[_0x9601('0xf')]);module[_0x9601('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 2364b94..fa196a4 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 _0x3721=['.js','push','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.','server','then','\x20to\x20','last','join','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','query','latest','tags','exports','status','json','fetch','origin','master','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','length','replace'];(function(_0x12359e,_0x17b998){var _0x42ca40=function(_0x36d524){while(--_0x36d524){_0x12359e['push'](_0x12359e['shift']());}};_0x42ca40(++_0x17b998);}(_0x3721,0x77));var _0x1372=function(_0x42d882,_0x4c574e){_0x42d882=_0x42d882-0x0;var _0x1f1ec1=_0x3721[_0x42d882];return _0x1f1ec1;};'use strict';var Umzug=require(_0x1372('0x0'));var path=require(_0x1372('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x1372('0x2'))(module,_0x1372('0x3'));var compareVersions=require('compare-versions');var exec=require('child_process')[_0x1372('0x4')];var db=require(_0x1372('0x5'))['db'];var config=require(_0x1372('0x6'));var pm2=require(_0x1372('0x7'));var logger=require(_0x1372('0x8'))(_0x1372('0x9'));var git=require(_0x1372('0xa'))(config[_0x1372('0xb')]);exports[_0x1372('0xc')]=function(_0x5e52b2,_0x3a9777){var _0x4d7a51={'current':module['exports'][_0x1372('0x3')],'phonebar':0x2};if(_0x5e52b2[_0x1372('0xd')]&&_0x5e52b2[_0x1372('0xd')][_0x1372('0xe')]){return git['fetch']()[_0x1372('0xf')](function(_0x31b809,_0x26284d){_0x4d7a51[_0x1372('0xe')]=(_0x31b809?module[_0x1372('0x10')][_0x1372('0x3')]:_0x26284d[_0x1372('0xe')])||'2.0.0';return _0x3a9777[_0x1372('0x11')](0xc8)[_0x1372('0x12')](_0x4d7a51);});}else{return _0x3a9777[_0x1372('0x11')](0xc8)[_0x1372('0x12')](_0x4d7a51);}};exports[_0x1372('0x13')]=function(_0x7f2816,_0x429ce1){return git[_0x1372('0x13')]([_0x1372('0x14'),_0x1372('0x15')],function(_0x50fcd4){if(_0x50fcd4){logger['error'](_0x50fcd4);return _0x429ce1['status'](0x1f4)[_0x1372('0x12')](_0x50fcd4);}logger['info'](_0x1372('0x16'));return _0x429ce1[_0x1372('0x11')](0xc8)['json']({'output':_0x1372('0x17')});});};exports[_0x1372('0x18')]=function(_0x44b221,_0x3cdc3c){return git['reset']([_0x1372('0x19'),_0x1372('0x1a')],function(_0x57d692){if(_0x57d692){logger[_0x1372('0x1b')](_0x57d692);return _0x3cdc3c[_0x1372('0x11')](0x1f4)['json'](_0x57d692);}logger[_0x1372('0x1c')](_0x1372('0x1d'));return _0x3cdc3c[_0x1372('0x11')](0xc8)['json']({'output':_0x1372('0x1e')});});};exports['pull']=function(_0x78fb07,_0x2b5daa){exec(_0x1372('0x1f'),function(_0x17af3c,_0x21a937,_0x27268b){logger[_0x1372('0x1c')](_0x21a937);logger[_0x1372('0x1c')](_0x27268b);if(_0x17af3c){logger['error'](_0x17af3c);return _0x2b5daa[_0x1372('0x11')](0x1f4)[_0x1372('0x12')](_0x17af3c);}return _0x2b5daa[_0x1372('0x11')](0xc8)[_0x1372('0x12')]({'output':_0x21a937});});};exports[_0x1372('0x20')]=function(_0x57db77,_0x4bebe6){return pm2[_0x1372('0x20')](_0x1372('0x21'))['then'](function(_0x33de1c){logger['info']('pm2\x20restart\x20motion\x20%s',_0x33de1c);return _0x4bebe6[_0x1372('0x11')](0xc8)['json']({'output':_0x1372('0x22')});})[_0x1372('0x23')](function(_0x359c12){logger[_0x1372('0x1b')](_0x359c12);return _0x4bebe6[_0x1372('0x11')](0x1f4)[_0x1372('0x12')](_0x359c12);});};exports[_0x1372('0x24')]=function(_0x5d4cf0,_0x59bc4b){var _0x499b5f=fs[_0x1372('0x25')](path['join'](config[_0x1372('0xb')],'server','migrations'));var _0x46d7fc=[];for(var _0x5e6dbb=0x0;_0x5e6dbb<_0x499b5f[_0x1372('0x26')];_0x5e6dbb++){var _0x497d19=_0x499b5f[_0x5e6dbb][_0x1372('0x27')](_0x1372('0x28'),'');if(compareVersions(module['exports'][_0x1372('0x3')],_0x497d19)===-0x1){_0x46d7fc[_0x1372('0x29')](_0x497d19);}}if(_0x46d7fc[_0x1372('0x26')]){var _0x15f6c6=_0x46d7fc['sort'](compareVersions);var _0x13e02b=new Umzug({'storage':_0x1372('0x2a'),'storageOptions':{'model':db[_0x1372('0x2b')],'modelName':_0x1372('0x2b'),'columnName':_0x1372('0x3')},'migrations':{'params':[db[_0x1372('0x2a')][_0x1372('0x2c')](),db['sequelize'][_0x1372('0x2d')],function(){throw new Error(_0x1372('0x2e'));}],'path':path['join'](config[_0x1372('0xb')],_0x1372('0x2f'),_0x1372('0x24')),'pattern':/\.js$/}});_0x13e02b['up']({'migrations':_['map'](_0x15f6c6,function(_0x56814e){return _0x56814e+_0x1372('0x28');})})[_0x1372('0x30')](function(){return _0x59bc4b[_0x1372('0x11')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x1372('0x10')]['version']+_0x1372('0x31')+_[_0x1372('0x32')](_0x15f6c6),'migrations':_[_0x1372('0x33')](_0x15f6c6)});})['catch'](function(_0x4dd45f){if(_0x4dd45f instanceof db[_0x1372('0x2a')]['UniqueConstraintError']){return _0x59bc4b[_0x1372('0x11')](0xc8)['json']({'output':_0x1372('0x34')});}else{return _0x59bc4b[_0x1372('0x11')](0x1f4)['json'](_0x4dd45f);}});}else{return _0x59bc4b[_0x1372('0x11')](0xc8)['json']({'output':_0x1372('0x34')});}}; \ No newline at end of file +var _0xff80=['update','index','exports','version','query','latest','fetch','tags','2.0.0','status','master','error','info','git\x20fetch','json','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','root','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','server','\x20to\x20','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/logger'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xff80,0x198));var _0x0ff8=function(_0x573719,_0x5cbb65){_0x573719=_0x573719-0x0;var _0x4f43a1=_0xff80[_0x573719];return _0x4f43a1;};'use strict';var Umzug=require(_0x0ff8('0x0'));var path=require(_0x0ff8('0x1'));var fs=require('fs');var _=require(_0x0ff8('0x2'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0x0ff8('0x3'));var exec=require(_0x0ff8('0x4'))['exec'];var db=require(_0x0ff8('0x5'))['db'];var config=require(_0x0ff8('0x6'));var pm2=require('../../config/pm2');var logger=require(_0x0ff8('0x7'))(_0x0ff8('0x8'));var git=require('simple-git')(config['root']);exports[_0x0ff8('0x9')]=function(_0xdc09e4,_0x20c793){var _0xf83bec={'current':module[_0x0ff8('0xa')][_0x0ff8('0xb')],'phonebar':0x2};if(_0xdc09e4[_0x0ff8('0xc')]&&_0xdc09e4['query'][_0x0ff8('0xd')]){return git[_0x0ff8('0xe')]()[_0x0ff8('0xf')](function(_0x3bb9a4,_0x59c6d0){_0xf83bec[_0x0ff8('0xd')]=(_0x3bb9a4?module[_0x0ff8('0xa')]['version']:_0x59c6d0[_0x0ff8('0xd')])||_0x0ff8('0x10');return _0x20c793['status'](0xc8)['json'](_0xf83bec);});}else{return _0x20c793[_0x0ff8('0x11')](0xc8)['json'](_0xf83bec);}};exports['fetch']=function(_0x21d48b,_0x36510a){return git[_0x0ff8('0xe')](['origin',_0x0ff8('0x12')],function(_0x55938b){if(_0x55938b){logger[_0x0ff8('0x13')](_0x55938b);return _0x36510a['status'](0x1f4)['json'](_0x55938b);}logger[_0x0ff8('0x14')](_0x0ff8('0x15'));return _0x36510a[_0x0ff8('0x11')](0xc8)[_0x0ff8('0x16')]({'output':_0x0ff8('0x17')});});};exports['reset']=function(_0x38820f,_0x26fcfa){return git[_0x0ff8('0x18')]([_0x0ff8('0x19'),_0x0ff8('0x1a')],function(_0x3e997b){if(_0x3e997b){logger[_0x0ff8('0x13')](_0x3e997b);return _0x26fcfa[_0x0ff8('0x11')](0x1f4)[_0x0ff8('0x16')](_0x3e997b);}logger[_0x0ff8('0x14')](_0x0ff8('0x1b'));return _0x26fcfa[_0x0ff8('0x11')](0xc8)[_0x0ff8('0x16')]({'output':_0x0ff8('0x1c')});});};exports[_0x0ff8('0x1d')]=function(_0xcebe89,_0x541d16){exec('npm\x20install\x20--production',function(_0x249396,_0x3942ae,_0x5b25bd){logger['info'](_0x3942ae);logger['info'](_0x5b25bd);if(_0x249396){logger[_0x0ff8('0x13')](_0x249396);return _0x541d16[_0x0ff8('0x11')](0x1f4)['json'](_0x249396);}return _0x541d16['status'](0xc8)[_0x0ff8('0x16')]({'output':_0x3942ae});});};exports[_0x0ff8('0x1e')]=function(_0x34d212,_0x139d76){return pm2[_0x0ff8('0x1e')](_0x0ff8('0x1f'))['then'](function(_0x23d9b9){logger[_0x0ff8('0x14')](_0x0ff8('0x20'),_0x23d9b9);return _0x139d76[_0x0ff8('0x11')](0xc8)['json']({'output':_0x0ff8('0x21')});})['catch'](function(_0x3babc0){logger['error'](_0x3babc0);return _0x139d76['status'](0x1f4)[_0x0ff8('0x16')](_0x3babc0);});};exports[_0x0ff8('0x22')]=function(_0x21adc9,_0x393159){var _0x25ff36=fs[_0x0ff8('0x23')](path[_0x0ff8('0x24')](config[_0x0ff8('0x25')],'server','migrations'));var _0x5d43d9=[];for(var _0x34fddd=0x0;_0x34fddd<_0x25ff36[_0x0ff8('0x26')];_0x34fddd++){var _0x29c178=_0x25ff36[_0x34fddd][_0x0ff8('0x27')](_0x0ff8('0x28'),'');if(compareVersions(module[_0x0ff8('0xa')][_0x0ff8('0xb')],_0x29c178)===-0x1){_0x5d43d9[_0x0ff8('0x29')](_0x29c178);}}if(_0x5d43d9['length']){var _0x5524a1=_0x5d43d9[_0x0ff8('0x2a')](compareVersions);var _0x46e48e=new Umzug({'storage':_0x0ff8('0x2b'),'storageOptions':{'model':db[_0x0ff8('0x2c')],'modelName':'Migration','columnName':_0x0ff8('0xb')},'migrations':{'params':[db[_0x0ff8('0x2b')][_0x0ff8('0x2d')](),db[_0x0ff8('0x2b')][_0x0ff8('0x2e')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x0ff8('0x24')](config[_0x0ff8('0x25')],_0x0ff8('0x2f'),_0x0ff8('0x22')),'pattern':/\.js$/}});_0x46e48e['up']({'migrations':_['map'](_0x5524a1,function(_0x15d8a2){return _0x15d8a2+_0x0ff8('0x28');})})['then'](function(){return _0x393159[_0x0ff8('0x11')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x0ff8('0xa')][_0x0ff8('0xb')]+_0x0ff8('0x30')+_['last'](_0x5524a1),'migrations':_[_0x0ff8('0x24')](_0x5524a1)});})[_0x0ff8('0x31')](function(_0x36c249){if(_0x36c249 instanceof db[_0x0ff8('0x2b')][_0x0ff8('0x32')]){return _0x393159[_0x0ff8('0x11')](0xc8)[_0x0ff8('0x16')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x393159[_0x0ff8('0x11')](0x1f4)['json'](_0x36c249);}});}else{return _0x393159[_0x0ff8('0x11')](0xc8)[_0x0ff8('0x16')]({'output':_0x0ff8('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 81dc24d..05d3c4f 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 _0xf793=['post','update','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','/:id','show'];(function(_0x38abab,_0x1e9235){var _0x4d43a3=function(_0x4e7d61){while(--_0x4e7d61){_0x38abab['push'](_0x38abab['shift']());}};_0x4d43a3(++_0x1e9235);}(_0xf793,0x188));var _0x3f79=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf793[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3f79('0x0'));var util=require(_0x3f79('0x1'));var path=require(_0x3f79('0x2'));var timeout=require('connect-timeout');var express=require(_0x3f79('0x3'));var router=express[_0x3f79('0x4')]();var fs_extra=require(_0x3f79('0x5'));var auth=require(_0x3f79('0x6'));var interaction=require(_0x3f79('0x7'));var config=require('../../config/environment');var controller=require(_0x3f79('0x8'));router[_0x3f79('0x9')]('/',auth[_0x3f79('0xa')](),controller['index']);router['get']('/describe',auth[_0x3f79('0xa')](),controller['describe']);router[_0x3f79('0x9')](_0x3f79('0xb'),auth[_0x3f79('0xa')](),controller[_0x3f79('0xc')]);router[_0x3f79('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x3f79('0xb'),auth[_0x3f79('0xa')](),controller[_0x3f79('0xe')]);router['delete'](_0x3f79('0xb'),auth[_0x3f79('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb218=['/:id','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','isAuthenticated','get','/describe','show','post','create','update','delete'];(function(_0x55a6a5,_0x1f869e){var _0x4ee2d0=function(_0x1e4df5){while(--_0x1e4df5){_0x55a6a5['push'](_0x55a6a5['shift']());}};_0x4ee2d0(++_0x1f869e);}(_0xb218,0x192));var _0x8b21=function(_0x367b03,_0x5b0646){_0x367b03=_0x367b03-0x0;var _0x3b4f5a=_0xb218[_0x367b03];return _0x3b4f5a;};'use strict';var multer=require(_0x8b21('0x0'));var util=require('util');var path=require(_0x8b21('0x1'));var timeout=require(_0x8b21('0x2'));var express=require(_0x8b21('0x3'));var router=express['Router']();var fs_extra=require(_0x8b21('0x4'));var auth=require(_0x8b21('0x5'));var interaction=require(_0x8b21('0x6'));var config=require('../../config/environment');var controller=require(_0x8b21('0x7'));router['get']('/',auth[_0x8b21('0x8')](),controller['index']);router[_0x8b21('0x9')](_0x8b21('0xa'),auth[_0x8b21('0x8')](),controller['describe']);router[_0x8b21('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x8b21('0xb')]);router[_0x8b21('0xc')]('/',auth['isAuthenticated'](),controller[_0x8b21('0xd')]);router['put']('/:id',auth[_0x8b21('0x8')](),controller[_0x8b21('0xe')]);router[_0x8b21('0xf')](_0x8b21('0x10'),auth[_0x8b21('0x8')](),controller[_0x8b21('0x11')]);module[_0x8b21('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 f69677c..e6db4c9 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 _0x25c2=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x2a9ffa,_0x42f948){var _0x9c0e7f=function(_0x29678c){while(--_0x29678c){_0x2a9ffa['push'](_0x2a9ffa['shift']());}};_0x9c0e7f(++_0x42f948);}(_0x25c2,0xdd));var _0x225c=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0x25c2[_0x1ed116];return _0x574066;};'use strict';var Sequelize=require(_0x225c('0x0'));module['exports']={'type':{'type':Sequelize[_0x225c('0x1')]},'uniqueid':{'type':Sequelize[_0x225c('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x225c('0x1')]},'queue':{'type':Sequelize[_0x225c('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x225c('0x1')]},'agentcalledAt':{'type':Sequelize[_0x225c('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x225c('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x225c('0x2')]},'agentdumpAt':{'type':Sequelize[_0x225c('0x2')]},'holdtime':{'type':Sequelize[_0x225c('0x3')]},'agentcomplete':{'type':Sequelize[_0x225c('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x225c('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x225c('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x225c('0x1')]},'lastevent':{'type':Sequelize[_0x225c('0x1')]},'channel':{'type':Sequelize[_0x225c('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x225c('0x1')]},'connectedlinenum':{'type':Sequelize[_0x225c('0x1')]},'connectedlinename':{'type':Sequelize[_0x225c('0x1')]},'language':{'type':Sequelize[_0x225c('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x225c('0x1')]},'exten':{'type':Sequelize[_0x225c('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x225c('0x1')]},'destchannelstate':{'type':Sequelize[_0x225c('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x225c('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x225c('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x225c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x225c('0x1')]},'destlanguage':{'type':Sequelize[_0x225c('0x1')]},'destaccountcode':{'type':Sequelize[_0x225c('0x1')]},'destcontext':{'type':Sequelize[_0x225c('0x1')]},'destexten':{'type':Sequelize[_0x225c('0x1')]},'destpriority':{'type':Sequelize[_0x225c('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x225c('0x1')]},'transfer':{'type':Sequelize[_0x225c('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x225c('0x1')],'comment':_0x225c('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x225c('0x1')]},'agententerreason':{'type':Sequelize[_0x225c('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2272=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x2272,0xd8));var _0x2227=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2272[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x2227('0x0'));module[_0x2227('0x1')]={'type':{'type':Sequelize[_0x2227('0x2')]},'uniqueid':{'type':Sequelize[_0x2227('0x2')]},'calleridnum':{'type':Sequelize[_0x2227('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x2227('0x2')]},'interface':{'type':Sequelize[_0x2227('0x2')]},'membername':{'type':Sequelize[_0x2227('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x2227('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x2227('0x3')]},'agentdumpAt':{'type':Sequelize[_0x2227('0x3')]},'holdtime':{'type':Sequelize[_0x2227('0x4')]},'agentcomplete':{'type':Sequelize[_0x2227('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x2227('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x2227('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x2227('0x4')]},'agentacw':{'type':Sequelize[_0x2227('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2227('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x2227('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x2227('0x4')]},'channelstatedesc':{'type':Sequelize[_0x2227('0x2')]},'connectedlinenum':{'type':Sequelize[_0x2227('0x2')]},'connectedlinename':{'type':Sequelize[_0x2227('0x2')]},'language':{'type':Sequelize[_0x2227('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x2227('0x2')]},'exten':{'type':Sequelize[_0x2227('0x2')]},'priority':{'type':Sequelize[_0x2227('0x2')]},'destchannel':{'type':Sequelize[_0x2227('0x2')]},'destchannelstate':{'type':Sequelize[_0x2227('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x2227('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x2227('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x2227('0x2')]},'destcontext':{'type':Sequelize[_0x2227('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x2227('0x2')]},'destuniqueid':{'type':Sequelize[_0x2227('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x2227('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x2227('0x2')]},'transfer':{'type':Sequelize[_0x2227('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2227('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x2227('0x2')]},'transferuniqueid':{'type':Sequelize[_0x2227('0x2')]},'agententerreason':{'type':Sequelize[_0x2227('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 b44bd35..81e54cb 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(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 df9ca80..a2f882d 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 _0xa786=['VoiceAgentReport','report_agent','uniqueid','destuniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','define'];(function(_0x223fdd,_0x4ca1d2){var _0x3accf9=function(_0x1313af){while(--_0x1313af){_0x223fdd['push'](_0x223fdd['shift']());}};_0x3accf9(++_0x4ca1d2);}(_0xa786,0x1d2));var _0x6a78=function(_0x250bf9,_0x550ae1){_0x250bf9=_0x250bf9-0x0;var _0x3b76ef=_0xa786[_0x250bf9];return _0x3b76ef;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6a78('0x0'))(_0x6a78('0x1'));var moment=require(_0x6a78('0x2'));var BPromise=require(_0x6a78('0x3'));var rp=require(_0x6a78('0x4'));var fs=require('fs');var path=require(_0x6a78('0x5'));var rimraf=require(_0x6a78('0x6'));var config=require('../../config/environment');var attributes=require(_0x6a78('0x7'));module[_0x6a78('0x8')]=function(_0xc0be8b,_0x45470e){return _0xc0be8b[_0x6a78('0x9')](_0x6a78('0xa'),attributes,{'tableName':_0x6a78('0xb'),'paranoid':![],'indexes':[{'fields':[_0x6a78('0xc'),_0x6a78('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa93e=['VoiceAgentReport','uniqueid','../../config/logger','api','bluebird','path','./voiceAgentReport.attributes','exports','define'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa93e,0x1df));var _0xea93=function(_0xadbe99,_0x1b491c){_0xadbe99=_0xadbe99-0x0;var _0x49e808=_0xa93e[_0xadbe99];return _0x49e808;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xea93('0x0'))(_0xea93('0x1'));var moment=require('moment');var BPromise=require(_0xea93('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea93('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xea93('0x4'));module[_0xea93('0x5')]=function(_0x6c6985,_0x26def3){return _0x6c6985[_0xea93('0x6')](_0xea93('0x7'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xea93('0x8'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 495fcfe..efb0361 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 _0xfeb6=['client','http','then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceAgentReport,\x20%s,\x20%s','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','UpdateVoiceAgentReport','update','where','attributes','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xfeb6,0x10d));var _0x6feb=function(_0x635784,_0x40f37c){_0x635784=_0x635784-0x0;var _0x1802da=_0xfeb6[_0x635784];return _0x1802da;};'use strict';var _=require(_0x6feb('0x0'));var util=require(_0x6feb('0x1'));var moment=require(_0x6feb('0x2'));var BPromise=require('bluebird');var rs=require(_0x6feb('0x3'));var fs=require('fs');var Redis=require(_0x6feb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6feb('0x5'));var logger=require(_0x6feb('0x6'))(_0x6feb('0x7'));var config=require(_0x6feb('0x8'));var jayson=require(_0x6feb('0x9'));var client=jayson[_0x6feb('0xa')][_0x6feb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32005a,_0xe0454e,_0x1ef25b){return new BPromise(function(_0x4b81a9,_0x24d804){return client['request'](_0x32005a,_0x1ef25b)[_0x6feb('0xc')](function(_0x24caf9){logger[_0x6feb('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0xe0454e,_0x6feb('0xe'));logger[_0x6feb('0xf')](_0x6feb('0x10'),_0xe0454e,_0x6feb('0xe'),JSON[_0x6feb('0x11')](_0x24caf9));if(_0x24caf9[_0x6feb('0x12')]){if(_0x24caf9[_0x6feb('0x12')]['code']===0x1f4){logger['error'](_0x6feb('0x13'),_0xe0454e,_0x24caf9[_0x6feb('0x12')][_0x6feb('0x14')]);return _0x24d804(_0x24caf9['error']['message']);}logger[_0x6feb('0x12')](_0x6feb('0x13'),_0xe0454e,_0x24caf9[_0x6feb('0x12')]['message']);return _0x4b81a9(_0x24caf9['error']['message']);}else{logger[_0x6feb('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0xe0454e,'request\x20sent');_0x4b81a9(_0x24caf9['result']['message']);}})[_0x6feb('0x15')](function(_0x2b1f6){logger[_0x6feb('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0xe0454e,_0x2b1f6);_0x24d804(_0x2b1f6);});});}exports[_0x6feb('0x16')]=function(_0x4d58e7){var _0x258f80=this;return new Promise(function(_0x494a27,_0x3dc1b0){return db[_0x6feb('0x17')][_0x6feb('0x18')](_0x4d58e7['body'],{'raw':_0x4d58e7[_0x6feb('0x19')]?_0x4d58e7[_0x6feb('0x19')][_0x6feb('0x1a')]===undefined?!![]:![]:!![]})[_0x6feb('0xc')](function(_0x1c3a83){logger[_0x6feb('0xd')](_0x6feb('0x16'),_0x4d58e7);logger[_0x6feb('0xf')](_0x6feb('0x16'),_0x4d58e7,JSON['stringify'](_0x1c3a83));_0x494a27(_0x1c3a83);})['catch'](function(_0x1209c7){logger[_0x6feb('0x12')](_0x6feb('0x16'),_0x1209c7['message'],_0x4d58e7);_0x3dc1b0(_0x258f80['error'](0x1f4,_0x1209c7[_0x6feb('0x14')]));});});};exports[_0x6feb('0x1b')]=function(_0x41e013){var _0x43debb=this;return new Promise(function(_0x2cb6d2,_0x364233){return db['VoiceAgentReport'][_0x6feb('0x1c')](_0x41e013['body'],{'raw':_0x41e013[_0x6feb('0x19')]?_0x41e013[_0x6feb('0x19')][_0x6feb('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41e013[_0x6feb('0x19')]?_0x41e013['options'][_0x6feb('0x1d')]||null:null,'attributes':_0x41e013[_0x6feb('0x19')]?_0x41e013[_0x6feb('0x19')][_0x6feb('0x1e')]||null:null,'limit':_0x41e013[_0x6feb('0x19')]?_0x41e013[_0x6feb('0x19')]['limit']||null:null})['then'](function(_0x108db0){logger[_0x6feb('0xd')]('UpdateVoiceAgentReport',_0x41e013);logger[_0x6feb('0xf')](_0x6feb('0x1b'),_0x41e013,JSON['stringify'](_0x108db0));_0x2cb6d2(_0x108db0);})[_0x6feb('0x15')](function(_0x554b74){logger[_0x6feb('0x12')](_0x6feb('0x1b'),_0x554b74['message'],_0x41e013);_0x364233(_0x43debb[_0x6feb('0x12')](0x1f4,_0x554b74[_0x6feb('0x14')]));});});}; \ No newline at end of file +var _0x71e9=['info','result','catch','VoiceAgentReport','body','options','then','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0x71e9,0x10d));var _0x971e=function(_0x194f05,_0x55523e){_0x194f05=_0x194f05-0x0;var _0x319f22=_0x71e9[_0x194f05];return _0x319f22;};'use strict';var _=require(_0x971e('0x0'));var util=require(_0x971e('0x1'));var moment=require(_0x971e('0x2'));var BPromise=require(_0x971e('0x3'));var rs=require(_0x971e('0x4'));var fs=require('fs');var Redis=require(_0x971e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x971e('0x6'));var logger=require('../../config/logger')(_0x971e('0x7'));var config=require(_0x971e('0x8'));var jayson=require(_0x971e('0x9'));var client=jayson[_0x971e('0xa')][_0x971e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a6bad,_0x2df145,_0x3473e5){return new BPromise(function(_0x2bcbc4,_0xfc18cb){return client['request'](_0x4a6bad,_0x3473e5)['then'](function(_0xe5d714){logger['info'](_0x971e('0xc'),_0x2df145,_0x971e('0xd'));logger[_0x971e('0xe')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x2df145,'request\x20sent',JSON[_0x971e('0xf')](_0xe5d714));if(_0xe5d714[_0x971e('0x10')]){if(_0xe5d714['error'][_0x971e('0x11')]===0x1f4){logger[_0x971e('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x2df145,_0xe5d714[_0x971e('0x10')][_0x971e('0x12')]);return _0xfc18cb(_0xe5d714['error'][_0x971e('0x12')]);}logger[_0x971e('0x10')](_0x971e('0xc'),_0x2df145,_0xe5d714[_0x971e('0x10')][_0x971e('0x12')]);return _0x2bcbc4(_0xe5d714['error'][_0x971e('0x12')]);}else{logger[_0x971e('0x13')](_0x971e('0xc'),_0x2df145,_0x971e('0xd'));_0x2bcbc4(_0xe5d714[_0x971e('0x14')][_0x971e('0x12')]);}})[_0x971e('0x15')](function(_0x114f32){logger[_0x971e('0x10')](_0x971e('0xc'),_0x2df145,_0x114f32);_0xfc18cb(_0x114f32);});});}exports['CreateVoiceAgentReport']=function(_0x31f14a){var _0x34bf12=this;return new Promise(function(_0x1f7c8b,_0xecb27c){return db[_0x971e('0x16')]['create'](_0x31f14a[_0x971e('0x17')],{'raw':_0x31f14a['options']?_0x31f14a[_0x971e('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x971e('0x19')](function(_0x25b2b9){logger[_0x971e('0x13')]('CreateVoiceAgentReport',_0x31f14a);logger[_0x971e('0xe')](_0x971e('0x1a'),_0x31f14a,JSON[_0x971e('0xf')](_0x25b2b9));_0x1f7c8b(_0x25b2b9);})[_0x971e('0x15')](function(_0x14ed22){logger[_0x971e('0x10')](_0x971e('0x1a'),_0x14ed22[_0x971e('0x12')],_0x31f14a);_0xecb27c(_0x34bf12[_0x971e('0x10')](0x1f4,_0x14ed22[_0x971e('0x12')]));});});};exports[_0x971e('0x1b')]=function(_0xa3ef81){var _0x125d17=this;return new Promise(function(_0x2db90c,_0x166f32){return db[_0x971e('0x16')][_0x971e('0x1c')](_0xa3ef81[_0x971e('0x17')],{'raw':_0xa3ef81['options']?_0xa3ef81[_0x971e('0x18')][_0x971e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa3ef81[_0x971e('0x18')]?_0xa3ef81[_0x971e('0x18')][_0x971e('0x1e')]||null:null,'attributes':_0xa3ef81[_0x971e('0x18')]?_0xa3ef81['options'][_0x971e('0x1f')]||null:null,'limit':_0xa3ef81[_0x971e('0x18')]?_0xa3ef81[_0x971e('0x18')]['limit']||null:null})['then'](function(_0x20b07d){logger[_0x971e('0x13')](_0x971e('0x1b'),_0xa3ef81);logger[_0x971e('0xe')](_0x971e('0x1b'),_0xa3ef81,JSON['stringify'](_0x20b07d));_0x2db90c(_0x20b07d);})[_0x971e('0x15')](function(_0x2bbfca){logger[_0x971e('0x10')](_0x971e('0x1b'),_0x2bbfca['message'],_0xa3ef81);_0x166f32(_0x125d17[_0x971e('0x10')](0x1f4,_0x2bbfca['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 892fe85..4abd37d 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 _0xe0ae=['exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','index','get','/describe','isAuthenticated','show','post','put','/:id','update'];(function(_0x379f99,_0x502ea4){var _0x50fc12=function(_0xbb0ae5){while(--_0xbb0ae5){_0x379f99['push'](_0x379f99['shift']());}};_0x50fc12(++_0x502ea4);}(_0xe0ae,0xa1));var _0xee0a=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0xe0ae[_0x5eef05];return _0x56d4b8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee0a('0x0'));var timeout=require(_0xee0a('0x1'));var express=require('express');var router=express[_0xee0a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xee0a('0x3'));var interaction=require(_0xee0a('0x4'));var config=require('../../config/environment');var controller=require(_0xee0a('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xee0a('0x6')]);router[_0xee0a('0x7')](_0xee0a('0x8'),auth[_0xee0a('0x9')](),controller['describe']);router[_0xee0a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xee0a('0xa')]);router[_0xee0a('0xb')]('/',auth[_0xee0a('0x9')](),controller['create']);router[_0xee0a('0xc')](_0xee0a('0xd'),auth['isAuthenticated'](),controller[_0xee0a('0xe')]);router['delete'](_0xee0a('0xd'),auth[_0xee0a('0x9')](),controller['destroy']);module[_0xee0a('0xf')]=router; \ No newline at end of file +var _0x9957=['show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x422e6d,_0x3f51c1){var _0x3bf252=function(_0x375922){while(--_0x375922){_0x422e6d['push'](_0x422e6d['shift']());}};_0x3bf252(++_0x3f51c1);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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('0xf')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')](_0x7995('0x12'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);module[_0x7995('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 5ed193b..99f55cb 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 _0xa3b7=['sequelize','STRING','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','DATE','INTEGER'];(function(_0x586e9a,_0x5647e5){var _0x1a89c6=function(_0x562e55){while(--_0x562e55){_0x586e9a['push'](_0x586e9a['shift']());}};_0x1a89c6(++_0x5647e5);}(_0xa3b7,0xe6));var _0x7a3b=function(_0x4503df,_0xfec122){_0x4503df=_0x4503df-0x0;var _0x3f1b2b=_0xa3b7[_0x4503df];return _0x3f1b2b;};'use strict';var Sequelize=require(_0x7a3b('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7a3b('0x1')]},'type':{'type':Sequelize['ENUM'](_0x7a3b('0x2'),_0x7a3b('0x3'),_0x7a3b('0x4'),_0x7a3b('0x5'),_0x7a3b('0x6'),_0x7a3b('0x7'))},'tag':{'type':Sequelize[_0x7a3b('0x1')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x7a3b('0x1')]},'destination':{'type':Sequelize[_0x7a3b('0x1')]},'destinationcontext':{'type':Sequelize[_0x7a3b('0x1')]},'callerid':{'type':Sequelize[_0x7a3b('0x1')]},'channel':{'type':Sequelize[_0x7a3b('0x1')]},'destinationchannel':{'type':Sequelize[_0x7a3b('0x1')]},'lastapplication':{'type':Sequelize[_0x7a3b('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7a3b('0x8')]},'systemanswertime':{'type':Sequelize[_0x7a3b('0x8')]},'answertime':{'type':Sequelize[_0x7a3b('0x8')]},'endtime':{'type':Sequelize[_0x7a3b('0x8')]},'duration':{'type':Sequelize[_0x7a3b('0x9')]},'billableseconds':{'type':Sequelize[_0x7a3b('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7a3b('0x1')]},'amaflags':{'type':Sequelize[_0x7a3b('0x1')]},'userfield':{'type':Sequelize[_0x7a3b('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x7a3b('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x7a3b('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x7a3b('0x1')]},'routeid':{'type':Sequelize[_0x7a3b('0x9')]},'sipcallid':{'type':Sequelize[_0x7a3b('0x1')]}}; \ No newline at end of file +var _0x233e=['exports','STRING','inbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER'];(function(_0x3f9937,_0x97293){var _0x2c1fd5=function(_0x488ff8){while(--_0x488ff8){_0x3f9937['push'](_0x3f9937['shift']());}};_0x2c1fd5(++_0x97293);}(_0x233e,0x1dd));var _0xe233=function(_0x4b0233,_0x3136ea){_0x4b0233=_0x4b0233-0x0;var _0x5a4841=_0x233e[_0x4b0233];return _0x5a4841;};'use strict';var Sequelize=require('sequelize');module[_0xe233('0x0')]={'uniqueid':{'type':Sequelize[_0xe233('0x1')]},'type':{'type':Sequelize['ENUM'](_0xe233('0x2'),'internal','outbound',_0xe233('0x3'),_0xe233('0x4'),_0xe233('0x5'))},'tag':{'type':Sequelize[_0xe233('0x1')]},'accountcode':{'type':Sequelize[_0xe233('0x1')]},'source':{'type':Sequelize[_0xe233('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xe233('0x1')]},'callerid':{'type':Sequelize[_0xe233('0x1')]},'channel':{'type':Sequelize[_0xe233('0x1')]},'destinationchannel':{'type':Sequelize[_0xe233('0x1')]},'lastapplication':{'type':Sequelize[_0xe233('0x1')]},'lastdata':{'type':Sequelize[_0xe233('0x6')]},'starttime':{'type':Sequelize[_0xe233('0x7')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xe233('0x7')]},'duration':{'type':Sequelize[_0xe233('0x8')]},'billableseconds':{'type':Sequelize[_0xe233('0x8')]},'mohtime':{'type':Sequelize[_0xe233('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe233('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xe233('0x1')]},'userDisposition':{'type':Sequelize[_0xe233('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xe233('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xe233('0x1')]},'note':{'type':Sequelize[_0xe233('0x1')]},'prefix':{'type':Sequelize[_0xe233('0x1')]},'routeid':{'type':Sequelize[_0xe233('0x8')]},'sipcallid':{'type':Sequelize[_0xe233('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 8c3664b..dc68616 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 _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file +var _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','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','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x9c8b4a,_0x2387ff){var _0x198bef=function(_0x2eb4e8){while(--_0x2eb4e8){_0x9c8b4a['push'](_0x9c8b4a['shift']());}};_0x198bef(++_0x2387ff);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5b01c3,_0x19684c){_0x5b01c3=_0x5b01c3-0x0;var _0x15b2d0=_0x5f2f[_0x5b01c3];return _0x15b2d0;};'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')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 9fa8744..f647dba 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 _0xc519=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','report_call'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xc519,0x1ea));var _0x9c51=function(_0x2fd61e,_0x408859){_0x2fd61e=_0x2fd61e-0x0;var _0x55ee6b=_0xc519[_0x2fd61e];return _0x55ee6b;};'use strict';var _=require(_0x9c51('0x0'));var util=require(_0x9c51('0x1'));var logger=require('../../config/logger')(_0x9c51('0x2'));var moment=require(_0x9c51('0x3'));var BPromise=require(_0x9c51('0x4'));var rp=require(_0x9c51('0x5'));var fs=require('fs');var path=require(_0x9c51('0x6'));var rimraf=require('rimraf');var config=require(_0x9c51('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0x9c51('0x8')]=function(_0xea3056,_0x1ca53){return _0xea3056['define']('VoiceCallReport',attributes,{'tableName':_0x9c51('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc2c1=['uniqueid','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','VoiceCallReport','report_call'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc2c1,0x90));var _0x1c2c=function(_0x2c64ab,_0x266970){_0x2c64ab=_0x2c64ab-0x0;var _0x242269=_0xc2c1[_0x2c64ab];return _0x242269;};'use strict';var _=require(_0x1c2c('0x0'));var util=require('util');var logger=require(_0x1c2c('0x1'))(_0x1c2c('0x2'));var moment=require(_0x1c2c('0x3'));var BPromise=require(_0x1c2c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c2c('0x5'));var rimraf=require(_0x1c2c('0x6'));var config=require(_0x1c2c('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0x1c2c('0x8')]=function(_0xd27b32,_0x2efa58){return _0xd27b32[_0x1c2c('0x9')](_0x1c2c('0xa'),attributes,{'tableName':_0x1c2c('0xb'),'paranoid':![],'indexes':[{'fields':[_0x1c2c('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 562f3d4..ddc5477 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 _0x4d15=['jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceCallReport','options','raw','where','attributes','limit','include','map','model','debug','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x500388,_0x478018){var _0x1fc581=function(_0x370fe0){while(--_0x370fe0){_0x500388['push'](_0x500388['shift']());}};_0x1fc581(++_0x478018);}(_0x4d15,0x67));var _0x54d1=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4d15[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x54d1('0x0'));var util=require('util');var moment=require(_0x54d1('0x1'));var BPromise=require(_0x54d1('0x2'));var rs=require(_0x54d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x54d1('0x4'));var logger=require(_0x54d1('0x5'))(_0x54d1('0x6'));var config=require(_0x54d1('0x7'));var jayson=require(_0x54d1('0x8'));var client=jayson[_0x54d1('0x9')][_0x54d1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39c317,_0x517ded,_0x624d9d){return new BPromise(function(_0x3b5645,_0x55f285){return client[_0x54d1('0xb')](_0x39c317,_0x624d9d)[_0x54d1('0xc')](function(_0x39ff8d){logger[_0x54d1('0xd')](_0x54d1('0xe'),_0x517ded,_0x54d1('0xf'));logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x517ded,_0x54d1('0xf'),JSON[_0x54d1('0x10')](_0x39ff8d));if(_0x39ff8d[_0x54d1('0x11')]){if(_0x39ff8d['error'][_0x54d1('0x12')]===0x1f4){logger[_0x54d1('0x11')](_0x54d1('0xe'),_0x517ded,_0x39ff8d['error'][_0x54d1('0x13')]);return _0x55f285(_0x39ff8d[_0x54d1('0x11')][_0x54d1('0x13')]);}logger['error'](_0x54d1('0xe'),_0x517ded,_0x39ff8d[_0x54d1('0x11')][_0x54d1('0x13')]);return _0x3b5645(_0x39ff8d['error'][_0x54d1('0x13')]);}else{logger[_0x54d1('0xd')](_0x54d1('0xe'),_0x517ded,_0x54d1('0xf'));_0x3b5645(_0x39ff8d[_0x54d1('0x14')]['message']);}})[_0x54d1('0x15')](function(_0x24a526){logger[_0x54d1('0x11')](_0x54d1('0xe'),_0x517ded,_0x24a526);_0x55f285(_0x24a526);});});}exports[_0x54d1('0x16')]=function(_0x29a1d0){var _0x56351e=this;return new Promise(function(_0xad99bc,_0x4cfb58){return db['VoiceCallReport']['findAll']({'raw':_0x29a1d0[_0x54d1('0x17')]?_0x29a1d0[_0x54d1('0x17')][_0x54d1('0x18')]===undefined?!![]:![]:!![],'where':_0x29a1d0[_0x54d1('0x17')]?_0x29a1d0[_0x54d1('0x17')][_0x54d1('0x19')]||null:null,'attributes':_0x29a1d0[_0x54d1('0x17')]?_0x29a1d0[_0x54d1('0x17')][_0x54d1('0x1a')]||null:null,'limit':_0x29a1d0[_0x54d1('0x17')]?_0x29a1d0['options'][_0x54d1('0x1b')]||null:null,'include':_0x29a1d0['options']?_0x29a1d0[_0x54d1('0x17')][_0x54d1('0x1c')]?_[_0x54d1('0x1d')](_0x29a1d0[_0x54d1('0x17')]['include'],function(_0x28fbc1){return{'model':db[_0x28fbc1[_0x54d1('0x1e')]],'as':_0x28fbc1['as'],'attributes':_0x28fbc1[_0x54d1('0x1a')],'include':_0x28fbc1[_0x54d1('0x1c')]?_[_0x54d1('0x1d')](_0x28fbc1[_0x54d1('0x1c')],function(_0x5432c4){return{'model':db[_0x5432c4[_0x54d1('0x1e')]],'as':_0x5432c4['as'],'attributes':_0x5432c4[_0x54d1('0x1a')],'include':_0x5432c4[_0x54d1('0x1c')]?_[_0x54d1('0x1d')](_0x5432c4[_0x54d1('0x1c')],function(_0x434568){return{'model':db[_0x434568[_0x54d1('0x1e')]],'as':_0x434568['as'],'attributes':_0x434568[_0x54d1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x54d1('0xc')](function(_0x11de74){logger[_0x54d1('0xd')](_0x54d1('0x16'),_0x29a1d0);logger[_0x54d1('0x1f')](_0x54d1('0x16'),_0x29a1d0,JSON['stringify'](_0x11de74));_0xad99bc(_0x11de74);})[_0x54d1('0x15')](function(_0x4955f0){logger[_0x54d1('0x11')](_0x54d1('0x16'),_0x4955f0[_0x54d1('0x13')],_0x29a1d0);_0x4cfb58(_0x56351e['error'](0x1f4,_0x4955f0[_0x54d1('0x13')]));});});};exports[_0x54d1('0x20')]=function(_0x21e99f){var _0x5bdcc8=this;return new Promise(function(_0x3336a6,_0x2413d2){return db[_0x54d1('0x21')][_0x54d1('0x22')](_0x21e99f[_0x54d1('0x23')],{'raw':_0x21e99f['options']?_0x21e99f[_0x54d1('0x17')][_0x54d1('0x18')]===undefined?!![]:![]:!![]})[_0x54d1('0xc')](function(_0x315eef){logger[_0x54d1('0xd')](_0x54d1('0x20'),_0x21e99f);logger['debug']('CreateVoiceCallReport',_0x21e99f,JSON[_0x54d1('0x10')](_0x315eef));_0x3336a6(_0x315eef);})[_0x54d1('0x15')](function(_0x20a8b4){logger[_0x54d1('0x11')](_0x54d1('0x20'),_0x20a8b4[_0x54d1('0x13')],_0x21e99f);_0x2413d2(_0x5bdcc8[_0x54d1('0x11')](0x1f4,_0x20a8b4[_0x54d1('0x13')]));});});};exports[_0x54d1('0x24')]=function(_0x35eccc){var _0x4628bd=this;return new Promise(function(_0x2160c5,_0xbe4a98){return db['VoiceCallReport']['update'](_0x35eccc[_0x54d1('0x23')],{'raw':_0x35eccc['options']?_0x35eccc[_0x54d1('0x17')][_0x54d1('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35eccc[_0x54d1('0x17')]?_0x35eccc[_0x54d1('0x17')][_0x54d1('0x19')]||null:null,'attributes':_0x35eccc[_0x54d1('0x17')]?_0x35eccc[_0x54d1('0x17')][_0x54d1('0x1a')]||null:null,'limit':_0x35eccc[_0x54d1('0x17')]?_0x35eccc[_0x54d1('0x17')][_0x54d1('0x1b')]||null:null})[_0x54d1('0xc')](function(_0x3d98a7){logger[_0x54d1('0xd')](_0x54d1('0x24'),_0x35eccc);logger['debug'](_0x54d1('0x24'),_0x35eccc,JSON[_0x54d1('0x10')](_0x3d98a7));_0x2160c5(_0x3d98a7);})['catch'](function(_0x5d86d0){logger[_0x54d1('0x11')]('UpdateVoiceCallReport',_0x5d86d0['message'],_0x35eccc);_0xbe4a98(_0x4628bd[_0x54d1('0x11')](0x1f4,_0x5d86d0[_0x54d1('0x13')]));});});}; \ No newline at end of file +var _0x5ad3=['GetVoiceCallReport','findAll','options','raw','where','attributes','include','map','model','debug','catch','CreateVoiceCallReport','VoiceCallReport','UpdateVoiceCallReport','update','body','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x5486b6,_0xd7dda){var _0x52587a=function(_0x32dbd6){while(--_0x32dbd6){_0x5486b6['push'](_0x5486b6['shift']());}};_0x52587a(++_0xd7dda);}(_0x5ad3,0x197));var _0x35ad=function(_0x4cfc1d,_0x2c0927){_0x4cfc1d=_0x4cfc1d-0x0;var _0x1c01a0=_0x5ad3[_0x4cfc1d];return _0x1c01a0;};'use strict';var _=require('lodash');var util=require(_0x35ad('0x0'));var moment=require(_0x35ad('0x1'));var BPromise=require(_0x35ad('0x2'));var rs=require(_0x35ad('0x3'));var fs=require('fs');var Redis=require(_0x35ad('0x4'));var db=require(_0x35ad('0x5'))['db'];var utils=require(_0x35ad('0x6'));var logger=require(_0x35ad('0x7'))(_0x35ad('0x8'));var config=require(_0x35ad('0x9'));var jayson=require(_0x35ad('0xa'));var client=jayson[_0x35ad('0xb')][_0x35ad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3d0da5,_0x47972f,_0x9c4a79){return new BPromise(function(_0x50a89f,_0x1c1a1f){return client[_0x35ad('0xd')](_0x3d0da5,_0x9c4a79)[_0x35ad('0xe')](function(_0x5f5765){logger['info'](_0x35ad('0xf'),_0x47972f,_0x35ad('0x10'));logger['debug'](_0x35ad('0x11'),_0x47972f,_0x35ad('0x10'),JSON[_0x35ad('0x12')](_0x5f5765));if(_0x5f5765[_0x35ad('0x13')]){if(_0x5f5765[_0x35ad('0x13')]['code']===0x1f4){logger[_0x35ad('0x13')](_0x35ad('0xf'),_0x47972f,_0x5f5765[_0x35ad('0x13')][_0x35ad('0x14')]);return _0x1c1a1f(_0x5f5765[_0x35ad('0x13')]['message']);}logger['error'](_0x35ad('0xf'),_0x47972f,_0x5f5765[_0x35ad('0x13')][_0x35ad('0x14')]);return _0x50a89f(_0x5f5765[_0x35ad('0x13')]['message']);}else{logger[_0x35ad('0x15')](_0x35ad('0xf'),_0x47972f,'request\x20sent');_0x50a89f(_0x5f5765['result']['message']);}})['catch'](function(_0x505328){logger[_0x35ad('0x13')](_0x35ad('0xf'),_0x47972f,_0x505328);_0x1c1a1f(_0x505328);});});}exports[_0x35ad('0x16')]=function(_0x333a9d){var _0xa5bf82=this;return new Promise(function(_0x3d60c4,_0x4611e5){return db['VoiceCallReport'][_0x35ad('0x17')]({'raw':_0x333a9d[_0x35ad('0x18')]?_0x333a9d[_0x35ad('0x18')][_0x35ad('0x19')]===undefined?!![]:![]:!![],'where':_0x333a9d[_0x35ad('0x18')]?_0x333a9d['options'][_0x35ad('0x1a')]||null:null,'attributes':_0x333a9d[_0x35ad('0x18')]?_0x333a9d[_0x35ad('0x18')][_0x35ad('0x1b')]||null:null,'limit':_0x333a9d[_0x35ad('0x18')]?_0x333a9d[_0x35ad('0x18')]['limit']||null:null,'include':_0x333a9d[_0x35ad('0x18')]?_0x333a9d[_0x35ad('0x18')][_0x35ad('0x1c')]?_[_0x35ad('0x1d')](_0x333a9d['options']['include'],function(_0x41f2ed){return{'model':db[_0x41f2ed[_0x35ad('0x1e')]],'as':_0x41f2ed['as'],'attributes':_0x41f2ed['attributes'],'include':_0x41f2ed[_0x35ad('0x1c')]?_[_0x35ad('0x1d')](_0x41f2ed[_0x35ad('0x1c')],function(_0x3f158e){return{'model':db[_0x3f158e[_0x35ad('0x1e')]],'as':_0x3f158e['as'],'attributes':_0x3f158e['attributes'],'include':_0x3f158e[_0x35ad('0x1c')]?_[_0x35ad('0x1d')](_0x3f158e[_0x35ad('0x1c')],function(_0xe907f3){return{'model':db[_0xe907f3[_0x35ad('0x1e')]],'as':_0xe907f3['as'],'attributes':_0xe907f3[_0x35ad('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23c6e3){logger[_0x35ad('0x15')]('GetVoiceCallReport',_0x333a9d);logger[_0x35ad('0x1f')](_0x35ad('0x16'),_0x333a9d,JSON['stringify'](_0x23c6e3));_0x3d60c4(_0x23c6e3);})[_0x35ad('0x20')](function(_0x1eadda){logger[_0x35ad('0x13')](_0x35ad('0x16'),_0x1eadda[_0x35ad('0x14')],_0x333a9d);_0x4611e5(_0xa5bf82[_0x35ad('0x13')](0x1f4,_0x1eadda[_0x35ad('0x14')]));});});};exports[_0x35ad('0x21')]=function(_0x56c362){var _0xbf6ecc=this;return new Promise(function(_0x39d05a,_0x4d9a62){return db[_0x35ad('0x22')]['create'](_0x56c362['body'],{'raw':_0x56c362[_0x35ad('0x18')]?_0x56c362[_0x35ad('0x18')][_0x35ad('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x32c4cc){logger[_0x35ad('0x15')]('CreateVoiceCallReport',_0x56c362);logger['debug']('CreateVoiceCallReport',_0x56c362,JSON[_0x35ad('0x12')](_0x32c4cc));_0x39d05a(_0x32c4cc);})[_0x35ad('0x20')](function(_0x3584bc){logger[_0x35ad('0x13')](_0x35ad('0x21'),_0x3584bc['message'],_0x56c362);_0x4d9a62(_0xbf6ecc['error'](0x1f4,_0x3584bc[_0x35ad('0x14')]));});});};exports[_0x35ad('0x23')]=function(_0x3591d6){var _0x2b6178=this;return new Promise(function(_0x4cf678,_0x4d80fa){return db['VoiceCallReport'][_0x35ad('0x24')](_0x3591d6[_0x35ad('0x25')],{'raw':_0x3591d6[_0x35ad('0x18')]?_0x3591d6[_0x35ad('0x18')][_0x35ad('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3591d6[_0x35ad('0x18')]?_0x3591d6[_0x35ad('0x18')][_0x35ad('0x1a')]||null:null,'attributes':_0x3591d6[_0x35ad('0x18')]?_0x3591d6[_0x35ad('0x18')][_0x35ad('0x1b')]||null:null,'limit':_0x3591d6['options']?_0x3591d6[_0x35ad('0x18')][_0x35ad('0x26')]||null:null})[_0x35ad('0xe')](function(_0x16e246){logger[_0x35ad('0x15')](_0x35ad('0x23'),_0x3591d6);logger[_0x35ad('0x1f')](_0x35ad('0x23'),_0x3591d6,JSON[_0x35ad('0x12')](_0x16e246));_0x4cf678(_0x16e246);})[_0x35ad('0x20')](function(_0x546099){logger[_0x35ad('0x13')](_0x35ad('0x23'),_0x546099[_0x35ad('0x14')],_0x3591d6);_0x4d80fa(_0x2b6178[_0x35ad('0x13')](0x1f4,_0x546099[_0x35ad('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 4cc0dfc..0394f7b 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 _0xa006=['delete','destroy','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','post'];(function(_0x4e4519,_0x392ae){var _0x340044=function(_0x11721f){while(--_0x11721f){_0x4e4519['push'](_0x4e4519['shift']());}};_0x340044(++_0x392ae);}(_0xa006,0x16a));var _0x6a00=function(_0x5c1633,_0x418d16){_0x5c1633=_0x5c1633-0x0;var _0x5572b3=_0xa006[_0x5c1633];return _0x5572b3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6a00('0x0'));var router=express[_0x6a00('0x1')]();var fs_extra=require(_0x6a00('0x2'));var auth=require(_0x6a00('0x3'));var interaction=require(_0x6a00('0x4'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0x6a00('0x5')]('/',auth[_0x6a00('0x6')](),controller['index']);router[_0x6a00('0x5')](_0x6a00('0x7'),auth[_0x6a00('0x6')](),controller[_0x6a00('0x8')]);router[_0x6a00('0x9')]('/',auth[_0x6a00('0x6')](),controller['create']);router['put'](_0x6a00('0x7'),auth[_0x6a00('0x6')](),controller['update']);router[_0x6a00('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x6a00('0xb')]);module['exports']=router; \ No newline at end of file +var _0xe6f6=['./voiceChanSpy.controller','isAuthenticated','index','get','post','put','/:id','update','delete','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xf8f772,_0x26d95e){var _0x27583f=function(_0x39d1f1){while(--_0x39d1f1){_0xf8f772['push'](_0xf8f772['shift']());}};_0x27583f(++_0x26d95e);}(_0xe6f6,0x13b));var _0x6e6f=function(_0x5b5a35,_0x5aef14){_0x5b5a35=_0x5b5a35-0x0;var _0x458a06=_0xe6f6[_0x5b5a35];return _0x458a06;};'use strict';var multer=require('multer');var util=require(_0x6e6f('0x0'));var path=require(_0x6e6f('0x1'));var timeout=require(_0x6e6f('0x2'));var express=require('express');var router=express[_0x6e6f('0x3')]();var fs_extra=require(_0x6e6f('0x4'));var auth=require(_0x6e6f('0x5'));var interaction=require(_0x6e6f('0x6'));var config=require(_0x6e6f('0x7'));var controller=require(_0x6e6f('0x8'));router['get']('/',auth[_0x6e6f('0x9')](),controller[_0x6e6f('0xa')]);router[_0x6e6f('0xb')]('/:id',auth[_0x6e6f('0x9')](),controller['show']);router[_0x6e6f('0xc')]('/',auth[_0x6e6f('0x9')](),controller['create']);router[_0x6e6f('0xd')](_0x6e6f('0xe'),auth[_0x6e6f('0x9')](),controller[_0x6e6f('0xf')]);router[_0x6e6f('0x10')](_0x6e6f('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 2271f2a..2ae82eb 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 _0xf670=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','options','join'];(function(_0x418549,_0x11b13d){var _0x288826=function(_0x3c0411){while(--_0x3c0411){_0x418549['push'](_0x418549['shift']());}};_0x288826(++_0x11b13d);}(_0xf670,0x193));var _0x0f67=function(_0x4a1ec0,_0x26287b){_0x4a1ec0=_0x4a1ec0-0x0;var _0x49ab91=_0xf670[_0x4a1ec0];return _0x49ab91;};'use strict';var Sequelize=require(_0x0f67('0x0'));module[_0x0f67('0x1')]={'name':{'type':Sequelize[_0x0f67('0x2')]},'prefix':{'type':Sequelize[_0x0f67('0x2')],'unique':_0x0f67('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x0f67('0x2')],'set':function(_0xcc8791){this[_0x0f67('0x4')](_0x0f67('0x5'),_0xcc8791?_0xcc8791[_0x0f67('0x6')](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0x0f67('0x7')](_0x0f67('0x5'))[_0x0f67('0x8')](''):[];}},'auth':{'type':Sequelize[_0x0f67('0x9')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x0f67('0x2')]},'description':{'type':Sequelize[_0x0f67('0x2')]}}; \ No newline at end of file +var _0xca3f=['exports','name','STRING','setDataValue','options','getDataValue','split','BOOLEAN','sequelize'];(function(_0x11f5ff,_0xa0ef18){var _0x46eefb=function(_0x51872a){while(--_0x51872a){_0x11f5ff['push'](_0x11f5ff['shift']());}};_0x46eefb(++_0xa0ef18);}(_0xca3f,0x194));var _0xfca3=function(_0x14e5ed,_0x1a3395){_0x14e5ed=_0x14e5ed-0x0;var _0x190cf2=_0xca3f[_0x14e5ed];return _0x190cf2;};'use strict';var Sequelize=require(_0xfca3('0x0'));module[_0xfca3('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0xfca3('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xfca3('0x3')],'set':function(_0xdced30){this[_0xfca3('0x4')](_0xfca3('0x5'),_0xdced30?_0xdced30['join'](''):[]);},'get':function(){return this[_0xfca3('0x6')](_0xfca3('0x5'))?this[_0xfca3('0x6')](_0xfca3('0x5'))[_0xfca3('0x7')](''):[];}},'auth':{'type':Sequelize[_0xfca3('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xfca3('0x3')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfca3('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 029e26b..8cf04a1 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 _0x477a=['role','ChanSpies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','include','rows','catch','show','options','find','create','body','user'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x477a,0x1e2));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa477('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa477('0x1'));var jsonpatch=require(_0xa477('0x2'));var rp=require('request-promise');var moment=require(_0xa477('0x3'));var BPromise=require(_0xa477('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa477('0x5'));var sox=require(_0xa477('0x6'));var csv=require('to-csv');var ejs=require(_0xa477('0x7'));var fs=require('fs');var fs_extra=require(_0xa477('0x8'));var _=require(_0xa477('0x9'));var squel=require(_0xa477('0xa'));var crypto=require(_0xa477('0xb'));var jsforce=require(_0xa477('0xc'));var deskjs=require(_0xa477('0xd'));var toCsv=require(_0xa477('0xe'));var querystring=require(_0xa477('0xf'));var Papa=require('papaparse');var Redis=require(_0xa477('0x10'));var authService=require(_0xa477('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa477('0x12'));var config=require(_0xa477('0x13'));var licenseUtil=require(_0xa477('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x280b97,_0x3d2a17){_0x3d2a17=_0x3d2a17||0xcc;return function(_0x70e1c1){if(_0x70e1c1){return _0x280b97['sendStatus'](_0x3d2a17);}return _0x280b97[_0xa477('0x15')](_0x3d2a17)[_0xa477('0x16')]();};}function respondWithResult(_0xbb21a7,_0x185c76){_0x185c76=_0x185c76||0xc8;return function(_0xe878a){if(_0xe878a){return _0xbb21a7['status'](_0x185c76)[_0xa477('0x17')](_0xe878a);}};}function respondWithFilteredResult(_0x2336fe,_0xa607d0){return function(_0x45ecc1){if(_0x45ecc1){var _0x22a156=typeof _0xa607d0[_0xa477('0x18')]===_0xa477('0x19')&&typeof _0xa607d0[_0xa477('0x1a')]===_0xa477('0x19');var _0x22a71c=_0x45ecc1[_0xa477('0x1b')];var _0x33db41=_0x22a156?0x0:_0xa607d0[_0xa477('0x18')];var _0x4a413c=_0x22a156?_0x45ecc1[_0xa477('0x1b')]:_0xa607d0[_0xa477('0x18')]+_0xa607d0[_0xa477('0x1a')];var _0x21cd60;if(_0x4a413c>=_0x22a71c){_0x4a413c=_0x22a71c;_0x21cd60=0xc8;}else{_0x21cd60=0xce;}_0x2336fe[_0xa477('0x15')](_0x21cd60);return _0x2336fe[_0xa477('0x1c')](_0xa477('0x1d'),_0x33db41+'-'+_0x4a413c+'/'+_0x22a71c)[_0xa477('0x17')](_0x45ecc1);}return null;};}function patchUpdates(_0x5af670){return function(_0x434ef1){try{jsonpatch[_0xa477('0x1e')](_0x434ef1,_0x5af670,!![]);}catch(_0x4a8c94){return BPromise['reject'](_0x4a8c94);}return _0x434ef1['save']();};}function saveUpdates(_0x4b7f69,_0x14d01e){return function(_0x2debae){if(_0x2debae){return _0x2debae['update'](_0x4b7f69)[_0xa477('0x1f')](function(_0x4faebd){return _0x4faebd;});}return null;};}function removeEntity(_0x5b6e98,_0x7aa4ac){return function(_0x166694){if(_0x166694){return _0x166694[_0xa477('0x20')]()[_0xa477('0x1f')](function(){var _0x472ed1=_0x166694[_0xa477('0x21')]({'plain':!![]});var _0x2b5c7f='ChanSpies';return db[_0xa477('0x22')][_0xa477('0x20')]({'where':{'type':_0x2b5c7f,'resourceId':_0x472ed1['id']}})[_0xa477('0x1f')](function(){return _0x166694;});})[_0xa477('0x1f')](function(){_0x5b6e98[_0xa477('0x15')](0xcc)[_0xa477('0x16')]();});}};}function handleEntityNotFound(_0x75f779,_0x47a86c){return function(_0x46c831){if(!_0x46c831){_0x75f779[_0xa477('0x23')](0x194);}return _0x46c831;};}function handleError(_0x287c83,_0x25acee){_0x25acee=_0x25acee||0x1f4;return function(_0x18d6a1){logger[_0xa477('0x24')](_0x18d6a1[_0xa477('0x25')]);if(_0x18d6a1['name']){delete _0x18d6a1[_0xa477('0x26')];}_0x287c83['status'](_0x25acee)['send'](_0x18d6a1);};}exports[_0xa477('0x27')]=function(_0x1fa6a5,_0x4c27e7){var _0x15e476={},_0x15c0ea={},_0x3dd666={'count':0x0,'rows':[]};var _0x3ec631=_[_0xa477('0x28')](db[_0xa477('0x29')][_0xa477('0x2a')],function(_0x91f9bf){return{'name':_0x91f9bf[_0xa477('0x2b')],'type':_0x91f9bf[_0xa477('0x2c')][_0xa477('0x2d')]};});_0x15c0ea[_0xa477('0x2e')]=_[_0xa477('0x28')](_0x3ec631,'name');_0x15c0ea[_0xa477('0x2f')]=_[_0xa477('0x30')](_0x1fa6a5[_0xa477('0x2f')]);_0x15c0ea[_0xa477('0x31')]=_[_0xa477('0x32')](_0x15c0ea[_0xa477('0x2e')],_0x15c0ea[_0xa477('0x2f')]);_0x15e476[_0xa477('0x33')]=_['intersection'](_0x15c0ea[_0xa477('0x2e')],qs[_0xa477('0x34')](_0x1fa6a5[_0xa477('0x2f')][_0xa477('0x34')]));_0x15e476[_0xa477('0x33')]=_0x15e476[_0xa477('0x33')][_0xa477('0x35')]?_0x15e476[_0xa477('0x33')]:_0x15c0ea[_0xa477('0x2e')];if(!_0x1fa6a5[_0xa477('0x2f')][_0xa477('0x36')](_0xa477('0x37'))){_0x15e476[_0xa477('0x1a')]=qs[_0xa477('0x1a')](_0x1fa6a5[_0xa477('0x2f')][_0xa477('0x1a')]);_0x15e476[_0xa477('0x18')]=qs[_0xa477('0x18')](_0x1fa6a5[_0xa477('0x2f')]['offset']);}_0x15e476[_0xa477('0x38')]=qs[_0xa477('0x39')](_0x1fa6a5[_0xa477('0x2f')][_0xa477('0x39')]);_0x15e476[_0xa477('0x3a')]=qs[_0xa477('0x31')](_['pick'](_0x1fa6a5['query'],_0x15c0ea[_0xa477('0x31')]),_0x3ec631);if(_0x1fa6a5[_0xa477('0x2f')][_0xa477('0x3b')]){_0x15e476[_0xa477('0x3a')]=_['merge'](_0x15e476['where'],{'$or':_[_0xa477('0x28')](_0x3ec631,function(_0x318086){if(_0x318086[_0xa477('0x2c')]!==_0xa477('0x3c')){var _0x326962={};_0x326962[_0x318086[_0xa477('0x26')]]={'$like':'%'+_0x1fa6a5[_0xa477('0x2f')][_0xa477('0x3b')]+'%'};return _0x326962;}})});}_0x15e476=_[_0xa477('0x3d')]({},_0x15e476,_0x1fa6a5['options']);var _0x2406ff={'where':_0x15e476[_0xa477('0x3a')]};return db[_0xa477('0x29')]['count'](_0x2406ff)[_0xa477('0x1f')](function(_0x4be8cb){_0x3dd666[_0xa477('0x1b')]=_0x4be8cb;if(_0x1fa6a5[_0xa477('0x2f')]['includeAll']){_0x15e476[_0xa477('0x3e')]=[{'all':!![]}];}return db[_0xa477('0x29')]['findAll'](_0x15e476);})[_0xa477('0x1f')](function(_0x37f18c){_0x3dd666[_0xa477('0x3f')]=_0x37f18c;return _0x3dd666;})[_0xa477('0x1f')](respondWithFilteredResult(_0x4c27e7,_0x15e476))[_0xa477('0x40')](handleError(_0x4c27e7,null));};exports[_0xa477('0x41')]=function(_0x2ecc11,_0xb1480a){var _0x983c11={'raw':![],'where':{'id':_0x2ecc11['params']['id']}},_0x476746={};_0x476746[_0xa477('0x2e')]=_[_0xa477('0x30')](db[_0xa477('0x29')][_0xa477('0x2a')]);_0x476746[_0xa477('0x2f')]=_['keys'](_0x2ecc11[_0xa477('0x2f')]);_0x476746['filters']=_[_0xa477('0x32')](_0x476746[_0xa477('0x2e')],_0x476746[_0xa477('0x2f')]);_0x983c11['attributes']=_[_0xa477('0x32')](_0x476746[_0xa477('0x2e')],qs[_0xa477('0x34')](_0x2ecc11[_0xa477('0x2f')][_0xa477('0x34')]));_0x983c11[_0xa477('0x33')]=_0x983c11[_0xa477('0x33')][_0xa477('0x35')]?_0x983c11[_0xa477('0x33')]:_0x476746[_0xa477('0x2e')];if(_0x2ecc11[_0xa477('0x2f')]['includeAll']){_0x983c11[_0xa477('0x3e')]=[{'all':!![]}];}_0x983c11=_[_0xa477('0x3d')]({},_0x983c11,_0x2ecc11[_0xa477('0x42')]);return db['VoiceChanSpy'][_0xa477('0x43')](_0x983c11)[_0xa477('0x1f')](handleEntityNotFound(_0xb1480a,null))['then'](respondWithResult(_0xb1480a,null))[_0xa477('0x40')](handleError(_0xb1480a,null));};exports[_0xa477('0x44')]=function(_0x404b00,_0x543a19){return db[_0xa477('0x29')]['create'](_0x404b00[_0xa477('0x45')],{})['then'](function(_0xd74d50){var _0x271831=_0x404b00[_0xa477('0x46')][_0xa477('0x21')]({'plain':!![]});if(!_0x271831)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x271831[_0xa477('0x47')]===_0xa477('0x46')){var _0xa30b74=_0xd74d50['get']({'plain':!![]});var _0x4fb38b=_0xa477('0x48');return db[_0xa477('0x49')][_0xa477('0x43')]({'where':{'name':_0x4fb38b,'userProfileId':_0x271831[_0xa477('0x4a')]},'raw':!![]})[_0xa477('0x1f')](function(_0x1dfcbd){if(_0x1dfcbd&&_0x1dfcbd[_0xa477('0x4b')]===0x0){return db[_0xa477('0x22')]['create']({'name':_0xa30b74['name'],'resourceId':_0xa30b74['id'],'type':_0x1dfcbd[_0xa477('0x26')],'sectionId':_0x1dfcbd['id']},{})[_0xa477('0x1f')](function(){return _0xd74d50;});}else{return _0xd74d50;}})[_0xa477('0x40')](function(_0xadf7b9){logger[_0xa477('0x24')](_0xa477('0x4c'),_0xadf7b9);throw _0xadf7b9;});}return _0xd74d50;})['then'](respondWithResult(_0x543a19,0xc9))[_0xa477('0x40')](handleError(_0x543a19,null));};exports[_0xa477('0x4d')]=function(_0x219417,_0x2d4b29){if(_0x219417[_0xa477('0x45')]['id']){delete _0x219417[_0xa477('0x45')]['id'];}return db[_0xa477('0x29')]['find']({'where':{'id':_0x219417['params']['id']}})[_0xa477('0x1f')](handleEntityNotFound(_0x2d4b29,null))[_0xa477('0x1f')](saveUpdates(_0x219417[_0xa477('0x45')],null))['then'](respondWithResult(_0x2d4b29,null))[_0xa477('0x40')](handleError(_0x2d4b29,null));};exports[_0xa477('0x20')]=function(_0x12b028,_0x504722){return db[_0xa477('0x29')][_0xa477('0x43')]({'where':{'id':_0x12b028[_0xa477('0x4e')]['id']}})[_0xa477('0x1f')](handleEntityNotFound(_0x504722,null))[_0xa477('0x1f')](removeEntity(_0x504722,null))[_0xa477('0x40')](handleError(_0x504722,null));}; \ No newline at end of file +var _0x1094=['autoAssociation','UserProfileResource','params','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','destroy','error','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','rows','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChanSpies','UserProfileSection'];(function(_0x41047c,_0x604f70){var _0x54508e=function(_0x36931a){while(--_0x36931a){_0x41047c['push'](_0x41047c['shift']());}};_0x54508e(++_0x604f70);}(_0x1094,0x143));var _0x4109=function(_0x43d106,_0x96a475){_0x43d106=_0x43d106-0x0;var _0x2160bc=_0x1094[_0x43d106];return _0x2160bc;};'use strict';var emlformat=require(_0x4109('0x0'));var rimraf=require(_0x4109('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4109('0x2'));var rp=require('request-promise');var moment=require(_0x4109('0x3'));var BPromise=require(_0x4109('0x4'));var Mustache=require(_0x4109('0x5'));var util=require(_0x4109('0x6'));var path=require(_0x4109('0x7'));var sox=require('sox');var csv=require(_0x4109('0x8'));var ejs=require(_0x4109('0x9'));var fs=require('fs');var fs_extra=require(_0x4109('0xa'));var _=require(_0x4109('0xb'));var squel=require(_0x4109('0xc'));var crypto=require(_0x4109('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4109('0xe'));var toCsv=require(_0x4109('0x8'));var querystring=require(_0x4109('0xf'));var Papa=require(_0x4109('0x10'));var Redis=require(_0x4109('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4109('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4109('0x13'))(_0x4109('0x14'));var utils=require(_0x4109('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4109('0x16'));var db=require(_0x4109('0x17'))['db'];function respondWithStatusCode(_0xfa09ea,_0x41e682){_0x41e682=_0x41e682||0xcc;return function(_0x2c2c9d){if(_0x2c2c9d){return _0xfa09ea['sendStatus'](_0x41e682);}return _0xfa09ea[_0x4109('0x18')](_0x41e682)[_0x4109('0x19')]();};}function respondWithResult(_0x3c8a84,_0x3c893a){_0x3c893a=_0x3c893a||0xc8;return function(_0x4a13fc){if(_0x4a13fc){return _0x3c8a84['status'](_0x3c893a)[_0x4109('0x1a')](_0x4a13fc);}};}function respondWithFilteredResult(_0x397937,_0x2e8e63){return function(_0x37b444){if(_0x37b444){var _0x1d81d8=typeof _0x2e8e63[_0x4109('0x1b')]===_0x4109('0x1c')&&typeof _0x2e8e63[_0x4109('0x1d')]==='undefined';var _0x4c4cf3=_0x37b444[_0x4109('0x1e')];var _0x328f1c=_0x1d81d8?0x0:_0x2e8e63[_0x4109('0x1b')];var _0x2e3fd6=_0x1d81d8?_0x37b444[_0x4109('0x1e')]:_0x2e8e63[_0x4109('0x1b')]+_0x2e8e63[_0x4109('0x1d')];var _0x6e8d56;if(_0x2e3fd6>=_0x4c4cf3){_0x2e3fd6=_0x4c4cf3;_0x6e8d56=0xc8;}else{_0x6e8d56=0xce;}_0x397937[_0x4109('0x18')](_0x6e8d56);return _0x397937['set'](_0x4109('0x1f'),_0x328f1c+'-'+_0x2e3fd6+'/'+_0x4c4cf3)[_0x4109('0x1a')](_0x37b444);}return null;};}function patchUpdates(_0x5cde5d){return function(_0x295f97){try{jsonpatch[_0x4109('0x20')](_0x295f97,_0x5cde5d,!![]);}catch(_0x4ba222){return BPromise['reject'](_0x4ba222);}return _0x295f97[_0x4109('0x21')]();};}function saveUpdates(_0x4e8723,_0x369de0){return function(_0x45d848){if(_0x45d848){return _0x45d848[_0x4109('0x22')](_0x4e8723)[_0x4109('0x23')](function(_0x5ddef4){return _0x5ddef4;});}return null;};}function removeEntity(_0x406d35,_0x438f4f){return function(_0x339cec){if(_0x339cec){return _0x339cec['destroy']()[_0x4109('0x23')](function(){var _0x3141c7=_0x339cec[_0x4109('0x24')]({'plain':!![]});var _0x57768e='ChanSpies';return db['UserProfileResource'][_0x4109('0x25')]({'where':{'type':_0x57768e,'resourceId':_0x3141c7['id']}})[_0x4109('0x23')](function(){return _0x339cec;});})[_0x4109('0x23')](function(){_0x406d35[_0x4109('0x18')](0xcc)[_0x4109('0x19')]();});}};}function handleEntityNotFound(_0x5bbf62,_0x2910cd){return function(_0x357ce6){if(!_0x357ce6){_0x5bbf62['sendStatus'](0x194);}return _0x357ce6;};}function handleError(_0x12b73b,_0x52cb0c){_0x52cb0c=_0x52cb0c||0x1f4;return function(_0x1d3eaa){logger[_0x4109('0x26')](_0x1d3eaa[_0x4109('0x27')]);if(_0x1d3eaa[_0x4109('0x28')]){delete _0x1d3eaa[_0x4109('0x28')];}_0x12b73b['status'](_0x52cb0c)[_0x4109('0x29')](_0x1d3eaa);};}exports['index']=function(_0x1f48fa,_0x2a26bb){var _0xf662af={},_0x319b67={},_0x358a20={'count':0x0,'rows':[]};var _0x12b958=_[_0x4109('0x2a')](db[_0x4109('0x2b')][_0x4109('0x2c')],function(_0x282727){return{'name':_0x282727[_0x4109('0x2d')],'type':_0x282727[_0x4109('0x2e')][_0x4109('0x2f')]};});_0x319b67[_0x4109('0x30')]=_[_0x4109('0x2a')](_0x12b958,_0x4109('0x28'));_0x319b67['query']=_[_0x4109('0x31')](_0x1f48fa[_0x4109('0x32')]);_0x319b67[_0x4109('0x33')]=_[_0x4109('0x34')](_0x319b67[_0x4109('0x30')],_0x319b67[_0x4109('0x32')]);_0xf662af['attributes']=_['intersection'](_0x319b67[_0x4109('0x30')],qs[_0x4109('0x35')](_0x1f48fa[_0x4109('0x32')][_0x4109('0x35')]));_0xf662af['attributes']=_0xf662af[_0x4109('0x36')][_0x4109('0x37')]?_0xf662af[_0x4109('0x36')]:_0x319b67[_0x4109('0x30')];if(!_0x1f48fa[_0x4109('0x32')][_0x4109('0x38')]('nolimit')){_0xf662af[_0x4109('0x1d')]=qs['limit'](_0x1f48fa[_0x4109('0x32')][_0x4109('0x1d')]);_0xf662af['offset']=qs[_0x4109('0x1b')](_0x1f48fa[_0x4109('0x32')]['offset']);}_0xf662af['order']=qs[_0x4109('0x39')](_0x1f48fa['query'][_0x4109('0x39')]);_0xf662af['where']=qs[_0x4109('0x33')](_[_0x4109('0x3a')](_0x1f48fa[_0x4109('0x32')],_0x319b67[_0x4109('0x33')]),_0x12b958);if(_0x1f48fa['query']['filter']){_0xf662af['where']=_[_0x4109('0x3b')](_0xf662af[_0x4109('0x3c')],{'$or':_[_0x4109('0x2a')](_0x12b958,function(_0x3062e5){if(_0x3062e5[_0x4109('0x2e')]!==_0x4109('0x3d')){var _0x269c7a={};_0x269c7a[_0x3062e5[_0x4109('0x28')]]={'$like':'%'+_0x1f48fa[_0x4109('0x32')][_0x4109('0x3e')]+'%'};return _0x269c7a;}})});}_0xf662af=_[_0x4109('0x3b')]({},_0xf662af,_0x1f48fa[_0x4109('0x3f')]);var _0xbd914e={'where':_0xf662af[_0x4109('0x3c')]};return db[_0x4109('0x2b')][_0x4109('0x1e')](_0xbd914e)[_0x4109('0x23')](function(_0x114685){_0x358a20[_0x4109('0x1e')]=_0x114685;if(_0x1f48fa['query'][_0x4109('0x40')]){_0xf662af[_0x4109('0x41')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0xf662af);})['then'](function(_0x17e854){_0x358a20[_0x4109('0x42')]=_0x17e854;return _0x358a20;})[_0x4109('0x23')](respondWithFilteredResult(_0x2a26bb,_0xf662af))[_0x4109('0x43')](handleError(_0x2a26bb,null));};exports[_0x4109('0x44')]=function(_0x3db53e,_0x88be51){var _0x590c8a={'raw':![],'where':{'id':_0x3db53e['params']['id']}},_0x56b0e5={};_0x56b0e5[_0x4109('0x30')]=_['keys'](db[_0x4109('0x2b')]['rawAttributes']);_0x56b0e5[_0x4109('0x32')]=_[_0x4109('0x31')](_0x3db53e[_0x4109('0x32')]);_0x56b0e5[_0x4109('0x33')]=_[_0x4109('0x34')](_0x56b0e5[_0x4109('0x30')],_0x56b0e5[_0x4109('0x32')]);_0x590c8a['attributes']=_[_0x4109('0x34')](_0x56b0e5[_0x4109('0x30')],qs[_0x4109('0x35')](_0x3db53e[_0x4109('0x32')][_0x4109('0x35')]));_0x590c8a['attributes']=_0x590c8a['attributes'][_0x4109('0x37')]?_0x590c8a['attributes']:_0x56b0e5['model'];if(_0x3db53e[_0x4109('0x32')][_0x4109('0x40')]){_0x590c8a[_0x4109('0x41')]=[{'all':!![]}];}_0x590c8a=_[_0x4109('0x3b')]({},_0x590c8a,_0x3db53e['options']);return db['VoiceChanSpy'][_0x4109('0x45')](_0x590c8a)['then'](handleEntityNotFound(_0x88be51,null))[_0x4109('0x23')](respondWithResult(_0x88be51,null))['catch'](handleError(_0x88be51,null));};exports[_0x4109('0x46')]=function(_0x2ec0b3,_0x3cb3b2){return db[_0x4109('0x2b')][_0x4109('0x46')](_0x2ec0b3[_0x4109('0x47')],{})['then'](function(_0x1abb3b){var _0x4138db=_0x2ec0b3['user']['get']({'plain':!![]});if(!_0x4138db)throw new Error(_0x4109('0x48'));if(_0x4138db[_0x4109('0x49')]===_0x4109('0x4a')){var _0x55772d=_0x1abb3b['get']({'plain':!![]});var _0x57e01e=_0x4109('0x4b');return db[_0x4109('0x4c')][_0x4109('0x45')]({'where':{'name':_0x57e01e,'userProfileId':_0x4138db['userProfileId']},'raw':!![]})[_0x4109('0x23')](function(_0x53753f){if(_0x53753f&&_0x53753f[_0x4109('0x4d')]===0x0){return db[_0x4109('0x4e')]['create']({'name':_0x55772d[_0x4109('0x28')],'resourceId':_0x55772d['id'],'type':_0x53753f[_0x4109('0x28')],'sectionId':_0x53753f['id']},{})['then'](function(){return _0x1abb3b;});}else{return _0x1abb3b;}})[_0x4109('0x43')](function(_0x3b6dbd){logger[_0x4109('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b6dbd);throw _0x3b6dbd;});}return _0x1abb3b;})['then'](respondWithResult(_0x3cb3b2,0xc9))['catch'](handleError(_0x3cb3b2,null));};exports[_0x4109('0x22')]=function(_0x45b5a2,_0x1748f8){if(_0x45b5a2[_0x4109('0x47')]['id']){delete _0x45b5a2[_0x4109('0x47')]['id'];}return db[_0x4109('0x2b')][_0x4109('0x45')]({'where':{'id':_0x45b5a2['params']['id']}})[_0x4109('0x23')](handleEntityNotFound(_0x1748f8,null))[_0x4109('0x23')](saveUpdates(_0x45b5a2['body'],null))[_0x4109('0x23')](respondWithResult(_0x1748f8,null))[_0x4109('0x43')](handleError(_0x1748f8,null));};exports[_0x4109('0x25')]=function(_0x43954d,_0x911e03){return db[_0x4109('0x2b')][_0x4109('0x45')]({'where':{'id':_0x43954d[_0x4109('0x4f')]['id']}})[_0x4109('0x23')](handleEntityNotFound(_0x911e03,null))[_0x4109('0x23')](removeEntity(_0x911e03,null))[_0x4109('0x43')](handleError(_0x911e03,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 90deb2f..c2baf1d 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 _0x5a2a=['VoiceExtension','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','system','CDR(type)=%s','chanspy','push','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','concat','internal','User','findAll','agent','then','catch','exports','define','VoiceChanSpy','voice_chanspy','length'];(function(_0x381cd5,_0x1f66dd){var _0x14b162=function(_0x1e7e89){while(--_0x1e7e89){_0x381cd5['push'](_0x381cd5['shift']());}};_0x14b162(++_0x1f66dd);}(_0x5a2a,0x1f0));var _0xa5a2=function(_0x1acf00,_0x3235b1){_0x1acf00=_0x1acf00-0x0;var _0x17ecea=_0x5a2a[_0x1acf00];return _0x17ecea;};'use strict';var _=require(_0xa5a2('0x0'));var util=require(_0xa5a2('0x1'));var BPromise=require(_0xa5a2('0x2'));var attributes=require(_0xa5a2('0x3'));var getUserApplications=function(_0x48a395,_0x2c6289,_0x50ffcd){var _0xbc5353=0x1;var _0x5d1913=[];var _0x17ecd8={'context':_0x2c6289[_0xa5a2('0x4')]||_0xa5a2('0x5'),'exten':util[_0xa5a2('0x6')](_0xa5a2('0x7'),_0x48a395['prefix'],_0x50ffcd),'type':_0xa5a2('0x8'),'isApp':![],'ChanSpyId':_0x48a395['id'],'UserId':_0x2c6289['id']};_0x5d1913['push'](_['merge']({'app':'Set','appdata':util[_0xa5a2('0x6')](_0xa5a2('0x9'),_0xa5a2('0xa')),'priority':_0xbc5353++},_0x17ecd8));if(_0x48a395['record']){_0x5d1913[_0xa5a2('0xb')](_[_0xa5a2('0xc')]({'app':_0xa5a2('0xd'),'appdata':util[_0xa5a2('0x6')](_0xa5a2('0xe'),_0x48a395[_0xa5a2('0xf')]),'priority':_0xbc5353++},_0x17ecd8));}if(_0x48a395[_0xa5a2('0x10')]){_0x5d1913[_0xa5a2('0xb')](_[_0xa5a2('0xc')]({'app':_0xa5a2('0x11'),'appdata':_0x48a395[_0xa5a2('0x12')],'priority':_0xbc5353++},_0x17ecd8));}_0x5d1913[_0xa5a2('0xb')](_[_0xa5a2('0xc')]({'app':_0xa5a2('0x13'),'appdata':util[_0xa5a2('0x6')](_0xa5a2('0x14'),_0x2c6289[_0xa5a2('0x15')],_0x48a395['options']?_0x48a395[_0xa5a2('0x16')][_0xa5a2('0x17')](''):''),'priority':_0xbc5353++},_0x17ecd8));if(_0x48a395['record']){_0x5d1913[_0xa5a2('0xb')](_[_0xa5a2('0xc')]({'app':'StopMixMonitor','priority':_0xbc5353++},_0x17ecd8));}return _0x5d1913;};var getChanSpyApplications=function(_0x49cf66,_0x497cae){var _0x57f687=[];for(var _0x1898f8=0x0,_0x42f375=0x1;_0x1898f8<_0x497cae['length'];_0x1898f8++,_0x42f375=0x1){_0x57f687=_0x57f687[_0xa5a2('0x18')](getUserApplications(_0x49cf66,_0x497cae[_0x1898f8],_0x497cae[_0x1898f8][_0xa5a2('0x19')]));if(_0x497cae[_0x1898f8][_0xa5a2('0x19')]!=_0x497cae[_0x1898f8]['name']){_0x57f687=_0x57f687[_0xa5a2('0x18')](getUserApplications(_0x49cf66,_0x497cae[_0x1898f8],_0x497cae[_0x1898f8][_0xa5a2('0x15')]));}}return _0x57f687;};var getChanSpyPromise=function(_0x34045b,_0x4a754){return new BPromise(function(_0x495e8c,_0x2611c8){return _0x34045b[_0xa5a2('0x1a')][_0xa5a2('0x1b')]({'attributes':['id',_0xa5a2('0x15'),_0xa5a2('0x19')],'where':{'role':_0xa5a2('0x1c'),'chanspy':!![]},'raw':!![]})[_0xa5a2('0x1d')](function(_0x2a59c7){if(_0x2a59c7){return _0x495e8c(getChanSpyApplications(_0x4a754,_0x2a59c7));}return _0x495e8c([]);})[_0xa5a2('0x1e')](function(_0x567b05){_0x2611c8(_0x567b05);});});};module[_0xa5a2('0x1f')]=function(_0x26750c,_0x4598b6){var _0x37dfb1=_0x26750c['models'];return _0x26750c[_0xa5a2('0x20')](_0xa5a2('0x21'),attributes,{'tableName':_0xa5a2('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x40f53f,_0x2eb2d4,_0x5aeca2){return getChanSpyPromise(_0x37dfb1,_0x40f53f)[_0xa5a2('0x1d')](function(_0x4c7f4f){if(_0x4c7f4f&&_0x4c7f4f[_0xa5a2('0x23')]){return _0x37dfb1[_0xa5a2('0x24')]['bulkCreate'](_0x4c7f4f);}})[_0xa5a2('0x1d')](function(){_0x5aeca2();})['catch'](function(_0x105ecb){_0x5aeca2(_0x105ecb);});},'afterUpdate':function(_0x4598fe,_0x791db2,_0x103b16){return _0x37dfb1[_0xa5a2('0x24')][_0xa5a2('0x25')]({'where':{'ChanSpyId':_0x4598fe['id']}})[_0xa5a2('0x1d')](function(){return getChanSpyPromise(_0x37dfb1,_0x4598fe);})['then'](function(_0x19199f){if(_0x19199f&&_0x19199f[_0xa5a2('0x23')]){return _0x37dfb1[_0xa5a2('0x24')]['bulkCreate'](_0x19199f);}})[_0xa5a2('0x1d')](function(){_0x103b16();})[_0xa5a2('0x1e')](function(_0xfd677b){_0x103b16(_0xfd677b);});},'afterDestroy':function(_0x44d488,_0x409a14,_0x105ead){return _0x37dfb1[_0xa5a2('0x24')]['destroy']({'where':{'ChanSpyId':_0x44d488['id']}})[_0xa5a2('0x1d')](function(){_0x105ead();})[_0xa5a2('0x1e')](function(_0x52e1f1){_0x105ead(_0x52e1f1);});}}});}; \ No newline at end of file +var _0x8db3=['push','MixMonitor','recordingFormat','auth','Authenticate','password','ChanSpy','name','options','join','length','concat','internal','findAll','agent','then','catch','exports','models','bulkCreate','VoiceExtension','destroy','context','from-sip','format','prefix','system','merge','CDR(type)=%s','record'];(function(_0xd0075e,_0x4b4b35){var _0xc43632=function(_0x39500e){while(--_0x39500e){_0xd0075e['push'](_0xd0075e['shift']());}};_0xc43632(++_0x4b4b35);}(_0x8db3,0x160));var _0x38db=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x8db3[_0x122096];return _0x3d1966;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x16d753,_0x9b2c46,_0x583c82){var _0x3b0e55=0x1;var _0x17f4af=[];var _0x280a29={'context':_0x9b2c46[_0x38db('0x0')]||_0x38db('0x1'),'exten':util[_0x38db('0x2')]('%s%s',_0x16d753[_0x38db('0x3')],_0x583c82),'type':_0x38db('0x4'),'isApp':![],'ChanSpyId':_0x16d753['id'],'UserId':_0x9b2c46['id']};_0x17f4af['push'](_[_0x38db('0x5')]({'app':'Set','appdata':util[_0x38db('0x2')](_0x38db('0x6'),'chanspy'),'priority':_0x3b0e55++},_0x280a29));if(_0x16d753[_0x38db('0x7')]){_0x17f4af[_0x38db('0x8')](_[_0x38db('0x5')]({'app':_0x38db('0x9'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x16d753[_0x38db('0xa')]),'priority':_0x3b0e55++},_0x280a29));}if(_0x16d753[_0x38db('0xb')]){_0x17f4af[_0x38db('0x8')](_[_0x38db('0x5')]({'app':_0x38db('0xc'),'appdata':_0x16d753[_0x38db('0xd')],'priority':_0x3b0e55++},_0x280a29));}_0x17f4af['push'](_['merge']({'app':_0x38db('0xe'),'appdata':util[_0x38db('0x2')]('SIP/%s,%s',_0x9b2c46[_0x38db('0xf')],_0x16d753[_0x38db('0x10')]?_0x16d753['options'][_0x38db('0x11')](''):''),'priority':_0x3b0e55++},_0x280a29));if(_0x16d753['record']){_0x17f4af[_0x38db('0x8')](_['merge']({'app':'StopMixMonitor','priority':_0x3b0e55++},_0x280a29));}return _0x17f4af;};var getChanSpyApplications=function(_0x1f7af3,_0x500089){var _0x5a4785=[];for(var _0x32c1e0=0x0,_0x2b2f23=0x1;_0x32c1e0<_0x500089[_0x38db('0x12')];_0x32c1e0++,_0x2b2f23=0x1){_0x5a4785=_0x5a4785[_0x38db('0x13')](getUserApplications(_0x1f7af3,_0x500089[_0x32c1e0],_0x500089[_0x32c1e0][_0x38db('0x14')]));if(_0x500089[_0x32c1e0][_0x38db('0x14')]!=_0x500089[_0x32c1e0][_0x38db('0xf')]){_0x5a4785=_0x5a4785[_0x38db('0x13')](getUserApplications(_0x1f7af3,_0x500089[_0x32c1e0],_0x500089[_0x32c1e0][_0x38db('0xf')]));}}return _0x5a4785;};var getChanSpyPromise=function(_0x1b4ca6,_0xea03a3){return new BPromise(function(_0x42aa07,_0xf9cfcd){return _0x1b4ca6['User'][_0x38db('0x15')]({'attributes':['id',_0x38db('0xf'),_0x38db('0x14')],'where':{'role':_0x38db('0x16'),'chanspy':!![]},'raw':!![]})[_0x38db('0x17')](function(_0x1c9d30){if(_0x1c9d30){return _0x42aa07(getChanSpyApplications(_0xea03a3,_0x1c9d30));}return _0x42aa07([]);})[_0x38db('0x18')](function(_0x4899f5){_0xf9cfcd(_0x4899f5);});});};module[_0x38db('0x19')]=function(_0x6d9469,_0x527fd3){var _0x52d640=_0x6d9469[_0x38db('0x1a')];return _0x6d9469['define']('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x521670,_0x1ee526,_0x349b73){return getChanSpyPromise(_0x52d640,_0x521670)[_0x38db('0x17')](function(_0x525592){if(_0x525592&&_0x525592[_0x38db('0x12')]){return _0x52d640['VoiceExtension'][_0x38db('0x1b')](_0x525592);}})[_0x38db('0x17')](function(){_0x349b73();})['catch'](function(_0x4f7ba8){_0x349b73(_0x4f7ba8);});},'afterUpdate':function(_0x545c78,_0x201f85,_0x19ab18){return _0x52d640[_0x38db('0x1c')]['destroy']({'where':{'ChanSpyId':_0x545c78['id']}})[_0x38db('0x17')](function(){return getChanSpyPromise(_0x52d640,_0x545c78);})[_0x38db('0x17')](function(_0x1c00a3){if(_0x1c00a3&&_0x1c00a3[_0x38db('0x12')]){return _0x52d640[_0x38db('0x1c')][_0x38db('0x1b')](_0x1c00a3);}})[_0x38db('0x17')](function(){_0x19ab18();})['catch'](function(_0x277994){_0x19ab18(_0x277994);});},'afterDestroy':function(_0xf33682,_0x2bb691,_0x3c6dc5){return _0x52d640['VoiceExtension'][_0x38db('0x1d')]({'where':{'ChanSpyId':_0xf33682['id']}})[_0x38db('0x17')](function(){_0x3c6dc5();})['catch'](function(_0x3c82c1){_0x3c6dc5(_0x3c82c1);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index bdd7138..eaff827 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 _0xb6b1=['catch','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','VoiceChanSpy,\x20%s,\x20%s','message','info','result'];(function(_0x2e25e0,_0x572a41){var _0x144f36=function(_0x511ad0){while(--_0x511ad0){_0x2e25e0['push'](_0x2e25e0['shift']());}};_0x144f36(++_0x572a41);}(_0xb6b1,0x17b));var _0x1b6b=function(_0x16e57d,_0x2cb7ba){_0x16e57d=_0x16e57d-0x0;var _0x40239c=_0xb6b1[_0x16e57d];return _0x40239c;};'use strict';var _=require(_0x1b6b('0x0'));var util=require('util');var moment=require(_0x1b6b('0x1'));var BPromise=require('bluebird');var rs=require(_0x1b6b('0x2'));var fs=require('fs');var Redis=require(_0x1b6b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b6b('0x4'));var logger=require('../../config/logger')(_0x1b6b('0x5'));var config=require(_0x1b6b('0x6'));var jayson=require(_0x1b6b('0x7'));var client=jayson[_0x1b6b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41d09e,_0x51cfed,_0xae4115){return new BPromise(function(_0x5042f7,_0x21f403){return client[_0x1b6b('0x9')](_0x41d09e,_0xae4115)[_0x1b6b('0xa')](function(_0x29258a){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x51cfed,_0x1b6b('0xb'));logger[_0x1b6b('0xc')](_0x1b6b('0xd'),_0x51cfed,_0x1b6b('0xb'),JSON[_0x1b6b('0xe')](_0x29258a));if(_0x29258a[_0x1b6b('0xf')]){if(_0x29258a[_0x1b6b('0xf')]['code']===0x1f4){logger[_0x1b6b('0xf')](_0x1b6b('0x10'),_0x51cfed,_0x29258a[_0x1b6b('0xf')]['message']);return _0x21f403(_0x29258a[_0x1b6b('0xf')]['message']);}logger['error'](_0x1b6b('0x10'),_0x51cfed,_0x29258a[_0x1b6b('0xf')][_0x1b6b('0x11')]);return _0x5042f7(_0x29258a[_0x1b6b('0xf')][_0x1b6b('0x11')]);}else{logger[_0x1b6b('0x12')](_0x1b6b('0x10'),_0x51cfed,'request\x20sent');_0x5042f7(_0x29258a[_0x1b6b('0x13')][_0x1b6b('0x11')]);}})[_0x1b6b('0x14')](function(_0x33dc7e){logger['error'](_0x1b6b('0x10'),_0x51cfed,_0x33dc7e);_0x21f403(_0x33dc7e);});});} \ No newline at end of file +var _0x574d=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2d56a0,_0x29b1a5){var _0x170c53=function(_0x288d81){while(--_0x288d81){_0x2d56a0['push'](_0x2d56a0['shift']());}};_0x170c53(++_0x29b1a5);}(_0x574d,0xc0));var _0xd574=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x574d[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0xd574('0x0'));var util=require(_0xd574('0x1'));var moment=require(_0xd574('0x2'));var BPromise=require(_0xd574('0x3'));var rs=require(_0xd574('0x4'));var fs=require('fs');var Redis=require(_0xd574('0x5'));var db=require(_0xd574('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd574('0x7'))(_0xd574('0x8'));var config=require(_0xd574('0x9'));var jayson=require(_0xd574('0xa'));var client=jayson['client'][_0xd574('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13a566,_0x3ce54f,_0x1558b3){return new BPromise(function(_0x3a1e54,_0x20751c){return client['request'](_0x13a566,_0x1558b3)['then'](function(_0x4306f7){logger[_0xd574('0xc')](_0xd574('0xd'),_0x3ce54f,_0xd574('0xe'));logger[_0xd574('0xf')](_0xd574('0x10'),_0x3ce54f,_0xd574('0xe'),JSON['stringify'](_0x4306f7));if(_0x4306f7[_0xd574('0x11')]){if(_0x4306f7[_0xd574('0x11')][_0xd574('0x12')]===0x1f4){logger[_0xd574('0x11')](_0xd574('0xd'),_0x3ce54f,_0x4306f7[_0xd574('0x11')][_0xd574('0x13')]);return _0x20751c(_0x4306f7[_0xd574('0x11')][_0xd574('0x13')]);}logger[_0xd574('0x11')](_0xd574('0xd'),_0x3ce54f,_0x4306f7[_0xd574('0x11')]['message']);return _0x3a1e54(_0x4306f7[_0xd574('0x11')][_0xd574('0x13')]);}else{logger[_0xd574('0xc')](_0xd574('0xd'),_0x3ce54f,_0xd574('0xe'));_0x3a1e54(_0x4306f7[_0xd574('0x14')][_0xd574('0x13')]);}})[_0xd574('0x15')](function(_0x5c1db1){logger['error'](_0xd574('0xd'),_0x3ce54f,_0x5c1db1);_0x20751c(_0x5c1db1);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 375f41a..842f0c6 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 _0xd37c=['delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','isAuthenticated','index','/:id','show','create','put'];(function(_0x582f8b,_0x27e0d6){var _0x46cfcc=function(_0x47ea87){while(--_0x47ea87){_0x582f8b['push'](_0x582f8b['shift']());}};_0x46cfcc(++_0x27e0d6);}(_0xd37c,0xe3));var _0xcd37=function(_0x2e3ec3,_0x343813){_0x2e3ec3=_0x2e3ec3-0x0;var _0x7ec3c9=_0xd37c[_0x2e3ec3];return _0x7ec3c9;};'use strict';var multer=require('multer');var util=require(_0xcd37('0x0'));var path=require('path');var timeout=require(_0xcd37('0x1'));var express=require(_0xcd37('0x2'));var router=express[_0xcd37('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcd37('0x4'));var interaction=require(_0xcd37('0x5'));var config=require('../../config/environment');var controller=require(_0xcd37('0x6'));router['get']('/',auth[_0xcd37('0x7')](),controller[_0xcd37('0x8')]);router['get'](_0xcd37('0x9'),auth['isAuthenticated'](),controller[_0xcd37('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcd37('0xb')]);router[_0xcd37('0xc')](_0xcd37('0x9'),auth[_0xcd37('0x7')](),controller['update']);router[_0xcd37('0xd')](_0xcd37('0x9'),auth[_0xcd37('0x7')](),controller[_0xcd37('0xe')]);module[_0xcd37('0xf')]=router; \ No newline at end of file +var _0xd2ae=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','multer','connect-timeout'];(function(_0x243dce,_0x548bcf){var _0x482b9d=function(_0x504104){while(--_0x504104){_0x243dce['push'](_0x243dce['shift']());}};_0x482b9d(++_0x548bcf);}(_0xd2ae,0x11e));var _0xed2a=function(_0x3418ae,_0x1cc8b3){_0x3418ae=_0x3418ae-0x0;var _0x3b28ff=_0xd2ae[_0x3418ae];return _0x3b28ff;};'use strict';var multer=require(_0xed2a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xed2a('0x1'));var express=require(_0xed2a('0x2'));var router=express[_0xed2a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xed2a('0x4'));var interaction=require(_0xed2a('0x5'));var config=require(_0xed2a('0x6'));var controller=require('./voiceContext.controller');router['get']('/',auth[_0xed2a('0x7')](),controller[_0xed2a('0x8')]);router[_0xed2a('0x9')](_0xed2a('0xa'),auth[_0xed2a('0x7')](),controller[_0xed2a('0xb')]);router[_0xed2a('0xc')]('/',auth[_0xed2a('0x7')](),controller[_0xed2a('0xd')]);router[_0xed2a('0xe')](_0xed2a('0xa'),auth[_0xed2a('0x7')](),controller[_0xed2a('0xf')]);router[_0xed2a('0x10')](_0xed2a('0xa'),auth['isAuthenticated'](),controller[_0xed2a('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 72fa623..aff32bc 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 _0x1e0b=['sequelize','exports','name','STRING','BOOLEAN'];(function(_0x2d93d9,_0x4efe81){var _0x3c2086=function(_0x1e5a7c){while(--_0x1e5a7c){_0x2d93d9['push'](_0x2d93d9['shift']());}};_0x3c2086(++_0x4efe81);}(_0x1e0b,0xd7));var _0xb1e0=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0x1e0b[_0x12b8ec];return _0x21af77;};'use strict';var Sequelize=require(_0xb1e0('0x0'));module[_0xb1e0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb1e0('0x2')},'description':{'type':Sequelize[_0xb1e0('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xb1e0('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9db0=['STRING','BOOLEAN','sequelize'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x9db0,0xcb));var _0x09db=function(_0x263763,_0x2f4b8d){_0x263763=_0x263763-0x0;var _0xe61485=_0x9db0[_0x263763];return _0xe61485;};'use strict';var Sequelize=require(_0x09db('0x0'));module['exports']={'name':{'type':Sequelize[_0x09db('0x1')],'unique':'name'},'description':{'type':Sequelize[_0x09db('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x09db('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 c5eaea3..ced521c 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 _0xc62f=['rows','catch','show','rawAttributes','keys','fields','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','UserProfileResource','params','Reload','update','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','destroy','then','get','Contexts','stack','name','send','index','map','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','sort','pick','filter','where','type','VIRTUAL','merge','options','VoiceContext','includeAll','include','findAll'];(function(_0xbc48b8,_0x2a07c8){var _0x5bdd75=function(_0x4501b6){while(--_0x4501b6){_0xbc48b8['push'](_0xbc48b8['shift']());}};_0x5bdd75(++_0x2a07c8);}(_0xc62f,0x155));var _0xfc62=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc62f[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0xfc62('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfc62('0x1'));var jsonpatch=require(_0xfc62('0x2'));var rp=require(_0xfc62('0x3'));var moment=require('moment');var BPromise=require(_0xfc62('0x4'));var Mustache=require(_0xfc62('0x5'));var util=require(_0xfc62('0x6'));var path=require(_0xfc62('0x7'));var sox=require(_0xfc62('0x8'));var csv=require(_0xfc62('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfc62('0xa'));var _=require(_0xfc62('0xb'));var squel=require(_0xfc62('0xc'));var crypto=require(_0xfc62('0xd'));var jsforce=require(_0xfc62('0xe'));var deskjs=require(_0xfc62('0xf'));var toCsv=require(_0xfc62('0x9'));var querystring=require(_0xfc62('0x10'));var Papa=require(_0xfc62('0x11'));var Redis=require(_0xfc62('0x12'));var authService=require(_0xfc62('0x13'));var qs=require(_0xfc62('0x14'));var as=require(_0xfc62('0x15'));var hardwareService=require(_0xfc62('0x16'));var logger=require(_0xfc62('0x17'))(_0xfc62('0x18'));var utils=require('../../config/utils');var config=require(_0xfc62('0x19'));var licenseUtil=require(_0xfc62('0x1a'));var db=require(_0xfc62('0x1b'))['db'];var jayson=require(_0xfc62('0x1c'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x160c86,_0xd6e111,_0x1ec2ca,_0x3bd38a){return new BPromise(function(_0x1b6ce4,_0x49a953){var _0xf473f9=_0x3bd38a||client;return _0xf473f9[_0xfc62('0x1d')](_0x160c86,_0x1ec2ca)['then'](function(_0x330de3){logger['info'](_0xfc62('0x1e'),_0xd6e111,_0xfc62('0x1f'));logger[_0xfc62('0x20')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0xd6e111,_0xfc62('0x1f'),JSON[_0xfc62('0x21')](_0x330de3));if(_0x330de3['error']){if(_0x330de3[_0xfc62('0x22')][_0xfc62('0x23')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0xd6e111,_0x330de3[_0xfc62('0x22')][_0xfc62('0x24')]);return _0x49a953(_0x330de3[_0xfc62('0x22')]['message']);}logger[_0xfc62('0x22')]('VoiceContext,\x20%s,\x20%s',_0xd6e111,_0x330de3[_0xfc62('0x22')][_0xfc62('0x24')]);return _0x1b6ce4(_0x330de3[_0xfc62('0x22')][_0xfc62('0x24')]);}else{logger['info'](_0xfc62('0x1e'),_0xd6e111,_0xfc62('0x1f'));_0x1b6ce4(_0x330de3[_0xfc62('0x25')][_0xfc62('0x24')]);}})['catch'](function(_0x57473a){logger[_0xfc62('0x22')]('VoiceContext,\x20%s,\x20%s',_0xd6e111,_0x57473a);_0x49a953(_0x57473a);});});}function respondWithStatusCode(_0x215f9c,_0x5748de){_0x5748de=_0x5748de||0xcc;return function(_0x4bd6b3){if(_0x4bd6b3){return _0x215f9c[_0xfc62('0x26')](_0x5748de);}return _0x215f9c[_0xfc62('0x27')](_0x5748de)[_0xfc62('0x28')]();};}function respondWithResult(_0x204ff1,_0x3dc13a){_0x3dc13a=_0x3dc13a||0xc8;return function(_0x2f2946){if(_0x2f2946){return _0x204ff1[_0xfc62('0x27')](_0x3dc13a)[_0xfc62('0x29')](_0x2f2946);}};}function respondWithFilteredResult(_0x1a0886,_0x196f47){return function(_0xf5ed9d){if(_0xf5ed9d){var _0x3fdadb=typeof _0x196f47[_0xfc62('0x2a')]===_0xfc62('0x2b')&&typeof _0x196f47[_0xfc62('0x2c')]===_0xfc62('0x2b');var _0xf126df=_0xf5ed9d[_0xfc62('0x2d')];var _0x3783a3=_0x3fdadb?0x0:_0x196f47[_0xfc62('0x2a')];var _0x1bf983=_0x3fdadb?_0xf5ed9d[_0xfc62('0x2d')]:_0x196f47[_0xfc62('0x2a')]+_0x196f47[_0xfc62('0x2c')];var _0x10375c;if(_0x1bf983>=_0xf126df){_0x1bf983=_0xf126df;_0x10375c=0xc8;}else{_0x10375c=0xce;}_0x1a0886[_0xfc62('0x27')](_0x10375c);return _0x1a0886[_0xfc62('0x2e')]('Content-Range',_0x3783a3+'-'+_0x1bf983+'/'+_0xf126df)[_0xfc62('0x29')](_0xf5ed9d);}return null;};}function patchUpdates(_0x4b6586){return function(_0x6e9818){try{jsonpatch[_0xfc62('0x2f')](_0x6e9818,_0x4b6586,!![]);}catch(_0x32df00){return BPromise['reject'](_0x32df00);}return _0x6e9818[_0xfc62('0x30')]();};}function saveUpdates(_0x301d77,_0x952041){return function(_0x119354){if(_0x119354){return _0x119354['update'](_0x301d77)['then'](function(_0x331e87){return _0x331e87;});}return null;};}function removeEntity(_0x318831,_0x5b8488){return function(_0x2091bd){if(_0x2091bd){return _0x2091bd[_0xfc62('0x31')]()[_0xfc62('0x32')](function(){var _0x2ccad7=_0x2091bd[_0xfc62('0x33')]({'plain':!![]});var _0x324869=_0xfc62('0x34');return db['UserProfileResource'][_0xfc62('0x31')]({'where':{'type':_0x324869,'resourceId':_0x2ccad7['id']}})[_0xfc62('0x32')](function(){return _0x2091bd;});})['then'](function(){_0x318831[_0xfc62('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd993de,_0x5773d1){return function(_0x1ea15d){if(!_0x1ea15d){_0xd993de['sendStatus'](0x194);}return _0x1ea15d;};}function handleError(_0x3c8437,_0xb26b3){_0xb26b3=_0xb26b3||0x1f4;return function(_0x461a3c){logger[_0xfc62('0x22')](_0x461a3c[_0xfc62('0x35')]);if(_0x461a3c[_0xfc62('0x36')]){delete _0x461a3c[_0xfc62('0x36')];}_0x3c8437['status'](_0xb26b3)[_0xfc62('0x37')](_0x461a3c);};}exports[_0xfc62('0x38')]=function(_0x18ae02,_0x21aa48){var _0xbd4203={},_0x1684b8={},_0x2bf00d={'count':0x0,'rows':[]};var _0xb21a33=_[_0xfc62('0x39')](db['VoiceContext']['rawAttributes'],function(_0x57ab87){return{'name':_0x57ab87[_0xfc62('0x3a')],'type':_0x57ab87['type'][_0xfc62('0x3b')]};});_0x1684b8[_0xfc62('0x3c')]=_[_0xfc62('0x39')](_0xb21a33,_0xfc62('0x36'));_0x1684b8[_0xfc62('0x3d')]=_['keys'](_0x18ae02[_0xfc62('0x3d')]);_0x1684b8[_0xfc62('0x3e')]=_[_0xfc62('0x3f')](_0x1684b8['model'],_0x1684b8[_0xfc62('0x3d')]);_0xbd4203[_0xfc62('0x40')]=_[_0xfc62('0x3f')](_0x1684b8[_0xfc62('0x3c')],qs['fields'](_0x18ae02[_0xfc62('0x3d')]['fields']));_0xbd4203['attributes']=_0xbd4203['attributes'][_0xfc62('0x41')]?_0xbd4203[_0xfc62('0x40')]:_0x1684b8['model'];if(!_0x18ae02[_0xfc62('0x3d')][_0xfc62('0x42')]('nolimit')){_0xbd4203[_0xfc62('0x2c')]=qs[_0xfc62('0x2c')](_0x18ae02['query'][_0xfc62('0x2c')]);_0xbd4203[_0xfc62('0x2a')]=qs[_0xfc62('0x2a')](_0x18ae02[_0xfc62('0x3d')][_0xfc62('0x2a')]);}_0xbd4203['order']=qs['sort'](_0x18ae02[_0xfc62('0x3d')][_0xfc62('0x43')]);_0xbd4203['where']=qs[_0xfc62('0x3e')](_[_0xfc62('0x44')](_0x18ae02[_0xfc62('0x3d')],_0x1684b8[_0xfc62('0x3e')]),_0xb21a33);if(_0x18ae02['query'][_0xfc62('0x45')]){_0xbd4203[_0xfc62('0x46')]=_['merge'](_0xbd4203['where'],{'$or':_[_0xfc62('0x39')](_0xb21a33,function(_0x173eca){if(_0x173eca[_0xfc62('0x47')]!==_0xfc62('0x48')){var _0x336688={};_0x336688[_0x173eca[_0xfc62('0x36')]]={'$like':'%'+_0x18ae02[_0xfc62('0x3d')][_0xfc62('0x45')]+'%'};return _0x336688;}})});}_0xbd4203=_[_0xfc62('0x49')]({},_0xbd4203,_0x18ae02[_0xfc62('0x4a')]);var _0x4dab71={'where':_0xbd4203[_0xfc62('0x46')]};return db[_0xfc62('0x4b')]['count'](_0x4dab71)['then'](function(_0x13acb6){_0x2bf00d['count']=_0x13acb6;if(_0x18ae02['query'][_0xfc62('0x4c')]){_0xbd4203[_0xfc62('0x4d')]=[{'all':!![]}];}return db[_0xfc62('0x4b')][_0xfc62('0x4e')](_0xbd4203);})[_0xfc62('0x32')](function(_0x2b63b1){_0x2bf00d[_0xfc62('0x4f')]=_0x2b63b1;return _0x2bf00d;})[_0xfc62('0x32')](respondWithFilteredResult(_0x21aa48,_0xbd4203))[_0xfc62('0x50')](handleError(_0x21aa48,null));};exports[_0xfc62('0x51')]=function(_0x49c6dc,_0x536933){var _0x23cacc={'raw':![],'where':{'id':_0x49c6dc['params']['id']}},_0x53b042={};_0x53b042[_0xfc62('0x3c')]=_['keys'](db[_0xfc62('0x4b')][_0xfc62('0x52')]);_0x53b042[_0xfc62('0x3d')]=_[_0xfc62('0x53')](_0x49c6dc[_0xfc62('0x3d')]);_0x53b042[_0xfc62('0x3e')]=_[_0xfc62('0x3f')](_0x53b042[_0xfc62('0x3c')],_0x53b042['query']);_0x23cacc['attributes']=_[_0xfc62('0x3f')](_0x53b042[_0xfc62('0x3c')],qs[_0xfc62('0x54')](_0x49c6dc['query']['fields']));_0x23cacc[_0xfc62('0x40')]=_0x23cacc[_0xfc62('0x40')]['length']?_0x23cacc['attributes']:_0x53b042[_0xfc62('0x3c')];if(_0x49c6dc[_0xfc62('0x3d')]['includeAll']){_0x23cacc[_0xfc62('0x4d')]=[{'all':!![]}];}_0x23cacc=_[_0xfc62('0x49')]({},_0x23cacc,_0x49c6dc[_0xfc62('0x4a')]);return db[_0xfc62('0x4b')]['find'](_0x23cacc)[_0xfc62('0x32')](handleEntityNotFound(_0x536933,null))['then'](respondWithResult(_0x536933,null))[_0xfc62('0x50')](handleError(_0x536933,null));};exports[_0xfc62('0x55')]=function(_0x32e9f8,_0xd68d55,_0x2c80d3){var _0xfc0f0c;return db[_0xfc62('0x4b')]['create'](_0x32e9f8[_0xfc62('0x56')],{'raw':!![]})['then'](function(_0x484e20){_0xfc0f0c=_0x484e20;return db[_0xfc62('0x4b')][_0xfc62('0x4e')]({'raw':!![]});})['then'](function(_0x5d62f7){var _0x3b71a7=fs[_0xfc62('0x57')](path[_0xfc62('0x58')](config[_0xfc62('0x59')],_0xfc62('0x5a')),_0xfc62('0x5b'));var _0xeeb64c=ejs[_0xfc62('0x5c')](_0x3b71a7,{'contexts':_0x5d62f7||[]});fs[_0xfc62('0x5d')](_0xfc62('0x5e'),_0xeeb64c);})['then'](function(){return respondWithRpcPromise('Reload','create',{'module':_0xfc62('0x5f')});})[_0xfc62('0x32')](function(){var _0x5e93a3=_0x32e9f8[_0xfc62('0x60')][_0xfc62('0x33')]({'plain':!![]});if(!_0x5e93a3)throw new Error(_0xfc62('0x61'));if(_0x5e93a3[_0xfc62('0x62')]===_0xfc62('0x60')){var _0x323f9e=_0xfc0f0c[_0xfc62('0x33')]({'plain':!![]});return db[_0xfc62('0x63')][_0xfc62('0x64')]({'where':{'name':_0xfc62('0x34'),'userProfileId':_0x5e93a3['userProfileId']},'raw':!![]})[_0xfc62('0x32')](function(_0x56a8bb){if(_0x56a8bb&&_0x56a8bb['autoAssociation']===0x0){return db[_0xfc62('0x65')]['create']({'name':_0x323f9e[_0xfc62('0x36')],'resourceId':_0x323f9e['id'],'type':_0x56a8bb[_0xfc62('0x36')],'sectionId':_0x56a8bb['id']},{})[_0xfc62('0x32')](function(){return _0xfc0f0c;});}else{return _0xfc0f0c;}})[_0xfc62('0x50')](function(_0x5c0a72){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c0a72);throw _0x5c0a72;});}return _0xfc0f0c;})[_0xfc62('0x32')](respondWithResult(_0xd68d55,0xc9))[_0xfc62('0x50')](handleError(_0xd68d55,null));};exports['update']=function(_0x9760b0,_0x5eb313,_0x14e4d8){var _0x259b9d;return db[_0xfc62('0x4b')]['find']({'where':{'id':_0x9760b0[_0xfc62('0x66')]['id']}})[_0xfc62('0x32')](handleEntityNotFound(_0x5eb313,null))[_0xfc62('0x32')](saveUpdates(_0x9760b0['body'],null))[_0xfc62('0x32')](function(_0x28744b){if(_0x28744b){_0x259b9d=_0x28744b;return db[_0xfc62('0x4b')]['findAll']({'raw':!![]});}})['then'](function(_0x2e9a23){var _0x4744a7=fs['readFileSync'](path[_0xfc62('0x58')](config['root'],'server/files/templates/context.ejs'),_0xfc62('0x5b'));var _0x440e61=ejs[_0xfc62('0x5c')](_0x4744a7,{'contexts':_0x2e9a23||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x440e61);})[_0xfc62('0x32')](function(){return respondWithRpcPromise(_0xfc62('0x67'),_0xfc62('0x68'),{'module':_0xfc62('0x5f')});})['then'](function(){return _0x259b9d;})[_0xfc62('0x32')](respondWithResult(_0x5eb313,null))[_0xfc62('0x50')](handleError(_0x5eb313,null));};exports[_0xfc62('0x31')]=function(_0x1a22f1,_0x90744d,_0xb8e85a){var _0x16ac42;return db[_0xfc62('0x4b')]['find']({'where':{'id':_0x1a22f1[_0xfc62('0x66')]['id']}})[_0xfc62('0x32')](handleEntityNotFound(_0x90744d,null))[_0xfc62('0x32')](removeEntity(_0x90744d,null))[_0xfc62('0x32')](function(){return db[_0xfc62('0x4b')]['findAll']({'raw':!![]});})[_0xfc62('0x32')](function(_0x4d1122){var _0x444ac8=fs[_0xfc62('0x57')](path[_0xfc62('0x58')](config[_0xfc62('0x59')],_0xfc62('0x5a')),_0xfc62('0x5b'));var _0x41cded=ejs[_0xfc62('0x5c')](_0x444ac8,{'contexts':_0x4d1122});fs[_0xfc62('0x5d')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x41cded);return respondWithRpcPromise(_0xfc62('0x67'),_0xfc62('0x31'),{'module':_0xfc62('0x5f')});})[_0xfc62('0x50')](handleError(_0x90744d,null));}; \ No newline at end of file +var _0x7951=['map','type','VIRTUAL','options','include','findAll','rows','show','keys','length','includeAll','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','render','chan_sip.so','params','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','reject','save','update','get','Contexts','UserProfileResource','destroy','stack','name','index','VoiceContext','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge'];(function(_0x9fb081,_0x48f480){var _0x43f8b0=function(_0x418570){while(--_0x418570){_0x9fb081['push'](_0x9fb081['shift']());}};_0x43f8b0(++_0x48f480);}(_0x7951,0x1cb));var _0x1795=function(_0x4b2d1b,_0x6f3e0a){_0x4b2d1b=_0x4b2d1b-0x0;var _0x407372=_0x7951[_0x4b2d1b];return _0x407372;};'use strict';var emlformat=require(_0x1795('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1795('0x1'));var rp=require(_0x1795('0x2'));var moment=require(_0x1795('0x3'));var BPromise=require(_0x1795('0x4'));var Mustache=require('mustache');var util=require(_0x1795('0x5'));var path=require(_0x1795('0x6'));var sox=require(_0x1795('0x7'));var csv=require(_0x1795('0x8'));var ejs=require(_0x1795('0x9'));var fs=require('fs');var fs_extra=require(_0x1795('0xa'));var _=require(_0x1795('0xb'));var squel=require(_0x1795('0xc'));var crypto=require(_0x1795('0xd'));var jsforce=require(_0x1795('0xe'));var deskjs=require(_0x1795('0xf'));var toCsv=require(_0x1795('0x8'));var querystring=require(_0x1795('0x10'));var Papa=require(_0x1795('0x11'));var Redis=require(_0x1795('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1795('0x13'));var hardwareService=require(_0x1795('0x14'));var logger=require('../../config/logger')(_0x1795('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1795('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x1795('0x17'));var client=jayson[_0x1795('0x18')][_0x1795('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x165c59,_0x820aa1,_0x2a42ce,_0xf675c1){return new BPromise(function(_0x23aecd,_0xd92c66){var _0x565ab5=_0xf675c1||client;return _0x565ab5['request'](_0x165c59,_0x2a42ce)[_0x1795('0x1a')](function(_0x580f6d){logger[_0x1795('0x1b')](_0x1795('0x1c'),_0x820aa1,_0x1795('0x1d'));logger[_0x1795('0x1e')](_0x1795('0x1f'),_0x820aa1,'request\x20sent',JSON[_0x1795('0x20')](_0x580f6d));if(_0x580f6d['error']){if(_0x580f6d[_0x1795('0x21')][_0x1795('0x22')]===0x1f4){logger['error'](_0x1795('0x1c'),_0x820aa1,_0x580f6d[_0x1795('0x21')]['message']);return _0xd92c66(_0x580f6d[_0x1795('0x21')]['message']);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x820aa1,_0x580f6d[_0x1795('0x21')][_0x1795('0x23')]);return _0x23aecd(_0x580f6d[_0x1795('0x21')][_0x1795('0x23')]);}else{logger['info'](_0x1795('0x1c'),_0x820aa1,'request\x20sent');_0x23aecd(_0x580f6d[_0x1795('0x24')][_0x1795('0x23')]);}})[_0x1795('0x25')](function(_0x42d044){logger[_0x1795('0x21')](_0x1795('0x1c'),_0x820aa1,_0x42d044);_0xd92c66(_0x42d044);});});}function respondWithStatusCode(_0x5058aa,_0x5af471){_0x5af471=_0x5af471||0xcc;return function(_0x58f016){if(_0x58f016){return _0x5058aa[_0x1795('0x26')](_0x5af471);}return _0x5058aa[_0x1795('0x27')](_0x5af471)[_0x1795('0x28')]();};}function respondWithResult(_0x20f049,_0xe416d4){_0xe416d4=_0xe416d4||0xc8;return function(_0x2e6f73){if(_0x2e6f73){return _0x20f049['status'](_0xe416d4)[_0x1795('0x29')](_0x2e6f73);}};}function respondWithFilteredResult(_0x1f10b0,_0x5e2bfc){return function(_0x2a1f99){if(_0x2a1f99){var _0x16c612=typeof _0x5e2bfc['offset']===_0x1795('0x2a')&&typeof _0x5e2bfc[_0x1795('0x2b')]===_0x1795('0x2a');var _0x2ee083=_0x2a1f99[_0x1795('0x2c')];var _0x1919f0=_0x16c612?0x0:_0x5e2bfc['offset'];var _0x325457=_0x16c612?_0x2a1f99[_0x1795('0x2c')]:_0x5e2bfc['offset']+_0x5e2bfc[_0x1795('0x2b')];var _0x641cf6;if(_0x325457>=_0x2ee083){_0x325457=_0x2ee083;_0x641cf6=0xc8;}else{_0x641cf6=0xce;}_0x1f10b0['status'](_0x641cf6);return _0x1f10b0[_0x1795('0x2d')](_0x1795('0x2e'),_0x1919f0+'-'+_0x325457+'/'+_0x2ee083)[_0x1795('0x29')](_0x2a1f99);}return null;};}function patchUpdates(_0x4003fb){return function(_0x3baa79){try{jsonpatch['apply'](_0x3baa79,_0x4003fb,!![]);}catch(_0x204e87){return BPromise[_0x1795('0x2f')](_0x204e87);}return _0x3baa79[_0x1795('0x30')]();};}function saveUpdates(_0x4c431b,_0x4fad8c){return function(_0x1f83e5){if(_0x1f83e5){return _0x1f83e5[_0x1795('0x31')](_0x4c431b)[_0x1795('0x1a')](function(_0x67137c){return _0x67137c;});}return null;};}function removeEntity(_0x222b6c,_0x3de017){return function(_0x369403){if(_0x369403){return _0x369403['destroy']()['then'](function(){var _0x457048=_0x369403[_0x1795('0x32')]({'plain':!![]});var _0x4a8c3d=_0x1795('0x33');return db[_0x1795('0x34')][_0x1795('0x35')]({'where':{'type':_0x4a8c3d,'resourceId':_0x457048['id']}})['then'](function(){return _0x369403;});})[_0x1795('0x1a')](function(){_0x222b6c[_0x1795('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c086a,_0x52a717){return function(_0x297f3e){if(!_0x297f3e){_0x1c086a['sendStatus'](0x194);}return _0x297f3e;};}function handleError(_0x38f955,_0xc2902d){_0xc2902d=_0xc2902d||0x1f4;return function(_0x307958){logger['error'](_0x307958[_0x1795('0x36')]);if(_0x307958[_0x1795('0x37')]){delete _0x307958[_0x1795('0x37')];}_0x38f955[_0x1795('0x27')](_0xc2902d)['send'](_0x307958);};}exports[_0x1795('0x38')]=function(_0xde7d67,_0x90ffea){var _0x378c71={},_0x2b120d={},_0x490bff={'count':0x0,'rows':[]};var _0x86966a=_['map'](db[_0x1795('0x39')][_0x1795('0x3a')],function(_0x1bff48){return{'name':_0x1bff48[_0x1795('0x3b')],'type':_0x1bff48['type'][_0x1795('0x3c')]};});_0x2b120d[_0x1795('0x3d')]=_['map'](_0x86966a,'name');_0x2b120d[_0x1795('0x3e')]=_['keys'](_0xde7d67[_0x1795('0x3e')]);_0x2b120d[_0x1795('0x3f')]=_[_0x1795('0x40')](_0x2b120d['model'],_0x2b120d[_0x1795('0x3e')]);_0x378c71[_0x1795('0x41')]=_[_0x1795('0x40')](_0x2b120d[_0x1795('0x3d')],qs[_0x1795('0x42')](_0xde7d67['query'][_0x1795('0x42')]));_0x378c71[_0x1795('0x41')]=_0x378c71['attributes']['length']?_0x378c71[_0x1795('0x41')]:_0x2b120d[_0x1795('0x3d')];if(!_0xde7d67[_0x1795('0x3e')][_0x1795('0x43')](_0x1795('0x44'))){_0x378c71[_0x1795('0x2b')]=qs[_0x1795('0x2b')](_0xde7d67[_0x1795('0x3e')][_0x1795('0x2b')]);_0x378c71[_0x1795('0x45')]=qs['offset'](_0xde7d67[_0x1795('0x3e')][_0x1795('0x45')]);}_0x378c71[_0x1795('0x46')]=qs[_0x1795('0x47')](_0xde7d67[_0x1795('0x3e')][_0x1795('0x47')]);_0x378c71[_0x1795('0x48')]=qs['filters'](_[_0x1795('0x49')](_0xde7d67[_0x1795('0x3e')],_0x2b120d[_0x1795('0x3f')]),_0x86966a);if(_0xde7d67[_0x1795('0x3e')][_0x1795('0x4a')]){_0x378c71[_0x1795('0x48')]=_[_0x1795('0x4b')](_0x378c71[_0x1795('0x48')],{'$or':_[_0x1795('0x4c')](_0x86966a,function(_0x1d0d32){if(_0x1d0d32[_0x1795('0x4d')]!==_0x1795('0x4e')){var _0x1f312d={};_0x1f312d[_0x1d0d32[_0x1795('0x37')]]={'$like':'%'+_0xde7d67[_0x1795('0x3e')]['filter']+'%'};return _0x1f312d;}})});}_0x378c71=_[_0x1795('0x4b')]({},_0x378c71,_0xde7d67[_0x1795('0x4f')]);var _0x5efac9={'where':_0x378c71[_0x1795('0x48')]};return db['VoiceContext'][_0x1795('0x2c')](_0x5efac9)['then'](function(_0x180a13){_0x490bff[_0x1795('0x2c')]=_0x180a13;if(_0xde7d67['query']['includeAll']){_0x378c71[_0x1795('0x50')]=[{'all':!![]}];}return db['VoiceContext'][_0x1795('0x51')](_0x378c71);})[_0x1795('0x1a')](function(_0xf2d8c0){_0x490bff[_0x1795('0x52')]=_0xf2d8c0;return _0x490bff;})[_0x1795('0x1a')](respondWithFilteredResult(_0x90ffea,_0x378c71))[_0x1795('0x25')](handleError(_0x90ffea,null));};exports[_0x1795('0x53')]=function(_0x1356b5,_0x1ae092){var _0x2b116c={'raw':![],'where':{'id':_0x1356b5['params']['id']}},_0x13e4a6={};_0x13e4a6[_0x1795('0x3d')]=_['keys'](db[_0x1795('0x39')]['rawAttributes']);_0x13e4a6[_0x1795('0x3e')]=_[_0x1795('0x54')](_0x1356b5[_0x1795('0x3e')]);_0x13e4a6[_0x1795('0x3f')]=_[_0x1795('0x40')](_0x13e4a6[_0x1795('0x3d')],_0x13e4a6[_0x1795('0x3e')]);_0x2b116c[_0x1795('0x41')]=_[_0x1795('0x40')](_0x13e4a6['model'],qs['fields'](_0x1356b5[_0x1795('0x3e')][_0x1795('0x42')]));_0x2b116c[_0x1795('0x41')]=_0x2b116c['attributes'][_0x1795('0x55')]?_0x2b116c[_0x1795('0x41')]:_0x13e4a6[_0x1795('0x3d')];if(_0x1356b5[_0x1795('0x3e')][_0x1795('0x56')]){_0x2b116c['include']=[{'all':!![]}];}_0x2b116c=_[_0x1795('0x4b')]({},_0x2b116c,_0x1356b5[_0x1795('0x4f')]);return db['VoiceContext'][_0x1795('0x57')](_0x2b116c)[_0x1795('0x1a')](handleEntityNotFound(_0x1ae092,null))[_0x1795('0x1a')](respondWithResult(_0x1ae092,null))[_0x1795('0x25')](handleError(_0x1ae092,null));};exports[_0x1795('0x58')]=function(_0x4d1706,_0x5954e9,_0x2baa8b){var _0x639f73;return db['VoiceContext'][_0x1795('0x58')](_0x4d1706[_0x1795('0x59')],{'raw':!![]})[_0x1795('0x1a')](function(_0x115112){_0x639f73=_0x115112;return db[_0x1795('0x39')]['findAll']({'raw':!![]});})[_0x1795('0x1a')](function(_0x45331f){var _0x1edc3e=fs[_0x1795('0x5a')](path[_0x1795('0x5b')](config[_0x1795('0x5c')],_0x1795('0x5d')),_0x1795('0x5e'));var _0x451fd2=ejs['render'](_0x1edc3e,{'contexts':_0x45331f||[]});fs[_0x1795('0x5f')](_0x1795('0x60'),_0x451fd2);})[_0x1795('0x1a')](function(){return respondWithRpcPromise(_0x1795('0x61'),_0x1795('0x58'),{'module':'chan_sip.so'});})[_0x1795('0x1a')](function(){var _0x4dce04=_0x4d1706[_0x1795('0x62')]['get']({'plain':!![]});if(!_0x4dce04)throw new Error(_0x1795('0x63'));if(_0x4dce04[_0x1795('0x64')]===_0x1795('0x62')){var _0x2b673f=_0x639f73[_0x1795('0x32')]({'plain':!![]});return db['UserProfileSection'][_0x1795('0x57')]({'where':{'name':_0x1795('0x33'),'userProfileId':_0x4dce04[_0x1795('0x65')]},'raw':!![]})[_0x1795('0x1a')](function(_0x1dd61b){if(_0x1dd61b&&_0x1dd61b[_0x1795('0x66')]===0x0){return db[_0x1795('0x34')][_0x1795('0x58')]({'name':_0x2b673f['name'],'resourceId':_0x2b673f['id'],'type':_0x1dd61b[_0x1795('0x37')],'sectionId':_0x1dd61b['id']},{})[_0x1795('0x1a')](function(){return _0x639f73;});}else{return _0x639f73;}})['catch'](function(_0x12928d){logger[_0x1795('0x21')](_0x1795('0x67'),_0x12928d);throw _0x12928d;});}return _0x639f73;})[_0x1795('0x1a')](respondWithResult(_0x5954e9,0xc9))[_0x1795('0x25')](handleError(_0x5954e9,null));};exports[_0x1795('0x31')]=function(_0x48387e,_0x24a72d,_0x408525){var _0x24a3f;return db['VoiceContext'][_0x1795('0x57')]({'where':{'id':_0x48387e['params']['id']}})['then'](handleEntityNotFound(_0x24a72d,null))[_0x1795('0x1a')](saveUpdates(_0x48387e['body'],null))['then'](function(_0x2ccbec){if(_0x2ccbec){_0x24a3f=_0x2ccbec;return db[_0x1795('0x39')]['findAll']({'raw':!![]});}})[_0x1795('0x1a')](function(_0x4350a5){var _0x1aa324=fs[_0x1795('0x5a')](path[_0x1795('0x5b')](config['root'],_0x1795('0x5d')),'utf8');var _0x5790b3=ejs[_0x1795('0x68')](_0x1aa324,{'contexts':_0x4350a5||[]});fs[_0x1795('0x5f')](_0x1795('0x60'),_0x5790b3);})[_0x1795('0x1a')](function(){return respondWithRpcPromise(_0x1795('0x61'),_0x1795('0x31'),{'module':_0x1795('0x69')});})['then'](function(){return _0x24a3f;})[_0x1795('0x1a')](respondWithResult(_0x24a72d,null))[_0x1795('0x25')](handleError(_0x24a72d,null));};exports['destroy']=function(_0x14614f,_0x2bcd8b,_0x6df4ff){var _0xd079ef;return db[_0x1795('0x39')][_0x1795('0x57')]({'where':{'id':_0x14614f[_0x1795('0x6a')]['id']}})[_0x1795('0x1a')](handleEntityNotFound(_0x2bcd8b,null))[_0x1795('0x1a')](removeEntity(_0x2bcd8b,null))['then'](function(){return db[_0x1795('0x39')][_0x1795('0x51')]({'raw':!![]});})[_0x1795('0x1a')](function(_0xf40458){var _0x498cf9=fs[_0x1795('0x5a')](path[_0x1795('0x5b')](config[_0x1795('0x5c')],_0x1795('0x5d')),_0x1795('0x5e'));var _0x5b6752=ejs[_0x1795('0x68')](_0x498cf9,{'contexts':_0xf40458});fs[_0x1795('0x5f')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x5b6752);return respondWithRpcPromise(_0x1795('0x61'),_0x1795('0x35'),{'module':_0x1795('0x69')});})[_0x1795('0x25')](handleError(_0x2bcd8b,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 6073fcd..3da8f87 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 _0xa8c7=['api','moment','request-promise','rimraf','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','util'];(function(_0x16d390,_0x78594c){var _0xf1854=function(_0x16f49f){while(--_0x16f49f){_0x16d390['push'](_0x16d390['shift']());}};_0xf1854(++_0x78594c);}(_0xa8c7,0x1a3));var _0x7a8c=function(_0x457341,_0x22c157){_0x457341=_0x457341-0x0;var _0x57cf3c=_0xa8c7[_0x457341];return _0x57cf3c;};'use strict';var _=require('lodash');var util=require(_0x7a8c('0x0'));var logger=require('../../config/logger')(_0x7a8c('0x1'));var moment=require(_0x7a8c('0x2'));var BPromise=require('bluebird');var rp=require(_0x7a8c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7a8c('0x4'));var config=require('../../config/environment');var attributes=require(_0x7a8c('0x5'));module[_0x7a8c('0x6')]=function(_0x661ee7,_0x2296cd){return _0x661ee7[_0x7a8c('0x7')](_0x7a8c('0x8'),attributes,{'tableName':_0x7a8c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x263d=['exports','VoiceContext','voice_contexts','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x263d,0x1d9));var _0xd263=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0x263d[_0x164af1];return _0x5d81a2;};'use strict';var _=require(_0xd263('0x0'));var util=require('util');var logger=require(_0xd263('0x1'))(_0xd263('0x2'));var moment=require('moment');var BPromise=require(_0xd263('0x3'));var rp=require(_0xd263('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd263('0x5'));var config=require(_0xd263('0x6'));var attributes=require('./voiceContext.attributes');module[_0xd263('0x7')]=function(_0x3b2e44,_0x131522){return _0x3b2e44['define'](_0xd263('0x8'),attributes,{'tableName':_0xd263('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 9daaa5b..732a385 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 _0x56fe=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring'];(function(_0x3310bc,_0x2fe6f6){var _0x5b4123=function(_0x2f9f5f){while(--_0x2f9f5f){_0x3310bc['push'](_0x3310bc['shift']());}};_0x5b4123(++_0x2fe6f6);}(_0x56fe,0xe4));var _0xe56f=function(_0x3044b5,_0x4f944b){_0x3044b5=_0x3044b5-0x0;var _0x34186e=_0x56fe[_0x3044b5];return _0x34186e;};'use strict';var _=require(_0xe56f('0x0'));var util=require(_0xe56f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe56f('0x2'));var fs=require('fs');var Redis=require(_0xe56f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe56f('0x4'));var logger=require(_0xe56f('0x5'))(_0xe56f('0x6'));var config=require(_0xe56f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe56f('0x8')][_0xe56f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e00bf,_0x575c9e,_0x1e093b){return new BPromise(function(_0x219537,_0x2d1cb3){return client[_0xe56f('0xa')](_0x2e00bf,_0x1e093b)['then'](function(_0x3153e7){logger[_0xe56f('0xb')](_0xe56f('0xc'),_0x575c9e,_0xe56f('0xd'));logger['debug'](_0xe56f('0xe'),_0x575c9e,_0xe56f('0xd'),JSON[_0xe56f('0xf')](_0x3153e7));if(_0x3153e7[_0xe56f('0x10')]){if(_0x3153e7['error'][_0xe56f('0x11')]===0x1f4){logger[_0xe56f('0x10')]('VoiceContext,\x20%s,\x20%s',_0x575c9e,_0x3153e7[_0xe56f('0x10')][_0xe56f('0x12')]);return _0x2d1cb3(_0x3153e7['error'][_0xe56f('0x12')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x575c9e,_0x3153e7['error']['message']);return _0x219537(_0x3153e7[_0xe56f('0x10')][_0xe56f('0x12')]);}else{logger[_0xe56f('0xb')]('VoiceContext,\x20%s,\x20%s',_0x575c9e,_0xe56f('0xd'));_0x219537(_0x3153e7[_0xe56f('0x13')][_0xe56f('0x12')]);}})[_0xe56f('0x14')](function(_0x94e319){logger['error'](_0xe56f('0xc'),_0x575c9e,_0x94e319);_0x2d1cb3(_0x94e319);});});} \ No newline at end of file +var _0xe6e5=['code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2557ca,_0x57ac9e){var _0x428e7a=function(_0x259d9b){while(--_0x259d9b){_0x2557ca['push'](_0x2557ca['shift']());}};_0x428e7a(++_0x57ac9e);}(_0xe6e5,0x1e7));var _0x5e6e=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xe6e5[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0x5e6e('0x0'));var util=require(_0x5e6e('0x1'));var moment=require(_0x5e6e('0x2'));var BPromise=require(_0x5e6e('0x3'));var rs=require(_0x5e6e('0x4'));var fs=require('fs');var Redis=require(_0x5e6e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5e6e('0x6'));var logger=require(_0x5e6e('0x7'))(_0x5e6e('0x8'));var config=require(_0x5e6e('0x9'));var jayson=require(_0x5e6e('0xa'));var client=jayson['client'][_0x5e6e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18b12d,_0x28b603,_0x42e7db){return new BPromise(function(_0x211707,_0x2f6f89){return client[_0x5e6e('0xc')](_0x18b12d,_0x42e7db)['then'](function(_0xdbee49){logger[_0x5e6e('0xd')](_0x5e6e('0xe'),_0x28b603,_0x5e6e('0xf'));logger['debug'](_0x5e6e('0x10'),_0x28b603,_0x5e6e('0xf'),JSON[_0x5e6e('0x11')](_0xdbee49));if(_0xdbee49[_0x5e6e('0x12')]){if(_0xdbee49['error'][_0x5e6e('0x13')]===0x1f4){logger['error'](_0x5e6e('0xe'),_0x28b603,_0xdbee49['error']['message']);return _0x2f6f89(_0xdbee49[_0x5e6e('0x12')][_0x5e6e('0x14')]);}logger[_0x5e6e('0x12')]('VoiceContext,\x20%s,\x20%s',_0x28b603,_0xdbee49['error']['message']);return _0x211707(_0xdbee49['error'][_0x5e6e('0x14')]);}else{logger[_0x5e6e('0xd')](_0x5e6e('0xe'),_0x28b603,_0x5e6e('0xf'));_0x211707(_0xdbee49[_0x5e6e('0x15')][_0x5e6e('0x14')]);}})['catch'](function(_0xd07b99){logger[_0x5e6e('0x12')](_0x5e6e('0xe'),_0x28b603,_0xd07b99);_0x2f6f89(_0xd07b99);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 40c7915..793f30e 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 _0xb6fd=['isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller'];(function(_0x2835a1,_0x1b50ef){var _0x32da3e=function(_0x345d09){while(--_0x345d09){_0x2835a1['push'](_0x2835a1['shift']());}};_0x32da3e(++_0x1b50ef);}(_0xb6fd,0x1bd));var _0xdb6f=function(_0x4a09c6,_0x54ce5e){_0x4a09c6=_0x4a09c6-0x0;var _0x25d834=_0xb6fd[_0x4a09c6];return _0x25d834;};'use strict';var multer=require(_0xdb6f('0x0'));var util=require(_0xdb6f('0x1'));var path=require(_0xdb6f('0x2'));var timeout=require(_0xdb6f('0x3'));var express=require(_0xdb6f('0x4'));var router=express[_0xdb6f('0x5')]();var fs_extra=require(_0xdb6f('0x6'));var auth=require(_0xdb6f('0x7'));var interaction=require(_0xdb6f('0x8'));var config=require(_0xdb6f('0x9'));var controller=require(_0xdb6f('0xa'));router['get']('/',auth[_0xdb6f('0xb')](),controller[_0xdb6f('0xc')]);router[_0xdb6f('0xd')](_0xdb6f('0xe'),auth[_0xdb6f('0xb')](),controller[_0xdb6f('0xf')]);router[_0xdb6f('0xd')](_0xdb6f('0x10'),auth['isAuthenticated'](),controller[_0xdb6f('0x11')]);router[_0xdb6f('0x12')]('/',auth[_0xdb6f('0xb')](),controller[_0xdb6f('0x13')]);router[_0xdb6f('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xdb6f('0x15')]);router[_0xdb6f('0x16')](_0xdb6f('0x10'),auth[_0xdb6f('0xb')](),controller['destroy']);module[_0xdb6f('0x17')]=router; \ No newline at end of file +var _0x9c48=['../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4953c9,_0x24591d){var _0x263a5e=function(_0x4181bf){while(--_0x4181bf){_0x4953c9['push'](_0x4953c9['shift']());}};_0x263a5e(++_0x24591d);}(_0x9c48,0xb1));var _0x89c4=function(_0x4c370d,_0x44cd12){_0x4c370d=_0x4c370d-0x0;var _0x383369=_0x9c48[_0x4c370d];return _0x383369;};'use strict';var multer=require(_0x89c4('0x0'));var util=require('util');var path=require(_0x89c4('0x1'));var timeout=require(_0x89c4('0x2'));var express=require(_0x89c4('0x3'));var router=express[_0x89c4('0x4')]();var fs_extra=require(_0x89c4('0x5'));var auth=require(_0x89c4('0x6'));var interaction=require(_0x89c4('0x7'));var config=require(_0x89c4('0x8'));var controller=require(_0x89c4('0x9'));router[_0x89c4('0xa')]('/',auth[_0x89c4('0xb')](),controller[_0x89c4('0xc')]);router[_0x89c4('0xa')](_0x89c4('0xd'),auth['isAuthenticated'](),controller[_0x89c4('0xe')]);router[_0x89c4('0xa')](_0x89c4('0xf'),auth[_0x89c4('0xb')](),controller[_0x89c4('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x89c4('0x11')]);router[_0x89c4('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x89c4('0x13')]);router[_0x89c4('0x14')](_0x89c4('0xf'),auth['isAuthenticated'](),controller[_0x89c4('0x15')]);module[_0x89c4('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index ddcd439..db46a83 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x54ef,0x112));var _0xf54e=function(_0x1c414f,_0x1db6de){_0x1c414f=_0x1c414f-0x0;var _0x2a99e4=_0x54ef[_0x1c414f];return _0x2a99e4;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'privilege':{'type':Sequelize[_0xf54e('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xf54e('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'calleridnum':{'type':Sequelize[_0xf54e('0x2')]},'calleridname':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'language':{'type':Sequelize[_0xf54e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf54e('0x2')]},'priority':{'type':Sequelize[_0xf54e('0x3')]},'uniqueid':{'type':Sequelize[_0xf54e('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf54e('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'destlanguage':{'type':Sequelize[_0xf54e('0x2')]},'destaccountcode':{'type':Sequelize[_0xf54e('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xf54e('0x2')]},'destpriority':{'type':Sequelize[_0xf54e('0x3')]},'destuniqueid':{'type':Sequelize[_0xf54e('0x2')]},'destlinkedid':{'type':Sequelize[_0xf54e('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xf54e('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf54e('0x4')]},'lastevent':{'type':Sequelize[_0xf54e('0x2')],'comment':_0xf54e('0x5')},'routeId':{'type':Sequelize[_0xf54e('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xf54e('0x3')]},'billableseconds':{'type':Sequelize[_0xf54e('0x3')]}}; \ No newline at end of file +var _0x9957=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x429d6a,_0x14b048){var _0x2f7374=function(_0x1de319){while(--_0x1de319){_0x429d6a['push'](_0x429d6a['shift']());}};_0x2f7374(++_0x14b048);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'privilege':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize[_0x7995('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7995('0x2')]},'calleridnum':{'type':Sequelize[_0x7995('0x2')]},'calleridname':{'type':Sequelize[_0x7995('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'context':{'type':Sequelize[_0x7995('0x2')]},'exten':{'type':Sequelize[_0x7995('0x2')]},'priority':{'type':Sequelize[_0x7995('0x3')]},'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x7995('0x2')]},'destchannelstate':{'type':Sequelize[_0x7995('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x7995('0x2')]},'destcalleridname':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7995('0x2')]},'destlanguage':{'type':Sequelize[_0x7995('0x2')]},'destaccountcode':{'type':Sequelize[_0x7995('0x2')]},'destcontext':{'type':Sequelize[_0x7995('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7995('0x3')]},'destuniqueid':{'type':Sequelize[_0x7995('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x7995('0x2')]},'dialstatus':{'type':Sequelize[_0x7995('0x2')]},'starttime':{'type':Sequelize[_0x7995('0x4')]},'answertime':{'type':Sequelize[_0x7995('0x4')]},'endtime':{'type':Sequelize[_0x7995('0x4')]},'lastevent':{'type':Sequelize[_0x7995('0x2')],'comment':_0x7995('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x7995('0x3')]},'billableseconds':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 55a764f..058a5eb 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 _0x68d2=['findAll','rows','show','params','include','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','save','update','destroy','stack','name','send','map','VoiceDialReport','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','then'];(function(_0x214cca,_0x27ffb0){var _0x269784=function(_0x57bb25){while(--_0x57bb25){_0x214cca['push'](_0x214cca['shift']());}};_0x269784(++_0x27ffb0);}(_0x68d2,0x109));var _0x268d=function(_0x3bd2f4,_0x40efb0){_0x3bd2f4=_0x3bd2f4-0x0;var _0x2e76cd=_0x68d2[_0x3bd2f4];return _0x2e76cd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x268d('0x0'));var zipdir=require(_0x268d('0x1'));var jsonpatch=require(_0x268d('0x2'));var rp=require(_0x268d('0x3'));var moment=require('moment');var BPromise=require(_0x268d('0x4'));var Mustache=require(_0x268d('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x268d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x268d('0x7'));var _=require('lodash');var squel=require(_0x268d('0x8'));var crypto=require(_0x268d('0x9'));var jsforce=require(_0x268d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x268d('0x6'));var querystring=require(_0x268d('0xb'));var Papa=require(_0x268d('0xc'));var Redis=require(_0x268d('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x268d('0xe'));var hardwareService=require(_0x268d('0xf'));var logger=require(_0x268d('0x10'))('api');var utils=require(_0x268d('0x11'));var config=require(_0x268d('0x12'));var licenseUtil=require(_0x268d('0x13'));var db=require(_0x268d('0x14'))['db'];function respondWithStatusCode(_0x3ef1d8,_0x3d2af4){_0x3d2af4=_0x3d2af4||0xcc;return function(_0x401dce){if(_0x401dce){return _0x3ef1d8[_0x268d('0x15')](_0x3d2af4);}return _0x3ef1d8['status'](_0x3d2af4)[_0x268d('0x16')]();};}function respondWithResult(_0x7f618c,_0x3f3d06){_0x3f3d06=_0x3f3d06||0xc8;return function(_0x1e0672){if(_0x1e0672){return _0x7f618c[_0x268d('0x17')](_0x3f3d06)[_0x268d('0x18')](_0x1e0672);}};}function respondWithFilteredResult(_0xc8b880,_0x2e45d7){return function(_0x2d33d2){if(_0x2d33d2){var _0x4e27b9=typeof _0x2e45d7[_0x268d('0x19')]==='undefined'&&typeof _0x2e45d7[_0x268d('0x1a')]==='undefined';var _0x5acb39=_0x2d33d2[_0x268d('0x1b')];var _0x407d67=_0x4e27b9?0x0:_0x2e45d7[_0x268d('0x19')];var _0x151f78=_0x4e27b9?_0x2d33d2[_0x268d('0x1b')]:_0x2e45d7['offset']+_0x2e45d7['limit'];var _0x235cfe;if(_0x151f78>=_0x5acb39){_0x151f78=_0x5acb39;_0x235cfe=0xc8;}else{_0x235cfe=0xce;}_0xc8b880[_0x268d('0x17')](_0x235cfe);return _0xc8b880[_0x268d('0x1c')](_0x268d('0x1d'),_0x407d67+'-'+_0x151f78+'/'+_0x5acb39)[_0x268d('0x18')](_0x2d33d2);}return null;};}function patchUpdates(_0x34c4f0){return function(_0xb1512e){try{jsonpatch['apply'](_0xb1512e,_0x34c4f0,!![]);}catch(_0x11bf7c){return BPromise['reject'](_0x11bf7c);}return _0xb1512e[_0x268d('0x1e')]();};}function saveUpdates(_0x1f3f0b,_0xe7eb7e){return function(_0x38338f){if(_0x38338f){return _0x38338f[_0x268d('0x1f')](_0x1f3f0b)['then'](function(_0x5730c4){return _0x5730c4;});}return null;};}function removeEntity(_0x4650c3,_0x343a85){return function(_0x1b334c){if(_0x1b334c){return _0x1b334c[_0x268d('0x20')]()['then'](function(){_0x4650c3['status'](0xcc)[_0x268d('0x16')]();});}};}function handleEntityNotFound(_0x1e478c,_0x265699){return function(_0x2ed6be){if(!_0x2ed6be){_0x1e478c[_0x268d('0x15')](0x194);}return _0x2ed6be;};}function handleError(_0x4c170d,_0x568c97){_0x568c97=_0x568c97||0x1f4;return function(_0x5d2b1d){logger['error'](_0x5d2b1d[_0x268d('0x21')]);if(_0x5d2b1d[_0x268d('0x22')]){delete _0x5d2b1d[_0x268d('0x22')];}_0x4c170d[_0x268d('0x17')](_0x568c97)[_0x268d('0x23')](_0x5d2b1d);};}exports['index']=function(_0x522606,_0x54f638){var _0x2aefb9={},_0x2cd763={},_0x5bae5f={'count':0x0,'rows':[]};var _0x201cc6=_[_0x268d('0x24')](db[_0x268d('0x25')][_0x268d('0x26')],function(_0x2cd81f){return{'name':_0x2cd81f['fieldName'],'type':_0x2cd81f['type'][_0x268d('0x27')]};});_0x2cd763[_0x268d('0x28')]=_[_0x268d('0x24')](_0x201cc6,_0x268d('0x22'));_0x2cd763[_0x268d('0x29')]=_[_0x268d('0x2a')](_0x522606['query']);_0x2cd763['filters']=_[_0x268d('0x2b')](_0x2cd763['model'],_0x2cd763['query']);_0x2aefb9['attributes']=_['intersection'](_0x2cd763[_0x268d('0x28')],qs[_0x268d('0x2c')](_0x522606[_0x268d('0x29')][_0x268d('0x2c')]));_0x2aefb9[_0x268d('0x2d')]=_0x2aefb9['attributes'][_0x268d('0x2e')]?_0x2aefb9[_0x268d('0x2d')]:_0x2cd763[_0x268d('0x28')];if(!_0x522606['query']['hasOwnProperty'](_0x268d('0x2f'))){_0x2aefb9[_0x268d('0x1a')]=qs[_0x268d('0x1a')](_0x522606[_0x268d('0x29')]['limit']);_0x2aefb9[_0x268d('0x19')]=qs[_0x268d('0x19')](_0x522606[_0x268d('0x29')][_0x268d('0x19')]);}_0x2aefb9['order']=qs['sort'](_0x522606[_0x268d('0x29')][_0x268d('0x30')]);_0x2aefb9[_0x268d('0x31')]=qs[_0x268d('0x32')](_[_0x268d('0x33')](_0x522606[_0x268d('0x29')],_0x2cd763['filters']),_0x201cc6);if(_0x522606[_0x268d('0x29')][_0x268d('0x34')]){_0x2aefb9['where']=_[_0x268d('0x35')](_0x2aefb9[_0x268d('0x31')],{'$or':_['map'](_0x201cc6,function(_0x133c2e){if(_0x133c2e['type']!=='VIRTUAL'){var _0x18e270={};_0x18e270[_0x133c2e[_0x268d('0x22')]]={'$like':'%'+_0x522606[_0x268d('0x29')][_0x268d('0x34')]+'%'};return _0x18e270;}})});}_0x2aefb9=_[_0x268d('0x35')]({},_0x2aefb9,_0x522606['options']);var _0x50eea1={'where':_0x2aefb9['where']};return db[_0x268d('0x25')][_0x268d('0x1b')](_0x50eea1)[_0x268d('0x36')](function(_0x4b1e7c){_0x5bae5f[_0x268d('0x1b')]=_0x4b1e7c;if(_0x522606[_0x268d('0x29')]['includeAll']){_0x2aefb9['include']=[{'all':!![]}];}return db[_0x268d('0x25')][_0x268d('0x37')](_0x2aefb9);})[_0x268d('0x36')](function(_0x134bd0){_0x5bae5f[_0x268d('0x38')]=_0x134bd0;return _0x5bae5f;})[_0x268d('0x36')](respondWithFilteredResult(_0x54f638,_0x2aefb9))['catch'](handleError(_0x54f638,null));};exports[_0x268d('0x39')]=function(_0x7dcfd1,_0x29916f){var _0x3cf72a={'raw':!![],'where':{'id':_0x7dcfd1[_0x268d('0x3a')]['id']}},_0x59e9e2={};_0x59e9e2[_0x268d('0x28')]=_['keys'](db['VoiceDialReport']['rawAttributes']);_0x59e9e2['query']=_[_0x268d('0x2a')](_0x7dcfd1[_0x268d('0x29')]);_0x59e9e2['filters']=_[_0x268d('0x2b')](_0x59e9e2[_0x268d('0x28')],_0x59e9e2[_0x268d('0x29')]);_0x3cf72a[_0x268d('0x2d')]=_[_0x268d('0x2b')](_0x59e9e2[_0x268d('0x28')],qs[_0x268d('0x2c')](_0x7dcfd1['query'][_0x268d('0x2c')]));_0x3cf72a[_0x268d('0x2d')]=_0x3cf72a[_0x268d('0x2d')]['length']?_0x3cf72a[_0x268d('0x2d')]:_0x59e9e2['model'];if(_0x7dcfd1[_0x268d('0x29')]['includeAll']){_0x3cf72a[_0x268d('0x3b')]=[{'all':!![]}];}_0x3cf72a=_[_0x268d('0x35')]({},_0x3cf72a,_0x7dcfd1['options']);return db[_0x268d('0x25')][_0x268d('0x3c')](_0x3cf72a)['then'](handleEntityNotFound(_0x29916f,null))[_0x268d('0x36')](respondWithResult(_0x29916f,null))[_0x268d('0x3d')](handleError(_0x29916f,null));};exports['create']=function(_0x37530a,_0x194a6f){return db[_0x268d('0x25')][_0x268d('0x3e')](_0x37530a[_0x268d('0x3f')],{})[_0x268d('0x36')](respondWithResult(_0x194a6f,0xc9))['catch'](handleError(_0x194a6f,null));};exports['update']=function(_0x33ab18,_0x45d557){if(_0x33ab18['body']['id']){delete _0x33ab18['body']['id'];}return db[_0x268d('0x25')][_0x268d('0x3c')]({'where':{'id':_0x33ab18[_0x268d('0x3a')]['id']}})[_0x268d('0x36')](handleEntityNotFound(_0x45d557,null))[_0x268d('0x36')](saveUpdates(_0x33ab18[_0x268d('0x3f')],null))[_0x268d('0x36')](respondWithResult(_0x45d557,null))[_0x268d('0x3d')](handleError(_0x45d557,null));};exports[_0x268d('0x20')]=function(_0x2f083c,_0x327670){return db[_0x268d('0x25')]['find']({'where':{'id':_0x2f083c[_0x268d('0x3a')]['id']}})['then'](handleEntityNotFound(_0x327670,null))[_0x268d('0x36')](removeEntity(_0x327670,null))[_0x268d('0x3d')](handleError(_0x327670,null));};exports['describe']=function(_0x4a0f74,_0x2a9faa){return db[_0x268d('0x25')]['describe']()['then'](respondWithResult(_0x2a9faa,null))[_0x268d('0x3d')](handleError(_0x2a9faa,null));}; \ No newline at end of file +var _0x435b=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','name','index','map','VoiceDialReport','rawAttributes','fieldName','type','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','catch','show','keys','includeAll','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel'];(function(_0x37ba89,_0x17ecbd){var _0x59ec87=function(_0x5e0ea1){while(--_0x5e0ea1){_0x37ba89['push'](_0x37ba89['shift']());}};_0x59ec87(++_0x17ecbd);}(_0x435b,0x86));var _0xb435=function(_0x47a894,_0x542f48){_0x47a894=_0x47a894-0x0;var _0x947c62=_0x435b[_0x47a894];return _0x947c62;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb435('0x0'));var zipdir=require(_0xb435('0x1'));var jsonpatch=require(_0xb435('0x2'));var rp=require(_0xb435('0x3'));var moment=require('moment');var BPromise=require(_0xb435('0x4'));var Mustache=require(_0xb435('0x5'));var util=require(_0xb435('0x6'));var path=require('path');var sox=require(_0xb435('0x7'));var csv=require('to-csv');var ejs=require(_0xb435('0x8'));var fs=require('fs');var fs_extra=require(_0xb435('0x9'));var _=require(_0xb435('0xa'));var squel=require(_0xb435('0xb'));var crypto=require(_0xb435('0xc'));var jsforce=require(_0xb435('0xd'));var deskjs=require(_0xb435('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb435('0xf'));var Papa=require(_0xb435('0x10'));var Redis=require(_0xb435('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb435('0x12'));var as=require(_0xb435('0x13'));var hardwareService=require(_0xb435('0x14'));var logger=require('../../config/logger')(_0xb435('0x15'));var utils=require(_0xb435('0x16'));var config=require(_0xb435('0x17'));var licenseUtil=require(_0xb435('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x432ef0,_0x6c5a17){_0x6c5a17=_0x6c5a17||0xcc;return function(_0x240a73){if(_0x240a73){return _0x432ef0[_0xb435('0x19')](_0x6c5a17);}return _0x432ef0[_0xb435('0x1a')](_0x6c5a17)[_0xb435('0x1b')]();};}function respondWithResult(_0x537f40,_0x4230cd){_0x4230cd=_0x4230cd||0xc8;return function(_0x5c0d04){if(_0x5c0d04){return _0x537f40[_0xb435('0x1a')](_0x4230cd)[_0xb435('0x1c')](_0x5c0d04);}};}function respondWithFilteredResult(_0x5f3f8b,_0x2d7389){return function(_0xb21edc){if(_0xb21edc){var _0x5cfe99=typeof _0x2d7389[_0xb435('0x1d')]===_0xb435('0x1e')&&typeof _0x2d7389[_0xb435('0x1f')]===_0xb435('0x1e');var _0x5cc886=_0xb21edc[_0xb435('0x20')];var _0x3cc8bf=_0x5cfe99?0x0:_0x2d7389[_0xb435('0x1d')];var _0x48f4de=_0x5cfe99?_0xb21edc[_0xb435('0x20')]:_0x2d7389[_0xb435('0x1d')]+_0x2d7389[_0xb435('0x1f')];var _0x11422a;if(_0x48f4de>=_0x5cc886){_0x48f4de=_0x5cc886;_0x11422a=0xc8;}else{_0x11422a=0xce;}_0x5f3f8b[_0xb435('0x1a')](_0x11422a);return _0x5f3f8b['set'](_0xb435('0x21'),_0x3cc8bf+'-'+_0x48f4de+'/'+_0x5cc886)[_0xb435('0x1c')](_0xb21edc);}return null;};}function patchUpdates(_0x44555e){return function(_0x353c03){try{jsonpatch[_0xb435('0x22')](_0x353c03,_0x44555e,!![]);}catch(_0x4e6e8d){return BPromise[_0xb435('0x23')](_0x4e6e8d);}return _0x353c03['save']();};}function saveUpdates(_0x573d9e,_0x1a2f9a){return function(_0x174628){if(_0x174628){return _0x174628[_0xb435('0x24')](_0x573d9e)[_0xb435('0x25')](function(_0x375317){return _0x375317;});}return null;};}function removeEntity(_0x1cb124,_0x4d01a0){return function(_0xa2eb72){if(_0xa2eb72){return _0xa2eb72[_0xb435('0x26')]()[_0xb435('0x25')](function(){_0x1cb124['status'](0xcc)[_0xb435('0x1b')]();});}};}function handleEntityNotFound(_0x4b4169,_0x5bb43b){return function(_0x3436b7){if(!_0x3436b7){_0x4b4169[_0xb435('0x19')](0x194);}return _0x3436b7;};}function handleError(_0x2171df,_0x5c8974){_0x5c8974=_0x5c8974||0x1f4;return function(_0x1f429f){logger[_0xb435('0x27')](_0x1f429f['stack']);if(_0x1f429f['name']){delete _0x1f429f[_0xb435('0x28')];}_0x2171df['status'](_0x5c8974)['send'](_0x1f429f);};}exports[_0xb435('0x29')]=function(_0xf04762,_0x3dc6e3){var _0x264ae5={},_0x2f7c46={},_0x59ce05={'count':0x0,'rows':[]};var _0x37cc55=_[_0xb435('0x2a')](db[_0xb435('0x2b')][_0xb435('0x2c')],function(_0x4eae17){return{'name':_0x4eae17[_0xb435('0x2d')],'type':_0x4eae17[_0xb435('0x2e')]['key']};});_0x2f7c46['model']=_[_0xb435('0x2a')](_0x37cc55,_0xb435('0x28'));_0x2f7c46[_0xb435('0x2f')]=_['keys'](_0xf04762['query']);_0x2f7c46[_0xb435('0x30')]=_[_0xb435('0x31')](_0x2f7c46['model'],_0x2f7c46['query']);_0x264ae5[_0xb435('0x32')]=_[_0xb435('0x31')](_0x2f7c46['model'],qs[_0xb435('0x33')](_0xf04762['query']['fields']));_0x264ae5[_0xb435('0x32')]=_0x264ae5[_0xb435('0x32')][_0xb435('0x34')]?_0x264ae5['attributes']:_0x2f7c46[_0xb435('0x35')];if(!_0xf04762[_0xb435('0x2f')][_0xb435('0x36')]('nolimit')){_0x264ae5[_0xb435('0x1f')]=qs[_0xb435('0x1f')](_0xf04762[_0xb435('0x2f')][_0xb435('0x1f')]);_0x264ae5['offset']=qs['offset'](_0xf04762['query'][_0xb435('0x1d')]);}_0x264ae5[_0xb435('0x37')]=qs[_0xb435('0x38')](_0xf04762['query'][_0xb435('0x38')]);_0x264ae5[_0xb435('0x39')]=qs[_0xb435('0x30')](_[_0xb435('0x3a')](_0xf04762[_0xb435('0x2f')],_0x2f7c46[_0xb435('0x30')]),_0x37cc55);if(_0xf04762[_0xb435('0x2f')]['filter']){_0x264ae5[_0xb435('0x39')]=_[_0xb435('0x3b')](_0x264ae5[_0xb435('0x39')],{'$or':_[_0xb435('0x2a')](_0x37cc55,function(_0xc4c383){if(_0xc4c383['type']!==_0xb435('0x3c')){var _0x28efa1={};_0x28efa1[_0xc4c383[_0xb435('0x28')]]={'$like':'%'+_0xf04762[_0xb435('0x2f')][_0xb435('0x3d')]+'%'};return _0x28efa1;}})});}_0x264ae5=_[_0xb435('0x3b')]({},_0x264ae5,_0xf04762[_0xb435('0x3e')]);var _0x2feadf={'where':_0x264ae5['where']};return db[_0xb435('0x2b')][_0xb435('0x20')](_0x2feadf)['then'](function(_0x46b41b){_0x59ce05[_0xb435('0x20')]=_0x46b41b;if(_0xf04762[_0xb435('0x2f')]['includeAll']){_0x264ae5[_0xb435('0x3f')]=[{'all':!![]}];}return db[_0xb435('0x2b')]['findAll'](_0x264ae5);})['then'](function(_0x44eb1b){_0x59ce05['rows']=_0x44eb1b;return _0x59ce05;})[_0xb435('0x25')](respondWithFilteredResult(_0x3dc6e3,_0x264ae5))[_0xb435('0x40')](handleError(_0x3dc6e3,null));};exports[_0xb435('0x41')]=function(_0x35c4e3,_0x1e7d9b){var _0x246b1b={'raw':!![],'where':{'id':_0x35c4e3['params']['id']}},_0x4dfa1d={};_0x4dfa1d[_0xb435('0x35')]=_['keys'](db[_0xb435('0x2b')][_0xb435('0x2c')]);_0x4dfa1d[_0xb435('0x2f')]=_[_0xb435('0x42')](_0x35c4e3['query']);_0x4dfa1d['filters']=_[_0xb435('0x31')](_0x4dfa1d[_0xb435('0x35')],_0x4dfa1d[_0xb435('0x2f')]);_0x246b1b['attributes']=_['intersection'](_0x4dfa1d['model'],qs['fields'](_0x35c4e3[_0xb435('0x2f')][_0xb435('0x33')]));_0x246b1b['attributes']=_0x246b1b[_0xb435('0x32')][_0xb435('0x34')]?_0x246b1b[_0xb435('0x32')]:_0x4dfa1d['model'];if(_0x35c4e3[_0xb435('0x2f')][_0xb435('0x43')]){_0x246b1b[_0xb435('0x3f')]=[{'all':!![]}];}_0x246b1b=_[_0xb435('0x3b')]({},_0x246b1b,_0x35c4e3[_0xb435('0x3e')]);return db[_0xb435('0x2b')][_0xb435('0x44')](_0x246b1b)[_0xb435('0x25')](handleEntityNotFound(_0x1e7d9b,null))['then'](respondWithResult(_0x1e7d9b,null))[_0xb435('0x40')](handleError(_0x1e7d9b,null));};exports[_0xb435('0x45')]=function(_0x2579b5,_0x52f41d){return db[_0xb435('0x2b')]['create'](_0x2579b5['body'],{})[_0xb435('0x25')](respondWithResult(_0x52f41d,0xc9))[_0xb435('0x40')](handleError(_0x52f41d,null));};exports[_0xb435('0x24')]=function(_0x312bc5,_0x47301e){if(_0x312bc5[_0xb435('0x46')]['id']){delete _0x312bc5[_0xb435('0x46')]['id'];}return db['VoiceDialReport'][_0xb435('0x44')]({'where':{'id':_0x312bc5[_0xb435('0x47')]['id']}})[_0xb435('0x25')](handleEntityNotFound(_0x47301e,null))[_0xb435('0x25')](saveUpdates(_0x312bc5[_0xb435('0x46')],null))[_0xb435('0x25')](respondWithResult(_0x47301e,null))[_0xb435('0x40')](handleError(_0x47301e,null));};exports['destroy']=function(_0x23636a,_0x498966){return db['VoiceDialReport']['find']({'where':{'id':_0x23636a[_0xb435('0x47')]['id']}})[_0xb435('0x25')](handleEntityNotFound(_0x498966,null))[_0xb435('0x25')](removeEntity(_0x498966,null))[_0xb435('0x40')](handleError(_0x498966,null));};exports[_0xb435('0x48')]=function(_0x3b436c,_0x430654){return db[_0xb435('0x2b')][_0xb435('0x48')]()[_0xb435('0x25')](respondWithResult(_0x430654,null))[_0xb435('0x40')](handleError(_0x430654,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 9170422..8429e5b 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 _0xb8b7=['../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','report_dial','uniqueid','bluebird','request-promise','path'];(function(_0x38f1f5,_0x38b961){var _0x2c8b9a=function(_0x5716be){while(--_0x5716be){_0x38f1f5['push'](_0x38f1f5['shift']());}};_0x2c8b9a(++_0x38b961);}(_0xb8b7,0x114));var _0x7b8b=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xb8b7[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7b8b('0x0'));var rp=require(_0x7b8b('0x1'));var fs=require('fs');var path=require(_0x7b8b('0x2'));var rimraf=require('rimraf');var config=require(_0x7b8b('0x3'));var attributes=require(_0x7b8b('0x4'));module['exports']=function(_0x58a059,_0x43e2b4){return _0x58a059[_0x7b8b('0x5')](_0x7b8b('0x6'),attributes,{'tableName':_0x7b8b('0x7'),'paranoid':![],'indexes':[{'fields':[_0x7b8b('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb2ed=['request-promise','rimraf','../../config/environment','./voiceDialReport.attributes','exports','VoiceDialReport','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x2ae5ce,_0x481760){var _0x3ccd3c=function(_0x3b870c){while(--_0x3b870c){_0x2ae5ce['push'](_0x2ae5ce['shift']());}};_0x3ccd3c(++_0x481760);}(_0xb2ed,0x127));var _0xdb2e=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0xb2ed[_0xbe40ad];return _0x50fac9;};'use strict';var _=require(_0xdb2e('0x0'));var util=require(_0xdb2e('0x1'));var logger=require(_0xdb2e('0x2'))(_0xdb2e('0x3'));var moment=require('moment');var BPromise=require(_0xdb2e('0x4'));var rp=require(_0xdb2e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdb2e('0x6'));var config=require(_0xdb2e('0x7'));var attributes=require(_0xdb2e('0x8'));module[_0xdb2e('0x9')]=function(_0x2761f1,_0x1dcc25){return _0x2761f1['define'](_0xdb2e('0xa'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xdb2e('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 b2ef7c5..f0d69e0 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 _0xeefa=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VoiceDialReport','create','options','raw','stringify','UpdateVoiceDialReport','where','attributes'];(function(_0x384fc4,_0x1740d6){var _0x292817=function(_0x50249c){while(--_0x50249c){_0x384fc4['push'](_0x384fc4['shift']());}};_0x292817(++_0x1740d6);}(_0xeefa,0x7c));var _0xaeef=function(_0x4370e0,_0x3ef12a){_0x4370e0=_0x4370e0-0x0;var _0x4b06da=_0xeefa[_0x4370e0];return _0x4b06da;};'use strict';var _=require(_0xaeef('0x0'));var util=require(_0xaeef('0x1'));var moment=require(_0xaeef('0x2'));var BPromise=require('bluebird');var rs=require(_0xaeef('0x3'));var fs=require('fs');var Redis=require(_0xaeef('0x4'));var db=require(_0xaeef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaeef('0x6'))(_0xaeef('0x7'));var config=require(_0xaeef('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaeef('0x9')][_0xaeef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2afb3c,_0x529531,_0x4ef190){return new BPromise(function(_0x13ac00,_0x2add15){return client[_0xaeef('0xb')](_0x2afb3c,_0x4ef190)[_0xaeef('0xc')](function(_0x2fbdac){logger[_0xaeef('0xd')](_0xaeef('0xe'),_0x529531,_0xaeef('0xf'));logger[_0xaeef('0x10')](_0xaeef('0x11'),_0x529531,_0xaeef('0xf'),JSON['stringify'](_0x2fbdac));if(_0x2fbdac[_0xaeef('0x12')]){if(_0x2fbdac[_0xaeef('0x12')][_0xaeef('0x13')]===0x1f4){logger[_0xaeef('0x12')](_0xaeef('0xe'),_0x529531,_0x2fbdac[_0xaeef('0x12')][_0xaeef('0x14')]);return _0x2add15(_0x2fbdac[_0xaeef('0x12')]['message']);}logger[_0xaeef('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x529531,_0x2fbdac[_0xaeef('0x12')][_0xaeef('0x14')]);return _0x13ac00(_0x2fbdac[_0xaeef('0x12')][_0xaeef('0x14')]);}else{logger[_0xaeef('0xd')](_0xaeef('0xe'),_0x529531,_0xaeef('0xf'));_0x13ac00(_0x2fbdac[_0xaeef('0x15')][_0xaeef('0x14')]);}})[_0xaeef('0x16')](function(_0x142fa3){logger[_0xaeef('0x12')](_0xaeef('0xe'),_0x529531,_0x142fa3);_0x2add15(_0x142fa3);});});}exports['CreateVoiceDialReport']=function(_0x108974){var _0x1024cc=this;return new Promise(function(_0x37aaf2,_0x457f72){return db[_0xaeef('0x17')][_0xaeef('0x18')](_0x108974['body'],{'raw':_0x108974[_0xaeef('0x19')]?_0x108974[_0xaeef('0x19')][_0xaeef('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x444e99){logger[_0xaeef('0xd')]('CreateVoiceDialReport',_0x108974);logger['debug']('CreateVoiceDialReport',_0x108974,JSON[_0xaeef('0x1b')](_0x444e99));_0x37aaf2(_0x444e99);})[_0xaeef('0x16')](function(_0x5f868f){logger['error']('CreateVoiceDialReport',_0x5f868f[_0xaeef('0x14')],_0x108974);_0x457f72(_0x1024cc[_0xaeef('0x12')](0x1f4,_0x5f868f[_0xaeef('0x14')]));});});};exports[_0xaeef('0x1c')]=function(_0x39441d){var _0x16403e=this;return new Promise(function(_0x33a21a,_0x204627){return db[_0xaeef('0x17')]['update'](_0x39441d['body'],{'raw':_0x39441d[_0xaeef('0x19')]?_0x39441d[_0xaeef('0x19')][_0xaeef('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39441d[_0xaeef('0x19')]?_0x39441d[_0xaeef('0x19')][_0xaeef('0x1d')]||null:null,'attributes':_0x39441d[_0xaeef('0x19')]?_0x39441d['options'][_0xaeef('0x1e')]||null:null,'limit':_0x39441d['options']?_0x39441d[_0xaeef('0x19')]['limit']||null:null})['then'](function(_0x3a2c0c){logger[_0xaeef('0xd')](_0xaeef('0x1c'),_0x39441d);logger[_0xaeef('0x10')](_0xaeef('0x1c'),_0x39441d,JSON['stringify'](_0x3a2c0c));_0x33a21a(_0x3a2c0c);})[_0xaeef('0x16')](function(_0x22e520){logger[_0xaeef('0x12')](_0xaeef('0x1c'),_0x22e520[_0xaeef('0x14')],_0x39441d);_0x204627(_0x16403e[_0xaeef('0x12')](0x1f4,_0x22e520['message']));});});}; \ No newline at end of file +var _0x86fa=['attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update','where'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x86fa,0xc2));var _0xa86f=function(_0x2285c4,_0x143174){_0x2285c4=_0x2285c4-0x0;var _0x31629f=_0x86fa[_0x2285c4];return _0x31629f;};'use strict';var _=require('lodash');var util=require(_0xa86f('0x0'));var moment=require(_0xa86f('0x1'));var BPromise=require(_0xa86f('0x2'));var rs=require(_0xa86f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa86f('0x4'))['db'];var utils=require(_0xa86f('0x5'));var logger=require(_0xa86f('0x6'))('rpc');var config=require(_0xa86f('0x7'));var jayson=require(_0xa86f('0x8'));var client=jayson[_0xa86f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x153486,_0x56dcf0,_0x33ad08){return new BPromise(function(_0x109231,_0x394218){return client['request'](_0x153486,_0x33ad08)[_0xa86f('0xa')](function(_0x529f55){logger['info'](_0xa86f('0xb'),_0x56dcf0,_0xa86f('0xc'));logger[_0xa86f('0xd')](_0xa86f('0xe'),_0x56dcf0,_0xa86f('0xc'),JSON[_0xa86f('0xf')](_0x529f55));if(_0x529f55['error']){if(_0x529f55[_0xa86f('0x10')][_0xa86f('0x11')]===0x1f4){logger[_0xa86f('0x10')](_0xa86f('0xb'),_0x56dcf0,_0x529f55[_0xa86f('0x10')][_0xa86f('0x12')]);return _0x394218(_0x529f55[_0xa86f('0x10')][_0xa86f('0x12')]);}logger[_0xa86f('0x10')](_0xa86f('0xb'),_0x56dcf0,_0x529f55[_0xa86f('0x10')][_0xa86f('0x12')]);return _0x109231(_0x529f55['error']['message']);}else{logger[_0xa86f('0x13')](_0xa86f('0xb'),_0x56dcf0,'request\x20sent');_0x109231(_0x529f55['result'][_0xa86f('0x12')]);}})[_0xa86f('0x14')](function(_0x1cd48e){logger[_0xa86f('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x56dcf0,_0x1cd48e);_0x394218(_0x1cd48e);});});}exports[_0xa86f('0x15')]=function(_0x55ceed){var _0x4996d9=this;return new Promise(function(_0x2daac6,_0x56fa0b){return db[_0xa86f('0x16')][_0xa86f('0x17')](_0x55ceed[_0xa86f('0x18')],{'raw':_0x55ceed[_0xa86f('0x19')]?_0x55ceed[_0xa86f('0x19')][_0xa86f('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0xb738a0){logger['info']('CreateVoiceDialReport',_0x55ceed);logger[_0xa86f('0xd')]('CreateVoiceDialReport',_0x55ceed,JSON['stringify'](_0xb738a0));_0x2daac6(_0xb738a0);})[_0xa86f('0x14')](function(_0x2dbee8){logger[_0xa86f('0x10')](_0xa86f('0x15'),_0x2dbee8['message'],_0x55ceed);_0x56fa0b(_0x4996d9[_0xa86f('0x10')](0x1f4,_0x2dbee8[_0xa86f('0x12')]));});});};exports[_0xa86f('0x1b')]=function(_0x507dcb){var _0x390ce8=this;return new Promise(function(_0x385330,_0x49ca4a){return db[_0xa86f('0x16')][_0xa86f('0x1c')](_0x507dcb[_0xa86f('0x18')],{'raw':_0x507dcb[_0xa86f('0x19')]?_0x507dcb[_0xa86f('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x507dcb[_0xa86f('0x19')]?_0x507dcb[_0xa86f('0x19')][_0xa86f('0x1d')]||null:null,'attributes':_0x507dcb[_0xa86f('0x19')]?_0x507dcb[_0xa86f('0x19')][_0xa86f('0x1e')]||null:null,'limit':_0x507dcb[_0xa86f('0x19')]?_0x507dcb[_0xa86f('0x19')][_0xa86f('0x1f')]||null:null})[_0xa86f('0xa')](function(_0x734dd0){logger['info']('UpdateVoiceDialReport',_0x507dcb);logger[_0xa86f('0xd')](_0xa86f('0x1b'),_0x507dcb,JSON['stringify'](_0x734dd0));_0x385330(_0x734dd0);})[_0xa86f('0x14')](function(_0xbe517c){logger[_0xa86f('0x10')](_0xa86f('0x1b'),_0xbe517c[_0xa86f('0x12')],_0x507dcb);_0x49ca4a(_0x390ce8[_0xa86f('0x10')](0x1f4,_0xbe517c[_0xa86f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 1e21cb4..e53074b 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 _0x84f9=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post','/:id/applications','addApplications','put','delete','destroy','multer','util'];(function(_0xf7941b,_0x1e022f){var _0xfabcd8=function(_0x12f654){while(--_0x12f654){_0xf7941b['push'](_0xf7941b['shift']());}};_0xfabcd8(++_0x1e022f);}(_0x84f9,0x154));var _0x984f=function(_0x342433,_0x1fa7c2){_0x342433=_0x342433-0x0;var _0xa1358f=_0x84f9[_0x342433];return _0xa1358f;};'use strict';var multer=require(_0x984f('0x0'));var util=require(_0x984f('0x1'));var path=require(_0x984f('0x2'));var timeout=require(_0x984f('0x3'));var express=require('express');var router=express[_0x984f('0x4')]();var fs_extra=require(_0x984f('0x5'));var auth=require(_0x984f('0x6'));var interaction=require(_0x984f('0x7'));var config=require(_0x984f('0x8'));var controller=require('./voiceExtension.controller');router['get']('/',auth[_0x984f('0x9')](),controller['index']);router[_0x984f('0xa')](_0x984f('0xb'),auth[_0x984f('0x9')](),controller[_0x984f('0xc')]);router[_0x984f('0xd')]('/',auth[_0x984f('0x9')](),controller['create']);router[_0x984f('0xd')](_0x984f('0xe'),auth[_0x984f('0x9')](),controller[_0x984f('0xf')]);router[_0x984f('0x10')](_0x984f('0xb'),auth[_0x984f('0x9')](),controller['update']);router[_0x984f('0x11')]('/:id',auth[_0x984f('0x9')](),controller[_0x984f('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5064=['/:id','show','post','create','/:id/applications','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x15f795,_0x55fc73){var _0x44decc=function(_0x3d53d5){while(--_0x3d53d5){_0x15f795['push'](_0x15f795['shift']());}};_0x44decc(++_0x55fc73);}(_0x5064,0x95));var _0x4506=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5064[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x4506('0x0'));var util=require(_0x4506('0x1'));var path=require(_0x4506('0x2'));var timeout=require(_0x4506('0x3'));var express=require(_0x4506('0x4'));var router=express['Router']();var fs_extra=require(_0x4506('0x5'));var auth=require(_0x4506('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4506('0x7'));var controller=require('./voiceExtension.controller');router[_0x4506('0x8')]('/',auth[_0x4506('0x9')](),controller[_0x4506('0xa')]);router['get'](_0x4506('0xb'),auth[_0x4506('0x9')](),controller[_0x4506('0xc')]);router[_0x4506('0xd')]('/',auth['isAuthenticated'](),controller[_0x4506('0xe')]);router['post'](_0x4506('0xf'),auth[_0x4506('0x9')](),controller['addApplications']);router[_0x4506('0x10')](_0x4506('0xb'),auth[_0x4506('0x9')](),controller[_0x4506('0x11')]);router[_0x4506('0x12')](_0x4506('0xb'),auth[_0x4506('0x9')](),controller[_0x4506('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index a509bdb..f4537f8 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 _0x9037=['inbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','exten','sequelize','STRING','compositeIndex','NoOp','ENUM','inbound','outbound'];(function(_0x17f84d,_0x52cc85){var _0x19cb05=function(_0x120ba8){while(--_0x120ba8){_0x17f84d['push'](_0x17f84d['shift']());}};_0x19cb05(++_0x52cc85);}(_0x9037,0x152));var _0x7903=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9037[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7903('0x0'));module['exports']={'context':{'type':Sequelize[_0x7903('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7903('0x2')},'priority':{'type':Sequelize[_0x7903('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x7903('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x7903('0x1')],'allowNull':![],'defaultValue':_0x7903('0x3')},'appdata':{'type':Sequelize[_0x7903('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x7903('0x4')](_0x7903('0x5'),_0x7903('0x6'),'internal',_0x7903('0x7'),'outbound-fax',_0x7903('0x8'),_0x7903('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x7903('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7903('0xa')},'IntervalId':{'type':Sequelize[_0x7903('0xb')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x7903('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x7903('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x7903('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x7903('0xb')]},'recordingFormat':{'type':Sequelize[_0x7903('0x1')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x7903('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x7903('0xd')],'get':function(_0x36dfbf){return this['getDataValue'](_0x7903('0xe'));}},'alias':{'type':Sequelize[_0x7903('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x36ff=['outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','exten','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax'];(function(_0x40dd56,_0x726ca5){var _0x4f850f=function(_0x5f899e){while(--_0x5f899e){_0x40dd56['push'](_0x40dd56['shift']());}};_0x4f850f(++_0x726ca5);}(_0x36ff,0x1b1));var _0xf36f=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x36ff[_0x491a7f];return _0x3d8f44;};'use strict';var Sequelize=require('sequelize');module[_0xf36f('0x0')]={'context':{'type':Sequelize[_0xf36f('0x1')],'allowNull':![],'unique':_0xf36f('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf36f('0x2')},'priority':{'type':Sequelize[_0xf36f('0x1')],'allowNull':![],'defaultValue':'1','unique':_0xf36f('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xf36f('0x1')],'allowNull':![],'defaultValue':_0xf36f('0x3')},'appdata':{'type':Sequelize[_0xf36f('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xf36f('0x4')](_0xf36f('0x5'),_0xf36f('0x6'),_0xf36f('0x7'),_0xf36f('0x8'),_0xf36f('0x9'),'system',_0xf36f('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xf36f('0x1')]},'interval':{'type':Sequelize[_0xf36f('0x1')],'allowNull':![],'defaultValue':_0xf36f('0xb')},'IntervalId':{'type':Sequelize[_0xf36f('0xc')]},'isApp':{'type':Sequelize[_0xf36f('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xf36f('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0xf36f('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xf36f('0xc')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xf36f('0xe')},'answer':{'type':Sequelize[_0xf36f('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0xf36f('0xf')],'get':function(_0xadbcb0){return this['getDataValue'](_0xf36f('0x10'));}},'alias':{'type':Sequelize[_0xf36f('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 62f8662..c4e9756 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 _0x7e4d=['fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','VoiceExtension','includeAll','include','findAll','catch','show','params','length','create','body','startsWith','exten','concat','user','role','InternalRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','error','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','then','get','InboundRoutes','OutboundRoutes','outbound','internal','filter','ignore','map','value','includes','type','find','name','send','index','rawAttributes','fieldName','key','model','keys','filters','query','attributes','intersection'];(function(_0x21d560,_0x51f6da){var _0x4e8c93=function(_0x28a0a1){while(--_0x28a0a1){_0x21d560['push'](_0x21d560['shift']());}};_0x4e8c93(++_0x51f6da);}(_0x7e4d,0x140));var _0xd7e4=function(_0x43c4ca,_0x42d4c8){_0x43c4ca=_0x43c4ca-0x0;var _0x136b76=_0x7e4d[_0x43c4ca];return _0x136b76;};'use strict';var _=require(_0xd7e4('0x0'));var Redis=require(_0xd7e4('0x1'));var qs=require(_0xd7e4('0x2'));var logger=require(_0xd7e4('0x3'))(_0xd7e4('0x4'));var config=require(_0xd7e4('0x5'));var db=require(_0xd7e4('0x6'))['db'];config[_0xd7e4('0x7')]=_['defaults'](config[_0xd7e4('0x7')],{'host':_0xd7e4('0x8'),'port':0x18eb});var socket=require(_0xd7e4('0x9'))(new Redis(config[_0xd7e4('0x7')]));require(_0xd7e4('0xa'))[_0xd7e4('0xb')](socket);function respondWithStatusCode(_0x4886be,_0x33a8e5){_0x33a8e5=_0x33a8e5||0xcc;return function(_0x412bff){if(_0x412bff){return _0x4886be[_0xd7e4('0xc')](_0x33a8e5);}return _0x4886be[_0xd7e4('0xd')](_0x33a8e5)[_0xd7e4('0xe')]();};}function respondWithResult(_0x5b44f3,_0x3bc9bc){_0x3bc9bc=_0x3bc9bc||0xc8;return function(_0x1e7628){if(_0x1e7628){return _0x5b44f3[_0xd7e4('0xd')](_0x3bc9bc)[_0xd7e4('0xf')](_0x1e7628);}};}function respondWithFilteredResult(_0x2e3fce,_0x34f951){return function(_0x1eb584){if(_0x1eb584){var _0x156e00=typeof _0x34f951[_0xd7e4('0x10')]===_0xd7e4('0x11')&&typeof _0x34f951[_0xd7e4('0x12')]===_0xd7e4('0x11');var _0x4ff8bb=_0x1eb584[_0xd7e4('0x13')];var _0x5cae41=_0x156e00?0x0:_0x34f951[_0xd7e4('0x10')];var _0x1aab25=_0x156e00?_0x1eb584[_0xd7e4('0x13')]:_0x34f951[_0xd7e4('0x10')]+_0x34f951[_0xd7e4('0x12')];var _0x526f7a;if(_0x1aab25>=_0x4ff8bb){_0x1aab25=_0x4ff8bb;_0x526f7a=0xc8;}else{_0x526f7a=0xce;}_0x2e3fce['status'](_0x526f7a);return _0x2e3fce[_0xd7e4('0x14')](_0xd7e4('0x15'),_0x5cae41+'-'+_0x1aab25+'/'+_0x4ff8bb)[_0xd7e4('0xf')](_0x1eb584);}return null;};}function removeEntity(_0x30f41f){return function(_0x3b5217){if(_0x3b5217){return _0x3b5217[_0xd7e4('0x16')]()[_0xd7e4('0x17')](function(){var _0x4cec30=_0x3b5217[_0xd7e4('0x18')]({'plain':!![]});var _0x20659f=[{'name':_0xd7e4('0x19'),'value':'inbound','ignore':![]},{'name':_0xd7e4('0x1a'),'value':_0xd7e4('0x1b'),'ignore':![]},{'name':'InternalRoutes','value':_0xd7e4('0x1c'),'ignore':![]}];var _0x4ca7be=_(_0x20659f)[_0xd7e4('0x1d')](_0xd7e4('0x1e'))[_0xd7e4('0x1f')](_0xd7e4('0x20'))[_0xd7e4('0x20')]();if(_[_0xd7e4('0x21')](_0x4ca7be,_0x4cec30[_0xd7e4('0x22')])){return;}var _0x146313=_[_0xd7e4('0x23')](_0x20659f,[_0xd7e4('0x20'),_0x4cec30[_0xd7e4('0x22')]])[_0xd7e4('0x24')];return db['UserProfileResource'][_0xd7e4('0x16')]({'where':{'type':_0x146313,'resourceId':_0x4cec30['id']}})[_0xd7e4('0x17')](function(){return _0x3b5217;});})[_0xd7e4('0x17')](function(){_0x30f41f[_0xd7e4('0xd')](0xcc)[_0xd7e4('0xe')]();});}};}function handleEntityNotFound(_0x351803){return function(_0x432725){if(!_0x432725){_0x351803[_0xd7e4('0xc')](0x194);}return _0x432725;};}function handleError(_0x548a70,_0x22fb93){_0x22fb93=_0x22fb93||0x1f4;return function(_0x45f197){logger['error'](_0x45f197['stack']);if(_0x45f197[_0xd7e4('0x24')]){delete _0x45f197[_0xd7e4('0x24')];}_0x548a70[_0xd7e4('0xd')](_0x22fb93)[_0xd7e4('0x25')](_0x45f197);};}exports[_0xd7e4('0x26')]=function(_0x3b48a4,_0x4f2f9c){var _0x9ad378={},_0xffa435={},_0x282a4b={'count':0x0,'rows':[]};var _0xa8bbd7=_[_0xd7e4('0x1f')](db['VoiceExtension'][_0xd7e4('0x27')],function(_0x31fa8b){return{'name':_0x31fa8b[_0xd7e4('0x28')],'type':_0x31fa8b[_0xd7e4('0x22')][_0xd7e4('0x29')]};});_0xffa435[_0xd7e4('0x2a')]=_[_0xd7e4('0x1f')](_0xa8bbd7,_0xd7e4('0x24'));_0xffa435['query']=_[_0xd7e4('0x2b')](_0x3b48a4['query']);_0xffa435[_0xd7e4('0x2c')]=_['intersection'](_0xffa435['model'],_0xffa435[_0xd7e4('0x2d')]);_0x9ad378[_0xd7e4('0x2e')]=_[_0xd7e4('0x2f')](_0xffa435[_0xd7e4('0x2a')],qs[_0xd7e4('0x30')](_0x3b48a4['query'][_0xd7e4('0x30')]));_0x9ad378[_0xd7e4('0x2e')]=_0x9ad378['attributes']['length']?_0x9ad378[_0xd7e4('0x2e')]:_0xffa435['model'];if(!_0x3b48a4[_0xd7e4('0x2d')][_0xd7e4('0x31')]('nolimit')){_0x9ad378[_0xd7e4('0x12')]=qs[_0xd7e4('0x12')](_0x3b48a4[_0xd7e4('0x2d')][_0xd7e4('0x12')]);_0x9ad378[_0xd7e4('0x10')]=qs[_0xd7e4('0x10')](_0x3b48a4[_0xd7e4('0x2d')][_0xd7e4('0x10')]);}_0x9ad378[_0xd7e4('0x32')]=qs[_0xd7e4('0x33')](_0x3b48a4[_0xd7e4('0x2d')][_0xd7e4('0x33')]);_0x9ad378[_0xd7e4('0x34')]=qs[_0xd7e4('0x2c')](_[_0xd7e4('0x35')](_0x3b48a4['query'],_0xffa435[_0xd7e4('0x2c')]),_0xa8bbd7);if(_0x3b48a4[_0xd7e4('0x2d')][_0xd7e4('0x1d')]){_0x9ad378[_0xd7e4('0x34')]=_[_0xd7e4('0x36')](_0x9ad378[_0xd7e4('0x34')],{'$or':_[_0xd7e4('0x1f')](_0xa8bbd7,function(_0x10a3a7){if(_0x10a3a7[_0xd7e4('0x22')]!==_0xd7e4('0x37')){var _0x4a2b9e={};_0x4a2b9e[_0x10a3a7[_0xd7e4('0x24')]]={'$like':'%'+_0x3b48a4[_0xd7e4('0x2d')][_0xd7e4('0x1d')]+'%'};return _0x4a2b9e;}})});}_0x9ad378=_['merge']({},_0x9ad378,_0x3b48a4[_0xd7e4('0x38')]);var _0x3bc17e={'where':_0x9ad378[_0xd7e4('0x34')]};return db[_0xd7e4('0x39')]['count'](_0x3bc17e)[_0xd7e4('0x17')](function(_0x53879d){_0x282a4b['count']=_0x53879d;if(_0x3b48a4[_0xd7e4('0x2d')][_0xd7e4('0x3a')]){_0x9ad378[_0xd7e4('0x3b')]=[{'all':!![]}];}return db[_0xd7e4('0x39')][_0xd7e4('0x3c')](_0x9ad378);})[_0xd7e4('0x17')](function(_0x4640d8){_0x282a4b['rows']=_0x4640d8;return _0x282a4b;})[_0xd7e4('0x17')](respondWithFilteredResult(_0x4f2f9c,_0x9ad378))[_0xd7e4('0x3d')](handleError(_0x4f2f9c,null));};exports[_0xd7e4('0x3e')]=function(_0xf5fce9,_0x13b54c){var _0x35ddb9={'raw':![],'where':{'id':_0xf5fce9[_0xd7e4('0x3f')]['id']}},_0x149406={};_0x149406[_0xd7e4('0x2a')]=_['keys'](db[_0xd7e4('0x39')][_0xd7e4('0x27')]);_0x149406[_0xd7e4('0x2d')]=_[_0xd7e4('0x2b')](_0xf5fce9[_0xd7e4('0x2d')]);_0x149406[_0xd7e4('0x2c')]=_[_0xd7e4('0x2f')](_0x149406[_0xd7e4('0x2a')],_0x149406[_0xd7e4('0x2d')]);_0x35ddb9[_0xd7e4('0x2e')]=_[_0xd7e4('0x2f')](_0x149406[_0xd7e4('0x2a')],qs['fields'](_0xf5fce9['query'][_0xd7e4('0x30')]));_0x35ddb9[_0xd7e4('0x2e')]=_0x35ddb9[_0xd7e4('0x2e')][_0xd7e4('0x40')]?_0x35ddb9[_0xd7e4('0x2e')]:_0x149406[_0xd7e4('0x2a')];if(_0xf5fce9[_0xd7e4('0x2d')]['includeAll']){_0x35ddb9[_0xd7e4('0x3b')]=[{'all':!![]}];}_0x35ddb9=_[_0xd7e4('0x36')]({},_0x35ddb9,_0xf5fce9[_0xd7e4('0x38')]);return db[_0xd7e4('0x39')][_0xd7e4('0x23')](_0x35ddb9)[_0xd7e4('0x17')](handleEntityNotFound(_0x13b54c,null))['then'](respondWithResult(_0x13b54c,null))[_0xd7e4('0x3d')](handleError(_0x13b54c,null));};exports['destroy']=function(_0x623c89,_0x4c0afd){return db[_0xd7e4('0x39')]['find']({'where':{'id':_0x623c89[_0xd7e4('0x3f')]['id']}})[_0xd7e4('0x17')](handleEntityNotFound(_0x4c0afd,null))[_0xd7e4('0x17')](removeEntity(_0x4c0afd,null))[_0xd7e4('0x3d')](handleError(_0x4c0afd,null));};exports[_0xd7e4('0x41')]=function(_0x10ae43,_0x548263){if(_0x10ae43[_0xd7e4('0x42')]['type']===_0xd7e4('0x1b')&&!_[_0xd7e4('0x43')](_0x10ae43[_0xd7e4('0x42')][_0xd7e4('0x44')],'_')){_0x10ae43['body'][_0xd7e4('0x44')]='_'[_0xd7e4('0x45')](_0x10ae43[_0xd7e4('0x42')][_0xd7e4('0x44')]);}return db[_0xd7e4('0x39')]['create'](_0x10ae43[_0xd7e4('0x42')],{'raw':![]})[_0xd7e4('0x17')](function(_0x55f2fd){var _0x586169=_0x10ae43[_0xd7e4('0x46')]['get']({'plain':!![]});if(!_0x586169)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x586169[_0xd7e4('0x47')]==='user'){var _0x324d43=_0x55f2fd['get']({'plain':!![]});var _0x55090f=[{'name':_0xd7e4('0x19'),'value':'inbound'},{'name':'OutboundRoutes','value':_0xd7e4('0x1b')},{'name':_0xd7e4('0x48'),'value':_0xd7e4('0x1c')}];var _0x4a71db=_[_0xd7e4('0x23')](_0x55090f,[_0xd7e4('0x20'),_0x324d43[_0xd7e4('0x22')]])['name'];return db[_0xd7e4('0x49')][_0xd7e4('0x23')]({'where':{'name':_0x4a71db,'userProfileId':_0x586169[_0xd7e4('0x4a')]},'raw':!![]})['then'](function(_0x2e89af){if(_0x2e89af&&_0x2e89af[_0xd7e4('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x324d43[_0xd7e4('0x24')],'resourceId':_0x324d43['id'],'type':_0x2e89af['name'],'sectionId':_0x2e89af['id']},{})[_0xd7e4('0x17')](function(){return _0x55f2fd;});}else{return _0x55f2fd;}})[_0xd7e4('0x3d')](function(_0x44d5c8){logger['error'](_0xd7e4('0x4c'),_0x44d5c8);throw _0x44d5c8;});}return _0x55f2fd;})[_0xd7e4('0x17')](respondWithResult(_0x548263,0xc9))[_0xd7e4('0x3d')](handleError(_0x548263,null));};exports['update']=function(_0x3770b4,_0x4adb4c){if(_0x3770b4[_0xd7e4('0x42')]['id']){delete _0x3770b4[_0xd7e4('0x42')]['id'];}return db[_0xd7e4('0x39')]['find']({'where':{'id':_0x3770b4[_0xd7e4('0x3f')]['id']}})[_0xd7e4('0x17')](handleEntityNotFound(_0x4adb4c,null))[_0xd7e4('0x17')](function(_0xd49cc9){if(_0xd49cc9){return db[_0xd7e4('0x39')][_0xd7e4('0x4d')](_[_0xd7e4('0x35')](_0x3770b4[_0xd7e4('0x42')],[_0xd7e4('0x44'),'context',_0xd7e4('0x4e'),_0xd7e4('0x4f'),_0xd7e4('0x50'),_0xd7e4('0x51'),_0xd7e4('0x52')]),{'where':{'context':_0xd49cc9[_0xd7e4('0x53')],'exten':_0xd49cc9[_0xd7e4('0x44')]},'individualHooks':!![]})[_0xd7e4('0x17')](function(_0x39859e){return _0x39859e;});}return null;})[_0xd7e4('0x17')](respondWithStatusCode(_0x4adb4c,null))[_0xd7e4('0x3d')](handleError(_0x4adb4c,null));};exports['addApplications']=function(_0x355462,_0x1229ed){var _0x15802c=_0x355462[_0xd7e4('0x3f')]['id'];var _0x4bfa03=_0x355462[_0xd7e4('0x42')];var _0x3a1f5f=0xc8;var _0x2d7a37=null;return db[_0xd7e4('0x54')]['transaction']({'isolationLevel':db[_0xd7e4('0x54')][_0xd7e4('0x55')][_0xd7e4('0x56')][_0xd7e4('0x57')]},function(_0x1aa425){return db[_0xd7e4('0x39')]['findOne']({'where':{'id':_0x15802c},'transaction':_0x1aa425})[_0xd7e4('0x17')](function(_0x1ba675){if(_0x1ba675){return db[_0xd7e4('0x39')][_0xd7e4('0x16')]({'where':{'VoiceExtensionId':_0x15802c},'transaction':_0x1aa425})['then'](function(){var _0x18128d=_[_0xd7e4('0x1f')](_0x4bfa03,function(_0x390ce5){_0x390ce5[_0xd7e4('0x58')]=_0x15802c;_0x390ce5[_0xd7e4('0x59')]=!![];return _0x390ce5;});return _0x1ba675['createRouting'](_0x18128d);})[_0xd7e4('0x17')](function(_0x36a38b){return db[_0xd7e4('0x39')]['bulkCreate'](_0x36a38b,{'transaction':_0x1aa425});});}else{_0x3a1f5f=0x194;_0x2d7a37=[];}});})[_0xd7e4('0x17')](function(){if(_0x3a1f5f!==0x194){return db[_0xd7e4('0x39')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x15802c},'order':'cast(priority\x20as\x20unsigned)'})[_0xd7e4('0x17')](function(_0x220339){_0x2d7a37=_0x220339;});}})[_0xd7e4('0x3d')](function(_0x2c966a){_0x3a1f5f=0x1f4;logger[_0xd7e4('0x5a')](_0x2c966a['stack']);if(_0x2c966a['name']){delete _0x2c966a[_0xd7e4('0x24')];}_0x2d7a37=_0x2c966a;})[_0xd7e4('0x5b')](function(){if(_0x2d7a37===null){_0x1229ed[_0xd7e4('0xc')](_0x3a1f5f);}else{if(_0x3a1f5f===0x1f4){_0x1229ed[_0xd7e4('0xd')](_0x3a1f5f)['send'](_0x2d7a37);}else{_0x1229ed[_0xd7e4('0xd')](_0x3a1f5f)[_0xd7e4('0xf')](_0x2d7a37);}}});}; \ No newline at end of file +var _0xbbae=['get','role','OutboundRoutes','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','cutdigits','alias','sequelize','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','cast(priority\x20as\x20unsigned)','error','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','./voiceExtension.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','then','InboundRoutes','inbound','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','name','destroy','stack','send','index','VoiceExtension','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','merge','find','body','startsWith','exten','concat','user'];(function(_0x371b25,_0x224870){var _0x5588e8=function(_0x4e10b1){while(--_0x4e10b1){_0x371b25['push'](_0x371b25['shift']());}};_0x5588e8(++_0x224870);}(_0xbbae,0x12d));var _0xebba=function(_0x5ca7b8,_0x1d8f03){_0x5ca7b8=_0x5ca7b8-0x0;var _0x58e84e=_0xbbae[_0x5ca7b8];return _0x58e84e;};'use strict';var _=require(_0xebba('0x0'));var Redis=require(_0xebba('0x1'));var qs=require(_0xebba('0x2'));var logger=require(_0xebba('0x3'))(_0xebba('0x4'));var config=require(_0xebba('0x5'));var db=require('../../mysqldb')['db'];config[_0xebba('0x6')]=_[_0xebba('0x7')](config[_0xebba('0x6')],{'host':_0xebba('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xebba('0x6')]));require(_0xebba('0x9'))[_0xebba('0xa')](socket);function respondWithStatusCode(_0x26d4a4,_0xa1ae42){_0xa1ae42=_0xa1ae42||0xcc;return function(_0x5f1bfb){if(_0x5f1bfb){return _0x26d4a4[_0xebba('0xb')](_0xa1ae42);}return _0x26d4a4['status'](_0xa1ae42)[_0xebba('0xc')]();};}function respondWithResult(_0x5e38f9,_0x423098){_0x423098=_0x423098||0xc8;return function(_0x2fd9c6){if(_0x2fd9c6){return _0x5e38f9[_0xebba('0xd')](_0x423098)[_0xebba('0xe')](_0x2fd9c6);}};}function respondWithFilteredResult(_0x4031c0,_0x183fb1){return function(_0x10b94c){if(_0x10b94c){var _0xf36082=typeof _0x183fb1[_0xebba('0xf')]==='undefined'&&typeof _0x183fb1[_0xebba('0x10')]===_0xebba('0x11');var _0x2334ef=_0x10b94c[_0xebba('0x12')];var _0x24cd78=_0xf36082?0x0:_0x183fb1[_0xebba('0xf')];var _0x2ae632=_0xf36082?_0x10b94c[_0xebba('0x12')]:_0x183fb1[_0xebba('0xf')]+_0x183fb1[_0xebba('0x10')];var _0x46a775;if(_0x2ae632>=_0x2334ef){_0x2ae632=_0x2334ef;_0x46a775=0xc8;}else{_0x46a775=0xce;}_0x4031c0[_0xebba('0xd')](_0x46a775);return _0x4031c0['set'](_0xebba('0x13'),_0x24cd78+'-'+_0x2ae632+'/'+_0x2334ef)[_0xebba('0xe')](_0x10b94c);}return null;};}function removeEntity(_0x466c86){return function(_0x5620e7){if(_0x5620e7){return _0x5620e7['destroy']()[_0xebba('0x14')](function(){var _0x3a0794=_0x5620e7['get']({'plain':!![]});var _0x15132f=[{'name':_0xebba('0x15'),'value':_0xebba('0x16'),'ignore':![]},{'name':'OutboundRoutes','value':_0xebba('0x17'),'ignore':![]},{'name':_0xebba('0x18'),'value':_0xebba('0x19'),'ignore':![]}];var _0x2ceb0e=_(_0x15132f)[_0xebba('0x1a')](_0xebba('0x1b'))[_0xebba('0x1c')](_0xebba('0x1d'))[_0xebba('0x1d')]();if(_[_0xebba('0x1e')](_0x2ceb0e,_0x3a0794[_0xebba('0x1f')])){return;}var _0x3fe7b2=_['find'](_0x15132f,[_0xebba('0x1d'),_0x3a0794['type']])[_0xebba('0x20')];return db['UserProfileResource'][_0xebba('0x21')]({'where':{'type':_0x3fe7b2,'resourceId':_0x3a0794['id']}})['then'](function(){return _0x5620e7;});})[_0xebba('0x14')](function(){_0x466c86['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3646a6){return function(_0x37c4f5){if(!_0x37c4f5){_0x3646a6['sendStatus'](0x194);}return _0x37c4f5;};}function handleError(_0x1acbb2,_0x217c9c){_0x217c9c=_0x217c9c||0x1f4;return function(_0x2fa68e){logger['error'](_0x2fa68e[_0xebba('0x22')]);if(_0x2fa68e['name']){delete _0x2fa68e['name'];}_0x1acbb2['status'](_0x217c9c)[_0xebba('0x23')](_0x2fa68e);};}exports[_0xebba('0x24')]=function(_0x1fd387,_0x1ec3db){var _0x17bc8e={},_0x47cd3c={},_0x3f2056={'count':0x0,'rows':[]};var _0x815f92=_[_0xebba('0x1c')](db[_0xebba('0x25')]['rawAttributes'],function(_0x1a40cf){return{'name':_0x1a40cf[_0xebba('0x26')],'type':_0x1a40cf[_0xebba('0x1f')][_0xebba('0x27')]};});_0x47cd3c['model']=_['map'](_0x815f92,_0xebba('0x20'));_0x47cd3c['query']=_[_0xebba('0x28')](_0x1fd387[_0xebba('0x29')]);_0x47cd3c[_0xebba('0x2a')]=_[_0xebba('0x2b')](_0x47cd3c[_0xebba('0x2c')],_0x47cd3c[_0xebba('0x29')]);_0x17bc8e[_0xebba('0x2d')]=_[_0xebba('0x2b')](_0x47cd3c[_0xebba('0x2c')],qs[_0xebba('0x2e')](_0x1fd387[_0xebba('0x29')][_0xebba('0x2e')]));_0x17bc8e['attributes']=_0x17bc8e[_0xebba('0x2d')][_0xebba('0x2f')]?_0x17bc8e[_0xebba('0x2d')]:_0x47cd3c[_0xebba('0x2c')];if(!_0x1fd387[_0xebba('0x29')][_0xebba('0x30')](_0xebba('0x31'))){_0x17bc8e[_0xebba('0x10')]=qs[_0xebba('0x10')](_0x1fd387[_0xebba('0x29')][_0xebba('0x10')]);_0x17bc8e[_0xebba('0xf')]=qs[_0xebba('0xf')](_0x1fd387[_0xebba('0x29')][_0xebba('0xf')]);}_0x17bc8e[_0xebba('0x32')]=qs[_0xebba('0x33')](_0x1fd387[_0xebba('0x29')][_0xebba('0x33')]);_0x17bc8e[_0xebba('0x34')]=qs[_0xebba('0x2a')](_[_0xebba('0x35')](_0x1fd387[_0xebba('0x29')],_0x47cd3c[_0xebba('0x2a')]),_0x815f92);if(_0x1fd387[_0xebba('0x29')][_0xebba('0x1a')]){_0x17bc8e[_0xebba('0x34')]=_['merge'](_0x17bc8e[_0xebba('0x34')],{'$or':_[_0xebba('0x1c')](_0x815f92,function(_0x44d555){if(_0x44d555[_0xebba('0x1f')]!==_0xebba('0x36')){var _0x55acff={};_0x55acff[_0x44d555[_0xebba('0x20')]]={'$like':'%'+_0x1fd387[_0xebba('0x29')][_0xebba('0x1a')]+'%'};return _0x55acff;}})});}_0x17bc8e=_['merge']({},_0x17bc8e,_0x1fd387[_0xebba('0x37')]);var _0x57c929={'where':_0x17bc8e[_0xebba('0x34')]};return db[_0xebba('0x25')][_0xebba('0x12')](_0x57c929)['then'](function(_0x308bfc){_0x3f2056['count']=_0x308bfc;if(_0x1fd387['query'][_0xebba('0x38')]){_0x17bc8e['include']=[{'all':!![]}];}return db[_0xebba('0x25')][_0xebba('0x39')](_0x17bc8e);})[_0xebba('0x14')](function(_0x1b416a){_0x3f2056[_0xebba('0x3a')]=_0x1b416a;return _0x3f2056;})[_0xebba('0x14')](respondWithFilteredResult(_0x1ec3db,_0x17bc8e))[_0xebba('0x3b')](handleError(_0x1ec3db,null));};exports[_0xebba('0x3c')]=function(_0x17877f,_0x480128){var _0x18a0fc={'raw':![],'where':{'id':_0x17877f[_0xebba('0x3d')]['id']}},_0x3b1e88={};_0x3b1e88['model']=_[_0xebba('0x28')](db[_0xebba('0x25')][_0xebba('0x3e')]);_0x3b1e88['query']=_[_0xebba('0x28')](_0x17877f[_0xebba('0x29')]);_0x3b1e88[_0xebba('0x2a')]=_['intersection'](_0x3b1e88[_0xebba('0x2c')],_0x3b1e88['query']);_0x18a0fc[_0xebba('0x2d')]=_['intersection'](_0x3b1e88['model'],qs[_0xebba('0x2e')](_0x17877f[_0xebba('0x29')]['fields']));_0x18a0fc[_0xebba('0x2d')]=_0x18a0fc[_0xebba('0x2d')]['length']?_0x18a0fc[_0xebba('0x2d')]:_0x3b1e88[_0xebba('0x2c')];if(_0x17877f[_0xebba('0x29')][_0xebba('0x38')]){_0x18a0fc[_0xebba('0x3f')]=[{'all':!![]}];}_0x18a0fc=_[_0xebba('0x40')]({},_0x18a0fc,_0x17877f[_0xebba('0x37')]);return db['VoiceExtension'][_0xebba('0x41')](_0x18a0fc)[_0xebba('0x14')](handleEntityNotFound(_0x480128,null))['then'](respondWithResult(_0x480128,null))['catch'](handleError(_0x480128,null));};exports[_0xebba('0x21')]=function(_0x346305,_0x566762){return db[_0xebba('0x25')][_0xebba('0x41')]({'where':{'id':_0x346305[_0xebba('0x3d')]['id']}})[_0xebba('0x14')](handleEntityNotFound(_0x566762,null))[_0xebba('0x14')](removeEntity(_0x566762,null))[_0xebba('0x3b')](handleError(_0x566762,null));};exports['create']=function(_0x28eab8,_0x4caf80){if(_0x28eab8[_0xebba('0x42')][_0xebba('0x1f')]==='outbound'&&!_[_0xebba('0x43')](_0x28eab8['body'][_0xebba('0x44')],'_')){_0x28eab8[_0xebba('0x42')][_0xebba('0x44')]='_'[_0xebba('0x45')](_0x28eab8[_0xebba('0x42')]['exten']);}return db[_0xebba('0x25')]['create'](_0x28eab8['body'],{'raw':![]})[_0xebba('0x14')](function(_0x102113){var _0x296cdf=_0x28eab8[_0xebba('0x46')][_0xebba('0x47')]({'plain':!![]});if(!_0x296cdf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x296cdf[_0xebba('0x48')]===_0xebba('0x46')){var _0x35db1e=_0x102113['get']({'plain':!![]});var _0x1a8e19=[{'name':_0xebba('0x15'),'value':'inbound'},{'name':_0xebba('0x49'),'value':_0xebba('0x17')},{'name':_0xebba('0x18'),'value':'internal'}];var _0x1554aa=_[_0xebba('0x41')](_0x1a8e19,[_0xebba('0x1d'),_0x35db1e[_0xebba('0x1f')]])[_0xebba('0x20')];return db['UserProfileSection']['find']({'where':{'name':_0x1554aa,'userProfileId':_0x296cdf[_0xebba('0x4a')]},'raw':!![]})[_0xebba('0x14')](function(_0x74128){if(_0x74128&&_0x74128[_0xebba('0x4b')]===0x0){return db[_0xebba('0x4c')][_0xebba('0x4d')]({'name':_0x35db1e[_0xebba('0x20')],'resourceId':_0x35db1e['id'],'type':_0x74128[_0xebba('0x20')],'sectionId':_0x74128['id']},{})[_0xebba('0x14')](function(){return _0x102113;});}else{return _0x102113;}})[_0xebba('0x3b')](function(_0x37e030){logger['error'](_0xebba('0x4e'),_0x37e030);throw _0x37e030;});}return _0x102113;})['then'](respondWithResult(_0x4caf80,0xc9))['catch'](handleError(_0x4caf80,null));};exports['update']=function(_0x49643e,_0x310148){if(_0x49643e[_0xebba('0x42')]['id']){delete _0x49643e[_0xebba('0x42')]['id'];}return db[_0xebba('0x25')]['find']({'where':{'id':_0x49643e[_0xebba('0x3d')]['id']}})[_0xebba('0x14')](handleEntityNotFound(_0x310148,null))[_0xebba('0x14')](function(_0x448d65){if(_0x448d65){return db[_0xebba('0x25')][_0xebba('0x4f')](_[_0xebba('0x35')](_0x49643e['body'],[_0xebba('0x44'),_0xebba('0x50'),_0xebba('0x51'),'recordingFormat',_0xebba('0x52'),'mandatoryDisposition',_0xebba('0x53')]),{'where':{'context':_0x448d65['context'],'exten':_0x448d65[_0xebba('0x44')]},'individualHooks':!![]})[_0xebba('0x14')](function(_0x3ee6f){return _0x3ee6f;});}return null;})[_0xebba('0x14')](respondWithStatusCode(_0x310148,null))[_0xebba('0x3b')](handleError(_0x310148,null));};exports['addApplications']=function(_0x71e760,_0x397512){var _0x55cdab=_0x71e760['params']['id'];var _0x72728c=_0x71e760['body'];var _0x2af8b5=0xc8;var _0x85b769=null;return db[_0xebba('0x54')]['transaction']({'isolationLevel':db['sequelize'][_0xebba('0x55')][_0xebba('0x56')]['READ_COMMITTED']},function(_0x39c455){return db['VoiceExtension'][_0xebba('0x57')]({'where':{'id':_0x55cdab},'transaction':_0x39c455})[_0xebba('0x14')](function(_0x5877ed){if(_0x5877ed){return db['VoiceExtension'][_0xebba('0x21')]({'where':{'VoiceExtensionId':_0x55cdab},'transaction':_0x39c455})['then'](function(){var _0x325103=_[_0xebba('0x1c')](_0x72728c,function(_0x4aedc3){_0x4aedc3[_0xebba('0x58')]=_0x55cdab;_0x4aedc3[_0xebba('0x59')]=!![];return _0x4aedc3;});return _0x5877ed[_0xebba('0x5a')](_0x325103);})[_0xebba('0x14')](function(_0x51f1b8){return db['VoiceExtension']['bulkCreate'](_0x51f1b8,{'transaction':_0x39c455});});}else{_0x2af8b5=0x194;_0x85b769=[];}});})[_0xebba('0x14')](function(){if(_0x2af8b5!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x55cdab},'order':_0xebba('0x5b')})[_0xebba('0x14')](function(_0x24fc00){_0x85b769=_0x24fc00;});}})[_0xebba('0x3b')](function(_0x633a42){_0x2af8b5=0x1f4;logger[_0xebba('0x5c')](_0x633a42[_0xebba('0x22')]);if(_0x633a42[_0xebba('0x20')]){delete _0x633a42[_0xebba('0x20')];}_0x85b769=_0x633a42;})['finally'](function(){if(_0x85b769===null){_0x397512[_0xebba('0xb')](_0x2af8b5);}else{if(_0x2af8b5===0x1f4){_0x397512['status'](_0x2af8b5)[_0xebba('0x23')](_0x85b769);}else{_0x397512['status'](_0x2af8b5)[_0xebba('0xe')](_0x85b769);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 85b6013..4bee6e0 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 _0x906e=['VoiceExtension','setMaxListeners','save','update','remove','emit','exports'];(function(_0x2dc65e,_0x162d74){var _0x1297d7=function(_0x137c8b){while(--_0x137c8b){_0x2dc65e['push'](_0x2dc65e['shift']());}};_0x1297d7(++_0x162d74);}(_0x906e,0x1ab));var _0xe906=function(_0x54b062,_0x264bb5){_0x54b062=_0x54b062-0x0;var _0x255e41=_0x906e[_0x54b062];return _0x255e41;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0xe906('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xe906('0x1')](0x0);var events={'afterCreate':_0xe906('0x2'),'afterUpdate':_0xe906('0x3'),'afterDestroy':_0xe906('0x4')};function emitEvent(_0x3fae07){return function(_0x21b6c4,_0x30dcc3,_0x3e2eb3){VoiceExtensionEvents[_0xe906('0x5')](_0x3fae07+':'+_0x21b6c4['id'],_0x21b6c4);VoiceExtensionEvents[_0xe906('0x5')](_0x3fae07,_0x21b6c4);_0x3e2eb3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xe906('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0x3516=['VoiceExtension','setMaxListeners','save','remove','emit','hook'];(function(_0x395bf6,_0x116cad){var _0x5edcd7=function(_0x1caa3a){while(--_0x1caa3a){_0x395bf6['push'](_0x395bf6['shift']());}};_0x5edcd7(++_0x116cad);}(_0x3516,0x156));var _0x6351=function(_0x5799e6,_0x197442){_0x5799e6=_0x5799e6-0x0;var _0x139dc0=_0x3516[_0x5799e6];return _0x139dc0;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0x6351('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x6351('0x1')](0x0);var events={'afterCreate':_0x6351('0x2'),'afterUpdate':'update','afterDestroy':_0x6351('0x3')};function emitEvent(_0x5c9069){return function(_0x22b321,_0x1a8d83,_0xbce09c){VoiceExtensionEvents[_0x6351('0x4')](_0x5c9069+':'+_0x22b321['id'],_0x22b321);VoiceExtensionEvents[_0x6351('0x4')](_0x5c9069,_0x22b321);_0xbce09c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x6351('0x5')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index aff27ef..365ad2b 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 _0xaccc=['CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','param','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','Interval','findAll','interval','then','*,*,*,*','intervals','map','IntervalId','toLowerCase','hasOwnProperty','tag','CDR(tag)=','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','length','answer','queue','playback','includes','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','priority','last','define','voice_extensions','get','concat','Hangup','lodash','./voiceExtension.attributes','exports','models','type','CDR(type)=','context','exten','alias','Set','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','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:'];(function(_0x36bf88,_0x15c459){var _0x332914=function(_0x512adf){while(--_0x512adf){_0x36bf88['push'](_0x36bf88['shift']());}};_0x332914(++_0x15c459);}(_0xaccc,0xda));var _0xcacc=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xaccc[_0x24259d];return _0x5a701;};'use strict';var _=require(_0xcacc('0x0'));var attributes=require(_0xcacc('0x1'));module[_0xcacc('0x2')]=function(_0x3f5321){var _0x315a70=_0x3f5321[_0xcacc('0x3')];function _0x4b0142(_0x1afc74){var _0x15fcec=0x2;var _0x1e34bd=[{'type':_0x1afc74[_0xcacc('0x4')],'app':'Set','appdata':_0xcacc('0x5')+_0x1afc74['type'],'context':_0x1afc74[_0xcacc('0x6')],'exten':_0x1afc74[_0xcacc('0x7')],'priority':_0x15fcec++,'VoiceExtensionId':_0x1afc74['id']},{'type':_0x1afc74[_0xcacc('0x4')],'app':_0x1afc74[_0xcacc('0x8')]?_0xcacc('0x9'):_0xcacc('0xa'),'appdata':_0x1afc74[_0xcacc('0x8')]?_0xcacc('0xb')+_0x1afc74[_0xcacc('0x8')]:_0xcacc('0xc'),'context':_0x1afc74[_0xcacc('0x6')],'exten':_0x1afc74[_0xcacc('0x7')],'priority':_0x15fcec++,'VoiceExtensionId':_0x1afc74['id']}];if(_0x1afc74['type']===_0xcacc('0xd')){_0x1e34bd[_0xcacc('0xe')]({'type':'inbound','app':_0xcacc('0x9'),'appdata':_0xcacc('0xf')+_0x1afc74['id'],'context':_0x1afc74[_0xcacc('0x6')],'exten':_0x1afc74[_0xcacc('0x7')],'priority':_0x15fcec++,'VoiceExtensionId':_0x1afc74['id']});}_0x1e34bd['push']({'type':_0x1afc74['type'],'app':_0xcacc('0x9'),'appdata':_0xcacc('0x10'),'context':_0x1afc74['context'],'exten':_0x1afc74[_0xcacc('0x7')],'priority':_0x15fcec++,'VoiceExtensionId':_0x1afc74['id']},{'type':_0x1afc74[_0xcacc('0x4')],'app':_0xcacc('0x9'),'appdata':_0xcacc('0x11'),'context':_0x1afc74['context'],'exten':_0x1afc74['exten'],'priority':_0x15fcec++,'VoiceExtensionId':_0x1afc74['id']},{'type':_0x1afc74[_0xcacc('0x4')],'app':_0xcacc('0x9'),'appdata':_0xcacc('0x12'),'context':_0x1afc74[_0xcacc('0x6')],'exten':_0x1afc74[_0xcacc('0x7')],'priority':_0x15fcec++,'VoiceExtensionId':_0x1afc74['id']});return _0x1e34bd;}function _0x42de68(_0x37a0a8){var _0x1a80f8=0x2;var _0x5a5c41=[{'type':_0xcacc('0x13'),'app':_0xcacc('0x9'),'appdata':_0xcacc('0x14'),'context':_0x37a0a8['context'],'exten':_0x37a0a8[_0xcacc('0x7')],'priority':_0x1a80f8++,'VoiceExtensionId':_0x37a0a8['id']},{'type':_0xcacc('0x13'),'app':_0x37a0a8[_0xcacc('0x8')]?'Set':_0xcacc('0xa'),'appdata':_0x37a0a8[_0xcacc('0x8')]?_0xcacc('0xb')+_0x37a0a8[_0xcacc('0x8')]:_0xcacc('0xc'),'context':_0x37a0a8[_0xcacc('0x6')],'exten':_0x37a0a8[_0xcacc('0x7')],'priority':_0x1a80f8++,'VoiceExtensionId':_0x37a0a8['id']},{'type':_0xcacc('0x13'),'app':_0xcacc('0x9'),'appdata':'CDR(destination)='+(_0x37a0a8[_0xcacc('0x15')]?_0xcacc('0x16')+_0x37a0a8[_0xcacc('0x15')]+'}':_0xcacc('0x17')),'context':_0x37a0a8[_0xcacc('0x6')],'exten':_0x37a0a8['exten'],'priority':_0x1a80f8++,'VoiceExtensionId':_0x37a0a8['id']},{'type':_0xcacc('0x13'),'app':_0xcacc('0x9'),'appdata':_0xcacc('0xf')+_0x37a0a8['id'],'context':_0x37a0a8['context'],'exten':_0x37a0a8[_0xcacc('0x7')],'priority':_0x1a80f8++,'VoiceExtensionId':_0x37a0a8['id']},{'type':_0xcacc('0x13'),'app':_0xcacc('0x18'),'appdata':_0xcacc('0x19')+(_0x1a80f8+0x2)+_0xcacc('0x1a')+(_0x1a80f8+0x1)+')','context':_0x37a0a8['context'],'exten':_0x37a0a8[_0xcacc('0x7')],'priority':_0x1a80f8++,'VoiceExtensionId':_0x37a0a8['id']},{'type':_0xcacc('0x13'),'app':_0xcacc('0x9'),'appdata':_0x37a0a8[_0xcacc('0x15')]?_0xcacc('0x1b')+_0x37a0a8[_0xcacc('0x15')]+'}':_0xcacc('0x1c'),'context':_0x37a0a8[_0xcacc('0x6')],'exten':_0x37a0a8['exten'],'priority':_0x1a80f8++,'VoiceExtensionId':_0x37a0a8['id']},{'type':_0xcacc('0x13'),'app':_0xcacc('0x9'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x37a0a8['context'],'exten':_0x37a0a8[_0xcacc('0x7')],'priority':_0x1a80f8++,'VoiceExtensionId':_0x37a0a8['id']},{'type':_0xcacc('0x13'),'app':_0xcacc('0x9'),'appdata':_0xcacc('0x11'),'context':_0x37a0a8[_0xcacc('0x6')],'exten':_0x37a0a8[_0xcacc('0x7')],'priority':_0x1a80f8++,'VoiceExtensionId':_0x37a0a8['id']},{'type':'outbound','app':_0xcacc('0x9'),'appdata':'MONITOR_OPTIONS=ab','context':_0x37a0a8[_0xcacc('0x6')],'exten':_0x37a0a8[_0xcacc('0x7')],'priority':_0x1a80f8++,'VoiceExtensionId':_0x37a0a8['id']},{'type':_0xcacc('0x13'),'app':'Set','appdata':'outboundrouteid='+_0x37a0a8['id'],'context':_0x37a0a8[_0xcacc('0x6')],'exten':_0x37a0a8[_0xcacc('0x7')],'priority':_0x1a80f8++,'VoiceExtensionId':_0x37a0a8['id']}];if(_0x37a0a8['hasOwnProperty'](_0xcacc('0x1d'))&&_0x37a0a8[_0xcacc('0x1d')]!==_0xcacc('0x1e')){_0x5a5c41['push']({'type':'outbound','app':_0xcacc('0x9'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x37a0a8[_0xcacc('0x6')],'exten':_0x37a0a8[_0xcacc('0x7')],'priority':_0x1a80f8++,'VoiceExtensionId':_0x37a0a8['id']},{'type':_0xcacc('0x13'),'app':_0xcacc('0x9'),'appdata':_0xcacc('0x1f')+_0x37a0a8['recordingFormat']||_0xcacc('0x20'),'context':_0x37a0a8[_0xcacc('0x6')],'exten':_0x37a0a8[_0xcacc('0x7')],'priority':_0x1a80f8++,'VoiceExtensionId':_0x37a0a8['id']});}return _0x5a5c41;}function _0x10e6c9(_0x27f940,_0x4b468a){var _0xc747d7=[{'name':_0xcacc('0x21'),'param':0x0},{'name':_0xcacc('0x22'),'param':0x1},{'name':_0xcacc('0x23'),'param':0x2},{'name':_0xcacc('0x24'),'param':0x3}];var _0x55b152={};var _0x1b5cba=_0x4b468a[_0xcacc('0x25')](',');var _0x499423=[];for(var _0x553b94=0x0;_0x553b94<_0xc747d7['length'];_0x553b94++){switch(_0xc747d7[_0x553b94]['name']){case'trunk':_0x55b152['trunk']=_0x1b5cba[_0xc747d7[_0x553b94][_0xcacc('0x26')]][_0xcacc('0x25')]('/')[0x1];_0x55b152[_0xcacc('0x27')]=_0x1b5cba[_0xc747d7[_0x553b94][_0xcacc('0x26')]][_0xcacc('0x25')]('/')[0x2];_0x55b152[_0xcacc('0x28')]=_0x55b152[_0xcacc('0x27')]?_0x55b152['phone'][_0xcacc('0x25')]('$')[0x0]:undefined;_0x55b152['phone']=_0x27f940[_0xcacc('0x15')]?(_0x55b152[_0xcacc('0x28')]||'')+_0xcacc('0x16')+_0x27f940[_0xcacc('0x15')]+'}':(_0x55b152[_0xcacc('0x28')]||'')+_0xcacc('0x17');_0x499423[_0xc747d7[_0x553b94][_0xcacc('0x26')]]=[_0xcacc('0x29'),_0x55b152[_0xcacc('0x21')],_0x55b152['phone']][_0xcacc('0x2a')]('/');break;case'options':_0x55b152[_0xcacc('0x23')]=_0x1b5cba[_0xc747d7[_0x553b94][_0xcacc('0x26')]];if(_0x27f940['recordingFormat']!=='none'){if(_0x55b152['options'][_0xcacc('0x2b')](_0xcacc('0x2c'))<0x0){_0x55b152[_0xcacc('0x23')]+=_0xcacc('0x2c');}}else{_0x55b152[_0xcacc('0x23')]=_0x55b152['options']['replace'](_0xcacc('0x2c'),'');}_0x499423[_0xc747d7[_0x553b94][_0xcacc('0x26')]]=_0x55b152[_0xcacc('0x23')];break;default:_0x499423[_0xc747d7[_0x553b94][_0xcacc('0x26')]]=_0x1b5cba[_0xc747d7[_0x553b94]['param']];}}return _0x499423[_0xcacc('0x2a')](',');}function _0x16cfc5(_0x1d02a2,_0x1f7a6a,_0x3b96d0){return new Promise(function(_0x4e15fd,_0x46d91b){var _0x54228d=[];if(_['isEmpty'](_0x1f7a6a))return _0x4e15fd(_0x54228d);_0x315a70[_0xcacc('0x2d')][_0xcacc('0x2e')]({'attributes':['id',_0xcacc('0x2f'),'IntervalId'],'raw':!![]})[_0xcacc('0x30')](function(_0x3f7ec5){for(var _0x1bcecf=0x0,_0x810f26=0x0;_0x1bcecf<_0x1f7a6a['length'];_0x1bcecf++,_0x810f26=0x0){var _0x4476f8=_0x1f7a6a[_0x1bcecf];var _0x104e21=[];var _0x196605=[];delete _0x4476f8['id'];if(_0x4476f8['interval']!==_0xcacc('0x31')){_0x4476f8[_0xcacc('0x32')]=[_0x4476f8[_0xcacc('0x2f')]];}else{_0x4476f8[_0xcacc('0x32')]=_0x4476f8['IntervalId']?_[_0xcacc('0x33')](_['filter'](_0x3f7ec5,{'IntervalId':_0x4476f8[_0xcacc('0x34')]}),_0xcacc('0x2f')):[];}_0x4476f8[_0xcacc('0x6')]=_0x1d02a2[_0xcacc('0x6')];_0x4476f8[_0xcacc('0x7')]=_0x1d02a2[_0xcacc('0x7')];if(_0x4476f8[_0xcacc('0x4')])_0x4476f8['type']=_0x4476f8[_0xcacc('0x4')][_0xcacc('0x35')]();if(_0x1d02a2[_0xcacc('0x4')]===_0xcacc('0x13')){if(_0x4476f8[_0xcacc('0x36')](_0xcacc('0x37'))&&_0x4476f8[_0xcacc('0x37')]&&_0x4476f8[_0xcacc('0x37')]!=='--'){_0x104e21[_0xcacc('0xe')]({'type':_0x4476f8[_0xcacc('0x4')]['toLowerCase'](),'app':'Set','appdata':_0xcacc('0x38')+_0x4476f8[_0xcacc('0x37')],'context':_0x1d02a2['context'],'exten':_0x1d02a2[_0xcacc('0x7')],'priority':_0x4476f8[_0xcacc('0x32')]['length']+_0x3b96d0+_0x810f26++,'VoiceExtensionId':_0x1d02a2['id']});}_0x104e21['push']({'type':_0x4476f8[_0xcacc('0x4')][_0xcacc('0x35')](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x4476f8['callerID']?_0xcacc('0x39')+_0x4476f8[_0xcacc('0x3a')]+')':_0xcacc('0x3b')),'context':_0x1d02a2[_0xcacc('0x6')],'exten':_0x1d02a2[_0xcacc('0x7')],'priority':_0x4476f8[_0xcacc('0x32')][_0xcacc('0x3c')]+_0x3b96d0+_0x810f26++,'VoiceExtensionId':_0x1d02a2['id']});}else{if(_0x4476f8[_0xcacc('0x36')](_0xcacc('0x3d'))){if([_0xcacc('0x3e'),_0xcacc('0x3f')][_0xcacc('0x40')](_0x4476f8['app'][_0xcacc('0x35')]())&&_0x4476f8[_0xcacc('0x41')]!==_0xcacc('0x42')){if(_0x4476f8[_0xcacc('0x3d')]){_0x104e21['push']({'type':_0x4476f8[_0xcacc('0x4')]['toLowerCase'](),'app':_0xcacc('0x18'),'appdata':_0xcacc('0x43'),'context':_0x1d02a2[_0xcacc('0x6')],'exten':_0x1d02a2[_0xcacc('0x7')],'priority':_0x4476f8['intervals']['length']+_0x3b96d0+_0x810f26++,'VoiceExtensionId':_0x1d02a2['id']});_0x104e21[_0xcacc('0xe')]({'type':_0x4476f8[_0xcacc('0x4')][_0xcacc('0x35')](),'app':_0xcacc('0x9'),'appdata':_0xcacc('0x44'),'context':_0x1d02a2[_0xcacc('0x6')],'exten':_0x1d02a2[_0xcacc('0x7')],'priority':_0x4476f8[_0xcacc('0x32')]['length']+_0x3b96d0+_0x810f26++,'VoiceExtensionId':_0x1d02a2['id']});}else{_0x104e21['push']({'type':_0x4476f8[_0xcacc('0x4')][_0xcacc('0x35')](),'app':'ExecIf','appdata':_0xcacc('0x45'),'context':_0x1d02a2['context'],'exten':_0x1d02a2[_0xcacc('0x7')],'priority':_0x4476f8[_0xcacc('0x32')][_0xcacc('0x3c')]+_0x3b96d0+_0x810f26++,'VoiceExtensionId':_0x1d02a2['id']});_0x104e21[_0xcacc('0xe')]({'type':_0x4476f8[_0xcacc('0x4')][_0xcacc('0x35')](),'app':_0xcacc('0x9'),'appdata':_0xcacc('0x46'),'context':_0x1d02a2[_0xcacc('0x6')],'exten':_0x1d02a2['exten'],'priority':_0x4476f8['intervals']['length']+_0x3b96d0+_0x810f26++,'VoiceExtensionId':_0x1d02a2['id']});}}}}for(var _0x4fa5e9=0x0;_0x4fa5e9<_0x4476f8[_0xcacc('0x32')][_0xcacc('0x3c')];_0x4fa5e9++){var _0x32e7e0=_0x3b96d0+_0x4476f8[_0xcacc('0x32')][_0xcacc('0x3c')];var _0x56be2b=_0x4fa5e9===_0x4476f8['intervals'][_0xcacc('0x3c')]-0x1?_0x3b96d0+_0x104e21[_0xcacc('0x3c')]+_0x196605['length']+0x2:_0x3b96d0+_0x4fa5e9+0x1;_0x104e21[_0xcacc('0x47')](_0x4fa5e9,0x0,{'type':_0x1d02a2[_0xcacc('0x4')],'app':'GotoIfTime','appdata':_0x4476f8[_0xcacc('0x32')][_0x4fa5e9]+'?'+_0x1d02a2['context']+_0xcacc('0x48')+_0x32e7e0+':'+_0x1d02a2[_0xcacc('0x6')]+_0xcacc('0x48')+_0x56be2b,'exten':_0x1d02a2[_0xcacc('0x7')],'context':_0x1d02a2[_0xcacc('0x6')],'priority':_0x3b96d0+_0x4fa5e9,'VoiceExtensionId':_0x1d02a2['id']});}if(_0x4476f8[_0xcacc('0x41')]===_0xcacc('0x49'))_0x4476f8['appdata']=_0x10e6c9(_0x1d02a2,_0x4476f8[_0xcacc('0x4a')]);_0x4476f8[_0xcacc('0x4b')]=_0x104e21[_0xcacc('0x3c')]?_[_0xcacc('0x4c')](_0x104e21)[_0xcacc('0x4b')]+0x1:_0x3b96d0;_0x54228d=_['concat'](_0x54228d,_0x104e21,[_0x4476f8],_0x196605);_0x3b96d0=_[_0xcacc('0x4c')](_0x54228d)[_0xcacc('0x4b')]+0x1;}return _0x4e15fd(_0x54228d);})['catch'](function(_0x452404){_0x46d91b(_0x452404);});});}return _0x3f5321[_0xcacc('0x4d')]('VoiceExtension',attributes,{'tableName':_0xcacc('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x42a617){var _0x44b243=this[_0xcacc('0x4f')]({'plain':!![]});var _0x279863=_0x44b243[_0xcacc('0x4')]===_0xcacc('0x13')?_0x42de68(_0x44b243):_0x4b0142(_0x44b243);return _0x16cfc5(_0x44b243,_0x42a617,_[_0xcacc('0x4c')](_0x279863)['priority']+0x1)[_0xcacc('0x30')](function(_0x564f28){var _0xc0345e=_[_0xcacc('0x50')](_0x279863,_0x564f28);_0xc0345e['push']({'type':_0x44b243[_0xcacc('0x4')],'app':_0xcacc('0x51'),'exten':_0x44b243[_0xcacc('0x7')],'context':_0x44b243[_0xcacc('0x6')],'priority':_[_0xcacc('0x4c')](_0xc0345e)['priority']+0x1,'VoiceExtensionId':_0x44b243['id']});return _0xc0345e;});}}});}; \ No newline at end of file +var _0xbacb=['appType','outboundDial','appdata','priority','last','catch','define','VoiceExtension','voice_extensions','get','concat','Hangup','lodash','./voiceExtension.attributes','models','Set','CDR(type)=','type','context','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','timeout','options','url','split','length','name','param','prefix','phone','${EXTEN:','${EXTEN}','SIP','trunk','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','IntervalId','then','intervals','map','filter','interval','tag','toLowerCase','CDR(tag)=','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','includes','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','GotoIfTime',',${EXTEN},'];(function(_0x139b75,_0x42154e){var _0x31fb46=function(_0x4244eb){while(--_0x4244eb){_0x139b75['push'](_0x139b75['shift']());}};_0x31fb46(++_0x42154e);}(_0xbacb,0x1a6));var _0xbbac=function(_0x19d271,_0x290d11){_0x19d271=_0x19d271-0x0;var _0x551c16=_0xbacb[_0x19d271];return _0x551c16;};'use strict';var _=require(_0xbbac('0x0'));var attributes=require(_0xbbac('0x1'));module['exports']=function(_0x399452){var _0x27e607=_0x399452[_0xbbac('0x2')];function _0x30e505(_0x3286fe){var _0x97ea61=0x2;var _0x4e3698=[{'type':_0x3286fe['type'],'app':_0xbbac('0x3'),'appdata':_0xbbac('0x4')+_0x3286fe[_0xbbac('0x5')],'context':_0x3286fe[_0xbbac('0x6')],'exten':_0x3286fe['exten'],'priority':_0x97ea61++,'VoiceExtensionId':_0x3286fe['id']},{'type':_0x3286fe[_0xbbac('0x5')],'app':_0x3286fe[_0xbbac('0x7')]?_0xbbac('0x3'):_0xbbac('0x8'),'appdata':_0x3286fe[_0xbbac('0x7')]?_0xbbac('0x9')+_0x3286fe['alias']:_0xbbac('0xa'),'context':_0x3286fe[_0xbbac('0x6')],'exten':_0x3286fe[_0xbbac('0xb')],'priority':_0x97ea61++,'VoiceExtensionId':_0x3286fe['id']}];if(_0x3286fe[_0xbbac('0x5')]===_0xbbac('0xc')){_0x4e3698['push']({'type':'inbound','app':_0xbbac('0x3'),'appdata':_0xbbac('0xd')+_0x3286fe['id'],'context':_0x3286fe[_0xbbac('0x6')],'exten':_0x3286fe['exten'],'priority':_0x97ea61++,'VoiceExtensionId':_0x3286fe['id']});}_0x4e3698[_0xbbac('0xe')]({'type':_0x3286fe['type'],'app':_0xbbac('0x3'),'appdata':_0xbbac('0xf'),'context':_0x3286fe['context'],'exten':_0x3286fe[_0xbbac('0xb')],'priority':_0x97ea61++,'VoiceExtensionId':_0x3286fe['id']},{'type':_0x3286fe[_0xbbac('0x5')],'app':'Set','appdata':_0xbbac('0x10'),'context':_0x3286fe[_0xbbac('0x6')],'exten':_0x3286fe[_0xbbac('0xb')],'priority':_0x97ea61++,'VoiceExtensionId':_0x3286fe['id']},{'type':_0x3286fe[_0xbbac('0x5')],'app':'Set','appdata':_0xbbac('0x11'),'context':_0x3286fe[_0xbbac('0x6')],'exten':_0x3286fe[_0xbbac('0xb')],'priority':_0x97ea61++,'VoiceExtensionId':_0x3286fe['id']});return _0x4e3698;}function _0x31b551(_0xa10fef){var _0x597916=0x2;var _0x5d0c0b=[{'type':_0xbbac('0x12'),'app':_0xbbac('0x3'),'appdata':_0xbbac('0x13'),'context':_0xa10fef['context'],'exten':_0xa10fef['exten'],'priority':_0x597916++,'VoiceExtensionId':_0xa10fef['id']},{'type':_0xbbac('0x12'),'app':_0xa10fef[_0xbbac('0x7')]?_0xbbac('0x3'):_0xbbac('0x8'),'appdata':_0xa10fef[_0xbbac('0x7')]?_0xbbac('0x9')+_0xa10fef[_0xbbac('0x7')]:_0xbbac('0xa'),'context':_0xa10fef[_0xbbac('0x6')],'exten':_0xa10fef['exten'],'priority':_0x597916++,'VoiceExtensionId':_0xa10fef['id']},{'type':_0xbbac('0x12'),'app':'Set','appdata':_0xbbac('0x14')+(_0xa10fef[_0xbbac('0x15')]?'${EXTEN:'+_0xa10fef[_0xbbac('0x15')]+'}':'${EXTEN}'),'context':_0xa10fef[_0xbbac('0x6')],'exten':_0xa10fef[_0xbbac('0xb')],'priority':_0x597916++,'VoiceExtensionId':_0xa10fef['id']},{'type':_0xbbac('0x12'),'app':_0xbbac('0x3'),'appdata':_0xbbac('0xd')+_0xa10fef['id'],'context':_0xa10fef[_0xbbac('0x6')],'exten':_0xa10fef[_0xbbac('0xb')],'priority':_0x597916++,'VoiceExtensionId':_0xa10fef['id']},{'type':'outbound','app':_0xbbac('0x16'),'appdata':_0xbbac('0x17')+(_0x597916+0x2)+_0xbbac('0x18')+(_0x597916+0x1)+')','context':_0xa10fef[_0xbbac('0x6')],'exten':_0xa10fef['exten'],'priority':_0x597916++,'VoiceExtensionId':_0xa10fef['id']},{'type':_0xbbac('0x12'),'app':_0xbbac('0x3'),'appdata':_0xa10fef[_0xbbac('0x15')]?_0xbbac('0x19')+_0xa10fef[_0xbbac('0x15')]+'}':'CDR(prefix)=noprefix','context':_0xa10fef[_0xbbac('0x6')],'exten':_0xa10fef[_0xbbac('0xb')],'priority':_0x597916++,'VoiceExtensionId':_0xa10fef['id']},{'type':'outbound','app':'Set','appdata':_0xbbac('0xf'),'context':_0xa10fef[_0xbbac('0x6')],'exten':_0xa10fef[_0xbbac('0xb')],'priority':_0x597916++,'VoiceExtensionId':_0xa10fef['id']},{'type':_0xbbac('0x12'),'app':_0xbbac('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0xa10fef[_0xbbac('0x6')],'exten':_0xa10fef[_0xbbac('0xb')],'priority':_0x597916++,'VoiceExtensionId':_0xa10fef['id']},{'type':_0xbbac('0x12'),'app':_0xbbac('0x3'),'appdata':_0xbbac('0x11'),'context':_0xa10fef[_0xbbac('0x6')],'exten':_0xa10fef['exten'],'priority':_0x597916++,'VoiceExtensionId':_0xa10fef['id']},{'type':'outbound','app':_0xbbac('0x3'),'appdata':_0xbbac('0x1a')+_0xa10fef['id'],'context':_0xa10fef['context'],'exten':_0xa10fef[_0xbbac('0xb')],'priority':_0x597916++,'VoiceExtensionId':_0xa10fef['id']}];if(_0xa10fef[_0xbbac('0x1b')]('recordingFormat')&&_0xa10fef[_0xbbac('0x1c')]!==_0xbbac('0x1d')){_0x5d0c0b[_0xbbac('0xe')]({'type':'outbound','app':_0xbbac('0x3'),'appdata':_0xbbac('0x1e'),'context':_0xa10fef[_0xbbac('0x6')],'exten':_0xa10fef['exten'],'priority':_0x597916++,'VoiceExtensionId':_0xa10fef['id']},{'type':_0xbbac('0x12'),'app':_0xbbac('0x3'),'appdata':_0xbbac('0x1f')+_0xa10fef['recordingFormat']||'wav','context':_0xa10fef['context'],'exten':_0xa10fef[_0xbbac('0xb')],'priority':_0x597916++,'VoiceExtensionId':_0xa10fef['id']});}return _0x5d0c0b;}function _0x18a5d9(_0x145bf6,_0x1682d4){var _0x496a4b=[{'name':'trunk','param':0x0},{'name':_0xbbac('0x20'),'param':0x1},{'name':_0xbbac('0x21'),'param':0x2},{'name':_0xbbac('0x22'),'param':0x3}];var _0x5c15eb={};var _0xd20706=_0x1682d4[_0xbbac('0x23')](',');var _0x295f30=[];for(var _0x48c379=0x0;_0x48c379<_0x496a4b[_0xbbac('0x24')];_0x48c379++){switch(_0x496a4b[_0x48c379][_0xbbac('0x25')]){case'trunk':_0x5c15eb['trunk']=_0xd20706[_0x496a4b[_0x48c379][_0xbbac('0x26')]]['split']('/')[0x1];_0x5c15eb['phone']=_0xd20706[_0x496a4b[_0x48c379]['param']][_0xbbac('0x23')]('/')[0x2];_0x5c15eb[_0xbbac('0x27')]=_0x5c15eb['phone']?_0x5c15eb[_0xbbac('0x28')][_0xbbac('0x23')]('$')[0x0]:undefined;_0x5c15eb[_0xbbac('0x28')]=_0x145bf6[_0xbbac('0x15')]?(_0x5c15eb[_0xbbac('0x27')]||'')+_0xbbac('0x29')+_0x145bf6[_0xbbac('0x15')]+'}':(_0x5c15eb[_0xbbac('0x27')]||'')+_0xbbac('0x2a');_0x295f30[_0x496a4b[_0x48c379][_0xbbac('0x26')]]=[_0xbbac('0x2b'),_0x5c15eb[_0xbbac('0x2c')],_0x5c15eb[_0xbbac('0x28')]][_0xbbac('0x2d')]('/');break;case _0xbbac('0x21'):_0x5c15eb[_0xbbac('0x21')]=_0xd20706[_0x496a4b[_0x48c379][_0xbbac('0x26')]];if(_0x145bf6[_0xbbac('0x1c')]!=='none'){if(_0x5c15eb['options'][_0xbbac('0x2e')]('U(xcally-mixmonitor-context)')<0x0){_0x5c15eb[_0xbbac('0x21')]+=_0xbbac('0x2f');}}else{_0x5c15eb[_0xbbac('0x21')]=_0x5c15eb['options'][_0xbbac('0x30')](_0xbbac('0x2f'),'');}_0x295f30[_0x496a4b[_0x48c379][_0xbbac('0x26')]]=_0x5c15eb[_0xbbac('0x21')];break;default:_0x295f30[_0x496a4b[_0x48c379][_0xbbac('0x26')]]=_0xd20706[_0x496a4b[_0x48c379][_0xbbac('0x26')]];}}return _0x295f30[_0xbbac('0x2d')](',');}function _0x1a7651(_0x40630b,_0x263f7b,_0x479325){return new Promise(function(_0x569344,_0x1f65ee){var _0x52eb48=[];if(_[_0xbbac('0x31')](_0x263f7b))return _0x569344(_0x52eb48);_0x27e607[_0xbbac('0x32')][_0xbbac('0x33')]({'attributes':['id','interval',_0xbbac('0x34')],'raw':!![]})[_0xbbac('0x35')](function(_0x4c50c5){for(var _0x24c36e=0x0,_0x58fc6b=0x0;_0x24c36e<_0x263f7b[_0xbbac('0x24')];_0x24c36e++,_0x58fc6b=0x0){var _0x74b30b=_0x263f7b[_0x24c36e];var _0x315f97=[];var _0x33332a=[];delete _0x74b30b['id'];if(_0x74b30b['interval']!=='*,*,*,*'){_0x74b30b[_0xbbac('0x36')]=[_0x74b30b['interval']];}else{_0x74b30b[_0xbbac('0x36')]=_0x74b30b['IntervalId']?_[_0xbbac('0x37')](_[_0xbbac('0x38')](_0x4c50c5,{'IntervalId':_0x74b30b[_0xbbac('0x34')]}),_0xbbac('0x39')):[];}_0x74b30b[_0xbbac('0x6')]=_0x40630b['context'];_0x74b30b[_0xbbac('0xb')]=_0x40630b[_0xbbac('0xb')];if(_0x74b30b[_0xbbac('0x5')])_0x74b30b['type']=_0x74b30b[_0xbbac('0x5')]['toLowerCase']();if(_0x40630b['type']==='outbound'){if(_0x74b30b[_0xbbac('0x1b')](_0xbbac('0x3a'))&&_0x74b30b[_0xbbac('0x3a')]&&_0x74b30b[_0xbbac('0x3a')]!=='--'){_0x315f97['push']({'type':_0x74b30b[_0xbbac('0x5')][_0xbbac('0x3b')](),'app':'Set','appdata':_0xbbac('0x3c')+_0x74b30b[_0xbbac('0x3a')],'context':_0x40630b['context'],'exten':_0x40630b[_0xbbac('0xb')],'priority':_0x74b30b['intervals'][_0xbbac('0x24')]+_0x479325+_0x58fc6b++,'VoiceExtensionId':_0x40630b['id']});}_0x315f97['push']({'type':_0x74b30b[_0xbbac('0x5')][_0xbbac('0x3b')](),'app':_0xbbac('0x16'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x74b30b[_0xbbac('0x3d')]?_0xbbac('0x3e')+_0x74b30b[_0xbbac('0x3d')]+')':_0xbbac('0x3f')),'context':_0x40630b['context'],'exten':_0x40630b['exten'],'priority':_0x74b30b[_0xbbac('0x36')][_0xbbac('0x24')]+_0x479325+_0x58fc6b++,'VoiceExtensionId':_0x40630b['id']});}else{if(_0x74b30b['hasOwnProperty'](_0xbbac('0x40'))){if(['queue','playback'][_0xbbac('0x41')](_0x74b30b['app']['toLowerCase']())&&_0x74b30b['appType']!=='custom'){if(_0x74b30b[_0xbbac('0x40')]){_0x315f97[_0xbbac('0xe')]({'type':_0x74b30b[_0xbbac('0x5')]['toLowerCase'](),'app':_0xbbac('0x16'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x40630b[_0xbbac('0x6')],'exten':_0x40630b['exten'],'priority':_0x74b30b['intervals']['length']+_0x479325+_0x58fc6b++,'VoiceExtensionId':_0x40630b['id']});_0x315f97['push']({'type':_0x74b30b[_0xbbac('0x5')][_0xbbac('0x3b')](),'app':_0xbbac('0x3'),'appdata':_0xbbac('0x42'),'context':_0x40630b[_0xbbac('0x6')],'exten':_0x40630b['exten'],'priority':_0x74b30b[_0xbbac('0x36')][_0xbbac('0x24')]+_0x479325+_0x58fc6b++,'VoiceExtensionId':_0x40630b['id']});}else{_0x315f97[_0xbbac('0xe')]({'type':_0x74b30b[_0xbbac('0x5')][_0xbbac('0x3b')](),'app':_0xbbac('0x16'),'appdata':_0xbbac('0x43'),'context':_0x40630b['context'],'exten':_0x40630b['exten'],'priority':_0x74b30b['intervals'][_0xbbac('0x24')]+_0x479325+_0x58fc6b++,'VoiceExtensionId':_0x40630b['id']});_0x315f97[_0xbbac('0xe')]({'type':_0x74b30b[_0xbbac('0x5')]['toLowerCase'](),'app':_0xbbac('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x40630b[_0xbbac('0x6')],'exten':_0x40630b[_0xbbac('0xb')],'priority':_0x74b30b[_0xbbac('0x36')][_0xbbac('0x24')]+_0x479325+_0x58fc6b++,'VoiceExtensionId':_0x40630b['id']});}}}}for(var _0x1459c3=0x0;_0x1459c3<_0x74b30b[_0xbbac('0x36')][_0xbbac('0x24')];_0x1459c3++){var _0x5dc65a=_0x479325+_0x74b30b[_0xbbac('0x36')]['length'];var _0x5c2523=_0x1459c3===_0x74b30b[_0xbbac('0x36')]['length']-0x1?_0x479325+_0x315f97['length']+_0x33332a[_0xbbac('0x24')]+0x2:_0x479325+_0x1459c3+0x1;_0x315f97['splice'](_0x1459c3,0x0,{'type':_0x40630b[_0xbbac('0x5')],'app':_0xbbac('0x44'),'appdata':_0x74b30b[_0xbbac('0x36')][_0x1459c3]+'?'+_0x40630b[_0xbbac('0x6')]+_0xbbac('0x45')+_0x5dc65a+':'+_0x40630b[_0xbbac('0x6')]+_0xbbac('0x45')+_0x5c2523,'exten':_0x40630b[_0xbbac('0xb')],'context':_0x40630b[_0xbbac('0x6')],'priority':_0x479325+_0x1459c3,'VoiceExtensionId':_0x40630b['id']});}if(_0x74b30b[_0xbbac('0x46')]===_0xbbac('0x47'))_0x74b30b[_0xbbac('0x48')]=_0x18a5d9(_0x40630b,_0x74b30b['appdata']);_0x74b30b[_0xbbac('0x49')]=_0x315f97[_0xbbac('0x24')]?_[_0xbbac('0x4a')](_0x315f97)[_0xbbac('0x49')]+0x1:_0x479325;_0x52eb48=_['concat'](_0x52eb48,_0x315f97,[_0x74b30b],_0x33332a);_0x479325=_['last'](_0x52eb48)[_0xbbac('0x49')]+0x1;}return _0x569344(_0x52eb48);})[_0xbbac('0x4b')](function(_0x5c942a){_0x1f65ee(_0x5c942a);});});}return _0x399452[_0xbbac('0x4c')](_0xbbac('0x4d'),attributes,{'tableName':_0xbbac('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xf48849){var _0x56b7e2=this[_0xbbac('0x4f')]({'plain':!![]});var _0x133d35=_0x56b7e2[_0xbbac('0x5')]==='outbound'?_0x31b551(_0x56b7e2):_0x30e505(_0x56b7e2);return _0x1a7651(_0x56b7e2,_0xf48849,_[_0xbbac('0x4a')](_0x133d35)[_0xbbac('0x49')]+0x1)['then'](function(_0x9a5ff9){var _0x99248a=_[_0xbbac('0x50')](_0x133d35,_0x9a5ff9);_0x99248a[_0xbbac('0xe')]({'type':_0x56b7e2['type'],'app':_0xbbac('0x51'),'exten':_0x56b7e2[_0xbbac('0xb')],'context':_0x56b7e2[_0xbbac('0x6')],'priority':_[_0xbbac('0x4a')](_0x99248a)[_0xbbac('0x49')]+0x1,'VoiceExtensionId':_0x56b7e2['id']});return _0x99248a;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 76ab1dd..b9dfdbe 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 _0xd67b=['include','model','map','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit'];(function(_0x3b1e04,_0x1b7b69){var _0x4b6fa0=function(_0x27c273){while(--_0x27c273){_0x3b1e04['push'](_0x3b1e04['shift']());}};_0x4b6fa0(++_0x1b7b69);}(_0xd67b,0x133));var _0xbd67=function(_0x2854d0,_0x8f7f6c){_0x2854d0=_0x2854d0-0x0;var _0x67d233=_0xd67b[_0x2854d0];return _0x67d233;};'use strict';var _=require('lodash');var util=require(_0xbd67('0x0'));var moment=require('moment');var BPromise=require(_0xbd67('0x1'));var rs=require(_0xbd67('0x2'));var fs=require('fs');var Redis=require(_0xbd67('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd67('0x4'));var logger=require('../../config/logger')(_0xbd67('0x5'));var config=require('../../config/environment');var jayson=require(_0xbd67('0x6'));var client=jayson[_0xbd67('0x7')][_0xbd67('0x8')]({'port':0x232a});config[_0xbd67('0x9')]=_[_0xbd67('0xa')](config[_0xbd67('0x9')],{'host':_0xbd67('0xb'),'port':0x18eb});var socket=require(_0xbd67('0xc'))(new Redis(config[_0xbd67('0x9')]));require(_0xbd67('0xd'))[_0xbd67('0xe')](socket);function respondWithRpcPromise(_0x3a7f43,_0x283f2f,_0x52b981){return new BPromise(function(_0x54954b,_0x208920){return client['request'](_0x3a7f43,_0x52b981)[_0xbd67('0xf')](function(_0xb6b4b5){logger[_0xbd67('0x10')](_0xbd67('0x11'),_0x283f2f,_0xbd67('0x12'));logger[_0xbd67('0x13')](_0xbd67('0x14'),_0x283f2f,_0xbd67('0x12'),JSON[_0xbd67('0x15')](_0xb6b4b5));if(_0xb6b4b5[_0xbd67('0x16')]){if(_0xb6b4b5['error'][_0xbd67('0x17')]===0x1f4){logger[_0xbd67('0x16')](_0xbd67('0x11'),_0x283f2f,_0xb6b4b5[_0xbd67('0x16')][_0xbd67('0x18')]);return _0x208920(_0xb6b4b5[_0xbd67('0x16')][_0xbd67('0x18')]);}logger[_0xbd67('0x16')](_0xbd67('0x11'),_0x283f2f,_0xb6b4b5[_0xbd67('0x16')]['message']);return _0x54954b(_0xb6b4b5['error'][_0xbd67('0x18')]);}else{logger[_0xbd67('0x10')](_0xbd67('0x11'),_0x283f2f,'request\x20sent');_0x54954b(_0xb6b4b5[_0xbd67('0x19')][_0xbd67('0x18')]);}})[_0xbd67('0x1a')](function(_0x4b764f){logger[_0xbd67('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x283f2f,_0x4b764f);_0x208920(_0x4b764f);});});}exports[_0xbd67('0x1b')]=function(_0x4609b7){var _0xb3f67f=this;return new Promise(function(_0x5e42c7,_0x3c4102){return db[_0xbd67('0x1c')][_0xbd67('0x1d')]({'raw':_0x4609b7[_0xbd67('0x1e')]?_0x4609b7[_0xbd67('0x1e')][_0xbd67('0x1f')]===undefined?!![]:![]:!![],'where':_0x4609b7['options']?_0x4609b7[_0xbd67('0x1e')][_0xbd67('0x20')]||null:null,'attributes':_0x4609b7[_0xbd67('0x1e')]?_0x4609b7[_0xbd67('0x1e')][_0xbd67('0x21')]||null:null,'limit':_0x4609b7[_0xbd67('0x1e')]?_0x4609b7[_0xbd67('0x1e')][_0xbd67('0x22')]||null:null,'include':_0x4609b7[_0xbd67('0x1e')]?_0x4609b7[_0xbd67('0x1e')][_0xbd67('0x23')]?_['map'](_0x4609b7[_0xbd67('0x1e')]['include'],function(_0x25bf7a){return{'model':db[_0x25bf7a[_0xbd67('0x24')]],'as':_0x25bf7a['as'],'attributes':_0x25bf7a[_0xbd67('0x21')],'include':_0x25bf7a['include']?_[_0xbd67('0x25')](_0x25bf7a[_0xbd67('0x23')],function(_0x4dfa19){return{'model':db[_0x4dfa19[_0xbd67('0x24')]],'as':_0x4dfa19['as'],'attributes':_0x4dfa19[_0xbd67('0x21')],'include':_0x4dfa19[_0xbd67('0x23')]?_[_0xbd67('0x25')](_0x4dfa19[_0xbd67('0x23')],function(_0x55c2d4){return{'model':db[_0x55c2d4['model']],'as':_0x55c2d4['as'],'attributes':_0x55c2d4[_0xbd67('0x21')]};}):[]};}):[]};}):[]:[]})[_0xbd67('0xf')](function(_0x4675ac){logger[_0xbd67('0x10')](_0xbd67('0x1b'),_0x4609b7);logger[_0xbd67('0x13')](_0xbd67('0x1b'),_0x4609b7,JSON[_0xbd67('0x15')](_0x4675ac));_0x5e42c7(_0x4675ac);})[_0xbd67('0x1a')](function(_0x34e5a8){logger['error']('GetVoiceExtension',_0x34e5a8[_0xbd67('0x18')],_0x4609b7);_0x3c4102(_0xb3f67f[_0xbd67('0x16')](0x1f4,_0x34e5a8[_0xbd67('0x18')]));});});}; \ No newline at end of file +var _0xcddb=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetVoiceExtension','VoiceExtension','options','raw','where','attributes','include','map','model','lodash','util','moment'];(function(_0x11a962,_0x3cc338){var _0x55d423=function(_0xf4b236){while(--_0xf4b236){_0x11a962['push'](_0x11a962['shift']());}};_0x55d423(++_0x3cc338);}(_0xcddb,0x1c4));var _0xbcdd=function(_0x1b9191,_0x56990d){_0x1b9191=_0x1b9191-0x0;var _0x2621a7=_0xcddb[_0x1b9191];return _0x2621a7;};'use strict';var _=require(_0xbcdd('0x0'));var util=require(_0xbcdd('0x1'));var moment=require(_0xbcdd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbcdd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbcdd('0x4'));var logger=require(_0xbcdd('0x5'))(_0xbcdd('0x6'));var config=require(_0xbcdd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbcdd('0x8')]['http']({'port':0x232a});config[_0xbcdd('0x9')]=_[_0xbcdd('0xa')](config['redis'],{'host':_0xbcdd('0xb'),'port':0x18eb});var socket=require(_0xbcdd('0xc'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0xbcdd('0xd')](socket);function respondWithRpcPromise(_0x276423,_0xc35a10,_0x4d3060){return new BPromise(function(_0xbe49f,_0x434c14){return client[_0xbcdd('0xe')](_0x276423,_0x4d3060)[_0xbcdd('0xf')](function(_0x50a271){logger[_0xbcdd('0x10')](_0xbcdd('0x11'),_0xc35a10,'request\x20sent');logger[_0xbcdd('0x12')](_0xbcdd('0x13'),_0xc35a10,'request\x20sent',JSON[_0xbcdd('0x14')](_0x50a271));if(_0x50a271[_0xbcdd('0x15')]){if(_0x50a271['error']['code']===0x1f4){logger[_0xbcdd('0x15')](_0xbcdd('0x11'),_0xc35a10,_0x50a271[_0xbcdd('0x15')][_0xbcdd('0x16')]);return _0x434c14(_0x50a271[_0xbcdd('0x15')]['message']);}logger[_0xbcdd('0x15')](_0xbcdd('0x11'),_0xc35a10,_0x50a271['error'][_0xbcdd('0x16')]);return _0xbe49f(_0x50a271['error'][_0xbcdd('0x16')]);}else{logger[_0xbcdd('0x10')](_0xbcdd('0x11'),_0xc35a10,_0xbcdd('0x17'));_0xbe49f(_0x50a271[_0xbcdd('0x18')][_0xbcdd('0x16')]);}})[_0xbcdd('0x19')](function(_0x33f1fb){logger[_0xbcdd('0x15')]('VoiceExtension,\x20%s,\x20%s',_0xc35a10,_0x33f1fb);_0x434c14(_0x33f1fb);});});}exports[_0xbcdd('0x1a')]=function(_0x3396bb){var _0x1d165b=this;return new Promise(function(_0x1477f1,_0x45ae83){return db[_0xbcdd('0x1b')]['findAll']({'raw':_0x3396bb[_0xbcdd('0x1c')]?_0x3396bb['options'][_0xbcdd('0x1d')]===undefined?!![]:![]:!![],'where':_0x3396bb[_0xbcdd('0x1c')]?_0x3396bb[_0xbcdd('0x1c')][_0xbcdd('0x1e')]||null:null,'attributes':_0x3396bb['options']?_0x3396bb[_0xbcdd('0x1c')][_0xbcdd('0x1f')]||null:null,'limit':_0x3396bb[_0xbcdd('0x1c')]?_0x3396bb[_0xbcdd('0x1c')]['limit']||null:null,'include':_0x3396bb[_0xbcdd('0x1c')]?_0x3396bb[_0xbcdd('0x1c')][_0xbcdd('0x20')]?_[_0xbcdd('0x21')](_0x3396bb[_0xbcdd('0x1c')]['include'],function(_0x1f334d){return{'model':db[_0x1f334d[_0xbcdd('0x22')]],'as':_0x1f334d['as'],'attributes':_0x1f334d[_0xbcdd('0x1f')],'include':_0x1f334d[_0xbcdd('0x20')]?_[_0xbcdd('0x21')](_0x1f334d['include'],function(_0x340fc0){return{'model':db[_0x340fc0[_0xbcdd('0x22')]],'as':_0x340fc0['as'],'attributes':_0x340fc0['attributes'],'include':_0x340fc0[_0xbcdd('0x20')]?_[_0xbcdd('0x21')](_0x340fc0[_0xbcdd('0x20')],function(_0x18b13b){return{'model':db[_0x18b13b[_0xbcdd('0x22')]],'as':_0x18b13b['as'],'attributes':_0x18b13b['attributes']};}):[]};}):[]};}):[]:[]})[_0xbcdd('0xf')](function(_0x485696){logger['info'](_0xbcdd('0x1a'),_0x3396bb);logger[_0xbcdd('0x12')]('GetVoiceExtension',_0x3396bb,JSON[_0xbcdd('0x14')](_0x485696));_0x1477f1(_0x485696);})[_0xbcdd('0x19')](function(_0x3cdcb3){logger[_0xbcdd('0x15')](_0xbcdd('0x1a'),_0x3cdcb3[_0xbcdd('0x16')],_0x3396bb);_0x45ae83(_0x1d165b[_0xbcdd('0x15')](0x1f4,_0x3cdcb3[_0xbcdd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 8efc4c2..82d3084 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 _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0x4390e6,_0x80dbce){var _0x30e4c7=function(_0xf84cab){while(--_0xf84cab){_0x4390e6['push'](_0x4390e6['shift']());}};_0x30e4c7(++_0x80dbce);}(_0x0295,0x1f0));var _0x5029=function(_0x4688f3,_0x1d5a1a){_0x4688f3=_0x4688f3-0x0;var _0x470c84=_0x0295[_0x4688f3];return _0x470c84;};'use strict';var VoiceExtensionEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){VoiceExtensionEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);VoiceExtensionEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file +var _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0x168e9c,_0x3c636a){var _0x482040=function(_0x1cd1a7){while(--_0x1cd1a7){_0x168e9c['push'](_0x168e9c['shift']());}};_0x482040(++_0x3c636a);}(_0x0295,0x1f0));var _0x5029=function(_0x70a4e2,_0x1b833a){_0x70a4e2=_0x70a4e2-0x0;var _0x4d1d1e=_0x0295[_0x70a4e2];return _0x4d1d1e;};'use strict';var VoiceExtensionEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){VoiceExtensionEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);VoiceExtensionEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 28474a4..81fcb31 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 _0xeda8=['show','/:id/messages','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index'];(function(_0x5bc2b6,_0x264fd9){var _0x526798=function(_0x5238d9){while(--_0x5238d9){_0x5bc2b6['push'](_0x5bc2b6['shift']());}};_0x526798(++_0x264fd9);}(_0xeda8,0x104));var _0x8eda=function(_0x498dc1,_0x2a65fc){_0x498dc1=_0x498dc1-0x0;var _0x2f58e9=_0xeda8[_0x498dc1];return _0x2f58e9;};'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')]('/:id',auth[_0x8eda('0xb')](),controller[_0x8eda('0xd')]);router[_0x8eda('0xa')](_0x8eda('0xe'),auth['isAuthenticated'](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller[_0x8eda('0xf')]);router[_0x8eda('0x10')](_0x8eda('0x11'),auth['isAuthenticated'](),controller[_0x8eda('0x12')]);router['delete'](_0x8eda('0x11'),auth[_0x8eda('0xb')](),controller[_0x8eda('0x13')]);module[_0x8eda('0x14')]=router; \ No newline at end of file +var _0xe5af=['show','create','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/:id'];(function(_0x5d4dad,_0x35ba14){var _0x4cd95c=function(_0x1f263e){while(--_0x1f263e){_0x5d4dad['push'](_0x5d4dad['shift']());}};_0x4cd95c(++_0x35ba14);}(_0xe5af,0x9c));var _0xfe5a=function(_0x30e783,_0x3302fc){_0x30e783=_0x30e783-0x0;var _0xc5abb0=_0xe5af[_0x30e783];return _0xc5abb0;};'use strict';var multer=require('multer');var util=require(_0xfe5a('0x0'));var path=require(_0xfe5a('0x1'));var timeout=require('connect-timeout');var express=require(_0xfe5a('0x2'));var router=express[_0xfe5a('0x3')]();var fs_extra=require(_0xfe5a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfe5a('0x5'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router[_0xfe5a('0x6')]('/',auth[_0xfe5a('0x7')](),controller['index']);router['get'](_0xfe5a('0x8'),auth[_0xfe5a('0x7')](),controller[_0xfe5a('0x9')]);router[_0xfe5a('0x6')]('/:id/messages',auth[_0xfe5a('0x7')](),controller['getMessages']);router['post']('/',auth[_0xfe5a('0x7')](),controller[_0xfe5a('0xa')]);router['put'](_0xfe5a('0x8'),auth[_0xfe5a('0x7')](),controller[_0xfe5a('0xb')]);router[_0xfe5a('0xc')](_0xfe5a('0x8'),auth['isAuthenticated'](),controller[_0xfe5a('0xd')]);module[_0xfe5a('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 6cd44c8..5960469 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 _0xadb1=['STRING','from-voicemail','contest_mailbox','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','exports'];(function(_0x29a6f2,_0x528543){var _0x122345=function(_0xc76d13){while(--_0xc76d13){_0x29a6f2['push'](_0x29a6f2['shift']());}};_0x122345(++_0x528543);}(_0xadb1,0x1b9));var _0x1adb=function(_0x53c7a6,_0x545d8d){_0x53c7a6=_0x53c7a6-0x0;var _0x88305c=_0xadb1[_0x53c7a6];return _0x88305c;};'use strict';var Sequelize=require('sequelize');module[_0x1adb('0x0')]={'customer_id':{'type':Sequelize[_0x1adb('0x1')]},'context':{'type':Sequelize[_0x1adb('0x1')],'defaultValue':_0x1adb('0x2'),'unique':_0x1adb('0x3')},'mailbox':{'type':Sequelize[_0x1adb('0x1')],'defaultValue':'','allowNull':![],'unique':_0x1adb('0x3')},'password':{'type':Sequelize[_0x1adb('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x348061){this['setDataValue']('email',typeof _0x348061===_0x1adb('0x4')&&_0x348061['trim']()?_0x348061[_0x1adb('0x5')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x1adb('0x1')],'defaultValue':_0x1adb('0x6')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x1adb('0x7')](_0x1adb('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x1adb('0x1')]},'callback':{'type':Sequelize[_0x1adb('0x1')]},'review':{'type':Sequelize['ENUM'](_0x1adb('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x1adb('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x1adb('0x7')](_0x1adb('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x1adb('0x7')](_0x1adb('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x1adb('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x1adb('0x7')](_0x1adb('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x1adb('0x7')](_0x1adb('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x1adb('0x7')](_0x1adb('0x8'),'no'),'defaultValue':_0x1adb('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x1adb('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x1adb('0x7')](_0x1adb('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x1adb('0x7')](_0x1adb('0x8'),'no'),'defaultValue':_0x1adb('0x8'),'allowNull':![]},'stamp':{'type':_0x1adb('0xa')},'emailsubject':{'type':Sequelize[_0x1adb('0x1')]},'emailbody':{'type':Sequelize[_0x1adb('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x1adb('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x1adb('0xc')],'get':function(){return this['getDataValue'](_0x1adb('0xd'))+_0x1adb('0xe')+this[_0x1adb('0xf')](_0x1adb('0x10'));}}}; \ No newline at end of file +var _0xd248=['yes','ENUM','TINYINT(4)','getDataValue','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central'];(function(_0x4fed38,_0x2d66e8){var _0x4819cd=function(_0x37f4fd){while(--_0x37f4fd){_0x4fed38['push'](_0x4fed38['shift']());}};_0x4819cd(++_0x2d66e8);}(_0xd248,0x1b9));var _0x8d24=function(_0x258c1b,_0x512728){_0x258c1b=_0x258c1b-0x0;var _0x25a846=_0xd248[_0x258c1b];return _0x25a846;};'use strict';var Sequelize=require(_0x8d24('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x8d24('0x1')]},'context':{'type':Sequelize[_0x8d24('0x1')],'defaultValue':_0x8d24('0x2'),'unique':_0x8d24('0x3')},'mailbox':{'type':Sequelize[_0x8d24('0x1')],'defaultValue':'','allowNull':![],'unique':_0x8d24('0x3')},'password':{'type':Sequelize[_0x8d24('0x1')]},'fullname':{'type':Sequelize[_0x8d24('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x52f226){this[_0x8d24('0x4')](_0x8d24('0x5'),typeof _0x52f226===_0x8d24('0x6')&&_0x52f226[_0x8d24('0x7')]()?_0x52f226['trim']():null);}},'pager':{'type':Sequelize[_0x8d24('0x1')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x8d24('0x8')},'attach':{'type':Sequelize['ENUM'](_0x8d24('0x9'),'no'),'defaultValue':_0x8d24('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x8d24('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x8d24('0x1')]},'review':{'type':Sequelize[_0x8d24('0xa')](_0x8d24('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8d24('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x8d24('0xa')](_0x8d24('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x8d24('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x8d24('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x8d24('0xa')](_0x8d24('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x8d24('0xa')](_0x8d24('0x9'),'no'),'defaultValue':_0x8d24('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x8d24('0xa')](_0x8d24('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x8d24('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x8d24('0x9'),'no'),'defaultValue':_0x8d24('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x8d24('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x8d24('0xc')]('fullname')+_0x8d24('0xd')+this[_0x8d24('0xc')](_0x8d24('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index e2c1366..73df5df 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 _0x44a3=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','index','map','VoiceMail','fieldName','type','key','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','getMessages','findOne','params','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','desk.js','querystring'];(function(_0x526f0b,_0x50c719){var _0x30fd93=function(_0x1ff33e){while(--_0x1ff33e){_0x526f0b['push'](_0x526f0b['shift']());}};_0x30fd93(++_0x50c719);}(_0x44a3,0x1a9));var _0x344a=function(_0x9a3d47,_0x1953a0){_0x9a3d47=_0x9a3d47-0x0;var _0xf60b78=_0x44a3[_0x9a3d47];return _0xf60b78;};'use strict';var emlformat=require(_0x344a('0x0'));var rimraf=require(_0x344a('0x1'));var zipdir=require(_0x344a('0x2'));var jsonpatch=require(_0x344a('0x3'));var rp=require(_0x344a('0x4'));var moment=require(_0x344a('0x5'));var BPromise=require(_0x344a('0x6'));var Mustache=require(_0x344a('0x7'));var util=require('util');var path=require(_0x344a('0x8'));var sox=require(_0x344a('0x9'));var csv=require(_0x344a('0xa'));var ejs=require(_0x344a('0xb'));var fs=require('fs');var fs_extra=require(_0x344a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x344a('0xd'));var toCsv=require(_0x344a('0xa'));var querystring=require(_0x344a('0xe'));var Papa=require(_0x344a('0xf'));var Redis=require(_0x344a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x344a('0x11'));var as=require(_0x344a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x344a('0x13'))('api');var utils=require(_0x344a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x344a('0x15'));var db=require(_0x344a('0x16'))['db'];function respondWithStatusCode(_0x57e42e,_0x4a69ea){_0x4a69ea=_0x4a69ea||0xcc;return function(_0x304b70){if(_0x304b70){return _0x57e42e[_0x344a('0x17')](_0x4a69ea);}return _0x57e42e[_0x344a('0x18')](_0x4a69ea)[_0x344a('0x19')]();};}function respondWithResult(_0x5a0df6,_0x133ad4){_0x133ad4=_0x133ad4||0xc8;return function(_0x4ee562){if(_0x4ee562){return _0x5a0df6[_0x344a('0x18')](_0x133ad4)[_0x344a('0x1a')](_0x4ee562);}};}function respondWithFilteredResult(_0xce0f65,_0x6e1639){return function(_0x58c8cd){if(_0x58c8cd){var _0x54a643=typeof _0x6e1639[_0x344a('0x1b')]===_0x344a('0x1c')&&typeof _0x6e1639[_0x344a('0x1d')]===_0x344a('0x1c');var _0x48b3ab=_0x58c8cd[_0x344a('0x1e')];var _0x277c06=_0x54a643?0x0:_0x6e1639['offset'];var _0x9fe854=_0x54a643?_0x58c8cd[_0x344a('0x1e')]:_0x6e1639[_0x344a('0x1b')]+_0x6e1639[_0x344a('0x1d')];var _0x13b382;if(_0x9fe854>=_0x48b3ab){_0x9fe854=_0x48b3ab;_0x13b382=0xc8;}else{_0x13b382=0xce;}_0xce0f65[_0x344a('0x18')](_0x13b382);return _0xce0f65[_0x344a('0x1f')](_0x344a('0x20'),_0x277c06+'-'+_0x9fe854+'/'+_0x48b3ab)[_0x344a('0x1a')](_0x58c8cd);}return null;};}function patchUpdates(_0x450922){return function(_0x4b3552){try{jsonpatch[_0x344a('0x21')](_0x4b3552,_0x450922,!![]);}catch(_0x4232eb){return BPromise[_0x344a('0x22')](_0x4232eb);}return _0x4b3552[_0x344a('0x23')]();};}function saveUpdates(_0x240be3,_0x80ae12){return function(_0x185303){if(_0x185303){return _0x185303[_0x344a('0x24')](_0x240be3)[_0x344a('0x25')](function(_0x27f527){return _0x27f527;});}return null;};}function removeEntity(_0x90070c,_0x3b2ab9){return function(_0x5ce9da){if(_0x5ce9da){return _0x5ce9da[_0x344a('0x26')]()['then'](function(){var _0x6ccfba=_0x5ce9da['get']({'plain':!![]});var _0x2a5e49='Voicemails';return db[_0x344a('0x27')][_0x344a('0x26')]({'where':{'type':_0x2a5e49,'resourceId':_0x6ccfba['id']}})[_0x344a('0x25')](function(){return _0x5ce9da;});})[_0x344a('0x25')](function(){_0x90070c[_0x344a('0x18')](0xcc)[_0x344a('0x19')]();});}};}function handleEntityNotFound(_0x229ccd,_0x114637){return function(_0x4f2499){if(!_0x4f2499){_0x229ccd[_0x344a('0x17')](0x194);}return _0x4f2499;};}function handleError(_0x18be46,_0x26cf51){_0x26cf51=_0x26cf51||0x1f4;return function(_0xc02d6){logger[_0x344a('0x28')](_0xc02d6[_0x344a('0x29')]);if(_0xc02d6['name']){delete _0xc02d6[_0x344a('0x2a')];}_0x18be46['status'](_0x26cf51)['send'](_0xc02d6);};}exports[_0x344a('0x2b')]=function(_0x14fa86,_0x5a36bb){var _0x4803db={},_0x5cd9c6={},_0x5cafd2={'count':0x0,'rows':[]};var _0x16f490=_[_0x344a('0x2c')](db[_0x344a('0x2d')]['rawAttributes'],function(_0x25b28d){return{'name':_0x25b28d[_0x344a('0x2e')],'type':_0x25b28d[_0x344a('0x2f')][_0x344a('0x30')]};});_0x5cd9c6[_0x344a('0x31')]=_[_0x344a('0x2c')](_0x16f490,_0x344a('0x2a'));_0x5cd9c6['query']=_[_0x344a('0x32')](_0x14fa86['query']);_0x5cd9c6['filters']=_['intersection'](_0x5cd9c6[_0x344a('0x31')],_0x5cd9c6[_0x344a('0x33')]);_0x4803db[_0x344a('0x34')]=_[_0x344a('0x35')](_0x5cd9c6[_0x344a('0x31')],qs[_0x344a('0x36')](_0x14fa86['query'][_0x344a('0x36')]));_0x4803db[_0x344a('0x34')]=_0x4803db[_0x344a('0x34')]['length']?_0x4803db[_0x344a('0x34')]:_0x5cd9c6[_0x344a('0x31')];if(!_0x14fa86[_0x344a('0x33')][_0x344a('0x37')](_0x344a('0x38'))){_0x4803db['limit']=qs[_0x344a('0x1d')](_0x14fa86[_0x344a('0x33')][_0x344a('0x1d')]);_0x4803db[_0x344a('0x1b')]=qs[_0x344a('0x1b')](_0x14fa86['query'][_0x344a('0x1b')]);}_0x4803db[_0x344a('0x39')]=qs[_0x344a('0x3a')](_0x14fa86[_0x344a('0x33')][_0x344a('0x3a')]);_0x4803db['where']=qs[_0x344a('0x3b')](_[_0x344a('0x3c')](_0x14fa86[_0x344a('0x33')],_0x5cd9c6[_0x344a('0x3b')]),_0x16f490);if(_0x14fa86[_0x344a('0x33')][_0x344a('0x3d')]){_0x4803db[_0x344a('0x3e')]=_[_0x344a('0x3f')](_0x4803db['where'],{'$or':_[_0x344a('0x2c')](_0x16f490,function(_0x371c68){if(_0x371c68[_0x344a('0x2f')]!==_0x344a('0x40')){var _0x2fc05f={};_0x2fc05f[_0x371c68['name']]={'$like':'%'+_0x14fa86[_0x344a('0x33')][_0x344a('0x3d')]+'%'};return _0x2fc05f;}})});}_0x4803db=_[_0x344a('0x3f')]({},_0x4803db,_0x14fa86[_0x344a('0x41')]);var _0x2f5132={'where':_0x4803db[_0x344a('0x3e')]};return db[_0x344a('0x2d')][_0x344a('0x1e')](_0x2f5132)[_0x344a('0x25')](function(_0x4b1bac){_0x5cafd2[_0x344a('0x1e')]=_0x4b1bac;if(_0x14fa86[_0x344a('0x33')][_0x344a('0x42')]){_0x4803db[_0x344a('0x43')]=[{'all':!![]}];}return db['VoiceMail'][_0x344a('0x44')](_0x4803db);})[_0x344a('0x25')](function(_0x2b0ee9){_0x5cafd2[_0x344a('0x45')]=_0x2b0ee9;return _0x5cafd2;})[_0x344a('0x25')](respondWithFilteredResult(_0x5a36bb,_0x4803db))[_0x344a('0x46')](handleError(_0x5a36bb,null));};exports[_0x344a('0x47')]=function(_0x372e7d,_0x483c39){var _0x4509be={'raw':!![],'where':{'id':_0x372e7d['params']['id']}},_0x2de5aa={};_0x2de5aa[_0x344a('0x31')]=_[_0x344a('0x32')](db['VoiceMail'][_0x344a('0x48')]);_0x2de5aa[_0x344a('0x33')]=_['keys'](_0x372e7d[_0x344a('0x33')]);_0x2de5aa[_0x344a('0x3b')]=_['intersection'](_0x2de5aa[_0x344a('0x31')],_0x2de5aa[_0x344a('0x33')]);_0x4509be[_0x344a('0x34')]=_['intersection'](_0x2de5aa[_0x344a('0x31')],qs['fields'](_0x372e7d[_0x344a('0x33')][_0x344a('0x36')]));_0x4509be[_0x344a('0x34')]=_0x4509be[_0x344a('0x34')]['length']?_0x4509be['attributes']:_0x2de5aa[_0x344a('0x31')];if(_0x372e7d[_0x344a('0x33')][_0x344a('0x42')]){_0x4509be[_0x344a('0x43')]=[{'all':!![]}];}_0x4509be=_[_0x344a('0x3f')]({},_0x4509be,_0x372e7d[_0x344a('0x41')]);return db[_0x344a('0x2d')][_0x344a('0x49')](_0x4509be)[_0x344a('0x25')](handleEntityNotFound(_0x483c39,null))[_0x344a('0x25')](respondWithResult(_0x483c39,null))['catch'](handleError(_0x483c39,null));};exports[_0x344a('0x4a')]=function(_0x2d9858,_0x6fad37){return db[_0x344a('0x2d')]['create'](_0x2d9858[_0x344a('0x4b')],{})['then'](function(_0x590f77){var _0xa6b6b5=_0x2d9858[_0x344a('0x4c')]['get']({'plain':!![]});if(!_0xa6b6b5)throw new Error(_0x344a('0x4d'));if(_0xa6b6b5[_0x344a('0x4e')]===_0x344a('0x4c')){var _0x226f41=_0x590f77['get']({'plain':!![]});var _0x225fce=_0x344a('0x4f');return db[_0x344a('0x50')][_0x344a('0x49')]({'where':{'name':_0x225fce,'userProfileId':_0xa6b6b5[_0x344a('0x51')]},'raw':!![]})[_0x344a('0x25')](function(_0x45232c){if(_0x45232c&&_0x45232c[_0x344a('0x52')]===0x0){return db[_0x344a('0x27')][_0x344a('0x4a')]({'name':_0x226f41['name'],'resourceId':_0x226f41['id'],'type':_0x45232c[_0x344a('0x2a')],'sectionId':_0x45232c['id']},{})['then'](function(){return _0x590f77;});}else{return _0x590f77;}})[_0x344a('0x46')](function(_0xb744c6){logger[_0x344a('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb744c6);throw _0xb744c6;});}return _0x590f77;})[_0x344a('0x25')](respondWithResult(_0x6fad37,0xc9))[_0x344a('0x46')](handleError(_0x6fad37,null));};exports[_0x344a('0x24')]=function(_0x14921e,_0x346cf3){if(_0x14921e[_0x344a('0x4b')]['id']){delete _0x14921e[_0x344a('0x4b')]['id'];}return db[_0x344a('0x2d')][_0x344a('0x49')]({'where':{'id':_0x14921e['params']['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x346cf3,null))[_0x344a('0x25')](saveUpdates(_0x14921e[_0x344a('0x4b')],null))[_0x344a('0x25')](respondWithResult(_0x346cf3,null))[_0x344a('0x46')](handleError(_0x346cf3,null));};exports['destroy']=function(_0x33077f,_0x163047){return db[_0x344a('0x2d')][_0x344a('0x49')]({'where':{'id':_0x33077f['params']['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x163047,null))[_0x344a('0x25')](removeEntity(_0x163047,null))['catch'](handleError(_0x163047,null));};exports[_0x344a('0x53')]=function(_0x11d301,_0x16482c,_0x2ea2ad){return db[_0x344a('0x2d')][_0x344a('0x54')]({'where':{'id':_0x11d301[_0x344a('0x55')]['id']}})['then'](handleEntityNotFound(_0x16482c,null))['then'](function(_0x4d707b){var _0x41dc89;var _0x450a64={},_0x2acfc0={};_0x2acfc0[_0x344a('0x31')]=_['keys'](db[_0x344a('0x56')]['rawAttributes']);_0x2acfc0['query']=_['keys'](_0x11d301['query']);_0x2acfc0[_0x344a('0x3b')]=_[_0x344a('0x35')](_0x2acfc0[_0x344a('0x31')],_0x2acfc0[_0x344a('0x33')]);_0x450a64['attributes']=_['intersection'](_0x2acfc0['model'],qs[_0x344a('0x36')](_0x11d301[_0x344a('0x33')][_0x344a('0x36')]));_0x450a64[_0x344a('0x34')]=_0x450a64[_0x344a('0x34')]['length']?_0x450a64[_0x344a('0x34')]:_0x2acfc0[_0x344a('0x31')];if(!_0x11d301[_0x344a('0x33')]['hasOwnProperty'](_0x344a('0x38'))){_0x450a64['limit']=qs['limit'](_0x11d301[_0x344a('0x33')]['limit']);_0x450a64['offset']=qs[_0x344a('0x1b')](_0x11d301[_0x344a('0x33')]['offset']);}_0x450a64[_0x344a('0x39')]=qs['sort'](_0x11d301[_0x344a('0x33')][_0x344a('0x3a')]);_0x450a64[_0x344a('0x3e')]=qs['filters'](_['pick'](_0x11d301[_0x344a('0x33')],_0x2acfc0[_0x344a('0x3b')]));if(_0x11d301[_0x344a('0x33')][_0x344a('0x3d')]){_0x450a64['where']=_['merge'](_0x450a64[_0x344a('0x3e')],{'$or':_[_0x344a('0x2c')](_0x450a64[_0x344a('0x34')],function(_0x4f5119){var _0x827f2e={};_0x827f2e[_0x4f5119]={'$like':'%'+_0x11d301[_0x344a('0x33')]['filter']+'%'};return _0x827f2e;})});}_0x450a64[_0x344a('0x3e')]=_['merge'](_0x450a64[_0x344a('0x3e')],{'mailboxuser':_0x4d707b['mailbox']});_0x450a64=_['merge']({},_0x450a64,_0x11d301['options']);return db[_0x344a('0x56')][_0x344a('0x57')](_0x450a64)[_0x344a('0x25')](respondWithFilteredResult(_0x16482c,_0x450a64));})[_0x344a('0x46')](handleError(_0x16482c,null));}; \ No newline at end of file +var _0x44a3=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','index','map','VoiceMail','fieldName','type','key','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','getMessages','findOne','params','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','desk.js','querystring'];(function(_0x498d19,_0x1a7a1b){var _0x3877e1=function(_0x204fb7){while(--_0x204fb7){_0x498d19['push'](_0x498d19['shift']());}};_0x3877e1(++_0x1a7a1b);}(_0x44a3,0x1a9));var _0x344a=function(_0x151334,_0x1e11ac){_0x151334=_0x151334-0x0;var _0x3d03da=_0x44a3[_0x151334];return _0x3d03da;};'use strict';var emlformat=require(_0x344a('0x0'));var rimraf=require(_0x344a('0x1'));var zipdir=require(_0x344a('0x2'));var jsonpatch=require(_0x344a('0x3'));var rp=require(_0x344a('0x4'));var moment=require(_0x344a('0x5'));var BPromise=require(_0x344a('0x6'));var Mustache=require(_0x344a('0x7'));var util=require('util');var path=require(_0x344a('0x8'));var sox=require(_0x344a('0x9'));var csv=require(_0x344a('0xa'));var ejs=require(_0x344a('0xb'));var fs=require('fs');var fs_extra=require(_0x344a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x344a('0xd'));var toCsv=require(_0x344a('0xa'));var querystring=require(_0x344a('0xe'));var Papa=require(_0x344a('0xf'));var Redis=require(_0x344a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x344a('0x11'));var as=require(_0x344a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x344a('0x13'))('api');var utils=require(_0x344a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x344a('0x15'));var db=require(_0x344a('0x16'))['db'];function respondWithStatusCode(_0x57e42e,_0x4a69ea){_0x4a69ea=_0x4a69ea||0xcc;return function(_0x304b70){if(_0x304b70){return _0x57e42e[_0x344a('0x17')](_0x4a69ea);}return _0x57e42e[_0x344a('0x18')](_0x4a69ea)[_0x344a('0x19')]();};}function respondWithResult(_0x5a0df6,_0x133ad4){_0x133ad4=_0x133ad4||0xc8;return function(_0x4ee562){if(_0x4ee562){return _0x5a0df6[_0x344a('0x18')](_0x133ad4)[_0x344a('0x1a')](_0x4ee562);}};}function respondWithFilteredResult(_0xce0f65,_0x6e1639){return function(_0x58c8cd){if(_0x58c8cd){var _0x54a643=typeof _0x6e1639[_0x344a('0x1b')]===_0x344a('0x1c')&&typeof _0x6e1639[_0x344a('0x1d')]===_0x344a('0x1c');var _0x48b3ab=_0x58c8cd[_0x344a('0x1e')];var _0x277c06=_0x54a643?0x0:_0x6e1639['offset'];var _0x9fe854=_0x54a643?_0x58c8cd[_0x344a('0x1e')]:_0x6e1639[_0x344a('0x1b')]+_0x6e1639[_0x344a('0x1d')];var _0x13b382;if(_0x9fe854>=_0x48b3ab){_0x9fe854=_0x48b3ab;_0x13b382=0xc8;}else{_0x13b382=0xce;}_0xce0f65[_0x344a('0x18')](_0x13b382);return _0xce0f65[_0x344a('0x1f')](_0x344a('0x20'),_0x277c06+'-'+_0x9fe854+'/'+_0x48b3ab)[_0x344a('0x1a')](_0x58c8cd);}return null;};}function patchUpdates(_0x450922){return function(_0x4b3552){try{jsonpatch[_0x344a('0x21')](_0x4b3552,_0x450922,!![]);}catch(_0x4232eb){return BPromise[_0x344a('0x22')](_0x4232eb);}return _0x4b3552[_0x344a('0x23')]();};}function saveUpdates(_0x240be3,_0x80ae12){return function(_0x185303){if(_0x185303){return _0x185303[_0x344a('0x24')](_0x240be3)[_0x344a('0x25')](function(_0x27f527){return _0x27f527;});}return null;};}function removeEntity(_0x90070c,_0x3b2ab9){return function(_0x5ce9da){if(_0x5ce9da){return _0x5ce9da[_0x344a('0x26')]()['then'](function(){var _0x6ccfba=_0x5ce9da['get']({'plain':!![]});var _0x2a5e49='Voicemails';return db[_0x344a('0x27')][_0x344a('0x26')]({'where':{'type':_0x2a5e49,'resourceId':_0x6ccfba['id']}})[_0x344a('0x25')](function(){return _0x5ce9da;});})[_0x344a('0x25')](function(){_0x90070c[_0x344a('0x18')](0xcc)[_0x344a('0x19')]();});}};}function handleEntityNotFound(_0x229ccd,_0x114637){return function(_0x4f2499){if(!_0x4f2499){_0x229ccd[_0x344a('0x17')](0x194);}return _0x4f2499;};}function handleError(_0x18be46,_0x26cf51){_0x26cf51=_0x26cf51||0x1f4;return function(_0xc02d6){logger[_0x344a('0x28')](_0xc02d6[_0x344a('0x29')]);if(_0xc02d6['name']){delete _0xc02d6[_0x344a('0x2a')];}_0x18be46['status'](_0x26cf51)['send'](_0xc02d6);};}exports[_0x344a('0x2b')]=function(_0x14fa86,_0x5a36bb){var _0x4803db={},_0x5cd9c6={},_0x5cafd2={'count':0x0,'rows':[]};var _0x16f490=_[_0x344a('0x2c')](db[_0x344a('0x2d')]['rawAttributes'],function(_0x25b28d){return{'name':_0x25b28d[_0x344a('0x2e')],'type':_0x25b28d[_0x344a('0x2f')][_0x344a('0x30')]};});_0x5cd9c6[_0x344a('0x31')]=_[_0x344a('0x2c')](_0x16f490,_0x344a('0x2a'));_0x5cd9c6['query']=_[_0x344a('0x32')](_0x14fa86['query']);_0x5cd9c6['filters']=_['intersection'](_0x5cd9c6[_0x344a('0x31')],_0x5cd9c6[_0x344a('0x33')]);_0x4803db[_0x344a('0x34')]=_[_0x344a('0x35')](_0x5cd9c6[_0x344a('0x31')],qs[_0x344a('0x36')](_0x14fa86['query'][_0x344a('0x36')]));_0x4803db[_0x344a('0x34')]=_0x4803db[_0x344a('0x34')]['length']?_0x4803db[_0x344a('0x34')]:_0x5cd9c6[_0x344a('0x31')];if(!_0x14fa86[_0x344a('0x33')][_0x344a('0x37')](_0x344a('0x38'))){_0x4803db['limit']=qs[_0x344a('0x1d')](_0x14fa86[_0x344a('0x33')][_0x344a('0x1d')]);_0x4803db[_0x344a('0x1b')]=qs[_0x344a('0x1b')](_0x14fa86['query'][_0x344a('0x1b')]);}_0x4803db[_0x344a('0x39')]=qs[_0x344a('0x3a')](_0x14fa86[_0x344a('0x33')][_0x344a('0x3a')]);_0x4803db['where']=qs[_0x344a('0x3b')](_[_0x344a('0x3c')](_0x14fa86[_0x344a('0x33')],_0x5cd9c6[_0x344a('0x3b')]),_0x16f490);if(_0x14fa86[_0x344a('0x33')][_0x344a('0x3d')]){_0x4803db[_0x344a('0x3e')]=_[_0x344a('0x3f')](_0x4803db['where'],{'$or':_[_0x344a('0x2c')](_0x16f490,function(_0x371c68){if(_0x371c68[_0x344a('0x2f')]!==_0x344a('0x40')){var _0x2fc05f={};_0x2fc05f[_0x371c68['name']]={'$like':'%'+_0x14fa86[_0x344a('0x33')][_0x344a('0x3d')]+'%'};return _0x2fc05f;}})});}_0x4803db=_[_0x344a('0x3f')]({},_0x4803db,_0x14fa86[_0x344a('0x41')]);var _0x2f5132={'where':_0x4803db[_0x344a('0x3e')]};return db[_0x344a('0x2d')][_0x344a('0x1e')](_0x2f5132)[_0x344a('0x25')](function(_0x4b1bac){_0x5cafd2[_0x344a('0x1e')]=_0x4b1bac;if(_0x14fa86[_0x344a('0x33')][_0x344a('0x42')]){_0x4803db[_0x344a('0x43')]=[{'all':!![]}];}return db['VoiceMail'][_0x344a('0x44')](_0x4803db);})[_0x344a('0x25')](function(_0x2b0ee9){_0x5cafd2[_0x344a('0x45')]=_0x2b0ee9;return _0x5cafd2;})[_0x344a('0x25')](respondWithFilteredResult(_0x5a36bb,_0x4803db))[_0x344a('0x46')](handleError(_0x5a36bb,null));};exports[_0x344a('0x47')]=function(_0x372e7d,_0x483c39){var _0x4509be={'raw':!![],'where':{'id':_0x372e7d['params']['id']}},_0x2de5aa={};_0x2de5aa[_0x344a('0x31')]=_[_0x344a('0x32')](db['VoiceMail'][_0x344a('0x48')]);_0x2de5aa[_0x344a('0x33')]=_['keys'](_0x372e7d[_0x344a('0x33')]);_0x2de5aa[_0x344a('0x3b')]=_['intersection'](_0x2de5aa[_0x344a('0x31')],_0x2de5aa[_0x344a('0x33')]);_0x4509be[_0x344a('0x34')]=_['intersection'](_0x2de5aa[_0x344a('0x31')],qs['fields'](_0x372e7d[_0x344a('0x33')][_0x344a('0x36')]));_0x4509be[_0x344a('0x34')]=_0x4509be[_0x344a('0x34')]['length']?_0x4509be['attributes']:_0x2de5aa[_0x344a('0x31')];if(_0x372e7d[_0x344a('0x33')][_0x344a('0x42')]){_0x4509be[_0x344a('0x43')]=[{'all':!![]}];}_0x4509be=_[_0x344a('0x3f')]({},_0x4509be,_0x372e7d[_0x344a('0x41')]);return db[_0x344a('0x2d')][_0x344a('0x49')](_0x4509be)[_0x344a('0x25')](handleEntityNotFound(_0x483c39,null))[_0x344a('0x25')](respondWithResult(_0x483c39,null))['catch'](handleError(_0x483c39,null));};exports[_0x344a('0x4a')]=function(_0x2d9858,_0x6fad37){return db[_0x344a('0x2d')]['create'](_0x2d9858[_0x344a('0x4b')],{})['then'](function(_0x590f77){var _0xa6b6b5=_0x2d9858[_0x344a('0x4c')]['get']({'plain':!![]});if(!_0xa6b6b5)throw new Error(_0x344a('0x4d'));if(_0xa6b6b5[_0x344a('0x4e')]===_0x344a('0x4c')){var _0x226f41=_0x590f77['get']({'plain':!![]});var _0x225fce=_0x344a('0x4f');return db[_0x344a('0x50')][_0x344a('0x49')]({'where':{'name':_0x225fce,'userProfileId':_0xa6b6b5[_0x344a('0x51')]},'raw':!![]})[_0x344a('0x25')](function(_0x45232c){if(_0x45232c&&_0x45232c[_0x344a('0x52')]===0x0){return db[_0x344a('0x27')][_0x344a('0x4a')]({'name':_0x226f41['name'],'resourceId':_0x226f41['id'],'type':_0x45232c[_0x344a('0x2a')],'sectionId':_0x45232c['id']},{})['then'](function(){return _0x590f77;});}else{return _0x590f77;}})[_0x344a('0x46')](function(_0xb744c6){logger[_0x344a('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb744c6);throw _0xb744c6;});}return _0x590f77;})[_0x344a('0x25')](respondWithResult(_0x6fad37,0xc9))[_0x344a('0x46')](handleError(_0x6fad37,null));};exports[_0x344a('0x24')]=function(_0x14921e,_0x346cf3){if(_0x14921e[_0x344a('0x4b')]['id']){delete _0x14921e[_0x344a('0x4b')]['id'];}return db[_0x344a('0x2d')][_0x344a('0x49')]({'where':{'id':_0x14921e['params']['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x346cf3,null))[_0x344a('0x25')](saveUpdates(_0x14921e[_0x344a('0x4b')],null))[_0x344a('0x25')](respondWithResult(_0x346cf3,null))[_0x344a('0x46')](handleError(_0x346cf3,null));};exports['destroy']=function(_0x33077f,_0x163047){return db[_0x344a('0x2d')][_0x344a('0x49')]({'where':{'id':_0x33077f['params']['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x163047,null))[_0x344a('0x25')](removeEntity(_0x163047,null))['catch'](handleError(_0x163047,null));};exports[_0x344a('0x53')]=function(_0x11d301,_0x16482c,_0x2ea2ad){return db[_0x344a('0x2d')][_0x344a('0x54')]({'where':{'id':_0x11d301[_0x344a('0x55')]['id']}})['then'](handleEntityNotFound(_0x16482c,null))['then'](function(_0x4d707b){var _0x41dc89;var _0x450a64={},_0x2acfc0={};_0x2acfc0[_0x344a('0x31')]=_['keys'](db[_0x344a('0x56')]['rawAttributes']);_0x2acfc0['query']=_['keys'](_0x11d301['query']);_0x2acfc0[_0x344a('0x3b')]=_[_0x344a('0x35')](_0x2acfc0[_0x344a('0x31')],_0x2acfc0[_0x344a('0x33')]);_0x450a64['attributes']=_['intersection'](_0x2acfc0['model'],qs[_0x344a('0x36')](_0x11d301[_0x344a('0x33')][_0x344a('0x36')]));_0x450a64[_0x344a('0x34')]=_0x450a64[_0x344a('0x34')]['length']?_0x450a64[_0x344a('0x34')]:_0x2acfc0[_0x344a('0x31')];if(!_0x11d301[_0x344a('0x33')]['hasOwnProperty'](_0x344a('0x38'))){_0x450a64['limit']=qs['limit'](_0x11d301[_0x344a('0x33')]['limit']);_0x450a64['offset']=qs[_0x344a('0x1b')](_0x11d301[_0x344a('0x33')]['offset']);}_0x450a64[_0x344a('0x39')]=qs['sort'](_0x11d301[_0x344a('0x33')][_0x344a('0x3a')]);_0x450a64[_0x344a('0x3e')]=qs['filters'](_['pick'](_0x11d301[_0x344a('0x33')],_0x2acfc0[_0x344a('0x3b')]));if(_0x11d301[_0x344a('0x33')][_0x344a('0x3d')]){_0x450a64['where']=_['merge'](_0x450a64[_0x344a('0x3e')],{'$or':_[_0x344a('0x2c')](_0x450a64[_0x344a('0x34')],function(_0x4f5119){var _0x827f2e={};_0x827f2e[_0x4f5119]={'$like':'%'+_0x11d301[_0x344a('0x33')]['filter']+'%'};return _0x827f2e;})});}_0x450a64[_0x344a('0x3e')]=_['merge'](_0x450a64[_0x344a('0x3e')],{'mailboxuser':_0x4d707b['mailbox']});_0x450a64=_['merge']({},_0x450a64,_0x11d301['options']);return db[_0x344a('0x56')][_0x344a('0x57')](_0x450a64)[_0x344a('0x25')](respondWithFilteredResult(_0x16482c,_0x450a64));})[_0x344a('0x46')](handleError(_0x16482c,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 64596f6..4727c0b 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 _0x743a=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','context','lodash'];(function(_0x5582a3,_0xeaffb0){var _0x4ae92d=function(_0x2d6c2b){while(--_0x2d6c2b){_0x5582a3['push'](_0x5582a3['shift']());}};_0x4ae92d(++_0xeaffb0);}(_0x743a,0x113));var _0xa743=function(_0x48038f,_0xc5d0a4){_0x48038f=_0x48038f-0x0;var _0x3c6bf8=_0x743a[_0x48038f];return _0x3c6bf8;};'use strict';var _=require(_0xa743('0x0'));var util=require(_0xa743('0x1'));var logger=require('../../config/logger')(_0xa743('0x2'));var moment=require('moment');var BPromise=require(_0xa743('0x3'));var rp=require(_0xa743('0x4'));var fs=require('fs');var path=require(_0xa743('0x5'));var rimraf=require(_0xa743('0x6'));var config=require(_0xa743('0x7'));var attributes=require(_0xa743('0x8'));module[_0xa743('0x9')]=function(_0x134394,_0x5a618b){return _0x134394[_0xa743('0xa')]('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0xa743('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2acf=['path','rimraf','../../config/environment','./voiceMail.attributes','exports','mailbox_context','mailbox','context','lodash','moment','bluebird'];(function(_0x5d37f2,_0x40b508){var _0x2ba122=function(_0x1a5984){while(--_0x1a5984){_0x5d37f2['push'](_0x5d37f2['shift']());}};_0x2ba122(++_0x40b508);}(_0x2acf,0x189));var _0xf2ac=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x2acf[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0xf2ac('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf2ac('0x1'));var BPromise=require(_0xf2ac('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2ac('0x3'));var rimraf=require(_0xf2ac('0x4'));var config=require(_0xf2ac('0x5'));var attributes=require(_0xf2ac('0x6'));module[_0xf2ac('0x7')]=function(_0x3a5113,_0x5a89c3){return _0x3a5113['define']('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xf2ac('0x8'),'fields':[_0xf2ac('0x9'),_0xf2ac('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 5c9e959..4795f40 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 _0x804a=['error','code','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x3216f5,_0xe32e8a){var _0x17035a=function(_0x5f28cd){while(--_0x5f28cd){_0x3216f5['push'](_0x3216f5['shift']());}};_0x17035a(++_0xe32e8a);}(_0x804a,0x194));var _0xa804=function(_0x2d38f1,_0x38ee22){_0x2d38f1=_0x2d38f1-0x0;var _0x663668=_0x804a[_0x2d38f1];return _0x663668;};'use strict';var _=require('lodash');var util=require(_0xa804('0x0'));var moment=require(_0xa804('0x1'));var BPromise=require('bluebird');var rs=require(_0xa804('0x2'));var fs=require('fs');var Redis=require(_0xa804('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa804('0x4'));var logger=require(_0xa804('0x5'))('rpc');var config=require(_0xa804('0x6'));var jayson=require(_0xa804('0x7'));var client=jayson[_0xa804('0x8')][_0xa804('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3183f1,_0x2c894b,_0x1c7220){return new BPromise(function(_0x55a0f5,_0x7343f0){return client[_0xa804('0xa')](_0x3183f1,_0x1c7220)[_0xa804('0xb')](function(_0x9bfa83){logger['info'](_0xa804('0xc'),_0x2c894b,_0xa804('0xd'));logger[_0xa804('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x2c894b,_0xa804('0xd'),JSON[_0xa804('0xf')](_0x9bfa83));if(_0x9bfa83['error']){if(_0x9bfa83[_0xa804('0x10')][_0xa804('0x11')]===0x1f4){logger[_0xa804('0x10')](_0xa804('0xc'),_0x2c894b,_0x9bfa83[_0xa804('0x10')][_0xa804('0x12')]);return _0x7343f0(_0x9bfa83[_0xa804('0x10')][_0xa804('0x12')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x2c894b,_0x9bfa83['error'][_0xa804('0x12')]);return _0x55a0f5(_0x9bfa83[_0xa804('0x10')][_0xa804('0x12')]);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x2c894b,_0xa804('0xd'));_0x55a0f5(_0x9bfa83[_0xa804('0x13')][_0xa804('0x12')]);}})[_0xa804('0x14')](function(_0x48b720){logger[_0xa804('0x10')]('VoiceMail,\x20%s,\x20%s',_0x2c894b,_0x48b720);_0x7343f0(_0x48b720);});});} \ No newline at end of file +var _0x4650=['VoiceMail,\x20%s,\x20%s,\x20%s','error','code','VoiceMail,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','ioredis','../../config/logger','rpc','jayson/promise','client','http','then','request\x20sent','debug'];(function(_0x1d7ff8,_0x130c1e){var _0x1fdc35=function(_0x1341c9){while(--_0x1341c9){_0x1d7ff8['push'](_0x1d7ff8['shift']());}};_0x1fdc35(++_0x130c1e);}(_0x4650,0xf8));var _0x0465=function(_0x391d72,_0x4684ac){_0x391d72=_0x391d72-0x0;var _0x2820e5=_0x4650[_0x391d72];return _0x2820e5;};'use strict';var _=require(_0x0465('0x0'));var util=require(_0x0465('0x1'));var moment=require(_0x0465('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0465('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0465('0x4'))(_0x0465('0x5'));var config=require('../../config/environment');var jayson=require(_0x0465('0x6'));var client=jayson[_0x0465('0x7')][_0x0465('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3efcba,_0x107261,_0x133c9f){return new BPromise(function(_0x392d2d,_0x5dffc6){return client['request'](_0x3efcba,_0x133c9f)[_0x0465('0x9')](function(_0xb2a3a7){logger['info']('VoiceMail,\x20%s,\x20%s',_0x107261,_0x0465('0xa'));logger[_0x0465('0xb')](_0x0465('0xc'),_0x107261,'request\x20sent',JSON['stringify'](_0xb2a3a7));if(_0xb2a3a7[_0x0465('0xd')]){if(_0xb2a3a7[_0x0465('0xd')][_0x0465('0xe')]===0x1f4){logger['error'](_0x0465('0xf'),_0x107261,_0xb2a3a7[_0x0465('0xd')][_0x0465('0x10')]);return _0x5dffc6(_0xb2a3a7[_0x0465('0xd')][_0x0465('0x10')]);}logger[_0x0465('0xd')]('VoiceMail,\x20%s,\x20%s',_0x107261,_0xb2a3a7[_0x0465('0xd')]['message']);return _0x392d2d(_0xb2a3a7['error'][_0x0465('0x10')]);}else{logger[_0x0465('0x11')](_0x0465('0xf'),_0x107261,'request\x20sent');_0x392d2d(_0xb2a3a7[_0x0465('0x12')][_0x0465('0x10')]);}})[_0x0465('0x13')](function(_0x46b1d5){logger[_0x0465('0xd')](_0x0465('0xf'),_0x107261,_0x46b1d5);_0x5dffc6(_0x46b1d5);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 6429432..8f15088 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 _0x45fb=['/:id/download','isAuthenticated','post','create','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','index','/:id','show'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x45fb,0x11e));var _0xb45f=function(_0x18269b,_0x5b7b9d){_0x18269b=_0x18269b-0x0;var _0x521e79=_0x45fb[_0x18269b];return _0x521e79;};'use strict';var multer=require(_0xb45f('0x0'));var util=require(_0xb45f('0x1'));var path=require(_0xb45f('0x2'));var timeout=require(_0xb45f('0x3'));var express=require(_0xb45f('0x4'));var router=express[_0xb45f('0x5')]();var fs_extra=require(_0xb45f('0x6'));var auth=require(_0xb45f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb45f('0x8'));var controller=require(_0xb45f('0x9'));router[_0xb45f('0xa')]('/',auth['isAuthenticated'](),controller[_0xb45f('0xb')]);router['get'](_0xb45f('0xc'),auth['isAuthenticated'](),controller[_0xb45f('0xd')]);router[_0xb45f('0xa')](_0xb45f('0xe'),auth[_0xb45f('0xf')](),controller['download']);router[_0xb45f('0x10')]('/',auth[_0xb45f('0xf')](),controller[_0xb45f('0x11')]);router['put']('/:id',auth[_0xb45f('0xf')](),controller[_0xb45f('0x12')]);router['delete'](_0xb45f('0xc'),auth[_0xb45f('0xf')](),controller[_0xb45f('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf441=['./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x234a15,_0x2758ce){var _0x39dcad=function(_0x2cdbcb){while(--_0x2cdbcb){_0x234a15['push'](_0x234a15['shift']());}};_0x39dcad(++_0x2758ce);}(_0xf441,0x1c5));var _0x1f44=function(_0x13cab2,_0x148058){_0x13cab2=_0x13cab2-0x0;var _0x292c90=_0xf441[_0x13cab2];return _0x292c90;};'use strict';var multer=require(_0x1f44('0x0'));var util=require(_0x1f44('0x1'));var path=require(_0x1f44('0x2'));var timeout=require(_0x1f44('0x3'));var express=require('express');var router=express[_0x1f44('0x4')]();var fs_extra=require(_0x1f44('0x5'));var auth=require(_0x1f44('0x6'));var interaction=require(_0x1f44('0x7'));var config=require(_0x1f44('0x8'));var controller=require(_0x1f44('0x9'));router[_0x1f44('0xa')]('/',auth[_0x1f44('0xb')](),controller[_0x1f44('0xc')]);router[_0x1f44('0xa')](_0x1f44('0xd'),auth[_0x1f44('0xb')](),controller['show']);router[_0x1f44('0xa')](_0x1f44('0xe'),auth['isAuthenticated'](),controller[_0x1f44('0xf')]);router['post']('/',auth[_0x1f44('0xb')](),controller[_0x1f44('0x10')]);router[_0x1f44('0x11')](_0x1f44('0xd'),auth[_0x1f44('0xb')](),controller[_0x1f44('0x12')]);router['delete'](_0x1f44('0xd'),auth[_0x1f44('0xb')](),controller[_0x1f44('0x13')]);module[_0x1f44('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index f1e2122..76943ae 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 _0x71a5=['STRING','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue','INTEGER'];(function(_0x387c26,_0x1a3ac1){var _0x172cd2=function(_0x17d579){while(--_0x17d579){_0x387c26['push'](_0x387c26['shift']());}};_0x172cd2(++_0x1a3ac1);}(_0x71a5,0x168));var _0x571a=function(_0x419bb9,_0x247ffa){_0x419bb9=_0x419bb9-0x0;var _0x594006=_0x71a5[_0x419bb9];return _0x594006;};'use strict';var Sequelize=require(_0x571a('0x0'));module[_0x571a('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x56c2c1){return this[_0x571a('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x571a('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x571a('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x571a('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x571a('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x571a('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x571a('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x571a('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x571a('0x4')],'defaultValue':''},'stamp':{'type':_0x571a('0x5'),'defaultValue':Sequelize['literal'](_0x571a('0x6'))}}; \ No newline at end of file +var _0x3f95=['BLOB','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0xdf9ee2,_0x20dc52){var _0x217150=function(_0x6ece9d){while(--_0x6ece9d){_0xdf9ee2['push'](_0xdf9ee2['shift']());}};_0x217150(++_0x20dc52);}(_0x3f95,0x1e4));var _0x53f9=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3f95[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x53f9('0x0'));module[_0x53f9('0x1')]={'name':{'type':Sequelize[_0x53f9('0x2')],'get':function(_0x59da5e){return this[_0x53f9('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x53f9('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x53f9('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x53f9('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x53f9('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x53f9('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x53f9('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x53f9('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x53f9('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x53f9('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x53f9('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x53f9('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x53f9('0x5')],'defaultValue':''},'stamp':{'type':_0x53f9('0x7'),'defaultValue':Sequelize[_0x53f9('0x8')](_0x53f9('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 94a5f77..650cec0 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 _0x4d87=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VoiceMailMessage','include','findAll','catch','show','params','length','includeAll','options','find','create','body','recording','msg_id','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','set'];(function(_0x34799f,_0x3e2a3d){var _0x46b18b=function(_0x5a8095){while(--_0x5a8095){_0x34799f['push'](_0x34799f['shift']());}};_0x46b18b(++_0x3e2a3d);}(_0x4d87,0x148));var _0x74d8=function(_0x5d6351,_0x1254e7){_0x5d6351=_0x5d6351-0x0;var _0x54b981=_0x4d87[_0x5d6351];return _0x54b981;};'use strict';var emlformat=require(_0x74d8('0x0'));var rimraf=require(_0x74d8('0x1'));var zipdir=require(_0x74d8('0x2'));var jsonpatch=require(_0x74d8('0x3'));var rp=require('request-promise');var moment=require(_0x74d8('0x4'));var BPromise=require(_0x74d8('0x5'));var Mustache=require('mustache');var util=require(_0x74d8('0x6'));var path=require(_0x74d8('0x7'));var sox=require(_0x74d8('0x8'));var csv=require(_0x74d8('0x9'));var ejs=require(_0x74d8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x74d8('0xb'));var crypto=require(_0x74d8('0xc'));var jsforce=require(_0x74d8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x74d8('0x9'));var querystring=require(_0x74d8('0xe'));var Papa=require(_0x74d8('0xf'));var Redis=require(_0x74d8('0x10'));var authService=require(_0x74d8('0x11'));var qs=require(_0x74d8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x74d8('0x13'))(_0x74d8('0x14'));var utils=require(_0x74d8('0x15'));var config=require(_0x74d8('0x16'));var licenseUtil=require(_0x74d8('0x17'));var db=require(_0x74d8('0x18'))['db'];function respondWithStatusCode(_0x3a113c,_0x3b1b4a){_0x3b1b4a=_0x3b1b4a||0xcc;return function(_0x3f69bb){if(_0x3f69bb){return _0x3a113c['sendStatus'](_0x3b1b4a);}return _0x3a113c[_0x74d8('0x19')](_0x3b1b4a)['end']();};}function respondWithResult(_0x6db3a0,_0x503f90){_0x503f90=_0x503f90||0xc8;return function(_0x17f79b){if(_0x17f79b){return _0x6db3a0['status'](_0x503f90)[_0x74d8('0x1a')](_0x17f79b);}};}function respondWithFilteredResult(_0xfb60f0,_0x33cf3f){return function(_0x5dc85a){if(_0x5dc85a){var _0x1fc63a=typeof _0x33cf3f[_0x74d8('0x1b')]===_0x74d8('0x1c')&&typeof _0x33cf3f[_0x74d8('0x1d')]===_0x74d8('0x1c');var _0x18fa72=_0x5dc85a[_0x74d8('0x1e')];var _0x445be7=_0x1fc63a?0x0:_0x33cf3f['offset'];var _0x55d908=_0x1fc63a?_0x5dc85a['count']:_0x33cf3f[_0x74d8('0x1b')]+_0x33cf3f[_0x74d8('0x1d')];var _0x17340c;if(_0x55d908>=_0x18fa72){_0x55d908=_0x18fa72;_0x17340c=0xc8;}else{_0x17340c=0xce;}_0xfb60f0[_0x74d8('0x19')](_0x17340c);return _0xfb60f0['set']('Content-Range',_0x445be7+'-'+_0x55d908+'/'+_0x18fa72)[_0x74d8('0x1a')](_0x5dc85a);}return null;};}function patchUpdates(_0x351bea){return function(_0x775111){try{jsonpatch['apply'](_0x775111,_0x351bea,!![]);}catch(_0x53907a){return BPromise[_0x74d8('0x1f')](_0x53907a);}return _0x775111[_0x74d8('0x20')]();};}function saveUpdates(_0x589570,_0x2fdd50){return function(_0x126db6){if(_0x126db6){return _0x126db6[_0x74d8('0x21')](_0x589570)[_0x74d8('0x22')](function(_0x245f8d){return _0x245f8d;});}return null;};}function removeEntity(_0x1f7538,_0x38e722){return function(_0x1db1c5){if(_0x1db1c5){return _0x1db1c5[_0x74d8('0x23')]()['then'](function(){_0x1f7538['status'](0xcc)[_0x74d8('0x24')]();});}};}function handleEntityNotFound(_0x198e9b,_0x38ce68){return function(_0x5560d3){if(!_0x5560d3){_0x198e9b[_0x74d8('0x25')](0x194);}return _0x5560d3;};}function handleError(_0x2f7500,_0x1a333e){_0x1a333e=_0x1a333e||0x1f4;return function(_0x4f326c){logger[_0x74d8('0x26')](_0x4f326c[_0x74d8('0x27')]);if(_0x4f326c[_0x74d8('0x28')]){delete _0x4f326c[_0x74d8('0x28')];}_0x2f7500['status'](_0x1a333e)[_0x74d8('0x29')](_0x4f326c);};}exports[_0x74d8('0x2a')]=function(_0x1c801e,_0x8237d7){var _0xad4ff4={},_0x3544c5={},_0x4dd611={'count':0x0,'rows':[]};var _0x4776ef=_[_0x74d8('0x2b')](db['VoiceMailMessage'][_0x74d8('0x2c')],function(_0x13a031){return{'name':_0x13a031[_0x74d8('0x2d')],'type':_0x13a031[_0x74d8('0x2e')]['key']};});_0x3544c5[_0x74d8('0x2f')]=_[_0x74d8('0x30')](_['map'](_0x4776ef,_0x74d8('0x28')),[_0x74d8('0x28')]);_0x3544c5[_0x74d8('0x31')]=_[_0x74d8('0x32')](_0x1c801e[_0x74d8('0x31')]);_0x3544c5[_0x74d8('0x33')]=_['intersection'](_0x3544c5[_0x74d8('0x2f')],_0x3544c5[_0x74d8('0x31')]);_0xad4ff4[_0x74d8('0x34')]=_[_0x74d8('0x35')](_0x3544c5[_0x74d8('0x2f')],qs[_0x74d8('0x36')](_0x1c801e[_0x74d8('0x31')][_0x74d8('0x36')]));_0xad4ff4[_0x74d8('0x34')]=_0xad4ff4[_0x74d8('0x34')]['length']?_0xad4ff4[_0x74d8('0x34')]:_0x3544c5['model'];if(!_0x1c801e[_0x74d8('0x31')][_0x74d8('0x37')](_0x74d8('0x38'))){_0xad4ff4[_0x74d8('0x1d')]=qs[_0x74d8('0x1d')](_0x1c801e[_0x74d8('0x31')][_0x74d8('0x1d')]);_0xad4ff4[_0x74d8('0x1b')]=qs['offset'](_0x1c801e[_0x74d8('0x31')][_0x74d8('0x1b')]);}_0xad4ff4[_0x74d8('0x39')]=qs[_0x74d8('0x3a')](_0x1c801e[_0x74d8('0x31')][_0x74d8('0x3a')]);_0xad4ff4[_0x74d8('0x3b')]=qs[_0x74d8('0x33')](_['pick'](_0x1c801e[_0x74d8('0x31')],_0x3544c5['filters']),_0x4776ef);if(_0x1c801e['query'][_0x74d8('0x3c')]){_0xad4ff4[_0x74d8('0x3b')]=_[_0x74d8('0x3d')](_0xad4ff4[_0x74d8('0x3b')],{'$or':_[_0x74d8('0x2b')](_0x4776ef,function(_0x1c295d){if(_0x1c295d['type']!=='VIRTUAL'){var _0x8b8d8b={};_0x8b8d8b[_0x1c295d[_0x74d8('0x28')]]={'$like':'%'+_0x1c801e['query']['filter']+'%'};return _0x8b8d8b;}})});}_0xad4ff4=_['merge']({},_0xad4ff4,_0x1c801e['options']);var _0x5850bf={'where':_0xad4ff4['where']};return db[_0x74d8('0x3e')][_0x74d8('0x1e')](_0x5850bf)[_0x74d8('0x22')](function(_0x55e38d){_0x4dd611['count']=_0x55e38d;if(_0x1c801e['query']['includeAll']){_0xad4ff4[_0x74d8('0x3f')]=[{'all':!![]}];}return db[_0x74d8('0x3e')][_0x74d8('0x40')](_0xad4ff4);})['then'](function(_0x10cbd2){_0x4dd611['rows']=_0x10cbd2;return _0x4dd611;})['then'](respondWithFilteredResult(_0x8237d7,_0xad4ff4))[_0x74d8('0x41')](handleError(_0x8237d7,null));};exports[_0x74d8('0x42')]=function(_0x24001b,_0x465ad5){var _0xe6cbe7={'raw':!![],'where':{'id':_0x24001b[_0x74d8('0x43')]['id']}},_0x405651={};_0x405651[_0x74d8('0x2f')]=_[_0x74d8('0x32')](db[_0x74d8('0x3e')][_0x74d8('0x2c')]);_0x405651[_0x74d8('0x31')]=_[_0x74d8('0x32')](_0x24001b[_0x74d8('0x31')]);_0x405651['filters']=_[_0x74d8('0x35')](_0x405651['model'],_0x405651[_0x74d8('0x31')]);_0xe6cbe7['attributes']=_[_0x74d8('0x35')](_0x405651[_0x74d8('0x2f')],qs[_0x74d8('0x36')](_0x24001b[_0x74d8('0x31')][_0x74d8('0x36')]));_0xe6cbe7[_0x74d8('0x34')]=_0xe6cbe7[_0x74d8('0x34')][_0x74d8('0x44')]?_0xe6cbe7[_0x74d8('0x34')]:_0x405651[_0x74d8('0x2f')];if(_0x24001b[_0x74d8('0x31')][_0x74d8('0x45')]){_0xe6cbe7[_0x74d8('0x3f')]=[{'all':!![]}];}_0xe6cbe7=_[_0x74d8('0x3d')]({},_0xe6cbe7,_0x24001b[_0x74d8('0x46')]);return db[_0x74d8('0x3e')][_0x74d8('0x47')](_0xe6cbe7)['then'](handleEntityNotFound(_0x465ad5,null))[_0x74d8('0x22')](respondWithResult(_0x465ad5,null))[_0x74d8('0x41')](handleError(_0x465ad5,null));};exports[_0x74d8('0x48')]=function(_0x6daac0,_0xfc309e){return db[_0x74d8('0x3e')][_0x74d8('0x48')](_0x6daac0[_0x74d8('0x49')],{})[_0x74d8('0x22')](respondWithResult(_0xfc309e,0xc9))[_0x74d8('0x41')](handleError(_0xfc309e,null));};exports['update']=function(_0x579619,_0x514df6){if(_0x579619[_0x74d8('0x49')]['id']){delete _0x579619[_0x74d8('0x49')]['id'];}return db[_0x74d8('0x3e')]['find']({'where':{'id':_0x579619[_0x74d8('0x43')]['id']}})[_0x74d8('0x22')](handleEntityNotFound(_0x514df6,null))['then'](saveUpdates(_0x579619[_0x74d8('0x49')],null))[_0x74d8('0x22')](respondWithResult(_0x514df6,null))[_0x74d8('0x41')](handleError(_0x514df6,null));};exports[_0x74d8('0x23')]=function(_0x154192,_0x4c05f2){return db['VoiceMailMessage'][_0x74d8('0x47')]({'where':{'id':_0x154192[_0x74d8('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c05f2,null))['then'](removeEntity(_0x4c05f2,null))[_0x74d8('0x41')](handleError(_0x4c05f2,null));};exports['download']=function(_0x1fb011,_0x1a5ea0,_0x7f825a){return db[_0x74d8('0x3e')][_0x74d8('0x47')]({'where':{'id':_0x1fb011[_0x74d8('0x43')]['id']},'attributes':['id',_0x74d8('0x4a'),_0x74d8('0x4b')]})[_0x74d8('0x22')](handleEntityNotFound(_0x1a5ea0,null))[_0x74d8('0x22')](function(_0x57deda){if(_0x57deda){if(!_0x57deda[_0x74d8('0x4a')]){throw new db['Sequelize'][(_0x74d8('0x4c'))]('VoiceMailMessage\x20not\x20found');}var _0x5540c3={'Content-Type':_0x74d8('0x4d'),'Content-Disposition':_0x74d8('0x4e')};if(_0x57deda[_0x74d8('0x4b')]){_0x5540c3[_0x74d8('0x4f')]=_0x74d8('0x50')+_0x57deda[_0x74d8('0x4b')]+'.wav\x22';}_0x1a5ea0[_0x74d8('0x51')](_0x5540c3);return _0x1a5ea0[_0x74d8('0x29')](new Buffer(_0x57deda[_0x74d8('0x4a')]));}})[_0x74d8('0x41')](handleError(_0x1a5ea0,null));}; \ No newline at end of file +var _0x9cc9=['limit','set','apply','reject','save','update','then','destroy','name','send','index','VoiceMailMessage','rawAttributes','type','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map','VIRTUAL','merge','options','includeAll','findAll','catch','params','fields','include','find','create','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count'];(function(_0xfb051c,_0x3d140c){var _0x2a7128=function(_0x18c41b){while(--_0x18c41b){_0xfb051c['push'](_0xfb051c['shift']());}};_0x2a7128(++_0x3d140c);}(_0x9cc9,0xe4));var _0x99cc=function(_0x3e0a3c,_0x59ce5b){_0x3e0a3c=_0x3e0a3c-0x0;var _0xe3cf06=_0x9cc9[_0x3e0a3c];return _0xe3cf06;};'use strict';var emlformat=require(_0x99cc('0x0'));var rimraf=require(_0x99cc('0x1'));var zipdir=require(_0x99cc('0x2'));var jsonpatch=require(_0x99cc('0x3'));var rp=require(_0x99cc('0x4'));var moment=require(_0x99cc('0x5'));var BPromise=require(_0x99cc('0x6'));var Mustache=require(_0x99cc('0x7'));var util=require(_0x99cc('0x8'));var path=require(_0x99cc('0x9'));var sox=require(_0x99cc('0xa'));var csv=require(_0x99cc('0xb'));var ejs=require(_0x99cc('0xc'));var fs=require('fs');var fs_extra=require(_0x99cc('0xd'));var _=require(_0x99cc('0xe'));var squel=require(_0x99cc('0xf'));var crypto=require(_0x99cc('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x99cc('0x11'));var toCsv=require(_0x99cc('0xb'));var querystring=require(_0x99cc('0x12'));var Papa=require('papaparse');var Redis=require(_0x99cc('0x13'));var authService=require(_0x99cc('0x14'));var qs=require(_0x99cc('0x15'));var as=require(_0x99cc('0x16'));var hardwareService=require(_0x99cc('0x17'));var logger=require(_0x99cc('0x18'))('api');var utils=require(_0x99cc('0x19'));var config=require(_0x99cc('0x1a'));var licenseUtil=require(_0x99cc('0x1b'));var db=require(_0x99cc('0x1c'))['db'];function respondWithStatusCode(_0x44745e,_0x134460){_0x134460=_0x134460||0xcc;return function(_0x2782fd){if(_0x2782fd){return _0x44745e[_0x99cc('0x1d')](_0x134460);}return _0x44745e[_0x99cc('0x1e')](_0x134460)[_0x99cc('0x1f')]();};}function respondWithResult(_0x3bfc3b,_0x31e177){_0x31e177=_0x31e177||0xc8;return function(_0x29c82a){if(_0x29c82a){return _0x3bfc3b[_0x99cc('0x1e')](_0x31e177)[_0x99cc('0x20')](_0x29c82a);}};}function respondWithFilteredResult(_0x512d2a,_0x332f8d){return function(_0x3597d4){if(_0x3597d4){var _0x5e9933=typeof _0x332f8d[_0x99cc('0x21')]===_0x99cc('0x22')&&typeof _0x332f8d['limit']===_0x99cc('0x22');var _0x5bfcb2=_0x3597d4[_0x99cc('0x23')];var _0x1c57b1=_0x5e9933?0x0:_0x332f8d['offset'];var _0x4b4638=_0x5e9933?_0x3597d4[_0x99cc('0x23')]:_0x332f8d[_0x99cc('0x21')]+_0x332f8d[_0x99cc('0x24')];var _0xd7dbcf;if(_0x4b4638>=_0x5bfcb2){_0x4b4638=_0x5bfcb2;_0xd7dbcf=0xc8;}else{_0xd7dbcf=0xce;}_0x512d2a[_0x99cc('0x1e')](_0xd7dbcf);return _0x512d2a[_0x99cc('0x25')]('Content-Range',_0x1c57b1+'-'+_0x4b4638+'/'+_0x5bfcb2)[_0x99cc('0x20')](_0x3597d4);}return null;};}function patchUpdates(_0x2b05f3){return function(_0x4d4308){try{jsonpatch[_0x99cc('0x26')](_0x4d4308,_0x2b05f3,!![]);}catch(_0x22c7bf){return BPromise[_0x99cc('0x27')](_0x22c7bf);}return _0x4d4308[_0x99cc('0x28')]();};}function saveUpdates(_0x1bc308,_0x4dbf11){return function(_0x4aa1b2){if(_0x4aa1b2){return _0x4aa1b2[_0x99cc('0x29')](_0x1bc308)[_0x99cc('0x2a')](function(_0x596ac2){return _0x596ac2;});}return null;};}function removeEntity(_0x38092b,_0x340df8){return function(_0x26c939){if(_0x26c939){return _0x26c939[_0x99cc('0x2b')]()[_0x99cc('0x2a')](function(){_0x38092b[_0x99cc('0x1e')](0xcc)[_0x99cc('0x1f')]();});}};}function handleEntityNotFound(_0x3d54fb,_0x323540){return function(_0x59beaf){if(!_0x59beaf){_0x3d54fb[_0x99cc('0x1d')](0x194);}return _0x59beaf;};}function handleError(_0x79ccbe,_0x4276ed){_0x4276ed=_0x4276ed||0x1f4;return function(_0xd7744a){logger['error'](_0xd7744a['stack']);if(_0xd7744a[_0x99cc('0x2c')]){delete _0xd7744a[_0x99cc('0x2c')];}_0x79ccbe[_0x99cc('0x1e')](_0x4276ed)[_0x99cc('0x2d')](_0xd7744a);};}exports[_0x99cc('0x2e')]=function(_0x45541a,_0x2e92cd){var _0x292843={},_0x3bcfed={},_0x165630={'count':0x0,'rows':[]};var _0x52421d=_['map'](db[_0x99cc('0x2f')][_0x99cc('0x30')],function(_0x351a81){return{'name':_0x351a81['fieldName'],'type':_0x351a81[_0x99cc('0x31')]['key']};});_0x3bcfed[_0x99cc('0x32')]=_['differenceBy'](_['map'](_0x52421d,'name'),[_0x99cc('0x2c')]);_0x3bcfed[_0x99cc('0x33')]=_[_0x99cc('0x34')](_0x45541a[_0x99cc('0x33')]);_0x3bcfed['filters']=_[_0x99cc('0x35')](_0x3bcfed[_0x99cc('0x32')],_0x3bcfed[_0x99cc('0x33')]);_0x292843[_0x99cc('0x36')]=_['intersection'](_0x3bcfed[_0x99cc('0x32')],qs['fields'](_0x45541a['query']['fields']));_0x292843[_0x99cc('0x36')]=_0x292843[_0x99cc('0x36')][_0x99cc('0x37')]?_0x292843['attributes']:_0x3bcfed['model'];if(!_0x45541a[_0x99cc('0x33')][_0x99cc('0x38')](_0x99cc('0x39'))){_0x292843[_0x99cc('0x24')]=qs['limit'](_0x45541a['query'][_0x99cc('0x24')]);_0x292843['offset']=qs[_0x99cc('0x21')](_0x45541a[_0x99cc('0x33')]['offset']);}_0x292843[_0x99cc('0x3a')]=qs['sort'](_0x45541a[_0x99cc('0x33')][_0x99cc('0x3b')]);_0x292843[_0x99cc('0x3c')]=qs[_0x99cc('0x3d')](_[_0x99cc('0x3e')](_0x45541a[_0x99cc('0x33')],_0x3bcfed['filters']),_0x52421d);if(_0x45541a[_0x99cc('0x33')][_0x99cc('0x3f')]){_0x292843[_0x99cc('0x3c')]=_['merge'](_0x292843['where'],{'$or':_[_0x99cc('0x40')](_0x52421d,function(_0x7c9241){if(_0x7c9241[_0x99cc('0x31')]!==_0x99cc('0x41')){var _0x15f489={};_0x15f489[_0x7c9241[_0x99cc('0x2c')]]={'$like':'%'+_0x45541a[_0x99cc('0x33')][_0x99cc('0x3f')]+'%'};return _0x15f489;}})});}_0x292843=_[_0x99cc('0x42')]({},_0x292843,_0x45541a[_0x99cc('0x43')]);var _0x2e28e7={'where':_0x292843[_0x99cc('0x3c')]};return db[_0x99cc('0x2f')][_0x99cc('0x23')](_0x2e28e7)[_0x99cc('0x2a')](function(_0x343a9b){_0x165630['count']=_0x343a9b;if(_0x45541a[_0x99cc('0x33')][_0x99cc('0x44')]){_0x292843['include']=[{'all':!![]}];}return db[_0x99cc('0x2f')][_0x99cc('0x45')](_0x292843);})['then'](function(_0x3000c3){_0x165630['rows']=_0x3000c3;return _0x165630;})[_0x99cc('0x2a')](respondWithFilteredResult(_0x2e92cd,_0x292843))[_0x99cc('0x46')](handleError(_0x2e92cd,null));};exports['show']=function(_0x3509a5,_0x280246){var _0x42228c={'raw':!![],'where':{'id':_0x3509a5[_0x99cc('0x47')]['id']}},_0x33081f={};_0x33081f[_0x99cc('0x32')]=_[_0x99cc('0x34')](db[_0x99cc('0x2f')]['rawAttributes']);_0x33081f[_0x99cc('0x33')]=_[_0x99cc('0x34')](_0x3509a5['query']);_0x33081f[_0x99cc('0x3d')]=_[_0x99cc('0x35')](_0x33081f[_0x99cc('0x32')],_0x33081f[_0x99cc('0x33')]);_0x42228c[_0x99cc('0x36')]=_[_0x99cc('0x35')](_0x33081f['model'],qs[_0x99cc('0x48')](_0x3509a5[_0x99cc('0x33')]['fields']));_0x42228c[_0x99cc('0x36')]=_0x42228c['attributes']['length']?_0x42228c[_0x99cc('0x36')]:_0x33081f[_0x99cc('0x32')];if(_0x3509a5['query'][_0x99cc('0x44')]){_0x42228c[_0x99cc('0x49')]=[{'all':!![]}];}_0x42228c=_[_0x99cc('0x42')]({},_0x42228c,_0x3509a5[_0x99cc('0x43')]);return db[_0x99cc('0x2f')][_0x99cc('0x4a')](_0x42228c)[_0x99cc('0x2a')](handleEntityNotFound(_0x280246,null))[_0x99cc('0x2a')](respondWithResult(_0x280246,null))[_0x99cc('0x46')](handleError(_0x280246,null));};exports[_0x99cc('0x4b')]=function(_0xdcd3f4,_0x352e42){return db[_0x99cc('0x2f')][_0x99cc('0x4b')](_0xdcd3f4[_0x99cc('0x4c')],{})['then'](respondWithResult(_0x352e42,0xc9))[_0x99cc('0x46')](handleError(_0x352e42,null));};exports[_0x99cc('0x29')]=function(_0x41b729,_0x4940a9){if(_0x41b729[_0x99cc('0x4c')]['id']){delete _0x41b729[_0x99cc('0x4c')]['id'];}return db[_0x99cc('0x2f')][_0x99cc('0x4a')]({'where':{'id':_0x41b729[_0x99cc('0x47')]['id']}})[_0x99cc('0x2a')](handleEntityNotFound(_0x4940a9,null))['then'](saveUpdates(_0x41b729['body'],null))['then'](respondWithResult(_0x4940a9,null))['catch'](handleError(_0x4940a9,null));};exports[_0x99cc('0x2b')]=function(_0x53e238,_0x10fa30){return db[_0x99cc('0x2f')]['find']({'where':{'id':_0x53e238[_0x99cc('0x47')]['id']}})[_0x99cc('0x2a')](handleEntityNotFound(_0x10fa30,null))['then'](removeEntity(_0x10fa30,null))[_0x99cc('0x46')](handleError(_0x10fa30,null));};exports[_0x99cc('0x4d')]=function(_0x1d3d74,_0x7dd0b4,_0xea1f80){return db[_0x99cc('0x2f')][_0x99cc('0x4a')]({'where':{'id':_0x1d3d74[_0x99cc('0x47')]['id']},'attributes':['id',_0x99cc('0x4e'),_0x99cc('0x4f')]})['then'](handleEntityNotFound(_0x7dd0b4,null))[_0x99cc('0x2a')](function(_0x4d76ef){if(_0x4d76ef){if(!_0x4d76ef[_0x99cc('0x4e')]){throw new db[(_0x99cc('0x50'))][(_0x99cc('0x51'))](_0x99cc('0x52'));}var _0x117320={'Content-Type':_0x99cc('0x53'),'Content-Disposition':_0x99cc('0x54')};if(_0x4d76ef['msg_id']){_0x117320[_0x99cc('0x55')]=_0x99cc('0x56')+_0x4d76ef[_0x99cc('0x4f')]+_0x99cc('0x57');}_0x7dd0b4[_0x99cc('0x25')](_0x117320);return _0x7dd0b4[_0x99cc('0x2d')](new Buffer(_0x4d76ef['recording']));}})[_0x99cc('0x46')](handleError(_0x7dd0b4,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 5e2aa15..9e92acc 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 _0xea5f=['rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5b881c,_0x2901b2){var _0x18afb4=function(_0x1107b0){while(--_0x1107b0){_0x5b881c['push'](_0x5b881c['shift']());}};_0x18afb4(++_0x2901b2);}(_0xea5f,0x149));var _0xfea5=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0xea5f[_0x1992f1];return _0x413dfe;};'use strict';var _=require(_0xfea5('0x0'));var util=require('util');var logger=require(_0xfea5('0x1'))(_0xfea5('0x2'));var moment=require(_0xfea5('0x3'));var BPromise=require(_0xfea5('0x4'));var rp=require(_0xfea5('0x5'));var fs=require('fs');var path=require(_0xfea5('0x6'));var rimraf=require(_0xfea5('0x7'));var config=require(_0xfea5('0x8'));var attributes=require(_0xfea5('0x9'));module[_0xfea5('0xa')]=function(_0x4415af,_0x39a7ef){return _0x4415af[_0xfea5('0xb')](_0xfea5('0xc'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xfea5('0xd'),'fields':[_0xfea5('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x849a=['VoiceMailMessage','voice_voicemail_messages','dir','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports'];(function(_0x1e785f,_0x2e3ff0){var _0x3d2a10=function(_0x88b66d){while(--_0x88b66d){_0x1e785f['push'](_0x1e785f['shift']());}};_0x3d2a10(++_0x2e3ff0);}(_0x849a,0x7b));var _0xa849=function(_0x4e1c9c,_0x30f213){_0x4e1c9c=_0x4e1c9c-0x0;var _0x584041=_0x849a[_0x4e1c9c];return _0x584041;};'use strict';var _=require(_0xa849('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa849('0x1'));var moment=require(_0xa849('0x2'));var BPromise=require(_0xa849('0x3'));var rp=require(_0xa849('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa849('0x5'));var config=require(_0xa849('0x6'));var attributes=require(_0xa849('0x7'));module[_0xa849('0x8')]=function(_0x47c213,_0x1adc6c){return _0x47c213['define'](_0xa849('0x9'),attributes,{'tableName':_0xa849('0xa'),'paranoid':![],'indexes':[{'name':_0xa849('0xb'),'fields':[_0xa849('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index eea9a8b..8b55609 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 _0x8b3f=['VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x57b504,_0x59e754){var _0x52cc59=function(_0x41821f){while(--_0x41821f){_0x57b504['push'](_0x57b504['shift']());}};_0x52cc59(++_0x59e754);}(_0x8b3f,0x1a7));var _0xf8b3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8b3f[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xf8b3('0x0'));var util=require(_0xf8b3('0x1'));var moment=require(_0xf8b3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf8b3('0x3'));var db=require(_0xf8b3('0x4'))['db'];var utils=require(_0xf8b3('0x5'));var logger=require(_0xf8b3('0x6'))(_0xf8b3('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8b3('0x8'));var client=jayson[_0xf8b3('0x9')][_0xf8b3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55f253,_0x266bd5,_0x544ad9){return new BPromise(function(_0xab065f,_0x504cf4){return client[_0xf8b3('0xb')](_0x55f253,_0x544ad9)[_0xf8b3('0xc')](function(_0xeb288){logger[_0xf8b3('0xd')](_0xf8b3('0xe'),_0x266bd5,'request\x20sent');logger[_0xf8b3('0xf')](_0xf8b3('0x10'),_0x266bd5,_0xf8b3('0x11'),JSON['stringify'](_0xeb288));if(_0xeb288['error']){if(_0xeb288['error'][_0xf8b3('0x12')]===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x266bd5,_0xeb288[_0xf8b3('0x13')][_0xf8b3('0x14')]);return _0x504cf4(_0xeb288['error'][_0xf8b3('0x14')]);}logger[_0xf8b3('0x13')](_0xf8b3('0xe'),_0x266bd5,_0xeb288['error']['message']);return _0xab065f(_0xeb288[_0xf8b3('0x13')][_0xf8b3('0x14')]);}else{logger[_0xf8b3('0xd')](_0xf8b3('0xe'),_0x266bd5,_0xf8b3('0x11'));_0xab065f(_0xeb288[_0xf8b3('0x15')][_0xf8b3('0x14')]);}})[_0xf8b3('0x16')](function(_0x35bb75){logger[_0xf8b3('0x13')](_0xf8b3('0xe'),_0x266bd5,_0x35bb75);_0x504cf4(_0x35bb75);});});} \ No newline at end of file +var _0xd3de=['http','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x56945d,_0xc6d2d3){var _0x394437=function(_0x53d1b0){while(--_0x53d1b0){_0x56945d['push'](_0x56945d['shift']());}};_0x394437(++_0xc6d2d3);}(_0xd3de,0x108));var _0xed3d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3de[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xed3d('0x0'));var BPromise=require('bluebird');var rs=require(_0xed3d('0x1'));var fs=require('fs');var Redis=require(_0xed3d('0x2'));var db=require(_0xed3d('0x3'))['db'];var utils=require(_0xed3d('0x4'));var logger=require(_0xed3d('0x5'))('rpc');var config=require(_0xed3d('0x6'));var jayson=require(_0xed3d('0x7'));var client=jayson[_0xed3d('0x8')][_0xed3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x455d59,_0x1c1b4a,_0x1ec8d2){return new BPromise(function(_0x3dd23c,_0x3c8320){return client[_0xed3d('0xa')](_0x455d59,_0x1ec8d2)[_0xed3d('0xb')](function(_0x1b50d3){logger['info'](_0xed3d('0xc'),_0x1c1b4a,_0xed3d('0xd'));logger[_0xed3d('0xe')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x1c1b4a,'request\x20sent',JSON[_0xed3d('0xf')](_0x1b50d3));if(_0x1b50d3[_0xed3d('0x10')]){if(_0x1b50d3[_0xed3d('0x10')][_0xed3d('0x11')]===0x1f4){logger['error'](_0xed3d('0xc'),_0x1c1b4a,_0x1b50d3['error']['message']);return _0x3c8320(_0x1b50d3['error']['message']);}logger[_0xed3d('0x10')](_0xed3d('0xc'),_0x1c1b4a,_0x1b50d3[_0xed3d('0x10')][_0xed3d('0x12')]);return _0x3dd23c(_0x1b50d3[_0xed3d('0x10')][_0xed3d('0x12')]);}else{logger[_0xed3d('0x13')](_0xed3d('0xc'),_0x1c1b4a,_0xed3d('0xd'));_0x3dd23c(_0x1b50d3[_0xed3d('0x14')][_0xed3d('0x12')]);}})['catch'](function(_0x327512){logger[_0xed3d('0x10')](_0xed3d('0xc'),_0x1c1b4a,_0x327512);_0x3c8320(_0x327512);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index ebaaf86..5796d3e 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 _0x9cfd=['/:id/sounds/:id2','removeSound','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','show','/:id/sounds','getSounds','post','isAuthenticated','addSound','put','update','delete','/:id'];(function(_0x18607d,_0x3f2bbf){var _0x12a81a=function(_0xb104fb){while(--_0xb104fb){_0x18607d['push'](_0x18607d['shift']());}};_0x12a81a(++_0x3f2bbf);}(_0x9cfd,0x121));var _0xd9cf=function(_0x348985,_0x29b4f5){_0x348985=_0x348985-0x0;var _0x1a7aef=_0x9cfd[_0x348985];return _0x1a7aef;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd9cf('0x0'));var express=require(_0xd9cf('0x1'));var router=express[_0xd9cf('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xd9cf('0x3'));var interaction=require(_0xd9cf('0x4'));var config=require(_0xd9cf('0x5'));var controller=require(_0xd9cf('0x6'));router[_0xd9cf('0x7')]('/',auth['isAuthenticated'](),controller[_0xd9cf('0x8')]);router[_0xd9cf('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xd9cf('0x9')]);router[_0xd9cf('0x7')](_0xd9cf('0xa'),auth['isAuthenticated'](),controller[_0xd9cf('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd9cf('0xc')](_0xd9cf('0xa'),auth[_0xd9cf('0xd')](),controller[_0xd9cf('0xe')]);router[_0xd9cf('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xd9cf('0x10')]);router[_0xd9cf('0x11')](_0xd9cf('0x12'),auth[_0xd9cf('0xd')](),controller['destroy']);router['delete'](_0xd9cf('0x13'),auth[_0xd9cf('0xd')](),controller[_0xd9cf('0x14')]);module[_0xd9cf('0x15')]=router; \ No newline at end of file +var _0x0c30=['getSounds','post','create','addSound','put','/:id','update','destroy','/:id/sounds/:id2','removeSound','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','get','/:id/sounds'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c30,0x192));var _0x00c3=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x0c30[_0xf51c06];return _0x1d5420;};'use strict';var multer=require('multer');var util=require(_0x00c3('0x0'));var path=require('path');var timeout=require(_0x00c3('0x1'));var express=require(_0x00c3('0x2'));var router=express[_0x00c3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x00c3('0x4'));var interaction=require(_0x00c3('0x5'));var config=require(_0x00c3('0x6'));var controller=require(_0x00c3('0x7'));router['get']('/',auth[_0x00c3('0x8')](),controller[_0x00c3('0x9')]);router['get']('/:id',auth[_0x00c3('0x8')](),controller['show']);router[_0x00c3('0xa')](_0x00c3('0xb'),auth['isAuthenticated'](),controller[_0x00c3('0xc')]);router[_0x00c3('0xd')]('/',auth[_0x00c3('0x8')](),controller[_0x00c3('0xe')]);router['post'](_0x00c3('0xb'),auth[_0x00c3('0x8')](),controller[_0x00c3('0xf')]);router[_0x00c3('0x10')](_0x00c3('0x11'),auth[_0x00c3('0x8')](),controller[_0x00c3('0x12')]);router['delete']('/:id',auth[_0x00c3('0x8')](),controller[_0x00c3('0x13')]);router['delete'](_0x00c3('0x14'),auth[_0x00c3('0x8')](),controller[_0x00c3('0x15')]);module[_0x00c3('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 6de3d16..0d99cbc 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 _0x3aea=['ENUM','mp3nb','mp3','files','STRING','alpha','BOOLEAN','sequelize','exports','name'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x3aea,0x101));var _0xa3ae=function(_0x5aec9a,_0x288db2){_0x5aec9a=_0x5aec9a-0x0;var _0x2fc104=_0x3aea[_0x5aec9a];return _0x2fc104;};'use strict';var Sequelize=require(_0xa3ae('0x0'));module[_0xa3ae('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa3ae('0x2')},'mode':{'type':Sequelize[_0xa3ae('0x3')]('custom','files',_0xa3ae('0x4'),'quietmp3nb','quietmp3',_0xa3ae('0x5')),'allowNull':!![],'defaultValue':_0xa3ae('0x6')},'directory':{'type':Sequelize[_0xa3ae('0x7')],'allowNull':!![]},'application':{'type':Sequelize[_0xa3ae('0x7')],'allowNull':!![]},'digit':{'type':Sequelize[_0xa3ae('0x7')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xa3ae('0x8')},'format':{'type':Sequelize[_0xa3ae('0x7')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xa3ae('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5557=['quietmp3','mp3','alpha','BOOLEAN','sequelize','exports','STRING','custom','files','mp3nb'];(function(_0x5e935f,_0x18d31a){var _0x1fd3fc=function(_0xf61b38){while(--_0xf61b38){_0x5e935f['push'](_0x5e935f['shift']());}};_0x1fd3fc(++_0x18d31a);}(_0x5557,0x72));var _0x7555=function(_0x1faf34,_0x5a96e7){_0x1faf34=_0x1faf34-0x0;var _0x294624=_0x5557[_0x1faf34];return _0x294624;};'use strict';var Sequelize=require(_0x7555('0x0'));module[_0x7555('0x1')]={'name':{'type':Sequelize[_0x7555('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0x7555('0x3'),_0x7555('0x4'),_0x7555('0x5'),'quietmp3nb',_0x7555('0x6'),_0x7555('0x7')),'allowNull':!![],'defaultValue':_0x7555('0x4')},'directory':{'type':Sequelize[_0x7555('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x7555('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x7555('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x7555('0x2')],'allowNull':!![],'defaultValue':_0x7555('0x8')},'format':{'type':Sequelize[_0x7555('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x7555('0x9')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 4a9a81c..27d3113 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 _0xb148=['message','addSound','Sound','findOne','save_name','converted_format','root','server/files/sounds/converted','format','%s.%s','basename','extname','server/files/moh','symlinkSync','Sequelize','removeSound','id2','createdAt','getSounds','nolimit','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/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','MusicOnHolds','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','options','find','body','create','sequelize','transaction','mode','files','directory','join','mkdirSync','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','unlinkSync','rmdirSync','ValidationError'];(function(_0x44b091,_0x454188){var _0x31d0b8=function(_0x4bd385){while(--_0x4bd385){_0x44b091['push'](_0x44b091['shift']());}};_0x31d0b8(++_0x454188);}(_0xb148,0x1e0));var _0x8b14=function(_0x320b8e,_0x1da3fe){_0x320b8e=_0x320b8e-0x0;var _0x55a10a=_0xb148[_0x320b8e];return _0x55a10a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b14('0x0'));var zipdir=require(_0x8b14('0x1'));var jsonpatch=require(_0x8b14('0x2'));var rp=require(_0x8b14('0x3'));var moment=require(_0x8b14('0x4'));var BPromise=require(_0x8b14('0x5'));var Mustache=require(_0x8b14('0x6'));var util=require(_0x8b14('0x7'));var path=require(_0x8b14('0x8'));var sox=require(_0x8b14('0x9'));var csv=require(_0x8b14('0xa'));var ejs=require(_0x8b14('0xb'));var fs=require('fs');var fs_extra=require(_0x8b14('0xc'));var _=require('lodash');var squel=require(_0x8b14('0xd'));var crypto=require(_0x8b14('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8b14('0xf'));var toCsv=require(_0x8b14('0xa'));var querystring=require(_0x8b14('0x10'));var Papa=require(_0x8b14('0x11'));var Redis=require('ioredis');var authService=require(_0x8b14('0x12'));var qs=require(_0x8b14('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b14('0x14'))(_0x8b14('0x15'));var utils=require(_0x8b14('0x16'));var config=require(_0x8b14('0x17'));var licenseUtil=require(_0x8b14('0x18'));var db=require(_0x8b14('0x19'))['db'];function respondWithStatusCode(_0x1ff909,_0x2f3c9d){_0x2f3c9d=_0x2f3c9d||0xcc;return function(_0x53cca3){if(_0x53cca3){return _0x1ff909[_0x8b14('0x1a')](_0x2f3c9d);}return _0x1ff909[_0x8b14('0x1b')](_0x2f3c9d)[_0x8b14('0x1c')]();};}function respondWithResult(_0x5f0f9a,_0xa8e70d){_0xa8e70d=_0xa8e70d||0xc8;return function(_0x1c001e){if(_0x1c001e){return _0x5f0f9a[_0x8b14('0x1b')](_0xa8e70d)[_0x8b14('0x1d')](_0x1c001e);}};}function respondWithFilteredResult(_0x231e8c,_0x97fddf){return function(_0x697a24){if(_0x697a24){var _0x1274a9=typeof _0x97fddf[_0x8b14('0x1e')]==='undefined'&&typeof _0x97fddf[_0x8b14('0x1f')]===_0x8b14('0x20');var _0x232582=_0x697a24[_0x8b14('0x21')];var _0x4b2d66=_0x1274a9?0x0:_0x97fddf[_0x8b14('0x1e')];var _0x3573c6=_0x1274a9?_0x697a24[_0x8b14('0x21')]:_0x97fddf['offset']+_0x97fddf['limit'];var _0x2af86b;if(_0x3573c6>=_0x232582){_0x3573c6=_0x232582;_0x2af86b=0xc8;}else{_0x2af86b=0xce;}_0x231e8c[_0x8b14('0x1b')](_0x2af86b);return _0x231e8c[_0x8b14('0x22')]('Content-Range',_0x4b2d66+'-'+_0x3573c6+'/'+_0x232582)['json'](_0x697a24);}return null;};}function patchUpdates(_0x34c572){return function(_0xc867e5){try{jsonpatch[_0x8b14('0x23')](_0xc867e5,_0x34c572,!![]);}catch(_0x38f92f){return BPromise['reject'](_0x38f92f);}return _0xc867e5[_0x8b14('0x24')]();};}function saveUpdates(_0x44df3c,_0x11d9d3){return function(_0x85b605){if(_0x85b605){return _0x85b605[_0x8b14('0x25')](_0x44df3c)[_0x8b14('0x26')](function(_0x143bf1){return _0x143bf1;});}return null;};}function removeEntity(_0x18af78,_0x4182c3){return function(_0x25e89b){if(_0x25e89b){return _0x25e89b[_0x8b14('0x27')]()[_0x8b14('0x26')](function(){var _0x7e498c=_0x25e89b['get']({'plain':!![]});var _0x4884b0=_0x8b14('0x28');return db[_0x8b14('0x29')][_0x8b14('0x27')]({'where':{'type':_0x4884b0,'resourceId':_0x7e498c['id']}})[_0x8b14('0x26')](function(){return _0x25e89b;});})[_0x8b14('0x26')](function(){_0x18af78[_0x8b14('0x1b')](0xcc)[_0x8b14('0x1c')]();});}};}function handleEntityNotFound(_0x4de4ca,_0x4db950){return function(_0x2f1ef9){if(!_0x2f1ef9){_0x4de4ca[_0x8b14('0x1a')](0x194);}return _0x2f1ef9;};}function handleError(_0x2fffae,_0x4ced54){_0x4ced54=_0x4ced54||0x1f4;return function(_0x5e9b98){logger[_0x8b14('0x2a')](_0x5e9b98[_0x8b14('0x2b')]);if(_0x5e9b98['name']){delete _0x5e9b98[_0x8b14('0x2c')];}_0x2fffae[_0x8b14('0x1b')](_0x4ced54)[_0x8b14('0x2d')](_0x5e9b98);};}exports[_0x8b14('0x2e')]=function(_0x4ec74b,_0x3290b0){var _0x118c97={},_0x1cb8ec={},_0x4eb997={'count':0x0,'rows':[]};var _0x5cd6ca=_[_0x8b14('0x2f')](db[_0x8b14('0x30')][_0x8b14('0x31')],function(_0x18dd94){return{'name':_0x18dd94['fieldName'],'type':_0x18dd94[_0x8b14('0x32')][_0x8b14('0x33')]};});_0x1cb8ec[_0x8b14('0x34')]=_[_0x8b14('0x2f')](_0x5cd6ca,_0x8b14('0x2c'));_0x1cb8ec[_0x8b14('0x35')]=_[_0x8b14('0x36')](_0x4ec74b[_0x8b14('0x35')]);_0x1cb8ec[_0x8b14('0x37')]=_[_0x8b14('0x38')](_0x1cb8ec[_0x8b14('0x34')],_0x1cb8ec[_0x8b14('0x35')]);_0x118c97[_0x8b14('0x39')]=_[_0x8b14('0x38')](_0x1cb8ec['model'],qs[_0x8b14('0x3a')](_0x4ec74b[_0x8b14('0x35')][_0x8b14('0x3a')]));_0x118c97[_0x8b14('0x39')]=_0x118c97[_0x8b14('0x39')][_0x8b14('0x3b')]?_0x118c97[_0x8b14('0x39')]:_0x1cb8ec[_0x8b14('0x34')];if(!_0x4ec74b[_0x8b14('0x35')][_0x8b14('0x3c')]('nolimit')){_0x118c97[_0x8b14('0x1f')]=qs[_0x8b14('0x1f')](_0x4ec74b['query'][_0x8b14('0x1f')]);_0x118c97[_0x8b14('0x1e')]=qs[_0x8b14('0x1e')](_0x4ec74b[_0x8b14('0x35')][_0x8b14('0x1e')]);}_0x118c97[_0x8b14('0x3d')]=qs[_0x8b14('0x3e')](_0x4ec74b['query'][_0x8b14('0x3e')]);delete _0x4ec74b[_0x8b14('0x35')][_0x8b14('0x3e')];_0x118c97[_0x8b14('0x3f')]=qs[_0x8b14('0x37')](_[_0x8b14('0x40')](_0x4ec74b[_0x8b14('0x35')],_0x1cb8ec[_0x8b14('0x37')]),_0x5cd6ca);if(_0x4ec74b[_0x8b14('0x35')][_0x8b14('0x41')]){_0x118c97[_0x8b14('0x3f')]=_[_0x8b14('0x42')](_0x118c97[_0x8b14('0x3f')],{'$or':_[_0x8b14('0x2f')](_0x5cd6ca,function(_0xa4369f){if(_0xa4369f[_0x8b14('0x32')]!=='VIRTUAL'){var _0x56faba={};_0x56faba[_0xa4369f[_0x8b14('0x2c')]]={'$like':'%'+_0x4ec74b[_0x8b14('0x35')]['filter']+'%'};return _0x56faba;}})});}_0x118c97=_[_0x8b14('0x42')]({},_0x118c97,_0x4ec74b['options']);var _0x5a467b={'where':_0x118c97[_0x8b14('0x3f')]};return db[_0x8b14('0x30')][_0x8b14('0x21')](_0x5a467b)[_0x8b14('0x26')](function(_0x4cd8b0){_0x4eb997['count']=_0x4cd8b0;if(_0x4ec74b['query'][_0x8b14('0x43')]){_0x118c97[_0x8b14('0x44')]=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x118c97);})[_0x8b14('0x26')](function(_0x15af09){_0x4eb997[_0x8b14('0x45')]=_0x15af09;return _0x4eb997;})['then'](respondWithFilteredResult(_0x3290b0,_0x118c97))[_0x8b14('0x46')](handleError(_0x3290b0,null));};exports[_0x8b14('0x47')]=function(_0x2c2fd5,_0x42a5b3){var _0xc797b7={'raw':![],'where':{'id':_0x2c2fd5[_0x8b14('0x48')]['id']}},_0x25d273={};_0x25d273[_0x8b14('0x34')]=_[_0x8b14('0x36')](db[_0x8b14('0x30')][_0x8b14('0x31')]);_0x25d273[_0x8b14('0x35')]=_[_0x8b14('0x36')](_0x2c2fd5[_0x8b14('0x35')]);_0x25d273[_0x8b14('0x37')]=_['intersection'](_0x25d273[_0x8b14('0x34')],_0x25d273['query']);_0xc797b7[_0x8b14('0x39')]=_[_0x8b14('0x38')](_0x25d273['model'],qs[_0x8b14('0x3a')](_0x2c2fd5['query'][_0x8b14('0x3a')]));_0xc797b7[_0x8b14('0x39')]=_0xc797b7[_0x8b14('0x39')]['length']?_0xc797b7['attributes']:_0x25d273[_0x8b14('0x34')];if(_0x2c2fd5[_0x8b14('0x35')][_0x8b14('0x43')]){_0xc797b7['include']=[{'all':!![]}];}_0xc797b7=_[_0x8b14('0x42')]({},_0xc797b7,_0x2c2fd5[_0x8b14('0x49')]);return db[_0x8b14('0x30')][_0x8b14('0x4a')](_0xc797b7)['then'](handleEntityNotFound(_0x42a5b3,null))[_0x8b14('0x26')](respondWithResult(_0x42a5b3,null))['catch'](handleError(_0x42a5b3,null));};exports['update']=function(_0x1fdf87,_0x3cf41a){if(_0x1fdf87[_0x8b14('0x4b')]['id']){delete _0x1fdf87[_0x8b14('0x4b')]['id'];}return db['VoiceMusicOnHold'][_0x8b14('0x4a')]({'where':{'id':_0x1fdf87[_0x8b14('0x48')]['id']}})[_0x8b14('0x26')](handleEntityNotFound(_0x3cf41a,null))[_0x8b14('0x26')](saveUpdates(_0x1fdf87['body'],null))[_0x8b14('0x26')](respondWithResult(_0x3cf41a,null))[_0x8b14('0x46')](handleError(_0x3cf41a,null));};exports[_0x8b14('0x4c')]=function(_0x1d38df,_0x4cdda5,_0x49e41c){return db[_0x8b14('0x4d')][_0x8b14('0x4e')](function(_0x3be656){if(_0x1d38df[_0x8b14('0x4b')][_0x8b14('0x4f')]===_0x8b14('0x50')){_0x1d38df[_0x8b14('0x4b')][_0x8b14('0x51')]=path[_0x8b14('0x52')](config['root'],'server/files/moh',_0x1d38df[_0x8b14('0x4b')]['name']);}return db['VoiceMusicOnHold'][_0x8b14('0x4c')](_0x1d38df[_0x8b14('0x4b')],{'transaction':_0x3be656})[_0x8b14('0x26')](function(_0x14f2bc){if(_0x1d38df[_0x8b14('0x4b')][_0x8b14('0x4f')]==='files'){fs[_0x8b14('0x53')](_0x14f2bc[_0x8b14('0x51')],parseInt(_0x8b14('0x54'),0x8));}var _0x449008=_0x1d38df[_0x8b14('0x55')][_0x8b14('0x56')]({'plain':!![]});if(!_0x449008)throw new Error(_0x8b14('0x57'));if(_0x449008['role']===_0x8b14('0x55')){var _0x1bde49=_0x14f2bc[_0x8b14('0x56')]({'plain':!![]});return db['UserProfileSection'][_0x8b14('0x4a')]({'where':{'name':'MusicOnHolds','userProfileId':_0x449008[_0x8b14('0x58')]},'raw':!![]})[_0x8b14('0x26')](function(_0xdf24){if(_0xdf24&&_0xdf24[_0x8b14('0x59')]===0x0){return db[_0x8b14('0x29')][_0x8b14('0x4c')]({'name':_0x1bde49['name'],'resourceId':_0x1bde49['id'],'type':_0xdf24[_0x8b14('0x2c')],'sectionId':_0xdf24['id']},{})[_0x8b14('0x26')](function(){return _0x14f2bc;});}else{return _0x14f2bc;}})[_0x8b14('0x46')](function(_0x1d120f){logger[_0x8b14('0x2a')](_0x8b14('0x5a'),_0x1d120f);});}return _0x14f2bc;});})[_0x8b14('0x26')](respondWithResult(_0x4cdda5,0xc9))['catch'](handleError(_0x4cdda5,null));};exports['destroy']=function(_0x434504,_0x41b5fa,_0x3d72b5){var _0x49432d;return db[_0x8b14('0x30')][_0x8b14('0x4a')]({'where':{'id':_0x434504[_0x8b14('0x48')]['id']}})[_0x8b14('0x26')](function(_0x486b77){if(_0x486b77){return db[_0x8b14('0x4d')][_0x8b14('0x4e')](function(_0xd49241){return _0x486b77[_0x8b14('0x27')]({'transaction':_0xd49241,'raw':!![]})[_0x8b14('0x26')](function(_0x54b5be){if(_0x54b5be[_0x8b14('0x51')]){fs[_0x8b14('0x5b')](_0x54b5be[_0x8b14('0x51')])['forEach'](function(_0x236483){fs[_0x8b14('0x5c')](path[_0x8b14('0x52')](_0x54b5be[_0x8b14('0x51')],_0x236483));});fs[_0x8b14('0x5d')](_0x54b5be[_0x8b14('0x51')]);}return _0x54b5be;});})['catch'](function(_0xa99487){throw new db['Sequelize'][(_0x8b14('0x5e'))](_0xa99487[_0x8b14('0x5f')]);});}})[_0x8b14('0x26')](handleEntityNotFound(_0x41b5fa,null))[_0x8b14('0x26')](removeEntity(_0x41b5fa,null))[_0x8b14('0x46')](handleError(_0x41b5fa,null));};exports[_0x8b14('0x60')]=function(_0x38aa5d,_0x4e1cf9,_0x39271b){return db[_0x8b14('0x4d')][_0x8b14('0x4e')](function(_0x254680){var _0x27016e;return db[_0x8b14('0x30')][_0x8b14('0x4a')]({'where':{'id':_0x38aa5d[_0x8b14('0x48')]['id']}})[_0x8b14('0x26')](function(_0x464f2f){if(_0x464f2f){_0x27016e=_0x464f2f;return _0x464f2f['addSound'](_0x38aa5d['body']['id'],{'transaction':_0x254680});}})[_0x8b14('0x26')](function(_0x4574b2){if(_0x4574b2){return db[_0x8b14('0x61')][_0x8b14('0x62')]({'where':{'id':_0x38aa5d[_0x8b14('0x4b')]['id']},'attributes':['id',_0x8b14('0x2c'),_0x8b14('0x63'),_0x8b14('0x64'),'createdAt'],'raw':!![]});}})[_0x8b14('0x26')](function(_0x4e398e){if(_0x4e398e){var _0x54b8aa=path[_0x8b14('0x52')](config[_0x8b14('0x65')],_0x8b14('0x66'),util[_0x8b14('0x67')](_0x8b14('0x68'),path[_0x8b14('0x69')](_0x4e398e[_0x8b14('0x63')],path[_0x8b14('0x6a')](_0x4e398e[_0x8b14('0x63')])),_0x4e398e[_0x8b14('0x64')]));var _0x140143=path[_0x8b14('0x52')](config['root'],_0x8b14('0x6b'),_0x27016e['name'],util[_0x8b14('0x67')](_0x8b14('0x68'),_0x4e398e['name'],_0x4e398e[_0x8b14('0x64')]));fs[_0x8b14('0x6c')](_0x54b8aa,_0x140143);return _0x4e398e;}})[_0x8b14('0x46')](function(_0x4fd764){throw new db[(_0x8b14('0x6d'))]['ValidationError'](_0x4fd764[_0x8b14('0x5f')]);});})[_0x8b14('0x26')](handleEntityNotFound(_0x4e1cf9,null))[_0x8b14('0x26')](respondWithResult(_0x4e1cf9,0xc9))[_0x8b14('0x46')](handleError(_0x4e1cf9,null));};exports[_0x8b14('0x6e')]=function(_0x4dfdc4,_0x4888a8,_0x4d42ad){return db[_0x8b14('0x4d')][_0x8b14('0x4e')](function(_0x59997f){var _0x2b10aa;return db[_0x8b14('0x30')][_0x8b14('0x62')]({'where':{'id':_0x4dfdc4[_0x8b14('0x48')]['id']}})[_0x8b14('0x26')](handleEntityNotFound(_0x4888a8,null))['then'](function(_0x3cdfba){if(_0x3cdfba){_0x2b10aa=_0x3cdfba;return _0x3cdfba[_0x8b14('0x6e')](_0x4dfdc4[_0x8b14('0x48')][_0x8b14('0x6f')]);}})['then'](function(_0x42fec9){if(_0x42fec9){return db[_0x8b14('0x61')]['findOne']({'where':{'id':_0x4dfdc4[_0x8b14('0x48')]['id2']},'attributes':['id',_0x8b14('0x2c'),'save_name',_0x8b14('0x64'),_0x8b14('0x70')],'raw':!![]});}})[_0x8b14('0x26')](function(_0x434a4b){if(_0x434a4b){fs[_0x8b14('0x5c')](path['join'](_0x2b10aa['directory'],util[_0x8b14('0x67')]('%s.%s',_0x434a4b[_0x8b14('0x2c')],_0x434a4b[_0x8b14('0x64')])));return _0x434a4b;}})[_0x8b14('0x46')](function(_0x353634){throw new db[(_0x8b14('0x6d'))][(_0x8b14('0x5e'))](_0x353634['message']);});})['then'](handleEntityNotFound(_0x4888a8,null))[_0x8b14('0x26')](respondWithStatusCode(_0x4888a8,0xcc))[_0x8b14('0x46')](handleError(_0x4888a8,null));};exports['getSounds']=function(_0x1e46e9,_0x414e24,_0x5230ba){var _0x49ca84={};var _0x116759={};var _0x271245;var _0x1197ed;return db[_0x8b14('0x30')]['findOne']({'where':{'id':_0x1e46e9[_0x8b14('0x48')]['id']}})[_0x8b14('0x26')](handleEntityNotFound(_0x414e24,null))[_0x8b14('0x26')](function(_0x412113){if(_0x412113){_0x271245=_0x412113;_0x116759[_0x8b14('0x34')]=_['keys'](db[_0x8b14('0x61')][_0x8b14('0x31')]);_0x116759[_0x8b14('0x35')]=_[_0x8b14('0x36')](_0x1e46e9[_0x8b14('0x35')]);_0x116759[_0x8b14('0x37')]=_[_0x8b14('0x38')](_0x116759[_0x8b14('0x34')],_0x116759['query']);_0x49ca84[_0x8b14('0x39')]=_[_0x8b14('0x38')](_0x116759[_0x8b14('0x34')],qs['fields'](_0x1e46e9['query'][_0x8b14('0x3a')]));_0x49ca84[_0x8b14('0x39')]=_0x49ca84[_0x8b14('0x39')]['length']?_0x49ca84[_0x8b14('0x39')]:_0x116759[_0x8b14('0x34')];_0x49ca84[_0x8b14('0x3d')]=qs[_0x8b14('0x3e')](_0x1e46e9[_0x8b14('0x35')][_0x8b14('0x3e')]);_0x49ca84['where']=qs[_0x8b14('0x37')](_['pick'](_0x1e46e9['query'],_0x116759[_0x8b14('0x37')]));if(_0x1e46e9[_0x8b14('0x35')]['filter']){_0x49ca84[_0x8b14('0x3f')]=_[_0x8b14('0x42')](_0x49ca84['where'],{'$or':_[_0x8b14('0x2f')](_0x49ca84[_0x8b14('0x39')],function(_0x1c37b7){var _0x4fecae={};_0x4fecae[_0x1c37b7]={'$like':'%'+_0x1e46e9['query'][_0x8b14('0x41')]+'%'};return _0x4fecae;})});}_0x49ca84=_[_0x8b14('0x42')]({},_0x49ca84,_0x1e46e9['options']);return _0x271245[_0x8b14('0x71')](_0x49ca84);}})[_0x8b14('0x26')](function(_0x3a49f0){if(_0x3a49f0){_0x1197ed=_0x3a49f0[_0x8b14('0x3b')];if(!_0x1e46e9['query'][_0x8b14('0x3c')](_0x8b14('0x72'))){_0x49ca84['limit']=qs['limit'](_0x1e46e9[_0x8b14('0x35')][_0x8b14('0x1f')]);_0x49ca84['offset']=qs[_0x8b14('0x1e')](_0x1e46e9[_0x8b14('0x35')][_0x8b14('0x1e')]);}return _0x271245[_0x8b14('0x71')](_0x49ca84);}})['then'](function(_0x4ae898){if(_0x4ae898){return _0x4ae898?{'count':_0x1197ed,'rows':_0x4ae898}:null;}})[_0x8b14('0x26')](respondWithResult(_0x414e24,null))[_0x8b14('0x46')](handleError(_0x414e24,null));}; \ No newline at end of file +var _0xdf77=['then','destroy','MusicOnHolds','UserProfileResource','end','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','keys','update','body','params','sequelize','transaction','mode','directory','root','server/files/moh','files','mkdirSync','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','autoAssociation','create','readdirSync','forEach','unlinkSync','join','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','symlinkSync','removeSound','id2','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','offset','count','limit','Content-Range','json','apply','reject','save'];(function(_0x21b232,_0x1b9b77){var _0x54a541=function(_0x466d43){while(--_0x466d43){_0x21b232['push'](_0x21b232['shift']());}};_0x54a541(++_0x1b9b77);}(_0xdf77,0x18b));var _0x7df7=function(_0x38f0e8,_0x4a0681){_0x38f0e8=_0x38f0e8-0x0;var _0x514c0d=_0xdf77[_0x38f0e8];return _0x514c0d;};'use strict';var emlformat=require(_0x7df7('0x0'));var rimraf=require(_0x7df7('0x1'));var zipdir=require(_0x7df7('0x2'));var jsonpatch=require(_0x7df7('0x3'));var rp=require(_0x7df7('0x4'));var moment=require(_0x7df7('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7df7('0x6'));var path=require(_0x7df7('0x7'));var sox=require(_0x7df7('0x8'));var csv=require(_0x7df7('0x9'));var ejs=require(_0x7df7('0xa'));var fs=require('fs');var fs_extra=require(_0x7df7('0xb'));var _=require(_0x7df7('0xc'));var squel=require(_0x7df7('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7df7('0x9'));var querystring=require(_0x7df7('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7df7('0xf'));var logger=require(_0x7df7('0x10'))(_0x7df7('0x11'));var utils=require('../../config/utils');var config=require(_0x7df7('0x12'));var licenseUtil=require(_0x7df7('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3745d7,_0x1b9990){_0x1b9990=_0x1b9990||0xcc;return function(_0x39210e){if(_0x39210e){return _0x3745d7['sendStatus'](_0x1b9990);}return _0x3745d7[_0x7df7('0x14')](_0x1b9990)['end']();};}function respondWithResult(_0x5720da,_0x210c8d){_0x210c8d=_0x210c8d||0xc8;return function(_0xff73dd){if(_0xff73dd){return _0x5720da[_0x7df7('0x14')](_0x210c8d)['json'](_0xff73dd);}};}function respondWithFilteredResult(_0x2aefdb,_0x1a9aa8){return function(_0x58f206){if(_0x58f206){var _0x297ef3=typeof _0x1a9aa8[_0x7df7('0x15')]==='undefined'&&typeof _0x1a9aa8['limit']==='undefined';var _0x3d0296=_0x58f206[_0x7df7('0x16')];var _0x3a1572=_0x297ef3?0x0:_0x1a9aa8[_0x7df7('0x15')];var _0xdd8f74=_0x297ef3?_0x58f206[_0x7df7('0x16')]:_0x1a9aa8[_0x7df7('0x15')]+_0x1a9aa8[_0x7df7('0x17')];var _0x5b608b;if(_0xdd8f74>=_0x3d0296){_0xdd8f74=_0x3d0296;_0x5b608b=0xc8;}else{_0x5b608b=0xce;}_0x2aefdb[_0x7df7('0x14')](_0x5b608b);return _0x2aefdb['set'](_0x7df7('0x18'),_0x3a1572+'-'+_0xdd8f74+'/'+_0x3d0296)[_0x7df7('0x19')](_0x58f206);}return null;};}function patchUpdates(_0x26efdc){return function(_0x26e111){try{jsonpatch[_0x7df7('0x1a')](_0x26e111,_0x26efdc,!![]);}catch(_0x43001f){return BPromise[_0x7df7('0x1b')](_0x43001f);}return _0x26e111[_0x7df7('0x1c')]();};}function saveUpdates(_0x3b1714,_0x49437c){return function(_0x435ed2){if(_0x435ed2){return _0x435ed2['update'](_0x3b1714)[_0x7df7('0x1d')](function(_0x2ffe65){return _0x2ffe65;});}return null;};}function removeEntity(_0x3b3ea2,_0x5bdff7){return function(_0x4848f8){if(_0x4848f8){return _0x4848f8[_0x7df7('0x1e')]()[_0x7df7('0x1d')](function(){var _0x3d8344=_0x4848f8['get']({'plain':!![]});var _0x1d3968=_0x7df7('0x1f');return db[_0x7df7('0x20')][_0x7df7('0x1e')]({'where':{'type':_0x1d3968,'resourceId':_0x3d8344['id']}})['then'](function(){return _0x4848f8;});})[_0x7df7('0x1d')](function(){_0x3b3ea2['status'](0xcc)[_0x7df7('0x21')]();});}};}function handleEntityNotFound(_0x29001b,_0x1b3a10){return function(_0x3c2c33){if(!_0x3c2c33){_0x29001b['sendStatus'](0x194);}return _0x3c2c33;};}function handleError(_0x1b0b7e,_0x112250){_0x112250=_0x112250||0x1f4;return function(_0x41543b){logger[_0x7df7('0x22')](_0x41543b[_0x7df7('0x23')]);if(_0x41543b[_0x7df7('0x24')]){delete _0x41543b[_0x7df7('0x24')];}_0x1b0b7e[_0x7df7('0x14')](_0x112250)[_0x7df7('0x25')](_0x41543b);};}exports[_0x7df7('0x26')]=function(_0x28bb40,_0xa778bd){var _0x3ac121={},_0x498c4b={},_0xa64f3f={'count':0x0,'rows':[]};var _0x2dd2df=_[_0x7df7('0x27')](db[_0x7df7('0x28')][_0x7df7('0x29')],function(_0x36eeb4){return{'name':_0x36eeb4[_0x7df7('0x2a')],'type':_0x36eeb4['type'][_0x7df7('0x2b')]};});_0x498c4b[_0x7df7('0x2c')]=_[_0x7df7('0x27')](_0x2dd2df,_0x7df7('0x24'));_0x498c4b['query']=_['keys'](_0x28bb40[_0x7df7('0x2d')]);_0x498c4b['filters']=_[_0x7df7('0x2e')](_0x498c4b['model'],_0x498c4b[_0x7df7('0x2d')]);_0x3ac121[_0x7df7('0x2f')]=_[_0x7df7('0x2e')](_0x498c4b['model'],qs[_0x7df7('0x30')](_0x28bb40[_0x7df7('0x2d')][_0x7df7('0x30')]));_0x3ac121[_0x7df7('0x2f')]=_0x3ac121[_0x7df7('0x2f')][_0x7df7('0x31')]?_0x3ac121[_0x7df7('0x2f')]:_0x498c4b[_0x7df7('0x2c')];if(!_0x28bb40[_0x7df7('0x2d')][_0x7df7('0x32')](_0x7df7('0x33'))){_0x3ac121[_0x7df7('0x17')]=qs[_0x7df7('0x17')](_0x28bb40[_0x7df7('0x2d')][_0x7df7('0x17')]);_0x3ac121[_0x7df7('0x15')]=qs[_0x7df7('0x15')](_0x28bb40[_0x7df7('0x2d')][_0x7df7('0x15')]);}_0x3ac121[_0x7df7('0x34')]=qs[_0x7df7('0x35')](_0x28bb40[_0x7df7('0x2d')][_0x7df7('0x35')]);delete _0x28bb40['query']['sort'];_0x3ac121['where']=qs[_0x7df7('0x36')](_[_0x7df7('0x37')](_0x28bb40[_0x7df7('0x2d')],_0x498c4b['filters']),_0x2dd2df);if(_0x28bb40['query'][_0x7df7('0x38')]){_0x3ac121[_0x7df7('0x39')]=_['merge'](_0x3ac121[_0x7df7('0x39')],{'$or':_['map'](_0x2dd2df,function(_0x497455){if(_0x497455['type']!==_0x7df7('0x3a')){var _0xd5122a={};_0xd5122a[_0x497455[_0x7df7('0x24')]]={'$like':'%'+_0x28bb40['query'][_0x7df7('0x38')]+'%'};return _0xd5122a;}})});}_0x3ac121=_[_0x7df7('0x3b')]({},_0x3ac121,_0x28bb40[_0x7df7('0x3c')]);var _0x21c57f={'where':_0x3ac121['where']};return db[_0x7df7('0x28')][_0x7df7('0x16')](_0x21c57f)[_0x7df7('0x1d')](function(_0x8842a8){_0xa64f3f[_0x7df7('0x16')]=_0x8842a8;if(_0x28bb40[_0x7df7('0x2d')][_0x7df7('0x3d')]){_0x3ac121[_0x7df7('0x3e')]=[{'all':!![]}];}return db[_0x7df7('0x28')][_0x7df7('0x3f')](_0x3ac121);})[_0x7df7('0x1d')](function(_0x3d850b){_0xa64f3f['rows']=_0x3d850b;return _0xa64f3f;})[_0x7df7('0x1d')](respondWithFilteredResult(_0xa778bd,_0x3ac121))[_0x7df7('0x40')](handleError(_0xa778bd,null));};exports[_0x7df7('0x41')]=function(_0x3aa2d3,_0x2c439){var _0x46ff7c={'raw':![],'where':{'id':_0x3aa2d3['params']['id']}},_0x325598={};_0x325598[_0x7df7('0x2c')]=_[_0x7df7('0x42')](db[_0x7df7('0x28')]['rawAttributes']);_0x325598[_0x7df7('0x2d')]=_[_0x7df7('0x42')](_0x3aa2d3[_0x7df7('0x2d')]);_0x325598[_0x7df7('0x36')]=_[_0x7df7('0x2e')](_0x325598[_0x7df7('0x2c')],_0x325598[_0x7df7('0x2d')]);_0x46ff7c[_0x7df7('0x2f')]=_[_0x7df7('0x2e')](_0x325598[_0x7df7('0x2c')],qs['fields'](_0x3aa2d3[_0x7df7('0x2d')][_0x7df7('0x30')]));_0x46ff7c[_0x7df7('0x2f')]=_0x46ff7c[_0x7df7('0x2f')][_0x7df7('0x31')]?_0x46ff7c[_0x7df7('0x2f')]:_0x325598['model'];if(_0x3aa2d3[_0x7df7('0x2d')][_0x7df7('0x3d')]){_0x46ff7c['include']=[{'all':!![]}];}_0x46ff7c=_[_0x7df7('0x3b')]({},_0x46ff7c,_0x3aa2d3[_0x7df7('0x3c')]);return db[_0x7df7('0x28')]['find'](_0x46ff7c)['then'](handleEntityNotFound(_0x2c439,null))[_0x7df7('0x1d')](respondWithResult(_0x2c439,null))[_0x7df7('0x40')](handleError(_0x2c439,null));};exports[_0x7df7('0x43')]=function(_0x413101,_0x10abd6){if(_0x413101[_0x7df7('0x44')]['id']){delete _0x413101[_0x7df7('0x44')]['id'];}return db[_0x7df7('0x28')]['find']({'where':{'id':_0x413101[_0x7df7('0x45')]['id']}})[_0x7df7('0x1d')](handleEntityNotFound(_0x10abd6,null))['then'](saveUpdates(_0x413101[_0x7df7('0x44')],null))[_0x7df7('0x1d')](respondWithResult(_0x10abd6,null))['catch'](handleError(_0x10abd6,null));};exports['create']=function(_0x448f55,_0x9f5f22,_0x351df6){return db[_0x7df7('0x46')][_0x7df7('0x47')](function(_0x4bb638){if(_0x448f55[_0x7df7('0x44')][_0x7df7('0x48')]==='files'){_0x448f55[_0x7df7('0x44')][_0x7df7('0x49')]=path['join'](config[_0x7df7('0x4a')],_0x7df7('0x4b'),_0x448f55[_0x7df7('0x44')]['name']);}return db['VoiceMusicOnHold']['create'](_0x448f55['body'],{'transaction':_0x4bb638})[_0x7df7('0x1d')](function(_0x31912b){if(_0x448f55['body'][_0x7df7('0x48')]===_0x7df7('0x4c')){fs[_0x7df7('0x4d')](_0x31912b[_0x7df7('0x49')],parseInt(_0x7df7('0x4e'),0x8));}var _0x4790d6=_0x448f55[_0x7df7('0x4f')][_0x7df7('0x50')]({'plain':!![]});if(!_0x4790d6)throw new Error(_0x7df7('0x51'));if(_0x4790d6['role']===_0x7df7('0x4f')){var _0x3f78d8=_0x31912b['get']({'plain':!![]});return db['UserProfileSection'][_0x7df7('0x52')]({'where':{'name':_0x7df7('0x1f'),'userProfileId':_0x4790d6['userProfileId']},'raw':!![]})[_0x7df7('0x1d')](function(_0x9336b){if(_0x9336b&&_0x9336b[_0x7df7('0x53')]===0x0){return db[_0x7df7('0x20')][_0x7df7('0x54')]({'name':_0x3f78d8[_0x7df7('0x24')],'resourceId':_0x3f78d8['id'],'type':_0x9336b[_0x7df7('0x24')],'sectionId':_0x9336b['id']},{})[_0x7df7('0x1d')](function(){return _0x31912b;});}else{return _0x31912b;}})[_0x7df7('0x40')](function(_0x173021){logger[_0x7df7('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x173021);});}return _0x31912b;});})['then'](respondWithResult(_0x9f5f22,0xc9))[_0x7df7('0x40')](handleError(_0x9f5f22,null));};exports['destroy']=function(_0xfe124c,_0x369072,_0x32ada1){var _0x1cb55d;return db[_0x7df7('0x28')][_0x7df7('0x52')]({'where':{'id':_0xfe124c[_0x7df7('0x45')]['id']}})[_0x7df7('0x1d')](function(_0x8c9118){if(_0x8c9118){return db[_0x7df7('0x46')][_0x7df7('0x47')](function(_0x3aa112){return _0x8c9118['destroy']({'transaction':_0x3aa112,'raw':!![]})[_0x7df7('0x1d')](function(_0x572556){if(_0x572556[_0x7df7('0x49')]){fs[_0x7df7('0x55')](_0x572556[_0x7df7('0x49')])[_0x7df7('0x56')](function(_0x4bcebb){fs[_0x7df7('0x57')](path[_0x7df7('0x58')](_0x572556['directory'],_0x4bcebb));});fs[_0x7df7('0x59')](_0x572556['directory']);}return _0x572556;});})['catch'](function(_0x581852){throw new db[(_0x7df7('0x5a'))][(_0x7df7('0x5b'))](_0x581852[_0x7df7('0x5c')]);});}})['then'](handleEntityNotFound(_0x369072,null))[_0x7df7('0x1d')](removeEntity(_0x369072,null))['catch'](handleError(_0x369072,null));};exports[_0x7df7('0x5d')]=function(_0x2e7d18,_0x45137d,_0x105b50){return db[_0x7df7('0x46')][_0x7df7('0x47')](function(_0x5f39e4){var _0x491693;return db[_0x7df7('0x28')]['find']({'where':{'id':_0x2e7d18[_0x7df7('0x45')]['id']}})[_0x7df7('0x1d')](function(_0x5cef84){if(_0x5cef84){_0x491693=_0x5cef84;return _0x5cef84['addSound'](_0x2e7d18[_0x7df7('0x44')]['id'],{'transaction':_0x5f39e4});}})[_0x7df7('0x1d')](function(_0x536136){if(_0x536136){return db[_0x7df7('0x5e')][_0x7df7('0x5f')]({'where':{'id':_0x2e7d18[_0x7df7('0x44')]['id']},'attributes':['id',_0x7df7('0x24'),_0x7df7('0x60'),_0x7df7('0x61'),_0x7df7('0x62')],'raw':!![]});}})[_0x7df7('0x1d')](function(_0x133b40){if(_0x133b40){var _0xe903c3=path[_0x7df7('0x58')](config['root'],_0x7df7('0x63'),util[_0x7df7('0x64')](_0x7df7('0x65'),path['basename'](_0x133b40[_0x7df7('0x60')],path['extname'](_0x133b40[_0x7df7('0x60')])),_0x133b40[_0x7df7('0x61')]));var _0x2745d0=path['join'](config[_0x7df7('0x4a')],_0x7df7('0x4b'),_0x491693[_0x7df7('0x24')],util['format'](_0x7df7('0x65'),_0x133b40['name'],_0x133b40['converted_format']));fs[_0x7df7('0x66')](_0xe903c3,_0x2745d0);return _0x133b40;}})[_0x7df7('0x40')](function(_0xa4b9d5){throw new db['Sequelize'][(_0x7df7('0x5b'))](_0xa4b9d5[_0x7df7('0x5c')]);});})[_0x7df7('0x1d')](handleEntityNotFound(_0x45137d,null))[_0x7df7('0x1d')](respondWithResult(_0x45137d,0xc9))['catch'](handleError(_0x45137d,null));};exports[_0x7df7('0x67')]=function(_0x30d835,_0xb5129f,_0x5a082e){return db[_0x7df7('0x46')]['transaction'](function(_0x568e03){var _0x4eefbd;return db[_0x7df7('0x28')][_0x7df7('0x5f')]({'where':{'id':_0x30d835[_0x7df7('0x45')]['id']}})['then'](handleEntityNotFound(_0xb5129f,null))['then'](function(_0x24c103){if(_0x24c103){_0x4eefbd=_0x24c103;return _0x24c103[_0x7df7('0x67')](_0x30d835[_0x7df7('0x45')][_0x7df7('0x68')]);}})[_0x7df7('0x1d')](function(_0x28b184){if(_0x28b184){return db[_0x7df7('0x5e')][_0x7df7('0x5f')]({'where':{'id':_0x30d835['params']['id2']},'attributes':['id',_0x7df7('0x24'),_0x7df7('0x60'),_0x7df7('0x61'),_0x7df7('0x62')],'raw':!![]});}})['then'](function(_0x1d341b){if(_0x1d341b){fs[_0x7df7('0x57')](path[_0x7df7('0x58')](_0x4eefbd['directory'],util[_0x7df7('0x64')](_0x7df7('0x65'),_0x1d341b[_0x7df7('0x24')],_0x1d341b[_0x7df7('0x61')])));return _0x1d341b;}})[_0x7df7('0x40')](function(_0x1345c4){throw new db[(_0x7df7('0x5a'))][(_0x7df7('0x5b'))](_0x1345c4[_0x7df7('0x5c')]);});})[_0x7df7('0x1d')](handleEntityNotFound(_0xb5129f,null))[_0x7df7('0x1d')](respondWithStatusCode(_0xb5129f,0xcc))[_0x7df7('0x40')](handleError(_0xb5129f,null));};exports[_0x7df7('0x69')]=function(_0x2a4de2,_0x32d23e,_0xce3636){var _0x58ed2a={};var _0x297460={};var _0x1ddf0e;var _0x134d3c;return db[_0x7df7('0x28')][_0x7df7('0x5f')]({'where':{'id':_0x2a4de2[_0x7df7('0x45')]['id']}})['then'](handleEntityNotFound(_0x32d23e,null))[_0x7df7('0x1d')](function(_0x2d82bc){if(_0x2d82bc){_0x1ddf0e=_0x2d82bc;_0x297460[_0x7df7('0x2c')]=_[_0x7df7('0x42')](db[_0x7df7('0x5e')][_0x7df7('0x29')]);_0x297460['query']=_['keys'](_0x2a4de2[_0x7df7('0x2d')]);_0x297460[_0x7df7('0x36')]=_[_0x7df7('0x2e')](_0x297460[_0x7df7('0x2c')],_0x297460[_0x7df7('0x2d')]);_0x58ed2a['attributes']=_[_0x7df7('0x2e')](_0x297460[_0x7df7('0x2c')],qs['fields'](_0x2a4de2['query'][_0x7df7('0x30')]));_0x58ed2a[_0x7df7('0x2f')]=_0x58ed2a[_0x7df7('0x2f')][_0x7df7('0x31')]?_0x58ed2a[_0x7df7('0x2f')]:_0x297460[_0x7df7('0x2c')];_0x58ed2a[_0x7df7('0x34')]=qs[_0x7df7('0x35')](_0x2a4de2[_0x7df7('0x2d')][_0x7df7('0x35')]);_0x58ed2a[_0x7df7('0x39')]=qs[_0x7df7('0x36')](_['pick'](_0x2a4de2['query'],_0x297460[_0x7df7('0x36')]));if(_0x2a4de2[_0x7df7('0x2d')][_0x7df7('0x38')]){_0x58ed2a[_0x7df7('0x39')]=_[_0x7df7('0x3b')](_0x58ed2a[_0x7df7('0x39')],{'$or':_[_0x7df7('0x27')](_0x58ed2a[_0x7df7('0x2f')],function(_0x26087d){var _0x45661e={};_0x45661e[_0x26087d]={'$like':'%'+_0x2a4de2['query'][_0x7df7('0x38')]+'%'};return _0x45661e;})});}_0x58ed2a=_[_0x7df7('0x3b')]({},_0x58ed2a,_0x2a4de2[_0x7df7('0x3c')]);return _0x1ddf0e[_0x7df7('0x69')](_0x58ed2a);}})[_0x7df7('0x1d')](function(_0x55e0b1){if(_0x55e0b1){_0x134d3c=_0x55e0b1['length'];if(!_0x2a4de2[_0x7df7('0x2d')]['hasOwnProperty']('nolimit')){_0x58ed2a['limit']=qs[_0x7df7('0x17')](_0x2a4de2['query'][_0x7df7('0x17')]);_0x58ed2a[_0x7df7('0x15')]=qs[_0x7df7('0x15')](_0x2a4de2[_0x7df7('0x2d')][_0x7df7('0x15')]);}return _0x1ddf0e['getSounds'](_0x58ed2a);}})[_0x7df7('0x1d')](function(_0x1c489b){if(_0x1c489b){return _0x1c489b?{'count':_0x134d3c,'rows':_0x1c489b}:null;}})['then'](respondWithResult(_0x32d23e,null))['catch'](handleError(_0x32d23e,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 01dc16b..0f16cd4 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 _0x134b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','voice_musiconhold'];(function(_0x5b7841,_0x4dfe3d){var _0x2db2f1=function(_0xceb2f4){while(--_0xceb2f4){_0x5b7841['push'](_0x5b7841['shift']());}};_0x2db2f1(++_0x4dfe3d);}(_0x134b,0x78));var _0xb134=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x134b[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb134('0x0'))(_0xb134('0x1'));var moment=require(_0xb134('0x2'));var BPromise=require(_0xb134('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb134('0x4'));var rimraf=require(_0xb134('0x5'));var config=require(_0xb134('0x6'));var attributes=require(_0xb134('0x7'));module[_0xb134('0x8')]=function(_0x1d7d19,_0x5a0b2d){return _0x1d7d19['define']('VoiceMusicOnHold',attributes,{'tableName':_0xb134('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf79a=['exports','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./voiceMusicOnHold.attributes'];(function(_0x38ee8c,_0x502391){var _0x68464b=function(_0xe1a2ec){while(--_0xe1a2ec){_0x38ee8c['push'](_0x38ee8c['shift']());}};_0x68464b(++_0x502391);}(_0xf79a,0xf4));var _0xaf79=function(_0x3121d1,_0x78aeb5){_0x3121d1=_0x3121d1-0x0;var _0x5c9c7b=_0xf79a[_0x3121d1];return _0x5c9c7b;};'use strict';var _=require(_0xaf79('0x0'));var util=require('util');var logger=require(_0xaf79('0x1'))(_0xaf79('0x2'));var moment=require(_0xaf79('0x3'));var BPromise=require('bluebird');var rp=require(_0xaf79('0x4'));var fs=require('fs');var path=require(_0xaf79('0x5'));var rimraf=require(_0xaf79('0x6'));var config=require('../../config/environment');var attributes=require(_0xaf79('0x7'));module[_0xaf79('0x8')]=function(_0x5a8f97,_0x16b8f0){return _0x5a8f97['define']('VoiceMusicOnHold',attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 3970003..9731a36 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x23718b,_0x2d7bd0){var _0xdc1daa=function(_0x33d41d){while(--_0x33d41d){_0x23718b['push'](_0x23718b['shift']());}};_0xdc1daa(++_0x2d7bd0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xab9f3d,_0xb336fa){_0xab9f3d=_0xab9f3d-0x0;var _0x5283bf=_0xcb91[_0xab9f3d];return _0x5283bf;};'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')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x523a20,_0x1d4eb2){var _0xb178f=function(_0x18b428){while(--_0x18b428){_0x523a20['push'](_0x523a20['shift']());}};_0xb178f(++_0x1d4eb2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2525f1,_0x47034f){_0x2525f1=_0x2525f1-0x0;var _0x13c1b5=_0xcb91[_0x2525f1];return _0x13c1b5;};'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')]('VoiceMusicOnHold,\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/voicePrefix/index.js b/server/api/voicePrefix/index.js index 7107efd..0c89917 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 _0xaa48=['/describe','describe','show','/:id/users','/:id/teams','getTeams','post','create','addTeams','put','/:id','update','delete','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index'];(function(_0x40f2da,_0x23f088){var _0x16633e=function(_0x4f1b5e){while(--_0x4f1b5e){_0x40f2da['push'](_0x40f2da['shift']());}};_0x16633e(++_0x23f088);}(_0xaa48,0x15a));var _0x8aa4=function(_0x29a1ca,_0x1c8ff4){_0x29a1ca=_0x29a1ca-0x0;var _0x23f0fa=_0xaa48[_0x29a1ca];return _0x23f0fa;};'use strict';var multer=require(_0x8aa4('0x0'));var util=require(_0x8aa4('0x1'));var path=require(_0x8aa4('0x2'));var timeout=require(_0x8aa4('0x3'));var express=require(_0x8aa4('0x4'));var router=express[_0x8aa4('0x5')]();var fs_extra=require(_0x8aa4('0x6'));var auth=require(_0x8aa4('0x7'));var interaction=require(_0x8aa4('0x8'));var config=require(_0x8aa4('0x9'));var controller=require(_0x8aa4('0xa'));router[_0x8aa4('0xb')]('/',auth[_0x8aa4('0xc')](),controller[_0x8aa4('0xd')]);router[_0x8aa4('0xb')](_0x8aa4('0xe'),auth[_0x8aa4('0xc')](),controller[_0x8aa4('0xf')]);router[_0x8aa4('0xb')]('/:id',auth[_0x8aa4('0xc')](),controller[_0x8aa4('0x10')]);router['get'](_0x8aa4('0x11'),auth[_0x8aa4('0xc')](),controller['getAgents']);router[_0x8aa4('0xb')](_0x8aa4('0x12'),auth[_0x8aa4('0xc')](),controller[_0x8aa4('0x13')]);router[_0x8aa4('0x14')]('/',auth[_0x8aa4('0xc')](),controller[_0x8aa4('0x15')]);router[_0x8aa4('0x14')](_0x8aa4('0x11'),auth[_0x8aa4('0xc')](),controller['addAgents']);router['post'](_0x8aa4('0x12'),auth[_0x8aa4('0xc')](),controller[_0x8aa4('0x16')]);router[_0x8aa4('0x17')](_0x8aa4('0x18'),auth[_0x8aa4('0xc')](),controller[_0x8aa4('0x19')]);router[_0x8aa4('0x1a')](_0x8aa4('0x18'),auth[_0x8aa4('0xc')](),controller['destroy']);router['delete']('/:id/users',auth[_0x8aa4('0xc')](),controller[_0x8aa4('0x1b')]);router[_0x8aa4('0x1a')](_0x8aa4('0x12'),auth['isAuthenticated'](),controller[_0x8aa4('0x1c')]);module[_0x8aa4('0x1d')]=router; \ No newline at end of file +var _0x8e0f=['get','index','/describe','isAuthenticated','/:id','/:id/users','getAgents','/:id/teams','getTeams','post','create','addTeams','put','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voicePrefix.controller'];(function(_0x5d77b3,_0x1ab7eb){var _0x2be7d1=function(_0x70b2c4){while(--_0x70b2c4){_0x5d77b3['push'](_0x5d77b3['shift']());}};_0x2be7d1(++_0x1ab7eb);}(_0x8e0f,0x12f));var _0xf8e0=function(_0x2c46b2,_0x23d699){_0x2c46b2=_0x2c46b2-0x0;var _0xaf0868=_0x8e0f[_0x2c46b2];return _0xaf0868;};'use strict';var multer=require(_0xf8e0('0x0'));var util=require(_0xf8e0('0x1'));var path=require(_0xf8e0('0x2'));var timeout=require(_0xf8e0('0x3'));var express=require(_0xf8e0('0x4'));var router=express[_0xf8e0('0x5')]();var fs_extra=require(_0xf8e0('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf8e0('0x7'));var config=require('../../config/environment');var controller=require(_0xf8e0('0x8'));router[_0xf8e0('0x9')]('/',auth['isAuthenticated'](),controller[_0xf8e0('0xa')]);router[_0xf8e0('0x9')](_0xf8e0('0xb'),auth[_0xf8e0('0xc')](),controller['describe']);router[_0xf8e0('0x9')](_0xf8e0('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xf8e0('0x9')](_0xf8e0('0xe'),auth[_0xf8e0('0xc')](),controller[_0xf8e0('0xf')]);router[_0xf8e0('0x9')](_0xf8e0('0x10'),auth[_0xf8e0('0xc')](),controller[_0xf8e0('0x11')]);router[_0xf8e0('0x12')]('/',auth['isAuthenticated'](),controller[_0xf8e0('0x13')]);router[_0xf8e0('0x12')](_0xf8e0('0xe'),auth[_0xf8e0('0xc')](),controller['addAgents']);router[_0xf8e0('0x12')]('/:id/teams',auth[_0xf8e0('0xc')](),controller[_0xf8e0('0x14')]);router[_0xf8e0('0x15')]('/:id',auth[_0xf8e0('0xc')](),controller['update']);router[_0xf8e0('0x16')]('/:id',auth[_0xf8e0('0xc')](),controller[_0xf8e0('0x17')]);router[_0xf8e0('0x16')](_0xf8e0('0xe'),auth[_0xf8e0('0xc')](),controller['removeAgents']);router[_0xf8e0('0x16')]('/:id/teams',auth[_0xf8e0('0xc')](),controller[_0xf8e0('0x18')]);module[_0xf8e0('0x19')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 3706c12..6d5ffae 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 _0x873b=['sequelize','exports','name','VIRTUAL','system-','getDataValue','INTEGER'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x873b,0x19d));var _0xb873=function(_0x26d678,_0x273258){_0x26d678=_0x26d678-0x0;var _0x4ad538=_0x873b[_0x26d678];return _0x4ad538;};'use strict';var Sequelize=require(_0xb873('0x0'));module[_0xb873('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb873('0x2')},'prefix':{'type':Sequelize[_0xb873('0x3')],'get':function(_0x53573c){return _0xb873('0x4')+this[_0xb873('0x5')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xb873('0x6')]}}; \ No newline at end of file +var _0x1279=['STRING','name','VIRTUAL','getDataValue','sequelize','exports'];(function(_0x54cbb0,_0xda3d6d){var _0x1acb55=function(_0x56d8f3){while(--_0x56d8f3){_0x54cbb0['push'](_0x54cbb0['shift']());}};_0x1acb55(++_0xda3d6d);}(_0x1279,0x1a8));var _0x9127=function(_0x233d88,_0x3d1ac3){_0x233d88=_0x233d88-0x0;var _0x127b69=_0x1279[_0x233d88];return _0x127b69;};'use strict';var Sequelize=require(_0x9127('0x0'));module[_0x9127('0x1')]={'name':{'type':Sequelize[_0x9127('0x2')],'allowNull':![],'unique':_0x9127('0x3')},'prefix':{'type':Sequelize[_0x9127('0x4')],'get':function(_0xb4b334){return'system-'+this[_0x9127('0x5')](_0x9127('0x3'))+'-';}},'description':{'type':Sequelize[_0x9127('0x2')]},'callerIdAll':{'type':Sequelize[_0x9127('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 0fcd3eb..ce55e32 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 _0x1893=['compact','value','isEmpty','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','error','name','index','map','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','VoicePrefix','includeAll','findAll','rows','show','length','options','find','catch','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','context','${EXTEN:','charAt','body','system-','findById','addAgents','params','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','rawAttributes','pick','getAgents','getTeams','addTeams','Team','Agents','online','voicePause','flatMap','each','upsert','findOrCreate','forEach','removeTeams','field','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1893,0xa2));var _0x3189=function(_0xc8a692,_0x579320){_0xc8a692=_0xc8a692-0x0;var _0x5055d8=_0x1893[_0xc8a692];return _0x5055d8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3189('0x0'));var jsonpatch=require(_0x3189('0x1'));var rp=require(_0x3189('0x2'));var moment=require(_0x3189('0x3'));var BPromise=require(_0x3189('0x4'));var Mustache=require(_0x3189('0x5'));var util=require(_0x3189('0x6'));var path=require('path');var sox=require(_0x3189('0x7'));var csv=require(_0x3189('0x8'));var ejs=require(_0x3189('0x9'));var fs=require('fs');var fs_extra=require(_0x3189('0xa'));var _=require(_0x3189('0xb'));var squel=require(_0x3189('0xc'));var crypto=require(_0x3189('0xd'));var jsforce=require(_0x3189('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3189('0x8'));var querystring=require('querystring');var Papa=require(_0x3189('0xf'));var Redis=require('ioredis');var authService=require(_0x3189('0x10'));var qs=require(_0x3189('0x11'));var as=require(_0x3189('0x12'));var hardwareService=require(_0x3189('0x13'));var logger=require('../../config/logger')(_0x3189('0x14'));var utils=require(_0x3189('0x15'));var config=require(_0x3189('0x16'));var licenseUtil=require(_0x3189('0x17'));var db=require(_0x3189('0x18'))['db'];config['redis']=_[_0x3189('0x19')](config[_0x3189('0x1a')],{'host':_0x3189('0x1b'),'port':0x18eb});var socket=require(_0x3189('0x1c'))(new Redis(config[_0x3189('0x1a')]));require(_0x3189('0x1d'))[_0x3189('0x1e')](socket);function respondWithStatusCode(_0x25a917,_0x5521bb){_0x5521bb=_0x5521bb||0xcc;return function(_0x220b18){if(_0x220b18){return _0x25a917[_0x3189('0x1f')](_0x5521bb);}return _0x25a917[_0x3189('0x20')](_0x5521bb)[_0x3189('0x21')]();};}function respondWithResult(_0x486dd2,_0x40195d){_0x40195d=_0x40195d||0xc8;return function(_0x5f2e82){if(_0x5f2e82){return _0x486dd2['status'](_0x40195d)[_0x3189('0x22')](_0x5f2e82);}};}function respondWithFilteredResult(_0x49b1bc,_0x42c3a3){return function(_0xf8aed7){if(_0xf8aed7){var _0x22c7ba=typeof _0x42c3a3[_0x3189('0x23')]==='undefined'&&typeof _0x42c3a3[_0x3189('0x24')]===_0x3189('0x25');var _0x16edd7=_0xf8aed7['count'];var _0x561265=_0x22c7ba?0x0:_0x42c3a3[_0x3189('0x23')];var _0x306ed3=_0x22c7ba?_0xf8aed7[_0x3189('0x26')]:_0x42c3a3[_0x3189('0x23')]+_0x42c3a3['limit'];var _0x1771a8;if(_0x306ed3>=_0x16edd7){_0x306ed3=_0x16edd7;_0x1771a8=0xc8;}else{_0x1771a8=0xce;}_0x49b1bc[_0x3189('0x20')](_0x1771a8);return _0x49b1bc[_0x3189('0x27')]('Content-Range',_0x561265+'-'+_0x306ed3+'/'+_0x16edd7)[_0x3189('0x22')](_0xf8aed7);}return null;};}function patchUpdates(_0x47abb4){return function(_0x4bfc03){try{jsonpatch[_0x3189('0x28')](_0x4bfc03,_0x47abb4,!![]);}catch(_0x200f16){return BPromise[_0x3189('0x29')](_0x200f16);}return _0x4bfc03[_0x3189('0x2a')]();};}function saveUpdates(_0x393fcb,_0x5a08dc){return function(_0x4b03ad){if(_0x4b03ad){return _0x4b03ad[_0x3189('0x2b')](_0x393fcb)[_0x3189('0x2c')](function(_0x1dc1c8){return _0x1dc1c8;});}return null;};}function removeEntity(_0x3cc1e5,_0x103de4){return function(_0x3f4789){if(_0x3f4789){return _0x3f4789[_0x3189('0x2d')]()[_0x3189('0x2c')](function(){var _0x17b540=_0x3f4789[_0x3189('0x2e')]({'plain':!![]});var _0x5ce5f5='VoicePrefixes';return db['UserProfileResource'][_0x3189('0x2d')]({'where':{'type':_0x5ce5f5,'resourceId':_0x17b540['id']}})[_0x3189('0x2c')](function(){return _0x3f4789;});})[_0x3189('0x2c')](function(){_0x3cc1e5[_0x3189('0x20')](0xcc)[_0x3189('0x21')]();});}};}function handleEntityNotFound(_0x2f7504,_0x4d453a){return function(_0x1ab94b){if(!_0x1ab94b){_0x2f7504[_0x3189('0x1f')](0x194);}return _0x1ab94b;};}function handleError(_0x4bd677,_0x173f18){_0x173f18=_0x173f18||0x1f4;return function(_0x3744ff){logger[_0x3189('0x2f')](_0x3744ff['stack']);if(_0x3744ff[_0x3189('0x30')]){delete _0x3744ff[_0x3189('0x30')];}_0x4bd677[_0x3189('0x20')](_0x173f18)['send'](_0x3744ff);};}exports[_0x3189('0x31')]=function(_0x47f7a7,_0x51ce54){var _0x32ca90={},_0x34007b={},_0x374f23={'count':0x0,'rows':[]};var _0x3bdc84=_[_0x3189('0x32')](db['VoicePrefix']['rawAttributes'],function(_0x7d7745){return{'name':_0x7d7745['fieldName'],'type':_0x7d7745[_0x3189('0x33')][_0x3189('0x34')]};});_0x34007b[_0x3189('0x35')]=_[_0x3189('0x32')](_0x3bdc84,_0x3189('0x30'));_0x34007b[_0x3189('0x36')]=_[_0x3189('0x37')](_0x47f7a7[_0x3189('0x36')]);_0x34007b[_0x3189('0x38')]=_['intersection'](_0x34007b[_0x3189('0x35')],_0x34007b[_0x3189('0x36')]);_0x32ca90[_0x3189('0x39')]=_[_0x3189('0x3a')](_0x34007b[_0x3189('0x35')],qs[_0x3189('0x3b')](_0x47f7a7[_0x3189('0x36')]['fields']));_0x32ca90['attributes']=_0x32ca90[_0x3189('0x39')]['length']?_0x32ca90[_0x3189('0x39')]:_0x34007b[_0x3189('0x35')];if(!_0x47f7a7['query'][_0x3189('0x3c')](_0x3189('0x3d'))){_0x32ca90[_0x3189('0x24')]=qs[_0x3189('0x24')](_0x47f7a7['query'][_0x3189('0x24')]);_0x32ca90['offset']=qs['offset'](_0x47f7a7[_0x3189('0x36')][_0x3189('0x23')]);}_0x32ca90[_0x3189('0x3e')]=qs[_0x3189('0x3f')](_0x47f7a7[_0x3189('0x36')][_0x3189('0x3f')]);_0x32ca90[_0x3189('0x40')]=qs[_0x3189('0x38')](_['pick'](_0x47f7a7['query'],_0x34007b[_0x3189('0x38')]),_0x3bdc84);if(_0x47f7a7[_0x3189('0x36')][_0x3189('0x41')]){_0x32ca90[_0x3189('0x40')]=_[_0x3189('0x42')](_0x32ca90[_0x3189('0x40')],{'$or':_['map'](_0x3bdc84,function(_0x280146){if(_0x280146[_0x3189('0x33')]!==_0x3189('0x43')){var _0xaf76f1={};_0xaf76f1[_0x280146['name']]={'$like':'%'+_0x47f7a7[_0x3189('0x36')][_0x3189('0x41')]+'%'};return _0xaf76f1;}})});}_0x32ca90=_['merge']({},_0x32ca90,_0x47f7a7['options']);var _0x1ef1b2={'where':_0x32ca90['where']};return db[_0x3189('0x44')][_0x3189('0x26')](_0x1ef1b2)[_0x3189('0x2c')](function(_0x9593f3){_0x374f23['count']=_0x9593f3;if(_0x47f7a7[_0x3189('0x36')][_0x3189('0x45')]){_0x32ca90['include']=[{'all':!![]}];}return db[_0x3189('0x44')][_0x3189('0x46')](_0x32ca90);})[_0x3189('0x2c')](function(_0x3a6a36){_0x374f23[_0x3189('0x47')]=_0x3a6a36;return _0x374f23;})['then'](respondWithFilteredResult(_0x51ce54,_0x32ca90))['catch'](handleError(_0x51ce54,null));};exports[_0x3189('0x48')]=function(_0x5ca360,_0x44e45f){var _0xf095fe={'raw':![],'where':{'id':_0x5ca360['params']['id']}},_0x1a3e51={};_0x1a3e51[_0x3189('0x35')]=_[_0x3189('0x37')](db[_0x3189('0x44')]['rawAttributes']);_0x1a3e51[_0x3189('0x36')]=_[_0x3189('0x37')](_0x5ca360[_0x3189('0x36')]);_0x1a3e51[_0x3189('0x38')]=_[_0x3189('0x3a')](_0x1a3e51[_0x3189('0x35')],_0x1a3e51['query']);_0xf095fe['attributes']=_[_0x3189('0x3a')](_0x1a3e51['model'],qs['fields'](_0x5ca360[_0x3189('0x36')]['fields']));_0xf095fe[_0x3189('0x39')]=_0xf095fe[_0x3189('0x39')][_0x3189('0x49')]?_0xf095fe['attributes']:_0x1a3e51[_0x3189('0x35')];if(_0x5ca360['query'][_0x3189('0x45')]){_0xf095fe['include']=[{'all':!![]}];}_0xf095fe=_['merge']({},_0xf095fe,_0x5ca360[_0x3189('0x4a')]);return db['VoicePrefix'][_0x3189('0x4b')](_0xf095fe)['then'](handleEntityNotFound(_0x44e45f,null))['then'](respondWithResult(_0x44e45f,null))[_0x3189('0x4c')](handleError(_0x44e45f,null));};exports[_0x3189('0x2d')]=function(_0x4373f6,_0x35cb23){return db[_0x3189('0x44')][_0x3189('0x4b')]({'where':{'id':_0x4373f6['params']['id']}})[_0x3189('0x2c')](handleEntityNotFound(_0x35cb23,null))['then'](removeEntity(_0x35cb23,null))['catch'](handleError(_0x35cb23,null));};exports[_0x3189('0x4d')]=function(_0x4f641a,_0xd90868){return db[_0x3189('0x44')][_0x3189('0x4d')]()[_0x3189('0x2c')](respondWithResult(_0xd90868,null))['catch'](handleError(_0xd90868,null));};exports[_0x3189('0x4e')]=function(_0x4ad892,_0x35fdb2){var _0x242ec4;return db[_0x3189('0x4f')][_0x3189('0x50')](function(_0x4f41e5){return db[_0x3189('0x44')][_0x3189('0x4e')](_0x4ad892['body'],{'transaction':_0x4f41e5})[_0x3189('0x2c')](function(_0xbf07c5){_0x242ec4=_0xbf07c5[_0x3189('0x2e')]({'plain':!![]});return db[_0x3189('0x51')]['find']({'where':{'id':_0x242ec4[_0x3189('0x52')]},'raw':!![]})['then'](function(_0x1ebb0d){return createVoicePrefixExtensions(_0x242ec4,_0x1ebb0d,_0x4f41e5);});});})['then'](function(){var _0x460c6e=_0x4ad892[_0x3189('0x53')]['get']({'plain':!![]});if(!_0x460c6e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x460c6e['role']===_0x3189('0x53')){var _0x5b14ac=_0x242ec4;return db[_0x3189('0x54')][_0x3189('0x4b')]({'where':{'name':_0x3189('0x55'),'userProfileId':_0x460c6e[_0x3189('0x56')]},'raw':!![]})[_0x3189('0x2c')](function(_0x40623f){if(_0x40623f&&_0x40623f[_0x3189('0x57')]===0x0){return db[_0x3189('0x58')][_0x3189('0x4e')]({'name':_0x5b14ac['name'],'resourceId':_0x5b14ac['id'],'type':_0x40623f[_0x3189('0x30')],'sectionId':_0x40623f['id']},{})[_0x3189('0x2c')](function(){return _0x242ec4;});}else{return _0x242ec4;}})[_0x3189('0x4c')](function(_0x429de3){logger[_0x3189('0x2f')](_0x3189('0x59'),_0x429de3);throw _0x429de3;});}return _0x242ec4;})[_0x3189('0x2c')](respondWithResult(_0x35fdb2,null))[_0x3189('0x4c')](handleError(_0x35fdb2,null));};function Extension(_0xa1316a,_0x68de3c,_0x187877,_0x3a2fe6){this['context']='from-sip';this[_0x3189('0x5a')]=_0xa1316a;this[_0x3189('0x5b')]=_0x187877;this[_0x3189('0x33')]=_0x3189('0x5c');this[_0x3189('0x5d')]=_0x3189('0x5e');this[_0x3189('0x5f')]=_0x68de3c;this[_0x3189('0x60')]=_0x3a2fe6;}function createVoicePrefixExtensions(_0x120a8a,_0x1472b6,_0xd45395){return new BPromise(function(_0x4f0ccb,_0x5b31dd){var _0x57aae5=new Extension(formatPrefixName(_0x120a8a[_0x3189('0x61')]),0x1,_0x3189('0x62'),'Voice\x20Prefix');_0x57aae5[_0x3189('0x63')]=_0x120a8a['id'];return db[_0x3189('0x51')][_0x3189('0x4e')](_0x57aae5,{'transaction':_0xd45395})[_0x3189('0x2c')](function(_0x26fdf2){var _0x4875a2=_0x26fdf2[_0x3189('0x2e')]({'plain':!![]});var _0x35a4d1=_[_0x3189('0x32')](addVoicePrefixExtensions(_0x120a8a,_0x1472b6),function(_0x228dfc){_0x228dfc['VoiceExtensionId']=_0x4875a2['id'];_0x228dfc[_0x3189('0x63')]=_0x120a8a['id'];return _0x228dfc;});return db[_0x3189('0x51')][_0x3189('0x64')](_0x35a4d1,{'transaction':_0xd45395})[_0x3189('0x2c')](function(_0x4a7172){if(!_0x4a7172){return _0x5b31dd(_0x3189('0x65'));}else{return _0x4f0ccb(_0x4a7172);}})['catch'](function(_0x1d7a44){return _0x5b31dd(_0x1d7a44);});});;});};function addVoicePrefixExtensions(_0x448635,_0x10fe1b){var _0xb02b4f=[];var _0x55bcf0=formatPrefixName(_0x448635[_0x3189('0x61')]);_0xb02b4f[_0x3189('0x66')](new Extension(_0x55bcf0,0x2,_0x3189('0x67'),_0x3189('0x68')+_0x448635[_0x3189('0x30')]));if(_0x448635[_0x3189('0x69')]){_0xb02b4f['push'](new Extension(_0x55bcf0,0x3,_0x3189('0x67'),_0x3189('0x6a')+_0x448635[_0x3189('0x69')]));}else{_0xb02b4f[_0x3189('0x66')](new Extension(_0x55bcf0,0x3,_0x3189('0x62'),'No\x20callerid\x20available'));}_0xb02b4f[_0x3189('0x66')](new Extension(_0x55bcf0,0x4,'goto',_0x10fe1b[_0x3189('0x6b')]+','+_0x3189('0x6c')+(0x8+_0x448635[_0x3189('0x30')][_0x3189('0x49')])+'}'+','+0x1));return _0xb02b4f;}function formatPrefixName(_0x46faac){var _0x458db9='_';for(var _0x403d31=0x0;_0x403d31<_0x46faac[_0x3189('0x49')];_0x403d31++){if(_0x46faac['charAt'](_0x403d31)=='-'){_0x458db9+=_0x46faac[_0x3189('0x6d')](_0x403d31);}else{_0x458db9+='['+_0x46faac['charAt'](_0x403d31)+']';}}_0x458db9+='.';return _0x458db9;}exports[_0x3189('0x2b')]=function(_0x2eedf4,_0xf740b0,_0x1e08f4){var _0x3d11ac=_0x2eedf4[_0x3189('0x6e')];_0x3d11ac['prefix']=_0x3189('0x6f')+_0x3d11ac[_0x3189('0x30')]+'-';return db['sequelize'][_0x3189('0x50')](function(_0x50438f){return db[_0x3189('0x44')][_0x3189('0x2b')](_0x3d11ac,{'where':{'id':_0x3d11ac['id']},'transaction':_0x50438f})[_0x3189('0x2c')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x3d11ac['id']},'transaction':_0x50438f})[_0x3189('0x2c')](function(){return db[_0x3189('0x51')][_0x3189('0x4b')]({'where':{'id':_0x3d11ac['VoiceExtensionId']},'raw':!![]})[_0x3189('0x2c')](function(_0x285b0d){return createVoicePrefixExtensions(_0x3d11ac,_0x285b0d,_0x50438f);});});});})['then'](function(){return db[_0x3189('0x44')][_0x3189('0x70')](_0x3d11ac['id']);})[_0x3189('0x2c')](respondWithResult(_0xf740b0,null))['catch'](handleError(_0xf740b0,null));};exports[_0x3189('0x71')]=function(_0x28bbe6,_0x3ab88e,_0x5d3478){return db['VoicePrefix'][_0x3189('0x4b')]({'where':{'id':_0x28bbe6[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](handleEntityNotFound(_0x3ab88e,null))['then'](function(_0x1f57c7){if(_0x1f57c7){return _0x1f57c7[_0x3189('0x71')](_0x28bbe6[_0x3189('0x6e')][_0x3189('0x73')],_[_0x3189('0x74')](_0x28bbe6[_0x3189('0x6e')],[_0x3189('0x73'),'id'])||{})[_0x3189('0x75')](function(_0x2c110e){for(var _0x41d415=0x0;_0x41d415<_0x28bbe6['body'][_0x3189('0x73')][_0x3189('0x49')];_0x41d415+=0x1){socket[_0x3189('0x76')](_0x3189('0x77'),{'UserId':Number(_0x28bbe6[_0x3189('0x6e')][_0x3189('0x73')][_0x41d415]),'VoicePrefixId':Number(_0x28bbe6[_0x3189('0x72')]['id'])});}return _0x2c110e;});}})[_0x3189('0x2c')](respondWithResult(_0x3ab88e,null))['catch'](handleError(_0x3ab88e,null));};exports[_0x3189('0x78')]=function(_0x4861ba,_0x226a58,_0x176c44){return db[_0x3189('0x44')][_0x3189('0x4b')]({'where':{'id':_0x4861ba['params']['id']}})['then'](handleEntityNotFound(_0x226a58,null))[_0x3189('0x2c')](function(_0x2c0e85){if(_0x2c0e85){return _0x2c0e85[_0x3189('0x78')](_0x4861ba[_0x3189('0x36')]['ids'])[_0x3189('0x2c')](function(){if(_[_0x3189('0x79')](_0x4861ba['query'][_0x3189('0x73')])){for(var _0x65c13f=0x0;_0x65c13f<_0x4861ba['query'][_0x3189('0x73')][_0x3189('0x49')];_0x65c13f+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x4861ba[_0x3189('0x36')]['ids'][_0x65c13f]),'VoicePrefixId':Number(_0x4861ba[_0x3189('0x72')]['id'])});}}else{socket[_0x3189('0x76')](_0x3189('0x7a'),{'UserId':Number(_0x4861ba[_0x3189('0x36')][_0x3189('0x73')]),'VoicePrefixId':Number(_0x4861ba['params']['id'])});}});}})['then'](respondWithStatusCode(_0x226a58,null))[_0x3189('0x4c')](handleError(_0x226a58,null));};exports['getAgents']=function(_0x33b271,_0x5c138a,_0x583d35){var _0x51303a={};var _0x278553={};var _0x4917e3;var _0x2d3d78;return db[_0x3189('0x44')][_0x3189('0x7b')]({'where':{'id':_0x33b271[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](handleEntityNotFound(_0x5c138a,null))[_0x3189('0x2c')](function(_0x4d3554){if(_0x4d3554){_0x4917e3=_0x4d3554;_0x278553[_0x3189('0x35')]=_[_0x3189('0x37')](db[_0x3189('0x7c')][_0x3189('0x7d')]);_0x278553[_0x3189('0x36')]=_['keys'](_0x33b271[_0x3189('0x36')]);_0x278553[_0x3189('0x38')]=_[_0x3189('0x3a')](_0x278553[_0x3189('0x35')],_0x278553[_0x3189('0x36')]);_0x51303a['attributes']=_[_0x3189('0x3a')](_0x278553[_0x3189('0x35')],qs[_0x3189('0x3b')](_0x33b271[_0x3189('0x36')][_0x3189('0x3b')]));_0x51303a[_0x3189('0x39')]=_0x51303a[_0x3189('0x39')][_0x3189('0x49')]?_0x51303a[_0x3189('0x39')]:_0x278553[_0x3189('0x35')];_0x51303a['order']=qs[_0x3189('0x3f')](_0x33b271[_0x3189('0x36')][_0x3189('0x3f')]);_0x51303a[_0x3189('0x40')]=qs[_0x3189('0x38')](_[_0x3189('0x7e')](_0x33b271['query'],_0x278553[_0x3189('0x38')]));if(_0x33b271['query'][_0x3189('0x41')]){_0x51303a['where']=_[_0x3189('0x42')](_0x51303a['where'],{'$or':_[_0x3189('0x32')](_0x51303a['attributes'],function(_0x3a84e8){var _0x17b46a={};_0x17b46a[_0x3a84e8]={'$like':'%'+_0x33b271['query'][_0x3189('0x41')]+'%'};return _0x17b46a;})});}_0x51303a=_[_0x3189('0x42')]({},_0x51303a,_0x33b271[_0x3189('0x4a')]);return _0x4917e3[_0x3189('0x7f')](_0x51303a);}})[_0x3189('0x2c')](function(_0x549bbd){if(_0x549bbd){_0x2d3d78=_0x549bbd['length'];if(!_0x33b271[_0x3189('0x36')][_0x3189('0x3c')](_0x3189('0x3d'))){_0x51303a[_0x3189('0x24')]=qs[_0x3189('0x24')](_0x33b271[_0x3189('0x36')]['limit']);_0x51303a[_0x3189('0x23')]=qs[_0x3189('0x23')](_0x33b271['query'][_0x3189('0x23')]);}return _0x4917e3[_0x3189('0x7f')](_0x51303a);}})[_0x3189('0x2c')](function(_0x5d10f8){if(_0x5d10f8){return _0x5d10f8?{'count':_0x2d3d78,'rows':_0x5d10f8}:null;}})[_0x3189('0x2c')](respondWithResult(_0x5c138a,null))[_0x3189('0x4c')](handleError(_0x5c138a,null));};exports[_0x3189('0x80')]=function(_0x24fec5,_0x5a7cf4,_0x2ef30c){var _0x14cecc={};var _0x2165f1={};var _0x1b8666;var _0x5bbf36;return db[_0x3189('0x44')][_0x3189('0x7b')]({'where':{'id':_0x24fec5[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](handleEntityNotFound(_0x5a7cf4,null))['then'](function(_0x4371b7){if(_0x4371b7){_0x1b8666=_0x4371b7;_0x2165f1[_0x3189('0x35')]=_[_0x3189('0x37')](db['Team'][_0x3189('0x7d')]);_0x2165f1['query']=_[_0x3189('0x37')](_0x24fec5['query']);_0x2165f1[_0x3189('0x38')]=_[_0x3189('0x3a')](_0x2165f1[_0x3189('0x35')],_0x2165f1[_0x3189('0x36')]);_0x14cecc['attributes']=_[_0x3189('0x3a')](_0x2165f1[_0x3189('0x35')],qs[_0x3189('0x3b')](_0x24fec5[_0x3189('0x36')][_0x3189('0x3b')]));_0x14cecc[_0x3189('0x39')]=_0x14cecc['attributes']['length']?_0x14cecc[_0x3189('0x39')]:_0x2165f1[_0x3189('0x35')];_0x14cecc['order']=qs[_0x3189('0x3f')](_0x24fec5[_0x3189('0x36')][_0x3189('0x3f')]);_0x14cecc[_0x3189('0x40')]=qs['filters'](_[_0x3189('0x7e')](_0x24fec5[_0x3189('0x36')],_0x2165f1[_0x3189('0x38')]));if(_0x24fec5[_0x3189('0x36')]['filter']){_0x14cecc[_0x3189('0x40')]=_[_0x3189('0x42')](_0x14cecc['where'],{'$or':_[_0x3189('0x32')](_0x14cecc[_0x3189('0x39')],function(_0x5eeb3d){var _0xe94bda={};_0xe94bda[_0x5eeb3d]={'$like':'%'+_0x24fec5[_0x3189('0x36')]['filter']+'%'};return _0xe94bda;})});}_0x14cecc=_[_0x3189('0x42')]({},_0x14cecc,_0x24fec5[_0x3189('0x4a')]);return _0x1b8666[_0x3189('0x80')](_0x14cecc);}})[_0x3189('0x2c')](function(_0x23d34e){if(_0x23d34e){_0x5bbf36=_0x23d34e[_0x3189('0x49')];if(!_0x24fec5['query'][_0x3189('0x3c')](_0x3189('0x3d'))){_0x14cecc[_0x3189('0x24')]=qs[_0x3189('0x24')](_0x24fec5[_0x3189('0x36')][_0x3189('0x24')]);_0x14cecc[_0x3189('0x23')]=qs[_0x3189('0x23')](_0x24fec5['query'][_0x3189('0x23')]);}return _0x1b8666[_0x3189('0x80')](_0x14cecc);}})['then'](function(_0x418ef8){if(_0x418ef8){return _0x418ef8?{'count':_0x5bbf36,'rows':_0x418ef8}:null;}})[_0x3189('0x2c')](respondWithResult(_0x5a7cf4,null))['catch'](handleError(_0x5a7cf4,null));};exports[_0x3189('0x81')]=function(_0x85c195,_0x4917ee,_0x2a8f73){var _0x464843=_0x85c195[_0x3189('0x6e')][_0x3189('0x73')];var _0x429bc1;return db[_0x3189('0x82')]['findAll']({'where':{'id':_0x464843},'attributes':['id'],'include':[{'model':db[_0x3189('0x7c')],'as':_0x3189('0x83'),'attributes':['id','name',_0x3189('0x84'),_0x3189('0x85'),'interface'],'raw':!![]}]})['then'](function(_0x158199){if(_0x158199){_0x429bc1=_0x158199;var _0x431e68=_[_0x3189('0x86')](_0x158199,function(_0x18d525){var _0x5e565c=_0x18d525['get']({'plain':!![]});return _0x5e565c[_0x3189('0x83')];});return db[_0x3189('0x44')]['find']({'where':{'id':_0x85c195[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](function(_0x36262a){return db['sequelize'][_0x3189('0x50')](function(_0xd24f4a){return _0x36262a[_0x3189('0x81')](_0x464843,{'transaction':_0xd24f4a})[_0x3189('0x2c')](function(){return BPromise[_0x3189('0x87')](_0x429bc1,function(_0x33f64c){return db['TeamVoicePrefix'][_0x3189('0x88')]({'TeamId':_0x33f64c['id'],'VoicePrefixId':_0x85c195['params']['id']},{'transaction':_0xd24f4a});});})[_0x3189('0x2c')](function(){return BPromise[_0x3189('0x87')](_0x431e68,function(_0x1c919f){return db['UserVoicePrefix'][_0x3189('0x89')]({'where':{'UserId':_0x1c919f['id'],'VoicePrefixId':_0x85c195[_0x3189('0x72')]['id']},'transaction':_0xd24f4a});});})['then'](function(){_0x431e68[_0x3189('0x8a')](function(_0x2bab94){socket['emit'](_0x3189('0x77'),{'UserId':_0x2bab94['id'],'VoicePrefixId':_0x36262a['id']});});});});});}})[_0x3189('0x2c')](respondWithStatusCode(_0x4917ee,null))[_0x3189('0x4c')](handleError(_0x4917ee,null));};exports[_0x3189('0x8b')]=function(_0x39fe89,_0x4f564d,_0x341e23){return db['Team'][_0x3189('0x46')]({'where':{'id':_0x39fe89[_0x3189('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x3189('0x7c')],'as':_0x3189('0x83'),'attributes':['id'],'raw':!![]}]})[_0x3189('0x2c')](handleEntityNotFound(_0x4f564d,null))['then'](function(_0x4fb475){var _0x522aa5=_[_0x3189('0x32')](_0x4fb475,'id');var _0x1f0c98=[];var _0x3f5cf9=[];var _0x47ce18=squel['select']();_0x47ce18[_0x3189('0x8c')](_0x3189('0x8d'))[_0x3189('0x8e')](_0x3189('0x8f'),'tq')[_0x3189('0x90')]('user_has_teams','ut',_0x3189('0x91'))['where'](_0x3189('0x92'),_0x39fe89['params']['id']);for(var _0x241a67=0x0;_0x241a67<_0x4fb475[_0x3189('0x49')];_0x241a67+=0x1){let _0x51913c=_0x4fb475[_0x241a67];for(var _0x1a07d7=0x0;_0x1a07d7<_0x51913c[_0x3189('0x83')][_0x3189('0x49')];_0x1a07d7+=0x1){let _0x36602c=_0x51913c['Agents'][_0x1a07d7];var _0x1f9018=_0x47ce18[_0x3189('0x93')]();_0x1f9018[_0x3189('0x40')]('ut.UserId\x20=\x20?',_0x36602c['id']);_0x3f5cf9[_0x3189('0x66')](db[_0x3189('0x4f')][_0x3189('0x36')](_0x1f9018[_0x3189('0x94')](),{'type':db['sequelize'][_0x3189('0x95')][_0x3189('0x96')]})[_0x3189('0x2c')](function(_0x13fc9f){if(_0x13fc9f[_0x3189('0x49')]===0x1){return _0x36602c['id'];}else{var _0x516164=_[_0x3189('0x97')](_['map'](_0x13fc9f,_0x3189('0x98')),function(_0x1f506c){return _[_0x3189('0x99')](_0x522aa5,_0x1f506c);});if(_0x516164){return _0x36602c['id'];}}}));}}return BPromise[_0x3189('0x9a')](_0x3f5cf9)[_0x3189('0x2c')](function(_0x48835c){_0x1f0c98=_(_0x1f0c98)[_0x3189('0x9b')](_0x48835c)[_0x3189('0x9c')]()[_0x3189('0x9d')]();return db['VoicePrefix']['find']({'where':{'id':_0x39fe89[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](function(_0x4c19e2){return db[_0x3189('0x4f')][_0x3189('0x50')](function(_0x5d89ec){return _0x4c19e2[_0x3189('0x8b')](_0x39fe89[_0x3189('0x36')][_0x3189('0x73')],{'transaction':_0x5d89ec})['then'](function(){if(!_[_0x3189('0x9e')](_0x1f0c98)){return _0x4c19e2[_0x3189('0x78')](_0x1f0c98,{'transaction':_0x5d89ec});}})['then'](function(){_0x1f0c98[_0x3189('0x8a')](function(_0xab746c){socket[_0x3189('0x76')](_0x3189('0x7a'),{'UserId':_0xab746c,'VoicePrefixId':_0x4c19e2['id']});});});});});});})[_0x3189('0x2c')](respondWithStatusCode(_0x4f564d,null))[_0x3189('0x4c')](handleError(_0x4f564d,null));}; \ No newline at end of file +var _0x4991=['VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','describe','create','transaction','body','VoiceExtension','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','from-sip','exten','description','Voice\x20Prefix\x20Extension','priority','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','NoOp','goto','context','charAt','system-','findById','addAgents','ids','omit','emit','isArray','userVoicePrefix:remove','getAgents','findOne','pick','getTeams','Team','findAll','User','interface','Agents','sequelize','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','toString','QueryTypes','every','includes','all','union','compact','value','isEmpty','removeAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','index','map'];(function(_0x23d927,_0x2102d1){var _0x1ba1b9=function(_0x4936ab){while(--_0x4936ab){_0x23d927['push'](_0x23d927['shift']());}};_0x1ba1b9(++_0x2102d1);}(_0x4991,0xf7));var _0x1499=function(_0x40e2d7,_0x36cb1d){_0x40e2d7=_0x40e2d7-0x0;var _0x3794b6=_0x4991[_0x40e2d7];return _0x3794b6;};'use strict';var emlformat=require(_0x1499('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1499('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1499('0x2'));var moment=require(_0x1499('0x3'));var BPromise=require(_0x1499('0x4'));var Mustache=require(_0x1499('0x5'));var util=require(_0x1499('0x6'));var path=require(_0x1499('0x7'));var sox=require(_0x1499('0x8'));var csv=require(_0x1499('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1499('0xa'));var _=require(_0x1499('0xb'));var squel=require(_0x1499('0xc'));var crypto=require(_0x1499('0xd'));var jsforce=require(_0x1499('0xe'));var deskjs=require(_0x1499('0xf'));var toCsv=require(_0x1499('0x9'));var querystring=require(_0x1499('0x10'));var Papa=require('papaparse');var Redis=require(_0x1499('0x11'));var authService=require(_0x1499('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1499('0x13'));var hardwareService=require(_0x1499('0x14'));var logger=require('../../config/logger')(_0x1499('0x15'));var utils=require(_0x1499('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1499('0x17')]=_[_0x1499('0x18')](config[_0x1499('0x17')],{'host':_0x1499('0x19'),'port':0x18eb});var socket=require(_0x1499('0x1a'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x1499('0x1b')](socket);function respondWithStatusCode(_0x4e5195,_0x37d99e){_0x37d99e=_0x37d99e||0xcc;return function(_0x12cde0){if(_0x12cde0){return _0x4e5195[_0x1499('0x1c')](_0x37d99e);}return _0x4e5195[_0x1499('0x1d')](_0x37d99e)['end']();};}function respondWithResult(_0x1ed43b,_0x373f57){_0x373f57=_0x373f57||0xc8;return function(_0x592c27){if(_0x592c27){return _0x1ed43b[_0x1499('0x1d')](_0x373f57)[_0x1499('0x1e')](_0x592c27);}};}function respondWithFilteredResult(_0x46b364,_0xc92272){return function(_0x1e45a9){if(_0x1e45a9){var _0x27e533=typeof _0xc92272['offset']==='undefined'&&typeof _0xc92272['limit']===_0x1499('0x1f');var _0xad534b=_0x1e45a9['count'];var _0x351da9=_0x27e533?0x0:_0xc92272[_0x1499('0x20')];var _0x28dff3=_0x27e533?_0x1e45a9[_0x1499('0x21')]:_0xc92272[_0x1499('0x20')]+_0xc92272[_0x1499('0x22')];var _0x2b0458;if(_0x28dff3>=_0xad534b){_0x28dff3=_0xad534b;_0x2b0458=0xc8;}else{_0x2b0458=0xce;}_0x46b364[_0x1499('0x1d')](_0x2b0458);return _0x46b364[_0x1499('0x23')](_0x1499('0x24'),_0x351da9+'-'+_0x28dff3+'/'+_0xad534b)[_0x1499('0x1e')](_0x1e45a9);}return null;};}function patchUpdates(_0x836081){return function(_0x223f4c){try{jsonpatch[_0x1499('0x25')](_0x223f4c,_0x836081,!![]);}catch(_0x4ec57a){return BPromise[_0x1499('0x26')](_0x4ec57a);}return _0x223f4c[_0x1499('0x27')]();};}function saveUpdates(_0x5615b4,_0x258e9c){return function(_0xc79f69){if(_0xc79f69){return _0xc79f69[_0x1499('0x28')](_0x5615b4)[_0x1499('0x29')](function(_0x3968e0){return _0x3968e0;});}return null;};}function removeEntity(_0x16d036,_0x54f3c2){return function(_0x501c0d){if(_0x501c0d){return _0x501c0d[_0x1499('0x2a')]()[_0x1499('0x29')](function(){var _0x3b9259=_0x501c0d[_0x1499('0x2b')]({'plain':!![]});var _0x32782a='VoicePrefixes';return db[_0x1499('0x2c')]['destroy']({'where':{'type':_0x32782a,'resourceId':_0x3b9259['id']}})['then'](function(){return _0x501c0d;});})['then'](function(){_0x16d036[_0x1499('0x1d')](0xcc)[_0x1499('0x2d')]();});}};}function handleEntityNotFound(_0x40932a,_0x1b460b){return function(_0x3dad86){if(!_0x3dad86){_0x40932a[_0x1499('0x1c')](0x194);}return _0x3dad86;};}function handleError(_0x3dd534,_0x5d3ec5){_0x5d3ec5=_0x5d3ec5||0x1f4;return function(_0x180171){logger[_0x1499('0x2e')](_0x180171[_0x1499('0x2f')]);if(_0x180171['name']){delete _0x180171[_0x1499('0x30')];}_0x3dd534[_0x1499('0x1d')](_0x5d3ec5)['send'](_0x180171);};}exports[_0x1499('0x31')]=function(_0x72ad,_0x497efd){var _0x464c5a={},_0x2eda80={},_0x15cc57={'count':0x0,'rows':[]};var _0x39f74f=_[_0x1499('0x32')](db[_0x1499('0x33')][_0x1499('0x34')],function(_0x18b662){return{'name':_0x18b662[_0x1499('0x35')],'type':_0x18b662[_0x1499('0x36')][_0x1499('0x37')]};});_0x2eda80[_0x1499('0x38')]=_[_0x1499('0x32')](_0x39f74f,_0x1499('0x30'));_0x2eda80[_0x1499('0x39')]=_[_0x1499('0x3a')](_0x72ad[_0x1499('0x39')]);_0x2eda80[_0x1499('0x3b')]=_[_0x1499('0x3c')](_0x2eda80[_0x1499('0x38')],_0x2eda80['query']);_0x464c5a[_0x1499('0x3d')]=_[_0x1499('0x3c')](_0x2eda80[_0x1499('0x38')],qs[_0x1499('0x3e')](_0x72ad[_0x1499('0x39')][_0x1499('0x3e')]));_0x464c5a[_0x1499('0x3d')]=_0x464c5a[_0x1499('0x3d')][_0x1499('0x3f')]?_0x464c5a[_0x1499('0x3d')]:_0x2eda80[_0x1499('0x38')];if(!_0x72ad['query']['hasOwnProperty'](_0x1499('0x40'))){_0x464c5a['limit']=qs[_0x1499('0x22')](_0x72ad['query'][_0x1499('0x22')]);_0x464c5a[_0x1499('0x20')]=qs[_0x1499('0x20')](_0x72ad[_0x1499('0x39')]['offset']);}_0x464c5a[_0x1499('0x41')]=qs['sort'](_0x72ad[_0x1499('0x39')][_0x1499('0x42')]);_0x464c5a[_0x1499('0x43')]=qs[_0x1499('0x3b')](_['pick'](_0x72ad[_0x1499('0x39')],_0x2eda80[_0x1499('0x3b')]),_0x39f74f);if(_0x72ad[_0x1499('0x39')][_0x1499('0x44')]){_0x464c5a['where']=_[_0x1499('0x45')](_0x464c5a['where'],{'$or':_[_0x1499('0x32')](_0x39f74f,function(_0x38f449){if(_0x38f449[_0x1499('0x36')]!==_0x1499('0x46')){var _0x3ed978={};_0x3ed978[_0x38f449[_0x1499('0x30')]]={'$like':'%'+_0x72ad[_0x1499('0x39')][_0x1499('0x44')]+'%'};return _0x3ed978;}})});}_0x464c5a=_[_0x1499('0x45')]({},_0x464c5a,_0x72ad[_0x1499('0x47')]);var _0x5ab521={'where':_0x464c5a[_0x1499('0x43')]};return db['VoicePrefix'][_0x1499('0x21')](_0x5ab521)[_0x1499('0x29')](function(_0x5646cf){_0x15cc57[_0x1499('0x21')]=_0x5646cf;if(_0x72ad[_0x1499('0x39')][_0x1499('0x48')]){_0x464c5a[_0x1499('0x49')]=[{'all':!![]}];}return db[_0x1499('0x33')]['findAll'](_0x464c5a);})['then'](function(_0x368fdb){_0x15cc57[_0x1499('0x4a')]=_0x368fdb;return _0x15cc57;})['then'](respondWithFilteredResult(_0x497efd,_0x464c5a))[_0x1499('0x4b')](handleError(_0x497efd,null));};exports[_0x1499('0x4c')]=function(_0x4a5529,_0x5de9b6){var _0x3814aa={'raw':![],'where':{'id':_0x4a5529[_0x1499('0x4d')]['id']}},_0x177147={};_0x177147['model']=_[_0x1499('0x3a')](db[_0x1499('0x33')][_0x1499('0x34')]);_0x177147[_0x1499('0x39')]=_['keys'](_0x4a5529[_0x1499('0x39')]);_0x177147[_0x1499('0x3b')]=_[_0x1499('0x3c')](_0x177147[_0x1499('0x38')],_0x177147['query']);_0x3814aa[_0x1499('0x3d')]=_[_0x1499('0x3c')](_0x177147[_0x1499('0x38')],qs['fields'](_0x4a5529['query'][_0x1499('0x3e')]));_0x3814aa['attributes']=_0x3814aa[_0x1499('0x3d')][_0x1499('0x3f')]?_0x3814aa[_0x1499('0x3d')]:_0x177147[_0x1499('0x38')];if(_0x4a5529[_0x1499('0x39')][_0x1499('0x48')]){_0x3814aa[_0x1499('0x49')]=[{'all':!![]}];}_0x3814aa=_['merge']({},_0x3814aa,_0x4a5529[_0x1499('0x47')]);return db['VoicePrefix'][_0x1499('0x4e')](_0x3814aa)[_0x1499('0x29')](handleEntityNotFound(_0x5de9b6,null))['then'](respondWithResult(_0x5de9b6,null))[_0x1499('0x4b')](handleError(_0x5de9b6,null));};exports[_0x1499('0x2a')]=function(_0x3de674,_0x4d1d24){return db[_0x1499('0x33')][_0x1499('0x4e')]({'where':{'id':_0x3de674[_0x1499('0x4d')]['id']}})[_0x1499('0x29')](handleEntityNotFound(_0x4d1d24,null))[_0x1499('0x29')](removeEntity(_0x4d1d24,null))[_0x1499('0x4b')](handleError(_0x4d1d24,null));};exports[_0x1499('0x4f')]=function(_0x3b7a6b,_0x28822a){return db[_0x1499('0x33')]['describe']()[_0x1499('0x29')](respondWithResult(_0x28822a,null))[_0x1499('0x4b')](handleError(_0x28822a,null));};exports[_0x1499('0x50')]=function(_0x4dc648,_0x339471){var _0x2a7614;return db['sequelize'][_0x1499('0x51')](function(_0x162ddb){return db['VoicePrefix'][_0x1499('0x50')](_0x4dc648[_0x1499('0x52')],{'transaction':_0x162ddb})[_0x1499('0x29')](function(_0x30b27b){_0x2a7614=_0x30b27b[_0x1499('0x2b')]({'plain':!![]});return db[_0x1499('0x53')][_0x1499('0x4e')]({'where':{'id':_0x2a7614['VoiceExtensionId']},'raw':!![]})[_0x1499('0x29')](function(_0x2a9f23){return createVoicePrefixExtensions(_0x2a7614,_0x2a9f23,_0x162ddb);});});})[_0x1499('0x29')](function(){var _0x175b8d=_0x4dc648['user']['get']({'plain':!![]});if(!_0x175b8d)throw new Error(_0x1499('0x54'));if(_0x175b8d[_0x1499('0x55')]==='user'){var _0x3c3a20=_0x2a7614;return db[_0x1499('0x56')][_0x1499('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x175b8d['userProfileId']},'raw':!![]})['then'](function(_0x308ce2){if(_0x308ce2&&_0x308ce2[_0x1499('0x57')]===0x0){return db[_0x1499('0x2c')]['create']({'name':_0x3c3a20[_0x1499('0x30')],'resourceId':_0x3c3a20['id'],'type':_0x308ce2['name'],'sectionId':_0x308ce2['id']},{})[_0x1499('0x29')](function(){return _0x2a7614;});}else{return _0x2a7614;}})[_0x1499('0x4b')](function(_0x2fc6f9){logger[_0x1499('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fc6f9);throw _0x2fc6f9;});}return _0x2a7614;})['then'](respondWithResult(_0x339471,null))['catch'](handleError(_0x339471,null));};function Extension(_0x403832,_0x42629d,_0x1e9261,_0x28866f){this['context']=_0x1499('0x58');this[_0x1499('0x59')]=_0x403832;this['app']=_0x1e9261;this[_0x1499('0x36')]='system';this[_0x1499('0x5a')]=_0x1499('0x5b');this[_0x1499('0x5c')]=_0x42629d;this['appdata']=_0x28866f;}function createVoicePrefixExtensions(_0x739e63,_0xca5326,_0x253706){return new BPromise(function(_0x5b2dab,_0x761610){var _0x3ff1ce=new Extension(formatPrefixName(_0x739e63[_0x1499('0x5d')]),0x1,'NoOp',_0x1499('0x5e'));_0x3ff1ce[_0x1499('0x5f')]=_0x739e63['id'];return db[_0x1499('0x53')][_0x1499('0x50')](_0x3ff1ce,{'transaction':_0x253706})[_0x1499('0x29')](function(_0x96a0ed){var _0x5c61dc=_0x96a0ed[_0x1499('0x2b')]({'plain':!![]});var _0x10b49f=_['map'](addVoicePrefixExtensions(_0x739e63,_0xca5326),function(_0x3839da){_0x3839da[_0x1499('0x60')]=_0x5c61dc['id'];_0x3839da[_0x1499('0x5f')]=_0x739e63['id'];return _0x3839da;});return db[_0x1499('0x53')][_0x1499('0x61')](_0x10b49f,{'transaction':_0x253706})[_0x1499('0x29')](function(_0x5e5ee4){if(!_0x5e5ee4){return _0x761610(_0x1499('0x62'));}else{return _0x5b2dab(_0x5e5ee4);}})[_0x1499('0x4b')](function(_0x4eec83){return _0x761610(_0x4eec83);});});;});};function addVoicePrefixExtensions(_0x4a0487,_0x1ff29d){var _0x314d88=[];var _0x502474=formatPrefixName(_0x4a0487[_0x1499('0x5d')]);_0x314d88[_0x1499('0x63')](new Extension(_0x502474,0x2,_0x1499('0x64'),_0x1499('0x65')+_0x4a0487[_0x1499('0x30')]));if(_0x4a0487['callerIdAll']){_0x314d88['push'](new Extension(_0x502474,0x3,_0x1499('0x64'),'PREFIX-CALLERIDALL='+_0x4a0487['callerIdAll']));}else{_0x314d88[_0x1499('0x63')](new Extension(_0x502474,0x3,_0x1499('0x66'),'No\x20callerid\x20available'));}_0x314d88[_0x1499('0x63')](new Extension(_0x502474,0x4,_0x1499('0x67'),_0x1ff29d[_0x1499('0x68')]+','+'${EXTEN:'+(0x8+_0x4a0487['name'][_0x1499('0x3f')])+'}'+','+0x1));return _0x314d88;}function formatPrefixName(_0x2f3a3a){var _0x256893='_';for(var _0x392f6f=0x0;_0x392f6f<_0x2f3a3a[_0x1499('0x3f')];_0x392f6f++){if(_0x2f3a3a['charAt'](_0x392f6f)=='-'){_0x256893+=_0x2f3a3a[_0x1499('0x69')](_0x392f6f);}else{_0x256893+='['+_0x2f3a3a[_0x1499('0x69')](_0x392f6f)+']';}}_0x256893+='.';return _0x256893;}exports['update']=function(_0x358a76,_0x20e5f3,_0x44d970){var _0x5741e5=_0x358a76[_0x1499('0x52')];_0x5741e5[_0x1499('0x5d')]=_0x1499('0x6a')+_0x5741e5[_0x1499('0x30')]+'-';return db['sequelize'][_0x1499('0x51')](function(_0x74e09b){return db[_0x1499('0x33')]['update'](_0x5741e5,{'where':{'id':_0x5741e5['id']},'transaction':_0x74e09b})[_0x1499('0x29')](function(){return db[_0x1499('0x53')][_0x1499('0x2a')]({'where':{'VoicePrefixId':_0x5741e5['id']},'transaction':_0x74e09b})[_0x1499('0x29')](function(){return db[_0x1499('0x53')][_0x1499('0x4e')]({'where':{'id':_0x5741e5['VoiceExtensionId']},'raw':!![]})[_0x1499('0x29')](function(_0x57e25b){return createVoicePrefixExtensions(_0x5741e5,_0x57e25b,_0x74e09b);});});});})['then'](function(){return db[_0x1499('0x33')][_0x1499('0x6b')](_0x5741e5['id']);})[_0x1499('0x29')](respondWithResult(_0x20e5f3,null))['catch'](handleError(_0x20e5f3,null));};exports['addAgents']=function(_0x320654,_0xb4a84b,_0x494d88){return db[_0x1499('0x33')][_0x1499('0x4e')]({'where':{'id':_0x320654[_0x1499('0x4d')]['id']}})[_0x1499('0x29')](handleEntityNotFound(_0xb4a84b,null))[_0x1499('0x29')](function(_0x3f6f36){if(_0x3f6f36){return _0x3f6f36[_0x1499('0x6c')](_0x320654['body'][_0x1499('0x6d')],_[_0x1499('0x6e')](_0x320654['body'],[_0x1499('0x6d'),'id'])||{})['spread'](function(_0x25a8c4){for(var _0x375576=0x0;_0x375576<_0x320654[_0x1499('0x52')][_0x1499('0x6d')]['length'];_0x375576+=0x1){socket[_0x1499('0x6f')]('userVoicePrefix:save',{'UserId':Number(_0x320654[_0x1499('0x52')]['ids'][_0x375576]),'VoicePrefixId':Number(_0x320654[_0x1499('0x4d')]['id'])});}return _0x25a8c4;});}})[_0x1499('0x29')](respondWithResult(_0xb4a84b,null))[_0x1499('0x4b')](handleError(_0xb4a84b,null));};exports['removeAgents']=function(_0x2349d7,_0x44511c,_0x585fe8){return db['VoicePrefix'][_0x1499('0x4e')]({'where':{'id':_0x2349d7['params']['id']}})[_0x1499('0x29')](handleEntityNotFound(_0x44511c,null))['then'](function(_0x917508){if(_0x917508){return _0x917508['removeAgents'](_0x2349d7[_0x1499('0x39')][_0x1499('0x6d')])[_0x1499('0x29')](function(){if(_[_0x1499('0x70')](_0x2349d7[_0x1499('0x39')][_0x1499('0x6d')])){for(var _0x114aea=0x0;_0x114aea<_0x2349d7[_0x1499('0x39')]['ids'][_0x1499('0x3f')];_0x114aea+=0x1){socket[_0x1499('0x6f')](_0x1499('0x71'),{'UserId':Number(_0x2349d7['query'][_0x1499('0x6d')][_0x114aea]),'VoicePrefixId':Number(_0x2349d7[_0x1499('0x4d')]['id'])});}}else{socket['emit'](_0x1499('0x71'),{'UserId':Number(_0x2349d7[_0x1499('0x39')][_0x1499('0x6d')]),'VoicePrefixId':Number(_0x2349d7[_0x1499('0x4d')]['id'])});}});}})[_0x1499('0x29')](respondWithStatusCode(_0x44511c,null))['catch'](handleError(_0x44511c,null));};exports[_0x1499('0x72')]=function(_0x53700c,_0x5ed058,_0x5cc567){var _0x2a0525={};var _0x362d8c={};var _0x419d9a;var _0x23dfc0;return db[_0x1499('0x33')][_0x1499('0x73')]({'where':{'id':_0x53700c['params']['id']}})['then'](handleEntityNotFound(_0x5ed058,null))[_0x1499('0x29')](function(_0x20e0d7){if(_0x20e0d7){_0x419d9a=_0x20e0d7;_0x362d8c['model']=_[_0x1499('0x3a')](db['User'][_0x1499('0x34')]);_0x362d8c['query']=_[_0x1499('0x3a')](_0x53700c['query']);_0x362d8c[_0x1499('0x3b')]=_['intersection'](_0x362d8c[_0x1499('0x38')],_0x362d8c[_0x1499('0x39')]);_0x2a0525['attributes']=_[_0x1499('0x3c')](_0x362d8c[_0x1499('0x38')],qs['fields'](_0x53700c[_0x1499('0x39')][_0x1499('0x3e')]));_0x2a0525[_0x1499('0x3d')]=_0x2a0525[_0x1499('0x3d')][_0x1499('0x3f')]?_0x2a0525[_0x1499('0x3d')]:_0x362d8c[_0x1499('0x38')];_0x2a0525['order']=qs[_0x1499('0x42')](_0x53700c[_0x1499('0x39')]['sort']);_0x2a0525[_0x1499('0x43')]=qs[_0x1499('0x3b')](_['pick'](_0x53700c[_0x1499('0x39')],_0x362d8c[_0x1499('0x3b')]));if(_0x53700c['query'][_0x1499('0x44')]){_0x2a0525[_0x1499('0x43')]=_[_0x1499('0x45')](_0x2a0525[_0x1499('0x43')],{'$or':_[_0x1499('0x32')](_0x2a0525[_0x1499('0x3d')],function(_0x1f4794){var _0x43b74b={};_0x43b74b[_0x1f4794]={'$like':'%'+_0x53700c['query'][_0x1499('0x44')]+'%'};return _0x43b74b;})});}_0x2a0525=_[_0x1499('0x45')]({},_0x2a0525,_0x53700c[_0x1499('0x47')]);return _0x419d9a[_0x1499('0x72')](_0x2a0525);}})[_0x1499('0x29')](function(_0x3fa3a4){if(_0x3fa3a4){_0x23dfc0=_0x3fa3a4['length'];if(!_0x53700c['query']['hasOwnProperty'](_0x1499('0x40'))){_0x2a0525[_0x1499('0x22')]=qs[_0x1499('0x22')](_0x53700c[_0x1499('0x39')][_0x1499('0x22')]);_0x2a0525[_0x1499('0x20')]=qs[_0x1499('0x20')](_0x53700c[_0x1499('0x39')]['offset']);}return _0x419d9a[_0x1499('0x72')](_0x2a0525);}})[_0x1499('0x29')](function(_0x59a12f){if(_0x59a12f){return _0x59a12f?{'count':_0x23dfc0,'rows':_0x59a12f}:null;}})['then'](respondWithResult(_0x5ed058,null))[_0x1499('0x4b')](handleError(_0x5ed058,null));};exports['getTeams']=function(_0x52282e,_0x5666f5,_0x63c7b3){var _0x118d7a={};var _0x23fd46={};var _0x30ba76;var _0x3c91d2;return db['VoicePrefix']['findOne']({'where':{'id':_0x52282e[_0x1499('0x4d')]['id']}})[_0x1499('0x29')](handleEntityNotFound(_0x5666f5,null))[_0x1499('0x29')](function(_0x497619){if(_0x497619){_0x30ba76=_0x497619;_0x23fd46[_0x1499('0x38')]=_['keys'](db['Team'][_0x1499('0x34')]);_0x23fd46['query']=_[_0x1499('0x3a')](_0x52282e['query']);_0x23fd46[_0x1499('0x3b')]=_['intersection'](_0x23fd46[_0x1499('0x38')],_0x23fd46[_0x1499('0x39')]);_0x118d7a['attributes']=_[_0x1499('0x3c')](_0x23fd46['model'],qs[_0x1499('0x3e')](_0x52282e[_0x1499('0x39')][_0x1499('0x3e')]));_0x118d7a[_0x1499('0x3d')]=_0x118d7a[_0x1499('0x3d')][_0x1499('0x3f')]?_0x118d7a[_0x1499('0x3d')]:_0x23fd46[_0x1499('0x38')];_0x118d7a[_0x1499('0x41')]=qs[_0x1499('0x42')](_0x52282e[_0x1499('0x39')][_0x1499('0x42')]);_0x118d7a[_0x1499('0x43')]=qs['filters'](_[_0x1499('0x74')](_0x52282e[_0x1499('0x39')],_0x23fd46[_0x1499('0x3b')]));if(_0x52282e[_0x1499('0x39')]['filter']){_0x118d7a[_0x1499('0x43')]=_[_0x1499('0x45')](_0x118d7a['where'],{'$or':_['map'](_0x118d7a[_0x1499('0x3d')],function(_0x1fbf21){var _0x2d4e5a={};_0x2d4e5a[_0x1fbf21]={'$like':'%'+_0x52282e[_0x1499('0x39')][_0x1499('0x44')]+'%'};return _0x2d4e5a;})});}_0x118d7a=_[_0x1499('0x45')]({},_0x118d7a,_0x52282e[_0x1499('0x47')]);return _0x30ba76[_0x1499('0x75')](_0x118d7a);}})[_0x1499('0x29')](function(_0x2dd404){if(_0x2dd404){_0x3c91d2=_0x2dd404['length'];if(!_0x52282e['query']['hasOwnProperty'](_0x1499('0x40'))){_0x118d7a[_0x1499('0x22')]=qs[_0x1499('0x22')](_0x52282e[_0x1499('0x39')][_0x1499('0x22')]);_0x118d7a[_0x1499('0x20')]=qs['offset'](_0x52282e[_0x1499('0x39')][_0x1499('0x20')]);}return _0x30ba76[_0x1499('0x75')](_0x118d7a);}})['then'](function(_0x4a11e4){if(_0x4a11e4){return _0x4a11e4?{'count':_0x3c91d2,'rows':_0x4a11e4}:null;}})[_0x1499('0x29')](respondWithResult(_0x5666f5,null))[_0x1499('0x4b')](handleError(_0x5666f5,null));};exports['addTeams']=function(_0x47f7e8,_0x4e5f60,_0x2f9c93){var _0x23e2c6=_0x47f7e8['body'][_0x1499('0x6d')];var _0x7dd273;return db[_0x1499('0x76')][_0x1499('0x77')]({'where':{'id':_0x23e2c6},'attributes':['id'],'include':[{'model':db[_0x1499('0x78')],'as':'Agents','attributes':['id','name','online','voicePause',_0x1499('0x79')],'raw':!![]}]})[_0x1499('0x29')](function(_0x14e4e8){if(_0x14e4e8){_0x7dd273=_0x14e4e8;var _0x5a675b=_['flatMap'](_0x14e4e8,function(_0x479936){var _0x2add75=_0x479936[_0x1499('0x2b')]({'plain':!![]});return _0x2add75[_0x1499('0x7a')];});return db[_0x1499('0x33')][_0x1499('0x4e')]({'where':{'id':_0x47f7e8[_0x1499('0x4d')]['id']}})[_0x1499('0x29')](function(_0x420576){return db[_0x1499('0x7b')]['transaction'](function(_0x3f5aab){return _0x420576['addTeams'](_0x23e2c6,{'transaction':_0x3f5aab})[_0x1499('0x29')](function(){return BPromise[_0x1499('0x7c')](_0x7dd273,function(_0x425dac){return db[_0x1499('0x7d')][_0x1499('0x7e')]({'TeamId':_0x425dac['id'],'VoicePrefixId':_0x47f7e8[_0x1499('0x4d')]['id']},{'transaction':_0x3f5aab});});})[_0x1499('0x29')](function(){return BPromise['each'](_0x5a675b,function(_0x56507a){return db[_0x1499('0x7f')][_0x1499('0x80')]({'where':{'UserId':_0x56507a['id'],'VoicePrefixId':_0x47f7e8['params']['id']},'transaction':_0x3f5aab});});})[_0x1499('0x29')](function(){_0x5a675b[_0x1499('0x81')](function(_0x477bb9){socket['emit']('userVoicePrefix:save',{'UserId':_0x477bb9['id'],'VoicePrefixId':_0x420576['id']});});});});});}})[_0x1499('0x29')](respondWithStatusCode(_0x4e5f60,null))['catch'](handleError(_0x4e5f60,null));};exports[_0x1499('0x82')]=function(_0x3f366a,_0x11ef6,_0x548faf){return db['Team']['findAll']({'where':{'id':_0x3f366a[_0x1499('0x39')][_0x1499('0x6d')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1499('0x7a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x11ef6,null))['then'](function(_0x10f4cf){var _0x5d1170=_['map'](_0x10f4cf,'id');var _0x52de11=[];var _0x2e39ac=[];var _0x4a9e81=squel[_0x1499('0x83')]();_0x4a9e81[_0x1499('0x84')](_0x1499('0x85'))[_0x1499('0x86')](_0x1499('0x87'),'tq')['join'](_0x1499('0x88'),'ut',_0x1499('0x89'))[_0x1499('0x43')]('VoicePrefixId\x20=\x20?',_0x3f366a[_0x1499('0x4d')]['id']);for(var _0x772b0c=0x0;_0x772b0c<_0x10f4cf[_0x1499('0x3f')];_0x772b0c+=0x1){let _0x27135a=_0x10f4cf[_0x772b0c];for(var _0x1e9c28=0x0;_0x1e9c28<_0x27135a[_0x1499('0x7a')][_0x1499('0x3f')];_0x1e9c28+=0x1){let _0x2c1793=_0x27135a['Agents'][_0x1e9c28];var _0x39d6a9=_0x4a9e81[_0x1499('0x8a')]();_0x39d6a9[_0x1499('0x43')]('ut.UserId\x20=\x20?',_0x2c1793['id']);_0x2e39ac[_0x1499('0x63')](db[_0x1499('0x7b')][_0x1499('0x39')](_0x39d6a9[_0x1499('0x8b')](),{'type':db[_0x1499('0x7b')][_0x1499('0x8c')]['SELECT']})[_0x1499('0x29')](function(_0x18d9bc){if(_0x18d9bc['length']===0x1){return _0x2c1793['id'];}else{var _0x271d85=_[_0x1499('0x8d')](_[_0x1499('0x32')](_0x18d9bc,'TeamId'),function(_0x53659b){return _[_0x1499('0x8e')](_0x5d1170,_0x53659b);});if(_0x271d85){return _0x2c1793['id'];}}}));}}return BPromise[_0x1499('0x8f')](_0x2e39ac)[_0x1499('0x29')](function(_0x6478eb){_0x52de11=_(_0x52de11)[_0x1499('0x90')](_0x6478eb)[_0x1499('0x91')]()[_0x1499('0x92')]();return db[_0x1499('0x33')]['find']({'where':{'id':_0x3f366a['params']['id']}})['then'](function(_0x335af4){return db[_0x1499('0x7b')]['transaction'](function(_0x2c5702){return _0x335af4['removeTeams'](_0x3f366a[_0x1499('0x39')][_0x1499('0x6d')],{'transaction':_0x2c5702})['then'](function(){if(!_[_0x1499('0x93')](_0x52de11)){return _0x335af4[_0x1499('0x94')](_0x52de11,{'transaction':_0x2c5702});}})[_0x1499('0x29')](function(){_0x52de11['forEach'](function(_0x3e7f29){socket[_0x1499('0x6f')](_0x1499('0x71'),{'UserId':_0x3e7f29,'VoicePrefixId':_0x335af4['id']});});});});});});})[_0x1499('0x29')](respondWithStatusCode(_0x11ef6,null))[_0x1499('0x4b')](handleError(_0x11ef6,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 3fb1975..8e6e97d 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 _0xd794=['emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','save','update','remove'];(function(_0x4ff722,_0x1fe73e){var _0x2c0b46=function(_0x131079){while(--_0x131079){_0x4ff722['push'](_0x4ff722['shift']());}};_0x2c0b46(++_0x1fe73e);}(_0xd794,0x1e9));var _0x4d79=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd794[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x4d79('0x0'));var VoicePrefix=require(_0x4d79('0x1'))['db'][_0x4d79('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4d79('0x3'),'afterUpdate':_0x4d79('0x4'),'afterDestroy':_0x4d79('0x5')};function emitEvent(_0x4943a6){return function(_0x3104fd,_0x208e0e,_0x1f4dd2){VoicePrefixEvents[_0x4d79('0x6')](_0x4943a6+':'+_0x3104fd['id'],_0x3104fd);VoicePrefixEvents['emit'](_0x4943a6,_0x3104fd);_0x1f4dd2(null);};}for(var e in events){if(events[_0x4d79('0x7')](e)){var event=events[e];VoicePrefix[_0x4d79('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x9173=['events','../../mysqldb','update','remove','emit','hook','exports'];(function(_0x22d216,_0x494f60){var _0x443849=function(_0x31ba48){while(--_0x31ba48){_0x22d216['push'](_0x22d216['shift']());}};_0x443849(++_0x494f60);}(_0x9173,0x18f));var _0x3917=function(_0x20a732,_0x4726ba){_0x20a732=_0x20a732-0x0;var _0x595bb5=_0x9173[_0x20a732];return _0x595bb5;};'use strict';var EventEmitter=require(_0x3917('0x0'));var VoicePrefix=require(_0x3917('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3917('0x2'),'afterDestroy':_0x3917('0x3')};function emitEvent(_0x32e324){return function(_0x570e57,_0x48aa71,_0x37745b){VoicePrefixEvents[_0x3917('0x4')](_0x32e324+':'+_0x570e57['id'],_0x570e57);VoicePrefixEvents[_0x3917('0x4')](_0x32e324,_0x570e57);_0x37745b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x3917('0x5')](e,emitEvent(event));}}module[_0x3917('0x6')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 653b072..989f64f 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 _0xe3af=['moment','bluebird','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','../../config/logger'];(function(_0x5003ae,_0x4ab275){var _0x39504d=function(_0x55c053){while(--_0x55c053){_0x5003ae['push'](_0x5003ae['shift']());}};_0x39504d(++_0x4ab275);}(_0xe3af,0x1ae));var _0xfe3a=function(_0x2ba9ac,_0xa1fdc4){_0x2ba9ac=_0x2ba9ac-0x0;var _0x1b0fc9=_0xe3af[_0x2ba9ac];return _0x1b0fc9;};'use strict';var _=require(_0xfe3a('0x0'));var util=require('util');var logger=require(_0xfe3a('0x1'))('api');var moment=require(_0xfe3a('0x2'));var BPromise=require(_0xfe3a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe3a('0x4'));var rimraf=require(_0xfe3a('0x5'));var config=require(_0xfe3a('0x6'));var attributes=require(_0xfe3a('0x7'));module[_0xfe3a('0x8')]=function(_0x5198f8,_0x37fdb9){return _0x5198f8[_0xfe3a('0x9')](_0xfe3a('0xa'),attributes,{'tableName':_0xfe3a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7de7=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','VoicePrefix','voice_prefixes'];(function(_0x5d2be4,_0x16c38a){var _0x1b6cfc=function(_0x51242e){while(--_0x51242e){_0x5d2be4['push'](_0x5d2be4['shift']());}};_0x1b6cfc(++_0x16c38a);}(_0x7de7,0x6e));var _0x77de=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x7de7[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x77de('0x0'));var util=require('util');var logger=require(_0x77de('0x1'))(_0x77de('0x2'));var moment=require(_0x77de('0x3'));var BPromise=require(_0x77de('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x77de('0x5'));var rimraf=require(_0x77de('0x6'));var config=require(_0x77de('0x7'));var attributes=require('./voicePrefix.attributes');module[_0x77de('0x8')]=function(_0x577d2a,_0x3ad1f8){return _0x577d2a['define'](_0x77de('0x9'),attributes,{'tableName':_0x77de('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index c11e828..2d40a63 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 _0xdcdb=['localhost','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x2dad28,_0x238ccb){var _0x5d72ba=function(_0xb59bfe){while(--_0xb59bfe){_0x2dad28['push'](_0x2dad28['shift']());}};_0x5d72ba(++_0x238ccb);}(_0xdcdb,0x64));var _0xbdcd=function(_0x30b95a,_0x103ff4){_0x30b95a=_0x30b95a-0x0;var _0x356c58=_0xdcdb[_0x30b95a];return _0x356c58;};'use strict';var _=require(_0xbdcd('0x0'));var util=require(_0xbdcd('0x1'));var moment=require(_0xbdcd('0x2'));var BPromise=require(_0xbdcd('0x3'));var rs=require(_0xbdcd('0x4'));var fs=require('fs');var Redis=require(_0xbdcd('0x5'));var db=require(_0xbdcd('0x6'))['db'];var utils=require(_0xbdcd('0x7'));var logger=require(_0xbdcd('0x8'))(_0xbdcd('0x9'));var config=require(_0xbdcd('0xa'));var jayson=require(_0xbdcd('0xb'));var client=jayson[_0xbdcd('0xc')][_0xbdcd('0xd')]({'port':0x232a});config[_0xbdcd('0xe')]=_[_0xbdcd('0xf')](config[_0xbdcd('0xe')],{'host':_0xbdcd('0x10'),'port':0x18eb});var socket=require(_0xbdcd('0x11'))(new Redis(config[_0xbdcd('0xe')]));require('./voicePrefix.socket')[_0xbdcd('0x12')](socket);function respondWithRpcPromise(_0xb2ba4b,_0x528bc1,_0xb2dbbb){return new BPromise(function(_0x486672,_0x63a874){return client[_0xbdcd('0x13')](_0xb2ba4b,_0xb2dbbb)[_0xbdcd('0x14')](function(_0x18ea8d){logger[_0xbdcd('0x15')](_0xbdcd('0x16'),_0x528bc1,'request\x20sent');logger[_0xbdcd('0x17')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x528bc1,_0xbdcd('0x18'),JSON['stringify'](_0x18ea8d));if(_0x18ea8d['error']){if(_0x18ea8d[_0xbdcd('0x19')]['code']===0x1f4){logger[_0xbdcd('0x19')](_0xbdcd('0x16'),_0x528bc1,_0x18ea8d['error'][_0xbdcd('0x1a')]);return _0x63a874(_0x18ea8d[_0xbdcd('0x19')][_0xbdcd('0x1a')]);}logger[_0xbdcd('0x19')]('VoicePrefix,\x20%s,\x20%s',_0x528bc1,_0x18ea8d[_0xbdcd('0x19')][_0xbdcd('0x1a')]);return _0x486672(_0x18ea8d[_0xbdcd('0x19')][_0xbdcd('0x1a')]);}else{logger[_0xbdcd('0x15')](_0xbdcd('0x16'),_0x528bc1,_0xbdcd('0x18'));_0x486672(_0x18ea8d[_0xbdcd('0x1b')][_0xbdcd('0x1a')]);}})[_0xbdcd('0x1c')](function(_0x4f5c5c){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x528bc1,_0x4f5c5c);_0x63a874(_0x4f5c5c);});});} \ No newline at end of file +var _0xb5dd=['socket.io-emitter','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x1118b4,_0x369423){var _0x2c5703=function(_0x32d086){while(--_0x32d086){_0x1118b4['push'](_0x1118b4['shift']());}};_0x2c5703(++_0x369423);}(_0xb5dd,0xd9));var _0xdb5d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb5dd[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xdb5d('0x0'));var util=require(_0xdb5d('0x1'));var moment=require(_0xdb5d('0x2'));var BPromise=require(_0xdb5d('0x3'));var rs=require(_0xdb5d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb5d('0x5'))['db'];var utils=require(_0xdb5d('0x6'));var logger=require(_0xdb5d('0x7'))('rpc');var config=require(_0xdb5d('0x8'));var jayson=require(_0xdb5d('0x9'));var client=jayson[_0xdb5d('0xa')][_0xdb5d('0xb')]({'port':0x232a});config[_0xdb5d('0xc')]=_[_0xdb5d('0xd')](config[_0xdb5d('0xc')],{'host':_0xdb5d('0xe'),'port':0x18eb});var socket=require(_0xdb5d('0xf'))(new Redis(config[_0xdb5d('0xc')]));require('./voicePrefix.socket')[_0xdb5d('0x10')](socket);function respondWithRpcPromise(_0x288b8f,_0x2a0f4a,_0x4fb3ab){return new BPromise(function(_0x541c31,_0xeb1c09){return client[_0xdb5d('0x11')](_0x288b8f,_0x4fb3ab)[_0xdb5d('0x12')](function(_0x56eb05){logger['info'](_0xdb5d('0x13'),_0x2a0f4a,_0xdb5d('0x14'));logger[_0xdb5d('0x15')](_0xdb5d('0x16'),_0x2a0f4a,_0xdb5d('0x14'),JSON[_0xdb5d('0x17')](_0x56eb05));if(_0x56eb05[_0xdb5d('0x18')]){if(_0x56eb05['error'][_0xdb5d('0x19')]===0x1f4){logger[_0xdb5d('0x18')](_0xdb5d('0x13'),_0x2a0f4a,_0x56eb05['error'][_0xdb5d('0x1a')]);return _0xeb1c09(_0x56eb05[_0xdb5d('0x18')][_0xdb5d('0x1a')]);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x2a0f4a,_0x56eb05[_0xdb5d('0x18')]['message']);return _0x541c31(_0x56eb05[_0xdb5d('0x18')][_0xdb5d('0x1a')]);}else{logger[_0xdb5d('0x1b')](_0xdb5d('0x13'),_0x2a0f4a,_0xdb5d('0x14'));_0x541c31(_0x56eb05[_0xdb5d('0x1c')][_0xdb5d('0x1a')]);}})['catch'](function(_0x21e981){logger['error'](_0xdb5d('0x13'),_0x2a0f4a,_0x21e981);_0xeb1c09(_0x21e981);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 63f7c2c..9cfdaa1 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 _0x44d4=['length','./voicePrefix.events','removeListener','register'];(function(_0x52dd3c,_0x12bdc1){var _0xf1f43b=function(_0x3f6664){while(--_0x3f6664){_0x52dd3c['push'](_0x52dd3c['shift']());}};_0xf1f43b(++_0x12bdc1);}(_0x44d4,0x161));var _0x444d=function(_0x5906ba,_0xc0e1e6){_0x5906ba=_0x5906ba-0x0;var _0x11e417=_0x44d4[_0x5906ba];return _0x11e417;};'use strict';var VoicePrefixEvents=require(_0x444d('0x0'));var events=['save','remove','update'];function createListener(_0x1c1a07,_0x409499){return function(_0x5a77ed){_0x409499['emit'](_0x1c1a07,_0x5a77ed);};}function removeListener(_0x51377d,_0x1c3432){return function(){VoicePrefixEvents[_0x444d('0x1')](_0x51377d,_0x1c3432);};}exports[_0x444d('0x2')]=function(_0x24f601){for(var _0x45dfdb=0x0,_0x33fe8c=events[_0x444d('0x3')];_0x45dfdb<_0x33fe8c;_0x45dfdb++){var _0x58e34d=events[_0x45dfdb];var _0x38938a=createListener('voicePrefix:'+_0x58e34d,_0x24f601);VoicePrefixEvents['on'](_0x58e34d,_0x38938a);}}; \ No newline at end of file +var _0x834d=['update','emit','register','length','voicePrefix:','./voicePrefix.events','save'];(function(_0x2ba6dc,_0x3a5110){var _0x4bf4bd=function(_0x53a795){while(--_0x53a795){_0x2ba6dc['push'](_0x2ba6dc['shift']());}};_0x4bf4bd(++_0x3a5110);}(_0x834d,0x140));var _0xd834=function(_0x55d63e,_0x41cfc1){_0x55d63e=_0x55d63e-0x0;var _0x149059=_0x834d[_0x55d63e];return _0x149059;};'use strict';var VoicePrefixEvents=require(_0xd834('0x0'));var events=[_0xd834('0x1'),'remove',_0xd834('0x2')];function createListener(_0x555e39,_0x48410e){return function(_0x19a31d){_0x48410e[_0xd834('0x3')](_0x555e39,_0x19a31d);};}function removeListener(_0x2d838f,_0xfee6e0){return function(){VoicePrefixEvents['removeListener'](_0x2d838f,_0xfee6e0);};}exports[_0xd834('0x4')]=function(_0x3f0759){for(var _0x5e696=0x0,_0x42623d=events[_0xd834('0x5')];_0x5e696<_0x42623d;_0x5e696++){var _0x256853=events[_0x5e696];var _0x51c989=createListener(_0xd834('0x6')+_0x256853,_0x3f0759);VoicePrefixEvents['on'](_0x256853,_0x51c989);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index e44a1e6..1a72648 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(_0x32bbb1,_0xa0e27e){var _0x42b415=function(_0x23f4e2){while(--_0x23f4e2){_0x32bbb1['push'](_0x32bbb1['shift']());}};_0x42b415(++_0xa0e27e);}(_0xb10b,0x12a));var _0xbb10=function(_0x369f28,_0x2c949d){_0x369f28=_0x369f28-0x0;var _0x584c8c=_0xb10b[_0x369f28];return _0x584c8c;};'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(_0x148834,_0x1caff0){var _0x51b610=function(_0x5579df){while(--_0x5579df){_0x148834['push'](_0x148834['shift']());}};_0x51b610(++_0x1caff0);}(_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'));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 90ce722..0a92b29 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 _0xd786=['#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','name','inbound','STRING','default','ENUM','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','preview','booked','roundrobin','includes','INTEGER','yes','all','once','TEXT','periodic_announce','join','joinempty','leavewhenempty','split','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','dropRate','FLOAT','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence'];(function(_0x1af0e5,_0x152990){var _0x3c444a=function(_0x3b3d13){while(--_0x3b3d13){_0x1af0e5['push'](_0x1af0e5['shift']());}};_0x3c444a(++_0x152990);}(_0xd786,0x1d4));var _0x6d78=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd786[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x6d78('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6d78('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x6d78('0x2'),'outbound'),'allowNull':![],'defaultValue':_0x6d78('0x2')},'musiconhold':{'type':Sequelize[_0x6d78('0x3')],'defaultValue':_0x6d78('0x4')},'announce':{'type':Sequelize[_0x6d78('0x3')],'defaultValue':''},'strategy':{'type':Sequelize[_0x6d78('0x5')]('rr',_0x6d78('0x6'),_0x6d78('0x7'),_0x6d78('0x8'),_0x6d78('0x9'),_0x6d78('0xa'),_0x6d78('0xb'),_0x6d78('0xc'),_0x6d78('0xd')),'allowNull':![],'defaultValue':_0x6d78('0x6'),'set':function(_0xfdfcfa){this[_0x6d78('0xe')](_0x6d78('0xf'),_0xfdfcfa?_0xfdfcfa:'rrmemory');},'get':function(){var _0x3314f8=this[_0x6d78('0x10')](_0x6d78('0x11'));var _0x232655=this[_0x6d78('0x10')]('dialMethod');var _0x54e106=this['getDataValue']('strategy');if(_0x3314f8==='outbound'){if(_0x232655===_0x6d78('0x12')){return null;}if(_0x232655===_0x6d78('0x13')&&![_0x6d78('0xa'),_0x6d78('0x14')][_0x6d78('0x15')](_0x54e106)){this['setDataValue'](_0x6d78('0xf'),_0x6d78('0xa'));}}return _0x54e106;}},'servicelevel':{'type':Sequelize[_0x6d78('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x6d78('0x3')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x6d78('0x3')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x6d78('0x5')](_0x6d78('0x17'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM']('yes','no',_0x6d78('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x6d78('0x16')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x6d78('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x6d78('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x6d78('0x5')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x6d78('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x6d78('0x5')](_0x6d78('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x6d78('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x6d78('0x3')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x6d78('0x3')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x6d78('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x6d78('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x6d78('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x6d78('0x5')](_0x6d78('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x6d78('0x17'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x6d78('0x5')](_0x6d78('0x17'),'no',_0x6d78('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x6d78('0x3')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x6d78('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x6d78('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x6d78('0x3')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x6d78('0x3')]},'queue_youarenext':{'type':Sequelize[_0x6d78('0x3')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x6d78('0x3')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x6d78('0x3')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x6d78('0x3')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x6d78('0x3')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x6d78('0x3')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x6d78('0x3')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x6d78('0x3')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x6d78('0x3')]},'queue_quantity1':{'type':Sequelize[_0x6d78('0x3')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x6d78('0x3')]},'periodic_announce':{'type':Sequelize[_0x6d78('0x1a')],'set':function(_0x2d56b3){this[_0x6d78('0xe')](_0x6d78('0x1b'),_0x2d56b3?_0x2d56b3[_0x6d78('0x1c')](','):[]);},'get':function(){return this[_0x6d78('0x10')](_0x6d78('0x1b'))?this[_0x6d78('0x10')](_0x6d78('0x1b'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x6d78('0x3')],'defaultValue':_0x6d78('0x17'),'set':function(_0x3aa060){this[_0x6d78('0xe')]('joinempty',_0x3aa060?_0x3aa060['join'](','):undefined);},'get':function(){return this[_0x6d78('0x10')](_0x6d78('0x1d'))?this[_0x6d78('0x10')](_0x6d78('0x1d'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x6d78('0x3')],'defaultValue':'no','set':function(_0x505805){this['setDataValue'](_0x6d78('0x1e'),_0x505805?_0x505805['join'](','):undefined);},'get':function(){return this[_0x6d78('0x10')](_0x6d78('0x1e'))?this[_0x6d78('0x10')](_0x6d78('0x1e'))[_0x6d78('0x1f')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x6d78('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x6d78('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x6d78('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x6d78('0x5')](_0x6d78('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6d78('0x3')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x40f328){this[_0x6d78('0xe')]('acw',_0x40f328);if(_0x40f328){if(this[_0x6d78('0x10')](_0x6d78('0x20'))<0x2){this['setDataValue'](_0x6d78('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x6d78('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x6d78('0x21')],'defaultValue':0x0,'comment':_0x6d78('0x22')},'dialMethod':{'type':Sequelize['ENUM'](_0x6d78('0x12'),_0x6d78('0x23'),_0x6d78('0x24'),_0x6d78('0x25'),'booked'),'defaultValue':'progressive','comment':_0x6d78('0x26')},'dialLimitChannel':{'type':Sequelize[_0x6d78('0x16')](0x4)[_0x6d78('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x6d78('0x28')},'dialLimitQueue':{'type':Sequelize[_0x6d78('0x16')](0x4)[_0x6d78('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x6d78('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x6d78('0x5')]('agentBusyFactor',_0x6d78('0x29')),'defaultValue':_0x6d78('0x29'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x6d78('0x2a')](0x2)[_0x6d78('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x6d78('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x6d78('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0x6d78('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x6d78('0x3')]},'dialOriginateTimeout':{'type':Sequelize[_0x6d78('0x16')](0x3)[_0x6d78('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6d78('0x2c')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x6d78('0x2d'),'comment':_0x6d78('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0x6d78('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6d78('0x2f')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x6d78('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0x6d78('0x16')](0x3)[_0x6d78('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6d78('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6d78('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x6d78('0x16')](0x3)[_0x6d78('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6d78('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6d78('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x6d78('0x16')](0x3)[_0x6d78('0x27')],'defaultValue':0x3,'comment':_0x6d78('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x6d78('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6d78('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x6d78('0x16')](0x3)[_0x6d78('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x6d78('0x35')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x6d78('0x3')],'defaultValue':_0x6d78('0x36')},'dialPrefix':{'type':Sequelize[_0x6d78('0x3')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x6d78('0x5')](_0x6d78('0x37'),_0x6d78('0x38'),_0x6d78('0x39')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x6d78('0x21')],'defaultValue':0x0,'comment':_0x6d78('0x3a')},'dialAMDInitialSilence':{'type':Sequelize[_0x6d78('0x16')](0x9)[_0x6d78('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x6d78('0x3b')},'dialAMDGreeting':{'type':Sequelize[_0x6d78('0x16')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x6d78('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6d78('0x16')](0x9)[_0x6d78('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x6d78('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x6d78('0x16')](0x9)[_0x6d78('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6d78('0x3e')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x6d78('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x6d78('0x3f')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x6d78('0x16')](0x9)[_0x6d78('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x6d78('0x40')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x6d78('0x41')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x6d78('0x16')](0x5)[_0x6d78('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6d78('0x42')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x6d78('0x16')](0x9)[_0x6d78('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6d78('0x43')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x6d78('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x6d78('0x44')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x6d78('0x45')},'dialOrderByScheduledAt':{'type':Sequelize[_0x6d78('0x5')](_0x6d78('0x46'),_0x6d78('0x47')),'defaultValue':_0x6d78('0x46')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x6d78('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x6d78('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x6d78('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x6d78('0x16')](0x3)[_0x6d78('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6d78('0x48')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6d78('0x49')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6d78('0x4a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x6d78('0x16')](0x5)[_0x6d78('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6d78('0x4b')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6d78('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6d78('0x4c')},'dialDropRetryFrequency':{'type':Sequelize[_0x6d78('0x16')](0x5)[_0x6d78('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6d78('0x4d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x6d78('0x16')](0x3)[_0x6d78('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6d78('0x4e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x6d78('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6d78('0x4f')},'dialMachineMaxRetry':{'type':Sequelize[_0x6d78('0x16')](0x3)[_0x6d78('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6d78('0x50')},'dialMachineRetryFrequency':{'type':Sequelize[_0x6d78('0x16')](0x5)[_0x6d78('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6d78('0x51')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x6d78('0x16')](0x3)[_0x6d78('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6d78('0x52')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x6d78('0x16')](0x5)[_0x6d78('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6d78('0x53')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6d78('0x16')],'allowNull':!![],'comment':_0x6d78('0x54')},'mandatoryDisposition':{'type':Sequelize[_0x6d78('0x21')],'defaultValue':![],'comment':_0x6d78('0x55'),'set':function(_0x4ca244){if(!_0x4ca244)this[_0x6d78('0xe')](_0x6d78('0x56'),null);this['setDataValue'](_0x6d78('0x57'),_0x4ca244);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x6d78('0x16')](0x3)[_0x6d78('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x6d78('0x16')](0x3)[_0x6d78('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x6d78('0x16')](0x3)[_0x6d78('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe736=['inbound','default','ENUM','ringall','fewestcalls','random','linear','wrandom','rrordered','setDataValue','strategy','rrmemory','getDataValue','dialMethod','outbound','preview','booked','INTEGER','yes','all','TEXT','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','acw','wrapuptime','power','predictive','progressive','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).','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','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)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','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','name'];(function(_0x1c4c80,_0x570562){var _0x28935c=function(_0x1cdc4b){while(--_0x1cdc4b){_0x1c4c80['push'](_0x1c4c80['shift']());}};_0x28935c(++_0x570562);}(_0xe736,0xf8));var _0x6e73=function(_0x3cc239,_0x442ccd){_0x3cc239=_0x3cc239-0x0;var _0xffc08d=_0xe736[_0x3cc239];return _0xffc08d;};'use strict';var Sequelize=require(_0x6e73('0x0'));module[_0x6e73('0x1')]={'name':{'type':Sequelize[_0x6e73('0x2')],'allowNull':![],'unique':_0x6e73('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x6e73('0x4'),'outbound'),'allowNull':![],'defaultValue':_0x6e73('0x4')},'musiconhold':{'type':Sequelize[_0x6e73('0x2')],'defaultValue':_0x6e73('0x5')},'announce':{'type':Sequelize[_0x6e73('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x6e73('0x6')]('rr',_0x6e73('0x7'),'leastrecent',_0x6e73('0x8'),_0x6e73('0x9'),'rrmemory',_0x6e73('0xa'),_0x6e73('0xb'),_0x6e73('0xc')),'allowNull':![],'defaultValue':_0x6e73('0x7'),'set':function(_0x53e528){this[_0x6e73('0xd')](_0x6e73('0xe'),_0x53e528?_0x53e528:_0x6e73('0xf'));},'get':function(){var _0x339b34=this[_0x6e73('0x10')]('type');var _0x3a52c7=this[_0x6e73('0x10')](_0x6e73('0x11'));var _0x4f2fb6=this[_0x6e73('0x10')](_0x6e73('0xe'));if(_0x339b34===_0x6e73('0x12')){if(_0x3a52c7===_0x6e73('0x13')){return null;}if(_0x3a52c7===_0x6e73('0x14')&&!['rrmemory','roundrobin']['includes'](_0x4f2fb6)){this[_0x6e73('0xd')](_0x6e73('0xe'),'rrmemory');}}return _0x4f2fb6;}},'servicelevel':{'type':Sequelize[_0x6e73('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x6e73('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x6e73('0x15')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x6e73('0x2')]},'weight':{'type':Sequelize[_0x6e73('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x6e73('0x6')](_0x6e73('0x16'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x6e73('0x6')](_0x6e73('0x16'),'no',_0x6e73('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x6e73('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x6e73('0x6')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x6e73('0x6')](_0x6e73('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x6e73('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x6e73('0x6')](_0x6e73('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x6e73('0x6')](_0x6e73('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x6e73('0x6')](_0x6e73('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x6e73('0x6')](_0x6e73('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x6e73('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x6e73('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x6e73('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x6e73('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x6e73('0x6')](_0x6e73('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x6e73('0x6')](_0x6e73('0x16'),'no'),'defaultValue':_0x6e73('0x16')},'announce_holdtime':{'type':Sequelize[_0x6e73('0x6')](_0x6e73('0x16'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x6e73('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x6e73('0x6')](_0x6e73('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x6e73('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x6e73('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x6e73('0x2')]},'queue_youarenext':{'type':Sequelize[_0x6e73('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x6e73('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x6e73('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x6e73('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x6e73('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x6e73('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x6e73('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x6e73('0x2')]},'queue_quantity1':{'type':Sequelize[_0x6e73('0x2')]},'queue_quantity2':{'type':Sequelize[_0x6e73('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x6e73('0x2')]},'queue_less_than':{'type':Sequelize[_0x6e73('0x2')]},'periodic_announce':{'type':Sequelize[_0x6e73('0x18')],'set':function(_0x20e1cc){this[_0x6e73('0xd')](_0x6e73('0x19'),_0x20e1cc?_0x20e1cc['join'](','):[]);},'get':function(){return this[_0x6e73('0x10')](_0x6e73('0x19'))?this[_0x6e73('0x10')](_0x6e73('0x19'))[_0x6e73('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x6e73('0x2')],'defaultValue':_0x6e73('0x16'),'set':function(_0x5e15d1){this['setDataValue'](_0x6e73('0x1b'),_0x5e15d1?_0x5e15d1[_0x6e73('0x1c')](','):undefined);},'get':function(){return this[_0x6e73('0x10')](_0x6e73('0x1b'))?this[_0x6e73('0x10')](_0x6e73('0x1b'))[_0x6e73('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x31d0e7){this[_0x6e73('0xd')]('leavewhenempty',_0x31d0e7?_0x31d0e7['join'](','):undefined);},'get':function(){return this['getDataValue']('leavewhenempty')?this[_0x6e73('0x10')](_0x6e73('0x1d'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x6e73('0x6')](_0x6e73('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x6e73('0x6')](_0x6e73('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x6e73('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x6e73('0x6')](_0x6e73('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x6e73('0x2')]},'description':{'type':Sequelize[_0x6e73('0x2')]},'acw':{'type':Sequelize[_0x6e73('0x1e')],'defaultValue':0x0,'set':function(_0x576f40){this[_0x6e73('0xd')](_0x6e73('0x1f'),_0x576f40);if(_0x576f40){if(this[_0x6e73('0x10')](_0x6e73('0x20'))<0x2){this['setDataValue'](_0x6e73('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x6e73('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x6e73('0x6')](_0x6e73('0x13'),'progressive',_0x6e73('0x21'),_0x6e73('0x22'),_0x6e73('0x14')),'defaultValue':_0x6e73('0x23'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x6e73('0x15')](0x4)[_0x6e73('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x6e73('0x25')},'dialLimitQueue':{'type':Sequelize[_0x6e73('0x15')](0x4)[_0x6e73('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x6e73('0x26')},'dialPowerLevel':{'type':Sequelize[_0x6e73('0x27')](0x2)[_0x6e73('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x6e73('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x6e73('0x6')]('agentBusyFactor','dropRate'),'defaultValue':'dropRate','comment':_0x6e73('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x6e73('0x27')](0x2)[_0x6e73('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x6e73('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x6e73('0x15')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x6e73('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0x6e73('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x6e73('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x6e73('0x15')](0x3)[_0x6e73('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e73('0x2c')},'dialQueueOptions':{'type':Sequelize[_0x6e73('0x2')],'defaultValue':_0x6e73('0x2d'),'comment':_0x6e73('0x2e')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x6e73('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x6e73('0x2')],'comment':_0x6e73('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x6e73('0x15')](0x3)[_0x6e73('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e73('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x6e73('0x15')](0x5)[_0x6e73('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e73('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x6e73('0x15')](0x3)[_0x6e73('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e73('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x6e73('0x15')](0x5)[_0x6e73('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x6e73('0x15')](0x3)[_0x6e73('0x24')],'defaultValue':0x3,'comment':_0x6e73('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x6e73('0x15')](0x5)[_0x6e73('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e73('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x6e73('0x15')](0x3)[_0x6e73('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x6e73('0x35')},'dialTimezone':{'type':Sequelize[_0x6e73('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x6e73('0x2')],'defaultValue':_0x6e73('0x36')},'dialPrefix':{'type':Sequelize[_0x6e73('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x6e73('0x6')](_0x6e73('0x37'),_0x6e73('0x38'),_0x6e73('0x39')),'defaultValue':_0x6e73('0x37')},'dialAMDActive':{'type':Sequelize[_0x6e73('0x1e')],'defaultValue':0x0,'comment':_0x6e73('0x3a')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x6e73('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x6e73('0x15')](0x9)[_0x6e73('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x6e73('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6e73('0x15')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x6e73('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6e73('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0x6e73('0x15')](0x9)[_0x6e73('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x6e73('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x6e73('0x15')](0x9)[_0x6e73('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x6e73('0x15')](0x9)[_0x6e73('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x6e73('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x6e73('0x15')](0x5)[_0x6e73('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6e73('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x6e73('0x15')](0x9)[_0x6e73('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6e73('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0x6e73('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x6e73('0x42')},'dialRecallInQueue':{'type':Sequelize[_0x6e73('0x1e')],'defaultValue':0x0,'comment':_0x6e73('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0x6e73('0x6')](_0x6e73('0x44'),_0x6e73('0x45')),'defaultValue':_0x6e73('0x44')},'dialQueueProject2':{'type':Sequelize[_0x6e73('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x6e73('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x6e73('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x6e73('0x15')](0x3)[_0x6e73('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6e73('0x46')},'dialCutDigit':{'type':Sequelize[_0x6e73('0x15')](0x3)[_0x6e73('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6e73('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6e73('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x6e73('0x15')](0x5)[_0x6e73('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e73('0x48')},'dialDropMaxRetry':{'type':Sequelize[_0x6e73('0x15')](0x3)[_0x6e73('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e73('0x49')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6e73('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e73('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x6e73('0x15')](0x3)[_0x6e73('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e73('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6e73('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e73('0x4c')},'dialMachineMaxRetry':{'type':Sequelize[_0x6e73('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e73('0x4d')},'dialMachineRetryFrequency':{'type':Sequelize[_0x6e73('0x15')](0x5)[_0x6e73('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e73('0x4e')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6e73('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e73('0x4f')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x6e73('0x15')](0x5)[_0x6e73('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x6e73('0x50')},'mandatoryDisposition':{'type':Sequelize[_0x6e73('0x1e')],'defaultValue':![],'comment':_0x6e73('0x51'),'set':function(_0x46cc5b){if(!_0x46cc5b)this[_0x6e73('0xd')](_0x6e73('0x52'),null);this[_0x6e73('0xd')](_0x6e73('0x53'),_0x46cc5b);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x6e73('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x6e73('0x15')](0x3)[_0x6e73('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x6e73('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x6e73('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x6e73('0x1e')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 4d673d4..45e4383 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 _0x0a6b=['ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','CmList','NOW()','removeBlackLists','eml-format','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','reject','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','name','UserProfileResource','destroy','error','stack','send','VoiceQueue','rawAttributes','fieldName','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','role','user','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','User','online','interface','flatMap','forEach','Agents','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','penalty','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','every','TeamId','all','union','compact','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','push','isArray','getAgents','getMembers','getLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ListId','ContactId','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','into','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id'];(function(_0x32666d,_0xc27cf6){var _0x37016e=function(_0x5c4cab){while(--_0x5c4cab){_0x32666d['push'](_0x32666d['shift']());}};_0x37016e(++_0xc27cf6);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x3022db,_0x8d7f2f){_0x3022db=_0x3022db-0x0;var _0x5ed072=_0x0a6b[_0x3022db];return _0x5ed072;};'use strict';var emlformat=require(_0xb0a6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb0a6('0x1'));var moment=require('moment');var BPromise=require(_0xb0a6('0x2'));var Mustache=require(_0xb0a6('0x3'));var util=require(_0xb0a6('0x4'));var path=require('path');var sox=require(_0xb0a6('0x5'));var csv=require('to-csv');var ejs=require(_0xb0a6('0x6'));var fs=require('fs');var fs_extra=require(_0xb0a6('0x7'));var _=require('lodash');var squel=require(_0xb0a6('0x8'));var crypto=require(_0xb0a6('0x9'));var jsforce=require(_0xb0a6('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb0a6('0xb'));var Redis=require(_0xb0a6('0xc'));var authService=require(_0xb0a6('0xd'));var qs=require(_0xb0a6('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb0a6('0xf'));var logger=require(_0xb0a6('0x10'))('api');var utils=require(_0xb0a6('0x11'));var config=require(_0xb0a6('0x12'));var licenseUtil=require(_0xb0a6('0x13'));var db=require(_0xb0a6('0x14'))['db'];config[_0xb0a6('0x15')]=_[_0xb0a6('0x16')](config[_0xb0a6('0x15')],{'host':_0xb0a6('0x17'),'port':0x18eb});var socket=require(_0xb0a6('0x18'))(new Redis(config[_0xb0a6('0x15')]));require('./voiceQueue.socket')[_0xb0a6('0x19')](socket);function respondWithStatusCode(_0x54016c,_0x397c36){_0x397c36=_0x397c36||0xcc;return function(_0x5351ed){if(_0x5351ed){return _0x54016c[_0xb0a6('0x1a')](_0x397c36);}return _0x54016c['status'](_0x397c36)[_0xb0a6('0x1b')]();};}function respondWithResult(_0x382c2f,_0x93243e){_0x93243e=_0x93243e||0xc8;return function(_0x5673ad){if(_0x5673ad){return _0x382c2f['status'](_0x93243e)[_0xb0a6('0x1c')](_0x5673ad);}};}function respondWithFilteredResult(_0x295b53,_0x59bc9c){return function(_0x18f994){if(_0x18f994){var _0x10f504=typeof _0x59bc9c[_0xb0a6('0x1d')]==='undefined'&&typeof _0x59bc9c[_0xb0a6('0x1e')]===_0xb0a6('0x1f');var _0x372457=_0x18f994[_0xb0a6('0x20')];var _0x4406d0=_0x10f504?0x0:_0x59bc9c[_0xb0a6('0x1d')];var _0x4c111f=_0x10f504?_0x18f994[_0xb0a6('0x20')]:_0x59bc9c[_0xb0a6('0x1d')]+_0x59bc9c[_0xb0a6('0x1e')];var _0x6bdcc1;if(_0x4c111f>=_0x372457){_0x4c111f=_0x372457;_0x6bdcc1=0xc8;}else{_0x6bdcc1=0xce;}_0x295b53[_0xb0a6('0x21')](_0x6bdcc1);return _0x295b53[_0xb0a6('0x22')](_0xb0a6('0x23'),_0x4406d0+'-'+_0x4c111f+'/'+_0x372457)[_0xb0a6('0x1c')](_0x18f994);}return null;};}function patchUpdates(_0x4b9a6c){return function(_0x3db6a6){try{jsonpatch['apply'](_0x3db6a6,_0x4b9a6c,!![]);}catch(_0x1322ec){return BPromise[_0xb0a6('0x24')](_0x1322ec);}return _0x3db6a6['save']();};}function saveUpdates(_0x4aa68d,_0x10d753){return function(_0x14993f){if(_0x14993f){return _0x14993f['update'](_0x4aa68d)[_0xb0a6('0x25')](function(_0x24574a){return _0x24574a;});}return null;};}function removeEntity(_0x259f47,_0x5b19c1){return function(_0x5600c5){if(_0x5600c5){return _0x5600c5['destroy']()[_0xb0a6('0x25')](function(){var _0x1e9947=_0x5600c5[_0xb0a6('0x26')]({'plain':!![]});var _0x58d923=[{'name':_0xb0a6('0x27'),'value':_0xb0a6('0x28'),'ignore':![]},{'name':_0xb0a6('0x29'),'value':_0xb0a6('0x2a'),'ignore':![]}];var _0x10cf86=_(_0x58d923)[_0xb0a6('0x2b')](_0xb0a6('0x2c'))[_0xb0a6('0x2d')](_0xb0a6('0x2e'))['value']();if(_[_0xb0a6('0x2f')](_0x10cf86,_0x1e9947[_0xb0a6('0x30')])){return;}var _0x3993bf=_['find'](_0x58d923,[_0xb0a6('0x2e'),_0x1e9947['type']])[_0xb0a6('0x31')];return db[_0xb0a6('0x32')][_0xb0a6('0x33')]({'where':{'type':_0x3993bf,'resourceId':_0x1e9947['id']}})[_0xb0a6('0x25')](function(){return _0x5600c5;});})[_0xb0a6('0x25')](function(){_0x259f47[_0xb0a6('0x21')](0xcc)[_0xb0a6('0x1b')]();});}};}function handleEntityNotFound(_0x4b5ac5,_0xa05fd0){return function(_0x150f6b){if(!_0x150f6b){_0x4b5ac5['sendStatus'](0x194);}return _0x150f6b;};}function handleError(_0x57f408,_0x4093f8){_0x4093f8=_0x4093f8||0x1f4;return function(_0x1fcbdd){logger[_0xb0a6('0x34')](_0x1fcbdd[_0xb0a6('0x35')]);if(_0x1fcbdd[_0xb0a6('0x31')]){delete _0x1fcbdd[_0xb0a6('0x31')];}_0x57f408[_0xb0a6('0x21')](_0x4093f8)[_0xb0a6('0x36')](_0x1fcbdd);};}exports['index']=function(_0x3001af,_0x16471f){var _0x572cf7={},_0x8502f8={},_0x88f3b1={'count':0x0,'rows':[]};var _0x52e397=_['map'](db[_0xb0a6('0x37')][_0xb0a6('0x38')],function(_0x472799){return{'name':_0x472799[_0xb0a6('0x39')],'type':_0x472799[_0xb0a6('0x30')][_0xb0a6('0x3a')]};});_0x8502f8['model']=_[_0xb0a6('0x2d')](_0x52e397,'name');_0x8502f8[_0xb0a6('0x3b')]=_[_0xb0a6('0x3c')](_0x3001af['query']);_0x8502f8['filters']=_['intersection'](_0x8502f8[_0xb0a6('0x3d')],_0x8502f8[_0xb0a6('0x3b')]);_0x572cf7[_0xb0a6('0x3e')]=_[_0xb0a6('0x3f')](_0x8502f8[_0xb0a6('0x3d')],qs['fields'](_0x3001af[_0xb0a6('0x3b')][_0xb0a6('0x40')]));_0x572cf7[_0xb0a6('0x3e')]=_0x572cf7[_0xb0a6('0x3e')]['length']?_0x572cf7[_0xb0a6('0x3e')]:_0x8502f8[_0xb0a6('0x3d')];if(!_0x3001af[_0xb0a6('0x3b')][_0xb0a6('0x41')](_0xb0a6('0x42'))){_0x572cf7['limit']=qs['limit'](_0x3001af[_0xb0a6('0x3b')][_0xb0a6('0x1e')]);_0x572cf7[_0xb0a6('0x1d')]=qs[_0xb0a6('0x1d')](_0x3001af[_0xb0a6('0x3b')][_0xb0a6('0x1d')]);}_0x572cf7[_0xb0a6('0x43')]=qs[_0xb0a6('0x44')](_0x3001af['query'][_0xb0a6('0x44')]);_0x572cf7[_0xb0a6('0x45')]=qs[_0xb0a6('0x46')](_[_0xb0a6('0x47')](_0x3001af[_0xb0a6('0x3b')],_0x8502f8['filters']),_0x52e397);if(_0x3001af[_0xb0a6('0x3b')]['filter']){_0x572cf7[_0xb0a6('0x45')]=_['merge'](_0x572cf7[_0xb0a6('0x45')],{'$or':_['map'](_0x52e397,function(_0x2f94d8){if(_0x2f94d8[_0xb0a6('0x30')]!==_0xb0a6('0x48')){var _0x34b193={};_0x34b193[_0x2f94d8[_0xb0a6('0x31')]]={'$like':'%'+_0x3001af[_0xb0a6('0x3b')][_0xb0a6('0x2b')]+'%'};return _0x34b193;}})});}_0x572cf7=_[_0xb0a6('0x49')]({},_0x572cf7,_0x3001af[_0xb0a6('0x4a')]);var _0x155a84={'where':_0x572cf7[_0xb0a6('0x45')]};return db[_0xb0a6('0x37')]['count'](_0x155a84)[_0xb0a6('0x25')](function(_0x42d03a){_0x88f3b1['count']=_0x42d03a;if(_0x3001af[_0xb0a6('0x3b')]['includeAll']){_0x572cf7[_0xb0a6('0x4b')]=[{'all':!![]}];}return db[_0xb0a6('0x37')][_0xb0a6('0x4c')](_0x572cf7);})['then'](function(_0x74a665){_0x88f3b1[_0xb0a6('0x4d')]=_0x74a665;return _0x88f3b1;})[_0xb0a6('0x25')](respondWithFilteredResult(_0x16471f,_0x572cf7))[_0xb0a6('0x4e')](handleError(_0x16471f,null));};exports[_0xb0a6('0x4f')]=function(_0x2cb5f6,_0x86881){var _0x410886={'raw':![],'where':{'id':_0x2cb5f6[_0xb0a6('0x50')]['id']}},_0x5a87a2={};_0x5a87a2[_0xb0a6('0x3d')]=_[_0xb0a6('0x3c')](db[_0xb0a6('0x37')]['rawAttributes']);_0x5a87a2['query']=_['keys'](_0x2cb5f6['query']);_0x5a87a2['filters']=_['intersection'](_0x5a87a2['model'],_0x5a87a2[_0xb0a6('0x3b')]);_0x410886[_0xb0a6('0x3e')]=_[_0xb0a6('0x3f')](_0x5a87a2[_0xb0a6('0x3d')],qs[_0xb0a6('0x40')](_0x2cb5f6[_0xb0a6('0x3b')][_0xb0a6('0x40')]));_0x410886[_0xb0a6('0x3e')]=_0x410886[_0xb0a6('0x3e')][_0xb0a6('0x51')]?_0x410886[_0xb0a6('0x3e')]:_0x5a87a2[_0xb0a6('0x3d')];if(_0x2cb5f6[_0xb0a6('0x3b')][_0xb0a6('0x52')]){_0x410886[_0xb0a6('0x4b')]=[{'all':!![]}];}_0x410886=_[_0xb0a6('0x49')]({},_0x410886,_0x2cb5f6['options']);return db[_0xb0a6('0x37')][_0xb0a6('0x53')](_0x410886)[_0xb0a6('0x25')](handleEntityNotFound(_0x86881,null))[_0xb0a6('0x25')](respondWithResult(_0x86881,null))[_0xb0a6('0x4e')](handleError(_0x86881,null));};exports[_0xb0a6('0x54')]=function(_0x269614,_0x1812c8){return db[_0xb0a6('0x37')]['create'](_0x269614['body'],{})[_0xb0a6('0x25')](function(_0x29cda9){var _0x429b7c=_0x269614['user'][_0xb0a6('0x26')]({'plain':!![]});if(!_0x429b7c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x429b7c[_0xb0a6('0x55')]===_0xb0a6('0x56')){var _0x4a157e=_0x29cda9[_0xb0a6('0x26')]({'plain':!![]});var _0x380b26=[{'name':'VoiceQueues','value':_0xb0a6('0x28')},{'name':'QueueCampaigns','value':_0xb0a6('0x2a')}];var _0x4e11fb=_[_0xb0a6('0x53')](_0x380b26,[_0xb0a6('0x2e'),_0x4a157e['type']])[_0xb0a6('0x31')];return db[_0xb0a6('0x57')][_0xb0a6('0x53')]({'where':{'name':_0x4e11fb,'userProfileId':_0x429b7c[_0xb0a6('0x58')]},'raw':!![]})[_0xb0a6('0x25')](function(_0x59016a){if(_0x59016a&&_0x59016a[_0xb0a6('0x59')]===0x0){return db['UserProfileResource'][_0xb0a6('0x54')]({'name':_0x4a157e['name'],'resourceId':_0x4a157e['id'],'type':_0x59016a['name'],'sectionId':_0x59016a['id']},{})[_0xb0a6('0x25')](function(){return _0x29cda9;});}else{return _0x29cda9;}})[_0xb0a6('0x4e')](function(_0x5da439){logger[_0xb0a6('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5da439);throw _0x5da439;});}return _0x29cda9;})[_0xb0a6('0x25')](respondWithResult(_0x1812c8,0xc9))[_0xb0a6('0x4e')](handleError(_0x1812c8,null));};exports[_0xb0a6('0x5a')]=function(_0x229666,_0x59fb5a){var _0x384d9f={'where':{'id':_0x229666[_0xb0a6('0x50')]['id']}},_0x299545={};_0x299545[_0xb0a6('0x3d')]=_[_0xb0a6('0x3c')](db[_0xb0a6('0x37')]['rawAttributes']);_0x384d9f['attributes']=_[_0xb0a6('0x3f')](_0x299545['model'],qs[_0xb0a6('0x40')](_0x229666[_0xb0a6('0x3b')][_0xb0a6('0x40')]));_0x384d9f['attributes']=_0x384d9f[_0xb0a6('0x3e')][_0xb0a6('0x51')]?_0x384d9f['attributes']:_0x299545[_0xb0a6('0x3d')];if(_0x229666[_0xb0a6('0x3b')][_0xb0a6('0x52')]){_0x384d9f[_0xb0a6('0x4b')]=[{'all':!![]}];}_0x384d9f=_[_0xb0a6('0x49')]({},_0x384d9f,_0x229666['options']);return db[_0xb0a6('0x37')][_0xb0a6('0x53')](_0x384d9f)['then'](handleEntityNotFound(_0x59fb5a,null))[_0xb0a6('0x25')](function(_0x3f197a){if(_0x3f197a){var _0x13a9ca=_0x3f197a[_0xb0a6('0x26')]({'plain':!![]});_0x13a9ca=qs[_0xb0a6('0x5b')](_0x13a9ca,['id',_0xb0a6('0x5c'),_0xb0a6('0x5d')]);_0x229666[_0xb0a6('0x5e')]=_[_0xb0a6('0x5b')](_0x229666[_0xb0a6('0x5e')],['id',_0xb0a6('0x5c'),_0xb0a6('0x5d')]);return db['VoiceQueue'][_0xb0a6('0x54')](_['merge'](_0x13a9ca,_0x229666[_0xb0a6('0x5e')]),{'include':_0x229666[_0xb0a6('0x3b')][_0xb0a6('0x52')]?[{'all':!![]}]:undefined})[_0xb0a6('0x25')](function(_0x49ea98){var _0x22521a=_0x229666[_0xb0a6('0x56')][_0xb0a6('0x26')]({'plain':!![]});if(!_0x22521a)throw new Error(_0xb0a6('0x5f'));if(_0x22521a[_0xb0a6('0x55')]===_0xb0a6('0x56')){var _0x35dd17=_0x49ea98[_0xb0a6('0x26')]({'plain':!![]});var _0x3a6c4c=[{'name':_0xb0a6('0x27'),'value':_0xb0a6('0x28')},{'name':_0xb0a6('0x29'),'value':_0xb0a6('0x2a')}];var _0x2f1b5a=_[_0xb0a6('0x53')](_0x3a6c4c,[_0xb0a6('0x2e'),_0x35dd17[_0xb0a6('0x30')]])[_0xb0a6('0x31')];return db['UserProfileSection'][_0xb0a6('0x53')]({'where':{'name':_0x2f1b5a,'userProfileId':_0x22521a[_0xb0a6('0x58')]},'raw':!![]})[_0xb0a6('0x25')](function(_0x35e3fb){if(_0x35e3fb&&_0x35e3fb[_0xb0a6('0x59')]===0x0){return db[_0xb0a6('0x32')]['create']({'name':_0x35dd17['name'],'resourceId':_0x35dd17['id'],'type':_0x35e3fb[_0xb0a6('0x31')],'sectionId':_0x35e3fb['id']},{})[_0xb0a6('0x25')](function(){return _0x49ea98;});}else{return _0x49ea98;}})[_0xb0a6('0x4e')](function(_0x2f2b44){logger['error'](_0xb0a6('0x60'),_0x2f2b44);throw _0x2f2b44;});}return _0x49ea98;});}})[_0xb0a6('0x25')](respondWithResult(_0x59fb5a,0xc9))[_0xb0a6('0x4e')](handleError(_0x59fb5a,null));};exports[_0xb0a6('0x61')]=function(_0x3143de,_0x265a02){if(_0x3143de[_0xb0a6('0x5e')]['id']){delete _0x3143de['body']['id'];}return db[_0xb0a6('0x37')][_0xb0a6('0x53')]({'where':{'id':_0x3143de['params']['id']}})['then'](handleEntityNotFound(_0x265a02,null))[_0xb0a6('0x25')](saveUpdates(_0x3143de['body'],null))[_0xb0a6('0x25')](respondWithResult(_0x265a02,null))[_0xb0a6('0x4e')](handleError(_0x265a02,null));};exports[_0xb0a6('0x33')]=function(_0x438a8b,_0x575b2c){return db[_0xb0a6('0x37')]['find']({'where':{'id':_0x438a8b[_0xb0a6('0x50')]['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x575b2c,null))['then'](removeEntity(_0x575b2c,null))['catch'](handleError(_0x575b2c,null));};exports[_0xb0a6('0x62')]=function(_0x247cb9,_0x24acde,_0x59827b){var _0x57ce94={'raw':![],'where':{}};var _0x567fd9={};var _0x907f16={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xb0a6('0x63')]({'where':{'id':_0x247cb9[_0xb0a6('0x50')]['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x24acde,null))['then'](function(_0x19b519){if(_0x19b519){_0x567fd9[_0xb0a6('0x3d')]=_[_0xb0a6('0x3c')](db[_0xb0a6('0x64')][_0xb0a6('0x38')]);_0x567fd9[_0xb0a6('0x3b')]=_[_0xb0a6('0x3c')](_0x247cb9['query']);_0x567fd9['filters']=_[_0xb0a6('0x3f')](_0x567fd9[_0xb0a6('0x3d')],_0x567fd9[_0xb0a6('0x3b')]);_0x57ce94[_0xb0a6('0x3e')]=_['intersection'](_0x567fd9['model'],qs[_0xb0a6('0x40')](_0x247cb9[_0xb0a6('0x3b')][_0xb0a6('0x40')]));_0x57ce94[_0xb0a6('0x3e')]=_0x57ce94[_0xb0a6('0x3e')]['length']?_0x57ce94[_0xb0a6('0x3e')]:_0x567fd9[_0xb0a6('0x3d')];if(!_0x247cb9['query'][_0xb0a6('0x41')](_0xb0a6('0x42'))){_0x57ce94[_0xb0a6('0x1e')]=qs[_0xb0a6('0x1e')](_0x247cb9[_0xb0a6('0x3b')][_0xb0a6('0x1e')]);_0x57ce94['offset']=qs[_0xb0a6('0x1d')](_0x247cb9[_0xb0a6('0x3b')][_0xb0a6('0x1d')]);}_0x57ce94[_0xb0a6('0x43')]=qs[_0xb0a6('0x44')](_0x247cb9['query']['sort']);_0x57ce94[_0xb0a6('0x45')]=qs['filters'](_[_0xb0a6('0x47')](_0x247cb9['query'],_0x567fd9[_0xb0a6('0x46')]));_0x57ce94['where'][_0xb0a6('0x65')]=_0x19b519['id'];if(_0x247cb9[_0xb0a6('0x3b')][_0xb0a6('0x2b')]){_0x57ce94[_0xb0a6('0x45')]=_[_0xb0a6('0x49')](_0x57ce94[_0xb0a6('0x45')],{'$or':_[_0xb0a6('0x2d')](_0x57ce94[_0xb0a6('0x3e')],function(_0x5281bf){var _0x5524ae={};_0x5524ae[_0x5281bf]={'$like':'%'+_0x247cb9['query']['filter']+'%'};return _0x5524ae;})});}_0x57ce94=_['merge']({},_0x57ce94,_0x247cb9[_0xb0a6('0x4a')]);return db[_0xb0a6('0x64')][_0xb0a6('0x20')]({'where':_0x57ce94[_0xb0a6('0x45')]})['then'](function(_0x2fcf51){_0x907f16[_0xb0a6('0x20')]=_0x2fcf51;if(_0x247cb9[_0xb0a6('0x3b')][_0xb0a6('0x52')]){_0x57ce94[_0xb0a6('0x4b')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x57ce94);})[_0xb0a6('0x25')](function(_0x33fd7e){_0x907f16[_0xb0a6('0x4d')]=_0x33fd7e;return _0x907f16;});}})[_0xb0a6('0x25')](respondWithFilteredResult(_0x24acde,_0x57ce94))[_0xb0a6('0x4e')](handleError(_0x24acde,null));};exports[_0xb0a6('0x66')]=function(_0x5d61ac,_0x5817ac,_0x482c07){var _0x292189={'raw':!![],'where':{}};var _0x40cd4d={};var _0x39149a={'count':0x0,'rows':[]};return db[_0xb0a6('0x37')][_0xb0a6('0x63')]({'where':{'id':_0x5d61ac[_0xb0a6('0x50')]['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x5817ac,null))['then'](function(_0x1bd0ec){if(_0x1bd0ec){_0x40cd4d[_0xb0a6('0x3d')]=_[_0xb0a6('0x3c')](db[_0xb0a6('0x67')][_0xb0a6('0x38')]);_0x40cd4d[_0xb0a6('0x3b')]=_['keys'](_0x5d61ac[_0xb0a6('0x3b')]);_0x40cd4d[_0xb0a6('0x46')]=_[_0xb0a6('0x3f')](_0x40cd4d[_0xb0a6('0x3d')],_0x40cd4d[_0xb0a6('0x3b')]);_0x292189[_0xb0a6('0x3e')]=_[_0xb0a6('0x3f')](_0x40cd4d['model'],qs[_0xb0a6('0x40')](_0x5d61ac['query'][_0xb0a6('0x40')]));_0x292189['attributes']=_0x292189[_0xb0a6('0x3e')][_0xb0a6('0x51')]?_0x292189[_0xb0a6('0x3e')]:_0x40cd4d[_0xb0a6('0x3d')];if(!_0x5d61ac[_0xb0a6('0x3b')][_0xb0a6('0x41')](_0xb0a6('0x42'))){_0x292189[_0xb0a6('0x1e')]=qs['limit'](_0x5d61ac[_0xb0a6('0x3b')][_0xb0a6('0x1e')]);_0x292189['offset']=qs[_0xb0a6('0x1d')](_0x5d61ac[_0xb0a6('0x3b')]['offset']);}_0x292189['order']=qs[_0xb0a6('0x44')](_0x5d61ac['query'][_0xb0a6('0x44')]);_0x292189[_0xb0a6('0x45')]=qs[_0xb0a6('0x46')](_[_0xb0a6('0x47')](_0x5d61ac[_0xb0a6('0x3b')],_0x40cd4d[_0xb0a6('0x46')]));_0x292189['where'][_0xb0a6('0x65')]=_0x1bd0ec['id'];if(_0x5d61ac[_0xb0a6('0x3b')]['filter']){_0x292189['where']=_[_0xb0a6('0x49')](_0x292189[_0xb0a6('0x45')],{'$or':_[_0xb0a6('0x2d')](_0x292189[_0xb0a6('0x3e')],function(_0x281665){var _0x3322d9={};_0x3322d9[_0x281665]={'$like':'%'+_0x5d61ac['query'][_0xb0a6('0x2b')]+'%'};return _0x3322d9;})});}_0x292189=_['merge']({},_0x292189,_0x5d61ac[_0xb0a6('0x4a')]);return db[_0xb0a6('0x67')][_0xb0a6('0x20')]({'where':_0x292189['where']})['then'](function(_0x586d32){_0x39149a[_0xb0a6('0x20')]=_0x586d32;if(_0x5d61ac[_0xb0a6('0x3b')][_0xb0a6('0x52')]){_0x292189[_0xb0a6('0x4b')]=[{'all':!![]}];}return db[_0xb0a6('0x67')][_0xb0a6('0x4c')](_0x292189);})[_0xb0a6('0x25')](function(_0x102f30){_0x39149a[_0xb0a6('0x4d')]=_0x102f30;return _0x39149a;});}})[_0xb0a6('0x25')](respondWithFilteredResult(_0x5817ac,_0x292189))[_0xb0a6('0x4e')](handleError(_0x5817ac,null));};exports[_0xb0a6('0x68')]=function(_0x12892b,_0x2c5d71,_0x4e4638){var _0x268cda={'raw':!![],'where':{}};var _0x49e431={};var _0x29bebb={'count':0x0,'rows':[]};return db[_0xb0a6('0x37')]['findOne']({'where':{'id':_0x12892b[_0xb0a6('0x50')]['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x2c5d71,null))[_0xb0a6('0x25')](function(_0x26a9d2){if(_0x26a9d2){_0x49e431[_0xb0a6('0x3d')]=_[_0xb0a6('0x3c')](db[_0xb0a6('0x69')]['rawAttributes']);_0x49e431['query']=_[_0xb0a6('0x3c')](_0x12892b['query']);_0x49e431[_0xb0a6('0x46')]=_[_0xb0a6('0x3f')](_0x49e431[_0xb0a6('0x3d')],_0x49e431[_0xb0a6('0x3b')]);_0x268cda[_0xb0a6('0x3e')]=_[_0xb0a6('0x3f')](_0x49e431[_0xb0a6('0x3d')],qs[_0xb0a6('0x40')](_0x12892b[_0xb0a6('0x3b')][_0xb0a6('0x40')]));_0x268cda[_0xb0a6('0x3e')]=_0x268cda[_0xb0a6('0x3e')][_0xb0a6('0x51')]?_0x268cda[_0xb0a6('0x3e')]:_0x49e431[_0xb0a6('0x3d')];if(!_0x12892b[_0xb0a6('0x3b')][_0xb0a6('0x41')](_0xb0a6('0x42'))){_0x268cda[_0xb0a6('0x1e')]=qs[_0xb0a6('0x1e')](_0x12892b[_0xb0a6('0x3b')][_0xb0a6('0x1e')]);_0x268cda[_0xb0a6('0x1d')]=qs[_0xb0a6('0x1d')](_0x12892b[_0xb0a6('0x3b')][_0xb0a6('0x1d')]);}_0x268cda[_0xb0a6('0x43')]=qs[_0xb0a6('0x44')](_0x12892b['query'][_0xb0a6('0x44')]);_0x268cda['where']=qs[_0xb0a6('0x46')](_[_0xb0a6('0x47')](_0x12892b[_0xb0a6('0x3b')],_0x49e431['filters']));_0x268cda['where']['VoiceQueueId']=_0x26a9d2['id'];if(_0x12892b[_0xb0a6('0x3b')][_0xb0a6('0x2b')]){_0x268cda[_0xb0a6('0x45')]=_[_0xb0a6('0x49')](_0x268cda[_0xb0a6('0x45')],{'$or':_[_0xb0a6('0x2d')](_0x268cda['attributes'],function(_0x1e1241){var _0x1f92c7={};_0x1f92c7[_0x1e1241]={'$like':'%'+_0x12892b[_0xb0a6('0x3b')][_0xb0a6('0x2b')]+'%'};return _0x1f92c7;})});}_0x268cda=_['merge']({},_0x268cda,_0x12892b['options']);return db[_0xb0a6('0x69')][_0xb0a6('0x20')]({'where':_0x268cda[_0xb0a6('0x45')]})['then'](function(_0x57ce79){_0x29bebb[_0xb0a6('0x20')]=_0x57ce79;if(_0x12892b[_0xb0a6('0x3b')]['includeAll']){_0x268cda['include']=[{'all':!![]}];}return db[_0xb0a6('0x69')]['findAll'](_0x268cda);})[_0xb0a6('0x25')](function(_0x11cdfe){_0x29bebb[_0xb0a6('0x4d')]=_0x11cdfe;return _0x29bebb;});}})['then'](respondWithFilteredResult(_0x2c5d71,_0x268cda))[_0xb0a6('0x4e')](handleError(_0x2c5d71,null));};exports[_0xb0a6('0x6a')]=function(_0x310fa3,_0x1eb8ac,_0x4be9ff){var _0x261c6c={'raw':!![],'where':{}};var _0x1710a6={};var _0x464bc8={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xb0a6('0x63')]({'where':{'id':_0x310fa3[_0xb0a6('0x50')]['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x1eb8ac,null))['then'](function(_0x2ec56d){if(_0x2ec56d){_0x1710a6[_0xb0a6('0x3d')]=_['keys'](db[_0xb0a6('0x6b')]['rawAttributes']);_0x1710a6['query']=_[_0xb0a6('0x3c')](_0x310fa3['query']);_0x1710a6[_0xb0a6('0x46')]=_[_0xb0a6('0x3f')](_0x1710a6[_0xb0a6('0x3d')],_0x1710a6[_0xb0a6('0x3b')]);_0x261c6c['attributes']=_[_0xb0a6('0x3f')](_0x1710a6[_0xb0a6('0x3d')],qs[_0xb0a6('0x40')](_0x310fa3[_0xb0a6('0x3b')][_0xb0a6('0x40')]));_0x261c6c['attributes']=_0x261c6c[_0xb0a6('0x3e')][_0xb0a6('0x51')]?_0x261c6c['attributes']:_0x1710a6['model'];if(!_0x310fa3[_0xb0a6('0x3b')][_0xb0a6('0x41')](_0xb0a6('0x42'))){_0x261c6c[_0xb0a6('0x1e')]=qs['limit'](_0x310fa3[_0xb0a6('0x3b')][_0xb0a6('0x1e')]);_0x261c6c[_0xb0a6('0x1d')]=qs[_0xb0a6('0x1d')](_0x310fa3[_0xb0a6('0x3b')]['offset']);}_0x261c6c[_0xb0a6('0x43')]=qs[_0xb0a6('0x44')](_0x310fa3[_0xb0a6('0x3b')]['sort']);_0x261c6c['where']=qs[_0xb0a6('0x46')](_[_0xb0a6('0x47')](_0x310fa3[_0xb0a6('0x3b')],_0x1710a6[_0xb0a6('0x46')]));_0x261c6c[_0xb0a6('0x45')]['VoiceQueueId']=_0x2ec56d['id'];if(_0x310fa3[_0xb0a6('0x3b')]['filter']){_0x261c6c['where']=_[_0xb0a6('0x49')](_0x261c6c[_0xb0a6('0x45')],{'$or':_[_0xb0a6('0x2d')](_0x261c6c['attributes'],function(_0xca3fbc){var _0x334b2e={};_0x334b2e[_0xca3fbc]={'$like':'%'+_0x310fa3[_0xb0a6('0x3b')][_0xb0a6('0x2b')]+'%'};return _0x334b2e;})});}_0x261c6c=_[_0xb0a6('0x49')]({},_0x261c6c,_0x310fa3[_0xb0a6('0x4a')]);return db[_0xb0a6('0x6b')][_0xb0a6('0x20')]({'where':_0x261c6c[_0xb0a6('0x45')]})['then'](function(_0x4983ba){_0x464bc8[_0xb0a6('0x20')]=_0x4983ba;if(_0x310fa3[_0xb0a6('0x3b')]['includeAll']){_0x261c6c['include']=[{'all':!![]}];}return db[_0xb0a6('0x6b')]['findAll'](_0x261c6c);})[_0xb0a6('0x25')](function(_0x2da7b4){_0x464bc8[_0xb0a6('0x4d')]=_0x2da7b4;return _0x464bc8;});}})[_0xb0a6('0x25')](respondWithFilteredResult(_0x1eb8ac,_0x261c6c))[_0xb0a6('0x4e')](handleError(_0x1eb8ac,null));};exports[_0xb0a6('0x6c')]=function(_0x42f6c1,_0x656b76,_0x381da8){var _0xb6a936={};var _0x52eeb9={};var _0x249a28;var _0x263719;return db['VoiceQueue'][_0xb0a6('0x63')]({'where':{'id':_0x42f6c1[_0xb0a6('0x50')]['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x656b76,null))['then'](function(_0xe4ef40){if(_0xe4ef40){_0x249a28=_0xe4ef40;_0x52eeb9['model']=_[_0xb0a6('0x3c')](db['Team'][_0xb0a6('0x38')]);_0x52eeb9[_0xb0a6('0x3b')]=_[_0xb0a6('0x3c')](_0x42f6c1[_0xb0a6('0x3b')]);_0x52eeb9[_0xb0a6('0x46')]=_[_0xb0a6('0x3f')](_0x52eeb9[_0xb0a6('0x3d')],_0x52eeb9['query']);_0xb6a936[_0xb0a6('0x3e')]=_[_0xb0a6('0x3f')](_0x52eeb9[_0xb0a6('0x3d')],qs[_0xb0a6('0x40')](_0x42f6c1[_0xb0a6('0x3b')]['fields']));_0xb6a936[_0xb0a6('0x3e')]=_0xb6a936['attributes'][_0xb0a6('0x51')]?_0xb6a936[_0xb0a6('0x3e')]:_0x52eeb9[_0xb0a6('0x3d')];_0xb6a936[_0xb0a6('0x43')]=qs[_0xb0a6('0x44')](_0x42f6c1[_0xb0a6('0x3b')][_0xb0a6('0x44')]);_0xb6a936[_0xb0a6('0x45')]=qs[_0xb0a6('0x46')](_[_0xb0a6('0x47')](_0x42f6c1[_0xb0a6('0x3b')],_0x52eeb9[_0xb0a6('0x46')]));if(_0x42f6c1[_0xb0a6('0x3b')][_0xb0a6('0x2b')]){_0xb6a936[_0xb0a6('0x45')]=_['merge'](_0xb6a936['where'],{'$or':_[_0xb0a6('0x2d')](_0xb6a936['attributes'],function(_0x5f4f76){var _0x57c3ab={};_0x57c3ab[_0x5f4f76]={'$like':'%'+_0x42f6c1[_0xb0a6('0x3b')]['filter']+'%'};return _0x57c3ab;})});}_0xb6a936=_[_0xb0a6('0x49')]({},_0xb6a936,_0x42f6c1[_0xb0a6('0x4a')]);return _0x249a28[_0xb0a6('0x6c')](_0xb6a936);}})['then'](function(_0x52ca93){if(_0x52ca93){_0x263719=_0x52ca93[_0xb0a6('0x51')];if(!_0x42f6c1['query'][_0xb0a6('0x41')](_0xb0a6('0x42'))){_0xb6a936[_0xb0a6('0x1e')]=qs[_0xb0a6('0x1e')](_0x42f6c1[_0xb0a6('0x3b')][_0xb0a6('0x1e')]);_0xb6a936[_0xb0a6('0x1d')]=qs[_0xb0a6('0x1d')](_0x42f6c1[_0xb0a6('0x3b')][_0xb0a6('0x1d')]);}return _0x249a28[_0xb0a6('0x6c')](_0xb6a936);}})[_0xb0a6('0x25')](function(_0x7ef690){if(_0x7ef690){return _0x7ef690?{'count':_0x263719,'rows':_0x7ef690}:null;}})[_0xb0a6('0x25')](respondWithResult(_0x656b76,null))[_0xb0a6('0x4e')](handleError(_0x656b76,null));};exports[_0xb0a6('0x6d')]=function(_0x32c7bb,_0x1d0404,_0x5a56c0){var _0x3bec09=_0x32c7bb['body'][_0xb0a6('0x6e')];var _0x4247b0=_['map'](_0x3bec09,'id');return db['Team'][_0xb0a6('0x4c')]({'where':{'id':_0x4247b0},'attributes':['id'],'include':[{'model':db[_0xb0a6('0x6f')],'as':'Agents','attributes':['id',_0xb0a6('0x31'),_0xb0a6('0x70'),'voicePause',_0xb0a6('0x71')],'raw':!![]}]})[_0xb0a6('0x25')](function(_0x197da0){if(_0x197da0){var _0x1d092d=_[_0xb0a6('0x72')](_0x197da0,function(_0x3add6b){var _0x228965=_0x3add6b['get']({'plain':!![]});_0x228965['Agents'][_0xb0a6('0x73')](function(_0x3c5e8e){_0x3c5e8e['penalty']=_[_0xb0a6('0x53')](_0x3bec09,{'id':_0x228965['id']})['penalty'];});return _0x228965[_0xb0a6('0x74')];});return db['VoiceQueue'][_0xb0a6('0x53')]({'where':{'id':_0x32c7bb[_0xb0a6('0x50')]['id']}})['then'](function(_0x169e4b){return db[_0xb0a6('0x75')][_0xb0a6('0x76')](function(_0x5231a7){return _0x169e4b[_0xb0a6('0x6d')](_0x4247b0,{'transaction':_0x5231a7})[_0xb0a6('0x25')](function(){return BPromise[_0xb0a6('0x77')](_0x3bec09,function(_0x1f77ce){return db[_0xb0a6('0x78')][_0xb0a6('0x79')]({'TeamId':_0x1f77ce['id'],'VoiceQueueId':_0x32c7bb[_0xb0a6('0x50')]['id'],'penalty':_0x1f77ce['penalty']},{'transaction':_0x5231a7});});})[_0xb0a6('0x25')](function(){return BPromise['each'](_0x1d092d,function(_0x9ea1f4){return db[_0xb0a6('0x7a')][_0xb0a6('0x7b')]({'where':{'UserId':_0x9ea1f4['id'],'VoiceQueueId':_0x32c7bb[_0xb0a6('0x50')]['id']},'defaults':{'penalty':_0x9ea1f4[_0xb0a6('0x7c')]},'transaction':_0x5231a7});});})['then'](function(){return BPromise['each'](_[_0xb0a6('0x2b')](_0x1d092d,{'online':!![]}),function(_0x3290a6){return db[_0xb0a6('0x7d')]['upsert']({'membername':_0x3290a6[_0xb0a6('0x31')],'UserId':_0x3290a6['id'],'queue_name':_0x169e4b[_0xb0a6('0x31')],'VoiceQueueId':_0x169e4b['id'],'interface':_[_0xb0a6('0x7e')](_0x3290a6[_0xb0a6('0x71')])?util[_0xb0a6('0x7f')](_0xb0a6('0x80'),_0x3290a6['name']):_0x3290a6[_0xb0a6('0x71')],'paused':_0x3290a6[_0xb0a6('0x81')]||![],'penalty':_0x3290a6[_0xb0a6('0x7c')]},{'transaction':_0x5231a7});});})[_0xb0a6('0x25')](function(){_0x1d092d['forEach'](function(_0x34fad3){socket[_0xb0a6('0x82')](_0xb0a6('0x83'),{'UserId':_0x34fad3['id'],'VoiceQueueId':_0x169e4b['id']});});});});});}})[_0xb0a6('0x25')](respondWithStatusCode(_0x1d0404,null))[_0xb0a6('0x4e')](handleError(_0x1d0404,null));};exports[_0xb0a6('0x84')]=function(_0x4283d8,_0x36ac4e,_0x465f34){return db['Team'][_0xb0a6('0x4c')]({'where':{'id':_0x4283d8[_0xb0a6('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb0a6('0x6f')],'as':_0xb0a6('0x74'),'attributes':['id'],'raw':!![]}]})[_0xb0a6('0x25')](handleEntityNotFound(_0x36ac4e,null))[_0xb0a6('0x25')](function(_0x309a7b){var _0x2b2abd=_['map'](_0x309a7b,'id');var _0x514b49=[];var _0x1cda2c=[];var _0xab2fdd=squel[_0xb0a6('0x85')]();_0xab2fdd[_0xb0a6('0x86')](_0xb0a6('0x87'))[_0xb0a6('0x88')](_0xb0a6('0x89'),'tq')[_0xb0a6('0x8a')]('user_has_teams','ut',_0xb0a6('0x8b'))['where'](_0xb0a6('0x8c'),_0x4283d8[_0xb0a6('0x50')]['id']);for(var _0x125ea0=0x0;_0x125ea0<_0x309a7b[_0xb0a6('0x51')];_0x125ea0+=0x1){let _0x4b4f64=_0x309a7b[_0x125ea0];for(var _0x155ea5=0x0;_0x155ea5<_0x4b4f64['Agents'][_0xb0a6('0x51')];_0x155ea5+=0x1){let _0x294761=_0x4b4f64[_0xb0a6('0x74')][_0x155ea5];var _0x16f9f6=_0xab2fdd[_0xb0a6('0x5a')]();_0x16f9f6['where'](_0xb0a6('0x8d'),_0x294761['id']);_0x1cda2c['push'](db[_0xb0a6('0x75')][_0xb0a6('0x3b')](_0x16f9f6[_0xb0a6('0x8e')](),{'type':db[_0xb0a6('0x75')]['QueryTypes']['SELECT']})[_0xb0a6('0x25')](function(_0x2f1795){if(_0x2f1795[_0xb0a6('0x51')]===0x1){return _0x294761['id'];}else{var _0x4e30c3=_[_0xb0a6('0x8f')](_['map'](_0x2f1795,_0xb0a6('0x90')),function(_0x28e82d){return _[_0xb0a6('0x2f')](_0x2b2abd,_0x28e82d);});if(_0x4e30c3){return _0x294761['id'];}}}));}}return BPromise[_0xb0a6('0x91')](_0x1cda2c)['then'](function(_0x1594c6){_0x514b49=_(_0x514b49)[_0xb0a6('0x92')](_0x1594c6)[_0xb0a6('0x93')]()[_0xb0a6('0x2e')]();return db[_0xb0a6('0x37')][_0xb0a6('0x53')]({'where':{'id':_0x4283d8['params']['id']}})[_0xb0a6('0x25')](function(_0x5db32f){return db[_0xb0a6('0x75')][_0xb0a6('0x76')](function(_0x2befab){return _0x5db32f['removeTeams'](_0x4283d8[_0xb0a6('0x3b')][_0xb0a6('0x94')],{'transaction':_0x2befab})[_0xb0a6('0x25')](function(){if(!_[_0xb0a6('0x95')](_0x514b49)){return _0x5db32f[_0xb0a6('0x96')](_0x514b49,{'transaction':_0x2befab})[_0xb0a6('0x25')](function(){return db[_0xb0a6('0x7d')][_0xb0a6('0x33')]({'where':{'VoiceQueueId':_0x4283d8[_0xb0a6('0x50')]['id'],'UserId':_0x514b49},'transaction':_0x2befab});});}})[_0xb0a6('0x25')](function(){_0x514b49[_0xb0a6('0x73')](function(_0x286405){socket[_0xb0a6('0x82')](_0xb0a6('0x97'),{'UserId':_0x286405,'VoiceQueueId':_0x5db32f['id']});});});});});});})[_0xb0a6('0x25')](respondWithStatusCode(_0x36ac4e,null))[_0xb0a6('0x4e')](handleError(_0x36ac4e,null));};exports[_0xb0a6('0x98')]=function(_0x137212,_0x33679b,_0x3f427d){var _0x28701c,_0x40c162;return db['VoiceQueue']['find']({'where':{'id':_0x137212[_0xb0a6('0x50')]['id']}})['then'](handleEntityNotFound(_0x33679b,null))['then'](function(_0x54a74d){if(_0x54a74d){_0x40c162=_0x54a74d;return _0x54a74d[_0xb0a6('0x98')](_0x137212['body'][_0xb0a6('0x94')],_[_0xb0a6('0x5b')](_0x137212[_0xb0a6('0x5e')],['ids','id'])||{})[_0xb0a6('0x99')](function(_0x2a8992){for(var _0x4cefc8=0x0;_0x4cefc8<_0x137212[_0xb0a6('0x5e')]['ids'][_0xb0a6('0x51')];_0x4cefc8+=0x1){socket[_0xb0a6('0x82')]('userVoiceQueue:save',{'UserId':Number(_0x137212['body'][_0xb0a6('0x94')][_0x4cefc8]),'VoiceQueueId':Number(_0x137212[_0xb0a6('0x50')]['id'])});}return _0x2a8992;});}})[_0xb0a6('0x25')](function(_0x1c5f17){_0x28701c=_0x1c5f17||[];if(_0x40c162){return db[_0xb0a6('0x6f')][_0xb0a6('0x4c')]({'where':{'id':_0x137212['body'][_0xb0a6('0x94')]},'attributes':['id',_0xb0a6('0x31'),'online',_0xb0a6('0x81'),_0xb0a6('0x71')],'raw':!![]});}})['then'](function(_0x4a4504){if(!_[_0xb0a6('0x95')](_0x4a4504)){var _0x1da461=[];for(var _0x39a995=0x0;_0x39a995<_0x4a4504['length'];_0x39a995++){if(_0x4a4504[_0x39a995]['online']){_0x1da461[_0xb0a6('0x9a')](db['UserVoiceQueueRt']['upsert']({'membername':_0x4a4504[_0x39a995][_0xb0a6('0x31')],'UserId':_0x4a4504[_0x39a995]['id'],'queue_name':_0x40c162['name'],'VoiceQueueId':_0x40c162['id'],'interface':_[_0xb0a6('0x7e')](_0x4a4504[_0x39a995][_0xb0a6('0x71')])?util[_0xb0a6('0x7f')]('SIP/%s',_0x4a4504[_0x39a995][_0xb0a6('0x31')]):_0x4a4504[_0x39a995][_0xb0a6('0x71')],'paused':_0x4a4504[_0x39a995][_0xb0a6('0x81')]||![],'penalty':_0x137212['body'][_0xb0a6('0x7c')]||0x0}));}}return BPromise[_0xb0a6('0x91')](_0x1da461);}})[_0xb0a6('0x25')](function(){return _0x28701c;})[_0xb0a6('0x25')](respondWithResult(_0x33679b,null))['catch'](handleError(_0x33679b,null));};exports[_0xb0a6('0x96')]=function(_0xd14e8a,_0x556584,_0x118e75){return db['VoiceQueue'][_0xb0a6('0x53')]({'where':{'id':_0xd14e8a[_0xb0a6('0x50')]['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x556584,null))[_0xb0a6('0x25')](function(_0x223b86){if(_0x223b86){return _0x223b86[_0xb0a6('0x96')](_0xd14e8a[_0xb0a6('0x3b')]['ids'])[_0xb0a6('0x25')](function(){if(_[_0xb0a6('0x9b')](_0xd14e8a[_0xb0a6('0x3b')]['ids'])){for(var _0xa076f9=0x0;_0xa076f9<_0xd14e8a['query'][_0xb0a6('0x94')][_0xb0a6('0x51')];_0xa076f9+=0x1){socket[_0xb0a6('0x82')]('userVoiceQueue:remove',{'UserId':Number(_0xd14e8a[_0xb0a6('0x3b')][_0xb0a6('0x94')][_0xa076f9]),'VoiceQueueId':Number(_0xd14e8a[_0xb0a6('0x50')]['id'])});}}else{socket[_0xb0a6('0x82')]('userVoiceQueue:remove',{'UserId':Number(_0xd14e8a[_0xb0a6('0x3b')][_0xb0a6('0x94')]),'VoiceQueueId':Number(_0xd14e8a['params']['id'])});}});}})[_0xb0a6('0x25')](function(_0x470848){return db[_0xb0a6('0x7d')]['destroy']({'where':{'VoiceQueueId':_0xd14e8a[_0xb0a6('0x50')]['id'],'UserId':_0xd14e8a['query'][_0xb0a6('0x94')]}})['then'](function(){return _0x470848;});})[_0xb0a6('0x25')](respondWithStatusCode(_0x556584,null))[_0xb0a6('0x4e')](handleError(_0x556584,null));};exports['getAgents']=function(_0x3a6b2c,_0x2d6099,_0x4119a0){var _0x99cdb={};var _0x4333f6={};var _0x462737;var _0x4e0bc6;return db[_0xb0a6('0x37')]['findOne']({'where':{'id':_0x3a6b2c[_0xb0a6('0x50')]['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x2d6099,null))[_0xb0a6('0x25')](function(_0x45b479){if(_0x45b479){_0x462737=_0x45b479;_0x4333f6[_0xb0a6('0x3d')]=_[_0xb0a6('0x3c')](db[_0xb0a6('0x6f')][_0xb0a6('0x38')]);_0x4333f6['query']=_[_0xb0a6('0x3c')](_0x3a6b2c['query']);_0x4333f6[_0xb0a6('0x46')]=_[_0xb0a6('0x3f')](_0x4333f6['model'],_0x4333f6[_0xb0a6('0x3b')]);_0x99cdb[_0xb0a6('0x3e')]=_[_0xb0a6('0x3f')](_0x4333f6[_0xb0a6('0x3d')],qs[_0xb0a6('0x40')](_0x3a6b2c[_0xb0a6('0x3b')][_0xb0a6('0x40')]));_0x99cdb[_0xb0a6('0x3e')]=_0x99cdb[_0xb0a6('0x3e')]['length']?_0x99cdb[_0xb0a6('0x3e')]:_0x4333f6[_0xb0a6('0x3d')];_0x99cdb[_0xb0a6('0x43')]=qs[_0xb0a6('0x44')](_0x3a6b2c[_0xb0a6('0x3b')][_0xb0a6('0x44')]);_0x99cdb[_0xb0a6('0x45')]=qs[_0xb0a6('0x46')](_[_0xb0a6('0x47')](_0x3a6b2c[_0xb0a6('0x3b')],_0x4333f6[_0xb0a6('0x46')]));if(_0x3a6b2c['query'][_0xb0a6('0x2b')]){_0x99cdb['where']=_[_0xb0a6('0x49')](_0x99cdb[_0xb0a6('0x45')],{'$or':_[_0xb0a6('0x2d')](_0x99cdb[_0xb0a6('0x3e')],function(_0x4a80d3){var _0x5796bb={};_0x5796bb[_0x4a80d3]={'$like':'%'+_0x3a6b2c[_0xb0a6('0x3b')][_0xb0a6('0x2b')]+'%'};return _0x5796bb;})});}_0x99cdb=_[_0xb0a6('0x49')]({},_0x99cdb,_0x3a6b2c[_0xb0a6('0x4a')]);return _0x462737[_0xb0a6('0x9c')](_0x99cdb);}})[_0xb0a6('0x25')](function(_0x432e61){if(_0x432e61){_0x4e0bc6=_0x432e61[_0xb0a6('0x51')];if(!_0x3a6b2c['query'][_0xb0a6('0x41')]('nolimit')){_0x99cdb[_0xb0a6('0x1e')]=qs['limit'](_0x3a6b2c[_0xb0a6('0x3b')][_0xb0a6('0x1e')]);_0x99cdb[_0xb0a6('0x1d')]=qs['offset'](_0x3a6b2c[_0xb0a6('0x3b')][_0xb0a6('0x1d')]);}return _0x462737[_0xb0a6('0x9c')](_0x99cdb);}})[_0xb0a6('0x25')](function(_0x196627){if(_0x196627){return _0x196627?{'count':_0x4e0bc6,'rows':_0x196627}:null;}})[_0xb0a6('0x25')](respondWithResult(_0x2d6099,null))[_0xb0a6('0x4e')](handleError(_0x2d6099,null));};exports['getMembers']=function(_0x2fdf9c,_0x4b11da,_0x440e8d){var _0x596957={};var _0x3fabfa={};var _0x56242f;var _0x5ad6a8;return db[_0xb0a6('0x37')]['findOne']({'where':{'id':_0x2fdf9c['params']['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x4b11da,null))['then'](function(_0x3eb842){if(_0x3eb842){_0x56242f=_0x3eb842;_0x3fabfa[_0xb0a6('0x3d')]=_[_0xb0a6('0x3c')](db[_0xb0a6('0x7d')][_0xb0a6('0x38')]);_0x3fabfa['query']=_[_0xb0a6('0x3c')](_0x2fdf9c[_0xb0a6('0x3b')]);_0x3fabfa[_0xb0a6('0x46')]=_[_0xb0a6('0x3f')](_0x3fabfa[_0xb0a6('0x3d')],_0x3fabfa['query']);_0x596957['attributes']=_[_0xb0a6('0x3f')](_0x3fabfa[_0xb0a6('0x3d')],qs[_0xb0a6('0x40')](_0x2fdf9c[_0xb0a6('0x3b')][_0xb0a6('0x40')]));_0x596957['attributes']=_0x596957[_0xb0a6('0x3e')][_0xb0a6('0x51')]?_0x596957[_0xb0a6('0x3e')]:_0x3fabfa[_0xb0a6('0x3d')];_0x596957[_0xb0a6('0x43')]=qs[_0xb0a6('0x44')](_0x2fdf9c[_0xb0a6('0x3b')][_0xb0a6('0x44')]);_0x596957[_0xb0a6('0x45')]=qs['filters'](_['pick'](_0x2fdf9c[_0xb0a6('0x3b')],_0x3fabfa['filters']));if(_0x2fdf9c['query']['filter']){_0x596957[_0xb0a6('0x45')]=_['merge'](_0x596957['where'],{'$or':_[_0xb0a6('0x2d')](_0x596957['attributes'],function(_0x3890ba){var _0x62706a={};_0x62706a[_0x3890ba]={'$like':'%'+_0x2fdf9c[_0xb0a6('0x3b')][_0xb0a6('0x2b')]+'%'};return _0x62706a;})});}_0x596957=_[_0xb0a6('0x49')]({},_0x596957,_0x2fdf9c[_0xb0a6('0x4a')]);return _0x56242f[_0xb0a6('0x9d')](_0x596957);}})['then'](function(_0x2f0f84){if(_0x2f0f84){_0x5ad6a8=_0x2f0f84['length'];if(!_0x2fdf9c['query'][_0xb0a6('0x41')]('nolimit')){_0x596957[_0xb0a6('0x1e')]=qs[_0xb0a6('0x1e')](_0x2fdf9c['query'][_0xb0a6('0x1e')]);_0x596957[_0xb0a6('0x1d')]=qs[_0xb0a6('0x1d')](_0x2fdf9c['query'][_0xb0a6('0x1d')]);}return _0x56242f[_0xb0a6('0x9d')](_0x596957);}})[_0xb0a6('0x25')](function(_0x58474b){return _0x58474b?{'count':_0x5ad6a8,'rows':_0x58474b}:null;})[_0xb0a6('0x25')](respondWithResult(_0x4b11da,null))[_0xb0a6('0x4e')](handleError(_0x4b11da,null));};exports['getLists']=function(_0x271352,_0x15936d,_0x828a3d){var _0x280785={};var _0x313ef2={};var _0x59661a;var _0x439324;return db[_0xb0a6('0x37')]['findOne']({'where':{'id':_0x271352[_0xb0a6('0x50')]['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x15936d,null))[_0xb0a6('0x25')](function(_0x1f8f7a){if(_0x1f8f7a){_0x59661a=_0x1f8f7a;_0x313ef2[_0xb0a6('0x3d')]=_[_0xb0a6('0x3c')](db['CmList']['rawAttributes']);_0x313ef2[_0xb0a6('0x3b')]=_['keys'](_0x271352[_0xb0a6('0x3b')]);_0x313ef2[_0xb0a6('0x46')]=_['intersection'](_0x313ef2[_0xb0a6('0x3d')],_0x313ef2[_0xb0a6('0x3b')]);_0x280785[_0xb0a6('0x3e')]=_[_0xb0a6('0x3f')](_0x313ef2['model'],qs[_0xb0a6('0x40')](_0x271352[_0xb0a6('0x3b')][_0xb0a6('0x40')]));_0x280785[_0xb0a6('0x3e')]=_0x280785[_0xb0a6('0x3e')][_0xb0a6('0x51')]?_0x280785[_0xb0a6('0x3e')]:_0x313ef2[_0xb0a6('0x3d')];_0x280785[_0xb0a6('0x43')]=qs['sort'](_0x271352[_0xb0a6('0x3b')]['sort']);_0x280785['where']=qs['filters'](_[_0xb0a6('0x47')](_0x271352[_0xb0a6('0x3b')],_0x313ef2['filters']));if(_0x271352['query'][_0xb0a6('0x2b')]){_0x280785[_0xb0a6('0x45')]=_[_0xb0a6('0x49')](_0x280785['where'],{'$or':_[_0xb0a6('0x2d')](_0x280785['attributes'],function(_0x136d83){var _0x340456={};_0x340456[_0x136d83]={'$like':'%'+_0x271352[_0xb0a6('0x3b')][_0xb0a6('0x2b')]+'%'};return _0x340456;})});}_0x280785=_[_0xb0a6('0x49')]({},_0x280785,_0x271352[_0xb0a6('0x4a')]);return _0x59661a[_0xb0a6('0x9e')](_0x280785);}})[_0xb0a6('0x25')](function(_0x409c47){if(_0x409c47){_0x439324=_0x409c47[_0xb0a6('0x51')];if(!_0x271352[_0xb0a6('0x3b')][_0xb0a6('0x41')](_0xb0a6('0x42'))){_0x280785[_0xb0a6('0x1e')]=qs[_0xb0a6('0x1e')](_0x271352['query'][_0xb0a6('0x1e')]);_0x280785[_0xb0a6('0x1d')]=qs[_0xb0a6('0x1d')](_0x271352[_0xb0a6('0x3b')][_0xb0a6('0x1d')]);}return _0x59661a[_0xb0a6('0x9e')](_0x280785);}})['then'](function(_0x43ab1b){if(_0x43ab1b){return _0x43ab1b?{'count':_0x439324,'rows':_0x43ab1b}:null;}})['then'](respondWithResult(_0x15936d,null))['catch'](handleError(_0x15936d,null));};exports['addLists']=function(_0x4e6832,_0x2f9e50,_0xd73b91){var _0x19bc15=moment()[_0xb0a6('0x7f')](_0xb0a6('0x9f'));var _0x1007c2,_0x5e0d9e;return db[_0xb0a6('0x37')][_0xb0a6('0x53')]({'where':{'id':_0x4e6832[_0xb0a6('0x50')]['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x2f9e50,null))[_0xb0a6('0x25')](function(_0x1425c0){if(_0x1425c0){_0x5e0d9e=_0x1425c0;return _0x1425c0['addLists'](_0x4e6832[_0xb0a6('0x5e')][_0xb0a6('0x94')],_[_0xb0a6('0x5b')](_0x4e6832[_0xb0a6('0x5e')],[_0xb0a6('0x94'),'id'])||{});}return null;})['spread'](function(_0x2b1457){var _0x5b582c;_0x1007c2=_0x2b1457||[];var _0x33d77c=[];if(_0x2b1457){for(var _0x1361b0=0x0;_0x1361b0<_0x2b1457[_0xb0a6('0x51')];_0x1361b0+=0x1){var _0x1139d0=_0x2b1457[_0x1361b0]['get']({'plain':!![]});_0x5e0d9e[_0xb0a6('0xa0')]=_0x4e6832[_0xb0a6('0x5e')][_0xb0a6('0xa0')]?_0x4e6832[_0xb0a6('0x5e')]['dialCheckDuplicateType']:_0x5e0d9e[_0xb0a6('0xa0')];switch(_0x5e0d9e[_0xb0a6('0xa0')]){case _0xb0a6('0xa1'):_0x5b582c=squel[_0xb0a6('0xa2')]()['into'](_0xb0a6('0xa3'))[_0xb0a6('0xa4')]([_0xb0a6('0xa5'),_0xb0a6('0xa6'),'ContactId',_0xb0a6('0xa7'),'VoiceQueueId',_0xb0a6('0x5c'),_0xb0a6('0x5d')],squel[_0xb0a6('0x85')]()[_0xb0a6('0x86')]('phone',_0xb0a6('0xa5'))[_0xb0a6('0x86')]('\x27'+_0x19bc15+'\x27',_0xb0a6('0xa6'))['field']('id',_0xb0a6('0xa8'))['field'](_0x1139d0[_0xb0a6('0xa9')][_0xb0a6('0x8e')](),_0xb0a6('0xa7'))[_0xb0a6('0x86')](_0x4e6832[_0xb0a6('0x50')]['id']['toString'](),'VoiceQueueId')[_0xb0a6('0x86')]('\x27'+_0x19bc15+'\x27',_0xb0a6('0x5c'))['field']('\x27'+_0x19bc15+'\x27',_0xb0a6('0x5d'))[_0xb0a6('0x88')]('cm_contacts')[_0xb0a6('0x45')]('deletedAt\x20IS\x20NULL')[_0xb0a6('0x45')]('ListId\x20=\x20?',_0x1139d0['CmListId']['toString']())[_0xb0a6('0x45')](_0xb0a6('0xaa'))['where'](_0xb0a6('0xab'),squel['select']()[_0xb0a6('0x86')](_0xb0a6('0xac'))[_0xb0a6('0x88')](_0xb0a6('0xad'))['where']('VoiceQueueId\x20=\x20?',_0x4e6832[_0xb0a6('0x50')]['id']['toString']()))[_0xb0a6('0x45')](_0xb0a6('0xab'),squel[_0xb0a6('0x85')]()['field'](_0xb0a6('0xae'))[_0xb0a6('0x88')]('cm_hopper')[_0xb0a6('0x45')](_0xb0a6('0x8c'),_0x4e6832['params']['id'][_0xb0a6('0x8e')]())))[_0xb0a6('0x8e')]();break;case _0xb0a6('0xaf'):_0x5b582c=squel[_0xb0a6('0xa2')]()['into'](_0xb0a6('0xa3'))[_0xb0a6('0xa4')](['phone','scheduledAt',_0xb0a6('0xa8'),_0xb0a6('0xa7'),'VoiceQueueId',_0xb0a6('0x5c'),'updatedAt'],squel['select']()[_0xb0a6('0x86')]('phone',_0xb0a6('0xa5'))['field']('\x27'+_0x19bc15+'\x27','scheduledAt')['field']('id',_0xb0a6('0xa8'))[_0xb0a6('0x86')](_0x1139d0['CmListId'][_0xb0a6('0x8e')](),_0xb0a6('0xa7'))[_0xb0a6('0x86')](_0x4e6832[_0xb0a6('0x50')]['id'][_0xb0a6('0x8e')](),'VoiceQueueId')[_0xb0a6('0x86')]('\x27'+_0x19bc15+'\x27',_0xb0a6('0x5c'))[_0xb0a6('0x86')]('\x27'+_0x19bc15+'\x27',_0xb0a6('0x5d'))['from'](_0xb0a6('0xb0'))[_0xb0a6('0x45')]('deletedAt\x20IS\x20NULL')[_0xb0a6('0x45')](_0xb0a6('0xb1'),_0x1139d0[_0xb0a6('0xa9')][_0xb0a6('0x8e')]())[_0xb0a6('0x45')](_0xb0a6('0xaa'))[_0xb0a6('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb0a6('0x85')]()[_0xb0a6('0x86')](_0xb0a6('0xae'))[_0xb0a6('0x88')](_0xb0a6('0xa3'))['where'](_0xb0a6('0x8c'),_0x4e6832['params']['id'][_0xb0a6('0x8e')]())))['toString']();break;default:_0x5b582c=squel[_0xb0a6('0xa2')]()['into'](_0xb0a6('0xa3'))[_0xb0a6('0xa4')]([_0xb0a6('0xa5'),_0xb0a6('0xa6'),'ContactId',_0xb0a6('0xa7'),'VoiceQueueId','createdAt',_0xb0a6('0x5d')],squel[_0xb0a6('0x85')]()[_0xb0a6('0x86')](_0xb0a6('0xa5'),_0xb0a6('0xa5'))[_0xb0a6('0x86')]('\x27'+_0x19bc15+'\x27',_0xb0a6('0xa6'))['field']('id','ContactId')['field'](_0x1139d0[_0xb0a6('0xa9')][_0xb0a6('0x8e')](),_0xb0a6('0xa7'))['field'](_0x4e6832['params']['id'][_0xb0a6('0x8e')](),_0xb0a6('0x65'))[_0xb0a6('0x86')]('\x27'+_0x19bc15+'\x27','createdAt')[_0xb0a6('0x86')]('\x27'+_0x19bc15+'\x27',_0xb0a6('0x5d'))[_0xb0a6('0x88')](_0xb0a6('0xb0'))[_0xb0a6('0x45')](_0xb0a6('0xb2'))[_0xb0a6('0x45')](_0xb0a6('0xb1'),_0x1139d0[_0xb0a6('0xa9')][_0xb0a6('0x8e')]())['where'](_0xb0a6('0xaa')))[_0xb0a6('0x8e')]();}_0x33d77c['push'](db['sequelize'][_0xb0a6('0x3b')](_0x5b582c));}return BPromise[_0xb0a6('0x91')](_0x33d77c);}})[_0xb0a6('0x25')](function(){var _0x37f857=[];var _0xfadea8=squel['insert']()[_0xb0a6('0xb3')](_0xb0a6('0xb4'))[_0xb0a6('0xa4')]([_0xb0a6('0xb5'),_0xb0a6('0xa5'),_0xb0a6('0xb6'),'createdAt',_0xb0a6('0x5d')],squel[_0xb0a6('0x85')]()[_0xb0a6('0x86')](_0xb0a6('0xb7'))[_0xb0a6('0x86')](_0xb0a6('0xb8'))[_0xb0a6('0x86')]('ci.OrderBy+1')['field']('\x27'+_0x19bc15+'\x27',_0xb0a6('0x5c'))[_0xb0a6('0x86')]('\x27'+_0x19bc15+'\x27','updatedAt')[_0xb0a6('0x88')](_0xb0a6('0xb9'),'ci')[_0xb0a6('0x8a')](_0xb0a6('0xa3'),'h',_0xb0a6('0xba'))[_0xb0a6('0x45')](_0xb0a6('0xbb'),_0x19bc15)[_0xb0a6('0x45')](_0xb0a6('0xbc'),'PHONE'))[_0xb0a6('0x8e')]();_0x37f857['push'](db[_0xb0a6('0x75')][_0xb0a6('0x3b')](_0xfadea8));return BPromise['all'](_0x37f857);})[_0xb0a6('0x25')](function(){return _0x1007c2;})[_0xb0a6('0x25')](respondWithResult(_0x2f9e50,null))[_0xb0a6('0x4e')](handleError(_0x2f9e50,null));};exports[_0xb0a6('0xbd')]=function(_0x5a27dd,_0x4d5cf5,_0x437675){return db[_0xb0a6('0x37')]['find']({'where':{'id':_0x5a27dd['params']['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x4d5cf5,null))[_0xb0a6('0x25')](function(_0x2cf5a1){if(_0x2cf5a1){return _0x2cf5a1[_0xb0a6('0xbd')](_0x5a27dd[_0xb0a6('0x3b')][_0xb0a6('0x94')]);}})[_0xb0a6('0x25')](function(_0x3f5bcc){if(_0x3f5bcc){return db[_0xb0a6('0x64')][_0xb0a6('0x33')]({'where':{'ListId':_0x5a27dd[_0xb0a6('0x3b')][_0xb0a6('0x94')],'VoiceQueueId':_0x5a27dd[_0xb0a6('0x50')]['id']}})['then'](function(){return _0x3f5bcc;});}})[_0xb0a6('0x25')](respondWithStatusCode(_0x4d5cf5,null))[_0xb0a6('0x4e')](handleError(_0x4d5cf5,null));};exports[_0xb0a6('0xbe')]=function(_0x5d11be,_0x47812a,_0x52ba59){var _0x5d2d94={};var _0x3012db={};var _0xdc45c;var _0x339459;return db[_0xb0a6('0x37')][_0xb0a6('0x63')]({'where':{'id':_0x5d11be['params']['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x47812a,null))['then'](function(_0x160fe0){if(_0x160fe0){_0xdc45c=_0x160fe0;_0x3012db[_0xb0a6('0x3d')]=_[_0xb0a6('0x3c')](db[_0xb0a6('0xbf')][_0xb0a6('0x38')]);_0x3012db[_0xb0a6('0x3b')]=_[_0xb0a6('0x3c')](_0x5d11be['query']);_0x3012db[_0xb0a6('0x46')]=_['intersection'](_0x3012db[_0xb0a6('0x3d')],_0x3012db['query']);_0x5d2d94[_0xb0a6('0x3e')]=_[_0xb0a6('0x3f')](_0x3012db[_0xb0a6('0x3d')],qs[_0xb0a6('0x40')](_0x5d11be[_0xb0a6('0x3b')][_0xb0a6('0x40')]));_0x5d2d94[_0xb0a6('0x3e')]=_0x5d2d94[_0xb0a6('0x3e')][_0xb0a6('0x51')]?_0x5d2d94['attributes']:_0x3012db[_0xb0a6('0x3d')];_0x5d2d94[_0xb0a6('0x43')]=qs[_0xb0a6('0x44')](_0x5d11be['query']['sort']);_0x5d2d94[_0xb0a6('0x45')]=qs[_0xb0a6('0x46')](_[_0xb0a6('0x47')](_0x5d11be[_0xb0a6('0x3b')],_0x3012db[_0xb0a6('0x46')]));if(_0x5d11be['query'][_0xb0a6('0x2b')]){_0x5d2d94[_0xb0a6('0x45')]=_['merge'](_0x5d2d94[_0xb0a6('0x45')],{'$or':_[_0xb0a6('0x2d')](_0x5d2d94[_0xb0a6('0x3e')],function(_0x1aba15){var _0x4a4512={};_0x4a4512[_0x1aba15]={'$like':'%'+_0x5d11be[_0xb0a6('0x3b')][_0xb0a6('0x2b')]+'%'};return _0x4a4512;})});}_0x5d2d94=_[_0xb0a6('0x49')]({},_0x5d2d94,_0x5d11be['options']);return _0xdc45c[_0xb0a6('0xbe')](_0x5d2d94);}})[_0xb0a6('0x25')](function(_0x1791b9){if(_0x1791b9){_0x339459=_0x1791b9[_0xb0a6('0x51')];if(!_0x5d11be['query']['hasOwnProperty'](_0xb0a6('0x42'))){_0x5d2d94['limit']=qs['limit'](_0x5d11be[_0xb0a6('0x3b')]['limit']);_0x5d2d94[_0xb0a6('0x1d')]=qs[_0xb0a6('0x1d')](_0x5d11be[_0xb0a6('0x3b')]['offset']);}return _0xdc45c[_0xb0a6('0xbe')](_0x5d2d94);}})['then'](function(_0x1a4f19){if(_0x1a4f19){return _0x1a4f19?{'count':_0x339459,'rows':_0x1a4f19}:null;}})['then'](respondWithResult(_0x47812a,null))['catch'](handleError(_0x47812a,null));};exports['addBlackLists']=function(_0x240500,_0x5a7f7c,_0x47d469){var _0x529901,_0x2762bc;return db[_0xb0a6('0x37')]['find']({'where':{'id':_0x240500['params']['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x5a7f7c,null))['then'](function(_0x233f4e){if(_0x233f4e){_0x2762bc=_0x233f4e;return _0x233f4e['addBlackLists'](_0x240500[_0xb0a6('0x5e')][_0xb0a6('0x94')],_[_0xb0a6('0x5b')](_0x240500[_0xb0a6('0x5e')],[_0xb0a6('0x94'),'id'])||{});}return null;})[_0xb0a6('0x99')](function(_0x18a761){var _0x3091c5;_0x529901=_0x18a761||[];var _0x45a3cc=[];if(_0x18a761){for(var _0x29cb05=0x0;_0x29cb05<_0x18a761[_0xb0a6('0x51')];_0x29cb05+=0x1){var _0x35c6d7=_0x18a761[_0x29cb05][_0xb0a6('0x26')]({'plain':!![]});_0x3091c5=squel[_0xb0a6('0xa2')]()[_0xb0a6('0xb3')]('cm_hopper_black')[_0xb0a6('0xa4')](['phone',_0xb0a6('0xa8'),_0xb0a6('0xa7'),_0xb0a6('0x65'),_0xb0a6('0x5c'),_0xb0a6('0x5d')],squel[_0xb0a6('0x85')]()['field'](_0xb0a6('0xa5'),_0xb0a6('0xa5'))[_0xb0a6('0x86')]('id','ContactId')[_0xb0a6('0x86')](_0x35c6d7[_0xb0a6('0xa9')][_0xb0a6('0x8e')](),_0xb0a6('0xa7'))[_0xb0a6('0x86')](_0x240500[_0xb0a6('0x50')]['id']['toString'](),_0xb0a6('0x65'))[_0xb0a6('0x86')](_0xb0a6('0xc0'),'createdAt')['field'](_0xb0a6('0xc0'),_0xb0a6('0x5d'))[_0xb0a6('0x88')](_0xb0a6('0xb0'))['where'](_0xb0a6('0xb2'))[_0xb0a6('0x45')](_0xb0a6('0xb1'),_0x35c6d7[_0xb0a6('0xa9')][_0xb0a6('0x8e')]())[_0xb0a6('0x45')]('phone\x20IS\x20NOT\x20NULL'))[_0xb0a6('0x8e')]();_0x45a3cc[_0xb0a6('0x9a')](db[_0xb0a6('0x75')][_0xb0a6('0x3b')](_0x3091c5));}return BPromise[_0xb0a6('0x91')](_0x45a3cc);}})[_0xb0a6('0x25')](function(){return _0x529901;})[_0xb0a6('0x25')](respondWithResult(_0x5a7f7c,null))['catch'](handleError(_0x5a7f7c,null));};exports[_0xb0a6('0xc1')]=function(_0x24c7d1,_0x1f80a8,_0x59a29e){return db[_0xb0a6('0x37')][_0xb0a6('0x53')]({'where':{'id':_0x24c7d1['params']['id']}})[_0xb0a6('0x25')](handleEntityNotFound(_0x1f80a8,null))[_0xb0a6('0x25')](function(_0x42f86d){if(_0x42f86d){return _0x42f86d[_0xb0a6('0xc1')](_0x24c7d1['query'][_0xb0a6('0x94')]);}})[_0xb0a6('0x25')](function(_0x5edf19){if(_0x5edf19){return db[_0xb0a6('0x6b')]['destroy']({'where':{'ListId':_0x24c7d1[_0xb0a6('0x3b')][_0xb0a6('0x94')],'VoiceQueueId':_0x24c7d1[_0xb0a6('0x50')]['id']}})['then'](function(){return _0x5edf19;});}})[_0xb0a6('0x25')](respondWithStatusCode(_0x1f80a8,null))[_0xb0a6('0x4e')](handleError(_0x1f80a8,null));}; \ No newline at end of file +var _0x2f74=['merge','VIRTUAL','options','VoiceQueue','count','includeAll','include','findAll','rows','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','outbound','UserProfileSection','catch','createdAt','updatedAt','omit','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','nolimit','pick','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','flatMap','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','interface','format','SIP/%s','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','union','compact','ids','isEmpty','removeAgents','forEach','emit','userVoiceQueue:remove','addAgents','voicePause','online','isNil','all','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','scheduledAt','cm_hopper_additional_phones','CmHopperId','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','register','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','ignore','map','value','includes','find','type','name','UserProfileResource','sendStatus','error','stack','index','rawAttributes','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters'];(function(_0x34a161,_0x52a77b){var _0x4412a1=function(_0x32e665){while(--_0x32e665){_0x34a161['push'](_0x34a161['shift']());}};_0x4412a1(++_0x52a77b);}(_0x2f74,0x7b));var _0x42f7=function(_0x59c233,_0xe0627e){_0x59c233=_0x59c233-0x0;var _0x26e0ef=_0x2f74[_0x59c233];return _0x26e0ef;};'use strict';var emlformat=require(_0x42f7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x42f7('0x1'));var jsonpatch=require(_0x42f7('0x2'));var rp=require(_0x42f7('0x3'));var moment=require(_0x42f7('0x4'));var BPromise=require(_0x42f7('0x5'));var Mustache=require(_0x42f7('0x6'));var util=require(_0x42f7('0x7'));var path=require(_0x42f7('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x42f7('0x9'));var _=require(_0x42f7('0xa'));var squel=require(_0x42f7('0xb'));var crypto=require(_0x42f7('0xc'));var jsforce=require(_0x42f7('0xd'));var deskjs=require(_0x42f7('0xe'));var toCsv=require(_0x42f7('0xf'));var querystring=require(_0x42f7('0x10'));var Papa=require('papaparse');var Redis=require(_0x42f7('0x11'));var authService=require(_0x42f7('0x12'));var qs=require(_0x42f7('0x13'));var as=require(_0x42f7('0x14'));var hardwareService=require(_0x42f7('0x15'));var logger=require(_0x42f7('0x16'))('api');var utils=require(_0x42f7('0x17'));var config=require(_0x42f7('0x18'));var licenseUtil=require(_0x42f7('0x19'));var db=require(_0x42f7('0x1a'))['db'];config[_0x42f7('0x1b')]=_[_0x42f7('0x1c')](config[_0x42f7('0x1b')],{'host':_0x42f7('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x42f7('0x1e'))[_0x42f7('0x1f')](socket);function respondWithStatusCode(_0x15d327,_0x1a30a4){_0x1a30a4=_0x1a30a4||0xcc;return function(_0x3a7512){if(_0x3a7512){return _0x15d327['sendStatus'](_0x1a30a4);}return _0x15d327[_0x42f7('0x20')](_0x1a30a4)['end']();};}function respondWithResult(_0x3e7fd8,_0x225a6b){_0x225a6b=_0x225a6b||0xc8;return function(_0x16d842){if(_0x16d842){return _0x3e7fd8[_0x42f7('0x20')](_0x225a6b)[_0x42f7('0x21')](_0x16d842);}};}function respondWithFilteredResult(_0xa1bb54,_0x1ca5ab){return function(_0x47aa1d){if(_0x47aa1d){var _0x3fc38d=typeof _0x1ca5ab[_0x42f7('0x22')]===_0x42f7('0x23')&&typeof _0x1ca5ab[_0x42f7('0x24')]===_0x42f7('0x23');var _0x9270e3=_0x47aa1d['count'];var _0x2b1910=_0x3fc38d?0x0:_0x1ca5ab['offset'];var _0x1ae649=_0x3fc38d?_0x47aa1d['count']:_0x1ca5ab[_0x42f7('0x22')]+_0x1ca5ab['limit'];var _0x4d5f51;if(_0x1ae649>=_0x9270e3){_0x1ae649=_0x9270e3;_0x4d5f51=0xc8;}else{_0x4d5f51=0xce;}_0xa1bb54['status'](_0x4d5f51);return _0xa1bb54[_0x42f7('0x25')](_0x42f7('0x26'),_0x2b1910+'-'+_0x1ae649+'/'+_0x9270e3)[_0x42f7('0x21')](_0x47aa1d);}return null;};}function patchUpdates(_0x2a755a){return function(_0x419ad0){try{jsonpatch[_0x42f7('0x27')](_0x419ad0,_0x2a755a,!![]);}catch(_0x3b12a7){return BPromise[_0x42f7('0x28')](_0x3b12a7);}return _0x419ad0[_0x42f7('0x29')]();};}function saveUpdates(_0x372709,_0x2730a1){return function(_0xd6093d){if(_0xd6093d){return _0xd6093d[_0x42f7('0x2a')](_0x372709)[_0x42f7('0x2b')](function(_0x553531){return _0x553531;});}return null;};}function removeEntity(_0x56627d,_0x10e6f7){return function(_0x35f941){if(_0x35f941){return _0x35f941[_0x42f7('0x2c')]()[_0x42f7('0x2b')](function(){var _0x1e31de=_0x35f941[_0x42f7('0x2d')]({'plain':!![]});var _0x8b64e5=[{'name':_0x42f7('0x2e'),'value':_0x42f7('0x2f'),'ignore':![]},{'name':_0x42f7('0x30'),'value':'outbound','ignore':![]}];var _0x5ac358=_(_0x8b64e5)[_0x42f7('0x31')](_0x42f7('0x32'))[_0x42f7('0x33')]('value')[_0x42f7('0x34')]();if(_[_0x42f7('0x35')](_0x5ac358,_0x1e31de['type'])){return;}var _0x59e2ca=_[_0x42f7('0x36')](_0x8b64e5,[_0x42f7('0x34'),_0x1e31de[_0x42f7('0x37')]])[_0x42f7('0x38')];return db[_0x42f7('0x39')][_0x42f7('0x2c')]({'where':{'type':_0x59e2ca,'resourceId':_0x1e31de['id']}})[_0x42f7('0x2b')](function(){return _0x35f941;});})[_0x42f7('0x2b')](function(){_0x56627d[_0x42f7('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dcbb6,_0x3e646d){return function(_0x11b8e4){if(!_0x11b8e4){_0x3dcbb6[_0x42f7('0x3a')](0x194);}return _0x11b8e4;};}function handleError(_0x1ac7e0,_0x5aa45f){_0x5aa45f=_0x5aa45f||0x1f4;return function(_0x27db26){logger[_0x42f7('0x3b')](_0x27db26[_0x42f7('0x3c')]);if(_0x27db26[_0x42f7('0x38')]){delete _0x27db26['name'];}_0x1ac7e0[_0x42f7('0x20')](_0x5aa45f)['send'](_0x27db26);};}exports[_0x42f7('0x3d')]=function(_0x2bb14b,_0xec377d){var _0x27518d={},_0x14cae3={},_0x22a45b={'count':0x0,'rows':[]};var _0x372a20=_['map'](db['VoiceQueue'][_0x42f7('0x3e')],function(_0x35ab16){return{'name':_0x35ab16['fieldName'],'type':_0x35ab16[_0x42f7('0x37')]['key']};});_0x14cae3[_0x42f7('0x3f')]=_[_0x42f7('0x33')](_0x372a20,'name');_0x14cae3['query']=_['keys'](_0x2bb14b[_0x42f7('0x40')]);_0x14cae3['filters']=_[_0x42f7('0x41')](_0x14cae3[_0x42f7('0x3f')],_0x14cae3[_0x42f7('0x40')]);_0x27518d[_0x42f7('0x42')]=_[_0x42f7('0x41')](_0x14cae3['model'],qs[_0x42f7('0x43')](_0x2bb14b[_0x42f7('0x40')]['fields']));_0x27518d['attributes']=_0x27518d[_0x42f7('0x42')][_0x42f7('0x44')]?_0x27518d[_0x42f7('0x42')]:_0x14cae3[_0x42f7('0x3f')];if(!_0x2bb14b[_0x42f7('0x40')][_0x42f7('0x45')]('nolimit')){_0x27518d[_0x42f7('0x24')]=qs['limit'](_0x2bb14b[_0x42f7('0x40')][_0x42f7('0x24')]);_0x27518d[_0x42f7('0x22')]=qs['offset'](_0x2bb14b[_0x42f7('0x40')]['offset']);}_0x27518d[_0x42f7('0x46')]=qs[_0x42f7('0x47')](_0x2bb14b[_0x42f7('0x40')]['sort']);_0x27518d[_0x42f7('0x48')]=qs[_0x42f7('0x49')](_['pick'](_0x2bb14b[_0x42f7('0x40')],_0x14cae3['filters']),_0x372a20);if(_0x2bb14b[_0x42f7('0x40')]['filter']){_0x27518d[_0x42f7('0x48')]=_[_0x42f7('0x4a')](_0x27518d['where'],{'$or':_[_0x42f7('0x33')](_0x372a20,function(_0xd99317){if(_0xd99317['type']!==_0x42f7('0x4b')){var _0x3916ce={};_0x3916ce[_0xd99317[_0x42f7('0x38')]]={'$like':'%'+_0x2bb14b[_0x42f7('0x40')][_0x42f7('0x31')]+'%'};return _0x3916ce;}})});}_0x27518d=_['merge']({},_0x27518d,_0x2bb14b[_0x42f7('0x4c')]);var _0x4acd7e={'where':_0x27518d[_0x42f7('0x48')]};return db[_0x42f7('0x4d')][_0x42f7('0x4e')](_0x4acd7e)[_0x42f7('0x2b')](function(_0x52c52d){_0x22a45b[_0x42f7('0x4e')]=_0x52c52d;if(_0x2bb14b[_0x42f7('0x40')][_0x42f7('0x4f')]){_0x27518d[_0x42f7('0x50')]=[{'all':!![]}];}return db[_0x42f7('0x4d')][_0x42f7('0x51')](_0x27518d);})['then'](function(_0x48d5e2){_0x22a45b[_0x42f7('0x52')]=_0x48d5e2;return _0x22a45b;})[_0x42f7('0x2b')](respondWithFilteredResult(_0xec377d,_0x27518d))['catch'](handleError(_0xec377d,null));};exports[_0x42f7('0x53')]=function(_0x3228f6,_0x135928){var _0x27434a={'raw':![],'where':{'id':_0x3228f6[_0x42f7('0x54')]['id']}},_0x335d6b={};_0x335d6b[_0x42f7('0x3f')]=_[_0x42f7('0x55')](db[_0x42f7('0x4d')]['rawAttributes']);_0x335d6b[_0x42f7('0x40')]=_[_0x42f7('0x55')](_0x3228f6[_0x42f7('0x40')]);_0x335d6b[_0x42f7('0x49')]=_[_0x42f7('0x41')](_0x335d6b[_0x42f7('0x3f')],_0x335d6b[_0x42f7('0x40')]);_0x27434a[_0x42f7('0x42')]=_['intersection'](_0x335d6b[_0x42f7('0x3f')],qs[_0x42f7('0x43')](_0x3228f6[_0x42f7('0x40')][_0x42f7('0x43')]));_0x27434a[_0x42f7('0x42')]=_0x27434a[_0x42f7('0x42')]['length']?_0x27434a[_0x42f7('0x42')]:_0x335d6b[_0x42f7('0x3f')];if(_0x3228f6['query'][_0x42f7('0x4f')]){_0x27434a['include']=[{'all':!![]}];}_0x27434a=_[_0x42f7('0x4a')]({},_0x27434a,_0x3228f6[_0x42f7('0x4c')]);return db[_0x42f7('0x4d')]['find'](_0x27434a)[_0x42f7('0x2b')](handleEntityNotFound(_0x135928,null))[_0x42f7('0x2b')](respondWithResult(_0x135928,null))['catch'](handleError(_0x135928,null));};exports[_0x42f7('0x56')]=function(_0x2e7262,_0xbb1b9d){return db[_0x42f7('0x4d')][_0x42f7('0x56')](_0x2e7262[_0x42f7('0x57')],{})[_0x42f7('0x2b')](function(_0x245099){var _0x4c2b35=_0x2e7262[_0x42f7('0x58')][_0x42f7('0x2d')]({'plain':!![]});if(!_0x4c2b35)throw new Error(_0x42f7('0x59'));if(_0x4c2b35[_0x42f7('0x5a')]==='user'){var _0xbe7233=_0x245099['get']({'plain':!![]});var _0x218a35=[{'name':_0x42f7('0x2e'),'value':_0x42f7('0x2f')},{'name':_0x42f7('0x30'),'value':_0x42f7('0x5b')}];var _0x5faada=_[_0x42f7('0x36')](_0x218a35,[_0x42f7('0x34'),_0xbe7233['type']])[_0x42f7('0x38')];return db[_0x42f7('0x5c')]['find']({'where':{'name':_0x5faada,'userProfileId':_0x4c2b35['userProfileId']},'raw':!![]})[_0x42f7('0x2b')](function(_0x4ed03d){if(_0x4ed03d&&_0x4ed03d['autoAssociation']===0x0){return db[_0x42f7('0x39')][_0x42f7('0x56')]({'name':_0xbe7233['name'],'resourceId':_0xbe7233['id'],'type':_0x4ed03d['name'],'sectionId':_0x4ed03d['id']},{})[_0x42f7('0x2b')](function(){return _0x245099;});}else{return _0x245099;}})['catch'](function(_0x1d0a93){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d0a93);throw _0x1d0a93;});}return _0x245099;})[_0x42f7('0x2b')](respondWithResult(_0xbb1b9d,0xc9))[_0x42f7('0x5d')](handleError(_0xbb1b9d,null));};exports['clone']=function(_0x5cb24f,_0x2f5909){var _0xd8842f={'where':{'id':_0x5cb24f[_0x42f7('0x54')]['id']}},_0x49029d={};_0x49029d[_0x42f7('0x3f')]=_[_0x42f7('0x55')](db[_0x42f7('0x4d')][_0x42f7('0x3e')]);_0xd8842f['attributes']=_[_0x42f7('0x41')](_0x49029d['model'],qs[_0x42f7('0x43')](_0x5cb24f[_0x42f7('0x40')][_0x42f7('0x43')]));_0xd8842f[_0x42f7('0x42')]=_0xd8842f[_0x42f7('0x42')][_0x42f7('0x44')]?_0xd8842f[_0x42f7('0x42')]:_0x49029d['model'];if(_0x5cb24f[_0x42f7('0x40')][_0x42f7('0x4f')]){_0xd8842f['include']=[{'all':!![]}];}_0xd8842f=_[_0x42f7('0x4a')]({},_0xd8842f,_0x5cb24f[_0x42f7('0x4c')]);return db[_0x42f7('0x4d')][_0x42f7('0x36')](_0xd8842f)['then'](handleEntityNotFound(_0x2f5909,null))[_0x42f7('0x2b')](function(_0x4d2c5d){if(_0x4d2c5d){var _0x31290e=_0x4d2c5d[_0x42f7('0x2d')]({'plain':!![]});_0x31290e=qs['omit'](_0x31290e,['id',_0x42f7('0x5e'),_0x42f7('0x5f')]);_0x5cb24f[_0x42f7('0x57')]=_[_0x42f7('0x60')](_0x5cb24f[_0x42f7('0x57')],['id',_0x42f7('0x5e'),_0x42f7('0x5f')]);return db['VoiceQueue'][_0x42f7('0x56')](_[_0x42f7('0x4a')](_0x31290e,_0x5cb24f[_0x42f7('0x57')]),{'include':_0x5cb24f['query'][_0x42f7('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x27f4d2){var _0x4c813c=_0x5cb24f['user']['get']({'plain':!![]});if(!_0x4c813c)throw new Error(_0x42f7('0x59'));if(_0x4c813c['role']===_0x42f7('0x58')){var _0x2117a6=_0x27f4d2['get']({'plain':!![]});var _0x4ba8f9=[{'name':_0x42f7('0x2e'),'value':'inbound'},{'name':_0x42f7('0x30'),'value':'outbound'}];var _0x37a9b4=_['find'](_0x4ba8f9,[_0x42f7('0x34'),_0x2117a6[_0x42f7('0x37')]])[_0x42f7('0x38')];return db[_0x42f7('0x5c')][_0x42f7('0x36')]({'where':{'name':_0x37a9b4,'userProfileId':_0x4c813c[_0x42f7('0x61')]},'raw':!![]})[_0x42f7('0x2b')](function(_0x5b9e5b){if(_0x5b9e5b&&_0x5b9e5b[_0x42f7('0x62')]===0x0){return db[_0x42f7('0x39')][_0x42f7('0x56')]({'name':_0x2117a6[_0x42f7('0x38')],'resourceId':_0x2117a6['id'],'type':_0x5b9e5b['name'],'sectionId':_0x5b9e5b['id']},{})[_0x42f7('0x2b')](function(){return _0x27f4d2;});}else{return _0x27f4d2;}})[_0x42f7('0x5d')](function(_0x3c98a3){logger['error'](_0x42f7('0x63'),_0x3c98a3);throw _0x3c98a3;});}return _0x27f4d2;});}})[_0x42f7('0x2b')](respondWithResult(_0x2f5909,0xc9))[_0x42f7('0x5d')](handleError(_0x2f5909,null));};exports['update']=function(_0x373e2f,_0x5292fd){if(_0x373e2f[_0x42f7('0x57')]['id']){delete _0x373e2f[_0x42f7('0x57')]['id'];}return db[_0x42f7('0x4d')][_0x42f7('0x36')]({'where':{'id':_0x373e2f[_0x42f7('0x54')]['id']}})[_0x42f7('0x2b')](handleEntityNotFound(_0x5292fd,null))[_0x42f7('0x2b')](saveUpdates(_0x373e2f[_0x42f7('0x57')],null))[_0x42f7('0x2b')](respondWithResult(_0x5292fd,null))['catch'](handleError(_0x5292fd,null));};exports['destroy']=function(_0x42259e,_0x3faad9){return db['VoiceQueue'][_0x42f7('0x36')]({'where':{'id':_0x42259e['params']['id']}})[_0x42f7('0x2b')](handleEntityNotFound(_0x3faad9,null))['then'](removeEntity(_0x3faad9,null))[_0x42f7('0x5d')](handleError(_0x3faad9,null));};exports[_0x42f7('0x64')]=function(_0x56ac1e,_0x4edd3e,_0x51cf22){var _0x18b810={'raw':![],'where':{}};var _0x56e591={};var _0x2fb982={'count':0x0,'rows':[]};return db[_0x42f7('0x4d')][_0x42f7('0x65')]({'where':{'id':_0x56ac1e[_0x42f7('0x54')]['id']}})[_0x42f7('0x2b')](handleEntityNotFound(_0x4edd3e,null))[_0x42f7('0x2b')](function(_0x43a950){if(_0x43a950){_0x56e591[_0x42f7('0x3f')]=_['keys'](db[_0x42f7('0x66')][_0x42f7('0x3e')]);_0x56e591[_0x42f7('0x40')]=_[_0x42f7('0x55')](_0x56ac1e['query']);_0x56e591[_0x42f7('0x49')]=_[_0x42f7('0x41')](_0x56e591['model'],_0x56e591[_0x42f7('0x40')]);_0x18b810[_0x42f7('0x42')]=_[_0x42f7('0x41')](_0x56e591['model'],qs[_0x42f7('0x43')](_0x56ac1e[_0x42f7('0x40')][_0x42f7('0x43')]));_0x18b810[_0x42f7('0x42')]=_0x18b810[_0x42f7('0x42')][_0x42f7('0x44')]?_0x18b810[_0x42f7('0x42')]:_0x56e591[_0x42f7('0x3f')];if(!_0x56ac1e[_0x42f7('0x40')]['hasOwnProperty'](_0x42f7('0x67'))){_0x18b810['limit']=qs[_0x42f7('0x24')](_0x56ac1e[_0x42f7('0x40')][_0x42f7('0x24')]);_0x18b810[_0x42f7('0x22')]=qs[_0x42f7('0x22')](_0x56ac1e[_0x42f7('0x40')][_0x42f7('0x22')]);}_0x18b810[_0x42f7('0x46')]=qs[_0x42f7('0x47')](_0x56ac1e['query'][_0x42f7('0x47')]);_0x18b810[_0x42f7('0x48')]=qs[_0x42f7('0x49')](_[_0x42f7('0x68')](_0x56ac1e[_0x42f7('0x40')],_0x56e591['filters']));_0x18b810[_0x42f7('0x48')][_0x42f7('0x69')]=_0x43a950['id'];if(_0x56ac1e[_0x42f7('0x40')][_0x42f7('0x31')]){_0x18b810['where']=_[_0x42f7('0x4a')](_0x18b810[_0x42f7('0x48')],{'$or':_[_0x42f7('0x33')](_0x18b810[_0x42f7('0x42')],function(_0x31389f){var _0x57b632={};_0x57b632[_0x31389f]={'$like':'%'+_0x56ac1e[_0x42f7('0x40')][_0x42f7('0x31')]+'%'};return _0x57b632;})});}_0x18b810=_[_0x42f7('0x4a')]({},_0x18b810,_0x56ac1e[_0x42f7('0x4c')]);return db[_0x42f7('0x66')][_0x42f7('0x4e')]({'where':_0x18b810[_0x42f7('0x48')]})[_0x42f7('0x2b')](function(_0x697c8a){_0x2fb982['count']=_0x697c8a;if(_0x56ac1e[_0x42f7('0x40')]['includeAll']){_0x18b810[_0x42f7('0x50')]=[{'all':!![]}];}return db[_0x42f7('0x66')][_0x42f7('0x51')](_0x18b810);})[_0x42f7('0x2b')](function(_0x163925){_0x2fb982[_0x42f7('0x52')]=_0x163925;return _0x2fb982;});}})[_0x42f7('0x2b')](respondWithFilteredResult(_0x4edd3e,_0x18b810))[_0x42f7('0x5d')](handleError(_0x4edd3e,null));};exports[_0x42f7('0x6a')]=function(_0x2ef131,_0x91d9a6,_0x243663){var _0x14b173={'raw':!![],'where':{}};var _0x3d0676={};var _0x170e25={'count':0x0,'rows':[]};return db[_0x42f7('0x4d')]['findOne']({'where':{'id':_0x2ef131['params']['id']}})[_0x42f7('0x2b')](handleEntityNotFound(_0x91d9a6,null))[_0x42f7('0x2b')](function(_0x2b2080){if(_0x2b2080){_0x3d0676[_0x42f7('0x3f')]=_['keys'](db['CmHopperHistory'][_0x42f7('0x3e')]);_0x3d0676[_0x42f7('0x40')]=_[_0x42f7('0x55')](_0x2ef131[_0x42f7('0x40')]);_0x3d0676['filters']=_[_0x42f7('0x41')](_0x3d0676[_0x42f7('0x3f')],_0x3d0676[_0x42f7('0x40')]);_0x14b173['attributes']=_['intersection'](_0x3d0676[_0x42f7('0x3f')],qs[_0x42f7('0x43')](_0x2ef131[_0x42f7('0x40')]['fields']));_0x14b173[_0x42f7('0x42')]=_0x14b173['attributes']['length']?_0x14b173[_0x42f7('0x42')]:_0x3d0676[_0x42f7('0x3f')];if(!_0x2ef131['query']['hasOwnProperty']('nolimit')){_0x14b173['limit']=qs[_0x42f7('0x24')](_0x2ef131[_0x42f7('0x40')][_0x42f7('0x24')]);_0x14b173['offset']=qs[_0x42f7('0x22')](_0x2ef131[_0x42f7('0x40')]['offset']);}_0x14b173[_0x42f7('0x46')]=qs[_0x42f7('0x47')](_0x2ef131[_0x42f7('0x40')][_0x42f7('0x47')]);_0x14b173['where']=qs[_0x42f7('0x49')](_[_0x42f7('0x68')](_0x2ef131['query'],_0x3d0676[_0x42f7('0x49')]));_0x14b173[_0x42f7('0x48')][_0x42f7('0x69')]=_0x2b2080['id'];if(_0x2ef131[_0x42f7('0x40')]['filter']){_0x14b173['where']=_[_0x42f7('0x4a')](_0x14b173[_0x42f7('0x48')],{'$or':_[_0x42f7('0x33')](_0x14b173[_0x42f7('0x42')],function(_0x5ac4d1){var _0x169f16={};_0x169f16[_0x5ac4d1]={'$like':'%'+_0x2ef131[_0x42f7('0x40')][_0x42f7('0x31')]+'%'};return _0x169f16;})});}_0x14b173=_['merge']({},_0x14b173,_0x2ef131['options']);return db[_0x42f7('0x6b')][_0x42f7('0x4e')]({'where':_0x14b173['where']})[_0x42f7('0x2b')](function(_0x585dae){_0x170e25[_0x42f7('0x4e')]=_0x585dae;if(_0x2ef131[_0x42f7('0x40')]['includeAll']){_0x14b173[_0x42f7('0x50')]=[{'all':!![]}];}return db[_0x42f7('0x6b')][_0x42f7('0x51')](_0x14b173);})['then'](function(_0x470ec5){_0x170e25[_0x42f7('0x52')]=_0x470ec5;return _0x170e25;});}})[_0x42f7('0x2b')](respondWithFilteredResult(_0x91d9a6,_0x14b173))[_0x42f7('0x5d')](handleError(_0x91d9a6,null));};exports[_0x42f7('0x6c')]=function(_0x542a18,_0x215249,_0x1066cb){var _0x507316={'raw':!![],'where':{}};var _0xf5758d={};var _0x4e3ac8={'count':0x0,'rows':[]};return db[_0x42f7('0x4d')][_0x42f7('0x65')]({'where':{'id':_0x542a18[_0x42f7('0x54')]['id']}})[_0x42f7('0x2b')](handleEntityNotFound(_0x215249,null))[_0x42f7('0x2b')](function(_0x38d54d){if(_0x38d54d){_0xf5758d[_0x42f7('0x3f')]=_['keys'](db[_0x42f7('0x6d')][_0x42f7('0x3e')]);_0xf5758d[_0x42f7('0x40')]=_[_0x42f7('0x55')](_0x542a18[_0x42f7('0x40')]);_0xf5758d[_0x42f7('0x49')]=_[_0x42f7('0x41')](_0xf5758d[_0x42f7('0x3f')],_0xf5758d[_0x42f7('0x40')]);_0x507316['attributes']=_[_0x42f7('0x41')](_0xf5758d['model'],qs['fields'](_0x542a18['query'][_0x42f7('0x43')]));_0x507316[_0x42f7('0x42')]=_0x507316[_0x42f7('0x42')]['length']?_0x507316[_0x42f7('0x42')]:_0xf5758d[_0x42f7('0x3f')];if(!_0x542a18['query'][_0x42f7('0x45')]('nolimit')){_0x507316['limit']=qs[_0x42f7('0x24')](_0x542a18['query'][_0x42f7('0x24')]);_0x507316[_0x42f7('0x22')]=qs[_0x42f7('0x22')](_0x542a18[_0x42f7('0x40')][_0x42f7('0x22')]);}_0x507316[_0x42f7('0x46')]=qs['sort'](_0x542a18['query'][_0x42f7('0x47')]);_0x507316[_0x42f7('0x48')]=qs[_0x42f7('0x49')](_['pick'](_0x542a18[_0x42f7('0x40')],_0xf5758d['filters']));_0x507316[_0x42f7('0x48')]['VoiceQueueId']=_0x38d54d['id'];if(_0x542a18[_0x42f7('0x40')][_0x42f7('0x31')]){_0x507316[_0x42f7('0x48')]=_['merge'](_0x507316[_0x42f7('0x48')],{'$or':_[_0x42f7('0x33')](_0x507316[_0x42f7('0x42')],function(_0x191ca6){var _0x2b9335={};_0x2b9335[_0x191ca6]={'$like':'%'+_0x542a18[_0x42f7('0x40')][_0x42f7('0x31')]+'%'};return _0x2b9335;})});}_0x507316=_[_0x42f7('0x4a')]({},_0x507316,_0x542a18[_0x42f7('0x4c')]);return db['CmHopperFinal'][_0x42f7('0x4e')]({'where':_0x507316[_0x42f7('0x48')]})[_0x42f7('0x2b')](function(_0x492c0f){_0x4e3ac8[_0x42f7('0x4e')]=_0x492c0f;if(_0x542a18[_0x42f7('0x40')][_0x42f7('0x4f')]){_0x507316[_0x42f7('0x50')]=[{'all':!![]}];}return db[_0x42f7('0x6d')][_0x42f7('0x51')](_0x507316);})[_0x42f7('0x2b')](function(_0x2e0dbb){_0x4e3ac8[_0x42f7('0x52')]=_0x2e0dbb;return _0x4e3ac8;});}})[_0x42f7('0x2b')](respondWithFilteredResult(_0x215249,_0x507316))[_0x42f7('0x5d')](handleError(_0x215249,null));};exports['getHopperBlacks']=function(_0x278395,_0x3def36,_0x419ca0){var _0x5c59e4={'raw':!![],'where':{}};var _0x5e34d1={};var _0x2eb7c1={'count':0x0,'rows':[]};return db[_0x42f7('0x4d')][_0x42f7('0x65')]({'where':{'id':_0x278395[_0x42f7('0x54')]['id']}})[_0x42f7('0x2b')](handleEntityNotFound(_0x3def36,null))['then'](function(_0x3b268b){if(_0x3b268b){_0x5e34d1[_0x42f7('0x3f')]=_[_0x42f7('0x55')](db['CmHopperBlack'][_0x42f7('0x3e')]);_0x5e34d1[_0x42f7('0x40')]=_[_0x42f7('0x55')](_0x278395[_0x42f7('0x40')]);_0x5e34d1[_0x42f7('0x49')]=_[_0x42f7('0x41')](_0x5e34d1[_0x42f7('0x3f')],_0x5e34d1['query']);_0x5c59e4[_0x42f7('0x42')]=_[_0x42f7('0x41')](_0x5e34d1[_0x42f7('0x3f')],qs['fields'](_0x278395[_0x42f7('0x40')][_0x42f7('0x43')]));_0x5c59e4['attributes']=_0x5c59e4['attributes']['length']?_0x5c59e4[_0x42f7('0x42')]:_0x5e34d1['model'];if(!_0x278395[_0x42f7('0x40')][_0x42f7('0x45')](_0x42f7('0x67'))){_0x5c59e4[_0x42f7('0x24')]=qs[_0x42f7('0x24')](_0x278395['query']['limit']);_0x5c59e4[_0x42f7('0x22')]=qs[_0x42f7('0x22')](_0x278395[_0x42f7('0x40')]['offset']);}_0x5c59e4['order']=qs['sort'](_0x278395[_0x42f7('0x40')][_0x42f7('0x47')]);_0x5c59e4[_0x42f7('0x48')]=qs[_0x42f7('0x49')](_[_0x42f7('0x68')](_0x278395['query'],_0x5e34d1[_0x42f7('0x49')]));_0x5c59e4['where'][_0x42f7('0x69')]=_0x3b268b['id'];if(_0x278395[_0x42f7('0x40')][_0x42f7('0x31')]){_0x5c59e4['where']=_[_0x42f7('0x4a')](_0x5c59e4[_0x42f7('0x48')],{'$or':_[_0x42f7('0x33')](_0x5c59e4[_0x42f7('0x42')],function(_0x6f8d5c){var _0x3fe76e={};_0x3fe76e[_0x6f8d5c]={'$like':'%'+_0x278395[_0x42f7('0x40')][_0x42f7('0x31')]+'%'};return _0x3fe76e;})});}_0x5c59e4=_['merge']({},_0x5c59e4,_0x278395[_0x42f7('0x4c')]);return db['CmHopperBlack'][_0x42f7('0x4e')]({'where':_0x5c59e4[_0x42f7('0x48')]})[_0x42f7('0x2b')](function(_0x1b2b1b){_0x2eb7c1['count']=_0x1b2b1b;if(_0x278395['query'][_0x42f7('0x4f')]){_0x5c59e4[_0x42f7('0x50')]=[{'all':!![]}];}return db[_0x42f7('0x6e')][_0x42f7('0x51')](_0x5c59e4);})[_0x42f7('0x2b')](function(_0x3b3ca7){_0x2eb7c1[_0x42f7('0x52')]=_0x3b3ca7;return _0x2eb7c1;});}})[_0x42f7('0x2b')](respondWithFilteredResult(_0x3def36,_0x5c59e4))['catch'](handleError(_0x3def36,null));};exports[_0x42f7('0x6f')]=function(_0x30a086,_0x42733d,_0x54e9b5){var _0x4c615e={};var _0xf2d5b0={};var _0x17619b;var _0x4e959f;return db[_0x42f7('0x4d')][_0x42f7('0x65')]({'where':{'id':_0x30a086['params']['id']}})['then'](handleEntityNotFound(_0x42733d,null))[_0x42f7('0x2b')](function(_0x1aba8c){if(_0x1aba8c){_0x17619b=_0x1aba8c;_0xf2d5b0[_0x42f7('0x3f')]=_[_0x42f7('0x55')](db[_0x42f7('0x70')][_0x42f7('0x3e')]);_0xf2d5b0[_0x42f7('0x40')]=_[_0x42f7('0x55')](_0x30a086[_0x42f7('0x40')]);_0xf2d5b0[_0x42f7('0x49')]=_[_0x42f7('0x41')](_0xf2d5b0[_0x42f7('0x3f')],_0xf2d5b0[_0x42f7('0x40')]);_0x4c615e['attributes']=_['intersection'](_0xf2d5b0[_0x42f7('0x3f')],qs[_0x42f7('0x43')](_0x30a086[_0x42f7('0x40')]['fields']));_0x4c615e[_0x42f7('0x42')]=_0x4c615e['attributes']['length']?_0x4c615e[_0x42f7('0x42')]:_0xf2d5b0[_0x42f7('0x3f')];_0x4c615e[_0x42f7('0x46')]=qs['sort'](_0x30a086[_0x42f7('0x40')][_0x42f7('0x47')]);_0x4c615e[_0x42f7('0x48')]=qs[_0x42f7('0x49')](_[_0x42f7('0x68')](_0x30a086[_0x42f7('0x40')],_0xf2d5b0[_0x42f7('0x49')]));if(_0x30a086[_0x42f7('0x40')][_0x42f7('0x31')]){_0x4c615e[_0x42f7('0x48')]=_[_0x42f7('0x4a')](_0x4c615e[_0x42f7('0x48')],{'$or':_[_0x42f7('0x33')](_0x4c615e[_0x42f7('0x42')],function(_0x1fda66){var _0x3332ef={};_0x3332ef[_0x1fda66]={'$like':'%'+_0x30a086[_0x42f7('0x40')]['filter']+'%'};return _0x3332ef;})});}_0x4c615e=_[_0x42f7('0x4a')]({},_0x4c615e,_0x30a086[_0x42f7('0x4c')]);return _0x17619b[_0x42f7('0x6f')](_0x4c615e);}})[_0x42f7('0x2b')](function(_0x4e06d3){if(_0x4e06d3){_0x4e959f=_0x4e06d3['length'];if(!_0x30a086['query'][_0x42f7('0x45')](_0x42f7('0x67'))){_0x4c615e['limit']=qs[_0x42f7('0x24')](_0x30a086[_0x42f7('0x40')][_0x42f7('0x24')]);_0x4c615e[_0x42f7('0x22')]=qs[_0x42f7('0x22')](_0x30a086['query']['offset']);}return _0x17619b[_0x42f7('0x6f')](_0x4c615e);}})['then'](function(_0x11fcd0){if(_0x11fcd0){return _0x11fcd0?{'count':_0x4e959f,'rows':_0x11fcd0}:null;}})['then'](respondWithResult(_0x42733d,null))[_0x42f7('0x5d')](handleError(_0x42733d,null));};exports[_0x42f7('0x71')]=function(_0x34f830,_0x171de4,_0x4c75c1){var _0x436c98=_0x34f830[_0x42f7('0x57')][_0x42f7('0x72')];var _0x320b7a=_[_0x42f7('0x33')](_0x436c98,'id');return db['Team'][_0x42f7('0x51')]({'where':{'id':_0x320b7a},'attributes':['id'],'include':[{'model':db[_0x42f7('0x73')],'as':_0x42f7('0x74'),'attributes':['id','name','online','voicePause','interface'],'raw':!![]}]})[_0x42f7('0x2b')](function(_0x17935d){if(_0x17935d){var _0x3e2423=_[_0x42f7('0x75')](_0x17935d,function(_0x27b185){var _0x1984c7=_0x27b185[_0x42f7('0x2d')]({'plain':!![]});_0x1984c7[_0x42f7('0x74')]['forEach'](function(_0x3d7864){_0x3d7864[_0x42f7('0x76')]=_[_0x42f7('0x36')](_0x436c98,{'id':_0x1984c7['id']})[_0x42f7('0x76')];});return _0x1984c7['Agents'];});return db[_0x42f7('0x4d')]['find']({'where':{'id':_0x34f830[_0x42f7('0x54')]['id']}})[_0x42f7('0x2b')](function(_0x4df8ab){return db[_0x42f7('0x77')][_0x42f7('0x78')](function(_0x2b2f22){return _0x4df8ab[_0x42f7('0x71')](_0x320b7a,{'transaction':_0x2b2f22})[_0x42f7('0x2b')](function(){return BPromise[_0x42f7('0x79')](_0x436c98,function(_0x559155){return db[_0x42f7('0x7a')][_0x42f7('0x7b')]({'TeamId':_0x559155['id'],'VoiceQueueId':_0x34f830[_0x42f7('0x54')]['id'],'penalty':_0x559155['penalty']},{'transaction':_0x2b2f22});});})[_0x42f7('0x2b')](function(){return BPromise[_0x42f7('0x79')](_0x3e2423,function(_0x51cda2){return db[_0x42f7('0x7c')]['findOrCreate']({'where':{'UserId':_0x51cda2['id'],'VoiceQueueId':_0x34f830['params']['id']},'defaults':{'penalty':_0x51cda2['penalty']},'transaction':_0x2b2f22});});})[_0x42f7('0x2b')](function(){return BPromise['each'](_[_0x42f7('0x31')](_0x3e2423,{'online':!![]}),function(_0x54e689){return db[_0x42f7('0x7d')]['upsert']({'membername':_0x54e689[_0x42f7('0x38')],'UserId':_0x54e689['id'],'queue_name':_0x4df8ab[_0x42f7('0x38')],'VoiceQueueId':_0x4df8ab['id'],'interface':_['isNil'](_0x54e689[_0x42f7('0x7e')])?util[_0x42f7('0x7f')](_0x42f7('0x80'),_0x54e689[_0x42f7('0x38')]):_0x54e689[_0x42f7('0x7e')],'paused':_0x54e689['voicePause']||![],'penalty':_0x54e689[_0x42f7('0x76')]},{'transaction':_0x2b2f22});});})[_0x42f7('0x2b')](function(){_0x3e2423['forEach'](function(_0x892b3){socket['emit'](_0x42f7('0x81'),{'UserId':_0x892b3['id'],'VoiceQueueId':_0x4df8ab['id']});});});});});}})['then'](respondWithStatusCode(_0x171de4,null))[_0x42f7('0x5d')](handleError(_0x171de4,null));};exports[_0x42f7('0x82')]=function(_0x44ba54,_0x4e6759,_0x20beaa){return db[_0x42f7('0x70')][_0x42f7('0x51')]({'where':{'id':_0x44ba54['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x42f7('0x73')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x42f7('0x2b')](handleEntityNotFound(_0x4e6759,null))[_0x42f7('0x2b')](function(_0x2a7eb4){var _0x168dda=_['map'](_0x2a7eb4,'id');var _0x4a9298=[];var _0x5db4c8=[];var _0x7a616=squel[_0x42f7('0x83')]();_0x7a616[_0x42f7('0x84')](_0x42f7('0x85'))[_0x42f7('0x86')](_0x42f7('0x87'),'tq')[_0x42f7('0x88')](_0x42f7('0x89'),'ut',_0x42f7('0x8a'))['where']('VoiceQueueId\x20=\x20?',_0x44ba54[_0x42f7('0x54')]['id']);for(var _0x59d99d=0x0;_0x59d99d<_0x2a7eb4[_0x42f7('0x44')];_0x59d99d+=0x1){let _0x37bad3=_0x2a7eb4[_0x59d99d];for(var _0x294111=0x0;_0x294111<_0x37bad3['Agents'][_0x42f7('0x44')];_0x294111+=0x1){let _0x343e37=_0x37bad3[_0x42f7('0x74')][_0x294111];var _0x2fad01=_0x7a616['clone']();_0x2fad01[_0x42f7('0x48')](_0x42f7('0x8b'),_0x343e37['id']);_0x5db4c8[_0x42f7('0x8c')](db[_0x42f7('0x77')][_0x42f7('0x40')](_0x2fad01[_0x42f7('0x8d')](),{'type':db[_0x42f7('0x77')][_0x42f7('0x8e')][_0x42f7('0x8f')]})['then'](function(_0x1df25b){if(_0x1df25b['length']===0x1){return _0x343e37['id'];}else{var _0x275682=_[_0x42f7('0x90')](_[_0x42f7('0x33')](_0x1df25b,_0x42f7('0x91')),function(_0x3c695b){return _[_0x42f7('0x35')](_0x168dda,_0x3c695b);});if(_0x275682){return _0x343e37['id'];}}}));}}return BPromise['all'](_0x5db4c8)[_0x42f7('0x2b')](function(_0xed6746){_0x4a9298=_(_0x4a9298)[_0x42f7('0x92')](_0xed6746)[_0x42f7('0x93')]()['value']();return db['VoiceQueue'][_0x42f7('0x36')]({'where':{'id':_0x44ba54[_0x42f7('0x54')]['id']}})[_0x42f7('0x2b')](function(_0x3d8463){return db[_0x42f7('0x77')][_0x42f7('0x78')](function(_0x1f7146){return _0x3d8463[_0x42f7('0x82')](_0x44ba54[_0x42f7('0x40')][_0x42f7('0x94')],{'transaction':_0x1f7146})['then'](function(){if(!_[_0x42f7('0x95')](_0x4a9298)){return _0x3d8463[_0x42f7('0x96')](_0x4a9298,{'transaction':_0x1f7146})[_0x42f7('0x2b')](function(){return db[_0x42f7('0x7d')][_0x42f7('0x2c')]({'where':{'VoiceQueueId':_0x44ba54[_0x42f7('0x54')]['id'],'UserId':_0x4a9298},'transaction':_0x1f7146});});}})[_0x42f7('0x2b')](function(){_0x4a9298[_0x42f7('0x97')](function(_0x32e5e2){socket[_0x42f7('0x98')](_0x42f7('0x99'),{'UserId':_0x32e5e2,'VoiceQueueId':_0x3d8463['id']});});});});});});})[_0x42f7('0x2b')](respondWithStatusCode(_0x4e6759,null))[_0x42f7('0x5d')](handleError(_0x4e6759,null));};exports[_0x42f7('0x9a')]=function(_0x3ea21a,_0x1a7f60,_0x43db4c){var _0x3fb7f0,_0x1c6f12;return db['VoiceQueue'][_0x42f7('0x36')]({'where':{'id':_0x3ea21a[_0x42f7('0x54')]['id']}})[_0x42f7('0x2b')](handleEntityNotFound(_0x1a7f60,null))[_0x42f7('0x2b')](function(_0x4763da){if(_0x4763da){_0x1c6f12=_0x4763da;return _0x4763da[_0x42f7('0x9a')](_0x3ea21a[_0x42f7('0x57')]['ids'],_[_0x42f7('0x60')](_0x3ea21a[_0x42f7('0x57')],['ids','id'])||{})['spread'](function(_0x302583){for(var _0x54fc68=0x0;_0x54fc68<_0x3ea21a[_0x42f7('0x57')]['ids'][_0x42f7('0x44')];_0x54fc68+=0x1){socket[_0x42f7('0x98')](_0x42f7('0x81'),{'UserId':Number(_0x3ea21a[_0x42f7('0x57')][_0x42f7('0x94')][_0x54fc68]),'VoiceQueueId':Number(_0x3ea21a[_0x42f7('0x54')]['id'])});}return _0x302583;});}})[_0x42f7('0x2b')](function(_0x5c69d8){_0x3fb7f0=_0x5c69d8||[];if(_0x1c6f12){return db['User'][_0x42f7('0x51')]({'where':{'id':_0x3ea21a[_0x42f7('0x57')][_0x42f7('0x94')]},'attributes':['id',_0x42f7('0x38'),'online',_0x42f7('0x9b'),_0x42f7('0x7e')],'raw':!![]});}})['then'](function(_0x182c1b){if(!_[_0x42f7('0x95')](_0x182c1b)){var _0x43c310=[];for(var _0x11855e=0x0;_0x11855e<_0x182c1b[_0x42f7('0x44')];_0x11855e++){if(_0x182c1b[_0x11855e][_0x42f7('0x9c')]){_0x43c310[_0x42f7('0x8c')](db['UserVoiceQueueRt'][_0x42f7('0x7b')]({'membername':_0x182c1b[_0x11855e][_0x42f7('0x38')],'UserId':_0x182c1b[_0x11855e]['id'],'queue_name':_0x1c6f12[_0x42f7('0x38')],'VoiceQueueId':_0x1c6f12['id'],'interface':_[_0x42f7('0x9d')](_0x182c1b[_0x11855e][_0x42f7('0x7e')])?util[_0x42f7('0x7f')](_0x42f7('0x80'),_0x182c1b[_0x11855e][_0x42f7('0x38')]):_0x182c1b[_0x11855e][_0x42f7('0x7e')],'paused':_0x182c1b[_0x11855e][_0x42f7('0x9b')]||![],'penalty':_0x3ea21a[_0x42f7('0x57')]['penalty']||0x0}));}}return BPromise[_0x42f7('0x9e')](_0x43c310);}})[_0x42f7('0x2b')](function(){return _0x3fb7f0;})[_0x42f7('0x2b')](respondWithResult(_0x1a7f60,null))[_0x42f7('0x5d')](handleError(_0x1a7f60,null));};exports[_0x42f7('0x96')]=function(_0x53f3a6,_0x291f60,_0x85c766){return db[_0x42f7('0x4d')][_0x42f7('0x36')]({'where':{'id':_0x53f3a6[_0x42f7('0x54')]['id']}})['then'](handleEntityNotFound(_0x291f60,null))['then'](function(_0x4e919d){if(_0x4e919d){return _0x4e919d['removeAgents'](_0x53f3a6['query']['ids'])[_0x42f7('0x2b')](function(){if(_['isArray'](_0x53f3a6[_0x42f7('0x40')][_0x42f7('0x94')])){for(var _0x48a5dc=0x0;_0x48a5dc<_0x53f3a6[_0x42f7('0x40')][_0x42f7('0x94')][_0x42f7('0x44')];_0x48a5dc+=0x1){socket[_0x42f7('0x98')](_0x42f7('0x99'),{'UserId':Number(_0x53f3a6[_0x42f7('0x40')][_0x42f7('0x94')][_0x48a5dc]),'VoiceQueueId':Number(_0x53f3a6['params']['id'])});}}else{socket['emit'](_0x42f7('0x99'),{'UserId':Number(_0x53f3a6[_0x42f7('0x40')][_0x42f7('0x94')]),'VoiceQueueId':Number(_0x53f3a6['params']['id'])});}});}})[_0x42f7('0x2b')](function(_0x3f3225){return db['UserVoiceQueueRt'][_0x42f7('0x2c')]({'where':{'VoiceQueueId':_0x53f3a6[_0x42f7('0x54')]['id'],'UserId':_0x53f3a6[_0x42f7('0x40')][_0x42f7('0x94')]}})[_0x42f7('0x2b')](function(){return _0x3f3225;});})[_0x42f7('0x2b')](respondWithStatusCode(_0x291f60,null))['catch'](handleError(_0x291f60,null));};exports['getAgents']=function(_0x264531,_0x329158,_0x2d4a87){var _0x2c5605={};var _0x2e9368={};var _0x16e003;var _0x32c6fe;return db['VoiceQueue'][_0x42f7('0x65')]({'where':{'id':_0x264531[_0x42f7('0x54')]['id']}})[_0x42f7('0x2b')](handleEntityNotFound(_0x329158,null))['then'](function(_0x340233){if(_0x340233){_0x16e003=_0x340233;_0x2e9368[_0x42f7('0x3f')]=_[_0x42f7('0x55')](db['User']['rawAttributes']);_0x2e9368['query']=_[_0x42f7('0x55')](_0x264531[_0x42f7('0x40')]);_0x2e9368['filters']=_[_0x42f7('0x41')](_0x2e9368[_0x42f7('0x3f')],_0x2e9368[_0x42f7('0x40')]);_0x2c5605[_0x42f7('0x42')]=_[_0x42f7('0x41')](_0x2e9368[_0x42f7('0x3f')],qs['fields'](_0x264531[_0x42f7('0x40')][_0x42f7('0x43')]));_0x2c5605[_0x42f7('0x42')]=_0x2c5605[_0x42f7('0x42')][_0x42f7('0x44')]?_0x2c5605[_0x42f7('0x42')]:_0x2e9368[_0x42f7('0x3f')];_0x2c5605[_0x42f7('0x46')]=qs[_0x42f7('0x47')](_0x264531[_0x42f7('0x40')][_0x42f7('0x47')]);_0x2c5605[_0x42f7('0x48')]=qs[_0x42f7('0x49')](_[_0x42f7('0x68')](_0x264531[_0x42f7('0x40')],_0x2e9368[_0x42f7('0x49')]));if(_0x264531['query'][_0x42f7('0x31')]){_0x2c5605[_0x42f7('0x48')]=_[_0x42f7('0x4a')](_0x2c5605[_0x42f7('0x48')],{'$or':_[_0x42f7('0x33')](_0x2c5605[_0x42f7('0x42')],function(_0x3bdae7){var _0x5b73d6={};_0x5b73d6[_0x3bdae7]={'$like':'%'+_0x264531[_0x42f7('0x40')][_0x42f7('0x31')]+'%'};return _0x5b73d6;})});}_0x2c5605=_['merge']({},_0x2c5605,_0x264531[_0x42f7('0x4c')]);return _0x16e003[_0x42f7('0x9f')](_0x2c5605);}})[_0x42f7('0x2b')](function(_0x13d5dd){if(_0x13d5dd){_0x32c6fe=_0x13d5dd[_0x42f7('0x44')];if(!_0x264531[_0x42f7('0x40')]['hasOwnProperty'](_0x42f7('0x67'))){_0x2c5605[_0x42f7('0x24')]=qs[_0x42f7('0x24')](_0x264531[_0x42f7('0x40')][_0x42f7('0x24')]);_0x2c5605['offset']=qs[_0x42f7('0x22')](_0x264531['query'][_0x42f7('0x22')]);}return _0x16e003[_0x42f7('0x9f')](_0x2c5605);}})['then'](function(_0x330ac0){if(_0x330ac0){return _0x330ac0?{'count':_0x32c6fe,'rows':_0x330ac0}:null;}})[_0x42f7('0x2b')](respondWithResult(_0x329158,null))[_0x42f7('0x5d')](handleError(_0x329158,null));};exports[_0x42f7('0xa0')]=function(_0xf73960,_0x5ba5bd,_0x5316c6){var _0x3b2506={};var _0x4ed178={};var _0xb05ee7;var _0x15c005;return db['VoiceQueue']['findOne']({'where':{'id':_0xf73960[_0x42f7('0x54')]['id']}})['then'](handleEntityNotFound(_0x5ba5bd,null))['then'](function(_0x257707){if(_0x257707){_0xb05ee7=_0x257707;_0x4ed178[_0x42f7('0x3f')]=_[_0x42f7('0x55')](db[_0x42f7('0x7d')]['rawAttributes']);_0x4ed178['query']=_[_0x42f7('0x55')](_0xf73960[_0x42f7('0x40')]);_0x4ed178['filters']=_[_0x42f7('0x41')](_0x4ed178['model'],_0x4ed178['query']);_0x3b2506['attributes']=_[_0x42f7('0x41')](_0x4ed178[_0x42f7('0x3f')],qs[_0x42f7('0x43')](_0xf73960[_0x42f7('0x40')][_0x42f7('0x43')]));_0x3b2506[_0x42f7('0x42')]=_0x3b2506['attributes'][_0x42f7('0x44')]?_0x3b2506[_0x42f7('0x42')]:_0x4ed178['model'];_0x3b2506[_0x42f7('0x46')]=qs[_0x42f7('0x47')](_0xf73960['query']['sort']);_0x3b2506['where']=qs[_0x42f7('0x49')](_[_0x42f7('0x68')](_0xf73960['query'],_0x4ed178['filters']));if(_0xf73960[_0x42f7('0x40')]['filter']){_0x3b2506[_0x42f7('0x48')]=_['merge'](_0x3b2506[_0x42f7('0x48')],{'$or':_[_0x42f7('0x33')](_0x3b2506[_0x42f7('0x42')],function(_0xe8416d){var _0x4f56be={};_0x4f56be[_0xe8416d]={'$like':'%'+_0xf73960[_0x42f7('0x40')][_0x42f7('0x31')]+'%'};return _0x4f56be;})});}_0x3b2506=_[_0x42f7('0x4a')]({},_0x3b2506,_0xf73960[_0x42f7('0x4c')]);return _0xb05ee7['getMembers'](_0x3b2506);}})[_0x42f7('0x2b')](function(_0x2967c2){if(_0x2967c2){_0x15c005=_0x2967c2['length'];if(!_0xf73960['query'][_0x42f7('0x45')](_0x42f7('0x67'))){_0x3b2506[_0x42f7('0x24')]=qs[_0x42f7('0x24')](_0xf73960[_0x42f7('0x40')][_0x42f7('0x24')]);_0x3b2506[_0x42f7('0x22')]=qs[_0x42f7('0x22')](_0xf73960[_0x42f7('0x40')][_0x42f7('0x22')]);}return _0xb05ee7[_0x42f7('0xa0')](_0x3b2506);}})['then'](function(_0x3a66c0){return _0x3a66c0?{'count':_0x15c005,'rows':_0x3a66c0}:null;})[_0x42f7('0x2b')](respondWithResult(_0x5ba5bd,null))['catch'](handleError(_0x5ba5bd,null));};exports[_0x42f7('0xa1')]=function(_0x3149ae,_0x763032,_0x271a21){var _0x414474={};var _0x115d3c={};var _0x2ded65;var _0x214129;return db[_0x42f7('0x4d')][_0x42f7('0x65')]({'where':{'id':_0x3149ae[_0x42f7('0x54')]['id']}})[_0x42f7('0x2b')](handleEntityNotFound(_0x763032,null))[_0x42f7('0x2b')](function(_0xb39a9){if(_0xb39a9){_0x2ded65=_0xb39a9;_0x115d3c['model']=_['keys'](db[_0x42f7('0xa2')]['rawAttributes']);_0x115d3c['query']=_['keys'](_0x3149ae[_0x42f7('0x40')]);_0x115d3c[_0x42f7('0x49')]=_[_0x42f7('0x41')](_0x115d3c[_0x42f7('0x3f')],_0x115d3c[_0x42f7('0x40')]);_0x414474[_0x42f7('0x42')]=_[_0x42f7('0x41')](_0x115d3c[_0x42f7('0x3f')],qs['fields'](_0x3149ae[_0x42f7('0x40')]['fields']));_0x414474[_0x42f7('0x42')]=_0x414474[_0x42f7('0x42')][_0x42f7('0x44')]?_0x414474[_0x42f7('0x42')]:_0x115d3c[_0x42f7('0x3f')];_0x414474[_0x42f7('0x46')]=qs[_0x42f7('0x47')](_0x3149ae[_0x42f7('0x40')]['sort']);_0x414474[_0x42f7('0x48')]=qs['filters'](_[_0x42f7('0x68')](_0x3149ae[_0x42f7('0x40')],_0x115d3c[_0x42f7('0x49')]));if(_0x3149ae[_0x42f7('0x40')][_0x42f7('0x31')]){_0x414474[_0x42f7('0x48')]=_['merge'](_0x414474['where'],{'$or':_[_0x42f7('0x33')](_0x414474[_0x42f7('0x42')],function(_0x41255d){var _0xfaaa4a={};_0xfaaa4a[_0x41255d]={'$like':'%'+_0x3149ae[_0x42f7('0x40')][_0x42f7('0x31')]+'%'};return _0xfaaa4a;})});}_0x414474=_[_0x42f7('0x4a')]({},_0x414474,_0x3149ae[_0x42f7('0x4c')]);return _0x2ded65['getLists'](_0x414474);}})[_0x42f7('0x2b')](function(_0x413eb8){if(_0x413eb8){_0x214129=_0x413eb8[_0x42f7('0x44')];if(!_0x3149ae[_0x42f7('0x40')][_0x42f7('0x45')](_0x42f7('0x67'))){_0x414474[_0x42f7('0x24')]=qs[_0x42f7('0x24')](_0x3149ae[_0x42f7('0x40')][_0x42f7('0x24')]);_0x414474[_0x42f7('0x22')]=qs[_0x42f7('0x22')](_0x3149ae[_0x42f7('0x40')][_0x42f7('0x22')]);}return _0x2ded65[_0x42f7('0xa1')](_0x414474);}})[_0x42f7('0x2b')](function(_0x3fc830){if(_0x3fc830){return _0x3fc830?{'count':_0x214129,'rows':_0x3fc830}:null;}})[_0x42f7('0x2b')](respondWithResult(_0x763032,null))[_0x42f7('0x5d')](handleError(_0x763032,null));};exports[_0x42f7('0xa3')]=function(_0x4ca0dd,_0x29a4b3,_0x53a9ba){var _0x13585=moment()[_0x42f7('0x7f')](_0x42f7('0xa4'));var _0x2de619,_0x33b934;return db[_0x42f7('0x4d')][_0x42f7('0x36')]({'where':{'id':_0x4ca0dd[_0x42f7('0x54')]['id']}})[_0x42f7('0x2b')](handleEntityNotFound(_0x29a4b3,null))[_0x42f7('0x2b')](function(_0xe22c5e){if(_0xe22c5e){_0x33b934=_0xe22c5e;return _0xe22c5e[_0x42f7('0xa3')](_0x4ca0dd[_0x42f7('0x57')][_0x42f7('0x94')],_['omit'](_0x4ca0dd['body'],[_0x42f7('0x94'),'id'])||{});}return null;})[_0x42f7('0xa5')](function(_0x1c24f9){var _0x42e71c;_0x2de619=_0x1c24f9||[];var _0x2b7b23=[];if(_0x1c24f9){for(var _0x2e73c4=0x0;_0x2e73c4<_0x1c24f9['length'];_0x2e73c4+=0x1){var _0x2ee98f=_0x1c24f9[_0x2e73c4][_0x42f7('0x2d')]({'plain':!![]});_0x33b934['dialCheckDuplicateType']=_0x4ca0dd[_0x42f7('0x57')][_0x42f7('0xa6')]?_0x4ca0dd[_0x42f7('0x57')][_0x42f7('0xa6')]:_0x33b934[_0x42f7('0xa6')];switch(_0x33b934[_0x42f7('0xa6')]){case _0x42f7('0xa7'):_0x42e71c=squel[_0x42f7('0xa8')]()[_0x42f7('0xa9')](_0x42f7('0xaa'))[_0x42f7('0xab')]([_0x42f7('0xac'),'scheduledAt',_0x42f7('0xad'),_0x42f7('0xae'),_0x42f7('0x69'),'createdAt','updatedAt'],squel[_0x42f7('0x83')]()[_0x42f7('0x84')](_0x42f7('0xac'),_0x42f7('0xac'))[_0x42f7('0x84')]('\x27'+_0x13585+'\x27','scheduledAt')[_0x42f7('0x84')]('id','ContactId')['field'](_0x2ee98f[_0x42f7('0xaf')]['toString'](),_0x42f7('0xae'))[_0x42f7('0x84')](_0x4ca0dd[_0x42f7('0x54')]['id'][_0x42f7('0x8d')](),'VoiceQueueId')[_0x42f7('0x84')]('\x27'+_0x13585+'\x27',_0x42f7('0x5e'))[_0x42f7('0x84')]('\x27'+_0x13585+'\x27','updatedAt')[_0x42f7('0x86')](_0x42f7('0xb0'))[_0x42f7('0x48')](_0x42f7('0xb1'))['where'](_0x42f7('0xb2'),_0x2ee98f[_0x42f7('0xaf')]['toString']())['where'](_0x42f7('0xb3'))[_0x42f7('0x48')](_0x42f7('0xb4'),squel['select']()[_0x42f7('0x84')](_0x42f7('0xb5'))['from']('cm_hopper_final')[_0x42f7('0x48')](_0x42f7('0xb6'),_0x4ca0dd[_0x42f7('0x54')]['id'][_0x42f7('0x8d')]()))['where'](_0x42f7('0xb4'),squel[_0x42f7('0x83')]()[_0x42f7('0x84')](_0x42f7('0xb7'))[_0x42f7('0x86')]('cm_hopper')['where'](_0x42f7('0xb6'),_0x4ca0dd[_0x42f7('0x54')]['id'][_0x42f7('0x8d')]())))['toString']();break;case'onlyIfOpen':_0x42e71c=squel['insert']()['into']('cm_hopper')[_0x42f7('0xab')](['phone','scheduledAt',_0x42f7('0xad'),_0x42f7('0xae'),_0x42f7('0x69'),_0x42f7('0x5e'),_0x42f7('0x5f')],squel[_0x42f7('0x83')]()['field'](_0x42f7('0xac'),_0x42f7('0xac'))[_0x42f7('0x84')]('\x27'+_0x13585+'\x27','scheduledAt')[_0x42f7('0x84')]('id',_0x42f7('0xad'))['field'](_0x2ee98f[_0x42f7('0xaf')][_0x42f7('0x8d')](),_0x42f7('0xae'))[_0x42f7('0x84')](_0x4ca0dd[_0x42f7('0x54')]['id'][_0x42f7('0x8d')](),_0x42f7('0x69'))['field']('\x27'+_0x13585+'\x27','createdAt')[_0x42f7('0x84')]('\x27'+_0x13585+'\x27',_0x42f7('0x5f'))[_0x42f7('0x86')](_0x42f7('0xb0'))[_0x42f7('0x48')](_0x42f7('0xb1'))[_0x42f7('0x48')](_0x42f7('0xb2'),_0x2ee98f[_0x42f7('0xaf')][_0x42f7('0x8d')]())[_0x42f7('0x48')](_0x42f7('0xb3'))['where'](_0x42f7('0xb4'),squel[_0x42f7('0x83')]()['field'](_0x42f7('0xb7'))['from'](_0x42f7('0xaa'))[_0x42f7('0x48')]('VoiceQueueId\x20=\x20?',_0x4ca0dd[_0x42f7('0x54')]['id'][_0x42f7('0x8d')]())))[_0x42f7('0x8d')]();break;default:_0x42e71c=squel[_0x42f7('0xa8')]()[_0x42f7('0xa9')](_0x42f7('0xaa'))[_0x42f7('0xab')]([_0x42f7('0xac'),_0x42f7('0xb8'),'ContactId',_0x42f7('0xae'),'VoiceQueueId',_0x42f7('0x5e'),_0x42f7('0x5f')],squel[_0x42f7('0x83')]()[_0x42f7('0x84')](_0x42f7('0xac'),_0x42f7('0xac'))[_0x42f7('0x84')]('\x27'+_0x13585+'\x27','scheduledAt')['field']('id',_0x42f7('0xad'))['field'](_0x2ee98f['CmListId'][_0x42f7('0x8d')](),_0x42f7('0xae'))['field'](_0x4ca0dd[_0x42f7('0x54')]['id'][_0x42f7('0x8d')](),'VoiceQueueId')[_0x42f7('0x84')]('\x27'+_0x13585+'\x27','createdAt')[_0x42f7('0x84')]('\x27'+_0x13585+'\x27',_0x42f7('0x5f'))[_0x42f7('0x86')](_0x42f7('0xb0'))['where']('deletedAt\x20IS\x20NULL')[_0x42f7('0x48')](_0x42f7('0xb2'),_0x2ee98f[_0x42f7('0xaf')][_0x42f7('0x8d')]())[_0x42f7('0x48')](_0x42f7('0xb3')))[_0x42f7('0x8d')]();}_0x2b7b23[_0x42f7('0x8c')](db['sequelize'][_0x42f7('0x40')](_0x42e71c));}return BPromise[_0x42f7('0x9e')](_0x2b7b23);}})[_0x42f7('0x2b')](function(){var _0x54925a=[];var _0x3f0f27=squel[_0x42f7('0xa8')]()[_0x42f7('0xa9')](_0x42f7('0xb9'))[_0x42f7('0xab')]([_0x42f7('0xba'),_0x42f7('0xac'),'OrderBy',_0x42f7('0x5e'),_0x42f7('0x5f')],squel['select']()[_0x42f7('0x84')]('h.id')[_0x42f7('0x84')](_0x42f7('0xbb'))[_0x42f7('0x84')](_0x42f7('0xbc'))[_0x42f7('0x84')]('\x27'+_0x13585+'\x27',_0x42f7('0x5e'))[_0x42f7('0x84')]('\x27'+_0x13585+'\x27',_0x42f7('0x5f'))[_0x42f7('0x86')](_0x42f7('0xbd'),'ci')[_0x42f7('0x88')](_0x42f7('0xaa'),'h',_0x42f7('0xbe'))[_0x42f7('0x48')]('h.scheduledat=?',_0x13585)[_0x42f7('0x48')](_0x42f7('0xbf'),'PHONE'))[_0x42f7('0x8d')]();_0x54925a['push'](db[_0x42f7('0x77')]['query'](_0x3f0f27));return BPromise[_0x42f7('0x9e')](_0x54925a);})[_0x42f7('0x2b')](function(){return _0x2de619;})['then'](respondWithResult(_0x29a4b3,null))[_0x42f7('0x5d')](handleError(_0x29a4b3,null));};exports['removeLists']=function(_0x439e11,_0x2f778e,_0x2904f1){return db[_0x42f7('0x4d')][_0x42f7('0x36')]({'where':{'id':_0x439e11[_0x42f7('0x54')]['id']}})[_0x42f7('0x2b')](handleEntityNotFound(_0x2f778e,null))[_0x42f7('0x2b')](function(_0x2772ee){if(_0x2772ee){return _0x2772ee[_0x42f7('0xc0')](_0x439e11['query'][_0x42f7('0x94')]);}})[_0x42f7('0x2b')](function(_0x35cf4a){if(_0x35cf4a){return db[_0x42f7('0x66')][_0x42f7('0x2c')]({'where':{'ListId':_0x439e11[_0x42f7('0x40')][_0x42f7('0x94')],'VoiceQueueId':_0x439e11[_0x42f7('0x54')]['id']}})[_0x42f7('0x2b')](function(){return _0x35cf4a;});}})['then'](respondWithStatusCode(_0x2f778e,null))[_0x42f7('0x5d')](handleError(_0x2f778e,null));};exports['getBlackLists']=function(_0x3d80bf,_0x98adc6,_0x571133){var _0x30c6d6={};var _0x4cb927={};var _0x564f41;var _0x4e103c;return db[_0x42f7('0x4d')][_0x42f7('0x65')]({'where':{'id':_0x3d80bf['params']['id']}})[_0x42f7('0x2b')](handleEntityNotFound(_0x98adc6,null))[_0x42f7('0x2b')](function(_0x21ca4d){if(_0x21ca4d){_0x564f41=_0x21ca4d;_0x4cb927[_0x42f7('0x3f')]=_['keys'](db['CmList'][_0x42f7('0x3e')]);_0x4cb927[_0x42f7('0x40')]=_[_0x42f7('0x55')](_0x3d80bf[_0x42f7('0x40')]);_0x4cb927[_0x42f7('0x49')]=_['intersection'](_0x4cb927[_0x42f7('0x3f')],_0x4cb927[_0x42f7('0x40')]);_0x30c6d6[_0x42f7('0x42')]=_[_0x42f7('0x41')](_0x4cb927[_0x42f7('0x3f')],qs[_0x42f7('0x43')](_0x3d80bf[_0x42f7('0x40')]['fields']));_0x30c6d6['attributes']=_0x30c6d6['attributes'][_0x42f7('0x44')]?_0x30c6d6[_0x42f7('0x42')]:_0x4cb927['model'];_0x30c6d6[_0x42f7('0x46')]=qs[_0x42f7('0x47')](_0x3d80bf[_0x42f7('0x40')][_0x42f7('0x47')]);_0x30c6d6[_0x42f7('0x48')]=qs[_0x42f7('0x49')](_[_0x42f7('0x68')](_0x3d80bf[_0x42f7('0x40')],_0x4cb927[_0x42f7('0x49')]));if(_0x3d80bf['query'][_0x42f7('0x31')]){_0x30c6d6[_0x42f7('0x48')]=_['merge'](_0x30c6d6[_0x42f7('0x48')],{'$or':_[_0x42f7('0x33')](_0x30c6d6[_0x42f7('0x42')],function(_0x55ab64){var _0x1d14ec={};_0x1d14ec[_0x55ab64]={'$like':'%'+_0x3d80bf[_0x42f7('0x40')][_0x42f7('0x31')]+'%'};return _0x1d14ec;})});}_0x30c6d6=_[_0x42f7('0x4a')]({},_0x30c6d6,_0x3d80bf[_0x42f7('0x4c')]);return _0x564f41[_0x42f7('0xc1')](_0x30c6d6);}})['then'](function(_0x2baea9){if(_0x2baea9){_0x4e103c=_0x2baea9['length'];if(!_0x3d80bf[_0x42f7('0x40')][_0x42f7('0x45')]('nolimit')){_0x30c6d6[_0x42f7('0x24')]=qs[_0x42f7('0x24')](_0x3d80bf[_0x42f7('0x40')][_0x42f7('0x24')]);_0x30c6d6[_0x42f7('0x22')]=qs[_0x42f7('0x22')](_0x3d80bf[_0x42f7('0x40')][_0x42f7('0x22')]);}return _0x564f41['getBlackLists'](_0x30c6d6);}})[_0x42f7('0x2b')](function(_0x31bf50){if(_0x31bf50){return _0x31bf50?{'count':_0x4e103c,'rows':_0x31bf50}:null;}})[_0x42f7('0x2b')](respondWithResult(_0x98adc6,null))['catch'](handleError(_0x98adc6,null));};exports[_0x42f7('0xc2')]=function(_0x51ab2e,_0x518a22,_0x248d05){var _0x5dbaa8,_0x376d38;return db[_0x42f7('0x4d')][_0x42f7('0x36')]({'where':{'id':_0x51ab2e['params']['id']}})[_0x42f7('0x2b')](handleEntityNotFound(_0x518a22,null))['then'](function(_0x3f27db){if(_0x3f27db){_0x376d38=_0x3f27db;return _0x3f27db['addBlackLists'](_0x51ab2e[_0x42f7('0x57')][_0x42f7('0x94')],_['omit'](_0x51ab2e['body'],[_0x42f7('0x94'),'id'])||{});}return null;})['spread'](function(_0x1f5847){var _0x323b1f;_0x5dbaa8=_0x1f5847||[];var _0x27a97d=[];if(_0x1f5847){for(var _0x55e883=0x0;_0x55e883<_0x1f5847[_0x42f7('0x44')];_0x55e883+=0x1){var _0x286b68=_0x1f5847[_0x55e883][_0x42f7('0x2d')]({'plain':!![]});_0x323b1f=squel[_0x42f7('0xa8')]()[_0x42f7('0xa9')]('cm_hopper_black')['fromQuery']([_0x42f7('0xac'),'ContactId',_0x42f7('0xae'),_0x42f7('0x69'),'createdAt',_0x42f7('0x5f')],squel[_0x42f7('0x83')]()[_0x42f7('0x84')](_0x42f7('0xac'),_0x42f7('0xac'))[_0x42f7('0x84')]('id',_0x42f7('0xad'))[_0x42f7('0x84')](_0x286b68[_0x42f7('0xaf')]['toString'](),_0x42f7('0xae'))[_0x42f7('0x84')](_0x51ab2e[_0x42f7('0x54')]['id']['toString'](),_0x42f7('0x69'))['field'](_0x42f7('0xc3'),_0x42f7('0x5e'))[_0x42f7('0x84')]('NOW()',_0x42f7('0x5f'))['from'](_0x42f7('0xb0'))['where'](_0x42f7('0xb1'))[_0x42f7('0x48')](_0x42f7('0xb2'),_0x286b68['CmListId']['toString']())[_0x42f7('0x48')]('phone\x20IS\x20NOT\x20NULL'))[_0x42f7('0x8d')]();_0x27a97d[_0x42f7('0x8c')](db['sequelize'][_0x42f7('0x40')](_0x323b1f));}return BPromise[_0x42f7('0x9e')](_0x27a97d);}})[_0x42f7('0x2b')](function(){return _0x5dbaa8;})[_0x42f7('0x2b')](respondWithResult(_0x518a22,null))['catch'](handleError(_0x518a22,null));};exports[_0x42f7('0xc4')]=function(_0x4f3e9b,_0x8b7f77,_0x28966e){return db['VoiceQueue']['find']({'where':{'id':_0x4f3e9b[_0x42f7('0x54')]['id']}})[_0x42f7('0x2b')](handleEntityNotFound(_0x8b7f77,null))['then'](function(_0x50f892){if(_0x50f892){return _0x50f892[_0x42f7('0xc4')](_0x4f3e9b[_0x42f7('0x40')][_0x42f7('0x94')]);}})[_0x42f7('0x2b')](function(_0x192dc2){if(_0x192dc2){return db['CmHopperBlack'][_0x42f7('0x2c')]({'where':{'ListId':_0x4f3e9b['query'][_0x42f7('0x94')],'VoiceQueueId':_0x4f3e9b['params']['id']}})[_0x42f7('0x2b')](function(){return _0x192dc2;});}})[_0x42f7('0x2b')](respondWithStatusCode(_0x8b7f77,null))[_0x42f7('0x5d')](handleError(_0x8b7f77,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 6925b82..0a4e142 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 _0xe020=['save','update','emit','hasOwnProperty','hook'];(function(_0x4fa4ae,_0xb9fdb1){var _0x2da45f=function(_0x2f1094){while(--_0x2f1094){_0x4fa4ae['push'](_0x4fa4ae['shift']());}};_0x2da45f(++_0xb9fdb1);}(_0xe020,0xf5));var _0x0e02=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xe020[_0x4a53d];return _0x27410e;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0e02('0x0'),'afterUpdate':_0x0e02('0x1'),'afterDestroy':'remove'};function emitEvent(_0x59c37b){return function(_0x28b9cc,_0x34df9a,_0xb48047){VoiceQueueEvents[_0x0e02('0x2')](_0x59c37b+':'+_0x28b9cc['id'],_0x28b9cc);VoiceQueueEvents[_0x0e02('0x2')](_0x59c37b,_0x28b9cc);_0xb48047(null);};}for(var e in events){if(events[_0x0e02('0x3')](e)){var event=events[e];VoiceQueue[_0x0e02('0x4')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xe3fd=['VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3378ed,_0xda25dd){var _0x5723e4=function(_0x24b02d){while(--_0x24b02d){_0x3378ed['push'](_0x3378ed['shift']());}};_0x5723e4(++_0xda25dd);}(_0xe3fd,0x148));var _0xde3f=function(_0x29ac89,_0x22aa72){_0x29ac89=_0x29ac89-0x0;var _0x324fe5=_0xe3fd[_0x29ac89];return _0x324fe5;};'use strict';var EventEmitter=require(_0xde3f('0x0'));var VoiceQueue=require(_0xde3f('0x1'))['db'][_0xde3f('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xde3f('0x3')](0x0);var events={'afterCreate':_0xde3f('0x4'),'afterUpdate':_0xde3f('0x5'),'afterDestroy':_0xde3f('0x6')};function emitEvent(_0x2b3345){return function(_0x2924af,_0x5786a2,_0xab128e){VoiceQueueEvents[_0xde3f('0x7')](_0x2b3345+':'+_0x2924af['id'],_0x2924af);VoiceQueueEvents['emit'](_0x2b3345,_0x2924af);_0xab128e(null);};}for(var e in events){if(events[_0xde3f('0x8')](e)){var event=events[e];VoiceQueue[_0xde3f('0x9')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 0424e31..fca92f5 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x3af90d,_0x5aeac8){var _0x5b7e3e=function(_0x2c6739){while(--_0x2c6739){_0x3af90d['push'](_0x3af90d['shift']());}};_0x5b7e3e(++_0x5aeac8);}(_0x34e8,0x12c));var _0x834e=function(_0x18063c,_0x20977d){_0x18063c=_0x18063c-0x0;var _0x4906a5=_0x34e8[_0x18063c];return _0x4906a5;};'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 _0x55ca=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x16a637,_0x5eb627){var _0x25126d=function(_0x54e016){while(--_0x54e016){_0x16a637['push'](_0x16a637['shift']());}};_0x25126d(++_0x5eb627);}(_0x55ca,0x126));var _0xa55c=function(_0x5b445b,_0xd251da){_0x5b445b=_0x5b445b-0x0;var _0x1a40fe=_0x55ca[_0x5b445b];return _0x1a40fe;};'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 9202857..0184c00 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 _0xb44c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','where','limit','map','include','model','attributes','ShowVoiceQueue','find','then','util'];(function(_0x2b7df8,_0x44e8de){var _0x1ff869=function(_0x15cdf0){while(--_0x15cdf0){_0x2b7df8['push'](_0x2b7df8['shift']());}};_0x1ff869(++_0x44e8de);}(_0xb44c,0x1eb));var _0xcb44=function(_0x24392f,_0x15a3e5){_0x24392f=_0x24392f-0x0;var _0x591e33=_0xb44c[_0x24392f];return _0x591e33;};'use strict';var _=require('lodash');var util=require(_0xcb44('0x0'));var moment=require(_0xcb44('0x1'));var BPromise=require(_0xcb44('0x2'));var rs=require(_0xcb44('0x3'));var fs=require('fs');var Redis=require(_0xcb44('0x4'));var db=require(_0xcb44('0x5'))['db'];var utils=require(_0xcb44('0x6'));var logger=require('../../config/logger')(_0xcb44('0x7'));var config=require('../../config/environment');var jayson=require(_0xcb44('0x8'));var client=jayson[_0xcb44('0x9')][_0xcb44('0xa')]({'port':0x232a});config['redis']=_[_0xcb44('0xb')](config['redis'],{'host':_0xcb44('0xc'),'port':0x18eb});var socket=require(_0xcb44('0xd'))(new Redis(config['redis']));require(_0xcb44('0xe'))[_0xcb44('0xf')](socket);function respondWithRpcPromise(_0x4ea782,_0x29ba22,_0x2cab2d){return new BPromise(function(_0x267262,_0x2c23e7){return client[_0xcb44('0x10')](_0x4ea782,_0x2cab2d)['then'](function(_0x1503cb){logger['info'](_0xcb44('0x11'),_0x29ba22,'request\x20sent');logger[_0xcb44('0x12')](_0xcb44('0x13'),_0x29ba22,_0xcb44('0x14'),JSON[_0xcb44('0x15')](_0x1503cb));if(_0x1503cb[_0xcb44('0x16')]){if(_0x1503cb[_0xcb44('0x16')][_0xcb44('0x17')]===0x1f4){logger['error'](_0xcb44('0x11'),_0x29ba22,_0x1503cb[_0xcb44('0x16')][_0xcb44('0x18')]);return _0x2c23e7(_0x1503cb['error'][_0xcb44('0x18')]);}logger['error'](_0xcb44('0x11'),_0x29ba22,_0x1503cb['error'][_0xcb44('0x18')]);return _0x267262(_0x1503cb['error'][_0xcb44('0x18')]);}else{logger[_0xcb44('0x19')](_0xcb44('0x11'),_0x29ba22,_0xcb44('0x14'));_0x267262(_0x1503cb[_0xcb44('0x1a')]['message']);}})[_0xcb44('0x1b')](function(_0x118ecb){logger['error'](_0xcb44('0x11'),_0x29ba22,_0x118ecb);_0x2c23e7(_0x118ecb);});});}exports[_0xcb44('0x1c')]=function(_0x4b03f1){var _0x45f1b8=this;return new Promise(function(_0x3e6c16,_0x5483c6){return db[_0xcb44('0x1d')][_0xcb44('0x1e')]({'raw':_0x4b03f1[_0xcb44('0x1f')]?_0x4b03f1['options']['raw']===undefined?!![]:![]:!![],'where':_0x4b03f1[_0xcb44('0x1f')]?_0x4b03f1[_0xcb44('0x1f')][_0xcb44('0x20')]||null:null,'attributes':_0x4b03f1['options']?_0x4b03f1[_0xcb44('0x1f')]['attributes']||null:null,'limit':_0x4b03f1[_0xcb44('0x1f')]?_0x4b03f1['options'][_0xcb44('0x21')]||null:null,'include':_0x4b03f1[_0xcb44('0x1f')]?_0x4b03f1['options']['include']?_[_0xcb44('0x22')](_0x4b03f1[_0xcb44('0x1f')][_0xcb44('0x23')],function(_0x134051){return{'model':db[_0x134051[_0xcb44('0x24')]],'as':_0x134051['as'],'attributes':_0x134051[_0xcb44('0x25')],'include':_0x134051[_0xcb44('0x23')]?_[_0xcb44('0x22')](_0x134051[_0xcb44('0x23')],function(_0x5a9988){return{'model':db[_0x5a9988[_0xcb44('0x24')]],'as':_0x5a9988['as'],'attributes':_0x5a9988[_0xcb44('0x25')],'include':_0x5a9988[_0xcb44('0x23')]?_[_0xcb44('0x22')](_0x5a9988[_0xcb44('0x23')],function(_0x26d38b){return{'model':db[_0x26d38b['model']],'as':_0x26d38b['as'],'attributes':_0x26d38b[_0xcb44('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2dc40b){logger[_0xcb44('0x19')]('GetVoiceQueue',_0x4b03f1);logger['debug']('GetVoiceQueue',_0x4b03f1,JSON[_0xcb44('0x15')](_0x2dc40b));_0x3e6c16(_0x2dc40b);})['catch'](function(_0x4c144c){logger['error'](_0xcb44('0x1c'),_0x4c144c[_0xcb44('0x18')],_0x4b03f1);_0x5483c6(_0x45f1b8[_0xcb44('0x16')](0x1f4,_0x4c144c[_0xcb44('0x18')]));});});};exports[_0xcb44('0x26')]=function(_0x659320){var _0x3cbfdc=this;return new Promise(function(_0x5e6b4b,_0x53ea8d){return db[_0xcb44('0x1d')][_0xcb44('0x27')]({'raw':_0x659320[_0xcb44('0x1f')]?_0x659320[_0xcb44('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x659320['options']?_0x659320[_0xcb44('0x1f')][_0xcb44('0x20')]||null:null,'attributes':_0x659320['options']?_0x659320[_0xcb44('0x1f')][_0xcb44('0x25')]||null:null,'include':_0x659320[_0xcb44('0x1f')]?_0x659320[_0xcb44('0x1f')][_0xcb44('0x23')]?_[_0xcb44('0x22')](_0x659320[_0xcb44('0x1f')]['include'],function(_0xc072b9){return{'model':db[_0xc072b9[_0xcb44('0x24')]],'as':_0xc072b9['as'],'attributes':_0xc072b9[_0xcb44('0x25')],'include':_0xc072b9[_0xcb44('0x23')]?_[_0xcb44('0x22')](_0xc072b9[_0xcb44('0x23')],function(_0x31c929){return{'model':db[_0x31c929[_0xcb44('0x24')]],'as':_0x31c929['as'],'attributes':_0x31c929['attributes'],'include':_0x31c929[_0xcb44('0x23')]?_[_0xcb44('0x22')](_0x31c929[_0xcb44('0x23')],function(_0x461831){return{'model':db[_0x461831[_0xcb44('0x24')]],'as':_0x461831['as'],'attributes':_0x461831[_0xcb44('0x25')]};}):[]};}):[]};}):[]:[]})[_0xcb44('0x28')](function(_0xbfe0ce){logger[_0xcb44('0x19')](_0xcb44('0x26'),_0x659320);logger['debug'](_0xcb44('0x26'),_0x659320,JSON['stringify'](_0xbfe0ce));_0x5e6b4b(_0xbfe0ce);})[_0xcb44('0x1b')](function(_0x1d1006){logger[_0xcb44('0x16')](_0xcb44('0x26'),_0x1d1006[_0xcb44('0x18')],_0x659320);_0x53ea8d(_0x3cbfdc[_0xcb44('0x16')](0x1f4,_0x1d1006[_0xcb44('0x18')]));});});}; \ No newline at end of file +var _0xca84=['limit','map','include','model','then','catch','find','ShowVoiceQueue','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./voiceQueue.socket','register','request','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes'];(function(_0x225474,_0x4078d1){var _0x39fa90=function(_0x30ca66){while(--_0x30ca66){_0x225474['push'](_0x225474['shift']());}};_0x39fa90(++_0x4078d1);}(_0xca84,0x15e));var _0x4ca8=function(_0xa7163a,_0x25b4df){_0xa7163a=_0xa7163a-0x0;var _0x2b68b7=_0xca84[_0xa7163a];return _0x2b68b7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4ca8('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ca8('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x4ca8('0x2'));var logger=require(_0x4ca8('0x3'))(_0x4ca8('0x4'));var config=require(_0x4ca8('0x5'));var jayson=require(_0x4ca8('0x6'));var client=jayson[_0x4ca8('0x7')][_0x4ca8('0x8')]({'port':0x232a});config['redis']=_[_0x4ca8('0x9')](config[_0x4ca8('0xa')],{'host':_0x4ca8('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4ca8('0xc'))[_0x4ca8('0xd')](socket);function respondWithRpcPromise(_0xd21980,_0x27afe0,_0x627f9a){return new BPromise(function(_0x244322,_0x17115f){return client[_0x4ca8('0xe')](_0xd21980,_0x627f9a)['then'](function(_0x41a227){logger['info'](_0x4ca8('0xf'),_0x27afe0,_0x4ca8('0x10'));logger[_0x4ca8('0x11')](_0x4ca8('0x12'),_0x27afe0,'request\x20sent',JSON[_0x4ca8('0x13')](_0x41a227));if(_0x41a227[_0x4ca8('0x14')]){if(_0x41a227[_0x4ca8('0x14')]['code']===0x1f4){logger[_0x4ca8('0x14')](_0x4ca8('0xf'),_0x27afe0,_0x41a227[_0x4ca8('0x14')][_0x4ca8('0x15')]);return _0x17115f(_0x41a227['error'][_0x4ca8('0x15')]);}logger[_0x4ca8('0x14')](_0x4ca8('0xf'),_0x27afe0,_0x41a227[_0x4ca8('0x14')][_0x4ca8('0x15')]);return _0x244322(_0x41a227[_0x4ca8('0x14')][_0x4ca8('0x15')]);}else{logger[_0x4ca8('0x16')](_0x4ca8('0xf'),_0x27afe0,_0x4ca8('0x10'));_0x244322(_0x41a227['result'][_0x4ca8('0x15')]);}})['catch'](function(_0x3b00bd){logger['error'](_0x4ca8('0xf'),_0x27afe0,_0x3b00bd);_0x17115f(_0x3b00bd);});});}exports[_0x4ca8('0x17')]=function(_0x3038da){var _0x39edb3=this;return new Promise(function(_0x2ba6cc,_0x3e3b85){return db[_0x4ca8('0x18')][_0x4ca8('0x19')]({'raw':_0x3038da[_0x4ca8('0x1a')]?_0x3038da[_0x4ca8('0x1a')][_0x4ca8('0x1b')]===undefined?!![]:![]:!![],'where':_0x3038da[_0x4ca8('0x1a')]?_0x3038da[_0x4ca8('0x1a')][_0x4ca8('0x1c')]||null:null,'attributes':_0x3038da['options']?_0x3038da[_0x4ca8('0x1a')][_0x4ca8('0x1d')]||null:null,'limit':_0x3038da[_0x4ca8('0x1a')]?_0x3038da[_0x4ca8('0x1a')][_0x4ca8('0x1e')]||null:null,'include':_0x3038da[_0x4ca8('0x1a')]?_0x3038da[_0x4ca8('0x1a')]['include']?_[_0x4ca8('0x1f')](_0x3038da[_0x4ca8('0x1a')][_0x4ca8('0x20')],function(_0x2c5abc){return{'model':db[_0x2c5abc[_0x4ca8('0x21')]],'as':_0x2c5abc['as'],'attributes':_0x2c5abc[_0x4ca8('0x1d')],'include':_0x2c5abc['include']?_['map'](_0x2c5abc['include'],function(_0x231f47){return{'model':db[_0x231f47[_0x4ca8('0x21')]],'as':_0x231f47['as'],'attributes':_0x231f47[_0x4ca8('0x1d')],'include':_0x231f47['include']?_[_0x4ca8('0x1f')](_0x231f47[_0x4ca8('0x20')],function(_0x160f0b){return{'model':db[_0x160f0b[_0x4ca8('0x21')]],'as':_0x160f0b['as'],'attributes':_0x160f0b[_0x4ca8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4ca8('0x22')](function(_0x47beca){logger[_0x4ca8('0x16')](_0x4ca8('0x17'),_0x3038da);logger[_0x4ca8('0x11')](_0x4ca8('0x17'),_0x3038da,JSON[_0x4ca8('0x13')](_0x47beca));_0x2ba6cc(_0x47beca);})[_0x4ca8('0x23')](function(_0xb136c3){logger[_0x4ca8('0x14')](_0x4ca8('0x17'),_0xb136c3[_0x4ca8('0x15')],_0x3038da);_0x3e3b85(_0x39edb3[_0x4ca8('0x14')](0x1f4,_0xb136c3['message']));});});};exports['ShowVoiceQueue']=function(_0x3a180d){var _0x3b287f=this;return new Promise(function(_0x106b2e,_0x40c902){return db[_0x4ca8('0x18')][_0x4ca8('0x24')]({'raw':_0x3a180d[_0x4ca8('0x1a')]?_0x3a180d['options']['raw']===undefined?!![]:![]:!![],'where':_0x3a180d[_0x4ca8('0x1a')]?_0x3a180d[_0x4ca8('0x1a')][_0x4ca8('0x1c')]||null:null,'attributes':_0x3a180d[_0x4ca8('0x1a')]?_0x3a180d[_0x4ca8('0x1a')][_0x4ca8('0x1d')]||null:null,'include':_0x3a180d['options']?_0x3a180d['options'][_0x4ca8('0x20')]?_[_0x4ca8('0x1f')](_0x3a180d[_0x4ca8('0x1a')][_0x4ca8('0x20')],function(_0x10e007){return{'model':db[_0x10e007[_0x4ca8('0x21')]],'as':_0x10e007['as'],'attributes':_0x10e007[_0x4ca8('0x1d')],'include':_0x10e007['include']?_[_0x4ca8('0x1f')](_0x10e007[_0x4ca8('0x20')],function(_0x35ec1d){return{'model':db[_0x35ec1d[_0x4ca8('0x21')]],'as':_0x35ec1d['as'],'attributes':_0x35ec1d['attributes'],'include':_0x35ec1d[_0x4ca8('0x20')]?_[_0x4ca8('0x1f')](_0x35ec1d['include'],function(_0x5eaab9){return{'model':db[_0x5eaab9[_0x4ca8('0x21')]],'as':_0x5eaab9['as'],'attributes':_0x5eaab9[_0x4ca8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4ca8('0x22')](function(_0x3eda00){logger[_0x4ca8('0x16')](_0x4ca8('0x25'),_0x3a180d);logger[_0x4ca8('0x11')](_0x4ca8('0x25'),_0x3a180d,JSON['stringify'](_0x3eda00));_0x106b2e(_0x3eda00);})['catch'](function(_0x15092b){logger['error'](_0x4ca8('0x25'),_0x15092b['message'],_0x3a180d);_0x40c902(_0x3b287f[_0x4ca8('0x14')](0x1f4,_0x15092b['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index ce77bb1..94b049e 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 _0xaa9b=['voiceQueue:','./voiceQueue.events','save','remove','removeListener','register','length'];(function(_0x2a0812,_0x256c48){var _0x237a38=function(_0x4f0859){while(--_0x4f0859){_0x2a0812['push'](_0x2a0812['shift']());}};_0x237a38(++_0x256c48);}(_0xaa9b,0x9b));var _0xbaa9=function(_0x58d9b0,_0xbd5219){_0x58d9b0=_0x58d9b0-0x0;var _0x31449b=_0xaa9b[_0x58d9b0];return _0x31449b;};'use strict';var VoiceQueueEvents=require(_0xbaa9('0x0'));var events=[_0xbaa9('0x1'),_0xbaa9('0x2'),'update'];function createListener(_0x2ca32b,_0x53db2d){return function(_0x2afd1a){_0x53db2d['emit'](_0x2ca32b,_0x2afd1a);};}function removeListener(_0xcab025,_0x21bf47){return function(){VoiceQueueEvents[_0xbaa9('0x3')](_0xcab025,_0x21bf47);};}exports[_0xbaa9('0x4')]=function(_0x2b3bc6){for(var _0x3870fe=0x0,_0x36e062=events[_0xbaa9('0x5')];_0x3870fe<_0x36e062;_0x3870fe++){var _0x253833=events[_0x3870fe];var _0x17457d=createListener(_0xbaa9('0x6')+_0x253833,_0x2b3bc6);VoiceQueueEvents['on'](_0x253833,_0x17457d);}}; \ No newline at end of file +var _0xe61b=['voiceQueue:','save','remove','update','emit','register'];(function(_0x47b54f,_0x4e9374){var _0xb5a44c=function(_0x4b97fa){while(--_0x4b97fa){_0x47b54f['push'](_0x47b54f['shift']());}};_0xb5a44c(++_0x4e9374);}(_0xe61b,0x103));var _0xbe61=function(_0x30182f,_0x30ce41){_0x30182f=_0x30182f-0x0;var _0x5207db=_0xe61b[_0x30182f];return _0x5207db;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xbe61('0x0'),_0xbe61('0x1'),_0xbe61('0x2')];function createListener(_0xeb21bd,_0x5f1dce){return function(_0x19298b){_0x5f1dce[_0xbe61('0x3')](_0xeb21bd,_0x19298b);};}function removeListener(_0x2e7f54,_0x451de4){return function(){VoiceQueueEvents['removeListener'](_0x2e7f54,_0x451de4);};}exports[_0xbe61('0x4')]=function(_0x40ff61){for(var _0x448cb6=0x0,_0x4434e6=events['length'];_0x448cb6<_0x4434e6;_0x448cb6++){var _0x95553c=events[_0x448cb6];var _0x2e0136=createListener(_0xbe61('0x5')+_0x95553c,_0x40ff61);VoiceQueueEvents['on'](_0x95553c,_0x2e0136);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 93eb98a..750f16a 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 _0x2420=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','/index','getVoiceQueuesReport','/:id','post','create','update','delete','util','path','connect-timeout','Router'];(function(_0x571852,_0x34ae1f){var _0x1ec365=function(_0x398fe5){while(--_0x398fe5){_0x571852['push'](_0x571852['shift']());}};_0x1ec365(++_0x34ae1f);}(_0x2420,0xd8));var _0x0242=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x2420[_0x29b609];return _0x54c952;};'use strict';var multer=require('multer');var util=require(_0x0242('0x0'));var path=require(_0x0242('0x1'));var timeout=require(_0x0242('0x2'));var express=require('express');var router=express[_0x0242('0x3')]();var fs_extra=require(_0x0242('0x4'));var auth=require(_0x0242('0x5'));var interaction=require(_0x0242('0x6'));var config=require(_0x0242('0x7'));var controller=require(_0x0242('0x8'));router[_0x0242('0x9')]('/',auth[_0x0242('0xa')](),controller['index']);router[_0x0242('0x9')](_0x0242('0xb'),auth[_0x0242('0xa')](),controller[_0x0242('0xc')]);router['get'](_0x0242('0xd'),auth[_0x0242('0xa')](),controller[_0x0242('0xe')]);router[_0x0242('0x9')](_0x0242('0xf'),auth[_0x0242('0xa')](),controller['show']);router[_0x0242('0x10')]('/',auth[_0x0242('0xa')](),controller[_0x0242('0x11')]);router['put'](_0x0242('0xf'),auth['isAuthenticated'](),controller[_0x0242('0x12')]);router[_0x0242('0x13')](_0x0242('0xf'),auth[_0x0242('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa30f=['/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/index','getVoiceQueuesReport'];(function(_0x52dace,_0x530aa7){var _0x4e43b6=function(_0x40aa29){while(--_0x40aa29){_0x52dace['push'](_0x52dace['shift']());}};_0x4e43b6(++_0x530aa7);}(_0xa30f,0xb8));var _0xfa30=function(_0xb2ddf9,_0x338dc1){_0xb2ddf9=_0xb2ddf9-0x0;var _0x13bab0=_0xa30f[_0xb2ddf9];return _0x13bab0;};'use strict';var multer=require(_0xfa30('0x0'));var util=require('util');var path=require(_0xfa30('0x1'));var timeout=require(_0xfa30('0x2'));var express=require(_0xfa30('0x3'));var router=express[_0xfa30('0x4')]();var fs_extra=require(_0xfa30('0x5'));var auth=require(_0xfa30('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfa30('0x7'));var controller=require('./voiceQueueReport.controller');router[_0xfa30('0x8')]('/',auth[_0xfa30('0x9')](),controller[_0xfa30('0xa')]);router[_0xfa30('0x8')](_0xfa30('0xb'),auth[_0xfa30('0x9')](),controller['describe']);router[_0xfa30('0x8')](_0xfa30('0xc'),auth[_0xfa30('0x9')](),controller[_0xfa30('0xd')]);router['get'](_0xfa30('0xe'),auth['isAuthenticated'](),controller[_0xfa30('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfa30('0x10')]);router[_0xfa30('0x11')](_0xfa30('0xe'),auth[_0xfa30('0x9')](),controller[_0xfa30('0x12')]);router[_0xfa30('0x13')](_0xfa30('0xe'),auth[_0xfa30('0x9')](),controller[_0xfa30('0x14')]);module[_0xfa30('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 383f02a..a3f9d9a 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 _0xcb7a=['DATE','queuecallerjoinAt','diff','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING'];(function(_0xadcc74,_0x170b20){var _0x26fc35=function(_0x24879e){while(--_0x24879e){_0xadcc74['push'](_0xadcc74['shift']());}};_0x26fc35(++_0x170b20);}(_0xcb7a,0xc3));var _0xacb7=function(_0x50af48,_0x246be9){_0x50af48=_0x50af48-0x0;var _0x2f4bc5=_0xcb7a[_0x50af48];return _0x2f4bc5;};'use strict';var Sequelize=require(_0xacb7('0x0'));var moment=require(_0xacb7('0x1'));module['exports']={'type':{'type':Sequelize[_0xacb7('0x2')]},'uniqueid':{'type':Sequelize[_0xacb7('0x2')]},'calleridnum':{'type':Sequelize[_0xacb7('0x2')]},'calleridname':{'type':Sequelize[_0xacb7('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xacb7('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xacb7('0x3')],'set':function(_0x240e34){var _0x4bbd25=moment(_0x240e34);var _0x447c93=moment(this['getDataValue'](_0xacb7('0x4')))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x4a8924=_0x4bbd25[_0xacb7('0x5')](_0x447c93,'seconds');this['setDataValue']('queuecallerleaveAt',_0x240e34);this['setDataValue'](_0xacb7('0x6'),_0x4a8924||null);}},'position':{'type':Sequelize[_0xacb7('0x7')]},'count':{'type':Sequelize[_0xacb7('0x7')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xacb7('0x8')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xacb7('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xacb7('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xacb7('0x2')],'comment':_0xacb7('0x9')},'originalposition':{'type':Sequelize[_0xacb7('0x7')]},'channel':{'type':Sequelize[_0xacb7('0x2')]},'connectedlinenum':{'type':Sequelize[_0xacb7('0x2')]},'connectedlinename':{'type':Sequelize[_0xacb7('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xacb7('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xacb7('0x7')]},'mohtime':{'type':Sequelize[_0xacb7('0x7')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xacb7('0x8')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xacb7('0x2')]},'transfer':{'type':Sequelize[_0xacb7('0x8')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xacb7('0x2')],'comment':_0xacb7('0xa')},'transferexten':{'type':Sequelize[_0xacb7('0x2')]},'transferuniqueid':{'type':Sequelize[_0xacb7('0x2')]},'disposition':{'type':Sequelize[_0xacb7('0x2')]},'secondDisposition':{'type':Sequelize[_0xacb7('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xacb7('0x7')],'defaultValue':0x0},'note':{'type':Sequelize[_0xacb7('0x2')]}}; \ No newline at end of file +var _0x4435=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x412990,_0x36da93){var _0x29fa35=function(_0x51cc3a){while(--_0x51cc3a){_0x412990['push'](_0x412990['shift']());}};_0x29fa35(++_0x36da93);}(_0x4435,0x134));var _0x5443=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x4435[_0x18ab2a];return _0x16dcee;};'use strict';var Sequelize=require(_0x5443('0x0'));var moment=require('moment');module[_0x5443('0x1')]={'type':{'type':Sequelize[_0x5443('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5443('0x2')]},'calleridname':{'type':Sequelize[_0x5443('0x2')]},'queue':{'type':Sequelize[_0x5443('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x5443('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x5443('0x3')],'set':function(_0x37d96c){var _0x4e3705=moment(_0x37d96c);var _0x3da7e2=moment(this['getDataValue']('queuecallerjoinAt'))['format'](_0x5443('0x4'));var _0x43ba85=_0x4e3705[_0x5443('0x5')](_0x3da7e2,_0x5443('0x6'));this[_0x5443('0x7')]('queuecallerleaveAt',_0x37d96c);this[_0x5443('0x7')](_0x5443('0x8'),_0x43ba85||null);}},'position':{'type':Sequelize[_0x5443('0x9')]},'count':{'type':Sequelize[_0x5443('0x9')]},'queuecallerabandon':{'type':Sequelize[_0x5443('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x5443('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x5443('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x5443('0x3')]},'queuecallerexit':{'type':Sequelize[_0x5443('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x5443('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x5443('0x2')],'comment':_0x5443('0xb')},'originalposition':{'type':Sequelize[_0x5443('0x9')]},'channel':{'type':Sequelize[_0x5443('0x2')]},'connectedlinenum':{'type':Sequelize[_0x5443('0x2')]},'connectedlinename':{'type':Sequelize[_0x5443('0x2')]},'accountcode':{'type':Sequelize[_0x5443('0x2')]},'context':{'type':Sequelize[_0x5443('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5443('0x2')]},'holdtime':{'type':Sequelize[_0x5443('0x9')]},'mohtime':{'type':Sequelize[_0x5443('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5443('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x5443('0xc')},'transferexten':{'type':Sequelize[_0x5443('0x2')]},'transferuniqueid':{'type':Sequelize[_0x5443('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x5443('0x2')]},'thirdDisposition':{'type':Sequelize[_0x5443('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x5443('0x9')],'defaultValue':0x0},'note':{'type':Sequelize[_0x5443('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 9d69d00..c148d01 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 _0x8f43=['fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','limit','count','offset','set','Content-Range','json','apply','reject','save','destroy','error','name','send','map','VoiceQueueReport','rawAttributes','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','then','includeAll','findAll','catch','include','find','create','body','params','describe','getVoiceQueuesReport','order','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x30c82a,_0x534bd1){var _0x1abdd7=function(_0xa7696b){while(--_0xa7696b){_0x30c82a['push'](_0x30c82a['shift']());}};_0x1abdd7(++_0x534bd1);}(_0x8f43,0x1e0));var _0x38f4=function(_0x5352a2,_0xb6ec28){_0x5352a2=_0x5352a2-0x0;var _0x14f3d7=_0x8f43[_0x5352a2];return _0x14f3d7;};'use strict';var emlformat=require(_0x38f4('0x0'));var rimraf=require(_0x38f4('0x1'));var zipdir=require(_0x38f4('0x2'));var jsonpatch=require(_0x38f4('0x3'));var rp=require(_0x38f4('0x4'));var moment=require(_0x38f4('0x5'));var BPromise=require(_0x38f4('0x6'));var Mustache=require(_0x38f4('0x7'));var util=require(_0x38f4('0x8'));var path=require('path');var sox=require(_0x38f4('0x9'));var csv=require(_0x38f4('0xa'));var ejs=require(_0x38f4('0xb'));var fs=require('fs');var fs_extra=require(_0x38f4('0xc'));var _=require('lodash');var squel=require(_0x38f4('0xd'));var crypto=require(_0x38f4('0xe'));var jsforce=require(_0x38f4('0xf'));var deskjs=require(_0x38f4('0x10'));var toCsv=require(_0x38f4('0xa'));var querystring=require(_0x38f4('0x11'));var Papa=require(_0x38f4('0x12'));var Redis=require(_0x38f4('0x13'));var authService=require(_0x38f4('0x14'));var qs=require(_0x38f4('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x38f4('0x16'));var logger=require(_0x38f4('0x17'))('api');var utils=require(_0x38f4('0x18'));var config=require(_0x38f4('0x19'));var licenseUtil=require(_0x38f4('0x1a'));var db=require(_0x38f4('0x1b'))['db'];config['redis']=_[_0x38f4('0x1c')](config[_0x38f4('0x1d')],{'host':_0x38f4('0x1e'),'port':0x18eb});var socket=require(_0x38f4('0x1f'))(new Redis(config[_0x38f4('0x1d')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x88ca8e,_0x41a710){_0x41a710=_0x41a710||0xcc;return function(_0x4197a6){if(_0x4197a6){return _0x88ca8e[_0x38f4('0x20')](_0x41a710);}return _0x88ca8e[_0x38f4('0x21')](_0x41a710)[_0x38f4('0x22')]();};}function respondWithResult(_0xc23917,_0x1ea681){_0x1ea681=_0x1ea681||0xc8;return function(_0x407530){if(_0x407530){return _0xc23917['status'](_0x1ea681)['json'](_0x407530);}};}function respondWithFilteredResult(_0x22532c,_0x10bf6d){return function(_0x42cafa){if(_0x42cafa){var _0x26ccbe=typeof _0x10bf6d['offset']==='undefined'&&typeof _0x10bf6d[_0x38f4('0x23')]==='undefined';var _0x55df64=_0x42cafa[_0x38f4('0x24')];var _0x5497f4=_0x26ccbe?0x0:_0x10bf6d[_0x38f4('0x25')];var _0x5caadc=_0x26ccbe?_0x42cafa[_0x38f4('0x24')]:_0x10bf6d[_0x38f4('0x25')]+_0x10bf6d[_0x38f4('0x23')];var _0x1001c9;if(_0x5caadc>=_0x55df64){_0x5caadc=_0x55df64;_0x1001c9=0xc8;}else{_0x1001c9=0xce;}_0x22532c['status'](_0x1001c9);return _0x22532c[_0x38f4('0x26')](_0x38f4('0x27'),_0x5497f4+'-'+_0x5caadc+'/'+_0x55df64)[_0x38f4('0x28')](_0x42cafa);}return null;};}function patchUpdates(_0x51267f){return function(_0xdbc961){try{jsonpatch[_0x38f4('0x29')](_0xdbc961,_0x51267f,!![]);}catch(_0x47acfc){return BPromise[_0x38f4('0x2a')](_0x47acfc);}return _0xdbc961[_0x38f4('0x2b')]();};}function saveUpdates(_0x4d7bd6,_0x15df11){return function(_0x18ae08){if(_0x18ae08){return _0x18ae08['update'](_0x4d7bd6)['then'](function(_0x5a7326){return _0x5a7326;});}return null;};}function removeEntity(_0x407ade,_0x3dc31d){return function(_0x80ac1e){if(_0x80ac1e){return _0x80ac1e[_0x38f4('0x2c')]()['then'](function(){_0x407ade[_0x38f4('0x21')](0xcc)[_0x38f4('0x22')]();});}};}function handleEntityNotFound(_0x99adcd,_0x254726){return function(_0x3202e7){if(!_0x3202e7){_0x99adcd[_0x38f4('0x20')](0x194);}return _0x3202e7;};}function handleError(_0x51492a,_0x2a546b){_0x2a546b=_0x2a546b||0x1f4;return function(_0x1a4bc5){logger[_0x38f4('0x2d')](_0x1a4bc5['stack']);if(_0x1a4bc5[_0x38f4('0x2e')]){delete _0x1a4bc5[_0x38f4('0x2e')];}_0x51492a[_0x38f4('0x21')](_0x2a546b)[_0x38f4('0x2f')](_0x1a4bc5);};}exports['index']=function(_0x31a372,_0x3d03de){var _0x32bfc1={},_0x506c35={},_0x31db64={'count':0x0,'rows':[]};var _0x14e8b8=_[_0x38f4('0x30')](db[_0x38f4('0x31')][_0x38f4('0x32')],function(_0x460c7e){return{'name':_0x460c7e['fieldName'],'type':_0x460c7e[_0x38f4('0x33')]['key']};});_0x506c35['model']=_['map'](_0x14e8b8,_0x38f4('0x2e'));_0x506c35[_0x38f4('0x34')]=_[_0x38f4('0x35')](_0x31a372['query']);_0x506c35['filters']=_[_0x38f4('0x36')](_0x506c35[_0x38f4('0x37')],_0x506c35[_0x38f4('0x34')]);_0x32bfc1[_0x38f4('0x38')]=_[_0x38f4('0x36')](_0x506c35[_0x38f4('0x37')],qs[_0x38f4('0x39')](_0x31a372['query'][_0x38f4('0x39')]));_0x32bfc1[_0x38f4('0x38')]=_0x32bfc1[_0x38f4('0x38')][_0x38f4('0x3a')]?_0x32bfc1[_0x38f4('0x38')]:_0x506c35[_0x38f4('0x37')];if(!_0x31a372[_0x38f4('0x34')][_0x38f4('0x3b')](_0x38f4('0x3c'))){_0x32bfc1['limit']=qs[_0x38f4('0x23')](_0x31a372['query'][_0x38f4('0x23')]);_0x32bfc1[_0x38f4('0x25')]=qs['offset'](_0x31a372['query']['offset']);}_0x32bfc1['order']=qs[_0x38f4('0x3d')](_0x31a372[_0x38f4('0x34')]['sort']);_0x32bfc1[_0x38f4('0x3e')]=qs[_0x38f4('0x3f')](_[_0x38f4('0x40')](_0x31a372[_0x38f4('0x34')],_0x506c35['filters']),_0x14e8b8);if(_0x31a372[_0x38f4('0x34')]['filter']){_0x32bfc1['where']=_['merge'](_0x32bfc1[_0x38f4('0x3e')],{'$or':_[_0x38f4('0x30')](_0x14e8b8,function(_0x360fc4){if(_0x360fc4[_0x38f4('0x33')]!==_0x38f4('0x41')){var _0x3aed3a={};_0x3aed3a[_0x360fc4[_0x38f4('0x2e')]]={'$like':'%'+_0x31a372[_0x38f4('0x34')][_0x38f4('0x42')]+'%'};return _0x3aed3a;}})});}_0x32bfc1=_[_0x38f4('0x43')]({},_0x32bfc1,_0x31a372[_0x38f4('0x44')]);var _0x92cd13={'where':_0x32bfc1[_0x38f4('0x3e')]};return db[_0x38f4('0x31')][_0x38f4('0x24')](_0x92cd13)[_0x38f4('0x45')](function(_0x177b4b){_0x31db64[_0x38f4('0x24')]=_0x177b4b;if(_0x31a372[_0x38f4('0x34')][_0x38f4('0x46')]){_0x32bfc1['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x38f4('0x47')](_0x32bfc1);})['then'](function(_0x312377){_0x31db64['rows']=_0x312377;return _0x31db64;})['then'](respondWithFilteredResult(_0x3d03de,_0x32bfc1))[_0x38f4('0x48')](handleError(_0x3d03de,null));};exports['show']=function(_0x4770ea,_0x11afb7){var _0x18e2b9={'raw':![],'where':{'id':_0x4770ea['params']['id']}},_0x48e6af={};_0x48e6af[_0x38f4('0x37')]=_[_0x38f4('0x35')](db[_0x38f4('0x31')][_0x38f4('0x32')]);_0x48e6af[_0x38f4('0x34')]=_[_0x38f4('0x35')](_0x4770ea[_0x38f4('0x34')]);_0x48e6af[_0x38f4('0x3f')]=_[_0x38f4('0x36')](_0x48e6af['model'],_0x48e6af[_0x38f4('0x34')]);_0x18e2b9[_0x38f4('0x38')]=_[_0x38f4('0x36')](_0x48e6af[_0x38f4('0x37')],qs[_0x38f4('0x39')](_0x4770ea[_0x38f4('0x34')][_0x38f4('0x39')]));_0x18e2b9[_0x38f4('0x38')]=_0x18e2b9['attributes']['length']?_0x18e2b9[_0x38f4('0x38')]:_0x48e6af[_0x38f4('0x37')];if(_0x4770ea[_0x38f4('0x34')][_0x38f4('0x46')]){_0x18e2b9[_0x38f4('0x49')]=[{'all':!![]}];}_0x18e2b9=_[_0x38f4('0x43')]({},_0x18e2b9,_0x4770ea[_0x38f4('0x44')]);return db['VoiceQueueReport'][_0x38f4('0x4a')](_0x18e2b9)[_0x38f4('0x45')](handleEntityNotFound(_0x11afb7,null))[_0x38f4('0x45')](respondWithResult(_0x11afb7,null))[_0x38f4('0x48')](handleError(_0x11afb7,null));};exports[_0x38f4('0x4b')]=function(_0x3b8ff9,_0x30db3f){return db[_0x38f4('0x31')][_0x38f4('0x4b')](_0x3b8ff9[_0x38f4('0x4c')],{})[_0x38f4('0x45')](respondWithResult(_0x30db3f,0xc9))[_0x38f4('0x48')](handleError(_0x30db3f,null));};exports['update']=function(_0x5a5362,_0x4ff04b){if(_0x5a5362[_0x38f4('0x4c')]['id']){delete _0x5a5362[_0x38f4('0x4c')]['id'];}return db['VoiceQueueReport'][_0x38f4('0x4a')]({'where':{'id':_0x5a5362[_0x38f4('0x4d')]['id']}})[_0x38f4('0x45')](handleEntityNotFound(_0x4ff04b,null))[_0x38f4('0x45')](saveUpdates(_0x5a5362[_0x38f4('0x4c')],null))[_0x38f4('0x45')](respondWithResult(_0x4ff04b,null))[_0x38f4('0x48')](handleError(_0x4ff04b,null));};exports[_0x38f4('0x2c')]=function(_0x544f62,_0x1fc84e){return db['VoiceQueueReport']['find']({'where':{'id':_0x544f62[_0x38f4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1fc84e,null))[_0x38f4('0x45')](removeEntity(_0x1fc84e,null))[_0x38f4('0x48')](handleError(_0x1fc84e,null));};exports[_0x38f4('0x4e')]=function(_0x346e74,_0x573c19){return db[_0x38f4('0x31')][_0x38f4('0x4e')]()[_0x38f4('0x45')](respondWithResult(_0x573c19,null))['catch'](handleError(_0x573c19,null));};exports[_0x38f4('0x4f')]=function(_0xc6864a,_0x595b7a){var _0xb1912c={},_0x700924={},_0x17ad0b={'count':0x0,'rows':[]};_0x700924[_0x38f4('0x37')]=_[_0x38f4('0x35')](db[_0x38f4('0x31')][_0x38f4('0x32')]);_0x700924['query']=_[_0x38f4('0x35')](_0xc6864a['query']);_0x700924['filters']=_[_0x38f4('0x36')](_0x700924[_0x38f4('0x37')],_0x700924[_0x38f4('0x34')]);_0xb1912c['attributes']=_[_0x38f4('0x36')](_0x700924[_0x38f4('0x37')],qs[_0x38f4('0x39')](_0xc6864a[_0x38f4('0x34')]['fields']));_0xb1912c[_0x38f4('0x38')]=_0xb1912c[_0x38f4('0x38')][_0x38f4('0x3a')]?_0xb1912c[_0x38f4('0x38')]:_0x700924['model'];if(!_0xc6864a[_0x38f4('0x34')][_0x38f4('0x3b')](_0x38f4('0x3c'))){_0xb1912c['limit']=qs[_0x38f4('0x23')](_0xc6864a[_0x38f4('0x34')]['limit']);_0xb1912c[_0x38f4('0x25')]=qs[_0x38f4('0x25')](_0xc6864a['query'][_0x38f4('0x25')]);}_0xb1912c[_0x38f4('0x50')]=qs['sort'](_0xc6864a[_0x38f4('0x34')]['sort']);_0xb1912c[_0x38f4('0x3e')]=qs[_0x38f4('0x3f')](_['pick'](_0xc6864a['query'],_0x700924[_0x38f4('0x3f')]));if(_0xc6864a[_0x38f4('0x34')][_0x38f4('0x42')]){_0xb1912c['where']=_[_0x38f4('0x43')](_0xb1912c[_0x38f4('0x3e')],{'$or':_[_0x38f4('0x30')](_0xb1912c['attributes'],function(_0x5ebee0){var _0x2d03d1={};_0x2d03d1[_0x5ebee0]={'$like':'%'+_0xc6864a['query'][_0x38f4('0x42')]+'%'};return _0x2d03d1;})});}_0xb1912c=_[_0x38f4('0x43')]({},_0xb1912c,_0xc6864a[_0x38f4('0x44')]);var _0x549f3e={'where':_0xb1912c[_0x38f4('0x3e')]};return db[_0x38f4('0x31')]['count'](_0x549f3e)[_0x38f4('0x45')](function(_0x2b4829){_0x17ad0b[_0x38f4('0x24')]=_0x2b4829;if(_0xc6864a[_0x38f4('0x34')][_0x38f4('0x46')]){_0xb1912c['include']=[{'all':!![]}];}return db[_0x38f4('0x31')]['findAll'](_0xb1912c);})[_0x38f4('0x45')](function(_0x2e5761){_0x17ad0b[_0x38f4('0x51')]=_0x2e5761;return _0x17ad0b;})[_0x38f4('0x45')](respondWithFilteredResult(_0x595b7a,_0xb1912c,'getVoiceQueuesReport'))[_0x38f4('0x48')](handleError(_0x595b7a,null,_0x38f4('0x4f')));}; \ No newline at end of file +var _0x1fa2=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','limit','undefined','offset','set','Content-Range','reject','save','then','destroy','error','stack','name','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','find','create','body','update','params','describe','getVoiceQueuesReport','sort','include','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x422c0a,_0x95ffba){var _0x54452d=function(_0x14263a){while(--_0x14263a){_0x422c0a['push'](_0x422c0a['shift']());}};_0x54452d(++_0x95ffba);}(_0x1fa2,0x1e7));var _0x21fa=function(_0xae7878,_0x3abb86){_0xae7878=_0xae7878-0x0;var _0x415a1b=_0x1fa2[_0xae7878];return _0x415a1b;};'use strict';var emlformat=require(_0x21fa('0x0'));var rimraf=require(_0x21fa('0x1'));var zipdir=require(_0x21fa('0x2'));var jsonpatch=require(_0x21fa('0x3'));var rp=require(_0x21fa('0x4'));var moment=require(_0x21fa('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x21fa('0x6'));var util=require(_0x21fa('0x7'));var path=require('path');var sox=require(_0x21fa('0x8'));var csv=require(_0x21fa('0x9'));var ejs=require(_0x21fa('0xa'));var fs=require('fs');var fs_extra=require(_0x21fa('0xb'));var _=require(_0x21fa('0xc'));var squel=require(_0x21fa('0xd'));var crypto=require(_0x21fa('0xe'));var jsforce=require(_0x21fa('0xf'));var deskjs=require(_0x21fa('0x10'));var toCsv=require(_0x21fa('0x9'));var querystring=require(_0x21fa('0x11'));var Papa=require(_0x21fa('0x12'));var Redis=require(_0x21fa('0x13'));var authService=require(_0x21fa('0x14'));var qs=require(_0x21fa('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x21fa('0x16'));var logger=require('../../config/logger')(_0x21fa('0x17'));var utils=require(_0x21fa('0x18'));var config=require(_0x21fa('0x19'));var licenseUtil=require(_0x21fa('0x1a'));var db=require(_0x21fa('0x1b'))['db'];config['redis']=_[_0x21fa('0x1c')](config[_0x21fa('0x1d')],{'host':_0x21fa('0x1e'),'port':0x18eb});var socket=require(_0x21fa('0x1f'))(new Redis(config[_0x21fa('0x1d')]));require('./voiceQueueReport.socket')[_0x21fa('0x20')](socket);function respondWithStatusCode(_0x5cc194,_0x28be86){_0x28be86=_0x28be86||0xcc;return function(_0x342ad6){if(_0x342ad6){return _0x5cc194[_0x21fa('0x21')](_0x28be86);}return _0x5cc194[_0x21fa('0x22')](_0x28be86)['end']();};}function respondWithResult(_0x5e1f00,_0x42d7bb){_0x42d7bb=_0x42d7bb||0xc8;return function(_0x49bb57){if(_0x49bb57){return _0x5e1f00[_0x21fa('0x22')](_0x42d7bb)[_0x21fa('0x23')](_0x49bb57);}};}function respondWithFilteredResult(_0x2db12b,_0x149637){return function(_0x7f6140){if(_0x7f6140){var _0x3494a3=typeof _0x149637['offset']==='undefined'&&typeof _0x149637[_0x21fa('0x24')]===_0x21fa('0x25');var _0x2552f2=_0x7f6140['count'];var _0x26854c=_0x3494a3?0x0:_0x149637[_0x21fa('0x26')];var _0x43a382=_0x3494a3?_0x7f6140['count']:_0x149637[_0x21fa('0x26')]+_0x149637[_0x21fa('0x24')];var _0x49d09e;if(_0x43a382>=_0x2552f2){_0x43a382=_0x2552f2;_0x49d09e=0xc8;}else{_0x49d09e=0xce;}_0x2db12b[_0x21fa('0x22')](_0x49d09e);return _0x2db12b[_0x21fa('0x27')](_0x21fa('0x28'),_0x26854c+'-'+_0x43a382+'/'+_0x2552f2)[_0x21fa('0x23')](_0x7f6140);}return null;};}function patchUpdates(_0x577ac3){return function(_0x68f22f){try{jsonpatch['apply'](_0x68f22f,_0x577ac3,!![]);}catch(_0x177514){return BPromise[_0x21fa('0x29')](_0x177514);}return _0x68f22f[_0x21fa('0x2a')]();};}function saveUpdates(_0x4d677d,_0x3ca139){return function(_0x2caeef){if(_0x2caeef){return _0x2caeef['update'](_0x4d677d)[_0x21fa('0x2b')](function(_0x202db2){return _0x202db2;});}return null;};}function removeEntity(_0x298653,_0xc708f7){return function(_0x37e9b8){if(_0x37e9b8){return _0x37e9b8[_0x21fa('0x2c')]()[_0x21fa('0x2b')](function(){_0x298653[_0x21fa('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7adba7,_0x45db02){return function(_0x5bae2c){if(!_0x5bae2c){_0x7adba7[_0x21fa('0x21')](0x194);}return _0x5bae2c;};}function handleError(_0x15dbf2,_0x45af3c){_0x45af3c=_0x45af3c||0x1f4;return function(_0x382621){logger[_0x21fa('0x2d')](_0x382621[_0x21fa('0x2e')]);if(_0x382621[_0x21fa('0x2f')]){delete _0x382621[_0x21fa('0x2f')];}_0x15dbf2['status'](_0x45af3c)['send'](_0x382621);};}exports[_0x21fa('0x30')]=function(_0x1c5ba1,_0x475793){var _0x5aecc9={},_0xb1237d={},_0x7ac734={'count':0x0,'rows':[]};var _0x3f3a3c=_[_0x21fa('0x31')](db[_0x21fa('0x32')][_0x21fa('0x33')],function(_0x3f0efe){return{'name':_0x3f0efe[_0x21fa('0x34')],'type':_0x3f0efe[_0x21fa('0x35')][_0x21fa('0x36')]};});_0xb1237d[_0x21fa('0x37')]=_[_0x21fa('0x31')](_0x3f3a3c,'name');_0xb1237d[_0x21fa('0x38')]=_[_0x21fa('0x39')](_0x1c5ba1['query']);_0xb1237d['filters']=_[_0x21fa('0x3a')](_0xb1237d[_0x21fa('0x37')],_0xb1237d[_0x21fa('0x38')]);_0x5aecc9[_0x21fa('0x3b')]=_['intersection'](_0xb1237d['model'],qs[_0x21fa('0x3c')](_0x1c5ba1[_0x21fa('0x38')][_0x21fa('0x3c')]));_0x5aecc9[_0x21fa('0x3b')]=_0x5aecc9[_0x21fa('0x3b')][_0x21fa('0x3d')]?_0x5aecc9['attributes']:_0xb1237d[_0x21fa('0x37')];if(!_0x1c5ba1[_0x21fa('0x38')]['hasOwnProperty'](_0x21fa('0x3e'))){_0x5aecc9['limit']=qs[_0x21fa('0x24')](_0x1c5ba1['query'][_0x21fa('0x24')]);_0x5aecc9[_0x21fa('0x26')]=qs[_0x21fa('0x26')](_0x1c5ba1[_0x21fa('0x38')][_0x21fa('0x26')]);}_0x5aecc9[_0x21fa('0x3f')]=qs['sort'](_0x1c5ba1[_0x21fa('0x38')]['sort']);_0x5aecc9[_0x21fa('0x40')]=qs[_0x21fa('0x41')](_[_0x21fa('0x42')](_0x1c5ba1['query'],_0xb1237d['filters']),_0x3f3a3c);if(_0x1c5ba1[_0x21fa('0x38')][_0x21fa('0x43')]){_0x5aecc9[_0x21fa('0x40')]=_[_0x21fa('0x44')](_0x5aecc9[_0x21fa('0x40')],{'$or':_[_0x21fa('0x31')](_0x3f3a3c,function(_0x3cc84c){if(_0x3cc84c[_0x21fa('0x35')]!==_0x21fa('0x45')){var _0x22e8e3={};_0x22e8e3[_0x3cc84c['name']]={'$like':'%'+_0x1c5ba1[_0x21fa('0x38')][_0x21fa('0x43')]+'%'};return _0x22e8e3;}})});}_0x5aecc9=_[_0x21fa('0x44')]({},_0x5aecc9,_0x1c5ba1[_0x21fa('0x46')]);var _0x5b541d={'where':_0x5aecc9[_0x21fa('0x40')]};return db[_0x21fa('0x32')][_0x21fa('0x47')](_0x5b541d)[_0x21fa('0x2b')](function(_0x460200){_0x7ac734['count']=_0x460200;if(_0x1c5ba1[_0x21fa('0x38')][_0x21fa('0x48')]){_0x5aecc9['include']=[{'all':!![]}];}return db[_0x21fa('0x32')][_0x21fa('0x49')](_0x5aecc9);})[_0x21fa('0x2b')](function(_0x5b6486){_0x7ac734[_0x21fa('0x4a')]=_0x5b6486;return _0x7ac734;})[_0x21fa('0x2b')](respondWithFilteredResult(_0x475793,_0x5aecc9))[_0x21fa('0x4b')](handleError(_0x475793,null));};exports['show']=function(_0x82b38b,_0xe9450){var _0x7f244d={'raw':![],'where':{'id':_0x82b38b['params']['id']}},_0x44b0cf={};_0x44b0cf[_0x21fa('0x37')]=_[_0x21fa('0x39')](db['VoiceQueueReport'][_0x21fa('0x33')]);_0x44b0cf[_0x21fa('0x38')]=_['keys'](_0x82b38b[_0x21fa('0x38')]);_0x44b0cf[_0x21fa('0x41')]=_['intersection'](_0x44b0cf[_0x21fa('0x37')],_0x44b0cf[_0x21fa('0x38')]);_0x7f244d[_0x21fa('0x3b')]=_[_0x21fa('0x3a')](_0x44b0cf['model'],qs[_0x21fa('0x3c')](_0x82b38b[_0x21fa('0x38')][_0x21fa('0x3c')]));_0x7f244d[_0x21fa('0x3b')]=_0x7f244d[_0x21fa('0x3b')][_0x21fa('0x3d')]?_0x7f244d[_0x21fa('0x3b')]:_0x44b0cf[_0x21fa('0x37')];if(_0x82b38b[_0x21fa('0x38')]['includeAll']){_0x7f244d['include']=[{'all':!![]}];}_0x7f244d=_[_0x21fa('0x44')]({},_0x7f244d,_0x82b38b[_0x21fa('0x46')]);return db[_0x21fa('0x32')][_0x21fa('0x4c')](_0x7f244d)[_0x21fa('0x2b')](handleEntityNotFound(_0xe9450,null))['then'](respondWithResult(_0xe9450,null))['catch'](handleError(_0xe9450,null));};exports[_0x21fa('0x4d')]=function(_0x17608b,_0x153c86){return db[_0x21fa('0x32')][_0x21fa('0x4d')](_0x17608b[_0x21fa('0x4e')],{})[_0x21fa('0x2b')](respondWithResult(_0x153c86,0xc9))[_0x21fa('0x4b')](handleError(_0x153c86,null));};exports[_0x21fa('0x4f')]=function(_0x322f74,_0x4245b1){if(_0x322f74['body']['id']){delete _0x322f74[_0x21fa('0x4e')]['id'];}return db[_0x21fa('0x32')][_0x21fa('0x4c')]({'where':{'id':_0x322f74[_0x21fa('0x50')]['id']}})['then'](handleEntityNotFound(_0x4245b1,null))['then'](saveUpdates(_0x322f74['body'],null))[_0x21fa('0x2b')](respondWithResult(_0x4245b1,null))[_0x21fa('0x4b')](handleError(_0x4245b1,null));};exports[_0x21fa('0x2c')]=function(_0x34987e,_0x1010f8){return db[_0x21fa('0x32')][_0x21fa('0x4c')]({'where':{'id':_0x34987e['params']['id']}})[_0x21fa('0x2b')](handleEntityNotFound(_0x1010f8,null))['then'](removeEntity(_0x1010f8,null))['catch'](handleError(_0x1010f8,null));};exports[_0x21fa('0x51')]=function(_0xf92d11,_0x38fbe7){return db['VoiceQueueReport'][_0x21fa('0x51')]()[_0x21fa('0x2b')](respondWithResult(_0x38fbe7,null))[_0x21fa('0x4b')](handleError(_0x38fbe7,null));};exports[_0x21fa('0x52')]=function(_0x5072cc,_0x72b800){var _0x1bb741={},_0x41abe6={},_0x4c843b={'count':0x0,'rows':[]};_0x41abe6[_0x21fa('0x37')]=_[_0x21fa('0x39')](db[_0x21fa('0x32')][_0x21fa('0x33')]);_0x41abe6[_0x21fa('0x38')]=_['keys'](_0x5072cc[_0x21fa('0x38')]);_0x41abe6[_0x21fa('0x41')]=_['intersection'](_0x41abe6[_0x21fa('0x37')],_0x41abe6['query']);_0x1bb741[_0x21fa('0x3b')]=_[_0x21fa('0x3a')](_0x41abe6[_0x21fa('0x37')],qs[_0x21fa('0x3c')](_0x5072cc[_0x21fa('0x38')][_0x21fa('0x3c')]));_0x1bb741[_0x21fa('0x3b')]=_0x1bb741[_0x21fa('0x3b')][_0x21fa('0x3d')]?_0x1bb741['attributes']:_0x41abe6['model'];if(!_0x5072cc['query']['hasOwnProperty'](_0x21fa('0x3e'))){_0x1bb741[_0x21fa('0x24')]=qs[_0x21fa('0x24')](_0x5072cc['query'][_0x21fa('0x24')]);_0x1bb741[_0x21fa('0x26')]=qs[_0x21fa('0x26')](_0x5072cc[_0x21fa('0x38')][_0x21fa('0x26')]);}_0x1bb741[_0x21fa('0x3f')]=qs[_0x21fa('0x53')](_0x5072cc['query']['sort']);_0x1bb741[_0x21fa('0x40')]=qs[_0x21fa('0x41')](_[_0x21fa('0x42')](_0x5072cc['query'],_0x41abe6[_0x21fa('0x41')]));if(_0x5072cc[_0x21fa('0x38')]['filter']){_0x1bb741[_0x21fa('0x40')]=_[_0x21fa('0x44')](_0x1bb741[_0x21fa('0x40')],{'$or':_[_0x21fa('0x31')](_0x1bb741[_0x21fa('0x3b')],function(_0x1f4cc9){var _0x52b38f={};_0x52b38f[_0x1f4cc9]={'$like':'%'+_0x5072cc[_0x21fa('0x38')][_0x21fa('0x43')]+'%'};return _0x52b38f;})});}_0x1bb741=_[_0x21fa('0x44')]({},_0x1bb741,_0x5072cc[_0x21fa('0x46')]);var _0x3d0543={'where':_0x1bb741['where']};return db['VoiceQueueReport'][_0x21fa('0x47')](_0x3d0543)[_0x21fa('0x2b')](function(_0x80854c){_0x4c843b['count']=_0x80854c;if(_0x5072cc[_0x21fa('0x38')][_0x21fa('0x48')]){_0x1bb741[_0x21fa('0x54')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x21fa('0x49')](_0x1bb741);})['then'](function(_0xec2b9){_0x4c843b[_0x21fa('0x4a')]=_0xec2b9;return _0x4c843b;})['then'](respondWithFilteredResult(_0x72b800,_0x1bb741,'getVoiceQueuesReport'))[_0x21fa('0x4b')](handleError(_0x72b800,null,_0x21fa('0x52')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index ee5a654..6b81b15 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 _0x4e75=['save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','VoiceQueueReport','setMaxListeners'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x4e75,0x153));var _0x54e7=function(_0x5371a8,_0x5349a2){_0x5371a8=_0x5371a8-0x0;var _0x46f6c9=_0x4e75[_0x5371a8];return _0x46f6c9;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x54e7('0x0'))['db'][_0x54e7('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x54e7('0x2')](0x0);var events={'afterCreate':_0x54e7('0x3'),'afterUpdate':_0x54e7('0x4'),'afterDestroy':_0x54e7('0x5')};function emitEvent(_0x1d928b){return function(_0x34475a,_0x33f607,_0x49e574){VoiceQueueReportEvents[_0x54e7('0x6')](_0x1d928b+':'+_0x34475a['id'],_0x34475a);VoiceQueueReportEvents[_0x54e7('0x6')](_0x1d928b,_0x34475a);_0x49e574(null);};}for(var e in events){if(events[_0x54e7('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x54e7('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x82fd=['../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x1ec3fa,_0x3e9940){var _0x349bee=function(_0x539e67){while(--_0x539e67){_0x1ec3fa['push'](_0x1ec3fa['shift']());}};_0x349bee(++_0x3e9940);}(_0x82fd,0xce));var _0xd82f=function(_0x3a7699,_0x42b505){_0x3a7699=_0x3a7699-0x0;var _0x227683=_0x82fd[_0x3a7699];return _0x227683;};'use strict';var EventEmitter=require(_0xd82f('0x0'));var VoiceQueueReport=require(_0xd82f('0x1'))['db'][_0xd82f('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xd82f('0x3')](0x0);var events={'afterCreate':_0xd82f('0x4'),'afterUpdate':_0xd82f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x115d4d){return function(_0x2a976a,_0x5cbf2a,_0x59b018){VoiceQueueReportEvents[_0xd82f('0x6')](_0x115d4d+':'+_0x2a976a['id'],_0x2a976a);VoiceQueueReportEvents[_0xd82f('0x6')](_0x115d4d,_0x2a976a);_0x59b018(null);};}for(var e in events){if(events[_0xd82f('0x7')](e)){var event=events[e];VoiceQueueReport[_0xd82f('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 cefe887..57a8f97 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 _0x2f3f=['rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','api','moment','bluebird','request-promise','path'];(function(_0x5b00f4,_0x708fc0){var _0x27fd94=function(_0x1a505f){while(--_0x1a505f){_0x5b00f4['push'](_0x5b00f4['shift']());}};_0x27fd94(++_0x708fc0);}(_0x2f3f,0x1ad));var _0xf2f3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2f3f[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0xf2f3('0x0'));var logger=require('../../config/logger')(_0xf2f3('0x1'));var moment=require(_0xf2f3('0x2'));var BPromise=require(_0xf2f3('0x3'));var rp=require(_0xf2f3('0x4'));var fs=require('fs');var path=require(_0xf2f3('0x5'));var rimraf=require(_0xf2f3('0x6'));var config=require(_0xf2f3('0x7'));var attributes=require(_0xf2f3('0x8'));module[_0xf2f3('0x9')]=function(_0xa8e4e5,_0x20cfc1){return _0xa8e4e5[_0xf2f3('0xa')](_0xf2f3('0xb'),attributes,{'tableName':_0xf2f3('0xc'),'paranoid':![],'indexes':[{'fields':[_0xf2f3('0xd')]},{'fields':[_0xf2f3('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x135a=['rimraf','../../config/environment','./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4d0493,_0x45c6fd){var _0x520449=function(_0x16c0c1){while(--_0x16c0c1){_0x4d0493['push'](_0x4d0493['shift']());}};_0x520449(++_0x45c6fd);}(_0x135a,0x1c9));var _0xa135=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x135a[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xa135('0x0'));var util=require(_0xa135('0x1'));var logger=require(_0xa135('0x2'))(_0xa135('0x3'));var moment=require(_0xa135('0x4'));var BPromise=require(_0xa135('0x5'));var rp=require(_0xa135('0x6'));var fs=require('fs');var path=require(_0xa135('0x7'));var rimraf=require(_0xa135('0x8'));var config=require(_0xa135('0x9'));var attributes=require(_0xa135('0xa'));module['exports']=function(_0x2feeeb,_0x212b65){return _0x2feeeb[_0xa135('0xb')](_0xa135('0xc'),attributes,{'tableName':_0xa135('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xa135('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 4d426a4..d98fef3 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 _0x52eb=['body','CreateVoiceQueueReport','UpdateVoiceQueueReport','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','model','map','GetVoiceQueueReport'];(function(_0xc1d691,_0x166b6e){var _0x16ac7=function(_0x134adc){while(--_0x134adc){_0xc1d691['push'](_0xc1d691['shift']());}};_0x16ac7(++_0x166b6e);}(_0x52eb,0x174));var _0xb52e=function(_0x221ba2,_0x79208){_0x221ba2=_0x221ba2-0x0;var _0x47d08e=_0x52eb[_0x221ba2];return _0x47d08e;};'use strict';var _=require(_0xb52e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb52e('0x1'));var rs=require(_0xb52e('0x2'));var fs=require('fs');var Redis=require(_0xb52e('0x3'));var db=require(_0xb52e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb52e('0x5'))(_0xb52e('0x6'));var config=require(_0xb52e('0x7'));var jayson=require(_0xb52e('0x8'));var client=jayson[_0xb52e('0x9')]['http']({'port':0x232a});config[_0xb52e('0xa')]=_[_0xb52e('0xb')](config['redis'],{'host':_0xb52e('0xc'),'port':0x18eb});var socket=require(_0xb52e('0xd'))(new Redis(config[_0xb52e('0xa')]));require(_0xb52e('0xe'))[_0xb52e('0xf')](socket);function respondWithRpcPromise(_0x41aa13,_0x5f1fad,_0x541238){return new BPromise(function(_0x57ff33,_0x2cd0af){return client[_0xb52e('0x10')](_0x41aa13,_0x541238)[_0xb52e('0x11')](function(_0x422dc9){logger[_0xb52e('0x12')](_0xb52e('0x13'),_0x5f1fad,'request\x20sent');logger[_0xb52e('0x14')](_0xb52e('0x15'),_0x5f1fad,_0xb52e('0x16'),JSON[_0xb52e('0x17')](_0x422dc9));if(_0x422dc9[_0xb52e('0x18')]){if(_0x422dc9[_0xb52e('0x18')]['code']===0x1f4){logger[_0xb52e('0x18')](_0xb52e('0x13'),_0x5f1fad,_0x422dc9['error'][_0xb52e('0x19')]);return _0x2cd0af(_0x422dc9[_0xb52e('0x18')]['message']);}logger[_0xb52e('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x5f1fad,_0x422dc9[_0xb52e('0x18')]['message']);return _0x57ff33(_0x422dc9[_0xb52e('0x18')]['message']);}else{logger[_0xb52e('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x5f1fad,_0xb52e('0x16'));_0x57ff33(_0x422dc9['result'][_0xb52e('0x19')]);}})[_0xb52e('0x1a')](function(_0x10ac3d){logger[_0xb52e('0x18')](_0xb52e('0x13'),_0x5f1fad,_0x10ac3d);_0x2cd0af(_0x10ac3d);});});}exports['GetVoiceQueueReport']=function(_0x81596d){var _0x3037e9=this;return new Promise(function(_0x3f83f3,_0x1fde20){return db[_0xb52e('0x1b')][_0xb52e('0x1c')]({'raw':_0x81596d[_0xb52e('0x1d')]?_0x81596d[_0xb52e('0x1d')][_0xb52e('0x1e')]===undefined?!![]:![]:!![],'where':_0x81596d[_0xb52e('0x1d')]?_0x81596d[_0xb52e('0x1d')][_0xb52e('0x1f')]||null:null,'attributes':_0x81596d[_0xb52e('0x1d')]?_0x81596d['options'][_0xb52e('0x20')]||null:null,'limit':_0x81596d[_0xb52e('0x1d')]?_0x81596d['options'][_0xb52e('0x21')]||null:null,'include':_0x81596d[_0xb52e('0x1d')]?_0x81596d[_0xb52e('0x1d')][_0xb52e('0x22')]?_['map'](_0x81596d['options'][_0xb52e('0x22')],function(_0x147416){return{'model':db[_0x147416[_0xb52e('0x23')]],'as':_0x147416['as'],'attributes':_0x147416[_0xb52e('0x20')],'include':_0x147416[_0xb52e('0x22')]?_['map'](_0x147416[_0xb52e('0x22')],function(_0x471af8){return{'model':db[_0x471af8[_0xb52e('0x23')]],'as':_0x471af8['as'],'attributes':_0x471af8[_0xb52e('0x20')],'include':_0x471af8[_0xb52e('0x22')]?_[_0xb52e('0x24')](_0x471af8[_0xb52e('0x22')],function(_0x367e91){return{'model':db[_0x367e91[_0xb52e('0x23')]],'as':_0x367e91['as'],'attributes':_0x367e91[_0xb52e('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb52e('0x11')](function(_0x4cec28){logger[_0xb52e('0x12')](_0xb52e('0x25'),_0x81596d);logger[_0xb52e('0x14')](_0xb52e('0x25'),_0x81596d,JSON[_0xb52e('0x17')](_0x4cec28));_0x3f83f3(_0x4cec28);})[_0xb52e('0x1a')](function(_0x92eab1){logger['error'](_0xb52e('0x25'),_0x92eab1[_0xb52e('0x19')],_0x81596d);_0x1fde20(_0x3037e9[_0xb52e('0x18')](0x1f4,_0x92eab1[_0xb52e('0x19')]));});});};exports['CreateVoiceQueueReport']=function(_0x35ab02){var _0x2ac81a=this;return new Promise(function(_0x3d7eab,_0x1af6d5){return db[_0xb52e('0x1b')]['create'](_0x35ab02[_0xb52e('0x26')],{'raw':_0x35ab02[_0xb52e('0x1d')]?_0x35ab02['options'][_0xb52e('0x1e')]===undefined?!![]:![]:!![]})[_0xb52e('0x11')](function(_0x52353c){logger[_0xb52e('0x12')]('CreateVoiceQueueReport',_0x35ab02);logger[_0xb52e('0x14')](_0xb52e('0x27'),_0x35ab02,JSON[_0xb52e('0x17')](_0x52353c));_0x3d7eab(_0x52353c);})[_0xb52e('0x1a')](function(_0x51e333){logger[_0xb52e('0x18')](_0xb52e('0x27'),_0x51e333[_0xb52e('0x19')],_0x35ab02);_0x1af6d5(_0x2ac81a[_0xb52e('0x18')](0x1f4,_0x51e333[_0xb52e('0x19')]));});});};exports['UpdateVoiceQueueReport']=function(_0xf5590f){var _0x58da4c=this;return new Promise(function(_0x2d8443,_0x15d22a){return db[_0xb52e('0x1b')]['update'](_0xf5590f[_0xb52e('0x26')],{'raw':_0xf5590f[_0xb52e('0x1d')]?_0xf5590f[_0xb52e('0x1d')][_0xb52e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf5590f[_0xb52e('0x1d')]?_0xf5590f[_0xb52e('0x1d')][_0xb52e('0x1f')]||null:null,'attributes':_0xf5590f['options']?_0xf5590f[_0xb52e('0x1d')][_0xb52e('0x20')]||null:null,'limit':_0xf5590f['options']?_0xf5590f[_0xb52e('0x1d')]['limit']||null:null})['then'](function(_0x3c2e22){logger[_0xb52e('0x12')](_0xb52e('0x28'),_0xf5590f);logger[_0xb52e('0x14')](_0xb52e('0x28'),_0xf5590f,JSON[_0xb52e('0x17')](_0x3c2e22));_0x2d8443(_0x3c2e22);})[_0xb52e('0x1a')](function(_0x2c195c){logger[_0xb52e('0x18')](_0xb52e('0x28'),_0x2c195c['message'],_0xf5590f);_0x15d22a(_0x58da4c[_0xb52e('0x18')](0x1f4,_0x2c195c[_0xb52e('0x19')]));});});}; \ No newline at end of file +var _0x7311=['redis','defaults','socket.io-emitter','./voiceQueueReport.socket','then','info','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','debug','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5ce15c,_0x19c917){var _0x36e4f5=function(_0x50fa90){while(--_0x50fa90){_0x5ce15c['push'](_0x5ce15c['shift']());}};_0x36e4f5(++_0x19c917);}(_0x7311,0xcb));var _0x1731=function(_0x25b92e,_0x59e7d2){_0x25b92e=_0x25b92e-0x0;var _0x493b10=_0x7311[_0x25b92e];return _0x493b10;};'use strict';var _=require(_0x1731('0x0'));var util=require(_0x1731('0x1'));var moment=require(_0x1731('0x2'));var BPromise=require(_0x1731('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1731('0x4'))['db'];var utils=require(_0x1731('0x5'));var logger=require(_0x1731('0x6'))(_0x1731('0x7'));var config=require(_0x1731('0x8'));var jayson=require(_0x1731('0x9'));var client=jayson[_0x1731('0xa')][_0x1731('0xb')]({'port':0x232a});config[_0x1731('0xc')]=_[_0x1731('0xd')](config[_0x1731('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x1731('0xe'))(new Redis(config['redis']));require(_0x1731('0xf'))['register'](socket);function respondWithRpcPromise(_0x35abdc,_0x4d6ea7,_0x377366){return new BPromise(function(_0x44d54f,_0x139f79){return client['request'](_0x35abdc,_0x377366)[_0x1731('0x10')](function(_0x13961d){logger[_0x1731('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x4d6ea7,'request\x20sent');logger['debug'](_0x1731('0x12'),_0x4d6ea7,'request\x20sent',JSON[_0x1731('0x13')](_0x13961d));if(_0x13961d['error']){if(_0x13961d['error'][_0x1731('0x14')]===0x1f4){logger[_0x1731('0x15')](_0x1731('0x16'),_0x4d6ea7,_0x13961d[_0x1731('0x15')][_0x1731('0x17')]);return _0x139f79(_0x13961d['error'][_0x1731('0x17')]);}logger[_0x1731('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x4d6ea7,_0x13961d[_0x1731('0x15')]['message']);return _0x44d54f(_0x13961d[_0x1731('0x15')][_0x1731('0x17')]);}else{logger['info'](_0x1731('0x16'),_0x4d6ea7,'request\x20sent');_0x44d54f(_0x13961d[_0x1731('0x18')][_0x1731('0x17')]);}})[_0x1731('0x19')](function(_0xf01a69){logger[_0x1731('0x15')](_0x1731('0x16'),_0x4d6ea7,_0xf01a69);_0x139f79(_0xf01a69);});});}exports[_0x1731('0x1a')]=function(_0x29fba1){var _0x43ec4c=this;return new Promise(function(_0x358285,_0x36e774){return db[_0x1731('0x1b')][_0x1731('0x1c')]({'raw':_0x29fba1[_0x1731('0x1d')]?_0x29fba1[_0x1731('0x1d')][_0x1731('0x1e')]===undefined?!![]:![]:!![],'where':_0x29fba1[_0x1731('0x1d')]?_0x29fba1[_0x1731('0x1d')][_0x1731('0x1f')]||null:null,'attributes':_0x29fba1[_0x1731('0x1d')]?_0x29fba1['options'][_0x1731('0x20')]||null:null,'limit':_0x29fba1[_0x1731('0x1d')]?_0x29fba1[_0x1731('0x1d')][_0x1731('0x21')]||null:null,'include':_0x29fba1['options']?_0x29fba1[_0x1731('0x1d')][_0x1731('0x22')]?_[_0x1731('0x23')](_0x29fba1[_0x1731('0x1d')][_0x1731('0x22')],function(_0x1cdd69){return{'model':db[_0x1cdd69[_0x1731('0x24')]],'as':_0x1cdd69['as'],'attributes':_0x1cdd69[_0x1731('0x20')],'include':_0x1cdd69[_0x1731('0x22')]?_[_0x1731('0x23')](_0x1cdd69[_0x1731('0x22')],function(_0x211b75){return{'model':db[_0x211b75[_0x1731('0x24')]],'as':_0x211b75['as'],'attributes':_0x211b75[_0x1731('0x20')],'include':_0x211b75['include']?_['map'](_0x211b75[_0x1731('0x22')],function(_0xeec158){return{'model':db[_0xeec158['model']],'as':_0xeec158['as'],'attributes':_0xeec158[_0x1731('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1731('0x10')](function(_0x5604a4){logger[_0x1731('0x11')](_0x1731('0x1a'),_0x29fba1);logger[_0x1731('0x25')](_0x1731('0x1a'),_0x29fba1,JSON['stringify'](_0x5604a4));_0x358285(_0x5604a4);})[_0x1731('0x19')](function(_0x3c2230){logger[_0x1731('0x15')](_0x1731('0x1a'),_0x3c2230[_0x1731('0x17')],_0x29fba1);_0x36e774(_0x43ec4c[_0x1731('0x15')](0x1f4,_0x3c2230[_0x1731('0x17')]));});});};exports[_0x1731('0x26')]=function(_0x56a90){var _0x32118d=this;return new Promise(function(_0x1366c5,_0x19a63c){return db[_0x1731('0x1b')][_0x1731('0x27')](_0x56a90[_0x1731('0x28')],{'raw':_0x56a90[_0x1731('0x1d')]?_0x56a90['options'][_0x1731('0x1e')]===undefined?!![]:![]:!![]})[_0x1731('0x10')](function(_0x403800){logger[_0x1731('0x11')]('CreateVoiceQueueReport',_0x56a90);logger[_0x1731('0x25')](_0x1731('0x26'),_0x56a90,JSON['stringify'](_0x403800));_0x1366c5(_0x403800);})['catch'](function(_0x641c08){logger[_0x1731('0x15')]('CreateVoiceQueueReport',_0x641c08[_0x1731('0x17')],_0x56a90);_0x19a63c(_0x32118d[_0x1731('0x15')](0x1f4,_0x641c08[_0x1731('0x17')]));});});};exports[_0x1731('0x29')]=function(_0x101922){var _0x412450=this;return new Promise(function(_0x401abc,_0x1fc2b6){return db[_0x1731('0x1b')][_0x1731('0x2a')](_0x101922[_0x1731('0x28')],{'raw':_0x101922['options']?_0x101922[_0x1731('0x1d')][_0x1731('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x101922['options']?_0x101922[_0x1731('0x1d')][_0x1731('0x1f')]||null:null,'attributes':_0x101922['options']?_0x101922[_0x1731('0x1d')][_0x1731('0x20')]||null:null,'limit':_0x101922[_0x1731('0x1d')]?_0x101922[_0x1731('0x1d')][_0x1731('0x21')]||null:null})['then'](function(_0x456f2f){logger[_0x1731('0x11')](_0x1731('0x29'),_0x101922);logger[_0x1731('0x25')](_0x1731('0x29'),_0x101922,JSON['stringify'](_0x456f2f));_0x401abc(_0x456f2f);})[_0x1731('0x19')](function(_0x4528a5){logger[_0x1731('0x15')](_0x1731('0x29'),_0x4528a5[_0x1731('0x17')],_0x101922);_0x1fc2b6(_0x412450[_0x1731('0x15')](0x1f4,_0x4528a5[_0x1731('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 4991133..839bba8 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 _0xd10b=['voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','removeListener','length'];(function(_0x2247c9,_0x5bfa79){var _0x1994c1=function(_0x40adac){while(--_0x40adac){_0x2247c9['push'](_0x2247c9['shift']());}};_0x1994c1(++_0x5bfa79);}(_0xd10b,0x189));var _0xbd10=function(_0x344906,_0xa8bbb6){_0x344906=_0x344906-0x0;var _0x4f2757=_0xd10b[_0x344906];return _0x4f2757;};'use strict';var VoiceQueueReportEvents=require(_0xbd10('0x0'));var events=[_0xbd10('0x1'),_0xbd10('0x2'),_0xbd10('0x3')];function createListener(_0x276b3f,_0x4493bc){return function(_0x1c0d0b){_0x4493bc[_0xbd10('0x4')](_0x276b3f,_0x1c0d0b);};}function removeListener(_0x48ae53,_0x4beff1){return function(){VoiceQueueReportEvents[_0xbd10('0x5')](_0x48ae53,_0x4beff1);};}exports['register']=function(_0x57460a){for(var _0x106d5e=0x0,_0x3d32b0=events[_0xbd10('0x6')];_0x106d5e<_0x3d32b0;_0x106d5e++){var _0x27c0d4=events[_0x106d5e];var _0x1e87f6=createListener(_0xbd10('0x7')+_0x27c0d4,_0x57460a);VoiceQueueReportEvents['on'](_0x27c0d4,_0x1e87f6);}}; \ No newline at end of file +var _0x2f74=['emit','length','voiceQueueReport:','./voiceQueueReport.events','remove','update'];(function(_0x644ecd,_0x397f36){var _0x1c66ce=function(_0x4cf42b){while(--_0x4cf42b){_0x644ecd['push'](_0x644ecd['shift']());}};_0x1c66ce(++_0x397f36);}(_0x2f74,0x7b));var _0x42f7=function(_0xecab6a,_0x3c768a){_0xecab6a=_0xecab6a-0x0;var _0x40b98b=_0x2f74[_0xecab6a];return _0x40b98b;};'use strict';var VoiceQueueReportEvents=require(_0x42f7('0x0'));var events=['save',_0x42f7('0x1'),_0x42f7('0x2')];function createListener(_0x1563f9,_0x34cb81){return function(_0xe8cf60){_0x34cb81[_0x42f7('0x3')](_0x1563f9,_0xe8cf60);};}function removeListener(_0x43a650,_0x16d639){return function(){VoiceQueueReportEvents['removeListener'](_0x43a650,_0x16d639);};}exports['register']=function(_0x540e53){for(var _0x250aa9=0x0,_0x1cb6e0=events[_0x42f7('0x4')];_0x250aa9<_0x1cb6e0;_0x250aa9++){var _0x36b55e=events[_0x250aa9];var _0x2c64b2=createListener(_0x42f7('0x5')+_0x36b55e,_0x540e53);VoiceQueueReportEvents['on'](_0x36b55e,_0x2c64b2);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 2c76c91..90ef9a5 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 _0x396d=['isAuthenticated','index','/:id','create','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','get'];(function(_0x5cfcef,_0x20d843){var _0x21df12=function(_0x4ae7a8){while(--_0x4ae7a8){_0x5cfcef['push'](_0x5cfcef['shift']());}};_0x21df12(++_0x20d843);}(_0x396d,0x97));var _0xd396=function(_0x10146e,_0x1cb55c){_0x10146e=_0x10146e-0x0;var _0x2899d1=_0x396d[_0x10146e];return _0x2899d1;};'use strict';var multer=require('multer');var util=require(_0xd396('0x0'));var path=require(_0xd396('0x1'));var timeout=require(_0xd396('0x2'));var express=require(_0xd396('0x3'));var router=express['Router']();var fs_extra=require(_0xd396('0x4'));var auth=require(_0xd396('0x5'));var interaction=require(_0xd396('0x6'));var config=require('../../config/environment');var controller=require(_0xd396('0x7'));router[_0xd396('0x8')]('/',auth[_0xd396('0x9')](),controller[_0xd396('0xa')]);router['get'](_0xd396('0xb'),auth[_0xd396('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xd396('0xc')]);router['put'](_0xd396('0xb'),auth[_0xd396('0x9')](),controller[_0xd396('0xd')]);router[_0xd396('0xe')](_0xd396('0xb'),auth[_0xd396('0x9')](),controller[_0xd396('0xf')]);module['exports']=router; \ No newline at end of file +var _0xf2cb=['../../components/interaction/service','get','isAuthenticated','index','post','put','/:id','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xf2cb,0x130));var _0xbf2c=function(_0x5f9e69,_0x1ccb44){_0x5f9e69=_0x5f9e69-0x0;var _0x5418ad=_0xf2cb[_0x5f9e69];return _0x5418ad;};'use strict';var multer=require('multer');var util=require(_0xbf2c('0x0'));var path=require('path');var timeout=require(_0xbf2c('0x1'));var express=require('express');var router=express[_0xbf2c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xbf2c('0x3'));var interaction=require(_0xbf2c('0x4'));var config=require('../../config/environment');var controller=require('./voiceQueuesLog.controller');router[_0xbf2c('0x5')]('/',auth[_0xbf2c('0x6')](),controller[_0xbf2c('0x7')]);router[_0xbf2c('0x5')]('/:id',auth[_0xbf2c('0x6')](),controller['show']);router[_0xbf2c('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbf2c('0x9')](_0xbf2c('0xa'),auth[_0xbf2c('0x6')](),controller['update']);router[_0xbf2c('0xb')](_0xbf2c('0xa'),auth[_0xbf2c('0x6')](),controller[_0xbf2c('0xc')]);module[_0xbf2c('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 011c428..ae7cb27 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 _0x1051=['sequelize','moment','exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1051,0x18f));var _0x1105=function(_0x4eebd9,_0x57afb9){_0x4eebd9=_0x4eebd9-0x0;var _0x1d6117=_0x1051[_0x4eebd9];return _0x1d6117;};'use strict';var Sequelize=require(_0x1105('0x0'));var moment=require(_0x1105('0x1'));module[_0x1105('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x1105('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x1105('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x1105('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x1105('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x1105('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x1105('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x1105('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x1105('0x5')](_0x1105('0x6'))}}; \ No newline at end of file +var _0xdcb5=['literal','moment','exports','STRING'];(function(_0x2880c8,_0x3d71ed){var _0xe78133=function(_0x525afb){while(--_0x525afb){_0x2880c8['push'](_0x2880c8['shift']());}};_0xe78133(++_0x3d71ed);}(_0xdcb5,0x1dd));var _0x5dcb=function(_0x416b0f,_0x138479){_0x416b0f=_0x416b0f-0x0;var _0x580f27=_0xdcb5[_0x416b0f];return _0x580f27;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5dcb('0x0'));module[_0x5dcb('0x1')]={'time':{'type':Sequelize[_0x5dcb('0x2')]},'callid':{'type':Sequelize[_0x5dcb('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x5dcb('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x5dcb('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x5dcb('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x5dcb('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x5dcb('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x5dcb('0x3')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 4e64e95..4187c3d 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 _0x3b0e=['fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','filters','pick','where','merge','VIRTUAL','filter','options','include','findAll','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes'];(function(_0x5484e9,_0x43585d){var _0x5bb7c7=function(_0x3a7c7f){while(--_0x3a7c7f){_0x5484e9['push'](_0x5484e9['shift']());}};_0x5bb7c7(++_0x43585d);}(_0x3b0e,0x1cb));var _0xe3b0=function(_0xbed45a,_0x85575b){_0xbed45a=_0xbed45a-0x0;var _0x51e5e4=_0x3b0e[_0xbed45a];return _0x51e5e4;};'use strict';var emlformat=require(_0xe3b0('0x0'));var rimraf=require(_0xe3b0('0x1'));var zipdir=require(_0xe3b0('0x2'));var jsonpatch=require(_0xe3b0('0x3'));var rp=require('request-promise');var moment=require(_0xe3b0('0x4'));var BPromise=require(_0xe3b0('0x5'));var Mustache=require(_0xe3b0('0x6'));var util=require('util');var path=require(_0xe3b0('0x7'));var sox=require(_0xe3b0('0x8'));var csv=require(_0xe3b0('0x9'));var ejs=require(_0xe3b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe3b0('0xb'));var _=require(_0xe3b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe3b0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe3b0('0x9'));var querystring=require(_0xe3b0('0xe'));var Papa=require('papaparse');var Redis=require(_0xe3b0('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe3b0('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe3b0('0x11'))(_0xe3b0('0x12'));var utils=require(_0xe3b0('0x13'));var config=require(_0xe3b0('0x14'));var licenseUtil=require(_0xe3b0('0x15'));var db=require(_0xe3b0('0x16'))['db'];function respondWithStatusCode(_0x2294fa,_0x16d804){_0x16d804=_0x16d804||0xcc;return function(_0x363938){if(_0x363938){return _0x2294fa[_0xe3b0('0x17')](_0x16d804);}return _0x2294fa[_0xe3b0('0x18')](_0x16d804)[_0xe3b0('0x19')]();};}function respondWithResult(_0x5a0222,_0x1f1dde){_0x1f1dde=_0x1f1dde||0xc8;return function(_0x4a15df){if(_0x4a15df){return _0x5a0222['status'](_0x1f1dde)[_0xe3b0('0x1a')](_0x4a15df);}};}function respondWithFilteredResult(_0x4128e1,_0xea69a5){return function(_0x37de48){if(_0x37de48){var _0x1190b8=typeof _0xea69a5[_0xe3b0('0x1b')]===_0xe3b0('0x1c')&&typeof _0xea69a5[_0xe3b0('0x1d')]===_0xe3b0('0x1c');var _0x1cf81c=_0x37de48[_0xe3b0('0x1e')];var _0x4e822f=_0x1190b8?0x0:_0xea69a5[_0xe3b0('0x1b')];var _0x3b78a9=_0x1190b8?_0x37de48[_0xe3b0('0x1e')]:_0xea69a5[_0xe3b0('0x1b')]+_0xea69a5[_0xe3b0('0x1d')];var _0x205b02;if(_0x3b78a9>=_0x1cf81c){_0x3b78a9=_0x1cf81c;_0x205b02=0xc8;}else{_0x205b02=0xce;}_0x4128e1[_0xe3b0('0x18')](_0x205b02);return _0x4128e1[_0xe3b0('0x1f')](_0xe3b0('0x20'),_0x4e822f+'-'+_0x3b78a9+'/'+_0x1cf81c)[_0xe3b0('0x1a')](_0x37de48);}return null;};}function patchUpdates(_0x463bac){return function(_0x47bf69){try{jsonpatch[_0xe3b0('0x21')](_0x47bf69,_0x463bac,!![]);}catch(_0x403950){return BPromise['reject'](_0x403950);}return _0x47bf69[_0xe3b0('0x22')]();};}function saveUpdates(_0x1f9695,_0x5c314f){return function(_0x269672){if(_0x269672){return _0x269672[_0xe3b0('0x23')](_0x1f9695)[_0xe3b0('0x24')](function(_0x6f5495){return _0x6f5495;});}return null;};}function removeEntity(_0x5aa154,_0x440337){return function(_0x306bf9){if(_0x306bf9){return _0x306bf9['destroy']()['then'](function(){_0x5aa154[_0xe3b0('0x18')](0xcc)[_0xe3b0('0x19')]();});}};}function handleEntityNotFound(_0x1434d8,_0x4ce909){return function(_0x283dfe){if(!_0x283dfe){_0x1434d8[_0xe3b0('0x17')](0x194);}return _0x283dfe;};}function handleError(_0x351e69,_0x3dd3c9){_0x3dd3c9=_0x3dd3c9||0x1f4;return function(_0x4f40d9){logger[_0xe3b0('0x25')](_0x4f40d9[_0xe3b0('0x26')]);if(_0x4f40d9[_0xe3b0('0x27')]){delete _0x4f40d9[_0xe3b0('0x27')];}_0x351e69[_0xe3b0('0x18')](_0x3dd3c9)[_0xe3b0('0x28')](_0x4f40d9);};}exports[_0xe3b0('0x29')]=function(_0x4ca60e,_0x471421){var _0x197058={},_0x4f483e={},_0x2d14fb={'count':0x0,'rows':[]};var _0x169745=_[_0xe3b0('0x2a')](db[_0xe3b0('0x2b')][_0xe3b0('0x2c')],function(_0x27a4d0){return{'name':_0x27a4d0[_0xe3b0('0x2d')],'type':_0x27a4d0[_0xe3b0('0x2e')][_0xe3b0('0x2f')]};});_0x4f483e[_0xe3b0('0x30')]=_[_0xe3b0('0x2a')](_0x169745,_0xe3b0('0x27'));_0x4f483e[_0xe3b0('0x31')]=_[_0xe3b0('0x32')](_0x4ca60e['query']);_0x4f483e['filters']=_[_0xe3b0('0x33')](_0x4f483e[_0xe3b0('0x30')],_0x4f483e[_0xe3b0('0x31')]);_0x197058[_0xe3b0('0x34')]=_['intersection'](_0x4f483e['model'],qs[_0xe3b0('0x35')](_0x4ca60e[_0xe3b0('0x31')][_0xe3b0('0x35')]));_0x197058[_0xe3b0('0x34')]=_0x197058[_0xe3b0('0x34')]['length']?_0x197058[_0xe3b0('0x34')]:_0x4f483e['model'];if(!_0x4ca60e[_0xe3b0('0x31')][_0xe3b0('0x36')]('nolimit')){_0x197058[_0xe3b0('0x1d')]=qs['limit'](_0x4ca60e[_0xe3b0('0x31')][_0xe3b0('0x1d')]);_0x197058[_0xe3b0('0x1b')]=qs[_0xe3b0('0x1b')](_0x4ca60e[_0xe3b0('0x31')][_0xe3b0('0x1b')]);}_0x197058['order']=qs[_0xe3b0('0x37')](_0x4ca60e[_0xe3b0('0x31')][_0xe3b0('0x37')]);_0x197058['where']=qs[_0xe3b0('0x38')](_[_0xe3b0('0x39')](_0x4ca60e[_0xe3b0('0x31')],_0x4f483e[_0xe3b0('0x38')]),_0x169745);if(_0x4ca60e[_0xe3b0('0x31')]['filter']){_0x197058[_0xe3b0('0x3a')]=_[_0xe3b0('0x3b')](_0x197058[_0xe3b0('0x3a')],{'$or':_[_0xe3b0('0x2a')](_0x169745,function(_0x49be8b){if(_0x49be8b[_0xe3b0('0x2e')]!==_0xe3b0('0x3c')){var _0x285198={};_0x285198[_0x49be8b['name']]={'$like':'%'+_0x4ca60e['query'][_0xe3b0('0x3d')]+'%'};return _0x285198;}})});}_0x197058=_[_0xe3b0('0x3b')]({},_0x197058,_0x4ca60e[_0xe3b0('0x3e')]);var _0x1ebbed={'where':_0x197058[_0xe3b0('0x3a')]};return db['VoiceQueuesLog'][_0xe3b0('0x1e')](_0x1ebbed)[_0xe3b0('0x24')](function(_0x5df3e1){_0x2d14fb[_0xe3b0('0x1e')]=_0x5df3e1;if(_0x4ca60e[_0xe3b0('0x31')]['includeAll']){_0x197058[_0xe3b0('0x3f')]=[{'all':!![]}];}return db[_0xe3b0('0x2b')][_0xe3b0('0x40')](_0x197058);})[_0xe3b0('0x24')](function(_0x53e1d9){_0x2d14fb['rows']=_0x53e1d9;return _0x2d14fb;})['then'](respondWithFilteredResult(_0x471421,_0x197058))[_0xe3b0('0x41')](handleError(_0x471421,null));};exports[_0xe3b0('0x42')]=function(_0x113c88,_0x590a31){var _0x388a17={'raw':!![],'where':{'id':_0x113c88[_0xe3b0('0x43')]['id']}},_0x48b20c={};_0x48b20c[_0xe3b0('0x30')]=_['keys'](db[_0xe3b0('0x2b')][_0xe3b0('0x2c')]);_0x48b20c[_0xe3b0('0x31')]=_[_0xe3b0('0x32')](_0x113c88[_0xe3b0('0x31')]);_0x48b20c['filters']=_[_0xe3b0('0x33')](_0x48b20c[_0xe3b0('0x30')],_0x48b20c[_0xe3b0('0x31')]);_0x388a17[_0xe3b0('0x34')]=_[_0xe3b0('0x33')](_0x48b20c[_0xe3b0('0x30')],qs[_0xe3b0('0x35')](_0x113c88[_0xe3b0('0x31')][_0xe3b0('0x35')]));_0x388a17['attributes']=_0x388a17[_0xe3b0('0x34')][_0xe3b0('0x44')]?_0x388a17['attributes']:_0x48b20c[_0xe3b0('0x30')];if(_0x113c88[_0xe3b0('0x31')]['includeAll']){_0x388a17[_0xe3b0('0x3f')]=[{'all':!![]}];}_0x388a17=_[_0xe3b0('0x3b')]({},_0x388a17,_0x113c88['options']);return db['VoiceQueuesLog'][_0xe3b0('0x45')](_0x388a17)['then'](handleEntityNotFound(_0x590a31,null))[_0xe3b0('0x24')](respondWithResult(_0x590a31,null))[_0xe3b0('0x41')](handleError(_0x590a31,null));};exports[_0xe3b0('0x46')]=function(_0x568e71,_0x44bca0){return db[_0xe3b0('0x2b')][_0xe3b0('0x46')](_0x568e71[_0xe3b0('0x47')],{})[_0xe3b0('0x24')](respondWithResult(_0x44bca0,0xc9))['catch'](handleError(_0x44bca0,null));};exports[_0xe3b0('0x23')]=function(_0x44c9f6,_0x55e5a7){if(_0x44c9f6['body']['id']){delete _0x44c9f6[_0xe3b0('0x47')]['id'];}return db[_0xe3b0('0x2b')]['find']({'where':{'id':_0x44c9f6[_0xe3b0('0x43')]['id']}})[_0xe3b0('0x24')](handleEntityNotFound(_0x55e5a7,null))[_0xe3b0('0x24')](saveUpdates(_0x44c9f6[_0xe3b0('0x47')],null))[_0xe3b0('0x24')](respondWithResult(_0x55e5a7,null))['catch'](handleError(_0x55e5a7,null));};exports['destroy']=function(_0x1c1bc3,_0x238411){return db['VoiceQueuesLog'][_0xe3b0('0x45')]({'where':{'id':_0x1c1bc3['params']['id']}})[_0xe3b0('0x24')](handleEntityNotFound(_0x238411,null))['then'](removeEntity(_0x238411,null))['catch'](handleError(_0x238411,null));}; \ No newline at end of file +var _0xfbb6=['reject','save','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','key','keys','query','intersection','model','attributes','fields','length','order','sort','pick','filters','filter','where','type','VIRTUAL','options','count','include','rows','catch','params','includeAll','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','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','status','end','offset','limit','undefined','set','Content-Range','json','apply'];(function(_0x283991,_0x23c1e6){var _0x233f0a=function(_0x638eae){while(--_0x638eae){_0x283991['push'](_0x283991['shift']());}};_0x233f0a(++_0x23c1e6);}(_0xfbb6,0xc1));var _0x6fbb=function(_0x23c3f4,_0x24f0b3){_0x23c3f4=_0x23c3f4-0x0;var _0x82f0f1=_0xfbb6[_0x23c3f4];return _0x82f0f1;};'use strict';var emlformat=require(_0x6fbb('0x0'));var rimraf=require(_0x6fbb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6fbb('0x2'));var rp=require(_0x6fbb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6fbb('0x4'));var util=require('util');var path=require(_0x6fbb('0x5'));var sox=require(_0x6fbb('0x6'));var csv=require(_0x6fbb('0x7'));var ejs=require(_0x6fbb('0x8'));var fs=require('fs');var fs_extra=require(_0x6fbb('0x9'));var _=require(_0x6fbb('0xa'));var squel=require(_0x6fbb('0xb'));var crypto=require(_0x6fbb('0xc'));var jsforce=require(_0x6fbb('0xd'));var deskjs=require(_0x6fbb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6fbb('0xf'));var Papa=require(_0x6fbb('0x10'));var Redis=require(_0x6fbb('0x11'));var authService=require(_0x6fbb('0x12'));var qs=require(_0x6fbb('0x13'));var as=require(_0x6fbb('0x14'));var hardwareService=require(_0x6fbb('0x15'));var logger=require(_0x6fbb('0x16'))(_0x6fbb('0x17'));var utils=require(_0x6fbb('0x18'));var config=require(_0x6fbb('0x19'));var licenseUtil=require(_0x6fbb('0x1a'));var db=require(_0x6fbb('0x1b'))['db'];function respondWithStatusCode(_0x263497,_0xdef607){_0xdef607=_0xdef607||0xcc;return function(_0x500f06){if(_0x500f06){return _0x263497[_0x6fbb('0x1c')](_0xdef607);}return _0x263497[_0x6fbb('0x1d')](_0xdef607)[_0x6fbb('0x1e')]();};}function respondWithResult(_0x58e62d,_0x27f3ab){_0x27f3ab=_0x27f3ab||0xc8;return function(_0x5868e9){if(_0x5868e9){return _0x58e62d[_0x6fbb('0x1d')](_0x27f3ab)['json'](_0x5868e9);}};}function respondWithFilteredResult(_0x555789,_0xebc799){return function(_0x16d52e){if(_0x16d52e){var _0x5ab1f0=typeof _0xebc799[_0x6fbb('0x1f')]==='undefined'&&typeof _0xebc799[_0x6fbb('0x20')]===_0x6fbb('0x21');var _0x55374f=_0x16d52e['count'];var _0x13d9a8=_0x5ab1f0?0x0:_0xebc799[_0x6fbb('0x1f')];var _0x3b964e=_0x5ab1f0?_0x16d52e['count']:_0xebc799[_0x6fbb('0x1f')]+_0xebc799[_0x6fbb('0x20')];var _0x5d4ad8;if(_0x3b964e>=_0x55374f){_0x3b964e=_0x55374f;_0x5d4ad8=0xc8;}else{_0x5d4ad8=0xce;}_0x555789[_0x6fbb('0x1d')](_0x5d4ad8);return _0x555789[_0x6fbb('0x22')](_0x6fbb('0x23'),_0x13d9a8+'-'+_0x3b964e+'/'+_0x55374f)[_0x6fbb('0x24')](_0x16d52e);}return null;};}function patchUpdates(_0x4a18b3){return function(_0x45ee6e){try{jsonpatch[_0x6fbb('0x25')](_0x45ee6e,_0x4a18b3,!![]);}catch(_0x50e6a1){return BPromise[_0x6fbb('0x26')](_0x50e6a1);}return _0x45ee6e[_0x6fbb('0x27')]();};}function saveUpdates(_0xdda43e,_0x32aee4){return function(_0x59c6f6){if(_0x59c6f6){return _0x59c6f6['update'](_0xdda43e)[_0x6fbb('0x28')](function(_0x3dbb86){return _0x3dbb86;});}return null;};}function removeEntity(_0x46ed03,_0x22ab49){return function(_0xcbfe76){if(_0xcbfe76){return _0xcbfe76[_0x6fbb('0x29')]()[_0x6fbb('0x28')](function(){_0x46ed03[_0x6fbb('0x1d')](0xcc)[_0x6fbb('0x1e')]();});}};}function handleEntityNotFound(_0x3c6fef,_0x465846){return function(_0x4b902b){if(!_0x4b902b){_0x3c6fef['sendStatus'](0x194);}return _0x4b902b;};}function handleError(_0x3fedf2,_0x5229d4){_0x5229d4=_0x5229d4||0x1f4;return function(_0x55780a){logger[_0x6fbb('0x2a')](_0x55780a[_0x6fbb('0x2b')]);if(_0x55780a['name']){delete _0x55780a[_0x6fbb('0x2c')];}_0x3fedf2['status'](_0x5229d4)[_0x6fbb('0x2d')](_0x55780a);};}exports[_0x6fbb('0x2e')]=function(_0x5558b1,_0x208a35){var _0xda8d70={},_0x168b9b={},_0x14d2f1={'count':0x0,'rows':[]};var _0x3e72ee=_[_0x6fbb('0x2f')](db[_0x6fbb('0x30')][_0x6fbb('0x31')],function(_0xd98da8){return{'name':_0xd98da8['fieldName'],'type':_0xd98da8['type'][_0x6fbb('0x32')]};});_0x168b9b['model']=_[_0x6fbb('0x2f')](_0x3e72ee,_0x6fbb('0x2c'));_0x168b9b['query']=_[_0x6fbb('0x33')](_0x5558b1[_0x6fbb('0x34')]);_0x168b9b['filters']=_[_0x6fbb('0x35')](_0x168b9b[_0x6fbb('0x36')],_0x168b9b[_0x6fbb('0x34')]);_0xda8d70[_0x6fbb('0x37')]=_[_0x6fbb('0x35')](_0x168b9b['model'],qs[_0x6fbb('0x38')](_0x5558b1[_0x6fbb('0x34')]['fields']));_0xda8d70[_0x6fbb('0x37')]=_0xda8d70[_0x6fbb('0x37')][_0x6fbb('0x39')]?_0xda8d70[_0x6fbb('0x37')]:_0x168b9b[_0x6fbb('0x36')];if(!_0x5558b1[_0x6fbb('0x34')]['hasOwnProperty']('nolimit')){_0xda8d70[_0x6fbb('0x20')]=qs[_0x6fbb('0x20')](_0x5558b1[_0x6fbb('0x34')][_0x6fbb('0x20')]);_0xda8d70[_0x6fbb('0x1f')]=qs[_0x6fbb('0x1f')](_0x5558b1[_0x6fbb('0x34')][_0x6fbb('0x1f')]);}_0xda8d70[_0x6fbb('0x3a')]=qs['sort'](_0x5558b1['query'][_0x6fbb('0x3b')]);_0xda8d70['where']=qs['filters'](_[_0x6fbb('0x3c')](_0x5558b1[_0x6fbb('0x34')],_0x168b9b[_0x6fbb('0x3d')]),_0x3e72ee);if(_0x5558b1[_0x6fbb('0x34')][_0x6fbb('0x3e')]){_0xda8d70[_0x6fbb('0x3f')]=_['merge'](_0xda8d70[_0x6fbb('0x3f')],{'$or':_[_0x6fbb('0x2f')](_0x3e72ee,function(_0x5c38d0){if(_0x5c38d0[_0x6fbb('0x40')]!==_0x6fbb('0x41')){var _0x283949={};_0x283949[_0x5c38d0[_0x6fbb('0x2c')]]={'$like':'%'+_0x5558b1['query'][_0x6fbb('0x3e')]+'%'};return _0x283949;}})});}_0xda8d70=_['merge']({},_0xda8d70,_0x5558b1[_0x6fbb('0x42')]);var _0x2c014b={'where':_0xda8d70[_0x6fbb('0x3f')]};return db[_0x6fbb('0x30')][_0x6fbb('0x43')](_0x2c014b)[_0x6fbb('0x28')](function(_0x3d5929){_0x14d2f1['count']=_0x3d5929;if(_0x5558b1['query']['includeAll']){_0xda8d70[_0x6fbb('0x44')]=[{'all':!![]}];}return db[_0x6fbb('0x30')]['findAll'](_0xda8d70);})[_0x6fbb('0x28')](function(_0x1b4580){_0x14d2f1[_0x6fbb('0x45')]=_0x1b4580;return _0x14d2f1;})['then'](respondWithFilteredResult(_0x208a35,_0xda8d70))[_0x6fbb('0x46')](handleError(_0x208a35,null));};exports['show']=function(_0x5741dc,_0x3e8ebb){var _0x14d829={'raw':!![],'where':{'id':_0x5741dc[_0x6fbb('0x47')]['id']}},_0x26088f={};_0x26088f['model']=_[_0x6fbb('0x33')](db[_0x6fbb('0x30')][_0x6fbb('0x31')]);_0x26088f[_0x6fbb('0x34')]=_[_0x6fbb('0x33')](_0x5741dc[_0x6fbb('0x34')]);_0x26088f[_0x6fbb('0x3d')]=_[_0x6fbb('0x35')](_0x26088f[_0x6fbb('0x36')],_0x26088f[_0x6fbb('0x34')]);_0x14d829[_0x6fbb('0x37')]=_[_0x6fbb('0x35')](_0x26088f[_0x6fbb('0x36')],qs[_0x6fbb('0x38')](_0x5741dc[_0x6fbb('0x34')][_0x6fbb('0x38')]));_0x14d829[_0x6fbb('0x37')]=_0x14d829[_0x6fbb('0x37')][_0x6fbb('0x39')]?_0x14d829[_0x6fbb('0x37')]:_0x26088f[_0x6fbb('0x36')];if(_0x5741dc[_0x6fbb('0x34')][_0x6fbb('0x48')]){_0x14d829[_0x6fbb('0x44')]=[{'all':!![]}];}_0x14d829=_['merge']({},_0x14d829,_0x5741dc[_0x6fbb('0x42')]);return db[_0x6fbb('0x30')][_0x6fbb('0x49')](_0x14d829)['then'](handleEntityNotFound(_0x3e8ebb,null))[_0x6fbb('0x28')](respondWithResult(_0x3e8ebb,null))['catch'](handleError(_0x3e8ebb,null));};exports[_0x6fbb('0x4a')]=function(_0x4df97b,_0x3c54fc){return db[_0x6fbb('0x30')]['create'](_0x4df97b[_0x6fbb('0x4b')],{})[_0x6fbb('0x28')](respondWithResult(_0x3c54fc,0xc9))[_0x6fbb('0x46')](handleError(_0x3c54fc,null));};exports[_0x6fbb('0x4c')]=function(_0x518c02,_0x598e4b){if(_0x518c02[_0x6fbb('0x4b')]['id']){delete _0x518c02[_0x6fbb('0x4b')]['id'];}return db[_0x6fbb('0x30')][_0x6fbb('0x49')]({'where':{'id':_0x518c02[_0x6fbb('0x47')]['id']}})[_0x6fbb('0x28')](handleEntityNotFound(_0x598e4b,null))[_0x6fbb('0x28')](saveUpdates(_0x518c02[_0x6fbb('0x4b')],null))['then'](respondWithResult(_0x598e4b,null))[_0x6fbb('0x46')](handleError(_0x598e4b,null));};exports['destroy']=function(_0x3c0883,_0x403ccb){return db[_0x6fbb('0x30')]['find']({'where':{'id':_0x3c0883[_0x6fbb('0x47')]['id']}})['then'](handleEntityNotFound(_0x403ccb,null))['then'](removeEntity(_0x403ccb,null))[_0x6fbb('0x46')](handleError(_0x403ccb,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index cee2e34..5f0991b 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 _0x63eb=['../../config/environment','./voiceQueuesLog.attributes','exports','event','dtm','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4084eb,_0x30c6ad){var _0x4c1f1c=function(_0x1ca12e){while(--_0x1ca12e){_0x4084eb['push'](_0x4084eb['shift']());}};_0x4c1f1c(++_0x30c6ad);}(_0x63eb,0x10d));var _0xb63e=function(_0x3d7d68,_0x2e5967){_0x3d7d68=_0x3d7d68-0x0;var _0x43c8f4=_0x63eb[_0x3d7d68];return _0x43c8f4;};'use strict';var _=require(_0xb63e('0x0'));var util=require('util');var logger=require(_0xb63e('0x1'))('api');var moment=require(_0xb63e('0x2'));var BPromise=require(_0xb63e('0x3'));var rp=require(_0xb63e('0x4'));var fs=require('fs');var path=require(_0xb63e('0x5'));var rimraf=require(_0xb63e('0x6'));var config=require(_0xb63e('0x7'));var attributes=require(_0xb63e('0x8'));module[_0xb63e('0x9')]=function(_0x32f3f4,_0x412c71){return _0x32f3f4['define']('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xb63e('0xa'),_0xb63e('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0xcf75=['../../config/logger','api','request-promise','path','../../config/environment','./voiceQueuesLog.attributes','exports','define','voice_queues_log','event_dtm','event','util'];(function(_0x3fe3f6,_0xc27c9d){var _0x45a388=function(_0x42b64c){while(--_0x42b64c){_0x3fe3f6['push'](_0x3fe3f6['shift']());}};_0x45a388(++_0xc27c9d);}(_0xcf75,0x83));var _0x5cf7=function(_0x45d8ae,_0x5b0d53){_0x45d8ae=_0x45d8ae-0x0;var _0x4d08b0=_0xcf75[_0x45d8ae];return _0x4d08b0;};'use strict';var _=require('lodash');var util=require(_0x5cf7('0x0'));var logger=require(_0x5cf7('0x1'))(_0x5cf7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5cf7('0x3'));var fs=require('fs');var path=require(_0x5cf7('0x4'));var rimraf=require('rimraf');var config=require(_0x5cf7('0x5'));var attributes=require(_0x5cf7('0x6'));module[_0x5cf7('0x7')]=function(_0x4d6d52,_0x3eb82a){return _0x4d6d52[_0x5cf7('0x8')]('VoiceQueuesLog',attributes,{'tableName':_0x5cf7('0x9'),'paranoid':![],'indexes':[{'name':_0x5cf7('0xa'),'fields':[_0x5cf7('0xb'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 8418612..cebaead 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 _0xb02a=['client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x5ece84,_0xc06c9f){var _0x2a12c4=function(_0x133bf3){while(--_0x133bf3){_0x5ece84['push'](_0x5ece84['shift']());}};_0x2a12c4(++_0xc06c9f);}(_0xb02a,0x14c));var _0xab02=function(_0x32c9d4,_0x3099ed){_0x32c9d4=_0x32c9d4-0x0;var _0x3142b2=_0xb02a[_0x32c9d4];return _0x3142b2;};'use strict';var _=require('lodash');var util=require(_0xab02('0x0'));var moment=require(_0xab02('0x1'));var BPromise=require(_0xab02('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab02('0x3'))['db'];var utils=require(_0xab02('0x4'));var logger=require('../../config/logger')(_0xab02('0x5'));var config=require(_0xab02('0x6'));var jayson=require(_0xab02('0x7'));var client=jayson[_0xab02('0x8')][_0xab02('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbee62a,_0x963453,_0x47981b){return new BPromise(function(_0x554538,_0x1ad530){return client['request'](_0xbee62a,_0x47981b)[_0xab02('0xa')](function(_0x349c0d){logger[_0xab02('0xb')](_0xab02('0xc'),_0x963453,_0xab02('0xd'));logger[_0xab02('0xe')](_0xab02('0xf'),_0x963453,_0xab02('0xd'),JSON[_0xab02('0x10')](_0x349c0d));if(_0x349c0d[_0xab02('0x11')]){if(_0x349c0d[_0xab02('0x11')]['code']===0x1f4){logger[_0xab02('0x11')](_0xab02('0xc'),_0x963453,_0x349c0d[_0xab02('0x11')]['message']);return _0x1ad530(_0x349c0d[_0xab02('0x11')][_0xab02('0x12')]);}logger[_0xab02('0x11')](_0xab02('0xc'),_0x963453,_0x349c0d['error'][_0xab02('0x12')]);return _0x554538(_0x349c0d[_0xab02('0x11')][_0xab02('0x12')]);}else{logger[_0xab02('0xb')](_0xab02('0xc'),_0x963453,'request\x20sent');_0x554538(_0x349c0d['result']['message']);}})[_0xab02('0x13')](function(_0x301016){logger[_0xab02('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x963453,_0x301016);_0x1ad530(_0x301016);});});} \ No newline at end of file +var _0x765b=['rpc','then','info','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x5efe5a,_0x23c863){var _0x25794b=function(_0x29f972){while(--_0x29f972){_0x5efe5a['push'](_0x5efe5a['shift']());}};_0x25794b(++_0x23c863);}(_0x765b,0x18c));var _0xb765=function(_0x290fa6,_0x16d017){_0x290fa6=_0x290fa6-0x0;var _0x47f1f3=_0x765b[_0x290fa6];return _0x47f1f3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb765('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb765('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xb765('0x2'));var logger=require(_0xb765('0x3'))(_0xb765('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x339593,_0x5b1baf,_0x179545){return new BPromise(function(_0x3d56b3,_0x39a186){return client['request'](_0x339593,_0x179545)[_0xb765('0x5')](function(_0x293807){logger[_0xb765('0x6')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5b1baf,'request\x20sent');logger['debug'](_0xb765('0x7'),_0x5b1baf,_0xb765('0x8'),JSON[_0xb765('0x9')](_0x293807));if(_0x293807[_0xb765('0xa')]){if(_0x293807['error'][_0xb765('0xb')]===0x1f4){logger[_0xb765('0xa')](_0xb765('0xc'),_0x5b1baf,_0x293807[_0xb765('0xa')][_0xb765('0xd')]);return _0x39a186(_0x293807[_0xb765('0xa')][_0xb765('0xd')]);}logger[_0xb765('0xa')](_0xb765('0xc'),_0x5b1baf,_0x293807['error'][_0xb765('0xd')]);return _0x3d56b3(_0x293807['error'][_0xb765('0xd')]);}else{logger[_0xb765('0x6')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5b1baf,'request\x20sent');_0x3d56b3(_0x293807[_0xb765('0xe')][_0xb765('0xd')]);}})[_0xb765('0xf')](function(_0x3a2341){logger[_0xb765('0xa')](_0xb765('0xc'),_0x5b1baf,_0x3a2341);_0x39a186(_0x3a2341);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 4770db9..151ce7c 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 _0x2724=['Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','get','/:id','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','update','delete','multer','util','path'];(function(_0x4afbb7,_0x4fb443){var _0x417773=function(_0x402274){while(--_0x402274){_0x4afbb7['push'](_0x4afbb7['shift']());}};_0x417773(++_0x4fb443);}(_0x2724,0x1c9));var _0x4272=function(_0x596935,_0x343b7e){_0x596935=_0x596935-0x0;var _0xd173e2=_0x2724[_0x596935];return _0xd173e2;};'use strict';var multer=require(_0x4272('0x0'));var util=require(_0x4272('0x1'));var path=require(_0x4272('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4272('0x3')]();var fs_extra=require(_0x4272('0x4'));var auth=require(_0x4272('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4272('0x6'));var controller=require(_0x4272('0x7'));router['get']('/',auth[_0x4272('0x8')](),controller[_0x4272('0x9')]);router[_0x4272('0xa')]('/describe',auth[_0x4272('0x8')](),controller['describe']);router[_0x4272('0xa')](_0x4272('0xb'),auth[_0x4272('0x8')](),controller['show']);router[_0x4272('0xa')](_0x4272('0xc'),auth['isAuthenticated'](),controller[_0x4272('0xd')]);router['get'](_0x4272('0xe'),controller[_0x4272('0xf')]);router['get'](_0x4272('0x10'),auth[_0x4272('0x8')](),controller[_0x4272('0x11')]);router[_0x4272('0x12')]('/',auth[_0x4272('0x8')](),controller[_0x4272('0x13')]);router[_0x4272('0x12')](_0x4272('0x10'),auth[_0x4272('0x8')](),controller[_0x4272('0x14')]);router['put'](_0x4272('0xb'),auth[_0x4272('0x8')](),controller[_0x4272('0x15')]);router[_0x4272('0x16')](_0x4272('0xb'),auth[_0x4272('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa7dc=['../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa7dc,0x12d));var _0xca7d=function(_0x44cf0b,_0x353c69){_0x44cf0b=_0x44cf0b-0x0;var _0x4cd70d=_0xa7dc[_0x44cf0b];return _0x4cd70d;};'use strict';var multer=require(_0xca7d('0x0'));var util=require(_0xca7d('0x1'));var path=require(_0xca7d('0x2'));var timeout=require('connect-timeout');var express=require(_0xca7d('0x3'));var router=express[_0xca7d('0x4')]();var fs_extra=require(_0xca7d('0x5'));var auth=require(_0xca7d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xca7d('0x7'));var controller=require(_0xca7d('0x8'));router[_0xca7d('0x9')]('/',auth[_0xca7d('0xa')](),controller['index']);router['get'](_0xca7d('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xca7d('0xc'),auth[_0xca7d('0xa')](),controller[_0xca7d('0xd')]);router[_0xca7d('0x9')](_0xca7d('0xe'),auth[_0xca7d('0xa')](),controller[_0xca7d('0xf')]);router[_0xca7d('0x9')](_0xca7d('0x10'),controller[_0xca7d('0x11')]);router[_0xca7d('0x9')](_0xca7d('0x12'),auth[_0xca7d('0xa')](),controller[_0xca7d('0x13')]);router[_0xca7d('0x14')]('/',auth[_0xca7d('0xa')](),controller[_0xca7d('0x15')]);router['post'](_0xca7d('0x12'),auth[_0xca7d('0xa')](),controller[_0xca7d('0x16')]);router[_0xca7d('0x17')](_0xca7d('0xc'),auth[_0xca7d('0xa')](),controller[_0xca7d('0x18')]);router[_0xca7d('0x19')]('/:id',auth[_0xca7d('0xa')](),controller[_0xca7d('0x1a')]);module[_0xca7d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 4cc70f8..e77be9a 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(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 4f3483a..d56f028 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 _0x3b02=['sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','../../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','reject','then','destroy','error','name','index','VoiceRecording','rawAttributes','fieldName','type','key','differenceBy','map','format','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','recording','existsSync','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','downloads','sequelize','col','token','$and','push','decryptFile','ValidationError','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJob','TranscriptionJobStatus','runTranscribe','secrets','Voice\x20Recording\x20not\x20found','Setting','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','findOne','fileText','root','.txt','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3b02,0x8e));var _0x23b0=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x3b02[_0x9df060];return _0x338dfe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x23b0('0x0'));var zipdir=require(_0x23b0('0x1'));var jsonpatch=require(_0x23b0('0x2'));var rp=require('request-promise');var moment=require(_0x23b0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x23b0('0x4'));var util=require(_0x23b0('0x5'));var path=require(_0x23b0('0x6'));var sox=require(_0x23b0('0x7'));var csv=require('to-csv');var ejs=require(_0x23b0('0x8'));var fs=require('fs');var fs_extra=require(_0x23b0('0x9'));var _=require('lodash');var squel=require(_0x23b0('0xa'));var crypto=require(_0x23b0('0xb'));var jsforce=require(_0x23b0('0xc'));var deskjs=require(_0x23b0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x23b0('0xe'));var Papa=require(_0x23b0('0xf'));var AWS=require(_0x23b0('0x10'));var uuidv4=require(_0x23b0('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x23b0('0x12'));var as=require(_0x23b0('0x13'));var hardwareService=require(_0x23b0('0x14'));var logger=require(_0x23b0('0x15'))(_0x23b0('0x16'));var utils=require('../../config/utils');var config=require(_0x23b0('0x17'));var licenseUtil=require(_0x23b0('0x18'));var db=require(_0x23b0('0x19'))['db'];function respondWithStatusCode(_0x412926,_0x48e3fe){_0x48e3fe=_0x48e3fe||0xcc;return function(_0x41e838){if(_0x41e838){return _0x412926[_0x23b0('0x1a')](_0x48e3fe);}return _0x412926[_0x23b0('0x1b')](_0x48e3fe)[_0x23b0('0x1c')]();};}function respondWithResult(_0x11da74,_0x14034f){_0x14034f=_0x14034f||0xc8;return function(_0x1fa588){if(_0x1fa588){return _0x11da74[_0x23b0('0x1b')](_0x14034f)[_0x23b0('0x1d')](_0x1fa588);}};}function respondWithFilteredResult(_0x1f3aff,_0x35e1d3){return function(_0x4981a7){if(_0x4981a7){var _0x109cc8=typeof _0x35e1d3[_0x23b0('0x1e')]===_0x23b0('0x1f')&&typeof _0x35e1d3[_0x23b0('0x20')]===_0x23b0('0x1f');var _0x8de51c=_0x4981a7[_0x23b0('0x21')];var _0x2b0b4e=_0x109cc8?0x0:_0x35e1d3[_0x23b0('0x1e')];var _0x113a83=_0x109cc8?_0x4981a7[_0x23b0('0x21')]:_0x35e1d3[_0x23b0('0x1e')]+_0x35e1d3[_0x23b0('0x20')];var _0x519751;if(_0x113a83>=_0x8de51c){_0x113a83=_0x8de51c;_0x519751=0xc8;}else{_0x519751=0xce;}_0x1f3aff[_0x23b0('0x1b')](_0x519751);return _0x1f3aff[_0x23b0('0x22')]('Content-Range',_0x2b0b4e+'-'+_0x113a83+'/'+_0x8de51c)['json'](_0x4981a7);}return null;};}function patchUpdates(_0x2d7159){return function(_0xc173e3){try{jsonpatch['apply'](_0xc173e3,_0x2d7159,!![]);}catch(_0x14d7f4){return BPromise[_0x23b0('0x23')](_0x14d7f4);}return _0xc173e3['save']();};}function saveUpdates(_0x5af9a1,_0x450e5d){return function(_0x466b0a){if(_0x466b0a){return _0x466b0a['update'](_0x5af9a1)[_0x23b0('0x24')](function(_0x6dcd66){return _0x6dcd66;});}return null;};}function removeEntity(_0xacf5ba,_0xd04f08){return function(_0x59b0fe){if(_0x59b0fe){return _0x59b0fe[_0x23b0('0x25')]()[_0x23b0('0x24')](function(){_0xacf5ba[_0x23b0('0x1b')](0xcc)[_0x23b0('0x1c')]();});}};}function handleEntityNotFound(_0x17fedc,_0x1669af){return function(_0x3c44c3){if(!_0x3c44c3){_0x17fedc['sendStatus'](0x194);}return _0x3c44c3;};}function handleError(_0x2f10c5,_0x26bfae){_0x26bfae=_0x26bfae||0x1f4;return function(_0x218b52){logger[_0x23b0('0x26')](_0x218b52['stack']);if(_0x218b52[_0x23b0('0x27')]){delete _0x218b52['name'];}_0x2f10c5['status'](_0x26bfae)['send'](_0x218b52);};}exports[_0x23b0('0x28')]=function(_0x36e7fe,_0x2d0141){var _0x51eb4f={},_0x3ce410={},_0x66d33a={'count':0x0,'rows':[]};var _0x3c1638=_['map'](db[_0x23b0('0x29')][_0x23b0('0x2a')],function(_0x253023){return{'name':_0x253023[_0x23b0('0x2b')],'type':_0x253023[_0x23b0('0x2c')][_0x23b0('0x2d')]};});_0x3ce410['model']=_[_0x23b0('0x2e')](_[_0x23b0('0x2f')](_0x3c1638,_0x23b0('0x27')),[_0x23b0('0x30')]);_0x3ce410['query']=_[_0x23b0('0x31')](_0x36e7fe[_0x23b0('0x32')]);_0x3ce410[_0x23b0('0x33')]=_[_0x23b0('0x34')](_0x3ce410['model'],_0x3ce410['query']);_0x51eb4f['attributes']=_[_0x23b0('0x34')](_0x3ce410[_0x23b0('0x35')],qs[_0x23b0('0x36')](_0x36e7fe[_0x23b0('0x32')][_0x23b0('0x36')]));_0x51eb4f[_0x23b0('0x37')]=_0x51eb4f[_0x23b0('0x37')][_0x23b0('0x38')]?_0x51eb4f[_0x23b0('0x37')]:_0x3ce410[_0x23b0('0x35')];if(!_0x36e7fe[_0x23b0('0x32')][_0x23b0('0x39')](_0x23b0('0x3a'))){_0x51eb4f[_0x23b0('0x20')]=qs[_0x23b0('0x20')](_0x36e7fe['query'][_0x23b0('0x20')]);_0x51eb4f['offset']=qs[_0x23b0('0x1e')](_0x36e7fe['query']['offset']);}_0x51eb4f['order']=qs['sort'](_0x36e7fe['query'][_0x23b0('0x3b')]);_0x51eb4f[_0x23b0('0x3c')]=qs[_0x23b0('0x33')](_[_0x23b0('0x3d')](_0x36e7fe[_0x23b0('0x32')],_0x3ce410[_0x23b0('0x33')]),_0x3c1638);if(_0x36e7fe[_0x23b0('0x32')][_0x23b0('0x3e')]){_0x51eb4f['where']=_[_0x23b0('0x3f')](_0x51eb4f['where'],{'$or':_['map'](_0x3c1638,function(_0x1d07e8){if(_0x1d07e8[_0x23b0('0x2c')]!==_0x23b0('0x40')){var _0x17c0e8={};_0x17c0e8[_0x1d07e8['name']]={'$like':'%'+_0x36e7fe[_0x23b0('0x32')][_0x23b0('0x3e')]+'%'};return _0x17c0e8;}})});}_0x51eb4f=_[_0x23b0('0x3f')]({},_0x51eb4f,_0x36e7fe[_0x23b0('0x41')]);var _0x5cd084={'where':_0x51eb4f['where']};return db[_0x23b0('0x29')][_0x23b0('0x21')](_0x5cd084)['then'](function(_0x39645b){_0x66d33a['count']=_0x39645b;if(_0x36e7fe[_0x23b0('0x32')]['includeAll']){_0x51eb4f[_0x23b0('0x42')]=[{'all':!![]}];}return db[_0x23b0('0x29')][_0x23b0('0x43')](_0x51eb4f);})[_0x23b0('0x24')](function(_0x57776b){_0x66d33a['rows']=_0x57776b;return _0x66d33a;})[_0x23b0('0x24')](respondWithFilteredResult(_0x2d0141,_0x51eb4f))[_0x23b0('0x44')](handleError(_0x2d0141,null));};exports[_0x23b0('0x45')]=function(_0x21aa86,_0x23a07d){var _0xe64c3a={'raw':![],'where':{'id':_0x21aa86[_0x23b0('0x46')]['id']}},_0x2a4cf2={};_0x2a4cf2[_0x23b0('0x35')]=_[_0x23b0('0x31')](db['VoiceRecording']['rawAttributes']);_0x2a4cf2['query']=_['keys'](_0x21aa86[_0x23b0('0x32')]);_0x2a4cf2[_0x23b0('0x33')]=_[_0x23b0('0x34')](_0x2a4cf2[_0x23b0('0x35')],_0x2a4cf2['query']);_0xe64c3a[_0x23b0('0x37')]=_[_0x23b0('0x34')](_0x2a4cf2[_0x23b0('0x35')],qs[_0x23b0('0x36')](_0x21aa86['query']['fields']));_0xe64c3a[_0x23b0('0x37')]=_0xe64c3a[_0x23b0('0x37')][_0x23b0('0x38')]?_0xe64c3a[_0x23b0('0x37')]:_0x2a4cf2[_0x23b0('0x35')];if(_0x21aa86[_0x23b0('0x32')][_0x23b0('0x47')]){_0xe64c3a[_0x23b0('0x42')]=[{'all':!![]}];}_0xe64c3a=_[_0x23b0('0x3f')]({},_0xe64c3a,_0x21aa86[_0x23b0('0x41')]);return db[_0x23b0('0x29')][_0x23b0('0x48')](_0xe64c3a)[_0x23b0('0x24')](handleEntityNotFound(_0x23a07d,null))['then'](respondWithResult(_0x23a07d,null))[_0x23b0('0x44')](handleError(_0x23a07d,null));};exports[_0x23b0('0x49')]=function(_0x5b8fde,_0x3616ff){return db[_0x23b0('0x29')]['create'](_0x5b8fde[_0x23b0('0x4a')],{})['then'](respondWithResult(_0x3616ff,0xc9))[_0x23b0('0x44')](handleError(_0x3616ff,null));};exports['update']=function(_0x413aca,_0x5ba42a){if(_0x413aca['body']['id']){delete _0x413aca['body']['id'];}return db[_0x23b0('0x29')][_0x23b0('0x48')]({'where':{'id':_0x413aca[_0x23b0('0x46')]['id']}})['then'](handleEntityNotFound(_0x5ba42a,null))[_0x23b0('0x24')](saveUpdates(_0x413aca[_0x23b0('0x4a')],null))['then'](respondWithResult(_0x5ba42a,null))[_0x23b0('0x44')](handleError(_0x5ba42a,null));};exports['describe']=function(_0x391b4c,_0x4eba61){return db[_0x23b0('0x29')][_0x23b0('0x4b')]()[_0x23b0('0x24')](respondWithResult(_0x4eba61,null))[_0x23b0('0x44')](handleError(_0x4eba61,null));};exports[_0x23b0('0x4c')]=function(_0xb6fd50,_0x18d00c,_0xcad5cf){var _0x1eab78=require(_0x23b0('0x4d'));var _0x4ade39=![];var _0x251ef9={};if(_0xb6fd50[_0x23b0('0x32')]['type']&&_0xb6fd50[_0x23b0('0x32')]['type']===_0x23b0('0x4e')){_0x251ef9[_0x23b0('0x4e')]=_0xb6fd50[_0x23b0('0x46')]['id'];}else{_0x251ef9['id']=_0xb6fd50['params']['id'];}return db[_0x23b0('0x29')]['find']({'where':_0x251ef9,'attributes':['id',_0x23b0('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x18d00c,null))['then'](function(_0x243849){if(_0x243849){var _0x577a46=_0x243849[_0x23b0('0x4f')];var _0x35bb5a=util['format'](_0x23b0('0x50'),_0x577a46);if(fs['existsSync'](_0x35bb5a)){_0x4ade39=!![];return _0x1eab78['decryptFile'](_0x35bb5a,_0x577a46,config['secrets'][_0x23b0('0x51')])[_0x23b0('0x24')](function(){return _0x243849;});}return _0x243849;}})[_0x23b0('0x24')](function(_0x1f22e1){if(_0x1f22e1){var _0x497584=_0x1f22e1[_0x23b0('0x4f')];if(!fs[_0x23b0('0x52')](_0x497584)){throw new db[(_0x23b0('0x53'))]['ValidationError'](_0x23b0('0x54'));}if(_0x1f22e1[_0x23b0('0x55')]){return _0x18d00c['download'](_0x497584,_0x1f22e1[_0x23b0('0x55')]+path[_0x23b0('0x56')](_0x497584),function(){if(_0x4ade39){fs[_0x23b0('0x57')](_0x497584);}});}else{return _0x18d00c[_0x23b0('0x4c')](_0x497584,function(_0x57abfd){if(_0x4ade39){fs['unlink'](_0x497584);}});}}})['catch'](function(_0x920d){if(_0x920d['message']===_0x23b0('0x54')){_0x18d00c['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x18d00c,null);}});};exports[_0x23b0('0x58')]=function(_0xac5338,_0x7fab56,_0x695d5b){var _0x40ac35=require('../../components/encryptor');var _0x1ba6da=![];var _0x2a4c4d={'$and':[db[_0x23b0('0x59')][_0x23b0('0x3c')](db[_0x23b0('0x59')]['fn']('MD5',db['sequelize'][_0x23b0('0x5a')](_0x23b0('0x4e'))),_0xac5338[_0x23b0('0x32')][_0x23b0('0x5b')])]};if(_0xac5338[_0x23b0('0x32')][_0x23b0('0x2c')]&&_0xac5338[_0x23b0('0x32')]['type']===_0x23b0('0x4e')){_0x2a4c4d[_0x23b0('0x5c')][_0x23b0('0x5d')]({'uniqueid':_0xac5338[_0x23b0('0x46')]['id']});}else{_0x2a4c4d[_0x23b0('0x5c')][_0x23b0('0x5d')]({'id':_0xac5338[_0x23b0('0x46')]['id']});}return db[_0x23b0('0x29')]['find']({'where':_0x2a4c4d,'attributes':['id',_0x23b0('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x7fab56,null))[_0x23b0('0x24')](function(_0x11a89f){if(_0x11a89f){var _0x36ed17=util[_0x23b0('0x30')](_0x23b0('0x50'),_0x11a89f[_0x23b0('0x4f')]);if(fs['existsSync'](_0x36ed17)){_0x1ba6da=!![];return _0x40ac35[_0x23b0('0x5e')](_0x36ed17,_0x11a89f[_0x23b0('0x4f')],config['secrets'][_0x23b0('0x51')])[_0x23b0('0x24')](function(){return _0x11a89f;});}return _0x11a89f;}})[_0x23b0('0x24')](function(_0x1fd122){if(_0x1fd122){if(!fs[_0x23b0('0x52')](_0x1fd122[_0x23b0('0x4f')])){throw new db[(_0x23b0('0x53'))][(_0x23b0('0x5f'))](_0x23b0('0x54'));}if(_0x1fd122[_0x23b0('0x55')]){return _0x7fab56['download'](_0x1fd122[_0x23b0('0x4f')],_0x1fd122[_0x23b0('0x55')]+path[_0x23b0('0x56')](_0x1fd122[_0x23b0('0x4f')]),function(){if(_0x1ba6da){fs[_0x23b0('0x57')](_0x1fd122['value']);}});}else{return _0x7fab56[_0x23b0('0x4c')](_0x1fd122[_0x23b0('0x4f')],function(_0x3b2c42){if(_0x1ba6da){fs[_0x23b0('0x57')](_0x1fd122['value']);}});}}})[_0x23b0('0x44')](handleError(_0x7fab56,null));};exports['destroy']=function(_0x33a8d2,_0x1a2f0e){return db[_0x23b0('0x29')][_0x23b0('0x48')]({'where':{'id':_0x33a8d2[_0x23b0('0x46')]['id']}})[_0x23b0('0x24')](function(_0x211a84){if(_[_0x23b0('0x60')](_0x211a84)){throw new ReferenceError('Entity\x20not\x20found');}return _0x211a84;})[_0x23b0('0x24')](function(_0x2854a7){var _0x291d8d=_0x2854a7['value'];logger['info'](_0x23b0('0x61'),_0x291d8d);if(!_[_0x23b0('0x60')](_0x2854a7[_0x23b0('0x4f')])&&fs[_0x23b0('0x52')](_0x291d8d)){logger[_0x23b0('0x62')](_0x23b0('0x63')+_0x291d8d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x23b0('0x64')](_0x291d8d);}_0x291d8d=_0x291d8d+'.cypher';if(!_[_0x23b0('0x60')](_0x2854a7[_0x23b0('0x4f')])&&fs['existsSync'](_0x291d8d)){logger[_0x23b0('0x62')](_0x23b0('0x63')+_0x291d8d+_0x23b0('0x65'));fs[_0x23b0('0x64')](_0x291d8d);}return _0x2854a7;})['then'](function(_0x37a05d){if(!_0x37a05d)throw new InternalError();return _0x37a05d[_0x23b0('0x25')]();})[_0x23b0('0x24')](function(){_0x1a2f0e[_0x23b0('0x1b')](0xcc)[_0x23b0('0x1c')]();})['catch'](handleError(_0x1a2f0e,null));};function getBucketslist(_0x42b234,_0x30cbad,_0x2c3128){return new Promise(function(_0x2fb012,_0x5c46ea){var _0x1a7a72=new AWS['S3']({'accessKeyId':_0x30cbad,'secretAccessKey':_0x42b234,'region':_0x2c3128});_0x1a7a72[_0x23b0('0x66')]({},function(_0x589efe,_0x270b2b){if(_0x589efe){return _0x5c46ea(_0x589efe);}else{return _0x2fb012(_0x270b2b);}});});}function createBucket(_0x26e02a,_0x37ef49,_0x4d7410,_0x237153){return new Promise(function(_0x564667,_0xa6ee6f){var _0x1ad44a=new AWS['S3']({'accessKeyId':_0x37ef49,'secretAccessKey':_0x26e02a,'region':_0x4d7410});_0x1ad44a['createBucket']({'Bucket':_0x237153},function(_0x274ce9,_0x3a75de){if(_0x274ce9){return _0xa6ee6f(_0x274ce9);}else{return _0x564667(_0x3a75de);}});});}function uploadFile(_0x294116,_0x322180,_0x24ea8c,_0x535b88,_0x56dd91,_0x2b05de){return new Promise(function(_0x245c6f,_0x22b3bb){var _0x75ae66=new AWS['S3']({'accessKeyId':_0x322180,'secretAccessKey':_0x294116,'region':_0x24ea8c});_0x75ae66[_0x23b0('0x67')]({'Bucket':_0x535b88,'Key':_0x56dd91,'Body':_0x2b05de},function(_0x4d1f0e,_0x4ba546){if(_0x4d1f0e){return _0x22b3bb(_0x4d1f0e);}else{return _0x245c6f(_0x4ba546);}});});}function startTranscribe(_0x2e661e,_0x13f0d5,_0x5b8a4b,_0x4136cb,_0x3b3636,_0x387daa){return new Promise(function(_0x2c0d2f,_0x371f58){var _0x3e1c8f=new AWS[(_0x23b0('0x68'))]({'accessKeyId':_0x13f0d5,'secretAccessKey':_0x2e661e,'region':_0x5b8a4b});_0x3e1c8f[_0x23b0('0x69')]({'TranscriptionJobName':_0x4136cb,'LanguageCode':_0x3b3636,'Media':{'MediaFileUri':_0x387daa}},function(_0x32926e,_0x53ecb7){if(_0x32926e){return _0x371f58(_0x32926e);}else{return _0x2c0d2f(_0x53ecb7);}});});}function transcribe(_0xc61619,_0x2ea1f2,_0x1da3da,_0x15ba9,_0x506701,_0x23d3dd,_0x58c081){return new Promise(function(_0x31fb24,_0x23a012){var _0xc6a967={};logger[_0x23b0('0x62')](util[_0x23b0('0x30')](_0x23b0('0x6a'),_0xc61619,_0x506701));return uploadFile(_0x2ea1f2,_0x1da3da,_0x15ba9,_0x506701,path['basename'](_0x23d3dd),fs[_0x23b0('0x6b')](_0x23d3dd))[_0x23b0('0x24')](function(_0x432593){logger[_0x23b0('0x62')](util[_0x23b0('0x30')](_0x23b0('0x6c'),_0xc61619,_0x506701,_0x432593['Location']));_0xc6a967[_0x23b0('0x6d')]=_0x432593[_0x23b0('0x6e')];_0xc6a967[_0x23b0('0x6f')]=_0x432593['Location'];logger[_0x23b0('0x62')](util[_0x23b0('0x30')](_0x23b0('0x70'),_0xc61619));return startTranscribe(_0x2ea1f2,_0x1da3da,_0x15ba9,uuidv4(),_0x58c081,_0x432593['Location']);})['then'](function(_0x2f8e5e){logger[_0x23b0('0x62')](util['format'](_0x23b0('0x71'),_0xc61619,_0x2f8e5e['TranscriptionJob'][_0x23b0('0x72')]));_0xc6a967[_0x23b0('0x73')]=_0x2f8e5e['TranscriptionJob']['TranscriptionJobName'];_0xc6a967[_0x23b0('0x74')]=_0x2f8e5e[_0x23b0('0x75')][_0x23b0('0x76')];return _0x31fb24(_0xc6a967);})[_0x23b0('0x44')](function(_0x313ade){return _0x23a012(_0x313ade);});});}exports[_0x23b0('0x77')]=function(_0x4eb632,_0x5a0706,_0x11e36c){var _0x27be56;var _0x312ed4;var _0x29fa10;var _0x9b32c7=require(_0x23b0('0x4d'));return db['VoiceRecording']['findOne']({'where':{'id':_0x4eb632['params']['id']}})[_0x23b0('0x24')](function(_0x4b291a){if(_0x4b291a){var _0x4b80f2=util[_0x23b0('0x30')]('%s.cypher',_0x4b291a[_0x23b0('0x4f')]);if(fs[_0x23b0('0x52')](_0x4b80f2)){cypher=!![];return _0x9b32c7[_0x23b0('0x5e')](_0x4b80f2,_0x4b291a['value'],config[_0x23b0('0x78')][_0x23b0('0x51')])[_0x23b0('0x24')](function(){return _0x4b291a;});}return _0x4b291a;}})[_0x23b0('0x24')](function(_0x30a5b0){if(!_0x30a5b0){throw new db[(_0x23b0('0x53'))][(_0x23b0('0x5f'))](_0x23b0('0x79'));}_0x312ed4=_0x30a5b0;return db[_0x23b0('0x7a')]['findOne']({'where':{'id':0x1}});})[_0x23b0('0x24')](handleEntityNotFound(_0x5a0706,null))[_0x23b0('0x24')](function(_0x30634e){if(_0x30634e){_0x27be56=_0x30634e;if(!_0x27be56['transcribe']||!_0x27be56['transcribeAccountId']||!_0x27be56[_0x23b0('0x7b')]||!_0x27be56[_0x23b0('0x7c')]||!_0x27be56[_0x23b0('0x6d')]){throw new db[(_0x23b0('0x53'))]['ValidationError'](_0x23b0('0x7d'));}if(_0x4eb632[_0x23b0('0x4a')][_0x23b0('0x7e')]&&(!_0x27be56[_0x23b0('0x7f')]||!_0x27be56[_0x23b0('0x80')]||!_0x27be56['sentimentRegion']||!_0x27be56[_0x23b0('0x7c')]||!_0x27be56[_0x23b0('0x6d')])){throw new db[(_0x23b0('0x53'))][(_0x23b0('0x5f'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x23b0('0x81')]['findOne']({'where':{'id':_0x27be56['transcribeAccountId']}});}})[_0x23b0('0x24')](function(_0x198bfc){if(!_0x198bfc){throw new db[(_0x23b0('0x53'))][(_0x23b0('0x5f'))](_0x23b0('0x82'));}if(!_0x198bfc[_0x23b0('0x83')]||!_0x198bfc[_0x23b0('0x84')]){throw new db[(_0x23b0('0x53'))][(_0x23b0('0x5f'))](_0x23b0('0x85'));}_0x29fa10=_0x198bfc;return getBucketslist(_0x29fa10[_0x23b0('0x83')],_0x29fa10['data2'],_0x27be56['transcribeRegion']);})['then'](function(_0x230782){if(_0x230782&&_0x230782[_0x23b0('0x86')]){var _0x2d1a28=_[_0x23b0('0x48')](_0x230782['Buckets'],function(_0x2be827){return _0x2be827[_0x23b0('0x87')]===_0x27be56[_0x23b0('0x6d')];});if(!_0x2d1a28){logger['info'](util[_0x23b0('0x30')](_0x23b0('0x88'),_0x4eb632[_0x23b0('0x46')]['id'],_0x27be56[_0x23b0('0x6d')]));return createBucket(_0x29fa10[_0x23b0('0x83')],_0x29fa10[_0x23b0('0x84')],_0x27be56['transcribeRegion'],_0x27be56[_0x23b0('0x6d')]);}logger[_0x23b0('0x62')](util[_0x23b0('0x30')](_0x23b0('0x89'),_0x4eb632[_0x23b0('0x46')]['id'],_0x27be56['bucket']));return;}})[_0x23b0('0x24')](function(_0x133701){if(_0x312ed4[_0x23b0('0x74')]===_0x23b0('0x8a')){return transcribe(_0x4eb632[_0x23b0('0x46')]['id'],_0x29fa10[_0x23b0('0x83')],_0x29fa10[_0x23b0('0x84')],_0x27be56[_0x23b0('0x7b')],_0x27be56[_0x23b0('0x6d')],_0x312ed4[_0x23b0('0x4f')],_0x27be56[_0x23b0('0x7c')]);}else{logger[_0x23b0('0x62')](util[_0x23b0('0x30')](_0x23b0('0x8b'),_0x4eb632[_0x23b0('0x46')]['id']));return{'transcribeStatus':_0x23b0('0x8c')};}})[_0x23b0('0x24')](function(_0x5f0f9b){if(_0x5f0f9b){_0x5f0f9b['tempSentiment']=_0x4eb632['body'][_0x23b0('0x7e')];return _0x312ed4[_0x23b0('0x8d')](_0x5f0f9b);}})[_0x23b0('0x24')](respondWithResult(_0x5a0706,null))[_0x23b0('0x44')](handleError(_0x5a0706,null));};function writeFile(_0xddeeb3,_0x42e8a5){return new Promise(function(_0x461408,_0x5d1bf7){fs[_0x23b0('0x8e')](_0x42e8a5,_0xddeeb3,function(_0xcb57ca,_0x16b762){if(_0xcb57ca){return _0x5d1bf7(_0xcb57ca);}else{return _0x461408(_0x16b762);}});});}exports[_0x23b0('0x8f')]=function(_0x591e49,_0x3c613f,_0x208c5d){return db[_0x23b0('0x29')][_0x23b0('0x90')]({'where':{'id':_0x591e49[_0x23b0('0x46')]['id']}})[_0x23b0('0x24')](handleEntityNotFound(_0x3c613f))[_0x23b0('0x24')](function(_0x56fd5c){if(_0x56fd5c&&_0x56fd5c[_0x23b0('0x91')]){var _0x2787db=_0x56fd5c['fileText'];var _0xe91019=config[_0x23b0('0x92')]+'/server/files/transcribes/transcribe_'+_0x56fd5c['id']+_0x23b0('0x93');if(fs[_0x23b0('0x52')](_0xe91019)){return _0xe91019;}return writeFile(_0x2787db,_0xe91019)[_0x23b0('0x24')](function(){return _0xe91019;});}else{throw new db[(_0x23b0('0x53'))][(_0x23b0('0x5f'))](_0x23b0('0x94'));}})[_0x23b0('0x24')](function(_0x41e297){return _0x3c613f[_0x23b0('0x4c')](_0x41e297);})['catch'](handleError(_0x3c613f));}; \ No newline at end of file +var _0xd572=['tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','VoiceRecording','rawAttributes','type','key','differenceBy','format','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','filters','pick','filter','options','then','includeAll','include','rows','catch','params','merge','find','create','body','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','send','Not\x20found','downloads','../../components/encryptor','sequelize','where','MD5','token','$and','push','recording','Sequelize','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJobName','transcribeName','TranscriptionJob','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS'];(function(_0x5db720,_0x1d6bdd){var _0x2ab3e2=function(_0x4f3692){while(--_0x4f3692){_0x5db720['push'](_0x5db720['shift']());}};_0x2ab3e2(++_0x1d6bdd);}(_0xd572,0x139));var _0x2d57=function(_0x30c5c5,_0x5747ab){_0x30c5c5=_0x30c5c5-0x0;var _0x3c1e32=_0xd572[_0x30c5c5];return _0x3c1e32;};'use strict';var emlformat=require(_0x2d57('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2d57('0x1'));var jsonpatch=require(_0x2d57('0x2'));var rp=require(_0x2d57('0x3'));var moment=require(_0x2d57('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2d57('0x5'));var util=require(_0x2d57('0x6'));var path=require(_0x2d57('0x7'));var sox=require(_0x2d57('0x8'));var csv=require(_0x2d57('0x9'));var ejs=require(_0x2d57('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2d57('0xb'));var crypto=require(_0x2d57('0xc'));var jsforce=require(_0x2d57('0xd'));var deskjs=require(_0x2d57('0xe'));var toCsv=require(_0x2d57('0x9'));var querystring=require(_0x2d57('0xf'));var Papa=require(_0x2d57('0x10'));var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require(_0x2d57('0x11'));var authService=require(_0x2d57('0x12'));var qs=require(_0x2d57('0x13'));var as=require(_0x2d57('0x14'));var hardwareService=require(_0x2d57('0x15'));var logger=require('../../config/logger')(_0x2d57('0x16'));var utils=require('../../config/utils');var config=require(_0x2d57('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2d57('0x18'))['db'];function respondWithStatusCode(_0x42a282,_0x45ffdd){_0x45ffdd=_0x45ffdd||0xcc;return function(_0x56070e){if(_0x56070e){return _0x42a282[_0x2d57('0x19')](_0x45ffdd);}return _0x42a282[_0x2d57('0x1a')](_0x45ffdd)[_0x2d57('0x1b')]();};}function respondWithResult(_0x424f46,_0x486ec3){_0x486ec3=_0x486ec3||0xc8;return function(_0x29ff72){if(_0x29ff72){return _0x424f46['status'](_0x486ec3)[_0x2d57('0x1c')](_0x29ff72);}};}function respondWithFilteredResult(_0x104c4a,_0x4e3fa3){return function(_0x47b0b9){if(_0x47b0b9){var _0x428515=typeof _0x4e3fa3[_0x2d57('0x1d')]==='undefined'&&typeof _0x4e3fa3[_0x2d57('0x1e')]===_0x2d57('0x1f');var _0x137e8f=_0x47b0b9[_0x2d57('0x20')];var _0xfbd2fc=_0x428515?0x0:_0x4e3fa3[_0x2d57('0x1d')];var _0x42132f=_0x428515?_0x47b0b9[_0x2d57('0x20')]:_0x4e3fa3[_0x2d57('0x1d')]+_0x4e3fa3[_0x2d57('0x1e')];var _0x5cb6e5;if(_0x42132f>=_0x137e8f){_0x42132f=_0x137e8f;_0x5cb6e5=0xc8;}else{_0x5cb6e5=0xce;}_0x104c4a[_0x2d57('0x1a')](_0x5cb6e5);return _0x104c4a[_0x2d57('0x21')](_0x2d57('0x22'),_0xfbd2fc+'-'+_0x42132f+'/'+_0x137e8f)[_0x2d57('0x1c')](_0x47b0b9);}return null;};}function patchUpdates(_0x5ba011){return function(_0x4807cc){try{jsonpatch[_0x2d57('0x23')](_0x4807cc,_0x5ba011,!![]);}catch(_0x5cae38){return BPromise[_0x2d57('0x24')](_0x5cae38);}return _0x4807cc[_0x2d57('0x25')]();};}function saveUpdates(_0x1c2d0f,_0x358e14){return function(_0x4629dc){if(_0x4629dc){return _0x4629dc[_0x2d57('0x26')](_0x1c2d0f)['then'](function(_0xfe2061){return _0xfe2061;});}return null;};}function removeEntity(_0xba0ad2,_0x28958a){return function(_0x44dab5){if(_0x44dab5){return _0x44dab5[_0x2d57('0x27')]()['then'](function(){_0xba0ad2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x33be64,_0x569b29){return function(_0x241dd8){if(!_0x241dd8){_0x33be64[_0x2d57('0x19')](0x194);}return _0x241dd8;};}function handleError(_0x119f10,_0xd65c18){_0xd65c18=_0xd65c18||0x1f4;return function(_0x4492e9){logger['error'](_0x4492e9[_0x2d57('0x28')]);if(_0x4492e9['name']){delete _0x4492e9[_0x2d57('0x29')];}_0x119f10[_0x2d57('0x1a')](_0xd65c18)['send'](_0x4492e9);};}exports[_0x2d57('0x2a')]=function(_0x1e9454,_0x3fc783){var _0x2cf836={},_0x3229ae={},_0xa246c4={'count':0x0,'rows':[]};var _0x7ec91c=_[_0x2d57('0x2b')](db[_0x2d57('0x2c')][_0x2d57('0x2d')],function(_0x32dd2b){return{'name':_0x32dd2b['fieldName'],'type':_0x32dd2b[_0x2d57('0x2e')][_0x2d57('0x2f')]};});_0x3229ae['model']=_[_0x2d57('0x30')](_[_0x2d57('0x2b')](_0x7ec91c,'name'),[_0x2d57('0x31')]);_0x3229ae[_0x2d57('0x32')]=_[_0x2d57('0x33')](_0x1e9454['query']);_0x3229ae['filters']=_[_0x2d57('0x34')](_0x3229ae[_0x2d57('0x35')],_0x3229ae['query']);_0x2cf836[_0x2d57('0x36')]=_[_0x2d57('0x34')](_0x3229ae[_0x2d57('0x35')],qs[_0x2d57('0x37')](_0x1e9454[_0x2d57('0x32')]['fields']));_0x2cf836[_0x2d57('0x36')]=_0x2cf836[_0x2d57('0x36')][_0x2d57('0x38')]?_0x2cf836[_0x2d57('0x36')]:_0x3229ae[_0x2d57('0x35')];if(!_0x1e9454[_0x2d57('0x32')]['hasOwnProperty'](_0x2d57('0x39'))){_0x2cf836[_0x2d57('0x1e')]=qs[_0x2d57('0x1e')](_0x1e9454[_0x2d57('0x32')][_0x2d57('0x1e')]);_0x2cf836[_0x2d57('0x1d')]=qs[_0x2d57('0x1d')](_0x1e9454[_0x2d57('0x32')]['offset']);}_0x2cf836[_0x2d57('0x3a')]=qs[_0x2d57('0x3b')](_0x1e9454[_0x2d57('0x32')][_0x2d57('0x3b')]);_0x2cf836['where']=qs[_0x2d57('0x3c')](_[_0x2d57('0x3d')](_0x1e9454['query'],_0x3229ae['filters']),_0x7ec91c);if(_0x1e9454[_0x2d57('0x32')]['filter']){_0x2cf836['where']=_['merge'](_0x2cf836['where'],{'$or':_[_0x2d57('0x2b')](_0x7ec91c,function(_0x397fa9){if(_0x397fa9[_0x2d57('0x2e')]!=='VIRTUAL'){var _0xe76493={};_0xe76493[_0x397fa9[_0x2d57('0x29')]]={'$like':'%'+_0x1e9454['query'][_0x2d57('0x3e')]+'%'};return _0xe76493;}})});}_0x2cf836=_['merge']({},_0x2cf836,_0x1e9454[_0x2d57('0x3f')]);var _0x302a11={'where':_0x2cf836['where']};return db[_0x2d57('0x2c')]['count'](_0x302a11)[_0x2d57('0x40')](function(_0x92724b){_0xa246c4[_0x2d57('0x20')]=_0x92724b;if(_0x1e9454[_0x2d57('0x32')][_0x2d57('0x41')]){_0x2cf836[_0x2d57('0x42')]=[{'all':!![]}];}return db[_0x2d57('0x2c')]['findAll'](_0x2cf836);})['then'](function(_0x5a4812){_0xa246c4[_0x2d57('0x43')]=_0x5a4812;return _0xa246c4;})[_0x2d57('0x40')](respondWithFilteredResult(_0x3fc783,_0x2cf836))[_0x2d57('0x44')](handleError(_0x3fc783,null));};exports['show']=function(_0x27ac23,_0x51285a){var _0x4672aa={'raw':![],'where':{'id':_0x27ac23[_0x2d57('0x45')]['id']}},_0xcf019c={};_0xcf019c[_0x2d57('0x35')]=_[_0x2d57('0x33')](db[_0x2d57('0x2c')]['rawAttributes']);_0xcf019c[_0x2d57('0x32')]=_[_0x2d57('0x33')](_0x27ac23['query']);_0xcf019c[_0x2d57('0x3c')]=_[_0x2d57('0x34')](_0xcf019c[_0x2d57('0x35')],_0xcf019c[_0x2d57('0x32')]);_0x4672aa['attributes']=_[_0x2d57('0x34')](_0xcf019c['model'],qs['fields'](_0x27ac23[_0x2d57('0x32')][_0x2d57('0x37')]));_0x4672aa['attributes']=_0x4672aa['attributes'][_0x2d57('0x38')]?_0x4672aa[_0x2d57('0x36')]:_0xcf019c[_0x2d57('0x35')];if(_0x27ac23[_0x2d57('0x32')]['includeAll']){_0x4672aa[_0x2d57('0x42')]=[{'all':!![]}];}_0x4672aa=_[_0x2d57('0x46')]({},_0x4672aa,_0x27ac23[_0x2d57('0x3f')]);return db[_0x2d57('0x2c')][_0x2d57('0x47')](_0x4672aa)[_0x2d57('0x40')](handleEntityNotFound(_0x51285a,null))[_0x2d57('0x40')](respondWithResult(_0x51285a,null))[_0x2d57('0x44')](handleError(_0x51285a,null));};exports['create']=function(_0x347b77,_0x299f8a){return db[_0x2d57('0x2c')][_0x2d57('0x48')](_0x347b77['body'],{})[_0x2d57('0x40')](respondWithResult(_0x299f8a,0xc9))['catch'](handleError(_0x299f8a,null));};exports[_0x2d57('0x26')]=function(_0x21b0ab,_0x27734f){if(_0x21b0ab[_0x2d57('0x49')]['id']){delete _0x21b0ab['body']['id'];}return db[_0x2d57('0x2c')][_0x2d57('0x47')]({'where':{'id':_0x21b0ab['params']['id']}})[_0x2d57('0x40')](handleEntityNotFound(_0x27734f,null))[_0x2d57('0x40')](saveUpdates(_0x21b0ab[_0x2d57('0x49')],null))['then'](respondWithResult(_0x27734f,null))[_0x2d57('0x44')](handleError(_0x27734f,null));};exports[_0x2d57('0x4a')]=function(_0x4e269a,_0x1e0ae6){return db[_0x2d57('0x2c')][_0x2d57('0x4a')]()[_0x2d57('0x40')](respondWithResult(_0x1e0ae6,null))['catch'](handleError(_0x1e0ae6,null));};exports[_0x2d57('0x4b')]=function(_0x2c7757,_0x2455f7,_0x1a9a1f){var _0x534ab3=require('../../components/encryptor');var _0xe12c20=![];var _0x175440={};if(_0x2c7757[_0x2d57('0x32')][_0x2d57('0x2e')]&&_0x2c7757[_0x2d57('0x32')][_0x2d57('0x2e')]==='uniqueid'){_0x175440[_0x2d57('0x4c')]=_0x2c7757['params']['id'];}else{_0x175440['id']=_0x2c7757[_0x2d57('0x45')]['id'];}return db[_0x2d57('0x2c')]['find']({'where':_0x175440,'attributes':['id',_0x2d57('0x4d')],'raw':!![]})[_0x2d57('0x40')](handleEntityNotFound(_0x2455f7,null))[_0x2d57('0x40')](function(_0x18f0bf){if(_0x18f0bf){var _0x28fefd=_0x18f0bf[_0x2d57('0x4d')];var _0xb2b312=util[_0x2d57('0x31')](_0x2d57('0x4e'),_0x28fefd);if(fs[_0x2d57('0x4f')](_0xb2b312)){_0xe12c20=!![];return _0x534ab3[_0x2d57('0x50')](_0xb2b312,_0x28fefd,config[_0x2d57('0x51')]['recording'])[_0x2d57('0x40')](function(){return _0x18f0bf;});}return _0x18f0bf;}})[_0x2d57('0x40')](function(_0x4ab99a){if(_0x4ab99a){var _0x56f796=_0x4ab99a[_0x2d57('0x4d')];if(!fs[_0x2d57('0x4f')](_0x56f796)){throw new db['Sequelize'][(_0x2d57('0x52'))](_0x2d57('0x53'));}if(_0x4ab99a[_0x2d57('0x54')]){return _0x2455f7[_0x2d57('0x4b')](_0x56f796,_0x4ab99a[_0x2d57('0x54')]+path[_0x2d57('0x55')](_0x56f796),function(){if(_0xe12c20){fs[_0x2d57('0x56')](_0x56f796);}});}else{return _0x2455f7[_0x2d57('0x4b')](_0x56f796,function(_0x57768f){if(_0xe12c20){fs[_0x2d57('0x56')](_0x56f796);}});}}})[_0x2d57('0x44')](function(_0x9a47d7){if(_0x9a47d7['message']===_0x2d57('0x53')){_0x2455f7[_0x2d57('0x1a')](0x194)[_0x2d57('0x57')](_0x2d57('0x58'));}else{return handleError(_0x2455f7,null);}});};exports[_0x2d57('0x59')]=function(_0x22642b,_0x4d74de,_0x1d39f2){var _0x4441a4=require(_0x2d57('0x5a'));var _0x27dcb3=![];var _0x4fb5c5={'$and':[db[_0x2d57('0x5b')][_0x2d57('0x5c')](db[_0x2d57('0x5b')]['fn'](_0x2d57('0x5d'),db[_0x2d57('0x5b')]['col'](_0x2d57('0x4c'))),_0x22642b[_0x2d57('0x32')][_0x2d57('0x5e')])]};if(_0x22642b['query'][_0x2d57('0x2e')]&&_0x22642b[_0x2d57('0x32')][_0x2d57('0x2e')]===_0x2d57('0x4c')){_0x4fb5c5[_0x2d57('0x5f')][_0x2d57('0x60')]({'uniqueid':_0x22642b[_0x2d57('0x45')]['id']});}else{_0x4fb5c5[_0x2d57('0x5f')][_0x2d57('0x60')]({'id':_0x22642b[_0x2d57('0x45')]['id']});}return db[_0x2d57('0x2c')]['find']({'where':_0x4fb5c5,'attributes':['id','value'],'raw':!![]})[_0x2d57('0x40')](handleEntityNotFound(_0x4d74de,null))[_0x2d57('0x40')](function(_0x2b227e){if(_0x2b227e){var _0x72aba8=util[_0x2d57('0x31')](_0x2d57('0x4e'),_0x2b227e['value']);if(fs[_0x2d57('0x4f')](_0x72aba8)){_0x27dcb3=!![];return _0x4441a4[_0x2d57('0x50')](_0x72aba8,_0x2b227e[_0x2d57('0x4d')],config['secrets'][_0x2d57('0x61')])[_0x2d57('0x40')](function(){return _0x2b227e;});}return _0x2b227e;}})[_0x2d57('0x40')](function(_0x51d949){if(_0x51d949){if(!fs[_0x2d57('0x4f')](_0x51d949[_0x2d57('0x4d')])){throw new db[(_0x2d57('0x62'))][(_0x2d57('0x52'))](_0x2d57('0x53'));}if(_0x51d949[_0x2d57('0x54')]){return _0x4d74de['download'](_0x51d949[_0x2d57('0x4d')],_0x51d949[_0x2d57('0x54')]+path[_0x2d57('0x55')](_0x51d949[_0x2d57('0x4d')]),function(){if(_0x27dcb3){fs['unlink'](_0x51d949['value']);}});}else{return _0x4d74de[_0x2d57('0x4b')](_0x51d949[_0x2d57('0x4d')],function(_0x4bb730){if(_0x27dcb3){fs['unlink'](_0x51d949[_0x2d57('0x4d')]);}});}}})[_0x2d57('0x44')](handleError(_0x4d74de,null));};exports[_0x2d57('0x27')]=function(_0x1c7e1b,_0x30fcec){return db[_0x2d57('0x2c')][_0x2d57('0x47')]({'where':{'id':_0x1c7e1b['params']['id']}})[_0x2d57('0x40')](function(_0x363968){if(_[_0x2d57('0x63')](_0x363968)){throw new ReferenceError(_0x2d57('0x64'));}return _0x363968;})['then'](function(_0xe990e){var _0x1b3f45=_0xe990e['value'];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x1b3f45);if(!_[_0x2d57('0x63')](_0xe990e[_0x2d57('0x4d')])&&fs[_0x2d57('0x4f')](_0x1b3f45)){logger[_0x2d57('0x65')](_0x2d57('0x66')+_0x1b3f45+_0x2d57('0x67'));fs['unlinkSync'](_0x1b3f45);}_0x1b3f45=_0x1b3f45+'.cypher';if(!_['isNil'](_0xe990e['value'])&&fs[_0x2d57('0x4f')](_0x1b3f45)){logger[_0x2d57('0x65')](_0x2d57('0x66')+_0x1b3f45+_0x2d57('0x67'));fs[_0x2d57('0x68')](_0x1b3f45);}return _0xe990e;})[_0x2d57('0x40')](function(_0x1e8dc5){if(!_0x1e8dc5)throw new InternalError();return _0x1e8dc5['destroy']();})[_0x2d57('0x40')](function(){_0x30fcec[_0x2d57('0x1a')](0xcc)[_0x2d57('0x1b')]();})[_0x2d57('0x44')](handleError(_0x30fcec,null));};function getBucketslist(_0x5dea9a,_0x491528,_0x39e9e6){return new Promise(function(_0x2a4269,_0x401b55){var _0x45c285=new AWS['S3']({'accessKeyId':_0x491528,'secretAccessKey':_0x5dea9a,'region':_0x39e9e6});_0x45c285[_0x2d57('0x69')]({},function(_0x1e9e7f,_0x2eacff){if(_0x1e9e7f){return _0x401b55(_0x1e9e7f);}else{return _0x2a4269(_0x2eacff);}});});}function createBucket(_0x3844a8,_0x18ae2c,_0x23c04f,_0x18870f){return new Promise(function(_0x52896a,_0x40a818){var _0xe1da5b=new AWS['S3']({'accessKeyId':_0x18ae2c,'secretAccessKey':_0x3844a8,'region':_0x23c04f});_0xe1da5b[_0x2d57('0x6a')]({'Bucket':_0x18870f},function(_0x56bbe8,_0x317dc2){if(_0x56bbe8){return _0x40a818(_0x56bbe8);}else{return _0x52896a(_0x317dc2);}});});}function uploadFile(_0x4e6a1b,_0x586c0f,_0x289ce3,_0x21b56e,_0x4d54c2,_0x2ebff6){return new Promise(function(_0x256042,_0x48efd4){var _0x41cce3=new AWS['S3']({'accessKeyId':_0x586c0f,'secretAccessKey':_0x4e6a1b,'region':_0x289ce3});_0x41cce3[_0x2d57('0x6b')]({'Bucket':_0x21b56e,'Key':_0x4d54c2,'Body':_0x2ebff6},function(_0x2a1579,_0xf4a66e){if(_0x2a1579){return _0x48efd4(_0x2a1579);}else{return _0x256042(_0xf4a66e);}});});}function startTranscribe(_0x169a7a,_0x27af89,_0x5677f8,_0x584463,_0x2d4078,_0x10ce36){return new Promise(function(_0x5cd715,_0x258521){var _0x305a58=new AWS[(_0x2d57('0x6c'))]({'accessKeyId':_0x27af89,'secretAccessKey':_0x169a7a,'region':_0x5677f8});_0x305a58[_0x2d57('0x6d')]({'TranscriptionJobName':_0x584463,'LanguageCode':_0x2d4078,'Media':{'MediaFileUri':_0x10ce36}},function(_0x36e911,_0x1b7410){if(_0x36e911){return _0x258521(_0x36e911);}else{return _0x5cd715(_0x1b7410);}});});}function transcribe(_0x51e762,_0x4011d3,_0x2bb0f8,_0x240052,_0x1adce1,_0x34bc7c,_0x4e491f){return new Promise(function(_0x28c1f7,_0x392722){var _0x335bfe={};logger['info'](util[_0x2d57('0x31')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x51e762,_0x1adce1));return uploadFile(_0x4011d3,_0x2bb0f8,_0x240052,_0x1adce1,path[_0x2d57('0x6e')](_0x34bc7c),fs[_0x2d57('0x6f')](_0x34bc7c))[_0x2d57('0x40')](function(_0x2035f0){logger[_0x2d57('0x65')](util[_0x2d57('0x31')](_0x2d57('0x70'),_0x51e762,_0x1adce1,_0x2035f0[_0x2d57('0x71')]));_0x335bfe[_0x2d57('0x72')]=_0x2035f0[_0x2d57('0x73')];_0x335bfe[_0x2d57('0x74')]=_0x2035f0[_0x2d57('0x71')];logger[_0x2d57('0x65')](util[_0x2d57('0x31')](_0x2d57('0x75'),_0x51e762));return startTranscribe(_0x4011d3,_0x2bb0f8,_0x240052,uuidv4(),_0x4e491f,_0x2035f0[_0x2d57('0x71')]);})[_0x2d57('0x40')](function(_0x26e6d0){logger[_0x2d57('0x65')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x51e762,_0x26e6d0['TranscriptionJob'][_0x2d57('0x76')]));_0x335bfe[_0x2d57('0x77')]=_0x26e6d0[_0x2d57('0x78')]['TranscriptionJobName'];_0x335bfe['transcribeStatus']=_0x26e6d0[_0x2d57('0x78')][_0x2d57('0x79')];return _0x28c1f7(_0x335bfe);})[_0x2d57('0x44')](function(_0x5d2324){return _0x392722(_0x5d2324);});});}exports['runTranscribe']=function(_0x4b3da5,_0x292e48,_0x22556e){var _0x426c8d;var _0x4aee14;var _0x38b517;var _0x27d698=require(_0x2d57('0x5a'));return db[_0x2d57('0x2c')][_0x2d57('0x7a')]({'where':{'id':_0x4b3da5['params']['id']}})[_0x2d57('0x40')](function(_0xc5c756){if(_0xc5c756){var _0xe154e0=util[_0x2d57('0x31')](_0x2d57('0x4e'),_0xc5c756[_0x2d57('0x4d')]);if(fs[_0x2d57('0x4f')](_0xe154e0)){cypher=!![];return _0x27d698['decryptFile'](_0xe154e0,_0xc5c756[_0x2d57('0x4d')],config['secrets'][_0x2d57('0x61')])['then'](function(){return _0xc5c756;});}return _0xc5c756;}})[_0x2d57('0x40')](function(_0x2c228a){if(!_0x2c228a){throw new db[(_0x2d57('0x62'))][(_0x2d57('0x52'))](_0x2d57('0x7b'));}_0x4aee14=_0x2c228a;return db[_0x2d57('0x7c')][_0x2d57('0x7a')]({'where':{'id':0x1}});})[_0x2d57('0x40')](handleEntityNotFound(_0x292e48,null))[_0x2d57('0x40')](function(_0x4dd643){if(_0x4dd643){_0x426c8d=_0x4dd643;if(!_0x426c8d[_0x2d57('0x7d')]||!_0x426c8d[_0x2d57('0x7e')]||!_0x426c8d[_0x2d57('0x7f')]||!_0x426c8d['language']||!_0x426c8d['bucket']){throw new db[(_0x2d57('0x62'))][(_0x2d57('0x52'))](_0x2d57('0x80'));}if(_0x4b3da5['body'][_0x2d57('0x81')]&&(!_0x426c8d[_0x2d57('0x82')]||!_0x426c8d[_0x2d57('0x83')]||!_0x426c8d['sentimentRegion']||!_0x426c8d[_0x2d57('0x84')]||!_0x426c8d[_0x2d57('0x72')])){throw new db[(_0x2d57('0x62'))][(_0x2d57('0x52'))](_0x2d57('0x85'));}return db[_0x2d57('0x86')][_0x2d57('0x7a')]({'where':{'id':_0x426c8d[_0x2d57('0x7e')]}});}})[_0x2d57('0x40')](function(_0x13b4c5){if(!_0x13b4c5){throw new db[(_0x2d57('0x62'))][(_0x2d57('0x52'))](_0x2d57('0x87'));}if(!_0x13b4c5['data1']||!_0x13b4c5['data2']){throw new db[(_0x2d57('0x62'))][(_0x2d57('0x52'))](_0x2d57('0x88'));}_0x38b517=_0x13b4c5;return getBucketslist(_0x38b517[_0x2d57('0x89')],_0x38b517[_0x2d57('0x8a')],_0x426c8d[_0x2d57('0x7f')]);})[_0x2d57('0x40')](function(_0x11e981){if(_0x11e981&&_0x11e981['Buckets']){var _0x3f2e59=_['find'](_0x11e981[_0x2d57('0x8b')],function(_0x3334dd){return _0x3334dd[_0x2d57('0x8c')]===_0x426c8d['bucket'];});if(!_0x3f2e59){logger[_0x2d57('0x65')](util[_0x2d57('0x31')](_0x2d57('0x8d'),_0x4b3da5[_0x2d57('0x45')]['id'],_0x426c8d[_0x2d57('0x72')]));return createBucket(_0x38b517[_0x2d57('0x89')],_0x38b517[_0x2d57('0x8a')],_0x426c8d['transcribeRegion'],_0x426c8d[_0x2d57('0x72')]);}logger[_0x2d57('0x65')](util[_0x2d57('0x31')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x4b3da5['params']['id'],_0x426c8d['bucket']));return;}})[_0x2d57('0x40')](function(_0x375609){if(_0x4aee14[_0x2d57('0x8e')]===_0x2d57('0x8f')){return transcribe(_0x4b3da5['params']['id'],_0x38b517[_0x2d57('0x89')],_0x38b517[_0x2d57('0x8a')],_0x426c8d['transcribeRegion'],_0x426c8d[_0x2d57('0x72')],_0x4aee14['value'],_0x426c8d[_0x2d57('0x84')]);}else{logger[_0x2d57('0x65')](util['format'](_0x2d57('0x90'),_0x4b3da5['params']['id']));return{'transcribeStatus':_0x2d57('0x91')};}})[_0x2d57('0x40')](function(_0x256b92){if(_0x256b92){_0x256b92[_0x2d57('0x92')]=_0x4b3da5['body'][_0x2d57('0x81')];return _0x4aee14[_0x2d57('0x93')](_0x256b92);}})[_0x2d57('0x40')](respondWithResult(_0x292e48,null))[_0x2d57('0x44')](handleError(_0x292e48,null));};function writeFile(_0x32981d,_0x250055){return new Promise(function(_0x11a68f,_0x225aac){fs[_0x2d57('0x94')](_0x250055,_0x32981d,function(_0x300678,_0x4450a4){if(_0x300678){return _0x225aac(_0x300678);}else{return _0x11a68f(_0x4450a4);}});});}exports[_0x2d57('0x95')]=function(_0xef09ba,_0x19c5b3,_0x2f0cc8){return db[_0x2d57('0x2c')][_0x2d57('0x7a')]({'where':{'id':_0xef09ba[_0x2d57('0x45')]['id']}})[_0x2d57('0x40')](handleEntityNotFound(_0x19c5b3))[_0x2d57('0x40')](function(_0x1c1aab){if(_0x1c1aab&&_0x1c1aab[_0x2d57('0x96')]){var _0x4de0a6=_0x1c1aab[_0x2d57('0x96')];var _0x4764fe=config['root']+_0x2d57('0x97')+_0x1c1aab['id']+_0x2d57('0x98');if(fs['existsSync'](_0x4764fe)){return _0x4764fe;}return writeFile(_0x4de0a6,_0x4764fe)[_0x2d57('0x40')](function(){return _0x4764fe;});}else{throw new db[(_0x2d57('0x62'))][(_0x2d57('0x52'))]('Transcript\x20not\x20available');}})['then'](function(_0x12665f){return _0x19c5b3[_0x2d57('0x4b')](_0x12665f);})[_0x2d57('0x44')](handleError(_0x19c5b3));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 35f5ad4..c0b4c73 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 _0xfc73=['transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x3497f3,_0xd4efdf){var _0x1937b2=function(_0x44df2f){while(--_0x44df2f){_0x3497f3['push'](_0x3497f3['shift']());}};_0x1937b2(++_0xd4efdf);}(_0xfc73,0x8d));var _0x3fc7=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xfc73[_0x1589dd];return _0x1bddd1;};'use strict';var attributes=require(_0x3fc7('0x0'));module[_0x3fc7('0x1')]=function(_0x4fc3c4,_0x117f70){return _0x4fc3c4[_0x3fc7('0x2')](_0x3fc7('0x3'),attributes,{'tableName':_0x3fc7('0x4'),'paranoid':![],'indexes':[{'name':_0x3fc7('0x5'),'fields':[_0x3fc7('0x5')]},{'name':_0x3fc7('0x6'),'fields':[_0x3fc7('0x6')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbbb8=['exports','define','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x161105,_0x34a84f){var _0x1c8085=function(_0x33b629){while(--_0x33b629){_0x161105['push'](_0x161105['shift']());}};_0x1c8085(++_0x34a84f);}(_0xbbb8,0x7d));var _0x8bbb=function(_0xf04283,_0x37588e){_0xf04283=_0xf04283-0x0;var _0x51c262=_0xbbb8[_0xf04283];return _0x51c262;};'use strict';var attributes=require(_0x8bbb('0x0'));module[_0x8bbb('0x1')]=function(_0x51ba1c,_0x1ff8cd){return _0x51ba1c[_0x8bbb('0x2')]('VoiceRecording',attributes,{'tableName':_0x8bbb('0x3'),'paranoid':![],'indexes':[{'name':_0x8bbb('0x4'),'fields':[_0x8bbb('0x4')]},{'name':_0x8bbb('0x5'),'fields':[_0x8bbb('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 0a045c4..29672c7 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 _0x2542=['catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','UpdateVoiceRecording','update','body','options','raw','where','limit','../../components/encryptor','Setting','callRecordingEncryption','VoiceRecording','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording'];(function(_0x510abd,_0x31689f){var _0x5eb82c=function(_0x210619){while(--_0x210619){_0x510abd['push'](_0x510abd['shift']());}};_0x5eb82c(++_0x31689f);}(_0x2542,0x169));var _0x2254=function(_0x16e752,_0x4e00c6){_0x16e752=_0x16e752-0x0;var _0x51c950=_0x2542[_0x16e752];return _0x51c950;};'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);});});}exports[_0x2254('0x16')]=function(_0x1ae11e){var _0x34f90e=this;return new Promise(function(_0x497724,_0x51b395){return db['VoiceRecording'][_0x2254('0x17')](_0x1ae11e[_0x2254('0x18')],{'raw':_0x1ae11e[_0x2254('0x19')]?_0x1ae11e[_0x2254('0x19')][_0x2254('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ae11e[_0x2254('0x19')]?_0x1ae11e['options'][_0x2254('0x1b')]||null:null,'attributes':_0x1ae11e[_0x2254('0x19')]?_0x1ae11e[_0x2254('0x19')]['attributes']||null:null,'limit':_0x1ae11e['options']?_0x1ae11e['options'][_0x2254('0x1c')]||null:null})[_0x2254('0xc')](function(_0xf88b56){logger['info']('UpdateVoiceRecording',_0x1ae11e);logger['debug']('UpdateVoiceRecording',_0x1ae11e,JSON['stringify'](_0xf88b56));_0x497724(_0xf88b56);})['catch'](function(_0x1aa71f){logger[_0x2254('0x14')](_0x2254('0x16'),_0x1aa71f[_0x2254('0x15')],_0x1ae11e);_0x51b395(_0x34f90e[_0x2254('0x14')](0x1f4,_0x1aa71f[_0x2254('0x15')]));});});};exports['CreateVoiceRecording']=function(_0x4a8274){var _0x1ada42=this;return new Promise(function(_0x4f6877,_0x35608a){var _0x141dc5=require(_0x2254('0x1d'));var _0x3aa0bd;return db[_0x2254('0x1e')]['findOne']({'attributes':['id',_0x2254('0x1f')],'where':{'id':0x1},'raw':!![]})[_0x2254('0xc')](function(_0x21285d){_0x3aa0bd=_0x21285d;return db[_0x2254('0x20')][_0x2254('0x21')](_0x4a8274[_0x2254('0x18')]);})[_0x2254('0xc')](function(_0x22e791){if(_0x3aa0bd[_0x2254('0x1f')]&&fs[_0x2254('0x22')](_0x22e791[_0x2254('0x23')])){var _0xad7774=util[_0x2254('0x24')](_0x2254('0x25'),_0x22e791[_0x2254('0x23')]);return _0x141dc5[_0x2254('0x26')](_0x22e791[_0x2254('0x23')],_0xad7774,config[_0x2254('0x27')][_0x2254('0x28')])['then'](function(){fs[_0x2254('0x29')](_0x22e791[_0x2254('0x23')]);logger[_0x2254('0xd')](_0x2254('0x2a'));return _0x22e791;});}return _0x22e791;})[_0x2254('0xc')](function(_0x1d275b){logger[_0x2254('0xd')](_0x2254('0x2b'),_0x4a8274);logger[_0x2254('0xf')]('CreateVoiceRecording',_0x4a8274,JSON[_0x2254('0x12')](_0x1d275b));_0x4f6877(_0x1d275b);})[_0x2254('0x2c')](function(_0x503540){logger[_0x2254('0x14')](_0x2254('0x2b'),_0x503540[_0x2254('0x15')],_0x4a8274);_0x35608a(_0x1ada42[_0x2254('0x14')](0x1f4,_0x503540['message']));});});}; \ No newline at end of file +var _0x5464=['UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','format','encryptFile','value','secrets','unlink','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch'];(function(_0x14cc29,_0x4b1488){var _0x52dea5=function(_0x12b7de){while(--_0x12b7de){_0x14cc29['push'](_0x14cc29['shift']());}};_0x52dea5(++_0x4b1488);}(_0x5464,0x15d));var _0x4546=function(_0x34df8c,_0x387233){_0x34df8c=_0x34df8c-0x0;var _0x3729d4=_0x5464[_0x34df8c];return _0x3729d4;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var moment=require(_0x4546('0x2'));var BPromise=require('bluebird');var rs=require(_0x4546('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4546('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4546('0x5'))(_0x4546('0x6'));var config=require(_0x4546('0x7'));var jayson=require(_0x4546('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c5e09,_0x224c7c,_0x36c875){return new BPromise(function(_0x1a76c1,_0x2e860a){return client[_0x4546('0x9')](_0x5c5e09,_0x36c875)[_0x4546('0xa')](function(_0x11d63e){logger[_0x4546('0xb')](_0x4546('0xc'),_0x224c7c,'request\x20sent');logger[_0x4546('0xd')](_0x4546('0xe'),_0x224c7c,_0x4546('0xf'),JSON['stringify'](_0x11d63e));if(_0x11d63e[_0x4546('0x10')]){if(_0x11d63e[_0x4546('0x10')][_0x4546('0x11')]===0x1f4){logger[_0x4546('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x224c7c,_0x11d63e['error'][_0x4546('0x12')]);return _0x2e860a(_0x11d63e['error']['message']);}logger['error']('VoiceRecording,\x20%s,\x20%s',_0x224c7c,_0x11d63e['error']['message']);return _0x1a76c1(_0x11d63e[_0x4546('0x10')]['message']);}else{logger[_0x4546('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x224c7c,_0x4546('0xf'));_0x1a76c1(_0x11d63e['result'][_0x4546('0x12')]);}})[_0x4546('0x13')](function(_0x24b32a){logger[_0x4546('0x10')](_0x4546('0xc'),_0x224c7c,_0x24b32a);_0x2e860a(_0x24b32a);});});}exports[_0x4546('0x14')]=function(_0x57d8de){var _0x4ffd6b=this;return new Promise(function(_0x5780a7,_0x330235){return db[_0x4546('0x15')][_0x4546('0x16')](_0x57d8de[_0x4546('0x17')],{'raw':_0x57d8de[_0x4546('0x18')]?_0x57d8de[_0x4546('0x18')][_0x4546('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57d8de[_0x4546('0x18')]?_0x57d8de[_0x4546('0x18')][_0x4546('0x1a')]||null:null,'attributes':_0x57d8de['options']?_0x57d8de[_0x4546('0x18')][_0x4546('0x1b')]||null:null,'limit':_0x57d8de['options']?_0x57d8de[_0x4546('0x18')][_0x4546('0x1c')]||null:null})[_0x4546('0xa')](function(_0x2f065d){logger[_0x4546('0xb')](_0x4546('0x14'),_0x57d8de);logger['debug'](_0x4546('0x14'),_0x57d8de,JSON[_0x4546('0x1d')](_0x2f065d));_0x5780a7(_0x2f065d);})['catch'](function(_0x824698){logger[_0x4546('0x10')](_0x4546('0x14'),_0x824698[_0x4546('0x12')],_0x57d8de);_0x330235(_0x4ffd6b[_0x4546('0x10')](0x1f4,_0x824698['message']));});});};exports[_0x4546('0x1e')]=function(_0x3796fe){var _0x831fa5=this;return new Promise(function(_0x48fc36,_0x4c1dad){var _0x43740e=require(_0x4546('0x1f'));var _0x15611c;return db[_0x4546('0x20')][_0x4546('0x21')]({'attributes':['id',_0x4546('0x22')],'where':{'id':0x1},'raw':!![]})[_0x4546('0xa')](function(_0x586ff1){_0x15611c=_0x586ff1;return db[_0x4546('0x15')]['create'](_0x3796fe[_0x4546('0x17')]);})[_0x4546('0xa')](function(_0x5396c5){if(_0x15611c['callRecordingEncryption']&&fs[_0x4546('0x23')](_0x5396c5['value'])){var _0x3c7c7d=util[_0x4546('0x24')]('%s.cypher',_0x5396c5['value']);return _0x43740e[_0x4546('0x25')](_0x5396c5[_0x4546('0x26')],_0x3c7c7d,config[_0x4546('0x27')]['recording'])[_0x4546('0xa')](function(){fs[_0x4546('0x28')](_0x5396c5['value']);logger[_0x4546('0xb')]('CreateVoiceRecording\x20file\x20encrypted');return _0x5396c5;});}return _0x5396c5;})[_0x4546('0xa')](function(_0x44f604){logger[_0x4546('0xb')](_0x4546('0x1e'),_0x3796fe);logger['debug'](_0x4546('0x1e'),_0x3796fe,JSON[_0x4546('0x1d')](_0x44f604));_0x48fc36(_0x44f604);})[_0x4546('0x13')](function(_0x298bef){logger[_0x4546('0x10')](_0x4546('0x1e'),_0x298bef['message'],_0x3796fe);_0x4c1dad(_0x831fa5[_0x4546('0x10')](0x1f4,_0x298bef[_0x4546('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 0c9503b..f55d700 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 _0xc9d6=['describe','/:id','show','post','create','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/describe'];(function(_0x5af8e1,_0x4d11a8){var _0x86ff0a=function(_0x5531bf){while(--_0x5531bf){_0x5af8e1['push'](_0x5af8e1['shift']());}};_0x86ff0a(++_0x4d11a8);}(_0xc9d6,0x1dc));var _0x6c9d=function(_0x35d8bf,_0x50ef9a){_0x35d8bf=_0x35d8bf-0x0;var _0x1fe59a=_0xc9d6[_0x35d8bf];return _0x1fe59a;};'use strict';var multer=require(_0x6c9d('0x0'));var util=require(_0x6c9d('0x1'));var path=require(_0x6c9d('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c9d('0x3'));var router=express[_0x6c9d('0x4')]();var fs_extra=require(_0x6c9d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6c9d('0x6'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0x6c9d('0x7')]('/',auth[_0x6c9d('0x8')](),controller['index']);router[_0x6c9d('0x7')](_0x6c9d('0x9'),auth[_0x6c9d('0x8')](),controller[_0x6c9d('0xa')]);router[_0x6c9d('0x7')](_0x6c9d('0xb'),auth[_0x6c9d('0x8')](),controller[_0x6c9d('0xc')]);router[_0x6c9d('0xd')]('/',auth[_0x6c9d('0x8')](),controller[_0x6c9d('0xe')]);router[_0x6c9d('0xf')]('/:id',auth[_0x6c9d('0x8')](),controller[_0x6c9d('0x10')]);router[_0x6c9d('0x11')](_0x6c9d('0xb'),auth[_0x6c9d('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc088=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','delete','exports'];(function(_0x5edc47,_0x1b94a5){var _0x514f6d=function(_0xebbf4c){while(--_0xebbf4c){_0x5edc47['push'](_0x5edc47['shift']());}};_0x514f6d(++_0x1b94a5);}(_0xc088,0x169));var _0x8c08=function(_0x5a2ca1,_0x47b0b2){_0x5a2ca1=_0x5a2ca1-0x0;var _0x3a15b=_0xc088[_0x5a2ca1];return _0x3a15b;};'use strict';var multer=require(_0x8c08('0x0'));var util=require('util');var path=require(_0x8c08('0x1'));var timeout=require(_0x8c08('0x2'));var express=require(_0x8c08('0x3'));var router=express[_0x8c08('0x4')]();var fs_extra=require(_0x8c08('0x5'));var auth=require(_0x8c08('0x6'));var interaction=require(_0x8c08('0x7'));var config=require(_0x8c08('0x8'));var controller=require(_0x8c08('0x9'));router[_0x8c08('0xa')]('/',auth[_0x8c08('0xb')](),controller[_0x8c08('0xc')]);router['get'](_0x8c08('0xd'),auth[_0x8c08('0xb')](),controller[_0x8c08('0xe')]);router[_0x8c08('0xa')](_0x8c08('0xf'),auth['isAuthenticated'](),controller[_0x8c08('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x8c08('0xf'),auth[_0x8c08('0xb')](),controller['update']);router[_0x8c08('0x11')](_0x8c08('0xf'),auth[_0x8c08('0xb')](),controller['destroy']);module[_0x8c08('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 446f39e..66dff56 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 _0xf195=['ENUM','attended','STRING','Yes','sequelize','moment','exports'];(function(_0x4cd2c3,_0x37dd0f){var _0x1f618c=function(_0xe98cf5){while(--_0xe98cf5){_0x4cd2c3['push'](_0x4cd2c3['shift']());}};_0x1f618c(++_0x37dd0f);}(_0xf195,0xc8));var _0x5f19=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xf195[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0x5f19('0x0'));var moment=require(_0x5f19('0x1'));module[_0x5f19('0x2')]={'type':{'type':Sequelize[_0x5f19('0x3')]('blind',_0x5f19('0x4'))},'result':{'type':Sequelize[_0x5f19('0x5')]},'transfererchannel':{'type':Sequelize[_0x5f19('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x5f19('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x5f19('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x5f19('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x5f19('0x5')]},'transfererexten':{'type':Sequelize[_0x5f19('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x5f19('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x5f19('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x5f19('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x5f19('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x5f19('0x5')]},'transfereecontext':{'type':Sequelize[_0x5f19('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x5f19('0x5')]},'isexternal':{'type':Sequelize[_0x5f19('0x3')](_0x5f19('0x6'),'No')},'context':{'type':Sequelize[_0x5f19('0x5')]},'extension':{'type':Sequelize[_0x5f19('0x5')]}}; \ No newline at end of file +var _0x2b7d=['blind','STRING','moment','exports','ENUM'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2b7d,0xb6));var _0xd2b7=function(_0x1ec69a,_0x1bde87){_0x1ec69a=_0x1ec69a-0x0;var _0x1ecfff=_0x2b7d[_0x1ec69a];return _0x1ecfff;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd2b7('0x0'));module[_0xd2b7('0x1')]={'type':{'type':Sequelize[_0xd2b7('0x2')](_0xd2b7('0x3'),'attended')},'result':{'type':Sequelize[_0xd2b7('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xd2b7('0x4')]},'transferercalleridname':{'type':Sequelize[_0xd2b7('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xd2b7('0x4')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xd2b7('0x4')]},'transfererexten':{'type':Sequelize[_0xd2b7('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xd2b7('0x4')]},'transfereechannel':{'type':Sequelize[_0xd2b7('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xd2b7('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xd2b7('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xd2b7('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0xd2b7('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xd2b7('0x4')]},'transfereeexten':{'type':Sequelize[_0xd2b7('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xd2b7('0x4')]},'isexternal':{'type':Sequelize[_0xd2b7('0x2')]('Yes','No')},'context':{'type':Sequelize[_0xd2b7('0x4')]},'extension':{'type':Sequelize[_0xd2b7('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index b1f732e..84e4f0c 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 _0xc6a1=['apply','reject','save','then','error','stack','name','send','index','VoiceTransferReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','find','create','update','body','destroy','describe','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xc6a1,0x101));var _0x1c6a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc6a1[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1c6a('0x0'));var jsonpatch=require(_0x1c6a('0x1'));var rp=require('request-promise');var moment=require(_0x1c6a('0x2'));var BPromise=require(_0x1c6a('0x3'));var Mustache=require('mustache');var util=require(_0x1c6a('0x4'));var path=require('path');var sox=require(_0x1c6a('0x5'));var csv=require(_0x1c6a('0x6'));var ejs=require(_0x1c6a('0x7'));var fs=require('fs');var fs_extra=require(_0x1c6a('0x8'));var _=require(_0x1c6a('0x9'));var squel=require('squel');var crypto=require(_0x1c6a('0xa'));var jsforce=require(_0x1c6a('0xb'));var deskjs=require(_0x1c6a('0xc'));var toCsv=require(_0x1c6a('0x6'));var querystring=require(_0x1c6a('0xd'));var Papa=require(_0x1c6a('0xe'));var Redis=require(_0x1c6a('0xf'));var authService=require(_0x1c6a('0x10'));var qs=require(_0x1c6a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c6a('0x12'));var logger=require(_0x1c6a('0x13'))(_0x1c6a('0x14'));var utils=require(_0x1c6a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1c6a('0x16'));var db=require(_0x1c6a('0x17'))['db'];function respondWithStatusCode(_0x46fdf9,_0x48284d){_0x48284d=_0x48284d||0xcc;return function(_0x13983a){if(_0x13983a){return _0x46fdf9[_0x1c6a('0x18')](_0x48284d);}return _0x46fdf9['status'](_0x48284d)['end']();};}function respondWithResult(_0x5492e9,_0x2675f1){_0x2675f1=_0x2675f1||0xc8;return function(_0xfd36e2){if(_0xfd36e2){return _0x5492e9[_0x1c6a('0x19')](_0x2675f1)[_0x1c6a('0x1a')](_0xfd36e2);}};}function respondWithFilteredResult(_0x82b76b,_0x5323ec){return function(_0x45cc09){if(_0x45cc09){var _0x48752a=typeof _0x5323ec['offset']===_0x1c6a('0x1b')&&typeof _0x5323ec[_0x1c6a('0x1c')]===_0x1c6a('0x1b');var _0x4b5942=_0x45cc09[_0x1c6a('0x1d')];var _0x22ffdd=_0x48752a?0x0:_0x5323ec[_0x1c6a('0x1e')];var _0x30fb0e=_0x48752a?_0x45cc09[_0x1c6a('0x1d')]:_0x5323ec[_0x1c6a('0x1e')]+_0x5323ec[_0x1c6a('0x1c')];var _0x4ff361;if(_0x30fb0e>=_0x4b5942){_0x30fb0e=_0x4b5942;_0x4ff361=0xc8;}else{_0x4ff361=0xce;}_0x82b76b[_0x1c6a('0x19')](_0x4ff361);return _0x82b76b['set']('Content-Range',_0x22ffdd+'-'+_0x30fb0e+'/'+_0x4b5942)[_0x1c6a('0x1a')](_0x45cc09);}return null;};}function patchUpdates(_0x32968d){return function(_0x364013){try{jsonpatch[_0x1c6a('0x1f')](_0x364013,_0x32968d,!![]);}catch(_0x5c8fb2){return BPromise[_0x1c6a('0x20')](_0x5c8fb2);}return _0x364013[_0x1c6a('0x21')]();};}function saveUpdates(_0x1ba482,_0x2533f9){return function(_0x5da2aa){if(_0x5da2aa){return _0x5da2aa['update'](_0x1ba482)[_0x1c6a('0x22')](function(_0x583cf7){return _0x583cf7;});}return null;};}function removeEntity(_0x5ad5fc,_0x19c739){return function(_0x295043){if(_0x295043){return _0x295043['destroy']()[_0x1c6a('0x22')](function(){_0x5ad5fc[_0x1c6a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55b151,_0x31bc84){return function(_0xebdc66){if(!_0xebdc66){_0x55b151[_0x1c6a('0x18')](0x194);}return _0xebdc66;};}function handleError(_0x1b703a,_0x3ee570){_0x3ee570=_0x3ee570||0x1f4;return function(_0x44a650){logger[_0x1c6a('0x23')](_0x44a650[_0x1c6a('0x24')]);if(_0x44a650[_0x1c6a('0x25')]){delete _0x44a650[_0x1c6a('0x25')];}_0x1b703a['status'](_0x3ee570)[_0x1c6a('0x26')](_0x44a650);};}exports[_0x1c6a('0x27')]=function(_0x396491,_0x30bc78){var _0x4d3ae3={},_0xe4cd63={},_0x52ecc0={'count':0x0,'rows':[]};var _0x4a5adb=_['map'](db[_0x1c6a('0x28')][_0x1c6a('0x29')],function(_0x167c71){return{'name':_0x167c71[_0x1c6a('0x2a')],'type':_0x167c71[_0x1c6a('0x2b')]['key']};});_0xe4cd63['model']=_[_0x1c6a('0x2c')](_0x4a5adb,_0x1c6a('0x25'));_0xe4cd63[_0x1c6a('0x2d')]=_['keys'](_0x396491[_0x1c6a('0x2d')]);_0xe4cd63[_0x1c6a('0x2e')]=_[_0x1c6a('0x2f')](_0xe4cd63[_0x1c6a('0x30')],_0xe4cd63[_0x1c6a('0x2d')]);_0x4d3ae3[_0x1c6a('0x31')]=_[_0x1c6a('0x2f')](_0xe4cd63[_0x1c6a('0x30')],qs[_0x1c6a('0x32')](_0x396491[_0x1c6a('0x2d')]['fields']));_0x4d3ae3['attributes']=_0x4d3ae3[_0x1c6a('0x31')][_0x1c6a('0x33')]?_0x4d3ae3['attributes']:_0xe4cd63[_0x1c6a('0x30')];if(!_0x396491[_0x1c6a('0x2d')][_0x1c6a('0x34')](_0x1c6a('0x35'))){_0x4d3ae3[_0x1c6a('0x1c')]=qs['limit'](_0x396491['query']['limit']);_0x4d3ae3[_0x1c6a('0x1e')]=qs[_0x1c6a('0x1e')](_0x396491[_0x1c6a('0x2d')][_0x1c6a('0x1e')]);}_0x4d3ae3[_0x1c6a('0x36')]=qs[_0x1c6a('0x37')](_0x396491[_0x1c6a('0x2d')][_0x1c6a('0x37')]);_0x4d3ae3[_0x1c6a('0x38')]=qs[_0x1c6a('0x2e')](_['pick'](_0x396491[_0x1c6a('0x2d')],_0xe4cd63[_0x1c6a('0x2e')]),_0x4a5adb);if(_0x396491[_0x1c6a('0x2d')][_0x1c6a('0x39')]){_0x4d3ae3[_0x1c6a('0x38')]=_['merge'](_0x4d3ae3[_0x1c6a('0x38')],{'$or':_['map'](_0x4a5adb,function(_0x101868){if(_0x101868[_0x1c6a('0x2b')]!==_0x1c6a('0x3a')){var _0x9749={};_0x9749[_0x101868[_0x1c6a('0x25')]]={'$like':'%'+_0x396491[_0x1c6a('0x2d')][_0x1c6a('0x39')]+'%'};return _0x9749;}})});}_0x4d3ae3=_['merge']({},_0x4d3ae3,_0x396491['options']);var _0x184c9c={'where':_0x4d3ae3['where']};return db['VoiceTransferReport'][_0x1c6a('0x1d')](_0x184c9c)[_0x1c6a('0x22')](function(_0x180d20){_0x52ecc0['count']=_0x180d20;if(_0x396491[_0x1c6a('0x2d')][_0x1c6a('0x3b')]){_0x4d3ae3[_0x1c6a('0x3c')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x1c6a('0x3d')](_0x4d3ae3);})['then'](function(_0x120542){_0x52ecc0[_0x1c6a('0x3e')]=_0x120542;return _0x52ecc0;})['then'](respondWithFilteredResult(_0x30bc78,_0x4d3ae3))[_0x1c6a('0x3f')](handleError(_0x30bc78,null));};exports['show']=function(_0x61974d,_0x5790e7){var _0x5d7309={'raw':!![],'where':{'id':_0x61974d[_0x1c6a('0x40')]['id']}},_0x3f149e={};_0x3f149e[_0x1c6a('0x30')]=_[_0x1c6a('0x41')](db[_0x1c6a('0x28')][_0x1c6a('0x29')]);_0x3f149e['query']=_[_0x1c6a('0x41')](_0x61974d[_0x1c6a('0x2d')]);_0x3f149e[_0x1c6a('0x2e')]=_[_0x1c6a('0x2f')](_0x3f149e['model'],_0x3f149e[_0x1c6a('0x2d')]);_0x5d7309[_0x1c6a('0x31')]=_['intersection'](_0x3f149e['model'],qs[_0x1c6a('0x32')](_0x61974d[_0x1c6a('0x2d')][_0x1c6a('0x32')]));_0x5d7309[_0x1c6a('0x31')]=_0x5d7309[_0x1c6a('0x31')][_0x1c6a('0x33')]?_0x5d7309[_0x1c6a('0x31')]:_0x3f149e['model'];if(_0x61974d[_0x1c6a('0x2d')]['includeAll']){_0x5d7309['include']=[{'all':!![]}];}_0x5d7309=_['merge']({},_0x5d7309,_0x61974d['options']);return db[_0x1c6a('0x28')][_0x1c6a('0x42')](_0x5d7309)[_0x1c6a('0x22')](handleEntityNotFound(_0x5790e7,null))['then'](respondWithResult(_0x5790e7,null))[_0x1c6a('0x3f')](handleError(_0x5790e7,null));};exports[_0x1c6a('0x43')]=function(_0x2713f8,_0x3ba6e7){return db[_0x1c6a('0x28')][_0x1c6a('0x43')](_0x2713f8['body'],{})[_0x1c6a('0x22')](respondWithResult(_0x3ba6e7,0xc9))[_0x1c6a('0x3f')](handleError(_0x3ba6e7,null));};exports[_0x1c6a('0x44')]=function(_0x50b3fc,_0x5b43d0){if(_0x50b3fc[_0x1c6a('0x45')]['id']){delete _0x50b3fc[_0x1c6a('0x45')]['id'];}return db[_0x1c6a('0x28')][_0x1c6a('0x42')]({'where':{'id':_0x50b3fc[_0x1c6a('0x40')]['id']}})[_0x1c6a('0x22')](handleEntityNotFound(_0x5b43d0,null))['then'](saveUpdates(_0x50b3fc[_0x1c6a('0x45')],null))['then'](respondWithResult(_0x5b43d0,null))[_0x1c6a('0x3f')](handleError(_0x5b43d0,null));};exports[_0x1c6a('0x46')]=function(_0x4b77fe,_0x2701f1){return db[_0x1c6a('0x28')][_0x1c6a('0x42')]({'where':{'id':_0x4b77fe['params']['id']}})['then'](handleEntityNotFound(_0x2701f1,null))[_0x1c6a('0x22')](removeEntity(_0x2701f1,null))[_0x1c6a('0x3f')](handleError(_0x2701f1,null));};exports['describe']=function(_0x4dcd6e,_0xc72800){return db[_0x1c6a('0x28')][_0x1c6a('0x47')]()['then'](respondWithResult(_0xc72800,null))[_0x1c6a('0x3f')](handleError(_0xc72800,null));}; \ No newline at end of file +var _0xa756=['undefined','limit','count','status','Content-Range','apply','save','then','error','stack','name','send','index','map','VoiceTransferReport','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','catch','show','params','keys','length','includeAll','find','create','body','update','describe','rimraf','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','offset'];(function(_0x426456,_0x4a76d7){var _0x170a8a=function(_0x196fcb){while(--_0x196fcb){_0x426456['push'](_0x426456['shift']());}};_0x170a8a(++_0x4a76d7);}(_0xa756,0x175));var _0x6a75=function(_0x544391,_0x1e996c){_0x544391=_0x544391-0x0;var _0x506b00=_0xa756[_0x544391];return _0x506b00;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6a75('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6a75('0x1'));var moment=require(_0x6a75('0x2'));var BPromise=require(_0x6a75('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6a75('0x4'));var sox=require(_0x6a75('0x5'));var csv=require(_0x6a75('0x6'));var ejs=require(_0x6a75('0x7'));var fs=require('fs');var fs_extra=require(_0x6a75('0x8'));var _=require(_0x6a75('0x9'));var squel=require('squel');var crypto=require(_0x6a75('0xa'));var jsforce=require(_0x6a75('0xb'));var deskjs=require(_0x6a75('0xc'));var toCsv=require(_0x6a75('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6a75('0xd'));var qs=require(_0x6a75('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6a75('0xf'));var logger=require(_0x6a75('0x10'))(_0x6a75('0x11'));var utils=require(_0x6a75('0x12'));var config=require(_0x6a75('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x249599,_0x3ae9de){_0x3ae9de=_0x3ae9de||0xcc;return function(_0x8b2d62){if(_0x8b2d62){return _0x249599[_0x6a75('0x14')](_0x3ae9de);}return _0x249599['status'](_0x3ae9de)[_0x6a75('0x15')]();};}function respondWithResult(_0x57f87e,_0x5156d2){_0x5156d2=_0x5156d2||0xc8;return function(_0xdb1328){if(_0xdb1328){return _0x57f87e['status'](_0x5156d2)['json'](_0xdb1328);}};}function respondWithFilteredResult(_0x3f3004,_0x39e85d){return function(_0x10ecbf){if(_0x10ecbf){var _0x3bfe92=typeof _0x39e85d[_0x6a75('0x16')]===_0x6a75('0x17')&&typeof _0x39e85d[_0x6a75('0x18')]===_0x6a75('0x17');var _0xaf77f1=_0x10ecbf[_0x6a75('0x19')];var _0x29e761=_0x3bfe92?0x0:_0x39e85d[_0x6a75('0x16')];var _0x3d8a55=_0x3bfe92?_0x10ecbf[_0x6a75('0x19')]:_0x39e85d[_0x6a75('0x16')]+_0x39e85d[_0x6a75('0x18')];var _0x1fc5dc;if(_0x3d8a55>=_0xaf77f1){_0x3d8a55=_0xaf77f1;_0x1fc5dc=0xc8;}else{_0x1fc5dc=0xce;}_0x3f3004[_0x6a75('0x1a')](_0x1fc5dc);return _0x3f3004['set'](_0x6a75('0x1b'),_0x29e761+'-'+_0x3d8a55+'/'+_0xaf77f1)['json'](_0x10ecbf);}return null;};}function patchUpdates(_0x21ed4f){return function(_0x201522){try{jsonpatch[_0x6a75('0x1c')](_0x201522,_0x21ed4f,!![]);}catch(_0x5b978d){return BPromise['reject'](_0x5b978d);}return _0x201522[_0x6a75('0x1d')]();};}function saveUpdates(_0x3368cf,_0x2edd67){return function(_0x5db7f8){if(_0x5db7f8){return _0x5db7f8['update'](_0x3368cf)[_0x6a75('0x1e')](function(_0x45b796){return _0x45b796;});}return null;};}function removeEntity(_0x44ec73,_0x3077c3){return function(_0x337542){if(_0x337542){return _0x337542['destroy']()['then'](function(){_0x44ec73[_0x6a75('0x1a')](0xcc)[_0x6a75('0x15')]();});}};}function handleEntityNotFound(_0x2f749a,_0x2ee489){return function(_0x170c1d){if(!_0x170c1d){_0x2f749a[_0x6a75('0x14')](0x194);}return _0x170c1d;};}function handleError(_0x5a23e2,_0x58053c){_0x58053c=_0x58053c||0x1f4;return function(_0x1d4f91){logger[_0x6a75('0x1f')](_0x1d4f91[_0x6a75('0x20')]);if(_0x1d4f91['name']){delete _0x1d4f91[_0x6a75('0x21')];}_0x5a23e2['status'](_0x58053c)[_0x6a75('0x22')](_0x1d4f91);};}exports[_0x6a75('0x23')]=function(_0x4d6018,_0x548d89){var _0x2096a7={},_0x5db63c={},_0x258520={'count':0x0,'rows':[]};var _0x198949=_[_0x6a75('0x24')](db[_0x6a75('0x25')]['rawAttributes'],function(_0x186af8){return{'name':_0x186af8['fieldName'],'type':_0x186af8['type']['key']};});_0x5db63c['model']=_['map'](_0x198949,_0x6a75('0x21'));_0x5db63c['query']=_['keys'](_0x4d6018[_0x6a75('0x26')]);_0x5db63c[_0x6a75('0x27')]=_[_0x6a75('0x28')](_0x5db63c[_0x6a75('0x29')],_0x5db63c[_0x6a75('0x26')]);_0x2096a7[_0x6a75('0x2a')]=_[_0x6a75('0x28')](_0x5db63c['model'],qs[_0x6a75('0x2b')](_0x4d6018['query'][_0x6a75('0x2b')]));_0x2096a7[_0x6a75('0x2a')]=_0x2096a7[_0x6a75('0x2a')]['length']?_0x2096a7[_0x6a75('0x2a')]:_0x5db63c[_0x6a75('0x29')];if(!_0x4d6018[_0x6a75('0x26')][_0x6a75('0x2c')](_0x6a75('0x2d'))){_0x2096a7[_0x6a75('0x18')]=qs[_0x6a75('0x18')](_0x4d6018[_0x6a75('0x26')][_0x6a75('0x18')]);_0x2096a7[_0x6a75('0x16')]=qs['offset'](_0x4d6018[_0x6a75('0x26')][_0x6a75('0x16')]);}_0x2096a7[_0x6a75('0x2e')]=qs['sort'](_0x4d6018[_0x6a75('0x26')][_0x6a75('0x2f')]);_0x2096a7[_0x6a75('0x30')]=qs[_0x6a75('0x27')](_[_0x6a75('0x31')](_0x4d6018['query'],_0x5db63c[_0x6a75('0x27')]),_0x198949);if(_0x4d6018[_0x6a75('0x26')][_0x6a75('0x32')]){_0x2096a7[_0x6a75('0x30')]=_['merge'](_0x2096a7[_0x6a75('0x30')],{'$or':_['map'](_0x198949,function(_0x590798){if(_0x590798['type']!==_0x6a75('0x33')){var _0x139f1a={};_0x139f1a[_0x590798[_0x6a75('0x21')]]={'$like':'%'+_0x4d6018[_0x6a75('0x26')]['filter']+'%'};return _0x139f1a;}})});}_0x2096a7=_[_0x6a75('0x34')]({},_0x2096a7,_0x4d6018[_0x6a75('0x35')]);var _0x2d5291={'where':_0x2096a7['where']};return db[_0x6a75('0x25')][_0x6a75('0x19')](_0x2d5291)[_0x6a75('0x1e')](function(_0x4af830){_0x258520[_0x6a75('0x19')]=_0x4af830;if(_0x4d6018['query']['includeAll']){_0x2096a7[_0x6a75('0x36')]=[{'all':!![]}];}return db[_0x6a75('0x25')]['findAll'](_0x2096a7);})[_0x6a75('0x1e')](function(_0x50e0af){_0x258520['rows']=_0x50e0af;return _0x258520;})[_0x6a75('0x1e')](respondWithFilteredResult(_0x548d89,_0x2096a7))[_0x6a75('0x37')](handleError(_0x548d89,null));};exports[_0x6a75('0x38')]=function(_0x8a6596,_0x2c47c8){var _0x26ccbb={'raw':!![],'where':{'id':_0x8a6596[_0x6a75('0x39')]['id']}},_0x5d5207={};_0x5d5207[_0x6a75('0x29')]=_[_0x6a75('0x3a')](db[_0x6a75('0x25')]['rawAttributes']);_0x5d5207[_0x6a75('0x26')]=_[_0x6a75('0x3a')](_0x8a6596[_0x6a75('0x26')]);_0x5d5207[_0x6a75('0x27')]=_[_0x6a75('0x28')](_0x5d5207[_0x6a75('0x29')],_0x5d5207[_0x6a75('0x26')]);_0x26ccbb[_0x6a75('0x2a')]=_[_0x6a75('0x28')](_0x5d5207[_0x6a75('0x29')],qs[_0x6a75('0x2b')](_0x8a6596[_0x6a75('0x26')][_0x6a75('0x2b')]));_0x26ccbb[_0x6a75('0x2a')]=_0x26ccbb[_0x6a75('0x2a')][_0x6a75('0x3b')]?_0x26ccbb[_0x6a75('0x2a')]:_0x5d5207['model'];if(_0x8a6596[_0x6a75('0x26')][_0x6a75('0x3c')]){_0x26ccbb['include']=[{'all':!![]}];}_0x26ccbb=_[_0x6a75('0x34')]({},_0x26ccbb,_0x8a6596[_0x6a75('0x35')]);return db[_0x6a75('0x25')][_0x6a75('0x3d')](_0x26ccbb)[_0x6a75('0x1e')](handleEntityNotFound(_0x2c47c8,null))[_0x6a75('0x1e')](respondWithResult(_0x2c47c8,null))[_0x6a75('0x37')](handleError(_0x2c47c8,null));};exports['create']=function(_0x37ef6e,_0x2d238e){return db['VoiceTransferReport'][_0x6a75('0x3e')](_0x37ef6e[_0x6a75('0x3f')],{})[_0x6a75('0x1e')](respondWithResult(_0x2d238e,0xc9))[_0x6a75('0x37')](handleError(_0x2d238e,null));};exports[_0x6a75('0x40')]=function(_0xf92dd7,_0x55ca2c){if(_0xf92dd7[_0x6a75('0x3f')]['id']){delete _0xf92dd7['body']['id'];}return db[_0x6a75('0x25')][_0x6a75('0x3d')]({'where':{'id':_0xf92dd7[_0x6a75('0x39')]['id']}})['then'](handleEntityNotFound(_0x55ca2c,null))[_0x6a75('0x1e')](saveUpdates(_0xf92dd7[_0x6a75('0x3f')],null))[_0x6a75('0x1e')](respondWithResult(_0x55ca2c,null))['catch'](handleError(_0x55ca2c,null));};exports['destroy']=function(_0x999e44,_0x510b70){return db[_0x6a75('0x25')]['find']({'where':{'id':_0x999e44[_0x6a75('0x39')]['id']}})['then'](handleEntityNotFound(_0x510b70,null))[_0x6a75('0x1e')](removeEntity(_0x510b70,null))[_0x6a75('0x37')](handleError(_0x510b70,null));};exports[_0x6a75('0x41')]=function(_0x4dd1fc,_0x169070){return db[_0x6a75('0x25')]['describe']()[_0x6a75('0x1e')](respondWithResult(_0x169070,null))[_0x6a75('0x37')](handleError(_0x169070,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 6e294b4..b956a88 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 _0xef32=['request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','define','lodash','util','moment','bluebird'];(function(_0x30fe2b,_0x1ae357){var _0x149386=function(_0x2aa50f){while(--_0x2aa50f){_0x30fe2b['push'](_0x30fe2b['shift']());}};_0x149386(++_0x1ae357);}(_0xef32,0x6a));var _0x2ef3=function(_0x55ff3e,_0x41077f){_0x55ff3e=_0x55ff3e-0x0;var _0x2709eb=_0xef32[_0x55ff3e];return _0x2709eb;};'use strict';var _=require(_0x2ef3('0x0'));var util=require(_0x2ef3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2ef3('0x2'));var BPromise=require(_0x2ef3('0x3'));var rp=require(_0x2ef3('0x4'));var fs=require('fs');var path=require(_0x2ef3('0x5'));var rimraf=require(_0x2ef3('0x6'));var config=require(_0x2ef3('0x7'));var attributes=require(_0x2ef3('0x8'));module['exports']=function(_0x280b9b,_0x149ef2){return _0x280b9b[_0x2ef3('0x9')]('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63b5=['request-promise','rimraf','../../config/environment','exports','define','VoiceTransferReport','../../config/logger'];(function(_0x28a5ad,_0x520afa){var _0x176b8a=function(_0x3d71b){while(--_0x3d71b){_0x28a5ad['push'](_0x28a5ad['shift']());}};_0x176b8a(++_0x520afa);}(_0x63b5,0x14f));var _0x563b=function(_0x5331ca,_0x530c59){_0x5331ca=_0x5331ca-0x0;var _0x2a7e80=_0x63b5[_0x5331ca];return _0x2a7e80;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x563b('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x563b('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x563b('0x2'));var config=require(_0x563b('0x3'));var attributes=require('./voiceTransferReport.attributes');module[_0x563b('0x4')]=function(_0x5dd432,_0x4ac29e){return _0x5dd432[_0x563b('0x5')](_0x563b('0x6'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 730d0ef..5e05a11 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 _0xca60=['jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateVoiceTransferReport','create','options','raw','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x46bb87,_0x5a88fa){var _0x304cdc=function(_0x277021){while(--_0x277021){_0x46bb87['push'](_0x46bb87['shift']());}};_0x304cdc(++_0x5a88fa);}(_0xca60,0x170));var _0x0ca6=function(_0xc40b9f,_0x17ec1f){_0xc40b9f=_0xc40b9f-0x0;var _0x535b9c=_0xca60[_0xc40b9f];return _0x535b9c;};'use strict';var _=require(_0x0ca6('0x0'));var util=require('util');var moment=require(_0x0ca6('0x1'));var BPromise=require(_0x0ca6('0x2'));var rs=require(_0x0ca6('0x3'));var fs=require('fs');var Redis=require(_0x0ca6('0x4'));var db=require(_0x0ca6('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0ca6('0x6'));var config=require('../../config/environment');var jayson=require(_0x0ca6('0x7'));var client=jayson[_0x0ca6('0x8')][_0x0ca6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35cba1,_0x4583a8,_0x5d46d8){return new BPromise(function(_0x57be63,_0x42142e){return client[_0x0ca6('0xa')](_0x35cba1,_0x5d46d8)[_0x0ca6('0xb')](function(_0x3f075f){logger[_0x0ca6('0xc')](_0x0ca6('0xd'),_0x4583a8,_0x0ca6('0xe'));logger['debug'](_0x0ca6('0xf'),_0x4583a8,_0x0ca6('0xe'),JSON[_0x0ca6('0x10')](_0x3f075f));if(_0x3f075f[_0x0ca6('0x11')]){if(_0x3f075f[_0x0ca6('0x11')]['code']===0x1f4){logger[_0x0ca6('0x11')](_0x0ca6('0xd'),_0x4583a8,_0x3f075f[_0x0ca6('0x11')]['message']);return _0x42142e(_0x3f075f['error']['message']);}logger[_0x0ca6('0x11')](_0x0ca6('0xd'),_0x4583a8,_0x3f075f[_0x0ca6('0x11')][_0x0ca6('0x12')]);return _0x57be63(_0x3f075f[_0x0ca6('0x11')][_0x0ca6('0x12')]);}else{logger[_0x0ca6('0xc')](_0x0ca6('0xd'),_0x4583a8,_0x0ca6('0xe'));_0x57be63(_0x3f075f['result']['message']);}})[_0x0ca6('0x13')](function(_0x2173e7){logger['error'](_0x0ca6('0xd'),_0x4583a8,_0x2173e7);_0x42142e(_0x2173e7);});});}exports[_0x0ca6('0x14')]=function(_0x2dadf3){var _0x1e5452=this;return new Promise(function(_0x256aa9,_0x288561){return db['VoiceTransferReport'][_0x0ca6('0x15')](_0x2dadf3['body'],{'raw':_0x2dadf3['options']?_0x2dadf3[_0x0ca6('0x16')][_0x0ca6('0x17')]===undefined?!![]:![]:!![]})[_0x0ca6('0xb')](function(_0xb81837){logger[_0x0ca6('0xc')]('CreateVoiceTransferReport',_0x2dadf3);logger[_0x0ca6('0x18')](_0x0ca6('0x14'),_0x2dadf3,JSON[_0x0ca6('0x10')](_0xb81837));_0x256aa9(_0xb81837);})[_0x0ca6('0x13')](function(_0xd25517){logger[_0x0ca6('0x11')](_0x0ca6('0x14'),_0xd25517[_0x0ca6('0x12')],_0x2dadf3);_0x288561(_0x1e5452[_0x0ca6('0x11')](0x1f4,_0xd25517[_0x0ca6('0x12')]));});});}; \ No newline at end of file +var _0x9515=['code','error','message','result','create','body','options','then','CreateVoiceTransferReport','catch','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0x9515,0x14f));var _0x5951=function(_0x5e3230,_0x4a7427){_0x5e3230=_0x5e3230-0x0;var _0x1b78ef=_0x9515[_0x5e3230];return _0x1b78ef;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5951('0x0'));var BPromise=require('bluebird');var rs=require(_0x5951('0x1'));var fs=require('fs');var Redis=require(_0x5951('0x2'));var db=require(_0x5951('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5951('0x4'));var config=require(_0x5951('0x5'));var jayson=require(_0x5951('0x6'));var client=jayson[_0x5951('0x7')][_0x5951('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2756ec,_0x584cdb,_0x486a2a){return new BPromise(function(_0x1b0849,_0x46579c){return client['request'](_0x2756ec,_0x486a2a)['then'](function(_0x445a3f){logger[_0x5951('0x9')](_0x5951('0xa'),_0x584cdb,_0x5951('0xb'));logger[_0x5951('0xc')](_0x5951('0xd'),_0x584cdb,_0x5951('0xb'),JSON[_0x5951('0xe')](_0x445a3f));if(_0x445a3f['error']){if(_0x445a3f['error'][_0x5951('0xf')]===0x1f4){logger['error'](_0x5951('0xa'),_0x584cdb,_0x445a3f[_0x5951('0x10')][_0x5951('0x11')]);return _0x46579c(_0x445a3f['error'][_0x5951('0x11')]);}logger[_0x5951('0x10')](_0x5951('0xa'),_0x584cdb,_0x445a3f[_0x5951('0x10')][_0x5951('0x11')]);return _0x1b0849(_0x445a3f['error'][_0x5951('0x11')]);}else{logger[_0x5951('0x9')](_0x5951('0xa'),_0x584cdb,_0x5951('0xb'));_0x1b0849(_0x445a3f[_0x5951('0x12')][_0x5951('0x11')]);}})['catch'](function(_0x167d0b){logger[_0x5951('0x10')](_0x5951('0xa'),_0x584cdb,_0x167d0b);_0x46579c(_0x167d0b);});});}exports['CreateVoiceTransferReport']=function(_0x189bd2){var _0x482b8c=this;return new Promise(function(_0x47c6fa,_0x53e9c7){return db['VoiceTransferReport'][_0x5951('0x13')](_0x189bd2[_0x5951('0x14')],{'raw':_0x189bd2['options']?_0x189bd2[_0x5951('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x5951('0x16')](function(_0x4c0917){logger[_0x5951('0x9')]('CreateVoiceTransferReport',_0x189bd2);logger['debug'](_0x5951('0x17'),_0x189bd2,JSON[_0x5951('0xe')](_0x4c0917));_0x47c6fa(_0x4c0917);})[_0x5951('0x18')](function(_0x7643df){logger[_0x5951('0x10')](_0x5951('0x17'),_0x7643df[_0x5951('0x11')],_0x189bd2);_0x53e9c7(_0x482b8c['error'](0x1f4,_0x7643df['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index f77a85e..6c7c99b 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 _0xdace=['unhold','calls','/transfer','transfer','exports','express','../../components/auth/service','./webbar.controller','post','isAuthenticated','isWebrtcLicence','originate','hangup','/answer','/hold','/unhold'];(function(_0x5d4090,_0x1cbbe6){var _0x33b462=function(_0x2f85e4){while(--_0x2f85e4){_0x5d4090['push'](_0x5d4090['shift']());}};_0x33b462(++_0x1cbbe6);}(_0xdace,0xc5));var _0xedac=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xdace[_0x9aada2];return _0x196dff;};'use strict';var express=require(_0xedac('0x0'));var router=express['Router']();var auth=require(_0xedac('0x1'));var controller=require(_0xedac('0x2'));router[_0xedac('0x3')]('/originate',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x6')]);router[_0xedac('0x3')]('/hangup',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x7')]);router['post'](_0xedac('0x8'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller['answer']);router[_0xedac('0x3')](_0xedac('0x9'),auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0xedac('0x3')](_0xedac('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xedac('0xb')]);router[_0xedac('0x3')]('/calls',auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller[_0xedac('0xc')]);router[_0xedac('0x3')](_0xedac('0xd'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0xe')]);module[_0xedac('0xf')]=router; \ No newline at end of file +var _0x9bde=['Router','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','/calls','transfer'];(function(_0xa8369a,_0x3d2319){var _0x4b74b7=function(_0x11d138){while(--_0x11d138){_0xa8369a['push'](_0xa8369a['shift']());}};_0x4b74b7(++_0x3d2319);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3d5090,_0x17138d){_0x3d5090=_0x3d5090-0x0;var _0x476535=_0x9bde[_0x3d5090];return _0x476535;};'use strict';var express=require('express');var router=express[_0xe9bd('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xe9bd('0x1'));router['post'](_0xe9bd('0x2'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0x5')]);router[_0xe9bd('0x6')](_0xe9bd('0x7'),auth[_0xe9bd('0x3')](),auth['isWebrtcLicence'](),controller[_0xe9bd('0x8')]);router[_0xe9bd('0x6')](_0xe9bd('0x9'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0xa')]);router[_0xe9bd('0x6')](_0xe9bd('0xb'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['hold']);router['post'](_0xe9bd('0xc'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['unhold']);router[_0xe9bd('0x6')](_0xe9bd('0xd'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['calls']);router[_0xe9bd('0x6')]('/transfer',auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 32fc30e..403e5d9 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 _0x55ea=['NotFound','request','code','message','result','catch','User','findOne','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','originate','info','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','entityFound:','webbar:originate','json','originate\x20executed!','hangup','hangup\x20fired:','format','user:%s','webbar:hangup','answer','answer\x20fired:','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference\x20fired:','transfer\x20fired:','path','lodash','../../mysqldb','util','bluebird','jayson/promise','client','http','webbarapi','localhost','socket.io-emitter','redis','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','log','handleError:','error','stack','name','status','send'];(function(_0x5aef17,_0x592cd4){var _0x43f9d0=function(_0x49ea9c){while(--_0x49ea9c){_0x5aef17['push'](_0x5aef17['shift']());}};_0x43f9d0(++_0x592cd4);}(_0x55ea,0xc9));var _0xa55e=function(_0x38a61e,_0xf150e3){_0x38a61e=_0x38a61e-0x0;var _0x14cd0f=_0x55ea[_0x38a61e];return _0x14cd0f;};'use strict';var path=require(_0xa55e('0x0'));var fs=require('fs');var _=require(_0xa55e('0x1'));var db=require(_0xa55e('0x2'))['db'];var config=require('../../config/environment');var util=require(_0xa55e('0x3'));var BPromise=require(_0xa55e('0x4'));var jayson=require(_0xa55e('0x5'));var amiClient=jayson[_0xa55e('0x6')][_0xa55e('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0xa55e('0x8'));var Redis=require('ioredis');config['redis']=_['defaults'](config['redis'],{'host':_0xa55e('0x9'),'port':0x18eb});var io=require(_0xa55e('0xa'))(new Redis(config[_0xa55e('0xb')]));var Schema=require(_0xa55e('0xc'));var originateValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]},'callNumber':{'type':_0xa55e('0xf'),'required':[!![],_0xa55e('0x10')]},'callerId':{'type':_0xa55e('0xf')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa55e('0xe')]},'sessionId':{'type':_0xa55e('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]},'sessionId':{'type':_0xa55e('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa55e('0xe')]},'sessionId':{'type':'string','required':[!![],_0xa55e('0x11')]},'transferNumber':{'type':_0xa55e('0xf'),'required':[!![],_0xa55e('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]},'sessionId':{'type':_0xa55e('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]},'sessionId':{'type':_0xa55e('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa55e('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]}});function emit(_0x12895e,_0x303698,_0x339f1e){logger['info'](_0x12895e,_0x303698,JSON[_0xa55e('0x13')](_0x339f1e));io['to'](_0x12895e)['emit'](_0x303698,_0x339f1e);}function handleError(_0x517142){return function(_0x4599b9){console[_0xa55e('0x14')](_0xa55e('0x15'),_0x4599b9,_0x4599b9 instanceof RangeError);logger[_0xa55e('0x16')](_0x4599b9[_0xa55e('0x17')]);if(_0x4599b9 instanceof RangeError){if(_0x4599b9['name']){delete _0x4599b9[_0xa55e('0x18')];}_0x517142['status'](0x194)['send'](_0x4599b9);}else{if(_0x4599b9[_0xa55e('0x18')]){delete _0x4599b9[_0xa55e('0x18')];}_0x517142[_0xa55e('0x19')](0x1f4)[_0xa55e('0x1a')](_0x4599b9);}};}function checkError(){return function(_0x51304d){if(!_0x51304d){throw new RangeError(_0xa55e('0x1b'));}return _0x51304d;};}function respondWithRpcPromise(_0x475dde,_0x267adb){return new BPromise(function(_0x9594a3,_0x5b0e74){var _0x53a2f9=amiClient;return _0x53a2f9[_0xa55e('0x1c')](_0x475dde,_0x267adb)['then'](function(_0xaaf2f1){if(_0xaaf2f1[_0xa55e('0x16')]){if(_0xaaf2f1[_0xa55e('0x16')][_0xa55e('0x1d')]===0x1f4){return _0x5b0e74(_0xaaf2f1[_0xa55e('0x16')][_0xa55e('0x1e')]);}return _0x9594a3(_0xaaf2f1[_0xa55e('0x16')][_0xa55e('0x1e')]);}else{_0x9594a3(_0xaaf2f1[_0xa55e('0x1f')]);}})[_0xa55e('0x20')](function(_0x3c519d){_0x5b0e74(_0x3c519d);});});}function getAgent(_0x137aca){return db[_0xa55e('0x21')][_0xa55e('0x22')]({'where':{'id':_0x137aca,'role':_0xa55e('0x23')}})[_0xa55e('0x24')](checkError());}function getAgentCheckSession(_0x2f2579,_0xa1917c){return new BPromise(function(_0x875010,_0x4eebcc){var _0x5c218d=respondWithRpcPromise(_0xa55e('0x25'));var _0x4ebcbd=getAgent(_0x2f2579);Promise[_0xa55e('0x26')]([_0x5c218d,_0x4ebcbd])['then'](function(_0x2fe4e9){var _0x4d9634=_0x2fe4e9[0x0];var _0x2758ca=_0x2fe4e9[0x1];var _0x532b13=_[_0xa55e('0x27')](_0x4d9634[_0xa55e('0x28')],function(_0x4a03ef){return _0x4a03ef[_0xa55e('0x29')]==_0x2758ca['id']&&_0x4a03ef[_0xa55e('0x2a')]==_0xa1917c;});if(_0x532b13[_0xa55e('0x2b')]==0x1){_0x875010(_0x2758ca);}else{_0x4eebcc(new RangeError(_0xa55e('0x2c')+_0xa1917c+'\x20not\x20found!'));}});});}exports[_0xa55e('0x2d')]=function(_0x25ecb3,_0x5b79d6){logger[_0xa55e('0x2e')](_0xa55e('0x2f'),_0x25ecb3[_0xa55e('0x30')]);var _0xcaeba6=originateValidation['validate'](_0x25ecb3[_0xa55e('0x30')]);if(_0xcaeba6['length']>0x0){return _0x5b79d6[_0xa55e('0x19')](0x190)['json'](_0xcaeba6);}var _0x339406=_0x25ecb3[_0xa55e('0x30')][_0xa55e('0x31')];var _0x1e53f0=_0x25ecb3['body'][_0xa55e('0x32')];var _0x5aec2c=_0x25ecb3[_0xa55e('0x30')][_0xa55e('0x33')];var _0x7999ac=_0x25ecb3['body'][_0xa55e('0x34')];return getAgent(_0x339406)[_0xa55e('0x24')](function(_0x602aa0){logger[_0xa55e('0x2e')](_0xa55e('0x35'),_0x602aa0[_0xa55e('0x18')]);emit(util['format']('user:%s',_0x602aa0[_0xa55e('0x18')]),_0xa55e('0x36'),{'callNumber':_0x1e53f0,'callerId':_0x5aec2c,'callbackUrl':_0x7999ac});return _0x5b79d6[_0xa55e('0x19')](0xc8)[_0xa55e('0x37')]({'error':![],'message':_0xa55e('0x38')});})[_0xa55e('0x20')](handleError(_0x5b79d6));};exports[_0xa55e('0x39')]=function(_0x596a5d,_0x5cd5b3){logger[_0xa55e('0x2e')](_0xa55e('0x3a'),_0x596a5d[_0xa55e('0x30')]);var _0x351dbf=hangupValidation[_0xa55e('0xc')](_0x596a5d[_0xa55e('0x30')]);if(_0x351dbf[_0xa55e('0x2b')]>0x0){return _0x5cd5b3[_0xa55e('0x19')](0x190)[_0xa55e('0x37')](_0x351dbf);}var _0x113ab5=_0x596a5d[_0xa55e('0x30')]['userId'];var _0x1da8a9=_0x596a5d[_0xa55e('0x30')][_0xa55e('0x2a')];return getAgent(_0x113ab5)['then'](function(_0x1e806a){logger['info'](_0xa55e('0x35'),_0x1e806a[_0xa55e('0x18')]);emit(util[_0xa55e('0x3b')](_0xa55e('0x3c'),_0x1e806a[_0xa55e('0x18')]),_0xa55e('0x3d'),{'sessionId':_0x1da8a9});return _0x5cd5b3[_0xa55e('0x19')](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})[_0xa55e('0x20')](handleError(_0x5cd5b3));};exports[_0xa55e('0x3e')]=function(_0x27e756,_0x518e06){logger[_0xa55e('0x2e')](_0xa55e('0x3f'),_0x27e756[_0xa55e('0x30')]);var _0xb43d62=answerValidation[_0xa55e('0xc')](_0x27e756[_0xa55e('0x30')]);if(_0xb43d62[_0xa55e('0x2b')]>0x0){return _0x518e06[_0xa55e('0x19')](0x190)['json'](_0xb43d62);}var _0x4bd20d=_0x27e756[_0xa55e('0x30')][_0xa55e('0x31')];var _0x186dc2=_0x27e756[_0xa55e('0x30')][_0xa55e('0x2a')];return getAgent(_0x4bd20d)[_0xa55e('0x24')](function(_0x52c3b5){logger[_0xa55e('0x2e')]('entityFound:',_0x52c3b5['name']);emit(util[_0xa55e('0x3b')]('user:%s',_0x52c3b5[_0xa55e('0x18')]),'webbar:answer',{'sessionId':_0x186dc2});return _0x518e06['status'](0xc8)[_0xa55e('0x37')]({'error':![],'message':_0xa55e('0x40')});})['catch'](handleError(_0x518e06));};exports['hold']=function(_0x3ae40d,_0x1dda95){logger[_0xa55e('0x2e')](_0xa55e('0x41'),_0x3ae40d[_0xa55e('0x30')]);var _0x1031c9=holdValidation['validate'](_0x3ae40d['body']);if(_0x1031c9[_0xa55e('0x2b')]>0x0){return _0x1dda95[_0xa55e('0x19')](0x190)[_0xa55e('0x37')](_0x1031c9);}var _0x259cb3=_0x3ae40d[_0xa55e('0x30')][_0xa55e('0x31')];var _0x5b8776=_0x3ae40d[_0xa55e('0x30')][_0xa55e('0x2a')];return getAgent(_0x259cb3)[_0xa55e('0x24')](function(_0x1de3a8){logger[_0xa55e('0x2e')](_0xa55e('0x35'),_0x1de3a8['name']);emit(util['format'](_0xa55e('0x3c'),_0x1de3a8['name']),_0xa55e('0x42'),{'sessionId':_0x5b8776});return _0x1dda95['status'](0xc8)[_0xa55e('0x37')]({'error':![],'message':_0xa55e('0x43')});})[_0xa55e('0x20')](handleError(_0x1dda95));};exports[_0xa55e('0x44')]=function(_0x2c35a8,_0x63aa32){logger[_0xa55e('0x2e')](_0xa55e('0x45'),_0x2c35a8['body']);var _0x12c9e1=unholdValidation[_0xa55e('0xc')](_0x2c35a8[_0xa55e('0x30')]);if(_0x12c9e1[_0xa55e('0x2b')]>0x0){return _0x63aa32[_0xa55e('0x19')](0x190)[_0xa55e('0x37')](_0x12c9e1);}var _0x50bc5b=_0x2c35a8[_0xa55e('0x30')][_0xa55e('0x31')];var _0x42c00c=_0x2c35a8[_0xa55e('0x30')][_0xa55e('0x2a')];return getAgent(_0x50bc5b)[_0xa55e('0x24')](function(_0x5e0e05){logger[_0xa55e('0x2e')]('entityFound:',_0x5e0e05[_0xa55e('0x18')]);emit(util[_0xa55e('0x3b')](_0xa55e('0x3c'),_0x5e0e05[_0xa55e('0x18')]),_0xa55e('0x46'),{'sessionId':_0x42c00c});return _0x63aa32[_0xa55e('0x19')](0xc8)['json']({'error':![],'message':_0xa55e('0x47')});})['catch'](handleError(_0x63aa32));};exports[_0xa55e('0x48')]=function(_0x5be88c,_0x4f7b59){logger[_0xa55e('0x2e')](_0xa55e('0x49'),_0x4f7b59[_0xa55e('0x30')]);var _0x1f03a8=callsValidation[_0xa55e('0xc')](_0x5be88c[_0xa55e('0x30')]);if(_0x1f03a8[_0xa55e('0x2b')]>0x0){return _0x4f7b59['status'](0x190)[_0xa55e('0x37')](_0x1f03a8);}var _0x33d1e4=_0x5be88c[_0xa55e('0x30')]['userId'];var _0x467ea7=respondWithRpcPromise(_0xa55e('0x25'));var _0x2aeae3=getAgent(_0x33d1e4);return Promise['all']([_0x467ea7,_0x2aeae3])[_0xa55e('0x24')](function(_0x12c5a0){var _0x28fd5a=_0x12c5a0[0x0];var _0x2a6a1f=_0x12c5a0[0x1];var _0x6f0032=_[_0xa55e('0x27')](_0x28fd5a[_0xa55e('0x28')],function(_0x2f8b5f){return _0x2f8b5f[_0xa55e('0x29')]==_0x2a6a1f['id'];});return _0x4f7b59[_0xa55e('0x19')](0xc8)[_0xa55e('0x37')]({'count':_0x6f0032['length'],'rows':_0x6f0032});})[_0xa55e('0x20')](handleError(_0x4f7b59));};exports['conference']=function(_0x373874,_0x1ea145){logger[_0xa55e('0x2e')](_0xa55e('0x4a'),_0x373874[_0xa55e('0x30')]);var _0x1bef1b=conferenceValidation[_0xa55e('0xc')](_0x373874[_0xa55e('0x30')]);if(_0x1bef1b[_0xa55e('0x2b')]>0x0){return _0x1ea145[_0xa55e('0x19')](0x190)[_0xa55e('0x37')](_0x1bef1b);}var _0x424b87=_0x373874[_0xa55e('0x30')][_0xa55e('0x31')];return getAgent(_0x424b87)[_0xa55e('0x24')](function(_0x448641){logger['info']('entityFound:',_0x448641[_0xa55e('0x18')]);emit(util[_0xa55e('0x3b')](_0xa55e('0x3c'),_0x448641[_0xa55e('0x18')]),'webbar:conference');return _0x1ea145['status'](0xc8)[_0xa55e('0x37')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x1ea145));};exports['transfer']=function(_0x16f585,_0x37cd3a){logger[_0xa55e('0x2e')](_0xa55e('0x4b'),_0x16f585[_0xa55e('0x30')]);var _0x909ec4=transferValidation[_0xa55e('0xc')](_0x16f585[_0xa55e('0x30')]);if(_0x909ec4[_0xa55e('0x2b')]>0x0){return _0x37cd3a[_0xa55e('0x19')](0x190)['json'](_0x909ec4);}var _0x100633=_0x16f585[_0xa55e('0x30')][_0xa55e('0x31')];var _0x5d9388=_0x16f585[_0xa55e('0x30')][_0xa55e('0x2a')];var _0x3dab7b=_0x16f585[_0xa55e('0x30')]['transferNumber'];return getAgent(_0x100633)[_0xa55e('0x24')](function(_0x14fcad){logger[_0xa55e('0x2e')]('entityFound:',_0x14fcad['name']);emit(util[_0xa55e('0x3b')]('user:%s',_0x14fcad[_0xa55e('0x18')]),'webbar:transfer',{'sessionId':_0x5d9388,'transferNumber':_0x3dab7b});return _0x37cd3a[_0xa55e('0x19')](0xc8)[_0xa55e('0x37')]({'error':![],'message':'transfer\x20executed!'});})[_0xa55e('0x20')](handleError(_0x37cd3a));}; \ No newline at end of file +var _0xd691=['conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../mysqldb','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','error','stack','name','status','send','NotFound','then','message','result','findOne','agent','VoiceChannels','all','filter','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','sessionId','user:%s','catch','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference'];(function(_0x2cfff5,_0x5afbd7){var _0x372fc3=function(_0x48f4d1){while(--_0x48f4d1){_0x2cfff5['push'](_0x2cfff5['shift']());}};_0x372fc3(++_0x5afbd7);}(_0xd691,0xe6));var _0x1d69=function(_0x29bef7,_0x5127f0){_0x29bef7=_0x29bef7-0x0;var _0x1ba0c1=_0xd691[_0x29bef7];return _0x1ba0c1;};'use strict';var path=require(_0x1d69('0x0'));var fs=require('fs');var _=require(_0x1d69('0x1'));var db=require(_0x1d69('0x2'))['db'];var config=require('../../config/environment');var util=require(_0x1d69('0x3'));var BPromise=require(_0x1d69('0x4'));var jayson=require(_0x1d69('0x5'));var amiClient=jayson[_0x1d69('0x6')][_0x1d69('0x7')]({'port':0x232a});var logger=require(_0x1d69('0x8'))(_0x1d69('0x9'));var Redis=require(_0x1d69('0xa'));config[_0x1d69('0xb')]=_[_0x1d69('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1d69('0xd'))(new Redis(config['redis']));var Schema=require(_0x1d69('0xe'));var originateValidation=new Schema({'userId':{'type':_0x1d69('0xf'),'required':[!![],_0x1d69('0x10')]},'callNumber':{'type':_0x1d69('0x11'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x1d69('0x11')},'callbackUrl':{'type':_0x1d69('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x1d69('0xf'),'required':[!![],_0x1d69('0x10')]},'sessionId':{'type':_0x1d69('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x1d69('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x1d69('0xf'),'required':[!![],_0x1d69('0x10')]},'sessionId':{'type':_0x1d69('0x11'),'required':[!![],_0x1d69('0x12')]},'transferNumber':{'type':_0x1d69('0x11'),'required':[!![],_0x1d69('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x1d69('0xf'),'required':[!![],_0x1d69('0x10')]},'sessionId':{'type':_0x1d69('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x1d69('0xf'),'required':[!![],_0x1d69('0x10')]},'sessionId':{'type':_0x1d69('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x1d69('0xf'),'required':[!![],_0x1d69('0x10')]}});function emit(_0x29dd32,_0x5fe486,_0x3ec720){logger[_0x1d69('0x14')](_0x29dd32,_0x5fe486,JSON['stringify'](_0x3ec720));io['to'](_0x29dd32)[_0x1d69('0x15')](_0x5fe486,_0x3ec720);}function handleError(_0xcf076b){return function(_0x34f6d4){console['log']('handleError:',_0x34f6d4,_0x34f6d4 instanceof RangeError);logger[_0x1d69('0x16')](_0x34f6d4[_0x1d69('0x17')]);if(_0x34f6d4 instanceof RangeError){if(_0x34f6d4[_0x1d69('0x18')]){delete _0x34f6d4['name'];}_0xcf076b[_0x1d69('0x19')](0x194)[_0x1d69('0x1a')](_0x34f6d4);}else{if(_0x34f6d4[_0x1d69('0x18')]){delete _0x34f6d4[_0x1d69('0x18')];}_0xcf076b[_0x1d69('0x19')](0x1f4)[_0x1d69('0x1a')](_0x34f6d4);}};}function checkError(){return function(_0x34c920){if(!_0x34c920){throw new RangeError(_0x1d69('0x1b'));}return _0x34c920;};}function respondWithRpcPromise(_0x5c90eb,_0x7821f8){return new BPromise(function(_0x122238,_0x1786e1){var _0x228d18=amiClient;return _0x228d18['request'](_0x5c90eb,_0x7821f8)[_0x1d69('0x1c')](function(_0x411ca0){if(_0x411ca0[_0x1d69('0x16')]){if(_0x411ca0['error']['code']===0x1f4){return _0x1786e1(_0x411ca0['error'][_0x1d69('0x1d')]);}return _0x122238(_0x411ca0[_0x1d69('0x16')][_0x1d69('0x1d')]);}else{_0x122238(_0x411ca0[_0x1d69('0x1e')]);}})['catch'](function(_0x3af518){_0x1786e1(_0x3af518);});});}function getAgent(_0x33b5e9){return db['User'][_0x1d69('0x1f')]({'where':{'id':_0x33b5e9,'role':_0x1d69('0x20')}})[_0x1d69('0x1c')](checkError());}function getAgentCheckSession(_0x30aefe,_0x2d3f2e){return new BPromise(function(_0x247130,_0x5cca6a){var _0x23043c=respondWithRpcPromise(_0x1d69('0x21'));var _0x3c6b2b=getAgent(_0x30aefe);Promise[_0x1d69('0x22')]([_0x23043c,_0x3c6b2b])[_0x1d69('0x1c')](function(_0x1e5818){var _0x2fd8d3=_0x1e5818[0x0];var _0x215052=_0x1e5818[0x1];var _0x156825=_[_0x1d69('0x23')](_0x2fd8d3[_0x1d69('0x24')],function(_0x5e8e8e){return _0x5e8e8e[_0x1d69('0x25')]==_0x215052['id']&&_0x5e8e8e['sessionId']==_0x2d3f2e;});if(_0x156825[_0x1d69('0x26')]==0x1){_0x247130(_0x215052);}else{_0x5cca6a(new RangeError(_0x1d69('0x27')+_0x2d3f2e+_0x1d69('0x28')));}});});}exports[_0x1d69('0x29')]=function(_0x582da2,_0x59b677){logger[_0x1d69('0x14')]('originate\x20fired:',_0x582da2[_0x1d69('0x2a')]);var _0x2db151=originateValidation[_0x1d69('0xe')](_0x582da2[_0x1d69('0x2a')]);if(_0x2db151[_0x1d69('0x26')]>0x0){return _0x59b677[_0x1d69('0x19')](0x190)[_0x1d69('0x2b')](_0x2db151);}var _0x1894d9=_0x582da2[_0x1d69('0x2a')][_0x1d69('0x2c')];var _0xa0d7f9=_0x582da2[_0x1d69('0x2a')][_0x1d69('0x2d')];var _0x441d1c=_0x582da2['body'][_0x1d69('0x2e')];var _0x2cf204=_0x582da2[_0x1d69('0x2a')][_0x1d69('0x2f')];return getAgent(_0x1894d9)[_0x1d69('0x1c')](function(_0x4c8414){logger[_0x1d69('0x14')](_0x1d69('0x30'),_0x4c8414[_0x1d69('0x18')]);emit(util[_0x1d69('0x31')]('user:%s',_0x4c8414[_0x1d69('0x18')]),_0x1d69('0x32'),{'callNumber':_0xa0d7f9,'callerId':_0x441d1c,'callbackUrl':_0x2cf204});return _0x59b677[_0x1d69('0x19')](0xc8)[_0x1d69('0x2b')]({'error':![],'message':_0x1d69('0x33')});})['catch'](handleError(_0x59b677));};exports['hangup']=function(_0x49ce52,_0x896d0e){logger[_0x1d69('0x14')]('hangup\x20fired:',_0x49ce52[_0x1d69('0x2a')]);var _0x23335c=hangupValidation[_0x1d69('0xe')](_0x49ce52['body']);if(_0x23335c[_0x1d69('0x26')]>0x0){return _0x896d0e[_0x1d69('0x19')](0x190)[_0x1d69('0x2b')](_0x23335c);}var _0x30be3e=_0x49ce52['body'][_0x1d69('0x2c')];var _0x353a83=_0x49ce52[_0x1d69('0x2a')][_0x1d69('0x34')];return getAgent(_0x30be3e)['then'](function(_0x1a46ae){logger[_0x1d69('0x14')](_0x1d69('0x30'),_0x1a46ae[_0x1d69('0x18')]);emit(util[_0x1d69('0x31')](_0x1d69('0x35'),_0x1a46ae[_0x1d69('0x18')]),'webbar:hangup',{'sessionId':_0x353a83});return _0x896d0e[_0x1d69('0x19')](0xc8)[_0x1d69('0x2b')]({'error':![],'message':'hangup\x20executed!'});})[_0x1d69('0x36')](handleError(_0x896d0e));};exports['answer']=function(_0x11b2e0,_0x399609){logger[_0x1d69('0x14')](_0x1d69('0x37'),_0x11b2e0['body']);var _0x1d6fee=answerValidation[_0x1d69('0xe')](_0x11b2e0[_0x1d69('0x2a')]);if(_0x1d6fee['length']>0x0){return _0x399609[_0x1d69('0x19')](0x190)['json'](_0x1d6fee);}var _0x531387=_0x11b2e0[_0x1d69('0x2a')][_0x1d69('0x2c')];var _0x5451b6=_0x11b2e0[_0x1d69('0x2a')]['sessionId'];return getAgent(_0x531387)[_0x1d69('0x1c')](function(_0x1dc676){logger['info'](_0x1d69('0x30'),_0x1dc676[_0x1d69('0x18')]);emit(util[_0x1d69('0x31')]('user:%s',_0x1dc676[_0x1d69('0x18')]),_0x1d69('0x38'),{'sessionId':_0x5451b6});return _0x399609[_0x1d69('0x19')](0xc8)[_0x1d69('0x2b')]({'error':![],'message':_0x1d69('0x39')});})[_0x1d69('0x36')](handleError(_0x399609));};exports[_0x1d69('0x3a')]=function(_0x746cdb,_0x357a76){logger[_0x1d69('0x14')](_0x1d69('0x3b'),_0x746cdb[_0x1d69('0x2a')]);var _0x2dbc0c=holdValidation[_0x1d69('0xe')](_0x746cdb[_0x1d69('0x2a')]);if(_0x2dbc0c[_0x1d69('0x26')]>0x0){return _0x357a76['status'](0x190)[_0x1d69('0x2b')](_0x2dbc0c);}var _0x11cf7c=_0x746cdb[_0x1d69('0x2a')]['userId'];var _0x4b38fd=_0x746cdb[_0x1d69('0x2a')]['sessionId'];return getAgent(_0x11cf7c)[_0x1d69('0x1c')](function(_0x370645){logger[_0x1d69('0x14')]('entityFound:',_0x370645['name']);emit(util[_0x1d69('0x31')]('user:%s',_0x370645[_0x1d69('0x18')]),'webbar:hold',{'sessionId':_0x4b38fd});return _0x357a76['status'](0xc8)[_0x1d69('0x2b')]({'error':![],'message':_0x1d69('0x3c')});})[_0x1d69('0x36')](handleError(_0x357a76));};exports[_0x1d69('0x3d')]=function(_0x442041,_0x4e6453){logger[_0x1d69('0x14')](_0x1d69('0x3e'),_0x442041['body']);var _0x28bb7b=unholdValidation[_0x1d69('0xe')](_0x442041[_0x1d69('0x2a')]);if(_0x28bb7b[_0x1d69('0x26')]>0x0){return _0x4e6453['status'](0x190)[_0x1d69('0x2b')](_0x28bb7b);}var _0x5a4e1c=_0x442041[_0x1d69('0x2a')][_0x1d69('0x2c')];var _0x37749b=_0x442041['body'][_0x1d69('0x34')];return getAgent(_0x5a4e1c)['then'](function(_0x2d90ec){logger[_0x1d69('0x14')](_0x1d69('0x30'),_0x2d90ec['name']);emit(util[_0x1d69('0x31')]('user:%s',_0x2d90ec[_0x1d69('0x18')]),_0x1d69('0x3f'),{'sessionId':_0x37749b});return _0x4e6453[_0x1d69('0x19')](0xc8)[_0x1d69('0x2b')]({'error':![],'message':_0x1d69('0x40')});})[_0x1d69('0x36')](handleError(_0x4e6453));};exports[_0x1d69('0x41')]=function(_0x143fd9,_0x29502a){logger[_0x1d69('0x14')](_0x1d69('0x42'),_0x29502a[_0x1d69('0x2a')]);var _0x25f7e5=callsValidation[_0x1d69('0xe')](_0x143fd9[_0x1d69('0x2a')]);if(_0x25f7e5[_0x1d69('0x26')]>0x0){return _0x29502a[_0x1d69('0x19')](0x190)['json'](_0x25f7e5);}var _0x2d2a7f=_0x143fd9[_0x1d69('0x2a')]['userId'];var _0x76ead1=respondWithRpcPromise('VoiceChannels');var _0x3b26c6=getAgent(_0x2d2a7f);return Promise[_0x1d69('0x22')]([_0x76ead1,_0x3b26c6])['then'](function(_0x5bd4d0){var _0x1d33c2=_0x5bd4d0[0x0];var _0x3b705d=_0x5bd4d0[0x1];var _0x329076=_[_0x1d69('0x23')](_0x1d33c2['rows'],function(_0x402b3c){return _0x402b3c[_0x1d69('0x25')]==_0x3b705d['id'];});return _0x29502a[_0x1d69('0x19')](0xc8)[_0x1d69('0x2b')]({'count':_0x329076[_0x1d69('0x26')],'rows':_0x329076});})[_0x1d69('0x36')](handleError(_0x29502a));};exports[_0x1d69('0x43')]=function(_0x323e7e,_0x8dcb5d){logger[_0x1d69('0x14')](_0x1d69('0x44'),_0x323e7e[_0x1d69('0x2a')]);var _0x362bdd=conferenceValidation['validate'](_0x323e7e[_0x1d69('0x2a')]);if(_0x362bdd[_0x1d69('0x26')]>0x0){return _0x8dcb5d[_0x1d69('0x19')](0x190)['json'](_0x362bdd);}var _0x44cd1c=_0x323e7e[_0x1d69('0x2a')][_0x1d69('0x2c')];return getAgent(_0x44cd1c)[_0x1d69('0x1c')](function(_0x8f8b31){logger[_0x1d69('0x14')](_0x1d69('0x30'),_0x8f8b31[_0x1d69('0x18')]);emit(util[_0x1d69('0x31')](_0x1d69('0x35'),_0x8f8b31[_0x1d69('0x18')]),_0x1d69('0x45'));return _0x8dcb5d[_0x1d69('0x19')](0xc8)[_0x1d69('0x2b')]({'error':![],'message':_0x1d69('0x46')});})['catch'](handleError(_0x8dcb5d));};exports[_0x1d69('0x47')]=function(_0x7bb6f5,_0x1df70c){logger[_0x1d69('0x14')](_0x1d69('0x48'),_0x7bb6f5['body']);var _0x38370e=transferValidation[_0x1d69('0xe')](_0x7bb6f5[_0x1d69('0x2a')]);if(_0x38370e['length']>0x0){return _0x1df70c[_0x1d69('0x19')](0x190)[_0x1d69('0x2b')](_0x38370e);}var _0x2e34bc=_0x7bb6f5['body'][_0x1d69('0x2c')];var _0x331d1a=_0x7bb6f5['body'][_0x1d69('0x34')];var _0x5d5bc4=_0x7bb6f5['body'][_0x1d69('0x49')];return getAgent(_0x2e34bc)['then'](function(_0x18d13c){logger['info'](_0x1d69('0x30'),_0x18d13c[_0x1d69('0x18')]);emit(util[_0x1d69('0x31')](_0x1d69('0x35'),_0x18d13c[_0x1d69('0x18')]),_0x1d69('0x4a'),{'sessionId':_0x331d1a,'transferNumber':_0x5d5bc4});return _0x1df70c['status'](0xc8)[_0x1d69('0x2b')]({'error':![],'message':'transfer\x20executed!'});})[_0x1d69('0x36')](handleError(_0x1df70c));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 321944c..c13a378 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 _0x0598=['put','update','delete','destroy','/:id/canned_answers','removeAgents','multer','util','connect-timeout','fs-extra','../../components/auth/service','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/users','addAgents','addApplications','/:id/notify'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0598,0x92));var _0x8059=function(_0xdb082f,_0x58f6b3){_0xdb082f=_0xdb082f-0x0;var _0x2528b3=_0x0598[_0xdb082f];return _0x2528b3;};'use strict';var multer=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var path=require('path');var timeout=require(_0x8059('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8059('0x3'));var auth=require(_0x8059('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0x8059('0x5')]('/',auth[_0x8059('0x6')](),controller['index']);router['get'](_0x8059('0x7'),auth[_0x8059('0x6')](),controller[_0x8059('0x8')]);router[_0x8059('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x8059('0x9')]);router[_0x8059('0x5')](_0x8059('0xa'),auth[_0x8059('0x6')](),controller[_0x8059('0xb')]);router['get']('/:id/canned_answers',auth[_0x8059('0x6')](),controller[_0x8059('0xc')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x8059('0xd')]);router[_0x8059('0x5')](_0x8059('0xe'),auth[_0x8059('0x6')](),controller[_0x8059('0xf')]);router['post']('/',auth[_0x8059('0x6')](),controller['create']);router[_0x8059('0x10')]('/:id/dispositions',auth[_0x8059('0x6')](),controller[_0x8059('0x11')]);router[_0x8059('0x10')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0x8059('0x10')](_0x8059('0x12'),auth[_0x8059('0x6')](),controller[_0x8059('0x13')]);router[_0x8059('0x10')]('/:id/applications',auth[_0x8059('0x6')](),controller[_0x8059('0x14')]);router[_0x8059('0x10')](_0x8059('0x15'),controller['notify']);router[_0x8059('0x10')]('/:id/send',auth[_0x8059('0x6')](),controller['send']);router[_0x8059('0x16')]('/:id',auth[_0x8059('0x6')](),controller[_0x8059('0x17')]);router[_0x8059('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x8059('0x19')]);router[_0x8059('0x18')](_0x8059('0xa'),auth[_0x8059('0x6')](),controller['removeDispositions']);router[_0x8059('0x18')](_0x8059('0x1a'),auth[_0x8059('0x6')](),controller['removeAnswers']);router[_0x8059('0x18')](_0x8059('0x12'),auth[_0x8059('0x6')](),controller[_0x8059('0x1b')]);module['exports']=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(_0x2b6813,_0x2d14d2){var _0x3c6cf8=function(_0x30dc5d){while(--_0x30dc5d){_0x2b6813['push'](_0x2b6813['shift']());}};_0x3c6cf8(++_0x2d14d2);}(_0x1967,0x173));var _0x7196=function(_0x31626c,_0x36891e){_0x31626c=_0x31626c-0x0;var _0x2b79a1=_0x1967[_0x31626c];return _0x2b79a1;};'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 bb51d01..2e38039 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 _0x3547=['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','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','twilio','sinch'];(function(_0x318372,_0x56ae1e){var _0x518e04=function(_0x3bf1c5){while(--_0x3bf1c5){_0x318372['push'](_0x318372['shift']());}};_0x518e04(++_0x56ae1e);}(_0x3547,0x178));var _0x7354=function(_0x350be0,_0x32bf13){_0x350be0=_0x350be0-0x0;var _0x2a6483=_0x3547[_0x350be0];return _0x2a6483;};'use strict';var Sequelize=require(_0x7354('0x0'));var rs=require(_0x7354('0x1'));module[_0x7354('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x7354('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x7354('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x7354('0x4')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x7354('0x5')]();}},'phone':{'type':Sequelize[_0x7354('0x4')]},'type':{'type':Sequelize['ENUM'](_0x7354('0x6'),_0x7354('0x7'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x7354('0x4')]},'authToken':{'type':Sequelize[_0x7354('0x4')]},'notificationTemplate':{'type':Sequelize[_0x7354('0x8')],'defaultValue':function(){return _0x7354('0x9');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x7354('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7354('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7354('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7354('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7354('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7354('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x7354('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x7354('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4cf5aa){if(!_0x4cf5aa){this[_0x7354('0xd')](_0x7354('0xe'),null);}this[_0x7354('0xd')](_0x7354('0xf'),_0x4cf5aa);}},'description':{'type':Sequelize[_0x7354('0x4')]}}; \ No newline at end of file +var _0xfc04=['BOOLEAN','INTEGER','setDataValue','mandatoryDispositionPauseId','randomstring','STRING','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xfc04,0xb8));var _0x4fc0=function(_0x507fbe,_0x333bcf){_0x507fbe=_0x507fbe-0x0;var _0x9e7037=_0xfc04[_0x507fbe];return _0x9e7037;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x4fc0('0x0'));module['exports']={'name':{'type':Sequelize[_0x4fc0('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x4fc0('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x4fc0('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x4fc0('0x1')],'defaultValue':function(){return rs[_0x4fc0('0x2')]();}},'phone':{'type':Sequelize[_0x4fc0('0x1')]},'type':{'type':Sequelize[_0x4fc0('0x3')](_0x4fc0('0x4'),_0x4fc0('0x5'))},'accountSid':{'type':Sequelize[_0x4fc0('0x1')]},'baseUrl':{'type':Sequelize[_0x4fc0('0x1')]},'authToken':{'type':Sequelize[_0x4fc0('0x1')]},'notificationTemplate':{'type':Sequelize[_0x4fc0('0x6')],'defaultValue':function(){return _0x4fc0('0x7');}},'notificationSound':{'type':Sequelize[_0x4fc0('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x4fc0('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4fc0('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4fc0('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4fc0('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4fc0('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4fc0('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4fc0('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x59d924){if(!_0x59d924){this[_0x4fc0('0xa')](_0x4fc0('0xb'),null);}this[_0x4fc0('0xa')]('mandatoryDisposition',_0x59d924);}},'description':{'type':Sequelize[_0x4fc0('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 4547508..99ff718 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 _0x7078=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','defaults','redis','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','update','destroy','then','get','WhatsappAccounts','UserProfileResource','stack','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','pick','merge','type','VIRTUAL','filter','includeAll','include','WhatsappAccount','findAll','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','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','hasOwnProperty','sort','options','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','transaction','sequelize','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','account','sinch','statuses','state','read','WhatsappMessage','message_id','applications','asc','Applications','CmContact','describe','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','From','replace','whatsapp:','Body','messageId','MessageSid','from','notifications','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','Start','startRouting','entity\x20found','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','push','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service'];(function(_0x277be3,_0x5f32d9){var _0x2be2ff=function(_0x218e51){while(--_0x218e51){_0x277be3['push'](_0x277be3['shift']());}};_0x2be2ff(++_0x5f32d9);}(_0x7078,0xb5));var _0x8707=function(_0x58b6c7,_0x3bf35e){_0x58b6c7=_0x58b6c7-0x0;var _0x5f50d0=_0x7078[_0x58b6c7];return _0x5f50d0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8707('0x0'));var jsonpatch=require(_0x8707('0x1'));var rp=require(_0x8707('0x2'));var moment=require(_0x8707('0x3'));var BPromise=require(_0x8707('0x4'));var Mustache=require(_0x8707('0x5'));var util=require(_0x8707('0x6'));var path=require(_0x8707('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8707('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8707('0x9'));var squel=require('squel');var crypto=require(_0x8707('0xa'));var jsforce=require(_0x8707('0xb'));var deskjs=require(_0x8707('0xc'));var toCsv=require(_0x8707('0xd'));var querystring=require(_0x8707('0xe'));var Papa=require(_0x8707('0xf'));var Redis=require('ioredis');var authService=require(_0x8707('0x10'));var qs=require(_0x8707('0x11'));var as=require(_0x8707('0x12'));var hardwareService=require(_0x8707('0x13'));var logger=require(_0x8707('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x8707('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x8707('0x16')](config[_0x8707('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x8707('0x18'))(new Redis(config['redis']));require(_0x8707('0x19'))[_0x8707('0x1a')](socket);var jayson=require(_0x8707('0x1b'));var client=jayson[_0x8707('0x1c')][_0x8707('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x51d5d8,_0x5224ed,_0x15ddc3,_0x303e66){return new BPromise(function(_0x36fa73,_0x25bdd6){var _0x259381=_0x303e66||client;return _0x259381[_0x8707('0x1e')](_0x51d5d8,_0x15ddc3)['then'](function(_0x41b7fd){logger[_0x8707('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0x5224ed,_0x8707('0x20'));logger[_0x8707('0x21')](_0x8707('0x22'),_0x5224ed,'request\x20sent',JSON[_0x8707('0x23')](_0x41b7fd));if(_0x41b7fd[_0x8707('0x24')]){if(_0x41b7fd['error'][_0x8707('0x25')]===0x1f4){logger[_0x8707('0x24')](_0x8707('0x26'),_0x5224ed,_0x41b7fd[_0x8707('0x24')][_0x8707('0x27')]);return _0x25bdd6(_0x41b7fd[_0x8707('0x24')]['message']);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x5224ed,_0x41b7fd['error'][_0x8707('0x27')]);return _0x36fa73(_0x41b7fd['error']['message']);}else{logger[_0x8707('0x1f')](_0x8707('0x26'),_0x5224ed,_0x8707('0x20'));_0x36fa73(_0x41b7fd[_0x8707('0x28')][_0x8707('0x27')]);}})[_0x8707('0x29')](function(_0x1141e2){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x5224ed,_0x1141e2);_0x25bdd6(_0x1141e2);});});}function respondWithStatusCode(_0x3c15a9,_0x3404fd){_0x3404fd=_0x3404fd||0xcc;return function(_0x4f4fa4){if(_0x4f4fa4){return _0x3c15a9[_0x8707('0x2a')](_0x3404fd);}return _0x3c15a9[_0x8707('0x2b')](_0x3404fd)[_0x8707('0x2c')]();};}function respondWithResult(_0x2161df,_0x5cec60){_0x5cec60=_0x5cec60||0xc8;return function(_0x4fd294){if(_0x4fd294){return _0x2161df['status'](_0x5cec60)[_0x8707('0x2d')](_0x4fd294);}};}function respondWithFilteredResult(_0x26ab2b,_0x574f54){return function(_0x3319b1){if(_0x3319b1){var _0x234c4a=typeof _0x574f54['offset']===_0x8707('0x2e')&&typeof _0x574f54['limit']===_0x8707('0x2e');var _0x1b3ea6=_0x3319b1[_0x8707('0x2f')];var _0x191274=_0x234c4a?0x0:_0x574f54[_0x8707('0x30')];var _0x1bcff0=_0x234c4a?_0x3319b1[_0x8707('0x2f')]:_0x574f54[_0x8707('0x30')]+_0x574f54[_0x8707('0x31')];var _0x31ef12;if(_0x1bcff0>=_0x1b3ea6){_0x1bcff0=_0x1b3ea6;_0x31ef12=0xc8;}else{_0x31ef12=0xce;}_0x26ab2b[_0x8707('0x2b')](_0x31ef12);return _0x26ab2b[_0x8707('0x32')](_0x8707('0x33'),_0x191274+'-'+_0x1bcff0+'/'+_0x1b3ea6)[_0x8707('0x2d')](_0x3319b1);}return null;};}function patchUpdates(_0x52016d){return function(_0x3047e2){try{jsonpatch['apply'](_0x3047e2,_0x52016d,!![]);}catch(_0x8a6479){return BPromise[_0x8707('0x34')](_0x8a6479);}return _0x3047e2['save']();};}function saveUpdates(_0x149a88,_0x438259){return function(_0x4c258d){if(_0x4c258d){return _0x4c258d[_0x8707('0x35')](_0x149a88)['then'](function(_0x52ca42){return _0x52ca42;});}return null;};}function removeEntity(_0x365eb6,_0x92dbb1){return function(_0x58e940){if(_0x58e940){return _0x58e940[_0x8707('0x36')]()[_0x8707('0x37')](function(){var _0x3e212d=_0x58e940[_0x8707('0x38')]({'plain':!![]});var _0x208b2f=_0x8707('0x39');return db[_0x8707('0x3a')][_0x8707('0x36')]({'where':{'type':_0x208b2f,'resourceId':_0x3e212d['id']}})[_0x8707('0x37')](function(){return _0x58e940;});})[_0x8707('0x37')](function(){_0x365eb6[_0x8707('0x2b')](0xcc)[_0x8707('0x2c')]();});}};}function handleEntityNotFound(_0x4667a6,_0x1e4032){return function(_0x3bedca){if(!_0x3bedca){_0x4667a6[_0x8707('0x2a')](0x194);}return _0x3bedca;};}function handleError(_0x293e2c,_0x3d4a47){_0x3d4a47=_0x3d4a47||0x1f4;return function(_0x5a9471){logger[_0x8707('0x24')](_0x5a9471[_0x8707('0x3b')]);if(_0x5a9471['name']){delete _0x5a9471['name'];}_0x293e2c[_0x8707('0x2b')](_0x3d4a47)[_0x8707('0x3c')](_0x5a9471);};}exports[_0x8707('0x3d')]=function(_0x3fa54c,_0x331b0c){var _0x32221b={'include':[{'model':db[_0x8707('0x3e')],'as':_0x8707('0x3f')}]},_0x30efcb={},_0x42f9fc={'count':0x0,'rows':[]};var _0x531546=_[_0x8707('0x40')](db['WhatsappAccount'][_0x8707('0x41')],function(_0x46c5e8){return{'name':_0x46c5e8['fieldName'],'type':_0x46c5e8['type'][_0x8707('0x42')]};});_0x30efcb[_0x8707('0x43')]=_[_0x8707('0x40')](_0x531546,_0x8707('0x44'));_0x30efcb[_0x8707('0x45')]=_[_0x8707('0x46')](_0x3fa54c['query']);_0x30efcb[_0x8707('0x47')]=_[_0x8707('0x48')](_0x30efcb[_0x8707('0x43')],_0x30efcb[_0x8707('0x45')]);_0x32221b[_0x8707('0x49')]=_[_0x8707('0x48')](_0x30efcb[_0x8707('0x43')],qs['fields'](_0x3fa54c['query'][_0x8707('0x4a')]));_0x32221b[_0x8707('0x49')]=_0x32221b['attributes'][_0x8707('0x4b')]?_0x32221b[_0x8707('0x49')]:_0x30efcb[_0x8707('0x43')];if(!_0x3fa54c[_0x8707('0x45')]['hasOwnProperty'](_0x8707('0x4c'))){_0x32221b[_0x8707('0x31')]=qs[_0x8707('0x31')](_0x3fa54c[_0x8707('0x45')][_0x8707('0x31')]);_0x32221b[_0x8707('0x30')]=qs[_0x8707('0x30')](_0x3fa54c[_0x8707('0x45')]['offset']);}_0x32221b[_0x8707('0x4d')]=qs['sort'](_0x3fa54c[_0x8707('0x45')]['sort']);_0x32221b[_0x8707('0x4e')]=qs['filters'](_[_0x8707('0x4f')](_0x3fa54c['query'],_0x30efcb['filters']),_0x531546);if(_0x3fa54c[_0x8707('0x45')]['filter']){_0x32221b[_0x8707('0x4e')]=_[_0x8707('0x50')](_0x32221b[_0x8707('0x4e')],{'$or':_[_0x8707('0x40')](_0x531546,function(_0x1ecc9e){if(_0x1ecc9e[_0x8707('0x51')]!==_0x8707('0x52')){var _0x1fe0c={};_0x1fe0c[_0x1ecc9e[_0x8707('0x44')]]={'$like':'%'+_0x3fa54c['query'][_0x8707('0x53')]+'%'};return _0x1fe0c;}})});}_0x32221b=_['merge']({},_0x32221b,_0x3fa54c['options']);var _0x37da44={'where':_0x32221b['where']};return db['WhatsappAccount'][_0x8707('0x2f')](_0x37da44)[_0x8707('0x37')](function(_0x1f768e){_0x42f9fc['count']=_0x1f768e;if(_0x3fa54c[_0x8707('0x45')][_0x8707('0x54')]){_0x32221b[_0x8707('0x55')]=[{'all':!![]}];}return db[_0x8707('0x56')][_0x8707('0x57')](_0x32221b);})[_0x8707('0x37')](function(_0x1f6d7e){_0x42f9fc['rows']=_0x1f6d7e;return _0x42f9fc;})[_0x8707('0x37')](respondWithFilteredResult(_0x331b0c,_0x32221b))['catch'](handleError(_0x331b0c,null));};exports['show']=function(_0x3661b8,_0x26adc2){var _0x33fe34={'raw':![],'where':{'id':_0x3661b8['params']['id']},'include':[{'model':db[_0x8707('0x3e')],'as':_0x8707('0x3f')}]},_0x3f0a68={};_0x3f0a68[_0x8707('0x43')]=_[_0x8707('0x46')](db[_0x8707('0x56')][_0x8707('0x41')]);_0x3f0a68[_0x8707('0x45')]=_[_0x8707('0x46')](_0x3661b8[_0x8707('0x45')]);_0x3f0a68[_0x8707('0x47')]=_[_0x8707('0x48')](_0x3f0a68[_0x8707('0x43')],_0x3f0a68['query']);_0x33fe34['attributes']=_[_0x8707('0x48')](_0x3f0a68[_0x8707('0x43')],qs['fields'](_0x3661b8[_0x8707('0x45')][_0x8707('0x4a')]));_0x33fe34[_0x8707('0x49')]=_0x33fe34['attributes'][_0x8707('0x4b')]?_0x33fe34[_0x8707('0x49')]:_0x3f0a68[_0x8707('0x43')];if(_0x3661b8[_0x8707('0x45')][_0x8707('0x54')]){_0x33fe34[_0x8707('0x55')]=[{'all':!![]}];}_0x33fe34=_[_0x8707('0x50')]({},_0x33fe34,_0x3661b8['options']);return db[_0x8707('0x56')]['find'](_0x33fe34)['then'](handleEntityNotFound(_0x26adc2,null))['then'](respondWithResult(_0x26adc2,null))[_0x8707('0x29')](handleError(_0x26adc2,null));};exports[_0x8707('0x58')]=function(_0x1f5048,_0x14d513){return db[_0x8707('0x56')]['create'](_0x1f5048[_0x8707('0x59')],{})[_0x8707('0x37')](function(_0x531b75){var _0x3594cb=_0x1f5048[_0x8707('0x5a')][_0x8707('0x38')]({'plain':!![]});if(!_0x3594cb)throw new Error(_0x8707('0x5b'));if(_0x3594cb[_0x8707('0x5c')]==='user'){var _0x227c52=_0x531b75[_0x8707('0x38')]({'plain':!![]});var _0x5d5a3e=_0x8707('0x39');return db[_0x8707('0x5d')][_0x8707('0x5e')]({'where':{'name':_0x5d5a3e,'userProfileId':_0x3594cb[_0x8707('0x5f')]},'raw':!![]})[_0x8707('0x37')](function(_0x1cc748){if(_0x1cc748&&_0x1cc748[_0x8707('0x60')]===0x0){return db[_0x8707('0x3a')]['create']({'name':_0x227c52['name'],'resourceId':_0x227c52['id'],'type':_0x1cc748['name'],'sectionId':_0x1cc748['id']},{})[_0x8707('0x37')](function(){return _0x531b75;});}else{return _0x531b75;}})[_0x8707('0x29')](function(_0x3075f1){logger[_0x8707('0x24')](_0x8707('0x61'),_0x3075f1);throw _0x3075f1;});}return _0x531b75;})[_0x8707('0x37')](respondWithResult(_0x14d513,0xc9))[_0x8707('0x29')](handleError(_0x14d513,null));};exports[_0x8707('0x35')]=function(_0x59f5ef,_0xc1f0c6){if(_0x59f5ef[_0x8707('0x59')]['id']){delete _0x59f5ef['body']['id'];}return db['WhatsappAccount'][_0x8707('0x5e')]({'where':{'id':_0x59f5ef[_0x8707('0x62')]['id']},'include':[{'model':db[_0x8707('0x3e')],'as':_0x8707('0x3f')}]})['then'](handleEntityNotFound(_0xc1f0c6,null))[_0x8707('0x37')](saveUpdates(_0x59f5ef[_0x8707('0x59')],null))['then'](respondWithResult(_0xc1f0c6,null))[_0x8707('0x29')](handleError(_0xc1f0c6,null));};exports[_0x8707('0x36')]=function(_0x39525f,_0x357b81){return db[_0x8707('0x56')]['find']({'where':{'id':_0x39525f[_0x8707('0x62')]['id']}})[_0x8707('0x37')](handleEntityNotFound(_0x357b81,null))[_0x8707('0x37')](removeEntity(_0x357b81,null))[_0x8707('0x29')](handleError(_0x357b81,null));};exports['describe']=function(_0x371b71,_0xf5b907){return db['WhatsappAccount']['describe']()[_0x8707('0x37')](respondWithResult(_0xf5b907,null))[_0x8707('0x29')](handleError(_0xf5b907,null));};exports[_0x8707('0x63')]=function(_0x164e89,_0xce4411,_0x171eea){if(_0x164e89[_0x8707('0x59')]['id']){delete _0x164e89[_0x8707('0x59')]['id'];}return db[_0x8707('0x56')]['find']({'where':{'id':_0x164e89['params']['id']}})[_0x8707('0x37')](handleEntityNotFound(_0xce4411,null))[_0x8707('0x37')](function(_0x34f74d){if(_0x34f74d){_0x164e89[_0x8707('0x59')][_0x8707('0x64')]=_0x34f74d['id'];return db[_0x8707('0x65')][_0x8707('0x58')](_0x164e89[_0x8707('0x59')]);}})[_0x8707('0x37')](respondWithResult(_0xce4411,null))[_0x8707('0x29')](handleError(_0xce4411,null));};exports[_0x8707('0x66')]=function(_0x435e8f,_0x24b065,_0x4a1ba6){var _0x45afa4={'raw':![],'where':{}};var _0x39371e={};var _0x2ed638={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x8707('0x67')]({'where':{'id':_0x435e8f['params']['id']}})['then'](handleEntityNotFound(_0x24b065,null))[_0x8707('0x37')](function(_0x2f4216){if(_0x2f4216){_0x39371e['model']=_['keys'](db[_0x8707('0x65')][_0x8707('0x41')]);_0x39371e[_0x8707('0x45')]=_[_0x8707('0x46')](_0x435e8f[_0x8707('0x45')]);_0x39371e[_0x8707('0x47')]=_[_0x8707('0x48')](_0x39371e['model'],_0x39371e[_0x8707('0x45')]);_0x45afa4[_0x8707('0x49')]=_[_0x8707('0x48')](_0x39371e[_0x8707('0x43')],qs['fields'](_0x435e8f[_0x8707('0x45')][_0x8707('0x4a')]));_0x45afa4[_0x8707('0x49')]=_0x45afa4[_0x8707('0x49')][_0x8707('0x4b')]?_0x45afa4['attributes']:_0x39371e[_0x8707('0x43')];if(!_0x435e8f[_0x8707('0x45')][_0x8707('0x68')](_0x8707('0x4c'))){_0x45afa4[_0x8707('0x31')]=qs[_0x8707('0x31')](_0x435e8f[_0x8707('0x45')][_0x8707('0x31')]);_0x45afa4[_0x8707('0x30')]=qs[_0x8707('0x30')](_0x435e8f[_0x8707('0x45')][_0x8707('0x30')]);}_0x45afa4[_0x8707('0x4d')]=qs['sort'](_0x435e8f[_0x8707('0x45')][_0x8707('0x69')]);_0x45afa4[_0x8707('0x4e')]=qs[_0x8707('0x47')](_[_0x8707('0x4f')](_0x435e8f[_0x8707('0x45')],_0x39371e[_0x8707('0x47')]));_0x45afa4[_0x8707('0x4e')][_0x8707('0x64')]=_0x2f4216['id'];if(_0x435e8f[_0x8707('0x45')]['filter']){_0x45afa4[_0x8707('0x4e')]=_[_0x8707('0x50')](_0x45afa4[_0x8707('0x4e')],{'$or':_[_0x8707('0x40')](_0x45afa4[_0x8707('0x49')],function(_0x1f90e0){var _0x3110f7={};_0x3110f7[_0x1f90e0]={'$like':'%'+_0x435e8f[_0x8707('0x45')][_0x8707('0x53')]+'%'};return _0x3110f7;})});}_0x45afa4=_[_0x8707('0x50')]({},_0x45afa4,_0x435e8f[_0x8707('0x6a')]);return db['Disposition'][_0x8707('0x2f')]({'where':_0x45afa4[_0x8707('0x4e')]})[_0x8707('0x37')](function(_0x38d646){_0x2ed638[_0x8707('0x2f')]=_0x38d646;if(_0x435e8f[_0x8707('0x45')][_0x8707('0x54')]){_0x45afa4['include']=[{'all':!![]}];}return db['Disposition'][_0x8707('0x57')](_0x45afa4);})[_0x8707('0x37')](function(_0x510ba6){_0x2ed638[_0x8707('0x6b')]=_0x510ba6;return _0x2ed638;});}})[_0x8707('0x37')](respondWithFilteredResult(_0x24b065,_0x45afa4))['catch'](handleError(_0x24b065,null));};exports[_0x8707('0x6c')]=function(_0x49f40e,_0x1de0e3,_0x25916e){return db['WhatsappAccount'][_0x8707('0x5e')]({'where':{'id':_0x49f40e[_0x8707('0x62')]['id']}})[_0x8707('0x37')](handleEntityNotFound(_0x1de0e3,null))[_0x8707('0x37')](function(_0x28463b){if(_0x28463b){return _0x28463b[_0x8707('0x6c')](_0x49f40e['query'][_0x8707('0x6d')]);}})[_0x8707('0x37')](respondWithStatusCode(_0x1de0e3,null))[_0x8707('0x29')](handleError(_0x1de0e3,null));};exports[_0x8707('0x6e')]=function(_0x16a902,_0x2cfad6,_0x3ef7d1){if(_0x16a902[_0x8707('0x59')]['id']){delete _0x16a902[_0x8707('0x59')]['id'];}return db['WhatsappAccount'][_0x8707('0x5e')]({'where':{'id':_0x16a902[_0x8707('0x62')]['id']}})[_0x8707('0x37')](handleEntityNotFound(_0x2cfad6,null))[_0x8707('0x37')](function(_0x58c07b){if(_0x58c07b){_0x16a902[_0x8707('0x59')][_0x8707('0x64')]=_0x58c07b['id'];return db['CannedAnswer'][_0x8707('0x58')](_0x16a902[_0x8707('0x59')]);}})[_0x8707('0x37')](respondWithResult(_0x2cfad6,null))[_0x8707('0x29')](handleError(_0x2cfad6,null));};exports['getAnswers']=function(_0x1f04c4,_0xf3e72d,_0x39f527){var _0x2bf7fb={'raw':![],'where':{}};var _0x49835d={};var _0x3e0997={'count':0x0,'rows':[]};return db[_0x8707('0x56')]['findOne']({'where':{'id':_0x1f04c4['params']['id']}})[_0x8707('0x37')](handleEntityNotFound(_0xf3e72d,null))[_0x8707('0x37')](function(_0x4541ca){if(_0x4541ca){_0x49835d[_0x8707('0x43')]=_[_0x8707('0x46')](db['CannedAnswer'][_0x8707('0x41')]);_0x49835d[_0x8707('0x45')]=_[_0x8707('0x46')](_0x1f04c4[_0x8707('0x45')]);_0x49835d['filters']=_['intersection'](_0x49835d[_0x8707('0x43')],_0x49835d[_0x8707('0x45')]);_0x2bf7fb[_0x8707('0x49')]=_[_0x8707('0x48')](_0x49835d[_0x8707('0x43')],qs['fields'](_0x1f04c4[_0x8707('0x45')][_0x8707('0x4a')]));_0x2bf7fb[_0x8707('0x49')]=_0x2bf7fb[_0x8707('0x49')][_0x8707('0x4b')]?_0x2bf7fb[_0x8707('0x49')]:_0x49835d['model'];if(!_0x1f04c4['query'][_0x8707('0x68')](_0x8707('0x4c'))){_0x2bf7fb[_0x8707('0x31')]=qs[_0x8707('0x31')](_0x1f04c4[_0x8707('0x45')][_0x8707('0x31')]);_0x2bf7fb[_0x8707('0x30')]=qs[_0x8707('0x30')](_0x1f04c4[_0x8707('0x45')][_0x8707('0x30')]);}_0x2bf7fb['order']=qs[_0x8707('0x69')](_0x1f04c4[_0x8707('0x45')][_0x8707('0x69')]);_0x2bf7fb['where']=qs[_0x8707('0x47')](_[_0x8707('0x4f')](_0x1f04c4[_0x8707('0x45')],_0x49835d[_0x8707('0x47')]));_0x2bf7fb[_0x8707('0x4e')][_0x8707('0x64')]=_0x4541ca['id'];if(_0x1f04c4[_0x8707('0x45')]['filter']){_0x2bf7fb['where']=_['merge'](_0x2bf7fb['where'],{'$or':_['map'](_0x2bf7fb[_0x8707('0x49')],function(_0x45b8a9){var _0x22644e={};_0x22644e[_0x45b8a9]={'$like':'%'+_0x1f04c4[_0x8707('0x45')][_0x8707('0x53')]+'%'};return _0x22644e;})});}_0x2bf7fb=_[_0x8707('0x50')]({},_0x2bf7fb,_0x1f04c4[_0x8707('0x6a')]);return db[_0x8707('0x6f')][_0x8707('0x2f')]({'where':_0x2bf7fb[_0x8707('0x4e')]})[_0x8707('0x37')](function(_0x1b1809){_0x3e0997[_0x8707('0x2f')]=_0x1b1809;if(_0x1f04c4[_0x8707('0x45')][_0x8707('0x54')]){_0x2bf7fb[_0x8707('0x55')]=[{'all':!![]}];}return db[_0x8707('0x6f')]['findAll'](_0x2bf7fb);})[_0x8707('0x37')](function(_0x8ce202){_0x3e0997['rows']=_0x8ce202;return _0x3e0997;});}})['then'](respondWithFilteredResult(_0xf3e72d,_0x2bf7fb))[_0x8707('0x29')](handleError(_0xf3e72d,null));};exports[_0x8707('0x70')]=function(_0x2fb96a,_0x31651b,_0x25bccf){return db[_0x8707('0x56')]['find']({'where':{'id':_0x2fb96a[_0x8707('0x62')]['id']}})[_0x8707('0x37')](handleEntityNotFound(_0x31651b,null))['then'](function(_0x2e1aa1){if(_0x2e1aa1){return _0x2e1aa1[_0x8707('0x70')](_0x2fb96a[_0x8707('0x45')]['ids']);}})[_0x8707('0x37')](respondWithStatusCode(_0x31651b,null))[_0x8707('0x29')](handleError(_0x31651b,null));};exports[_0x8707('0x71')]=function(_0x320f5b,_0x25c030,_0x5cba28){return db['WhatsappAccount'][_0x8707('0x5e')]({'where':{'id':_0x320f5b[_0x8707('0x62')]['id']}})[_0x8707('0x37')](handleEntityNotFound(_0x25c030,null))['then'](function(_0x39e717){if(_0x39e717){return _0x39e717['addAgents'](_0x320f5b[_0x8707('0x59')]['ids'],_[_0x8707('0x72')](_0x320f5b[_0x8707('0x59')],['ids','id'])||{})[_0x8707('0x73')](function(_0x1c6b5c){for(var _0x32f2d3=0x0;_0x32f2d3<_0x320f5b[_0x8707('0x59')][_0x8707('0x6d')][_0x8707('0x4b')];_0x32f2d3+=0x1){socket[_0x8707('0x74')](_0x8707('0x75'),{'UserId':Number(_0x320f5b[_0x8707('0x59')][_0x8707('0x6d')][_0x32f2d3]),'WhatsappAccountId':Number(_0x320f5b[_0x8707('0x62')]['id'])});}return _0x1c6b5c;});}})[_0x8707('0x37')](respondWithResult(_0x25c030,null))[_0x8707('0x29')](handleError(_0x25c030,null));};exports[_0x8707('0x76')]=function(_0x16dfc2,_0x5e3ec5,_0x499ac0){return db[_0x8707('0x56')][_0x8707('0x5e')]({'where':{'id':_0x16dfc2[_0x8707('0x62')]['id']}})['then'](handleEntityNotFound(_0x5e3ec5,null))[_0x8707('0x37')](function(_0x4e8796){if(_0x4e8796){return _0x4e8796[_0x8707('0x76')](_0x16dfc2[_0x8707('0x45')][_0x8707('0x6d')])[_0x8707('0x37')](function(){if(_[_0x8707('0x77')](_0x16dfc2[_0x8707('0x45')]['ids'])){for(var _0x305770=0x0;_0x305770<_0x16dfc2[_0x8707('0x45')][_0x8707('0x6d')][_0x8707('0x4b')];_0x305770+=0x1){socket[_0x8707('0x74')](_0x8707('0x78'),{'UserId':Number(_0x16dfc2['query']['ids'][_0x305770]),'WhatsappAccountId':Number(_0x16dfc2[_0x8707('0x62')]['id'])});}}else{socket[_0x8707('0x74')](_0x8707('0x78'),{'UserId':Number(_0x16dfc2[_0x8707('0x45')][_0x8707('0x6d')]),'WhatsappAccountId':Number(_0x16dfc2['params']['id'])});}});}})[_0x8707('0x37')](respondWithStatusCode(_0x5e3ec5,null))[_0x8707('0x29')](handleError(_0x5e3ec5,null));};exports['getAgents']=function(_0x2eed98,_0x37440c,_0x2dec51){var _0x1324bc={};var _0x3c36ab={};var _0x4657a1;var _0x37a1d4;return db['WhatsappAccount']['findOne']({'where':{'id':_0x2eed98[_0x8707('0x62')]['id']}})[_0x8707('0x37')](handleEntityNotFound(_0x37440c,null))[_0x8707('0x37')](function(_0x3d0f23){if(_0x3d0f23){_0x4657a1=_0x3d0f23;_0x3c36ab[_0x8707('0x43')]=_[_0x8707('0x46')](db['User'][_0x8707('0x41')]);_0x3c36ab[_0x8707('0x45')]=_[_0x8707('0x46')](_0x2eed98[_0x8707('0x45')]);_0x3c36ab['filters']=_['intersection'](_0x3c36ab['model'],_0x3c36ab['query']);_0x1324bc[_0x8707('0x49')]=_[_0x8707('0x48')](_0x3c36ab[_0x8707('0x43')],qs[_0x8707('0x4a')](_0x2eed98[_0x8707('0x45')]['fields']));_0x1324bc[_0x8707('0x49')]=_0x1324bc[_0x8707('0x49')]['length']?_0x1324bc[_0x8707('0x49')]:_0x3c36ab[_0x8707('0x43')];_0x1324bc[_0x8707('0x4d')]=qs[_0x8707('0x69')](_0x2eed98[_0x8707('0x45')]['sort']);_0x1324bc[_0x8707('0x4e')]=qs['filters'](_[_0x8707('0x4f')](_0x2eed98[_0x8707('0x45')],_0x3c36ab[_0x8707('0x47')]));if(_0x2eed98[_0x8707('0x45')][_0x8707('0x53')]){_0x1324bc['where']=_[_0x8707('0x50')](_0x1324bc[_0x8707('0x4e')],{'$or':_['map'](_0x1324bc[_0x8707('0x49')],function(_0x588e98){var _0x5683f2={};_0x5683f2[_0x588e98]={'$like':'%'+_0x2eed98[_0x8707('0x45')][_0x8707('0x53')]+'%'};return _0x5683f2;})});}_0x1324bc=_[_0x8707('0x50')]({},_0x1324bc,_0x2eed98[_0x8707('0x6a')]);return _0x4657a1[_0x8707('0x79')](_0x1324bc);}})[_0x8707('0x37')](function(_0x36de3f){if(_0x36de3f){_0x37a1d4=_0x36de3f[_0x8707('0x4b')];if(!_0x2eed98['query'][_0x8707('0x68')]('nolimit')){_0x1324bc[_0x8707('0x31')]=qs[_0x8707('0x31')](_0x2eed98[_0x8707('0x45')][_0x8707('0x31')]);_0x1324bc[_0x8707('0x30')]=qs[_0x8707('0x30')](_0x2eed98[_0x8707('0x45')][_0x8707('0x30')]);}return _0x4657a1['getAgents'](_0x1324bc);}})[_0x8707('0x37')](function(_0x51df7d){if(_0x51df7d){return _0x51df7d?{'count':_0x37a1d4,'rows':_0x51df7d}:null;}})[_0x8707('0x37')](respondWithResult(_0x37440c,null))['catch'](handleError(_0x37440c,null));};exports[_0x8707('0x7a')]=function(_0x49deaa,_0x515f56){var _0x2971b1=_0x49deaa['params']['id'];var _0x4326c7=_0x49deaa['body'];var _0x5991aa=0xc8;var _0x1dabd0=null;return db['sequelize'][_0x8707('0x7b')]({'isolationLevel':db[_0x8707('0x7c')]['Transaction']['ISOLATION_LEVELS'][_0x8707('0x7d')]},function(_0x296029){return db[_0x8707('0x56')][_0x8707('0x67')]({'where':{'id':_0x2971b1},'transaction':_0x296029})[_0x8707('0x37')](function(_0x4316a4){if(_0x4316a4){return db[_0x8707('0x7e')][_0x8707('0x36')]({'where':{'WhatsappAccountId':_0x2971b1},'transaction':_0x296029})[_0x8707('0x37')](function(){var _0x6b71b1=_[_0x8707('0x40')](_0x4326c7,function(_0x25898d){_0x25898d['WhatsappAccountId']=_0x2971b1;return _0x25898d;});return db['WhatsappApplication'][_0x8707('0x7f')](_0x6b71b1,{'transaction':_0x296029});});}else{_0x5991aa=0x194;_0x1dabd0=[];}});})[_0x8707('0x37')](function(){if(_0x5991aa!==0x194){return db[_0x8707('0x7e')][_0x8707('0x80')]({'where':{'WhatsappAccountId':_0x2971b1},'order':_0x8707('0x81')})['then'](function(_0x31fcd2){_0x1dabd0=_0x31fcd2;});}})[_0x8707('0x29')](function(_0x1c5e6c){_0x5991aa=0x1f4;logger[_0x8707('0x24')](_0x1c5e6c[_0x8707('0x3b')]);if(_0x1c5e6c['name']){delete _0x1c5e6c['name'];}_0x1dabd0=_0x1c5e6c;})[_0x8707('0x82')](function(){if(_0x1dabd0===null){_0x515f56[_0x8707('0x2a')](_0x5991aa);}else{if(_0x5991aa===0x1f4){_0x515f56[_0x8707('0x2b')](_0x5991aa)[_0x8707('0x3c')](_0x1dabd0);}else{_0x515f56[_0x8707('0x2b')](_0x5991aa)[_0x8707('0x2d')](_0x1dabd0);}}});};exports[_0x8707('0x83')]=function(_0x427e88,_0x33d80d,_0x157857){var _0x40aa95={};var _0x53ffc0={};var _0x9bfe50;var _0x376d06;return db[_0x8707('0x56')][_0x8707('0x67')]({'where':{'id':_0x427e88['params']['id']}})[_0x8707('0x37')](handleEntityNotFound(_0x33d80d,null))[_0x8707('0x37')](function(_0x2e3f69){if(_0x2e3f69){_0x9bfe50=_0x2e3f69;_0x53ffc0[_0x8707('0x43')]=_[_0x8707('0x46')](db[_0x8707('0x7e')][_0x8707('0x41')]);_0x53ffc0['query']=_[_0x8707('0x46')](_0x427e88['query']);_0x53ffc0['filters']=_['intersection'](_0x53ffc0['model'],_0x53ffc0['query']);_0x40aa95[_0x8707('0x49')]=_[_0x8707('0x48')](_0x53ffc0[_0x8707('0x43')],qs[_0x8707('0x4a')](_0x427e88['query'][_0x8707('0x4a')]));_0x40aa95[_0x8707('0x49')]=_0x40aa95[_0x8707('0x49')][_0x8707('0x4b')]?_0x40aa95[_0x8707('0x49')]:_0x53ffc0[_0x8707('0x43')];_0x40aa95[_0x8707('0x4d')]=qs['sort'](_0x427e88[_0x8707('0x45')]['sort']);_0x40aa95[_0x8707('0x4e')]=qs[_0x8707('0x47')](_[_0x8707('0x4f')](_0x427e88['query'],_0x53ffc0[_0x8707('0x47')]));if(_0x427e88[_0x8707('0x45')][_0x8707('0x53')]){_0x40aa95[_0x8707('0x4e')]=_[_0x8707('0x50')](_0x40aa95['where'],{'$or':_[_0x8707('0x40')](_0x40aa95['attributes'],function(_0x4e26e2){var _0x4f9fc4={};_0x4f9fc4[_0x4e26e2]={'$like':'%'+_0x427e88['query'][_0x8707('0x53')]+'%'};return _0x4f9fc4;})});}_0x40aa95=_['merge']({},_0x40aa95,_0x427e88[_0x8707('0x6a')]);return _0x9bfe50[_0x8707('0x83')](_0x40aa95);}})[_0x8707('0x37')](function(_0x1bc17d){if(_0x1bc17d){_0x376d06=_0x1bc17d['length'];if(!_0x427e88[_0x8707('0x45')][_0x8707('0x68')](_0x8707('0x4c'))){_0x40aa95[_0x8707('0x31')]=qs[_0x8707('0x31')](_0x427e88[_0x8707('0x45')]['limit']);_0x40aa95[_0x8707('0x30')]=qs[_0x8707('0x30')](_0x427e88[_0x8707('0x45')][_0x8707('0x30')]);}return _0x9bfe50['getApplications'](_0x40aa95);}})[_0x8707('0x37')](function(_0x3b46fc){if(_0x3b46fc){return _0x3b46fc?{'count':_0x376d06,'rows':_0x3b46fc}:null;}})[_0x8707('0x37')](respondWithResult(_0x33d80d,null))[_0x8707('0x29')](handleError(_0x33d80d,null));};exports[_0x8707('0x84')]=function(_0x17f5bf,_0x31378d,_0x357558){var _0x1582a8={'channel':_0x8707('0x85')};var _0x48b67e=[];var _0x2c048d=[];var _0x13ef68={};return db[_0x8707('0x56')][_0x8707('0x5e')]({'where':{'id':_0x17f5bf['params']['id']},'include':[{'model':db[_0x8707('0x7e')],'as':'Applications'}]})[_0x8707('0x37')](handleEntityNotFound(_0x31378d,null))[_0x8707('0x37')](function(_0x5a1c7e){_0x1582a8[_0x8707('0x86')]=_0x5a1c7e;if(_0x1582a8['account']&&_0x1582a8['account'][_0x8707('0x51')]===_0x8707('0x87')&&_0x17f5bf[_0x8707('0x59')][_0x8707('0x88')]){if(_0x17f5bf['body'][_0x8707('0x88')][_0x8707('0x4b')]===0x0)return;if(_0x17f5bf[_0x8707('0x59')][_0x8707('0x88')][0x0][_0x8707('0x89')]!==_0x8707('0x8a'))return;return db[_0x8707('0x8b')][_0x8707('0x35')]({'read':!![],'readAt':_0x17f5bf[_0x8707('0x59')][_0x8707('0x88')][0x0]['timestamp']},{'where':{'messageId':_0x17f5bf[_0x8707('0x59')][_0x8707('0x88')][0x0][_0x8707('0x8c')]},'individualHooks':!![]})[_0x8707('0x37')](function(_0x3950fc){return _0x31378d[_0x8707('0x2b')](0xc8)['json'](_0x3950fc);});}_0x1582a8[_0x8707('0x8d')]=_['orderBy'](_0x5a1c7e['Applications'],[_0x8707('0x81')],[_0x8707('0x8e')]);if(_0x1582a8['account'][_0x8707('0x8f')]){delete _0x1582a8[_0x8707('0x86')][_0x8707('0x8f')];}return db[_0x8707('0x90')][_0x8707('0x91')]()['then'](function(_0x2df212){if(!_0x2df212){throw new db['Sequelize']['ValidationError'](_0x8707('0x92'));}_0x48b67e=_[_0x8707('0x93')](_[_0x8707('0x46')](_0x2df212),[_0x8707('0x94'),_0x8707('0x95')]);_0x2c048d=_[_0x8707('0x93')](_[_0x8707('0x46')](_0x2df212),[_0x8707('0x94'),'updatedAt',_0x8707('0x96'),_0x8707('0x97')]);_0x1582a8[_0x8707('0x59')]={'mapKey':_0x8707('0x98')};if(_0x1582a8[_0x8707('0x86')]&&_0x1582a8['account'][_0x8707('0x51')]==='twilio'){_0x1582a8['body']['from']=_0x17f5bf['body'][_0x8707('0x99')][_0x8707('0x9a')](_0x8707('0x9b'),'');_0x1582a8[_0x8707('0x59')]['body']=_0x17f5bf[_0x8707('0x59')][_0x8707('0x9c')];_0x1582a8[_0x8707('0x59')][_0x8707('0x9d')]=_0x17f5bf[_0x8707('0x59')][_0x8707('0x9e')];}if(_0x1582a8[_0x8707('0x86')]&&_0x1582a8[_0x8707('0x86')][_0x8707('0x51')]==='sinch'){_0x1582a8[_0x8707('0x59')][_0x8707('0x9f')]=_0x17f5bf['body']['notifications'][0x0][_0x8707('0x9f')];_0x1582a8['body']['body']=_0x17f5bf[_0x8707('0x59')][_0x8707('0xa0')][0x0]['message']['body'];_0x1582a8[_0x8707('0x59')][_0x8707('0x9d')]=_0x17f5bf[_0x8707('0x59')][_0x8707('0xa0')][0x0][_0x8707('0x8c')];}if(_0x1582a8[_0x8707('0x59')]['id']){delete _0x1582a8[_0x8707('0x59')]['id'];}if(_['isNil'](_0x1582a8['body'][_0x8707('0x9f')])){throw new db[(_0x8707('0xa1'))][(_0x8707('0xa2'))](_0x8707('0xa3'));}if(_['isNil'](_0x1582a8[_0x8707('0x59')][_0x8707('0x59')])||_0x1582a8['body'][_0x8707('0x59')]===''){throw new db[(_0x8707('0xa1'))][(_0x8707('0xa2'))](_0x8707('0xa4'));}if(_[_0x8707('0xa5')](_0x1582a8[_0x8707('0x59')]['mapKey'])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2c048d);}if(!_[_0x8707('0xa6')](_0x2c048d,_0x1582a8[_0x8707('0x59')][_0x8707('0xa7')])){throw new db[(_0x8707('0xa1'))][(_0x8707('0xa2'))](_0x8707('0xa8')+_0x2c048d);}_0x13ef68[_0x1582a8[_0x8707('0x59')][_0x8707('0xa7')]]=_0x1582a8[_0x8707('0x59')][_0x8707('0x9f')];return db[_0x8707('0xa9')]['find']({'where':{'id':_0x1582a8['account']['ListId']},'include':[{'model':db[_0x8707('0x90')],'as':_0x8707('0xaa'),'where':_0x13ef68,'limit':0x1,'order':[[_0x8707('0x95'),_0x8707('0xab')]]}]});})[_0x8707('0x37')](handleEntityNotFound(_0x31378d,null))['then'](function(_0xef19d){if(_0xef19d){_0x1582a8[_0x8707('0xac')]=_[_0x8707('0x72')](_0xef19d,['Contacts']);if(_0xef19d[_0x8707('0xaa')]['length']){return _0xef19d[_0x8707('0xaa')][0x0];}var _0x157216=_[_0x8707('0x16')](_0x1582a8[_0x8707('0x59')],{'firstName':_0x1582a8[_0x8707('0x59')][_0x8707('0x9f')],'ListId':_0xef19d['id']});_0x157216[_0x1582a8[_0x8707('0x59')][_0x8707('0xa7')]]=_0x1582a8[_0x8707('0x59')]['from'];return db['CmContact'][_0x8707('0x58')](_0x157216,{'fields':_0x48b67e,'raw':!![]});}})[_0x8707('0x37')](handleEntityNotFound(_0x31378d,null))['then'](function(_0x217813){if(_0x217813){_0x1582a8[_0x8707('0xad')]=_0x217813;var _0x435e62={'ContactId':_0x217813['id'],'phone':_0x1582a8['body'][_0x8707('0x9f')],'WhatsappAccountId':_0x17f5bf[_0x8707('0x62')]['id']};var _0x46b5e0={'ContactId':_0x217813['id'],'WhatsappAccountId':_0x17f5bf[_0x8707('0x62')]['id'],'closed':![]};return db[_0x8707('0xae')]['find']({'where':_0x46b5e0})[_0x8707('0x37')](function(_0x4cbb98){if(_0x4cbb98){return[_0x4cbb98,![]];}return db[_0x8707('0xae')][_0x8707('0x58')](_0x435e62)['then'](function(_0x1dddaf){return[_0x1dddaf,!![]];});});}})[_0x8707('0x73')](function(_0x157fd1,_0x5680dd){_0x1582a8[_0x8707('0xaf')]=_0x157fd1['get']({'plain':!![]});_0x1582a8['interaction'][_0x8707('0xb0')]=![];if(_0x5680dd){if(_0x1582a8[_0x8707('0x86')][_0x8707('0xb1')]){_0x1582a8['applications']['push']({'id':0x0,'priority':_0x1582a8[_0x8707('0x8d')][_0x8707('0x4b')]+0x1,'app':_0x8707('0xb2'),'appdata':_0x8707('0xb3'),'interval':_0x8707('0xb4')});}_0x1582a8[_0x8707('0xaf')]['created']=!![];}return db[_0x8707('0x8b')][_0x8707('0x58')]({'phone':_0x1582a8['body'][_0x8707('0x9f')],'messageId':_0x1582a8[_0x8707('0x59')][_0x8707('0x9d')],'body':_0x1582a8['body'][_0x8707('0x59')],'WhatsappAccountId':_0x17f5bf[_0x8707('0x62')]['id'],'WhatsappInteractionId':_0x157fd1['id'],'direction':'in','ContactId':_0x157fd1[_0x8707('0xb5')],'AttachmentId':_0x1582a8['body'][_0x8707('0xb6')]});})[_0x8707('0x37')](function(_0x3daabf){_0x1582a8[_0x8707('0x27')]=_0x3daabf;if(_0x1582a8[_0x8707('0xaf')][_0x8707('0xb7')]){return db[_0x8707('0xb8')][_0x8707('0x5e')]({'attributes':['id','name'],'where':{'id':_0x1582a8[_0x8707('0xaf')][_0x8707('0xb7')]}})[_0x8707('0x37')](function(_0x4b906e){if(_0x4b906e){_0x1582a8['applications'][_0x8707('0xb9')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4b906e[_0x8707('0x44')]+','+(_0x1582a8[_0x8707('0x86')]['waitForTheAssignedAgent']||0xa),'interval':_0x8707('0xb4')});}return respondWithRpcPromise(_0x8707('0xba'),'startRouting',_0x1582a8);});}return respondWithRpcPromise(_0x8707('0xba'),_0x8707('0xbb'),_0x1582a8);})[_0x8707('0x37')](function(_0xe2e084){if(_0xe2e084){var _0x50e7f7=0xc8;var _0x4b029b='receiveMessage';logger[_0x8707('0x1f')](_0x8707('0x22'),_0x4b029b,_0x50e7f7,_0x8707('0xbc'));logger[_0x8707('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x4b029b,_0x50e7f7,_0x8707('0xbc'),JSON[_0x8707('0x23')](_0xe2e084));if(_0x1582a8['account'][_0x8707('0x51')]==='twilio'){return _0x31378d[_0x8707('0x2b')](_0x50e7f7)[_0x8707('0x32')](_0x8707('0xbd'),_0x8707('0xbe'))['send'](_0x8707('0xbf'));}else{return _0x31378d[_0x8707('0x2b')](_0x50e7f7)[_0x8707('0x2d')](_0xe2e084);}}});})[_0x8707('0x29')](handleError(_0x31378d,null));};exports['send']=function(_0x55eefe,_0x5cae78,_0x2113a7){var _0x5e0dd5,_0x59aa1b,_0x4148c6;if(_[_0x8707('0xa5')](_0x55eefe[_0x8707('0x59')][_0x8707('0x59')])||_0x55eefe[_0x8707('0x59')][_0x8707('0x59')]===''){throw new db['Sequelize'][(_0x8707('0xa2'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x55eefe[_0x8707('0x59')]['to'])){throw new db[(_0x8707('0xa1'))]['ValidationError'](_0x8707('0xc0'));}_0x5e0dd5=_0x55eefe[_0x8707('0x59')]['to'];return db[_0x8707('0x56')][_0x8707('0x5e')]({'where':{'id':_0x55eefe[_0x8707('0x62')]['id']},'include':[{'model':db[_0x8707('0xa9')],'as':_0x8707('0xc1'),'include':[{'model':db[_0x8707('0x90')],'as':_0x8707('0xaa'),'where':{'mobile':_0x5e0dd5},'limit':0x1,'order':[[_0x8707('0x95'),_0x8707('0xab')]]}]}]})[_0x8707('0x37')](handleEntityNotFound(_0x5cae78,null))[_0x8707('0x37')](function(_0x2bb8fe){if(_0x2bb8fe&&_0x2bb8fe[_0x8707('0xc1')]){_0x59aa1b=_0x2bb8fe['get']({'plain':!![]});if(_0x59aa1b['List']&&_0x59aa1b['List']['Contacts'][_0x8707('0x4b')]){return _0x59aa1b[_0x8707('0xc1')]['Contacts'][0x0];}return db[_0x8707('0x90')][_0x8707('0x58')](_[_0x8707('0x16')](_0x55eefe[_0x8707('0x59')],{'firstName':_0x5e0dd5,'mobile':_0x5e0dd5,'phone':_0x5e0dd5,'ListId':_0x59aa1b['ListId']}));}})[_0x8707('0x37')](handleEntityNotFound(_0x5cae78,null))[_0x8707('0x37')](function(_0x58ad6d){if(_0x58ad6d){_0x4148c6=_0x58ad6d;return db['WhatsappInteraction'][_0x8707('0x5e')]({'where':{'ContactId':_0x4148c6['id'],'closed':![],'WhatsappAccountId':_0x59aa1b['id']}})[_0x8707('0x37')](function(_0x22907e){if(_0x22907e){return[_0x22907e,![]];}return db[_0x8707('0xae')][_0x8707('0x58')]({'UserId':_0x55eefe[_0x8707('0x5a')]['id'],'ContactId':_0x4148c6['id'],'WhatsappAccountId':_0x59aa1b['id'],'phone':_0x5e0dd5,'firstMsgDirection':_0x8707('0xc2'),'Messages':[_[_0x8707('0x50')](_0x55eefe['body'],{'read':![],'body':_0x55eefe[_0x8707('0x59')][_0x8707('0x59')],'phone':_0x5e0dd5,'WhatsappAccountId':_0x59aa1b['id'],'UserId':_0x55eefe['user']['id'],'ContactId':_0x4148c6['id']})]},{'include':[{'model':db[_0x8707('0x8b')],'as':_0x8707('0xc3')}]})[_0x8707('0x37')](function(_0x44ca40){return[_0x44ca40,!![]];});});}})['spread'](function(_0x4457f1,_0x752c84){if(_0x752c84){return _0x4457f1;}return db['WhatsappMessage'][_0x8707('0x58')](_[_0x8707('0x50')](_0x55eefe[_0x8707('0x59')],{'read':![],'body':_0x55eefe['body']['body'],'phone':_0x5e0dd5,'WhatsappAccountId':_0x59aa1b['id'],'WhatsappInteractionId':_0x4457f1['id'],'UserId':_0x55eefe['user']['id'],'ContactId':_0x4148c6['id']}))[_0x8707('0x37')](function(_0x2f60aa){_0x4457f1[_0x8707('0xc4')][_0x8707('0xc3')]=[];_0x4457f1[_0x8707('0xc4')][_0x8707('0xc3')][_0x8707('0xc5')](_0x2f60aa[_0x8707('0xc4')]);return _0x4457f1;});})['then'](respondWithResult(_0x5cae78,null))['catch'](handleError(_0x5cae78,null));}; \ No newline at end of file +var _0x9ec0=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','params','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','nolimit','filter','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','User','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','WhatsappApplication','findAndCountAll','priority','finally','send','getApplications','whatsapp','Applications','account','statuses','state','read','WhatsappMessage','timestamp','message_id','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','From','replace','whatsapp:','Body','MessageSid','sinch','from','notifications','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','defaults','WhatsappInteraction','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','ContactId','UserId','Start','startRouting','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','text/xml','\x0a','to\x20is\x20mandatory','List','user','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','localhost','redis','./whatsappAccount.socket','register','jayson/promise','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','status','index','Pause','mandatoryDispositionPause','map','WhatsappAccount'];(function(_0x1c8125,_0x24490b){var _0x4852ff=function(_0x589b0b){while(--_0x589b0b){_0x1c8125['push'](_0x1c8125['shift']());}};_0x4852ff(++_0x24490b);}(_0x9ec0,0x154));var _0x09ec=function(_0x3f2327,_0x234948){_0x3f2327=_0x3f2327-0x0;var _0x34c873=_0x9ec0[_0x3f2327];return _0x34c873;};'use strict';var emlformat=require(_0x09ec('0x0'));var rimraf=require(_0x09ec('0x1'));var zipdir=require(_0x09ec('0x2'));var jsonpatch=require(_0x09ec('0x3'));var rp=require(_0x09ec('0x4'));var moment=require(_0x09ec('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x09ec('0x6'));var path=require(_0x09ec('0x7'));var sox=require(_0x09ec('0x8'));var csv=require(_0x09ec('0x9'));var ejs=require(_0x09ec('0xa'));var fs=require('fs');var fs_extra=require(_0x09ec('0xb'));var _=require(_0x09ec('0xc'));var squel=require(_0x09ec('0xd'));var crypto=require(_0x09ec('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x09ec('0x9'));var querystring=require(_0x09ec('0xf'));var Papa=require(_0x09ec('0x10'));var Redis=require(_0x09ec('0x11'));var authService=require(_0x09ec('0x12'));var qs=require(_0x09ec('0x13'));var as=require(_0x09ec('0x14'));var hardwareService=require(_0x09ec('0x15'));var logger=require(_0x09ec('0x16'))(_0x09ec('0x17'));var utils=require('../../config/utils');var config=require(_0x09ec('0x18'));var licenseUtil=require(_0x09ec('0x19'));var db=require(_0x09ec('0x1a'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x09ec('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x09ec('0x1c')]));require(_0x09ec('0x1d'))[_0x09ec('0x1e')](socket);var jayson=require(_0x09ec('0x1f'));var client=jayson[_0x09ec('0x20')][_0x09ec('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x301e3d,_0x181f90,_0x510fc9,_0x5792a9){return new BPromise(function(_0x58d10f,_0x17eac6){var _0x25b9ef=_0x5792a9||client;return _0x25b9ef[_0x09ec('0x22')](_0x301e3d,_0x510fc9)['then'](function(_0x1176d9){logger[_0x09ec('0x23')](_0x09ec('0x24'),_0x181f90,_0x09ec('0x25'));logger['debug'](_0x09ec('0x26'),_0x181f90,_0x09ec('0x25'),JSON[_0x09ec('0x27')](_0x1176d9));if(_0x1176d9[_0x09ec('0x28')]){if(_0x1176d9['error']['code']===0x1f4){logger[_0x09ec('0x28')](_0x09ec('0x24'),_0x181f90,_0x1176d9[_0x09ec('0x28')][_0x09ec('0x29')]);return _0x17eac6(_0x1176d9[_0x09ec('0x28')][_0x09ec('0x29')]);}logger[_0x09ec('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x181f90,_0x1176d9['error'][_0x09ec('0x29')]);return _0x58d10f(_0x1176d9[_0x09ec('0x28')][_0x09ec('0x29')]);}else{logger[_0x09ec('0x23')](_0x09ec('0x24'),_0x181f90,_0x09ec('0x25'));_0x58d10f(_0x1176d9[_0x09ec('0x2a')][_0x09ec('0x29')]);}})[_0x09ec('0x2b')](function(_0x4d2cf7){logger[_0x09ec('0x28')](_0x09ec('0x24'),_0x181f90,_0x4d2cf7);_0x17eac6(_0x4d2cf7);});});}function respondWithStatusCode(_0x16dd90,_0x4b2178){_0x4b2178=_0x4b2178||0xcc;return function(_0x12e812){if(_0x12e812){return _0x16dd90['sendStatus'](_0x4b2178);}return _0x16dd90['status'](_0x4b2178)[_0x09ec('0x2c')]();};}function respondWithResult(_0x4f0685,_0x10f744){_0x10f744=_0x10f744||0xc8;return function(_0x2a55bf){if(_0x2a55bf){return _0x4f0685['status'](_0x10f744)[_0x09ec('0x2d')](_0x2a55bf);}};}function respondWithFilteredResult(_0x533c5d,_0x29faf2){return function(_0x4d8663){if(_0x4d8663){var _0x38ecd8=typeof _0x29faf2['offset']==='undefined'&&typeof _0x29faf2[_0x09ec('0x2e')]===_0x09ec('0x2f');var _0xc8ba8e=_0x4d8663[_0x09ec('0x30')];var _0x2d451a=_0x38ecd8?0x0:_0x29faf2[_0x09ec('0x31')];var _0x50ff6e=_0x38ecd8?_0x4d8663[_0x09ec('0x30')]:_0x29faf2[_0x09ec('0x31')]+_0x29faf2[_0x09ec('0x2e')];var _0x82a4f3;if(_0x50ff6e>=_0xc8ba8e){_0x50ff6e=_0xc8ba8e;_0x82a4f3=0xc8;}else{_0x82a4f3=0xce;}_0x533c5d['status'](_0x82a4f3);return _0x533c5d[_0x09ec('0x32')](_0x09ec('0x33'),_0x2d451a+'-'+_0x50ff6e+'/'+_0xc8ba8e)[_0x09ec('0x2d')](_0x4d8663);}return null;};}function patchUpdates(_0x1315a7){return function(_0x203c75){try{jsonpatch[_0x09ec('0x34')](_0x203c75,_0x1315a7,!![]);}catch(_0x1314ca){return BPromise[_0x09ec('0x35')](_0x1314ca);}return _0x203c75[_0x09ec('0x36')]();};}function saveUpdates(_0x4c2ff8,_0x440e22){return function(_0x282bf7){if(_0x282bf7){return _0x282bf7[_0x09ec('0x37')](_0x4c2ff8)['then'](function(_0x2e6b91){return _0x2e6b91;});}return null;};}function removeEntity(_0x31b0ab,_0x1ab9b8){return function(_0x5969e0){if(_0x5969e0){return _0x5969e0[_0x09ec('0x38')]()[_0x09ec('0x39')](function(){var _0x1dd8ca=_0x5969e0[_0x09ec('0x3a')]({'plain':!![]});var _0x425778=_0x09ec('0x3b');return db[_0x09ec('0x3c')][_0x09ec('0x38')]({'where':{'type':_0x425778,'resourceId':_0x1dd8ca['id']}})[_0x09ec('0x39')](function(){return _0x5969e0;});})[_0x09ec('0x39')](function(){_0x31b0ab['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c3139,_0xb74f1d){return function(_0x53c33a){if(!_0x53c33a){_0x5c3139[_0x09ec('0x3d')](0x194);}return _0x53c33a;};}function handleError(_0x2bc236,_0x3ee677){_0x3ee677=_0x3ee677||0x1f4;return function(_0x2cd4b2){logger[_0x09ec('0x28')](_0x2cd4b2[_0x09ec('0x3e')]);if(_0x2cd4b2[_0x09ec('0x3f')]){delete _0x2cd4b2[_0x09ec('0x3f')];}_0x2bc236[_0x09ec('0x40')](_0x3ee677)['send'](_0x2cd4b2);};}exports[_0x09ec('0x41')]=function(_0x578a40,_0x48047f){var _0x39881e={'include':[{'model':db[_0x09ec('0x42')],'as':_0x09ec('0x43')}]},_0x4363dd={},_0x5999b={'count':0x0,'rows':[]};var _0x3ac31f=_[_0x09ec('0x44')](db[_0x09ec('0x45')][_0x09ec('0x46')],function(_0x2b8f0c){return{'name':_0x2b8f0c[_0x09ec('0x47')],'type':_0x2b8f0c[_0x09ec('0x48')][_0x09ec('0x49')]};});_0x4363dd[_0x09ec('0x4a')]=_[_0x09ec('0x44')](_0x3ac31f,_0x09ec('0x3f'));_0x4363dd[_0x09ec('0x4b')]=_[_0x09ec('0x4c')](_0x578a40[_0x09ec('0x4b')]);_0x4363dd[_0x09ec('0x4d')]=_[_0x09ec('0x4e')](_0x4363dd['model'],_0x4363dd[_0x09ec('0x4b')]);_0x39881e[_0x09ec('0x4f')]=_[_0x09ec('0x4e')](_0x4363dd[_0x09ec('0x4a')],qs[_0x09ec('0x50')](_0x578a40['query'][_0x09ec('0x50')]));_0x39881e['attributes']=_0x39881e['attributes'][_0x09ec('0x51')]?_0x39881e[_0x09ec('0x4f')]:_0x4363dd[_0x09ec('0x4a')];if(!_0x578a40['query'][_0x09ec('0x52')]('nolimit')){_0x39881e[_0x09ec('0x2e')]=qs[_0x09ec('0x2e')](_0x578a40['query']['limit']);_0x39881e[_0x09ec('0x31')]=qs[_0x09ec('0x31')](_0x578a40[_0x09ec('0x4b')][_0x09ec('0x31')]);}_0x39881e[_0x09ec('0x53')]=qs['sort'](_0x578a40[_0x09ec('0x4b')][_0x09ec('0x54')]);_0x39881e[_0x09ec('0x55')]=qs[_0x09ec('0x4d')](_[_0x09ec('0x56')](_0x578a40[_0x09ec('0x4b')],_0x4363dd['filters']),_0x3ac31f);if(_0x578a40[_0x09ec('0x4b')]['filter']){_0x39881e[_0x09ec('0x55')]=_[_0x09ec('0x57')](_0x39881e[_0x09ec('0x55')],{'$or':_['map'](_0x3ac31f,function(_0x368225){if(_0x368225[_0x09ec('0x48')]!==_0x09ec('0x58')){var _0xba5b12={};_0xba5b12[_0x368225[_0x09ec('0x3f')]]={'$like':'%'+_0x578a40[_0x09ec('0x4b')]['filter']+'%'};return _0xba5b12;}})});}_0x39881e=_[_0x09ec('0x57')]({},_0x39881e,_0x578a40[_0x09ec('0x59')]);var _0x33df6c={'where':_0x39881e[_0x09ec('0x55')]};return db['WhatsappAccount'][_0x09ec('0x30')](_0x33df6c)[_0x09ec('0x39')](function(_0x103546){_0x5999b[_0x09ec('0x30')]=_0x103546;if(_0x578a40['query'][_0x09ec('0x5a')]){_0x39881e[_0x09ec('0x5b')]=[{'all':!![]}];}return db[_0x09ec('0x45')]['findAll'](_0x39881e);})[_0x09ec('0x39')](function(_0x2a781d){_0x5999b[_0x09ec('0x5c')]=_0x2a781d;return _0x5999b;})[_0x09ec('0x39')](respondWithFilteredResult(_0x48047f,_0x39881e))[_0x09ec('0x2b')](handleError(_0x48047f,null));};exports['show']=function(_0x335c57,_0x63cd7c){var _0x37f26b={'raw':![],'where':{'id':_0x335c57[_0x09ec('0x5d')]['id']},'include':[{'model':db[_0x09ec('0x42')],'as':_0x09ec('0x43')}]},_0x217cab={};_0x217cab['model']=_[_0x09ec('0x4c')](db[_0x09ec('0x45')]['rawAttributes']);_0x217cab['query']=_[_0x09ec('0x4c')](_0x335c57[_0x09ec('0x4b')]);_0x217cab[_0x09ec('0x4d')]=_[_0x09ec('0x4e')](_0x217cab[_0x09ec('0x4a')],_0x217cab['query']);_0x37f26b[_0x09ec('0x4f')]=_[_0x09ec('0x4e')](_0x217cab[_0x09ec('0x4a')],qs[_0x09ec('0x50')](_0x335c57[_0x09ec('0x4b')][_0x09ec('0x50')]));_0x37f26b['attributes']=_0x37f26b[_0x09ec('0x4f')]['length']?_0x37f26b[_0x09ec('0x4f')]:_0x217cab['model'];if(_0x335c57['query']['includeAll']){_0x37f26b[_0x09ec('0x5b')]=[{'all':!![]}];}_0x37f26b=_[_0x09ec('0x57')]({},_0x37f26b,_0x335c57[_0x09ec('0x59')]);return db[_0x09ec('0x45')]['find'](_0x37f26b)[_0x09ec('0x39')](handleEntityNotFound(_0x63cd7c,null))[_0x09ec('0x39')](respondWithResult(_0x63cd7c,null))[_0x09ec('0x2b')](handleError(_0x63cd7c,null));};exports[_0x09ec('0x5e')]=function(_0x5218d0,_0x11b496){return db[_0x09ec('0x45')][_0x09ec('0x5e')](_0x5218d0['body'],{})[_0x09ec('0x39')](function(_0x313bb8){var _0x3a50ec=_0x5218d0['user'][_0x09ec('0x3a')]({'plain':!![]});if(!_0x3a50ec)throw new Error(_0x09ec('0x5f'));if(_0x3a50ec['role']==='user'){var _0x2dbc11=_0x313bb8['get']({'plain':!![]});var _0x3ccaad=_0x09ec('0x3b');return db[_0x09ec('0x60')][_0x09ec('0x61')]({'where':{'name':_0x3ccaad,'userProfileId':_0x3a50ec[_0x09ec('0x62')]},'raw':!![]})['then'](function(_0x3b1162){if(_0x3b1162&&_0x3b1162[_0x09ec('0x63')]===0x0){return db[_0x09ec('0x3c')][_0x09ec('0x5e')]({'name':_0x2dbc11[_0x09ec('0x3f')],'resourceId':_0x2dbc11['id'],'type':_0x3b1162[_0x09ec('0x3f')],'sectionId':_0x3b1162['id']},{})[_0x09ec('0x39')](function(){return _0x313bb8;});}else{return _0x313bb8;}})['catch'](function(_0x489204){logger[_0x09ec('0x28')](_0x09ec('0x64'),_0x489204);throw _0x489204;});}return _0x313bb8;})[_0x09ec('0x39')](respondWithResult(_0x11b496,0xc9))[_0x09ec('0x2b')](handleError(_0x11b496,null));};exports[_0x09ec('0x37')]=function(_0x2a323c,_0x21ce52){if(_0x2a323c[_0x09ec('0x65')]['id']){delete _0x2a323c[_0x09ec('0x65')]['id'];}return db[_0x09ec('0x45')][_0x09ec('0x61')]({'where':{'id':_0x2a323c[_0x09ec('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0x09ec('0x43')}]})[_0x09ec('0x39')](handleEntityNotFound(_0x21ce52,null))[_0x09ec('0x39')](saveUpdates(_0x2a323c[_0x09ec('0x65')],null))[_0x09ec('0x39')](respondWithResult(_0x21ce52,null))[_0x09ec('0x2b')](handleError(_0x21ce52,null));};exports[_0x09ec('0x38')]=function(_0x1cac45,_0x5b9547){return db['WhatsappAccount'][_0x09ec('0x61')]({'where':{'id':_0x1cac45[_0x09ec('0x5d')]['id']}})[_0x09ec('0x39')](handleEntityNotFound(_0x5b9547,null))[_0x09ec('0x39')](removeEntity(_0x5b9547,null))[_0x09ec('0x2b')](handleError(_0x5b9547,null));};exports[_0x09ec('0x66')]=function(_0x2b23e0,_0x452e59){return db['WhatsappAccount']['describe']()['then'](respondWithResult(_0x452e59,null))[_0x09ec('0x2b')](handleError(_0x452e59,null));};exports[_0x09ec('0x67')]=function(_0x22710b,_0x443fff,_0x872284){if(_0x22710b[_0x09ec('0x65')]['id']){delete _0x22710b[_0x09ec('0x65')]['id'];}return db[_0x09ec('0x45')][_0x09ec('0x61')]({'where':{'id':_0x22710b[_0x09ec('0x5d')]['id']}})['then'](handleEntityNotFound(_0x443fff,null))[_0x09ec('0x39')](function(_0x28f5e6){if(_0x28f5e6){_0x22710b[_0x09ec('0x65')][_0x09ec('0x68')]=_0x28f5e6['id'];return db[_0x09ec('0x69')]['create'](_0x22710b[_0x09ec('0x65')]);}})[_0x09ec('0x39')](respondWithResult(_0x443fff,null))[_0x09ec('0x2b')](handleError(_0x443fff,null));};exports[_0x09ec('0x6a')]=function(_0x2d6fe9,_0x3ce17a,_0x248e75){var _0x599291={'raw':![],'where':{}};var _0x57ec8d={};var _0x4e50aa={'count':0x0,'rows':[]};return db[_0x09ec('0x45')][_0x09ec('0x6b')]({'where':{'id':_0x2d6fe9[_0x09ec('0x5d')]['id']}})[_0x09ec('0x39')](handleEntityNotFound(_0x3ce17a,null))[_0x09ec('0x39')](function(_0x23cc76){if(_0x23cc76){_0x57ec8d[_0x09ec('0x4a')]=_[_0x09ec('0x4c')](db[_0x09ec('0x69')][_0x09ec('0x46')]);_0x57ec8d[_0x09ec('0x4b')]=_[_0x09ec('0x4c')](_0x2d6fe9['query']);_0x57ec8d[_0x09ec('0x4d')]=_[_0x09ec('0x4e')](_0x57ec8d[_0x09ec('0x4a')],_0x57ec8d['query']);_0x599291[_0x09ec('0x4f')]=_[_0x09ec('0x4e')](_0x57ec8d[_0x09ec('0x4a')],qs['fields'](_0x2d6fe9[_0x09ec('0x4b')][_0x09ec('0x50')]));_0x599291[_0x09ec('0x4f')]=_0x599291[_0x09ec('0x4f')][_0x09ec('0x51')]?_0x599291['attributes']:_0x57ec8d[_0x09ec('0x4a')];if(!_0x2d6fe9[_0x09ec('0x4b')][_0x09ec('0x52')](_0x09ec('0x6c'))){_0x599291[_0x09ec('0x2e')]=qs[_0x09ec('0x2e')](_0x2d6fe9[_0x09ec('0x4b')][_0x09ec('0x2e')]);_0x599291['offset']=qs['offset'](_0x2d6fe9[_0x09ec('0x4b')][_0x09ec('0x31')]);}_0x599291[_0x09ec('0x53')]=qs[_0x09ec('0x54')](_0x2d6fe9[_0x09ec('0x4b')][_0x09ec('0x54')]);_0x599291[_0x09ec('0x55')]=qs[_0x09ec('0x4d')](_[_0x09ec('0x56')](_0x2d6fe9[_0x09ec('0x4b')],_0x57ec8d[_0x09ec('0x4d')]));_0x599291['where'][_0x09ec('0x68')]=_0x23cc76['id'];if(_0x2d6fe9['query'][_0x09ec('0x6d')]){_0x599291[_0x09ec('0x55')]=_[_0x09ec('0x57')](_0x599291[_0x09ec('0x55')],{'$or':_[_0x09ec('0x44')](_0x599291[_0x09ec('0x4f')],function(_0x29d7cb){var _0x18e570={};_0x18e570[_0x29d7cb]={'$like':'%'+_0x2d6fe9['query']['filter']+'%'};return _0x18e570;})});}_0x599291=_[_0x09ec('0x57')]({},_0x599291,_0x2d6fe9[_0x09ec('0x59')]);return db[_0x09ec('0x69')][_0x09ec('0x30')]({'where':_0x599291['where']})[_0x09ec('0x39')](function(_0x3e91ed){_0x4e50aa['count']=_0x3e91ed;if(_0x2d6fe9[_0x09ec('0x4b')]['includeAll']){_0x599291[_0x09ec('0x5b')]=[{'all':!![]}];}return db[_0x09ec('0x69')][_0x09ec('0x6e')](_0x599291);})['then'](function(_0x51767c){_0x4e50aa[_0x09ec('0x5c')]=_0x51767c;return _0x4e50aa;});}})[_0x09ec('0x39')](respondWithFilteredResult(_0x3ce17a,_0x599291))[_0x09ec('0x2b')](handleError(_0x3ce17a,null));};exports[_0x09ec('0x6f')]=function(_0x15e756,_0x10e46f,_0x27a750){return db[_0x09ec('0x45')][_0x09ec('0x61')]({'where':{'id':_0x15e756[_0x09ec('0x5d')]['id']}})[_0x09ec('0x39')](handleEntityNotFound(_0x10e46f,null))['then'](function(_0x14b7b2){if(_0x14b7b2){return _0x14b7b2[_0x09ec('0x6f')](_0x15e756[_0x09ec('0x4b')][_0x09ec('0x70')]);}})[_0x09ec('0x39')](respondWithStatusCode(_0x10e46f,null))[_0x09ec('0x2b')](handleError(_0x10e46f,null));};exports[_0x09ec('0x71')]=function(_0x2aeb9c,_0x352239,_0x29f4fd){if(_0x2aeb9c[_0x09ec('0x65')]['id']){delete _0x2aeb9c[_0x09ec('0x65')]['id'];}return db[_0x09ec('0x45')][_0x09ec('0x61')]({'where':{'id':_0x2aeb9c[_0x09ec('0x5d')]['id']}})['then'](handleEntityNotFound(_0x352239,null))[_0x09ec('0x39')](function(_0x5bdcf2){if(_0x5bdcf2){_0x2aeb9c[_0x09ec('0x65')][_0x09ec('0x68')]=_0x5bdcf2['id'];return db[_0x09ec('0x72')]['create'](_0x2aeb9c[_0x09ec('0x65')]);}})[_0x09ec('0x39')](respondWithResult(_0x352239,null))[_0x09ec('0x2b')](handleError(_0x352239,null));};exports['getAnswers']=function(_0x437799,_0x38205e,_0x2b47b3){var _0x47ebc4={'raw':![],'where':{}};var _0x5c05f7={};var _0x37854c={'count':0x0,'rows':[]};return db[_0x09ec('0x45')][_0x09ec('0x6b')]({'where':{'id':_0x437799[_0x09ec('0x5d')]['id']}})[_0x09ec('0x39')](handleEntityNotFound(_0x38205e,null))[_0x09ec('0x39')](function(_0x425ebd){if(_0x425ebd){_0x5c05f7[_0x09ec('0x4a')]=_['keys'](db[_0x09ec('0x72')]['rawAttributes']);_0x5c05f7['query']=_[_0x09ec('0x4c')](_0x437799[_0x09ec('0x4b')]);_0x5c05f7[_0x09ec('0x4d')]=_['intersection'](_0x5c05f7['model'],_0x5c05f7[_0x09ec('0x4b')]);_0x47ebc4[_0x09ec('0x4f')]=_[_0x09ec('0x4e')](_0x5c05f7[_0x09ec('0x4a')],qs['fields'](_0x437799[_0x09ec('0x4b')]['fields']));_0x47ebc4[_0x09ec('0x4f')]=_0x47ebc4[_0x09ec('0x4f')][_0x09ec('0x51')]?_0x47ebc4[_0x09ec('0x4f')]:_0x5c05f7[_0x09ec('0x4a')];if(!_0x437799[_0x09ec('0x4b')][_0x09ec('0x52')](_0x09ec('0x6c'))){_0x47ebc4[_0x09ec('0x2e')]=qs[_0x09ec('0x2e')](_0x437799[_0x09ec('0x4b')][_0x09ec('0x2e')]);_0x47ebc4[_0x09ec('0x31')]=qs[_0x09ec('0x31')](_0x437799[_0x09ec('0x4b')]['offset']);}_0x47ebc4[_0x09ec('0x53')]=qs[_0x09ec('0x54')](_0x437799['query']['sort']);_0x47ebc4[_0x09ec('0x55')]=qs[_0x09ec('0x4d')](_[_0x09ec('0x56')](_0x437799[_0x09ec('0x4b')],_0x5c05f7[_0x09ec('0x4d')]));_0x47ebc4[_0x09ec('0x55')][_0x09ec('0x68')]=_0x425ebd['id'];if(_0x437799[_0x09ec('0x4b')][_0x09ec('0x6d')]){_0x47ebc4[_0x09ec('0x55')]=_['merge'](_0x47ebc4[_0x09ec('0x55')],{'$or':_['map'](_0x47ebc4['attributes'],function(_0x2e8500){var _0x561f5e={};_0x561f5e[_0x2e8500]={'$like':'%'+_0x437799[_0x09ec('0x4b')][_0x09ec('0x6d')]+'%'};return _0x561f5e;})});}_0x47ebc4=_[_0x09ec('0x57')]({},_0x47ebc4,_0x437799[_0x09ec('0x59')]);return db[_0x09ec('0x72')]['count']({'where':_0x47ebc4[_0x09ec('0x55')]})[_0x09ec('0x39')](function(_0x28415c){_0x37854c[_0x09ec('0x30')]=_0x28415c;if(_0x437799[_0x09ec('0x4b')][_0x09ec('0x5a')]){_0x47ebc4[_0x09ec('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x09ec('0x6e')](_0x47ebc4);})[_0x09ec('0x39')](function(_0x42fc18){_0x37854c[_0x09ec('0x5c')]=_0x42fc18;return _0x37854c;});}})['then'](respondWithFilteredResult(_0x38205e,_0x47ebc4))[_0x09ec('0x2b')](handleError(_0x38205e,null));};exports['removeAnswers']=function(_0x2177fe,_0x152288,_0x4e552f){return db[_0x09ec('0x45')]['find']({'where':{'id':_0x2177fe[_0x09ec('0x5d')]['id']}})[_0x09ec('0x39')](handleEntityNotFound(_0x152288,null))[_0x09ec('0x39')](function(_0x53a865){if(_0x53a865){return _0x53a865[_0x09ec('0x73')](_0x2177fe[_0x09ec('0x4b')][_0x09ec('0x70')]);}})[_0x09ec('0x39')](respondWithStatusCode(_0x152288,null))['catch'](handleError(_0x152288,null));};exports[_0x09ec('0x74')]=function(_0x359a88,_0x5aadf0,_0x56ccbf){return db[_0x09ec('0x45')]['find']({'where':{'id':_0x359a88[_0x09ec('0x5d')]['id']}})[_0x09ec('0x39')](handleEntityNotFound(_0x5aadf0,null))[_0x09ec('0x39')](function(_0x5f1fff){if(_0x5f1fff){return _0x5f1fff[_0x09ec('0x74')](_0x359a88[_0x09ec('0x65')]['ids'],_[_0x09ec('0x75')](_0x359a88[_0x09ec('0x65')],[_0x09ec('0x70'),'id'])||{})[_0x09ec('0x76')](function(_0x57faa7){for(var _0x41a46d=0x0;_0x41a46d<_0x359a88['body']['ids'][_0x09ec('0x51')];_0x41a46d+=0x1){socket[_0x09ec('0x77')](_0x09ec('0x78'),{'UserId':Number(_0x359a88[_0x09ec('0x65')][_0x09ec('0x70')][_0x41a46d]),'WhatsappAccountId':Number(_0x359a88[_0x09ec('0x5d')]['id'])});}return _0x57faa7;});}})['then'](respondWithResult(_0x5aadf0,null))[_0x09ec('0x2b')](handleError(_0x5aadf0,null));};exports[_0x09ec('0x79')]=function(_0x366716,_0x1c20cb,_0x4db8e3){return db[_0x09ec('0x45')][_0x09ec('0x61')]({'where':{'id':_0x366716[_0x09ec('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1c20cb,null))['then'](function(_0x11a981){if(_0x11a981){return _0x11a981['removeAgents'](_0x366716[_0x09ec('0x4b')][_0x09ec('0x70')])[_0x09ec('0x39')](function(){if(_[_0x09ec('0x7a')](_0x366716[_0x09ec('0x4b')]['ids'])){for(var _0x34428c=0x0;_0x34428c<_0x366716['query'][_0x09ec('0x70')][_0x09ec('0x51')];_0x34428c+=0x1){socket[_0x09ec('0x77')]('userWhatsappAccount:remove',{'UserId':Number(_0x366716[_0x09ec('0x4b')][_0x09ec('0x70')][_0x34428c]),'WhatsappAccountId':Number(_0x366716[_0x09ec('0x5d')]['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x366716['query'][_0x09ec('0x70')]),'WhatsappAccountId':Number(_0x366716[_0x09ec('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x1c20cb,null))[_0x09ec('0x2b')](handleError(_0x1c20cb,null));};exports['getAgents']=function(_0x3a834a,_0x323f30,_0x56f152){var _0x50fcdc={};var _0x57fd32={};var _0x94cf3f;var _0x54a5f0;return db[_0x09ec('0x45')]['findOne']({'where':{'id':_0x3a834a['params']['id']}})[_0x09ec('0x39')](handleEntityNotFound(_0x323f30,null))[_0x09ec('0x39')](function(_0x414525){if(_0x414525){_0x94cf3f=_0x414525;_0x57fd32['model']=_[_0x09ec('0x4c')](db[_0x09ec('0x7b')]['rawAttributes']);_0x57fd32[_0x09ec('0x4b')]=_[_0x09ec('0x4c')](_0x3a834a['query']);_0x57fd32[_0x09ec('0x4d')]=_[_0x09ec('0x4e')](_0x57fd32[_0x09ec('0x4a')],_0x57fd32[_0x09ec('0x4b')]);_0x50fcdc[_0x09ec('0x4f')]=_['intersection'](_0x57fd32[_0x09ec('0x4a')],qs[_0x09ec('0x50')](_0x3a834a[_0x09ec('0x4b')][_0x09ec('0x50')]));_0x50fcdc[_0x09ec('0x4f')]=_0x50fcdc['attributes'][_0x09ec('0x51')]?_0x50fcdc['attributes']:_0x57fd32['model'];_0x50fcdc['order']=qs[_0x09ec('0x54')](_0x3a834a[_0x09ec('0x4b')][_0x09ec('0x54')]);_0x50fcdc[_0x09ec('0x55')]=qs['filters'](_[_0x09ec('0x56')](_0x3a834a[_0x09ec('0x4b')],_0x57fd32[_0x09ec('0x4d')]));if(_0x3a834a['query'][_0x09ec('0x6d')]){_0x50fcdc['where']=_[_0x09ec('0x57')](_0x50fcdc[_0x09ec('0x55')],{'$or':_[_0x09ec('0x44')](_0x50fcdc[_0x09ec('0x4f')],function(_0x2f8cba){var _0x14136f={};_0x14136f[_0x2f8cba]={'$like':'%'+_0x3a834a['query'][_0x09ec('0x6d')]+'%'};return _0x14136f;})});}_0x50fcdc=_[_0x09ec('0x57')]({},_0x50fcdc,_0x3a834a[_0x09ec('0x59')]);return _0x94cf3f[_0x09ec('0x7c')](_0x50fcdc);}})[_0x09ec('0x39')](function(_0x5923f0){if(_0x5923f0){_0x54a5f0=_0x5923f0['length'];if(!_0x3a834a[_0x09ec('0x4b')][_0x09ec('0x52')](_0x09ec('0x6c'))){_0x50fcdc[_0x09ec('0x2e')]=qs[_0x09ec('0x2e')](_0x3a834a[_0x09ec('0x4b')][_0x09ec('0x2e')]);_0x50fcdc[_0x09ec('0x31')]=qs[_0x09ec('0x31')](_0x3a834a[_0x09ec('0x4b')][_0x09ec('0x31')]);}return _0x94cf3f[_0x09ec('0x7c')](_0x50fcdc);}})[_0x09ec('0x39')](function(_0x3b9c67){if(_0x3b9c67){return _0x3b9c67?{'count':_0x54a5f0,'rows':_0x3b9c67}:null;}})[_0x09ec('0x39')](respondWithResult(_0x323f30,null))[_0x09ec('0x2b')](handleError(_0x323f30,null));};exports[_0x09ec('0x7d')]=function(_0x35ed13,_0x44d384){var _0x4e6822=_0x35ed13[_0x09ec('0x5d')]['id'];var _0x16dd6a=_0x35ed13['body'];var _0x2d7686=0xc8;var _0x2408bc=null;return db[_0x09ec('0x7e')][_0x09ec('0x7f')]({'isolationLevel':db[_0x09ec('0x7e')][_0x09ec('0x80')][_0x09ec('0x81')]['READ_COMMITTED']},function(_0x366fa5){return db[_0x09ec('0x45')][_0x09ec('0x6b')]({'where':{'id':_0x4e6822},'transaction':_0x366fa5})[_0x09ec('0x39')](function(_0x2b8cac){if(_0x2b8cac){return db['WhatsappApplication'][_0x09ec('0x38')]({'where':{'WhatsappAccountId':_0x4e6822},'transaction':_0x366fa5})[_0x09ec('0x39')](function(){var _0x25860f=_['map'](_0x16dd6a,function(_0x479217){_0x479217[_0x09ec('0x68')]=_0x4e6822;return _0x479217;});return db['WhatsappApplication'][_0x09ec('0x82')](_0x25860f,{'transaction':_0x366fa5});});}else{_0x2d7686=0x194;_0x2408bc=[];}});})['then'](function(){if(_0x2d7686!==0x194){return db[_0x09ec('0x83')][_0x09ec('0x84')]({'where':{'WhatsappAccountId':_0x4e6822},'order':_0x09ec('0x85')})['then'](function(_0x26fcbf){_0x2408bc=_0x26fcbf;});}})['catch'](function(_0x289ede){_0x2d7686=0x1f4;logger[_0x09ec('0x28')](_0x289ede['stack']);if(_0x289ede[_0x09ec('0x3f')]){delete _0x289ede['name'];}_0x2408bc=_0x289ede;})[_0x09ec('0x86')](function(){if(_0x2408bc===null){_0x44d384['sendStatus'](_0x2d7686);}else{if(_0x2d7686===0x1f4){_0x44d384[_0x09ec('0x40')](_0x2d7686)[_0x09ec('0x87')](_0x2408bc);}else{_0x44d384['status'](_0x2d7686)['json'](_0x2408bc);}}});};exports['getApplications']=function(_0x5713a7,_0x4aff9d,_0x2f34ba){var _0x29c385={};var _0x4e379b={};var _0x45af1e;var _0x507bd9;return db[_0x09ec('0x45')]['findOne']({'where':{'id':_0x5713a7[_0x09ec('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4aff9d,null))[_0x09ec('0x39')](function(_0x321b87){if(_0x321b87){_0x45af1e=_0x321b87;_0x4e379b[_0x09ec('0x4a')]=_['keys'](db[_0x09ec('0x83')][_0x09ec('0x46')]);_0x4e379b[_0x09ec('0x4b')]=_['keys'](_0x5713a7['query']);_0x4e379b[_0x09ec('0x4d')]=_['intersection'](_0x4e379b[_0x09ec('0x4a')],_0x4e379b[_0x09ec('0x4b')]);_0x29c385[_0x09ec('0x4f')]=_[_0x09ec('0x4e')](_0x4e379b[_0x09ec('0x4a')],qs[_0x09ec('0x50')](_0x5713a7[_0x09ec('0x4b')]['fields']));_0x29c385[_0x09ec('0x4f')]=_0x29c385[_0x09ec('0x4f')][_0x09ec('0x51')]?_0x29c385[_0x09ec('0x4f')]:_0x4e379b[_0x09ec('0x4a')];_0x29c385[_0x09ec('0x53')]=qs[_0x09ec('0x54')](_0x5713a7[_0x09ec('0x4b')][_0x09ec('0x54')]);_0x29c385[_0x09ec('0x55')]=qs[_0x09ec('0x4d')](_['pick'](_0x5713a7['query'],_0x4e379b['filters']));if(_0x5713a7[_0x09ec('0x4b')][_0x09ec('0x6d')]){_0x29c385['where']=_[_0x09ec('0x57')](_0x29c385[_0x09ec('0x55')],{'$or':_[_0x09ec('0x44')](_0x29c385[_0x09ec('0x4f')],function(_0x366d1c){var _0x32c87f={};_0x32c87f[_0x366d1c]={'$like':'%'+_0x5713a7[_0x09ec('0x4b')]['filter']+'%'};return _0x32c87f;})});}_0x29c385=_[_0x09ec('0x57')]({},_0x29c385,_0x5713a7[_0x09ec('0x59')]);return _0x45af1e[_0x09ec('0x88')](_0x29c385);}})[_0x09ec('0x39')](function(_0x3a3fc9){if(_0x3a3fc9){_0x507bd9=_0x3a3fc9[_0x09ec('0x51')];if(!_0x5713a7[_0x09ec('0x4b')][_0x09ec('0x52')](_0x09ec('0x6c'))){_0x29c385[_0x09ec('0x2e')]=qs['limit'](_0x5713a7[_0x09ec('0x4b')][_0x09ec('0x2e')]);_0x29c385[_0x09ec('0x31')]=qs[_0x09ec('0x31')](_0x5713a7[_0x09ec('0x4b')][_0x09ec('0x31')]);}return _0x45af1e[_0x09ec('0x88')](_0x29c385);}})[_0x09ec('0x39')](function(_0x289738){if(_0x289738){return _0x289738?{'count':_0x507bd9,'rows':_0x289738}:null;}})[_0x09ec('0x39')](respondWithResult(_0x4aff9d,null))[_0x09ec('0x2b')](handleError(_0x4aff9d,null));};exports['notify']=function(_0x563f49,_0x54aaad,_0x5ba449){var _0x15c73b={'channel':_0x09ec('0x89')};var _0x3731f3=[];var _0x4f6d16=[];var _0x51259b={};return db['WhatsappAccount'][_0x09ec('0x61')]({'where':{'id':_0x563f49[_0x09ec('0x5d')]['id']},'include':[{'model':db[_0x09ec('0x83')],'as':_0x09ec('0x8a')}]})['then'](handleEntityNotFound(_0x54aaad,null))['then'](function(_0x5f4a5c){_0x15c73b['account']=_0x5f4a5c;if(_0x15c73b[_0x09ec('0x8b')]&&_0x15c73b[_0x09ec('0x8b')]['type']==='sinch'&&_0x563f49[_0x09ec('0x65')][_0x09ec('0x8c')]){if(_0x563f49[_0x09ec('0x65')][_0x09ec('0x8c')][_0x09ec('0x51')]===0x0)return;if(_0x563f49[_0x09ec('0x65')][_0x09ec('0x8c')][0x0][_0x09ec('0x8d')]!==_0x09ec('0x8e'))return;return db[_0x09ec('0x8f')]['update']({'read':!![],'readAt':_0x563f49[_0x09ec('0x65')]['statuses'][0x0][_0x09ec('0x90')]},{'where':{'messageId':_0x563f49['body'][_0x09ec('0x8c')][0x0][_0x09ec('0x91')]},'individualHooks':!![]})[_0x09ec('0x39')](function(_0x23e9e1){return _0x54aaad['status'](0xc8)[_0x09ec('0x2d')](_0x23e9e1);});}_0x15c73b['applications']=_[_0x09ec('0x92')](_0x5f4a5c[_0x09ec('0x8a')],[_0x09ec('0x85')],[_0x09ec('0x93')]);if(_0x15c73b[_0x09ec('0x8b')][_0x09ec('0x8a')]){delete _0x15c73b[_0x09ec('0x8b')][_0x09ec('0x8a')];}return db[_0x09ec('0x94')][_0x09ec('0x66')]()[_0x09ec('0x39')](function(_0x4d04c7){if(!_0x4d04c7){throw new db[(_0x09ec('0x95'))][(_0x09ec('0x96'))](_0x09ec('0x97'));}_0x3731f3=_[_0x09ec('0x98')](_[_0x09ec('0x4c')](_0x4d04c7),[_0x09ec('0x99'),_0x09ec('0x9a')]);_0x4f6d16=_[_0x09ec('0x98')](_[_0x09ec('0x4c')](_0x4d04c7),[_0x09ec('0x99'),_0x09ec('0x9a'),_0x09ec('0x9b'),_0x09ec('0x9c')]);_0x15c73b[_0x09ec('0x65')]={'mapKey':_0x09ec('0x9d')};if(_0x15c73b['account']&&_0x15c73b[_0x09ec('0x8b')][_0x09ec('0x48')]==='twilio'){_0x15c73b[_0x09ec('0x65')]['from']=_0x563f49[_0x09ec('0x65')][_0x09ec('0x9e')][_0x09ec('0x9f')](_0x09ec('0xa0'),'');_0x15c73b[_0x09ec('0x65')][_0x09ec('0x65')]=_0x563f49[_0x09ec('0x65')][_0x09ec('0xa1')];_0x15c73b[_0x09ec('0x65')]['messageId']=_0x563f49[_0x09ec('0x65')][_0x09ec('0xa2')];}if(_0x15c73b[_0x09ec('0x8b')]&&_0x15c73b[_0x09ec('0x8b')][_0x09ec('0x48')]===_0x09ec('0xa3')){_0x15c73b[_0x09ec('0x65')][_0x09ec('0xa4')]=_0x563f49[_0x09ec('0x65')]['notifications'][0x0][_0x09ec('0xa4')];_0x15c73b[_0x09ec('0x65')][_0x09ec('0x65')]=_0x563f49['body'][_0x09ec('0xa5')][0x0]['message'][_0x09ec('0x65')];_0x15c73b[_0x09ec('0x65')][_0x09ec('0xa6')]=_0x563f49[_0x09ec('0x65')][_0x09ec('0xa5')][0x0][_0x09ec('0x91')];}if(_0x15c73b['body']['id']){delete _0x15c73b['body']['id'];}if(_[_0x09ec('0xa7')](_0x15c73b[_0x09ec('0x65')][_0x09ec('0xa4')])){throw new db[(_0x09ec('0x95'))]['ValidationError'](_0x09ec('0xa8'));}if(_['isNil'](_0x15c73b[_0x09ec('0x65')][_0x09ec('0x65')])||_0x15c73b[_0x09ec('0x65')]['body']===''){throw new db[(_0x09ec('0x95'))][(_0x09ec('0x96'))](_0x09ec('0xa9'));}if(_[_0x09ec('0xa7')](_0x15c73b['body'][_0x09ec('0xaa')])){throw new db['Sequelize'][(_0x09ec('0x96'))](_0x09ec('0xab')+_0x4f6d16);}if(!_[_0x09ec('0xac')](_0x4f6d16,_0x15c73b[_0x09ec('0x65')][_0x09ec('0xaa')])){throw new db['Sequelize']['ValidationError'](_0x09ec('0xad')+_0x4f6d16);}_0x51259b[_0x15c73b[_0x09ec('0x65')]['mapKey']]=_0x15c73b[_0x09ec('0x65')][_0x09ec('0xa4')];return db[_0x09ec('0xae')][_0x09ec('0x61')]({'where':{'id':_0x15c73b[_0x09ec('0x8b')][_0x09ec('0x9c')]},'include':[{'model':db[_0x09ec('0x94')],'as':_0x09ec('0xaf'),'where':_0x51259b,'limit':0x1,'order':[['updatedAt',_0x09ec('0xb0')]]}]});})[_0x09ec('0x39')](handleEntityNotFound(_0x54aaad,null))[_0x09ec('0x39')](function(_0x4d3019){if(_0x4d3019){_0x15c73b[_0x09ec('0xb1')]=_[_0x09ec('0x75')](_0x4d3019,[_0x09ec('0xaf')]);if(_0x4d3019[_0x09ec('0xaf')][_0x09ec('0x51')]){return _0x4d3019[_0x09ec('0xaf')][0x0];}var _0x1bf884=_[_0x09ec('0xb2')](_0x15c73b['body'],{'firstName':_0x15c73b[_0x09ec('0x65')]['from'],'ListId':_0x4d3019['id']});_0x1bf884[_0x15c73b[_0x09ec('0x65')]['mapKey']]=_0x15c73b[_0x09ec('0x65')]['from'];return db['CmContact']['create'](_0x1bf884,{'fields':_0x3731f3,'raw':!![]});}})[_0x09ec('0x39')](handleEntityNotFound(_0x54aaad,null))['then'](function(_0x52742f){if(_0x52742f){_0x15c73b['contact']=_0x52742f;var _0x5f16b1={'ContactId':_0x52742f['id'],'phone':_0x15c73b['body'][_0x09ec('0xa4')],'WhatsappAccountId':_0x563f49['params']['id']};var _0x2011c7={'ContactId':_0x52742f['id'],'WhatsappAccountId':_0x563f49[_0x09ec('0x5d')]['id'],'closed':![]};return db[_0x09ec('0xb3')]['find']({'where':_0x2011c7})[_0x09ec('0x39')](function(_0x5842e4){if(_0x5842e4){return[_0x5842e4,![]];}return db[_0x09ec('0xb3')]['create'](_0x5f16b1)[_0x09ec('0x39')](function(_0x1d6a8e){return[_0x1d6a8e,!![]];});});}})[_0x09ec('0x76')](function(_0x1f2481,_0x25ed9c){_0x15c73b[_0x09ec('0xb4')]=_0x1f2481[_0x09ec('0x3a')]({'plain':!![]});_0x15c73b[_0x09ec('0xb4')][_0x09ec('0xb5')]=![];if(_0x25ed9c){if(_0x15c73b['account'][_0x09ec('0xb6')]){_0x15c73b[_0x09ec('0xb7')][_0x09ec('0xb8')]({'id':0x0,'priority':_0x15c73b['applications'][_0x09ec('0x51')]+0x1,'app':_0x09ec('0xb9'),'appdata':_0x09ec('0xba'),'interval':_0x09ec('0xbb')});}_0x15c73b[_0x09ec('0xb4')][_0x09ec('0xb5')]=!![];}return db['WhatsappMessage'][_0x09ec('0x5e')]({'phone':_0x15c73b[_0x09ec('0x65')][_0x09ec('0xa4')],'messageId':_0x15c73b[_0x09ec('0x65')][_0x09ec('0xa6')],'body':_0x15c73b['body'][_0x09ec('0x65')],'WhatsappAccountId':_0x563f49[_0x09ec('0x5d')]['id'],'WhatsappInteractionId':_0x1f2481['id'],'direction':'in','ContactId':_0x1f2481[_0x09ec('0xbc')],'AttachmentId':_0x15c73b['body']['AttachmentId']});})[_0x09ec('0x39')](function(_0x11793a){_0x15c73b[_0x09ec('0x29')]=_0x11793a;if(_0x15c73b[_0x09ec('0xb4')][_0x09ec('0xbd')]){return db['User'][_0x09ec('0x61')]({'attributes':['id',_0x09ec('0x3f')],'where':{'id':_0x15c73b[_0x09ec('0xb4')]['UserId']}})[_0x09ec('0x39')](function(_0x2544ad){if(_0x2544ad){_0x15c73b[_0x09ec('0xb7')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2544ad['name']+','+(_0x15c73b[_0x09ec('0x8b')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x09ec('0xbe'),_0x09ec('0xbf'),_0x15c73b);});}return respondWithRpcPromise('Start',_0x09ec('0xbf'),_0x15c73b);})[_0x09ec('0x39')](function(_0x1992c4){if(_0x1992c4){var _0x4f431f=0xc8;var _0x31de68=_0x09ec('0xc0');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x31de68,_0x4f431f,_0x09ec('0xc1'));logger[_0x09ec('0xc2')](_0x09ec('0xc3'),_0x31de68,_0x4f431f,_0x09ec('0xc1'),JSON[_0x09ec('0x27')](_0x1992c4));if(_0x15c73b[_0x09ec('0x8b')]['type']===_0x09ec('0xc4')){return _0x54aaad[_0x09ec('0x40')](_0x4f431f)[_0x09ec('0x32')]('Content-Type',_0x09ec('0xc5'))[_0x09ec('0x87')](_0x09ec('0xc6'));}else{return _0x54aaad[_0x09ec('0x40')](_0x4f431f)['json'](_0x1992c4);}}});})[_0x09ec('0x2b')](handleError(_0x54aaad,null));};exports[_0x09ec('0x87')]=function(_0xfd1f42,_0x153b5f,_0x164e88){var _0x579778,_0x504a22,_0x155f34;if(_[_0x09ec('0xa7')](_0xfd1f42[_0x09ec('0x65')][_0x09ec('0x65')])||_0xfd1f42[_0x09ec('0x65')][_0x09ec('0x65')]===''){throw new db[(_0x09ec('0x95'))][(_0x09ec('0x96'))](_0x09ec('0xa9'));}if(_[_0x09ec('0xa7')](_0xfd1f42['body']['to'])){throw new db[(_0x09ec('0x95'))][(_0x09ec('0x96'))](_0x09ec('0xc7'));}_0x579778=_0xfd1f42[_0x09ec('0x65')]['to'];return db[_0x09ec('0x45')][_0x09ec('0x61')]({'where':{'id':_0xfd1f42[_0x09ec('0x5d')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x09ec('0x94')],'as':'Contacts','where':{'mobile':_0x579778},'limit':0x1,'order':[['updatedAt',_0x09ec('0xb0')]]}]}]})[_0x09ec('0x39')](handleEntityNotFound(_0x153b5f,null))['then'](function(_0x54092f){if(_0x54092f&&_0x54092f['List']){_0x504a22=_0x54092f[_0x09ec('0x3a')]({'plain':!![]});if(_0x504a22[_0x09ec('0xc8')]&&_0x504a22['List'][_0x09ec('0xaf')]['length']){return _0x504a22[_0x09ec('0xc8')][_0x09ec('0xaf')][0x0];}return db[_0x09ec('0x94')]['create'](_[_0x09ec('0xb2')](_0xfd1f42[_0x09ec('0x65')],{'firstName':_0x579778,'mobile':_0x579778,'phone':_0x579778,'ListId':_0x504a22[_0x09ec('0x9c')]}));}})[_0x09ec('0x39')](handleEntityNotFound(_0x153b5f,null))['then'](function(_0x33df94){if(_0x33df94){_0x155f34=_0x33df94;return db['WhatsappInteraction'][_0x09ec('0x61')]({'where':{'ContactId':_0x155f34['id'],'closed':![],'WhatsappAccountId':_0x504a22['id']}})[_0x09ec('0x39')](function(_0x5df1d1){if(_0x5df1d1){return[_0x5df1d1,![]];}return db[_0x09ec('0xb3')]['create']({'UserId':_0xfd1f42[_0x09ec('0xc9')]['id'],'ContactId':_0x155f34['id'],'WhatsappAccountId':_0x504a22['id'],'phone':_0x579778,'firstMsgDirection':_0x09ec('0xca'),'Messages':[_[_0x09ec('0x57')](_0xfd1f42[_0x09ec('0x65')],{'read':![],'body':_0xfd1f42[_0x09ec('0x65')][_0x09ec('0x65')],'phone':_0x579778,'WhatsappAccountId':_0x504a22['id'],'UserId':_0xfd1f42[_0x09ec('0xc9')]['id'],'ContactId':_0x155f34['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x09ec('0xcb')}]})[_0x09ec('0x39')](function(_0x21d33d){return[_0x21d33d,!![]];});});}})[_0x09ec('0x76')](function(_0x25094c,_0x314550){if(_0x314550){return _0x25094c;}return db[_0x09ec('0x8f')][_0x09ec('0x5e')](_['merge'](_0xfd1f42[_0x09ec('0x65')],{'read':![],'body':_0xfd1f42[_0x09ec('0x65')][_0x09ec('0x65')],'phone':_0x579778,'WhatsappAccountId':_0x504a22['id'],'WhatsappInteractionId':_0x25094c['id'],'UserId':_0xfd1f42[_0x09ec('0xc9')]['id'],'ContactId':_0x155f34['id']}))[_0x09ec('0x39')](function(_0x22077d){_0x25094c[_0x09ec('0xcc')]['Messages']=[];_0x25094c[_0x09ec('0xcc')][_0x09ec('0xcb')][_0x09ec('0xb8')](_0x22077d[_0x09ec('0xcc')]);return _0x25094c;});})['then'](respondWithResult(_0x153b5f,null))['catch'](handleError(_0x153b5f,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 9295d35..660955f 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 _0xd4ad=['hook','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','remove','emit'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0xd4ad,0x139));var _0xdd4a=function(_0x490437,_0x21b81a){_0x490437=_0x490437-0x0;var _0x45335b=_0xd4ad[_0x490437];return _0x45335b;};'use strict';var EventEmitter=require(_0xdd4a('0x0'));var WhatsappAccount=require(_0xdd4a('0x1'))['db'][_0xdd4a('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xdd4a('0x3')](0x0);var events={'afterCreate':_0xdd4a('0x4'),'afterUpdate':'update','afterDestroy':_0xdd4a('0x5')};function emitEvent(_0x487f7c){return function(_0x387b66,_0x801f01,_0x40f3c3){WhatsappAccountEvents[_0xdd4a('0x6')](_0x487f7c+':'+_0x387b66['id'],_0x387b66);WhatsappAccountEvents[_0xdd4a('0x6')](_0x487f7c,_0x387b66);_0x40f3c3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xdd4a('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xc8c2=['remove','emit','hasOwnProperty','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x331e14,_0x17eaa9){var _0x1da56e=function(_0xee02c9){while(--_0xee02c9){_0x331e14['push'](_0x331e14['shift']());}};_0x1da56e(++_0x17eaa9);}(_0xc8c2,0x1cb));var _0x2c8c=function(_0x287cc5,_0x2f5c71){_0x287cc5=_0x287cc5-0x0;var _0xe7212a=_0xc8c2[_0x287cc5];return _0xe7212a;};'use strict';var EventEmitter=require(_0x2c8c('0x0'));var WhatsappAccount=require(_0x2c8c('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x2c8c('0x2')](0x0);var events={'afterCreate':_0x2c8c('0x3'),'afterUpdate':_0x2c8c('0x4'),'afterDestroy':_0x2c8c('0x5')};function emitEvent(_0x1ed27b){return function(_0x928c15,_0x47b1c5,_0x8d78f6){WhatsappAccountEvents['emit'](_0x1ed27b+':'+_0x928c15['id'],_0x928c15);WhatsappAccountEvents[_0x2c8c('0x6')](_0x1ed27b,_0x928c15);_0x8d78f6(null);};}for(var e in events){if(events[_0x2c8c('0x7')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 6d05f5e..6936020 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 _0x856b=['bluebird','request-promise','rimraf','../../config/environment','exports','WhatsappAccount','whatsapp_accounts','lodash','util','api'];(function(_0x45e9bc,_0x1293ea){var _0x456f80=function(_0x2856d7){while(--_0x2856d7){_0x45e9bc['push'](_0x45e9bc['shift']());}};_0x456f80(++_0x1293ea);}(_0x856b,0x10b));var _0xb856=function(_0xc587ed,_0x11cbc2){_0xc587ed=_0xc587ed-0x0;var _0x41d137=_0x856b[_0xc587ed];return _0x41d137;};'use strict';var _=require(_0xb856('0x0'));var util=require(_0xb856('0x1'));var logger=require('../../config/logger')(_0xb856('0x2'));var moment=require('moment');var BPromise=require(_0xb856('0x3'));var rp=require(_0xb856('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb856('0x5'));var config=require(_0xb856('0x6'));var attributes=require('./whatsappAccount.attributes');module[_0xb856('0x7')]=function(_0x3db111,_0xc7569c){return _0x3db111['define'](_0xb856('0x8'),attributes,{'tableName':_0xb856('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a7f=['whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount'];(function(_0x132c26,_0x338014){var _0x114754=function(_0x29fd5e){while(--_0x29fd5e){_0x132c26['push'](_0x132c26['shift']());}};_0x114754(++_0x338014);}(_0x5a7f,0x1dd));var _0xf5a7=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x5a7f[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0xf5a7('0x0'));var util=require(_0xf5a7('0x1'));var logger=require(_0xf5a7('0x2'))(_0xf5a7('0x3'));var moment=require(_0xf5a7('0x4'));var BPromise=require(_0xf5a7('0x5'));var rp=require(_0xf5a7('0x6'));var fs=require('fs');var path=require(_0xf5a7('0x7'));var rimraf=require('rimraf');var config=require(_0xf5a7('0x8'));var attributes=require(_0xf5a7('0x9'));module[_0xf5a7('0xa')]=function(_0x572e42,_0x542c0c){return _0x572e42[_0xf5a7('0xb')](_0xf5a7('0xc'),attributes,{'tableName':_0xf5a7('0xd'),'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 42e0e6f..dd1d4ea 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 _0x431c=['defaults','localhost','socket.io-emitter','./whatsappAccount.socket','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','then','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','redis'];(function(_0x578b0d,_0x48bf3a){var _0x1349f0=function(_0x5324f2){while(--_0x5324f2){_0x578b0d['push'](_0x578b0d['shift']());}};_0x1349f0(++_0x48bf3a);}(_0x431c,0x1e8));var _0xc431=function(_0x1e33a7,_0x4101ee){_0x1e33a7=_0x1e33a7-0x0;var _0x661bc5=_0x431c[_0x1e33a7];return _0x661bc5;};'use strict';var _=require('lodash');var util=require(_0xc431('0x0'));var moment=require('moment');var BPromise=require(_0xc431('0x1'));var rs=require(_0xc431('0x2'));var fs=require('fs');var Redis=require(_0xc431('0x3'));var db=require(_0xc431('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc431('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xc431('0x6')]=_[_0xc431('0x7')](config[_0xc431('0x6')],{'host':_0xc431('0x8'),'port':0x18eb});var socket=require(_0xc431('0x9'))(new Redis(config[_0xc431('0x6')]));require(_0xc431('0xa'))['register'](socket);function respondWithRpcPromise(_0x5b35da,_0x122b49,_0x29a612){return new BPromise(function(_0x3ef3ef,_0x498766){return client[_0xc431('0xb')](_0x5b35da,_0x29a612)['then'](function(_0x5f08be){logger[_0xc431('0xc')](_0xc431('0xd'),_0x122b49,_0xc431('0xe'));logger[_0xc431('0xf')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x122b49,_0xc431('0xe'),JSON[_0xc431('0x10')](_0x5f08be));if(_0x5f08be[_0xc431('0x11')]){if(_0x5f08be[_0xc431('0x11')][_0xc431('0x12')]===0x1f4){logger[_0xc431('0x11')](_0xc431('0xd'),_0x122b49,_0x5f08be[_0xc431('0x11')][_0xc431('0x13')]);return _0x498766(_0x5f08be[_0xc431('0x11')]['message']);}logger[_0xc431('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x122b49,_0x5f08be[_0xc431('0x11')]['message']);return _0x3ef3ef(_0x5f08be['error'][_0xc431('0x13')]);}else{logger[_0xc431('0xc')](_0xc431('0xd'),_0x122b49,'request\x20sent');_0x3ef3ef(_0x5f08be[_0xc431('0x14')][_0xc431('0x13')]);}})[_0xc431('0x15')](function(_0x22abe8){logger['error'](_0xc431('0xd'),_0x122b49,_0x22abe8);_0x498766(_0x22abe8);});});}exports[_0xc431('0x16')]=function(_0x11eb02){var _0x1f36ac=this;return new Promise(function(_0x40c77a,_0x449bed){return db[_0xc431('0x17')][_0xc431('0x18')]({'raw':_0x11eb02[_0xc431('0x19')]?_0x11eb02[_0xc431('0x19')][_0xc431('0x1a')]===undefined?!![]:![]:!![],'where':_0x11eb02['options']?_0x11eb02[_0xc431('0x19')][_0xc431('0x1b')]||null:null,'attributes':_0x11eb02[_0xc431('0x19')]?_0x11eb02[_0xc431('0x19')][_0xc431('0x1c')]||null:null,'include':_0x11eb02['options']?_0x11eb02[_0xc431('0x19')][_0xc431('0x1d')]?_[_0xc431('0x1e')](_0x11eb02['options'][_0xc431('0x1d')],function(_0x39d836){return{'model':db[_0x39d836[_0xc431('0x1f')]],'as':_0x39d836['as'],'attributes':_0x39d836[_0xc431('0x1c')],'include':_0x39d836['include']?_[_0xc431('0x1e')](_0x39d836['include'],function(_0x581c6b){return{'model':db[_0x581c6b[_0xc431('0x1f')]],'as':_0x581c6b['as'],'attributes':_0x581c6b[_0xc431('0x1c')],'include':_0x581c6b[_0xc431('0x1d')]?_[_0xc431('0x1e')](_0x581c6b[_0xc431('0x1d')],function(_0x37441d){return{'model':db[_0x37441d[_0xc431('0x1f')]],'as':_0x37441d['as'],'attributes':_0x37441d['attributes']};}):[]};}):[]};}):[]:[]})[_0xc431('0x20')](function(_0x1d1f0f){logger[_0xc431('0xc')](_0xc431('0x16'),_0x11eb02);logger[_0xc431('0xf')]('ShowWhatsappAccount',_0x11eb02,JSON[_0xc431('0x10')](_0x1d1f0f));_0x40c77a(_0x1d1f0f);})[_0xc431('0x15')](function(_0x135e76){logger[_0xc431('0x11')]('ShowWhatsappAccount',_0x135e76['message'],_0x11eb02);_0x449bed(_0x1f36ac[_0xc431('0x11')](0x1f4,_0x135e76['message']));});});}; \ No newline at end of file +var _0xe808=['socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','include','map','model','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','localhost'];(function(_0x1905cc,_0x99e86f){var _0x15f952=function(_0x4471c0){while(--_0x4471c0){_0x1905cc['push'](_0x1905cc['shift']());}};_0x15f952(++_0x99e86f);}(_0xe808,0xe9));var _0x8e80=function(_0x2a4e28,_0x5d3ed0){_0x2a4e28=_0x2a4e28-0x0;var _0x2ccf44=_0xe808[_0x2a4e28];return _0x2ccf44;};'use strict';var _=require('lodash');var util=require(_0x8e80('0x0'));var moment=require('moment');var BPromise=require(_0x8e80('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e80('0x2'));var db=require(_0x8e80('0x3'))['db'];var utils=require(_0x8e80('0x4'));var logger=require(_0x8e80('0x5'))(_0x8e80('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8e80('0x7')][_0x8e80('0x8')]({'port':0x232a});config['redis']=_[_0x8e80('0x9')](config[_0x8e80('0xa')],{'host':_0x8e80('0xb'),'port':0x18eb});var socket=require(_0x8e80('0xc'))(new Redis(config['redis']));require(_0x8e80('0xd'))[_0x8e80('0xe')](socket);function respondWithRpcPromise(_0x2819df,_0x4f5abb,_0xc0abe0){return new BPromise(function(_0x2000fd,_0x1bb63f){return client[_0x8e80('0xf')](_0x2819df,_0xc0abe0)[_0x8e80('0x10')](function(_0x4e03d8){logger[_0x8e80('0x11')](_0x8e80('0x12'),_0x4f5abb,_0x8e80('0x13'));logger[_0x8e80('0x14')](_0x8e80('0x15'),_0x4f5abb,_0x8e80('0x13'),JSON[_0x8e80('0x16')](_0x4e03d8));if(_0x4e03d8[_0x8e80('0x17')]){if(_0x4e03d8[_0x8e80('0x17')]['code']===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x4f5abb,_0x4e03d8[_0x8e80('0x17')][_0x8e80('0x18')]);return _0x1bb63f(_0x4e03d8['error']['message']);}logger[_0x8e80('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x4f5abb,_0x4e03d8[_0x8e80('0x17')][_0x8e80('0x18')]);return _0x2000fd(_0x4e03d8[_0x8e80('0x17')][_0x8e80('0x18')]);}else{logger['info'](_0x8e80('0x12'),_0x4f5abb,_0x8e80('0x13'));_0x2000fd(_0x4e03d8['result'][_0x8e80('0x18')]);}})['catch'](function(_0x204815){logger[_0x8e80('0x17')](_0x8e80('0x12'),_0x4f5abb,_0x204815);_0x1bb63f(_0x204815);});});}exports[_0x8e80('0x19')]=function(_0x1fdeae){var _0x44b3dd=this;return new Promise(function(_0x8c852b,_0x1dc0c4){return db[_0x8e80('0x1a')]['find']({'raw':_0x1fdeae[_0x8e80('0x1b')]?_0x1fdeae[_0x8e80('0x1b')][_0x8e80('0x1c')]===undefined?!![]:![]:!![],'where':_0x1fdeae['options']?_0x1fdeae[_0x8e80('0x1b')][_0x8e80('0x1d')]||null:null,'attributes':_0x1fdeae[_0x8e80('0x1b')]?_0x1fdeae[_0x8e80('0x1b')][_0x8e80('0x1e')]||null:null,'include':_0x1fdeae[_0x8e80('0x1b')]?_0x1fdeae[_0x8e80('0x1b')][_0x8e80('0x1f')]?_['map'](_0x1fdeae[_0x8e80('0x1b')][_0x8e80('0x1f')],function(_0x52081c){return{'model':db[_0x52081c['model']],'as':_0x52081c['as'],'attributes':_0x52081c[_0x8e80('0x1e')],'include':_0x52081c[_0x8e80('0x1f')]?_[_0x8e80('0x20')](_0x52081c[_0x8e80('0x1f')],function(_0x4e12d0){return{'model':db[_0x4e12d0[_0x8e80('0x21')]],'as':_0x4e12d0['as'],'attributes':_0x4e12d0[_0x8e80('0x1e')],'include':_0x4e12d0['include']?_[_0x8e80('0x20')](_0x4e12d0[_0x8e80('0x1f')],function(_0x7d4bd5){return{'model':db[_0x7d4bd5['model']],'as':_0x7d4bd5['as'],'attributes':_0x7d4bd5[_0x8e80('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x31d072){logger[_0x8e80('0x11')](_0x8e80('0x19'),_0x1fdeae);logger[_0x8e80('0x14')]('ShowWhatsappAccount',_0x1fdeae,JSON[_0x8e80('0x16')](_0x31d072));_0x8c852b(_0x31d072);})[_0x8e80('0x22')](function(_0x3b786a){logger[_0x8e80('0x17')]('ShowWhatsappAccount',_0x3b786a[_0x8e80('0x18')],_0x1fdeae);_0x1dc0c4(_0x44b3dd[_0x8e80('0x17')](0x1f4,_0x3b786a['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index b894ff2..6feab9e 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 _0x8fba=['length','whatsappAccount:','save','remove','register'];(function(_0x3e330a,_0x11bf04){var _0x451dee=function(_0x1074b7){while(--_0x1074b7){_0x3e330a['push'](_0x3e330a['shift']());}};_0x451dee(++_0x11bf04);}(_0x8fba,0xde));var _0xa8fb=function(_0x14f47e,_0x48c646){_0x14f47e=_0x14f47e-0x0;var _0x5cecf8=_0x8fba[_0x14f47e];return _0x5cecf8;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xa8fb('0x0'),_0xa8fb('0x1'),'update'];function createListener(_0x432ecf,_0x3d0181){return function(_0x6751ab){_0x3d0181['emit'](_0x432ecf,_0x6751ab);};}function removeListener(_0x49d79a,_0x325532){return function(){WhatsappAccountEvents['removeListener'](_0x49d79a,_0x325532);};}exports[_0xa8fb('0x2')]=function(_0x44bdbf){for(var _0x298dfa=0x0,_0x334231=events[_0xa8fb('0x3')];_0x298dfa<_0x334231;_0x298dfa++){var _0x46425c=events[_0x298dfa];var _0x2e9cc6=createListener(_0xa8fb('0x4')+_0x46425c,_0x44bdbf);WhatsappAccountEvents['on'](_0x46425c,_0x2e9cc6);}}; \ No newline at end of file +var _0x2c82=['register','length','./whatsappAccount.events','remove','update','removeListener'];(function(_0x433a10,_0x1f15a6){var _0x55d4f8=function(_0xd95ed2){while(--_0xd95ed2){_0x433a10['push'](_0x433a10['shift']());}};_0x55d4f8(++_0x1f15a6);}(_0x2c82,0x18e));var _0x22c8=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x2c82[_0x50aa2e];return _0x5e07f0;};'use strict';var WhatsappAccountEvents=require(_0x22c8('0x0'));var events=['save',_0x22c8('0x1'),_0x22c8('0x2')];function createListener(_0x53371d,_0x4fb5d9){return function(_0x54e665){_0x4fb5d9['emit'](_0x53371d,_0x54e665);};}function removeListener(_0x34023a,_0x98fb78){return function(){WhatsappAccountEvents[_0x22c8('0x3')](_0x34023a,_0x98fb78);};}exports[_0x22c8('0x4')]=function(_0x31f747){for(var _0x8e630=0x0,_0x2e1523=events[_0x22c8('0x5')];_0x8e630<_0x2e1523;_0x8e630++){var _0x2aad98=events[_0x8e630];var _0x732628=createListener('whatsappAccount:'+_0x2aad98,_0x31f747);WhatsappAccountEvents['on'](_0x2aad98,_0x732628);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 0316100..958f420 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 _0x0255=['./whatsappApplication.controller','isAuthenticated','index','get','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x1e2e76,_0xe7ffe2){var _0x175a94=function(_0x283b5a){while(--_0x283b5a){_0x1e2e76['push'](_0x1e2e76['shift']());}};_0x175a94(++_0xe7ffe2);}(_0x0255,0x1ba));var _0x5025=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0255[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5025('0x0'));var util=require(_0x5025('0x1'));var path=require(_0x5025('0x2'));var timeout=require(_0x5025('0x3'));var express=require('express');var router=express[_0x5025('0x4')]();var fs_extra=require(_0x5025('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5025('0x6'));var config=require(_0x5025('0x7'));var controller=require(_0x5025('0x8'));router['get']('/',auth[_0x5025('0x9')](),controller[_0x5025('0xa')]);router[_0x5025('0xb')]('/:id',auth[_0x5025('0x9')](),controller[_0x5025('0xc')]);router[_0x5025('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5025('0xe')]('/:id',auth[_0x5025('0x9')](),controller[_0x5025('0xf')]);router['delete']('/:id',auth[_0x5025('0x9')](),controller[_0x5025('0x10')]);module[_0x5025('0x11')]=router; \ No newline at end of file +var _0x247a=['exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','./whatsappApplication.controller','get','isAuthenticated','show','post','put','/:id'];(function(_0x4492af,_0x47e25d){var _0x216729=function(_0x4964c8){while(--_0x4964c8){_0x4492af['push'](_0x4492af['shift']());}};_0x216729(++_0x47e25d);}(_0x247a,0x194));var _0xa247=function(_0x1440d9,_0x4a2c7e){_0x1440d9=_0x1440d9-0x0;var _0x4a0cfb=_0x247a[_0x1440d9];return _0x4a0cfb;};'use strict';var multer=require(_0xa247('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa247('0x1'));var express=require('express');var router=express[_0xa247('0x2')]();var fs_extra=require(_0xa247('0x3'));var auth=require(_0xa247('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa247('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa247('0x6')]('/:id',auth[_0xa247('0x7')](),controller[_0xa247('0x8')]);router[_0xa247('0x9')]('/',auth[_0xa247('0x7')](),controller['create']);router[_0xa247('0xa')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xa247('0xb'),auth[_0xa247('0x7')](),controller['destroy']);module[_0xa247('0xc')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index a9472ca..8f76268 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 _0x35b8=['*,*,*,*','sequelize','exports','INTEGER','TEXT','STRING'];(function(_0x3a7455,_0x46b004){var _0x216c72=function(_0xdd775c){while(--_0xdd775c){_0x3a7455['push'](_0x3a7455['shift']());}};_0x216c72(++_0x46b004);}(_0x35b8,0x10f));var _0x835b=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0x35b8[_0x35e92e];return _0x1205a8;};'use strict';var Sequelize=require(_0x835b('0x0'));module[_0x835b('0x1')]={'priority':{'type':Sequelize[_0x835b('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x835b('0x3')]()},'description':{'type':Sequelize[_0x835b('0x4')]},'interval':{'type':Sequelize[_0x835b('0x4')],'defaultValue':_0x835b('0x5')}}; \ No newline at end of file +var _0xe806=['sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xe806,0x113));var _0x6e80=function(_0x2bcb51,_0x52dcd3){_0x2bcb51=_0x2bcb51-0x0;var _0x460d51=_0xe806[_0x2bcb51];return _0x460d51;};'use strict';var Sequelize=require(_0x6e80('0x0'));module['exports']={'priority':{'type':Sequelize[_0x6e80('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6e80('0x2')],'allowNull':![],'defaultValue':_0x6e80('0x3')},'appdata':{'type':Sequelize[_0x6e80('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6e80('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index e2d9807..c634a50 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 _0x9666=['zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','end','error','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','WhatsappApplication','includeAll','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf'];(function(_0xc8a02c,_0x4809d3){var _0x3d89da=function(_0x5903d8){while(--_0x5903d8){_0xc8a02c['push'](_0xc8a02c['shift']());}};_0x3d89da(++_0x4809d3);}(_0x9666,0x17a));var _0x6966=function(_0x43cda8,_0x541645){_0x43cda8=_0x43cda8-0x0;var _0x3ebaa7=_0x9666[_0x43cda8];return _0x3ebaa7;};'use strict';var emlformat=require(_0x6966('0x0'));var rimraf=require(_0x6966('0x1'));var zipdir=require(_0x6966('0x2'));var jsonpatch=require(_0x6966('0x3'));var rp=require('request-promise');var moment=require(_0x6966('0x4'));var BPromise=require(_0x6966('0x5'));var Mustache=require(_0x6966('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6966('0x7'));var csv=require(_0x6966('0x8'));var ejs=require(_0x6966('0x9'));var fs=require('fs');var fs_extra=require(_0x6966('0xa'));var _=require(_0x6966('0xb'));var squel=require(_0x6966('0xc'));var crypto=require('crypto');var jsforce=require(_0x6966('0xd'));var deskjs=require(_0x6966('0xe'));var toCsv=require(_0x6966('0x8'));var querystring=require('querystring');var Papa=require(_0x6966('0xf'));var Redis=require(_0x6966('0x10'));var authService=require(_0x6966('0x11'));var qs=require(_0x6966('0x12'));var as=require(_0x6966('0x13'));var hardwareService=require(_0x6966('0x14'));var logger=require(_0x6966('0x15'))(_0x6966('0x16'));var utils=require(_0x6966('0x17'));var config=require(_0x6966('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c5272,_0x154c15){_0x154c15=_0x154c15||0xcc;return function(_0x2ce913){if(_0x2ce913){return _0x4c5272[_0x6966('0x19')](_0x154c15);}return _0x4c5272['status'](_0x154c15)['end']();};}function respondWithResult(_0x584bf2,_0x235ba3){_0x235ba3=_0x235ba3||0xc8;return function(_0xbd4ea2){if(_0xbd4ea2){return _0x584bf2[_0x6966('0x1a')](_0x235ba3)[_0x6966('0x1b')](_0xbd4ea2);}};}function respondWithFilteredResult(_0x19428c,_0x48d414){return function(_0x204200){if(_0x204200){var _0x1bf59d=typeof _0x48d414['offset']===_0x6966('0x1c')&&typeof _0x48d414[_0x6966('0x1d')]===_0x6966('0x1c');var _0x529dbd=_0x204200[_0x6966('0x1e')];var _0x4bf5b8=_0x1bf59d?0x0:_0x48d414[_0x6966('0x1f')];var _0x519049=_0x1bf59d?_0x204200['count']:_0x48d414['offset']+_0x48d414[_0x6966('0x1d')];var _0x5eef44;if(_0x519049>=_0x529dbd){_0x519049=_0x529dbd;_0x5eef44=0xc8;}else{_0x5eef44=0xce;}_0x19428c['status'](_0x5eef44);return _0x19428c['set']('Content-Range',_0x4bf5b8+'-'+_0x519049+'/'+_0x529dbd)['json'](_0x204200);}return null;};}function patchUpdates(_0x197c2c){return function(_0x247570){try{jsonpatch[_0x6966('0x20')](_0x247570,_0x197c2c,!![]);}catch(_0x4e8342){return BPromise[_0x6966('0x21')](_0x4e8342);}return _0x247570[_0x6966('0x22')]();};}function saveUpdates(_0x43349b,_0x8c7833){return function(_0x33fc7f){if(_0x33fc7f){return _0x33fc7f[_0x6966('0x23')](_0x43349b)[_0x6966('0x24')](function(_0x2af0b7){return _0x2af0b7;});}return null;};}function removeEntity(_0x3772d7,_0x509631){return function(_0x24af6a){if(_0x24af6a){return _0x24af6a[_0x6966('0x25')]()[_0x6966('0x24')](function(){_0x3772d7[_0x6966('0x1a')](0xcc)[_0x6966('0x26')]();});}};}function handleEntityNotFound(_0x27db0e,_0x44a5df){return function(_0x4e4c30){if(!_0x4e4c30){_0x27db0e[_0x6966('0x19')](0x194);}return _0x4e4c30;};}function handleError(_0x5a7f85,_0x433601){_0x433601=_0x433601||0x1f4;return function(_0x4f7aa2){logger[_0x6966('0x27')](_0x4f7aa2[_0x6966('0x28')]);if(_0x4f7aa2[_0x6966('0x29')]){delete _0x4f7aa2[_0x6966('0x29')];}_0x5a7f85[_0x6966('0x1a')](_0x433601)[_0x6966('0x2a')](_0x4f7aa2);};}exports[_0x6966('0x2b')]=function(_0x1b86a7,_0x2c9fbb){var _0x4a85c7={},_0x270919={},_0x35fdb4={'count':0x0,'rows':[]};var _0x59a8d6=_[_0x6966('0x2c')](db['WhatsappApplication'][_0x6966('0x2d')],function(_0x297c21){return{'name':_0x297c21[_0x6966('0x2e')],'type':_0x297c21[_0x6966('0x2f')][_0x6966('0x30')]};});_0x270919[_0x6966('0x31')]=_[_0x6966('0x2c')](_0x59a8d6,_0x6966('0x29'));_0x270919[_0x6966('0x32')]=_[_0x6966('0x33')](_0x1b86a7[_0x6966('0x32')]);_0x270919[_0x6966('0x34')]=_[_0x6966('0x35')](_0x270919[_0x6966('0x31')],_0x270919[_0x6966('0x32')]);_0x4a85c7[_0x6966('0x36')]=_['intersection'](_0x270919[_0x6966('0x31')],qs['fields'](_0x1b86a7[_0x6966('0x32')][_0x6966('0x37')]));_0x4a85c7[_0x6966('0x36')]=_0x4a85c7[_0x6966('0x36')][_0x6966('0x38')]?_0x4a85c7[_0x6966('0x36')]:_0x270919[_0x6966('0x31')];if(!_0x1b86a7[_0x6966('0x32')][_0x6966('0x39')](_0x6966('0x3a'))){_0x4a85c7['limit']=qs[_0x6966('0x1d')](_0x1b86a7[_0x6966('0x32')][_0x6966('0x1d')]);_0x4a85c7['offset']=qs['offset'](_0x1b86a7[_0x6966('0x32')][_0x6966('0x1f')]);}_0x4a85c7['order']=qs[_0x6966('0x3b')](_0x1b86a7['query']['sort']);_0x4a85c7[_0x6966('0x3c')]=qs[_0x6966('0x34')](_[_0x6966('0x3d')](_0x1b86a7[_0x6966('0x32')],_0x270919['filters']),_0x59a8d6);if(_0x1b86a7[_0x6966('0x32')][_0x6966('0x3e')]){_0x4a85c7[_0x6966('0x3c')]=_[_0x6966('0x3f')](_0x4a85c7[_0x6966('0x3c')],{'$or':_[_0x6966('0x2c')](_0x59a8d6,function(_0x3cb629){if(_0x3cb629[_0x6966('0x2f')]!==_0x6966('0x40')){var _0x112bff={};_0x112bff[_0x3cb629[_0x6966('0x29')]]={'$like':'%'+_0x1b86a7[_0x6966('0x32')][_0x6966('0x3e')]+'%'};return _0x112bff;}})});}_0x4a85c7=_['merge']({},_0x4a85c7,_0x1b86a7[_0x6966('0x41')]);var _0x5c9590={'where':_0x4a85c7['where']};return db[_0x6966('0x42')][_0x6966('0x1e')](_0x5c9590)['then'](function(_0x57949e){_0x35fdb4[_0x6966('0x1e')]=_0x57949e;if(_0x1b86a7[_0x6966('0x32')][_0x6966('0x43')]){_0x4a85c7['include']=[{'all':!![]}];}return db[_0x6966('0x42')][_0x6966('0x44')](_0x4a85c7);})[_0x6966('0x24')](function(_0x6af6a8){_0x35fdb4[_0x6966('0x45')]=_0x6af6a8;return _0x35fdb4;})[_0x6966('0x24')](respondWithFilteredResult(_0x2c9fbb,_0x4a85c7))[_0x6966('0x46')](handleError(_0x2c9fbb,null));};exports[_0x6966('0x47')]=function(_0x1df2cb,_0x5356fc){var _0x49be81={'raw':!![],'where':{'id':_0x1df2cb[_0x6966('0x48')]['id']}},_0x50ec04={};_0x50ec04['model']=_[_0x6966('0x33')](db[_0x6966('0x42')]['rawAttributes']);_0x50ec04[_0x6966('0x32')]=_['keys'](_0x1df2cb[_0x6966('0x32')]);_0x50ec04[_0x6966('0x34')]=_[_0x6966('0x35')](_0x50ec04[_0x6966('0x31')],_0x50ec04[_0x6966('0x32')]);_0x49be81[_0x6966('0x36')]=_[_0x6966('0x35')](_0x50ec04[_0x6966('0x31')],qs[_0x6966('0x37')](_0x1df2cb[_0x6966('0x32')][_0x6966('0x37')]));_0x49be81['attributes']=_0x49be81[_0x6966('0x36')][_0x6966('0x38')]?_0x49be81[_0x6966('0x36')]:_0x50ec04['model'];if(_0x1df2cb[_0x6966('0x32')][_0x6966('0x43')]){_0x49be81['include']=[{'all':!![]}];}_0x49be81=_[_0x6966('0x3f')]({},_0x49be81,_0x1df2cb[_0x6966('0x41')]);return db[_0x6966('0x42')][_0x6966('0x49')](_0x49be81)[_0x6966('0x24')](handleEntityNotFound(_0x5356fc,null))[_0x6966('0x24')](respondWithResult(_0x5356fc,null))[_0x6966('0x46')](handleError(_0x5356fc,null));};exports[_0x6966('0x4a')]=function(_0x3635b8,_0x154d3e){return db['WhatsappApplication'][_0x6966('0x4a')](_0x3635b8['body'],{})[_0x6966('0x24')](respondWithResult(_0x154d3e,0xc9))[_0x6966('0x46')](handleError(_0x154d3e,null));};exports['update']=function(_0x301555,_0x4955b8){if(_0x301555[_0x6966('0x4b')]['id']){delete _0x301555[_0x6966('0x4b')]['id'];}return db[_0x6966('0x42')]['find']({'where':{'id':_0x301555[_0x6966('0x48')]['id']}})['then'](handleEntityNotFound(_0x4955b8,null))[_0x6966('0x24')](saveUpdates(_0x301555[_0x6966('0x4b')],null))[_0x6966('0x24')](respondWithResult(_0x4955b8,null))['catch'](handleError(_0x4955b8,null));};exports['destroy']=function(_0x3422fe,_0x40175c){return db[_0x6966('0x42')][_0x6966('0x49')]({'where':{'id':_0x3422fe[_0x6966('0x48')]['id']}})['then'](handleEntityNotFound(_0x40175c,null))[_0x6966('0x24')](removeEntity(_0x40175c,null))[_0x6966('0x46')](handleError(_0x40175c,null));}; \ No newline at end of file +var _0xd991=['limit','count','json','apply','save','update','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','intersection','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x3bb89d,_0x5eb22e){var _0x939cac=function(_0x15f83b){while(--_0x15f83b){_0x3bb89d['push'](_0x3bb89d['shift']());}};_0x939cac(++_0x5eb22e);}(_0xd991,0x115));var _0x1d99=function(_0x26eca1,_0x4c6e2e){_0x26eca1=_0x26eca1-0x0;var _0x2438a9=_0xd991[_0x26eca1];return _0x2438a9;};'use strict';var emlformat=require(_0x1d99('0x0'));var rimraf=require(_0x1d99('0x1'));var zipdir=require(_0x1d99('0x2'));var jsonpatch=require(_0x1d99('0x3'));var rp=require(_0x1d99('0x4'));var moment=require('moment');var BPromise=require(_0x1d99('0x5'));var Mustache=require(_0x1d99('0x6'));var util=require(_0x1d99('0x7'));var path=require(_0x1d99('0x8'));var sox=require(_0x1d99('0x9'));var csv=require(_0x1d99('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d99('0xb'));var _=require(_0x1d99('0xc'));var squel=require('squel');var crypto=require(_0x1d99('0xd'));var jsforce=require(_0x1d99('0xe'));var deskjs=require(_0x1d99('0xf'));var toCsv=require(_0x1d99('0xa'));var querystring=require(_0x1d99('0x10'));var Papa=require(_0x1d99('0x11'));var Redis=require(_0x1d99('0x12'));var authService=require(_0x1d99('0x13'));var qs=require(_0x1d99('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d99('0x15'));var logger=require(_0x1d99('0x16'))('api');var utils=require(_0x1d99('0x17'));var config=require(_0x1d99('0x18'));var licenseUtil=require(_0x1d99('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x442843,_0xf7b799){_0xf7b799=_0xf7b799||0xcc;return function(_0x3c87e3){if(_0x3c87e3){return _0x442843[_0x1d99('0x1a')](_0xf7b799);}return _0x442843[_0x1d99('0x1b')](_0xf7b799)[_0x1d99('0x1c')]();};}function respondWithResult(_0x5f57a8,_0x35dd66){_0x35dd66=_0x35dd66||0xc8;return function(_0x5ad75d){if(_0x5ad75d){return _0x5f57a8[_0x1d99('0x1b')](_0x35dd66)['json'](_0x5ad75d);}};}function respondWithFilteredResult(_0x2f8738,_0x1b2c78){return function(_0x3ac89a){if(_0x3ac89a){var _0x8903f2=typeof _0x1b2c78[_0x1d99('0x1d')]===_0x1d99('0x1e')&&typeof _0x1b2c78[_0x1d99('0x1f')]===_0x1d99('0x1e');var _0x5c31c3=_0x3ac89a[_0x1d99('0x20')];var _0x4da463=_0x8903f2?0x0:_0x1b2c78[_0x1d99('0x1d')];var _0x1a51a4=_0x8903f2?_0x3ac89a[_0x1d99('0x20')]:_0x1b2c78[_0x1d99('0x1d')]+_0x1b2c78[_0x1d99('0x1f')];var _0x5044a7;if(_0x1a51a4>=_0x5c31c3){_0x1a51a4=_0x5c31c3;_0x5044a7=0xc8;}else{_0x5044a7=0xce;}_0x2f8738['status'](_0x5044a7);return _0x2f8738['set']('Content-Range',_0x4da463+'-'+_0x1a51a4+'/'+_0x5c31c3)[_0x1d99('0x21')](_0x3ac89a);}return null;};}function patchUpdates(_0x20af77){return function(_0x234b4b){try{jsonpatch[_0x1d99('0x22')](_0x234b4b,_0x20af77,!![]);}catch(_0x1863c0){return BPromise['reject'](_0x1863c0);}return _0x234b4b[_0x1d99('0x23')]();};}function saveUpdates(_0x2e6c35,_0x4a72ac){return function(_0x25bd22){if(_0x25bd22){return _0x25bd22[_0x1d99('0x24')](_0x2e6c35)[_0x1d99('0x25')](function(_0x3e7160){return _0x3e7160;});}return null;};}function removeEntity(_0x42e482,_0x8273bb){return function(_0x54a295){if(_0x54a295){return _0x54a295[_0x1d99('0x26')]()[_0x1d99('0x25')](function(){_0x42e482['status'](0xcc)[_0x1d99('0x1c')]();});}};}function handleEntityNotFound(_0x31e70e,_0x5b5fd){return function(_0x30a1ef){if(!_0x30a1ef){_0x31e70e['sendStatus'](0x194);}return _0x30a1ef;};}function handleError(_0x27d9d9,_0x50c51e){_0x50c51e=_0x50c51e||0x1f4;return function(_0x150569){logger[_0x1d99('0x27')](_0x150569[_0x1d99('0x28')]);if(_0x150569[_0x1d99('0x29')]){delete _0x150569['name'];}_0x27d9d9[_0x1d99('0x1b')](_0x50c51e)[_0x1d99('0x2a')](_0x150569);};}exports[_0x1d99('0x2b')]=function(_0x37f7b1,_0x11bff3){var _0x1aaf2b={},_0x5c0c0a={},_0x273f41={'count':0x0,'rows':[]};var _0x16cc9f=_[_0x1d99('0x2c')](db[_0x1d99('0x2d')][_0x1d99('0x2e')],function(_0x4b5c90){return{'name':_0x4b5c90[_0x1d99('0x2f')],'type':_0x4b5c90[_0x1d99('0x30')][_0x1d99('0x31')]};});_0x5c0c0a[_0x1d99('0x32')]=_[_0x1d99('0x2c')](_0x16cc9f,_0x1d99('0x29'));_0x5c0c0a[_0x1d99('0x33')]=_[_0x1d99('0x34')](_0x37f7b1[_0x1d99('0x33')]);_0x5c0c0a[_0x1d99('0x35')]=_['intersection'](_0x5c0c0a[_0x1d99('0x32')],_0x5c0c0a[_0x1d99('0x33')]);_0x1aaf2b[_0x1d99('0x36')]=_['intersection'](_0x5c0c0a[_0x1d99('0x32')],qs[_0x1d99('0x37')](_0x37f7b1['query'][_0x1d99('0x37')]));_0x1aaf2b[_0x1d99('0x36')]=_0x1aaf2b[_0x1d99('0x36')][_0x1d99('0x38')]?_0x1aaf2b[_0x1d99('0x36')]:_0x5c0c0a['model'];if(!_0x37f7b1[_0x1d99('0x33')][_0x1d99('0x39')](_0x1d99('0x3a'))){_0x1aaf2b[_0x1d99('0x1f')]=qs[_0x1d99('0x1f')](_0x37f7b1[_0x1d99('0x33')][_0x1d99('0x1f')]);_0x1aaf2b['offset']=qs['offset'](_0x37f7b1[_0x1d99('0x33')][_0x1d99('0x1d')]);}_0x1aaf2b[_0x1d99('0x3b')]=qs[_0x1d99('0x3c')](_0x37f7b1[_0x1d99('0x33')]['sort']);_0x1aaf2b[_0x1d99('0x3d')]=qs[_0x1d99('0x35')](_[_0x1d99('0x3e')](_0x37f7b1[_0x1d99('0x33')],_0x5c0c0a[_0x1d99('0x35')]),_0x16cc9f);if(_0x37f7b1[_0x1d99('0x33')][_0x1d99('0x3f')]){_0x1aaf2b[_0x1d99('0x3d')]=_['merge'](_0x1aaf2b[_0x1d99('0x3d')],{'$or':_[_0x1d99('0x2c')](_0x16cc9f,function(_0x43b5cb){if(_0x43b5cb['type']!==_0x1d99('0x40')){var _0x478624={};_0x478624[_0x43b5cb['name']]={'$like':'%'+_0x37f7b1[_0x1d99('0x33')][_0x1d99('0x3f')]+'%'};return _0x478624;}})});}_0x1aaf2b=_[_0x1d99('0x41')]({},_0x1aaf2b,_0x37f7b1[_0x1d99('0x42')]);var _0x59c119={'where':_0x1aaf2b[_0x1d99('0x3d')]};return db[_0x1d99('0x2d')][_0x1d99('0x20')](_0x59c119)[_0x1d99('0x25')](function(_0x17d969){_0x273f41['count']=_0x17d969;if(_0x37f7b1[_0x1d99('0x33')][_0x1d99('0x43')]){_0x1aaf2b[_0x1d99('0x44')]=[{'all':!![]}];}return db[_0x1d99('0x2d')][_0x1d99('0x45')](_0x1aaf2b);})[_0x1d99('0x25')](function(_0x107f3c){_0x273f41['rows']=_0x107f3c;return _0x273f41;})[_0x1d99('0x25')](respondWithFilteredResult(_0x11bff3,_0x1aaf2b))[_0x1d99('0x46')](handleError(_0x11bff3,null));};exports[_0x1d99('0x47')]=function(_0x41dc0e,_0x16a423){var _0x3b6b66={'raw':!![],'where':{'id':_0x41dc0e[_0x1d99('0x48')]['id']}},_0x280937={};_0x280937[_0x1d99('0x32')]=_[_0x1d99('0x34')](db[_0x1d99('0x2d')]['rawAttributes']);_0x280937['query']=_[_0x1d99('0x34')](_0x41dc0e['query']);_0x280937[_0x1d99('0x35')]=_[_0x1d99('0x49')](_0x280937[_0x1d99('0x32')],_0x280937[_0x1d99('0x33')]);_0x3b6b66[_0x1d99('0x36')]=_[_0x1d99('0x49')](_0x280937[_0x1d99('0x32')],qs['fields'](_0x41dc0e['query']['fields']));_0x3b6b66[_0x1d99('0x36')]=_0x3b6b66[_0x1d99('0x36')][_0x1d99('0x38')]?_0x3b6b66[_0x1d99('0x36')]:_0x280937[_0x1d99('0x32')];if(_0x41dc0e['query'][_0x1d99('0x43')]){_0x3b6b66[_0x1d99('0x44')]=[{'all':!![]}];}_0x3b6b66=_[_0x1d99('0x41')]({},_0x3b6b66,_0x41dc0e['options']);return db[_0x1d99('0x2d')]['find'](_0x3b6b66)[_0x1d99('0x25')](handleEntityNotFound(_0x16a423,null))[_0x1d99('0x25')](respondWithResult(_0x16a423,null))[_0x1d99('0x46')](handleError(_0x16a423,null));};exports[_0x1d99('0x4a')]=function(_0x9e43b6,_0x437f13){return db['WhatsappApplication'][_0x1d99('0x4a')](_0x9e43b6[_0x1d99('0x4b')],{})[_0x1d99('0x25')](respondWithResult(_0x437f13,0xc9))[_0x1d99('0x46')](handleError(_0x437f13,null));};exports[_0x1d99('0x24')]=function(_0x5e458b,_0x48affc){if(_0x5e458b['body']['id']){delete _0x5e458b[_0x1d99('0x4b')]['id'];}return db[_0x1d99('0x2d')]['find']({'where':{'id':_0x5e458b['params']['id']}})[_0x1d99('0x25')](handleEntityNotFound(_0x48affc,null))[_0x1d99('0x25')](saveUpdates(_0x5e458b[_0x1d99('0x4b')],null))[_0x1d99('0x25')](respondWithResult(_0x48affc,null))[_0x1d99('0x46')](handleError(_0x48affc,null));};exports[_0x1d99('0x26')]=function(_0x10d644,_0x184f0e){return db[_0x1d99('0x2d')][_0x1d99('0x4c')]({'where':{'id':_0x10d644[_0x1d99('0x48')]['id']}})[_0x1d99('0x25')](handleEntityNotFound(_0x184f0e,null))[_0x1d99('0x25')](removeEntity(_0x184f0e,null))[_0x1d99('0x46')](handleError(_0x184f0e,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 7bad81f..92288ea 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 _0xc978=['bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x5a4441,_0x4f3299){var _0x244031=function(_0xa2c0cd){while(--_0xa2c0cd){_0x5a4441['push'](_0x5a4441['shift']());}};_0x244031(++_0x4f3299);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var logger=require(_0x8c97('0x2'))(_0x8c97('0x3'));var moment=require(_0x8c97('0x4'));var BPromise=require(_0x8c97('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c97('0x6'));var rimraf=require(_0x8c97('0x7'));var config=require(_0x8c97('0x8'));var attributes=require(_0x8c97('0x9'));module[_0x8c97('0xa')]=function(_0x2a9434,_0xabd146){return _0x2a9434['define'](_0x8c97('0xb'),attributes,{'tableName':_0x8c97('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8c97('0xd'),'collate':_0x8c97('0xe')});}; \ No newline at end of file +var _0x495e=['moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','utf8mb4_unicode_ci','lodash','api'];(function(_0x2272b5,_0x362458){var _0x110156=function(_0x5c2e32){while(--_0x5c2e32){_0x2272b5['push'](_0x2272b5['shift']());}};_0x110156(++_0x362458);}(_0x495e,0xfb));var _0xe495=function(_0x1d30a3,_0x5f428c){_0x1d30a3=_0x1d30a3-0x0;var _0x32bba1=_0x495e[_0x1d30a3];return _0x32bba1;};'use strict';var _=require(_0xe495('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe495('0x1'));var moment=require(_0xe495('0x2'));var BPromise=require(_0xe495('0x3'));var rp=require(_0xe495('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe495('0x5'));var config=require(_0xe495('0x6'));var attributes=require(_0xe495('0x7'));module[_0xe495('0x8')]=function(_0x130db3,_0x467a69){return _0x130db3[_0xe495('0x9')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe495('0xa')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index e896644..a0d72d2 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','WhatsappApplication,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x2e5374,_0x195046){var _0x32ee76=function(_0xc45fcc){while(--_0xc45fcc){_0x2e5374['push'](_0x2e5374['shift']());}};_0x32ee76(++_0x195046);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0xa41a=['rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x54ace3,_0x5ae7a1){var _0x3c50d5=function(_0x4a97c8){while(--_0x4a97c8){_0x54ace3['push'](_0x54ace3['shift']());}};_0x3c50d5(++_0x5ae7a1);}(_0xa41a,0x6b));var _0xaa41=function(_0x5b6b2c,_0x17e6c9){_0x5b6b2c=_0x5b6b2c-0x0;var _0x3196a3=_0xa41a[_0x5b6b2c];return _0x3196a3;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 1728d86..5f68c0d 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 _0x4074=['destroy','removeTags','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete'];(function(_0x2421dc,_0x346e9b){var _0x3d515d=function(_0x415af5){while(--_0x415af5){_0x2421dc['push'](_0x2421dc['shift']());}};_0x3d515d(++_0x346e9b);}(_0x4074,0xf0));var _0x4407=function(_0x200ea3,_0x3c6a05){_0x200ea3=_0x200ea3-0x0;var _0x133fae=_0x4074[_0x200ea3];return _0x133fae;};'use strict';var multer=require(_0x4407('0x0'));var util=require(_0x4407('0x1'));var path=require(_0x4407('0x2'));var timeout=require('connect-timeout');var express=require(_0x4407('0x3'));var router=express[_0x4407('0x4')]();var fs_extra=require(_0x4407('0x5'));var auth=require(_0x4407('0x6'));var interaction=require(_0x4407('0x7'));var config=require(_0x4407('0x8'));var controller=require(_0x4407('0x9'));router[_0x4407('0xa')]('/',auth[_0x4407('0xb')](),controller[_0x4407('0xc')]);router['get'](_0x4407('0xd'),auth['isAuthenticated'](),controller[_0x4407('0xe')]);router[_0x4407('0xa')](_0x4407('0xf'),auth['isAuthenticated'](),controller['show']);router['get'](_0x4407('0x10'),auth[_0x4407('0xb')](),controller[_0x4407('0x11')]);router[_0x4407('0xa')](_0x4407('0x12'),auth[_0x4407('0xb')](),controller[_0x4407('0x13')]);router[_0x4407('0x14')]('/',auth[_0x4407('0xb')](),controller[_0x4407('0x15')]);router[_0x4407('0x14')]('/:id/messages',auth[_0x4407('0xb')](),controller[_0x4407('0x16')]);router['post'](_0x4407('0x17'),auth['isAuthenticated'](),interaction[_0x4407('0x18')](_0x4407('0x19'),_0x4407('0x1a')),controller[_0x4407('0x1b')]);router[_0x4407('0x1c')](_0x4407('0xf'),auth[_0x4407('0xb')](),interaction[_0x4407('0x18')]('whatsapp',_0x4407('0x1d')),controller[_0x4407('0x1e')]);router[_0x4407('0x1f')](_0x4407('0xf'),auth[_0x4407('0xb')](),interaction['tracked'](_0x4407('0x19'),'whatsappinteraction:destroy'),controller[_0x4407('0x20')]);router[_0x4407('0x1f')](_0x4407('0x17'),auth[_0x4407('0xb')](),controller[_0x4407('0x21')]);module['exports']=router; \ No newline at end of file +var _0xfd87=['index','/describe','describe','get','/:id','show','/:id/messages','/:id/download','download','post','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','whatsappinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated'];(function(_0x4800d4,_0x5a7d45){var _0x5ed2ae=function(_0x2f31ec){while(--_0x2f31ec){_0x4800d4['push'](_0x4800d4['shift']());}};_0x5ed2ae(++_0x5a7d45);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7fd8('0x0'));var util=require(_0x7fd8('0x1'));var path=require(_0x7fd8('0x2'));var timeout=require(_0x7fd8('0x3'));var express=require(_0x7fd8('0x4'));var router=express[_0x7fd8('0x5')]();var fs_extra=require(_0x7fd8('0x6'));var auth=require(_0x7fd8('0x7'));var interaction=require(_0x7fd8('0x8'));var config=require(_0x7fd8('0x9'));var controller=require(_0x7fd8('0xa'));router['get']('/',auth[_0x7fd8('0xb')](),controller[_0x7fd8('0xc')]);router['get'](_0x7fd8('0xd'),auth[_0x7fd8('0xb')](),controller[_0x7fd8('0xe')]);router[_0x7fd8('0xf')](_0x7fd8('0x10'),auth['isAuthenticated'](),controller[_0x7fd8('0x11')]);router[_0x7fd8('0xf')](_0x7fd8('0x12'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x7fd8('0x13'),auth['isAuthenticated'](),controller[_0x7fd8('0x14')]);router[_0x7fd8('0x15')]('/',auth[_0x7fd8('0xb')](),controller['create']);router[_0x7fd8('0x15')](_0x7fd8('0x12'),auth[_0x7fd8('0xb')](),controller[_0x7fd8('0x16')]);router[_0x7fd8('0x15')]('/:id/tags',auth[_0x7fd8('0xb')](),interaction[_0x7fd8('0x17')](_0x7fd8('0x18'),_0x7fd8('0x19')),controller[_0x7fd8('0x1a')]);router[_0x7fd8('0x1b')](_0x7fd8('0x10'),auth[_0x7fd8('0xb')](),interaction[_0x7fd8('0x17')](_0x7fd8('0x18'),_0x7fd8('0x1c')),controller['update']);router['delete']('/:id',auth[_0x7fd8('0xb')](),interaction[_0x7fd8('0x17')]('whatsapp',_0x7fd8('0x1d')),controller[_0x7fd8('0x1e')]);router[_0x7fd8('0x1f')](_0x7fd8('0x20'),auth[_0x7fd8('0xb')](),controller[_0x7fd8('0x21')]);module[_0x7fd8('0x22')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 93ba755..61eaa22 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 _0x1b20=['DATE','ENUM','out','BOOLEAN','moment','exports','STRING'];(function(_0x2900f8,_0x564d8b){var _0x59c827=function(_0x1bafca){while(--_0x1bafca){_0x2900f8['push'](_0x2900f8['shift']());}};_0x59c827(++_0x564d8b);}(_0x1b20,0x66));var _0x01b2=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1b20[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x01b2('0x0'));module[_0x01b2('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x01b2('0x2')]},'secondDisposition':{'type':Sequelize[_0x01b2('0x2')]},'thirdDisposition':{'type':Sequelize[_0x01b2('0x2')]},'note':{'type':Sequelize[_0x01b2('0x2')]},'phone':{'type':Sequelize[_0x01b2('0x2')]},'read1stAt':{'type':Sequelize[_0x01b2('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x01b2('0x4')]('in',_0x01b2('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x01b2('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x01b2('0x4')]('in',_0x01b2('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x01b2('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x374c=['moment','exports','BOOLEAN','DATE','STRING','out','ENUM'];(function(_0x588ddd,_0x5211b5){var _0x1d43c0=function(_0x47179f){while(--_0x47179f){_0x588ddd['push'](_0x588ddd['shift']());}};_0x1d43c0(++_0x5211b5);}(_0x374c,0x1e3));var _0xc374=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x374c[_0x1c8c28];return _0x1f59b4;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc374('0x0'));module[_0xc374('0x1')]={'closed':{'type':Sequelize[_0xc374('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc374('0x3')]},'disposition':{'type':Sequelize[_0xc374('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc374('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xc374('0x4')]},'read1stAt':{'type':Sequelize[_0xc374('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xc374('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc374('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc374('0x6')]('in',_0xc374('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc374('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index ae3ff50..e6b91db 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 _0x8166=['name','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','query','user','catch','show','keys','filters','intersection','model','fields','attributes','includeAll','options','find','create','body','params','describe','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','length','hasOwnProperty','nolimit','order','sort','pick','where','WhatsappInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','merge','rows','addTags','setTags','spread','Tag','whatsappInteractionTags:save','removeTags','toString','join','root','server','files','tmp','attachments','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','createdAt','Owner','get','mkdirSync','Whatsapp','format','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','rimraf','zip-dir','moment','bluebird','util','ejs','lodash','../../components/export/pdf','api','../../mysqldb','redis','localhost','register','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','end','sendStatus','error','stack'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8166,0xde));var _0x6816=function(_0x43444b,_0x8cf95b){_0x43444b=_0x43444b-0x0;var _0x392fe5=_0x8166[_0x43444b];return _0x392fe5;};'use strict';var rimraf=require(_0x6816('0x0'));var zipdir=require(_0x6816('0x1'));var moment=require(_0x6816('0x2'));var BPromise=require(_0x6816('0x3'));var util=require(_0x6816('0x4'));var path=require('path');var ejs=require(_0x6816('0x5'));var fs=require('fs');var _=require(_0x6816('0x6'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0x6816('0x7'));var logger=require('../../config/logger')(_0x6816('0x8'));var config=require('../../config/environment');var db=require(_0x6816('0x9'))['db'];config[_0x6816('0xa')]=_['defaults'](config[_0x6816('0xa')],{'host':_0x6816('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x6816('0xc')](socket);function respondWithStatusCode(_0x51427d,_0x3b996a){_0x3b996a=_0x3b996a||0xcc;return function(_0x4fdc7b){if(_0x4fdc7b){return _0x51427d['sendStatus'](_0x3b996a);}return _0x51427d[_0x6816('0xd')](_0x3b996a)['end']();};}function respondWithResult(_0x4f467f,_0x4cf36a){_0x4cf36a=_0x4cf36a||0xc8;return function(_0x443bd5){if(_0x443bd5){return _0x4f467f[_0x6816('0xd')](_0x4cf36a)['json'](_0x443bd5);}};}function respondWithFilteredResult(_0x23d520,_0x13c440){return function(_0x261fa3){if(_0x261fa3){var _0x4dd6ec=typeof _0x13c440[_0x6816('0xe')]===_0x6816('0xf')&&typeof _0x13c440[_0x6816('0x10')]===_0x6816('0xf');var _0x149aa0=_0x261fa3['count'];var _0x1d8d6d=_0x4dd6ec?0x0:_0x13c440[_0x6816('0xe')];var _0x4be552=_0x4dd6ec?_0x261fa3[_0x6816('0x11')]:_0x13c440[_0x6816('0xe')]+_0x13c440[_0x6816('0x10')];var _0x17c34d;if(_0x4be552>=_0x149aa0){_0x4be552=_0x149aa0;_0x17c34d=0xc8;}else{_0x17c34d=0xce;}_0x23d520['status'](_0x17c34d);return _0x23d520[_0x6816('0x12')](_0x6816('0x13'),_0x1d8d6d+'-'+_0x4be552+'/'+_0x149aa0)[_0x6816('0x14')](_0x261fa3);}return null;};}function saveUpdates(_0x289ba6){return function(_0x32acca){if(_0x32acca){return _0x32acca[_0x6816('0x15')](_0x289ba6)[_0x6816('0x16')](function(_0x532c63){return _0x532c63;});}return null;};}function removeEntity(_0x4d0ff7){return function(_0x417809){if(_0x417809){return _0x417809[_0x6816('0x17')]()[_0x6816('0x16')](function(){_0x4d0ff7['status'](0xcc)[_0x6816('0x18')]();});}};}function handleEntityNotFound(_0x584376){return function(_0x5c9293){if(!_0x5c9293){_0x584376[_0x6816('0x19')](0x194);}return _0x5c9293;};}function handleError(_0x2681e7,_0x325306){_0x325306=_0x325306||0x1f4;return function(_0x3258c6){logger[_0x6816('0x1a')](_0x3258c6[_0x6816('0x1b')]);if(_0x3258c6[_0x6816('0x1c')]){delete _0x3258c6[_0x6816('0x1c')];}_0x2681e7[_0x6816('0xd')](_0x325306)['send'](_0x3258c6);};}exports[_0x6816('0x1d')]=function(_0x5c7577,_0x1a7dce){var _0x5ca590={};var _0x4340eb=_[_0x6816('0x1e')](db[_0x6816('0x1f')][_0x6816('0x20')],function(_0x3f683a){return{'name':_0x3f683a[_0x6816('0x21')],'type':_0x3f683a[_0x6816('0x22')][_0x6816('0x23')]};});_0x5ca590=qs[_0x6816('0x24')](_0x4340eb,_0x5c7577);return interaction[_0x6816('0x25')](_0x6816('0x26'),_0x5c7577[_0x6816('0x27')],_0x5c7577[_0x6816('0x28')],_0x5ca590,_0x4340eb)[_0x6816('0x16')](respondWithFilteredResult(_0x1a7dce,_0x5ca590))[_0x6816('0x29')](handleError(_0x1a7dce,null));};exports[_0x6816('0x2a')]=function(_0x1741ad,_0x4b06db){var _0x58e04d={'raw':![],'where':{'id':_0x1741ad['params']['id']}},_0x44a04c={};_0x44a04c['model']=_[_0x6816('0x2b')](db['WhatsappInteraction'][_0x6816('0x20')]);_0x44a04c[_0x6816('0x27')]=_[_0x6816('0x2b')](_0x1741ad[_0x6816('0x27')]);_0x44a04c[_0x6816('0x2c')]=_[_0x6816('0x2d')](_0x44a04c[_0x6816('0x2e')],_0x44a04c[_0x6816('0x27')]);_0x58e04d['attributes']=_[_0x6816('0x2d')](_0x44a04c[_0x6816('0x2e')],qs['fields'](_0x1741ad[_0x6816('0x27')][_0x6816('0x2f')]));_0x58e04d[_0x6816('0x30')]=_0x58e04d[_0x6816('0x30')]['length']?_0x58e04d[_0x6816('0x30')]:_0x44a04c[_0x6816('0x2e')];if(_0x1741ad['query'][_0x6816('0x31')]){_0x58e04d['include']=[{'all':!![]}];}_0x58e04d=_['merge']({},_0x58e04d,_0x1741ad[_0x6816('0x32')]);return db[_0x6816('0x1f')][_0x6816('0x33')](_0x58e04d)[_0x6816('0x16')](handleEntityNotFound(_0x4b06db,null))[_0x6816('0x16')](respondWithResult(_0x4b06db,null))[_0x6816('0x29')](handleError(_0x4b06db,null));};exports[_0x6816('0x34')]=function(_0x1cbf5a,_0x517c2b){return db[_0x6816('0x1f')][_0x6816('0x34')](_0x1cbf5a[_0x6816('0x35')],{})[_0x6816('0x16')](respondWithResult(_0x517c2b,0xc9))[_0x6816('0x29')](handleError(_0x517c2b,null));};exports[_0x6816('0x15')]=function(_0x260a17,_0x2f6a41){if(_0x260a17['body']['id']){delete _0x260a17['body']['id'];}return db[_0x6816('0x1f')][_0x6816('0x33')]({'where':{'id':_0x260a17[_0x6816('0x36')]['id']}})[_0x6816('0x16')](handleEntityNotFound(_0x2f6a41,null))[_0x6816('0x16')](saveUpdates(_0x260a17['body'],null))[_0x6816('0x16')](respondWithResult(_0x2f6a41,null))['catch'](handleError(_0x2f6a41,null));};exports['destroy']=function(_0x3b599b,_0x55928d){return db[_0x6816('0x1f')][_0x6816('0x33')]({'where':{'id':_0x3b599b[_0x6816('0x36')]['id']}})[_0x6816('0x16')](handleEntityNotFound(_0x55928d,null))[_0x6816('0x16')](removeEntity(_0x55928d,null))['catch'](handleError(_0x55928d,null));};exports[_0x6816('0x37')]=function(_0x37e765,_0x5266f0){return db[_0x6816('0x1f')]['describe']()[_0x6816('0x16')](respondWithResult(_0x5266f0,null))[_0x6816('0x29')](handleError(_0x5266f0,null));};exports[_0x6816('0x38')]=function(_0x4a22cd,_0x128660){return db[_0x6816('0x39')][_0x6816('0x33')]({'where':{'id':_0x4a22cd[_0x6816('0x36')]['id']}})[_0x6816('0x16')](handleEntityNotFound(_0x128660,null))[_0x6816('0x16')](function(_0x5ed371){if(_0x5ed371){return _0x5ed371[_0x6816('0x38')](_0x4a22cd[_0x6816('0x35')]['ids'],_[_0x6816('0x3a')](_0x4a22cd['body'],[_0x6816('0x3b'),'id'])||{});}})[_0x6816('0x16')](respondWithResult(_0x128660,null))[_0x6816('0x29')](handleError(_0x128660,null));};exports[_0x6816('0x3c')]=function(_0x1de555,_0xb7c1e2){var _0xd1b943={'raw':![],'where':{}};var _0xe3e16e={};var _0x30f206={'count':0x0,'rows':[]};return db[_0x6816('0x1f')][_0x6816('0x3d')]({'where':{'id':_0x1de555[_0x6816('0x36')]['id']}})[_0x6816('0x16')](handleEntityNotFound(_0xb7c1e2,null))[_0x6816('0x16')](function(_0x123673){if(_0x123673){_0xe3e16e['model']=_[_0x6816('0x2b')](db[_0x6816('0x39')]['rawAttributes']);_0xe3e16e[_0x6816('0x27')]=_[_0x6816('0x2b')](_0x1de555[_0x6816('0x27')]);_0xe3e16e['filters']=_[_0x6816('0x2d')](_0xe3e16e[_0x6816('0x2e')],_0xe3e16e['query']);_0xd1b943[_0x6816('0x30')]=_['intersection'](_0xe3e16e['model'],qs['fields'](_0x1de555[_0x6816('0x27')]['fields']));_0xd1b943[_0x6816('0x30')]=_0xd1b943[_0x6816('0x30')][_0x6816('0x3e')]?_0xd1b943['attributes']:_0xe3e16e[_0x6816('0x2e')];if(!_0x1de555[_0x6816('0x27')][_0x6816('0x3f')](_0x6816('0x40'))){_0xd1b943[_0x6816('0x10')]=qs[_0x6816('0x10')](_0x1de555[_0x6816('0x27')][_0x6816('0x10')]);_0xd1b943[_0x6816('0xe')]=qs[_0x6816('0xe')](_0x1de555[_0x6816('0x27')][_0x6816('0xe')]);}_0xd1b943[_0x6816('0x41')]=qs['sort'](_0x1de555[_0x6816('0x27')][_0x6816('0x42')]);_0xd1b943['where']=qs['filters'](_[_0x6816('0x43')](_0x1de555[_0x6816('0x27')],_0xe3e16e[_0x6816('0x2c')]));_0xd1b943[_0x6816('0x44')][_0x6816('0x45')]=_0x123673['id'];if(_0x1de555[_0x6816('0x27')][_0x6816('0x46')]){_0xd1b943['where']=_['merge'](_0xd1b943[_0x6816('0x44')],{'$or':_[_0x6816('0x1e')](_0xd1b943[_0x6816('0x30')],function(_0x4a5b6e){var _0x12eb6c={};_0x12eb6c[_0x4a5b6e]={'$like':'%'+_0x1de555['query']['filter']+'%'};return _0x12eb6c;})});}if(_0x1de555[_0x6816('0x27')][_0x6816('0x47')]){var _0x171a8a=_0x1de555[_0x6816('0x27')]['$gte'][_0x6816('0x48')](',');var _0x3ddc4b={};_0x3ddc4b[_0x171a8a[0x0]]={'$gte':moment(_0x171a8a[0x1])['format'](_0x6816('0x49'))};_0xd1b943[_0x6816('0x44')]=_[_0x6816('0x4a')](_0xd1b943['where'],_0x3ddc4b);}_0xd1b943=_[_0x6816('0x4a')]({},_0xd1b943,_0x1de555['options']);return db[_0x6816('0x39')][_0x6816('0x11')]({'where':_0xd1b943[_0x6816('0x44')]})[_0x6816('0x16')](function(_0xa27dc){_0x30f206[_0x6816('0x11')]=_0xa27dc;if(_0x1de555['query'][_0x6816('0x31')]){_0xd1b943['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x6816('0x25')](_0xd1b943);})['then'](function(_0x27407c){_0x30f206[_0x6816('0x4b')]=_0x27407c;return _0x30f206;});}})[_0x6816('0x16')](respondWithFilteredResult(_0xb7c1e2,_0xd1b943))['catch'](handleError(_0xb7c1e2,null));};exports[_0x6816('0x4c')]=function(_0x49ad59,_0x5ab774){return db[_0x6816('0x1f')][_0x6816('0x33')]({'where':{'id':_0x49ad59[_0x6816('0x36')]['id']}})[_0x6816('0x16')](handleEntityNotFound(_0x5ab774,null))[_0x6816('0x16')](function(_0x4a6a1a){if(_0x4a6a1a){return _0x4a6a1a[_0x6816('0x4d')](_0x49ad59[_0x6816('0x35')][_0x6816('0x3b')],_['omit'](_0x49ad59[_0x6816('0x35')],[_0x6816('0x3b'),'id'])||{})[_0x6816('0x4e')](function(){return db[_0x6816('0x4f')][_0x6816('0x25')]({'attributes':['id',_0x6816('0x1c'),'color'],'where':{'id':_0x49ad59[_0x6816('0x35')][_0x6816('0x3b')]}});})['then'](function(_0x4423f3){socket['emit'](_0x6816('0x50'),{'id':Number(_0x49ad59[_0x6816('0x36')]['id']),'tags':_0x4423f3||[]});return{'id':Number(_0x49ad59[_0x6816('0x36')]['id']),'tags':_0x4423f3||[]};});}})[_0x6816('0x16')](respondWithResult(_0x5ab774,null))[_0x6816('0x29')](handleError(_0x5ab774,null));};exports['removeTags']=function(_0x3e37c4,_0x5a8935){return db['WhatsappInteraction']['find']({'where':{'id':_0x3e37c4[_0x6816('0x36')]['id']}})[_0x6816('0x16')](handleEntityNotFound(_0x5a8935,null))[_0x6816('0x16')](function(_0x5d1827){if(_0x5d1827){return _0x5d1827[_0x6816('0x51')](_0x3e37c4['query'][_0x6816('0x3b')]);}})[_0x6816('0x16')](respondWithStatusCode(_0x5a8935,null))[_0x6816('0x29')](handleError(_0x5a8935,null));};exports['download']=function(_0x3d1b91,_0x1027c8){var _0x1a495e=moment()['unix']()[_0x6816('0x52')]();var _0x2b6fb8=path[_0x6816('0x53')](config[_0x6816('0x54')],_0x6816('0x55'),_0x6816('0x56'),_0x6816('0x57'));var _0x397f53=path[_0x6816('0x53')](config['root'],_0x6816('0x55'),_0x6816('0x56'),_0x6816('0x58'));var _0x437f3b=path[_0x6816('0x53')](_0x2b6fb8,_0x1a495e);var _0x2b5b18=util['format']('transcript-%d-%s.zip',_0x3d1b91[_0x6816('0x36')]['id'],_0x1a495e);var _0x437dcf=path[_0x6816('0x53')](_0x2b6fb8,_0x2b5b18);var _0x3aa96c=[];_0x3aa96c[_0x6816('0x59')]({'model':db[_0x6816('0x5a')],'as':_0x6816('0x5a'),'attributes':['id',_0x6816('0x5b')],'raw':!![]});_0x3aa96c[_0x6816('0x59')]({'model':db[_0x6816('0x5c')],'as':_0x6816('0x5d'),'attributes':['id',_0x6816('0x5e'),_0x6816('0x5f')],'raw':!![]});if(_0x3d1b91[_0x6816('0x27')]['attachments']){_0x3aa96c[_0x6816('0x59')]({'model':db[_0x6816('0x60')],'as':'Attachment','raw':!![]});}var _0x54e087=[{'model':db[_0x6816('0x39')],'as':'Messages','attributes':['id',_0x6816('0x35'),_0x6816('0x61'),'direction','secret','read'],'include':_0x3aa96c}];_0x54e087[_0x6816('0x59')]({'model':db['WhatsappAccount'],'as':'Account','attributes':['id',_0x6816('0x1c')]});_0x54e087[_0x6816('0x59')]({'model':db[_0x6816('0x5a')],'as':_0x6816('0x62'),'attributes':['id',_0x6816('0x5b')]});return db[_0x6816('0x1f')][_0x6816('0x33')]({'where':{'id':_0x3d1b91[_0x6816('0x36')]['id']},'include':_0x54e087})['then'](handleEntityNotFound(_0x1027c8,null))[_0x6816('0x16')](function(_0x1bcec9){if(_0x1bcec9){var _0x283f56=_0x1bcec9[_0x6816('0x63')]({'plain':!![]});fs[_0x6816('0x64')](_0x437f3b);var _0x105e6a={'channel':_0x6816('0x65'),'account':_0x283f56['Account'][_0x6816('0x1c')],'agent':_0x283f56[_0x6816('0x62')]?_0x283f56[_0x6816('0x62')][_0x6816('0x5b')]:'N.A.','createdAt':moment(_0x283f56[_0x6816('0x61')])[_0x6816('0x66')](_0x6816('0x49'))[_0x6816('0x52')](),'closedAt':_0x283f56[_0x6816('0x67')]?moment(_0x283f56[_0x6816('0x68')])[_0x6816('0x66')](_0x6816('0x49'))[_0x6816('0x52')]():'','disposition':_0x283f56[_0x6816('0x69')],'messages':_(_0x283f56['Messages'])[_0x6816('0x46')]({'secret':![]})[_0x6816('0x1e')](function(_0x49c2f5){if(_0x49c2f5[_0x6816('0x60')]){var _0x4f045e=path['join'](_0x397f53,_0x49c2f5['Attachment'][_0x6816('0x6a')]);if(fs[_0x6816('0x6b')](_0x4f045e)){fs[_0x6816('0x6c')](_0x4f045e)[_0x6816('0x6d')](fs[_0x6816('0x6e')](path[_0x6816('0x53')](_0x437f3b,_0x49c2f5['Attachment'][_0x6816('0x6a')])));}}return{'date':moment(_0x49c2f5['createdAt'])[_0x6816('0x66')](_0x6816('0x49'))[_0x6816('0x52')](),'sender':_0x49c2f5[_0x6816('0x6f')]===_0x6816('0x70')?_0x49c2f5['User']?_0x49c2f5[_0x6816('0x5a')]['fullname']:_0x6816('0x71'):_0x49c2f5['Contact'][_0x6816('0x5e')]+(_0x49c2f5[_0x6816('0x5d')]['lastName']?'\x20'+_0x49c2f5[_0x6816('0x5d')][_0x6816('0x5f')]:''),'body':_0x49c2f5[_0x6816('0x60')]?_0x49c2f5[_0x6816('0x60')][_0x6816('0x6a')]:_0x49c2f5[_0x6816('0x35')],'direction':_0x49c2f5[_0x6816('0x6f')]==='out'?'A':'C','secret':_0x49c2f5['secret'],'read':_0x49c2f5[_0x6816('0x72')],'attachment':_0x49c2f5[_0x6816('0x60')]};})[_0x6816('0x73')]()};return ejs[_0x6816('0x74')](path['join'](config[_0x6816('0x54')],_0x6816('0x55'),_0x6816('0x75'),_0x6816('0x76')),{'interaction':_0x105e6a})[_0x6816('0x16')](function(_0x432c8b){var _0x3b63a7=path[_0x6816('0x53')](_0x437f3b,_0x6816('0x77')+_0x283f56['id']+'-'+_0x1a495e+_0x6816('0x78'));var _0x40e814={'path':_0x3b63a7,'channel':_0x6816('0x65'),'interactionId':_0x283f56['id']};return pdf[_0x6816('0x79')](_0x432c8b,_0x40e814);})['then'](function(){return new BPromise(function(_0x145002,_0x33e6fc){zipdir(_0x437f3b,{'saveTo':_0x437dcf},function(_0x13554e,_0xba9101){if(_0x13554e)return _0x33e6fc(_0x13554e);return _0x145002(_0xba9101);});})[_0x6816('0x16')](function(){return new BPromise(function(_0x4ed15f,_0x5b37c1){rimraf(_0x437f3b,function(_0x4326c3){if(_0x4326c3)_0x5b37c1(_0x4326c3);return _0x4ed15f();});});})[_0x6816('0x16')](function(){return _0x1027c8[_0x6816('0x7a')](_0x437dcf,_0x2b5b18,function(_0x3fd7e1){if(_0x3fd7e1){console[_0x6816('0x7b')](_0x6816('0x7c'),_0x3fd7e1);}else{fs['unlinkSync'](_0x437dcf);}});});});}else{return _0x1027c8['sendStatus'](0xc8);}})[_0x6816('0x29')](handleError(_0x1027c8,null));}; \ No newline at end of file +var _0xcf1a=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','name','send','index','WhatsappInteraction','fieldName','type','key','getOptions','whatsapp','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','includeAll','include','options','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','rawAttributes','nolimit','order','sort','pick','WhatsappInteractionId','filter','merge','where','split','format','YYYY-MM-DD\x20HH:mm:ss','setTags','spread','Tag','color','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','User','Contact','firstName','lastName','push','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','Owner','fullname','get','mkdirSync','N.A.','toString','closedAt','disposition','map','basename','pipe','System','out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','err','rimraf','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xcf1a,0x1e2));var _0xacf1=function(_0x33bc05,_0x243cdc){_0x33bc05=_0x33bc05-0x0;var _0x830049=_0xcf1a[_0x33bc05];return _0x830049;};'use strict';var rimraf=require(_0xacf1('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0xacf1('0x1'));var util=require(_0xacf1('0x2'));var path=require(_0xacf1('0x3'));var ejs=require(_0xacf1('0x4'));var fs=require('fs');var _=require(_0xacf1('0x5'));var Redis=require(_0xacf1('0x6'));var interaction=require(_0xacf1('0x7'));var qs=require(_0xacf1('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0xacf1('0x9'))('api');var config=require(_0xacf1('0xa'));var db=require(_0xacf1('0xb'))['db'];config['redis']=_[_0xacf1('0xc')](config[_0xacf1('0xd')],{'host':_0xacf1('0xe'),'port':0x18eb});var socket=require(_0xacf1('0xf'))(new Redis(config[_0xacf1('0xd')]));require(_0xacf1('0x10'))[_0xacf1('0x11')](socket);function respondWithStatusCode(_0x3aa6f3,_0x1da583){_0x1da583=_0x1da583||0xcc;return function(_0x27c486){if(_0x27c486){return _0x3aa6f3[_0xacf1('0x12')](_0x1da583);}return _0x3aa6f3[_0xacf1('0x13')](_0x1da583)[_0xacf1('0x14')]();};}function respondWithResult(_0x34f463,_0x5b37c0){_0x5b37c0=_0x5b37c0||0xc8;return function(_0x59dc95){if(_0x59dc95){return _0x34f463[_0xacf1('0x13')](_0x5b37c0)[_0xacf1('0x15')](_0x59dc95);}};}function respondWithFilteredResult(_0x1ba291,_0x5299ff){return function(_0x4fc7d5){if(_0x4fc7d5){var _0x1714b2=typeof _0x5299ff[_0xacf1('0x16')]===_0xacf1('0x17')&&typeof _0x5299ff[_0xacf1('0x18')]===_0xacf1('0x17');var _0x1c01b9=_0x4fc7d5[_0xacf1('0x19')];var _0x42b972=_0x1714b2?0x0:_0x5299ff[_0xacf1('0x16')];var _0x3dbedc=_0x1714b2?_0x4fc7d5[_0xacf1('0x19')]:_0x5299ff['offset']+_0x5299ff[_0xacf1('0x18')];var _0x2ee833;if(_0x3dbedc>=_0x1c01b9){_0x3dbedc=_0x1c01b9;_0x2ee833=0xc8;}else{_0x2ee833=0xce;}_0x1ba291[_0xacf1('0x13')](_0x2ee833);return _0x1ba291[_0xacf1('0x1a')](_0xacf1('0x1b'),_0x42b972+'-'+_0x3dbedc+'/'+_0x1c01b9)[_0xacf1('0x15')](_0x4fc7d5);}return null;};}function saveUpdates(_0x4ead46){return function(_0x226695){if(_0x226695){return _0x226695[_0xacf1('0x1c')](_0x4ead46)[_0xacf1('0x1d')](function(_0x5b7b8b){return _0x5b7b8b;});}return null;};}function removeEntity(_0x1b9858){return function(_0xe28458){if(_0xe28458){return _0xe28458[_0xacf1('0x1e')]()[_0xacf1('0x1d')](function(){_0x1b9858[_0xacf1('0x13')](0xcc)[_0xacf1('0x14')]();});}};}function handleEntityNotFound(_0x118f62){return function(_0x5972bb){if(!_0x5972bb){_0x118f62[_0xacf1('0x12')](0x194);}return _0x5972bb;};}function handleError(_0x4c35a9,_0x3f9153){_0x3f9153=_0x3f9153||0x1f4;return function(_0x4409fc){logger[_0xacf1('0x1f')](_0x4409fc['stack']);if(_0x4409fc[_0xacf1('0x20')]){delete _0x4409fc[_0xacf1('0x20')];}_0x4c35a9['status'](_0x3f9153)[_0xacf1('0x21')](_0x4409fc);};}exports[_0xacf1('0x22')]=function(_0x186966,_0x3dfedf){var _0x25856b={};var _0x4a3bd9=_['map'](db[_0xacf1('0x23')]['rawAttributes'],function(_0x3b7e20){return{'name':_0x3b7e20[_0xacf1('0x24')],'type':_0x3b7e20[_0xacf1('0x25')][_0xacf1('0x26')]};});_0x25856b=qs[_0xacf1('0x27')](_0x4a3bd9,_0x186966);return interaction['findAll'](_0xacf1('0x28'),_0x186966[_0xacf1('0x29')],_0x186966[_0xacf1('0x2a')],_0x25856b,_0x4a3bd9)['then'](respondWithFilteredResult(_0x3dfedf,_0x25856b))[_0xacf1('0x2b')](handleError(_0x3dfedf,null));};exports[_0xacf1('0x2c')]=function(_0x57fc33,_0x1576a1){var _0x1583ad={'raw':![],'where':{'id':_0x57fc33[_0xacf1('0x2d')]['id']}},_0x398eb6={};_0x398eb6[_0xacf1('0x2e')]=_[_0xacf1('0x2f')](db[_0xacf1('0x23')]['rawAttributes']);_0x398eb6['query']=_['keys'](_0x57fc33['query']);_0x398eb6[_0xacf1('0x30')]=_[_0xacf1('0x31')](_0x398eb6['model'],_0x398eb6[_0xacf1('0x29')]);_0x1583ad[_0xacf1('0x32')]=_['intersection'](_0x398eb6['model'],qs['fields'](_0x57fc33[_0xacf1('0x29')][_0xacf1('0x33')]));_0x1583ad['attributes']=_0x1583ad[_0xacf1('0x32')]['length']?_0x1583ad['attributes']:_0x398eb6[_0xacf1('0x2e')];if(_0x57fc33[_0xacf1('0x29')][_0xacf1('0x34')]){_0x1583ad[_0xacf1('0x35')]=[{'all':!![]}];}_0x1583ad=_['merge']({},_0x1583ad,_0x57fc33[_0xacf1('0x36')]);return db['WhatsappInteraction'][_0xacf1('0x37')](_0x1583ad)[_0xacf1('0x1d')](handleEntityNotFound(_0x1576a1,null))[_0xacf1('0x1d')](respondWithResult(_0x1576a1,null))[_0xacf1('0x2b')](handleError(_0x1576a1,null));};exports[_0xacf1('0x38')]=function(_0x3958f3,_0x4315d9){return db['WhatsappInteraction']['create'](_0x3958f3[_0xacf1('0x39')],{})[_0xacf1('0x1d')](respondWithResult(_0x4315d9,0xc9))[_0xacf1('0x2b')](handleError(_0x4315d9,null));};exports['update']=function(_0x4ef768,_0xc418c6){if(_0x4ef768[_0xacf1('0x39')]['id']){delete _0x4ef768['body']['id'];}return db['WhatsappInteraction']['find']({'where':{'id':_0x4ef768['params']['id']}})[_0xacf1('0x1d')](handleEntityNotFound(_0xc418c6,null))[_0xacf1('0x1d')](saveUpdates(_0x4ef768[_0xacf1('0x39')],null))['then'](respondWithResult(_0xc418c6,null))[_0xacf1('0x2b')](handleError(_0xc418c6,null));};exports['destroy']=function(_0x3eab92,_0x43b0e4){return db[_0xacf1('0x23')][_0xacf1('0x37')]({'where':{'id':_0x3eab92[_0xacf1('0x2d')]['id']}})['then'](handleEntityNotFound(_0x43b0e4,null))[_0xacf1('0x1d')](removeEntity(_0x43b0e4,null))['catch'](handleError(_0x43b0e4,null));};exports[_0xacf1('0x3a')]=function(_0x42963b,_0x5a945f){return db['WhatsappInteraction'][_0xacf1('0x3a')]()['then'](respondWithResult(_0x5a945f,null))[_0xacf1('0x2b')](handleError(_0x5a945f,null));};exports[_0xacf1('0x3b')]=function(_0x53ebd8,_0x196c64){return db['WhatsappMessage']['find']({'where':{'id':_0x53ebd8[_0xacf1('0x2d')]['id']}})[_0xacf1('0x1d')](handleEntityNotFound(_0x196c64,null))[_0xacf1('0x1d')](function(_0x39162f){if(_0x39162f){return _0x39162f[_0xacf1('0x3b')](_0x53ebd8['body'][_0xacf1('0x3c')],_[_0xacf1('0x3d')](_0x53ebd8[_0xacf1('0x39')],[_0xacf1('0x3c'),'id'])||{});}})[_0xacf1('0x1d')](respondWithResult(_0x196c64,null))['catch'](handleError(_0x196c64,null));};exports[_0xacf1('0x3e')]=function(_0x13731b,_0x599239){var _0x527264={'raw':![],'where':{}};var _0x3200f1={};var _0x4af0c7={'count':0x0,'rows':[]};return db[_0xacf1('0x23')][_0xacf1('0x3f')]({'where':{'id':_0x13731b[_0xacf1('0x2d')]['id']}})[_0xacf1('0x1d')](handleEntityNotFound(_0x599239,null))[_0xacf1('0x1d')](function(_0x587029){if(_0x587029){_0x3200f1[_0xacf1('0x2e')]=_['keys'](db[_0xacf1('0x40')][_0xacf1('0x41')]);_0x3200f1[_0xacf1('0x29')]=_[_0xacf1('0x2f')](_0x13731b['query']);_0x3200f1['filters']=_['intersection'](_0x3200f1[_0xacf1('0x2e')],_0x3200f1[_0xacf1('0x29')]);_0x527264['attributes']=_[_0xacf1('0x31')](_0x3200f1[_0xacf1('0x2e')],qs[_0xacf1('0x33')](_0x13731b[_0xacf1('0x29')][_0xacf1('0x33')]));_0x527264[_0xacf1('0x32')]=_0x527264['attributes']['length']?_0x527264[_0xacf1('0x32')]:_0x3200f1['model'];if(!_0x13731b[_0xacf1('0x29')]['hasOwnProperty'](_0xacf1('0x42'))){_0x527264[_0xacf1('0x18')]=qs[_0xacf1('0x18')](_0x13731b['query']['limit']);_0x527264[_0xacf1('0x16')]=qs[_0xacf1('0x16')](_0x13731b['query'][_0xacf1('0x16')]);}_0x527264[_0xacf1('0x43')]=qs['sort'](_0x13731b[_0xacf1('0x29')][_0xacf1('0x44')]);_0x527264['where']=qs[_0xacf1('0x30')](_[_0xacf1('0x45')](_0x13731b['query'],_0x3200f1['filters']));_0x527264['where'][_0xacf1('0x46')]=_0x587029['id'];if(_0x13731b[_0xacf1('0x29')][_0xacf1('0x47')]){_0x527264['where']=_[_0xacf1('0x48')](_0x527264[_0xacf1('0x49')],{'$or':_['map'](_0x527264[_0xacf1('0x32')],function(_0x30ac27){var _0x24afa0={};_0x24afa0[_0x30ac27]={'$like':'%'+_0x13731b['query']['filter']+'%'};return _0x24afa0;})});}if(_0x13731b[_0xacf1('0x29')]['$gte']){var _0x11e266=_0x13731b[_0xacf1('0x29')]['$gte'][_0xacf1('0x4a')](',');var _0x2fe5cd={};_0x2fe5cd[_0x11e266[0x0]]={'$gte':moment(_0x11e266[0x1])[_0xacf1('0x4b')](_0xacf1('0x4c'))};_0x527264[_0xacf1('0x49')]=_[_0xacf1('0x48')](_0x527264['where'],_0x2fe5cd);}_0x527264=_[_0xacf1('0x48')]({},_0x527264,_0x13731b[_0xacf1('0x36')]);return db[_0xacf1('0x40')][_0xacf1('0x19')]({'where':_0x527264['where']})[_0xacf1('0x1d')](function(_0x423b68){_0x4af0c7[_0xacf1('0x19')]=_0x423b68;if(_0x13731b[_0xacf1('0x29')][_0xacf1('0x34')]){_0x527264['include']=[{'all':!![]}];}return db[_0xacf1('0x40')]['findAll'](_0x527264);})[_0xacf1('0x1d')](function(_0x430b63){_0x4af0c7['rows']=_0x430b63;return _0x4af0c7;});}})[_0xacf1('0x1d')](respondWithFilteredResult(_0x599239,_0x527264))['catch'](handleError(_0x599239,null));};exports['addTags']=function(_0x125364,_0x3cc70d){return db[_0xacf1('0x23')][_0xacf1('0x37')]({'where':{'id':_0x125364['params']['id']}})['then'](handleEntityNotFound(_0x3cc70d,null))['then'](function(_0x759054){if(_0x759054){return _0x759054[_0xacf1('0x4d')](_0x125364[_0xacf1('0x39')]['ids'],_['omit'](_0x125364[_0xacf1('0x39')],[_0xacf1('0x3c'),'id'])||{})[_0xacf1('0x4e')](function(){return db[_0xacf1('0x4f')]['findAll']({'attributes':['id','name',_0xacf1('0x50')],'where':{'id':_0x125364['body'][_0xacf1('0x3c')]}});})[_0xacf1('0x1d')](function(_0x37730b){socket['emit'](_0xacf1('0x51'),{'id':Number(_0x125364[_0xacf1('0x2d')]['id']),'tags':_0x37730b||[]});return{'id':Number(_0x125364[_0xacf1('0x2d')]['id']),'tags':_0x37730b||[]};});}})[_0xacf1('0x1d')](respondWithResult(_0x3cc70d,null))[_0xacf1('0x2b')](handleError(_0x3cc70d,null));};exports[_0xacf1('0x52')]=function(_0xbeb5b1,_0x4e0d15){return db['WhatsappInteraction']['find']({'where':{'id':_0xbeb5b1['params']['id']}})[_0xacf1('0x1d')](handleEntityNotFound(_0x4e0d15,null))[_0xacf1('0x1d')](function(_0x229a06){if(_0x229a06){return _0x229a06[_0xacf1('0x52')](_0xbeb5b1[_0xacf1('0x29')]['ids']);}})[_0xacf1('0x1d')](respondWithStatusCode(_0x4e0d15,null))[_0xacf1('0x2b')](handleError(_0x4e0d15,null));};exports[_0xacf1('0x53')]=function(_0x1d137e,_0x13671e){var _0x1baa0b=moment()[_0xacf1('0x54')]()['toString']();var _0x18819a=path[_0xacf1('0x55')](config[_0xacf1('0x56')],_0xacf1('0x57'),_0xacf1('0x58'),_0xacf1('0x59'));var _0x43baab=path[_0xacf1('0x55')](config[_0xacf1('0x56')],_0xacf1('0x57'),_0xacf1('0x58'),_0xacf1('0x5a'));var _0x16439e=path[_0xacf1('0x55')](_0x18819a,_0x1baa0b);var _0x97fb80=util[_0xacf1('0x4b')]('transcript-%d-%s.zip',_0x1d137e[_0xacf1('0x2d')]['id'],_0x1baa0b);var _0x5b709d=path['join'](_0x18819a,_0x97fb80);var _0x517fc5=[];_0x517fc5['push']({'model':db['User'],'as':_0xacf1('0x5b'),'attributes':['id','fullname'],'raw':!![]});_0x517fc5['push']({'model':db['CmContact'],'as':_0xacf1('0x5c'),'attributes':['id',_0xacf1('0x5d'),_0xacf1('0x5e')],'raw':!![]});if(_0x1d137e[_0xacf1('0x29')][_0xacf1('0x5a')]){_0x517fc5[_0xacf1('0x5f')]({'model':db[_0xacf1('0x60')],'as':_0xacf1('0x60'),'raw':!![]});}var _0x2b86ef=[{'model':db['WhatsappMessage'],'as':_0xacf1('0x61'),'attributes':['id',_0xacf1('0x39'),_0xacf1('0x62'),_0xacf1('0x63'),_0xacf1('0x64'),_0xacf1('0x65')],'include':_0x517fc5}];_0x2b86ef[_0xacf1('0x5f')]({'model':db[_0xacf1('0x66')],'as':_0xacf1('0x67'),'attributes':['id',_0xacf1('0x20')]});_0x2b86ef[_0xacf1('0x5f')]({'model':db[_0xacf1('0x5b')],'as':_0xacf1('0x68'),'attributes':['id',_0xacf1('0x69')]});return db[_0xacf1('0x23')][_0xacf1('0x37')]({'where':{'id':_0x1d137e[_0xacf1('0x2d')]['id']},'include':_0x2b86ef})[_0xacf1('0x1d')](handleEntityNotFound(_0x13671e,null))[_0xacf1('0x1d')](function(_0xf73b2e){if(_0xf73b2e){var _0x28da7c=_0xf73b2e[_0xacf1('0x6a')]({'plain':!![]});fs[_0xacf1('0x6b')](_0x16439e);var _0x59c0a5={'channel':'Whatsapp','account':_0x28da7c[_0xacf1('0x67')]['name'],'agent':_0x28da7c[_0xacf1('0x68')]?_0x28da7c[_0xacf1('0x68')]['fullname']:_0xacf1('0x6c'),'createdAt':moment(_0x28da7c[_0xacf1('0x62')])[_0xacf1('0x4b')](_0xacf1('0x4c'))[_0xacf1('0x6d')](),'closedAt':_0x28da7c['closed']?moment(_0x28da7c[_0xacf1('0x6e')])[_0xacf1('0x4b')](_0xacf1('0x4c'))['toString']():'','disposition':_0x28da7c[_0xacf1('0x6f')],'messages':_(_0x28da7c[_0xacf1('0x61')])[_0xacf1('0x47')]({'secret':![]})[_0xacf1('0x70')](function(_0x4407a6){if(_0x4407a6[_0xacf1('0x60')]){var _0x29708b=path[_0xacf1('0x55')](_0x43baab,_0x4407a6['Attachment'][_0xacf1('0x71')]);if(fs['existsSync'](_0x29708b)){fs['createReadStream'](_0x29708b)[_0xacf1('0x72')](fs['createWriteStream'](path[_0xacf1('0x55')](_0x16439e,_0x4407a6[_0xacf1('0x60')][_0xacf1('0x71')])));}}return{'date':moment(_0x4407a6[_0xacf1('0x62')])[_0xacf1('0x4b')](_0xacf1('0x4c'))[_0xacf1('0x6d')](),'sender':_0x4407a6[_0xacf1('0x63')]==='out'?_0x4407a6[_0xacf1('0x5b')]?_0x4407a6['User'][_0xacf1('0x69')]:_0xacf1('0x73'):_0x4407a6[_0xacf1('0x5c')][_0xacf1('0x5d')]+(_0x4407a6['Contact'][_0xacf1('0x5e')]?'\x20'+_0x4407a6['Contact'][_0xacf1('0x5e')]:''),'body':_0x4407a6[_0xacf1('0x60')]?_0x4407a6[_0xacf1('0x60')][_0xacf1('0x71')]:_0x4407a6['body'],'direction':_0x4407a6[_0xacf1('0x63')]===_0xacf1('0x74')?'A':'C','secret':_0x4407a6['secret'],'read':_0x4407a6[_0xacf1('0x65')],'attachment':_0x4407a6[_0xacf1('0x60')]};})[_0xacf1('0x75')]()};return ejs[_0xacf1('0x76')](path[_0xacf1('0x55')](config[_0xacf1('0x56')],_0xacf1('0x57'),_0xacf1('0x77'),_0xacf1('0x78')),{'interaction':_0x59c0a5})[_0xacf1('0x1d')](function(_0x377af2){var _0x2ab82e=path[_0xacf1('0x55')](_0x16439e,_0xacf1('0x79')+_0x28da7c['id']+'-'+_0x1baa0b+_0xacf1('0x7a'));var _0x3d9c72={'path':_0x2ab82e,'channel':_0xacf1('0x7b'),'interactionId':_0x28da7c['id']};return pdf['createPdfFromHTML'](_0x377af2,_0x3d9c72);})[_0xacf1('0x1d')](function(){return new BPromise(function(_0x5dc6d6,_0x4ce0c9){zipdir(_0x16439e,{'saveTo':_0x5b709d},function(_0x416124,_0x189158){if(_0x416124)return _0x4ce0c9(_0x416124);return _0x5dc6d6(_0x189158);});})['then'](function(){return new BPromise(function(_0x433b29,_0x4cdbc7){rimraf(_0x16439e,function(_0x30b7c9){if(_0x30b7c9)_0x4cdbc7(_0x30b7c9);return _0x433b29();});});})[_0xacf1('0x1d')](function(){return _0x13671e[_0xacf1('0x53')](_0x5b709d,_0x97fb80,function(_0x3240c9){if(_0x3240c9){console['log'](_0xacf1('0x7c'),_0x3240c9);}else{fs['unlinkSync'](_0x5b709d);}});});});}else{return _0x13671e[_0xacf1('0x12')](0xc8);}})[_0xacf1('0x2b')](handleError(_0x13671e,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index abe41c8..0f770ff 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 _0x2a41=['update','remove','getUsers','setDataValue','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','save'];(function(_0x33c880,_0x4df440){var _0x17ea5a=function(_0x15109a){while(--_0x15109a){_0x33c880['push'](_0x33c880['shift']());}};_0x17ea5a(++_0x4df440);}(_0x2a41,0x126));var _0x12a4=function(_0x2d61ac,_0x18ff36){_0x2d61ac=_0x2d61ac-0x0;var _0x3f7d3c=_0x2a41[_0x2d61ac];return _0x3f7d3c;};'use strict';var EventEmitter=require(_0x12a4('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x12a4('0x1')];var WhatsappMessage=require(_0x12a4('0x2'))['db'][_0x12a4('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x12a4('0x4')](0x0);var events={'afterCreate':_0x12a4('0x5'),'afterUpdate':_0x12a4('0x6'),'afterDestroy':_0x12a4('0x7')};function emitEvent(_0x28a00e){return function(_0x3ae504,_0x501fcf,_0x379b3c){_0x3ae504[_0x12a4('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5d2353){_0x3ae504[_0x12a4('0x9')]('Users',_0x5d2353[_0x12a4('0xa')](function(_0x3eeef7){return{'id':_0x3eeef7['id']};}));return WhatsappMessage[_0x12a4('0xb')]({'where':{'WhatsappInteractionId':_0x3ae504['id'],'direction':'in','read':![]},'raw':!![]});})[_0x12a4('0xc')](function(_0x3d8beb){_0x3ae504['setDataValue'](_0x12a4('0xd'),_0x3d8beb[_0x12a4('0xe')]);WhatsappInteractionEvents[_0x12a4('0xf')](_0x28a00e+':'+_0x3ae504['id'],_0x3ae504);WhatsappInteractionEvents[_0x12a4('0xf')](_0x28a00e,_0x3ae504);_0x379b3c(null);})[_0x12a4('0x10')](_0x379b3c(null));};}for(var e in events){if(events[_0x12a4('0x11')](e)){var event=events[e];WhatsappInteraction[_0x12a4('0x12')](e,emitEvent(event));}}module[_0x12a4('0x13')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x44d4=['catch','hasOwnProperty','exports','events','WhatsappMessage','setMaxListeners','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit'];(function(_0x2e14e3,_0x1ed432){var _0x173c9b=function(_0x4caeb6){while(--_0x4caeb6){_0x2e14e3['push'](_0x2e14e3['shift']());}};_0x173c9b(++_0x1ed432);}(_0x44d4,0x161));var _0x444d=function(_0x15bb22,_0x382cf5){_0x15bb22=_0x15bb22-0x0;var _0x6751c7=_0x44d4[_0x15bb22];return _0x6751c7;};'use strict';var EventEmitter=require(_0x444d('0x0'));var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db'][_0x444d('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x444d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1c3432){return function(_0xd2363d,_0x1e49b8,_0x24f601){_0xd2363d[_0x444d('0x3')]({'attributes':['id'],'raw':!![]})[_0x444d('0x4')](function(_0x300f01){_0xd2363d['setDataValue'](_0x444d('0x5'),_0x300f01['map'](function(_0x2324ed){return{'id':_0x2324ed['id']};}));return WhatsappMessage[_0x444d('0x6')]({'where':{'WhatsappInteractionId':_0xd2363d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x444d('0x4')](function(_0x3982b2){_0xd2363d[_0x444d('0x7')](_0x444d('0x8'),_0x3982b2[_0x444d('0x9')]);WhatsappInteractionEvents[_0x444d('0xa')](_0x1c3432+':'+_0xd2363d['id'],_0xd2363d);WhatsappInteractionEvents[_0x444d('0xa')](_0x1c3432,_0xd2363d);_0x24f601(null);})[_0x444d('0xb')](_0x24f601(null));};}for(var e in events){if(events[_0x444d('0xc')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x444d('0xd')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 4fb24d2..f26ce07 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 _0xe8b0=['rimraf','define','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x289c9d,_0x55993d){var _0x3b749c=function(_0x3fba0f){while(--_0x3fba0f){_0x289c9d['push'](_0x289c9d['shift']());}};_0x3b749c(++_0x55993d);}(_0xe8b0,0x1bb));var _0x0e8b=function(_0x5eda1b,_0x4bedc1){_0x5eda1b=_0x5eda1b-0x0;var _0x5d1322=_0xe8b0[_0x5eda1b];return _0x5d1322;};'use strict';var _=require('lodash');var util=require(_0x0e8b('0x0'));var logger=require(_0x0e8b('0x1'))(_0x0e8b('0x2'));var moment=require(_0x0e8b('0x3'));var BPromise=require(_0x0e8b('0x4'));var rp=require(_0x0e8b('0x5'));var fs=require('fs');var path=require(_0x0e8b('0x6'));var rimraf=require(_0x0e8b('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x14e1d2,_0x2eb694){return _0x14e1d2[_0x0e8b('0x8')](_0x0e8b('0x9'),attributes,{'tableName':_0x0e8b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x49e69b,_0x9445fa,_0xe3ab79){if(_0x49e69b['changed'](_0x0e8b('0xb'))){_0x49e69b[_0x0e8b('0xc')]=moment()[_0x0e8b('0xd')](_0x0e8b('0xe'));}_0xe3ab79(null,_0x49e69b);}}});}; \ No newline at end of file +var _0xdbd7=['exports','WhatsappInteraction','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./whatsappInteraction.attributes'];(function(_0x3afcf5,_0x62ddd1){var _0x4ea156=function(_0x209aa9){while(--_0x209aa9){_0x3afcf5['push'](_0x3afcf5['shift']());}};_0x4ea156(++_0x62ddd1);}(_0xdbd7,0x1e4));var _0x7dbd=function(_0x4832b8,_0x1cde29){_0x4832b8=_0x4832b8-0x0;var _0x425045=_0xdbd7[_0x4832b8];return _0x425045;};'use strict';var _=require(_0x7dbd('0x0'));var util=require(_0x7dbd('0x1'));var logger=require(_0x7dbd('0x2'))('api');var moment=require(_0x7dbd('0x3'));var BPromise=require(_0x7dbd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7dbd('0x5'));var config=require(_0x7dbd('0x6'));var attributes=require(_0x7dbd('0x7'));module[_0x7dbd('0x8')]=function(_0x2956ec,_0x3d449b){return _0x2956ec['define'](_0x7dbd('0x9'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x48b32e,_0x117103,_0xd0683d){if(_0x48b32e['changed'](_0x7dbd('0xa'))){_0x48b32e['closedAt']=moment()['format'](_0x7dbd('0xb'));}_0xd0683d(null,_0x48b32e);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 2c25d54..2f41f1a 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 _0x587d=['defaults','socket.io-emitter','./whatsappInteraction.socket','register','request','info','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','then','debug','AddTagsToWhatsappInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis'];(function(_0x3a9f07,_0x402524){var _0x58350e=function(_0x3fbd0f){while(--_0x3fbd0f){_0x3a9f07['push'](_0x3a9f07['shift']());}};_0x58350e(++_0x402524);}(_0x587d,0xc6));var _0xd587=function(_0x17640c,_0x2835bd){_0x17640c=_0x17640c-0x0;var _0x21125e=_0x587d[_0x17640c];return _0x21125e;};'use strict';var _=require(_0xd587('0x0'));var util=require(_0xd587('0x1'));var moment=require(_0xd587('0x2'));var BPromise=require('bluebird');var rs=require(_0xd587('0x3'));var fs=require('fs');var Redis=require(_0xd587('0x4'));var db=require(_0xd587('0x5'))['db'];var utils=require(_0xd587('0x6'));var logger=require(_0xd587('0x7'))(_0xd587('0x8'));var config=require(_0xd587('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd587('0xa')]({'port':0x232a});config[_0xd587('0xb')]=_[_0xd587('0xc')](config[_0xd587('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd587('0xd'))(new Redis(config[_0xd587('0xb')]));require(_0xd587('0xe'))[_0xd587('0xf')](socket);function respondWithRpcPromise(_0x1c5f86,_0x563e7c,_0x5a3396){return new BPromise(function(_0x179c68,_0x1f73ea){return client[_0xd587('0x10')](_0x1c5f86,_0x5a3396)['then'](function(_0x1b92da){logger[_0xd587('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x563e7c,_0xd587('0x12'));logger['debug'](_0xd587('0x13'),_0x563e7c,_0xd587('0x12'),JSON[_0xd587('0x14')](_0x1b92da));if(_0x1b92da[_0xd587('0x15')]){if(_0x1b92da['error'][_0xd587('0x16')]===0x1f4){logger[_0xd587('0x15')](_0xd587('0x17'),_0x563e7c,_0x1b92da['error']['message']);return _0x1f73ea(_0x1b92da[_0xd587('0x15')][_0xd587('0x18')]);}logger[_0xd587('0x15')](_0xd587('0x17'),_0x563e7c,_0x1b92da[_0xd587('0x15')]['message']);return _0x179c68(_0x1b92da['error'][_0xd587('0x18')]);}else{logger['info'](_0xd587('0x17'),_0x563e7c,'request\x20sent');_0x179c68(_0x1b92da['result'][_0xd587('0x18')]);}})[_0xd587('0x19')](function(_0xeb1ba6){logger[_0xd587('0x15')](_0xd587('0x17'),_0x563e7c,_0xeb1ba6);_0x1f73ea(_0xeb1ba6);});});}exports[_0xd587('0x1a')]=function(_0x14f49a){var _0x5808da=this;return new Promise(function(_0x2df8d1,_0x1b20fd){return db[_0xd587('0x1b')][_0xd587('0x1c')](_0x14f49a[_0xd587('0x1d')],{'raw':_0x14f49a[_0xd587('0x1e')]?_0x14f49a['options'][_0xd587('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14f49a[_0xd587('0x1e')]?_0x14f49a[_0xd587('0x1e')][_0xd587('0x20')]||null:null,'attributes':_0x14f49a[_0xd587('0x1e')]?_0x14f49a[_0xd587('0x1e')][_0xd587('0x21')]||null:null,'limit':_0x14f49a[_0xd587('0x1e')]?_0x14f49a[_0xd587('0x1e')]['limit']||null:null})[_0xd587('0x22')](function(_0x33094d){logger[_0xd587('0x11')](_0xd587('0x1a'),_0x14f49a);logger[_0xd587('0x23')](_0xd587('0x1a'),_0x14f49a,JSON[_0xd587('0x14')](_0x33094d));_0x2df8d1(_0x33094d);})['catch'](function(_0x2d1304){logger[_0xd587('0x15')](_0xd587('0x1a'),_0x2d1304['message'],_0x14f49a);_0x1b20fd(_0x5808da[_0xd587('0x15')](0x1f4,_0x2d1304[_0xd587('0x18')]));});});};exports[_0xd587('0x24')]=function(_0x2deede){return new Promise(function(_0x428f14,_0x4127ba){return db[_0xd587('0x1b')][_0xd587('0x25')]({'where':_0x2deede[_0xd587('0x1e')]?_0x2deede['options'][_0xd587('0x20')]||null:null})['then'](function(_0x7e3cd2){if(_0x7e3cd2){return _0x7e3cd2[_0xd587('0x26')](_0x2deede[_0xd587('0x1d')][_0xd587('0x27')],_['omit'](_0x2deede[_0xd587('0x1d')],[_0xd587('0x27'),'id'])||{});}})[_0xd587('0x28')](function(_0x442f3f){logger[_0xd587('0x11')](_0xd587('0x29'),_0x2deede);logger['debug'](_0xd587('0x29'),_0x2deede,JSON[_0xd587('0x14')](_0x442f3f));_0x428f14(_0x442f3f);})[_0xd587('0x19')](function(_0x11a7da){logger[_0xd587('0x15')](_0xd587('0x29'),_0x11a7da[_0xd587('0x18')],_0x2deede);_0x4127ba(_this['error'](0x1f4,_0x11a7da[_0xd587('0x18')]));});});}; \ No newline at end of file +var _0xa8b9=['where','addTags','omit','ids','AddTags','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','attributes','limit','AddTagsToWhatsappInteraction','find'];(function(_0x48c615,_0x4cc757){var _0x3d9e22=function(_0x1ee9f2){while(--_0x1ee9f2){_0x48c615['push'](_0x48c615['shift']());}};_0x3d9e22(++_0x4cc757);}(_0xa8b9,0x1bd));var _0x9a8b=function(_0x63e1cf,_0x1a93fb){_0x63e1cf=_0x63e1cf-0x0;var _0x13cb9f=_0xa8b9[_0x63e1cf];return _0x13cb9f;};'use strict';var _=require(_0x9a8b('0x0'));var util=require(_0x9a8b('0x1'));var moment=require(_0x9a8b('0x2'));var BPromise=require('bluebird');var rs=require(_0x9a8b('0x3'));var fs=require('fs');var Redis=require(_0x9a8b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9a8b('0x5'))(_0x9a8b('0x6'));var config=require(_0x9a8b('0x7'));var jayson=require(_0x9a8b('0x8'));var client=jayson['client'][_0x9a8b('0x9')]({'port':0x232a});config[_0x9a8b('0xa')]=_['defaults'](config[_0x9a8b('0xa')],{'host':_0x9a8b('0xb'),'port':0x18eb});var socket=require(_0x9a8b('0xc'))(new Redis(config['redis']));require(_0x9a8b('0xd'))['register'](socket);function respondWithRpcPromise(_0x4d1230,_0x5756be,_0x29893e){return new BPromise(function(_0x2b17dd,_0x3d95ba){return client['request'](_0x4d1230,_0x29893e)[_0x9a8b('0xe')](function(_0x2d4027){logger[_0x9a8b('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x5756be,_0x9a8b('0x10'));logger[_0x9a8b('0x11')](_0x9a8b('0x12'),_0x5756be,_0x9a8b('0x10'),JSON[_0x9a8b('0x13')](_0x2d4027));if(_0x2d4027[_0x9a8b('0x14')]){if(_0x2d4027['error'][_0x9a8b('0x15')]===0x1f4){logger['error'](_0x9a8b('0x16'),_0x5756be,_0x2d4027[_0x9a8b('0x14')][_0x9a8b('0x17')]);return _0x3d95ba(_0x2d4027['error'][_0x9a8b('0x17')]);}logger['error'](_0x9a8b('0x16'),_0x5756be,_0x2d4027[_0x9a8b('0x14')][_0x9a8b('0x17')]);return _0x2b17dd(_0x2d4027[_0x9a8b('0x14')][_0x9a8b('0x17')]);}else{logger[_0x9a8b('0xf')](_0x9a8b('0x16'),_0x5756be,'request\x20sent');_0x2b17dd(_0x2d4027[_0x9a8b('0x18')]['message']);}})[_0x9a8b('0x19')](function(_0x4f1b02){logger[_0x9a8b('0x14')](_0x9a8b('0x16'),_0x5756be,_0x4f1b02);_0x3d95ba(_0x4f1b02);});});}exports[_0x9a8b('0x1a')]=function(_0x391ed4){var _0x11b3ab=this;return new Promise(function(_0x1ddc08,_0x410c27){return db[_0x9a8b('0x1b')][_0x9a8b('0x1c')](_0x391ed4[_0x9a8b('0x1d')],{'raw':_0x391ed4[_0x9a8b('0x1e')]?_0x391ed4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x391ed4[_0x9a8b('0x1e')]?_0x391ed4[_0x9a8b('0x1e')]['where']||null:null,'attributes':_0x391ed4[_0x9a8b('0x1e')]?_0x391ed4[_0x9a8b('0x1e')][_0x9a8b('0x1f')]||null:null,'limit':_0x391ed4['options']?_0x391ed4['options'][_0x9a8b('0x20')]||null:null})[_0x9a8b('0xe')](function(_0x5f4bec){logger[_0x9a8b('0xf')]('UpdateWhatsappInteraction',_0x391ed4);logger[_0x9a8b('0x11')](_0x9a8b('0x1a'),_0x391ed4,JSON[_0x9a8b('0x13')](_0x5f4bec));_0x1ddc08(_0x5f4bec);})[_0x9a8b('0x19')](function(_0x3b4774){logger['error'](_0x9a8b('0x1a'),_0x3b4774['message'],_0x391ed4);_0x410c27(_0x11b3ab['error'](0x1f4,_0x3b4774['message']));});});};exports[_0x9a8b('0x21')]=function(_0x14c62c){return new Promise(function(_0x2d94af,_0x5eadb0){return db[_0x9a8b('0x1b')][_0x9a8b('0x22')]({'where':_0x14c62c[_0x9a8b('0x1e')]?_0x14c62c[_0x9a8b('0x1e')][_0x9a8b('0x23')]||null:null})['then'](function(_0x54bb3b){if(_0x54bb3b){return _0x54bb3b[_0x9a8b('0x24')](_0x14c62c['body']['ids'],_[_0x9a8b('0x25')](_0x14c62c[_0x9a8b('0x1d')],[_0x9a8b('0x26'),'id'])||{});}})['spread'](function(_0x2373b1){logger[_0x9a8b('0xf')](_0x9a8b('0x27'),_0x14c62c);logger[_0x9a8b('0x11')]('AddTags',_0x14c62c,JSON[_0x9a8b('0x13')](_0x2373b1));_0x2d94af(_0x2373b1);})['catch'](function(_0x46effa){logger[_0x9a8b('0x14')](_0x9a8b('0x27'),_0x46effa[_0x9a8b('0x17')],_0x14c62c);_0x5eadb0(_this[_0x9a8b('0x14')](0x1f4,_0x46effa[_0x9a8b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index f3a2f02..e115c7c 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 _0xca39=['remove','update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xca39,0xe8));var _0x9ca3=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xca39[_0x2dafbe];return _0x58a45a;};'use strict';var WhatsappInteractionEvents=require(_0x9ca3('0x0'));var events=[_0x9ca3('0x1'),_0x9ca3('0x2'),_0x9ca3('0x3')];function createListener(_0x58d4a3,_0x24a4ac){return function(_0x16a7de){_0x24a4ac[_0x9ca3('0x4')](_0x58d4a3,_0x16a7de);};}function removeListener(_0x514cf2,_0x538710){return function(){WhatsappInteractionEvents[_0x9ca3('0x5')](_0x514cf2,_0x538710);};}exports[_0x9ca3('0x6')]=function(_0x3d32a1){for(var _0x946a97=0x0,_0x1a1588=events[_0x9ca3('0x7')];_0x946a97<_0x1a1588;_0x946a97++){var _0x341f92=events[_0x946a97];var _0x4b3c3b=createListener(_0x9ca3('0x8')+_0x341f92,_0x3d32a1);WhatsappInteractionEvents['on'](_0x341f92,_0x4b3c3b);}}; \ No newline at end of file +var _0x6463=['save','remove','emit','removeListener','register','length','./whatsappInteraction.events'];(function(_0x7de746,_0x1ce1fc){var _0x538066=function(_0x3765fe){while(--_0x3765fe){_0x7de746['push'](_0x7de746['shift']());}};_0x538066(++_0x1ce1fc);}(_0x6463,0x117));var _0x3646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6463[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappInteractionEvents=require(_0x3646('0x0'));var events=[_0x3646('0x1'),_0x3646('0x2'),'update'];function createListener(_0x2ef21a,_0x5b2d04){return function(_0x592e99){_0x5b2d04[_0x3646('0x3')](_0x2ef21a,_0x592e99);};}function removeListener(_0x2a6144,_0x38dc45){return function(){WhatsappInteractionEvents[_0x3646('0x4')](_0x2a6144,_0x38dc45);};}exports[_0x3646('0x5')]=function(_0x2cdf57){for(var _0x1a815f=0x0,_0x440fa8=events[_0x3646('0x6')];_0x1a815f<_0x440fa8;_0x1a815f++){var _0x10fd41=events[_0x1a815f];var _0x3b53d2=createListener('whatsappInteraction:'+_0x10fd41,_0x2cdf57);WhatsappInteractionEvents['on'](_0x10fd41,_0x3b53d2);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index d1f76be..d9ab0f6 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 _0xbc30=['isAuthenticated','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','update','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','describe','/:id'];(function(_0x7184f8,_0x23b17f){var _0x1c7f67=function(_0x5c2b96){while(--_0x5c2b96){_0x7184f8['push'](_0x7184f8['shift']());}};_0x1c7f67(++_0x23b17f);}(_0xbc30,0xe2));var _0x0bc3=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xbc30[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require(_0x0bc3('0x0'));var util=require(_0x0bc3('0x1'));var path=require(_0x0bc3('0x2'));var timeout=require(_0x0bc3('0x3'));var express=require(_0x0bc3('0x4'));var router=express[_0x0bc3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0bc3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0bc3('0x7'));var controller=require(_0x0bc3('0x8'));router[_0x0bc3('0x9')]('/',auth['isAuthenticated'](),controller[_0x0bc3('0xa')]);router['get'](_0x0bc3('0xb'),auth['isAuthenticated'](),controller[_0x0bc3('0xc')]);router[_0x0bc3('0x9')](_0x0bc3('0xd'),auth[_0x0bc3('0xe')](),controller['show']);router[_0x0bc3('0xf')]('/',auth[_0x0bc3('0xe')](),interaction[_0x0bc3('0x10')](_0x0bc3('0x11'),_0x0bc3('0x12')),controller[_0x0bc3('0x13')]);router[_0x0bc3('0xf')](_0x0bc3('0x14'),controller[_0x0bc3('0x15')]);router['put'](_0x0bc3('0xd'),auth[_0x0bc3('0xe')](),controller[_0x0bc3('0x16')]);router[_0x0bc3('0x17')](_0x0bc3('0x18'),auth[_0x0bc3('0xe')](),controller[_0x0bc3('0x19')]);router[_0x0bc3('0x17')](_0x0bc3('0x1a'),auth[_0x0bc3('0xe')](),controller['reject']);router[_0x0bc3('0x1b')](_0x0bc3('0xd'),auth[_0x0bc3('0xe')](),controller[_0x0bc3('0x1c')]);module[_0x0bc3('0x1d')]=router; \ No newline at end of file +var _0xeb9b=['../../config/environment','./whatsappMessage.controller','index','get','describe','/:id','isAuthenticated','show','post','tracked','whatsapp','whatsappmessage:create','/:id/status','status','put','accept','/:id/reject','reject','delete','destroy','multer','util','connect-timeout','Router','../../components/interaction/service'];(function(_0x2a1048,_0x283da8){var _0x15cc0c=function(_0x45f184){while(--_0x45f184){_0x2a1048['push'](_0x2a1048['shift']());}};_0x15cc0c(++_0x283da8);}(_0xeb9b,0x1ef));var _0xbeb9=function(_0x456bd2,_0x156c79){_0x456bd2=_0x456bd2-0x0;var _0x2218c1=_0xeb9b[_0x456bd2];return _0x2218c1;};'use strict';var multer=require(_0xbeb9('0x0'));var util=require(_0xbeb9('0x1'));var path=require('path');var timeout=require(_0xbeb9('0x2'));var express=require('express');var router=express[_0xbeb9('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbeb9('0x4'));var config=require(_0xbeb9('0x5'));var controller=require(_0xbeb9('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xbeb9('0x7')]);router[_0xbeb9('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xbeb9('0x9')]);router[_0xbeb9('0x8')](_0xbeb9('0xa'),auth[_0xbeb9('0xb')](),controller[_0xbeb9('0xc')]);router[_0xbeb9('0xd')]('/',auth[_0xbeb9('0xb')](),interaction[_0xbeb9('0xe')](_0xbeb9('0xf'),_0xbeb9('0x10')),controller['create']);router[_0xbeb9('0xd')](_0xbeb9('0x11'),controller[_0xbeb9('0x12')]);router[_0xbeb9('0x13')](_0xbeb9('0xa'),auth[_0xbeb9('0xb')](),controller['update']);router[_0xbeb9('0x13')]('/:id/accept',auth[_0xbeb9('0xb')](),controller[_0xbeb9('0x14')]);router[_0xbeb9('0x13')](_0xbeb9('0x15'),auth[_0xbeb9('0xb')](),controller[_0xbeb9('0x16')]);router[_0xbeb9('0x17')](_0xbeb9('0xa'),auth[_0xbeb9('0xb')](),controller[_0xbeb9('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 2b06ba1..06d7a83 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 _0x0dbf=['TEXT','out','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x3ae458,_0x5dbfd7){var _0x4da67a=function(_0x69c99d){while(--_0x69c99d){_0x3ae458['push'](_0x3ae458['shift']());}};_0x4da67a(++_0x5dbfd7);}(_0x0dbf,0x1a9));var _0xf0db=function(_0x127783,_0x258715){_0x127783=_0x127783-0x0;var _0x14f298=_0x0dbf[_0x127783];return _0x14f298;};'use strict';var Sequelize=require(_0xf0db('0x0'));module[_0xf0db('0x1')]={'body':{'type':Sequelize[_0xf0db('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf0db('0x3')),'defaultValue':_0xf0db('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xf0db('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xf0db('0x5')]},'secret':{'type':Sequelize[_0xf0db('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xf0db('0x4')]},'providerResponse':{'type':Sequelize[_0xf0db('0x2')]}}; \ No newline at end of file +var _0xd6e1=['out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x3d56bf,_0x6011e5){var _0x4de1c7=function(_0x3a66cd){while(--_0x3a66cd){_0x3d56bf['push'](_0x3d56bf['shift']());}};_0x4de1c7(++_0x6011e5);}(_0xd6e1,0x9c));var _0x1d6e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xd6e1[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x1d6e('0x0'));module[_0x1d6e('0x1')]={'body':{'type':Sequelize[_0x1d6e('0x2')](_0x1d6e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1d6e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1d6e('0x5')]('in',_0x1d6e('0x6')),'defaultValue':_0x1d6e('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x1d6e('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1d6e('0x8')]},'providerResponse':{'type':Sequelize[_0x1d6e('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index f918af5..ae7484e 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 _0x355b=['querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','result','catch','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','WhatsappMessage','rawAttributes','type','key','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','filter','options','where','includeAll','include','findAll','rows','show','length','merge','create','body','find','params','describe','whatsapp','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','format','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','User','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x4c4042,_0x1ea485){var _0xbd10dc=function(_0x164b20){while(--_0x164b20){_0x4c4042['push'](_0x4c4042['shift']());}};_0xbd10dc(++_0x1ea485);}(_0x355b,0x100));var _0xb355=function(_0x7feb20,_0x1b0f5c){_0x7feb20=_0x7feb20-0x0;var _0x19a348=_0x355b[_0x7feb20];return _0x19a348;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb355('0x0'));var zipdir=require(_0xb355('0x1'));var jsonpatch=require(_0xb355('0x2'));var rp=require(_0xb355('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb355('0x4'));var path=require(_0xb355('0x5'));var sox=require('sox');var csv=require(_0xb355('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb355('0x7'));var _=require(_0xb355('0x8'));var squel=require(_0xb355('0x9'));var crypto=require(_0xb355('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb355('0xb'));var toCsv=require(_0xb355('0x6'));var querystring=require(_0xb355('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb355('0xd'));var qs=require(_0xb355('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb355('0xf'))(_0xb355('0x10'));var utils=require(_0xb355('0x11'));var config=require(_0xb355('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb355('0x13')]=_[_0xb355('0x14')](config[_0xb355('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0xb355('0x15'))(new Redis(config['redis']));require('./whatsappMessage.socket')['register'](socket);var jayson=require(_0xb355('0x16'));var client=jayson[_0xb355('0x17')][_0xb355('0x18')]({'port':0x232c});var client9002=jayson[_0xb355('0x17')][_0xb355('0x18')]({'port':0x232a});function respondWithRpcPromise(_0xb5776b,_0xe060f3,_0x537ef4,_0x47991c){return new BPromise(function(_0x1af402,_0x22d313){var _0x37e732=_0x47991c||client;return _0x37e732[_0xb355('0x19')](_0xb5776b,_0x537ef4)[_0xb355('0x1a')](function(_0x3a7afb){logger[_0xb355('0x1b')]('WhatsappMessage,\x20%s,\x20%s',_0xe060f3,_0xb355('0x1c'));logger[_0xb355('0x1d')](_0xb355('0x1e'),_0xe060f3,_0xb355('0x1c'),JSON[_0xb355('0x1f')](_0x3a7afb));if(_0x3a7afb[_0xb355('0x20')]){if(_0x3a7afb[_0xb355('0x20')][_0xb355('0x21')]===0x1f4){logger[_0xb355('0x20')]('WhatsappMessage,\x20%s,\x20%s',_0xe060f3,_0x3a7afb[_0xb355('0x20')][_0xb355('0x22')]);return _0x22d313(_0x3a7afb['error'][_0xb355('0x22')]);}logger[_0xb355('0x20')](_0xb355('0x23'),_0xe060f3,_0x3a7afb[_0xb355('0x20')]['message']);return _0x1af402(_0x3a7afb[_0xb355('0x20')][_0xb355('0x22')]);}else{logger[_0xb355('0x1b')](_0xb355('0x23'),_0xe060f3,'request\x20sent');_0x1af402(_0x3a7afb[_0xb355('0x24')][_0xb355('0x22')]);}})[_0xb355('0x25')](function(_0x1097c9){logger[_0xb355('0x20')](_0xb355('0x23'),_0xe060f3,_0x1097c9);_0x22d313(_0x1097c9);});});}function respondWithStatusCode(_0x476998,_0x404e6d){_0x404e6d=_0x404e6d||0xcc;return function(_0x52a661){if(_0x52a661){return _0x476998[_0xb355('0x26')](_0x404e6d);}return _0x476998['status'](_0x404e6d)[_0xb355('0x27')]();};}function respondWithResult(_0x3e57c2,_0x263c1c){_0x263c1c=_0x263c1c||0xc8;return function(_0x457254){if(_0x457254){return _0x3e57c2[_0xb355('0x28')](_0x263c1c)[_0xb355('0x29')](_0x457254);}};}function respondWithFilteredResult(_0x3de1c4,_0x704160){return function(_0x2a0103){if(_0x2a0103){var _0x4c1441=typeof _0x704160[_0xb355('0x2a')]==='undefined'&&typeof _0x704160[_0xb355('0x2b')]===_0xb355('0x2c');var _0x21f9c8=_0x2a0103[_0xb355('0x2d')];var _0x14c678=_0x4c1441?0x0:_0x704160[_0xb355('0x2a')];var _0x52b9fc=_0x4c1441?_0x2a0103[_0xb355('0x2d')]:_0x704160[_0xb355('0x2a')]+_0x704160[_0xb355('0x2b')];var _0x375a0f;if(_0x52b9fc>=_0x21f9c8){_0x52b9fc=_0x21f9c8;_0x375a0f=0xc8;}else{_0x375a0f=0xce;}_0x3de1c4[_0xb355('0x28')](_0x375a0f);return _0x3de1c4[_0xb355('0x2e')](_0xb355('0x2f'),_0x14c678+'-'+_0x52b9fc+'/'+_0x21f9c8)[_0xb355('0x29')](_0x2a0103);}return null;};}function patchUpdates(_0x23134e){return function(_0x43210d){try{jsonpatch[_0xb355('0x30')](_0x43210d,_0x23134e,!![]);}catch(_0x3ef2e3){return BPromise[_0xb355('0x31')](_0x3ef2e3);}return _0x43210d[_0xb355('0x32')]();};}function saveUpdates(_0x2c4e3b,_0x409d91){return function(_0x4af734){if(_0x4af734){return _0x4af734[_0xb355('0x33')](_0x2c4e3b)[_0xb355('0x1a')](function(_0xb80d55){return _0xb80d55;});}return null;};}function removeEntity(_0x17d74a,_0x32a4bf){return function(_0x4a9768){if(_0x4a9768){return _0x4a9768[_0xb355('0x34')]()[_0xb355('0x1a')](function(){_0x17d74a[_0xb355('0x28')](0xcc)[_0xb355('0x27')]();});}};}function handleEntityNotFound(_0x40e2be,_0x97f18){return function(_0x225b55){if(!_0x225b55){_0x40e2be[_0xb355('0x26')](0x194);}return _0x225b55;};}function handleError(_0x2e3b36,_0x42aeb3){_0x42aeb3=_0x42aeb3||0x1f4;return function(_0x414f4f){logger['error'](_0x414f4f[_0xb355('0x35')]);if(_0x414f4f[_0xb355('0x36')]){delete _0x414f4f['name'];}_0x2e3b36[_0xb355('0x28')](_0x42aeb3)[_0xb355('0x37')](_0x414f4f);};}exports['index']=function(_0x20cc88,_0x3d9d2d){var _0x1476a9={},_0x14937b={},_0x18a1c1={'count':0x0,'rows':[]};var _0x245784=_[_0xb355('0x38')](db[_0xb355('0x39')][_0xb355('0x3a')],function(_0x27ae96){return{'name':_0x27ae96['fieldName'],'type':_0x27ae96[_0xb355('0x3b')][_0xb355('0x3c')]};});_0x14937b['model']=_[_0xb355('0x38')](_0x245784,_0xb355('0x36'));_0x14937b['query']=_[_0xb355('0x3d')](_0x20cc88[_0xb355('0x3e')]);_0x14937b[_0xb355('0x3f')]=_[_0xb355('0x40')](_0x14937b[_0xb355('0x41')],_0x14937b['query']);_0x1476a9['attributes']=_[_0xb355('0x40')](_0x14937b[_0xb355('0x41')],qs[_0xb355('0x42')](_0x20cc88[_0xb355('0x3e')][_0xb355('0x42')]));_0x1476a9['attributes']=_0x1476a9['attributes']['length']?_0x1476a9[_0xb355('0x43')]:_0x14937b['model'];if(!_0x20cc88[_0xb355('0x3e')][_0xb355('0x44')]('nolimit')){_0x1476a9[_0xb355('0x2b')]=qs[_0xb355('0x2b')](_0x20cc88[_0xb355('0x3e')][_0xb355('0x2b')]);_0x1476a9[_0xb355('0x2a')]=qs[_0xb355('0x2a')](_0x20cc88[_0xb355('0x3e')][_0xb355('0x2a')]);}_0x1476a9[_0xb355('0x45')]=qs[_0xb355('0x46')](_0x20cc88[_0xb355('0x3e')][_0xb355('0x46')]);_0x1476a9['where']=qs[_0xb355('0x3f')](_['pick'](_0x20cc88[_0xb355('0x3e')],_0x14937b[_0xb355('0x3f')]),_0x245784);if(_0x20cc88[_0xb355('0x3e')][_0xb355('0x47')]){_0x1476a9['where']=_['merge'](_0x1476a9['where'],{'$or':_[_0xb355('0x38')](_0x245784,function(_0x3a2100){if(_0x3a2100[_0xb355('0x3b')]!=='VIRTUAL'){var _0x5c5ca4={};_0x5c5ca4[_0x3a2100[_0xb355('0x36')]]={'$like':'%'+_0x20cc88[_0xb355('0x3e')]['filter']+'%'};return _0x5c5ca4;}})});}_0x1476a9=_['merge']({},_0x1476a9,_0x20cc88[_0xb355('0x48')]);var _0x388142={'where':_0x1476a9[_0xb355('0x49')]};return db[_0xb355('0x39')][_0xb355('0x2d')](_0x388142)[_0xb355('0x1a')](function(_0x655a71){_0x18a1c1[_0xb355('0x2d')]=_0x655a71;if(_0x20cc88[_0xb355('0x3e')][_0xb355('0x4a')]){_0x1476a9[_0xb355('0x4b')]=[{'all':!![]}];}return db[_0xb355('0x39')][_0xb355('0x4c')](_0x1476a9);})[_0xb355('0x1a')](function(_0x11f16b){_0x18a1c1[_0xb355('0x4d')]=_0x11f16b;return _0x18a1c1;})['then'](respondWithFilteredResult(_0x3d9d2d,_0x1476a9))[_0xb355('0x25')](handleError(_0x3d9d2d,null));};exports[_0xb355('0x4e')]=function(_0x76da0a,_0x3826d0){var _0x19d9ed={'raw':!![],'where':{'id':_0x76da0a['params']['id']}},_0xd14606={};_0xd14606['model']=_[_0xb355('0x3d')](db['WhatsappMessage']['rawAttributes']);_0xd14606[_0xb355('0x3e')]=_[_0xb355('0x3d')](_0x76da0a[_0xb355('0x3e')]);_0xd14606[_0xb355('0x3f')]=_[_0xb355('0x40')](_0xd14606['model'],_0xd14606[_0xb355('0x3e')]);_0x19d9ed[_0xb355('0x43')]=_['intersection'](_0xd14606['model'],qs[_0xb355('0x42')](_0x76da0a[_0xb355('0x3e')]['fields']));_0x19d9ed['attributes']=_0x19d9ed[_0xb355('0x43')][_0xb355('0x4f')]?_0x19d9ed['attributes']:_0xd14606[_0xb355('0x41')];if(_0x76da0a['query'][_0xb355('0x4a')]){_0x19d9ed[_0xb355('0x4b')]=[{'all':!![]}];}_0x19d9ed=_[_0xb355('0x50')]({},_0x19d9ed,_0x76da0a['options']);return db[_0xb355('0x39')]['find'](_0x19d9ed)[_0xb355('0x1a')](handleEntityNotFound(_0x3826d0,null))[_0xb355('0x1a')](respondWithResult(_0x3826d0,null))['catch'](handleError(_0x3826d0,null));};exports[_0xb355('0x51')]=function(_0x16770a,_0x5b38ed){return db[_0xb355('0x39')][_0xb355('0x51')](_0x16770a['body'],{})[_0xb355('0x1a')](respondWithResult(_0x5b38ed,0xc9))['catch'](handleError(_0x5b38ed,null));};exports['update']=function(_0x1cdcea,_0x4ae7e7){if(_0x1cdcea[_0xb355('0x52')]['id']){delete _0x1cdcea[_0xb355('0x52')]['id'];}return db[_0xb355('0x39')][_0xb355('0x53')]({'where':{'id':_0x1cdcea[_0xb355('0x54')]['id']}})[_0xb355('0x1a')](handleEntityNotFound(_0x4ae7e7,null))['then'](saveUpdates(_0x1cdcea[_0xb355('0x52')],null))['then'](respondWithResult(_0x4ae7e7,null))[_0xb355('0x25')](handleError(_0x4ae7e7,null));};exports['destroy']=function(_0x1bb607,_0xde389e){return db[_0xb355('0x39')]['find']({'where':{'id':_0x1bb607[_0xb355('0x54')]['id']}})[_0xb355('0x1a')](handleEntityNotFound(_0xde389e,null))[_0xb355('0x1a')](removeEntity(_0xde389e,null))[_0xb355('0x25')](handleError(_0xde389e,null));};exports[_0xb355('0x55')]=function(_0x432da3,_0x3a9d3e){return db[_0xb355('0x39')][_0xb355('0x55')]()[_0xb355('0x1a')](respondWithResult(_0x3a9d3e,null))[_0xb355('0x25')](handleError(_0x3a9d3e,null));};var interaction_log=require(_0xb355('0xf'))('whatsapp-interactions');exports['accept']=function(_0x308fba,_0x2c1156,_0xc56835){var _0x59aa50={'agent':{},'channel':_0xb355('0x56')};if(_0x308fba[_0xb355('0x52')]['id']){delete _0x308fba[_0xb355('0x52')]['id'];}_0x308fba[_0xb355('0x52')][_0xb355('0x57')]=!![];_0x308fba[_0xb355('0x52')]['readAt']=moment()['format'](_0xb355('0x58'));_0x308fba[_0xb355('0x52')][_0xb355('0x59')]=_0x308fba['body'][_0xb355('0x59')]||_0x308fba[_0xb355('0x5a')]['id'];_0x59aa50[_0xb355('0x5b')]['id']=_0x308fba[_0xb355('0x52')]['UserId'];return db[_0xb355('0x39')][_0xb355('0x53')]({'where':{'id':_0x308fba[_0xb355('0x54')]['id'],'UserId':null}})[_0xb355('0x1a')](handleEntityNotFound(_0x2c1156,null))[_0xb355('0x1a')](saveUpdates(_0x308fba['body'],null))[_0xb355('0x1a')](function(_0x52f4c9){if(_0x52f4c9){_0x59aa50[_0xb355('0x22')]=_0x52f4c9[_0xb355('0x5c')]({'plain':!![]});return db[_0xb355('0x5d')][_0xb355('0x53')]({'where':{'id':_0x52f4c9[_0xb355('0x5e')]}});}return null;})[_0xb355('0x1a')](handleEntityNotFound(_0x2c1156,null))['then'](function(_0x118028){if(_0x118028){return _0x118028[_0xb355('0x33')]({'UserId':_0x308fba[_0xb355('0x52')][_0xb355('0x59')],'read1stAt':_[_0xb355('0x5f')](_0x118028['read1stAt'])?moment()['format'](_0xb355('0x58')):undefined});}return null;})[_0xb355('0x1a')](function(_0x1cf19a){if(_0x1cf19a){_0x59aa50['interaction']=_0x1cf19a[_0xb355('0x5c')]({'plain':!![]});interaction_log[_0xb355('0x1b')](_0xb355('0x60'),_0x308fba['user']['id'],_0x308fba[_0xb355('0x5a')][_0xb355('0x36')],_0x308fba[_0xb355('0x5a')][_0xb355('0x61')],_0x59aa50[_0xb355('0x62')]['id'],_0x308fba[_0xb355('0x52')]?JSON['stringify'](_0x308fba[_0xb355('0x52')]):_0xb355('0x63'));return respondWithRpcPromise(_0xb355('0x64'),'acceptMessage',_0x59aa50);}return null;})[_0xb355('0x1a')](function(_0xfefa42){var _0x5dccf5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xfefa42['message'][_0xb355('0x65')];return db[_0xb355('0x66')]['query'](_0x5dccf5,{'type':db[_0xb355('0x67')][_0xb355('0x68')][_0xb355('0x69')],'raw':!![]})[_0xb355('0x1a')](function(_0x2a6f85){return _0x2a6f85;});})[_0xb355('0x1a')](function(_0x4b5445){if(_0x4b5445){_0x59aa50[_0xb355('0x22')][_0xb355('0x6a')]=_0x4b5445[0x0];if(!_0x308fba[_0xb355('0x52')][_0xb355('0x59')])return;return db['User'][_0xb355('0x53')]({'where':{'id':_0x308fba[_0xb355('0x52')][_0xb355('0x59')],'role':_0xb355('0x5b')},'attributes':['id','name',_0xb355('0x6b'),_0xb355('0x6c'),_0xb355('0x6d')],'raw':!![]});}return null;})[_0xb355('0x1a')](function(_0x32609f){if(!_0x32609f)return null;_0x59aa50[_0xb355('0x22')][_0xb355('0x5b')]=_0x32609f;return _0x59aa50;})['then'](function(_0x49efd9){if(_0x49efd9){if(_0x308fba['body'][_0xb355('0x6e')]){_0x59aa50['message'][_0xb355('0x6f')]=util[_0xb355('0x70')](_0xb355('0x71'),_0x308fba['user']['name']);_0x59aa50[_0xb355('0x22')][_0xb355('0x72')]=_0x59aa50['channel'];_0x59aa50['message'][_0xb355('0x73')]=_0x59aa50['channel'];_0x59aa50[_0xb355('0x22')][_0xb355('0x74')]=_0xb355('0x75');return respondWithRpcPromise(_0xb355('0x76'),_0xb355('0x76'),{'event':_0xb355('0x77'),'message':_0x59aa50['message']},client9002)[_0xb355('0x1a')](function(){return _0x59aa50;});}return _0x59aa50;}return null;})[_0xb355('0x1a')](respondWithResult(_0x2c1156,null))[_0xb355('0x25')](handleError(_0x2c1156,null));};var interaction_log=require(_0xb355('0xf'))(_0xb355('0x78'));exports[_0xb355('0x31')]=function(_0x33f5f0,_0x4c773b,_0x323c44){var _0xff2789={'agent':{},'channel':_0xb355('0x56')};if(_0x33f5f0['body']['id']){delete _0x33f5f0[_0xb355('0x52')]['id'];}_0x33f5f0[_0xb355('0x52')][_0xb355('0x59')]=_0x33f5f0[_0xb355('0x52')][_0xb355('0x59')]||_0x33f5f0['user']['id'];_0xff2789[_0xb355('0x5b')]['id']=_0x33f5f0[_0xb355('0x52')][_0xb355('0x59')];return db[_0xb355('0x39')][_0xb355('0x53')]({'where':{'id':_0x33f5f0[_0xb355('0x54')]['id'],'UserId':null}})[_0xb355('0x1a')](handleEntityNotFound(_0x4c773b,null))[_0xb355('0x1a')](function(_0x383022){if(_0x383022){_0xff2789[_0xb355('0x22')]=_0x383022[_0xb355('0x5c')]({'plain':!![]});return db[_0xb355('0x5d')]['find']({'where':{'id':_0x383022[_0xb355('0x5e')]}});}return null;})[_0xb355('0x1a')](handleEntityNotFound(_0x4c773b,null))[_0xb355('0x1a')](function(_0x20ac4b){if(_0x20ac4b){_0xff2789[_0xb355('0x62')]=_0x20ac4b[_0xb355('0x5c')]({'plain':!![]});interaction_log['info'](_0xb355('0x79'),_0x33f5f0[_0xb355('0x5a')]['id'],_0x33f5f0[_0xb355('0x5a')]['name'],_0x33f5f0['user']['role'],_0xff2789[_0xb355('0x62')]['id'],_0x33f5f0[_0xb355('0x52')]?JSON['stringify'](_0x33f5f0[_0xb355('0x52')]):_0xb355('0x63'));return respondWithRpcPromise(_0xb355('0x7a'),_0xb355('0x7b'),_0xff2789);}return null;})[_0xb355('0x1a')](function(_0x3898fc){var _0x2e6fad=_0xb355('0x7c')+_0x3898fc[_0xb355('0x22')]['ContactId'];return db[_0xb355('0x66')][_0xb355('0x3e')](_0x2e6fad,{'type':db['Sequelize'][_0xb355('0x68')][_0xb355('0x69')],'raw':!![]})[_0xb355('0x1a')](function(_0x4fb557){return _0x4fb557;});})[_0xb355('0x1a')](function(_0x5d9f66){if(_0x5d9f66){_0xff2789['message']['contact']=_0x5d9f66[0x0];if(!_0x33f5f0[_0xb355('0x52')][_0xb355('0x59')])return;return db[_0xb355('0x7d')][_0xb355('0x53')]({'where':{'id':_0x33f5f0[_0xb355('0x52')]['UserId'],'role':_0xb355('0x5b')},'attributes':['id',_0xb355('0x36'),_0xb355('0x6b'),'email',_0xb355('0x6d')],'raw':!![]});}return null;})['then'](function(_0x2d67ff){if(!_0x2d67ff)return null;_0xff2789['message']['agent']=_0x2d67ff;return _0xff2789;})['then'](function(_0x2c860d){if(_0x2c860d){_0x2c860d[_0xb355('0x22')][_0xb355('0x6f')]=util['format']('SIP/%s',_0x33f5f0['user']['name']);_0x2c860d['message'][_0xb355('0x72')]=_0xff2789['channel'];_0x2c860d[_0xb355('0x22')][_0xb355('0x73')]=_0xff2789[_0xb355('0x72')];_0x2c860d[_0xb355('0x22')]['event']='reject';respondWithRpcPromise('EventManager',_0xb355('0x76'),{'event':'rejectmessage','message':_0x2c860d['message']},client9002);return _0xff2789;}return null;})[_0xb355('0x1a')](respondWithResult(_0x4c773b,null))[_0xb355('0x25')](handleError(_0x4c773b,null));};exports[_0xb355('0x28')]=function(_0x1b4b2a,_0x55abe3,_0x197ba1){if(_0x1b4b2a[_0xb355('0x52')]['id']){delete _0x1b4b2a[_0xb355('0x52')]['id'];}var _0x1ed63b;return db['WhatsappMessage'][_0xb355('0x53')]({'where':{'id':_0x1b4b2a['params']['id']}})['then'](handleEntityNotFound(_0x55abe3,null))[_0xb355('0x1a')](function(_0x39830f){if(_0x39830f){_0x1ed63b=_0x39830f;return db[_0xb355('0x7e')][_0xb355('0x53')]({'where':{'id':_0x39830f['WhatsappAccountId']}});}})[_0xb355('0x1a')](handleEntityNotFound(_0x55abe3,null))[_0xb355('0x1a')](function(_0x6f0f93){if(_0x6f0f93){logger[_0xb355('0x1d')](_0xb355('0x7f'),_0xb355('0x28'),_0xb355('0x80'),_0x6f0f93['type'],util['inspect'](_0x1b4b2a[_0xb355('0x52')],{'showHidden':![],'depth':null}));switch(_0x6f0f93[_0xb355('0x3b')]){case _0xb355('0x81'):if(_0x1b4b2a[_0xb355('0x52')][_0xb355('0x82')]&&_0x1b4b2a[_0xb355('0x52')][_0xb355('0x82')]===_0x1ed63b[_0xb355('0x83')]&&_0x1b4b2a[_0xb355('0x52')]['MessageStatus']&&_0x1b4b2a[_0xb355('0x52')]['MessageStatus']===_0xb355('0x57')){return _0x1ed63b[_0xb355('0x33')]({'read':!![]});}else{logger[_0xb355('0x20')](_0xb355('0x84'),_0xb355('0x28'),_0xb355('0x81'),util[_0xb355('0x85')](_0x1b4b2a['body'],{'showHidden':![],'depth':null}));}break;}return _0x1ed63b;}})['then'](respondWithResult(_0x55abe3,null))[_0xb355('0x25')](handleError(_0x55abe3,null));}; \ No newline at end of file +var _0xb11c=['Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','SELECT','motionChannel','rejectmessage','WhatsappAccount','debug','received\x20delivery\x20report\x20from','MessageSid','messageId','MessageStatus','twilio','inspect','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','end','name','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','WhatsappMessage','includeAll','include','findAll','rows','show','params','find','update','body','describe','../../config/logger','whatsapp-interactions','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId'];(function(_0x58a22b,_0x149a01){var _0x26478b=function(_0x3a4ae5){while(--_0x3a4ae5){_0x58a22b['push'](_0x58a22b['shift']());}};_0x26478b(++_0x149a01);}(_0xb11c,0xa8));var _0xcb11=function(_0x43a2fb,_0x27ca01){_0x43a2fb=_0x43a2fb-0x0;var _0x619ac7=_0xb11c[_0x43a2fb];return _0x619ac7;};'use strict';var emlformat=require(_0xcb11('0x0'));var rimraf=require(_0xcb11('0x1'));var zipdir=require(_0xcb11('0x2'));var jsonpatch=require(_0xcb11('0x3'));var rp=require(_0xcb11('0x4'));var moment=require(_0xcb11('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xcb11('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcb11('0x7'));var crypto=require(_0xcb11('0x8'));var jsforce=require(_0xcb11('0x9'));var deskjs=require(_0xcb11('0xa'));var toCsv=require(_0xcb11('0xb'));var querystring=require('querystring');var Papa=require(_0xcb11('0xc'));var Redis=require('ioredis');var authService=require(_0xcb11('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xcb11('0xe'));var hardwareService=require(_0xcb11('0xf'));var logger=require('../../config/logger')(_0xcb11('0x10'));var utils=require(_0xcb11('0x11'));var config=require(_0xcb11('0x12'));var licenseUtil=require(_0xcb11('0x13'));var db=require(_0xcb11('0x14'))['db'];config['redis']=_[_0xcb11('0x15')](config[_0xcb11('0x16')],{'host':_0xcb11('0x17'),'port':0x18eb});var socket=require(_0xcb11('0x18'))(new Redis(config[_0xcb11('0x16')]));require(_0xcb11('0x19'))[_0xcb11('0x1a')](socket);var jayson=require(_0xcb11('0x1b'));var client=jayson[_0xcb11('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xcb11('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39bfcb,_0x5c1ae2,_0xecf87f,_0x4df0f3){return new BPromise(function(_0x28167a,_0x228e94){var _0x5c0681=_0x4df0f3||client;return _0x5c0681['request'](_0x39bfcb,_0xecf87f)[_0xcb11('0x1d')](function(_0x2b0e62){logger[_0xcb11('0x1e')](_0xcb11('0x1f'),_0x5c1ae2,'request\x20sent');logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5c1ae2,_0xcb11('0x20'),JSON[_0xcb11('0x21')](_0x2b0e62));if(_0x2b0e62[_0xcb11('0x22')]){if(_0x2b0e62[_0xcb11('0x22')][_0xcb11('0x23')]===0x1f4){logger[_0xcb11('0x22')](_0xcb11('0x1f'),_0x5c1ae2,_0x2b0e62[_0xcb11('0x22')][_0xcb11('0x24')]);return _0x228e94(_0x2b0e62[_0xcb11('0x22')][_0xcb11('0x24')]);}logger[_0xcb11('0x22')](_0xcb11('0x1f'),_0x5c1ae2,_0x2b0e62['error']['message']);return _0x28167a(_0x2b0e62['error']['message']);}else{logger[_0xcb11('0x1e')](_0xcb11('0x1f'),_0x5c1ae2,_0xcb11('0x20'));_0x28167a(_0x2b0e62[_0xcb11('0x25')][_0xcb11('0x24')]);}})[_0xcb11('0x26')](function(_0x5da724){logger[_0xcb11('0x22')](_0xcb11('0x1f'),_0x5c1ae2,_0x5da724);_0x228e94(_0x5da724);});});}function respondWithStatusCode(_0x1233c4,_0x8134c4){_0x8134c4=_0x8134c4||0xcc;return function(_0x15a4b4){if(_0x15a4b4){return _0x1233c4[_0xcb11('0x27')](_0x8134c4);}return _0x1233c4['status'](_0x8134c4)['end']();};}function respondWithResult(_0x2745a4,_0x59c6cc){_0x59c6cc=_0x59c6cc||0xc8;return function(_0x2d160f){if(_0x2d160f){return _0x2745a4[_0xcb11('0x28')](_0x59c6cc)[_0xcb11('0x29')](_0x2d160f);}};}function respondWithFilteredResult(_0x5ad5a2,_0x1d958a){return function(_0x2b29fa){if(_0x2b29fa){var _0x18c8c1=typeof _0x1d958a[_0xcb11('0x2a')]===_0xcb11('0x2b')&&typeof _0x1d958a['limit']===_0xcb11('0x2b');var _0x12c181=_0x2b29fa['count'];var _0x30c0ac=_0x18c8c1?0x0:_0x1d958a[_0xcb11('0x2a')];var _0x547b04=_0x18c8c1?_0x2b29fa[_0xcb11('0x2c')]:_0x1d958a['offset']+_0x1d958a[_0xcb11('0x2d')];var _0x54dfc4;if(_0x547b04>=_0x12c181){_0x547b04=_0x12c181;_0x54dfc4=0xc8;}else{_0x54dfc4=0xce;}_0x5ad5a2[_0xcb11('0x28')](_0x54dfc4);return _0x5ad5a2[_0xcb11('0x2e')](_0xcb11('0x2f'),_0x30c0ac+'-'+_0x547b04+'/'+_0x12c181)['json'](_0x2b29fa);}return null;};}function patchUpdates(_0x537340){return function(_0x4d17b1){try{jsonpatch[_0xcb11('0x30')](_0x4d17b1,_0x537340,!![]);}catch(_0x1e3ea){return BPromise[_0xcb11('0x31')](_0x1e3ea);}return _0x4d17b1[_0xcb11('0x32')]();};}function saveUpdates(_0x1d5c36,_0x5075f4){return function(_0x165fbd){if(_0x165fbd){return _0x165fbd['update'](_0x1d5c36)[_0xcb11('0x1d')](function(_0x44ade6){return _0x44ade6;});}return null;};}function removeEntity(_0x401c06,_0x226e03){return function(_0xa029a1){if(_0xa029a1){return _0xa029a1['destroy']()[_0xcb11('0x1d')](function(){_0x401c06[_0xcb11('0x28')](0xcc)[_0xcb11('0x33')]();});}};}function handleEntityNotFound(_0x2b0231,_0x1d2f0c){return function(_0x83e77f){if(!_0x83e77f){_0x2b0231[_0xcb11('0x27')](0x194);}return _0x83e77f;};}function handleError(_0x470bd8,_0x52a6fd){_0x52a6fd=_0x52a6fd||0x1f4;return function(_0x4edc3e){logger[_0xcb11('0x22')](_0x4edc3e['stack']);if(_0x4edc3e[_0xcb11('0x34')]){delete _0x4edc3e['name'];}_0x470bd8[_0xcb11('0x28')](_0x52a6fd)['send'](_0x4edc3e);};}exports[_0xcb11('0x35')]=function(_0xeba73e,_0x2880ff){var _0x566630={},_0x5b0385={},_0x3e5c78={'count':0x0,'rows':[]};var _0x486f00=_[_0xcb11('0x36')](db['WhatsappMessage'][_0xcb11('0x37')],function(_0x29cdcd){return{'name':_0x29cdcd[_0xcb11('0x38')],'type':_0x29cdcd['type']['key']};});_0x5b0385[_0xcb11('0x39')]=_[_0xcb11('0x36')](_0x486f00,_0xcb11('0x34'));_0x5b0385[_0xcb11('0x3a')]=_[_0xcb11('0x3b')](_0xeba73e[_0xcb11('0x3a')]);_0x5b0385[_0xcb11('0x3c')]=_[_0xcb11('0x3d')](_0x5b0385[_0xcb11('0x39')],_0x5b0385[_0xcb11('0x3a')]);_0x566630[_0xcb11('0x3e')]=_[_0xcb11('0x3d')](_0x5b0385[_0xcb11('0x39')],qs[_0xcb11('0x3f')](_0xeba73e['query'][_0xcb11('0x3f')]));_0x566630[_0xcb11('0x3e')]=_0x566630[_0xcb11('0x3e')][_0xcb11('0x40')]?_0x566630[_0xcb11('0x3e')]:_0x5b0385[_0xcb11('0x39')];if(!_0xeba73e['query'][_0xcb11('0x41')]('nolimit')){_0x566630[_0xcb11('0x2d')]=qs[_0xcb11('0x2d')](_0xeba73e[_0xcb11('0x3a')]['limit']);_0x566630[_0xcb11('0x2a')]=qs[_0xcb11('0x2a')](_0xeba73e[_0xcb11('0x3a')]['offset']);}_0x566630[_0xcb11('0x42')]=qs[_0xcb11('0x43')](_0xeba73e[_0xcb11('0x3a')][_0xcb11('0x43')]);_0x566630['where']=qs[_0xcb11('0x3c')](_[_0xcb11('0x44')](_0xeba73e[_0xcb11('0x3a')],_0x5b0385[_0xcb11('0x3c')]),_0x486f00);if(_0xeba73e[_0xcb11('0x3a')][_0xcb11('0x45')]){_0x566630[_0xcb11('0x46')]=_[_0xcb11('0x47')](_0x566630[_0xcb11('0x46')],{'$or':_[_0xcb11('0x36')](_0x486f00,function(_0x1e4204){if(_0x1e4204[_0xcb11('0x48')]!==_0xcb11('0x49')){var _0x14fe98={};_0x14fe98[_0x1e4204[_0xcb11('0x34')]]={'$like':'%'+_0xeba73e[_0xcb11('0x3a')][_0xcb11('0x45')]+'%'};return _0x14fe98;}})});}_0x566630=_[_0xcb11('0x47')]({},_0x566630,_0xeba73e[_0xcb11('0x4a')]);var _0x2b48e4={'where':_0x566630[_0xcb11('0x46')]};return db[_0xcb11('0x4b')][_0xcb11('0x2c')](_0x2b48e4)[_0xcb11('0x1d')](function(_0x1d9c8c){_0x3e5c78[_0xcb11('0x2c')]=_0x1d9c8c;if(_0xeba73e[_0xcb11('0x3a')][_0xcb11('0x4c')]){_0x566630[_0xcb11('0x4d')]=[{'all':!![]}];}return db[_0xcb11('0x4b')][_0xcb11('0x4e')](_0x566630);})[_0xcb11('0x1d')](function(_0x46e146){_0x3e5c78[_0xcb11('0x4f')]=_0x46e146;return _0x3e5c78;})[_0xcb11('0x1d')](respondWithFilteredResult(_0x2880ff,_0x566630))['catch'](handleError(_0x2880ff,null));};exports[_0xcb11('0x50')]=function(_0x280e69,_0x572633){var _0x4dfb54={'raw':!![],'where':{'id':_0x280e69[_0xcb11('0x51')]['id']}},_0x3403bd={};_0x3403bd[_0xcb11('0x39')]=_[_0xcb11('0x3b')](db[_0xcb11('0x4b')]['rawAttributes']);_0x3403bd[_0xcb11('0x3a')]=_[_0xcb11('0x3b')](_0x280e69[_0xcb11('0x3a')]);_0x3403bd[_0xcb11('0x3c')]=_[_0xcb11('0x3d')](_0x3403bd[_0xcb11('0x39')],_0x3403bd[_0xcb11('0x3a')]);_0x4dfb54[_0xcb11('0x3e')]=_['intersection'](_0x3403bd[_0xcb11('0x39')],qs[_0xcb11('0x3f')](_0x280e69[_0xcb11('0x3a')][_0xcb11('0x3f')]));_0x4dfb54['attributes']=_0x4dfb54[_0xcb11('0x3e')][_0xcb11('0x40')]?_0x4dfb54['attributes']:_0x3403bd[_0xcb11('0x39')];if(_0x280e69[_0xcb11('0x3a')][_0xcb11('0x4c')]){_0x4dfb54[_0xcb11('0x4d')]=[{'all':!![]}];}_0x4dfb54=_[_0xcb11('0x47')]({},_0x4dfb54,_0x280e69[_0xcb11('0x4a')]);return db[_0xcb11('0x4b')][_0xcb11('0x52')](_0x4dfb54)[_0xcb11('0x1d')](handleEntityNotFound(_0x572633,null))[_0xcb11('0x1d')](respondWithResult(_0x572633,null))['catch'](handleError(_0x572633,null));};exports['create']=function(_0x4d69af,_0x284c51){return db[_0xcb11('0x4b')]['create'](_0x4d69af['body'],{})['then'](respondWithResult(_0x284c51,0xc9))['catch'](handleError(_0x284c51,null));};exports[_0xcb11('0x53')]=function(_0x388d09,_0x180015){if(_0x388d09[_0xcb11('0x54')]['id']){delete _0x388d09[_0xcb11('0x54')]['id'];}return db[_0xcb11('0x4b')][_0xcb11('0x52')]({'where':{'id':_0x388d09[_0xcb11('0x51')]['id']}})[_0xcb11('0x1d')](handleEntityNotFound(_0x180015,null))['then'](saveUpdates(_0x388d09[_0xcb11('0x54')],null))[_0xcb11('0x1d')](respondWithResult(_0x180015,null))[_0xcb11('0x26')](handleError(_0x180015,null));};exports['destroy']=function(_0x5ee21b,_0x209716){return db[_0xcb11('0x4b')]['find']({'where':{'id':_0x5ee21b[_0xcb11('0x51')]['id']}})[_0xcb11('0x1d')](handleEntityNotFound(_0x209716,null))['then'](removeEntity(_0x209716,null))[_0xcb11('0x26')](handleError(_0x209716,null));};exports[_0xcb11('0x55')]=function(_0x4363a9,_0x168ec9){return db[_0xcb11('0x4b')][_0xcb11('0x55')]()[_0xcb11('0x1d')](respondWithResult(_0x168ec9,null))[_0xcb11('0x26')](handleError(_0x168ec9,null));};var interaction_log=require(_0xcb11('0x56'))(_0xcb11('0x57'));exports['accept']=function(_0x4aa6de,_0x53773e,_0x5db6be){var _0x3946dd={'agent':{},'channel':'whatsapp'};if(_0x4aa6de[_0xcb11('0x54')]['id']){delete _0x4aa6de['body']['id'];}_0x4aa6de[_0xcb11('0x54')][_0xcb11('0x58')]=!![];_0x4aa6de['body']['readAt']=moment()[_0xcb11('0x59')](_0xcb11('0x5a'));_0x4aa6de[_0xcb11('0x54')][_0xcb11('0x5b')]=_0x4aa6de['body']['UserId']||_0x4aa6de[_0xcb11('0x5c')]['id'];_0x3946dd[_0xcb11('0x5d')]['id']=_0x4aa6de[_0xcb11('0x54')]['UserId'];return db[_0xcb11('0x4b')][_0xcb11('0x52')]({'where':{'id':_0x4aa6de[_0xcb11('0x51')]['id'],'UserId':null}})[_0xcb11('0x1d')](handleEntityNotFound(_0x53773e,null))[_0xcb11('0x1d')](saveUpdates(_0x4aa6de[_0xcb11('0x54')],null))[_0xcb11('0x1d')](function(_0x3b8dd9){if(_0x3b8dd9){_0x3946dd[_0xcb11('0x24')]=_0x3b8dd9[_0xcb11('0x5e')]({'plain':!![]});return db[_0xcb11('0x5f')][_0xcb11('0x52')]({'where':{'id':_0x3b8dd9[_0xcb11('0x60')]}});}return null;})[_0xcb11('0x1d')](handleEntityNotFound(_0x53773e,null))[_0xcb11('0x1d')](function(_0xe0f5b1){if(_0xe0f5b1){return _0xe0f5b1[_0xcb11('0x53')]({'UserId':_0x4aa6de[_0xcb11('0x54')][_0xcb11('0x5b')],'read1stAt':_[_0xcb11('0x61')](_0xe0f5b1[_0xcb11('0x62')])?moment()[_0xcb11('0x59')](_0xcb11('0x5a')):undefined});}return null;})[_0xcb11('0x1d')](function(_0x53859f){if(_0x53859f){_0x3946dd[_0xcb11('0x63')]=_0x53859f[_0xcb11('0x5e')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4aa6de[_0xcb11('0x5c')]['id'],_0x4aa6de[_0xcb11('0x5c')]['name'],_0x4aa6de['user'][_0xcb11('0x64')],_0x3946dd['interaction']['id'],_0x4aa6de[_0xcb11('0x54')]?JSON['stringify'](_0x4aa6de[_0xcb11('0x54')]):_0xcb11('0x65'));return respondWithRpcPromise(_0xcb11('0x66'),_0xcb11('0x67'),_0x3946dd);}return null;})[_0xcb11('0x1d')](function(_0x273718){var _0x53f6b2=_0xcb11('0x68')+_0x273718[_0xcb11('0x24')][_0xcb11('0x69')];return db['sequelize'][_0xcb11('0x3a')](_0x53f6b2,{'type':db[_0xcb11('0x6a')][_0xcb11('0x6b')]['SELECT'],'raw':!![]})['then'](function(_0x1ebd81){return _0x1ebd81;});})[_0xcb11('0x1d')](function(_0x1219e9){if(_0x1219e9){_0x3946dd[_0xcb11('0x24')][_0xcb11('0x6c')]=_0x1219e9[0x0];if(!_0x4aa6de[_0xcb11('0x54')][_0xcb11('0x5b')])return;return db[_0xcb11('0x6d')][_0xcb11('0x52')]({'where':{'id':_0x4aa6de['body'][_0xcb11('0x5b')],'role':'agent'},'attributes':['id',_0xcb11('0x34'),_0xcb11('0x6e'),_0xcb11('0x6f'),_0xcb11('0x70')],'raw':!![]});}return null;})[_0xcb11('0x1d')](function(_0x331de8){if(!_0x331de8)return null;_0x3946dd[_0xcb11('0x24')]['agent']=_0x331de8;return _0x3946dd;})['then'](function(_0x1c17e6){if(_0x1c17e6){if(_0x4aa6de[_0xcb11('0x54')][_0xcb11('0x71')]){_0x3946dd[_0xcb11('0x24')][_0xcb11('0x72')]=util[_0xcb11('0x59')](_0xcb11('0x73'),_0x4aa6de[_0xcb11('0x5c')][_0xcb11('0x34')]);_0x3946dd['message'][_0xcb11('0x74')]=_0x3946dd['channel'];_0x3946dd[_0xcb11('0x24')]['motionChannel']=_0x3946dd[_0xcb11('0x74')];_0x3946dd[_0xcb11('0x24')][_0xcb11('0x75')]=_0xcb11('0x76');return respondWithRpcPromise(_0xcb11('0x77'),_0xcb11('0x77'),{'event':_0xcb11('0x78'),'message':_0x3946dd[_0xcb11('0x24')]},client9002)[_0xcb11('0x1d')](function(){return _0x3946dd;});}return _0x3946dd;}return null;})[_0xcb11('0x1d')](respondWithResult(_0x53773e,null))[_0xcb11('0x26')](handleError(_0x53773e,null));};var interaction_log=require(_0xcb11('0x56'))(_0xcb11('0x57'));exports[_0xcb11('0x31')]=function(_0x47e05a,_0x3f3f83,_0x36d4cc){var _0x544dba={'agent':{},'channel':_0xcb11('0x79')};if(_0x47e05a[_0xcb11('0x54')]['id']){delete _0x47e05a['body']['id'];}_0x47e05a[_0xcb11('0x54')]['UserId']=_0x47e05a[_0xcb11('0x54')][_0xcb11('0x5b')]||_0x47e05a['user']['id'];_0x544dba['agent']['id']=_0x47e05a[_0xcb11('0x54')][_0xcb11('0x5b')];return db[_0xcb11('0x4b')]['find']({'where':{'id':_0x47e05a['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3f3f83,null))[_0xcb11('0x1d')](function(_0x1e4e1e){if(_0x1e4e1e){_0x544dba['message']=_0x1e4e1e['get']({'plain':!![]});return db[_0xcb11('0x5f')][_0xcb11('0x52')]({'where':{'id':_0x1e4e1e[_0xcb11('0x60')]}});}return null;})[_0xcb11('0x1d')](handleEntityNotFound(_0x3f3f83,null))['then'](function(_0x5bf7a8){if(_0x5bf7a8){_0x544dba[_0xcb11('0x63')]=_0x5bf7a8[_0xcb11('0x5e')]({'plain':!![]});interaction_log[_0xcb11('0x1e')](_0xcb11('0x7a'),_0x47e05a[_0xcb11('0x5c')]['id'],_0x47e05a['user']['name'],_0x47e05a['user']['role'],_0x544dba['interaction']['id'],_0x47e05a['body']?JSON[_0xcb11('0x21')](_0x47e05a[_0xcb11('0x54')]):_0xcb11('0x65'));return respondWithRpcPromise(_0xcb11('0x7b'),_0xcb11('0x7c'),_0x544dba);}return null;})[_0xcb11('0x1d')](function(_0x156008){var _0x4005d2=_0xcb11('0x68')+_0x156008[_0xcb11('0x24')][_0xcb11('0x69')];return db[_0xcb11('0x7d')]['query'](_0x4005d2,{'type':db['Sequelize'][_0xcb11('0x6b')][_0xcb11('0x7e')],'raw':!![]})[_0xcb11('0x1d')](function(_0x46f60c){return _0x46f60c;});})[_0xcb11('0x1d')](function(_0x30a2e5){if(_0x30a2e5){_0x544dba[_0xcb11('0x24')][_0xcb11('0x6c')]=_0x30a2e5[0x0];if(!_0x47e05a[_0xcb11('0x54')]['UserId'])return;return db['User'][_0xcb11('0x52')]({'where':{'id':_0x47e05a[_0xcb11('0x54')]['UserId'],'role':_0xcb11('0x5d')},'attributes':['id',_0xcb11('0x34'),_0xcb11('0x6e'),_0xcb11('0x6f'),'internal'],'raw':!![]});}return null;})[_0xcb11('0x1d')](function(_0x5e351d){if(!_0x5e351d)return null;_0x544dba[_0xcb11('0x24')][_0xcb11('0x5d')]=_0x5e351d;return _0x544dba;})[_0xcb11('0x1d')](function(_0x302d06){if(_0x302d06){_0x302d06['message'][_0xcb11('0x72')]=util[_0xcb11('0x59')](_0xcb11('0x73'),_0x47e05a[_0xcb11('0x5c')][_0xcb11('0x34')]);_0x302d06['message'][_0xcb11('0x74')]=_0x544dba[_0xcb11('0x74')];_0x302d06['message'][_0xcb11('0x7f')]=_0x544dba[_0xcb11('0x74')];_0x302d06[_0xcb11('0x24')][_0xcb11('0x75')]=_0xcb11('0x31');respondWithRpcPromise(_0xcb11('0x77'),_0xcb11('0x77'),{'event':_0xcb11('0x80'),'message':_0x302d06[_0xcb11('0x24')]},client9002);return _0x544dba;}return null;})[_0xcb11('0x1d')](respondWithResult(_0x3f3f83,null))['catch'](handleError(_0x3f3f83,null));};exports['status']=function(_0x433a1a,_0xe41015,_0x4a363f){if(_0x433a1a[_0xcb11('0x54')]['id']){delete _0x433a1a['body']['id'];}var _0x53491c;return db[_0xcb11('0x4b')]['find']({'where':{'id':_0x433a1a[_0xcb11('0x51')]['id']}})[_0xcb11('0x1d')](handleEntityNotFound(_0xe41015,null))['then'](function(_0x36440e){if(_0x36440e){_0x53491c=_0x36440e;return db[_0xcb11('0x81')][_0xcb11('0x52')]({'where':{'id':_0x36440e['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0xe41015,null))[_0xcb11('0x1d')](function(_0x11984c){if(_0x11984c){logger[_0xcb11('0x82')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xcb11('0x28'),_0xcb11('0x83'),_0x11984c['type'],util['inspect'](_0x433a1a[_0xcb11('0x54')],{'showHidden':![],'depth':null}));switch(_0x11984c['type']){case'twilio':if(_0x433a1a[_0xcb11('0x54')]['MessageSid']&&_0x433a1a[_0xcb11('0x54')][_0xcb11('0x84')]===_0x53491c[_0xcb11('0x85')]&&_0x433a1a['body'][_0xcb11('0x86')]&&_0x433a1a['body']['MessageStatus']==='read'){return _0x53491c[_0xcb11('0x53')]({'read':!![]});}else{logger[_0xcb11('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xcb11('0x28'),_0xcb11('0x87'),util[_0xcb11('0x88')](_0x433a1a[_0xcb11('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x53491c;}})[_0xcb11('0x1d')](respondWithResult(_0xe41015,null))[_0xcb11('0x26')](handleError(_0xe41015,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 7f60f39..833aee5 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 _0xa478=['hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5b6c7c,_0x511733){var _0x348d9f=function(_0x5b3cf9){while(--_0x5b3cf9){_0x5b6c7c['push'](_0x5b6c7c['shift']());}};_0x348d9f(++_0x511733);}(_0xa478,0x136));var _0x8a47=function(_0x430f44,_0x4ae21b){_0x430f44=_0x430f44-0x0;var _0x1f6b0f=_0xa478[_0x430f44];return _0x1f6b0f;};'use strict';var EventEmitter=require(_0x8a47('0x0'));var WhatsappMessage=require(_0x8a47('0x1'))['db'][_0x8a47('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x8a47('0x3')](0x0);var events={'afterCreate':_0x8a47('0x4'),'afterUpdate':_0x8a47('0x5'),'afterDestroy':_0x8a47('0x6')};function emitEvent(_0x37a882){return function(_0x2b3110,_0x256550,_0x6e2ab5){WhatsappMessageEvents[_0x8a47('0x7')](_0x37a882+':'+_0x2b3110['id'],_0x2b3110);WhatsappMessageEvents['emit'](_0x37a882,_0x2b3110);_0x6e2ab5(null);};}for(var e in events){if(events[_0x8a47('0x8')](e)){var event=events[e];WhatsappMessage[_0x8a47('0x9')](e,emitEvent(event));}}module[_0x8a47('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0x8f59=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage'];(function(_0x180844,_0x4ee45b){var _0x2295a9=function(_0x4b72fb){while(--_0x4b72fb){_0x180844['push'](_0x180844['shift']());}};_0x2295a9(++_0x4ee45b);}(_0x8f59,0x11d));var _0x98f5=function(_0x49bf94,_0x1b48c7){_0x49bf94=_0x49bf94-0x0;var _0x88831d=_0x8f59[_0x49bf94];return _0x88831d;};'use strict';var EventEmitter=require(_0x98f5('0x0'));var WhatsappMessage=require(_0x98f5('0x1'))['db'][_0x98f5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x98f5('0x3')](0x0);var events={'afterCreate':_0x98f5('0x4'),'afterUpdate':_0x98f5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x912492){return function(_0x320235,_0x107e7e,_0x2f8c31){WhatsappMessageEvents['emit'](_0x912492+':'+_0x320235['id'],_0x320235);WhatsappMessageEvents[_0x98f5('0x6')](_0x912492,_0x320235);_0x2f8c31(null);};}for(var e in events){if(events[_0x98f5('0x7')](e)){var event=events[e];WhatsappMessage[_0x98f5('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index dc1f15e..b362a38 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 _0x1100=['fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','then','catch','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','messages','body','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','afterCreate','inspect','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','text','Bearer\x20','application/json','message_id','err','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','messageId'];(function(_0x42310e,_0x2ecd55){var _0x50b06f=function(_0x344d8e){while(--_0x344d8e){_0x42310e['push'](_0x42310e['shift']());}};_0x50b06f(++_0x2ecd55);}(_0x1100,0xd7));var _0x0110=function(_0x24d6bd,_0x40fb1d){_0x24d6bd=_0x24d6bd-0x0;var _0x4840bb=_0x1100[_0x24d6bd];return _0x4840bb;};'use strict';var _=require(_0x0110('0x0'));var util=require(_0x0110('0x1'));var logger=require(_0x0110('0x2'))('api');var moment=require(_0x0110('0x3'));var BPromise=require(_0x0110('0x4'));var rp=require(_0x0110('0x5'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x0110('0x6'));var rimraf=require(_0x0110('0x7'));var config=require(_0x0110('0x8'));var attributes=require(_0x0110('0x9'));module[_0x0110('0xa')]=function(_0x44afda,_0x345978){return _0x44afda[_0x0110('0xb')]('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x0110('0xc'),'fields':['messageId']},{'name':_0x0110('0xd'),'fields':['body'],'type':_0x0110('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f37c4,_0x1daa71,_0x362607){var _0x1d3658=_0x44afda[_0x0110('0xf')];var _0x503cd2=_0x1f37c4[_0x0110('0x10')]({'plain':!![]});if(_0x503cd2[_0x0110('0x11')][_0x0110('0x12')]()==='in'||_0x503cd2[_0x0110('0x11')][_0x0110('0x12')]()===_0x0110('0x13')&&!_0x503cd2[_0x0110('0x14')]&&!_[_0x0110('0x15')](_0x503cd2[_0x0110('0x16')])){_0x1d3658[_0x0110('0x17')]['findOne']({'where':{'id':_0x503cd2['WhatsappInteractionId']}})[_0x0110('0x18')](function(_0x4ed0c3){if(_0x4ed0c3){_0x4ed0c3['update']({'lastMsgAt':_0x503cd2['createdAt'],'lastMsgDirection':_0x503cd2[_0x0110('0x11')][_0x0110('0x12')]()});}})[_0x0110('0x19')](function(_0x268dfa){console['error'](_0x268dfa);});}if(_0x503cd2[_0x0110('0x11')]===_0x0110('0x13')&&!_0x503cd2[_0x0110('0x14')]){var _0x2f52aa;_0x1d3658[_0x0110('0x1a')][_0x0110('0x1b')]({'where':{'id':_0x503cd2[_0x0110('0x1c')]},'raw':!![]})[_0x0110('0x18')](function(_0x24a5cb){_0x2f52aa=_0x24a5cb;if(_0x2f52aa&&_0x2f52aa[_0x0110('0x1d')]){switch(_0x2f52aa[_0x0110('0x1d')]){case'twilio':var _0x3ccad1=require(_0x0110('0x1e'));if(_0x2f52aa[_0x0110('0x1f')]&&_0x2f52aa[_0x0110('0x20')]&&_0x2f52aa['phone']){var _0xfed7d7=new _0x3ccad1(_0x2f52aa[_0x0110('0x1f')],_0x2f52aa[_0x0110('0x20')]);_0xfed7d7[_0x0110('0x21')]['create']({'body':_0x503cd2[_0x0110('0x22')],'to':_0x0110('0x23')+_0x503cd2['phone'],'from':'whatsapp:'+_0x2f52aa[_0x0110('0x24')],'statusCallback':_0x2f52aa[_0x0110('0x25')]+_0x0110('0x26')+_0x503cd2['id']+_0x0110('0x27')+_0x2f52aa[_0x0110('0x28')]})[_0x0110('0x18')](function(_0x5ac555){if(_0x5ac555[_0x0110('0x29')]){return _0x1f37c4[_0x0110('0x2a')]({'messageId':_0x5ac555[_0x0110('0x29')]});}})[_0x0110('0x19')](function(_0x1baa57){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x0110('0x2b'),_0x0110('0x1e'),util[_0x0110('0x2c')](_0x1baa57,{'showHidden':![],'depth':null}));});}else{logger[_0x0110('0x2d')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x0110('0x2b'),_0x0110('0x1e'),_0x0110('0x2e'));}break;case _0x0110('0x2f'):var _0x188c8b=_0x2f52aa[_0x0110('0x1f')];var _0x555611=_0x2f52aa['authToken'];var _0x2cccb4=_0x2f52aa[_0x0110('0x30')]+_0x0110('0x31')+_0x188c8b+'/messages/';var _0x2b0431={'to':[_0x503cd2['phone']],'message':{'type':_0x0110('0x32'),'text':_0x503cd2[_0x0110('0x22')]}};var _0x5dce31={'method':'POST','uri':_0x2cccb4,'headers':{'Authorization':_0x0110('0x33')+_0x555611,'Content-Type':_0x0110('0x34')},'body':_0x2b0431,'json':!![]};rp(_0x5dce31)[_0x0110('0x18')](function(_0x3dbd66){if(_0x3dbd66['statuses'][0x0][_0x0110('0x35')]){return _0x1f37c4[_0x0110('0x2a')]({'messageId':_0x3dbd66['statuses'][0x0][_0x0110('0x35')]});}})[_0x0110('0x19')](function(_0x58bdab){logger[_0x0110('0x36')]('WhatsappMessage,\x20%s',_0x58bdab);});break;}}})['finally'](function(){_0x362607();});}else{_0x362607();}}},'charset':_0x0110('0x37'),'collate':_0x0110('0x38')});}; \ No newline at end of file +var _0xcfca=['FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','body','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','/whatsapp/v1/','/messages/','text','Bearer\x20','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0xcfca,0x6a));var _0xacfc=function(_0x5db7ee,_0x15c59e){_0x5db7ee=_0x5db7ee-0x0;var _0x56c136=_0xcfca[_0x5db7ee];return _0x56c136;};'use strict';var _=require(_0xacfc('0x0'));var util=require(_0xacfc('0x1'));var logger=require('../../config/logger')(_0xacfc('0x2'));var moment=require(_0xacfc('0x3'));var BPromise=require(_0xacfc('0x4'));var rp=require(_0xacfc('0x5'));var fetch=require(_0xacfc('0x6'));var fs=require('fs');var path=require(_0xacfc('0x7'));var rimraf=require(_0xacfc('0x8'));var config=require(_0xacfc('0x9'));var attributes=require(_0xacfc('0xa'));module[_0xacfc('0xb')]=function(_0xba24ea,_0x23c2a0){return _0xba24ea[_0xacfc('0xc')]('WhatsappMessage',attributes,{'tableName':_0xacfc('0xd'),'paranoid':![],'indexes':[{'name':_0xacfc('0xe'),'fields':['messageId']},{'name':_0xacfc('0xf'),'fields':['body'],'type':_0xacfc('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x49be8e,_0x102df8,_0x4c69c6){var _0x596d78=_0xba24ea['models'];var _0x1b242e=_0x49be8e[_0xacfc('0x11')]({'plain':!![]});if(_0x1b242e[_0xacfc('0x12')][_0xacfc('0x13')]()==='in'||_0x1b242e[_0xacfc('0x12')][_0xacfc('0x13')]()===_0xacfc('0x14')&&!_0x1b242e[_0xacfc('0x15')]&&!_[_0xacfc('0x16')](_0x1b242e[_0xacfc('0x17')])){_0x596d78[_0xacfc('0x18')][_0xacfc('0x19')]({'where':{'id':_0x1b242e[_0xacfc('0x1a')]}})[_0xacfc('0x1b')](function(_0x3e8b4b){if(_0x3e8b4b){_0x3e8b4b['update']({'lastMsgAt':_0x1b242e['createdAt'],'lastMsgDirection':_0x1b242e[_0xacfc('0x12')]['toLowerCase']()});}})[_0xacfc('0x1c')](function(_0x2596bb){console[_0xacfc('0x1d')](_0x2596bb);});}if(_0x1b242e[_0xacfc('0x12')]==='out'&&!_0x1b242e[_0xacfc('0x15')]){var _0x5ed1b7;_0x596d78[_0xacfc('0x1e')][_0xacfc('0x1f')]({'where':{'id':_0x1b242e[_0xacfc('0x20')]},'raw':!![]})[_0xacfc('0x1b')](function(_0x38ea97){_0x5ed1b7=_0x38ea97;if(_0x5ed1b7&&_0x5ed1b7[_0xacfc('0x21')]){switch(_0x5ed1b7[_0xacfc('0x21')]){case _0xacfc('0x22'):var _0x3f15ac=require(_0xacfc('0x22'));if(_0x5ed1b7[_0xacfc('0x23')]&&_0x5ed1b7[_0xacfc('0x24')]&&_0x5ed1b7['phone']){var _0x1f3c99=new _0x3f15ac(_0x5ed1b7['accountSid'],_0x5ed1b7[_0xacfc('0x24')]);_0x1f3c99[_0xacfc('0x25')][_0xacfc('0x26')]({'body':_0x1b242e[_0xacfc('0x27')],'to':_0xacfc('0x28')+_0x1b242e[_0xacfc('0x29')],'from':_0xacfc('0x28')+_0x5ed1b7[_0xacfc('0x29')],'statusCallback':_0x5ed1b7[_0xacfc('0x2a')]+_0xacfc('0x2b')+_0x1b242e['id']+_0xacfc('0x2c')+_0x5ed1b7[_0xacfc('0x2d')]})[_0xacfc('0x1b')](function(_0x318a38){if(_0x318a38[_0xacfc('0x2e')]){return _0x49be8e[_0xacfc('0x2f')]({'messageId':_0x318a38['sid']});}})['catch'](function(_0x587078){logger[_0xacfc('0x1d')](_0xacfc('0x30'),_0xacfc('0x31'),'twilio',util[_0xacfc('0x32')](_0x587078,{'showHidden':![],'depth':null}));});}else{logger[_0xacfc('0x1d')](_0xacfc('0x30'),_0xacfc('0x31'),_0xacfc('0x22'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'sinch':var _0x855762=_0x5ed1b7[_0xacfc('0x23')];var _0x5047a3=_0x5ed1b7['authToken'];var _0xef3c55=_0x5ed1b7['baseUrl']+_0xacfc('0x33')+_0x855762+_0xacfc('0x34');var _0x263f77={'to':[_0x1b242e['phone']],'message':{'type':_0xacfc('0x35'),'text':_0x1b242e[_0xacfc('0x27')]}};var _0x2fb72={'method':'POST','uri':_0xef3c55,'headers':{'Authorization':_0xacfc('0x36')+_0x5047a3,'Content-Type':'application/json'},'body':_0x263f77,'json':!![]};rp(_0x2fb72)[_0xacfc('0x1b')](function(_0x5a1452){if(_0x5a1452[_0xacfc('0x37')][0x0][_0xacfc('0x38')]){return _0x49be8e[_0xacfc('0x2f')]({'messageId':_0x5a1452[_0xacfc('0x37')][0x0][_0xacfc('0x38')]});}})[_0xacfc('0x1c')](function(_0xa119a1){logger[_0xacfc('0x39')](_0xacfc('0x3a'),_0xa119a1);});break;}}})['finally'](function(){_0x4c69c6();});}else{_0x4c69c6();}}},'charset':_0xacfc('0x3b'),'collate':_0xacfc('0x3c')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 89e6f5b..1e85dc8 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 _0xc949=['error','code','message','result','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x177f45,_0x364c0a){var _0x2e13db=function(_0x577ab0){while(--_0x577ab0){_0x177f45['push'](_0x177f45['shift']());}};_0x2e13db(++_0x364c0a);}(_0xc949,0xdc));var _0x9c94=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc949[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x9c94('0x0'));var util=require(_0x9c94('0x1'));var moment=require(_0x9c94('0x2'));var BPromise=require(_0x9c94('0x3'));var rs=require(_0x9c94('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c94('0x5'))['db'];var utils=require(_0x9c94('0x6'));var logger=require(_0x9c94('0x7'))(_0x9c94('0x8'));var config=require(_0x9c94('0x9'));var jayson=require(_0x9c94('0xa'));var client=jayson[_0x9c94('0xb')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x9c94('0xc')],{'host':_0x9c94('0xd'),'port':0x18eb});var socket=require(_0x9c94('0xe'))(new Redis(config['redis']));require(_0x9c94('0xf'))[_0x9c94('0x10')](socket);function respondWithRpcPromise(_0x1ee03c,_0x27992,_0x815356){return new BPromise(function(_0xe59e4c,_0x1943cf){return client[_0x9c94('0x11')](_0x1ee03c,_0x815356)[_0x9c94('0x12')](function(_0x324227){logger[_0x9c94('0x13')](_0x9c94('0x14'),_0x27992,_0x9c94('0x15'));logger[_0x9c94('0x16')](_0x9c94('0x17'),_0x27992,_0x9c94('0x15'),JSON[_0x9c94('0x18')](_0x324227));if(_0x324227[_0x9c94('0x19')]){if(_0x324227[_0x9c94('0x19')][_0x9c94('0x1a')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x27992,_0x324227[_0x9c94('0x19')]['message']);return _0x1943cf(_0x324227['error']['message']);}logger[_0x9c94('0x19')](_0x9c94('0x14'),_0x27992,_0x324227['error']['message']);return _0xe59e4c(_0x324227[_0x9c94('0x19')][_0x9c94('0x1b')]);}else{logger[_0x9c94('0x13')](_0x9c94('0x14'),_0x27992,'request\x20sent');_0xe59e4c(_0x324227[_0x9c94('0x1c')][_0x9c94('0x1b')]);}})['catch'](function(_0x1e8f7a){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x27992,_0x1e8f7a);_0x1943cf(_0x1e8f7a);});});}exports[_0x9c94('0x1d')]=function(_0x1a3a02){var _0x48ef82=this;return new Promise(function(_0x41b4d4,_0x2b3cf1){return db[_0x9c94('0x1e')][_0x9c94('0x1f')](_0x1a3a02[_0x9c94('0x20')],{'raw':_0x1a3a02[_0x9c94('0x21')]?_0x1a3a02['options'][_0x9c94('0x22')]===undefined?!![]:![]:!![]})[_0x9c94('0x12')](function(_0x1ce634){logger[_0x9c94('0x13')]('CreateWhatsappMessage',_0x1a3a02);logger[_0x9c94('0x16')](_0x9c94('0x1d'),_0x1a3a02,JSON[_0x9c94('0x18')](_0x1ce634));_0x41b4d4(_0x1ce634);})['catch'](function(_0x47cd74){logger['error'](_0x9c94('0x1d'),_0x47cd74[_0x9c94('0x1b')],_0x1a3a02);_0x2b3cf1(_0x48ef82['error'](0x1f4,_0x47cd74[_0x9c94('0x1b')]));});});}; \ No newline at end of file +var _0x6261=['info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','WhatsappMessage','create','body','options','raw','debug','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then'];(function(_0x2f5147,_0x3dc50d){var _0x48a3db=function(_0x585851){while(--_0x585851){_0x2f5147['push'](_0x2f5147['shift']());}};_0x48a3db(++_0x3dc50d);}(_0x6261,0x107));var _0x1626=function(_0x2cc7fd,_0x469775){_0x2cc7fd=_0x2cc7fd-0x0;var _0x30b726=_0x6261[_0x2cc7fd];return _0x30b726;};'use strict';var _=require('lodash');var util=require(_0x1626('0x0'));var moment=require('moment');var BPromise=require(_0x1626('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1626('0x2'));var db=require(_0x1626('0x3'))['db'];var utils=require(_0x1626('0x4'));var logger=require(_0x1626('0x5'))(_0x1626('0x6'));var config=require('../../config/environment');var jayson=require(_0x1626('0x7'));var client=jayson[_0x1626('0x8')]['http']({'port':0x232a});config[_0x1626('0x9')]=_['defaults'](config[_0x1626('0x9')],{'host':_0x1626('0xa'),'port':0x18eb});var socket=require(_0x1626('0xb'))(new Redis(config['redis']));require(_0x1626('0xc'))[_0x1626('0xd')](socket);function respondWithRpcPromise(_0x1df6af,_0x355948,_0x3eb0aa){return new BPromise(function(_0x188075,_0x4415a9){return client[_0x1626('0xe')](_0x1df6af,_0x3eb0aa)[_0x1626('0xf')](function(_0x370692){logger[_0x1626('0x10')](_0x1626('0x11'),_0x355948,_0x1626('0x12'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x355948,_0x1626('0x12'),JSON[_0x1626('0x13')](_0x370692));if(_0x370692[_0x1626('0x14')]){if(_0x370692[_0x1626('0x14')][_0x1626('0x15')]===0x1f4){logger[_0x1626('0x14')](_0x1626('0x11'),_0x355948,_0x370692['error']['message']);return _0x4415a9(_0x370692[_0x1626('0x14')][_0x1626('0x16')]);}logger[_0x1626('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x355948,_0x370692[_0x1626('0x14')][_0x1626('0x16')]);return _0x188075(_0x370692[_0x1626('0x14')][_0x1626('0x16')]);}else{logger[_0x1626('0x10')](_0x1626('0x11'),_0x355948,_0x1626('0x12'));_0x188075(_0x370692[_0x1626('0x17')]['message']);}})[_0x1626('0x18')](function(_0x405e42){logger[_0x1626('0x14')](_0x1626('0x11'),_0x355948,_0x405e42);_0x4415a9(_0x405e42);});});}exports['CreateWhatsappMessage']=function(_0x194e59){var _0x1c722f=this;return new Promise(function(_0x493214,_0x804f50){return db[_0x1626('0x19')][_0x1626('0x1a')](_0x194e59[_0x1626('0x1b')],{'raw':_0x194e59[_0x1626('0x1c')]?_0x194e59['options'][_0x1626('0x1d')]===undefined?!![]:![]:!![]})[_0x1626('0xf')](function(_0xf186bc){logger['info']('CreateWhatsappMessage',_0x194e59);logger[_0x1626('0x1e')]('CreateWhatsappMessage',_0x194e59,JSON[_0x1626('0x13')](_0xf186bc));_0x493214(_0xf186bc);})[_0x1626('0x18')](function(_0x54d8c8){logger[_0x1626('0x14')]('CreateWhatsappMessage',_0x54d8c8['message'],_0x194e59);_0x804f50(_0x1c722f[_0x1626('0x14')](0x1f4,_0x54d8c8['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 9cb85e3..9e86475 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 _0x63ba=['save','update','emit','removeListener','register','length'];(function(_0x19732b,_0x308e06){var _0x132832=function(_0xabec5e){while(--_0xabec5e){_0x19732b['push'](_0x19732b['shift']());}};_0x132832(++_0x308e06);}(_0x63ba,0x162));var _0xa63b=function(_0x450179,_0xa1039f){_0x450179=_0x450179-0x0;var _0xc3113e=_0x63ba[_0x450179];return _0xc3113e;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xa63b('0x0'),'remove',_0xa63b('0x1')];function createListener(_0x40e810,_0x208b4b){return function(_0x9f2e9){_0x208b4b[_0xa63b('0x2')](_0x40e810,_0x9f2e9);};}function removeListener(_0x278b85,_0x371350){return function(){WhatsappMessageEvents[_0xa63b('0x3')](_0x278b85,_0x371350);};}exports[_0xa63b('0x4')]=function(_0x4d032b){for(var _0x41b798=0x0,_0x259850=events[_0xa63b('0x5')];_0x41b798<_0x259850;_0x41b798++){var _0x32f096=events[_0x41b798];var _0x401aba=createListener('whatsappMessage:'+_0x32f096,_0x4d032b);WhatsappMessageEvents['on'](_0x32f096,_0x401aba);}}; \ No newline at end of file +var _0xe1d4=['./whatsappMessage.events','remove','update','emit','removeListener','length','whatsappMessage:'];(function(_0x3b2369,_0x4c68b9){var _0x5a1367=function(_0x58ddcf){while(--_0x58ddcf){_0x3b2369['push'](_0x3b2369['shift']());}};_0x5a1367(++_0x4c68b9);}(_0xe1d4,0x1c0));var _0x4e1d=function(_0xbab88,_0x4dd205){_0xbab88=_0xbab88-0x0;var _0x33a607=_0xe1d4[_0xbab88];return _0x33a607;};'use strict';var WhatsappMessageEvents=require(_0x4e1d('0x0'));var events=['save',_0x4e1d('0x1'),_0x4e1d('0x2')];function createListener(_0x2dc413,_0xce1460){return function(_0x4232d3){_0xce1460[_0x4e1d('0x3')](_0x2dc413,_0x4232d3);};}function removeListener(_0x3dde66,_0x46c757){return function(){WhatsappMessageEvents[_0x4e1d('0x4')](_0x3dde66,_0x46c757);};}exports['register']=function(_0xff5372){for(var _0x4e0de6=0x0,_0x431ea1=events[_0x4e1d('0x5')];_0x4e0de6<_0x431ea1;_0x4e0de6++){var _0x255ab3=events[_0x4e0de6];var _0x3ce099=createListener(_0x4e1d('0x6')+_0x255ab3,_0xff5372);WhatsappMessageEvents['on'](_0x255ab3,_0x3ce099);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 55ee10f..316e7c4 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 _0x0e3f=['describe','/:id','/:id/members','getMembers','getTeams','/:id/users','create','addAgents','put','update','delete','/:id/teams','removeTeams','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index'];(function(_0x5b445b,_0xd251da){var _0x1a40fe=function(_0x218fce){while(--_0x218fce){_0x5b445b['push'](_0x5b445b['shift']());}};_0x1a40fe(++_0xd251da);}(_0x0e3f,0x12e));var _0xf0e3=function(_0x47bb53,_0x28fe7b){_0x47bb53=_0x47bb53-0x0;var _0x12c66e=_0x0e3f[_0x47bb53];return _0x12c66e;};'use strict';var multer=require(_0xf0e3('0x0'));var util=require('util');var path=require(_0xf0e3('0x1'));var timeout=require(_0xf0e3('0x2'));var express=require(_0xf0e3('0x3'));var router=express[_0xf0e3('0x4')]();var fs_extra=require(_0xf0e3('0x5'));var auth=require(_0xf0e3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0xf0e3('0x7')]('/',auth[_0xf0e3('0x8')](),controller[_0xf0e3('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xf0e3('0xa')]);router[_0xf0e3('0x7')](_0xf0e3('0xb'),auth[_0xf0e3('0x8')](),controller['show']);router[_0xf0e3('0x7')](_0xf0e3('0xc'),auth['isAuthenticated'](),controller[_0xf0e3('0xd')]);router['get']('/:id/teams',auth[_0xf0e3('0x8')](),controller[_0xf0e3('0xe')]);router[_0xf0e3('0x7')](_0xf0e3('0xf'),auth[_0xf0e3('0x8')](),controller['getAgents']);router['post']('/',auth[_0xf0e3('0x8')](),controller[_0xf0e3('0x10')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router['post']('/:id/users',auth[_0xf0e3('0x8')](),controller[_0xf0e3('0x11')]);router[_0xf0e3('0x12')](_0xf0e3('0xb'),auth[_0xf0e3('0x8')](),controller[_0xf0e3('0x13')]);router[_0xf0e3('0x14')](_0xf0e3('0xb'),auth[_0xf0e3('0x8')](),controller['destroy']);router[_0xf0e3('0x14')](_0xf0e3('0x15'),auth[_0xf0e3('0x8')](),controller[_0xf0e3('0x16')]);router[_0xf0e3('0x14')]('/:id/users',auth[_0xf0e3('0x8')](),controller['removeAgents']);module[_0xf0e3('0x17')]=router; \ No newline at end of file +var _0xfd33=['update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','put'];(function(_0x556634,_0x520958){var _0x4429fd=function(_0x1e7eb9){while(--_0x1e7eb9){_0x556634['push'](_0x556634['shift']());}};_0x4429fd(++_0x520958);}(_0xfd33,0x97));var _0x3fd3=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xfd33[_0x1e7b16];return _0x37fadc;};'use strict';var multer=require('multer');var util=require(_0x3fd3('0x0'));var path=require(_0x3fd3('0x1'));var timeout=require(_0x3fd3('0x2'));var express=require('express');var router=express[_0x3fd3('0x3')]();var fs_extra=require(_0x3fd3('0x4'));var auth=require(_0x3fd3('0x5'));var interaction=require(_0x3fd3('0x6'));var config=require('../../config/environment');var controller=require(_0x3fd3('0x7'));router[_0x3fd3('0x8')]('/',auth[_0x3fd3('0x9')](),controller[_0x3fd3('0xa')]);router[_0x3fd3('0x8')](_0x3fd3('0xb'),auth[_0x3fd3('0x9')](),controller[_0x3fd3('0xc')]);router[_0x3fd3('0x8')](_0x3fd3('0xd'),auth[_0x3fd3('0x9')](),controller[_0x3fd3('0xe')]);router[_0x3fd3('0x8')](_0x3fd3('0xf'),auth[_0x3fd3('0x9')](),controller['getMembers']);router[_0x3fd3('0x8')](_0x3fd3('0x10'),auth['isAuthenticated'](),controller[_0x3fd3('0x11')]);router[_0x3fd3('0x8')](_0x3fd3('0x12'),auth[_0x3fd3('0x9')](),controller[_0x3fd3('0x13')]);router['post']('/',auth[_0x3fd3('0x9')](),controller[_0x3fd3('0x14')]);router[_0x3fd3('0x15')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x3fd3('0x15')](_0x3fd3('0x12'),auth['isAuthenticated'](),controller['addAgents']);router[_0x3fd3('0x16')](_0x3fd3('0xd'),auth[_0x3fd3('0x9')](),controller[_0x3fd3('0x17')]);router[_0x3fd3('0x18')]('/:id',auth[_0x3fd3('0x9')](),controller[_0x3fd3('0x19')]);router[_0x3fd3('0x18')](_0x3fd3('0x10'),auth['isAuthenticated'](),controller[_0x3fd3('0x1a')]);router[_0x3fd3('0x18')](_0x3fd3('0x12'),auth[_0x3fd3('0x9')](),controller[_0x3fd3('0x1b')]);module[_0x3fd3('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index a5f1e57..e386a04 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 _0x9a62=['STRING','INTEGER','ENUM','roundrobin','exports'];(function(_0x15b14d,_0x4d1729){var _0x42d874=function(_0x1f52a0){while(--_0x1f52a0){_0x15b14d['push'](_0x15b14d['shift']());}};_0x42d874(++_0x4d1729);}(_0x9a62,0x1bc));var _0x29a6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9a62[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require('sequelize');module[_0x29a6('0x0')]={'name':{'type':Sequelize[_0x29a6('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x29a6('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x29a6('0x3')]('rrmemory','beepall',_0x29a6('0x4'))},'description':{'type':Sequelize[_0x29a6('0x1')]}}; \ No newline at end of file +var _0xc1c4=['exports','STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x3ab353,_0x5d5283){var _0x1e2285=function(_0x55804f){while(--_0x55804f){_0x3ab353['push'](_0x3ab353['shift']());}};_0x1e2285(++_0x5d5283);}(_0xc1c4,0x1c7));var _0x4c1c=function(_0x4e3b9e,_0x6d363d){_0x4e3b9e=_0x4e3b9e-0x0;var _0x4d5919=_0xc1c4[_0x4e3b9e];return _0x4d5919;};'use strict';var Sequelize=require(_0x4c1c('0x0'));module[_0x4c1c('0x1')]={'name':{'type':Sequelize[_0x4c1c('0x2')],'unique':_0x4c1c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x4c1c('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4c1c('0x5')](_0x4c1c('0x6'),'beepall',_0x4c1c('0x7'))},'description':{'type':Sequelize[_0x4c1c('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 47de2f0..20fea27 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 _0xaa48=['count','offset','status','set','Content-Range','apply','reject','save','update','then','get','WhatsappQueues','UserProfileResource','destroy','end','stack','name','send','index','map','WhatsappQueue','rawAttributes','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','create','body','user','UserProfileSection','find','error','params','describe','getMembers','findOne','length','nolimit','UserWhatsappQueue','User','UserId','agent','whatsappPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','addTeams','ids','Team','online','voicePause','interface','Agents','sequelize','each','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','includes','all','compact','transaction','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','emit','userWhatsappQueue:save','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','json','undefined','limit'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0xaa48,0xed));var _0x8aa4=function(_0x259ff9,_0x592622){_0x259ff9=_0x259ff9-0x0;var _0x572e7a=_0xaa48[_0x259ff9];return _0x572e7a;};'use strict';var emlformat=require(_0x8aa4('0x0'));var rimraf=require(_0x8aa4('0x1'));var zipdir=require(_0x8aa4('0x2'));var jsonpatch=require(_0x8aa4('0x3'));var rp=require(_0x8aa4('0x4'));var moment=require(_0x8aa4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8aa4('0x6'));var util=require(_0x8aa4('0x7'));var path=require(_0x8aa4('0x8'));var sox=require(_0x8aa4('0x9'));var csv=require(_0x8aa4('0xa'));var ejs=require(_0x8aa4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8aa4('0xc'));var crypto=require('crypto');var jsforce=require(_0x8aa4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8aa4('0xa'));var querystring=require(_0x8aa4('0xe'));var Papa=require(_0x8aa4('0xf'));var Redis=require('ioredis');var authService=require(_0x8aa4('0x10'));var qs=require(_0x8aa4('0x11'));var as=require(_0x8aa4('0x12'));var hardwareService=require(_0x8aa4('0x13'));var logger=require(_0x8aa4('0x14'))('api');var utils=require(_0x8aa4('0x15'));var config=require(_0x8aa4('0x16'));var licenseUtil=require(_0x8aa4('0x17'));var db=require(_0x8aa4('0x18'))['db'];config[_0x8aa4('0x19')]=_[_0x8aa4('0x1a')](config[_0x8aa4('0x19')],{'host':_0x8aa4('0x1b'),'port':0x18eb});var socket=require(_0x8aa4('0x1c'))(new Redis(config[_0x8aa4('0x19')]));require(_0x8aa4('0x1d'))[_0x8aa4('0x1e')](socket);function respondWithStatusCode(_0x160475,_0x409eac){_0x409eac=_0x409eac||0xcc;return function(_0x1b4bcc){if(_0x1b4bcc){return _0x160475[_0x8aa4('0x1f')](_0x409eac);}return _0x160475['status'](_0x409eac)['end']();};}function respondWithResult(_0xe31e44,_0x4c2a88){_0x4c2a88=_0x4c2a88||0xc8;return function(_0x364e68){if(_0x364e68){return _0xe31e44['status'](_0x4c2a88)[_0x8aa4('0x20')](_0x364e68);}};}function respondWithFilteredResult(_0x15c3e0,_0x54bf19){return function(_0x3bc510){if(_0x3bc510){var _0x349618=typeof _0x54bf19['offset']===_0x8aa4('0x21')&&typeof _0x54bf19[_0x8aa4('0x22')]===_0x8aa4('0x21');var _0x1bb5b9=_0x3bc510[_0x8aa4('0x23')];var _0x1e30c1=_0x349618?0x0:_0x54bf19[_0x8aa4('0x24')];var _0xebd640=_0x349618?_0x3bc510[_0x8aa4('0x23')]:_0x54bf19['offset']+_0x54bf19['limit'];var _0x575ff6;if(_0xebd640>=_0x1bb5b9){_0xebd640=_0x1bb5b9;_0x575ff6=0xc8;}else{_0x575ff6=0xce;}_0x15c3e0[_0x8aa4('0x25')](_0x575ff6);return _0x15c3e0[_0x8aa4('0x26')](_0x8aa4('0x27'),_0x1e30c1+'-'+_0xebd640+'/'+_0x1bb5b9)[_0x8aa4('0x20')](_0x3bc510);}return null;};}function patchUpdates(_0x4f6fcf){return function(_0x21d35b){try{jsonpatch[_0x8aa4('0x28')](_0x21d35b,_0x4f6fcf,!![]);}catch(_0x14e238){return BPromise[_0x8aa4('0x29')](_0x14e238);}return _0x21d35b[_0x8aa4('0x2a')]();};}function saveUpdates(_0x18ba76,_0x37624b){return function(_0x3f53dc){if(_0x3f53dc){return _0x3f53dc[_0x8aa4('0x2b')](_0x18ba76)[_0x8aa4('0x2c')](function(_0x3a6828){return _0x3a6828;});}return null;};}function removeEntity(_0x455209,_0x3113f3){return function(_0x1a8955){if(_0x1a8955){return _0x1a8955['destroy']()[_0x8aa4('0x2c')](function(){var _0xe7d557=_0x1a8955[_0x8aa4('0x2d')]({'plain':!![]});var _0x30b02f=_0x8aa4('0x2e');return db[_0x8aa4('0x2f')][_0x8aa4('0x30')]({'where':{'type':_0x30b02f,'resourceId':_0xe7d557['id']}})[_0x8aa4('0x2c')](function(){return _0x1a8955;});})['then'](function(){_0x455209[_0x8aa4('0x25')](0xcc)[_0x8aa4('0x31')]();});}};}function handleEntityNotFound(_0x2d0c80,_0x389935){return function(_0x608ca8){if(!_0x608ca8){_0x2d0c80[_0x8aa4('0x1f')](0x194);}return _0x608ca8;};}function handleError(_0x1c6bdb,_0x56dac9){_0x56dac9=_0x56dac9||0x1f4;return function(_0x152dc6){logger['error'](_0x152dc6[_0x8aa4('0x32')]);if(_0x152dc6[_0x8aa4('0x33')]){delete _0x152dc6['name'];}_0x1c6bdb[_0x8aa4('0x25')](_0x56dac9)[_0x8aa4('0x34')](_0x152dc6);};}exports[_0x8aa4('0x35')]=function(_0x455d1c,_0x73ac23){var _0x3bdb20={},_0xa697f2={},_0x358d7d={'count':0x0,'rows':[]};var _0x270cd2=_[_0x8aa4('0x36')](db[_0x8aa4('0x37')][_0x8aa4('0x38')],function(_0x2b8293){return{'name':_0x2b8293['fieldName'],'type':_0x2b8293['type']['key']};});_0xa697f2[_0x8aa4('0x39')]=_['map'](_0x270cd2,_0x8aa4('0x33'));_0xa697f2[_0x8aa4('0x3a')]=_[_0x8aa4('0x3b')](_0x455d1c[_0x8aa4('0x3a')]);_0xa697f2[_0x8aa4('0x3c')]=_[_0x8aa4('0x3d')](_0xa697f2['model'],_0xa697f2[_0x8aa4('0x3a')]);_0x3bdb20[_0x8aa4('0x3e')]=_[_0x8aa4('0x3d')](_0xa697f2['model'],qs[_0x8aa4('0x3f')](_0x455d1c['query'][_0x8aa4('0x3f')]));_0x3bdb20[_0x8aa4('0x3e')]=_0x3bdb20[_0x8aa4('0x3e')]['length']?_0x3bdb20['attributes']:_0xa697f2[_0x8aa4('0x39')];if(!_0x455d1c[_0x8aa4('0x3a')][_0x8aa4('0x40')]('nolimit')){_0x3bdb20[_0x8aa4('0x22')]=qs[_0x8aa4('0x22')](_0x455d1c[_0x8aa4('0x3a')][_0x8aa4('0x22')]);_0x3bdb20['offset']=qs['offset'](_0x455d1c[_0x8aa4('0x3a')][_0x8aa4('0x24')]);}_0x3bdb20[_0x8aa4('0x41')]=qs[_0x8aa4('0x42')](_0x455d1c[_0x8aa4('0x3a')][_0x8aa4('0x42')]);_0x3bdb20['where']=qs['filters'](_[_0x8aa4('0x43')](_0x455d1c[_0x8aa4('0x3a')],_0xa697f2[_0x8aa4('0x3c')]),_0x270cd2);if(_0x455d1c[_0x8aa4('0x3a')][_0x8aa4('0x44')]){_0x3bdb20[_0x8aa4('0x45')]=_[_0x8aa4('0x46')](_0x3bdb20[_0x8aa4('0x45')],{'$or':_[_0x8aa4('0x36')](_0x270cd2,function(_0x2a59f1){if(_0x2a59f1[_0x8aa4('0x47')]!==_0x8aa4('0x48')){var _0x1f6f31={};_0x1f6f31[_0x2a59f1[_0x8aa4('0x33')]]={'$like':'%'+_0x455d1c[_0x8aa4('0x3a')][_0x8aa4('0x44')]+'%'};return _0x1f6f31;}})});}_0x3bdb20=_['merge']({},_0x3bdb20,_0x455d1c[_0x8aa4('0x49')]);var _0x54a7f8={'where':_0x3bdb20[_0x8aa4('0x45')]};return db['WhatsappQueue'][_0x8aa4('0x23')](_0x54a7f8)[_0x8aa4('0x2c')](function(_0x31dcb1){_0x358d7d[_0x8aa4('0x23')]=_0x31dcb1;if(_0x455d1c[_0x8aa4('0x3a')]['includeAll']){_0x3bdb20[_0x8aa4('0x4a')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x8aa4('0x4b')](_0x3bdb20);})[_0x8aa4('0x2c')](function(_0x577eb8){_0x358d7d[_0x8aa4('0x4c')]=_0x577eb8;return _0x358d7d;})[_0x8aa4('0x2c')](respondWithFilteredResult(_0x73ac23,_0x3bdb20))[_0x8aa4('0x4d')](handleError(_0x73ac23,null));};exports['show']=function(_0x2e1714,_0x41bd0e){var _0x423cac={'raw':!![],'where':{'id':_0x2e1714['params']['id']}},_0x37c659={};_0x37c659[_0x8aa4('0x39')]=_[_0x8aa4('0x3b')](db['WhatsappQueue'][_0x8aa4('0x38')]);_0x37c659[_0x8aa4('0x3a')]=_[_0x8aa4('0x3b')](_0x2e1714[_0x8aa4('0x3a')]);_0x37c659[_0x8aa4('0x3c')]=_[_0x8aa4('0x3d')](_0x37c659[_0x8aa4('0x39')],_0x37c659[_0x8aa4('0x3a')]);_0x423cac[_0x8aa4('0x3e')]=_[_0x8aa4('0x3d')](_0x37c659[_0x8aa4('0x39')],qs['fields'](_0x2e1714['query'][_0x8aa4('0x3f')]));_0x423cac[_0x8aa4('0x3e')]=_0x423cac[_0x8aa4('0x3e')]['length']?_0x423cac[_0x8aa4('0x3e')]:_0x37c659['model'];if(_0x2e1714[_0x8aa4('0x3a')]['includeAll']){_0x423cac[_0x8aa4('0x4a')]=[{'all':!![]}];}_0x423cac=_[_0x8aa4('0x46')]({},_0x423cac,_0x2e1714[_0x8aa4('0x49')]);return db['WhatsappQueue']['find'](_0x423cac)['then'](handleEntityNotFound(_0x41bd0e,null))['then'](respondWithResult(_0x41bd0e,null))[_0x8aa4('0x4d')](handleError(_0x41bd0e,null));};exports[_0x8aa4('0x4e')]=function(_0x8f1ff0,_0x24183f){return db[_0x8aa4('0x37')][_0x8aa4('0x4e')](_0x8f1ff0[_0x8aa4('0x4f')],{})[_0x8aa4('0x2c')](function(_0x37b9c2){var _0x12a8b2=_0x8f1ff0[_0x8aa4('0x50')][_0x8aa4('0x2d')]({'plain':!![]});if(!_0x12a8b2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12a8b2['role']===_0x8aa4('0x50')){var _0xe49725=_0x37b9c2['get']({'plain':!![]});var _0x4e1632='WhatsappQueues';return db[_0x8aa4('0x51')][_0x8aa4('0x52')]({'where':{'name':_0x4e1632,'userProfileId':_0x12a8b2['userProfileId']},'raw':!![]})['then'](function(_0x2f74f4){if(_0x2f74f4&&_0x2f74f4['autoAssociation']===0x0){return db[_0x8aa4('0x2f')][_0x8aa4('0x4e')]({'name':_0xe49725['name'],'resourceId':_0xe49725['id'],'type':_0x2f74f4['name'],'sectionId':_0x2f74f4['id']},{})[_0x8aa4('0x2c')](function(){return _0x37b9c2;});}else{return _0x37b9c2;}})[_0x8aa4('0x4d')](function(_0x413913){logger[_0x8aa4('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x413913);throw _0x413913;});}return _0x37b9c2;})[_0x8aa4('0x2c')](respondWithResult(_0x24183f,0xc9))[_0x8aa4('0x4d')](handleError(_0x24183f,null));};exports[_0x8aa4('0x2b')]=function(_0x391b70,_0x24212c){if(_0x391b70[_0x8aa4('0x4f')]['id']){delete _0x391b70[_0x8aa4('0x4f')]['id'];}return db[_0x8aa4('0x37')][_0x8aa4('0x52')]({'where':{'id':_0x391b70['params']['id']}})[_0x8aa4('0x2c')](handleEntityNotFound(_0x24212c,null))[_0x8aa4('0x2c')](saveUpdates(_0x391b70[_0x8aa4('0x4f')],null))[_0x8aa4('0x2c')](respondWithResult(_0x24212c,null))[_0x8aa4('0x4d')](handleError(_0x24212c,null));};exports[_0x8aa4('0x30')]=function(_0x2d712e,_0x197dc7){return db['WhatsappQueue'][_0x8aa4('0x52')]({'where':{'id':_0x2d712e[_0x8aa4('0x54')]['id']}})['then'](handleEntityNotFound(_0x197dc7,null))['then'](removeEntity(_0x197dc7,null))[_0x8aa4('0x4d')](handleError(_0x197dc7,null));};exports[_0x8aa4('0x55')]=function(_0x558398,_0x148678){return db[_0x8aa4('0x37')][_0x8aa4('0x55')]()[_0x8aa4('0x2c')](respondWithResult(_0x148678,null))[_0x8aa4('0x4d')](handleError(_0x148678,null));};exports[_0x8aa4('0x56')]=function(_0xa11452,_0x5c783d,_0x2adfd9){var _0x496eb1={'raw':!![],'where':{}},_0x40009a={},_0x5896d8;return db[_0x8aa4('0x37')][_0x8aa4('0x57')]({'where':{'id':_0xa11452[_0x8aa4('0x54')]['id']}})[_0x8aa4('0x2c')](handleEntityNotFound(_0x5c783d,null))[_0x8aa4('0x2c')](function(_0x45ad46){if(_0x45ad46){_0x5896d8=_0x45ad46['get']({'plain':!![]});_0x40009a[_0x8aa4('0x39')]=_[_0x8aa4('0x3b')](db['UserWhatsappQueue'][_0x8aa4('0x38')]);_0x40009a[_0x8aa4('0x3a')]=_[_0x8aa4('0x3b')](_0xa11452[_0x8aa4('0x3a')]);_0x40009a[_0x8aa4('0x3c')]=_[_0x8aa4('0x3d')](_0x40009a[_0x8aa4('0x39')],_0x40009a[_0x8aa4('0x3a')]);_0x496eb1[_0x8aa4('0x3e')]=_['intersection'](_0x40009a[_0x8aa4('0x39')],qs[_0x8aa4('0x3f')](_0xa11452[_0x8aa4('0x3a')][_0x8aa4('0x3f')]));_0x496eb1['attributes']=_0x496eb1[_0x8aa4('0x3e')][_0x8aa4('0x58')]?_0x496eb1[_0x8aa4('0x3e')]:_0x40009a['model'];if(!_0xa11452['query']['hasOwnProperty'](_0x8aa4('0x59'))){_0x496eb1[_0x8aa4('0x22')]=qs['limit'](_0xa11452[_0x8aa4('0x3a')][_0x8aa4('0x22')]);_0x496eb1[_0x8aa4('0x24')]=qs[_0x8aa4('0x24')](_0xa11452[_0x8aa4('0x3a')]['offset']);}_0x496eb1['order']=qs['sort'](_0xa11452[_0x8aa4('0x3a')][_0x8aa4('0x42')]);_0x496eb1['where']=qs[_0x8aa4('0x3c')](_[_0x8aa4('0x43')](_0xa11452['query'],_0x40009a[_0x8aa4('0x3c')]));_0x496eb1[_0x8aa4('0x45')]['WhatsappQueueId']=_0x45ad46['id'];if(_0xa11452['query'][_0x8aa4('0x44')]){_0x496eb1[_0x8aa4('0x45')]=_[_0x8aa4('0x46')](_0x496eb1[_0x8aa4('0x45')],{'$or':_[_0x8aa4('0x36')](_0x496eb1['attributes'],function(_0x998e83){var _0x1f9960={};_0x1f9960[_0x998e83]={'$like':'%'+_0xa11452[_0x8aa4('0x3a')][_0x8aa4('0x44')]+'%'};return _0x1f9960;})});}_0x496eb1=_[_0x8aa4('0x46')]({},_0x496eb1,_0xa11452[_0x8aa4('0x49')]);return db[_0x8aa4('0x5a')]['findAll'](_0x496eb1);}})[_0x8aa4('0x2c')](function(_0x23f8df){if(_0x23f8df){return db[_0x8aa4('0x5b')]['findAndCountAll']({'where':{'id':_['map'](_0x23f8df,_0x8aa4('0x5c')),'role':_0x8aa4('0x5d')},'attributes':['id',_0x8aa4('0x33'),_0x8aa4('0x5e'),_0x8aa4('0x5f'),'createdAt']});}})[_0x8aa4('0x2c')](function(_0x5d1291){if(_0x5d1291){return{'count':_0x5d1291[_0x8aa4('0x23')],'rows':_['map'](_0x5d1291['rows'],function(_0x20450c){return{'membername':_0x20450c[_0x8aa4('0x33')],'UserId':_0x20450c['id'],'queue_name':_0x5896d8['name'],'WhatsappQueueId':_0x5896d8['id'],'interface':util[_0x8aa4('0x60')](_0x8aa4('0x61'),_0x8aa4('0x62'),_0x20450c[_0x8aa4('0x33')]),'penalty':0x0,'paused':_0x20450c['whatsappPause'],'createdAt':_0x20450c[_0x8aa4('0x63')],'updatedAt':_0x20450c[_0x8aa4('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5c783d,_0x496eb1))[_0x8aa4('0x4d')](handleError(_0x5c783d,null));};exports[_0x8aa4('0x64')]=function(_0x5923a2,_0xdc9485,_0x57fe95){var _0x52a03e={};var _0x49f527={};var _0x2cc8b4;var _0x104a70;return db[_0x8aa4('0x37')][_0x8aa4('0x57')]({'where':{'id':_0x5923a2['params']['id']}})[_0x8aa4('0x2c')](handleEntityNotFound(_0xdc9485,null))[_0x8aa4('0x2c')](function(_0xefacd0){if(_0xefacd0){_0x2cc8b4=_0xefacd0;_0x49f527[_0x8aa4('0x39')]=_['keys'](db['Team'][_0x8aa4('0x38')]);_0x49f527['query']=_[_0x8aa4('0x3b')](_0x5923a2[_0x8aa4('0x3a')]);_0x49f527['filters']=_['intersection'](_0x49f527[_0x8aa4('0x39')],_0x49f527[_0x8aa4('0x3a')]);_0x52a03e[_0x8aa4('0x3e')]=_[_0x8aa4('0x3d')](_0x49f527[_0x8aa4('0x39')],qs[_0x8aa4('0x3f')](_0x5923a2[_0x8aa4('0x3a')][_0x8aa4('0x3f')]));_0x52a03e[_0x8aa4('0x3e')]=_0x52a03e[_0x8aa4('0x3e')][_0x8aa4('0x58')]?_0x52a03e[_0x8aa4('0x3e')]:_0x49f527[_0x8aa4('0x39')];_0x52a03e['order']=qs[_0x8aa4('0x42')](_0x5923a2['query'][_0x8aa4('0x42')]);_0x52a03e[_0x8aa4('0x45')]=qs[_0x8aa4('0x3c')](_[_0x8aa4('0x43')](_0x5923a2[_0x8aa4('0x3a')],_0x49f527[_0x8aa4('0x3c')]));if(_0x5923a2[_0x8aa4('0x3a')][_0x8aa4('0x44')]){_0x52a03e['where']=_[_0x8aa4('0x46')](_0x52a03e[_0x8aa4('0x45')],{'$or':_['map'](_0x52a03e['attributes'],function(_0x13c53c){var _0x2fbe00={};_0x2fbe00[_0x13c53c]={'$like':'%'+_0x5923a2['query']['filter']+'%'};return _0x2fbe00;})});}_0x52a03e=_[_0x8aa4('0x46')]({},_0x52a03e,_0x5923a2[_0x8aa4('0x49')]);return _0x2cc8b4[_0x8aa4('0x64')](_0x52a03e);}})[_0x8aa4('0x2c')](function(_0x4dbeb5){if(_0x4dbeb5){_0x104a70=_0x4dbeb5[_0x8aa4('0x58')];if(!_0x5923a2[_0x8aa4('0x3a')][_0x8aa4('0x40')](_0x8aa4('0x59'))){_0x52a03e[_0x8aa4('0x22')]=qs[_0x8aa4('0x22')](_0x5923a2['query'][_0x8aa4('0x22')]);_0x52a03e[_0x8aa4('0x24')]=qs[_0x8aa4('0x24')](_0x5923a2['query']['offset']);}return _0x2cc8b4[_0x8aa4('0x64')](_0x52a03e);}})['then'](function(_0x539f68){if(_0x539f68){return _0x539f68?{'count':_0x104a70,'rows':_0x539f68}:null;}})['then'](respondWithResult(_0xdc9485,null))[_0x8aa4('0x4d')](handleError(_0xdc9485,null));};exports[_0x8aa4('0x65')]=function(_0x575271,_0x57787d,_0x123931){var _0x4e2edb=_0x575271['body'][_0x8aa4('0x66')];return db[_0x8aa4('0x67')][_0x8aa4('0x4b')]({'where':{'id':_0x4e2edb},'attributes':['id'],'include':[{'model':db[_0x8aa4('0x5b')],'as':'Agents','attributes':['id','name',_0x8aa4('0x68'),_0x8aa4('0x69'),_0x8aa4('0x6a')],'raw':!![]}]})[_0x8aa4('0x2c')](function(_0xdb9a52){if(_0xdb9a52){var _0x3555be=_['flatMap'](_0xdb9a52,function(_0x1575eb){var _0x1ebec0=_0x1575eb['get']({'plain':!![]});return _0x1ebec0[_0x8aa4('0x6b')];});return db['WhatsappQueue'][_0x8aa4('0x52')]({'where':{'id':_0x575271[_0x8aa4('0x54')]['id']}})[_0x8aa4('0x2c')](function(_0x1ae077){return db[_0x8aa4('0x6c')]['transaction'](function(_0x42d4af){return _0x1ae077[_0x8aa4('0x65')](_0x4e2edb,{'transaction':_0x42d4af})['then'](function(){return BPromise[_0x8aa4('0x6d')](_0x3555be,function(_0x51fd6a){return db[_0x8aa4('0x5a')][_0x8aa4('0x6e')]({'where':{'UserId':_0x51fd6a['id'],'WhatsappQueueId':_0x575271[_0x8aa4('0x54')]['id']},'transaction':_0x42d4af});});})[_0x8aa4('0x2c')](function(){_0x3555be[_0x8aa4('0x6f')](function(_0x4e3f2b){socket['emit']('userWhatsappQueue:save',{'UserId':_0x4e3f2b['id'],'WhatsappQueueId':_0x1ae077['id']});});});});});}})[_0x8aa4('0x2c')](respondWithStatusCode(_0x57787d,null))[_0x8aa4('0x4d')](handleError(_0x57787d,null));};exports[_0x8aa4('0x70')]=function(_0x39b9d2,_0xf3fc40,_0x4851aa){return db['Team'][_0x8aa4('0x4b')]({'where':{'id':_0x39b9d2[_0x8aa4('0x3a')][_0x8aa4('0x66')]},'attributes':['id'],'include':[{'model':db[_0x8aa4('0x5b')],'as':_0x8aa4('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x8aa4('0x2c')](handleEntityNotFound(_0xf3fc40,null))[_0x8aa4('0x2c')](function(_0x4668c2){var _0x4dac8c=_[_0x8aa4('0x36')](_0x4668c2,'id');var _0x151dff=[];var _0x4d69eb=[];var _0x2a96c9=squel[_0x8aa4('0x71')]();_0x2a96c9[_0x8aa4('0x72')](_0x8aa4('0x73'))[_0x8aa4('0x74')]('team_has_whatsapp_queues','tq')[_0x8aa4('0x75')](_0x8aa4('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8aa4('0x45')](_0x8aa4('0x77'),_0x39b9d2[_0x8aa4('0x54')]['id']);for(var _0x6510b1=0x0;_0x6510b1<_0x4668c2[_0x8aa4('0x58')];_0x6510b1+=0x1){let _0x7ea694=_0x4668c2[_0x6510b1];for(var _0x5dba19=0x0;_0x5dba19<_0x7ea694[_0x8aa4('0x6b')][_0x8aa4('0x58')];_0x5dba19+=0x1){let _0xbe20bf=_0x7ea694[_0x8aa4('0x6b')][_0x5dba19];var _0x5c65f9=_0x2a96c9[_0x8aa4('0x78')]();_0x5c65f9[_0x8aa4('0x45')](_0x8aa4('0x79'),_0xbe20bf['id']);_0x4d69eb[_0x8aa4('0x7a')](db[_0x8aa4('0x6c')][_0x8aa4('0x3a')](_0x5c65f9['toString'](),{'type':db[_0x8aa4('0x6c')][_0x8aa4('0x7b')][_0x8aa4('0x7c')]})[_0x8aa4('0x2c')](function(_0x553730){if(_0x553730[_0x8aa4('0x58')]===0x1){return _0xbe20bf['id'];}else{var _0x4c09bc=_['every'](_['map'](_0x553730,'TeamId'),function(_0x852e24){return _[_0x8aa4('0x7d')](_0x4dac8c,_0x852e24);});if(_0x4c09bc){return _0xbe20bf['id'];}}}));}}return BPromise[_0x8aa4('0x7e')](_0x4d69eb)['then'](function(_0x5eb65b){_0x151dff=_(_0x151dff)['union'](_0x5eb65b)[_0x8aa4('0x7f')]()['value']();return db[_0x8aa4('0x37')]['find']({'where':{'id':_0x39b9d2[_0x8aa4('0x54')]['id']}})[_0x8aa4('0x2c')](function(_0x20a4c1){return db[_0x8aa4('0x6c')][_0x8aa4('0x80')](function(_0x32389a){return _0x20a4c1[_0x8aa4('0x70')](_0x39b9d2[_0x8aa4('0x3a')][_0x8aa4('0x66')],{'transaction':_0x32389a})[_0x8aa4('0x2c')](function(){if(!_['isEmpty'](_0x151dff)){return _0x20a4c1[_0x8aa4('0x81')](_0x151dff,{'transaction':_0x32389a});}})[_0x8aa4('0x2c')](function(){_0x151dff[_0x8aa4('0x6f')](function(_0x1f8bb4){socket['emit'](_0x8aa4('0x82'),{'UserId':_0x1f8bb4,'WhatsappQueueId':_0x20a4c1['id']});});});});});});})[_0x8aa4('0x2c')](respondWithStatusCode(_0xf3fc40,null))[_0x8aa4('0x4d')](handleError(_0xf3fc40,null));};exports[_0x8aa4('0x83')]=function(_0x4122c4,_0x24e607,_0x52dfed){return db[_0x8aa4('0x37')][_0x8aa4('0x52')]({'where':{'id':_0x4122c4[_0x8aa4('0x54')]['id']}})[_0x8aa4('0x2c')](handleEntityNotFound(_0x24e607,null))['then'](function(_0x2543c5){if(_0x2543c5){return _0x2543c5[_0x8aa4('0x83')](_0x4122c4[_0x8aa4('0x4f')][_0x8aa4('0x66')],_[_0x8aa4('0x84')](_0x4122c4[_0x8aa4('0x4f')],['ids','id'])||{})[_0x8aa4('0x85')](function(_0x478087){for(var _0x131cf8=0x0;_0x131cf8<_0x4122c4[_0x8aa4('0x4f')][_0x8aa4('0x66')][_0x8aa4('0x58')];_0x131cf8+=0x1){socket[_0x8aa4('0x86')](_0x8aa4('0x87'),{'UserId':Number(_0x4122c4[_0x8aa4('0x4f')][_0x8aa4('0x66')][_0x131cf8]),'WhatsappQueueId':Number(_0x4122c4[_0x8aa4('0x54')]['id'])});}return _0x478087;});}})['then'](respondWithResult(_0x24e607,null))[_0x8aa4('0x4d')](handleError(_0x24e607,null));};exports[_0x8aa4('0x81')]=function(_0xca5d34,_0x320bd5,_0x5882c5){return db[_0x8aa4('0x37')]['find']({'where':{'id':_0xca5d34['params']['id']}})[_0x8aa4('0x2c')](handleEntityNotFound(_0x320bd5,null))[_0x8aa4('0x2c')](function(_0x1cefa2){if(_0x1cefa2){return _0x1cefa2[_0x8aa4('0x81')](_0xca5d34[_0x8aa4('0x3a')][_0x8aa4('0x66')])[_0x8aa4('0x2c')](function(){if(_['isArray'](_0xca5d34['query'][_0x8aa4('0x66')])){for(var _0x3c8af7=0x0;_0x3c8af7<_0xca5d34['query'][_0x8aa4('0x66')][_0x8aa4('0x58')];_0x3c8af7+=0x1){socket[_0x8aa4('0x86')]('userWhatsappQueue:remove',{'UserId':Number(_0xca5d34[_0x8aa4('0x3a')]['ids'][_0x3c8af7]),'WhatsappQueueId':Number(_0xca5d34['params']['id'])});}}else{socket['emit'](_0x8aa4('0x82'),{'UserId':Number(_0xca5d34['query'][_0x8aa4('0x66')]),'WhatsappQueueId':Number(_0xca5d34['params']['id'])});}});}})[_0x8aa4('0x2c')](respondWithStatusCode(_0x320bd5,null))[_0x8aa4('0x4d')](handleError(_0x320bd5,null));};exports['getAgents']=function(_0x31d44a,_0x4f3efa,_0x478617){var _0x333da4={};var _0x251a60={};var _0x2306c8;var _0x4071ed;return db['WhatsappQueue'][_0x8aa4('0x57')]({'where':{'id':_0x31d44a['params']['id']}})[_0x8aa4('0x2c')](handleEntityNotFound(_0x4f3efa,null))[_0x8aa4('0x2c')](function(_0x42fbe9){if(_0x42fbe9){_0x2306c8=_0x42fbe9;_0x251a60[_0x8aa4('0x39')]=_[_0x8aa4('0x3b')](db[_0x8aa4('0x5b')][_0x8aa4('0x38')]);_0x251a60['query']=_['keys'](_0x31d44a[_0x8aa4('0x3a')]);_0x251a60[_0x8aa4('0x3c')]=_[_0x8aa4('0x3d')](_0x251a60[_0x8aa4('0x39')],_0x251a60[_0x8aa4('0x3a')]);_0x333da4['attributes']=_[_0x8aa4('0x3d')](_0x251a60['model'],qs[_0x8aa4('0x3f')](_0x31d44a[_0x8aa4('0x3a')][_0x8aa4('0x3f')]));_0x333da4[_0x8aa4('0x3e')]=_0x333da4[_0x8aa4('0x3e')][_0x8aa4('0x58')]?_0x333da4[_0x8aa4('0x3e')]:_0x251a60[_0x8aa4('0x39')];_0x333da4[_0x8aa4('0x41')]=qs[_0x8aa4('0x42')](_0x31d44a['query'][_0x8aa4('0x42')]);_0x333da4[_0x8aa4('0x45')]=qs['filters'](_[_0x8aa4('0x43')](_0x31d44a['query'],_0x251a60[_0x8aa4('0x3c')]));if(_0x31d44a[_0x8aa4('0x3a')][_0x8aa4('0x44')]){_0x333da4[_0x8aa4('0x45')]=_['merge'](_0x333da4[_0x8aa4('0x45')],{'$or':_[_0x8aa4('0x36')](_0x333da4['attributes'],function(_0x2103a7){var _0x55f23d={};_0x55f23d[_0x2103a7]={'$like':'%'+_0x31d44a[_0x8aa4('0x3a')][_0x8aa4('0x44')]+'%'};return _0x55f23d;})});}_0x333da4=_[_0x8aa4('0x46')]({},_0x333da4,_0x31d44a['options']);return _0x2306c8['getAgents'](_0x333da4);}})[_0x8aa4('0x2c')](function(_0x429316){if(_0x429316){_0x4071ed=_0x429316[_0x8aa4('0x58')];if(!_0x31d44a[_0x8aa4('0x3a')][_0x8aa4('0x40')](_0x8aa4('0x59'))){_0x333da4[_0x8aa4('0x22')]=qs['limit'](_0x31d44a[_0x8aa4('0x3a')]['limit']);_0x333da4[_0x8aa4('0x24')]=qs[_0x8aa4('0x24')](_0x31d44a[_0x8aa4('0x3a')][_0x8aa4('0x24')]);}return _0x2306c8['getAgents'](_0x333da4);}})[_0x8aa4('0x2c')](function(_0xf3b6eb){if(_0xf3b6eb){return _0xf3b6eb?{'count':_0x4071ed,'rows':_0xf3b6eb}:null;}})[_0x8aa4('0x2c')](respondWithResult(_0x4f3efa,null))[_0x8aa4('0x4d')](handleError(_0x4f3efa,null));}; \ No newline at end of file +var _0x4584=['filter','merge','options','includeAll','include','rows','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','catch','update','params','describe','getMembers','UserWhatsappQueue','WhatsappQueueId','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','SIP','getTeams','findOne','body','Team','Agents','online','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','ids','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','register','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','WhatsappQueues','UserProfileResource','sendStatus','error','stack','name','WhatsappQueue','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4584,0x16c));var _0x4458=function(_0x20e7e3,_0x1529be){_0x20e7e3=_0x20e7e3-0x0;var _0x14b9de=_0x4584[_0x20e7e3];return _0x14b9de;};'use strict';var emlformat=require(_0x4458('0x0'));var rimraf=require(_0x4458('0x1'));var zipdir=require(_0x4458('0x2'));var jsonpatch=require(_0x4458('0x3'));var rp=require(_0x4458('0x4'));var moment=require(_0x4458('0x5'));var BPromise=require(_0x4458('0x6'));var Mustache=require(_0x4458('0x7'));var util=require('util');var path=require(_0x4458('0x8'));var sox=require('sox');var csv=require(_0x4458('0x9'));var ejs=require(_0x4458('0xa'));var fs=require('fs');var fs_extra=require(_0x4458('0xb'));var _=require('lodash');var squel=require(_0x4458('0xc'));var crypto=require(_0x4458('0xd'));var jsforce=require(_0x4458('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4458('0x9'));var querystring=require('querystring');var Papa=require(_0x4458('0xf'));var Redis=require(_0x4458('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4458('0x11'));var as=require(_0x4458('0x12'));var hardwareService=require(_0x4458('0x13'));var logger=require(_0x4458('0x14'))(_0x4458('0x15'));var utils=require('../../config/utils');var config=require(_0x4458('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4458('0x17'))['db'];config[_0x4458('0x18')]=_['defaults'](config['redis'],{'host':_0x4458('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x4458('0x1a')](socket);function respondWithStatusCode(_0xcdac37,_0x1f867b){_0x1f867b=_0x1f867b||0xcc;return function(_0x373604){if(_0x373604){return _0xcdac37['sendStatus'](_0x1f867b);}return _0xcdac37[_0x4458('0x1b')](_0x1f867b)[_0x4458('0x1c')]();};}function respondWithResult(_0x2cc800,_0xdfc196){_0xdfc196=_0xdfc196||0xc8;return function(_0x25f6c9){if(_0x25f6c9){return _0x2cc800[_0x4458('0x1b')](_0xdfc196)['json'](_0x25f6c9);}};}function respondWithFilteredResult(_0x2142ba,_0x543707){return function(_0x2f21c5){if(_0x2f21c5){var _0x4bf10b=typeof _0x543707[_0x4458('0x1d')]===_0x4458('0x1e')&&typeof _0x543707[_0x4458('0x1f')]===_0x4458('0x1e');var _0x489aab=_0x2f21c5[_0x4458('0x20')];var _0x39df81=_0x4bf10b?0x0:_0x543707[_0x4458('0x1d')];var _0x2b65b6=_0x4bf10b?_0x2f21c5[_0x4458('0x20')]:_0x543707[_0x4458('0x1d')]+_0x543707[_0x4458('0x1f')];var _0x48e64d;if(_0x2b65b6>=_0x489aab){_0x2b65b6=_0x489aab;_0x48e64d=0xc8;}else{_0x48e64d=0xce;}_0x2142ba['status'](_0x48e64d);return _0x2142ba[_0x4458('0x21')](_0x4458('0x22'),_0x39df81+'-'+_0x2b65b6+'/'+_0x489aab)[_0x4458('0x23')](_0x2f21c5);}return null;};}function patchUpdates(_0x13e7e3){return function(_0x11c058){try{jsonpatch[_0x4458('0x24')](_0x11c058,_0x13e7e3,!![]);}catch(_0x4c5a29){return BPromise[_0x4458('0x25')](_0x4c5a29);}return _0x11c058[_0x4458('0x26')]();};}function saveUpdates(_0x28e6ca,_0x1c73db){return function(_0x2aaea8){if(_0x2aaea8){return _0x2aaea8['update'](_0x28e6ca)[_0x4458('0x27')](function(_0x3bf3f0){return _0x3bf3f0;});}return null;};}function removeEntity(_0x2496fe,_0x452218){return function(_0x1caa52){if(_0x1caa52){return _0x1caa52[_0x4458('0x28')]()[_0x4458('0x27')](function(){var _0xeebe4d=_0x1caa52[_0x4458('0x29')]({'plain':!![]});var _0x2c3773=_0x4458('0x2a');return db[_0x4458('0x2b')][_0x4458('0x28')]({'where':{'type':_0x2c3773,'resourceId':_0xeebe4d['id']}})[_0x4458('0x27')](function(){return _0x1caa52;});})['then'](function(){_0x2496fe[_0x4458('0x1b')](0xcc)[_0x4458('0x1c')]();});}};}function handleEntityNotFound(_0x2fc4c9,_0x506ee8){return function(_0x364d6c){if(!_0x364d6c){_0x2fc4c9[_0x4458('0x2c')](0x194);}return _0x364d6c;};}function handleError(_0x29cec9,_0x5dc9c9){_0x5dc9c9=_0x5dc9c9||0x1f4;return function(_0xd6e6d6){logger[_0x4458('0x2d')](_0xd6e6d6[_0x4458('0x2e')]);if(_0xd6e6d6['name']){delete _0xd6e6d6[_0x4458('0x2f')];}_0x29cec9[_0x4458('0x1b')](_0x5dc9c9)['send'](_0xd6e6d6);};}exports['index']=function(_0x436d78,_0x6d8183){var _0x39e5e7={},_0x27aa2e={},_0x1a18fd={'count':0x0,'rows':[]};var _0x44ac29=_['map'](db[_0x4458('0x30')][_0x4458('0x31')],function(_0x1c2129){return{'name':_0x1c2129[_0x4458('0x32')],'type':_0x1c2129[_0x4458('0x33')][_0x4458('0x34')]};});_0x27aa2e[_0x4458('0x35')]=_[_0x4458('0x36')](_0x44ac29,'name');_0x27aa2e[_0x4458('0x37')]=_[_0x4458('0x38')](_0x436d78[_0x4458('0x37')]);_0x27aa2e[_0x4458('0x39')]=_[_0x4458('0x3a')](_0x27aa2e[_0x4458('0x35')],_0x27aa2e[_0x4458('0x37')]);_0x39e5e7[_0x4458('0x3b')]=_['intersection'](_0x27aa2e['model'],qs[_0x4458('0x3c')](_0x436d78[_0x4458('0x37')]['fields']));_0x39e5e7[_0x4458('0x3b')]=_0x39e5e7[_0x4458('0x3b')][_0x4458('0x3d')]?_0x39e5e7[_0x4458('0x3b')]:_0x27aa2e[_0x4458('0x35')];if(!_0x436d78['query'][_0x4458('0x3e')](_0x4458('0x3f'))){_0x39e5e7[_0x4458('0x1f')]=qs[_0x4458('0x1f')](_0x436d78[_0x4458('0x37')][_0x4458('0x1f')]);_0x39e5e7['offset']=qs['offset'](_0x436d78['query'][_0x4458('0x1d')]);}_0x39e5e7[_0x4458('0x40')]=qs[_0x4458('0x41')](_0x436d78[_0x4458('0x37')][_0x4458('0x41')]);_0x39e5e7[_0x4458('0x42')]=qs[_0x4458('0x39')](_[_0x4458('0x43')](_0x436d78[_0x4458('0x37')],_0x27aa2e['filters']),_0x44ac29);if(_0x436d78['query'][_0x4458('0x44')]){_0x39e5e7['where']=_[_0x4458('0x45')](_0x39e5e7[_0x4458('0x42')],{'$or':_[_0x4458('0x36')](_0x44ac29,function(_0x38f5a1){if(_0x38f5a1['type']!=='VIRTUAL'){var _0x3caf59={};_0x3caf59[_0x38f5a1[_0x4458('0x2f')]]={'$like':'%'+_0x436d78[_0x4458('0x37')][_0x4458('0x44')]+'%'};return _0x3caf59;}})});}_0x39e5e7=_[_0x4458('0x45')]({},_0x39e5e7,_0x436d78[_0x4458('0x46')]);var _0xf42544={'where':_0x39e5e7[_0x4458('0x42')]};return db['WhatsappQueue'][_0x4458('0x20')](_0xf42544)['then'](function(_0x179845){_0x1a18fd[_0x4458('0x20')]=_0x179845;if(_0x436d78['query'][_0x4458('0x47')]){_0x39e5e7[_0x4458('0x48')]=[{'all':!![]}];}return db[_0x4458('0x30')]['findAll'](_0x39e5e7);})[_0x4458('0x27')](function(_0x2c3326){_0x1a18fd[_0x4458('0x49')]=_0x2c3326;return _0x1a18fd;})['then'](respondWithFilteredResult(_0x6d8183,_0x39e5e7))['catch'](handleError(_0x6d8183,null));};exports['show']=function(_0x582205,_0x1be3a0){var _0x40ef40={'raw':!![],'where':{'id':_0x582205['params']['id']}},_0x33bc75={};_0x33bc75[_0x4458('0x35')]=_[_0x4458('0x38')](db[_0x4458('0x30')]['rawAttributes']);_0x33bc75['query']=_[_0x4458('0x38')](_0x582205[_0x4458('0x37')]);_0x33bc75[_0x4458('0x39')]=_['intersection'](_0x33bc75[_0x4458('0x35')],_0x33bc75[_0x4458('0x37')]);_0x40ef40[_0x4458('0x3b')]=_[_0x4458('0x3a')](_0x33bc75[_0x4458('0x35')],qs['fields'](_0x582205[_0x4458('0x37')][_0x4458('0x3c')]));_0x40ef40['attributes']=_0x40ef40[_0x4458('0x3b')][_0x4458('0x3d')]?_0x40ef40[_0x4458('0x3b')]:_0x33bc75[_0x4458('0x35')];if(_0x582205['query']['includeAll']){_0x40ef40[_0x4458('0x48')]=[{'all':!![]}];}_0x40ef40=_[_0x4458('0x45')]({},_0x40ef40,_0x582205[_0x4458('0x46')]);return db[_0x4458('0x30')][_0x4458('0x4a')](_0x40ef40)[_0x4458('0x27')](handleEntityNotFound(_0x1be3a0,null))[_0x4458('0x27')](respondWithResult(_0x1be3a0,null))['catch'](handleError(_0x1be3a0,null));};exports[_0x4458('0x4b')]=function(_0x734d4e,_0x40568b){return db[_0x4458('0x30')][_0x4458('0x4b')](_0x734d4e['body'],{})[_0x4458('0x27')](function(_0x582d50){var _0x2236fa=_0x734d4e[_0x4458('0x4c')][_0x4458('0x29')]({'plain':!![]});if(!_0x2236fa)throw new Error(_0x4458('0x4d'));if(_0x2236fa['role']===_0x4458('0x4c')){var _0x1f8552=_0x582d50['get']({'plain':!![]});var _0x4c2711=_0x4458('0x2a');return db[_0x4458('0x4e')][_0x4458('0x4a')]({'where':{'name':_0x4c2711,'userProfileId':_0x2236fa[_0x4458('0x4f')]},'raw':!![]})[_0x4458('0x27')](function(_0x50754e){if(_0x50754e&&_0x50754e[_0x4458('0x50')]===0x0){return db[_0x4458('0x2b')][_0x4458('0x4b')]({'name':_0x1f8552['name'],'resourceId':_0x1f8552['id'],'type':_0x50754e[_0x4458('0x2f')],'sectionId':_0x50754e['id']},{})['then'](function(){return _0x582d50;});}else{return _0x582d50;}})[_0x4458('0x51')](function(_0x720cac){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x720cac);throw _0x720cac;});}return _0x582d50;})[_0x4458('0x27')](respondWithResult(_0x40568b,0xc9))['catch'](handleError(_0x40568b,null));};exports[_0x4458('0x52')]=function(_0x321021,_0x5c3717){if(_0x321021['body']['id']){delete _0x321021['body']['id'];}return db[_0x4458('0x30')][_0x4458('0x4a')]({'where':{'id':_0x321021[_0x4458('0x53')]['id']}})[_0x4458('0x27')](handleEntityNotFound(_0x5c3717,null))[_0x4458('0x27')](saveUpdates(_0x321021['body'],null))[_0x4458('0x27')](respondWithResult(_0x5c3717,null))[_0x4458('0x51')](handleError(_0x5c3717,null));};exports[_0x4458('0x28')]=function(_0xbb85d7,_0x575651){return db[_0x4458('0x30')][_0x4458('0x4a')]({'where':{'id':_0xbb85d7['params']['id']}})[_0x4458('0x27')](handleEntityNotFound(_0x575651,null))['then'](removeEntity(_0x575651,null))[_0x4458('0x51')](handleError(_0x575651,null));};exports[_0x4458('0x54')]=function(_0x4645b3,_0x191df3){return db[_0x4458('0x30')][_0x4458('0x54')]()['then'](respondWithResult(_0x191df3,null))['catch'](handleError(_0x191df3,null));};exports[_0x4458('0x55')]=function(_0x1e73e7,_0x565a11,_0x4771d0){var _0x231113={'raw':!![],'where':{}},_0x474e52={},_0x2e1dfd;return db[_0x4458('0x30')]['findOne']({'where':{'id':_0x1e73e7['params']['id']}})[_0x4458('0x27')](handleEntityNotFound(_0x565a11,null))[_0x4458('0x27')](function(_0x31870e){if(_0x31870e){_0x2e1dfd=_0x31870e[_0x4458('0x29')]({'plain':!![]});_0x474e52[_0x4458('0x35')]=_[_0x4458('0x38')](db[_0x4458('0x56')]['rawAttributes']);_0x474e52[_0x4458('0x37')]=_[_0x4458('0x38')](_0x1e73e7[_0x4458('0x37')]);_0x474e52['filters']=_[_0x4458('0x3a')](_0x474e52[_0x4458('0x35')],_0x474e52[_0x4458('0x37')]);_0x231113[_0x4458('0x3b')]=_[_0x4458('0x3a')](_0x474e52[_0x4458('0x35')],qs[_0x4458('0x3c')](_0x1e73e7['query'][_0x4458('0x3c')]));_0x231113[_0x4458('0x3b')]=_0x231113[_0x4458('0x3b')]['length']?_0x231113[_0x4458('0x3b')]:_0x474e52[_0x4458('0x35')];if(!_0x1e73e7[_0x4458('0x37')]['hasOwnProperty']('nolimit')){_0x231113[_0x4458('0x1f')]=qs[_0x4458('0x1f')](_0x1e73e7[_0x4458('0x37')][_0x4458('0x1f')]);_0x231113[_0x4458('0x1d')]=qs[_0x4458('0x1d')](_0x1e73e7[_0x4458('0x37')][_0x4458('0x1d')]);}_0x231113['order']=qs[_0x4458('0x41')](_0x1e73e7['query'][_0x4458('0x41')]);_0x231113[_0x4458('0x42')]=qs[_0x4458('0x39')](_['pick'](_0x1e73e7[_0x4458('0x37')],_0x474e52[_0x4458('0x39')]));_0x231113[_0x4458('0x42')][_0x4458('0x57')]=_0x31870e['id'];if(_0x1e73e7['query'][_0x4458('0x44')]){_0x231113[_0x4458('0x42')]=_[_0x4458('0x45')](_0x231113[_0x4458('0x42')],{'$or':_[_0x4458('0x36')](_0x231113[_0x4458('0x3b')],function(_0x4354e7){var _0x1ecb1b={};_0x1ecb1b[_0x4354e7]={'$like':'%'+_0x1e73e7[_0x4458('0x37')]['filter']+'%'};return _0x1ecb1b;})});}_0x231113=_[_0x4458('0x45')]({},_0x231113,_0x1e73e7[_0x4458('0x46')]);return db[_0x4458('0x56')][_0x4458('0x58')](_0x231113);}})[_0x4458('0x27')](function(_0x55163){if(_0x55163){return db[_0x4458('0x59')][_0x4458('0x5a')]({'where':{'id':_[_0x4458('0x36')](_0x55163,_0x4458('0x5b')),'role':_0x4458('0x5c')},'attributes':['id',_0x4458('0x2f'),_0x4458('0x5d'),_0x4458('0x5e'),_0x4458('0x5f')]});}})['then'](function(_0x45618a){if(_0x45618a){return{'count':_0x45618a[_0x4458('0x20')],'rows':_[_0x4458('0x36')](_0x45618a[_0x4458('0x49')],function(_0x10b512){return{'membername':_0x10b512[_0x4458('0x2f')],'UserId':_0x10b512['id'],'queue_name':_0x2e1dfd[_0x4458('0x2f')],'WhatsappQueueId':_0x2e1dfd['id'],'interface':util[_0x4458('0x60')]('%s/%s',_0x4458('0x61'),_0x10b512[_0x4458('0x2f')]),'penalty':0x0,'paused':_0x10b512[_0x4458('0x5d')],'createdAt':_0x10b512['createdAt'],'updatedAt':_0x10b512['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x4458('0x27')](respondWithFilteredResult(_0x565a11,_0x231113))[_0x4458('0x51')](handleError(_0x565a11,null));};exports[_0x4458('0x62')]=function(_0x51b54d,_0x11f422,_0x2aea5a){var _0x36382b={};var _0x2435d8={};var _0x48629b;var _0x3ee7a2;return db['WhatsappQueue'][_0x4458('0x63')]({'where':{'id':_0x51b54d[_0x4458('0x53')]['id']}})[_0x4458('0x27')](handleEntityNotFound(_0x11f422,null))[_0x4458('0x27')](function(_0x56bfc2){if(_0x56bfc2){_0x48629b=_0x56bfc2;_0x2435d8[_0x4458('0x35')]=_['keys'](db['Team'][_0x4458('0x31')]);_0x2435d8[_0x4458('0x37')]=_[_0x4458('0x38')](_0x51b54d[_0x4458('0x37')]);_0x2435d8['filters']=_[_0x4458('0x3a')](_0x2435d8['model'],_0x2435d8[_0x4458('0x37')]);_0x36382b[_0x4458('0x3b')]=_[_0x4458('0x3a')](_0x2435d8[_0x4458('0x35')],qs[_0x4458('0x3c')](_0x51b54d['query'][_0x4458('0x3c')]));_0x36382b[_0x4458('0x3b')]=_0x36382b[_0x4458('0x3b')]['length']?_0x36382b[_0x4458('0x3b')]:_0x2435d8[_0x4458('0x35')];_0x36382b[_0x4458('0x40')]=qs[_0x4458('0x41')](_0x51b54d[_0x4458('0x37')][_0x4458('0x41')]);_0x36382b['where']=qs[_0x4458('0x39')](_['pick'](_0x51b54d[_0x4458('0x37')],_0x2435d8['filters']));if(_0x51b54d[_0x4458('0x37')][_0x4458('0x44')]){_0x36382b[_0x4458('0x42')]=_['merge'](_0x36382b['where'],{'$or':_['map'](_0x36382b[_0x4458('0x3b')],function(_0xe146d){var _0x35f236={};_0x35f236[_0xe146d]={'$like':'%'+_0x51b54d[_0x4458('0x37')][_0x4458('0x44')]+'%'};return _0x35f236;})});}_0x36382b=_['merge']({},_0x36382b,_0x51b54d['options']);return _0x48629b[_0x4458('0x62')](_0x36382b);}})[_0x4458('0x27')](function(_0x324b08){if(_0x324b08){_0x3ee7a2=_0x324b08[_0x4458('0x3d')];if(!_0x51b54d[_0x4458('0x37')][_0x4458('0x3e')](_0x4458('0x3f'))){_0x36382b[_0x4458('0x1f')]=qs['limit'](_0x51b54d['query'][_0x4458('0x1f')]);_0x36382b[_0x4458('0x1d')]=qs[_0x4458('0x1d')](_0x51b54d[_0x4458('0x37')][_0x4458('0x1d')]);}return _0x48629b[_0x4458('0x62')](_0x36382b);}})['then'](function(_0x4efb56){if(_0x4efb56){return _0x4efb56?{'count':_0x3ee7a2,'rows':_0x4efb56}:null;}})[_0x4458('0x27')](respondWithResult(_0x11f422,null))[_0x4458('0x51')](handleError(_0x11f422,null));};exports['addTeams']=function(_0x462789,_0x3a45fe,_0x2422e7){var _0x41ef8=_0x462789[_0x4458('0x64')]['ids'];return db[_0x4458('0x65')][_0x4458('0x58')]({'where':{'id':_0x41ef8},'attributes':['id'],'include':[{'model':db[_0x4458('0x59')],'as':_0x4458('0x66'),'attributes':['id','name',_0x4458('0x67'),'voicePause',_0x4458('0x68')],'raw':!![]}]})[_0x4458('0x27')](function(_0x239cd9){if(_0x239cd9){var _0x4b5371=_[_0x4458('0x69')](_0x239cd9,function(_0x2e112c){var _0x4e17b9=_0x2e112c[_0x4458('0x29')]({'plain':!![]});return _0x4e17b9['Agents'];});return db[_0x4458('0x30')][_0x4458('0x4a')]({'where':{'id':_0x462789['params']['id']}})[_0x4458('0x27')](function(_0xd5c525){return db[_0x4458('0x6a')][_0x4458('0x6b')](function(_0x4fd31a){return _0xd5c525[_0x4458('0x6c')](_0x41ef8,{'transaction':_0x4fd31a})[_0x4458('0x27')](function(){return BPromise[_0x4458('0x6d')](_0x4b5371,function(_0x5bcbd5){return db[_0x4458('0x56')][_0x4458('0x6e')]({'where':{'UserId':_0x5bcbd5['id'],'WhatsappQueueId':_0x462789['params']['id']},'transaction':_0x4fd31a});});})[_0x4458('0x27')](function(){_0x4b5371[_0x4458('0x6f')](function(_0x44436a){socket[_0x4458('0x70')]('userWhatsappQueue:save',{'UserId':_0x44436a['id'],'WhatsappQueueId':_0xd5c525['id']});});});});});}})[_0x4458('0x27')](respondWithStatusCode(_0x3a45fe,null))[_0x4458('0x51')](handleError(_0x3a45fe,null));};exports[_0x4458('0x71')]=function(_0x4d47fe,_0x4f141c,_0x5117fe){return db[_0x4458('0x65')][_0x4458('0x58')]({'where':{'id':_0x4d47fe['query'][_0x4458('0x72')]},'attributes':['id'],'include':[{'model':db[_0x4458('0x59')],'as':_0x4458('0x66'),'attributes':['id'],'raw':!![]}]})[_0x4458('0x27')](handleEntityNotFound(_0x4f141c,null))[_0x4458('0x27')](function(_0x5d8211){var _0x4cf7e6=_[_0x4458('0x36')](_0x5d8211,'id');var _0x503327=[];var _0x35517a=[];var _0x4e9aa8=squel[_0x4458('0x73')]();_0x4e9aa8[_0x4458('0x74')](_0x4458('0x75'))[_0x4458('0x76')](_0x4458('0x77'),'tq')[_0x4458('0x78')](_0x4458('0x79'),'ut',_0x4458('0x7a'))[_0x4458('0x42')](_0x4458('0x7b'),_0x4d47fe[_0x4458('0x53')]['id']);for(var _0x45aa7f=0x0;_0x45aa7f<_0x5d8211[_0x4458('0x3d')];_0x45aa7f+=0x1){let _0x40e1d6=_0x5d8211[_0x45aa7f];for(var _0x17f3ab=0x0;_0x17f3ab<_0x40e1d6[_0x4458('0x66')][_0x4458('0x3d')];_0x17f3ab+=0x1){let _0x3e32e5=_0x40e1d6[_0x4458('0x66')][_0x17f3ab];var _0x56de9f=_0x4e9aa8[_0x4458('0x7c')]();_0x56de9f[_0x4458('0x42')]('ut.UserId\x20=\x20?',_0x3e32e5['id']);_0x35517a[_0x4458('0x7d')](db[_0x4458('0x6a')][_0x4458('0x37')](_0x56de9f[_0x4458('0x7e')](),{'type':db['sequelize'][_0x4458('0x7f')][_0x4458('0x80')]})[_0x4458('0x27')](function(_0x3a37fa){if(_0x3a37fa['length']===0x1){return _0x3e32e5['id'];}else{var _0x1ead25=_[_0x4458('0x81')](_['map'](_0x3a37fa,_0x4458('0x82')),function(_0x3d9c09){return _['includes'](_0x4cf7e6,_0x3d9c09);});if(_0x1ead25){return _0x3e32e5['id'];}}}));}}return BPromise[_0x4458('0x83')](_0x35517a)['then'](function(_0x526f6d){_0x503327=_(_0x503327)[_0x4458('0x84')](_0x526f6d)[_0x4458('0x85')]()[_0x4458('0x86')]();return db[_0x4458('0x30')][_0x4458('0x4a')]({'where':{'id':_0x4d47fe[_0x4458('0x53')]['id']}})[_0x4458('0x27')](function(_0x2c9106){return db['sequelize'][_0x4458('0x6b')](function(_0x102d29){return _0x2c9106['removeTeams'](_0x4d47fe[_0x4458('0x37')][_0x4458('0x72')],{'transaction':_0x102d29})[_0x4458('0x27')](function(){if(!_[_0x4458('0x87')](_0x503327)){return _0x2c9106[_0x4458('0x88')](_0x503327,{'transaction':_0x102d29});}})[_0x4458('0x27')](function(){_0x503327[_0x4458('0x6f')](function(_0x30d1d7){socket['emit'](_0x4458('0x89'),{'UserId':_0x30d1d7,'WhatsappQueueId':_0x2c9106['id']});});});});});});})['then'](respondWithStatusCode(_0x4f141c,null))[_0x4458('0x51')](handleError(_0x4f141c,null));};exports[_0x4458('0x8a')]=function(_0x77c81b,_0x18723d,_0x938792){return db[_0x4458('0x30')][_0x4458('0x4a')]({'where':{'id':_0x77c81b[_0x4458('0x53')]['id']}})[_0x4458('0x27')](handleEntityNotFound(_0x18723d,null))[_0x4458('0x27')](function(_0x816f6e){if(_0x816f6e){return _0x816f6e['addAgents'](_0x77c81b[_0x4458('0x64')][_0x4458('0x72')],_[_0x4458('0x8b')](_0x77c81b[_0x4458('0x64')],['ids','id'])||{})[_0x4458('0x8c')](function(_0x56a97e){for(var _0x1a055c=0x0;_0x1a055c<_0x77c81b[_0x4458('0x64')]['ids'][_0x4458('0x3d')];_0x1a055c+=0x1){socket[_0x4458('0x70')](_0x4458('0x8d'),{'UserId':Number(_0x77c81b[_0x4458('0x64')][_0x4458('0x72')][_0x1a055c]),'WhatsappQueueId':Number(_0x77c81b[_0x4458('0x53')]['id'])});}return _0x56a97e;});}})[_0x4458('0x27')](respondWithResult(_0x18723d,null))[_0x4458('0x51')](handleError(_0x18723d,null));};exports[_0x4458('0x88')]=function(_0x5a1f36,_0x788a35,_0xe1bf8b){return db[_0x4458('0x30')]['find']({'where':{'id':_0x5a1f36[_0x4458('0x53')]['id']}})[_0x4458('0x27')](handleEntityNotFound(_0x788a35,null))[_0x4458('0x27')](function(_0x5c57fd){if(_0x5c57fd){return _0x5c57fd['removeAgents'](_0x5a1f36[_0x4458('0x37')]['ids'])[_0x4458('0x27')](function(){if(_[_0x4458('0x8e')](_0x5a1f36[_0x4458('0x37')]['ids'])){for(var _0x223c0f=0x0;_0x223c0f<_0x5a1f36['query']['ids']['length'];_0x223c0f+=0x1){socket[_0x4458('0x70')]('userWhatsappQueue:remove',{'UserId':Number(_0x5a1f36[_0x4458('0x37')][_0x4458('0x72')][_0x223c0f]),'WhatsappQueueId':Number(_0x5a1f36[_0x4458('0x53')]['id'])});}}else{socket['emit'](_0x4458('0x89'),{'UserId':Number(_0x5a1f36[_0x4458('0x37')][_0x4458('0x72')]),'WhatsappQueueId':Number(_0x5a1f36[_0x4458('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x788a35,null))[_0x4458('0x51')](handleError(_0x788a35,null));};exports['getAgents']=function(_0x15b9f1,_0x2e7335,_0x4e44e9){var _0x1f6221={};var _0x241934={};var _0x120a7a;var _0x4b3f57;return db[_0x4458('0x30')]['findOne']({'where':{'id':_0x15b9f1[_0x4458('0x53')]['id']}})['then'](handleEntityNotFound(_0x2e7335,null))[_0x4458('0x27')](function(_0x338e95){if(_0x338e95){_0x120a7a=_0x338e95;_0x241934[_0x4458('0x35')]=_[_0x4458('0x38')](db['User'][_0x4458('0x31')]);_0x241934[_0x4458('0x37')]=_[_0x4458('0x38')](_0x15b9f1[_0x4458('0x37')]);_0x241934[_0x4458('0x39')]=_[_0x4458('0x3a')](_0x241934['model'],_0x241934['query']);_0x1f6221[_0x4458('0x3b')]=_[_0x4458('0x3a')](_0x241934[_0x4458('0x35')],qs[_0x4458('0x3c')](_0x15b9f1[_0x4458('0x37')]['fields']));_0x1f6221[_0x4458('0x3b')]=_0x1f6221[_0x4458('0x3b')]['length']?_0x1f6221[_0x4458('0x3b')]:_0x241934['model'];_0x1f6221[_0x4458('0x40')]=qs['sort'](_0x15b9f1['query']['sort']);_0x1f6221['where']=qs[_0x4458('0x39')](_[_0x4458('0x43')](_0x15b9f1[_0x4458('0x37')],_0x241934[_0x4458('0x39')]));if(_0x15b9f1[_0x4458('0x37')]['filter']){_0x1f6221['where']=_['merge'](_0x1f6221[_0x4458('0x42')],{'$or':_[_0x4458('0x36')](_0x1f6221[_0x4458('0x3b')],function(_0x2cd9c6){var _0x5238f2={};_0x5238f2[_0x2cd9c6]={'$like':'%'+_0x15b9f1['query']['filter']+'%'};return _0x5238f2;})});}_0x1f6221=_[_0x4458('0x45')]({},_0x1f6221,_0x15b9f1['options']);return _0x120a7a[_0x4458('0x8f')](_0x1f6221);}})[_0x4458('0x27')](function(_0xb6700){if(_0xb6700){_0x4b3f57=_0xb6700[_0x4458('0x3d')];if(!_0x15b9f1[_0x4458('0x37')][_0x4458('0x3e')](_0x4458('0x3f'))){_0x1f6221[_0x4458('0x1f')]=qs[_0x4458('0x1f')](_0x15b9f1[_0x4458('0x37')][_0x4458('0x1f')]);_0x1f6221[_0x4458('0x1d')]=qs[_0x4458('0x1d')](_0x15b9f1[_0x4458('0x37')][_0x4458('0x1d')]);}return _0x120a7a[_0x4458('0x8f')](_0x1f6221);}})['then'](function(_0x1fad45){if(_0x1fad45){return _0x1fad45?{'count':_0x4b3f57,'rows':_0x1fad45}:null;}})[_0x4458('0x27')](respondWithResult(_0x2e7335,null))[_0x4458('0x51')](handleError(_0x2e7335,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index decc395..1f74d0d 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 _0x9afa=['remove','emit','hasOwnProperty','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update'];(function(_0x452920,_0x37310f){var _0x57a261=function(_0x4ad790){while(--_0x4ad790){_0x452920['push'](_0x452920['shift']());}};_0x57a261(++_0x37310f);}(_0x9afa,0xc0));var _0xa9af=function(_0x2162f1,_0x428221){_0x2162f1=_0x2162f1-0x0;var _0x4d7a96=_0x9afa[_0x2162f1];return _0x4d7a96;};'use strict';var EventEmitter=require(_0xa9af('0x0'));var WhatsappQueue=require(_0xa9af('0x1'))['db'][_0xa9af('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xa9af('0x3')](0x0);var events={'afterCreate':_0xa9af('0x4'),'afterUpdate':_0xa9af('0x5'),'afterDestroy':_0xa9af('0x6')};function emitEvent(_0x46d90f){return function(_0x816652,_0x161fea,_0x30555c){WhatsappQueueEvents['emit'](_0x46d90f+':'+_0x816652['id'],_0x816652);WhatsappQueueEvents[_0xa9af('0x7')](_0x46d90f,_0x816652);_0x30555c(null);};}for(var e in events){if(events[_0xa9af('0x8')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x5fbd=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x268bd2,_0x31ec23){var _0xd04986=function(_0x733f85){while(--_0x733f85){_0x268bd2['push'](_0x268bd2['shift']());}};_0xd04986(++_0x31ec23);}(_0x5fbd,0x13c));var _0xd5fb=function(_0x2460cd,_0x1002b8){_0x2460cd=_0x2460cd-0x0;var _0x5d3d43=_0x5fbd[_0x2460cd];return _0x5d3d43;};'use strict';var EventEmitter=require(_0xd5fb('0x0'));var WhatsappQueue=require(_0xd5fb('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xd5fb('0x2')](0x0);var events={'afterCreate':_0xd5fb('0x3'),'afterUpdate':_0xd5fb('0x4'),'afterDestroy':_0xd5fb('0x5')};function emitEvent(_0x322bee){return function(_0x4c9cc9,_0x58d588,_0x306e64){WhatsappQueueEvents['emit'](_0x322bee+':'+_0x4c9cc9['id'],_0x4c9cc9);WhatsappQueueEvents[_0xd5fb('0x6')](_0x322bee,_0x4c9cc9);_0x306e64(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xd5fb('0x7')](e,emitEvent(event));}}module[_0xd5fb('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 78d02ce..4c45505 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 _0x1fee=['exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x466ebc,_0x95074c){var _0x5aa290=function(_0x4deb9e){while(--_0x4deb9e){_0x466ebc['push'](_0x466ebc['shift']());}};_0x5aa290(++_0x95074c);}(_0x1fee,0x1e0));var _0xe1fe=function(_0x3caa8a,_0x76ee70){_0x3caa8a=_0x3caa8a-0x0;var _0xca9058=_0x1fee[_0x3caa8a];return _0xca9058;};'use strict';var _=require(_0xe1fe('0x0'));var util=require(_0xe1fe('0x1'));var logger=require(_0xe1fe('0x2'))(_0xe1fe('0x3'));var moment=require(_0xe1fe('0x4'));var BPromise=require(_0xe1fe('0x5'));var rp=require(_0xe1fe('0x6'));var fs=require('fs');var path=require(_0xe1fe('0x7'));var rimraf=require(_0xe1fe('0x8'));var config=require(_0xe1fe('0x9'));var attributes=require('./whatsappQueue.attributes');module[_0xe1fe('0xa')]=function(_0x22f306,_0xd7b712){return _0x22f306[_0xe1fe('0xb')](_0xe1fe('0xc'),attributes,{'tableName':_0xe1fe('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8401=['bluebird','request-promise','path','rimraf','./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash','../../config/logger','api','moment'];(function(_0x256224,_0x249028){var _0x37af37=function(_0x1cbfbd){while(--_0x1cbfbd){_0x256224['push'](_0x256224['shift']());}};_0x37af37(++_0x249028);}(_0x8401,0x194));var _0x1840=function(_0x2e351b,_0x4a967d){_0x2e351b=_0x2e351b-0x0;var _0x153613=_0x8401[_0x2e351b];return _0x153613;};'use strict';var _=require(_0x1840('0x0'));var util=require('util');var logger=require(_0x1840('0x1'))(_0x1840('0x2'));var moment=require(_0x1840('0x3'));var BPromise=require(_0x1840('0x4'));var rp=require(_0x1840('0x5'));var fs=require('fs');var path=require(_0x1840('0x6'));var rimraf=require(_0x1840('0x7'));var config=require('../../config/environment');var attributes=require(_0x1840('0x8'));module[_0x1840('0x9')]=function(_0x115a3f,_0x464f3c){return _0x115a3f[_0x1840('0xa')]('WhatsappQueue',attributes,{'tableName':_0x1840('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 6243286..e148806 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 _0x1144=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','include','model','attributes','map','ShowWhatsappQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5b3552,_0x4f97ed){var _0x1d9d04=function(_0x3b4652){while(--_0x3b4652){_0x5b3552['push'](_0x5b3552['shift']());}};_0x1d9d04(++_0x4f97ed);}(_0x1144,0x1f0));var _0x4114=function(_0x4e9429,_0xd8b069){_0x4e9429=_0x4e9429-0x0;var _0x385357=_0x1144[_0x4e9429];return _0x385357;};'use strict';var _=require(_0x4114('0x0'));var util=require(_0x4114('0x1'));var moment=require(_0x4114('0x2'));var BPromise=require('bluebird');var rs=require(_0x4114('0x3'));var fs=require('fs');var Redis=require(_0x4114('0x4'));var db=require(_0x4114('0x5'))['db'];var utils=require(_0x4114('0x6'));var logger=require(_0x4114('0x7'))(_0x4114('0x8'));var config=require(_0x4114('0x9'));var jayson=require(_0x4114('0xa'));var client=jayson[_0x4114('0xb')][_0x4114('0xc')]({'port':0x232a});config[_0x4114('0xd')]=_[_0x4114('0xe')](config['redis'],{'host':_0x4114('0xf'),'port':0x18eb});var socket=require(_0x4114('0x10'))(new Redis(config[_0x4114('0xd')]));require(_0x4114('0x11'))['register'](socket);function respondWithRpcPromise(_0x272b49,_0x42d965,_0x4ca899){return new BPromise(function(_0x42a185,_0x5e91df){return client[_0x4114('0x12')](_0x272b49,_0x4ca899)[_0x4114('0x13')](function(_0x1cf91d){logger['info'](_0x4114('0x14'),_0x42d965,_0x4114('0x15'));logger[_0x4114('0x16')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x42d965,'request\x20sent',JSON[_0x4114('0x17')](_0x1cf91d));if(_0x1cf91d[_0x4114('0x18')]){if(_0x1cf91d[_0x4114('0x18')][_0x4114('0x19')]===0x1f4){logger[_0x4114('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x42d965,_0x1cf91d[_0x4114('0x18')][_0x4114('0x1a')]);return _0x5e91df(_0x1cf91d[_0x4114('0x18')]['message']);}logger[_0x4114('0x18')](_0x4114('0x14'),_0x42d965,_0x1cf91d['error'][_0x4114('0x1a')]);return _0x42a185(_0x1cf91d[_0x4114('0x18')][_0x4114('0x1a')]);}else{logger[_0x4114('0x1b')](_0x4114('0x14'),_0x42d965,_0x4114('0x15'));_0x42a185(_0x1cf91d[_0x4114('0x1c')][_0x4114('0x1a')]);}})[_0x4114('0x1d')](function(_0x540be9){logger[_0x4114('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x42d965,_0x540be9);_0x5e91df(_0x540be9);});});}exports[_0x4114('0x1e')]=function(_0x3da929){var _0x158820=this;return new Promise(function(_0x19b0c2,_0x5c97fd){return db[_0x4114('0x1f')][_0x4114('0x20')]({'raw':_0x3da929[_0x4114('0x21')]?_0x3da929[_0x4114('0x21')][_0x4114('0x22')]===undefined?!![]:![]:!![],'where':_0x3da929[_0x4114('0x21')]?_0x3da929[_0x4114('0x21')][_0x4114('0x23')]||null:null,'attributes':_0x3da929[_0x4114('0x21')]?_0x3da929['options']['attributes']||null:null,'limit':_0x3da929['options']?_0x3da929[_0x4114('0x21')]['limit']||null:null,'include':_0x3da929[_0x4114('0x21')]?_0x3da929[_0x4114('0x21')][_0x4114('0x24')]?_['map'](_0x3da929[_0x4114('0x21')][_0x4114('0x24')],function(_0x436ad2){return{'model':db[_0x436ad2[_0x4114('0x25')]],'as':_0x436ad2['as'],'attributes':_0x436ad2[_0x4114('0x26')],'include':_0x436ad2[_0x4114('0x24')]?_[_0x4114('0x27')](_0x436ad2['include'],function(_0x2d5cff){return{'model':db[_0x2d5cff['model']],'as':_0x2d5cff['as'],'attributes':_0x2d5cff['attributes'],'include':_0x2d5cff[_0x4114('0x24')]?_[_0x4114('0x27')](_0x2d5cff[_0x4114('0x24')],function(_0x11e8b6){return{'model':db[_0x11e8b6[_0x4114('0x25')]],'as':_0x11e8b6['as'],'attributes':_0x11e8b6['attributes']};}):[]};}):[]};}):[]:[]})[_0x4114('0x13')](function(_0x470b79){logger[_0x4114('0x1b')]('GetWhatsappQueue',_0x3da929);logger[_0x4114('0x16')](_0x4114('0x1e'),_0x3da929,JSON['stringify'](_0x470b79));_0x19b0c2(_0x470b79);})[_0x4114('0x1d')](function(_0xcfd403){logger[_0x4114('0x18')](_0x4114('0x1e'),_0xcfd403['message'],_0x3da929);_0x5c97fd(_0x158820[_0x4114('0x18')](0x1f4,_0xcfd403[_0x4114('0x1a')]));});});};exports[_0x4114('0x28')]=function(_0x476c4f){var _0x46eb76=this;return new Promise(function(_0x1900a4,_0x2409f8){return db[_0x4114('0x1f')][_0x4114('0x29')]({'raw':_0x476c4f[_0x4114('0x21')]?_0x476c4f['options'][_0x4114('0x22')]===undefined?!![]:![]:!![],'where':_0x476c4f[_0x4114('0x21')]?_0x476c4f[_0x4114('0x21')]['where']||null:null,'attributes':_0x476c4f[_0x4114('0x21')]?_0x476c4f[_0x4114('0x21')][_0x4114('0x26')]||null:null,'include':_0x476c4f['options']?_0x476c4f[_0x4114('0x21')][_0x4114('0x24')]?_[_0x4114('0x27')](_0x476c4f[_0x4114('0x21')][_0x4114('0x24')],function(_0x1dd3f5){return{'model':db[_0x1dd3f5[_0x4114('0x25')]],'as':_0x1dd3f5['as'],'attributes':_0x1dd3f5[_0x4114('0x26')],'include':_0x1dd3f5[_0x4114('0x24')]?_[_0x4114('0x27')](_0x1dd3f5[_0x4114('0x24')],function(_0x584d7f){return{'model':db[_0x584d7f[_0x4114('0x25')]],'as':_0x584d7f['as'],'attributes':_0x584d7f['attributes'],'include':_0x584d7f[_0x4114('0x24')]?_[_0x4114('0x27')](_0x584d7f[_0x4114('0x24')],function(_0x496344){return{'model':db[_0x496344[_0x4114('0x25')]],'as':_0x496344['as'],'attributes':_0x496344[_0x4114('0x26')]};}):[]};}):[]};}):[]:[]})[_0x4114('0x13')](function(_0x4f5f97){logger[_0x4114('0x1b')](_0x4114('0x28'),_0x476c4f);logger[_0x4114('0x16')](_0x4114('0x28'),_0x476c4f,JSON['stringify'](_0x4f5f97));_0x1900a4(_0x4f5f97);})[_0x4114('0x1d')](function(_0x4565eb){logger[_0x4114('0x18')](_0x4114('0x28'),_0x4565eb[_0x4114('0x1a')],_0x476c4f);_0x2409f8(_0x46eb76[_0x4114('0x18')](0x1f4,_0x4565eb['message']));});});}; \ No newline at end of file +var _0x6fa4=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','WhatsappQueue','options','where','attributes','limit','include','map','model','GetWhatsappQueue','debug','catch','ShowWhatsappQueue','find','raw','lodash','util'];(function(_0x379f37,_0x187657){var _0x5ad4b6=function(_0x4ed51e){while(--_0x4ed51e){_0x379f37['push'](_0x379f37['shift']());}};_0x5ad4b6(++_0x187657);}(_0x6fa4,0xc1));var _0x46fa=function(_0x5eeb4e,_0x1444c8){_0x5eeb4e=_0x5eeb4e-0x0;var _0x5594bd=_0x6fa4[_0x5eeb4e];return _0x5594bd;};'use strict';var _=require(_0x46fa('0x0'));var util=require(_0x46fa('0x1'));var moment=require('moment');var BPromise=require(_0x46fa('0x2'));var rs=require(_0x46fa('0x3'));var fs=require('fs');var Redis=require(_0x46fa('0x4'));var db=require(_0x46fa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x46fa('0x6'))(_0x46fa('0x7'));var config=require(_0x46fa('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x46fa('0x9')]({'port':0x232a});config[_0x46fa('0xa')]=_[_0x46fa('0xb')](config[_0x46fa('0xa')],{'host':_0x46fa('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x46fa('0xd'))[_0x46fa('0xe')](socket);function respondWithRpcPromise(_0x4ced6e,_0xace848,_0x5f252d){return new BPromise(function(_0x4ea594,_0x22aa59){return client[_0x46fa('0xf')](_0x4ced6e,_0x5f252d)[_0x46fa('0x10')](function(_0x518478){logger[_0x46fa('0x11')](_0x46fa('0x12'),_0xace848,'request\x20sent');logger['debug'](_0x46fa('0x13'),_0xace848,_0x46fa('0x14'),JSON[_0x46fa('0x15')](_0x518478));if(_0x518478['error']){if(_0x518478[_0x46fa('0x16')]['code']===0x1f4){logger[_0x46fa('0x16')](_0x46fa('0x12'),_0xace848,_0x518478[_0x46fa('0x16')][_0x46fa('0x17')]);return _0x22aa59(_0x518478[_0x46fa('0x16')][_0x46fa('0x17')]);}logger['error'](_0x46fa('0x12'),_0xace848,_0x518478['error'][_0x46fa('0x17')]);return _0x4ea594(_0x518478[_0x46fa('0x16')][_0x46fa('0x17')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0xace848,_0x46fa('0x14'));_0x4ea594(_0x518478[_0x46fa('0x18')][_0x46fa('0x17')]);}})['catch'](function(_0x248da5){logger['error'](_0x46fa('0x12'),_0xace848,_0x248da5);_0x22aa59(_0x248da5);});});}exports['GetWhatsappQueue']=function(_0x1ab6e5){var _0x428092=this;return new Promise(function(_0x39f9c1,_0x4e8f7a){return db[_0x46fa('0x19')]['findAll']({'raw':_0x1ab6e5[_0x46fa('0x1a')]?_0x1ab6e5['options']['raw']===undefined?!![]:![]:!![],'where':_0x1ab6e5[_0x46fa('0x1a')]?_0x1ab6e5[_0x46fa('0x1a')][_0x46fa('0x1b')]||null:null,'attributes':_0x1ab6e5[_0x46fa('0x1a')]?_0x1ab6e5[_0x46fa('0x1a')][_0x46fa('0x1c')]||null:null,'limit':_0x1ab6e5[_0x46fa('0x1a')]?_0x1ab6e5[_0x46fa('0x1a')][_0x46fa('0x1d')]||null:null,'include':_0x1ab6e5['options']?_0x1ab6e5[_0x46fa('0x1a')][_0x46fa('0x1e')]?_[_0x46fa('0x1f')](_0x1ab6e5[_0x46fa('0x1a')][_0x46fa('0x1e')],function(_0x57407d){return{'model':db[_0x57407d[_0x46fa('0x20')]],'as':_0x57407d['as'],'attributes':_0x57407d[_0x46fa('0x1c')],'include':_0x57407d['include']?_['map'](_0x57407d[_0x46fa('0x1e')],function(_0x1e30e3){return{'model':db[_0x1e30e3[_0x46fa('0x20')]],'as':_0x1e30e3['as'],'attributes':_0x1e30e3['attributes'],'include':_0x1e30e3[_0x46fa('0x1e')]?_[_0x46fa('0x1f')](_0x1e30e3[_0x46fa('0x1e')],function(_0x9fabe8){return{'model':db[_0x9fabe8[_0x46fa('0x20')]],'as':_0x9fabe8['as'],'attributes':_0x9fabe8[_0x46fa('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x46fa('0x10')](function(_0x53d187){logger['info'](_0x46fa('0x21'),_0x1ab6e5);logger[_0x46fa('0x22')](_0x46fa('0x21'),_0x1ab6e5,JSON['stringify'](_0x53d187));_0x39f9c1(_0x53d187);})[_0x46fa('0x23')](function(_0x5eb5fe){logger[_0x46fa('0x16')](_0x46fa('0x21'),_0x5eb5fe['message'],_0x1ab6e5);_0x4e8f7a(_0x428092[_0x46fa('0x16')](0x1f4,_0x5eb5fe[_0x46fa('0x17')]));});});};exports[_0x46fa('0x24')]=function(_0x3b2067){var _0x4df289=this;return new Promise(function(_0x19df02,_0x311eac){return db['WhatsappQueue'][_0x46fa('0x25')]({'raw':_0x3b2067[_0x46fa('0x1a')]?_0x3b2067[_0x46fa('0x1a')][_0x46fa('0x26')]===undefined?!![]:![]:!![],'where':_0x3b2067[_0x46fa('0x1a')]?_0x3b2067[_0x46fa('0x1a')][_0x46fa('0x1b')]||null:null,'attributes':_0x3b2067[_0x46fa('0x1a')]?_0x3b2067['options']['attributes']||null:null,'include':_0x3b2067['options']?_0x3b2067[_0x46fa('0x1a')][_0x46fa('0x1e')]?_[_0x46fa('0x1f')](_0x3b2067[_0x46fa('0x1a')][_0x46fa('0x1e')],function(_0x36890f){return{'model':db[_0x36890f['model']],'as':_0x36890f['as'],'attributes':_0x36890f['attributes'],'include':_0x36890f[_0x46fa('0x1e')]?_['map'](_0x36890f[_0x46fa('0x1e')],function(_0x439ec1){return{'model':db[_0x439ec1[_0x46fa('0x20')]],'as':_0x439ec1['as'],'attributes':_0x439ec1[_0x46fa('0x1c')],'include':_0x439ec1[_0x46fa('0x1e')]?_[_0x46fa('0x1f')](_0x439ec1['include'],function(_0x34afbc){return{'model':db[_0x34afbc['model']],'as':_0x34afbc['as'],'attributes':_0x34afbc[_0x46fa('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f8348){logger[_0x46fa('0x11')](_0x46fa('0x24'),_0x3b2067);logger[_0x46fa('0x22')](_0x46fa('0x24'),_0x3b2067,JSON[_0x46fa('0x15')](_0x3f8348));_0x19df02(_0x3f8348);})['catch'](function(_0x1e33a7){logger['error'](_0x46fa('0x24'),_0x1e33a7['message'],_0x3b2067);_0x311eac(_0x4df289[_0x46fa('0x16')](0x1f4,_0x1e33a7[_0x46fa('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 8e0c9c5..9bc9644 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 _0x0640=['./whatsappQueue.events','save','remove','update','emit','removeListener'];(function(_0x369991,_0x371684){var _0x42b4f9=function(_0x1f9d05){while(--_0x1f9d05){_0x369991['push'](_0x369991['shift']());}};_0x42b4f9(++_0x371684);}(_0x0640,0x66));var _0x0064=function(_0x500752,_0x473ea9){_0x500752=_0x500752-0x0;var _0x25f440=_0x0640[_0x500752];return _0x25f440;};'use strict';var WhatsappQueueEvents=require(_0x0064('0x0'));var events=[_0x0064('0x1'),_0x0064('0x2'),_0x0064('0x3')];function createListener(_0x350e82,_0x14ff8a){return function(_0x5e443f){_0x14ff8a[_0x0064('0x4')](_0x350e82,_0x5e443f);};}function removeListener(_0x34322b,_0x3c9d70){return function(){WhatsappQueueEvents[_0x0064('0x5')](_0x34322b,_0x3c9d70);};}exports['register']=function(_0x1bca85){for(var _0x4ff9eb=0x0,_0x58ea46=events['length'];_0x4ff9eb<_0x58ea46;_0x4ff9eb++){var _0x40d6d3=events[_0x4ff9eb];var _0x472b6d=createListener('whatsappQueue:'+_0x40d6d3,_0x1bca85);WhatsappQueueEvents['on'](_0x40d6d3,_0x472b6d);}}; \ No newline at end of file +var _0x962c=['removeListener','register','whatsappQueue:','./whatsappQueue.events','save','remove','update','emit'];(function(_0x3a8ec5,_0x378f44){var _0x483caf=function(_0x559670){while(--_0x559670){_0x3a8ec5['push'](_0x3a8ec5['shift']());}};_0x483caf(++_0x378f44);}(_0x962c,0x93));var _0xc962=function(_0x258745,_0x4be599){_0x258745=_0x258745-0x0;var _0xf334ba=_0x962c[_0x258745];return _0xf334ba;};'use strict';var WhatsappQueueEvents=require(_0xc962('0x0'));var events=[_0xc962('0x1'),_0xc962('0x2'),_0xc962('0x3')];function createListener(_0x45ee00,_0x261f5d){return function(_0x2bb097){_0x261f5d[_0xc962('0x4')](_0x45ee00,_0x2bb097);};}function removeListener(_0x36c48a,_0x50c065){return function(){WhatsappQueueEvents[_0xc962('0x5')](_0x36c48a,_0x50c065);};}exports[_0xc962('0x6')]=function(_0x288315){for(var _0x101f91=0x0,_0x114554=events['length'];_0x101f91<_0x114554;_0x101f91++){var _0x5c6f1e=events[_0x101f91];var _0x23ef2a=createListener(_0xc962('0x7')+_0x5c6f1e,_0x288315);WhatsappQueueEvents['on'](_0x5c6f1e,_0x23ef2a);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index bf1ac27..9e757a4 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 _0x7789=['../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5652c1,_0x1e52d8){var _0x3b51b9=function(_0x3df7e8){while(--_0x3df7e8){_0x5652c1['push'](_0x5652c1['shift']());}};_0x3b51b9(++_0x1e52d8);}(_0x7789,0x19a));var _0x9778=function(_0x355c47,_0x43de58){_0x355c47=_0x355c47-0x0;var _0x503cbc=_0x7789[_0x355c47];return _0x503cbc;};'use strict';var multer=require(_0x9778('0x0'));var util=require(_0x9778('0x1'));var path=require(_0x9778('0x2'));var timeout=require(_0x9778('0x3'));var express=require(_0x9778('0x4'));var router=express[_0x9778('0x5')]();var fs_extra=require(_0x9778('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9778('0x7'));var config=require(_0x9778('0x8'));var controller=require(_0x9778('0x9'));router['get']('/',auth[_0x9778('0xa')](),controller[_0x9778('0xb')]);router[_0x9778('0xc')]('/describe',auth['isAuthenticated'](),controller[_0x9778('0xd')]);router[_0x9778('0xc')](_0x9778('0xe'),auth[_0x9778('0xa')](),controller[_0x9778('0xf')]);router[_0x9778('0x10')]('/',auth[_0x9778('0xa')](),controller[_0x9778('0x11')]);router[_0x9778('0x12')](_0x9778('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x9778('0x13')](_0x9778('0xe'),auth[_0x9778('0xa')](),controller[_0x9778('0x14')]);module[_0x9778('0x15')]=router; \ No newline at end of file +var _0xdfcb=['isAuthenticated','/describe','describe','/:id','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./whatsappQueueReport.controller','get'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xdfcb,0x14d));var _0xbdfc=function(_0x1aed80,_0x3ca6f6){_0x1aed80=_0x1aed80-0x0;var _0x43961e=_0xdfcb[_0x1aed80];return _0x43961e;};'use strict';var multer=require(_0xbdfc('0x0'));var util=require(_0xbdfc('0x1'));var path=require(_0xbdfc('0x2'));var timeout=require(_0xbdfc('0x3'));var express=require('express');var router=express[_0xbdfc('0x4')]();var fs_extra=require(_0xbdfc('0x5'));var auth=require(_0xbdfc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbdfc('0x7'));router[_0xbdfc('0x8')]('/',auth[_0xbdfc('0x9')](),controller['index']);router[_0xbdfc('0x8')](_0xbdfc('0xa'),auth['isAuthenticated'](),controller[_0xbdfc('0xb')]);router[_0xbdfc('0x8')](_0xbdfc('0xc'),auth[_0xbdfc('0x9')](),controller['show']);router[_0xbdfc('0xd')]('/',auth[_0xbdfc('0x9')](),controller[_0xbdfc('0xe')]);router[_0xbdfc('0xf')](_0xbdfc('0xc'),auth[_0xbdfc('0x9')](),controller[_0xbdfc('0x10')]);router['delete']('/:id',auth[_0xbdfc('0x9')](),controller[_0xbdfc('0x11')]);module[_0xbdfc('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 93a6360..27fcc92 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x10a7c3,_0x3f5d2b){var _0x52843a=function(_0xe68a40){while(--_0xe68a40){_0x10a7c3['push'](_0x10a7c3['shift']());}};_0x52843a(++_0x3f5d2b);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x55469d,_0x2aab3e){var _0xbc02a3=function(_0x36d2ef){while(--_0x36d2ef){_0x55469d['push'](_0x55469d['shift']());}};_0xbc02a3(++_0x2aab3e);}(_0x7a54,0x106));var _0x47a5=function(_0x16f39c,_0x40b3b1){_0x16f39c=_0x16f39c-0x0;var _0x4b9a64=_0x7a54[_0x16f39c];return _0x4b9a64;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index bb5e201..0087a2c 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 _0x282b=['intersection','attributes','model','fields','hasOwnProperty','order','where','filters','pick','filter','merge','VIRTUAL','options','WhatsappQueueReport','includeAll','include','findAll','rows','catch','show','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','error','name','send','map','rawAttributes','fieldName','type','key','query','keys'];(function(_0x1a01b3,_0x5b2713){var _0x16f709=function(_0xff337f){while(--_0xff337f){_0x1a01b3['push'](_0x1a01b3['shift']());}};_0x16f709(++_0x5b2713);}(_0x282b,0xec));var _0xb282=function(_0x5cf4ef,_0x333dd0){_0x5cf4ef=_0x5cf4ef-0x0;var _0x291437=_0x282b[_0x5cf4ef];return _0x291437;};'use strict';var emlformat=require(_0xb282('0x0'));var rimraf=require(_0xb282('0x1'));var zipdir=require(_0xb282('0x2'));var jsonpatch=require(_0xb282('0x3'));var rp=require(_0xb282('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb282('0x5'));var util=require('util');var path=require(_0xb282('0x6'));var sox=require(_0xb282('0x7'));var csv=require(_0xb282('0x8'));var ejs=require(_0xb282('0x9'));var fs=require('fs');var fs_extra=require(_0xb282('0xa'));var _=require(_0xb282('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb282('0xc'));var deskjs=require(_0xb282('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb282('0xe'));var Papa=require(_0xb282('0xf'));var Redis=require(_0xb282('0x10'));var authService=require(_0xb282('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb282('0x12'));var logger=require(_0xb282('0x13'))(_0xb282('0x14'));var utils=require(_0xb282('0x15'));var config=require(_0xb282('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x338bdb,_0xc08746){_0xc08746=_0xc08746||0xcc;return function(_0x40d7b8){if(_0x40d7b8){return _0x338bdb[_0xb282('0x17')](_0xc08746);}return _0x338bdb[_0xb282('0x18')](_0xc08746)['end']();};}function respondWithResult(_0x34c595,_0x5adf7f){_0x5adf7f=_0x5adf7f||0xc8;return function(_0xe1d53){if(_0xe1d53){return _0x34c595[_0xb282('0x18')](_0x5adf7f)['json'](_0xe1d53);}};}function respondWithFilteredResult(_0x525cfa,_0x5bc7c3){return function(_0x13cea1){if(_0x13cea1){var _0x350676=typeof _0x5bc7c3[_0xb282('0x19')]===_0xb282('0x1a')&&typeof _0x5bc7c3[_0xb282('0x1b')]==='undefined';var _0x191a31=_0x13cea1[_0xb282('0x1c')];var _0xca5f12=_0x350676?0x0:_0x5bc7c3[_0xb282('0x19')];var _0x3f8a3f=_0x350676?_0x13cea1['count']:_0x5bc7c3['offset']+_0x5bc7c3[_0xb282('0x1b')];var _0x2cdeb1;if(_0x3f8a3f>=_0x191a31){_0x3f8a3f=_0x191a31;_0x2cdeb1=0xc8;}else{_0x2cdeb1=0xce;}_0x525cfa['status'](_0x2cdeb1);return _0x525cfa[_0xb282('0x1d')](_0xb282('0x1e'),_0xca5f12+'-'+_0x3f8a3f+'/'+_0x191a31)[_0xb282('0x1f')](_0x13cea1);}return null;};}function patchUpdates(_0x438dbe){return function(_0x1c3084){try{jsonpatch['apply'](_0x1c3084,_0x438dbe,!![]);}catch(_0x1de407){return BPromise[_0xb282('0x20')](_0x1de407);}return _0x1c3084[_0xb282('0x21')]();};}function saveUpdates(_0x4b79d7,_0x437d66){return function(_0x2a7ef8){if(_0x2a7ef8){return _0x2a7ef8[_0xb282('0x22')](_0x4b79d7)[_0xb282('0x23')](function(_0x680095){return _0x680095;});}return null;};}function removeEntity(_0x56645f,_0x4d624f){return function(_0x360f15){if(_0x360f15){return _0x360f15[_0xb282('0x24')]()['then'](function(){_0x56645f['status'](0xcc)[_0xb282('0x25')]();});}};}function handleEntityNotFound(_0x114f77,_0x3451e5){return function(_0x3c4018){if(!_0x3c4018){_0x114f77[_0xb282('0x17')](0x194);}return _0x3c4018;};}function handleError(_0x2b1303,_0x5b1d3d){_0x5b1d3d=_0x5b1d3d||0x1f4;return function(_0xa0d7fb){logger[_0xb282('0x26')](_0xa0d7fb['stack']);if(_0xa0d7fb[_0xb282('0x27')]){delete _0xa0d7fb[_0xb282('0x27')];}_0x2b1303[_0xb282('0x18')](_0x5b1d3d)[_0xb282('0x28')](_0xa0d7fb);};}exports['index']=function(_0x1520b1,_0x1fb89f){var _0xe337b8={},_0x433ad5={},_0x4cee93={'count':0x0,'rows':[]};var _0xfddd2e=_[_0xb282('0x29')](db['WhatsappQueueReport'][_0xb282('0x2a')],function(_0x1e2861){return{'name':_0x1e2861[_0xb282('0x2b')],'type':_0x1e2861[_0xb282('0x2c')][_0xb282('0x2d')]};});_0x433ad5['model']=_[_0xb282('0x29')](_0xfddd2e,'name');_0x433ad5[_0xb282('0x2e')]=_[_0xb282('0x2f')](_0x1520b1[_0xb282('0x2e')]);_0x433ad5['filters']=_[_0xb282('0x30')](_0x433ad5['model'],_0x433ad5[_0xb282('0x2e')]);_0xe337b8[_0xb282('0x31')]=_[_0xb282('0x30')](_0x433ad5[_0xb282('0x32')],qs[_0xb282('0x33')](_0x1520b1[_0xb282('0x2e')]['fields']));_0xe337b8[_0xb282('0x31')]=_0xe337b8[_0xb282('0x31')]['length']?_0xe337b8['attributes']:_0x433ad5[_0xb282('0x32')];if(!_0x1520b1[_0xb282('0x2e')][_0xb282('0x34')]('nolimit')){_0xe337b8['limit']=qs['limit'](_0x1520b1[_0xb282('0x2e')][_0xb282('0x1b')]);_0xe337b8[_0xb282('0x19')]=qs[_0xb282('0x19')](_0x1520b1[_0xb282('0x2e')][_0xb282('0x19')]);}_0xe337b8[_0xb282('0x35')]=qs['sort'](_0x1520b1[_0xb282('0x2e')]['sort']);_0xe337b8[_0xb282('0x36')]=qs[_0xb282('0x37')](_[_0xb282('0x38')](_0x1520b1['query'],_0x433ad5[_0xb282('0x37')]),_0xfddd2e);if(_0x1520b1['query'][_0xb282('0x39')]){_0xe337b8[_0xb282('0x36')]=_[_0xb282('0x3a')](_0xe337b8[_0xb282('0x36')],{'$or':_['map'](_0xfddd2e,function(_0x5c86bb){if(_0x5c86bb[_0xb282('0x2c')]!==_0xb282('0x3b')){var _0x3791fd={};_0x3791fd[_0x5c86bb[_0xb282('0x27')]]={'$like':'%'+_0x1520b1['query'][_0xb282('0x39')]+'%'};return _0x3791fd;}})});}_0xe337b8=_['merge']({},_0xe337b8,_0x1520b1[_0xb282('0x3c')]);var _0x1a1b50={'where':_0xe337b8['where']};return db[_0xb282('0x3d')][_0xb282('0x1c')](_0x1a1b50)[_0xb282('0x23')](function(_0x2c988a){_0x4cee93[_0xb282('0x1c')]=_0x2c988a;if(_0x1520b1[_0xb282('0x2e')][_0xb282('0x3e')]){_0xe337b8[_0xb282('0x3f')]=[{'all':!![]}];}return db[_0xb282('0x3d')][_0xb282('0x40')](_0xe337b8);})[_0xb282('0x23')](function(_0x91fe43){_0x4cee93[_0xb282('0x41')]=_0x91fe43;return _0x4cee93;})[_0xb282('0x23')](respondWithFilteredResult(_0x1fb89f,_0xe337b8))[_0xb282('0x42')](handleError(_0x1fb89f,null));};exports[_0xb282('0x43')]=function(_0x2416a4,_0x7332d2){var _0x573da7={'raw':!![],'where':{'id':_0x2416a4['params']['id']}},_0x310ad1={};_0x310ad1[_0xb282('0x32')]=_[_0xb282('0x2f')](db[_0xb282('0x3d')][_0xb282('0x2a')]);_0x310ad1[_0xb282('0x2e')]=_[_0xb282('0x2f')](_0x2416a4['query']);_0x310ad1['filters']=_[_0xb282('0x30')](_0x310ad1['model'],_0x310ad1[_0xb282('0x2e')]);_0x573da7[_0xb282('0x31')]=_['intersection'](_0x310ad1[_0xb282('0x32')],qs[_0xb282('0x33')](_0x2416a4[_0xb282('0x2e')]['fields']));_0x573da7['attributes']=_0x573da7[_0xb282('0x31')]['length']?_0x573da7[_0xb282('0x31')]:_0x310ad1[_0xb282('0x32')];if(_0x2416a4[_0xb282('0x2e')][_0xb282('0x3e')]){_0x573da7[_0xb282('0x3f')]=[{'all':!![]}];}_0x573da7=_[_0xb282('0x3a')]({},_0x573da7,_0x2416a4['options']);return db[_0xb282('0x3d')][_0xb282('0x44')](_0x573da7)[_0xb282('0x23')](handleEntityNotFound(_0x7332d2,null))['then'](respondWithResult(_0x7332d2,null))[_0xb282('0x42')](handleError(_0x7332d2,null));};exports['create']=function(_0x32fc1d,_0x4b0822){return db[_0xb282('0x3d')]['create'](_0x32fc1d['body'],{})['then'](respondWithResult(_0x4b0822,0xc9))[_0xb282('0x42')](handleError(_0x4b0822,null));};exports[_0xb282('0x22')]=function(_0x42d99f,_0x7a5aa4){if(_0x42d99f['body']['id']){delete _0x42d99f['body']['id'];}return db['WhatsappQueueReport'][_0xb282('0x44')]({'where':{'id':_0x42d99f[_0xb282('0x45')]['id']}})[_0xb282('0x23')](handleEntityNotFound(_0x7a5aa4,null))[_0xb282('0x23')](saveUpdates(_0x42d99f['body'],null))[_0xb282('0x23')](respondWithResult(_0x7a5aa4,null))[_0xb282('0x42')](handleError(_0x7a5aa4,null));};exports['destroy']=function(_0x33bded,_0x9f4d79){return db[_0xb282('0x3d')][_0xb282('0x44')]({'where':{'id':_0x33bded[_0xb282('0x45')]['id']}})['then'](handleEntityNotFound(_0x9f4d79,null))[_0xb282('0x23')](removeEntity(_0x9f4d79,null))[_0xb282('0x42')](handleError(_0x9f4d79,null));};exports[_0xb282('0x46')]=function(_0x22d129,_0x308aa8){return db[_0xb282('0x3d')]['describe']()[_0xb282('0x23')](respondWithResult(_0x308aa8,null))['catch'](handleError(_0x308aa8,null));}; \ No newline at end of file +var _0xbc9d=['index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','filter','map','type','merge','options','WhatsappQueueReport','includeAll','include','findAll','rows','show','params','find','catch','create','body','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','destroy','then','stack','name','send'];(function(_0x2c3f36,_0x4c57ff){var _0x2bcb93=function(_0x179be2){while(--_0x179be2){_0x2c3f36['push'](_0x2c3f36['shift']());}};_0x2bcb93(++_0x4c57ff);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x3026ec,_0x4e9bed){_0x3026ec=_0x3026ec-0x0;var _0x3a6c2c=_0xbc9d[_0x3026ec];return _0x3a6c2c;};'use strict';var emlformat=require(_0xdbc9('0x0'));var rimraf=require(_0xdbc9('0x1'));var zipdir=require(_0xdbc9('0x2'));var jsonpatch=require(_0xdbc9('0x3'));var rp=require(_0xdbc9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbc9('0x5'));var path=require(_0xdbc9('0x6'));var sox=require(_0xdbc9('0x7'));var csv=require(_0xdbc9('0x8'));var ejs=require(_0xdbc9('0x9'));var fs=require('fs');var fs_extra=require(_0xdbc9('0xa'));var _=require(_0xdbc9('0xb'));var squel=require('squel');var crypto=require(_0xdbc9('0xc'));var jsforce=require(_0xdbc9('0xd'));var deskjs=require(_0xdbc9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdbc9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbc9('0x10'));var qs=require(_0xdbc9('0x11'));var as=require(_0xdbc9('0x12'));var hardwareService=require(_0xdbc9('0x13'));var logger=require('../../config/logger')(_0xdbc9('0x14'));var utils=require(_0xdbc9('0x15'));var config=require(_0xdbc9('0x16'));var licenseUtil=require(_0xdbc9('0x17'));var db=require(_0xdbc9('0x18'))['db'];function respondWithStatusCode(_0x103d54,_0x48bc83){_0x48bc83=_0x48bc83||0xcc;return function(_0x567e71){if(_0x567e71){return _0x103d54[_0xdbc9('0x19')](_0x48bc83);}return _0x103d54[_0xdbc9('0x1a')](_0x48bc83)[_0xdbc9('0x1b')]();};}function respondWithResult(_0x436e50,_0x53495d){_0x53495d=_0x53495d||0xc8;return function(_0x4a9dcb){if(_0x4a9dcb){return _0x436e50[_0xdbc9('0x1a')](_0x53495d)[_0xdbc9('0x1c')](_0x4a9dcb);}};}function respondWithFilteredResult(_0x3a8a7b,_0x4c7b4f){return function(_0x1b4616){if(_0x1b4616){var _0x1abee8=typeof _0x4c7b4f['offset']===_0xdbc9('0x1d')&&typeof _0x4c7b4f[_0xdbc9('0x1e')]===_0xdbc9('0x1d');var _0x14e655=_0x1b4616[_0xdbc9('0x1f')];var _0x33f1bd=_0x1abee8?0x0:_0x4c7b4f[_0xdbc9('0x20')];var _0xc2ddd2=_0x1abee8?_0x1b4616[_0xdbc9('0x1f')]:_0x4c7b4f[_0xdbc9('0x20')]+_0x4c7b4f['limit'];var _0x1ca5fd;if(_0xc2ddd2>=_0x14e655){_0xc2ddd2=_0x14e655;_0x1ca5fd=0xc8;}else{_0x1ca5fd=0xce;}_0x3a8a7b['status'](_0x1ca5fd);return _0x3a8a7b[_0xdbc9('0x21')](_0xdbc9('0x22'),_0x33f1bd+'-'+_0xc2ddd2+'/'+_0x14e655)['json'](_0x1b4616);}return null;};}function patchUpdates(_0x4408e9){return function(_0x5367dc){try{jsonpatch['apply'](_0x5367dc,_0x4408e9,!![]);}catch(_0x4ab00d){return BPromise['reject'](_0x4ab00d);}return _0x5367dc[_0xdbc9('0x23')]();};}function saveUpdates(_0x2011a2,_0x570ad9){return function(_0x16dcf7){if(_0x16dcf7){return _0x16dcf7[_0xdbc9('0x24')](_0x2011a2)['then'](function(_0x1bc073){return _0x1bc073;});}return null;};}function removeEntity(_0x6b788,_0x1b1c0d){return function(_0x119230){if(_0x119230){return _0x119230[_0xdbc9('0x25')]()[_0xdbc9('0x26')](function(){_0x6b788[_0xdbc9('0x1a')](0xcc)[_0xdbc9('0x1b')]();});}};}function handleEntityNotFound(_0x3c8c1d,_0x4a868b){return function(_0x550bef){if(!_0x550bef){_0x3c8c1d[_0xdbc9('0x19')](0x194);}return _0x550bef;};}function handleError(_0x446ab9,_0x1053ca){_0x1053ca=_0x1053ca||0x1f4;return function(_0x24fdec){logger['error'](_0x24fdec[_0xdbc9('0x27')]);if(_0x24fdec[_0xdbc9('0x28')]){delete _0x24fdec['name'];}_0x446ab9['status'](_0x1053ca)[_0xdbc9('0x29')](_0x24fdec);};}exports[_0xdbc9('0x2a')]=function(_0x473430,_0x59bfd2){var _0x13a432={},_0x539e57={},_0x561f8e={'count':0x0,'rows':[]};var _0x210a40=_['map'](db['WhatsappQueueReport'][_0xdbc9('0x2b')],function(_0x20eb4f){return{'name':_0x20eb4f[_0xdbc9('0x2c')],'type':_0x20eb4f['type'][_0xdbc9('0x2d')]};});_0x539e57[_0xdbc9('0x2e')]=_['map'](_0x210a40,'name');_0x539e57[_0xdbc9('0x2f')]=_[_0xdbc9('0x30')](_0x473430[_0xdbc9('0x2f')]);_0x539e57[_0xdbc9('0x31')]=_[_0xdbc9('0x32')](_0x539e57[_0xdbc9('0x2e')],_0x539e57[_0xdbc9('0x2f')]);_0x13a432['attributes']=_[_0xdbc9('0x32')](_0x539e57[_0xdbc9('0x2e')],qs[_0xdbc9('0x33')](_0x473430[_0xdbc9('0x2f')][_0xdbc9('0x33')]));_0x13a432[_0xdbc9('0x34')]=_0x13a432['attributes'][_0xdbc9('0x35')]?_0x13a432['attributes']:_0x539e57['model'];if(!_0x473430['query']['hasOwnProperty']('nolimit')){_0x13a432[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x473430[_0xdbc9('0x2f')]['limit']);_0x13a432[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x473430[_0xdbc9('0x2f')][_0xdbc9('0x20')]);}_0x13a432[_0xdbc9('0x36')]=qs[_0xdbc9('0x37')](_0x473430['query'][_0xdbc9('0x37')]);_0x13a432[_0xdbc9('0x38')]=qs[_0xdbc9('0x31')](_['pick'](_0x473430[_0xdbc9('0x2f')],_0x539e57[_0xdbc9('0x31')]),_0x210a40);if(_0x473430[_0xdbc9('0x2f')][_0xdbc9('0x39')]){_0x13a432['where']=_['merge'](_0x13a432[_0xdbc9('0x38')],{'$or':_[_0xdbc9('0x3a')](_0x210a40,function(_0x136392){if(_0x136392[_0xdbc9('0x3b')]!=='VIRTUAL'){var _0x1b651f={};_0x1b651f[_0x136392[_0xdbc9('0x28')]]={'$like':'%'+_0x473430[_0xdbc9('0x2f')]['filter']+'%'};return _0x1b651f;}})});}_0x13a432=_[_0xdbc9('0x3c')]({},_0x13a432,_0x473430[_0xdbc9('0x3d')]);var _0x444219={'where':_0x13a432['where']};return db[_0xdbc9('0x3e')][_0xdbc9('0x1f')](_0x444219)['then'](function(_0x5173c2){_0x561f8e[_0xdbc9('0x1f')]=_0x5173c2;if(_0x473430[_0xdbc9('0x2f')][_0xdbc9('0x3f')]){_0x13a432[_0xdbc9('0x40')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xdbc9('0x41')](_0x13a432);})[_0xdbc9('0x26')](function(_0x577725){_0x561f8e[_0xdbc9('0x42')]=_0x577725;return _0x561f8e;})[_0xdbc9('0x26')](respondWithFilteredResult(_0x59bfd2,_0x13a432))['catch'](handleError(_0x59bfd2,null));};exports[_0xdbc9('0x43')]=function(_0x72dee3,_0x2adb23){var _0x3415c3={'raw':!![],'where':{'id':_0x72dee3[_0xdbc9('0x44')]['id']}},_0x3ed4de={};_0x3ed4de[_0xdbc9('0x2e')]=_['keys'](db['WhatsappQueueReport'][_0xdbc9('0x2b')]);_0x3ed4de[_0xdbc9('0x2f')]=_[_0xdbc9('0x30')](_0x72dee3[_0xdbc9('0x2f')]);_0x3ed4de[_0xdbc9('0x31')]=_[_0xdbc9('0x32')](_0x3ed4de[_0xdbc9('0x2e')],_0x3ed4de[_0xdbc9('0x2f')]);_0x3415c3[_0xdbc9('0x34')]=_[_0xdbc9('0x32')](_0x3ed4de[_0xdbc9('0x2e')],qs['fields'](_0x72dee3['query'][_0xdbc9('0x33')]));_0x3415c3[_0xdbc9('0x34')]=_0x3415c3[_0xdbc9('0x34')][_0xdbc9('0x35')]?_0x3415c3[_0xdbc9('0x34')]:_0x3ed4de[_0xdbc9('0x2e')];if(_0x72dee3[_0xdbc9('0x2f')][_0xdbc9('0x3f')]){_0x3415c3['include']=[{'all':!![]}];}_0x3415c3=_['merge']({},_0x3415c3,_0x72dee3[_0xdbc9('0x3d')]);return db[_0xdbc9('0x3e')][_0xdbc9('0x45')](_0x3415c3)[_0xdbc9('0x26')](handleEntityNotFound(_0x2adb23,null))[_0xdbc9('0x26')](respondWithResult(_0x2adb23,null))[_0xdbc9('0x46')](handleError(_0x2adb23,null));};exports[_0xdbc9('0x47')]=function(_0x2ea096,_0x43e3ec){return db['WhatsappQueueReport'][_0xdbc9('0x47')](_0x2ea096[_0xdbc9('0x48')],{})['then'](respondWithResult(_0x43e3ec,0xc9))['catch'](handleError(_0x43e3ec,null));};exports[_0xdbc9('0x24')]=function(_0xc3db3c,_0x133a13){if(_0xc3db3c['body']['id']){delete _0xc3db3c[_0xdbc9('0x48')]['id'];}return db[_0xdbc9('0x3e')][_0xdbc9('0x45')]({'where':{'id':_0xc3db3c[_0xdbc9('0x44')]['id']}})['then'](handleEntityNotFound(_0x133a13,null))[_0xdbc9('0x26')](saveUpdates(_0xc3db3c[_0xdbc9('0x48')],null))[_0xdbc9('0x26')](respondWithResult(_0x133a13,null))[_0xdbc9('0x46')](handleError(_0x133a13,null));};exports['destroy']=function(_0x3e89f5,_0x36c70e){return db[_0xdbc9('0x3e')][_0xdbc9('0x45')]({'where':{'id':_0x3e89f5[_0xdbc9('0x44')]['id']}})[_0xdbc9('0x26')](handleEntityNotFound(_0x36c70e,null))[_0xdbc9('0x26')](removeEntity(_0x36c70e,null))[_0xdbc9('0x46')](handleError(_0x36c70e,null));};exports['describe']=function(_0x1c6e6e,_0x4d09e1){return db[_0xdbc9('0x3e')][_0xdbc9('0x49')]()['then'](respondWithResult(_0x4d09e1,null))['catch'](handleError(_0x4d09e1,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index ca3e230..fd10e6b 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 _0x82e7=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','api'];(function(_0xc9c128,_0x13d604){var _0x2abd60=function(_0x17a2de){while(--_0x17a2de){_0xc9c128['push'](_0xc9c128['shift']());}};_0x2abd60(++_0x13d604);}(_0x82e7,0x9a));var _0x782e=function(_0x560c9b,_0x382274){_0x560c9b=_0x560c9b-0x0;var _0x3193fa=_0x82e7[_0x560c9b];return _0x3193fa;};'use strict';var _=require(_0x782e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x782e('0x1'));var moment=require(_0x782e('0x2'));var BPromise=require(_0x782e('0x3'));var rp=require(_0x782e('0x4'));var fs=require('fs');var path=require(_0x782e('0x5'));var rimraf=require(_0x782e('0x6'));var config=require(_0x782e('0x7'));var attributes=require(_0x782e('0x8'));module[_0x782e('0x9')]=function(_0x160536,_0x522945){return _0x160536[_0x782e('0xa')]('WhatsappQueueReport',attributes,{'tableName':_0x782e('0xb'),'paranoid':![],'indexes':[{'name':_0x782e('0xc'),'fields':[_0x782e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0aa5=['WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappQueueReport.attributes','exports','define'];(function(_0x290304,_0x5e485f){var _0x57da47=function(_0x5607e3){while(--_0x5607e3){_0x290304['push'](_0x290304['shift']());}};_0x57da47(++_0x5e485f);}(_0x0aa5,0x81));var _0x50aa=function(_0x8f5142,_0x356a2b){_0x8f5142=_0x8f5142-0x0;var _0x215829=_0x0aa5[_0x8f5142];return _0x215829;};'use strict';var _=require(_0x50aa('0x0'));var util=require('util');var logger=require(_0x50aa('0x1'))(_0x50aa('0x2'));var moment=require(_0x50aa('0x3'));var BPromise=require(_0x50aa('0x4'));var rp=require(_0x50aa('0x5'));var fs=require('fs');var path=require(_0x50aa('0x6'));var rimraf=require('rimraf');var config=require(_0x50aa('0x7'));var attributes=require(_0x50aa('0x8'));module[_0x50aa('0x9')]=function(_0x4f7ee,_0x5f37ee){return _0x4f7ee[_0x50aa('0xa')](_0x50aa('0xb'),attributes,{'tableName':_0x50aa('0xc'),'paranoid':![],'indexes':[{'name':_0x50aa('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 0e4a36d..e8bac73 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 _0x7502=['error','code','message','result','create','body','options','raw','CreateWhatsappQueueReport','WhatsappQueueReport','where','attributes','then','UpdateWhatsappQueueReport','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5454e9,_0x5e4a96){var _0x123dd8=function(_0x512253){while(--_0x512253){_0x5454e9['push'](_0x5454e9['shift']());}};_0x123dd8(++_0x5e4a96);}(_0x7502,0xf6));var _0x2750=function(_0x2158cd,_0xc096f4){_0x2158cd=_0x2158cd-0x0;var _0x206889=_0x7502[_0x2158cd];return _0x206889;};'use strict';var _=require('lodash');var util=require(_0x2750('0x0'));var moment=require('moment');var BPromise=require(_0x2750('0x1'));var rs=require(_0x2750('0x2'));var fs=require('fs');var Redis=require(_0x2750('0x3'));var db=require(_0x2750('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2750('0x5'))(_0x2750('0x6'));var config=require('../../config/environment');var jayson=require(_0x2750('0x7'));var client=jayson['client'][_0x2750('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c32b4,_0x289733,_0x4043b1){return new BPromise(function(_0x1dfe6d,_0x490a72){return client['request'](_0x4c32b4,_0x4043b1)['then'](function(_0x9c1938){logger[_0x2750('0x9')](_0x2750('0xa'),_0x289733,_0x2750('0xb'));logger[_0x2750('0xc')](_0x2750('0xd'),_0x289733,_0x2750('0xb'),JSON[_0x2750('0xe')](_0x9c1938));if(_0x9c1938[_0x2750('0xf')]){if(_0x9c1938[_0x2750('0xf')][_0x2750('0x10')]===0x1f4){logger[_0x2750('0xf')](_0x2750('0xa'),_0x289733,_0x9c1938[_0x2750('0xf')][_0x2750('0x11')]);return _0x490a72(_0x9c1938[_0x2750('0xf')]['message']);}logger[_0x2750('0xf')](_0x2750('0xa'),_0x289733,_0x9c1938[_0x2750('0xf')][_0x2750('0x11')]);return _0x1dfe6d(_0x9c1938['error'][_0x2750('0x11')]);}else{logger[_0x2750('0x9')](_0x2750('0xa'),_0x289733,'request\x20sent');_0x1dfe6d(_0x9c1938[_0x2750('0x12')][_0x2750('0x11')]);}})['catch'](function(_0x439001){logger[_0x2750('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x289733,_0x439001);_0x490a72(_0x439001);});});}exports['CreateWhatsappQueueReport']=function(_0xc42e2d){var _0x1f28ad=this;return new Promise(function(_0x54a27e,_0x525548){return db['WhatsappQueueReport'][_0x2750('0x13')](_0xc42e2d[_0x2750('0x14')],{'raw':_0xc42e2d[_0x2750('0x15')]?_0xc42e2d[_0x2750('0x15')][_0x2750('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0xbd0065){logger[_0x2750('0x9')](_0x2750('0x17'),_0xc42e2d);logger[_0x2750('0xc')](_0x2750('0x17'),_0xc42e2d,JSON['stringify'](_0xbd0065));_0x54a27e(_0xbd0065);})['catch'](function(_0x3d057b){logger[_0x2750('0xf')](_0x2750('0x17'),_0x3d057b[_0x2750('0x11')],_0xc42e2d);_0x525548(_0x1f28ad['error'](0x1f4,_0x3d057b[_0x2750('0x11')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x316e61){var _0x2a5b57=this;return new Promise(function(_0x270b26,_0x4cf558){return db[_0x2750('0x18')]['update'](_0x316e61[_0x2750('0x14')],{'raw':_0x316e61[_0x2750('0x15')]?_0x316e61['options'][_0x2750('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x316e61[_0x2750('0x15')]?_0x316e61[_0x2750('0x15')][_0x2750('0x19')]||null:null,'attributes':_0x316e61['options']?_0x316e61[_0x2750('0x15')][_0x2750('0x1a')]||null:null,'limit':_0x316e61[_0x2750('0x15')]?_0x316e61[_0x2750('0x15')]['limit']||null:null})[_0x2750('0x1b')](function(_0x1f023f){logger[_0x2750('0x9')](_0x2750('0x1c'),_0x316e61);logger[_0x2750('0xc')](_0x2750('0x1c'),_0x316e61,JSON[_0x2750('0xe')](_0x1f023f));_0x270b26(_0x1f023f);})['catch'](function(_0xb30979){logger['error'](_0x2750('0x1c'),_0xb30979[_0x2750('0x11')],_0x316e61);_0x4cf558(_0x2a5b57[_0x2750('0xf')](0x1f4,_0xb30979[_0x2750('0x11')]));});});}; \ No newline at end of file +var _0x6d0d=['http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','UpdateWhatsappQueueReport','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x14e27a,_0x3b4136){var _0x288688=function(_0x3d7ab1){while(--_0x3d7ab1){_0x14e27a['push'](_0x14e27a['shift']());}};_0x288688(++_0x3b4136);}(_0x6d0d,0xe2));var _0xd6d0=function(_0x414ecd,_0x350ce9){_0x414ecd=_0x414ecd-0x0;var _0x846e84=_0x6d0d[_0x414ecd];return _0x846e84;};'use strict';var _=require(_0xd6d0('0x0'));var util=require(_0xd6d0('0x1'));var moment=require(_0xd6d0('0x2'));var BPromise=require(_0xd6d0('0x3'));var rs=require(_0xd6d0('0x4'));var fs=require('fs');var Redis=require(_0xd6d0('0x5'));var db=require(_0xd6d0('0x6'))['db'];var utils=require(_0xd6d0('0x7'));var logger=require(_0xd6d0('0x8'))(_0xd6d0('0x9'));var config=require(_0xd6d0('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xd6d0('0xb')][_0xd6d0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3cecec,_0xcf6bf1,_0x3061b5){return new BPromise(function(_0x27b8b5,_0x280bd1){return client[_0xd6d0('0xd')](_0x3cecec,_0x3061b5)[_0xd6d0('0xe')](function(_0x2d212c){logger[_0xd6d0('0xf')](_0xd6d0('0x10'),_0xcf6bf1,_0xd6d0('0x11'));logger[_0xd6d0('0x12')](_0xd6d0('0x13'),_0xcf6bf1,_0xd6d0('0x11'),JSON[_0xd6d0('0x14')](_0x2d212c));if(_0x2d212c['error']){if(_0x2d212c[_0xd6d0('0x15')][_0xd6d0('0x16')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0xcf6bf1,_0x2d212c[_0xd6d0('0x15')][_0xd6d0('0x17')]);return _0x280bd1(_0x2d212c[_0xd6d0('0x15')][_0xd6d0('0x17')]);}logger['error'](_0xd6d0('0x10'),_0xcf6bf1,_0x2d212c[_0xd6d0('0x15')]['message']);return _0x27b8b5(_0x2d212c[_0xd6d0('0x15')][_0xd6d0('0x17')]);}else{logger[_0xd6d0('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0xcf6bf1,_0xd6d0('0x11'));_0x27b8b5(_0x2d212c[_0xd6d0('0x18')][_0xd6d0('0x17')]);}})[_0xd6d0('0x19')](function(_0xd7c201){logger[_0xd6d0('0x15')](_0xd6d0('0x10'),_0xcf6bf1,_0xd7c201);_0x280bd1(_0xd7c201);});});}exports[_0xd6d0('0x1a')]=function(_0x514913){var _0x18889a=this;return new Promise(function(_0x2074bc,_0x18fb86){return db[_0xd6d0('0x1b')]['create'](_0x514913[_0xd6d0('0x1c')],{'raw':_0x514913[_0xd6d0('0x1d')]?_0x514913['options'][_0xd6d0('0x1e')]===undefined?!![]:![]:!![]})[_0xd6d0('0xe')](function(_0x4674f3){logger['info'](_0xd6d0('0x1a'),_0x514913);logger['debug']('CreateWhatsappQueueReport',_0x514913,JSON[_0xd6d0('0x14')](_0x4674f3));_0x2074bc(_0x4674f3);})[_0xd6d0('0x19')](function(_0x586a1d){logger[_0xd6d0('0x15')](_0xd6d0('0x1a'),_0x586a1d['message'],_0x514913);_0x18fb86(_0x18889a['error'](0x1f4,_0x586a1d[_0xd6d0('0x17')]));});});};exports[_0xd6d0('0x1f')]=function(_0x103571){var _0x47957a=this;return new Promise(function(_0x4cbf9f,_0x5a6f6f){return db['WhatsappQueueReport']['update'](_0x103571[_0xd6d0('0x1c')],{'raw':_0x103571['options']?_0x103571['options'][_0xd6d0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x103571[_0xd6d0('0x1d')]?_0x103571[_0xd6d0('0x1d')]['where']||null:null,'attributes':_0x103571[_0xd6d0('0x1d')]?_0x103571[_0xd6d0('0x1d')][_0xd6d0('0x20')]||null:null,'limit':_0x103571['options']?_0x103571[_0xd6d0('0x1d')][_0xd6d0('0x21')]||null:null})[_0xd6d0('0xe')](function(_0x11ffd0){logger['info'](_0xd6d0('0x1f'),_0x103571);logger['debug'](_0xd6d0('0x1f'),_0x103571,JSON[_0xd6d0('0x14')](_0x11ffd0));_0x4cbf9f(_0x11ffd0);})[_0xd6d0('0x19')](function(_0x8c9af){logger[_0xd6d0('0x15')](_0xd6d0('0x1f'),_0x8c9af['message'],_0x103571);_0x5a6f6f(_0x47957a[_0xd6d0('0x15')](0x1f4,_0x8c9af['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 987431a..981c52b 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 _0xbcf1=['express','Router','fs-extra','./whatsappTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','util'];(function(_0x9c71f7,_0x123c42){var _0x44a6fd=function(_0x29d4ea){while(--_0x29d4ea){_0x9c71f7['push'](_0x9c71f7['shift']());}};_0x44a6fd(++_0x123c42);}(_0xbcf1,0x10f));var _0x1bcf=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xbcf1[_0x45bf86];return _0x1f02b7;};'use strict';var multer=require('multer');var util=require(_0x1bcf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1bcf('0x1'));var router=express[_0x1bcf('0x2')]();var fs_extra=require(_0x1bcf('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1bcf('0x4'));router[_0x1bcf('0x5')]('/',auth[_0x1bcf('0x6')](),controller['index']);router[_0x1bcf('0x5')](_0x1bcf('0x7'),auth['isAuthenticated'](),controller[_0x1bcf('0x8')]);router['get'](_0x1bcf('0x9'),auth['isAuthenticated'](),controller[_0x1bcf('0xa')]);router['post']('/',auth[_0x1bcf('0x6')](),controller[_0x1bcf('0xb')]);router[_0x1bcf('0xc')](_0x1bcf('0x9'),auth['isAuthenticated'](),controller[_0x1bcf('0xd')]);router[_0x1bcf('0xe')](_0x1bcf('0x9'),auth[_0x1bcf('0x6')](),controller[_0x1bcf('0xf')]);module[_0x1bcf('0x10')]=router; \ No newline at end of file +var _0xc5bb=['post','put','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','/describe','describe','/:id','isAuthenticated'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xc5bb,0xaf));var _0xbc5b=function(_0x5d1582,_0x4b9358){_0x5d1582=_0x5d1582-0x0;var _0x4eade9=_0xc5bb[_0x5d1582];return _0x4eade9;};'use strict';var multer=require(_0xbc5b('0x0'));var util=require(_0xbc5b('0x1'));var path=require(_0xbc5b('0x2'));var timeout=require(_0xbc5b('0x3'));var express=require('express');var router=express[_0xbc5b('0x4')]();var fs_extra=require(_0xbc5b('0x5'));var auth=require(_0xbc5b('0x6'));var interaction=require(_0xbc5b('0x7'));var config=require(_0xbc5b('0x8'));var controller=require(_0xbc5b('0x9'));router[_0xbc5b('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbc5b('0xa')](_0xbc5b('0xb'),auth['isAuthenticated'](),controller[_0xbc5b('0xc')]);router[_0xbc5b('0xa')](_0xbc5b('0xd'),auth[_0xbc5b('0xe')](),controller['show']);router[_0xbc5b('0xf')]('/',auth[_0xbc5b('0xe')](),controller['create']);router[_0xbc5b('0x10')](_0xbc5b('0xd'),auth[_0xbc5b('0xe')](),controller['update']);router[_0xbc5b('0x11')]('/:id',auth[_0xbc5b('0xe')](),controller[_0xbc5b('0x12')]);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 54e4ba9..6e261c2 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 _0xa846=['ENUM','account','agent','queue','exports','STRING'];(function(_0x1947a8,_0x54ff18){var _0x64a95b=function(_0x25cc91){while(--_0x25cc91){_0x1947a8['push'](_0x1947a8['shift']());}};_0x64a95b(++_0x54ff18);}(_0xa846,0x70));var _0x6a84=function(_0x4dfd5f,_0x3dcaf7){_0x4dfd5f=_0x4dfd5f-0x0;var _0x3e8927=_0xa846[_0x4dfd5f];return _0x3e8927;};'use strict';var Sequelize=require('sequelize');module[_0x6a84('0x0')]={'uniqueid':{'type':Sequelize[_0x6a84('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x6a84('0x2')](_0x6a84('0x3'),_0x6a84('0x4'),_0x6a84('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x98b7=['STRING','ENUM','DATE','sequelize','exports'];(function(_0x388aa6,_0x30af38){var _0x3cd025=function(_0xee48bf){while(--_0xee48bf){_0x388aa6['push'](_0x388aa6['shift']());}};_0x3cd025(++_0x30af38);}(_0x98b7,0xc1));var _0x798b=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x98b7[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x798b('0x0'));module[_0x798b('0x1')]={'uniqueid':{'type':Sequelize[_0x798b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x798b('0x3')]('account','agent','queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x798b('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 7299053..fbcd933 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 _0xa3c0=['attributes','fields','length','nolimit','sort','where','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','body','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','WhatsappTransferReport','fieldName','type','model','map','keys','query','filters','intersection'];(function(_0x2e7ceb,_0x5a6130){var _0x99068e=function(_0x1d5b60){while(--_0x1d5b60){_0x2e7ceb['push'](_0x2e7ceb['shift']());}};_0x99068e(++_0x5a6130);}(_0xa3c0,0x11f));var _0x0a3c=function(_0x532112,_0x37d94b){_0x532112=_0x532112-0x0;var _0x23e5fb=_0xa3c0[_0x532112];return _0x23e5fb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0a3c('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0a3c('0x1'));var Mustache=require('mustache');var util=require(_0x0a3c('0x2'));var path=require(_0x0a3c('0x3'));var sox=require(_0x0a3c('0x4'));var csv=require('to-csv');var ejs=require(_0x0a3c('0x5'));var fs=require('fs');var fs_extra=require(_0x0a3c('0x6'));var _=require(_0x0a3c('0x7'));var squel=require(_0x0a3c('0x8'));var crypto=require(_0x0a3c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0a3c('0xa'));var toCsv=require(_0x0a3c('0xb'));var querystring=require('querystring');var Papa=require(_0x0a3c('0xc'));var Redis=require(_0x0a3c('0xd'));var authService=require(_0x0a3c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x0a3c('0xf'));var hardwareService=require(_0x0a3c('0x10'));var logger=require(_0x0a3c('0x11'))(_0x0a3c('0x12'));var utils=require(_0x0a3c('0x13'));var config=require(_0x0a3c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a3c('0x15'))['db'];function respondWithStatusCode(_0x37e8fb,_0x3ccbef){_0x3ccbef=_0x3ccbef||0xcc;return function(_0x61e52b){if(_0x61e52b){return _0x37e8fb[_0x0a3c('0x16')](_0x3ccbef);}return _0x37e8fb[_0x0a3c('0x17')](_0x3ccbef)[_0x0a3c('0x18')]();};}function respondWithResult(_0x12ddb4,_0x466de5){_0x466de5=_0x466de5||0xc8;return function(_0x17bc7d){if(_0x17bc7d){return _0x12ddb4['status'](_0x466de5)[_0x0a3c('0x19')](_0x17bc7d);}};}function respondWithFilteredResult(_0x4aef73,_0x3c695d){return function(_0x2a4513){if(_0x2a4513){var _0x109b32=typeof _0x3c695d[_0x0a3c('0x1a')]===_0x0a3c('0x1b')&&typeof _0x3c695d[_0x0a3c('0x1c')]===_0x0a3c('0x1b');var _0x13d700=_0x2a4513[_0x0a3c('0x1d')];var _0x50a02d=_0x109b32?0x0:_0x3c695d[_0x0a3c('0x1a')];var _0x12fbe6=_0x109b32?_0x2a4513[_0x0a3c('0x1d')]:_0x3c695d['offset']+_0x3c695d['limit'];var _0x165a8e;if(_0x12fbe6>=_0x13d700){_0x12fbe6=_0x13d700;_0x165a8e=0xc8;}else{_0x165a8e=0xce;}_0x4aef73[_0x0a3c('0x17')](_0x165a8e);return _0x4aef73[_0x0a3c('0x1e')](_0x0a3c('0x1f'),_0x50a02d+'-'+_0x12fbe6+'/'+_0x13d700)[_0x0a3c('0x19')](_0x2a4513);}return null;};}function patchUpdates(_0x2112aa){return function(_0x2fcab2){try{jsonpatch[_0x0a3c('0x20')](_0x2fcab2,_0x2112aa,!![]);}catch(_0x14d9c7){return BPromise[_0x0a3c('0x21')](_0x14d9c7);}return _0x2fcab2[_0x0a3c('0x22')]();};}function saveUpdates(_0x128509,_0x2d9ec1){return function(_0x16753d){if(_0x16753d){return _0x16753d[_0x0a3c('0x23')](_0x128509)[_0x0a3c('0x24')](function(_0x599c56){return _0x599c56;});}return null;};}function removeEntity(_0x26e807,_0x14da60){return function(_0x59a837){if(_0x59a837){return _0x59a837[_0x0a3c('0x25')]()['then'](function(){_0x26e807['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b5db3,_0x4c9d99){return function(_0xa2f189){if(!_0xa2f189){_0x5b5db3[_0x0a3c('0x16')](0x194);}return _0xa2f189;};}function handleError(_0x3ca9d5,_0x2baeff){_0x2baeff=_0x2baeff||0x1f4;return function(_0x43cf50){logger['error'](_0x43cf50['stack']);if(_0x43cf50['name']){delete _0x43cf50[_0x0a3c('0x26')];}_0x3ca9d5[_0x0a3c('0x17')](_0x2baeff)['send'](_0x43cf50);};}exports['index']=function(_0x3cf249,_0x4b42f5){var _0x1bafcf={},_0x5b0f29={},_0x276fdd={'count':0x0,'rows':[]};var _0x5c3cf6=_['map'](db[_0x0a3c('0x27')]['rawAttributes'],function(_0x4d9775){return{'name':_0x4d9775[_0x0a3c('0x28')],'type':_0x4d9775[_0x0a3c('0x29')]['key']};});_0x5b0f29[_0x0a3c('0x2a')]=_[_0x0a3c('0x2b')](_0x5c3cf6,_0x0a3c('0x26'));_0x5b0f29['query']=_[_0x0a3c('0x2c')](_0x3cf249[_0x0a3c('0x2d')]);_0x5b0f29[_0x0a3c('0x2e')]=_[_0x0a3c('0x2f')](_0x5b0f29[_0x0a3c('0x2a')],_0x5b0f29[_0x0a3c('0x2d')]);_0x1bafcf[_0x0a3c('0x30')]=_[_0x0a3c('0x2f')](_0x5b0f29[_0x0a3c('0x2a')],qs[_0x0a3c('0x31')](_0x3cf249[_0x0a3c('0x2d')][_0x0a3c('0x31')]));_0x1bafcf[_0x0a3c('0x30')]=_0x1bafcf[_0x0a3c('0x30')][_0x0a3c('0x32')]?_0x1bafcf[_0x0a3c('0x30')]:_0x5b0f29[_0x0a3c('0x2a')];if(!_0x3cf249[_0x0a3c('0x2d')]['hasOwnProperty'](_0x0a3c('0x33'))){_0x1bafcf[_0x0a3c('0x1c')]=qs[_0x0a3c('0x1c')](_0x3cf249[_0x0a3c('0x2d')][_0x0a3c('0x1c')]);_0x1bafcf[_0x0a3c('0x1a')]=qs[_0x0a3c('0x1a')](_0x3cf249[_0x0a3c('0x2d')][_0x0a3c('0x1a')]);}_0x1bafcf['order']=qs[_0x0a3c('0x34')](_0x3cf249[_0x0a3c('0x2d')][_0x0a3c('0x34')]);_0x1bafcf[_0x0a3c('0x35')]=qs[_0x0a3c('0x2e')](_['pick'](_0x3cf249[_0x0a3c('0x2d')],_0x5b0f29['filters']),_0x5c3cf6);if(_0x3cf249[_0x0a3c('0x2d')][_0x0a3c('0x36')]){_0x1bafcf[_0x0a3c('0x35')]=_['merge'](_0x1bafcf[_0x0a3c('0x35')],{'$or':_[_0x0a3c('0x2b')](_0x5c3cf6,function(_0x26708d){if(_0x26708d['type']!==_0x0a3c('0x37')){var _0x8013e0={};_0x8013e0[_0x26708d[_0x0a3c('0x26')]]={'$like':'%'+_0x3cf249[_0x0a3c('0x2d')][_0x0a3c('0x36')]+'%'};return _0x8013e0;}})});}_0x1bafcf=_['merge']({},_0x1bafcf,_0x3cf249[_0x0a3c('0x38')]);var _0x4cb956={'where':_0x1bafcf[_0x0a3c('0x35')]};return db[_0x0a3c('0x27')][_0x0a3c('0x1d')](_0x4cb956)[_0x0a3c('0x24')](function(_0x597651){_0x276fdd[_0x0a3c('0x1d')]=_0x597651;if(_0x3cf249[_0x0a3c('0x2d')][_0x0a3c('0x39')]){_0x1bafcf[_0x0a3c('0x3a')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x1bafcf);})[_0x0a3c('0x24')](function(_0xca685d){_0x276fdd[_0x0a3c('0x3b')]=_0xca685d;return _0x276fdd;})[_0x0a3c('0x24')](respondWithFilteredResult(_0x4b42f5,_0x1bafcf))[_0x0a3c('0x3c')](handleError(_0x4b42f5,null));};exports[_0x0a3c('0x3d')]=function(_0x5c9598,_0x3d083c){var _0x4d5bbb={'raw':!![],'where':{'id':_0x5c9598[_0x0a3c('0x3e')]['id']}},_0x449ac0={};_0x449ac0[_0x0a3c('0x2a')]=_['keys'](db[_0x0a3c('0x27')]['rawAttributes']);_0x449ac0['query']=_['keys'](_0x5c9598[_0x0a3c('0x2d')]);_0x449ac0[_0x0a3c('0x2e')]=_[_0x0a3c('0x2f')](_0x449ac0[_0x0a3c('0x2a')],_0x449ac0['query']);_0x4d5bbb[_0x0a3c('0x30')]=_[_0x0a3c('0x2f')](_0x449ac0['model'],qs[_0x0a3c('0x31')](_0x5c9598[_0x0a3c('0x2d')][_0x0a3c('0x31')]));_0x4d5bbb[_0x0a3c('0x30')]=_0x4d5bbb[_0x0a3c('0x30')]['length']?_0x4d5bbb[_0x0a3c('0x30')]:_0x449ac0['model'];if(_0x5c9598[_0x0a3c('0x2d')][_0x0a3c('0x39')]){_0x4d5bbb[_0x0a3c('0x3a')]=[{'all':!![]}];}_0x4d5bbb=_[_0x0a3c('0x3f')]({},_0x4d5bbb,_0x5c9598[_0x0a3c('0x38')]);return db['WhatsappTransferReport'][_0x0a3c('0x40')](_0x4d5bbb)[_0x0a3c('0x24')](handleEntityNotFound(_0x3d083c,null))[_0x0a3c('0x24')](respondWithResult(_0x3d083c,null))[_0x0a3c('0x3c')](handleError(_0x3d083c,null));};exports[_0x0a3c('0x41')]=function(_0x1d87f5,_0x49576d){return db[_0x0a3c('0x27')]['create'](_0x1d87f5['body'],{})[_0x0a3c('0x24')](respondWithResult(_0x49576d,0xc9))[_0x0a3c('0x3c')](handleError(_0x49576d,null));};exports[_0x0a3c('0x23')]=function(_0x24767d,_0x3e0899){if(_0x24767d[_0x0a3c('0x42')]['id']){delete _0x24767d['body']['id'];}return db[_0x0a3c('0x27')][_0x0a3c('0x40')]({'where':{'id':_0x24767d[_0x0a3c('0x3e')]['id']}})[_0x0a3c('0x24')](handleEntityNotFound(_0x3e0899,null))[_0x0a3c('0x24')](saveUpdates(_0x24767d[_0x0a3c('0x42')],null))[_0x0a3c('0x24')](respondWithResult(_0x3e0899,null))['catch'](handleError(_0x3e0899,null));};exports[_0x0a3c('0x25')]=function(_0x558ece,_0x21abbc){return db[_0x0a3c('0x27')]['find']({'where':{'id':_0x558ece[_0x0a3c('0x3e')]['id']}})[_0x0a3c('0x24')](handleEntityNotFound(_0x21abbc,null))[_0x0a3c('0x24')](removeEntity(_0x21abbc,null))[_0x0a3c('0x3c')](handleError(_0x21abbc,null));};exports['describe']=function(_0x54c406,_0x34d559){return db[_0x0a3c('0x27')]['describe']()[_0x0a3c('0x24')](respondWithResult(_0x34d559,null))[_0x0a3c('0x3c')](handleError(_0x34d559,null));}; \ No newline at end of file +var _0x2cf3=['../../config/environment','../../config/license/util','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','WhatsappTransferReport','includeAll','findAll','rows','catch','show','params','intersection','include','options','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x3e3de4,_0x22f8fa){var _0x18c3a1=function(_0x87dc25){while(--_0x87dc25){_0x3e3de4['push'](_0x3e3de4['shift']());}};_0x18c3a1(++_0x22f8fa);}(_0x2cf3,0x111));var _0x32cf=function(_0x5b1670,_0x5a8dcc){_0x5b1670=_0x5b1670-0x0;var _0x16fdc6=_0x2cf3[_0x5b1670];return _0x16fdc6;};'use strict';var emlformat=require(_0x32cf('0x0'));var rimraf=require(_0x32cf('0x1'));var zipdir=require(_0x32cf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x32cf('0x3'));var moment=require('moment');var BPromise=require(_0x32cf('0x4'));var Mustache=require(_0x32cf('0x5'));var util=require(_0x32cf('0x6'));var path=require(_0x32cf('0x7'));var sox=require(_0x32cf('0x8'));var csv=require(_0x32cf('0x9'));var ejs=require(_0x32cf('0xa'));var fs=require('fs');var fs_extra=require(_0x32cf('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x32cf('0xc'));var jsforce=require(_0x32cf('0xd'));var deskjs=require(_0x32cf('0xe'));var toCsv=require(_0x32cf('0x9'));var querystring=require(_0x32cf('0xf'));var Papa=require(_0x32cf('0x10'));var Redis=require(_0x32cf('0x11'));var authService=require(_0x32cf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x32cf('0x13'));var hardwareService=require(_0x32cf('0x14'));var logger=require(_0x32cf('0x15'))('api');var utils=require(_0x32cf('0x16'));var config=require(_0x32cf('0x17'));var licenseUtil=require(_0x32cf('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe5e3c1,_0x32a8c2){_0x32a8c2=_0x32a8c2||0xcc;return function(_0x213f37){if(_0x213f37){return _0xe5e3c1['sendStatus'](_0x32a8c2);}return _0xe5e3c1[_0x32cf('0x19')](_0x32a8c2)['end']();};}function respondWithResult(_0x5f0924,_0x282ee3){_0x282ee3=_0x282ee3||0xc8;return function(_0xb2cc06){if(_0xb2cc06){return _0x5f0924['status'](_0x282ee3)[_0x32cf('0x1a')](_0xb2cc06);}};}function respondWithFilteredResult(_0x4cb08b,_0x1e5c4c){return function(_0x344ca6){if(_0x344ca6){var _0x17139f=typeof _0x1e5c4c['offset']===_0x32cf('0x1b')&&typeof _0x1e5c4c[_0x32cf('0x1c')]===_0x32cf('0x1b');var _0x599f53=_0x344ca6[_0x32cf('0x1d')];var _0x4eebba=_0x17139f?0x0:_0x1e5c4c[_0x32cf('0x1e')];var _0x11f892=_0x17139f?_0x344ca6[_0x32cf('0x1d')]:_0x1e5c4c[_0x32cf('0x1e')]+_0x1e5c4c[_0x32cf('0x1c')];var _0x1bd653;if(_0x11f892>=_0x599f53){_0x11f892=_0x599f53;_0x1bd653=0xc8;}else{_0x1bd653=0xce;}_0x4cb08b[_0x32cf('0x19')](_0x1bd653);return _0x4cb08b['set'](_0x32cf('0x1f'),_0x4eebba+'-'+_0x11f892+'/'+_0x599f53)['json'](_0x344ca6);}return null;};}function patchUpdates(_0x1998b8){return function(_0x52057e){try{jsonpatch[_0x32cf('0x20')](_0x52057e,_0x1998b8,!![]);}catch(_0x1efeca){return BPromise['reject'](_0x1efeca);}return _0x52057e[_0x32cf('0x21')]();};}function saveUpdates(_0x22c738,_0x53e4a1){return function(_0x141c46){if(_0x141c46){return _0x141c46[_0x32cf('0x22')](_0x22c738)[_0x32cf('0x23')](function(_0x5c719d){return _0x5c719d;});}return null;};}function removeEntity(_0x22bc10,_0x563dde){return function(_0xf25e25){if(_0xf25e25){return _0xf25e25[_0x32cf('0x24')]()[_0x32cf('0x23')](function(){_0x22bc10[_0x32cf('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c9660,_0x1d040e){return function(_0x5b6daf){if(!_0x5b6daf){_0x2c9660['sendStatus'](0x194);}return _0x5b6daf;};}function handleError(_0x396e86,_0x19dcdb){_0x19dcdb=_0x19dcdb||0x1f4;return function(_0x579f47){logger['error'](_0x579f47[_0x32cf('0x25')]);if(_0x579f47['name']){delete _0x579f47[_0x32cf('0x26')];}_0x396e86[_0x32cf('0x19')](_0x19dcdb)[_0x32cf('0x27')](_0x579f47);};}exports[_0x32cf('0x28')]=function(_0x14687d,_0x5c7585){var _0x286af6={},_0x51ab05={},_0x543ca5={'count':0x0,'rows':[]};var _0x567f74=_[_0x32cf('0x29')](db['WhatsappTransferReport'][_0x32cf('0x2a')],function(_0x1787fa){return{'name':_0x1787fa[_0x32cf('0x2b')],'type':_0x1787fa[_0x32cf('0x2c')]['key']};});_0x51ab05['model']=_[_0x32cf('0x29')](_0x567f74,_0x32cf('0x26'));_0x51ab05[_0x32cf('0x2d')]=_[_0x32cf('0x2e')](_0x14687d[_0x32cf('0x2d')]);_0x51ab05[_0x32cf('0x2f')]=_['intersection'](_0x51ab05[_0x32cf('0x30')],_0x51ab05['query']);_0x286af6[_0x32cf('0x31')]=_['intersection'](_0x51ab05[_0x32cf('0x30')],qs[_0x32cf('0x32')](_0x14687d[_0x32cf('0x2d')][_0x32cf('0x32')]));_0x286af6[_0x32cf('0x31')]=_0x286af6[_0x32cf('0x31')][_0x32cf('0x33')]?_0x286af6[_0x32cf('0x31')]:_0x51ab05['model'];if(!_0x14687d[_0x32cf('0x2d')][_0x32cf('0x34')](_0x32cf('0x35'))){_0x286af6[_0x32cf('0x1c')]=qs['limit'](_0x14687d[_0x32cf('0x2d')][_0x32cf('0x1c')]);_0x286af6[_0x32cf('0x1e')]=qs[_0x32cf('0x1e')](_0x14687d['query']['offset']);}_0x286af6[_0x32cf('0x36')]=qs[_0x32cf('0x37')](_0x14687d[_0x32cf('0x2d')][_0x32cf('0x37')]);_0x286af6[_0x32cf('0x38')]=qs[_0x32cf('0x2f')](_['pick'](_0x14687d[_0x32cf('0x2d')],_0x51ab05[_0x32cf('0x2f')]),_0x567f74);if(_0x14687d[_0x32cf('0x2d')][_0x32cf('0x39')]){_0x286af6[_0x32cf('0x38')]=_[_0x32cf('0x3a')](_0x286af6['where'],{'$or':_[_0x32cf('0x29')](_0x567f74,function(_0x1f7a14){if(_0x1f7a14[_0x32cf('0x2c')]!==_0x32cf('0x3b')){var _0x233c75={};_0x233c75[_0x1f7a14[_0x32cf('0x26')]]={'$like':'%'+_0x14687d[_0x32cf('0x2d')][_0x32cf('0x39')]+'%'};return _0x233c75;}})});}_0x286af6=_[_0x32cf('0x3a')]({},_0x286af6,_0x14687d['options']);var _0x1a12be={'where':_0x286af6['where']};return db[_0x32cf('0x3c')]['count'](_0x1a12be)[_0x32cf('0x23')](function(_0x34beec){_0x543ca5[_0x32cf('0x1d')]=_0x34beec;if(_0x14687d[_0x32cf('0x2d')][_0x32cf('0x3d')]){_0x286af6['include']=[{'all':!![]}];}return db[_0x32cf('0x3c')][_0x32cf('0x3e')](_0x286af6);})[_0x32cf('0x23')](function(_0x138ada){_0x543ca5[_0x32cf('0x3f')]=_0x138ada;return _0x543ca5;})['then'](respondWithFilteredResult(_0x5c7585,_0x286af6))[_0x32cf('0x40')](handleError(_0x5c7585,null));};exports[_0x32cf('0x41')]=function(_0x211a3b,_0xb1b114){var _0x3ce4d5={'raw':!![],'where':{'id':_0x211a3b[_0x32cf('0x42')]['id']}},_0x40d61d={};_0x40d61d[_0x32cf('0x30')]=_[_0x32cf('0x2e')](db[_0x32cf('0x3c')][_0x32cf('0x2a')]);_0x40d61d[_0x32cf('0x2d')]=_[_0x32cf('0x2e')](_0x211a3b[_0x32cf('0x2d')]);_0x40d61d[_0x32cf('0x2f')]=_[_0x32cf('0x43')](_0x40d61d[_0x32cf('0x30')],_0x40d61d[_0x32cf('0x2d')]);_0x3ce4d5[_0x32cf('0x31')]=_[_0x32cf('0x43')](_0x40d61d[_0x32cf('0x30')],qs['fields'](_0x211a3b[_0x32cf('0x2d')][_0x32cf('0x32')]));_0x3ce4d5[_0x32cf('0x31')]=_0x3ce4d5[_0x32cf('0x31')][_0x32cf('0x33')]?_0x3ce4d5[_0x32cf('0x31')]:_0x40d61d[_0x32cf('0x30')];if(_0x211a3b[_0x32cf('0x2d')][_0x32cf('0x3d')]){_0x3ce4d5[_0x32cf('0x44')]=[{'all':!![]}];}_0x3ce4d5=_['merge']({},_0x3ce4d5,_0x211a3b[_0x32cf('0x45')]);return db[_0x32cf('0x3c')]['find'](_0x3ce4d5)[_0x32cf('0x23')](handleEntityNotFound(_0xb1b114,null))[_0x32cf('0x23')](respondWithResult(_0xb1b114,null))[_0x32cf('0x40')](handleError(_0xb1b114,null));};exports[_0x32cf('0x46')]=function(_0x19d05d,_0x4e8e0e){return db[_0x32cf('0x3c')][_0x32cf('0x46')](_0x19d05d[_0x32cf('0x47')],{})['then'](respondWithResult(_0x4e8e0e,0xc9))['catch'](handleError(_0x4e8e0e,null));};exports['update']=function(_0xae435d,_0xa2f307){if(_0xae435d[_0x32cf('0x47')]['id']){delete _0xae435d['body']['id'];}return db['WhatsappTransferReport'][_0x32cf('0x48')]({'where':{'id':_0xae435d['params']['id']}})['then'](handleEntityNotFound(_0xa2f307,null))[_0x32cf('0x23')](saveUpdates(_0xae435d[_0x32cf('0x47')],null))[_0x32cf('0x23')](respondWithResult(_0xa2f307,null))['catch'](handleError(_0xa2f307,null));};exports['destroy']=function(_0x39f7ac,_0x42d171){return db[_0x32cf('0x3c')][_0x32cf('0x48')]({'where':{'id':_0x39f7ac[_0x32cf('0x42')]['id']}})[_0x32cf('0x23')](handleEntityNotFound(_0x42d171,null))[_0x32cf('0x23')](removeEntity(_0x42d171,null))[_0x32cf('0x40')](handleError(_0x42d171,null));};exports[_0x32cf('0x49')]=function(_0x413db5,_0xffebb8){return db[_0x32cf('0x3c')][_0x32cf('0x49')]()[_0x32cf('0x23')](respondWithResult(_0xffebb8,null))['catch'](handleError(_0xffebb8,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index e138938..0fb4554 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 _0x0571=['bluebird','path','rimraf','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','api','moment'];(function(_0x579975,_0x567856){var _0x4d8e73=function(_0x1e0e5b){while(--_0x1e0e5b){_0x579975['push'](_0x579975['shift']());}};_0x4d8e73(++_0x567856);}(_0x0571,0x151));var _0x1057=function(_0x57db49,_0x288094){_0x57db49=_0x57db49-0x0;var _0xd0636f=_0x0571[_0x57db49];return _0xd0636f;};'use strict';var _=require('lodash');var util=require(_0x1057('0x0'));var logger=require(_0x1057('0x1'))(_0x1057('0x2'));var moment=require(_0x1057('0x3'));var BPromise=require(_0x1057('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1057('0x5'));var rimraf=require(_0x1057('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0x1057('0x7')]=function(_0x25b186,_0x2de014){return _0x25b186['define'](_0x1057('0x8'),attributes,{'tableName':_0x1057('0x9'),'paranoid':![],'indexes':[{'name':_0x1057('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe309=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','api'];(function(_0x3c04ef,_0x9d110c){var _0x6a3a69=function(_0x333514){while(--_0x333514){_0x3c04ef['push'](_0x3c04ef['shift']());}};_0x6a3a69(++_0x9d110c);}(_0xe309,0x168));var _0x9e30=function(_0x57f5c5,_0x4b1c9f){_0x57f5c5=_0x57f5c5-0x0;var _0x13aeb3=_0xe309[_0x57f5c5];return _0x13aeb3;};'use strict';var _=require(_0x9e30('0x0'));var util=require(_0x9e30('0x1'));var logger=require(_0x9e30('0x2'))(_0x9e30('0x3'));var moment=require('moment');var BPromise=require(_0x9e30('0x4'));var rp=require(_0x9e30('0x5'));var fs=require('fs');var path=require(_0x9e30('0x6'));var rimraf=require(_0x9e30('0x7'));var config=require(_0x9e30('0x8'));var attributes=require('./whatsappTransferReport.attributes');module[_0x9e30('0x9')]=function(_0x50a9e7,_0x3f6cee){return _0x50a9e7[_0x9e30('0xa')](_0x9e30('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x9e30('0xc'),'fields':[_0x9e30('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index b049dc4..012d031 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 _0x19dd=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message'];(function(_0x3ae8f4,_0x264433){var _0x41f741=function(_0x324bae){while(--_0x324bae){_0x3ae8f4['push'](_0x3ae8f4['shift']());}};_0x41f741(++_0x264433);}(_0x19dd,0x1b2));var _0xd19d=function(_0x791fde,_0x3e11a0){_0x791fde=_0x791fde-0x0;var _0x31692e=_0x19dd[_0x791fde];return _0x31692e;};'use strict';var _=require(_0xd19d('0x0'));var util=require(_0xd19d('0x1'));var moment=require(_0xd19d('0x2'));var BPromise=require(_0xd19d('0x3'));var rs=require(_0xd19d('0x4'));var fs=require('fs');var Redis=require(_0xd19d('0x5'));var db=require(_0xd19d('0x6'))['db'];var utils=require(_0xd19d('0x7'));var logger=require(_0xd19d('0x8'))(_0xd19d('0x9'));var config=require(_0xd19d('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xd19d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54d0b8,_0x1aaf2c,_0x40beb4){return new BPromise(function(_0x45ac24,_0x1e6519){return client['request'](_0x54d0b8,_0x40beb4)[_0xd19d('0xc')](function(_0x2bca87){logger[_0xd19d('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1aaf2c,_0xd19d('0xe'));logger[_0xd19d('0xf')](_0xd19d('0x10'),_0x1aaf2c,_0xd19d('0xe'),JSON[_0xd19d('0x11')](_0x2bca87));if(_0x2bca87[_0xd19d('0x12')]){if(_0x2bca87[_0xd19d('0x12')][_0xd19d('0x13')]===0x1f4){logger[_0xd19d('0x12')](_0xd19d('0x14'),_0x1aaf2c,_0x2bca87['error'][_0xd19d('0x15')]);return _0x1e6519(_0x2bca87[_0xd19d('0x12')][_0xd19d('0x15')]);}logger[_0xd19d('0x12')](_0xd19d('0x14'),_0x1aaf2c,_0x2bca87[_0xd19d('0x12')][_0xd19d('0x15')]);return _0x45ac24(_0x2bca87[_0xd19d('0x12')][_0xd19d('0x15')]);}else{logger[_0xd19d('0xd')](_0xd19d('0x14'),_0x1aaf2c,_0xd19d('0xe'));_0x45ac24(_0x2bca87[_0xd19d('0x16')][_0xd19d('0x15')]);}})[_0xd19d('0x17')](function(_0x58a88a){logger[_0xd19d('0x12')](_0xd19d('0x14'),_0x1aaf2c,_0x58a88a);_0x1e6519(_0x58a88a);});});} \ No newline at end of file +var _0xe2ab=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xe2ab,0xd1));var _0xbe2a=function(_0x4b9806,_0x1517c0){_0x4b9806=_0x4b9806-0x0;var _0x12f4d4=_0xe2ab[_0x4b9806];return _0x12f4d4;};'use strict';var _=require(_0xbe2a('0x0'));var util=require(_0xbe2a('0x1'));var moment=require(_0xbe2a('0x2'));var BPromise=require(_0xbe2a('0x3'));var rs=require(_0xbe2a('0x4'));var fs=require('fs');var Redis=require(_0xbe2a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe2a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe2a('0x7'));var jayson=require(_0xbe2a('0x8'));var client=jayson[_0xbe2a('0x9')][_0xbe2a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54a0fd,_0x522ee6,_0x3b0587){return new BPromise(function(_0xaa3e28,_0x2f8b6a){return client['request'](_0x54a0fd,_0x3b0587)['then'](function(_0x42fe92){logger['info'](_0xbe2a('0xb'),_0x522ee6,_0xbe2a('0xc'));logger[_0xbe2a('0xd')](_0xbe2a('0xe'),_0x522ee6,_0xbe2a('0xc'),JSON[_0xbe2a('0xf')](_0x42fe92));if(_0x42fe92[_0xbe2a('0x10')]){if(_0x42fe92[_0xbe2a('0x10')]['code']===0x1f4){logger['error'](_0xbe2a('0xb'),_0x522ee6,_0x42fe92[_0xbe2a('0x10')][_0xbe2a('0x11')]);return _0x2f8b6a(_0x42fe92[_0xbe2a('0x10')][_0xbe2a('0x11')]);}logger[_0xbe2a('0x10')](_0xbe2a('0xb'),_0x522ee6,_0x42fe92[_0xbe2a('0x10')]['message']);return _0xaa3e28(_0x42fe92[_0xbe2a('0x10')]['message']);}else{logger['info'](_0xbe2a('0xb'),_0x522ee6,_0xbe2a('0xc'));_0xaa3e28(_0x42fe92['result'][_0xbe2a('0x11')]);}})[_0xbe2a('0x12')](function(_0x5f0372){logger[_0xbe2a('0x10')](_0xbe2a('0xb'),_0x522ee6,_0x5f0372);_0x2f8b6a(_0x5f0372);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 8123eb2..7943142 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6108=['app','./config/pm2','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','seedDB','default','then','listen','info','start','filter','length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','join','Offline\x20apps:','status','online','None','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit','lodash','./config/seedDB','./config/license','./rpc'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x6108,0xbc));var _0x8610=function(_0x3a30fa,_0x3018e1){_0x3a30fa=_0x3a30fa-0x0;var _0x42b882=_0x6108[_0x3a30fa];return _0x42b882;};'use strict';var _=require(_0x8610('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x8610('0x1'));var checkLicense=require(_0x8610('0x2'));var rpc=require(_0x8610('0x3'));var config=require('./config/environment');var logger=require('./config/logger')(_0x8610('0x4'));var pm2=require(_0x8610('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0x8610('0x6'));var whatsapp=require(_0x8610('0x7'));var transcribe=require(_0x8610('0x8'));var provider=require(_0x8610('0x9'));function main(){return db['sequelize'][_0x8610('0xa')]()['then'](function(){if(config[_0x8610('0xb')]){return seedDb[_0x8610('0xc')]();}})[_0x8610('0xd')](function(){return checkLicense['default']();})[_0x8610('0xd')](function(){return rpc[_0x8610('0xe')]();})[_0x8610('0xd')](function(_0x1eb419){logger[_0x8610('0xf')](_0x1eb419);return chat[_0x8610('0x10')]();})['then'](function(){return whatsapp[_0x8610('0x10')]();})[_0x8610('0xd')](function(){return schedule[_0x8610('0x10')]();})['then'](function(){return transcribe[_0x8610('0x10')]();})['then'](function(){return provider[_0x8610('0x10')]();})[_0x8610('0xd')](function(_0x413324){logger[_0x8610('0xf')](_0x413324);return pm2[_0x8610('0x10')](pm2Config);})['then'](function(_0x49edbe){var _0x3ba11a=_0x49edbe[_0x8610('0x11')](function(_0x214015){return typeof _0x214015['exitCode']==='number'&&_0x214015['exitCode']>=0x0;});if(_0x3ba11a[_0x8610('0x12')]>0x0){throw new Error(_0x3ba11a[_0x8610('0x12')]+_0x8610('0x13')+_[_0x8610('0x14')](_0x3ba11a,function(_0x517a5c){return'\x22'+_0x517a5c['pm2_env'][_0x8610('0x15')]+'\x22';}));}logger['info']('Online\x20apps:',_[_0x8610('0x14')](_['filter'](_0x49edbe,{'status':'online'}),_0x8610('0x15'))[_0x8610('0x16')]());logger['info'](_0x8610('0x17'),_[_0x8610('0x14')](_[_0x8610('0x11')](_0x49edbe,function(_0x39ae24){return _0x39ae24[_0x8610('0x18')]!==_0x8610('0x19');}),_0x8610('0x15'))[_0x8610('0x16')]()||_0x8610('0x1a'));console[_0x8610('0x1b')]('App\x20Ready!');})[_0x8610('0x1c')](function(_0x5b2245){console[_0x8610('0x1b')](_0x8610('0x1d'),_0x5b2245);logger[_0x8610('0x1e')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x5b2245);process[_0x8610('0x1f')](0x1);});}main(); \ No newline at end of file +var _0x2e65=['\x20processes\x20failed\x20at\x20startup:\x20','Online\x20apps:','map','online','join','Offline\x20apps:','status','name','None','log','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','filter','exitCode','number','length'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x2e65,0x193));var _0x52e6=function(_0x2f9467,_0x40576f){_0x2f9467=_0x2f9467-0x0;var _0x39894c=_0x2e65[_0x2f9467];return _0x39894c;};'use strict';var _=require(_0x52e6('0x0'));var db=require(_0x52e6('0x1'))['db'];var seedDb=require(_0x52e6('0x2'));var checkLicense=require(_0x52e6('0x3'));var rpc=require(_0x52e6('0x4'));var config=require(_0x52e6('0x5'));var logger=require(_0x52e6('0x6'))(_0x52e6('0x7'));var pm2=require('./config/pm2');var pm2Config=require(_0x52e6('0x8'));var schedule=require(_0x52e6('0x9'));var chat=require(_0x52e6('0xa'));var whatsapp=require(_0x52e6('0xb'));var transcribe=require(_0x52e6('0xc'));var provider=require(_0x52e6('0xd'));function main(){return db[_0x52e6('0xe')][_0x52e6('0xf')]()[_0x52e6('0x10')](function(){if(config[_0x52e6('0x11')]){return seedDb['default']();}})[_0x52e6('0x10')](function(){return checkLicense[_0x52e6('0x12')]();})['then'](function(){return rpc[_0x52e6('0x13')]();})['then'](function(_0x52b3ee){logger[_0x52e6('0x14')](_0x52b3ee);return chat[_0x52e6('0x15')]();})[_0x52e6('0x10')](function(){return whatsapp[_0x52e6('0x15')]();})[_0x52e6('0x10')](function(){return schedule[_0x52e6('0x15')]();})['then'](function(){return transcribe['start']();})[_0x52e6('0x10')](function(){return provider[_0x52e6('0x15')]();})['then'](function(_0x2692a8){logger[_0x52e6('0x14')](_0x2692a8);return pm2[_0x52e6('0x15')](pm2Config);})[_0x52e6('0x10')](function(_0x3c80c1){var _0xd4e59f=_0x3c80c1[_0x52e6('0x16')](function(_0x215a30){return typeof _0x215a30[_0x52e6('0x17')]===_0x52e6('0x18')&&_0x215a30[_0x52e6('0x17')]>=0x0;});if(_0xd4e59f[_0x52e6('0x19')]>0x0){throw new Error(_0xd4e59f[_0x52e6('0x19')]+_0x52e6('0x1a')+_['map'](_0xd4e59f,function(_0x2e29ad){return'\x22'+_0x2e29ad['pm2_env']['name']+'\x22';}));}logger[_0x52e6('0x14')](_0x52e6('0x1b'),_[_0x52e6('0x1c')](_['filter'](_0x3c80c1,{'status':_0x52e6('0x1d')}),'name')[_0x52e6('0x1e')]());logger[_0x52e6('0x14')](_0x52e6('0x1f'),_['map'](_[_0x52e6('0x16')](_0x3c80c1,function(_0x54ee91){return _0x54ee91[_0x52e6('0x20')]!==_0x52e6('0x1d');}),_0x52e6('0x21'))['join']()||_0x52e6('0x22'));console[_0x52e6('0x23')]('App\x20Ready!');})['catch'](function(_0x53359f){console[_0x52e6('0x23')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x53359f);logger[_0x52e6('0x24')](_0x52e6('0x25'),_0x53359f);process[_0x52e6('0x26')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 4831634..482e50c 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 _0x9c44=['showWebBar','lastLoginAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','user','ChatInteraction','findOne','params','then','status','disposition','unmanaged','json','Unmanaged.','catch','isAuthenticated','headers','authorization','startsWith','Basic','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','User','find','sub','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','use','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','unshift','encryptString','sign','options','promisify','toString','hex','floor','now','HS512','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','crypto','util','moment','secrets','session','role','name','internal','email','userpic','voicePause','chatPause','faxPause','smsPause'];(function(_0x57fa7e,_0xd0b5ce){var _0x320671=function(_0x3392cc){while(--_0x3392cc){_0x57fa7e['push'](_0x57fa7e['shift']());}};_0x320671(++_0xd0b5ce);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var hardwareConf=require(_0x49c4('0x0'));var licenseUtil=require(_0x49c4('0x1'));var encryptor=require(_0x49c4('0x2'));var _=require(_0x49c4('0x3'));var jwt=require(_0x49c4('0x4'));var expressJwt=require(_0x49c4('0x5'));var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require(_0x49c4('0x6'));var BPromise=require('bluebird');var util=require(_0x49c4('0x7'));var moment=require(_0x49c4('0x8'));var validateJwt=expressJwt({'secret':config[_0x49c4('0x9')][_0x49c4('0xa')]});var userAttributes=['id',_0x49c4('0xb'),'fullname',_0x49c4('0xc'),_0x49c4('0xd'),_0x49c4('0xe'),_0x49c4('0xf'),'permissions','md5secret',_0x49c4('0x10'),_0x49c4('0x11'),'mailPause',_0x49c4('0x12'),_0x49c4('0x13'),'openchannelPause','pauseType',_0x49c4('0x14'),_0x49c4('0x15'),'lastPauseAt',_0x49c4('0x16'),_0x49c4('0x17'),'passwordResetAt',_0x49c4('0x18'),_0x49c4('0x19'),_0x49c4('0x1a'),_0x49c4('0x1b'),_0x49c4('0x1c'),_0x49c4('0x1d'),_0x49c4('0x1e'),_0x49c4('0x1f'),'phoneBarPrefixRequired',_0x49c4('0x20'),_0x49c4('0x21'),_0x49c4('0x22'),_0x49c4('0x23'),_0x49c4('0x24'),'privacyEnabled',_0x49c4('0x25'),_0x49c4('0x26'),'downloadVoiceRecordings','downloadOmnichannelInteractions',_0x49c4('0x27'),_0x49c4('0x28'),_0x49c4('0x29'),'chatAutoanswer',_0x49c4('0x2a'),'emailAutoanswer',_0x49c4('0x2b'),_0x49c4('0x2c'),_0x49c4('0x2d'),_0x49c4('0x2e'),_0x49c4('0x2f'),_0x49c4('0x30'),_0x49c4('0x31'),_0x49c4('0x32'),_0x49c4('0x33')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])['use'](function(_0x1c99b1,_0x4f0b62,_0x592bb8){if(_0x1c99b1[_0x49c4('0x34')]){_0x592bb8();}else{return db[_0x49c4('0x35')][_0x49c4('0x36')]({'where':{'id':_0x1c99b1[_0x49c4('0x37')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0x49c4('0x38')](function(_0x9cb797){if(_0x9cb797&&_0x9cb797['closed']){return _0x4f0b62[_0x49c4('0x39')](_0x9cb797[_0x49c4('0x3a')]===_0x49c4('0x3b')?0x195:0x193)[_0x49c4('0x3c')]({'message':_0x9cb797['disposition']==='unmanaged'?_0x49c4('0x3d'):'Forbidden.'});}else{_0x592bb8();}})[_0x49c4('0x3e')](function(_0x3852b2){_0x592bb8(_0x3852b2);});}});};exports[_0x49c4('0x3f')]=function isAuthenticated(_0x372a47){return compose()['use'](function(_0x889909,_0x2b2793,_0x46e04d){var _0x4f28a2;if(_0x889909[_0x49c4('0x40')][_0x49c4('0x41')]){if(_[_0x49c4('0x42')](_0x889909[_0x49c4('0x40')][_0x49c4('0x41')],_0x49c4('0x43'))){var _0x46f7ea=basicAuth(_0x889909);db['User']['find']({'where':{'name':_0x46f7ea['name']}})[_0x49c4('0x38')](function(_0x7ee704){if(!_0x7ee704||!_0x7ee704[_0x49c4('0x44')](_0x46f7ea[_0x49c4('0x45')])){return _0x2b2793[_0x49c4('0x39')](0x191)['json']({'message':_0x49c4('0x46')});}_0x889909[_0x49c4('0x34')]={'id':_0x7ee704['id']};_0x46e04d();})[_0x49c4('0x3e')](function(_0x24bba9){_0x46e04d(_0x24bba9);});}else if(_['startsWith'](_0x889909['headers'][_0x49c4('0x41')],_0x49c4('0x47'))){validateJwt(_0x889909,_0x2b2793,_0x46e04d);}else{if(_0x372a47){_0x46e04d();}else{return _0x2b2793[_0x49c4('0x39')](0x193)[_0x49c4('0x3c')]({'message':_0x49c4('0x48')});}}}else if(_0x889909['query'][_0x49c4('0x49')]){try{var _0x84c621={'audience':hardwareConf[_0x49c4('0x4a')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x889909['query'][_0x49c4('0x49')],_0x84c621)[_0x49c4('0x38')](function(_0x3bec0a){return db[_0x49c4('0x4b')][_0x49c4('0x4c')]({'where':{'id':_0x3bec0a[_0x49c4('0x4d')]}})[_0x49c4('0x38')](function(_0x27ef5f){_0x4f28a2=_0x27ef5f;return db[_0x49c4('0x4e')]['findOne']({'where':{'id':0x1},'attributes':[_0x49c4('0x4f'),'blockDuration'],'raw':!![]});})[_0x49c4('0x38')](function(_0x349791){if(!_0x4f28a2||!_[_0x49c4('0x50')](_0x4f28a2[_0x49c4('0x51')],_0x3bec0a['nonce'])){return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':_0x49c4('0x52')});}if(_0x4f28a2['disabled']){return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':_0x49c4('0x53')});}if(_0x4f28a2[_0x49c4('0x54')]){if(_0x349791[_0x49c4('0x55')]>0x0){if(moment(_0x4f28a2[_0x49c4('0x56')])[_0x49c4('0x57')](_0x349791[_0x49c4('0x55')],_0x49c4('0x58'))>moment()){return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':_0x49c4('0x53')});}}_0x889909[_0x49c4('0x34')]={'id':_0x4f28a2['id']};_0x46e04d();});})[_0x49c4('0x3e')](function(){return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':_0x49c4('0x53')});});}catch(_0x248c0a){_0x46e04d(_0x248c0a);}}else if(_0x372a47){_0x46e04d();}else{return _0x2b2793[_0x49c4('0x39')](0x193)[_0x49c4('0x3c')]({'message':_0x49c4('0x48')});}})[_0x49c4('0x59')](function(_0x4e38bc,_0x212366,_0x49829e){if(_0x4e38bc[_0x49c4('0x34')]){db[_0x49c4('0x4b')][_0x49c4('0x4c')]({'where':{'id':_0x4e38bc[_0x49c4('0x34')]['id']},'attributes':userAttributes})[_0x49c4('0x38')](function(_0x281b83){if(!_0x281b83){return _0x212366['status'](0x194)['json']({'message':_0x49c4('0x5a')});}_0x4e38bc[_0x49c4('0x34')]=_0x281b83;_0x49829e();})[_0x49c4('0x3e')](function(_0x117151){_0x49829e(_0x117151);});}else if(_0x372a47){_0x49829e();}else{return _0x212366['status'](0x194)[_0x49c4('0x3c')]({'message':_0x49c4('0x5b')});}});};exports[_0x49c4('0x5c')]=function canUpdate(){return compose()[_0x49c4('0x59')](function(_0x81a674,_0x3bde49,_0x1a9593){return licenseUtil[_0x49c4('0x5d')]()[_0x49c4('0x38')](function(_0x5640d3){if(_0x5640d3[_0x49c4('0x5e')]){_0x1a9593();}else{return _0x3bde49['status'](0x193)[_0x49c4('0x3c')]({'message':_0x49c4('0x5f')});}})[_0x49c4('0x3e')](function(_0x258abe){_0x1a9593(_0x258abe);});});};exports[_0x49c4('0x60')]=function isWebrtcLicence(){return compose()['use'](function(_0x592e8e,_0x15b674,_0x384862){return licenseUtil[_0x49c4('0x5d')]()[_0x49c4('0x38')](function(_0x5d4790){if(_0x5d4790[_0x49c4('0x61')]){_0x384862();}else{return _0x15b674['status'](0x193)[_0x49c4('0x3c')]({'message':'Forbidden'});}})[_0x49c4('0x3e')](function(_0x906d3){_0x384862(_0x906d3);});});};exports[_0x49c4('0x62')]=function(_0x27adfe,_0x2d8087,_0x30bea5){_0x27adfe[_0x49c4('0x62')]=!![];return _0x30bea5();};exports['signToken']=function signToken(_0x3b731f){return signJwt(_0x3b731f);};exports[_0x49c4('0x63')]=function(_0x4a5c34,_0x1e1ac4){if(!_0x4a5c34[_0x49c4('0x34')]){return _0x1e1ac4[_0x49c4('0x39')](0x194)[_0x49c4('0x3c')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x5d8bf0={'payload':{'id':_0x4a5c34[_0x49c4('0x34')]['id'],'role':_0x4a5c34['user'][_0x49c4('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5d8bf0)[_0x49c4('0x38')](function(_0x3811b2){_0x1e1ac4[_0x49c4('0x64')](_0x49c4('0x65'),_0x3811b2);_0x1e1ac4[_0x49c4('0x66')](_0x49c4('0x67'));})['catch'](function(_0x1f26c2){return _0x1e1ac4[_0x49c4('0x39')](0x1f4)[_0x49c4('0x68')](_0x1f26c2);});};exports[_0x49c4('0x69')]=function(_0x17ef75){if(_[_0x49c4('0x6a')](_0x17ef75[_0x49c4('0x51')])||_[_0x49c4('0x6a')](_0x17ef75[_0x49c4('0x6b')])){return null;}else{return createJwt(_0x17ef75);}};exports[_0x49c4('0x6c')]=function(_0x5b822f){_0x5b822f['apiKeyNonce']=generateNonce();_0x5b822f[_0x49c4('0x6b')]=generateIssuedAt();return createJwt(_0x5b822f);};exports[_0x49c4('0x6d')]=function(_0x527e74,_0x59a8bc){var _0x77163d=_0x527e74['query']['apikey'];if(_0x77163d){var _0x3208c2={'nonce':_0x59a8bc[_0x49c4('0x51')],'iat':_0x59a8bc[_0x49c4('0x6b')],'audience':hardwareConf[_0x49c4('0x4a')](),'issuer':hardwareConf[_0x49c4('0x4a')]()};return verifyJwt(_0x77163d,_0x3208c2)[_0x49c4('0x38')](function(){return generateApiKey(_0x59a8bc);});}else{throw{'message':_0x49c4('0x6e')};}};exports['validatePasswordPattern']=function(_0x859dde){var _0xcc6a2b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xcc6a2b[_0x49c4('0x6f')](_0x859dde))throw new db[(_0x49c4('0x70'))][(_0x49c4('0x71'))](_0x49c4('0x72'));return;};exports['validatePasswordHistory']=function(_0x5c7ddd,_0x1ef0c1,_0x155c43){var _0x2a6308=encryptor[_0x49c4('0x73')](_0x1ef0c1)[_0x49c4('0x74')](',');for(var _0x6b2592=0x0;_0x6b2592<_0x155c43;_0x6b2592++){if(!_0x2a6308[_0x6b2592])break;if(_0x5c7ddd[_0x49c4('0x75')]()===_0x2a6308[_0x6b2592]['toLowerCase']()){var _0x45d715=util[_0x49c4('0x76')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x155c43);if(_0x155c43===0x1){_0x45d715=_0x49c4('0x77');}throw new db['Sequelize'][(_0x49c4('0x71'))](_0x45d715);}}return;};exports[_0x49c4('0x78')]=function(_0x9eaa84,_0x2fe89a){var _0x845f7e=_0x2fe89a?encryptor[_0x49c4('0x73')](_0x2fe89a)[_0x49c4('0x74')](','):[];if(_0x845f7e[_0x49c4('0x79')]===0x5){_0x845f7e['splice'](-0x1,0x1);}_0x845f7e[_0x49c4('0x7a')](_0x9eaa84);return encryptor[_0x49c4('0x7b')](_0x845f7e['join'](','));};function signJwt(_0x10dec7){var _0x299e74=BPromise['promisify'](jwt[_0x49c4('0x7c')],{'context':jwt});var _0x42e0e6=_0x10dec7['secret']||config['secrets']['session'];return new BPromise(function(_0x513879,_0xc43386){_0x299e74(_0x10dec7['payload'],_0x42e0e6,_0x10dec7[_0x49c4('0x7d')])[_0x49c4('0x38')](function(_0x515240){_0x513879(_0x515240);})[_0x49c4('0x3e')](function(_0xdb2b33){_0xc43386(_0xdb2b33);});});}function verifyJwt(_0x5ac9f0,_0x34272f,_0x3dcf4c){var _0x167e84=BPromise[_0x49c4('0x7e')](jwt['verify'],{'context':jwt});var _0x431921=_0x3dcf4c||config[_0x49c4('0x9')][_0x49c4('0xa')];return new BPromise(function(_0x20e97d,_0x5d3375){_0x167e84(_0x5ac9f0,_0x431921,_0x34272f)[_0x49c4('0x38')](function(_0x4a93bc){_0x20e97d(_0x4a93bc);})['catch'](function(_0x58259d){_0x5d3375(_0x58259d);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x49c4('0x7f')](_0x49c4('0x80'));}function generateIssuedAt(){return Math[_0x49c4('0x81')](Date[_0x49c4('0x82')]()/0x3e8)['toString']();}function createJwt(_0x4daa6d){var _0x340523={'payload':{'iat':_0x4daa6d[_0x49c4('0x6b')],'nonce':_0x4daa6d[_0x49c4('0x51')]},'options':{'algorithm':_0x49c4('0x83'),'subject':_0x4daa6d['id'][_0x49c4('0x7f')](),'issuer':hardwareConf[_0x49c4('0x4a')](),'audience':hardwareConf[_0x49c4('0x4a')]()}};return signJwt(_0x340523)[_0x49c4('0x38')](function(_0x4d49e0){return{'iat':_0x4daa6d[_0x49c4('0x6b')],'nonce':_0x4daa6d['apiKeyNonce'],'token':_0x4d49e0};});} \ No newline at end of file +var _0x00bb=['lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','isChatInteractionAuthorized','use','user','findOne','params','disposition','then','closed','unmanaged','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','Basic','User','find','pass','status','Wrong\x20credentials.','Bearer','json','Unknown\x20authorization\x20format','query','getUuid','apikey','sub','Setting','allowedLoginAttempts','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','webrtc','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','isNil','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','unshift','encryptString','join','promisify','sign','secret','options','verify','toString','hex','floor','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','jsonwebtoken','express-jwt','basic-auth','crypto','secrets','session','role','fullname','name','internal','permissions','md5secret','voicePause','chatPause','mailPause','smsPause'];(function(_0x2c4819,_0x184573){var _0x3e1235=function(_0x5384ff){while(--_0x5384ff){_0x2c4819['push'](_0x2c4819['shift']());}};_0x3e1235(++_0x184573);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x00bb[_0x5c351c];return _0x26f3b3;};'use strict';var db=require(_0xb00b('0x0'))['db'];var config=require(_0xb00b('0x1'));var hardwareConf=require(_0xb00b('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xb00b('0x3'));var _=require('lodash');var jwt=require(_0xb00b('0x4'));var expressJwt=require(_0xb00b('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0xb00b('0x6'));var crypto=require(_0xb00b('0x7'));var BPromise=require('bluebird');var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xb00b('0x8')][_0xb00b('0x9')]});var userAttributes=['id',_0xb00b('0xa'),_0xb00b('0xb'),_0xb00b('0xc'),_0xb00b('0xd'),'email','userpic',_0xb00b('0xe'),_0xb00b('0xf'),_0xb00b('0x10'),_0xb00b('0x11'),_0xb00b('0x12'),'faxPause',_0xb00b('0x13'),'openchannelPause','pauseType','showWebBar',_0xb00b('0x14'),_0xb00b('0x15'),_0xb00b('0x16'),_0xb00b('0x17'),_0xb00b('0x18'),_0xb00b('0x19'),'phoneBarAutoAnswer',_0xb00b('0x1a'),_0xb00b('0x1b'),'phoneBarEnableRecording',_0xb00b('0x1c'),_0xb00b('0x1d'),'phoneBarExpires','phoneBarPrefixRequired',_0xb00b('0x1e'),'phoneBarRemoteControlPort','hotdesk',_0xb00b('0x1f'),_0xb00b('0x20'),_0xb00b('0x21'),_0xb00b('0x22'),'wssPort',_0xb00b('0x23'),'downloadOmnichannelInteractions',_0xb00b('0x24'),'ignorePauseForPreviewCalls',_0xb00b('0x25'),'chatAutoanswer',_0xb00b('0x26'),_0xb00b('0x27'),'emailAutoanswerDelay','smsAutoanswer',_0xb00b('0x28'),'openchannelAutoanswer',_0xb00b('0x29'),_0xb00b('0x2a'),_0xb00b('0x2b'),_0xb00b('0x2c'),'whatsappAutoanswerDelay'];exports[_0xb00b('0x2d')]=function(){return this['isAuthenticated'](!![])[_0xb00b('0x2e')](function(_0x121ec7,_0x51b841,_0x231293){if(_0x121ec7[_0xb00b('0x2f')]){_0x231293();}else{return db['ChatInteraction'][_0xb00b('0x30')]({'where':{'id':_0x121ec7[_0xb00b('0x31')]['id']},'attributes':['id','closed',_0xb00b('0x32')],'raw':!![]})[_0xb00b('0x33')](function(_0x3c9500){if(_0x3c9500&&_0x3c9500[_0xb00b('0x34')]){return _0x51b841['status'](_0x3c9500['disposition']===_0xb00b('0x35')?0x195:0x193)['json']({'message':_0x3c9500['disposition']==='unmanaged'?_0xb00b('0x36'):_0xb00b('0x37')});}else{_0x231293();}})[_0xb00b('0x38')](function(_0x3825af){_0x231293(_0x3825af);});}});};exports[_0xb00b('0x39')]=function isAuthenticated(_0x197379){return compose()[_0xb00b('0x2e')](function(_0x4a8d2b,_0x22c22d,_0x503c9c){var _0x450129;if(_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')]){if(_['startsWith'](_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')],_0xb00b('0x3c'))){var _0x183233=basicAuth(_0x4a8d2b);db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'name':_0x183233[_0xb00b('0xc')]}})[_0xb00b('0x33')](function(_0x149c1a){if(!_0x149c1a||!_0x149c1a['authenticate'](_0x183233[_0xb00b('0x3f')])){return _0x22c22d[_0xb00b('0x40')](0x191)['json']({'message':_0xb00b('0x41')});}_0x4a8d2b[_0xb00b('0x2f')]={'id':_0x149c1a['id']};_0x503c9c();})['catch'](function(_0x456241){_0x503c9c(_0x456241);});}else if(_['startsWith'](_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')],_0xb00b('0x42'))){validateJwt(_0x4a8d2b,_0x22c22d,_0x503c9c);}else{if(_0x197379){_0x503c9c();}else{return _0x22c22d[_0xb00b('0x40')](0x193)[_0xb00b('0x43')]({'message':_0xb00b('0x44')});}}}else if(_0x4a8d2b[_0xb00b('0x45')]['apikey']){try{var _0x57e8f9={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xb00b('0x46')]()};verifyJwt(_0x4a8d2b[_0xb00b('0x45')][_0xb00b('0x47')],_0x57e8f9)[_0xb00b('0x33')](function(_0x5cfa60){return db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'id':_0x5cfa60[_0xb00b('0x48')]}})[_0xb00b('0x33')](function(_0x261c80){_0x450129=_0x261c80;return db[_0xb00b('0x49')][_0xb00b('0x30')]({'where':{'id':0x1},'attributes':[_0xb00b('0x4a'),'blockDuration'],'raw':!![]});})['then'](function(_0x2ea41d){if(!_0x450129||!_['isEqual'](_0x450129[_0xb00b('0x4b')],_0x5cfa60[_0xb00b('0x4c')])){return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4d')});}if(_0x450129[_0xb00b('0x4e')]){return _0x22c22d[_0xb00b('0x40')](0x191)['json']({'message':_0xb00b('0x4f')});}if(_0x450129[_0xb00b('0x50')]){if(_0x2ea41d[_0xb00b('0x51')]>0x0){if(moment(_0x450129[_0xb00b('0x52')])[_0xb00b('0x53')](_0x2ea41d[_0xb00b('0x51')],'minutes')>moment()){return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4f')});}}_0x4a8d2b[_0xb00b('0x2f')]={'id':_0x450129['id']};_0x503c9c();});})[_0xb00b('0x38')](function(){return _0x22c22d['status'](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4f')});});}catch(_0xb76ede){_0x503c9c(_0xb76ede);}}else if(_0x197379){_0x503c9c();}else{return _0x22c22d[_0xb00b('0x40')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0xb00b('0x2e')](function(_0xf6ae0c,_0x10a348,_0x152437){if(_0xf6ae0c[_0xb00b('0x2f')]){db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'id':_0xf6ae0c['user']['id']},'attributes':userAttributes})[_0xb00b('0x33')](function(_0x3b72c4){if(!_0x3b72c4){return _0x10a348[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x54')});}_0xf6ae0c[_0xb00b('0x2f')]=_0x3b72c4;_0x152437();})[_0xb00b('0x38')](function(_0x974a29){_0x152437(_0x974a29);});}else if(_0x197379){_0x152437();}else{return _0x10a348[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x55')});}});};exports[_0xb00b('0x56')]=function canUpdate(){return compose()['use'](function(_0x3da23c,_0x35a0ba,_0xd07fb8){return licenseUtil[_0xb00b('0x57')]()[_0xb00b('0x33')](function(_0x2d9174){if(_0x2d9174[_0xb00b('0x58')]){_0xd07fb8();}else{return _0x35a0ba[_0xb00b('0x40')](0x193)[_0xb00b('0x43')]({'message':_0xb00b('0x59')});}})[_0xb00b('0x38')](function(_0x3b3031){_0xd07fb8(_0x3b3031);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x47c6c0,_0x3f8f60,_0x23d858){return licenseUtil['getLicense']()[_0xb00b('0x33')](function(_0x3c0fa){if(_0x3c0fa[_0xb00b('0x5a')]){_0x23d858();}else{return _0x3f8f60[_0xb00b('0x40')](0x193)['json']({'message':'Forbidden'});}})[_0xb00b('0x38')](function(_0x40c2fd){_0x23d858(_0x40c2fd);});});};exports['isMiddleware']=function(_0x514c5b,_0x154759,_0x3a205d){_0x514c5b['isMiddleware']=!![];return _0x3a205d();};exports[_0xb00b('0x5b')]=function signToken(_0x47a814){return signJwt(_0x47a814);};exports['setTokenCookie']=function(_0x4bcc9e,_0x465d90){if(!_0x4bcc9e['user']){return _0x465d90[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x5c')});}var _0xe724a5={'payload':{'id':_0x4bcc9e[_0xb00b('0x2f')]['id'],'role':_0x4bcc9e[_0xb00b('0x2f')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0xe724a5)['then'](function(_0x1d2a0d){_0x465d90[_0xb00b('0x5d')]('motion.token',_0x1d2a0d);_0x465d90[_0xb00b('0x5e')](_0xb00b('0x5f'));})['catch'](function(_0x15dcbf){return _0x465d90[_0xb00b('0x40')](0x1f4)[_0xb00b('0x60')](_0x15dcbf);});};exports['retrieveApiKey']=function(_0x501cbe){if(_[_0xb00b('0x61')](_0x501cbe[_0xb00b('0x4b')])||_[_0xb00b('0x61')](_0x501cbe[_0xb00b('0x62')])){return null;}else{return createJwt(_0x501cbe);}};exports['generateApiKey']=function(_0x380acb){_0x380acb[_0xb00b('0x4b')]=generateNonce();_0x380acb['apiKeyIat']=generateIssuedAt();return createJwt(_0x380acb);};exports['regenerateApiKey']=function(_0x160965,_0x524b05){var _0x1ab196=_0x160965[_0xb00b('0x45')][_0xb00b('0x47')];if(_0x1ab196){var _0x222459={'nonce':_0x524b05[_0xb00b('0x4b')],'iat':_0x524b05[_0xb00b('0x62')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xb00b('0x46')]()};return verifyJwt(_0x1ab196,_0x222459)['then'](function(){return generateApiKey(_0x524b05);});}else{throw{'message':_0xb00b('0x63')};}};exports[_0xb00b('0x64')]=function(_0x4129ba){var _0x5ac79e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5ac79e[_0xb00b('0x65')](_0x4129ba))throw new db[(_0xb00b('0x66'))][(_0xb00b('0x67'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0xb00b('0x68')]=function(_0x309ae6,_0x219b74,_0x385029){var _0x131848=encryptor[_0xb00b('0x69')](_0x219b74)[_0xb00b('0x6a')](',');for(var _0x3a0b90=0x0;_0x3a0b90<_0x385029;_0x3a0b90++){if(!_0x131848[_0x3a0b90])break;if(_0x309ae6['toLowerCase']()===_0x131848[_0x3a0b90][_0xb00b('0x6b')]()){var _0x2cbe80=util[_0xb00b('0x6c')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x385029);if(_0x385029===0x1){_0x2cbe80=_0xb00b('0x6d');}throw new db[(_0xb00b('0x66'))][(_0xb00b('0x67'))](_0x2cbe80);}}return;};exports[_0xb00b('0x6e')]=function(_0x1ad387,_0x4bfe0b){var _0xfd4ecc=_0x4bfe0b?encryptor[_0xb00b('0x69')](_0x4bfe0b)[_0xb00b('0x6a')](','):[];if(_0xfd4ecc[_0xb00b('0x6f')]===0x5){_0xfd4ecc['splice'](-0x1,0x1);}_0xfd4ecc[_0xb00b('0x70')](_0x1ad387);return encryptor[_0xb00b('0x71')](_0xfd4ecc[_0xb00b('0x72')](','));};function signJwt(_0x2d73bb){var _0x161216=BPromise[_0xb00b('0x73')](jwt[_0xb00b('0x74')],{'context':jwt});var _0x542223=_0x2d73bb[_0xb00b('0x75')]||config['secrets'][_0xb00b('0x9')];return new BPromise(function(_0x4c2186,_0x3b3272){_0x161216(_0x2d73bb['payload'],_0x542223,_0x2d73bb[_0xb00b('0x76')])['then'](function(_0x3dffaf){_0x4c2186(_0x3dffaf);})[_0xb00b('0x38')](function(_0x3bae02){_0x3b3272(_0x3bae02);});});}function verifyJwt(_0x4d1cec,_0x51fbe2,_0x4f7a59){var _0x21a53d=BPromise[_0xb00b('0x73')](jwt[_0xb00b('0x77')],{'context':jwt});var _0x49246b=_0x4f7a59||config[_0xb00b('0x8')][_0xb00b('0x9')];return new BPromise(function(_0xca87d4,_0x2ddba4){_0x21a53d(_0x4d1cec,_0x49246b,_0x51fbe2)[_0xb00b('0x33')](function(_0x485033){_0xca87d4(_0x485033);})[_0xb00b('0x38')](function(_0x27b13b){_0x2ddba4(_0x27b13b);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xb00b('0x78')](_0xb00b('0x79'));}function generateIssuedAt(){return Math[_0xb00b('0x7a')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x359669){var _0x188da7={'payload':{'iat':_0x359669[_0xb00b('0x62')],'nonce':_0x359669['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x359669['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xb00b('0x46')]()}};return signJwt(_0x188da7)['then'](function(_0x2434a0){return{'iat':_0x359669[_0xb00b('0x62')],'nonce':_0x359669['apiKeyNonce'],'token':_0x2434a0};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 0e61c56..dae4f73 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa96a=['catch','describe','CmContact','keys','startsWith','cf_','map','CmCustomField','findOne','slice','all','fieldType','type','lodash','../../mysqldb','skipContactsQuery','getContactsSubquery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','default','where','fields','filter','clause','tags','user','skip','ids','tag','countFilteredContacts','count','User','getFilteredContacts','rows'];(function(_0x482e34,_0x416303){var _0x4e2869=function(_0x5d825d){while(--_0x5d825d){_0x482e34['push'](_0x482e34['shift']());}};_0x4e2869(++_0x416303);}(_0xa96a,0xeb));var _0xaa96=function(_0x5926bd,_0x5c8ddf){_0x5926bd=_0x5926bd-0x0;var _0x2b1633=_0xa96a[_0x5926bd];return _0x2b1633;};'use strict';var _=require(_0xaa96('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0xaa96('0x1'))['db'];exports['findAll']=function(_0x35ecc7,_0x16c655,_0x1e2ed6,_0x6be37c){var _0x25cec4={'count':0x0,'rows':[]};var _0x160734=sqlUtils[_0xaa96('0x2')](_0x16c655,_0x35ecc7);if(_0x160734){return Promise['resolve'](_0x25cec4);}var _0x2a58cc=sqlUtils[_0xaa96('0x3')]();var _0x48942d={};var _0x53a428=![];var _0x331f04=![];return Promise[_0xaa96('0x4')]()[_0xaa96('0x5')](function(){if(_0x35ecc7[_0xaa96('0x6')]){return sqlUtils[_0xaa96('0x7')](_0x35ecc7[_0xaa96('0x6')],_0x6be37c);}else{return sqlUtils[_0xaa96('0x8')](_0x35ecc7,_0x6be37c);}})['then'](function(_0x438081){_0x2a58cc['where'](_0x438081[_0xaa96('0x9')]);_0x2a58cc[_0xaa96('0xa')](_0x438081[_0xaa96('0xb')]);_0x2a58cc[_0xaa96('0xa')](_0x438081[_0xaa96('0xc')]);_0x2a58cc[_0xaa96('0xa')](_0x438081['user'][_0xaa96('0xd')]);_0x48942d=_0x438081[_0xaa96('0xe')];_0x331f04=_0x438081[_0xaa96('0xf')][_0xaa96('0x10')];return sqlUtils['checkListsRestrictions'](_0x16c655,_0x35ecc7,_0x331f04);})['then'](function(_0x2460ce){_0x2a58cc['where'](_0x2460ce);var _0x1b258e=_0x35ecc7[_0xaa96('0x6')]?_0x48942d[_0xaa96('0x11')]:_0x35ecc7[_0xaa96('0x12')];_0x53a428=_0x1b258e?!![]:![];return sqlUtils[_0xaa96('0x13')](_0x2a58cc,_0x1b258e);})[_0xaa96('0x5')](function(_0x25edf7){_0x25cec4['count']=_0x25edf7;if(_0x25cec4[_0xaa96('0x14')]===0x0){return;}if(_0x35ecc7[_0xaa96('0x15')]){_0x331f04=!![];}return sqlUtils['buildContactsQuery'](_0x2a58cc,_0x35ecc7[_0xaa96('0xb')],_0x1e2ed6,_0x53a428,_0x48942d[_0xaa96('0xd')],_0x331f04);})[_0xaa96('0x5')](function(_0x418dab){if(!_0x418dab){return[];}return sqlUtils[_0xaa96('0x16')](_0x418dab,_0x35ecc7,_0x1e2ed6);})['then'](function(_0x1bca52){_0x25cec4[_0xaa96('0x17')]=_0x1bca52;return _0x25cec4;})[_0xaa96('0x18')](function(_0x522655){throw _0x522655;});};exports[_0xaa96('0x19')]=function(){var _0xe4a1a1={};var _0x3fdef8=[];return db[_0xaa96('0x1a')][_0xaa96('0x19')]()[_0xaa96('0x5')](function(_0x264f07){_0xe4a1a1=_0x264f07;var _0x1a2170=Object[_0xaa96('0x1b')](_0xe4a1a1)[_0xaa96('0xc')](function(_0x1e2a52){return _[_0xaa96('0x1c')](_0x1e2a52,_0xaa96('0x1d'))?_0x1e2a52:undefined;});var _0x4d1fa8=_0x1a2170[_0xaa96('0x1e')](function(_0x478beb){return db[_0xaa96('0x1f')][_0xaa96('0x20')]({'where':{'id':_0x478beb[_0xaa96('0x21')](0x3)},'raw':!![]});});return Promise[_0xaa96('0x22')](_0x4d1fa8);})[_0xaa96('0x5')](function(_0x2fc8c0){for(var _0x228b85=0x0;_0x228b85<_0x2fc8c0['length'];_0x228b85++){if(_0x2fc8c0[_0x228b85]){var _0xa168e5=_0xaa96('0x1d')+_0x2fc8c0[_0x228b85]['id'];_0xe4a1a1[_0xa168e5][_0xaa96('0x23')]=_0x2fc8c0[_0x228b85][_0xaa96('0x24')];}}_0x3fdef8=_['map'](Object[_0xaa96('0x1b')](_0xe4a1a1),function(_0x3db6d6){return{'name':_0x3db6d6,'type':_0xe4a1a1[_0x3db6d6]['type']};});return _0x3fdef8;})['catch'](function(_0x1c8c5f){throw _0x1c8c5f;});}; \ No newline at end of file +var _0x356c=['findOne','slice','cf_','type','catch','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','parseAdvancedSearchFilter','search','parseQueryParameters','fields','clause','tags','skip','where','ids','tag','count','User','buildContactsQuery','getFilteredContacts','rows','describe','CmContact','keys','filter','startsWith','map','CmCustomField'];(function(_0x3c5e54,_0x2b991b){var _0x3ae1f3=function(_0x43f80f){while(--_0x43f80f){_0x3c5e54['push'](_0x3c5e54['shift']());}};_0x3ae1f3(++_0x2b991b);}(_0x356c,0x1a9));var _0xc356=function(_0x24eba1,_0x4ddf3a){_0x24eba1=_0x24eba1-0x0;var _0x31a7ed=_0x356c[_0x24eba1];return _0x31a7ed;};'use strict';var _=require(_0xc356('0x0'));var sqlUtils=require(_0xc356('0x1'));var db=require(_0xc356('0x2'))['db'];exports[_0xc356('0x3')]=function(_0x3985f7,_0x4a85e1,_0x1327fd,_0x365ab7){var _0x5aa289={'count':0x0,'rows':[]};var _0x5b1892=sqlUtils[_0xc356('0x4')](_0x4a85e1,_0x3985f7);if(_0x5b1892){return Promise[_0xc356('0x5')](_0x5aa289);}var _0x2bdf60=sqlUtils[_0xc356('0x6')]();var _0x2cc545={};var _0x3a6a7e=![];var _0xc4fef2=![];return Promise['resolve']()[_0xc356('0x7')](function(){if(_0x3985f7['search']){return sqlUtils[_0xc356('0x8')](_0x3985f7[_0xc356('0x9')],_0x365ab7);}else{return sqlUtils[_0xc356('0xa')](_0x3985f7,_0x365ab7);}})[_0xc356('0x7')](function(_0x3a57bf){_0x2bdf60['where'](_0x3a57bf['default']);_0x2bdf60['where'](_0x3a57bf[_0xc356('0xb')]);_0x2bdf60['where'](_0x3a57bf['filter']);_0x2bdf60['where'](_0x3a57bf['user'][_0xc356('0xc')]);_0x2cc545=_0x3a57bf[_0xc356('0xd')];_0xc4fef2=_0x3a57bf['user'][_0xc356('0xe')];return sqlUtils['checkListsRestrictions'](_0x4a85e1,_0x3985f7,_0xc4fef2);})['then'](function(_0xa571ea){_0x2bdf60[_0xc356('0xf')](_0xa571ea);var _0x4f9ffc=_0x3985f7[_0xc356('0x9')]?_0x2cc545[_0xc356('0x10')]:_0x3985f7[_0xc356('0x11')];_0x3a6a7e=_0x4f9ffc?!![]:![];return sqlUtils['countFilteredContacts'](_0x2bdf60,_0x4f9ffc);})[_0xc356('0x7')](function(_0xddf4a0){_0x5aa289[_0xc356('0x12')]=_0xddf4a0;if(_0x5aa289[_0xc356('0x12')]===0x0){return;}if(_0x3985f7[_0xc356('0x13')]){_0xc4fef2=!![];}return sqlUtils[_0xc356('0x14')](_0x2bdf60,_0x3985f7[_0xc356('0xb')],_0x1327fd,_0x3a6a7e,_0x2cc545['clause'],_0xc4fef2);})[_0xc356('0x7')](function(_0x23b7fb){if(!_0x23b7fb){return[];}return sqlUtils[_0xc356('0x15')](_0x23b7fb,_0x3985f7,_0x1327fd);})[_0xc356('0x7')](function(_0x6b064e){_0x5aa289[_0xc356('0x16')]=_0x6b064e;return _0x5aa289;})['catch'](function(_0x4e4d7a){throw _0x4e4d7a;});};exports[_0xc356('0x17')]=function(){var _0x48c8a3={};var _0x4b4780=[];return db[_0xc356('0x18')][_0xc356('0x17')]()['then'](function(_0x368828){_0x48c8a3=_0x368828;var _0xe0dd5e=Object[_0xc356('0x19')](_0x48c8a3)[_0xc356('0x1a')](function(_0x2c2465){return _[_0xc356('0x1b')](_0x2c2465,'cf_')?_0x2c2465:undefined;});var _0x440ac2=_0xe0dd5e[_0xc356('0x1c')](function(_0x4fe151){return db[_0xc356('0x1d')][_0xc356('0x1e')]({'where':{'id':_0x4fe151[_0xc356('0x1f')](0x3)},'raw':!![]});});return Promise['all'](_0x440ac2);})[_0xc356('0x7')](function(_0x35ebe1){for(var _0x252f8f=0x0;_0x252f8f<_0x35ebe1['length'];_0x252f8f++){if(_0x35ebe1[_0x252f8f]){var _0x3aeadd=_0xc356('0x20')+_0x35ebe1[_0x252f8f]['id'];_0x48c8a3[_0x3aeadd]['fieldType']=_0x35ebe1[_0x252f8f][_0xc356('0x21')];}}_0x4b4780=_[_0xc356('0x1c')](Object['keys'](_0x48c8a3),function(_0x1dea58){return{'name':_0x1dea58,'type':_0x48c8a3[_0x1dea58][_0xc356('0x21')]};});return _0x4b4780;})[_0xc356('0x22')](function(_0x3ebcf9){throw _0x3ebcf9;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index da4f982..5dac5c0 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1a9=['concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','group','c.id','limit','offset','subqry.id','order','DESC','findAll','keyBy','QueryTypes','SELECT','CmContact','sequelize','query','toString','TagIds','Tags','COUNT(*)','t.id\x20IN\x20?','Sequelize','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','agent','search','ListId','true','select','from','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','mobile','fax','createdAt','updatedAt','deletedAt','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','conditions','find','dateOfBirth','fieldType','datetime','castTo','buildExpression','type','default','Tag','value','map','tags','clause','and','ids','User','user','skip','some','name','compact','Contact','length','c.ListId\x20IN\x20?'];(function(_0x472d33,_0x39fc67){var _0x3e9cb4=function(_0x133eb0){while(--_0x133eb0){_0x472d33['push'](_0x472d33['shift']());}};_0x3e9cb4(++_0x39fc67);}(_0xa1a9,0x1bc));var _0x9a1a=function(_0xc0b9df,_0x571502){_0xc0b9df=_0xc0b9df-0x0;var _0x476904=_0xa1a9[_0xc0b9df];return _0x476904;};'use strict';var _=require(_0x9a1a('0x0'));var squel=require(_0x9a1a('0x1'));var as=require(_0x9a1a('0x2'));var qs=require(_0x9a1a('0x3'));var utils=require(_0x9a1a('0x4'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x366fb7,_0x47832b){var _0x4df7c6=![];if(_0x366fb7['role']===_0x9a1a('0x5')&&!_0x47832b[_0x9a1a('0x6')]&&!_0x47832b[_0x9a1a('0x7')]&&_0x47832b['autocomplete']!==_0x9a1a('0x8')){_0x4df7c6=!![];}return _0x4df7c6;}function getContactsSubquery(){return squel[_0x9a1a('0x9')]()[_0x9a1a('0xa')]('cm_contacts','c')[_0x9a1a('0xb')](_0x9a1a('0xc'));}function applyJoinClauses(_0x56ab75,_0x14e5c3){var _0x4ef884=_0x14e5c3?'c':_0x9a1a('0xd');_0x56ab75[_0x9a1a('0xe')](_0x9a1a('0xf'),'uc','uc.CmContactId\x20=\x20'+_0x4ef884+_0x9a1a('0x10'))['left_join'](_0x9a1a('0x11'),'ct',_0x9a1a('0x12')+_0x4ef884+_0x9a1a('0x10'))['left_join'](_0x9a1a('0x13'),'t',_0x9a1a('0x14'));return _0x56ab75;}function addFieldsToQuery(_0x577234,_0x2a1733,_0x34cc14,_0x4a0dbc,_0x435696){var _0x111833=_0x435696?'c':'subqry';if(!_0x2a1733){_0x2a1733=['id',_0x9a1a('0x15'),_0x9a1a('0x16'),'phone',_0x9a1a('0x17'),_0x9a1a('0x18'),'email','ListId','CompanyId',_0x9a1a('0x19'),_0x9a1a('0x1a'),_0x9a1a('0x1b'),'TagIds'];}else if(!_0x2a1733[_0x9a1a('0x1c')]('id')){_0x2a1733[_0x9a1a('0x1d')]('id');}var _0x55c79c=_0x34cc14&&_0x435696||!_0x34cc14&&!_0x435696;if(_0x4a0dbc){_0x55c79c=_0x4a0dbc&&_0x435696||!_0x4a0dbc&&!_0x435696;}_0x2a1733[_0x9a1a('0x1e')](function(_0x11767a){if(_0x11767a==='TagIds'){if(_0x55c79c){_0x577234[_0x9a1a('0x1f')](_0x9a1a('0x20'),_0x11767a);}else if(_0x34cc14||_0x4a0dbc){_0x577234[_0x9a1a('0x1f')](_0x111833+'.'+_0x11767a);}}else{_0x577234[_0x9a1a('0x1f')](_0x111833+'.'+_0x11767a);}});return _0x577234;}function getSqlClauses(){var _0x4dac3e={'default':squel[_0x9a1a('0x21')](),'fields':squel[_0x9a1a('0x21')](),'filter':squel[_0x9a1a('0x21')](),'tags':{'clause':squel[_0x9a1a('0x21')](),'ids':null},'user':{'clause':squel[_0x9a1a('0x21')](),'skip':![]}};return _0x4dac3e;}function parseTagParameter(_0x366f68){var _0x305337=squel[_0x9a1a('0x21')]();if(_0x366f68){var _0x518c03=utils[_0x9a1a('0x22')](_0x366f68);_0x518c03['forEach'](function(_0x20a87c){_0x305337['or'](_0x9a1a('0x23'),'%,'+_0x20a87c+',%');});}return _0x305337;}function parseSearchFilter(_0x2107a0){var _0x9934c0=squel['expr']();if(_0x2107a0){var _0x8398a8=_0x2107a0[_0x9a1a('0x24')]('\x5c','\x5c\x5c')[_0x9a1a('0x24')](/'/g,'\x27\x27');if(_0x8398a8[_0x9a1a('0x25')]('\x20')['length']>0x1){_0x9934c0['or'](_0x9a1a('0x26'),qs[_0x9a1a('0x27')](_0x8398a8,!![]),null);}else{if(qs['isNumeric'](_0x8398a8)){_0x9934c0['or'](_0x9a1a('0x28'),_0x8398a8+'%');_0x9934c0['or'](_0x9a1a('0x29'),_0x8398a8+'%');_0x9934c0['or'](_0x9a1a('0x2a'),_0x8398a8+'%');_0x9934c0['or'](_0x9a1a('0x2b'),_0x8398a8+'%');}else if(qs[_0x9a1a('0x2c')](_0x8398a8)){_0x9934c0['or'](_0x9a1a('0x2d'),_0x8398a8+'%');}else{_0x9934c0['or']('c.firstName\x20LIKE\x20?','%'+_0x8398a8+'%');_0x9934c0['or']('c.lastName\x20LIKE\x20?','%'+_0x8398a8+'%');_0x9934c0['or'](_0x9a1a('0x2d'),'%'+_0x8398a8+'%');}}}return _0x9934c0;}function parseAdvancedSearchFilter(_0x2cb8f5,_0x21e4ee){var _0xd3dd2b=getSqlClauses();var _0x2909a9=as['parseSearch'](_0x2cb8f5);var _0x96acdc=_0x2909a9['sqlOperator'];for(var _0x5ec38c=0x0;_0x5ec38c<_0x2909a9[_0x9a1a('0x2e')]['length'];_0x5ec38c++){var _0x1acc60=_0x2909a9['conditions'][_0x5ec38c];var _0x4f49ea='c';var _0xf52c9=_[_0x9a1a('0x2f')](_0x21e4ee,['name',_0x1acc60['field']]);if(_0xf52c9){if(_0x1acc60[_0x9a1a('0x1f')]===_0x9a1a('0x30')||_0xf52c9[_0x9a1a('0x31')]===_0x9a1a('0x32')){_0x1acc60[_0x9a1a('0x33')]='DATE';}var _0x4b97f7=as[_0x9a1a('0x34')](_0x4f49ea,_0xf52c9[_0x9a1a('0x35')],_0x1acc60);_0xd3dd2b[_0x9a1a('0x36')][_0x96acdc](_0x4b97f7['text'],_0x4b97f7['value']['start'],_0x4b97f7['value']['end']);}else{if(_0x1acc60[_0x9a1a('0x1f')]===_0x9a1a('0x37')){var _0x1d9e0a=_0x1acc60[_0x9a1a('0x38')][_0x9a1a('0x25')](',')[_0x9a1a('0x39')](function(_0x418871){return Number(_0x418871);});var _0x49f3c6=parseTagParameter(_0x1d9e0a);_0xd3dd2b[_0x9a1a('0x3a')][_0x9a1a('0x3b')][_0x9a1a('0x3c')](_0x49f3c6);_0xd3dd2b[_0x9a1a('0x3a')][_0x9a1a('0x3d')]=_0x1d9e0a;}else if(_0x1acc60[_0x9a1a('0x1f')]===_0x9a1a('0x3e')){_0xd3dd2b[_0x9a1a('0x3f')][_0x9a1a('0x3b')][_0x9a1a('0x3c')]('uc.UserId\x20=\x20?',_0x1acc60[_0x9a1a('0x38')]);_0xd3dd2b[_0x9a1a('0x3f')][_0x9a1a('0x40')]=!![];}}}return _0xd3dd2b;}function parseModelFields(_0x45e819,_0x14747a){var _0x43b258=squel[_0x9a1a('0x21')]();var _0x43f3fd=_(_0x45e819)['keys']()[_0x9a1a('0x39')](function(_0x459168){return _[_0x9a1a('0x41')](_0x14747a,[_0x9a1a('0x42'),_0x459168])?_0x459168:undefined;})[_0x9a1a('0x43')]()[_0x9a1a('0x38')]();if(_0x45e819[_0x9a1a('0x44')]){_0x43f3fd[_0x9a1a('0x1d')](_0x9a1a('0x44'));}if(_0x45e819[_0x9a1a('0x3e')]){_0x43f3fd[_0x9a1a('0x1d')](_0x9a1a('0x3e'));}if(_0x43f3fd[_0x9a1a('0x45')]>0x0){_0x43f3fd[_0x9a1a('0x1e')](function(_0x23a2c7){if(_0x23a2c7==='ListId'){_0x43b258[_0x9a1a('0x3c')](_0x9a1a('0x46'),[][_0x9a1a('0x47')](_0x45e819[_0x23a2c7]));}else if(_0x23a2c7===_0x9a1a('0x44')){var _0x3a363d='%'+_0x45e819[_0x23a2c7]+'%';_0x43b258[_0x9a1a('0x3c')](_0x9a1a('0x48'),_0x3a363d);}else if(_0x23a2c7===_0x9a1a('0x3e')){_0x43b258['and'](_0x9a1a('0x49'),_0x45e819[_0x23a2c7]);}else{_0x43b258[_0x9a1a('0x3c')]('c.'+_0x23a2c7+_0x9a1a('0x4a'),_0x45e819[_0x23a2c7]);}});}return _0x43b258;}function parseQueryParameters(_0x5dae4f,_0x543138){var _0x2e5454=getSqlClauses();return Promise[_0x9a1a('0x4b')]()[_0x9a1a('0x4c')](function(){return parseModelFields(_0x5dae4f,_0x543138);})[_0x9a1a('0x4c')](function(_0x5ef811){_0x2e5454[_0x9a1a('0x4d')][_0x9a1a('0x3c')](_0x5ef811);return parseTagParameter(_0x5dae4f[_0x9a1a('0x4e')]);})['then'](function(_0x3eb8a4){_0x2e5454['tags'][_0x9a1a('0x3b')][_0x9a1a('0x3c')](_0x3eb8a4);return parseSearchFilter(_0x5dae4f[_0x9a1a('0x4f')]);})['then'](function(_0x2bf069){_0x2e5454[_0x9a1a('0x4f')]=_0x2bf069;return _0x2e5454;});}function checkListsRestrictions(_0x429fcb,_0x5d59b9,_0x1b02c1){var _0x12b212=squel[_0x9a1a('0x21')]();return Promise['resolve']()[_0x9a1a('0x4c')](function(){if(_0x5d59b9[_0x9a1a('0x6')]&&_0x429fcb['role']===_0x9a1a('0x5')&&!_0x1b02c1){return _0x429fcb[_0x9a1a('0x50')]({'attributes':['id'],'raw':!![]});}})[_0x9a1a('0x4c')](function(_0x33c431){if(_0x33c431){if(_0x33c431[_0x9a1a('0x45')]===0x0){_0x12b212[_0x9a1a('0x3c')](_0x9a1a('0x51'));}else{_0x12b212[_0x9a1a('0x3c')](_0x9a1a('0x46'),_[_0x9a1a('0x39')](_0x33c431,'id'));}}})['then'](function(){return _0x12b212;});}function buildContactsQuery(_0x5ad7b0,_0x1dac39,_0x5cc875,_0x51eead,_0xa8000a,_0xcfb79b){if(_0x1dac39){_0x1dac39=_0x5cc875['attributes'];}_0x5ad7b0=addFieldsToQuery(_0x5ad7b0,_0x1dac39,_0x51eead,_0xcfb79b,!![]);var _0x518c78=squel[_0x9a1a('0x9')]();_0x518c78=addFieldsToQuery(_0x518c78,_0x1dac39,_0x51eead,_0xcfb79b,![]);if(_0x51eead||_0xcfb79b){_0x5ad7b0=applyJoinClauses(_0x5ad7b0,!![]);_0x5ad7b0[_0x9a1a('0x52')](_0x9a1a('0x53'));if(_0x5cc875[_0x9a1a('0x54')]){_0x518c78[_0x9a1a('0x54')](_0x5cc875[_0x9a1a('0x54')]);}if(_0x5cc875[_0x9a1a('0x55')]){_0x518c78['offset'](_0x5cc875[_0x9a1a('0x55')]);}}else{_0x518c78=applyJoinClauses(_0x518c78,![]);_0x518c78[_0x9a1a('0x52')](_0x9a1a('0x56'));if(_0x5cc875[_0x9a1a('0x54')]){_0x5ad7b0[_0x9a1a('0x54')](_0x5cc875[_0x9a1a('0x54')]);}if(_0x5cc875[_0x9a1a('0x55')]){_0x5ad7b0[_0x9a1a('0x55')](_0x5cc875[_0x9a1a('0x55')]);}}_0x518c78['having'](_0xa8000a);if(_0x5cc875[_0x9a1a('0x57')]){_0x5cc875[_0x9a1a('0x57')][_0x9a1a('0x1e')](function(_0x531acc){_0x5ad7b0['order']('c.'+_0x531acc[0x0],_0x531acc[0x1]===_0x9a1a('0x58')?![]:!![]);_0x518c78[_0x9a1a('0x57')]('subqry.'+_0x531acc[0x0],_0x531acc[0x1]===_0x9a1a('0x58')?![]:!![]);});}_0x518c78[_0x9a1a('0xa')](_0x5ad7b0,_0x9a1a('0xd'));return _0x518c78;}function getFilteredContacts(_0x88991c){var _0x4d1ad8=[];return db[_0x9a1a('0x37')][_0x9a1a('0x59')]({'attributes':['id',_0x9a1a('0x42'),'color'],'raw':!![]})[_0x9a1a('0x4c')](function(_0xf87508){_0x4d1ad8=_[_0x9a1a('0x5a')](_0xf87508,'id');var _0x49c2df={'type':db['Sequelize'][_0x9a1a('0x5b')][_0x9a1a('0x5c')],'model':db[_0x9a1a('0x5d')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x9a1a('0x5e')][_0x9a1a('0x5f')](_0x88991c[_0x9a1a('0x60')](),_0x49c2df);})[_0x9a1a('0x4c')](function(_0x4e3eec){_0x4e3eec[_0x9a1a('0x1e')](function(_0x29e3f8){if(_0x29e3f8[_0x9a1a('0x61')]){_0x29e3f8[_0x9a1a('0x62')]=[];_0x29e3f8[_0x9a1a('0x61')][_0x9a1a('0x25')](',')[_0x9a1a('0x1e')](function(_0x106e3a){_0x29e3f8['Tags'][_0x9a1a('0x1d')](_0x4d1ad8[_0x106e3a]);});}delete _0x29e3f8[_0x9a1a('0x61')];});return _0x4e3eec;});}function countFilteredContacts(_0x12804d,_0x25a891){var _0x2fcbdc=_0x12804d['clone']();_0x2fcbdc[_0x9a1a('0x1f')](_0x9a1a('0x63'));_0x2fcbdc=applyJoinClauses(_0x2fcbdc,!![]);_0x12804d[_0x9a1a('0x52')](_0x9a1a('0x53'));var _0x48530c=utils['getSelectedTags'](_0x25a891);if(!_['isEmpty'](_0x48530c)){_0x2fcbdc[_0x9a1a('0xb')](_0x9a1a('0x64'),_0x48530c);}var _0x545908={'type':db[_0x9a1a('0x65')][_0x9a1a('0x5b')][_0x9a1a('0x5c')],'raw':!![]};return db[_0x9a1a('0x5e')][_0x9a1a('0x5f')](_0x2fcbdc[_0x9a1a('0x60')](),_0x545908)[_0x9a1a('0x4c')](function(_0x322981){return _0x322981[0x0][_0x9a1a('0x63')];});}module[_0x9a1a('0x66')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x63b2=['../interaction/utils','../../mysqldb','agent','ListId','true','from','where','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','phone','mobile','fax','email','CompanyId','createdAt','updatedAt','includes','push','forEach','TagIds','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','conditions','length','datetime','castTo','DATE','type','default','text','value','start','end','Tag','map','clause','and','tags','ids','User','user','uc.UserId\x20=\x20?','skip','keys','some','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','tag','filter','search','getLists','c.ListId\x20IS\x20NULL','attributes','select','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','name','color','keyBy','Sequelize','QueryTypes','CmContact','sequelize','toString','Tags','split','getSelectedTags','isEmpty','t.id\x20IN\x20?','SELECT','query','COUNT(*)','lodash','../parsers/advancedSearch','../parsers/qs'];(function(_0x14c8ee,_0x34d4fb){var _0x51acc2=function(_0x4c1277){while(--_0x4c1277){_0x14c8ee['push'](_0x14c8ee['shift']());}};_0x51acc2(++_0x34d4fb);}(_0x63b2,0xd9));var _0x263b=function(_0x581531,_0x3bb2f5){_0x581531=_0x581531-0x0;var _0x2db225=_0x63b2[_0x581531];return _0x2db225;};'use strict';var _=require(_0x263b('0x0'));var squel=require('squel');var as=require(_0x263b('0x1'));var qs=require(_0x263b('0x2'));var utils=require(_0x263b('0x3'));var db=require(_0x263b('0x4'))['db'];function skipContactsQuery(_0x2ddd1f,_0x1c5b00){var _0x50fbe1=![];if(_0x2ddd1f['role']===_0x263b('0x5')&&!_0x1c5b00['search']&&!_0x1c5b00[_0x263b('0x6')]&&_0x1c5b00['autocomplete']!==_0x263b('0x7')){_0x50fbe1=!![];}return _0x50fbe1;}function getContactsSubquery(){return squel['select']()[_0x263b('0x8')]('cm_contacts','c')[_0x263b('0x9')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x69ef58,_0x518d07){var _0x2fa67a=_0x518d07?'c':_0x263b('0xa');_0x69ef58[_0x263b('0xb')](_0x263b('0xc'),'uc',_0x263b('0xd')+_0x2fa67a+_0x263b('0xe'))[_0x263b('0xb')]('cm_contact_has_tags','ct',_0x263b('0xf')+_0x2fa67a+'.id')[_0x263b('0xb')](_0x263b('0x10'),'t',_0x263b('0x11'));return _0x69ef58;}function addFieldsToQuery(_0x17539b,_0x57a093,_0x52cc00,_0x702215,_0x495c95){var _0x5cfc4c=_0x495c95?'c':'subqry';if(!_0x57a093){_0x57a093=['id',_0x263b('0x12'),'lastName',_0x263b('0x13'),_0x263b('0x14'),_0x263b('0x15'),_0x263b('0x16'),_0x263b('0x6'),_0x263b('0x17'),_0x263b('0x18'),_0x263b('0x19'),'deletedAt','TagIds'];}else if(!_0x57a093[_0x263b('0x1a')]('id')){_0x57a093[_0x263b('0x1b')]('id');}var _0x336b41=_0x52cc00&&_0x495c95||!_0x52cc00&&!_0x495c95;if(_0x702215){_0x336b41=_0x702215&&_0x495c95||!_0x702215&&!_0x495c95;}_0x57a093[_0x263b('0x1c')](function(_0x5a90e1){if(_0x5a90e1===_0x263b('0x1d')){if(_0x336b41){_0x17539b['field'](_0x263b('0x1e'),_0x5a90e1);}else if(_0x52cc00||_0x702215){_0x17539b[_0x263b('0x1f')](_0x5cfc4c+'.'+_0x5a90e1);}}else{_0x17539b[_0x263b('0x1f')](_0x5cfc4c+'.'+_0x5a90e1);}});return _0x17539b;}function getSqlClauses(){var _0x39ea88={'default':squel[_0x263b('0x20')](),'fields':squel[_0x263b('0x20')](),'filter':squel[_0x263b('0x20')](),'tags':{'clause':squel[_0x263b('0x20')](),'ids':null},'user':{'clause':squel[_0x263b('0x20')](),'skip':![]}};return _0x39ea88;}function parseTagParameter(_0x23546f){var _0xd70b70=squel[_0x263b('0x20')]();if(_0x23546f){var _0x3fa2c4=utils['getSelectedTags'](_0x23546f);_0x3fa2c4['forEach'](function(_0x2152ca){_0xd70b70['or'](_0x263b('0x21'),'%,'+_0x2152ca+',%');});}return _0xd70b70;}function parseSearchFilter(_0x33f676){var _0x13c72d=squel[_0x263b('0x20')]();if(_0x33f676){var _0x58608b=_0x33f676[_0x263b('0x22')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x58608b['split']('\x20')['length']>0x1){_0x13c72d['or'](_0x263b('0x23'),qs[_0x263b('0x24')](_0x58608b,!![]),null);}else{if(qs[_0x263b('0x25')](_0x58608b)){_0x13c72d['or'](_0x263b('0x26'),_0x58608b+'%');_0x13c72d['or']('c.phone\x20LIKE\x20?',_0x58608b+'%');_0x13c72d['or'](_0x263b('0x27'),_0x58608b+'%');_0x13c72d['or'](_0x263b('0x28'),_0x58608b+'%');}else if(qs[_0x263b('0x29')](_0x58608b)){_0x13c72d['or'](_0x263b('0x2a'),_0x58608b+'%');}else{_0x13c72d['or'](_0x263b('0x2b'),'%'+_0x58608b+'%');_0x13c72d['or'](_0x263b('0x2c'),'%'+_0x58608b+'%');_0x13c72d['or'](_0x263b('0x2a'),'%'+_0x58608b+'%');}}}return _0x13c72d;}function parseAdvancedSearchFilter(_0x41e24c,_0x39d7a8){var _0x369c20=getSqlClauses();var _0x382c96=as[_0x263b('0x2d')](_0x41e24c);var _0x9528e2=_0x382c96['sqlOperator'];for(var _0xa764f6=0x0;_0xa764f6<_0x382c96[_0x263b('0x2e')][_0x263b('0x2f')];_0xa764f6++){var _0x27e1b6=_0x382c96['conditions'][_0xa764f6];var _0x55c554='c';var _0x56c0a4=_['find'](_0x39d7a8,['name',_0x27e1b6[_0x263b('0x1f')]]);if(_0x56c0a4){if(_0x27e1b6[_0x263b('0x1f')]==='dateOfBirth'||_0x56c0a4['fieldType']===_0x263b('0x30')){_0x27e1b6[_0x263b('0x31')]=_0x263b('0x32');}var _0x570490=as['buildExpression'](_0x55c554,_0x56c0a4[_0x263b('0x33')],_0x27e1b6);_0x369c20[_0x263b('0x34')][_0x9528e2](_0x570490[_0x263b('0x35')],_0x570490[_0x263b('0x36')][_0x263b('0x37')],_0x570490['value'][_0x263b('0x38')]);}else{if(_0x27e1b6[_0x263b('0x1f')]===_0x263b('0x39')){var _0x3bf582=_0x27e1b6[_0x263b('0x36')]['split'](',')[_0x263b('0x3a')](function(_0x5e4c65){return Number(_0x5e4c65);});var _0x2a0e11=parseTagParameter(_0x3bf582);_0x369c20['tags'][_0x263b('0x3b')][_0x263b('0x3c')](_0x2a0e11);_0x369c20[_0x263b('0x3d')][_0x263b('0x3e')]=_0x3bf582;}else if(_0x27e1b6[_0x263b('0x1f')]===_0x263b('0x3f')){_0x369c20[_0x263b('0x40')][_0x263b('0x3b')][_0x263b('0x3c')](_0x263b('0x41'),_0x27e1b6[_0x263b('0x36')]);_0x369c20['user'][_0x263b('0x42')]=!![];}}}return _0x369c20;}function parseModelFields(_0x5a02ec,_0x509887){var _0x2b0fcc=squel[_0x263b('0x20')]();var _0x41d36f=_(_0x5a02ec)[_0x263b('0x43')]()[_0x263b('0x3a')](function(_0x1e9b06){return _[_0x263b('0x44')](_0x509887,['name',_0x1e9b06])?_0x1e9b06:undefined;})[_0x263b('0x45')]()[_0x263b('0x36')]();if(_0x5a02ec['Contact']){_0x41d36f[_0x263b('0x1b')](_0x263b('0x46'));}if(_0x5a02ec[_0x263b('0x3f')]){_0x41d36f[_0x263b('0x1b')](_0x263b('0x3f'));}if(_0x41d36f[_0x263b('0x2f')]>0x0){_0x41d36f[_0x263b('0x1c')](function(_0xc1e18e){if(_0xc1e18e==='ListId'){_0x2b0fcc['and'](_0x263b('0x47'),[][_0x263b('0x48')](_0x5a02ec[_0xc1e18e]));}else if(_0xc1e18e===_0x263b('0x46')){var _0x5d76ec='%'+_0x5a02ec[_0xc1e18e]+'%';_0x2b0fcc[_0x263b('0x3c')](_0x263b('0x49'),_0x5d76ec);}else if(_0xc1e18e==='User'){_0x2b0fcc[_0x263b('0x3c')]('uc.UserId\x20=\x20?',_0x5a02ec[_0xc1e18e]);}else{_0x2b0fcc[_0x263b('0x3c')]('c.'+_0xc1e18e+_0x263b('0x4a'),_0x5a02ec[_0xc1e18e]);}});}return _0x2b0fcc;}function parseQueryParameters(_0x3bcf87,_0x51f625){var _0x1e64cb=getSqlClauses();return Promise[_0x263b('0x4b')]()[_0x263b('0x4c')](function(){return parseModelFields(_0x3bcf87,_0x51f625);})[_0x263b('0x4c')](function(_0x21dc63){_0x1e64cb['fields'][_0x263b('0x3c')](_0x21dc63);return parseTagParameter(_0x3bcf87[_0x263b('0x4d')]);})[_0x263b('0x4c')](function(_0x5a1153){_0x1e64cb[_0x263b('0x3d')][_0x263b('0x3b')]['and'](_0x5a1153);return parseSearchFilter(_0x3bcf87[_0x263b('0x4e')]);})[_0x263b('0x4c')](function(_0xeff263){_0x1e64cb['filter']=_0xeff263;return _0x1e64cb;});}function checkListsRestrictions(_0x283fce,_0xfcae12,_0x592cc7){var _0x5ee6cb=squel[_0x263b('0x20')]();return Promise['resolve']()[_0x263b('0x4c')](function(){if(_0xfcae12[_0x263b('0x4f')]&&_0x283fce['role']===_0x263b('0x5')&&!_0x592cc7){return _0x283fce[_0x263b('0x50')]({'attributes':['id'],'raw':!![]});}})[_0x263b('0x4c')](function(_0x58a1bd){if(_0x58a1bd){if(_0x58a1bd[_0x263b('0x2f')]===0x0){_0x5ee6cb[_0x263b('0x3c')](_0x263b('0x51'));}else{_0x5ee6cb['and'](_0x263b('0x47'),_[_0x263b('0x3a')](_0x58a1bd,'id'));}}})['then'](function(){return _0x5ee6cb;});}function buildContactsQuery(_0x2c283e,_0xa5c5ef,_0x37ba48,_0x5c7bab,_0x45f92f,_0x563f90){if(_0xa5c5ef){_0xa5c5ef=_0x37ba48[_0x263b('0x52')];}_0x2c283e=addFieldsToQuery(_0x2c283e,_0xa5c5ef,_0x5c7bab,_0x563f90,!![]);var _0x21833c=squel[_0x263b('0x53')]();_0x21833c=addFieldsToQuery(_0x21833c,_0xa5c5ef,_0x5c7bab,_0x563f90,![]);if(_0x5c7bab||_0x563f90){_0x2c283e=applyJoinClauses(_0x2c283e,!![]);_0x2c283e[_0x263b('0x54')](_0x263b('0x55'));if(_0x37ba48[_0x263b('0x56')]){_0x21833c[_0x263b('0x56')](_0x37ba48[_0x263b('0x56')]);}if(_0x37ba48[_0x263b('0x57')]){_0x21833c[_0x263b('0x57')](_0x37ba48[_0x263b('0x57')]);}}else{_0x21833c=applyJoinClauses(_0x21833c,![]);_0x21833c[_0x263b('0x54')](_0x263b('0x58'));if(_0x37ba48[_0x263b('0x56')]){_0x2c283e[_0x263b('0x56')](_0x37ba48[_0x263b('0x56')]);}if(_0x37ba48['offset']){_0x2c283e[_0x263b('0x57')](_0x37ba48[_0x263b('0x57')]);}}_0x21833c[_0x263b('0x59')](_0x45f92f);if(_0x37ba48['order']){_0x37ba48['order'][_0x263b('0x1c')](function(_0x37975b){_0x2c283e[_0x263b('0x5a')]('c.'+_0x37975b[0x0],_0x37975b[0x1]===_0x263b('0x5b')?![]:!![]);_0x21833c['order'](_0x263b('0x5c')+_0x37975b[0x0],_0x37975b[0x1]===_0x263b('0x5b')?![]:!![]);});}_0x21833c['from'](_0x2c283e,_0x263b('0xa'));return _0x21833c;}function getFilteredContacts(_0x5b9f8f){var _0x591f5b=[];return db[_0x263b('0x39')][_0x263b('0x5d')]({'attributes':['id',_0x263b('0x5e'),_0x263b('0x5f')],'raw':!![]})['then'](function(_0x4994e9){_0x591f5b=_[_0x263b('0x60')](_0x4994e9,'id');var _0x5dbc9c={'type':db[_0x263b('0x61')][_0x263b('0x62')]['SELECT'],'model':db[_0x263b('0x63')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x263b('0x64')]['query'](_0x5b9f8f[_0x263b('0x65')](),_0x5dbc9c);})[_0x263b('0x4c')](function(_0x594d5e){_0x594d5e['forEach'](function(_0x1cb58a){if(_0x1cb58a[_0x263b('0x1d')]){_0x1cb58a[_0x263b('0x66')]=[];_0x1cb58a['TagIds'][_0x263b('0x67')](',')['forEach'](function(_0x16b49a){_0x1cb58a[_0x263b('0x66')]['push'](_0x591f5b[_0x16b49a]);});}delete _0x1cb58a[_0x263b('0x1d')];});return _0x594d5e;});}function countFilteredContacts(_0x195340,_0x3f37c1){var _0x471617=_0x195340['clone']();_0x471617[_0x263b('0x1f')]('COUNT(*)');_0x471617=applyJoinClauses(_0x471617,!![]);_0x195340['group'](_0x263b('0x55'));var _0x38e5de=utils[_0x263b('0x68')](_0x3f37c1);if(!_[_0x263b('0x69')](_0x38e5de)){_0x471617[_0x263b('0x9')](_0x263b('0x6a'),_0x38e5de);}var _0x30acae={'type':db['Sequelize'][_0x263b('0x62')][_0x263b('0x6b')],'raw':!![]};return db['sequelize'][_0x263b('0x6c')](_0x471617[_0x263b('0x65')](),_0x30acae)['then'](function(_0x59e2d5){return _0x59e2d5[0x0][_0x263b('0x6d')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index db7228e..9541ac5 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 _0x94db=['aes192','encrypt','algorithm','join','error','test','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','createCipher','update','binary','write','final','close','decryptFile','createDecipher','data','end','unlink','encryptString','secret','base64','decryptString','utf8','crypto','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr'];(function(_0xda035e,_0x3a6eef){var _0x596c8a=function(_0x2384c0){while(--_0x2384c0){_0xda035e['push'](_0xda035e['shift']());}};_0x596c8a(++_0x3a6eef);}(_0x94db,0x88));var _0xb94d=function(_0x6c5b98,_0x586b7d){_0x6c5b98=_0x6c5b98-0x0;var _0x5aeaf3=_0x94db[_0x6c5b98];return _0x5aeaf3;};'use strict';var crypto=require(_0xb94d('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xb94d('0x1'));var config=require(_0xb94d('0x2'));var logger=require(_0xb94d('0x3'))(_0xb94d('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xb94d('0x5')][_0xb94d('0x6')],'algorithm':_0xb94d('0x7')};const fileOptions={'algorithm':_0xb94d('0x8')};if(config[_0xb94d('0x9')]&&config[_0xb94d('0x9')][_0xb94d('0xa')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0xb94d('0xa')]);if(isSupported){fileOptions[_0xb94d('0xa')]=config[_0xb94d('0x9')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xb94d('0xb')](',\x20');logger[_0xb94d('0xc')](config[_0xb94d('0x9')]['algorithm'],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x2af573){return AES_SUPPORTED_RX[_0xb94d('0xd')](_0x2af573);}function getSupportedCiphers(){return crypto[_0xb94d('0xe')]()[_0xb94d('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x2e81e2){return getSupportedCiphers()[_0xb94d('0x10')](_0x2e81e2)>-0x1;}function combineOptions(_0x4ffbdd){var _0xcb6dc7={};for(var _0x125fd3 in fileOptions){if(fileOptions[_0xb94d('0x11')](_0x125fd3)){_0xcb6dc7[_0x125fd3]=fileOptions[_0x125fd3];}}if(_0x4ffbdd){for(var _0x19f322 in _0x4ffbdd){if(_0x4ffbdd[_0xb94d('0x11')](_0x19f322)){_0xcb6dc7[_0x19f322]=_0x4ffbdd[_0x19f322];}}}return _0xcb6dc7;}exports['encryptFile']=function(_0x3e561c,_0x4328f5,_0x50ae63,_0x38fd8b){return new BPromise(function(_0x3b23ce,_0x1d5e46){_0x38fd8b=combineOptions(_0x38fd8b);var _0x5a0d7e=new Buffer(_0x50ae63);var _0xf16842=fs[_0xb94d('0x12')](_0x3e561c);var _0x482aff=fs[_0xb94d('0x13')](_0x4328f5);var _0x378fb8=crypto[_0xb94d('0x14')](_0x38fd8b[_0xb94d('0xa')],_0x5a0d7e);_0xf16842['on']('data',function(_0x16d402){var _0x368a06=new Buffer(_0x378fb8[_0xb94d('0x15')](_0x16d402),_0xb94d('0x16'));_0x482aff[_0xb94d('0x17')](_0x368a06);});_0xf16842['on']('end',function(){try{var _0x4e83b7=new Buffer(_0x378fb8[_0xb94d('0x18')](_0xb94d('0x16')),_0xb94d('0x16'));_0x482aff[_0xb94d('0x17')](_0x4e83b7);_0x482aff['end']();_0x482aff['on'](_0xb94d('0x19'),function(){return _0x3b23ce(_0x4328f5);});}catch(_0x58e83b){fs['unlink'](_0x4328f5);return _0x1d5e46(_0x58e83b);}});});};exports[_0xb94d('0x1a')]=function(_0x33542e,_0x1ef57f,_0x258eb2,_0x39f2ca){return new BPromise(function(_0x5d22b6,_0x26af1f){_0x39f2ca=combineOptions(_0x39f2ca);var _0x2b3db9=new Buffer(_0x258eb2);var _0x402480=fs[_0xb94d('0x12')](_0x33542e);var _0x12e89c=fs[_0xb94d('0x13')](_0x1ef57f);var _0x45a027=crypto[_0xb94d('0x1b')](_0x39f2ca[_0xb94d('0xa')],_0x2b3db9);_0x402480['on'](_0xb94d('0x1c'),function(_0x52e8fc){var _0x4e63b0=new Buffer(_0x45a027['update'](_0x52e8fc),'binary');_0x12e89c[_0xb94d('0x17')](_0x4e63b0);});_0x402480['on'](_0xb94d('0x1d'),function(){try{var _0x18a8c2=new Buffer(_0x45a027[_0xb94d('0x18')](_0xb94d('0x16')),_0xb94d('0x16'));_0x12e89c[_0xb94d('0x17')](_0x18a8c2);_0x12e89c['end']();_0x12e89c['on'](_0xb94d('0x19'),function(){return _0x5d22b6(_0x1ef57f);});}catch(_0x35a45e){fs[_0xb94d('0x1e')](_0x1ef57f);return _0x26af1f(_0x35a45e);}});});};exports[_0xb94d('0x1f')]=function(_0x3152ae,_0x3dc425,_0xa292e3){var _0x274280=_0xa292e3||stringOptions[_0xb94d('0xa')];var _0x590286=_0x3dc425||stringOptions[_0xb94d('0x20')];var _0x44a559=crypto['createCipher'](_0x274280,_0x590286);var _0x2864cb=_0x44a559[_0xb94d('0x15')](_0x3152ae,'utf8','base64');_0x2864cb+=_0x44a559['final'](_0xb94d('0x21'));return _0x2864cb;};exports[_0xb94d('0x22')]=function(_0x2e72b6,_0x214c47,_0x43d7dd){var _0x5570fa=_0x43d7dd||stringOptions[_0xb94d('0xa')];var _0x173e94=_0x214c47||stringOptions[_0xb94d('0x20')];var _0x9cf6df=crypto[_0xb94d('0x1b')](_0x5570fa,_0x173e94);var _0x1e24db=_0x9cf6df[_0xb94d('0x15')](_0x2e72b6,'base64','utf8');_0x1e24db+=_0x9cf6df[_0xb94d('0x18')](_0xb94d('0x23'));return _0x1e24db;}; \ No newline at end of file +var _0x6762=['utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','session','aes-256-ctr','aes192','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','createCipher','binary','write','final','end','close','unlink','decryptFile','createDecipher','data','update','encryptString','secret'];(function(_0x459c7d,_0x1771b5){var _0x2e676f=function(_0x1e31e0){while(--_0x1e31e0){_0x459c7d['push'](_0x459c7d['shift']());}};_0x2e676f(++_0x1771b5);}(_0x6762,0xb7));var _0x2676=function(_0x1eb17b,_0x2c2f2b){_0x1eb17b=_0x1eb17b-0x0;var _0x321a44=_0x6762[_0x1eb17b];return _0x321a44;};'use strict';var crypto=require(_0x2676('0x0'));var fs=require('fs');var BPromise=require(_0x2676('0x1'));var _=require(_0x2676('0x2'));var config=require(_0x2676('0x3'));var logger=require(_0x2676('0x4'))(_0x2676('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x2676('0x6')],'algorithm':_0x2676('0x7')};const fileOptions={'algorithm':_0x2676('0x8')};if(config[_0x2676('0x9')]&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config['encrypt'][_0x2676('0xa')]);if(isSupported){fileOptions[_0x2676('0xa')]=config[_0x2676('0x9')][_0x2676('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x2676('0xb')](config['encrypt'][_0x2676('0xa')],_0x2676('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x12c01f){return AES_SUPPORTED_RX[_0x2676('0xd')](_0x12c01f);}function getSupportedCiphers(){return crypto[_0x2676('0xe')]()[_0x2676('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x491e62){return getSupportedCiphers()[_0x2676('0x10')](_0x491e62)>-0x1;}function combineOptions(_0x1c507a){var _0x40ca3c={};for(var _0x4fa905 in fileOptions){if(fileOptions[_0x2676('0x11')](_0x4fa905)){_0x40ca3c[_0x4fa905]=fileOptions[_0x4fa905];}}if(_0x1c507a){for(var _0x3fc6bd in _0x1c507a){if(_0x1c507a[_0x2676('0x11')](_0x3fc6bd)){_0x40ca3c[_0x3fc6bd]=_0x1c507a[_0x3fc6bd];}}}return _0x40ca3c;}exports['encryptFile']=function(_0x21c1de,_0x44b477,_0x2e7eda,_0x3d04ff){return new BPromise(function(_0x21c99d,_0x30bfce){_0x3d04ff=combineOptions(_0x3d04ff);var _0x11633a=new Buffer(_0x2e7eda);var _0x203434=fs[_0x2676('0x12')](_0x21c1de);var _0x2e844f=fs[_0x2676('0x13')](_0x44b477);var _0x29d5ce=crypto[_0x2676('0x14')](_0x3d04ff[_0x2676('0xa')],_0x11633a);_0x203434['on']('data',function(_0x2acca9){var _0x43146d=new Buffer(_0x29d5ce['update'](_0x2acca9),_0x2676('0x15'));_0x2e844f[_0x2676('0x16')](_0x43146d);});_0x203434['on']('end',function(){try{var _0x35880b=new Buffer(_0x29d5ce[_0x2676('0x17')](_0x2676('0x15')),'binary');_0x2e844f[_0x2676('0x16')](_0x35880b);_0x2e844f[_0x2676('0x18')]();_0x2e844f['on'](_0x2676('0x19'),function(){return _0x21c99d(_0x44b477);});}catch(_0x292660){fs[_0x2676('0x1a')](_0x44b477);return _0x30bfce(_0x292660);}});});};exports[_0x2676('0x1b')]=function(_0xb62374,_0x32107a,_0x1e08e0,_0xa6dc24){return new BPromise(function(_0x44bfb6,_0x4bc0cc){_0xa6dc24=combineOptions(_0xa6dc24);var _0x12aaba=new Buffer(_0x1e08e0);var _0x162522=fs[_0x2676('0x12')](_0xb62374);var _0x3c6c34=fs['createWriteStream'](_0x32107a);var _0x53a3bf=crypto[_0x2676('0x1c')](_0xa6dc24['algorithm'],_0x12aaba);_0x162522['on'](_0x2676('0x1d'),function(_0xe820d8){var _0x13b5b2=new Buffer(_0x53a3bf[_0x2676('0x1e')](_0xe820d8),_0x2676('0x15'));_0x3c6c34[_0x2676('0x16')](_0x13b5b2);});_0x162522['on'](_0x2676('0x18'),function(){try{var _0x453207=new Buffer(_0x53a3bf[_0x2676('0x17')](_0x2676('0x15')),_0x2676('0x15'));_0x3c6c34['write'](_0x453207);_0x3c6c34[_0x2676('0x18')]();_0x3c6c34['on'](_0x2676('0x19'),function(){return _0x44bfb6(_0x32107a);});}catch(_0x55b96d){fs[_0x2676('0x1a')](_0x32107a);return _0x4bc0cc(_0x55b96d);}});});};exports[_0x2676('0x1f')]=function(_0x8c4a6c,_0x993bf1,_0xe3bbb3){var _0x3891d7=_0xe3bbb3||stringOptions[_0x2676('0xa')];var _0x5c0a53=_0x993bf1||stringOptions[_0x2676('0x20')];var _0x1aaa7d=crypto['createCipher'](_0x3891d7,_0x5c0a53);var _0xfa9c1f=_0x1aaa7d[_0x2676('0x1e')](_0x8c4a6c,_0x2676('0x21'),_0x2676('0x22'));_0xfa9c1f+=_0x1aaa7d[_0x2676('0x17')](_0x2676('0x22'));return _0xfa9c1f;};exports[_0x2676('0x23')]=function(_0x12f0cb,_0x25cd99,_0x575c51){var _0x2486df=_0x575c51||stringOptions[_0x2676('0xa')];var _0x2b6165=_0x25cd99||stringOptions[_0x2676('0x20')];var _0x1bd409=crypto[_0x2676('0x1c')](_0x2486df,_0x2b6165);var _0x5cf00d=_0x1bd409[_0x2676('0x1e')](_0x12f0cb,_0x2676('0x22'),'utf8');_0x5cf00d+=_0x1bd409['final']('utf8');return _0x5cf00d;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 65db2c2..ee1cb21 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 _0x2a25=['zip-dir','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','CSV','find','split','splitSizeCsv','then','sequelize','query','SELECT','num','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','existsSync','join','mkdirSync','each','csv','%s.%s','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','exit','util','path','lodash','to-csv','bluebird'];(function(_0x239ab3,_0x58842f){var _0x2ddc74=function(_0x357882){while(--_0x357882){_0x239ab3['push'](_0x239ab3['shift']());}};_0x2ddc74(++_0x58842f);}(_0x2a25,0x1ea));var _0x52a2=function(_0x465a57,_0x2df402){_0x465a57=_0x465a57-0x0;var _0x2bd9b0=_0x2a25[_0x465a57];return _0x2bd9b0;};'use strict';var util=require(_0x52a2('0x0'));var path=require(_0x52a2('0x1'));var _=require(_0x52a2('0x2'));var csv=require(_0x52a2('0x3'));var fs=require('fs');var BPromise=require(_0x52a2('0x4'));var zipdir=require(_0x52a2('0x5'));var rimraf=require('rimraf');var db=require(_0x52a2('0x6'))['db'];var dbH=require(_0x52a2('0x6'))['dbH'];var logger=require(_0x52a2('0x7'))(_0x52a2('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x52a2('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xf044c9,_0x2051a1){var _0x140cd9={'status':_0xf044c9};var _0x546042={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2051a1){_0x140cd9['savename']=_0x2051a1;}return db[_0x52a2('0xa')][_0x52a2('0xb')](_0x140cd9,_0x546042);}function main(){var _0x5c4490=0x1388;var _0x2c0acd;logger[_0x52a2('0xc')](util[_0x52a2('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x52a2('0xe')));return db['Setting'][_0x52a2('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x52a2('0x10'),_0x52a2('0x11')]})[_0x52a2('0x12')](function(_0x3a74cc){if(_0x3a74cc){_0x2c0acd=_0x3a74cc;_0x5c4490=_0x2c0acd['splitSizeCsv']||0x1388;}})[_0x52a2('0x12')](function(){return dbH[_0x52a2('0x13')][_0x52a2('0x14')](util[_0x52a2('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x52a2('0x15')]});})['then'](function(_0x1f0c02){if(!_0x1f0c02[0x0][_0x52a2('0x16')]){return analyticExtractedReport('Empty');}var _0x2025d2=[];var _0x106cb7=0x0;if(_0x2c0acd[_0x52a2('0x10')]){if(_0x1f0c02&&_0x1f0c02[_0x52a2('0x17')]){var _0x15b2ee=_[_0x52a2('0x18')](_0x1f0c02[0x0][_0x52a2('0x16')]/_0x5c4490);var _0x28f497=Number[_0x52a2('0x19')](_0x1f0c02[0x0][_0x52a2('0x16')]/_0x5c4490)?_0x1f0c02[0x0][_0x52a2('0x16')]%_0x5c4490:0x0;_0x15b2ee['forEach'](function(_0x3cf5d8){if(_0x3cf5d8>0x0){_0x106cb7+=_0x5c4490;}_0x2025d2[_0x52a2('0x1a')](dbH[_0x52a2('0x13')][_0x52a2('0x14')](util[_0x52a2('0xd')](_0x52a2('0x1b'),QUERY,_0x5c4490,_0x106cb7),{'type':dbH['sequelize'][_0x52a2('0x1c')][_0x52a2('0x15')]}));});if(_0x28f497>0x0){_0x106cb7+=_0x5c4490;_0x2025d2[_0x52a2('0x1a')](dbH[_0x52a2('0x13')]['query'](util[_0x52a2('0xd')](_0x52a2('0x1b'),QUERY,_0x28f497,_0x106cb7),{'type':dbH[_0x52a2('0x13')]['QueryTypes'][_0x52a2('0x15')]}));}}}else{_0x2025d2[_0x52a2('0x1a')](dbH['sequelize'][_0x52a2('0x14')](QUERY,{'type':dbH[_0x52a2('0x13')][_0x52a2('0x1c')][_0x52a2('0x15')]}));}var _0x54ddcc=path[_0x52a2('0x1d')](PATH);var _0x328553=path[_0x52a2('0x1e')](PATH,_0x52a2('0x1f'));var _0x272905=_0x2c0acd[_0x52a2('0x10')]&&_0x2025d2['length']>0x1;var _0x113475=[];if(!fs[_0x52a2('0x20')](path[_0x52a2('0x21')](_0x54ddcc,_0x328553))&&_0x272905){fs[_0x52a2('0x22')](path[_0x52a2('0x21')](_0x54ddcc,_0x328553));}return BPromise[_0x52a2('0x23')](_0x2025d2,function(_0xf6ef50){_0x113475[_0x52a2('0x1a')](_0xf6ef50);})[_0x52a2('0x12')](function(){for(var _0x241b85=0x0;_0x241b85<_0x113475[_0x52a2('0x17')];_0x241b85+=0x1){var _0x15d19c;var _0x17cb33=_0x113475[_0x241b85];if(_0x272905){_0x15d19c=path[_0x52a2('0x21')](_0x54ddcc,_0x328553,util[_0x52a2('0xd')]('%s%d.%s',_0x328553,_0x241b85,_0x52a2('0x24')));}else{_0x15d19c=path['join'](_0x54ddcc,util[_0x52a2('0xd')]('%s.%s',_0x328553,_0x52a2('0x24')));}fs['writeFileSync'](_0x15d19c,csv(_0x17cb33));}})[_0x52a2('0x12')](function(){if(_0x272905){return new Promise(function(_0x30477a){zipdir(path[_0x52a2('0x21')](_0x54ddcc,_0x328553),{'saveTo':path[_0x52a2('0x21')](_0x54ddcc,util[_0x52a2('0xd')](_0x52a2('0x25'),_0x328553,'zip'))},function(_0x26197a,_0x2aff4e){rimraf(path['join'](_0x54ddcc,_0x328553),function(){});_0x30477a(_0x52a2('0x26'));});});}})[_0x52a2('0x12')](function(){logger[_0x52a2('0xc')](util[_0x52a2('0xd')](_0x52a2('0x27'),EXTRACTED_REPORT_ID,_0x52a2('0xe')));return analyticExtractedReport(_0x52a2('0x28'),_0x272905?util['format']('%s.%s',_0x328553,_0x272905?_0x52a2('0x29'):_0x52a2('0x24')):null);});})[_0x52a2('0x2a')](function(_0x3803eb){logger['info'](util['format'](_0x52a2('0x2b'),EXTRACTED_REPORT_ID,_0x52a2('0xe')),util['inspect'](_0x3803eb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x52a2('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xb895=['info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','range','forEach','push','SELECT','dirname','basename','.csv','length','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','writeFileSync','zip\x20finished','CSV','Completed','zip','csv','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','lodash','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','update'];(function(_0x544d59,_0x4b7874){var _0x32cc27=function(_0x419919){while(--_0x419919){_0x544d59['push'](_0x544d59['shift']());}};_0x32cc27(++_0x4b7874);}(_0xb895,0x146));var _0x5b89=function(_0x3813a2,_0x206dec){_0x3813a2=_0x3813a2-0x0;var _0x5c1058=_0xb895[_0x3813a2];return _0x5c1058;};'use strict';var util=require(_0x5b89('0x0'));var path=require('path');var _=require(_0x5b89('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x5b89('0x2'));var rimraf=require(_0x5b89('0x3'));var db=require(_0x5b89('0x4'))['db'];var dbH=require(_0x5b89('0x4'))[_0x5b89('0x5')];var logger=require(_0x5b89('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x5b89('0x7')][0x2]);var QUERY=process[_0x5b89('0x7')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x43914e,_0x898975){var _0x1e3046={'status':_0x43914e};var _0x4d6ac0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x898975){_0x1e3046[_0x5b89('0x8')]=_0x898975;}return db['AnalyticExtractedReport'][_0x5b89('0x9')](_0x1e3046,_0x4d6ac0);}function main(){var _0x2b16da=0x1388;var _0x4486d1;logger[_0x5b89('0xa')](util[_0x5b89('0xb')](_0x5b89('0xc'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x5b89('0xd')][_0x5b89('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5b89('0xf'),_0x5b89('0x10')]})[_0x5b89('0x11')](function(_0x1bbebe){if(_0x1bbebe){_0x4486d1=_0x1bbebe;_0x2b16da=_0x4486d1[_0x5b89('0x10')]||0x1388;}})[_0x5b89('0x11')](function(){return dbH[_0x5b89('0x12')][_0x5b89('0x13')](util[_0x5b89('0xb')](_0x5b89('0x14'),QUERY),{'type':dbH['sequelize'][_0x5b89('0x15')]['SELECT']});})[_0x5b89('0x11')](function(_0xac84f4){if(!_0xac84f4[0x0][_0x5b89('0x16')]){return analyticExtractedReport(_0x5b89('0x17'));}var _0x28d50f=[];var _0x4ccd86=0x0;if(_0x4486d1[_0x5b89('0xf')]){if(_0xac84f4&&_0xac84f4['length']){var _0x26f961=_[_0x5b89('0x18')](_0xac84f4[0x0][_0x5b89('0x16')]/_0x2b16da);var _0x53dcd6=Number['isInteger'](_0xac84f4[0x0][_0x5b89('0x16')]/_0x2b16da)?_0xac84f4[0x0][_0x5b89('0x16')]%_0x2b16da:0x0;_0x26f961[_0x5b89('0x19')](function(_0x4f13af){if(_0x4f13af>0x0){_0x4ccd86+=_0x2b16da;}_0x28d50f[_0x5b89('0x1a')](dbH[_0x5b89('0x12')][_0x5b89('0x13')](util[_0x5b89('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2b16da,_0x4ccd86),{'type':dbH[_0x5b89('0x12')]['QueryTypes'][_0x5b89('0x1b')]}));});if(_0x53dcd6>0x0){_0x4ccd86+=_0x2b16da;_0x28d50f[_0x5b89('0x1a')](dbH[_0x5b89('0x12')][_0x5b89('0x13')](util[_0x5b89('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x53dcd6,_0x4ccd86),{'type':dbH[_0x5b89('0x12')][_0x5b89('0x15')]['SELECT']}));}}}else{_0x28d50f[_0x5b89('0x1a')](dbH[_0x5b89('0x12')]['query'](QUERY,{'type':dbH[_0x5b89('0x12')][_0x5b89('0x15')][_0x5b89('0x1b')]}));}var _0x362301=path[_0x5b89('0x1c')](PATH);var _0x12792a=path[_0x5b89('0x1d')](PATH,_0x5b89('0x1e'));var _0x4cbb19=_0x4486d1[_0x5b89('0xf')]&&_0x28d50f[_0x5b89('0x1f')]>0x1;var _0x4b1654=[];if(!fs[_0x5b89('0x20')](path[_0x5b89('0x21')](_0x362301,_0x12792a))&&_0x4cbb19){fs[_0x5b89('0x22')](path['join'](_0x362301,_0x12792a));}return BPromise[_0x5b89('0x23')](_0x28d50f,function(_0x2d9a25){_0x4b1654['push'](_0x2d9a25);})[_0x5b89('0x11')](function(){for(var _0x7d29be=0x0;_0x7d29be<_0x4b1654[_0x5b89('0x1f')];_0x7d29be+=0x1){var _0x3e4582;var _0x45f354=_0x4b1654[_0x7d29be];if(_0x4cbb19){_0x3e4582=path[_0x5b89('0x21')](_0x362301,_0x12792a,util[_0x5b89('0xb')](_0x5b89('0x24'),_0x12792a,_0x7d29be,'csv'));}else{_0x3e4582=path['join'](_0x362301,util[_0x5b89('0xb')](_0x5b89('0x25'),_0x12792a,'csv'));}fs[_0x5b89('0x26')](_0x3e4582,csv(_0x45f354));}})[_0x5b89('0x11')](function(){if(_0x4cbb19){return new Promise(function(_0x42a5ea){zipdir(path[_0x5b89('0x21')](_0x362301,_0x12792a),{'saveTo':path['join'](_0x362301,util['format'](_0x5b89('0x25'),_0x12792a,'zip'))},function(_0x41480e,_0x4271f9){rimraf(path[_0x5b89('0x21')](_0x362301,_0x12792a),function(){});_0x42a5ea(_0x5b89('0x27'));});});}})[_0x5b89('0x11')](function(){logger[_0x5b89('0xa')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x5b89('0x28')));return analyticExtractedReport(_0x5b89('0x29'),_0x4cbb19?util[_0x5b89('0xb')]('%s.%s',_0x12792a,_0x4cbb19?_0x5b89('0x2a'):_0x5b89('0x2b')):null);});})['catch'](function(_0xfa3c8e){logger['info'](util[_0x5b89('0xb')](_0x5b89('0x2c'),EXTRACTED_REPORT_ID,_0x5b89('0x28')),util[_0x5b89('0x2d')](_0xfa3c8e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x5b89('0x2e')](function(){process[_0x5b89('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index f3cc8e5..9d800be 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 _0xc803=['footer','black','right','num','Empty','Setting','find','split','then','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','mkdirSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','catch','util','path','moment','html-to-pdfmake','zip-dir','rimraf','jsdom','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','pageBreak','margin','\x20/\x20'];(function(_0x35c666,_0x281c14){var _0x4dbfd1=function(_0x262107){while(--_0x262107){_0x35c666['push'](_0x35c666['shift']());}};_0x4dbfd1(++_0x281c14);}(_0xc803,0x1b5));var _0x3c80=function(_0x4d61ee,_0x95701){_0x4d61ee=_0x4d61ee-0x0;var _0x5e439d=_0xc803[_0x4d61ee];return _0x5e439d;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x3c80('0x0'));var path=require(_0x3c80('0x1'));var moment=require(_0x3c80('0x2'));var htmlToPdfmake=require(_0x3c80('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x3c80('0x4'));var rimraf=require(_0x3c80('0x5'));var JSDOM=require(_0x3c80('0x6'))['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require(_0x3c80('0x7'));var db=require(_0x3c80('0x8'))['db'];var dbH=require(_0x3c80('0x8'))[_0x3c80('0x9')];var logger=require('../../config/logger')(_0x3c80('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x3c80('0xb')][0x2]);var QUERY=process[_0x3c80('0xb')][0x3];var PATH=process[_0x3c80('0xb')][0x4];var NAME=process[_0x3c80('0xb')][0x5];var FORMAT=_0x3c80('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1ef7e3,_0x2d908b){var _0x4ee514={'status':_0x1ef7e3};var _0x189935={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2d908b){_0x4ee514[_0x3c80('0xd')]=_0x2d908b;}return db[_0x3c80('0xe')][_0x3c80('0xf')](_0x4ee514,_0x189935);}function getHeaders(_0x373013){return _[_0x3c80('0x10')](_0x373013,function(_0x3e4873){return{'text':_0x3e4873,'style':_0x3c80('0x11')};});}function getRows(_0x2fcea9,_0x13a286){return _[_0x3c80('0x10')](_0x13a286,function(_0x2be976){return _(_0x2be976)[_0x3c80('0x12')](_0x2fcea9)['map'](function(_0x389ebe){return _0x389ebe?_[_0x3c80('0x13')](_0x389ebe):'';})[_0x3c80('0x14')]();});}function createTable(_0x638f46,_0x2e87be){var _0x25cd68={'widths':_[_0x3c80('0x15')](Array(_0x638f46[_0x3c80('0x16')]),0x91),'heights':function(_0x2382c9){return _0x2382c9===0x0?_0x3c80('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4f4028=getHeaders(_0x638f46);_0x25cd68[_0x3c80('0x18')][_0x3c80('0x19')](_0x4f4028);var _0x5c2a27=getRows(_0x638f46,_0x2e87be);_0x25cd68[_0x3c80('0x18')]=_0x25cd68['body'][_0x3c80('0x1a')](_0x5c2a27);return _0x25cd68;}function createTables(_0x413a11){var _0x29fd93=[];var _0x14ecc8=_[_0x3c80('0x1b')](Object[_0x3c80('0x1c')](_0x413a11[0x0]),0x5);_0x14ecc8[_0x3c80('0x1d')](function(_0x59efcc){_0x29fd93[_0x3c80('0x19')](createTable(_0x59efcc,_0x413a11));});return _0x29fd93;}function getPDFDocDefinition(_0x14aa86){var _0x28cfe4=util[_0x3c80('0x1e')](_0x3c80('0x1f'),NAME,EXTRACTED_REPORT[_0x3c80('0x20')],moment(EXTRACTED_REPORT[_0x3c80('0x21')])[_0x3c80('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0x3c80('0x22')])[_0x3c80('0x1e')](FORMAT));var _0x28b2fa=[];for(var _0xaf05ae=0x0;_0xaf05ae<_0x14aa86[_0x3c80('0x16')];_0xaf05ae++){var _0x3990ac=[];if(_0xaf05ae===0x0){_0x3990ac[_0x3c80('0x19')]({'text':_0x28cfe4,'style':'header'});}var _0x36671d={'table':_0x14aa86[_0xaf05ae]};if(_0xaf05ae>0x0){_0x36671d[_0x3c80('0x23')]='before';_0x36671d[_0x3c80('0x24')]=[0x0,0x46,0x0,0x0];}_0x3990ac[_0x3c80('0x19')](_0x36671d);_0x28b2fa['push'](_0x3990ac);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x28b2fa,'footer':function(_0x48e3c8,_0x48212a){return{'text':_0x48e3c8[_0x3c80('0x13')]()+_0x3c80('0x25')+_0x48212a,'style':_0x3c80('0x26')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x3c80('0x27')},'footer':{'alignment':_0x3c80('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x6c5001){var _0x35b1b1=0x1388;var _0x58159c;if(!_0x6c5001[0x0][_0x3c80('0x29')]){return analyticExtractedReport(_0x3c80('0x2a'));}return db[_0x3c80('0x2b')][_0x3c80('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3c80('0x2d'),'splitSizePdf']})['then'](function(_0x31e8d2){if(_0x31e8d2){_0x58159c=_0x31e8d2;_0x35b1b1=_0x58159c['splitSizePdf']||0x3e8;}})[_0x3c80('0x2e')](function(){var _0x327fc1=[];var _0x51020a=0x0;if(_0x58159c['split']){if(_0x6c5001&&_0x6c5001['length']){var _0xb4c9ab=_['range'](_0x6c5001[0x0][_0x3c80('0x29')]/_0x35b1b1);var _0x1d0c37=Number['isInteger'](_0x6c5001[0x0][_0x3c80('0x29')]/_0x35b1b1)?_0x6c5001[0x0][_0x3c80('0x29')]%_0x35b1b1:0x0;_0xb4c9ab[_0x3c80('0x1d')](function(_0x1fcf86){if(_0x1fcf86>0x0){_0x51020a+=_0x35b1b1;}_0x327fc1[_0x3c80('0x19')](dbH['sequelize'][_0x3c80('0x2f')](util[_0x3c80('0x1e')](_0x3c80('0x30'),QUERY,_0x35b1b1,_0x51020a),{'type':dbH[_0x3c80('0x31')][_0x3c80('0x32')]['SELECT']}));});if(_0x1d0c37>0x0){_0x51020a+=_0x35b1b1;_0x327fc1['push'](dbH['sequelize'][_0x3c80('0x2f')](util[_0x3c80('0x1e')](_0x3c80('0x30'),QUERY,_0x1d0c37,_0x51020a),{'type':dbH[_0x3c80('0x31')][_0x3c80('0x32')][_0x3c80('0x33')]}));}}}else{_0x327fc1[_0x3c80('0x19')](dbH[_0x3c80('0x31')][_0x3c80('0x2f')](QUERY,{'type':dbH[_0x3c80('0x31')][_0x3c80('0x32')]['SELECT']}));}var _0x5e8000=path[_0x3c80('0x34')](PATH);var _0x294824=path[_0x3c80('0x35')](PATH,_0x3c80('0x36'));var _0x43cab7=_0x58159c[_0x3c80('0x2d')]&&_0x327fc1[_0x3c80('0x16')]>0x1;var _0x37508e=[];if(!fs[_0x3c80('0x37')](path['join'](_0x5e8000,_0x294824))&&_0x43cab7){fs[_0x3c80('0x38')](path[_0x3c80('0x39')](_0x5e8000,_0x294824));}return BPromise[_0x3c80('0x3a')](_0x327fc1,function(_0x11d796){_0x37508e['push'](_0x11d796);})[_0x3c80('0x2e')](function(){var _0x2676c0=[];for(var _0x1264da=0x0;_0x1264da<_0x37508e['length'];_0x1264da+=0x1){var _0x2fced9=_0x37508e[_0x1264da];var _0x3d28fc=createTables(_[_0x3c80('0x3b')](_0x2fced9));var _0x4ab48c;var _0x2d88c7=getPDFDocDefinition(_0x3d28fc);var _0x5837b6=getPDFPrinter();var _0x3021bf=_0x5837b6[_0x3c80('0x3c')](_0x2d88c7);if(_0x43cab7){_0x4ab48c=path[_0x3c80('0x39')](_0x5e8000,_0x294824,util[_0x3c80('0x1e')](_0x3c80('0x3d'),_0x294824,_0x1264da,_0x3c80('0x3e')));}else{_0x4ab48c=path['join'](_0x5e8000,util[_0x3c80('0x1e')](_0x3c80('0x3f'),_0x294824,'pdf'));}_0x2676c0[_0x3c80('0x19')](writePDFDocument(_0x3021bf,_0x4ab48c));}return Promise[_0x3c80('0x40')](_0x2676c0);})[_0x3c80('0x2e')](function(){if(_0x43cab7){return new Promise(function(_0x4f01a2){zipdir(path[_0x3c80('0x39')](_0x5e8000,_0x294824),{'saveTo':path[_0x3c80('0x39')](_0x5e8000,util[_0x3c80('0x1e')](_0x3c80('0x3f'),_0x294824,'zip'))},function(){rimraf(path['join'](_0x5e8000,_0x294824),function(){});_0x4f01a2(_0x3c80('0x41'));});});}})[_0x3c80('0x2e')](function(){if(!_0x43cab7)return;rimraf(path[_0x3c80('0x39')](_0x5e8000,_0x294824),function(){});})[_0x3c80('0x2e')](function(){logger[_0x3c80('0x42')](util[_0x3c80('0x1e')](_0x3c80('0x43'),EXTRACTED_REPORT_ID,_0x3c80('0x44')));return analyticExtractedReport(_0x3c80('0x45'),_0x43cab7?util['format'](_0x3c80('0x3f'),_0x294824,_0x43cab7?'zip':_0x3c80('0x3e')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x3c80('0x42')](util['format'](_0x3c80('0x46'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x3c80('0xe')][_0x3c80('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x3f2363){EXTRACTED_REPORT=_0x3f2363;return dbH[_0x3c80('0x31')][_0x3c80('0x2f')](util['format'](_0x3c80('0x48'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x3c80('0x33')]});})['then'](extractReport)['catch'](function(_0x25b61c){logger[_0x3c80('0x42')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'),util[_0x3c80('0x49')](_0x25b61c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3c80('0x4a'));})[_0x3c80('0x4b')](function(){process[_0x3c80('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x4cbfda=new PdfPrinter({'Arial':{'normal':__dirname+_0x3c80('0x4d'),'bold':__dirname+_0x3c80('0x4e'),'italics':__dirname+_0x3c80('0x4f'),'bolditalics':__dirname+_0x3c80('0x50')}});return _0x4cbfda;}function getPDFDocDefinitionFromHTML(_0xd887ca,_0x8c0f86){var _0x476b3a=util[_0x3c80('0x1e')](_0x3c80('0x51'),_0x8c0f86[_0x3c80('0x52')],_0x8c0f86[_0x3c80('0x53')]);var _0x4e8b40=moment()[_0x3c80('0x1e')](_0x3c80('0x54'))['toString']();var _0x537fba=htmlToPdfmake(_0xd887ca,{'window':window,'tableAutoSize':!![]});return{'content':[_0x537fba],'defaultStyle':{'font':_0x3c80('0x55')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x3c80('0x56'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x3c80('0x56'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x3c80('0x56')}},'header':function(){return[{'text':_0x3c80('0x57'),'style':'header'}];},'footer':function(_0x287eca,_0x331ff1){return[{'text':util['format'](_0x3c80('0x58'),_0x476b3a,_0x287eca,_0x331ff1,_0x4e8b40),'style':_0x3c80('0x26')}];}};}function writePDFDocument(_0x355be4,_0x38b131){return new Promise(function(_0x2d4b36,_0x554830){var _0x378547=_0x355be4[_0x3c80('0x59')](fs[_0x3c80('0x5a')](_0x38b131));_0x378547['on'](_0x3c80('0x5b'),function(){_0x2d4b36(_0x3c80('0x5b'));});_0x378547['on'](_0x3c80('0x5c'),function(_0x5742fd){_0x554830(_0x5742fd);});_0x355be4[_0x3c80('0x5d')]();});}exports['createPdfFromHTML']=function(_0x37b299,_0x161a48){var _0x37800c=getPDFPrinter();var _0x5d4120=getPDFDocDefinitionFromHTML(_0x37b299,_0x161a48);var _0x2da19a=_0x37800c[_0x3c80('0x3c')](_0x5d4120);return writePDFDocument(_0x2da19a,_0x161a48[_0x3c80('0x1')])[_0x3c80('0x5e')](function(_0x2c1ca6){throw _0x2c1ca6;});}; \ No newline at end of file +var _0x63aa=['flatten','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','inspect','Failed','finally','exit','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','end','createPdfFromHTML','path','lodash','util','moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','fill','length','auto','body','concat','chunk','keys','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','header','pageBreak','before','margin','landscape','footer','Arial','black','right','num','Empty','Setting','split','splitSizePdf','then','range','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','mkdirSync','each'];(function(_0x420c44,_0x11af5b){var _0x138afb=function(_0x3e52f5){while(--_0x3e52f5){_0x420c44['push'](_0x420c44['shift']());}};_0x138afb(++_0x11af5b);}(_0x63aa,0x140));var _0xa63a=function(_0x5dc23e,_0x45a9cf){_0x5dc23e=_0x5dc23e-0x0;var _0x19e8c2=_0x63aa[_0x5dc23e];return _0x19e8c2;};'use strict';var _=require(_0xa63a('0x0'));var fs=require('fs');var util=require(_0xa63a('0x1'));var path=require('path');var moment=require(_0xa63a('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xa63a('0x3'));var zipdir=require(_0xa63a('0x4'));var rimraf=require(_0xa63a('0x5'));var JSDOM=require(_0xa63a('0x6'))[_0xa63a('0x7')];var window=new JSDOM('')[_0xa63a('0x8')];var BPromise=require(_0xa63a('0x9'));var db=require(_0xa63a('0xa'))['db'];var dbH=require(_0xa63a('0xa'))[_0xa63a('0xb')];var logger=require(_0xa63a('0xc'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xa63a('0xd')][0x2]);var QUERY=process[_0xa63a('0xd')][0x3];var PATH=process[_0xa63a('0xd')][0x4];var NAME=process[_0xa63a('0xd')][0x5];var FORMAT=_0xa63a('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4c978f,_0x2b277b){var _0x44dd13={'status':_0x4c978f};var _0x12066d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2b277b){_0x44dd13[_0xa63a('0xf')]=_0x2b277b;}return db[_0xa63a('0x10')][_0xa63a('0x11')](_0x44dd13,_0x12066d);}function getHeaders(_0x45bd37){return _[_0xa63a('0x12')](_0x45bd37,function(_0x347649){return{'text':_0x347649,'style':_0xa63a('0x13')};});}function getRows(_0xee5113,_0x26b0f4){return _[_0xa63a('0x12')](_0x26b0f4,function(_0x4e47d8){return _(_0x4e47d8)[_0xa63a('0x14')](_0xee5113)[_0xa63a('0x12')](function(_0x13efbb){return _0x13efbb?_[_0xa63a('0x15')](_0x13efbb):'';})['value']();});}function createTable(_0x4e2dd1,_0x6ba8d){var _0x360026={'widths':_[_0xa63a('0x16')](Array(_0x4e2dd1[_0xa63a('0x17')]),0x91),'heights':function(_0x3db001){return _0x3db001===0x0?_0xa63a('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x37c594=getHeaders(_0x4e2dd1);_0x360026[_0xa63a('0x19')]['push'](_0x37c594);var _0x6c185=getRows(_0x4e2dd1,_0x6ba8d);_0x360026[_0xa63a('0x19')]=_0x360026[_0xa63a('0x19')][_0xa63a('0x1a')](_0x6c185);return _0x360026;}function createTables(_0x5abf0e){var _0x3cd7f7=[];var _0x1ae2d5=_[_0xa63a('0x1b')](Object[_0xa63a('0x1c')](_0x5abf0e[0x0]),0x5);_0x1ae2d5['forEach'](function(_0x1faaf6){_0x3cd7f7[_0xa63a('0x1d')](createTable(_0x1faaf6,_0x5abf0e));});return _0x3cd7f7;}function getPDFDocDefinition(_0x25138a){var _0x7c13fa=util[_0xa63a('0x1e')](_0xa63a('0x1f'),NAME,EXTRACTED_REPORT[_0xa63a('0x20')],moment(EXTRACTED_REPORT['startDate'])[_0xa63a('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0xa63a('0x21')])[_0xa63a('0x1e')](FORMAT));var _0x28f837=[];for(var _0x1e7923=0x0;_0x1e7923<_0x25138a[_0xa63a('0x17')];_0x1e7923++){var _0xf73af6=[];if(_0x1e7923===0x0){_0xf73af6['push']({'text':_0x7c13fa,'style':_0xa63a('0x22')});}var _0x3be1af={'table':_0x25138a[_0x1e7923]};if(_0x1e7923>0x0){_0x3be1af[_0xa63a('0x23')]=_0xa63a('0x24');_0x3be1af[_0xa63a('0x25')]=[0x0,0x46,0x0,0x0];}_0xf73af6[_0xa63a('0x1d')](_0x3be1af);_0x28f837['push'](_0xf73af6);}return{'pageSize':'A4','pageOrientation':_0xa63a('0x26'),'content':_0x28f837,'footer':function(_0x435f0c,_0x4c274d){return{'text':_0x435f0c[_0xa63a('0x15')]()+'\x20/\x20'+_0x4c274d,'style':_0xa63a('0x27')};},'defaultStyle':{'font':_0xa63a('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xa63a('0x29')},'footer':{'alignment':_0xa63a('0x2a'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x239250){var _0x19b046=0x1388;var _0x5316b3;if(!_0x239250[0x0][_0xa63a('0x2b')]){return analyticExtractedReport(_0xa63a('0x2c'));}return db[_0xa63a('0x2d')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa63a('0x2e'),_0xa63a('0x2f')]})[_0xa63a('0x30')](function(_0x4ef7fb){if(_0x4ef7fb){_0x5316b3=_0x4ef7fb;_0x19b046=_0x5316b3[_0xa63a('0x2f')]||0x3e8;}})[_0xa63a('0x30')](function(){var _0x4c1033=[];var _0x2d2efd=0x0;if(_0x5316b3[_0xa63a('0x2e')]){if(_0x239250&&_0x239250[_0xa63a('0x17')]){var _0x1631bc=_[_0xa63a('0x31')](_0x239250[0x0]['num']/_0x19b046);var _0x574b5d=Number[_0xa63a('0x32')](_0x239250[0x0][_0xa63a('0x2b')]/_0x19b046)?_0x239250[0x0][_0xa63a('0x2b')]%_0x19b046:0x0;_0x1631bc[_0xa63a('0x33')](function(_0x29819f){if(_0x29819f>0x0){_0x2d2efd+=_0x19b046;}_0x4c1033[_0xa63a('0x1d')](dbH['sequelize'][_0xa63a('0x34')](util[_0xa63a('0x1e')](_0xa63a('0x35'),QUERY,_0x19b046,_0x2d2efd),{'type':dbH[_0xa63a('0x36')][_0xa63a('0x37')][_0xa63a('0x38')]}));});if(_0x574b5d>0x0){_0x2d2efd+=_0x19b046;_0x4c1033[_0xa63a('0x1d')](dbH[_0xa63a('0x36')][_0xa63a('0x34')](util['format'](_0xa63a('0x35'),QUERY,_0x574b5d,_0x2d2efd),{'type':dbH['sequelize']['QueryTypes'][_0xa63a('0x38')]}));}}}else{_0x4c1033[_0xa63a('0x1d')](dbH[_0xa63a('0x36')][_0xa63a('0x34')](QUERY,{'type':dbH[_0xa63a('0x36')][_0xa63a('0x37')][_0xa63a('0x38')]}));}var _0x373fcf=path[_0xa63a('0x39')](PATH);var _0xc5ed37=path[_0xa63a('0x3a')](PATH,_0xa63a('0x3b'));var _0x3a56f3=_0x5316b3[_0xa63a('0x2e')]&&_0x4c1033[_0xa63a('0x17')]>0x1;var _0x2c3331=[];if(!fs[_0xa63a('0x3c')](path[_0xa63a('0x3d')](_0x373fcf,_0xc5ed37))&&_0x3a56f3){fs[_0xa63a('0x3e')](path['join'](_0x373fcf,_0xc5ed37));}return BPromise[_0xa63a('0x3f')](_0x4c1033,function(_0x14f913){_0x2c3331['push'](_0x14f913);})[_0xa63a('0x30')](function(){var _0x4bf026=[];for(var _0x117789=0x0;_0x117789<_0x2c3331[_0xa63a('0x17')];_0x117789+=0x1){var _0x3ba9a4=_0x2c3331[_0x117789];var _0x11aa65=createTables(_[_0xa63a('0x40')](_0x3ba9a4));var _0x4baf72;var _0x49cd8e=getPDFDocDefinition(_0x11aa65);var _0x5f1097=getPDFPrinter();var _0x15c523=_0x5f1097[_0xa63a('0x41')](_0x49cd8e);if(_0x3a56f3){_0x4baf72=path['join'](_0x373fcf,_0xc5ed37,util[_0xa63a('0x1e')](_0xa63a('0x42'),_0xc5ed37,_0x117789,_0xa63a('0x43')));}else{_0x4baf72=path[_0xa63a('0x3d')](_0x373fcf,util['format']('%s.%s',_0xc5ed37,_0xa63a('0x43')));}_0x4bf026[_0xa63a('0x1d')](writePDFDocument(_0x15c523,_0x4baf72));}return Promise[_0xa63a('0x44')](_0x4bf026);})['then'](function(){if(_0x3a56f3){return new Promise(function(_0x10e39d){zipdir(path[_0xa63a('0x3d')](_0x373fcf,_0xc5ed37),{'saveTo':path[_0xa63a('0x3d')](_0x373fcf,util['format'](_0xa63a('0x45'),_0xc5ed37,_0xa63a('0x46')))},function(){rimraf(path[_0xa63a('0x3d')](_0x373fcf,_0xc5ed37),function(){});_0x10e39d(_0xa63a('0x47'));});});}})[_0xa63a('0x30')](function(){if(!_0x3a56f3)return;rimraf(path['join'](_0x373fcf,_0xc5ed37),function(){});})[_0xa63a('0x30')](function(){logger[_0xa63a('0x48')](util[_0xa63a('0x1e')](_0xa63a('0x49'),EXTRACTED_REPORT_ID,_0xa63a('0x4a')));return analyticExtractedReport(_0xa63a('0x4b'),_0x3a56f3?util['format'](_0xa63a('0x45'),_0xc5ed37,_0x3a56f3?_0xa63a('0x46'):_0xa63a('0x43')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xa63a('0x48')](util[_0xa63a('0x1e')](_0xa63a('0x4c'),EXTRACTED_REPORT_ID,_0xa63a('0x4a')));return db['AnalyticExtractedReport'][_0xa63a('0x4d')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xa63a('0x30')](function(_0x1b7f7d){EXTRACTED_REPORT=_0x1b7f7d;return dbH['sequelize'][_0xa63a('0x34')](util[_0xa63a('0x1e')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xa63a('0x38')]});})[_0xa63a('0x30')](extractReport)[_0xa63a('0x4e')](function(_0x100767){logger[_0xa63a('0x48')](util[_0xa63a('0x1e')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa63a('0x4a')),util[_0xa63a('0x4f')](_0x100767,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa63a('0x50'));})[_0xa63a('0x51')](function(){process[_0xa63a('0x52')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x36e56d=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xa63a('0x53'),'bolditalics':__dirname+_0xa63a('0x54')}});return _0x36e56d;}function getPDFDocDefinitionFromHTML(_0xfd0e36,_0x5e04a3){var _0x23663a=util[_0xa63a('0x1e')]('%s\x20#%d',_0x5e04a3['channel'],_0x5e04a3[_0xa63a('0x55')]);var _0x5311db=moment()[_0xa63a('0x1e')](_0xa63a('0x56'))[_0xa63a('0x15')]();var _0x20e26c=htmlToPdfmake(_0xfd0e36,{'window':window,'tableAutoSize':!![]});return{'content':[_0x20e26c],'defaultStyle':{'font':_0xa63a('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xa63a('0x57'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xa63a('0x57'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xa63a('0x57')}},'header':function(){return[{'text':_0xa63a('0x58'),'style':'header'}];},'footer':function(_0x2fa5d9,_0x4b6643){return[{'text':util['format'](_0xa63a('0x59'),_0x23663a,_0x2fa5d9,_0x4b6643,_0x5311db),'style':_0xa63a('0x27')}];}};}function writePDFDocument(_0x27cd9f,_0x5a9236){return new Promise(function(_0x58e4f7,_0x2aa283){var _0x4f3d69=_0x27cd9f[_0xa63a('0x5a')](fs['createWriteStream'](_0x5a9236));_0x4f3d69['on'](_0xa63a('0x5b'),function(){_0x58e4f7(_0xa63a('0x5b'));});_0x4f3d69['on'](_0xa63a('0x5c'),function(_0x58d528){_0x2aa283(_0x58d528);});_0x27cd9f[_0xa63a('0x5d')]();});}exports[_0xa63a('0x5e')]=function(_0x68aea8,_0x5a1694){var _0x542b27=getPDFPrinter();var _0x4a736e=getPDFDocDefinitionFromHTML(_0x68aea8,_0x5a1694);var _0x3cfb0e=_0x542b27['createPdfKitDocument'](_0x4a736e);return writePDFDocument(_0x3cfb0e,_0x5a1694[_0xa63a('0x5f')])['catch'](function(_0x4b5662){throw _0x4b5662;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 031f65e..70da5e2 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 _0x27d6=['../../config/logger','analytics','argv','AnalyticExtractedReport','info','format','XLSX','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','length','existsSync','mkdirSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','bluebird','rimraf','../../mysqldb','dbH'];(function(_0x22fc1d,_0x5b8ee1){var _0x29e032=function(_0x69e18a){while(--_0x69e18a){_0x22fc1d['push'](_0x22fc1d['shift']());}};_0x29e032(++_0x5b8ee1);}(_0x27d6,0x14a));var _0x627d=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x27d6[_0x1e7b16];return _0x37fadc;};'use strict';var util=require(_0x627d('0x0'));var path=require(_0x627d('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x627d('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x627d('0x3'));var db=require(_0x627d('0x4'))['db'];var dbH=require(_0x627d('0x4'))[_0x627d('0x5')];var logger=require(_0x627d('0x6'))(_0x627d('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x627d('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x627d('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1a0da1,_0x15984e){var _0x16e7af={'status':_0x1a0da1};var _0x3db293={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x15984e){_0x16e7af['savename']=_0x15984e;}return db[_0x627d('0x9')]['update'](_0x16e7af,_0x3db293);}function main(){var _0x170786=0x1388;var _0x44731c;logger[_0x627d('0xa')](util[_0x627d('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x627d('0xc')));return db['Setting'][_0x627d('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x627d('0xe'),_0x627d('0xf')]})[_0x627d('0x10')](function(_0x1ad092){if(_0x1ad092){_0x44731c=_0x1ad092;_0x170786=_0x44731c[_0x627d('0xf')]||0x1388;}})['then'](function(){return dbH[_0x627d('0x11')][_0x627d('0x12')](util[_0x627d('0xb')](_0x627d('0x13'),QUERY),{'type':dbH[_0x627d('0x11')][_0x627d('0x14')][_0x627d('0x15')]});})[_0x627d('0x10')](function(_0x2e98b3){if(!_0x2e98b3[0x0][_0x627d('0x16')]){return analyticExtractedReport(_0x627d('0x17'));}var _0x3f8d48=[];var _0x1dc9cc=0x0;if(_0x44731c[_0x627d('0xe')]){if(_0x2e98b3&&_0x2e98b3['length']){var _0x18f12a=_[_0x627d('0x18')](_0x2e98b3[0x0][_0x627d('0x16')]/_0x170786);var _0x169c96=Number[_0x627d('0x19')](_0x2e98b3[0x0][_0x627d('0x16')]/_0x170786)?_0x2e98b3[0x0][_0x627d('0x16')]%_0x170786:0x0;_0x18f12a[_0x627d('0x1a')](function(_0x3bdad0){if(_0x3bdad0>0x0){_0x1dc9cc+=_0x170786;}_0x3f8d48[_0x627d('0x1b')](dbH[_0x627d('0x11')]['query'](util[_0x627d('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x170786,_0x1dc9cc),{'type':dbH[_0x627d('0x11')][_0x627d('0x14')]['SELECT']}));});if(_0x169c96>0x0){_0x1dc9cc+=_0x170786;_0x3f8d48['push'](dbH[_0x627d('0x11')][_0x627d('0x12')](util[_0x627d('0xb')](_0x627d('0x1c'),QUERY,_0x169c96,_0x1dc9cc),{'type':dbH[_0x627d('0x11')][_0x627d('0x14')][_0x627d('0x15')]}));}}}else{_0x3f8d48[_0x627d('0x1b')](dbH[_0x627d('0x11')][_0x627d('0x12')](QUERY,{'type':dbH['sequelize'][_0x627d('0x14')][_0x627d('0x15')]}));}var _0x2b800e=path[_0x627d('0x1d')](PATH);var _0x264267=path[_0x627d('0x1e')](PATH,_0x627d('0x1f'));var _0xc9b740=_0x44731c[_0x627d('0xe')]&&_0x3f8d48[_0x627d('0x20')]>0x1;var _0x4a7d5c=[];if(!fs[_0x627d('0x21')](path['join'](_0x2b800e,_0x264267))&&_0xc9b740){fs[_0x627d('0x22')](path[_0x627d('0x23')](_0x2b800e,_0x264267));}return BPromise[_0x627d('0x24')](_0x3f8d48,function(_0x194714){_0x4a7d5c['push'](_0x194714);})[_0x627d('0x10')](function(){for(var _0xa151bf=0x0;_0xa151bf<_0x4a7d5c[_0x627d('0x20')];_0xa151bf+=0x1){var _0x4dc3b7;var _0x2c304c=_0x4a7d5c[_0xa151bf];if(_0xc9b740){_0x4dc3b7=path[_0x627d('0x23')](_0x2b800e,_0x264267,util[_0x627d('0xb')](_0x627d('0x25'),_0x264267,_0xa151bf,_0x627d('0x26')));}else{_0x4dc3b7=path['join'](_0x2b800e,util[_0x627d('0xb')](_0x627d('0x27'),_0x264267,_0x627d('0x26')));}fs[_0x627d('0x28')](_0x4dc3b7,json2xls(_0x2c304c),'binary');}})['then'](function(){if(_0xc9b740){return new Promise(function(_0x1f07ad){zipdir(path['join'](_0x2b800e,_0x264267),{'saveTo':path[_0x627d('0x23')](_0x2b800e,util[_0x627d('0xb')](_0x627d('0x27'),_0x264267,_0x627d('0x29')))},function(_0x9c26c7,_0x4dfdd3){rimraf(path['join'](_0x2b800e,_0x264267),function(){});_0x1f07ad(_0x627d('0x2a'));});});}})[_0x627d('0x10')](function(){logger[_0x627d('0xa')](util[_0x627d('0xb')](_0x627d('0x2b'),EXTRACTED_REPORT_ID,_0x627d('0xc')));return analyticExtractedReport('Completed',_0xc9b740?util[_0x627d('0xb')](_0x627d('0x27'),_0x264267,_0xc9b740?_0x627d('0x29'):_0x627d('0x26')):null);});})[_0x627d('0x2c')](function(_0x5e908e){logger[_0x627d('0xa')](util[_0x627d('0xb')](_0x627d('0x2d'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x627d('0x2e')](_0x5e908e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x627d('0x2f'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xe2b9=['forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename','.xlsx','existsSync','mkdirSync','join','each','length','xlsx','%s.%s','binary','zip','inspect','Failed','finally','exit','util','lodash','json2xls','bluebird','rimraf','../../mysqldb','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','then','query','sequelize','SELECT','num','Empty','isInteger'];(function(_0x401676,_0x3f1436){var _0x4f13fe=function(_0xd2f197){while(--_0xd2f197){_0x401676['push'](_0x401676['shift']());}};_0x4f13fe(++_0x3f1436);}(_0xe2b9,0x140));var _0x9e2b=function(_0x36940e,_0x11f338){_0x36940e=_0x36940e-0x0;var _0x3283f2=_0xe2b9[_0x36940e];return _0x3283f2;};'use strict';var util=require(_0x9e2b('0x0'));var path=require('path');var _=require(_0x9e2b('0x1'));var fs=require('fs');var json2xls=require(_0x9e2b('0x2'));var BPromise=require(_0x9e2b('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x9e2b('0x4'));var db=require(_0x9e2b('0x5'))['db'];var dbH=require(_0x9e2b('0x5'))['dbH'];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x9e2b('0x6')][0x3];var PATH=process[_0x9e2b('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4c4a34,_0x315438){var _0x31d322={'status':_0x4c4a34};var _0xafb2fa={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x315438){_0x31d322[_0x9e2b('0x7')]=_0x315438;}return db[_0x9e2b('0x8')][_0x9e2b('0x9')](_0x31d322,_0xafb2fa);}function main(){var _0x5ed310=0x1388;var _0x5874b5;logger[_0x9e2b('0xa')](util[_0x9e2b('0xb')](_0x9e2b('0xc'),EXTRACTED_REPORT_ID,_0x9e2b('0xd')));return db[_0x9e2b('0xe')][_0x9e2b('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9e2b('0x10'),'splitSizeXlsx']})[_0x9e2b('0x11')](function(_0x4921bf){if(_0x4921bf){_0x5874b5=_0x4921bf;_0x5ed310=_0x5874b5['splitSizeXlsx']||0x1388;}})[_0x9e2b('0x11')](function(){return dbH['sequelize'][_0x9e2b('0x12')](util[_0x9e2b('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x9e2b('0x13')]['QueryTypes'][_0x9e2b('0x14')]});})['then'](function(_0x1bd8b6){if(!_0x1bd8b6[0x0][_0x9e2b('0x15')]){return analyticExtractedReport(_0x9e2b('0x16'));}var _0x82fa4b=[];var _0x4feae9=0x0;if(_0x5874b5[_0x9e2b('0x10')]){if(_0x1bd8b6&&_0x1bd8b6['length']){var _0xd89c61=_['range'](_0x1bd8b6[0x0]['num']/_0x5ed310);var _0x124305=Number[_0x9e2b('0x17')](_0x1bd8b6[0x0][_0x9e2b('0x15')]/_0x5ed310)?_0x1bd8b6[0x0][_0x9e2b('0x15')]%_0x5ed310:0x0;_0xd89c61[_0x9e2b('0x18')](function(_0x5433d4){if(_0x5433d4>0x0){_0x4feae9+=_0x5ed310;}_0x82fa4b[_0x9e2b('0x19')](dbH['sequelize']['query'](util['format'](_0x9e2b('0x1a'),QUERY,_0x5ed310,_0x4feae9),{'type':dbH[_0x9e2b('0x13')][_0x9e2b('0x1b')]['SELECT']}));});if(_0x124305>0x0){_0x4feae9+=_0x5ed310;_0x82fa4b[_0x9e2b('0x19')](dbH[_0x9e2b('0x13')][_0x9e2b('0x12')](util['format'](_0x9e2b('0x1a'),QUERY,_0x124305,_0x4feae9),{'type':dbH[_0x9e2b('0x13')][_0x9e2b('0x1b')][_0x9e2b('0x14')]}));}}}else{_0x82fa4b[_0x9e2b('0x19')](dbH['sequelize'][_0x9e2b('0x12')](QUERY,{'type':dbH[_0x9e2b('0x13')][_0x9e2b('0x1b')][_0x9e2b('0x14')]}));}var _0x1c45e0=path['dirname'](PATH);var _0x26e5c3=path[_0x9e2b('0x1c')](PATH,_0x9e2b('0x1d'));var _0x1cbd7d=_0x5874b5[_0x9e2b('0x10')]&&_0x82fa4b['length']>0x1;var _0x5c3838=[];if(!fs[_0x9e2b('0x1e')](path['join'](_0x1c45e0,_0x26e5c3))&&_0x1cbd7d){fs[_0x9e2b('0x1f')](path[_0x9e2b('0x20')](_0x1c45e0,_0x26e5c3));}return BPromise[_0x9e2b('0x21')](_0x82fa4b,function(_0x6dafb1){_0x5c3838['push'](_0x6dafb1);})['then'](function(){for(var _0x441c8d=0x0;_0x441c8d<_0x5c3838[_0x9e2b('0x22')];_0x441c8d+=0x1){var _0x5e2ec8;var _0x250ed4=_0x5c3838[_0x441c8d];if(_0x1cbd7d){_0x5e2ec8=path[_0x9e2b('0x20')](_0x1c45e0,_0x26e5c3,util[_0x9e2b('0xb')]('%s%d.%s',_0x26e5c3,_0x441c8d,_0x9e2b('0x23')));}else{_0x5e2ec8=path[_0x9e2b('0x20')](_0x1c45e0,util['format'](_0x9e2b('0x24'),_0x26e5c3,_0x9e2b('0x23')));}fs['writeFileSync'](_0x5e2ec8,json2xls(_0x250ed4),_0x9e2b('0x25'));}})[_0x9e2b('0x11')](function(){if(_0x1cbd7d){return new Promise(function(_0x38d219){zipdir(path[_0x9e2b('0x20')](_0x1c45e0,_0x26e5c3),{'saveTo':path[_0x9e2b('0x20')](_0x1c45e0,util[_0x9e2b('0xb')]('%s.%s',_0x26e5c3,_0x9e2b('0x26')))},function(_0x205090,_0x3df54f){rimraf(path[_0x9e2b('0x20')](_0x1c45e0,_0x26e5c3),function(){});_0x38d219('zip\x20finished');});});}})[_0x9e2b('0x11')](function(){logger[_0x9e2b('0xa')](util[_0x9e2b('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x9e2b('0xd')));return analyticExtractedReport('Completed',_0x1cbd7d?util[_0x9e2b('0xb')](_0x9e2b('0x24'),_0x26e5c3,_0x1cbd7d?_0x9e2b('0x26'):_0x9e2b('0x23')):null);});})['catch'](function(_0x253914){logger['info'](util[_0x9e2b('0xb')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9e2b('0xd')),util[_0x9e2b('0x27')](_0x253914,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9e2b('0x28'));})[_0x9e2b('0x29')](function(){process[_0x9e2b('0x2a')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index a91d94c..4590570 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 _0x393f=['none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','map','tag','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','appType','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','catch','error','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','exten','push','type','Set','format','CDR(type)=%s','context','inbound','VoiceExtensionId','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0x393f,0xea));var _0xf393=function(_0x48e550,_0x120e2c){_0x48e550=_0x48e550-0x0;var _0x341d3c=_0x393f[_0x48e550];return _0x341d3c;};'use strict';var _=require(_0xf393('0x0'));var util=require(_0xf393('0x1'));function rewrite(_0x57240b,_0x12aeee){var _0x24f344=this;return _0x57240b[_0xf393('0x2')][_0xf393('0x3')][_0xf393('0x4')]({'raw':!![]})[_0xf393('0x5')](function(_0x49a9b3){_0x24f344[_0xf393('0x6')]=_0x49a9b3;return _0x57240b[_0xf393('0x2')][_0xf393('0x7')][_0xf393('0x4')]({'where':{'IntervalId':_0x12aeee[_0xf393('0x8')]},'raw':!![]});})[_0xf393('0x5')](function(_0xcc243){return _0x57240b[_0xf393('0x2')][_0xf393('0x7')]['findAll']({'where':{'exten':{'$in':_[_0xf393('0x9')](_['map'](_0xcc243,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x251ffb){var _0x7ce1a0=_[_0xf393('0xa')](_0x251ffb,{'priority':'1'});var _0x2ff269=_['filter'](_0x251ffb,{'isApp':0x1});var _0x1cd7cd=_[_0xf393('0xb')](_0x2ff269,'exten');var _0x3ec371=[_0xf393('0xc'),_0xf393('0xd')];var _0x5afae8=[];var _0x15a8b1=[];for(var _0x24dcd0 in _0x1cd7cd){if(_0x1cd7cd[_0xf393('0xe')](_0x24dcd0)){_0x24f344[_0xf393('0xf')]=0x2;_0x24f344[_0xf393('0x10')]=[];_0x24f344[_0xf393('0x11')]=_[_0xf393('0x12')](_0x7ce1a0,{'exten':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x13')]});_0x24f344[_0xf393('0x10')][_0xf393('0x14')]({'type':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x15')],'app':_0xf393('0x16'),'appdata':util[_0xf393('0x17')](_0xf393('0x18'),_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x15')]),'context':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x19')],'exten':_0x1cd7cd[_0x24dcd0][0x0]['exten'],'priority':_0x24f344['priority']++,'VoiceExtensionId':_0x1cd7cd[_0x24dcd0][0x0]['VoiceExtensionId']});if(_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x15')]===_0xf393('0x1a')){_0x24f344[_0xf393('0x10')][_0xf393('0x14')]({'type':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x15')],'app':_0xf393('0x16'),'appdata':'CDR(routeid)='+_0x1cd7cd[_0x24dcd0][0x0]['VoiceExtensionId'],'context':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x19')],'exten':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x13')],'priority':_0x24f344['priority']++,'VoiceExtensionId':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x1b')]});}else if(_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x15')]==='outbound'){if(_0x24f344['extension']){_0x24f344[_0xf393('0x10')][_0xf393('0x14')]({'type':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x15')],'app':'Set','appdata':_0xf393('0x1c')+(_0x24f344[_0xf393('0x11')]['cutdigits']?'${EXTEN:'+_0x24f344[_0xf393('0x11')][_0xf393('0x1d')]+'}':_0xf393('0x1e')),'context':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x19')],'exten':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x13')],'priority':_0x24f344[_0xf393('0xf')]++,'VoiceExtensionId':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x1b')]});}_0x24f344[_0xf393('0x10')][_0xf393('0x14')]({'type':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x15')],'app':_0xf393('0x16'),'appdata':_0xf393('0x1f')+_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x1b')],'context':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x19')],'exten':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x13')],'priority':_0x24f344['priority']++,'VoiceExtensionId':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x1b')]});var _0x53366f=_0x24f344[_0xf393('0xf')]++;_0x24f344[_0xf393('0x10')][_0xf393('0x14')]({'type':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x15')],'app':_0xf393('0x20'),'appdata':_0xf393('0x21')+(_0x53366f+0x2)+_0xf393('0x22')+(_0x53366f+0x1)+')','context':_0x1cd7cd[_0x24dcd0][0x0]['context'],'exten':_0x1cd7cd[_0x24dcd0][0x0]['exten'],'priority':_0x53366f,'VoiceExtensionId':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x1b')]});if(_0x24f344[_0xf393('0x11')]){_0x24f344[_0xf393('0x10')][_0xf393('0x14')]({'type':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x15')],'app':_0xf393('0x16'),'appdata':_0x24f344[_0xf393('0x11')][_0xf393('0x1d')]?'CDR(prefix)=${EXTEN:0:'+_0x24f344[_0xf393('0x11')][_0xf393('0x1d')]+'}':_0xf393('0x23'),'context':_0x1cd7cd[_0x24dcd0][0x0]['context'],'exten':_0x1cd7cd[_0x24dcd0][0x0]['exten'],'priority':_0x24f344[_0xf393('0xf')]++,'VoiceExtensionId':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x1b')]});}_0x24f344[_0xf393('0x10')]['push']({'type':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x15')],'app':_0xf393('0x16'),'appdata':_0xf393('0x24')+_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x1b')],'context':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x19')],'exten':_0x1cd7cd[_0x24dcd0][0x0]['exten'],'priority':_0x24f344['priority']++,'VoiceExtensionId':_0x1cd7cd[_0x24dcd0][0x0]['VoiceExtensionId']});if(_0x24f344[_0xf393('0x11')]&&_0x24f344['extension'][_0xf393('0xe')](_0xf393('0x25'))&&_0x24f344[_0xf393('0x11')][_0xf393('0x25')]!==_0xf393('0x26')){_0x24f344['extensions']['push']({'type':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x15')],'app':_0xf393('0x16'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x19')],'exten':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x13')],'priority':_0x24f344[_0xf393('0xf')]++,'VoiceExtensionId':_0x1cd7cd[_0x24dcd0][0x0]['VoiceExtensionId']});_0x24f344[_0xf393('0x10')][_0xf393('0x14')]({'type':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x15')],'app':_0xf393('0x16'),'appdata':_0xf393('0x27')+_0x24f344[_0xf393('0x11')][_0xf393('0x25')]||_0xf393('0x28'),'context':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x19')],'exten':_0x1cd7cd[_0x24dcd0][0x0]['exten'],'priority':_0x24f344[_0xf393('0xf')]++,'VoiceExtensionId':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x1b')]});}}_0x24f344[_0xf393('0x10')]['push']({'type':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x15')],'app':'Set','appdata':_0xf393('0x29'),'context':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x19')],'exten':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x13')],'priority':_0x24f344['priority']++,'VoiceExtensionId':_0x1cd7cd[_0x24dcd0][0x0]['VoiceExtensionId']});_0x24f344['extensions'][_0xf393('0x14')]({'type':_0x1cd7cd[_0x24dcd0][0x0]['type'],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x19')],'exten':_0x1cd7cd[_0x24dcd0][0x0]['exten'],'priority':_0x24f344[_0xf393('0xf')]++,'VoiceExtensionId':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x1b')]});_0x24f344['extensions'][_0xf393('0x14')]({'type':_0x1cd7cd[_0x24dcd0][0x0]['type'],'app':_0xf393('0x16'),'appdata':_0xf393('0x2a'),'context':_0x1cd7cd[_0x24dcd0][0x0]['context'],'exten':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x13')],'priority':_0x24f344[_0xf393('0xf')]++,'VoiceExtensionId':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x1b')]});for(var _0x34e18d=0x0,_0x4c6edb=0x0;_0x34e18d<_0x1cd7cd[_0x24dcd0][_0xf393('0x2b')];_0x34e18d+=0x1,_0x4c6edb=0x0){var _0x2320d3=_0x1cd7cd[_0x24dcd0][_0x34e18d];if(_0x2320d3[_0xf393('0x15')]){_0x2320d3['type']=_0x2320d3[_0xf393('0x15')][_0xf393('0x2c')]();}var _0x2bde0c=[];var _0x5c471b=[];delete _0x2320d3['id'];delete _0x2320d3[_0xf393('0x2d')];delete _0x2320d3['updatedAt'];var _0x5b7d71=_0x2320d3[_0xf393('0x2e')]!==_0xf393('0x2f')?[_0x2320d3['interval']]:_0x2320d3[_0xf393('0x8')]?_[_0xf393('0x30')](_[_0xf393('0xa')](_0x24f344[_0xf393('0x6')],{'IntervalId':_0x2320d3[_0xf393('0x8')]}),'interval'):[];if(_0x2320d3['hasOwnProperty']('tag')){if(_0x2320d3[_0xf393('0x31')]&&_0x2320d3[_0xf393('0x31')]!=='--'){_0x2bde0c['push']({'type':_0x2320d3[_0xf393('0x15')],'app':_0xf393('0x16'),'appdata':'CDR(tag)='+_0x2320d3['tag'],'context':_0x2320d3[_0xf393('0x19')],'exten':_0x2320d3['exten'],'priority':_0x5b7d71[_0xf393('0x2b')]+_0x24f344[_0xf393('0xf')]+_0x4c6edb++,'VoiceExtensionId':_0x2320d3[_0xf393('0x1b')]});}}if(_0x2320d3[_0xf393('0x15')]===_0xf393('0x32')&&_0x2320d3[_0xf393('0xe')](_0xf393('0x33'))){if(_0x2320d3[_0xf393('0x33')]){_0x2bde0c[_0xf393('0x14')]({'type':_0x2320d3[_0xf393('0x15')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x2320d3[_0xf393('0x33')]+')','context':_0x2320d3[_0xf393('0x19')],'exten':_0x2320d3['exten'],'priority':_0x5b7d71[_0xf393('0x2b')]+_0x24f344[_0xf393('0xf')]+_0x4c6edb++,'VoiceExtensionId':_0x2320d3[_0xf393('0x1b')]});}else{_0x2bde0c[_0xf393('0x14')]({'type':_0x2320d3['type'],'app':'ExecIf','appdata':_0xf393('0x34'),'context':_0x2320d3[_0xf393('0x19')],'exten':_0x2320d3[_0xf393('0x13')],'priority':_0x5b7d71[_0xf393('0x2b')]+_0x24f344[_0xf393('0xf')]+_0x4c6edb++,'VoiceExtensionId':_0x2320d3[_0xf393('0x1b')]});}}if(_0x2320d3['hasOwnProperty'](_0xf393('0x35'))){if(_0x3ec371['indexOf'](_0x2320d3[_0xf393('0x36')][_0xf393('0x2c')]())>=0x0&&_0x2320d3[_0xf393('0x37')]!==_0xf393('0x38')){if(_0x2320d3[_0xf393('0x35')]){_0x2bde0c['push']({'type':_0x2320d3[_0xf393('0x15')],'app':_0xf393('0x20'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2320d3[_0xf393('0x19')],'exten':_0x2320d3[_0xf393('0x13')],'priority':_0x5b7d71['length']+_0x24f344[_0xf393('0xf')]+_0x4c6edb++,'VoiceExtensionId':_0x2320d3[_0xf393('0x1b')]});_0x2bde0c[_0xf393('0x14')]({'type':_0x2320d3[_0xf393('0x15')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x2320d3[_0xf393('0x19')],'exten':_0x2320d3['exten'],'priority':_0x5b7d71[_0xf393('0x2b')]+_0x24f344['priority']+_0x4c6edb++,'VoiceExtensionId':_0x2320d3[_0xf393('0x1b')]});}else{_0x2bde0c['push']({'type':_0x2320d3[_0xf393('0x15')],'app':_0xf393('0x20'),'appdata':_0xf393('0x39'),'context':_0x2320d3[_0xf393('0x19')],'exten':_0x2320d3[_0xf393('0x13')],'priority':_0x5b7d71[_0xf393('0x2b')]+_0x24f344['priority']+_0x4c6edb++,'VoiceExtensionId':_0x2320d3[_0xf393('0x1b')]});_0x2bde0c[_0xf393('0x14')]({'type':_0x2320d3[_0xf393('0x15')],'app':_0xf393('0x16'),'appdata':_0xf393('0x3a'),'context':_0x2320d3[_0xf393('0x19')],'exten':_0x2320d3[_0xf393('0x13')],'priority':_0x5b7d71[_0xf393('0x2b')]+_0x24f344[_0xf393('0xf')]+_0x4c6edb++,'VoiceExtensionId':_0x2320d3[_0xf393('0x1b')]});}}}for(var _0x29b8b9=0x0;_0x29b8b9<_0x5b7d71[_0xf393('0x2b')];_0x29b8b9+=0x1){var _0x17ccd6=_0x24f344[_0xf393('0xf')]+_0x5b7d71[_0xf393('0x2b')];var _0x210c43=_0x29b8b9===_0x5b7d71[_0xf393('0x2b')]-0x1?_0x24f344['priority']+_0x2bde0c[_0xf393('0x2b')]+_0x5c471b[_0xf393('0x2b')]+0x2:_0x24f344[_0xf393('0xf')]+_0x29b8b9+0x1;_0x2bde0c[_0xf393('0x3b')](_0x29b8b9,0x0,{'type':_0x2320d3[_0xf393('0x15')],'app':_0xf393('0x3c'),'appdata':_0x5b7d71[_0x29b8b9]+'?'+_0x2320d3[_0xf393('0x19')]+_0xf393('0x3d')+_0x17ccd6+':'+_0x2320d3[_0xf393('0x19')]+_0xf393('0x3d')+_0x210c43,'exten':_0x2320d3[_0xf393('0x13')],'context':_0x2320d3[_0xf393('0x19')],'priority':_0x24f344[_0xf393('0xf')]+_0x29b8b9,'VoiceExtensionId':_0x1cd7cd[_0x24dcd0][0x0]['VoiceExtensionId']});}_0x2320d3[_0xf393('0xf')]=_0x2bde0c['length']?_[_0xf393('0x3e')](_0x2bde0c)[_0xf393('0xf')]+0x1:_0x24f344[_0xf393('0xf')];_0x24f344[_0xf393('0xf')]=(_0x5c471b['length']?_[_0xf393('0x3e')](_0x5c471b)[_0xf393('0xf')]:_0x2320d3[_0xf393('0xf')])+0x1;_0x24f344[_0xf393('0x10')]=_[_0xf393('0x3f')](_0x24f344[_0xf393('0x10')],_0x2bde0c,[_0x2320d3],_0x5c471b);}_0x24f344[_0xf393('0x10')]['push']({'type':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x15')],'app':_0xf393('0x40'),'exten':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x13')],'context':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x19')],'priority':_0x24f344[_0xf393('0xf')],'VoiceExtensionId':_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x1b')]});_0x5afae8['push'](_0x1cd7cd[_0x24dcd0][0x0][_0xf393('0x1b')]);_0x15a8b1=_[_0xf393('0x3f')](_0x15a8b1,_0x24f344['extensions']);}}return _0x57240b['transaction'](function(_0x5871b2){return _0x57240b[_0xf393('0x2')][_0xf393('0x7')][_0xf393('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x5afae8}},'transaction':_0x5871b2})[_0xf393('0x5')](function(_0x1a577f){return _0x57240b[_0xf393('0x2')]['VoiceExtension']['bulkCreate'](_['sortBy'](_0x15a8b1,_0xf393('0xf')),{'transaction':_0x5871b2});});});})[_0xf393('0x42')](function(_0x1e7cec){console[_0xf393('0x43')](_0x1e7cec);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0xb9e4=['CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','length','toLowerCase','updatedAt','*,*,*,*','interval','intervals','tag','CDR(tag)=','callerID','answer','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','bulkCreate','sortBy','error','rewrite','lodash','util','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','hasOwnProperty','priority','extensions','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','outbound','extension','push','CDR(destination)=','${EXTEN:','cutdigits','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:'];(function(_0xea413c,_0x57963c){var _0x5a2fbe=function(_0x4bd630){while(--_0x4bd630){_0xea413c['push'](_0xea413c['shift']());}};_0x5a2fbe(++_0x57963c);}(_0xb9e4,0x136));var _0x4b9e=function(_0x478016,_0x1857bf){_0x478016=_0x478016-0x0;var _0x534361=_0xb9e4[_0x478016];return _0x534361;};'use strict';var _=require(_0x4b9e('0x0'));var util=require(_0x4b9e('0x1'));function rewrite(_0x44b6f7,_0x1a38d2){var _0x35f4f6=this;return _0x44b6f7[_0x4b9e('0x2')][_0x4b9e('0x3')][_0x4b9e('0x4')]({'raw':!![]})[_0x4b9e('0x5')](function(_0x2dd0eb){_0x35f4f6['intervals']=_0x2dd0eb;return _0x44b6f7[_0x4b9e('0x2')][_0x4b9e('0x6')][_0x4b9e('0x4')]({'where':{'IntervalId':_0x1a38d2[_0x4b9e('0x7')]},'raw':!![]});})[_0x4b9e('0x5')](function(_0x18256a){return _0x44b6f7[_0x4b9e('0x2')][_0x4b9e('0x6')][_0x4b9e('0x4')]({'where':{'exten':{'$in':_[_0x4b9e('0x8')](_[_0x4b9e('0x9')](_0x18256a,'exten'))}},'order':[{'raw':_0x4b9e('0xa')}],'raw':!![]});})['then'](function(_0x5358c1){var _0x15bed3=_['filter'](_0x5358c1,{'priority':'1'});var _0x326e5a=_[_0x4b9e('0xb')](_0x5358c1,{'isApp':0x1});var _0x217d01=_[_0x4b9e('0xc')](_0x326e5a,_0x4b9e('0xd'));var _0x21ab93=[_0x4b9e('0xe'),'playback'];var _0x441857=[];var _0x35d595=[];for(var _0x402d58 in _0x217d01){if(_0x217d01[_0x4b9e('0xf')](_0x402d58)){_0x35f4f6[_0x4b9e('0x10')]=0x2;_0x35f4f6[_0x4b9e('0x11')]=[];_0x35f4f6['extension']=_['find'](_0x15bed3,{'exten':_0x217d01[_0x402d58][0x0]['exten']});_0x35f4f6['extensions']['push']({'type':_0x217d01[_0x402d58][0x0][_0x4b9e('0x12')],'app':_0x4b9e('0x13'),'appdata':util[_0x4b9e('0x14')](_0x4b9e('0x15'),_0x217d01[_0x402d58][0x0][_0x4b9e('0x12')]),'context':_0x217d01[_0x402d58][0x0][_0x4b9e('0x16')],'exten':_0x217d01[_0x402d58][0x0]['exten'],'priority':_0x35f4f6[_0x4b9e('0x10')]++,'VoiceExtensionId':_0x217d01[_0x402d58][0x0][_0x4b9e('0x17')]});if(_0x217d01[_0x402d58][0x0]['type']==='inbound'){_0x35f4f6[_0x4b9e('0x11')]['push']({'type':_0x217d01[_0x402d58][0x0][_0x4b9e('0x12')],'app':_0x4b9e('0x13'),'appdata':'CDR(routeid)='+_0x217d01[_0x402d58][0x0][_0x4b9e('0x17')],'context':_0x217d01[_0x402d58][0x0][_0x4b9e('0x16')],'exten':_0x217d01[_0x402d58][0x0]['exten'],'priority':_0x35f4f6[_0x4b9e('0x10')]++,'VoiceExtensionId':_0x217d01[_0x402d58][0x0][_0x4b9e('0x17')]});}else if(_0x217d01[_0x402d58][0x0][_0x4b9e('0x12')]===_0x4b9e('0x18')){if(_0x35f4f6[_0x4b9e('0x19')]){_0x35f4f6[_0x4b9e('0x11')][_0x4b9e('0x1a')]({'type':_0x217d01[_0x402d58][0x0][_0x4b9e('0x12')],'app':_0x4b9e('0x13'),'appdata':_0x4b9e('0x1b')+(_0x35f4f6[_0x4b9e('0x19')]['cutdigits']?_0x4b9e('0x1c')+_0x35f4f6[_0x4b9e('0x19')][_0x4b9e('0x1d')]+'}':'${EXTEN}'),'context':_0x217d01[_0x402d58][0x0][_0x4b9e('0x16')],'exten':_0x217d01[_0x402d58][0x0][_0x4b9e('0xd')],'priority':_0x35f4f6[_0x4b9e('0x10')]++,'VoiceExtensionId':_0x217d01[_0x402d58][0x0][_0x4b9e('0x17')]});}_0x35f4f6['extensions']['push']({'type':_0x217d01[_0x402d58][0x0][_0x4b9e('0x12')],'app':'Set','appdata':_0x4b9e('0x1e')+_0x217d01[_0x402d58][0x0][_0x4b9e('0x17')],'context':_0x217d01[_0x402d58][0x0][_0x4b9e('0x16')],'exten':_0x217d01[_0x402d58][0x0][_0x4b9e('0xd')],'priority':_0x35f4f6['priority']++,'VoiceExtensionId':_0x217d01[_0x402d58][0x0][_0x4b9e('0x17')]});var _0x40e2d5=_0x35f4f6[_0x4b9e('0x10')]++;_0x35f4f6[_0x4b9e('0x11')]['push']({'type':_0x217d01[_0x402d58][0x0][_0x4b9e('0x12')],'app':_0x4b9e('0x1f'),'appdata':_0x4b9e('0x20')+(_0x40e2d5+0x2)+_0x4b9e('0x21')+(_0x40e2d5+0x1)+')','context':_0x217d01[_0x402d58][0x0][_0x4b9e('0x16')],'exten':_0x217d01[_0x402d58][0x0][_0x4b9e('0xd')],'priority':_0x40e2d5,'VoiceExtensionId':_0x217d01[_0x402d58][0x0][_0x4b9e('0x17')]});if(_0x35f4f6['extension']){_0x35f4f6[_0x4b9e('0x11')]['push']({'type':_0x217d01[_0x402d58][0x0][_0x4b9e('0x12')],'app':'Set','appdata':_0x35f4f6[_0x4b9e('0x19')][_0x4b9e('0x1d')]?_0x4b9e('0x22')+_0x35f4f6[_0x4b9e('0x19')]['cutdigits']+'}':_0x4b9e('0x23'),'context':_0x217d01[_0x402d58][0x0][_0x4b9e('0x16')],'exten':_0x217d01[_0x402d58][0x0][_0x4b9e('0xd')],'priority':_0x35f4f6[_0x4b9e('0x10')]++,'VoiceExtensionId':_0x217d01[_0x402d58][0x0][_0x4b9e('0x17')]});}_0x35f4f6['extensions'][_0x4b9e('0x1a')]({'type':_0x217d01[_0x402d58][0x0]['type'],'app':_0x4b9e('0x13'),'appdata':_0x4b9e('0x24')+_0x217d01[_0x402d58][0x0][_0x4b9e('0x17')],'context':_0x217d01[_0x402d58][0x0]['context'],'exten':_0x217d01[_0x402d58][0x0][_0x4b9e('0xd')],'priority':_0x35f4f6[_0x4b9e('0x10')]++,'VoiceExtensionId':_0x217d01[_0x402d58][0x0][_0x4b9e('0x17')]});if(_0x35f4f6[_0x4b9e('0x19')]&&_0x35f4f6[_0x4b9e('0x19')]['hasOwnProperty'](_0x4b9e('0x25'))&&_0x35f4f6[_0x4b9e('0x19')]['recordingFormat']!==_0x4b9e('0x26')){_0x35f4f6[_0x4b9e('0x11')][_0x4b9e('0x1a')]({'type':_0x217d01[_0x402d58][0x0]['type'],'app':_0x4b9e('0x13'),'appdata':_0x4b9e('0x27'),'context':_0x217d01[_0x402d58][0x0][_0x4b9e('0x16')],'exten':_0x217d01[_0x402d58][0x0][_0x4b9e('0xd')],'priority':_0x35f4f6[_0x4b9e('0x10')]++,'VoiceExtensionId':_0x217d01[_0x402d58][0x0][_0x4b9e('0x17')]});_0x35f4f6[_0x4b9e('0x11')]['push']({'type':_0x217d01[_0x402d58][0x0]['type'],'app':'Set','appdata':_0x4b9e('0x28')+_0x35f4f6[_0x4b9e('0x19')][_0x4b9e('0x25')]||_0x4b9e('0x29'),'context':_0x217d01[_0x402d58][0x0]['context'],'exten':_0x217d01[_0x402d58][0x0][_0x4b9e('0xd')],'priority':_0x35f4f6[_0x4b9e('0x10')]++,'VoiceExtensionId':_0x217d01[_0x402d58][0x0][_0x4b9e('0x17')]});}}_0x35f4f6['extensions'][_0x4b9e('0x1a')]({'type':_0x217d01[_0x402d58][0x0][_0x4b9e('0x12')],'app':'Set','appdata':_0x4b9e('0x2a'),'context':_0x217d01[_0x402d58][0x0][_0x4b9e('0x16')],'exten':_0x217d01[_0x402d58][0x0]['exten'],'priority':_0x35f4f6['priority']++,'VoiceExtensionId':_0x217d01[_0x402d58][0x0]['VoiceExtensionId']});_0x35f4f6[_0x4b9e('0x11')]['push']({'type':_0x217d01[_0x402d58][0x0]['type'],'app':_0x4b9e('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x217d01[_0x402d58][0x0]['context'],'exten':_0x217d01[_0x402d58][0x0]['exten'],'priority':_0x35f4f6[_0x4b9e('0x10')]++,'VoiceExtensionId':_0x217d01[_0x402d58][0x0][_0x4b9e('0x17')]});_0x35f4f6[_0x4b9e('0x11')][_0x4b9e('0x1a')]({'type':_0x217d01[_0x402d58][0x0]['type'],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x217d01[_0x402d58][0x0][_0x4b9e('0x16')],'exten':_0x217d01[_0x402d58][0x0][_0x4b9e('0xd')],'priority':_0x35f4f6[_0x4b9e('0x10')]++,'VoiceExtensionId':_0x217d01[_0x402d58][0x0][_0x4b9e('0x17')]});for(var _0x3d4c50=0x0,_0x5cd4ac=0x0;_0x3d4c50<_0x217d01[_0x402d58][_0x4b9e('0x2b')];_0x3d4c50+=0x1,_0x5cd4ac=0x0){var _0x233941=_0x217d01[_0x402d58][_0x3d4c50];if(_0x233941[_0x4b9e('0x12')]){_0x233941[_0x4b9e('0x12')]=_0x233941[_0x4b9e('0x12')][_0x4b9e('0x2c')]();}var _0x2d8aec=[];var _0xb1372f=[];delete _0x233941['id'];delete _0x233941['createdAt'];delete _0x233941[_0x4b9e('0x2d')];var _0x3376f3=_0x233941['interval']!==_0x4b9e('0x2e')?[_0x233941[_0x4b9e('0x2f')]]:_0x233941[_0x4b9e('0x7')]?_[_0x4b9e('0x9')](_[_0x4b9e('0xb')](_0x35f4f6[_0x4b9e('0x30')],{'IntervalId':_0x233941[_0x4b9e('0x7')]}),_0x4b9e('0x2f')):[];if(_0x233941[_0x4b9e('0xf')]('tag')){if(_0x233941['tag']&&_0x233941[_0x4b9e('0x31')]!=='--'){_0x2d8aec['push']({'type':_0x233941['type'],'app':_0x4b9e('0x13'),'appdata':_0x4b9e('0x32')+_0x233941[_0x4b9e('0x31')],'context':_0x233941[_0x4b9e('0x16')],'exten':_0x233941[_0x4b9e('0xd')],'priority':_0x3376f3[_0x4b9e('0x2b')]+_0x35f4f6['priority']+_0x5cd4ac++,'VoiceExtensionId':_0x233941[_0x4b9e('0x17')]});}}if(_0x233941['type']===_0x4b9e('0x18')&&_0x233941[_0x4b9e('0xf')](_0x4b9e('0x33'))){if(_0x233941[_0x4b9e('0x33')]){_0x2d8aec['push']({'type':_0x233941['type'],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x233941['callerID']+')','context':_0x233941['context'],'exten':_0x233941['exten'],'priority':_0x3376f3[_0x4b9e('0x2b')]+_0x35f4f6[_0x4b9e('0x10')]+_0x5cd4ac++,'VoiceExtensionId':_0x233941['VoiceExtensionId']});}else{_0x2d8aec[_0x4b9e('0x1a')]({'type':_0x233941[_0x4b9e('0x12')],'app':_0x4b9e('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x233941['context'],'exten':_0x233941['exten'],'priority':_0x3376f3[_0x4b9e('0x2b')]+_0x35f4f6[_0x4b9e('0x10')]+_0x5cd4ac++,'VoiceExtensionId':_0x233941[_0x4b9e('0x17')]});}}if(_0x233941[_0x4b9e('0xf')](_0x4b9e('0x34'))){if(_0x21ab93[_0x4b9e('0x35')](_0x233941['app']['toLowerCase']())>=0x0&&_0x233941[_0x4b9e('0x36')]!==_0x4b9e('0x37')){if(_0x233941[_0x4b9e('0x34')]){_0x2d8aec[_0x4b9e('0x1a')]({'type':_0x233941[_0x4b9e('0x12')],'app':'ExecIf','appdata':_0x4b9e('0x38'),'context':_0x233941[_0x4b9e('0x16')],'exten':_0x233941[_0x4b9e('0xd')],'priority':_0x3376f3[_0x4b9e('0x2b')]+_0x35f4f6[_0x4b9e('0x10')]+_0x5cd4ac++,'VoiceExtensionId':_0x233941[_0x4b9e('0x17')]});_0x2d8aec[_0x4b9e('0x1a')]({'type':_0x233941[_0x4b9e('0x12')],'app':_0x4b9e('0x13'),'appdata':_0x4b9e('0x39'),'context':_0x233941[_0x4b9e('0x16')],'exten':_0x233941[_0x4b9e('0xd')],'priority':_0x3376f3[_0x4b9e('0x2b')]+_0x35f4f6['priority']+_0x5cd4ac++,'VoiceExtensionId':_0x233941[_0x4b9e('0x17')]});}else{_0x2d8aec[_0x4b9e('0x1a')]({'type':_0x233941[_0x4b9e('0x12')],'app':_0x4b9e('0x1f'),'appdata':_0x4b9e('0x3a'),'context':_0x233941[_0x4b9e('0x16')],'exten':_0x233941['exten'],'priority':_0x3376f3['length']+_0x35f4f6[_0x4b9e('0x10')]+_0x5cd4ac++,'VoiceExtensionId':_0x233941['VoiceExtensionId']});_0x2d8aec[_0x4b9e('0x1a')]({'type':_0x233941[_0x4b9e('0x12')],'app':_0x4b9e('0x13'),'appdata':_0x4b9e('0x3b'),'context':_0x233941[_0x4b9e('0x16')],'exten':_0x233941[_0x4b9e('0xd')],'priority':_0x3376f3[_0x4b9e('0x2b')]+_0x35f4f6[_0x4b9e('0x10')]+_0x5cd4ac++,'VoiceExtensionId':_0x233941['VoiceExtensionId']});}}}for(var _0x106873=0x0;_0x106873<_0x3376f3['length'];_0x106873+=0x1){var _0x2a795f=_0x35f4f6['priority']+_0x3376f3[_0x4b9e('0x2b')];var _0xf40cc6=_0x106873===_0x3376f3[_0x4b9e('0x2b')]-0x1?_0x35f4f6[_0x4b9e('0x10')]+_0x2d8aec['length']+_0xb1372f[_0x4b9e('0x2b')]+0x2:_0x35f4f6[_0x4b9e('0x10')]+_0x106873+0x1;_0x2d8aec[_0x4b9e('0x3c')](_0x106873,0x0,{'type':_0x233941['type'],'app':_0x4b9e('0x3d'),'appdata':_0x3376f3[_0x106873]+'?'+_0x233941[_0x4b9e('0x16')]+',${EXTEN},'+_0x2a795f+':'+_0x233941['context']+_0x4b9e('0x3e')+_0xf40cc6,'exten':_0x233941['exten'],'context':_0x233941[_0x4b9e('0x16')],'priority':_0x35f4f6[_0x4b9e('0x10')]+_0x106873,'VoiceExtensionId':_0x217d01[_0x402d58][0x0][_0x4b9e('0x17')]});}_0x233941['priority']=_0x2d8aec['length']?_[_0x4b9e('0x3f')](_0x2d8aec)['priority']+0x1:_0x35f4f6[_0x4b9e('0x10')];_0x35f4f6[_0x4b9e('0x10')]=(_0xb1372f[_0x4b9e('0x2b')]?_['last'](_0xb1372f)[_0x4b9e('0x10')]:_0x233941[_0x4b9e('0x10')])+0x1;_0x35f4f6[_0x4b9e('0x11')]=_[_0x4b9e('0x40')](_0x35f4f6[_0x4b9e('0x11')],_0x2d8aec,[_0x233941],_0xb1372f);}_0x35f4f6[_0x4b9e('0x11')][_0x4b9e('0x1a')]({'type':_0x217d01[_0x402d58][0x0]['type'],'app':'Hangup','exten':_0x217d01[_0x402d58][0x0][_0x4b9e('0xd')],'context':_0x217d01[_0x402d58][0x0][_0x4b9e('0x16')],'priority':_0x35f4f6[_0x4b9e('0x10')],'VoiceExtensionId':_0x217d01[_0x402d58][0x0][_0x4b9e('0x17')]});_0x441857[_0x4b9e('0x1a')](_0x217d01[_0x402d58][0x0][_0x4b9e('0x17')]);_0x35d595=_[_0x4b9e('0x40')](_0x35d595,_0x35f4f6[_0x4b9e('0x11')]);}}return _0x44b6f7['transaction'](function(_0x1f2625){return _0x44b6f7[_0x4b9e('0x2')][_0x4b9e('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x441857}},'transaction':_0x1f2625})[_0x4b9e('0x5')](function(_0x11aa47){return _0x44b6f7[_0x4b9e('0x2')]['VoiceExtension'][_0x4b9e('0x41')](_[_0x4b9e('0x42')](_0x35d595,'priority'),{'transaction':_0x1f2625});});});})['catch'](function(_0x160858){console[_0x4b9e('0x43')](_0x160858);});}exports[_0x4b9e('0x44')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 8db8740..e8b9a7f 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 _0x7881=['index','test','isNil','length','map','errors','message','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!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','into','ContactId','createdAt','updatedAt','select','field','NOW()','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','where','phone\x20NOT\x20IN\x20(?)','from','cm_hopper','fromQuery','ListId','str','calleridnum','cm_hopper_final','\x20=\x20?','insert','scheduledAt','cm_hopper_black','id\x20IN\x20?','VoiceQueue','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','then','findAll','BlackLists','all','dialCheckDuplicateType','CampaignId','Campaign','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','parse','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','defaults','redis','socket.io-emitter','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact'];(function(_0x46cf7e,_0xe67477){var _0x241ad7=function(_0x2e8aa7){while(--_0x2e8aa7){_0x46cf7e['push'](_0x46cf7e['shift']());}};_0x241ad7(++_0xe67477);}(_0x7881,0x1a1));var _0x1788=function(_0x5113f4,_0xc9b97f){_0x5113f4=_0x5113f4-0x0;var _0x22a8f1=_0x7881[_0x5113f4];return _0x22a8f1;};'use strict';var BPromise=require(_0x1788('0x0'));var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require(_0x1788('0x1'));var Papa=require(_0x1788('0x2'));var Redis=require(_0x1788('0x3'));var db=require(_0x1788('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x1788('0x5'))('api');config['redis']=_[_0x1788('0x6')](config[_0x1788('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x1788('0x8'))(new Redis(config['redis']));require('../../../api/cmContact/cmContact.socket')[_0x1788('0x9')](socket);try{if(!process[_0x1788('0xa')][0x2]||process[_0x1788('0xa')][0x2]===_0x1788('0xb')||process[_0x1788('0xa')][0x2]===_0x1788('0xc')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x1788('0xa')][0x2];if(!process[_0x1788('0xa')][0x3]||process[_0x1788('0xa')][0x3]===_0x1788('0xb')||process[_0x1788('0xa')][0x3]==='null'||!process[_0x1788('0xa')][0x4]||process['argv'][0x4]===_0x1788('0xb')||process[_0x1788('0xa')][0x4]===_0x1788('0xc')){throw new Error(_0x1788('0xd'));}var FIELDS=_[_0x1788('0xe')](process[_0x1788('0xa')][0x3][_0x1788('0xf')](','),process['argv'][0x4]['split'](','));if(!process['argv'][0x5]||process[_0x1788('0xa')][0x5]===_0x1788('0xb')||process[_0x1788('0xa')][0x5]===_0x1788('0xc')){throw new Error(_0x1788('0x10'));}var LISTID=process[_0x1788('0xa')][0x5];var COMPANYID=process[_0x1788('0xa')][0x6]&&process[_0x1788('0xa')][0x6]!==_0x1788('0xb')&&process['argv'][0x6]!==_0x1788('0xc')?process[_0x1788('0xa')][0x6]:null;var DUPLICATES=process[_0x1788('0xa')][0x7]&&process[_0x1788('0xa')][0x7]!==_0x1788('0xb')&&process['argv'][0x7]!==_0x1788('0xc')?process[_0x1788('0xa')][0x7]:null;if(!process[_0x1788('0xa')][0x8]||process['argv'][0x8]===_0x1788('0xb')||process[_0x1788('0xa')][0x8]===_0x1788('0xc')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x1788('0xa')][0x8];}catch(_0x2cf6a0){logger[_0x1788('0x11')](_0x2cf6a0);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(_0xc510dc,_0x4a32e1,_0x816a13,_0x123042){var _0x224d44={'message':_0x4a32e1};_0x224d44[_0xc510dc]=!![];if(_0x816a13){_0x224d44[_0x1788('0x12')]=_0x816a13;}if(_0x123042){_0x224d44[_0x1788('0x13')]=_0x123042;}return _0x224d44;}function isEmail(_0x5bac01){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))*$/[_0x1788('0x14')](_0x5bac01);}function checkRow(_0x831571,_0x4f85e4,_0x53bb62){return new BPromise(function(_0x23702d,_0x5d321f){if(_[_0x1788('0x15')](_0x831571)){return _0x5d321f(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x53bb62));}if(_0x831571['errors']&&_0x831571['errors'][_0x1788('0x16')]){var _0x4e7a24=_[_0x1788('0x17')](_0x831571[_0x1788('0x18')],_0x1788('0x19'))['join'](';');return _0x5d321f(handleCheckRowError(_0x1788('0x11'),_0x4e7a24,null,_0x53bb62));}var _0x491d76={};for(var _0x2aed5e in FIELDS){if(FIELDS[_0x1788('0x1a')](_0x2aed5e)&&FIELDS[_0x2aed5e]){_0x491d76[_0x2aed5e]=_0x831571[_0x1788('0x1b')][0x0][FIELDS[_0x2aed5e]]||_0x831571['data'][0x0]['\ufeff'+FIELDS[_0x2aed5e]];}}if(!_0x491d76[_0x1788('0x1c')]){return _0x5d321f(handleCheckRowError(_0x1788('0x11'),_0x1788('0x1d'),null,_0x53bb62));}if(!_0x491d76[_0x1788('0x1e')]){return _0x5d321f(handleCheckRowError(_0x1788('0x11'),'phone\x20not\x20specified!',null,_0x53bb62));}if(_0x491d76[_0x1788('0x1f')]){var _0x3a91e3=moment(_0x491d76[_0x1788('0x1f')],_0x1788('0x20'));if(!_0x3a91e3[_0x1788('0x21')]()){return _0x5d321f(handleCheckRowError(_0x1788('0x11'),_0x1788('0x22'),null,_0x53bb62));}}if(_0x491d76[_0x1788('0x23')]){if(!isEmail(_0x491d76[_0x1788('0x23')])){return _0x5d321f(handleCheckRowError(_0x1788('0x11'),_0x1788('0x24'),null,_0x53bb62));}}_0x491d76['ListId']=LISTID;_0x491d76[_0x1788('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1788('0x16')]&&_0x4f85e4){var _0x1762ff={};for(var _0x1e125b=0x0,_0x290b73=DUPLICATES[_0x1788('0x16')];_0x1e125b<_0x290b73;_0x1e125b+=0x1){_0x1762ff[DUPLICATES[_0x1e125b]]=_0x491d76[DUPLICATES[_0x1e125b]];}var _0x49b063=_[_0x1788('0x26')](_0x4f85e4,_0x1762ff);if(_0x49b063){return _0x5d321f(handleCheckRowError(_0x1788('0x27'),_0x1788('0x28'),_0x49b063,_0x53bb62));}}return db[_0x1788('0x29')][_0x1788('0x2a')](_0x491d76,{'raw':!![],'hooks':![],'fields':_[_0x1788('0x2b')](_0x491d76)})['then'](function(_0x3f3645){if(DUPLICATES&&DUPLICATES[_0x1788('0x16')]&&_0x4f85e4){_0x4f85e4[_0x1788('0x2c')](_[_0x1788('0x2d')](_0x491d76,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3f3645['id'];return _0x23702d();})[_0x1788('0x2e')](function(_0xd0e67c){return _0x5d321f(handleCheckRowError(_0x1788('0x11'),_0x1788('0x2f')+(_0xd0e67c['message']||JSON[_0x1788('0x30')](_0xd0e67c)),null,_0x53bb62));});});}function checkHopper(){function _0x234de9(){return function(_0xed6969){logger[_0x1788('0x11')](_0x1788('0x31'),'checkHopper',util[_0x1788('0x32')](_0xed6969,{'showHidden':![],'depth':null}));};}var _0x37219a=function(_0x5d3072,_0x205d93){var _0x132bd3=squel['insert']()[_0x1788('0x33')]('cm_hopper')['fromQuery'](['phone','scheduledAt',_0x1788('0x34'),'ListId',_0x205d93,_0x1788('0x35'),_0x1788('0x36')],squel[_0x1788('0x37')]()[_0x1788('0x38')](_0x1788('0x1e'),_0x1788('0x1e'))[_0x1788('0x38')](_0x1788('0x39'),'scheduledAt')[_0x1788('0x38')]('id',_0x1788('0x34'))[_0x1788('0x38')](LISTID[_0x1788('0x3a')](),'ListId')[_0x1788('0x38')](_0x5d3072['id']['toString'](),_0x205d93)[_0x1788('0x38')](_0x1788('0x39'),_0x1788('0x35'))[_0x1788('0x38')]('NOW()',_0x1788('0x36'))['from'](_0x1788('0x3b'))['where'](_0x1788('0x3c'))['where'](_0x1788('0x3d'),LISTID['toString']())['where'](_0x1788('0x3e'))[_0x1788('0x3f')](_0x1788('0x40'),squel[_0x1788('0x37')]()[_0x1788('0x38')](_0x1788('0x1e'))[_0x1788('0x41')](_0x1788('0x42'))['where'](_0x205d93+'\x20=\x20?',_0x5d3072['id'][_0x1788('0x3a')]())))['toString']();return _0x132bd3;};var _0x55bb05=function(_0x40ce81,_0x435c2e){var _0x376a84=squel['insert']()['into'](_0x1788('0x42'))[_0x1788('0x43')]([_0x1788('0x1e'),'scheduledAt','ContactId',_0x1788('0x44'),_0x435c2e,_0x1788('0x35'),_0x1788('0x36')],squel[_0x1788('0x37')]()['field'](_0x1788('0x1e'),_0x1788('0x1e'))[_0x1788('0x38')](_0x1788('0x39'),'scheduledAt')['field']('id',_0x1788('0x34'))['field'](LISTID['toString'](),_0x1788('0x44'))[_0x1788('0x38')](_0x40ce81['id'][_0x1788('0x3a')](),_0x435c2e)[_0x1788('0x38')](_0x1788('0x39'),_0x1788('0x35'))['field'](_0x1788('0x39'),_0x1788('0x36'))[_0x1788('0x41')]('cm_contacts')['where'](_0x1788('0x3c'))[_0x1788('0x3f')]('ListId\x20=\x20?',LISTID[_0x1788('0x3a')]())[_0x1788('0x3f')]('id\x20IN\x20?',squel[_0x1788('0x45')](hopperContacts))[_0x1788('0x3f')](_0x1788('0x3e'))['where'](_0x1788('0x40'),squel['select']()['field'](_0x1788('0x46'))[_0x1788('0x41')](_0x1788('0x47'))['where'](_0x435c2e+_0x1788('0x48'),_0x40ce81['id'][_0x1788('0x3a')]()))[_0x1788('0x3f')](_0x1788('0x40'),squel[_0x1788('0x37')]()[_0x1788('0x38')](_0x1788('0x1e'))[_0x1788('0x41')](_0x1788('0x42'))[_0x1788('0x3f')](_0x435c2e+_0x1788('0x48'),_0x40ce81['id'][_0x1788('0x3a')]())))[_0x1788('0x3a')]();return _0x376a84;};function _0x5490c1(_0x442a55,_0x4daf7e){var _0x276410=squel[_0x1788('0x49')]()[_0x1788('0x33')](_0x1788('0x42'))[_0x1788('0x43')]([_0x1788('0x1e'),'scheduledAt',_0x1788('0x34'),_0x1788('0x44'),_0x4daf7e,_0x1788('0x35'),_0x1788('0x36')],squel['select']()[_0x1788('0x38')](_0x1788('0x1e'),_0x1788('0x1e'))[_0x1788('0x38')](_0x1788('0x39'),_0x1788('0x4a'))[_0x1788('0x38')]('id','ContactId')[_0x1788('0x38')](LISTID['toString'](),_0x1788('0x44'))[_0x1788('0x38')](_0x442a55['id'][_0x1788('0x3a')](),_0x4daf7e)['field'](_0x1788('0x39'),'createdAt')['field'](_0x1788('0x39'),_0x1788('0x36'))['from']('cm_contacts')[_0x1788('0x3f')](_0x1788('0x3c'))['where']('ListId\x20=\x20?',LISTID[_0x1788('0x3a')]())['where']('id\x20IN\x20?',squel['str'](hopperContacts))[_0x1788('0x3f')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x276410;}function _0x47f92a(_0x28c0a4,_0x26fb1d){var _0x4365e7=squel['insert']()[_0x1788('0x33')](_0x1788('0x4b'))['fromQuery']([_0x1788('0x1e'),_0x1788('0x34'),_0x1788('0x44'),_0x26fb1d,_0x1788('0x35'),_0x1788('0x36')],squel['select']()[_0x1788('0x38')](_0x1788('0x1e'),_0x1788('0x1e'))[_0x1788('0x38')]('id',_0x1788('0x34'))[_0x1788('0x38')](LISTID[_0x1788('0x3a')](),_0x1788('0x44'))[_0x1788('0x38')](_0x28c0a4['id'][_0x1788('0x3a')](),_0x26fb1d)['field'](_0x1788('0x39'),_0x1788('0x35'))[_0x1788('0x38')](_0x1788('0x39'),_0x1788('0x36'))['from'](_0x1788('0x3b'))[_0x1788('0x3f')]('deletedAt\x20IS\x20NULL')[_0x1788('0x3f')](_0x1788('0x3d'),LISTID[_0x1788('0x3a')]())['where'](_0x1788('0x4c'),squel[_0x1788('0x45')](hopperContacts))['where'](_0x1788('0x3e')))[_0x1788('0x3a')]();return _0x4365e7;}return db[_0x1788('0x4d')]['findAll']({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x1788('0x4e')],'as':_0x1788('0x4f'),'where':{'id':LISTID}}]})['then'](function(_0x3fceb2){var _0x85baa7=[];if(_0x3fceb2){var _0x3f3c93;for(var _0x68300a=0x0,_0x1313f0;_0x68300a<_0x3fceb2[_0x1788('0x16')];_0x68300a+=0x1){_0x1313f0=_0x3fceb2[_0x68300a][_0x1788('0x50')]({'plain':!![]});switch(_0x1313f0['dialCheckDuplicateType']){case _0x1788('0x51'):_0x85baa7[_0x1788('0x2c')](db[_0x1788('0x52')]['query'](_0x55bb05(_0x1313f0,_0x1788('0x53')))['then'](function(){})[_0x1788('0x2e')](_0x234de9()));break;case _0x1788('0x54'):_0x85baa7['push'](db[_0x1788('0x52')][_0x1788('0x55')](_0x37219a(_0x1313f0,_0x1788('0x53')))[_0x1788('0x56')](function(){})[_0x1788('0x2e')](_0x234de9()));break;default:_0x85baa7[_0x1788('0x2c')](db[_0x1788('0x52')][_0x1788('0x55')](_0x5490c1(_0x1313f0,_0x1788('0x53')))[_0x1788('0x56')](function(){})['catch'](_0x234de9()));}}}return _0x85baa7;})['all']()['then'](function(){return db['VoiceQueue'][_0x1788('0x57')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x1788('0x58'),'where':{'id':LISTID}}]})[_0x1788('0x56')](function(_0x3e4f55){var _0x59a4aa=[];if(_0x3e4f55){var _0x25bdec;for(var _0x2a4a6d=0x0,_0x44c5dc;_0x2a4a6d<_0x3e4f55[_0x1788('0x16')];_0x2a4a6d+=0x1){_0x44c5dc=_0x3e4f55[_0x2a4a6d][_0x1788('0x50')]({'plain':!![]});_0x59a4aa['push'](db['sequelize'][_0x1788('0x55')](_0x47f92a(_0x44c5dc,_0x1788('0x53')))[_0x1788('0x56')](function(){})[_0x1788('0x2e')](_0x234de9()));}}return _0x59a4aa;})[_0x1788('0x59')]();})[_0x1788('0x56')](function(){return db['Campaign'][_0x1788('0x57')]({'attributes':['id',_0x1788('0x5a')],'include':[{'model':db['CmList'],'as':_0x1788('0x4f'),'where':{'id':LISTID}}]})['then'](function(_0x1742a2){var _0x45dc0c=[];if(_0x1742a2){for(var _0x425d96=0x0,_0x22cead;_0x425d96<_0x1742a2[_0x1788('0x16')];_0x425d96+=0x1){_0x22cead=_0x1742a2[_0x425d96][_0x1788('0x50')]({'plain':!![]});switch(_0x22cead[_0x1788('0x5a')]){case _0x1788('0x51'):_0x45dc0c[_0x1788('0x2c')](db[_0x1788('0x52')][_0x1788('0x55')](_0x55bb05(_0x22cead,_0x1788('0x5b')))['then'](function(){})[_0x1788('0x2e')](_0x234de9()));break;case _0x1788('0x54'):_0x45dc0c['push'](db[_0x1788('0x52')]['query'](_0x37219a(_0x22cead,_0x1788('0x5b')))[_0x1788('0x56')](function(){})['catch'](_0x234de9()));break;default:_0x45dc0c[_0x1788('0x2c')](db[_0x1788('0x52')][_0x1788('0x55')](_0x5490c1(_0x22cead,'CampaignId'))[_0x1788('0x56')](function(){})[_0x1788('0x2e')](_0x234de9()));}}}return _0x45dc0c;})[_0x1788('0x59')]();})[_0x1788('0x56')](function(){return db[_0x1788('0x5c')][_0x1788('0x57')]({'attributes':['id'],'include':[{'model':db[_0x1788('0x4e')],'as':_0x1788('0x58'),'where':{'id':LISTID}}]})[_0x1788('0x56')](function(_0x1789aa){var _0x3fafb6=[];if(_0x1789aa){for(var _0x18427b=0x0,_0x453238;_0x18427b<_0x1789aa[_0x1788('0x16')];_0x18427b+=0x1){_0x453238=_0x1789aa[_0x18427b][_0x1788('0x50')]({'plain':!![]});_0x3fafb6[_0x1788('0x2c')](db['sequelize']['query'](_0x47f92a(_0x453238,_0x1788('0x5b')))[_0x1788('0x56')](function(){})[_0x1788('0x2e')](_0x234de9()));}}return _0x3fafb6;})['all']();})['catch'](function(_0x5c2656){logger[_0x1788('0x11')]('cmContact,\x20%s,\x20%s',_0x1788('0x5d'),_0x5c2656[_0x1788('0x19')]);});}var processPromises=function(_0x5468b0){return BPromise['all'](promises)['then'](function(_0x13ac90){})['catch'](function(_0x4e0058){logger[_0x1788('0x11')](_0x1788('0x5e'),JSON[_0x1788('0x30')](_0x4e0058));})[_0x1788('0x5f')](function(){socket[_0x1788('0x60')](_0x1788('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5468b0){return _0x5468b0[_0x1788('0x62')]();}});};var endCsv=function(){return BPromise[_0x1788('0x63')]()[_0x1788('0x56')](function(){if(hopperContacts){return checkHopper();}})[_0x1788('0x56')](function(){socket[_0x1788('0x60')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1788('0x64')](FILEPATH);}catch(_0x2484c6){logger[_0x1788('0x11')](_0x1788('0x65'),JSON[_0x1788('0x30')](_0x2484c6));}finally{process[_0x1788('0x66')](0x0);}});};process['on'](_0x1788('0x67'),function(){logger[_0x1788('0x68')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x1788('0x56')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x1788('0x29')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x592b48){var _0x57761e=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x1788('0x69')](_0x57761e,{'header':!![],'skipEmptyLines':!![],'step':function(_0x39de65,_0x3065cf){total+=0x1;var _0x58e994=total;promises[_0x1788('0x2c')](checkRow(_0x39de65,_0x592b48,_0x58e994)['then'](function(){success+=0x1;})[_0x1788('0x2e')](function(_0x2d9b4b){if(_0x2d9b4b[_0x1788('0x11')]){errors+=0x1;delete _0x2d9b4b[_0x1788('0x11')];}else if(_0x2d9b4b[_0x1788('0x27')]){duplicates+=0x1;delete _0x2d9b4b[_0x1788('0x27')];}rows['push'](_0x2d9b4b);}));if(total%0xc8===0x0){_0x3065cf[_0x1788('0x6a')]();return processPromises(_0x3065cf);}},'complete':function(){return processPromises()[_0x1788('0x56')](function(){logger[_0x1788('0x68')](_0x1788('0x6b'));endCsv();});},'error':function(_0x5a822b,_0x54523e){logger[_0x1788('0x68')]('CSV\x20parse\x20error',JSON[_0x1788('0x30')](_0x5a822b));endCsv();}});})['catch'](function(_0x424c30){logger[_0x1788('0x11')](_0x1788('0x6c'),JSON['stringify'](_0x424c30));});}main(); \ No newline at end of file +var _0x7f3d=['contact','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','hasOwnProperty','data','firstName','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','find','Duplicate\x20Contact','CmContact','create','push','pick','message','checkHopper','inspect','insert','fromQuery','scheduledAt','createdAt','updatedAt','select','phone','field','ContactId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','cm_hopper','\x20=\x20?','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','id\x20IN\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','into','str','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','then','get','always','query','VoiceQueueId','catch','onlyIfOpen','BlackLists','Campaign','findAll','sequelize','CampaignId','all','stringify','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','parse','duplicate','info','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','split','Missing\x20ListId\x20parameter!'];(function(_0x6bb814,_0x17196b){var _0x3c4bf6=function(_0x5bf6b9){while(--_0x5bf6b9){_0x6bb814['push'](_0x6bb814['shift']());}};_0x3c4bf6(++_0x17196b);}(_0x7f3d,0xb4));var _0xd7f3=function(_0xdd82b4,_0x5cd8b8){_0xdd82b4=_0xdd82b4-0x0;var _0x549bb2=_0x7f3d[_0xdd82b4];return _0x549bb2;};'use strict';var BPromise=require(_0xd7f3('0x0'));var util=require(_0xd7f3('0x1'));var _=require(_0xd7f3('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require('ioredis');var db=require(_0xd7f3('0x3'))['db'];var config=require(_0xd7f3('0x4'));var logger=require(_0xd7f3('0x5'))(_0xd7f3('0x6'));config[_0xd7f3('0x7')]=_[_0xd7f3('0x8')](config[_0xd7f3('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xd7f3('0x9'))(new Redis(config[_0xd7f3('0x7')]));require(_0xd7f3('0xa'))[_0xd7f3('0xb')](socket);try{if(!process['argv'][0x2]||process[_0xd7f3('0xc')][0x2]===_0xd7f3('0xd')||process[_0xd7f3('0xc')][0x2]===_0xd7f3('0xe')){throw new Error(_0xd7f3('0xf'));}var FILEPATH=process[_0xd7f3('0xc')][0x2];if(!process[_0xd7f3('0xc')][0x3]||process['argv'][0x3]===_0xd7f3('0xd')||process['argv'][0x3]===_0xd7f3('0xe')||!process['argv'][0x4]||process['argv'][0x4]===_0xd7f3('0xd')||process[_0xd7f3('0xc')][0x4]===_0xd7f3('0xe')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_['zipObject'](process[_0xd7f3('0xc')][0x3][_0xd7f3('0x10')](','),process[_0xd7f3('0xc')][0x4]['split'](','));if(!process[_0xd7f3('0xc')][0x5]||process[_0xd7f3('0xc')][0x5]===_0xd7f3('0xd')||process[_0xd7f3('0xc')][0x5]===_0xd7f3('0xe')){throw new Error(_0xd7f3('0x11'));}var LISTID=process[_0xd7f3('0xc')][0x5];var COMPANYID=process[_0xd7f3('0xc')][0x6]&&process['argv'][0x6]!==_0xd7f3('0xd')&&process['argv'][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process[_0xd7f3('0xc')][0x7]&&process[_0xd7f3('0xc')][0x7]!==_0xd7f3('0xd')&&process[_0xd7f3('0xc')][0x7]!=='null'?process[_0xd7f3('0xc')][0x7]:null;if(!process[_0xd7f3('0xc')][0x8]||process['argv'][0x8]===_0xd7f3('0xd')||process[_0xd7f3('0xc')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xd7f3('0xc')][0x8];}catch(_0x2abcdd){logger['error'](_0x2abcdd);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(_0x320a36,_0x5a0a96,_0x5805af,_0x1bc627){var _0x59b2cf={'message':_0x5a0a96};_0x59b2cf[_0x320a36]=!![];if(_0x5805af){_0x59b2cf[_0xd7f3('0x12')]=_0x5805af;}if(_0x1bc627){_0x59b2cf['index']=_0x1bc627;}return _0x59b2cf;}function isEmail(_0x4bade3){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))*$/[_0xd7f3('0x13')](_0x4bade3);}function checkRow(_0x5ca6a5,_0x811a,_0x44fadf){return new BPromise(function(_0x13d1bd,_0xf0aa86){if(_[_0xd7f3('0x14')](_0x5ca6a5)){return _0xf0aa86(handleCheckRowError(_0xd7f3('0x15'),_0xd7f3('0x16'),null,_0x44fadf));}if(_0x5ca6a5[_0xd7f3('0x17')]&&_0x5ca6a5[_0xd7f3('0x17')][_0xd7f3('0x18')]){var _0x5527b8=_[_0xd7f3('0x19')](_0x5ca6a5[_0xd7f3('0x17')],'message')['join'](';');return _0xf0aa86(handleCheckRowError(_0xd7f3('0x15'),_0x5527b8,null,_0x44fadf));}var _0x23f01a={};for(var _0x212528 in FIELDS){if(FIELDS[_0xd7f3('0x1a')](_0x212528)&&FIELDS[_0x212528]){_0x23f01a[_0x212528]=_0x5ca6a5['data'][0x0][FIELDS[_0x212528]]||_0x5ca6a5[_0xd7f3('0x1b')][0x0]['\ufeff'+FIELDS[_0x212528]];}}if(!_0x23f01a[_0xd7f3('0x1c')]){return _0xf0aa86(handleCheckRowError(_0xd7f3('0x15'),'firstName\x20not\x20specified!',null,_0x44fadf));}if(!_0x23f01a['phone']){return _0xf0aa86(handleCheckRowError('error','phone\x20not\x20specified!',null,_0x44fadf));}if(_0x23f01a['birthDate']){var _0xd5a117=moment(_0x23f01a['birthDate'],_0xd7f3('0x1d'));if(!_0xd5a117['isValid']()){return _0xf0aa86(handleCheckRowError(_0xd7f3('0x15'),_0xd7f3('0x1e'),null,_0x44fadf));}}if(_0x23f01a['email']){if(!isEmail(_0x23f01a[_0xd7f3('0x1f')])){return _0xf0aa86(handleCheckRowError(_0xd7f3('0x15'),_0xd7f3('0x20'),null,_0x44fadf));}}_0x23f01a[_0xd7f3('0x21')]=LISTID;_0x23f01a['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xd7f3('0x18')]&&_0x811a){var _0x34d692={};for(var _0x4f04b0=0x0,_0x738668=DUPLICATES['length'];_0x4f04b0<_0x738668;_0x4f04b0+=0x1){_0x34d692[DUPLICATES[_0x4f04b0]]=_0x23f01a[DUPLICATES[_0x4f04b0]];}var _0x30b56b=_[_0xd7f3('0x22')](_0x811a,_0x34d692);if(_0x30b56b){return _0xf0aa86(handleCheckRowError('duplicate',_0xd7f3('0x23'),_0x30b56b,_0x44fadf));}}return db[_0xd7f3('0x24')][_0xd7f3('0x25')](_0x23f01a,{'raw':!![],'hooks':![],'fields':_['keys'](_0x23f01a)})['then'](function(_0x50a424){if(DUPLICATES&&DUPLICATES[_0xd7f3('0x18')]&&_0x811a){_0x811a[_0xd7f3('0x26')](_[_0xd7f3('0x27')](_0x23f01a,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x50a424['id'];return _0x13d1bd();})['catch'](function(_0x2a7cb2){return _0xf0aa86(handleCheckRowError(_0xd7f3('0x15'),'Error\x20while\x20creating\x20contact:\x20'+(_0x2a7cb2[_0xd7f3('0x28')]||JSON['stringify'](_0x2a7cb2)),null,_0x44fadf));});});}function checkHopper(){function _0x1fe738(){return function(_0x3b4efc){logger[_0xd7f3('0x15')]('cmContact',_0xd7f3('0x29'),util[_0xd7f3('0x2a')](_0x3b4efc,{'showHidden':![],'depth':null}));};}var _0x2a7bd8=function(_0x1f01b0,_0x2c0097){var _0xb96ea0=squel[_0xd7f3('0x2b')]()['into']('cm_hopper')[_0xd7f3('0x2c')](['phone',_0xd7f3('0x2d'),'ContactId',_0xd7f3('0x21'),_0x2c0097,_0xd7f3('0x2e'),_0xd7f3('0x2f')],squel[_0xd7f3('0x30')]()['field']('phone',_0xd7f3('0x31'))[_0xd7f3('0x32')]('NOW()',_0xd7f3('0x2d'))[_0xd7f3('0x32')]('id',_0xd7f3('0x33'))[_0xd7f3('0x32')](LISTID['toString'](),_0xd7f3('0x21'))[_0xd7f3('0x32')](_0x1f01b0['id'][_0xd7f3('0x34')](),_0x2c0097)['field'](_0xd7f3('0x35'),_0xd7f3('0x2e'))[_0xd7f3('0x32')](_0xd7f3('0x35'),_0xd7f3('0x2f'))[_0xd7f3('0x36')](_0xd7f3('0x37'))[_0xd7f3('0x38')]('deletedAt\x20IS\x20NULL')[_0xd7f3('0x38')]('ListId\x20=\x20?',LISTID[_0xd7f3('0x34')]())[_0xd7f3('0x38')](_0xd7f3('0x39'))[_0xd7f3('0x38')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xd7f3('0x32')](_0xd7f3('0x31'))[_0xd7f3('0x36')](_0xd7f3('0x3a'))[_0xd7f3('0x38')](_0x2c0097+_0xd7f3('0x3b'),_0x1f01b0['id']['toString']())))[_0xd7f3('0x34')]();return _0xb96ea0;};var _0x3ce50d=function(_0x419de7,_0x34ccb7){var _0x356f2d=squel[_0xd7f3('0x2b')]()['into'](_0xd7f3('0x3a'))[_0xd7f3('0x2c')](['phone',_0xd7f3('0x2d'),_0xd7f3('0x33'),_0xd7f3('0x21'),_0x34ccb7,'createdAt',_0xd7f3('0x2f')],squel[_0xd7f3('0x30')]()[_0xd7f3('0x32')](_0xd7f3('0x31'),_0xd7f3('0x31'))['field'](_0xd7f3('0x35'),_0xd7f3('0x2d'))[_0xd7f3('0x32')]('id',_0xd7f3('0x33'))['field'](LISTID['toString'](),'ListId')[_0xd7f3('0x32')](_0x419de7['id'][_0xd7f3('0x34')](),_0x34ccb7)['field'](_0xd7f3('0x35'),_0xd7f3('0x2e'))[_0xd7f3('0x32')](_0xd7f3('0x35'),_0xd7f3('0x2f'))[_0xd7f3('0x36')](_0xd7f3('0x37'))['where'](_0xd7f3('0x3c'))[_0xd7f3('0x38')](_0xd7f3('0x3d'),LISTID['toString']())[_0xd7f3('0x38')](_0xd7f3('0x3e'),squel['str'](hopperContacts))[_0xd7f3('0x38')](_0xd7f3('0x39'))[_0xd7f3('0x38')](_0xd7f3('0x3f'),squel[_0xd7f3('0x30')]()[_0xd7f3('0x32')]('calleridnum')[_0xd7f3('0x36')](_0xd7f3('0x40'))['where'](_0x34ccb7+_0xd7f3('0x3b'),_0x419de7['id'][_0xd7f3('0x34')]()))[_0xd7f3('0x38')](_0xd7f3('0x3f'),squel[_0xd7f3('0x30')]()[_0xd7f3('0x32')](_0xd7f3('0x31'))[_0xd7f3('0x36')](_0xd7f3('0x3a'))[_0xd7f3('0x38')](_0x34ccb7+_0xd7f3('0x3b'),_0x419de7['id'][_0xd7f3('0x34')]())))[_0xd7f3('0x34')]();return _0x356f2d;};function _0x2281d2(_0x41640a,_0x392808){var _0x21fb2a=squel[_0xd7f3('0x2b')]()[_0xd7f3('0x41')](_0xd7f3('0x3a'))['fromQuery']([_0xd7f3('0x31'),'scheduledAt','ContactId',_0xd7f3('0x21'),_0x392808,_0xd7f3('0x2e'),'updatedAt'],squel[_0xd7f3('0x30')]()[_0xd7f3('0x32')](_0xd7f3('0x31'),_0xd7f3('0x31'))[_0xd7f3('0x32')](_0xd7f3('0x35'),_0xd7f3('0x2d'))[_0xd7f3('0x32')]('id',_0xd7f3('0x33'))[_0xd7f3('0x32')](LISTID[_0xd7f3('0x34')](),_0xd7f3('0x21'))[_0xd7f3('0x32')](_0x41640a['id'][_0xd7f3('0x34')](),_0x392808)['field'](_0xd7f3('0x35'),'createdAt')[_0xd7f3('0x32')](_0xd7f3('0x35'),'updatedAt')['from'](_0xd7f3('0x37'))['where'](_0xd7f3('0x3c'))[_0xd7f3('0x38')](_0xd7f3('0x3d'),LISTID[_0xd7f3('0x34')]())[_0xd7f3('0x38')]('id\x20IN\x20?',squel[_0xd7f3('0x42')](hopperContacts))['where'](_0xd7f3('0x39')))['toString']();return _0x21fb2a;}function _0x6dd73a(_0x173f2d,_0x416cb3){var _0x18ed87=squel['insert']()[_0xd7f3('0x41')]('cm_hopper_black')[_0xd7f3('0x2c')](['phone','ContactId',_0xd7f3('0x21'),_0x416cb3,'createdAt',_0xd7f3('0x2f')],squel['select']()[_0xd7f3('0x32')](_0xd7f3('0x31'),_0xd7f3('0x31'))['field']('id',_0xd7f3('0x33'))[_0xd7f3('0x32')](LISTID[_0xd7f3('0x34')](),_0xd7f3('0x21'))[_0xd7f3('0x32')](_0x173f2d['id']['toString'](),_0x416cb3)[_0xd7f3('0x32')](_0xd7f3('0x35'),_0xd7f3('0x2e'))[_0xd7f3('0x32')](_0xd7f3('0x35'),_0xd7f3('0x2f'))[_0xd7f3('0x36')](_0xd7f3('0x37'))[_0xd7f3('0x38')](_0xd7f3('0x3c'))[_0xd7f3('0x38')](_0xd7f3('0x3d'),LISTID[_0xd7f3('0x34')]())[_0xd7f3('0x38')](_0xd7f3('0x3e'),squel['str'](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0xd7f3('0x34')]();return _0x18ed87;}return db[_0xd7f3('0x43')]['findAll']({'where':{'type':_0xd7f3('0x44')},'attributes':['id',_0xd7f3('0x45')],'include':[{'model':db[_0xd7f3('0x46')],'as':_0xd7f3('0x47'),'where':{'id':LISTID}}]})[_0xd7f3('0x48')](function(_0x54c9c3){var _0x18a0b9=[];if(_0x54c9c3){var _0x3c105d;for(var _0x347d5e=0x0,_0x4e959f;_0x347d5e<_0x54c9c3['length'];_0x347d5e+=0x1){_0x4e959f=_0x54c9c3[_0x347d5e][_0xd7f3('0x49')]({'plain':!![]});switch(_0x4e959f['dialCheckDuplicateType']){case _0xd7f3('0x4a'):_0x18a0b9[_0xd7f3('0x26')](db['sequelize'][_0xd7f3('0x4b')](_0x3ce50d(_0x4e959f,_0xd7f3('0x4c')))['then'](function(){})[_0xd7f3('0x4d')](_0x1fe738()));break;case _0xd7f3('0x4e'):_0x18a0b9[_0xd7f3('0x26')](db['sequelize']['query'](_0x2a7bd8(_0x4e959f,'VoiceQueueId'))[_0xd7f3('0x48')](function(){})[_0xd7f3('0x4d')](_0x1fe738()));break;default:_0x18a0b9[_0xd7f3('0x26')](db['sequelize'][_0xd7f3('0x4b')](_0x2281d2(_0x4e959f,_0xd7f3('0x4c')))[_0xd7f3('0x48')](function(){})[_0xd7f3('0x4d')](_0x1fe738()));}}}return _0x18a0b9;})['all']()[_0xd7f3('0x48')](function(){return db[_0xd7f3('0x43')]['findAll']({'where':{'type':_0xd7f3('0x44')},'attributes':['id'],'include':[{'model':db[_0xd7f3('0x46')],'as':_0xd7f3('0x4f'),'where':{'id':LISTID}}]})[_0xd7f3('0x48')](function(_0x38a423){var _0x5eac9a=[];if(_0x38a423){var _0x523739;for(var _0x5bfecb=0x0,_0x37c833;_0x5bfecb<_0x38a423['length'];_0x5bfecb+=0x1){_0x37c833=_0x38a423[_0x5bfecb][_0xd7f3('0x49')]({'plain':!![]});_0x5eac9a[_0xd7f3('0x26')](db['sequelize']['query'](_0x6dd73a(_0x37c833,_0xd7f3('0x4c')))[_0xd7f3('0x48')](function(){})[_0xd7f3('0x4d')](_0x1fe738()));}}return _0x5eac9a;})['all']();})[_0xd7f3('0x48')](function(){return db[_0xd7f3('0x50')][_0xd7f3('0x51')]({'attributes':['id',_0xd7f3('0x45')],'include':[{'model':db[_0xd7f3('0x46')],'as':_0xd7f3('0x47'),'where':{'id':LISTID}}]})[_0xd7f3('0x48')](function(_0x5b18fe){var _0x136843=[];if(_0x5b18fe){for(var _0x193209=0x0,_0xdf250d;_0x193209<_0x5b18fe[_0xd7f3('0x18')];_0x193209+=0x1){_0xdf250d=_0x5b18fe[_0x193209][_0xd7f3('0x49')]({'plain':!![]});switch(_0xdf250d[_0xd7f3('0x45')]){case _0xd7f3('0x4a'):_0x136843[_0xd7f3('0x26')](db[_0xd7f3('0x52')][_0xd7f3('0x4b')](_0x3ce50d(_0xdf250d,_0xd7f3('0x53')))[_0xd7f3('0x48')](function(){})[_0xd7f3('0x4d')](_0x1fe738()));break;case'onlyIfOpen':_0x136843[_0xd7f3('0x26')](db['sequelize'][_0xd7f3('0x4b')](_0x2a7bd8(_0xdf250d,_0xd7f3('0x53')))['then'](function(){})[_0xd7f3('0x4d')](_0x1fe738()));break;default:_0x136843[_0xd7f3('0x26')](db[_0xd7f3('0x52')][_0xd7f3('0x4b')](_0x2281d2(_0xdf250d,_0xd7f3('0x53')))['then'](function(){})[_0xd7f3('0x4d')](_0x1fe738()));}}}return _0x136843;})['all']();})[_0xd7f3('0x48')](function(){return db[_0xd7f3('0x50')][_0xd7f3('0x51')]({'attributes':['id'],'include':[{'model':db[_0xd7f3('0x46')],'as':_0xd7f3('0x4f'),'where':{'id':LISTID}}]})[_0xd7f3('0x48')](function(_0x52c64a){var _0x2b2561=[];if(_0x52c64a){for(var _0x3182cb=0x0,_0x5c54b3;_0x3182cb<_0x52c64a[_0xd7f3('0x18')];_0x3182cb+=0x1){_0x5c54b3=_0x52c64a[_0x3182cb][_0xd7f3('0x49')]({'plain':!![]});_0x2b2561[_0xd7f3('0x26')](db['sequelize'][_0xd7f3('0x4b')](_0x6dd73a(_0x5c54b3,_0xd7f3('0x53')))[_0xd7f3('0x48')](function(){})['catch'](_0x1fe738()));}}return _0x2b2561;})[_0xd7f3('0x54')]();})[_0xd7f3('0x4d')](function(_0x11f335){logger[_0xd7f3('0x15')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x11f335[_0xd7f3('0x28')]);});}var processPromises=function(_0x46e243){return BPromise[_0xd7f3('0x54')](promises)[_0xd7f3('0x48')](function(_0x5f65fe){})[_0xd7f3('0x4d')](function(_0x18abf1){logger[_0xd7f3('0x15')]('Error\x20processing\x20rows\x20block:',JSON[_0xd7f3('0x55')](_0x18abf1));})[_0xd7f3('0x56')](function(){socket[_0xd7f3('0x57')](_0xd7f3('0x58')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x46e243){return _0x46e243['resume']();}});};var endCsv=function(){return BPromise[_0xd7f3('0x59')]()[_0xd7f3('0x48')](function(){if(hopperContacts){return checkHopper();}})[_0xd7f3('0x48')](function(){socket[_0xd7f3('0x57')](_0xd7f3('0x58')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xd7f3('0x5a')](FILEPATH);}catch(_0x2c1454){logger['error'](_0xd7f3('0x5b'),JSON[_0xd7f3('0x55')](_0x2c1454));}finally{process[_0xd7f3('0x5c')](0x0);}});};process['on'](_0xd7f3('0x5d'),function(){logger['info'](_0xd7f3('0x5e'));endCsv();});function main(){return BPromise['resolve']()[_0xd7f3('0x48')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xd7f3('0x10')](',');return db[_0xd7f3('0x24')][_0xd7f3('0x51')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xd7f3('0x48')](function(_0x2263d8){var _0x435e15=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xd7f3('0x5f')](_0x435e15,{'header':!![],'skipEmptyLines':!![],'step':function(_0x445503,_0x3f9a18){total+=0x1;var _0x95947e=total;promises[_0xd7f3('0x26')](checkRow(_0x445503,_0x2263d8,_0x95947e)[_0xd7f3('0x48')](function(){success+=0x1;})[_0xd7f3('0x4d')](function(_0x312927){if(_0x312927[_0xd7f3('0x15')]){errors+=0x1;delete _0x312927[_0xd7f3('0x15')];}else if(_0x312927[_0xd7f3('0x60')]){duplicates+=0x1;delete _0x312927[_0xd7f3('0x60')];}rows[_0xd7f3('0x26')](_0x312927);}));if(total%0xc8===0x0){_0x3f9a18['pause']();return processPromises(_0x3f9a18);}},'complete':function(){return processPromises()[_0xd7f3('0x48')](function(){logger[_0xd7f3('0x61')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x2b4ccc,_0x2eeff9){logger[_0xd7f3('0x61')]('CSV\x20parse\x20error',JSON[_0xd7f3('0x55')](_0x2b4ccc));endCsv();}});})[_0xd7f3('0x4d')](function(_0x3561d0){logger[_0xd7f3('0x15')](_0xd7f3('0x62'),JSON['stringify'](_0x3561d0));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index a35afa8..5091fa4 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 _0x70c8=['cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_hopper_black','ListId','createdAt','toString','.offset-cm_contacts.utcOffset\x20minute)','.CmListId\x20=\x20?','\x22onlyIfOpen\x22','ListId\x20=\x20?','\x20=\x20','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','OrderBy','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','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','spread','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','catch','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=','timezones','dialTimezone','utcOffset','set','offset','main','start','binding','socket_timestamp','root','server/files/tmp','.csv','includes','ContactItemType','name','_description','header','writeFileSync','createReadStream','data','find','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','hasOwnProperty','itemTypeId','description','SystemRow','rows','emit','contact:import:','Abort\x20parser','SystemError','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','orderBy','VoiceQueueId','campaigns_has_cm_blacklists','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','finish','affectedRows','unlink','complete','argv','existsSync','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','then','length','push','all','split','isNil','CmContactHasItem','update','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?'];(function(_0x122213,_0x3bfb84){var _0x4eebc0=function(_0x367d90){while(--_0x367d90){_0x122213['push'](_0x122213['shift']());}};_0x4eebc0(++_0x3bfb84);}(_0x70c8,0x7d));var _0x870c=function(_0x34263d,_0x1c51ca){_0x34263d=_0x34263d-0x0;var _0x3b5f59=_0x70c8[_0x34263d];return _0x3b5f59;};'use strict';var fs=require('fs');var path=require(_0x870c('0x0'));var _=require(_0x870c('0x1'));var Papa=require(_0x870c('0x2'));var util=require(_0x870c('0x3'));var BPromise=require(_0x870c('0x4'));var moment=require(_0x870c('0x5'));var squel=require(_0x870c('0x6'));var Redis=require(_0x870c('0x7'));var db=require(_0x870c('0x8'))['db'];var config=require('../../../config/environment');var shared=require(_0x870c('0x9'));var logger=require(_0x870c('0xa'))('import');config[_0x870c('0xb')]=_[_0x870c('0xc')](config['redis'],{'host':_0x870c('0xd'),'port':0x18eb});var socket=require(_0x870c('0xe'))(new Redis(config[_0x870c('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x870c('0xf')](_0x870c('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x48928b){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))*$/[_0x870c('0x11')](_0x48928b);}function selectNotIn(_0x302741,_0x24444d,_0x3ed999,_0x502f32,_0xd8558f){return squel[_0x870c('0x12')]()[_0x870c('0x13')](_0x870c('0x14'))[_0x870c('0x15')](_0x502f32)[_0x870c('0x16')](_0x24444d,null,_0x24444d+_0x870c('0x17')+_0x502f32+'.'+_0x3ed999)[_0x870c('0x18')](_0x502f32+'.'+_0x3ed999+'\x20=\x20'+_0x302741+'.'+_0x3ed999)['where'](_0x24444d+_0x870c('0x19')+_0xd8558f[_0x870c('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2b1b53,_0x49161d){promisesAdditionalPhones=[];return db['CmContact'][_0x870c('0x1a')]({'raw':!![],'attributes':['id',_0x870c('0x1b')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x870c('0x1c')](function(_0x3dd609){if(_0x3dd609!==null){var _0x27f1ba=[];for(var _0x408db4=0x0;_0x408db4<_0x3dd609[_0x870c('0x1d')];_0x408db4++){var _0x510d67=_0x3dd609[_0x408db4];_0x27f1ba[_0x870c('0x1e')](insertAdditionalPhones(_0x510d67));}}Promise[_0x870c('0x1f')](_0x27f1ba)[_0x870c('0x1c')](function(){_0x2b1b53({'val':0x1});});});});}function insertAdditionalPhones(_0x3f3929){return new Promise(function(_0x24fa75,_0xbe4b14){var _0x4b5d43=_0x3f3929[_0x870c('0x1b')];var _0x4def8f=_0x4b5d43['split'](';');var _0x351c18=[];orderBy=0x0;for(var _0x483472=0x0;_0x483472<_0x4def8f[_0x870c('0x1d')];_0x483472++){_0x351c18[_0x870c('0x1e')](splitAdditionalPhone(_0x3f3929['id'],_0x4def8f[_0x483472]));}Promise['all'](_0x351c18)['then'](function(){_0x24fa75({'val':_0x4def8f[_0x870c('0x1d')]});});});}function splitAdditionalPhone(_0x55d7c5,_0xfda1d7){return new Promise(function(_0x152017,_0x2a1951){var _0x5b0041=_0xfda1d7[_0x870c('0x20')](':');var _0x53d9c3=_0x5b0041[0x0];var _0xedf4c8=_0x5b0041[0x1];if(!_[_0x870c('0x21')](_0xedf4c8)){var _0x399bf9=_0xedf4c8[_0x870c('0x20')]('|');var _0x1e0c05=[];for(var _0x430dd7=0x0;_0x430dd7<_0x399bf9[_0x870c('0x1d')];_0x430dd7++){if(_0x399bf9[_0x430dd7]!==''){var _0x39034d=_['filter'](promisesAdditionalPhones,{'contactId':_0x55d7c5,'phone':_0x399bf9[_0x430dd7]});if(_0x39034d['length']==0x0){orderBy++;promisesAdditionalPhones[_0x870c('0x1e')]({'contactId':_0x55d7c5,'contactTypeId':_0x53d9c3,'phone':_0x399bf9[_0x430dd7],'orderBy':orderBy});}}}_0x152017({'ok':0x1});}else _0x152017({'res':0x0});});}function createAdditionalPhone(_0x414345,_0x235834,_0x319025,_0x2975ca){var _0x472579='';var _0x355ebd='';var _0x1a438c=_0x319025[_0x870c('0x20')]('§');_0x472579=_0x1a438c[0x0];if(_0x1a438c['length']==0x2)_0x355ebd=_0x1a438c[0x1];return new Promise(function(_0x30c65b,_0xd2c8ff){return db[_0x870c('0x22')]['findOne']({'where':{'CmContactId':_0x414345,'item':_0x472579}})[_0x870c('0x1c')](function(_0x1a07e2){if(_0x1a07e2){return db['CmContactHasItem'][_0x870c('0x23')]({'ItemTypeId':_0x235834,'description':_0x355ebd,'OrderBy':_0x2975ca},{'where':{'CmContactId':_0x414345,'item':_0x472579}})[_0x870c('0x1c')](function(_0x3afd7e){_0x30c65b({'res':'updated'});});}else{return db['CmContactHasItem'][_0x870c('0x24')]({'CmContactId':_0x414345,'item':_0x472579,'description':_0x355ebd,'ItemTypeId':_0x235834,'OrderBy':_0x2975ca,'ItemClass':_0x870c('0x25')})['then'](function(_0x40bef7){_0x30c65b({'res':_0x870c('0x26')});});}});});}function insertCmHopper(_0x181147,_0x4d2376,_0xa7854c,_0x59c5ab,_0x454be6){var _0x458dae=[_0x870c('0x27'),_0x870c('0x28'),_0x870c('0x29'),_0x870c('0x2a'),_0x4d2376+'.'+_0x59c5ab,_0x870c('0x2b'),_0x870c('0x2c'),_0x870c('0x2d'),_0x870c('0x2e'),'\x22'+_0x454be6+'\x22'];return squel[_0x870c('0x2f')]()[_0x870c('0x30')](_0x870c('0x31'))[_0x870c('0x32')]([_0x870c('0x14'),_0x870c('0x33'),_0x870c('0x34'),'ListId',_0x59c5ab,'createdAt',_0x870c('0x35'),_0x870c('0x36'),_0x870c('0x37'),_0x870c('0x38')],squel[_0x870c('0x12')]()[_0x870c('0x39')](_0x458dae)['from'](_0x4d2376)[_0x870c('0x16')](_0x870c('0x3a'),null,_0x870c('0x3b')+_0x4d2376+_0x870c('0x3c'))[_0x870c('0x16')](_0xa7854c,null,_0xa7854c+_0x870c('0x17')+_0x4d2376+'.'+_0x59c5ab)[_0x870c('0x18')](_0x4d2376+'.CmListId\x20=\x20?',_0x181147)[_0x870c('0x18')](_0x870c('0x3d'),NOW)[_0x870c('0x18')](_0x870c('0x3e'),selectNotIn(_0x4d2376,_0xa7854c,_0x59c5ab,_0x870c('0x31'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0x870c('0x18')](_0x870c('0x3e'),selectNotIn(_0x4d2376,_0xa7854c,_0x59c5ab,_0x870c('0x31'),[_0x870c('0x3f')])))['toString']();}function insertCmHopperBlack(_0x3eb17e,_0x22997b,_0x42be92,_0x43eb96){var _0xdc1829=[_0x870c('0x27'),'cm_contacts.id',_0x870c('0x2a'),_0x22997b+'.'+_0x43eb96,'cm_contacts.createdAt',_0x870c('0x2c')];return squel['insert']()[_0x870c('0x30')](_0x870c('0x40'))['fromQuery']([_0x870c('0x14'),_0x870c('0x34'),_0x870c('0x41'),_0x43eb96,_0x870c('0x42'),_0x870c('0x35')],squel[_0x870c('0x12')]()[_0x870c('0x39')](_0xdc1829)[_0x870c('0x15')](_0x22997b)[_0x870c('0x16')](_0x870c('0x3a'),null,_0x870c('0x3b')+_0x22997b+_0x870c('0x3c'))[_0x870c('0x16')](_0x42be92,null,_0x42be92+'.id\x20=\x20'+_0x22997b+'.'+_0x43eb96)['where'](_0x22997b+'.CmListId\x20=\x20?',_0x3eb17e)[_0x870c('0x18')](_0x870c('0x3d'),NOW)[_0x870c('0x18')](_0x870c('0x3e'),squel['select']()['field']('phone')[_0x870c('0x15')](_0x870c('0x40'))['where']('ListId\x20=\x20?',_0x3eb17e)[_0x870c('0x18')](_0x43eb96+'\x20=\x20'+_0x22997b+'.'+_0x43eb96)))[_0x870c('0x43')]();}function insertTzCmHopper(_0x143b1f,_0x18efcf,_0x63aab2,_0x4aa961,_0x32bf75,_0x730289){var _0xb4ae49=[_0x870c('0x27'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x730289+_0x870c('0x44'),'cm_contacts.id',_0x870c('0x2a'),_0x18efcf+'.'+_0x4aa961,_0x870c('0x2b'),_0x870c('0x2c'),_0x870c('0x2d'),_0x870c('0x2e'),'\x22'+_0x32bf75+'\x22'];var _0x5ca471=squel[_0x870c('0x2f')]()['into'](_0x870c('0x31'))['fromQuery']([_0x870c('0x14'),_0x870c('0x33'),_0x870c('0x34'),_0x870c('0x41'),_0x4aa961,_0x870c('0x42'),'updatedAt','priority',_0x870c('0x37'),'recallme'],squel['select']()['fields'](_0xb4ae49)[_0x870c('0x15')](_0x18efcf)['join']('cm_contacts',null,_0x870c('0x3b')+_0x18efcf+_0x870c('0x3c'))[_0x870c('0x16')](_0x63aab2,null,_0x63aab2+_0x870c('0x17')+_0x18efcf+'.'+_0x4aa961)[_0x870c('0x16')](_0x730289,null,_0x730289+_0x870c('0x17')+_0x18efcf+'.'+_0x4aa961)['where'](_0x18efcf+_0x870c('0x45'),_0x143b1f)[_0x870c('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x870c('0x18')](_0x870c('0x3e'),selectNotIn(_0x18efcf,_0x63aab2,_0x4aa961,_0x870c('0x31'),[_0x870c('0x3f'),_0x870c('0x46')]))[_0x870c('0x18')](_0x870c('0x3e'),selectNotIn(_0x18efcf,_0x63aab2,_0x4aa961,_0x870c('0x31'),['\x22always\x22'])))[_0x870c('0x43')]();return _0x5ca471;}function insertTzCmHopperBlack(_0x5421b5,_0x4a2f81,_0x24b1d4,_0x1533cf){var _0x53e66c=[_0x870c('0x27'),'cm_contacts.id',_0x870c('0x2a'),_0x4a2f81+'.'+_0x1533cf,_0x870c('0x2b'),'cm_contacts.updatedAt'];return squel['insert']()['into'](_0x870c('0x40'))['fromQuery'](['phone',_0x870c('0x34'),'ListId',_0x1533cf,'createdAt',_0x870c('0x35')],squel[_0x870c('0x12')]()['fields'](_0x53e66c)[_0x870c('0x15')](_0x4a2f81)[_0x870c('0x16')](_0x870c('0x3a'),null,_0x870c('0x3b')+_0x4a2f81+_0x870c('0x3c'))[_0x870c('0x16')](_0x24b1d4,null,_0x24b1d4+_0x870c('0x17')+_0x4a2f81+'.'+_0x1533cf)['where'](_0x4a2f81+_0x870c('0x45'),_0x5421b5)[_0x870c('0x18')](_0x870c('0x3d'),NOW)['where'](_0x870c('0x3e'),squel['select']()[_0x870c('0x13')](_0x870c('0x14'))[_0x870c('0x15')](_0x870c('0x40'))['where'](_0x870c('0x47'),_0x5421b5)['where'](_0x1533cf+_0x870c('0x48')+_0x4a2f81+'.'+_0x1533cf)))[_0x870c('0x43')]();}function insertCmHopperAdditionalPhones(_0x483886){var _0x1a6bc0=[_0x870c('0x49'),_0x870c('0x4a'),_0x870c('0x4b'),_0x870c('0x4c'),_0x870c('0x4d')];return squel[_0x870c('0x2f')]()['into']('cm_hopper_additional_phones')[_0x870c('0x32')](['CmHopperId',_0x870c('0x14'),_0x870c('0x4e'),'createdAt',_0x870c('0x35')],squel['select']()[_0x870c('0x39')](_0x1a6bc0)['from'](_0x870c('0x31'))['join'](_0x870c('0x3a'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')['join'](_0x870c('0x4f'),null,_0x870c('0x50'))[_0x870c('0x18')](_0x870c('0x51'),_0x483886)[_0x870c('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x870c('0x43')]();}function insertCmContact(_0x50a3d2,_0x531d13,_0x12fc51,_0x3a3696){var _0x350204=_[_0x870c('0x52')](_[_0x870c('0x53')](_0x3a3696),[_0x870c('0x41'),_0x870c('0x54'),'createdAt',_0x870c('0x35')]);return squel[_0x870c('0x2f')]()[_0x870c('0x30')](_0x870c('0x3a'))[_0x870c('0x32')](_0x350204,squel[_0x870c('0x12')]()[_0x870c('0x39')](_0x350204)[_0x870c('0x15')](_0x531d13)[_0x870c('0x18')]('('+_0x12fc51[_0x870c('0x16')](',')+_0x870c('0x55'),squel['select']()['fields'](_0x12fc51)[_0x870c('0x15')](_0x870c('0x3a'))[_0x870c('0x18')](_0x870c('0x47'),_0x50a3d2)[_0x870c('0x18')](_0x870c('0x56')))['where'](_0x870c('0x57'),squel[_0x870c('0x12')]()[_0x870c('0x13')](_0x870c('0x58'),_0x870c('0x59'))[_0x870c('0x15')](_0x531d13)[_0x870c('0x5a')](_0x12fc51[_0x870c('0x16')](','))))[_0x870c('0x43')]();}function handleStop(){logger[_0x870c('0x5b')](_0x870c('0x5c'));stopped=!![];}function handleUncaughtException(_0x578044){logger[_0x870c('0x5d')](_0x578044[_0x870c('0x5e')]);process[_0x870c('0x5f')](0x1);}function handleError(_0x5a445f,_0x3a07b3){stats[_0x870c('0x60')]['push']({'name':_0x3a07b3[_0x870c('0x61')],'message':_0x3a07b3[_0x870c('0x5e')],'row':_0x5a445f});}function handleQuery(_0x19550b){logger[_0x870c('0x5b')](_0x19550b);return db[_0x870c('0x62')][_0x870c('0x63')](_0x19550b)[_0x870c('0x64')](function(_0x50fad8){results['push'](_0x50fad8);})['catch'](function(_0x2ca076){logger[_0x870c('0x5d')](_0x2ca076[_0x870c('0x5e')]);});}function updateTzCampaigns(_0x42a1aa){return new Promise(function(_0x138772,_0x5465e7){var _0x5d3087=squel[_0x870c('0x12')]()['fields'](['campaigns.id','campaigns.dialTimezone'])[_0x870c('0x15')](_0x870c('0x65'))[_0x870c('0x16')]('campaigns_has_cm_lists',null,_0x870c('0x66'))[_0x870c('0x18')]('campaigns_has_cm_lists.CmListId='+_0x42a1aa);db[_0x870c('0x62')][_0x870c('0x63')](_0x5d3087[_0x870c('0x43')]())[_0x870c('0x64')](function(_0x590751){var _0x8a4ad5=[];for(var _0xe5e335=0x0;_0xe5e335<_0x590751[_0x870c('0x1d')];_0xe5e335++){_0x8a4ad5[_0x870c('0x1e')](getTimezoneData(_0x590751[_0xe5e335],tmp_campaigns));}BPromise[_0x870c('0x1f')](_0x8a4ad5)[_0x870c('0x1c')](function(){_0x138772({'val':0x1});});})[_0x870c('0x67')](function(_0x380bdb){logger[_0x870c('0x5d')](_0x380bdb[_0x870c('0x5e')]);_0x138772({'val':0x0});});});}function updateTzVoiceQueues(_0x298a28){return new Promise(function(_0x505843,_0x4ede6f){var _0x2edff1=squel[_0x870c('0x12')]()[_0x870c('0x39')]([_0x870c('0x68'),_0x870c('0x69')])['from'](_0x870c('0x6a'))[_0x870c('0x16')](_0x870c('0x6b'),null,_0x870c('0x6c'))['where'](_0x870c('0x6d')+_0x298a28);db[_0x870c('0x62')][_0x870c('0x63')](_0x2edff1[_0x870c('0x43')]())['spread'](function(_0x51f20b){var _0x2ff1e1=[];for(var _0x517da8=0x0;_0x517da8<_0x51f20b[_0x870c('0x1d')];_0x517da8++){_0x2ff1e1[_0x870c('0x1e')](getTimezoneData(_0x51f20b[_0x517da8],tmp_voice_queues));}BPromise[_0x870c('0x1f')](_0x2ff1e1)[_0x870c('0x1c')](function(){_0x505843({'val':0x1});});})[_0x870c('0x67')](function(_0x21a43c){logger[_0x870c('0x5d')](_0x21a43c['message']);_0x505843({'val':0x0});});});}function getTimezoneData(_0x12731b,_0x560330){return new Promise(function(_0xe707e5,_0x29e23f){var _0xfd1b2e=shared[_0x870c('0x6e')];var _0x251b67=_0xfd1b2e[_0x12731b[_0x870c('0x6f')]];if(_[_0x870c('0x21')](_0x251b67)){_0xe707e5({'ret':0x1});}else{var _0x373602=_0x251b67[_0x870c('0x70')];var _0x16bad3=squel[_0x870c('0x2f')]()[_0x870c('0x30')](_0x560330)[_0x870c('0x71')]('id',_0x12731b['id'])['set'](_0x870c('0x72'),_0x373602)[_0x870c('0x71')]('dialTimezone',_0x12731b[_0x870c('0x6f')])['toString']();return db[_0x870c('0x62')]['query'](_0x16bad3)[_0x870c('0x64')](function(_0x58b28c){_0xe707e5({'ret':0x1});})['catch'](function(_0x108289){logger[_0x870c('0x5d')](_0x108289[_0x870c('0x5e')]);_0x29e23f({'ret':0x1});});}});}function handleTZQuery(_0x280a36){logger[_0x870c('0x5b')](_0x280a36);return db[_0x870c('0x62')][_0x870c('0x63')](_0x280a36)['spread'](function(_0x39ef89){})['catch'](function(_0x52ec68){logger[_0x870c('0x5d')](_0x52ec68[_0x870c('0x5e')]);});}function main(_0x45e364,_0x2067fe,_0x6f86b7,_0x20757b){logger[_0x870c('0x5b')](_0x870c('0x73'),_0x45e364,JSON['stringify'](_0x2067fe));process['send'](_0x870c('0x74'));var _0x2645ec=_0x2067fe[_0x870c('0x75')];var _0x507b90=_['clone'](_0x2645ec);var _0x28ff11=_0x2067fe[_0x870c('0x76')];var _0x46612c=path[_0x870c('0x16')](config[_0x870c('0x77')],_0x870c('0x78'),_0x28ff11+_0x870c('0x79'));hasTZ=_[_0x870c('0x53')](_0x2645ec)[_0x870c('0x7a')]('dialTimezone');var _0x5aa560=_[_0x870c('0x53')](_0x2645ec)['join']();logger['info']('header',_0x5aa560);db[_0x870c('0x7b')][_0x870c('0x1a')]({'raw':!![],'attributes':['id',_0x870c('0x7c')]})[_0x870c('0x1c')](function(_0x5eb9c7){for(var _0x41f6f2=0x0;_0x41f6f2<_0x5eb9c7[_0x870c('0x1d')];_0x41f6f2++){if(_0x5eb9c7[_0x41f6f2][_0x870c('0x7c')]in _0x2645ec){contactItemTypes[_0x870c('0x1e')](_0x5eb9c7[_0x41f6f2]);delete _0x507b90[_0x5eb9c7[_0x41f6f2]['name']];hasAdditionalPhones=!![];}for(var _0x4fc662 in _0x2645ec){if(_0x5eb9c7[_0x41f6f2][_0x870c('0x7c')]+_0x870c('0x7d')===_0x4fc662){phoneDescriptions['push']({'itemTypeId':_0x5eb9c7[_0x41f6f2]['id'],'description':_0x4fc662});delete _0x507b90[_0x4fc662];}}}if(hasAdditionalPhones)_0x507b90[_0x870c('0x1b')]='';var _0x2fc6ce=_[_0x870c('0x53')](_0x507b90)[_0x870c('0x16')]();logger[_0x870c('0x5b')](_0x870c('0x7e'),_0x2fc6ce);fs[_0x870c('0x7f')](_0x46612c,_0x2fc6ce+'\x0a');Papa['parse'](fs[_0x870c('0x80')](_0x45e364),{'header':!![],'skipEmptyLines':!![],'step':function(_0x702f6e,_0x15bd41){try{for(var _0x1214a2=0x0,_0x587a1d=[];_0x1214a2<_0x702f6e[_0x870c('0x81')][_0x870c('0x1d')];_0x1214a2++){stats['rows']+=0x1;if(_0x702f6e[_0x870c('0x60')][_0x1214a2]){handleError(_0x702f6e['data'][_0x1214a2],_0x702f6e[_0x870c('0x60')][_0x1214a2]);}else{var _0x4f934f=[];var _0x1194d8=[];var _0x3e4fbe={};for(var _0x4e9ae5 in _0x2645ec){let _0x217e66=contactItemTypes[_0x870c('0x82')](_0x40bc86=>_0x40bc86[_0x870c('0x7c')]===_0x4e9ae5);let _0x5db610=contactItemTypes[_0x870c('0x82')](_0x36a73d=>_0x36a73d[_0x870c('0x7c')]+_0x870c('0x7d')===_0x4e9ae5);if(_[_0x870c('0x21')](_0x217e66)&&_[_0x870c('0x21')](_0x5db610)){if(_0x2645ec['hasOwnProperty'](_0x4e9ae5)){if(_0x702f6e[_0x870c('0x81')][_0x1214a2][_0x2645ec[_0x4e9ae5]]){var _0x24ee87=_[_0x870c('0x83')](_0x702f6e[_0x870c('0x81')][_0x1214a2][_0x2645ec[_0x4e9ae5]][_0x870c('0x84')](/"/g,'\x27'));switch(_0x4e9ae5){case'scheduledat':var _0x2c1ad0=moment(_0x24ee87,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x2c1ad0[_0x870c('0x85')]()){_0x587a1d[_0x870c('0x1e')]('\x22'+_0x24ee87+'\x22');}else{_0x4f934f['push'](_0x870c('0x86'));}break;case'priority':var _0x186168=parseInt(_0x24ee87);_0x24ee87=_[_0x870c('0x87')](_0x186168)||_0x186168<0x0||_0x186168>0x4?_0x20757b?0x3:0x2:_0x186168;_0x587a1d[_0x870c('0x1e')]('\x22'+_0x24ee87+'\x22');break;case _0x870c('0x37'):var _0x28f705=parseInt(_0x24ee87);if(_[_0x870c('0x88')](_0x28f705)&&_[_0x870c('0x7a')](_0x6f86b7,_0x28f705)){_0x587a1d['push']('\x22'+_0x28f705+'\x22');}else{_0x4f934f['push'](_0x870c('0x89'));}break;case'email':if(isEmail(_0x24ee87)){_0x587a1d[_0x870c('0x1e')]('\x22'+_0x24ee87+'\x22');}else{_0x4f934f[_0x870c('0x1e')](_0x870c('0x8a'));}break;case _0x870c('0x8b'):var _0x4b205a=moment(_0x24ee87,_0x870c('0x8c'),!![]);if(_0x4b205a[_0x870c('0x85')]()){_0x587a1d[_0x870c('0x1e')]('\x22'+_0x24ee87+'\x22');}else{_0x4f934f[_0x870c('0x1e')](_0x870c('0x8d'));}break;case _0x870c('0x6f'):var _0x41bb29=shared[_0x870c('0x6e')];var _0x5ca0e5=_0x41bb29[_0x24ee87];if(!_[_0x870c('0x21')](_0x5ca0e5)){var _0x2e7406=_0x5ca0e5[_0x870c('0x70')];_0x587a1d[_0x870c('0x1e')]('\x22'+_0x24ee87+'\x22');_0x587a1d[_0x870c('0x1e')]('\x22'+_0x2e7406+'\x22');}break;default:_0x587a1d[_0x870c('0x1e')]('\x22'+_0x24ee87+'\x22');}}else{switch(_0x4e9ae5){case _0x870c('0x8e'):case _0x870c('0x14'):_0x4f934f[_0x870c('0x1e')](_0x4e9ae5+'\x20not\x20specified');break;default:_0x587a1d[_0x870c('0x1e')]('\x22\x22');}}}}else{var _0x350917='';if(!_['isNil'](_0x217e66)){if(!_0x3e4fbe[_0x870c('0x8f')](_0x217e66['id'])){if(!_['isNil'](_0x702f6e[_0x870c('0x81')][_0x1214a2][_0x2645ec[_0x4e9ae5]])){var _0x24ee87=_[_0x870c('0x83')](_0x702f6e[_0x870c('0x81')][_0x1214a2][_0x2645ec[_0x4e9ae5]][_0x870c('0x84')](/"/g,'\x27'));var _0x4bb991=phoneDescriptions[_0x870c('0x82')](_0x14213d=>_0x14213d[_0x870c('0x90')]===_0x217e66['id']);if(!_[_0x870c('0x21')](_0x4bb991)){var _0x2ae661=_['trim'](_0x702f6e[_0x870c('0x81')][_0x1214a2][_0x2645ec[_0x4bb991[_0x870c('0x91')]]][_0x870c('0x84')](/"/g,'\x27'));if(!_[_0x870c('0x21')](_0x2ae661))_0x24ee87=_0x24ee87+'§'+_0x2ae661;}if(_0x350917=='')_0x350917=_0x24ee87;else _0x350917+='|'+_0x24ee87;}_0x1194d8[_0x870c('0x1e')](_0x217e66['id']+':'+_0x350917);_0x3e4fbe[_0x217e66['id']]=0x1;}}}}if(hasAdditionalPhones){_0x587a1d[_0x870c('0x1e')]('\x22'+_0x1194d8['join'](';')+'\x22');}if(_0x4f934f[_0x870c('0x1d')]){handleError(_0x702f6e[_0x870c('0x81')][_0x1214a2],{'code':_0x870c('0x92'),'message':_0x4f934f[_0x870c('0x16')]()});}else{fs['appendFileSync'](_0x46612c,_0x587a1d[_0x870c('0x16')]()+'\x0a');}_0x587a1d=[];}if(!(stats[_0x870c('0x93')]%0xc8)){socket[_0x870c('0x94')](_0x870c('0x95')+_0x28ff11,stats);stats['errors']=[];}}if(stopped){logger[_0x870c('0x5b')](_0x870c('0x96'));_0x15bd41['abort']();}}catch(_0x33ada8){handleError(_0x702f6e[_0x870c('0x81')][_0x1214a2],{'code':_0x870c('0x97'),'message':_0x33ada8['message']});logger['error'](_0x870c('0x98'),_0x33ada8[_0x870c('0x5e')]);}},'complete':function(){try{var _0x569022=[];var _0xc42709=[];var _0x141456=_0x870c('0x3a');if(_0x2067fe['duplicates']&&_0x2067fe[_0x870c('0x99')]['length']){_0x141456=_0x870c('0x9a')+_0x28ff11;_0x569022[_0x870c('0x1e')](_0x870c('0x9b')+_0x141456+_0x870c('0x9c'));}tmp_campaigns=_0x870c('0x9d')+_0x28ff11;tmp_voice_queues=_0x870c('0x9e')+_0x28ff11;_0xc42709[_0x870c('0x1e')](_0x870c('0x9b')+tmp_campaigns+_0x870c('0x9f'));_0xc42709[_0x870c('0x1e')](_0x870c('0x9b')+tmp_voice_queues+_0x870c('0x9f'));BPromise[_0x870c('0xa0')](_0xc42709,handleTZQuery)[_0x870c('0x1c')](function(_0xee1c4){updateTzCampaigns(_0x2067fe['ListId'])['then'](function(_0x4734e8){updateTzVoiceQueues(_0x2067fe[_0x870c('0x41')])['then'](function(_0x197fcd){if(hasTZ)_0x2fc6ce=_0x2fc6ce[_0x870c('0x84')](_0x870c('0x6f'),_0x870c('0xa1'));var _0x56b6d7=util[_0x870c('0xf')](_0x870c('0xa2'),_0x46612c,_0x141456,_0x2fc6ce,_0x2067fe[_0x870c('0x41')],_0x2067fe[_0x870c('0x54')]||null,NOW,NOW);if(_['isNil'](_0x2645ec['scheduledat'])){_0x56b6d7+=_0x870c('0xa3');}_0x569022[_0x870c('0x1e')](_0x56b6d7);if(_0x2067fe[_0x870c('0x99')]&&_0x2067fe[_0x870c('0x99')][_0x870c('0x1d')]){_0x569022[_0x870c('0x1e')](insertCmContact(_0x2067fe[_0x870c('0x41')],_0x141456,_0x2067fe[_0x870c('0x99')],_0x2645ec));_0x569022[_0x870c('0x1e')](_0x870c('0xa4')+_0x141456+';');}BPromise[_0x870c('0xa0')](_0x569022,handleQuery)[_0x870c('0x1c')](function(_0xfe1ce1){BPromise[_0x870c('0x1f')]([handleAdditionalPhones()])[_0x870c('0x1c')](function(){_0x569022=[];for(var _0x55eb7a=0x0;_0x55eb7a\x20\x20');}var _0x5d77dc=path[_0x870c('0x16')](config[_0x870c('0x77')],_0x870c('0x78'),process[_0x870c('0xb0')][0x2]);if(!fs[_0x870c('0xb1')](_0x5d77dc)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x3906a7={};try{_0x3906a7=JSON[_0x870c('0xb2')](process[_0x870c('0xb0')][0x3]);if(!_0x3906a7[_0x870c('0x75')]){throw new Error(_0x870c('0xb3'));}if(!_0x3906a7[_0x870c('0x75')]['phone']){throw new Error(_0x870c('0xb4'));}if(!_0x3906a7[_0x870c('0x75')][_0x870c('0x8e')]){throw new Error('firstName\x20is\x20mandatory');}var _0x5d7be6=0x0;if(_0x3906a7[_0x870c('0x75')]['UserId']){_0x5d7be6=0x1;}if(!_0x3906a7['ListId']){throw new Error(_0x870c('0xb5'));}}catch(_0x9772ab){throw new Error(_0x870c('0xb6'));}var _0x41e149=[];try{_0x41e149=_[_0x870c('0xb7')](JSON[_0x870c('0xb2')](process['argv'][0x4]),'id');}catch(_0x1ce091){logger[_0x870c('0x5b')](_0x870c('0xb8'));}main(_0x5d77dc,_0x3906a7,_0x41e149,_0x5d7be6);}validate();process['on'](_0x870c('0xb9'),handleStop);process['on'](_0x870c('0xba'),handleUncaughtException); \ No newline at end of file +var _0x23fa=['\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','CompanyId','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','voice_queues_has_cm_blacklists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','CampaignId','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/environment/shared','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','findAll','AdditionalPhones','then','push','all','split','length','isNil','CmContactHasItem','findOne','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','recallme','fields','cm_contacts','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','into','cm_hopper_black','updatedAt','cm_contacts.ListId\x20=\x20','cm_contacts.phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','toString','.offset-cm_contacts.utcOffset\x20minute)','priority','UserId','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','error','message','exit','code','sequelize','query','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','spread','catch','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','main','binding','clone','socket_timestamp','root','.csv','includes','header','ContactItemType','name','_description','writeFileSync','data','rows','errors','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','email','email\x20wrong\x20format','dateOfBirth','\x20not\x20specified','itemTypeId','description','appendFileSync','emit','contact:import:','SystemError','step','duplicates','CREATE\x20TABLE\x20'];(function(_0x4a93bb,_0x495404){var _0x208468=function(_0x1d82b7){while(--_0x1d82b7){_0x4a93bb['push'](_0x4a93bb['shift']());}};_0x208468(++_0x495404);}(_0x23fa,0x183));var _0xa23f=function(_0x43caf5,_0x40a4f5){_0x43caf5=_0x43caf5-0x0;var _0x427fc4=_0x23fa[_0x43caf5];return _0x427fc4;};'use strict';var fs=require('fs');var path=require(_0xa23f('0x0'));var _=require(_0xa23f('0x1'));var Papa=require('papaparse');var util=require(_0xa23f('0x2'));var BPromise=require(_0xa23f('0x3'));var moment=require(_0xa23f('0x4'));var squel=require(_0xa23f('0x5'));var Redis=require(_0xa23f('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0xa23f('0x7'));var shared=require(_0xa23f('0x8'));var logger=require('../../../config/logger')(_0xa23f('0x9'));config[_0xa23f('0xa')]=_['defaults'](config['redis'],{'host':_0xa23f('0xb'),'port':0x18eb});var socket=require(_0xa23f('0xc'))(new Redis(config[_0xa23f('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xa23f('0xd')](_0xa23f('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xa23f('0xd')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0xc98fe4){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))*$/[_0xa23f('0xf')](_0xc98fe4);}function selectNotIn(_0xe2e8c4,_0x1546b4,_0x1d8310,_0x415c7d,_0x5a1103){return squel[_0xa23f('0x10')]()[_0xa23f('0x11')](_0xa23f('0x12'))[_0xa23f('0x13')](_0x415c7d)['join'](_0x1546b4,null,_0x1546b4+'.id\x20=\x20'+_0x415c7d+'.'+_0x1d8310)[_0xa23f('0x14')](_0x415c7d+'.'+_0x1d8310+_0xa23f('0x15')+_0xe2e8c4+'.'+_0x1d8310)[_0xa23f('0x14')](_0x1546b4+_0xa23f('0x16')+_0x5a1103[_0xa23f('0x17')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x38cfad,_0x5e29a0){promisesAdditionalPhones=[];return db['CmContact'][_0xa23f('0x18')]({'raw':!![],'attributes':['id',_0xa23f('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xa23f('0x1a')](function(_0x13818b){if(_0x13818b!==null){var _0x178e63=[];for(var _0x18ec3d=0x0;_0x18ec3d<_0x13818b['length'];_0x18ec3d++){var _0x456019=_0x13818b[_0x18ec3d];_0x178e63[_0xa23f('0x1b')](insertAdditionalPhones(_0x456019));}}Promise[_0xa23f('0x1c')](_0x178e63)[_0xa23f('0x1a')](function(){_0x38cfad({'val':0x1});});});});}function insertAdditionalPhones(_0x3a3170){return new Promise(function(_0x30383a,_0x130d36){var _0x14b327=_0x3a3170['AdditionalPhones'];var _0x594848=_0x14b327[_0xa23f('0x1d')](';');var _0x54a320=[];orderBy=0x0;for(var _0x456ea1=0x0;_0x456ea1<_0x594848[_0xa23f('0x1e')];_0x456ea1++){_0x54a320[_0xa23f('0x1b')](splitAdditionalPhone(_0x3a3170['id'],_0x594848[_0x456ea1]));}Promise[_0xa23f('0x1c')](_0x54a320)[_0xa23f('0x1a')](function(){_0x30383a({'val':_0x594848[_0xa23f('0x1e')]});});});}function splitAdditionalPhone(_0x35bf93,_0x3911a0){return new Promise(function(_0x2403d3,_0xc31295){var _0x1851d8=_0x3911a0[_0xa23f('0x1d')](':');var _0x332975=_0x1851d8[0x0];var _0x2e0d05=_0x1851d8[0x1];if(!_[_0xa23f('0x1f')](_0x2e0d05)){var _0x2df0ce=_0x2e0d05[_0xa23f('0x1d')]('|');var _0x4dcfe4=[];for(var _0x2bf693=0x0;_0x2bf693<_0x2df0ce['length'];_0x2bf693++){if(_0x2df0ce[_0x2bf693]!==''){var _0x4242e2=_['filter'](promisesAdditionalPhones,{'contactId':_0x35bf93,'phone':_0x2df0ce[_0x2bf693]});if(_0x4242e2[_0xa23f('0x1e')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x35bf93,'contactTypeId':_0x332975,'phone':_0x2df0ce[_0x2bf693],'orderBy':orderBy});}}}_0x2403d3({'ok':0x1});}else _0x2403d3({'res':0x0});});}function createAdditionalPhone(_0x48cc78,_0x2e0f1a,_0x285a14,_0x27f971){var _0x5eff42='';var _0x457d49='';var _0x49cb6d=_0x285a14[_0xa23f('0x1d')]('§');_0x5eff42=_0x49cb6d[0x0];if(_0x49cb6d[_0xa23f('0x1e')]==0x2)_0x457d49=_0x49cb6d[0x1];return new Promise(function(_0x243807,_0x409003){return db[_0xa23f('0x20')][_0xa23f('0x21')]({'where':{'CmContactId':_0x48cc78,'item':_0x5eff42}})['then'](function(_0x5a080d){if(_0x5a080d){return db[_0xa23f('0x20')]['update']({'ItemTypeId':_0x2e0f1a,'description':_0x457d49,'OrderBy':_0x27f971},{'where':{'CmContactId':_0x48cc78,'item':_0x5eff42}})[_0xa23f('0x1a')](function(_0xb64c5a){_0x243807({'res':'updated'});});}else{return db[_0xa23f('0x20')][_0xa23f('0x22')]({'CmContactId':_0x48cc78,'item':_0x5eff42,'description':_0x457d49,'ItemTypeId':_0x2e0f1a,'OrderBy':_0x27f971,'ItemClass':_0xa23f('0x23')})[_0xa23f('0x1a')](function(_0x37824f){_0x243807({'res':_0xa23f('0x24')});});}});});}function insertCmHopper(_0x37db99,_0xb9482f,_0x318e65,_0x1c0c8a,_0x74ba38){var _0x1f83c8=[_0xa23f('0x25'),_0xa23f('0x26'),_0xa23f('0x27'),_0xa23f('0x28'),_0xb9482f+'.'+_0x1c0c8a,_0xa23f('0x29'),_0xa23f('0x2a'),'cm_contacts.priority',_0xa23f('0x2b'),'\x22'+_0x74ba38+'\x22'];return squel[_0xa23f('0x2c')]()['into'](_0xa23f('0x2d'))[_0xa23f('0x2e')](['phone',_0xa23f('0x2f'),_0xa23f('0x30'),_0xa23f('0x31'),_0x1c0c8a,_0xa23f('0x32'),'updatedAt','priority','UserId',_0xa23f('0x33')],squel[_0xa23f('0x10')]()[_0xa23f('0x34')](_0x1f83c8)['from'](_0xb9482f)[_0xa23f('0x17')](_0xa23f('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0xb9482f+_0xa23f('0x36'))['join'](_0x318e65,null,_0x318e65+_0xa23f('0x37')+_0xb9482f+'.'+_0x1c0c8a)[_0xa23f('0x14')](_0xb9482f+_0xa23f('0x38'),_0x37db99)[_0xa23f('0x14')](_0xa23f('0x39'),NOW)[_0xa23f('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xb9482f,_0x318e65,_0x1c0c8a,_0xa23f('0x2d'),[_0xa23f('0x3a'),_0xa23f('0x3b')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xb9482f,_0x318e65,_0x1c0c8a,'cm_hopper',[_0xa23f('0x3a')])))['toString']();}function insertCmHopperBlack(_0x36133f,_0x676f46,_0x53b752,_0x5434bd){var _0x14dc48=[_0xa23f('0x25'),_0xa23f('0x27'),_0xa23f('0x28'),_0x676f46+'.'+_0x5434bd,'cm_contacts.createdAt',_0xa23f('0x2a')];return squel[_0xa23f('0x2c')]()[_0xa23f('0x3c')](_0xa23f('0x3d'))[_0xa23f('0x2e')]([_0xa23f('0x12'),_0xa23f('0x30'),'ListId',_0x5434bd,_0xa23f('0x32'),_0xa23f('0x3e')],squel['select']()[_0xa23f('0x34')](_0x14dc48)['from'](_0x676f46)['join']('cm_contacts',null,_0xa23f('0x3f')+_0x676f46+'.CmListId')[_0xa23f('0x17')](_0x53b752,null,_0x53b752+_0xa23f('0x37')+_0x676f46+'.'+_0x5434bd)[_0xa23f('0x14')](_0x676f46+'.CmListId\x20=\x20?',_0x36133f)[_0xa23f('0x14')](_0xa23f('0x39'),NOW)[_0xa23f('0x14')](_0xa23f('0x40'),squel[_0xa23f('0x10')]()[_0xa23f('0x11')](_0xa23f('0x12'))[_0xa23f('0x13')](_0xa23f('0x3d'))['where'](_0xa23f('0x41'),_0x36133f)['where'](_0x5434bd+_0xa23f('0x15')+_0x676f46+'.'+_0x5434bd)))[_0xa23f('0x42')]();}function insertTzCmHopper(_0x32817f,_0x363bbe,_0xe404ea,_0x4c487e,_0x2a6607,_0x416407){var _0x47c2d5=[_0xa23f('0x25'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x416407+_0xa23f('0x43'),_0xa23f('0x27'),_0xa23f('0x28'),_0x363bbe+'.'+_0x4c487e,_0xa23f('0x29'),_0xa23f('0x2a'),'cm_contacts.priority',_0xa23f('0x2b'),'\x22'+_0x2a6607+'\x22'];var _0x2249ad=squel[_0xa23f('0x2c')]()[_0xa23f('0x3c')]('cm_hopper')[_0xa23f('0x2e')](['phone','scheduledat','ContactId',_0xa23f('0x31'),_0x4c487e,_0xa23f('0x32'),_0xa23f('0x3e'),_0xa23f('0x44'),_0xa23f('0x45'),_0xa23f('0x33')],squel[_0xa23f('0x10')]()['fields'](_0x47c2d5)[_0xa23f('0x13')](_0x363bbe)['join'](_0xa23f('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x363bbe+_0xa23f('0x36'))[_0xa23f('0x17')](_0xe404ea,null,_0xe404ea+_0xa23f('0x37')+_0x363bbe+'.'+_0x4c487e)[_0xa23f('0x17')](_0x416407,null,_0x416407+_0xa23f('0x37')+_0x363bbe+'.'+_0x4c487e)[_0xa23f('0x14')](_0x363bbe+'.CmListId\x20=\x20?',_0x32817f)[_0xa23f('0x14')](_0xa23f('0x39'),NOW)[_0xa23f('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x363bbe,_0xe404ea,_0x4c487e,_0xa23f('0x2d'),['\x22always\x22',_0xa23f('0x3b')]))[_0xa23f('0x14')](_0xa23f('0x40'),selectNotIn(_0x363bbe,_0xe404ea,_0x4c487e,_0xa23f('0x2d'),['\x22always\x22'])))['toString']();return _0x2249ad;}function insertTzCmHopperBlack(_0x120ca,_0x55ff02,_0x120868,_0x41c49a){var _0x445f6e=[_0xa23f('0x25'),_0xa23f('0x27'),_0xa23f('0x28'),_0x55ff02+'.'+_0x41c49a,_0xa23f('0x29'),_0xa23f('0x2a')];return squel[_0xa23f('0x2c')]()['into'](_0xa23f('0x3d'))[_0xa23f('0x2e')](['phone',_0xa23f('0x30'),_0xa23f('0x31'),_0x41c49a,_0xa23f('0x32'),_0xa23f('0x3e')],squel['select']()[_0xa23f('0x34')](_0x445f6e)[_0xa23f('0x13')](_0x55ff02)['join'](_0xa23f('0x35'),null,_0xa23f('0x3f')+_0x55ff02+'.CmListId')['join'](_0x120868,null,_0x120868+_0xa23f('0x37')+_0x55ff02+'.'+_0x41c49a)[_0xa23f('0x14')](_0x55ff02+'.CmListId\x20=\x20?',_0x120ca)[_0xa23f('0x14')](_0xa23f('0x39'),NOW)[_0xa23f('0x14')](_0xa23f('0x40'),squel[_0xa23f('0x10')]()[_0xa23f('0x11')](_0xa23f('0x12'))[_0xa23f('0x13')]('cm_hopper_black')[_0xa23f('0x14')](_0xa23f('0x41'),_0x120ca)['where'](_0x41c49a+_0xa23f('0x15')+_0x55ff02+'.'+_0x41c49a)))[_0xa23f('0x42')]();}function insertCmHopperAdditionalPhones(_0x1b3346){var _0x15da04=[_0xa23f('0x46'),_0xa23f('0x47'),_0xa23f('0x48'),_0xa23f('0x49'),'cm_contact_has_items.updatedAt'];return squel['insert']()['into'](_0xa23f('0x4a'))[_0xa23f('0x2e')]([_0xa23f('0x4b'),_0xa23f('0x12'),_0xa23f('0x4c'),'createdAt','updatedAt'],squel['select']()[_0xa23f('0x34')](_0x15da04)[_0xa23f('0x13')](_0xa23f('0x2d'))[_0xa23f('0x17')](_0xa23f('0x35'),null,_0xa23f('0x4d'))[_0xa23f('0x17')](_0xa23f('0x4e'),null,_0xa23f('0x4f'))[_0xa23f('0x14')](_0xa23f('0x50'),_0x1b3346)['where'](_0xa23f('0x39'),NOW))[_0xa23f('0x42')]();}function insertCmContact(_0x4e4bde,_0xf2f8d7,_0x2c720d,_0x1b77b9){var _0x2d076a=_['concat'](_[_0xa23f('0x51')](_0x1b77b9),[_0xa23f('0x31'),'CompanyId',_0xa23f('0x32'),_0xa23f('0x3e')]);return squel[_0xa23f('0x2c')]()['into'](_0xa23f('0x35'))['fromQuery'](_0x2d076a,squel[_0xa23f('0x10')]()[_0xa23f('0x34')](_0x2d076a)['from'](_0xf2f8d7)[_0xa23f('0x14')]('('+_0x2c720d[_0xa23f('0x17')](',')+_0xa23f('0x52'),squel['select']()[_0xa23f('0x34')](_0x2c720d)['from']('cm_contacts')[_0xa23f('0x14')]('ListId\x20=\x20?',_0x4e4bde)[_0xa23f('0x14')](_0xa23f('0x53')))[_0xa23f('0x14')](_0xa23f('0x54'),squel[_0xa23f('0x10')]()[_0xa23f('0x11')]('MIN(id)',_0xa23f('0x55'))['from'](_0xf2f8d7)[_0xa23f('0x56')](_0x2c720d[_0xa23f('0x17')](','))))[_0xa23f('0x42')]();}function handleStop(){logger[_0xa23f('0x57')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x302be9){logger[_0xa23f('0x58')](_0x302be9[_0xa23f('0x59')]);process[_0xa23f('0x5a')](0x1);}function handleError(_0x40b485,_0x5be6d6){stats['errors'][_0xa23f('0x1b')]({'name':_0x5be6d6[_0xa23f('0x5b')],'message':_0x5be6d6[_0xa23f('0x59')],'row':_0x40b485});}function handleQuery(_0x24e700){logger['info'](_0x24e700);return db[_0xa23f('0x5c')][_0xa23f('0x5d')](_0x24e700)['spread'](function(_0x5983a1){results[_0xa23f('0x1b')](_0x5983a1);})['catch'](function(_0x8176eb){logger['error'](_0x8176eb[_0xa23f('0x59')]);});}function updateTzCampaigns(_0x123e8c){return new Promise(function(_0x36f5ac,_0x3c5081){var _0x348ac0=squel['select']()[_0xa23f('0x34')]([_0xa23f('0x5e'),_0xa23f('0x5f')])[_0xa23f('0x13')](_0xa23f('0x60'))[_0xa23f('0x17')]('campaigns_has_cm_lists',null,_0xa23f('0x61'))[_0xa23f('0x14')](_0xa23f('0x62')+_0x123e8c);db['sequelize'][_0xa23f('0x5d')](_0x348ac0[_0xa23f('0x42')]())[_0xa23f('0x63')](function(_0x5ea1c2){var _0x13e0fa=[];for(var _0xdae2c0=0x0;_0xdae2c0<_0x5ea1c2[_0xa23f('0x1e')];_0xdae2c0++){_0x13e0fa['push'](getTimezoneData(_0x5ea1c2[_0xdae2c0],tmp_campaigns));}BPromise[_0xa23f('0x1c')](_0x13e0fa)[_0xa23f('0x1a')](function(){_0x36f5ac({'val':0x1});});})[_0xa23f('0x64')](function(_0x36b0de){logger[_0xa23f('0x58')](_0x36b0de[_0xa23f('0x59')]);_0x36f5ac({'val':0x0});});});}function updateTzVoiceQueues(_0x3605cf){return new Promise(function(_0xc9a09c,_0x4b92e2){var _0x5af8bd=squel[_0xa23f('0x10')]()['fields'](['voice_queues.id',_0xa23f('0x65')])[_0xa23f('0x13')]('voice_queues')[_0xa23f('0x17')](_0xa23f('0x66'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0xa23f('0x14')](_0xa23f('0x67')+_0x3605cf);db[_0xa23f('0x5c')][_0xa23f('0x5d')](_0x5af8bd[_0xa23f('0x42')]())[_0xa23f('0x63')](function(_0x3d1511){var _0x252e3=[];for(var _0x2a6501=0x0;_0x2a6501<_0x3d1511['length'];_0x2a6501++){_0x252e3[_0xa23f('0x1b')](getTimezoneData(_0x3d1511[_0x2a6501],tmp_voice_queues));}BPromise[_0xa23f('0x1c')](_0x252e3)[_0xa23f('0x1a')](function(){_0xc9a09c({'val':0x1});});})[_0xa23f('0x64')](function(_0x553601){logger[_0xa23f('0x58')](_0x553601[_0xa23f('0x59')]);_0xc9a09c({'val':0x0});});});}function getTimezoneData(_0xde60a5,_0x394ddf){return new Promise(function(_0x34027b,_0x7e3f1e){var _0x50db6f=shared[_0xa23f('0x68')];var _0x12c140=_0x50db6f[_0xde60a5[_0xa23f('0x69')]];if(_[_0xa23f('0x1f')](_0x12c140)){_0x34027b({'ret':0x1});}else{var _0x5b284b=_0x12c140[_0xa23f('0x6a')];var _0x1a3fc1=squel[_0xa23f('0x2c')]()[_0xa23f('0x3c')](_0x394ddf)[_0xa23f('0x6b')]('id',_0xde60a5['id'])[_0xa23f('0x6b')](_0xa23f('0x6c'),_0x5b284b)['set']('dialTimezone',_0xde60a5[_0xa23f('0x69')])[_0xa23f('0x42')]();return db[_0xa23f('0x5c')][_0xa23f('0x5d')](_0x1a3fc1)[_0xa23f('0x63')](function(_0x34db12){_0x34027b({'ret':0x1});})[_0xa23f('0x64')](function(_0x366640){logger[_0xa23f('0x58')](_0x366640[_0xa23f('0x59')]);_0x7e3f1e({'ret':0x1});});}});}function handleTZQuery(_0x167341){logger[_0xa23f('0x57')](_0x167341);return db[_0xa23f('0x5c')][_0xa23f('0x5d')](_0x167341)[_0xa23f('0x63')](function(_0x50d840){})[_0xa23f('0x64')](function(_0xd6b447){logger[_0xa23f('0x58')](_0xd6b447[_0xa23f('0x59')]);});}function main(_0x1caea5,_0x427095,_0x56440e,_0x26eb55){logger[_0xa23f('0x57')](_0xa23f('0x6d'),_0x1caea5,JSON['stringify'](_0x427095));process['send']('start');var _0x3fa940=_0x427095[_0xa23f('0x6e')];var _0x4d9590=_[_0xa23f('0x6f')](_0x3fa940);var _0x2a0369=_0x427095[_0xa23f('0x70')];var _0x1efc02=path[_0xa23f('0x17')](config[_0xa23f('0x71')],'server/files/tmp',_0x2a0369+_0xa23f('0x72'));hasTZ=_[_0xa23f('0x51')](_0x3fa940)[_0xa23f('0x73')](_0xa23f('0x69'));var _0x481f23=_[_0xa23f('0x51')](_0x3fa940)[_0xa23f('0x17')]();logger[_0xa23f('0x57')](_0xa23f('0x74'),_0x481f23);db[_0xa23f('0x75')][_0xa23f('0x18')]({'raw':!![],'attributes':['id','name']})[_0xa23f('0x1a')](function(_0x3bc3c9){for(var _0x38a38d=0x0;_0x38a38d<_0x3bc3c9['length'];_0x38a38d++){if(_0x3bc3c9[_0x38a38d]['name']in _0x3fa940){contactItemTypes[_0xa23f('0x1b')](_0x3bc3c9[_0x38a38d]);delete _0x4d9590[_0x3bc3c9[_0x38a38d][_0xa23f('0x76')]];hasAdditionalPhones=!![];}for(var _0x3ac326 in _0x3fa940){if(_0x3bc3c9[_0x38a38d][_0xa23f('0x76')]+_0xa23f('0x77')===_0x3ac326){phoneDescriptions[_0xa23f('0x1b')]({'itemTypeId':_0x3bc3c9[_0x38a38d]['id'],'description':_0x3ac326});delete _0x4d9590[_0x3ac326];}}}if(hasAdditionalPhones)_0x4d9590['AdditionalPhones']='';var _0x23792e=_[_0xa23f('0x51')](_0x4d9590)[_0xa23f('0x17')]();logger[_0xa23f('0x57')](_0xa23f('0x74'),_0x23792e);fs[_0xa23f('0x78')](_0x1efc02,_0x23792e+'\x0a');Papa['parse'](fs['createReadStream'](_0x1caea5),{'header':!![],'skipEmptyLines':!![],'step':function(_0x44f796,_0xf739fb){try{for(var _0x28d1e2=0x0,_0xacc42e=[];_0x28d1e2<_0x44f796[_0xa23f('0x79')]['length'];_0x28d1e2++){stats[_0xa23f('0x7a')]+=0x1;if(_0x44f796[_0xa23f('0x7b')][_0x28d1e2]){handleError(_0x44f796[_0xa23f('0x79')][_0x28d1e2],_0x44f796[_0xa23f('0x7b')][_0x28d1e2]);}else{var _0x26da93=[];var _0x333ca2=[];var _0x37845c={};for(var _0x9c4c3b in _0x3fa940){let _0x1d4e96=contactItemTypes['find'](_0x56cd90=>_0x56cd90[_0xa23f('0x76')]===_0x9c4c3b);let _0x58b1e8=contactItemTypes['find'](_0x5dac88=>_0x5dac88['name']+_0xa23f('0x77')===_0x9c4c3b);if(_['isNil'](_0x1d4e96)&&_['isNil'](_0x58b1e8)){if(_0x3fa940[_0xa23f('0x7c')](_0x9c4c3b)){if(_0x44f796[_0xa23f('0x79')][_0x28d1e2][_0x3fa940[_0x9c4c3b]]){var _0x1d97d2=_[_0xa23f('0x7d')](_0x44f796[_0xa23f('0x79')][_0x28d1e2][_0x3fa940[_0x9c4c3b]][_0xa23f('0x7e')](/"/g,'\x27'));switch(_0x9c4c3b){case _0xa23f('0x2f'):var _0x9c90b2=moment(_0x1d97d2,_0xa23f('0xe'),!![]);if(_0x9c90b2[_0xa23f('0x7f')]()){_0xacc42e[_0xa23f('0x1b')]('\x22'+_0x1d97d2+'\x22');}else{_0x26da93[_0xa23f('0x1b')](_0xa23f('0x80'));}break;case _0xa23f('0x44'):var _0x83f206=parseInt(_0x1d97d2);_0x1d97d2=_[_0xa23f('0x81')](_0x83f206)||_0x83f206<0x0||_0x83f206>0x4?_0x26eb55?0x3:0x2:_0x83f206;_0xacc42e[_0xa23f('0x1b')]('\x22'+_0x1d97d2+'\x22');break;case _0xa23f('0x45'):var _0x51adb1=parseInt(_0x1d97d2);if(_[_0xa23f('0x82')](_0x51adb1)&&_[_0xa23f('0x73')](_0x56440e,_0x51adb1)){_0xacc42e[_0xa23f('0x1b')]('\x22'+_0x51adb1+'\x22');}else{_0x26da93[_0xa23f('0x1b')]('agent\x20not\x20exists');}break;case _0xa23f('0x83'):if(isEmail(_0x1d97d2)){_0xacc42e[_0xa23f('0x1b')]('\x22'+_0x1d97d2+'\x22');}else{_0x26da93[_0xa23f('0x1b')](_0xa23f('0x84'));}break;case _0xa23f('0x85'):var _0x503a40=moment(_0x1d97d2,'YYYY-MM-DD',!![]);if(_0x503a40[_0xa23f('0x7f')]()){_0xacc42e[_0xa23f('0x1b')]('\x22'+_0x1d97d2+'\x22');}else{_0x26da93['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0xa23f('0x69'):var _0x2bf0d2=shared['timezones'];var _0x3ce3d1=_0x2bf0d2[_0x1d97d2];if(!_[_0xa23f('0x1f')](_0x3ce3d1)){var _0x335258=_0x3ce3d1[_0xa23f('0x6a')];_0xacc42e[_0xa23f('0x1b')]('\x22'+_0x1d97d2+'\x22');_0xacc42e[_0xa23f('0x1b')]('\x22'+_0x335258+'\x22');}break;default:_0xacc42e[_0xa23f('0x1b')]('\x22'+_0x1d97d2+'\x22');}}else{switch(_0x9c4c3b){case'firstName':case'phone':_0x26da93[_0xa23f('0x1b')](_0x9c4c3b+_0xa23f('0x86'));break;default:_0xacc42e['push']('\x22\x22');}}}}else{var _0x14b65f='';if(!_[_0xa23f('0x1f')](_0x1d4e96)){if(!_0x37845c[_0xa23f('0x7c')](_0x1d4e96['id'])){if(!_[_0xa23f('0x1f')](_0x44f796['data'][_0x28d1e2][_0x3fa940[_0x9c4c3b]])){var _0x1d97d2=_[_0xa23f('0x7d')](_0x44f796[_0xa23f('0x79')][_0x28d1e2][_0x3fa940[_0x9c4c3b]][_0xa23f('0x7e')](/"/g,'\x27'));var _0x117fa9=phoneDescriptions['find'](_0xc3de46=>_0xc3de46[_0xa23f('0x87')]===_0x1d4e96['id']);if(!_['isNil'](_0x117fa9)){var _0x366d3c=_[_0xa23f('0x7d')](_0x44f796[_0xa23f('0x79')][_0x28d1e2][_0x3fa940[_0x117fa9[_0xa23f('0x88')]]][_0xa23f('0x7e')](/"/g,'\x27'));if(!_[_0xa23f('0x1f')](_0x366d3c))_0x1d97d2=_0x1d97d2+'§'+_0x366d3c;}if(_0x14b65f=='')_0x14b65f=_0x1d97d2;else _0x14b65f+='|'+_0x1d97d2;}_0x333ca2[_0xa23f('0x1b')](_0x1d4e96['id']+':'+_0x14b65f);_0x37845c[_0x1d4e96['id']]=0x1;}}}}if(hasAdditionalPhones){_0xacc42e[_0xa23f('0x1b')]('\x22'+_0x333ca2['join'](';')+'\x22');}if(_0x26da93[_0xa23f('0x1e')]){handleError(_0x44f796[_0xa23f('0x79')][_0x28d1e2],{'code':'SystemRow','message':_0x26da93[_0xa23f('0x17')]()});}else{fs[_0xa23f('0x89')](_0x1efc02,_0xacc42e['join']()+'\x0a');}_0xacc42e=[];}if(!(stats['rows']%0xc8)){socket[_0xa23f('0x8a')](_0xa23f('0x8b')+_0x2a0369,stats);stats['errors']=[];}}if(stopped){logger[_0xa23f('0x57')]('Abort\x20parser');_0xf739fb['abort']();}}catch(_0x356a9c){handleError(_0x44f796[_0xa23f('0x79')][_0x28d1e2],{'code':_0xa23f('0x8c'),'message':_0x356a9c[_0xa23f('0x59')]});logger[_0xa23f('0x58')](_0xa23f('0x8d'),_0x356a9c[_0xa23f('0x59')]);}},'complete':function(){try{var _0x324c6d=[];var _0x5d2bfb=[];var _0x4d3801='cm_contacts';if(_0x427095[_0xa23f('0x8e')]&&_0x427095['duplicates']['length']){_0x4d3801='cm_contacts_'+_0x2a0369;_0x324c6d[_0xa23f('0x1b')](_0xa23f('0x8f')+_0x4d3801+_0xa23f('0x90'));}tmp_campaigns=_0xa23f('0x91')+_0x2a0369;tmp_voice_queues=_0xa23f('0x92')+_0x2a0369;_0x5d2bfb[_0xa23f('0x1b')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0xa23f('0x93'));_0x5d2bfb['push'](_0xa23f('0x8f')+tmp_voice_queues+_0xa23f('0x93'));BPromise[_0xa23f('0x94')](_0x5d2bfb,handleTZQuery)[_0xa23f('0x1a')](function(_0x4412dc){updateTzCampaigns(_0x427095[_0xa23f('0x31')])[_0xa23f('0x1a')](function(_0x5b3d55){updateTzVoiceQueues(_0x427095[_0xa23f('0x31')])['then'](function(_0x3eb58b){if(hasTZ)_0x23792e=_0x23792e['replace'](_0xa23f('0x69'),_0xa23f('0x95'));var _0x3957c4=util[_0xa23f('0xd')](_0xa23f('0x96'),_0x1efc02,_0x4d3801,_0x23792e,_0x427095[_0xa23f('0x31')],_0x427095[_0xa23f('0x97')]||null,NOW,NOW);if(_[_0xa23f('0x1f')](_0x3fa940[_0xa23f('0x2f')])){_0x3957c4+=',\x20scheduledAt\x20=\x20NOW()';}_0x324c6d['push'](_0x3957c4);if(_0x427095['duplicates']&&_0x427095[_0xa23f('0x8e')][_0xa23f('0x1e')]){_0x324c6d['push'](insertCmContact(_0x427095[_0xa23f('0x31')],_0x4d3801,_0x427095[_0xa23f('0x8e')],_0x3fa940));_0x324c6d[_0xa23f('0x1b')](_0xa23f('0x98')+_0x4d3801+';');}BPromise[_0xa23f('0x94')](_0x324c6d,handleQuery)[_0xa23f('0x1a')](function(_0x11bd8e){BPromise[_0xa23f('0x1c')]([handleAdditionalPhones()])[_0xa23f('0x1a')](function(){_0x324c6d=[];for(var _0x36cfab=0x0;_0x36cfab\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','format','cm_contacts_temp_','YYYYMMDDHHmmss','select','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','spread','length','isNil','phone','AdditionalPhones','push','then','catch','error','message','all','split','filter','CmContactHasItem','findOne','update','updated','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','scheduledat','ContactId','ListId','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','cm_contacts.updatedAt','fromQuery','updatedAt','fields','.CmListId','cm_hopper_black','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','into','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','CompanyId','createdAt',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id'];(function(_0x2c544c,_0x34d8ed){var _0x56382f=function(_0x17ed67){while(--_0x17ed67){_0x2c544c['push'](_0x2c544c['shift']());}};_0x56382f(++_0x34d8ed);}(_0x282b,0xec));var _0xb282=function(_0x2aea4d,_0x126d66){_0x2aea4d=_0x2aea4d-0x0;var _0x672e15=_0x282b[_0x2aea4d];return _0x672e15;};'use strict';var fs=require('fs');var path=require(_0xb282('0x0'));var _=require(_0xb282('0x1'));var Papa=require(_0xb282('0x2'));var util=require(_0xb282('0x3'));var BPromise=require(_0xb282('0x4'));var moment=require('moment');var squel=require('squel');var Redis=require(_0xb282('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0xb282('0x6'));var logger=require(_0xb282('0x7'))(_0xb282('0x8'));config[_0xb282('0x9')]=_[_0xb282('0xa')](config[_0xb282('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb282('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xb282('0xb')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xb282('0xc')+moment()[_0xb282('0xb')](_0xb282('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2d86ba){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'](_0x2d86ba);}function selectNotIn(_0x47e62e,_0x36b984,_0x29faf1,_0x389be7,_0x1cbe28){return squel[_0xb282('0xe')]()['field']('phone')[_0xb282('0xf')](_0x389be7)[_0xb282('0x10')](_0x36b984,null,_0x36b984+_0xb282('0x11')+_0x389be7+'.'+_0x29faf1)[_0xb282('0x12')](_0x389be7+'.'+_0x29faf1+_0xb282('0x13')+_0x47e62e+'.'+_0x29faf1)['where'](_0x36b984+_0xb282('0x14')+_0x1cbe28['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0xe1d53,_0x211862){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize']['query']('select\x20*\x20from\x20'+tempTableName)[_0xb282('0x15')](function(_0x350676){if(_0x350676!==null){var _0x7c20df=[];for(var _0xbb182=0x0;_0xbb182<_0x350676[_0xb282('0x16')];_0xbb182++){var _0x5307ed=_0x350676[_0xbb182];if(!_[_0xb282('0x17')](_0x5307ed[_0xb282('0x18')])){if(!_[_0xb282('0x17')](_0x5307ed[_0xb282('0x19')]))_0x7c20df[_0xb282('0x1a')](insertAdditionalPhones(_0x5307ed));promisesContact['push']({'contact':_0x5307ed});}}}Promise['all'](_0x7c20df)[_0xb282('0x1b')](function(){_0xe1d53({'val':0x1});});})[_0xb282('0x1c')](function(_0x599f9e){logger[_0xb282('0x1d')](_0x599f9e[_0xb282('0x1e')]);});});}function insertAdditionalPhones(_0x2e3928){return new Promise(function(_0x438dbe,_0x1c3084){var _0x533147=_0x2e3928[_0xb282('0x19')];if(_[_0xb282('0x17')](_0x533147))_0x1c3084({'val':0x0});else{var _0x1f3e12=_0x533147['split'](';');var _0x437d66=[];orderBy=0x0;for(var _0x2a7ef8=0x0;_0x2a7ef8<_0x1f3e12[_0xb282('0x16')];_0x2a7ef8++){_0x437d66[_0xb282('0x1a')](splitAdditionalPhone(_0x2e3928['id'],_0x1f3e12[_0x2a7ef8]));}Promise[_0xb282('0x1f')](_0x437d66)['then'](function(){_0x438dbe({'val':_0x1f3e12['length']});});}});}function splitAdditionalPhone(_0x360f15,_0x3c7f1f){return new Promise(function(_0x4934f0,_0x5e828e){var _0x34774d=_0x3c7f1f[_0xb282('0x20')](':');var _0x3451e5=_0x34774d[0x0];var _0x3c4018=_0x34774d[0x1];if(_0x3c4018!==''){var _0x211cc1=_0x3c4018[_0xb282('0x20')]('|');var _0x5b1d3d=[];for(var _0xa0d7fb=0x0;_0xa0d7fb<_0x211cc1[_0xb282('0x16')];_0xa0d7fb++){if(_0x211cc1[_0xa0d7fb]!==''){var _0x50bd73=_[_0xb282('0x21')](promisesAdditionalPhones,{'contactId':_0x360f15,'phone':_0x211cc1[_0xa0d7fb]});if(_0x50bd73[_0xb282('0x16')]==0x0){orderBy++;promisesAdditionalPhones[_0xb282('0x1a')]({'contactId':_0x360f15,'contactTypeId':_0x3451e5,'phone':_0x211cc1[_0xa0d7fb],'orderBy':orderBy});}}}_0x4934f0({'ok':0x1});}else _0x4934f0({'res':0x0});});}function createAdditionalPhone(_0x280940,_0x59644e,_0x1520b1,_0x1fb89f){var _0xe337b8='';var _0x433ad5='';var _0x4cee93=_0x1520b1[_0xb282('0x20')]('§');_0xe337b8=_0x4cee93[0x0];if(_0x4cee93[_0xb282('0x16')]==0x2)_0x433ad5=_0x4cee93[0x1];return new Promise(function(_0x499e3d,_0x1b15b5){return db[_0xb282('0x22')][_0xb282('0x23')]({'where':{'CmContactId':_0x280940,'item':_0xe337b8}})[_0xb282('0x1b')](function(_0x42ef75){if(_0x42ef75){return db['CmContactHasItem'][_0xb282('0x24')]({'ItemTypeId':_0x59644e,'description':_0x433ad5,'OrderBy':_0x1fb89f},{'where':{'CmContactId':_0x280940,'item':_0xe337b8}})['then'](function(_0x4b7660){_0x499e3d({'res':_0xb282('0x25')});});}else{return db[_0xb282('0x22')]['create']({'CmContactId':_0x280940,'item':_0xe337b8,'ItemTypeId':_0x59644e,'description':_0x433ad5,'OrderBy':_0x1fb89f,'ItemClass':_0xb282('0x26')})['then'](function(_0x26d6ff){_0x499e3d({'res':_0xb282('0x27')});});}});});}function updateContact(_0x33b9e2){return new Promise(function(_0x41e0eb,_0x1c58c2){var _0x1b740c=_0x33b9e2['id'];delete _0x33b9e2['id'];return db['CmContact'][_0xb282('0x24')](_0x33b9e2,{'where':{'id':_0x1b740c}})[_0xb282('0x1b')](function(_0x4ede9d){updatedRows+=0x1;return db['CmHopper'][_0xb282('0x24')]({'phone':_0x33b9e2[_0xb282('0x18')]},{'where':{'ContactId':_0x1b740c}})[_0xb282('0x1b')](function(_0x50efa2){_0x41e0eb({'ret':'OK'});});});});}function insertCmHopper(_0x4a76ce,_0x4ad54b,_0x27073b,_0x2a7362,_0x61a377){var _0xf2133f=[_0xb282('0x28'),_0xb282('0x29'),_0xb282('0x2a'),'cm_contacts.ListId',_0x4ad54b+'.'+_0x2a7362,_0xb282('0x2b'),'cm_contacts.updatedAt',_0xb282('0x2c'),_0xb282('0x2d'),'\x22'+_0x61a377+'\x22'];return squel[_0xb282('0x2e')]()['into'](_0xb282('0x2f'))['fromQuery']([_0xb282('0x18'),_0xb282('0x30'),_0xb282('0x31'),_0xb282('0x32'),_0x2a7362,'createdAt','updatedAt',_0xb282('0x33'),_0xb282('0x34'),_0xb282('0x35')],squel[_0xb282('0xe')]()['fields'](_0xf2133f)[_0xb282('0xf')](_0x4ad54b)['join'](_0xb282('0x36'),null,_0xb282('0x37')+_0x4ad54b+'.CmListId')[_0xb282('0x10')](_0x27073b,null,_0x27073b+_0xb282('0x11')+_0x4ad54b+'.'+_0x2a7362)[_0xb282('0x12')](_0x4ad54b+_0xb282('0x38'),_0x4a76ce)[_0xb282('0x12')](_0xb282('0x39'),NOW)[_0xb282('0x12')](_0xb282('0x3a'),selectNotIn(_0x4ad54b,_0x27073b,_0x2a7362,_0xb282('0x2f'),[_0xb282('0x3b'),_0xb282('0x3c')]))[_0xb282('0x12')](_0xb282('0x3a'),selectNotIn(_0x4ad54b,_0x27073b,_0x2a7362,_0xb282('0x2f'),[_0xb282('0x3b')])))[_0xb282('0x3d')]();}function insertCmHopperBlack(_0x2416a4,_0x7332d2,_0x573da7,_0x310ad1){var _0x58109a=[_0xb282('0x28'),_0xb282('0x2a'),_0xb282('0x3e'),_0x7332d2+'.'+_0x310ad1,_0xb282('0x2b'),_0xb282('0x3f')];return squel[_0xb282('0x2e')]()['into']('cm_hopper_black')[_0xb282('0x40')](['phone',_0xb282('0x31'),_0xb282('0x32'),_0x310ad1,'createdAt',_0xb282('0x41')],squel[_0xb282('0xe')]()[_0xb282('0x42')](_0x58109a)['from'](_0x7332d2)['join'](_0xb282('0x36'),null,'cm_contacts.ListId\x20=\x20'+_0x7332d2+_0xb282('0x43'))[_0xb282('0x10')](_0x573da7,null,_0x573da7+_0xb282('0x11')+_0x7332d2+'.'+_0x310ad1)[_0xb282('0x12')](_0x7332d2+_0xb282('0x38'),_0x2416a4)[_0xb282('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xb282('0x12')](_0xb282('0x3a'),squel[_0xb282('0xe')]()['field'](_0xb282('0x18'))['from'](_0xb282('0x44'))['where'](_0xb282('0x45'),_0x2416a4)['where'](_0x310ad1+'\x20=\x20?',_0x7332d2+'.'+_0x310ad1)))['toString']();}function insertCmHopperAdditionalPhones(_0x354fc9){var _0x32765f=[_0xb282('0x46'),_0xb282('0x47'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0xb282('0x2e')]()[_0xb282('0x48')](_0xb282('0x49'))[_0xb282('0x40')](['CmHopperId',_0xb282('0x18'),_0xb282('0x4a'),'createdAt',_0xb282('0x41')],squel[_0xb282('0xe')]()[_0xb282('0x42')](_0x32765f)[_0xb282('0xf')](_0xb282('0x2f'))['join'](_0xb282('0x36'),null,_0xb282('0x4b'))[_0xb282('0x10')](_0xb282('0x4c'),null,_0xb282('0x4d'))[_0xb282('0x12')]('cm_hopper.ListId\x20=\x20?',_0x354fc9)[_0xb282('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xb282('0x3d')]();}function insertCmContact(_0x1e6ade,_0x5ca27b,_0x33b658,_0x3dd8cb){var _0x5380fe=_['concat'](_['keys'](_0x3dd8cb),[_0xb282('0x32'),_0xb282('0x4e'),_0xb282('0x4f'),'updatedAt']);return squel[_0xb282('0x2e')]()['into'](_0xb282('0x36'))[_0xb282('0x40')](_0x5380fe,squel['select']()[_0xb282('0x42')](_0x5380fe)['from'](_0x5ca27b)[_0xb282('0x12')]('('+_0x33b658[_0xb282('0x10')](',')+_0xb282('0x50'),squel[_0xb282('0xe')]()[_0xb282('0x42')](_0x33b658)[_0xb282('0xf')]('cm_contacts')[_0xb282('0x12')]('ListId\x20=\x20?',_0x1e6ade))[_0xb282('0x12')](_0xb282('0x51'),squel['select']()['field'](_0xb282('0x52'),_0xb282('0x53'))[_0xb282('0xf')](_0x5ca27b)['group'](_0x33b658['join'](','))))[_0xb282('0x3d')]();}function handleStop(){logger[_0xb282('0x54')](_0xb282('0x55'));stopped=!![];}function handleUncaughtException(_0x5d6a78){logger[_0xb282('0x1d')](_0x5d6a78['message']);process[_0xb282('0x56')](0x1);}function handleError(_0x1de487,_0x6b7f07){stats[_0xb282('0x57')][_0xb282('0x1a')]({'name':_0x6b7f07[_0xb282('0x58')],'message':_0x6b7f07[_0xb282('0x1e')],'row':_0x1de487});}function handleQuery(_0x5c0bf1){logger[_0xb282('0x54')](_0x5c0bf1);return db[_0xb282('0x59')][_0xb282('0x5a')](_0x5c0bf1)['spread'](function(_0x545ca7){results[_0xb282('0x1a')](_0x545ca7);})[_0xb282('0x1c')](function(_0x1d2d00){logger['error'](_0x1d2d00['message']);});}function main(_0x223aa7,_0x22e565,_0x542c0e,_0x7bd956){logger[_0xb282('0x54')](_0xb282('0x5b'),_0x223aa7,JSON['stringify'](_0x22e565));process[_0xb282('0x5c')](_0xb282('0x5d'));var _0x526f76=_0x22e565[_0xb282('0x5e')];var _0x20e01e=_[_0xb282('0x5f')](_0x526f76);var _0x26c9a6=_0x22e565['socket_timestamp'];var _0x4a129d=path[_0xb282('0x10')](config[_0xb282('0x60')],'server/files/tmp',_0x26c9a6+_0xb282('0x61'));logger[_0xb282('0x54')](_0xb282('0x62'),_0x22e565);db[_0xb282('0x63')][_0xb282('0x64')]({'raw':!![],'attributes':['id',_0xb282('0x65')]})[_0xb282('0x1b')](function(_0xe02175){for(var _0x4ef228=0x0;_0x4ef228<_0xe02175[_0xb282('0x16')];_0x4ef228++){if(_0xe02175[_0x4ef228][_0xb282('0x65')]in _0x526f76){contactItemTypes[_0xb282('0x1a')](_0xe02175[_0x4ef228]);delete _0x20e01e[_0xe02175[_0x4ef228]['name']];hasAdditionalPhones=!![];}for(var _0x339c5a in _0x526f76){if(_0xe02175[_0x4ef228][_0xb282('0x65')]+'_description'===_0x339c5a){phoneDescriptions['push']({'itemTypeId':_0xe02175[_0x4ef228]['id'],'description':_0x339c5a});delete _0x20e01e[_0x339c5a];}}}if(hasAdditionalPhones)_0x20e01e[_0xb282('0x19')]='';var _0x1ef276=_[_0xb282('0x66')](_0x20e01e)[_0xb282('0x10')]();logger[_0xb282('0x54')](_0xb282('0x67'),_0x1ef276);fs[_0xb282('0x68')](_0x4a129d,_0x1ef276+'\x0a');Papa[_0xb282('0x69')](fs[_0xb282('0x6a')](_0x223aa7),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1805f6,_0x802949){try{for(var _0x3a6712=0x0,_0x88dfa6=[];_0x3a6712<_0x1805f6[_0xb282('0x6b')][_0xb282('0x16')];_0x3a6712++){stats[_0xb282('0x6c')]+=0x1;if(_0x1805f6['errors'][_0x3a6712]){handleError(_0x1805f6[_0xb282('0x6b')][_0x3a6712],_0x1805f6[_0xb282('0x57')][_0x3a6712]);}else{var _0x3cf767=[];var _0x2b6db9=[];var _0x277769={};for(var _0x24c1fa in _0x526f76){let _0x4179e0=contactItemTypes[_0xb282('0x6d')](_0x2203e7=>_0x2203e7[_0xb282('0x65')]===_0x24c1fa);let _0x21b3f6=contactItemTypes['find'](_0x10bed7=>_0x10bed7[_0xb282('0x65')]+_0xb282('0x6e')===_0x24c1fa);if(_[_0xb282('0x17')](_0x4179e0)&&_[_0xb282('0x17')](_0x21b3f6)){if(_0x526f76['hasOwnProperty'](_0x24c1fa)){if(_0x1805f6['data'][_0x3a6712][_0x526f76[_0x24c1fa]]){var _0x313018=_[_0xb282('0x6f')](_0x1805f6[_0xb282('0x6b')][_0x3a6712][_0x526f76[_0x24c1fa]][_0xb282('0x70')](/"/g,'\x27'));switch(_0x24c1fa){case _0xb282('0x30'):var _0x7cb26e=moment(_0x313018,_0xb282('0x71'),!![]);if(_0x7cb26e['isValid']()){_0x88dfa6['push']('\x22'+_0x313018+'\x22');}else{_0x3cf767[_0xb282('0x1a')](_0xb282('0x72'));}break;case'priority':var _0x4def13=parseInt(_0x313018);_0x313018=_[_0xb282('0x73')](_0x4def13)||_0x4def13<0x0||_0x4def13>0x4?_0x7bd956?0x3:0x2:_0x4def13;_0x88dfa6[_0xb282('0x1a')]('\x22'+_0x313018+'\x22');break;case _0xb282('0x34'):var _0xad8c7d=parseInt(_0x313018);if(_[_0xb282('0x74')](_0xad8c7d)&&_[_0xb282('0x75')](_0x542c0e,_0xad8c7d)){_0x88dfa6[_0xb282('0x1a')]('\x22'+_0xad8c7d+'\x22');}else{_0x3cf767['push'](_0xb282('0x76'));}break;case _0xb282('0x77'):if(isEmail(_0x313018)){_0x88dfa6[_0xb282('0x1a')]('\x22'+_0x313018+'\x22');}else{_0x3cf767[_0xb282('0x1a')](_0xb282('0x78'));}break;case _0xb282('0x79'):var _0x11f255=moment(_0x313018,_0xb282('0x7a'),!![]);if(_0x11f255[_0xb282('0x7b')]()){_0x88dfa6[_0xb282('0x1a')]('\x22'+_0x313018+'\x22');}else{_0x3cf767['push'](_0xb282('0x7c'));}break;default:_0x88dfa6[_0xb282('0x1a')]('\x22'+_0x313018+'\x22');}}else{switch(_0x24c1fa){case _0xb282('0x7d'):case _0xb282('0x18'):_0x3cf767[_0xb282('0x1a')](_0x24c1fa+_0xb282('0x7e'));break;default:_0x88dfa6[_0xb282('0x1a')]('\x22\x22');}}}}else{var _0x36bea3='';if(!_['isNil'](_0x4179e0)){if(!_0x277769[_0xb282('0x7f')](_0x4179e0['id'])){for(var _0x400f2a=0x0;_0x400f2a<_0x526f76[_0x24c1fa][_0xb282('0x16')];_0x400f2a++){var _0x313018=_[_0xb282('0x6f')](_0x1805f6[_0xb282('0x6b')][_0x3a6712][_0x526f76[_0x24c1fa][_0x400f2a]]['replace'](/"/g,'\x27'));var _0x44846b=phoneDescriptions[_0xb282('0x6d')](_0x39c8a8=>_0x39c8a8['itemTypeId']===_0x4179e0['id']);if(!_[_0xb282('0x17')](_0x44846b)){var _0x28677e=_['trim'](_0x1805f6[_0xb282('0x6b')][_0x3a6712][_0x526f76[_0x44846b[_0xb282('0x80')]][0x0]][_0xb282('0x70')](/"/g,'\x27'));if(!_[_0xb282('0x17')](_0x28677e))_0x313018=_0x313018+'§'+_0x28677e;}if(_0x36bea3=='')_0x36bea3=_0x313018;else _0x36bea3+='|'+_0x313018;}_0x2b6db9[_0xb282('0x1a')](_0x4179e0['id']+':'+_0x36bea3);_0x277769[_0x4179e0['id']]=0x1;}}}}if(hasAdditionalPhones){_0x88dfa6[_0xb282('0x1a')]('\x22'+_0x2b6db9[_0xb282('0x10')](';')+'\x22');}if(_0x3cf767['length']){handleError(_0x1805f6['data'][_0x3a6712],{'code':_0xb282('0x81'),'message':_0x3cf767['join']()});}else{fs[_0xb282('0x82')](_0x4a129d,_0x88dfa6[_0xb282('0x10')]()+'\x0a');}_0x88dfa6=[];}if(!(stats[_0xb282('0x6c')]%0xc8)){socket[_0xb282('0x83')](_0xb282('0x84')+_0x26c9a6,stats);stats['errors']=[];}}if(stopped){logger[_0xb282('0x54')](_0xb282('0x85'));_0x802949[_0xb282('0x86')]();}}catch(_0x5d7eb3){handleError(_0x1805f6[_0xb282('0x6b')][_0x3a6712],{'code':_0xb282('0x87'),'message':_0x5d7eb3[_0xb282('0x1e')]});logger[_0xb282('0x1d')](_0xb282('0x88'),_0x5d7eb3[_0xb282('0x1e')]);}},'complete':function(){try{var _0x534465=[];var _0x28f5c3=tempTableName;_0x534465[_0xb282('0x1a')](_0xb282('0x89')+_0x28f5c3+_0xb282('0x8a'));logger['info'](_0xb282('0x8b'),contactItemTypes[_0xb282('0x16')]);var _0x4622c9=util[_0xb282('0xb')](_0xb282('0x8c'),_0x4a129d,_0x28f5c3,_0x1ef276,_0x22e565[_0xb282('0x32')],_0x22e565[_0xb282('0x4e')]||null,NOW,NOW);if(_[_0xb282('0x17')](_0x526f76[_0xb282('0x30')])){_0x4622c9+=_0xb282('0x8d');}_0x534465[_0xb282('0x1a')](_0x4622c9);BPromise['each'](_0x534465,handleQuery)[_0xb282('0x1b')](function(_0x129818){BPromise['all']([handleAdditionalPhones()])[_0xb282('0x1b')](function(){_0x534465=[];for(var _0x401a3b=0x0;_0x401a3b\x20\x20','server/files/tmp','parse','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','bluebird','squel','../../../config/environment','import','redis','localhost','socket.io-emitter','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','length','isNil','phone','AdditionalPhones','push','then','catch','message','all'];(function(_0x261d55,_0xffa8d6){var _0x3f74fc=function(_0x455edf){while(--_0x455edf){_0x261d55['push'](_0x261d55['shift']());}};_0x3f74fc(++_0xffa8d6);}(_0xa702,0x1ae));var _0x2a70=function(_0x29646b,_0x1bc681){_0x29646b=_0x29646b-0x0;var _0x42faca=_0xa702[_0x29646b];return _0x42faca;};'use strict';var fs=require('fs');var path=require(_0x2a70('0x0'));var _=require(_0x2a70('0x1'));var Papa=require(_0x2a70('0x2'));var util=require(_0x2a70('0x3'));var BPromise=require(_0x2a70('0x4'));var moment=require('moment');var squel=require(_0x2a70('0x5'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x2a70('0x6'));var logger=require('../../../config/logger')(_0x2a70('0x7'));config[_0x2a70('0x8')]=_['defaults'](config['redis'],{'host':_0x2a70('0x9'),'port':0x18eb});var socket=require(_0x2a70('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x2a70('0xb')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x2a70('0xc')+moment()[_0x2a70('0xb')](_0x2a70('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0xee19e8){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))*$/[_0x2a70('0xe')](_0xee19e8);}function selectNotIn(_0xe9145f,_0x2fcb36,_0x109086,_0xb10b65,_0x941803){return squel[_0x2a70('0xf')]()[_0x2a70('0x10')]('phone')[_0x2a70('0x11')](_0xb10b65)[_0x2a70('0x12')](_0x2fcb36,null,_0x2fcb36+_0x2a70('0x13')+_0xb10b65+'.'+_0x109086)[_0x2a70('0x14')](_0xb10b65+'.'+_0x109086+_0x2a70('0x15')+_0xe9145f+'.'+_0x109086)['where'](_0x2fcb36+_0x2a70('0x16')+_0x941803[_0x2a70('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5562cb,_0x8a36e4){promisesAdditionalPhones=[];promisesContact=[];return db[_0x2a70('0x17')]['query'](_0x2a70('0x18')+tempTableName)[_0x2a70('0x19')](function(_0x5d992a){if(_0x5d992a!==null){var _0x5695aa=[];for(var _0x3a775c=0x0;_0x3a775c<_0x5d992a[_0x2a70('0x1a')];_0x3a775c++){var _0x2c5a21=_0x5d992a[_0x3a775c];if(!_[_0x2a70('0x1b')](_0x2c5a21[_0x2a70('0x1c')])){if(!_['isNil'](_0x2c5a21[_0x2a70('0x1d')]))_0x5695aa[_0x2a70('0x1e')](insertAdditionalPhones(_0x2c5a21));promisesContact['push']({'contact':_0x2c5a21});}}}Promise['all'](_0x5695aa)[_0x2a70('0x1f')](function(){_0x5562cb({'val':0x1});});})[_0x2a70('0x20')](function(_0x9ccca8){logger['error'](_0x9ccca8[_0x2a70('0x21')]);});});}function insertAdditionalPhones(_0x203670){return new Promise(function(_0x1b7764,_0x29fbf3){var _0x147de7=_0x203670[_0x2a70('0x1d')];if(_[_0x2a70('0x1b')](_0x147de7))_0x29fbf3({'val':0x0});else{var _0x5e38f8=_0x147de7['split'](';');var _0x932b18=[];orderBy=0x0;for(var _0x5cdac3=0x0;_0x5cdac3<_0x5e38f8[_0x2a70('0x1a')];_0x5cdac3++){_0x932b18[_0x2a70('0x1e')](splitAdditionalPhone(_0x203670['id'],_0x5e38f8[_0x5cdac3]));}Promise[_0x2a70('0x22')](_0x932b18)[_0x2a70('0x1f')](function(){_0x1b7764({'val':_0x5e38f8[_0x2a70('0x1a')]});});}});}function splitAdditionalPhone(_0x1ef985,_0x3c5672){return new Promise(function(_0x119218,_0x477dcd){var _0x364fe0=_0x3c5672[_0x2a70('0x23')](':');var _0x61a342=_0x364fe0[0x0];var _0x530b1b=_0x364fe0[0x1];if(_0x530b1b!==''){var _0x53656f=_0x530b1b[_0x2a70('0x23')]('|');var _0x163061=[];for(var _0x220be7=0x0;_0x220be7<_0x53656f[_0x2a70('0x1a')];_0x220be7++){if(_0x53656f[_0x220be7]!==''){var _0x5b04be=_[_0x2a70('0x24')](promisesAdditionalPhones,{'contactId':_0x1ef985,'phone':_0x53656f[_0x220be7]});if(_0x5b04be[_0x2a70('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0x2a70('0x1e')]({'contactId':_0x1ef985,'contactTypeId':_0x61a342,'phone':_0x53656f[_0x220be7],'orderBy':orderBy});}}}_0x119218({'ok':0x1});}else _0x119218({'res':0x0});});}function createAdditionalPhone(_0xc2cfe4,_0x4cfa86,_0x588efc,_0x47dafe){var _0x18f571='';var _0x57dae1='';var _0x22fb1b=_0x588efc['split']('§');_0x18f571=_0x22fb1b[0x0];if(_0x22fb1b[_0x2a70('0x1a')]==0x2)_0x57dae1=_0x22fb1b[0x1];return new Promise(function(_0x583564,_0x186418){return db[_0x2a70('0x25')]['findOne']({'where':{'CmContactId':_0xc2cfe4,'item':_0x18f571}})['then'](function(_0x13bc13){if(_0x13bc13){return db[_0x2a70('0x25')]['update']({'ItemTypeId':_0x4cfa86,'description':_0x57dae1,'OrderBy':_0x47dafe},{'where':{'CmContactId':_0xc2cfe4,'item':_0x18f571}})[_0x2a70('0x1f')](function(_0x14f803){_0x583564({'res':_0x2a70('0x26')});});}else{return db[_0x2a70('0x25')]['create']({'CmContactId':_0xc2cfe4,'item':_0x18f571,'ItemTypeId':_0x4cfa86,'description':_0x57dae1,'OrderBy':_0x47dafe,'ItemClass':_0x2a70('0x27')})[_0x2a70('0x1f')](function(_0x40e2ea){_0x583564({'res':_0x2a70('0x28')});});}});});}function updateContact(_0x434769){return new Promise(function(_0x21a670,_0x345975){var _0xec2d24=_0x434769['id'];delete _0x434769['id'];return db['CmContact']['update'](_0x434769,{'where':{'id':_0xec2d24}})[_0x2a70('0x1f')](function(_0x2f8140){updatedRows+=0x1;return db['CmHopper'][_0x2a70('0x29')]({'phone':_0x434769[_0x2a70('0x1c')]},{'where':{'ContactId':_0xec2d24}})[_0x2a70('0x1f')](function(_0x376f1c){_0x21a670({'ret':'OK'});});});});}function insertCmHopper(_0xa1c10e,_0x66d18f,_0x2c0f36,_0x251a7f,_0x1b65d6){var _0x4f86fe=[_0x2a70('0x2a'),_0x2a70('0x2b'),_0x2a70('0x2c'),'cm_contacts.ListId',_0x66d18f+'.'+_0x251a7f,_0x2a70('0x2d'),_0x2a70('0x2e'),_0x2a70('0x2f'),_0x2a70('0x30'),'\x22'+_0x1b65d6+'\x22'];return squel[_0x2a70('0x31')]()[_0x2a70('0x32')](_0x2a70('0x33'))[_0x2a70('0x34')](['phone',_0x2a70('0x35'),_0x2a70('0x36'),_0x2a70('0x37'),_0x251a7f,_0x2a70('0x38'),_0x2a70('0x39'),_0x2a70('0x3a'),'UserId',_0x2a70('0x3b')],squel[_0x2a70('0xf')]()[_0x2a70('0x3c')](_0x4f86fe)['from'](_0x66d18f)[_0x2a70('0x12')](_0x2a70('0x3d'),null,'cm_contacts.ListId\x20=\x20'+_0x66d18f+'.CmListId')['join'](_0x2c0f36,null,_0x2c0f36+_0x2a70('0x13')+_0x66d18f+'.'+_0x251a7f)[_0x2a70('0x14')](_0x66d18f+_0x2a70('0x3e'),_0xa1c10e)['where'](_0x2a70('0x3f'),NOW)[_0x2a70('0x14')](_0x2a70('0x40'),selectNotIn(_0x66d18f,_0x2c0f36,_0x251a7f,_0x2a70('0x33'),[_0x2a70('0x41'),'\x22onlyIfOpen\x22']))[_0x2a70('0x14')](_0x2a70('0x40'),selectNotIn(_0x66d18f,_0x2c0f36,_0x251a7f,_0x2a70('0x33'),[_0x2a70('0x41')])))[_0x2a70('0x42')]();}function insertCmHopperBlack(_0xd1c3fb,_0x229ccc,_0x848bc3,_0xa0f46c){var _0x1e3ca3=[_0x2a70('0x2a'),_0x2a70('0x2c'),_0x2a70('0x43'),_0x229ccc+'.'+_0xa0f46c,_0x2a70('0x2d'),_0x2a70('0x2e')];return squel['insert']()[_0x2a70('0x32')](_0x2a70('0x44'))[_0x2a70('0x34')]([_0x2a70('0x1c'),_0x2a70('0x36'),_0x2a70('0x37'),_0xa0f46c,_0x2a70('0x38'),_0x2a70('0x39')],squel[_0x2a70('0xf')]()['fields'](_0x1e3ca3)['from'](_0x229ccc)[_0x2a70('0x12')](_0x2a70('0x3d'),null,_0x2a70('0x45')+_0x229ccc+_0x2a70('0x46'))[_0x2a70('0x12')](_0x848bc3,null,_0x848bc3+_0x2a70('0x13')+_0x229ccc+'.'+_0xa0f46c)[_0x2a70('0x14')](_0x229ccc+'.CmListId\x20=\x20?',_0xd1c3fb)[_0x2a70('0x14')](_0x2a70('0x3f'),NOW)[_0x2a70('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x2a70('0xf')]()[_0x2a70('0x10')]('phone')[_0x2a70('0x11')](_0x2a70('0x44'))[_0x2a70('0x14')](_0x2a70('0x47'),_0xd1c3fb)[_0x2a70('0x14')](_0xa0f46c+_0x2a70('0x48'),_0x229ccc+'.'+_0xa0f46c)))[_0x2a70('0x42')]();}function insertCmHopperAdditionalPhones(_0x4b5dda){var _0x90e823=[_0x2a70('0x49'),'cm_contact_has_items.item',_0x2a70('0x4a'),'cm_contact_has_items.createdAt',_0x2a70('0x4b')];return squel[_0x2a70('0x31')]()[_0x2a70('0x32')](_0x2a70('0x4c'))['fromQuery']([_0x2a70('0x4d'),'phone',_0x2a70('0x4e'),'createdAt','updatedAt'],squel[_0x2a70('0xf')]()[_0x2a70('0x3c')](_0x90e823)[_0x2a70('0x11')](_0x2a70('0x33'))[_0x2a70('0x12')](_0x2a70('0x3d'),null,_0x2a70('0x4f'))[_0x2a70('0x12')](_0x2a70('0x50'),null,_0x2a70('0x51'))[_0x2a70('0x14')](_0x2a70('0x52'),_0x4b5dda)[_0x2a70('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x44c641,_0x41d76e,_0x297d67,_0x10ce25){var _0xcb11b8=_[_0x2a70('0x53')](_[_0x2a70('0x54')](_0x10ce25),['ListId',_0x2a70('0x55'),_0x2a70('0x38'),_0x2a70('0x39')]);return squel[_0x2a70('0x31')]()[_0x2a70('0x32')](_0x2a70('0x3d'))[_0x2a70('0x34')](_0xcb11b8,squel['select']()[_0x2a70('0x3c')](_0xcb11b8)[_0x2a70('0x11')](_0x41d76e)[_0x2a70('0x14')]('('+_0x297d67[_0x2a70('0x12')](',')+_0x2a70('0x56'),squel[_0x2a70('0xf')]()[_0x2a70('0x3c')](_0x297d67)['from'](_0x2a70('0x3d'))[_0x2a70('0x14')]('ListId\x20=\x20?',_0x44c641))['where'](_0x2a70('0x57'),squel[_0x2a70('0xf')]()[_0x2a70('0x10')]('MIN(id)',_0x2a70('0x58'))[_0x2a70('0x11')](_0x41d76e)[_0x2a70('0x59')](_0x297d67[_0x2a70('0x12')](','))))[_0x2a70('0x42')]();}function handleStop(){logger[_0x2a70('0x5a')](_0x2a70('0x5b'));stopped=!![];}function handleUncaughtException(_0x2dbcaf){logger[_0x2a70('0x5c')](_0x2dbcaf[_0x2a70('0x21')]);process[_0x2a70('0x5d')](0x1);}function handleError(_0x59b031,_0x3e5483){stats[_0x2a70('0x5e')][_0x2a70('0x1e')]({'name':_0x3e5483['code'],'message':_0x3e5483[_0x2a70('0x21')],'row':_0x59b031});}function handleQuery(_0x57c7d0){logger['info'](_0x57c7d0);return db[_0x2a70('0x17')][_0x2a70('0x5f')](_0x57c7d0)[_0x2a70('0x19')](function(_0x23974c){results[_0x2a70('0x1e')](_0x23974c);})['catch'](function(_0x138f08){logger[_0x2a70('0x5c')](_0x138f08['message']);});}function main(_0x48c8c8,_0x4fd84b,_0xcc1634,_0x2ea698){logger[_0x2a70('0x5a')](_0x2a70('0x60'),_0x48c8c8,JSON[_0x2a70('0x61')](_0x4fd84b));process['send'](_0x2a70('0x62'));var _0xdf2aad=_0x4fd84b[_0x2a70('0x63')];var _0x4dad3a=_[_0x2a70('0x64')](_0xdf2aad);var _0x442e3a=_0x4fd84b[_0x2a70('0x65')];var _0x3eb19c=path[_0x2a70('0x12')](config[_0x2a70('0x66')],'server/files/tmp',_0x442e3a+_0x2a70('0x67'));logger['info']('body',_0x4fd84b);db[_0x2a70('0x68')][_0x2a70('0x69')]({'raw':!![],'attributes':['id',_0x2a70('0x6a')]})[_0x2a70('0x1f')](function(_0x2742b6){for(var _0x3a5ec0=0x0;_0x3a5ec0<_0x2742b6[_0x2a70('0x1a')];_0x3a5ec0++){if(_0x2742b6[_0x3a5ec0][_0x2a70('0x6a')]in _0xdf2aad){contactItemTypes[_0x2a70('0x1e')](_0x2742b6[_0x3a5ec0]);delete _0x4dad3a[_0x2742b6[_0x3a5ec0][_0x2a70('0x6a')]];hasAdditionalPhones=!![];}for(var _0x5520c6 in _0xdf2aad){if(_0x2742b6[_0x3a5ec0][_0x2a70('0x6a')]+_0x2a70('0x6b')===_0x5520c6){phoneDescriptions['push']({'itemTypeId':_0x2742b6[_0x3a5ec0]['id'],'description':_0x5520c6});delete _0x4dad3a[_0x5520c6];}}}if(hasAdditionalPhones)_0x4dad3a[_0x2a70('0x1d')]='';var _0x3c4ab3=_[_0x2a70('0x54')](_0x4dad3a)[_0x2a70('0x12')]();logger['info'](_0x2a70('0x6c'),_0x3c4ab3);fs[_0x2a70('0x6d')](_0x3eb19c,_0x3c4ab3+'\x0a');Papa['parse'](fs[_0x2a70('0x6e')](_0x48c8c8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x31c3e3,_0x1ee223){try{for(var _0x91f2ed=0x0,_0x4363c1=[];_0x91f2ed<_0x31c3e3['data'][_0x2a70('0x1a')];_0x91f2ed++){stats[_0x2a70('0x6f')]+=0x1;if(_0x31c3e3[_0x2a70('0x5e')][_0x91f2ed]){handleError(_0x31c3e3['data'][_0x91f2ed],_0x31c3e3[_0x2a70('0x5e')][_0x91f2ed]);}else{var _0x1baca4=[];var _0x2738bb=[];var _0x248421={};for(var _0x50b2a7 in _0xdf2aad){let _0x4b4268=contactItemTypes[_0x2a70('0x70')](_0x56b0b1=>_0x56b0b1[_0x2a70('0x6a')]===_0x50b2a7);let _0x310cba=contactItemTypes[_0x2a70('0x70')](_0x527cf5=>_0x527cf5[_0x2a70('0x6a')]+_0x2a70('0x6b')===_0x50b2a7);if(_[_0x2a70('0x1b')](_0x4b4268)&&_['isNil'](_0x310cba)){if(_0xdf2aad['hasOwnProperty'](_0x50b2a7)){if(_0x31c3e3[_0x2a70('0x71')][_0x91f2ed][_0xdf2aad[_0x50b2a7]]){var _0x1a97b9=_[_0x2a70('0x72')](_0x31c3e3[_0x2a70('0x71')][_0x91f2ed][_0xdf2aad[_0x50b2a7]][_0x2a70('0x73')](/"/g,'\x27'));switch(_0x50b2a7){case _0x2a70('0x35'):var _0x2fe5d4=moment(_0x1a97b9,_0x2a70('0x74'),!![]);if(_0x2fe5d4[_0x2a70('0x75')]()){_0x4363c1['push']('\x22'+_0x1a97b9+'\x22');}else{_0x1baca4[_0x2a70('0x1e')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x2a70('0x3a'):var _0x27e04c=parseInt(_0x1a97b9);_0x1a97b9=_[_0x2a70('0x76')](_0x27e04c)||_0x27e04c<0x0||_0x27e04c>0x4?_0x2ea698?0x3:0x2:_0x27e04c;_0x4363c1[_0x2a70('0x1e')]('\x22'+_0x1a97b9+'\x22');break;case _0x2a70('0x77'):var _0x44e06e=parseInt(_0x1a97b9);if(_['isNumber'](_0x44e06e)&&_['includes'](_0xcc1634,_0x44e06e)){_0x4363c1[_0x2a70('0x1e')]('\x22'+_0x44e06e+'\x22');}else{_0x1baca4[_0x2a70('0x1e')](_0x2a70('0x78'));}break;case _0x2a70('0x79'):if(isEmail(_0x1a97b9)){_0x4363c1['push']('\x22'+_0x1a97b9+'\x22');}else{_0x1baca4['push'](_0x2a70('0x7a'));}break;case _0x2a70('0x7b'):var _0x5e332f=moment(_0x1a97b9,_0x2a70('0x7c'),!![]);if(_0x5e332f[_0x2a70('0x75')]()){_0x4363c1['push']('\x22'+_0x1a97b9+'\x22');}else{_0x1baca4['push'](_0x2a70('0x7d'));}break;default:_0x4363c1['push']('\x22'+_0x1a97b9+'\x22');}}else{switch(_0x50b2a7){case _0x2a70('0x7e'):case _0x2a70('0x1c'):_0x1baca4[_0x2a70('0x1e')](_0x50b2a7+'\x20not\x20specified');break;default:_0x4363c1[_0x2a70('0x1e')]('\x22\x22');}}}}else{var _0x5ea220='';if(!_[_0x2a70('0x1b')](_0x4b4268)){if(!_0x248421[_0x2a70('0x7f')](_0x4b4268['id'])){for(var _0x2d2b04=0x0;_0x2d2b04<_0xdf2aad[_0x50b2a7][_0x2a70('0x1a')];_0x2d2b04++){var _0x1a97b9=_[_0x2a70('0x72')](_0x31c3e3['data'][_0x91f2ed][_0xdf2aad[_0x50b2a7][_0x2d2b04]][_0x2a70('0x73')](/"/g,'\x27'));var _0x19c4a4=phoneDescriptions[_0x2a70('0x70')](_0x519e7d=>_0x519e7d[_0x2a70('0x80')]===_0x4b4268['id']);if(!_[_0x2a70('0x1b')](_0x19c4a4)){var _0x45e907=_['trim'](_0x31c3e3[_0x2a70('0x71')][_0x91f2ed][_0xdf2aad[_0x19c4a4['description']][0x0]][_0x2a70('0x73')](/"/g,'\x27'));if(!_[_0x2a70('0x1b')](_0x45e907))_0x1a97b9=_0x1a97b9+'§'+_0x45e907;}if(_0x5ea220=='')_0x5ea220=_0x1a97b9;else _0x5ea220+='|'+_0x1a97b9;}_0x2738bb[_0x2a70('0x1e')](_0x4b4268['id']+':'+_0x5ea220);_0x248421[_0x4b4268['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4363c1[_0x2a70('0x1e')]('\x22'+_0x2738bb['join'](';')+'\x22');}if(_0x1baca4[_0x2a70('0x1a')]){handleError(_0x31c3e3[_0x2a70('0x71')][_0x91f2ed],{'code':_0x2a70('0x81'),'message':_0x1baca4[_0x2a70('0x12')]()});}else{fs[_0x2a70('0x82')](_0x3eb19c,_0x4363c1['join']()+'\x0a');}_0x4363c1=[];}if(!(stats[_0x2a70('0x6f')]%0xc8)){socket[_0x2a70('0x83')](_0x2a70('0x84')+_0x442e3a,stats);stats[_0x2a70('0x5e')]=[];}}if(stopped){logger['info'](_0x2a70('0x85'));_0x1ee223['abort']();}}catch(_0x1b93cd){handleError(_0x31c3e3[_0x2a70('0x71')][_0x91f2ed],{'code':_0x2a70('0x86'),'message':_0x1b93cd['message']});logger[_0x2a70('0x5c')](_0x2a70('0x87'),_0x1b93cd['message']);}},'complete':function(){try{var _0x129a26=[];var _0x5b32ce=tempTableName;_0x129a26[_0x2a70('0x1e')](_0x2a70('0x88')+_0x5b32ce+_0x2a70('0x89'));logger['info']('CIS\x20len',contactItemTypes['length']);var _0x1a143c=util[_0x2a70('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',_0x3eb19c,_0x5b32ce,_0x3c4ab3,_0x4fd84b[_0x2a70('0x37')],_0x4fd84b['CompanyId']||null,NOW,NOW);if(_[_0x2a70('0x1b')](_0xdf2aad[_0x2a70('0x35')])){_0x1a143c+=_0x2a70('0x8a');}_0x129a26['push'](_0x1a143c);BPromise[_0x2a70('0x8b')](_0x129a26,handleQuery)[_0x2a70('0x1f')](function(_0x2f734e){BPromise[_0x2a70('0x22')]([handleAdditionalPhones()])[_0x2a70('0x1f')](function(){_0x129a26=[];for(var _0x3a5b57=0x0;_0x3a5b57\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','all','COUNT(*)','QueryTypes','exports','../parsers/qs','./utils','getAccountFK','role','agent','search','select','field','name','color','from'];(function(_0x5be292,_0x2b2912){var _0x29a223=function(_0x235b52){while(--_0x235b52){_0x5be292['push'](_0x5be292['shift']());}};_0x29a223(++_0x2b2912);}(_0xec17,0x133));var _0x7ec1=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xec17[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require(_0x7ec1('0x0'));var updateInteraction=require('./update-interaction')['updateInteraction'];var utils=require(_0x7ec1('0x1'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x41e114,_0x304020,_0x515487){var _0x2922c9=![];var _0xad33b7=utils[_0x7ec1('0x2')](_0x41e114);if(_0x304020[_0x7ec1('0x3')]===_0x7ec1('0x4')&&!_0x515487[_0x7ec1('0x5')]&&!_0x515487[_0xad33b7]){_0x2922c9=!![];}return _0x2922c9;}function getTagsQuery(){return squel[_0x7ec1('0x6')]()[_0x7ec1('0x7')]('id')['field'](_0x7ec1('0x8'))['field'](_0x7ec1('0x9'))[_0x7ec1('0xa')](_0x7ec1('0xb'));}function getUsersQuery(_0x30e11e,_0x37dae1){var _0x41396b=utils['getInteractionFK'](_0x30e11e);var _0x5c8911='user_has_'+_0x30e11e+'_interactions';var _0xf4017c=squel['select']()[_0x7ec1('0x7')](_0x7ec1('0xc'))['field'](_0x7ec1('0xd'))[_0x7ec1('0x7')](_0x7ec1('0xe')+_0x41396b)['from'](_0x5c8911,'ui')[_0x7ec1('0xf')](_0x7ec1('0x10'),'u','u.id\x20=\x20ui.UserId');if(_0x37dae1[_0x7ec1('0x11')]>0x0){_0xf4017c[_0x7ec1('0x12')]('ui.'+_0x41396b+'\x20IN\x20?',_[_0x7ec1('0x13')](_0x37dae1,'id'));}return _0xf4017c;}function getInteractionsQuery(_0x543956){var _0x57523f=utils[_0x7ec1('0x14')](_0x543956);var _0x143309=utils[_0x7ec1('0x2')](_0x543956);var _0x3c6e10=utils[_0x7ec1('0x15')](_0x543956);return squel[_0x7ec1('0x6')]()['from'](_0x57523f[_0x7ec1('0x16')],'i')[_0x7ec1('0xf')](_0x7ec1('0x17'),'c',_0x7ec1('0x18'))[_0x7ec1('0xf')]('users','o','o.id\x20=\x20i.UserId')[_0x7ec1('0xf')](_0x57523f[_0x7ec1('0x19')],'a',_0x7ec1('0x1a')+_0x143309)[_0x7ec1('0xf')](_0x57523f[_0x7ec1('0x1b')],'me',_0x7ec1('0x1c')+_0x3c6e10+_0x7ec1('0x1d'))[_0x7ec1('0xf')](_0x57523f[_0x7ec1('0x1e')],'it',_0x7ec1('0x1f')+_0x3c6e10+_0x7ec1('0x1d'))[_0x7ec1('0xf')](_0x7ec1('0xb'),'t',_0x7ec1('0x20'));}function getSqlClauses(){var _0x9f3a25={'body':squel['expr'](),'contact':squel[_0x7ec1('0x21')](),'default':squel[_0x7ec1('0x21')](),'fields':squel['expr'](),'filter':squel[_0x7ec1('0x21')](),'read':squel['expr'](),'tags':{'clause':squel[_0x7ec1('0x21')](),'ids':null},'user':squel['expr']()};return _0x9f3a25;}function parseTagParameter(_0x24a882){var _0xbc83f4=squel[_0x7ec1('0x21')]();if(_0x24a882){var _0x244e2e=utils['getSelectedTags'](_0x24a882);_0x244e2e[_0x7ec1('0x22')](function(_0x53de64){_0xbc83f4['or'](_0x7ec1('0x23'),'%,'+_0x53de64+',%');});}return _0xbc83f4;}function parseReadParameter(_0x329864){var _0x277b53='';if(_0x329864){_0x277b53=_0x7ec1('0x24');if(_0x329864==='1'){_0x277b53=_0x277b53[_0x7ec1('0x25')](_0x7ec1('0x26'),'=');}else{_0x277b53=_0x277b53[_0x7ec1('0x25')](_0x7ec1('0x26'),'>');}}return _0x277b53;}function parseSearchFilter(_0x4e2194,_0x5c2b5c){var _0x2ea4dd=squel[_0x7ec1('0x21')]();if(_0x5c2b5c){var _0x2d7f0b=_0x5c2b5c[_0x7ec1('0x25')]('\x5c','\x5c\x5c')[_0x7ec1('0x25')](/'/g,'\x27\x27');if(qs[_0x7ec1('0x27')](_0x2d7f0b)){_0x2ea4dd['or'](_0x7ec1('0x28'),_0x2d7f0b+'%');if([_0x7ec1('0x29'),_0x7ec1('0x2a')][_0x7ec1('0x2b')](_0x4e2194)){_0x2ea4dd['or'](_0x7ec1('0x2c'),_0x2d7f0b+'%');}else if(_0x4e2194===_0x7ec1('0x2d')){_0x2ea4dd['or']('i.fax\x20LIKE\x20?',_0x2d7f0b+'%');}else if(_0x4e2194===_0x7ec1('0x2e')){_0x2ea4dd['or'](_0x7ec1('0x2f'),_0x2d7f0b+'%');}}else if(_0x4e2194==='mail'&&qs[_0x7ec1('0x30')](_0x2d7f0b)){_0x2ea4dd['or'](_0x7ec1('0x31'),_0x2d7f0b+'%');}else{if(_0x4e2194===_0x7ec1('0x32')){_0x2ea4dd['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7ec1('0x33')](_0x2d7f0b,!![]))['or'](_0x7ec1('0x34'),qs['getFullTextValue'](_0x2d7f0b));}else if(_0x4e2194!==_0x7ec1('0x2d')){_0x2ea4dd['or'](_0x7ec1('0x35'),qs[_0x7ec1('0x33')](_0x2d7f0b));}_0x2ea4dd['or'](_0x7ec1('0x36'),qs[_0x7ec1('0x33')](_0x2d7f0b,!![]),null);}}return _0x2ea4dd;}function parseAdvancedSearchFilter(_0x307ef7,_0x4e6ba6){var _0x8130ff=getSqlClauses();var _0x4f81b6=as[_0x7ec1('0x37')](_0x307ef7);var _0x27f744=_0x4f81b6['sqlOperator'];for(var _0x4617af=0x0;_0x4617af<_0x4f81b6['conditions'][_0x7ec1('0x11')];_0x4617af++){var _0x29b34d=_0x4f81b6[_0x7ec1('0x38')][_0x4617af];var _0x3649f0='i';var _0x544e2c=_[_0x7ec1('0x39')](_0x4e6ba6,[_0x7ec1('0x8'),_0x29b34d[_0x7ec1('0x7')]]);if(_0x544e2c){var _0x51c8ca=as[_0x7ec1('0x3a')](_0x3649f0,_0x544e2c['type'],_0x29b34d);_0x8130ff[_0x7ec1('0x3b')][_0x27f744](_0x51c8ca['text'],_0x51c8ca[_0x7ec1('0x3c')][_0x7ec1('0x3d')],_0x51c8ca[_0x7ec1('0x3c')][_0x7ec1('0x3e')]);}else{switch(_0x29b34d['field']){case _0x7ec1('0x3f'):var _0x1be1b0=parseReadParameter(_0x29b34d[_0x7ec1('0x3c')]);_0x8130ff[_0x7ec1('0x40')][_0x7ec1('0x41')](_0x1be1b0);break;case'Contact':if(_0x29b34d['operator']===_0x7ec1('0x42')){if(_0x29b34d[_0x7ec1('0x3c')][_0x7ec1('0x43')]('\x20')['length']>0x1){_0x8130ff['contact'][_0x27f744](_0x7ec1('0x36'),qs['getFullTextValue'](_0x29b34d[_0x7ec1('0x3c')],!![]),null);}else{var _0x5defc6='%'+_0x29b34d[_0x7ec1('0x3c')]+'%';_0x8130ff[_0x7ec1('0x44')][_0x27f744](_0x7ec1('0x45'),_0x5defc6,_0x5defc6,_0x5defc6);}}else{_0x544e2c=_[_0x7ec1('0x39')](_0x4e6ba6,[_0x7ec1('0x8'),_0x7ec1('0x46')]);_0x29b34d[_0x7ec1('0x7')]='ContactId';_0x51c8ca=as[_0x7ec1('0x3a')](_0x3649f0,_0x544e2c[_0x7ec1('0x47')],_0x29b34d);_0x8130ff[_0x7ec1('0x44')][_0x27f744](_0x51c8ca['text'],_0x51c8ca[_0x7ec1('0x3c')][_0x7ec1('0x3d')],_0x51c8ca[_0x7ec1('0x3c')][_0x7ec1('0x3e')]);}break;case _0x7ec1('0x48'):var _0x2a578d=_0x29b34d[_0x7ec1('0x3c')][_0x7ec1('0x43')](',')[_0x7ec1('0x13')](function(_0x1acb25){return Number(_0x1acb25);});var _0x1f3d91=parseTagParameter(_0x2a578d);_0x8130ff[_0x7ec1('0x49')][_0x7ec1('0x4a')][_0x7ec1('0x41')](_0x1f3d91);_0x8130ff[_0x7ec1('0x49')][_0x7ec1('0x4b')]=_0x2a578d;break;case _0x7ec1('0x4c'):if(_0x29b34d[_0x7ec1('0x4d')]===_0x7ec1('0x42')){_0x8130ff['user'][_0x27f744](_0x7ec1('0x4e'),'%'+_0x29b34d['value']+'%',null);}else{_0x544e2c=_[_0x7ec1('0x39')](_0x4e6ba6,[_0x7ec1('0x8'),'UserId']);_0x29b34d['field']=_0x7ec1('0x4f');_0x51c8ca=as['buildExpression'](_0x3649f0,_0x544e2c[_0x7ec1('0x47')],_0x29b34d);_0x8130ff[_0x7ec1('0x50')][_0x27f744](_0x51c8ca[_0x7ec1('0x51')],_0x51c8ca['value'][_0x7ec1('0x3d')],_0x51c8ca[_0x7ec1('0x3c')]['end']);}break;case _0x7ec1('0x52'):case _0x7ec1('0x53'):_0x51c8ca=as[_0x7ec1('0x3a')]('me',null,_0x29b34d);_0x8130ff['body'][_0x27f744](_0x51c8ca[_0x7ec1('0x51')],_0x51c8ca['value'][_0x7ec1('0x3d')],_0x51c8ca[_0x7ec1('0x3c')][_0x7ec1('0x3e')]);break;}}}return _0x8130ff;}function parseModelFields(_0x361e42,_0x4cbfae,_0x1b0dd8){var _0x1b5f90=utils['getAccountFK'](_0x361e42);var _0x26ce8c=squel[_0x7ec1('0x21')]();var _0x38668d=_(_0x4cbfae)['keys']()['map'](function(_0x55c4a6){return _[_0x7ec1('0x54')](_0x1b0dd8,[_0x7ec1('0x8'),_0x55c4a6])?_0x55c4a6:undefined;})[_0x7ec1('0x55')]()[_0x7ec1('0x3c')]();if(_0x38668d['length']>0x0){_0x38668d[_0x7ec1('0x22')](function(_0x56f3e8){if(_0x56f3e8===_0x1b5f90){_0x26ce8c[_0x7ec1('0x41')]('i.'+_0x1b5f90+_0x7ec1('0x56'),[]['concat'](_0x4cbfae[_0x56f3e8]));}else if(_0x56f3e8===_0x7ec1('0x57')){var _0x6de7ce=JSON[_0x7ec1('0x58')](_0x4cbfae[_0x56f3e8])[_0x7ec1('0x59')];var _0x527302=JSON['parse'](_0x4cbfae[_0x56f3e8])[_0x7ec1('0x5a')];_0x26ce8c[_0x7ec1('0x41')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x6de7ce,_0x527302);}else{if(_0x4cbfae[_0x56f3e8]===_0x7ec1('0x5b')){_0x26ce8c[_0x7ec1('0x41')]('i.'+_0x56f3e8+_0x7ec1('0x5c'));}else{_0x26ce8c[_0x7ec1('0x41')]('i.'+_0x56f3e8+_0x7ec1('0x5d'),_0x4cbfae[_0x56f3e8]);}}});}return _0x26ce8c;}function parseQueryParameters(_0x4ca4a8,_0x1d4b8c,_0x389bcc){var _0x2214df=getSqlClauses();return Promise[_0x7ec1('0x5e')]()['then'](function(){return parseModelFields(_0x4ca4a8,_0x1d4b8c,_0x389bcc);})[_0x7ec1('0x5f')](function(_0x32b43b){_0x2214df[_0x7ec1('0x60')][_0x7ec1('0x41')](_0x32b43b);return parseReadParameter(_0x1d4b8c[_0x7ec1('0x40')]);})[_0x7ec1('0x5f')](function(_0x2d0d15){_0x2214df[_0x7ec1('0x40')]['and'](_0x2d0d15);return parseTagParameter(_0x1d4b8c['tag']);})[_0x7ec1('0x5f')](function(_0x406a28){_0x2214df['tags'][_0x7ec1('0x4a')]['and'](_0x406a28);return parseSearchFilter(_0x4ca4a8,_0x1d4b8c[_0x7ec1('0x61')]);})[_0x7ec1('0x5f')](function(_0x2cc0a7){_0x2214df['filter']=_0x2cc0a7;return _0x2214df;});}function checkAccountsRestrictions(_0x275229,_0x5b0a89,_0x3b5d9a){var _0x2364b8=utils[_0x7ec1('0x2')](_0x275229);var _0x3dc628='get'+_[_0x7ec1('0x62')](_0x275229)+(_0x275229===_0x7ec1('0x63')?'Websites':_0x7ec1('0x64'));var _0x3ac3f3=squel[_0x7ec1('0x21')]();return Promise['resolve']()[_0x7ec1('0x5f')](function(){if(_0x3b5d9a[_0x7ec1('0x5')]&&_0x5b0a89[_0x7ec1('0x3')]===_0x7ec1('0x4')){return _0x5b0a89[_0x3dc628]({'attributes':['id'],'raw':!![]});}})[_0x7ec1('0x5f')](function(_0xcbfd70){if(_0xcbfd70){if(_0xcbfd70[_0x7ec1('0x11')]===0x0){_0x3ac3f3['and']('i.'+_0x2364b8+'\x20IS\x20NULL');}else{_0x3ac3f3['and']('i.'+_0x2364b8+_0x7ec1('0x56'),_[_0x7ec1('0x13')](_0xcbfd70,'id'));}}else if(!_0x3b5d9a[_0x2364b8]){_0x3ac3f3[_0x7ec1('0x41')]('i.'+_0x2364b8+_0x7ec1('0x65'));}})[_0x7ec1('0x5f')](function(){return _0x3ac3f3;});}function getClosedOrderClause(_0x2deaf3,_0x2674a6){var _0x47176e='';var _0x390fa2=[_0x7ec1('0x66'),_0x7ec1('0x67'),_0x7ec1('0x68')];if(_0x2deaf3===_0x7ec1('0x32')){_0x390fa2[_0x7ec1('0x69')](_0x7ec1('0x6a'));}if(_0x2674a6[_0x7ec1('0x6b')]==='0'&&_0x2deaf3===_0x7ec1('0x32')){_0x47176e=_0x7ec1('0x6a');}else{if(_0x2674a6[_0x7ec1('0x6b')]==='1'){_0x390fa2[_0x7ec1('0x6c')]();}_0x47176e='CONCAT_WS(\x27\x27,\x20'+_0x390fa2['join'](',\x20')+')';}return _0x47176e;}function getFilteredInteractions(_0x3db430,_0x1396ff,_0x340b78,_0xa14523){var _0x4ad6b1=utils[_0x7ec1('0x15')](_0x3db430);var _0x23c986=_[_0x7ec1('0x62')](_0x3db430)+'Interaction';var _0x28f333=[];var _0x121bf0=getTagsQuery();var _0xf6be7a={'type':db[_0x7ec1('0x6d')]['QueryTypes'][_0x7ec1('0x6e')],'raw':!![]};var _0x114894=[];var _0x4f93d8=[];return db[_0x7ec1('0x6f')][_0x7ec1('0x70')](_0x121bf0[_0x7ec1('0x71')](),_0xf6be7a)[_0x7ec1('0x5f')](function(_0x25f387){_0x28f333=_[_0x7ec1('0x72')](_0x25f387,'id');_0xf6be7a=_[_0x7ec1('0x73')](_0xf6be7a,{'model':db[_0x23c986],'mapToModel':!![],'nest':!![]});if(_0x340b78[_0x7ec1('0x60')]){_0xa14523[_0x7ec1('0x74')][_0x7ec1('0x22')](function(_0x15c3cf){_0x1396ff[_0x7ec1('0x7')]('i.'+_0x15c3cf);});}else{_0x1396ff['field'](_0x7ec1('0x75'),_0x7ec1('0x3f'));_0x1396ff[_0x7ec1('0x7')](_0x7ec1('0x76'),_0x7ec1('0x77'));_0x1396ff[_0x7ec1('0x7')]('a.mandatoryDisposition',_0x7ec1('0x78'));if(_0x3db430===_0x7ec1('0x32')){_0x1396ff[_0x7ec1('0x7')](_0x7ec1('0x79'),'Account.email');_0x1396ff[_0x7ec1('0x7')](_0x7ec1('0x7a'),_0x7ec1('0x7b'));_0x1396ff[_0x7ec1('0x7')](_0x7ec1('0x7c'));_0x1396ff['field'](_0x7ec1('0x7d'));_0x1396ff[_0x7ec1('0x7')](_0x7ec1('0x7e'));_0x1396ff[_0x7ec1('0x7')](_0x7ec1('0x7f'));_0x1396ff[_0x7ec1('0x7')](_0x7ec1('0x80'));_0x1396ff[_0x7ec1('0x7')](_0x7ec1('0x81'));_0x1396ff[_0x7ec1('0x7')](_0x7ec1('0x82'));_0x1396ff[_0x7ec1('0x7')](_0x7ec1('0x83'));_0x1396ff[_0x7ec1('0x7')](_0x7ec1('0x84'));_0x1396ff[_0x7ec1('0x7')](_0x7ec1('0x68'));_0x1396ff[_0x7ec1('0x7')](_0x7ec1('0x67'));_0x1396ff[_0x7ec1('0x7')]('i.thirdDisposition');_0x1396ff[_0x7ec1('0x7')](_0x7ec1('0x6a'));_0x1396ff['field'](_0x7ec1('0x85'));_0x1396ff[_0x7ec1('0x7')]('i.ContactId');_0x1396ff[_0x7ec1('0x7')](_0x7ec1('0x86'));_0x1396ff['field'](_0x7ec1('0x87'));}else if(_0x3db430===_0x7ec1('0x2e')){_0x1396ff[_0x7ec1('0x7')](_0x7ec1('0x88'),_0x7ec1('0x7b'));}else{_0x1396ff[_0x7ec1('0x7')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x7ec1('0x7b'));}if(_0x3db430!==_0x7ec1('0x32')){_0x1396ff['field']('i.*');}_0x1396ff[_0x7ec1('0x7')](_0x7ec1('0x89'),_0x7ec1('0x8a'));_0x1396ff[_0x7ec1('0x7')](_0x7ec1('0x8b'),'Contact.lastName');_0x1396ff[_0x7ec1('0x7')](_0x7ec1('0x8c'),_0x7ec1('0x8d'));_0x1396ff['field'](_0x7ec1('0x8e'),'Contact.phone');_0x1396ff['field'](_0x7ec1('0x8f'),_0x7ec1('0x90'));_0x1396ff[_0x7ec1('0x7')]('c.fax','Contact.fax');_0x1396ff[_0x7ec1('0x7')](_0x7ec1('0x91'),_0x7ec1('0x92'));_0x1396ff[_0x7ec1('0x7')]('o.internal','Owner.internal');_0x1396ff[_0x7ec1('0x7')](_0x7ec1('0x93'),_0x7ec1('0x94'));}if(_0xa14523[_0x7ec1('0x95')]){_0x1396ff[_0x7ec1('0x95')](_0xa14523[_0x7ec1('0x95')]);}if(_0xa14523['offset']){_0x1396ff[_0x7ec1('0x96')](_0xa14523[_0x7ec1('0x96')]);}return db['sequelize'][_0x7ec1('0x70')](_0x1396ff['toString'](),_0xf6be7a);})[_0x7ec1('0x5f')](function(_0x216337){_0x114894=_0x216337;var _0x1e114a=getUsersQuery(_0x3db430,_0x114894);return db['sequelize'][_0x7ec1('0x70')](_0x1e114a['toString'](),_0xf6be7a);})[_0x7ec1('0x5f')](function(_0x3ebebb){_0x4f93d8=_[_0x7ec1('0x97')](_0x3ebebb,_0x4ad6b1);if(_0x3db430==='mail'){return db[_0x7ec1('0x98')][_0x7ec1('0x99')]({'attributes':[_0x7ec1('0x9a')],'raw':!![]});}})[_0x7ec1('0x5f')](function(_0x5c1716){var _0xa64272=_0x5c1716?_0x5c1716[_0x7ec1('0x9a')]:undefined;var _0x413c91=_0x114894[_0x7ec1('0x13')](function(_0x2c4b6f){return updateInteraction(_0x2c4b6f,_0x28f333,_0x4f93d8,_0xa64272);});return Promise[_0x7ec1('0x9b')](_0x413c91);});}function countFilteredInteractions(_0x3502e3,_0x48da0b){var _0x28f9e0=_0x3502e3['clone']();_0x28f9e0[_0x7ec1('0x7')](_0x7ec1('0x9c'));_0x28f9e0[_0x7ec1('0x7')](_0x7ec1('0x75'),_0x7ec1('0x3f'));var _0x58b34a=utils['getSelectedTags'](_0x48da0b);if(!_['isEmpty'](_0x58b34a)){_0x28f9e0[_0x7ec1('0x12')]('t.id\x20IN\x20?',_0x58b34a);}var _0x129191={'type':db[_0x7ec1('0x6d')][_0x7ec1('0x9d')][_0x7ec1('0x6e')],'raw':!![]};return db[_0x7ec1('0x6f')]['query'](_0x28f9e0[_0x7ec1('0x71')](),_0x129191);}module[_0x7ec1('0x9e')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xb714=['unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','i.phone\x20LIKE\x20?','i.fax\x20LIKE\x20?','i.from\x20LIKE\x20?','mail','c.email\x20LIKE\x20?','getFullTextValue','fax','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','type','text','value','start','unreadMessages','read','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','end','Tag','tags','clause','and','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','body','plainBody','keys','some','compact','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','then','fields','filter','get','capitalize','chat','Accounts','resolve','role','map','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.disposition','unshift','i.substatus','closed','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','i.UserId','openchannel','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','limit','offset','groupBy','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','exports','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','./utils','../../mysqldb','getAccountFK','agent','search','select','field','name','color','from','getInteractionFK','user_has_','_interactions','u.id','left_join','u.id\x20=\x20ui.UserId','length','where','ui.','\x20IN\x20?','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','tools_tags','expr','getSelectedTags','forEach'];(function(_0x5958d2,_0x550300){var _0x2a4809=function(_0x48048b){while(--_0x48048b){_0x5958d2['push'](_0x5958d2['shift']());}};_0x2a4809(++_0x550300);}(_0xb714,0x124));var _0x4b71=function(_0x153ab3,_0x5c7acb){_0x153ab3=_0x153ab3-0x0;var _0x4e2455=_0xb714[_0x153ab3];return _0x4e2455;};'use strict';var _=require(_0x4b71('0x0'));var squel=require('squel');var as=require(_0x4b71('0x1'));var qs=require(_0x4b71('0x2'));var updateInteraction=require(_0x4b71('0x3'))['updateInteraction'];var utils=require(_0x4b71('0x4'));var db=require(_0x4b71('0x5'))['db'];function skipInteractionsQuery(_0x3f1082,_0x5bca38,_0x1c4cc1){var _0x561c24=![];var _0x5243a3=utils[_0x4b71('0x6')](_0x3f1082);if(_0x5bca38['role']===_0x4b71('0x7')&&!_0x1c4cc1[_0x4b71('0x8')]&&!_0x1c4cc1[_0x5243a3]){_0x561c24=!![];}return _0x561c24;}function getTagsQuery(){return squel[_0x4b71('0x9')]()[_0x4b71('0xa')]('id')[_0x4b71('0xa')](_0x4b71('0xb'))[_0x4b71('0xa')](_0x4b71('0xc'))[_0x4b71('0xd')]('tools_tags');}function getUsersQuery(_0x2f2cb3,_0x371609){var _0x283996=utils[_0x4b71('0xe')](_0x2f2cb3);var _0x585432=_0x4b71('0xf')+_0x2f2cb3+_0x4b71('0x10');var _0xccbcc3=squel['select']()['field'](_0x4b71('0x11'))[_0x4b71('0xa')]('u.fullname')[_0x4b71('0xa')]('ui.'+_0x283996)['from'](_0x585432,'ui')[_0x4b71('0x12')]('users','u',_0x4b71('0x13'));if(_0x371609[_0x4b71('0x14')]>0x0){_0xccbcc3[_0x4b71('0x15')](_0x4b71('0x16')+_0x283996+_0x4b71('0x17'),_['map'](_0x371609,'id'));}return _0xccbcc3;}function getInteractionsQuery(_0x34eda8){var _0x32afc3=utils['getInteractionsTables'](_0x34eda8);var _0xa56da0=utils['getAccountFK'](_0x34eda8);var _0x3b1924=utils[_0x4b71('0xe')](_0x34eda8);return squel[_0x4b71('0x9')]()[_0x4b71('0xd')](_0x32afc3[_0x4b71('0x18')],'i')['left_join'](_0x4b71('0x19'),'c',_0x4b71('0x1a'))[_0x4b71('0x12')](_0x4b71('0x1b'),'o',_0x4b71('0x1c'))['left_join'](_0x32afc3[_0x4b71('0x1d')],'a',_0x4b71('0x1e')+_0xa56da0)[_0x4b71('0x12')](_0x32afc3[_0x4b71('0x1f')],'me',_0x4b71('0x20')+_0x3b1924+_0x4b71('0x21'))[_0x4b71('0x12')](_0x32afc3[_0x4b71('0x22')],'it',_0x4b71('0x23')+_0x3b1924+_0x4b71('0x21'))[_0x4b71('0x12')](_0x4b71('0x24'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x15da14={'body':squel[_0x4b71('0x25')](),'contact':squel[_0x4b71('0x25')](),'default':squel[_0x4b71('0x25')](),'fields':squel[_0x4b71('0x25')](),'filter':squel[_0x4b71('0x25')](),'read':squel[_0x4b71('0x25')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x4b71('0x25')]()};return _0x15da14;}function parseTagParameter(_0x5bc7bd){var _0x5c7fee=squel[_0x4b71('0x25')]();if(_0x5bc7bd){var _0xa78b7a=utils[_0x4b71('0x26')](_0x5bc7bd);_0xa78b7a[_0x4b71('0x27')](function(_0x7c253f){_0x5c7fee['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x7c253f+',%');});}return _0x5c7fee;}function parseReadParameter(_0x444eb7){var _0xc116d7='';if(_0x444eb7){_0xc116d7=_0x4b71('0x28');if(_0x444eb7==='1'){_0xc116d7=_0xc116d7[_0x4b71('0x29')](_0x4b71('0x2a'),'=');}else{_0xc116d7=_0xc116d7[_0x4b71('0x29')](_0x4b71('0x2a'),'>');}}return _0xc116d7;}function parseSearchFilter(_0x2ec7b3,_0x20ecab){var _0x3a8ed8=squel[_0x4b71('0x25')]();if(_0x20ecab){var _0x310446=_0x20ecab[_0x4b71('0x29')]('\x5c','\x5c\x5c')[_0x4b71('0x29')](/'/g,'\x27\x27');if(qs[_0x4b71('0x2b')](_0x310446)){_0x3a8ed8['or'](_0x4b71('0x2c'),_0x310446+'%');if([_0x4b71('0x2d'),_0x4b71('0x2e')]['includes'](_0x2ec7b3)){_0x3a8ed8['or'](_0x4b71('0x2f'),_0x310446+'%');}else if(_0x2ec7b3==='fax'){_0x3a8ed8['or'](_0x4b71('0x30'),_0x310446+'%');}else if(_0x2ec7b3==='openchannel'){_0x3a8ed8['or'](_0x4b71('0x31'),_0x310446+'%');}}else if(_0x2ec7b3===_0x4b71('0x32')&&qs['isEmail'](_0x310446)){_0x3a8ed8['or'](_0x4b71('0x33'),_0x310446+'%');}else{if(_0x2ec7b3===_0x4b71('0x32')){_0x3a8ed8['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4b71('0x34')](_0x310446,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x310446));}else if(_0x2ec7b3!==_0x4b71('0x35')){_0x3a8ed8['or'](_0x4b71('0x36'),qs['getFullTextValue'](_0x310446));}_0x3a8ed8['or'](_0x4b71('0x37'),qs[_0x4b71('0x34')](_0x310446,!![]),null);}}return _0x3a8ed8;}function parseAdvancedSearchFilter(_0x296919,_0x2692cf){var _0x1a20d5=getSqlClauses();var _0x22a9fb=as[_0x4b71('0x38')](_0x296919);var _0x586258=_0x22a9fb[_0x4b71('0x39')];for(var _0x2a804f=0x0;_0x2a804f<_0x22a9fb[_0x4b71('0x3a')][_0x4b71('0x14')];_0x2a804f++){var _0x14f83b=_0x22a9fb['conditions'][_0x2a804f];var _0x3c3d49='i';var _0x15e70a=_['find'](_0x2692cf,['name',_0x14f83b['field']]);if(_0x15e70a){var _0x4b5613=as['buildExpression'](_0x3c3d49,_0x15e70a[_0x4b71('0x3b')],_0x14f83b);_0x1a20d5['default'][_0x586258](_0x4b5613[_0x4b71('0x3c')],_0x4b5613[_0x4b71('0x3d')][_0x4b71('0x3e')],_0x4b5613['value']['end']);}else{switch(_0x14f83b['field']){case _0x4b71('0x3f'):var _0x1f96c3=parseReadParameter(_0x14f83b[_0x4b71('0x3d')]);_0x1a20d5[_0x4b71('0x40')]['and'](_0x1f96c3);break;case _0x4b71('0x41'):if(_0x14f83b[_0x4b71('0x42')]===_0x4b71('0x43')){if(_0x14f83b[_0x4b71('0x3d')][_0x4b71('0x44')]('\x20')['length']>0x1){_0x1a20d5[_0x4b71('0x45')][_0x586258]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4b71('0x34')](_0x14f83b[_0x4b71('0x3d')],!![]),null);}else{var _0x5b4459='%'+_0x14f83b['value']+'%';_0x1a20d5['contact'][_0x586258](_0x4b71('0x46'),_0x5b4459,_0x5b4459,_0x5b4459);}}else{_0x15e70a=_['find'](_0x2692cf,[_0x4b71('0xb'),_0x4b71('0x47')]);_0x14f83b['field']=_0x4b71('0x47');_0x4b5613=as[_0x4b71('0x48')](_0x3c3d49,_0x15e70a['type'],_0x14f83b);_0x1a20d5[_0x4b71('0x45')][_0x586258](_0x4b5613[_0x4b71('0x3c')],_0x4b5613[_0x4b71('0x3d')][_0x4b71('0x3e')],_0x4b5613[_0x4b71('0x3d')][_0x4b71('0x49')]);}break;case _0x4b71('0x4a'):var _0x164f9b=_0x14f83b[_0x4b71('0x3d')][_0x4b71('0x44')](',')['map'](function(_0x510534){return Number(_0x510534);});var _0x477db7=parseTagParameter(_0x164f9b);_0x1a20d5[_0x4b71('0x4b')][_0x4b71('0x4c')][_0x4b71('0x4d')](_0x477db7);_0x1a20d5[_0x4b71('0x4b')]['ids']=_0x164f9b;break;case'User':if(_0x14f83b[_0x4b71('0x42')]===_0x4b71('0x43')){_0x1a20d5[_0x4b71('0x4e')][_0x586258](_0x4b71('0x4f'),'%'+_0x14f83b[_0x4b71('0x3d')]+'%',null);}else{_0x15e70a=_[_0x4b71('0x50')](_0x2692cf,[_0x4b71('0xb'),_0x4b71('0x51')]);_0x14f83b[_0x4b71('0xa')]=_0x4b71('0x51');_0x4b5613=as[_0x4b71('0x48')](_0x3c3d49,_0x15e70a[_0x4b71('0x3b')],_0x14f83b);_0x1a20d5[_0x4b71('0x4e')][_0x586258](_0x4b5613[_0x4b71('0x3c')],_0x4b5613['value'][_0x4b71('0x3e')],_0x4b5613['value'][_0x4b71('0x49')]);}break;case _0x4b71('0x52'):case _0x4b71('0x53'):_0x4b5613=as[_0x4b71('0x48')]('me',null,_0x14f83b);_0x1a20d5[_0x4b71('0x52')][_0x586258](_0x4b5613['text'],_0x4b5613[_0x4b71('0x3d')][_0x4b71('0x3e')],_0x4b5613[_0x4b71('0x3d')][_0x4b71('0x49')]);break;}}}return _0x1a20d5;}function parseModelFields(_0x27b611,_0x587863,_0x286a07){var _0x713f63=utils[_0x4b71('0x6')](_0x27b611);var _0x52aef5=squel[_0x4b71('0x25')]();var _0x2c8ad4=_(_0x587863)[_0x4b71('0x54')]()['map'](function(_0x56dea0){return _[_0x4b71('0x55')](_0x286a07,[_0x4b71('0xb'),_0x56dea0])?_0x56dea0:undefined;})[_0x4b71('0x56')]()[_0x4b71('0x3d')]();if(_0x2c8ad4[_0x4b71('0x14')]>0x0){_0x2c8ad4[_0x4b71('0x27')](function(_0x2c5904){if(_0x2c5904===_0x713f63){_0x52aef5[_0x4b71('0x4d')]('i.'+_0x713f63+_0x4b71('0x17'),[][_0x4b71('0x57')](_0x587863[_0x2c5904]));}else if(_0x2c5904===_0x4b71('0x58')){var _0x236717=JSON['parse'](_0x587863[_0x2c5904])[_0x4b71('0x59')];var _0x1c3ecb=JSON[_0x4b71('0x5a')](_0x587863[_0x2c5904])[_0x4b71('0x5b')];_0x52aef5[_0x4b71('0x4d')](_0x4b71('0x5c'),_0x236717,_0x1c3ecb);}else{if(_0x587863[_0x2c5904]==='null'){_0x52aef5[_0x4b71('0x4d')]('i.'+_0x2c5904+_0x4b71('0x5d'));}else{_0x52aef5[_0x4b71('0x4d')]('i.'+_0x2c5904+'\x20=\x20?',_0x587863[_0x2c5904]);}}});}return _0x52aef5;}function parseQueryParameters(_0x3d41d2,_0x36c122,_0x550da5){var _0x4b41e7=getSqlClauses();return Promise['resolve']()[_0x4b71('0x5e')](function(){return parseModelFields(_0x3d41d2,_0x36c122,_0x550da5);})[_0x4b71('0x5e')](function(_0x127fae){_0x4b41e7[_0x4b71('0x5f')][_0x4b71('0x4d')](_0x127fae);return parseReadParameter(_0x36c122['read']);})[_0x4b71('0x5e')](function(_0x45d2bc){_0x4b41e7['read'][_0x4b71('0x4d')](_0x45d2bc);return parseTagParameter(_0x36c122['tag']);})[_0x4b71('0x5e')](function(_0x549de4){_0x4b41e7[_0x4b71('0x4b')]['clause'][_0x4b71('0x4d')](_0x549de4);return parseSearchFilter(_0x3d41d2,_0x36c122[_0x4b71('0x60')]);})[_0x4b71('0x5e')](function(_0x57d5a8){_0x4b41e7['filter']=_0x57d5a8;return _0x4b41e7;});}function checkAccountsRestrictions(_0x48223f,_0xf8d048,_0x20ccfa){var _0x31fcc2=utils[_0x4b71('0x6')](_0x48223f);var _0x3d1743=_0x4b71('0x61')+_[_0x4b71('0x62')](_0x48223f)+(_0x48223f===_0x4b71('0x63')?'Websites':_0x4b71('0x64'));var _0x3f71b9=squel[_0x4b71('0x25')]();return Promise[_0x4b71('0x65')]()[_0x4b71('0x5e')](function(){if(_0x20ccfa['search']&&_0xf8d048[_0x4b71('0x66')]===_0x4b71('0x7')){return _0xf8d048[_0x3d1743]({'attributes':['id'],'raw':!![]});}})[_0x4b71('0x5e')](function(_0xe557c){if(_0xe557c){if(_0xe557c['length']===0x0){_0x3f71b9[_0x4b71('0x4d')]('i.'+_0x31fcc2+_0x4b71('0x5d'));}else{_0x3f71b9[_0x4b71('0x4d')]('i.'+_0x31fcc2+_0x4b71('0x17'),_[_0x4b71('0x67')](_0xe557c,'id'));}}else if(!_0x20ccfa[_0x31fcc2]){_0x3f71b9[_0x4b71('0x4d')]('i.'+_0x31fcc2+_0x4b71('0x68'));}})[_0x4b71('0x5e')](function(){return _0x3f71b9;});}function getClosedOrderClause(_0x3134bd,_0x5dd4b2){var _0xa5475c='';var _0x428a32=[_0x4b71('0x69'),'i.secondDisposition',_0x4b71('0x6a')];if(_0x3134bd===_0x4b71('0x32')){_0x428a32[_0x4b71('0x6b')](_0x4b71('0x6c'));}if(_0x5dd4b2[_0x4b71('0x6d')]==='0'&&_0x3134bd===_0x4b71('0x32')){_0xa5475c='i.substatus';}else{if(_0x5dd4b2[_0x4b71('0x6d')]==='1'){_0x428a32['shift']();}_0xa5475c=_0x4b71('0x6e')+_0x428a32[_0x4b71('0x6f')](',\x20')+')';}return _0xa5475c;}function getFilteredInteractions(_0x206f77,_0x53af62,_0x40c10d,_0x49b138){var _0x1c68f1=utils['getInteractionFK'](_0x206f77);var _0x3d56bc=_[_0x4b71('0x62')](_0x206f77)+_0x4b71('0x70');var _0x383319=[];var _0xe006a8=getTagsQuery();var _0x2f4de6={'type':db[_0x4b71('0x71')][_0x4b71('0x72')][_0x4b71('0x73')],'raw':!![]};var _0x20d487=[];var _0x116833=[];return db[_0x4b71('0x74')][_0x4b71('0x75')](_0xe006a8[_0x4b71('0x76')](),_0x2f4de6)['then'](function(_0x3ce8fb){_0x383319=_[_0x4b71('0x77')](_0x3ce8fb,'id');_0x2f4de6=_[_0x4b71('0x78')](_0x2f4de6,{'model':db[_0x3d56bc],'mapToModel':!![],'nest':!![]});if(_0x40c10d[_0x4b71('0x5f')]){_0x49b138[_0x4b71('0x79')][_0x4b71('0x27')](function(_0x147c1b){_0x53af62[_0x4b71('0xa')]('i.'+_0x147c1b);});}else{_0x53af62['field'](_0x4b71('0x7a'),_0x4b71('0x3f'));_0x53af62[_0x4b71('0xa')]('a.key','Account.key');_0x53af62['field'](_0x4b71('0x7b'),_0x4b71('0x7c'));if(_0x206f77==='mail'){_0x53af62[_0x4b71('0xa')](_0x4b71('0x7d'),_0x4b71('0x7e'));_0x53af62[_0x4b71('0xa')](_0x4b71('0x7f'),_0x4b71('0x80'));_0x53af62[_0x4b71('0xa')](_0x4b71('0x81'));_0x53af62[_0x4b71('0xa')](_0x4b71('0x82'));_0x53af62['field'](_0x4b71('0x83'));_0x53af62['field'](_0x4b71('0x84'));_0x53af62[_0x4b71('0xa')]('i.closedAt');_0x53af62[_0x4b71('0xa')](_0x4b71('0x85'));_0x53af62[_0x4b71('0xa')](_0x4b71('0x86'));_0x53af62[_0x4b71('0xa')](_0x4b71('0x87'));_0x53af62[_0x4b71('0xa')](_0x4b71('0x88'));_0x53af62['field'](_0x4b71('0x6a'));_0x53af62[_0x4b71('0xa')]('i.secondDisposition');_0x53af62[_0x4b71('0xa')](_0x4b71('0x69'));_0x53af62[_0x4b71('0xa')](_0x4b71('0x6c'));_0x53af62['field'](_0x4b71('0x89'));_0x53af62[_0x4b71('0xa')](_0x4b71('0x8a'));_0x53af62[_0x4b71('0xa')](_0x4b71('0x8b'));_0x53af62[_0x4b71('0xa')](_0x4b71('0x8c'));}else if(_0x206f77===_0x4b71('0x8d')){_0x53af62[_0x4b71('0xa')](_0x4b71('0x8e'),_0x4b71('0x80'));}else{_0x53af62[_0x4b71('0xa')]('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',_0x4b71('0x80'));}if(_0x206f77!==_0x4b71('0x32')){_0x53af62[_0x4b71('0xa')]('i.*');}_0x53af62[_0x4b71('0xa')](_0x4b71('0x8f'),_0x4b71('0x90'));_0x53af62[_0x4b71('0xa')](_0x4b71('0x91'),'Contact.lastName');_0x53af62[_0x4b71('0xa')](_0x4b71('0x92'),_0x4b71('0x93'));_0x53af62['field'](_0x4b71('0x94'),_0x4b71('0x95'));_0x53af62[_0x4b71('0xa')]('c.mobile','Contact.mobile');_0x53af62[_0x4b71('0xa')](_0x4b71('0x96'),'Contact.fax');_0x53af62[_0x4b71('0xa')](_0x4b71('0x97'),_0x4b71('0x98'));_0x53af62['field'](_0x4b71('0x99'),_0x4b71('0x9a'));_0x53af62[_0x4b71('0xa')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x49b138['limit']){_0x53af62[_0x4b71('0x9b')](_0x49b138['limit']);}if(_0x49b138['offset']){_0x53af62[_0x4b71('0x9c')](_0x49b138['offset']);}return db[_0x4b71('0x74')][_0x4b71('0x75')](_0x53af62[_0x4b71('0x76')](),_0x2f4de6);})[_0x4b71('0x5e')](function(_0x31f979){_0x20d487=_0x31f979;var _0x58c3b5=getUsersQuery(_0x206f77,_0x20d487);return db[_0x4b71('0x74')]['query'](_0x58c3b5[_0x4b71('0x76')](),_0x2f4de6);})[_0x4b71('0x5e')](function(_0x543931){_0x116833=_[_0x4b71('0x9d')](_0x543931,_0x1c68f1);if(_0x206f77===_0x4b71('0x32')){return db['Setting'][_0x4b71('0x9e')]({'attributes':[_0x4b71('0x9f')],'raw':!![]});}})[_0x4b71('0x5e')](function(_0x1eebde){var _0x4b7976=_0x1eebde?_0x1eebde[_0x4b71('0x9f')]:undefined;var _0x1f6a60=_0x20d487[_0x4b71('0x67')](function(_0x4d0f71){return updateInteraction(_0x4d0f71,_0x383319,_0x116833,_0x4b7976);});return Promise[_0x4b71('0xa0')](_0x1f6a60);});}function countFilteredInteractions(_0x2d0b12,_0x56858c){var _0x4e000d=_0x2d0b12[_0x4b71('0xa1')]();_0x4e000d[_0x4b71('0xa')](_0x4b71('0xa2'));_0x4e000d['field'](_0x4b71('0x7a'),_0x4b71('0x3f'));var _0x456050=utils[_0x4b71('0x26')](_0x56858c);if(!_[_0x4b71('0xa3')](_0x456050)){_0x4e000d[_0x4b71('0x15')](_0x4b71('0xa4'),_0x456050);}var _0x3d8794={'type':db[_0x4b71('0x71')][_0x4b71('0x72')]['SELECT'],'raw':!![]};return db[_0x4b71('0x74')][_0x4b71('0x75')](_0x4e000d[_0x4b71('0x76')](),_0x3d8794);}module[_0x4b71('0xa5')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 4e4cc0c..1329fb1 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6cbe=['lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','lodash','../../mysqldb','map','fullname','split','forEach','push','waiting','talking','answered','total','closed','disposition','abandoned','unmanaged','UserId','MailMessage','findOne','out','-id','then','plainBody'];(function(_0x109c78,_0x54d66c){var _0x4808fc=function(_0x15cf9b){while(--_0x15cf9b){_0x109c78['push'](_0x109c78['shift']());}};_0x4808fc(++_0x54d66c);}(_0x6cbe,0x146));var _0xe6cb=function(_0xda7f4f,_0x1f73f8){_0xda7f4f=_0xda7f4f-0x0;var _0x463bb5=_0x6cbe[_0xda7f4f];return _0x463bb5;};'use strict';var _=require(_0xe6cb('0x0'));var db=require(_0xe6cb('0x1'))['db'];function getInteractionUsers(_0x36a2aa,_0x6b8656){return new Promise(function(_0x563736,_0x2c6912){try{var _0x46392e=[];if(_0x6b8656[_0x36a2aa]){_0x46392e=_0x6b8656[_0x36a2aa][_0xe6cb('0x2')](function(_0x23d230){return{'id':_0x23d230['id'],'fullname':_0x23d230[_0xe6cb('0x3')]};});}return _0x563736(_0x46392e);}catch(_0x5b67f8){_0x2c6912(_0x5b67f8);}});}function getInteractionTags(_0x4680a7,_0x46de54){var _0x507a1a=[];if(_0x4680a7){_0x4680a7[_0xe6cb('0x4')](',')[_0xe6cb('0x5')](function(_0x38e7bb){_0x507a1a[_0xe6cb('0x6')](_0x46de54[_0x38e7bb]);});}return _0x507a1a;}function updateWaitingCounter(_0x4f3aff){if(_0x4f3aff[_0xe6cb('0x7')]){_0x4f3aff['waiting']-=0x1;}}function updateInteractionCounters(_0x3eeb47){_0x3eeb47[_0xe6cb('0x7')]=0x0;_0x3eeb47[_0xe6cb('0x8')]=0x0;_0x3eeb47[_0xe6cb('0x9')]=0x0;_0x3eeb47['unmanaged']=0x0;_0x3eeb47['abandoned']=0x0;_0x3eeb47[_0xe6cb('0xa')]=0x0;if(_0x3eeb47[_0xe6cb('0xb')]){if(_0x3eeb47[_0xe6cb('0xc')]==='abandoned'){_0x3eeb47[_0xe6cb('0xd')]+=0x1;updateWaitingCounter(_0x3eeb47);}if(_0x3eeb47['UserId']){_0x3eeb47[_0xe6cb('0x9')]+=0x1;if(_0x3eeb47[_0xe6cb('0x8')]){_0x3eeb47[_0xe6cb('0x8')]-=0x1;}}else{if(_0x3eeb47['disposition']){_0x3eeb47[_0xe6cb('0xe')]+=0x1;updateWaitingCounter(_0x3eeb47);}}}else{if(!_0x3eeb47[_0xe6cb('0xf')]){_0x3eeb47[_0xe6cb('0x7')]+=0x1;}if(_0x3eeb47['UserId']){_0x3eeb47[_0xe6cb('0x8')]+=0x1;updateWaitingCounter(_0x3eeb47);}}_0x3eeb47[_0xe6cb('0xa')]+=0x1;return _0x3eeb47;}function getLastMessageText(_0x587a5c){return db[_0xe6cb('0x10')][_0xe6cb('0x11')]({'where':{'$and':[{'MailInteractionId':_0x587a5c['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xe6cb('0x12')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xe6cb('0x13'),'raw':!![]})[_0xe6cb('0x14')](function(_0x146e0f){if(_0x146e0f&&_0x146e0f[_0xe6cb('0x15')]){_0x587a5c[_0xe6cb('0x16')]=_[_0xe6cb('0x17')](_0x146e0f['plainBody']);}return _0x587a5c;})[_0xe6cb('0x18')](function(_0x5f51fd){throw _0x5f51fd;});}exports[_0xe6cb('0x19')]=function(_0x30f204,_0x4e001a,_0x25ddbd,_0x1bcf67){return new Promise(function(_0x47ca5d,_0x23d19a){return getInteractionUsers(_0x30f204['id'],_0x25ddbd)[_0xe6cb('0x14')](function(_0x248db5){_0x30f204[_0xe6cb('0x1a')]=_0x248db5;return getInteractionTags(_0x30f204[_0xe6cb('0x1b')],_0x4e001a);})['then'](function(_0x293744){_0x30f204[_0xe6cb('0x1c')]=_0x293744;delete _0x30f204['TagIds'];return updateInteractionCounters(_0x30f204);})[_0xe6cb('0x14')](function(_0x4fd5f9){if(_0x1bcf67){return getLastMessageText(_0x4fd5f9);}else{return _0x4fd5f9;}})[_0xe6cb('0x14')](function(_0x24ce63){_0x47ca5d(_0x24ce63);})[_0xe6cb('0x18')](function(_0x2df297){_0x23d19a(_0x2df297);});});}; \ No newline at end of file +var _0x64ed=['plainBody','lastMsgText','trimStart','catch','updateInteraction','then','Users','Tags','TagIds','lodash','map','fullname','split','forEach','push','waiting','answered','unmanaged','abandoned','total','closed','disposition','UserId','talking','MailMessage','findOne','out','-id'];(function(_0x41f0e1,_0x2f9a7d){var _0x33abc3=function(_0x5eacf1){while(--_0x5eacf1){_0x41f0e1['push'](_0x41f0e1['shift']());}};_0x33abc3(++_0x2f9a7d);}(_0x64ed,0x79));var _0xd64e=function(_0x5677ea,_0x517d5b){_0x5677ea=_0x5677ea-0x0;var _0x383b77=_0x64ed[_0x5677ea];return _0x383b77;};'use strict';var _=require(_0xd64e('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x37dda9,_0x2487b7){return new Promise(function(_0x89aecb,_0x479794){try{var _0x3911f3=[];if(_0x2487b7[_0x37dda9]){_0x3911f3=_0x2487b7[_0x37dda9][_0xd64e('0x1')](function(_0x34e9b8){return{'id':_0x34e9b8['id'],'fullname':_0x34e9b8[_0xd64e('0x2')]};});}return _0x89aecb(_0x3911f3);}catch(_0x56b81f){_0x479794(_0x56b81f);}});}function getInteractionTags(_0x453f38,_0x57fd47){var _0x40c587=[];if(_0x453f38){_0x453f38[_0xd64e('0x3')](',')[_0xd64e('0x4')](function(_0x179d92){_0x40c587[_0xd64e('0x5')](_0x57fd47[_0x179d92]);});}return _0x40c587;}function updateWaitingCounter(_0x4f3121){if(_0x4f3121[_0xd64e('0x6')]){_0x4f3121[_0xd64e('0x6')]-=0x1;}}function updateInteractionCounters(_0x391a5b){_0x391a5b[_0xd64e('0x6')]=0x0;_0x391a5b['talking']=0x0;_0x391a5b[_0xd64e('0x7')]=0x0;_0x391a5b[_0xd64e('0x8')]=0x0;_0x391a5b[_0xd64e('0x9')]=0x0;_0x391a5b[_0xd64e('0xa')]=0x0;if(_0x391a5b[_0xd64e('0xb')]){if(_0x391a5b[_0xd64e('0xc')]===_0xd64e('0x9')){_0x391a5b[_0xd64e('0x9')]+=0x1;updateWaitingCounter(_0x391a5b);}if(_0x391a5b[_0xd64e('0xd')]){_0x391a5b[_0xd64e('0x7')]+=0x1;if(_0x391a5b[_0xd64e('0xe')]){_0x391a5b[_0xd64e('0xe')]-=0x1;}}else{if(_0x391a5b[_0xd64e('0xc')]){_0x391a5b[_0xd64e('0x8')]+=0x1;updateWaitingCounter(_0x391a5b);}}}else{if(!_0x391a5b[_0xd64e('0xd')]){_0x391a5b[_0xd64e('0x6')]+=0x1;}if(_0x391a5b['UserId']){_0x391a5b[_0xd64e('0xe')]+=0x1;updateWaitingCounter(_0x391a5b);}}_0x391a5b['total']+=0x1;return _0x391a5b;}function getLastMessageText(_0x193b24){return db[_0xd64e('0xf')][_0xd64e('0x10')]({'where':{'$and':[{'MailInteractionId':_0x193b24['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xd64e('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xd64e('0x12'),'raw':!![]})['then'](function(_0x1010c0){if(_0x1010c0&&_0x1010c0[_0xd64e('0x13')]){_0x193b24[_0xd64e('0x14')]=_[_0xd64e('0x15')](_0x1010c0['plainBody']);}return _0x193b24;})[_0xd64e('0x16')](function(_0x417625){throw _0x417625;});}exports[_0xd64e('0x17')]=function(_0x1be69a,_0x2f4958,_0x1d31e3,_0x9034f){return new Promise(function(_0x225a5e,_0x1c4621){return getInteractionUsers(_0x1be69a['id'],_0x1d31e3)[_0xd64e('0x18')](function(_0x65c722){_0x1be69a[_0xd64e('0x19')]=_0x65c722;return getInteractionTags(_0x1be69a['TagIds'],_0x2f4958);})['then'](function(_0x231dac){_0x1be69a[_0xd64e('0x1a')]=_0x231dac;delete _0x1be69a[_0xd64e('0x1b')];return updateInteractionCounters(_0x1be69a);})[_0xd64e('0x18')](function(_0x106f91){if(_0x9034f){return getLastMessageText(_0x106f91);}else{return _0x106f91;}})['then'](function(_0x2f10ca){_0x225a5e(_0x2f10ca);})[_0xd64e('0x16')](function(_0x5c3ba2){_0x1c4621(_0x5c3ba2);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index cb78331..c8135e5 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93bf=['catch','error','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','chat-interactions','whatsapp-interactions','capitalize','InteractionId','upperFirst','unknown','chat','websites','accounts','_interaction_has_tags','_messages','_interactions','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','info'];(function(_0x5b9aa3,_0x44ce72){var _0x30a81b=function(_0x59ac55){while(--_0x59ac55){_0x5b9aa3['push'](_0x5b9aa3['shift']());}};_0x30a81b(++_0x44ce72);}(_0x93bf,0x82));var _0xf93b=function(_0x510540,_0x27b7a6){_0x510540=_0x510540-0x0;var _0x5767d2=_0x93bf[_0x510540];return _0x5767d2;};'use strict';var _=require(_0xf93b('0x0'));var db=require(_0xf93b('0x1'))['db'];var loggers={'openchannel':require(_0xf93b('0x2'))(_0xf93b('0x3')),'mail':require('../../config/logger')(_0xf93b('0x4')),'fax':require('../../config/logger')(_0xf93b('0x5')),'sms':require(_0xf93b('0x2'))('sms-interactions'),'chat':require(_0xf93b('0x2'))(_0xf93b('0x6')),'whatsapp':require(_0xf93b('0x2'))(_0xf93b('0x7'))};function getAccountFK(_0x1d255e){return _[_0xf93b('0x8')](_0x1d255e)+(_0x1d255e==='chat'?'Website':'Account')+'Id';}function getInteractionFK(_0x25022d){return _[_0xf93b('0x8')](_0x25022d)+_0xf93b('0x9');}function getInteractionId(_0x3df832,_0xee019e,_0x3e5cc4){if(_0x3df832&&_0x3df832[_[_0xf93b('0xa')](_0x3e5cc4)+_0xf93b('0x9')]){return _0x3df832[_[_0xf93b('0xa')](_0x3e5cc4)+_0xf93b('0x9')];}else if(_0x3df832&&_0x3df832['id']){return _0x3df832['id'];}else if(_0xee019e&&_0xee019e['id']){return _0xee019e['id'];}else{return _0xf93b('0xb');}}function getInteractionsTables(_0x128bce){return{'accounts':_0x128bce+'_'+(_0x128bce===_0xf93b('0xc')?_0xf93b('0xd'):_0xf93b('0xe')),'interactions':_0x128bce+'_interactions','interactionsTags':_0x128bce+_0xf93b('0xf'),'messages':_0x128bce+_0xf93b('0x10'),'userInteractions':'user_has_'+_0x128bce+_0xf93b('0x11')};}function getSelectedTags(_0x338713){var _0x368893=[];if(_0x338713){_0x368893=Array[_0xf93b('0x12')](_0x338713)?_0x338713:[_0x338713];}return _0x368893;}function log(_0x31a88c,_0x438bd2,_0x4e0ea5,_0x4a8933,_0x15b320,_0x5c168d){loggers[_0x15b320[_0xf93b('0x13')]()][_0x31a88c](_0xf93b('0x14'),_0x5c168d[_0xf93b('0x15')](),_0x438bd2?_0x438bd2['id']:null,_0x438bd2?_0x438bd2[_0xf93b('0x16')]:null,_0x438bd2?_0x438bd2[_0xf93b('0x17')]:null,getInteractionId(_0x4e0ea5,_0x4a8933,_0x15b320),_0x4e0ea5?JSON[_0xf93b('0x18')](_0x4e0ea5):_0xf93b('0x19'));}function updateUser(_0xab37cc,_0x45252b,_0x20df2a,_0x32a2f7,_0x213c54){db[_[_0xf93b('0xa')](_0x32a2f7)+_0xf93b('0x1a')][_0xf93b('0x1b')]({'where':{'id':getInteractionId(_0x45252b,_0x20df2a,_0x32a2f7)}})[_0xf93b('0x1c')](function(_0x1701c6){if(_0x1701c6){return _0x1701c6['update']({'UserId':_0xab37cc?_0xab37cc['id']:null});}})[_0xf93b('0x1c')](function(_0x3cf8cc){if(_0x3cf8cc){log(_0xf93b('0x1d'),_0xab37cc,_0x45252b,_0x20df2a,_0x32a2f7,_0x213c54);}})[_0xf93b('0x1e')](function(){log(_0xf93b('0x1f'),_0xab37cc,_0x45252b,_0x20df2a,_0x32a2f7,_0x213c54);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x117f=['exports','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','_interactions','_interaction_has_tags','_messages','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','null','Interaction','findOne','then','update','catch'];(function(_0x29102c,_0x21fb14){var _0x231218=function(_0x52780f){while(--_0x52780f){_0x29102c['push'](_0x29102c['shift']());}};_0x231218(++_0x21fb14);}(_0x117f,0xf4));var _0xf117=function(_0x5462d1,_0x503350){_0x5462d1=_0x5462d1-0x0;var _0xe870f6=_0x117f[_0x5462d1];return _0xe870f6;};'use strict';var _=require('lodash');var db=require(_0xf117('0x0'))['db'];var loggers={'openchannel':require(_0xf117('0x1'))(_0xf117('0x2')),'mail':require(_0xf117('0x1'))('mail-interactions'),'fax':require(_0xf117('0x1'))(_0xf117('0x3')),'sms':require(_0xf117('0x1'))('sms-interactions'),'chat':require('../../config/logger')(_0xf117('0x4')),'whatsapp':require(_0xf117('0x1'))(_0xf117('0x5'))};function getAccountFK(_0x4a1798){return _[_0xf117('0x6')](_0x4a1798)+(_0x4a1798===_0xf117('0x7')?_0xf117('0x8'):_0xf117('0x9'))+'Id';}function getInteractionFK(_0x37daad){return _['capitalize'](_0x37daad)+_0xf117('0xa');}function getInteractionId(_0x3f8056,_0x511a0b,_0x2a37d6){if(_0x3f8056&&_0x3f8056[_[_0xf117('0xb')](_0x2a37d6)+_0xf117('0xa')]){return _0x3f8056[_[_0xf117('0xb')](_0x2a37d6)+_0xf117('0xa')];}else if(_0x3f8056&&_0x3f8056['id']){return _0x3f8056['id'];}else if(_0x511a0b&&_0x511a0b['id']){return _0x511a0b['id'];}else{return _0xf117('0xc');}}function getInteractionsTables(_0x24d6df){return{'accounts':_0x24d6df+'_'+(_0x24d6df===_0xf117('0x7')?'websites':'accounts'),'interactions':_0x24d6df+_0xf117('0xd'),'interactionsTags':_0x24d6df+_0xf117('0xe'),'messages':_0x24d6df+_0xf117('0xf'),'userInteractions':'user_has_'+_0x24d6df+_0xf117('0xd')};}function getSelectedTags(_0x52b425){var _0x5f43cb=[];if(_0x52b425){_0x5f43cb=Array['isArray'](_0x52b425)?_0x52b425:[_0x52b425];}return _0x5f43cb;}function log(_0x5a318d,_0x3c2638,_0x1c5d7c,_0xd1896d,_0x37807b,_0x2a6ea6){loggers[_0x37807b['toLowerCase']()][_0x5a318d](_0xf117('0x10'),_0x2a6ea6[_0xf117('0x11')](),_0x3c2638?_0x3c2638['id']:null,_0x3c2638?_0x3c2638['name']:null,_0x3c2638?_0x3c2638[_0xf117('0x12')]:null,getInteractionId(_0x1c5d7c,_0xd1896d,_0x37807b),_0x1c5d7c?JSON[_0xf117('0x13')](_0x1c5d7c):_0xf117('0x14'));}function updateUser(_0x20ca8e,_0x5b4a50,_0x516bd6,_0x465c31,_0x1995b6){db[_[_0xf117('0xb')](_0x465c31)+_0xf117('0x15')][_0xf117('0x16')]({'where':{'id':getInteractionId(_0x5b4a50,_0x516bd6,_0x465c31)}})[_0xf117('0x17')](function(_0x3ccf69){if(_0x3ccf69){return _0x3ccf69[_0xf117('0x18')]({'UserId':_0x20ca8e?_0x20ca8e['id']:null});}})[_0xf117('0x17')](function(_0x23f473){if(_0x23f473){log('info',_0x20ca8e,_0x5b4a50,_0x516bd6,_0x465c31,_0x1995b6);}})[_0xf117('0x19')](function(){log('error',_0x20ca8e,_0x5b4a50,_0x516bd6,_0x465c31,_0x1995b6);});}module[_0xf117('0x1a')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 24a52d2..009fe15 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x927e=['split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','then','count','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','isUserLimit','crypto','util','../../config/environment','data1','license'];(function(_0x38e61c,_0x5680cd){var _0x6234d1=function(_0x22690c){while(--_0x22690c){_0x38e61c['push'](_0x38e61c['shift']());}};_0x6234d1(++_0x5680cd);}(_0x927e,0x1ab));var _0xe927=function(_0x18c937,_0x32d230){_0x18c937=_0x18c937-0x0;var _0xc920b3=_0x927e[_0x18c937];return _0xc920b3;};'use strict';var crypto=require(_0xe927('0x0'));var util=require(_0xe927('0x1'));var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0xe927('0x2'));function getValueFromLicense(_0xd63046,_0x2746af){if(_0xd63046&&_0x2746af){if(_0x2746af[_0xe927('0x3')]&&_0x2746af[_0xe927('0x4')]){var _0x3c67e6=_0x2746af[_0xe927('0x3')];var _0xdb9e23=_0x2746af[_0xe927('0x4')];var _0x2719a6=_0x3c67e6[_0xe927('0x5')]('-')[0x4];var _0x26e1ee=_0x3c67e6[_0xe927('0x5')]('-')[0x0];var _0x2d6257=crypto['createDecipher'](_0xe927('0x6'),util[_0xe927('0x7')](_0xe927('0x8'),_0x2719a6,_0x3c67e6,_0x26e1ee));var _0x2f0906=_0x2d6257[_0xe927('0x9')](_0xdb9e23,_0xe927('0xa'),_0xe927('0xb'));_0x2f0906+=_0x2d6257[_0xe927('0xc')]('utf8');var _0x59a56f=JSON[_0xe927('0xd')](_0x2f0906);return _0x59a56f[_0xe927('0xe')](_0xd63046)?_0x59a56f[_0xd63046]:null;}}return null;}function isLimit(_0x4cbdc0,_0x2cc065,_0x39d604,_0x5977f0){var _0x265f11=_0x2cc065;return compose()[_0xe927('0xf')](function(_0x1edcfd,_0x306166,_0x4caac1){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x2bb92a){var _0x56d9d7=getValueFromLicense(_0x4cbdc0,_0x2bb92a);return _0x56d9d7?_0x56d9d7:_0x265f11;})[_0xe927('0x10')](function(_0x194ebc){_0x265f11=_0x194ebc;return _0x39d604[_0xe927('0x11')](_0x5977f0);})['then'](function(_0x3ebd63){if(_0x3ebd63>=_0x265f11){return _0x306166['status'](0x193)['json']({'message':util[_0xe927('0x7')](_0xe927('0x12'),_0x4cbdc0)});}_0x4caac1();})[_0xe927('0x13')](function(_0x1fe271){_0x4caac1(_0x1fe271);});});}function isUserLimit(){return isLimit(_0xe927('0x14'),0x1,db['User'],{'where':{'$or':[{'role':_0xe927('0x15')},{'role':_0xe927('0x16')}]}});}exports[_0xe927('0x17')]=isUserLimit; \ No newline at end of file +var _0xd6ce=['isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','update','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user'];(function(_0x122e4e,_0x113549){var _0x27c1c5=function(_0x50a312){while(--_0x50a312){_0x122e4e['push'](_0x122e4e['shift']());}};_0x27c1c5(++_0x113549);}(_0xd6ce,0x187));var _0xed6c=function(_0x5698b5,_0x5e0784){_0x5698b5=_0x5698b5-0x0;var _0x49ba3b=_0xd6ce[_0x5698b5];return _0x49ba3b;};'use strict';var crypto=require(_0xed6c('0x0'));var util=require(_0xed6c('0x1'));var compose=require(_0xed6c('0x2'));var db=require(_0xed6c('0x3'))['db'];var config=require(_0xed6c('0x4'));function getValueFromLicense(_0x5033dd,_0x363930){if(_0x5033dd&&_0x363930){if(_0x363930[_0xed6c('0x5')]&&_0x363930[_0xed6c('0x6')]){var _0x3a37a6=_0x363930[_0xed6c('0x5')];var _0x271e57=_0x363930[_0xed6c('0x6')];var _0x29b874=_0x3a37a6[_0xed6c('0x7')]('-')[0x4];var _0x2c5939=_0x3a37a6[_0xed6c('0x7')]('-')[0x0];var _0x5bffd9=crypto[_0xed6c('0x8')](_0xed6c('0x9'),util[_0xed6c('0xa')]('%s:%s:%s',_0x29b874,_0x3a37a6,_0x2c5939));var _0x963c3f=_0x5bffd9[_0xed6c('0xb')](_0x271e57,'base64',_0xed6c('0xc'));_0x963c3f+=_0x5bffd9[_0xed6c('0xd')](_0xed6c('0xc'));var _0x2d30d2=JSON[_0xed6c('0xe')](_0x963c3f);return _0x2d30d2[_0xed6c('0xf')](_0x5033dd)?_0x2d30d2[_0x5033dd]:null;}}return null;}function isLimit(_0x1963ad,_0x489e51,_0x2bb806,_0x1b6800){var _0x17d13b=_0x489e51;return compose()[_0xed6c('0x10')](function(_0x59340a,_0x59713e,_0x3f3b26){return db[_0xed6c('0x11')][_0xed6c('0x12')]({'where':{'id':0x1},'raw':!![]})[_0xed6c('0x13')](function(_0x38dce2){var _0x47c3ce=getValueFromLicense(_0x1963ad,_0x38dce2);return _0x47c3ce?_0x47c3ce:_0x17d13b;})['then'](function(_0x3e6f22){_0x17d13b=_0x3e6f22;return _0x2bb806[_0xed6c('0x14')](_0x1b6800);})[_0xed6c('0x13')](function(_0x15720d){if(_0x15720d>=_0x17d13b){return _0x59713e[_0xed6c('0x15')](0x193)[_0xed6c('0x16')]({'message':util[_0xed6c('0xa')](_0xed6c('0x17'),_0x1963ad)});}_0x3f3b26();})[_0xed6c('0x18')](function(_0x3042b0){_0x3f3b26(_0x3042b0);});});}function isUserLimit(){return isLimit(_0xed6c('0x19'),0x1,db[_0xed6c('0x1a')],{'where':{'$or':[{'role':_0xed6c('0x1b')},{'role':_0xed6c('0x1c')}]}});}exports[_0xed6c('0x1d')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 0eb3fdc..ed8ebba 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 _0x2da4=['$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','$between','BETWEEN\x20?\x20AND\x20?','$substring','start','utcOffset','hours','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','[$and]','replace','split','length','slice','forEach','shift','match','filter','indexOf','conditions','push','buildExpression','DATE','operator','$eq','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?'];(function(_0x5a569f,_0x53894c){var _0x412b92=function(_0x5920e7){while(--_0x5920e7){_0x5a569f['push'](_0x5a569f['shift']());}};_0x412b92(++_0x53894c);}(_0x2da4,0xc0));var _0x42da=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2da4[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x42da('0x0'));var moment=require(_0x42da('0x1'));exports[_0x42da('0x2')]=function(_0x550326){var _0x5290e9={'conditions':[]};_0x5290e9[_0x42da('0x3')]=_[_0x42da('0x4')](_0x550326,_0x42da('0x5'))?'or':'and';var _0x3b651b=_0x550326['replace'](_0x42da('0x6'),'')[_0x42da('0x7')](_0x42da('0x5'),'')[_0x42da('0x8')]('||');for(var _0x4fdce3=0x0;_0x4fdce3<_0x3b651b[_0x42da('0x9')];_0x4fdce3++){var _0x52ec94=_0x3b651b[_0x4fdce3]['split'](':=');var _0x2c0773=_0x52ec94[0x0];var _0x321202=_0x52ec94[_0x42da('0xa')](0x1);_0x321202[_0x42da('0xb')](function(_0x3e9fd1){var _0x114add=_0x3e9fd1[_0x42da('0x8')]('[')[_0x42da('0xc')]();var _0x181fad=_0x3e9fd1[_0x42da('0xd')](/\[(.*?)\]/g);_0x181fad[_0x42da('0xb')](function(_0x564a34){var _0x82ef93=_0x564a34[_0x42da('0x8')]('[')[_0x42da('0xe')](function(_0xae3dd5){return _0xae3dd5[_0x42da('0xf')](']')>-0x1;})['map'](function(_0x378241){return _0x378241[_0x42da('0x8')](']')[0x0];})[0x0];_0x5290e9[_0x42da('0x10')][_0x42da('0x11')]({'field':_0x2c0773,'operator':_0x114add,'value':_0x82ef93});});});}return _0x5290e9;};exports[_0x42da('0x12')]=function(_0x4ef434,_0x1b0209,_0x47031b){var _0x47c52e={};if(_0x1b0209===_0x42da('0x13')){if(_0x47031b[_0x42da('0x14')]===_0x42da('0x15')){_0x47031b[_0x42da('0x14')]='$between';_0x47031b['value']+=','+_0x47031b[_0x42da('0x16')];}else if(_[_0x42da('0x17')]([_0x42da('0x18'),_0x42da('0x19')],_0x47031b[_0x42da('0x14')])){_0x47031b[_0x42da('0x16')]=moment(_0x47031b[_0x42da('0x16')])[_0x42da('0x1a')](0x1,_0x42da('0x1b'))[_0x42da('0x1c')](_0x42da('0x1d'));}}if(_0x47031b['castTo']){_0x1b0209=_0x47031b[_0x42da('0x1e')];_0x47c52e[_0x42da('0x1f')]=_0x42da('0x20')+_0x4ef434+'.'+_0x47031b[_0x42da('0x21')]+_0x42da('0x22')+_0x47031b[_0x42da('0x1e')]+')\x20'+parseOperator(_0x47031b[_0x42da('0x14')]);}else{_0x47c52e['text']=_0x4ef434+'.'+_0x47031b[_0x42da('0x21')]+'\x20'+parseOperator(_0x47031b[_0x42da('0x14')]);}if(_[_0x42da('0x17')]([_0x42da('0x23'),_0x42da('0x24')],_0x47031b[_0x42da('0x14')]))_0x47c52e['text']='('+_0x47c52e[_0x42da('0x1f')]+_0x42da('0x25')+_0x4ef434+'.'+_0x47031b['field']+_0x42da('0x26');_0x47c52e[_0x42da('0x16')]=parseValue(_0x1b0209,_0x47031b['operator'],_0x47031b[_0x42da('0x16')]);return _0x47c52e;};function parseOperator(_0x355244){var _0x5ee71f;switch(_0x355244){case _0x42da('0x27'):_0x5ee71f=_0x42da('0x28');break;case'$notIn':_0x5ee71f=_0x42da('0x29');break;case _0x42da('0x15'):_0x5ee71f=_0x42da('0x2a');break;case _0x42da('0x23'):_0x5ee71f=_0x42da('0x2b');break;case'$substring':case _0x42da('0x2c'):case _0x42da('0x2d'):_0x5ee71f=_0x42da('0x2e');break;case _0x42da('0x2f'):_0x5ee71f=_0x42da('0x30');break;case'$gt':_0x5ee71f=_0x42da('0x31');break;case'$lte':_0x5ee71f=_0x42da('0x32');break;case _0x42da('0x33'):_0x5ee71f='>=\x20?';break;case _0x42da('0x34'):_0x5ee71f=_0x42da('0x35');break;}return _0x5ee71f;}function parseValue(_0xe803f,_0x16552f,_0x3c2d4b){var _0x1cacae={'start':undefined,'end':undefined};switch(_0x16552f){case'$in':case _0x42da('0x24'):_0x1cacae['start']=_0x3c2d4b[_0x42da('0x8')](',');break;case _0x42da('0x36'):_0x1cacae[_0x42da('0x37')]='%'+_0x3c2d4b+'%';break;case _0x42da('0x2c'):_0x1cacae['start']=_0x3c2d4b+'%';break;case _0x42da('0x2d'):_0x1cacae[_0x42da('0x37')]='%'+_0x3c2d4b;break;case _0x42da('0x34'):var _0x77bfaf=_0x3c2d4b[_0x42da('0x8')](',');var _0x3c2d4b=_0x77bfaf[_0x42da('0xc')]();var _0x1d8684=_0x77bfaf['pop']();if(_0xe803f===_0x42da('0x13')){_0x3c2d4b=moment(_0x3c2d4b)['utcOffset'](0x0,!![])['format']();_0x1d8684=moment(_0x1d8684)[_0x42da('0x38')](0x0,!![])[_0x42da('0x1a')](0x17,_0x42da('0x39'))[_0x42da('0x1a')](0x3b,'minutes')[_0x42da('0x1a')](0x3b,_0x42da('0x3a'))[_0x42da('0x1c')]();}_0x1cacae={'start':_0x3c2d4b,'end':_0x1d8684};break;default:_0x1cacae[_0x42da('0x37')]=_0x3c2d4b;break;}return _0x1cacae;} \ No newline at end of file +var _0x6ea3=['seconds','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','split','length','slice','forEach','shift','match','filter','indexOf','map','conditions','push','buildExpression','operator','$eq','$between','value','includes','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20OR\x20','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','$lte','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$endsWith','start','pop','DATE','utcOffset'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x6ea3,0xaf));var _0x36ea=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x6ea3[_0x5a95fa];return _0x1a61b8;};'use strict';var _=require(_0x36ea('0x0'));var moment=require(_0x36ea('0x1'));exports['parseSearch']=function(_0x1629e0){var _0x1ffc22={'conditions':[]};_0x1ffc22[_0x36ea('0x2')]=_[_0x36ea('0x3')](_0x1629e0,_0x36ea('0x4'))?'or':_0x36ea('0x5');var _0x4a67ad=_0x1629e0['replace']('[$and]','')[_0x36ea('0x6')](_0x36ea('0x4'),'')[_0x36ea('0x7')]('||');for(var _0x43038d=0x0;_0x43038d<_0x4a67ad[_0x36ea('0x8')];_0x43038d++){var _0x4015f9=_0x4a67ad[_0x43038d]['split'](':=');var _0x2fc14c=_0x4015f9[0x0];var _0x13c378=_0x4015f9[_0x36ea('0x9')](0x1);_0x13c378[_0x36ea('0xa')](function(_0x48b6b2){var _0x51f593=_0x48b6b2[_0x36ea('0x7')]('[')[_0x36ea('0xb')]();var _0x327db1=_0x48b6b2[_0x36ea('0xc')](/\[(.*?)\]/g);_0x327db1[_0x36ea('0xa')](function(_0x5e9da3){var _0xb42ca=_0x5e9da3[_0x36ea('0x7')]('[')[_0x36ea('0xd')](function(_0x6ba413){return _0x6ba413[_0x36ea('0xe')](']')>-0x1;})[_0x36ea('0xf')](function(_0x57c156){return _0x57c156[_0x36ea('0x7')](']')[0x0];})[0x0];_0x1ffc22[_0x36ea('0x10')][_0x36ea('0x11')]({'field':_0x2fc14c,'operator':_0x51f593,'value':_0xb42ca});});});}return _0x1ffc22;};exports[_0x36ea('0x12')]=function(_0x2ce2e7,_0xef705a,_0x4927cb){var _0x4632b5={};if(_0xef705a==='DATE'){if(_0x4927cb[_0x36ea('0x13')]===_0x36ea('0x14')){_0x4927cb[_0x36ea('0x13')]=_0x36ea('0x15');_0x4927cb[_0x36ea('0x16')]+=','+_0x4927cb[_0x36ea('0x16')];}else if(_[_0x36ea('0x17')](['$gt','$lte'],_0x4927cb[_0x36ea('0x13')])){_0x4927cb[_0x36ea('0x16')]=moment(_0x4927cb[_0x36ea('0x16')])[_0x36ea('0x18')](0x1,_0x36ea('0x19'))[_0x36ea('0x1a')](_0x36ea('0x1b'));}}if(_0x4927cb[_0x36ea('0x1c')]){_0xef705a=_0x4927cb[_0x36ea('0x1c')];_0x4632b5[_0x36ea('0x1d')]=_0x36ea('0x1e')+_0x2ce2e7+'.'+_0x4927cb[_0x36ea('0x1f')]+_0x36ea('0x20')+_0x4927cb[_0x36ea('0x1c')]+')\x20'+parseOperator(_0x4927cb['operator']);}else{_0x4632b5[_0x36ea('0x1d')]=_0x2ce2e7+'.'+_0x4927cb['field']+'\x20'+parseOperator(_0x4927cb[_0x36ea('0x13')]);}if(_[_0x36ea('0x17')]([_0x36ea('0x21'),'$notIn'],_0x4927cb[_0x36ea('0x13')]))_0x4632b5['text']='('+_0x4632b5[_0x36ea('0x1d')]+_0x36ea('0x22')+_0x2ce2e7+'.'+_0x4927cb[_0x36ea('0x1f')]+'\x20IS\x20NULL)';_0x4632b5['value']=parseValue(_0xef705a,_0x4927cb[_0x36ea('0x13')],_0x4927cb['value']);return _0x4632b5;};function parseOperator(_0x2f3594){var _0x5b58e8;switch(_0x2f3594){case _0x36ea('0x23'):_0x5b58e8=_0x36ea('0x24');break;case _0x36ea('0x25'):_0x5b58e8=_0x36ea('0x26');break;case _0x36ea('0x14'):_0x5b58e8=_0x36ea('0x27');break;case _0x36ea('0x21'):_0x5b58e8=_0x36ea('0x28');break;case _0x36ea('0x29'):case _0x36ea('0x2a'):case'$endsWith':_0x5b58e8=_0x36ea('0x2b');break;case _0x36ea('0x2c'):_0x5b58e8=_0x36ea('0x2d');break;case _0x36ea('0x2e'):_0x5b58e8=_0x36ea('0x2f');break;case _0x36ea('0x30'):_0x5b58e8='<=\x20?';break;case _0x36ea('0x31'):_0x5b58e8=_0x36ea('0x32');break;case _0x36ea('0x15'):_0x5b58e8=_0x36ea('0x33');break;}return _0x5b58e8;}function parseValue(_0x12bfb0,_0x3f5269,_0x12d1b2){var _0x448079={'start':undefined,'end':undefined};switch(_0x3f5269){case _0x36ea('0x23'):case'$notIn':_0x448079['start']=_0x12d1b2['split'](',');break;case _0x36ea('0x29'):_0x448079['start']='%'+_0x12d1b2+'%';break;case _0x36ea('0x2a'):_0x448079['start']=_0x12d1b2+'%';break;case _0x36ea('0x34'):_0x448079[_0x36ea('0x35')]='%'+_0x12d1b2;break;case _0x36ea('0x15'):var _0x1d1549=_0x12d1b2['split'](',');var _0x12d1b2=_0x1d1549[_0x36ea('0xb')]();var _0x56002e=_0x1d1549[_0x36ea('0x36')]();if(_0x12bfb0===_0x36ea('0x37')){_0x12d1b2=moment(_0x12d1b2)[_0x36ea('0x38')](0x0,!![])[_0x36ea('0x1a')]();_0x56002e=moment(_0x56002e)[_0x36ea('0x38')](0x0,!![])['add'](0x17,'hours')[_0x36ea('0x18')](0x3b,'minutes')[_0x36ea('0x18')](0x3b,_0x36ea('0x39'))[_0x36ea('0x1a')]();}_0x448079={'start':_0x12d1b2,'end':_0x56002e};break;default:_0x448079[_0x36ea('0x35')]=_0x12d1b2;break;}return _0x448079;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 44d08ec..05f6b85 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 _0x430c=['where','pick','filter','object','name','value','merge','type','VIRTUAL','lower','options','lodash','parse','keys','fields','split','filters','isEmpty','forOwn','find','DATE','isPlainObject','$gte','format','$lte','YYYY-MM-DD','utc','isArray','sort','map','priority','unsigned','substr','col','ASC','omit','length','isString','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','getFullTextValue','\x22{EXPR}\x22','{EXPR}','replace','match','join','getOptions','$id','query','intersection','model','attributes','nolimit','limit','offset','order'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x430c,0x1a1));var _0xc430=function(_0x2e655a,_0x6d5799){_0x2e655a=_0x2e655a-0x0;var _0x26f13b=_0x430c[_0x2e655a];return _0x26f13b;};'use strict';var _=require(_0xc430('0x0'));var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x426596){var _0xe2d084=['ne'];try{var _0x1d5b5e=JSON['parse'](_0x426596);var _0x4f0118=Object['keys'](_0x1d5b5e)[0x0];return _0xe2d084['includes'](_0x4f0118);}catch(_0x338a82){return![];}}function getOperatorValue(_0x2408f5){var _0x50b256=JSON[_0xc430('0x1')](_0x2408f5);var _0x4de44f=Object[_0xc430('0x2')](_0x50b256)[0x0];var _0x2e51c6=_0x50b256[_0x4de44f];return{['$'+_0x4de44f]:_0x2e51c6};}exports[_0xc430('0x3')]=function(_0x13ae66){var _0x2e23f8=null;if(_0x13ae66){_0x2e23f8=_0x13ae66[_0xc430('0x4')](',');}return _0x2e23f8;};exports[_0xc430('0x5')]=function(_0x115814,_0x24737a){var _0x5bbdf9={};if(!_[_0xc430('0x6')](_0x115814)){_[_0xc430('0x7')](_0x115814,function(_0x56c090,_0x39e624){try{if(_0x24737a){var _0x5aeed9=_[_0xc430('0x8')](_0x24737a,{'name':_0x39e624})||{};if(hasSequelizeOperator(_0x56c090)){_0x5bbdf9[_0x39e624]=getOperatorValue(_0x56c090);}else if(_0x5aeed9['type']===_0xc430('0x9')&&_[_0xc430('0xa')](_0x56c090)){var _0xc5f92=JSON[_0xc430('0x1')](_0x56c090);var _0x2cdef9={'$gte':moment(moment(_0xc5f92[_0xc430('0xb')])[_0xc430('0xc')]('YYYY-MM-DD'))['utc']()[_0xc430('0xc')](),'$lte':moment(moment(_0xc5f92[_0xc430('0xd')])[_0xc430('0xc')](_0xc430('0xe')))[_0xc430('0xf')]()['subtract'](0x1,'s')[_0xc430('0xc')]()};_0x5bbdf9[_0x39e624]=_0x2cdef9;}else if(_0x5aeed9['name']==='uniqueid'){_0x5bbdf9[_0x39e624]=_0x56c090;}else{_0x5bbdf9[_0x39e624]=_[_0xc430('0x10')](_0x56c090)?_0x56c090:JSON[_0xc430('0x1')](_0x56c090);}}else{_0x5bbdf9[_0x39e624]=_[_0xc430('0x10')](_0x56c090)?_0x56c090:JSON['parse'](_0x56c090);}}catch(_0x5d3acc){_0x5bbdf9[_0x39e624]=_0x56c090[_0xc430('0x4')](',');}});}return _0x5bbdf9;};exports['limit']=function(_0x2bcb21){_0x2bcb21=parseInt(_0x2bcb21,0xa);if(!_0x2bcb21||_0x2bcb21<0x0){_0x2bcb21=LIMIT_VALUE;}return _0x2bcb21;};exports['offset']=function(_0x564522){_0x564522=parseInt(_0x564522,0xa);if(!_0x564522||_0x564522<0x0){_0x564522=0x0;}return _0x564522;};exports[_0xc430('0x11')]=function(_0x59b68f){var _0x302926,_0x1eae3b=null;if(_0x59b68f){_0x302926=_0x59b68f[_0xc430('0x4')](',');_0x1eae3b=_[_0xc430('0x12')](_0x302926,function(_0x2a1ea1){if(_0x2a1ea1['indexOf']('-')===0x0){return[_0x2a1ea1===_0xc430('0x13')?sequelize['cast'](sequelize['col'](_0xc430('0x13')),_0xc430('0x14')):_0x2a1ea1[_0xc430('0x15')](0x1),'DESC'];}else{return[_0x2a1ea1===_0xc430('0x13')?sequelize['cast'](sequelize[_0xc430('0x16')](_0xc430('0x13')),'unsigned'):_0x2a1ea1,_0xc430('0x17')];}});}return _0x1eae3b;};exports[_0xc430('0x18')]=function(_0x48f67a,_0x2f9af4){if(_['isEmpty'](_0x48f67a)){return _0x48f67a;}if(_[_0xc430('0x10')](_0x48f67a)){for(var _0x4b5280=0x0;_0x4b5280<_0x48f67a[_0xc430('0x19')];_0x4b5280+=0x1){_0x48f67a[_0x4b5280]=this[_0xc430('0x18')](_0x48f67a[_0x4b5280],_0x2f9af4);}return _0x48f67a;}if(!_['isObject'](_0x48f67a)){return _0x48f67a;}if(_[_0xc430('0x1a')](_0x2f9af4)){_0x2f9af4=[_0x2f9af4];}if(!_[_0xc430('0x10')](_0x2f9af4)){return _0x48f67a;}for(var _0x2c0422=0x0;_0x2c0422<_0x2f9af4[_0xc430('0x19')];_0x2c0422+=0x1){_[_0xc430('0x1b')](_0x48f67a,_0x2f9af4[_0x2c0422]);}for(var _0x57cd72 in _0x48f67a){if(_0x48f67a[_0xc430('0x1c')](_0x57cd72)){_0x48f67a[_0x57cd72]=this[_0xc430('0x18')](_0x48f67a[_0x57cd72],_0x2f9af4);}}return _0x48f67a;};exports[_0xc430('0x1d')]=function(_0x1591e3){return _0x1591e3['match'](RegExp(_0xc430('0x1e')))?!![]:![];};exports['isEmail']=function(_0x1d65ee){return _0x1d65ee['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xc430('0x1f')]=function(_0x1045c0,_0xfc8767){var _0x3d7ccf=[];var _0x49977b=/[ `!@#$%^&*()_\-?~]/;var _0x17c975=_0xfc8767?_0xc430('0x20'):_0xc430('0x21');_0x1045c0[_0xc430('0x4')](/[ ,]+/)['forEach'](function(_0xfcc12c){_0xfcc12c=_0xfcc12c[_0xc430('0x22')](/([^:]")"+/g,'$1');_0xfcc12c='+'+_0xfcc12c+'*';var _0x47fe5a=_0xfcc12c[_0xc430('0x23')](_0x49977b);if(_0x47fe5a){_0xfcc12c='\x22'+_0xfcc12c+'\x22';}_0x3d7ccf['push'](_0xfcc12c);});_0x17c975=_0x17c975['replace'](_0xc430('0x21'),_0x3d7ccf[_0xc430('0x24')]('\x20'));return _0x17c975;};exports[_0xc430('0x25')]=function(_0x476c12,_0x2f44bb,_0x63878e){var _0x438879={},_0x25a81d={};if(_0x2f44bb['query'][_0xc430('0x26')]){_0x2f44bb['query']['id']=_0x2f44bb[_0xc430('0x27')][_0xc430('0x26')];delete _0x2f44bb[_0xc430('0x27')][_0xc430('0x26')];}_0x438879['model']=_[_0xc430('0x12')](_0x476c12,'name');_0x438879['query']=_[_0xc430('0x2')](_0x2f44bb[_0xc430('0x27')]);_0x438879['filters']=_[_0xc430('0x28')](_0x438879[_0xc430('0x29')],_0x438879[_0xc430('0x27')]);_0x25a81d[_0xc430('0x2a')]=_[_0xc430('0x28')](_0x438879[_0xc430('0x29')],this[_0xc430('0x3')](_0x2f44bb[_0xc430('0x27')][_0xc430('0x3')]));_0x25a81d[_0xc430('0x2a')]=_0x25a81d[_0xc430('0x2a')][_0xc430('0x19')]?_0x25a81d[_0xc430('0x2a')]:_0x438879[_0xc430('0x29')];if(!_0x2f44bb[_0xc430('0x27')]['hasOwnProperty'](_0xc430('0x2b'))){_0x25a81d[_0xc430('0x2c')]=this[_0xc430('0x2c')](_0x2f44bb[_0xc430('0x27')]['limit']);_0x25a81d[_0xc430('0x2d')]=this[_0xc430('0x2d')](_0x2f44bb[_0xc430('0x27')][_0xc430('0x2d')]);}_0x25a81d[_0xc430('0x2e')]=this[_0xc430('0x11')](_0x2f44bb['query'][_0xc430('0x11')]);_0x25a81d[_0xc430('0x2f')]=this[_0xc430('0x5')](_[_0xc430('0x30')](_0x2f44bb[_0xc430('0x27')],_0x438879[_0xc430('0x5')]),_0x476c12);if(_0x2f44bb[_0xc430('0x27')][_0xc430('0x31')]){var _0x469a0c=_0x476c12;var _0x4174d2=_0x2f44bb[_0xc430('0x27')][_0xc430('0x31')];if(typeof _0x4174d2===_0xc430('0x32')){_0x469a0c=_[_0xc430('0x31')](_0x476c12,function(_0x5a9c4b){return _['includes'](_0x4174d2['columns'],_0x5a9c4b[_0xc430('0x33')]);});_0x4174d2=_0x4174d2[_0xc430('0x34')];}_0x25a81d[_0xc430('0x2f')]=_[_0xc430('0x35')](_0x25a81d[_0xc430('0x2f')],{'$or':_[_0xc430('0x12')](_0x469a0c,function(_0x26cc86){if(_0x26cc86[_0xc430('0x36')]!==_0xc430('0x37')){if(_0x63878e){return sequelize[_0xc430('0x2f')](sequelize['fn'](_0xc430('0x38'),sequelize[_0xc430('0x16')](_0x26cc86[_0xc430('0x33')])),{'$like':sequelize['fn'](_0xc430('0x38'),'%'+_0x2f44bb[_0xc430('0x27')][_0xc430('0x31')]+'%')});}else{var _0x5ed841={};_0x5ed841[_0x26cc86[_0xc430('0x33')]]={'$like':'%'+_0x2f44bb[_0xc430('0x27')][_0xc430('0x31')]+'%'};return _0x5ed841;}}})});}_0x25a81d=_[_0xc430('0x35')]({},_0x25a81d,_0x2f44bb[_0xc430('0x39')]);return _0x25a81d;}; \ No newline at end of file +var _0x2e87=['substr','DESC','col','unsigned','ASC','omit','length','isObject','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','join','getOptions','$id','query','intersection','model','attributes','nolimit','order','where','pick','filters','filter','object','columns','merge','VIRTUAL','lower','options','lodash','moment','keys','includes','parse','fields','split','isEmpty','forOwn','find','type','isPlainObject','$gte','format','YYYY-MM-DD','$lte','utc','name','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','cast'];(function(_0x1c648d,_0x24aef4){var _0x326fd4=function(_0x248200){while(--_0x248200){_0x1c648d['push'](_0x1c648d['shift']());}};_0x326fd4(++_0x24aef4);}(_0x2e87,0x171));var _0x72e8=function(_0x2bd88d,_0x2d5dc3){_0x2bd88d=_0x2bd88d-0x0;var _0x5516d4=_0x2e87[_0x2bd88d];return _0x5516d4;};'use strict';var _=require(_0x72e8('0x0'));var sequelize=require('sequelize');var moment=require(_0x72e8('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2f4f7d){var _0xbb02d7=['ne'];try{var _0x422404=JSON['parse'](_0x2f4f7d);var _0x4df870=Object[_0x72e8('0x2')](_0x422404)[0x0];return _0xbb02d7[_0x72e8('0x3')](_0x4df870);}catch(_0x4ce1ba){return![];}}function getOperatorValue(_0xb2bf1e){var _0x2ef1dd=JSON[_0x72e8('0x4')](_0xb2bf1e);var _0x4dd0a6=Object[_0x72e8('0x2')](_0x2ef1dd)[0x0];var _0x4ae073=_0x2ef1dd[_0x4dd0a6];return{['$'+_0x4dd0a6]:_0x4ae073};}exports[_0x72e8('0x5')]=function(_0x348378){var _0x8cfa14=null;if(_0x348378){_0x8cfa14=_0x348378[_0x72e8('0x6')](',');}return _0x8cfa14;};exports['filters']=function(_0x1ba049,_0x2e08e7){var _0x3354e9={};if(!_[_0x72e8('0x7')](_0x1ba049)){_[_0x72e8('0x8')](_0x1ba049,function(_0x28a112,_0x2caebc){try{if(_0x2e08e7){var _0xead09=_[_0x72e8('0x9')](_0x2e08e7,{'name':_0x2caebc})||{};if(hasSequelizeOperator(_0x28a112)){_0x3354e9[_0x2caebc]=getOperatorValue(_0x28a112);}else if(_0xead09[_0x72e8('0xa')]==='DATE'&&_[_0x72e8('0xb')](_0x28a112)){var _0x13bda6=JSON['parse'](_0x28a112);var _0x5aa9a5={'$gte':moment(moment(_0x13bda6[_0x72e8('0xc')])[_0x72e8('0xd')](_0x72e8('0xe')))['utc']()[_0x72e8('0xd')](),'$lte':moment(moment(_0x13bda6[_0x72e8('0xf')])[_0x72e8('0xd')]('YYYY-MM-DD'))[_0x72e8('0x10')]()['subtract'](0x1,'s')[_0x72e8('0xd')]()};_0x3354e9[_0x2caebc]=_0x5aa9a5;}else if(_0xead09[_0x72e8('0x11')]===_0x72e8('0x12')){_0x3354e9[_0x2caebc]=_0x28a112;}else{_0x3354e9[_0x2caebc]=_['isArray'](_0x28a112)?_0x28a112:JSON[_0x72e8('0x4')](_0x28a112);}}else{_0x3354e9[_0x2caebc]=_[_0x72e8('0x13')](_0x28a112)?_0x28a112:JSON[_0x72e8('0x4')](_0x28a112);}}catch(_0x40ddb7){_0x3354e9[_0x2caebc]=_0x28a112[_0x72e8('0x6')](',');}});}return _0x3354e9;};exports[_0x72e8('0x14')]=function(_0x9d57ad){_0x9d57ad=parseInt(_0x9d57ad,0xa);if(!_0x9d57ad||_0x9d57ad<0x0){_0x9d57ad=LIMIT_VALUE;}return _0x9d57ad;};exports[_0x72e8('0x15')]=function(_0x19575d){_0x19575d=parseInt(_0x19575d,0xa);if(!_0x19575d||_0x19575d<0x0){_0x19575d=0x0;}return _0x19575d;};exports[_0x72e8('0x16')]=function(_0x104718){var _0x3ff9d0,_0x881096=null;if(_0x104718){_0x3ff9d0=_0x104718[_0x72e8('0x6')](',');_0x881096=_[_0x72e8('0x17')](_0x3ff9d0,function(_0x35422e){if(_0x35422e[_0x72e8('0x18')]('-')===0x0){return[_0x35422e===_0x72e8('0x19')?sequelize[_0x72e8('0x1a')](sequelize['col']('priority'),'unsigned'):_0x35422e[_0x72e8('0x1b')](0x1),_0x72e8('0x1c')];}else{return[_0x35422e===_0x72e8('0x19')?sequelize[_0x72e8('0x1a')](sequelize[_0x72e8('0x1d')](_0x72e8('0x19')),_0x72e8('0x1e')):_0x35422e,_0x72e8('0x1f')];}});}return _0x881096;};exports[_0x72e8('0x20')]=function(_0x5bb6fe,_0x33d74c){if(_[_0x72e8('0x7')](_0x5bb6fe)){return _0x5bb6fe;}if(_[_0x72e8('0x13')](_0x5bb6fe)){for(var _0x3b82ce=0x0;_0x3b82ce<_0x5bb6fe[_0x72e8('0x21')];_0x3b82ce+=0x1){_0x5bb6fe[_0x3b82ce]=this['omit'](_0x5bb6fe[_0x3b82ce],_0x33d74c);}return _0x5bb6fe;}if(!_[_0x72e8('0x22')](_0x5bb6fe)){return _0x5bb6fe;}if(_['isString'](_0x33d74c)){_0x33d74c=[_0x33d74c];}if(!_[_0x72e8('0x13')](_0x33d74c)){return _0x5bb6fe;}for(var _0x5c0070=0x0;_0x5c0070<_0x33d74c[_0x72e8('0x21')];_0x5c0070+=0x1){_[_0x72e8('0x23')](_0x5bb6fe,_0x33d74c[_0x5c0070]);}for(var _0x1948ef in _0x5bb6fe){if(_0x5bb6fe[_0x72e8('0x24')](_0x1948ef)){_0x5bb6fe[_0x1948ef]=this[_0x72e8('0x20')](_0x5bb6fe[_0x1948ef],_0x33d74c);}}return _0x5bb6fe;};exports[_0x72e8('0x25')]=function(_0x1f2cd0){return _0x1f2cd0[_0x72e8('0x26')](RegExp(_0x72e8('0x27')))?!![]:![];};exports[_0x72e8('0x28')]=function(_0x4f7e9d){return _0x4f7e9d['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x72e8('0x29')]=function(_0x372c79,_0x22a64f){var _0x3ab825=[];var _0x6d9b5e=/[ `!@#$%^&*()_\-?~]/;var _0x42df0c=_0x22a64f?_0x72e8('0x2a'):_0x72e8('0x2b');_0x372c79[_0x72e8('0x6')](/[ ,]+/)[_0x72e8('0x2c')](function(_0x3c610f){_0x3c610f=_0x3c610f[_0x72e8('0x2d')](/([^:]")"+/g,'$1');_0x3c610f='+'+_0x3c610f+'*';var _0x2e5ead=_0x3c610f[_0x72e8('0x26')](_0x6d9b5e);if(_0x2e5ead){_0x3c610f='\x22'+_0x3c610f+'\x22';}_0x3ab825[_0x72e8('0x2e')](_0x3c610f);});_0x42df0c=_0x42df0c[_0x72e8('0x2d')]('{EXPR}',_0x3ab825[_0x72e8('0x2f')]('\x20'));return _0x42df0c;};exports[_0x72e8('0x30')]=function(_0x574233,_0x3790ff,_0x5b4ece){var _0x3dba09={},_0x16a6d6={};if(_0x3790ff['query'][_0x72e8('0x31')]){_0x3790ff[_0x72e8('0x32')]['id']=_0x3790ff[_0x72e8('0x32')][_0x72e8('0x31')];delete _0x3790ff[_0x72e8('0x32')][_0x72e8('0x31')];}_0x3dba09['model']=_[_0x72e8('0x17')](_0x574233,_0x72e8('0x11'));_0x3dba09[_0x72e8('0x32')]=_[_0x72e8('0x2')](_0x3790ff['query']);_0x3dba09['filters']=_[_0x72e8('0x33')](_0x3dba09[_0x72e8('0x34')],_0x3dba09[_0x72e8('0x32')]);_0x16a6d6[_0x72e8('0x35')]=_[_0x72e8('0x33')](_0x3dba09['model'],this[_0x72e8('0x5')](_0x3790ff[_0x72e8('0x32')][_0x72e8('0x5')]));_0x16a6d6[_0x72e8('0x35')]=_0x16a6d6[_0x72e8('0x35')][_0x72e8('0x21')]?_0x16a6d6[_0x72e8('0x35')]:_0x3dba09[_0x72e8('0x34')];if(!_0x3790ff[_0x72e8('0x32')][_0x72e8('0x24')](_0x72e8('0x36'))){_0x16a6d6['limit']=this[_0x72e8('0x14')](_0x3790ff[_0x72e8('0x32')][_0x72e8('0x14')]);_0x16a6d6[_0x72e8('0x15')]=this[_0x72e8('0x15')](_0x3790ff[_0x72e8('0x32')][_0x72e8('0x15')]);}_0x16a6d6[_0x72e8('0x37')]=this[_0x72e8('0x16')](_0x3790ff[_0x72e8('0x32')][_0x72e8('0x16')]);_0x16a6d6[_0x72e8('0x38')]=this['filters'](_[_0x72e8('0x39')](_0x3790ff[_0x72e8('0x32')],_0x3dba09[_0x72e8('0x3a')]),_0x574233);if(_0x3790ff['query'][_0x72e8('0x3b')]){var _0x1a5706=_0x574233;var _0x3defbe=_0x3790ff[_0x72e8('0x32')][_0x72e8('0x3b')];if(typeof _0x3defbe===_0x72e8('0x3c')){_0x1a5706=_[_0x72e8('0x3b')](_0x574233,function(_0x18441c){return _[_0x72e8('0x3')](_0x3defbe[_0x72e8('0x3d')],_0x18441c['name']);});_0x3defbe=_0x3defbe['value'];}_0x16a6d6[_0x72e8('0x38')]=_[_0x72e8('0x3e')](_0x16a6d6[_0x72e8('0x38')],{'$or':_[_0x72e8('0x17')](_0x1a5706,function(_0x420d9d){if(_0x420d9d[_0x72e8('0xa')]!==_0x72e8('0x3f')){if(_0x5b4ece){return sequelize['where'](sequelize['fn'](_0x72e8('0x40'),sequelize['col'](_0x420d9d[_0x72e8('0x11')])),{'$like':sequelize['fn'](_0x72e8('0x40'),'%'+_0x3790ff[_0x72e8('0x32')][_0x72e8('0x3b')]+'%')});}else{var _0x4c8152={};_0x4c8152[_0x420d9d[_0x72e8('0x11')]]={'$like':'%'+_0x3790ff[_0x72e8('0x32')]['filter']+'%'};return _0x4c8152;}}})});}_0x16a6d6=_[_0x72e8('0x3e')]({},_0x16a6d6,_0x3790ff[_0x72e8('0x41')]);return _0x16a6d6;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 67441f0..e91883f 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb970=['smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','smsStatus','chatStatusTime','openchannelStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','online','omit','pick','filterAgentAttributes','lodash','../../mysqldb','client','http','chatPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','whatsappStatus','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','merge','catch','*pause','busy','startCase','all','flatten','map','uniq','value','getAgentIdsByQueues','includes','resolve','findAll','name','fullname','faxPause','pauseType','fields','globalStatus','order','startsWith','DESC','ASC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity'];(function(_0xbffa14,_0x33acf3){var _0x523d1d=function(_0x22f34c){while(--_0x22f34c){_0xbffa14['push'](_0xbffa14['shift']());}};_0x523d1d(++_0x33acf3);}(_0xb970,0x127));var _0x0b97=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0xb970[_0x154192];return _0x3c2792;};'use strict';var _=require(_0x0b97('0x0'));var jayson=require('jayson/promise');var db=require(_0x0b97('0x1'))['db'];var amiClient=jayson[_0x0b97('0x2')][_0x0b97('0x3')]({'port':0x232a});var routingClient=jayson[_0x0b97('0x2')]['http']({'port':0x232c});function isAgentPaused(_0x5ad6e1,_0x55d7cd){var _0x1adc4b=[_0x5ad6e1[_0x0b97('0x4')],_0x5ad6e1['faxPause'],_0x5ad6e1[_0x0b97('0x5')],_0x5ad6e1[_0x0b97('0x6')],_0x5ad6e1[_0x0b97('0x7')],_0x5ad6e1[_0x0b97('0x8')],_0x5ad6e1[_0x0b97('0x9')]];if(!_0x55d7cd)return _[_0x0b97('0xa')](_0x1adc4b);var _0x568953=_[_0x0b97('0xb')](_0x1adc4b);return _0x568953['length']>0x0&&_0x568953[_0x0b97('0xc')]<_0x1adc4b[_0x0b97('0xc')]?!![]:![];}function isIdle(_0x1ad3e2){return _0x1ad3e2===_0x0b97('0xd')||_0x1ad3e2===_0x0b97('0xe')||_0x1ad3e2===_0x0b97('0xf')||_0x1ad3e2===_0x0b97('0x10')||_[_0x0b97('0x11')](_0x1ad3e2);}function isAgentIdle(_0x526a4f){if(_0x526a4f[_0x0b97('0x12')]!==_0x0b97('0xd')&&_0x526a4f[_0x0b97('0x8')]){_0x526a4f[_0x0b97('0x12')]=_0x0b97('0x13');return![];}return _[_0x0b97('0xa')]([_0x526a4f[_0x0b97('0x14')],_0x526a4f[_0x0b97('0x15')],_0x526a4f[_0x0b97('0x16')],_0x526a4f[_0x0b97('0x17')],_0x526a4f['smsStatus'],_0x526a4f['voiceStatus'],_0x526a4f[_0x0b97('0x18')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x0b97('0x19'),{})[_0x0b97('0x1a')](function(_0x465929){if(_0x465929[_0x0b97('0x1b')]){throw new Error(_0x0b97('0x1c'));}var _0x2d96c8=_0x465929[_0x0b97('0x1d')];return routingClient[_0x0b97('0x1e')]('Agents',{})['then'](function(_0x1689a1){if(_0x1689a1[_0x0b97('0x1b')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x5d3776=_0x1689a1[_0x0b97('0x1d')];return _[_0x0b97('0x1f')]({},_0x2d96c8,_0x5d3776);});})[_0x0b97('0x20')](function(_0x521c82){throw _0x521c82;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x114bda){var _0x2ffac7='unknown';if(isAgentPaused(_0x114bda))_0x2ffac7='pause';else if(isAgentPaused(_0x114bda,!![]))_0x2ffac7=_0x0b97('0x21');else if(isAgentIdle(_0x114bda))_0x2ffac7=_0x0b97('0xd');else _0x2ffac7=_0x0b97('0x22');return _0x2ffac7;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x22439e,_0xee001e){var _0x23354b=_['isArray'](_0x22439e)?_0x22439e:[_0x22439e];var _0x5791f9=_[_0x0b97('0x23')](_0xee001e)+'Queue';var _0x1be7b5=_['map'](_0x23354b,function(_0x25097f){return db[_0x5791f9]['findOne']({'where':{'id':_0x25097f}})[_0x0b97('0x1a')](function(_0x178ec1){if(!_0x178ec1)return[];return _0x178ec1['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x0b97('0x24')](_0x1be7b5)['then'](function(_0x2dff64){var _0x5c224f=_(_0x2dff64)[_0x0b97('0x25')]()[_0x0b97('0x26')]('id')[_0x0b97('0x27')]()[_0x0b97('0x28')]();return _0x5c224f;});}exports[_0x0b97('0x29')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x385d43,_0x1a6dee,_0x5f1987){try{if(_0x1a6dee[_0x0b97('0xc')]>0x0){_0x385d43=_0x385d43[_0x0b97('0xb')](function(_0x1c06a2){return _0x1a6dee[_0x0b97('0x2a')](_0x1c06a2['id']);});}var _0x559c2e=_0x385d43['filter'](function(_0x5a9793){var _0x46d140=_0x0b97('0x22');if(isAgentIdle(_0x5a9793)){_0x46d140=_0x0b97('0xd');}return _0x46d140===_0x5f1987;});return _[_0x0b97('0x26')](_0x559c2e,'id');}catch(_0x28f001){throw _0x28f001;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x317ac4,_0x367dcb,_0x5a3f60){return Promise[_0x0b97('0x2b')]()[_0x0b97('0x1a')](function(){if(_0x367dcb[_0x0b97('0xc')]>0x0){_0x317ac4=_0x317ac4[_0x0b97('0xb')](function(_0x35c12e){return _0x367dcb['includes'](_0x35c12e['id']);});}return _0x317ac4;})[_0x0b97('0x1a')](function(){return db['User'][_0x0b97('0x2c')]({'attributes':['id',_0x0b97('0x2d'),_0x0b97('0x2e'),_0x0b97('0x4'),_0x0b97('0x2f'),_0x0b97('0x5'),_0x0b97('0x6'),_0x0b97('0x7'),'voicePause',_0x0b97('0x9'),_0x0b97('0x30')],'where':{'id':{'$in':_[_0x0b97('0x26')](_0x317ac4,'id')}},'raw':!![]});})[_0x0b97('0x1a')](function(_0x20a665){return _0x20a665[_0x0b97('0x26')](function(_0x1de034){var _0x321f4d=_['find'](_0x317ac4,['id',_0x1de034['id']]);var _0x1191c1=filterAgentAttributes(_0x321f4d);_['merge'](_0x1de034,_0x1191c1);_0x1de034['globalStatus']=getAgentStatus(_0x1de034);return _0x1de034;});})[_0x0b97('0x1a')](function(_0x5d5cd9){var _0x2c473d=sortAgentsByStatus(_0x5d5cd9,_0x5a3f60);return _[_0x0b97('0x26')](_0x2c473d,'id');})[_0x0b97('0x20')](function(_0x2c0f69){throw _0x2c0f69;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x2d55ba){var _0x197885={'fields':[],'order':null};var _0x5a370e=_0x2d55ba['split'](',');_0x197885[_0x0b97('0x31')]=_[_0x0b97('0xb')](_0x5a370e,function(_0x3a8a1a){if(!_0x3a8a1a[_0x0b97('0x2a')](_0x0b97('0x32'))){return!![];}_0x197885[_0x0b97('0x33')]=_[_0x0b97('0x34')](_0x3a8a1a,'-')?_0x0b97('0x35'):_0x0b97('0x36');return![];});return _0x197885;}exports[_0x0b97('0x37')]=getUpdatedSortOptions;function validateSortParameter(_0x4cd6dd){if(_0x4cd6dd['includes'](_0x0b97('0x2e'))&&!_0x4cd6dd['includes'](_0x0b97('0x38'))){var _0x1439c7=_0x4cd6dd[_0x0b97('0x39')](0x0,_0x4cd6dd[_0x0b97('0x3a')]('fullname'));_0x4cd6dd+=','+_0x1439c7+'internal';}return _0x4cd6dd;}exports[_0x0b97('0x3b')]=validateSortParameter;function sortAgentsByStatus(_0xaef309,_0x1c2013){var _0x2c88c2=_0xaef309[_0x0b97('0x3c')](function(_0x11a42d,_0x2f18ea){if(_0x11a42d[_0x0b97('0x32')]===_0x2f18ea['globalStatus']){if(_0x11a42d[_0x0b97('0x32')]===_0x0b97('0x13')){if(_0x1c2013==='DESC'){return(_0x11a42d['pauseType']||'')<(_0x2f18ea[_0x0b97('0x30')]||'')||_0x11a42d[_0x0b97('0x2e')][_0x0b97('0x3d')]()>_0x2f18ea[_0x0b97('0x2e')][_0x0b97('0x3d')]()?0x1:-0x1;}else{return(_0x11a42d[_0x0b97('0x30')]||'')<(_0x2f18ea['pauseType']||'')||_0x11a42d[_0x0b97('0x2e')]['toLowerCase']()>_0x2f18ea[_0x0b97('0x2e')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x1c2013===_0x0b97('0x35')){return _0x11a42d[_0x0b97('0x2e')][_0x0b97('0x3d')]()<_0x2f18ea[_0x0b97('0x2e')]['toLowerCase']()?0x1:-0x1;}else{return _0x11a42d[_0x0b97('0x2e')]['toLowerCase']()<_0x2f18ea[_0x0b97('0x2e')][_0x0b97('0x3d')]()?-0x1:0x1;}}}else{if(_0x1c2013===_0x0b97('0x35')){return _0x11a42d[_0x0b97('0x32')]<_0x2f18ea[_0x0b97('0x32')]?0x1:-0x1;}else{return _0x11a42d[_0x0b97('0x32')]<_0x2f18ea['globalStatus']?-0x1:0x1;}}});return _0x2c88c2;}exports[_0x0b97('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0x5c556c){var _0x171e20=['userpic','online',_0x0b97('0x3f'),'lastPauseAt',_0x0b97('0x30'),_0x0b97('0x40'),_0x0b97('0x38'),_0x0b97('0x41'),_0x0b97('0x4'),'openchannelPause',_0x0b97('0x5'),'smsPause','whatsappPause',_0x0b97('0x2f'),_0x0b97('0x8'),_0x0b97('0x42'),_0x0b97('0x43'),_0x0b97('0x44'),_0x0b97('0x45'),'whatsappCapacity','faxCapacity',_0x0b97('0x46'),_0x0b97('0x47'),_0x0b97('0x48'),_0x0b97('0x49'),_0x0b97('0x4a'),_0x0b97('0x4b'),_0x0b97('0x14'),_0x0b97('0x17'),_0x0b97('0x16'),_0x0b97('0x4c'),'whatsappStatus',_0x0b97('0x15'),_0x0b97('0x12'),_0x0b97('0x4d'),_0x0b97('0x4e'),'mailStatusTime',_0x0b97('0x4f'),_0x0b97('0x50'),_0x0b97('0x51'),_0x0b97('0x52'),_0x0b97('0x53'),_0x0b97('0x54'),'screenrecording',_0x0b97('0x55'),_0x0b97('0x56'),_0x0b97('0x57')];var _0x21061e=[_0x0b97('0x4'),'openchannelPause',_0x0b97('0x5'),_0x0b97('0x7'),_0x0b97('0x9'),_0x0b97('0x2f'),'voicePause',_0x0b97('0x58')];var _0x56c6e4=_(_0x5c556c)[_0x0b97('0x59')](_0x21061e)[_0x0b97('0x5a')](_0x171e20)[_0x0b97('0x28')]();return _0x56c6e4;}exports[_0x0b97('0x5b')]=filterAgentAttributes; \ No newline at end of file +var _0x4288=['fullname','internal','indexOf','validateSortParameter','sort','pauseType','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','mailCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','mailStatus','faxStatus','openchannelStatusTime','mailStatusTime','voiceStatusTime','queue','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','value','lodash','jayson/promise','../../mysqldb','client','http','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','ringing','isNil','pause','chatStatus','smsStatus','voiceStatus','whatsappStatus','request','Agents','then','error','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','getRealtimeAgents','unknown','idle','busy','getAgentStatus','isArray','Queue','findOne','all','flatten','map','uniq','getAgentIdsByQueues','includes','resolve','findAll','chatPause','find','catch','fields','globalStatus','order','startsWith','DESC','ASC','getUpdatedSortOptions'];(function(_0x16270f,_0x11bdf3){var _0xc82aa9=function(_0x2e9e5e){while(--_0x2e9e5e){_0x16270f['push'](_0x16270f['shift']());}};_0xc82aa9(++_0x11bdf3);}(_0x4288,0x178));var _0x8428=function(_0x38c412,_0x556af1){_0x38c412=_0x38c412-0x0;var _0xace629=_0x4288[_0x38c412];return _0xace629;};'use strict';var _=require(_0x8428('0x0'));var jayson=require(_0x8428('0x1'));var db=require(_0x8428('0x2'))['db'];var amiClient=jayson[_0x8428('0x3')][_0x8428('0x4')]({'port':0x232a});var routingClient=jayson[_0x8428('0x3')][_0x8428('0x4')]({'port':0x232c});function isAgentPaused(_0x50f935,_0x5b2ef6){var _0x5ed1f6=[_0x50f935['chatPause'],_0x50f935[_0x8428('0x5')],_0x50f935[_0x8428('0x6')],_0x50f935[_0x8428('0x7')],_0x50f935[_0x8428('0x8')],_0x50f935[_0x8428('0x9')],_0x50f935[_0x8428('0xa')]];if(!_0x5b2ef6)return _[_0x8428('0xb')](_0x5ed1f6);var _0x40f8c4=_[_0x8428('0xc')](_0x5ed1f6);return _0x40f8c4[_0x8428('0xd')]>0x0&&_0x40f8c4[_0x8428('0xd')]<_0x5ed1f6[_0x8428('0xd')]?!![]:![];}function isIdle(_0x4cec20){return _0x4cec20==='idle'||_0x4cec20==='unknown'||_0x4cec20==='unavailable'||_0x4cec20===_0x8428('0xe')||_[_0x8428('0xf')](_0x4cec20);}function isAgentIdle(_0x3eadd4){if(_0x3eadd4['voiceStatus']!=='idle'&&_0x3eadd4['voicePause']){_0x3eadd4['voiceStatus']=_0x8428('0x10');return![];}return _[_0x8428('0xb')]([_0x3eadd4[_0x8428('0x11')],_0x3eadd4['faxStatus'],_0x3eadd4['mailStatus'],_0x3eadd4['openchannelStatus'],_0x3eadd4[_0x8428('0x12')],_0x3eadd4[_0x8428('0x13')],_0x3eadd4[_0x8428('0x14')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x8428('0x15')](_0x8428('0x16'),{})[_0x8428('0x17')](function(_0x4feefc){if(_0x4feefc[_0x8428('0x18')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x3f1fd0=_0x4feefc[_0x8428('0x19')];return routingClient['request']('Agents',{})['then'](function(_0x4d0625){if(_0x4d0625[_0x8428('0x18')]){throw new Error(_0x8428('0x1a'));}var _0x1d237a=_0x4d0625[_0x8428('0x19')];return _[_0x8428('0x1b')]({},_0x3f1fd0,_0x1d237a);});})['catch'](function(_0x404b9e){throw _0x404b9e;});}exports[_0x8428('0x1c')]=getRealtimeAgents;function getAgentStatus(_0x5e24be){var _0x1983dd=_0x8428('0x1d');if(isAgentPaused(_0x5e24be))_0x1983dd=_0x8428('0x10');else if(isAgentPaused(_0x5e24be,!![]))_0x1983dd='*pause';else if(isAgentIdle(_0x5e24be))_0x1983dd=_0x8428('0x1e');else _0x1983dd=_0x8428('0x1f');return _0x1983dd;}exports[_0x8428('0x20')]=getAgentStatus;function getAgentIdsByQueues(_0x28dc2d,_0x477c59){var _0xcda58f=_[_0x8428('0x21')](_0x28dc2d)?_0x28dc2d:[_0x28dc2d];var _0x542b15=_['startCase'](_0x477c59)+_0x8428('0x22');var _0x5d1f8e=_['map'](_0xcda58f,function(_0x3cdd05){return db[_0x542b15][_0x8428('0x23')]({'where':{'id':_0x3cdd05}})['then'](function(_0x48e133){if(!_0x48e133)return[];return _0x48e133['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x8428('0x24')](_0x5d1f8e)[_0x8428('0x17')](function(_0x601e8d){var _0xa184af=_(_0x601e8d)[_0x8428('0x25')]()[_0x8428('0x26')]('id')[_0x8428('0x27')]()['value']();return _0xa184af;});}exports[_0x8428('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3d3599,_0x256303,_0x29e5c4){try{if(_0x256303[_0x8428('0xd')]>0x0){_0x3d3599=_0x3d3599['filter'](function(_0x2e33e0){return _0x256303[_0x8428('0x29')](_0x2e33e0['id']);});}var _0x3f3e98=_0x3d3599[_0x8428('0xc')](function(_0x28cd72){var _0x4a15a3=_0x8428('0x1f');if(isAgentIdle(_0x28cd72)){_0x4a15a3=_0x8428('0x1e');}return _0x4a15a3===_0x29e5c4;});return _[_0x8428('0x26')](_0x3f3e98,'id');}catch(_0x98c928){throw _0x98c928;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x19e7b8,_0x397d9c,_0xcb3e71){return Promise[_0x8428('0x2a')]()['then'](function(){if(_0x397d9c[_0x8428('0xd')]>0x0){_0x19e7b8=_0x19e7b8['filter'](function(_0x2b11ce){return _0x397d9c['includes'](_0x2b11ce['id']);});}return _0x19e7b8;})[_0x8428('0x17')](function(){return db['User'][_0x8428('0x2b')]({'attributes':['id','name','fullname',_0x8428('0x2c'),_0x8428('0x5'),_0x8428('0x6'),_0x8428('0x7'),_0x8428('0x8'),_0x8428('0x9'),_0x8428('0xa'),'pauseType'],'where':{'id':{'$in':_[_0x8428('0x26')](_0x19e7b8,'id')}},'raw':!![]});})['then'](function(_0xe5bfd9){return _0xe5bfd9[_0x8428('0x26')](function(_0x271643){var _0x165e25=_[_0x8428('0x2d')](_0x19e7b8,['id',_0x271643['id']]);var _0x1c8002=filterAgentAttributes(_0x165e25);_[_0x8428('0x1b')](_0x271643,_0x1c8002);_0x271643['globalStatus']=getAgentStatus(_0x271643);return _0x271643;});})[_0x8428('0x17')](function(_0x203687){var _0x35de9f=sortAgentsByStatus(_0x203687,_0xcb3e71);return _['map'](_0x35de9f,'id');})[_0x8428('0x2e')](function(_0x2af3e3){throw _0x2af3e3;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0xd93bf0){var _0x56bf31={'fields':[],'order':null};var _0xd83df0=_0xd93bf0['split'](',');_0x56bf31[_0x8428('0x2f')]=_[_0x8428('0xc')](_0xd83df0,function(_0x1de6aa){if(!_0x1de6aa[_0x8428('0x29')](_0x8428('0x30'))){return!![];}_0x56bf31[_0x8428('0x31')]=_[_0x8428('0x32')](_0x1de6aa,'-')?_0x8428('0x33'):_0x8428('0x34');return![];});return _0x56bf31;}exports[_0x8428('0x35')]=getUpdatedSortOptions;function validateSortParameter(_0x374f04){if(_0x374f04[_0x8428('0x29')](_0x8428('0x36'))&&!_0x374f04[_0x8428('0x29')](_0x8428('0x37'))){var _0x14e9eb=_0x374f04['substring'](0x0,_0x374f04[_0x8428('0x38')]('fullname'));_0x374f04+=','+_0x14e9eb+_0x8428('0x37');}return _0x374f04;}exports[_0x8428('0x39')]=validateSortParameter;function sortAgentsByStatus(_0x1e3ac6,_0x6df984){var _0x25390b=_0x1e3ac6[_0x8428('0x3a')](function(_0x33548f,_0x1761c7){if(_0x33548f['globalStatus']===_0x1761c7[_0x8428('0x30')]){if(_0x33548f[_0x8428('0x30')]===_0x8428('0x10')){if(_0x6df984==='DESC'){return(_0x33548f['pauseType']||'')<(_0x1761c7[_0x8428('0x3b')]||'')||_0x33548f[_0x8428('0x36')][_0x8428('0x3c')]()>_0x1761c7[_0x8428('0x36')][_0x8428('0x3c')]()?0x1:-0x1;}else{return(_0x33548f[_0x8428('0x3b')]||'')<(_0x1761c7[_0x8428('0x3b')]||'')||_0x33548f[_0x8428('0x36')][_0x8428('0x3c')]()>_0x1761c7[_0x8428('0x36')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x6df984==='DESC'){return _0x33548f[_0x8428('0x36')][_0x8428('0x3c')]()<_0x1761c7[_0x8428('0x36')][_0x8428('0x3c')]()?0x1:-0x1;}else{return _0x33548f[_0x8428('0x36')][_0x8428('0x3c')]()<_0x1761c7['fullname'][_0x8428('0x3c')]()?-0x1:0x1;}}}else{if(_0x6df984===_0x8428('0x33')){return _0x33548f[_0x8428('0x30')]<_0x1761c7[_0x8428('0x30')]?0x1:-0x1;}else{return _0x33548f[_0x8428('0x30')]<_0x1761c7[_0x8428('0x30')]?-0x1:0x1;}}});return _0x25390b;}exports[_0x8428('0x3d')]=sortAgentsByStatus;function filterAgentAttributes(_0x23f705){var _0x13fc0a=[_0x8428('0x3e'),_0x8428('0x3f'),_0x8428('0x40'),_0x8428('0x41'),_0x8428('0x3b'),_0x8428('0x41'),'internal',_0x8428('0x42'),_0x8428('0x2c'),_0x8428('0x7'),_0x8428('0x6'),_0x8428('0x8'),_0x8428('0xa'),_0x8428('0x5'),'voicePause',_0x8428('0x43'),'openchannelCapacity',_0x8428('0x44'),_0x8428('0x45'),'whatsappCapacity',_0x8428('0x46'),_0x8428('0x47'),_0x8428('0x48'),_0x8428('0x49'),_0x8428('0x4a'),_0x8428('0x4b'),'faxCurrentCapacity',_0x8428('0x11'),'openchannelStatus',_0x8428('0x4c'),_0x8428('0x12'),_0x8428('0x14'),_0x8428('0x4d'),'voiceStatus','chatStatusTime',_0x8428('0x4e'),_0x8428('0x4f'),'smsStatusTime','whatsappStatusTime','faxStatusTime',_0x8428('0x50'),_0x8428('0x51'),'destconnectedlinenum','screenrecording',_0x8428('0x52'),_0x8428('0x53'),_0x8428('0x54')];var _0x4eae56=[_0x8428('0x2c'),_0x8428('0x7'),'mailPause',_0x8428('0x8'),'whatsappPause',_0x8428('0x5'),_0x8428('0x9'),_0x8428('0x3f')];var _0x3e88b0=_(_0x23f705)['omit'](_0x4eae56)['pick'](_0x13fc0a)[_0x8428('0x55')]();return _0x3e88b0;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 42f9234..eaf725d 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbbfd=['client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','onHold','ringing','ringInUse','talking','unknown','originated','message','dialMethod','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','startCase','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','concat','outbound','map','get','voice','pTalking','find','merge','pick','initializeQueues','lodash','util'];(function(_0x4eb6dc,_0x3dc261){var _0x3068b4=function(_0x49f403){while(--_0x49f403){_0x4eb6dc['push'](_0x4eb6dc['shift']());}};_0x3068b4(++_0x3dc261);}(_0xbbfd,0x94));var _0xdbbf=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xbbfd[_0x4b7895];return _0x264180;};'use strict';var _=require(_0xdbbf('0x0'));var jayson=require('jayson/promise');var util=require(_0xdbbf('0x1'));var amiClient=jayson[_0xdbbf('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0xdbbf('0x2')][_0xdbbf('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xdbbf('0x4'),_0xdbbf('0x5'),_0xdbbf('0x6'),_0xdbbf('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0xdbbf('0x8'),_0xdbbf('0x9'),_0xdbbf('0xa'),_0xdbbf('0xb'),'notInUse',_0xdbbf('0xc'),_0xdbbf('0xd'),_0xdbbf('0xe'),_0xdbbf('0xf'),'unavailable',_0xdbbf('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0xdbbf('0x11'),_0xdbbf('0x12'),'statusMessage','dialActive',_0xdbbf('0x13'),'Trunk','startPredictive',_0xdbbf('0x14'),_0xdbbf('0x15'),_0xdbbf('0x16'),_0xdbbf('0x17'),_0xdbbf('0x18'),_0xdbbf('0x19'),_0xdbbf('0x1a'),_0xdbbf('0x1b'),_0xdbbf('0x1c'),_0xdbbf('0x1d'),_0xdbbf('0x1e'),_0xdbbf('0x1f'),_0xdbbf('0x20'),'predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x3759ce,_0x68d55f){var _0x55268e=_0x68d55f==='voice'?amiClient:routingClient;return _0x55268e['request'](_[_0xdbbf('0x21')](_0x68d55f)+'Queues',_0x3759ce)[_0xdbbf('0x22')](function(_0x4f6f37){if(_0x4f6f37['error'])throw new Error(util[_0xdbbf('0x23')](_0xdbbf('0x24'),_0x68d55f));return _0x4f6f37[_0xdbbf('0x25')];})[_0xdbbf('0x26')](function(_0x470115){throw _0x470115;});}exports[_0xdbbf('0x27')]=getRealtimeQueues;function initializeQueues(_0x21d83f,_0x3bd6e8,_0x39ac25,_0x380d34){var _0x329d7e=DEFAULT_QUEUE_ATTRIBUTES;if(_0x39ac25==='voice'){if(_0x380d34==='inbound'){_0x329d7e=_0x329d7e[_0xdbbf('0x28')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x380d34===_0xdbbf('0x29')){_0x329d7e=_0x329d7e[_0xdbbf('0x28')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x21d83f[_0xdbbf('0x2a')](function(_0x12a0bd){var _0x543de6=_0x12a0bd[_0xdbbf('0x2b')]({'plain':!![]});_0x543de6[_0xdbbf('0x6')]=0x0;_0x543de6[_0xdbbf('0xb')]=0x0;_0x543de6['loggedIn']=0x0;_0x543de6[_0xdbbf('0x4')]=0x0;_0x543de6[_0xdbbf('0x7')]=0x0;if(_0x39ac25===_0xdbbf('0x2c')){_0x543de6[_0xdbbf('0xf')]=0x0;_0x543de6[_0xdbbf('0x8')]=0x0;if(_0x380d34==='outbound'){_0x543de6[_0xdbbf('0x2d')]=0x0;_0x543de6[_0xdbbf('0x11')]=0x0;}}var _0x9591c7=_[_0xdbbf('0x2e')](_0x3bd6e8,['id',_0x543de6['id']]);if(_0x9591c7){_[_0xdbbf('0x2f')](_0x543de6,_[_0xdbbf('0x30')](_0x9591c7,_0x329d7e));}return _0x543de6;});}exports[_0xdbbf('0x31')]=initializeQueues; \ No newline at end of file +var _0x2ee2=['concat','map','get','loggedIn','waiting','talking','outbound','originated','initializeQueues','lodash','jayson/promise','http','client','available','paused','busy','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','unavailable','unknown','pTalking','message','statusMessage','dialActive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','request','startCase','Queues','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','voice','inbound'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x2ee2,0x10d));var _0x22ee=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x2ee2[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x22ee('0x0'));var jayson=require(_0x22ee('0x1'));var util=require('util');var amiClient=jayson['client'][_0x22ee('0x2')]({'port':0x232a});var routingClient=jayson[_0x22ee('0x3')][_0x22ee('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x22ee('0x4'),'loggedIn',_0x22ee('0x5'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0x22ee('0x6'),'inUse',_0x22ee('0x7'),_0x22ee('0x8'),_0x22ee('0x9'),_0x22ee('0xa'),_0x22ee('0xb'),_0x22ee('0xc'),'talking',_0x22ee('0xd'),_0x22ee('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x22ee('0xf'),'originated',_0x22ee('0x10'),_0x22ee('0x11'),_0x22ee('0x12'),'dialMethod','Trunk','startPredictive',_0x22ee('0x13'),_0x22ee('0x14'),_0x22ee('0x15'),_0x22ee('0x16'),'erlangBusyFactor',_0x22ee('0x17'),_0x22ee('0x18'),_0x22ee('0x19'),_0x22ee('0x1a'),_0x22ee('0x1b'),_0x22ee('0x1c'),'predictiveIntervalDroppedCallsTimeout',_0x22ee('0x1d'),_0x22ee('0x1e'),_0x22ee('0x1f')];function getRealtimeQueues(_0x412349,_0x393f15){var _0x49466d=_0x393f15==='voice'?amiClient:routingClient;return _0x49466d[_0x22ee('0x20')](_[_0x22ee('0x21')](_0x393f15)+_0x22ee('0x22'),_0x412349)[_0x22ee('0x23')](function(_0x37b694){if(_0x37b694[_0x22ee('0x24')])throw new Error(util['format'](_0x22ee('0x25'),_0x393f15));return _0x37b694[_0x22ee('0x26')];})[_0x22ee('0x27')](function(_0x3047f4){throw _0x3047f4;});}exports[_0x22ee('0x28')]=getRealtimeQueues;function initializeQueues(_0x1d254a,_0x11ceae,_0x3d51c0,_0x4dddb7){var _0x47028c=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3d51c0===_0x22ee('0x29')){if(_0x4dddb7===_0x22ee('0x2a')){_0x47028c=_0x47028c[_0x22ee('0x2b')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x4dddb7==='outbound'){_0x47028c=_0x47028c['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1d254a[_0x22ee('0x2c')](function(_0x58fd7c){var _0x469cf0=_0x58fd7c[_0x22ee('0x2d')]({'plain':!![]});_0x469cf0[_0x22ee('0x5')]=0x0;_0x469cf0[_0x22ee('0x8')]=0x0;_0x469cf0[_0x22ee('0x2e')]=0x0;_0x469cf0[_0x22ee('0x4')]=0x0;_0x469cf0[_0x22ee('0x2f')]=0x0;if(_0x3d51c0===_0x22ee('0x29')){_0x469cf0[_0x22ee('0x30')]=0x0;_0x469cf0[_0x22ee('0x6')]=0x0;if(_0x4dddb7===_0x22ee('0x31')){_0x469cf0[_0x22ee('0xf')]=0x0;_0x469cf0[_0x22ee('0x32')]=0x0;}}var _0x9becbc=_['find'](_0x11ceae,['id',_0x469cf0['id']]);if(_0x9becbc){_['merge'](_0x469cf0,_['pick'](_0x9becbc,_0x47028c));}return _0x469cf0;});}exports[_0x22ee('0x33')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index f9a6f02..94c8a0c 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(_0x3a37df,_0x46c381){var _0x33845c=function(_0x276b10){while(--_0x276b10){_0x3a37df['push'](_0x3a37df['shift']());}};_0x33845c(++_0x46c381);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x24b852,_0x2bad67){var _0x180ad2=function(_0x454562){while(--_0x454562){_0x24b852['push'](_0x24b852['shift']());}};_0x180ad2(++_0x2bad67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index e059f5e..157ce99 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 _0x1278=['md5','digest','hex','getUuid','platform','test','licenseToken','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','ipAddress','substring','crypto','child_process','execSync','../environment','networkInterfaces','length','filter','family','IPv4','internal','head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','map','model','join','createHash'];(function(_0x55f160,_0x722f1f){var _0x1ddce6=function(_0x28552a){while(--_0x28552a){_0x55f160['push'](_0x55f160['shift']());}};_0x1ddce6(++_0x722f1f);}(_0x1278,0x91));var _0x8127=function(_0x37f202,_0x178698){_0x37f202=_0x37f202-0x0;var _0x5c1aff=_0x1278[_0x37f202];return _0x5c1aff;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x8127('0x0'));var machine=require('bimedia-machine-uuid');var exec=require(_0x8127('0x1'))[_0x8127('0x2')];var config=require(_0x8127('0x3'));function getInterfaces(){var _0x446aec=[];var _0x4a5ddc=os[_0x8127('0x4')]();var _0x1b49bb=_['orderBy'](_['keys'](_0x4a5ddc));for(var _0x5bff58=0x0;_0x5bff58<_0x1b49bb[_0x8127('0x5')];_0x5bff58++){var _0x1f0b35=_0x4a5ddc[_0x1b49bb[_0x5bff58]][_0x8127('0x6')](function(_0x47b5f9){return _0x47b5f9[_0x8127('0x7')]===_0x8127('0x8')&&_0x47b5f9[_0x8127('0x9')]===![];});_0x446aec=_0x446aec['concat'](_0x1f0b35);}return _0x446aec;}function getFirstInterface(){var _0x29f5b5=_[_0x8127('0xa')](getInterfaces());return{'macAddress':_0x29f5b5&&_0x29f5b5['mac']?_0x29f5b5[_0x8127('0xb')]:_0x8127('0xc'),'ipAddress':_0x29f5b5&&_0x29f5b5[_0x8127('0xd')]?_0x29f5b5['address']:_0x8127('0xe')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x3ae326=_['orderBy'](os[_0x8127('0xf')]()[_0x8127('0x10')](function(_0x2bba03){return _0x2bba03[_0x8127('0x11')];}))[_0x8127('0x12')](':');return crypto[_0x8127('0x13')](_0x8127('0x14'))['update'](_0x3ae326)[_0x8127('0x15')](_0x8127('0x16'));}exports[_0x8127('0x17')]=function(){var _0x409f14=os[_0x8127('0x18')]();var _0x3b12cb=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x3b12cb[_0x8127('0x19')](config['licenseToken'])){return config[_0x8127('0x1a')];}else if(_0x409f14==='win32'){return exec(_0x8127('0x1b'),{'encoding':'utf8'})[_0x8127('0x1c')]('\x0d\x0a','');}else{var _0x1e0b80=getFirstInterface();var _0x1c3854=getCPUhash();var _0x3b0c82=_0x1c3854+'|'+os[_0x8127('0x1d')]()+'|'+_0x1e0b80[_0x8127('0x1e')]+'|'+_0x1e0b80[_0x8127('0x1f')];var _0xc671e9=crypto['createHash'](_0x8127('0x14'))['update'](_0x3b0c82)[_0x8127('0x15')](_0x8127('0x16'));return _0xc671e9[_0x8127('0x20')](0x0,0x8)+'-'+_0xc671e9[_0x8127('0x20')](0x8,0xc)+'-'+_0xc671e9['substring'](0xc,0x10)+'-'+_0xc671e9['substring'](0x10,0x14)+'-'+_0xc671e9[_0x8127('0x20')](0x14);}}; \ No newline at end of file +var _0x515b=['keys','length','filter','IPv4','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','digest','hex','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','replace','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x515b,0x1f0));var _0xb515=function(_0x139450,_0x231197){_0x139450=_0x139450-0x0;var _0x5ef976=_0x515b[_0x139450];return _0x5ef976;};'use strict';var _=require(_0xb515('0x0'));var os=require('os');var crypto=require(_0xb515('0x1'));var machine=require(_0xb515('0x2'));var exec=require(_0xb515('0x3'))[_0xb515('0x4')];var config=require(_0xb515('0x5'));function getInterfaces(){var _0x48e2f1=[];var _0x13e777=os[_0xb515('0x6')]();var _0x29eb4a=_[_0xb515('0x7')](_[_0xb515('0x8')](_0x13e777));for(var _0x25ea97=0x0;_0x25ea97<_0x29eb4a[_0xb515('0x9')];_0x25ea97++){var _0x3925d0=_0x13e777[_0x29eb4a[_0x25ea97]][_0xb515('0xa')](function(_0x503c84){return _0x503c84['family']===_0xb515('0xb')&&_0x503c84['internal']===![];});_0x48e2f1=_0x48e2f1[_0xb515('0xc')](_0x3925d0);}return _0x48e2f1;}function getFirstInterface(){var _0x449636=_[_0xb515('0xd')](getInterfaces());return{'macAddress':_0x449636&&_0x449636[_0xb515('0xe')]?_0x449636[_0xb515('0xe')]:_0xb515('0xf'),'ipAddress':_0x449636&&_0x449636[_0xb515('0x10')]?_0x449636[_0xb515('0x10')]:_0xb515('0x11')};}exports[_0xb515('0x12')]=getFirstInterface;function getCPUhash(){var _0x599782=_[_0xb515('0x7')](os[_0xb515('0x13')]()[_0xb515('0x14')](function(_0x525447){return _0x525447[_0xb515('0x15')];}))[_0xb515('0x16')](':');return crypto[_0xb515('0x17')](_0xb515('0x18'))['update'](_0x599782)[_0xb515('0x19')](_0xb515('0x1a'));}exports['getUuid']=function(){var _0x4148e6=os[_0xb515('0x1b')]();var _0x237f09=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x237f09[_0xb515('0x1c')](config['licenseToken'])){return config[_0xb515('0x1d')];}else if(_0x4148e6===_0xb515('0x1e')){return exec(_0xb515('0x1f'),{'encoding':'utf8'})[_0xb515('0x20')]('\x0d\x0a','');}else{var _0x391103=getFirstInterface();var _0x42e13c=getCPUhash();var _0x46ac8c=_0x42e13c+'|'+os['hostname']()+'|'+_0x391103[_0xb515('0x21')]+'|'+_0x391103[_0xb515('0x22')];var _0x5ddc11=crypto[_0xb515('0x17')]('md5')['update'](_0x46ac8c)[_0xb515('0x19')](_0xb515('0x1a'));return _0x5ddc11[_0xb515('0x23')](0x0,0x8)+'-'+_0x5ddc11['substring'](0x8,0xc)+'-'+_0x5ddc11[_0xb515('0x23')](0xc,0x10)+'-'+_0x5ddc11[_0xb515('0x23')](0x10,0x14)+'-'+_0x5ddc11['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 3964c1e..e560926 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 _0x8e59=['Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString','days','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','./hardware','../logger','license','https://www.xcallymotion.com','format','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','get','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED'];(function(_0x14f817,_0x4737e0){var _0x240112=function(_0x5a7abb){while(--_0x5a7abb){_0x14f817['push'](_0x14f817['shift']());}};_0x240112(++_0x4737e0);}(_0x8e59,0x11d));var _0x98e5=function(_0x2f7ae0,_0x3aa6c8){_0x2f7ae0=_0x2f7ae0-0x0;var _0x59b8f9=_0x8e59[_0x2f7ae0];return _0x59b8f9;};'use strict';var util=require(_0x98e5('0x0'));var moment=require(_0x98e5('0x1'));var rp=require(_0x98e5('0x2'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x98e5('0x3'));var logger=require(_0x98e5('0x4'))(_0x98e5('0x5'));var HOST=_0x98e5('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x483a7a){return new BPromise(function(_0xf8600d,_0x58830b){var _0x2a9935=util[_0x98e5('0x7')]('%s/api/servers/%s/check?version=%s',HOST,_0x483a7a,module[_0x98e5('0x8')][_0x98e5('0x9')]);if(oldToken){_0x2a9935=util[_0x98e5('0x7')](_0x98e5('0xa'),HOST,_0x483a7a,module[_0x98e5('0x8')]['version'],oldToken);}var _0x1d5540={'uri':_0x2a9935,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x1d5540)[_0x98e5('0xb')](function(_0x2c6f5e){_0xf8600d(_0x2c6f5e);})[_0x98e5('0xc')](function(_0x1f4b0f){_0x58830b(_0x1f4b0f);});});}function manageLicense(_0x3d022b,_0x5adde4){var _0x1c4d47=_0x5adde4[_0x98e5('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x1c4d47[_0x98e5('0xe')]!==_0x3d022b&&!_0x1c4d47[_0x98e5('0xf')]){oldToken=_0x1c4d47['data1'];}httpRequest(_0x3d022b)[_0x98e5('0xb')](function(_0x4caa68){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4caa68['active']){isOldTokenSent=![];if(!_0x1c4d47['license']&&_0x1c4d47[_0x98e5('0x5')]!=_0x4caa68[_0x98e5('0x5')]||_0x1c4d47[_0x98e5('0x5')]&&_0x1c4d47[_0x98e5('0xf')]){logger[_0x98e5('0x10')](_0x98e5('0x11'));}if(_0x1c4d47['license']&&!_0x1c4d47[_0x98e5('0xf')]&&_0x1c4d47['license']!=_0x4caa68[_0x98e5('0x5')]){logger['info'](_0x98e5('0x12'));}if(_0x1c4d47[_0x98e5('0x5')]&&!_0x1c4d47[_0x98e5('0xf')]&&_0x1c4d47[_0x98e5('0x5')]==_0x4caa68['license']){return _0x5adde4;}return _0x5adde4['update']({'data1':_0x3d022b,'data2':null,'license':_0x4caa68[_0x98e5('0x5')]});}else{if(_0x4caa68[_0x98e5('0x5')]||_0x1c4d47[_0x98e5('0x5')]){if(!_0x1c4d47[_0x98e5('0xf')]){if(_0x1c4d47['data1']==_0x3d022b){GRAY_PERIOD_REASON=_0x98e5('0x13');logger[_0x98e5('0x10')](_0x98e5('0x14'));}else{GRAY_PERIOD_REASON=_0x98e5('0x15');logger[_0x98e5('0x10')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x1c4d47[_0x98e5('0xe')],_0x3d022b);}logger[_0x98e5('0x10')](_0x98e5('0x16'),GRAY_PERIOD_REASON[_0x98e5('0x17')](),moment()[_0x98e5('0x7')](_0x98e5('0x18')));return _0x5adde4[_0x98e5('0x19')]({'data2':encryptor[_0x98e5('0x1a')](moment()['format'](_0x98e5('0x18')))});}else{if(moment()[_0x98e5('0x1b')](encryptor[_0x98e5('0x1c')](_0x1c4d47[_0x98e5('0xf')]),_0x98e5('0x1d'))>DAYS){logger[_0x98e5('0x10')]('DEMO\x20START\x20AT\x20%s',moment()[_0x98e5('0x7')](_0x98e5('0x18')));isOldTokenSent=![];return _0x5adde4[_0x98e5('0x19')]({'data1':_0x3d022b,'data2':null,'license':null});}}}else{if(_0x1c4d47['data1']!=_0x3d022b){logger['info'](_0x98e5('0x1e'),_0x1c4d47[_0x98e5('0xe')],_0x3d022b);return _0x5adde4[_0x98e5('0x19')]({'data1':_0x3d022b,'data2':null,'license':null});}}}return _0x5adde4;})[_0x98e5('0xb')](function(_0x5cf8cd){_0x5adde4=_0x5cf8cd;})[_0x98e5('0xc')](function(_0x36a48e){logger[_0x98e5('0x1f')](_0x36a48e[_0x98e5('0x20')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x98e5('0x21')](),_0x5adde4);},TIME);});}function defaultLicense(){var _0x473554=hardware[_0x98e5('0x21')]();if(_0x473554){return db[_0x98e5('0x22')][_0x98e5('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x473554}})['spread'](function(_0x5bad7d,_0x3b9de0){logger[_0x98e5('0x10')](_0x98e5('0x24'),_0x473554);manageLicense(_0x473554,_0x5bad7d);})[_0x98e5('0xc')](function(_0x30ebcc){logger[_0x98e5('0x1f')](_0x30ebcc['message']);});}}exports[_0x98e5('0x25')]=defaultLicense; \ No newline at end of file +var _0x601b=['format','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','catch','message','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase'];(function(_0x31abc2,_0x5f38fa){var _0x306e96=function(_0x4bacdc){while(--_0x4bacdc){_0x31abc2['push'](_0x31abc2['shift']());}};_0x306e96(++_0x5f38fa);}(_0x601b,0x83));var _0xb601=function(_0x5ecb87,_0x9d837c){_0x5ecb87=_0x5ecb87-0x0;var _0x466841=_0x601b[_0x5ecb87];return _0x466841;};'use strict';var util=require('util');var moment=require('moment');var rp=require(_0xb601('0x0'));var BPromise=require(_0xb601('0x1'));var pkginfo=require(_0xb601('0x2'))(module,_0xb601('0x3'));var db=require(_0xb601('0x4'))['db'];var encryptor=require(_0xb601('0x5'));var hardware=require(_0xb601('0x6'));var logger=require(_0xb601('0x7'))(_0xb601('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1e737a){return new BPromise(function(_0x2486fb,_0x132713){var _0x85932d=util['format'](_0xb601('0x9'),HOST,_0x1e737a,module[_0xb601('0xa')][_0xb601('0x3')]);if(oldToken){_0x85932d=util['format'](_0xb601('0xb'),HOST,_0x1e737a,module[_0xb601('0xa')]['version'],oldToken);}var _0x187983={'uri':_0x85932d,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x187983)[_0xb601('0xc')](function(_0xf75a68){_0x2486fb(_0xf75a68);})['catch'](function(_0x16548d){_0x132713(_0x16548d);});});}function manageLicense(_0x308551,_0x110b6a){var _0x3fb17c=_0x110b6a['get']({'plain':!![]});if(!isOldTokenSent&&_0x3fb17c[_0xb601('0xd')]!==_0x308551&&!_0x3fb17c[_0xb601('0xe')]){oldToken=_0x3fb17c['data1'];}httpRequest(_0x308551)[_0xb601('0xc')](function(_0x47445c){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x47445c[_0xb601('0xf')]){isOldTokenSent=![];if(!_0x3fb17c[_0xb601('0x8')]&&_0x3fb17c['license']!=_0x47445c[_0xb601('0x8')]||_0x3fb17c[_0xb601('0x8')]&&_0x3fb17c[_0xb601('0xe')]){logger[_0xb601('0x10')](_0xb601('0x11'));}if(_0x3fb17c[_0xb601('0x8')]&&!_0x3fb17c[_0xb601('0xe')]&&_0x3fb17c['license']!=_0x47445c[_0xb601('0x8')]){logger[_0xb601('0x10')](_0xb601('0x12'));}if(_0x3fb17c['license']&&!_0x3fb17c[_0xb601('0xe')]&&_0x3fb17c['license']==_0x47445c[_0xb601('0x8')]){return _0x110b6a;}return _0x110b6a[_0xb601('0x13')]({'data1':_0x308551,'data2':null,'license':_0x47445c[_0xb601('0x8')]});}else{if(_0x47445c[_0xb601('0x8')]||_0x3fb17c['license']){if(!_0x3fb17c[_0xb601('0xe')]){if(_0x3fb17c[_0xb601('0xd')]==_0x308551){GRAY_PERIOD_REASON=_0xb601('0x14');logger[_0xb601('0x10')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xb601('0x15');logger['info'](_0xb601('0x16'),_0x3fb17c[_0xb601('0xd')],_0x308551);}logger[_0xb601('0x10')](_0xb601('0x17'),GRAY_PERIOD_REASON[_0xb601('0x18')](),moment()[_0xb601('0x19')](_0xb601('0x1a')));return _0x110b6a[_0xb601('0x13')]({'data2':encryptor['encryptString'](moment()[_0xb601('0x19')](_0xb601('0x1a')))});}else{if(moment()[_0xb601('0x1b')](encryptor[_0xb601('0x1c')](_0x3fb17c['data2']),_0xb601('0x1d'))>DAYS){logger['info'](_0xb601('0x1e'),moment()[_0xb601('0x19')](_0xb601('0x1a')));isOldTokenSent=![];return _0x110b6a[_0xb601('0x13')]({'data1':_0x308551,'data2':null,'license':null});}}}else{if(_0x3fb17c[_0xb601('0xd')]!=_0x308551){logger[_0xb601('0x10')](_0xb601('0x16'),_0x3fb17c[_0xb601('0xd')],_0x308551);return _0x110b6a[_0xb601('0x13')]({'data1':_0x308551,'data2':null,'license':null});}}}return _0x110b6a;})['then'](function(_0x41df4c){_0x110b6a=_0x41df4c;})['catch'](function(_0x1abf1f){logger['error'](_0x1abf1f['message']);})[_0xb601('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0xb601('0x20')](),_0x110b6a);},TIME);});}function defaultLicense(){var _0x2167b3=hardware[_0xb601('0x20')]();if(_0x2167b3){return db[_0xb601('0x21')][_0xb601('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x2167b3}})[_0xb601('0x23')](function(_0x5df955,_0x55a294){logger['info'](_0xb601('0x24'),_0x2167b3);manageLicense(_0x2167b3,_0x5df955);})[_0xb601('0x25')](function(_0x20b60f){logger['error'](_0x20b60f[_0xb601('0x26')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 92e3814..7c2f497 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 _0xa4ac=['parse','demo','machineUuid','deadline','add','days','changed','disabled','message','User','findAll','role','sequelize','count','admin','telephone','users','telephones','user','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','defaults','then','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s'];(function(_0x125d0,_0x2b14f4){var _0x3266df=function(_0x1590f9){while(--_0x1590f9){_0x125d0['push'](_0x125d0['shift']());}};_0x3266df(++_0x2b14f4);}(_0xa4ac,0xa5));var _0xca4a=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa4ac[_0x4154a6];return _0x3b2786;};'use strict';var util=require(_0xca4a('0x0'));var _=require(_0xca4a('0x1'));var moment=require(_0xca4a('0x2'));var BPromise=require(_0xca4a('0x3'));var hardware=require(_0xca4a('0x4'));var encryptor=require(_0xca4a('0x5'));var db=require(_0xca4a('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xca4a('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xca4a('0x8'),'machineUuid':hardware[_0xca4a('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xca4a('0xa'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3d06d0){return new BPromise(function(_0x5f0dd0,_0x2cb059){return db['License']['find'](_[_0xca4a('0xb')](_0x3d06d0,{'raw':!![],'where':{'id':0x1}}))[_0xca4a('0xc')](function(_0x44b92b){return checkLicense(_0x44b92b,null);})['then'](function(_0x42738f){_0x5f0dd0(_0x42738f);return;})['catch'](function(_0x466535){_0x2cb059(_0x466535);});});}function checkLicense(_0x675672,_0x3c80f7){if(!_0x675672){demoLicense[_0xca4a('0xd')]=_0x675672[_0xca4a('0xe')];return demoLicense;}try{var _0x4c8a76=_0x3c80f7||_0x675672[_0xca4a('0xf')];if(_[_0xca4a('0x10')](_0x4c8a76)){throw new Error(_0xca4a('0x11'));}var _0x1132ac=_0x675672['data1'];var _0x2d18b0=_0x675672[_0xca4a('0x12')];var _0x2b3661=_0x1132ac[_0xca4a('0x13')]('-')[0x4];var _0x121b75=_0x1132ac[_0xca4a('0x13')]('-')[0x0];var _0x35b368=encryptor[_0xca4a('0x14')](_0x4c8a76,util[_0xca4a('0x15')](_0xca4a('0x16'),_0x2b3661,_0x1132ac,_0x121b75));var _0x54aa0f=JSON[_0xca4a('0x17')](_0x35b368);_0x54aa0f[_0xca4a('0x18')]=![];_0x54aa0f[_0xca4a('0xd')]=_0x1132ac;_0x54aa0f[_0xca4a('0x19')]=hardware[_0xca4a('0x9')]();if(_0x2d18b0){var _0x2aaac2=encryptor[_0xca4a('0x14')](_0x2d18b0);_0x54aa0f['gray']=_0x2aaac2;_0x54aa0f[_0xca4a('0x1a')]=moment(_0x2aaac2)[_0xca4a('0x1b')](0x7,_0xca4a('0x1c'))[_0xca4a('0x15')]();_0x54aa0f['grayReason']=_0x54aa0f[_0xca4a('0xd')]!=_0x54aa0f[_0xca4a('0x19')]?_0xca4a('0x1d'):_0xca4a('0x1e');}return _0x54aa0f;}catch(_0x19810e){breakingLicense[_0xca4a('0xd')]=_0x675672[_0xca4a('0xe')];breakingLicense[_0xca4a('0x1f')]=_0x19810e[_0xca4a('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x458a67,_0x4b5066){getLicense()[_0xca4a('0xc')](function(_0x572d1e){return db[_0xca4a('0x20')][_0xca4a('0x21')]({'attributes':[_0xca4a('0x22'),[db[_0xca4a('0x23')]['fn']('COUNT',db[_0xca4a('0x23')]['col'](_0xca4a('0x22'))),_0xca4a('0x24')]],'group':_0xca4a('0x22'),'where':{'role':{'$or':[_0xca4a('0x25'),'user',_0xca4a('0x26')]}},'raw':!![]})[_0xca4a('0xc')](function(_0x4b7321){var _0x713866={'user':_0x572d1e[_0xca4a('0x27')]||0x0,'telephone':_0x572d1e[_0xca4a('0x28')]||0x0};_0x4b7321['forEach'](function(_0x17fff7){var _0x377bbd=_0x17fff7[_0xca4a('0x22')]===_0xca4a('0x25')?_0xca4a('0x29'):_0x17fff7['role'];_0x713866[_0x377bbd]-=_0x17fff7['count'];if(_0x713866[_0x377bbd]<0x0)_0x713866[_0x377bbd]=0x0;});_0x458a67(_0x713866);return;});})[_0xca4a('0x2a')](function(_0x2cd93e){_0x4b5066(_0x2cd93e);});});}function checkUserLimits(_0x2f83a7){return new BPromise(function(_0x3313a4,_0x55d8eb){getLimits()[_0xca4a('0xc')](function(_0x753c86){var _0x21b08f=_[_0xca4a('0x2b')](_[_0xca4a('0x2c')](_0x2f83a7,_0xca4a('0x22')),['admin','user',_0xca4a('0x26')]);var _0x41ff98=(_0x21b08f['admin']||0x0)+(_0x21b08f[_0xca4a('0x29')]||0x0);var _0x408411=_0x21b08f['telephone']||0x0;if(_0x41ff98>_0x753c86[_0xca4a('0x29')])return _0x55d8eb(_0xca4a('0x2d'));if(_0x408411>_0x753c86['telephone'])return _0x55d8eb(_0xca4a('0x2e'));return _0x3313a4();})[_0xca4a('0x2a')](function(_0x2f4def){_0x55d8eb(_0x2f4def);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x6eec=['uuid','decryptString','gray','deadline','add','days','grayReason','machineUuid','changed','disabled','message','User','findAll','role','sequelize','COUNT','admin','telephone','telephones','forEach','user','count','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','util','bluebird','./hardware','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','defaults','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','format','%s:%s:%s','parse','demo'];(function(_0x382524,_0x3e642e){var _0x609d8=function(_0x5c56a9){while(--_0x5c56a9){_0x382524['push'](_0x382524['shift']());}};_0x609d8(++_0x3e642e);}(_0x6eec,0x162));var _0xc6ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6eec[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xc6ee('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require(_0xc6ee('0x1'));var hardware=require(_0xc6ee('0x2'));var encryptor=require('../../components/encryptor');var db=require(_0xc6ee('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xc6ee('0x4'),'machineUuid':hardware[_0xc6ee('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc6ee('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xc6ee('0x7'),'machineUuid':hardware[_0xc6ee('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3eb4e9){return new BPromise(function(_0x28fedc,_0x107866){return db[_0xc6ee('0x8')]['find'](_[_0xc6ee('0x9')](_0x3eb4e9,{'raw':!![],'where':{'id':0x1}}))[_0xc6ee('0xa')](function(_0x479844){return checkLicense(_0x479844,null);})[_0xc6ee('0xa')](function(_0x53cc1c){_0x28fedc(_0x53cc1c);return;})[_0xc6ee('0xb')](function(_0x32ffb7){_0x107866(_0x32ffb7);});});}function checkLicense(_0x3103b9,_0x237c8f){if(!_0x3103b9){demoLicense['uuid']=_0x3103b9[_0xc6ee('0xc')];return demoLicense;}try{var _0x503a60=_0x237c8f||_0x3103b9[_0xc6ee('0xd')];if(_[_0xc6ee('0xe')](_0x503a60)){throw new Error(_0xc6ee('0xf'));}var _0x416d36=_0x3103b9[_0xc6ee('0xc')];var _0x216c7c=_0x3103b9[_0xc6ee('0x10')];var _0x365027=_0x416d36[_0xc6ee('0x11')]('-')[0x4];var _0xdd745c=_0x416d36[_0xc6ee('0x11')]('-')[0x0];var _0x24ae04=encryptor['decryptString'](_0x503a60,util[_0xc6ee('0x12')](_0xc6ee('0x13'),_0x365027,_0x416d36,_0xdd745c));var _0x518014=JSON[_0xc6ee('0x14')](_0x24ae04);_0x518014[_0xc6ee('0x15')]=![];_0x518014[_0xc6ee('0x16')]=_0x416d36;_0x518014['machineUuid']=hardware['getUuid']();if(_0x216c7c){var _0x5f186b=encryptor[_0xc6ee('0x17')](_0x216c7c);_0x518014[_0xc6ee('0x18')]=_0x5f186b;_0x518014[_0xc6ee('0x19')]=moment(_0x5f186b)[_0xc6ee('0x1a')](0x7,_0xc6ee('0x1b'))[_0xc6ee('0x12')]();_0x518014[_0xc6ee('0x1c')]=_0x518014[_0xc6ee('0x16')]!=_0x518014[_0xc6ee('0x1d')]?_0xc6ee('0x1e'):_0xc6ee('0x1f');}return _0x518014;}catch(_0x4c74e2){breakingLicense[_0xc6ee('0x16')]=_0x3103b9[_0xc6ee('0xc')];breakingLicense[_0xc6ee('0x20')]=_0x4c74e2[_0xc6ee('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x7bf5ee,_0xdb8f69){getLicense()['then'](function(_0x1a1c03){return db[_0xc6ee('0x21')][_0xc6ee('0x22')]({'attributes':[_0xc6ee('0x23'),[db[_0xc6ee('0x24')]['fn'](_0xc6ee('0x25'),db[_0xc6ee('0x24')]['col']('role')),'count']],'group':_0xc6ee('0x23'),'where':{'role':{'$or':[_0xc6ee('0x26'),'user',_0xc6ee('0x27')]}},'raw':!![]})[_0xc6ee('0xa')](function(_0x2d2d9a){var _0x31efce={'user':_0x1a1c03['users']||0x0,'telephone':_0x1a1c03[_0xc6ee('0x28')]||0x0};_0x2d2d9a[_0xc6ee('0x29')](function(_0x1bd90f){var _0x40657a=_0x1bd90f[_0xc6ee('0x23')]===_0xc6ee('0x26')?_0xc6ee('0x2a'):_0x1bd90f[_0xc6ee('0x23')];_0x31efce[_0x40657a]-=_0x1bd90f[_0xc6ee('0x2b')];if(_0x31efce[_0x40657a]<0x0)_0x31efce[_0x40657a]=0x0;});_0x7bf5ee(_0x31efce);return;});})[_0xc6ee('0xb')](function(_0x1760e4){_0xdb8f69(_0x1760e4);});});}function checkUserLimits(_0x24989){return new BPromise(function(_0x4613d0,_0x31222a){getLimits()['then'](function(_0x6f7dae){var _0x31920e=_[_0xc6ee('0x2c')](_[_0xc6ee('0x2d')](_0x24989,_0xc6ee('0x23')),[_0xc6ee('0x26'),_0xc6ee('0x2a'),_0xc6ee('0x27')]);var _0x11cdc4=(_0x31920e[_0xc6ee('0x26')]||0x0)+(_0x31920e[_0xc6ee('0x2a')]||0x0);var _0xb5d3a3=_0x31920e[_0xc6ee('0x27')]||0x0;if(_0x11cdc4>_0x6f7dae['user'])return _0x31222a('License\x20limit\x20reached\x20for\x20users');if(_0xb5d3a3>_0x6f7dae[_0xc6ee('0x27')])return _0x31222a(_0xc6ee('0x2e'));return _0x4613d0();})[_0xc6ee('0xb')](function(_0x5abe30){_0x31222a(_0x5abe30);});});}module['exports']={'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 75a981b..c2c5357 100644 --- a/server/config/local.env.js +++ b/server/config/local.env.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x63a5=['myappanuglar-secret','secret','exports','http://localhost:9000'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x63a5,0x18e));var _0x563a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x63a5[_0x4b055c];return _0x4b62bb;};'use strict';module[_0x563a('0x0')]={'DOMAIN':_0x563a('0x1'),'SESSION_SECRET':_0x563a('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x563a('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x3266=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0xfef84,_0xa9e482){var _0xc2773a=function(_0x5e2e33){while(--_0x5e2e33){_0xfef84['push'](_0xfef84['shift']());}};_0xc2773a(++_0xa9e482);}(_0x3266,0x6a));var _0x6326=function(_0x273dc5,_0x268a81){_0x273dc5=_0x273dc5-0x0;var _0x46dae7=_0x3266[_0x273dc5];return _0x46dae7;};'use strict';module[_0x6326('0x0')]={'DOMAIN':_0x6326('0x1'),'SESSION_SECRET':_0x6326('0x2'),'GOOGLE_ID':_0x6326('0x3'),'GOOGLE_SECRET':_0x6326('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 2d51ce8..b6c9116 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x663f=['fileLogger','exports','../utils/loggers'];(function(_0x4f4664,_0x5a7a50){var _0x324f0a=function(_0x45889c){while(--_0x45889c){_0x4f4664['push'](_0x4f4664['shift']());}};_0x324f0a(++_0x5a7a50);}(_0x663f,0xb6));var _0xf663=function(_0x3452a8,_0x4bfaa4){_0x3452a8=_0x3452a8-0x0;var _0x233814=_0x663f[_0x3452a8];return _0x233814;};'use strict';var fileLogger=require(_0xf663('0x0'))[_0xf663('0x1')];module[_0xf663('0x2')]=fileLogger; \ No newline at end of file +var _0xae2c=['../utils/loggers','fileLogger','exports'];(function(_0x25ee32,_0x2defb6){var _0x1bee35=function(_0x2dcf2f){while(--_0x2dcf2f){_0x25ee32['push'](_0x25ee32['shift']());}};_0x1bee35(++_0x2defb6);}(_0xae2c,0x7e));var _0xcae2=function(_0x2a8928,_0x3a4e4c){_0x2a8928=_0x2a8928-0x0;var _0x3640fe=_0xae2c[_0x2a8928];return _0x3640fe;};'use strict';var fileLogger=require(_0xcae2('0x0'))[_0xcae2('0x1')];module[_0xcae2('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index f8b6eeb..6864d6b 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 _0xeae9=['../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','path','../../config/environment','resolve','join','root','express','../../services/express/index.js','ami','../../services/ami/index.js','../../services/agi/index.js','email'];(function(_0x4f53ea,_0x20a1a3){var _0x1b1987=function(_0x1abede){while(--_0x1abede){_0x4f53ea['push'](_0x4f53ea['shift']());}};_0x1b1987(++_0x20a1a3);}(_0xeae9,0x14e));var _0x9eae=function(_0x857d28,_0x13fcd2){_0x857d28=_0x857d28-0x0;var _0x27bfa7=_0xeae9[_0x857d28];return _0x27bfa7;};'use strict';var path=require(_0x9eae('0x0'));var cfg=require(_0x9eae('0x1'));var env={'NODE_PATH':path[_0x9eae('0x2')](path[_0x9eae('0x3')](cfg[_0x9eae('0x4')],'legacy-libs'))};var pm2config={'apps':[{'name':_0x9eae('0x5'),'script':path['join'](__dirname,_0x9eae('0x6')),'env':env},{'name':_0x9eae('0x7'),'script':path['join'](__dirname,_0x9eae('0x8')),'env':env},{'name':'agi','script':path[_0x9eae('0x3')](__dirname,_0x9eae('0x9')),'env':env},{'name':_0x9eae('0xa'),'script':path[_0x9eae('0x3')](__dirname,_0x9eae('0xb')),'env':env},{'name':_0x9eae('0xc'),'script':path[_0x9eae('0x3')](__dirname,_0x9eae('0xd')),'env':env},{'name':'xdr','script':path[_0x9eae('0x3')](__dirname,_0x9eae('0xe')),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0x3a08=['email','../../services/email/index.js','routing','exports','path','join','root','express','ami','../../services/ami/index.js','agi'];(function(_0x5428f2,_0x1ab767){var _0x4d2181=function(_0x3d9277){while(--_0x3d9277){_0x5428f2['push'](_0x5428f2['shift']());}};_0x4d2181(++_0x1ab767);}(_0x3a08,0x1a6));var _0x83a0=function(_0x2910c7,_0x4adc50){_0x2910c7=_0x2910c7-0x0;var _0xa2c848=_0x3a08[_0x2910c7];return _0xa2c848;};'use strict';var path=require(_0x83a0('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path['resolve'](path[_0x83a0('0x1')](cfg[_0x83a0('0x2')],'legacy-libs'))};var pm2config={'apps':[{'name':_0x83a0('0x3'),'script':path[_0x83a0('0x1')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0x83a0('0x4'),'script':path[_0x83a0('0x1')](__dirname,_0x83a0('0x5')),'env':env},{'name':_0x83a0('0x6'),'script':path[_0x83a0('0x1')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x83a0('0x7'),'script':path['join'](__dirname,_0x83a0('0x8')),'env':env},{'name':_0x83a0('0x9'),'script':path[_0x83a0('0x1')](__dirname,'../../services/routing/index.js'),'env':env},{'name':'xdr','script':path[_0x83a0('0x1')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x83a0('0xa')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 9ef5465..0a55db1 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 _0x8cec=['connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird'];(function(_0x329437,_0x1de73a){var _0x3789d9=function(_0x37832e){while(--_0x37832e){_0x329437['push'](_0x329437['shift']());}};_0x3789d9(++_0x1de73a);}(_0x8cec,0xde));var _0xc8ce=function(_0x34f709,_0x462672){_0x34f709=_0x34f709-0x0;var _0x11de47=_0x8cec[_0x34f709];return _0x11de47;};'use strict';var pm2=require(_0xc8ce('0x0'));var BPromise=require(_0xc8ce('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x5d3224,_0x5ad104){return pm2[_0xc8ce('0x2')](function(_0x2725e3){if(_0x2725e3){return _0x5ad104(_0x2725e3);}return _0x5d3224(_0xc8ce('0x3'));});});};exports[_0xc8ce('0x4')]=function(_0x559a80){return connect()[_0xc8ce('0x5')](function(){return new BPromise(function(_0x1ec536,_0x108418){return pm2[_0xc8ce('0x4')](_0x559a80,function(_0x3df75f,_0x474837){if(_0x3df75f){return _0x108418(_0x3df75f);}pm2[_0xc8ce('0x6')]();return _0x1ec536(_0x474837);});});});};exports[_0xc8ce('0x7')]=function(_0x43d9ef){return connect()[_0xc8ce('0x5')](function(){return new BPromise(function(_0x23992a,_0x4b996e){return pm2[_0xc8ce('0x7')](_0x43d9ef,function(_0x1a60b1,_0x2a2894){if(_0x1a60b1){return _0x4b996e(_0x1a60b1);}pm2[_0xc8ce('0x6')]();return _0x23992a(_0x2a2894);});});});};exports[_0xc8ce('0x8')]=function(_0x5aa130){return connect()[_0xc8ce('0x5')](function(){return new BPromise(function(_0xd0f287,_0x76df7c){return pm2[_0xc8ce('0x8')](_0x5aa130,function(_0x585bcd,_0x3ed32f){if(_0x585bcd){return _0x76df7c(_0x585bcd);}pm2['disconnect']();return _0xd0f287(_0x3ed32f);});});});};exports[_0xc8ce('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x46ed2e,_0x17c97e){return pm2['list'](function(_0x164a48,_0x2a3bd7){if(_0x164a48){return _0x17c97e(_0x164a48);}pm2[_0xc8ce('0x6')]();return _0x46ed2e(_0x2a3bd7);});});});};exports[_0xc8ce('0xa')]=function(_0x229c3c){return connect()[_0xc8ce('0x5')](function(){return new BPromise(function(_0x3b931a,_0x407ef6){return pm2[_0xc8ce('0xa')](_0x229c3c,function(_0x2470d6,_0x14a23b){if(_0x2470d6){return _0x407ef6(_0x2470d6);}pm2[_0xc8ce('0x6')]();return _0x3b931a(_0x14a23b);});});});};exports['delete']=function(_0x4ca6d8){return connect()[_0xc8ce('0x5')](function(){return new BPromise(function(_0xa61241,_0x3e4ab1){return pm2[_0xc8ce('0xb')](_0x4ca6d8,function(_0x45818d,_0xce15ce){if(_0x45818d){return _0x3e4ab1(_0x45818d);}pm2[_0xc8ce('0x6')]();return _0xa61241(_0xce15ce);});});});};exports[_0xc8ce('0xc')]=function(){return connect()[_0xc8ce('0x5')](function(){return new BPromise(function(_0x561068,_0x2bfedc){return pm2[_0xc8ce('0xc')](function(_0xffd8bd){if(_0xffd8bd){return _0x2bfedc(_0xffd8bd);}return _0x561068(_0xc8ce('0xd'));});});});}; \ No newline at end of file +var _0x25e6=['then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','connected'];(function(_0x57cbfb,_0x2de760){var _0x4cb933=function(_0x33cf6a){while(--_0x33cf6a){_0x57cbfb['push'](_0x57cbfb['shift']());}};_0x4cb933(++_0x2de760);}(_0x25e6,0x167));var _0x625e=function(_0x1b2360,_0x2690cf){_0x1b2360=_0x1b2360-0x0;var _0x46749c=_0x25e6[_0x1b2360];return _0x46749c;};'use strict';var pm2=require(_0x625e('0x0'));var BPromise=require(_0x625e('0x1'));var config=require(_0x625e('0x2'));function connect(){return new BPromise(function(_0x5dc7b3,_0x479a41){return pm2[_0x625e('0x3')](function(_0xbc3632){if(_0xbc3632){return _0x479a41(_0xbc3632);}return _0x5dc7b3(_0x625e('0x4'));});});};exports['start']=function(_0x906ad4){return connect()[_0x625e('0x5')](function(){return new BPromise(function(_0x206d34,_0x135dcd){return pm2['start'](_0x906ad4,function(_0x10326d,_0x90c940){if(_0x10326d){return _0x135dcd(_0x10326d);}pm2[_0x625e('0x6')]();return _0x206d34(_0x90c940);});});});};exports['stop']=function(_0x576781){return connect()[_0x625e('0x5')](function(){return new BPromise(function(_0xc7ee75,_0x11f219){return pm2[_0x625e('0x7')](_0x576781,function(_0x51c897,_0x560b88){if(_0x51c897){return _0x11f219(_0x51c897);}pm2['disconnect']();return _0xc7ee75(_0x560b88);});});});};exports[_0x625e('0x8')]=function(_0x500c3b){return connect()[_0x625e('0x5')](function(){return new BPromise(function(_0x2559a6,_0x300c51){return pm2[_0x625e('0x8')](_0x500c3b,function(_0x2cf8b9,_0x42565d){if(_0x2cf8b9){return _0x300c51(_0x2cf8b9);}pm2['disconnect']();return _0x2559a6(_0x42565d);});});});};exports[_0x625e('0x9')]=function(){return connect()[_0x625e('0x5')](function(){return new BPromise(function(_0x3c8f46,_0xe7a59c){return pm2['list'](function(_0x399db0,_0x4d3e5f){if(_0x399db0){return _0xe7a59c(_0x399db0);}pm2[_0x625e('0x6')]();return _0x3c8f46(_0x4d3e5f);});});});};exports[_0x625e('0xa')]=function(_0x2b4629){return connect()['then'](function(){return new BPromise(function(_0x25f411,_0x173748){return pm2[_0x625e('0xa')](_0x2b4629,function(_0x57258d,_0x5df686){if(_0x57258d){return _0x173748(_0x57258d);}pm2[_0x625e('0x6')]();return _0x25f411(_0x5df686);});});});};exports['delete']=function(_0x4b27cc){return connect()[_0x625e('0x5')](function(){return new BPromise(function(_0x4ae63d,_0x48bd5c){return pm2[_0x625e('0xb')](_0x4b27cc,function(_0x340a33,_0x5b2419){if(_0x340a33){return _0x48bd5c(_0x340a33);}pm2[_0x625e('0x6')]();return _0x4ae63d(_0x5b2419);});});});};exports[_0x625e('0xc')]=function(){return connect()[_0x625e('0x5')](function(){return new BPromise(function(_0x3c42ea,_0x5ec345){return pm2[_0x625e('0xc')](function(_0x1c0fa7){if(_0x1c0fa7){return _0x5ec345(_0x1c0fa7);}return _0x3c42ea(_0x625e('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 1fd3271..9b8b584 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 _0x2873=['chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0x3cc64a,_0xd5a062){var _0x1733ef=function(_0x2992c0){while(--_0x2992c0){_0x3cc64a['push'](_0x3cc64a['shift']());}};_0x1733ef(++_0xd5a062);}(_0x2873,0x14f));var _0x3287=function(_0x1b9cf5,_0x56ee7f){_0x1b9cf5=_0x1b9cf5-0x0;var _0x6f7bff=_0x2873[_0x1b9cf5];return _0x6f7bff;};'use strict';var _=require(_0x3287('0x0'));var moment=require('moment');var Redis=require(_0x3287('0x1'));var util=require('util');var config=require(_0x3287('0x2'));var db=require(_0x3287('0x3'))['db'];var logger=require(_0x3287('0x4'))(_0x3287('0x5'));config[_0x3287('0x6')]=_[_0x3287('0x7')](config[_0x3287('0x6')],{'host':_0x3287('0x8'),'port':0x18eb});var io=require(_0x3287('0x9'))(new Redis(config[_0x3287('0x6')]));function closeInteractions(){var _0x43ce1b=0x0;var _0x4314c2=[];return db[_0x3287('0xa')][_0x3287('0xb')]({'raw':!![],'attributes':['id',_0x3287('0xc')],'where':{'id':0x1}})[_0x3287('0xd')](function(_0x30b359){_0x43ce1b=_0x30b359[_0x3287('0xc')];if(_0x43ce1b){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id',_0x3287('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x3287('0xf')](_0x30b359[_0x3287('0xc')],_0x3287('0x10'))}}});}else{return[];}})[_0x3287('0xd')](function(_0x7a5958){if(_0x7a5958&&_0x7a5958[_0x3287('0x11')]){_0x4314c2=_[_0x3287('0x12')](_0x7a5958||[],'id');logger[_0x3287('0x13')](_0x3287('0x14'),_0x4314c2[_0x3287('0x15')]());return db['ChatInteraction'][_0x3287('0x16')]({'closeReason':_0x3287('0x17'),'disposition':_0x3287('0x18'),'closed':!![],'closedAt':moment()[_0x3287('0x19')](_0x3287('0x1a'))},{'where':{'id':_0x4314c2}});}})[_0x3287('0xd')](function(){if(_0x4314c2&&_0x4314c2[_0x3287('0x11')]){logger['info'](_0x3287('0x1b'),_0x4314c2[_0x3287('0x15')]());for(var _0x1ed8c7=0x0;_0x1ed8c7<_0x4314c2[_0x3287('0x11')];_0x1ed8c7++){io['emit'](_0x3287('0x1c'),{'id':_0x4314c2[_0x1ed8c7],'closed':!![]});}}})['catch'](function(_0x294b1c){logger[_0x3287('0x1d')](_0x3287('0x1e'),_0x294b1c?util[_0x3287('0x1f')](_0x294b1c,{'showHidden':![],'depth':null}):'');});}exports[_0x3287('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x185b=['length','map','info','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','subtract'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x185b,0x1ce));var _0xb185=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x185b[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0xb185('0x0'));var moment=require(_0xb185('0x1'));var Redis=require(_0xb185('0x2'));var util=require(_0xb185('0x3'));var config=require(_0xb185('0x4'));var db=require(_0xb185('0x5'))['db'];var logger=require(_0xb185('0x6'))(_0xb185('0x7'));config[_0xb185('0x8')]=_[_0xb185('0x9')](config[_0xb185('0x8')],{'host':_0xb185('0xa'),'port':0x18eb});var io=require(_0xb185('0xb'))(new Redis(config[_0xb185('0x8')]));function closeInteractions(){var _0xcfb5fd=0x0;var _0x52e7da=[];return db[_0xb185('0xc')][_0xb185('0xd')]({'raw':!![],'attributes':['id',_0xb185('0xe')],'where':{'id':0x1}})[_0xb185('0xf')](function(_0xdcf8e8){_0xcfb5fd=_0xdcf8e8[_0xb185('0xe')];if(_0xcfb5fd){return db[_0xb185('0x10')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xb185('0x11')](_0xdcf8e8['chatTimeout'],'minutes')}}});}else{return[];}})[_0xb185('0xf')](function(_0x1594d6){if(_0x1594d6&&_0x1594d6[_0xb185('0x12')]){_0x52e7da=_[_0xb185('0x13')](_0x1594d6||[],'id');logger[_0xb185('0x14')]('[CHAT]\x20Interactions\x20to\x20close:',_0x52e7da['join']());return db[_0xb185('0x10')][_0xb185('0x15')]({'closeReason':_0xb185('0x16'),'disposition':_0xb185('0x17'),'closed':!![],'closedAt':moment()['format'](_0xb185('0x18'))},{'where':{'id':_0x52e7da}});}})[_0xb185('0xf')](function(){if(_0x52e7da&&_0x52e7da[_0xb185('0x12')]){logger[_0xb185('0x14')](_0xb185('0x19'),_0x52e7da[_0xb185('0x1a')]());for(var _0x38279a=0x0;_0x38279a<_0x52e7da[_0xb185('0x12')];_0x38279a++){io[_0xb185('0x1b')](_0xb185('0x1c'),{'id':_0x52e7da[_0x38279a],'closed':!![]});}}})[_0xb185('0x1d')](function(_0x409c41){logger[_0xb185('0x1e')](_0xb185('0x1f'),_0x409c41?util['inspect'](_0x409c41,{'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 8881489..0e2632f 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 _0x7e21=['../../api/cloudProvider/cloudProvider.oauth.js','exports'];(function(_0x4ea955,_0x1eda76){var _0x558561=function(_0x5b20f4){while(--_0x5b20f4){_0x4ea955['push'](_0x4ea955['shift']());}};_0x558561(++_0x1eda76);}(_0x7e21,0x9a));var _0x17e2=function(_0x258b9e,_0x3c0261){_0x258b9e=_0x258b9e-0x0;var _0x125b0f=_0x7e21[_0x258b9e];return _0x125b0f;};'use strict';function start(){var _0x181de7=require(_0x17e2('0x0'));return _0x181de7['startAllRefreshIntervals']();}module[_0x17e2('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x64df=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x4b2546,_0x5a66d8){var _0x4e08d4=function(_0x1c6523){while(--_0x1c6523){_0x4b2546['push'](_0x4b2546['shift']());}};_0x4e08d4(++_0x5a66d8);}(_0x64df,0x19a));var _0xf64d=function(_0x376971,_0x3d9579){_0x376971=_0x376971-0x0;var _0x2286ff=_0x64df[_0x376971];return _0x2286ff;};'use strict';function start(){var _0x35d709=require(_0xf64d('0x0'));return _0x35d709[_0xf64d('0x1')]();}module[_0xf64d('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 5677420..0b6a2b3 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 _0x8143=['../../files/reports','savename','%s.%s','basename','zip','join','existsSync','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','catch','stringify','data','isNil','email','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','toString','keyBy','difference','intersection','length','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','start','add\x20cron','exists','stop\x20cron','update','run','path','moment','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','format','\x22%s\x22\x20<%s>','name','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit'];(function(_0x1c7946,_0x4e274f){var _0xcd40ca=function(_0x4a3bfe){while(--_0x4a3bfe){_0x1c7946['push'](_0x1c7946['shift']());}};_0xcd40ca(++_0x4e274f);}(_0x8143,0x1cd));var _0x3814=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8143[_0x4a9fb1];return _0x348672;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x3814('0x0'));var _=require('lodash');var moment=require(_0x3814('0x1'));var CronJobManager=require(_0x3814('0x2'));var jayson=require('jayson/promise');var BPromise=require(_0x3814('0x3'));var logger=require(_0x3814('0x4'))(_0x3814('0x5'));var db=require(_0x3814('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0x3814('0x7')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x23953e,_0x1be100){return function(){logger[_0x3814('0x8')](_0x3814('0x9'),_0x23953e['email']);var _0x449037=!![];var _0x1c2dd8=_0x23953e[_0x3814('0xa')]['getSmtpOptions']();var _0x7b54d={'account':_0x1c2dd8,'message':{'from':util[_0x3814('0xb')](_0x3814('0xc'),_0x23953e['MailAccount'][_0x3814('0xd')],_0x23953e[_0x3814('0xa')]['email']||_0x23953e['MailAccount'][_0x3814('0xe')]['user']),'to':_0x23953e['email'],'cc':_0x23953e['cc'],'bcc':_0x23953e[_0x3814('0xf')],'subject':util[_0x3814('0xb')](_0x3814('0x10'),_0x1be100[_0x3814('0xd')],_0x23953e[_0x3814('0x11')],_0x23953e[_0x3814('0x12')])}};var _0x211b71=path['join'](__dirname,_0x3814('0x13'));var _0xcbf6f5=_0x1be100[_0x3814('0x14')];var _0x4c3071=util[_0x3814('0xb')](_0x3814('0x15'),path[_0x3814('0x16')](_0x1be100[_0x3814('0x14')],path['extname'](_0x1be100['savename'])),_0x3814('0x17'));var _0xc3f9f5=path[_0x3814('0x18')](_0x211b71,_0xcbf6f5);var _0x39a2e8=path[_0x3814('0x18')](_0x211b71,_0x4c3071);if(fs[_0x3814('0x19')](_0xc3f9f5)){_0x1be100['status']=_0x3814('0x1a');_0x7b54d[_0x3814('0x1b')]['attachments']=[{'filename':_0xcbf6f5,'path':_0xc3f9f5}];_0x7b54d[_0x3814('0x1b')][_0x3814('0x1c')]=util[_0x3814('0xb')](_0x3814('0x1d'),JSON['stringify'](_0x1be100,null,0x2));}else if(fs[_0x3814('0x19')](_0x39a2e8)){_0x1be100['status']=_0x3814('0x1a');_0x7b54d['message']['attachments']=[{'filename':_0x4c3071,'path':_0x39a2e8}];}else{_0x7b54d[_0x3814('0x1b')][_0x3814('0x1c')]=_0x3814('0x1e');if(!_0x23953e[_0x3814('0x1f')]){_0x449037=![];logger[_0x3814('0x8')](_0x3814('0x20'));}}if(_0x449037){return client[_0x3814('0x21')](_0x3814('0x22'),_0x7b54d)[_0x3814('0x23')](function(_0x47b1ec){if(_0x47b1ec[_0x3814('0x24')]){return logger[_0x3814('0x24')](_0x3814('0x25'),JSON['stringify'](_0x47b1ec));}return logger['info']('email\x20sent');})[_0x3814('0x26')](function(_0x3ae86a){return logger['error']('error\x20mail',JSON['stringify'](_0x3ae86a));});}};}function handleError(){return function(_0x11fbb8){return logger['error'](JSON[_0x3814('0x27')](_0x11fbb8));};}function handleResult(_0x1bdd39){return function(_0x5545ad){logger[_0x3814('0x8')](_0x3814('0x28'),JSON['stringify'](_0x5545ad));if(_0x1bdd39[_0x3814('0xa')]&&_0x1bdd39['MailAccount'][_0x3814('0xe')]&&!_[_0x3814('0x29')](_0x1bdd39[_0x3814('0x2a')])){setTimeout(handleSendEmail(_0x1bdd39,_0x5545ad),0x3c*0x3e8);}};}function handleJob(_0x316ed1){return function(){try{if(_[_0x3814('0x29')](_0x316ed1[_0x3814('0x11')])){return logger[_0x3814('0x8')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x3814('0x29')](_0x316ed1[_0x3814('0x12')])){return logger['info'](_0x3814('0x2b'));}var _0x159e73={'startDate':moment()[_0x3814('0x2c')](_0x316ed1['subtractNumber'],_0x316ed1['subtractUnit'])['format'](_0x3814('0x2d')),'endDate':moment()[_0x3814('0xb')](_0x3814('0x2d')),'type':_0x3814('0x2e'),'output':_0x316ed1[_0x3814('0x2f')],'name':_0x316ed1['name']};if(!_[_0x3814('0x29')](_0x316ed1[_0x3814('0x30')])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x316ed1[_0x3814('0x30')]);return analyticDefaultReportController[_0x3814('0x31')]({'id':_0x316ed1['DefaultReportId']},_0x159e73)['then'](handleResult(_0x316ed1))[_0x3814('0x26')](handleError());}if(!_[_0x3814('0x29')](_0x316ed1[_0x3814('0x32')])){logger[_0x3814('0x8')]('exec\x20custom\x20report\x20id:%s',_0x316ed1['CustomReportId']);return analyticCustomReportController[_0x3814('0x31')]({'id':_0x316ed1[_0x3814('0x32')]},_0x159e73)[_0x3814('0x23')](handleResult(_0x316ed1))['catch'](handleError());}}catch(_0x472ffd){logger[_0x3814('0x24')](JSON[_0x3814('0x27')](_0x472ffd));}return logger[_0x3814('0x8')](_0x3814('0x33'));};}function getJobs(_0x31d428){var _0xcc12d4={};if(_0x31d428){_0xcc12d4['id']=_0x31d428;}return db[_0x3814('0x34')][_0x3814('0x35')]({'where':_0xcc12d4,'include':[{'model':db[_0x3814('0xa')],'attributes':['id','name','email'],'include':[{'model':db[_0x3814('0x36')],'as':'Smtp','include':[{'model':db[_0x3814('0x37')],'as':_0x3814('0x37')}]}]}]})['then'](function(_0x1b07c9){var _0x18d2eb=_['keys'](manager['jobs']);var _0x2389cb=_['map'](_0x1b07c9,function(_0x5b7818){return _0x5b7818['id'][_0x3814('0x38')]();});var _0x1ff684=_[_0x3814('0x39')](_0x1b07c9,function(_0x179aca){return _0x179aca['id'][_0x3814('0x38')]();});var _0x1665fb=_0x31d428?_0x2389cb:_[_0x3814('0x3a')](_0x2389cb,_0x18d2eb);var _0x494c96=_[_0x3814('0x3b')](_0x2389cb,_0x18d2eb);var _0x2fa0d3=_[_0x3814('0x3a')](_0x18d2eb,_0x2389cb);var _0x4101ab;var _0x147c95;for(_0x4101ab=0x0;_0x4101ab<_0x2fa0d3[_0x3814('0x3c')]&&!_0x31d428;_0x4101ab+=0x1){_0x147c95=_0x2fa0d3[_0x4101ab][_0x3814('0x38')]();if(manager['exists'](_0x147c95)){manager[_0x3814('0x3d')](_0x147c95);manager[_0x3814('0x3e')](_0x147c95);logger[_0x3814('0x8')](_0x3814('0x3f'),_0x147c95);}}logger[_0x3814('0x8')](_0x3814('0x40'),JSON[_0x3814('0x27')](_0x1665fb));for(_0x4101ab=0x0;_0x4101ab<_0x1665fb[_0x3814('0x3c')];_0x4101ab+=0x1){_0x147c95=_0x1665fb[_0x4101ab][_0x3814('0x38')]();logger[_0x3814('0x8')](_0x3814('0x41'),_0x147c95);if(_0x31d428){logger[_0x3814('0x8')](_0x3814('0x42'),_0x31d428);logger[_0x3814('0x8')](JSON[_0x3814('0x27')](_0x1ff684[_0x147c95]));BPromise[_0x3814('0x43')]()[_0x3814('0x23')](handleJob(_0x1ff684[_0x147c95]));logger[_0x3814('0x8')](_0x3814('0x44'),_0x1ff684[_0x147c95][_0x3814('0xd')],_0x1ff684[_0x147c95]['cron']);}else if(_0x1ff684[_0x147c95][_0x3814('0x45')]&&_0x1ff684[_0x147c95][_0x3814('0x46')]&&moment()[_0x3814('0x47')](_0x1ff684[_0x147c95][_0x3814('0x48')],_0x1ff684[_0x147c95][_0x3814('0x49')])){manager['add'](_0x147c95,_0x1ff684[_0x147c95][_0x3814('0x45')],handleJob(_0x1ff684[_0x147c95]));manager[_0x3814('0x4a')](_0x147c95);logger[_0x3814('0x8')](_0x3814('0x4b'),_0x1ff684[_0x147c95][_0x3814('0xd')],_0x1ff684[_0x147c95][_0x3814('0x45')]);}else if(manager[_0x3814('0x4c')](_0x147c95)){manager['stop'](_0x147c95);manager['deleteJob'](_0x147c95);logger['info'](_0x3814('0x4d'),_0x1ff684[_0x147c95][_0x3814('0xd')],_0x1ff684[_0x147c95][_0x3814('0x45')]);}}for(_0x4101ab=0x0,_0x147c95;_0x4101ab<_0x494c96[_0x3814('0x3c')]&&!_0x31d428;_0x4101ab+=0x1){_0x147c95=_0x494c96[_0x4101ab]['toString']();if(manager[_0x3814('0x4c')](_0x147c95)){if(_0x1ff684[_0x147c95][_0x3814('0x45')]&&_0x1ff684[_0x147c95][_0x3814('0x46')]&&moment()['isBetween'](_0x1ff684[_0x147c95]['startAt'],_0x1ff684[_0x147c95][_0x3814('0x49')])){manager[_0x3814('0x4e')](_0x147c95,_0x1ff684[_0x147c95][_0x3814('0x45')],handleJob(_0x1ff684[_0x147c95]));logger[_0x3814('0x8')]('update\x20cron',_0x1ff684[_0x147c95][_0x3814('0xd')],_0x1ff684[_0x147c95][_0x3814('0x45')]);}else{manager['stop'](_0x147c95);manager['deleteJob'](_0x147c95);logger[_0x3814('0x8')](_0x3814('0x4d'),_0x1ff684[_0x147c95][_0x3814('0xd')],_0x1ff684[_0x147c95][_0x3814('0x45')]);}}}})[_0x3814('0x26')](function(_0x3dccbc){logger['error'](JSON[_0x3814('0x27')](_0x3dccbc));});}exports[_0x3814('0x4f')]=function(_0xb37e71){return getJobs(_0xb37e71);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xd1dc=['../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','name','email','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','text','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','then','error','error\x20mail','email\x20sent','catch','data','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','isNil','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','MailServerOut','Smtp','CloudProvider','keys','map','keyBy','toString','intersection','exists','delete\x20cron','toRun','length','run\x20job','cron','isBetween','startAt','endAt','add','start','add\x20cron','stop','stop\x20cron','active','update','update\x20cron','deleteJob','run','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xd1dc,0xfa));var _0xcd1d=function(_0x2d304d,_0x462fb5){_0x2d304d=_0x2d304d-0x0;var _0x16be9a=_0xd1dc[_0x2d304d];return _0x16be9a;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xcd1d('0x0'));var _=require(_0xcd1d('0x1'));var moment=require(_0xcd1d('0x2'));var CronJobManager=require(_0xcd1d('0x3'));var jayson=require(_0xcd1d('0x4'));var BPromise=require(_0xcd1d('0x5'));var logger=require('../logger')(_0xcd1d('0x6'));var db=require(_0xcd1d('0x7'))['db'];var analyticCustomReportController=require(_0xcd1d('0x8'));var analyticDefaultReportController=require(_0xcd1d('0x9'));var client=jayson['client'][_0xcd1d('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1b99db,_0x156642){return function(){logger[_0xcd1d('0xb')](_0xcd1d('0xc'),_0x1b99db['email']);var _0x20439c=!![];var _0x721f27=_0x1b99db[_0xcd1d('0xd')][_0xcd1d('0xe')]();var _0x4b4696={'account':_0x721f27,'message':{'from':util['format'](_0xcd1d('0xf'),_0x1b99db[_0xcd1d('0xd')][_0xcd1d('0x10')],_0x1b99db['MailAccount'][_0xcd1d('0x11')]||_0x1b99db['MailAccount']['Smtp'][_0xcd1d('0x12')]),'to':_0x1b99db[_0xcd1d('0x11')],'cc':_0x1b99db['cc'],'bcc':_0x1b99db[_0xcd1d('0x13')],'subject':util[_0xcd1d('0x14')](_0xcd1d('0x15'),_0x156642[_0xcd1d('0x10')],_0x1b99db[_0xcd1d('0x16')],_0x1b99db[_0xcd1d('0x17')])}};var _0x4a93b5=path[_0xcd1d('0x18')](__dirname,_0xcd1d('0x19'));var _0x4f0d59=_0x156642[_0xcd1d('0x1a')];var _0x37d5a9=util[_0xcd1d('0x14')](_0xcd1d('0x1b'),path[_0xcd1d('0x1c')](_0x156642['savename'],path[_0xcd1d('0x1d')](_0x156642[_0xcd1d('0x1a')])),_0xcd1d('0x1e'));var _0x509aa6=path[_0xcd1d('0x18')](_0x4a93b5,_0x4f0d59);var _0x153ab3=path[_0xcd1d('0x18')](_0x4a93b5,_0x37d5a9);if(fs[_0xcd1d('0x1f')](_0x509aa6)){_0x156642[_0xcd1d('0x20')]=_0xcd1d('0x21');_0x4b4696[_0xcd1d('0x22')]['attachments']=[{'filename':_0x4f0d59,'path':_0x509aa6}];_0x4b4696[_0xcd1d('0x22')][_0xcd1d('0x23')]=util[_0xcd1d('0x14')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xcd1d('0x24')](_0x156642,null,0x2));}else if(fs['existsSync'](_0x153ab3)){_0x156642[_0xcd1d('0x20')]=_0xcd1d('0x21');_0x4b4696[_0xcd1d('0x22')]['attachments']=[{'filename':_0x37d5a9,'path':_0x153ab3}];}else{_0x4b4696[_0xcd1d('0x22')][_0xcd1d('0x23')]=_0xcd1d('0x25');if(!_0x1b99db[_0xcd1d('0x26')]){_0x20439c=![];logger[_0xcd1d('0xb')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x20439c){return client[_0xcd1d('0x27')]('SendMail',_0x4b4696)[_0xcd1d('0x28')](function(_0x16713e){if(_0x16713e[_0xcd1d('0x29')]){return logger['error'](_0xcd1d('0x2a'),JSON[_0xcd1d('0x24')](_0x16713e));}return logger[_0xcd1d('0xb')](_0xcd1d('0x2b'));})[_0xcd1d('0x2c')](function(_0x1c63e2){return logger[_0xcd1d('0x29')](_0xcd1d('0x2a'),JSON['stringify'](_0x1c63e2));});}};}function handleError(){return function(_0x1b5ee9){return logger[_0xcd1d('0x29')](JSON[_0xcd1d('0x24')](_0x1b5ee9));};}function handleResult(_0x3c1f20){return function(_0x4b44e3){logger[_0xcd1d('0xb')](_0xcd1d('0x2d'),JSON['stringify'](_0x4b44e3));if(_0x3c1f20[_0xcd1d('0xd')]&&_0x3c1f20[_0xcd1d('0xd')]['Smtp']&&!_['isNil'](_0x3c1f20[_0xcd1d('0x11')])){setTimeout(handleSendEmail(_0x3c1f20,_0x4b44e3),0x3c*0x3e8);}};}function handleJob(_0x4ebd45){return function(){try{if(_['isNil'](_0x4ebd45[_0xcd1d('0x16')])){return logger[_0xcd1d('0xb')](_0xcd1d('0x2e'));}if(_['isNil'](_0x4ebd45['subtractUnit'])){return logger[_0xcd1d('0xb')](_0xcd1d('0x2f'));}var _0x5f37c5={'startDate':moment()['subtract'](_0x4ebd45[_0xcd1d('0x16')],_0x4ebd45[_0xcd1d('0x17')])['format'](_0xcd1d('0x30')),'endDate':moment()[_0xcd1d('0x14')](_0xcd1d('0x30')),'type':_0xcd1d('0x31'),'output':_0x4ebd45[_0xcd1d('0x32')],'name':_0x4ebd45['name']};if(!_[_0xcd1d('0x33')](_0x4ebd45[_0xcd1d('0x34')])){logger[_0xcd1d('0xb')](_0xcd1d('0x35'),_0x4ebd45[_0xcd1d('0x34')]);return analyticDefaultReportController[_0xcd1d('0x36')]({'id':_0x4ebd45[_0xcd1d('0x34')]},_0x5f37c5)[_0xcd1d('0x28')](handleResult(_0x4ebd45))[_0xcd1d('0x2c')](handleError());}if(!_['isNil'](_0x4ebd45['CustomReportId'])){logger[_0xcd1d('0xb')](_0xcd1d('0x37'),_0x4ebd45[_0xcd1d('0x38')]);return analyticCustomReportController[_0xcd1d('0x36')]({'id':_0x4ebd45['CustomReportId']},_0x5f37c5)[_0xcd1d('0x28')](handleResult(_0x4ebd45))['catch'](handleError());}}catch(_0x2d36c9){logger[_0xcd1d('0x29')](JSON[_0xcd1d('0x24')](_0x2d36c9));}return logger[_0xcd1d('0xb')](_0xcd1d('0x39'));};}function getJobs(_0x5ce803){var _0xe3ec70={};if(_0x5ce803){_0xe3ec70['id']=_0x5ce803;}return db[_0xcd1d('0x3a')]['findAll']({'where':_0xe3ec70,'include':[{'model':db[_0xcd1d('0xd')],'attributes':['id',_0xcd1d('0x10'),_0xcd1d('0x11')],'include':[{'model':db[_0xcd1d('0x3b')],'as':_0xcd1d('0x3c'),'include':[{'model':db[_0xcd1d('0x3d')],'as':'CloudProvider'}]}]}]})[_0xcd1d('0x28')](function(_0x37e357){var _0x469d7a=_[_0xcd1d('0x3e')](manager['jobs']);var _0x4c80e2=_[_0xcd1d('0x3f')](_0x37e357,function(_0x5d305f){return _0x5d305f['id']['toString']();});var _0x117125=_[_0xcd1d('0x40')](_0x37e357,function(_0x184371){return _0x184371['id'][_0xcd1d('0x41')]();});var _0xd4bfb8=_0x5ce803?_0x4c80e2:_['difference'](_0x4c80e2,_0x469d7a);var _0x4eb1b1=_[_0xcd1d('0x42')](_0x4c80e2,_0x469d7a);var _0x5e0c91=_['difference'](_0x469d7a,_0x4c80e2);var _0x5a846a;var _0x43cb4e;for(_0x5a846a=0x0;_0x5a846a<_0x5e0c91['length']&&!_0x5ce803;_0x5a846a+=0x1){_0x43cb4e=_0x5e0c91[_0x5a846a][_0xcd1d('0x41')]();if(manager[_0xcd1d('0x43')](_0x43cb4e)){manager['stop'](_0x43cb4e);manager['deleteJob'](_0x43cb4e);logger[_0xcd1d('0xb')](_0xcd1d('0x44'),_0x43cb4e);}}logger['info'](_0xcd1d('0x45'),JSON[_0xcd1d('0x24')](_0xd4bfb8));for(_0x5a846a=0x0;_0x5a846a<_0xd4bfb8[_0xcd1d('0x46')];_0x5a846a+=0x1){_0x43cb4e=_0xd4bfb8[_0x5a846a][_0xcd1d('0x41')]();logger[_0xcd1d('0xb')]('index',_0x43cb4e);if(_0x5ce803){logger[_0xcd1d('0xb')]('my\x20id',_0x5ce803);logger[_0xcd1d('0xb')](JSON[_0xcd1d('0x24')](_0x117125[_0x43cb4e]));BPromise['resolve']()[_0xcd1d('0x28')](handleJob(_0x117125[_0x43cb4e]));logger['info'](_0xcd1d('0x47'),_0x117125[_0x43cb4e][_0xcd1d('0x10')],_0x117125[_0x43cb4e][_0xcd1d('0x48')]);}else if(_0x117125[_0x43cb4e][_0xcd1d('0x48')]&&_0x117125[_0x43cb4e]['active']&&moment()[_0xcd1d('0x49')](_0x117125[_0x43cb4e][_0xcd1d('0x4a')],_0x117125[_0x43cb4e][_0xcd1d('0x4b')])){manager[_0xcd1d('0x4c')](_0x43cb4e,_0x117125[_0x43cb4e][_0xcd1d('0x48')],handleJob(_0x117125[_0x43cb4e]));manager[_0xcd1d('0x4d')](_0x43cb4e);logger[_0xcd1d('0xb')](_0xcd1d('0x4e'),_0x117125[_0x43cb4e]['name'],_0x117125[_0x43cb4e]['cron']);}else if(manager[_0xcd1d('0x43')](_0x43cb4e)){manager[_0xcd1d('0x4f')](_0x43cb4e);manager['deleteJob'](_0x43cb4e);logger['info'](_0xcd1d('0x50'),_0x117125[_0x43cb4e][_0xcd1d('0x10')],_0x117125[_0x43cb4e][_0xcd1d('0x48')]);}}for(_0x5a846a=0x0,_0x43cb4e;_0x5a846a<_0x4eb1b1['length']&&!_0x5ce803;_0x5a846a+=0x1){_0x43cb4e=_0x4eb1b1[_0x5a846a][_0xcd1d('0x41')]();if(manager[_0xcd1d('0x43')](_0x43cb4e)){if(_0x117125[_0x43cb4e][_0xcd1d('0x48')]&&_0x117125[_0x43cb4e][_0xcd1d('0x51')]&&moment()[_0xcd1d('0x49')](_0x117125[_0x43cb4e][_0xcd1d('0x4a')],_0x117125[_0x43cb4e][_0xcd1d('0x4b')])){manager[_0xcd1d('0x52')](_0x43cb4e,_0x117125[_0x43cb4e][_0xcd1d('0x48')],handleJob(_0x117125[_0x43cb4e]));logger['info'](_0xcd1d('0x53'),_0x117125[_0x43cb4e][_0xcd1d('0x10')],_0x117125[_0x43cb4e]['cron']);}else{manager['stop'](_0x43cb4e);manager[_0xcd1d('0x54')](_0x43cb4e);logger[_0xcd1d('0xb')]('stop\x20cron',_0x117125[_0x43cb4e][_0xcd1d('0x10')],_0x117125[_0x43cb4e][_0xcd1d('0x48')]);}}}})[_0xcd1d('0x2c')](function(_0x24094f){logger[_0xcd1d('0x29')](JSON['stringify'](_0x24094f));});}exports[_0xcd1d('0x55')]=function(_0x2215d8){return getJobs(_0x2215d8);};exports[_0xcd1d('0x4d')]=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 5148d6a..9997fc3 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 _0x7fce=['TranscribeService','getTranscriptionJob','Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','COMPLETED','TranscriptionJob','TranscriptionJobStatus','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','then','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','sentimentAccountId','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data2','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20configured','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','bucket','Transcribe\x20not\x20configured','forEach','push','all','start','lodash','aws-sdk','request-promise','bluebird','../../config/logger'];(function(_0x2d2b23,_0x21f14f){var _0x37a236=function(_0x470fe3){while(--_0x470fe3){_0x2d2b23['push'](_0x2d2b23['shift']());}};_0x37a236(++_0x21f14f);}(_0x7fce,0xdc));var _0xe7fc=function(_0x652532,_0x58f4fa){_0x652532=_0x652532-0x0;var _0x5deab7=_0x7fce[_0x652532];return _0x5deab7;};var _=require(_0xe7fc('0x0'));var AWS=require(_0xe7fc('0x1'));var rp=require(_0xe7fc('0x2'));var util=require('util');var BPromise=require(_0xe7fc('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xe7fc('0x4'))('transcribe');function getTranscriptionJob(_0x11cdec,_0x337972,_0x5810de,_0x55392f){return new Promise(function(_0x223d07,_0x51c63b){var _0x4665f6=new AWS[(_0xe7fc('0x5'))]({'accessKeyId':_0x337972,'secretAccessKey':_0x11cdec,'region':_0x5810de});_0x4665f6[_0xe7fc('0x6')]({'TranscriptionJobName':_0x55392f},function(_0x19eeef,_0x22fabf){if(_0x19eeef){return _0x51c63b(_0x19eeef);}else{return _0x223d07(_0x22fabf);}});});}function sentiment(_0x525bfd,_0x185203,_0x4a1209,_0xc98c5e,_0x4e16a1){return new Promise(function(_0x16cc1b,_0x1c05d3){var _0x1fcfdd=new AWS[(_0xe7fc('0x7'))]({'accessKeyId':_0x185203,'secretAccessKey':_0x525bfd,'region':_0x4a1209});_0x1fcfdd['detectSentiment']({'Text':_0xc98c5e,'LanguageCode':_0x4e16a1[_0xe7fc('0x8')](0x0,0x2)},function(_0x1bd950,_0x4f9499){if(_0x1bd950){return _0x1c05d3(_0x1bd950);}else{return _0x16cc1b(_0x4f9499);}});});}function checkTranscribeJob(_0x4b8500,_0x243600,_0x59da2e){var _0x38512a;return new BPromise(function(_0x4e32e9,_0x57e027){logger[_0xe7fc('0x9')](util[_0xe7fc('0xa')](_0xe7fc('0xb'),_0x4b8500['id'],_0x4b8500[_0xe7fc('0xc')]));return getTranscriptionJob(_0x59da2e[_0xe7fc('0xd')],_0x59da2e['data2'],_0x243600[_0xe7fc('0xe')],_0x4b8500['transcribeName'])['then'](function(_0x1302e5){logger[_0xe7fc('0x9')](util[_0xe7fc('0xa')](_0xe7fc('0xf'),_0x4b8500['id'],_0x4b8500['transcribeName'],_0x1302e5['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x4b8500['fileText']){switch(_0x1302e5['TranscriptionJob']['TranscriptionJobStatus']){case _0xe7fc('0x10'):var _0x4a59d5={'transcribeStatus':_0x1302e5[_0xe7fc('0x11')][_0xe7fc('0x12')],'fileUri':_0x1302e5[_0xe7fc('0x11')][_0xe7fc('0x13')][_0xe7fc('0x14')]};logger[_0xe7fc('0x9')](util[_0xe7fc('0xa')](_0xe7fc('0x15'),_0x4b8500['id']));return rp({'uri':_0x1302e5['TranscriptionJob'][_0xe7fc('0x13')][_0xe7fc('0x14')],'json':!![]})['then'](function(_0x587dee){logger[_0xe7fc('0x9')](util[_0xe7fc('0xa')](_0xe7fc('0x16'),_0x4b8500['id']));if(_0x587dee&&_0x587dee[_0xe7fc('0x17')]&&_0x587dee[_0xe7fc('0x17')][_0xe7fc('0x18')]&&_0x587dee[_0xe7fc('0x17')][_0xe7fc('0x18')][_0xe7fc('0x19')]){_0x4a59d5[_0xe7fc('0x1a')]='';for(var _0x1d1348=0x0;_0x1d1348<_0x587dee[_0xe7fc('0x17')][_0xe7fc('0x18')]['length'];_0x1d1348++){_0x4a59d5[_0xe7fc('0x1a')]+=_0x587dee[_0xe7fc('0x17')][_0xe7fc('0x18')][_0x1d1348][_0xe7fc('0x1b')]+'';}}return _0x4b8500[_0xe7fc('0x1c')](_0x4a59d5);})[_0xe7fc('0x1d')](function(){logger['info'](util[_0xe7fc('0xa')](_0xe7fc('0x1e'),_0x4b8500['id']));if(!_0x4b8500[_0xe7fc('0x1f')]){throw new db[(_0xe7fc('0x20'))][(_0xe7fc('0x21'))](_0xe7fc('0x22'));}if(!_0x243600[_0xe7fc('0x23')]||!_0x243600['sentimentAccountId']||!_0x243600[_0xe7fc('0x24')]||!_0x243600[_0xe7fc('0x25')]||!_0x243600['bucket']){throw new db[(_0xe7fc('0x20'))]['ValidationError'](_0xe7fc('0x26'));}if(!_0x4a59d5[_0xe7fc('0x1a')]){throw new Error('Transcript\x20not\x20available');}if(_0x243600[_0xe7fc('0x27')]===_0x59da2e['id']){return _0x59da2e;}else{return db['CloudProvider'][_0xe7fc('0x28')]({'where':{'id':_settings[_0xe7fc('0x27')]}});}})[_0xe7fc('0x1d')](function(_0x48389c){if(!_0x48389c){throw new db[(_0xe7fc('0x20'))]['ValidationError'](_0xe7fc('0x29'));}if(!_0x48389c[_0xe7fc('0xd')]||!_0x48389c['data2']){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x38512a=_0x48389c;logger[_0xe7fc('0x9')](util[_0xe7fc('0xa')](_0xe7fc('0x2a'),_0x4b8500['id']));return sentiment(_0x38512a[_0xe7fc('0xd')],_0x38512a[_0xe7fc('0x2b')],_0x243600[_0xe7fc('0x24')],_0x4a59d5[_0xe7fc('0x1a')],_0x243600[_0xe7fc('0x25')]);})[_0xe7fc('0x1d')](function(_0x18f046){logger['info'](util[_0xe7fc('0xa')](_0xe7fc('0x2c'),_0x4b8500['id']));return _0x4b8500[_0xe7fc('0x1c')]({'sentiment':_0x18f046[_0xe7fc('0x2d')],'sPositive':_0x18f046[_0xe7fc('0x2e')]['Positive'],'sNegative':_0x18f046[_0xe7fc('0x2e')][_0xe7fc('0x2f')],'sMixed':_0x18f046[_0xe7fc('0x2e')][_0xe7fc('0x30')],'sNeutral':_0x18f046[_0xe7fc('0x2e')][_0xe7fc('0x31')]});})[_0xe7fc('0x1d')](function(){logger[_0xe7fc('0x9')](util[_0xe7fc('0xa')](_0xe7fc('0x1e'),_0x4b8500['id']));_0x4e32e9();});case _0xe7fc('0x32'):return _0x4b8500[_0xe7fc('0x1c')]({'transcribeStatus':'FAILED','failureReason':_0x1302e5[_0xe7fc('0x11')][_0xe7fc('0x33')]})[_0xe7fc('0x1d')](function(){logger[_0xe7fc('0x9')](util[_0xe7fc('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4b8500['id']));_0x4e32e9();});default:logger[_0xe7fc('0x9')](util[_0xe7fc('0xa')](_0xe7fc('0x34'),_0x4b8500['id']));break;}}else{return BPromise[_0xe7fc('0x35')]()[_0xe7fc('0x1d')](function(){if(!_0x4b8500[_0xe7fc('0x1f')]){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x243600['sentiment']||!_0x243600['sentimentAccountId']||!_0x243600[_0xe7fc('0x24')]||!_0x243600[_0xe7fc('0x25')]||!_0x243600['bucket']){throw new db[(_0xe7fc('0x20'))]['ValidationError'](_0xe7fc('0x26'));}if(!_0x4b8500[_0xe7fc('0x1a')]){throw new Error(_0xe7fc('0x36'));}if(_0x243600[_0xe7fc('0x27')]===_0x59da2e['id']){return _0x59da2e;}else{return db[_0xe7fc('0x37')][_0xe7fc('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xe7fc('0x1d')](function(_0x5612c6){if(!_0x5612c6){throw new db[(_0xe7fc('0x20'))][(_0xe7fc('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5612c6[_0xe7fc('0xd')]||!_0x5612c6[_0xe7fc('0x2b')]){throw new db[(_0xe7fc('0x20'))][(_0xe7fc('0x21'))](_0xe7fc('0x38'));}_0x38512a=_0x5612c6;logger[_0xe7fc('0x9')](util[_0xe7fc('0xa')](_0xe7fc('0x2a'),_0x4b8500['id']));return sentiment(_0x38512a[_0xe7fc('0xd')],_0x38512a[_0xe7fc('0x2b')],_0x243600[_0xe7fc('0x24')],_0x4b8500[_0xe7fc('0x1a')],_0x243600[_0xe7fc('0x25')]);})[_0xe7fc('0x1d')](function(_0x30d0c4){logger[_0xe7fc('0x9')](util[_0xe7fc('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4b8500['id']));return _0x4b8500[_0xe7fc('0x1c')]({'sentiment':_0x30d0c4[_0xe7fc('0x2d')],'sPositive':_0x30d0c4[_0xe7fc('0x2e')]['Positive'],'sNegative':_0x30d0c4[_0xe7fc('0x2e')][_0xe7fc('0x2f')],'sMixed':_0x30d0c4[_0xe7fc('0x2e')][_0xe7fc('0x30')],'sNeutral':_0x30d0c4[_0xe7fc('0x2e')]['Neutral'],'transcribeStatus':'COMPLETED'});})[_0xe7fc('0x1d')](function(){logger[_0xe7fc('0x9')](util[_0xe7fc('0xa')](_0xe7fc('0x1e'),_0x4b8500['id']));_0x4e32e9();});}})[_0xe7fc('0x39')](function(_0x4f7ad7){if(_0x4f7ad7){if(!_0x4f7ad7[_0xe7fc('0x3a')]||_0x4f7ad7[_0xe7fc('0x3a')]!==_0xe7fc('0x3b')){logger[_0xe7fc('0x3c')](util[_0xe7fc('0xa')](_0xe7fc('0x3d'),_0x4b8500['id']),util[_0xe7fc('0x3e')](_0x4f7ad7,{'showHidden':![],'depth':null}));}}_0x4e32e9();});});}function checkTranscribe(){var _0x697ddb;var _0x13669e;var _0x45edbf;return db['VoiceRecording'][_0xe7fc('0x3f')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xe7fc('0x1d')](function(_0x380ade){if(!_0x380ade||!_0x380ade[_0xe7fc('0x19')]){throw new db[(_0xe7fc('0x20'))][(_0xe7fc('0x21'))](_0xe7fc('0x40'));}_0x697ddb=_0x380ade;return db[_0xe7fc('0x41')][_0xe7fc('0x28')]({'where':{'id':0x1}});})[_0xe7fc('0x1d')](function(_0x535afb){if(!_0x535afb){throw new db[(_0xe7fc('0x20'))][(_0xe7fc('0x21'))](_0xe7fc('0x42'));}_0x13669e=_0x535afb;if(!_0x13669e[_0xe7fc('0x43')]||!_0x13669e[_0xe7fc('0x44')]||!_0x13669e[_0xe7fc('0xe')]||!_0x13669e['language']||!_0x13669e[_0xe7fc('0x45')]){throw new db[(_0xe7fc('0x20'))][(_0xe7fc('0x21'))](_0xe7fc('0x46'));}return db[_0xe7fc('0x37')][_0xe7fc('0x28')]({'where':{'id':_0x13669e['transcribeAccountId']}});})['then'](function(_0x3d5f19){if(!_0x3d5f19){throw new db['Sequelize']['ValidationError'](_0xe7fc('0x29'));}if(!_0x3d5f19[_0xe7fc('0xd')]||!_0x3d5f19[_0xe7fc('0x2b')]){throw new db[(_0xe7fc('0x20'))][(_0xe7fc('0x21'))](_0xe7fc('0x38'));}_0x45edbf=_0x3d5f19;var _0x3fab1f=[];_0x697ddb[_0xe7fc('0x47')](function(_0x2a4616){_0x3fab1f[_0xe7fc('0x48')](checkTranscribeJob(_0x2a4616,_0x13669e,_0x45edbf));});return BPromise[_0xe7fc('0x49')](_0x3fab1f);})['catch'](function(_0x3a40a7){if(_0x3a40a7){if(!_0x3a40a7['name']||_0x3a40a7[_0xe7fc('0x3a')]!==_0xe7fc('0x3b')){logger[_0xe7fc('0x3c')](util[_0xe7fc('0x3e')](_0x3a40a7,{'showHidden':![],'depth':null}));}}});}exports[_0xe7fc('0x4a')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xede3=['substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data2','transcribeName','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','[RECORDING:%d]\x20Get\x20transcript','Transcript','TranscriptFileUri','then','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','ValidationError','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','data1','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Neutral','FAILED','FailureReason','Sentiment\x20Analysis\x20not\x20configured','Mixed','catch','name','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','start','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment'];(function(_0x15cc7f,_0x5c7341){var _0x3a1583=function(_0xb43227){while(--_0xb43227){_0x15cc7f['push'](_0x15cc7f['shift']());}};_0x3a1583(++_0x5c7341);}(_0xede3,0xc0));var _0x3ede=function(_0x4e4e5f,_0x1cc70b){_0x4e4e5f=_0x4e4e5f-0x0;var _0x53cdc5=_0xede3[_0x4e4e5f];return _0x53cdc5;};var _=require('lodash');var AWS=require(_0x3ede('0x0'));var rp=require('request-promise');var util=require(_0x3ede('0x1'));var BPromise=require(_0x3ede('0x2'));var db=require(_0x3ede('0x3'))['db'];var logger=require(_0x3ede('0x4'))(_0x3ede('0x5'));function getTranscriptionJob(_0x1e463b,_0x10dbc8,_0x450f99,_0xf6f567){return new Promise(function(_0x365db9,_0x328085){var _0x150182=new AWS[(_0x3ede('0x6'))]({'accessKeyId':_0x10dbc8,'secretAccessKey':_0x1e463b,'region':_0x450f99});_0x150182[_0x3ede('0x7')]({'TranscriptionJobName':_0xf6f567},function(_0x583272,_0x428a4b){if(_0x583272){return _0x328085(_0x583272);}else{return _0x365db9(_0x428a4b);}});});}function sentiment(_0x3d308f,_0x4168b5,_0x58ceae,_0x35cea4,_0x555bd){return new Promise(function(_0x177db,_0x377182){var _0x1e5240=new AWS['Comprehend']({'accessKeyId':_0x4168b5,'secretAccessKey':_0x3d308f,'region':_0x58ceae});_0x1e5240[_0x3ede('0x8')]({'Text':_0x35cea4,'LanguageCode':_0x555bd[_0x3ede('0x9')](0x0,0x2)},function(_0x3a22b8,_0xdeba4e){if(_0x3a22b8){return _0x377182(_0x3a22b8);}else{return _0x177db(_0xdeba4e);}});});}function checkTranscribeJob(_0x4a9c49,_0x35c8d4,_0x3b2697){var _0xf1a93b;return new BPromise(function(_0x449111,_0x3875f0){logger[_0x3ede('0xa')](util[_0x3ede('0xb')](_0x3ede('0xc'),_0x4a9c49['id'],_0x4a9c49['transcribeName']));return getTranscriptionJob(_0x3b2697['data1'],_0x3b2697[_0x3ede('0xd')],_0x35c8d4['transcribeRegion'],_0x4a9c49[_0x3ede('0xe')])['then'](function(_0x54ae57){logger[_0x3ede('0xa')](util[_0x3ede('0xb')](_0x3ede('0xf'),_0x4a9c49['id'],_0x4a9c49['transcribeName'],_0x54ae57[_0x3ede('0x10')]['TranscriptionJobStatus']));if(!_0x4a9c49['fileText']){switch(_0x54ae57[_0x3ede('0x10')][_0x3ede('0x11')]){case _0x3ede('0x12'):var _0x54aeb9={'transcribeStatus':_0x54ae57[_0x3ede('0x10')][_0x3ede('0x11')],'fileUri':_0x54ae57[_0x3ede('0x10')]['Transcript']['TranscriptFileUri']};logger[_0x3ede('0xa')](util['format'](_0x3ede('0x13'),_0x4a9c49['id']));return rp({'uri':_0x54ae57['TranscriptionJob'][_0x3ede('0x14')][_0x3ede('0x15')],'json':!![]})[_0x3ede('0x16')](function(_0xf821d9){logger[_0x3ede('0xa')](util[_0x3ede('0xb')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x4a9c49['id']));if(_0xf821d9&&_0xf821d9[_0x3ede('0x17')]&&_0xf821d9[_0x3ede('0x17')][_0x3ede('0x18')]&&_0xf821d9[_0x3ede('0x17')][_0x3ede('0x18')][_0x3ede('0x19')]){_0x54aeb9[_0x3ede('0x1a')]='';for(var _0x44713b=0x0;_0x44713b<_0xf821d9[_0x3ede('0x17')][_0x3ede('0x18')]['length'];_0x44713b++){_0x54aeb9['fileText']+=_0xf821d9[_0x3ede('0x17')][_0x3ede('0x18')][_0x44713b][_0x3ede('0x1b')]+'';}}return _0x4a9c49[_0x3ede('0x1c')](_0x54aeb9);})[_0x3ede('0x16')](function(){logger[_0x3ede('0xa')](util['format'](_0x3ede('0x1d'),_0x4a9c49['id']));if(!_0x4a9c49[_0x3ede('0x1e')]){throw new db[(_0x3ede('0x1f'))]['ValidationError'](_0x3ede('0x20'));}if(!_0x35c8d4[_0x3ede('0x21')]||!_0x35c8d4[_0x3ede('0x22')]||!_0x35c8d4['sentimentRegion']||!_0x35c8d4[_0x3ede('0x23')]||!_0x35c8d4['bucket']){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x54aeb9['fileText']){throw new Error(_0x3ede('0x25'));}if(_0x35c8d4[_0x3ede('0x22')]===_0x3b2697['id']){return _0x3b2697;}else{return db[_0x3ede('0x26')][_0x3ede('0x27')]({'where':{'id':_settings[_0x3ede('0x22')]}});}})[_0x3ede('0x16')](function(_0x41c790){if(!_0x41c790){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x28'));}if(!_0x41c790['data1']||!_0x41c790[_0x3ede('0xd')]){throw new db[(_0x3ede('0x1f'))]['ValidationError'](_0x3ede('0x29'));}_0xf1a93b=_0x41c790;logger[_0x3ede('0xa')](util[_0x3ede('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4a9c49['id']));return sentiment(_0xf1a93b[_0x3ede('0x2a')],_0xf1a93b['data2'],_0x35c8d4[_0x3ede('0x2b')],_0x54aeb9[_0x3ede('0x1a')],_0x35c8d4[_0x3ede('0x23')]);})['then'](function(_0x518543){logger[_0x3ede('0xa')](util[_0x3ede('0xb')](_0x3ede('0x2c'),_0x4a9c49['id']));return _0x4a9c49[_0x3ede('0x1c')]({'sentiment':_0x518543[_0x3ede('0x2d')],'sPositive':_0x518543['SentimentScore'][_0x3ede('0x2e')],'sNegative':_0x518543[_0x3ede('0x2f')][_0x3ede('0x30')],'sMixed':_0x518543[_0x3ede('0x2f')]['Mixed'],'sNeutral':_0x518543[_0x3ede('0x2f')][_0x3ede('0x31')]});})[_0x3ede('0x16')](function(){logger['info'](util['format'](_0x3ede('0x1d'),_0x4a9c49['id']));_0x449111();});case _0x3ede('0x32'):return _0x4a9c49[_0x3ede('0x1c')]({'transcribeStatus':_0x3ede('0x32'),'failureReason':_0x54ae57[_0x3ede('0x10')][_0x3ede('0x33')]})[_0x3ede('0x16')](function(){logger['info'](util[_0x3ede('0xb')](_0x3ede('0x1d'),_0x4a9c49['id']));_0x449111();});default:logger[_0x3ede('0xa')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x4a9c49['id']));break;}}else{return BPromise['resolve']()[_0x3ede('0x16')](function(){if(!_0x4a9c49[_0x3ede('0x1e')]){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x20'));}if(!_0x35c8d4[_0x3ede('0x21')]||!_0x35c8d4[_0x3ede('0x22')]||!_0x35c8d4[_0x3ede('0x2b')]||!_0x35c8d4[_0x3ede('0x23')]||!_0x35c8d4['bucket']){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x34'));}if(!_0x4a9c49['fileText']){throw new Error(_0x3ede('0x25'));}if(_0x35c8d4[_0x3ede('0x22')]===_0x3b2697['id']){return _0x3b2697;}else{return db[_0x3ede('0x26')][_0x3ede('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x222a85){if(!_0x222a85){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x28'));}if(!_0x222a85['data1']||!_0x222a85[_0x3ede('0xd')]){throw new db[(_0x3ede('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0xf1a93b=_0x222a85;logger['info'](util[_0x3ede('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4a9c49['id']));return sentiment(_0xf1a93b['data1'],_0xf1a93b['data2'],_0x35c8d4[_0x3ede('0x2b')],_0x4a9c49[_0x3ede('0x1a')],_0x35c8d4[_0x3ede('0x23')]);})[_0x3ede('0x16')](function(_0x22ae1a){logger[_0x3ede('0xa')](util['format'](_0x3ede('0x2c'),_0x4a9c49['id']));return _0x4a9c49['update']({'sentiment':_0x22ae1a['Sentiment'],'sPositive':_0x22ae1a[_0x3ede('0x2f')][_0x3ede('0x2e')],'sNegative':_0x22ae1a[_0x3ede('0x2f')]['Negative'],'sMixed':_0x22ae1a['SentimentScore'][_0x3ede('0x35')],'sNeutral':_0x22ae1a[_0x3ede('0x2f')][_0x3ede('0x31')],'transcribeStatus':'COMPLETED'});})[_0x3ede('0x16')](function(){logger[_0x3ede('0xa')](util[_0x3ede('0xb')](_0x3ede('0x1d'),_0x4a9c49['id']));_0x449111();});}})[_0x3ede('0x36')](function(_0x34f94a){if(_0x34f94a){if(!_0x34f94a[_0x3ede('0x37')]||_0x34f94a['name']!=='SequelizeValidationError'){logger['error'](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x4a9c49['id']),util[_0x3ede('0x38')](_0x34f94a,{'showHidden':![],'depth':null}));}}_0x449111();});});}function checkTranscribe(){var _0x44ba2a;var _0x13b7a0;var _0x29f801;return db[_0x3ede('0x39')][_0x3ede('0x3a')]({'where':{'transcribeStatus':_0x3ede('0x3b')}})['then'](function(_0x52d97e){if(!_0x52d97e||!_0x52d97e[_0x3ede('0x19')]){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x3c'));}_0x44ba2a=_0x52d97e;return db[_0x3ede('0x3d')][_0x3ede('0x27')]({'where':{'id':0x1}});})['then'](function(_0x3dc3a5){if(!_0x3dc3a5){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x3e'));}_0x13b7a0=_0x3dc3a5;if(!_0x13b7a0[_0x3ede('0x5')]||!_0x13b7a0[_0x3ede('0x3f')]||!_0x13b7a0[_0x3ede('0x40')]||!_0x13b7a0[_0x3ede('0x23')]||!_0x13b7a0['bucket']){throw new db['Sequelize']['ValidationError'](_0x3ede('0x41'));}return db[_0x3ede('0x26')][_0x3ede('0x27')]({'where':{'id':_0x13b7a0[_0x3ede('0x3f')]}});})['then'](function(_0x253773){if(!_0x253773){throw new db[(_0x3ede('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x253773[_0x3ede('0x2a')]||!_0x253773['data2']){throw new db['Sequelize'][(_0x3ede('0x24'))](_0x3ede('0x29'));}_0x29f801=_0x253773;var _0x148c96=[];_0x44ba2a['forEach'](function(_0x2c6981){_0x148c96['push'](checkTranscribeJob(_0x2c6981,_0x13b7a0,_0x29f801));});return BPromise['all'](_0x148c96);})[_0x3ede('0x36')](function(_0x37fbbb){if(_0x37fbbb){if(!_0x37fbbb[_0x3ede('0x37')]||_0x37fbbb['name']!=='SequelizeValidationError'){logger['error'](util[_0x3ede('0x38')](_0x37fbbb,{'showHidden':![],'depth':null}));}}});}exports[_0x3ede('0x42')]=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 3938caa..7102335 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 _0x9e46=['length','map','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','ioredis','util','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','hours','then'];(function(_0x1deee5,_0x1d4485){var _0x1d6c3a=function(_0x433abf){while(--_0x433abf){_0x1deee5['push'](_0x1deee5['shift']());}};_0x1d6c3a(++_0x1d4485);}(_0x9e46,0x16b));var _0x69e4=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9e46[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x69e4('0x0'));var util=require(_0x69e4('0x1'));var config=require(_0x69e4('0x2'));var db=require(_0x69e4('0x3'))['db'];var logger=require('../logger')('schedule');config['redis']=_['defaults'](config[_0x69e4('0x4')],{'host':_0x69e4('0x5'),'port':0x18eb});var io=require(_0x69e4('0x6'))(new Redis(config[_0x69e4('0x4')]));function closeInteractions(){var _0x887781=[];return db[_0x69e4('0x7')][_0x69e4('0x8')]({'raw':!![],'attributes':['id',_0x69e4('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x69e4('0xa'))}}})[_0x69e4('0xb')](function(_0x3b7ce0){if(_0x3b7ce0&&_0x3b7ce0[_0x69e4('0xc')]){_0x887781=_[_0x69e4('0xd')](_0x3b7ce0||[],'id');logger[_0x69e4('0xe')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x887781[_0x69e4('0xf')]());return db[_0x69e4('0x7')][_0x69e4('0x10')]({'closeReason':_0x69e4('0x11'),'disposition':_0x69e4('0x12'),'closed':!![],'closedAt':moment()[_0x69e4('0x13')](_0x69e4('0x14'))},{'where':{'id':_0x887781}});}})[_0x69e4('0xb')](function(){if(_0x887781&&_0x887781[_0x69e4('0xc')]){logger['info'](_0x69e4('0x15'),_0x887781[_0x69e4('0xf')]());for(var _0x18e943=0x0;_0x18e943<_0x887781[_0x69e4('0xc')];_0x18e943++){io['emit']('whatsappInteraction:update',{'id':_0x887781[_0x18e943],'closed':!![]});}}})['catch'](function(_0x35b097){logger['error'](_0x69e4('0x16'),_0x35b097?util[_0x69e4('0x17')](_0x35b097,{'showHidden':![],'depth':null}):'');});}exports[_0x69e4('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xfe39=['catch','error','start','lodash','moment','util','../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','subtract','hours','then','length','map','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update'];(function(_0x5df641,_0x1e66a0){var _0x1a943e=function(_0x4a517c){while(--_0x4a517c){_0x5df641['push'](_0x5df641['shift']());}};_0x1a943e(++_0x1e66a0);}(_0xfe39,0x1b3));var _0x9fe3=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xfe39[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0x9fe3('0x0'));var moment=require(_0x9fe3('0x1'));var Redis=require('ioredis');var util=require(_0x9fe3('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x9fe3('0x3'))(_0x9fe3('0x4'));config['redis']=_['defaults'](config[_0x9fe3('0x5')],{'host':_0x9fe3('0x6'),'port':0x18eb});var io=require(_0x9fe3('0x7'))(new Redis(config[_0x9fe3('0x5')]));function closeInteractions(){var _0xc469b7=[];return db[_0x9fe3('0x8')][_0x9fe3('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x9fe3('0xa')](0x18,_0x9fe3('0xb'))}}})[_0x9fe3('0xc')](function(_0x35c391){if(_0x35c391&&_0x35c391[_0x9fe3('0xd')]){_0xc469b7=_[_0x9fe3('0xe')](_0x35c391||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0xc469b7[_0x9fe3('0xf')]());return db[_0x9fe3('0x8')]['update']({'closeReason':_0x9fe3('0x10'),'disposition':_0x9fe3('0x11'),'closed':!![],'closedAt':moment()[_0x9fe3('0x12')](_0x9fe3('0x13'))},{'where':{'id':_0xc469b7}});}})['then'](function(){if(_0xc469b7&&_0xc469b7[_0x9fe3('0xd')]){logger[_0x9fe3('0x14')](_0x9fe3('0x15'),_0xc469b7[_0x9fe3('0xf')]());for(var _0x573ac1=0x0;_0x573ac1<_0xc469b7['length'];_0x573ac1++){io[_0x9fe3('0x16')](_0x9fe3('0x17'),{'id':_0xc469b7[_0x573ac1],'closed':!![]});}}})[_0x9fe3('0x18')](function(_0x4730d6){logger[_0x9fe3('0x19')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x4730d6?util['inspect'](_0x4730d6,{'showHidden':![],'depth':null}):'');});}exports[_0x9fe3('0x1a')]=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 572af05..8d4f4f7 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x67a0=['hopper1','contacts2','finished\x20populating','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','log','contacts1','CmHopper','bulkCreate'];(function(_0x24c1cd,_0x25a9c0){var _0x41b888=function(_0x19fa21){while(--_0x19fa21){_0x24c1cd['push'](_0x24c1cd['shift']());}};_0x41b888(++_0x25a9c0);}(_0x67a0,0xb9));var _0x067a=function(_0x461503,_0x5f3b58){_0x461503=_0x461503-0x0;var _0x37b514=_0x67a0[_0x461503];return _0x37b514;};'use strict';var util=require(_0x067a('0x0'));var db=require(_0x067a('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x067a('0x2')]({'id':i,'firstName':_0x067a('0x3')+i,'lastName':_0x067a('0x4')+i,'phone':0xf879fb460+i,'email':_0x067a('0x5')+i+_0x067a('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x067a('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x067a('0x7')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x067a('0x2')]({'id':i,'firstName':_0x067a('0x3')+i,'lastName':_0x067a('0x4')+i,'phone':0xf879fb460+i,'email':_0x067a('0x5')+i+_0x067a('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x067a('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x067a('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x067a('0x7')](),'updatedAt':Date[_0x067a('0x7')]()});}db[_0x067a('0x8')][_0x067a('0x9')]({'where':{}})[_0x067a('0xa')](function(){return db[_0x067a('0x8')]['bulkCreate'](contacts);})[_0x067a('0xa')](function(){console[_0x067a('0xb')]('finished\x20populating',_0x067a('0xc'));return db['CmHopper'][_0x067a('0x9')]({'where':{}});})[_0x067a('0xa')](function(){return db[_0x067a('0xd')][_0x067a('0xe')](hopper);})[_0x067a('0xa')](function(){console['log']('finished\x20populating',_0x067a('0xf'));return db[_0x067a('0x8')][_0x067a('0xe')](contacts2);})[_0x067a('0xa')](function(){console['log']('finished\x20populating',_0x067a('0x10'));return db[_0x067a('0xd')][_0x067a('0xe')](hopper2);})['then'](function(){console['log'](_0x067a('0x11'),_0x067a('0x12'));})[_0x067a('0x13')](function(_0x5633de){console[_0x067a('0xb')](_0x5633de);}); \ No newline at end of file +var _0xca7c=['bulkCreate','log','finished\x20populating','CmHopper','hopper1','contacts2','hopper2','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now','CmContact','destroy','then'];(function(_0x2137f7,_0x29c2f2){var _0x12da68=function(_0x1f033f){while(--_0x1f033f){_0x2137f7['push'](_0x2137f7['shift']());}};_0x12da68(++_0x29c2f2);}(_0xca7c,0x7e));var _0xcca7=function(_0xc9b1,_0x22e7db){_0xc9b1=_0xc9b1-0x0;var _0x3fe3fa=_0xca7c[_0xc9b1];return _0x3fe3fa;};'use strict';var util=require('util');var db=require(_0xcca7('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xcca7('0x1')+i,'lastName':_0xcca7('0x2')+i,'phone':0xf879fb460+i,'email':_0xcca7('0x3')+i+_0xcca7('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xcca7('0x5')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xcca7('0x6')](),'updatedAt':Date[_0xcca7('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xcca7('0x1')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xcca7('0x3')+i+_0xcca7('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xcca7('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xcca7('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xcca7('0x6')]()});}db[_0xcca7('0x7')][_0xcca7('0x8')]({'where':{}})[_0xcca7('0x9')](function(){return db[_0xcca7('0x7')][_0xcca7('0xa')](contacts);})[_0xcca7('0x9')](function(){console[_0xcca7('0xb')](_0xcca7('0xc'),'contacts1');return db[_0xcca7('0xd')]['destroy']({'where':{}});})[_0xcca7('0x9')](function(){return db[_0xcca7('0xd')][_0xcca7('0xa')](hopper);})['then'](function(){console[_0xcca7('0xb')](_0xcca7('0xc'),_0xcca7('0xe'));return db[_0xcca7('0x7')][_0xcca7('0xa')](contacts2);})[_0xcca7('0x9')](function(){console[_0xcca7('0xb')](_0xcca7('0xc'),_0xcca7('0xf'));return db['CmHopper'][_0xcca7('0xa')](hopper2);})[_0xcca7('0x9')](function(){console[_0xcca7('0xb')](_0xcca7('0xc'),_0xcca7('0x10'));})['catch'](function(_0x144e5f){console['log'](_0x144e5f);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index e750eca..b0628e1 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe955=['log','add\x20user','catch','../mysqldb','push','format','agent','%s%s','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xe955,0x133));var _0x5e95=function(_0x16b45c,_0x16231d){_0x16b45c=_0x16b45c-0x0;var _0x5bec69=_0xe955[_0x16b45c];return _0x5bec69;};'use strict';var util=require('util');var db=require(_0x5e95('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x5e95('0x1')]({'name':util[_0x5e95('0x2')]('%s%s',_0x5e95('0x3'),i),'fullname':util[_0x5e95('0x2')](_0x5e95('0x4'),'agent',i),'email':util[_0x5e95('0x2')]('%s%s@xcally.com','agent',i),'role':_0x5e95('0x3'),'password':'password','internal':0xfa0+i,'type':_0x5e95('0x5'),'transport':[_0x5e95('0x6'),'ws',_0x5e95('0x7')],'disallow':[_0x5e95('0x8')],'allow':[_0x5e95('0x9')],'defaultuser':util[_0x5e95('0x2')]('%s%s',_0x5e95('0x3'),i),'encryption':_0x5e95('0xa'),'avpf':_0x5e95('0xa'),'force_avp':_0x5e95('0xa'),'icesupport':_0x5e95('0xa'),'dtlsenable':_0x5e95('0xa'),'dtlsverify':'no','dtlscertfile':_0x5e95('0xb'),'dtlsprivatekey':_0x5e95('0xc'),'dtlssetup':_0x5e95('0xd'),'callerid':util['format'](_0x5e95('0xe'),util[_0x5e95('0x2')](_0x5e95('0x4'),'agent',i),0xfa0+i)});}db[_0x5e95('0xf')]['bulkCreate'](users)['then'](function(){console[_0x5e95('0x10')](_0x5e95('0x11'));})[_0x5e95('0x12')](function(_0x2bb2a3){console[_0x5e95('0x10')](_0x2bb2a3);}); \ No newline at end of file +var _0x288e=['actpass','User','bulkCreate','then','log','add\x20user','catch','util','push','format','agent','%s%s','%s%s@xcally.com','password','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key'];(function(_0xd206ce,_0x3031d2){var _0x5b3ec6=function(_0x526993){while(--_0x526993){_0xd206ce['push'](_0xd206ce['shift']());}};_0x5b3ec6(++_0x3031d2);}(_0x288e,0x142));var _0xe288=function(_0x34c7ba,_0x55aec0){_0x34c7ba=_0x34c7ba-0x0;var _0x39aa76=_0x288e[_0x34c7ba];return _0x39aa76;};'use strict';var util=require(_0xe288('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xe288('0x1')]({'name':util[_0xe288('0x2')]('%s%s',_0xe288('0x3'),i),'fullname':util[_0xe288('0x2')](_0xe288('0x4'),_0xe288('0x3'),i),'email':util[_0xe288('0x2')](_0xe288('0x5'),'agent',i),'role':'agent','password':_0xe288('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0xe288('0x7'),'ws',_0xe288('0x8')],'disallow':[_0xe288('0x9')],'allow':[_0xe288('0xa')],'defaultuser':util[_0xe288('0x2')](_0xe288('0x4'),_0xe288('0x3'),i),'encryption':'yes','avpf':_0xe288('0xb'),'force_avp':_0xe288('0xb'),'icesupport':_0xe288('0xb'),'dtlsenable':_0xe288('0xb'),'dtlsverify':'no','dtlscertfile':_0xe288('0xc'),'dtlsprivatekey':_0xe288('0xd'),'dtlssetup':_0xe288('0xe'),'callerid':util['format']('\x22%s\x22\x20<%s>',util['format'](_0xe288('0x4'),'agent',i),0xfa0+i)});}db[_0xe288('0xf')][_0xe288('0x10')](users)[_0xe288('0x11')](function(){console[_0xe288('0x12')](_0xe288('0x13'));})[_0xe288('0x14')](function(_0x2bdf50){console['log'](_0x2bdf50);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 4a50291..2783c6f 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b8e=['format','%s:queue:%s','Agents','length','user:%s','query','find','handshake','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:inbound','userProfileId','FaxQueue','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','openchannel','whatsapp','telephone:%s','trunk:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','log','join','default','address','connection','remoteAddress','request','remotePort','SocketIO\x20','nsp','disconnect','CONNECTED','lodash','bluebird','./environment','User','name','role','agent','telephone','ivr','findOne','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','map','resourceId','where','Campaign','type'];(function(_0x4c637b,_0x326ee8){var _0x5c2e10=function(_0x2674f9){while(--_0x2674f9){_0x4c637b['push'](_0x4c637b['shift']());}};_0x5c2e10(++_0x326ee8);}(_0x8b8e,0x108));var _0xe8b8=function(_0x176496,_0x5f25cd){_0x176496=_0x176496-0x0;var _0x15f71c=_0x8b8e[_0x176496];return _0x15f71c;};'use strict';var _=require(_0xe8b8('0x0'));var util=require('util');var BPromise=require(_0xe8b8('0x1'));var db=require('../mysqldb')['db'];var config=require(_0xe8b8('0x2'));var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0xe8b8('0x3')],'attributes':['id',_0xe8b8('0x4'),_0xe8b8('0x5')],'raw':!![],'where':{'role':_0xe8b8('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xe8b8('0x4')],'where':{'role':_0xe8b8('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xe8b8('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xe8b8('0x4')],'where':{'role':_0xe8b8('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xe8b8('0x4'),'type'],'where':{'type':_0xe8b8('0x8')}};function getAssociatedResources(_0x5cd238,_0x2ce648,_0x4ea70a){return db['UserProfileSection'][_0xe8b8('0x9')]({'where':{'name':_0x5cd238,'userProfileId':_0x2ce648},'raw':!![]})[_0xe8b8('0xa')](function(_0x568241){if(_0x568241){if(_0x568241['autoAssociation']){switch(_0x5cd238){case _0xe8b8('0xb'):case _0xe8b8('0xc'):case _0xe8b8('0xd'):case _0xe8b8('0xe'):case _0xe8b8('0xf'):case _0xe8b8('0x10'):case _0xe8b8('0x11'):return db[_0x4ea70a][_0xe8b8('0x12')](queryQueues);case _0xe8b8('0x13'):return db[_0x4ea70a][_0xe8b8('0x12')](queryTelephones);case _0xe8b8('0x14'):return db[_0x4ea70a][_0xe8b8('0x12')](queryTrunks);case _0xe8b8('0x15'):return db[_0x4ea70a][_0xe8b8('0x12')](queryCampaigns);}}else{return db['UserProfileResource'][_0xe8b8('0x12')]({'attributes':['resourceId'],'where':{'sectionId':_0x568241['id']},'raw':!![]})[_0xe8b8('0xa')](function(_0x290c30){if(_0x290c30){var _0x288699={'where':{'id':_[_0xe8b8('0x16')](_0x290c30,_0xe8b8('0x17'))},'raw':!![]};switch(_0x4ea70a){case _0xe8b8('0x3'):_0x288699[_0xe8b8('0x18')][_0xe8b8('0x5')]=_0xe8b8('0x7');break;case _0xe8b8('0x19'):_0x288699['where'][_0xe8b8('0x1a')]=_0xe8b8('0x8');break;}return db[_0x4ea70a]['findAll'](_0x288699);}else{return[];}});}}else{return[];}})[_0xe8b8('0xa')](function(_0xe48622){return _0xe48622;});}function joinOrLeaveQueues(_0x2b2b80,_0x2f54c3,_0xbd89e,_0x23a0ad){_0x2b2b80[_0x2f54c3](util[_0xe8b8('0x1b')](_0xe8b8('0x1c'),_0xbd89e,_0x23a0ad[_0xe8b8('0x4')]));if(_0x23a0ad[_0xe8b8('0x1d')]){for(var _0x3fdc80=0x0;_0x3fdc80<_0x23a0ad[_0xe8b8('0x1d')][_0xe8b8('0x1e')];_0x3fdc80+=0x1){_0x2b2b80[_0x2f54c3](util[_0xe8b8('0x1b')](_0xe8b8('0x1f'),_0x23a0ad[_0xe8b8('0x1d')][_0x3fdc80][_0xe8b8('0x4')]));}}}function joinOrLeave(_0x56ee42,_0x57faf7,_0x566721){var _0x4769fe;if(_0x56ee42['handshake'][_0xe8b8('0x20')]['id']){db['User'][_0xe8b8('0x21')]({'attributes':['id',_0xe8b8('0x4'),'role','userProfileId'],'where':{'id':_0x56ee42[_0xe8b8('0x22')][_0xe8b8('0x20')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xe8b8('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xe8b8('0x24')],'as':_0xe8b8('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xe8b8('0x26')],'as':_0xe8b8('0x27'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xe8b8('0x28'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xe8b8('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xe8b8('0x2a')],'as':_0xe8b8('0x2b'),'attributes':['id'],'raw':!![]}]})[_0xe8b8('0xa')](function(_0x589877){if(_0x589877){_0x4769fe=_0x589877;_0x56ee42[_0x57faf7](util['format'](_0xe8b8('0x1f'),_0x589877[_0xe8b8('0x4')]));var _0xfe05db=[];switch(_0x589877[_0xe8b8('0x5')]){case _0xe8b8('0x2c'):_0x56ee42[_0x57faf7]('voice:inbound');_0x56ee42[_0x57faf7](_0xe8b8('0x2d'));if(queryQueues[_0xe8b8('0x2e')](_0xe8b8('0x2f'))){delete queryQueues[_0xe8b8('0x2f')];}_0xfe05db[_0xe8b8('0x30')](db[_0xe8b8('0x31')][_0xe8b8('0x12')](queryQueues));_0xfe05db[_0xe8b8('0x30')](db[_0xe8b8('0x32')][_0xe8b8('0x12')](queryQueues));_0xfe05db[_0xe8b8('0x30')](db['FaxQueue'][_0xe8b8('0x12')](queryQueues));_0xfe05db[_0xe8b8('0x30')](db[_0xe8b8('0x33')]['findAll'](queryQueues));_0xfe05db[_0xe8b8('0x30')](db[_0xe8b8('0x34')][_0xe8b8('0x12')](queryQueues));_0xfe05db[_0xe8b8('0x30')](db[_0xe8b8('0x35')][_0xe8b8('0x12')](queryQueues));_0xfe05db[_0xe8b8('0x30')](db[_0xe8b8('0x36')][_0xe8b8('0x12')](queryQueues));_0xfe05db['push'](db[_0xe8b8('0x3')][_0xe8b8('0x12')](queryTelephones));_0xfe05db['push'](db[_0xe8b8('0x37')][_0xe8b8('0x12')](queryTrunks));_0xfe05db[_0xe8b8('0x30')](db[_0xe8b8('0x19')][_0xe8b8('0x12')](queryCampaigns));_0xfe05db['push'](db[_0xe8b8('0x3')][_0xe8b8('0x12')](queryAgents));break;case _0xe8b8('0x38'):_0x56ee42[_0x57faf7](_0xe8b8('0x39'));_0x56ee42[_0x57faf7](_0xe8b8('0x2d'));_0xfe05db[_0xe8b8('0x30')](getAssociatedResources('VoiceQueues',_0x589877[_0xe8b8('0x3a')],'VoiceQueue'));_0xfe05db[_0xe8b8('0x30')](getAssociatedResources(_0xe8b8('0xc'),_0x589877['userProfileId'],'ChatQueue'));_0xfe05db[_0xe8b8('0x30')](getAssociatedResources(_0xe8b8('0xd'),_0x589877[_0xe8b8('0x3a')],_0xe8b8('0x3b')));_0xfe05db['push'](getAssociatedResources(_0xe8b8('0xe'),_0x589877[_0xe8b8('0x3a')],_0xe8b8('0x33')));_0xfe05db[_0xe8b8('0x30')](getAssociatedResources(_0xe8b8('0xf'),_0x589877[_0xe8b8('0x3a')],_0xe8b8('0x34')));_0xfe05db[_0xe8b8('0x30')](getAssociatedResources('OpenchannelQueues',_0x589877['userProfileId'],_0xe8b8('0x35')));_0xfe05db[_0xe8b8('0x30')](getAssociatedResources(_0xe8b8('0x11'),_0x589877['userProfileId'],_0xe8b8('0x36')));_0xfe05db[_0xe8b8('0x30')](getAssociatedResources(_0xe8b8('0x13'),_0x589877[_0xe8b8('0x3a')],_0xe8b8('0x3')));_0xfe05db[_0xe8b8('0x30')](getAssociatedResources(_0xe8b8('0x14'),_0x589877['userProfileId'],'Trunk'));_0xfe05db['push'](getAssociatedResources(_0xe8b8('0x15'),_0x589877[_0xe8b8('0x3a')],_0xe8b8('0x19')));_0xfe05db[_0xe8b8('0x30')](db['User'][_0xe8b8('0x12')](queryAgents));break;case _0xe8b8('0x6'):_0x56ee42[_0x57faf7](_0xe8b8('0x39'));_0x56ee42[_0x57faf7](_0xe8b8('0x2d'));_0xfe05db['push'](_0x589877['getVoiceQueues']({'attributes':['id',_0xe8b8('0x4')]}));_0xfe05db[_0xe8b8('0x30')](_0x589877[_0xe8b8('0x3c')]({'attributes':['id','name']}));_0xfe05db[_0xe8b8('0x30')](_0x589877[_0xe8b8('0x3d')]({'attributes':['id',_0xe8b8('0x4')]}));_0xfe05db[_0xe8b8('0x30')](_0x589877['getSmsQueues']({'attributes':['id',_0xe8b8('0x4')]}));_0xfe05db[_0xe8b8('0x30')](_0x589877[_0xe8b8('0x3e')]({'attributes':['id',_0xe8b8('0x4')]}));_0xfe05db[_0xe8b8('0x30')](_0x589877[_0xe8b8('0x3f')]({'attributes':['id',_0xe8b8('0x4')]}));_0xfe05db[_0xe8b8('0x30')](_0x589877[_0xe8b8('0x40')]({'attributes':['id',_0xe8b8('0x4')]}));break;}return BPromise[_0xe8b8('0x41')](_0xfe05db);}})[_0xe8b8('0xa')](function(_0x562d50){if(_0x562d50&&_0x562d50['length']){for(var _0x442c58=0x0;_0x442c58<_0x562d50[_0xe8b8('0x1e')];_0x442c58+=0x1){for(var _0x39bab6=0x0;_0x39bab6<_0x562d50[_0x442c58][_0xe8b8('0x1e')];_0x39bab6+=0x1){switch(_0x442c58){case 0x0:joinOrLeaveQueues(_0x56ee42,_0x57faf7,_0xe8b8('0x42'),_0x562d50[_0x442c58][_0x39bab6]);break;case 0x1:joinOrLeaveQueues(_0x56ee42,_0x57faf7,_0xe8b8('0x43'),_0x562d50[_0x442c58][_0x39bab6]);break;case 0x2:joinOrLeaveQueues(_0x56ee42,_0x57faf7,_0xe8b8('0x44'),_0x562d50[_0x442c58][_0x39bab6]);break;case 0x3:joinOrLeaveQueues(_0x56ee42,_0x57faf7,'sms',_0x562d50[_0x442c58][_0x39bab6]);break;case 0x4:joinOrLeaveQueues(_0x56ee42,_0x57faf7,'mail',_0x562d50[_0x442c58][_0x39bab6]);break;case 0x5:joinOrLeaveQueues(_0x56ee42,_0x57faf7,_0xe8b8('0x45'),_0x562d50[_0x442c58][_0x39bab6]);break;case 0x6:joinOrLeaveQueues(_0x56ee42,_0x57faf7,_0xe8b8('0x46'),_0x562d50[_0x442c58][_0x39bab6]);break;case 0x7:if(_0x4769fe['role']!==_0xe8b8('0x6'))_0x56ee42[_0x57faf7](util[_0xe8b8('0x1b')](_0xe8b8('0x47'),_0x562d50[_0x442c58][_0x39bab6][_0xe8b8('0x4')]));break;case 0x8:if(_0x4769fe[_0xe8b8('0x5')]!==_0xe8b8('0x6'))_0x56ee42[_0x57faf7](util[_0xe8b8('0x1b')](_0xe8b8('0x48'),_0x562d50[_0x442c58][_0x39bab6][_0xe8b8('0x4')]));break;case 0x9:if(_0x4769fe[_0xe8b8('0x5')]!==_0xe8b8('0x6'))_0x56ee42[_0x57faf7](util[_0xe8b8('0x1b')]('campaign:%s:%s',_0x562d50[_0x442c58][_0x39bab6][_0xe8b8('0x1a')],_0x562d50[_0x442c58][_0x39bab6]['name']));break;case 0xa:_0x56ee42[_0x57faf7](util[_0xe8b8('0x1b')](_0xe8b8('0x1f'),_0x562d50[_0x442c58][_0x39bab6][_0xe8b8('0x4')]));break;}}}}})[_0xe8b8('0xa')](function(){if(_0x57faf7==='leave'){var _0x1b0223=_[_0xe8b8('0x16')](_0x4769fe['ChatInteractions'],'id');return _0x4769fe[_0xe8b8('0x49')](_0x1b0223)[_0xe8b8('0xa')](function(){for(var _0x371e4b=0x0;_0x371e4b<_0x1b0223[_0xe8b8('0x1e')];_0x371e4b+=0x1){_0x566721[_0xe8b8('0x4a')](_0xe8b8('0x4b'),{'ChatInteractionId':Number(_0x1b0223[_0x371e4b]),'UserId':Number(_0x4769fe['id'])});}});}})['then'](function(){if(_0x57faf7===_0xe8b8('0x4c')){var _0x4d9971=_['map'](_0x4769fe[_0xe8b8('0x25')],'id');return _0x4769fe[_0xe8b8('0x4d')](_0x4d9971)[_0xe8b8('0xa')](function(){for(var _0x152c65=0x0;_0x152c65<_0x4d9971[_0xe8b8('0x1e')];_0x152c65+=0x1){_0x566721[_0xe8b8('0x4a')](_0xe8b8('0x4e'),{'MailInteractionId':Number(_0x4d9971[_0x152c65]),'UserId':Number(_0x4769fe['id'])});}});}})[_0xe8b8('0xa')](function(){if(_0x57faf7===_0xe8b8('0x4c')){var _0x2cb38a=_[_0xe8b8('0x16')](_0x4769fe['FaxInteractions'],'id');return _0x4769fe[_0xe8b8('0x4f')](_0x2cb38a)[_0xe8b8('0xa')](function(){for(var _0x98f10f=0x0;_0x98f10f<_0x2cb38a[_0xe8b8('0x1e')];_0x98f10f+=0x1){_0x566721['emit'](_0xe8b8('0x50'),{'FaxInteractionId':Number(_0x2cb38a[_0x98f10f]),'UserId':Number(_0x4769fe['id'])});}});}})['then'](function(){if(_0x57faf7===_0xe8b8('0x4c')){var _0x46ff8d=_['map'](_0x4769fe[_0xe8b8('0x28')],'id');return _0x4769fe['removeSmsInteractions'](_0x46ff8d)[_0xe8b8('0xa')](function(){for(var _0x38a515=0x0;_0x38a515<_0x46ff8d[_0xe8b8('0x1e')];_0x38a515+=0x1){_0x566721['emit'](_0xe8b8('0x51'),{'SmsInteractionId':Number(_0x46ff8d[_0x38a515]),'UserId':Number(_0x4769fe['id'])});}});}})[_0xe8b8('0xa')](function(){if(_0x57faf7===_0xe8b8('0x4c')){var _0x2c6603=_[_0xe8b8('0x16')](_0x4769fe[_0xe8b8('0x29')],'id');return _0x4769fe['removeOpenchannelInteractions'](_0x2c6603)[_0xe8b8('0xa')](function(){for(var _0x37a1e1=0x0;_0x37a1e1<_0x2c6603[_0xe8b8('0x1e')];_0x37a1e1+=0x1){_0x566721[_0xe8b8('0x4a')](_0xe8b8('0x52'),{'OpenchannelInteractionId':Number(_0x2c6603[_0x37a1e1]),'UserId':Number(_0x4769fe['id'])});}});}})[_0xe8b8('0xa')](function(){if(_0x57faf7===_0xe8b8('0x4c')){var _0x452285=_[_0xe8b8('0x16')](_0x4769fe['WhatsappInteractions'],'id');return _0x4769fe['removeWhatsappInteractions'](_0x452285)['then'](function(){for(var _0x537907=0x0;_0x537907<_0x452285[_0xe8b8('0x1e')];_0x537907+=0x1){_0x566721[_0xe8b8('0x4a')](_0xe8b8('0x53'),{'WhatsappInteractionId':Number(_0x452285[_0x537907]),'UserId':Number(_0x4769fe['id'])});}});}})[_0xe8b8('0x54')](function(_0x3b0be4){_0x56ee42[_0xe8b8('0x55')](_0x3b0be4);});}}function onDisconnect(_0x41c205,_0x3a1a4b){joinOrLeave(_0x41c205,_0xe8b8('0x4c'),_0x3a1a4b);}function onConnect(_0x2836a3){joinOrLeave(_0x2836a3,_0xe8b8('0x56'));}exports[_0xe8b8('0x57')]=function(_0xd1950d){_0xd1950d['on']('connection',function(_0x1af57a){_0x1af57a['setMaxListeners'](0x0);_0x1af57a[_0xe8b8('0x58')]=_0x1af57a['request'][_0xe8b8('0x59')][_0xe8b8('0x5a')]+':'+_0x1af57a[_0xe8b8('0x5b')][_0xe8b8('0x59')][_0xe8b8('0x5c')];_0x1af57a['connectedAt']=new Date();_0x1af57a[_0xe8b8('0x55')]=function(_0x39c471){console['log'](_0xe8b8('0x5d')+_0x1af57a[_0xe8b8('0x5e')]['name']+'['+_0x1af57a[_0xe8b8('0x58')]+']',_0x39c471);};_0x1af57a['on'](_0xe8b8('0x5f'),function(){onDisconnect(_0x1af57a,_0xd1950d);_0x1af57a[_0xe8b8('0x55')]('DISCONNECTED');});onConnect(_0x1af57a);_0x1af57a[_0xe8b8('0x55')](_0xe8b8('0x60'));});}; \ No newline at end of file +var _0x06f1=['request','remoteAddress','remotePort','connectedAt','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','./environment','Agents','role','agent','name','telephone','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Trunks','UserProfileResource','resourceId','where','Campaign','type','format','length','handshake','query','User','find','userProfileId','ChatInteractions','MailInteraction','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','FaxQueue','MailQueue','OpenchannelQueue','Trunk','user','VoiceQueue','ChatQueue','OpenchannelQueues','IvrCampaigns','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','map','FaxInteractions','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','address'];(function(_0xaac208,_0x29f03){var _0x1ad453=function(_0x204c1d){while(--_0x204c1d){_0xaac208['push'](_0xaac208['shift']());}};_0x1ad453(++_0x29f03);}(_0x06f1,0x6e));var _0x106f=function(_0x383770,_0x402ba0){_0x383770=_0x383770-0x0;var _0x4fdaac=_0x06f1[_0x383770];return _0x4fdaac;};'use strict';var _=require(_0x106f('0x0'));var util=require(_0x106f('0x1'));var BPromise=require(_0x106f('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x106f('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x106f('0x4'),'model':db['User'],'attributes':['id','name',_0x106f('0x5')],'raw':!![],'where':{'role':_0x106f('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x106f('0x7')],'where':{'role':_0x106f('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x106f('0x7')]};var queryAgents={'raw':!![],'attributes':['id',_0x106f('0x7')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x106f('0x7'),'type'],'where':{'type':_0x106f('0x9')}};function getAssociatedResources(_0x2e683c,_0x164dd5,_0x59e36f){return db[_0x106f('0xa')][_0x106f('0xb')]({'where':{'name':_0x2e683c,'userProfileId':_0x164dd5},'raw':!![]})[_0x106f('0xc')](function(_0x3e667d){if(_0x3e667d){if(_0x3e667d[_0x106f('0xd')]){switch(_0x2e683c){case _0x106f('0xe'):case _0x106f('0xf'):case _0x106f('0x10'):case _0x106f('0x11'):case _0x106f('0x12'):case'OpenchannelQueues':case _0x106f('0x13'):return db[_0x59e36f][_0x106f('0x14')](queryQueues);case'Telephones':return db[_0x59e36f][_0x106f('0x14')](queryTelephones);case _0x106f('0x15'):return db[_0x59e36f][_0x106f('0x14')](queryTrunks);case'IvrCampaigns':return db[_0x59e36f]['findAll'](queryCampaigns);}}else{return db[_0x106f('0x16')][_0x106f('0x14')]({'attributes':[_0x106f('0x17')],'where':{'sectionId':_0x3e667d['id']},'raw':!![]})[_0x106f('0xc')](function(_0x422461){if(_0x422461){var _0x378483={'where':{'id':_['map'](_0x422461,'resourceId')},'raw':!![]};switch(_0x59e36f){case'User':_0x378483[_0x106f('0x18')][_0x106f('0x5')]='telephone';break;case _0x106f('0x19'):_0x378483[_0x106f('0x18')][_0x106f('0x1a')]='ivr';break;}return db[_0x59e36f]['findAll'](_0x378483);}else{return[];}});}}else{return[];}})[_0x106f('0xc')](function(_0x3f2cd6){return _0x3f2cd6;});}function joinOrLeaveQueues(_0x25d759,_0x37fab2,_0x1980e5,_0x8d54c8){_0x25d759[_0x37fab2](util[_0x106f('0x1b')]('%s:queue:%s',_0x1980e5,_0x8d54c8[_0x106f('0x7')]));if(_0x8d54c8[_0x106f('0x4')]){for(var _0x54bbb=0x0;_0x54bbb<_0x8d54c8['Agents'][_0x106f('0x1c')];_0x54bbb+=0x1){_0x25d759[_0x37fab2](util['format']('user:%s',_0x8d54c8[_0x106f('0x4')][_0x54bbb][_0x106f('0x7')]));}}}function joinOrLeave(_0x348614,_0x50093b,_0x18fd98){var _0x41dfdb;if(_0x348614[_0x106f('0x1d')][_0x106f('0x1e')]['id']){db[_0x106f('0x1f')][_0x106f('0x20')]({'attributes':['id',_0x106f('0x7'),_0x106f('0x5'),_0x106f('0x21')],'where':{'id':_0x348614['handshake']['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0x106f('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x106f('0x23')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x106f('0x24')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x106f('0x25')],'as':_0x106f('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x106f('0x27')],'as':_0x106f('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x106f('0x29')],'as':_0x106f('0x2a'),'attributes':['id'],'raw':!![]}]})['then'](function(_0xefc734){if(_0xefc734){_0x41dfdb=_0xefc734;_0x348614[_0x50093b](util[_0x106f('0x1b')](_0x106f('0x2b'),_0xefc734[_0x106f('0x7')]));var _0x57ebc0=[];switch(_0xefc734['role']){case _0x106f('0x2c'):_0x348614[_0x50093b](_0x106f('0x2d'));_0x348614[_0x50093b](_0x106f('0x2e'));if(queryQueues[_0x106f('0x2f')](_0x106f('0x30'))){delete queryQueues[_0x106f('0x30')];}_0x57ebc0[_0x106f('0x31')](db['VoiceQueue'][_0x106f('0x14')](queryQueues));_0x57ebc0[_0x106f('0x31')](db['ChatQueue'][_0x106f('0x14')](queryQueues));_0x57ebc0[_0x106f('0x31')](db[_0x106f('0x32')][_0x106f('0x14')](queryQueues));_0x57ebc0['push'](db['SmsQueue'][_0x106f('0x14')](queryQueues));_0x57ebc0[_0x106f('0x31')](db[_0x106f('0x33')][_0x106f('0x14')](queryQueues));_0x57ebc0['push'](db[_0x106f('0x34')][_0x106f('0x14')](queryQueues));_0x57ebc0[_0x106f('0x31')](db['WhatsappQueue'][_0x106f('0x14')](queryQueues));_0x57ebc0[_0x106f('0x31')](db[_0x106f('0x1f')][_0x106f('0x14')](queryTelephones));_0x57ebc0['push'](db[_0x106f('0x35')][_0x106f('0x14')](queryTrunks));_0x57ebc0[_0x106f('0x31')](db[_0x106f('0x19')]['findAll'](queryCampaigns));_0x57ebc0[_0x106f('0x31')](db[_0x106f('0x1f')]['findAll'](queryAgents));break;case _0x106f('0x36'):_0x348614[_0x50093b](_0x106f('0x2d'));_0x348614[_0x50093b](_0x106f('0x2e'));_0x57ebc0['push'](getAssociatedResources(_0x106f('0xe'),_0xefc734['userProfileId'],_0x106f('0x37')));_0x57ebc0[_0x106f('0x31')](getAssociatedResources(_0x106f('0xf'),_0xefc734[_0x106f('0x21')],_0x106f('0x38')));_0x57ebc0[_0x106f('0x31')](getAssociatedResources('FaxQueues',_0xefc734['userProfileId'],_0x106f('0x32')));_0x57ebc0[_0x106f('0x31')](getAssociatedResources(_0x106f('0x11'),_0xefc734['userProfileId'],'SmsQueue'));_0x57ebc0[_0x106f('0x31')](getAssociatedResources('MailQueues',_0xefc734[_0x106f('0x21')],_0x106f('0x33')));_0x57ebc0[_0x106f('0x31')](getAssociatedResources(_0x106f('0x39'),_0xefc734[_0x106f('0x21')],_0x106f('0x34')));_0x57ebc0['push'](getAssociatedResources(_0x106f('0x13'),_0xefc734['userProfileId'],'WhatsappQueue'));_0x57ebc0[_0x106f('0x31')](getAssociatedResources('Telephones',_0xefc734[_0x106f('0x21')],_0x106f('0x1f')));_0x57ebc0[_0x106f('0x31')](getAssociatedResources(_0x106f('0x15'),_0xefc734[_0x106f('0x21')],_0x106f('0x35')));_0x57ebc0[_0x106f('0x31')](getAssociatedResources(_0x106f('0x3a'),_0xefc734[_0x106f('0x21')],'Campaign'));_0x57ebc0[_0x106f('0x31')](db['User']['findAll'](queryAgents));break;case _0x106f('0x6'):_0x348614[_0x50093b](_0x106f('0x2d'));_0x348614[_0x50093b](_0x106f('0x2e'));_0x57ebc0[_0x106f('0x31')](_0xefc734['getVoiceQueues']({'attributes':['id',_0x106f('0x7')]}));_0x57ebc0[_0x106f('0x31')](_0xefc734[_0x106f('0x3b')]({'attributes':['id',_0x106f('0x7')]}));_0x57ebc0[_0x106f('0x31')](_0xefc734[_0x106f('0x3c')]({'attributes':['id','name']}));_0x57ebc0[_0x106f('0x31')](_0xefc734[_0x106f('0x3d')]({'attributes':['id',_0x106f('0x7')]}));_0x57ebc0['push'](_0xefc734[_0x106f('0x3e')]({'attributes':['id',_0x106f('0x7')]}));_0x57ebc0['push'](_0xefc734[_0x106f('0x3f')]({'attributes':['id','name']}));_0x57ebc0['push'](_0xefc734['getWhatsappQueues']({'attributes':['id',_0x106f('0x7')]}));break;}return BPromise[_0x106f('0x40')](_0x57ebc0);}})[_0x106f('0xc')](function(_0x4c24b2){if(_0x4c24b2&&_0x4c24b2[_0x106f('0x1c')]){for(var _0x381b0d=0x0;_0x381b0d<_0x4c24b2[_0x106f('0x1c')];_0x381b0d+=0x1){for(var _0x3f62b6=0x0;_0x3f62b6<_0x4c24b2[_0x381b0d][_0x106f('0x1c')];_0x3f62b6+=0x1){switch(_0x381b0d){case 0x0:joinOrLeaveQueues(_0x348614,_0x50093b,_0x106f('0x41'),_0x4c24b2[_0x381b0d][_0x3f62b6]);break;case 0x1:joinOrLeaveQueues(_0x348614,_0x50093b,_0x106f('0x42'),_0x4c24b2[_0x381b0d][_0x3f62b6]);break;case 0x2:joinOrLeaveQueues(_0x348614,_0x50093b,'fax',_0x4c24b2[_0x381b0d][_0x3f62b6]);break;case 0x3:joinOrLeaveQueues(_0x348614,_0x50093b,_0x106f('0x43'),_0x4c24b2[_0x381b0d][_0x3f62b6]);break;case 0x4:joinOrLeaveQueues(_0x348614,_0x50093b,_0x106f('0x44'),_0x4c24b2[_0x381b0d][_0x3f62b6]);break;case 0x5:joinOrLeaveQueues(_0x348614,_0x50093b,_0x106f('0x45'),_0x4c24b2[_0x381b0d][_0x3f62b6]);break;case 0x6:joinOrLeaveQueues(_0x348614,_0x50093b,_0x106f('0x46'),_0x4c24b2[_0x381b0d][_0x3f62b6]);break;case 0x7:if(_0x41dfdb[_0x106f('0x5')]!==_0x106f('0x6'))_0x348614[_0x50093b](util[_0x106f('0x1b')](_0x106f('0x47'),_0x4c24b2[_0x381b0d][_0x3f62b6]['name']));break;case 0x8:if(_0x41dfdb['role']!==_0x106f('0x6'))_0x348614[_0x50093b](util[_0x106f('0x1b')](_0x106f('0x48'),_0x4c24b2[_0x381b0d][_0x3f62b6]['name']));break;case 0x9:if(_0x41dfdb[_0x106f('0x5')]!==_0x106f('0x6'))_0x348614[_0x50093b](util[_0x106f('0x1b')](_0x106f('0x49'),_0x4c24b2[_0x381b0d][_0x3f62b6][_0x106f('0x1a')],_0x4c24b2[_0x381b0d][_0x3f62b6][_0x106f('0x7')]));break;case 0xa:_0x348614[_0x50093b](util[_0x106f('0x1b')](_0x106f('0x2b'),_0x4c24b2[_0x381b0d][_0x3f62b6]['name']));break;}}}}})['then'](function(){if(_0x50093b===_0x106f('0x4a')){var _0x5394b3=_['map'](_0x41dfdb[_0x106f('0x22')],'id');return _0x41dfdb[_0x106f('0x4b')](_0x5394b3)[_0x106f('0xc')](function(){for(var _0x24d20b=0x0;_0x24d20b<_0x5394b3[_0x106f('0x1c')];_0x24d20b+=0x1){_0x18fd98[_0x106f('0x4c')](_0x106f('0x4d'),{'ChatInteractionId':Number(_0x5394b3[_0x24d20b]),'UserId':Number(_0x41dfdb['id'])});}});}})[_0x106f('0xc')](function(){if(_0x50093b==='leave'){var _0x18b755=_['map'](_0x41dfdb[_0x106f('0x4e')],'id');return _0x41dfdb['removeMailInteractions'](_0x18b755)['then'](function(){for(var _0x36ba8b=0x0;_0x36ba8b<_0x18b755[_0x106f('0x1c')];_0x36ba8b+=0x1){_0x18fd98['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x18b755[_0x36ba8b]),'UserId':Number(_0x41dfdb['id'])});}});}})['then'](function(){if(_0x50093b==='leave'){var _0x5672ed=_[_0x106f('0x4f')](_0x41dfdb[_0x106f('0x50')],'id');return _0x41dfdb[_0x106f('0x51')](_0x5672ed)[_0x106f('0xc')](function(){for(var _0x1ef7bc=0x0;_0x1ef7bc<_0x5672ed[_0x106f('0x1c')];_0x1ef7bc+=0x1){_0x18fd98[_0x106f('0x4c')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x5672ed[_0x1ef7bc]),'UserId':Number(_0x41dfdb['id'])});}});}})[_0x106f('0xc')](function(){if(_0x50093b===_0x106f('0x4a')){var _0x4255a1=_['map'](_0x41dfdb['SmsInteractions'],'id');return _0x41dfdb[_0x106f('0x52')](_0x4255a1)[_0x106f('0xc')](function(){for(var _0xeecb61=0x0;_0xeecb61<_0x4255a1[_0x106f('0x1c')];_0xeecb61+=0x1){_0x18fd98['emit'](_0x106f('0x53'),{'SmsInteractionId':Number(_0x4255a1[_0xeecb61]),'UserId':Number(_0x41dfdb['id'])});}});}})[_0x106f('0xc')](function(){if(_0x50093b==='leave'){var _0x36b189=_[_0x106f('0x4f')](_0x41dfdb['OpenchannelInteractions'],'id');return _0x41dfdb[_0x106f('0x54')](_0x36b189)['then'](function(){for(var _0x4fdf90=0x0;_0x4fdf90<_0x36b189[_0x106f('0x1c')];_0x4fdf90+=0x1){_0x18fd98[_0x106f('0x4c')](_0x106f('0x55'),{'OpenchannelInteractionId':Number(_0x36b189[_0x4fdf90]),'UserId':Number(_0x41dfdb['id'])});}});}})[_0x106f('0xc')](function(){if(_0x50093b===_0x106f('0x4a')){var _0x5ee884=_[_0x106f('0x4f')](_0x41dfdb[_0x106f('0x2a')],'id');return _0x41dfdb[_0x106f('0x56')](_0x5ee884)['then'](function(){for(var _0x36f6c8=0x0;_0x36f6c8<_0x5ee884[_0x106f('0x1c')];_0x36f6c8+=0x1){_0x18fd98[_0x106f('0x4c')](_0x106f('0x57'),{'WhatsappInteractionId':Number(_0x5ee884[_0x36f6c8]),'UserId':Number(_0x41dfdb['id'])});}});}})['catch'](function(_0x12a799){_0x348614[_0x106f('0x58')](_0x12a799);});}}function onDisconnect(_0x4f8125,_0x227179){joinOrLeave(_0x4f8125,_0x106f('0x4a'),_0x227179);}function onConnect(_0x578f2e){joinOrLeave(_0x578f2e,_0x106f('0x59'));}exports[_0x106f('0x5a')]=function(_0x24cd76){_0x24cd76['on'](_0x106f('0x5b'),function(_0x37f877){_0x37f877[_0x106f('0x5c')](0x0);_0x37f877[_0x106f('0x5d')]=_0x37f877[_0x106f('0x5e')]['connection'][_0x106f('0x5f')]+':'+_0x37f877['request'][_0x106f('0x5b')][_0x106f('0x60')];_0x37f877[_0x106f('0x61')]=new Date();_0x37f877[_0x106f('0x58')]=function(_0x44ac61){console[_0x106f('0x58')]('SocketIO\x20'+_0x37f877[_0x106f('0x62')][_0x106f('0x7')]+'['+_0x37f877[_0x106f('0x5d')]+']',_0x44ac61);};_0x37f877['on'](_0x106f('0x63'),function(){onDisconnect(_0x37f877,_0x24cd76);_0x37f877[_0x106f('0x58')](_0x106f('0x64'));});onConnect(_0x37f877);_0x37f877['log'](_0x106f('0x65'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 4e6b138..d552374 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 _0x4dd0=['Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','error','code','catch','Trigger,\x20%s','get','channel','motionChannel','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','query','QueryTypes','SELECT','contact','UserId','interface','format','SIP/%s','name','agent','incomingmessage','AfterCreateMessage','event','offlineMessage','opened','sequelize','Sequelize','changed','closed','substatus','AfterUpdate','User','find','fullname','email','default','model','hook','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','Chat','afterCreate','ChatInteraction','ChatMessage','ChatOfflineMessage','newmessage','Sms','SmsInteraction','newinteraction','afterUpdate','closedinteraction','SmsMessage'];(function(_0xba96a,_0x5759f9){var _0x3abb99=function(_0x177de2){while(--_0x177de2){_0xba96a['push'](_0xba96a['shift']());}};_0x3abb99(++_0x5759f9);}(_0x4dd0,0x11e));var _0x04dd=function(_0x544b4f,_0x1b02a3){_0x544b4f=_0x544b4f-0x0;var _0xd3432=_0x4dd0[_0x544b4f];return _0xd3432;};'use strict';var util=require(_0x04dd('0x0'));var db=require(_0x04dd('0x1'))['db'];var jayson=require(_0x04dd('0x2'));var logger=require(_0x04dd('0x3'))(_0x04dd('0x4'));var client=jayson[_0x04dd('0x5')]['http']({'port':0x232a});var triggers=[{'channel':_0x04dd('0x6'),'model':'ChatInteraction','event':_0x04dd('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x04dd('0x6'),'model':_0x04dd('0x8'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x04dd('0x6'),'model':_0x04dd('0x9'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Chat','model':_0x04dd('0xa'),'event':_0x04dd('0x7'),'condition':_0x04dd('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0x04dd('0xc'),'model':_0x04dd('0xd'),'event':_0x04dd('0x7'),'condition':_0x04dd('0xe'),'callback':afterCreate},{'channel':'Sms','model':'SmsInteraction','event':_0x04dd('0xf'),'condition':_0x04dd('0x10'),'callback':afterUpdate},{'channel':_0x04dd('0xc'),'model':_0x04dd('0x11'),'event':_0x04dd('0x7'),'condition':_0x04dd('0xb'),'callback':afterCreateMessage},{'channel':_0x04dd('0x12'),'model':'WhatsappInteraction','event':_0x04dd('0x7'),'condition':_0x04dd('0xe'),'callback':afterCreate},{'channel':'Whatsapp','model':_0x04dd('0x13'),'event':_0x04dd('0xf'),'condition':_0x04dd('0x10'),'callback':afterUpdate},{'channel':_0x04dd('0x12'),'model':_0x04dd('0x14'),'event':_0x04dd('0x7'),'condition':_0x04dd('0xb'),'callback':afterCreateMessage},{'channel':_0x04dd('0x15'),'model':_0x04dd('0x16'),'event':'afterCreate','condition':_0x04dd('0xe'),'callback':afterCreate},{'channel':_0x04dd('0x15'),'model':'FaxInteraction','event':'afterUpdate','condition':_0x04dd('0x10'),'callback':afterUpdate},{'channel':_0x04dd('0x15'),'model':_0x04dd('0x17'),'event':_0x04dd('0x7'),'condition':_0x04dd('0xb'),'callback':afterCreateMessage},{'channel':_0x04dd('0x18'),'model':_0x04dd('0x19'),'event':'afterCreate','condition':_0x04dd('0xe'),'callback':afterCreate},{'channel':_0x04dd('0x18'),'model':_0x04dd('0x19'),'event':'afterUpdate','condition':_0x04dd('0x10'),'callback':afterUpdate},{'channel':'Mail','model':_0x04dd('0x1a'),'event':_0x04dd('0x7'),'condition':_0x04dd('0xb'),'callback':afterCreateMessage},{'channel':_0x04dd('0x1b'),'model':'OpenchannelInteraction','event':_0x04dd('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x04dd('0x1b'),'model':_0x04dd('0x1c'),'event':_0x04dd('0xf'),'condition':_0x04dd('0x10'),'callback':afterUpdate},{'channel':_0x04dd('0x1b'),'model':_0x04dd('0x1d'),'event':_0x04dd('0x7'),'condition':_0x04dd('0xb'),'callback':afterCreateMessage}];function request(_0xf2e0f4){return client[_0x04dd('0x1e')](_0x04dd('0x1f'),_0xf2e0f4)[_0x04dd('0x20')](function(_0x1482e6){logger[_0x04dd('0x21')]('Trigger,\x20%s',_0x04dd('0x1f'),_0x1482e6);if(_0x1482e6[_0x04dd('0x22')]){if(_0x1482e6[_0x04dd('0x22')][_0x04dd('0x23')]===0x1f4){logger[_0x04dd('0x22')]('Trigger,\x20%s',_0x04dd('0x1f'),_0x1482e6[_0x04dd('0x22')]);}}})[_0x04dd('0x24')](function(_0x31249f){logger[_0x04dd('0x22')](_0x04dd('0x25'),_0x04dd('0x1f'),_0x31249f);});}function afterCreateMessage(_0x1ffebd){return function(_0x58ae9a){_0x58ae9a=_0x58ae9a[_0x04dd('0x26')]({'plain':!![]});_0x58ae9a[_0x04dd('0x27')]=_0x1ffebd;_0x58ae9a[_0x04dd('0x28')]=_0x1ffebd;_0x58ae9a['event']=_0x58ae9a[_0x04dd('0x29')];Promise[_0x04dd('0x2a')]()['then'](function(){if(typeof _0x58ae9a[_0x04dd('0x2b')]===_0x04dd('0x2c'))return null;var _0x88f66f=_0x04dd('0x2d')+_0x58ae9a[_0x04dd('0x2b')];return db['sequelize'][_0x04dd('0x2e')](_0x88f66f,{'type':db['Sequelize'][_0x04dd('0x2f')][_0x04dd('0x30')],'raw':!![]});})[_0x04dd('0x20')](function(_0x2db873){if(_0x2db873){_0x58ae9a[_0x04dd('0x31')]=_0x2db873[0x0];}if(typeof _0x58ae9a[_0x04dd('0x32')]===_0x04dd('0x2c'))return;return getAgent(_0x58ae9a['UserId']);})[_0x04dd('0x20')](function(_0x1a8b7a){if(_0x1a8b7a){_0x58ae9a[_0x04dd('0x33')]=util[_0x04dd('0x34')](_0x04dd('0x35'),_0x1a8b7a[_0x04dd('0x36')]);_0x58ae9a[_0x04dd('0x37')]=_0x1a8b7a;_0x58ae9a[_0x04dd('0x27')]=_0x1ffebd;return request({'event':_0x04dd('0x38'),'message':_0x58ae9a});}else{return request({'event':'outgoingmessage','message':_0x58ae9a});}})['catch'](function(_0xc601e){logger[_0x04dd('0x22')]('Trigger,\x20%s',_0x04dd('0x39'),_0xc601e);});};}function afterCreateOfflineMessage(_0x401f3a){return function(_0x35b89c){_0x35b89c=_0x35b89c[_0x04dd('0x26')]({'plain':!![]});_0x35b89c[_0x04dd('0x27')]=_0x401f3a;_0x35b89c[_0x04dd('0x28')]=_0x401f3a;_0x35b89c[_0x04dd('0x3a')]=_0x04dd('0x3b');return request({'event':_0x35b89c[_0x04dd('0x3a')],'message':_0x35b89c});};}function afterCreate(_0x34628a,_0x3343f5){return function(_0x3f857c){_0x3f857c=_0x3f857c['get']({'plain':!![]});_0x3f857c[_0x04dd('0x27')]=_0x34628a;_0x3f857c[_0x04dd('0x28')]=_0x34628a;_0x3f857c[_0x04dd('0x3a')]=_0x04dd('0x3c');Promise[_0x04dd('0x2a')]()[_0x04dd('0x20')](function(){var _0x21555f=_0x04dd('0x2d')+_0x3f857c[_0x04dd('0x2b')];return db[_0x04dd('0x3d')][_0x04dd('0x2e')](_0x21555f,{'type':db[_0x04dd('0x3e')]['QueryTypes'][_0x04dd('0x30')],'raw':!![]});})[_0x04dd('0x20')](function(_0x693265){if(_0x693265){_0x3f857c['contact']=_0x693265[0x0];}if(typeof _0x3f857c[_0x04dd('0x32')]==='undefined')return;return getAgent(_0x3f857c[_0x04dd('0x32')]);})[_0x04dd('0x20')](function(_0x282166){if(_0x282166){_0x3f857c[_0x04dd('0x33')]=util[_0x04dd('0x34')](_0x04dd('0x35'),_0x282166['name']);_0x3f857c[_0x04dd('0x37')]=_0x282166;}return request({'event':_0x3343f5,'message':_0x3f857c});})['catch'](function(_0x144a79){logger[_0x04dd('0x22')](_0x04dd('0x25'),'AfterCreate',_0x144a79);});};}function afterUpdate(_0x51c002){return function(_0x2417c9){var _0x288ad1=_0x2417c9[_0x04dd('0x3f')](_0x04dd('0x40'))&&_0x2417c9[_0x04dd('0x40')];var _0x517881=_0x2417c9['changed']('substatus');if(_0x288ad1||_0x517881){var _0x16f808=_0x288ad1?_0x04dd('0x10'):_0x04dd('0x41');var _0x31e3e2=_0x2417c9['get']({'plain':!![]});_0x31e3e2[_0x04dd('0x27')]=_0x51c002;_0x31e3e2[_0x04dd('0x28')]=_0x51c002;_0x31e3e2[_0x04dd('0x3a')]=_0x288ad1?_0x04dd('0x40'):'substatus';var _0x183dcb=_0x04dd('0x2d')+_0x31e3e2['ContactId'];return db[_0x04dd('0x3d')]['query'](_0x183dcb,{'type':db[_0x04dd('0x3e')][_0x04dd('0x2f')][_0x04dd('0x30')],'raw':!![]})['then'](function(_0x5c4ad6){if(_0x5c4ad6){_0x31e3e2['contact']=_0x5c4ad6[0x0];}if(typeof _0x31e3e2['UserId']===_0x04dd('0x2c'))return;return getAgent(_0x31e3e2[_0x04dd('0x32')]);})[_0x04dd('0x20')](function(_0x17321c){if(_0x17321c){_0x31e3e2['interface']=util[_0x04dd('0x34')](_0x04dd('0x35'),_0x17321c[_0x04dd('0x36')]);_0x31e3e2['agent']=_0x17321c;}return request({'event':_0x16f808,'message':_0x31e3e2});})[_0x04dd('0x24')](function(_0x16a2d8){logger[_0x04dd('0x22')](_0x04dd('0x25'),_0x04dd('0x42'),_0x16a2d8);});}};}function getAgent(_0xa6e736){return db[_0x04dd('0x43')][_0x04dd('0x44')]({'where':{'id':_0xa6e736},'attributes':['id','name',_0x04dd('0x45'),_0x04dd('0x46'),'internal'],'raw':!![]})[_0x04dd('0x20')](function(_0x17d4a9){return _0x17d4a9;});}exports[_0x04dd('0x47')]=function(){for(var _0x52816c=0x0;_0x52816c=_0x50ee7a[_0x2326('0x13')]){throw Error(_0x2326('0x14'));}_0x472e88(_0x3818d2);})[_0x2326('0x15')](function(_0x3113f3){_0x316d8d(_0x3113f3);});});}; \ No newline at end of file +var _0x3a79=['Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','mail','chat','fax','sms','whatsapp','openchannel','getChannels','toLowerCase','includes','blockedAt','updateAttributes','getLicense','role','agent','User','count','then','agents'];(function(_0x59b439,_0x14ae7b){var _0x521ea3=function(_0x5af627){while(--_0x5af627){_0x59b439['push'](_0x59b439['shift']());}};_0x521ea3(++_0x14ae7b);}(_0x3a79,0x116));var _0x93a7=function(_0xa81a65,_0x35b536){_0xa81a65=_0xa81a65-0x0;var _0x63809e=_0x3a79[_0xa81a65];return _0x63809e;};'use strict';var _=require(_0x93a7('0x0'));var BPromise=require(_0x93a7('0x1'));var db=require(_0x93a7('0x2'))['db'];var util=require('./license/util');var channels=['voice',_0x93a7('0x3'),_0x93a7('0x4'),_0x93a7('0x5'),_0x93a7('0x6'),_0x93a7('0x7'),_0x93a7('0x8')];exports[_0x93a7('0x9')]=function(){return channels;};exports['isValidChannel']=function(_0x5b51bd){_0x5b51bd=_0x5b51bd[_0x93a7('0xa')]();return _[_0x93a7('0xb')](channels,_0x5b51bd);};exports['clearBlockUser']=function(_0x2b0bfd,_0x2facab,_0x273f94,_0x5e3a9f){var _0x1da7be={'loginAttempts':_0x2facab,'blocked':_0x273f94};if(!_['isUndefined'](_0x5e3a9f)){_0x1da7be[_0x93a7('0xc')]=_0x5e3a9f;}return _0x2b0bfd[_0x93a7('0xd')](_0x1da7be);};exports[_0x93a7('0xe')]=function(_0x1327a5){return new BPromise(function(_0x53e0ac,_0x1cc247){var _0x301a62=0x0;if(_0x1327a5[_0x93a7('0xf')]!==_0x93a7('0x10')){_0x53e0ac(_0x1327a5);}db[_0x93a7('0x11')][_0x93a7('0x12')]({'where':{'role':_0x93a7('0x10'),'online':!![],'id':{'$ne':_0x1327a5['id']}}})[_0x93a7('0x13')](function(_0x26b0ba){_0x301a62=_0x26b0ba;return util[_0x93a7('0xe')]();})[_0x93a7('0x13')](function(_0xbccc3e){if(_0xbccc3e&&_0xbccc3e['agents']&&_0x301a62>=_0xbccc3e[_0x93a7('0x14')]){throw Error(_0x93a7('0x15'));}_0x53e0ac(_0x1327a5);})[_0x93a7('0x16')](function(_0x2f7d17){_0x1cc247(_0x2f7d17);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index a461d84..a2663ef 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Forbidden','OutOfInterval','Not\x20Found','status','send','util','../config/logger','api'];(function(_0x33a5e2,_0x37a932){var _0x5245c4=function(_0x4316c2){while(--_0x4316c2){_0x33a5e2['push'](_0x33a5e2['shift']());}};_0x5245c4(++_0x37a932);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var util=require(_0x0a9e('0x0'));var logger=require(_0x0a9e('0x1'))(_0x0a9e('0x2'));var APIError=function(_0x5dd881,_0x550fbc){this[_0x0a9e('0x3')]=_0x5dd881||'Internal\x20Server\x20Error';this[_0x0a9e('0x4')]=_0x550fbc||_0x0a9e('0x5');util[_0x0a9e('0x6')](APIError,Error);};var APIBadRequestError=function(_0x991246){this[_0x0a9e('0x3')]=_0x991246||'Bad\x20Request';this[_0x0a9e('0x4')]=_0x0a9e('0x7');util[_0x0a9e('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x5f41ea){this['message']=_0x5f41ea||_0x0a9e('0x8');this['name']='Not\x20Found';util[_0x0a9e('0x6')](APINotFoundError,APIError);};function getStatusCode(_0xf81284){switch(_0xf81284){case _0x0a9e('0x7'):return 0x190;case _0x0a9e('0x9'),_0x0a9e('0xa'):return 0x193;case _0x0a9e('0xb'):return 0x194;default:return 0x1f4;}}function handleError(_0x4a4c56){return function(_0x50dfb2){logger['error'](_0x50dfb2['stack']);var _0x273d4d=getStatusCode(_0x50dfb2[_0x0a9e('0x4')]);if(_0x50dfb2[_0x0a9e('0x4')])delete _0x50dfb2[_0x0a9e('0x4')];return _0x4a4c56[_0x0a9e('0xc')](_0x273d4d)[_0x0a9e('0xd')](_0x50dfb2);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x5b02=['inherits','message','Bad\x20Request','Not\x20Found','Forbidden','OutOfInterval','error','stack','name','status','send','exports','util','../config/logger','api','Internal\x20Server\x20Error','Error'];(function(_0x46f2f5,_0x5a222d){var _0x5da818=function(_0x7b8cb9){while(--_0x7b8cb9){_0x46f2f5['push'](_0x46f2f5['shift']());}};_0x5da818(++_0x5a222d);}(_0x5b02,0xe9));var _0x25b0=function(_0x367d75,_0x31bfbd){_0x367d75=_0x367d75-0x0;var _0x246cd0=_0x5b02[_0x367d75];return _0x246cd0;};'use strict';var util=require(_0x25b0('0x0'));var logger=require(_0x25b0('0x1'))(_0x25b0('0x2'));var APIError=function(_0x1c3295,_0x4ef71c){this['message']=_0x1c3295||_0x25b0('0x3');this['name']=_0x4ef71c||_0x25b0('0x4');util[_0x25b0('0x5')](APIError,Error);};var APIBadRequestError=function(_0x38dc14){this[_0x25b0('0x6')]=_0x38dc14||_0x25b0('0x7');this['name']=_0x25b0('0x7');util[_0x25b0('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x49ef3a){this[_0x25b0('0x6')]=_0x49ef3a||'Entity\x20not\x20found';this['name']=_0x25b0('0x8');util[_0x25b0('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x358af0){switch(_0x358af0){case'Bad\x20Request':return 0x190;case _0x25b0('0x9'),_0x25b0('0xa'):return 0x193;case _0x25b0('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0x250d31){return function(_0x2c72f3){logger[_0x25b0('0xb')](_0x2c72f3[_0x25b0('0xc')]);var _0x10c3fb=getStatusCode(_0x2c72f3[_0x25b0('0xd')]);if(_0x2c72f3[_0x25b0('0xd')])delete _0x2c72f3[_0x25b0('0xd')];return _0x250d31[_0x25b0('0xe')](_0x10c3fb)[_0x25b0('0xf')](_0x2c72f3);};}module[_0x25b0('0x10')]={'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 7f16c07..d7f7f03 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f28=['exports','404','status','json'];(function(_0x264b79,_0xc62859){var _0x548c85=function(_0x3ca7f0){while(--_0x3ca7f0){_0x264b79['push'](_0x264b79['shift']());}};_0x548c85(++_0xc62859);}(_0x7f28,0x84));var _0x87f2=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7f28[_0x432682];return _0x463d05;};'use strict';module[_0x87f2('0x0')][0x194]=function pageNotFound(_0x48d4d7,_0x1bf5e2){var _0x1b22f7=_0x87f2('0x1');var _0x45ee61=0x194;var _0xc79982={'status':_0x45ee61};_0x1bf5e2['status'](_0xc79982[_0x87f2('0x2')]);_0x1bf5e2['render'](_0x1b22f7,{},function(_0xc967b7,_0x35fb6a){if(_0xc967b7){return _0x1bf5e2[_0x87f2('0x2')](_0xc79982[_0x87f2('0x2')])[_0x87f2('0x3')](_0xc79982);}_0x1bf5e2['send'](_0x35fb6a);});}; \ No newline at end of file +var _0xc37e=['status','render','json','exports','404'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0xc37e,0x152));var _0xec37=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xc37e[_0x46e363];return _0x3fb059;};'use strict';module[_0xec37('0x0')][0x194]=function pageNotFound(_0x12208d,_0x6cf0c0){var _0x105be6=_0xec37('0x1');var _0x346a20=0x194;var _0x9b6de4={'status':_0x346a20};_0x6cf0c0[_0xec37('0x2')](_0x9b6de4[_0xec37('0x2')]);_0x6cf0c0[_0xec37('0x3')](_0x105be6,{},function(_0x5963a2,_0x24edf8){if(_0x5963a2){return _0x6cf0c0[_0xec37('0x2')](_0x9b6de4[_0xec37('0x2')])[_0xec37('0x4')](_0x9b6de4);}_0x6cf0c0['send'](_0x24edf8);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 2cc1c20..566bdc8 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x44474f,_0x431580){var _0x427d97=function(_0x53f7d4){while(--_0x53f7d4){_0x44474f['push'](_0x44474f['shift']());}};_0x427d97(++_0x431580);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 5b663f4..145ec5c 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x17b2=['/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/faxAccount','/api/fax/applications','./api/faxApplication','./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/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsQueue','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','/api/chat/internal/messages','./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/squareReport','/api/square/details/reports','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','./api/license','/api/campaigns','/api/migrations','/api/attachments','./api/attachment','/api/plugins','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/version','./api/system','/api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','snippet','/plugins','/server/files/plugins','route','get','sendFile','resolve','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','default','then','use','/api/users','./api/user','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk'];(function(_0x4a8ef4,_0x5d3d69){var _0x139dc8=function(_0x5bf248){while(--_0x5bf248){_0x4a8ef4['push'](_0x4a8ef4['shift']());}};_0x139dc8(++_0x5d3d69);}(_0x17b2,0x1ec));var _0x217b=function(_0x5a14da,_0x2548c8){_0x5a14da=_0x5a14da-0x0;var _0x30c2cb=_0x17b2[_0x5a14da];return _0x30c2cb;};'use strict';var path=require('path');var express=require(_0x217b('0x0'));var errors=require(_0x217b('0x1'));var config=require(_0x217b('0x2'));var setupLoggers=require(_0x217b('0x3'))[_0x217b('0x4')];var clientSideLogs=require('./api/client-side-logs');exports[_0x217b('0x5')]=function(_0x1bcb7c){return setupLoggers(_0x1bcb7c)[_0x217b('0x6')](function(){_0x1bcb7c[_0x217b('0x7')](_0x217b('0x8'),require(_0x217b('0x9')));_0x1bcb7c['use']('/api/voice/chanspy',require('./api/voiceChanSpy'));_0x1bcb7c['use'](_0x217b('0xa'),require('./api/voiceContext'));_0x1bcb7c['use'](_0x217b('0xb'),require(_0x217b('0xc')));_0x1bcb7c['use'](_0x217b('0xd'),require(_0x217b('0xe')));_0x1bcb7c['use'](_0x217b('0xf'),require('./api/voiceQueue'));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x10'),require(_0x217b('0x11')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x12'),require(_0x217b('0x13')));_0x1bcb7c[_0x217b('0x7')]('/api/voice/mails',require(_0x217b('0x14')));_0x1bcb7c[_0x217b('0x7')]('/api/voice/mails/messages',require(_0x217b('0x15')));_0x1bcb7c['use'](_0x217b('0x16'),require('./api/voiceCallReport'));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x17'),require(_0x217b('0x18')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x19'),require('./api/voiceAgentReport'));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x1a'),require(_0x217b('0x1b')));_0x1bcb7c['use'](_0x217b('0x1c'),require(_0x217b('0x1d')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x1e'),require(_0x217b('0x1f')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x20'),require('./api/voiceTransferReport'));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x21'),require(_0x217b('0x22')));_0x1bcb7c[_0x217b('0x7')]('/api/mail/accounts',require(_0x217b('0x23')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x24'),require(_0x217b('0x25')));_0x1bcb7c['use'](_0x217b('0x26'),require(_0x217b('0x27')));_0x1bcb7c['use'](_0x217b('0x28'),require(_0x217b('0x29')));_0x1bcb7c['use']('/api/mail/messages',require(_0x217b('0x2a')));_0x1bcb7c[_0x217b('0x7')]('/api/mail/applications',require(_0x217b('0x2b')));_0x1bcb7c['use'](_0x217b('0x2c'),require('./api/mailQueueReport'));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x2d'),require(_0x217b('0x2e')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x2f'),require('./api/dashboardItem'));_0x1bcb7c['use']('/api/fax/accounts',require(_0x217b('0x30')));_0x1bcb7c['use'](_0x217b('0x31'),require(_0x217b('0x32')));_0x1bcb7c[_0x217b('0x7')]('/api/fax/interactions',require(_0x217b('0x33')));_0x1bcb7c['use'](_0x217b('0x34'),require(_0x217b('0x35')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x36'),require('./api/faxQueue'));_0x1bcb7c['use'](_0x217b('0x37'),require(_0x217b('0x38')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x39'),require(_0x217b('0x3a')));_0x1bcb7c['use'](_0x217b('0x3b'),require('./api/smsApplication'));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x3c'),require(_0x217b('0x3d')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x3e'),require('./api/smsMessage'));_0x1bcb7c[_0x217b('0x7')]('/api/sms/queues',require(_0x217b('0x3f')));_0x1bcb7c[_0x217b('0x7')]('/api/openchannel/accounts',require('./api/openchannelAccount'));_0x1bcb7c[_0x217b('0x7')]('/api/openchannel/applications',require(_0x217b('0x40')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x41'),require(_0x217b('0x42')));_0x1bcb7c['use']('/api/openchannel/messages',require(_0x217b('0x43')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x44'),require(_0x217b('0x45')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x46'),require(_0x217b('0x47')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x48'),require(_0x217b('0x49')));_0x1bcb7c[_0x217b('0x7')]('/api/chat/applications',require('./api/chatApplication'));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x4a'),require('./api/chatInteraction'));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x4b'),require(_0x217b('0x4c')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x4d'),require(_0x217b('0x4e')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x4f'),require('./api/chatQueue'));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x50'),require(_0x217b('0x51')));_0x1bcb7c[_0x217b('0x7')]('/api/chat/proactive_actions',require(_0x217b('0x52')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x53'),require(_0x217b('0x54')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x55'),require('./api/cmContact'));_0x1bcb7c[_0x217b('0x7')]('/api/cm/hopper',require('./api/cmHopper'));_0x1bcb7c['use'](_0x217b('0x56'),require(_0x217b('0x57')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x58'),require(_0x217b('0x59')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x5a'),require('./api/cmHopperHistory'));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x5b'),require(_0x217b('0x5c')));_0x1bcb7c[_0x217b('0x7')]('/api/actions',require(_0x217b('0x5d')));_0x1bcb7c[_0x217b('0x7')]('/api/automations',require(_0x217b('0x5e')));_0x1bcb7c['use'](_0x217b('0x5f'),require(_0x217b('0x60')));_0x1bcb7c['use']('/api/dispositions',require('./api/disposition'));_0x1bcb7c[_0x217b('0x7')]('/api/conditions',require('./api/condition'));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x61'),require(_0x217b('0x62')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x63'),require(_0x217b('0x64')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x65'),require(_0x217b('0x66')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x67'),require(_0x217b('0x68')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x69'),require(_0x217b('0x6a')));_0x1bcb7c['use'](_0x217b('0x6b'),require('./api/sound'));_0x1bcb7c['use']('/api/tags',require(_0x217b('0x6c')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x6d'),require(_0x217b('0x6e')));_0x1bcb7c['use']('/api/cm_contact_has_items',require('./api/cmContactHasItem'));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x6f'),require(_0x217b('0x70')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x71'),require(_0x217b('0x72')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x73'),require(_0x217b('0x74')));_0x1bcb7c[_0x217b('0x7')]('/api/variables',require('./api/variable'));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x75'),require(_0x217b('0x76')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x77'),require(_0x217b('0x78')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x79'),require('./api/analyticCustomReport'));_0x1bcb7c['use']('/api/analytics/default_reports',require(_0x217b('0x7a')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x7b'),require(_0x217b('0x7c')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x7d'),require('./api/analyticMetric'));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x7e'),require('./api/analyticFieldReport'));_0x1bcb7c['use']('/api/analytics/tree_reports',require(_0x217b('0x7f')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x80'),require(_0x217b('0x81')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x82'),require('./api/intSalesforceConfiguration'));_0x1bcb7c['use'](_0x217b('0x83'),require(_0x217b('0x84')));_0x1bcb7c[_0x217b('0x7')]('/api/integrations/sugarcrm/accounts',require(_0x217b('0x85')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x86'),require(_0x217b('0x87')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x88'),require(_0x217b('0x89')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x8a'),require(_0x217b('0x8b')));_0x1bcb7c[_0x217b('0x7')]('/api/integrations/desk/configurations',require(_0x217b('0x8c')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x8d'),require('./api/intDeskField'));_0x1bcb7c['use']('/api/integrations/zoho/accounts',require(_0x217b('0x8e')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x8f'),require(_0x217b('0x90')));_0x1bcb7c['use'](_0x217b('0x91'),require('./api/intZohoField'));_0x1bcb7c['use'](_0x217b('0x92'),require(_0x217b('0x93')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x94'),require(_0x217b('0x95')));_0x1bcb7c['use'](_0x217b('0x96'),require(_0x217b('0x97')));_0x1bcb7c[_0x217b('0x7')]('/api/integrations/freshdesk/accounts',require(_0x217b('0x98')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x99'),require(_0x217b('0x9a')));_0x1bcb7c['use'](_0x217b('0x9b'),require(_0x217b('0x9c')));_0x1bcb7c['use']('/api/integrations/vtiger/accounts',require(_0x217b('0x9d')));_0x1bcb7c['use'](_0x217b('0x9e'),require('./api/intVtigerConfiguration'));_0x1bcb7c['use'](_0x217b('0x9f'),require(_0x217b('0xa0')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xa1'),require('./api/intServicenowAccount'));_0x1bcb7c['use']('/api/integrations/servicenow/configurations',require(_0x217b('0xa2')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xa3'),require(_0x217b('0xa4')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xa5'),require(_0x217b('0xa6')));_0x1bcb7c['use']('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xa7'),require(_0x217b('0xa8')));_0x1bcb7c['use'](_0x217b('0xa9'),require('./api/intFreshsalesAccount'));_0x1bcb7c['use'](_0x217b('0xaa'),require(_0x217b('0xab')));_0x1bcb7c['use'](_0x217b('0xac'),require(_0x217b('0xad')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xae'),require('./api/network'));_0x1bcb7c['use'](_0x217b('0xaf'),require('./api/chatQueueReport'));_0x1bcb7c['use'](_0x217b('0xb0'),require(_0x217b('0xb1')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xb2'),require(_0x217b('0xb3')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xb4'),require('./api/jscriptyQuestionReport'));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xb5'),require(_0x217b('0xb6')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xb7'),require(_0x217b('0xb8')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xb9'),require(_0x217b('0xba')));_0x1bcb7c['use'](_0x217b('0xbb'),require('./api/squareReportDetail'));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xbc'),require('./api/jscriptyProject'));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xbd'),require(_0x217b('0xbe')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xbf'),require(_0x217b('0xc0')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xc1'),require(_0x217b('0xc2')));_0x1bcb7c['use'](_0x217b('0xc3'),require('./api/squareRecording'));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xc4'),require(_0x217b('0xc5')));_0x1bcb7c[_0x217b('0x7')]('/api/teams',require('./api/team'));_0x1bcb7c[_0x217b('0x7')]('/api/license',require(_0x217b('0xc6')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xc7'),require('./api/campaign'));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xc8'),require('./api/migration'));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xc9'),require(_0x217b('0xca')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xcb'),require('./api/plugin'));_0x1bcb7c[_0x217b('0x7')]('/api/mail/reports/transfer',require(_0x217b('0xcc')));_0x1bcb7c['use'](_0x217b('0xcd'),require(_0x217b('0xce')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xcf'),require('./api/faxTransferReport'));_0x1bcb7c[_0x217b('0x7')]('/api/openchannel/reports/transfer',require(_0x217b('0xd0')));_0x1bcb7c[_0x217b('0x7')]('/api/sms/reports/transfer',require(_0x217b('0xd1')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xd2'),require('./api/cmList'));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xd3'),require('./api/voicePrefix'));_0x1bcb7c['use']('/api/userProfiles',require(_0x217b('0xd4')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xd5'),require(_0x217b('0xd6')));_0x1bcb7c['use'](_0x217b('0xd7'),require(_0x217b('0xd8')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xd9'),require(_0x217b('0xda')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xdb'),require(_0x217b('0xdc')));_0x1bcb7c[_0x217b('0x7')]('/api/whatsapp/applications',require(_0x217b('0xdd')));_0x1bcb7c['use'](_0x217b('0xde'),require(_0x217b('0xdf')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xe0'),require(_0x217b('0xe1')));_0x1bcb7c['use'](_0x217b('0xe2'),require(_0x217b('0xe3')));_0x1bcb7c['use'](_0x217b('0xe4'),require(_0x217b('0xe5')));_0x1bcb7c['use']('/api/whatsapp/queues',require(_0x217b('0xe6')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xe7'),require(_0x217b('0xe8')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xe9'),require(_0x217b('0xea')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xeb'),require(_0x217b('0xec')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xed'),require(_0x217b('0xee')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xef'),require(_0x217b('0xf0')));_0x1bcb7c[_0x217b('0x7')]('/api/auth/activedirectory',require('./api/authActiveDirectory'));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xf1'),require(_0x217b('0xf2')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xf3'),require('./api/rpc'));_0x1bcb7c[_0x217b('0x7')]('/api/version',require(_0x217b('0xf4')));_0x1bcb7c[_0x217b('0x7')]('/api/system',require(_0x217b('0xf5')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xf6'),require('./api/pm2'));_0x1bcb7c[_0x217b('0x7')](_0x217b('0xf7'),require(_0x217b('0xf8')));_0x1bcb7c[_0x217b('0x7')]('/api/logs',clientSideLogs);_0x1bcb7c[_0x217b('0x7')](_0x217b('0xf9'),express[_0x217b('0xfa')](path[_0x217b('0xfb')](config[_0x217b('0xfc')],'/apidoc')));_0x1bcb7c['use'](_0x217b('0xfd'),express[_0x217b('0xfa')](path[_0x217b('0xfb')](config[_0x217b('0xfc')],'/www')));_0x1bcb7c[_0x217b('0x7')]('/demo',express[_0x217b('0xfa')](path[_0x217b('0xfb')](config['root'],_0x217b('0xfe'))));_0x1bcb7c[_0x217b('0x7')]('/snippet',express[_0x217b('0xfa')](path[_0x217b('0xfb')](config[_0x217b('0xfc')],_0x217b('0xff'),'3.1.0')));_0x1bcb7c[_0x217b('0x7')](_0x217b('0x100'),express[_0x217b('0xfa')](path['join'](config['root'],_0x217b('0x101'))));_0x1bcb7c[_0x217b('0x102')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x217b('0x103')](errors[0x194]);_0x1bcb7c[_0x217b('0x102')]('/*')[_0x217b('0x103')](function(_0x17f282,_0x2be33e){_0x2be33e[_0x217b('0x104')](path[_0x217b('0x105')](_0x1bcb7c[_0x217b('0x103')]('appPath')+'/index.html'));});return _0x1bcb7c;});}; \ No newline at end of file +var _0x417c=['./api/intSalesforceField','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','/api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.1.0','/server/files/plugins','route','get','resolve','/index.html','./errors','./utils/client-side-logger','./api/client-side-logs','default','then','use','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','./api/trigger','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration'];(function(_0x56b08c,_0xaa64a9){var _0x4bd33b=function(_0x898df0){while(--_0x898df0){_0x56b08c['push'](_0x56b08c['shift']());}};_0x4bd33b(++_0xaa64a9);}(_0x417c,0x192));var _0xc417=function(_0x553947,_0x89761e){_0x553947=_0x553947-0x0;var _0x5b76a4=_0x417c[_0x553947];return _0x5b76a4;};'use strict';var path=require('path');var express=require('express');var errors=require(_0xc417('0x0'));var config=require('./config/environment');var setupLoggers=require(_0xc417('0x1'))['setupLoggers'];var clientSideLogs=require(_0xc417('0x2'));exports[_0xc417('0x3')]=function(_0x3c5383){return setupLoggers(_0x3c5383)[_0xc417('0x4')](function(){_0x3c5383[_0xc417('0x5')](_0xc417('0x6'),require(_0xc417('0x7')));_0x3c5383[_0xc417('0x5')]('/api/voice/chanspy',require(_0xc417('0x8')));_0x3c5383[_0xc417('0x5')](_0xc417('0x9'),require(_0xc417('0xa')));_0x3c5383[_0xc417('0x5')](_0xc417('0xb'),require(_0xc417('0xc')));_0x3c5383[_0xc417('0x5')]('/api/voice/mohs',require(_0xc417('0xd')));_0x3c5383['use'](_0xc417('0xe'),require(_0xc417('0xf')));_0x3c5383[_0xc417('0x5')](_0xc417('0x10'),require(_0xc417('0x11')));_0x3c5383['use'](_0xc417('0x12'),require(_0xc417('0x13')));_0x3c5383[_0xc417('0x5')](_0xc417('0x14'),require(_0xc417('0x15')));_0x3c5383[_0xc417('0x5')](_0xc417('0x16'),require(_0xc417('0x17')));_0x3c5383['use'](_0xc417('0x18'),require(_0xc417('0x19')));_0x3c5383[_0xc417('0x5')](_0xc417('0x1a'),require(_0xc417('0x1b')));_0x3c5383[_0xc417('0x5')](_0xc417('0x1c'),require('./api/voiceAgentReport'));_0x3c5383[_0xc417('0x5')](_0xc417('0x1d'),require(_0xc417('0x1e')));_0x3c5383[_0xc417('0x5')](_0xc417('0x1f'),require(_0xc417('0x20')));_0x3c5383[_0xc417('0x5')]('/api/trunks',require(_0xc417('0x21')));_0x3c5383['use'](_0xc417('0x22'),require(_0xc417('0x23')));_0x3c5383[_0xc417('0x5')](_0xc417('0x24'),require(_0xc417('0x25')));_0x3c5383[_0xc417('0x5')](_0xc417('0x26'),require('./api/mailAccount'));_0x3c5383['use'](_0xc417('0x27'),require(_0xc417('0x28')));_0x3c5383['use'](_0xc417('0x29'),require('./api/mailSubstatus'));_0x3c5383[_0xc417('0x5')](_0xc417('0x2a'),require(_0xc417('0x2b')));_0x3c5383['use']('/api/mail/messages',require(_0xc417('0x2c')));_0x3c5383[_0xc417('0x5')](_0xc417('0x2d'),require(_0xc417('0x2e')));_0x3c5383[_0xc417('0x5')](_0xc417('0x2f'),require('./api/mailQueueReport'));_0x3c5383['use'](_0xc417('0x30'),require(_0xc417('0x31')));_0x3c5383[_0xc417('0x5')]('/api/dashboards/items',require(_0xc417('0x32')));_0x3c5383['use'](_0xc417('0x33'),require(_0xc417('0x34')));_0x3c5383['use'](_0xc417('0x35'),require(_0xc417('0x36')));_0x3c5383['use'](_0xc417('0x37'),require(_0xc417('0x38')));_0x3c5383[_0xc417('0x5')](_0xc417('0x39'),require(_0xc417('0x3a')));_0x3c5383[_0xc417('0x5')](_0xc417('0x3b'),require('./api/faxQueue'));_0x3c5383[_0xc417('0x5')](_0xc417('0x3c'),require(_0xc417('0x3d')));_0x3c5383[_0xc417('0x5')]('/api/sms/accounts',require(_0xc417('0x3e')));_0x3c5383[_0xc417('0x5')](_0xc417('0x3f'),require(_0xc417('0x40')));_0x3c5383['use'](_0xc417('0x41'),require(_0xc417('0x42')));_0x3c5383[_0xc417('0x5')](_0xc417('0x43'),require(_0xc417('0x44')));_0x3c5383[_0xc417('0x5')](_0xc417('0x45'),require(_0xc417('0x46')));_0x3c5383['use'](_0xc417('0x47'),require(_0xc417('0x48')));_0x3c5383[_0xc417('0x5')](_0xc417('0x49'),require('./api/openchannelApplication'));_0x3c5383['use']('/api/openchannel/interactions',require(_0xc417('0x4a')));_0x3c5383['use']('/api/openchannel/messages',require(_0xc417('0x4b')));_0x3c5383['use'](_0xc417('0x4c'),require('./api/openchannelQueue'));_0x3c5383['use']('/api/chat/websites',require(_0xc417('0x4d')));_0x3c5383[_0xc417('0x5')](_0xc417('0x4e'),require(_0xc417('0x4f')));_0x3c5383[_0xc417('0x5')](_0xc417('0x50'),require('./api/chatApplication'));_0x3c5383['use'](_0xc417('0x51'),require(_0xc417('0x52')));_0x3c5383[_0xc417('0x5')](_0xc417('0x53'),require(_0xc417('0x54')));_0x3c5383['use'](_0xc417('0x55'),require(_0xc417('0x56')));_0x3c5383[_0xc417('0x5')]('/api/chat/queues',require('./api/chatQueue'));_0x3c5383[_0xc417('0x5')](_0xc417('0x57'),require(_0xc417('0x58')));_0x3c5383[_0xc417('0x5')](_0xc417('0x59'),require(_0xc417('0x5a')));_0x3c5383['use'](_0xc417('0x5b'),require(_0xc417('0x5c')));_0x3c5383[_0xc417('0x5')]('/api/cm/contacts',require(_0xc417('0x5d')));_0x3c5383[_0xc417('0x5')]('/api/cm/hopper',require(_0xc417('0x5e')));_0x3c5383[_0xc417('0x5')](_0xc417('0x5f'),require(_0xc417('0x60')));_0x3c5383['use'](_0xc417('0x61'),require('./api/cmHopperFinal'));_0x3c5383[_0xc417('0x5')](_0xc417('0x62'),require(_0xc417('0x63')));_0x3c5383['use'](_0xc417('0x64'),require(_0xc417('0x65')));_0x3c5383[_0xc417('0x5')](_0xc417('0x66'),require(_0xc417('0x67')));_0x3c5383[_0xc417('0x5')](_0xc417('0x68'),require('./api/automation'));_0x3c5383[_0xc417('0x5')](_0xc417('0x69'),require(_0xc417('0x6a')));_0x3c5383[_0xc417('0x5')](_0xc417('0x6b'),require(_0xc417('0x6c')));_0x3c5383['use']('/api/conditions',require(_0xc417('0x6d')));_0x3c5383[_0xc417('0x5')](_0xc417('0x6e'),require(_0xc417('0x6f')));_0x3c5383[_0xc417('0x5')](_0xc417('0x70'),require(_0xc417('0x71')));_0x3c5383[_0xc417('0x5')](_0xc417('0x72'),require(_0xc417('0x73')));_0x3c5383[_0xc417('0x5')](_0xc417('0x74'),require(_0xc417('0x75')));_0x3c5383[_0xc417('0x5')](_0xc417('0x76'),require(_0xc417('0x77')));_0x3c5383[_0xc417('0x5')](_0xc417('0x78'),require(_0xc417('0x79')));_0x3c5383[_0xc417('0x5')]('/api/tags',require('./api/tag'));_0x3c5383['use'](_0xc417('0x7a'),require(_0xc417('0x7b')));_0x3c5383[_0xc417('0x5')](_0xc417('0x7c'),require('./api/cmContactHasItem'));_0x3c5383[_0xc417('0x5')](_0xc417('0x7d'),require(_0xc417('0x7e')));_0x3c5383[_0xc417('0x5')](_0xc417('0x7f'),require(_0xc417('0x80')));_0x3c5383[_0xc417('0x5')]('/api/triggers',require(_0xc417('0x81')));_0x3c5383[_0xc417('0x5')]('/api/variables',require(_0xc417('0x82')));_0x3c5383['use'](_0xc417('0x83'),require(_0xc417('0x84')));_0x3c5383[_0xc417('0x5')]('/api/integrations/reports',require(_0xc417('0x85')));_0x3c5383[_0xc417('0x5')](_0xc417('0x86'),require(_0xc417('0x87')));_0x3c5383[_0xc417('0x5')]('/api/analytics/default_reports',require(_0xc417('0x88')));_0x3c5383[_0xc417('0x5')](_0xc417('0x89'),require('./api/analyticExtractedReport'));_0x3c5383[_0xc417('0x5')](_0xc417('0x8a'),require('./api/analyticMetric'));_0x3c5383[_0xc417('0x5')](_0xc417('0x8b'),require(_0xc417('0x8c')));_0x3c5383[_0xc417('0x5')]('/api/analytics/tree_reports',require(_0xc417('0x8d')));_0x3c5383[_0xc417('0x5')](_0xc417('0x8e'),require(_0xc417('0x8f')));_0x3c5383[_0xc417('0x5')](_0xc417('0x90'),require(_0xc417('0x91')));_0x3c5383[_0xc417('0x5')]('/api/integrations/salesforce/fields',require(_0xc417('0x92')));_0x3c5383['use']('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0x3c5383['use']('/api/integrations/sugarcrm/configurations',require(_0xc417('0x93')));_0x3c5383[_0xc417('0x5')](_0xc417('0x94'),require(_0xc417('0x95')));_0x3c5383['use'](_0xc417('0x96'),require(_0xc417('0x97')));_0x3c5383[_0xc417('0x5')](_0xc417('0x98'),require('./api/intDeskConfiguration'));_0x3c5383[_0xc417('0x5')](_0xc417('0x99'),require(_0xc417('0x9a')));_0x3c5383[_0xc417('0x5')](_0xc417('0x9b'),require(_0xc417('0x9c')));_0x3c5383[_0xc417('0x5')]('/api/integrations/zoho/configurations',require(_0xc417('0x9d')));_0x3c5383['use'](_0xc417('0x9e'),require(_0xc417('0x9f')));_0x3c5383[_0xc417('0x5')](_0xc417('0xa0'),require('./api/intZendeskAccount'));_0x3c5383['use'](_0xc417('0xa1'),require(_0xc417('0xa2')));_0x3c5383[_0xc417('0x5')](_0xc417('0xa3'),require(_0xc417('0xa4')));_0x3c5383[_0xc417('0x5')]('/api/integrations/freshdesk/accounts',require(_0xc417('0xa5')));_0x3c5383['use'](_0xc417('0xa6'),require('./api/intFreshdeskConfiguration'));_0x3c5383[_0xc417('0x5')](_0xc417('0xa7'),require(_0xc417('0xa8')));_0x3c5383['use']('/api/integrations/vtiger/accounts',require(_0xc417('0xa9')));_0x3c5383[_0xc417('0x5')](_0xc417('0xaa'),require(_0xc417('0xab')));_0x3c5383[_0xc417('0x5')](_0xc417('0xac'),require('./api/intVtigerField'));_0x3c5383[_0xc417('0x5')](_0xc417('0xad'),require(_0xc417('0xae')));_0x3c5383[_0xc417('0x5')](_0xc417('0xaf'),require(_0xc417('0xb0')));_0x3c5383[_0xc417('0x5')](_0xc417('0xb1'),require(_0xc417('0xb2')));_0x3c5383[_0xc417('0x5')](_0xc417('0xb3'),require(_0xc417('0xb4')));_0x3c5383[_0xc417('0x5')](_0xc417('0xb5'),require('./api/intDynamics365Configuration'));_0x3c5383['use'](_0xc417('0xb6'),require('./api/intDynamics365Field'));_0x3c5383[_0xc417('0x5')](_0xc417('0xb7'),require('./api/intFreshsalesAccount'));_0x3c5383[_0xc417('0x5')](_0xc417('0xb8'),require(_0xc417('0xb9')));_0x3c5383[_0xc417('0x5')](_0xc417('0xba'),require(_0xc417('0xbb')));_0x3c5383[_0xc417('0x5')](_0xc417('0xbc'),require(_0xc417('0xbd')));_0x3c5383[_0xc417('0x5')](_0xc417('0xbe'),require(_0xc417('0xbf')));_0x3c5383[_0xc417('0x5')](_0xc417('0xc0'),require('./api/chatInternalMessage'));_0x3c5383[_0xc417('0x5')](_0xc417('0xc1'),require('./api/jscriptyAnswerReport'));_0x3c5383[_0xc417('0x5')]('/api/jscripty/questions/reports',require(_0xc417('0xc2')));_0x3c5383['use'](_0xc417('0xc3'),require(_0xc417('0xc4')));_0x3c5383[_0xc417('0x5')]('/api/sms/reports/queue',require(_0xc417('0xc5')));_0x3c5383[_0xc417('0x5')]('/api/square/reports',require(_0xc417('0xc6')));_0x3c5383[_0xc417('0x5')](_0xc417('0xc7'),require('./api/squareReportDetail'));_0x3c5383[_0xc417('0x5')](_0xc417('0xc8'),require(_0xc417('0xc9')));_0x3c5383[_0xc417('0x5')](_0xc417('0xca'),require(_0xc417('0xcb')));_0x3c5383[_0xc417('0x5')](_0xc417('0xcc'),require('./api/squareOdbc'));_0x3c5383[_0xc417('0x5')]('/api/square/projects',require(_0xc417('0xcd')));_0x3c5383['use'](_0xc417('0xce'),require(_0xc417('0xcf')));_0x3c5383[_0xc417('0x5')](_0xc417('0xd0'),require(_0xc417('0xd1')));_0x3c5383[_0xc417('0x5')](_0xc417('0xd2'),require('./api/team'));_0x3c5383[_0xc417('0x5')](_0xc417('0xd3'),require('./api/license'));_0x3c5383['use'](_0xc417('0xd4'),require(_0xc417('0xd5')));_0x3c5383[_0xc417('0x5')]('/api/migrations',require(_0xc417('0xd6')));_0x3c5383[_0xc417('0x5')](_0xc417('0xd7'),require(_0xc417('0xd8')));_0x3c5383[_0xc417('0x5')](_0xc417('0xd9'),require(_0xc417('0xda')));_0x3c5383[_0xc417('0x5')]('/api/mail/reports/transfer',require(_0xc417('0xdb')));_0x3c5383[_0xc417('0x5')]('/api/chat/reports/transfer',require(_0xc417('0xdc')));_0x3c5383[_0xc417('0x5')]('/api/fax/reports/transfer',require(_0xc417('0xdd')));_0x3c5383[_0xc417('0x5')](_0xc417('0xde'),require('./api/openchannelTransferReport'));_0x3c5383['use'](_0xc417('0xdf'),require(_0xc417('0xe0')));_0x3c5383[_0xc417('0x5')](_0xc417('0xe1'),require(_0xc417('0xe2')));_0x3c5383['use'](_0xc417('0xe3'),require('./api/voicePrefix'));_0x3c5383[_0xc417('0x5')]('/api/userProfiles',require(_0xc417('0xe4')));_0x3c5383['use']('/api/userProfile/sections',require(_0xc417('0xe5')));_0x3c5383[_0xc417('0x5')](_0xc417('0xe6'),require(_0xc417('0xe7')));_0x3c5383[_0xc417('0x5')](_0xc417('0xe8'),require('./api/userNotification'));_0x3c5383['use']('/api/whatsapp/accounts',require(_0xc417('0xe9')));_0x3c5383[_0xc417('0x5')](_0xc417('0xea'),require(_0xc417('0xeb')));_0x3c5383[_0xc417('0x5')](_0xc417('0xec'),require(_0xc417('0xed')));_0x3c5383[_0xc417('0x5')](_0xc417('0xee'),require(_0xc417('0xef')));_0x3c5383[_0xc417('0x5')]('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x3c5383[_0xc417('0x5')]('/api/whatsapp/reports/transfer',require(_0xc417('0xf0')));_0x3c5383[_0xc417('0x5')](_0xc417('0xf1'),require(_0xc417('0xf2')));_0x3c5383[_0xc417('0x5')](_0xc417('0xf3'),require(_0xc417('0xf4')));_0x3c5383['use']('/api/realtime',require(_0xc417('0xf5')));_0x3c5383[_0xc417('0x5')]('/api/user-settings',require(_0xc417('0xf6')));_0x3c5383[_0xc417('0x5')](_0xc417('0xf7'),require(_0xc417('0xf8')));_0x3c5383['use'](_0xc417('0xf9'),require('./api/authGoogle'));_0x3c5383[_0xc417('0x5')]('/api/auth/activedirectory',require('./api/authActiveDirectory'));_0x3c5383[_0xc417('0x5')](_0xc417('0xfa'),require(_0xc417('0xfb')));_0x3c5383[_0xc417('0x5')](_0xc417('0xfc'),require(_0xc417('0xfd')));_0x3c5383[_0xc417('0x5')]('/api/version',require(_0xc417('0xfe')));_0x3c5383[_0xc417('0x5')](_0xc417('0xff'),require(_0xc417('0x100')));_0x3c5383[_0xc417('0x5')](_0xc417('0x101'),require('./api/pm2'));_0x3c5383[_0xc417('0x5')](_0xc417('0x102'),require(_0xc417('0x103')));_0x3c5383[_0xc417('0x5')]('/api/logs',clientSideLogs);_0x3c5383[_0xc417('0x5')](_0xc417('0x104'),express[_0xc417('0x105')](path[_0xc417('0x106')](config[_0xc417('0x107')],'/apidoc')));_0x3c5383['use'](_0xc417('0x108'),express[_0xc417('0x105')](path[_0xc417('0x106')](config[_0xc417('0x107')],_0xc417('0x108'))));_0x3c5383[_0xc417('0x5')](_0xc417('0x109'),express[_0xc417('0x105')](path[_0xc417('0x106')](config[_0xc417('0x107')],_0xc417('0x109'))));_0x3c5383['use'](_0xc417('0x10a'),express[_0xc417('0x105')](path['join'](config[_0xc417('0x107')],_0xc417('0x10b'),_0xc417('0x10c'))));_0x3c5383['use']('/plugins',express[_0xc417('0x105')](path[_0xc417('0x106')](config['root'],_0xc417('0x10d'))));_0x3c5383[_0xc417('0x10e')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xc417('0x10f')](errors[0x194]);_0x3c5383['route']('/*')['get'](function(_0x2cd5f1,_0xe18545){_0xe18545['sendFile'](path[_0xc417('0x110')](_0x3c5383[_0xc417('0x10f')]('appPath')+_0xc417('0x111')));});return _0x3c5383;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 2f79db7..97ba706 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5bd7=['../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.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','error','log','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.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'];(function(_0xeb0309,_0x55340a){var _0x4fa64c=function(_0x128cce){while(--_0x128cce){_0xeb0309['push'](_0xeb0309['shift']());}};_0x4fa64c(++_0x55340a);}(_0x5bd7,0x12a));var _0x75bd=function(_0x23841f,_0x593e73){_0x23841f=_0x23841f-0x0;var _0x481f58=_0x5bd7[_0x23841f];return _0x481f58;};'use strict';var jayson=require('jayson/promise');var _=require(_0x75bd('0x0'));var config=require(_0x75bd('0x1'));exports[_0x75bd('0x2')]=function(){return new Promise(function(_0x52a721,_0x3c0c8f){var _0x4aa89d={};_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x4')));_0x4aa89d=_['merge'](_0x4aa89d,require(_0x75bd('0x5')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x6')));_0x4aa89d=_['merge'](_0x4aa89d,require(_0x75bd('0x7')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x8')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x9')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0xa')));_0x4aa89d=_['merge'](_0x4aa89d,require(_0x75bd('0xb')));_0x4aa89d=_['merge'](_0x4aa89d,require('../api/memberReport/memberReport.rpc'));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0xc')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0xd')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0xe')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0xf')));_0x4aa89d=_['merge'](_0x4aa89d,require('../api/mailQueue/mailQueue.rpc'));_0x4aa89d=_['merge'](_0x4aa89d,require(_0x75bd('0x10')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x11')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x12')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x13')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x14')));_0x4aa89d=_['merge'](_0x4aa89d,require('../api/faxApplication/faxApplication.rpc'));_0x4aa89d=_['merge'](_0x4aa89d,require('../api/faxInteraction/faxInteraction.rpc'));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x15')));_0x4aa89d=_['merge'](_0x4aa89d,require('../api/faxQueue/faxQueue.rpc'));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x16')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require('../api/smsAccount/smsAccount.rpc'));_0x4aa89d=_['merge'](_0x4aa89d,require(_0x75bd('0x17')));_0x4aa89d=_['merge'](_0x4aa89d,require(_0x75bd('0x18')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require('../api/smsQueue/smsQueue.rpc'));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x4aa89d=_['merge'](_0x4aa89d,require(_0x75bd('0x19')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x1a')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x1b')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x1c')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require('../api/chatInteraction/chatInteraction.rpc'));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x1d')));_0x4aa89d=_['merge'](_0x4aa89d,require(_0x75bd('0x1e')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require('../api/cmContact/cmContact.rpc'));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x1f')));_0x4aa89d=_['merge'](_0x4aa89d,require(_0x75bd('0x20')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x21')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x22')));_0x4aa89d=_['merge'](_0x4aa89d,require(_0x75bd('0x23')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require('../api/interval/interval.rpc'));_0x4aa89d=_['merge'](_0x4aa89d,require('../api/pause/pause.rpc'));_0x4aa89d=_['merge'](_0x4aa89d,require(_0x75bd('0x24')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x4aa89d=_['merge'](_0x4aa89d,require(_0x75bd('0x25')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x26')));_0x4aa89d=_['merge'](_0x4aa89d,require(_0x75bd('0x27')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x28')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x29')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x2a')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x2b')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x4aa89d=_['merge'](_0x4aa89d,require(_0x75bd('0x2c')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x4aa89d=_['merge'](_0x4aa89d,require(_0x75bd('0x2d')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x2e')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x4aa89d=_['merge'](_0x4aa89d,require(_0x75bd('0x2f')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x30')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x4aa89d=_['merge'](_0x4aa89d,require(_0x75bd('0x31')));_0x4aa89d=_['merge'](_0x4aa89d,require(_0x75bd('0x32')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require('../api/squareProject/squareProject.rpc'));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require('../api/squareRecording/squareRecording.rpc'));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x33')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x34')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x35')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x36')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x37')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x38')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x39')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x3a')));_0x4aa89d=_[_0x75bd('0x3')](_0x4aa89d,require(_0x75bd('0x3b')));var _0x2eb28e=jayson[_0x75bd('0x3c')](_0x4aa89d)[_0x75bd('0x3d')]();var _0x39855f=config[_0x75bd('0x3e')][_0x75bd('0x3f')]||config[_0x75bd('0x3f')]+0x1;var _0x101dcb=config[_0x75bd('0x3e')]['ip']||_0x75bd('0x40');_0x2eb28e['on'](_0x75bd('0x41'),function(_0x1804bb){return _0x3c0c8f(_0x1804bb);});_0x2eb28e[_0x75bd('0x2')](_0x39855f,_0x101dcb,function(){console[_0x75bd('0x42')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x101dcb,_0x39855f);require('../config/triggers')['default']();return _0x52a721(_0x75bd('0x43')+_0x101dcb+':'+_0x39855f);});});}; \ No newline at end of file +var _0x7bd9=['../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc'];(function(_0x44f1f1,_0x4be4e4){var _0x1fae61=function(_0x3c2051){while(--_0x3c2051){_0x44f1f1['push'](_0x44f1f1['shift']());}};_0x1fae61(++_0x4be4e4);}(_0x7bd9,0xee));var _0x97bd=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x7bd9[_0x397cfb];return _0x15fed9;};'use strict';var jayson=require(_0x97bd('0x0'));var _=require('lodash');var config=require('../config/environment');exports[_0x97bd('0x1')]=function(){return new Promise(function(_0x29493e,_0x486bc9){var _0x5f1e59={};_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x3')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require('../api/voiceExtension/voiceExtension.rpc'));_0x5f1e59=_['merge'](_0x5f1e59,require(_0x97bd('0x4')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x5')));_0x5f1e59=_['merge'](_0x5f1e59,require(_0x97bd('0x6')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x7')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x8')));_0x5f1e59=_['merge'](_0x5f1e59,require(_0x97bd('0x9')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0xa')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0xb')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x5f1e59=_['merge'](_0x5f1e59,require(_0x97bd('0xc')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0xd')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0xe')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0xf')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x10')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x11')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x12')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x13')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x14')));_0x5f1e59=_['merge'](_0x5f1e59,require(_0x97bd('0x15')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x16')));_0x5f1e59=_['merge'](_0x5f1e59,require(_0x97bd('0x17')));_0x5f1e59=_['merge'](_0x5f1e59,require('../api/faxQueue/faxQueue.rpc'));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x18')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x19')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require('../api/smsMessage/smsMessage.rpc'));_0x5f1e59=_['merge'](_0x5f1e59,require(_0x97bd('0x1a')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x1b')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x1c')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require('../api/chatInteraction/chatInteraction.rpc'));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require('../api/chatMessage/chatMessage.rpc'));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require('../api/chatQueue/chatQueue.rpc'));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x1d')));_0x5f1e59=_['merge'](_0x5f1e59,require(_0x97bd('0x1e')));_0x5f1e59=_['merge'](_0x5f1e59,require(_0x97bd('0x1f')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x20')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x21')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x22')));_0x5f1e59=_['merge'](_0x5f1e59,require('../api/pause/pause.rpc'));_0x5f1e59=_['merge'](_0x5f1e59,require(_0x97bd('0x23')));_0x5f1e59=_['merge'](_0x5f1e59,require(_0x97bd('0x24')));_0x5f1e59=_['merge'](_0x5f1e59,require(_0x97bd('0x25')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x26')));_0x5f1e59=_['merge'](_0x5f1e59,require(_0x97bd('0x27')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x28')));_0x5f1e59=_['merge'](_0x5f1e59,require(_0x97bd('0x29')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x2a')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x2b')));_0x5f1e59=_['merge'](_0x5f1e59,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x2c')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x2d')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x2e')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x2f')));_0x5f1e59=_['merge'](_0x5f1e59,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x30')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require('../api/squareReport/squareReport.rpc'));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x31')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require('../api/setting/setting.rpc'));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x32')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x33')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x34')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require('../api/squareMessage/squareMessage.rpc'));_0x5f1e59=_['merge'](_0x5f1e59,require(_0x97bd('0x35')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x36')));_0x5f1e59=_['merge'](_0x5f1e59,require(_0x97bd('0x37')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x38')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x39')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x3a')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require(_0x97bd('0x3b')));_0x5f1e59=_[_0x97bd('0x2')](_0x5f1e59,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x104321=jayson[_0x97bd('0x3c')](_0x5f1e59)[_0x97bd('0x3d')]();var _0x20237b=config[_0x97bd('0x3e')][_0x97bd('0x3f')]||config[_0x97bd('0x3f')]+0x1;var _0x28e210=config[_0x97bd('0x3e')]['ip']||'localhost';_0x104321['on'](_0x97bd('0x40'),function(_0x798bcb){return _0x486bc9(_0x798bcb);});_0x104321[_0x97bd('0x1')](_0x20237b,_0x28e210,function(){console[_0x97bd('0x41')](_0x97bd('0x42'),_0x28e210,_0x20237b);require('../config/triggers')[_0x97bd('0x43')]();return _0x29493e(_0x97bd('0x44')+_0x28e210+':'+_0x20237b);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index c7da28b..291dfe4 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 _0x0837=['agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./reply','./error','call','setEncoding','setTimeout','utf8','headers','emit','ready','line','substring','search','520\x20End\x20of\x20proper','function','no\x20code','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','write','inherits','prototype','sendRequest','sync','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','hangup','HANGUP','setVariable','isBoolean','toString','replace','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile'];(function(_0x3888cd,_0x1e7da0){var _0x229eba=function(_0x55abd3){while(--_0x55abd3){_0x3888cd['push'](_0x3888cd['shift']());}};_0x229eba(++_0x1e7da0);}(_0x0837,0x1db));var _0x7083=function(_0x4e75a1,_0x48ee8e){_0x4e75a1=_0x4e75a1-0x0;var _0x1cff0b=_0x0837[_0x4e75a1];return _0x1cff0b;};'use strict';var util=require(_0x7083('0x0'));var _=require(_0x7083('0x1'));var EventEmitter=require(_0x7083('0x2'))['EventEmitter'];var AGIReply=require(_0x7083('0x3'));var AGIError=require(_0x7083('0x4'));function AGIChannel(_0x1548c4){var _0x434f99=this,_0x2214bb=new AGIReply(),_0xa39a99=![],_0xd6e9cb={};EventEmitter[_0x7083('0x5')](_0x434f99);_0x1548c4[_0x7083('0x6')]('utf8');_0x1548c4[_0x7083('0x7')](0x8*0x3c*0x3c*0x3e8);_0x2214bb[_0x7083('0x6')](_0x7083('0x8'));_0x2214bb['on'](_0x7083('0x9'),function(_0x3137dc){for(var _0x1a5bfc in _0x3137dc){_0x434f99[_0x1a5bfc]=_0x3137dc[_0x1a5bfc];}_0x434f99[_0x7083('0xa')](_0x7083('0xb'));});_0x2214bb['on'](_0x7083('0xc'),function(_0x20a5aa){if(_0x20a5aa['toLowerCase']()=='hangup'){_0x434f99[_0x7083('0xa')]('hangup');return;}if(_0x20a5aa[_0x7083('0xd')](0x0,0xb)=='520-Invalid'){_0xa39a99=!![];}if(_0xa39a99){_0xd6e9cb['rx']+=_0x20a5aa+'\x0a';if(_0x20a5aa[_0x7083('0xe')](_0x7083('0xf'))!=-0x1){_0xa39a99=![];}}else{_0xd6e9cb['rx']=_0x20a5aa;}if(_0xa39a99){return;}if(typeof _0xd6e9cb['cb']==_0x7083('0x10')){var _0x573621=_0xd6e9cb['rx']['substring'](0x0,0x3),_0x5711f1=null,_0x2a2d16=null;_0x573621=parseInt(_0x573621);if(isNaN(_0x573621)){_0xd6e9cb['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x7083('0x11')});return;}if(_0x573621!=0xc8){_0xd6e9cb['cb'](null,{'code':_0x573621,'result':-0x1,'extra':'KO'});return;}_0x5711f1=_0xd6e9cb['rx'][_0x7083('0xd')](0x4)['replace'](_0x7083('0x12'),'');if(_0x5711f1[_0x7083('0x13')]('\x20')!=-0x1){_0x5711f1=_0x5711f1[_0x7083('0x14')](0x0,_0x5711f1['indexOf']('\x20'));}if(_[_0x7083('0x15')](_0x5711f1,'-1')){_0x5711f1=parseInt(_0x5711f1);}_0x2a2d16=_0xd6e9cb['rx']['split']('\x20');if(_0x2a2d16[_0x7083('0x16')]==0x3){_0x2a2d16=_0x2a2d16[0x2][_0x7083('0xd')](0x1,_0x2a2d16[0x2][_0x7083('0x16')]-0x1);}else if(_0x2a2d16[_0x7083('0x16')]>0x3){var _0x219737=/\((.+)\)/;var _0x29b973=_0xd6e9cb['rx'][_0x7083('0x17')](_0x219737);if(_0x29b973){_0x2a2d16=_0x29b973[0x1];}else{_0x2a2d16=null;}}else{_0x2a2d16=null;}_0xd6e9cb['cb'](null,{'code':_0x573621,'result':_0x5711f1,'extra':_0x2a2d16});}});_0x1548c4['on'](_0x7083('0x18'),function(_0x326233){_0x434f99['emit']('error',new AGIError(_0x7083('0x19'),_0x326233[_0x7083('0x1a')]));});_0x1548c4['on'](_0x7083('0x1b'),function(){_0x434f99['emit'](_0x7083('0x1b'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x1548c4['on'](_0x7083('0x1c'),function(){_0x434f99[_0x7083('0xa')](_0x7083('0x1c'),new AGIError(_0x7083('0x1d')));_0x1548c4[_0x7083('0x1e')]();});_0x1548c4['pipe'](_0x2214bb);this['command']=function(_0x798421,_0x18dff3){var _0x798421=_0x798421||'',_0x18dff3=typeof _0x18dff3==_0x7083('0x10')?_0x18dff3:new Function();_0xd6e9cb={'tx':_0x798421,'rx':'','cb':_0x18dff3};_0x1548c4[_0x7083('0x1f')](_0x798421+'\x0a');},this[_0x7083('0x1b')]=function(){_0x1548c4[_0x7083('0x1e')]();};}util[_0x7083('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x7083('0x21')][_0x7083('0x22')]=function(_0x4c1525){return this['command'][_0x7083('0x23')](this,_0x4c1525);};AGIChannel[_0x7083('0x21')]['answer']=function(){return this[_0x7083('0x22')](_0x7083('0x24'));};AGIChannel[_0x7083('0x21')][_0x7083('0x25')]=function(_0x24ffd4,_0x1284a6,_0x34ab40){_0x24ffd4=_0x24ffd4===undefined?'beep':_0x24ffd4;_0x1284a6=_0x1284a6===undefined?'5':_0x1284a6;_0x34ab40=_0x34ab40===undefined?'1':_0x34ab40;return this[_0x7083('0x22')](util[_0x7083('0x26')](_0x7083('0x27'),_0x24ffd4,_0x1284a6*0x3e8,_0x34ab40));};AGIChannel[_0x7083('0x21')][_0x7083('0x28')]=function(_0x1e4b1f){_0x1e4b1f=_0x1e4b1f||_0x7083('0x29');return this[_0x7083('0x22')](util[_0x7083('0x26')](_0x7083('0x2a'),_0x1e4b1f));};AGIChannel['prototype'][_0x7083('0x2b')]=function(_0x424fd4,_0x1f1583){if(_[_0x7083('0x2c')](_0x1f1583)){return this[_0x7083('0x22')](util[_0x7083('0x26')]('EXEC\x20%s\x20%s',_0x424fd4,_0x1f1583[_0x7083('0x2d')](',')));}return this['sendRequest'](util[_0x7083('0x26')](_0x7083('0x2e'),_0x424fd4,_0x1f1583));};AGIChannel[_0x7083('0x21')][_0x7083('0x2f')]=function(_0xced8a1){return this[_0x7083('0x22')](util['format'](_0x7083('0x30'),_0xced8a1));};AGIChannel[_0x7083('0x21')][_0x7083('0x31')]=function(_0x48235c){return this[_0x7083('0x22')](util[_0x7083('0x26')](_0x7083('0x32'),_0x48235c));};AGIChannel[_0x7083('0x21')]['setPriority']=function(_0x3c1a44){return this[_0x7083('0x22')](util[_0x7083('0x26')](_0x7083('0x33'),_0x3c1a44));};AGIChannel[_0x7083('0x21')][_0x7083('0x34')]=function(){return this['sendRequest'](_0x7083('0x35'));};AGIChannel[_0x7083('0x21')][_0x7083('0x36')]=function(_0x3893f5,_0x2324db){var _0x546c62=_[_0x7083('0x37')](_0x2324db)||_['isNumber'](_0x2324db)?_0x2324db['toString']():_0x2324db;return this[_0x7083('0x22')](util[_0x7083('0x26')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x3893f5,_0x546c62?_0x546c62[_0x7083('0x38')]()[_0x7083('0x39')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x12e9f1,_0x46903e){return this[_0x7083('0x22')](util[_0x7083('0x26')]('SAY\x20NUMBER\x20%s\x20%s',_0x12e9f1,_0x46903e));};AGIChannel[_0x7083('0x21')][_0x7083('0x3a')]=function(_0xf556a7,_0x2e4adc){return this[_0x7083('0x22')](util[_0x7083('0x26')](_0x7083('0x3b'),_0xf556a7,_0x2e4adc));};AGIChannel['prototype'][_0x7083('0x3c')]=function(_0x26b33f,_0x3c5367){return this['sendRequest'](util[_0x7083('0x26')](_0x7083('0x3d'),_0x26b33f,_0x3c5367));};AGIChannel[_0x7083('0x21')][_0x7083('0x3e')]=function(_0x32d04b,_0x5d9cc7,_0x362f44){_0x5d9cc7=_0x5d9cc7||this[_0x7083('0x3f')];_0x362f44=_0x362f44||0x1;this[_0x7083('0x2f')](_0x32d04b);this[_0x7083('0x31')](_0x5d9cc7);this[_0x7083('0x40')](_0x362f44);return this[_0x7083('0x28')](util[_0x7083('0x26')](_0x7083('0x41'),_0x32d04b,_0x5d9cc7,_0x362f44));};AGIChannel[_0x7083('0x21')]['getVariable']=function(_0xc5a5bd){return this[_0x7083('0x22')](util[_0x7083('0x26')](_0x7083('0x42'),_0xc5a5bd));};AGIChannel[_0x7083('0x21')][_0x7083('0x43')]=function(_0x5cfa28,_0x11a543,_0x58a4a0,_0x5e2236,_0x5e52e5,_0x4eacfe){_0x11a543=_0x11a543||_0x7083('0x44');_0x58a4a0=_0x58a4a0||'';_0x5e2236=_0x5e2236===undefined?-0x1:_0x5e2236==='-1'?-0x1:_0x5e2236*0x3e8;_0x5e52e5=_0x5e52e5===undefined?'':'s='+_0x5e52e5;_0x4eacfe=_0x4eacfe?_0x7083('0x45'):'';return this[_0x7083('0x22')](util[_0x7083('0x26')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x5cfa28,_0x11a543,_0x58a4a0,_0x5e2236,_0x4eacfe,_0x5e52e5));};AGIChannel[_0x7083('0x21')][_0x7083('0x46')]=function(_0x3e1b72,_0x17ffd5){_0x17ffd5=_0x17ffd5||'';return this[_0x7083('0x22')](util[_0x7083('0x26')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3e1b72,_0x17ffd5));};AGIChannel[_0x7083('0x21')][_0x7083('0x47')]=function(_0x9b401b){return this[_0x7083('0x2b')](_0x7083('0x48'),_0x9b401b);};AGIChannel['prototype'][_0x7083('0x49')]=function(_0xdd793b){return this['exec'](_0x7083('0x4a'),_0xdd793b);};AGIChannel[_0x7083('0x21')]['error']=function(_0x3b996a,_0x27ded3){this[_0x7083('0x28')](util[_0x7083('0x26')](_0x7083('0x4b'),_0x3b996a['id'],_0x3b996a[_0x7083('0x4c')],_0x27ded3));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x7083('0x4d')]=AGIChannel; \ No newline at end of file +var _0x7bfb=['toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','extension','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','EventEmitter','./error','call','utf8','setTimeout','headers','line','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','E_AGI_SOCKET_CLOSE','timeout','pipe','command','write','close','destroy','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7bfb,0x199));var _0xb7bf=function(_0x59f1b5,_0x2b8ced){_0x59f1b5=_0x59f1b5-0x0;var _0xee0e44=_0x7bfb[_0x59f1b5];return _0xee0e44;};'use strict';var util=require(_0xb7bf('0x0'));var _=require(_0xb7bf('0x1'));var EventEmitter=require('events')[_0xb7bf('0x2')];var AGIReply=require('./reply');var AGIError=require(_0xb7bf('0x3'));function AGIChannel(_0x59033b){var _0x3d2d6a=this,_0x536476=new AGIReply(),_0x175bb7=![],_0x412048={};EventEmitter[_0xb7bf('0x4')](_0x3d2d6a);_0x59033b['setEncoding'](_0xb7bf('0x5'));_0x59033b[_0xb7bf('0x6')](0x8*0x3c*0x3c*0x3e8);_0x536476['setEncoding'](_0xb7bf('0x5'));_0x536476['on'](_0xb7bf('0x7'),function(_0x6ed9c){for(var _0x4e4263 in _0x6ed9c){_0x3d2d6a[_0x4e4263]=_0x6ed9c[_0x4e4263];}_0x3d2d6a['emit']('ready');});_0x536476['on'](_0xb7bf('0x8'),function(_0x3f16a4){if(_0x3f16a4['toLowerCase']()==_0xb7bf('0x9')){_0x3d2d6a[_0xb7bf('0xa')](_0xb7bf('0x9'));return;}if(_0x3f16a4[_0xb7bf('0xb')](0x0,0xb)==_0xb7bf('0xc')){_0x175bb7=!![];}if(_0x175bb7){_0x412048['rx']+=_0x3f16a4+'\x0a';if(_0x3f16a4[_0xb7bf('0xd')](_0xb7bf('0xe'))!=-0x1){_0x175bb7=![];}}else{_0x412048['rx']=_0x3f16a4;}if(_0x175bb7){return;}if(typeof _0x412048['cb']==_0xb7bf('0xf')){var _0x28ae96=_0x412048['rx'][_0xb7bf('0xb')](0x0,0x3),_0x25ea4e=null,_0x550c7d=null;_0x28ae96=parseInt(_0x28ae96);if(isNaN(_0x28ae96)){_0x412048['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xb7bf('0x10')});return;}if(_0x28ae96!=0xc8){_0x412048['cb'](null,{'code':_0x28ae96,'result':-0x1,'extra':'KO'});return;}_0x25ea4e=_0x412048['rx'][_0xb7bf('0xb')](0x4)[_0xb7bf('0x11')](_0xb7bf('0x12'),'');if(_0x25ea4e[_0xb7bf('0x13')]('\x20')!=-0x1){_0x25ea4e=_0x25ea4e['substr'](0x0,_0x25ea4e[_0xb7bf('0x13')]('\x20'));}if(_[_0xb7bf('0x14')](_0x25ea4e,'-1')){_0x25ea4e=parseInt(_0x25ea4e);}_0x550c7d=_0x412048['rx'][_0xb7bf('0x15')]('\x20');if(_0x550c7d[_0xb7bf('0x16')]==0x3){_0x550c7d=_0x550c7d[0x2]['substring'](0x1,_0x550c7d[0x2][_0xb7bf('0x16')]-0x1);}else if(_0x550c7d[_0xb7bf('0x16')]>0x3){var _0x5b8ff0=/\((.+)\)/;var _0x4788e8=_0x412048['rx'][_0xb7bf('0x17')](_0x5b8ff0);if(_0x4788e8){_0x550c7d=_0x4788e8[0x1];}else{_0x550c7d=null;}}else{_0x550c7d=null;}_0x412048['cb'](null,{'code':_0x28ae96,'result':_0x25ea4e,'extra':_0x550c7d});}});_0x59033b['on'](_0xb7bf('0x18'),function(_0x2a99eb){_0x3d2d6a['emit'](_0xb7bf('0x18'),new AGIError(_0xb7bf('0x19'),_0x2a99eb['code']));});_0x59033b['on']('close',function(){_0x3d2d6a['emit']('close',new AGIError(_0xb7bf('0x1a')));});_0x59033b['on'](_0xb7bf('0x1b'),function(){_0x3d2d6a[_0xb7bf('0xa')](_0xb7bf('0x1b'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x59033b['destroy']();});_0x59033b[_0xb7bf('0x1c')](_0x536476);this[_0xb7bf('0x1d')]=function(_0x5addec,_0x59842d){var _0x5addec=_0x5addec||'',_0x59842d=typeof _0x59842d==_0xb7bf('0xf')?_0x59842d:new Function();_0x412048={'tx':_0x5addec,'rx':'','cb':_0x59842d};_0x59033b[_0xb7bf('0x1e')](_0x5addec+'\x0a');},this[_0xb7bf('0x1f')]=function(){_0x59033b[_0xb7bf('0x20')]();};}util[_0xb7bf('0x21')](AGIChannel,EventEmitter);AGIChannel[_0xb7bf('0x22')][_0xb7bf('0x23')]=function(_0x3aa6e2){return this[_0xb7bf('0x1d')][_0xb7bf('0x24')](this,_0x3aa6e2);};AGIChannel['prototype'][_0xb7bf('0x25')]=function(){return this[_0xb7bf('0x23')](_0xb7bf('0x26'));};AGIChannel[_0xb7bf('0x22')][_0xb7bf('0x27')]=function(_0x3eecf2,_0x1c9b06,_0x31a030){_0x3eecf2=_0x3eecf2===undefined?_0xb7bf('0x28'):_0x3eecf2;_0x1c9b06=_0x1c9b06===undefined?'5':_0x1c9b06;_0x31a030=_0x31a030===undefined?'1':_0x31a030;return this['sendRequest'](util[_0xb7bf('0x29')](_0xb7bf('0x2a'),_0x3eecf2,_0x1c9b06*0x3e8,_0x31a030));};AGIChannel[_0xb7bf('0x22')][_0xb7bf('0x2b')]=function(_0x1b3865){_0x1b3865=_0x1b3865||_0xb7bf('0x2c');return this[_0xb7bf('0x23')](util[_0xb7bf('0x29')](_0xb7bf('0x2d'),_0x1b3865));};AGIChannel[_0xb7bf('0x22')][_0xb7bf('0x2e')]=function(_0x1957c7,_0x26f824){if(_[_0xb7bf('0x2f')](_0x26f824)){return this['sendRequest'](util['format'](_0xb7bf('0x30'),_0x1957c7,_0x26f824[_0xb7bf('0x31')](',')));}return this['sendRequest'](util['format']('EXEC\x20%s\x20%s',_0x1957c7,_0x26f824));};AGIChannel['prototype'][_0xb7bf('0x32')]=function(_0xe69688){return this[_0xb7bf('0x23')](util['format'](_0xb7bf('0x33'),_0xe69688));};AGIChannel[_0xb7bf('0x22')][_0xb7bf('0x34')]=function(_0x56f16a){return this[_0xb7bf('0x23')](util[_0xb7bf('0x29')](_0xb7bf('0x35'),_0x56f16a));};AGIChannel[_0xb7bf('0x22')][_0xb7bf('0x36')]=function(_0x4c3496){return this[_0xb7bf('0x23')](util[_0xb7bf('0x29')](_0xb7bf('0x37'),_0x4c3496));};AGIChannel[_0xb7bf('0x22')][_0xb7bf('0x9')]=function(){return this[_0xb7bf('0x23')](_0xb7bf('0x38'));};AGIChannel[_0xb7bf('0x22')][_0xb7bf('0x39')]=function(_0xeac08d,_0x404554){var _0x54f6bb=_['isBoolean'](_0x404554)||_[_0xb7bf('0x3a')](_0x404554)?_0x404554[_0xb7bf('0x3b')]():_0x404554;return this[_0xb7bf('0x23')](util[_0xb7bf('0x29')](_0xb7bf('0x3c'),_0xeac08d,_0x54f6bb?_0x54f6bb[_0xb7bf('0x3b')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xb7bf('0x22')][_0xb7bf('0x3d')]=function(_0x30bb65,_0x1f439a){return this['sendRequest'](util['format'](_0xb7bf('0x3e'),_0x30bb65,_0x1f439a));};AGIChannel['prototype'][_0xb7bf('0x3f')]=function(_0x44f99f,_0x313ec7){return this['sendRequest'](util[_0xb7bf('0x29')]('SAY\x20DIGITS\x20%s\x20%s',_0x44f99f,_0x313ec7));};AGIChannel[_0xb7bf('0x22')][_0xb7bf('0x40')]=function(_0x2867ec,_0xd9bd48){return this[_0xb7bf('0x23')](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x2867ec,_0xd9bd48));};AGIChannel[_0xb7bf('0x22')]['continueAt']=function(_0x491585,_0x3da667,_0x5d89b3){_0x3da667=_0x3da667||this[_0xb7bf('0x41')];_0x5d89b3=_0x5d89b3||0x1;this[_0xb7bf('0x32')](_0x491585);this[_0xb7bf('0x34')](_0x3da667);this[_0xb7bf('0x36')](_0x5d89b3);return this['noop'](util[_0xb7bf('0x29')](_0xb7bf('0x42'),_0x491585,_0x3da667,_0x5d89b3));};AGIChannel[_0xb7bf('0x22')][_0xb7bf('0x43')]=function(_0x4ea5b7){return this['sendRequest'](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x4ea5b7));};AGIChannel['prototype'][_0xb7bf('0x44')]=function(_0x54cf40,_0x16ff6c,_0x4280de,_0x1d4cf9,_0x579173,_0x351d2c){_0x16ff6c=_0x16ff6c||_0xb7bf('0x45');_0x4280de=_0x4280de||'';_0x1d4cf9=_0x1d4cf9===undefined?-0x1:_0x1d4cf9==='-1'?-0x1:_0x1d4cf9*0x3e8;_0x579173=_0x579173===undefined?'':'s='+_0x579173;_0x351d2c=_0x351d2c?_0xb7bf('0x46'):'';return this[_0xb7bf('0x23')](util[_0xb7bf('0x29')](_0xb7bf('0x47'),_0x54cf40,_0x16ff6c,_0x4280de,_0x1d4cf9,_0x351d2c,_0x579173));};AGIChannel[_0xb7bf('0x22')][_0xb7bf('0x48')]=function(_0x439be6,_0x10dda5){_0x10dda5=_0x10dda5||'';return this['sendRequest'](util[_0xb7bf('0x29')](_0xb7bf('0x49'),_0x439be6,_0x10dda5));};AGIChannel[_0xb7bf('0x22')][_0xb7bf('0x4a')]=function(_0x2fbc1f){return this[_0xb7bf('0x2e')](_0xb7bf('0x4b'),_0x2fbc1f);};AGIChannel[_0xb7bf('0x22')]['wait']=function(_0x94e013){return this['exec']('WAIT',_0x94e013);};AGIChannel[_0xb7bf('0x22')][_0xb7bf('0x18')]=function(_0xb501c8,_0x4cc5ba){this[_0xb7bf('0x2b')](util[_0xb7bf('0x29')](_0xb7bf('0x4c'),_0xb501c8['id'],_0xb501c8['label'],_0x4cc5ba));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xb7bf('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 3811df3..c045ebd 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 _0x4d18=['Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','apply','message','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4d18,0x87));var _0x84d1=function(_0x2d6812,_0x30264e){_0x2d6812=_0x2d6812-0x0;var _0x4cd33b=_0x4d18[_0x2d6812];return _0x4cd33b;};'use strict';var util=require(_0x84d1('0x0'));var error={'E_AGI_UNDEFINED':_0x84d1('0x1'),'E_AGI_ARGUMENT_PORT':_0x84d1('0x2'),'E_AGI_SERVER_ERROR':_0x84d1('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x84d1('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x84d1('0x5'),'E_AGI_SOCKET_ERROR':_0x84d1('0x6'),'E_AGI_SOCKET_CLOSE':_0x84d1('0x7'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x84d1('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x84d1('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x214375){var _0x214375=_0x214375||null,_0x4b130a=_0x4b130a||[],_0x33709e=0x1,_0x49df37='';if(!error[_0x214375]){_0x214375=_0x84d1('0xa');}_0x4b130a[_0x84d1('0xb')](error[_0x214375]);while(arguments[_0x33709e]){_0x4b130a['push'](arguments[_0x33709e]);_0x33709e++;}_0x49df37=util[_0x84d1('0xc')][_0x84d1('0xd')](util,_0x4b130a);this[_0x84d1('0xe')]=_0x49df37;this['name']=_0x214375;}module[_0x84d1('0xf')]=AGIError; \ No newline at end of file +var _0xcb62=['apply','message','name','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format'];(function(_0xf1ffc0,_0x476e27){var _0x1a2776=function(_0x95e41a){while(--_0x95e41a){_0xf1ffc0['push'](_0xf1ffc0['shift']());}};_0x1a2776(++_0x476e27);}(_0xcb62,0x103));var _0x2cb6=function(_0x5c6ebc,_0x216f42){_0x5c6ebc=_0x5c6ebc-0x0;var _0x490c42=_0xcb62[_0x5c6ebc];return _0x490c42;};'use strict';var util=require(_0x2cb6('0x0'));var error={'E_AGI_UNDEFINED':_0x2cb6('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x2cb6('0x2'),'E_AGI_SERVER_CLOSE':_0x2cb6('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x2cb6('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x2cb6('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x2cb6('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x2cb6('0x7'),'E_AGI_COMMAND_EMPTY':_0x2cb6('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x2cb6('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x13ceed){var _0x13ceed=_0x13ceed||null,_0x4a8f4c=_0x4a8f4c||[],_0x2088a3=0x1,_0x576b6d='';if(!error[_0x13ceed]){_0x13ceed=_0x2cb6('0xa');}_0x4a8f4c[_0x2cb6('0xb')](error[_0x13ceed]);while(arguments[_0x2088a3]){_0x4a8f4c['push'](arguments[_0x2088a3]);_0x2088a3++;}_0x576b6d=util[_0x2cb6('0xc')][_0x2cb6('0xd')](util,_0x4a8f4c);this[_0x2cb6('0xe')]=_0x576b6d;this[_0x2cb6('0xf')]=_0x13ceed;}module[_0x2cb6('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index e626522..64e4639 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 _0xb870=['E_AGI_SERVER_ERROR','message','emit','projectUpdate','exports','lodash','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','localhost','subscribe','agi','error'];(function(_0x4e1ce5,_0x285ce8){var _0x42b11a=function(_0x515020){while(--_0x515020){_0x4e1ce5['push'](_0x4e1ce5['shift']());}};_0x42b11a(++_0x285ce8);}(_0xb870,0x95));var _0x0b87=function(_0x187718,_0x427383){_0x187718=_0x187718-0x0;var _0x29ddf4=_0xb870[_0x187718];return _0x29ddf4;};'use strict';var _=require(_0x0b87('0x0'));var EventEmitter=require('events')[_0x0b87('0x1')];var Redis=require(_0x0b87('0x2'));var AGIError=require(_0x0b87('0x3'));var config=require(_0x0b87('0x4'));config[_0x0b87('0x5')]=_[_0x0b87('0x6')](config[_0x0b87('0x5')],{'host':_0x0b87('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x0b87('0x8')](_0x0b87('0x9'),function(_0x50a356){if(_0x50a356)return eventEmitter['emit'](_0x0b87('0xa'),new AGIError(_0x0b87('0xb'),_0x50a356));});sub['on'](_0x0b87('0xc'),function(_0x107dc1,_0x2f47c0){if(_0x107dc1!=='agi')return;try{var _0x48424e=JSON['parse'](_0x2f47c0);eventEmitter[_0x0b87('0xd')](_0x0b87('0xe'),_0x48424e);}catch(_0x16de33){eventEmitter[_0x0b87('0xd')](_0x0b87('0xa'),new AGIError(_0x0b87('0xb'),_0x16de33));}});module[_0x0b87('0xf')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xaaac=['redis','defaults','localhost','subscribe','emit','E_AGI_SERVER_ERROR','parse','exports','events','ioredis','./error'];(function(_0x3ac265,_0x21150c){var _0x10d4c9=function(_0x3d654d){while(--_0x3d654d){_0x3ac265['push'](_0x3ac265['shift']());}};_0x10d4c9(++_0x21150c);}(_0xaaac,0x13c));var _0xcaaa=function(_0x18dda3,_0x18d499){_0x18dda3=_0x18dda3-0x0;var _0x52ba2b=_0xaaac[_0x18dda3];return _0x52ba2b;};'use strict';var _=require('lodash');var EventEmitter=require(_0xcaaa('0x0'))['EventEmitter'];var Redis=require(_0xcaaa('0x1'));var AGIError=require(_0xcaaa('0x2'));var config=require('../../config/environment');config[_0xcaaa('0x3')]=_[_0xcaaa('0x4')](config[_0xcaaa('0x3')],{'host':_0xcaaa('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xcaaa('0x3')]);sub[_0xcaaa('0x6')]('agi',function(_0x273439){if(_0x273439)return eventEmitter[_0xcaaa('0x7')]('error',new AGIError(_0xcaaa('0x8'),_0x273439));});sub['on']('message',function(_0xbad12a,_0x3ea865){if(_0xbad12a!=='agi')return;try{var _0x1a7a69=JSON[_0xcaaa('0x9')](_0x3ea865);eventEmitter[_0xcaaa('0x7')]('projectUpdate',_0x1a7a69);}catch(_0x5db937){eventEmitter[_0xcaaa('0x7')]('error',new AGIError(_0xcaaa('0x8'),_0x5db937));}});module[_0xcaaa('0xa')]={'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 a7e0b7c..a500e09 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 _0xcf8f=['target','default','agicommand','default\x20on\x20switch\x20not\x20found','exports','lodash','agi','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition'];(function(_0x217900,_0x2d756a){var _0x161e03=function(_0x3cbca1){while(--_0x3cbca1){_0x217900['push'](_0x217900['shift']());}};_0x161e03(++_0x2d756a);}(_0xcf8f,0x1cd));var _0xfcf8=function(_0x197b98,_0x55f2ba){_0x197b98=_0x197b98-0x0;var _0xfbd0ba=_0xcf8f[_0x197b98];return _0xfbd0ba;};'use strict';var _=require(_0xfcf8('0x0'));var logger=require('../../../config/logger')(_0xfcf8('0x1'));var verticesWithRetry=['menu',_0xfcf8('0x2'),_0xfcf8('0x3')];var Graph=function(){this[_0xfcf8('0x4')]={};this[_0xfcf8('0x5')]={};this[_0xfcf8('0x6')]=0x0;};Graph[_0xfcf8('0x7')][_0xfcf8('0x8')]=function(_0x4c7810){this[_0xfcf8('0x4')][_0x4c7810['id']]=_0x4c7810;this[_0xfcf8('0x5')][_0x4c7810['id']]=[];};Graph[_0xfcf8('0x7')]['addEdge']=function(_0x629167,_0x5500f6,_0xcb90d){this[_0xfcf8('0x5')][_0x629167]['push']({'target':_0x5500f6,'condition':_0xcb90d});this[_0xfcf8('0x6')]+=0x1;};Graph[_0xfcf8('0x7')][_0xfcf8('0x9')]=function(){return _[_0xfcf8('0x9')](this[_0xfcf8('0x4')]);};Graph[_0xfcf8('0x7')][_0xfcf8('0xa')]=function(){return this[_0xfcf8('0x6')];};Graph[_0xfcf8('0x7')][_0xfcf8('0xb')]=function(_0x4aa050){return this[_0xfcf8('0x4')][_0x4aa050];};Graph[_0xfcf8('0x7')][_0xfcf8('0xc')]=function(_0x35fcb9,_0x5ae2a3){if(!this[_0xfcf8('0x4')][_0x35fcb9]){return logger[_0xfcf8('0xd')](_0xfcf8('0xe'));}var _0x18ddec=_0x5ae2a3(this['vertices'][_0x35fcb9]);if(!_0x18ddec){return logger[_0xfcf8('0xd')](_0xfcf8('0xf'));}if(this[_0xfcf8('0x5')][_0x35fcb9][_0xfcf8('0x10')]===0x0){return logger[_0xfcf8('0xd')](_0xfcf8('0x11'));}for(var _0x180b57=0x0,_0x351741=[],_0x1a79ae=![];_0x180b57\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','then','hasOwnProperty','indexOf','agi_','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','handleNotFound','handleUnpublished','initialize','getLicense'];(function(_0x436768,_0x531d20){var _0x5a8c85=function(_0x85a0c8){while(--_0x85a0c8){_0x436768['push'](_0x436768['shift']());}};_0x5a8c85(++_0x531d20);}(_0x90da,0x127));var _0xa90d=function(_0x1dce4a,_0x45dc6d){_0x1dce4a=_0x1dce4a-0x0;var _0x1231eb=_0x90da[_0x1dce4a];return _0x1231eb;};'use strict';var _=require('lodash');var syncho=require(_0xa90d('0x0'));var util=require(_0xa90d('0x1'));var config=require(_0xa90d('0x2'));var logger=require('../../config/logger')('agi');var utilLicense=require('../../config/license/util');var rpc=require(_0xa90d('0x3'));var Project=require(_0xa90d('0x4'));var AGIEmitter=require(_0xa90d('0x5'))[_0xa90d('0x6')];var projects=[];config['agi']=_[_0xa90d('0x7')](config['agi'],{'ip':_0xa90d('0x8'),'port':0x11dd});AGIEmitter['on'](_0xa90d('0x9'),projectUpdateHandler);function connectionHandler(_0x200f73){process[_0xa90d('0xa')](function(){syncho(function(){try{setChannelVariables(_0x200f73);agiHandler(_0x200f73);}catch(_0x59ce29){logger['error'](_0x59ce29[_0xa90d('0xb')]);}});});}function projectUpdateHandler(_0x401223){try{var _0x1977f1=_[_0xa90d('0xc')](projects,['id',_0x401223['id']]);if(_0x1977f1>-0x1){if(_0x401223[_0xa90d('0xd')]===!![]){projects['splice'](_0x1977f1,0x1);}else{projects[_0x1977f1]=_0x401223;}}else{projects[_0xa90d('0xe')](_0x401223);}}catch(_0x146d8e){logger[_0xa90d('0xf')](_0x146d8e['stack']);}}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xa90d('0x10')][_0xa90d('0x11')]);logger['info'](util['format'](_0xa90d('0x12'),config[_0xa90d('0x10')]['ip'],config['agi'][_0xa90d('0x11')]));}function errorHandler(_0x363fca){if(_0x363fca&&_0x363fca[_0xa90d('0x13')]&&_0x363fca[_0xa90d('0x14')]){logger[_0xa90d('0xf')](util[_0xa90d('0x15')](_0xa90d('0x16'),_0x363fca[_0xa90d('0x13')],_0x363fca[_0xa90d('0x14')]));}else{logger[_0xa90d('0xf')](util[_0xa90d('0x15')](_0xa90d('0x17'),_0x363fca[_0xa90d('0xb')]));}}function closeHandler(){logger[_0xa90d('0x18')](util[_0xa90d('0x15')](_0xa90d('0x19'),this[_0xa90d('0x1a')],this[_0xa90d('0x1b')],this[_0xa90d('0x1c')],this[_0xa90d('0x1d')],this[_0xa90d('0x1e')]));try{createSquareReport(this);}catch(_0x2471af){logger[_0xa90d('0xf')](_0x2471af[_0xa90d('0xb')]);}}function timeoutHandler(){logger['info'](util[_0xa90d('0x15')](_0xa90d('0x1f'),this[_0xa90d('0x1a')],this[_0xa90d('0x1b')],this[_0xa90d('0x1c')],this[_0xa90d('0x1d')],this['uniqueid']));}function hangupHandler(){logger[_0xa90d('0x18')](util['format'](_0xa90d('0x20'),this[_0xa90d('0x1a')],this[_0xa90d('0x1b')],this[_0xa90d('0x1c')],this[_0xa90d('0x1d')],this['uniqueid']));this[_0xa90d('0x21')]=!![];}function createSquareReport(_0x25fbcb,_0x502445){rpc['createSquareReport'](_0x25fbcb)[_0xa90d('0x22')](function(_0x75c75f){if(_0x502445){_0x502445(null,_0x75c75f);}})['catch'](function(_0x5c8542){if(_0x502445){_0x502445(null,_0x5c8542);}});}function setChannelVariables(_0x1bd6b1){for(var _0x325f43 in _0x1bd6b1){if(_0x1bd6b1[_0xa90d('0x23')](_0x325f43)){if(_0x325f43[_0xa90d('0x24')](_0xa90d('0x25'))===0x0){_0x1bd6b1[_0x325f43['substring'](0x4)]=_0x1bd6b1[_0x325f43];delete _0x1bd6b1[_0x325f43];}}}}function agiHandler(_0x309e74){logger[_0xa90d('0x26')](_0xa90d('0x27'),JSON[_0xa90d('0x28')](_0x309e74,null,0x2));logger[_0xa90d('0x18')](util[_0xa90d('0x15')](_0xa90d('0x29'),_0x309e74[_0xa90d('0x1a')],_0x309e74[_0xa90d('0x1b')],_0x309e74[_0xa90d('0x1c')],_0x309e74['dnid'],_0x309e74[_0xa90d('0x1e')]));_0x309e74['on'](_0xa90d('0xf'),errorHandler);_0x309e74['on'](_0xa90d('0x2a'),closeHandler);_0x309e74['on']('timeout',timeoutHandler);_0x309e74[_0xa90d('0x21')]=![];_0x309e74['on']('hangup',hangupHandler);var _0x178756=_['find'](projects,[_0xa90d('0x13'),_0x309e74[_0xa90d('0x1a')]]);if(!_0x178756)return Project[_0xa90d('0x2b')](_0x309e74);if(!_0x178756['production'])return Project[_0xa90d('0x2c')](_0x309e74);return Project[_0xa90d('0x2d')](_0x178756,_0x309e74);}function main(){var _0x1ccb29;return utilLicense[_0xa90d('0x2e')]()[_0xa90d('0x22')](function(_0x2262c4){if(!_0x2262c4)return;if(_0x2262c4[_0xa90d('0x2f')]){if(_0x2262c4['callysquare']&&_0x2262c4['callysquare']>0x0){logger[_0xa90d('0x18')](util[_0xa90d('0x15')](_0xa90d('0x30'),_0x2262c4['callysquare']));_0x1ccb29=_0x2262c4[_0xa90d('0x31')];}else{logger[_0xa90d('0x18')](_0xa90d('0x32'));}}else{logger['info'](_0xa90d('0x33'));_0x1ccb29=-0x1;}})[_0xa90d('0x22')](function(){return Project['getAll']();})[_0xa90d('0x22')](function(_0x4b72fe){projects=_0x4b72fe;return;})[_0xa90d('0x34')](function(_0x5c314b){logger[_0xa90d('0xf')](_0xa90d('0x35'),_0x5c314b['stack']);})['finally'](function(){var _0x5482c1=require(_0xa90d('0x36'))(config[_0xa90d('0x10')][_0xa90d('0x11')],config['agi']['ip'],_0x1ccb29);_0x5482c1['on']('error',errorHandler);_0x5482c1['on'](_0xa90d('0x37'),listeningHandler);_0x5482c1['on'](_0xa90d('0x38'),connectionHandler);_0x5482c1['on'](_0xa90d('0x2a'),closeHandler);});}main(); \ No newline at end of file +var _0x1db2=['[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','close','timeout','hangup','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','getAll','./server','connection','lodash','syncho','util','../../config/environment','../../config/logger','../../config/license/util','./project','./events','EventEmitter','agi','defaults','projectUpdate','nextTick','error','stack','findIndex','deleted','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[ERROR]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','then','catch','hasOwnProperty','indexOf','substring','debug','variables','stringify'];(function(_0xd0614e,_0xc496a6){var _0x1edb21=function(_0x7194be){while(--_0x7194be){_0xd0614e['push'](_0xd0614e['shift']());}};_0x1edb21(++_0xc496a6);}(_0x1db2,0x137));var _0x21db=function(_0x2224a0,_0x51657d){_0x2224a0=_0x2224a0-0x0;var _0x9a629c=_0x1db2[_0x2224a0];return _0x9a629c;};'use strict';var _=require(_0x21db('0x0'));var syncho=require(_0x21db('0x1'));var util=require(_0x21db('0x2'));var config=require(_0x21db('0x3'));var logger=require(_0x21db('0x4'))('agi');var utilLicense=require(_0x21db('0x5'));var rpc=require('./rpc');var Project=require(_0x21db('0x6'));var AGIEmitter=require(_0x21db('0x7'))[_0x21db('0x8')];var projects=[];config[_0x21db('0x9')]=_[_0x21db('0xa')](config[_0x21db('0x9')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x21db('0xb'),projectUpdateHandler);function connectionHandler(_0xbba0b4){process[_0x21db('0xc')](function(){syncho(function(){try{setChannelVariables(_0xbba0b4);agiHandler(_0xbba0b4);}catch(_0x4f012a){logger[_0x21db('0xd')](_0x4f012a[_0x21db('0xe')]);}});});}function projectUpdateHandler(_0x322842){try{var _0x572739=_[_0x21db('0xf')](projects,['id',_0x322842['id']]);if(_0x572739>-0x1){if(_0x322842[_0x21db('0x10')]===!![]){projects['splice'](_0x572739,0x1);}else{projects[_0x572739]=_0x322842;}}else{projects[_0x21db('0x11')](_0x322842);}}catch(_0x5576a0){logger[_0x21db('0xd')](_0x5576a0[_0x21db('0xe')]);}}function listeningHandler(){console[_0x21db('0x12')](_0x21db('0x13'),config[_0x21db('0x9')][_0x21db('0x14')]);logger['info'](util[_0x21db('0x15')](_0x21db('0x16'),config[_0x21db('0x9')]['ip'],config['agi']['port']));}function errorHandler(_0x5a2bad){if(_0x5a2bad&&_0x5a2bad[_0x21db('0x17')]&&_0x5a2bad['message']){logger['error'](util[_0x21db('0x15')]('[%s]\x20%s',_0x5a2bad['name'],_0x5a2bad[_0x21db('0x18')]));}else{logger['error'](util[_0x21db('0x15')](_0x21db('0x19'),_0x5a2bad[_0x21db('0xe')]));}}function closeHandler(){logger[_0x21db('0x1a')](util[_0x21db('0x15')](_0x21db('0x1b'),this[_0x21db('0x1c')],this['calleridname'],this[_0x21db('0x1d')],this['dnid'],this[_0x21db('0x1e')]));try{createSquareReport(this);}catch(_0xbea4eb){logger['error'](_0xbea4eb[_0x21db('0xe')]);}}function timeoutHandler(){logger['info'](util[_0x21db('0x15')](_0x21db('0x1f'),this[_0x21db('0x1c')],this['calleridname'],this[_0x21db('0x1d')],this[_0x21db('0x20')],this['uniqueid']));}function hangupHandler(){logger[_0x21db('0x1a')](util[_0x21db('0x15')](_0x21db('0x21'),this[_0x21db('0x1c')],this['calleridname'],this[_0x21db('0x1d')],this['dnid'],this[_0x21db('0x1e')]));this[_0x21db('0x22')]=!![];}function createSquareReport(_0xfe7476,_0x478ac9){rpc['createSquareReport'](_0xfe7476)[_0x21db('0x23')](function(_0xe2ab4f){if(_0x478ac9){_0x478ac9(null,_0xe2ab4f);}})[_0x21db('0x24')](function(_0x5cda8a){if(_0x478ac9){_0x478ac9(null,_0x5cda8a);}});}function setChannelVariables(_0x56b65f){for(var _0xdbbbcc in _0x56b65f){if(_0x56b65f[_0x21db('0x25')](_0xdbbbcc)){if(_0xdbbbcc[_0x21db('0x26')]('agi_')===0x0){_0x56b65f[_0xdbbbcc[_0x21db('0x27')](0x4)]=_0x56b65f[_0xdbbbcc];delete _0x56b65f[_0xdbbbcc];}}}}function agiHandler(_0x3794a1){logger[_0x21db('0x28')](_0x21db('0x29'),JSON[_0x21db('0x2a')](_0x3794a1,null,0x2));logger[_0x21db('0x1a')](util['format'](_0x21db('0x2b'),_0x3794a1[_0x21db('0x1c')],_0x3794a1[_0x21db('0x2c')],_0x3794a1[_0x21db('0x1d')],_0x3794a1[_0x21db('0x20')],_0x3794a1[_0x21db('0x1e')]));_0x3794a1['on'](_0x21db('0xd'),errorHandler);_0x3794a1['on'](_0x21db('0x2d'),closeHandler);_0x3794a1['on'](_0x21db('0x2e'),timeoutHandler);_0x3794a1[_0x21db('0x22')]=![];_0x3794a1['on'](_0x21db('0x2f'),hangupHandler);var _0x567eef=_['find'](projects,[_0x21db('0x17'),_0x3794a1[_0x21db('0x1c')]]);if(!_0x567eef)return Project[_0x21db('0x30')](_0x3794a1);if(!_0x567eef[_0x21db('0x31')])return Project[_0x21db('0x32')](_0x3794a1);return Project[_0x21db('0x33')](_0x567eef,_0x3794a1);}function main(){var _0x210e10;return utilLicense[_0x21db('0x34')]()['then'](function(_0x546d82){if(!_0x546d82)return;if(_0x546d82[_0x21db('0x35')]){if(_0x546d82[_0x21db('0x36')]&&_0x546d82[_0x21db('0x36')]>0x0){logger[_0x21db('0x1a')](util[_0x21db('0x15')](_0x21db('0x37'),_0x546d82['callysquare']));_0x210e10=_0x546d82[_0x21db('0x36')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x210e10=-0x1;}})[_0x21db('0x23')](function(){return Project[_0x21db('0x38')]();})['then'](function(_0x55785b){projects=_0x55785b;return;})[_0x21db('0x24')](function(_0x381d44){logger[_0x21db('0xd')]('[LICENSE]',_0x381d44['stack']);})['finally'](function(){var _0x414684=require(_0x21db('0x39'))(config['agi']['port'],config[_0x21db('0x9')]['ip'],_0x210e10);_0x414684['on'](_0x21db('0xd'),errorHandler);_0x414684['on']('listening',listeningHandler);_0x414684['on'](_0x21db('0x3a'),connectionHandler);_0x414684['on'](_0x21db('0x2d'),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 4f58a1e..f1cbd13 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 _0x53fc=['error','message','result','catch','sendMailMessage','bluebird','jayson/promise','client','http','then'];(function(_0x4df3ba,_0x439e15){var _0x3a0aae=function(_0x3f89c5){while(--_0x3f89c5){_0x4df3ba['push'](_0x4df3ba['shift']());}};_0x3a0aae(++_0x439e15);}(_0x53fc,0x13b));var _0xc53f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x53fc[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0xc53f('0x0'));var jayson=require(_0xc53f('0x1'));var client=jayson[_0xc53f('0x2')][_0xc53f('0x3')]({'port':0x232b});function request(_0x3b68fe,_0x45c845){return new BPromise(function(_0x20770,_0xe49054){return client['request'](_0x3b68fe,_0x45c845)[_0xc53f('0x4')](function(_0x47927d){if(_0x47927d[_0xc53f('0x5')]){return _0xe49054(_0x47927d['error'][_0xc53f('0x6')]);}else{return _0x20770(_0x47927d[_0xc53f('0x7')]);}})[_0xc53f('0x8')](function(_0x2c9fd7){return _0xe49054(_0x2c9fd7);});});}exports[_0xc53f('0x9')]=function(_0x28b98b,_0x35743f){return request('SendMail',{'account':_0x28b98b,'message':_0x35743f});}; \ No newline at end of file +var _0x320b=['result','catch','sendMailMessage','bluebird','jayson/promise','http','request','message'];(function(_0x2b2211,_0x119177){var _0x4fce38=function(_0x2b8b7a){while(--_0x2b8b7a){_0x2b2211['push'](_0x2b2211['shift']());}};_0x4fce38(++_0x119177);}(_0x320b,0x193));var _0xb320=function(_0x2e7f96,_0x2ffe43){_0x2e7f96=_0x2e7f96-0x0;var _0x315277=_0x320b[_0x2e7f96];return _0x315277;};'use strict';var BPromise=require(_0xb320('0x0'));var jayson=require(_0xb320('0x1'));var client=jayson['client'][_0xb320('0x2')]({'port':0x232b});function request(_0x3cf310,_0x33b2f4){return new BPromise(function(_0x10c485,_0x1bdc65){return client[_0xb320('0x3')](_0x3cf310,_0x33b2f4)['then'](function(_0x146207){if(_0x146207['error']){return _0x1bdc65(_0x146207['error'][_0xb320('0x4')]);}else{return _0x10c485(_0x146207[_0xb320('0x5')]);}})[_0xb320('0x6')](function(_0x11b15c){return _0x1bdc65(_0x11b15c);});});}exports[_0xb320('0x7')]=function(_0x54b862,_0x5bf8a1){return request('SendMail',{'account':_0x54b862,'message':_0x5bf8a1});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 083f95a..ca84a72 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 _0x4e6f=['inspect','production','debug','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','traverseBFS','clear','vertex','gotoc','context','extension','priority','response','stringify','code','result','evtHangup','isUndefined','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','exports','lodash','moment','util','../../config/logger','agi','./mailRpc','./graph','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4e6f,0x116));var _0xf4e6=function(_0x2b3546,_0xd0343d){_0x2b3546=_0x2b3546-0x0;var _0x17b9a8=_0x4e6f[_0x2b3546];return _0x17b9a8;};'use strict';var _=require(_0xf4e6('0x0'));var moment=require(_0xf4e6('0x1'));var parser=require('xml2json');var util=require(_0xf4e6('0x2'));var logger=require(_0xf4e6('0x3'))(_0xf4e6('0x4'));var rpc=require('./rpc');var mailRpc=require(_0xf4e6('0x5'));var Graph=require(_0xf4e6('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xf4e6('0x7')]()[_0xf4e6('0x8')](function(_0x28e0c1){logger[_0xf4e6('0x9')](_0xf4e6('0xa'),_0x28e0c1[_0xf4e6('0xb')]);return[];});}function addVertex(_0x43f71f,_0x54502a,_0x5abb02){_0x54502a[_0xf4e6('0xc')]=_0x5abb02;if(_0x54502a['hasOwnProperty'](_0xf4e6('0xd'))){_0x54502a['maxRetry']=parseInt(_0x54502a['retry'],0xa);}_0x43f71f[_0xf4e6('0xe')](_[_0xf4e6('0xf')](_0x54502a,_0xf4e6('0x10')));}function initGraph(_0x578744,_0x5f047e){var _0x523d84=new Graph();for(var _0x3e6891 in _0x578744){if(_0x578744[_0xf4e6('0x11')](_0x3e6891)){if(_[_0xf4e6('0x12')](_0x578744[_0x3e6891])){for(var _0x462456=0x0;_0x462456<_0x578744[_0x3e6891][_0xf4e6('0x13')];_0x462456+=0x1){addVertex(_0x523d84,_0x578744[_0x3e6891][_0x462456],_0x3e6891);}}else{addVertex(_0x523d84,_0x578744[_0x3e6891],_0x3e6891);}}}for(var _0x16012d=0x0;_0x16012d<_0x5f047e[_0xf4e6('0x13')];_0x16012d+=0x1){if(_0x5f047e[_0x16012d][_0xf4e6('0x14')]&&_0x5f047e[_0x16012d][_0xf4e6('0x15')]){_0x523d84[_0xf4e6('0x16')](_0x5f047e[_0x16012d]['source'],_0x5f047e[_0x16012d]['target'],_0x5f047e[_0x16012d][_0xf4e6('0x17')]);}}return _0x523d84;}function getRoot(_0x238b69){return parser[_0xf4e6('0x18')](_0x238b69,{'object':!![]})[_0xf4e6('0x19')][_0xf4e6('0x1a')];}function inspect(_0x23ff8d){return util[_0xf4e6('0x1b')](_0x23ff8d,{'showHidden':![],'depth':null});}function initialize(_0x57f3be,_0xba3d74){var _0x4e0624=getRoot(_0x57f3be[_0xf4e6('0x1c')]);if(!_0x4e0624||!_0x4e0624['start'])return;var _0x3c5dc0,_0x3af11c,_0x2c8c12;logger[_0xf4e6('0x1d')](_0xf4e6('0x1a'),JSON['stringify'](_0x4e0624,null,0x2));_0xba3d74['joinAt']=moment()[_0xf4e6('0x1e')](_0xf4e6('0x1f'));_0x3c5dc0=initGraph(_['omit'](_0x4e0624,'mxCell'),_0x4e0624[_0xf4e6('0x10')]);_0x3af11c=new Vertices(_0xba3d74,rpc,mailRpc);logger[_0xf4e6('0x20')](util['format'](_0xf4e6('0x21'),_0xba3d74[_0xf4e6('0x22')],_0xba3d74['calleridname'],_0xba3d74[_0xf4e6('0x23')],_0xba3d74[_0xf4e6('0x24')],_0xba3d74[_0xf4e6('0x25')]));_0x3c5dc0[_0xf4e6('0x26')](_0x4e0624['start']['id'],function(_0x2bf69d){try{_0x2bf69d=_0x3af11c[_0xf4e6('0x27')](_0x2bf69d);logger[_0xf4e6('0x1d')](_0xf4e6('0x28'),JSON['stringify'](_0x2bf69d,null,0x2));if(_0x2bf69d['agicommand']===_0xf4e6('0x29')){logger[_0xf4e6('0x20')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0xba3d74['context']=_0x2bf69d[_0xf4e6('0x2a')]||_0xba3d74[_0xf4e6('0x2a')];_0xba3d74[_0xf4e6('0x2b')]=_0x2bf69d['extension'];_0xba3d74[_0xf4e6('0x2c')]=_0x2bf69d[_0xf4e6('0x2c')]?_0x2bf69d[_0xf4e6('0x2c')]-0x1:0x1;return null;}else if(_0x2bf69d&&_0x3af11c[_0x2bf69d[_0xf4e6('0xc')]]){_0x2c8c12=_0x3af11c[_0x2bf69d['agicommand']](_0x2bf69d);logger[_0xf4e6('0x20')](_0xf4e6('0x2d'),JSON[_0xf4e6('0x2e')](_0x2c8c12,null,0x2));if(_0x2c8c12&&_0x2c8c12[_0xf4e6('0x2f')]===AGI_CODE_SUCCESS&&_0x2c8c12[_0xf4e6('0x30')]!==AGI_RESULT_ERROR&&!_0xba3d74[_0xf4e6('0x31')]){logger[_0xf4e6('0x1d')]('response',inspect(_0x2c8c12));return _[_0xf4e6('0x32')](_0x2c8c12[_0xf4e6('0x30')])?null:_0x2c8c12['result']['toString']();}else{logger['error'](_0xf4e6('0x2d'),inspect(_0x2c8c12));return null;}}else{logger[_0xf4e6('0x9')](_0xf4e6('0x33'));return null;}}catch(_0x33e58c){logger[_0xf4e6('0x9')](_0x33e58c[_0xf4e6('0xb')]);return null;}});if(_0x4e0624[_0xf4e6('0x34')]){logger[_0xf4e6('0x20')](util['format'](_0xf4e6('0x35'),_0xba3d74[_0xf4e6('0x22')],_0xba3d74[_0xf4e6('0x36')],_0xba3d74['callerid'],_0xba3d74[_0xf4e6('0x24')],_0xba3d74[_0xf4e6('0x25')]));_0x3c5dc0[_0xf4e6('0x26')](_0x4e0624[_0xf4e6('0x34')]['id'],function(_0x5272a0){try{_0x5272a0=_0x3af11c['clear'](_0x5272a0);logger['debug'](_0xf4e6('0x28'),JSON['stringify'](_0x5272a0,null,0x2));if(_0x5272a0&&_0x3af11c[_0x5272a0[_0xf4e6('0xc')]]){_0x2c8c12=_0x3af11c[_0x5272a0[_0xf4e6('0xc')]](_0x5272a0);if(_0x2c8c12){logger[_0xf4e6('0x1d')](_0xf4e6('0x2d'),inspect(_0x2c8c12));return _['isUndefined'](_0x2c8c12[_0xf4e6('0x30')])?null:_0x2c8c12[_0xf4e6('0x30')][_0xf4e6('0x37')]();}else{logger[_0xf4e6('0x9')](_0xf4e6('0x2d'),inspect(_0x2c8c12));return null;}}else{logger[_0xf4e6('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x154721){logger[_0xf4e6('0x9')](_0x154721[_0xf4e6('0xb')]);return null;}});}logger[_0xf4e6('0x20')](util['format'](_0xf4e6('0x38'),_0xba3d74[_0xf4e6('0x22')],_0xba3d74[_0xf4e6('0x36')],_0xba3d74[_0xf4e6('0x23')],_0xba3d74[_0xf4e6('0x24')],_0xba3d74['uniqueid']));logger[_0xf4e6('0x20')](util['format'](_0xf4e6('0x39'),_0xba3d74['context'],_0xba3d74['extension'],parseInt(_0xba3d74[_0xf4e6('0x2c')],0xa)+0x1));_0xba3d74[_0xf4e6('0x3a')](_0xba3d74[_0xf4e6('0x2a')],_0xba3d74[_0xf4e6('0x2b')],parseInt(_0xba3d74[_0xf4e6('0x2c')],0xa)+0x1);_0xba3d74['close']();}function handleNotFound(_0x35ebe3){logger[_0xf4e6('0x9')](util[_0xf4e6('0x1e')](_0xf4e6('0x3b'),_0x35ebe3[_0xf4e6('0x22')]));_0x35ebe3[_0xf4e6('0x3a')](_0x35ebe3['context'],_0x35ebe3[_0xf4e6('0x2b')],parseInt(_0x35ebe3['priority'],0xa)+0x1);_0x35ebe3['close']();}function handleUnpublished(_0x14975d){logger[_0xf4e6('0x9')](util[_0xf4e6('0x1e')]('Project\x20%s\x20not\x20published',_0x14975d[_0xf4e6('0x22')]));_0x14975d[_0xf4e6('0x3a')](_0x14975d['context'],_0x14975d['extension'],parseInt(_0x14975d[_0xf4e6('0x2c')],0xa)+0x1);_0x14975d['close']();}module[_0xf4e6('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x5e9d=['YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','toString','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','Project\x20%s\x20not\x20published','continueAt','moment','xml2json','../../config/logger','agi','./rpc','./mailRpc','./graph','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','omit','mxCell','length','source','value','toJson','inspect','production','start','debug','stringify','joinAt','format'];(function(_0x580c67,_0x2efc77){var _0x3ff181=function(_0x528b17){while(--_0x528b17){_0x580c67['push'](_0x580c67['shift']());}};_0x3ff181(++_0x2efc77);}(_0x5e9d,0x157));var _0xd5e9=function(_0x475751,_0x29a777){_0x475751=_0x475751-0x0;var _0x585b6b=_0x5e9d[_0x475751];return _0x585b6b;};'use strict';var _=require('lodash');var moment=require(_0xd5e9('0x0'));var parser=require(_0xd5e9('0x1'));var util=require('util');var logger=require(_0xd5e9('0x2'))(_0xd5e9('0x3'));var rpc=require(_0xd5e9('0x4'));var mailRpc=require(_0xd5e9('0x5'));var Graph=require(_0xd5e9('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0xd5e9('0x7')](function(_0x499ab1){logger[_0xd5e9('0x8')](_0xd5e9('0x9'),_0x499ab1[_0xd5e9('0xa')]);return[];});}function addVertex(_0x31cead,_0x531713,_0x5ca53d){_0x531713[_0xd5e9('0xb')]=_0x5ca53d;if(_0x531713[_0xd5e9('0xc')](_0xd5e9('0xd'))){_0x531713[_0xd5e9('0xe')]=parseInt(_0x531713[_0xd5e9('0xd')],0xa);}_0x31cead['addVertex'](_[_0xd5e9('0xf')](_0x531713,_0xd5e9('0x10')));}function initGraph(_0x585432,_0x363c44){var _0x35cd81=new Graph();for(var _0x3c7840 in _0x585432){if(_0x585432[_0xd5e9('0xc')](_0x3c7840)){if(_['isArray'](_0x585432[_0x3c7840])){for(var _0x412f62=0x0;_0x412f62<_0x585432[_0x3c7840][_0xd5e9('0x11')];_0x412f62+=0x1){addVertex(_0x35cd81,_0x585432[_0x3c7840][_0x412f62],_0x3c7840);}}else{addVertex(_0x35cd81,_0x585432[_0x3c7840],_0x3c7840);}}}for(var _0x47d9ac=0x0;_0x47d9ac<_0x363c44[_0xd5e9('0x11')];_0x47d9ac+=0x1){if(_0x363c44[_0x47d9ac][_0xd5e9('0x12')]&&_0x363c44[_0x47d9ac]['target']){_0x35cd81['addEdge'](_0x363c44[_0x47d9ac][_0xd5e9('0x12')],_0x363c44[_0x47d9ac]['target'],_0x363c44[_0x47d9ac][_0xd5e9('0x13')]);}}return _0x35cd81;}function getRoot(_0x2db9a0){return parser[_0xd5e9('0x14')](_0x2db9a0,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x7e3a1a){return util[_0xd5e9('0x15')](_0x7e3a1a,{'showHidden':![],'depth':null});}function initialize(_0x55e6e3,_0x26f533){var _0x5051a3=getRoot(_0x55e6e3[_0xd5e9('0x16')]);if(!_0x5051a3||!_0x5051a3[_0xd5e9('0x17')])return;var _0x3e6359,_0x40ac91,_0x3feefe;logger[_0xd5e9('0x18')]('root',JSON[_0xd5e9('0x19')](_0x5051a3,null,0x2));_0x26f533[_0xd5e9('0x1a')]=moment()[_0xd5e9('0x1b')](_0xd5e9('0x1c'));_0x3e6359=initGraph(_[_0xd5e9('0xf')](_0x5051a3,_0xd5e9('0x10')),_0x5051a3[_0xd5e9('0x10')]);_0x40ac91=new Vertices(_0x26f533,rpc,mailRpc);logger[_0xd5e9('0x1d')](util[_0xd5e9('0x1b')](_0xd5e9('0x1e'),_0x26f533[_0xd5e9('0x1f')],_0x26f533[_0xd5e9('0x20')],_0x26f533[_0xd5e9('0x21')],_0x26f533[_0xd5e9('0x22')],_0x26f533['uniqueid']));_0x3e6359['traverseBFS'](_0x5051a3[_0xd5e9('0x17')]['id'],function(_0x37485e){try{_0x37485e=_0x40ac91['clear'](_0x37485e);logger[_0xd5e9('0x18')](_0xd5e9('0x23'),JSON[_0xd5e9('0x19')](_0x37485e,null,0x2));if(_0x37485e['agicommand']==='gotoc'){logger[_0xd5e9('0x1d')](_0xd5e9('0x24'));_0x26f533[_0xd5e9('0x25')]=_0x37485e[_0xd5e9('0x25')]||_0x26f533[_0xd5e9('0x25')];_0x26f533[_0xd5e9('0x26')]=_0x37485e['extension'];_0x26f533['priority']=_0x37485e[_0xd5e9('0x27')]?_0x37485e[_0xd5e9('0x27')]-0x1:0x1;return null;}else if(_0x37485e&&_0x40ac91[_0x37485e[_0xd5e9('0xb')]]){_0x3feefe=_0x40ac91[_0x37485e[_0xd5e9('0xb')]](_0x37485e);logger[_0xd5e9('0x1d')](_0xd5e9('0x28'),JSON[_0xd5e9('0x19')](_0x3feefe,null,0x2));if(_0x3feefe&&_0x3feefe[_0xd5e9('0x29')]===AGI_CODE_SUCCESS&&_0x3feefe[_0xd5e9('0x2a')]!==AGI_RESULT_ERROR&&!_0x26f533[_0xd5e9('0x2b')]){logger[_0xd5e9('0x18')](_0xd5e9('0x28'),inspect(_0x3feefe));return _['isUndefined'](_0x3feefe['result'])?null:_0x3feefe[_0xd5e9('0x2a')][_0xd5e9('0x2c')]();}else{logger[_0xd5e9('0x8')](_0xd5e9('0x28'),inspect(_0x3feefe));return null;}}else{logger[_0xd5e9('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x3f0314){logger[_0xd5e9('0x8')](_0x3f0314[_0xd5e9('0xa')]);return null;}});if(_0x5051a3['finally']){logger[_0xd5e9('0x1d')](util[_0xd5e9('0x1b')](_0xd5e9('0x2d'),_0x26f533[_0xd5e9('0x1f')],_0x26f533[_0xd5e9('0x20')],_0x26f533[_0xd5e9('0x21')],_0x26f533[_0xd5e9('0x22')],_0x26f533[_0xd5e9('0x2e')]));_0x3e6359['traverseBFS'](_0x5051a3['finally']['id'],function(_0xda18d4){try{_0xda18d4=_0x40ac91['clear'](_0xda18d4);logger[_0xd5e9('0x18')](_0xd5e9('0x23'),JSON[_0xd5e9('0x19')](_0xda18d4,null,0x2));if(_0xda18d4&&_0x40ac91[_0xda18d4[_0xd5e9('0xb')]]){_0x3feefe=_0x40ac91[_0xda18d4[_0xd5e9('0xb')]](_0xda18d4);if(_0x3feefe){logger[_0xd5e9('0x18')](_0xd5e9('0x28'),inspect(_0x3feefe));return _['isUndefined'](_0x3feefe[_0xd5e9('0x2a')])?null:_0x3feefe['result'][_0xd5e9('0x2c')]();}else{logger[_0xd5e9('0x8')](_0xd5e9('0x28'),inspect(_0x3feefe));return null;}}else{logger[_0xd5e9('0x8')](_0xd5e9('0x2f'));return null;}}catch(_0x54a517){logger[_0xd5e9('0x8')](_0x54a517[_0xd5e9('0xa')]);return null;}});}logger[_0xd5e9('0x1d')](util['format'](_0xd5e9('0x30'),_0x26f533[_0xd5e9('0x1f')],_0x26f533[_0xd5e9('0x20')],_0x26f533[_0xd5e9('0x21')],_0x26f533[_0xd5e9('0x22')],_0x26f533['uniqueid']));logger[_0xd5e9('0x1d')](util['format'](_0xd5e9('0x31'),_0x26f533[_0xd5e9('0x25')],_0x26f533[_0xd5e9('0x26')],parseInt(_0x26f533['priority'],0xa)+0x1));_0x26f533['continueAt'](_0x26f533[_0xd5e9('0x25')],_0x26f533[_0xd5e9('0x26')],parseInt(_0x26f533[_0xd5e9('0x27')],0xa)+0x1);_0x26f533[_0xd5e9('0x32')]();}function handleNotFound(_0x5e98f9){logger['error'](util['format']('Project\x20%s\x20not\x20found',_0x5e98f9[_0xd5e9('0x1f')]));_0x5e98f9['continueAt'](_0x5e98f9[_0xd5e9('0x25')],_0x5e98f9[_0xd5e9('0x26')],parseInt(_0x5e98f9['priority'],0xa)+0x1);_0x5e98f9[_0xd5e9('0x32')]();}function handleUnpublished(_0x591bc0){logger['error'](util[_0xd5e9('0x1b')](_0xd5e9('0x33'),_0x591bc0[_0xd5e9('0x1f')]));_0x591bc0[_0xd5e9('0x34')](_0x591bc0[_0xd5e9('0x25')],_0x591bc0[_0xd5e9('0x26')],parseInt(_0x591bc0[_0xd5e9('0x27')],0xa)+0x1);_0x591bc0[_0xd5e9('0x32')]();}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 3b3caf7..837cc5c 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 _0xb622=['line','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','substring','length','split','indexOf','trim','slice','headers'];(function(_0x1bbb53,_0x36f97f){var _0x337bf4=function(_0x2f5d27){while(--_0x2f5d27){_0x1bbb53['push'](_0x1bbb53['shift']());}};_0x337bf4(++_0x36f97f);}(_0xb622,0x1e7));var _0x2b62=function(_0x345c35,_0x97ce14){_0x345c35=_0x345c35-0x0;var _0x1a3c63=_0xb622[_0x345c35];return _0x1a3c63;};'use strict';var util=require('util');var Transform=require(_0x2b62('0x0'))[_0x2b62('0x1')];function AGIReply(_0x34abf4){Transform[_0x2b62('0x2')](this,_0x34abf4);this[_0x2b62('0x3')]='';this[_0x2b62('0x4')]=![];}util[_0x2b62('0x5')](AGIReply,Transform);AGIReply[_0x2b62('0x6')][_0x2b62('0x7')]=function(_0x3ab14d,_0x46f472,_0x23a401){var _0x467837='\x0a',_0x399f30=['\x0a\x0a',_0x2b62('0x8')],_0x22360f=-0x1,_0x25bcde=-0x1,_0x11e974='',_0x56330d=0x0,_0x40c3d2='',_0x384270='';this[_0x2b62('0x3')]+=_0x3ab14d[_0x2b62('0x9')]();_0x40c3d2=this[_0x2b62('0x3')];if(!this[_0x2b62('0x4')]){_0x56330d=0x0;while(_0x399f30[_0x56330d]){while((_0x25bcde=_0x40c3d2['indexOf'](_0x399f30[_0x56330d]))!=-0x1){_0x11e974=_0x399f30[_0x56330d];_0x384270=_0x40c3d2[_0x2b62('0xa')](0x0,_0x25bcde);_0x40c3d2=_0x40c3d2[_0x2b62('0xa')](_0x25bcde+_0x11e974[_0x2b62('0xb')]);var _0x737eac=_0x384270[_0x2b62('0xc')](_0x467837),_0x2fbc13=0x0,_0x1cc9f5={},_0x3f121f='',_0xb28d0b='',_0x3f0866=-0x1;while(_0x737eac[_0x2fbc13]){_0x3f0866=_0x737eac[_0x2fbc13][_0x2b62('0xd')](':');if(_0x3f0866!=-0x1){_0x3f121f=_0x737eac[_0x2fbc13]['slice'](0x0,_0x3f0866)[_0x2b62('0xe')]();_0xb28d0b=_0x737eac[_0x2fbc13][_0x2b62('0xf')](_0x3f0866+0x1)['trim']();if(_0x3f121f['length']>0x0){_0x1cc9f5[_0x3f121f]=_0xb28d0b;}}else{}_0x2fbc13++;}this['emit'](_0x2b62('0x10'),_0x1cc9f5);this['_inBody']=!![];}_0x56330d++;}this[_0x2b62('0x3')]=_0x40c3d2;}else{while((_0x22360f=_0x40c3d2[_0x2b62('0xd')](_0x467837))!=-0x1){_0x384270=_0x40c3d2['substring'](0x0,_0x22360f);this['emit'](_0x2b62('0x11'),_0x384270);_0x40c3d2=_0x40c3d2['substring'](_0x22360f+_0x467837[_0x2b62('0xb')]);}this['_localBuffer']=_0x40c3d2;}_0x23a401();};module['exports']=AGIReply; \ No newline at end of file +var _0xb5ce=['line','util','call','_inBody','inherits','prototype','_transform','_localBuffer','toString','substring','split','indexOf','slice','trim','length','emit'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0xb5ce,0xa1));var _0xeb5c=function(_0x28b723,_0x3b36cf){_0x28b723=_0x28b723-0x0;var _0x197f4f=_0xb5ce[_0x28b723];return _0x197f4f;};'use strict';var util=require(_0xeb5c('0x0'));var Transform=require('stream')['Transform'];function AGIReply(_0x2e2a25){Transform[_0xeb5c('0x1')](this,_0x2e2a25);this['_localBuffer']='';this[_0xeb5c('0x2')]=![];}util[_0xeb5c('0x3')](AGIReply,Transform);AGIReply[_0xeb5c('0x4')][_0xeb5c('0x5')]=function(_0x283caa,_0x2ad637,_0x1b0aee){var _0x5560e8='\x0a',_0x4501c9=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x188a1d=-0x1,_0x42b643=-0x1,_0x40e07c='',_0x3d488a=0x0,_0x2f151b='',_0x55fa13='';this[_0xeb5c('0x6')]+=_0x283caa[_0xeb5c('0x7')]();_0x2f151b=this[_0xeb5c('0x6')];if(!this[_0xeb5c('0x2')]){_0x3d488a=0x0;while(_0x4501c9[_0x3d488a]){while((_0x42b643=_0x2f151b['indexOf'](_0x4501c9[_0x3d488a]))!=-0x1){_0x40e07c=_0x4501c9[_0x3d488a];_0x55fa13=_0x2f151b['substring'](0x0,_0x42b643);_0x2f151b=_0x2f151b[_0xeb5c('0x8')](_0x42b643+_0x40e07c['length']);var _0x1668f5=_0x55fa13[_0xeb5c('0x9')](_0x5560e8),_0x14f4de=0x0,_0x3be605={},_0x52997f='',_0x4fe17d='',_0x4054bc=-0x1;while(_0x1668f5[_0x14f4de]){_0x4054bc=_0x1668f5[_0x14f4de][_0xeb5c('0xa')](':');if(_0x4054bc!=-0x1){_0x52997f=_0x1668f5[_0x14f4de][_0xeb5c('0xb')](0x0,_0x4054bc)[_0xeb5c('0xc')]();_0x4fe17d=_0x1668f5[_0x14f4de][_0xeb5c('0xb')](_0x4054bc+0x1)[_0xeb5c('0xc')]();if(_0x52997f[_0xeb5c('0xd')]>0x0){_0x3be605[_0x52997f]=_0x4fe17d;}}else{}_0x14f4de++;}this[_0xeb5c('0xe')]('headers',_0x3be605);this[_0xeb5c('0x2')]=!![];}_0x3d488a++;}this[_0xeb5c('0x6')]=_0x2f151b;}else{while((_0x188a1d=_0x2f151b[_0xeb5c('0xa')](_0x5560e8))!=-0x1){_0x55fa13=_0x2f151b['substring'](0x0,_0x188a1d);this[_0xeb5c('0xe')](_0xeb5c('0xf'),_0x55fa13);_0x2f151b=_0x2f151b['substring'](_0x188a1d+_0x5560e8[_0xeb5c('0xd')]);}this[_0xeb5c('0x6')]=_0x2f151b;}_0x1b0aee();};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 ff8c21c..6277079 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 _0x8135=['ShowSound','save_name','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ListId','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','moment','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','CloudProvider','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById'];(function(_0xd858fd,_0x333bbc){var _0x5e581d=function(_0x35b3c2){while(--_0x35b3c2){_0xd858fd['push'](_0xd858fd['shift']());}};_0x5e581d(++_0x333bbc);}(_0x8135,0x99));var _0x5813=function(_0x964865,_0x1536df){_0x964865=_0x964865-0x0;var _0x1d9609=_0x8135[_0x964865];return _0x1d9609;};'use strict';var _=require('lodash');var moment=require(_0x5813('0x0'));var jayson=require(_0x5813('0x1'));var client=jayson[_0x5813('0x2')][_0x5813('0x3')]({'port':0x2329});function request(_0x4b43a8,_0x1fced6){return new Promise(function(_0x196ea8,_0xf23c29){return client[_0x5813('0x4')](_0x4b43a8,_0x1fced6)[_0x5813('0x5')](function(_0x5c8ff5){if(_0x5c8ff5['error']){return _0xf23c29(_0x5c8ff5[_0x5813('0x6')][_0x5813('0x7')]);}else{return _0x196ea8(_0x5c8ff5[_0x5813('0x8')]);}})[_0x5813('0x9')](function(_0x3101ea){return _0xf23c29(_0x3101ea);});});}exports[_0x5813('0xa')]=function(){return request(_0x5813('0xb'),{'options':{'raw':![],'attributes':['id',_0x5813('0xc'),_0x5813('0xd')]}});};exports[_0x5813('0xe')]=function(_0x3adb65){return request(_0x5813('0xf'),{'options':{'raw':![],'where':{'name':_0x3adb65},'attributes':[_0x5813('0xd')]}});};exports[_0x5813('0x10')]=function(_0x3012b5){return request(_0x5813('0x11'),{'options':{'raw':![],'where':{'id':_0x3012b5},'include':[{'model':_0x5813('0x12'),'as':'Smtp','include':[{'model':_0x5813('0x13'),'as':_0x5813('0x13')}]}],'attributes':['id',_0x5813('0xc'),'email'],'smtp':!![]}});};exports[_0x5813('0x14')]=function(_0x5076d){return request('ShowSquareProject',{'options':{'where':{'id':_0x5076d},'attributes':[_0x5813('0xc')]}});};exports[_0x5813('0x15')]=function(_0x57df76){return request(_0x5813('0x16'),{'options':{'where':{'id':_0x57df76},'attributes':[_0x5813('0xc')]}});};exports[_0x5813('0x17')]=function(_0x5044e9){return request(_0x5813('0x18'),{'options':{'where':{'id':_0x5044e9},'attributes':[_0x5813('0xc')]}});};exports['getSquareOdbcById']=function(_0x2834e6){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2834e6},'attributes':['dsn']}});};exports['getUserById']=function(_0x5705c9){return request('ShowUser',{'options':{'where':{'id':_0x5705c9},'attributes':[_0x5813('0xc')]}});};exports[_0x5813('0x19')]=function(_0x1e43df){return request('GetContactByPhone',{'options':{'where':{'phone':_0x1e43df[_0x5813('0x1a')]},'attributes':['id']}});};exports[_0x5813('0x1b')]=function(_0x7b7ee8){return request(_0x5813('0x1c'),{'options':{'where':{'id':_0x7b7ee8},'attributes':['name']}});};exports[_0x5813('0x1d')]=function(_0x383196){return request(_0x5813('0x1e'),{'options':{'where':{'id':_0x383196},'attributes':[_0x5813('0x1f')]}});};exports['getIntervalById']=function(_0x1f2506){return request(_0x5813('0x20'),{'options':{'raw':![],'where':{'id':_0x1f2506},'include':[{'model':_0x5813('0x21'),'as':'Intervals'}]}});};exports[_0x5813('0x22')]=function(_0xd116c0){return request(_0x5813('0x23'),{'options':{'where':{'id':_0xd116c0},'attributes':['id',_0x5813('0xc')]}});};exports[_0x5813('0x24')]=function(_0x183f7d){return request(_0x5813('0x25'),{'body':_0x183f7d});};exports[_0x5813('0x26')]=function(_0x5b4189){return request(_0x5813('0x27'),{'body':_0x5b4189});};exports[_0x5813('0x28')]=function(_0x23c6c7){return request(_0x5813('0x29'),{'body':_[_0x5813('0x2a')](_0x23c6c7,{'project_name':_0x23c6c7[_0x5813('0x2b')],'prev_project_name':_0x23c6c7[_0x5813('0x2c')]||'','is_subproject':_0x23c6c7['arg_2']?!![]:![],'leaveAt':moment()[_0x5813('0x2d')](_0x5813('0x2e'))})});};exports[_0x5813('0x2f')]=function(_0x4c9385){return request(_0x5813('0x30'),{'body':_0x4c9385});};exports[_0x5813('0x31')]=function(_0x56d18c){return request('CreateSquareMessage',{'body':_0x56d18c});};exports[_0x5813('0x32')]=function(_0x17acb5){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x17acb5['phone'],'ListId':_0x17acb5[_0x5813('0x33')]}}})[_0x5813('0x5')](function(_0x3a9bed){if(_0x3a9bed){return _0x3a9bed;}return request(_0x5813('0x34'),{'body':_0x17acb5});});};exports['getPauseById']=function(_0x520db4){return request(_0x5813('0x35'),{'options':{'where':{'id':_0x520db4},'attributes':[_0x5813('0xc')]}});};exports[_0x5813('0x36')]=function(_0x534b5c,_0x2e6665){return request(_0x5813('0x37'),{'body':{'interface':_0x2e6665},'options':{'where':_0x534b5c}});};exports[_0x5813('0x38')]=function(_0x5981da,_0x363275,_0x41b7a7){return request(_0x5813('0x39'),{'body':{'type':_0x363275,'uniqueid':_0x41b7a7},'options':{'where':_0x5981da}});};exports['agentUnpause']=function(_0x247ba1){return request(_0x5813('0x3a'),{'body':{},'options':{'where':_0x247ba1}});};exports[_0x5813('0x3b')]=function(_0x424430){return request(_0x5813('0x3c'),{'body':{},'options':{'where':_0x424430}});}; \ No newline at end of file +var _0xdfcc=['GetContactByPhone','phone','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','then','ShowPause','LoginUser','agentPause','agentUnpause','lodash','moment','jayson/promise','http','error','result','catch','getSquareProjects','name','getSquareProject','ShowSquareProject','production','getMailAccountById','Smtp','CloudProvider','email','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getContactByPhone'];(function(_0x3b5265,_0x50fba8){var _0x372857=function(_0x18fcab){while(--_0x18fcab){_0x3b5265['push'](_0x3b5265['shift']());}};_0x372857(++_0x50fba8);}(_0xdfcc,0x8d));var _0xcdfc=function(_0x4c80d7,_0x2bef29){_0x4c80d7=_0x4c80d7-0x0;var _0x3c5095=_0xdfcc[_0x4c80d7];return _0x3c5095;};'use strict';var _=require(_0xcdfc('0x0'));var moment=require(_0xcdfc('0x1'));var jayson=require(_0xcdfc('0x2'));var client=jayson['client'][_0xcdfc('0x3')]({'port':0x2329});function request(_0x851248,_0x54bd16){return new Promise(function(_0x4aef49,_0x468275){return client['request'](_0x851248,_0x54bd16)['then'](function(_0x5cf6e7){if(_0x5cf6e7[_0xcdfc('0x4')]){return _0x468275(_0x5cf6e7[_0xcdfc('0x4')]['message']);}else{return _0x4aef49(_0x5cf6e7[_0xcdfc('0x5')]);}})[_0xcdfc('0x6')](function(_0x462f04){return _0x468275(_0x462f04);});});}exports[_0xcdfc('0x7')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0xcdfc('0x8'),'production']}});};exports[_0xcdfc('0x9')]=function(_0x1db95f){return request(_0xcdfc('0xa'),{'options':{'raw':![],'where':{'name':_0x1db95f},'attributes':[_0xcdfc('0xb')]}});};exports[_0xcdfc('0xc')]=function(_0xee25c1){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0xee25c1},'include':[{'model':'MailServerOut','as':_0xcdfc('0xd'),'include':[{'model':_0xcdfc('0xe'),'as':'CloudProvider'}]}],'attributes':['id',_0xcdfc('0x8'),_0xcdfc('0xf')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x23ed41){return request(_0xcdfc('0xa'),{'options':{'where':{'id':_0x23ed41},'attributes':[_0xcdfc('0x8')]}});};exports['getVoiceQueueById']=function(_0x1378fe){return request(_0xcdfc('0x10'),{'options':{'where':{'id':_0x1378fe},'attributes':['name']}});};exports[_0xcdfc('0x11')]=function(_0x2cbc4c){return request(_0xcdfc('0x12'),{'options':{'where':{'id':_0x2cbc4c},'attributes':['name']}});};exports[_0xcdfc('0x13')]=function(_0x1a8095){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x1a8095},'attributes':[_0xcdfc('0x14')]}});};exports[_0xcdfc('0x15')]=function(_0x51ab72){return request(_0xcdfc('0x16'),{'options':{'where':{'id':_0x51ab72},'attributes':[_0xcdfc('0x8')]}});};exports[_0xcdfc('0x17')]=function(_0x53324a){return request(_0xcdfc('0x18'),{'options':{'where':{'phone':_0x53324a[_0xcdfc('0x19')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x3e1707){return request(_0xcdfc('0x1a'),{'options':{'where':{'id':_0x3e1707},'attributes':[_0xcdfc('0x8')]}});};exports[_0xcdfc('0x1b')]=function(_0x439ade){return request(_0xcdfc('0x1c'),{'options':{'where':{'id':_0x439ade},'attributes':['save_name']}});};exports[_0xcdfc('0x1d')]=function(_0x5f2293){return request(_0xcdfc('0x1e'),{'options':{'raw':![],'where':{'id':_0x5f2293},'include':[{'model':_0xcdfc('0x1f'),'as':_0xcdfc('0x20')}]}});};exports[_0xcdfc('0x21')]=function(_0x4e58ce){return request(_0xcdfc('0x22'),{'options':{'where':{'id':_0x4e58ce},'attributes':['id',_0xcdfc('0x8')]}});};exports[_0xcdfc('0x23')]=function(_0x338194){return request(_0xcdfc('0x24'),{'body':_0x338194});};exports[_0xcdfc('0x25')]=function(_0x101ba0){return request(_0xcdfc('0x26'),{'body':_0x101ba0});};exports[_0xcdfc('0x27')]=function(_0x3858ad){return request(_0xcdfc('0x28'),{'body':_['merge'](_0x3858ad,{'project_name':_0x3858ad[_0xcdfc('0x29')],'prev_project_name':_0x3858ad['arg_2']||'','is_subproject':_0x3858ad[_0xcdfc('0x2a')]?!![]:![],'leaveAt':moment()[_0xcdfc('0x2b')](_0xcdfc('0x2c'))})});};exports[_0xcdfc('0x2d')]=function(_0x1de322){return request(_0xcdfc('0x2e'),{'body':_0x1de322});};exports[_0xcdfc('0x2f')]=function(_0x5380cd){return request('CreateSquareMessage',{'body':_0x5380cd});};exports[_0xcdfc('0x30')]=function(_0x260843){return request(_0xcdfc('0x31'),{'options':{'raw':![],'where':{'phone':_0x260843[_0xcdfc('0x19')],'ListId':_0x260843['ListId']}}})[_0xcdfc('0x32')](function(_0x28e7f0){if(_0x28e7f0){return _0x28e7f0;}return request('CreateCmContact',{'body':_0x260843});});};exports['getPauseById']=function(_0x29cc4e){return request(_0xcdfc('0x33'),{'options':{'where':{'id':_0x29cc4e},'attributes':[_0xcdfc('0x8')]}});};exports['agentLogin']=function(_0x411229,_0x209ca7){return request(_0xcdfc('0x34'),{'body':{'interface':_0x209ca7},'options':{'where':_0x411229}});};exports[_0xcdfc('0x35')]=function(_0x481f3f,_0x36c82d,_0x51c461){return request('PauseUser',{'body':{'type':_0x36c82d,'uniqueid':_0x51c461},'options':{'where':_0x481f3f}});};exports[_0xcdfc('0x36')]=function(_0xd14932){return request('UnpauseUser',{'body':{},'options':{'where':_0xd14932}});};exports['agentLogout']=function(_0x2e51b8){return request('LogoutUser',{'body':{},'options':{'where':_0x2e51b8}});}; \ 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 8567db6..c27d087 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 _0x1b94=['./polly','./lex','exports'];(function(_0x2b9c0c,_0x4678a3){var _0xd8577b=function(_0x2dd9eb){while(--_0x2dd9eb){_0x2b9c0c['push'](_0x2b9c0c['shift']());}};_0xd8577b(++_0x4678a3);}(_0x1b94,0x1f2));var _0x41b9=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x1b94[_0x3070dc];return _0x431489;};var polly=require(_0x41b9('0x0'));var lex=require(_0x41b9('0x1'));module[_0x41b9('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x3d49=['exports','./lex'];(function(_0xe84953,_0xa2cc7){var _0x2f486f=function(_0x4a0a09){while(--_0x4a0a09){_0xe84953['push'](_0xe84953['shift']());}};_0x2f486f(++_0xa2cc7);}(_0x3d49,0x151));var _0x93d4=function(_0xd158dc,_0x128608){_0xd158dc=_0xd158dc-0x0;var _0x12d25f=_0x3d49[_0xd158dc];return _0x12d25f;};var polly=require('./polly');var lex=require(_0x93d4('0x0'));module[_0x93d4('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 2b99993..1273693 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 _0xdace=['./lib/api'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0xdace,0xc5));var _0xedac=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xdace[_0x68ee8b];return _0x5148f7;};'use strict';var lex=require(_0xedac('0x0'));module['exports']=function(_0x1c76b2,_0x13adb5,_0x46eba0,_0x518516,_0x413d77,_0x36bcd2){return lex(_0x1c76b2,_0x13adb5,_0x46eba0,_0x518516,_0x413d77,_0x36bcd2);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x3d5d4e,_0x33a55d,_0x5527b3,_0x175deb,_0xd002ca,_0x200b2a){return lex(_0x3d5d4e,_0x33a55d,_0x5527b3,_0x175deb,_0xd002ca,_0x200b2a);}; \ 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 ea54923..248a7a2 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(_0x306da1,_0x5ba128){var _0x6f864f=function(_0x13c5d7){while(--_0x13c5d7){_0x306da1['push'](_0x306da1['shift']());}};_0x6f864f(++_0x5ba128);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x3064f4,_0x561535){var _0x459ee4=function(_0x5b749a){while(--_0x5b749a){_0x3064f4['push'](_0x3064f4['shift']());}};_0x459ee4(++_0x561535);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 cde67a4..a4d6557 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 _0xdf8b=['exports','./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf8b,0x1e3));var _0xbdf8=function(_0x5e2a0f,_0x447ab4){_0x5e2a0f=_0x5e2a0f-0x0;var _0x3e8c10=_0xdf8b[_0x5e2a0f];return _0x3e8c10;};'use strict';var polly=require(_0xbdf8('0x0'));module[_0xbdf8('0x1')]=function(_0x308e8a,_0xe84584,_0x5c39de,_0x151f20,_0x2f57f5,_0x16d692,_0x1f761d){return polly(_0x308e8a,_0xe84584,_0x5c39de,_0x151f20,_0x2f57f5,_0x16d692,_0x1f761d);}; \ No newline at end of file +var _0xe271=['./lib/api','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe271,0xce));var _0x1e27=function(_0x5369f4,_0x4515f9){_0x5369f4=_0x5369f4-0x0;var _0x11daa7=_0xe271[_0x5369f4];return _0x11daa7;};'use strict';var polly=require(_0x1e27('0x0'));module[_0x1e27('0x1')]=function(_0x51f678,_0x15ba9d,_0x2625b4,_0x1f5e14,_0x23ec44,_0x2b2211,_0x455be9){return polly(_0x51f678,_0x15ba9d,_0x2625b4,_0x1f5e14,_0x23ec44,_0x2b2211,_0x455be9);}; \ 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 8e12558..8c521ca 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 _0x88b3=['path','bluebird','randomstring','aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x88b3,0xf0));var _0x388b=function(_0x2cd9cb,_0x517de7){_0x2cd9cb=_0x2cd9cb-0x0;var _0x5b3777=_0x88b3[_0x2cd9cb];return _0x5b3777;};'use strict';var fs=require('fs');var path=require(_0x388b('0x0'));var BPromise=require(_0x388b('0x1'));var rs=require(_0x388b('0x2'));var AWS=require(_0x388b('0x3'));function pollyResult(_0x5d6979,_0x781597,_0x559840){return new BPromise(function(_0x5ed7ec,_0xe696d8){_0x5d6979['synthesizeSpeech'](_0x781597,function(_0x386464,_0x24d892){if(_0x386464){_0xe696d8(_0x386464);}else if(_0x24d892){if(_0x24d892[_0x388b('0x4')]instanceof Buffer){fs[_0x388b('0x5')](_0x559840,_0x24d892[_0x388b('0x4')],function(_0x1ca16c){if(_0x1ca16c){_0xe696d8(_0x1ca16c);}else{_0x5ed7ec();}});}else{_0xe696d8(new Error(_0x388b('0x6')));}}else{_0xe696d8(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x324935,_0x23bbb7,_0x490128,_0x4e3495,_0x202c8b,_0x562c93,_0x4c82ad){var _0x560fa8=new AWS[(_0x388b('0x7'))]({'accessKeyId':_0x324935,'secretAccessKey':_0x23bbb7,'region':_0x490128});var _0x1d8d69={'Text':_0x202c8b,'TextType':_0x562c93||_0x388b('0x8'),'OutputFormat':_0x388b('0x9'),'VoiceId':_0x4e3495};return pollyResult(_0x560fa8,_0x1d8d69,_0x4c82ad);}; \ No newline at end of file +var _0xb14e=['Polly','text','mp3','path','randomstring','aws-sdk','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x34f91f,_0x5a57fe){var _0x4cbf28=function(_0x254f7f){while(--_0x254f7f){_0x34f91f['push'](_0x34f91f['shift']());}};_0x4cbf28(++_0x5a57fe);}(_0xb14e,0xcb));var _0xeb14=function(_0x4e3cb9,_0x350b7b){_0x4e3cb9=_0x4e3cb9-0x0;var _0x357ed1=_0xb14e[_0x4e3cb9];return _0x357ed1;};'use strict';var fs=require('fs');var path=require(_0xeb14('0x0'));var BPromise=require('bluebird');var rs=require(_0xeb14('0x1'));var AWS=require(_0xeb14('0x2'));function pollyResult(_0x1b8ee2,_0x229c3,_0x8f74de){return new BPromise(function(_0x51f25d,_0x49f659){_0x1b8ee2['synthesizeSpeech'](_0x229c3,function(_0x533016,_0x4a4450){if(_0x533016){_0x49f659(_0x533016);}else if(_0x4a4450){if(_0x4a4450[_0xeb14('0x3')]instanceof Buffer){fs[_0xeb14('0x4')](_0x8f74de,_0x4a4450[_0xeb14('0x3')],function(_0x218eca){if(_0x218eca){_0x49f659(_0x218eca);}else{_0x51f25d();}});}else{_0x49f659(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x49f659(new Error(_0xeb14('0x5')));}});});}module[_0xeb14('0x6')]=function(_0x9335ea,_0x35ef7e,_0x18264c,_0x43659c,_0x1e5e8f,_0x34ba9a,_0x28d63c){var _0x2c5c75=new AWS[(_0xeb14('0x7'))]({'accessKeyId':_0x9335ea,'secretAccessKey':_0x35ef7e,'region':_0x18264c});var _0x5d4236={'Text':_0x1e5e8f,'TextType':_0x34ba9a||_0xeb14('0x8'),'OutputFormat':_0xeb14('0x9'),'VoiceId':_0x43659c};return pollyResult(_0x2c5c75,_0x5d4236,_0x28d63c);}; \ 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 62f604b..34d7b27 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 _0xa712=['exports'];(function(_0x51d534,_0x135ace){var _0x1b741b=function(_0x22f28c){while(--_0x22f28c){_0x51d534['push'](_0x51d534['shift']());}};_0x1b741b(++_0x135ace);}(_0xa712,0x159));var _0x2a71=function(_0x3c6dce,_0x5424dd){_0x3c6dce=_0x3c6dce-0x0;var _0x1450e9=_0xa712[_0x3c6dce];return _0x1450e9;};'use strict';var asr=require('./lib/api');module[_0x2a71('0x0')]=function(_0xf9b935,_0x11f901,_0xce8c02,_0x2d33e5){return asr(_0xf9b935,_0x11f901,_0xce8c02);}; \ No newline at end of file +var _0xf1ab=['exports'];(function(_0x503a66,_0x512c53){var _0x526f02=function(_0x18a770){while(--_0x18a770){_0x503a66['push'](_0x503a66['shift']());}};_0x526f02(++_0x512c53);}(_0xf1ab,0xb4));var _0xbf1a=function(_0x4106be,_0x2c9af4){_0x4106be=_0x4106be-0x0;var _0x4542f7=_0xf1ab[_0x4106be];return _0x4542f7;};'use strict';var asr=require('./lib/api');module[_0xbf1a('0x0')]=function(_0x2cc1f9,_0x1fd10f,_0x475ccc,_0xf9573f){return asr(_0x2cc1f9,_0x1fd10f,_0x475ccc);}; \ 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 0e26b67..f958a8a 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 _0x9099=['https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','base64','POST','/v1/speech:recognize?key=','LINEAR16','url'];(function(_0x58336c,_0x2c1cf3){var _0x18a1fb=function(_0x97c4d){while(--_0x97c4d){_0x58336c['push'](_0x58336c['shift']());}};_0x18a1fb(++_0x2c1cf3);}(_0x9099,0x1ac));var _0x9909=function(_0x8dc04d,_0xaa7559){_0x8dc04d=_0x8dc04d-0x0;var _0x2f5f28=_0x9099[_0x8dc04d];return _0x2f5f28;};'use strict';var url=require(_0x9909('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x9909('0x1');module[_0x9909('0x2')]=function(_0x38e636,_0x2524d3,_0x3fd4b4){return new BPromise(function(_0x34aabc,_0x2168ff){var _0x6eb0ac;if(typeof _0x38e636!==_0x9909('0x3')||_0x38e636[_0x9909('0x4')]===0x0){return _0x2168ff(_0x9909('0x5'));}if(typeof _0x2524d3!==_0x9909('0x3')||_0x2524d3[_0x9909('0x4')]===0x0){return _0x2168ff(_0x9909('0x6'));}if(typeof _0x3fd4b4!=='undefined'&&(typeof _0x3fd4b4!==_0x9909('0x3')||_0x3fd4b4['length']===0x0)){return _0x2168ff('lang\x20should\x20be\x20a\x20string');}try{_0x6eb0ac=fs['readFileSync'](_0x38e636)['toString'](_0x9909('0x7'));}catch(_0x592725){return _0x2168ff(_0x592725);}return _0x34aabc({'method':_0x9909('0x8'),'uri':host+_0x9909('0x9')+_0x2524d3,'body':{'config':{'encoding':_0x9909('0xa'),'sampleRateHertz':'8000','languageCode':_0x3fd4b4},'audio':{'content':_0x6eb0ac}},'json':!![]});});}; \ No newline at end of file +var _0x9f3e=['key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9f3e,0x1c4));var _0xe9f3=function(_0x590376,_0x1c9168){_0x590376=_0x590376-0x0;var _0x4015a3=_0x9f3e[_0x590376];return _0x4015a3;};'use strict';var url=require(_0xe9f3('0x0'));var BPromise=require(_0xe9f3('0x1'));var fs=require('fs');var host=_0xe9f3('0x2');module[_0xe9f3('0x3')]=function(_0xf82db9,_0x59bb34,_0x597538){return new BPromise(function(_0x4c3a39,_0x1ea33c){var _0x4bc414;if(typeof _0xf82db9!==_0xe9f3('0x4')||_0xf82db9[_0xe9f3('0x5')]===0x0){return _0x1ea33c(_0xe9f3('0x6'));}if(typeof _0x59bb34!==_0xe9f3('0x4')||_0x59bb34[_0xe9f3('0x5')]===0x0){return _0x1ea33c(_0xe9f3('0x7'));}if(typeof _0x597538!==_0xe9f3('0x8')&&(typeof _0x597538!==_0xe9f3('0x4')||_0x597538[_0xe9f3('0x5')]===0x0)){return _0x1ea33c(_0xe9f3('0x9'));}try{_0x4bc414=fs[_0xe9f3('0xa')](_0xf82db9)[_0xe9f3('0xb')](_0xe9f3('0xc'));}catch(_0x5b77e6){return _0x1ea33c(_0x5b77e6);}return _0x4c3a39({'method':_0xe9f3('0xd'),'uri':host+_0xe9f3('0xe')+_0x59bb34,'body':{'config':{'encoding':_0xe9f3('0xf'),'sampleRateHertz':_0xe9f3('0x10'),'languageCode':_0x597538},'audio':{'content':_0x4bc414}},'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 bd81b04..c46e98b 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 _0x2898=['exports','./asr'];(function(_0x2ecac5,_0x47fdd2){var _0x40e663=function(_0x4cc999){while(--_0x4cc999){_0x2ecac5['push'](_0x2ecac5['shift']());}};_0x40e663(++_0x47fdd2);}(_0x2898,0x13b));var _0x8289=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0x2898[_0x126fb9];return _0xc8a3b1;};var asr=require(_0x8289('0x0'));module[_0x8289('0x1')]={'asr':asr}; \ No newline at end of file +var _0x469f=['exports'];(function(_0x510be5,_0x383680){var _0x55aca1=function(_0x597c77){while(--_0x597c77){_0x510be5['push'](_0x510be5['shift']());}};_0x55aca1(++_0x383680);}(_0x469f,0x19d));var _0xf469=function(_0x4407af,_0x21c452){_0x4407af=_0x4407af-0x0;var _0x5dcdc2=_0x469f[_0x4407af];return _0x5dcdc2;};var asr=require('./asr');module[_0xf469('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 6857969..c05bbdb 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 _0x7963=['end_conversation','fulfillmentText','intent','name','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','request-promise','sox','google-tts-api','url','util','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','get','statusCode','error','request\x20to\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','download\x20error','end','transcode','wav','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','then','unlink','777','split','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','chmodSync','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','jQ1olc','stringify','null','generic','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','alternatives','transcript','join','results','map','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','message','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields'];(function(_0x337ea1,_0x1e73df){var _0x49dbc3=function(_0x22c2a2){while(--_0x22c2a2){_0x337ea1['push'](_0x337ea1['shift']());}};_0x49dbc3(++_0x1e73df);}(_0x7963,0xa9));var _0x3796=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x7963[_0x4cf98e];return _0x1623ac;};'use strict';var apiai=require(_0x3796('0x0'));var BPromise=require(_0x3796('0x1'));var dialogflow=require(_0x3796('0x2'));var fs=require('fs');var http=require(_0x3796('0x3'));var https=require(_0x3796('0x4'));var md5=require('md5');var path=require('path');var querystring=require('querystring');var rp=require(_0x3796('0x5'));var rs=require('randomstring');var sox=require(_0x3796('0x6'));var tts=require(_0x3796('0x7'));var urlParse=require(_0x3796('0x8'))['parse'];var util=require(_0x3796('0x9'));var aws=require(_0x3796('0xa'));var google=require(_0x3796('0xb'));var sestek=require(_0x3796('0xc'));var tilde=require('./tilde');var logger=require(_0x3796('0xd'))(_0x3796('0xe'));var ISPEECH_API=_0x3796('0xf');function downloadFile(_0x3627be,_0x2e174f){return new BPromise(function(_0xcb7773,_0x28fcf7){var _0x1dad86=urlParse(_0x3627be);var _0x178cd2=_0x1dad86[_0x3796('0x10')]===_0x3796('0x11')?https:http;var _0x3675c8={'host':_0x1dad86[_0x3796('0x12')],'path':_0x1dad86[_0x3796('0x13')],'headers':{'user-agent':'WHAT_EVER'}};_0x178cd2[_0x3796('0x14')](_0x3675c8,function(_0x22f43f){if(_0x22f43f[_0x3796('0x15')]!==0xc8){logger[_0x3796('0x16')](_0x3796('0x17')+_0x3627be+'\x20failed,\x20status\x20code\x20=\x20'+_0x22f43f['statusCode']+'\x20('+_0x22f43f['statusMessage']+')');_0x28fcf7(new Error(_0x3796('0x17')+_0x3627be+'\x20failed,\x20status\x20code\x20=\x20'+_0x22f43f[_0x3796('0x15')]+'\x20('+_0x22f43f[_0x3796('0x18')]+')'));return;}var _0x368056=fs[_0x3796('0x19')](_0x2e174f);_0x368056['on']('finish',function(){logger[_0x3796('0x1a')](_0x3796('0x1b'));_0x368056['close'](_0xcb7773);});_0x368056['on'](_0x3796('0x16'),function(_0x37b186){fs['unlink'](_0x2e174f);logger[_0x3796('0x16')](_0x3796('0x1c'),_0x37b186);_0x28fcf7(_0x37b186);});_0x22f43f['pipe'](_0x368056);})['on'](_0x3796('0x16'),function(_0x27067c){logger[_0x3796('0x16')](_0x27067c);_0x28fcf7(_0x27067c);})[_0x3796('0x1d')]();});}function uploadFile(_0x2ad68d){return new BPromise(function(_0x9c932,_0x28792f){var _0x547169=urlParse(_0x2ad68d);var _0x48282d=_0x547169[_0x3796('0x10')]==='https:'?https:http;var _0x33f42b={'host':_0x547169[_0x3796('0x12')],'path':_0x547169[_0x3796('0x13')],'headers':{'user-agent':'WHAT_EVER'}};_0x48282d[_0x3796('0x14')](_0x33f42b,function(_0x223912){if(_0x223912[_0x3796('0x15')]!==0xc8){_0x28792f(new Error(_0x3796('0x17')+_0x2ad68d+'\x20failed,\x20status\x20code\x20=\x20'+_0x223912[_0x3796('0x15')]+'\x20('+_0x223912[_0x3796('0x18')]+')'));return;}var _0x51e866='';_0x223912['on']('data',function(_0x3aeac1){_0x51e866+=_0x3aeac1;});_0x223912['on'](_0x3796('0x1d'),function(){_0x9c932(_0x51e866);});})['on'](_0x3796('0x16'),function(_0x1a5208){_0x28792f(_0x1a5208);})[_0x3796('0x1d')]();});}function convertFile(_0x558c29,_0x20fddf){return new BPromise(function(_0x292a57,_0x102e0b){var _0x4c0db7=sox[_0x3796('0x1e')](_0x558c29,_0x20fddf,{'sampleRate':0x1f40,'format':_0x3796('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4c0db7['on'](_0x3796('0x16'),function(_0x2a95fb){logger['error']('error\x20convert',_0x2a95fb);_0x102e0b(_0x2a95fb);});_0x4c0db7['on'](_0x3796('0x1d'),function(){logger[_0x3796('0x1a')](_0x3796('0x20'));_0x292a57();});_0x4c0db7[_0x3796('0x21')]();});}function base64Decode(_0x57f787,_0x16d4e9){var _0x5e2a5d=path[_0x3796('0x22')](__dirname,_0x3796('0x23'),rs[_0x3796('0x24')](0x4)+_0x3796('0x25'));fs['writeFileSync'](_0x5e2a5d,_0x57f787,'base64');return convertFile(_0x5e2a5d,_0x16d4e9)[_0x3796('0x26')](function(){try{fs[_0x3796('0x27')](_0x5e2a5d);fs['chmodSync'](_0x16d4e9,_0x3796('0x28'));}catch(_0x354d1a){logger[_0x3796('0x16')](_0x354d1a);}return _0x16d4e9[_0x3796('0x29')]('.')[0x0];});}function base64Encode(_0x117394){var _0x221549=fs['readFileSync'](_0x117394);return new Buffer(_0x221549)[_0x3796('0x2a')](_0x3796('0x2b'));}exports[_0x3796('0x2c')]=function(_0x348ba6,_0x2835e7,_0xa43e88,_0x4168ea,_0x3c23fb,_0x295b20){var _0x11400e,_0x178ef6;var _0x14ea91=_0x3796('0x2d');var _0x4bde25=_0x3796('0x2e')+_0x348ba6;var _0x149673={};if(_0x2835e7===_0x3796('0x2f')){_0x149673[_0x3796('0x30')]={'ssml':_0xa43e88};}else{_0x149673[_0x3796('0x30')]={'text':_0xa43e88};};_0x149673[_0x3796('0x31')]={'languageCode':_0x4168ea,'ssmlGender':_0x3c23fb};_0x149673[_0x3796('0x32')]={'audioEncoding':_0x3796('0x33'),'sampleRateHertz':0x1f40};var _0x55791f={'url':_0x14ea91+_0x3796('0x34')+_0x4bde25,'method':_0x3796('0x35'),'json':!![],'body':_0x149673};return rp(_0x55791f)[_0x3796('0x26')](function(_0x5911f3){return new BPromise(function(_0x274476,_0x59660d){_0x11400e=path[_0x3796('0x22')](__dirname,'tmp',rs[_0x3796('0x24')](0x4)+_0x3796('0x36'));var _0x1cfbae=Buffer[_0x3796('0x37')](_0x5911f3[_0x3796('0x38')],_0x3796('0x2b'));return fs['writeFile'](_0x11400e,_0x1cfbae,function(_0x4ed156){_0x59660d(_0x4ed156);},function(_0x2110ff){fs[_0x3796('0x39')](_0x11400e,'777');_0x274476(_0x2110ff);});});})['then'](function(_0x83038e){_0x178ef6=path[_0x3796('0x22')](__dirname,_0x3796('0x23'),rs['generate'](0x4)+_0x3796('0x25'));return convertFile(_0x11400e,_0x178ef6);})['then'](function(){try{fs[_0x3796('0x27')](_0x11400e);fs[_0x3796('0x39')](_0x178ef6,_0x3796('0x28'));}catch(_0x27f2ee){logger[_0x3796('0x16')](_0x27f2ee);}logger['info'](_0x3796('0x3a'),_0x178ef6[_0x3796('0x29')]('.')[0x0]);return _0x178ef6['split']('.')[0x0];});};exports[_0x3796('0x3b')]=function(_0x59682c,_0x3198ca){var _0x523ddf=_0x3796('0x3c');var _0x585a20,_0x564784;var _0x9e73bf;var _0x3ec826={'encoding':_0x3796('0x3d'),'method':_0x3796('0x35'),'timeout':0x2710,'url':_0x523ddf,'headers':{'Content-Type':_0x3796('0x3e')},'body':'f.req='+encodeURIComponent(JSON['stringify']([[[_0x3796('0x3f'),JSON[_0x3796('0x40')]([_0x59682c,_0x3198ca||'en',![],_0x3796('0x41')]),null,_0x3796('0x42')]]]))};return rp(_0x3ec826)[_0x3796('0x26')](function(_0x35dfeb){try{_0x9e73bf=eval(_0x35dfeb['slice'](0x5))[0x0][0x2];}catch(_0x61aa8b){throw new Error(_0x3796('0x43')+_0x35dfeb[_0x3796('0x44')]);}if(!_0x9e73bf){if(_0x59682c[_0x3796('0x45')]>0xc8){throw new Error(_0x3796('0x46'));}else{throw new Error(_0x3796('0x47')+_0x3198ca+_0x3796('0x48'));}}try{_0x9e73bf=eval(_0x9e73bf)[0x0];}catch(_0x1dd615){throw new Error(_0x3796('0x43')+res[_0x3796('0x44')]);}const _0x4ab766=_0x9e73bf;_0x585a20=path[_0x3796('0x22')](__dirname,'tmp',rs[_0x3796('0x24')](0x4)+_0x3796('0x36'));fs['writeFileSync'](_0x585a20,_0x9e73bf,{'encoding':_0x3796('0x2b')});_0x564784=path['resolve'](__dirname,'tmp',rs[_0x3796('0x24')](0x4)+_0x3796('0x25'));return convertFile(_0x585a20,_0x564784);})['then'](function(){try{fs[_0x3796('0x27')](_0x585a20);fs[_0x3796('0x39')](_0x564784,_0x3796('0x28'));}catch(_0x2caa0f){logger[_0x3796('0x16')](_0x2caa0f);}logger[_0x3796('0x1a')](_0x3796('0x49'),_0x564784['split']('.')[0x0]);return _0x564784[_0x3796('0x29')]('.')[0x0];});};exports[_0x3796('0x4a')]=function(_0x5f07ca,_0x5e8bbd,_0x5550f8){return google[_0x3796('0x4b')](_0x5f07ca,_0x5e8bbd,_0x5550f8)[_0x3796('0x26')](function(_0x432338){logger[_0x3796('0x1a')](_0x432338[_0x3796('0x4c')]);return rp(_0x432338);})[_0x3796('0x26')](function(_0x575e2f){var _0x2d86c3='';var _0xf0a1a8=0x0;try{fs[_0x3796('0x27')](_0x5f07ca);}catch(_0x55059f){logger[_0x3796('0x16')](_0x55059f);}if(_0x575e2f&&_0x575e2f['results']){_0x2d86c3=_0x575e2f['results']['map'](function(_0x4cd3a9){return _0x4cd3a9&&_0x4cd3a9[_0x3796('0x4d')][0x0]&&_0x4cd3a9['alternatives'][0x0]['transcript']?_0x4cd3a9[_0x3796('0x4d')][0x0][_0x3796('0x4e')]:'';})[_0x3796('0x4f')]('\x0a');_0xf0a1a8=_0x575e2f[_0x3796('0x50')][_0x3796('0x51')](function(_0x500561){return _0x500561&&_0x500561[_0x3796('0x4d')][0x0]&&_0x500561[_0x3796('0x4d')][0x0]['confidence']?_0x500561['alternatives'][0x0][_0x3796('0x52')]:0x0;})['join']('\x0a');}logger[_0x3796('0x1a')](_0x3796('0x53'),_0x2d86c3);logger[_0x3796('0x1a')](_0x3796('0x54'),_0xf0a1a8);return{'transcript':_0x2d86c3,'confidence':_0xf0a1a8};})['catch'](function(_0x4652a8){logger[_0x3796('0x16')](_0x3796('0x55'),_0x4652a8['statusCode'],_0x4652a8['name'],_0x4652a8[_0x3796('0x56')]);});};exports['googleDialogflow']=function(_0x1ef3d2,_0x221590,_0x37ed2c,_0x5f4d33){var _0x211ce2=apiai(_0x221590,{'language':_0x5f4d33||'en'});return _0x211ce2[_0x3796('0x57')](_0x37ed2c,{'sessionId':md5(_0x1ef3d2)})[_0x3796('0x26')](function(_0x25d1ef){logger[_0x3796('0x1a')](JSON[_0x3796('0x40')](_0x25d1ef));return{'source':_0x25d1ef[_0x3796('0x58')][_0x3796('0x59')],'resolvedQuery':_0x25d1ef[_0x3796('0x58')][_0x3796('0x5a')],'action':_0x25d1ef['result'][_0x3796('0x5b')],'actionIncomplete':_0x25d1ef['result'][_0x3796('0x5c')],'speech':_0x25d1ef[_0x3796('0x58')][_0x3796('0x5d')][_0x3796('0x5e')],'score':_0x25d1ef['result'][_0x3796('0x5f')],'statusCode':_0x25d1ef[_0x3796('0x60')][_0x3796('0x61')],'endConversation':_0x25d1ef[_0x3796('0x58')][_0x3796('0x62')][_0x3796('0x63')]||![],'isFallbackIntent':_0x25d1ef['result'][_0x3796('0x62')][_0x3796('0x64')]};});};exports[_0x3796('0x65')]=function(_0x3470e9,_0x3615d9,_0x31fa0b,_0x31f1d,_0x2ea36c,_0x4f2997){var _0x17c8c7=_0x31f1d[_0x3796('0x66')](/\\n/g,'\x0a');var _0x39c366={'credentials':{'private_key':_0x17c8c7,'client_email':_0x31fa0b}};var _0x3ac4d3=new dialogflow[(_0x3796('0x67'))](_0x39c366);var _0x29a2c1=_0x3ac4d3['sessionPath'](_0x3615d9,md5(_0x3470e9));var _0x2e346f={'session':_0x29a2c1,'queryInput':{'text':{'text':_0x2ea36c,'languageCode':_0x4f2997}}};return _0x3ac4d3[_0x3796('0x68')](_0x2e346f)[_0x3796('0x26')](function(_0x379c4b){if(_0x379c4b&&_0x379c4b[_0x3796('0x45')]){logger[_0x3796('0x1a')]('Dialogflow\x20V2\x20response:',JSON[_0x3796('0x40')](_0x379c4b));var _0x240c97=_0x379c4b[0x0];if(_0x240c97){var _0x49c45a={'action':_0x240c97[_0x3796('0x69')][_0x3796('0x5b')],'allRequiredParamsPresent':_0x240c97[_0x3796('0x69')][_0x3796('0x6a')],'endConversation':_0x240c97[_0x3796('0x69')][_0x3796('0x6b')]&&_0x240c97[_0x3796('0x69')][_0x3796('0x6b')][_0x3796('0x6c')]?_0x240c97[_0x3796('0x69')][_0x3796('0x6b')][_0x3796('0x6c')][_0x3796('0x6d')]['boolValue']:![],'fulfillmentText':_0x240c97[_0x3796('0x69')][_0x3796('0x6e')],'intentName':_0x240c97[_0x3796('0x69')][_0x3796('0x6f')][_0x3796('0x70')],'intentDisplayName':_0x240c97[_0x3796('0x69')]['intent'][_0x3796('0x71')],'isFallbackIntent':_0x240c97[_0x3796('0x69')]['intent'][_0x3796('0x72')],'languageCode':_0x240c97[_0x3796('0x69')][_0x3796('0x73')],'queryText':_0x240c97[_0x3796('0x69')]['queryText'],'responseId':_0x240c97[_0x3796('0x74')],'score':_0x240c97[_0x3796('0x69')][_0x3796('0x75')],'speech':_0x240c97[_0x3796('0x69')]['fulfillmentText'],'providerResponse':JSON[_0x3796('0x40')](_0x379c4b)};return _0x49c45a;}}});};exports[_0x3796('0x76')]=function(_0xca54ba,_0x57d567,_0x39743d,_0x352ee2){return tilde[_0x3796('0x4b')](_0xca54ba,_0x57d567,_0x39743d,_0x352ee2)[_0x3796('0x26')](function(_0x4a3f76){try{fs[_0x3796('0x27')](_0xca54ba);}catch(_0x30b1dc){logger[_0x3796('0x16')](_0x30b1dc);}logger['info'](_0x3796('0x77'),_0x4a3f76[_0x3796('0x4e')]);logger['info'](_0x3796('0x78'),_0x4a3f76['confidence']);return _0x4a3f76;});};exports[_0x3796('0x79')]=function(_0x474e45,_0x509dd3,_0x2f02c2,_0x117994,_0x4aca38,_0x849a04){var _0x371412=path['resolve'](__dirname,_0x3796('0x23'),rs[_0x3796('0x24')](0x4)+'.mp3');var _0x357742;return aws['polly'](_0x474e45,_0x509dd3,_0x2f02c2,_0x117994,_0x4aca38,_0x849a04,_0x371412)[_0x3796('0x26')](function(){_0x357742=path[_0x3796('0x22')](__dirname,_0x3796('0x23'),rs['generate'](0x4)+'.wav');return convertFile(_0x371412,_0x357742);})[_0x3796('0x26')](function(){try{fs[_0x3796('0x27')](_0x371412);fs['chmodSync'](_0x357742,_0x3796('0x28'));}catch(_0x56e0fc){logger[_0x3796('0x16')](_0x56e0fc);}return _0x357742['split']('.')[0x0];});};exports[_0x3796('0x7a')]=function(_0x5b5aba,_0x15fec8,_0x7e0bf8,_0xf7819b,_0x3b271c,_0x230d32){return aws[_0x3796('0x7b')](_0x5b5aba,_0x15fec8,_0x7e0bf8,_0xf7819b,_0x3b271c,_0x230d32)[_0x3796('0x26')](function(_0x2594f1){logger[_0x3796('0x1a')](JSON[_0x3796('0x40')](_0x2594f1));return _0x2594f1;});};exports[_0x3796('0x7c')]=function(_0x202d7f,_0x1804af,_0x474b83,_0x28f68f){var _0x72e13b=util[_0x3796('0x7d')](_0x3796('0x7e'),ISPEECH_API,_0x202d7f,encodeURIComponent(_0x1804af),_0x474b83,_0x28f68f);var _0x3e7bbe=path[_0x3796('0x22')](__dirname,_0x3796('0x23'),rs[_0x3796('0x24')](0x4)+'.mp3');var _0x5f3912;return downloadFile(_0x72e13b,_0x3e7bbe)[_0x3796('0x26')](function(){_0x5f3912=path[_0x3796('0x22')](__dirname,'tmp',rs[_0x3796('0x24')](0x4)+_0x3796('0x25'));return convertFile(_0x3e7bbe,_0x5f3912);})['then'](function(){try{fs[_0x3796('0x27')](_0x3e7bbe);fs['chmodSync'](_0x5f3912,_0x3796('0x28'));}catch(_0x44d876){logger[_0x3796('0x16')](_0x44d876);}return _0x5f3912[_0x3796('0x29')]('.')[0x0];});};exports['ispeechASR']=function(_0x27fd06,_0x4f5912,_0x52160a,_0x2b37cb){var _0xc57f70=util[_0x3796('0x7d')](_0x3796('0x7f'),ISPEECH_API,_0x4f5912,_0x52160a,base64Encode(_0x27fd06),_0x2b37cb?util[_0x3796('0x7d')](_0x3796('0x80'),encodeURIComponent(_0x2b37cb)):_0x3796('0x81'));return uploadFile(_0xc57f70)[_0x3796('0x26')](function(_0x48c5b5){return querystring[_0x3796('0x82')](_0x48c5b5);});};exports[_0x3796('0x83')]=function(_0x1225e8,_0x209678){return sestek[_0x3796('0x84')](_0x1225e8,_0x209678)[_0x3796('0x26')](function(_0x37e2ac){logger[_0x3796('0x1a')](JSON[_0x3796('0x40')](_0x37e2ac));var _0x520425={'speech':_0x37e2ac[_0x3796('0x85')],'action':_0x37e2ac[_0x3796('0x86')]?_0x37e2ac[_0x3796('0x86')][_0x3796('0x87')]:undefined,'actiondata':_0x37e2ac[_0x3796('0x86')]?_0x37e2ac[_0x3796('0x86')]['CustomActionData']:undefined};if(_0x37e2ac['channelData']&&_0x37e2ac[_0x3796('0x86')][_0x3796('0x88')]){return base64Decode(_0x37e2ac[_0x3796('0x86')]['AudioFromTts']['Data'],path[_0x3796('0x22')](__dirname,_0x3796('0x23'),rs['generate'](0x4)+_0x3796('0x25')))[_0x3796('0x26')](function(_0x97680d){_0x520425[_0x3796('0x89')]=_0x97680d;return _0x520425;});}return _0x520425;});};exports[_0x3796('0x8a')]=function(){return __dirname;}; \ No newline at end of file +var _0x7006=['audioContent','writeFile','generate','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','null','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','data','writeFileSync','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','textRequest','result','source','resolvedQuery','action','fulfillment','speech','score','code','metadata','endConversation','googleDialogflowV2','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','https','md5','path','request-promise','sox','google-tts-api','url','parse','./aws','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','end','host','transcode','error\x20convert','start','resolve','tmp','.wav','base64','then','chmodSync','777','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','MP3','text:synthesize','POST','.mp3','from'];(function(_0x20a822,_0x5dc295){var _0x3775d1=function(_0x5c53dd){while(--_0x5c53dd){_0x20a822['push'](_0x20a822['shift']());}};_0x3775d1(++_0x5dc295);}(_0x7006,0x152));var _0x6700=function(_0x40dd56,_0x726ca5){_0x40dd56=_0x40dd56-0x0;var _0x4f850f=_0x7006[_0x40dd56];return _0x4f850f;};'use strict';var apiai=require(_0x6700('0x0'));var BPromise=require(_0x6700('0x1'));var dialogflow=require(_0x6700('0x2'));var fs=require('fs');var http=require(_0x6700('0x3'));var https=require(_0x6700('0x4'));var md5=require(_0x6700('0x5'));var path=require(_0x6700('0x6'));var querystring=require('querystring');var rp=require(_0x6700('0x7'));var rs=require('randomstring');var sox=require(_0x6700('0x8'));var tts=require(_0x6700('0x9'));var urlParse=require(_0x6700('0xa'))[_0x6700('0xb')];var util=require('util');var aws=require(_0x6700('0xc'));var google=require(_0x6700('0xd'));var sestek=require(_0x6700('0xe'));var tilde=require(_0x6700('0xf'));var logger=require('../../../config/logger')(_0x6700('0x10'));var ISPEECH_API=_0x6700('0x11');function downloadFile(_0x5cf32e,_0x418d46){return new BPromise(function(_0x58ee02,_0x2fb012){var _0x44bae5=urlParse(_0x5cf32e);var _0x2979f8=_0x44bae5[_0x6700('0x12')]===_0x6700('0x13')?https:http;var _0x3372a1={'host':_0x44bae5['host'],'path':_0x44bae5[_0x6700('0x6')],'headers':{'user-agent':_0x6700('0x14')}};_0x2979f8[_0x6700('0x15')](_0x3372a1,function(_0x5b68c5){if(_0x5b68c5['statusCode']!==0xc8){logger['error'](_0x6700('0x16')+_0x5cf32e+_0x6700('0x17')+_0x5b68c5[_0x6700('0x18')]+'\x20('+_0x5b68c5['statusMessage']+')');_0x2fb012(new Error(_0x6700('0x16')+_0x5cf32e+_0x6700('0x17')+_0x5b68c5[_0x6700('0x18')]+'\x20('+_0x5b68c5[_0x6700('0x19')]+')'));return;}var _0xff7f84=fs[_0x6700('0x1a')](_0x418d46);_0xff7f84['on'](_0x6700('0x1b'),function(){logger[_0x6700('0x1c')](_0x6700('0x1d'));_0xff7f84[_0x6700('0x1e')](_0x58ee02);});_0xff7f84['on'](_0x6700('0x1f'),function(_0x57c6c0){fs[_0x6700('0x20')](_0x418d46);logger[_0x6700('0x1f')](_0x6700('0x21'),_0x57c6c0);_0x2fb012(_0x57c6c0);});_0x5b68c5[_0x6700('0x22')](_0xff7f84);})['on'](_0x6700('0x1f'),function(_0x4fed43){logger[_0x6700('0x1f')](_0x4fed43);_0x2fb012(_0x4fed43);})[_0x6700('0x23')]();});}function uploadFile(_0x47ae75){return new BPromise(function(_0x2b3300,_0x4a451c){var _0x391bce=urlParse(_0x47ae75);var _0x160d9d=_0x391bce[_0x6700('0x12')]==='https:'?https:http;var _0x3c7c26={'host':_0x391bce[_0x6700('0x24')],'path':_0x391bce[_0x6700('0x6')],'headers':{'user-agent':_0x6700('0x14')}};_0x160d9d[_0x6700('0x15')](_0x3c7c26,function(_0x1603d8){if(_0x1603d8[_0x6700('0x18')]!==0xc8){_0x4a451c(new Error(_0x6700('0x16')+_0x47ae75+'\x20failed,\x20status\x20code\x20=\x20'+_0x1603d8[_0x6700('0x18')]+'\x20('+_0x1603d8[_0x6700('0x19')]+')'));return;}var _0x42f094='';_0x1603d8['on']('data',function(_0x1fc39e){_0x42f094+=_0x1fc39e;});_0x1603d8['on']('end',function(){_0x2b3300(_0x42f094);});})['on'](_0x6700('0x1f'),function(_0xd51df0){_0x4a451c(_0xd51df0);})[_0x6700('0x23')]();});}function convertFile(_0x28ef62,_0x3c02bf){return new BPromise(function(_0x2fea05,_0x1e96cb){var _0x538cef=sox[_0x6700('0x25')](_0x28ef62,_0x3c02bf,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x538cef['on'](_0x6700('0x1f'),function(_0x2608d5){logger['error'](_0x6700('0x26'),_0x2608d5);_0x1e96cb(_0x2608d5);});_0x538cef['on'](_0x6700('0x23'),function(){logger[_0x6700('0x1c')]('finish\x20to\x20convert');_0x2fea05();});_0x538cef[_0x6700('0x27')]();});}function base64Decode(_0x2e141a,_0x5c15a9){var _0x3bed52=path[_0x6700('0x28')](__dirname,_0x6700('0x29'),rs['generate'](0x4)+_0x6700('0x2a'));fs['writeFileSync'](_0x3bed52,_0x2e141a,_0x6700('0x2b'));return convertFile(_0x3bed52,_0x5c15a9)[_0x6700('0x2c')](function(){try{fs[_0x6700('0x20')](_0x3bed52);fs[_0x6700('0x2d')](_0x5c15a9,_0x6700('0x2e'));}catch(_0x1a4283){logger[_0x6700('0x1f')](_0x1a4283);}return _0x5c15a9['split']('.')[0x0];});}function base64Encode(_0x4f4859){var _0x3ca745=fs[_0x6700('0x2f')](_0x4f4859);return new Buffer(_0x3ca745)['toString']('base64');}exports[_0x6700('0x30')]=function(_0x45cdd5,_0xffcbe,_0x394091,_0x5b65e9,_0x5770ad,_0x54d33f){var _0x1bf96b,_0x6f9f55;var _0x14398f=_0x6700('0x31');var _0x17c256=_0x6700('0x32')+_0x45cdd5;var _0x4cc5ce={};if(_0xffcbe===_0x6700('0x33')){_0x4cc5ce[_0x6700('0x34')]={'ssml':_0x394091};}else{_0x4cc5ce[_0x6700('0x34')]={'text':_0x394091};};_0x4cc5ce['voice']={'languageCode':_0x5b65e9,'ssmlGender':_0x5770ad};_0x4cc5ce['audioConfig']={'audioEncoding':_0x6700('0x35'),'sampleRateHertz':0x1f40};var _0x92e6ee={'url':_0x14398f+_0x6700('0x36')+_0x17c256,'method':_0x6700('0x37'),'json':!![],'body':_0x4cc5ce};return rp(_0x92e6ee)[_0x6700('0x2c')](function(_0x568410){return new BPromise(function(_0x1d6777,_0x244e6e){_0x1bf96b=path[_0x6700('0x28')](__dirname,_0x6700('0x29'),rs['generate'](0x4)+_0x6700('0x38'));var _0x432566=Buffer[_0x6700('0x39')](_0x568410[_0x6700('0x3a')],_0x6700('0x2b'));return fs[_0x6700('0x3b')](_0x1bf96b,_0x432566,function(_0x400430){_0x244e6e(_0x400430);},function(_0x14827a){fs[_0x6700('0x2d')](_0x1bf96b,_0x6700('0x2e'));_0x1d6777(_0x14827a);});});})[_0x6700('0x2c')](function(_0x4be038){_0x6f9f55=path[_0x6700('0x28')](__dirname,'tmp',rs[_0x6700('0x3c')](0x4)+_0x6700('0x2a'));return convertFile(_0x1bf96b,_0x6f9f55);})['then'](function(){try{fs[_0x6700('0x20')](_0x1bf96b);fs[_0x6700('0x2d')](_0x6f9f55,_0x6700('0x2e'));}catch(_0x3e6b8e){logger[_0x6700('0x1f')](_0x3e6b8e);}logger['info']('googleCloudTTS\x20path',_0x6f9f55[_0x6700('0x3d')]('.')[0x0]);return _0x6f9f55['split']('.')[0x0];});};exports[_0x6700('0x3e')]=function(_0x32b072,_0x15cbd9){var _0x3de875=_0x6700('0x3f');var _0x2a777b,_0x41b56d;var _0x2cf761;var _0x2b9544={'encoding':_0x6700('0x40'),'method':'POST','timeout':0x2710,'url':_0x3de875,'headers':{'Content-Type':_0x6700('0x41')},'body':_0x6700('0x42')+encodeURIComponent(JSON['stringify']([[[_0x6700('0x43'),JSON[_0x6700('0x44')]([_0x32b072,_0x15cbd9||'en',![],_0x6700('0x45')]),null,'generic']]]))};return rp(_0x2b9544)[_0x6700('0x2c')](function(_0x6164ba){try{_0x2cf761=eval(_0x6164ba[_0x6700('0x46')](0x5))[0x0][0x2];}catch(_0x19445f){throw new Error(_0x6700('0x47')+_0x6164ba['data']);}if(!_0x2cf761){if(_0x32b072[_0x6700('0x48')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x6700('0x49')+_0x15cbd9+_0x6700('0x4a'));}}try{_0x2cf761=eval(_0x2cf761)[0x0];}catch(_0x30ec68){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x6700('0x4b')]);}const _0x50acc6=_0x2cf761;_0x2a777b=path[_0x6700('0x28')](__dirname,_0x6700('0x29'),rs['generate'](0x4)+_0x6700('0x38'));fs[_0x6700('0x4c')](_0x2a777b,_0x2cf761,{'encoding':_0x6700('0x2b')});_0x41b56d=path['resolve'](__dirname,_0x6700('0x29'),rs['generate'](0x4)+_0x6700('0x2a'));return convertFile(_0x2a777b,_0x41b56d);})['then'](function(){try{fs[_0x6700('0x20')](_0x2a777b);fs[_0x6700('0x2d')](_0x41b56d,'777');}catch(_0x389261){logger[_0x6700('0x1f')](_0x389261);}logger['info'](_0x6700('0x4d'),_0x41b56d[_0x6700('0x3d')]('.')[0x0]);return _0x41b56d['split']('.')[0x0];});};exports[_0x6700('0x4e')]=function(_0x1b7d18,_0x1c70fb,_0x1d40a6){return google[_0x6700('0x4f')](_0x1b7d18,_0x1c70fb,_0x1d40a6)[_0x6700('0x2c')](function(_0x1ff605){logger[_0x6700('0x1c')](_0x1ff605[_0x6700('0x50')]);return rp(_0x1ff605);})[_0x6700('0x2c')](function(_0x101d92){var _0x588104='';var _0x22b850=0x0;try{fs[_0x6700('0x20')](_0x1b7d18);}catch(_0xa87dcd){logger[_0x6700('0x1f')](_0xa87dcd);}if(_0x101d92&&_0x101d92['results']){_0x588104=_0x101d92[_0x6700('0x51')][_0x6700('0x52')](function(_0x4c7b7a){return _0x4c7b7a&&_0x4c7b7a[_0x6700('0x53')][0x0]&&_0x4c7b7a['alternatives'][0x0][_0x6700('0x54')]?_0x4c7b7a[_0x6700('0x53')][0x0]['transcript']:'';})[_0x6700('0x55')]('\x0a');_0x22b850=_0x101d92[_0x6700('0x51')][_0x6700('0x52')](function(_0xfd0ed4){return _0xfd0ed4&&_0xfd0ed4[_0x6700('0x53')][0x0]&&_0xfd0ed4['alternatives'][0x0][_0x6700('0x56')]?_0xfd0ed4['alternatives'][0x0][_0x6700('0x56')]:0x0;})['join']('\x0a');}logger[_0x6700('0x1c')](_0x6700('0x57'),_0x588104);logger[_0x6700('0x1c')](_0x6700('0x58'),_0x22b850);return{'transcript':_0x588104,'confidence':_0x22b850};})[_0x6700('0x59')](function(_0x290e6d){logger['error'](_0x6700('0x5a'),_0x290e6d[_0x6700('0x18')],_0x290e6d['name'],_0x290e6d['message']);});};exports['googleDialogflow']=function(_0x34fbe0,_0xa375de,_0x411a09,_0x34a1dc){var _0x50bcbc=apiai(_0xa375de,{'language':_0x34a1dc||'en'});return _0x50bcbc[_0x6700('0x5b')](_0x411a09,{'sessionId':md5(_0x34fbe0)})[_0x6700('0x2c')](function(_0x3790a1){logger[_0x6700('0x1c')](JSON[_0x6700('0x44')](_0x3790a1));return{'source':_0x3790a1[_0x6700('0x5c')][_0x6700('0x5d')],'resolvedQuery':_0x3790a1['result'][_0x6700('0x5e')],'action':_0x3790a1[_0x6700('0x5c')][_0x6700('0x5f')],'actionIncomplete':_0x3790a1[_0x6700('0x5c')]['actionIncomplete'],'speech':_0x3790a1[_0x6700('0x5c')][_0x6700('0x60')][_0x6700('0x61')],'score':_0x3790a1['result'][_0x6700('0x62')],'statusCode':_0x3790a1['status'][_0x6700('0x63')],'endConversation':_0x3790a1[_0x6700('0x5c')][_0x6700('0x64')][_0x6700('0x65')]||![],'isFallbackIntent':_0x3790a1[_0x6700('0x5c')][_0x6700('0x64')]['isFallbackIntent']};});};exports[_0x6700('0x66')]=function(_0x368a76,_0x30559b,_0x38c454,_0x50826d,_0x417bfc,_0x746eb7){var _0x5062ed=_0x50826d['replace'](/\\n/g,'\x0a');var _0x3f50a6={'credentials':{'private_key':_0x5062ed,'client_email':_0x38c454}};var _0x477a9e=new dialogflow['SessionsClient'](_0x3f50a6);var _0x162f59=_0x477a9e['sessionPath'](_0x30559b,md5(_0x368a76));var _0x5b4bcb={'session':_0x162f59,'queryInput':{'text':{'text':_0x417bfc,'languageCode':_0x746eb7}}};return _0x477a9e['detectIntent'](_0x5b4bcb)[_0x6700('0x2c')](function(_0x2263d2){if(_0x2263d2&&_0x2263d2[_0x6700('0x48')]){logger[_0x6700('0x1c')](_0x6700('0x67'),JSON['stringify'](_0x2263d2));var _0x416e47=_0x2263d2[0x0];if(_0x416e47){var _0x3d724a={'action':_0x416e47[_0x6700('0x68')][_0x6700('0x5f')],'allRequiredParamsPresent':_0x416e47[_0x6700('0x68')][_0x6700('0x69')],'endConversation':_0x416e47['queryResult'][_0x6700('0x6a')]&&_0x416e47[_0x6700('0x68')]['diagnosticInfo']['fields']?_0x416e47['queryResult'][_0x6700('0x6a')][_0x6700('0x6b')][_0x6700('0x6c')][_0x6700('0x6d')]:![],'fulfillmentText':_0x416e47['queryResult'][_0x6700('0x6e')],'intentName':_0x416e47[_0x6700('0x68')][_0x6700('0x6f')]['name'],'intentDisplayName':_0x416e47[_0x6700('0x68')][_0x6700('0x6f')]['displayName'],'isFallbackIntent':_0x416e47[_0x6700('0x68')][_0x6700('0x6f')]['isFallback'],'languageCode':_0x416e47[_0x6700('0x68')]['languageCode'],'queryText':_0x416e47[_0x6700('0x68')]['queryText'],'responseId':_0x416e47[_0x6700('0x70')],'score':_0x416e47[_0x6700('0x68')]['intentDetectionConfidence'],'speech':_0x416e47[_0x6700('0x68')][_0x6700('0x6e')],'providerResponse':JSON['stringify'](_0x2263d2)};return _0x3d724a;}}});};exports[_0x6700('0x71')]=function(_0x23160d,_0x2b1128,_0x4880d5,_0x5a3160){return tilde[_0x6700('0x4f')](_0x23160d,_0x2b1128,_0x4880d5,_0x5a3160)[_0x6700('0x2c')](function(_0x4b6ec3){try{fs[_0x6700('0x20')](_0x23160d);}catch(_0x4a3550){logger[_0x6700('0x1f')](_0x4a3550);}logger[_0x6700('0x1c')](_0x6700('0x72'),_0x4b6ec3[_0x6700('0x54')]);logger[_0x6700('0x1c')](_0x6700('0x73'),_0x4b6ec3[_0x6700('0x56')]);return _0x4b6ec3;});};exports['awsPolly']=function(_0x390bfa,_0x4fb743,_0x1dcf64,_0x258769,_0x28bcbb,_0x109192){var _0x1e46d7=path[_0x6700('0x28')](__dirname,_0x6700('0x29'),rs[_0x6700('0x3c')](0x4)+'.mp3');var _0x5ce4e0;return aws[_0x6700('0x74')](_0x390bfa,_0x4fb743,_0x1dcf64,_0x258769,_0x28bcbb,_0x109192,_0x1e46d7)[_0x6700('0x2c')](function(){_0x5ce4e0=path[_0x6700('0x28')](__dirname,_0x6700('0x29'),rs[_0x6700('0x3c')](0x4)+_0x6700('0x2a'));return convertFile(_0x1e46d7,_0x5ce4e0);})[_0x6700('0x2c')](function(){try{fs['unlink'](_0x1e46d7);fs[_0x6700('0x2d')](_0x5ce4e0,'777');}catch(_0x5816e4){logger[_0x6700('0x1f')](_0x5816e4);}return _0x5ce4e0['split']('.')[0x0];});};exports['awsLex']=function(_0x22b1b4,_0x363f3d,_0x19cd1b,_0x12e5bc,_0x36ac3b,_0x204e40){return aws[_0x6700('0x75')](_0x22b1b4,_0x363f3d,_0x19cd1b,_0x12e5bc,_0x36ac3b,_0x204e40)['then'](function(_0x5b3d59){logger[_0x6700('0x1c')](JSON[_0x6700('0x44')](_0x5b3d59));return _0x5b3d59;});};exports[_0x6700('0x76')]=function(_0x7737be,_0x16dbc4,_0x2ac102,_0x5af778){var _0x13ea6c=util[_0x6700('0x77')](_0x6700('0x78'),ISPEECH_API,_0x7737be,encodeURIComponent(_0x16dbc4),_0x2ac102,_0x5af778);var _0x1bdb7d=path[_0x6700('0x28')](__dirname,_0x6700('0x29'),rs['generate'](0x4)+'.mp3');var _0x2b7652;return downloadFile(_0x13ea6c,_0x1bdb7d)[_0x6700('0x2c')](function(){_0x2b7652=path['resolve'](__dirname,_0x6700('0x29'),rs['generate'](0x4)+_0x6700('0x2a'));return convertFile(_0x1bdb7d,_0x2b7652);})[_0x6700('0x2c')](function(){try{fs[_0x6700('0x20')](_0x1bdb7d);fs[_0x6700('0x2d')](_0x2b7652,_0x6700('0x2e'));}catch(_0x5a0cfd){logger[_0x6700('0x1f')](_0x5a0cfd);}return _0x2b7652['split']('.')[0x0];});};exports['ispeechASR']=function(_0x3ad691,_0x17face,_0x34965e,_0x2188ef){var _0x12ba90=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x17face,_0x34965e,base64Encode(_0x3ad691),_0x2188ef?util[_0x6700('0x77')](_0x6700('0x79'),encodeURIComponent(_0x2188ef)):_0x6700('0x7a'));return uploadFile(_0x12ba90)[_0x6700('0x2c')](function(_0x49d3c5){return querystring[_0x6700('0xb')](_0x49d3c5);});};exports[_0x6700('0x7b')]=function(_0x19f6f0,_0x5939c1){return sestek[_0x6700('0x7c')](_0x19f6f0,_0x5939c1)[_0x6700('0x2c')](function(_0x26c4ea){logger[_0x6700('0x1c')](JSON[_0x6700('0x44')](_0x26c4ea));var _0x29a239={'speech':_0x26c4ea[_0x6700('0x7d')],'action':_0x26c4ea['channelData']?_0x26c4ea[_0x6700('0x7e')][_0x6700('0x7f')]:undefined,'actiondata':_0x26c4ea[_0x6700('0x7e')]?_0x26c4ea[_0x6700('0x7e')][_0x6700('0x80')]:undefined};if(_0x26c4ea[_0x6700('0x7e')]&&_0x26c4ea[_0x6700('0x7e')][_0x6700('0x81')]){return base64Decode(_0x26c4ea[_0x6700('0x7e')][_0x6700('0x81')][_0x6700('0x82')],path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x6700('0x2a')))[_0x6700('0x2c')](function(_0x306570){_0x29a239[_0x6700('0x83')]=_0x306570;return _0x29a239;});}return _0x29a239;});};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 a57e770..e9bdc23 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 _0xdf01=['exports','./nda'];(function(_0x5ba3c4,_0x3dcb83){var _0x3a4dd6=function(_0x2b9680){while(--_0x2b9680){_0x5ba3c4['push'](_0x5ba3c4['shift']());}};_0x3a4dd6(++_0x3dcb83);}(_0xdf01,0x11b));var _0x1df0=function(_0x177e06,_0x2ddcb3){_0x177e06=_0x177e06-0x0;var _0x3f8c42=_0xdf01[_0x177e06];return _0x3f8c42;};var nda=require(_0x1df0('0x0'));module[_0x1df0('0x1')]={'nda':nda}; \ No newline at end of file +var _0xa5b2=['./nda','exports'];(function(_0x1fed59,_0x30e496){var _0x531185=function(_0x205972){while(--_0x205972){_0x1fed59['push'](_0x1fed59['shift']());}};_0x531185(++_0x30e496);}(_0xa5b2,0x140));var _0x2a5b=function(_0x244862,_0x3da79e){_0x244862=_0x244862-0x0;var _0x2bce23=_0xa5b2[_0x244862];return _0x2bce23;};var nda=require(_0x2a5b('0x0'));module[_0x2a5b('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 fb13e21..5f35055 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 _0x76dc=['calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','POST','/token','password','username','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','callerid'];(function(_0x2b6f15,_0x167918){var _0x566260=function(_0x50e7d3){while(--_0x50e7d3){_0x2b6f15['push'](_0x2b6f15['shift']());}};_0x566260(++_0x167918);}(_0x76dc,0x1f2));var _0xc76d=function(_0x5e018a,_0x42479f){_0x5e018a=_0x5e018a-0x0;var _0x4e09f2=_0x76dc[_0x5e018a];return _0x4e09f2;};'use strict';var rp=require(_0xc76d('0x0'));var url=require(_0xc76d('0x1'));var logger=require(_0xc76d('0x2'))(_0xc76d('0x3'));module['exports']=function(_0x2a8b7d,_0x1ba6a1){var _0x5cff74={'method':_0xc76d('0x4'),'uri':url['resolve'](_0x1ba6a1['ndauth_url'],_0xc76d('0x5')),'form':{'grant_type':_0xc76d('0x6'),'username':_0x1ba6a1[_0xc76d('0x7')],'password':_0x1ba6a1['password']},'json':!![]};return rp(_0x5cff74)['then'](function(_0x119f38){var _0x114572={'method':_0xc76d('0x4'),'uri':url['resolve'](_0x1ba6a1['ndassistant_url'],_0xc76d('0x8')),'body':{'type':_0x1ba6a1[_0xc76d('0x9')]||'message','channelId':_0xc76d('0xa'),'conversation':{'id':_0x2a8b7d['uniqueid']},'from':{'id':_0x2a8b7d[_0xc76d('0xb')],'name':_0x2a8b7d[_0xc76d('0xc')]},'recipient':{'id':_0x2a8b7d[_0xc76d('0xd')],'name':_0x2a8b7d[_0xc76d('0xe')]},'text':_0x1ba6a1[_0xc76d('0xf')],'channelData':{}},'headers':{'Authorization':_0xc76d('0x10')+_0x119f38[_0xc76d('0x11')]},'json':!![]};if(_0x1ba6a1[_0xc76d('0x12')]){_0x114572[_0xc76d('0x13')][_0xc76d('0x14')][_0xc76d('0x15')]=_0x1ba6a1[_0xc76d('0x12')];}if(_0x1ba6a1[_0xc76d('0x16')]=='1'){_0x114572[_0xc76d('0x13')]['channelData'][_0xc76d('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xc76d('0x18')};}if(_0x1ba6a1['custom_action']){_0x114572[_0xc76d('0x13')][_0xc76d('0x14')][_0xc76d('0x19')]=_0x1ba6a1[_0xc76d('0x1a')];if(_0x1ba6a1['custom_action_data']){_0x114572[_0xc76d('0x13')]['channelData']['CustomActionData']=_0x1ba6a1[_0xc76d('0x1b')];}}logger[_0xc76d('0x1c')](JSON[_0xc76d('0x1d')](_0x114572));return rp(_0x114572);});}; \ No newline at end of file +var _0xa74d=['AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','access_token','project','body','ProjectName','ndagenerate_audio','channelData'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xa74d,0x1cf));var _0xda74=function(_0x4a1022,_0x4435a6){_0x4a1022=_0x4a1022-0x0;var _0x562d12=_0xa74d[_0x4a1022];return _0x562d12;};'use strict';var rp=require('request-promise');var url=require(_0xda74('0x0'));var logger=require(_0xda74('0x1'))(_0xda74('0x2'));module[_0xda74('0x3')]=function(_0x34754d,_0xe99b70){var _0x4e3fa4={'method':_0xda74('0x4'),'uri':url[_0xda74('0x5')](_0xe99b70[_0xda74('0x6')],_0xda74('0x7')),'form':{'grant_type':_0xda74('0x8'),'username':_0xe99b70[_0xda74('0x9')],'password':_0xe99b70[_0xda74('0x8')]},'json':!![]};return rp(_0x4e3fa4)[_0xda74('0xa')](function(_0x5da443){var _0x23d5f5={'method':'POST','uri':url['resolve'](_0xe99b70[_0xda74('0xb')],_0xda74('0xc')),'body':{'type':_0xe99b70['ndaactivity_type']||_0xda74('0xd'),'channelId':_0xda74('0xe'),'conversation':{'id':_0x34754d[_0xda74('0xf')]},'from':{'id':_0x34754d[_0xda74('0x10')],'name':_0x34754d[_0xda74('0x11')]},'recipient':{'id':_0x34754d[_0xda74('0x12')],'name':_0x34754d[_0xda74('0x13')]},'text':_0xe99b70[_0xda74('0x14')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x5da443[_0xda74('0x15')]},'json':!![]};if(_0xe99b70[_0xda74('0x16')]){_0x23d5f5[_0xda74('0x17')]['channelData'][_0xda74('0x18')]=_0xe99b70[_0xda74('0x16')];}if(_0xe99b70[_0xda74('0x19')]=='1'){_0x23d5f5[_0xda74('0x17')][_0xda74('0x1a')][_0xda74('0x1b')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xda74('0x1c')};}if(_0xe99b70['custom_action']){_0x23d5f5[_0xda74('0x17')][_0xda74('0x1a')][_0xda74('0x1d')]=_0xe99b70[_0xda74('0x1e')];if(_0xe99b70[_0xda74('0x1f')]){_0x23d5f5['body'][_0xda74('0x1a')][_0xda74('0x20')]=_0xe99b70[_0xda74('0x1f')];}}logger[_0xda74('0x21')](JSON[_0xda74('0x22')](_0x23d5f5));return rp(_0x23d5f5);});}; \ 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 dc84ff8..d8be152 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 _0x4968=['exports','./lib/api'];(function(_0x35f087,_0x92b91c){var _0x3fa3a7=function(_0x509672){while(--_0x509672){_0x35f087['push'](_0x35f087['shift']());}};_0x3fa3a7(++_0x92b91c);}(_0x4968,0xab));var _0x8496=function(_0x4e403e,_0x21fc31){_0x4e403e=_0x4e403e-0x0;var _0x4c86d0=_0x4968[_0x4e403e];return _0x4c86d0;};'use strict';var asr=require(_0x8496('0x0'));module[_0x8496('0x1')]=function(_0x3ef54d,_0x4f126a,_0x59c39e,_0x51bcc2){return asr(_0x3ef54d,_0x4f126a,_0x59c39e,_0x51bcc2);}; \ No newline at end of file +var _0x0fc9=['exports','./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0fc9,0x13f));var _0x90fc=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0fc9[_0x1facfa];return _0x9ec701;};'use strict';var asr=require(_0x90fc('0x0'));module[_0x90fc('0x1')]=function(_0x4c7c90,_0x4a825b,_0x1684b3,_0x11d57d){return asr(_0x4c7c90,_0x4a825b,_0x1684b3,_0x11d57d);}; \ 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 2a2040a..6f9911a 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 _0x3dec=['likelihood','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','lodash','moment','crypto','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','update','hex','unix','send','close','EOS','error','stringify','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript'];(function(_0x512c5d,_0x1cf1e3){var _0x857c9a=function(_0x57275c){while(--_0x57275c){_0x512c5d['push'](_0x512c5d['shift']());}};_0x857c9a(++_0x1cf1e3);}(_0x3dec,0xdd));var _0xc3de=function(_0x1577d5,_0x459e81){_0x1577d5=_0x1577d5-0x0;var _0x45c557=_0x3dec[_0x1577d5];return _0x45c557;};'use strict';var BPromise=require(_0xc3de('0x0'));var _=require(_0xc3de('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xc3de('0x2'));var crypto=require(_0xc3de('0x3'));var logger=require('../../../../../../config/logger')(_0xc3de('0x4'));module[_0xc3de('0x5')]=function(_0x146467,_0x284c02,_0x31132d,_0x5706fd){return new BPromise(function(_0x5ee9ba,_0x21620c){logger[_0xc3de('0x6')]('Tilde\x20URI',_0x5706fd||_0xc3de('0x7'));var _0x3c2017=new WebSocket(_0x5706fd||_0xc3de('0x7'),{'perMessageDeflate':![]});var _0x4fe5d9='';var _0x420d80='0';var _0x10c7ea='1';var _0x5ea31b='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x29b601(_0x506372){var _0x226f2e=crypto['createHash']('sha1');_0x226f2e[_0xc3de('0x8')](_0x506372);return _0x226f2e['digest'](_0xc3de('0x9'));}function _0x2c6e92(){try{logger[_0xc3de('0x6')]('Open\x20Tilde\x20ASR\x20socket');var _0xced301=moment()[_0xc3de('0xa')]();var _0x24c771=_0x29b601(_0xced301+_0x284c02+_0x31132d);_0x3c2017[_0xc3de('0xb')](JSON['stringify']({'appID':_0x284c02,'timestamp':_0xced301,'appKey':_0x24c771}));var _0x5413e3=fs['createReadStream'](_0x146467);_0x5413e3['on']('data',function(_0x1c281b){_0x3c2017[_0xc3de('0xb')](_0x1c281b);});_0x5413e3['on'](_0xc3de('0xc'),function(){_0x3c2017[_0xc3de('0xb')](_0xc3de('0xd'));});}catch(_0x902148){logger[_0xc3de('0xe')]('Tilde\x20ASR\x20send\x20error',JSON[_0xc3de('0xf')](_0x902148));_0x3c2017[_0xc3de('0x10')]();}}function _0xe9a157(_0x3cc1a8){try{if(_0x3cc1a8){var _0x13d094=JSON[_0xc3de('0x11')](_0x3cc1a8);switch(_0x13d094[_0xc3de('0x12')]){case 0x0:if(_0x13d094[_0xc3de('0x13')]){if(_0x13d094[_0xc3de('0x13')][_0xc3de('0x14')]){logger[_0xc3de('0x6')](_0xc3de('0x15'),JSON[_0xc3de('0xf')](_0x13d094[_0xc3de('0x13')][_0xc3de('0x16')]));_0x4fe5d9=_0x13d094['result'][_0xc3de('0x16')][0x0][_0xc3de('0x17')];_0x420d80=_0x13d094[_0xc3de('0x13')][_0xc3de('0x16')][0x0][_0xc3de('0x18')];_0x10c7ea='0';_0x5ea31b='Success.';_0x3c2017[_0xc3de('0x10')]();}}break;case 0x1:logger[_0xc3de('0x6')](_0xc3de('0x19'));_0x10c7ea='1';_0x5ea31b=_0xc3de('0x19');break;case 0x2:logger[_0xc3de('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x10c7ea='2';_0x5ea31b=_0xc3de('0x1a');break;case 0x9:logger['info'](_0xc3de('0x1b'));_0x10c7ea='9';_0x5ea31b=_0xc3de('0x1b');break;case 0xa:logger[_0xc3de('0x6')](_0xc3de('0x1c'));_0x10c7ea='10';_0x5ea31b=_0xc3de('0x1c');break;case 0xb:logger[_0xc3de('0x6')](_0xc3de('0x1d'));_0x10c7ea='11';_0x5ea31b=_0xc3de('0x1d');}}}catch(_0x58cb1a){logger[_0xc3de('0xe')](_0xc3de('0x1e'),JSON[_0xc3de('0xf')](_0x58cb1a));_0x3c2017[_0xc3de('0x10')]();}}function _0x1d0a42(){logger[_0xc3de('0x6')](_0xc3de('0x1f'));_0x5ee9ba({'transcript':_0x4fe5d9,'confidence':_0x420d80,'status':_0x10c7ea,'status_message':_0x5ea31b});}function _0x2357c7(_0x31b5da){logger[_0xc3de('0xe')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x31b5da)){logger[_0xc3de('0xe')](_[_0xc3de('0x20')](_0x31b5da)?JSON[_0xc3de('0xf')](_0x31b5da):_0x31b5da);}}_0x3c2017['on'](_0xc3de('0x21'),_0x2c6e92);_0x3c2017['on'](_0xc3de('0x22'),_0xe9a157);_0x3c2017['on'](_0xc3de('0xc'),_0x1d0a42);_0x3c2017['on'](_0xc3de('0xe'),_0x2357c7);});}; \ No newline at end of file +var _0x7252=['terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','lodash','moment','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','digest','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error'];(function(_0x3e261c,_0x10887b){var _0x5df635=function(_0x130c93){while(--_0x130c93){_0x3e261c['push'](_0x3e261c['shift']());}};_0x5df635(++_0x10887b);}(_0x7252,0x1b7));var _0x2725=function(_0x3f9c14,_0x4649d1){_0x3f9c14=_0x3f9c14-0x0;var _0x2d0851=_0x7252[_0x3f9c14];return _0x2d0851;};'use strict';var BPromise=require(_0x2725('0x0'));var _=require(_0x2725('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x2725('0x2'));var crypto=require(_0x2725('0x3'));var logger=require(_0x2725('0x4'))(_0x2725('0x5'));module[_0x2725('0x6')]=function(_0x37a9b1,_0x100d24,_0x558cf7,_0x5c2103){return new BPromise(function(_0xf91570,_0x220a97){logger[_0x2725('0x7')](_0x2725('0x8'),_0x5c2103||_0x2725('0x9'));var _0x33a5ce=new WebSocket(_0x5c2103||_0x2725('0x9'),{'perMessageDeflate':![]});var _0x316738='';var _0x5ceb1c='0';var _0x53f7eb='1';var _0x14ead6=_0x2725('0xa');function _0x3155a2(_0x2cfecb){var _0x415c79=crypto[_0x2725('0xb')](_0x2725('0xc'));_0x415c79['update'](_0x2cfecb);return _0x415c79[_0x2725('0xd')](_0x2725('0xe'));}function _0x403a29(){try{logger[_0x2725('0x7')](_0x2725('0xf'));var _0x12a2be=moment()['unix']();var _0x2b7dfc=_0x3155a2(_0x12a2be+_0x100d24+_0x558cf7);_0x33a5ce[_0x2725('0x10')](JSON[_0x2725('0x11')]({'appID':_0x100d24,'timestamp':_0x12a2be,'appKey':_0x2b7dfc}));var _0x240e0b=fs[_0x2725('0x12')](_0x37a9b1);_0x240e0b['on'](_0x2725('0x13'),function(_0x5cb834){_0x33a5ce[_0x2725('0x10')](_0x5cb834);});_0x240e0b['on'](_0x2725('0x14'),function(){_0x33a5ce[_0x2725('0x10')]('EOS');});}catch(_0x473dcf){logger[_0x2725('0x15')](_0x2725('0x16'),JSON[_0x2725('0x11')](_0x473dcf));_0x33a5ce[_0x2725('0x17')]();}}function _0x415ac9(_0x22b1f6){try{if(_0x22b1f6){var _0x59de58=JSON[_0x2725('0x18')](_0x22b1f6);switch(_0x59de58['status']){case 0x0:if(_0x59de58[_0x2725('0x19')]){if(_0x59de58[_0x2725('0x19')][_0x2725('0x1a')]){logger[_0x2725('0x7')](_0x2725('0x1b'),JSON['stringify'](_0x59de58['result'][_0x2725('0x1c')]));_0x316738=_0x59de58[_0x2725('0x19')][_0x2725('0x1c')][0x0][_0x2725('0x1d')];_0x5ceb1c=_0x59de58['result']['hypotheses'][0x0][_0x2725('0x1e')];_0x53f7eb='0';_0x14ead6=_0x2725('0x1f');_0x33a5ce[_0x2725('0x17')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x53f7eb='1';_0x14ead6=_0x2725('0xa');break;case 0x2:logger[_0x2725('0x7')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x53f7eb='2';_0x14ead6=_0x2725('0x20');break;case 0x9:logger[_0x2725('0x7')](_0x2725('0x21'));_0x53f7eb='9';_0x14ead6=_0x2725('0x21');break;case 0xa:logger[_0x2725('0x7')]('Authentication\x20failed.');_0x53f7eb='10';_0x14ead6=_0x2725('0x22');break;case 0xb:logger[_0x2725('0x7')](_0x2725('0x23'));_0x53f7eb='11';_0x14ead6=_0x2725('0x23');}}}catch(_0x401435){logger[_0x2725('0x15')](_0x2725('0x24'),JSON['stringify'](_0x401435));_0x33a5ce[_0x2725('0x17')]();}}function _0x552782(){logger[_0x2725('0x7')](_0x2725('0x25'));_0xf91570({'transcript':_0x316738,'confidence':_0x5ceb1c,'status':_0x53f7eb,'status_message':_0x14ead6});}function _0x5199ab(_0x12de4b){logger[_0x2725('0x15')](_0x2725('0x26'));if(!_[_0x2725('0x27')](_0x12de4b)){logger[_0x2725('0x15')](_[_0x2725('0x28')](_0x12de4b)?JSON[_0x2725('0x11')](_0x12de4b):_0x12de4b);}}_0x33a5ce['on']('open',_0x403a29);_0x33a5ce['on'](_0x2725('0x29'),_0x415ac9);_0x33a5ce['on'](_0x2725('0x14'),_0x552782);_0x33a5ce['on'](_0x2725('0x15'),_0x5199ab);});}; \ 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 b025797..c62eb48 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 _0xb1b7=['exports','./asr'];(function(_0x42596b,_0x305360){var _0x4a68ea=function(_0x32967e){while(--_0x32967e){_0x42596b['push'](_0x42596b['shift']());}};_0x4a68ea(++_0x305360);}(_0xb1b7,0x67));var _0x7b1b=function(_0x572bcd,_0x1cdc96){_0x572bcd=_0x572bcd-0x0;var _0x33e0ac=_0xb1b7[_0x572bcd];return _0x33e0ac;};var asr=require(_0x7b1b('0x0'));module[_0x7b1b('0x1')]={'asr':asr}; \ No newline at end of file +var _0x1f05=['./asr','exports'];(function(_0x180060,_0x39ebda){var _0x3c1ef8=function(_0x47f759){while(--_0x47f759){_0x180060['push'](_0x180060['shift']());}};_0x3c1ef8(++_0x39ebda);}(_0x1f05,0x108));var _0x51f0=function(_0x1318e3,_0x205d55){_0x1318e3=_0x1318e3-0x0;var _0x4e2bd0=_0x1f05[_0x1318e3];return _0x4e2bd0;};var asr=require(_0x51f0('0x0'));module[_0x51f0('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 95df00d..980147e 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(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'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(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'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 8b349c6..dc66b0e 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 _0xa664=['Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','tildeASR','uri','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','recursiveNodeIndex','split','replaceAll','getAndSetVariable','result','extra','maxRetry','retry','mrcpsynth','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','noop','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','list_id','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','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','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','dialogflowV2_language','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','variable_id','getData','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','appid','appsecret','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','extension','no\x20condition\x20configured','condition','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','Enter\x20in\x20MATH\x20(%s)\x20block','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','pause_id','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','toLowerCase','macro','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','escape_digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','number','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','subject','template_id','sendMail\x20message','sendMailMessage','smtpOptions','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','lodash','shelljs','odbc','randomstring','mustache','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','mailRpc','getIntervals','getIntervalById','Intervals','interval','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','priority','accountcode','file','createSquareMessage','uniqueid','createCmContact','isEmpty','callback_','lastName','phone','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agent','isNil','agentUnpause','agentLogout','internal','format','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','MALE','audioEncoding','googleTTS','restAPI','method','timeout','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','url','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region'];(function(_0x3a1132,_0x5368b9){var _0x3cffcf=function(_0x497cae){while(--_0x497cae){_0x3a1132['push'](_0x3a1132['shift']());}};_0x3cffcf(++_0x5368b9);}(_0xa664,0x132));var _0x4a66=function(_0x4e6ef4,_0x31ffac){_0x4e6ef4=_0x4e6ef4-0x0;var _0x186348=_0xa664[_0x4e6ef4];return _0x186348;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x4a66('0x0'));var sh=require(_0x4a66('0x1'));var odbc=require(_0x4a66('0x2'))();var rs=require(_0x4a66('0x3'));var moment=require('moment');var Mustache=require(_0x4a66('0x4'));var rp=require('request-promise');var logger=require('../../config/logger')(_0x4a66('0x5'));var config=require(_0x4a66('0x6'));var shared=require(_0x4a66('0x7'));var scripts=require(_0x4a66('0x8'));var FILES_PATH=_0x4a66('0x9');var recursiveMapAttributes=[_0x4a66('0xa'),_0x4a66('0xb')];var verticesWithRetry=['menu',_0x4a66('0xc'),_0x4a66('0xd')];var AGIVertices=function(_0x20376e,_0x14a150,_0x4a3c4c){this[_0x4a66('0xe')]=_0x20376e;this[_0x4a66('0xf')]=_0x14a150;this['mailRpc']=_0x4a3c4c;};AGIVertices[_0x4a66('0x10')][_0x4a66('0x11')]=function(_0x42a9fc,_0x75fd00){this[_0x4a66('0xf')][_0x4a66('0x12')](_0x42a9fc)[_0x4a66('0x13')](function(_0x3f662e){_0x75fd00(null,_0x3f662e?_0x3f662e[_0x4a66('0x14')]:![]);})[_0x4a66('0x15')](function(_0x177bf1){_0x75fd00(_0x177bf1);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x16')]=function(_0x56e4cc,_0x409921){this[_0x4a66('0xf')][_0x4a66('0x17')](_0x56e4cc)['then'](function(_0x2f2d93){_0x409921(null,_0x2f2d93?_0x2f2d93[_0x4a66('0x14')]:![]);})[_0x4a66('0x15')](function(_0x4208f9){_0x409921(_0x4208f9);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x18')]=function(_0xceefbd,_0x20954d){this['rpc'][_0x4a66('0x19')](_0xceefbd)[_0x4a66('0x13')](function(_0x3e8805){_0x20954d(null,_0x3e8805?_0x3e8805[_0x4a66('0x14')]:![]);})['catch'](function(_0x18a4f8){_0x20954d(_0x18a4f8);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x1a')]=function(_0x569ebd,_0x4e8e62){this[_0x4a66('0xf')][_0x4a66('0x1b')](_0x569ebd)[_0x4a66('0x13')](function(_0x4c78e1){_0x4e8e62(null,_0x4c78e1?_0x4c78e1['dsn']:![]);})[_0x4a66('0x15')](function(_0x566fc8){_0x4e8e62(_0x566fc8);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x1c')]=function(_0x18ec8e,_0x3d649d){this[_0x4a66('0xf')][_0x4a66('0x1d')](_0x18ec8e)[_0x4a66('0x13')](function(_0x2c0a0d){_0x3d649d(null,_0x2c0a0d?_0x2c0a0d[_0x4a66('0x14')]:![]);})[_0x4a66('0x15')](function(_0xad793e){_0x3d649d(_0xad793e);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x1e')]=function(_0xfacfbe,_0x2cd979){this['rpc'][_0x4a66('0x1f')](_0xfacfbe)[_0x4a66('0x13')](function(_0x54c1c5){_0x2cd979(null,_0x54c1c5?_0x54c1c5[_0x4a66('0x14')]:![]);})[_0x4a66('0x15')](function(_0x47184e){_0x2cd979(_0x47184e);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x20')]=function(_0x5298a8,_0x532fd3){var _0x38328d=this;this[_0x4a66('0xf')][_0x4a66('0x21')](_0x5298a8)[_0x4a66('0x13')](function(_0xa81e68){_0x532fd3(null,_0xa81e68?_0x38328d[_0x4a66('0x22')](_0xa81e68[_0x4a66('0x23')]):![]);})[_0x4a66('0x15')](function(_0x2bc150){_0x532fd3(_0x2bc150);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x24')]=function(_0x2274c9,_0x5cc0cf){this['rpc'][_0x4a66('0x25')](_0x2274c9)['then'](function(_0x234d47){_0x5cc0cf(null,_0x234d47?_0x234d47:![]);})[_0x4a66('0x15')](function(_0x4544da){_0x5cc0cf(_0x4544da);});};AGIVertices[_0x4a66('0x10')]['sendMailMessage']=function(_0x1fc788,_0xe56dc,_0x33e098){this[_0x4a66('0x26')]['sendMailMessage'](_0x1fc788,_0xe56dc)['then'](function(){_0x33e098(null);})[_0x4a66('0x15')](function(_0x24b7a7){_0x33e098(_0x24b7a7);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x27')]=function(_0x35216b,_0x458d24){this[_0x4a66('0xf')][_0x4a66('0x28')](_0x35216b)[_0x4a66('0x13')](function(_0x1a8fbd){if(_0x1a8fbd){if(_0x1a8fbd['IntervalId']){_0x458d24(null,[_0x1a8fbd['interval']]);}else{_0x458d24(null,_['map'](_0x1a8fbd[_0x4a66('0x29')],_0x4a66('0x2a')));}}else{_0x458d24(null,![]);}})[_0x4a66('0x15')](function(_0x33d37e){_0x458d24(_0x33d37e);});};AGIVertices[_0x4a66('0x10')]['getSoundPath']=function(_0x21b5cc){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x21b5cc);};AGIVertices[_0x4a66('0x10')][_0x4a66('0x2b')]=function(_0x1e1568,_0x3f9add,_0x5146c3){odbc[_0x4a66('0x2c')](_0x1e1568,function(_0x57ed4e){if(_0x57ed4e){logger[_0x4a66('0x2d')](_0x4a66('0x2e'),_0x57ed4e);_0x5146c3(_0x57ed4e);}else{logger[_0x4a66('0x2f')](_0x4a66('0x30'));odbc[_0x4a66('0x31')](_0x3f9add,function(_0x46f96b,_0x447af4){if(_0x46f96b){logger[_0x4a66('0x2f')](_0x4a66('0x32'),_0x3f9add);_0x5146c3(_0x46f96b);}else{logger[_0x4a66('0x2f')](_0x4a66('0x33'),_0x3f9add);odbc[_0x4a66('0x34')](function(_0x20d2cd){if(_0x20d2cd){logger[_0x4a66('0x2d')](_0x4a66('0x35'),_0x20d2cd);}_0x5146c3(null,_0x447af4);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x1effa9,_0x106de8){this[_0x4a66('0xf')][_0x4a66('0x36')](_0x1effa9)[_0x4a66('0x13')](function(_0x4027ab){_0x106de8(null,_0x4027ab?_0x4027ab:![]);})[_0x4a66('0x15')](function(_0x2fe95c){_0x106de8(_0x2fe95c);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x37')]=function(_0x9178f6,_0xf0e82d){this[_0x4a66('0xf')][_0x4a66('0x37')](_0x9178f6)[_0x4a66('0x13')](function(_0x524d19){_0xf0e82d(null,_0x524d19);})[_0x4a66('0x15')](function(_0x236db9){_0xf0e82d(_0x236db9);});};AGIVertices['prototype'][_0x4a66('0x38')]=function(_0x1ecd9e,_0x37a2ed,_0x5cc69d){this[_0x4a66('0xf')][_0x4a66('0x38')]({'uniqueid':this[_0x4a66('0xe')]['uniqueid'],'node':_0x1ecd9e[_0x4a66('0x39')],'application':_0x1ecd9e[_0x4a66('0x3a')],'data':_0x37a2ed||null,'project_name':this['channel'][_0x4a66('0x3b')],'callerid':this['channel'][_0x4a66('0x3c')]})['then'](function(_0x19af47){if(_0x5cc69d){_0x5cc69d(null,_0x19af47);}})[_0x4a66('0x15')](function(_0x2689d5){if(_0x5cc69d){_0x5cc69d(_0x2689d5);}});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x3d')]=function(_0x5cb7e6,_0x57fe1c,_0x23884e,_0x3b03fd){this[_0x4a66('0xf')][_0x4a66('0x3d')]({'uniqueid':this[_0x4a66('0xe')]['uniqueid'],'callerid':this['channel'][_0x4a66('0x3c')],'calleridname':this[_0x4a66('0xe')][_0x4a66('0x3e')],'context':this['channel'][_0x4a66('0x3f')],'extension':this['channel']['extension'],'priority':this[_0x4a66('0xe')][_0x4a66('0x40')],'accountcode':this['channel'][_0x4a66('0x41')],'dnid':this[_0x4a66('0xe')]['dnid'],'projectName':this[_0x4a66('0xe')][_0x4a66('0x3b')],'saveName':_0x57fe1c,'filename':_0x5cb7e6[_0x4a66('0x42')]||_0x57fe1c,'savePath':_0x23884e})[_0x4a66('0x13')](function(_0x46b9e7){_0x3b03fd(null,_0x46b9e7);})['catch'](function(_0x2a72dc){_0x3b03fd(_0x2a72dc);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x43')]=function(_0x2c1a40,_0xb573bf,_0x2adcaf,_0x29d823,_0x3636b8){this[_0x4a66('0xf')][_0x4a66('0x43')]({'uniqueid':this[_0x4a66('0xe')][_0x4a66('0x44')],'body':_0x2c1a40,'direction':_0xb573bf,'providerName':_0x2adcaf,'providerResponse':_0x29d823})[_0x4a66('0x13')](function(_0x591c10){if(_0x3636b8){_0x3636b8(null,_0x591c10);}})['catch'](function(_0x1a7abe){if(_0x3636b8){_0x3636b8(_0x1a7abe);}});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x45')]=function(_0x35cd3,_0x1a8251){this[_0x4a66('0xf')]['createCmContact']({'firstName':_[_0x4a66('0x46')](_0x35cd3[_0x4a66('0x14')])||_['isNil'](_0x35cd3[_0x4a66('0x14')])?_0x4a66('0x47')+Math['random']():_0x35cd3[_0x4a66('0x14')],'lastName':_['isEmpty'](_0x35cd3[_0x4a66('0x48')])||_['isNil'](_0x35cd3['lastName'])?null:_0x35cd3[_0x4a66('0x48')],'phone':_0x35cd3[_0x4a66('0x49')],'ListId':_0x35cd3['list_id'],'scheduledat':_0x35cd3['scheduledAt'],'callbackUniqueid':this[_0x4a66('0xe')][_0x4a66('0x44')],'tags':'callback','description':_0x4a66('0x4a')+_0x35cd3[_0x4a66('0x4b')][_0x4a66('0x4c')](),'priority':_0x35cd3[_0x4a66('0x4d')]})[_0x4a66('0x13')](function(_0x149b13){_0x1a8251(null,_0x149b13);})['catch'](function(_0x197fde){_0x1a8251(_0x197fde);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x4e')]=function(_0x40c3e7,_0x82ebe0){this['rpc'][_0x4a66('0x4f')](_0x40c3e7)[_0x4a66('0x13')](function(_0x1df8a0){_0x82ebe0(null,_0x1df8a0?_0x1df8a0[_0x4a66('0x14')]:![]);})['catch'](function(_0x25f273){_0x82ebe0(_0x25f273);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x50')]=function(_0x12ec1e,_0x5bdeae,_0x1e5430){var _0x284ac6={'role':_0x4a66('0x51')};_0x284ac6[_0x12ec1e]=this[_0x4a66('0xe')][_0x4a66('0x3c')];this[_0x4a66('0xf')][_0x4a66('0x50')](_0x284ac6,_0x5bdeae,this[_0x4a66('0xe')]['uniqueid'])[_0x4a66('0x13')](function(_0x2e2c7f){_0x1e5430(null,_[_0x4a66('0x52')](_0x2e2c7f)?![]:!![]);})[_0x4a66('0x15')](function(_0x409a90){logger[_0x4a66('0x2d')](_0x409a90);_0x1e5430(null,![]);});};AGIVertices['prototype'][_0x4a66('0x53')]=function(_0x9ce558,_0x5c363b){var _0x5ad839={'role':'agent'};_0x5ad839[_0x9ce558]=this[_0x4a66('0xe')][_0x4a66('0x3c')];this[_0x4a66('0xf')][_0x4a66('0x53')](_0x5ad839)[_0x4a66('0x13')](function(_0x5dd372){_0x5c363b(null,_[_0x4a66('0x52')](_0x5dd372)?![]:!![]);})[_0x4a66('0x15')](function(_0x4bc9db){logger[_0x4a66('0x2d')](_0x4bc9db);_0x5c363b(null,![]);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x54')]=function(_0x87a543,_0x463c15){var _0x577554={'role':_0x4a66('0x51')};_0x577554[_0x87a543]=this[_0x4a66('0xe')][_0x4a66('0x3c')];this[_0x4a66('0xf')]['agentLogout'](_0x577554)['then'](function(_0x1068ed){_0x463c15(null,_[_0x4a66('0x52')](_0x1068ed)?![]:!![]);})[_0x4a66('0x15')](function(_0x54496b){logger[_0x4a66('0x2d')](_0x54496b);_0x463c15(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x1d7f9,_0x39eadb){var _0x306a64={'role':_0x4a66('0x51')};_0x306a64[_0x1d7f9]=this['channel'][_0x4a66('0x3c')];var _0x35de1c=_0x1d7f9!=_0x4a66('0x55')?util[_0x4a66('0x56')](_0x4a66('0x57'),_0x4a66('0x58'),this[_0x4a66('0xe')][_0x4a66('0x3c')]):undefined;this[_0x4a66('0xf')][_0x4a66('0x59')](_0x306a64,_0x35de1c)[_0x4a66('0x13')](function(_0x11b1fd){_0x39eadb(null,_[_0x4a66('0x52')](_0x11b1fd)?![]:!![]);})[_0x4a66('0x15')](function(_0x204778){logger[_0x4a66('0x2d')](_0x204778);_0x39eadb(null,![]);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x5a')]=function(_0x28947b,_0x576445){sh[_0x4a66('0x5b')](_[_0x4a66('0x5c')](_0x28947b),function(_0x50b5dc,_0xdfbfb7){var _0x2462f0=_0xdfbfb7[_0x4a66('0x5d')](/(\r\n|\n|\r)/gm,'');_0x576445(null,_0x2462f0);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x5e')]=function(_0x435203,_0x520840){scripts[_0x4a66('0x5e')](_0x435203[_0x4a66('0x5f')],_0x435203[_0x4a66('0x60')]||_0x4a66('0x61'),_0x435203['text'],_0x435203[_0x4a66('0x62')]||'en-US',_0x435203['ssmlGender']||_0x4a66('0x63'),_0x435203[_0x4a66('0x64')]||'MP3')[_0x4a66('0x13')](function(_0x3eb24d){_0x520840(null,_0x3eb24d);})['catch'](function(_0x853fad){_0x520840(_0x853fad);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x65')]=function(_0x4796f9,_0x517aa0){scripts[_0x4a66('0x65')](_0x4796f9[_0x4a66('0x61')],_0x4796f9['google_tts_language']||'en',0x1)['then'](function(_0xbafaec){_0x517aa0(null,_0xbafaec);})[_0x4a66('0x15')](function(_0x13e896){_0x517aa0(_0x13e896);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x66')]=function(_0x2c1a26,_0xacceca){var _0x43baaa={'uri':_0x2c1a26['url'],'method':_0x2c1a26[_0x4a66('0x67')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2c1a26[_0x4a66('0x68')])==='number'&&parseInt(_0x2c1a26['timeout'])>=0x1?parseInt(_0x2c1a26['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x4a66('0x69')]([_0x4a66('0x6a'),_0x4a66('0x6b')],_0x43baaa[_0x4a66('0x67')][_0x4a66('0x6c')]())){try{_0x43baaa[_0x4a66('0x6d')]=_0x2c1a26[_0x4a66('0xb')]?JSON[_0x4a66('0x6e')](_0x2c1a26[_0x4a66('0xb')]):{};}catch(_0x234f20){logger['error'](_0x4a66('0x6f'),_0x234f20);}}try{_0x43baaa[_0x4a66('0x70')]=_0x2c1a26['rawHeaders']?JSON['parse'](_0x2c1a26['rawHeaders']):{};}catch(_0x4e2569){logger[_0x4a66('0x2d')](_0x4a66('0x71'),_0x4e2569);}if(_0x2c1a26['computedVariables']){try{var _0x47407a=require(_0x2c1a26['computedVariables'])[_0x4a66('0x72')](this,_0x43baaa);_0x43baaa['uri']=Mustache['render'](_0x2c1a26[_0x4a66('0x73')],_0x47407a,{},['$$','$$']);if(_0x43baaa['headers']){_0x43baaa[_0x4a66('0x70')]=JSON['parse'](Mustache[_0x4a66('0x74')](JSON[_0x4a66('0x75')](_0x43baaa['headers']),_0x47407a,{},['$$','$$']));}if(_0x43baaa[_0x4a66('0x6d')]){_0x43baaa['body']=JSON['parse'](Mustache[_0x4a66('0x74')](JSON[_0x4a66('0x75')](_0x43baaa[_0x4a66('0x6d')]),_0x47407a,{},['$$','$$']));}}catch(_0x5b1564){logger[_0x4a66('0x2d')](_0x4a66('0x76'),_0x5b1564);}}rp(_0x43baaa)[_0x4a66('0x13')](function(_0x31ad73){var _0x4837db={'statusCode':_0x31ad73['statusCode']||0xc8,'statusMessage':_0x31ad73[_0x4a66('0x77')]||'OK','headers':_0x31ad73[_0x4a66('0x70')]||{},'body':_0x31ad73['body']||{}};_0xacceca(null,_0x4837db);})[_0x4a66('0x15')](function(_0x3fa892){var _0x41d47a={'statusCode':_0x3fa892[_0x4a66('0x78')]||0x1f4,'statusMessage':_0x3fa892[_0x4a66('0x79')]||_0x4a66('0x7a'),'headers':_0x3fa892[_0x4a66('0x7b')][_0x4a66('0x70')]||{},'body':_0x3fa892[_0x4a66('0x7b')][_0x4a66('0x6d')]||{}};_0xacceca(null,_0x41d47a);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x7c')]=function(_0x59abfe,_0x3409ea){scripts[_0x4a66('0x7c')](this['channel'][_0x4a66('0x44')],_0x59abfe[_0x4a66('0x7d')],_0x59abfe[_0x4a66('0x61')],_0x59abfe[_0x4a66('0x7e')]||'en')[_0x4a66('0x13')](function(_0x51f232){_0x3409ea(null,_0x51f232);})[_0x4a66('0x15')](function(_0x6a7a8c){_0x3409ea(_0x6a7a8c);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x7f')]=function(_0x22c0d6,_0x2459e7){scripts[_0x4a66('0x7f')](this['channel'][_0x4a66('0x44')],_0x22c0d6['dialogflowV2_project_id'],_0x22c0d6[_0x4a66('0x80')],_0x22c0d6[_0x4a66('0x81')],_0x22c0d6[_0x4a66('0x61')],_0x22c0d6['dialogflowV2_language']||'en')[_0x4a66('0x13')](function(_0x19ad97){_0x2459e7(null,_0x19ad97);})['catch'](function(_0x1a132b){_0x2459e7(_0x1a132b);});};AGIVertices[_0x4a66('0x10')]['sestekNDA']=function(_0x14cd8c,_0x17ac1f){scripts[_0x4a66('0x82')](this[_0x4a66('0xe')],_0x14cd8c)['then'](function(_0x5e1a4a){_0x17ac1f(null,_0x5e1a4a);})[_0x4a66('0x15')](function(_0x597303){_0x17ac1f(_0x597303);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x83')]=function(_0x3dc8d8,_0x385648){scripts[_0x4a66('0x83')](_0x3dc8d8[_0x4a66('0x7d')],_0x3dc8d8[_0x4a66('0x61')],_0x3dc8d8[_0x4a66('0x84')]||_0x4a66('0x85'),_0x3dc8d8[_0x4a66('0x86')])['then'](function(_0x2c5774){_0x385648(null,_0x2c5774);})['catch'](function(_0x581365){_0x385648(_0x581365);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x87')]=function(_0x238ab3,_0x41106b,_0x1bcb49){scripts[_0x4a66('0x87')](_0x41106b,_0x238ab3[_0x4a66('0x7d')],_0x238ab3[_0x4a66('0x88')]||_0x4a66('0x85'),this[_0x4a66('0x89')](_0x238ab3['model'])?_0x238ab3[_0x4a66('0x8a')]:undefined)['then'](function(_0x1b43af){_0x1bcb49(null,_0x1b43af);})[_0x4a66('0x15')](function(_0x161609){_0x1bcb49(_0x161609);});};AGIVertices[_0x4a66('0x10')]['awsPolly']=function(_0x407371,_0x3a98b5){scripts[_0x4a66('0x8b')](_0x407371[_0x4a66('0x8c')],_0x407371['aws_secret_access_key'],_0x407371[_0x4a66('0x8d')],_0x407371['aws_polly_voice']||_0x4a66('0x8e'),_0x407371['text'],_0x407371[_0x4a66('0x8f')]||_0x4a66('0x61'))[_0x4a66('0x13')](function(_0x2a484c){_0x3a98b5(null,_0x2a484c);})['catch'](function(_0x4119a4){_0x3a98b5(_0x4119a4);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x90')]=function(_0x103ff6,_0x406cfc){scripts[_0x4a66('0x90')](this[_0x4a66('0xe')][_0x4a66('0x44')],_0x103ff6[_0x4a66('0x8c')],_0x103ff6[_0x4a66('0x91')],_0x103ff6[_0x4a66('0x92')],_0x103ff6[_0x4a66('0x61')],_0x103ff6[_0x4a66('0x93')])[_0x4a66('0x13')](function(_0xb370fb){_0x406cfc(null,_0xb370fb);})[_0x4a66('0x15')](function(_0x3b42a8){_0x406cfc(_0x3b42a8);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x94')]=function(_0x274cd6,_0x7e818f,_0x2124ab){scripts[_0x4a66('0x94')](_0x7e818f,_0x274cd6[_0x4a66('0x7d')],_0x274cd6['google_asr_language']||_0x4a66('0x85'))[_0x4a66('0x13')](function(_0x5cdc79){_0x2124ab(null,_0x5cdc79);})['catch'](function(_0xdede39){_0x2124ab(_0xdede39);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x95')]=function(_0x79e861,_0x15b402,_0x1be58e){scripts[_0x4a66('0x95')](_0x15b402,_0x79e861['appid'],_0x79e861['appsecret'],_0x79e861[_0x4a66('0x96')])[_0x4a66('0x13')](function(_0x4cb372){_0x1be58e(null,_0x4cb372);})[_0x4a66('0x15')](function(_0xc92821){_0x1be58e(_0xc92821);});};AGIVertices[_0x4a66('0x10')][_0x4a66('0x97')]=function(_0x3d6d47){var _0x46767a=_['includes'](verticesWithRetry,_0x3d6d47['agicommand'])?_0x3d6d47:_[_0x4a66('0x98')](_0x3d6d47);for(var _0x570664 in _0x46767a){if(_0x46767a[_0x4a66('0x99')](_0x570664)){if(_0x46767a[_0x570664]&&_[_0x4a66('0x9a')](_0x46767a[_0x570664])){if(_[_0x4a66('0x69')](recursiveMapAttributes,_0x570664)){_0x46767a[_0x570664]=this[_0x4a66('0x9b')](_0x46767a[_0x570664]);}else{_0x46767a[_0x570664]=this[_0x4a66('0x9c')](_0x46767a[_0x570664]);}}}}return _0x46767a;};AGIVertices[_0x4a66('0x10')]['recursiveNodeIndex']=function(_0x1c3f3b){for(var _0x182ceb in _0x1c3f3b){if(_0x1c3f3b['hasOwnProperty'](_0x182ceb)){if(_[_0x4a66('0x9d')](_0x1c3f3b[_0x182ceb])){this['recursiveNodeIndex'](_0x1c3f3b[_0x182ceb]);}else if(_[_0x4a66('0x9e')](_0x1c3f3b[_0x182ceb])){for(var _0xf32a60=0x0;_0xf32a60<_0x1c3f3b[_0x182ceb][_0x4a66('0x9f')];_0xf32a60++){this['recursiveNodeIndex'](_0x1c3f3b[_0x182ceb][_0xf32a60]);}}else if(_[_0x4a66('0x9a')](_0x1c3f3b[_0x182ceb])){_0x1c3f3b[_0x182ceb]=this[_0x4a66('0x9c')](_0x1c3f3b[_0x182ceb]);}}}};AGIVertices[_0x4a66('0x10')][_0x4a66('0xa0')]=function(_0x1864df,_0x5ef1f2){for(var _0x2e5668 in _0x1864df){if(_0x1864df[_0x4a66('0x99')](_0x2e5668)){if(_[_0x4a66('0x9d')](_0x1864df[_0x2e5668])){if(!_[_0x4a66('0x46')](_0x1864df[_0x2e5668])){this['saveRestApiResult'](_0x1864df[_0x2e5668],util[_0x4a66('0x56')](_0x4a66('0xa1'),_0x5ef1f2,_0x2e5668));}}else if(_[_0x4a66('0x9e')](_0x1864df[_0x2e5668])){for(var _0x2db0b2=0x0;_0x2db0b2<_0x1864df[_0x2e5668]['length'];_0x2db0b2++){this[_0x4a66('0xa0')](_0x1864df[_0x2e5668][_0x2db0b2],util[_0x4a66('0x56')](_0x4a66('0xa1'),_0x5ef1f2,_0x2e5668+'['+_0x2db0b2+']'));}}else{if(!_[_0x4a66('0x52')](_0x1864df[_0x2e5668])){this[_0x4a66('0xe')][_0x4a66('0xa2')](util[_0x4a66('0x56')](_0x4a66('0xa1'),_0x5ef1f2,_0x2e5668),_0x1864df[_0x2e5668]);}}}}};AGIVertices['prototype'][_0x4a66('0x9b')]=function(_0x4ed3f5){try{var _0x4ad984=JSON['parse'](_0x4ed3f5);this[_0x4a66('0xa3')](_0x4ad984);return JSON['stringify'](_0x4ad984);}catch(_0x3f8d6c){return this[_0x4a66('0x9c')](_0x4ed3f5);}};AGIVertices[_0x4a66('0x10')][_0x4a66('0x9c')]=function(_0x6afbd2){var _0x34c5dd=_0x6afbd2[_0x4a66('0xa4')]('{');for(var _0x1715cf=0x1;_0x1715cf<_0x34c5dd[_0x4a66('0x9f')];_0x1715cf+=0x1){var _0x2d8555=_0x34c5dd[_0x1715cf][_0x4a66('0xa4')]('}');if(_0x2d8555[_0x4a66('0x9f')]>0x1){_0x6afbd2=_0x6afbd2[_0x4a66('0xa5')]('{'+_0x2d8555[0x0]+'}',this[_0x4a66('0xe')][_0x4a66('0x11')](_0x2d8555[0x0])['extra']||_0x2d8555[0x0]);}}if(_0x34c5dd[_0x4a66('0x9f')]===0x1){return _0x6afbd2[_0x4a66('0x4c')]();}return this[_0x4a66('0x9c')](_0x6afbd2);};AGIVertices['prototype'][_0x4a66('0xa6')]=function(_0x266f2f,_0x2a83f0){var _0x4fd9f5=this[_0x4a66('0xe')][_0x4a66('0x11')](_0x266f2f);if(_0x4fd9f5[_0x4a66('0xa7')]===-0x1){return _0x4fd9f5;}logger[_0x4a66('0x2f')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x2a83f0,_0x4fd9f5[_0x4a66('0xa8')]));return this[_0x4a66('0xe')][_0x4a66('0xa2')](_0x2a83f0,_0x4fd9f5[_0x4a66('0xa8')]);};AGIVertices[_0x4a66('0x10')][_0x4a66('0x89')]=function(_0x2eb1b6){return _0x2eb1b6&&_0x2eb1b6!=='0'&&_0x2eb1b6!=='-1'&&_0x2eb1b6!=='';};AGIVertices['prototype'][_0x4a66('0xa9')]=function(_0x1f3b9d){this['createSquareDetailsReport']['sync'](this,_0x1f3b9d,'-');_0x1f3b9d[_0x4a66('0xaa')]=_0x1f3b9d[_0x4a66('0xa9')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x4a66('0x10')][_0x4a66('0xab')]=function(_0x1e615d){logger['info'](util[_0x4a66('0x56')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x1e615d[_0x4a66('0x39')]));if(!this[_0x4a66('0x89')](_0x1e615d[_0x4a66('0x61')])){return this[_0x4a66('0xe')]['noop'](_0x4a66('0xac'));}var _0x2cdc42='\x22'+_0x1e615d[_0x4a66('0x61')]+'\x22';if(this[_0x4a66('0x89')](_0x1e615d[_0x4a66('0x7b')])){_0x2cdc42+=','+_0x1e615d['options'];}var _0x20200a=this[_0x4a66('0xe')][_0x4a66('0x5b')](_0x4a66('0xad'),_0x2cdc42);if(_0x20200a['result']===-0x1){return _0x20200a;}return this[_0x4a66('0xe')]['noop'](util[_0x4a66('0x56')](_0x4a66('0xae'),_0x2cdc42));};AGIVertices[_0x4a66('0x10')]['mrcprecog']=function(_0x65c376){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0xaf'),_0x65c376[_0x4a66('0x39')]));if(!this['isConfigured'](_0x65c376['grammar'])){return this['channel'][_0x4a66('0xb0')](_0x4a66('0xb1'));}var _0x310bcf=_0x65c376[_0x4a66('0xb2')];if(this[_0x4a66('0x89')](_0x65c376[_0x4a66('0x7b')])){_0x310bcf+=','+_0x65c376['options'];}var _0xfcd4e1=this['channel'][_0x4a66('0x5b')](_0x4a66('0xb3'),_0x310bcf);if(_0xfcd4e1[_0x4a66('0xa7')]===-0x1){return _0xfcd4e1;}var _0x59237f=this[_0x4a66('0xa6')](_0x4a66('0xb4'),'MRCP_RECOG_CONFIDENCE');if(_0x59237f[_0x4a66('0xa7')]===-0x1){return _0x59237f;}var _0x2dddd8=this[_0x4a66('0xa6')](_0x4a66('0xb5'),_0x4a66('0xb6'));if(_0x2dddd8['result']===-0x1){return _0x2dddd8;}var _0x24c74f=this[_0x4a66('0xa6')](_0x4a66('0xb7'),'MRCP_RECOG_INSTANCE');if(_0x24c74f[_0x4a66('0xa7')]===-0x1){return _0x24c74f;}return this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0xb8'),_0x310bcf));};AGIVertices[_0x4a66('0x10')]['agi']=function(_0x20ae92){logger['info'](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x20ae92[_0x4a66('0x39')]));return this[_0x4a66('0xe')][_0x4a66('0x5')]([_0x20ae92[_0x4a66('0xb9')],_0x20ae92[_0x4a66('0xba')]]);};AGIVertices[_0x4a66('0x10')][_0x4a66('0xbb')]=function(_0x10e507){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x10e507[_0x4a66('0x39')]));if(this[_0x4a66('0x89')](_0x10e507[_0x4a66('0x68')])){logger[_0x4a66('0x2f')](util['format'](_0x4a66('0xbc'),_0x10e507[_0x4a66('0x68')]));var _0x4189a4=this[_0x4a66('0xe')][_0x4a66('0xbd')](_0x10e507[_0x4a66('0x68')]);if(_0x4189a4['result']===-0x1){return _0x4189a4;}}return this['channel'][_0x4a66('0xbb')]();};AGIVertices[_0x4a66('0x10')][_0x4a66('0xbe')]=function(_0x469b2f){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0xbf'),_0x469b2f[_0x4a66('0x39')]));if(!this[_0x4a66('0x89')](_0x469b2f['list_id'])){return this['channel'][_0x4a66('0x2d')](_0x469b2f,_0x4a66('0xc0'));}_0x469b2f[_0x4a66('0x4b')]=moment();if(this[_0x4a66('0x89')](_0x469b2f[_0x4a66('0xc1')])){_0x469b2f[_0x4a66('0x4b')]=moment()[_0x4a66('0xc2')](_0x469b2f['delay'],_0x4a66('0xc3'));}if(!this[_0x4a66('0x89')](_0x469b2f[_0x4a66('0x4d')])){_0x469b2f['callback_priority']=0x2;}this['createCmContact'][_0x4a66('0x72')](this,_0x469b2f);return this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0xc4'),_0x469b2f[_0x4a66('0x49')],_0x469b2f[_0x4a66('0xc5')],_0x469b2f[_0x4a66('0x4b')]));};AGIVertices[_0x4a66('0x10')][_0x4a66('0xc6')]=function(_0x532870){logger[_0x4a66('0x2f')](util['format'](_0x4a66('0xc7'),_0x532870[_0x4a66('0x39')]));var _0x5af92d=this['channel'][_0x4a66('0x5b')](_0x532870[_0x4a66('0xc8')],_0x532870[_0x4a66('0x7b')]);if(_0x5af92d[_0x4a66('0xa7')]===-0x1){return _0x5af92d;}return this[_0x4a66('0xe')][_0x4a66('0xb0')](util['format'](_0x4a66('0xc9'),_0x532870[_0x4a66('0xc8')],_0x532870[_0x4a66('0x7b')]));};AGIVertices[_0x4a66('0x10')][_0x4a66('0xca')]=function(_0x557769){logger['info'](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x557769['label']));if(!this[_0x4a66('0x89')](_0x557769[_0x4a66('0x61')])){return this[_0x4a66('0xe')]['noop'](_0x4a66('0xac'));}var _0x2df51d='\x22'+_0x557769[_0x4a66('0x61')]+'\x22';if(this['isConfigured'](_0x557769['options'])){_0x2df51d+=','+_0x557769[_0x4a66('0x7b')];}var _0x1ca5fe=this[_0x4a66('0xe')]['exec'](_0x4a66('0xad'),_0x2df51d);if(_0x1ca5fe[_0x4a66('0xa7')]===-0x1){return _0x1ca5fe;}return this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0xae'),_0x2df51d));};AGIVertices[_0x4a66('0x10')][_0x4a66('0xcb')]=function(_0x22f9b3){logger['info'](util[_0x4a66('0x56')](_0x4a66('0xcc'),_0x22f9b3[_0x4a66('0x39')]));if(!this[_0x4a66('0x89')](_0x22f9b3[_0x4a66('0x61')])){return this[_0x4a66('0xe')][_0x4a66('0xb0')](_0x4a66('0xac'));}var _0x10cea2='\x22'+_0x22f9b3['text']+'\x22';if(this['isConfigured'](_0x22f9b3[_0x4a66('0x7b')])){_0x10cea2+=','+_0x22f9b3[_0x4a66('0x7b')];}var _0x2bfa40=this[_0x4a66('0xe')][_0x4a66('0x5b')](_0x4a66('0xad'),_0x10cea2);if(_0x2bfa40[_0x4a66('0xa7')]===-0x1){return _0x2bfa40;}return this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0xae'),_0x10cea2));};AGIVertices['prototype']['lumenvoxasr']=function(_0x3aae60){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0xcd'),_0x3aae60[_0x4a66('0x39')]));if(!this['isConfigured'](_0x3aae60[_0x4a66('0xb2')])){return this[_0x4a66('0xe')][_0x4a66('0xb0')]('no\x20grammar\x20configured');}var _0x1f61a5=_0x3aae60[_0x4a66('0xb2')];if(this[_0x4a66('0x89')](_0x3aae60[_0x4a66('0x7b')])){_0x1f61a5+=','+_0x3aae60[_0x4a66('0x7b')];}var _0x4e48db=this[_0x4a66('0xe')][_0x4a66('0x5b')](_0x4a66('0xb3'),_0x1f61a5);if(_0x4e48db[_0x4a66('0xa7')]===-0x1){return _0x4e48db;}var _0x27b853=this[_0x4a66('0xa6')](_0x4a66('0xb4'),_0x4a66('0xce'));if(_0x27b853[_0x4a66('0xa7')]===-0x1){return _0x27b853;}var _0x150b62=this['getAndSetVariable'](_0x4a66('0xb5'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x150b62['result']===-0x1){return _0x150b62;}var _0x6f7880=this['getAndSetVariable']('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x6f7880[_0x4a66('0xa7')]===-0x1){return _0x6f7880;}return this['channel']['noop'](util[_0x4a66('0x56')](_0x4a66('0xb8'),_0x1f61a5));};AGIVertices[_0x4a66('0x10')][_0x4a66('0xcf')]=function(_0x525d4a){logger['info'](util[_0x4a66('0x56')](_0x4a66('0xd0'),_0x525d4a[_0x4a66('0x39')]));if(!this[_0x4a66('0x89')](_0x525d4a[_0x4a66('0xb2')])){return this[_0x4a66('0xe')][_0x4a66('0xb0')](_0x4a66('0xb1'));}var _0x2deb86=_0x525d4a[_0x4a66('0xb2')];if(this['isConfigured'](_0x525d4a[_0x4a66('0x7b')])){_0x2deb86+=','+_0x525d4a[_0x4a66('0x7b')];}var _0x58994e=this[_0x4a66('0xe')]['exec']('MRCPRecog',_0x2deb86);if(_0x58994e[_0x4a66('0xa7')]===-0x1){return _0x58994e;}var _0x41828c=this[_0x4a66('0xa6')](_0x4a66('0xb4'),_0x4a66('0xd1'));if(_0x41828c['result']===-0x1){return _0x41828c;}var _0x1df5b1=this[_0x4a66('0xa6')](_0x4a66('0xb5'),_0x4a66('0xd2'));if(_0x1df5b1[_0x4a66('0xa7')]===-0x1){return _0x1df5b1;}var _0x1c7df9=this[_0x4a66('0xa6')]('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x1c7df9[_0x4a66('0xa7')]===-0x1){return _0x1c7df9;}return this['channel'][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0xb8'),_0x2deb86));};AGIVertices[_0x4a66('0x10')][_0x4a66('0xd3')]=function(_0x711fd3){logger[_0x4a66('0x2f')](util['format'](_0x4a66('0xd4'),_0x711fd3[_0x4a66('0x39')]));if(!this[_0x4a66('0x89')](_0x711fd3[_0x4a66('0xd5')])){return this['channel'][_0x4a66('0x2d')](_0x711fd3,'no\x20database\x20selected');}var _0x2b0859=this[_0x4a66('0x1a')][_0x4a66('0x72')](this,_0x711fd3[_0x4a66('0xd5')]);if(!_0x2b0859){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x711fd3,'no\x20odbc\x20database\x20found');}if(!this[_0x4a66('0x89')](_0x711fd3['query'])){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x711fd3,'no\x20query\x20configured');}var _0x11d0ae=_0x711fd3[_0x4a66('0x31')][_0x4a66('0x5d')](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util['format']('query:\x20%s',_0x11d0ae));var _0x2f8089=this[_0x4a66('0x2b')]['sync'](this,_0x2b0859,_0x11d0ae);this[_0x4a66('0x38')][_0x4a66('0x72')](this,_0x711fd3,_0x11d0ae);if(!this[_0x4a66('0x89')](_0x711fd3['variable_id'])){return this[_0x4a66('0xe')][_0x4a66('0xb0')](_0x4a66('0xd6'));}var _0x153689=this[_0x4a66('0x11')][_0x4a66('0x72')](this,_0x711fd3['variable_id']);if(!_0x153689){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x711fd3,_0x4a66('0xd7'));}var _0x4b81a0=this;_0x2f8089[_0x4a66('0xd8')](function(_0x150c07,_0x547921){Object[_0x4a66('0xd9')](_0x150c07)[_0x4a66('0xd8')](function(_0x355a9c){_0x4b81a0[_0x4a66('0xe')][_0x4a66('0xa2')](util[_0x4a66('0x56')](_0x4a66('0xda'),_0x153689,_0x547921,_0x355a9c),_0x150c07[_0x355a9c]);});});this['channel'][_0x4a66('0xa2')](util[_0x4a66('0x56')](_0x4a66('0xdb'),_0x153689),_0x2f8089[_0x4a66('0x9f')]);return this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')]('variable\x20%s\x20set',_0x153689));};AGIVertices[_0x4a66('0x10')]['dial']=function(_0x2f9ed6){logger[_0x4a66('0xdc')](util[_0x4a66('0x56')](_0x4a66('0xdd'),_0x2f9ed6[_0x4a66('0x39')]));if(!this[_0x4a66('0x89')](_0x2f9ed6[_0x4a66('0xde')])){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x2f9ed6,_0x4a66('0xdf'));}var _0x136d63=this[_0x4a66('0x1c')][_0x4a66('0x72')](this,_0x2f9ed6[_0x4a66('0xde')]);if(!_0x136d63){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x2f9ed6,'no\x20user\x20found');}var _0x4d0bfe=this[_0x4a66('0xe')][_0x4a66('0x5b')](_0x4a66('0xe0'),[util[_0x4a66('0x56')](_0x4a66('0xe1'),_0x136d63),_0x2f9ed6[_0x4a66('0x68')],_0x2f9ed6[_0x4a66('0xe2')],_0x2f9ed6[_0x4a66('0x73')]]);if(_0x4d0bfe[_0x4a66('0xa7')]===-0x1){return _0x4d0bfe;}return this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0xe3'),_0x4a66('0xe0')));};AGIVertices[_0x4a66('0x10')][_0x4a66('0xe4')]=function(_0x49077e){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0xe5'),_0x49077e[_0x4a66('0x39')]));if(!this[_0x4a66('0x89')](_0x49077e[_0x4a66('0x7d')])){return this['channel'][_0x4a66('0xb0')](_0x4a66('0xe6'));}if(!this[_0x4a66('0x89')](_0x49077e[_0x4a66('0x61')])){return this['channel'][_0x4a66('0xb0')]('no\x20text\x20configured');}this[_0x4a66('0xe')][_0x4a66('0xe7')]=!![];this[_0x4a66('0x38')](_0x49077e);this[_0x4a66('0x43')](_0x49077e[_0x4a66('0x61')],'in','','');this[_0x4a66('0xe')][_0x4a66('0xb0')](util['format'](_0x4a66('0xe8'),_0x49077e['text']));var _0xe1ea04=this[_0x4a66('0x7c')][_0x4a66('0x72')](this,_0x49077e);if(_0xe1ea04){for(var _0x272319 in _0xe1ea04){if(_0xe1ea04[_0x4a66('0x99')](_0x272319)){this[_0x4a66('0xe')]['setVariable'](util[_0x4a66('0x56')](_0x4a66('0xe9'),_0x272319[_0x4a66('0x6c')]()),_0xe1ea04[_0x272319]);}}this[_0x4a66('0x43')](_0xe1ea04[_0x4a66('0xea')],_0x4a66('0xeb'),_0x4a66('0xe4'),'');return this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0xec'),_0xe1ea04['speech']));}return this[_0x4a66('0xe')]['error'](_0x49077e,_0x4a66('0xed'));};AGIVertices[_0x4a66('0x10')][_0x4a66('0xee')]=function(_0x2fb974){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0xef'),_0x2fb974[_0x4a66('0x39')]));if(!this[_0x4a66('0x89')](_0x2fb974[_0x4a66('0xf0')])){return this['channel']['noop'](_0x4a66('0xf1'));}if(!this[_0x4a66('0x89')](_0x2fb974[_0x4a66('0x80')])){return this[_0x4a66('0xe')][_0x4a66('0xb0')](_0x4a66('0xf2'));}if(!this[_0x4a66('0x89')](_0x2fb974[_0x4a66('0x81')])){return this['channel'][_0x4a66('0xb0')]('no\x20private_key\x20configured');}if(!this[_0x4a66('0x89')](_0x2fb974[_0x4a66('0xf3')])){return this[_0x4a66('0xe')][_0x4a66('0xb0')]('no\x20anguage\x20configured');}if(!this[_0x4a66('0x89')](_0x2fb974[_0x4a66('0x61')])){return this[_0x4a66('0xe')][_0x4a66('0xb0')](_0x4a66('0xac'));}this[_0x4a66('0xe')][_0x4a66('0xe7')]=!![];this[_0x4a66('0x38')](_0x2fb974);this['createSquareMessage'](_0x2fb974[_0x4a66('0x61')],'in','','');this['channel'][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0xf4'),_0x2fb974['text']));var _0x1ab95d=this[_0x4a66('0x7f')]['sync'](this,_0x2fb974);if(_0x1ab95d){for(var _0x477005 in _0x1ab95d){if(_0x1ab95d[_0x4a66('0x99')](_0x477005)){if(_0x477005!==_0x4a66('0xf5')){this[_0x4a66('0xe')][_0x4a66('0xa2')](util[_0x4a66('0x56')](_0x4a66('0xe9'),_0x477005[_0x4a66('0x6c')]()),_0x1ab95d[_0x477005]);}}}this[_0x4a66('0x43')](_0x1ab95d[_0x4a66('0xea')],_0x4a66('0xeb'),'dialogflowV2',_0x1ab95d[_0x4a66('0xf5')]);return this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0xf6'),_0x1ab95d[_0x4a66('0xea')]));}return this['channel'][_0x4a66('0x2d')](_0x2fb974,_0x4a66('0xf7'));};AGIVertices[_0x4a66('0x10')][_0x4a66('0xf8')]=function(_0x1bc361){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x1bc361['label']));if(!this[_0x4a66('0x89')](_0x1bc361[_0x4a66('0xf9')])){return this[_0x4a66('0xe')][_0x4a66('0xb0')](_0x4a66('0xfa'));}if(!this[_0x4a66('0x89')](_0x1bc361['username'])){return this[_0x4a66('0xe')][_0x4a66('0xb0')](_0x4a66('0xfb'));}if(!this[_0x4a66('0x89')](_0x1bc361['password'])){return this['channel'][_0x4a66('0xb0')](_0x4a66('0xfc'));}if(!this[_0x4a66('0x89')](_0x1bc361[_0x4a66('0xfd')])){return this[_0x4a66('0xe')][_0x4a66('0xb0')]('no\x20text\x20configured');}this[_0x4a66('0xe')][_0x4a66('0xe7')]=!![];this[_0x4a66('0x38')](_0x1bc361);this[_0x4a66('0x43')](_0x1bc361[_0x4a66('0x61')],'in','','');this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0xfe'),_0x1bc361[_0x4a66('0x61')]));var _0x3ded17=this[_0x4a66('0x82')]['sync'](this,_0x1bc361);if(_0x3ded17){for(var _0x21896c in _0x3ded17){if(_0x3ded17[_0x4a66('0x99')](_0x21896c)){this[_0x4a66('0xe')][_0x4a66('0xa2')](util[_0x4a66('0x56')](_0x4a66('0xff'),_0x21896c[_0x4a66('0x6c')]()),_0x3ded17[_0x21896c]);}}this[_0x4a66('0x43')](_0x3ded17[_0x4a66('0xea')],_0x4a66('0xeb'),'sesteknda','');if(_0x3ded17[_0x4a66('0x100')]){this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0x101'),_0x3ded17[_0x4a66('0x100')]));var _0x17d9f8=this[_0x4a66('0xe')]['streamFile'](_0x3ded17[_0x4a66('0x100')]);try{fs[_0x4a66('0x102')](_0x3ded17[_0x4a66('0x100')]+'.wav');}catch(_0x6ac36d){logger[_0x4a66('0x2d')](_0x6ac36d);}return _0x17d9f8;}else{return this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0x103'),_0x3ded17[_0x4a66('0xea')]));}}return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x1bc361,_0x4a66('0x104'));};AGIVertices[_0x4a66('0x10')][_0x4a66('0x105')]=function(_0x5eea04){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')]('Enter\x20in\x20END\x20(%s)\x20block',_0x5eea04[_0x4a66('0x39')]));return this[_0x4a66('0xe')][_0x4a66('0xb0')]('end');};AGIVertices[_0x4a66('0x10')]['ext_dial']=function(_0x197f06){logger[_0x4a66('0x2f')](util['format'](_0x4a66('0x106'),_0x197f06[_0x4a66('0x39')]));var _0x1937e9='';if(_0x197f06['trunk_id']){if(!this[_0x4a66('0x89')](_0x197f06[_0x4a66('0x107')])){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x197f06,_0x4a66('0x108'));}else{var _0x459a2b=parseInt(_0x197f06[_0x4a66('0x107')],0xa);if(isNaN(_0x459a2b)){_0x1937e9=_0x197f06[_0x4a66('0x107')];}else{_0x1937e9=this[_0x4a66('0x1e')][_0x4a66('0x72')](this,_0x197f06[_0x4a66('0x107')]);if(!_0x1937e9){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x197f06,'no\x20trunk\x20found');}}}}else if(_0x197f06['trunk_name']){_0x1937e9=_0x197f06[_0x4a66('0x109')];}else{return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x197f06,_0x4a66('0x108'));}var _0x174a26=this[_0x4a66('0xe')][_0x4a66('0x5b')]('DIAL',[util['format'](_0x4a66('0x10a'),_0x1937e9,_0x197f06[_0x4a66('0x49')]),_0x197f06['timeout'],_0x197f06[_0x4a66('0xe2')],_0x197f06[_0x4a66('0x73')]]);if(_0x174a26[_0x4a66('0xa7')]===-0x1){return _0x174a26;}return this[_0x4a66('0xe')]['noop'](util['format'](_0x4a66('0xe3'),'DIAL'));};AGIVertices[_0x4a66('0x10')][_0x4a66('0x10b')]=function(_0x4ab2f4){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x4ab2f4[_0x4a66('0x39')]));return this['channel'][_0x4a66('0xb0')](_0x4a66('0x10b'));};AGIVertices['prototype']['getdigits']=function(_0x5d63de){logger[_0x4a66('0x2f')](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x5d63de[_0x4a66('0x39')]));if(_0x5d63de['retry']===0x0){return this[_0x4a66('0xa9')](_0x5d63de);}_0x5d63de[_0x4a66('0xaa')]-=0x1;if(!this[_0x4a66('0x89')](_0x5d63de[_0x4a66('0x10c')])){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x5d63de,_0x4a66('0x10d'));}var _0x52a1b9=this[_0x4a66('0x20')]['sync'](this,_0x5d63de[_0x4a66('0x10c')]);if(!_0x52a1b9){return this[_0x4a66('0xe')]['error'](_0x5d63de,_0x4a66('0x10e'));}if(!this['isConfigured'](_0x5d63de[_0x4a66('0x10f')])){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x4a66('0xd6'));}var _0x51b666=this[_0x4a66('0xe')][_0x4a66('0x110')](_0x52a1b9,_0x5d63de[_0x4a66('0x111')],_0x5d63de[_0x4a66('0x112')]);var _0x231b46=_0x51b666[_0x4a66('0xa7')]?_0x51b666[_0x4a66('0xa7')][_0x4a66('0x4c')]():'';logger[_0x4a66('0x2f')]('test',JSON[_0x4a66('0x75')](_0x51b666));if(_0x51b666[_0x4a66('0xa7')]===-0x1){this[_0x4a66('0x38')][_0x4a66('0x72')](this,_0x5d63de,_0x231b46);return _0x51b666;}else if(_0x51b666[_0x4a66('0xa8')]==='timeout'){_0x51b666['result']=_0x231b46[_0x4a66('0x9f')]>=parseInt(_0x5d63de[_0x4a66('0x113')])?'x':'i';}else{_0x51b666[_0x4a66('0xa7')]=_0x231b46[_0x4a66('0x9f')]>=parseInt(_0x5d63de[_0x4a66('0x113')])&&_0x231b46[_0x4a66('0x9f')]<=parseInt(_0x5d63de[_0x4a66('0x112')])?'x':'i';}var _0x2363a6=this[_0x4a66('0x11')]['sync'](this,_0x5d63de['variable_id']);if(!_0x2363a6){return this[_0x4a66('0xe')]['error'](_0x5d63de,_0x4a66('0xd7'));}this['channel']['setVariable'](_0x2363a6,_0x231b46);if(this[_0x4a66('0x89')](_0x5d63de['hiddendigitsnum'])){var _0x589d53=parseInt(_0x5d63de[_0x4a66('0x114')],0xa);var _0x1f5bab=rs[_0x4a66('0x115')]({'charset':'*','length':_0x589d53});var _0x26474c=_0x231b46['length'];if(_0x26474c>0x0){if(_0x26474c>_0x589d53){this[_0x4a66('0x38')][_0x4a66('0x72')](this,_0x5d63de,_0x5d63de[_0x4a66('0x116')]===_0x4a66('0x117')?_0x1f5bab+_0x231b46[_0x4a66('0x118')](_0x589d53):_0x231b46[_0x4a66('0x118')](0x0,_0x26474c-_0x589d53)+_0x1f5bab);}else{this[_0x4a66('0x38')][_0x4a66('0x72')](this,_0x5d63de,rs['generate']({'charset':'*','length':_0x26474c}));}}else{this['createSquareDetailsReport'][_0x4a66('0x72')](this,_0x5d63de,'');}}else{this[_0x4a66('0x38')][_0x4a66('0x72')](this,_0x5d63de,_0x231b46);}return _0x51b666;};AGIVertices[_0x4a66('0x10')]['getsecretdigits']=function(_0x57ecb5){logger[_0x4a66('0x2f')](util['format'](_0x4a66('0x119'),_0x57ecb5[_0x4a66('0x39')]));return this[_0x4a66('0xc')](_0x57ecb5);};AGIVertices[_0x4a66('0x10')]['goal']=function(_0x3dacfa){logger['info'](util['format'](_0x4a66('0x11a'),_0x3dacfa[_0x4a66('0x39')]));this['createSquareDetailsReport'][_0x4a66('0x72')](this,_0x3dacfa,_0x3dacfa[_0x4a66('0x11b')]);return this[_0x4a66('0xe')][_0x4a66('0xb0')](util['format'](_0x4a66('0x11c'),_0x3dacfa[_0x4a66('0x11b')]));};AGIVertices[_0x4a66('0x10')][_0x4a66('0x11d')]=function(_0x19fa71){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0x11e'),_0x19fa71[_0x4a66('0x39')]));if(!this['isConfigured'](_0x19fa71[_0x4a66('0x8c')])||!this[_0x4a66('0x89')](_0x19fa71[_0x4a66('0x91')])){return this['channel'][_0x4a66('0xb0')](_0x4a66('0x11f'));}if(!this[_0x4a66('0x89')](_0x19fa71[_0x4a66('0x61')])){return this[_0x4a66('0xe')][_0x4a66('0xb0')](_0x4a66('0xac'));}this['channel'][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0x120'),_0x19fa71[_0x4a66('0x61')]));var _0x4938cd=this[_0x4a66('0x8b')]['sync'](this,_0x19fa71);if(_0x4938cd){this[_0x4a66('0xe')]['noop'](util[_0x4a66('0x56')](_0x4a66('0x121'),_0x4938cd));var _0x560c6a=this['channel'][_0x4a66('0x122')](_0x4938cd);try{fs['unlink'](_0x4938cd+_0x4a66('0x123'));}catch(_0x28ec5b){logger[_0x4a66('0x2d')](_0x28ec5b);}return _0x560c6a;}return this[_0x4a66('0xe')]['error'](_0x19fa71,_0x4a66('0x124'));};AGIVertices['prototype'][_0x4a66('0x125')]=function(_0x5ef1db){logger[_0x4a66('0x2f')](util['format'](_0x4a66('0x126'),_0x5ef1db[_0x4a66('0x39')]));if(!this['isConfigured'](_0x5ef1db[_0x4a66('0x8c')])||!this[_0x4a66('0x89')](_0x5ef1db['aws_secret_access_key'])){return this[_0x4a66('0xe')][_0x4a66('0xb0')](_0x4a66('0x11f'));}if(!this['isConfigured'](_0x5ef1db[_0x4a66('0x93')])){return this[_0x4a66('0xe')]['noop'](_0x4a66('0x127'));}if(!this[_0x4a66('0x89')](_0x5ef1db[_0x4a66('0x61')])){return this[_0x4a66('0xe')]['noop']('no\x20text\x20configured');}this[_0x4a66('0xe')][_0x4a66('0xe7')]=!![];this[_0x4a66('0x38')](_0x5ef1db);this[_0x4a66('0x43')](_0x5ef1db[_0x4a66('0x61')],'in','','');this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0x128'),_0x5ef1db[_0x4a66('0x61')]));var _0x4ada44=this[_0x4a66('0x90')][_0x4a66('0x72')](this,_0x5ef1db);if(_0x4ada44){for(var _0xe5cc4a in _0x4ada44){if(_0x4ada44[_0x4a66('0x99')](_0xe5cc4a)&&_[_0x4a66('0x9a')](_0x4ada44[_0xe5cc4a])){this[_0x4a66('0xe')][_0x4a66('0xa2')](util['format']('AWS_LEX_%s',_0xe5cc4a[_0x4a66('0x6c')]()),_0x4ada44[_0xe5cc4a]);}}if(_['isNil'](_0x4ada44[_0x4a66('0x79')])){return this[_0x4a66('0xe')][_0x4a66('0xb0')](_0x4a66('0x129'));}else{this[_0x4a66('0x43')](_0x4ada44[_0x4a66('0x79')],_0x4a66('0xeb'),'amazonlex','');return this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0x12a'),_0x4ada44[_0x4a66('0x79')]));}}return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x5ef1db,_0x4a66('0x12b'));};AGIVertices[_0x4a66('0x10')][_0x4a66('0x12c')]=function(_0x3e5cc1){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0x12d'),_0x3e5cc1[_0x4a66('0x39')],_0x3e5cc1[_0x4a66('0x68')]));if(!this['isConfigured'](_0x3e5cc1[_0x4a66('0x7d')])){return this['channel']['noop'](_0x4a66('0xe6'));}var _0x5de69d=_0x4a66('0x12e');var _0x3233a0=util[_0x4a66('0x56')](_0x4a66('0x12f'),FILES_PATH,rs[_0x4a66('0x115')](0x4));var _0xeafeb2=util['format'](_0x4a66('0xa1'),_0x3233a0,_0x5de69d);var _0x5a391e=!![];if(_0x3e5cc1[_0x4a66('0x130')]===_0x4a66('0x131')){_0x5a391e=![];}var _0x283d50=this['channel'][_0x4a66('0x132')](_0x3233a0,_0x5de69d,_0x3e5cc1[_0x4a66('0x133')],_0x3e5cc1[_0x4a66('0x68')],undefined,_0x5a391e);if(_0x283d50['result']!==-0x1){this[_0x4a66('0xe')][_0x4a66('0xb0')](util['format']('google\x20%s\x20file\x20created',_0xeafeb2));var _0x2655b1=this[_0x4a66('0x94')][_0x4a66('0x72')](this,_0x3e5cc1,_0xeafeb2);if(_0x2655b1){for(var _0x208229 in _0x2655b1){if(_0x2655b1[_0x4a66('0x99')](_0x208229)){this['channel'][_0x4a66('0xa2')](util['format'](_0x4a66('0x134'),_0x208229['toUpperCase']()),_0x2655b1[_0x208229]);}}return this['channel'][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0x135'),JSON[_0x4a66('0x75')](_0x2655b1)));}}return _0x283d50;};AGIVertices[_0x4a66('0x10')][_0x4a66('0x136')]=function(_0x2253eb){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x2253eb['label']));if(!this[_0x4a66('0x89')](_0x2253eb[_0x4a66('0x137')])){return this['channel'][_0x4a66('0xb0')]('no\x20appid\x20configured');}if(!this[_0x4a66('0x89')](_0x2253eb[_0x4a66('0x138')])){return this[_0x4a66('0xe')][_0x4a66('0xb0')]('no\x20appsecret\x20configured');}var _0xbdbd04='wav';var _0x70f34e=util['format'](_0x4a66('0x12f'),FILES_PATH,rs[_0x4a66('0x115')](0x4));var _0x21e921=util[_0x4a66('0x56')](_0x4a66('0xa1'),_0x70f34e,_0xbdbd04);var _0x3e59ed=!![];if(_0x2253eb[_0x4a66('0x130')]===_0x4a66('0x131')){_0x3e59ed=![];}var _0x215588=this[_0x4a66('0xe')][_0x4a66('0x132')](_0x70f34e,_0xbdbd04,_0x2253eb['intKey'],_0x2253eb['timeout'],undefined,_0x3e59ed);if(_0x215588[_0x4a66('0xa7')]!==-0x1){this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0x139'),_0x21e921));var _0x4fbf7c=this['tildeASR'][_0x4a66('0x72')](this,_0x2253eb,_0x21e921);if(_0x4fbf7c){for(var _0xa0291b in _0x4fbf7c){if(_0x4fbf7c[_0x4a66('0x99')](_0xa0291b)){this['channel']['setVariable'](util[_0x4a66('0x56')](_0x4a66('0x13a'),_0xa0291b[_0x4a66('0x6c')]()),_0x4fbf7c[_0xa0291b]);}}return this['channel'][_0x4a66('0xb0')](util['format'](_0x4a66('0x13b'),JSON[_0x4a66('0x75')](_0x4fbf7c)));}}return _0x215588;};AGIVertices[_0x4a66('0x10')][_0x4a66('0x13c')]=function(_0x25395b){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0x13d'),_0x25395b[_0x4a66('0x39')]));return this[_0x4a66('0xe')]['continueAt'](_0x25395b[_0x4a66('0x3f')],_0x25395b[_0x4a66('0x13e')],_0x25395b[_0x4a66('0x40')]);};AGIVertices[_0x4a66('0x10')]['gotoif']=function(_0x4b9534){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x4b9534['label']));if(!this[_0x4a66('0x89')](_0x4b9534['condition'])){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x4b9534,_0x4a66('0x13f'));}try{var _0x1b398d=eval(_0x4b9534[_0x4a66('0x140')])?'true':_0x4a66('0x141');this[_0x4a66('0xe')][_0x4a66('0xb0')](util['format'](_0x4a66('0x142'),_0x4b9534[_0x4a66('0x140')],_0x1b398d));return{'code':0xc8,'result':_0x1b398d};}catch(_0x45621b){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x4a66('0x10')][_0x4a66('0x143')]=function(_0x411cfa){logger['info'](util['format'](_0x4a66('0x144'),_0x411cfa[_0x4a66('0x39')]));if(!this[_0x4a66('0x89')](_0x411cfa['interval_id'])){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x411cfa,_0x4a66('0x145'));}var _0x5254fa=this[_0x4a66('0x27')][_0x4a66('0x72')](this,_0x411cfa['interval_id']);if(!_0x5254fa){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x411cfa,_0x4a66('0x146'));}for(var _0x1c463c=0x0;_0x1c463c<_0x5254fa[_0x4a66('0x9f')];_0x1c463c+=0x1){var _0x2957d6=this[_0x4a66('0xe')]['getVariable'](util[_0x4a66('0x56')](_0x4a66('0x147'),_0x5254fa[_0x1c463c]));if(_0x2957d6[_0x4a66('0xa7')]===-0x1){return _0x2957d6;}logger[_0x4a66('0x2f')](util['format'](_0x4a66('0x148'),_0x5254fa[_0x1c463c],_0x2957d6['extra']));if(_0x2957d6['extra']===_0x4a66('0x149')){logger['info'](util['format'](_0x4a66('0x148'),_0x5254fa[_0x1c463c],'true'));this[_0x4a66('0xe')][_0x4a66('0xb0')](util['format']('IFTIME\x20%s\x20%s',_0x5254fa[_0x1c463c],'true'));return{'code':0xc8,'result':_0x4a66('0x149')};}else{logger[_0x4a66('0x2f')](util['format'](_0x4a66('0x148'),_0x5254fa[_0x1c463c],_0x4a66('0x141')));this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')]('IFTIME\x20%s\x20%s',_0x5254fa[_0x1c463c],_0x4a66('0x141')));}}return{'code':0xc8,'result':_0x4a66('0x141')};};AGIVertices['prototype'][_0x4a66('0x14a')]=function(_0x418a81){logger[_0x4a66('0x2f')](util['format'](_0x4a66('0x14b'),_0x418a81[_0x4a66('0x39')]));return this[_0x4a66('0xe')][_0x4a66('0x14a')]();};AGIVertices[_0x4a66('0x10')]['ispeechasr']=function(_0x537f21){logger['info'](util[_0x4a66('0x56')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x537f21[_0x4a66('0x39')]));if(!this[_0x4a66('0x89')](_0x537f21['key'])){return this[_0x4a66('0xe')][_0x4a66('0xb0')](_0x4a66('0xe6'));}var _0x51449f='wav';var _0x3bce15=util['format'](_0x4a66('0x12f'),FILES_PATH,rs[_0x4a66('0x115')](0x4));var _0x21f71a=util['format'](_0x4a66('0xa1'),_0x3bce15,_0x51449f);var _0x42af6b=!![];if(_0x537f21['beep']==='NOBEEP'){_0x42af6b=![];}var _0x1badbb=this[_0x4a66('0xe')][_0x4a66('0x132')](_0x3bce15,_0x51449f,_0x537f21[_0x4a66('0x133')],_0x537f21['timeout'],undefined,_0x42af6b);if(_0x1badbb[_0x4a66('0xa7')]!==-0x1){this[_0x4a66('0xe')]['noop'](util[_0x4a66('0x56')]('ispeech\x20%s\x20file\x20created',_0x21f71a));var _0x744492=this[_0x4a66('0x87')][_0x4a66('0x72')](this,_0x537f21,_0x21f71a);if(_0x744492){for(var _0x21371a in _0x744492){if(_0x744492[_0x4a66('0x99')](_0x21371a)){this['channel'][_0x4a66('0xa2')](util[_0x4a66('0x56')](_0x4a66('0x14c'),_0x21371a[_0x4a66('0x6c')]()),_0x744492[_0x21371a]);}}return this[_0x4a66('0xe')][_0x4a66('0xb0')](util['format']('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x744492)));}}return _0x1badbb;};AGIVertices[_0x4a66('0x10')][_0x4a66('0x14d')]=function(_0x2d871d){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0x14e'),_0x2d871d[_0x4a66('0x39')]));if(!this['isConfigured'](_0x2d871d[_0x4a66('0x7d')])){return this[_0x4a66('0xe')]['noop'](_0x4a66('0xe6'));}if(!this[_0x4a66('0x89')](_0x2d871d['text'])){return this['channel'][_0x4a66('0xb0')](_0x4a66('0xac'));}this[_0x4a66('0xe')]['noop'](util[_0x4a66('0x56')](_0x4a66('0x14f'),_0x2d871d['text']));var _0x297d4a=this[_0x4a66('0x83')][_0x4a66('0x72')](this,_0x2d871d);if(_0x297d4a){this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0x150'),_0x297d4a));var _0x768818=this[_0x4a66('0xe')][_0x4a66('0x122')](_0x297d4a,_0x2d871d[_0x4a66('0x133')]);try{fs['unlink'](_0x297d4a+_0x4a66('0x123'));}catch(_0x415755){logger[_0x4a66('0x2d')](_0x415755);}return _0x768818;}return this['channel']['error'](_0x2d871d,_0x4a66('0x151'));};AGIVertices[_0x4a66('0x10')]['login']=function(_0x4b7704){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x4b7704[_0x4a66('0x39')]));if(!this['isConfigured'](_0x4b7704['findBy'])){return this[_0x4a66('0xe')]['error'](_0x4b7704,_0x4a66('0x152'));}logger[_0x4a66('0x2f')](util[_0x4a66('0x56')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x4a66('0xe')][_0x4a66('0x3c')],_0x4b7704[_0x4a66('0x153')]));var _0x3e5c2b=this[_0x4a66('0x59')][_0x4a66('0x72')](this,_0x4b7704[_0x4a66('0x153')]);if(_0x3e5c2b){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0x154'),this[_0x4a66('0xe')]['callerid'],_0x4b7704[_0x4a66('0x153')]));this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0x154'),this[_0x4a66('0xe')]['callerid'],_0x4b7704[_0x4a66('0x153')]));return{'code':0xc8,'result':_0x4a66('0x155')};}else{logger['info'](util[_0x4a66('0x56')](_0x4a66('0x156'),this['channel'][_0x4a66('0x3c')],_0x4b7704[_0x4a66('0x153')]));this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0x156'),this[_0x4a66('0xe')]['callerid'],_0x4b7704[_0x4a66('0x153')]));return{'code':0xc8,'result':_0x4a66('0x157')};}};AGIVertices[_0x4a66('0x10')][_0x4a66('0x158')]=function(_0x197101){logger[_0x4a66('0x2f')](util['format'](_0x4a66('0x159'),_0x197101['label']));if(!this[_0x4a66('0x89')](_0x197101[_0x4a66('0x153')])){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x197101,'no\x20find\x20by\x20configured');}logger['info'](util[_0x4a66('0x56')](_0x4a66('0x15a'),this[_0x4a66('0xe')]['callerid'],_0x197101['findBy']));var _0x92d605=this[_0x4a66('0x54')][_0x4a66('0x72')](this,_0x197101[_0x4a66('0x153')]);if(_0x92d605){logger[_0x4a66('0x2f')](util['format'](_0x4a66('0x154'),this[_0x4a66('0xe')]['callerid'],_0x197101['findBy']));this['channel'][_0x4a66('0xb0')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x4a66('0xe')][_0x4a66('0x3c')],_0x197101[_0x4a66('0x153')]));return{'code':0xc8,'result':'success'};}else{logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0x156'),this[_0x4a66('0xe')][_0x4a66('0x3c')],_0x197101[_0x4a66('0x153')]));this[_0x4a66('0xe')]['noop'](util[_0x4a66('0x56')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x4a66('0x3c')],_0x197101[_0x4a66('0x153')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x4a66('0x10')]['math']=function(_0x4c80d7){logger['info'](util[_0x4a66('0x56')](_0x4a66('0x15b'),_0x4c80d7['label']));if(!this[_0x4a66('0x89')](_0x4c80d7['operation'])){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x4c80d7,'no\x20operation\x20configured');}this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0x15c'),_0x4c80d7[_0x4a66('0x15d')]));var _0x1ac549=eval(_0x4c80d7['operation']);if(!this[_0x4a66('0x89')](_0x4c80d7[_0x4a66('0x10f')])){return this[_0x4a66('0xe')][_0x4a66('0xb0')](_0x4a66('0xd6'));}var _0xc01019=this['getVariable'][_0x4a66('0x72')](this,_0x4c80d7[_0x4a66('0x10f')]);if(!_0xc01019){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x4c80d7,_0x4a66('0xd7'));}if(_[_0x4a66('0x9e')](_0x1ac549)){var _0x16f4cf=this;_0x1ac549['forEach'](function(_0x335866,_0x5719bf){_0x16f4cf[_0x4a66('0xe')][_0x4a66('0xa2')](util[_0x4a66('0x56')](_0x4a66('0x15e'),_0xc01019,_0x5719bf),_0x335866);});return this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0x15f'),_0xc01019));}else{return this[_0x4a66('0xe')][_0x4a66('0xa2')](_0xc01019,_0x1ac549);}};AGIVertices['prototype'][_0x4a66('0x160')]=function(_0xe864ff){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0x161'),_0xe864ff[_0x4a66('0x39')]));if(_0xe864ff[_0x4a66('0xaa')]===0x0){return this[_0x4a66('0xa9')](_0xe864ff);}_0xe864ff[_0x4a66('0xaa')]-=0x1;if(!this[_0x4a66('0x89')](_0xe864ff[_0x4a66('0x10c')])){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0xe864ff,_0x4a66('0x10d'));}var _0x3f80e4=this['getSound'][_0x4a66('0x72')](this,_0xe864ff['file_id']);if(!_0x3f80e4){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0xe864ff,'no\x20file\x20audio\x20found');}var _0x44a6ae=this[_0x4a66('0xe')]['getData'](_0x3f80e4,_0xe864ff[_0x4a66('0x111')],_0xe864ff[_0x4a66('0x162')]);var _0x3bb503=_0x44a6ae[_0x4a66('0xa7')];if(_0x44a6ae[_0x4a66('0xa7')]===-0x1){this['createSquareDetailsReport'][_0x4a66('0x72')](this,_0xe864ff,'-1');return _0x44a6ae;}else if(_0x44a6ae[_0x4a66('0xa8')]===_0x4a66('0x68')){_0x44a6ae[_0x4a66('0xa7')]=_0x44a6ae[_0x4a66('0xa7')]['length']>0x0?_0x44a6ae[_0x4a66('0xa7')]:'t';}else if(_[_0x4a66('0x46')](_0x44a6ae[_0x4a66('0xa7')])){_0x44a6ae['result']='#';_0x3bb503='#';}if(!this[_0x4a66('0x89')](_0xe864ff[_0x4a66('0x10f')])){this[_0x4a66('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x42184b=this[_0x4a66('0x11')][_0x4a66('0x72')](this,_0xe864ff[_0x4a66('0x10f')]);if(!_0x42184b){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0xe864ff,_0x4a66('0xd7'));}this['channel']['setVariable'](_0x42184b,_0x3bb503);}this[_0x4a66('0x38')][_0x4a66('0x72')](this,_0xe864ff,_0x3bb503);return _0x44a6ae;};AGIVertices[_0x4a66('0x10')]['noop']=function(_0x1799d3){logger['info'](util[_0x4a66('0x56')](_0x4a66('0x163'),_0x1799d3[_0x4a66('0x39')]));return this[_0x4a66('0xe')][_0x4a66('0xb0')](_0x1799d3['output']||_0x1799d3[_0x4a66('0x39')]);};AGIVertices[_0x4a66('0x10')][_0x4a66('0x164')]=function(_0x587c44){logger[_0x4a66('0x2f')](util['format']('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x587c44[_0x4a66('0x39')]));if(!this['isConfigured'](_0x587c44[_0x4a66('0x153')])){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x587c44,_0x4a66('0x152'));}logger[_0x4a66('0x2f')](util[_0x4a66('0x56')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x4a66('0xe')][_0x4a66('0x3c')],_0x587c44[_0x4a66('0x153')]));var _0x4226b5=this['getPause'][_0x4a66('0x72')](this,_0x587c44[_0x4a66('0x165')]);var _0x4d9f40=this[_0x4a66('0x50')]['sync'](this,_0x587c44[_0x4a66('0x153')],_0x4226b5);if(_0x4d9f40){logger['info'](util[_0x4a66('0x56')](_0x4a66('0x154'),this[_0x4a66('0xe')][_0x4a66('0x3c')],_0x587c44[_0x4a66('0x153')]));this[_0x4a66('0xe')]['noop'](util[_0x4a66('0x56')](_0x4a66('0x154'),this['channel']['callerid'],_0x587c44[_0x4a66('0x153')]));return{'code':0xc8,'result':'success'};}else{logger[_0x4a66('0x2f')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4a66('0xe')][_0x4a66('0x3c')],_0x587c44[_0x4a66('0x153')]));this[_0x4a66('0xe')]['noop'](util[_0x4a66('0x56')](_0x4a66('0x154'),this[_0x4a66('0xe')]['callerid'],_0x587c44[_0x4a66('0x153')]));return{'code':0xc8,'result':_0x4a66('0x157')};}};AGIVertices[_0x4a66('0x10')]['playback']=function(_0x38578b){logger['info'](util[_0x4a66('0x56')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x38578b[_0x4a66('0x39')]));if(!this[_0x4a66('0x89')](_0x38578b[_0x4a66('0x10c')])){return this['channel']['error'](_0x38578b,_0x4a66('0x10d'));}var _0x4b8336=this[_0x4a66('0x20')][_0x4a66('0x72')](this,_0x38578b['file_id']);if(!_0x4b8336){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x38578b,_0x4a66('0x10e'));}var _0x8408b8=this[_0x4a66('0xe')][_0x4a66('0x5b')](_0x4a66('0x166'),[_0x4b8336,_0x38578b[_0x4a66('0xe2')]]);if(_0x8408b8[_0x4a66('0xa7')]===-0x1){return _0x8408b8;}return this[_0x4a66('0xe')][_0x4a66('0xb0')](util['format'](_0x4a66('0xc9'),_0x4a66('0x166'),_0x4b8336));};AGIVertices[_0x4a66('0x10')][_0x4a66('0x167')]=function(_0x43fa93){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0x168'),_0x43fa93['label']));if(!this[_0x4a66('0x89')](_0x43fa93['queue_id'])){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x43fa93,_0x4a66('0x169'));}var _0xc9f427='';var _0x441f26=parseInt(_0x43fa93[_0x4a66('0x16a')],0xa);if(isNaN(_0x441f26)){_0xc9f427=_0x43fa93[_0x4a66('0x16a')];}else{_0xc9f427=this['getVoiceQueue'][_0x4a66('0x72')](this,_0x43fa93[_0x4a66('0x16a')]);if(!_0xc9f427){return this['channel'][_0x4a66('0x2d')](_0x43fa93,_0x4a66('0x16b'));}}var _0x175a70='';if(this['isConfigured'](_0x43fa93[_0x4a66('0x10c')])){var _0xc374f1=this[_0x4a66('0x20')]['sync'](this,_0x43fa93[_0x4a66('0x10c')]);if(_0xc374f1){_0x175a70=_0xc374f1;}}this[_0x4a66('0x38')][_0x4a66('0x72')](this,_0x43fa93,_0xc9f427);if(_0x43fa93[_0x4a66('0xe2')]['indexOf']('x')<0x0){_0x43fa93[_0x4a66('0xe2')]+='x';}if(_0x43fa93[_0x4a66('0xe2')][_0x4a66('0x16c')]('X')<0x0){_0x43fa93[_0x4a66('0xe2')]+='X';}this[_0x4a66('0xe')][_0x4a66('0xa2')]('XMCS-QUEUE',_0xc9f427?_0xc9f427[_0x4a66('0x16d')]():'');var _0x1d08e7=this[_0x4a66('0xe')][_0x4a66('0x5b')]('QUEUE',[_0xc9f427,_0x43fa93[_0x4a66('0xe2')],_0x43fa93[_0x4a66('0x73')],_0x175a70,_0x43fa93[_0x4a66('0x68')],_0x43fa93[_0x4a66('0x5')],_0x43fa93[_0x4a66('0x16e')],_0x43fa93['gosub'],'',_0x43fa93[_0x4a66('0x16f')]]);if(_0x1d08e7[_0x4a66('0xa7')]===-0x1){return _0x1d08e7;}return this[_0x4a66('0xe')]['noop'](util['format'](_0x4a66('0xc9'),_0x4a66('0x170'),_0xc9f427));};AGIVertices[_0x4a66('0x10')][_0x4a66('0x171')]=function(_0x452eac){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0x172'),_0x452eac[_0x4a66('0x39')]));var _0x179bbd=_0x452eac[_0x4a66('0x173')]||_0x4a66('0x12e');var _0x39447c=util[_0x4a66('0x56')]('%s_%s',this['channel'][_0x4a66('0x44')],rs[_0x4a66('0x115')](0x5));var _0x2ebedd=util[_0x4a66('0x56')](_0x4a66('0x174'),FILES_PATH,_0x39447c,_0x179bbd);var _0x309420=util['format']('%s/recordings/%s',FILES_PATH,_0x39447c);this['createSquareRecording']['sync'](this,_0x452eac,_0x39447c,_0x2ebedd);this['channel']['setVariable'](_0x4a66('0x175'),_0x39447c);logger[_0x4a66('0x2f')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x309420,_0x179bbd,_0x452eac['escape_digits'],_0x452eac[_0x4a66('0x68')]);return this['channel'][_0x4a66('0x132')](_0x309420,_0x179bbd,_0x452eac['escape_digits'],_0x452eac[_0x4a66('0x68')],undefined,!![]);};AGIVertices[_0x4a66('0x10')]['restapi']=function(_0x24fe17){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x24fe17[_0x4a66('0x39')]));if(!this[_0x4a66('0x89')](_0x24fe17[_0x4a66('0x73')])){return this[_0x4a66('0xe')][_0x4a66('0xb0')]('no\x20url\x20configured');}var _0x4027cd=this['restAPI'][_0x4a66('0x72')](this,_0x24fe17);logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0x176'),util[_0x4a66('0x177')](_0x4027cd,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x24fe17[_0x4a66('0x10f')])){return this[_0x4a66('0xe')]['noop'](_0x4a66('0x178'));}var _0x46ced2=this[_0x4a66('0x11')]['sync'](this,_0x24fe17[_0x4a66('0x10f')]);if(!_0x46ced2){return this[_0x4a66('0xe')]['error'](_0x24fe17,'no\x20variable\x20found');}this[_0x4a66('0xe')][_0x4a66('0xa2')](util[_0x4a66('0x56')](_0x4a66('0x179'),_0x46ced2),_0x4027cd[_0x4a66('0x78')]?_0x4027cd[_0x4a66('0x78')]:_0x4a66('0x17a'));this['channel']['setVariable'](util[_0x4a66('0x56')](_0x4a66('0x17b'),_0x46ced2),_0x4027cd[_0x4a66('0x77')]?_0x4027cd['statusMessage']:'OK');if(_0x4027cd[_0x4a66('0x6d')]){try{this[_0x4a66('0xa0')](_0x4027cd[_0x4a66('0x6d')],_0x46ced2);}catch(_0x50b2e8){logger[_0x4a66('0x2d')](util[_0x4a66('0x56')](_0x4a66('0x17c'),_0x46ced2));}}return this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0x17d'),_0x46ced2));};AGIVertices[_0x4a66('0x10')][_0x4a66('0x17e')]=function(_0xe6f0e4){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0xe6f0e4[_0x4a66('0x39')]));return this[_0x4a66('0xe')]['sayDigits'](_0xe6f0e4['digits']['replace'](/\s+/g,''),_0xe6f0e4[_0x4a66('0x17f')]);};AGIVertices['prototype']['saynumber']=function(_0x345ad1){logger[_0x4a66('0x2f')](util['format'](_0x4a66('0x180'),_0x345ad1['label']));return this['channel']['sayNumber'](_0x345ad1[_0x4a66('0x181')]['replace'](/\s+/g,''),_0x345ad1[_0x4a66('0x17f')]);};AGIVertices['prototype']['sayphonetic']=function(_0x42fbb6){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0x182'),_0x42fbb6[_0x4a66('0x39')]));return this[_0x4a66('0xe')][_0x4a66('0x183')](_0x42fbb6[_0x4a66('0x61')],_0x42fbb6['escape_digits']);};AGIVertices[_0x4a66('0x10')][_0x4a66('0x184')]=function(_0x34a45c){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x34a45c['label']));if(!this[_0x4a66('0x89')](_0x34a45c[_0x4a66('0x185')])){return this[_0x4a66('0xe')][_0x4a66('0xb0')](_0x4a66('0x186'));}var _0x4bb00c=this[_0x4a66('0x24')][_0x4a66('0x72')](this,_0x34a45c[_0x4a66('0x185')]);if(!_0x4bb00c||!_0x4bb00c[_0x4a66('0x187')]){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x34a45c,_0x4a66('0x188'));}var _0x37f9db={'from':util[_0x4a66('0x56')](_0x4a66('0x189'),_0x4bb00c[_0x4a66('0x14')],_0x4bb00c[_0x4a66('0x18a')]||_0x4bb00c[_0x4a66('0x187')][_0x4a66('0x18b')]),'to':_0x34a45c['to']||'','cc':_0x34a45c['cc']||'','bcc':_0x34a45c['bcc']||'','subject':_0x34a45c[_0x4a66('0x18c')],'html':_0x34a45c['text'],'text':_0x34a45c['text']};if(this[_0x4a66('0x89')](_0x34a45c[_0x4a66('0x18d')])){}logger[_0x4a66('0xdc')](_0x4a66('0x18e'),JSON['stringify'](_0x37f9db));this[_0x4a66('0x38')][_0x4a66('0x72')](this,_0x34a45c,_0x34a45c[_0x4a66('0x185')]);this[_0x4a66('0xe')]['noop'](util[_0x4a66('0x56')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x4bb00c[_0x4a66('0x14')]));this[_0x4a66('0x18f')][_0x4a66('0x72')](this,_0x4bb00c[_0x4a66('0x190')],_0x37f9db);return this[_0x4a66('0xe')][_0x4a66('0xb0')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype']['sendFax']=function(_0x9271c2){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0x191'),_0x9271c2[_0x4a66('0x39')]));return this[_0x4a66('0xe')][_0x4a66('0xb0')](_0x4a66('0x192'));};AGIVertices[_0x4a66('0x10')][_0x4a66('0x193')]=function(_0x1bd41d){logger[_0x4a66('0x2f')](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x1bd41d[_0x4a66('0x39')]));if(!this[_0x4a66('0x89')](_0x1bd41d[_0x4a66('0x194')])){return this[_0x4a66('0xe')][_0x4a66('0xb0')](_0x4a66('0x195'));}var _0x444655=this[_0x4a66('0x196')][_0x4a66('0x72')](this,_0x1bd41d[_0x4a66('0x194')]);if(!_0x444655){return this[_0x4a66('0xe')]['error'](_0x1bd41d,_0x4a66('0x197'));}var _0x229bdd={'body':_0x1bd41d[_0x4a66('0x198')],'phone':_0x1bd41d['to']||'','SmsAccountId':_0x444655['id']};logger['debug'](_0x4a66('0x199'),JSON['stringify'](_0x229bdd));this['createSquareDetailsReport'][_0x4a66('0x72')](this,_0x1bd41d,_0x1bd41d[_0x4a66('0x194')]);this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x444655['name']));this[_0x4a66('0x37')]['sync'](this,_0x229bdd);return this['channel'][_0x4a66('0xb0')](_0x4a66('0x19a'));};AGIVertices[_0x4a66('0x10')][_0x4a66('0x19b')]=function(_0x334976){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0x19c'),_0x334976[_0x4a66('0x39')]));if(!this['isConfigured'](_0x334976[_0x4a66('0x10f')])){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x334976,_0x4a66('0x19d'));}var _0x2ba0e4=this[_0x4a66('0x11')][_0x4a66('0x72')](this,_0x334976[_0x4a66('0x10f')]);if(!_0x2ba0e4){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x334976,_0x4a66('0xd7'));}return this[_0x4a66('0xe')]['setVariable'](_0x2ba0e4,_0x334976[_0x4a66('0x19e')]);};AGIVertices[_0x4a66('0x10')][_0x4a66('0x19f')]=function(_0x478900){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0x1a0'),_0x478900[_0x4a66('0x39')]));this[_0x4a66('0xe')][_0x4a66('0xb0')](_0x4a66('0x1a1'));if(_0x478900[_0x4a66('0xbb')]===_0x4a66('0x1a2')){this[_0x4a66('0xe')][_0x4a66('0xb0')]('Answer');return this[_0x4a66('0xe')]['answer']();}return this['channel'][_0x4a66('0xb0')](_0x4a66('0x1a3'));};AGIVertices[_0x4a66('0x10')]['subproject']=function(_0x197fc3){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0x1a4'),_0x197fc3['label']));if(!this[_0x4a66('0x89')](_0x197fc3[_0x4a66('0x1a5')])){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x197fc3,_0x4a66('0x1a6'));}var _0x2a1e98=this[_0x4a66('0x18')]['sync'](this,_0x197fc3['project_id']);if(!this[_0x4a66('0x89')](_0x2a1e98)){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x197fc3,util[_0x4a66('0x56')](_0x4a66('0x1a7'),_0x197fc3[_0x4a66('0x1a5')]));}if(_0x2a1e98===this[_0x4a66('0xe')]['arg_1']){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x197fc3,_0x4a66('0x1a8'));}this[_0x4a66('0x38')][_0x4a66('0x72')](this,_0x197fc3,_0x2a1e98);var _0x27c6f7=this[_0x4a66('0xe')][_0x4a66('0x5b')](_0x4a66('0x1a9'),util[_0x4a66('0x56')](_0x4a66('0x1aa'),config[_0x4a66('0x5')][_0x4a66('0x1ab')]||_0x4a66('0x1ac'),_0x2a1e98,this[_0x4a66('0xe')][_0x4a66('0x3b')]));if(_0x27c6f7[_0x4a66('0xa7')]===-0x1){return _0x27c6f7;}return this[_0x4a66('0xe')]['noop'](util[_0x4a66('0x56')]('Executed\x20command\x20%s\x20%s',_0x4a66('0x1a9'),_0x2a1e98));};AGIVertices[_0x4a66('0x10')]['system']=function(_0x47d92f){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0x1ad'),_0x47d92f[_0x4a66('0x39')]));var _0x45c7a2=this[_0x4a66('0x5a')]['sync'](this,_0x47d92f['command']);this[_0x4a66('0x38')][_0x4a66('0x72')](this,_0x47d92f,_0x47d92f[_0x4a66('0xb9')]);if(this[_0x4a66('0x89')](_0x47d92f[_0x4a66('0x10f')])){var _0x709238=this[_0x4a66('0x11')][_0x4a66('0x72')](this,_0x47d92f[_0x4a66('0x10f')]);if(_0x709238){this[_0x4a66('0xe')][_0x4a66('0xa2')](_0x709238,_0x45c7a2);return this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0x1ae'),_0x47d92f['command'],_0x709238));}}return this['channel']['noop'](util[_0x4a66('0x56')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x47d92f[_0x4a66('0xb9')]));};AGIVertices[_0x4a66('0x10')][_0x4a66('0x1af')]=function(_0x542f76){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0x1b0'),_0x542f76['label']));_0x542f76['text']=_0x542f76[_0x4a66('0x61')][_0x4a66('0x5d')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x542f76[_0x4a66('0x5f')])){return this[_0x4a66('0xe')][_0x4a66('0xb0')](_0x4a66('0x1b1'));}if(!this[_0x4a66('0x89')](_0x542f76['text'])){return this[_0x4a66('0xe')][_0x4a66('0xb0')]('no\x20text\x20configured');}this['channel']['noop'](util[_0x4a66('0x56')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x542f76[_0x4a66('0x61')]));var _0x411975=this[_0x4a66('0x5e')][_0x4a66('0x72')](this,_0x542f76);if(_0x411975){this['channel']['noop'](util[_0x4a66('0x56')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x411975));var _0x11c9e7=this['channel']['streamFile'](_0x411975);try{fs[_0x4a66('0x102')](_0x411975+_0x4a66('0x123'));}catch(_0x2d0628){logger[_0x4a66('0x2d')](_0x2d0628);}return _0x11c9e7;}return this[_0x4a66('0xe')]['error'](_0x542f76,_0x4a66('0x1b2'));};AGIVertices[_0x4a66('0x10')][_0x4a66('0x1b3')]=function(_0x368814){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x368814[_0x4a66('0x39')]));_0x368814['text']=_0x368814[_0x4a66('0x61')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x368814[_0x4a66('0x61')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x4a66('0xe')]['noop'](util[_0x4a66('0x56')](_0x4a66('0x1b4'),_0x368814[_0x4a66('0x61')]));var _0x5662c6=this[_0x4a66('0x65')][_0x4a66('0x72')](this,_0x368814);if(_0x5662c6){this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0x1b5'),_0x5662c6));var _0x274d70=this[_0x4a66('0xe')][_0x4a66('0x122')](_0x5662c6);try{fs[_0x4a66('0x102')](_0x5662c6+'.wav');}catch(_0x178f68){logger[_0x4a66('0x2d')](_0x178f68);}return _0x274d70;}return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0x368814,_0x4a66('0x1b6'));};AGIVertices[_0x4a66('0x10')][_0x4a66('0x1b7')]=function(_0x250163){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0x1b8'),_0x250163[_0x4a66('0x39')]));if(!this['isConfigured'](_0x250163[_0x4a66('0x153')])){return this['channel'][_0x4a66('0x2d')](_0x250163,_0x4a66('0x152'));}logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0x15a'),this[_0x4a66('0xe')][_0x4a66('0x3c')],_0x250163['findBy']));var _0x33a639=this[_0x4a66('0x53')]['sync'](this,_0x250163[_0x4a66('0x153')]);if(_0x33a639){logger['info'](util[_0x4a66('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4a66('0xe')]['callerid'],_0x250163[_0x4a66('0x153')]));this[_0x4a66('0xe')][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0x154'),this[_0x4a66('0xe')][_0x4a66('0x3c')],_0x250163[_0x4a66('0x153')]));return{'code':0xc8,'result':_0x4a66('0x155')};}else{logger[_0x4a66('0x2f')](util['format'](_0x4a66('0x156'),this[_0x4a66('0xe')]['callerid'],_0x250163['findBy']));this['channel'][_0x4a66('0xb0')](util[_0x4a66('0x56')](_0x4a66('0x156'),this[_0x4a66('0xe')][_0x4a66('0x3c')],_0x250163[_0x4a66('0x153')]));return{'code':0xc8,'result':_0x4a66('0x157')};}};AGIVertices[_0x4a66('0x10')][_0x4a66('0x1b9')]=function(_0x3222fb){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0x1ba'),_0x3222fb[_0x4a66('0x39')]));var _0x1f9f33=this[_0x4a66('0xe')]['exec']('VOICEMAIL',[_0x3222fb[_0x4a66('0x1bb')],_0x3222fb['options']]);if(_0x1f9f33[_0x4a66('0xa7')]===-0x1){return _0x1f9f33;}return this[_0x4a66('0xe')]['noop'](util[_0x4a66('0x56')](_0x4a66('0xc9'),_0x4a66('0x1bc'),_0x3222fb['mailbox']));};AGIVertices['prototype'][_0x4a66('0x1bd')]=function(_0xeae186){logger[_0x4a66('0x2f')](util[_0x4a66('0x56')](_0x4a66('0x1be'),_0xeae186[_0x4a66('0x39')]));if(!this['isConfigured'](_0xeae186[_0x4a66('0x10f')])){return this[_0x4a66('0xe')][_0x4a66('0x2d')](_0xeae186,_0x4a66('0x19d'));}var _0x2cc3e0=this[_0x4a66('0x11')][_0x4a66('0x72')](this,_0xeae186['variable_id']);if(!_0x2cc3e0){return this[_0x4a66('0xe')]['error'](_0xeae186,_0x4a66('0xd7'));}var _0x38113d=this['channel'][_0x4a66('0x11')](_0x2cc3e0);return{'code':0xc8,'result':_0x38113d['extra']?_0x38113d[_0x4a66('0xa8')]:'-'};};String[_0x4a66('0x10')]['replaceAll']=function(_0x170e75,_0x7c2601){return this[_0x4a66('0xa4')](_0x170e75)['join'](_0x7c2601);};module[_0x4a66('0x1bf')]=AGIVertices; \ No newline at end of file +var _0xfc61=['IspeechASR\x20Result\x20%s','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','agentLogin','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','pause_id','agentPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','createSquareRecording','RECORDING_SAVENAME','escape_digits','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','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','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Answer','Skipped\x20Answer','no\x20subproject\x20selected','getSquareProject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','vswitch','join','exports','util','lodash','shelljs','odbc','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','channel','mailRpc','prototype','rpc','getVariableById','name','catch','getVoiceQueueById','then','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','calleridname','extension','accountcode','dnid','file','createSquareMessage','createCmContact','callback_','random','isNil','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agent','agentUnpause','agentLogout','internal','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','method','number','timeout','includes','PUT','toUpperCase','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','body','parse','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','Amy','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','isEmpty','%s.%s','length','setVariable','split','replaceAll','getVariable','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','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\x20database\x20selected','no\x20query\x20configured','query:\x20%s','variable_id','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','no\x20key\x20configured','DIALOGFLOW_%s','speech','out','dialogflow','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','bot','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','url','Executed\x20command\x20%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','hiddendigitspos','first','substr','generate','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','unlink','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','%s/recordings/%s','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','getIntervals','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xfc61,0x78));var _0x1fc6=function(_0x420b0c,_0xbb4ea3){_0x420b0c=_0x420b0c-0x0;var _0x3a0f8b=_0xfc61[_0x420b0c];return _0x3a0f8b;};'use strict';var fs=require('fs');var util=require(_0x1fc6('0x0'));var _=require(_0x1fc6('0x1'));var sh=require(_0x1fc6('0x2'));var odbc=require(_0x1fc6('0x3'))();var rs=require('randomstring');var moment=require('moment');var Mustache=require('mustache');var rp=require(_0x1fc6('0x4'));var logger=require(_0x1fc6('0x5'))(_0x1fc6('0x6'));var config=require(_0x1fc6('0x7'));var shared=require('../../config/environment/shared');var scripts=require('./scripts');var FILES_PATH=_0x1fc6('0x8');var recursiveMapAttributes=[_0x1fc6('0x9'),_0x1fc6('0xa')];var verticesWithRetry=[_0x1fc6('0xb'),_0x1fc6('0xc'),'getsecretdigits'];var AGIVertices=function(_0x8891cc,_0x37a219,_0x300375){this[_0x1fc6('0xd')]=_0x8891cc;this['rpc']=_0x37a219;this[_0x1fc6('0xe')]=_0x300375;};AGIVertices[_0x1fc6('0xf')]['getVariable']=function(_0xbcc0d,_0x12c3d9){this[_0x1fc6('0x10')][_0x1fc6('0x11')](_0xbcc0d)['then'](function(_0x4d8b12){_0x12c3d9(null,_0x4d8b12?_0x4d8b12[_0x1fc6('0x12')]:![]);})[_0x1fc6('0x13')](function(_0xa08740){_0x12c3d9(_0xa08740);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x7aa77f,_0x55da92){this[_0x1fc6('0x10')][_0x1fc6('0x14')](_0x7aa77f)[_0x1fc6('0x15')](function(_0xe160d5){_0x55da92(null,_0xe160d5?_0xe160d5[_0x1fc6('0x12')]:![]);})[_0x1fc6('0x13')](function(_0x324fa7){_0x55da92(_0x324fa7);});};AGIVertices[_0x1fc6('0xf')]['getSquareProject']=function(_0xd671fc,_0x48602a){this[_0x1fc6('0x10')][_0x1fc6('0x16')](_0xd671fc)[_0x1fc6('0x15')](function(_0x2b0294){_0x48602a(null,_0x2b0294?_0x2b0294[_0x1fc6('0x12')]:![]);})['catch'](function(_0x3e2996){_0x48602a(_0x3e2996);});};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x17')]=function(_0x3d4fd8,_0xbd94b){this[_0x1fc6('0x10')][_0x1fc6('0x18')](_0x3d4fd8)['then'](function(_0x56a853){_0xbd94b(null,_0x56a853?_0x56a853['dsn']:![]);})[_0x1fc6('0x13')](function(_0x3ae4a3){_0xbd94b(_0x3ae4a3);});};AGIVertices['prototype'][_0x1fc6('0x19')]=function(_0x2b7acb,_0x2d0fe0){this[_0x1fc6('0x10')][_0x1fc6('0x1a')](_0x2b7acb)[_0x1fc6('0x15')](function(_0x1209a4){_0x2d0fe0(null,_0x1209a4?_0x1209a4[_0x1fc6('0x12')]:![]);})[_0x1fc6('0x13')](function(_0xc6965f){_0x2d0fe0(_0xc6965f);});};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x1b')]=function(_0x358d3a,_0x499d83){this[_0x1fc6('0x10')][_0x1fc6('0x1c')](_0x358d3a)[_0x1fc6('0x15')](function(_0x2e326f){_0x499d83(null,_0x2e326f?_0x2e326f[_0x1fc6('0x12')]:![]);})[_0x1fc6('0x13')](function(_0x42bd0d){_0x499d83(_0x42bd0d);});};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x1d')]=function(_0x3de90e,_0x1dc319){var _0x2aa8b=this;this[_0x1fc6('0x10')][_0x1fc6('0x1e')](_0x3de90e)['then'](function(_0x287c3e){_0x1dc319(null,_0x287c3e?_0x2aa8b[_0x1fc6('0x1f')](_0x287c3e[_0x1fc6('0x20')]):![]);})['catch'](function(_0x2f75e2){_0x1dc319(_0x2f75e2);});};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x21')]=function(_0x730883,_0x1ff069){this[_0x1fc6('0x10')][_0x1fc6('0x22')](_0x730883)[_0x1fc6('0x15')](function(_0x56720a){_0x1ff069(null,_0x56720a?_0x56720a:![]);})[_0x1fc6('0x13')](function(_0x279bb5){_0x1ff069(_0x279bb5);});};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x23')]=function(_0x8e8ae8,_0x987ac7,_0x2acfd8){this['mailRpc'][_0x1fc6('0x23')](_0x8e8ae8,_0x987ac7)[_0x1fc6('0x15')](function(){_0x2acfd8(null);})[_0x1fc6('0x13')](function(_0xe7735f){_0x2acfd8(_0xe7735f);});};AGIVertices[_0x1fc6('0xf')]['getIntervals']=function(_0x50491b,_0x2a8d83){this[_0x1fc6('0x10')][_0x1fc6('0x24')](_0x50491b)[_0x1fc6('0x15')](function(_0x5811b0){if(_0x5811b0){if(_0x5811b0[_0x1fc6('0x25')]){_0x2a8d83(null,[_0x5811b0[_0x1fc6('0x26')]]);}else{_0x2a8d83(null,_[_0x1fc6('0x27')](_0x5811b0[_0x1fc6('0x28')],_0x1fc6('0x26')));}}else{_0x2a8d83(null,![]);}})['catch'](function(_0x1260bf){_0x2a8d83(_0x1260bf);});};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x1f')]=function(_0x136fd9){return util[_0x1fc6('0x29')](_0x1fc6('0x2a'),FILES_PATH,_0x136fd9);};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x2b')]=function(_0x1cc480,_0x2671b9,_0x1361a7){odbc[_0x1fc6('0x2c')](_0x1cc480,function(_0x2489d6){if(_0x2489d6){logger[_0x1fc6('0x2d')](_0x1fc6('0x2e'),_0x2489d6);_0x1361a7(_0x2489d6);}else{logger[_0x1fc6('0x2f')](_0x1fc6('0x30'));odbc[_0x1fc6('0x31')](_0x2671b9,function(_0x1c67c3,_0x4e204e){if(_0x1c67c3){logger[_0x1fc6('0x2f')](_0x1fc6('0x32'),_0x2671b9);_0x1361a7(_0x1c67c3);}else{logger[_0x1fc6('0x2f')](_0x1fc6('0x33'),_0x2671b9);odbc['close'](function(_0x1e1da8){if(_0x1e1da8){logger[_0x1fc6('0x2d')](_0x1fc6('0x34'),_0x1e1da8);}_0x1361a7(null,_0x4e204e);});}});}});};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x35')]=function(_0x1f6d6a,_0x51dc5b){this[_0x1fc6('0x10')]['getSmsAccountById'](_0x1f6d6a)[_0x1fc6('0x15')](function(_0x1f495d){_0x51dc5b(null,_0x1f495d?_0x1f495d:![]);})[_0x1fc6('0x13')](function(_0x22ca27){_0x51dc5b(_0x22ca27);});};AGIVertices[_0x1fc6('0xf')]['createSmsMessage']=function(_0x3a1272,_0x39b8ae){this[_0x1fc6('0x10')][_0x1fc6('0x36')](_0x3a1272)[_0x1fc6('0x15')](function(_0x4c310a){_0x39b8ae(null,_0x4c310a);})[_0x1fc6('0x13')](function(_0x3e942d){_0x39b8ae(_0x3e942d);});};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x37')]=function(_0x49f335,_0x3e1dbc,_0x3bafe1){this[_0x1fc6('0x10')][_0x1fc6('0x37')]({'uniqueid':this[_0x1fc6('0xd')][_0x1fc6('0x38')],'node':_0x49f335[_0x1fc6('0x39')],'application':_0x49f335[_0x1fc6('0x3a')],'data':_0x3e1dbc||null,'project_name':this[_0x1fc6('0xd')][_0x1fc6('0x3b')],'callerid':this[_0x1fc6('0xd')]['callerid']})[_0x1fc6('0x15')](function(_0x83463e){if(_0x3bafe1){_0x3bafe1(null,_0x83463e);}})[_0x1fc6('0x13')](function(_0x82594d){if(_0x3bafe1){_0x3bafe1(_0x82594d);}});};AGIVertices['prototype']['createSquareRecording']=function(_0x4fbb76,_0x3f2010,_0x14f49f,_0x2353a2){this['rpc']['createSquareRecording']({'uniqueid':this[_0x1fc6('0xd')]['uniqueid'],'callerid':this[_0x1fc6('0xd')][_0x1fc6('0x3c')],'calleridname':this['channel'][_0x1fc6('0x3d')],'context':this[_0x1fc6('0xd')]['context'],'extension':this['channel'][_0x1fc6('0x3e')],'priority':this['channel']['priority'],'accountcode':this[_0x1fc6('0xd')][_0x1fc6('0x3f')],'dnid':this[_0x1fc6('0xd')][_0x1fc6('0x40')],'projectName':this['channel'][_0x1fc6('0x3b')],'saveName':_0x3f2010,'filename':_0x4fbb76[_0x1fc6('0x41')]||_0x3f2010,'savePath':_0x14f49f})[_0x1fc6('0x15')](function(_0x5b59ab){_0x2353a2(null,_0x5b59ab);})[_0x1fc6('0x13')](function(_0x53ecf7){_0x2353a2(_0x53ecf7);});};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x42')]=function(_0x4ed3ae,_0x16eea6,_0x239fd4,_0x29e624,_0x13c989){this['rpc'][_0x1fc6('0x42')]({'uniqueid':this['channel'][_0x1fc6('0x38')],'body':_0x4ed3ae,'direction':_0x16eea6,'providerName':_0x239fd4,'providerResponse':_0x29e624})['then'](function(_0x3520cf){if(_0x13c989){_0x13c989(null,_0x3520cf);}})[_0x1fc6('0x13')](function(_0x28bde){if(_0x13c989){_0x13c989(_0x28bde);}});};AGIVertices['prototype'][_0x1fc6('0x43')]=function(_0x10b1de,_0x28f94d){this['rpc'][_0x1fc6('0x43')]({'firstName':_['isEmpty'](_0x10b1de[_0x1fc6('0x12')])||_['isNil'](_0x10b1de['name'])?_0x1fc6('0x44')+Math[_0x1fc6('0x45')]():_0x10b1de['name'],'lastName':_['isEmpty'](_0x10b1de['lastName'])||_[_0x1fc6('0x46')](_0x10b1de[_0x1fc6('0x47')])?null:_0x10b1de[_0x1fc6('0x47')],'phone':_0x10b1de[_0x1fc6('0x48')],'ListId':_0x10b1de[_0x1fc6('0x49')],'scheduledat':_0x10b1de[_0x1fc6('0x4a')],'callbackUniqueid':this[_0x1fc6('0xd')][_0x1fc6('0x38')],'tags':_0x1fc6('0x4b'),'description':_0x1fc6('0x4c')+_0x10b1de[_0x1fc6('0x4a')]['toString'](),'priority':_0x10b1de[_0x1fc6('0x4d')]})[_0x1fc6('0x15')](function(_0xeb24e1){_0x28f94d(null,_0xeb24e1);})[_0x1fc6('0x13')](function(_0x139f2e){_0x28f94d(_0x139f2e);});};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x4e')]=function(_0x42b5b1,_0x27ca03){this[_0x1fc6('0x10')][_0x1fc6('0x4f')](_0x42b5b1)[_0x1fc6('0x15')](function(_0x554ffd){_0x27ca03(null,_0x554ffd?_0x554ffd[_0x1fc6('0x12')]:![]);})[_0x1fc6('0x13')](function(_0x359080){_0x27ca03(_0x359080);});};AGIVertices[_0x1fc6('0xf')]['agentPause']=function(_0x403a7b,_0x155440,_0x7f3ad6){var _0x12f174={'role':_0x1fc6('0x50')};_0x12f174[_0x403a7b]=this[_0x1fc6('0xd')]['callerid'];this[_0x1fc6('0x10')]['agentPause'](_0x12f174,_0x155440,this[_0x1fc6('0xd')][_0x1fc6('0x38')])[_0x1fc6('0x15')](function(_0x58b84a){_0x7f3ad6(null,_[_0x1fc6('0x46')](_0x58b84a)?![]:!![]);})[_0x1fc6('0x13')](function(_0x4bd470){logger[_0x1fc6('0x2d')](_0x4bd470);_0x7f3ad6(null,![]);});};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x51')]=function(_0x314fb9,_0x3ad59b){var _0xc83682={'role':_0x1fc6('0x50')};_0xc83682[_0x314fb9]=this[_0x1fc6('0xd')][_0x1fc6('0x3c')];this[_0x1fc6('0x10')][_0x1fc6('0x51')](_0xc83682)[_0x1fc6('0x15')](function(_0x581b16){_0x3ad59b(null,_[_0x1fc6('0x46')](_0x581b16)?![]:!![]);})[_0x1fc6('0x13')](function(_0x49637b){logger[_0x1fc6('0x2d')](_0x49637b);_0x3ad59b(null,![]);});};AGIVertices['prototype'][_0x1fc6('0x52')]=function(_0x3cc47d,_0x107708){var _0x204b1c={'role':_0x1fc6('0x50')};_0x204b1c[_0x3cc47d]=this[_0x1fc6('0xd')][_0x1fc6('0x3c')];this[_0x1fc6('0x10')][_0x1fc6('0x52')](_0x204b1c)[_0x1fc6('0x15')](function(_0x31978f){_0x107708(null,_[_0x1fc6('0x46')](_0x31978f)?![]:!![]);})['catch'](function(_0x53301a){logger[_0x1fc6('0x2d')](_0x53301a);_0x107708(null,![]);});};AGIVertices[_0x1fc6('0xf')]['agentLogin']=function(_0x114fe2,_0x4f5bdb){var _0x2d0392={'role':_0x1fc6('0x50')};_0x2d0392[_0x114fe2]=this['channel'][_0x1fc6('0x3c')];var _0x147a1f=_0x114fe2!=_0x1fc6('0x53')?util[_0x1fc6('0x29')]('%s/%s@from-sip/n',_0x1fc6('0x54'),this['channel'][_0x1fc6('0x3c')]):undefined;this[_0x1fc6('0x10')]['agentLogin'](_0x2d0392,_0x147a1f)[_0x1fc6('0x15')](function(_0x58f0a9){_0x4f5bdb(null,_[_0x1fc6('0x46')](_0x58f0a9)?![]:!![]);})['catch'](function(_0x28ecaa){logger[_0x1fc6('0x2d')](_0x28ecaa);_0x4f5bdb(null,![]);});};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x55')]=function(_0x1f3675,_0x1163c9){sh[_0x1fc6('0x56')](_[_0x1fc6('0x57')](_0x1f3675),function(_0x111fa9,_0x24e94f){var _0x4c35cb=_0x24e94f[_0x1fc6('0x58')](/(\r\n|\n|\r)/gm,'');_0x1163c9(null,_0x4c35cb);});};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x59')]=function(_0x136950,_0x49bb94){scripts[_0x1fc6('0x59')](_0x136950[_0x1fc6('0x5a')],_0x136950[_0x1fc6('0x5b')]||'text',_0x136950[_0x1fc6('0x5c')],_0x136950[_0x1fc6('0x5d')]||_0x1fc6('0x5e'),_0x136950[_0x1fc6('0x5f')]||_0x1fc6('0x60'),_0x136950['audioEncoding']||_0x1fc6('0x61'))[_0x1fc6('0x15')](function(_0x3426f){_0x49bb94(null,_0x3426f);})[_0x1fc6('0x13')](function(_0x4d2c3e){_0x49bb94(_0x4d2c3e);});};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x62')]=function(_0x44769d,_0x54a83d){scripts['googleTTS'](_0x44769d[_0x1fc6('0x5c')],_0x44769d[_0x1fc6('0x63')]||'en',0x1)['then'](function(_0x3ad744){_0x54a83d(null,_0x3ad744);})[_0x1fc6('0x13')](function(_0x5aa035){_0x54a83d(_0x5aa035);});};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x64')]=function(_0x2092ce,_0x3c4b79){var _0x224ba2={'uri':_0x2092ce['url'],'method':_0x2092ce[_0x1fc6('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2092ce['timeout'])===_0x1fc6('0x66')&&parseInt(_0x2092ce[_0x1fc6('0x67')])>=0x1?parseInt(_0x2092ce['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x1fc6('0x68')](['POST',_0x1fc6('0x69')],_0x224ba2[_0x1fc6('0x65')][_0x1fc6('0x6a')]())){try{_0x224ba2['body']=_0x2092ce[_0x1fc6('0xa')]?JSON['parse'](_0x2092ce[_0x1fc6('0xa')]):{};}catch(_0x1719f2){logger['error'](_0x1fc6('0x6b'),_0x1719f2);}}try{_0x224ba2[_0x1fc6('0x6c')]=_0x2092ce[_0x1fc6('0x9')]?JSON['parse'](_0x2092ce['rawHeaders']):{};}catch(_0x155df0){logger[_0x1fc6('0x2d')](_0x1fc6('0x6d'),_0x155df0);}if(_0x2092ce[_0x1fc6('0x6e')]){try{var _0xb751f2=require(_0x2092ce[_0x1fc6('0x6e')])[_0x1fc6('0x6f')](this,_0x224ba2);_0x224ba2[_0x1fc6('0x70')]=Mustache[_0x1fc6('0x71')](_0x2092ce['url'],_0xb751f2,{},['$$','$$']);if(_0x224ba2[_0x1fc6('0x6c')]){_0x224ba2['headers']=JSON['parse'](Mustache[_0x1fc6('0x71')](JSON[_0x1fc6('0x72')](_0x224ba2['headers']),_0xb751f2,{},['$$','$$']));}if(_0x224ba2[_0x1fc6('0x73')]){_0x224ba2[_0x1fc6('0x73')]=JSON[_0x1fc6('0x74')](Mustache[_0x1fc6('0x71')](JSON['stringify'](_0x224ba2[_0x1fc6('0x73')]),_0xb751f2,{},['$$','$$']));}}catch(_0x213273){logger[_0x1fc6('0x2d')](_0x1fc6('0x75'),_0x213273);}}rp(_0x224ba2)['then'](function(_0x58ac6d){var _0x597e86={'statusCode':_0x58ac6d['statusCode']||0xc8,'statusMessage':_0x58ac6d[_0x1fc6('0x76')]||'OK','headers':_0x58ac6d[_0x1fc6('0x6c')]||{},'body':_0x58ac6d[_0x1fc6('0x73')]||{}};_0x3c4b79(null,_0x597e86);})['catch'](function(_0x4e3afa){var _0x4e466e={'statusCode':_0x4e3afa[_0x1fc6('0x77')]||0x1f4,'statusMessage':_0x4e3afa[_0x1fc6('0x78')]||_0x1fc6('0x79'),'headers':_0x4e3afa['options']['headers']||{},'body':_0x4e3afa[_0x1fc6('0x7a')][_0x1fc6('0x73')]||{}};_0x3c4b79(null,_0x4e466e);});};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x7b')]=function(_0x5a2742,_0x35db2f){scripts[_0x1fc6('0x7b')](this['channel'][_0x1fc6('0x38')],_0x5a2742['key'],_0x5a2742[_0x1fc6('0x5c')],_0x5a2742['dialogflow_language']||'en')['then'](function(_0x264f0){_0x35db2f(null,_0x264f0);})['catch'](function(_0x6ce18f){_0x35db2f(_0x6ce18f);});};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x7c')]=function(_0x5676ef,_0xf43e22){scripts[_0x1fc6('0x7c')](this['channel'][_0x1fc6('0x38')],_0x5676ef[_0x1fc6('0x7d')],_0x5676ef['client_email'],_0x5676ef[_0x1fc6('0x7e')],_0x5676ef['text'],_0x5676ef[_0x1fc6('0x7f')]||'en')[_0x1fc6('0x15')](function(_0x3a9b00){_0xf43e22(null,_0x3a9b00);})['catch'](function(_0x3489d4){_0xf43e22(_0x3489d4);});};AGIVertices['prototype'][_0x1fc6('0x80')]=function(_0x2d7233,_0x1fedbc){scripts['sestekNDA'](this[_0x1fc6('0xd')],_0x2d7233)[_0x1fc6('0x15')](function(_0x1c59e9){_0x1fedbc(null,_0x1c59e9);})['catch'](function(_0x16e7fd){_0x1fedbc(_0x16e7fd);});};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x81')]=function(_0x6de0dd,_0x19a706){scripts['ispeechTTS'](_0x6de0dd[_0x1fc6('0x82')],_0x6de0dd[_0x1fc6('0x5c')],_0x6de0dd[_0x1fc6('0x83')]||_0x1fc6('0x5e'),_0x6de0dd[_0x1fc6('0x84')])['then'](function(_0x33aa62){_0x19a706(null,_0x33aa62);})['catch'](function(_0x4bf531){_0x19a706(_0x4bf531);});};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x85')]=function(_0x5e819f,_0x1ccb2e,_0x1f7eb1){scripts[_0x1fc6('0x85')](_0x1ccb2e,_0x5e819f[_0x1fc6('0x82')],_0x5e819f[_0x1fc6('0x86')]||_0x1fc6('0x5e'),this[_0x1fc6('0x87')](_0x5e819f[_0x1fc6('0x88')])?_0x5e819f[_0x1fc6('0x88')]:undefined)[_0x1fc6('0x15')](function(_0x10f51e){_0x1f7eb1(null,_0x10f51e);})[_0x1fc6('0x13')](function(_0x3fcca9){_0x1f7eb1(_0x3fcca9);});};AGIVertices[_0x1fc6('0xf')]['awsPolly']=function(_0xe5aefe,_0x37e144){scripts[_0x1fc6('0x89')](_0xe5aefe[_0x1fc6('0x8a')],_0xe5aefe[_0x1fc6('0x8b')],_0xe5aefe['aws_polly_region'],_0xe5aefe['aws_polly_voice']||_0x1fc6('0x8c'),_0xe5aefe[_0x1fc6('0x5c')],_0xe5aefe['aws_text_type']||_0x1fc6('0x5c'))[_0x1fc6('0x15')](function(_0x1f42db){_0x37e144(null,_0x1f42db);})[_0x1fc6('0x13')](function(_0x233031){_0x37e144(_0x233031);});};AGIVertices[_0x1fc6('0xf')]['awsLex']=function(_0x27d357,_0x11e2f5){scripts[_0x1fc6('0x8d')](this['channel'][_0x1fc6('0x38')],_0x27d357[_0x1fc6('0x8a')],_0x27d357['aws_secret_access_key'],_0x27d357[_0x1fc6('0x8e')],_0x27d357['text'],_0x27d357[_0x1fc6('0x8f')])[_0x1fc6('0x15')](function(_0x416520){_0x11e2f5(null,_0x416520);})[_0x1fc6('0x13')](function(_0x1c2f40){_0x11e2f5(_0x1c2f40);});};AGIVertices[_0x1fc6('0xf')]['googleASR']=function(_0x1c01a6,_0x305437,_0x4746e0){scripts[_0x1fc6('0x90')](_0x305437,_0x1c01a6[_0x1fc6('0x82')],_0x1c01a6[_0x1fc6('0x91')]||_0x1fc6('0x5e'))[_0x1fc6('0x15')](function(_0x53f4e6){_0x4746e0(null,_0x53f4e6);})['catch'](function(_0x153e9d){_0x4746e0(_0x153e9d);});};AGIVertices['prototype'][_0x1fc6('0x92')]=function(_0x5ccb33,_0x3bcca9,_0x332027){scripts['tildeASR'](_0x3bcca9,_0x5ccb33[_0x1fc6('0x93')],_0x5ccb33[_0x1fc6('0x94')],_0x5ccb33[_0x1fc6('0x70')])[_0x1fc6('0x15')](function(_0x22fc07){_0x332027(null,_0x22fc07);})['catch'](function(_0x14e846){_0x332027(_0x14e846);});};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x95')]=function(_0x3cec17){var _0x280170=_['includes'](verticesWithRetry,_0x3cec17[_0x1fc6('0x3a')])?_0x3cec17:_[_0x1fc6('0x96')](_0x3cec17);for(var _0x215dd0 in _0x280170){if(_0x280170[_0x1fc6('0x97')](_0x215dd0)){if(_0x280170[_0x215dd0]&&_[_0x1fc6('0x98')](_0x280170[_0x215dd0])){if(_[_0x1fc6('0x68')](recursiveMapAttributes,_0x215dd0)){_0x280170[_0x215dd0]=this[_0x1fc6('0x99')](_0x280170[_0x215dd0]);}else{_0x280170[_0x215dd0]=this[_0x1fc6('0x9a')](_0x280170[_0x215dd0]);}}}}return _0x280170;};AGIVertices['prototype'][_0x1fc6('0x9b')]=function(_0x61c784){for(var _0x1db139 in _0x61c784){if(_0x61c784[_0x1fc6('0x97')](_0x1db139)){if(_[_0x1fc6('0x9c')](_0x61c784[_0x1db139])){this[_0x1fc6('0x9b')](_0x61c784[_0x1db139]);}else if(_[_0x1fc6('0x9d')](_0x61c784[_0x1db139])){for(var _0x2dcb6c=0x0;_0x2dcb6c<_0x61c784[_0x1db139]['length'];_0x2dcb6c++){this[_0x1fc6('0x9b')](_0x61c784[_0x1db139][_0x2dcb6c]);}}else if(_[_0x1fc6('0x98')](_0x61c784[_0x1db139])){_0x61c784[_0x1db139]=this[_0x1fc6('0x9a')](_0x61c784[_0x1db139]);}}}};AGIVertices['prototype'][_0x1fc6('0x9e')]=function(_0x443389,_0x26bc3b){for(var _0x7ec348 in _0x443389){if(_0x443389[_0x1fc6('0x97')](_0x7ec348)){if(_[_0x1fc6('0x9c')](_0x443389[_0x7ec348])){if(!_[_0x1fc6('0x9f')](_0x443389[_0x7ec348])){this['saveRestApiResult'](_0x443389[_0x7ec348],util[_0x1fc6('0x29')](_0x1fc6('0xa0'),_0x26bc3b,_0x7ec348));}}else if(_[_0x1fc6('0x9d')](_0x443389[_0x7ec348])){for(var _0x4a07aa=0x0;_0x4a07aa<_0x443389[_0x7ec348][_0x1fc6('0xa1')];_0x4a07aa++){this[_0x1fc6('0x9e')](_0x443389[_0x7ec348][_0x4a07aa],util[_0x1fc6('0x29')](_0x1fc6('0xa0'),_0x26bc3b,_0x7ec348+'['+_0x4a07aa+']'));}}else{if(!_[_0x1fc6('0x46')](_0x443389[_0x7ec348])){this[_0x1fc6('0xd')][_0x1fc6('0xa2')](util[_0x1fc6('0x29')](_0x1fc6('0xa0'),_0x26bc3b,_0x7ec348),_0x443389[_0x7ec348]);}}}}};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x99')]=function(_0x5d268e){try{var _0x58b698=JSON[_0x1fc6('0x74')](_0x5d268e);this[_0x1fc6('0x9b')](_0x58b698);return JSON[_0x1fc6('0x72')](_0x58b698);}catch(_0x21a10c){return this[_0x1fc6('0x9a')](_0x5d268e);}};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x9a')]=function(_0x1c7082){var _0x3c2e50=_0x1c7082[_0x1fc6('0xa3')]('{');for(var _0x4559ed=0x1;_0x4559ed<_0x3c2e50[_0x1fc6('0xa1')];_0x4559ed+=0x1){var _0x3bdb5d=_0x3c2e50[_0x4559ed]['split']('}');if(_0x3bdb5d[_0x1fc6('0xa1')]>0x1){_0x1c7082=_0x1c7082[_0x1fc6('0xa4')]('{'+_0x3bdb5d[0x0]+'}',this[_0x1fc6('0xd')][_0x1fc6('0xa5')](_0x3bdb5d[0x0])['extra']||_0x3bdb5d[0x0]);}}if(_0x3c2e50[_0x1fc6('0xa1')]===0x1){return _0x1c7082[_0x1fc6('0xa6')]();}return this[_0x1fc6('0x9a')](_0x1c7082);};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0xa7')]=function(_0x2e080c,_0x5e3a52){var _0x3c36ca=this[_0x1fc6('0xd')][_0x1fc6('0xa5')](_0x2e080c);if(_0x3c36ca[_0x1fc6('0xa8')]===-0x1){return _0x3c36ca;}logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0xa9'),_0x5e3a52,_0x3c36ca[_0x1fc6('0xaa')]));return this['channel'][_0x1fc6('0xa2')](_0x5e3a52,_0x3c36ca['extra']);};AGIVertices['prototype'][_0x1fc6('0x87')]=function(_0x53329c){return _0x53329c&&_0x53329c!=='0'&&_0x53329c!=='-1'&&_0x53329c!=='';};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0xab')]=function(_0x560130){this['createSquareDetailsReport'][_0x1fc6('0x6f')](this,_0x560130,'-');_0x560130[_0x1fc6('0xac')]=_0x560130[_0x1fc6('0xab')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0xad')]=function(_0x43966e){logger['info'](util[_0x1fc6('0x29')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x43966e[_0x1fc6('0x39')]));if(!this['isConfigured'](_0x43966e['text'])){return this['channel'][_0x1fc6('0xae')](_0x1fc6('0xaf'));}var _0xdbf2a0='\x22'+_0x43966e[_0x1fc6('0x5c')]+'\x22';if(this[_0x1fc6('0x87')](_0x43966e[_0x1fc6('0x7a')])){_0xdbf2a0+=','+_0x43966e[_0x1fc6('0x7a')];}var _0x5d0044=this['channel'][_0x1fc6('0x56')](_0x1fc6('0xb0'),_0xdbf2a0);if(_0x5d0044[_0x1fc6('0xa8')]===-0x1){return _0x5d0044;}return this['channel'][_0x1fc6('0xae')](util[_0x1fc6('0x29')](_0x1fc6('0xb1'),_0xdbf2a0));};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0xb2')]=function(_0x9bec7){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x9bec7['label']));if(!this[_0x1fc6('0x87')](_0x9bec7[_0x1fc6('0xb3')])){return this[_0x1fc6('0xd')]['noop'](_0x1fc6('0xb4'));}var _0x575840=_0x9bec7['grammar'];if(this[_0x1fc6('0x87')](_0x9bec7['options'])){_0x575840+=','+_0x9bec7[_0x1fc6('0x7a')];}var _0x15dd2e=this['channel']['exec'](_0x1fc6('0xb5'),_0x575840);if(_0x15dd2e[_0x1fc6('0xa8')]===-0x1){return _0x15dd2e;}var _0x3b1afc=this['getAndSetVariable'](_0x1fc6('0xb6'),_0x1fc6('0xb7'));if(_0x3b1afc[_0x1fc6('0xa8')]===-0x1){return _0x3b1afc;}var _0x379d36=this['getAndSetVariable'](_0x1fc6('0xb8'),_0x1fc6('0xb9'));if(_0x379d36[_0x1fc6('0xa8')]===-0x1){return _0x379d36;}var _0x540a0b=this[_0x1fc6('0xa7')](_0x1fc6('0xba'),_0x1fc6('0xbb'));if(_0x540a0b[_0x1fc6('0xa8')]===-0x1){return _0x540a0b;}return this[_0x1fc6('0xd')][_0x1fc6('0xae')](util['format'](_0x1fc6('0xbc'),_0x575840));};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x6')]=function(_0x4c5220){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0xbd'),_0x4c5220[_0x1fc6('0x39')]));return this['channel'][_0x1fc6('0x6')]([_0x4c5220['command'],_0x4c5220[_0x1fc6('0xbe')]]);};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0xbf')]=function(_0x308c57){logger[_0x1fc6('0x2f')](util['format'](_0x1fc6('0xc0'),_0x308c57[_0x1fc6('0x39')]));if(this['isConfigured'](_0x308c57[_0x1fc6('0x67')])){logger[_0x1fc6('0x2f')](util['format'](_0x1fc6('0xc1'),_0x308c57[_0x1fc6('0x67')]));var _0x1fca7d=this[_0x1fc6('0xd')][_0x1fc6('0xc2')](_0x308c57['timeout']);if(_0x1fca7d[_0x1fc6('0xa8')]===-0x1){return _0x1fca7d;}}return this[_0x1fc6('0xd')]['answer']();};AGIVertices[_0x1fc6('0xf')]['callback']=function(_0x151a8e){logger[_0x1fc6('0x2f')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x151a8e[_0x1fc6('0x39')]));if(!this[_0x1fc6('0x87')](_0x151a8e[_0x1fc6('0x49')])){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x151a8e,_0x1fc6('0xc3'));}_0x151a8e[_0x1fc6('0x4a')]=moment();if(this[_0x1fc6('0x87')](_0x151a8e['delay'])){_0x151a8e['scheduledAt']=moment()['add'](_0x151a8e[_0x1fc6('0xc4')],_0x1fc6('0xc5'));}if(!this['isConfigured'](_0x151a8e[_0x1fc6('0x4d')])){_0x151a8e['callback_priority']=0x2;}this[_0x1fc6('0x43')][_0x1fc6('0x6f')](this,_0x151a8e);return this[_0x1fc6('0xd')][_0x1fc6('0xae')](util[_0x1fc6('0x29')](_0x1fc6('0xc6'),_0x151a8e[_0x1fc6('0x48')],_0x151a8e[_0x1fc6('0x49')],_0x151a8e[_0x1fc6('0x4a')]));};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0xc7')]=function(_0x7413ed){logger['info'](util[_0x1fc6('0x29')](_0x1fc6('0xc8'),_0x7413ed[_0x1fc6('0x39')]));var _0x87550f=this[_0x1fc6('0xd')][_0x1fc6('0x56')](_0x7413ed[_0x1fc6('0xc9')],_0x7413ed[_0x1fc6('0x7a')]);if(_0x87550f[_0x1fc6('0xa8')]===-0x1){return _0x87550f;}return this['channel'][_0x1fc6('0xae')](util['format'](_0x1fc6('0xca'),_0x7413ed[_0x1fc6('0xc9')],_0x7413ed[_0x1fc6('0x7a')]));};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0xcb')]=function(_0x8200a){logger['info'](util[_0x1fc6('0x29')](_0x1fc6('0xcc'),_0x8200a[_0x1fc6('0x39')]));if(!this['isConfigured'](_0x8200a['text'])){return this[_0x1fc6('0xd')][_0x1fc6('0xae')](_0x1fc6('0xaf'));}var _0x39dd84='\x22'+_0x8200a[_0x1fc6('0x5c')]+'\x22';if(this['isConfigured'](_0x8200a[_0x1fc6('0x7a')])){_0x39dd84+=','+_0x8200a[_0x1fc6('0x7a')];}var _0x38caac=this[_0x1fc6('0xd')][_0x1fc6('0x56')](_0x1fc6('0xb0'),_0x39dd84);if(_0x38caac['result']===-0x1){return _0x38caac;}return this[_0x1fc6('0xd')][_0x1fc6('0xae')](util[_0x1fc6('0x29')](_0x1fc6('0xb1'),_0x39dd84));};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0xcd')]=function(_0x465936){logger['info'](util['format'](_0x1fc6('0xce'),_0x465936[_0x1fc6('0x39')]));if(!this['isConfigured'](_0x465936[_0x1fc6('0x5c')])){return this['channel'][_0x1fc6('0xae')]('no\x20text\x20configured');}var _0x166357='\x22'+_0x465936[_0x1fc6('0x5c')]+'\x22';if(this['isConfigured'](_0x465936[_0x1fc6('0x7a')])){_0x166357+=','+_0x465936['options'];}var _0x279bf7=this[_0x1fc6('0xd')]['exec'](_0x1fc6('0xb0'),_0x166357);if(_0x279bf7[_0x1fc6('0xa8')]===-0x1){return _0x279bf7;}return this[_0x1fc6('0xd')][_0x1fc6('0xae')](util['format'](_0x1fc6('0xb1'),_0x166357));};AGIVertices['prototype'][_0x1fc6('0xcf')]=function(_0x3cc3d6){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0xd0'),_0x3cc3d6[_0x1fc6('0x39')]));if(!this[_0x1fc6('0x87')](_0x3cc3d6['grammar'])){return this[_0x1fc6('0xd')]['noop']('no\x20grammar\x20configured');}var _0x2bb90b=_0x3cc3d6['grammar'];if(this['isConfigured'](_0x3cc3d6['options'])){_0x2bb90b+=','+_0x3cc3d6[_0x1fc6('0x7a')];}var _0x18d6c4=this[_0x1fc6('0xd')][_0x1fc6('0x56')](_0x1fc6('0xb5'),_0x2bb90b);if(_0x18d6c4[_0x1fc6('0xa8')]===-0x1){return _0x18d6c4;}var _0x11c2ac=this[_0x1fc6('0xa7')](_0x1fc6('0xb6'),_0x1fc6('0xd1'));if(_0x11c2ac['result']===-0x1){return _0x11c2ac;}var _0x5bd93f=this[_0x1fc6('0xa7')](_0x1fc6('0xb8'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x5bd93f[_0x1fc6('0xa8')]===-0x1){return _0x5bd93f;}var _0x219ff0=this['getAndSetVariable'](_0x1fc6('0xba'),'LUMENVOX_ASR_INSTANCE');if(_0x219ff0[_0x1fc6('0xa8')]===-0x1){return _0x219ff0;}return this['channel'][_0x1fc6('0xae')](util[_0x1fc6('0x29')](_0x1fc6('0xbc'),_0x2bb90b));};AGIVertices['prototype'][_0x1fc6('0xd2')]=function(_0x3a3c0d){logger['info'](util[_0x1fc6('0x29')](_0x1fc6('0xd3'),_0x3a3c0d['label']));if(!this[_0x1fc6('0x87')](_0x3a3c0d[_0x1fc6('0xb3')])){return this[_0x1fc6('0xd')][_0x1fc6('0xae')](_0x1fc6('0xb4'));}var _0x2c1bfc=_0x3a3c0d[_0x1fc6('0xb3')];if(this['isConfigured'](_0x3a3c0d[_0x1fc6('0x7a')])){_0x2c1bfc+=','+_0x3a3c0d['options'];}var _0x2db7c3=this[_0x1fc6('0xd')][_0x1fc6('0x56')](_0x1fc6('0xb5'),_0x2c1bfc);if(_0x2db7c3[_0x1fc6('0xa8')]===-0x1){return _0x2db7c3;}var _0x547eae=this[_0x1fc6('0xa7')](_0x1fc6('0xb6'),_0x1fc6('0xd4'));if(_0x547eae[_0x1fc6('0xa8')]===-0x1){return _0x547eae;}var _0x3fce65=this[_0x1fc6('0xa7')](_0x1fc6('0xb8'),_0x1fc6('0xd5'));if(_0x3fce65[_0x1fc6('0xa8')]===-0x1){return _0x3fce65;}var _0x5e980b=this['getAndSetVariable']('RECOG_INSTANCE()',_0x1fc6('0xd6'));if(_0x5e980b[_0x1fc6('0xa8')]===-0x1){return _0x5e980b;}return this[_0x1fc6('0xd')]['noop'](util[_0x1fc6('0x29')](_0x1fc6('0xbc'),_0x2c1bfc));};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0xd7')]=function(_0x4fe0bd){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0xd8'),_0x4fe0bd[_0x1fc6('0x39')]));if(!this[_0x1fc6('0x87')](_0x4fe0bd[_0x1fc6('0xd9')])){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x4fe0bd,_0x1fc6('0xda'));}var _0x10c848=this[_0x1fc6('0x17')][_0x1fc6('0x6f')](this,_0x4fe0bd['odbc_id']);if(!_0x10c848){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x4fe0bd,'no\x20odbc\x20database\x20found');}if(!this[_0x1fc6('0x87')](_0x4fe0bd[_0x1fc6('0x31')])){return this[_0x1fc6('0xd')]['error'](_0x4fe0bd,_0x1fc6('0xdb'));}var _0x3f6032=_0x4fe0bd[_0x1fc6('0x31')][_0x1fc6('0x58')](/(\r\n|\n|\r)/gm,'\x20');this[_0x1fc6('0xd')][_0x1fc6('0xae')](util[_0x1fc6('0x29')](_0x1fc6('0xdc'),_0x3f6032));var _0x5e00f1=this['getQueryOdbc'][_0x1fc6('0x6f')](this,_0x10c848,_0x3f6032);this[_0x1fc6('0x37')][_0x1fc6('0x6f')](this,_0x4fe0bd,_0x3f6032);if(!this[_0x1fc6('0x87')](_0x4fe0bd[_0x1fc6('0xdd')])){return this[_0x1fc6('0xd')][_0x1fc6('0xae')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x162715=this[_0x1fc6('0xa5')][_0x1fc6('0x6f')](this,_0x4fe0bd[_0x1fc6('0xdd')]);if(!_0x162715){return this['channel'][_0x1fc6('0x2d')](_0x4fe0bd,'no\x20variable\x20found');}var _0x109431=this;_0x5e00f1['forEach'](function(_0x4d30c8,_0x25d76a){Object[_0x1fc6('0xde')](_0x4d30c8)[_0x1fc6('0xdf')](function(_0x56e84f){_0x109431['channel'][_0x1fc6('0xa2')](util[_0x1fc6('0x29')](_0x1fc6('0xe0'),_0x162715,_0x25d76a,_0x56e84f),_0x4d30c8[_0x56e84f]);});});this[_0x1fc6('0xd')]['setVariable'](util[_0x1fc6('0x29')](_0x1fc6('0xe1'),_0x162715),_0x5e00f1[_0x1fc6('0xa1')]);return this[_0x1fc6('0xd')]['noop'](util[_0x1fc6('0x29')](_0x1fc6('0xe2'),_0x162715));};AGIVertices[_0x1fc6('0xf')]['dial']=function(_0xf42ff9){logger[_0x1fc6('0xe3')](util[_0x1fc6('0x29')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0xf42ff9[_0x1fc6('0x39')]));if(!this['isConfigured'](_0xf42ff9['sip_id'])){return this[_0x1fc6('0xd')]['error'](_0xf42ff9,_0x1fc6('0xe4'));}var _0x45512b=this[_0x1fc6('0x19')][_0x1fc6('0x6f')](this,_0xf42ff9[_0x1fc6('0xe5')]);if(!_0x45512b){return this[_0x1fc6('0xd')]['error'](_0xf42ff9,_0x1fc6('0xe6'));}var _0x11a832=this[_0x1fc6('0xd')][_0x1fc6('0x56')](_0x1fc6('0xe7'),[util[_0x1fc6('0x29')]('SIP/%s',_0x45512b),_0xf42ff9[_0x1fc6('0x67')],_0xf42ff9['opts'],_0xf42ff9['url']]);if(_0x11a832['result']===-0x1){return _0x11a832;}return this[_0x1fc6('0xd')][_0x1fc6('0xae')](util[_0x1fc6('0x29')]('Executed\x20command\x20%s',_0x1fc6('0xe7')));};AGIVertices[_0x1fc6('0xf')]['dialogflow']=function(_0x3a1fdf){logger[_0x1fc6('0x2f')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x3a1fdf[_0x1fc6('0x39')]));if(!this['isConfigured'](_0x3a1fdf[_0x1fc6('0x82')])){return this['channel'][_0x1fc6('0xae')](_0x1fc6('0xe8'));}if(!this['isConfigured'](_0x3a1fdf[_0x1fc6('0x5c')])){return this[_0x1fc6('0xd')][_0x1fc6('0xae')](_0x1fc6('0xaf'));}this[_0x1fc6('0xd')]['bot']=!![];this[_0x1fc6('0x37')](_0x3a1fdf);this[_0x1fc6('0x42')](_0x3a1fdf[_0x1fc6('0x5c')],'in','','');this[_0x1fc6('0xd')][_0x1fc6('0xae')](util[_0x1fc6('0x29')]('Trying\x20Dialogflow:\x20%s',_0x3a1fdf[_0x1fc6('0x5c')]));var _0x487224=this['googleDialogflow'][_0x1fc6('0x6f')](this,_0x3a1fdf);if(_0x487224){for(var _0x58a16b in _0x487224){if(_0x487224[_0x1fc6('0x97')](_0x58a16b)){this[_0x1fc6('0xd')]['setVariable'](util[_0x1fc6('0x29')](_0x1fc6('0xe9'),_0x58a16b[_0x1fc6('0x6a')]()),_0x487224[_0x58a16b]);}}this['createSquareMessage'](_0x487224[_0x1fc6('0xea')],_0x1fc6('0xeb'),_0x1fc6('0xec'),'');return this['channel'][_0x1fc6('0xae')](util[_0x1fc6('0x29')]('Dialogflow\x20Result\x20%s',_0x487224[_0x1fc6('0xea')]));}return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x3a1fdf,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x1fc6('0xf')]['dialogflowV2']=function(_0x2aee24){logger['info'](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x2aee24[_0x1fc6('0x39')]));if(!this['isConfigured'](_0x2aee24[_0x1fc6('0x7d')])){return this[_0x1fc6('0xd')][_0x1fc6('0xae')]('no\x20project_id\x20configured');}if(!this[_0x1fc6('0x87')](_0x2aee24['client_email'])){return this['channel'][_0x1fc6('0xae')](_0x1fc6('0xed'));}if(!this[_0x1fc6('0x87')](_0x2aee24['private_key'])){return this[_0x1fc6('0xd')][_0x1fc6('0xae')](_0x1fc6('0xee'));}if(!this[_0x1fc6('0x87')](_0x2aee24[_0x1fc6('0x7f')])){return this[_0x1fc6('0xd')][_0x1fc6('0xae')](_0x1fc6('0xef'));}if(!this[_0x1fc6('0x87')](_0x2aee24[_0x1fc6('0x5c')])){return this['channel']['noop'](_0x1fc6('0xaf'));}this[_0x1fc6('0xd')]['bot']=!![];this[_0x1fc6('0x37')](_0x2aee24);this[_0x1fc6('0x42')](_0x2aee24[_0x1fc6('0x5c')],'in','','');this[_0x1fc6('0xd')][_0x1fc6('0xae')](util['format'](_0x1fc6('0xf0'),_0x2aee24[_0x1fc6('0x5c')]));var _0x1d822e=this['googleDialogflowV2']['sync'](this,_0x2aee24);if(_0x1d822e){for(var _0xed6301 in _0x1d822e){if(_0x1d822e['hasOwnProperty'](_0xed6301)){if(_0xed6301!==_0x1fc6('0xf1')){this['channel']['setVariable'](util[_0x1fc6('0x29')](_0x1fc6('0xe9'),_0xed6301[_0x1fc6('0x6a')]()),_0x1d822e[_0xed6301]);}}}this[_0x1fc6('0x42')](_0x1d822e['speech'],_0x1fc6('0xeb'),_0x1fc6('0xf2'),_0x1d822e[_0x1fc6('0xf1')]);return this[_0x1fc6('0xd')][_0x1fc6('0xae')](util[_0x1fc6('0x29')]('DialogflowV2\x20Result\x20%s',_0x1d822e[_0x1fc6('0xea')]));}return this['channel'][_0x1fc6('0x2d')](_0x2aee24,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0xf3')]=function(_0x1dfc01){logger['info'](util[_0x1fc6('0x29')](_0x1fc6('0xf4'),_0x1dfc01[_0x1fc6('0x39')]));if(!this[_0x1fc6('0x87')](_0x1dfc01['ndauth_url'])){return this[_0x1fc6('0xd')][_0x1fc6('0xae')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x1dfc01[_0x1fc6('0xf5')])){return this[_0x1fc6('0xd')][_0x1fc6('0xae')](_0x1fc6('0xf6'));}if(!this[_0x1fc6('0x87')](_0x1dfc01[_0x1fc6('0xf7')])){return this[_0x1fc6('0xd')][_0x1fc6('0xae')](_0x1fc6('0xf8'));}if(!this[_0x1fc6('0x87')](_0x1dfc01[_0x1fc6('0xf9')])){return this['channel'][_0x1fc6('0xae')](_0x1fc6('0xaf'));}this['channel'][_0x1fc6('0xfa')]=!![];this[_0x1fc6('0x37')](_0x1dfc01);this[_0x1fc6('0x42')](_0x1dfc01[_0x1fc6('0x5c')],'in','','');this[_0x1fc6('0xd')][_0x1fc6('0xae')](util['format'](_0x1fc6('0xfb'),_0x1dfc01['text']));var _0x4742a0=this[_0x1fc6('0x80')][_0x1fc6('0x6f')](this,_0x1dfc01);if(_0x4742a0){for(var _0x8c91b6 in _0x4742a0){if(_0x4742a0[_0x1fc6('0x97')](_0x8c91b6)){this[_0x1fc6('0xd')][_0x1fc6('0xa2')](util[_0x1fc6('0x29')](_0x1fc6('0xfc'),_0x8c91b6[_0x1fc6('0x6a')]()),_0x4742a0[_0x8c91b6]);}}this[_0x1fc6('0x42')](_0x4742a0[_0x1fc6('0xea')],'out',_0x1fc6('0xf3'),'');if(_0x4742a0[_0x1fc6('0xfd')]){this[_0x1fc6('0xd')][_0x1fc6('0xae')](util[_0x1fc6('0x29')](_0x1fc6('0xfe'),_0x4742a0[_0x1fc6('0xfd')]));var _0x3f1c7d=this[_0x1fc6('0xd')][_0x1fc6('0xff')](_0x4742a0[_0x1fc6('0xfd')]);try{fs['unlink'](_0x4742a0['audiofile']+'.wav');}catch(_0x3b32d0){logger['error'](_0x3b32d0);}return _0x3f1c7d;}else{return this[_0x1fc6('0xd')][_0x1fc6('0xae')](util['format'](_0x1fc6('0x100'),_0x4742a0[_0x1fc6('0xea')]));}}return this[_0x1fc6('0xd')]['error'](_0x1dfc01,_0x1fc6('0x101'));};AGIVertices[_0x1fc6('0xf')]['end']=function(_0x401b1c){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x102'),_0x401b1c[_0x1fc6('0x39')]));return this['channel'][_0x1fc6('0xae')](_0x1fc6('0x103'));};AGIVertices[_0x1fc6('0xf')]['ext_dial']=function(_0x1e003b){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x104'),_0x1e003b[_0x1fc6('0x39')]));var _0x3cad3c='';if(_0x1e003b[_0x1fc6('0x105')]){if(!this['isConfigured'](_0x1e003b[_0x1fc6('0x105')])){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x1e003b,_0x1fc6('0x106'));}else{var _0x1c5040=parseInt(_0x1e003b['trunk_id'],0xa);if(isNaN(_0x1c5040)){_0x3cad3c=_0x1e003b['trunk_id'];}else{_0x3cad3c=this[_0x1fc6('0x1b')]['sync'](this,_0x1e003b[_0x1fc6('0x105')]);if(!_0x3cad3c){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x1e003b,_0x1fc6('0x107'));}}}}else if(_0x1e003b[_0x1fc6('0x108')]){_0x3cad3c=_0x1e003b['trunk_name'];}else{return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x1e003b,_0x1fc6('0x106'));}var _0x35a535=this[_0x1fc6('0xd')][_0x1fc6('0x56')]('DIAL',[util['format'](_0x1fc6('0x109'),_0x3cad3c,_0x1e003b[_0x1fc6('0x48')]),_0x1e003b[_0x1fc6('0x67')],_0x1e003b[_0x1fc6('0x10a')],_0x1e003b[_0x1fc6('0x10b')]]);if(_0x35a535[_0x1fc6('0xa8')]===-0x1){return _0x35a535;}return this[_0x1fc6('0xd')]['noop'](util['format'](_0x1fc6('0x10c'),_0x1fc6('0xe7')));};AGIVertices[_0x1fc6('0xf')]['finally']=function(_0x92a3fd){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x10d'),_0x92a3fd[_0x1fc6('0x39')]));return this[_0x1fc6('0xd')][_0x1fc6('0xae')]('finally');};AGIVertices[_0x1fc6('0xf')]['getdigits']=function(_0x1aa108){logger['info'](util[_0x1fc6('0x29')](_0x1fc6('0x10e'),_0x1aa108[_0x1fc6('0x39')]));if(_0x1aa108['retry']===0x0){return this[_0x1fc6('0xab')](_0x1aa108);}_0x1aa108[_0x1fc6('0xac')]-=0x1;if(!this[_0x1fc6('0x87')](_0x1aa108[_0x1fc6('0x10f')])){return this[_0x1fc6('0xd')]['error'](_0x1aa108,'no\x20file\x20audio\x20selected');}var _0x503584=this[_0x1fc6('0x1d')][_0x1fc6('0x6f')](this,_0x1aa108[_0x1fc6('0x10f')]);if(!_0x503584){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x1aa108,'no\x20file\x20audio\x20found');}if(!this[_0x1fc6('0x87')](_0x1aa108['variable_id'])){return this['channel'][_0x1fc6('0x2d')](_0x1fc6('0x110'));}var _0x19742a=this[_0x1fc6('0xd')][_0x1fc6('0x111')](_0x503584,_0x1aa108[_0x1fc6('0x112')],_0x1aa108[_0x1fc6('0x113')]);var _0x3c211f=_0x19742a[_0x1fc6('0xa8')]?_0x19742a[_0x1fc6('0xa8')][_0x1fc6('0xa6')]():'';logger[_0x1fc6('0x2f')]('test',JSON[_0x1fc6('0x72')](_0x19742a));if(_0x19742a['result']===-0x1){this[_0x1fc6('0x37')][_0x1fc6('0x6f')](this,_0x1aa108,_0x3c211f);return _0x19742a;}else if(_0x19742a[_0x1fc6('0xaa')]===_0x1fc6('0x67')){_0x19742a['result']=_0x3c211f[_0x1fc6('0xa1')]>=parseInt(_0x1aa108[_0x1fc6('0x114')])?'x':'i';}else{_0x19742a[_0x1fc6('0xa8')]=_0x3c211f[_0x1fc6('0xa1')]>=parseInt(_0x1aa108[_0x1fc6('0x114')])&&_0x3c211f[_0x1fc6('0xa1')]<=parseInt(_0x1aa108[_0x1fc6('0x113')])?'x':'i';}var _0x98c772=this[_0x1fc6('0xa5')][_0x1fc6('0x6f')](this,_0x1aa108[_0x1fc6('0xdd')]);if(!_0x98c772){return this['channel']['error'](_0x1aa108,_0x1fc6('0x115'));}this[_0x1fc6('0xd')][_0x1fc6('0xa2')](_0x98c772,_0x3c211f);if(this[_0x1fc6('0x87')](_0x1aa108[_0x1fc6('0x116')])){var _0x501539=parseInt(_0x1aa108[_0x1fc6('0x116')],0xa);var _0x5f12dd=rs['generate']({'charset':'*','length':_0x501539});var _0x452ffb=_0x3c211f['length'];if(_0x452ffb>0x0){if(_0x452ffb>_0x501539){this[_0x1fc6('0x37')][_0x1fc6('0x6f')](this,_0x1aa108,_0x1aa108[_0x1fc6('0x117')]===_0x1fc6('0x118')?_0x5f12dd+_0x3c211f[_0x1fc6('0x119')](_0x501539):_0x3c211f['substr'](0x0,_0x452ffb-_0x501539)+_0x5f12dd);}else{this[_0x1fc6('0x37')][_0x1fc6('0x6f')](this,_0x1aa108,rs[_0x1fc6('0x11a')]({'charset':'*','length':_0x452ffb}));}}else{this[_0x1fc6('0x37')][_0x1fc6('0x6f')](this,_0x1aa108,'');}}else{this['createSquareDetailsReport'][_0x1fc6('0x6f')](this,_0x1aa108,_0x3c211f);}return _0x19742a;};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x11b')]=function(_0x2bfc02){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x11c'),_0x2bfc02[_0x1fc6('0x39')]));return this[_0x1fc6('0xc')](_0x2bfc02);};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x11d')]=function(_0x5efc53){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x11e'),_0x5efc53[_0x1fc6('0x39')]));this['createSquareDetailsReport'][_0x1fc6('0x6f')](this,_0x5efc53,_0x5efc53[_0x1fc6('0x11f')]);return this[_0x1fc6('0xd')][_0x1fc6('0xae')](util['format'](_0x1fc6('0x120'),_0x5efc53['goalname']));};AGIVertices['prototype'][_0x1fc6('0x121')]=function(_0x4d83b7){logger[_0x1fc6('0x2f')](util['format'](_0x1fc6('0x122'),_0x4d83b7[_0x1fc6('0x39')]));if(!this['isConfigured'](_0x4d83b7[_0x1fc6('0x8a')])||!this['isConfigured'](_0x4d83b7[_0x1fc6('0x8b')])){return this[_0x1fc6('0xd')][_0x1fc6('0xae')](_0x1fc6('0x123'));}if(!this[_0x1fc6('0x87')](_0x4d83b7[_0x1fc6('0x5c')])){return this[_0x1fc6('0xd')][_0x1fc6('0xae')]('no\x20text\x20configured');}this[_0x1fc6('0xd')][_0x1fc6('0xae')](util[_0x1fc6('0x29')]('Trying\x20aws\x20Polly\x20%s',_0x4d83b7[_0x1fc6('0x5c')]));var _0x53a881=this['awsPolly'][_0x1fc6('0x6f')](this,_0x4d83b7);if(_0x53a881){this[_0x1fc6('0xd')][_0x1fc6('0xae')](util[_0x1fc6('0x29')](_0x1fc6('0x124'),_0x53a881));var _0x2f72a4=this['channel'][_0x1fc6('0xff')](_0x53a881);try{fs[_0x1fc6('0x125')](_0x53a881+_0x1fc6('0x126'));}catch(_0x496c49){logger[_0x1fc6('0x2d')](_0x496c49);}return _0x2f72a4;}return this['channel']['error'](_0x4d83b7,_0x1fc6('0x127'));};AGIVertices['prototype'][_0x1fc6('0x128')]=function(_0x1c18a4){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x129'),_0x1c18a4[_0x1fc6('0x39')]));if(!this[_0x1fc6('0x87')](_0x1c18a4['aws_access_key_id'])||!this['isConfigured'](_0x1c18a4[_0x1fc6('0x8b')])){return this['channel'][_0x1fc6('0xae')](_0x1fc6('0x123'));}if(!this[_0x1fc6('0x87')](_0x1c18a4['aws_bot_name'])){return this[_0x1fc6('0xd')][_0x1fc6('0xae')](_0x1fc6('0x12a'));}if(!this[_0x1fc6('0x87')](_0x1c18a4[_0x1fc6('0x5c')])){return this[_0x1fc6('0xd')]['noop'](_0x1fc6('0xaf'));}this[_0x1fc6('0xd')]['bot']=!![];this[_0x1fc6('0x37')](_0x1c18a4);this[_0x1fc6('0x42')](_0x1c18a4[_0x1fc6('0x5c')],'in','','');this[_0x1fc6('0xd')][_0x1fc6('0xae')](util[_0x1fc6('0x29')](_0x1fc6('0x12b'),_0x1c18a4[_0x1fc6('0x5c')]));var _0x4a954d=this[_0x1fc6('0x8d')]['sync'](this,_0x1c18a4);if(_0x4a954d){for(var _0x45486 in _0x4a954d){if(_0x4a954d[_0x1fc6('0x97')](_0x45486)&&_[_0x1fc6('0x98')](_0x4a954d[_0x45486])){this['channel'][_0x1fc6('0xa2')](util['format']('AWS_LEX_%s',_0x45486['toUpperCase']()),_0x4a954d[_0x45486]);}}if(_[_0x1fc6('0x46')](_0x4a954d[_0x1fc6('0x78')])){return this['channel'][_0x1fc6('0xae')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x1fc6('0x42')](_0x4a954d[_0x1fc6('0x78')],_0x1fc6('0xeb'),_0x1fc6('0x12c'),'');return this[_0x1fc6('0xd')][_0x1fc6('0xae')](util[_0x1fc6('0x29')](_0x1fc6('0x12d'),_0x4a954d[_0x1fc6('0x78')]));}}return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x1c18a4,_0x1fc6('0x12e'));};AGIVertices['prototype'][_0x1fc6('0x12f')]=function(_0x67f495){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x130'),_0x67f495['label'],_0x67f495[_0x1fc6('0x67')]));if(!this['isConfigured'](_0x67f495[_0x1fc6('0x82')])){return this[_0x1fc6('0xd')]['noop']('no\x20key\x20configured');}var _0x11db32=_0x1fc6('0x131');var _0x3707b2=util[_0x1fc6('0x29')]('%s/recordings/%s',FILES_PATH,rs[_0x1fc6('0x11a')](0x4));var _0x275752=util[_0x1fc6('0x29')](_0x1fc6('0xa0'),_0x3707b2,_0x11db32);var _0x40ada5=!![];if(_0x67f495[_0x1fc6('0x132')]===_0x1fc6('0x133')){_0x40ada5=![];}var _0x138536=this['channel'][_0x1fc6('0x134')](_0x3707b2,_0x11db32,_0x67f495[_0x1fc6('0x135')],_0x67f495[_0x1fc6('0x67')],undefined,_0x40ada5);if(_0x138536[_0x1fc6('0xa8')]!==-0x1){this['channel'][_0x1fc6('0xae')](util['format'](_0x1fc6('0x136'),_0x275752));var _0x58aa0e=this[_0x1fc6('0x90')][_0x1fc6('0x6f')](this,_0x67f495,_0x275752);if(_0x58aa0e){for(var _0x307dd7 in _0x58aa0e){if(_0x58aa0e['hasOwnProperty'](_0x307dd7)){this[_0x1fc6('0xd')][_0x1fc6('0xa2')](util[_0x1fc6('0x29')](_0x1fc6('0x137'),_0x307dd7[_0x1fc6('0x6a')]()),_0x58aa0e[_0x307dd7]);}}return this[_0x1fc6('0xd')][_0x1fc6('0xae')](util[_0x1fc6('0x29')]('GoogleASR\x20Result\x20%s',JSON[_0x1fc6('0x72')](_0x58aa0e)));}}return _0x138536;};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x138')]=function(_0x52e869){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x52e869[_0x1fc6('0x39')]));if(!this[_0x1fc6('0x87')](_0x52e869['appid'])){return this[_0x1fc6('0xd')]['noop']('no\x20appid\x20configured');}if(!this[_0x1fc6('0x87')](_0x52e869['appsecret'])){return this[_0x1fc6('0xd')][_0x1fc6('0xae')]('no\x20appsecret\x20configured');}var _0x2b2c99=_0x1fc6('0x131');var _0x33a000=util[_0x1fc6('0x29')](_0x1fc6('0x139'),FILES_PATH,rs[_0x1fc6('0x11a')](0x4));var _0x353532=util['format'](_0x1fc6('0xa0'),_0x33a000,_0x2b2c99);var _0x312273=!![];if(_0x52e869[_0x1fc6('0x132')]===_0x1fc6('0x133')){_0x312273=![];}var _0x2a47d2=this[_0x1fc6('0xd')][_0x1fc6('0x134')](_0x33a000,_0x2b2c99,_0x52e869[_0x1fc6('0x135')],_0x52e869[_0x1fc6('0x67')],undefined,_0x312273);if(_0x2a47d2[_0x1fc6('0xa8')]!==-0x1){this[_0x1fc6('0xd')][_0x1fc6('0xae')](util[_0x1fc6('0x29')](_0x1fc6('0x13a'),_0x353532));var _0x298dac=this[_0x1fc6('0x92')]['sync'](this,_0x52e869,_0x353532);if(_0x298dac){for(var _0x21ab51 in _0x298dac){if(_0x298dac['hasOwnProperty'](_0x21ab51)){this[_0x1fc6('0xd')][_0x1fc6('0xa2')](util[_0x1fc6('0x29')](_0x1fc6('0x13b'),_0x21ab51[_0x1fc6('0x6a')]()),_0x298dac[_0x21ab51]);}}return this[_0x1fc6('0xd')]['noop'](util['format'](_0x1fc6('0x13c'),JSON['stringify'](_0x298dac)));}}return _0x2a47d2;};AGIVertices['prototype']['gotoc']=function(_0x17f3f2){logger['info'](util['format'](_0x1fc6('0x13d'),_0x17f3f2[_0x1fc6('0x39')]));return this[_0x1fc6('0xd')]['continueAt'](_0x17f3f2[_0x1fc6('0x13e')],_0x17f3f2[_0x1fc6('0x3e')],_0x17f3f2['priority']);};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x13f')]=function(_0x4284c7){logger[_0x1fc6('0x2f')](util['format'](_0x1fc6('0x140'),_0x4284c7[_0x1fc6('0x39')]));if(!this[_0x1fc6('0x87')](_0x4284c7[_0x1fc6('0x141')])){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x4284c7,'no\x20condition\x20configured');}try{var _0x4f7625=eval(_0x4284c7[_0x1fc6('0x141')])?_0x1fc6('0x142'):'false';this[_0x1fc6('0xd')][_0x1fc6('0xae')](util[_0x1fc6('0x29')]('EVAL\x20CONDITION\x20%s\x20%s',_0x4284c7['condition'],_0x4f7625));return{'code':0xc8,'result':_0x4f7625};}catch(_0x594794){return{'code':0xc8,'result':_0x1fc6('0x143')};}};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x144')]=function(_0x61adaa){logger['info'](util[_0x1fc6('0x29')](_0x1fc6('0x145'),_0x61adaa[_0x1fc6('0x39')]));if(!this[_0x1fc6('0x87')](_0x61adaa['interval_id'])){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x61adaa,_0x1fc6('0x146'));}var _0x3c267e=this[_0x1fc6('0x147')][_0x1fc6('0x6f')](this,_0x61adaa[_0x1fc6('0x148')]);if(!_0x3c267e){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x61adaa,_0x1fc6('0x149'));}for(var _0x313b9e=0x0;_0x313b9e<_0x3c267e[_0x1fc6('0xa1')];_0x313b9e+=0x1){var _0x8a16c=this[_0x1fc6('0xd')][_0x1fc6('0xa5')](util['format'](_0x1fc6('0x14a'),_0x3c267e[_0x313b9e]));if(_0x8a16c[_0x1fc6('0xa8')]===-0x1){return _0x8a16c;}logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x3c267e[_0x313b9e],_0x8a16c[_0x1fc6('0xaa')]));if(_0x8a16c['extra']===_0x1fc6('0x142')){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x14b'),_0x3c267e[_0x313b9e],_0x1fc6('0x142')));this['channel'][_0x1fc6('0xae')](util[_0x1fc6('0x29')](_0x1fc6('0x14b'),_0x3c267e[_0x313b9e],_0x1fc6('0x142')));return{'code':0xc8,'result':_0x1fc6('0x142')};}else{logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x14b'),_0x3c267e[_0x313b9e],_0x1fc6('0x143')));this[_0x1fc6('0xd')][_0x1fc6('0xae')](util['format']('IFTIME\x20%s\x20%s',_0x3c267e[_0x313b9e],_0x1fc6('0x143')));}}return{'code':0xc8,'result':_0x1fc6('0x143')};};AGIVertices[_0x1fc6('0xf')]['hangup']=function(_0x14a9b1){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x14c'),_0x14a9b1[_0x1fc6('0x39')]));return this[_0x1fc6('0xd')][_0x1fc6('0x14d')]();};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x14e')]=function(_0x9f34f7){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x14f'),_0x9f34f7[_0x1fc6('0x39')]));if(!this[_0x1fc6('0x87')](_0x9f34f7['key'])){return this[_0x1fc6('0xd')][_0x1fc6('0xae')](_0x1fc6('0xe8'));}var _0x2b9bf0=_0x1fc6('0x131');var _0x374a70=util[_0x1fc6('0x29')](_0x1fc6('0x139'),FILES_PATH,rs[_0x1fc6('0x11a')](0x4));var _0x14fcd4=util['format'](_0x1fc6('0xa0'),_0x374a70,_0x2b9bf0);var _0x5fcacb=!![];if(_0x9f34f7['beep']===_0x1fc6('0x133')){_0x5fcacb=![];}var _0x3a414d=this[_0x1fc6('0xd')]['recordFile'](_0x374a70,_0x2b9bf0,_0x9f34f7[_0x1fc6('0x135')],_0x9f34f7['timeout'],undefined,_0x5fcacb);if(_0x3a414d['result']!==-0x1){this[_0x1fc6('0xd')]['noop'](util['format'](_0x1fc6('0x150'),_0x14fcd4));var _0x3ed867=this[_0x1fc6('0x85')][_0x1fc6('0x6f')](this,_0x9f34f7,_0x14fcd4);if(_0x3ed867){for(var _0x5d2ccf in _0x3ed867){if(_0x3ed867[_0x1fc6('0x97')](_0x5d2ccf)){this[_0x1fc6('0xd')]['setVariable'](util[_0x1fc6('0x29')]('ISPEECH_ASR_%s',_0x5d2ccf[_0x1fc6('0x6a')]()),_0x3ed867[_0x5d2ccf]);}}return this[_0x1fc6('0xd')][_0x1fc6('0xae')](util[_0x1fc6('0x29')](_0x1fc6('0x151'),JSON[_0x1fc6('0x72')](_0x3ed867)));}}return _0x3a414d;};AGIVertices['prototype']['ispeechtts']=function(_0x26a7d3){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x26a7d3[_0x1fc6('0x39')]));if(!this['isConfigured'](_0x26a7d3[_0x1fc6('0x82')])){return this['channel'][_0x1fc6('0xae')](_0x1fc6('0xe8'));}if(!this[_0x1fc6('0x87')](_0x26a7d3[_0x1fc6('0x5c')])){return this[_0x1fc6('0xd')][_0x1fc6('0xae')]('no\x20text\x20configured');}this[_0x1fc6('0xd')][_0x1fc6('0xae')](util[_0x1fc6('0x29')](_0x1fc6('0x152'),_0x26a7d3['text']));var _0x89a806=this[_0x1fc6('0x81')]['sync'](this,_0x26a7d3);if(_0x89a806){this[_0x1fc6('0xd')][_0x1fc6('0xae')](util[_0x1fc6('0x29')](_0x1fc6('0x150'),_0x89a806));var _0x33a092=this['channel'][_0x1fc6('0xff')](_0x89a806,_0x26a7d3['intKey']);try{fs[_0x1fc6('0x125')](_0x89a806+_0x1fc6('0x126'));}catch(_0x2c5ab4){logger[_0x1fc6('0x2d')](_0x2c5ab4);}return _0x33a092;}return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x26a7d3,_0x1fc6('0x153'));};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x154')]=function(_0x2905aa){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x2905aa[_0x1fc6('0x39')]));if(!this[_0x1fc6('0x87')](_0x2905aa[_0x1fc6('0x155')])){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x2905aa,_0x1fc6('0x156'));}logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x1fc6('0xd')][_0x1fc6('0x3c')],_0x2905aa[_0x1fc6('0x155')]));var _0x333bda=this[_0x1fc6('0x157')][_0x1fc6('0x6f')](this,_0x2905aa[_0x1fc6('0x155')]);if(_0x333bda){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x158'),this[_0x1fc6('0xd')][_0x1fc6('0x3c')],_0x2905aa[_0x1fc6('0x155')]));this[_0x1fc6('0xd')][_0x1fc6('0xae')](util['format'](_0x1fc6('0x158'),this['channel'][_0x1fc6('0x3c')],_0x2905aa['findBy']));return{'code':0xc8,'result':_0x1fc6('0x159')};}else{logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x15a'),this[_0x1fc6('0xd')][_0x1fc6('0x3c')],_0x2905aa[_0x1fc6('0x155')]));this[_0x1fc6('0xd')][_0x1fc6('0xae')](util[_0x1fc6('0x29')](_0x1fc6('0x15a'),this[_0x1fc6('0xd')][_0x1fc6('0x3c')],_0x2905aa['findBy']));return{'code':0xc8,'result':_0x1fc6('0x15b')};}};AGIVertices[_0x1fc6('0xf')]['logout']=function(_0xacb697){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x15c'),_0xacb697['label']));if(!this[_0x1fc6('0x87')](_0xacb697[_0x1fc6('0x155')])){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0xacb697,_0x1fc6('0x156'));}logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x1fc6('0xd')][_0x1fc6('0x3c')],_0xacb697[_0x1fc6('0x155')]));var _0x2161f4=this[_0x1fc6('0x52')][_0x1fc6('0x6f')](this,_0xacb697['findBy']);if(_0x2161f4){logger[_0x1fc6('0x2f')](util['format'](_0x1fc6('0x158'),this[_0x1fc6('0xd')]['callerid'],_0xacb697[_0x1fc6('0x155')]));this[_0x1fc6('0xd')][_0x1fc6('0xae')](util[_0x1fc6('0x29')](_0x1fc6('0x158'),this[_0x1fc6('0xd')][_0x1fc6('0x3c')],_0xacb697[_0x1fc6('0x155')]));return{'code':0xc8,'result':'success'};}else{logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x15a'),this[_0x1fc6('0xd')][_0x1fc6('0x3c')],_0xacb697['findBy']));this[_0x1fc6('0xd')][_0x1fc6('0xae')](util[_0x1fc6('0x29')](_0x1fc6('0x15a'),this[_0x1fc6('0xd')][_0x1fc6('0x3c')],_0xacb697[_0x1fc6('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x1fc6('0xf')]['math']=function(_0x3b75ae){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x15d'),_0x3b75ae[_0x1fc6('0x39')]));if(!this['isConfigured'](_0x3b75ae[_0x1fc6('0x15e')])){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x3b75ae,_0x1fc6('0x15f'));}this[_0x1fc6('0xd')]['noop'](util[_0x1fc6('0x29')](_0x1fc6('0x160'),_0x3b75ae[_0x1fc6('0x15e')]));var _0x187769=eval(_0x3b75ae[_0x1fc6('0x15e')]);if(!this[_0x1fc6('0x87')](_0x3b75ae[_0x1fc6('0xdd')])){return this[_0x1fc6('0xd')][_0x1fc6('0xae')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5f2254=this[_0x1fc6('0xa5')][_0x1fc6('0x6f')](this,_0x3b75ae[_0x1fc6('0xdd')]);if(!_0x5f2254){return this['channel']['error'](_0x3b75ae,'no\x20variable\x20found');}if(_[_0x1fc6('0x9d')](_0x187769)){var _0x3f6c82=this;_0x187769['forEach'](function(_0x12c1af,_0x111e3d){_0x3f6c82[_0x1fc6('0xd')][_0x1fc6('0xa2')](util[_0x1fc6('0x29')](_0x1fc6('0x161'),_0x5f2254,_0x111e3d),_0x12c1af);});return this[_0x1fc6('0xd')][_0x1fc6('0xae')](util['format']('variable\x20%s[key]\x20set',_0x5f2254));}else{return this[_0x1fc6('0xd')]['setVariable'](_0x5f2254,_0x187769);}};AGIVertices['prototype']['menu']=function(_0x2cdb49){logger[_0x1fc6('0x2f')](util['format'](_0x1fc6('0x162'),_0x2cdb49[_0x1fc6('0x39')]));if(_0x2cdb49['retry']===0x0){return this[_0x1fc6('0xab')](_0x2cdb49);}_0x2cdb49[_0x1fc6('0xac')]-=0x1;if(!this[_0x1fc6('0x87')](_0x2cdb49[_0x1fc6('0x10f')])){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x2cdb49,_0x1fc6('0x163'));}var _0x233ad4=this[_0x1fc6('0x1d')][_0x1fc6('0x6f')](this,_0x2cdb49[_0x1fc6('0x10f')]);if(!_0x233ad4){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x2cdb49,_0x1fc6('0x164'));}var _0x4297fc=this[_0x1fc6('0xd')]['getData'](_0x233ad4,_0x2cdb49[_0x1fc6('0x112')],_0x2cdb49[_0x1fc6('0x165')]);var _0x2c262a=_0x4297fc['result'];if(_0x4297fc[_0x1fc6('0xa8')]===-0x1){this[_0x1fc6('0x37')][_0x1fc6('0x6f')](this,_0x2cdb49,'-1');return _0x4297fc;}else if(_0x4297fc[_0x1fc6('0xaa')]===_0x1fc6('0x67')){_0x4297fc[_0x1fc6('0xa8')]=_0x4297fc[_0x1fc6('0xa8')][_0x1fc6('0xa1')]>0x0?_0x4297fc['result']:'t';}else if(_[_0x1fc6('0x9f')](_0x4297fc[_0x1fc6('0xa8')])){_0x4297fc['result']='#';_0x2c262a='#';}if(!this[_0x1fc6('0x87')](_0x2cdb49[_0x1fc6('0xdd')])){this[_0x1fc6('0xd')][_0x1fc6('0xae')](_0x1fc6('0x110'));}else{var _0x22bb78=this['getVariable'][_0x1fc6('0x6f')](this,_0x2cdb49[_0x1fc6('0xdd')]);if(!_0x22bb78){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x2cdb49,_0x1fc6('0x115'));}this[_0x1fc6('0xd')]['setVariable'](_0x22bb78,_0x2c262a);}this[_0x1fc6('0x37')][_0x1fc6('0x6f')](this,_0x2cdb49,_0x2c262a);return _0x4297fc;};AGIVertices['prototype']['noop']=function(_0x332671){logger[_0x1fc6('0x2f')](util['format'](_0x1fc6('0x166'),_0x332671[_0x1fc6('0x39')]));return this[_0x1fc6('0xd')][_0x1fc6('0xae')](_0x332671[_0x1fc6('0x167')]||_0x332671[_0x1fc6('0x39')]);};AGIVertices['prototype'][_0x1fc6('0x168')]=function(_0x232e98){logger[_0x1fc6('0x2f')](util['format'](_0x1fc6('0x169'),_0x232e98[_0x1fc6('0x39')]));if(!this[_0x1fc6('0x87')](_0x232e98[_0x1fc6('0x155')])){return this[_0x1fc6('0xd')]['error'](_0x232e98,_0x1fc6('0x156'));}logger['info'](util[_0x1fc6('0x29')](_0x1fc6('0x16a'),this[_0x1fc6('0xd')]['callerid'],_0x232e98[_0x1fc6('0x155')]));var _0x2cbeb6=this[_0x1fc6('0x4e')][_0x1fc6('0x6f')](this,_0x232e98[_0x1fc6('0x16b')]);var _0x3512f4=this[_0x1fc6('0x16c')][_0x1fc6('0x6f')](this,_0x232e98[_0x1fc6('0x155')],_0x2cbeb6);if(_0x3512f4){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x158'),this['channel'][_0x1fc6('0x3c')],_0x232e98[_0x1fc6('0x155')]));this[_0x1fc6('0xd')][_0x1fc6('0xae')](util[_0x1fc6('0x29')](_0x1fc6('0x158'),this[_0x1fc6('0xd')][_0x1fc6('0x3c')],_0x232e98[_0x1fc6('0x155')]));return{'code':0xc8,'result':_0x1fc6('0x159')};}else{logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x15a'),this[_0x1fc6('0xd')]['callerid'],_0x232e98['findBy']));this['channel'][_0x1fc6('0xae')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x1fc6('0xd')]['callerid'],_0x232e98[_0x1fc6('0x155')]));return{'code':0xc8,'result':_0x1fc6('0x15b')};}};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x16d')]=function(_0x4ad73d){logger[_0x1fc6('0x2f')](util['format'](_0x1fc6('0x16e'),_0x4ad73d['label']));if(!this[_0x1fc6('0x87')](_0x4ad73d[_0x1fc6('0x10f')])){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x4ad73d,_0x1fc6('0x163'));}var _0x414229=this[_0x1fc6('0x1d')][_0x1fc6('0x6f')](this,_0x4ad73d[_0x1fc6('0x10f')]);if(!_0x414229){return this[_0x1fc6('0xd')]['error'](_0x4ad73d,'no\x20file\x20audio\x20found');}var _0x1b6090=this[_0x1fc6('0xd')][_0x1fc6('0x56')](_0x1fc6('0x16f'),[_0x414229,_0x4ad73d[_0x1fc6('0x10a')]]);if(_0x1b6090[_0x1fc6('0xa8')]===-0x1){return _0x1b6090;}return this[_0x1fc6('0xd')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x1fc6('0x16f'),_0x414229));};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x170')]=function(_0x5dd13d){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x171'),_0x5dd13d[_0x1fc6('0x39')]));if(!this['isConfigured'](_0x5dd13d[_0x1fc6('0x172')])){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x5dd13d,_0x1fc6('0x173'));}var _0x41329a='';var _0x306d4b=parseInt(_0x5dd13d[_0x1fc6('0x172')],0xa);if(isNaN(_0x306d4b)){_0x41329a=_0x5dd13d[_0x1fc6('0x172')];}else{_0x41329a=this['getVoiceQueue'][_0x1fc6('0x6f')](this,_0x5dd13d['queue_id']);if(!_0x41329a){return this[_0x1fc6('0xd')]['error'](_0x5dd13d,_0x1fc6('0x174'));}}var _0x353c40='';if(this[_0x1fc6('0x87')](_0x5dd13d[_0x1fc6('0x10f')])){var _0x2a3b6a=this[_0x1fc6('0x1d')]['sync'](this,_0x5dd13d[_0x1fc6('0x10f')]);if(_0x2a3b6a){_0x353c40=_0x2a3b6a;}}this[_0x1fc6('0x37')][_0x1fc6('0x6f')](this,_0x5dd13d,_0x41329a);if(_0x5dd13d['opts']['indexOf']('x')<0x0){_0x5dd13d['opts']+='x';}if(_0x5dd13d[_0x1fc6('0x10a')][_0x1fc6('0x175')]('X')<0x0){_0x5dd13d['opts']+='X';}this[_0x1fc6('0xd')][_0x1fc6('0xa2')](_0x1fc6('0x176'),_0x41329a?_0x41329a[_0x1fc6('0x177')]():'');var _0x29a32b=this['channel'][_0x1fc6('0x56')](_0x1fc6('0x178'),[_0x41329a,_0x5dd13d[_0x1fc6('0x10a')],_0x5dd13d[_0x1fc6('0x10b')],_0x353c40,_0x5dd13d['timeout'],_0x5dd13d[_0x1fc6('0x6')],_0x5dd13d[_0x1fc6('0x179')],_0x5dd13d[_0x1fc6('0x17a')],'',_0x5dd13d['position']]);if(_0x29a32b['result']===-0x1){return _0x29a32b;}return this['channel'][_0x1fc6('0xae')](util[_0x1fc6('0x29')](_0x1fc6('0xca'),_0x1fc6('0x178'),_0x41329a));};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x17b')]=function(_0x2db43b){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x17c'),_0x2db43b[_0x1fc6('0x39')]));var _0x484950=_0x2db43b[_0x1fc6('0x17d')]||_0x1fc6('0x131');var _0x258d6d=util[_0x1fc6('0x29')](_0x1fc6('0x17e'),this['channel'][_0x1fc6('0x38')],rs[_0x1fc6('0x11a')](0x5));var _0xd1fe27=util[_0x1fc6('0x29')]('%s/recordings/%s.%s',FILES_PATH,_0x258d6d,_0x484950);var _0x416ceb=util[_0x1fc6('0x29')]('%s/recordings/%s',FILES_PATH,_0x258d6d);this[_0x1fc6('0x17f')][_0x1fc6('0x6f')](this,_0x2db43b,_0x258d6d,_0xd1fe27);this[_0x1fc6('0xd')][_0x1fc6('0xa2')](_0x1fc6('0x180'),_0x258d6d);logger[_0x1fc6('0x2f')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x416ceb,_0x484950,_0x2db43b[_0x1fc6('0x181')],_0x2db43b[_0x1fc6('0x67')]);return this['channel'][_0x1fc6('0x134')](_0x416ceb,_0x484950,_0x2db43b[_0x1fc6('0x181')],_0x2db43b[_0x1fc6('0x67')],undefined,!![]);};AGIVertices[_0x1fc6('0xf')]['restapi']=function(_0x3fb90c){logger['info'](util[_0x1fc6('0x29')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x3fb90c[_0x1fc6('0x39')]));if(!this[_0x1fc6('0x87')](_0x3fb90c[_0x1fc6('0x10b')])){return this['channel'][_0x1fc6('0xae')](_0x1fc6('0x182'));}var _0x58d6e8=this[_0x1fc6('0x64')][_0x1fc6('0x6f')](this,_0x3fb90c);logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x183'),util[_0x1fc6('0x184')](_0x58d6e8,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x3fb90c['variable_id'])){return this[_0x1fc6('0xd')][_0x1fc6('0xae')](_0x1fc6('0x185'));}var _0x1e41f6=this['getVariable']['sync'](this,_0x3fb90c[_0x1fc6('0xdd')]);if(!_0x1e41f6){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x3fb90c,'no\x20variable\x20found');}this['channel'][_0x1fc6('0xa2')](util[_0x1fc6('0x29')](_0x1fc6('0x186'),_0x1e41f6),_0x58d6e8[_0x1fc6('0x77')]?_0x58d6e8[_0x1fc6('0x77')]:'200');this['channel'][_0x1fc6('0xa2')](util[_0x1fc6('0x29')]('%s_STATUS_MESSAGE',_0x1e41f6),_0x58d6e8[_0x1fc6('0x76')]?_0x58d6e8['statusMessage']:'OK');if(_0x58d6e8[_0x1fc6('0x73')]){try{this[_0x1fc6('0x9e')](_0x58d6e8['body'],_0x1e41f6);}catch(_0x1584bd){logger[_0x1fc6('0x2d')](util[_0x1fc6('0x29')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x1e41f6));}}return this[_0x1fc6('0xd')]['noop'](util[_0x1fc6('0x29')](_0x1fc6('0xe2'),_0x1e41f6));};AGIVertices['prototype'][_0x1fc6('0x187')]=function(_0x3bb8e){logger['info'](util[_0x1fc6('0x29')](_0x1fc6('0x188'),_0x3bb8e[_0x1fc6('0x39')]));return this[_0x1fc6('0xd')]['sayDigits'](_0x3bb8e[_0x1fc6('0x189')][_0x1fc6('0x58')](/\s+/g,''),_0x3bb8e[_0x1fc6('0x181')]);};AGIVertices['prototype'][_0x1fc6('0x18a')]=function(_0x272042){logger[_0x1fc6('0x2f')](util['format'](_0x1fc6('0x18b'),_0x272042[_0x1fc6('0x39')]));return this[_0x1fc6('0xd')][_0x1fc6('0x18c')](_0x272042[_0x1fc6('0x66')]['replace'](/\s+/g,''),_0x272042['escape_digits']);};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x18d')]=function(_0x3a53aa){logger['info'](util['format'](_0x1fc6('0x18e'),_0x3a53aa['label']));return this[_0x1fc6('0xd')]['sayPhonetic'](_0x3a53aa[_0x1fc6('0x5c')],_0x3a53aa[_0x1fc6('0x181')]);};AGIVertices[_0x1fc6('0xf')]['sendMail']=function(_0x2155b2){logger[_0x1fc6('0x2f')](util['format'](_0x1fc6('0x18f'),_0x2155b2[_0x1fc6('0x39')]));if(!this[_0x1fc6('0x87')](_0x2155b2[_0x1fc6('0x190')])){return this[_0x1fc6('0xd')]['noop'](_0x1fc6('0x191'));}var _0x5c87d0=this[_0x1fc6('0x21')]['sync'](this,_0x2155b2[_0x1fc6('0x190')]);if(!_0x5c87d0||!_0x5c87d0[_0x1fc6('0x192')]){return this['channel'][_0x1fc6('0x2d')](_0x2155b2,_0x1fc6('0x193'));}var _0x40bf28={'from':util[_0x1fc6('0x29')](_0x1fc6('0x194'),_0x5c87d0['name'],_0x5c87d0['email']||_0x5c87d0['Smtp'][_0x1fc6('0x195')]),'to':_0x2155b2['to']||'','cc':_0x2155b2['cc']||'','bcc':_0x2155b2[_0x1fc6('0x196')]||'','subject':_0x2155b2['subject'],'html':_0x2155b2['text'],'text':_0x2155b2[_0x1fc6('0x5c')]};if(this[_0x1fc6('0x87')](_0x2155b2[_0x1fc6('0x197')])){}logger[_0x1fc6('0xe3')](_0x1fc6('0x198'),JSON[_0x1fc6('0x72')](_0x40bf28));this[_0x1fc6('0x37')][_0x1fc6('0x6f')](this,_0x2155b2,_0x2155b2['account_id']);this[_0x1fc6('0xd')][_0x1fc6('0xae')](util['format'](_0x1fc6('0x199'),_0x5c87d0[_0x1fc6('0x12')]));this[_0x1fc6('0x23')][_0x1fc6('0x6f')](this,_0x5c87d0[_0x1fc6('0x19a')],_0x40bf28);return this['channel'][_0x1fc6('0xae')](_0x1fc6('0x19b'));};AGIVertices['prototype']['sendFax']=function(_0x2aa31f){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x19c'),_0x2aa31f[_0x1fc6('0x39')]));return this['channel']['noop'](_0x1fc6('0x19d'));};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x19e')]=function(_0x15a014){logger['info'](util[_0x1fc6('0x29')](_0x1fc6('0x19f'),_0x15a014[_0x1fc6('0x39')]));if(!this['isConfigured'](_0x15a014[_0x1fc6('0x1a0')])){return this[_0x1fc6('0xd')][_0x1fc6('0xae')](_0x1fc6('0x1a1'));}var _0x1275b6=this[_0x1fc6('0x35')][_0x1fc6('0x6f')](this,_0x15a014[_0x1fc6('0x1a0')]);if(!_0x1275b6){return this['channel'][_0x1fc6('0x2d')](_0x15a014,'no\x20sms\x20account\x20found');}var _0x2e590f={'body':_0x15a014[_0x1fc6('0x1a2')],'phone':_0x15a014['to']||'','SmsAccountId':_0x1275b6['id']};logger[_0x1fc6('0xe3')]('sendSMS\x20message',JSON[_0x1fc6('0x72')](_0x2e590f));this[_0x1fc6('0x37')][_0x1fc6('0x6f')](this,_0x15a014,_0x15a014['sms_account_id']);this[_0x1fc6('0xd')]['noop'](util[_0x1fc6('0x29')](_0x1fc6('0x1a3'),_0x1275b6[_0x1fc6('0x12')]));this[_0x1fc6('0x36')]['sync'](this,_0x2e590f);return this[_0x1fc6('0xd')][_0x1fc6('0xae')](_0x1fc6('0x1a4'));};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x1a5')]=function(_0x69ae9b){logger[_0x1fc6('0x2f')](util['format'](_0x1fc6('0x1a6'),_0x69ae9b[_0x1fc6('0x39')]));if(!this[_0x1fc6('0x87')](_0x69ae9b[_0x1fc6('0xdd')])){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x69ae9b,_0x1fc6('0x1a7'));}var _0x74de9b=this['getVariable'][_0x1fc6('0x6f')](this,_0x69ae9b[_0x1fc6('0xdd')]);if(!_0x74de9b){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x69ae9b,_0x1fc6('0x115'));}return this[_0x1fc6('0xd')][_0x1fc6('0xa2')](_0x74de9b,_0x69ae9b[_0x1fc6('0x1a8')]);};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x1a9')]=function(_0x507d73){logger['info'](util[_0x1fc6('0x29')]('Enter\x20in\x20START\x20(%s)\x20block',_0x507d73[_0x1fc6('0x39')]));this[_0x1fc6('0xd')]['noop']('START\x20CALLY\x20SQUARE');if(_0x507d73['answer']==='yes'){this[_0x1fc6('0xd')]['noop'](_0x1fc6('0x1aa'));return this[_0x1fc6('0xd')][_0x1fc6('0xbf')]();}return this[_0x1fc6('0xd')][_0x1fc6('0xae')](_0x1fc6('0x1ab'));};AGIVertices[_0x1fc6('0xf')]['subproject']=function(_0xa2b6ae){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0xa2b6ae[_0x1fc6('0x39')]));if(!this[_0x1fc6('0x87')](_0xa2b6ae['project_id'])){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0xa2b6ae,_0x1fc6('0x1ac'));}var _0x6e6550=this[_0x1fc6('0x1ad')][_0x1fc6('0x6f')](this,_0xa2b6ae[_0x1fc6('0x1ae')]);if(!this[_0x1fc6('0x87')](_0x6e6550)){return this['channel'][_0x1fc6('0x2d')](_0xa2b6ae,util['format'](_0x1fc6('0x1af'),_0xa2b6ae[_0x1fc6('0x1ae')]));}if(_0x6e6550===this['channel'][_0x1fc6('0x3b')]){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0xa2b6ae,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x1fc6('0x37')][_0x1fc6('0x6f')](this,_0xa2b6ae,_0x6e6550);var _0x453b68=this['channel']['exec']('AGI',util[_0x1fc6('0x29')](_0x1fc6('0x1b0'),config['agi'][_0x1fc6('0x1b1')]||_0x1fc6('0x1b2'),_0x6e6550,this[_0x1fc6('0xd')][_0x1fc6('0x3b')]));if(_0x453b68[_0x1fc6('0xa8')]===-0x1){return _0x453b68;}return this['channel'][_0x1fc6('0xae')](util[_0x1fc6('0x29')](_0x1fc6('0xca'),_0x1fc6('0x1b3'),_0x6e6550));};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x1b4')]=function(_0xb2492){logger[_0x1fc6('0x2f')](util['format'](_0x1fc6('0x1b5'),_0xb2492[_0x1fc6('0x39')]));var _0x5184a5=this[_0x1fc6('0x55')][_0x1fc6('0x6f')](this,_0xb2492[_0x1fc6('0x1b6')]);this[_0x1fc6('0x37')]['sync'](this,_0xb2492,_0xb2492[_0x1fc6('0x1b6')]);if(this['isConfigured'](_0xb2492[_0x1fc6('0xdd')])){var _0x4ddd27=this[_0x1fc6('0xa5')]['sync'](this,_0xb2492[_0x1fc6('0xdd')]);if(_0x4ddd27){this[_0x1fc6('0xd')][_0x1fc6('0xa2')](_0x4ddd27,_0x5184a5);return this[_0x1fc6('0xd')]['noop'](util[_0x1fc6('0x29')](_0x1fc6('0x1b7'),_0xb2492[_0x1fc6('0x1b6')],_0x4ddd27));}}return this['channel']['noop'](util[_0x1fc6('0x29')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0xb2492[_0x1fc6('0x1b6')]));};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x1b8')]=function(_0x2e8bfe){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x1b9'),_0x2e8bfe[_0x1fc6('0x39')]));_0x2e8bfe[_0x1fc6('0x5c')]=_0x2e8bfe['text'][_0x1fc6('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x2e8bfe['apiKey'])){return this['channel'][_0x1fc6('0xae')]('no\x20apiKey\x20configured');}if(!this[_0x1fc6('0x87')](_0x2e8bfe[_0x1fc6('0x5c')])){return this[_0x1fc6('0xd')][_0x1fc6('0xae')](_0x1fc6('0xaf'));}this['channel'][_0x1fc6('0xae')](util['format'](_0x1fc6('0x1ba'),_0x2e8bfe['text']));var _0x4c5177=this['googleCloudTTS'][_0x1fc6('0x6f')](this,_0x2e8bfe);if(_0x4c5177){this[_0x1fc6('0xd')][_0x1fc6('0xae')](util[_0x1fc6('0x29')](_0x1fc6('0x1bb'),_0x4c5177));var _0x936faf=this['channel'][_0x1fc6('0xff')](_0x4c5177);try{fs[_0x1fc6('0x125')](_0x4c5177+_0x1fc6('0x126'));}catch(_0x2e00e3){logger[_0x1fc6('0x2d')](_0x2e00e3);}return _0x936faf;}return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x2e8bfe,_0x1fc6('0x1bc'));};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x1bd')]=function(_0x2b492e){logger[_0x1fc6('0x2f')](util['format'](_0x1fc6('0x1be'),_0x2b492e['label']));_0x2b492e[_0x1fc6('0x5c')]=_0x2b492e['text'][_0x1fc6('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x1fc6('0x87')](_0x2b492e[_0x1fc6('0x5c')])){return this[_0x1fc6('0xd')][_0x1fc6('0xae')]('no\x20text\x20configured');}this['channel'][_0x1fc6('0xae')](util['format'](_0x1fc6('0x1bf'),_0x2b492e[_0x1fc6('0x5c')]));var _0xf5dca4=this[_0x1fc6('0x62')][_0x1fc6('0x6f')](this,_0x2b492e);if(_0xf5dca4){this['channel'][_0x1fc6('0xae')](util['format'](_0x1fc6('0x1c0'),_0xf5dca4));var _0x19f77f=this['channel'][_0x1fc6('0xff')](_0xf5dca4);try{fs['unlink'](_0xf5dca4+_0x1fc6('0x126'));}catch(_0x179313){logger[_0x1fc6('0x2d')](_0x179313);}return _0x19f77f;}return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x2b492e,_0x1fc6('0x1c1'));};AGIVertices[_0x1fc6('0xf')]['unpause']=function(_0x399836){logger['info'](util['format'](_0x1fc6('0x1c2'),_0x399836[_0x1fc6('0x39')]));if(!this[_0x1fc6('0x87')](_0x399836[_0x1fc6('0x155')])){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x399836,'no\x20find\x20by\x20configured');}logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x16a'),this['channel'][_0x1fc6('0x3c')],_0x399836[_0x1fc6('0x155')]));var _0x14ddbe=this[_0x1fc6('0x51')]['sync'](this,_0x399836[_0x1fc6('0x155')]);if(_0x14ddbe){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x158'),this[_0x1fc6('0xd')][_0x1fc6('0x3c')],_0x399836['findBy']));this[_0x1fc6('0xd')][_0x1fc6('0xae')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x1fc6('0xd')][_0x1fc6('0x3c')],_0x399836[_0x1fc6('0x155')]));return{'code':0xc8,'result':_0x1fc6('0x159')};}else{logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')](_0x1fc6('0x15a'),this[_0x1fc6('0xd')][_0x1fc6('0x3c')],_0x399836['findBy']));this['channel'][_0x1fc6('0xae')](util[_0x1fc6('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x1fc6('0xd')][_0x1fc6('0x3c')],_0x399836[_0x1fc6('0x155')]));return{'code':0xc8,'result':_0x1fc6('0x15b')};}};AGIVertices[_0x1fc6('0xf')][_0x1fc6('0x1c3')]=function(_0x2fe8e3){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x2fe8e3[_0x1fc6('0x39')]));var _0x5b98d4=this[_0x1fc6('0xd')][_0x1fc6('0x56')](_0x1fc6('0x1c4'),[_0x2fe8e3[_0x1fc6('0x1c5')],_0x2fe8e3[_0x1fc6('0x7a')]]);if(_0x5b98d4[_0x1fc6('0xa8')]===-0x1){return _0x5b98d4;}return this['channel']['noop'](util[_0x1fc6('0x29')](_0x1fc6('0xca'),_0x1fc6('0x1c4'),_0x2fe8e3[_0x1fc6('0x1c5')]));};AGIVertices['prototype'][_0x1fc6('0x1c6')]=function(_0x3f062b){logger[_0x1fc6('0x2f')](util[_0x1fc6('0x29')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x3f062b[_0x1fc6('0x39')]));if(!this[_0x1fc6('0x87')](_0x3f062b[_0x1fc6('0xdd')])){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x3f062b,_0x1fc6('0x1a7'));}var _0x314106=this[_0x1fc6('0xa5')][_0x1fc6('0x6f')](this,_0x3f062b[_0x1fc6('0xdd')]);if(!_0x314106){return this[_0x1fc6('0xd')][_0x1fc6('0x2d')](_0x3f062b,_0x1fc6('0x115'));}var _0x557e3b=this[_0x1fc6('0xd')]['getVariable'](_0x314106);return{'code':0xc8,'result':_0x557e3b[_0x1fc6('0xaa')]?_0x557e3b[_0x1fc6('0xaa')]:'-'};};String[_0x1fc6('0xf')]['replaceAll']=function(_0x5a3725,_0x1fe928){return this[_0x1fc6('0xa3')](_0x5a3725)[_0x1fc6('0x1c7')](_0x1fe928);};module[_0x1fc6('0x1c8')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index d0678ce..ae726b8 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 _0x17db=['[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','message','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','destlinkedid','[ACW][syncAgentConnect]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','savePause','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','update','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]'];(function(_0x485984,_0x19f82f){var _0x48cc7e=function(_0x352cef){while(--_0x352cef){_0x485984['push'](_0x485984['shift']());}};_0x48cc7e(++_0x19f82f);}(_0x17db,0x78));var _0xb17d=function(_0x3c766b,_0x5758c3){_0x3c766b=_0x3c766b-0x0;var _0x3dec50=_0x17db[_0x3c766b];return _0x3dec50;};'use strict';var _=require(_0xb17d('0x0'));var moment=require(_0xb17d('0x1'));var ami=require(_0xb17d('0x2'));var logger=require(_0xb17d('0x3'))(_0xb17d('0x4'));var RpcUser=require(_0xb17d('0x5'));var RpcVoiceAgentReport=require(_0xb17d('0x6'));function Acw(_0x4877d9){this[_0xb17d('0x7')]=_0x4877d9[_0xb17d('0x7')];this[_0xb17d('0x8')]=_0x4877d9[_0xb17d('0x8')];this[_0xb17d('0x9')]=_0x4877d9[_0xb17d('0x9')];this[_0xb17d('0xa')]={};ami['on'](_0xb17d('0xb'),this[_0xb17d('0xc')][_0xb17d('0xd')](this));ami['on'](_0xb17d('0xe'),this[_0xb17d('0xf')]['bind'](this));ami['on'](_0xb17d('0x10'),this[_0xb17d('0x11')][_0xb17d('0xd')](this));ami['on']('agentringnoanswer',this[_0xb17d('0x12')]['bind'](this));ami['on'](_0xb17d('0x13'),this[_0xb17d('0x14')][_0xb17d('0xd')](this));ami['on']('blindtransfer',this[_0xb17d('0x15')]['bind'](this));ami['on'](_0xb17d('0x16'),this[_0xb17d('0x17')]['bind'](this));}function getDiff(_0x1e3a9c){var _0x175854=moment()[_0xb17d('0x18')](0x0);var _0x20fe66=moment(_0x1e3a9c)[_0xb17d('0x18')](0x0);return _0x175854[_0xb17d('0x19')](_0x20fe66,_0xb17d('0x1a'));}Acw[_0xb17d('0x1b')][_0xb17d('0x1c')]=function(_0x5c0e0e){try{var _0x1b092f=this;var _0x4666e5=this[_0xb17d('0xa')][_0x5c0e0e][_0xb17d('0x1d')];var _0x2164e4=this['channels'][_0x5c0e0e][_0xb17d('0x1e')];var _0xb237ca=this[_0xb17d('0x7')][_0x2164e4];var _0x43613f=![];var _0x47e79b=_0xb17d('0x1f');if(_0xb237ca[_0xb17d('0x20')]){if(_0xb237ca[_0xb17d('0x21')][_0xb17d('0x22')]){_0x43613f=!![];_0x47e79b=_0xb237ca[_0xb17d('0x21')]['name'];}}return ami[_0xb17d('0x23')]({'action':_0xb17d('0x24'),'interface':_0x4666e5,'paused':!![],'reason':_0x47e79b})[_0xb17d('0x25')](function(){if(_0x1b092f[_0xb17d('0x8')][_0x4666e5]){return RpcUser[_0xb17d('0x26')](_0x1b092f[_0xb17d('0x8')][_0x4666e5]['id'])['then'](function(_0x39a1c0){if(_0x39a1c0&&!_0x39a1c0[_0xb17d('0x27')]){logger[_0xb17d('0x28')](_0xb17d('0x29'),_0x5c0e0e,_0x4666e5,_0x2164e4);var _0x290517=_0x1b092f[_0xb17d('0xa')][_0x5c0e0e][_0xb17d('0x2a')]&&_0x1b092f[_0xb17d('0xa')][_0x5c0e0e]['destlinkedid']?_0x1b092f['channels'][_0x5c0e0e]['destlinkedid']:_0x5c0e0e;return RpcUser[_0xb17d('0x2b')](_0x1b092f[_0xb17d('0x8')][_0x4666e5],_0x47e79b,_0x290517)[_0xb17d('0x25')](function(){if(!_0x43613f){_0x1b092f[_0xb17d('0x9')][_0x4666e5]={};logger[_0xb17d('0x28')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x5c0e0e,_0x1b092f[_0xb17d('0x7')][_0x2164e4][_0xb17d('0x2c')],_0x4666e5,_0x2164e4);_0x1b092f['timers'][_0x4666e5][_0xb17d('0x2d')]=setTimeout(_0x1b092f[_0xb17d('0x2e')][_0xb17d('0xd')](_0x1b092f,_0x4666e5),_0x1b092f[_0xb17d('0x7')][_0x2164e4][_0xb17d('0x2c')]*0x3e8);_0x1b092f[_0xb17d('0x9')][_0x4666e5][_0xb17d('0x2f')]=moment()[_0xb17d('0x30')](_0xb17d('0x31'));_0x1b092f['timers'][_0x4666e5][_0xb17d('0x32')]=_0x5c0e0e;_0x1b092f[_0xb17d('0x9')][_0x4666e5][_0xb17d('0x1e')]=_0x2164e4;_0x1b092f[_0xb17d('0x9')][_0x4666e5]['updateAcw']=function(){var _0x215b8a=getDiff(_0x1b092f[_0xb17d('0x9')][_0x4666e5][_0xb17d('0x2f')]);clearTimeout(_0x1b092f[_0xb17d('0x9')][_0x4666e5][_0xb17d('0x2d')]);_0x1b092f[_0xb17d('0x9')][_0x4666e5][_0xb17d('0x2d')]=![];RpcVoiceAgentReport[_0xb17d('0x33')]({'acwtime':_0x215b8a},_0x1b092f[_0xb17d('0x9')][_0x4666e5]['uniqueid'],_0x4666e5)[_0xb17d('0x25')](function(_0x5a045c){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x5c0e0e,_0x215b8a,_0x5a045c);})[_0xb17d('0x34')](function(_0x52ebb7){logger[_0xb17d('0x35')](_0xb17d('0x36'),_0x5c0e0e,_0x52ebb7);});delete _0x1b092f[_0xb17d('0x9')][_0x4666e5];};}});}else{logger[_0xb17d('0x28')](_0xb17d('0x37'),_0x5c0e0e,_0x4666e5,_0x2164e4);}});}})[_0xb17d('0x34')](function(){logger[_0xb17d('0x35')](_0xb17d('0x38'),_0x5c0e0e,_0x1b092f[_0xb17d('0x7')][_0x2164e4][_0xb17d('0x2c')],_0x4666e5,_0x2164e4);})['finally'](function(){delete _0x1b092f[_0xb17d('0xa')][_0x5c0e0e];});}catch(_0xc2153){logger[_0xb17d('0x35')]('[ACW][START]\x20%s',_0xc2153[_0xb17d('0x39')]);}};Acw[_0xb17d('0x1b')][_0xb17d('0x2e')]=function(_0x10749c){try{var _0x52d75e=this;if(_0x52d75e['timers'][_0x10749c]){_0x52d75e[_0xb17d('0x9')][_0x10749c][_0xb17d('0x2d')]=![];var _0x1d4382=_0x52d75e['timers'][_0x10749c][_0xb17d('0x32')];var _0x51ad6e=_0x52d75e[_0xb17d('0x9')][_0x10749c][_0xb17d('0x1e')];var _0x5dbb67=_0x52d75e[_0xb17d('0x7')][_0x51ad6e]['acwTimeout'];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0x1d4382,_0x10749c);RpcUser[_0xb17d('0x3a')](this[_0xb17d('0x8')][_0x10749c]);RpcVoiceAgentReport[_0xb17d('0x33')]({'acwtime':_0x5dbb67,'agentacw':!![]},_0x1d4382,_0x10749c)[_0xb17d('0x25')](function(_0x188ad3){logger[_0xb17d('0x28')](_0xb17d('0x3b'),_0x1d4382,_0x5dbb67,_0x188ad3);})[_0xb17d('0x34')](function(_0x19176f){logger[_0xb17d('0x35')]('[%s][UPDATE][ERRORS:%s]',_0x1d4382,_0x19176f);});}else{logger[_0xb17d('0x35')](_0xb17d('0x3c'),_0x10749c);if(_0x52d75e[_0xb17d('0x9')]){logger[_0xb17d('0x28')](_0xb17d('0x3d'),JSON['stringify'](_0x52d75e[_0xb17d('0x9')]));}}}catch(_0x2050bc){logger[_0xb17d('0x35')](_0xb17d('0x3e'),_0x2050bc[_0xb17d('0x39')]);}};Acw[_0xb17d('0x1b')][_0xb17d('0xc')]=function(_0x173740){try{if(this[_0xb17d('0x7')][_0x173740['queue']]&&(this[_0xb17d('0x7')][_0x173740[_0xb17d('0x1e')]][_0xb17d('0x4')]||this[_0xb17d('0x7')][_0x173740['queue']][_0xb17d('0x20')])){if(this[_0xb17d('0x8')][_0x173740['interface']]){this['channels'][_0x173740[_0xb17d('0x32')]]={'queue':_0x173740[_0xb17d('0x1e')],'interface':_0x173740['interface'],'destlinkedid':_0x173740[_0xb17d('0x3f')]};}}}catch(_0xe91051){logger[_0xb17d('0x35')](_0xb17d('0x40'),_0xe91051[_0xb17d('0x39')]);}};Acw['prototype'][_0xb17d('0x17')]=function(_0x58a058){try{if(this[_0xb17d('0x7')][_0x58a058[_0xb17d('0x1e')]]&&(this['voiceQueues'][_0x58a058['queue']][_0xb17d('0x4')]||this[_0xb17d('0x7')][_0x58a058[_0xb17d('0x1e')]][_0xb17d('0x20')])){if(this[_0xb17d('0x8')][_0x58a058[_0xb17d('0x1d')]]){this[_0xb17d('0xa')][_0x58a058[_0xb17d('0x32')]]={'queue':_0x58a058[_0xb17d('0x1e')],'interface':_0x58a058[_0xb17d('0x1d')]};}}}catch(_0x3d40bd){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x3d40bd['message']);}};Acw[_0xb17d('0x1b')][_0xb17d('0xf')]=function(_0x57748e){try{if(this['channels'][_0x57748e[_0xb17d('0x32')]]&&_[_0xb17d('0x41')](this[_0xb17d('0xa')][_0x57748e['uniqueid']]['attended'])){logger[_0xb17d('0x28')](_0xb17d('0x42'),_0x57748e[_0xb17d('0x32')]);this[_0xb17d('0x1c')](_0x57748e[_0xb17d('0x32')]);}else if(this[_0xb17d('0xa')][_0x57748e[_0xb17d('0x43')]]&&_[_0xb17d('0x41')](this[_0xb17d('0xa')][_0x57748e[_0xb17d('0x43')]][_0xb17d('0x2a')])){logger[_0xb17d('0x28')](_0xb17d('0x44'),_0x57748e[_0xb17d('0x43')]);this[_0xb17d('0x1c')](_0x57748e[_0xb17d('0x43')]);}}catch(_0x1c1f43){logger[_0xb17d('0x35')](_0xb17d('0x45'),_0x1c1f43[_0xb17d('0x39')]);}};Acw['prototype'][_0xb17d('0x11')]=function(_0x39b1d7){try{if(this[_0xb17d('0xa')][_0x39b1d7['uniqueid']]&&this[_0xb17d('0xa')][_0x39b1d7['uniqueid']][_0xb17d('0x2a')]){logger[_0xb17d('0x28')](_0xb17d('0x46'),_0x39b1d7['uniqueid']);this[_0xb17d('0x1c')](_0x39b1d7[_0xb17d('0x32')]);}else if(this[_0xb17d('0xa')][_0x39b1d7['linkedid']]&&this[_0xb17d('0xa')][_0x39b1d7['linkedid']][_0xb17d('0x2a')]){logger[_0xb17d('0x28')](_0xb17d('0x47'),_0x39b1d7['linkedid']);this[_0xb17d('0x1c')](_0x39b1d7['linkedid']);}}catch(_0x14c63d){logger[_0xb17d('0x35')](_0xb17d('0x48'),_0x14c63d['message']);}};Acw['prototype'][_0xb17d('0x14')]=function(_0x591b30){try{if(!_[_0xb17d('0x49')](this[_0xb17d('0xa')][_0x591b30[_0xb17d('0x4a')]])){this[_0xb17d('0x1c')](_0x591b30[_0xb17d('0x4a')]);if(this[_0xb17d('0xa')][_0x591b30[_0xb17d('0x4b')]]){this[_0xb17d('0xa')][_0x591b30[_0xb17d('0x4b')]][_0xb17d('0x2a')]=!![];this[_0xb17d('0xa')][_0x591b30[_0xb17d('0x4c')]]=this[_0xb17d('0xa')][_0x591b30[_0xb17d('0x4b')]];delete this[_0xb17d('0xa')][_0x591b30['secondtransfereruniqueid']];}}else if(!_[_0xb17d('0x49')](this[_0xb17d('0xa')][_0x591b30[_0xb17d('0x4c')]])){this[_0xb17d('0x1c')](_0x591b30[_0xb17d('0x4c')]);if(this[_0xb17d('0xa')][_0x591b30[_0xb17d('0x4d')]]){this[_0xb17d('0xa')][_0x591b30[_0xb17d('0x4d')]]['attended']=!![];this[_0xb17d('0xa')][_0x591b30[_0xb17d('0x4a')]]=this[_0xb17d('0xa')][_0x591b30['origtransfereruniqueid']];delete this[_0xb17d('0xa')][_0x591b30[_0xb17d('0x4d')]];}}}catch(_0x46461a){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x46461a[_0xb17d('0x39')]);}};Acw['prototype'][_0xb17d('0x15')]=function(_0x3041df){try{if(this[_0xb17d('0xa')][_0x3041df[_0xb17d('0x4e')]]){logger['info'](_0xb17d('0x4f'),JSON[_0xb17d('0x50')](_0x3041df[_0xb17d('0x4e')]));this[_0xb17d('0x1c')](_0x3041df[_0xb17d('0x4e')]);}else if(this[_0xb17d('0xa')][_0x3041df['transfererlinkedid']]){logger[_0xb17d('0x28')](_0xb17d('0x51'),JSON[_0xb17d('0x50')](_0x3041df[_0xb17d('0x52')]));this['startAcw'](_0x3041df[_0xb17d('0x52')]);}}catch(_0x1e7491){logger[_0xb17d('0x35')]('[ACW][syncBlindTransfer]\x20%s',_0x1e7491[_0xb17d('0x39')]);}};Acw[_0xb17d('0x1b')][_0xb17d('0x12')]=function(_0x25b941){try{if(this[_0xb17d('0x7')][_0x25b941[_0xb17d('0x1e')]]&&this[_0xb17d('0x7')][_0x25b941[_0xb17d('0x1e')]][_0xb17d('0x53')]===_0xb17d('0x54')){if(this[_0xb17d('0x8')][_0x25b941['interface']]){logger['info'](_0xb17d('0x55'),_0x25b941[_0xb17d('0x32')],_0x25b941['interface'],_0x25b941[_0xb17d('0x1e')]);return RpcUser[_0xb17d('0x2b')](this[_0xb17d('0x8')][_0x25b941[_0xb17d('0x1d')]],_0xb17d('0x56'),_0x25b941['uniqueid']);}}}catch(_0x1ce904){logger[_0xb17d('0x35')](_0xb17d('0x57'),_0x1ce904[_0xb17d('0x39')]);}};module['exports']=Acw; \ No newline at end of file +var _0xcc8d=['../../../config/logger','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','hangup','syncHangup','bind','agentringnoanswer','syncAgentRingNoAnswer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','uniqueid','lastPauseAt','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xcc8d,0x9a));var _0xdcc8=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0xcc8d[_0x561f25];return _0x150e4c;};'use strict';var _=require('lodash');var moment=require('moment');var ami=require('../ami');var logger=require(_0xdcc8('0x0'))('acw');var RpcUser=require(_0xdcc8('0x1'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x46a07f){this['voiceQueues']=_0x46a07f[_0xdcc8('0x2')];this['agents']=_0x46a07f[_0xdcc8('0x3')];this[_0xdcc8('0x4')]=_0x46a07f['timers'];this[_0xdcc8('0x5')]={};ami['on'](_0xdcc8('0x6'),this['syncAgentConnect']['bind'](this));ami['on']('hanguprequest',this['syncHangupRequest']['bind'](this));ami['on'](_0xdcc8('0x7'),this[_0xdcc8('0x8')][_0xdcc8('0x9')](this));ami['on'](_0xdcc8('0xa'),this[_0xdcc8('0xb')][_0xdcc8('0x9')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0xdcc8('0x9')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xdcc8('0x9')](this));ami['on'](_0xdcc8('0xc'),this[_0xdcc8('0xd')][_0xdcc8('0x9')](this));}function getDiff(_0x53d250){var _0x25a77c=moment()[_0xdcc8('0xe')](0x0);var _0x2de96f=moment(_0x53d250)[_0xdcc8('0xe')](0x0);return _0x25a77c[_0xdcc8('0xf')](_0x2de96f,_0xdcc8('0x10'));}Acw[_0xdcc8('0x11')]['startAcw']=function(_0x3c0af9){try{var _0x5b23f3=this;var _0x11b492=this[_0xdcc8('0x5')][_0x3c0af9][_0xdcc8('0x12')];var _0x979c26=this[_0xdcc8('0x5')][_0x3c0af9][_0xdcc8('0x13')];var _0x546616=this[_0xdcc8('0x2')][_0x979c26];var _0x3637da=![];var _0x1b3b7d=_0xdcc8('0x14');if(_0x546616[_0xdcc8('0x15')]){if(_0x546616[_0xdcc8('0x16')][_0xdcc8('0x17')]){_0x3637da=!![];_0x1b3b7d=_0x546616[_0xdcc8('0x16')][_0xdcc8('0x17')];}}return ami[_0xdcc8('0x18')]({'action':_0xdcc8('0x19'),'interface':_0x11b492,'paused':!![],'reason':_0x1b3b7d})[_0xdcc8('0x1a')](function(){if(_0x5b23f3[_0xdcc8('0x3')][_0x11b492]){return RpcUser[_0xdcc8('0x1b')](_0x5b23f3['agents'][_0x11b492]['id'])['then'](function(_0x657268){if(_0x657268&&!_0x657268['voicePause']){logger[_0xdcc8('0x1c')](_0xdcc8('0x1d'),_0x3c0af9,_0x11b492,_0x979c26);var _0x32c5c5=_0x5b23f3['channels'][_0x3c0af9][_0xdcc8('0x1e')]&&_0x5b23f3[_0xdcc8('0x5')][_0x3c0af9][_0xdcc8('0x1f')]?_0x5b23f3[_0xdcc8('0x5')][_0x3c0af9][_0xdcc8('0x1f')]:_0x3c0af9;return RpcUser['savePause'](_0x5b23f3[_0xdcc8('0x3')][_0x11b492],_0x1b3b7d,_0x32c5c5)[_0xdcc8('0x1a')](function(){if(!_0x3637da){_0x5b23f3[_0xdcc8('0x4')][_0x11b492]={};logger[_0xdcc8('0x1c')](_0xdcc8('0x20'),_0x3c0af9,_0x5b23f3[_0xdcc8('0x2')][_0x979c26][_0xdcc8('0x21')],_0x11b492,_0x979c26);_0x5b23f3['timers'][_0x11b492][_0xdcc8('0x22')]=setTimeout(_0x5b23f3[_0xdcc8('0x23')][_0xdcc8('0x9')](_0x5b23f3,_0x11b492),_0x5b23f3[_0xdcc8('0x2')][_0x979c26]['acwTimeout']*0x3e8);_0x5b23f3['timers'][_0x11b492]['lastPauseAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5b23f3['timers'][_0x11b492][_0xdcc8('0x24')]=_0x3c0af9;_0x5b23f3[_0xdcc8('0x4')][_0x11b492][_0xdcc8('0x13')]=_0x979c26;_0x5b23f3[_0xdcc8('0x4')][_0x11b492]['updateAcw']=function(){var _0x1fd039=getDiff(_0x5b23f3[_0xdcc8('0x4')][_0x11b492][_0xdcc8('0x25')]);clearTimeout(_0x5b23f3['timers'][_0x11b492]['timer']);_0x5b23f3[_0xdcc8('0x4')][_0x11b492][_0xdcc8('0x22')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x1fd039},_0x5b23f3[_0xdcc8('0x4')][_0x11b492][_0xdcc8('0x24')],_0x11b492)[_0xdcc8('0x1a')](function(_0x173f5e){logger[_0xdcc8('0x1c')](_0xdcc8('0x26'),_0x3c0af9,_0x1fd039,_0x173f5e);})['catch'](function(_0x35beb8){logger[_0xdcc8('0x27')](_0xdcc8('0x28'),_0x3c0af9,_0x35beb8);});delete _0x5b23f3[_0xdcc8('0x4')][_0x11b492];};}});}else{logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x3c0af9,_0x11b492,_0x979c26);}});}})['catch'](function(){logger[_0xdcc8('0x27')](_0xdcc8('0x20'),_0x3c0af9,_0x5b23f3[_0xdcc8('0x2')][_0x979c26][_0xdcc8('0x21')],_0x11b492,_0x979c26);})[_0xdcc8('0x29')](function(){delete _0x5b23f3[_0xdcc8('0x5')][_0x3c0af9];});}catch(_0x12acc8){logger[_0xdcc8('0x27')](_0xdcc8('0x2a'),_0x12acc8[_0xdcc8('0x2b')]);}};Acw[_0xdcc8('0x11')][_0xdcc8('0x23')]=function(_0xa63ea5){try{var _0x49019c=this;if(_0x49019c[_0xdcc8('0x4')][_0xa63ea5]){_0x49019c[_0xdcc8('0x4')][_0xa63ea5][_0xdcc8('0x22')]=![];var _0x56c91e=_0x49019c[_0xdcc8('0x4')][_0xa63ea5][_0xdcc8('0x24')];var _0xbb9648=_0x49019c[_0xdcc8('0x4')][_0xa63ea5][_0xdcc8('0x13')];var _0x18f1b8=_0x49019c[_0xdcc8('0x2')][_0xbb9648][_0xdcc8('0x21')];logger[_0xdcc8('0x1c')](_0xdcc8('0x2c'),_0x56c91e,_0xa63ea5);RpcUser[_0xdcc8('0x2d')](this['agents'][_0xa63ea5]);RpcVoiceAgentReport[_0xdcc8('0x2e')]({'acwtime':_0x18f1b8,'agentacw':!![]},_0x56c91e,_0xa63ea5)[_0xdcc8('0x1a')](function(_0xe9b901){logger[_0xdcc8('0x1c')](_0xdcc8('0x26'),_0x56c91e,_0x18f1b8,_0xe9b901);})['catch'](function(_0x278cf3){logger[_0xdcc8('0x27')](_0xdcc8('0x28'),_0x56c91e,_0x278cf3);});}else{logger[_0xdcc8('0x27')](_0xdcc8('0x2f'),_0xa63ea5);if(_0x49019c[_0xdcc8('0x4')]){logger[_0xdcc8('0x1c')](_0xdcc8('0x30'),JSON['stringify'](_0x49019c[_0xdcc8('0x4')]));}}}catch(_0x2dd5cc){logger[_0xdcc8('0x27')](_0xdcc8('0x31'),_0x2dd5cc[_0xdcc8('0x2b')]);}};Acw[_0xdcc8('0x11')][_0xdcc8('0x32')]=function(_0x3f3388){try{if(this[_0xdcc8('0x2')][_0x3f3388['queue']]&&(this['voiceQueues'][_0x3f3388[_0xdcc8('0x13')]]['acw']||this[_0xdcc8('0x2')][_0x3f3388[_0xdcc8('0x13')]][_0xdcc8('0x15')])){if(this[_0xdcc8('0x3')][_0x3f3388[_0xdcc8('0x12')]]){this[_0xdcc8('0x5')][_0x3f3388[_0xdcc8('0x24')]]={'queue':_0x3f3388[_0xdcc8('0x13')],'interface':_0x3f3388[_0xdcc8('0x12')],'destlinkedid':_0x3f3388[_0xdcc8('0x1f')]};}}}catch(_0x33a3d0){logger[_0xdcc8('0x27')](_0xdcc8('0x33'),_0x33a3d0[_0xdcc8('0x2b')]);}};Acw['prototype'][_0xdcc8('0xd')]=function(_0x749589){try{if(this['voiceQueues'][_0x749589[_0xdcc8('0x13')]]&&(this[_0xdcc8('0x2')][_0x749589[_0xdcc8('0x13')]]['acw']||this[_0xdcc8('0x2')][_0x749589['queue']]['mandatoryDisposition'])){if(this['agents'][_0x749589[_0xdcc8('0x12')]]){this['channels'][_0x749589[_0xdcc8('0x24')]]={'queue':_0x749589[_0xdcc8('0x13')],'interface':_0x749589[_0xdcc8('0x12')]};}}}catch(_0x5298c8){logger[_0xdcc8('0x27')]('[ACW][syncAgentConnectPreview]\x20%s',_0x5298c8[_0xdcc8('0x2b')]);}};Acw['prototype'][_0xdcc8('0x34')]=function(_0x38f7ca){try{if(this['channels'][_0x38f7ca['uniqueid']]&&_[_0xdcc8('0x35')](this['channels'][_0x38f7ca['uniqueid']][_0xdcc8('0x1e')])){logger[_0xdcc8('0x1c')](_0xdcc8('0x36'),_0x38f7ca[_0xdcc8('0x24')]);this[_0xdcc8('0x37')](_0x38f7ca[_0xdcc8('0x24')]);}else if(this['channels'][_0x38f7ca[_0xdcc8('0x38')]]&&_[_0xdcc8('0x35')](this[_0xdcc8('0x5')][_0x38f7ca['linkedid']]['attended'])){logger[_0xdcc8('0x1c')](_0xdcc8('0x39'),_0x38f7ca['linkedid']);this[_0xdcc8('0x37')](_0x38f7ca[_0xdcc8('0x38')]);}}catch(_0x5d3491){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x5d3491[_0xdcc8('0x2b')]);}};Acw[_0xdcc8('0x11')][_0xdcc8('0x8')]=function(_0x3b27af){try{if(this['channels'][_0x3b27af['uniqueid']]&&this['channels'][_0x3b27af[_0xdcc8('0x24')]][_0xdcc8('0x1e')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x3b27af[_0xdcc8('0x24')]);this[_0xdcc8('0x37')](_0x3b27af[_0xdcc8('0x24')]);}else if(this[_0xdcc8('0x5')][_0x3b27af[_0xdcc8('0x38')]]&&this[_0xdcc8('0x5')][_0x3b27af['linkedid']][_0xdcc8('0x1e')]){logger[_0xdcc8('0x1c')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x3b27af[_0xdcc8('0x38')]);this[_0xdcc8('0x37')](_0x3b27af[_0xdcc8('0x38')]);}}catch(_0xce0ed7){logger[_0xdcc8('0x27')](_0xdcc8('0x3a'),_0xce0ed7['message']);}};Acw['prototype'][_0xdcc8('0x3b')]=function(_0x5730c5){try{if(!_[_0xdcc8('0x3c')](this[_0xdcc8('0x5')][_0x5730c5[_0xdcc8('0x3d')]])){this[_0xdcc8('0x37')](_0x5730c5[_0xdcc8('0x3d')]);if(this['channels'][_0x5730c5[_0xdcc8('0x3e')]]){this[_0xdcc8('0x5')][_0x5730c5[_0xdcc8('0x3e')]][_0xdcc8('0x1e')]=!![];this[_0xdcc8('0x5')][_0x5730c5[_0xdcc8('0x3f')]]=this[_0xdcc8('0x5')][_0x5730c5[_0xdcc8('0x3e')]];delete this[_0xdcc8('0x5')][_0x5730c5[_0xdcc8('0x3e')]];}}else if(!_[_0xdcc8('0x3c')](this[_0xdcc8('0x5')][_0x5730c5['transfertargetuniqueid']])){this[_0xdcc8('0x37')](_0x5730c5[_0xdcc8('0x3f')]);if(this['channels'][_0x5730c5[_0xdcc8('0x40')]]){this['channels'][_0x5730c5['origtransfereruniqueid']]['attended']=!![];this[_0xdcc8('0x5')][_0x5730c5[_0xdcc8('0x3d')]]=this['channels'][_0x5730c5[_0xdcc8('0x40')]];delete this['channels'][_0x5730c5[_0xdcc8('0x40')]];}}}catch(_0x5ae9cb){logger[_0xdcc8('0x27')](_0xdcc8('0x41'),_0x5ae9cb['message']);}};Acw[_0xdcc8('0x11')]['syncBlindTransfer']=function(_0x5b6dd7){try{if(this[_0xdcc8('0x5')][_0x5b6dd7[_0xdcc8('0x42')]]){logger[_0xdcc8('0x1c')](_0xdcc8('0x43'),JSON[_0xdcc8('0x44')](_0x5b6dd7[_0xdcc8('0x42')]));this['startAcw'](_0x5b6dd7[_0xdcc8('0x42')]);}else if(this[_0xdcc8('0x5')][_0x5b6dd7['transfererlinkedid']]){logger[_0xdcc8('0x1c')](_0xdcc8('0x45'),JSON[_0xdcc8('0x44')](_0x5b6dd7[_0xdcc8('0x46')]));this[_0xdcc8('0x37')](_0x5b6dd7[_0xdcc8('0x46')]);}}catch(_0x4eafb1){logger['error'](_0xdcc8('0x47'),_0x4eafb1[_0xdcc8('0x2b')]);}};Acw[_0xdcc8('0x11')]['syncAgentRingNoAnswer']=function(_0x3f1106){try{if(this[_0xdcc8('0x2')][_0x3f1106[_0xdcc8('0x13')]]&&this[_0xdcc8('0x2')][_0x3f1106[_0xdcc8('0x13')]]['autopause']===_0xdcc8('0x48')){if(this[_0xdcc8('0x3')][_0x3f1106['interface']]){logger[_0xdcc8('0x1c')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x3f1106[_0xdcc8('0x24')],_0x3f1106['interface'],_0x3f1106[_0xdcc8('0x13')]);return RpcUser[_0xdcc8('0x49')](this[_0xdcc8('0x3')][_0x3f1106[_0xdcc8('0x12')]],_0xdcc8('0x4a'),_0x3f1106['uniqueid']);}}}catch(_0x538c9b){logger['error'](_0xdcc8('0x4b'),_0x538c9b[_0xdcc8('0x2b')]);}};module[_0xdcc8('0x4c')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 4f0379a..e97e1c1 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 _0xd37d=['../../config/environment','asterisk','username','password','keepConnected','promisify','action','error','format','port','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','resolve','then','actionCoreShowChannels','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/logger'];(function(_0x3aaee7,_0x385b84){var _0x205a95=function(_0x41fcae){while(--_0x41fcae){_0x3aaee7['push'](_0x3aaee7['shift']());}};_0x205a95(++_0x385b84);}(_0xd37d,0x193));var _0xdd37=function(_0x2113d8,_0x5a3232){_0x2113d8=_0x2113d8-0x0;var _0x1c8538=_0xd37d[_0x2113d8];return _0x1c8538;};'use strict';var Manager=require(_0xdd37('0x0'));var BPromise=require(_0xdd37('0x1'));var util=require(_0xdd37('0x2'));var logger=require(_0xdd37('0x3'))('ami');var config=require(_0xdd37('0x4'));var ami=new Manager(config[_0xdd37('0x5')]['port'],config[_0xdd37('0x5')]['ip'],config[_0xdd37('0x5')][_0xdd37('0x6')],config[_0xdd37('0x5')][_0xdd37('0x7')],!![]);ami[_0xdd37('0x8')]();ami['Action']=BPromise[_0xdd37('0x9')](ami[_0xdd37('0xa')]);function error(_0x1c95fc){logger[_0xdd37('0xb')](util[_0xdd37('0xc')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0xdd37('0x5')][_0xdd37('0x6')],config['asterisk']['ip'],config[_0xdd37('0x5')][_0xdd37('0xd')],util['inspect'](_0x1c95fc,![],null)));}function close(){logger[_0xdd37('0xb')](util['format'](_0xdd37('0xe'),config['asterisk'][_0xdd37('0x6')],config['asterisk']['ip'],config[_0xdd37('0x5')][_0xdd37('0xd')]));}ami[_0xdd37('0xf')]=function(){return function(){return ami[_0xdd37('0x10')]({'action':_0xdd37('0x11')});};};ami[_0xdd37('0x12')]=function(){return function(){return ami[_0xdd37('0x10')]({'action':'devicestatelist'});};};ami[_0xdd37('0x13')]=function(){return function(){return ami['Action']({'action':_0xdd37('0x14')});};};ami[_0xdd37('0x15')]=function(){return function(){return ami[_0xdd37('0x10')]({'action':_0xdd37('0x16')});};};ami['actionCoreShowChannels']=function(){return function(){return ami['Action']({'action':_0xdd37('0x17')});};};function connect(){logger[_0xdd37('0x18')](util[_0xdd37('0xc')](_0xdd37('0x19'),config[_0xdd37('0x5')][_0xdd37('0x6')],config['asterisk']['ip'],config[_0xdd37('0x5')][_0xdd37('0xd')]));ami[_0xdd37('0x1a')](_0xdd37('0xb'),error);ami['once'](_0xdd37('0x1b'),close);}ami['on']('connect',connect);ami['on']('shutdown',function(_0x2be0af){logger[_0xdd37('0x18')](util['format'](_0xdd37('0x1c'),config[_0xdd37('0x5')]['username'],config[_0xdd37('0x5')]['ip'],config[_0xdd37('0x5')][_0xdd37('0xd')],util[_0xdd37('0x1d')](_0x2be0af,![],null)));});ami['on'](_0xdd37('0x1e'),function(){logger[_0xdd37('0x18')](util[_0xdd37('0xc')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xdd37('0x5')][_0xdd37('0x6')],config[_0xdd37('0x5')]['ip'],config[_0xdd37('0x5')][_0xdd37('0xd')]));return Promise[_0xdd37('0x1f')]()['then'](ami[_0xdd37('0xf')]())[_0xdd37('0x20')](ami[_0xdd37('0x12')]())[_0xdd37('0x20')](ami[_0xdd37('0x13')]())[_0xdd37('0x20')](ami[_0xdd37('0x15')]())['then'](ami[_0xdd37('0x21')]())[_0xdd37('0x22')](function(_0x2c2da4){logger['error'](_0xdd37('0x23'),util[_0xdd37('0x1d')](_0x2c2da4,{'showHidden':![],'depth':null}));});});ami[_0xdd37('0x1a')]('error',error);ami[_0xdd37('0x1a')](_0xdd37('0x1b'),close);module[_0xdd37('0x24')]=ami; \ No newline at end of file +var _0x6953=['once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','then','actionDeviceStateList','catch','[ami.js][fullybooted]','asterisk-manager','bluebird','util','../../config/logger','../../config/environment','asterisk','username','password','keepConnected','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x6953,0xe8));var _0x3695=function(_0x1c82ff,_0x17dbda){_0x1c82ff=_0x1c82ff-0x0;var _0x3281d9=_0x6953[_0x1c82ff];return _0x3281d9;};'use strict';var Manager=require(_0x3695('0x0'));var BPromise=require(_0x3695('0x1'));var util=require(_0x3695('0x2'));var logger=require(_0x3695('0x3'))('ami');var config=require(_0x3695('0x4'));var ami=new Manager(config[_0x3695('0x5')]['port'],config[_0x3695('0x5')]['ip'],config[_0x3695('0x5')][_0x3695('0x6')],config[_0x3695('0x5')][_0x3695('0x7')],!![]);ami[_0x3695('0x8')]();ami[_0x3695('0x9')]=BPromise[_0x3695('0xa')](ami[_0x3695('0xb')]);function error(_0x2f24a6){logger['error'](util[_0x3695('0xc')](_0x3695('0xd'),config['asterisk']['username'],config[_0x3695('0x5')]['ip'],config['asterisk'][_0x3695('0xe')],util[_0x3695('0xf')](_0x2f24a6,![],null)));}function close(){logger[_0x3695('0x10')](util['format'](_0x3695('0x11'),config[_0x3695('0x5')][_0x3695('0x6')],config['asterisk']['ip'],config['asterisk'][_0x3695('0xe')]));}ami[_0x3695('0x12')]=function(){return function(){return ami[_0x3695('0x9')]({'action':_0x3695('0x13')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x3695('0x9')]({'action':_0x3695('0x14')});};};ami[_0x3695('0x15')]=function(){return function(){return ami[_0x3695('0x9')]({'action':'sippeerstatus'});};};ami[_0x3695('0x16')]=function(){return function(){return ami[_0x3695('0x9')]({'action':'queuesummary'});};};ami[_0x3695('0x17')]=function(){return function(){return ami[_0x3695('0x9')]({'action':_0x3695('0x18')});};};function connect(){logger[_0x3695('0x19')](util[_0x3695('0xc')](_0x3695('0x1a'),config['asterisk'][_0x3695('0x6')],config[_0x3695('0x5')]['ip'],config[_0x3695('0x5')][_0x3695('0xe')]));ami[_0x3695('0x1b')]('error',error);ami[_0x3695('0x1b')](_0x3695('0x1c'),close);}ami['on'](_0x3695('0x1d'),connect);ami['on'](_0x3695('0x1e'),function(_0x5d3613){logger[_0x3695('0x19')](util[_0x3695('0xc')](_0x3695('0x1f'),config['asterisk'][_0x3695('0x6')],config[_0x3695('0x5')]['ip'],config[_0x3695('0x5')][_0x3695('0xe')],util['inspect'](_0x5d3613,![],null)));});ami['on'](_0x3695('0x20'),function(){logger[_0x3695('0x19')](util[_0x3695('0xc')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk'][_0x3695('0x6')],config['asterisk']['ip'],config[_0x3695('0x5')]['port']));return Promise['resolve']()[_0x3695('0x21')](ami[_0x3695('0x12')]())[_0x3695('0x21')](ami[_0x3695('0x22')]())[_0x3695('0x21')](ami['actionSipPeerStatus']())['then'](ami[_0x3695('0x16')]())[_0x3695('0x21')](ami[_0x3695('0x17')]())[_0x3695('0x23')](function(_0x414bf2){logger[_0x3695('0x10')](_0x3695('0x24'),util[_0x3695('0xf')](_0x414bf2,{'showHidden':![],'depth':null}));});});ami['once'](_0x3695('0x10'),error);ami[_0x3695('0x1b')](_0x3695('0x1c'),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 c19f462..7503943 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x70e0,0x17b));var _0x070e=function(_0x47b3a7,_0x5bb5a4){_0x47b3a7=_0x47b3a7-0x0;var _0x312b41=_0x70e0[_0x47b3a7];return _0x312b41;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client; \ No newline at end of file +var _0xd8b0=['message','result','catch','exports','jayson/promise','bluebird','http','Request','then','debug','memberReport','error','rpc'];(function(_0x350ff3,_0x2c05a8){var _0x9d68cb=function(_0x4f3d4c){while(--_0x4f3d4c){_0x350ff3['push'](_0x350ff3['shift']());}};_0x9d68cb(++_0x2c05a8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('ami');var client=jayson['client'][_0x0d8b('0x2')]({'port':0x2329});client[_0x0d8b('0x3')]=function(_0x43bca1,_0x364286){return new BPromise(function(_0x8196ed,_0x577834){return client['request'](_0x43bca1,_0x364286)[_0x0d8b('0x4')](function(_0x227c63){logger[_0x0d8b('0x5')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x364286,_0x227c63);if(_0x227c63[_0x0d8b('0x7')]){logger['error'](_0x0d8b('0x8'),_0x0d8b('0x6'),_0x43bca1,_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')],_0x364286);return _0x577834(_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')]);}else{return _0x8196ed(_0x227c63[_0x0d8b('0xa')]);}})[_0x0d8b('0xb')](function(_0x48fa16){logger[_0x0d8b('0x7')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x48fa16,_0x364286);return _0x577834(_0x48fa16);});});};module[_0x0d8b('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index f10f5d8..bdd84dd 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 _0x35b7=['outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','available','talking','floor','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','predictiveIntervalHitRate','abandonmentRate','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','dialPredictiveOptimization','loggedIn','outboundQueuePauses','predictiveIntervalPauses','agentBusyFactor','busyFactor','startMethodPredictive','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','dialRecallMeTimeout','voicePause','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','temp','checkContactEmpty','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','getContactDialer','[countReScheduled]\x20','RUNNING','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','reachable','dialOrderByScheduledAt','countReScheduled','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','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]','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils/hopper','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','tail','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','hangup','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','type','debug','inspect','format','voice:queue:%s','voice_queue:save','isEmpty','info','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','checkContactLowerLimitOriginate','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','contactsRescheduled','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','Intervals','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','campaign:save','sendMessageOneNotActive','originated','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','ifTimeIvr','checkIfTimeIntervals','NULL_INTERVAL','ifTime','EMPTY_INTERVAL','Failure','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','iftime\x20%s,%s','timezones','content','true','catch','command','indexOf','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','undefined','isIVRCampaign','checkIfTime','dialGlobalInterval','dialTimezone','launchHandleIvr','checkDialMethod','dialMethod','progressive','handlePower','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Timezone:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','queue','uniqueid','ivr','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','agiafterat','dialQueueProject2','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','ContactId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','minutes','Abandoned','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','syncNewExten','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','stateinterface','queueBooked','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','ListId','[unlock][syncQueueStatusComplete]','_rr','paused','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','finally','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','emit','amd','saveInDb','value','MACHINE','countmachineretry','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','membername','custom:amd','[syncHangupInAMDIvr]','Machine','buildObj','[syncAgentComplete][createHistory][0]','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','[rescheduleContact][Machine]','syncHangup','[syncHangupIvr][createHistory]','AnswerAGI','[syncHangupIvr]','dialQueueProject','cause-txt','queuesSummary','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','resolve','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','assign','[syncQueueSummary]','syncQueueSummaryComplete','throttle','filter','online','handlePreviewRecallNotifications','map','Agent','user:%s','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','sequence','enqueue','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','user:dialPreviewRecallReminder','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','Contact','tags','createdAt','XMD-','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','dialOriginateCallerIdName','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject'];(function(_0x2eb2d8,_0x28e64a){var _0x47df3d=function(_0x5b7a4d){while(--_0x5b7a4d){_0x2eb2d8['push'](_0x2eb2d8['shift']());}};_0x47df3d(++_0x28e64a);}(_0x35b7,0x6f));var _0x735b=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x35b7[_0x47fd36];return _0x21a0fc;};'use strict';var util=require(_0x735b('0x0'));var _=require(_0x735b('0x1'));var uuid=require(_0x735b('0x2'));var moment=require(_0x735b('0x3'));var rr=require('rr');var Redis=require(_0x735b('0x4'));var utils=require('./utils');var hopperUtils=require(_0x735b('0x5'));var ut=require(_0x735b('0x6'));var config=require(_0x735b('0x7'));var logger=require('../../../config/logger')(_0x735b('0x8'));var loggerBooked=require(_0x735b('0x9'))(_0x735b('0xa'));var loggerPredictive=require(_0x735b('0x9'))(_0x735b('0xb'));var loggerPredictiveCalls=require('../../../config/logger')(_0x735b('0xc'));var loggerSyncQueueSummary=require(_0x735b('0x9'))(_0x735b('0xd'));var ami=require(_0x735b('0xe'));config[_0x735b('0xf')]=_[_0x735b('0x10')](config[_0x735b('0xf')],{'host':_0x735b('0x11'),'port':0x18eb});var io=require(_0x735b('0x12'))(new Redis(config['redis']));var cmHopper=require(_0x735b('0x13'));var voiceQueueRt=require(_0x735b('0x14'));var RpcSetting=require(_0x735b('0x15'));var Interval=require(_0x735b('0x16'));var Action=require(_0x735b('0x17'));var History=require(_0x735b('0x18'));var Final=require(_0x735b('0x19'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x735b('0x1a'));var Hangup=require(_0x735b('0x1b'));var ipAgi=process[_0x735b('0x1c')][_0x735b('0x1d')]||_0x735b('0x1e');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x735b('0x1f')]['enqueue']=function(_0x24ea51){this['tail']=this[_0x735b('0x20')]?this[_0x735b('0x20')]['finally'](_0x24ea51):_0x24ea51();};function Dialer(_0x2d5dbd,_0x351ee3){this['sequence']=new Sequence();this[_0x735b('0x21')]=_0x351ee3;this[_0x735b('0x22')]=_0x2d5dbd[_0x735b('0x22')];this['campaigns']=_0x2d5dbd[_0x735b('0x23')];this[_0x735b('0x24')]=_0x2d5dbd[_0x735b('0x24')];this['trunks']=_0x2d5dbd[_0x735b('0x25')];this[_0x735b('0x26')]=config[_0x735b('0x26')]||0x2;this[_0x735b('0x27')]={};this[_0x735b('0x28')]={};this[_0x735b('0x29')]={};this[_0x735b('0x2a')]={};this['optionPredictive']={};this[_0x735b('0x2b')]={};this[_0x735b('0x2c')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0x735b('0x2d')]={};this['queuesSummary']={};ami['on'](_0x735b('0x2e'),this[_0x735b('0x2f')][_0x735b('0x30')](this));ami['on'](_0x735b('0x31'),this[_0x735b('0x32')][_0x735b('0x30')](this));ami['on'](_0x735b('0x33'),this[_0x735b('0x34')][_0x735b('0x30')](this));ami['on']('agentcomplete',this[_0x735b('0x35')][_0x735b('0x30')](this));ami['on'](_0x735b('0x36'),this[_0x735b('0xd')][_0x735b('0x30')](this));ami['on'](_0x735b('0x37'),this['syncQueueSummaryComplete'][_0x735b('0x30')](this));ami['on'](_0x735b('0x38'),this['syncHangup'][_0x735b('0x30')](this));ami['on']('newexten',this['syncNewExten'][_0x735b('0x30')](this));ami['on'](_0x735b('0x39'),this[_0x735b('0x3a')][_0x735b('0x30')](this));ami['on'](_0x735b('0x3b'),this[_0x735b('0x3c')][_0x735b('0x30')](this));ami['on'](_0x735b('0x3d'),this[_0x735b('0x3e')][_0x735b('0x30')](this));this[_0x735b('0x3f')]();this[_0x735b('0x40')]();RpcSetting['getSettings']()[_0x735b('0x41')](function(_0xbab670){previewRecallmeReminderInterval=_0xbab670[_0x735b('0x42')];});}function isNotNull(_0x5a4585){return _0x5a4585!==null&&!_[_0x735b('0x43')](_0x5a4585);}function msgResponse(_0x528203,_0x5a4904,_0x403700){return{'action':_0x528203,'response':_0x5a4904,'message':_0x403700,'stack':_0x403700};}function emit(_0xe56780,_0xc13e87,_0x2f576f){io['to'](_0xe56780)['emit'](_0xc13e87,_0x2f576f);}function emitOutboundVoiceQueueSummary(_0x1d047b){if(_0x1d047b[_0x735b('0x44')]==='outbound'){logger[_0x735b('0x45')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x735b('0x46')](_0x1d047b,{'showHidden':![],'depth':null}));emit(util[_0x735b('0x47')](_0x735b('0x48'),_0x1d047b['name']),_0x735b('0x49'),_0x1d047b);}}function checkGetDataPredictive(_0x3dbe76){if(isNotNull(_0x3dbe76)&&!_[_0x735b('0x4a')](_0x3dbe76)){loggerPredictive[_0x735b('0x4b')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x735b('0x4b')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3dbe76[_0x735b('0x4c')]);loggerPredictive[_0x735b('0x4b')](_0x735b('0x4d'),_0x3dbe76['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x735b('0x4b')](_0x735b('0x4e'),_0x3dbe76['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x735b('0x4b')](_0x735b('0x4f'),_0x3dbe76[_0x735b('0x50')]);loggerPredictive['info'](_0x735b('0x51'),_0x3dbe76['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x735b('0x4b')](_0x735b('0x52'),_0x3dbe76['predictiveIntervalAvgTalktime']);loggerPredictive[_0x735b('0x4b')](_0x735b('0x53'));if(_0x3dbe76[_0x735b('0x4c')]>0x0){if(!_[_0x735b('0x43')](_0x3dbe76['predictiveIntervalAvgTalktime'])&&_0x3dbe76[_0x735b('0x54')]>0x0){return!![];}loggerPredictive['info'](_0x735b('0x55'));if(!_['isUndefined'](_0x3dbe76['predictiveIntervalAvgHoldtime'])&&_0x3dbe76[_0x735b('0x56')]>0x0){return!![];}loggerPredictive[_0x735b('0x4b')](_0x735b('0x57'));}else{loggerPredictive[_0x735b('0x4b')](_0x735b('0x58'));}}else{loggerPredictive[_0x735b('0x4b')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x5e466b){return function(_0x31eb5a){loggerPredictive[_0x735b('0x4b')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x735b('0x4b')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x31eb5a[_0x735b('0x59')]);loggerPredictive[_0x735b('0x4b')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x31eb5a[_0x735b('0x5a')]);loggerPredictive[_0x735b('0x4b')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x31eb5a[_0x735b('0x5b')]);loggerPredictive['info'](_0x735b('0x5c'),_0x31eb5a[_0x735b('0x5d')]);loggerPredictive[_0x735b('0x4b')](_0x735b('0x5e'),_0x31eb5a['erlangAbandonmentRate']);loggerPredictive[_0x735b('0x4b')]('---------------------------');_[_0x735b('0x5f')](_0x5e466b,_0x31eb5a);};}function ifInterval(_0x2dec7d,_0x434c18){if(_[_0x735b('0x43')](_0x434c18)){return![];}return utils[_0x735b('0x60')](undefined,_0x434c18)<_0x2dec7d*0x3c;}function clearPredictiveAttributes(_0x15a4f0){if(_0x15a4f0[_0x735b('0x2c')]){_0x15a4f0[_0x735b('0x2c')]=undefined;loggerPredictive['debug'](_0x15a4f0[_0x735b('0x61')],_0x735b('0x62'));}if(_0x15a4f0[_0x735b('0x2b')]){_0x15a4f0[_0x735b('0x2b')]=undefined;loggerPredictive[_0x735b('0x45')](_0x15a4f0[_0x735b('0x61')],_0x735b('0x63'));}if(_0x15a4f0[_0x735b('0x64')]){clearInterval(_0x15a4f0[_0x735b('0x64')]);_0x15a4f0[_0x735b('0x64')]=undefined;loggerPredictive[_0x735b('0x45')](_0x15a4f0[_0x735b('0x61')],_0x735b('0x65'));}}function loggerCatchPredictive(_0x5679b8,_0x402715){return function(_0xc3a832){loggerPredictive[_0x735b('0x66')](_0x402715['name'],_0x5679b8);loggerPredictive['error'](_0xc3a832['stack']);clearPredictiveAttributes(_0x402715);};}function loggerCatch(_0x3a0c17){return function(_0x3bce3f){logger['error'](_0x3a0c17,util['inspect'](_0x3bce3f,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x23f9f2,_0x57dd37,_0x596f53){return function(_0x14d14a){utils[_0x735b('0x67')](_0x57dd37,_0x596f53,0x0);logger[_0x735b('0x66')](_0x23f9f2,util[_0x735b('0x46')](_0x14d14a,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2d2968){return function(_0x4786e8){if(isNotNull(_0x4786e8)&&isNotNull(_0x4786e8[0x0])){if(_0x4786e8[0x0]['contactsRescheduled']>0x0){_0x2d2968[_0x735b('0x68')]=utils[_0x735b('0x69')][_0x735b('0x6a')];logger[_0x735b('0x4b')]('[getContactDialer2][ReScheduled]'+_0x2d2968[_0x735b('0x61')],_0x4786e8[0x0][_0x735b('0x6b')],_0x735b('0x6c'));}else{_0x2d2968[_0x735b('0x68')]=utils[_0x735b('0x69')][_0x735b('0x6d')];logger[_0x735b('0x4b')](_0x735b('0x6e')+_0x2d2968[_0x735b('0x61')]);}}};}function createObjHistory(_0x5eb8b0,_0x4e2257,_0xb0da86,_0x570336,_0x55ba1f){_0x5eb8b0[_0x735b('0x68')]=_0xb0da86;var _0x28fcf2=new Action(_0x5eb8b0,_0x4e2257);var _0x559263=new History(_0x28fcf2);_0x559263[_0x735b('0x6f')]=_0x570336;_0x559263[_0x735b('0x70')]=_0x55ba1f;_0x559263[_0x735b('0x71')]=_0x28fcf2[_0x735b('0x72')];return _0x559263;}function unlockQueueStatus(_0x11e278,_0x4b5659){setTimeout(function(){if(_[_0x735b('0x43')](_0x11e278[_0x735b('0x73')])){loggerBooked[_0x735b('0x66')](_0x735b('0x74'),_0x4b5659);}_0x11e278['queueStatusComplete']=!![];loggerBooked[_0x735b('0x4b')](_0x735b('0x75'),_0x4b5659,JSON[_0x735b('0x76')](_[_0x735b('0x77')](_0x11e278,[_0x735b('0x61'),_0x735b('0x73')])));},0x1f3);}function checkInterval(_0x2b563e){return function(){if(!isNotNull(_0x2b563e[_0x735b('0x78')])){_0x2b563e[_0x735b('0x68')]=utils[_0x735b('0x69')]['NULL_INTERVAL'];throw _0x2b563e[_0x735b('0x61')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x2b563e[_0x735b('0x78')][_0x735b('0x79')])){_0x2b563e['message']=utils[_0x735b('0x69')]['NULL_INTERVAL'];throw _0x2b563e[_0x735b('0x61')]+_0x735b('0x7a');}if(!isNotNull(_[_0x735b('0x4a')](_0x2b563e[_0x735b('0x78')][_0x735b('0x79')]))){_0x2b563e[_0x735b('0x68')]=utils[_0x735b('0x69')]['NULL_INTERVAL'];throw _0x2b563e[_0x735b('0x61')]+_0x735b('0x7a');}};}function checkIsIVRCampaignActive(_0x53a2bb){return function(){if(!utils[_0x735b('0x7b')](_0x53a2bb)){_0x53a2bb[_0x735b('0x68')]=utils[_0x735b('0x69')][_0x735b('0x7c')];throw _0x53a2bb[_0x735b('0x61')]+_0x735b('0x7d');}};}function emitCampaignSummary(_0x5d3232){if(utils['isIVRCampaign'](_0x5d3232)){emit(util[_0x735b('0x47')]('campaign:ivr:%s',_0x5d3232[_0x735b('0x61')]),_0x735b('0x7e'),_0x5d3232);}}function loggerCatchQueueSummary(_0x4ca275,_0x50d407){return function(_0x26a523){clearPredictiveAttributes(_0x50d407);emitCampaignSummary(_0x50d407);loggerSyncQueueSummary[_0x735b('0x45')](_0x4ca275,util[_0x735b('0x46')](_0x26a523,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x45cc81){if(_0x45cc81[_0x735b('0x7f')]){if(_0x45cc81[_0x735b('0x80')]===0x0){_0x45cc81[_0x735b('0x7f')]=![];_0x45cc81[_0x735b('0x68')]=utils[_0x735b('0x69')]['INACTIVE'];loggerSyncQueueSummary[_0x735b('0x45')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x45cc81[_0x735b('0x61')],'is\x20not\x20active');}else{_0x45cc81[_0x735b('0x68')]=utils['CAMPAIGN_STATUS'][_0x735b('0x81')];loggerSyncQueueSummary['debug'](_0x735b('0x82'),_0x45cc81['name'],_0x735b('0x83'));}emitCampaignSummary(_0x45cc81);}}function myreject(_0x117f32){return function(_0x52f168){return _0x117f32(msgResponse(_0x735b('0x84'),_0x735b('0x85'),JSON[_0x735b('0x76')](_0x52f168)));};}Dialer['prototype'][_0x735b('0x86')]=function(_0x582154){return!_[_0x735b('0x43')](_0x582154)&&_0x582154&&!_[_0x735b('0x43')](_0x582154[_0x735b('0x61')])&&!_[_0x735b('0x43')](_0x582154[_0x735b('0x87')])&&_0x582154[_0x735b('0x87')]&&(this[_0x735b('0x25')][util[_0x735b('0x47')]('SIP/%s',_0x582154[_0x735b('0x61')])]['status']==='reachable'||this[_0x735b('0x25')][util[_0x735b('0x47')](_0x735b('0x88'),_0x582154[_0x735b('0x61')])][_0x735b('0x89')]===_0x735b('0x8a'));};Dialer[_0x735b('0x1f')][_0x735b('0x8b')]=function(_0x2b695f){var _0x1140f4=this;return function(){if(!_0x1140f4[_0x735b('0x86')](_0x2b695f[_0x735b('0x8c')])){if(!_0x1140f4[_0x735b('0x86')](_0x2b695f[_0x735b('0x8d')])){_0x2b695f['message']=utils[_0x735b('0x69')]['TRUNK_NOT_REACHABLE'];throw _0x2b695f[_0x735b('0x61')]+_0x735b('0x8e');}}};};Dialer[_0x735b('0x1f')]['checkIfTime']=function(_0x29eb44,_0x5282f5,_0x54584a,_0x2d6d77){var _0x58a43e=this;return function(){var _0x230ee7=!![];return _0x58a43e[_0x735b('0x8f')](_0x29eb44,_0x5282f5,_0x54584a,_0x2d6d77,_0x230ee7);};};Dialer[_0x735b('0x1f')][_0x735b('0x90')]=function(_0x305b9c,_0x31256e,_0xf5349,_0x593180){var _0x3b0043=this;return function(){var _0x1591a1=![];return _0x3b0043[_0x735b('0x8f')](_0x305b9c['Intervals'],_0x31256e,_0xf5349,_0x593180,_0x1591a1);};};Dialer[_0x735b('0x1f')][_0x735b('0x8f')]=function(_0x234e77,_0x1845f1,_0x233fb3,_0xb92958,_0x45027d){var _0x1d2dc5=[];return new Promise(function(_0x389a2f,_0x2f4d4c){if(!isNotNull(_0x234e77)){_0xb92958[_0x735b('0x68')]=utils[_0x735b('0x69')][_0x735b('0x91')];return _0x2f4d4c(msgResponse(_0x735b('0x92'),'Failure',_0x233fb3+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x735b('0x4a')](_0x234e77)){_0xb92958[_0x735b('0x68')]=utils[_0x735b('0x69')][_0x735b('0x93')];return _0x2f4d4c(msgResponse('ifTime',_0x735b('0x94'),_0x233fb3+_0x735b('0x95')));}if(_0x1845f1&&_[_0x735b('0x43')](config['timezones'][_0x1845f1])){_0xb92958[_0x735b('0x68')]=utils['CAMPAIGN_STATUS'][_0x735b('0x96')];return _0x2f4d4c(msgResponse(_0x735b('0x92'),_0x735b('0x94'),_0x233fb3+_0x735b('0x97')+_0x1845f1));}if(_[_0x735b('0x98')](_0x234e77)){for(var _0x355f47=0x0;_0x355f47<_0x234e77[_0x735b('0x99')];_0x355f47+=0x1){_0x1d2dc5[_0x735b('0x9a')](ami[_0x735b('0x9b')]({'action':'command','command':util[_0x735b('0x47')](_0x735b('0x9c'),_0x234e77[_0x355f47]['interval'],!_['isUndefined'](config[_0x735b('0x9d')][_0x1845f1])?_0x1845f1:'')})['then'](function(_0x52a2b6){return _0x52a2b6[_0x735b('0x9e')]['indexOf'](_0x735b('0x9f'))>=0x0;})[_0x735b('0xa0')](myreject(_0x2f4d4c)));}}else{_0x1d2dc5[_0x735b('0x9a')](ami['Action']({'action':_0x735b('0xa1'),'command':util[_0x735b('0x47')](_0x735b('0x9c'),_0x234e77,!_[_0x735b('0x43')](config[_0x735b('0x9d')][_0x1845f1])?_0x1845f1:'')})[_0x735b('0x41')](function(_0x465b49){return _0x465b49[_0x735b('0x9e')][_0x735b('0xa2')](_0x735b('0x9f'))>=0x0;})[_0x735b('0xa0')](myreject(_0x2f4d4c)));}Promise['all'](_0x1d2dc5)[_0x735b('0x41')](function(_0x10178b){var _0x28a8bc=_['some'](_0x10178b);if(_0x28a8bc){return _0x389a2f(_0x28a8bc);}else{_0xb92958[_0x735b('0x68')]=_0x45027d?utils[_0x735b('0x69')][_0x735b('0xa3')]:utils[_0x735b('0x69')][_0x735b('0xa4')];return _0x2f4d4c(msgResponse(_0x735b('0xa5'),_0x735b('0x94'),_0x735b('0xa6')+_0x45027d+'\x20'+_0x233fb3+_0x735b('0xa7')+util['inspect'](_0x234e77,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x1845f1));}})[_0x735b('0xa0')](function(_0x559f20){return _0x2f4d4c(msgResponse(_0x735b('0x92'),_0x735b('0x94'),JSON[_0x735b('0x76')](_0x559f20)));});});};Dialer[_0x735b('0x1f')]['loopCampaigns']=function(){var _0x7d91b6=this;return cmHopper[_0x735b('0xa8')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x7d91b6[_0x735b('0xa9')]();},0x3e8);});};Dialer[_0x735b('0x1f')][_0x735b('0xa9')]=function(){var _0x516a27=this;var _0x390819;for(var _0x13eb87 in this[_0x735b('0x23')]){if(typeof this[_0x735b('0x23')][_0x13eb87]!==_0x735b('0xaa')){_0x390819=this['campaigns'][_0x13eb87];if(utils[_0x735b('0xab')](_0x390819)&&utils[_0x735b('0x7b')](_0x390819)){_0x390819[_0x735b('0x7f')]=!![];Promise['resolve']()[_0x735b('0x41')](checkIsIVRCampaignActive(_0x390819))[_0x735b('0x41')](checkInterval(_0x390819))[_0x735b('0x41')](_0x516a27[_0x735b('0x8b')](_0x390819))[_0x735b('0x41')](_0x516a27[_0x735b('0xac')](_0x390819[_0x735b('0xad')],_0x390819[_0x735b('0xae')],_0x390819[_0x735b('0x61')],_0x390819))[_0x735b('0x41')](_0x516a27[_0x735b('0x90')](_0x390819[_0x735b('0x78')],_0x390819[_0x735b('0xae')],_0x390819['name'],_0x390819))[_0x735b('0x41')](_0x516a27[_0x735b('0xaf')](_0x390819))[_0x735b('0xa0')](loggerCatchQueueSummary('[syncCampaigns]',_0x390819));}else{notSendMessagesCampaign(_0x390819);}}}};Dialer['prototype'][_0x735b('0xb0')]=function(_0xcbac6d){if(_0xcbac6d['dialMethod']!==_0x735b('0xb')){clearPredictiveAttributes(_0xcbac6d);}switch(_0xcbac6d[_0x735b('0xb1')]){case _0x735b('0xb2'):this['handlePower'](_0xcbac6d,0x1);break;case'power':this[_0x735b('0xb3')](_0xcbac6d,_0xcbac6d['dialPowerLevel']);break;case _0x735b('0xb'):this[_0x735b('0xb')](_0xcbac6d);break;case _0x735b('0xa'):this[_0x735b('0xb3')](_0xcbac6d,0x1);break;default:logger[_0x735b('0x66')](_0x735b('0xb4'),_0xcbac6d['name'],_0x735b('0xb5'));}};Dialer['prototype']['ifTime']=function(_0x5323ff,_0xc89574){var _0x1de9a8=_0x5323ff[_0x735b('0xae')];var _0x34acd7=_0xc89574?_0x5323ff[_0x735b('0xad')]:_0x5323ff[_0x735b('0x78')][_0x735b('0x79')];logger[_0x735b('0xb6')](_0x735b('0xb7'),_0x34acd7,_0x1de9a8,_0x5323ff[_0x735b('0x61')],util[_0x735b('0x47')](_0x735b('0xb8'),_0x5323ff[_0x735b('0x61')],_0x5323ff['id']));var _0x5c2fe2=null;return Interval[_0x735b('0xb9')](_0x34acd7,_0x1de9a8)[_0x735b('0x41')](function(_0x58aa0b){if(_0x58aa0b===!![]){return _0x58aa0b;}else{_0x5323ff[_0x735b('0x68')]=_0xc89574?utils[_0x735b('0x69')][_0x735b('0xa3')]:utils[_0x735b('0x69')][_0x735b('0xa4')];_0x5c2fe2=msgResponse(_0x735b('0xa5'),_0x735b('0x94'),_0x735b('0xa6')+_0xc89574+'\x20'+_0x5323ff['name']+_0x735b('0xa7')+util[_0x735b('0x46')](_0x34acd7,{'showHidden':![],'depth':null})+_0x735b('0xba')+_0x1de9a8);}if(_0x5c2fe2!==null){logger[_0x735b('0xb6')](_0x735b('0xbb'),_0x5c2fe2);_0x5c2fe2[_0x735b('0xbc')]=_0xc89574;throw _0x5c2fe2;}})[_0x735b('0xa0')](function(_0x31d47c){logger[_0x735b('0x66')](_0x735b('0xbd'),_0x31d47c);throw msgResponse('[ifTime][Action]','Error',util['inspect'](_0x31d47c,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x735b('0x2f')]=function(_0x40f26d){if(this[_0x735b('0x22')][_0x40f26d[_0x735b('0xbe')]]){if(this[_0x735b('0x2a')][_0x40f26d['uniqueid']]&&this[_0x735b('0x2a')][_0x40f26d[_0x735b('0xbf')]][_0x735b('0x44')]!==_0x735b('0xc0')){this[_0x735b('0xc1')](this[_0x735b('0x22')][_0x40f26d[_0x735b('0xbe')]]);this[_0x735b('0x2a')][_0x40f26d['uniqueid']]['answertime']=moment()['format'](_0x735b('0xc2'));}}};Dialer[_0x735b('0x1f')][_0x735b('0x35')]=function(_0x366c4a){var _0x4f6665=this['uniqueId'][_0x366c4a['uniqueid']];if(this['voiceQueues'][_0x366c4a[_0x735b('0xbe')]]){if(_0x4f6665&&_0x4f6665[_0x735b('0x44')]!=='ivr'){delete this[_0x735b('0x2a')][_0x366c4a[_0x735b('0xbf')]];this[_0x735b('0x22')][_0x366c4a[_0x735b('0xbe')]][_0x735b('0xc3')]+=0x1;var _0x4f9c3c=new AgentComplete(_0x4f6665,_0x366c4a);if(_0x366c4a[_0x735b('0xc4')]===_0x735b('0xc5')){_0x4f9c3c['agiafterat']=this['voiceQueues'][_0x366c4a[_0x735b('0xbe')]]['dialQueueProject2']&&this[_0x735b('0x22')][_0x366c4a[_0x735b('0xbe')]][_0x735b('0xc6')]?moment()[_0x735b('0x47')](_0x735b('0xc2')):undefined;}hopperUtils[_0x735b('0xc7')](_0x4f9c3c)[_0x735b('0xa0')](loggerCatch(_0x735b('0xc8')));hopperUtils[_0x735b('0xc9')](_0x4f9c3c)[_0x735b('0xa0')](loggerCatch(_0x735b('0xca')));}}};Dialer[_0x735b('0x1f')][_0x735b('0x32')]=function(_0x5d2941){var _0x25303d=this[_0x735b('0x2a')][_0x5d2941[_0x735b('0xbf')]];var _0x4b7179=this;var _0x1b97ea=![];var _0x8bcc3f;var _0x172499;if(this[_0x735b('0x22')][_0x5d2941['queue']]){if(_0x25303d&&_0x25303d[_0x735b('0x44')]!==_0x735b('0xc0')){delete this[_0x735b('0x2a')][_0x5d2941[_0x735b('0xbf')]];this['updateOriginated'](this[_0x735b('0x22')][_0x5d2941[_0x735b('0xbe')]]);_0x25303d[_0x735b('0xcb')]=moment()[_0x735b('0x47')](_0x735b('0xc2'));var _0x2634f0=new QueueCallerAbandon(_0x25303d,_0x5d2941);if(utils[_0x735b('0x60')](_0x25303d[_0x735b('0xcb')],_0x25303d[_0x735b('0xcc')])>=_0x25303d[_0x735b('0xcd')]){this['voiceQueues'][_0x5d2941[_0x735b('0xbe')]][_0x735b('0xce')]+=0x1;this['voiceQueues'][_0x5d2941['queue']][_0x735b('0xcf')]+=0x1;this[_0x735b('0x22')][_0x5d2941[_0x735b('0xbe')]][_0x735b('0xd0')]+=0x1;_0x2634f0[_0x735b('0x6f')]=0xa;_0x2634f0['statedesc']='Drop';_0x2634f0[_0x735b('0xd1')]=_0x735b('0xd2');_0x2634f0[_0x735b('0xd3')]=this[_0x735b('0x22')][_0x5d2941[_0x735b('0xbe')]][_0x735b('0xd4')]?moment()[_0x735b('0x47')](_0x735b('0xc2')):undefined;_0x2634f0['countdropretry']+=0x1;_0x2634f0[_0x735b('0xd5')]+=0x1;_0x8bcc3f=this[_0x735b('0x22')][_0x5d2941['queue']][_0x735b('0xd6')];_0x172499=this[_0x735b('0x22')][_0x5d2941['queue']][_0x735b('0xd7')];hopperUtils[_0x735b('0xd8')](_0x2634f0,_0x2634f0[_0x735b('0x6f')],_0x25303d[_0x735b('0xd9')])[_0x735b('0x41')](function(_0x548c02){_0x1b97ea=_0x548c02[_0x735b('0xda')]==0x1;if(_0x2634f0[_0x735b('0xdb')]>=_0x4b7179[_0x735b('0x22')][_0x5d2941[_0x735b('0xbe')]][_0x735b('0xdc')]){_0x4b7179[_0x735b('0xdd')](_0x2634f0,_0x548c02[_0x735b('0xda')]);}else{hopperUtils[_0x735b('0xde')]({'active':![],'countdropretry':_0x2634f0[_0x735b('0xdb')],'scheduledat':moment()[_0x735b('0xdf')](_0x4b7179[_0x735b('0x22')][_0x5d2941['queue']][_0x735b('0xd6')],'minutes')[_0x735b('0x47')](_0x735b('0xc2')),'ContactId':_0x25303d[_0x735b('0xe0')],'ListId':_0x25303d['ListId'],'VoiceQueueId':_0x25303d[_0x735b('0xe1')]||undefined,'CampaignId':_0x25303d[_0x735b('0xe2')]||undefined})[_0x735b('0xa0')](loggerCatch(_0x735b('0xe3')));var _0x4b9099=new History(_0x2634f0);_0x4b9099[_0x735b('0x6f')]=0xa;_0x4b9099['statedesc']=_0x735b('0xe4');_0x4b9099[_0x735b('0x72')]=moment()[_0x735b('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x4b9099[_0x735b('0x71')]=_0x4b9099[_0x735b('0x72')];_0x4b9099[_0x735b('0xe5')]=_0x2634f0[_0x735b('0xe5')];_0x4b9099[_0x735b('0xe6')]=_0x2634f0['calleridnum'];hopperUtils['createHistory'](_0x4b9099)[_0x735b('0xa0')](loggerCatch(_0x735b('0xe7')));}})['then'](function(){if(_0x1b97ea)hopperUtils['swapAdditionalPhones'](_0x2634f0,_0x8bcc3f,_0x172499)['then'](function(){return 0x1;});});}else{this[_0x735b('0x22')][_0x5d2941['queue']][_0x735b('0x50')]+=0x1;this[_0x735b('0x22')][_0x5d2941[_0x735b('0xbe')]][_0x735b('0xe8')]+=0x1;_0x2634f0[_0x735b('0x6f')]=0xb;_0x2634f0['statedesc']='Abandoned';_0x2634f0[_0x735b('0xd1')]=_0x735b('0xe9');_0x2634f0[_0x735b('0xea')]+=0x1;_0x2634f0['countglobal']+=0x1;_0x8bcc3f=this['voiceQueues'][_0x5d2941[_0x735b('0xbe')]][_0x735b('0xeb')];_0x172499=this[_0x735b('0x22')][_0x5d2941[_0x735b('0xbe')]][_0x735b('0xd7')];hopperUtils[_0x735b('0xd8')](_0x2634f0,_0x2634f0[_0x735b('0x6f')],_0x25303d[_0x735b('0xd9')])[_0x735b('0x41')](function(_0x1af18c){if(_0x2634f0[_0x735b('0xea')]>=_0x4b7179[_0x735b('0x22')][_0x5d2941[_0x735b('0xbe')]][_0x735b('0xec')]){_0x4b7179[_0x735b('0xdd')](_0x2634f0,_0x1af18c[_0x735b('0xda')]);}else{hopperUtils[_0x735b('0xde')]({'active':![],'countabandonedretry':_0x2634f0[_0x735b('0xea')],'scheduledat':moment()[_0x735b('0xdf')](_0x4b7179[_0x735b('0x22')][_0x5d2941['queue']]['dialAbandonedRetryFrequency'],_0x735b('0xed'))['format'](_0x735b('0xc2')),'ContactId':_0x25303d[_0x735b('0xe0')],'ListId':_0x25303d['ListId'],'VoiceQueueId':_0x25303d[_0x735b('0xe1')]||undefined,'CampaignId':_0x25303d[_0x735b('0xe2')]||undefined})[_0x735b('0xa0')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x35598a=new History(_0x2634f0);_0x35598a[_0x735b('0x6f')]=0xb;_0x35598a['statedesc']=_0x735b('0xee');_0x35598a[_0x735b('0x72')]=moment()['format'](_0x735b('0xc2'));_0x35598a[_0x735b('0x71')]=_0x35598a[_0x735b('0x72')];_0x35598a['calleridname']=_0x2634f0[_0x735b('0xe5')];_0x35598a[_0x735b('0xe6')]=_0x2634f0[_0x735b('0xe6')];hopperUtils[_0x735b('0xc7')](_0x35598a)[_0x735b('0xa0')](loggerCatch(_0x735b('0xef')));}})[_0x735b('0x41')](function(){if(_0x1b97ea)hopperUtils[_0x735b('0xf0')](_0x2634f0,_0x8bcc3f,_0x172499)[_0x735b('0x41')](function(){return 0x1;});});}}}};Dialer[_0x735b('0x1f')][_0x735b('0xf1')]=function(_0x295ab3){if(this[_0x735b('0x28')][_0x295ab3[_0x735b('0xbf')]]){this[_0x735b('0x28')][_0x295ab3[_0x735b('0xbf')]]['channel']=_0x295ab3[_0x735b('0xf2')];}if(this[_0x735b('0x2a')][_0x295ab3[_0x735b('0xbf')]]){this[_0x735b('0x2a')][_0x295ab3[_0x735b('0xbf')]][_0x735b('0xf2')]=_0x295ab3['channel'];}};Dialer[_0x735b('0x1f')][_0x735b('0x3c')]=function(_0x29dfef){if(!this[_0x735b('0x28')][_0x29dfef[_0x735b('0xf3')]]){return;}var _0xe7bd58=this[_0x735b('0x22')][this[_0x735b('0x28')][_0x29dfef['actionid']]['queue']][_0x735b('0xf4')]||_0x735b('0xf5');if(_0xe7bd58===_0x735b('0xf6')){if(this[_0x735b('0x28')][_0x29dfef[_0x735b('0xf3')]]&&_[_0x735b('0xf7')](this['actions'][_0x29dfef[_0x735b('0xf3')]][_0x735b('0xf8')])&&_0x29dfef['status']==='1'&&_0x29dfef['paused']==='0'){if(this[_0x735b('0x24')][_0x29dfef[_0x735b('0xf9')]]){if(!this[_0x735b('0x24')][_0x29dfef['stateinterface']][_0x735b('0xf8')]){this[_0x735b('0x24')][_0x29dfef[_0x735b('0xf9')]]['locked']=!![];this[_0x735b('0x28')][_0x29dfef[_0x735b('0xf3')]][_0x735b('0xf8')]=!![];this[_0x735b('0x28')][_0x29dfef[_0x735b('0xf3')]][_0x735b('0xf9')]=_0x29dfef[_0x735b('0xf9')];}}}}else if(_0xe7bd58==='rrmemory'){if(this[_0x735b('0x28')][_0x29dfef['actionid']]){if(this[_0x735b('0x24')][_0x29dfef[_0x735b('0xf9')]]){this[_0x735b('0x28')][_0x29dfef[_0x735b('0xf3')]][_0x735b('0xf9')]=_0x29dfef[_0x735b('0xf9')];if(_[_0x735b('0xf7')](this[_0x735b('0xfa')][this[_0x735b('0x28')][_0x29dfef[_0x735b('0xf3')]][_0x735b('0xbe')]])){this[_0x735b('0xfa')][this[_0x735b('0x28')][_0x29dfef[_0x735b('0xf3')]][_0x735b('0xbe')]]=[];}this[_0x735b('0xfa')][this[_0x735b('0x28')][_0x29dfef[_0x735b('0xf3')]]['queue']][_0x735b('0x9a')](_['merge'](_[_0x735b('0x77')](this[_0x735b('0x28')][_0x29dfef[_0x735b('0xf3')]],['idHopper',_0x735b('0xf9')]),{'status':_0x29dfef['status'],'paused':_0x29dfef['paused']}));}}}};Dialer['prototype']['syncQueueStatusComplete']=function(_0x16d3c6){if(!this[_0x735b('0x28')][_0x16d3c6[_0x735b('0xf3')]]){return;}var _0x33e58c=this;var _0x538b6c=this[_0x735b('0x22')][this[_0x735b('0x28')][_0x16d3c6['actionid']][_0x735b('0xbe')]];var _0x1df741=_0x538b6c[_0x735b('0xf4')]||_0x735b('0xf5');if(_0x1df741==='roundrobin'){if(this[_0x735b('0x28')][_0x16d3c6[_0x735b('0xf3')]]&&this[_0x735b('0x28')][_0x16d3c6[_0x735b('0xf3')]][_0x735b('0xf9')]){this[_0x735b('0x21')][_0x735b('0xfb')](this[_0x735b('0x28')][_0x16d3c6['actionid']][_0x735b('0xfc')],this[_0x735b('0x28')][_0x16d3c6[_0x735b('0xf3')]][_0x735b('0xf9')])[_0x735b('0xa0')](function(_0x4d73b3){logger[_0x735b('0x66')](_0x735b('0xfd'),util[_0x735b('0x46')](_0x4d73b3,{'showHidden':![],'depth':null}));})['finally'](function(){_0x33e58c['updateOriginated'](_0x33e58c[_0x735b('0x22')][_0x33e58c['actions'][_0x16d3c6['actionid']][_0x735b('0xbe')]]);_0x33e58c[_0x735b('0x24')][_0x33e58c['actions'][_0x16d3c6['actionid']][_0x735b('0xf9')]]['locked']=![];delete _0x33e58c[_0x735b('0x28')][_0x16d3c6['actionid']];unlockQueueStatus(_0x538b6c);});}else{this['updateOriginated'](this[_0x735b('0x22')][this[_0x735b('0x28')][_0x16d3c6[_0x735b('0xf3')]][_0x735b('0xbe')]]);hopperUtils[_0x735b('0xde')]({'active':![],'ContactId':this['actions'][_0x16d3c6[_0x735b('0xf3')]]['ContactId'],'ListId':this[_0x735b('0x28')][_0x16d3c6[_0x735b('0xf3')]][_0x735b('0xfe')],'VoiceQueueId':this['actions'][_0x16d3c6[_0x735b('0xf3')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x735b('0x28')][_0x16d3c6[_0x735b('0xf3')]][_0x735b('0xe2')]||undefined})[_0x735b('0xa0')](loggerCatch(_0x735b('0xff')));delete this[_0x735b('0x28')][_0x16d3c6[_0x735b('0xf3')]];unlockQueueStatus(_0x538b6c);}}else if(_0x1df741===_0x735b('0xf5')){var _0x21bb2d;if(this[_0x735b('0x28')][_0x16d3c6[_0x735b('0xf3')]]&&!_[_0x735b('0x4a')](this[_0x735b('0xfa')][this['actions'][_0x16d3c6[_0x735b('0xf3')]][_0x735b('0xbe')]])){if(this[_0x735b('0x2d')][_0x33e58c[_0x735b('0x28')][_0x16d3c6['actionid']][_0x735b('0xbe')]]){this['queueBookedRR'][_0x33e58c[_0x735b('0x28')][_0x16d3c6[_0x735b('0xf3')]][_0x735b('0xbe')]]=this['queueBookedRR'][this[_0x735b('0x28')][_0x16d3c6[_0x735b('0xf3')]][_0x735b('0xbe')]]?this['queueBookedRR'][this[_0x735b('0x28')][_0x16d3c6[_0x735b('0xf3')]][_0x735b('0xbe')]]:this['queueBooked'][this[_0x735b('0x28')][_0x16d3c6[_0x735b('0xf3')]][_0x735b('0xbe')]]?this[_0x735b('0xfa')][this[_0x735b('0x28')][_0x16d3c6[_0x735b('0xf3')]]['queue']]['_rr']||0x0:0x0;}this[_0x735b('0xfa')][this[_0x735b('0x28')][_0x16d3c6['actionid']][_0x735b('0xbe')]][_0x735b('0x100')]=this['queueBookedRR'][this[_0x735b('0x28')][_0x16d3c6[_0x735b('0xf3')]]['queue']];for(var _0x25aad7=0x0;_0x25aad7=_0x3b51b5['dialGlobalMaxRetry']){_0xac4692['stateGlobal'](_0x5add0e,_0x303503,_0x723097,_0x735b('0x122'));}else{if(_0x5add0e['countmachineretry']>=_0x3b51b5[_0x735b('0x123')]){_0xac4692[_0x735b('0x124')](_0x5add0e,_0x303503,_0x723097,_0x735b('0x125'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x5add0e[_0x735b('0x11d')],'scheduledat':moment()[_0x735b('0xdf')](_0x3b51b5[_0x735b('0x126')],'minutes')[_0x735b('0x47')](_0x735b('0xc2')),'ContactId':_0x5add0e[_0x735b('0xe0')],'ListId':_0x5add0e[_0x735b('0xfe')],'VoiceQueueId':_0x5add0e[_0x735b('0xe1')]||undefined,'CampaignId':_0x5add0e[_0x735b('0xe2')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x303503({'reschedule':0x1});}}});}if(_0x2af246[_0x735b('0x44')]===_0x735b('0xc0')&&this[_0x735b('0x23')][_0x2af246[_0x735b('0xbe')]][_0x735b('0x114')]&&_0x343140['value']===_0x735b('0x115')){delete this[_0x735b('0x2a')][_0x343140['uniqueid']];this[_0x735b('0xc1')](this[_0x735b('0x23')][_0x2af246['queue']]);_0x196f16=new Hangup(_0x2af246,_0x343140);_0x196f16['state']=0x12;_0x196f16[_0x735b('0x70')]=_0x735b('0x117');_0x196f16[_0x735b('0x127')]='AMD';ami[_0x735b('0x118')](_0x735b('0x128'),ut['buildObj'](_0x196f16,_0x735b('0x119')));this[_0x735b('0x11a')](_0x196f16,'[syncHangupInAMDIvr][createHistory]',_0x735b('0x129'));}if(_0x2af246[_0x735b('0x44')]===_0x735b('0xc0')&&this[_0x735b('0x23')][_0x2af246[_0x735b('0xbe')]]['dialAMDActive']&&_0x343140[_0x735b('0x11b')]===_0x735b('0x11c')){return new Promise(function(_0x5c16fe,_0x329665){delete _0xac4692['uniqueId'][_0x343140[_0x735b('0xbf')]];_0xac4692[_0x735b('0xc1')](_0xac4692[_0x735b('0x23')][_0x2af246[_0x735b('0xbe')]]);_0xac4692['campaigns'][_0x2af246['queue']]['outboundAnswerCallsDay']+=0x1;_0xac4692[_0x735b('0x23')][_0x2af246[_0x735b('0xbe')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x1eeeca=_0xac4692[_0x735b('0x23')][_0x2af246[_0x735b('0xbe')]];var _0x909f9e=new Hangup(_0x2af246,_0x343140);_0x909f9e[_0x735b('0x6f')]=0x13;_0x909f9e['statedesc']=_0x735b('0x12a');_0x909f9e[_0x735b('0x127')]='AMD';_0x909f9e[_0x735b('0x11d')]+=0x1;_0x909f9e[_0x735b('0xd5')]+=0x1;_0x909f9e[_0x735b('0x119')]=!![];ami[_0x735b('0x118')](_0x735b('0x128'),ut[_0x735b('0x12b')](_0x909f9e,_0x735b('0x119')));hopperUtils[_0x735b('0xc7')](_0x909f9e)[_0x735b('0xa0')](loggerCatch(_0x735b('0x12c')));if(_0x909f9e['countbusyretry']+_0x909f9e[_0x735b('0x11f')]+_0x909f9e['countnoanswerretry']+_0x909f9e[_0x735b('0x12d')]+_0x909f9e['countdropretry']+_0x909f9e['countabandonedretry']+_0x909f9e[_0x735b('0x11d')]+_0x909f9e[_0x735b('0x121')]>=_0x1eeeca[_0x735b('0x12e')]){_0xac4692[_0x735b('0x12f')](_0x909f9e,_0x5c16fe,_0x329665,'reason19\x20machine....');}else{if(_0x909f9e[_0x735b('0x11d')]>=_0x1eeeca['dialMachineMaxRetry']){_0xac4692[_0x735b('0x124')](_0x909f9e,_0x5c16fe,_0x329665,_0x735b('0x125'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x909f9e[_0x735b('0x11d')],'scheduledat':moment()[_0x735b('0xdf')](_0x1eeeca[_0x735b('0x126')],_0x735b('0xed'))[_0x735b('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x909f9e[_0x735b('0xe0')],'ListId':_0x909f9e[_0x735b('0xfe')],'VoiceQueueId':_0x909f9e[_0x735b('0xe1')]||undefined,'CampaignId':_0x909f9e['CampaignId']||undefined})['catch'](loggerCatch(_0x735b('0x130')));_0x5c16fe({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x735b('0x131')]=function(_0x3de346){var _0x4db1e4=this[_0x735b('0x2a')][_0x3de346['uniqueid']];var _0x4ea321;if(_0x4db1e4&&_0x4db1e4[_0x735b('0x44')]===_0x735b('0xc0')){delete this['uniqueId'][_0x3de346[_0x735b('0xbf')]];this[_0x735b('0xc1')](this['campaigns'][_0x4db1e4['queue']]);this[_0x735b('0x23')][_0x4db1e4[_0x735b('0xbe')]]['ivrAnswerCallsDay']+=0x1;_0x4ea321=new Hangup(_0x4db1e4,_0x3de346);hopperUtils['createHistory'](_0x4ea321)[_0x735b('0xa0')](loggerCatch(_0x735b('0x132')));hopperUtils[_0x735b('0xc9')](_0x4ea321)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x4db1e4&&_0x4db1e4['type']!==_0x735b('0xc0')&&isNotNull(this[_0x735b('0x22')][_0x4db1e4[_0x735b('0xbe')]]['dialQueueProject'])){delete this[_0x735b('0x2a')][_0x3de346[_0x735b('0xbf')]];this[_0x735b('0xc1')](this[_0x735b('0x22')][_0x4db1e4['queue']]);this[_0x735b('0x22')][_0x4db1e4[_0x735b('0xbe')]][_0x735b('0xc3')]+=0x1;this[_0x735b('0x22')][_0x4db1e4[_0x735b('0xbe')]][_0x735b('0x116')]+=0x1;_0x4ea321=new Hangup(_0x4db1e4,_0x3de346);_0x4ea321[_0x735b('0x6f')]=0x10;_0x4ea321[_0x735b('0x70')]=_0x735b('0x133');_0x4ea321[_0x735b('0x127')]='AGI';hopperUtils[_0x735b('0xc7')](_0x4ea321)[_0x735b('0xa0')](loggerCatch(_0x735b('0x132')));hopperUtils[_0x735b('0xc9')](_0x4ea321)[_0x735b('0xa0')](loggerCatch(_0x735b('0x134')));}if(_0x4db1e4&&_0x4db1e4[_0x735b('0x44')]!==_0x735b('0xc0')&&!isNotNull(this['voiceQueues'][_0x4db1e4[_0x735b('0xbe')]][_0x735b('0x135')])){delete this[_0x735b('0x2a')][_0x3de346['uniqueid']];this[_0x735b('0xc1')](this[_0x735b('0x22')][_0x4db1e4['queue']]);this[_0x735b('0x22')][_0x4db1e4[_0x735b('0xbe')]]['outboundUnknownCallsDay']+=0x1;_0x4ea321=new Hangup(_0x4db1e4,_0x3de346);_0x4ea321[_0x735b('0x6f')]=0xc;_0x4ea321[_0x735b('0x70')]=_0x3de346[_0x735b('0x136')];_0x4ea321[_0x735b('0x127')]='Unknow';hopperUtils[_0x735b('0xc7')](_0x4ea321)['catch'](loggerCatch(_0x735b('0x132')));hopperUtils[_0x735b('0xc9')](_0x4ea321)[_0x735b('0xa0')](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype'][_0x735b('0xd')]=function(_0x29c01b){var _0x2b94f4=this;if(!_0x2b94f4['queuesSummary'][_0x29c01b[_0x735b('0x61')]]){_0x2b94f4[_0x735b('0x137')][_0x29c01b['name']]={'running':![]};}else if(_0x2b94f4[_0x735b('0x137')][_0x29c01b[_0x735b('0x61')]][_0x735b('0x138')]===!![]){return;}else if(_0x2b94f4['queuesSummary'][_0x29c01b[_0x735b('0x61')]][_0x735b('0x138')]===![]){_0x2b94f4['queuesSummary'][_0x29c01b['name']][_0x735b('0x138')]=!![];}var _0x4a8b94=_0x2b94f4['voiceQueues'][_0x29c01b[_0x735b('0x61')]];var _0xa2725e=_0x4a8b94[_0x735b('0x68')]!==utils['CAMPAIGN_STATUS']['INACTIVE'];var _0x4473d2=utils[_0x735b('0x139')](_0x4a8b94);_0x4a8b94[_0x735b('0x13a')]=utils[_0x735b('0x13b')](_0x4a8b94,_0x2b94f4['trunks']);Promise[_0x735b('0x13c')]()[_0x735b('0x41')](function(){if(_0x4a8b94[_0x735b('0x13a')]===utils['CAMPAIGN_STATUS'][_0x735b('0x7c')]){if(_0xa2725e){clearPredictiveAttributes(_0x4a8b94);_0x29c01b[_0x735b('0x2b')]=undefined;_0x29c01b['startProgressive']=undefined;}if(_0x4a8b94[_0x735b('0x13a')]===utils['CAMPAIGN_STATUS'][_0x735b('0x7c')]){_0x29c01b['available']=0x0;_0x29c01b['paused']=0x0;_0x29c01b['inUse']=0x0;_0x29c01b['talking']=0x0;_0x29c01b['pTalking']=0x0;}}else if(_0x4a8b94[_0x735b('0x13a')]===utils['CAMPAIGN_STATUS'][_0x735b('0x13d')]&&!_0x4473d2){return _0x2b94f4[_0x735b('0x92')](_0x4a8b94,!![])['then'](function(){return _0x2b94f4[_0x735b('0x92')](_0x4a8b94,![]);})[_0x735b('0x41')](function(){return _0x2b94f4['checkDialMethod'](_0x4a8b94);})[_0x735b('0xa0')](function(_0x653d6f){loggerSyncQueueSummary[_0x735b('0x45')]('[syncQueueSummary]',util[_0x735b('0x46')](_0x653d6f,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x4a8b94);});}else{clearPredictiveAttributes(_0x4a8b94);}})['then'](function(){var _0x15482e=_0x29c01b[_0x735b('0x13e')](_0x4a8b94);if(_0x15482e||_0x4a8b94[_0x735b('0x13f')]){_0x4a8b94[_0x735b('0x13f')]=![];_0x29c01b['updateReportFromOutboundQueue'](_0x4a8b94);Object[_0x735b('0x140')](_0x4a8b94,_0x29c01b);emitOutboundVoiceQueueSummary(_0x29c01b);}_0x2b94f4['queuesSummary'][_0x4a8b94[_0x735b('0x61')]][_0x735b('0x138')]=![];})[_0x735b('0xa0')](function(_0x4cfa05){logger[_0x735b('0x66')](_0x735b('0x141'),util[_0x735b('0x46')](_0x4cfa05,{'showHidden':![],'depth':null}));_0x2b94f4[_0x735b('0x137')][_0x4a8b94[_0x735b('0x61')]][_0x735b('0x138')]=![];});};Dialer['prototype'][_0x735b('0x142')]=_[_0x735b('0x143')](function(){var _0x91a68d=_[_0x735b('0x144')](this['voiceQueues'],function(_0x354fa0){return _0x354fa0['dialPreviewRecallmeReminder'];});var _0x5c27ba=_[_0x735b('0x144')](this[_0x735b('0x24')],function(_0x576a34){return _0x576a34[_0x735b('0x145')]&&_0x576a34[_0x735b('0x89')]==='reachable';});if(_0x91a68d[_0x735b('0x99')]>0x0&&_0x5c27ba[_0x735b('0x99')]>0x0){return Promise[_0x735b('0x13c')]()[_0x735b('0x41')](cmHopper[_0x735b('0x146')](_[_0x735b('0x147')](_0x91a68d,'id'),previewRecallmeReminderInterval,_[_0x735b('0x147')](_0x5c27ba,'id')))[_0x735b('0x41')](function(_0x5bf1b0){for(var _0x184486=0x0;_0x184486<_0x5bf1b0[_0x735b('0x99')];_0x184486++){var _0xee21c5=_0x5bf1b0[_0x184486][_0x735b('0x148')][_0x735b('0x61')];if(_0xee21c5)io['to'](util['format'](_0x735b('0x149'),_0xee21c5))[_0x735b('0x118')]('user:dialPreviewRecallReminder',{'hopper':_0x5bf1b0[_0x184486]});}})['catch'](function(_0x42e498){logger['error'](_0x735b('0x14a'),_0x42e498);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x735b('0x40')]=function(){var _0x660264=this;setInterval(function(){_0x660264[_0x735b('0x14b')](_0x660264['uniqueId'],_0x735b('0x14c'));_0x660264[_0x735b('0x14b')](_0x660264[_0x735b('0x28')],'[actions]');},0x32c8);};Dialer[_0x735b('0x1f')][_0x735b('0x14b')]=function(_0xbca6b0,_0xfdc226){var _0x1b7084=this;for(var _0x364fb6 in _0xbca6b0){if(typeof _0xbca6b0[_0x364fb6]!=='undefined'){this[_0x735b('0x14d')][_0x735b('0x14e')](function(){if(!_['isNil'](_0xbca6b0[_0x364fb6])){return ami[_0x735b('0x9b')]({'action':_0x735b('0x89'),'channel':_0xbca6b0[_0x364fb6][_0x735b('0xf2')]})['catch'](function(_0x3cecfd){if(_0x3cecfd['message']===_0x735b('0x14f')){setTimeout(function(){if(_0xbca6b0[_0x364fb6]&&_0xbca6b0[_0x364fb6]['type']!==_0x735b('0xc0')){_0x1b7084[_0x735b('0xc1')](_0x1b7084[_0x735b('0x22')][_0xbca6b0[_0x364fb6][_0x735b('0xbe')]]);logger[_0x735b('0x66')](_0x735b('0x150'),_0xfdc226,_0x364fb6,_0xbca6b0[_0x364fb6][_0x735b('0xbe')]);delete _0xbca6b0[_0x364fb6];}if(_0xbca6b0[_0x364fb6]&&_0xbca6b0[_0x364fb6][_0x735b('0x44')]===_0x735b('0xc0')){_0x1b7084['updateOriginated'](_0x1b7084[_0x735b('0x23')][_0xbca6b0[_0x364fb6][_0x735b('0xbe')]]);logger[_0x735b('0x66')](_0x735b('0x151'),_0xfdc226,_0x364fb6,_0xbca6b0[_0x364fb6][_0x735b('0xbe')]);delete _0xbca6b0[_0x364fb6];}},0x2328);}});}});}}};Dialer['prototype'][_0x735b('0x152')]=function(_0x56a1e8){return Promise['resolve']()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x56a1e8))[_0x735b('0xa0')](loggerCatch(_0x735b('0x153')));};Dialer[_0x735b('0x1f')][_0x735b('0xc1')]=function(_0x148352){if(!_['isUndefined'](_0x148352)&&_0x148352!==null){if(typeof _0x148352[_0x735b('0x80')]!==_0x735b('0xaa')){if(_0x148352[_0x735b('0x80')]>0x0){_0x148352['originated']-=0x1;}else{logger[_0x735b('0x66')](_0x735b('0x154'));}}}else{logger['error'](_0x735b('0x155'));}};Dialer[_0x735b('0x1f')][_0x735b('0x156')]=function(_0x19fee9,_0x30cbf2){var _0x447075=this;return function(_0x2b4a56){_0x447075[_0x735b('0xc1')](_0x30cbf2);logger['error'](_0x19fee9,util[_0x735b('0x46')](_0x2b4a56,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x1cd29b,_0x4556c5,_0x165dce){var _0x4cd88a={'state':0x19,'statedesc':_0x735b('0x157')};this[_0x735b('0xc1')](_0x4556c5);this[_0x735b('0x11a')](_[_0x735b('0x5f')](_0x4cd88a,_['pick'](_0x165dce,[_0x735b('0xe0'),_0x735b('0xfe'),_0x735b('0x158'),_0x735b('0xe1'),_0x735b('0xe2')])),_0x735b('0x159'),_0x735b('0x15a'));logger[_0x735b('0x66')](_0x1cd29b);};Dialer[_0x735b('0x1f')]['saveInDb']=function(_0x5f5533,_0x2ef572,_0x8ca83d){hopperUtils[_0x735b('0xc7')](_0x5f5533)['catch'](loggerCatch(_0x2ef572));hopperUtils[_0x735b('0xc9')](_0x5f5533)[_0x735b('0xa0')](loggerCatch(_0x8ca83d));};Dialer[_0x735b('0x1f')]['queueCallerAbandonCreateState']=function(_0x5217da,_0x239cdd){hopperUtils[_0x735b('0xc7')](_0x5217da)['catch'](loggerCatch(_0x735b('0xc8')));if(_0x239cdd==0x0){hopperUtils[_0x735b('0xc9')](_0x5217da)[_0x735b('0xa0')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x735b('0x1f')]['checkPreviewRecallReminder']=function(_0x491104){return Promise[_0x735b('0x13c')]()[_0x735b('0x41')](cmHopper[_0x735b('0x146')](_0x491104['id'],previewRecallmeReminderInterval))['then'](function(_0x354091){for(var _0x5e0b9b=0x0;_0x5e0b9b<_0x354091[_0x735b('0x99')];_0x5e0b9b++){var _0x275943=_0x354091[_0x5e0b9b][_0x735b('0x148')]['name'];if(_0x275943)io['to'](util['format'](_0x735b('0x149'),_0x275943))['emit'](_0x735b('0x15b'),{'hopper':_0x354091[_0x5e0b9b]});}})[_0x735b('0xa0')](function(){});};Dialer[_0x735b('0x1f')][_0x735b('0xaf')]=function(_0xa631a4){var _0x266786=this;return function(){_0x266786['handleIvr'](_0xa631a4);};};Dialer[_0x735b('0x1f')][_0x735b('0x15c')]=function(_0x2c1c5f,_0x54c516){var _0xb25c25=this;var _0x2233af=uuid['v4']();this[_0x735b('0x28')][_0x2233af]=new Action(_0x2c1c5f,_0x54c516,_0x2233af);return new Promise(function(_0x3a5685,_0x25558a){if(_[_0x735b('0x43')](_0x2c1c5f)&&typeof _0x2c1c5f!==_0x735b('0x15d')){return _0x25558a(msgResponse(_0x735b('0x15e'),'Failure',_0x735b('0x15f')));}if(_[_0x735b('0x43')](_0x54c516[_0x735b('0x160')])||_0x54c516[_0x735b('0x160')]===null){return _0x25558a(msgResponse(_0x735b('0x15e'),_0x735b('0x94'),'contact\x20is\x20undefine'));}var _0x4b2f2f={'XMD-CALLERID':_0xb25c25['actions'][_0x2233af][_0x735b('0x161')](),'XMD-AGI':_0x2c1c5f[_0x735b('0x135')]?util['format'](_0x735b('0x162'),ipAgi,_0x2c1c5f[_0x735b('0x135')]):_0x735b('0x163'),'XMD-AGIAFTER':_0x2c1c5f[_0x735b('0xd4')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x2c1c5f[_0x735b('0xd4')]):_0x735b('0x163'),'XMD-QUEUE':utils[_0x735b('0x164')](_0x2c1c5f)?util[_0x735b('0x47')](_0x735b('0x165'),_0x2c1c5f[_0x735b('0x61')],_0x2c1c5f[_0x735b('0x166')]||'',_0x2c1c5f[_0x735b('0xc6')]?'c':'',_0x2c1c5f[_0x735b('0xcd')]||0x3):'NONE','XMD-CONTACTID':_0x54c516['ContactId'],'XMD-CDRTYPE':_0x735b('0x8'),'CALLERID(all)':_0xb25c25['actions'][_0x2233af][_0x735b('0x161')](),'XMD-AMD':_0x2c1c5f['dialAMDActive']?_0x735b('0x13d'):_0x735b('0x163'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x2c1c5f[_0x735b('0x114')]){_0x4b2f2f[_0x735b('0x167')]=_0x2c1c5f[_0x735b('0x168')]||0x9c4;_0x4b2f2f[_0x735b('0x169')]=_0x2c1c5f['dialAMDGreeting']||0x5dc;_0x4b2f2f[_0x735b('0x16a')]=_0x2c1c5f[_0x735b('0x16b')]||0x320;_0x4b2f2f['XMD-AMDTOTALANALYSISTIME']=_0x2c1c5f[_0x735b('0x16c')]||0x1388;_0x4b2f2f[_0x735b('0x16d')]=_0x2c1c5f[_0x735b('0x16e')]||0x64;_0x4b2f2f[_0x735b('0x16f')]=_0x2c1c5f[_0x735b('0x170')]||0x32;_0x4b2f2f[_0x735b('0x171')]=_0x2c1c5f[_0x735b('0x172')]||0x3;_0x4b2f2f[_0x735b('0x173')]=_0x2c1c5f[_0x735b('0x174')]||0x100;_0x4b2f2f[_0x735b('0x175')]=_0x2c1c5f[_0x735b('0x176')]||0x1388;}if(utils[_0x735b('0x164')](_0x2c1c5f)){_0x4b2f2f['XMD-VOICEQUEUEID']=_0x54c516[_0x735b('0xe1')];}else{_0x4b2f2f[_0x735b('0x177')]=_0x54c516[_0x735b('0xe2')];}for(var _0x363aa5 in _0x54c516[_0x735b('0x178')]){if(typeof _0x54c516[_0x735b('0x178')][_0x363aa5]!==_0x735b('0xaa')){if(isNotNull(_0x54c516[_0x735b('0x178')][_0x363aa5])&&_0x363aa5!=='id'&&_0x363aa5!==_0x735b('0x179')&&_0x363aa5!==_0x735b('0x17a')&&_0x363aa5!=='updatedAt'){_0x4b2f2f[util[_0x735b('0x47')]('%s%s',_0x735b('0x17b'),_['toUpper'](_0x363aa5))]=_0x54c516[_0x735b('0x178')][_0x363aa5];}}}var _0x3b8dd2=_0xb25c25[_0x735b('0x86')](_0x2c1c5f[_0x735b('0x8c')])?utils[_0x735b('0x17c')](_0x2c1c5f['Trunk'][_0x735b('0x17d')],_0x2c1c5f['dialOriginateCallerIdName'],_0x2c1c5f[_0x735b('0x17e')]>0x0?utils['getCallerIdRandom'](_0x2c1c5f[_0x735b('0x17f')],_0x2c1c5f[_0x735b('0x17e')]):_0x2c1c5f[_0x735b('0x17f')]):utils[_0x735b('0x17c')](_[_0x735b('0xf7')](_0x2c1c5f[_0x735b('0x8d')])?_0x2c1c5f[_0x735b('0x8c')][_0x735b('0x17d')]:_0x2c1c5f[_0x735b('0x8d')][_0x735b('0x17d')],_0x2c1c5f[_0x735b('0x180')],_0x2c1c5f[_0x735b('0x17e')]>0x0?utils['getCallerIdRandom'](_0x2c1c5f[_0x735b('0x17f')],_0x2c1c5f['dialRandomLastDigitCallerIdNumber']):_0x2c1c5f['dialOriginateCallerIdNumber']);if(_0x3b8dd2){_0x4b2f2f[_0x735b('0x181')]=_0xb25c25['actions'][_0x2233af][_0x735b('0x182')]=utils[_0x735b('0x183')](_0x3b8dd2);_0x4b2f2f[_0x735b('0x184')]=_0x54c516[_0x735b('0x160')];}_0x2c1c5f['variables']=_0x4b2f2f;return ami[_0x735b('0x9b')]({'actionid':_0x2233af,'action':_0x735b('0x15e'),'channel':_0xb25c25[_0x735b('0x86')](_0x2c1c5f[_0x735b('0x8c')])?util[_0x735b('0x47')](_0x735b('0x185'),_0x2c1c5f[_0x735b('0x8c')][_0x735b('0x61')],isNotNull(_0x2c1c5f[_0x735b('0x186')])?_0x2c1c5f[_0x735b('0x186')]['trim']()||'':'',_0x2c1c5f[_0x735b('0x187')]>0x0?_0x54c516[_0x735b('0x160')][_0x735b('0x188')](_0x2c1c5f['dialCutDigit']):_0x54c516[_0x735b('0x160')]):util[_0x735b('0x47')](_0x735b('0x185'),_[_0x735b('0xf7')](_0x2c1c5f[_0x735b('0x8d')])?_0x2c1c5f[_0x735b('0x8c')]['name']:_0x2c1c5f[_0x735b('0x8d')][_0x735b('0x61')],isNotNull(_0x2c1c5f[_0x735b('0x186')])?_0x2c1c5f[_0x735b('0x186')][_0x735b('0x189')]()||'':'',_0x2c1c5f[_0x735b('0x187')]>0x0?_0x54c516[_0x735b('0x160')][_0x735b('0x188')](_0x2c1c5f[_0x735b('0x187')]):_0x54c516['phone']),'callerid':_0x3b8dd2,'Exten':_0x735b('0x113'),'Context':_0x735b('0x18a'),'Priority':'1','variable':_0x4b2f2f,'timeout':(_0x2c1c5f[_0x735b('0x18b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2233af})['then'](function(_0xb973eb){return _0x3a5685(_0xb973eb);})[_0x735b('0xa0')](function(_0x567b3d){_0x2c1c5f[_0x735b('0x18c')]+=0x1;var _0x19d91a=new History(_0xb25c25[_0x735b('0x28')][_0x2233af]);logger[_0x735b('0x66')](util['format'](_0x735b('0x18d'),JSON['stringify'](_0x567b3d)));_0x19d91a[_0x735b('0x6f')]=0xe;_0x19d91a[_0x735b('0x70')]=_0x735b('0x18e');_0x19d91a[_0x735b('0x72')]=moment()['format'](_0x735b('0xc2'));_0x19d91a[_0x735b('0x71')]=_0x19d91a[_0x735b('0x72')];hopperUtils[_0x735b('0xc7')](_0x19d91a)['catch'](loggerCatch('[originate][error]'));_0xb25c25[_0x735b('0xc9')](_0x19d91a)[_0x735b('0xa0')](loggerCatch(_0x735b('0x18f')))[_0x735b('0x105')](function(){delete _0xb25c25['actions'][_0x2233af];return _0x25558a(msgResponse(_0x735b('0x15e'),'Error',_0x735b('0x190')));});});});};Dialer['prototype']['checkRetriveMax']=function(_0x53b06b,_0x2a0130,_0x32f79f){var _0x1f349e=new History(_0x2a0130);if(_0x1f349e[_0x735b('0x11e')]+_0x1f349e[_0x735b('0x11f')]+_0x1f349e[_0x735b('0x120')]+_0x1f349e['countnosuchnumberretry']+_0x1f349e[_0x735b('0xdb')]+_0x1f349e['countabandonedretry']+_0x1f349e['countmachineretry']+_0x1f349e['countagentrejectretry']>=_0x32f79f[_0x735b('0x12e')]-0x1){return!![];}switch(_0x53b06b){case 0x3:if(_0x1f349e['countnoanswerretry']>=_0x32f79f['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x1f349e['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x735b('0xdf')](_0x32f79f['dialNoAnswerRetryFrequency'],_0x735b('0xed'))[_0x735b('0x47')](_0x735b('0xc2')),'ContactId':_0x1f349e[_0x735b('0xe0')],'ListId':_0x1f349e[_0x735b('0xfe')],'VoiceQueueId':_0x1f349e[_0x735b('0xe1')]||undefined,'CampaignId':_0x1f349e['CampaignId']||undefined})['catch'](loggerCatch(_0x735b('0x191')));break;case 0x5:if(_0x1f349e['countbusyretry']>=_0x32f79f[_0x735b('0x192')]-0x1){return!![];}hopperUtils[_0x735b('0xde')]({'active':![],'countbusyretry':_0x1f349e[_0x735b('0x11e')]+=0x1,'scheduledat':moment()[_0x735b('0xdf')](_0x32f79f['dialBusyRetryFrequency'],_0x735b('0xed'))[_0x735b('0x47')](_0x735b('0xc2')),'ContactId':_0x1f349e['ContactId'],'ListId':_0x1f349e[_0x735b('0xfe')],'VoiceQueueId':_0x1f349e[_0x735b('0xe1')]||undefined,'CampaignId':_0x1f349e[_0x735b('0xe2')]||undefined})['catch'](loggerCatch(_0x735b('0x193')));break;case 0x8:if(_0x1f349e[_0x735b('0x11f')]>=_0x32f79f[_0x735b('0x194')]-0x1){return!![];}hopperUtils[_0x735b('0xde')]({'active':![],'countcongestionretry':_0x1f349e[_0x735b('0x11f')]+=0x1,'scheduledat':moment()[_0x735b('0xdf')](_0x32f79f[_0x735b('0x195')],'minutes')[_0x735b('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1f349e[_0x735b('0xe0')],'ListId':_0x1f349e[_0x735b('0xfe')],'VoiceQueueId':_0x1f349e[_0x735b('0xe1')]||undefined,'CampaignId':_0x1f349e['CampaignId']||undefined})[_0x735b('0xa0')](loggerCatch(_0x735b('0x196')));break;case 0x0:if(_0x1f349e[_0x735b('0x12d')]>=_0x32f79f[_0x735b('0x197')]-0x1){return!![];}else{hopperUtils[_0x735b('0xde')]({'active':![],'countnosuchnumberretry':_0x1f349e[_0x735b('0x12d')]+=0x1,'scheduledat':moment()['add'](_0x32f79f[_0x735b('0x198')],_0x735b('0xed'))[_0x735b('0x47')](_0x735b('0xc2')),'ContactId':_0x1f349e[_0x735b('0xe0')],'ListId':_0x1f349e[_0x735b('0xfe')],'VoiceQueueId':_0x1f349e[_0x735b('0xe1')]||undefined,'CampaignId':_0x1f349e['CampaignId']||undefined})[_0x735b('0xa0')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x1f349e[_0x735b('0xdb')]>=_0x32f79f[_0x735b('0xdc')]-0x1){return!![];}hopperUtils[_0x735b('0xde')]({'active':![],'countdropretry':_0x1f349e['countdropretry']+=0x1,'scheduledat':moment()[_0x735b('0xdf')](_0x32f79f[_0x735b('0xd6')],_0x735b('0xed'))[_0x735b('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1f349e[_0x735b('0xe0')],'ListId':_0x1f349e[_0x735b('0xfe')],'VoiceQueueId':_0x1f349e['VoiceQueueId']||undefined,'CampaignId':_0x1f349e[_0x735b('0xe2')]||undefined})['catch'](loggerCatch(_0x735b('0xe3')));break;case 0xb:if(_0x1f349e[_0x735b('0xea')]>=_0x32f79f[_0x735b('0xec')]-0x1){return!![];}hopperUtils[_0x735b('0xde')]({'active':![],'countabandonedretry':_0x1f349e['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x32f79f[_0x735b('0xeb')],'minutes')['format'](_0x735b('0xc2')),'ContactId':_0x1f349e['ContactId'],'ListId':_0x1f349e[_0x735b('0xfe')],'VoiceQueueId':_0x1f349e[_0x735b('0xe1')]||undefined,'CampaignId':_0x1f349e[_0x735b('0xe2')]||undefined})[_0x735b('0xa0')](loggerCatch(_0x735b('0x199')));break;case 0x13:if(_0x1f349e[_0x735b('0x11d')]>=_0x32f79f[_0x735b('0x123')]-0x1){return!![];}hopperUtils[_0x735b('0xde')]({'active':![],'countmachineretry':_0x1f349e[_0x735b('0x11d')]+=0x1,'scheduledat':moment()[_0x735b('0xdf')](_0x32f79f[_0x735b('0x126')],_0x735b('0xed'))[_0x735b('0x47')](_0x735b('0xc2')),'ContactId':_0x1f349e[_0x735b('0xe0')],'ListId':_0x1f349e[_0x735b('0xfe')],'VoiceQueueId':_0x1f349e[_0x735b('0xe1')]||undefined,'CampaignId':_0x1f349e['CampaignId']||undefined})[_0x735b('0xa0')](loggerCatch(_0x735b('0x130')));break;case 0x14:if(_0x1f349e['countagentrejectretry']>=_0x32f79f[_0x735b('0x19a')]-0x1){return!![];}hopperUtils[_0x735b('0xde')]({'active':![],'countagentrejectretry':_0x1f349e['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x735b('0xdf')](_0x32f79f[_0x735b('0x19b')],_0x735b('0xed'))[_0x735b('0x47')](_0x735b('0xc2')),'ContactId':_0x1f349e['ContactId'],'ListId':_0x1f349e[_0x735b('0xfe')],'VoiceQueueId':_0x1f349e[_0x735b('0xe1')]||undefined,'CampaignId':_0x1f349e[_0x735b('0xe2')]||undefined})[_0x735b('0xa0')](loggerCatch(_0x735b('0x19c')));break;default:return!![];}};Dialer[_0x735b('0x1f')][_0x735b('0x10e')]=function(_0x1f6ca1,_0x37dc22,_0x578322){var _0x34d701=this;var _0x5e00f5=new History(_0x1f6ca1);var _0x45a446=![];var _0x2ed796;var _0x300c76;return new Promise(function(_0x131a3c,_0x138421){if(_[_0x735b('0x43')](_0x37dc22)&&typeof _0x37dc22!==_0x735b('0x15d')){return _0x138421(msgResponse(_0x735b('0x19d'),'Failure',_0x735b('0x19e')));}if(_[_0x735b('0x43')](_0x578322)&&typeof _0x578322!==_0x735b('0x15d')){return _0x138421(msgResponse(_0x735b('0x19d'),_0x735b('0x94'),_0x735b('0x19f')));}hopperUtils['verifyAdditionalPhones'](_0x5e00f5,_0x578322[_0x735b('0xc4')],_0x37dc22)[_0x735b('0x41')](function(_0x2d7830){if(_0x2d7830[_0x735b('0xda')]==0x1)_0x45a446=!![];switch(_0x578322[_0x735b('0xc4')]){case'0':_0x37dc22[_0x735b('0x1a0')]+=0x1;_0x5e00f5[_0x735b('0x6f')]=0x0;_0x5e00f5[_0x735b('0x70')]=_0x735b('0x1a1');_0x5e00f5['countnosuchnumberretry']+=0x1;_0x5e00f5['countglobal']+=0x1;ami[_0x735b('0x118')](_0x735b('0x1a2'),ut[_0x735b('0x12b')](_0x1f6ca1,_0x735b('0x1a3')));_0x2ed796=_0x37dc22[_0x735b('0x198')];_0x300c76=_0x37dc22[_0x735b('0xd7')];hopperUtils[_0x735b('0xc7')](_0x5e00f5)[_0x735b('0xa0')](loggerCatch(_0x735b('0x12c')));if(_0x34d701[_0x735b('0x1a4')](0x0,_0x1f6ca1,_0x37dc22)&&!_0x45a446){if(_0x5e00f5[_0x735b('0x12d')]>=_0x37dc22['dialNoSuchNumberMaxRetry']){_0x34d701[_0x735b('0x124')](_0x5e00f5,_0x131a3c,_0x138421,_0x735b('0x1a5'));}else{_0x34d701[_0x735b('0x12f')](_0x5e00f5,_0x131a3c,_0x138421,_0x735b('0x1a5'));}}break;case'3':_0x37dc22[_0x735b('0x1a6')]+=0x1;_0x5e00f5['state']=0x3;_0x5e00f5[_0x735b('0x70')]=_0x735b('0x1a7');_0x5e00f5[_0x735b('0x120')]+=0x1;_0x5e00f5[_0x735b('0xd5')]+=0x1;var _0x31c7ad=ut[_0x735b('0x1a8')](_0x1f6ca1,_0x37dc22);ami[_0x735b('0x118')](_0x735b('0x1a9'),_0x31c7ad);_0x2ed796=_0x37dc22[_0x735b('0x1aa')];_0x300c76=_0x37dc22[_0x735b('0xd7')];hopperUtils[_0x735b('0xc7')](_0x5e00f5)[_0x735b('0xa0')](loggerCatch(_0x735b('0x1ab')));if(_0x34d701[_0x735b('0x1a4')](0x3,_0x1f6ca1,_0x37dc22)&&!_0x45a446){if(_0x5e00f5['countnoanswerretry']>=_0x37dc22[_0x735b('0x1ac')]){_0x34d701['createStateFinal'](_0x5e00f5,_0x131a3c,_0x138421,_0x735b('0x1ad'));}else{_0x34d701['stateGlobal'](_0x5e00f5,_0x131a3c,_0x138421,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x37dc22[_0x735b('0x1ae')]+=0x1;_0x5e00f5['state']=0x5;_0x5e00f5[_0x735b('0x70')]=_0x735b('0x1af');_0x5e00f5[_0x735b('0x11e')]+=0x1;_0x5e00f5[_0x735b('0xd5')]+=0x1;ami[_0x735b('0x118')]('custom:agentbusy',ut[_0x735b('0x12b')](_0x1f6ca1,_0x735b('0x1b0')));_0x2ed796=_0x37dc22[_0x735b('0x1b1')];_0x300c76=_0x37dc22[_0x735b('0xd7')];hopperUtils[_0x735b('0xc7')](_0x5e00f5)[_0x735b('0xa0')](loggerCatch(_0x735b('0x1b2')));if(_0x34d701['checkRetriveMax'](0x5,_0x1f6ca1,_0x37dc22)&&!_0x45a446){if(_0x5e00f5['countbusyretry']>=_0x37dc22['dialBusyMaxRetry']){_0x34d701[_0x735b('0x124')](_0x5e00f5,_0x131a3c,_0x138421,_0x735b('0x1b3'));}else{_0x34d701['stateGlobal'](_0x5e00f5,_0x131a3c,_0x138421,_0x735b('0x1b3'));}}break;case'8':_0x37dc22[_0x735b('0x1b4')]+=0x1;_0x5e00f5[_0x735b('0x6f')]=0x8;_0x5e00f5['statedesc']=_0x735b('0x1b5');_0x5e00f5[_0x735b('0x11f')]+=0x1;_0x5e00f5[_0x735b('0xd5')]+=0x1;_0x2ed796=_0x37dc22['dialCongestionRetryFrequency'];_0x300c76=_0x37dc22[_0x735b('0xd7')];ami[_0x735b('0x118')](_0x735b('0x1b6'),ut[_0x735b('0x12b')](_0x1f6ca1,_0x735b('0x1b7')));hopperUtils['createHistory'](_0x5e00f5)[_0x735b('0xa0')](loggerCatch(_0x735b('0x1b8')));if(_0x34d701['checkRetriveMax'](0x8,_0x1f6ca1,_0x37dc22)&&!_0x45a446){if(_0x5e00f5[_0x735b('0x11f')]>=_0x37dc22[_0x735b('0x194')]){_0x34d701[_0x735b('0x124')](_0x5e00f5,_0x131a3c,_0x138421,_0x735b('0x1b9'));}else{_0x34d701[_0x735b('0x12f')](_0x5e00f5,_0x131a3c,_0x138421,'reason\x208\x20congestion');}}break;case'11':_0x37dc22['outboundAbandonedCallsDay']+=0x1;_0x5e00f5[_0x735b('0x6f')]=0xb;_0x5e00f5['statedesc']=_0x735b('0xee');_0x5e00f5[_0x735b('0xea')]+=0x1;_0x5e00f5[_0x735b('0xd5')]+=0x1;_0x2ed796=_0x37dc22[_0x735b('0xeb')];_0x300c76=_0x37dc22[_0x735b('0xd7')];hopperUtils[_0x735b('0xc7')](_0x5e00f5)[_0x735b('0xa0')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x34d701[_0x735b('0x1a4')](0xb,_0x1f6ca1,_0x37dc22)&&!_0x45a446){if(_0x5e00f5['countabandonedretry']>=_0x37dc22[_0x735b('0xec')]){_0x34d701['createStateFinal'](_0x5e00f5,_0x131a3c,_0x138421,_0x735b('0x1ba'));}else{_0x34d701[_0x735b('0x12f')](_0x5e00f5,_0x131a3c,_0x138421,_0x735b('0x1ba'));}}break;case'20':_0x37dc22[_0x735b('0x1bb')]+=0x1;_0x5e00f5[_0x735b('0x6f')]=0x14;_0x5e00f5[_0x735b('0x70')]='AgentReject';_0x5e00f5[_0x735b('0x121')]+=0x1;_0x5e00f5[_0x735b('0xd5')]+=0x1;_0x2ed796=_0x37dc22['dialAgentRejectRetryFrequency'];_0x300c76=_0x37dc22[_0x735b('0xd7')];ami[_0x735b('0x118')](_0x735b('0x1bc'),ut[_0x735b('0x12b')](_0x1f6ca1,_0x735b('0x1bd')));hopperUtils[_0x735b('0xc7')](_0x5e00f5)[_0x735b('0xa0')](loggerCatch(_0x735b('0x1be')));if(_0x34d701[_0x735b('0x1a4')](0x14,_0x1f6ca1,_0x37dc22)&&!_0x45a446){if(_0x5e00f5[_0x735b('0x121')]>=_0x37dc22[_0x735b('0x19a')]){_0x34d701[_0x735b('0x124')](_0x5e00f5,_0x131a3c,_0x138421,_0x735b('0x1bf'));}else{_0x34d701[_0x735b('0x12f')](_0x5e00f5,_0x131a3c,_0x138421,_0x735b('0x1bf'));}}break;default:_0x37dc22[_0x735b('0x1c0')]+=0x1;_0x5e00f5['state']=0xc;_0x5e00f5[_0x735b('0x70')]=_0x578322[_0x735b('0xc4')];_0x2ed796=_0x37dc22[_0x735b('0x19b')];_0x300c76=_0x37dc22[_0x735b('0xd7')];hopperUtils[_0x735b('0xc7')](_0x5e00f5)[_0x735b('0xa0')](loggerCatch(_0x735b('0x1c1')));if(_0x34d701['checkRetriveMax'](_0x578322['reason'],_0x1f6ca1,_0x37dc22)&&!_0x45a446){if(_0x5e00f5['countbusyretry']+_0x5e00f5['countcongestionretry']+_0x5e00f5[_0x735b('0x120')]+_0x5e00f5[_0x735b('0x12d')]+_0x5e00f5[_0x735b('0xdb')]+_0x5e00f5[_0x735b('0xea')]+_0x5e00f5[_0x735b('0x11d')]+_0x5e00f5[_0x735b('0x121')]>=_0x37dc22[_0x735b('0x12e')]){_0x34d701[_0x735b('0x12f')](_0x5e00f5,_0x131a3c,_0x138421,_0x578322[_0x735b('0xc4')]);}else{_0x34d701[_0x735b('0x124')](_0x5e00f5,_0x131a3c,_0x138421,_0x578322['reason']);}}}})[_0x735b('0x41')](function(){if(_0x45a446){hopperUtils[_0x735b('0xf0')](_0x5e00f5,_0x2ed796,_0x300c76)['then'](function(){return _0x131a3c(0x1);});}});});};Dialer[_0x735b('0x1f')][_0x735b('0x12f')]=function(_0x2c227a,_0xbf08f,_0x3cc411,_0x39774d){var _0x5ecd9d=new Final(_0x2c227a);_0x5ecd9d[_0x735b('0x6f')]=0xf;_0x5ecd9d['statedesc']='Global';this[_0x735b('0x124')](_0x5ecd9d,_0xbf08f,_0x3cc411,_0x39774d);};Dialer[_0x735b('0x1f')][_0x735b('0x124')]=function(_0x460b4b,_0xc4a8ca,_0x36d35b,_0xeb1c97){hopperUtils[_0x735b('0xc9')](_0x460b4b)[_0x735b('0x41')](function(){return _0xc4a8ca(msgResponse('[callProgressDetecting]',_0x735b('0x10d'),_0xeb1c97));})[_0x735b('0xa0')](function(){return _0x36d35b(msgResponse(_0x735b('0x1c2'),_0x735b('0x94'),_0x735b('0x1c3')));});};Dialer['prototype'][_0x735b('0xb')]=function(_0x283c0b){var _0x205a6f=_0x283c0b[_0x735b('0x1c4')]/0x64;var _0x3db6d2=_0x283c0b['outboundDropCallsDayTimeout']/(_0x283c0b['outboundDropCallsDayTimeout']+_0x283c0b['outboundAnswerCallsDay']);var _0x53c43a=Math['round'](_0x283c0b[_0x735b('0x1c5')]*(_0x283c0b[_0x735b('0x1c6')]/0x64));var _0x845abb=Math[_0x735b('0x1c7')](_0x283c0b[_0x735b('0x1c5')]*(_0x283c0b[_0x735b('0x1c8')]/0x64));var _0x57b349=_0x283c0b[_0x735b('0x1c9')]+_0x283c0b[_0x735b('0x1ca')];var _0x3c9432=Math[_0x735b('0x1cb')](_0x283c0b['erlangCalls']*_0x283c0b[_0x735b('0x5b')]*_0x283c0b['predictiveIntervalHitRate']*_0x283c0b[_0x735b('0x1cc')]);if(_['isUndefined'](_0x283c0b[_0x735b('0x2c')])){if(!_[_0x735b('0x43')](_0x283c0b[_0x735b('0x2b')])){_0x283c0b['startPredictive']=undefined;loggerPredictive[_0x735b('0x66')]('[startMethodPredictive][StartProgressive]',_0x735b('0x1cd'));}if(!_['isUndefined'](_0x283c0b[_0x735b('0x64')])){loggerPredictive[_0x735b('0x66')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x283c0b['handlePredictive']);_0x283c0b['handlePredictive']=undefined;}_0x283c0b['startProgressive']=moment()[_0x735b('0x47')](_0x735b('0xc2'));loggerPredictive['info'](_0x283c0b[_0x735b('0x61')],_0x735b('0x1ce'),_0x283c0b[_0x735b('0x2c')]);this['handlePower'](_0x283c0b,0x1);}else if(ifInterval(_0x283c0b[_0x735b('0x1cf')],_0x283c0b[_0x735b('0x2c')])){this[_0x735b('0xb3')](_0x283c0b,0x1);loggerPredictiveCalls['info'](_0x735b('0x1d0'),_0x283c0b[_0x735b('0x2c')],_0x283c0b[_0x735b('0x61')]);_0x283c0b[_0x735b('0x59')]=0x0;_0x283c0b[_0x735b('0xd0')]=0x0;}else if(_0x205a6f<_0x3db6d2&&_0x283c0b['dialPredictiveOptimization']===_0x735b('0x1d1')){clearPredictiveAttributes(_0x283c0b);loggerPredictive['info'](_0x735b('0x1d2'),_0x735b('0x1d3'),_0x3db6d2,_0x735b('0x2c'),_0x283c0b[_0x735b('0x61')]);}else if(_0x3c9432<_0x283c0b[_0x735b('0xd0')]&&_0x283c0b['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x283c0b);loggerPredictive[_0x735b('0x4b')](_0x735b('0x1d4'),_0x735b('0x1d5'),_0x3c9432,_0x735b('0x1d6'),_0x283c0b[_0x735b('0xd0')],_0x735b('0x2c'),_0x283c0b[_0x735b('0x61')]);}else if(!ifInterval(_0x283c0b['dialPredictiveInterval'],_0x283c0b[_0x735b('0x2c')])&&_['isUndefined'](_0x283c0b[_0x735b('0x2b')])&&!_['isUndefined'](_0x283c0b[_0x735b('0x2c')])){_0x283c0b[_0x735b('0x2b')]=moment()['format'](_0x735b('0xc2'));loggerPredictive[_0x735b('0x4b')](_0x283c0b[_0x735b('0x61')],_0x735b('0x1d7'),_0x283c0b[_0x735b('0x2b')]);hopperUtils[_0x735b('0x1d8')](_0x283c0b[_0x735b('0x1cf')])[_0x735b('0x41')](this[_0x735b('0x1d9')](_0x283c0b))['then'](mergeDataErlangB(_0x283c0b))['then'](this['startMethodPredictive'](_0x283c0b))[_0x735b('0xa0')](loggerCatchPredictive(_0x735b('0x1da'),_0x283c0b));}else if(!ifInterval(_0x283c0b[_0x735b('0x1cf')],_0x283c0b[_0x735b('0x2b')])){_0x283c0b[_0x735b('0xd0')]=0x0;_0x283c0b[_0x735b('0x2b')]=moment()[_0x735b('0x47')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x735b('0x4b')](_0x283c0b['name'],_0x735b('0x1db'),_0x283c0b[_0x735b('0x2b')]);clearInterval(_0x283c0b[_0x735b('0x64')]);_0x283c0b[_0x735b('0x64')]=undefined;hopperUtils[_0x735b('0x1d8')](_0x283c0b[_0x735b('0x1cf')])[_0x735b('0x41')](this[_0x735b('0x1d9')](_0x283c0b))[_0x735b('0x41')](mergeDataErlangB(_0x283c0b))['then'](this['startMethodPredictive'](_0x283c0b))[_0x735b('0xa0')](loggerCatchPredictive(_0x735b('0x1dc'),_0x283c0b));}else if(_0x283c0b[_0x735b('0x1c5')]&&_0x57b349<_0x283c0b[_0x735b('0x1c5')]-_0x845abb){clearPredictiveAttributes(_0x283c0b);loggerPredictive['info'](_0x283c0b[_0x735b('0x61')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x57b349,_0x735b('0x1dd'),_0x283c0b[_0x735b('0x1c5')],'-',_0x845abb,'=',_0x283c0b[_0x735b('0x1c5')]-_0x845abb,')');}else if(_0x283c0b['predictiveIntervalAvailable']&&_0x57b349>_0x283c0b[_0x735b('0x1c5')]+_0x53c43a){clearPredictiveAttributes(_0x283c0b);loggerPredictive['info'](_0x283c0b[_0x735b('0x61')],_0x735b('0x1de'),_0x57b349,_0x735b('0x1df'),_0x283c0b['predictiveIntervalAvailable'],'+',_0x53c43a,'=',_0x283c0b[_0x735b('0x1c5')]+_0x53c43a,')');}};Dialer[_0x735b('0x1f')]['getDataPredictive']=function(_0x547ecb){var _0x58c5ec=this;return function(_0x2403a5){return new Promise(function(_0x292d5e,_0x392e76){_[_0x735b('0x5f')](_0x547ecb,_0x2403a5[0x0]);if(checkGetDataPredictive(_0x2403a5[0x0])){var _0x3cd774=_0x547ecb['predictiveIntervalAvailable']=_0x547ecb[_0x735b('0x1ca')]+_0x547ecb['available'];var _0x52d58f=_0x547ecb[_0x735b('0x1cf')]*0x3c;var _0x5457fe=_0x2403a5[0x0][_0x735b('0x54')]+_0x2403a5[0x0][_0x735b('0x56')];var _0x36dd34=(_0x2403a5[0x0][_0x735b('0x1e0')]+_0x2403a5[0x0][_0x735b('0xce')]+_0x2403a5[0x0][_0x735b('0x50')])/_0x2403a5[0x0][_0x735b('0x4c')];_0x547ecb[_0x735b('0x1e1')]=_0x36dd34>0x0?_0x36dd34:0x1;switch(_0x547ecb['dialPredictiveOptimization']){case _0x735b('0x1d1'):var _0x5ef0f0=_0x547ecb[_0x735b('0x1c4')]/0x64;return _0x58c5ec[_0x735b('0x1e2')](_0x3cd774,_0x52d58f,_0x5457fe,_0x36dd34,_0x5ef0f0)[_0x735b('0x41')](function(_0x54a463){return _0x292d5e(_0x54a463);});case'agentBusyFactor':var _0x7e6c24=_0x547ecb[_0x735b('0x1c4')]/0x64;return _0x58c5ec['busyFactor'](_0x3cd774,_0x52d58f,_0x5457fe,_0x36dd34,_0x7e6c24)[_0x735b('0x41')](function(_0xba2935){return _0x292d5e(_0xba2935);});default:return _0x392e76(msgResponse('[getDataPredictive]',_0x735b('0x94'),_0x735b('0x1e3')));}}else{return _0x392e76(msgResponse(_0x735b('0x1e4'),'Failure',_0x735b('0x1e5')));}});};};Dialer[_0x735b('0x1f')][_0x735b('0x1e6')]=function(_0x45bd1d){var _0x48e9fb=this;return function(_0xcf517c){return new Promise(function(_0x38fe19,_0x54c574){_['merge'](_0x45bd1d,_0xcf517c[0x0]);if(checkGetDataPredictive(_0xcf517c[0x0])){loggerPredictive[_0x735b('0x4b')](JSON[_0x735b('0x76')](_0xcf517c[0x0]));if(_0x45bd1d[_0x735b('0x1e7')]===_0x735b('0x1d1')){return _0x48e9fb[_0x735b('0x152')](_0x45bd1d['id'])[_0x735b('0x41')](function(_0x32e499){var _0x117b8f=_0x45bd1d[_0x735b('0x1e8')]-_0x32e499[0x0][_0x735b('0x1e9')];var _0x16ab2e=_0x45bd1d[_0x735b('0x1cf')]*0x3c;var _0x491ff9=_0xcf517c[0x0]['predictiveIntervalAvgTalktime']+_0xcf517c[0x0][_0x735b('0x56')];var _0x27095c=(_0xcf517c[0x0][_0x735b('0x1e0')]+_0xcf517c[0x0][_0x735b('0xce')]+_0xcf517c[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xcf517c[0x0][_0x735b('0x4c')];var _0x33a46e=_0x45bd1d[_0x735b('0x1c4')]/0x64;_0x45bd1d[_0x735b('0x1ea')]=_0x32e499[0x0][_0x735b('0x1e9')]||0x0;_0x45bd1d[_0x735b('0x1e1')]=_0x27095c>0x0?_0x27095c:0x1;return _0x48e9fb[_0x735b('0x1e2')](_0x117b8f,_0x16ab2e,_0x491ff9,_0x27095c,_0x33a46e);})[_0x735b('0x41')](function(_0x3532f9){return _0x38fe19(_0x3532f9);})[_0x735b('0xa0')](function(_0x25b517){return _0x54c574(msgResponse('[CatchErlangB]',_0x735b('0x94'),JSON['stringify'](_0x25b517)));});}if(_0x45bd1d[_0x735b('0x1e7')]===_0x735b('0x1eb')){return _0x48e9fb['getVoiceQueueRtPauses'](_0x45bd1d['id'])[_0x735b('0x41')](function(_0x65c6e7){var _0x1e4ac2=_0x45bd1d['loggedIn']-_0x65c6e7[0x0][_0x735b('0x1e9')];var _0xacf5c0=_0x45bd1d[_0x735b('0x1cf')]*0x3c;var _0xbc34ea=_0xcf517c[0x0]['predictiveIntervalAvgTalktime']+_0xcf517c[0x0][_0x735b('0x56')];var _0x52db98=(_0xcf517c[0x0][_0x735b('0x1e0')]+_0xcf517c[0x0][_0x735b('0xce')]+_0xcf517c[0x0][_0x735b('0x50')])/_0xcf517c[0x0]['predictiveIntervalTotalCalls'];var _0x46ae34=_0x45bd1d[_0x735b('0x1c4')]/0x64;_0x45bd1d[_0x735b('0x1ea')]=_0x65c6e7[0x0]['outboundQueuePauses']||0x0;_0x45bd1d['predictiveIntervalHitRate']=_0x52db98>0x0?_0x52db98:0x1;return _0x48e9fb[_0x735b('0x1ec')](_0x1e4ac2,_0xacf5c0,_0xbc34ea,_0x52db98,_0x46ae34);})['then'](function(_0x4ef0e6){return _0x38fe19(_0x4ef0e6);})[_0x735b('0xa0')](function(_0x22387a){return _0x54c574(msgResponse('[CatchErlangB]',_0x735b('0x94'),JSON[_0x735b('0x76')](_0x22387a)));});}}else{return _0x54c574(msgResponse(_0x735b('0x1e4'),'Failure',_0x735b('0x1e5')));}});};};Dialer[_0x735b('0x1f')][_0x735b('0x1ed')]=function(_0x25aa6d){var _0x4c36e1=this;return function(){var _0x49b78d=0x0;var _0x111a13=Math[_0x735b('0x1cb')](_0x25aa6d[_0x735b('0x5a')]*0x3e8);if(_0x111a13>0x0){_0x111a13=_0x111a13<0x64?0x64:_0x111a13;loggerPredictive[_0x735b('0x4b')](_0x25aa6d[_0x735b('0x61')],_0x735b('0x1ee'),_0x111a13,_0x735b('0x1ef'));_0x25aa6d[_0x735b('0x64')]=setInterval(function(){_0x4c36e1[_0x735b('0x64')](_0x25aa6d);loggerPredictiveCalls[_0x735b('0x4b')](_0x735b('0x1f0'),_0x49b78d+=0x1);},_0x111a13);}else{loggerPredictive['info'](_0x25aa6d[_0x735b('0x61')],_0x735b('0x1f1'));}};};Dialer[_0x735b('0x1f')][_0x735b('0x1f2')]=function(_0x3b8069,_0x2cc52f){var _0x281384=this;return function(_0xaf1e86){if(_[_0x735b('0x4a')](_0xaf1e86)){if(_[_0x735b('0xf7')](_0x2cc52f[_0x735b('0x158')])||!_0x2cc52f[_0x735b('0x1f3')]){if(_0x3b8069['dialMethod']==='booked'){_0x3b8069[_0x735b('0x73')]=_[_0x735b('0x43')](_0x3b8069[_0x735b('0x73')])?!![]:_0x3b8069[_0x735b('0x73')];var _0xa8761f=uuid['v4']();_0x281384[_0x735b('0x28')][_0xa8761f]=new Action(_0x3b8069,_0x2cc52f,_0xa8761f);loggerBooked[_0x735b('0x4b')](_0x735b('0x1f4'),_0xa8761f,_0x735b('0x1f5'),JSON[_0x735b('0x76')](_0x3b8069[_0x735b('0x73')]),'Queue:\x20',_0x3b8069[_0x735b('0x61')]);if(_0x3b8069[_0x735b('0x73')]){_0x3b8069[_0x735b('0x73')]=![];_0x281384['queueBooked'][_0x281384[_0x735b('0x28')][_0xa8761f][_0x735b('0xbe')]]=[];ami['Action']({'actionid':_0xa8761f,'action':_0x735b('0x1f6'),'queue':_0x3b8069[_0x735b('0x61')]})['catch'](function(){_0x281384[_0x735b('0xc1')](_0x3b8069);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x281384['actions'][_0xa8761f][_0x735b('0xe0')],'ListId':_0x281384['actions'][_0xa8761f]['ListId'],'VoiceQueueId':_0x281384[_0x735b('0x28')][_0xa8761f][_0x735b('0xe1')]||undefined,'CampaignId':_0x281384[_0x735b('0x28')][_0xa8761f]['CampaignId']||undefined})['catch'](loggerCatch(_0x735b('0x1f7')));delete _0x281384['actions'][_0xa8761f];});}else{loggerBooked[_0x735b('0x4b')](_0x735b('0x1f8'),JSON['stringify'](_0x3b8069[_0x735b('0x73')]),_0x735b('0x1f9'),_0x3b8069['name']);_0x281384[_0x735b('0xc1')](_0x3b8069);hopperUtils[_0x735b('0xde')]({'active':![],'ContactId':_0x281384[_0x735b('0x28')][_0xa8761f][_0x735b('0xe0')],'ListId':_0x281384[_0x735b('0x28')][_0xa8761f][_0x735b('0xfe')],'VoiceQueueId':_0x281384[_0x735b('0x28')][_0xa8761f][_0x735b('0xe1')]||undefined,'CampaignId':_0x281384[_0x735b('0x28')][_0xa8761f][_0x735b('0xe2')]||undefined})[_0x735b('0xa0')](loggerCatch(_0x735b('0x1f7')));delete _0x281384[_0x735b('0x28')][_0xa8761f];}}else{return _0x281384[_0x735b('0x15c')](_0x3b8069,_0x2cc52f);}}else{if(utils[_0x735b('0x60')](undefined,_0x2cc52f['scheduledat'])<_0x3b8069[_0x735b('0x1fa')]*0x3c){if(_0x2cc52f[_0x735b('0x148')]&&!_0x2cc52f[_0x735b('0x148')][_0x735b('0x1fb')]){_0x281384[_0x735b('0x21')][_0x735b('0xfb')](_0x2cc52f['id'])[_0x735b('0x105')](function(){_0x281384[_0x735b('0xc1')](_0x3b8069);});}else{hopperUtils['unlockContact']({'active':![]},_0x2cc52f['id'],0x1)[_0x735b('0x105')](function(){_0x281384[_0x735b('0xc1')](_0x3b8069);});}}else{_0x3b8069['outboundReCallsDay']+=0x1;_0x281384[_0x735b('0xc1')](_0x3b8069);if(_0x3b8069['dialRecallInQueue']){hopperUtils[_0x735b('0xde')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2cc52f[_0x735b('0xe0')],'ListId':_0x2cc52f['ListId'],'VoiceQueueId':_0x2cc52f[_0x735b('0xe1')]||undefined,'CampaignId':_0x2cc52f['CampaignId']||undefined})[_0x735b('0xa0')](loggerCatch(_0x735b('0x1fc')));hopperUtils[_0x735b('0xc7')](createObjHistory(_0x3b8069,_0x2cc52f,utils[_0x735b('0x69')][_0x735b('0x1fd')],0x17,_0x735b('0x1fe')))[_0x735b('0xa0')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x281384['saveInDb'](createObjHistory(_0x3b8069,_0x2cc52f,utils[_0x735b('0x69')]['RECALL_TIMEOUT'],0x16,_0x735b('0x1ff')),'[Originate][HistoryRecallClose][historyCatch]',_0x735b('0x200'));}}}}else{_0x3b8069[_0x735b('0x201')]+=0x1;_0x281384[_0x735b('0x11a')](createObjHistory(_0x3b8069,_0x2cc52f,utils['CAMPAIGN_STATUS']['BLACKLIST'],0xd,_0x735b('0x202')),_0x735b('0x203'),_0x735b('0x204'));throw _0x735b('0x205');}};};Dialer[_0x735b('0x1f')][_0x735b('0x206')]=function(_0xd13ccd){var _0x929dfb=this;var _0x8cf43c=_0xd13ccd[_0x735b('0x207')]-_0xd13ccd['originated']-_0xd13ccd[_0x735b('0x208')];emitCampaignSummary(_0xd13ccd);if(_0x8cf43c>0x0){if(_0x8cf43c>this[_0x735b('0x26')]){_0x8cf43c=this[_0x735b('0x26')];}_0xd13ccd['temp']+=_0x8cf43c;hopperUtils['getContactDialerIvr'](_0xd13ccd,_0x8cf43c)['then'](function(_0x14a008){_0xd13ccd[_0x735b('0x208')]-=_0x8cf43c;_0xd13ccd[_0x735b('0x208')]=_0xd13ccd[_0x735b('0x208')]>0x0?_0xd13ccd[_0x735b('0x208')]:0x0;if(!utils[_0x735b('0x209')](_0x14a008)){_0xd13ccd[_0x735b('0x68')]=utils[_0x735b('0x69')][_0x735b('0x6d')];logger[_0x735b('0x4b')]('[getContactCampaign2][Empty]'+_0xd13ccd['name']);}else{_0xd13ccd[_0x735b('0x80')]+=_0x14a008[_0x735b('0x99')];_0xd13ccd[_0x735b('0x68')]=utils[_0x735b('0x69')]['RUNNING'];for(var _0x2656a8=0x0;_0x2656a8<_0x14a008[_0x735b('0x99')];_0x2656a8+=0x1){_0xd13ccd[_0x735b('0x20a')]+=0x1;if(_[_0x735b('0xf7')](_0x14a008[_0x2656a8])||_[_0x735b('0xf7')](_0x14a008[_0x2656a8][_0x735b('0x178')])||_[_0x735b('0xf7')](_0x14a008[_0x2656a8][_0x735b('0x160')])){_0x929dfb[_0x735b('0x20b')](_0x735b('0x20c'),_0xd13ccd,_0x14a008[_0x2656a8]);}else{hopperUtils[_0x735b('0x20d')](_[_0x735b('0x77')](_0x14a008[_0x2656a8],[_0x735b('0xe2'),_0x735b('0x160')]))[_0x735b('0x41')](_0x929dfb[_0x735b('0x1f2')](_0xd13ccd,_0x14a008[_0x2656a8]))[_0x735b('0xa0')](_0x929dfb['loggerHandler'](_0x735b('0x20e'),_0xd13ccd));}}}})[_0x735b('0xa0')](loggerGetContactDialer(_0x735b('0x20f'),_0xd13ccd,_0x8cf43c));}};Dialer[_0x735b('0x1f')][_0x735b('0xb3')]=function(_0x243fef,_0x4af610){var _0x2e781a=this;var _0x24af41=[];if(_0x4af610<0x1||_0x243fef[_0x735b('0xb1')]==='booked'){_0x4af610=0x1;}var _0x154e66=Math[_0x735b('0x1cb')](_0x243fef['available']*_0x4af610)-_0x243fef[_0x735b('0x80')]-_0x243fef[_0x735b('0x208')];if(_0x243fef[_0x735b('0x210')]>0x0){var _0x1f520a=_0x243fef[_0x735b('0x210')]-_0x243fef[_0x735b('0x80')]-_0x243fef[_0x735b('0x1ca')]-_0x243fef[_0x735b('0x208')]-_0x243fef[_0x735b('0x211')];if(_0x154e66>_0x1f520a){_0x154e66=_0x1f520a;}}if(_0x154e66>0x0){if(_0x243fef['dialMethod']==='booked'){_0x154e66=0x1;}if(_0x154e66>this[_0x735b('0x26')]){_0x154e66=this['maxNumberOriginate'];}_0x243fef[_0x735b('0x208')]+=_0x154e66;for(var _0x35b449 in this[_0x735b('0x24')]){if(typeof this['agents'][_0x35b449]!==_0x735b('0xaa')){if(this[_0x735b('0x24')][_0x35b449][_0x735b('0x6f')]===_0x735b('0x212')&&this['agents'][_0x35b449][_0x735b('0x89')]==='reachable'){_0x24af41[_0x735b('0x9a')](this['agents'][_0x35b449]['id']);}}}hopperUtils[_0x735b('0x213')](_0x243fef,_0x24af41,_0x154e66)[_0x735b('0x41')](function(_0x35a314){_0x243fef[_0x735b('0x208')]-=_0x154e66;_0x243fef[_0x735b('0x208')]=_0x243fef[_0x735b('0x208')]>0x0?_0x243fef[_0x735b('0x208')]:0x0;if(!utils[_0x735b('0x209')](_0x35a314)){hopperUtils['countReScheduled'](_0x243fef)[_0x735b('0x41')](sendMessageReschedule(_0x243fef))['catch'](loggerCatch(_0x735b('0x214')));}else{_0x243fef[_0x735b('0x80')]+=_0x35a314[_0x735b('0x99')];_0x243fef[_0x735b('0x68')]=_0x243fef[_0x735b('0xb1')]==='booked'?utils['CAMPAIGN_STATUS'][_0x735b('0x13d')]:utils['CAMPAIGN_STATUS'][_0x735b('0x215')];for(var _0x5652d2=0x0;_0x5652d2<_0x35a314[_0x735b('0x99')];_0x5652d2+=0x1){if(_[_0x735b('0xf7')](_0x35a314[_0x5652d2])||_[_0x735b('0xf7')](_0x35a314[_0x5652d2][_0x735b('0x178')])||_[_0x735b('0xf7')](_0x35a314[_0x5652d2][_0x735b('0x160')])){_0x2e781a[_0x735b('0x20b')](_0x735b('0x20c'),_0x243fef,_0x35a314[_0x5652d2]);}else{hopperUtils[_0x735b('0x216')](_[_0x735b('0x77')](_0x35a314[_0x5652d2],[_0x735b('0xe1'),_0x735b('0x160')]))[_0x735b('0x41')](_0x2e781a['checkContactBlack'](_0x243fef,_0x35a314[_0x5652d2]))['catch'](_0x2e781a[_0x735b('0x156')]('[actionOriginate]\x20',_0x243fef));}}}})[_0x735b('0xa0')](loggerGetContactDialer(_0x735b('0x217'),_0x243fef,_0x154e66));}};Dialer[_0x735b('0x1f')]['handlePredictive']=function(_0x396a16){if(_0x396a16[_0x735b('0x210')]>0x0){var _0x4524db=_0x396a16[_0x735b('0x210')]-_0x396a16[_0x735b('0x80')]-_0x396a16[_0x735b('0x1ca')];if(_0x4524db>0x0){this[_0x735b('0x218')](_0x396a16);}else{loggerPredictiveCalls[_0x735b('0x4b')](_0x735b('0x219'));}}else{this[_0x735b('0x218')](_0x396a16);}};Dialer[_0x735b('0x1f')][_0x735b('0x218')]=function(_0x395889){var _0x401482=this;var _0x3b0e19=[];_0x395889[_0x735b('0x80')]+=0x1;for(var _0x4414f9 in this[_0x735b('0x24')]){if(typeof this[_0x735b('0x24')][_0x4414f9]!==_0x735b('0xaa')){if(this['agents'][_0x4414f9][_0x735b('0x6f')]===_0x735b('0x212')&&this[_0x735b('0x24')][_0x4414f9][_0x735b('0x89')]===_0x735b('0x21a')){_0x3b0e19[_0x735b('0x9a')](this[_0x735b('0x24')][_0x4414f9]['id']);}}}return this[_0x735b('0x213')](_0x395889['id'],_0x3b0e19,0x1,_0x395889[_0x735b('0x21b')],_0x395889)['then'](function(_0x365a46){if(!utils[_0x735b('0x209')](_0x365a46)){utils['checkContactLowerLimitOriginate'](_0x395889,0x1,0x0);return hopperUtils[_0x735b('0x21c')](_0x395889)[_0x735b('0x41')](sendMessageReschedule(_0x395889))['catch'](loggerCatch(_0x735b('0x214')));}else{_0x395889['message']=utils['CAMPAIGN_STATUS'][_0x735b('0x215')];if(_[_0x735b('0xf7')](_0x365a46[0x0])||_[_0x735b('0xf7')](_0x365a46[0x0][_0x735b('0x178')])||_['isNil'](_0x365a46[0x0][_0x735b('0x160')])){_0x401482[_0x735b('0x20b')](_0x735b('0x20c'),_0x395889,_0x365a46[0x0]);}else{return hopperUtils[_0x735b('0x216')](_[_0x735b('0x77')](_0x365a46[0x0],[_0x735b('0xe1'),'phone']))[_0x735b('0x41')](_0x401482['checkContactBlack'](_0x395889,_0x365a46[0x0]))[_0x735b('0xa0')](_0x401482[_0x735b('0x156')](_0x735b('0x21d'),_0x395889));}}})[_0x735b('0xa0')](loggerGetContactDialer(_0x735b('0x21e'),_0x395889,0x1));};Dialer[_0x735b('0x1f')][_0x735b('0x1e2')]=function(_0x5d9fe0,_0x1ac434,_0x6f9eba,_0x3dd02e,_0xa40ee2,_0x4988ea){loggerPredictive[_0x735b('0x4b')](_0x735b('0x21f'));loggerPredictive[_0x735b('0x4b')]('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',_0x5d9fe0);loggerPredictive['info'](_0x735b('0x220'),_0x1ac434);loggerPredictive[_0x735b('0x4b')](_0x735b('0x221'),_0x6f9eba);loggerPredictive['info'](_0x735b('0x222'),_0x3dd02e);loggerPredictive[_0x735b('0x4b')](_0x735b('0x223'),_0xa40ee2);loggerPredictive[_0x735b('0x4b')](_0x735b('0x53'));return new Promise(function(_0x2d4825,_0x23637e){if(_0x5d9fe0<=0x0||isNaN(_0x5d9fe0)){return _0x23637e(msgResponse(_0x735b('0x224'),_0x735b('0x85'),_0x735b('0x225')+_0x5d9fe0));}if(_0x6f9eba<=0x0||isNaN(_0x6f9eba)){return _0x23637e(msgResponse('[abandonmentRate]',_0x735b('0x85'),_0x735b('0x226')+_0x6f9eba));}if(_0x3dd02e<=0x0||isNaN(_0x3dd02e)){return _0x23637e(msgResponse('[abandonmentRate]',_0x735b('0x85'),_0x735b('0x227')+_0x3dd02e));}if(_0x1ac434<=0x0||isNaN(_0x1ac434)){return _0x23637e(msgResponse(_0x735b('0x224'),'Error',_0x735b('0x228')+_0x1ac434));}if(_0xa40ee2<=0x0||isNaN(_0xa40ee2)){return _0x23637e(msgResponse(_0x735b('0x224'),_0x735b('0x85'),_0x735b('0x229')+_0xa40ee2));}_0x4988ea=_0x4988ea||0x0;var _0x25b2aa=0x1/_0x6f9eba;var _0x202a5b=0x0;var _0x1732ea=0x0;var _0x3a8056=0x0;var _0x5c08bb=0x0;for(var _0x1070cd=0x0;_0x3a8056<_0xa40ee2;_0x1070cd+=0x1){_0x1732ea=_0x1070cd/_0x1ac434;_0x202a5b=(_0x3dd02e*_0x1732ea+_0x4988ea)/_0x25b2aa;_0x3a8056=utils[_0x735b('0x22a')](_0x202a5b,_0x5d9fe0);_0x5c08bb=_0x202a5b/_0x5d9fe0*(0x1-utils['erlangb'](_0x202a5b,_0x5d9fe0));}return _0x2d4825({'erlangCalls':_0x1070cd,'erlangCallToSecond':_0x1ac434/_0x1070cd,'erlangAbandonmentRate':_0x3a8056,'erlangBusyFactor':_0x5c08bb});});};Dialer['prototype']['busyFactor']=function(_0x6ec845,_0x1d5271,_0x6dca01,_0x1c2466,_0x37a377,_0x4482b7){loggerPredictive[_0x735b('0x4b')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x735b('0x4b')](_0x735b('0x22b'),_0x6ec845);loggerPredictive[_0x735b('0x4b')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1d5271);loggerPredictive[_0x735b('0x4b')](_0x735b('0x221'),_0x6dca01);loggerPredictive[_0x735b('0x4b')](_0x735b('0x222'),_0x1c2466);loggerPredictive[_0x735b('0x4b')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x37a377);loggerPredictive[_0x735b('0x4b')](_0x735b('0x53'));return new Promise(function(_0x245b08,_0x25f010){if(_0x6ec845<=0x0||isNaN(_0x6ec845)){return _0x25f010(msgResponse('[busyFactor]','Error',_0x735b('0x225')+_0x6ec845));}if(_0x6dca01<=0x0||isNaN(_0x6dca01)){return _0x25f010(msgResponse('[busyFactor]','Error',_0x735b('0x226')+_0x6dca01));}if(_0x1c2466<=0x0||isNaN(_0x1c2466)){return _0x25f010(msgResponse('[busyFactor]','Error',_0x735b('0x227')+_0x1c2466));}if(_0x1d5271<=0x0||isNaN(_0x1d5271)){return _0x25f010(msgResponse(_0x735b('0x22c'),_0x735b('0x85'),_0x735b('0x228')+_0x1d5271));}if(_0x37a377<=0x0||isNaN(_0x37a377)){return _0x25f010(msgResponse(_0x735b('0x22c'),_0x735b('0x85'),_0x735b('0x22d')+_0x37a377));}_0x4482b7=_0x4482b7||0x0;var _0x31a004=0x1/_0x6dca01;var _0xaef771=0x0;var _0x4cb1bb=0x0;var _0x374d10=0x0;var _0x202aa5=0x0;for(var _0x5ce25d=0x0;_0x202aa5<_0x37a377;_0x5ce25d+=0x1){_0x4cb1bb=_0x5ce25d/_0x1d5271;_0xaef771=(_0x1c2466*_0x4cb1bb+_0x4482b7)/_0x31a004;_0x374d10=utils[_0x735b('0x22a')](_0xaef771,_0x6ec845);_0x202aa5=_0xaef771/_0x6ec845*(0x1-utils['erlangb'](_0xaef771,_0x6ec845));}return _0x245b08({'erlangCalls':_0x5ce25d,'erlangCallToSecond':_0x1d5271/_0x5ce25d,'erlangAbandonmentRate':_0x374d10,'erlangBusyFactor':_0x202aa5});});};module[_0x735b('0x22e')]=Dialer; \ No newline at end of file +var _0x9642=['name','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalTotalCalls','isUndefined','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','error','stack','checkContactLowerLimitOriginate','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contactsRescheduled','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','isIVRCampaign','campaign:ivr:%s','campaign:save','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','stringify','isTrunkReachable','active','SIP/%s','status','unmonitored','prototype','Trunk','TrunkBackup','checkIfTime','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','Action','command','iftime\x20%s,%s','content','catch','push','true','all','some','OVERTIME_INTERVAL','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','sendMessageOneNotActive','resolve','checkIsTrunkReachable','dialTimezone','checkIfTimeIntervals','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','Queue','method\x20not\x20recognized','dialGlobalInterval','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_GLOBAL_INTERVAL','Global:\x20','\x20Interval\x20is\x20overtime:\x20','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','syncAgentConnect','uniqueid','ivr','updateOriginated','queue','answertime','YYYY-MM-DD\x20HH:mm:ss','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','syncQueueCallerAbandon','droptime','outboundDropCallsDayTimeout','statedesc','dropreason','TIMEOUT','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','additional','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','add','minutes','ContactId','VoiceQueueId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','ListId','CampaignId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','channel','actionid','strategy','rrmemory','roundrobin','paused','stateinterface','locked','isNil','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','rescheduleContact','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','responsetime','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','amdstatus','exten','xcally-motion-dialer','value','HANGUP','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','membername','buildObj','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','AMD','custom:amd','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','dialGlobalMaxRetry','createStateFinal','syncHangup','[syncHangupIvr][createHistory]','moveContactManagedDialer','dialQueueProject','AnswerAGI','outboundUnknownCallsDay','cause-txt','Unknow','[syncHangupIvr]','running','statusMessage','getQueueCampaignStatusMessage','available','inUse','pTalking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','assign','throttle','filter','dialPreviewRecallmeReminder','online','reachable','length','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','launchHandleIvr','handleIvr','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','XMD-','toUpper','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','object','evt\x20is\x20undefine','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','outboundRejectCallsDay','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalAvailable','talking','floor','erlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','avgHandleTime','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','voicePause','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','limitCalls','maxNumberOriginate','temp','[getContactCampaign2][Empty]','ivrTotalCallsDays','dialLimitQueue','countReScheduled','[countReScheduled]\x20','ACTIVE','[actionOriginate]\x20','checkIsBlackList','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','dialOrderByScheduledAt','RUNNING','[actionOriginatePredictive]\x20','[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','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','agentconnect','bind','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','syncQueueSummaryComplete','hangup','syncNewExten','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','emit','type','outbound','debug','inspect','format'];(function(_0x312579,_0x5bb0bb){var _0x801bb9=function(_0x53766a){while(--_0x53766a){_0x312579['push'](_0x312579['shift']());}};_0x801bb9(++_0x5bb0bb);}(_0x9642,0x1d8));var _0x2964=function(_0x1f5ddc,_0x386e4a){_0x1f5ddc=_0x1f5ddc-0x0;var _0x464343=_0x9642[_0x1f5ddc];return _0x464343;};'use strict';var util=require(_0x2964('0x0'));var _=require(_0x2964('0x1'));var uuid=require('uuid');var moment=require(_0x2964('0x2'));var rr=require('rr');var Redis=require(_0x2964('0x3'));var utils=require(_0x2964('0x4'));var hopperUtils=require(_0x2964('0x5'));var ut=require(_0x2964('0x6'));var config=require(_0x2964('0x7'));var logger=require('../../../config/logger')('dialer');var loggerBooked=require(_0x2964('0x8'))(_0x2964('0x9'));var loggerPredictive=require('../../../config/logger')(_0x2964('0xa'));var loggerPredictiveCalls=require(_0x2964('0x8'))(_0x2964('0xb'));var loggerSyncQueueSummary=require(_0x2964('0x8'))(_0x2964('0xc'));var ami=require('../ami');config[_0x2964('0xd')]=_[_0x2964('0xe')](config[_0x2964('0xd')],{'host':_0x2964('0xf'),'port':0x18eb});var io=require(_0x2964('0x10'))(new Redis(config[_0x2964('0xd')]));var cmHopper=require(_0x2964('0x11'));var voiceQueueRt=require(_0x2964('0x12'));var RpcSetting=require(_0x2964('0x13'));var Interval=require(_0x2964('0x14'));var Action=require('./models/action');var History=require(_0x2964('0x15'));var Final=require(_0x2964('0x16'));var AgentComplete=require(_0x2964('0x17'));var QueueCallerAbandon=require(_0x2964('0x18'));var Hangup=require(_0x2964('0x19'));var ipAgi=process['env'][_0x2964('0x1a')]||_0x2964('0x1b');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x2964('0x1c')]=function(_0x2d4e2b){this['tail']=this[_0x2964('0x1d')]?this['tail'][_0x2964('0x1e')](_0x2d4e2b):_0x2d4e2b();};function Dialer(_0x58a2cb,_0x1300cc){this[_0x2964('0x1f')]=new Sequence();this[_0x2964('0x20')]=_0x1300cc;this['voiceQueues']=_0x58a2cb[_0x2964('0x21')];this[_0x2964('0x22')]=_0x58a2cb[_0x2964('0x22')];this[_0x2964('0x23')]=_0x58a2cb[_0x2964('0x23')];this[_0x2964('0x24')]=_0x58a2cb[_0x2964('0x24')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this['channels']={};this[_0x2964('0x25')]={};this[_0x2964('0x26')]={};this[_0x2964('0x27')]={};this[_0x2964('0x28')]={};this[_0x2964('0x29')]={};this[_0x2964('0x2a')]={};this[_0x2964('0x2b')]={};this[_0x2964('0x2c')]={};this['queueBookedRR']={};this[_0x2964('0x2d')]={};ami['on'](_0x2964('0x2e'),this['syncAgentConnect'][_0x2964('0x2f')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x2964('0x2f')](this));ami['on'](_0x2964('0x30'),this[_0x2964('0x31')][_0x2964('0x2f')](this));ami['on']('agentcomplete',this[_0x2964('0x32')][_0x2964('0x2f')](this));ami['on'](_0x2964('0x33'),this[_0x2964('0xc')][_0x2964('0x2f')](this));ami['on']('custom:queuesummarycomplete',this[_0x2964('0x34')][_0x2964('0x2f')](this));ami['on'](_0x2964('0x35'),this['syncHangup'][_0x2964('0x2f')](this));ami['on']('newexten',this[_0x2964('0x36')][_0x2964('0x2f')](this));ami['on']('varset',this[_0x2964('0x37')][_0x2964('0x2f')](this));ami['on'](_0x2964('0x38'),this[_0x2964('0x39')][_0x2964('0x2f')](this));ami['on']('queuestatuscomplete',this[_0x2964('0x3a')][_0x2964('0x2f')](this));this[_0x2964('0x3b')]();this[_0x2964('0x3c')]();RpcSetting[_0x2964('0x3d')]()[_0x2964('0x3e')](function(_0x1d9546){previewRecallmeReminderInterval=_0x1d9546[_0x2964('0x3f')];});}function isNotNull(_0x2be66c){return _0x2be66c!==null&&!_['isUndefined'](_0x2be66c);}function msgResponse(_0x15373a,_0x136867,_0xb6e267){return{'action':_0x15373a,'response':_0x136867,'message':_0xb6e267,'stack':_0xb6e267};}function emit(_0x255962,_0x12279f,_0x2017bf){io['to'](_0x255962)[_0x2964('0x40')](_0x12279f,_0x2017bf);}function emitOutboundVoiceQueueSummary(_0x1c3345){if(_0x1c3345[_0x2964('0x41')]===_0x2964('0x42')){logger[_0x2964('0x43')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x2964('0x44')](_0x1c3345,{'showHidden':![],'depth':null}));emit(util[_0x2964('0x45')]('voice:queue:%s',_0x1c3345[_0x2964('0x46')]),'voice_queue:save',_0x1c3345);}}function checkGetDataPredictive(_0x641988){if(isNotNull(_0x641988)&&!_[_0x2964('0x47')](_0x641988)){loggerPredictive[_0x2964('0x48')](_0x2964('0x49'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x641988['predictiveIntervalTotalCalls']);loggerPredictive['info'](_0x2964('0x4a'),_0x641988['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x2964('0x48')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x641988[_0x2964('0x4b')]);loggerPredictive['info'](_0x2964('0x4c'),_0x641988['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x641988[_0x2964('0x4d')]);loggerPredictive[_0x2964('0x48')](_0x2964('0x4e'),_0x641988[_0x2964('0x4f')]);loggerPredictive[_0x2964('0x48')](_0x2964('0x50'));if(_0x641988[_0x2964('0x51')]>0x0){if(!_[_0x2964('0x52')](_0x641988['predictiveIntervalAvgTalktime'])&&_0x641988[_0x2964('0x4f')]>0x0){return!![];}loggerPredictive[_0x2964('0x48')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x641988[_0x2964('0x4d')])&&_0x641988[_0x2964('0x4d')]>0x0){return!![];}loggerPredictive['info'](_0x2964('0x53'));}else{loggerPredictive[_0x2964('0x48')](_0x2964('0x54'));}}else{loggerPredictive['info'](_0x2964('0x55'));}return![];}function mergeDataErlangB(_0x35e587){return function(_0x1a3228){loggerPredictive[_0x2964('0x48')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x2964('0x48')](_0x2964('0x56'),_0x1a3228['erlangCalls']);loggerPredictive[_0x2964('0x48')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1a3228[_0x2964('0x57')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1a3228[_0x2964('0x58')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1a3228[_0x2964('0x59')]);loggerPredictive[_0x2964('0x48')](_0x2964('0x5a'),_0x1a3228['erlangAbandonmentRate']);loggerPredictive[_0x2964('0x48')](_0x2964('0x50'));_[_0x2964('0x5b')](_0x35e587,_0x1a3228);};}function ifInterval(_0x1f46d2,_0x2d4e94){if(_[_0x2964('0x52')](_0x2d4e94)){return![];}return utils[_0x2964('0x5c')](undefined,_0x2d4e94)<_0x1f46d2*0x3c;}function clearPredictiveAttributes(_0x22758c){if(_0x22758c['startProgressive']){_0x22758c['startProgressive']=undefined;loggerPredictive[_0x2964('0x43')](_0x22758c['name'],_0x2964('0x5d'));}if(_0x22758c[_0x2964('0x29')]){_0x22758c[_0x2964('0x29')]=undefined;loggerPredictive['debug'](_0x22758c['name'],_0x2964('0x5e'));}if(_0x22758c['handlePredictive']){clearInterval(_0x22758c['handlePredictive']);_0x22758c[_0x2964('0x5f')]=undefined;loggerPredictive[_0x2964('0x43')](_0x22758c[_0x2964('0x46')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x4bb08e,_0x13c2e1){return function(_0x2fbd6c){loggerPredictive[_0x2964('0x60')](_0x13c2e1['name'],_0x4bb08e);loggerPredictive[_0x2964('0x60')](_0x2fbd6c[_0x2964('0x61')]);clearPredictiveAttributes(_0x13c2e1);};}function loggerCatch(_0x55e6c2){return function(_0xa7c874){logger[_0x2964('0x60')](_0x55e6c2,util[_0x2964('0x44')](_0xa7c874,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x8ff727,_0xfa1dae,_0x48d5bd){return function(_0x35d083){utils[_0x2964('0x62')](_0xfa1dae,_0x48d5bd,0x0);logger[_0x2964('0x60')](_0x8ff727,util[_0x2964('0x44')](_0x35d083,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x20fbcc){return function(_0x396206){if(isNotNull(_0x396206)&&isNotNull(_0x396206[0x0])){if(_0x396206[0x0]['contactsRescheduled']>0x0){_0x20fbcc['message']=utils[_0x2964('0x63')][_0x2964('0x64')];logger[_0x2964('0x48')](_0x2964('0x65')+_0x20fbcc[_0x2964('0x46')],_0x396206[0x0][_0x2964('0x66')],'contacts');}else{_0x20fbcc[_0x2964('0x67')]=utils['CAMPAIGN_STATUS'][_0x2964('0x68')];logger[_0x2964('0x48')](_0x2964('0x69')+_0x20fbcc[_0x2964('0x46')]);}}};}function createObjHistory(_0xa4479a,_0x1103a1,_0x15f9ea,_0x1bd551,_0x2e02ba){_0xa4479a[_0x2964('0x67')]=_0x15f9ea;var _0x30434a=new Action(_0xa4479a,_0x1103a1);var _0x213b1d=new History(_0x30434a);_0x213b1d[_0x2964('0x6a')]=_0x1bd551;_0x213b1d['statedesc']=_0x2e02ba;_0x213b1d[_0x2964('0x6b')]=_0x30434a[_0x2964('0x6c')];return _0x213b1d;}function unlockQueueStatus(_0xaa567b,_0x2f870e){setTimeout(function(){if(_[_0x2964('0x52')](_0xaa567b[_0x2964('0x6d')])){loggerBooked[_0x2964('0x60')](_0x2964('0x6e'),_0x2f870e);}_0xaa567b[_0x2964('0x6d')]=!![];loggerBooked[_0x2964('0x48')](_0x2964('0x6f'),_0x2f870e,JSON['stringify'](_[_0x2964('0x70')](_0xaa567b,[_0x2964('0x46'),_0x2964('0x6d')])));},0x1f3);}function checkInterval(_0x1a51d7){return function(){if(!isNotNull(_0x1a51d7[_0x2964('0x71')])){_0x1a51d7[_0x2964('0x67')]=utils[_0x2964('0x63')][_0x2964('0x72')];throw _0x1a51d7[_0x2964('0x46')]+_0x2964('0x73');}if(!isNotNull(_0x1a51d7[_0x2964('0x71')][_0x2964('0x74')])){_0x1a51d7['message']=utils[_0x2964('0x63')][_0x2964('0x72')];throw _0x1a51d7[_0x2964('0x46')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x1a51d7[_0x2964('0x71')][_0x2964('0x74')]))){_0x1a51d7[_0x2964('0x67')]=utils[_0x2964('0x63')][_0x2964('0x72')];throw _0x1a51d7[_0x2964('0x46')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x23019a){return function(){if(!utils[_0x2964('0x75')](_0x23019a)){_0x23019a[_0x2964('0x67')]=utils['CAMPAIGN_STATUS'][_0x2964('0x76')];throw _0x23019a[_0x2964('0x46')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x3dbc1a){if(utils[_0x2964('0x77')](_0x3dbc1a)){emit(util[_0x2964('0x45')](_0x2964('0x78'),_0x3dbc1a[_0x2964('0x46')]),_0x2964('0x79'),_0x3dbc1a);}}function loggerCatchQueueSummary(_0x48ee04,_0x64974b){return function(_0x540bd4){clearPredictiveAttributes(_0x64974b);emitCampaignSummary(_0x64974b);loggerSyncQueueSummary[_0x2964('0x43')](_0x48ee04,util[_0x2964('0x44')](_0x540bd4,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x3bf7ee){if(_0x3bf7ee['sendMessageOneNotActive']){if(_0x3bf7ee[_0x2964('0x7a')]===0x0){_0x3bf7ee['sendMessageOneNotActive']=![];_0x3bf7ee[_0x2964('0x67')]=utils['CAMPAIGN_STATUS'][_0x2964('0x76')];loggerSyncQueueSummary[_0x2964('0x43')](_0x2964('0x7b'),_0x3bf7ee[_0x2964('0x46')],_0x2964('0x7c'));}else{_0x3bf7ee[_0x2964('0x67')]=utils[_0x2964('0x63')][_0x2964('0x7d')];loggerSyncQueueSummary['debug'](_0x2964('0x7b'),_0x3bf7ee['name'],_0x2964('0x7e'));}emitCampaignSummary(_0x3bf7ee);}}function myreject(_0x24ec69){return function(_0x3798a9){return _0x24ec69(msgResponse(_0x2964('0x7f'),_0x2964('0x80'),JSON[_0x2964('0x81')](_0x3798a9)));};}Dialer['prototype'][_0x2964('0x82')]=function(_0x51ec01){return!_[_0x2964('0x52')](_0x51ec01)&&_0x51ec01&&!_[_0x2964('0x52')](_0x51ec01['name'])&&!_['isUndefined'](_0x51ec01['active'])&&_0x51ec01[_0x2964('0x83')]&&(this[_0x2964('0x24')][util[_0x2964('0x45')](_0x2964('0x84'),_0x51ec01[_0x2964('0x46')])][_0x2964('0x85')]==='reachable'||this[_0x2964('0x24')][util[_0x2964('0x45')](_0x2964('0x84'),_0x51ec01[_0x2964('0x46')])]['status']===_0x2964('0x86'));};Dialer[_0x2964('0x87')]['checkIsTrunkReachable']=function(_0x43ab93){var _0x243feb=this;return function(){if(!_0x243feb[_0x2964('0x82')](_0x43ab93[_0x2964('0x88')])){if(!_0x243feb[_0x2964('0x82')](_0x43ab93[_0x2964('0x89')])){_0x43ab93['message']=utils['CAMPAIGN_STATUS']['TRUNK_NOT_REACHABLE'];throw _0x43ab93[_0x2964('0x46')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0x2964('0x87')][_0x2964('0x8a')]=function(_0x1ba884,_0x19af5a,_0x50397d,_0x1b78a5){var _0x5b2a25=this;return function(){var _0x4a023e=!![];return _0x5b2a25[_0x2964('0x8b')](_0x1ba884,_0x19af5a,_0x50397d,_0x1b78a5,_0x4a023e);};};Dialer[_0x2964('0x87')]['checkIfTimeIntervals']=function(_0x4da61d,_0x592388,_0x532ee4,_0xb2200a){var _0x370e01=this;return function(){var _0x386e82=![];return _0x370e01[_0x2964('0x8b')](_0x4da61d['Intervals'],_0x592388,_0x532ee4,_0xb2200a,_0x386e82);};};Dialer['prototype']['ifTimeIvr']=function(_0x2be91c,_0x1a2eb9,_0x5af5ea,_0x23db69,_0x1214c2){var _0x25f689=[];return new Promise(function(_0xdce5c4,_0x39546c){if(!isNotNull(_0x2be91c)){_0x23db69['message']=utils['CAMPAIGN_STATUS'][_0x2964('0x72')];return _0x39546c(msgResponse(_0x2964('0x8c'),_0x2964('0x8d'),_0x5af5ea+_0x2964('0x8e')));}if(_[_0x2964('0x47')](_0x2be91c)){_0x23db69[_0x2964('0x67')]=utils[_0x2964('0x63')]['EMPTY_INTERVAL'];return _0x39546c(msgResponse(_0x2964('0x8c'),_0x2964('0x8d'),_0x5af5ea+_0x2964('0x8f')));}if(_0x1a2eb9&&_[_0x2964('0x52')](config[_0x2964('0x90')][_0x1a2eb9])){_0x23db69[_0x2964('0x67')]=utils[_0x2964('0x63')][_0x2964('0x91')];return _0x39546c(msgResponse('ifTime','Failure',_0x5af5ea+_0x2964('0x92')+_0x1a2eb9));}if(_[_0x2964('0x93')](_0x2be91c)){for(var _0x5ae6c1=0x0;_0x5ae6c1<_0x2be91c['length'];_0x5ae6c1+=0x1){_0x25f689['push'](ami[_0x2964('0x94')]({'action':_0x2964('0x95'),'command':util[_0x2964('0x45')](_0x2964('0x96'),_0x2be91c[_0x5ae6c1]['interval'],!_['isUndefined'](config['timezones'][_0x1a2eb9])?_0x1a2eb9:'')})['then'](function(_0x107528){return _0x107528[_0x2964('0x97')]['indexOf']('true')>=0x0;})[_0x2964('0x98')](myreject(_0x39546c)));}}else{_0x25f689[_0x2964('0x99')](ami['Action']({'action':_0x2964('0x95'),'command':util['format'](_0x2964('0x96'),_0x2be91c,!_[_0x2964('0x52')](config['timezones'][_0x1a2eb9])?_0x1a2eb9:'')})['then'](function(_0x30d852){return _0x30d852[_0x2964('0x97')]['indexOf'](_0x2964('0x9a'))>=0x0;})[_0x2964('0x98')](myreject(_0x39546c)));}Promise[_0x2964('0x9b')](_0x25f689)['then'](function(_0x121a1b){var _0x5dd862=_[_0x2964('0x9c')](_0x121a1b);if(_0x5dd862){return _0xdce5c4(_0x5dd862);}else{_0x23db69[_0x2964('0x67')]=_0x1214c2?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0x2964('0x9d')];return _0x39546c(msgResponse('[ifTime][promiseAll]',_0x2964('0x8d'),'Global:\x20'+_0x1214c2+'\x20'+_0x5af5ea+'\x20Interval\x20is\x20overtime:\x20'+util[_0x2964('0x44')](_0x2be91c,{'showHidden':![],'depth':null})+_0x2964('0x9e')+_0x1a2eb9));}})[_0x2964('0x98')](function(_0x295854){return _0x39546c(msgResponse(_0x2964('0x8c'),'Failure',JSON[_0x2964('0x81')](_0x295854)));});});};Dialer['prototype']['loopCampaigns']=function(){var _0x53f424=this;return cmHopper[_0x2964('0x9f')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x53f424[_0x2964('0xa0')]();},0x3e8);});};Dialer[_0x2964('0x87')][_0x2964('0xa0')]=function(){var _0x358d75=this;var _0x1f59a3;for(var _0x3dc609 in this[_0x2964('0x22')]){if(typeof this[_0x2964('0x22')][_0x3dc609]!==_0x2964('0xa1')){_0x1f59a3=this[_0x2964('0x22')][_0x3dc609];if(utils[_0x2964('0x77')](_0x1f59a3)&&utils[_0x2964('0x75')](_0x1f59a3)){_0x1f59a3[_0x2964('0xa2')]=!![];Promise[_0x2964('0xa3')]()[_0x2964('0x3e')](checkIsIVRCampaignActive(_0x1f59a3))['then'](checkInterval(_0x1f59a3))[_0x2964('0x3e')](_0x358d75[_0x2964('0xa4')](_0x1f59a3))['then'](_0x358d75[_0x2964('0x8a')](_0x1f59a3['dialGlobalInterval'],_0x1f59a3[_0x2964('0xa5')],_0x1f59a3[_0x2964('0x46')],_0x1f59a3))[_0x2964('0x3e')](_0x358d75[_0x2964('0xa6')](_0x1f59a3[_0x2964('0x71')],_0x1f59a3[_0x2964('0xa5')],_0x1f59a3[_0x2964('0x46')],_0x1f59a3))[_0x2964('0x3e')](_0x358d75['launchHandleIvr'](_0x1f59a3))[_0x2964('0x98')](loggerCatchQueueSummary(_0x2964('0xa7'),_0x1f59a3));}else{notSendMessagesCampaign(_0x1f59a3);}}}};Dialer['prototype'][_0x2964('0xa8')]=function(_0x203d38){if(_0x203d38[_0x2964('0xa9')]!==_0x2964('0xa')){clearPredictiveAttributes(_0x203d38);}switch(_0x203d38['dialMethod']){case _0x2964('0xaa'):this[_0x2964('0xab')](_0x203d38,0x1);break;case'power':this[_0x2964('0xab')](_0x203d38,_0x203d38['dialPowerLevel']);break;case _0x2964('0xa'):this[_0x2964('0xa')](_0x203d38);break;case _0x2964('0x9'):this[_0x2964('0xab')](_0x203d38,0x1);break;default:logger[_0x2964('0x60')](_0x2964('0xac'),_0x203d38[_0x2964('0x46')],_0x2964('0xad'));}};Dialer['prototype'][_0x2964('0x8c')]=function(_0x1ba7eb,_0x2bcfbc){var _0x1f5f07=_0x1ba7eb[_0x2964('0xa5')];var _0x2c1116=_0x2bcfbc?_0x1ba7eb[_0x2964('0xae')]:_0x1ba7eb['Interval'][_0x2964('0x74')];logger['silly']('Dialer::ifTime()',_0x2c1116,_0x1f5f07,_0x1ba7eb[_0x2964('0x46')],util[_0x2964('0x45')](_0x2964('0xaf'),_0x1ba7eb[_0x2964('0x46')],_0x1ba7eb['id']));var _0x498a12=null;return Interval[_0x2964('0xb0')](_0x2c1116,_0x1f5f07)[_0x2964('0x3e')](function(_0xabc727){if(_0xabc727===!![]){return _0xabc727;}else{_0x1ba7eb[_0x2964('0x67')]=_0x2bcfbc?utils['CAMPAIGN_STATUS'][_0x2964('0xb1')]:utils[_0x2964('0x63')]['OVERTIME_INTERVAL'];_0x498a12=msgResponse('[ifTime][promiseAll]',_0x2964('0x8d'),_0x2964('0xb2')+_0x2bcfbc+'\x20'+_0x1ba7eb[_0x2964('0x46')]+_0x2964('0xb3')+util[_0x2964('0x44')](_0x2c1116,{'showHidden':![],'depth':null})+_0x2964('0x9e')+_0x1f5f07);}if(_0x498a12!==null){logger[_0x2964('0xb4')](_0x2964('0xb5'),_0x498a12);_0x498a12[_0x2964('0xb6')]=_0x2bcfbc;throw _0x498a12;}})[_0x2964('0x98')](function(_0xe20540){logger[_0x2964('0x60')](_0x2964('0xb7'),_0xe20540);throw msgResponse(_0x2964('0x7f'),_0x2964('0x80'),util[_0x2964('0x44')](_0xe20540,{'showHidden':![],'depth':null}));});};Dialer[_0x2964('0x87')][_0x2964('0xb8')]=function(_0x32e403){if(this[_0x2964('0x21')][_0x32e403['queue']]){if(this[_0x2964('0x27')][_0x32e403[_0x2964('0xb9')]]&&this[_0x2964('0x27')][_0x32e403['uniqueid']]['type']!==_0x2964('0xba')){this[_0x2964('0xbb')](this[_0x2964('0x21')][_0x32e403[_0x2964('0xbc')]]);this['uniqueId'][_0x32e403[_0x2964('0xb9')]][_0x2964('0xbd')]=moment()[_0x2964('0x45')](_0x2964('0xbe'));}}};Dialer[_0x2964('0x87')][_0x2964('0x32')]=function(_0x49dd2f){var _0x403bce=this[_0x2964('0x27')][_0x49dd2f[_0x2964('0xb9')]];if(this[_0x2964('0x21')][_0x49dd2f[_0x2964('0xbc')]]){if(_0x403bce&&_0x403bce[_0x2964('0x41')]!==_0x2964('0xba')){delete this[_0x2964('0x27')][_0x49dd2f[_0x2964('0xb9')]];this[_0x2964('0x21')][_0x49dd2f[_0x2964('0xbc')]]['outboundAnswerCallsDay']+=0x1;var _0x25580c=new AgentComplete(_0x403bce,_0x49dd2f);if(_0x49dd2f[_0x2964('0xbf')]===_0x2964('0xc0')){_0x25580c[_0x2964('0xc1')]=this[_0x2964('0x21')][_0x49dd2f[_0x2964('0xbc')]][_0x2964('0xc2')]&&this[_0x2964('0x21')][_0x49dd2f[_0x2964('0xbc')]][_0x2964('0xc3')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0x2964('0xc4')](_0x25580c)[_0x2964('0x98')](loggerCatch(_0x2964('0xc5')));hopperUtils['moveContactManagedDialer'](_0x25580c)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x2964('0x87')][_0x2964('0xc6')]=function(_0x701457){var _0x4d5ccc=this['uniqueId'][_0x701457[_0x2964('0xb9')]];var _0x24ede8=this;var _0x3ad181=![];var _0x28005b;var _0x3d0324;if(this['voiceQueues'][_0x701457[_0x2964('0xbc')]]){if(_0x4d5ccc&&_0x4d5ccc[_0x2964('0x41')]!=='ivr'){delete this[_0x2964('0x27')][_0x701457[_0x2964('0xb9')]];this[_0x2964('0xbb')](this[_0x2964('0x21')][_0x701457[_0x2964('0xbc')]]);_0x4d5ccc[_0x2964('0xc7')]=moment()[_0x2964('0x45')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5d7fdd=new QueueCallerAbandon(_0x4d5ccc,_0x701457);if(utils[_0x2964('0x5c')](_0x4d5ccc[_0x2964('0xc7')],_0x4d5ccc['responsetime'])>=_0x4d5ccc['dialQueueTimeout']){this[_0x2964('0x21')][_0x701457[_0x2964('0xbc')]][_0x2964('0x4b')]+=0x1;this[_0x2964('0x21')][_0x701457['queue']][_0x2964('0xc8')]+=0x1;this[_0x2964('0x21')][_0x701457['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x5d7fdd[_0x2964('0x6a')]=0xa;_0x5d7fdd[_0x2964('0xc9')]='Drop';_0x5d7fdd[_0x2964('0xca')]=_0x2964('0xcb');_0x5d7fdd['agiafterat']=this[_0x2964('0x21')][_0x701457['queue']][_0x2964('0xc2')]?moment()[_0x2964('0x45')](_0x2964('0xbe')):undefined;_0x5d7fdd['countdropretry']+=0x1;_0x5d7fdd[_0x2964('0xcc')]+=0x1;_0x28005b=this[_0x2964('0x21')][_0x701457[_0x2964('0xbc')]][_0x2964('0xcd')];_0x3d0324=this[_0x2964('0x21')][_0x701457['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0x2964('0xce')](_0x5d7fdd,_0x5d7fdd[_0x2964('0x6a')],_0x4d5ccc[_0x2964('0xcf')])['then'](function(_0x46a0f5){_0x3ad181=_0x46a0f5[_0x2964('0xd0')]==0x1;if(_0x5d7fdd[_0x2964('0xd1')]>=_0x24ede8[_0x2964('0x21')][_0x701457[_0x2964('0xbc')]][_0x2964('0xd2')]){_0x24ede8[_0x2964('0xd3')](_0x5d7fdd,_0x46a0f5[_0x2964('0xd0')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x5d7fdd['countdropretry'],'scheduledat':moment()[_0x2964('0xd4')](_0x24ede8[_0x2964('0x21')][_0x701457['queue']][_0x2964('0xcd')],_0x2964('0xd5'))[_0x2964('0x45')](_0x2964('0xbe')),'ContactId':_0x4d5ccc[_0x2964('0xd6')],'ListId':_0x4d5ccc['ListId'],'VoiceQueueId':_0x4d5ccc[_0x2964('0xd7')]||undefined,'CampaignId':_0x4d5ccc['CampaignId']||undefined})[_0x2964('0x98')](loggerCatch(_0x2964('0xd8')));var _0x21ae51=new History(_0x5d7fdd);_0x21ae51[_0x2964('0x6a')]=0xa;_0x21ae51[_0x2964('0xc9')]='Drop';_0x21ae51['starttime']=moment()['format'](_0x2964('0xbe'));_0x21ae51['endtime']=_0x21ae51[_0x2964('0x6c')];_0x21ae51[_0x2964('0xd9')]=_0x5d7fdd[_0x2964('0xd9')];_0x21ae51[_0x2964('0xda')]=_0x5d7fdd['calleridnum'];hopperUtils['createHistory'](_0x21ae51)['catch'](loggerCatch(_0x2964('0xdb')));}})[_0x2964('0x3e')](function(){if(_0x3ad181)hopperUtils['swapAdditionalPhones'](_0x5d7fdd,_0x28005b,_0x3d0324)[_0x2964('0x3e')](function(){return 0x1;});});}else{this['voiceQueues'][_0x701457['queue']][_0x2964('0xdc')]+=0x1;this['voiceQueues'][_0x701457[_0x2964('0xbc')]][_0x2964('0xdd')]+=0x1;_0x5d7fdd['state']=0xb;_0x5d7fdd[_0x2964('0xc9')]='Abandoned';_0x5d7fdd['dropreason']=_0x2964('0xde');_0x5d7fdd[_0x2964('0xdf')]+=0x1;_0x5d7fdd['countglobal']+=0x1;_0x28005b=this[_0x2964('0x21')][_0x701457[_0x2964('0xbc')]][_0x2964('0xe0')];_0x3d0324=this[_0x2964('0x21')][_0x701457[_0x2964('0xbc')]][_0x2964('0xe1')];hopperUtils['verifyAdditionalPhones'](_0x5d7fdd,_0x5d7fdd[_0x2964('0x6a')],_0x4d5ccc[_0x2964('0xcf')])[_0x2964('0x3e')](function(_0x50dbda){if(_0x5d7fdd[_0x2964('0xdf')]>=_0x24ede8[_0x2964('0x21')][_0x701457[_0x2964('0xbc')]][_0x2964('0xe2')]){_0x24ede8[_0x2964('0xd3')](_0x5d7fdd,_0x50dbda[_0x2964('0xd0')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x5d7fdd['countabandonedretry'],'scheduledat':moment()[_0x2964('0xd4')](_0x24ede8[_0x2964('0x21')][_0x701457[_0x2964('0xbc')]]['dialAbandonedRetryFrequency'],_0x2964('0xd5'))[_0x2964('0x45')](_0x2964('0xbe')),'ContactId':_0x4d5ccc[_0x2964('0xd6')],'ListId':_0x4d5ccc[_0x2964('0xe3')],'VoiceQueueId':_0x4d5ccc[_0x2964('0xd7')]||undefined,'CampaignId':_0x4d5ccc[_0x2964('0xe4')]||undefined})[_0x2964('0x98')](loggerCatch(_0x2964('0xe5')));var _0x38a8ad=new History(_0x5d7fdd);_0x38a8ad['state']=0xb;_0x38a8ad['statedesc']='Abandoned';_0x38a8ad[_0x2964('0x6c')]=moment()['format'](_0x2964('0xbe'));_0x38a8ad['endtime']=_0x38a8ad[_0x2964('0x6c')];_0x38a8ad[_0x2964('0xd9')]=_0x5d7fdd[_0x2964('0xd9')];_0x38a8ad[_0x2964('0xda')]=_0x5d7fdd['calleridnum'];hopperUtils[_0x2964('0xc4')](_0x38a8ad)[_0x2964('0x98')](loggerCatch(_0x2964('0xe6')));}})[_0x2964('0x3e')](function(){if(_0x3ad181)hopperUtils[_0x2964('0xe7')](_0x5d7fdd,_0x28005b,_0x3d0324)['then'](function(){return 0x1;});});}}}};Dialer[_0x2964('0x87')][_0x2964('0x36')]=function(_0x42bef4){if(this[_0x2964('0x25')][_0x42bef4[_0x2964('0xb9')]]){this['actions'][_0x42bef4[_0x2964('0xb9')]]['channel']=_0x42bef4['channel'];}if(this[_0x2964('0x27')][_0x42bef4[_0x2964('0xb9')]]){this[_0x2964('0x27')][_0x42bef4[_0x2964('0xb9')]][_0x2964('0xe8')]=_0x42bef4[_0x2964('0xe8')];}};Dialer[_0x2964('0x87')]['syncQueueMember']=function(_0x3bbce6){if(!this[_0x2964('0x25')][_0x3bbce6[_0x2964('0xe9')]]){return;}var _0x43e902=this[_0x2964('0x21')][this[_0x2964('0x25')][_0x3bbce6[_0x2964('0xe9')]][_0x2964('0xbc')]][_0x2964('0xea')]||_0x2964('0xeb');if(_0x43e902===_0x2964('0xec')){if(this['actions'][_0x3bbce6[_0x2964('0xe9')]]&&_['isNil'](this['actions'][_0x3bbce6['actionid']]['locked'])&&_0x3bbce6[_0x2964('0x85')]==='1'&&_0x3bbce6[_0x2964('0xed')]==='0'){if(this[_0x2964('0x23')][_0x3bbce6[_0x2964('0xee')]]){if(!this[_0x2964('0x23')][_0x3bbce6[_0x2964('0xee')]][_0x2964('0xef')]){this['agents'][_0x3bbce6['stateinterface']]['locked']=!![];this[_0x2964('0x25')][_0x3bbce6[_0x2964('0xe9')]][_0x2964('0xef')]=!![];this[_0x2964('0x25')][_0x3bbce6[_0x2964('0xe9')]][_0x2964('0xee')]=_0x3bbce6[_0x2964('0xee')];}}}}else if(_0x43e902===_0x2964('0xeb')){if(this[_0x2964('0x25')][_0x3bbce6['actionid']]){if(this[_0x2964('0x23')][_0x3bbce6['stateinterface']]){this[_0x2964('0x25')][_0x3bbce6[_0x2964('0xe9')]][_0x2964('0xee')]=_0x3bbce6[_0x2964('0xee')];if(_[_0x2964('0xf0')](this[_0x2964('0x2c')][this[_0x2964('0x25')][_0x3bbce6[_0x2964('0xe9')]][_0x2964('0xbc')]])){this[_0x2964('0x2c')][this[_0x2964('0x25')][_0x3bbce6['actionid']]['queue']]=[];}this[_0x2964('0x2c')][this['actions'][_0x3bbce6[_0x2964('0xe9')]]['queue']][_0x2964('0x99')](_['merge'](_[_0x2964('0x70')](this[_0x2964('0x25')][_0x3bbce6[_0x2964('0xe9')]],[_0x2964('0xf1'),_0x2964('0xee')]),{'status':_0x3bbce6[_0x2964('0x85')],'paused':_0x3bbce6[_0x2964('0xed')]}));}}}};Dialer['prototype'][_0x2964('0x3a')]=function(_0x10a86c){if(!this[_0x2964('0x25')][_0x10a86c[_0x2964('0xe9')]]){return;}var _0x21bbef=this;var _0x159de4=this[_0x2964('0x21')][this[_0x2964('0x25')][_0x10a86c['actionid']][_0x2964('0xbc')]];var _0x57cea8=_0x159de4[_0x2964('0xea')]||'rrmemory';if(_0x57cea8===_0x2964('0xec')){if(this[_0x2964('0x25')][_0x10a86c[_0x2964('0xe9')]]&&this['actions'][_0x10a86c[_0x2964('0xe9')]][_0x2964('0xee')]){this[_0x2964('0x20')][_0x2964('0xf2')](this['actions'][_0x10a86c['actionid']]['idHopper'],this[_0x2964('0x25')][_0x10a86c[_0x2964('0xe9')]][_0x2964('0xee')])[_0x2964('0x98')](function(_0x3558b2){logger[_0x2964('0x60')](_0x2964('0xf3'),util[_0x2964('0x44')](_0x3558b2,{'showHidden':![],'depth':null}));})[_0x2964('0x1e')](function(){_0x21bbef[_0x2964('0xbb')](_0x21bbef[_0x2964('0x21')][_0x21bbef[_0x2964('0x25')][_0x10a86c[_0x2964('0xe9')]][_0x2964('0xbc')]]);_0x21bbef[_0x2964('0x23')][_0x21bbef['actions'][_0x10a86c[_0x2964('0xe9')]]['stateinterface']][_0x2964('0xef')]=![];delete _0x21bbef[_0x2964('0x25')][_0x10a86c[_0x2964('0xe9')]];unlockQueueStatus(_0x159de4);});}else{this['updateOriginated'](this[_0x2964('0x21')][this['actions'][_0x10a86c[_0x2964('0xe9')]][_0x2964('0xbc')]]);hopperUtils[_0x2964('0xf4')]({'active':![],'ContactId':this[_0x2964('0x25')][_0x10a86c[_0x2964('0xe9')]][_0x2964('0xd6')],'ListId':this[_0x2964('0x25')][_0x10a86c[_0x2964('0xe9')]]['ListId'],'VoiceQueueId':this[_0x2964('0x25')][_0x10a86c['actionid']][_0x2964('0xd7')]||undefined,'CampaignId':this['actions'][_0x10a86c[_0x2964('0xe9')]][_0x2964('0xe4')]||undefined})[_0x2964('0x98')](loggerCatch(_0x2964('0xf5')));delete this[_0x2964('0x25')][_0x10a86c[_0x2964('0xe9')]];unlockQueueStatus(_0x159de4);}}else if(_0x57cea8===_0x2964('0xeb')){var _0x2ec15b;if(this[_0x2964('0x25')][_0x10a86c[_0x2964('0xe9')]]&&!_[_0x2964('0x47')](this[_0x2964('0x2c')][this['actions'][_0x10a86c['actionid']][_0x2964('0xbc')]])){if(this[_0x2964('0xf6')][_0x21bbef[_0x2964('0x25')][_0x10a86c['actionid']][_0x2964('0xbc')]]){this[_0x2964('0xf6')][_0x21bbef['actions'][_0x10a86c['actionid']][_0x2964('0xbc')]]=this[_0x2964('0xf6')][this[_0x2964('0x25')][_0x10a86c['actionid']][_0x2964('0xbc')]]?this[_0x2964('0xf6')][this[_0x2964('0x25')][_0x10a86c[_0x2964('0xe9')]]['queue']]:this[_0x2964('0x2c')][this[_0x2964('0x25')][_0x10a86c[_0x2964('0xe9')]]['queue']]?this['queueBooked'][this[_0x2964('0x25')][_0x10a86c[_0x2964('0xe9')]][_0x2964('0xbc')]]['_rr']||0x0:0x0;}this[_0x2964('0x2c')][this['actions'][_0x10a86c[_0x2964('0xe9')]][_0x2964('0xbc')]][_0x2964('0xf7')]=this[_0x2964('0xf6')][this['actions'][_0x10a86c[_0x2964('0xe9')]][_0x2964('0xbc')]];for(var _0x3d9b5c=0x0;_0x3d9b5c=_0x4774f1['dialGlobalMaxRetry']){_0x348e42[_0x2964('0x120')](_0x398431,_0x58b039,_0x7b49dc,_0x2964('0x121'));}else{if(_0x398431['countmachineretry']>=_0x4774f1[_0x2964('0x122')]){_0x348e42['createStateFinal'](_0x398431,_0x58b039,_0x7b49dc,_0x2964('0x123'));}else{hopperUtils[_0x2964('0xf4')]({'active':![],'countmachineretry':_0x398431['countmachineretry'],'scheduledat':moment()['add'](_0x4774f1[_0x2964('0x124')],_0x2964('0xd5'))[_0x2964('0x45')](_0x2964('0xbe')),'ContactId':_0x398431['ContactId'],'ListId':_0x398431[_0x2964('0xe3')],'VoiceQueueId':_0x398431[_0x2964('0xd7')]||undefined,'CampaignId':_0x398431[_0x2964('0xe4')]||undefined})[_0x2964('0x98')](loggerCatch(_0x2964('0x125')));_0x58b039({'reschedule':0x1});}}});}if(_0x13db7b[_0x2964('0x41')]===_0x2964('0xba')&&this[_0x2964('0x22')][_0x13db7b[_0x2964('0xbc')]][_0x2964('0x113')]&&_0x4ff631['value']===_0x2964('0x10b')){delete this[_0x2964('0x27')][_0x4ff631['uniqueid']];this[_0x2964('0xbb')](this[_0x2964('0x22')][_0x13db7b[_0x2964('0xbc')]]);_0xcaf4c=new Hangup(_0x13db7b,_0x4ff631);_0xcaf4c[_0x2964('0x6a')]=0x12;_0xcaf4c[_0x2964('0xc9')]=_0x2964('0x10e');_0xcaf4c[_0x2964('0x10f')]=_0x2964('0x116');ami[_0x2964('0x40')](_0x2964('0x117'),ut[_0x2964('0x110')](_0xcaf4c,_0x2964('0x118')));this['saveInDb'](_0xcaf4c,_0x2964('0x126'),_0x2964('0x127'));}if(_0x13db7b['type']==='ivr'&&this['campaigns'][_0x13db7b['queue']]['dialAMDActive']&&_0x4ff631[_0x2964('0x10a')]===_0x2964('0x114')){return new Promise(function(_0x25274f,_0x51ee16){delete _0x348e42[_0x2964('0x27')][_0x4ff631[_0x2964('0xb9')]];_0x348e42[_0x2964('0xbb')](_0x348e42[_0x2964('0x22')][_0x13db7b['queue']]);_0x348e42[_0x2964('0x22')][_0x13db7b['queue']][_0x2964('0x10c')]+=0x1;_0x348e42['campaigns'][_0x13db7b['queue']][_0x2964('0x10d')]+=0x1;var _0x52edb1=_0x348e42[_0x2964('0x22')][_0x13db7b[_0x2964('0xbc')]];var _0x44afea=new Hangup(_0x13db7b,_0x4ff631);_0x44afea[_0x2964('0x6a')]=0x13;_0x44afea[_0x2964('0xc9')]=_0x2964('0x115');_0x44afea[_0x2964('0x10f')]=_0x2964('0x116');_0x44afea[_0x2964('0x11e')]+=0x1;_0x44afea[_0x2964('0xcc')]+=0x1;_0x44afea[_0x2964('0x118')]=!![];ami[_0x2964('0x40')](_0x2964('0x117'),ut['buildObj'](_0x44afea,_0x2964('0x118')));hopperUtils[_0x2964('0xc4')](_0x44afea)[_0x2964('0x98')](loggerCatch(_0x2964('0x119')));if(_0x44afea['countbusyretry']+_0x44afea[_0x2964('0x11b')]+_0x44afea[_0x2964('0x11c')]+_0x44afea[_0x2964('0x11d')]+_0x44afea[_0x2964('0xd1')]+_0x44afea[_0x2964('0xdf')]+_0x44afea['countmachineretry']+_0x44afea['countagentrejectretry']>=_0x52edb1[_0x2964('0x128')]){_0x348e42['stateGlobal'](_0x44afea,_0x25274f,_0x51ee16,_0x2964('0x121'));}else{if(_0x44afea[_0x2964('0x11e')]>=_0x52edb1[_0x2964('0x122')]){_0x348e42[_0x2964('0x129')](_0x44afea,_0x25274f,_0x51ee16,_0x2964('0x123'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x44afea[_0x2964('0x11e')],'scheduledat':moment()[_0x2964('0xd4')](_0x52edb1[_0x2964('0x124')],_0x2964('0xd5'))['format'](_0x2964('0xbe')),'ContactId':_0x44afea[_0x2964('0xd6')],'ListId':_0x44afea[_0x2964('0xe3')],'VoiceQueueId':_0x44afea['VoiceQueueId']||undefined,'CampaignId':_0x44afea[_0x2964('0xe4')]||undefined})[_0x2964('0x98')](loggerCatch(_0x2964('0x125')));_0x25274f({'reschedule':0x1});}}});}}};Dialer[_0x2964('0x87')][_0x2964('0x12a')]=function(_0x410a4f){var _0x23b340=this[_0x2964('0x27')][_0x410a4f['uniqueid']];var _0x477d24;if(_0x23b340&&_0x23b340[_0x2964('0x41')]===_0x2964('0xba')){delete this[_0x2964('0x27')][_0x410a4f[_0x2964('0xb9')]];this[_0x2964('0xbb')](this['campaigns'][_0x23b340['queue']]);this[_0x2964('0x22')][_0x23b340[_0x2964('0xbc')]]['ivrAnswerCallsDay']+=0x1;_0x477d24=new Hangup(_0x23b340,_0x410a4f);hopperUtils['createHistory'](_0x477d24)['catch'](loggerCatch(_0x2964('0x12b')));hopperUtils[_0x2964('0x12c')](_0x477d24)[_0x2964('0x98')](loggerCatch('[syncHangupIvr]'));}if(_0x23b340&&_0x23b340[_0x2964('0x41')]!==_0x2964('0xba')&&isNotNull(this[_0x2964('0x21')][_0x23b340[_0x2964('0xbc')]][_0x2964('0x12d')])){delete this[_0x2964('0x27')][_0x410a4f['uniqueid']];this['updateOriginated'](this[_0x2964('0x21')][_0x23b340[_0x2964('0xbc')]]);this[_0x2964('0x21')][_0x23b340['queue']][_0x2964('0x10c')]+=0x1;this[_0x2964('0x21')][_0x23b340[_0x2964('0xbc')]][_0x2964('0x10d')]+=0x1;_0x477d24=new Hangup(_0x23b340,_0x410a4f);_0x477d24[_0x2964('0x6a')]=0x10;_0x477d24['statedesc']=_0x2964('0x12e');_0x477d24[_0x2964('0x10f')]='AGI';hopperUtils[_0x2964('0xc4')](_0x477d24)[_0x2964('0x98')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x2964('0x12c')](_0x477d24)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x23b340&&_0x23b340[_0x2964('0x41')]!==_0x2964('0xba')&&!isNotNull(this[_0x2964('0x21')][_0x23b340['queue']]['dialQueueProject'])){delete this[_0x2964('0x27')][_0x410a4f[_0x2964('0xb9')]];this[_0x2964('0xbb')](this[_0x2964('0x21')][_0x23b340[_0x2964('0xbc')]]);this[_0x2964('0x21')][_0x23b340[_0x2964('0xbc')]][_0x2964('0x12f')]+=0x1;_0x477d24=new Hangup(_0x23b340,_0x410a4f);_0x477d24['state']=0xc;_0x477d24[_0x2964('0xc9')]=_0x410a4f[_0x2964('0x130')];_0x477d24['membername']=_0x2964('0x131');hopperUtils[_0x2964('0xc4')](_0x477d24)[_0x2964('0x98')](loggerCatch(_0x2964('0x12b')));hopperUtils[_0x2964('0x12c')](_0x477d24)[_0x2964('0x98')](loggerCatch(_0x2964('0x132')));}};Dialer[_0x2964('0x87')]['syncQueueSummary']=function(_0xe5c943){var _0x2dab28=this;if(!_0x2dab28[_0x2964('0x2d')][_0xe5c943[_0x2964('0x46')]]){_0x2dab28['queuesSummary'][_0xe5c943['name']]={'running':![]};}else if(_0x2dab28[_0x2964('0x2d')][_0xe5c943['name']][_0x2964('0x133')]===!![]){return;}else if(_0x2dab28[_0x2964('0x2d')][_0xe5c943[_0x2964('0x46')]][_0x2964('0x133')]===![]){_0x2dab28[_0x2964('0x2d')][_0xe5c943[_0x2964('0x46')]][_0x2964('0x133')]=!![];}var _0x4c947f=_0x2dab28[_0x2964('0x21')][_0xe5c943[_0x2964('0x46')]];var _0x166b45=_0x4c947f['message']!==utils[_0x2964('0x63')][_0x2964('0x76')];var _0x404c88=utils['isPreviewCampaign'](_0x4c947f);_0x4c947f[_0x2964('0x134')]=utils[_0x2964('0x135')](_0x4c947f,_0x2dab28[_0x2964('0x24')]);Promise[_0x2964('0xa3')]()[_0x2964('0x3e')](function(){if(_0x4c947f[_0x2964('0x134')]===utils['CAMPAIGN_STATUS'][_0x2964('0x76')]){if(_0x166b45){clearPredictiveAttributes(_0x4c947f);_0xe5c943[_0x2964('0x29')]=undefined;_0xe5c943[_0x2964('0x2a')]=undefined;}if(_0x4c947f[_0x2964('0x134')]===utils[_0x2964('0x63')][_0x2964('0x76')]){_0xe5c943[_0x2964('0x136')]=0x0;_0xe5c943[_0x2964('0xed')]=0x0;_0xe5c943[_0x2964('0x137')]=0x0;_0xe5c943['talking']=0x0;_0xe5c943[_0x2964('0x138')]=0x0;}}else if(_0x4c947f[_0x2964('0x134')]===utils['CAMPAIGN_STATUS']['ACTIVE']&&!_0x404c88){return _0x2dab28[_0x2964('0x8c')](_0x4c947f,!![])[_0x2964('0x3e')](function(){return _0x2dab28['ifTime'](_0x4c947f,![]);})[_0x2964('0x3e')](function(){return _0x2dab28[_0x2964('0xa8')](_0x4c947f);})[_0x2964('0x98')](function(_0x39ad09){loggerSyncQueueSummary[_0x2964('0x43')](_0x2964('0x139'),util[_0x2964('0x44')](_0x39ad09,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x4c947f);});}else{clearPredictiveAttributes(_0x4c947f);}})[_0x2964('0x3e')](function(){var _0x2116a4=_0xe5c943[_0x2964('0x13a')](_0x4c947f);if(_0x2116a4||_0x4c947f[_0x2964('0x13b')]){_0x4c947f[_0x2964('0x13b')]=![];_0xe5c943['updateReportFromOutboundQueue'](_0x4c947f);Object[_0x2964('0x13c')](_0x4c947f,_0xe5c943);emitOutboundVoiceQueueSummary(_0xe5c943);}_0x2dab28['queuesSummary'][_0x4c947f[_0x2964('0x46')]]['running']=![];})['catch'](function(_0x4215f5){logger[_0x2964('0x60')](_0x2964('0x139'),util[_0x2964('0x44')](_0x4215f5,{'showHidden':![],'depth':null}));_0x2dab28[_0x2964('0x2d')][_0x4c947f[_0x2964('0x46')]]['running']=![];});};Dialer[_0x2964('0x87')][_0x2964('0x34')]=_[_0x2964('0x13d')](function(){var _0x454564=_[_0x2964('0x13e')](this[_0x2964('0x21')],function(_0x3bc1af){return _0x3bc1af[_0x2964('0x13f')];});var _0x4d978f=_[_0x2964('0x13e')](this[_0x2964('0x23')],function(_0x3385f8){return _0x3385f8[_0x2964('0x140')]&&_0x3385f8[_0x2964('0x85')]===_0x2964('0x141');});if(_0x454564[_0x2964('0x142')]>0x0&&_0x4d978f[_0x2964('0x142')]>0x0){return Promise[_0x2964('0xa3')]()[_0x2964('0x3e')](cmHopper[_0x2964('0x143')](_[_0x2964('0x144')](_0x454564,'id'),previewRecallmeReminderInterval,_[_0x2964('0x144')](_0x4d978f,'id')))[_0x2964('0x3e')](function(_0x17cef6){for(var _0x980e67=0x0;_0x980e67<_0x17cef6[_0x2964('0x142')];_0x980e67++){var _0x12f19e=_0x17cef6[_0x980e67][_0x2964('0x145')][_0x2964('0x46')];if(_0x12f19e)io['to'](util['format'](_0x2964('0x146'),_0x12f19e))[_0x2964('0x40')](_0x2964('0x147'),{'hopper':_0x17cef6[_0x980e67]});}})[_0x2964('0x98')](function(_0x458314){logger['error'](_0x2964('0x148'),_0x458314);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x2964('0x87')]['loopClearZombieChannels']=function(){var _0x2cb947=this;setInterval(function(){_0x2cb947['clearZombieChannels'](_0x2cb947[_0x2964('0x27')],'[uniqueid]');_0x2cb947[_0x2964('0x149')](_0x2cb947['actions'],_0x2964('0x14a'));},0x32c8);};Dialer[_0x2964('0x87')][_0x2964('0x149')]=function(_0x33a8ae,_0x20a258){var _0x10e885=this;for(var _0x20aac2 in _0x33a8ae){if(typeof _0x33a8ae[_0x20aac2]!==_0x2964('0xa1')){this['sequence'][_0x2964('0x1c')](function(){if(!_[_0x2964('0xf0')](_0x33a8ae[_0x20aac2])){return ami['Action']({'action':_0x2964('0x85'),'channel':_0x33a8ae[_0x20aac2]['channel']})[_0x2964('0x98')](function(_0x2d4e13){if(_0x2d4e13[_0x2964('0x67')]===_0x2964('0x14b')){setTimeout(function(){if(_0x33a8ae[_0x20aac2]&&_0x33a8ae[_0x20aac2][_0x2964('0x41')]!=='ivr'){_0x10e885[_0x2964('0xbb')](_0x10e885['voiceQueues'][_0x33a8ae[_0x20aac2][_0x2964('0xbc')]]);logger[_0x2964('0x60')](_0x2964('0x14c'),_0x20a258,_0x20aac2,_0x33a8ae[_0x20aac2][_0x2964('0xbc')]);delete _0x33a8ae[_0x20aac2];}if(_0x33a8ae[_0x20aac2]&&_0x33a8ae[_0x20aac2][_0x2964('0x41')]===_0x2964('0xba')){_0x10e885[_0x2964('0xbb')](_0x10e885[_0x2964('0x22')][_0x33a8ae[_0x20aac2][_0x2964('0xbc')]]);logger[_0x2964('0x60')](_0x2964('0x14d'),_0x20a258,_0x20aac2,_0x33a8ae[_0x20aac2]['queue']);delete _0x33a8ae[_0x20aac2];}},0x2328);}});}});}}};Dialer[_0x2964('0x87')][_0x2964('0x14e')]=function(_0x6895c6){return Promise[_0x2964('0xa3')]()[_0x2964('0x3e')](voiceQueueRt[_0x2964('0x14e')](_0x6895c6))[_0x2964('0x98')](loggerCatch(_0x2964('0x14f')));};Dialer['prototype'][_0x2964('0xbb')]=function(_0x21ae22){if(!_[_0x2964('0x52')](_0x21ae22)&&_0x21ae22!==null){if(typeof _0x21ae22[_0x2964('0x7a')]!==_0x2964('0xa1')){if(_0x21ae22[_0x2964('0x7a')]>0x0){_0x21ae22[_0x2964('0x7a')]-=0x1;}else{logger[_0x2964('0x60')](_0x2964('0x150'));}}}else{logger[_0x2964('0x60')](_0x2964('0x151'));}};Dialer['prototype'][_0x2964('0x152')]=function(_0x43d9fb,_0x30284a){var _0x1ce30a=this;return function(_0x3c7f6f){_0x1ce30a[_0x2964('0xbb')](_0x30284a);logger[_0x2964('0x60')](_0x43d9fb,util['inspect'](_0x3c7f6f,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x2964('0x153')]=function(_0x1cecd1,_0x2487d8,_0x3ee071){var _0x452bba={'state':0x19,'statedesc':_0x2964('0x154')};this[_0x2964('0xbb')](_0x2487d8);this[_0x2964('0x155')](_[_0x2964('0x5b')](_0x452bba,_[_0x2964('0x70')](_0x3ee071,[_0x2964('0xd6'),_0x2964('0xe3'),'UserId',_0x2964('0xd7'),_0x2964('0xe4')])),'[emptyContact][createHistory]',_0x2964('0x156'));logger[_0x2964('0x60')](_0x1cecd1);};Dialer['prototype'][_0x2964('0x155')]=function(_0x63bcbe,_0x43e2d6,_0xa69deb){hopperUtils[_0x2964('0xc4')](_0x63bcbe)[_0x2964('0x98')](loggerCatch(_0x43e2d6));hopperUtils[_0x2964('0x12c')](_0x63bcbe)[_0x2964('0x98')](loggerCatch(_0xa69deb));};Dialer[_0x2964('0x87')][_0x2964('0xd3')]=function(_0x55e052,_0x4a8bfe){hopperUtils['createHistory'](_0x55e052)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x4a8bfe==0x0){hopperUtils['moveContactManagedDialer'](_0x55e052)[_0x2964('0x98')](loggerCatch(_0x2964('0x157')));}};Dialer[_0x2964('0x87')][_0x2964('0x148')]=function(_0x3d40e2){return Promise[_0x2964('0xa3')]()['then'](cmHopper[_0x2964('0x143')](_0x3d40e2['id'],previewRecallmeReminderInterval))[_0x2964('0x3e')](function(_0x188eb0){for(var _0x4bc257=0x0;_0x4bc257<_0x188eb0[_0x2964('0x142')];_0x4bc257++){var _0x408bc2=_0x188eb0[_0x4bc257][_0x2964('0x145')][_0x2964('0x46')];if(_0x408bc2)io['to'](util[_0x2964('0x45')](_0x2964('0x146'),_0x408bc2))[_0x2964('0x40')](_0x2964('0x147'),{'hopper':_0x188eb0[_0x4bc257]});}})[_0x2964('0x98')](function(){});};Dialer['prototype'][_0x2964('0x158')]=function(_0x116c28){var _0x762ed9=this;return function(){_0x762ed9[_0x2964('0x159')](_0x116c28);};};Dialer[_0x2964('0x87')]['actionOriginate']=function(_0x997ecb,_0x31ef6b){var _0x1a1f38=this;var _0x13e386=uuid['v4']();this[_0x2964('0x25')][_0x13e386]=new Action(_0x997ecb,_0x31ef6b,_0x13e386);return new Promise(function(_0x53c86b,_0xb2d283){if(_[_0x2964('0x52')](_0x997ecb)&&typeof _0x997ecb!=='object'){return _0xb2d283(msgResponse('originate',_0x2964('0x8d'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x31ef6b[_0x2964('0x15a')])||_0x31ef6b[_0x2964('0x15a')]===null){return _0xb2d283(msgResponse(_0x2964('0x15b'),_0x2964('0x8d'),_0x2964('0x15c')));}var _0x5438c8={'XMD-CALLERID':_0x1a1f38[_0x2964('0x25')][_0x13e386][_0x2964('0x15d')](),'XMD-AGI':_0x997ecb[_0x2964('0x12d')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x997ecb['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x997ecb[_0x2964('0xc2')]?util['format'](_0x2964('0x15e'),ipAgi,_0x997ecb['dialQueueProject2']):_0x2964('0x15f'),'XMD-QUEUE':utils[_0x2964('0x160')](_0x997ecb)?util['format'](_0x2964('0x161'),_0x997ecb['name'],_0x997ecb[_0x2964('0x162')]||'',_0x997ecb[_0x2964('0xc3')]?'c':'',_0x997ecb['dialQueueTimeout']||0x3):_0x2964('0x15f'),'XMD-CONTACTID':_0x31ef6b[_0x2964('0xd6')],'XMD-CDRTYPE':_0x2964('0x163'),'CALLERID(all)':_0x1a1f38[_0x2964('0x25')][_0x13e386][_0x2964('0x15d')](),'XMD-AMD':_0x997ecb[_0x2964('0x113')]?'ACTIVE':_0x2964('0x15f'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x997ecb['dialAMDActive']){_0x5438c8['XMD-AMDINITIALSILENCE']=_0x997ecb['dialAMDInitialSilence']||0x9c4;_0x5438c8[_0x2964('0x164')]=_0x997ecb[_0x2964('0x165')]||0x5dc;_0x5438c8['XMD-AMDAFTERGREETINGSILENCE']=_0x997ecb[_0x2964('0x166')]||0x320;_0x5438c8[_0x2964('0x167')]=_0x997ecb[_0x2964('0x168')]||0x1388;_0x5438c8['XMD-AMDMINWORDLENGTH']=_0x997ecb[_0x2964('0x169')]||0x64;_0x5438c8['XMD-AMDBETWEENWORDSSILENCE']=_0x997ecb[_0x2964('0x16a')]||0x32;_0x5438c8[_0x2964('0x16b')]=_0x997ecb[_0x2964('0x16c')]||0x3;_0x5438c8[_0x2964('0x16d')]=_0x997ecb['dialAMDSilenceThreshold']||0x100;_0x5438c8[_0x2964('0x16e')]=_0x997ecb[_0x2964('0x16f')]||0x1388;}if(utils['isOutboundQueue'](_0x997ecb)){_0x5438c8[_0x2964('0x170')]=_0x31ef6b[_0x2964('0xd7')];}else{_0x5438c8[_0x2964('0x171')]=_0x31ef6b[_0x2964('0xe4')];}for(var _0x278d12 in _0x31ef6b[_0x2964('0x172')]){if(typeof _0x31ef6b[_0x2964('0x172')][_0x278d12]!==_0x2964('0xa1')){if(isNotNull(_0x31ef6b[_0x2964('0x172')][_0x278d12])&&_0x278d12!=='id'&&_0x278d12!==_0x2964('0x173')&&_0x278d12!==_0x2964('0x174')&&_0x278d12!==_0x2964('0x175')){_0x5438c8[util[_0x2964('0x45')]('%s%s',_0x2964('0x176'),_[_0x2964('0x177')](_0x278d12))]=_0x31ef6b['Contact'][_0x278d12];}}}var _0x234e29=_0x1a1f38[_0x2964('0x82')](_0x997ecb[_0x2964('0x88')])?utils[_0x2964('0x178')](_0x997ecb['Trunk'][_0x2964('0x179')],_0x997ecb[_0x2964('0x17a')],_0x997ecb[_0x2964('0x17b')]>0x0?utils[_0x2964('0x17c')](_0x997ecb[_0x2964('0x17d')],_0x997ecb[_0x2964('0x17b')]):_0x997ecb[_0x2964('0x17d')]):utils[_0x2964('0x178')](_[_0x2964('0xf0')](_0x997ecb[_0x2964('0x89')])?_0x997ecb['Trunk']['callerid']:_0x997ecb[_0x2964('0x89')]['callerid'],_0x997ecb[_0x2964('0x17a')],_0x997ecb[_0x2964('0x17b')]>0x0?utils[_0x2964('0x17c')](_0x997ecb[_0x2964('0x17d')],_0x997ecb[_0x2964('0x17b')]):_0x997ecb[_0x2964('0x17d')]);if(_0x234e29){_0x5438c8['XMD-ORIGINATECALLERIDNAME']=_0x1a1f38['actions'][_0x13e386][_0x2964('0x17e')]=utils[_0x2964('0x17f')](_0x234e29);_0x5438c8[_0x2964('0x180')]=_0x31ef6b[_0x2964('0x15a')];}_0x997ecb[_0x2964('0x181')]=_0x5438c8;return ami['Action']({'actionid':_0x13e386,'action':_0x2964('0x15b'),'channel':_0x1a1f38[_0x2964('0x82')](_0x997ecb[_0x2964('0x88')])?util['format'](_0x2964('0x182'),_0x997ecb[_0x2964('0x88')]['name'],isNotNull(_0x997ecb['dialPrefix'])?_0x997ecb[_0x2964('0x183')][_0x2964('0x184')]()||'':'',_0x997ecb[_0x2964('0x185')]>0x0?_0x31ef6b[_0x2964('0x15a')]['substring'](_0x997ecb[_0x2964('0x185')]):_0x31ef6b[_0x2964('0x15a')]):util[_0x2964('0x45')]('SIP/%s/%s%s',_[_0x2964('0xf0')](_0x997ecb[_0x2964('0x89')])?_0x997ecb[_0x2964('0x88')][_0x2964('0x46')]:_0x997ecb[_0x2964('0x89')]['name'],isNotNull(_0x997ecb[_0x2964('0x183')])?_0x997ecb[_0x2964('0x183')][_0x2964('0x184')]()||'':'',_0x997ecb['dialCutDigit']>0x0?_0x31ef6b[_0x2964('0x15a')][_0x2964('0x186')](_0x997ecb[_0x2964('0x185')]):_0x31ef6b[_0x2964('0x15a')]),'callerid':_0x234e29,'Exten':_0x2964('0x109'),'Context':_0x2964('0x187'),'Priority':'1','variable':_0x5438c8,'timeout':(_0x997ecb[_0x2964('0x188')]||0x1e)*0x3e8,'async':!![],'channelid':_0x13e386})[_0x2964('0x3e')](function(_0x121178){return _0x53c86b(_0x121178);})['catch'](function(_0x40ee63){_0x997ecb[_0x2964('0x189')]+=0x1;var _0x119c58=new History(_0x1a1f38[_0x2964('0x25')][_0x13e386]);logger[_0x2964('0x60')](util['format'](_0x2964('0x18a'),JSON[_0x2964('0x81')](_0x40ee63)));_0x119c58['state']=0xe;_0x119c58[_0x2964('0xc9')]=_0x2964('0x18b');_0x119c58[_0x2964('0x6c')]=moment()[_0x2964('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x119c58[_0x2964('0x6b')]=_0x119c58[_0x2964('0x6c')];hopperUtils['createHistory'](_0x119c58)[_0x2964('0x98')](loggerCatch(_0x2964('0x18c')));_0x1a1f38[_0x2964('0x12c')](_0x119c58)[_0x2964('0x98')](loggerCatch('[originate][error]'))[_0x2964('0x1e')](function(){delete _0x1a1f38[_0x2964('0x25')][_0x13e386];return _0xb2d283(msgResponse('originate','Error',_0x2964('0x18d')));});});});};Dialer['prototype'][_0x2964('0x18e')]=function(_0xfbd2e9,_0x4382b3,_0x3e034f){var _0x34a4ef=new History(_0x4382b3);if(_0x34a4ef['countbusyretry']+_0x34a4ef['countcongestionretry']+_0x34a4ef['countnoanswerretry']+_0x34a4ef[_0x2964('0x11d')]+_0x34a4ef[_0x2964('0xd1')]+_0x34a4ef[_0x2964('0xdf')]+_0x34a4ef[_0x2964('0x11e')]+_0x34a4ef[_0x2964('0x11f')]>=_0x3e034f[_0x2964('0x128')]-0x1){return!![];}switch(_0xfbd2e9){case 0x3:if(_0x34a4ef[_0x2964('0x11c')]>=_0x3e034f[_0x2964('0x18f')]-0x1){return!![];}hopperUtils[_0x2964('0xf4')]({'active':![],'countnoanswerretry':_0x34a4ef[_0x2964('0x11c')]+=0x1,'scheduledat':moment()[_0x2964('0xd4')](_0x3e034f[_0x2964('0x190')],'minutes')['format'](_0x2964('0xbe')),'ContactId':_0x34a4ef[_0x2964('0xd6')],'ListId':_0x34a4ef['ListId'],'VoiceQueueId':_0x34a4ef[_0x2964('0xd7')]||undefined,'CampaignId':_0x34a4ef[_0x2964('0xe4')]||undefined})[_0x2964('0x98')](loggerCatch(_0x2964('0x191')));break;case 0x5:if(_0x34a4ef[_0x2964('0x11a')]>=_0x3e034f['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x2964('0xf4')]({'active':![],'countbusyretry':_0x34a4ef['countbusyretry']+=0x1,'scheduledat':moment()[_0x2964('0xd4')](_0x3e034f['dialBusyRetryFrequency'],_0x2964('0xd5'))['format'](_0x2964('0xbe')),'ContactId':_0x34a4ef[_0x2964('0xd6')],'ListId':_0x34a4ef[_0x2964('0xe3')],'VoiceQueueId':_0x34a4ef['VoiceQueueId']||undefined,'CampaignId':_0x34a4ef[_0x2964('0xe4')]||undefined})[_0x2964('0x98')](loggerCatch(_0x2964('0x192')));break;case 0x8:if(_0x34a4ef[_0x2964('0x11b')]>=_0x3e034f[_0x2964('0x193')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x34a4ef[_0x2964('0x11b')]+=0x1,'scheduledat':moment()[_0x2964('0xd4')](_0x3e034f[_0x2964('0x194')],_0x2964('0xd5'))[_0x2964('0x45')](_0x2964('0xbe')),'ContactId':_0x34a4ef[_0x2964('0xd6')],'ListId':_0x34a4ef[_0x2964('0xe3')],'VoiceQueueId':_0x34a4ef[_0x2964('0xd7')]||undefined,'CampaignId':_0x34a4ef[_0x2964('0xe4')]||undefined})[_0x2964('0x98')](loggerCatch(_0x2964('0x195')));break;case 0x0:if(_0x34a4ef[_0x2964('0x11d')]>=_0x3e034f[_0x2964('0x196')]-0x1){return!![];}else{hopperUtils[_0x2964('0xf4')]({'active':![],'countnosuchnumberretry':_0x34a4ef[_0x2964('0x11d')]+=0x1,'scheduledat':moment()[_0x2964('0xd4')](_0x3e034f[_0x2964('0x197')],_0x2964('0xd5'))[_0x2964('0x45')](_0x2964('0xbe')),'ContactId':_0x34a4ef[_0x2964('0xd6')],'ListId':_0x34a4ef[_0x2964('0xe3')],'VoiceQueueId':_0x34a4ef['VoiceQueueId']||undefined,'CampaignId':_0x34a4ef[_0x2964('0xe4')]||undefined})[_0x2964('0x98')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x34a4ef[_0x2964('0xd1')]>=_0x3e034f[_0x2964('0xd2')]-0x1){return!![];}hopperUtils[_0x2964('0xf4')]({'active':![],'countdropretry':_0x34a4ef[_0x2964('0xd1')]+=0x1,'scheduledat':moment()[_0x2964('0xd4')](_0x3e034f['dialDropRetryFrequency'],_0x2964('0xd5'))[_0x2964('0x45')](_0x2964('0xbe')),'ContactId':_0x34a4ef[_0x2964('0xd6')],'ListId':_0x34a4ef[_0x2964('0xe3')],'VoiceQueueId':_0x34a4ef[_0x2964('0xd7')]||undefined,'CampaignId':_0x34a4ef[_0x2964('0xe4')]||undefined})[_0x2964('0x98')](loggerCatch(_0x2964('0xd8')));break;case 0xb:if(_0x34a4ef[_0x2964('0xdf')]>=_0x3e034f[_0x2964('0xe2')]-0x1){return!![];}hopperUtils[_0x2964('0xf4')]({'active':![],'countabandonedretry':_0x34a4ef['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x3e034f[_0x2964('0xe0')],'minutes')[_0x2964('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x34a4ef[_0x2964('0xd6')],'ListId':_0x34a4ef[_0x2964('0xe3')],'VoiceQueueId':_0x34a4ef[_0x2964('0xd7')]||undefined,'CampaignId':_0x34a4ef[_0x2964('0xe4')]||undefined})['catch'](loggerCatch(_0x2964('0xe5')));break;case 0x13:if(_0x34a4ef['countmachineretry']>=_0x3e034f[_0x2964('0x122')]-0x1){return!![];}hopperUtils[_0x2964('0xf4')]({'active':![],'countmachineretry':_0x34a4ef[_0x2964('0x11e')]+=0x1,'scheduledat':moment()[_0x2964('0xd4')](_0x3e034f[_0x2964('0x124')],'minutes')[_0x2964('0x45')](_0x2964('0xbe')),'ContactId':_0x34a4ef['ContactId'],'ListId':_0x34a4ef[_0x2964('0xe3')],'VoiceQueueId':_0x34a4ef[_0x2964('0xd7')]||undefined,'CampaignId':_0x34a4ef[_0x2964('0xe4')]||undefined})[_0x2964('0x98')](loggerCatch(_0x2964('0x125')));break;case 0x14:if(_0x34a4ef['countagentrejectretry']>=_0x3e034f[_0x2964('0x198')]-0x1){return!![];}hopperUtils[_0x2964('0xf4')]({'active':![],'countagentrejectretry':_0x34a4ef[_0x2964('0x11f')]+=0x1,'scheduledat':moment()[_0x2964('0xd4')](_0x3e034f[_0x2964('0x199')],_0x2964('0xd5'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x34a4ef[_0x2964('0xd6')],'ListId':_0x34a4ef[_0x2964('0xe3')],'VoiceQueueId':_0x34a4ef[_0x2964('0xd7')]||undefined,'CampaignId':_0x34a4ef[_0x2964('0xe4')]||undefined})[_0x2964('0x98')](loggerCatch(_0x2964('0x19a')));break;default:return!![];}};Dialer['prototype'][_0x2964('0x105')]=function(_0x5d4046,_0x2b3999,_0x179619){var _0x37c7db=this;var _0x1f3509=new History(_0x5d4046);var _0x1527fe=![];var _0x258fcd;var _0x36407f;return new Promise(function(_0x3ff685,_0x10a0ed){if(_[_0x2964('0x52')](_0x2b3999)&&typeof _0x2b3999!=='object'){return _0x10a0ed(msgResponse(_0x2964('0x19b'),_0x2964('0x8d'),_0x2964('0x19c')));}if(_[_0x2964('0x52')](_0x179619)&&typeof _0x179619!==_0x2964('0x19d')){return _0x10a0ed(msgResponse(_0x2964('0x19b'),'Failure',_0x2964('0x19e')));}hopperUtils[_0x2964('0xce')](_0x1f3509,_0x179619[_0x2964('0xbf')],_0x2b3999)[_0x2964('0x3e')](function(_0x4ba7c2){if(_0x4ba7c2[_0x2964('0xd0')]==0x1)_0x1527fe=!![];switch(_0x179619[_0x2964('0xbf')]){case'0':_0x2b3999['outboundNoSuchCallsDay']+=0x1;_0x1f3509[_0x2964('0x6a')]=0x0;_0x1f3509[_0x2964('0xc9')]='NoSuchNumber';_0x1f3509[_0x2964('0x11d')]+=0x1;_0x1f3509[_0x2964('0xcc')]+=0x1;ami['emit'](_0x2964('0x19f'),ut[_0x2964('0x110')](_0x5d4046,_0x2964('0x1a0')));_0x258fcd=_0x2b3999['dialNoSuchNumberRetryFrequency'];_0x36407f=_0x2b3999[_0x2964('0xe1')];hopperUtils[_0x2964('0xc4')](_0x1f3509)[_0x2964('0x98')](loggerCatch(_0x2964('0x119')));if(_0x37c7db['checkRetriveMax'](0x0,_0x5d4046,_0x2b3999)&&!_0x1527fe){if(_0x1f3509[_0x2964('0x11d')]>=_0x2b3999['dialNoSuchNumberMaxRetry']){_0x37c7db[_0x2964('0x129')](_0x1f3509,_0x3ff685,_0x10a0ed,_0x2964('0x1a1'));}else{_0x37c7db[_0x2964('0x120')](_0x1f3509,_0x3ff685,_0x10a0ed,_0x2964('0x1a1'));}}break;case'3':_0x2b3999[_0x2964('0x1a2')]+=0x1;_0x1f3509[_0x2964('0x6a')]=0x3;_0x1f3509[_0x2964('0xc9')]=_0x2964('0x1a3');_0x1f3509[_0x2964('0x11c')]+=0x1;_0x1f3509[_0x2964('0xcc')]+=0x1;var _0x5d5e9c=ut['buildNoAnswerEventPayload'](_0x5d4046,_0x2b3999);ami[_0x2964('0x40')](_0x2964('0x1a4'),_0x5d5e9c);_0x258fcd=_0x2b3999[_0x2964('0x190')];_0x36407f=_0x2b3999[_0x2964('0xe1')];hopperUtils['createHistory'](_0x1f3509)[_0x2964('0x98')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x37c7db[_0x2964('0x18e')](0x3,_0x5d4046,_0x2b3999)&&!_0x1527fe){if(_0x1f3509['countnoanswerretry']>=_0x2b3999[_0x2964('0x18f')]){_0x37c7db[_0x2964('0x129')](_0x1f3509,_0x3ff685,_0x10a0ed,_0x2964('0x1a5'));}else{_0x37c7db[_0x2964('0x120')](_0x1f3509,_0x3ff685,_0x10a0ed,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x2b3999[_0x2964('0x1a6')]+=0x1;_0x1f3509[_0x2964('0x6a')]=0x5;_0x1f3509[_0x2964('0xc9')]='Busy';_0x1f3509[_0x2964('0x11a')]+=0x1;_0x1f3509[_0x2964('0xcc')]+=0x1;ami[_0x2964('0x40')]('custom:agentbusy',ut[_0x2964('0x110')](_0x5d4046,'busy'));_0x258fcd=_0x2b3999[_0x2964('0x1a7')];_0x36407f=_0x2b3999['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x1f3509)[_0x2964('0x98')](loggerCatch(_0x2964('0x1a8')));if(_0x37c7db[_0x2964('0x18e')](0x5,_0x5d4046,_0x2b3999)&&!_0x1527fe){if(_0x1f3509['countbusyretry']>=_0x2b3999[_0x2964('0x1a9')]){_0x37c7db[_0x2964('0x129')](_0x1f3509,_0x3ff685,_0x10a0ed,_0x2964('0x1aa'));}else{_0x37c7db[_0x2964('0x120')](_0x1f3509,_0x3ff685,_0x10a0ed,_0x2964('0x1aa'));}}break;case'8':_0x2b3999[_0x2964('0x1ab')]+=0x1;_0x1f3509[_0x2964('0x6a')]=0x8;_0x1f3509[_0x2964('0xc9')]=_0x2964('0x1ac');_0x1f3509[_0x2964('0x11b')]+=0x1;_0x1f3509[_0x2964('0xcc')]+=0x1;_0x258fcd=_0x2b3999[_0x2964('0x194')];_0x36407f=_0x2b3999['callAdditionalPhoneAfterMin'];ami['emit'](_0x2964('0x1ad'),ut[_0x2964('0x110')](_0x5d4046,_0x2964('0x1ae')));hopperUtils[_0x2964('0xc4')](_0x1f3509)['catch'](loggerCatch(_0x2964('0x1af')));if(_0x37c7db['checkRetriveMax'](0x8,_0x5d4046,_0x2b3999)&&!_0x1527fe){if(_0x1f3509['countcongestionretry']>=_0x2b3999['dialCongestionMaxRetry']){_0x37c7db[_0x2964('0x129')](_0x1f3509,_0x3ff685,_0x10a0ed,_0x2964('0x1b0'));}else{_0x37c7db[_0x2964('0x120')](_0x1f3509,_0x3ff685,_0x10a0ed,_0x2964('0x1b0'));}}break;case'11':_0x2b3999[_0x2964('0x1b1')]+=0x1;_0x1f3509[_0x2964('0x6a')]=0xb;_0x1f3509[_0x2964('0xc9')]=_0x2964('0x1b2');_0x1f3509[_0x2964('0xdf')]+=0x1;_0x1f3509[_0x2964('0xcc')]+=0x1;_0x258fcd=_0x2b3999[_0x2964('0xe0')];_0x36407f=_0x2b3999[_0x2964('0xe1')];hopperUtils[_0x2964('0xc4')](_0x1f3509)['catch'](loggerCatch(_0x2964('0xe6')));if(_0x37c7db['checkRetriveMax'](0xb,_0x5d4046,_0x2b3999)&&!_0x1527fe){if(_0x1f3509[_0x2964('0xdf')]>=_0x2b3999[_0x2964('0xe2')]){_0x37c7db[_0x2964('0x129')](_0x1f3509,_0x3ff685,_0x10a0ed,'reason\x2011\x20abandoned');}else{_0x37c7db['stateGlobal'](_0x1f3509,_0x3ff685,_0x10a0ed,'reason\x2011\x20abandoned');}}break;case'20':_0x2b3999[_0x2964('0x1b3')]+=0x1;_0x1f3509[_0x2964('0x6a')]=0x14;_0x1f3509[_0x2964('0xc9')]=_0x2964('0x1b4');_0x1f3509[_0x2964('0x11f')]+=0x1;_0x1f3509[_0x2964('0xcc')]+=0x1;_0x258fcd=_0x2b3999['dialAgentRejectRetryFrequency'];_0x36407f=_0x2b3999[_0x2964('0xe1')];ami[_0x2964('0x40')]('custom:agentreject',ut[_0x2964('0x110')](_0x5d4046,_0x2964('0x1b5')));hopperUtils['createHistory'](_0x1f3509)['catch'](loggerCatch(_0x2964('0x1b6')));if(_0x37c7db[_0x2964('0x18e')](0x14,_0x5d4046,_0x2b3999)&&!_0x1527fe){if(_0x1f3509[_0x2964('0x11f')]>=_0x2b3999[_0x2964('0x198')]){_0x37c7db[_0x2964('0x129')](_0x1f3509,_0x3ff685,_0x10a0ed,'reason\x2020\x20agentreject');}else{_0x37c7db[_0x2964('0x120')](_0x1f3509,_0x3ff685,_0x10a0ed,_0x2964('0x1b7'));}}break;default:_0x2b3999[_0x2964('0x12f')]+=0x1;_0x1f3509[_0x2964('0x6a')]=0xc;_0x1f3509[_0x2964('0xc9')]=_0x179619[_0x2964('0xbf')];_0x258fcd=_0x2b3999[_0x2964('0x199')];_0x36407f=_0x2b3999[_0x2964('0xe1')];hopperUtils['createHistory'](_0x1f3509)[_0x2964('0x98')](loggerCatch(_0x2964('0x1b8')));if(_0x37c7db['checkRetriveMax'](_0x179619[_0x2964('0xbf')],_0x5d4046,_0x2b3999)&&!_0x1527fe){if(_0x1f3509[_0x2964('0x11a')]+_0x1f3509[_0x2964('0x11b')]+_0x1f3509['countnoanswerretry']+_0x1f3509[_0x2964('0x11d')]+_0x1f3509[_0x2964('0xd1')]+_0x1f3509[_0x2964('0xdf')]+_0x1f3509[_0x2964('0x11e')]+_0x1f3509[_0x2964('0x11f')]>=_0x2b3999['dialGlobalMaxRetry']){_0x37c7db[_0x2964('0x120')](_0x1f3509,_0x3ff685,_0x10a0ed,_0x179619[_0x2964('0xbf')]);}else{_0x37c7db[_0x2964('0x129')](_0x1f3509,_0x3ff685,_0x10a0ed,_0x179619[_0x2964('0xbf')]);}}}})['then'](function(){if(_0x1527fe){hopperUtils[_0x2964('0xe7')](_0x1f3509,_0x258fcd,_0x36407f)[_0x2964('0x3e')](function(){return _0x3ff685(0x1);});}});});};Dialer['prototype'][_0x2964('0x120')]=function(_0x5f37b0,_0xdf5382,_0x26e348,_0x4d2e7a){var _0x2b6179=new Final(_0x5f37b0);_0x2b6179[_0x2964('0x6a')]=0xf;_0x2b6179['statedesc']='Global';this[_0x2964('0x129')](_0x2b6179,_0xdf5382,_0x26e348,_0x4d2e7a);};Dialer['prototype'][_0x2964('0x129')]=function(_0xfd2479,_0x724f3,_0x1308af,_0x39e4b8){hopperUtils['moveContactManagedDialer'](_0xfd2479)[_0x2964('0x3e')](function(){return _0x724f3(msgResponse(_0x2964('0x19b'),'Success',_0x39e4b8));})[_0x2964('0x98')](function(){return _0x1308af(msgResponse(_0x2964('0x1b9'),_0x2964('0x8d'),'contact\x20not\x20moved'));});};Dialer['prototype']['predictive']=function(_0x22b8b8){var _0x617fd4=_0x22b8b8[_0x2964('0x1ba')]/0x64;var _0x2fc365=_0x22b8b8[_0x2964('0xc8')]/(_0x22b8b8[_0x2964('0xc8')]+_0x22b8b8['outboundAnswerCallsDay']);var _0x5dd5e3=Math[_0x2964('0x1bb')](_0x22b8b8['predictiveIntervalAvailable']*(_0x22b8b8[_0x2964('0x1bc')]/0x64));var _0xe5b14d=Math[_0x2964('0x1bb')](_0x22b8b8[_0x2964('0x1bd')]*(_0x22b8b8['predictiveIntervalMinThreshold']/0x64));var _0x2df46c=_0x22b8b8['available']+_0x22b8b8[_0x2964('0x1be')];var _0x151606=Math[_0x2964('0x1bf')](_0x22b8b8[_0x2964('0x1c0')]*_0x22b8b8[_0x2964('0x58')]*_0x22b8b8[_0x2964('0x1c1')]*_0x22b8b8[_0x2964('0x1c2')]);if(_[_0x2964('0x52')](_0x22b8b8[_0x2964('0x2a')])){if(!_[_0x2964('0x52')](_0x22b8b8['startPredictive'])){_0x22b8b8['startPredictive']=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x2964('0x1c3'));}if(!_[_0x2964('0x52')](_0x22b8b8[_0x2964('0x5f')])){loggerPredictive[_0x2964('0x60')]('[startMethodPredictive][StartProgressive]',_0x2964('0x1c4'));clearInterval(_0x22b8b8[_0x2964('0x5f')]);_0x22b8b8['handlePredictive']=undefined;}_0x22b8b8[_0x2964('0x2a')]=moment()['format'](_0x2964('0xbe'));loggerPredictive[_0x2964('0x48')](_0x22b8b8['name'],_0x2964('0x1c5'),_0x22b8b8[_0x2964('0x2a')]);this[_0x2964('0xab')](_0x22b8b8,0x1);}else if(ifInterval(_0x22b8b8[_0x2964('0x1c6')],_0x22b8b8[_0x2964('0x2a')])){this[_0x2964('0xab')](_0x22b8b8,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x22b8b8['startProgressive'],_0x22b8b8['name']);_0x22b8b8['erlangCalls']=0x0;_0x22b8b8[_0x2964('0x1c7')]=0x0;}else if(_0x617fd4<_0x2fc365&&_0x22b8b8['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x22b8b8);loggerPredictive[_0x2964('0x48')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x2fc365,_0x2964('0x2a'),_0x22b8b8['name']);}else if(_0x151606<_0x22b8b8[_0x2964('0x1c7')]&&_0x22b8b8[_0x2964('0x1c8')]===_0x2964('0x1c9')){clearPredictiveAttributes(_0x22b8b8);loggerPredictive['info'](_0x2964('0x1ca'),_0x2964('0x1cb'),_0x151606,_0x2964('0x1cc'),_0x22b8b8[_0x2964('0x1c7')],_0x2964('0x2a'),_0x22b8b8['name']);}else if(!ifInterval(_0x22b8b8['dialPredictiveInterval'],_0x22b8b8[_0x2964('0x2a')])&&_[_0x2964('0x52')](_0x22b8b8[_0x2964('0x29')])&&!_['isUndefined'](_0x22b8b8[_0x2964('0x2a')])){_0x22b8b8[_0x2964('0x29')]=moment()[_0x2964('0x45')](_0x2964('0xbe'));loggerPredictive[_0x2964('0x48')](_0x22b8b8[_0x2964('0x46')],_0x2964('0x1cd'),_0x22b8b8[_0x2964('0x29')]);hopperUtils['avgHandleTime'](_0x22b8b8[_0x2964('0x1c6')])[_0x2964('0x3e')](this[_0x2964('0x1ce')](_0x22b8b8))[_0x2964('0x3e')](mergeDataErlangB(_0x22b8b8))[_0x2964('0x3e')](this[_0x2964('0x1cf')](_0x22b8b8))['catch'](loggerCatchPredictive(_0x2964('0x1d0'),_0x22b8b8));}else if(!ifInterval(_0x22b8b8[_0x2964('0x1c6')],_0x22b8b8[_0x2964('0x29')])){_0x22b8b8[_0x2964('0x1c7')]=0x0;_0x22b8b8[_0x2964('0x29')]=moment()[_0x2964('0x45')](_0x2964('0xbe'));loggerPredictive[_0x2964('0x48')](_0x22b8b8[_0x2964('0x46')],_0x2964('0x1d1'),_0x22b8b8['startPredictive']);clearInterval(_0x22b8b8[_0x2964('0x5f')]);_0x22b8b8[_0x2964('0x5f')]=undefined;hopperUtils[_0x2964('0x1d2')](_0x22b8b8['dialPredictiveInterval'])['then'](this[_0x2964('0x1ce')](_0x22b8b8))['then'](mergeDataErlangB(_0x22b8b8))[_0x2964('0x3e')](this['startMethodPredictive'](_0x22b8b8))['catch'](loggerCatchPredictive(_0x2964('0x1d3'),_0x22b8b8));}else if(_0x22b8b8['predictiveIntervalAvailable']&&_0x2df46c<_0x22b8b8[_0x2964('0x1bd')]-_0xe5b14d){clearPredictiveAttributes(_0x22b8b8);loggerPredictive[_0x2964('0x48')](_0x22b8b8[_0x2964('0x46')],_0x2964('0x1d4'),_0x2df46c,_0x2964('0x1d5'),_0x22b8b8[_0x2964('0x1bd')],'-',_0xe5b14d,'=',_0x22b8b8[_0x2964('0x1bd')]-_0xe5b14d,')');}else if(_0x22b8b8['predictiveIntervalAvailable']&&_0x2df46c>_0x22b8b8[_0x2964('0x1bd')]+_0x5dd5e3){clearPredictiveAttributes(_0x22b8b8);loggerPredictive['info'](_0x22b8b8[_0x2964('0x46')],_0x2964('0x1d4'),_0x2df46c,_0x2964('0x1d6'),_0x22b8b8[_0x2964('0x1bd')],'+',_0x5dd5e3,'=',_0x22b8b8['predictiveIntervalAvailable']+_0x5dd5e3,')');}};Dialer[_0x2964('0x87')][_0x2964('0x1ce')]=function(_0x5e7f60){var _0x18dc6d=this;return function(_0x297aad){return new Promise(function(_0xb78dc6,_0x5d4e1a){_['merge'](_0x5e7f60,_0x297aad[0x0]);if(checkGetDataPredictive(_0x297aad[0x0])){var _0x1cee0e=_0x5e7f60['predictiveIntervalAvailable']=_0x5e7f60['talking']+_0x5e7f60[_0x2964('0x136')];var _0x23385e=_0x5e7f60['dialPredictiveInterval']*0x3c;var _0x103d04=_0x297aad[0x0][_0x2964('0x4f')]+_0x297aad[0x0]['predictiveIntervalAvgHoldtime'];var _0x43e4ee=(_0x297aad[0x0][_0x2964('0x1d7')]+_0x297aad[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x297aad[0x0][_0x2964('0xdc')])/_0x297aad[0x0][_0x2964('0x51')];_0x5e7f60[_0x2964('0x1c1')]=_0x43e4ee>0x0?_0x43e4ee:0x1;switch(_0x5e7f60[_0x2964('0x1c8')]){case _0x2964('0x1c9'):var _0x1a780c=_0x5e7f60['dialPredictiveOptimizationPercentage']/0x64;return _0x18dc6d[_0x2964('0x1d8')](_0x1cee0e,_0x23385e,_0x103d04,_0x43e4ee,_0x1a780c)[_0x2964('0x3e')](function(_0x1a6ebf){return _0xb78dc6(_0x1a6ebf);});case _0x2964('0x1d9'):var _0x366664=_0x5e7f60[_0x2964('0x1ba')]/0x64;return _0x18dc6d[_0x2964('0x1da')](_0x1cee0e,_0x23385e,_0x103d04,_0x43e4ee,_0x366664)[_0x2964('0x3e')](function(_0x389d7a){return _0xb78dc6(_0x389d7a);});default:return _0x5d4e1a(msgResponse(_0x2964('0x1db'),_0x2964('0x8d'),'Unknown\x20Predictive'));}}else{return _0x5d4e1a(msgResponse(_0x2964('0x1db'),'Failure',_0x2964('0x1dc')));}});};};Dialer[_0x2964('0x87')][_0x2964('0x1dd')]=function(_0x55941a){var _0x35af55=this;return function(_0x54d47d){return new Promise(function(_0x3484aa,_0x4d8f8a){_['merge'](_0x55941a,_0x54d47d[0x0]);if(checkGetDataPredictive(_0x54d47d[0x0])){loggerPredictive[_0x2964('0x48')](JSON['stringify'](_0x54d47d[0x0]));if(_0x55941a['dialPredictiveOptimization']===_0x2964('0x1c9')){return _0x35af55[_0x2964('0x14e')](_0x55941a['id'])[_0x2964('0x3e')](function(_0x1093a4){var _0x2c0a42=_0x55941a[_0x2964('0x1de')]-_0x1093a4[0x0][_0x2964('0x1df')];var _0x124fe5=_0x55941a['dialPredictiveInterval']*0x3c;var _0x1e55a6=_0x54d47d[0x0][_0x2964('0x4f')]+_0x54d47d[0x0][_0x2964('0x4d')];var _0x44ef8d=(_0x54d47d[0x0][_0x2964('0x1d7')]+_0x54d47d[0x0][_0x2964('0x4b')]+_0x54d47d[0x0][_0x2964('0xdc')])/_0x54d47d[0x0][_0x2964('0x51')];var _0x3dd4c4=_0x55941a[_0x2964('0x1ba')]/0x64;_0x55941a[_0x2964('0x1e0')]=_0x1093a4[0x0][_0x2964('0x1df')]||0x0;_0x55941a[_0x2964('0x1c1')]=_0x44ef8d>0x0?_0x44ef8d:0x1;return _0x35af55[_0x2964('0x1d8')](_0x2c0a42,_0x124fe5,_0x1e55a6,_0x44ef8d,_0x3dd4c4);})[_0x2964('0x3e')](function(_0x919681){return _0x3484aa(_0x919681);})[_0x2964('0x98')](function(_0x19ffbe){return _0x4d8f8a(msgResponse(_0x2964('0x1e1'),_0x2964('0x8d'),JSON[_0x2964('0x81')](_0x19ffbe)));});}if(_0x55941a[_0x2964('0x1c8')]===_0x2964('0x1d9')){return _0x35af55['getVoiceQueueRtPauses'](_0x55941a['id'])[_0x2964('0x3e')](function(_0x3116e6){var _0x4a3ddd=_0x55941a['loggedIn']-_0x3116e6[0x0]['outboundQueuePauses'];var _0xd001d0=_0x55941a['dialPredictiveInterval']*0x3c;var _0x261fd2=_0x54d47d[0x0]['predictiveIntervalAvgTalktime']+_0x54d47d[0x0][_0x2964('0x4d')];var _0xcf0d49=(_0x54d47d[0x0]['predictiveIntervalAnsweredCalls']+_0x54d47d[0x0][_0x2964('0x4b')]+_0x54d47d[0x0][_0x2964('0xdc')])/_0x54d47d[0x0][_0x2964('0x51')];var _0x57f4d4=_0x55941a[_0x2964('0x1ba')]/0x64;_0x55941a[_0x2964('0x1e0')]=_0x3116e6[0x0][_0x2964('0x1df')]||0x0;_0x55941a['predictiveIntervalHitRate']=_0xcf0d49>0x0?_0xcf0d49:0x1;return _0x35af55[_0x2964('0x1da')](_0x4a3ddd,_0xd001d0,_0x261fd2,_0xcf0d49,_0x57f4d4);})[_0x2964('0x3e')](function(_0x681741){return _0x3484aa(_0x681741);})[_0x2964('0x98')](function(_0x4749e1){return _0x4d8f8a(msgResponse('[CatchErlangB]',_0x2964('0x8d'),JSON['stringify'](_0x4749e1)));});}}else{return _0x4d8f8a(msgResponse('[getDataPredictive]',_0x2964('0x8d'),_0x2964('0x1dc')));}});};};Dialer['prototype'][_0x2964('0x1cf')]=function(_0x2971e0){var _0xed4a7b=this;return function(){var _0x2038b9=0x0;var _0x422f35=Math[_0x2964('0x1bf')](_0x2971e0[_0x2964('0x57')]*0x3e8);if(_0x422f35>0x0){_0x422f35=_0x422f35<0x64?0x64:_0x422f35;loggerPredictive[_0x2964('0x48')](_0x2971e0['name'],_0x2964('0x1e2'),_0x422f35,_0x2964('0x1e3'));_0x2971e0[_0x2964('0x5f')]=setInterval(function(){_0xed4a7b[_0x2964('0x5f')](_0x2971e0);loggerPredictiveCalls['info'](_0x2964('0x1e4'),_0x2038b9+=0x1);},_0x422f35);}else{loggerPredictive[_0x2964('0x48')](_0x2971e0[_0x2964('0x46')],_0x2964('0x1e5'));}};};Dialer[_0x2964('0x87')][_0x2964('0x1e6')]=function(_0x27c333,_0x488204){var _0xcaf553=this;return function(_0x3447a3){if(_[_0x2964('0x47')](_0x3447a3)){if(_[_0x2964('0xf0')](_0x488204[_0x2964('0x1e7')])||!_0x488204['recallme']){if(_0x27c333['dialMethod']==='booked'){_0x27c333['queueStatusComplete']=_[_0x2964('0x52')](_0x27c333[_0x2964('0x6d')])?!![]:_0x27c333['queueStatusComplete'];var _0x435a41=uuid['v4']();_0xcaf553[_0x2964('0x25')][_0x435a41]=new Action(_0x27c333,_0x488204,_0x435a41);loggerBooked['info']('[booked][checkContactBlack]',_0x435a41,_0x2964('0x1e8'),JSON[_0x2964('0x81')](_0x27c333['queueStatusComplete']),_0x2964('0x1e9'),_0x27c333[_0x2964('0x46')]);if(_0x27c333['queueStatusComplete']){_0x27c333[_0x2964('0x6d')]=![];_0xcaf553[_0x2964('0x2c')][_0xcaf553['actions'][_0x435a41]['queue']]=[];ami[_0x2964('0x94')]({'actionid':_0x435a41,'action':_0x2964('0x1ea'),'queue':_0x27c333['name']})[_0x2964('0x98')](function(){_0xcaf553[_0x2964('0xbb')](_0x27c333);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0xcaf553['actions'][_0x435a41][_0x2964('0xd6')],'ListId':_0xcaf553['actions'][_0x435a41][_0x2964('0xe3')],'VoiceQueueId':_0xcaf553[_0x2964('0x25')][_0x435a41]['VoiceQueueId']||undefined,'CampaignId':_0xcaf553['actions'][_0x435a41]['CampaignId']||undefined})[_0x2964('0x98')](loggerCatch(_0x2964('0x1eb')));delete _0xcaf553[_0x2964('0x25')][_0x435a41];});}else{loggerBooked[_0x2964('0x48')](_0x2964('0x1ec'),JSON[_0x2964('0x81')](_0x27c333[_0x2964('0x6d')]),_0x2964('0x1e9'),_0x27c333[_0x2964('0x46')]);_0xcaf553[_0x2964('0xbb')](_0x27c333);hopperUtils[_0x2964('0xf4')]({'active':![],'ContactId':_0xcaf553[_0x2964('0x25')][_0x435a41][_0x2964('0xd6')],'ListId':_0xcaf553['actions'][_0x435a41]['ListId'],'VoiceQueueId':_0xcaf553[_0x2964('0x25')][_0x435a41][_0x2964('0xd7')]||undefined,'CampaignId':_0xcaf553[_0x2964('0x25')][_0x435a41][_0x2964('0xe4')]||undefined})[_0x2964('0x98')](loggerCatch(_0x2964('0x1eb')));delete _0xcaf553['actions'][_0x435a41];}}else{return _0xcaf553['actionOriginate'](_0x27c333,_0x488204);}}else{if(utils[_0x2964('0x5c')](undefined,_0x488204[_0x2964('0x1ed')])<_0x27c333['dialRecallMeTimeout']*0x3c){if(_0x488204['Agent']&&!_0x488204[_0x2964('0x145')][_0x2964('0x1ee')]){_0xcaf553['preview'][_0x2964('0xf2')](_0x488204['id'])[_0x2964('0x1e')](function(){_0xcaf553[_0x2964('0xbb')](_0x27c333);});}else{hopperUtils[_0x2964('0x1ef')]({'active':![]},_0x488204['id'],0x1)[_0x2964('0x1e')](function(){_0xcaf553[_0x2964('0xbb')](_0x27c333);});}}else{_0x27c333['outboundReCallsDay']+=0x1;_0xcaf553[_0x2964('0xbb')](_0x27c333);if(_0x27c333[_0x2964('0x1f0')]){hopperUtils[_0x2964('0xf4')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x488204[_0x2964('0xd6')],'ListId':_0x488204[_0x2964('0xe3')],'VoiceQueueId':_0x488204[_0x2964('0xd7')]||undefined,'CampaignId':_0x488204[_0x2964('0xe4')]||undefined})[_0x2964('0x98')](loggerCatch(_0x2964('0x1f1')));hopperUtils[_0x2964('0xc4')](createObjHistory(_0x27c333,_0x488204,utils['CAMPAIGN_STATUS'][_0x2964('0x1f2')],0x17,_0x2964('0x1f3')))[_0x2964('0x98')](loggerCatch(_0x2964('0x1f4')));}else{_0xcaf553[_0x2964('0x155')](createObjHistory(_0x27c333,_0x488204,utils['CAMPAIGN_STATUS'][_0x2964('0x1f5')],0x16,_0x2964('0x1f6')),_0x2964('0x1f7'),'[Originate][HistoryRecallClose]');}}}}else{_0x27c333[_0x2964('0x1f8')]+=0x1;_0xcaf553[_0x2964('0x155')](createObjHistory(_0x27c333,_0x488204,utils[_0x2964('0x63')][_0x2964('0x1f9')],0xd,_0x2964('0x1fa')),'[Originate][historyBlacklist]',_0x2964('0x1fb'));throw'inBlackList';}};};Dialer[_0x2964('0x87')][_0x2964('0x159')]=function(_0x161a66){var _0x1045a6=this;var _0x488e19=_0x161a66[_0x2964('0x1fc')]-_0x161a66[_0x2964('0x7a')]-_0x161a66['temp'];emitCampaignSummary(_0x161a66);if(_0x488e19>0x0){if(_0x488e19>this[_0x2964('0x1fd')]){_0x488e19=this[_0x2964('0x1fd')];}_0x161a66['temp']+=_0x488e19;hopperUtils['getContactDialerIvr'](_0x161a66,_0x488e19)[_0x2964('0x3e')](function(_0x3e2ca4){_0x161a66[_0x2964('0x1fe')]-=_0x488e19;_0x161a66[_0x2964('0x1fe')]=_0x161a66[_0x2964('0x1fe')]>0x0?_0x161a66[_0x2964('0x1fe')]:0x0;if(!utils['checkContactEmpty'](_0x3e2ca4)){_0x161a66[_0x2964('0x67')]=utils[_0x2964('0x63')][_0x2964('0x68')];logger[_0x2964('0x48')](_0x2964('0x1ff')+_0x161a66['name']);}else{_0x161a66[_0x2964('0x7a')]+=_0x3e2ca4['length'];_0x161a66[_0x2964('0x67')]=utils[_0x2964('0x63')]['RUNNING'];for(var _0x8cc145=0x0;_0x8cc145<_0x3e2ca4[_0x2964('0x142')];_0x8cc145+=0x1){_0x161a66[_0x2964('0x200')]+=0x1;if(_[_0x2964('0xf0')](_0x3e2ca4[_0x8cc145])||_[_0x2964('0xf0')](_0x3e2ca4[_0x8cc145][_0x2964('0x172')])||_[_0x2964('0xf0')](_0x3e2ca4[_0x8cc145][_0x2964('0x15a')])){_0x1045a6[_0x2964('0x153')]('[actionOriginate]\x20',_0x161a66,_0x3e2ca4[_0x8cc145]);}else{hopperUtils['checkIsBlackListIvr'](_['pick'](_0x3e2ca4[_0x8cc145],['CampaignId',_0x2964('0x15a')]))[_0x2964('0x3e')](_0x1045a6[_0x2964('0x1e6')](_0x161a66,_0x3e2ca4[_0x8cc145]))[_0x2964('0x98')](_0x1045a6[_0x2964('0x152')]('[actionOriginateIvr]\x20',_0x161a66));}}}})[_0x2964('0x98')](loggerGetContactDialer('[getContactCampaign2]',_0x161a66,_0x488e19));}};Dialer[_0x2964('0x87')]['handlePower']=function(_0x5e7c28,_0x1259b3){var _0x221dfa=this;var _0x71db1f=[];if(_0x1259b3<0x1||_0x5e7c28[_0x2964('0xa9')]==='booked'){_0x1259b3=0x1;}var _0x502418=Math[_0x2964('0x1bf')](_0x5e7c28[_0x2964('0x136')]*_0x1259b3)-_0x5e7c28[_0x2964('0x7a')]-_0x5e7c28['temp'];if(_0x5e7c28[_0x2964('0x201')]>0x0){var _0x2f2708=_0x5e7c28['dialLimitQueue']-_0x5e7c28[_0x2964('0x7a')]-_0x5e7c28[_0x2964('0x1be')]-_0x5e7c28[_0x2964('0x1fe')]-_0x5e7c28['pTalking'];if(_0x502418>_0x2f2708){_0x502418=_0x2f2708;}}if(_0x502418>0x0){if(_0x5e7c28[_0x2964('0xa9')]===_0x2964('0x9')){_0x502418=0x1;}if(_0x502418>this[_0x2964('0x1fd')]){_0x502418=this[_0x2964('0x1fd')];}_0x5e7c28['temp']+=_0x502418;for(var _0x26ca87 in this['agents']){if(typeof this[_0x2964('0x23')][_0x26ca87]!=='undefined'){if(this[_0x2964('0x23')][_0x26ca87]['state']==='not_inuse'&&this[_0x2964('0x23')][_0x26ca87][_0x2964('0x85')]===_0x2964('0x141')){_0x71db1f[_0x2964('0x99')](this[_0x2964('0x23')][_0x26ca87]['id']);}}}hopperUtils['getContactDialer'](_0x5e7c28,_0x71db1f,_0x502418)[_0x2964('0x3e')](function(_0x85a2fe){_0x5e7c28[_0x2964('0x1fe')]-=_0x502418;_0x5e7c28[_0x2964('0x1fe')]=_0x5e7c28[_0x2964('0x1fe')]>0x0?_0x5e7c28[_0x2964('0x1fe')]:0x0;if(!utils['checkContactEmpty'](_0x85a2fe)){hopperUtils[_0x2964('0x202')](_0x5e7c28)[_0x2964('0x3e')](sendMessageReschedule(_0x5e7c28))[_0x2964('0x98')](loggerCatch(_0x2964('0x203')));}else{_0x5e7c28[_0x2964('0x7a')]+=_0x85a2fe['length'];_0x5e7c28[_0x2964('0x67')]=_0x5e7c28[_0x2964('0xa9')]===_0x2964('0x9')?utils[_0x2964('0x63')][_0x2964('0x204')]:utils[_0x2964('0x63')]['RUNNING'];for(var _0x23da94=0x0;_0x23da94<_0x85a2fe[_0x2964('0x142')];_0x23da94+=0x1){if(_[_0x2964('0xf0')](_0x85a2fe[_0x23da94])||_[_0x2964('0xf0')](_0x85a2fe[_0x23da94]['Contact'])||_[_0x2964('0xf0')](_0x85a2fe[_0x23da94][_0x2964('0x15a')])){_0x221dfa['emptyContact'](_0x2964('0x205'),_0x5e7c28,_0x85a2fe[_0x23da94]);}else{hopperUtils[_0x2964('0x206')](_[_0x2964('0x70')](_0x85a2fe[_0x23da94],[_0x2964('0xd7'),_0x2964('0x15a')]))[_0x2964('0x3e')](_0x221dfa[_0x2964('0x1e6')](_0x5e7c28,_0x85a2fe[_0x23da94]))[_0x2964('0x98')](_0x221dfa[_0x2964('0x152')]('[actionOriginate]\x20',_0x5e7c28));}}}})[_0x2964('0x98')](loggerGetContactDialer('[getContactDialer2]',_0x5e7c28,_0x502418));}};Dialer[_0x2964('0x87')][_0x2964('0x5f')]=function(_0x58b2be){if(_0x58b2be[_0x2964('0x201')]>0x0){var _0x10832c=_0x58b2be[_0x2964('0x201')]-_0x58b2be['originated']-_0x58b2be['talking'];if(_0x10832c>0x0){this[_0x2964('0x207')](_0x58b2be);}else{loggerPredictiveCalls[_0x2964('0x48')](_0x2964('0x208'));}}else{this[_0x2964('0x207')](_0x58b2be);}};Dialer[_0x2964('0x87')][_0x2964('0x207')]=function(_0x56f61a){var _0x4e9aae=this;var _0x3ddcf5=[];_0x56f61a[_0x2964('0x7a')]+=0x1;for(var _0x4c4855 in this[_0x2964('0x23')]){if(typeof this[_0x2964('0x23')][_0x4c4855]!==_0x2964('0xa1')){if(this[_0x2964('0x23')][_0x4c4855][_0x2964('0x6a')]===_0x2964('0x209')&&this['agents'][_0x4c4855][_0x2964('0x85')]===_0x2964('0x141')){_0x3ddcf5[_0x2964('0x99')](this['agents'][_0x4c4855]['id']);}}}return this['getContactDialer'](_0x56f61a['id'],_0x3ddcf5,0x1,_0x56f61a[_0x2964('0x20a')],_0x56f61a)[_0x2964('0x3e')](function(_0x2f7837){if(!utils['checkContactEmpty'](_0x2f7837)){utils[_0x2964('0x62')](_0x56f61a,0x1,0x0);return hopperUtils[_0x2964('0x202')](_0x56f61a)[_0x2964('0x3e')](sendMessageReschedule(_0x56f61a))[_0x2964('0x98')](loggerCatch('[countReScheduled]\x20'));}else{_0x56f61a[_0x2964('0x67')]=utils['CAMPAIGN_STATUS'][_0x2964('0x20b')];if(_[_0x2964('0xf0')](_0x2f7837[0x0])||_[_0x2964('0xf0')](_0x2f7837[0x0][_0x2964('0x172')])||_['isNil'](_0x2f7837[0x0][_0x2964('0x15a')])){_0x4e9aae[_0x2964('0x153')]('[actionOriginate]\x20',_0x56f61a,_0x2f7837[0x0]);}else{return hopperUtils[_0x2964('0x206')](_[_0x2964('0x70')](_0x2f7837[0x0],['VoiceQueueId',_0x2964('0x15a')]))['then'](_0x4e9aae['checkContactBlack'](_0x56f61a,_0x2f7837[0x0]))[_0x2964('0x98')](_0x4e9aae[_0x2964('0x152')](_0x2964('0x20c'),_0x56f61a));}}})[_0x2964('0x98')](loggerGetContactDialer(_0x2964('0x20d'),_0x56f61a,0x1));};Dialer[_0x2964('0x87')]['abandonmentRate']=function(_0x413f43,_0x4f2ba1,_0x373488,_0x2a17eb,_0xaf4cad,_0x3f971f){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x2964('0x48')](_0x2964('0x20e'),_0x413f43);loggerPredictive[_0x2964('0x48')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4f2ba1);loggerPredictive[_0x2964('0x48')]('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',_0x373488);loggerPredictive[_0x2964('0x48')](_0x2964('0x20f'),_0x2a17eb);loggerPredictive[_0x2964('0x48')](_0x2964('0x210'),_0xaf4cad);loggerPredictive['info'](_0x2964('0x50'));return new Promise(function(_0x5f3b3b,_0x4bdbd0){if(_0x413f43<=0x0||isNaN(_0x413f43)){return _0x4bdbd0(msgResponse('[abandonmentRate]',_0x2964('0x80'),_0x2964('0x211')+_0x413f43));}if(_0x373488<=0x0||isNaN(_0x373488)){return _0x4bdbd0(msgResponse(_0x2964('0x212'),_0x2964('0x80'),_0x2964('0x213')+_0x373488));}if(_0x2a17eb<=0x0||isNaN(_0x2a17eb)){return _0x4bdbd0(msgResponse(_0x2964('0x212'),_0x2964('0x80'),_0x2964('0x214')+_0x2a17eb));}if(_0x4f2ba1<=0x0||isNaN(_0x4f2ba1)){return _0x4bdbd0(msgResponse(_0x2964('0x212'),_0x2964('0x80'),_0x2964('0x215')+_0x4f2ba1));}if(_0xaf4cad<=0x0||isNaN(_0xaf4cad)){return _0x4bdbd0(msgResponse('[abandonmentRate]',_0x2964('0x80'),_0x2964('0x216')+_0xaf4cad));}_0x3f971f=_0x3f971f||0x0;var _0xac160d=0x1/_0x373488;var _0x14be54=0x0;var _0x49fcad=0x0;var _0x2a0a80=0x0;var _0x6b1f78=0x0;for(var _0x326259=0x0;_0x2a0a80<_0xaf4cad;_0x326259+=0x1){_0x49fcad=_0x326259/_0x4f2ba1;_0x14be54=(_0x2a17eb*_0x49fcad+_0x3f971f)/_0xac160d;_0x2a0a80=utils[_0x2964('0x217')](_0x14be54,_0x413f43);_0x6b1f78=_0x14be54/_0x413f43*(0x1-utils[_0x2964('0x217')](_0x14be54,_0x413f43));}return _0x5f3b3b({'erlangCalls':_0x326259,'erlangCallToSecond':_0x4f2ba1/_0x326259,'erlangAbandonmentRate':_0x2a0a80,'erlangBusyFactor':_0x6b1f78});});};Dialer[_0x2964('0x87')][_0x2964('0x1da')]=function(_0x591617,_0x13b491,_0x5791fd,_0x1373d4,_0xecf909,_0x24c204){loggerPredictive[_0x2964('0x48')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x2964('0x48')](_0x2964('0x20e'),_0x591617);loggerPredictive['info'](_0x2964('0x218'),_0x13b491);loggerPredictive['info'](_0x2964('0x219'),_0x5791fd);loggerPredictive[_0x2964('0x48')](_0x2964('0x20f'),_0x1373d4);loggerPredictive[_0x2964('0x48')](_0x2964('0x21a'),_0xecf909);loggerPredictive[_0x2964('0x48')]('---------------------------');return new Promise(function(_0x168ca7,_0x3932ff){if(_0x591617<=0x0||isNaN(_0x591617)){return _0x3932ff(msgResponse(_0x2964('0x21b'),'Error',_0x2964('0x211')+_0x591617));}if(_0x5791fd<=0x0||isNaN(_0x5791fd)){return _0x3932ff(msgResponse(_0x2964('0x21b'),_0x2964('0x80'),_0x2964('0x213')+_0x5791fd));}if(_0x1373d4<=0x0||isNaN(_0x1373d4)){return _0x3932ff(msgResponse(_0x2964('0x21b'),_0x2964('0x80'),_0x2964('0x214')+_0x1373d4));}if(_0x13b491<=0x0||isNaN(_0x13b491)){return _0x3932ff(msgResponse('[busyFactor]','Error',_0x2964('0x215')+_0x13b491));}if(_0xecf909<=0x0||isNaN(_0xecf909)){return _0x3932ff(msgResponse(_0x2964('0x21b'),'Error',_0x2964('0x21c')+_0xecf909));}_0x24c204=_0x24c204||0x0;var _0x20de77=0x1/_0x5791fd;var _0x340418=0x0;var _0x3e8d86=0x0;var _0x562700=0x0;var _0x14ea56=0x0;for(var _0x3ab764=0x0;_0x14ea56<_0xecf909;_0x3ab764+=0x1){_0x3e8d86=_0x3ab764/_0x13b491;_0x340418=(_0x1373d4*_0x3e8d86+_0x24c204)/_0x20de77;_0x562700=utils['erlangb'](_0x340418,_0x591617);_0x14ea56=_0x340418/_0x591617*(0x1-utils[_0x2964('0x217')](_0x340418,_0x591617));}return _0x168ca7({'erlangCalls':_0x3ab764,'erlangCallToSecond':_0x13b491/_0x3ab764,'erlangAbandonmentRate':_0x562700,'erlangBusyFactor':_0x14ea56});});};module[_0x2964('0x21d')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 3d51081..30f7bbc 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x87a5=['substring','exports','lodash','moment','isNil','string','voiceQueue','uniqueid','Contact','phone','lastName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','UserId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit'];(function(_0x3002d3,_0x4972c7){var _0x1699f1=function(_0x4f9b2b){while(--_0x4f9b2b){_0x3002d3['push'](_0x3002d3['shift']());}};_0x1699f1(++_0x4972c7);}(_0x87a5,0xb2));var _0x587a=function(_0x4e4f0e,_0x1c3892){_0x4e4f0e=_0x4e4f0e-0x0;var _0x1a7219=_0x87a5[_0x4e4f0e];return _0x1a7219;};'use strict';var util=require('util');var _=require(_0x587a('0x0'));var moment=require(_0x587a('0x1'));function checkNameSurname(_0x4243da,_0x3937f8,_0x1caf64){var _0x3c2d7b='';if(!_[_0x587a('0x2')](_0x3937f8)&&_0x587a('0x3')===typeof _0x3937f8){_0x3c2d7b+=_0x3937f8;}if(!_[_0x587a('0x2')](_0x1caf64)&&_0x587a('0x3')===typeof _0x1caf64){_0x3c2d7b+='\x20'+_0x1caf64;}if(_0x3c2d7b!==''){return _0x3c2d7b;}return _0x4243da;}function Action(_0x1a6c6f,_0x2ddb5a,_0x67de4){this[_0x587a('0x4')]=_0x1a6c6f;this[_0x587a('0x5')]=_0x67de4||undefined;this['name']=checkNameSurname(_0x2ddb5a[_0x587a('0x6')][_0x587a('0x7')],_0x2ddb5a[_0x587a('0x6')]['firstName'],_0x2ddb5a['Contact'][_0x587a('0x8')]);this[_0x587a('0x9')]=_0x2ddb5a[_0x587a('0x7')];this[_0x587a('0xa')]=_0x1a6c6f[_0x587a('0xb')];this[_0x587a('0xc')]=_0x2ddb5a[_0x587a('0xc')]||![];this['type']=_0x1a6c6f[_0x587a('0xd')];this[_0x587a('0xe')]=_0x1a6c6f[_0x587a('0xe')]||0x3;this['scheduledat']=_0x2ddb5a[_0x587a('0xf')];this['countbusyretry']=_0x2ddb5a[_0x587a('0x10')];this[_0x587a('0x11')]=_0x2ddb5a['countcongestionretry'];this[_0x587a('0x12')]=_0x2ddb5a[_0x587a('0x12')];this[_0x587a('0x13')]=_0x2ddb5a[_0x587a('0x13')];this[_0x587a('0x14')]=_0x2ddb5a[_0x587a('0x14')];this[_0x587a('0x15')]=_0x2ddb5a[_0x587a('0x15')];this['countmachineretry']=_0x2ddb5a[_0x587a('0x16')];this['countagentrejectretry']=_0x2ddb5a[_0x587a('0x17')];this[_0x587a('0x18')]=_0x2ddb5a[_0x587a('0x18')];this['ListId']=_0x2ddb5a['ListId'];this[_0x587a('0x19')]=_0x2ddb5a['UserId'];this['VoiceQueueId']=_0x2ddb5a['VoiceQueueId'];this[_0x587a('0x1a')]=_0x2ddb5a['CampaignId'];this[_0x587a('0x1b')]=_0x2ddb5a['id'];this[_0x587a('0x1c')]=_0x2ddb5a[_0x587a('0x6')][_0x587a('0x1d')]||'';this[_0x587a('0x1e')]=moment()[_0x587a('0x1f')](_0x587a('0x20'));this[_0x587a('0x21')]=_0x2ddb5a[_0x587a('0x21')];this[_0x587a('0x22')]=_0x2ddb5a[_0x587a('0x22')];this[_0x587a('0x23')]=_0x2ddb5a['callbackat'];this[_0x587a('0x24')]=_0x2ddb5a[_0x587a('0x24')];this['originatecalleridnum']='';this[_0x587a('0x25')]='';}Action[_0x587a('0x26')][_0x587a('0x27')]=function(){return util['format'](_0x587a('0x28'),this[_0x587a('0xb')],this[_0x587a('0x4')][_0x587a('0x29')]>0x0?this['number'][_0x587a('0x2a')](this['voiceQueue'][_0x587a('0x29')]):this[_0x587a('0x9')]);};Action[_0x587a('0x26')]['getQueue']=function(){return this[_0x587a('0xa')];};module[_0x587a('0x2b')]=Action; \ No newline at end of file +var _0x7d8b=['YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','voiceQueue','getQueue','exports','util','lodash','moment','isNil','string','uniqueid','name','Contact','firstName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format'];(function(_0xdb04b2,_0xab8184){var _0x469142=function(_0x1c87ea){while(--_0x1c87ea){_0xdb04b2['push'](_0xdb04b2['shift']());}};_0x469142(++_0xab8184);}(_0x7d8b,0x1a3));var _0xb7d8=function(_0x5b174b,_0x404869){_0x5b174b=_0x5b174b-0x0;var _0x47ee37=_0x7d8b[_0x5b174b];return _0x47ee37;};'use strict';var util=require(_0xb7d8('0x0'));var _=require(_0xb7d8('0x1'));var moment=require(_0xb7d8('0x2'));function checkNameSurname(_0x5c3ae7,_0x179497,_0x486772){var _0x2d31fb='';if(!_[_0xb7d8('0x3')](_0x179497)&&_0xb7d8('0x4')===typeof _0x179497){_0x2d31fb+=_0x179497;}if(!_[_0xb7d8('0x3')](_0x486772)&&_0xb7d8('0x4')===typeof _0x486772){_0x2d31fb+='\x20'+_0x486772;}if(_0x2d31fb!==''){return _0x2d31fb;}return _0x5c3ae7;}function Action(_0x53f299,_0x3d0f77,_0x326ff3){this['voiceQueue']=_0x53f299;this[_0xb7d8('0x5')]=_0x326ff3||undefined;this[_0xb7d8('0x6')]=checkNameSurname(_0x3d0f77[_0xb7d8('0x7')]['phone'],_0x3d0f77[_0xb7d8('0x7')][_0xb7d8('0x8')],_0x3d0f77['Contact']['lastName']);this[_0xb7d8('0x9')]=_0x3d0f77[_0xb7d8('0xa')];this[_0xb7d8('0xb')]=_0x53f299[_0xb7d8('0x6')];this[_0xb7d8('0xc')]=_0x3d0f77[_0xb7d8('0xc')]||![];this[_0xb7d8('0xd')]=_0x53f299[_0xb7d8('0xd')];this[_0xb7d8('0xe')]=_0x53f299[_0xb7d8('0xe')]||0x3;this[_0xb7d8('0xf')]=_0x3d0f77[_0xb7d8('0xf')];this[_0xb7d8('0x10')]=_0x3d0f77['countbusyretry'];this[_0xb7d8('0x11')]=_0x3d0f77[_0xb7d8('0x11')];this[_0xb7d8('0x12')]=_0x3d0f77[_0xb7d8('0x12')];this[_0xb7d8('0x13')]=_0x3d0f77[_0xb7d8('0x13')];this['countdropretry']=_0x3d0f77[_0xb7d8('0x14')];this[_0xb7d8('0x15')]=_0x3d0f77[_0xb7d8('0x15')];this['countmachineretry']=_0x3d0f77[_0xb7d8('0x16')];this[_0xb7d8('0x17')]=_0x3d0f77['countagentrejectretry'];this['ContactId']=_0x3d0f77['ContactId'];this[_0xb7d8('0x18')]=_0x3d0f77['ListId'];this[_0xb7d8('0x19')]=_0x3d0f77[_0xb7d8('0x19')];this[_0xb7d8('0x1a')]=_0x3d0f77['VoiceQueueId'];this[_0xb7d8('0x1b')]=_0x3d0f77[_0xb7d8('0x1b')];this[_0xb7d8('0x1c')]=_0x3d0f77['id'];this[_0xb7d8('0x1d')]=_0x3d0f77[_0xb7d8('0x7')]['firstName']||'';this['starttime']=moment()[_0xb7d8('0x1e')](_0xb7d8('0x1f'));this[_0xb7d8('0x20')]=_0x3d0f77['callback'];this[_0xb7d8('0x21')]=_0x3d0f77['callbackuniqueid'];this[_0xb7d8('0x22')]=_0x3d0f77[_0xb7d8('0x22')];this['recallme']=_0x3d0f77[_0xb7d8('0x23')];this[_0xb7d8('0x24')]='';this[_0xb7d8('0x25')]='';}Action['prototype'][_0xb7d8('0x26')]=function(){return util[_0xb7d8('0x1e')](_0xb7d8('0x27'),this[_0xb7d8('0x6')],this['voiceQueue'][_0xb7d8('0x28')]>0x0?this['number'][_0xb7d8('0x29')](this[_0xb7d8('0x2a')][_0xb7d8('0x28')]):this[_0xb7d8('0x9')]);};Action['prototype'][_0xb7d8('0x2b')]=function(){return this[_0xb7d8('0xb')];};module[_0xb7d8('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 4e1d3a3..bc55359 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9327=['originatecalleridname','agiafterat','moment','../utils','state','Answer','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countbusyretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','name','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x9327,0x1c5));var _0x7932=function(_0x45c65a,_0x39a06c){_0x45c65a=_0x45c65a-0x0;var _0x97241b=_0x9327[_0x45c65a];return _0x97241b;};'use strict';var moment=require(_0x7932('0x0'));var utils=require(_0x7932('0x1'));function AgentComplete(_0x473329,_0x52d4ee){this[_0x7932('0x2')]=0x4;this['statedesc']=_0x7932('0x3');this[_0x7932('0x4')]=_0x473329[_0x7932('0x4')];this[_0x7932('0x5')]=_0x473329[_0x7932('0x5')];this[_0x7932('0x6')]=_0x473329['type']===_0x7932('0x7')?_0x7932('0x8'):_0x473329[_0x7932('0x5')];this['countbusyretry']=_0x473329['countbusyretry'];this[_0x7932('0x9')]=_0x473329[_0x7932('0x9')];this[_0x7932('0xa')]=_0x473329[_0x7932('0xa')];this['countglobal']=_0x473329[_0x7932('0xb')]+_0x473329['countcongestionretry']+_0x473329[_0x7932('0xa')]+_0x473329['countnosuchnumberretry']+_0x473329[_0x7932('0xc')]+_0x473329[_0x7932('0xd')]+_0x473329[_0x7932('0xe')]+_0x473329['countagentrejectretry'];this[_0x7932('0xf')]=_0x473329['countnosuchnumberretry'];this[_0x7932('0xc')]=_0x473329[_0x7932('0xc')];this['countabandonedretry']=_0x473329[_0x7932('0xd')];this['countmachineretry']=_0x473329[_0x7932('0xe')];this[_0x7932('0x10')]=_0x473329[_0x7932('0x10')];this[_0x7932('0x11')]=_0x52d4ee[_0x7932('0x11')];this['calleridname']=_0x473329[_0x7932('0x12')];this['calleridnum']=_0x473329[_0x7932('0x13')];this[_0x7932('0x14')]=_0x473329[_0x7932('0x14')];this[_0x7932('0x15')]=_0x473329['responsetime'];this['answertime']=_0x473329[_0x7932('0x16')];this[_0x7932('0x17')]=moment()['format'](_0x7932('0x18'));this[_0x7932('0x19')]=utils[_0x7932('0x1a')](_0x473329[_0x7932('0x15')],_0x473329[_0x7932('0x14')]);this[_0x7932('0x1b')]=utils[_0x7932('0x1a')](_0x473329[_0x7932('0x16')],_0x473329[_0x7932('0x15')]);this[_0x7932('0x1c')]=utils['getSeconds'](this['endtime'],_0x473329['answertime']);this[_0x7932('0x8')]=_0x52d4ee[_0x7932('0x8')];this[_0x7932('0x1d')]=_0x52d4ee[_0x7932('0x1d')];this['reason']=_0x52d4ee['reason'];this[_0x7932('0x1e')]=_0x473329[_0x7932('0x1e')];this['callbackuniqueid']=_0x473329[_0x7932('0x1f')];this[_0x7932('0x20')]=_0x473329['callbackat'];this[_0x7932('0x21')]=_0x473329[_0x7932('0x21')];this['ContactId']=_0x473329['ContactId'];this['ListId']=_0x473329[_0x7932('0x22')];this[_0x7932('0x23')]=_0x473329['UserId'];this[_0x7932('0x24')]=_0x473329[_0x7932('0x24')];this[_0x7932('0x25')]=_0x473329[_0x7932('0x25')];this[_0x7932('0x26')]=_0x473329[_0x7932('0x26')]||'';this[_0x7932('0x27')]=_0x473329['originatecalleridname']||'';this[_0x7932('0x28')]=_0x473329[_0x7932('0x28')];}module['exports']=AgentComplete; \ No newline at end of file +var _0xf1f5=['moment','../utils','state','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','starttime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xf1f5,0x87));var _0x5f1f=function(_0x11279c,_0x37b77d){_0x11279c=_0x11279c-0x0;var _0x127940=_0xf1f5[_0x11279c];return _0x127940;};'use strict';var moment=require(_0x5f1f('0x0'));var utils=require(_0x5f1f('0x1'));function AgentComplete(_0x1c5808,_0x40a02c){this[_0x5f1f('0x2')]=0x4;this['statedesc']=_0x5f1f('0x3');this[_0x5f1f('0x4')]=_0x1c5808['scheduledat'];this[_0x5f1f('0x5')]=_0x1c5808['type'];this[_0x5f1f('0x6')]=_0x1c5808[_0x5f1f('0x5')]==='outbound'?_0x5f1f('0x7'):_0x1c5808[_0x5f1f('0x5')];this[_0x5f1f('0x8')]=_0x1c5808[_0x5f1f('0x8')];this[_0x5f1f('0x9')]=_0x1c5808['countcongestionretry'];this[_0x5f1f('0xa')]=_0x1c5808[_0x5f1f('0xa')];this['countglobal']=_0x1c5808[_0x5f1f('0x8')]+_0x1c5808['countcongestionretry']+_0x1c5808[_0x5f1f('0xa')]+_0x1c5808[_0x5f1f('0xb')]+_0x1c5808['countdropretry']+_0x1c5808[_0x5f1f('0xc')]+_0x1c5808[_0x5f1f('0xd')]+_0x1c5808[_0x5f1f('0xe')];this[_0x5f1f('0xb')]=_0x1c5808[_0x5f1f('0xb')];this[_0x5f1f('0xf')]=_0x1c5808[_0x5f1f('0xf')];this[_0x5f1f('0xc')]=_0x1c5808['countabandonedretry'];this[_0x5f1f('0xd')]=_0x1c5808[_0x5f1f('0xd')];this['countagentrejectretry']=_0x1c5808[_0x5f1f('0xe')];this[_0x5f1f('0x10')]=_0x40a02c[_0x5f1f('0x10')];this[_0x5f1f('0x11')]=_0x1c5808[_0x5f1f('0x12')];this[_0x5f1f('0x13')]=_0x1c5808[_0x5f1f('0x14')];this['starttime']=_0x1c5808['starttime'];this[_0x5f1f('0x15')]=_0x1c5808['responsetime'];this[_0x5f1f('0x16')]=_0x1c5808[_0x5f1f('0x16')];this[_0x5f1f('0x17')]=moment()[_0x5f1f('0x18')](_0x5f1f('0x19'));this[_0x5f1f('0x1a')]=utils[_0x5f1f('0x1b')](_0x1c5808[_0x5f1f('0x15')],_0x1c5808[_0x5f1f('0x1c')]);this['holdtime']=utils[_0x5f1f('0x1b')](_0x1c5808[_0x5f1f('0x16')],_0x1c5808[_0x5f1f('0x15')]);this[_0x5f1f('0x1d')]=utils[_0x5f1f('0x1b')](this[_0x5f1f('0x17')],_0x1c5808['answertime']);this[_0x5f1f('0x7')]=_0x40a02c['queue'];this[_0x5f1f('0x1e')]=_0x40a02c['membername'];this['reason']=_0x40a02c[_0x5f1f('0x1f')];this[_0x5f1f('0x20')]=_0x1c5808['callback'];this[_0x5f1f('0x21')]=_0x1c5808[_0x5f1f('0x21')];this['callbackat']=_0x1c5808[_0x5f1f('0x22')];this['recallme']=_0x1c5808[_0x5f1f('0x23')];this[_0x5f1f('0x24')]=_0x1c5808[_0x5f1f('0x24')];this[_0x5f1f('0x25')]=_0x1c5808['ListId'];this[_0x5f1f('0x26')]=_0x1c5808[_0x5f1f('0x26')];this[_0x5f1f('0x27')]=_0x1c5808['VoiceQueueId'];this[_0x5f1f('0x28')]=_0x1c5808['CampaignId'];this[_0x5f1f('0x29')]=_0x1c5808['originatecalleridnum']||'';this[_0x5f1f('0x2a')]=_0x1c5808[_0x5f1f('0x2a')]||'';this[_0x5f1f('0x2b')]=_0x1c5808[_0x5f1f('0x2b')];}module[_0x5f1f('0x2c')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 0ecf31f..31953c3 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb79e=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x341806,_0x1fdce2){var _0x2213dc=function(_0x3c0187){while(--_0x3c0187){_0x341806['push'](_0x341806['shift']());}};_0x2213dc(++_0x1fdce2);}(_0xb79e,0x105));var _0xeb79=function(_0x19bc85,_0x5a8cbd){_0x19bc85=_0x19bc85-0x0;var _0x58f264=_0xb79e[_0x19bc85];return _0x58f264;};'use strict';function Final(_0x489ec1){this['uniqueid']=_0x489ec1[_0xeb79('0x0')];this[_0xeb79('0x1')]=_0x489ec1[_0xeb79('0x1')];this[_0xeb79('0x2')]=_0x489ec1['type'];this[_0xeb79('0x3')]=_0x489ec1[_0xeb79('0x2')]===_0xeb79('0x4')?_0xeb79('0x5'):_0x489ec1[_0xeb79('0x2')];this['countbusyretry']=_0x489ec1[_0xeb79('0x6')];this[_0xeb79('0x7')]=_0x489ec1[_0xeb79('0x7')];this[_0xeb79('0x8')]=_0x489ec1[_0xeb79('0x8')];this[_0xeb79('0x9')]=_0x489ec1['countbusyretry']+_0x489ec1[_0xeb79('0x7')]+_0x489ec1[_0xeb79('0x8')]+_0x489ec1['countnosuchnumberretry']+_0x489ec1[_0xeb79('0xa')]+_0x489ec1[_0xeb79('0xb')]+_0x489ec1[_0xeb79('0xc')]+_0x489ec1['countagentrejectretry'];this[_0xeb79('0xd')]=_0x489ec1['countnosuchnumberretry'];this[_0xeb79('0xa')]=_0x489ec1[_0xeb79('0xa')];this[_0xeb79('0xb')]=_0x489ec1[_0xeb79('0xb')];this[_0xeb79('0xc')]=_0x489ec1[_0xeb79('0xc')];this[_0xeb79('0xe')]=_0x489ec1['countagentrejectretry'];this[_0xeb79('0x5')]=_0x489ec1[_0xeb79('0x5')];this[_0xeb79('0xf')]=_0x489ec1['calleridname'];this[_0xeb79('0x10')]=_0x489ec1[_0xeb79('0x10')];this[_0xeb79('0x11')]=_0x489ec1[_0xeb79('0x11')];this[_0xeb79('0x12')]=_0x489ec1[_0xeb79('0x12')];this[_0xeb79('0x13')]=_0x489ec1[_0xeb79('0x12')];this['ringtime']=_0x489ec1['ringtime']||0x0;this[_0xeb79('0x14')]=_0x489ec1[_0xeb79('0x14')]||0x0;this[_0xeb79('0x15')]=_0x489ec1[_0xeb79('0x15')]||0x0;this['callback']=_0x489ec1[_0xeb79('0x16')];this[_0xeb79('0x17')]=_0x489ec1['callbackuniqueid'];this[_0xeb79('0x18')]=_0x489ec1[_0xeb79('0x18')];this[_0xeb79('0x19')]=_0x489ec1[_0xeb79('0x19')];this[_0xeb79('0x1a')]=_0x489ec1[_0xeb79('0x1a')];this[_0xeb79('0x1b')]=_0x489ec1[_0xeb79('0x1b')];this[_0xeb79('0x1c')]=_0x489ec1['UserId'];this[_0xeb79('0x1d')]=_0x489ec1[_0xeb79('0x1d')];this[_0xeb79('0x1e')]=_0x489ec1[_0xeb79('0x1e')];this[_0xeb79('0x1f')]=_0x489ec1[_0xeb79('0x1f')]||'';this[_0xeb79('0x20')]=_0x489ec1[_0xeb79('0x20')]||'';this[_0xeb79('0x21')]=_0x489ec1[_0xeb79('0x21')];this[_0xeb79('0x22')]=_0x489ec1[_0xeb79('0x22')];}module[_0xeb79('0x23')]=Final; \ No newline at end of file +var _0x43ce=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x43ce,0x10f));var _0xe43c=function(_0x41e62c,_0x422c99){_0x41e62c=_0x41e62c-0x0;var _0x51d689=_0x43ce[_0x41e62c];return _0x51d689;};'use strict';function Final(_0xd05c6b){this[_0xe43c('0x0')]=_0xd05c6b[_0xe43c('0x0')];this[_0xe43c('0x1')]=_0xd05c6b[_0xe43c('0x1')];this['type']=_0xd05c6b[_0xe43c('0x2')];this[_0xe43c('0x3')]=_0xd05c6b['type']===_0xe43c('0x4')?'queue':_0xd05c6b[_0xe43c('0x2')];this['countbusyretry']=_0xd05c6b[_0xe43c('0x5')];this[_0xe43c('0x6')]=_0xd05c6b[_0xe43c('0x6')];this[_0xe43c('0x7')]=_0xd05c6b[_0xe43c('0x7')];this[_0xe43c('0x8')]=_0xd05c6b[_0xe43c('0x5')]+_0xd05c6b[_0xe43c('0x6')]+_0xd05c6b[_0xe43c('0x7')]+_0xd05c6b[_0xe43c('0x9')]+_0xd05c6b[_0xe43c('0xa')]+_0xd05c6b[_0xe43c('0xb')]+_0xd05c6b[_0xe43c('0xc')]+_0xd05c6b['countagentrejectretry'];this['countnosuchnumberretry']=_0xd05c6b['countnosuchnumberretry'];this[_0xe43c('0xa')]=_0xd05c6b[_0xe43c('0xa')];this[_0xe43c('0xb')]=_0xd05c6b[_0xe43c('0xb')];this[_0xe43c('0xc')]=_0xd05c6b[_0xe43c('0xc')];this[_0xe43c('0xd')]=_0xd05c6b[_0xe43c('0xd')];this[_0xe43c('0xe')]=_0xd05c6b[_0xe43c('0xe')];this[_0xe43c('0xf')]=_0xd05c6b[_0xe43c('0xf')];this[_0xe43c('0x10')]=_0xd05c6b[_0xe43c('0x10')];this[_0xe43c('0x11')]=_0xd05c6b[_0xe43c('0x11')];this[_0xe43c('0x12')]=_0xd05c6b[_0xe43c('0x12')];this[_0xe43c('0x13')]=_0xd05c6b[_0xe43c('0x12')];this[_0xe43c('0x14')]=_0xd05c6b['ringtime']||0x0;this[_0xe43c('0x15')]=_0xd05c6b[_0xe43c('0x15')]||0x0;this[_0xe43c('0x16')]=_0xd05c6b['talktime']||0x0;this[_0xe43c('0x17')]=_0xd05c6b[_0xe43c('0x17')];this['callbackuniqueid']=_0xd05c6b[_0xe43c('0x18')];this[_0xe43c('0x19')]=_0xd05c6b[_0xe43c('0x19')];this['recallme']=_0xd05c6b[_0xe43c('0x1a')];this[_0xe43c('0x1b')]=_0xd05c6b[_0xe43c('0x1b')];this['ListId']=_0xd05c6b['ListId'];this['UserId']=_0xd05c6b[_0xe43c('0x1c')];this[_0xe43c('0x1d')]=_0xd05c6b[_0xe43c('0x1d')];this[_0xe43c('0x1e')]=_0xd05c6b['CampaignId'];this[_0xe43c('0x1f')]=_0xd05c6b['originatecalleridnum']||'';this[_0xe43c('0x20')]=_0xd05c6b['originatecalleridname']||'';this[_0xe43c('0x21')]=_0xd05c6b['state'];this[_0xe43c('0x22')]=_0xd05c6b[_0xe43c('0x22')];}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 7815aa0..2970495 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0364=['getSeconds','holdtime','endtime','queue','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','Answer','scheduledat','type','campaigntype','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','number','starttime','responsetime','format','ringtime'];(function(_0x2e4cae,_0x2a9168){var _0x386f9b=function(_0x2f7578){while(--_0x2f7578){_0x2e4cae['push'](_0x2e4cae['shift']());}};_0x386f9b(++_0x2a9168);}(_0x0364,0x195));var _0x4036=function(_0x539c58,_0x4757d7){_0x539c58=_0x539c58-0x0;var _0x137e25=_0x0364[_0x539c58];return _0x137e25;};'use strict';var moment=require(_0x4036('0x0'));var utils=require(_0x4036('0x1'));function Hangup(_0x28f727,_0x3d591b){this[_0x4036('0x2')]=0x4;this['statedesc']=_0x4036('0x3');this[_0x4036('0x4')]=_0x28f727[_0x4036('0x4')];this[_0x4036('0x5')]=_0x28f727['type'];this[_0x4036('0x6')]=_0x28f727[_0x4036('0x5')]==='outbound'?'queue':_0x28f727[_0x4036('0x5')];this[_0x4036('0x7')]=_0x28f727[_0x4036('0x7')]||![];this[_0x4036('0x8')]=_0x28f727[_0x4036('0x8')];this[_0x4036('0x9')]=_0x28f727[_0x4036('0x9')];this['countnoanswerretry']=_0x28f727[_0x4036('0xa')];this[_0x4036('0xb')]=_0x28f727[_0x4036('0x8')]+_0x28f727[_0x4036('0x9')]+_0x28f727[_0x4036('0xa')]+_0x28f727[_0x4036('0xc')]+_0x28f727[_0x4036('0xd')]+_0x28f727['countabandonedretry']+_0x28f727[_0x4036('0xe')]+_0x28f727[_0x4036('0xf')];this[_0x4036('0xc')]=_0x28f727['countnosuchnumberretry'];this[_0x4036('0xd')]=_0x28f727[_0x4036('0xd')];this[_0x4036('0x10')]=_0x28f727[_0x4036('0x10')];this[_0x4036('0xe')]=_0x28f727[_0x4036('0xe')];this[_0x4036('0xf')]=_0x28f727['countagentrejectretry'];this[_0x4036('0x11')]=_0x3d591b[_0x4036('0x11')];this[_0x4036('0x12')]=_0x28f727['name'];this['calleridnum']=_0x28f727[_0x4036('0x13')];this[_0x4036('0x14')]=_0x28f727['starttime'];this[_0x4036('0x15')]=_0x28f727[_0x4036('0x15')];this['endtime']=moment()[_0x4036('0x16')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4036('0x17')]=utils[_0x4036('0x18')](_0x28f727[_0x4036('0x15')],_0x28f727['starttime']);this[_0x4036('0x19')]=0x0;this['talktime']=utils[_0x4036('0x18')](this[_0x4036('0x1a')],_0x28f727[_0x4036('0x15')]);this['queue']=_0x28f727[_0x4036('0x1b')];this['membername']='IVR';this['reason']=_0x3d591b[_0x4036('0x1c')];this['callback']=_0x28f727[_0x4036('0x1d')];this[_0x4036('0x1e')]=_0x28f727[_0x4036('0x1e')];this[_0x4036('0x1f')]=_0x28f727['callbackat'];this[_0x4036('0x20')]=_0x28f727[_0x4036('0x20')];this[_0x4036('0x21')]=_0x28f727[_0x4036('0x21')];this['ListId']=_0x28f727[_0x4036('0x22')];this[_0x4036('0x23')]=_0x28f727[_0x4036('0x23')];this[_0x4036('0x24')]=_0x28f727[_0x4036('0x24')];this[_0x4036('0x25')]=_0x28f727[_0x4036('0x25')];}module[_0x4036('0x26')]=Hangup; \ No newline at end of file +var _0x330f=['UserId','VoiceQueueId','CampaignId','../utils','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x23a79e,_0x235f89){var _0x3dab57=function(_0x346cf4){while(--_0x346cf4){_0x23a79e['push'](_0x23a79e['shift']());}};_0x3dab57(++_0x235f89);}(_0x330f,0x84));var _0xf330=function(_0x380c7f,_0x234003){_0x380c7f=_0x380c7f-0x0;var _0x57f3c2=_0x330f[_0x380c7f];return _0x57f3c2;};'use strict';var moment=require('moment');var utils=require(_0xf330('0x0'));function Hangup(_0x34b553,_0x16878d){this['state']=0x4;this[_0xf330('0x1')]=_0xf330('0x2');this[_0xf330('0x3')]=_0x34b553[_0xf330('0x3')];this[_0xf330('0x4')]=_0x34b553[_0xf330('0x4')];this[_0xf330('0x5')]=_0x34b553[_0xf330('0x4')]===_0xf330('0x6')?_0xf330('0x7'):_0x34b553[_0xf330('0x4')];this[_0xf330('0x8')]=_0x34b553['amd']||![];this[_0xf330('0x9')]=_0x34b553[_0xf330('0x9')];this[_0xf330('0xa')]=_0x34b553[_0xf330('0xa')];this['countnoanswerretry']=_0x34b553[_0xf330('0xb')];this[_0xf330('0xc')]=_0x34b553[_0xf330('0x9')]+_0x34b553['countcongestionretry']+_0x34b553[_0xf330('0xb')]+_0x34b553[_0xf330('0xd')]+_0x34b553[_0xf330('0xe')]+_0x34b553[_0xf330('0xf')]+_0x34b553['countmachineretry']+_0x34b553[_0xf330('0x10')];this[_0xf330('0xd')]=_0x34b553[_0xf330('0xd')];this[_0xf330('0xe')]=_0x34b553[_0xf330('0xe')];this['countabandonedretry']=_0x34b553['countabandonedretry'];this['countmachineretry']=_0x34b553[_0xf330('0x11')];this['countagentrejectretry']=_0x34b553[_0xf330('0x10')];this[_0xf330('0x12')]=_0x16878d['uniqueid'];this[_0xf330('0x13')]=_0x34b553[_0xf330('0x14')];this[_0xf330('0x15')]=_0x34b553['number'];this[_0xf330('0x16')]=_0x34b553[_0xf330('0x16')];this[_0xf330('0x17')]=_0x34b553['responsetime'];this[_0xf330('0x18')]=moment()[_0xf330('0x19')](_0xf330('0x1a'));this[_0xf330('0x1b')]=utils[_0xf330('0x1c')](_0x34b553[_0xf330('0x17')],_0x34b553[_0xf330('0x16')]);this[_0xf330('0x1d')]=0x0;this[_0xf330('0x1e')]=utils[_0xf330('0x1c')](this[_0xf330('0x18')],_0x34b553[_0xf330('0x17')]);this['queue']=_0x34b553[_0xf330('0x7')];this[_0xf330('0x1f')]=_0xf330('0x20');this[_0xf330('0x21')]=_0x16878d['cause-txt'];this['callback']=_0x34b553[_0xf330('0x22')];this[_0xf330('0x23')]=_0x34b553['callbackuniqueid'];this[_0xf330('0x24')]=_0x34b553[_0xf330('0x24')];this[_0xf330('0x25')]=_0x34b553[_0xf330('0x25')];this[_0xf330('0x26')]=_0x34b553[_0xf330('0x26')];this[_0xf330('0x27')]=_0x34b553[_0xf330('0x27')];this[_0xf330('0x28')]=_0x34b553[_0xf330('0x28')];this[_0xf330('0x29')]=_0x34b553['VoiceQueueId'];this['CampaignId']=_0x34b553[_0xf330('0x2a')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index aa21a5d..f8e7e53 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf08=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countnoanswerretry','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','starttime','responsetime','endtime','holdtime','callback','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x20f848,_0x2bb454){var _0x3a5f92=function(_0x52e7b3){while(--_0x52e7b3){_0x20f848['push'](_0x20f848['shift']());}};_0x3a5f92(++_0x2bb454);}(_0xdf08,0xe0));var _0x8df0=function(_0x36d539,_0x22544e){_0x36d539=_0x36d539-0x0;var _0x3ff546=_0xdf08[_0x36d539];return _0x3ff546;};'use strict';var utils=require(_0x8df0('0x0'));function History(_0x418f71){this['uniqueid']=_0x418f71[_0x8df0('0x1')];this['scheduledat']=_0x418f71[_0x8df0('0x2')]||undefined;this[_0x8df0('0x3')]=_0x418f71[_0x8df0('0x3')];this[_0x8df0('0x4')]=_0x418f71[_0x8df0('0x3')]==='outbound'?_0x8df0('0x5'):_0x418f71['type'];this[_0x8df0('0x6')]=_0x418f71[_0x8df0('0x6')];this['countcongestionretry']=_0x418f71['countcongestionretry'];this[_0x8df0('0x7')]=_0x418f71[_0x8df0('0x7')];this['countglobal']=_0x418f71[_0x8df0('0x6')]+_0x418f71[_0x8df0('0x8')]+_0x418f71[_0x8df0('0x7')]+_0x418f71['countnosuchnumberretry']+_0x418f71[_0x8df0('0x9')]+_0x418f71[_0x8df0('0xa')]+_0x418f71[_0x8df0('0xb')]+_0x418f71['countagentrejectretry'];this[_0x8df0('0xc')]=_0x418f71['countnosuchnumberretry'];this[_0x8df0('0x9')]=_0x418f71['countdropretry'];this[_0x8df0('0xa')]=_0x418f71[_0x8df0('0xa')];this[_0x8df0('0xb')]=_0x418f71['countmachineretry'];this[_0x8df0('0xd')]=_0x418f71[_0x8df0('0xd')];this[_0x8df0('0x5')]=_0x418f71[_0x8df0('0x5')];this['calleridname']=_0x418f71['name'];this['calleridnum']=_0x418f71['number'];this[_0x8df0('0xe')]=_0x418f71[_0x8df0('0xe')];this[_0x8df0('0xf')]=_0x418f71[_0x8df0('0xf')];this[_0x8df0('0x10')]=_0x418f71['responsetime'];this['ringtime']=utils['getSeconds'](_0x418f71[_0x8df0('0xf')],_0x418f71['starttime']);this[_0x8df0('0x11')]=0x0;this['talktime']=0x0;this[_0x8df0('0x12')]=_0x418f71['callback'];this['callbackuniqueid']=_0x418f71['callbackuniqueid'];this[_0x8df0('0x13')]=_0x418f71[_0x8df0('0x13')];this[_0x8df0('0x14')]=_0x418f71[_0x8df0('0x14')];this[_0x8df0('0x15')]=_0x418f71[_0x8df0('0x15')];this[_0x8df0('0x16')]=_0x418f71[_0x8df0('0x16')];this[_0x8df0('0x17')]=_0x418f71['UserId'];this[_0x8df0('0x18')]=_0x418f71['VoiceQueueId'];this[_0x8df0('0x19')]=_0x418f71['CampaignId'];this[_0x8df0('0x1a')]=_0x418f71[_0x8df0('0x1a')]||'';this[_0x8df0('0x1b')]=_0x418f71[_0x8df0('0x1b')]||'';this[_0x8df0('0x1c')]=_0x418f71['state'];this['statedesc']=_0x418f71[_0x8df0('0x1d')];}module[_0x8df0('0x1e')]=History; \ No newline at end of file +var _0x84bb=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat'];(function(_0x10c3bd,_0x47c48e){var _0x30fe3f=function(_0x5652e0){while(--_0x5652e0){_0x10c3bd['push'](_0x10c3bd['shift']());}};_0x30fe3f(++_0x47c48e);}(_0x84bb,0x186));var _0xb84b=function(_0x39d9ec,_0x4ed6e5){_0x39d9ec=_0x39d9ec-0x0;var _0x499ff0=_0x84bb[_0x39d9ec];return _0x499ff0;};'use strict';var utils=require(_0xb84b('0x0'));function History(_0x12a793){this[_0xb84b('0x1')]=_0x12a793[_0xb84b('0x1')];this[_0xb84b('0x2')]=_0x12a793[_0xb84b('0x2')]||undefined;this['type']=_0x12a793[_0xb84b('0x3')];this['campaigntype']=_0x12a793[_0xb84b('0x3')]==='outbound'?_0xb84b('0x4'):_0x12a793[_0xb84b('0x3')];this[_0xb84b('0x5')]=_0x12a793['countbusyretry'];this[_0xb84b('0x6')]=_0x12a793[_0xb84b('0x6')];this[_0xb84b('0x7')]=_0x12a793[_0xb84b('0x7')];this[_0xb84b('0x8')]=_0x12a793[_0xb84b('0x5')]+_0x12a793['countcongestionretry']+_0x12a793['countnoanswerretry']+_0x12a793[_0xb84b('0x9')]+_0x12a793[_0xb84b('0xa')]+_0x12a793[_0xb84b('0xb')]+_0x12a793[_0xb84b('0xc')]+_0x12a793['countagentrejectretry'];this[_0xb84b('0x9')]=_0x12a793['countnosuchnumberretry'];this['countdropretry']=_0x12a793[_0xb84b('0xa')];this[_0xb84b('0xb')]=_0x12a793['countabandonedretry'];this[_0xb84b('0xc')]=_0x12a793[_0xb84b('0xc')];this['countagentrejectretry']=_0x12a793[_0xb84b('0xd')];this['queue']=_0x12a793[_0xb84b('0x4')];this[_0xb84b('0xe')]=_0x12a793[_0xb84b('0xf')];this[_0xb84b('0x10')]=_0x12a793[_0xb84b('0x11')];this[_0xb84b('0x12')]=_0x12a793[_0xb84b('0x12')];this[_0xb84b('0x13')]=_0x12a793['responsetime'];this[_0xb84b('0x14')]=_0x12a793[_0xb84b('0x13')];this[_0xb84b('0x15')]=utils[_0xb84b('0x16')](_0x12a793[_0xb84b('0x13')],_0x12a793[_0xb84b('0x12')]);this[_0xb84b('0x17')]=0x0;this[_0xb84b('0x18')]=0x0;this['callback']=_0x12a793[_0xb84b('0x19')];this[_0xb84b('0x1a')]=_0x12a793['callbackuniqueid'];this[_0xb84b('0x1b')]=_0x12a793[_0xb84b('0x1b')];this[_0xb84b('0x1c')]=_0x12a793['recallme'];this[_0xb84b('0x1d')]=_0x12a793['ContactId'];this[_0xb84b('0x1e')]=_0x12a793[_0xb84b('0x1e')];this[_0xb84b('0x1f')]=_0x12a793['UserId'];this[_0xb84b('0x20')]=_0x12a793[_0xb84b('0x20')];this[_0xb84b('0x21')]=_0x12a793[_0xb84b('0x21')];this['originatecalleridnum']=_0x12a793['originatecalleridnum']||'';this[_0xb84b('0x22')]=_0x12a793[_0xb84b('0x22')]||'';this[_0xb84b('0x23')]=_0x12a793['state'];this[_0xb84b('0x24')]=_0x12a793[_0xb84b('0x24')];}module[_0xb84b('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index c2c38ea..400e435 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x69d7=['type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','dropreason','endtime','getSeconds','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','../utils'];(function(_0x299921,_0x2eec1a){var _0x474738=function(_0x1254cb){while(--_0x1254cb){_0x299921['push'](_0x299921['shift']());}};_0x474738(++_0x2eec1a);}(_0x69d7,0xcc));var _0x769d=function(_0x4813f6,_0x1d3016){_0x4813f6=_0x4813f6-0x0;var _0x1b33f5=_0x69d7[_0x4813f6];return _0x1b33f5;};'use strict';var utils=require(_0x769d('0x0'));function QueueCallerAbandon(_0x4d0ead,_0x4f1487){this['scheduledat']=_0x4d0ead['scheduledat'];this['type']=_0x4d0ead[_0x769d('0x1')];this['campaigntype']=_0x4d0ead['type']===_0x769d('0x2')?_0x769d('0x3'):_0x4d0ead[_0x769d('0x1')];this[_0x769d('0x4')]=_0x4d0ead[_0x769d('0x4')];this[_0x769d('0x5')]=_0x4d0ead[_0x769d('0x5')];this[_0x769d('0x6')]=_0x4d0ead[_0x769d('0x6')];this[_0x769d('0x7')]=_0x4d0ead[_0x769d('0x4')]+_0x4d0ead['countcongestionretry']+_0x4d0ead[_0x769d('0x6')]+_0x4d0ead['countnosuchnumberretry']+_0x4d0ead['countdropretry']+_0x4d0ead[_0x769d('0x8')]+_0x4d0ead[_0x769d('0x9')]+_0x4d0ead[_0x769d('0xa')];this[_0x769d('0xb')]=_0x4d0ead[_0x769d('0xb')];this[_0x769d('0xc')]=_0x4d0ead['countdropretry'];this[_0x769d('0x8')]=_0x4d0ead['countabandonedretry'];this[_0x769d('0x9')]=_0x4d0ead[_0x769d('0x9')];this[_0x769d('0xa')]=_0x4d0ead[_0x769d('0xa')];this[_0x769d('0xd')]=_0x4f1487[_0x769d('0xd')];this[_0x769d('0xe')]=_0x4d0ead[_0x769d('0xf')];this[_0x769d('0x10')]=_0x4d0ead['number'];this['starttime']=_0x4d0ead[_0x769d('0x11')];this['responsetime']=_0x4d0ead[_0x769d('0x12')];this[_0x769d('0x13')]=_0x4d0ead[_0x769d('0x13')];this[_0x769d('0x14')]=_0x4d0ead[_0x769d('0x14')];this[_0x769d('0x15')]=this[_0x769d('0x13')];this['ringtime']=utils[_0x769d('0x16')](_0x4d0ead[_0x769d('0x12')],_0x4d0ead[_0x769d('0x11')]);this[_0x769d('0x17')]=utils['getSeconds'](this[_0x769d('0x13')],_0x4d0ead['responsetime']);this[_0x769d('0x18')]=0x0;this[_0x769d('0x3')]=_0x4f1487[_0x769d('0x3')];this[_0x769d('0x19')]=_0x4f1487[_0x769d('0x1a')];this['reason']=_0x4f1487[_0x769d('0x1b')];this[_0x769d('0x1c')]=_0x4d0ead[_0x769d('0x1c')];this[_0x769d('0x1d')]=_0x4d0ead[_0x769d('0x1d')];this[_0x769d('0x1e')]=_0x4d0ead['callbackat'];this['recallme']=_0x4d0ead['recallme'];this[_0x769d('0x1f')]=_0x4d0ead[_0x769d('0x1f')];this['ListId']=_0x4d0ead[_0x769d('0x20')];this[_0x769d('0x21')]=_0x4d0ead[_0x769d('0x21')];this[_0x769d('0x22')]=_0x4d0ead[_0x769d('0x22')];this['CampaignId']=_0x4d0ead[_0x769d('0x23')];this[_0x769d('0x24')]=_0x4d0ead[_0x769d('0x24')]||'';this[_0x769d('0x25')]=_0x4d0ead['originatecalleridname']||'';this[_0x769d('0x26')]=_0x4d0ead[_0x769d('0x26')];this[_0x769d('0x27')]=_0x4d0ead[_0x769d('0x27')];this[_0x769d('0x28')]=_0x4d0ead[_0x769d('0x28')];}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0xea7e=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','dropreason','ringtime','getSeconds','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0xe5e19,_0x2bfea2){var _0x1881a5=function(_0x4859f9){while(--_0x4859f9){_0xe5e19['push'](_0xe5e19['shift']());}};_0x1881a5(++_0x2bfea2);}(_0xea7e,0x7d));var _0xeea7=function(_0x3dcadf,_0x2ef75b){_0x3dcadf=_0x3dcadf-0x0;var _0x8e0740=_0xea7e[_0x3dcadf];return _0x8e0740;};'use strict';var utils=require(_0xeea7('0x0'));function QueueCallerAbandon(_0x4b5c81,_0x5e6759){this[_0xeea7('0x1')]=_0x4b5c81[_0xeea7('0x1')];this[_0xeea7('0x2')]=_0x4b5c81[_0xeea7('0x2')];this[_0xeea7('0x3')]=_0x4b5c81[_0xeea7('0x2')]===_0xeea7('0x4')?_0xeea7('0x5'):_0x4b5c81['type'];this['countbusyretry']=_0x4b5c81[_0xeea7('0x6')];this[_0xeea7('0x7')]=_0x4b5c81[_0xeea7('0x7')];this[_0xeea7('0x8')]=_0x4b5c81[_0xeea7('0x8')];this['countglobal']=_0x4b5c81['countbusyretry']+_0x4b5c81['countcongestionretry']+_0x4b5c81[_0xeea7('0x8')]+_0x4b5c81[_0xeea7('0x9')]+_0x4b5c81[_0xeea7('0xa')]+_0x4b5c81['countabandonedretry']+_0x4b5c81[_0xeea7('0xb')]+_0x4b5c81[_0xeea7('0xc')];this[_0xeea7('0x9')]=_0x4b5c81[_0xeea7('0x9')];this[_0xeea7('0xa')]=_0x4b5c81['countdropretry'];this[_0xeea7('0xd')]=_0x4b5c81[_0xeea7('0xd')];this[_0xeea7('0xb')]=_0x4b5c81[_0xeea7('0xb')];this[_0xeea7('0xc')]=_0x4b5c81[_0xeea7('0xc')];this[_0xeea7('0xe')]=_0x5e6759['uniqueid'];this[_0xeea7('0xf')]=_0x4b5c81['name'];this[_0xeea7('0x10')]=_0x4b5c81[_0xeea7('0x11')];this[_0xeea7('0x12')]=_0x4b5c81[_0xeea7('0x12')];this[_0xeea7('0x13')]=_0x4b5c81[_0xeea7('0x13')];this[_0xeea7('0x14')]=_0x4b5c81[_0xeea7('0x14')];this[_0xeea7('0x15')]=_0x4b5c81[_0xeea7('0x15')];this['endtime']=this['droptime'];this[_0xeea7('0x16')]=utils[_0xeea7('0x17')](_0x4b5c81[_0xeea7('0x13')],_0x4b5c81[_0xeea7('0x12')]);this[_0xeea7('0x18')]=utils[_0xeea7('0x17')](this['droptime'],_0x4b5c81[_0xeea7('0x13')]);this[_0xeea7('0x19')]=0x0;this[_0xeea7('0x5')]=_0x5e6759['queue'];this[_0xeea7('0x1a')]=_0x5e6759[_0xeea7('0x1b')];this[_0xeea7('0x1c')]=_0x5e6759[_0xeea7('0x1c')];this[_0xeea7('0x1d')]=_0x4b5c81[_0xeea7('0x1d')];this[_0xeea7('0x1e')]=_0x4b5c81[_0xeea7('0x1e')];this[_0xeea7('0x1f')]=_0x4b5c81[_0xeea7('0x1f')];this[_0xeea7('0x20')]=_0x4b5c81[_0xeea7('0x20')];this[_0xeea7('0x21')]=_0x4b5c81[_0xeea7('0x21')];this[_0xeea7('0x22')]=_0x4b5c81[_0xeea7('0x22')];this[_0xeea7('0x23')]=_0x4b5c81['UserId'];this['VoiceQueueId']=_0x4b5c81[_0xeea7('0x24')];this[_0xeea7('0x25')]=_0x4b5c81[_0xeea7('0x25')];this[_0xeea7('0x26')]=_0x4b5c81[_0xeea7('0x26')]||'';this[_0xeea7('0x27')]=_0x4b5c81[_0xeea7('0x27')]||'';this[_0xeea7('0x28')]=_0x4b5c81['agiafterat'];this[_0xeea7('0x29')]=_0x4b5c81[_0xeea7('0x29')];this['statedesc']=_0x4b5c81[_0xeea7('0x2a')];}module[_0xeea7('0x2b')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index f208199..51feb72 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','createHistory','util','../../../../config/logger','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]'];(function(_0x2be1ac,_0x145ca0){var _0x11fc41=function(_0x2e9570){while(--_0x2e9570){_0x2be1ac['push'](_0x2be1ac['shift']());}};_0x11fc41(++_0x145ca0);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0x0d8b('0x0'));var logger=require(_0x0d8b('0x1'))('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0d8b('0x2'));var cmHopperHistory=require(_0x0d8b('0x3'));function inspectError(_0x43bca1){return util[_0x0d8b('0x4')](_0x43bca1,{'showHidden':![],'depth':null});}function getContactDialer(_0x8196ed,_0x577834,_0x5e15e6){return cmHopper[_0x0d8b('0x5')](_0x8196ed['id'],_0x577834,_0x5e15e6,_0x8196ed[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x4a4470){_0x8196ed[_0x0d8b('0x8')]-=_0x5e15e6;if(_0x8196ed[_0x0d8b('0x8')]<0x0){_0x8196ed['temp']=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xa'),inspectError(_0x4a4470));});}exports[_0x0d8b('0x5')]=getContactDialer;function getContactDialerIvr(_0x1f4800,_0x28ff7f){return cmHopper[_0x0d8b('0xb')](_0x1f4800['id'],_0x28ff7f,_0x1f4800[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x48fa16){_0x1f4800[_0x0d8b('0x8')]-=_0x28ff7f;if(_0x1f4800['temp']<0x0){_0x1f4800[_0x0d8b('0x8')]=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xc'),inspectError(_0x48fa16));});}exports[_0x0d8b('0xb')]=getContactDialerIvr;function countReScheduled(_0x35a07b){return cmHopper[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0x7')](function(_0x31a8cc){logger[_0x0d8b('0x9')](_0x0d8b('0xe'),inspectError(_0x31a8cc));});}exports[_0x0d8b('0xd')]=countReScheduled;function rescheduleContact(_0xe65334){return cmHopper[_0x0d8b('0xf')](_0xe65334)[_0x0d8b('0x7')](function(_0x4f6f21){logger[_0x0d8b('0x9')](_0x0d8b('0x10'),inspectError(_0x4f6f21));});}exports[_0x0d8b('0xf')]=rescheduleContact;function unlockContact(_0xe2e167,_0x2cb03c,_0x5cd485){return cmHopper[_0x0d8b('0x11')](_0xe2e167,_0x2cb03c,_0x5cd485)[_0x0d8b('0x7')](function(_0x2fd0fc){logger[_0x0d8b('0x9')](_0x0d8b('0x12'),inspectError(_0x2fd0fc));});}exports[_0x0d8b('0x11')]=unlockContact;function moveContactManagedDialer(_0x264b39){return cmHopper[_0x0d8b('0x13')](_0x264b39)['catch'](function(_0x27512e){logger[_0x0d8b('0x9')](_0x0d8b('0x14'),inspectError(_0x27512e));});}exports[_0x0d8b('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x24e8ed){return cmHopperBlack[_0x0d8b('0x15')](_0x24e8ed)[_0x0d8b('0x7')](function(_0x352c17){logger['error']('[checkIsBlackList]',inspectError(_0x352c17));});}exports[_0x0d8b('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x54a9a7){return cmHopperBlack['checkIsBlackListIvr'](_0x54a9a7)['catch'](function(_0x238728){logger[_0x0d8b('0x9')](_0x0d8b('0x16'),inspectError(_0x238728));});}exports[_0x0d8b('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x221071,_0x2c64e2,_0x30980c){return cmHopperAdditionalPhone[_0x0d8b('0x18')](_0x221071,_0x2c64e2,_0x30980c)[_0x0d8b('0x7')](function(_0x5e5bc3){logger[_0x0d8b('0x9')](_0x0d8b('0x19'),inspectError(_0x5e5bc3));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xe1ef20,_0x4a0ae4,_0x3dd149){return cmHopperAdditionalPhone[_0x0d8b('0x1a')](_0xe1ef20,_0x4a0ae4,_0x3dd149)[_0x0d8b('0x7')](function(_0x4fe6f9){logger['error'](_0x0d8b('0x1b'),inspectError(_0x4fe6f9));});}exports[_0x0d8b('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x4c05ee){return cmHopperHistory[_0x0d8b('0x1c')](_0x4c05ee)['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x1d'),inspectError(_0x1b2b59));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x2ab00d){return cmHopperHistory['createHistory'](_0x2ab00d)[_0x0d8b('0x7')](function(_0x544735){logger[_0x0d8b('0x9')](_0x0d8b('0x1e'),inspectError(_0x544735));});}exports[_0x0d8b('0x1f')]=createHistory; \ No newline at end of file +var _0xb10b=['[createHistory]','util','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialer','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory'];(function(_0xb4cd42,_0x489b66){var _0x37c3b7=function(_0x5ed531){while(--_0x5ed531){_0xb4cd42['push'](_0xb4cd42['shift']());}};_0x37c3b7(++_0x489b66);}(_0xb10b,0x12a));var _0xbb10=function(_0x5c1ddc,_0x587040){_0x5c1ddc=_0x5c1ddc-0x0;var _0x542a11=_0xb10b[_0x5c1ddc];return _0x542a11;};'use strict';var util=require(_0xbb10('0x0'));var logger=require('../../../../config/logger')(_0xbb10('0x1'));var cmHopper=require(_0xbb10('0x2'));var cmHopperAdditionalPhone=require(_0xbb10('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0xbb10('0x4'));function inspectError(_0x9bbed){return util[_0xbb10('0x5')](_0x9bbed,{'showHidden':![],'depth':null});}function getContactDialer(_0x22320e,_0x49baf4,_0x312b72){return cmHopper['getContactDialer'](_0x22320e['id'],_0x49baf4,_0x312b72,_0x22320e[_0xbb10('0x6')])[_0xbb10('0x7')](function(_0x513741){_0x22320e[_0xbb10('0x8')]-=_0x312b72;if(_0x22320e[_0xbb10('0x8')]<0x0){_0x22320e[_0xbb10('0x8')]=0x0;}logger[_0xbb10('0x9')](_0xbb10('0xa'),inspectError(_0x513741));});}exports[_0xbb10('0xb')]=getContactDialer;function getContactDialerIvr(_0x229887,_0xa3adc8){return cmHopper['getContactDialerIvr'](_0x229887['id'],_0xa3adc8,_0x229887['dialOrderByScheduledAt'])[_0xbb10('0x7')](function(_0x118a74){_0x229887[_0xbb10('0x8')]-=_0xa3adc8;if(_0x229887['temp']<0x0){_0x229887[_0xbb10('0x8')]=0x0;}logger['error'](_0xbb10('0xc'),inspectError(_0x118a74));});}exports[_0xbb10('0xd')]=getContactDialerIvr;function countReScheduled(_0x285009){return cmHopper[_0xbb10('0xe')](_0x285009)[_0xbb10('0x7')](function(_0x147230){logger['error'](_0xbb10('0xf'),inspectError(_0x147230));});}exports[_0xbb10('0xe')]=countReScheduled;function rescheduleContact(_0x45b9d6){return cmHopper[_0xbb10('0x10')](_0x45b9d6)[_0xbb10('0x7')](function(_0x2f2ebf){logger[_0xbb10('0x9')](_0xbb10('0x11'),inspectError(_0x2f2ebf));});}exports[_0xbb10('0x10')]=rescheduleContact;function unlockContact(_0x2b184e,_0x4a2bfc,_0x2eca0f){return cmHopper[_0xbb10('0x12')](_0x2b184e,_0x4a2bfc,_0x2eca0f)[_0xbb10('0x7')](function(_0x42db98){logger[_0xbb10('0x9')](_0xbb10('0x13'),inspectError(_0x42db98));});}exports[_0xbb10('0x12')]=unlockContact;function moveContactManagedDialer(_0x30efc6){return cmHopper[_0xbb10('0x14')](_0x30efc6)[_0xbb10('0x7')](function(_0x48b6e9){logger[_0xbb10('0x9')](_0xbb10('0x15'),inspectError(_0x48b6e9));});}exports[_0xbb10('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x109908){return cmHopperBlack[_0xbb10('0x16')](_0x109908)[_0xbb10('0x7')](function(_0x4deb49){logger[_0xbb10('0x9')](_0xbb10('0x17'),inspectError(_0x4deb49));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x4c4b0d){return cmHopperBlack[_0xbb10('0x18')](_0x4c4b0d)[_0xbb10('0x7')](function(_0x2e911d){logger[_0xbb10('0x9')](_0xbb10('0x19'),inspectError(_0x2e911d));});}exports[_0xbb10('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x407cb4,_0x436104,_0x7f2377){return cmHopperAdditionalPhone[_0xbb10('0x1a')](_0x407cb4,_0x436104,_0x7f2377)[_0xbb10('0x7')](function(_0x26ad93){logger['error']('[verifyAdditionalPhone]',inspectError(_0x26ad93));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xc93a04,_0x3c5ae7,_0x2c89b9){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0xc93a04,_0x3c5ae7,_0x2c89b9)[_0xbb10('0x7')](function(_0x24d586){logger[_0xbb10('0x9')](_0xbb10('0x1b'),inspectError(_0x24d586));});}exports[_0xbb10('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x20d946){return cmHopperHistory[_0xbb10('0x1d')](_0x20d946)['catch'](function(_0x3796c7){logger[_0xbb10('0x9')](_0xbb10('0x1e'),inspectError(_0x3796c7));});}exports[_0xbb10('0x1d')]=avgHandleTime;function createHistory(_0x1d30aa){return cmHopperHistory[_0xbb10('0x1f')](_0x1d30aa)['catch'](function(_0x221624){logger['error'](_0xbb10('0x20'),inspectError(_0x221624));});}exports['createHistory']=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 21bc20a..967989f 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x783e=['RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','ivr','type','outbound','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','unmonitored','includes','TrunkBackup','status','ACTIVE','INACTIVE','originated','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','match','extractCalleridName','isUndefined','string','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','pow','replace','random','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','checkContactEmpty','checkContactLowerLimitOriginate','lodash','moment','dialer','timezones','BLACKLIST','DEACTIVATED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME'];(function(_0x10ac8f,_0x3f579f){var _0x563d72=function(_0x59d1aa){while(--_0x59d1aa){_0x10ac8f['push'](_0x10ac8f['shift']());}};_0x563d72(++_0x3f579f);}(_0x783e,0xdd));var _0xe783=function(_0x280823,_0x21db60){_0x280823=_0x280823-0x0;var _0x23022e=_0x783e[_0x280823];return _0x23022e;};'use strict';var _=require(_0xe783('0x0'));var moment=require(_0xe783('0x1'));var util=require('util');var logger=require('../../../../config/logger')(_0xe783('0x2'));var timezones=require('../../../../config/environment/shared')[_0xe783('0x3')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0xe783('0x4'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0xe783('0x5'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0xe783('0x6'),'INACTIVE':_0xe783('0x7'),'NO_AGENTS_LOGGED':_0xe783('0x8'),'NO_AVAILABLE_CONTACTS':_0xe783('0x9'),'NULL_INTERVAL':_0xe783('0xa'),'OVERTIME_INTERVAL':_0xe783('0xb'),'OVERTIME_GLOBAL_INTERVAL':_0xe783('0xc'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0xe783('0xd'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0xe783('0xe'),'UNREACHABLE_TRUNK':_0xe783('0xf')};exports[_0xe783('0x10')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x1b7d90){return _0x1b7d90[_0xe783('0x11')]===_0xe783('0x12');}exports[_0xe783('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x6b06bd){return _0x6b06bd['type']===_0xe783('0x14');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x141536){return _0x141536[_0xe783('0x15')]===_0xe783('0x16');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x122953){return _0x122953[_0xe783('0x17')];}exports[_0xe783('0x18')]=isQueueCampaignActive;function isIVRCampaignActive(_0x360448){return _0x360448[_0xe783('0x19')];}exports[_0xe783('0x1a')]=isIVRCampaignActive;function getSeconds(_0x4bb91e,_0x23159e){var _0x578f0=moment(_0x4bb91e)[_0xe783('0x1b')](0x0);var _0x352938=moment(_0x23159e)[_0xe783('0x1b')](0x0);return _0x578f0[_0xe783('0x1c')](_0x352938,'seconds');}exports[_0xe783('0x1d')]=getSeconds;function hasQueueCampaignDataChanged(_0x1373f9,_0x4ba557){var _0xd90d1c=![];var _0x254cc6=_0x1373f9[_0xe783('0x11')]!==_0x4ba557['dialMethod']||_0x1373f9[_0xe783('0x17')]!==_0x4ba557[_0xe783('0x17')]||_0x1373f9['message']!==_0x4ba557[_0xe783('0x1e')];var _0x37c1ac=_0x1373f9[_0xe783('0x1f')]!==_0x4ba557[_0xe783('0x1f')]||_0x1373f9[_0xe783('0x20')]!==_0x4ba557['loggedIn']||_0x1373f9[_0xe783('0x21')]!==_0x4ba557[_0xe783('0x21')]||_0x1373f9[_0xe783('0x22')]!==_0x4ba557[_0xe783('0x22')]||_0x1373f9[_0xe783('0x23')]!==_0x4ba557['talking']||_0x1373f9['pTalking']!==_0x4ba557[_0xe783('0x24')]||_0x1373f9[_0xe783('0x25')]!==_0x4ba557[_0xe783('0x25')]||_0x1373f9[_0xe783('0x26')]!==_0x4ba557[_0xe783('0x26')]||_0x1373f9['originated']!==_0x4ba557['originated'];if(_0x1373f9[_0xe783('0x27')]&&_0x4ba557[_0xe783('0x27')]){_0xd90d1c=_0x1373f9[_0xe783('0x27')][_0xe783('0x28')]!==_0x4ba557[_0xe783('0x27')][_0xe783('0x28')]||_0x1373f9[_0xe783('0x27')][_0xe783('0x19')]!==_0x4ba557[_0xe783('0x27')]['active'];}return _0x254cc6||_0x37c1ac||_0xd90d1c;}exports[_0xe783('0x29')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x5af9cf){var _0x418b05=null;var _0xa5bb68=_0x5af9cf[_0xe783('0x2a')];if(_[_0xe783('0x2b')](_0x5af9cf[_0xe783('0x2c')])||_[_0xe783('0x2b')](_0x5af9cf[_0xe783('0x2d')])||_[_0xe783('0x2b')](_0x5af9cf[_0xe783('0x2d')]['Intervals'])){_0x418b05=CAMPAIGN_STATUS[_0xe783('0x2e')];}else if(_[_0xe783('0x2f')](_0x5af9cf['dialGlobalInterval'])||_[_0xe783('0x2f')](_0x5af9cf['Interval']['Intervals'])){_0x418b05=CAMPAIGN_STATUS[_0xe783('0x30')];}else if(_0xa5bb68&&!timezones[_0xa5bb68]){_0x418b05=CAMPAIGN_STATUS[_0xe783('0x31')];}return _0x418b05;}function checkAnyValidTrunk(_0x478002,_0x2d8a16){var _0x4195f9=null;var _0x4965e2=_0xe783('0x32');var _0x2593da=['reachable',_0xe783('0x33')];var _0x377a6e=!![];if(_0x478002[_0xe783('0x27')]&&_0x478002['Trunk'][_0xe783('0x19')]){_0x4965e2+=_0x478002[_0xe783('0x27')]['name'];_0x4195f9=_0x2d8a16[_0x4965e2];_0x377a6e=_0x2593da[_0xe783('0x34')](_0x4195f9['status']);}else if(_0x478002[_0xe783('0x35')]&&_0x478002[_0xe783('0x35')][_0xe783('0x19')]){_0x4965e2+=_0x478002['TrunkBackup'][_0xe783('0x28')];_0x4195f9=_0x2d8a16[_0x4965e2];_0x377a6e=_0x2593da[_0xe783('0x34')](_0x4195f9[_0xe783('0x36')]);}return _0x377a6e;}function getQueueCampaignStatusMessage(_0x1f5500,_0x23d812){var _0x5500cb=CAMPAIGN_STATUS[_0xe783('0x37')];var _0x5847b9=isPreviewCampaign(_0x1f5500);if(!isQueueCampaignActive(_0x1f5500)){if(_0x5847b9){_0x5500cb=CAMPAIGN_STATUS[_0xe783('0x38')];}else{if(_0x1f5500[_0xe783('0x39')]===0x0&&_0x1f5500[_0xe783('0x23')]===0x0&&_0x1f5500['waiting']===0x0&&(_0x1f5500[_0xe783('0x24')]||0x0)===0x0){_0x5500cb=CAMPAIGN_STATUS[_0xe783('0x38')];}else{_0x5500cb=CAMPAIGN_STATUS[_0xe783('0x3a')];}}}else if(_0x1f5500[_0xe783('0x20')]===0x0){_0x5500cb=CAMPAIGN_STATUS[_0xe783('0x3b')];}else if(!checkAnyValidTrunk(_0x1f5500,_0x23d812)){_0x5500cb=CAMPAIGN_STATUS[_0xe783('0x3c')];}else if(!isPreviewCampaign(_0x1f5500)){var _0x5a866f=checkAnyValidQueueCampaignInterval(_0x1f5500);if(_0x5a866f){_0x5500cb=_0x5a866f;}}return _0x5500cb;}exports[_0xe783('0x3d')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x4d388f){var _0x327d7a=CAMPAIGN_STATUS['DISACTIVED'];if(_0x4d388f['originated']===0x0&&_0x4d388f[_0xe783('0x23')]===0x0&&_0x4d388f['waiting']===0x0&&(_0x4d388f['pTalking']||0x0)===0x0){_0x327d7a=CAMPAIGN_STATUS[_0xe783('0x38')];}return _0x327d7a;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x6840db){var _0x5b60b4=_0x6840db[_0xe783('0x3e')](/"(.*?)"/);return _0x5b60b4?_0x5b60b4[0x1]:_0x6840db;}exports[_0xe783('0x3f')]=extractCalleridName;function getCallerId(_0x4e8ede,_0x3330bf,_0x4ed09f){if(!_[_0xe783('0x40')](_0x4ed09f)&&typeof _0x4ed09f===_0xe783('0x41')&&!_['isEmpty'](_0x4ed09f)){if(!_['isUndefined'](_0x3330bf)&&typeof _0x3330bf===_0xe783('0x41')&&!_[_0xe783('0x2f')](_0x3330bf)){return util['format'](_0xe783('0x42'),_0x3330bf,_0x4ed09f);}return util[_0xe783('0x43')]('\x22%s\x22\x20<%s>',_0x4ed09f,_0x4ed09f);}if(!_['isUndefined'](_0x4e8ede)&&typeof _0x4e8ede==='string'&&!_[_0xe783('0x2f')](_0x4e8ede)){return _0x4e8ede;}return _0xe783('0x44');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x1777f9,_0x3acda5){var _0x47cac3;var _0x23cfee;var _0x43ac74;if(_0x3acda5<=0x0){_0x3acda5=0x1;}_0x47cac3=new RegExp('\x5cw{0,'+_0x3acda5+'}$');_0x23cfee=Math[_0xe783('0x45')](0xa,_0x3acda5-0x1);_0x43ac74=Math[_0xe783('0x45')](0xa,_0x3acda5)-0x1;return util[_0xe783('0x43')]('%s',_[_0xe783('0x46')](_0x1777f9,_0x47cac3,_[_0xe783('0x47')](_0x23cfee,_0x43ac74)[_0xe783('0x48')]()));}exports[_0xe783('0x49')]=getCallerIdRandom;function decrementOriginate(_0x195de5){if(_0x195de5[_0xe783('0x39')]&&_0x195de5['originated']>0x0){_0x195de5['originated']-=0x1;}else{logger['error'](_0xe783('0x4a'));}}exports[_0xe783('0x4b')]=decrementOriginate;function checkContactEmpty(_0x99906){return _0x99906&&_0x99906['length']>0x0;}exports[_0xe783('0x4c')]=checkContactEmpty;function erlangb(_0x4dd6a2,_0x4d4160){if(_0x4d4160===0x0){return 0x0;}var _0x219543=0x1;for(var _0x53ef87=0x1;_0x53ef87<=_0x4d4160;_0x53ef87+=0x1){_0x219543=0x1+_0x219543*_0x53ef87/_0x4dd6a2;}return 0x1/_0x219543;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x2f5894,_0x12a51b,_0x50b356){if(_0x12a51b>_0x50b356){for(var _0x5f1325=0x0;_0x5f1325<_0x12a51b-_0x50b356;_0x5f1325+=0x1){decrementOriginate(_0x2f5894);}}}exports[_0xe783('0x4d')]=checkContactLowerLimitOriginate; \ No newline at end of file +var _0xff30=['string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactLowerLimitOriginate','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialMethod','dialActive','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','dialGlobalInterval','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','DISACTIVED','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined'];(function(_0x140bc3,_0x327e3a){var _0x20f69d=function(_0x4cd26d){while(--_0x4cd26d){_0x140bc3['push'](_0x140bc3['shift']());}};_0x20f69d(++_0x327e3a);}(_0xff30,0xff));var _0x0ff3=function(_0x28b7f2,_0x1c6a4d){_0x28b7f2=_0x28b7f2-0x0;var _0x53e3d3=_0xff30[_0x28b7f2];return _0x53e3d3;};'use strict';var _=require(_0x0ff3('0x0'));var moment=require(_0x0ff3('0x1'));var util=require(_0x0ff3('0x2'));var logger=require(_0x0ff3('0x3'))(_0x0ff3('0x4'));var timezones=require(_0x0ff3('0x5'))[_0x0ff3('0x6')];var CAMPAIGN_STATUS={'ACTIVE':_0x0ff3('0x7'),'BLACKLIST':_0x0ff3('0x8'),'CONTACTS_RESCHEDULED':_0x0ff3('0x9'),'DEACTIVATED':_0x0ff3('0xa'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x0ff3('0xb'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0x0ff3('0xc'),'OVERTIME_INTERVAL':_0x0ff3('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0x0ff3('0xe'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0x0ff3('0xf'),'RUNNING':_0x0ff3('0x10'),'UNKNOWN_TIMEZONE':_0x0ff3('0x11'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x18d69c){return _0x18d69c['dialMethod']===_0x0ff3('0x12');}exports[_0x0ff3('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x1858a0){return _0x1858a0[_0x0ff3('0x14')]===_0x0ff3('0x15');}exports[_0x0ff3('0x16')]=isIVRCampaign;function isOutboundQueue(_0x3581a7){return _0x3581a7['type']===_0x0ff3('0x17');}exports[_0x0ff3('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x4e735e){return _0x4e735e['dialActive'];}exports[_0x0ff3('0x19')]=isQueueCampaignActive;function isIVRCampaignActive(_0x2b89c7){return _0x2b89c7[_0x0ff3('0x1a')];}exports[_0x0ff3('0x1b')]=isIVRCampaignActive;function getSeconds(_0x422f46,_0x1ea193){var _0x3bb897=moment(_0x422f46)[_0x0ff3('0x1c')](0x0);var _0x598be3=moment(_0x1ea193)[_0x0ff3('0x1c')](0x0);return _0x3bb897[_0x0ff3('0x1d')](_0x598be3,_0x0ff3('0x1e'));}exports[_0x0ff3('0x1f')]=getSeconds;function hasQueueCampaignDataChanged(_0x1e425d,_0x217682){var _0x4c6650=![];var _0x2eeba5=_0x1e425d[_0x0ff3('0x20')]!==_0x217682[_0x0ff3('0x20')]||_0x1e425d[_0x0ff3('0x21')]!==_0x217682[_0x0ff3('0x21')]||_0x1e425d['message']!==_0x217682['message'];var _0x3adfcf=_0x1e425d[_0x0ff3('0x22')]!==_0x217682['available']||_0x1e425d[_0x0ff3('0x23')]!==_0x217682[_0x0ff3('0x23')]||_0x1e425d[_0x0ff3('0x24')]!==_0x217682[_0x0ff3('0x24')]||_0x1e425d[_0x0ff3('0x25')]!==_0x217682['paused']||_0x1e425d['talking']!==_0x217682[_0x0ff3('0x26')]||_0x1e425d[_0x0ff3('0x27')]!==_0x217682[_0x0ff3('0x27')]||_0x1e425d[_0x0ff3('0x28')]!==_0x217682[_0x0ff3('0x28')]||_0x1e425d[_0x0ff3('0x29')]!==_0x217682['inUse']||_0x1e425d[_0x0ff3('0x2a')]!==_0x217682[_0x0ff3('0x2a')];if(_0x1e425d[_0x0ff3('0x2b')]&&_0x217682[_0x0ff3('0x2b')]){_0x4c6650=_0x1e425d[_0x0ff3('0x2b')][_0x0ff3('0x2c')]!==_0x217682[_0x0ff3('0x2b')][_0x0ff3('0x2c')]||_0x1e425d['Trunk'][_0x0ff3('0x1a')]!==_0x217682['Trunk'][_0x0ff3('0x1a')];}return _0x2eeba5||_0x3adfcf||_0x4c6650;}exports[_0x0ff3('0x2d')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x2f7af8){var _0x5e2ece=null;var _0x54837c=_0x2f7af8['dialTimezone'];if(_[_0x0ff3('0x2e')](_0x2f7af8['dialGlobalInterval'])||_[_0x0ff3('0x2e')](_0x2f7af8['Interval'])||_[_0x0ff3('0x2e')](_0x2f7af8[_0x0ff3('0x2f')][_0x0ff3('0x30')])){_0x5e2ece=CAMPAIGN_STATUS[_0x0ff3('0x31')];}else if(_[_0x0ff3('0x32')](_0x2f7af8[_0x0ff3('0x33')])||_[_0x0ff3('0x32')](_0x2f7af8['Interval'][_0x0ff3('0x30')])){_0x5e2ece=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x54837c&&!timezones[_0x54837c]){_0x5e2ece=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x5e2ece;}function checkAnyValidTrunk(_0xb08722,_0x3c56cd){var _0x59eb4c=null;var _0x58fa19=_0x0ff3('0x34');var _0xcd05b2=[_0x0ff3('0x35'),_0x0ff3('0x36')];var _0x3a25b0=!![];if(_0xb08722[_0x0ff3('0x2b')]&&_0xb08722['Trunk'][_0x0ff3('0x1a')]){_0x58fa19+=_0xb08722[_0x0ff3('0x2b')][_0x0ff3('0x2c')];_0x59eb4c=_0x3c56cd[_0x58fa19];_0x3a25b0=_0xcd05b2[_0x0ff3('0x37')](_0x59eb4c[_0x0ff3('0x38')]);}else if(_0xb08722[_0x0ff3('0x39')]&&_0xb08722[_0x0ff3('0x39')]['active']){_0x58fa19+=_0xb08722[_0x0ff3('0x39')][_0x0ff3('0x2c')];_0x59eb4c=_0x3c56cd[_0x58fa19];_0x3a25b0=_0xcd05b2[_0x0ff3('0x37')](_0x59eb4c['status']);}return _0x3a25b0;}function getQueueCampaignStatusMessage(_0x5031ad,_0x131a6f){var _0x27af91=CAMPAIGN_STATUS[_0x0ff3('0x7')];var _0x5cf645=isPreviewCampaign(_0x5031ad);if(!isQueueCampaignActive(_0x5031ad)){if(_0x5cf645){_0x27af91=CAMPAIGN_STATUS[_0x0ff3('0x3a')];}else{if(_0x5031ad['originated']===0x0&&_0x5031ad[_0x0ff3('0x26')]===0x0&&_0x5031ad[_0x0ff3('0x28')]===0x0&&(_0x5031ad[_0x0ff3('0x27')]||0x0)===0x0){_0x27af91=CAMPAIGN_STATUS[_0x0ff3('0x3a')];}else{_0x27af91=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x5031ad['loggedIn']===0x0){_0x27af91=CAMPAIGN_STATUS[_0x0ff3('0x3b')];}else if(!checkAnyValidTrunk(_0x5031ad,_0x131a6f)){_0x27af91=CAMPAIGN_STATUS[_0x0ff3('0x3c')];}else if(!isPreviewCampaign(_0x5031ad)){var _0x46f16c=checkAnyValidQueueCampaignInterval(_0x5031ad);if(_0x46f16c){_0x27af91=_0x46f16c;}}return _0x27af91;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x2328ad){var _0x2e01db=CAMPAIGN_STATUS[_0x0ff3('0x3d')];if(_0x2328ad[_0x0ff3('0x2a')]===0x0&&_0x2328ad[_0x0ff3('0x26')]===0x0&&_0x2328ad[_0x0ff3('0x28')]===0x0&&(_0x2328ad[_0x0ff3('0x27')]||0x0)===0x0){_0x2e01db=CAMPAIGN_STATUS['INACTIVE'];}return _0x2e01db;}exports[_0x0ff3('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x4b3740){var _0x36a4b7=_0x4b3740['match'](/"(.*?)"/);return _0x36a4b7?_0x36a4b7[0x1]:_0x4b3740;}exports[_0x0ff3('0x3f')]=extractCalleridName;function getCallerId(_0x52dcc3,_0xaac40c,_0x3a1bf1){if(!_[_0x0ff3('0x40')](_0x3a1bf1)&&typeof _0x3a1bf1===_0x0ff3('0x41')&&!_[_0x0ff3('0x32')](_0x3a1bf1)){if(!_[_0x0ff3('0x40')](_0xaac40c)&&typeof _0xaac40c==='string'&&!_[_0x0ff3('0x32')](_0xaac40c)){return util[_0x0ff3('0x42')](_0x0ff3('0x43'),_0xaac40c,_0x3a1bf1);}return util['format'](_0x0ff3('0x43'),_0x3a1bf1,_0x3a1bf1);}if(!_['isUndefined'](_0x52dcc3)&&typeof _0x52dcc3===_0x0ff3('0x41')&&!_[_0x0ff3('0x32')](_0x52dcc3)){return _0x52dcc3;}return _0x0ff3('0x44');}exports[_0x0ff3('0x45')]=getCallerId;function getCallerIdRandom(_0x318e95,_0x18e110){var _0x3535ea;var _0x3a4a03;var _0xb4a675;if(_0x18e110<=0x0){_0x18e110=0x1;}_0x3535ea=new RegExp(_0x0ff3('0x46')+_0x18e110+'}$');_0x3a4a03=Math[_0x0ff3('0x47')](0xa,_0x18e110-0x1);_0xb4a675=Math['pow'](0xa,_0x18e110)-0x1;return util[_0x0ff3('0x42')]('%s',_[_0x0ff3('0x48')](_0x318e95,_0x3535ea,_['random'](_0x3a4a03,_0xb4a675)[_0x0ff3('0x49')]()));}exports[_0x0ff3('0x4a')]=getCallerIdRandom;function decrementOriginate(_0x217cca){if(_0x217cca[_0x0ff3('0x2a')]&&_0x217cca[_0x0ff3('0x2a')]>0x0){_0x217cca[_0x0ff3('0x2a')]-=0x1;}else{logger[_0x0ff3('0x4b')](_0x0ff3('0x4c'));}}exports[_0x0ff3('0x4d')]=decrementOriginate;function checkContactEmpty(_0xec8c98){return _0xec8c98&&_0xec8c98[_0x0ff3('0x4e')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x5a1a4c,_0x307543){if(_0x307543===0x0){return 0x0;}var _0x4a646c=0x1;for(var _0x3edf2b=0x1;_0x3edf2b<=_0x307543;_0x3edf2b+=0x1){_0x4a646c=0x1+_0x4a646c*_0x3edf2b/_0x5a1a4c;}return 0x1/_0x4a646c;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0xe30b9f,_0x2ca44f,_0x3d3bc9){if(_0x2ca44f>_0x3d3bc9){for(var _0x4b5057=0x0;_0x4b5057<_0x2ca44f-_0x3d3bc9;_0x4b5057+=0x1){decrementOriginate(_0xe30b9f);}}}exports[_0x0ff3('0x4f')]=checkContactLowerLimitOriginate; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 2f7771a..87b2801 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(_0x4b9cfd,_0x5170c2){var _0xa953fd=function(_0x43fce6){while(--_0x43fce6){_0x4b9cfd['push'](_0x4b9cfd['shift']());}};_0xa953fd(++_0x5170c2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0x36ce9a,_0x17fd19){var _0x2e5a6a=function(_0x3a98ea){while(--_0x3a98ea){_0x36ce9a['push'](_0x36ce9a['shift']());}};_0x2e5a6a(++_0x17fd19);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index d19c698..5905a93 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 _0xd0c6=['\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','SENDING\x20FAILED:\x20','faxstatusstring','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','checkAfterSend','checkTrunk','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','moment','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./util/util','./action','../rpc/faxMessage','faxAccounts','trunks','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channels','channel','name','actions','prototype','channelstate','channelstatedesc','syncNewExten','variable','value','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','info'];(function(_0x392451,_0x25682c){var _0x2f5a83=function(_0xcd8ed8){while(--_0xcd8ed8){_0x392451['push'](_0x392451['shift']());}};_0x2f5a83(++_0x25682c);}(_0xd0c6,0x13e));var _0x6d0c=function(_0x4d8d34,_0x329802){_0x4d8d34=_0x4d8d34-0x0;var _0x2a97a8=_0xd0c6[_0x4d8d34];return _0x2a97a8;};'use strict';var util=require(_0x6d0c('0x0'));var _=require(_0x6d0c('0x1'));var BPromise=require(_0x6d0c('0x2'));var uuid=require('uuid');var moment=require(_0x6d0c('0x3'));var path=require('path');var tiff2pdf=require(_0x6d0c('0x4'));var gs=require(_0x6d0c('0x5'));var logger=require(_0x6d0c('0x6'))('fax');var ami=require(_0x6d0c('0x7'));var rpcDb=require(_0x6d0c('0x8'));var Channel=require('./channel');var ut=require(_0x6d0c('0x9'));var Action=require(_0x6d0c('0xa'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0x6d0c('0xb'));function Fax(_0x2488aa){this['channels']={};this[_0x6d0c('0xc')]=_0x2488aa[_0x6d0c('0xc')];this[_0x6d0c('0xd')]=_0x2488aa[_0x6d0c('0xd')];this['actions']={};ami['on'](_0x6d0c('0xe'),this[_0x6d0c('0xf')]['bind'](this));ami['on'](_0x6d0c('0x10'),this[_0x6d0c('0x11')][_0x6d0c('0x12')](this));ami['on'](_0x6d0c('0x13'),this[_0x6d0c('0x14')]['bind'](this));ami['on'](_0x6d0c('0x15'),this['syncNewExten'][_0x6d0c('0x12')](this));ami['on'](_0x6d0c('0x16'),this[_0x6d0c('0x17')][_0x6d0c('0x12')](this));ami['on'](_0x6d0c('0x18'),this['syncReceiveFax'][_0x6d0c('0x12')](this));ami['on'](_0x6d0c('0x19'),this[_0x6d0c('0x1a')]['bind'](this));ami['on'](_0x6d0c('0x1b'),this[_0x6d0c('0x1c')][_0x6d0c('0x12')](this));}Fax['prototype'][_0x6d0c('0xf')]=function(_0x2dfe29){if(_0x2dfe29[_0x6d0c('0x1d')]===_0x6d0c('0x1e')){for(var _0x5a00f6 in this[_0x6d0c('0xc')]){if(this[_0x6d0c('0xc')][_0x6d0c('0x1f')](_0x5a00f6)){if(_0x2dfe29[_0x6d0c('0x20')]===this[_0x6d0c('0xc')][_0x5a00f6][_0x6d0c('0x21')]){this['channels'][_0x2dfe29[_0x6d0c('0x22')]]={};this[_0x6d0c('0x23')][_0x2dfe29[_0x6d0c('0x22')]][_0x6d0c('0x24')]=_0x2dfe29[_0x6d0c('0x24')];this[_0x6d0c('0x23')][_0x2dfe29[_0x6d0c('0x22')]]['id']=this[_0x6d0c('0xc')][_0x5a00f6]['id'];this[_0x6d0c('0x23')][_0x2dfe29[_0x6d0c('0x22')]][_0x6d0c('0x25')]=this[_0x6d0c('0xc')][_0x5a00f6][_0x6d0c('0x25')];logger['info'](_0x2dfe29['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this[_0x6d0c('0x26')][_0x2dfe29[_0x6d0c('0x22')]]){this[_0x6d0c('0x23')][_0x2dfe29[_0x6d0c('0x22')]]={};this[_0x6d0c('0x23')][_0x2dfe29[_0x6d0c('0x22')]][_0x6d0c('0x24')]=_0x2dfe29[_0x6d0c('0x24')];logger['info'](_0x2dfe29['uniqueid'],'\x20syncNewchannel\x20');}};Fax[_0x6d0c('0x27')][_0x6d0c('0x11')]=function(_0x320709){if(this[_0x6d0c('0x23')][_0x320709[_0x6d0c('0x22')]]){for(var _0x5150bf in _0x320709['variable']){if(_0x320709['variable'][_0x6d0c('0x1f')](_0x5150bf)){this[_0x6d0c('0x23')][_0x320709[_0x6d0c('0x22')]][_0x5150bf]=_0x320709['value'];}}}};Fax[_0x6d0c('0x27')][_0x6d0c('0x14')]=function(_0x48c5eb){if(this[_0x6d0c('0x23')][_0x48c5eb['uniqueid']]){this[_0x6d0c('0x23')][_0x48c5eb[_0x6d0c('0x22')]][_0x6d0c('0x28')]=_0x48c5eb[_0x6d0c('0x28')];this['channels'][_0x48c5eb[_0x6d0c('0x22')]][_0x6d0c('0x29')]=_0x48c5eb[_0x6d0c('0x29')];}};Fax[_0x6d0c('0x27')][_0x6d0c('0x2a')]=function(_0x218f4d){if(this[_0x6d0c('0x23')][_0x218f4d['uniqueid']]){for(var _0x515d68 in _0x218f4d[_0x6d0c('0x2b')]){if(_0x218f4d['variable'][_0x6d0c('0x1f')](_0x515d68)){this[_0x6d0c('0x23')][_0x218f4d[_0x6d0c('0x22')]][_0x515d68]=_0x218f4d[_0x6d0c('0x2c')];}}}};Fax[_0x6d0c('0x27')][_0x6d0c('0x17')]=function(_0x2bea8a){if(this['channels'][_0x2bea8a[_0x6d0c('0x22')]]){this[_0x6d0c('0x23')][_0x2bea8a['uniqueid']]['operation']=_0x2bea8a[_0x6d0c('0x2d')];this[_0x6d0c('0x23')][_0x2bea8a[_0x6d0c('0x22')]][_0x6d0c('0x2e')]=_0x2bea8a[_0x6d0c('0x2e')];this['channels'][_0x2bea8a[_0x6d0c('0x22')]]['localstationid']=_0x2bea8a[_0x6d0c('0x21')];this[_0x6d0c('0x23')][_0x2bea8a[_0x6d0c('0x22')]][_0x6d0c('0x2f')]=_0x2bea8a[_0x6d0c('0x2f')];logger['info'](_0x2bea8a[_0x6d0c('0x22')],_0x6d0c('0x30'));}};Fax[_0x6d0c('0x27')][_0x6d0c('0x31')]=function(_0x11f5fe){var _0x472454=this;if(this[_0x6d0c('0x23')][_0x11f5fe[_0x6d0c('0x22')]]){var _0x3d821e=this[_0x6d0c('0x23')][_0x11f5fe[_0x6d0c('0x22')]]['id'];this[_0x6d0c('0x23')][_0x11f5fe['uniqueid']][_0x6d0c('0x32')]=_0x11f5fe[_0x6d0c('0x32')];this[_0x6d0c('0x23')][_0x11f5fe['uniqueid']][_0x6d0c('0x33')]=_0x11f5fe[_0x6d0c('0x33')];this['channels'][_0x11f5fe[_0x6d0c('0x22')]][_0x6d0c('0x21')]=_0x11f5fe[_0x6d0c('0x21')];this[_0x6d0c('0x23')][_0x11f5fe[_0x6d0c('0x22')]][_0x6d0c('0x34')]=_0x11f5fe['resolution'];this['channels'][_0x11f5fe[_0x6d0c('0x22')]][_0x6d0c('0x35')]=_0x11f5fe['transferrate'];this[_0x6d0c('0x23')][_0x11f5fe[_0x6d0c('0x22')]][_0x6d0c('0x2f')]=_0x11f5fe[_0x6d0c('0x2f')];this[_0x6d0c('0x23')][_0x11f5fe['uniqueid']][_0x6d0c('0x36')]=_0x11f5fe[_0x6d0c('0x36')];if(this['channels'][_0x11f5fe[_0x6d0c('0x22')]][_0x6d0c('0x33')]>0x0){tiff2pdf(_0x11f5fe[_0x6d0c('0x2f')],_0x6d0c('0x37'),function(_0x30ae37){logger[_0x6d0c('0x38')](_0x11f5fe[_0x6d0c('0x22')],_0x6d0c('0x39'),_0x30ae37[_0x6d0c('0x3a')]);attachment[_0x6d0c('0x3b')]({'name':path[_0x6d0c('0x3c')](_0x11f5fe[_0x6d0c('0x2f')])[_0x6d0c('0x25')],'basename':path[_0x6d0c('0x3c')](_0x11f5fe['filename'])['name']+_0x6d0c('0x3d'),'type':_0x6d0c('0x3e')})['then'](function(_0x17d2f0){faxAccount[_0x6d0c('0x3f')](_0x3d821e,{'from':_0x11f5fe[_0x6d0c('0x36')],'mapKey':_0x6d0c('0x40'),'body':path[_0x6d0c('0x3c')](_0x11f5fe[_0x6d0c('0x2f')])['name']+_0x6d0c('0x3d'),'AttachmentId':_0x17d2f0['id']})[_0x6d0c('0x41')](function(_0x2d7a0b){logger[_0x6d0c('0x42')](_0x11f5fe['uniqueid'],_0x6d0c('0x43'),JSON[_0x6d0c('0x44')](_0x2d7a0b));});})[_0x6d0c('0x41')](function(_0x4f094b){logger[_0x6d0c('0x42')](_0x11f5fe[_0x6d0c('0x22')],_0x6d0c('0x45'),JSON[_0x6d0c('0x44')](_0x4f094b));});});}logger[_0x6d0c('0x38')](_0x11f5fe[_0x6d0c('0x22')],_0x6d0c('0x45'));}};Fax['prototype']['syncOriginateResponse']=function(_0x40ae1b){if(this[_0x6d0c('0x26')][_0x40ae1b[_0x6d0c('0x22')]]){_[_0x6d0c('0x46')](this[_0x6d0c('0x23')][_0x40ae1b[_0x6d0c('0x22')]],_[_0x6d0c('0x47')](_0x40ae1b,[_0x6d0c('0x48'),_0x6d0c('0x49')]));}};function updateStatus(_0x2e95cb){if(_0x2e95cb[_0x6d0c('0x4a')]){faxMessage[_0x6d0c('0x4b')](_0x2e95cb['AttachmentId'],{'failMessage':_0x6d0c('0x4c')})[_0x6d0c('0x4d')](function(_0x3e5456){ut[_0x6d0c('0x4e')](_0x6d0c('0x4f'),_0x3e5456);})[_0x6d0c('0x41')](function(_0x571603){ut[_0x6d0c('0x4e')](_0x6d0c('0x50'),_0x571603);});}else{ut['logger'](_0x6d0c('0x51'));}}Fax[_0x6d0c('0x27')]['updateStatus']=function(_0x231812,_0x487f4c,_0x1b589d){var _0x562c72=this;var _0x2649bf={};if(_0x487f4c){_0x2649bf={'read':_0x487f4c};}else{_0x2649bf={'failMessage':_0x1b589d};}if(this[_0x6d0c('0x26')][_0x231812][_0x6d0c('0x4a')]){faxMessage['update'](this[_0x6d0c('0x26')][_0x231812][_0x6d0c('0x4a')],_0x2649bf)[_0x6d0c('0x4d')](function(_0x474a99){ut[_0x6d0c('0x4e')](_0x6d0c('0x52'),_0x474a99);})[_0x6d0c('0x41')](function(_0x192859){ut[_0x6d0c('0x4e')](_0x6d0c('0x53'),_0x192859);})[_0x6d0c('0x54')](function(){delete _0x562c72[_0x6d0c('0x23')][_0x231812];delete _0x562c72[_0x6d0c('0x26')][_0x231812];});}else{ut[_0x6d0c('0x4e')](_0x6d0c('0x55'));delete this[_0x6d0c('0x23')][_0x231812];delete this[_0x6d0c('0x26')][_0x231812];}};Fax[_0x6d0c('0x27')][_0x6d0c('0x1a')]=function(_0x1cdd2d){var _0x15750b=this;if(this['channels'][_0x1cdd2d[_0x6d0c('0x22')]]){if(this[_0x6d0c('0x26')][_0x1cdd2d['uniqueid']]){this[_0x6d0c('0x23')][_0x1cdd2d[_0x6d0c('0x22')]]['id']=this[_0x6d0c('0x26')][_0x1cdd2d['uniqueid']]['id'];this[_0x6d0c('0x23')][_0x1cdd2d[_0x6d0c('0x22')]][_0x6d0c('0x25')]=this['actions'][_0x1cdd2d[_0x6d0c('0x22')]][_0x6d0c('0x25')];}logger[_0x6d0c('0x38')](_0x1cdd2d['uniqueid'],this['actions'][_0x1cdd2d[_0x6d0c('0x22')]]?'\x20hangup\x20sendFile\x20':_0x6d0c('0x56'),JSON[_0x6d0c('0x44')](this[_0x6d0c('0x23')][_0x1cdd2d[_0x6d0c('0x22')]]));if(this[_0x6d0c('0x26')][_0x1cdd2d[_0x6d0c('0x22')]]){if(this[_0x6d0c('0x23')][_0x1cdd2d[_0x6d0c('0x22')]][_0x6d0c('0x57')]>0x0&&this['channels'][_0x1cdd2d[_0x6d0c('0x22')]][_0x6d0c('0x16')]===_0x6d0c('0x58')){this[_0x6d0c('0x59')](_0x1cdd2d['uniqueid'],!![]);}else{this[_0x6d0c('0x59')](_0x1cdd2d[_0x6d0c('0x22')],![],this['channels'][_0x1cdd2d[_0x6d0c('0x22')]]['faxstatusstring']?_0x6d0c('0x5a')+this[_0x6d0c('0x23')][_0x1cdd2d[_0x6d0c('0x22')]][_0x6d0c('0x5b')]:'SENDING\x20FAILED');}}}};Fax['prototype'][_0x6d0c('0x5c')]=function(_0xec7b43){var _0x27c16a=this;return new BPromise(function(_0x5de902,_0x4dfbf2){_0x27c16a[_0x6d0c('0x5d')](_0xec7b43,_0x27c16a[_0x6d0c('0xc')][_0xec7b43[_0x6d0c('0x5e')]])[_0x6d0c('0x4d')](function(_0x389554){ut['logger'](_0x6d0c('0x5f'),_0x389554);_0x5de902(ut[_0x6d0c('0x3a')](_0x6d0c('0x60')));})[_0x6d0c('0x41')](function(_0x35cb3e){ut[_0x6d0c('0x4e')]('[Fax][execOriginate][failure]',_0x35cb3e);updateStatus(_0xec7b43);_0x4dfbf2(ut[_0x6d0c('0x3a')]('Fax\x20failed'));});});};Fax['prototype'][_0x6d0c('0x61')]=function(_0x2a36b5){var _0x2fc13b=this;return new BPromise(function(_0x330aab,_0x6eeb7){var _0x87502a=_0x2fc13b[_0x6d0c('0x62')](_0x2fc13b['faxAccounts'][_0x2a36b5[_0x6d0c('0x5e')]][_0x6d0c('0x63')],_0x2a36b5);if(_0x87502a[_0x6d0c('0x64')]){_0x330aab(ut[_0x6d0c('0x3a')]('Trunk\x20Reachable'));}else{_0x6eeb7(ut[_0x6d0c('0x3a')](_0x87502a[_0x6d0c('0x3a')]));}});};function originate(_0x4aad74,_0x23927d,_0xdf2233){return new BPromise(function(_0x1d27f8,_0x2bcbbd){if(_0xdf2233){var _0x29cb6e=util[_0x6d0c('0x65')](_0x6d0c('0x66'),path[_0x6d0c('0x3c')](_0x4aad74[_0x6d0c('0x67')])[_0x6d0c('0x25')],_0x4aad74['path']);gs[_0x6d0c('0x68')](_0x29cb6e)['then'](function(){_0x4aad74['path']=util[_0x6d0c('0x65')](_0x6d0c('0x69'),path[_0x6d0c('0x3c')](_0x4aad74[_0x6d0c('0x67')])['dir'],path[_0x6d0c('0x3c')](_0x4aad74[_0x6d0c('0x67')])['name']);_0x23927d[_0x6d0c('0x6a')]=_0x4aad74[_0x6d0c('0x67')];ut[_0x6d0c('0x4e')](_0x6d0c('0x6b'),'');ami[_0x6d0c('0x6c')](ut[_0x6d0c('0x6d')](_0x4aad74,_0x23927d))[_0x6d0c('0x4d')](function(_0x480545){_0x1d27f8(_0x480545);})['catch'](function(_0xecc2b){_0x2bcbbd(_0xecc2b);});})[_0x6d0c('0x41')](function(_0x5242f8){_0x2bcbbd(_0x5242f8);});}else{ami[_0x6d0c('0x6c')](ut['variablesAction'](_0x4aad74,_0x23927d))[_0x6d0c('0x4d')](function(_0x3de3ee){_0x1d27f8(_0x3de3ee);})[_0x6d0c('0x41')](function(_0x147ba8){_0x2bcbbd(_0x147ba8);});}});}Fax[_0x6d0c('0x27')][_0x6d0c('0x5d')]=function(_0x8a9c28,_0x5cc1e2){var _0x1cc368=this;return new BPromise(function(_0x2e8a1c,_0xf8fa68){var _0x126b44=uuid['v4']();var _0xb6bdad=ut[_0x6d0c('0x6e')](_0x8a9c28,_0x5cc1e2);_0x1cc368[_0x6d0c('0x26')][_0x126b44]=new Action(_0x126b44,_0x5cc1e2,_0x8a9c28);var _0x2548a8=_0x1cc368[_0x6d0c('0x26')][_0x126b44];if(path[_0x6d0c('0x3c')](_0x8a9c28[_0x6d0c('0x67')])[_0x6d0c('0x6f')]===_0x6d0c('0x3d')){originate(_0x2548a8,_0xb6bdad,!![])[_0x6d0c('0x4d')](function(_0x3af108){_0x2e8a1c(_0x3af108);})[_0x6d0c('0x41')](function(_0x4b6996){_0xf8fa68(_0x4b6996);});}else{originate(_0x2548a8,_0xb6bdad,![])[_0x6d0c('0x4d')](function(_0x426024){_0x2e8a1c(_0x426024);})[_0x6d0c('0x41')](function(_0xf18d7c){_0xf8fa68(_0xf18d7c);});}});};Fax[_0x6d0c('0x27')][_0x6d0c('0x70')]=function(_0x41a47f){return!_[_0x6d0c('0x71')](_0x41a47f)&&!_[_0x6d0c('0x71')](_0x41a47f[_0x6d0c('0x25')])&&!_[_0x6d0c('0x71')](_0x41a47f['active'])&&_0x41a47f[_0x6d0c('0x72')]&&!_[_0x6d0c('0x71')](this[_0x6d0c('0xd')][util[_0x6d0c('0x65')]('SIP/%s',_0x41a47f[_0x6d0c('0x25')])])&&!_[_0x6d0c('0x71')](this[_0x6d0c('0xd')][util[_0x6d0c('0x65')](_0x6d0c('0x73'),_0x41a47f[_0x6d0c('0x25')])]['status'])&&(this[_0x6d0c('0xd')][util['format']('SIP/%s',_0x41a47f[_0x6d0c('0x25')])][_0x6d0c('0x2e')]===_0x6d0c('0x74')||this[_0x6d0c('0xd')][util[_0x6d0c('0x65')](_0x6d0c('0x73'),_0x41a47f[_0x6d0c('0x25')])][_0x6d0c('0x2e')]===_0x6d0c('0x75'));};Fax['prototype'][_0x6d0c('0x62')]=function(_0xdf42c5,_0x5ecd34){if(!this['isTrunkReachable'](_0xdf42c5)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x6d0c('0x71')](_0xdf42c5)?'':_0xdf42c5[_0x6d0c('0x25')]+_0x6d0c('0x76'));return{'isValid':![],'message':_0x6d0c('0x77')};}if(_[_0x6d0c('0x71')](_0x5ecd34[_0x6d0c('0x40')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x6d0c('0x44')](_0x5ecd34));return{'isValid':![],'message':_0x6d0c('0x78')};}if(_[_0x6d0c('0x71')](_0x5ecd34[_0x6d0c('0x67')])){ut[_0x6d0c('0x4e')](_0x6d0c('0x79'),JSON[_0x6d0c('0x44')](_0x5ecd34));return{'isValid':![],'message':_0x6d0c('0x7a')};}return{'isValid':!![],'message':_0x6d0c('0x7b')};};module[_0x6d0c('0x7c')]=Fax; \ No newline at end of file +var _0xb43d=['reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','Trunk\x20Reachable','execute','format','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newexten','faxstatus','syncFaxStatus','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','syncNewState','channelstate','channelstatedesc','syncNewExten','value','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response'];(function(_0x16c2b1,_0x36a70c){var _0x199ac4=function(_0x2f1802){while(--_0x2f1802){_0x16c2b1['push'](_0x16c2b1['shift']());}};_0x199ac4(++_0x36a70c);}(_0xb43d,0xab));var _0xdb43=function(_0x3bbe59,_0x4fd92b){_0x3bbe59=_0x3bbe59-0x0;var _0x2e4d69=_0xb43d[_0x3bbe59];return _0x2e4d69;};'use strict';var util=require(_0xdb43('0x0'));var _=require(_0xdb43('0x1'));var BPromise=require(_0xdb43('0x2'));var uuid=require(_0xdb43('0x3'));var moment=require(_0xdb43('0x4'));var path=require(_0xdb43('0x5'));var tiff2pdf=require(_0xdb43('0x6'));var gs=require(_0xdb43('0x7'));var logger=require(_0xdb43('0x8'))(_0xdb43('0x9'));var ami=require(_0xdb43('0xa'));var rpcDb=require(_0xdb43('0xb'));var Channel=require(_0xdb43('0xc'));var ut=require(_0xdb43('0xd'));var Action=require(_0xdb43('0xe'));var faxAccount=require(_0xdb43('0xf'));var attachment=require(_0xdb43('0x10'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x115af2){this[_0xdb43('0x11')]={};this[_0xdb43('0x12')]=_0x115af2['faxAccounts'];this[_0xdb43('0x13')]=_0x115af2[_0xdb43('0x13')];this[_0xdb43('0x14')]={};ami['on'](_0xdb43('0x15'),this[_0xdb43('0x16')][_0xdb43('0x17')](this));ami['on'](_0xdb43('0x18'),this[_0xdb43('0x19')][_0xdb43('0x17')](this));ami['on']('newstate',this['syncNewState'][_0xdb43('0x17')](this));ami['on'](_0xdb43('0x1a'),this['syncNewExten'][_0xdb43('0x17')](this));ami['on'](_0xdb43('0x1b'),this[_0xdb43('0x1c')][_0xdb43('0x17')](this));ami['on']('receivefax',this['syncReceiveFax'][_0xdb43('0x17')](this));ami['on']('hangup',this['syncHangup'][_0xdb43('0x17')](this));ami['on'](_0xdb43('0x1d'),this[_0xdb43('0x1e')][_0xdb43('0x17')](this));}Fax[_0xdb43('0x1f')]['syncNewchannel']=function(_0x25c59b){if(_0x25c59b[_0xdb43('0x20')]===_0xdb43('0x21')){for(var _0x1d82fd in this['faxAccounts']){if(this[_0xdb43('0x12')][_0xdb43('0x22')](_0x1d82fd)){if(_0x25c59b[_0xdb43('0x23')]===this[_0xdb43('0x12')][_0x1d82fd][_0xdb43('0x24')]){this[_0xdb43('0x11')][_0x25c59b[_0xdb43('0x25')]]={};this[_0xdb43('0x11')][_0x25c59b['uniqueid']][_0xdb43('0x26')]=_0x25c59b[_0xdb43('0x26')];this['channels'][_0x25c59b[_0xdb43('0x25')]]['id']=this[_0xdb43('0x12')][_0x1d82fd]['id'];this[_0xdb43('0x11')][_0x25c59b['uniqueid']][_0xdb43('0x27')]=this[_0xdb43('0x12')][_0x1d82fd]['name'];logger['info'](_0x25c59b['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this[_0xdb43('0x14')][_0x25c59b[_0xdb43('0x25')]]){this[_0xdb43('0x11')][_0x25c59b[_0xdb43('0x25')]]={};this[_0xdb43('0x11')][_0x25c59b[_0xdb43('0x25')]][_0xdb43('0x26')]=_0x25c59b[_0xdb43('0x26')];logger[_0xdb43('0x28')](_0x25c59b['uniqueid'],_0xdb43('0x29'));}};Fax['prototype'][_0xdb43('0x19')]=function(_0x211f80){if(this['channels'][_0x211f80[_0xdb43('0x25')]]){for(var _0xa9819f in _0x211f80[_0xdb43('0x2a')]){if(_0x211f80[_0xdb43('0x2a')][_0xdb43('0x22')](_0xa9819f)){this[_0xdb43('0x11')][_0x211f80[_0xdb43('0x25')]][_0xa9819f]=_0x211f80['value'];}}}};Fax[_0xdb43('0x1f')][_0xdb43('0x2b')]=function(_0x5646e9){if(this[_0xdb43('0x11')][_0x5646e9['uniqueid']]){this['channels'][_0x5646e9['uniqueid']][_0xdb43('0x2c')]=_0x5646e9[_0xdb43('0x2c')];this[_0xdb43('0x11')][_0x5646e9[_0xdb43('0x25')]][_0xdb43('0x2d')]=_0x5646e9['channelstatedesc'];}};Fax[_0xdb43('0x1f')][_0xdb43('0x2e')]=function(_0xf7463a){if(this['channels'][_0xf7463a['uniqueid']]){for(var _0x331763 in _0xf7463a['variable']){if(_0xf7463a['variable'][_0xdb43('0x22')](_0x331763)){this['channels'][_0xf7463a[_0xdb43('0x25')]][_0x331763]=_0xf7463a[_0xdb43('0x2f')];}}}};Fax[_0xdb43('0x1f')][_0xdb43('0x1c')]=function(_0x3d03c2){if(this[_0xdb43('0x11')][_0x3d03c2[_0xdb43('0x25')]]){this[_0xdb43('0x11')][_0x3d03c2['uniqueid']][_0xdb43('0x30')]=_0x3d03c2['operation'];this[_0xdb43('0x11')][_0x3d03c2['uniqueid']][_0xdb43('0x31')]=_0x3d03c2[_0xdb43('0x31')];this[_0xdb43('0x11')][_0x3d03c2['uniqueid']][_0xdb43('0x24')]=_0x3d03c2[_0xdb43('0x24')];this[_0xdb43('0x11')][_0x3d03c2[_0xdb43('0x25')]][_0xdb43('0x32')]=_0x3d03c2[_0xdb43('0x32')];logger['info'](_0x3d03c2[_0xdb43('0x25')],_0xdb43('0x33'));}};Fax[_0xdb43('0x1f')][_0xdb43('0x34')]=function(_0x14e6fa){var _0x1bffc5=this;if(this[_0xdb43('0x11')][_0x14e6fa[_0xdb43('0x25')]]){var _0x514e26=this[_0xdb43('0x11')][_0x14e6fa['uniqueid']]['id'];this[_0xdb43('0x11')][_0x14e6fa[_0xdb43('0x25')]][_0xdb43('0x35')]=_0x14e6fa[_0xdb43('0x35')];this['channels'][_0x14e6fa[_0xdb43('0x25')]][_0xdb43('0x36')]=_0x14e6fa[_0xdb43('0x36')];this['channels'][_0x14e6fa[_0xdb43('0x25')]][_0xdb43('0x24')]=_0x14e6fa[_0xdb43('0x24')];this[_0xdb43('0x11')][_0x14e6fa[_0xdb43('0x25')]][_0xdb43('0x37')]=_0x14e6fa[_0xdb43('0x37')];this[_0xdb43('0x11')][_0x14e6fa[_0xdb43('0x25')]][_0xdb43('0x38')]=_0x14e6fa[_0xdb43('0x38')];this[_0xdb43('0x11')][_0x14e6fa[_0xdb43('0x25')]][_0xdb43('0x32')]=_0x14e6fa[_0xdb43('0x32')];this[_0xdb43('0x11')][_0x14e6fa['uniqueid']][_0xdb43('0x39')]=_0x14e6fa[_0xdb43('0x39')];if(this[_0xdb43('0x11')][_0x14e6fa['uniqueid']][_0xdb43('0x36')]>0x0){tiff2pdf(_0x14e6fa[_0xdb43('0x32')],'/var/opt/motion2/server/files/attachments/',function(_0x5446c8){logger[_0xdb43('0x28')](_0x14e6fa[_0xdb43('0x25')],_0xdb43('0x3a'),_0x5446c8[_0xdb43('0x3b')]);attachment[_0xdb43('0x3c')]({'name':path[_0xdb43('0x3d')](_0x14e6fa['filename'])[_0xdb43('0x27')],'basename':path[_0xdb43('0x3d')](_0x14e6fa[_0xdb43('0x32')])[_0xdb43('0x27')]+'.pdf','type':_0xdb43('0x3e')})[_0xdb43('0x3f')](function(_0x3ab594){faxAccount['notify'](_0x514e26,{'from':_0x14e6fa[_0xdb43('0x39')],'mapKey':'fax','body':path[_0xdb43('0x3d')](_0x14e6fa['filename'])['name']+_0xdb43('0x40'),'AttachmentId':_0x3ab594['id']})[_0xdb43('0x41')](function(_0xd24d5){logger[_0xdb43('0x42')](_0x14e6fa[_0xdb43('0x25')],_0xdb43('0x43'),JSON[_0xdb43('0x44')](_0xd24d5));});})[_0xdb43('0x41')](function(_0x16b419){logger[_0xdb43('0x42')](_0x14e6fa[_0xdb43('0x25')],_0xdb43('0x45'),JSON[_0xdb43('0x44')](_0x16b419));});});}logger['info'](_0x14e6fa['uniqueid'],_0xdb43('0x45'));}};Fax[_0xdb43('0x1f')]['syncOriginateResponse']=function(_0x5aff78){if(this[_0xdb43('0x14')][_0x5aff78['uniqueid']]){_[_0xdb43('0x46')](this[_0xdb43('0x11')][_0x5aff78[_0xdb43('0x25')]],_[_0xdb43('0x47')](_0x5aff78,[_0xdb43('0x48'),_0xdb43('0x49')]));}};function updateStatus(_0x2c934d){if(_0x2c934d[_0xdb43('0x4a')]){faxMessage[_0xdb43('0x4b')](_0x2c934d[_0xdb43('0x4a')],{'failMessage':_0xdb43('0x4c')})[_0xdb43('0x3f')](function(_0x26d60e){ut[_0xdb43('0x4d')](_0xdb43('0x4e'),_0x26d60e);})['catch'](function(_0x2cd8da){ut['logger'](_0xdb43('0x4f'),_0x2cd8da);});}else{ut[_0xdb43('0x4d')](_0xdb43('0x50'));}}Fax[_0xdb43('0x1f')][_0xdb43('0x51')]=function(_0x367397,_0x17ecaf,_0x5e5ea7){var _0x4b90b1=this;var _0x23f5e0={};if(_0x17ecaf){_0x23f5e0={'read':_0x17ecaf};}else{_0x23f5e0={'failMessage':_0x5e5ea7};}if(this[_0xdb43('0x14')][_0x367397][_0xdb43('0x4a')]){faxMessage[_0xdb43('0x4b')](this[_0xdb43('0x14')][_0x367397][_0xdb43('0x4a')],_0x23f5e0)[_0xdb43('0x3f')](function(_0xc05b07){ut['logger'](_0xdb43('0x52'),_0xc05b07);})[_0xdb43('0x41')](function(_0x1ad9b3){ut[_0xdb43('0x4d')](_0xdb43('0x53'),_0x1ad9b3);})[_0xdb43('0x54')](function(){delete _0x4b90b1[_0xdb43('0x11')][_0x367397];delete _0x4b90b1['actions'][_0x367397];});}else{ut['logger'](_0xdb43('0x55'));delete this['channels'][_0x367397];delete this[_0xdb43('0x14')][_0x367397];}};Fax[_0xdb43('0x1f')]['syncHangup']=function(_0x24066d){var _0x5caaad=this;if(this[_0xdb43('0x11')][_0x24066d[_0xdb43('0x25')]]){if(this[_0xdb43('0x14')][_0x24066d[_0xdb43('0x25')]]){this[_0xdb43('0x11')][_0x24066d[_0xdb43('0x25')]]['id']=this[_0xdb43('0x14')][_0x24066d[_0xdb43('0x25')]]['id'];this[_0xdb43('0x11')][_0x24066d[_0xdb43('0x25')]][_0xdb43('0x27')]=this[_0xdb43('0x14')][_0x24066d[_0xdb43('0x25')]]['name'];}logger[_0xdb43('0x28')](_0x24066d[_0xdb43('0x25')],this[_0xdb43('0x14')][_0x24066d['uniqueid']]?_0xdb43('0x56'):_0xdb43('0x57'),JSON[_0xdb43('0x44')](this['channels'][_0x24066d[_0xdb43('0x25')]]));if(this[_0xdb43('0x14')][_0x24066d[_0xdb43('0x25')]]){if(this['channels'][_0x24066d[_0xdb43('0x25')]][_0xdb43('0x58')]>0x0&&this['channels'][_0x24066d[_0xdb43('0x25')]][_0xdb43('0x1b')]===_0xdb43('0x59')){this[_0xdb43('0x51')](_0x24066d[_0xdb43('0x25')],!![]);}else{this[_0xdb43('0x51')](_0x24066d[_0xdb43('0x25')],![],this[_0xdb43('0x11')][_0x24066d[_0xdb43('0x25')]]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this[_0xdb43('0x11')][_0x24066d['uniqueid']][_0xdb43('0x5a')]:_0xdb43('0x5b'));}}}};Fax['prototype'][_0xdb43('0x5c')]=function(_0x543316){var _0x5ad2b0=this;return new BPromise(function(_0x364028,_0x2df337){_0x5ad2b0[_0xdb43('0x5d')](_0x543316,_0x5ad2b0['faxAccounts'][_0x543316[_0xdb43('0x5e')]])[_0xdb43('0x3f')](function(_0x941058){ut['logger'](_0xdb43('0x5f'),_0x941058);_0x364028(ut[_0xdb43('0x3b')](_0xdb43('0x60')));})['catch'](function(_0x4c0eca){ut[_0xdb43('0x4d')](_0xdb43('0x61'),_0x4c0eca);updateStatus(_0x543316);_0x2df337(ut[_0xdb43('0x3b')]('Fax\x20failed'));});});};Fax['prototype'][_0xdb43('0x62')]=function(_0x52fdb5){var _0x2dda73=this;return new BPromise(function(_0x2ad983,_0x5d646b){var _0x51006e=_0x2dda73[_0xdb43('0x63')](_0x2dda73[_0xdb43('0x12')][_0x52fdb5[_0xdb43('0x5e')]][_0xdb43('0x64')],_0x52fdb5);if(_0x51006e['isValid']){_0x2ad983(ut[_0xdb43('0x3b')](_0xdb43('0x65')));}else{_0x5d646b(ut[_0xdb43('0x3b')](_0x51006e[_0xdb43('0x3b')]));}});};function originate(_0xbb56a,_0x56a2f0,_0x3bc21d){return new BPromise(function(_0x26402c,_0x27c178){if(_0x3bc21d){var _0x50abde=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0xdb43('0x3d')](_0xbb56a['path'])[_0xdb43('0x27')],_0xbb56a['path']);gs[_0xdb43('0x66')](_0x50abde)[_0xdb43('0x3f')](function(){_0xbb56a[_0xdb43('0x5')]=util[_0xdb43('0x67')](_0xdb43('0x68'),path[_0xdb43('0x3d')](_0xbb56a['path'])['dir'],path[_0xdb43('0x3d')](_0xbb56a[_0xdb43('0x5')])[_0xdb43('0x27')]);_0x56a2f0[_0xdb43('0x69')]=_0xbb56a['path'];ut[_0xdb43('0x4d')](_0xdb43('0x6a'),'');ami[_0xdb43('0x6b')](ut['variablesAction'](_0xbb56a,_0x56a2f0))[_0xdb43('0x3f')](function(_0x2136b0){_0x26402c(_0x2136b0);})[_0xdb43('0x41')](function(_0x194e6a){_0x27c178(_0x194e6a);});})[_0xdb43('0x41')](function(_0x2076df){_0x27c178(_0x2076df);});}else{ami['Action'](ut[_0xdb43('0x6c')](_0xbb56a,_0x56a2f0))[_0xdb43('0x3f')](function(_0x5e3d82){_0x26402c(_0x5e3d82);})['catch'](function(_0x1bbca4){_0x27c178(_0x1bbca4);});}});}Fax[_0xdb43('0x1f')][_0xdb43('0x5d')]=function(_0x4beb82,_0x316912){var _0x3b4a13=this;return new BPromise(function(_0x4c71f4,_0x17248a){var _0x969ba7=uuid['v4']();var _0x4fe261=ut[_0xdb43('0x6d')](_0x4beb82,_0x316912);_0x3b4a13[_0xdb43('0x14')][_0x969ba7]=new Action(_0x969ba7,_0x316912,_0x4beb82);var _0x511438=_0x3b4a13['actions'][_0x969ba7];if(path['parse'](_0x4beb82['path'])[_0xdb43('0x6e')]===_0xdb43('0x40')){originate(_0x511438,_0x4fe261,!![])['then'](function(_0x15e4b3){_0x4c71f4(_0x15e4b3);})['catch'](function(_0x92d822){_0x17248a(_0x92d822);});}else{originate(_0x511438,_0x4fe261,![])[_0xdb43('0x3f')](function(_0x33eaee){_0x4c71f4(_0x33eaee);})['catch'](function(_0x32b06b){_0x17248a(_0x32b06b);});}});};Fax[_0xdb43('0x1f')][_0xdb43('0x6f')]=function(_0x210824){return!_[_0xdb43('0x70')](_0x210824)&&!_[_0xdb43('0x70')](_0x210824[_0xdb43('0x27')])&&!_[_0xdb43('0x70')](_0x210824['active'])&&_0x210824[_0xdb43('0x71')]&&!_['isNil'](this['trunks'][util[_0xdb43('0x67')](_0xdb43('0x72'),_0x210824[_0xdb43('0x27')])])&&!_[_0xdb43('0x70')](this['trunks'][util[_0xdb43('0x67')]('SIP/%s',_0x210824[_0xdb43('0x27')])]['status'])&&(this[_0xdb43('0x13')][util[_0xdb43('0x67')](_0xdb43('0x72'),_0x210824[_0xdb43('0x27')])]['status']===_0xdb43('0x73')||this['trunks'][util[_0xdb43('0x67')](_0xdb43('0x72'),_0x210824[_0xdb43('0x27')])][_0xdb43('0x31')]==='unmonitored');};Fax[_0xdb43('0x1f')][_0xdb43('0x63')]=function(_0x103401,_0x544ae3){if(!this[_0xdb43('0x6f')](_0x103401)){ut['logger'](_0xdb43('0x74'),_[_0xdb43('0x70')](_0x103401)?'':_0x103401[_0xdb43('0x27')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xdb43('0x75')};}if(_['isNil'](_0x544ae3[_0xdb43('0x9')])){ut[_0xdb43('0x4d')](_0xdb43('0x76'),JSON[_0xdb43('0x44')](_0x544ae3));return{'isValid':![],'message':_0xdb43('0x77')};}if(_[_0xdb43('0x70')](_0x544ae3[_0xdb43('0x5')])){ut[_0xdb43('0x4d')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x544ae3));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xdb43('0x78')};};module[_0xdb43('0x79')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index de6d81e..5a421f0 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 _0xfba1=['../rpc/faxAccount','error','inspect','notify','resolve','then','catch','[Notify]\x20','util','../../../config/logger'];(function(_0x3c9b0a,_0x1789ad){var _0x2c94dd=function(_0x537ea8){while(--_0x537ea8){_0x3c9b0a['push'](_0x3c9b0a['shift']());}};_0x2c94dd(++_0x1789ad);}(_0xfba1,0x76));var _0x1fba=function(_0x2c826c,_0x269a9f){_0x2c826c=_0x2c826c-0x0;var _0x3231a1=_0xfba1[_0x2c826c];return _0x3231a1;};'use strict';var util=require(_0x1fba('0x0'));var BPromise=require('bluebird');var logger=require(_0x1fba('0x1'))('preview');var _=require('lodash');var faxAccount=require(_0x1fba('0x2'));function loggerCatch(_0x1673f6){return function(_0x137cf1){logger[_0x1fba('0x3')](_0x1673f6,util[_0x1fba('0x4')](_0x137cf1,{'showHidden':![],'depth':null}));};}exports[_0x1fba('0x5')]=function(_0x1dfd3c,_0x571598){return BPromise[_0x1fba('0x6')]()[_0x1fba('0x7')](faxAccount[_0x1fba('0x5')](_0x1dfd3c,_0x571598))[_0x1fba('0x8')](loggerCatch(_0x1fba('0x9')));}; \ No newline at end of file +var _0x2ee4=['util','bluebird','../../../config/logger','inspect','notify','resolve','then','catch'];(function(_0x260285,_0x47248a){var _0x37141f=function(_0x57521d){while(--_0x57521d){_0x260285['push'](_0x260285['shift']());}};_0x37141f(++_0x47248a);}(_0x2ee4,0x178));var _0x42ee=function(_0x572246,_0x31c860){_0x572246=_0x572246-0x0;var _0x53ff43=_0x2ee4[_0x572246];return _0x53ff43;};'use strict';var util=require(_0x42ee('0x0'));var BPromise=require(_0x42ee('0x1'));var logger=require(_0x42ee('0x2'))('preview');var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x5ef75c){return function(_0x5c35ff){logger['error'](_0x5ef75c,util[_0x42ee('0x3')](_0x5c35ff,{'showHidden':![],'depth':null}));};}exports[_0x42ee('0x4')]=function(_0x15fbf1,_0x4bc0b1){return BPromise[_0x42ee('0x5')]()[_0x42ee('0x6')](faxAccount['notify'](_0x15fbf1,_0x4bc0b1))[_0x42ee('0x7')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 6459549..c4d5ce6 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 _0x7761=['\x20Error\x20:','inspect','../../../../config/logger','fax','bluebird','exec','Exec\x20gs'];(function(_0x13632a,_0x26d8d1){var _0xddb7ff=function(_0x2bb12a){while(--_0x2bb12a){_0x13632a['push'](_0x13632a['shift']());}};_0xddb7ff(++_0x26d8d1);}(_0x7761,0x128));var _0x1776=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7761[_0x14add3];return _0x4a174f;};'use strict';var util=require('util');var logger=require(_0x1776('0x0'))(_0x1776('0x1'));var BPromise=require(_0x1776('0x2'));var exec=require('child_process')[_0x1776('0x3')];exports['execute']=function(_0x2b39e7){return new BPromise(function(_0x3edd46,_0x21e99e){exec(_0x2b39e7,function(_0x4f602d,_0x58292f,_0x3f6646){logger['info']('Exec\x20gs',_0x58292f);if(_0x4f602d){logger['info'](_0x1776('0x4'),_0x1776('0x5'),util[_0x1776('0x6')](_0x4f602d,{'showHidden':![],'depth':null}),_0x58292f,_0x3f6646);_0x21e99e(_0x4f602d);}_0x3edd46(_0x58292f);});});}; \ No newline at end of file +var _0xbb2a=['Exec\x20gs','info','inspect','util','../../../../config/logger','bluebird','exec'];(function(_0x47724a,_0x962c5d){var _0x467afc=function(_0x2da2dd){while(--_0x2da2dd){_0x47724a['push'](_0x47724a['shift']());}};_0x467afc(++_0x962c5d);}(_0xbb2a,0x1f4));var _0xabb2=function(_0x438d50,_0x2ba078){_0x438d50=_0x438d50-0x0;var _0x352601=_0xbb2a[_0x438d50];return _0x352601;};'use strict';var util=require(_0xabb2('0x0'));var logger=require(_0xabb2('0x1'))('fax');var BPromise=require(_0xabb2('0x2'));var exec=require('child_process')[_0xabb2('0x3')];exports['execute']=function(_0x2f4ebe){return new BPromise(function(_0x6b6da9,_0x25f6be){exec(_0x2f4ebe,function(_0x137c52,_0x571b5d,_0x588303){logger['info'](_0xabb2('0x4'),_0x571b5d);if(_0x137c52){logger[_0xabb2('0x5')](_0xabb2('0x4'),'\x20Error\x20:',util[_0xabb2('0x6')](_0x137c52,{'showHidden':![],'depth':null}),_0x571b5d,_0x588303);_0x25f6be(_0x137c52);}_0x6b6da9(_0x571b5d);});});}; \ 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 6e846ca..baabaa7 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 _0xe104=['maxrate','format','\x22%s\x22','gateway','faxdetect','localstationid','path','uniqueid','originate','util','lodash','../../../../config/logger','message','logger','info','inspect','ecm','headerinfo','minrate'];(function(_0x4caa15,_0xf0aebb){var _0xf5e464=function(_0x2ed6f7){while(--_0x2ed6f7){_0x4caa15['push'](_0x4caa15['shift']());}};_0xf5e464(++_0xf0aebb);}(_0xe104,0x198));var _0x4e10=function(_0x4625db,_0x224f9f){_0x4625db=_0x4625db-0x0;var _0x51e452=_0xe104[_0x4625db];return _0x51e452;};'use strict';var util=require(_0x4e10('0x0'));var _=require(_0x4e10('0x1'));var moment=require('moment');var logger=require(_0x4e10('0x2'))('fax');exports[_0x4e10('0x3')]=function(_0xfb6eb7){return{'message':_0xfb6eb7};};exports[_0x4e10('0x4')]=function(_0x576e71,_0x581f0d){logger[_0x4e10('0x5')](_0x576e71,util[_0x4e10('0x6')](_0x581f0d,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x5713f3,_0x2ae611){var _0x435b21={'XMF-ECM':_0x2ae611[_0x4e10('0x7')],'XMF-HEADERINFO':_0x2ae611[_0x4e10('0x8')],'XMF-MINRATE':_0x2ae611[_0x4e10('0x9')],'XMF-MAXRATE':_0x2ae611[_0x4e10('0xa')],'XMF-MODEM':util[_0x4e10('0xb')](_0x4e10('0xc'),_0x2ae611['modem']),'XMF-GATEWAY':_0x2ae611[_0x4e10('0xd')],'XMF-FAXDETECT':_0x2ae611[_0x4e10('0xe')],'XMF-T38TIMEOUT':_0x2ae611['t38timeout'],'XMF-LOCALSTATIONID':_0x2ae611[_0x4e10('0xf')],'XMF-PATH':_0x5713f3[_0x4e10('0x10')]};return _0x435b21;};exports['variablesAction']=function(_0x20b999,_0x40798e){return{'actionid':_0x20b999[_0x4e10('0x11')],'action':_0x4e10('0x12'),'channel':_0x20b999['channel'],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0x4e10('0xb')]('\x22%s\x22\x20<%s>',_0x20b999[_0x4e10('0x8')]?_0x20b999[_0x4e10('0x8')]:'',_0x20b999[_0x4e10('0xf')]),'variable':_0x40798e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x20b999[_0x4e10('0x11')]};}; \ No newline at end of file +var _0xc5ba=['maxrate','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xc5ba,0xb9));var _0xac5b=function(_0xc153db,_0x516c10){_0xc153db=_0xc153db-0x0;var _0x4dc97d=_0xc5ba[_0xc153db];return _0x4dc97d;};'use strict';var util=require(_0xac5b('0x0'));var _=require(_0xac5b('0x1'));var moment=require(_0xac5b('0x2'));var logger=require(_0xac5b('0x3'))(_0xac5b('0x4'));exports[_0xac5b('0x5')]=function(_0x3158cd){return{'message':_0x3158cd};};exports[_0xac5b('0x6')]=function(_0x3d0dc6,_0x3c48f1){logger[_0xac5b('0x7')](_0x3d0dc6,util[_0xac5b('0x8')](_0x3c48f1,{'showHidden':![],'depth':null}));};exports[_0xac5b('0x9')]=function(_0x17fcf3,_0x38602a){var _0xc09fbc={'XMF-ECM':_0x38602a[_0xac5b('0xa')],'XMF-HEADERINFO':_0x38602a['headerinfo'],'XMF-MINRATE':_0x38602a['minrate'],'XMF-MAXRATE':_0x38602a[_0xac5b('0xb')],'XMF-MODEM':util['format'](_0xac5b('0xc'),_0x38602a[_0xac5b('0xd')]),'XMF-GATEWAY':_0x38602a[_0xac5b('0xe')],'XMF-FAXDETECT':_0x38602a[_0xac5b('0xf')],'XMF-T38TIMEOUT':_0x38602a[_0xac5b('0x10')],'XMF-LOCALSTATIONID':_0x38602a[_0xac5b('0x11')],'XMF-PATH':_0x17fcf3[_0xac5b('0x12')]};return _0xc09fbc;};exports[_0xac5b('0x13')]=function(_0x2e22b5,_0x59e879){return{'actionid':_0x2e22b5[_0xac5b('0x14')],'action':_0xac5b('0x15'),'channel':_0x2e22b5[_0xac5b('0x16')],'Exten':_0xac5b('0x17'),'Context':_0xac5b('0x18'),'Priority':'1','callerid':util[_0xac5b('0x19')](_0xac5b('0x1a'),_0x2e22b5[_0xac5b('0x1b')]?_0x2e22b5[_0xac5b('0x1b')]:'',_0x2e22b5[_0xac5b('0x11')]),'variable':_0x59e879,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2e22b5[_0xac5b('0x14')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index ebc695d..cf36e44 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 _0x7f17=['./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./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','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','listen','sync','inspect','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x7f17,0x129));var _0x77f1=function(_0x3c1ca2,_0x3428ae){_0x3c1ca2=_0x3c1ca2-0x0;var _0x310c01=_0x7f17[_0x3c1ca2];return _0x310c01;};'use strict';var util=require(_0x77f1('0x0'));var moment=require(_0x77f1('0x1'));var server=require(_0x77f1('0x2'));var Realtime=require(_0x77f1('0x3'));var Report=require(_0x77f1('0x4'));var Acw=require(_0x77f1('0x5'));var Trigger=require(_0x77f1('0x6'));var Dialer=require(_0x77f1('0x7'));var Preview=require(_0x77f1('0x8'));var Fax=require(_0x77f1('0x9'));var user=require('./rpc/user');var voiceQueue=require(_0x77f1('0xa'));var voiceQueueReport=require(_0x77f1('0xb'));var voiceCallReport=require(_0x77f1('0xc'));var trunk=require('./rpc/trunk');var trigger=require(_0x77f1('0xd'));var template=require(_0x77f1('0xe'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x77f1('0xf'));var voiceExtension=require(_0x77f1('0x10'));var faxAccount=require(_0x77f1('0x11'));var zendesk=require(_0x77f1('0x12'));var salesforce=require(_0x77f1('0x13'));var sugarcrm=require(_0x77f1('0x14'));var freshdesk=require(_0x77f1('0x15'));var desk=require(_0x77f1('0x16'));var zoho=require(_0x77f1('0x17'));var vtiger=require(_0x77f1('0x18'));var freshsales=require(_0x77f1('0x19'));var servicenow=require(_0x77f1('0x1a'));var dynamics365=require(_0x77f1('0x1b'));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(_0x77f1('0x1c'))(_0x77f1('0x1d'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x77f1('0x1e')](_0x77f1('0x1f'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x77f1('0x1f'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x77f1('0x20')]()[_0x77f1('0x21')](user[_0x77f1('0x22')]())[_0x77f1('0x21')](realtime[_0x77f1('0x23')]())[_0x77f1('0x21')](user['getTelephones']())[_0x77f1('0x21')](realtime[_0x77f1('0x24')]())[_0x77f1('0x21')](trunk[_0x77f1('0x25')]())['then'](realtime[_0x77f1('0x26')]())[_0x77f1('0x21')](voiceQueue[_0x77f1('0x27')]())[_0x77f1('0x21')](realtime[_0x77f1('0x28')]())[_0x77f1('0x21')](trigger[_0x77f1('0x29')]())[_0x77f1('0x21')](realtime[_0x77f1('0x2a')]())[_0x77f1('0x21')](template['getTemplates']())[_0x77f1('0x21')](realtime[_0x77f1('0x2b')]())[_0x77f1('0x21')](zendesk[_0x77f1('0x2c')]())[_0x77f1('0x21')](realtime[_0x77f1('0x2d')]())[_0x77f1('0x21')](salesforce['getSalesforceAccounts']())[_0x77f1('0x21')](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0x77f1('0x2e')]())['then'](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x77f1('0x2f')]())[_0x77f1('0x21')](realtime[_0x77f1('0x30')]())[_0x77f1('0x21')](desk[_0x77f1('0x31')]())[_0x77f1('0x21')](realtime[_0x77f1('0x32')]())[_0x77f1('0x21')](zoho['getZohoAccounts']())[_0x77f1('0x21')](realtime[_0x77f1('0x33')]())[_0x77f1('0x21')](vtiger[_0x77f1('0x34')]())[_0x77f1('0x21')](realtime[_0x77f1('0x35')]())['then'](freshsales[_0x77f1('0x36')]())[_0x77f1('0x21')](realtime[_0x77f1('0x37')]())['then'](servicenow[_0x77f1('0x38')]())[_0x77f1('0x21')](realtime[_0x77f1('0x39')]())[_0x77f1('0x21')](dynamics365[_0x77f1('0x3a')]())[_0x77f1('0x21')](realtime[_0x77f1('0x3b')]())[_0x77f1('0x21')](campaign[_0x77f1('0x3c')]())[_0x77f1('0x21')](realtime[_0x77f1('0x3d')]())[_0x77f1('0x21')](voiceExtension['getVoiceExtensions']())['then'](realtime['initVoiceExtensions']())[_0x77f1('0x21')](faxAccount[_0x77f1('0x3e')]())[_0x77f1('0x21')](realtime[_0x77f1('0x3f')]())[_0x77f1('0x21')](function(){return realtime;});}function initParams(){return Promise[_0x77f1('0x20')]()[_0x77f1('0x21')](voiceQueueReport[_0x77f1('0x40')]())[_0x77f1('0x21')](realtime[_0x77f1('0x41')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x77f1('0x21')](realtime[_0x77f1('0x42')]())[_0x77f1('0x21')](cmHopperHistory[_0x77f1('0x43')]())[_0x77f1('0x21')](realtime[_0x77f1('0x44')]())[_0x77f1('0x21')](voiceCallReport[_0x77f1('0x45')]())[_0x77f1('0x21')](realtime[_0x77f1('0x46')]())[_0x77f1('0x47')](function(_0x3ec49f){logger[_0x77f1('0x48')](_0x77f1('0x49'),util['inspect'](_0x3ec49f,{'showHidden':![],'depth':null}));});}function main(){return server[_0x77f1('0x4a')](realtime,preview,fax)[_0x77f1('0x21')](function(){return initRealtime();})['then'](function(){return initParams();})[_0x77f1('0x21')](function(){report[_0x77f1('0x4b')]();setInterval(initRealtime,0x1388);})[_0x77f1('0x47')](function(_0x58e59e){logger['error']('[index.js][main]',util[_0x77f1('0x4c')](_0x58e59e,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xed41=['getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','[index.js][main]','util','moment','./server','./realtime','./acw','./dialer','./preview','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xed41,0x1c8));var _0x1ed4=function(_0x5f3bf7,_0x578a8a){_0x5f3bf7=_0x5f3bf7-0x0;var _0x4e4b86=_0xed41[_0x5f3bf7];return _0x4e4b86;};'use strict';var util=require(_0x1ed4('0x0'));var moment=require(_0x1ed4('0x1'));var server=require(_0x1ed4('0x2'));var Realtime=require(_0x1ed4('0x3'));var Report=require('./report');var Acw=require(_0x1ed4('0x4'));var Trigger=require('./trigger');var Dialer=require(_0x1ed4('0x5'));var Preview=require(_0x1ed4('0x6'));var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require(_0x1ed4('0x7'));var voiceQueueReport=require(_0x1ed4('0x8'));var voiceCallReport=require(_0x1ed4('0x9'));var trunk=require(_0x1ed4('0xa'));var trigger=require(_0x1ed4('0xb'));var template=require(_0x1ed4('0xc'));var cmHopperHistory=require(_0x1ed4('0xd'));var campaign=require(_0x1ed4('0xe'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x1ed4('0xf'));var zendesk=require(_0x1ed4('0x10'));var salesforce=require(_0x1ed4('0x11'));var sugarcrm=require(_0x1ed4('0x12'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x1ed4('0x13'));var zoho=require(_0x1ed4('0x14'));var vtiger=require(_0x1ed4('0x15'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x1ed4('0x16'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x1ed4('0x17'))(_0x1ed4('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x1ed4('0x19')](_0x1ed4('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x1ed4('0x1b')]()[_0x1ed4('0x1c')](user[_0x1ed4('0x1d')]())[_0x1ed4('0x1c')](realtime[_0x1ed4('0x1e')]())[_0x1ed4('0x1c')](user[_0x1ed4('0x1f')]())[_0x1ed4('0x1c')](realtime[_0x1ed4('0x20')]())['then'](trunk[_0x1ed4('0x21')]())[_0x1ed4('0x1c')](realtime[_0x1ed4('0x22')]())['then'](voiceQueue[_0x1ed4('0x23')]())[_0x1ed4('0x1c')](realtime[_0x1ed4('0x24')]())['then'](trigger['getTriggers']())[_0x1ed4('0x1c')](realtime[_0x1ed4('0x25')]())[_0x1ed4('0x1c')](template['getTemplates']())[_0x1ed4('0x1c')](realtime[_0x1ed4('0x26')]())[_0x1ed4('0x1c')](zendesk[_0x1ed4('0x27')]())[_0x1ed4('0x1c')](realtime[_0x1ed4('0x28')]())[_0x1ed4('0x1c')](salesforce[_0x1ed4('0x29')]())[_0x1ed4('0x1c')](realtime[_0x1ed4('0x2a')]())[_0x1ed4('0x1c')](sugarcrm[_0x1ed4('0x2b')]())[_0x1ed4('0x1c')](realtime[_0x1ed4('0x2c')]())[_0x1ed4('0x1c')](freshdesk[_0x1ed4('0x2d')]())[_0x1ed4('0x1c')](realtime[_0x1ed4('0x2e')]())['then'](desk[_0x1ed4('0x2f')]())[_0x1ed4('0x1c')](realtime[_0x1ed4('0x30')]())[_0x1ed4('0x1c')](zoho[_0x1ed4('0x31')]())[_0x1ed4('0x1c')](realtime[_0x1ed4('0x32')]())[_0x1ed4('0x1c')](vtiger['getVtigerAccounts']())[_0x1ed4('0x1c')](realtime[_0x1ed4('0x33')]())['then'](freshsales[_0x1ed4('0x34')]())[_0x1ed4('0x1c')](realtime[_0x1ed4('0x35')]())[_0x1ed4('0x1c')](servicenow[_0x1ed4('0x36')]())[_0x1ed4('0x1c')](realtime['initServicenowAccounts']())[_0x1ed4('0x1c')](dynamics365[_0x1ed4('0x37')]())['then'](realtime[_0x1ed4('0x38')]())[_0x1ed4('0x1c')](campaign[_0x1ed4('0x39')]())[_0x1ed4('0x1c')](realtime[_0x1ed4('0x3a')]())['then'](voiceExtension['getVoiceExtensions']())[_0x1ed4('0x1c')](realtime[_0x1ed4('0x3b')]())[_0x1ed4('0x1c')](faxAccount[_0x1ed4('0x3c')]())[_0x1ed4('0x1c')](realtime[_0x1ed4('0x3d')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0x1ed4('0x1b')]()['then'](voiceQueueReport[_0x1ed4('0x3e')]())[_0x1ed4('0x1c')](realtime['initVoiceQueueReports']())[_0x1ed4('0x1c')](cmHopperHistory[_0x1ed4('0x3f')]())[_0x1ed4('0x1c')](realtime['initVoiceQueueHopperHistory']())[_0x1ed4('0x1c')](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime[_0x1ed4('0x40')]())[_0x1ed4('0x1c')](voiceCallReport[_0x1ed4('0x41')]())[_0x1ed4('0x1c')](realtime[_0x1ed4('0x42')]())[_0x1ed4('0x43')](function(_0xbd4e7e){logger[_0x1ed4('0x44')](_0x1ed4('0x45'),util[_0x1ed4('0x46')](_0xbd4e7e,{'showHidden':![],'depth':null}));});}function main(){return server[_0x1ed4('0x47')](realtime,preview,fax)[_0x1ed4('0x1c')](function(){return initRealtime();})[_0x1ed4('0x1c')](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x1ed4('0x43')](function(_0x49b92a){logger[_0x1ed4('0x44')](_0x1ed4('0x48'),util[_0x1ed4('0x46')](_0x49b92a,{'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 9fcd470..0c42d2d 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 _0x7f0e=['exports','md5','ioredis','../../../config/environment','localhost','socket.io-emitter','redis','name','email','accountcode','fullname','state','unknown','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','idle','inuse','talking','statePause','toNumber','format','emit','user:save'];(function(_0x7ebdf1,_0xc93d6e){var _0x2a1b2e=function(_0x584a24){while(--_0x584a24){_0x7ebdf1['push'](_0x7ebdf1['shift']());}};_0x2a1b2e(++_0xc93d6e);}(_0x7f0e,0xd9));var _0xe7f0=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7f0e[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var md5=require(_0xe7f0('0x0'));var Redis=require(_0xe7f0('0x1'));var config=require(_0xe7f0('0x2'));config['redis']=_['defaults'](config['redis'],{'host':_0xe7f0('0x3'),'port':0x18eb});var io=require(_0xe7f0('0x4'))(new Redis(config[_0xe7f0('0x5')]));function Agent(_0x191624){this['id']=_0x191624['id']||0x0;this[_0xe7f0('0x6')]=_0x191624['name']||'';this['email']=_0x191624[_0xe7f0('0x7')]||'';this[_0xe7f0('0x8')]=_0x191624[_0xe7f0('0x8')]||'';this['fullname']=_0x191624[_0xe7f0('0x9')]||'';this[_0xe7f0('0xa')]=_0xe7f0('0xb');this['stateTime']=0x0;this[_0xe7f0('0xc')]=_0xe7f0('0xb');this[_0xe7f0('0xd')]='';this[_0xe7f0('0xe')]='';this[_0xe7f0('0xf')]='';this[_0xe7f0('0x10')]='';this[_0xe7f0('0x11')]=_0x191624[_0xe7f0('0x11')]||![];this[_0xe7f0('0x12')]=_0xe7f0('0xb');this[_0xe7f0('0x13')]=0x0;this[_0xe7f0('0x14')]='';this[_0xe7f0('0x15')]='';this[_0xe7f0('0x16')]=![];this[_0xe7f0('0x17')]=![];this[_0xe7f0('0x0')]='';}Agent[_0xe7f0('0x18')][_0xe7f0('0x19')]=function(_0x2130a2){var _0x50b18e;if(_0x2130a2&&_0x2130a2[_0xe7f0('0xa')]){_0x50b18e=_0x2130a2['state'][_0xe7f0('0x1a')]();switch(_0x50b18e){case'not_inuse':_0x50b18e=_0xe7f0('0x1b');break;case _0xe7f0('0x1c'):_0x50b18e=_0xe7f0('0x1d');break;}}if(_0x50b18e&&this[_0xe7f0('0x12')]!==_0x50b18e||_0x2130a2[_0xe7f0('0x1e')]){this[_0xe7f0('0x13')]=_[_0xe7f0('0x1f')](moment()[_0xe7f0('0x20')]('x'));}if(_0x50b18e){this[_0xe7f0('0x12')]=_0x50b18e;}var _0xd03705={'id':this['id'],'name':this[_0xe7f0('0x6')],'email':this[_0xe7f0('0x7')],'accountcode':this[_0xe7f0('0x8')],'fullname':this[_0xe7f0('0x9')],'state':this[_0xe7f0('0xa')],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0xe7f0('0xd')],'online':this[_0xe7f0('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xe7f0('0x13')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0xe7f0('0x10')],'onhold':this[_0xe7f0('0x16')]};var _0x4b4475=md5(JSON['stringify'](_0xd03705));if(this[_0xe7f0('0x0')]!==_0x4b4475){this[_0xe7f0('0x0')]=_0x4b4475;io['to'](util['format']('user:%s',_0xd03705[_0xe7f0('0x6')]))[_0xe7f0('0x21')](_0xe7f0('0x22'),_0xd03705);io[_0xe7f0('0x21')]('user:presence',_0xd03705);}};module[_0xe7f0('0x23')]=Agent; \ No newline at end of file +var _0x576d=['statePause','format','status','onhold','user:%s','emit','exports','util','moment','md5','ioredis','../../../config/environment','redis','localhost','name','email','accountcode','fullname','state','unknown','stateTime','address','phone','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking'];(function(_0x4b62db,_0x1b18d3){var _0x2935a0=function(_0x1c7e6e){while(--_0x1c7e6e){_0x4b62db['push'](_0x4b62db['shift']());}};_0x2935a0(++_0x1b18d3);}(_0x576d,0x103));var _0xd576=function(_0xefb667,_0x1108a2){_0xefb667=_0xefb667-0x0;var _0x34f80d=_0x576d[_0xefb667];return _0x34f80d;};'use strict';var _=require('lodash');var util=require(_0xd576('0x0'));var moment=require(_0xd576('0x1'));var md5=require(_0xd576('0x2'));var Redis=require(_0xd576('0x3'));var config=require(_0xd576('0x4'));config[_0xd576('0x5')]=_['defaults'](config[_0xd576('0x5')],{'host':_0xd576('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x28221a){this['id']=_0x28221a['id']||0x0;this[_0xd576('0x7')]=_0x28221a[_0xd576('0x7')]||'';this[_0xd576('0x8')]=_0x28221a[_0xd576('0x8')]||'';this[_0xd576('0x9')]=_0x28221a['accountcode']||'';this['fullname']=_0x28221a[_0xd576('0xa')]||'';this[_0xd576('0xb')]=_0xd576('0xc');this[_0xd576('0xd')]=0x0;this['status']=_0xd576('0xc');this[_0xd576('0xe')]='';this[_0xd576('0xf')]='';this['mobile']='';this[_0xd576('0x10')]='';this['online']=_0x28221a[_0xd576('0x11')]||![];this[_0xd576('0x12')]=_0xd576('0xc');this[_0xd576('0x13')]=0x0;this[_0xd576('0x14')]='';this[_0xd576('0x15')]='';this['onhold']=![];this['local']=![];this['md5']='';}Agent[_0xd576('0x16')][_0xd576('0x17')]=function(_0x3d541e){var _0x42d785;if(_0x3d541e&&_0x3d541e[_0xd576('0xb')]){_0x42d785=_0x3d541e[_0xd576('0xb')][_0xd576('0x18')]();switch(_0x42d785){case _0xd576('0x19'):_0x42d785=_0xd576('0x1a');break;case _0xd576('0x1b'):_0x42d785=_0xd576('0x1c');break;}}if(_0x42d785&&this['voiceStatus']!==_0x42d785||_0x3d541e[_0xd576('0x1d')]){this[_0xd576('0x13')]=_['toNumber'](moment()[_0xd576('0x1e')]('x'));}if(_0x42d785){this['voiceStatus']=_0x42d785;}var _0x517996={'id':this['id'],'name':this['name'],'email':this[_0xd576('0x8')],'accountcode':this[_0xd576('0x9')],'fullname':this[_0xd576('0xa')],'state':this[_0xd576('0xb')],'stateTime':this[_0xd576('0xd')],'status':this[_0xd576('0x1f')],'address':this[_0xd576('0xe')],'online':this[_0xd576('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xd576('0x13')],'voiceStatusCallerIdNumber':this[_0xd576('0x14')],'voiceStatusQueue':this[_0xd576('0x15')],'interface':this[_0xd576('0x10')],'onhold':this[_0xd576('0x20')]};var _0x164e3a=md5(JSON['stringify'](_0x517996));if(this[_0xd576('0x2')]!==_0x164e3a){this[_0xd576('0x2')]=_0x164e3a;io['to'](util[_0xd576('0x1e')](_0xd576('0x21'),_0x517996[_0xd576('0x7')]))[_0xd576('0x22')]('user:save',_0x517996);io['emit']('user:presence',_0x517996);}};module[_0xd576('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index f18925f..94514a9 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 _0xfd66=['dialQueueProject','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','campaign','originated','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject'];(function(_0x5e8078,_0x4f69bc){var _0x1e93e1=function(_0x3163fe){while(--_0x3163fe){_0x5e8078['push'](_0x5e8078['shift']());}};_0x1e93e1(++_0x4f69bc);}(_0xfd66,0xcf));var _0x6fd6=function(_0x1f48f3,_0x22326e){_0x1f48f3=_0x1f48f3-0x0;var _0x337829=_0xfd66[_0x1f48f3];return _0x337829;};'use strict';function Campaign(_0x2fd3da){this['id']=_0x2fd3da['id']||0x0;this[_0x6fd6('0x0')]=_0x2fd3da[_0x6fd6('0x0')]||'';this['type']=_0x2fd3da['type']||_0x6fd6('0x1');this[_0x6fd6('0x2')]=0x0;this['temp']=0x0;this[_0x6fd6('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x6fd6('0x4')]='';this[_0x6fd6('0x5')]=!![];this['active']=_0x2fd3da[_0x6fd6('0x6')];this[_0x6fd6('0x7')]=_0x2fd3da[_0x6fd6('0x7')];this[_0x6fd6('0x8')]=_0x2fd3da[_0x6fd6('0x8')]||null;this[_0x6fd6('0x9')]=_0x2fd3da[_0x6fd6('0x9')]?_0x2fd3da['dialGlobalInterval']:null;this[_0x6fd6('0xa')]=_0x2fd3da[_0x6fd6('0xa')];this[_0x6fd6('0xb')]=_0x2fd3da[_0x6fd6('0xb')];this[_0x6fd6('0xc')]=_0x2fd3da['dialOriginateTimeout']||0x1e;this[_0x6fd6('0xd')]=_0x2fd3da[_0x6fd6('0xd')];this[_0x6fd6('0xe')]=_0x2fd3da[_0x6fd6('0xe')];this[_0x6fd6('0xf')]=_0x2fd3da['dialBusyMaxRetry'];this[_0x6fd6('0x10')]=_0x2fd3da['dialBusyRetryFrequency'];this[_0x6fd6('0x11')]=_0x2fd3da[_0x6fd6('0x11')];this[_0x6fd6('0x12')]=_0x2fd3da['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x2fd3da[_0x6fd6('0x13')];this[_0x6fd6('0x14')]=_0x2fd3da[_0x6fd6('0x14')]||0x3;this[_0x6fd6('0x15')]=_0x2fd3da[_0x6fd6('0x15')]||0x96;this[_0x6fd6('0x16')]=_0x2fd3da[_0x6fd6('0x16')]||0x3;this[_0x6fd6('0x17')]=_0x2fd3da[_0x6fd6('0x17')]||0x96;this[_0x6fd6('0x18')]=_0x2fd3da[_0x6fd6('0x18')]||0x3;this['dialAbandonedRetryFrequency']=_0x2fd3da[_0x6fd6('0x19')]||0x96;this[_0x6fd6('0x1a')]=_0x2fd3da[_0x6fd6('0x1a')]||0x3;this[_0x6fd6('0x1b')]=_0x2fd3da[_0x6fd6('0x1b')]||0x96;this['dialAgentRejectMaxRetry']=_0x2fd3da['dialAgentRejectMaxRetry']||0x3;this[_0x6fd6('0x1c')]=_0x2fd3da[_0x6fd6('0x1c')]||0x96;this[_0x6fd6('0x1d')]=_0x2fd3da[_0x6fd6('0x1d')]||_0x6fd6('0x1e');this[_0x6fd6('0x1f')]=_0x2fd3da['dialPrefix']||undefined;this[_0x6fd6('0x20')]=_0x2fd3da[_0x6fd6('0x20')]||undefined;this[_0x6fd6('0x21')]=_0x2fd3da[_0x6fd6('0x21')]||undefined;this[_0x6fd6('0x22')]=_0x2fd3da[_0x6fd6('0x22')]?_0x2fd3da[_0x6fd6('0x22')]:undefined;this[_0x6fd6('0x23')]=_0x2fd3da['Trunk']?_0x2fd3da['Trunk']:undefined;this[_0x6fd6('0x24')]=_0x2fd3da[_0x6fd6('0x24')]?_0x2fd3da[_0x6fd6('0x24')]:undefined;this[_0x6fd6('0x25')]=_0x2fd3da[_0x6fd6('0x25')]?_0x2fd3da[_0x6fd6('0x25')]:undefined;this[_0x6fd6('0x26')]=_0x2fd3da[_0x6fd6('0x25')]?_0x2fd3da[_0x6fd6('0x25')]['name']:undefined;this['dialAMDActive']=_0x2fd3da['dialAMDActive']||![];this[_0x6fd6('0x27')]=_0x2fd3da[_0x6fd6('0x27')];this[_0x6fd6('0x28')]=_0x2fd3da[_0x6fd6('0x28')];this[_0x6fd6('0x29')]=_0x2fd3da[_0x6fd6('0x29')];this[_0x6fd6('0x2a')]=_0x2fd3da[_0x6fd6('0x2a')];this[_0x6fd6('0x2b')]=_0x2fd3da[_0x6fd6('0x2b')];this[_0x6fd6('0x2c')]=_0x2fd3da['dialAMDBetweenWordsSilence'];this[_0x6fd6('0x2d')]=_0x2fd3da[_0x6fd6('0x2d')];this['dialAMDSilenceThreshold']=_0x2fd3da[_0x6fd6('0x2e')];this['dialAMDMaximumWordLength']=_0x2fd3da[_0x6fd6('0x2f')];}module[_0x6fd6('0x30')]=Campaign; \ No newline at end of file +var _0xac31=['dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','limitCalls','dialTimezone','dialGlobalInterval'];(function(_0x124728,_0x463dca){var _0x8eb20f=function(_0x49d9de){while(--_0x49d9de){_0x124728['push'](_0x124728['shift']());}};_0x8eb20f(++_0x463dca);}(_0xac31,0xe6));var _0x1ac3=function(_0x42a4b4,_0x127f85){_0x42a4b4=_0x42a4b4-0x0;var _0x3ca387=_0xac31[_0x42a4b4];return _0x3ca387;};'use strict';function Campaign(_0x28d53f){this['id']=_0x28d53f['id']||0x0;this[_0x1ac3('0x0')]=_0x28d53f['name']||'';this['type']=_0x28d53f[_0x1ac3('0x1')]||_0x1ac3('0x2');this['originated']=0x0;this[_0x1ac3('0x3')]=0x0;this[_0x1ac3('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x1ac3('0x5')]='';this[_0x1ac3('0x6')]=!![];this['active']=_0x28d53f['active'];this[_0x1ac3('0x7')]=_0x28d53f[_0x1ac3('0x7')];this['dialTimezone']=_0x28d53f[_0x1ac3('0x8')]||null;this[_0x1ac3('0x9')]=_0x28d53f['dialGlobalInterval']?_0x28d53f['dialGlobalInterval']:null;this[_0x1ac3('0xa')]=_0x28d53f['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x28d53f[_0x1ac3('0xb')];this[_0x1ac3('0xc')]=_0x28d53f[_0x1ac3('0xc')]||0x1e;this[_0x1ac3('0xd')]=_0x28d53f[_0x1ac3('0xd')];this[_0x1ac3('0xe')]=_0x28d53f[_0x1ac3('0xe')];this[_0x1ac3('0xf')]=_0x28d53f['dialBusyMaxRetry'];this[_0x1ac3('0x10')]=_0x28d53f[_0x1ac3('0x10')];this[_0x1ac3('0x11')]=_0x28d53f['dialNoAnswerMaxRetry'];this[_0x1ac3('0x12')]=_0x28d53f[_0x1ac3('0x12')];this['dialGlobalMaxRetry']=_0x28d53f[_0x1ac3('0x13')];this[_0x1ac3('0x14')]=_0x28d53f['dialNoSuchNumberMaxRetry']||0x3;this[_0x1ac3('0x15')]=_0x28d53f[_0x1ac3('0x15')]||0x96;this[_0x1ac3('0x16')]=_0x28d53f['dialDropMaxRetry']||0x3;this[_0x1ac3('0x17')]=_0x28d53f[_0x1ac3('0x17')]||0x96;this['dialAbandonedMaxRetry']=_0x28d53f['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x28d53f['dialAbandonedRetryFrequency']||0x96;this[_0x1ac3('0x18')]=_0x28d53f['dialMachineMaxRetry']||0x3;this[_0x1ac3('0x19')]=_0x28d53f[_0x1ac3('0x19')]||0x96;this['dialAgentRejectMaxRetry']=_0x28d53f[_0x1ac3('0x1a')]||0x3;this[_0x1ac3('0x1b')]=_0x28d53f[_0x1ac3('0x1b')]||0x96;this[_0x1ac3('0x1c')]=_0x28d53f['dialOrderByScheduledAt']||_0x1ac3('0x1d');this['dialPrefix']=_0x28d53f[_0x1ac3('0x1e')]||undefined;this[_0x1ac3('0x1f')]=_0x28d53f['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x1ac3('0x20')]=_0x28d53f['dialCutDigit']||undefined;this[_0x1ac3('0x21')]=_0x28d53f[_0x1ac3('0x21')]?_0x28d53f[_0x1ac3('0x21')]:undefined;this['Trunk']=_0x28d53f[_0x1ac3('0x22')]?_0x28d53f[_0x1ac3('0x22')]:undefined;this['Interval']=_0x28d53f[_0x1ac3('0x23')]?_0x28d53f[_0x1ac3('0x23')]:undefined;this[_0x1ac3('0x24')]=_0x28d53f[_0x1ac3('0x24')]?_0x28d53f[_0x1ac3('0x24')]:undefined;this[_0x1ac3('0x25')]=_0x28d53f[_0x1ac3('0x24')]?_0x28d53f[_0x1ac3('0x24')]['name']:undefined;this['dialAMDActive']=_0x28d53f['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x28d53f[_0x1ac3('0x26')];this[_0x1ac3('0x27')]=_0x28d53f[_0x1ac3('0x27')];this[_0x1ac3('0x28')]=_0x28d53f[_0x1ac3('0x28')];this[_0x1ac3('0x29')]=_0x28d53f[_0x1ac3('0x29')];this[_0x1ac3('0x2a')]=_0x28d53f[_0x1ac3('0x2a')];this['dialAMDBetweenWordsSilence']=_0x28d53f[_0x1ac3('0x2b')];this[_0x1ac3('0x2c')]=_0x28d53f['dialAMDMaximumNumberOfWords'];this[_0x1ac3('0x2d')]=_0x28d53f[_0x1ac3('0x2d')];this[_0x1ac3('0x2e')]=_0x28d53f[_0x1ac3('0x2e')];}module[_0x1ac3('0x2f')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index e282fb7..17415ce 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 _0x757c=['exports','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','tag','monitor','queue','transfercalleridnum','transferconnectedlinenum','transferType','mohtime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x757c,0x191));var _0xc757=function(_0x5bf425,_0x1edfd6){_0x5bf425=_0x5bf425-0x0;var _0x34e7bc=_0x757c[_0x5bf425];return _0x34e7bc;};'use strict';function Channel(){this[_0xc757('0x0')]=null;this[_0xc757('0x1')]='';this['destinationchannel']='';this[_0xc757('0x2')]=0x0;this[_0xc757('0x3')]='';this[_0xc757('0x4')]=undefined;this[_0xc757('0x5')]=undefined;this[_0xc757('0x6')]=0x0;this[_0xc757('0x7')]='';this[_0xc757('0x8')]=0x0;this['linkedid']=0x0;this['exten']=0x0;this[_0xc757('0x9')]=![];this['answertime']=null;this[_0xc757('0xa')]=null;this[_0xc757('0xb')]=![];this[_0xc757('0xc')]=![];this[_0xc757('0xd')]='';this[_0xc757('0xe')]='';this[_0xc757('0xf')]=0x0;this[_0xc757('0x10')]=0x0;this['holdtime']=0x0;this['type']=null;this[_0xc757('0x11')]=null;this['disposition']=null;this[_0xc757('0x12')]=![];this['monitorFilename']=null;this[_0xc757('0x13')]=null;this['monitors']=[];this[_0xc757('0x14')]=undefined;this[_0xc757('0x15')]=undefined;this[_0xc757('0x16')]=undefined;this[_0xc757('0x17')]=0x0;}module[_0xc757('0x18')]=Channel; \ No newline at end of file +var _0x0f42=['tag','disposition','monitor','queue','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel','destinationchannel','calleridnum','connectedlinenum','accountcode','uniqueid','linkedid','exten','answertime','endtime','abandoned','billableseconds','type'];(function(_0x6b888e,_0x420fed){var _0x17d0f6=function(_0x42675a){while(--_0x42675a){_0x6b888e['push'](_0x6b888e['shift']());}};_0x17d0f6(++_0x420fed);}(_0x0f42,0x126));var _0x20f4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0f42[_0x432682];return _0x463d05;};'use strict';function Channel(){this[_0x20f4('0x0')]=null;this[_0x20f4('0x1')]='';this[_0x20f4('0x2')]='';this[_0x20f4('0x3')]=0x0;this['calleridname']='';this[_0x20f4('0x4')]=undefined;this['connectedlinename']=undefined;this[_0x20f4('0x5')]=0x0;this['context']='';this[_0x20f4('0x6')]=0x0;this[_0x20f4('0x7')]=0x0;this[_0x20f4('0x8')]=0x0;this['answered']=![];this[_0x20f4('0x9')]=null;this[_0x20f4('0xa')]=null;this['unmanaged']=![];this[_0x20f4('0xb')]=![];this['lastapplication']='';this['lastdata']='';this['duration']=0x0;this[_0x20f4('0xc')]=0x0;this['holdtime']=0x0;this[_0x20f4('0xd')]=null;this[_0x20f4('0xe')]=null;this[_0x20f4('0xf')]=null;this[_0x20f4('0x10')]=![];this['monitorFilename']=null;this[_0x20f4('0x11')]=null;this['monitors']=[];this[_0x20f4('0x12')]=undefined;this[_0x20f4('0x13')]=undefined;this[_0x20f4('0x14')]=undefined;this[_0x20f4('0x15')]=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 a9c7ca2..f9fad5f 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 _0xd887=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType'];(function(_0xff7e15,_0xf0db6e){var _0x3989be=function(_0x3d1320){while(--_0x3d1320){_0xff7e15['push'](_0xff7e15['shift']());}};_0x3989be(++_0xf0db6e);}(_0xd887,0x1dd));var _0x7d88=function(_0x2ecbfd,_0x5bacbc){_0x2ecbfd=_0x2ecbfd-0x0;var _0x2c65a2=_0xd887[_0x2ecbfd];return _0x2c65a2;};'use strict';function DeskAccount(_0x222ebd){this['id']=_0x222ebd['id']||0x0;this[_0x7d88('0x0')]=_0x222ebd[_0x7d88('0x0')]||'';this[_0x7d88('0x1')]=_0x222ebd['username']||'';this[_0x7d88('0x2')]=_0x222ebd[_0x7d88('0x2')]||'';this[_0x7d88('0x3')]=_0x222ebd[_0x7d88('0x3')]||'';this[_0x7d88('0x4')]=_0x222ebd[_0x7d88('0x4')]||'';this['consumerKey']=_0x222ebd[_0x7d88('0x5')]||'';this[_0x7d88('0x6')]=_0x222ebd['consumerSecret']||'';this[_0x7d88('0x7')]=_0x222ebd[_0x7d88('0x7')]||'';this[_0x7d88('0x8')]=_0x222ebd[_0x7d88('0x8')]||'';this[_0x7d88('0x9')]=_0x222ebd[_0x7d88('0x9')]||'';this[_0x7d88('0xa')]=_0x222ebd[_0x7d88('0xa')]||'';this[_0x7d88('0xb')]=_0x222ebd['Configurations']||{};}module[_0x7d88('0xc')]=DeskAccount; \ No newline at end of file +var _0x97a4=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','Configurations','name','username'];(function(_0x203a6a,_0x593b86){var _0x5e81e7=function(_0x2a574b){while(--_0x2a574b){_0x203a6a['push'](_0x203a6a['shift']());}};_0x5e81e7(++_0x593b86);}(_0x97a4,0xc4));var _0x497a=function(_0x2d437d,_0x54fc93){_0x2d437d=_0x2d437d-0x0;var _0x43a4dd=_0x97a4[_0x2d437d];return _0x43a4dd;};'use strict';function DeskAccount(_0x14e37e){this['id']=_0x14e37e['id']||0x0;this[_0x497a('0x0')]=_0x14e37e[_0x497a('0x0')]||'';this[_0x497a('0x1')]=_0x14e37e[_0x497a('0x1')]||'';this[_0x497a('0x2')]=_0x14e37e[_0x497a('0x2')]||'';this[_0x497a('0x3')]=_0x14e37e[_0x497a('0x3')]||'';this['password']=_0x14e37e[_0x497a('0x4')]||'';this[_0x497a('0x5')]=_0x14e37e[_0x497a('0x5')]||'';this[_0x497a('0x6')]=_0x14e37e[_0x497a('0x6')]||'';this[_0x497a('0x7')]=_0x14e37e['token']||'';this[_0x497a('0x8')]=_0x14e37e['tokenSecret']||'';this[_0x497a('0x9')]=_0x14e37e['type']||'';this['serverUrl']=_0x14e37e['serverUrl']||'';this[_0x497a('0xa')]=_0x14e37e[_0x497a('0xa')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 611f613..75927e0 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 _0x847d=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','exports'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x847d,0x79));var _0xd847=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0x847d[_0x349148];return _0x2f2b0f;};'use strict';function Dynamics365Account(_0x377dab){this['id']=_0x377dab['id']||0x0;this[_0xd847('0x0')]=_0x377dab[_0xd847('0x0')]||'';this['username']=_0x377dab[_0xd847('0x1')]||'';this[_0xd847('0x2')]=_0x377dab[_0xd847('0x2')]||'';this[_0xd847('0x3')]=_0x377dab[_0xd847('0x3')]||'';this[_0xd847('0x4')]=_0x377dab[_0xd847('0x4')]||'';this[_0xd847('0x5')]=_0x377dab[_0xd847('0x5')]||'';this[_0xd847('0x6')]=_0x377dab['clientSecret']||{};this['serverUrl']=_0x377dab[_0xd847('0x7')]||'';this['modernAuthentication']=_0x377dab[_0xd847('0x8')]||![];this[_0xd847('0x9')]=_0x377dab[_0xd847('0x9')]||{};this['CloudProvider']=_0x377dab['CloudProvider']||{};}module[_0xd847('0xa')]=Dynamics365Account; \ No newline at end of file +var _0xe4fa=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','name'];(function(_0x101450,_0x3bd2de){var _0x3664b6=function(_0x4e0ad4){while(--_0x4e0ad4){_0x101450['push'](_0x101450['shift']());}};_0x3664b6(++_0x3bd2de);}(_0xe4fa,0x18b));var _0xae4f=function(_0x300c85,_0x5efb57){_0x300c85=_0x300c85-0x0;var _0xdaefd3=_0xe4fa[_0x300c85];return _0xdaefd3;};'use strict';function Dynamics365Account(_0x1e9bd9){this['id']=_0x1e9bd9['id']||0x0;this[_0xae4f('0x0')]=_0x1e9bd9[_0xae4f('0x0')]||'';this[_0xae4f('0x1')]=_0x1e9bd9[_0xae4f('0x1')]||'';this['password']=_0x1e9bd9[_0xae4f('0x2')]||'';this[_0xae4f('0x3')]=_0x1e9bd9['remoteUri']||'';this[_0xae4f('0x4')]=_0x1e9bd9[_0xae4f('0x4')]||'';this[_0xae4f('0x5')]=_0x1e9bd9['clientId']||'';this[_0xae4f('0x6')]=_0x1e9bd9[_0xae4f('0x6')]||{};this['serverUrl']=_0x1e9bd9[_0xae4f('0x7')]||'';this[_0xae4f('0x8')]=_0x1e9bd9[_0xae4f('0x8')]||![];this[_0xae4f('0x9')]=_0x1e9bd9[_0xae4f('0x9')]||{};this[_0xae4f('0xa')]=_0x1e9bd9[_0xae4f('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 20dd67c..10f90e3 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 _0x4ac7=['description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','tech','Trunk','ListId','key','exports'];(function(_0x2bbdfc,_0x3a3863){var _0x2956ee=function(_0x4e1336){while(--_0x4e1336){_0x2bbdfc['push'](_0x2bbdfc['shift']());}};_0x2956ee(++_0x3a3863);}(_0x4ac7,0x13b));var _0x74ac=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x4ac7[_0x173441];return _0x2423a8;};'use strict';function FaxAccount(_0x375ed2){this['id']=_0x375ed2['id']||0x0;this['name']=_0x375ed2['name']||'';this[_0x74ac('0x0')]=_0x375ed2['description'];this[_0x74ac('0x1')]=_0x375ed2[_0x74ac('0x1')];this[_0x74ac('0x2')]=_0x375ed2['headerinfo'];this[_0x74ac('0x3')]=_0x375ed2[_0x74ac('0x3')];this[_0x74ac('0x4')]=_0x375ed2['minrate']||0x960;this[_0x74ac('0x5')]=_0x375ed2[_0x74ac('0x5')]||0x3840;this[_0x74ac('0x6')]=_0x375ed2[_0x74ac('0x6')]||_0x74ac('0x7');this[_0x74ac('0x8')]=_0x375ed2[_0x74ac('0x8')]||'no';this[_0x74ac('0x9')]=_0x375ed2['faxdetect']||'no';this['t38timeout']=_0x375ed2['t38timeout']||0x1388;this[_0x74ac('0xa')]=_0x375ed2[_0x74ac('0xa')]||'SIP';this[_0x74ac('0xb')]=_0x375ed2[_0x74ac('0xb')]?_0x375ed2['Trunk']:undefined;this['ListId']=_0x375ed2[_0x74ac('0xc')];this['key']=_0x375ed2[_0x74ac('0xd')];}module[_0x74ac('0xe')]=FaxAccount; \ No newline at end of file +var _0x9802=['t38timeout','tech','SIP','Trunk','ListId','key','exports','description','ecm','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect'];(function(_0x2f93dd,_0x54a159){var _0x40e66c=function(_0x2d5215){while(--_0x2d5215){_0x2f93dd['push'](_0x2f93dd['shift']());}};_0x40e66c(++_0x54a159);}(_0x9802,0x67));var _0x2980=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9802[_0x53ccf2];return _0x5a2964;};'use strict';function FaxAccount(_0x4ff7a0){this['id']=_0x4ff7a0['id']||0x0;this['name']=_0x4ff7a0['name']||'';this[_0x2980('0x0')]=_0x4ff7a0[_0x2980('0x0')];this['ecm']=_0x4ff7a0[_0x2980('0x1')];this['headerinfo']=_0x4ff7a0['headerinfo'];this[_0x2980('0x2')]=_0x4ff7a0['localstationid'];this['minrate']=_0x4ff7a0[_0x2980('0x3')]||0x960;this[_0x2980('0x4')]=_0x4ff7a0[_0x2980('0x4')]||0x3840;this[_0x2980('0x5')]=_0x4ff7a0['modem']||_0x2980('0x6');this['gateway']=_0x4ff7a0[_0x2980('0x7')]||'no';this['faxdetect']=_0x4ff7a0[_0x2980('0x8')]||'no';this[_0x2980('0x9')]=_0x4ff7a0['t38timeout']||0x1388;this[_0x2980('0xa')]=_0x4ff7a0[_0x2980('0xa')]||_0x2980('0xb');this['Trunk']=_0x4ff7a0['Trunk']?_0x4ff7a0[_0x2980('0xc')]:undefined;this[_0x2980('0xd')]=_0x4ff7a0[_0x2980('0xd')];this[_0x2980('0xe')]=_0x4ff7a0[_0x2980('0xe')];}module[_0x2980('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 08e5c64..e3a1d7d 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 _0x80be=['token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x5bdf48,_0x10ad10){var _0x3be835=function(_0x2e6015){while(--_0x2e6015){_0x5bdf48['push'](_0x5bdf48['shift']());}};_0x3be835(++_0x10ad10);}(_0x80be,0xec));var _0xe80b=function(_0x3cb057,_0x2d01e6){_0x3cb057=_0x3cb057-0x0;var _0x4cab2a=_0x80be[_0x3cb057];return _0x4cab2a;};'use strict';function FreshdeskAccount(_0x3942f0){this['id']=_0x3942f0['id']||0x0;this[_0xe80b('0x0')]=_0x3942f0[_0xe80b('0x0')]||'';this[_0xe80b('0x1')]=_0x3942f0[_0xe80b('0x1')]||'';this['apiKey']=_0x3942f0[_0xe80b('0x2')]||'';this[_0xe80b('0x3')]=_0x3942f0[_0xe80b('0x3')]||'';this[_0xe80b('0x4')]=_0x3942f0[_0xe80b('0x4')]||'';this[_0xe80b('0x5')]=_0x3942f0['Configurations']||{};}module[_0xe80b('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x9a6c=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x21870e,_0x324c59){var _0x2616a0=function(_0x73c66b){while(--_0x73c66b){_0x21870e['push'](_0x21870e['shift']());}};_0x2616a0(++_0x324c59);}(_0x9a6c,0x170));var _0xc9a6=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9a6c[_0x2b7764];return _0x848dcb;};'use strict';function FreshdeskAccount(_0x1f0ff4){this['id']=_0x1f0ff4['id']||0x0;this[_0xc9a6('0x0')]=_0x1f0ff4[_0xc9a6('0x0')]||'';this['username']=_0x1f0ff4[_0xc9a6('0x1')]||'';this[_0xc9a6('0x2')]=_0x1f0ff4[_0xc9a6('0x3')]||'';this[_0xc9a6('0x4')]=_0x1f0ff4[_0xc9a6('0x4')]||'';this[_0xc9a6('0x5')]=_0x1f0ff4[_0xc9a6('0x5')]||'';this['Configurations']=_0x1f0ff4[_0xc9a6('0x6')]||{};}module[_0xc9a6('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 5b4cfe5..203ea06 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 _0x8c46=['serverUrl','Configurations','exports','username','token','remoteUri'];(function(_0x554b65,_0x27f099){var _0x35682a=function(_0x4f4c62){while(--_0x4f4c62){_0x554b65['push'](_0x554b65['shift']());}};_0x35682a(++_0x27f099);}(_0x8c46,0x171));var _0x68c4=function(_0x499757,_0x452ccc){_0x499757=_0x499757-0x0;var _0x544df0=_0x8c46[_0x499757];return _0x544df0;};'use strict';function FreshsalesAccount(_0x2bca70){this['id']=_0x2bca70['id']||0x0;this['name']=_0x2bca70['name']||'';this[_0x68c4('0x0')]=_0x2bca70['username']||'';this['apiKey']=_0x2bca70[_0x68c4('0x1')]||'';this[_0x68c4('0x2')]=_0x2bca70[_0x68c4('0x2')]||'';this[_0x68c4('0x3')]=_0x2bca70[_0x68c4('0x3')]||'';this[_0x68c4('0x4')]=_0x2bca70[_0x68c4('0x4')]||{};}module[_0x68c4('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0x7676=['remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x456f2d,_0x3ff5d8){var _0x18281a=function(_0x503f7d){while(--_0x503f7d){_0x456f2d['push'](_0x456f2d['shift']());}};_0x18281a(++_0x3ff5d8);}(_0x7676,0xb8));var _0x6767=function(_0x1cc24b,_0x52cf43){_0x1cc24b=_0x1cc24b-0x0;var _0x4bc069=_0x7676[_0x1cc24b];return _0x4bc069;};'use strict';function FreshsalesAccount(_0x3e6e53){this['id']=_0x3e6e53['id']||0x0;this[_0x6767('0x0')]=_0x3e6e53[_0x6767('0x0')]||'';this['username']=_0x3e6e53[_0x6767('0x1')]||'';this['apiKey']=_0x3e6e53['token']||'';this[_0x6767('0x2')]=_0x3e6e53['remoteUri']||'';this[_0x6767('0x3')]=_0x3e6e53[_0x6767('0x3')]||'';this[_0x6767('0x4')]=_0x3e6e53['Configurations']||{};}module[_0x6767('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index fadb1c7..2978bf6 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 _0x57fa=['accountcode','context','lastAssignedTo','motionChannel','voice','routealias','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercompleteAt','originalposition','channel','connectedlinenum','connectedlinename'];(function(_0x46b061,_0x55dad6){var _0x37321f=function(_0x48acd8){while(--_0x48acd8){_0x46b061['push'](_0x46b061['shift']());}};_0x37321f(++_0x55dad6);}(_0x57fa,0x180));var _0xa57f=function(_0x1e7e12,_0x586d42){_0x1e7e12=_0x1e7e12-0x0;var _0x32781c=_0x57fa[_0x1e7e12];return _0x32781c;};'use strict';function QueueReport(){this[_0xa57f('0x0')]=_0xa57f('0x1');this[_0xa57f('0x2')]='';this[_0xa57f('0x3')]='';this[_0xa57f('0x4')]='';this[_0xa57f('0x5')]='';this[_0xa57f('0x6')]=null;this[_0xa57f('0x7')]=null;this[_0xa57f('0x8')]=0x1;this[_0xa57f('0x9')]=0x1;this['queuecallerabandon']=![];this[_0xa57f('0xa')]=null;this['queuecallercomplete']=![];this[_0xa57f('0xb')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0xa57f('0xc')]=0x1;this[_0xa57f('0xd')]='';this[_0xa57f('0xe')]='';this[_0xa57f('0xf')]='';this[_0xa57f('0x10')]='';this[_0xa57f('0x11')]='';this['exten']='';this['priority']='';this['holdtime']=0x0;this['assigned']=![];this[_0xa57f('0x12')]='';this[_0xa57f('0x13')]=_0xa57f('0x14');this[_0xa57f('0x15')]=null;this[_0xa57f('0x16')]=0x0;this[_0xa57f('0x17')]={};}module[_0xa57f('0x18')]=QueueReport; \ No newline at end of file +var _0x7dfd=['queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode','context','priority','assigned','motionChannel','voice','routealias','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';function QueueReport(){this[_0xd7df('0x0')]=_0xd7df('0x1');this[_0xd7df('0x2')]='';this[_0xd7df('0x3')]='';this[_0xd7df('0x4')]='';this[_0xd7df('0x5')]='';this[_0xd7df('0x6')]=null;this[_0xd7df('0x7')]=null;this[_0xd7df('0x8')]=0x1;this[_0xd7df('0x9')]=0x1;this[_0xd7df('0xa')]=![];this[_0xd7df('0xb')]=null;this[_0xd7df('0xc')]=![];this[_0xd7df('0xd')]=null;this[_0xd7df('0xe')]=![];this[_0xd7df('0xf')]=null;this[_0xd7df('0x10')]=0x1;this['channel']='';this[_0xd7df('0x11')]='';this[_0xd7df('0x12')]='';this[_0xd7df('0x13')]='';this[_0xd7df('0x14')]='';this['exten']='';this[_0xd7df('0x15')]='';this['holdtime']=0x0;this[_0xd7df('0x16')]=![];this['lastAssignedTo']='';this[_0xd7df('0x17')]=_0xd7df('0x18');this[_0xd7df('0x19')]=null;this[_0xd7df('0x1a')]=0x0;this[_0xd7df('0x1b')]={};}module[_0xd7df('0x1c')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index e379206..cc31f65 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 _0x9918=['clientId','clientSecret','securityToken','type','integrationTab','serverUrl','exports','username','remoteUri','password'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x9918,0x133));var _0x8991=function(_0x500923,_0x3689d9){_0x500923=_0x500923-0x0;var _0x4c4e33=_0x9918[_0x500923];return _0x4c4e33;};'use strict';function SalesforceAccount(_0x48ad2b){this['id']=_0x48ad2b['id']||0x0;this['name']=_0x48ad2b['name']||'';this[_0x8991('0x0')]=_0x48ad2b[_0x8991('0x0')]||'';this[_0x8991('0x1')]=_0x48ad2b['remoteUri']||'';this['password']=_0x48ad2b[_0x8991('0x2')]||'';this[_0x8991('0x3')]=_0x48ad2b[_0x8991('0x3')]||'';this[_0x8991('0x4')]=_0x48ad2b[_0x8991('0x4')]||'';this['securityToken']=_0x48ad2b[_0x8991('0x5')]||'';this[_0x8991('0x6')]=_0x48ad2b[_0x8991('0x6')]||_0x8991('0x7');this[_0x8991('0x8')]=_0x48ad2b[_0x8991('0x8')]||'';this['Configurations']=_0x48ad2b['Configurations']||{};}module[_0x8991('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x909e=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x3d3417,_0x3d878e){var _0x768ea8=function(_0x2051b4){while(--_0x2051b4){_0x3d3417['push'](_0x3d3417['shift']());}};_0x768ea8(++_0x3d878e);}(_0x909e,0x174));var _0xe909=function(_0x2ce7a3,_0x5c7f2d){_0x2ce7a3=_0x2ce7a3-0x0;var _0x83adbe=_0x909e[_0x2ce7a3];return _0x83adbe;};'use strict';function SalesforceAccount(_0x280202){this['id']=_0x280202['id']||0x0;this[_0xe909('0x0')]=_0x280202[_0xe909('0x0')]||'';this[_0xe909('0x1')]=_0x280202[_0xe909('0x1')]||'';this['remoteUri']=_0x280202[_0xe909('0x2')]||'';this[_0xe909('0x3')]=_0x280202['password']||'';this[_0xe909('0x4')]=_0x280202[_0xe909('0x4')]||'';this[_0xe909('0x5')]=_0x280202[_0xe909('0x5')]||'';this[_0xe909('0x6')]=_0x280202[_0xe909('0x6')]||'';this[_0xe909('0x7')]=_0x280202[_0xe909('0x7')]||'integrationTab';this['serverUrl']=_0x280202['serverUrl']||'';this[_0xe909('0x8')]=_0x280202[_0xe909('0x8')]||{};}module[_0xe909('0x9')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 80c42d5..d196527 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 _0x8590=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x3a1b01,_0x55f0ac){var _0x1856e3=function(_0x1b525c){while(--_0x1b525c){_0x3a1b01['push'](_0x3a1b01['shift']());}};_0x1856e3(++_0x55f0ac);}(_0x8590,0x9b));var _0x0859=function(_0x479f54,_0x309962){_0x479f54=_0x479f54-0x0;var _0x45c72d=_0x8590[_0x479f54];return _0x45c72d;};'use strict';function ServicenowAccount(_0x14c74f){this['id']=_0x14c74f['id']||0x0;this[_0x0859('0x0')]=_0x14c74f[_0x0859('0x0')]||'';this[_0x0859('0x1')]=_0x14c74f['username']||'';this[_0x0859('0x2')]=_0x14c74f['password']||'';this[_0x0859('0x3')]=_0x14c74f[_0x0859('0x3')]||'';this[_0x0859('0x4')]=_0x14c74f[_0x0859('0x4')]||'';this[_0x0859('0x5')]=_0x14c74f[_0x0859('0x5')]||{};}module[_0x0859('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x8905=['serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x59b84f,_0x5c84ba){var _0xf9c90c=function(_0x51bda9){while(--_0x51bda9){_0x59b84f['push'](_0x59b84f['shift']());}};_0xf9c90c(++_0x5c84ba);}(_0x8905,0x19b));var _0x5890=function(_0x337f2a,_0x4079bf){_0x337f2a=_0x337f2a-0x0;var _0xa7152b=_0x8905[_0x337f2a];return _0xa7152b;};'use strict';function ServicenowAccount(_0x2fa4e9){this['id']=_0x2fa4e9['id']||0x0;this[_0x5890('0x0')]=_0x2fa4e9[_0x5890('0x0')]||'';this[_0x5890('0x1')]=_0x2fa4e9[_0x5890('0x1')]||'';this['password']=_0x2fa4e9['password']||'';this[_0x5890('0x2')]=_0x2fa4e9[_0x5890('0x2')]||'';this[_0x5890('0x3')]=_0x2fa4e9[_0x5890('0x3')]||'';this['Configurations']=_0x2fa4e9[_0x5890('0x4')]||{};}module[_0x5890('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index b59f40c..6318109 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 _0x492e=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x253e1f,_0x576ba4){var _0x138dc2=function(_0x5085bf){while(--_0x5085bf){_0x253e1f['push'](_0x253e1f['shift']());}};_0x138dc2(++_0x576ba4);}(_0x492e,0xd8));var _0xe492=function(_0x119578,_0x18f037){_0x119578=_0x119578-0x0;var _0x225277=_0x492e[_0x119578];return _0x225277;};'use strict';function SugarcrmAccount(_0xfd4c11){this['id']=_0xfd4c11['id']||0x0;this[_0xe492('0x0')]=_0xfd4c11['name']||'';this[_0xe492('0x1')]=_0xfd4c11[_0xe492('0x1')]||'';this[_0xe492('0x2')]=_0xfd4c11[_0xe492('0x2')]||'';this['remoteUri']=_0xfd4c11[_0xe492('0x3')]||'';this[_0xe492('0x4')]=_0xfd4c11['serverUrl']||'';this[_0xe492('0x5')]=_0xfd4c11[_0xe492('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0xeb28=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0xfb5b41,_0x5cbf71){var _0x53b1d1=function(_0xa5f9ad){while(--_0xa5f9ad){_0xfb5b41['push'](_0xfb5b41['shift']());}};_0x53b1d1(++_0x5cbf71);}(_0xeb28,0x1d0));var _0x8eb2=function(_0x536d8d,_0x138a94){_0x536d8d=_0x536d8d-0x0;var _0x5759b9=_0xeb28[_0x536d8d];return _0x5759b9;};'use strict';function SugarcrmAccount(_0x2458de){this['id']=_0x2458de['id']||0x0;this['name']=_0x2458de[_0x8eb2('0x0')]||'';this[_0x8eb2('0x1')]=_0x2458de['username']||'';this[_0x8eb2('0x2')]=_0x2458de[_0x8eb2('0x2')]||'';this[_0x8eb2('0x3')]=_0x2458de[_0x8eb2('0x3')]||'';this[_0x8eb2('0x4')]=_0x2458de['serverUrl']||'';this[_0x8eb2('0x5')]=_0x2458de[_0x8eb2('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 91d1b49..9994dae 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 _0xefe2=['exports','name','accountcode','unknown','status','address'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xefe2,0xd9));var _0x2efe=function(_0x66061e,_0x59d380){_0x66061e=_0x66061e-0x0;var _0xb1c9ce=_0xefe2[_0x66061e];return _0xb1c9ce;};'use strict';function Telephone(_0x2143f9){this['id']=_0x2143f9['id']||0x0;this[_0x2efe('0x0')]=_0x2143f9['name']||'';this[_0x2efe('0x1')]=_0x2143f9[_0x2efe('0x1')]||'';this['state']=_0x2efe('0x2');this['stateTime']=0x0;this[_0x2efe('0x3')]=_0x2efe('0x2');this[_0x2efe('0x4')]='';}module[_0x2efe('0x5')]=Telephone; \ No newline at end of file +var _0x4dcb=['stateTime','status','exports','name','accountcode','state','unknown'];(function(_0x5338f3,_0x48d4ec){var _0x398403=function(_0x408b04){while(--_0x408b04){_0x5338f3['push'](_0x5338f3['shift']());}};_0x398403(++_0x48d4ec);}(_0x4dcb,0x153));var _0xb4dc=function(_0x425a5d,_0x4be979){_0x425a5d=_0x425a5d-0x0;var _0x4efc35=_0x4dcb[_0x425a5d];return _0x4efc35;};'use strict';function Telephone(_0x3de6e1){this['id']=_0x3de6e1['id']||0x0;this[_0xb4dc('0x0')]=_0x3de6e1['name']||'';this['accountcode']=_0x3de6e1[_0xb4dc('0x1')]||'';this[_0xb4dc('0x2')]=_0xb4dc('0x3');this[_0xb4dc('0x4')]=0x0;this[_0xb4dc('0x5')]='unknown';this['address']='';}module[_0xb4dc('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 343e408..02a0c53 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(_0x487638,_0x465fbf){var _0x46cd86=function(_0x8874f7){while(--_0x8874f7){_0x487638['push'](_0x487638['shift']());}};_0x46cd86(++_0x465fbf);}(_0xb10b,0x12a));var _0xbb10=function(_0x500d35,_0x3f5d69){_0x500d35=_0x500d35-0x0;var _0x383af4=_0xb10b[_0x500d35];return _0x383af4;};'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(_0x48efb6,_0x18c731){var _0x4d6ceb=function(_0x1477b7){while(--_0x1477b7){_0x48efb6['push'](_0x48efb6['shift']());}};_0x4d6ceb(++_0x18c731);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 a907c12..72242aa 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x3fb030,_0x12aebe){var _0xd6899b=function(_0x327646){while(--_0x327646){_0x3fb030['push'](_0x3fb030['shift']());}};_0xd6899b(++_0x12aebe);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file +var _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x4e7beb,_0x46d190){var _0x5ac57b=function(_0x2ad18a){while(--_0x2ad18a){_0x4e7beb['push'](_0x4e7beb['shift']());}};_0x5ac57b(++_0x46d190);}(_0xda2d,0x102));var _0xdda2=function(_0x46e6f3,_0x28dc76){_0x46e6f3=_0x46e6f3-0x0;var _0x1aa2aa=_0xda2d[_0x46e6f3];return _0x1aa2aa;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 2f9106e..c5f9604 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 _0xb8e0=['unknown','stateTime','status','registry','indexOf','split','port','domain','refresh','stateRegistry','address','active','name','state'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xb8e0,0x14d));var _0x0b8e=function(_0x870b62,_0x2143f9){_0x870b62=_0x870b62-0x0;var _0x2dcb39=_0xb8e0[_0x870b62];return _0x2dcb39;};'use strict';function Trunk(_0x31a62c){this['id']=_0x31a62c['id']||0x0;this['active']=_0x31a62c[_0x0b8e('0x0')]||![];this[_0x0b8e('0x1')]=_0x31a62c['name']||'';this[_0x0b8e('0x2')]=_0x0b8e('0x3');this[_0x0b8e('0x4')]=0x0;this[_0x0b8e('0x5')]=_0x0b8e('0x3');this['registry']=_0x31a62c[_0x0b8e('0x6')]&&_0x31a62c[_0x0b8e('0x6')][_0x0b8e('0x7')](':')?_0x31a62c[_0x0b8e('0x6')][_0x0b8e('0x8')](':')[0x0]:'';this['host']='';this[_0x0b8e('0x9')]='';this[_0x0b8e('0xa')]='';this['domainport']='';this[_0x0b8e('0xb')]='';this[_0x0b8e('0xc')]=_0x0b8e('0x3');this['registrationtime']='';this[_0x0b8e('0xd')]='';this['defaultuser']=_0x31a62c['defaultuser']||'';}module['exports']=Trunk; \ No newline at end of file +var _0xf7e6=['unknown','address','defaultuser','exports','active','name','state','registry','indexOf','split','host','port','domain','domainport','stateRegistry'];(function(_0x1739a1,_0x1b4131){var _0x250e30=function(_0x336376){while(--_0x336376){_0x1739a1['push'](_0x1739a1['shift']());}};_0x250e30(++_0x1b4131);}(_0xf7e6,0x199));var _0x6f7e=function(_0x2fad4d,_0x12b97b){_0x2fad4d=_0x2fad4d-0x0;var _0x299866=_0xf7e6[_0x2fad4d];return _0x299866;};'use strict';function Trunk(_0xc20b55){this['id']=_0xc20b55['id']||0x0;this['active']=_0xc20b55[_0x6f7e('0x0')]||![];this[_0x6f7e('0x1')]=_0xc20b55[_0x6f7e('0x1')]||'';this[_0x6f7e('0x2')]='unknown';this['stateTime']=0x0;this['status']='unknown';this[_0x6f7e('0x3')]=_0xc20b55[_0x6f7e('0x3')]&&_0xc20b55[_0x6f7e('0x3')][_0x6f7e('0x4')](':')?_0xc20b55[_0x6f7e('0x3')][_0x6f7e('0x5')](':')[0x0]:'';this[_0x6f7e('0x6')]='';this[_0x6f7e('0x7')]='';this[_0x6f7e('0x8')]='';this[_0x6f7e('0x9')]='';this['refresh']='';this[_0x6f7e('0xa')]=_0x6f7e('0xb');this['registrationtime']='';this[_0x6f7e('0xc')]='';this['defaultuser']=_0xc20b55[_0x6f7e('0xd')]||'';}module[_0x6f7e('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 8050d0e..03d5fd4 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 _0xd1dd=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd1dd,0x1a2));var _0xdd1d=function(_0x471ee2,_0x390837){_0x471ee2=_0x471ee2-0x0;var _0x507eb0=_0xd1dd[_0x471ee2];return _0x507eb0;};'use strict';function voiceExtension(_0x49c1bc){this['id']=_0x49c1bc['id']||0x0;this[_0xdd1d('0x0')]=_0x49c1bc[_0xdd1d('0x0')]||'';this[_0xdd1d('0x1')]=_0x49c1bc[_0xdd1d('0x1')]||_0xdd1d('0x2');this[_0xdd1d('0x3')]=_0x49c1bc['mandatoryDisposition']||![];}module[_0xdd1d('0x4')]=voiceExtension; \ No newline at end of file +var _0x09e0=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x43db75,_0x14f303){var _0xee31b=function(_0x10ea79){while(--_0x10ea79){_0x43db75['push'](_0x43db75['shift']());}};_0xee31b(++_0x14f303);}(_0x09e0,0x1b9));var _0x009e=function(_0x290232,_0x1e8ebd){_0x290232=_0x290232-0x0;var _0x3b2a32=_0x09e0[_0x290232];return _0x3b2a32;};'use strict';function voiceExtension(_0x474ce3){this['id']=_0x474ce3['id']||0x0;this['exten']=_0x474ce3[_0x009e('0x0')]||'';this['recordingFormat']=_0x474ce3[_0x009e('0x1')]||_0x009e('0x2');this[_0x009e('0x3')]=_0x474ce3[_0x009e('0x3')]||![];}module[_0x009e('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 d239f11..d4f9246 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 _0x29c8=['autopause','sendMessageOneNotActive','statusMessage','originated','temp','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','gsm','fewestcalls','leastrecent','linear','ringall','roundrobin','rrordered','name','monitor_format','type','waiting','total','answered','sumHoldTime','sumBillable','unmanaged','inUse','loggedIn','onHold','paused','ringInUse','unavailable','unknown','acw','acwTimeout'];(function(_0x39f934,_0x464cae){var _0x2e934b=function(_0x1d8a10){while(--_0x1d8a10){_0x39f934['push'](_0x39f934['shift']());}};_0x2e934b(++_0x464cae);}(_0x29c8,0x163));var _0x829c=function(_0x52a07b,_0x19c8c8){_0x52a07b=_0x52a07b-0x0;var _0x28045d=_0x29c8[_0x52a07b];return _0x28045d;};'use strict';var monitorFormat={'wav':'wav','wav49':_0x829c('0x0'),'gsm':_0x829c('0x1')};var strategy={'fewestcalls':_0x829c('0x2'),'leastrecent':_0x829c('0x3'),'linear':_0x829c('0x4'),'random':'random','ringall':_0x829c('0x5'),'rr':_0x829c('0x6'),'rrmemory':'rrmemory','rrordered':_0x829c('0x7'),'wrandom':'wrandom'};function VoiceQueue(_0x1e93d6){this['id']=_0x1e93d6['id']||0x0;this[_0x829c('0x8')]=_0x1e93d6[_0x829c('0x8')]||'';this[_0x829c('0x9')]=_0x1e93d6[_0x829c('0x9')]||'';this['type']=_0x1e93d6[_0x829c('0xa')]||'inbound';this[_0x829c('0xb')]=0x0;this[_0x829c('0xc')]=0x0;this[_0x829c('0xd')]=0x0;this['sumDuration']=0x0;this[_0x829c('0xe')]=0x0;this[_0x829c('0xf')]=0x0;this[_0x829c('0x10')]=0x0;this['abandoned']=0x0;this['available']=0x0;this['busy']=0x0;this[_0x829c('0x11')]=0x0;this['invalid']=0x0;this[_0x829c('0x12')]=0x0;this['notInUse']=0x0;this[_0x829c('0x13')]=0x0;this[_0x829c('0x14')]=0x0;this['ringing']=0x0;this[_0x829c('0x15')]=0x0;this['talking']=0x0;this[_0x829c('0x16')]=0x0;this[_0x829c('0x17')]=0x0;this[_0x829c('0x18')]=_0x1e93d6[_0x829c('0x18')]||![];this[_0x829c('0x19')]=_0x1e93d6[_0x829c('0x19')]||0xa;this[_0x829c('0x1a')]=_0x1e93d6[_0x829c('0x1a')]||'no';this[_0x829c('0x1b')]=!![];this['message']='';this[_0x829c('0x1c')]='';this[_0x829c('0x1d')]=0x0;this[_0x829c('0x1e')]=0x0;this['dialTimezone']=_0x1e93d6['dialTimezone']||null;this[_0x829c('0x1f')]=_0x1e93d6[_0x829c('0x1f')]?_0x1e93d6[_0x829c('0x1f')]:null;this[_0x829c('0x20')]=_0x1e93d6[_0x829c('0x20')];this['dialMethod']=_0x1e93d6[_0x829c('0x21')]||_0x829c('0x22');this[_0x829c('0x23')]=_0x1e93d6[_0x829c('0x23')]||0x0;this['dialLimitQueue']=_0x1e93d6[_0x829c('0x24')]||0x0;this[_0x829c('0x25')]=_0x1e93d6[_0x829c('0x25')]||0x1;this[_0x829c('0x26')]=_0x1e93d6[_0x829c('0x26')]||_0x829c('0x27');this[_0x829c('0x28')]=_0x1e93d6[_0x829c('0x28')]||0.03;this[_0x829c('0x29')]=_0x1e93d6[_0x829c('0x29')]||0x258;this[_0x829c('0x2a')]=_0x1e93d6[_0x829c('0x2a')]||_0x829c('0x2b');this[_0x829c('0x2c')]=_0x1e93d6['dialOriginateCallerIdNumber']||_0x829c('0x2b');this[_0x829c('0x2d')]=_0x1e93d6['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x1e93d6[_0x829c('0x2e')]||_0x829c('0x2f');this[_0x829c('0x30')]=_0x1e93d6[_0x829c('0x30')]||0x3;this['dialQueueProject']=_0x1e93d6[_0x829c('0x31')]||undefined;this[_0x829c('0x32')]=_0x1e93d6['dialCongestionMaxRetry']||0x3;this[_0x829c('0x33')]=_0x1e93d6[_0x829c('0x33')]||0x96;this[_0x829c('0x34')]=_0x1e93d6[_0x829c('0x34')]||0x3;this[_0x829c('0x35')]=_0x1e93d6[_0x829c('0x35')]||0x96;this[_0x829c('0x36')]=_0x1e93d6[_0x829c('0x36')]||0x3;this[_0x829c('0x37')]=_0x1e93d6['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x1e93d6[_0x829c('0x38')]||0x3;this[_0x829c('0x39')]=_0x1e93d6[_0x829c('0x39')]||0x96;this['dialDropMaxRetry']=_0x1e93d6[_0x829c('0x3a')]||0x3;this[_0x829c('0x3b')]=_0x1e93d6[_0x829c('0x3b')]||0x96;this[_0x829c('0x3c')]=_0x1e93d6[_0x829c('0x3c')]||0x3;this[_0x829c('0x3d')]=_0x1e93d6['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x1e93d6['dialMachineMaxRetry']||0x3;this[_0x829c('0x3e')]=_0x1e93d6['dialMachineRetryFrequency']||0x96;this[_0x829c('0x3f')]=_0x1e93d6['dialAgentRejectMaxRetry']||0x3;this[_0x829c('0x40')]=_0x1e93d6['dialAgentRejectRetryFrequency']||0x96;this[_0x829c('0x41')]=_0x1e93d6[_0x829c('0x41')]||0x3;this['dialGlobalMaxRetry']=_0x1e93d6[_0x829c('0x42')]||0x4;this[_0x829c('0x43')]=_0x1e93d6[_0x829c('0x43')]?_0x1e93d6['Trunk']:undefined;this['TrunkBackup']=_0x1e93d6[_0x829c('0x44')]?_0x1e93d6[_0x829c('0x44')]:undefined;this[_0x829c('0x45')]=_0x1e93d6[_0x829c('0x45')]||undefined;this['Interval']=_0x1e93d6[_0x829c('0x46')]?_0x1e93d6[_0x829c('0x46')]:undefined;this['dialOrderByScheduledAt']=_0x1e93d6['dialOrderByScheduledAt']||_0x829c('0x47');this[_0x829c('0x48')]=_0x1e93d6[_0x829c('0x48')]||undefined;this[_0x829c('0x49')]=_0x1e93d6[_0x829c('0x49')]||undefined;this[_0x829c('0x4a')]=strategy[_0x1e93d6[_0x829c('0x4a')]];this['queueStatusComplete']=!![];this['dialAMDActive']=_0x1e93d6[_0x829c('0x4b')]||![];this[_0x829c('0x4c')]=_0x1e93d6['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x1e93d6[_0x829c('0x4d')];this[_0x829c('0x4e')]=_0x1e93d6[_0x829c('0x4e')];this[_0x829c('0x4f')]=_0x1e93d6['dialAMDTotalAnalysisTime'];this[_0x829c('0x50')]=_0x1e93d6[_0x829c('0x50')];this[_0x829c('0x51')]=_0x1e93d6[_0x829c('0x51')];this[_0x829c('0x52')]=_0x1e93d6[_0x829c('0x52')];this['dialAMDSilenceThreshold']=_0x1e93d6[_0x829c('0x53')];this[_0x829c('0x54')]=_0x1e93d6[_0x829c('0x54')];this[_0x829c('0x55')]=0x0;this[_0x829c('0x56')]=0x0;this[_0x829c('0x57')]=_0x1e93d6[_0x829c('0x57')];this[_0x829c('0x58')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x829c('0x59')]=0x0;this[_0x829c('0x5a')]=0x0;this[_0x829c('0x5b')]=0x0;this[_0x829c('0x5c')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x829c('0x5d')]=0x0;this[_0x829c('0x5e')]=0x0;this[_0x829c('0x5f')]=0x0;this[_0x829c('0x60')]=0x0;this['outboundReCallsDay']=0x0;this[_0x829c('0x61')]=0x0;this[_0x829c('0x62')]=undefined;this[_0x829c('0x63')]=undefined;this[_0x829c('0x64')]=undefined;this[_0x829c('0x65')]=1.05;this[_0x829c('0x66')]=0x0;this[_0x829c('0x67')]=0x0;this[_0x829c('0x68')]=0x0;this[_0x829c('0x69')]=0x0;this[_0x829c('0x6a')]=0x0;this[_0x829c('0x6b')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x829c('0x6c')]=0x0;this['predictiveIntervalMaxThreshold']=_0x1e93d6[_0x829c('0x6d')]||0x14;this[_0x829c('0x6e')]=_0x1e93d6[_0x829c('0x6d')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x829c('0x6f')]=0x1;this[_0x829c('0x70')]=0x0;this[_0x829c('0x71')]=0x0;this[_0x829c('0x72')]=0x0;this[_0x829c('0x73')]=0x0;this[_0x829c('0x74')]=_0x1e93d6['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x1e93d6[_0x829c('0x75')]||![];this[_0x829c('0x76')]=!!_0x1e93d6[_0x829c('0x76')]||![];this[_0x829c('0x77')]=!!_0x1e93d6['dialPreviewRecallmeReminder']||![];this[_0x829c('0x78')]=_0x1e93d6[_0x829c('0x78')]||undefined;this[_0x829c('0x79')]=_0x1e93d6[_0x829c('0x79')]||![];this[_0x829c('0x7a')]=_0x1e93d6[_0x829c('0x7a')]||![];this[_0x829c('0x9')]=monitorFormat[_0x1e93d6[_0x829c('0x9')]]?monitorFormat[_0x1e93d6[_0x829c('0x9')]]:undefined;this[_0x829c('0x7b')]=_0x1e93d6[_0x829c('0x7b')]||![];this[_0x829c('0x7c')]=_0x1e93d6['mandatoryDispositionPause']?_0x1e93d6['mandatoryDispositionPause']:undefined;this[_0x829c('0x7d')]=![];}module[_0x829c('0x7e')]=VoiceQueue; \ No newline at end of file +var _0x310c=['erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','wav','wav49','fewestcalls','leastrecent','linear','random','ringall','rrmemory','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','onHold','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond'];(function(_0xe50549,_0x375e5b){var _0x40a5a8=function(_0x13cb88){while(--_0x13cb88){_0xe50549['push'](_0xe50549['shift']());}};_0x40a5a8(++_0x375e5b);}(_0x310c,0x191));var _0xc310=function(_0x1c6b6f,_0x46e32c){_0x1c6b6f=_0x1c6b6f-0x0;var _0x1e5e8f=_0x310c[_0x1c6b6f];return _0x1e5e8f;};'use strict';var monitorFormat={'wav':_0xc310('0x0'),'wav49':_0xc310('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0xc310('0x2'),'leastrecent':_0xc310('0x3'),'linear':_0xc310('0x4'),'random':_0xc310('0x5'),'ringall':_0xc310('0x6'),'rr':'roundrobin','rrmemory':_0xc310('0x7'),'rrordered':'rrordered','wrandom':_0xc310('0x8')};function VoiceQueue(_0x432885){this['id']=_0x432885['id']||0x0;this[_0xc310('0x9')]=_0x432885[_0xc310('0x9')]||'';this[_0xc310('0xa')]=_0x432885['monitor_format']||'';this[_0xc310('0xb')]=_0x432885[_0xc310('0xb')]||_0xc310('0xc');this[_0xc310('0xd')]=0x0;this[_0xc310('0xe')]=0x0;this[_0xc310('0xf')]=0x0;this['sumDuration']=0x0;this[_0xc310('0x10')]=0x0;this[_0xc310('0x11')]=0x0;this[_0xc310('0x12')]=0x0;this[_0xc310('0x13')]=0x0;this[_0xc310('0x14')]=0x0;this[_0xc310('0x15')]=0x0;this[_0xc310('0x16')]=0x0;this[_0xc310('0x17')]=0x0;this['loggedIn']=0x0;this['notInUse']=0x0;this[_0xc310('0x18')]=0x0;this['paused']=0x0;this[_0xc310('0x19')]=0x0;this[_0xc310('0x1a')]=0x0;this[_0xc310('0x1b')]=0x0;this[_0xc310('0x1c')]=0x0;this[_0xc310('0x1d')]=0x0;this[_0xc310('0x1e')]=_0x432885[_0xc310('0x1e')]||![];this[_0xc310('0x1f')]=_0x432885['acwTimeout']||0xa;this[_0xc310('0x20')]=_0x432885[_0xc310('0x20')]||'no';this[_0xc310('0x21')]=!![];this[_0xc310('0x22')]='';this[_0xc310('0x23')]='';this[_0xc310('0x24')]=0x0;this[_0xc310('0x25')]=0x0;this[_0xc310('0x26')]=_0x432885['dialTimezone']||null;this[_0xc310('0x27')]=_0x432885[_0xc310('0x27')]?_0x432885['dialGlobalInterval']:null;this[_0xc310('0x28')]=_0x432885[_0xc310('0x28')];this['dialMethod']=_0x432885['dialMethod']||_0xc310('0x29');this[_0xc310('0x2a')]=_0x432885[_0xc310('0x2a')]||0x0;this[_0xc310('0x2b')]=_0x432885[_0xc310('0x2b')]||0x0;this[_0xc310('0x2c')]=_0x432885[_0xc310('0x2c')]||0x1;this[_0xc310('0x2d')]=_0x432885[_0xc310('0x2d')]||_0xc310('0x2e');this[_0xc310('0x2f')]=_0x432885[_0xc310('0x2f')]||0.03;this['dialPredictiveInterval']=_0x432885[_0xc310('0x30')]||0x258;this[_0xc310('0x31')]=_0x432885[_0xc310('0x31')]||_0xc310('0x32');this[_0xc310('0x33')]=_0x432885['dialOriginateCallerIdNumber']||_0xc310('0x32');this[_0xc310('0x34')]=_0x432885[_0xc310('0x34')]||0x1e;this[_0xc310('0x35')]=_0x432885[_0xc310('0x35')]||_0xc310('0x36');this['dialQueueTimeout']=_0x432885['dialQueueTimeout']||0x3;this[_0xc310('0x37')]=_0x432885[_0xc310('0x37')]||undefined;this[_0xc310('0x38')]=_0x432885[_0xc310('0x38')]||0x3;this[_0xc310('0x39')]=_0x432885[_0xc310('0x39')]||0x96;this['dialBusyMaxRetry']=_0x432885[_0xc310('0x3a')]||0x3;this['dialBusyRetryFrequency']=_0x432885['dialBusyRetryFrequency']||0x96;this[_0xc310('0x3b')]=_0x432885[_0xc310('0x3b')]||0x3;this[_0xc310('0x3c')]=_0x432885[_0xc310('0x3c')]||0x96;this[_0xc310('0x3d')]=_0x432885[_0xc310('0x3d')]||0x3;this[_0xc310('0x3e')]=_0x432885[_0xc310('0x3e')]||0x96;this[_0xc310('0x3f')]=_0x432885[_0xc310('0x3f')]||0x3;this[_0xc310('0x40')]=_0x432885[_0xc310('0x40')]||0x96;this[_0xc310('0x41')]=_0x432885[_0xc310('0x41')]||0x3;this[_0xc310('0x42')]=_0x432885[_0xc310('0x42')]||0x96;this[_0xc310('0x43')]=_0x432885[_0xc310('0x43')]||0x3;this[_0xc310('0x44')]=_0x432885['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x432885[_0xc310('0x45')]||0x3;this[_0xc310('0x46')]=_0x432885['dialAgentRejectRetryFrequency']||0x96;this[_0xc310('0x47')]=_0x432885[_0xc310('0x47')]||0x3;this['dialGlobalMaxRetry']=_0x432885['dialGlobalMaxRetry']||0x4;this[_0xc310('0x48')]=_0x432885['Trunk']?_0x432885[_0xc310('0x48')]:undefined;this[_0xc310('0x49')]=_0x432885[_0xc310('0x49')]?_0x432885[_0xc310('0x49')]:undefined;this['dialPrefix']=_0x432885[_0xc310('0x4a')]||undefined;this[_0xc310('0x4b')]=_0x432885[_0xc310('0x4b')]?_0x432885[_0xc310('0x4b')]:undefined;this['dialOrderByScheduledAt']=_0x432885[_0xc310('0x4c')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x432885['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xc310('0x4d')]=_0x432885[_0xc310('0x4d')]||undefined;this[_0xc310('0x4e')]=strategy[_0x432885['strategy']];this[_0xc310('0x4f')]=!![];this[_0xc310('0x50')]=_0x432885[_0xc310('0x50')]||![];this[_0xc310('0x51')]=_0x432885[_0xc310('0x51')];this[_0xc310('0x52')]=_0x432885['dialAMDGreeting'];this[_0xc310('0x53')]=_0x432885[_0xc310('0x53')];this[_0xc310('0x54')]=_0x432885[_0xc310('0x54')];this[_0xc310('0x55')]=_0x432885['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x432885[_0xc310('0x56')];this[_0xc310('0x57')]=_0x432885[_0xc310('0x57')];this[_0xc310('0x58')]=_0x432885[_0xc310('0x58')];this['dialAMDMaximumWordLength']=_0x432885[_0xc310('0x59')];this[_0xc310('0x5a')]=0x0;this[_0xc310('0x5b')]=0x0;this[_0xc310('0x5c')]=_0x432885[_0xc310('0x5c')];this[_0xc310('0x5d')]=0x0;this[_0xc310('0x5e')]=0x0;this[_0xc310('0x5f')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xc310('0x60')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xc310('0x61')]=0x0;this[_0xc310('0x62')]=0x0;this[_0xc310('0x63')]=0x0;this[_0xc310('0x64')]=0x0;this[_0xc310('0x65')]=0x0;this[_0xc310('0x66')]=0x0;this[_0xc310('0x67')]=0x0;this[_0xc310('0x68')]=undefined;this[_0xc310('0x69')]=undefined;this[_0xc310('0x6a')]=undefined;this[_0xc310('0x6b')]=1.05;this[_0xc310('0x6c')]=0x0;this[_0xc310('0x6d')]=0x0;this[_0xc310('0x6e')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xc310('0x6f')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xc310('0x70')]=0x0;this['predictiveIntervalMaxThreshold']=_0x432885[_0xc310('0x71')]||0x14;this[_0xc310('0x72')]=_0x432885[_0xc310('0x71')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xc310('0x73')]=0x0;this[_0xc310('0x74')]=0x1;this[_0xc310('0x75')]=0x0;this[_0xc310('0x76')]=0x0;this[_0xc310('0x77')]=0x0;this['erlangBusyFactor']=0x0;this[_0xc310('0x78')]=_0x432885['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x432885[_0xc310('0x79')]||![];this[_0xc310('0x7a')]=!!_0x432885['dialPreviewAutoRecallMe']||![];this[_0xc310('0x7b')]=!!_0x432885['dialPreviewRecallmeReminder']||![];this[_0xc310('0x7c')]=_0x432885[_0xc310('0x7c')]||undefined;this[_0xc310('0x7d')]=_0x432885[_0xc310('0x7d')]||![];this['dialAgiAfterHangupAgent']=_0x432885[_0xc310('0x7e')]||![];this[_0xc310('0xa')]=monitorFormat[_0x432885[_0xc310('0xa')]]?monitorFormat[_0x432885[_0xc310('0xa')]]:undefined;this[_0xc310('0x7f')]=_0x432885[_0xc310('0x7f')]||![];this[_0xc310('0x80')]=_0x432885[_0xc310('0x80')]?_0x432885['mandatoryDispositionPause']:undefined;this[_0xc310('0x81')]=![];}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index d40944b..4200d74 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81bd=['outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','loggedin','callers','length','SIP/','online','incall','includes','status','keys','queue','xcally-motion-preview','some','updateReportFromOutboundQueue','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit'];(function(_0x2f87cd,_0xcaf299){var _0x5d7eda=function(_0x37ffb0){while(--_0x37ffb0){_0x2f87cd['push'](_0x2f87cd['shift']());}};_0x5d7eda(++_0xcaf299);}(_0x81bd,0x7c));var _0xd81b=function(_0x392890,_0xb8d3dd){_0x392890=_0x392890-0x0;var _0x2b2e30=_0x81bd[_0x392890];return _0x2b2e30;};'use strict';var INBOUND_COUNTERS=[_0xd81b('0x0'),_0xd81b('0x1'),_0xd81b('0x2'),_0xd81b('0x3'),_0xd81b('0x4'),_0xd81b('0x5'),_0xd81b('0x6')];var OUTBOUND_COUNTERS=['available',_0xd81b('0x7'),_0xd81b('0x8'),_0xd81b('0x1'),'loggedInDb',_0xd81b('0x9'),_0xd81b('0xa'),_0xd81b('0xb'),'outboundBlacklistCallsDay','outboundBusyCallsDay',_0xd81b('0xc'),'outboundNoAnswerCallsDay',_0xd81b('0xd'),_0xd81b('0xe'),_0xd81b('0xf'),_0xd81b('0x10'),_0xd81b('0x3'),_0xd81b('0x11'),_0xd81b('0x5'),_0xd81b('0x12'),_0xd81b('0x13'),_0xd81b('0x14'),_0xd81b('0x6')];function VoiceQueueSummary(_0x3914f7){this['id']=_0x3914f7['id'];this[_0xd81b('0x15')]=_0x3914f7['name'];this[_0xd81b('0x16')]=_0x3914f7['strategy'];this[_0xd81b('0x17')]=_0x3914f7[_0xd81b('0x17')]||0x0;this['answered']=_0x3914f7[_0xd81b('0x7')]||0x0;this['available']=_0x3914f7[_0xd81b('0x0')]||0x0;this[_0xd81b('0x18')]=_0x3914f7[_0xd81b('0x18')]||0x0;this[_0xd81b('0x8')]=_0x3914f7[_0xd81b('0x8')]||0x0;this['invalid']=_0x3914f7[_0xd81b('0x19')]||0x0;this[_0xd81b('0x1')]=_0x3914f7['loggedIn']||0x0;this[_0xd81b('0x2')]=_0x3914f7[_0xd81b('0x2')]||0x0;this[_0xd81b('0x1a')]=_0x3914f7[_0xd81b('0x1a')]||0x0;this[_0xd81b('0x1b')]=_0x3914f7[_0xd81b('0x1b')]||0x0;this[_0xd81b('0x3')]=_0x3914f7[_0xd81b('0x3')]||0x0;this[_0xd81b('0x4')]=_0x3914f7[_0xd81b('0x4')]||0x0;this[_0xd81b('0x1c')]=_0x3914f7[_0xd81b('0x1c')];this[_0xd81b('0x12')]=_0x3914f7[_0xd81b('0x12')];this[_0xd81b('0x13')]=_0x3914f7[_0xd81b('0x13')];this['sumHoldTime']=_0x3914f7['sumHoldTime']||0x0;this[_0xd81b('0x5')]=_0x3914f7[_0xd81b('0x5')]||0x0;this[_0xd81b('0x14')]=_0x3914f7['total']||0x0;this[_0xd81b('0x1d')]=_0x3914f7[_0xd81b('0x1d')];this['unavailable']=_0x3914f7[_0xd81b('0x1e')]||0x0;this[_0xd81b('0x1f')]=_0x3914f7[_0xd81b('0x1f')]||0x0;this[_0xd81b('0x20')]=_0x3914f7[_0xd81b('0x20')]||0x0;this[_0xd81b('0x6')]=_0x3914f7[_0xd81b('0x6')]||0x0;if(_0x3914f7[_0xd81b('0x1d')]===_0xd81b('0x21')){this[_0xd81b('0x11')]=_0x3914f7[_0xd81b('0x11')]||0x0;this[_0xd81b('0x22')]=_0x3914f7['dialActive'];this[_0xd81b('0x23')]=_0x3914f7[_0xd81b('0x23')];this[_0xd81b('0x24')]=_0x3914f7[_0xd81b('0x24')];this[_0xd81b('0x25')]=_0x3914f7[_0xd81b('0x25')];this[_0xd81b('0x26')]=_0x3914f7[_0xd81b('0x26')];this[_0xd81b('0x27')]=_0x3914f7['dialPrefix'];this[_0xd81b('0x28')]=_0x3914f7['temp'];this['outboundAnswerAgiCallsDay']=_0x3914f7[_0xd81b('0x29')];this[_0xd81b('0xb')]=_0x3914f7['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x3914f7[_0xd81b('0x2a')];this[_0xd81b('0x2b')]=_0x3914f7[_0xd81b('0x2b')];this[_0xd81b('0xc')]=_0x3914f7[_0xd81b('0xc')];this[_0xd81b('0x2c')]=_0x3914f7['outboundDropCallsDayACS'];this[_0xd81b('0x2d')]=_0x3914f7[_0xd81b('0x2d')];this['outboundDropCallsDayTimeout']=_0x3914f7['outboundDropCallsDayTimeout'];this[_0xd81b('0x2e')]=_0x3914f7[_0xd81b('0x2e')];this['outboundNoSuchCallsDay']=_0x3914f7['outboundNoSuchCallsDay'];this['outboundOriginateFailureCallsDay']=_0x3914f7[_0xd81b('0x2f')];this[_0xd81b('0xe')]=_0x3914f7[_0xd81b('0xe')];this[_0xd81b('0xf')]=_0x3914f7[_0xd81b('0xf')];this[_0xd81b('0x10')]=_0x3914f7[_0xd81b('0x10')];this['predictiveIntervalAnsweredCalls']=_0x3914f7[_0xd81b('0x30')];this['predictiveIntervalAvgHoldtime']=_0x3914f7[_0xd81b('0x31')];this[_0xd81b('0x32')]=_0x3914f7[_0xd81b('0x32')];this[_0xd81b('0x33')]=_0x3914f7[_0xd81b('0x33')];this[_0xd81b('0x34')]=_0x3914f7[_0xd81b('0x34')];this[_0xd81b('0x35')]=_0x3914f7[_0xd81b('0x35')];this[_0xd81b('0x36')]=_0x3914f7[_0xd81b('0x36')];this[_0xd81b('0x37')]=_0x3914f7[_0xd81b('0x37')];this['predictiveIntervalMultiplicativeFactor']=_0x3914f7['predictiveIntervalMultiplicativeFactor'];this[_0xd81b('0x38')]=_0x3914f7[_0xd81b('0x38')];this[_0xd81b('0x39')]=_0x3914f7['predictiveIntervalAvailable'];this[_0xd81b('0x3a')]=_0x3914f7[_0xd81b('0x3a')];this['originated']=_0x3914f7[_0xd81b('0x9')];this[_0xd81b('0x3b')]=_0x3914f7['erlangCalls'];this[_0xd81b('0x3c')]=_0x3914f7['erlangCallToSecond'];this[_0xd81b('0x3d')]=_0x3914f7[_0xd81b('0x3d')];this[_0xd81b('0x3e')]=_0x3914f7[_0xd81b('0x3e')];this['startPredictive']=_0x3914f7[_0xd81b('0x3f')];this[_0xd81b('0x40')]=_0x3914f7[_0xd81b('0x40')];this[_0xd81b('0x41')]=_0x3914f7[_0xd81b('0x41')];this[_0xd81b('0x42')]=_0x3914f7[_0xd81b('0x42')];}if(_0x3914f7['Trunk']){this[_0xd81b('0x43')]={'id':_0x3914f7[_0xd81b('0x43')]['id'],'name':_0x3914f7[_0xd81b('0x43')]['name'],'active':_0x3914f7[_0xd81b('0x43')][_0xd81b('0x44')],'callerid':_0x3914f7[_0xd81b('0x43')][_0xd81b('0x45')]};}}VoiceQueueSummary[_0xd81b('0x46')]['createReport']=function(_0x3dfba7,_0x11d617,_0x448e24,_0x43ea38){this[_0xd81b('0x2')]=0x0;this[_0xd81b('0x5')]=0x0;this[_0xd81b('0x3')]=0x0;this[_0xd81b('0x1f')]=0x0;this[_0xd81b('0x1b')]=0x0;this[_0xd81b('0x8')]=0x0;this[_0xd81b('0x18')]=0x0;this['invalid']=0x0;this[_0xd81b('0x1e')]=0x0;this[_0xd81b('0x4')]=0x0;this[_0xd81b('0x1c')]=0x0;this[_0xd81b('0x1a')]=0x0;if(_0x448e24){if(_0x448e24[_0xd81b('0x0')]){this[_0xd81b('0x0')]=Number(_0x448e24[_0xd81b('0x0')]);}if(_0x448e24[_0xd81b('0x47')]){this['loggedIn']=Number(_0x448e24['loggedin']);}if(_0x448e24[_0xd81b('0x48')]){this[_0xd81b('0x6')]=Number(_0x448e24[_0xd81b('0x48')]);}}for(var _0x222c5e=0x0;_0x222c5e<_0x3dfba7[_0xd81b('0x49')];_0x222c5e++){var _0x37031b=_0x11d617[_0xd81b('0x4a')+_0x3dfba7[_0x222c5e][_0xd81b('0x15')]];if(_0x37031b&&_0x37031b[_0xd81b('0x4b')]){this[_0xd81b('0x2')]+=0x1;}if(_0x3dfba7[_0x222c5e][_0xd81b('0x4c')]==='1'){this[_0xd81b('0x5')]+=0x1;}if(_0x3dfba7[_0x222c5e]['paused']==='1'&&!['2','7','8'][_0xd81b('0x4d')](_0x3dfba7[_0x222c5e][_0xd81b('0x4e')])){this[_0xd81b('0x3')]+=0x1;}switch(_0x3dfba7[_0x222c5e][_0xd81b('0x4e')]){case'0':this[_0xd81b('0x1f')]+=0x1;break;case'1':this[_0xd81b('0x1b')]+=0x1;break;case'2':this[_0xd81b('0x8')]+=0x1;break;case'3':this[_0xd81b('0x18')]+=0x1;break;case'4':this[_0xd81b('0x19')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0xd81b('0x4')]+=0x1;break;case'7':this[_0xd81b('0x1c')]+=0x1;break;case'8':this[_0xd81b('0x1a')]+=0x1;break;}}if(this[_0xd81b('0x23')]==='booked'){var _0x43e8fe=Object[_0xd81b('0x4f')](_0x43ea38);for(var _0x15030b=0x0;_0x15030b<_0x43e8fe[_0xd81b('0x49')];_0x15030b++){var _0x2699e6=_0x43e8fe[_0x15030b];var _0x434ae5=_0x43ea38[_0x2699e6];if(_0x434ae5[_0xd81b('0x50')]===this[_0xd81b('0x15')]&&_0x434ae5[_0xd81b('0x1d')]==='dialer'&&_0x434ae5['exten']===_0xd81b('0x51')){this[_0xd81b('0x5')]+=0x1;}}if(this[_0xd81b('0x5')]>this[_0xd81b('0x8')]){this[_0xd81b('0x5')]=this[_0xd81b('0x8')];}this[_0xd81b('0x11')]=0x0;}return this;};VoiceQueueSummary[_0xd81b('0x46')]['compareToInboundQueue']=function(_0x2db83b){var _0x34706d=![];if(_0x2db83b){_0x34706d=INBOUND_COUNTERS[_0xd81b('0x52')](function(_0x3d171a){return this[_0x3d171a]!==_0x2db83b[_0x3d171a];},this);}return _0x34706d;};VoiceQueueSummary[_0xd81b('0x46')]['compareToOutboundQueue']=function(_0x647c56){var _0x44e03b=![];var _0x50d940=![];var _0x1f13c3=![];if(_0x647c56){_0x44e03b=this[_0xd81b('0x23')]!==_0x647c56[_0xd81b('0x23')]||this[_0xd81b('0x22')]!==_0x647c56[_0xd81b('0x22')]||this[_0xd81b('0x41')]!==_0x647c56[_0xd81b('0x41')]||this[_0xd81b('0x42')]!==_0x647c56[_0xd81b('0x42')];_0x50d940=OUTBOUND_COUNTERS[_0xd81b('0x52')](function(_0x2fa737){return this[_0x2fa737]!==_0x647c56[_0x2fa737];},this);if(this['Trunk']&&_0x647c56[_0xd81b('0x43')]){_0x1f13c3=this['Trunk'][_0xd81b('0x15')]!==_0x647c56[_0xd81b('0x43')][_0xd81b('0x15')]||this[_0xd81b('0x43')][_0xd81b('0x44')]!==_0x647c56[_0xd81b('0x43')]['active'];}}return _0x44e03b||_0x50d940||_0x1f13c3;};VoiceQueueSummary[_0xd81b('0x46')][_0xd81b('0x53')]=function(_0x51f5a1){this['answered']=_0x51f5a1[_0xd81b('0x7')];this['message']=_0x51f5a1[_0xd81b('0x41')];this['statusMessage']=_0x51f5a1[_0xd81b('0x42')];this[_0xd81b('0x9')]=_0x51f5a1[_0xd81b('0x9')];this['outboundAbandonedCallsDay']=_0x51f5a1[_0xd81b('0xa')];this[_0xd81b('0xb')]=_0x51f5a1['outboundAnswerCallsDay'];this[_0xd81b('0x2a')]=_0x51f5a1[_0xd81b('0x2a')];this['outboundBusyCallsDay']=_0x51f5a1[_0xd81b('0x2b')];this['outboundCongestionCallsDay']=_0x51f5a1[_0xd81b('0xc')];this[_0xd81b('0x2e')]=_0x51f5a1[_0xd81b('0x2e')];this[_0xd81b('0xd')]=_0x51f5a1[_0xd81b('0xd')];this[_0xd81b('0xe')]=_0x51f5a1[_0xd81b('0xe')];this[_0xd81b('0xf')]=_0x51f5a1[_0xd81b('0xf')];this[_0xd81b('0x10')]=_0x51f5a1['outboundUnknownCallsDay'];this[_0xd81b('0x12')]=_0x51f5a1[_0xd81b('0x12')];this[_0xd81b('0x13')]=_0x51f5a1[_0xd81b('0x13')];this[_0xd81b('0x14')]=_0x51f5a1[_0xd81b('0x14')];if(this[_0xd81b('0x23')]==='preview'){this['pTalking']=_0x51f5a1['pTalking'];}};module[_0xd81b('0x54')]=VoiceQueueSummary; \ No newline at end of file +var _0x972c=['unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','prototype','createReport','callers','length','SIP/','online','incall','includes','status','booked','keys','dialer','exten','some','compareToOutboundQueue','updateReportFromOutboundQueue','outboundNoSuchCallsDay','preview','exports','loggedInDb','paused','talking','waiting','inUse','loggedIn','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundRejectCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','answered','available','busy','invalid','onHold','notInUse','ringing','ringInUse','sumHoldTime','type'];(function(_0x48b78e,_0x10e2c5){var _0x545582=function(_0xd190c2){while(--_0xd190c2){_0x48b78e['push'](_0x48b78e['shift']());}};_0x545582(++_0x10e2c5);}(_0x972c,0xf2));var _0xc972=function(_0x4cbb5f,_0x26a8a5){_0x4cbb5f=_0x4cbb5f-0x0;var _0xe0290d=_0x972c[_0x4cbb5f];return _0xe0290d;};'use strict';var INBOUND_COUNTERS=['available','loggedIn',_0xc972('0x0'),_0xc972('0x1'),'ringing',_0xc972('0x2'),_0xc972('0x3')];var OUTBOUND_COUNTERS=['available','answered',_0xc972('0x4'),_0xc972('0x5'),_0xc972('0x0'),'originated',_0xc972('0x6'),'outboundAnswerCallsDay',_0xc972('0x7'),_0xc972('0x8'),_0xc972('0x9'),'outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay',_0xc972('0xa'),'outboundUnknownCallsDay',_0xc972('0x1'),_0xc972('0xb'),_0xc972('0x2'),_0xc972('0xc'),_0xc972('0xd'),_0xc972('0xe'),_0xc972('0x3')];function VoiceQueueSummary(_0x53d399){this['id']=_0x53d399['id'];this[_0xc972('0xf')]=_0x53d399[_0xc972('0xf')];this[_0xc972('0x10')]=_0x53d399['strategy'];this[_0xc972('0x11')]=_0x53d399[_0xc972('0x11')]||0x0;this[_0xc972('0x12')]=_0x53d399['answered']||0x0;this[_0xc972('0x13')]=_0x53d399[_0xc972('0x13')]||0x0;this[_0xc972('0x14')]=_0x53d399[_0xc972('0x14')]||0x0;this['inUse']=_0x53d399[_0xc972('0x4')]||0x0;this[_0xc972('0x15')]=_0x53d399[_0xc972('0x15')]||0x0;this[_0xc972('0x5')]=_0x53d399[_0xc972('0x5')]||0x0;this[_0xc972('0x0')]=_0x53d399[_0xc972('0x0')]||0x0;this[_0xc972('0x16')]=_0x53d399[_0xc972('0x16')]||0x0;this[_0xc972('0x17')]=_0x53d399[_0xc972('0x17')]||0x0;this[_0xc972('0x1')]=_0x53d399[_0xc972('0x1')]||0x0;this[_0xc972('0x18')]=_0x53d399[_0xc972('0x18')]||0x0;this[_0xc972('0x19')]=_0x53d399['ringInUse'];this[_0xc972('0xc')]=_0x53d399[_0xc972('0xc')];this[_0xc972('0xd')]=_0x53d399[_0xc972('0xd')];this[_0xc972('0x1a')]=_0x53d399['sumHoldTime']||0x0;this[_0xc972('0x2')]=_0x53d399[_0xc972('0x2')]||0x0;this['total']=_0x53d399[_0xc972('0xe')]||0x0;this[_0xc972('0x1b')]=_0x53d399[_0xc972('0x1b')];this[_0xc972('0x1c')]=_0x53d399[_0xc972('0x1c')]||0x0;this[_0xc972('0x1d')]=_0x53d399['unknown']||0x0;this[_0xc972('0x1e')]=_0x53d399['unmanaged']||0x0;this['waiting']=_0x53d399[_0xc972('0x3')]||0x0;if(_0x53d399[_0xc972('0x1b')]===_0xc972('0x1f')){this['pTalking']=_0x53d399[_0xc972('0xb')]||0x0;this[_0xc972('0x20')]=_0x53d399[_0xc972('0x20')];this[_0xc972('0x21')]=_0x53d399[_0xc972('0x21')];this[_0xc972('0x22')]=_0x53d399[_0xc972('0x22')];this[_0xc972('0x23')]=_0x53d399[_0xc972('0x23')];this[_0xc972('0x24')]=_0x53d399[_0xc972('0x24')];this[_0xc972('0x25')]=_0x53d399[_0xc972('0x25')];this[_0xc972('0x26')]=_0x53d399['temp'];this[_0xc972('0x27')]=_0x53d399['outboundAnswerAgiCallsDay'];this[_0xc972('0x28')]=_0x53d399['outboundAnswerCallsDay'];this[_0xc972('0x7')]=_0x53d399[_0xc972('0x7')];this[_0xc972('0x8')]=_0x53d399[_0xc972('0x8')];this[_0xc972('0x9')]=_0x53d399['outboundCongestionCallsDay'];this[_0xc972('0x29')]=_0x53d399[_0xc972('0x29')];this[_0xc972('0x2a')]=_0x53d399[_0xc972('0x2a')];this['outboundDropCallsDayTimeout']=_0x53d399[_0xc972('0x2b')];this[_0xc972('0x2c')]=_0x53d399['outboundNoAnswerCallsDay'];this['outboundNoSuchCallsDay']=_0x53d399['outboundNoSuchCallsDay'];this['outboundOriginateFailureCallsDay']=_0x53d399[_0xc972('0x2d')];this['outboundReCallsDay']=_0x53d399[_0xc972('0x2e')];this['outboundRejectCallsDay']=_0x53d399['outboundRejectCallsDay'];this[_0xc972('0x2f')]=_0x53d399[_0xc972('0x2f')];this[_0xc972('0x30')]=_0x53d399['predictiveIntervalAnsweredCalls'];this[_0xc972('0x31')]=_0x53d399['predictiveIntervalAvgHoldtime'];this[_0xc972('0x32')]=_0x53d399[_0xc972('0x32')];this['predictiveIntervalDroppedCallsCallersExit']=_0x53d399[_0xc972('0x33')];this[_0xc972('0x34')]=_0x53d399[_0xc972('0x34')];this[_0xc972('0x35')]=_0x53d399[_0xc972('0x35')];this[_0xc972('0x36')]=_0x53d399[_0xc972('0x36')];this[_0xc972('0x37')]=_0x53d399[_0xc972('0x37')];this[_0xc972('0x38')]=_0x53d399[_0xc972('0x38')];this[_0xc972('0x39')]=_0x53d399[_0xc972('0x39')];this[_0xc972('0x3a')]=_0x53d399[_0xc972('0x3a')];this[_0xc972('0x3b')]=_0x53d399[_0xc972('0x3b')];this[_0xc972('0x3c')]=_0x53d399[_0xc972('0x3c')];this[_0xc972('0x3d')]=_0x53d399[_0xc972('0x3d')];this['erlangCallToSecond']=_0x53d399[_0xc972('0x3e')];this[_0xc972('0x3f')]=_0x53d399['erlangAbandonmentRate'];this[_0xc972('0x40')]=_0x53d399[_0xc972('0x40')];this[_0xc972('0x41')]=_0x53d399[_0xc972('0x41')];this[_0xc972('0x42')]=_0x53d399[_0xc972('0x42')];this[_0xc972('0x43')]=_0x53d399[_0xc972('0x43')];this['statusMessage']=_0x53d399[_0xc972('0x44')];}if(_0x53d399[_0xc972('0x45')]){this['Trunk']={'id':_0x53d399[_0xc972('0x45')]['id'],'name':_0x53d399[_0xc972('0x45')][_0xc972('0xf')],'active':_0x53d399[_0xc972('0x45')][_0xc972('0x46')],'callerid':_0x53d399['Trunk']['callerid']};}}VoiceQueueSummary[_0xc972('0x47')][_0xc972('0x48')]=function(_0x483f11,_0x1b7332,_0x205658,_0x1ddc14){this[_0xc972('0x0')]=0x0;this[_0xc972('0x2')]=0x0;this['paused']=0x0;this[_0xc972('0x1d')]=0x0;this[_0xc972('0x17')]=0x0;this[_0xc972('0x4')]=0x0;this[_0xc972('0x14')]=0x0;this[_0xc972('0x15')]=0x0;this[_0xc972('0x1c')]=0x0;this[_0xc972('0x18')]=0x0;this[_0xc972('0x19')]=0x0;this[_0xc972('0x16')]=0x0;if(_0x205658){if(_0x205658['available']){this[_0xc972('0x13')]=Number(_0x205658[_0xc972('0x13')]);}if(_0x205658['loggedin']){this['loggedIn']=Number(_0x205658['loggedin']);}if(_0x205658['callers']){this[_0xc972('0x3')]=Number(_0x205658[_0xc972('0x49')]);}}for(var _0xcee4e9=0x0;_0xcee4e9<_0x483f11[_0xc972('0x4a')];_0xcee4e9++){var _0x2199bd=_0x1b7332[_0xc972('0x4b')+_0x483f11[_0xcee4e9][_0xc972('0xf')]];if(_0x2199bd&&_0x2199bd[_0xc972('0x4c')]){this['loggedInDb']+=0x1;}if(_0x483f11[_0xcee4e9][_0xc972('0x4d')]==='1'){this[_0xc972('0x2')]+=0x1;}if(_0x483f11[_0xcee4e9][_0xc972('0x1')]==='1'&&!['2','7','8'][_0xc972('0x4e')](_0x483f11[_0xcee4e9][_0xc972('0x4f')])){this[_0xc972('0x1')]+=0x1;}switch(_0x483f11[_0xcee4e9][_0xc972('0x4f')]){case'0':this['unknown']+=0x1;break;case'1':this[_0xc972('0x17')]+=0x1;break;case'2':this[_0xc972('0x4')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0xc972('0x1c')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0xc972('0x19')]+=0x1;break;case'8':this[_0xc972('0x16')]+=0x1;break;}}if(this[_0xc972('0x21')]===_0xc972('0x50')){var _0x19d3d3=Object[_0xc972('0x51')](_0x1ddc14);for(var _0x2e2afe=0x0;_0x2e2afe<_0x19d3d3['length'];_0x2e2afe++){var _0x35bd39=_0x19d3d3[_0x2e2afe];var _0x338c46=_0x1ddc14[_0x35bd39];if(_0x338c46['queue']===this[_0xc972('0xf')]&&_0x338c46[_0xc972('0x1b')]===_0xc972('0x52')&&_0x338c46[_0xc972('0x53')]==='xcally-motion-preview'){this['talking']+=0x1;}}if(this[_0xc972('0x2')]>this[_0xc972('0x4')]){this[_0xc972('0x2')]=this[_0xc972('0x4')];}this[_0xc972('0xb')]=0x0;}return this;};VoiceQueueSummary[_0xc972('0x47')]['compareToInboundQueue']=function(_0x15deeb){var _0x392183=![];if(_0x15deeb){_0x392183=INBOUND_COUNTERS[_0xc972('0x54')](function(_0x52f9fd){return this[_0x52f9fd]!==_0x15deeb[_0x52f9fd];},this);}return _0x392183;};VoiceQueueSummary[_0xc972('0x47')][_0xc972('0x55')]=function(_0x4ee7ec){var _0x53d1c2=![];var _0x1613ac=![];var _0x5ccedc=![];if(_0x4ee7ec){_0x53d1c2=this[_0xc972('0x21')]!==_0x4ee7ec[_0xc972('0x21')]||this[_0xc972('0x20')]!==_0x4ee7ec[_0xc972('0x20')]||this[_0xc972('0x43')]!==_0x4ee7ec[_0xc972('0x43')]||this['statusMessage']!==_0x4ee7ec[_0xc972('0x44')];_0x1613ac=OUTBOUND_COUNTERS['some'](function(_0x4f89fd){return this[_0x4f89fd]!==_0x4ee7ec[_0x4f89fd];},this);if(this['Trunk']&&_0x4ee7ec[_0xc972('0x45')]){_0x5ccedc=this['Trunk'][_0xc972('0xf')]!==_0x4ee7ec[_0xc972('0x45')][_0xc972('0xf')]||this[_0xc972('0x45')]['active']!==_0x4ee7ec[_0xc972('0x45')][_0xc972('0x46')];}}return _0x53d1c2||_0x1613ac||_0x5ccedc;};VoiceQueueSummary[_0xc972('0x47')][_0xc972('0x56')]=function(_0x5debca){this[_0xc972('0x12')]=_0x5debca[_0xc972('0x12')];this['message']=_0x5debca[_0xc972('0x43')];this[_0xc972('0x44')]=_0x5debca[_0xc972('0x44')];this['originated']=_0x5debca[_0xc972('0x3c')];this[_0xc972('0x6')]=_0x5debca[_0xc972('0x6')];this[_0xc972('0x28')]=_0x5debca['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x5debca[_0xc972('0x7')];this[_0xc972('0x8')]=_0x5debca[_0xc972('0x8')];this['outboundCongestionCallsDay']=_0x5debca[_0xc972('0x9')];this[_0xc972('0x2c')]=_0x5debca[_0xc972('0x2c')];this[_0xc972('0x57')]=_0x5debca[_0xc972('0x57')];this['outboundReCallsDay']=_0x5debca[_0xc972('0x2e')];this[_0xc972('0xa')]=_0x5debca[_0xc972('0xa')];this[_0xc972('0x2f')]=_0x5debca[_0xc972('0x2f')];this['sumBillable']=_0x5debca[_0xc972('0xc')];this[_0xc972('0xd')]=_0x5debca['sumDuration'];this[_0xc972('0xe')]=_0x5debca[_0xc972('0xe')];if(this[_0xc972('0x21')]===_0xc972('0x58')){this[_0xc972('0xb')]=_0x5debca[_0xc972('0xb')];}};module[_0xc972('0x59')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index e9ff2df..c26d42f 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 _0xe4e0=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x21a4fa,_0x4920a1){var _0x2af37b=function(_0xc183b4){while(--_0xc183b4){_0x21a4fa['push'](_0x21a4fa['shift']());}};_0x2af37b(++_0x4920a1);}(_0xe4e0,0x1a5));var _0x0e4e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xe4e0[_0x4154a6];return _0x3b2786;};'use strict';function VtigerAccount(_0x49b061){this['id']=_0x49b061['id']||0x0;this['name']=_0x49b061[_0x0e4e('0x0')]||'';this[_0x0e4e('0x1')]=_0x49b061[_0x0e4e('0x1')]||'';this[_0x0e4e('0x2')]=_0x49b061[_0x0e4e('0x2')]||'';this[_0x0e4e('0x3')]=_0x49b061[_0x0e4e('0x3')]||'';this['serverUrl']=_0x49b061[_0x0e4e('0x4')]||'';this['Configurations']=_0x49b061[_0x0e4e('0x5')]||{};}module[_0x0e4e('0x6')]=VtigerAccount; \ No newline at end of file +var _0xc9c0=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x6328f4,_0x86f234){var _0xf44b83=function(_0x362fde){while(--_0x362fde){_0x6328f4['push'](_0x6328f4['shift']());}};_0xf44b83(++_0x86f234);}(_0xc9c0,0x1dc));var _0x0c9c=function(_0x75e7a3,_0x416fb3){_0x75e7a3=_0x75e7a3-0x0;var _0x2b4eb7=_0xc9c0[_0x75e7a3];return _0x2b4eb7;};'use strict';function VtigerAccount(_0x2ee623){this['id']=_0x2ee623['id']||0x0;this[_0x0c9c('0x0')]=_0x2ee623['name']||'';this[_0x0c9c('0x1')]=_0x2ee623['username']||'';this[_0x0c9c('0x2')]=_0x2ee623[_0x0c9c('0x2')]||'';this['remoteUri']=_0x2ee623[_0x0c9c('0x3')]||'';this[_0x0c9c('0x4')]=_0x2ee623[_0x0c9c('0x4')]||'';this[_0x0c9c('0x5')]=_0x2ee623[_0x0c9c('0x5')]||{};}module[_0x0c9c('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 2a5cc29..e5a231c 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 _0x2f22=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f22,0x1ac));var _0x22f2=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x2f22[_0x8c43de];return _0xa6591b;};'use strict';function ZendeskAccount(_0x357033){this['id']=_0x357033['id']||0x0;this['name']=_0x357033[_0x22f2('0x0')]||'';this['username']=_0x357033[_0x22f2('0x1')]||'';this['password']=_0x357033[_0x22f2('0x2')]||'';this[_0x22f2('0x3')]=_0x357033['token']||'';this['remoteUri']=_0x357033[_0x22f2('0x4')]||'';this[_0x22f2('0x5')]=_0x357033['authType']||'';this[_0x22f2('0x6')]=_0x357033[_0x22f2('0x6')]||_0x22f2('0x7');this['serverUrl']=_0x357033[_0x22f2('0x8')]||'';this['Configurations']=_0x357033[_0x22f2('0x9')]||{};}module[_0x22f2('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x6e7b=['serverUrl','exports','name','username','password','token','remoteUri','authType','type'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x6e7b,0x1d6));var _0xb6e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e7b[_0x3dd15e];return _0x231fd0;};'use strict';function ZendeskAccount(_0x4e4ae4){this['id']=_0x4e4ae4['id']||0x0;this[_0xb6e7('0x0')]=_0x4e4ae4[_0xb6e7('0x0')]||'';this[_0xb6e7('0x1')]=_0x4e4ae4[_0xb6e7('0x1')]||'';this['password']=_0x4e4ae4[_0xb6e7('0x2')]||'';this[_0xb6e7('0x3')]=_0x4e4ae4['token']||'';this[_0xb6e7('0x4')]=_0x4e4ae4[_0xb6e7('0x4')]||'';this[_0xb6e7('0x5')]=_0x4e4ae4[_0xb6e7('0x5')]||'';this[_0xb6e7('0x6')]=_0x4e4ae4[_0xb6e7('0x6')]||'integrationTab';this[_0xb6e7('0x7')]=_0x4e4ae4['serverUrl']||'';this['Configurations']=_0x4e4ae4['Configurations']||{};}module[_0xb6e7('0x8')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 10e9a13..5d57f37 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 _0x037d=['name','description','host','zone','clientId','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x037d,0x14a));var _0xd037=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x037d[_0x2235bf];return _0x4c3a64;};'use strict';function ZohoAccount(_0x5d532a){this['id']=_0x5d532a['id']||0x0;this['name']=_0x5d532a[_0xd037('0x0')]||'';this['description']=_0x5d532a[_0xd037('0x1')]||'';this[_0xd037('0x2')]=_0x5d532a[_0xd037('0x2')]||'';this['zone']=_0x5d532a[_0xd037('0x3')]||'';this[_0xd037('0x4')]=_0x5d532a['clientId']||'';this['clientSecret']=_0x5d532a['clientSecret']||'';this[_0xd037('0x5')]=_0x5d532a[_0xd037('0x5')]||'';this[_0xd037('0x6')]=_0x5d532a[_0xd037('0x6')]||'';this[_0xd037('0x7')]=_0x5d532a[_0xd037('0x7')]||'';this['Configurations']=_0x5d532a[_0xd037('0x8')]||{};}module[_0xd037('0x9')]=ZohoAccount; \ No newline at end of file +var _0x3f87=['Configurations','exports','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x5e8d3e,_0x18ed2e){var _0x1348c0=function(_0x5a889f){while(--_0x5a889f){_0x5e8d3e['push'](_0x5e8d3e['shift']());}};_0x1348c0(++_0x18ed2e);}(_0x3f87,0xb6));var _0x73f8=function(_0x51aa1f,_0xf5f775){_0x51aa1f=_0x51aa1f-0x0;var _0x2d5d14=_0x3f87[_0x51aa1f];return _0x2d5d14;};'use strict';function ZohoAccount(_0x2fcacc){this['id']=_0x2fcacc['id']||0x0;this['name']=_0x2fcacc['name']||'';this[_0x73f8('0x0')]=_0x2fcacc[_0x73f8('0x0')]||'';this['host']=_0x2fcacc[_0x73f8('0x1')]||'';this[_0x73f8('0x2')]=_0x2fcacc[_0x73f8('0x2')]||'';this[_0x73f8('0x3')]=_0x2fcacc[_0x73f8('0x3')]||'';this[_0x73f8('0x4')]=_0x2fcacc[_0x73f8('0x4')]||'';this[_0x73f8('0x5')]=_0x2fcacc['serverUrl']||'';this[_0x73f8('0x6')]=_0x2fcacc[_0x73f8('0x6')]||'';this['refreshToken']=_0x2fcacc[_0x73f8('0x7')]||'';this['Configurations']=_0x2fcacc[_0x73f8('0x8')]||{};}module[_0x73f8('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 f2ae0a1..f651aee 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 _0x3d04=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','idContact','queue','name','type','dialAnswer','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry'];(function(_0x2bd415,_0x78946c){var _0x51ad63=function(_0x192e5e){while(--_0x192e5e){_0x2bd415['push'](_0x2bd415['shift']());}};_0x51ad63(++_0x78946c);}(_0x3d04,0xbe));var _0x43d0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3d04[_0x1facfa];return _0x9ec701;};'use strict';var util=require(_0x43d0('0x0'));var _=require(_0x43d0('0x1'));var moment=require(_0x43d0('0x2'));function checkNameSurname(_0x105c73,_0x191de5,_0x143fea){var _0x3d6e62='';if(!_[_0x43d0('0x3')](_0x191de5)&&'string'===typeof _0x191de5){_0x3d6e62+=_0x191de5;}if(!_[_0x43d0('0x3')](_0x143fea)&&_0x43d0('0x4')===typeof _0x143fea){_0x3d6e62+='\x20'+_0x143fea;}if(_0x3d6e62!==''){return _0x3d6e62;}return _0x105c73;}function Action(_0x746f5e,_0x617bf,_0x5e284f,_0x484271,_0x50919e){this['uniqueid']=_0x5e284f||undefined;this[_0x43d0('0x5')]=_0x746f5e['id'];this[_0x43d0('0x6')]=_0x617bf[_0x43d0('0x7')];this[_0x43d0('0x8')]=_0x617bf[_0x43d0('0x8')];this['campaigntype']='queue';this[_0x43d0('0x9')]=![];this['membername']=_['isNil'](_0x746f5e[_0x43d0('0xa')])?undefined:_0x746f5e[_0x43d0('0xa')][_0x43d0('0x7')];this[_0x43d0('0xb')]=this['membername']?util[_0x43d0('0xc')](_0x43d0('0xd'),this['membername']):_0x484271||undefined;this[_0x43d0('0xe')]=checkNameSurname(_0x746f5e[_0x43d0('0xf')][_0x43d0('0x10')],_0x746f5e['Contact'][_0x43d0('0x11')],_0x746f5e[_0x43d0('0xf')][_0x43d0('0x12')]);this['active']=_0x746f5e[_0x43d0('0x13')]||![];this[_0x43d0('0x14')]=_0x746f5e[_0x43d0('0x10')];this[_0x43d0('0x15')]=_0x746f5e[_0x43d0('0x15')];this['countbusyretry']=_0x746f5e['countbusyretry']||0x0;this[_0x43d0('0x16')]=_0x746f5e[_0x43d0('0x16')]||0x0;this[_0x43d0('0x17')]=_0x746f5e['countnoanswerretry']||0x0;this[_0x43d0('0x18')]=(_0x746f5e['countbusyretry']||0x0)+(_0x746f5e[_0x43d0('0x16')]||0x0)+(_0x746f5e[_0x43d0('0x17')]||0x0)+(_0x746f5e[_0x43d0('0x19')]||0x0)+(_0x746f5e['countdropretry']||0x0)+(_0x746f5e[_0x43d0('0x1a')]||0x0)+(_0x746f5e[_0x43d0('0x1b')]||0x0)+(_0x746f5e['countagentrejectretry']||0x0);this[_0x43d0('0x19')]=_0x746f5e[_0x43d0('0x19')]||0x0;this[_0x43d0('0x1c')]=_0x746f5e[_0x43d0('0x1c')]||0x0;this[_0x43d0('0x1a')]=_0x746f5e[_0x43d0('0x1a')]||0x0;this[_0x43d0('0x1b')]=_0x746f5e[_0x43d0('0x1b')]||0x0;this[_0x43d0('0x1d')]=_0x746f5e[_0x43d0('0x1d')]||0x0;this[_0x43d0('0x1e')]=_0x746f5e[_0x43d0('0x1e')];this[_0x43d0('0x1f')]=_0x746f5e[_0x43d0('0x1f')];this[_0x43d0('0x20')]=_0x746f5e['callbackat'];this[_0x43d0('0x21')]=_0x746f5e[_0x43d0('0x21')];this['ContactId']=_0x746f5e[_0x43d0('0x22')];this['ListId']=_0x746f5e[_0x43d0('0x23')];this[_0x43d0('0x24')]=_['isNil'](_0x746f5e[_0x43d0('0xa')])?_0x746f5e[_0x43d0('0x24')]:_0x746f5e['Agent']['id'];this[_0x43d0('0x25')]=_0x746f5e[_0x43d0('0x25')];this[_0x43d0('0x26')]='';this['originatecalleridname']='';}Action[_0x43d0('0x27')][_0x43d0('0x28')]=function(){return util[_0x43d0('0xc')](_0x43d0('0x29'),this[_0x43d0('0xe')],this[_0x43d0('0x2a')]);};module[_0x43d0('0x2b')]=Action; \ No newline at end of file +var _0x4991=['ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','number','exports','util','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','SIP/%s','calleridname','Contact','phone','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x9ca2de,_0x39a8b0){var _0x5f37fd=function(_0x4e2a42){while(--_0x4e2a42){_0x9ca2de['push'](_0x9ca2de['shift']());}};_0x5f37fd(++_0x39a8b0);}(_0x4991,0xf7));var _0x1499=function(_0x3455f1,_0x514f0a){_0x3455f1=_0x3455f1-0x0;var _0x26ad5f=_0x4991[_0x3455f1];return _0x26ad5f;};'use strict';var util=require(_0x1499('0x0'));var _=require('lodash');var moment=require(_0x1499('0x1'));function checkNameSurname(_0x5bd577,_0x30d640,_0x256e41){var _0x16ac22='';if(!_[_0x1499('0x2')](_0x30d640)&&_0x1499('0x3')===typeof _0x30d640){_0x16ac22+=_0x30d640;}if(!_[_0x1499('0x2')](_0x256e41)&&_0x1499('0x3')===typeof _0x256e41){_0x16ac22+='\x20'+_0x256e41;}if(_0x16ac22!==''){return _0x16ac22;}return _0x5bd577;}function Action(_0x209616,_0x4b6154,_0x2a8e96,_0x1c3bd7,_0x1c65c3){this[_0x1499('0x4')]=_0x2a8e96||undefined;this[_0x1499('0x5')]=_0x209616['id'];this[_0x1499('0x6')]=_0x4b6154[_0x1499('0x7')];this[_0x1499('0x8')]=_0x4b6154['type'];this[_0x1499('0x9')]=_0x1499('0x6');this['dialAnswer']=![];this[_0x1499('0xa')]=_[_0x1499('0x2')](_0x209616['Agent'])?undefined:_0x209616[_0x1499('0xb')][_0x1499('0x7')];this['channelAgent']=this['membername']?util['format'](_0x1499('0xc'),this[_0x1499('0xa')]):_0x1c3bd7||undefined;this[_0x1499('0xd')]=checkNameSurname(_0x209616[_0x1499('0xe')][_0x1499('0xf')],_0x209616['Contact']['firstName'],_0x209616[_0x1499('0xe')]['lastName']);this[_0x1499('0x10')]=_0x209616[_0x1499('0x10')]||![];this[_0x1499('0x11')]=_0x209616[_0x1499('0xf')];this['scheduledat']=_0x209616[_0x1499('0x12')];this[_0x1499('0x13')]=_0x209616['countbusyretry']||0x0;this[_0x1499('0x14')]=_0x209616[_0x1499('0x14')]||0x0;this[_0x1499('0x15')]=_0x209616[_0x1499('0x15')]||0x0;this[_0x1499('0x16')]=(_0x209616[_0x1499('0x13')]||0x0)+(_0x209616['countcongestionretry']||0x0)+(_0x209616['countnoanswerretry']||0x0)+(_0x209616['countnosuchnumberretry']||0x0)+(_0x209616[_0x1499('0x17')]||0x0)+(_0x209616[_0x1499('0x18')]||0x0)+(_0x209616['countmachineretry']||0x0)+(_0x209616[_0x1499('0x19')]||0x0);this[_0x1499('0x1a')]=_0x209616[_0x1499('0x1a')]||0x0;this[_0x1499('0x17')]=_0x209616[_0x1499('0x17')]||0x0;this[_0x1499('0x18')]=_0x209616[_0x1499('0x18')]||0x0;this[_0x1499('0x1b')]=_0x209616[_0x1499('0x1b')]||0x0;this[_0x1499('0x19')]=_0x209616[_0x1499('0x19')]||0x0;this[_0x1499('0x1c')]=_0x209616[_0x1499('0x1c')];this[_0x1499('0x1d')]=_0x209616[_0x1499('0x1d')];this[_0x1499('0x1e')]=_0x209616[_0x1499('0x1e')];this['recallme']=_0x209616[_0x1499('0x1f')];this[_0x1499('0x20')]=_0x209616[_0x1499('0x20')];this[_0x1499('0x21')]=_0x209616[_0x1499('0x21')];this[_0x1499('0x22')]=_['isNil'](_0x209616['Agent'])?_0x209616[_0x1499('0x22')]:_0x209616[_0x1499('0xb')]['id'];this[_0x1499('0x23')]=_0x209616[_0x1499('0x23')];this[_0x1499('0x24')]='';this['originatecalleridname']='';}Action[_0x1499('0x25')]['getCaller']=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x1499('0xd')],this[_0x1499('0x26')]);};module[_0x1499('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 250af33..921ada7 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 _0x55ca=['syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','originated','sendMessageOneNotActive','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','prototype','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','preview','booked','type','outbound','clockClearZombieChannels','clearZombieChannels','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','info','[clearZombieChannels][talking]','originated:\x20','queue','pTalking:\x20','pick','UserId','ListId','Action','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','getContactRecallMe','agents','then','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','catch','starttime','outboundReCallsDay','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','dialActive','Trunk','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','countnosuchnumberretry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','pTalking','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','uniqueid','outboundBusyCallsDay','countbusyretry','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','Congestion','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','VoiceQueueId','Queue','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','Calling','[Preview][execCall][failure]','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','trunks','SIP/%s','status','reachable','unmonitored','run','unlock','disableContact','getContactPreview','recallme','validateContact','checkIsBlackList','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','logLookAgent','clone','unlockContact','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','actions','originateresponse','syncOriginateResponse','bind','hangup','syncHangup'];(function(_0x5c5312,_0x2378c3){var _0xf5c589=function(_0x3ca0ea){while(--_0x3ca0ea){_0x5c5312['push'](_0x5c5312['shift']());}};_0xf5c589(++_0x2378c3);}(_0x55ca,0x126));var _0xa55c=function(_0x100ea5,_0x2f13b4){_0x100ea5=_0x100ea5-0x0;var _0x1c331=_0x55ca[_0x100ea5];return _0x1c331;};'use strict';var util=require(_0xa55c('0x0'));var _=require(_0xa55c('0x1'));var uuid=require('uuid');var moment=require('moment');var Redis=require('ioredis');var config=require(_0xa55c('0x2'));var logger=require(_0xa55c('0x3'))('preview');var loggerAction=require(_0xa55c('0x3'))(_0xa55c('0x4'));var ami=require(_0xa55c('0x5'));var rpcDb=require(_0xa55c('0x6'));var cmHopperAdditionalPhone=require(_0xa55c('0x7'));var Action=require(_0xa55c('0x8'));var ut=require(_0xa55c('0x9'));var utils=require('../dialer/utils');config[_0xa55c('0xa')]=_[_0xa55c('0xb')](config['redis'],{'host':_0xa55c('0xc'),'port':0x18eb});var io=require(_0xa55c('0xd'))(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype'][_0xa55c('0xe')]=function(_0x20c76a){this[_0xa55c('0xf')]=this[_0xa55c('0xf')]?this[_0xa55c('0xf')][_0xa55c('0x10')](_0x20c76a):_0x20c76a();};function Preview(_0x508342){this[_0xa55c('0x11')]=new Sequence();this[_0xa55c('0x12')]=_0x508342[_0xa55c('0x13')];this['trunks']=_0x508342['trunks'];this[_0xa55c('0x14')]={};this['agents']=_0x508342['agents'];this['clockClearZombieChannels']=0x0;ami['on'](_0xa55c('0x15'),this[_0xa55c('0x16')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x18'),this[_0xa55c('0x19')][_0xa55c('0x17')](this));ami['on']('hanguprequest',this[_0xa55c('0x1a')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x1b'),this[_0xa55c('0x1c')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x1d'),this[_0xa55c('0x1e')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x1f'),this['syncVarSet'][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x20'),this[_0xa55c('0x21')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x22'),this[_0xa55c('0x23')]['bind'](this));this['loopCampaigns'](this[_0xa55c('0x12')]);}function emit(_0x3776ac,_0xade4c4,_0x4cfe10){io['to'](_0x3776ac)[_0xa55c('0x24')](_0xade4c4,_0x4cfe10);}function emitVoiceQueueChannelRemove(_0x2fcb90){logger['info'](_0xa55c('0x25'),JSON[_0xa55c('0x26')](_0x2fcb90));emit(util[_0xa55c('0x27')](_0xa55c('0x28'),_0x2fcb90[_0xa55c('0x29')]),'voice_queue_channel:remove',_0x2fcb90);io[_0xa55c('0x24')]('voice_queue_presence:remove',_0x2fcb90);}function notSendMessagesQueue(_0x5ba836){if(_0x5ba836['sendMessageOneNotActive']){if(_0x5ba836[_0xa55c('0x2a')]===0x0&&_0x5ba836['pTalking']===0x0){_0x5ba836[_0xa55c('0x2b')]=![];_0x5ba836[_0xa55c('0x2c')]=0x0;_0x5ba836[_0xa55c('0x2d')]=0x0;_0x5ba836[_0xa55c('0x2e')]=utils[_0xa55c('0x2f')][_0xa55c('0x30')];ut[_0xa55c('0x31')](_0xa55c('0x32'),_0x5ba836[_0xa55c('0x29')]+_0xa55c('0x33'));}else{_0x5ba836[_0xa55c('0x2e')]=utils['CAMPAIGN_STATUS'][_0xa55c('0x34')];ut[_0xa55c('0x31')](_0xa55c('0x32'),_0x5ba836[_0xa55c('0x29')]+'\x20is\x20deactivated');}}}Preview[_0xa55c('0x35')][_0xa55c('0x36')]=function(){var _0x1b8388=this;setInterval(function(){_0x1b8388[_0xa55c('0x37')]();},0x7cf);};Preview[_0xa55c('0x35')][_0xa55c('0x37')]=function(){var _0x52d37f=this[_0xa55c('0x12')];this['clockClearZombieChannels']+=0x1;for(var _0x35c9c2 in _0x52d37f){if(_0x52d37f[_0xa55c('0x38')](_0x35c9c2)&&(_0x52d37f[_0x35c9c2][_0xa55c('0x39')]===_0xa55c('0x3a')||_0x52d37f[_0x35c9c2]['dialMethod']===_0xa55c('0x3b'))&&_0x52d37f[_0x35c9c2][_0xa55c('0x3c')]===_0xa55c('0x3d')){if(this[_0xa55c('0x3e')]>0x7){this[_0xa55c('0x3e')]=0x0;this[_0xa55c('0x3f')]();}}if(_0x52d37f[_0xa55c('0x38')](_0x35c9c2)&&_0x52d37f[_0x35c9c2][_0xa55c('0x39')]===_0xa55c('0x3a')&&_0x52d37f[_0x35c9c2][_0xa55c('0x3c')]===_0xa55c('0x3d')){if(_0x52d37f[_0x35c9c2]['dialActive']){this['setMessage'](_0x52d37f[_0x35c9c2]);if(_0x52d37f[_0x35c9c2][_0xa55c('0x40')])this[_0xa55c('0x41')](_0x52d37f[_0x35c9c2]);}else{notSendMessagesQueue(_0x52d37f[_0x35c9c2]);}}}};Preview['prototype'][_0xa55c('0x42')]=function(_0x2f0110){var _0x2e9623=this;this[_0xa55c('0x11')][_0xa55c('0xe')](function(){if(!_[_0xa55c('0x43')](_0x2e9623[_0xa55c('0x14')][_0x2f0110])){loggerAction[_0xa55c('0x44')](_0xa55c('0x45'),_0x2f0110,'Queue',_0x2e9623['actions'][_0x2f0110]['queue'],_0xa55c('0x46'),JSON[_0xa55c('0x26')](_0x2e9623[_0xa55c('0x12')][_0x2e9623['actions'][_0x2f0110][_0xa55c('0x47')]]['originated']),_0xa55c('0x48'),JSON['stringify'](_0x2e9623[_0xa55c('0x12')][_0x2e9623[_0xa55c('0x14')][_0x2f0110][_0xa55c('0x47')]]['pTalking']),JSON[_0xa55c('0x26')](_0x2e9623[_0xa55c('0x14')][_0x2f0110]['dialAnswer']),JSON[_0xa55c('0x26')](_[_0xa55c('0x49')](_0x2e9623['actions'][_0x2f0110],['contactId',_0xa55c('0x4a'),'VoiceQueueId',_0xa55c('0x4b')])));return ami[_0xa55c('0x4c')]({'action':'status','channel':_0x2e9623['actions'][_0x2f0110]['channel']})['catch'](function(_0x3b3308){if(_0x3b3308[_0xa55c('0x2e')]===_0xa55c('0x4d')){setTimeout(function(){if(_0x2e9623[_0xa55c('0x14')][_0x2f0110]){ut[_0xa55c('0x4e')](_0x2e9623['campaignsPreview'][_0x2e9623[_0xa55c('0x14')][_0x2f0110][_0xa55c('0x47')]],_0xa55c('0x4f'));if(_0x2e9623[_0xa55c('0x14')][_0x2f0110][_0xa55c('0x50')]===!![]){ut[_0xa55c('0x51')](_0x2e9623['campaignsPreview'][_0x2e9623[_0xa55c('0x14')][_0x2f0110]['queue']],'[clearZombieChannel]');ut[_0xa55c('0x52')](_0xa55c('0x53')+_0x2f0110,_0x2e9623['actions'][_0x2f0110][_0xa55c('0x47')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x2f0110,_0x2e9623[_0xa55c('0x14')][_0x2f0110][_0xa55c('0x47')]);delete _0x2e9623[_0xa55c('0x14')][_0x2f0110];}},0x2328);}});}});};Preview['prototype'][_0xa55c('0x3f')]=function(){var _0xd5a006=this;loggerAction['info'](_0xa55c('0x54'),_['size'](this[_0xa55c('0x14')]));for(var _0x43a42d in this['actions']){if(_0xd5a006[_0xa55c('0x14')][_0xa55c('0x38')](_0x43a42d)){_0xd5a006['clearZombieChannel'](_0x43a42d);}}};Preview[_0xa55c('0x35')][_0xa55c('0x41')]=function(_0x204767){var _0x59a6c8=this;rpcDb[_0xa55c('0x55')](_0x204767['id'],ut['agentReadyId'](this[_0xa55c('0x56')]))[_0xa55c('0x57')](function(_0x451269){if(!_['isNil'](_0x451269)){for(var _0x41eab1=0x0;_0x41eab1<_0x451269[_0xa55c('0x58')];_0x41eab1+=0x1){if(ut['getDiff'](_0x451269[_0x41eab1][_0xa55c('0x59')])<_0x204767[_0xa55c('0x5a')]*0x3c){if(_0x451269[_0x41eab1]['Agent']&&!_0x451269[_0x41eab1][_0xa55c('0x5b')][_0xa55c('0x5c')]){_0x59a6c8['run'](_0x451269[_0x41eab1]['id'])[_0xa55c('0x57')](ut[_0xa55c('0x5d')](_0xa55c('0x5e')))[_0xa55c('0x5f')](ut['logger2'](_0xa55c('0x5e')));}else{rpcDb['disableContact'](_0x451269[_0x41eab1]['id']);}}else{var _0x2157d6=new Action(_0x451269[_0x41eab1],_0x204767);_0x2157d6[_0xa55c('0x60')]=moment()[_0xa55c('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0x204767[_0xa55c('0x61')]+=0x1;ut[_0xa55c('0x62')](_0x2157d6,0x17,'RecallInQueue');if(_0x204767[_0xa55c('0x63')]){rpcDb[_0xa55c('0x64')](ut[_0xa55c('0x65')](_0x451269[_0x41eab1]));rpcDb[_0xa55c('0x66')](_0x2157d6,_0xa55c('0x67'));}else{ut[_0xa55c('0x62')](_0x2157d6,0x16,_0xa55c('0x68'));rpcDb[_0xa55c('0x66')](_0x2157d6,_0xa55c('0x69'));rpcDb[_0xa55c('0x6a')](_0x2157d6,'[HistoryRecallClose]');}}}}})[_0xa55c('0x5f')](ut[_0xa55c('0x5d')](_0xa55c('0x6b')));};Preview['prototype'][_0xa55c('0x6c')]=function(_0x35bf0a){_0x35bf0a['sendMessageOneNotActive']=!![];if(ut[_0xa55c('0x6d')](_0x35bf0a['loggedIn'])){_0x35bf0a[_0xa55c('0x2e')]=utils[_0xa55c('0x2f')][_0xa55c('0x6e')];}else if(!ut[_0xa55c('0x6f')](_0x35bf0a[_0xa55c('0x70')])){_0x35bf0a['message']=utils[_0xa55c('0x2f')][_0xa55c('0x30')];}else if(!this['isTrunkReachable'](_0x35bf0a[_0xa55c('0x71')])){if(!this[_0xa55c('0x72')](_0x35bf0a[_0xa55c('0x73')])){_0x35bf0a[_0xa55c('0x2e')]=utils['CAMPAIGN_STATUS']['UNREACHABLE_TRUNK'];}else{_0x35bf0a[_0xa55c('0x2e')]=utils[_0xa55c('0x2f')][_0xa55c('0x74')];}}else{_0x35bf0a[_0xa55c('0x2e')]=utils['CAMPAIGN_STATUS'][_0xa55c('0x74')];}};Preview['prototype'][_0xa55c('0x75')]=function(_0x437ced,_0x20593d,_0x2ccfb1){var _0xec640=this;var _0x53b2f7=this[_0xa55c('0x14')][_0x20593d];var _0x54f776=this[_0xa55c('0x12')][_0x53b2f7[_0xa55c('0x47')]];var _0x2cfe08;var _0x1e1c5b=![];var _0x19aaf5=0x2;var _0x138c9e=0x3;if(_0x54f776){switch(_0x2ccfb1){case'1':_0x54f776[_0xa55c('0x76')]+=0x1;_0x53b2f7['countnosuchnumberretry']+=0x1;_0x53b2f7[_0xa55c('0x77')]=ut[_0xa55c('0x78')](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0x0,_0xa55c('0x79'));ami[_0xa55c('0x24')]('custom:agentnosuchnumber',ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0x7b')));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0x7c'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'0',_0x54f776)['then'](function(_0xdd92c1){_0x1e1c5b=_0xdd92c1[_0xa55c('0x7e')]==0x1;_0x19aaf5=_0x54f776[_0xa55c('0x7f')];_0x138c9e=_0x54f776[_0xa55c('0x80')];if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut[_0xa55c('0x81')](_0x53b2f7,0xf,'Global');rpcDb[_0xa55c('0x6a')](_0x2cfe08,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x53b2f7[_0xa55c('0x82')]>=_0x54f776['dialNoSuchNumberMaxRetry']){rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0x83'));}else{rpcDb[_0xa55c('0x84')](ut[_0xa55c('0x85')](_0x53b2f7,_0xa55c('0x82'),_0x54f776[_0xa55c('0x7f')]),_0x53b2f7[_0xa55c('0x86')],_0x53b2f7[_0xa55c('0x87')]);}}delete this[_0xa55c('0x14')][_0x437ced[_0xa55c('0x88')]];}else{_0x53b2f7['countnosuchnumberretry']++;logger[_0xa55c('0x44')](_0xa55c('0x89'),_0x53b2f7['countnosuchnumberretry']);logger[_0xa55c('0x44')]('id',_0x53b2f7[_0xa55c('0x8a')]);_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnosuchnumberretry':_0x53b2f7[_0xa55c('0x82')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});break;case'ANSWER':var _0x1dfaf7=moment()[_0xa55c('0x27')](_0xa55c('0x8d'));_0x53b2f7[_0xa55c('0x8e')]=_0x1dfaf7;_0x53b2f7[_0xa55c('0x8f')]=_0x1dfaf7;_0x53b2f7[_0xa55c('0x50')]=!![];_0x54f776[_0xa55c('0x90')]+=0x1;logger[_0xa55c('0x44')](_0xa55c('0x91'),_0x53b2f7['uniqueid'],_0xa55c('0x92'),_0x54f776[_0xa55c('0x29')],_0xa55c('0x48'),_0x54f776[_0xa55c('0x90')]);ami[_0xa55c('0x24')](_0xa55c('0x93'),ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0x94'),this[_0xa55c('0x12')][_0x53b2f7[_0xa55c('0x47')]]));if(_0x54f776[_0xa55c('0x95')]){ami['emit'](_0xa55c('0x96'),ut['buildAcw'](_0x53b2f7));}break;case'16':ami[_0xa55c('0x24')](_0xa55c('0x97'),ut[_0xa55c('0x7a')](_0x53b2f7,'complete',this['campaignsPreview'][_0x53b2f7[_0xa55c('0x47')]]));emitVoiceQueueChannelRemove(ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0x98')));_0x54f776[_0xa55c('0x99')]+=0x1;_0x54f776['total']+=0x1;_0x54f776[_0xa55c('0x9a')]+=0x1;ut[_0xa55c('0x51')](_0x54f776,_0xa55c('0x9b'));_0x53b2f7[_0xa55c('0x77')]=ut[_0xa55c('0x78')](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0x4,'Answer');rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0x9c'));rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0x9d'));rpcDb[_0xa55c('0x9e')](_0x53b2f7);_0x54f776['sumDuration']+=_0x53b2f7[_0xa55c('0x9f')];_0x54f776[_0xa55c('0xa0')]+=_0x53b2f7['talktime'];logger[_0xa55c('0x44')](_0xa55c('0xa1'),_0x53b2f7[_0xa55c('0xa2')],'\x20Queue',_0x54f776[_0xa55c('0x29')],_0xa55c('0x48'),_0x54f776[_0xa55c('0x90')]);delete this[_0xa55c('0x14')][_0x437ced[_0xa55c('0x88')]];break;case'BUSY':_0x54f776[_0xa55c('0xa3')]+=0x1;_0x53b2f7[_0xa55c('0xa4')]+=0x1;_0x53b2f7['countglobal']=ut['totalGlobal'](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0x5,'Busy');_0x19aaf5=_0x54f776[_0xa55c('0xa5')];_0x138c9e=_0x54f776[_0xa55c('0x80')];ami[_0xa55c('0x24')](_0xa55c('0xa6'),ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0xa7')));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0xa8'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'5',_0x54f776)['then'](function(_0x463195){_0x1e1c5b=_0x463195[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776[_0xa55c('0xa9')]){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xab'));}else{if(_0x53b2f7[_0xa55c('0xa4')]>=_0x54f776['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x53b2f7,_0xa55c('0xa8'));}else{rpcDb[_0xa55c('0x84')](ut[_0xa55c('0x85')](_0x53b2f7,_0xa55c('0xa4'),_0x54f776['dialBusyRetryFrequency']),_0x53b2f7['unlockAgent'],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7[_0xa55c('0xa4')]++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countbusyretry':_0x53b2f7[_0xa55c('0xa4')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)['then'](function(){});});}});break;case _0xa55c('0xac'):_0x54f776['outboundNoAnswerCallsDay']+=0x1;_0x53b2f7[_0xa55c('0xad')]+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0x3,_0xa55c('0xae'));_0x19aaf5=_0x54f776[_0xa55c('0xaf')];_0x138c9e=_0x54f776[_0xa55c('0x80')];var _0x402f02=ut[_0xa55c('0xb0')](_0x53b2f7,_0x54f776);ami[_0xa55c('0x24')]('custom:agentnoanswer',_0x402f02);rpcDb['createCustomerHistory'](_0x53b2f7,_0xa55c('0xb1'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'3',_0x54f776)[_0xa55c('0x57')](function(_0x256db0){_0x1e1c5b=_0x256db0[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut[_0xa55c('0x81')](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xb2'));}else{if(_0x53b2f7[_0xa55c('0xad')]>=_0x54f776[_0xa55c('0xb3')]){rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xb1'));}else{rpcDb['rescheduleContact'](ut[_0xa55c('0x85')](_0x53b2f7,_0xa55c('0xad'),_0x54f776[_0xa55c('0xaf')]),_0x53b2f7[_0xa55c('0x86')],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7['countnoanswerretry']++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7['countnoanswerretry']}})['then'](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});break;case'CONGESTION':_0x54f776['outboundCongestionCallsDay']+=0x1;_0x53b2f7['countcongestionretry']+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0x8,_0xa55c('0xb4'));_0x19aaf5=_0x54f776[_0xa55c('0xb5')];_0x138c9e=_0x54f776[_0xa55c('0x80')];ami[_0xa55c('0x24')]('custom:agentcongestion',ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0xb6')));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0xb7'));_0xec640['verifyAdditionalPhones'](_0x53b2f7,'8',_0x54f776)[_0xa55c('0x57')](function(_0x25e4e0){_0x1e1c5b=_0x25e4e0[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut['totalGlobal'](_0x53b2f7)>=_0x54f776[_0xa55c('0xa9')]){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0xf,'Global');rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xb8'));}else{if(_0x53b2f7[_0xa55c('0xb9')]>=_0x54f776[_0xa55c('0xba')]){rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xb7'));}else{rpcDb[_0xa55c('0x84')](ut['scheduledAt'](_0x53b2f7,'countcongestionretry',_0x54f776[_0xa55c('0xa5')]),_0x53b2f7[_0xa55c('0x86')],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7[_0xa55c('0xb9')]++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countcongestionretry':_0x53b2f7[_0xa55c('0xb9')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});break;case'CANCEL':_0x54f776[_0xa55c('0xbb')]+=0x1;_0x53b2f7[_0xa55c('0xbc')]+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0x14,_0xa55c('0xbd'));_0x19aaf5=_0x54f776[_0xa55c('0xbe')];_0x138c9e=_0x54f776[_0xa55c('0x80')];ami[_0xa55c('0x24')](_0xa55c('0xbf'),ut['buildObj'](_0x53b2f7,_0xa55c('0xc0')));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0xc1'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'20',_0x54f776)[_0xa55c('0x57')](function(_0x31287c){_0x1e1c5b=_0x31287c[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut['totalGlobal'](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0x14,_0xa55c('0xbd'));rpcDb['createCustomerFinal'](_0x2cfe08,_0xa55c('0xc2'));}else{if(_0x53b2f7[_0xa55c('0xbc')]>=_0x54f776[_0xa55c('0xc3')]){rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xc2'));}else{rpcDb['rescheduleContact'](ut[_0xa55c('0x85')](_0x53b2f7,'countagentrejectretry',_0x54f776[_0xa55c('0xbe')]),_0x53b2f7[_0xa55c('0x86')],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7[_0xa55c('0xad')]++;_0xec640['incrementPreviewCounters']({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7[_0xa55c('0xad')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});break;case _0xa55c('0xc4'):_0x54f776[_0xa55c('0xc5')]+=0x1;_0x53b2f7[_0xa55c('0xc6')]+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0xb,_0xa55c('0xc7'));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0xc8'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'11',_0x54f776)['then'](function(_0x46124b){_0x1e1c5b=_0x46124b['additional']==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut[_0xa55c('0x81')](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x53b2f7[_0xa55c('0xc9')]>=_0x54f776[_0xa55c('0xca')]){rpcDb[_0xa55c('0x6a')](_0x53b2f7,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xa55c('0x84')](ut['scheduledAt'](_0x53b2f7,_0xa55c('0xc6'),_0x54f776[_0xa55c('0xcb')]),_0x53b2f7['unlockAgent'],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7['countnoanswerretry']++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7['countnoanswerretry']}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)['then'](function(){});});}});break;case'18':_0x54f776[_0xa55c('0xcc')]+=0x1;_0x53b2f7[_0xa55c('0xcd')]+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0x12,_0x437ced['cause-txt']||_0x437ced[_0xa55c('0xce')]);ami[_0xa55c('0x24')](_0xa55c('0xcf'),ut[_0xa55c('0x7a')](_0x53b2f7,'amd'));rpcDb[_0xa55c('0x66')](_0x53b2f7,'[callProgressDetectingCustomer][hangupInAMD]');_0xec640[_0xa55c('0x7d')](_0x53b2f7,'18',_0x54f776)['then'](function(_0x4ab9f1){_0x1e1c5b=_0x4ab9f1['additional']==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0x12,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xd0'));}else{rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xd0'));}}else{_0x53b2f7[_0xa55c('0xad')]++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7[_0xa55c('0xad')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});delete this[_0xa55c('0x14')][_0x437ced['linkedid']];break;case'19':_0x54f776[_0xa55c('0xcc')]+=0x1;_0x53b2f7['countglobal']=ut['totalGlobal'](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0x13,_0x437ced[_0xa55c('0xd1')]||_0x437ced['dialstatus']);ami[_0xa55c('0x24')]('custom:amd',ut[_0xa55c('0x7a')](_0x53b2f7,'amd'));rpcDb['createCustomerHistory'](_0x53b2f7,_0xa55c('0xd2'));_0xec640['verifyAdditionalPhones'](_0x53b2f7,'18',_0x54f776)['then'](function(_0x2961b6){_0x1e1c5b=_0x2961b6[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut['totalGlobal'](_0x53b2f7)>=_0x54f776[_0xa55c('0xa9')]){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xd2'));}else{rpcDb['createCustomerFinal'](_0x53b2f7,'[callProgressDetectingCustomer][machine]');}}else{_0x53b2f7[_0xa55c('0xad')]++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7[_0xa55c('0xad')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});delete this[_0xa55c('0x14')][_0x437ced['linkedid']];break;default:if(_0x53b2f7[_0xa55c('0x50')]){ut[_0xa55c('0x51')](_0x54f776,_0xa55c('0xd3'));ut[_0xa55c('0x52')](_0xa55c('0xd4')+_0x54f776[_0xa55c('0x29')],_0x437ced);}_0x54f776[_0xa55c('0xcc')]+=0x1;_0x53b2f7[_0xa55c('0x77')]=ut[_0xa55c('0x78')](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0xc,_0x437ced[_0xa55c('0xd1')]||_0x437ced[_0xa55c('0xce')]);_0x19aaf5=_0x54f776[_0xa55c('0xbe')];_0x138c9e=_0x54f776['callAdditionalPhoneAfterMin'];rpcDb['createCustomerHistory'](_0x53b2f7,'[callProgressDetectingCustomer][logUnknown]');_0xec640[_0xa55c('0x7d')](_0x53b2f7,'20',_0x54f776)['then'](function(_0x1ba04f){_0x1e1c5b=_0x1ba04f[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776[_0xa55c('0xa9')]){_0x2cfe08=ut[_0xa55c('0x81')](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xd5'));}else{rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xd5'));}delete this[_0xa55c('0x14')][_0x437ced[_0xa55c('0x88')]];}else{_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});}});}if(!(_0x53b2f7[_0xa55c('0x50')]&&_0x2ccfb1==='16')){ut[_0xa55c('0x4e')](_0x54f776,_0xa55c('0xd6'));logger[_0xa55c('0x44')](_0xa55c('0xd7'),_0x53b2f7[_0xa55c('0xa2')],_0xa55c('0x92'),_0x54f776[_0xa55c('0x29')],_0xa55c('0x46'),_0x54f776[_0xa55c('0x2a')]);}if(_0x2ccfb1!=='ANSWER'){delete this[_0xa55c('0x14')][_0x437ced[_0xa55c('0x88')]];delete this['actions'][_0x437ced[_0xa55c('0xd8')]];}_0x54f776[_0xa55c('0xd9')]=!![];}};Preview[_0xa55c('0x35')][_0xa55c('0xda')]=function(_0x31767b,_0x4d9b66,_0x456dd4){if(_['isUndefined'](_0x4d9b66)&&'object'!==typeof _0x4d9b66){return;}if(_[_0xa55c('0xdb')](_0x456dd4)&&_0xa55c('0xdc')!==typeof _0x456dd4){return;}switch(_0x456dd4[_0xa55c('0xdd')]){case'0':ut[_0xa55c('0xde')](_0x31767b,0x0,_0xa55c('0x79'));rpcDb[_0xa55c('0xdf')](_0x31767b,_0xa55c('0xe0'));break;case'3':ut[_0xa55c('0xde')](_0x31767b,0x3,_0xa55c('0xae'));rpcDb[_0xa55c('0xdf')](_0x31767b,_0xa55c('0xe1'));break;case'5':ut[_0xa55c('0xde')](_0x31767b,0x5,_0xa55c('0xe2'));rpcDb[_0xa55c('0xdf')](_0x31767b,_0xa55c('0xe3'));break;case'8':ut[_0xa55c('0xde')](_0x31767b,0x8,_0xa55c('0xb4'));rpcDb[_0xa55c('0xdf')](_0x31767b,_0xa55c('0xe4'));break;case'22':ut['logAgent'](_0x31767b,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x31767b,_0xa55c('0xe5'));break;default:ut[_0xa55c('0xde')](_0x31767b,0xc,_0x456dd4['reason']);rpcDb[_0xa55c('0xdf')](_0x31767b,'[callProgressDetectingAgent][logCongestion]');}ut[_0xa55c('0x4e')](_0x4d9b66,'[callProgressDetectingAgent]');logger[_0xa55c('0x44')](_0xa55c('0xe6'),_0x31767b[_0xa55c('0xa2')],_0xa55c('0x92'),_0x4d9b66[_0xa55c('0x29')],_0xa55c('0x46'),_0x4d9b66[_0xa55c('0x2a')]);delete this[_0xa55c('0x14')][_0x31767b[_0xa55c('0xa2')]];};Preview[_0xa55c('0x35')][_0xa55c('0x7d')]=function(_0x53f209,_0x59f3a4,_0xde7bd){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x53f209,_0x59f3a4,_0xde7bd)[_0xa55c('0x5f')](logger['info'](_0xa55c('0xe7')));};Preview[_0xa55c('0x35')][_0xa55c('0x8c')]=function(_0x5b20c5,_0x3b8f15,_0x18584c){return cmHopperAdditionalPhone[_0xa55c('0x8c')](_0x5b20c5,_0x3b8f15,_0x18584c)['catch'](logger[_0xa55c('0x44')]('[swapAdditionalPhone]\x20'));};Preview[_0xa55c('0x35')]['incrementPreviewCounters']=function(_0x4e8433){return Promise[_0xa55c('0xe8')]()[_0xa55c('0x57')](cmHopperAdditionalPhone[_0xa55c('0x8b')](_0x4e8433))['catch'](logger[_0xa55c('0x44')](_0xa55c('0xe9')));};Preview[_0xa55c('0x35')][_0xa55c('0xea')]=function(_0x4399bd,_0x3e9384,_0x2e76ad,_0x24db74,_0x4b1762){var _0x402298=this;return new Promise(function(_0x1b8b05,_0x80befe){if(_[_0xa55c('0x43')](_0x3e9384)||_[_0xa55c('0x43')](_0x3e9384[_0xa55c('0xeb')])||_[_0xa55c('0x43')](_0x3e9384[_0xa55c('0xec')])||_[_0xa55c('0x43')](_0x3e9384[_0xa55c('0xed')])){_0x80befe(ut[_0xa55c('0x2e')]('Contact\x20is\x20undefined',_0x24db74,_0x4b1762));return;}var _0x263d16=uuid['v4']();var _0x48127c=_0x402298['campaignsPreview'][_0x3e9384[_0xa55c('0xee')]['name']];var _0x427e3b=_0x2e76ad?_0x402298['agents'][_0x2e76ad]['id']:undefined;_0x402298[_0xa55c('0x14')][_0x263d16]=new Action(_0x3e9384,_0x48127c,_0x263d16,_0x2e76ad,_0x427e3b);var _0x231499=_0x402298[_0xa55c('0x14')][_0x263d16];_0x231499[_0xa55c('0x86')]=_0x24db74;_0x231499[_0xa55c('0x87')]=_0x4b1762;_0x231499[_0xa55c('0xef')]=_0x2e76ad;if(_[_0xa55c('0xf0')](_0x4399bd)){_0x402298['execCall'](_0x231499,_0x48127c,_0x3e9384,_0x2e76ad)[_0xa55c('0x57')](function(_0x590c0c){logger['info'](_0xa55c('0xf1'),_0xa55c('0xf2')+_0x231499['queue']+_0xa55c('0xf3')+_0x231499[_0xa55c('0x8a')],JSON[_0xa55c('0x26')](_0x590c0c));ami['emit']('custom:agentcalled',ut['buildObj'](_0x231499,'called',_0x402298[_0xa55c('0x12')][_0x231499[_0xa55c('0x47')]]));_0x1b8b05(ut['message'](_0xa55c('0xf4')));})[_0xa55c('0x5f')](function(_0x3b3be0){ut['logger'](_0xa55c('0xf5'),_0x3b3be0);_0x80befe(ut['message']('Call\x20failed',_0x24db74,_0x4b1762));});}else{_0x48127c['outboundBlacklistCallsDay']+=0x1;ut[_0xa55c('0xf6')](_0x231499);rpcDb['createHistory'](_0x231499,_0xa55c('0xf7'));delete _0x402298['actions'][_0x263d16];_0x80befe(ut[_0xa55c('0x2e')](_0xa55c('0xf8'),_0x24db74,_0x4b1762));}});};Preview[_0xa55c('0x35')]['isTrunkReachable']=function(_0x1c016d){return!_[_0xa55c('0x43')](_0x1c016d)&&!_[_0xa55c('0x43')](_0x1c016d[_0xa55c('0x29')])&&!_[_0xa55c('0x43')](_0x1c016d[_0xa55c('0xf9')])&&_0x1c016d[_0xa55c('0xf9')]&&!_[_0xa55c('0x43')](this[_0xa55c('0xfa')][util['format'](_0xa55c('0xfb'),_0x1c016d[_0xa55c('0x29')])])&&!_[_0xa55c('0x43')](this[_0xa55c('0xfa')][util[_0xa55c('0x27')](_0xa55c('0xfb'),_0x1c016d['name'])][_0xa55c('0xfc')])&&(this['trunks'][util[_0xa55c('0x27')](_0xa55c('0xfb'),_0x1c016d['name'])][_0xa55c('0xfc')]===_0xa55c('0xfd')||this['trunks'][util['format'](_0xa55c('0xfb'),_0x1c016d[_0xa55c('0x29')])][_0xa55c('0xfc')]===_0xa55c('0xfe'));};Preview[_0xa55c('0x35')][_0xa55c('0xff')]=function(_0x31b866,_0x37ed47){return this['execRun'](_0x31b866,_0x37ed47)[_0xa55c('0x57')](function(_0x331595){return _[_0xa55c('0x49')](_0x331595,[_0xa55c('0x2e')]);})[_0xa55c('0x5f')](function(_0x59a69d){if(_0x59a69d[_0xa55c('0x100')]){rpcDb['unlockContact'](_0x31b866);}if(_0x59a69d['active']){rpcDb[_0xa55c('0x101')](_0x31b866);}throw _[_0xa55c('0x49')](_0x59a69d,[_0xa55c('0x2e')]);});};Preview[_0xa55c('0x35')]['execRun']=function(_0x125812,_0x155c6e){var _0xa22273=this;var _0x1c7506,_0x3b76df;return rpcDb[_0xa55c('0x102')](_0x125812)[_0xa55c('0x57')](function(_0x239b2e){if(!_['isNil'](_0x239b2e[0x0])){_0x3b76df=_0x239b2e[0x0][_0xa55c('0x103')]?![]:!![];_0x1c7506=_0x239b2e[0x0][_0xa55c('0x103')]?!![]:![];_0x1c7506=_0x155c6e?!![]:_0x1c7506;}var _0x2639cc=_0xa22273[_0xa55c('0x104')](_0x239b2e);if(_0x2639cc['isValid']){rpcDb[_0xa55c('0x105')](_[_0xa55c('0x49')](_0x239b2e[0x0],[_0xa55c('0xed'),'phone']))[_0xa55c('0x57')](function(_0x3a67fb){_0xa22273[_0xa55c('0xea')](_0x3a67fb,_0x239b2e[0x0],_0x155c6e,_0x3b76df,_0x1c7506)[_0xa55c('0x57')](function(_0x19e506){return _0x19e506;})[_0xa55c('0x5f')](function(_0x127c2f){throw _0x127c2f;});})['catch'](function(_0xcd4f3a){ut[_0xa55c('0x31')]('[Preview][checkIsBlackList]',_0xcd4f3a);throw ut[_0xa55c('0x2e')](_0xa55c('0x106'),_0x3b76df,_0x1c7506);});}else{throw ut[_0xa55c('0x2e')](_0x2639cc['message'],_0x3b76df,_0x1c7506);}})['catch'](function(_0x4dba17){ut[_0xa55c('0x31')](_0xa55c('0x107'),_0x4dba17);throw ut['message']('Call\x20unsuccessful',![],!![]);});};Preview[_0xa55c('0x35')][_0xa55c('0x104')]=function(_0x591ee3){if(_['isNil'](_0x591ee3)||_[_0xa55c('0xf0')](_0x591ee3)||!_[_0xa55c('0x43')](_0x591ee3[0x0][_0xa55c('0x5b')])&&_['isNil'](_0x591ee3[0x0]['Agent'][_0xa55c('0x29')])){ut['logger'](_0xa55c('0x108'),_0x591ee3);return{'isValid':![],'message':_0xa55c('0x109')};}var _0x5a4e69=this[_0xa55c('0x12')][_0x591ee3[0x0]['Queue']['name']];_0x5a4e69['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0xa55c('0x43')](_0x5a4e69)){ut['logger'](_0xa55c('0x10a'),_0x5a4e69);return{'isValid':![],'message':_0xa55c('0x10b')};}if(!this[_0xa55c('0x72')](_0x5a4e69['Trunk'])){ut[_0xa55c('0x31')](_0xa55c('0x10c'),_0xa55c('0x10d')+_0x5a4e69[_0xa55c('0x29')]+_0xa55c('0x10e'));if(!this[_0xa55c('0x72')](_0x5a4e69[_0xa55c('0x73')])){ut[_0xa55c('0x31')](_0xa55c('0x10c'),_0x5a4e69[_0xa55c('0x29')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xa55c('0x10f')};}}if(!ut[_0xa55c('0x6f')](_0x5a4e69['dialActive'])){ut[_0xa55c('0x31')](_0xa55c('0x110'),_0x5a4e69[_0xa55c('0x29')]+_0xa55c('0x111'));return{'isValid':![],'message':_0xa55c('0x10d')+_0x5a4e69[_0xa55c('0x29')]+_0xa55c('0x111')};}return{'isValid':!![],'message':_0xa55c('0x112')};};Preview[_0xa55c('0x35')][_0xa55c('0x113')]=function(_0x131288,_0x197953,_0x262d72,_0x228d12){var _0x16e229=this;return new Promise(function(_0x5c8713,_0x2d03b2){var _0x4b2e75=_0x131288[_0xa55c('0xa2')];var _0x3d0c6d=_0x16e229[_0xa55c('0x72')](_0x197953[_0xa55c('0x71')])?util['format'](_0xa55c('0x114'),_0x197953[_0xa55c('0x71')][_0xa55c('0x29')],_['isNil'](_0x197953[_0xa55c('0x115')])?'':_0x197953[_0xa55c('0x115')][_0xa55c('0x116')]()||'',_0x197953['dialCutDigit']>0x0?_0x262d72[_0xa55c('0xec')][_0xa55c('0x117')](_0x197953[_0xa55c('0x118')]):_0x262d72['phone']):util[_0xa55c('0x27')]('SIP/%s/%s%s',_[_0xa55c('0x43')](_0x197953[_0xa55c('0x73')])?_0x197953[_0xa55c('0x71')][_0xa55c('0x29')]:_0x197953[_0xa55c('0x73')]['name'],_[_0xa55c('0x43')](_0x197953[_0xa55c('0x115')])?'':_0x197953[_0xa55c('0x115')]['trim']()||'',_0x197953[_0xa55c('0x118')]>0x0?_0x262d72[_0xa55c('0xec')][_0xa55c('0x117')](_0x197953['dialCutDigit']):_0x262d72[_0xa55c('0xec')]);var _0x2becbd=_0x16e229[_0xa55c('0x72')](_0x197953[_0xa55c('0x71')])?ut[_0xa55c('0x119')](_0x197953[_0xa55c('0x71')][_0xa55c('0x11a')],_0x197953['dialOriginateCallerIdName'],_0x197953[_0xa55c('0x11b')]>0x0?ut[_0xa55c('0x11c')](_0x197953[_0xa55c('0x11d')],_0x197953[_0xa55c('0x11b')]):_0x197953['dialOriginateCallerIdNumber']):ut[_0xa55c('0x119')](_[_0xa55c('0x43')](_0x197953[_0xa55c('0x73')])?_0x197953[_0xa55c('0x71')][_0xa55c('0x11a')]:_0x197953[_0xa55c('0x73')][_0xa55c('0x11a')],_0x197953['dialOriginateCallerIdName'],_0x197953[_0xa55c('0x11b')]>0x0?ut[_0xa55c('0x11c')](_0x197953[_0xa55c('0x11d')],_0x197953[_0xa55c('0x11b')]):_0x197953[_0xa55c('0x11d')]);if(_0x2becbd){_0x131288['originatecalleridname']=ut['extractCalleridName'](_0x2becbd);_0x131288['originatecalleridnum']=ut[_0xa55c('0x11e')](_0x2becbd);}var _0x124873=ut[_0xa55c('0x11f')](_0x197953,_0x262d72,_0x3d0c6d,_0x2becbd,_0x4b2e75,_0x131288);_[_0xa55c('0x120')](_0x131288,ut[_0xa55c('0x121')](_0x124873));_0x131288[_0xa55c('0x60')]=moment()[_0xa55c('0x27')](_0xa55c('0x8d'));_0x197953['variables']=_0x124873;var _0x35c42c=ut[_0xa55c('0x122')](_0x131288,_0x197953,_0x124873,_0x131288[_0xa55c('0x87')],_0x228d12);return ami[_0xa55c('0x4c')](_0x35c42c)[_0xa55c('0x57')](function(_0xd511c0){_0x197953['originated']+=0x1;logger[_0xa55c('0x44')]('[originated][increment]',_0x4b2e75,'\x20Queue',_0x197953['name'],'originated:\x20',_0x197953[_0xa55c('0x2a')]);_0x5c8713(_0xd511c0);})[_0xa55c('0x5f')](function(_0x4732b4){ut[_0xa55c('0xde')](_0x131288,0xe,_0xa55c('0x123'));rpcDb[_0xa55c('0xdf')](_0x131288,_0xa55c('0x124'));_0x2d03b2(_0x4732b4);});});};Preview[_0xa55c('0x35')][_0xa55c('0x1e')]=function(_0x9c98af){if(this[_0xa55c('0x14')][_0x9c98af['linkedid']]){this['actions'][_0x9c98af[_0xa55c('0x88')]]['channel']=_0x9c98af[_0xa55c('0x125')];}};Preview[_0xa55c('0x35')][_0xa55c('0x16')]=function(_0x340570){var _0x2ef96f=this;var _0x582b22=this[_0xa55c('0x14')][_0x340570[_0xa55c('0x126')]];if(_0x582b22){if(_0x582b22[_0xa55c('0xef')]&&this['agents'][_0x582b22[_0xa55c('0xef')]]){ut[_0xa55c('0x127')](_0x582b22,this['agents'][_0x582b22['lookAgent']][_0xa55c('0x29')],this[_0xa55c('0x56')][_0x582b22[_0xa55c('0xef')]]['id']);}var _0x4f2883=_[_0xa55c('0x128')](_0x582b22);_0x4f2883[_0xa55c('0x8e')]=moment()[_0xa55c('0x27')](_0xa55c('0x8d'));var _0x5a37d6=_0x2ef96f['campaignsPreview'][_0x582b22[_0xa55c('0x47')]];if(ut['isFailure'](_0x340570['response'])){if(_0x582b22[_0xa55c('0x86')]){rpcDb[_0xa55c('0x129')](_0x582b22[_0xa55c('0x8a')]);}if(_0x582b22[_0xa55c('0x87')]){rpcDb['disableContact'](_0x582b22[_0xa55c('0x8a')]);}ami[_0xa55c('0x24')](_0xa55c('0x12a'),ut[_0xa55c('0x7a')](_0x582b22,_0xa55c('0x12b'),this['campaignsPreview'][_0x582b22[_0xa55c('0x47')]]));this[_0xa55c('0xda')](_0x4f2883,_0x5a37d6,_0x340570);}else{_0x582b22[_0xa55c('0x60')]=moment()[_0xa55c('0x27')](_0xa55c('0x8d'));ut[_0xa55c('0xde')](_0x4f2883,0x4,_0xa55c('0x12c'));rpcDb['createAgentHistory'](_0x4f2883,_0xa55c('0x12d'));}}};Preview['prototype'][_0xa55c('0x19')]=function(_0x26946f){var _0x3755a7=this['actions'][_0x26946f['linkedid']];var _0x307b39;if(_0x3755a7){_0x307b39=this[_0xa55c('0x12')][_0x3755a7['queue']];logger['info'](_0xa55c('0x12e'),_0x26946f[_0xa55c('0x88')],'\x20Queue',_0x307b39[_0xa55c('0x29')],'pTalking:\x20',_0x307b39[_0xa55c('0x90')]);}if(this[_0xa55c('0x14')][_0x26946f[_0xa55c('0x88')]]&&_0x26946f[_0xa55c('0x88')]!==_0x26946f['uniqueid']){if(_0x26946f[_0xa55c('0x12f')]==='16'&&this[_0xa55c('0x14')][_0x26946f[_0xa55c('0x88')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x26946f,_0x26946f[_0xa55c('0x88')],_0x26946f['cause']);}else if(this['actions'][_0x26946f[_0xa55c('0x88')]][_0xa55c('0x50')]){logger[_0xa55c('0x44')](_0xa55c('0x130'),_0x26946f[_0xa55c('0x88')],_0x26946f[_0xa55c('0x12f')],_0xa55c('0x92'),_0x307b39[_0xa55c('0x29')],_0xa55c('0x48'),_0x307b39[_0xa55c('0x90')]);this['callProgressDetectingCustomer'](_0x26946f,_0x26946f['linkedid'],_0x26946f[_0xa55c('0x12f')]);}}else if(_0x3755a7&&_[_0xa55c('0x43')](_0x3755a7[_0xa55c('0x131')])&&_0x307b39[_0xa55c('0x132')]&&_0x26946f['linkedid']===_0x26946f[_0xa55c('0xa2')]&&_[_0xa55c('0x43')](_0x26946f[_0xa55c('0xdd')])&&_0x26946f[_0xa55c('0x12f')]==='16'&&_0x26946f['channelstate']==='6'&&_[_0xa55c('0xdb')](_0x3755a7['transfer'])){if(_0x3755a7['unlockAgent']){rpcDb['unlockContact'](_0x3755a7['idContact']);}if(_0x3755a7[_0xa55c('0x87')]){rpcDb[_0xa55c('0x101')](_0x3755a7['idContact']);}_0x26946f[_0xa55c('0xdd')]='22';this[_0xa55c('0xda')](_0x3755a7,_0x307b39,_0x26946f);}else if(_0x3755a7&&_0x3755a7[_0xa55c('0x133')]){if(_0x26946f[_0xa55c('0x12f')]==='16'&&this[_0xa55c('0x14')][_0x26946f[_0xa55c('0x88')]]['dialAnswer']){logger[_0xa55c('0x44')](_0xa55c('0x134'),_0x26946f[_0xa55c('0x88')],_0x26946f[_0xa55c('0x12f')],'\x20Queue',_0x307b39['name'],'pTalking:\x20',_0x307b39[_0xa55c('0x90')]);this[_0xa55c('0x75')](_0x26946f,_0x26946f[_0xa55c('0x88')],_0x26946f[_0xa55c('0x12f')]);}else if(this[_0xa55c('0x14')][_0x26946f[_0xa55c('0x88')]][_0xa55c('0x50')]){logger[_0xa55c('0x44')]('[syncHangup][talking][cause]',_0x26946f['linkedid'],_0x26946f[_0xa55c('0x12f')],_0xa55c('0x92'),_0x307b39['name'],_0xa55c('0x48'),_0x307b39[_0xa55c('0x90')]);this['callProgressDetectingCustomer'](_0x26946f,_0x26946f['linkedid'],_0x26946f[_0xa55c('0x12f')]);}}};Preview[_0xa55c('0x35')][_0xa55c('0x1c')]=function(_0x236015){if(this['actions'][_0x236015['destlinkedid']]&&_0x236015[_0xa55c('0xd8')]!==_0x236015[_0xa55c('0x135')]){this[_0xa55c('0x75')](_0x236015,_0x236015[_0xa55c('0xd8')],_0x236015[_0xa55c('0xce')]);}};Preview[_0xa55c('0x35')][_0xa55c('0x1a')]=function(_0x2511fe){if(this[_0xa55c('0x14')][_0x2511fe[_0xa55c('0x88')]]&&_0x2511fe['linkedid']!==_0x2511fe[_0xa55c('0xa2')]&&!this['actions'][_0x2511fe[_0xa55c('0x88')]][_0xa55c('0x50')]){if(_0x2511fe[_0xa55c('0x12f')]==='1'){this[_0xa55c('0x75')](_0x2511fe,_0x2511fe[_0xa55c('0x88')],_0x2511fe[_0xa55c('0x12f')]);}}};Preview[_0xa55c('0x35')][_0xa55c('0x136')]=function(_0x1e8760,_0x329808,_0x35ad66){if(this[_0xa55c('0x14')][_0x1e8760]){if(_[_0xa55c('0x43')](this['actions'][_0x1e8760][_0xa55c('0x137')])){this[_0xa55c('0x14')][_0x1e8760]['variables']={};}this[_0xa55c('0x14')][_0x1e8760][_0xa55c('0x137')][_0x329808]=_0x35ad66;}};Preview[_0xa55c('0x35')]['syncVarSet']=function(_0x238a43){try{if(!_[_0xa55c('0x43')](_0x238a43)){if(ut['filterKey'](_[_0xa55c('0x138')](_0x238a43[_0xa55c('0x139')])[0x0])){this['addVariable'](_0x238a43[_0xa55c('0xa2')],_['keys'](_0x238a43[_0xa55c('0x139')])[0x0],_0x238a43[_0xa55c('0x13a')]);}}}catch(_0x2a6c2d){logger[_0xa55c('0x13b')](_0xa55c('0x13c'),util[_0xa55c('0x13d')](_0x2a6c2d,{'showHidden':![],'depth':null}));}};Preview[_0xa55c('0x35')][_0xa55c('0x21')]=function(_0x9b5e3a){if(_0x9b5e3a){if(this[_0xa55c('0x14')][_0x9b5e3a[_0xa55c('0x13e')]]){this[_0xa55c('0x14')][_0x9b5e3a[_0xa55c('0x13e')]][_0xa55c('0x133')]=!![];}}};Preview[_0xa55c('0x35')][_0xa55c('0x23')]=function(_0x5ac4fa){if(_0x5ac4fa){if(this[_0xa55c('0x14')][_0x5ac4fa['transfererlinkedid']]){this[_0xa55c('0x14')][_0x5ac4fa[_0xa55c('0x13f')]][_0xa55c('0x133')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x3e74=['unmonitored','run','execRun','unlock','unlockContact','getContactPreview','isValid','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','Trunk\x20not\x20working\x20correctly','dialActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','originatecalleridname','originatecalleridnum','addVariables','merge','toLowerVariables','starttime','variables','variablesAction','Action','[originated][increment]','OriginateError','syncNewExten','actionid','logLookAgent','YYYY-MM-DD\x20HH:mm:ss','response','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destlinkedid','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','util','uuid','moment','ioredis','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','../dialer/utils','redis','defaults','localhost','tail','sequence','voiceQueues','trunks','actions','clockClearZombieChannels','originateresponse','syncOriginateResponse','syncHangup','bind','hanguprequest','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','sendMessageOneNotActive','originated','paused','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','message','DEACTIVATED','prototype','syncCampaigns','hasOwnProperty','dialMethod','type','outbound','clearZombieChannels','recallMe','clearZombieChannel','queue','pTalking:\x20','pTalking','dialAnswer','pick','contactId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','Agent','voicePause','[RecallMe]','disableContact','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','logger2','[getContactRecallMe]','setMessage','IsNotLoggedIn','isActive','isTrunkReachable','Trunk','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','total','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','BUSY','Busy','dialBusyRetryFrequency','busy','additional','Global','dialBusyMaxRetry','countbusyretry','incrementPreviewCounters','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','queueSummaryCountersUpdated','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Queue','agents','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable'];(function(_0x2cac98,_0x2e14a1){var _0x263940=function(_0x433ea7){while(--_0x433ea7){_0x2cac98['push'](_0x2cac98['shift']());}};_0x263940(++_0x2e14a1);}(_0x3e74,0x175));var _0x43e7=function(_0x53611f,_0x47f50a){_0x53611f=_0x53611f-0x0;var _0x1b1fb7=_0x3e74[_0x53611f];return _0x1b1fb7;};'use strict';var util=require(_0x43e7('0x0'));var _=require('lodash');var uuid=require(_0x43e7('0x1'));var moment=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x43e7('0x4'));var loggerAction=require('../../../config/logger')(_0x43e7('0x5'));var ami=require(_0x43e7('0x6'));var rpcDb=require(_0x43e7('0x7'));var cmHopperAdditionalPhone=require(_0x43e7('0x8'));var Action=require(_0x43e7('0x9'));var ut=require('./util/util');var utils=require(_0x43e7('0xa'));config[_0x43e7('0xb')]=_[_0x43e7('0xc')](config[_0x43e7('0xb')],{'host':_0x43e7('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43e7('0xb')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x39c8bd){this[_0x43e7('0xe')]=this['tail']?this[_0x43e7('0xe')]['finally'](_0x39c8bd):_0x39c8bd();};function Preview(_0xf7c520){this[_0x43e7('0xf')]=new Sequence();this['campaignsPreview']=_0xf7c520[_0x43e7('0x10')];this[_0x43e7('0x11')]=_0xf7c520[_0x43e7('0x11')];this[_0x43e7('0x12')]={};this['agents']=_0xf7c520['agents'];this[_0x43e7('0x13')]=0x0;ami['on'](_0x43e7('0x14'),this[_0x43e7('0x15')]['bind'](this));ami['on']('hangup',this[_0x43e7('0x16')][_0x43e7('0x17')](this));ami['on'](_0x43e7('0x18'),this[_0x43e7('0x19')]['bind'](this));ami['on']('dialend',this[_0x43e7('0x1a')][_0x43e7('0x17')](this));ami['on'](_0x43e7('0x1b'),this['syncNewExten']['bind'](this));ami['on'](_0x43e7('0x1c'),this[_0x43e7('0x1d')][_0x43e7('0x17')](this));ami['on'](_0x43e7('0x1e'),this[_0x43e7('0x1f')][_0x43e7('0x17')](this));ami['on'](_0x43e7('0x20'),this[_0x43e7('0x21')][_0x43e7('0x17')](this));this[_0x43e7('0x22')](this[_0x43e7('0x23')]);}function emit(_0x177ee1,_0x4b5d64,_0xef1a5a){io['to'](_0x177ee1)[_0x43e7('0x24')](_0x4b5d64,_0xef1a5a);}function emitVoiceQueueChannelRemove(_0x4b386b){logger[_0x43e7('0x25')](_0x43e7('0x26'),JSON[_0x43e7('0x27')](_0x4b386b));emit(util[_0x43e7('0x28')](_0x43e7('0x29'),_0x4b386b[_0x43e7('0x2a')]),'voice_queue_channel:remove',_0x4b386b);io[_0x43e7('0x24')]('voice_queue_presence:remove',_0x4b386b);}function notSendMessagesQueue(_0x4c9df3){if(_0x4c9df3[_0x43e7('0x2b')]){if(_0x4c9df3[_0x43e7('0x2c')]===0x0&&_0x4c9df3['pTalking']===0x0){_0x4c9df3[_0x43e7('0x2b')]=![];_0x4c9df3['available']=0x0;_0x4c9df3[_0x43e7('0x2d')]=0x0;_0x4c9df3['message']=utils[_0x43e7('0x2e')][_0x43e7('0x2f')];ut[_0x43e7('0x30')](_0x43e7('0x31'),_0x4c9df3['name']+'\x20is\x20not\x20active');}else{_0x4c9df3[_0x43e7('0x32')]=utils['CAMPAIGN_STATUS'][_0x43e7('0x33')];ut[_0x43e7('0x30')](_0x43e7('0x31'),_0x4c9df3[_0x43e7('0x2a')]+'\x20is\x20deactivated');}}}Preview[_0x43e7('0x34')][_0x43e7('0x22')]=function(){var _0x45b675=this;setInterval(function(){_0x45b675[_0x43e7('0x35')]();},0x7cf);};Preview[_0x43e7('0x34')][_0x43e7('0x35')]=function(){var _0x2b85a5=this[_0x43e7('0x23')];this[_0x43e7('0x13')]+=0x1;for(var _0x35dbcd in _0x2b85a5){if(_0x2b85a5[_0x43e7('0x36')](_0x35dbcd)&&(_0x2b85a5[_0x35dbcd][_0x43e7('0x37')]===_0x43e7('0x4')||_0x2b85a5[_0x35dbcd][_0x43e7('0x37')]==='booked')&&_0x2b85a5[_0x35dbcd][_0x43e7('0x38')]===_0x43e7('0x39')){if(this[_0x43e7('0x13')]>0x7){this[_0x43e7('0x13')]=0x0;this[_0x43e7('0x3a')]();}}if(_0x2b85a5['hasOwnProperty'](_0x35dbcd)&&_0x2b85a5[_0x35dbcd][_0x43e7('0x37')]===_0x43e7('0x4')&&_0x2b85a5[_0x35dbcd][_0x43e7('0x38')]===_0x43e7('0x39')){if(_0x2b85a5[_0x35dbcd]['dialActive']){this['setMessage'](_0x2b85a5[_0x35dbcd]);if(_0x2b85a5[_0x35dbcd]['dialPreviewAutoRecallMe'])this[_0x43e7('0x3b')](_0x2b85a5[_0x35dbcd]);}else{notSendMessagesQueue(_0x2b85a5[_0x35dbcd]);}}}};Preview[_0x43e7('0x34')][_0x43e7('0x3c')]=function(_0x234fe6){var _0x108313=this;this[_0x43e7('0xf')]['enqueue'](function(){if(!_['isNil'](_0x108313['actions'][_0x234fe6])){loggerAction['info']('[clearZombieChannels][talking]',_0x234fe6,'Queue',_0x108313['actions'][_0x234fe6][_0x43e7('0x3d')],'originated:\x20',JSON[_0x43e7('0x27')](_0x108313[_0x43e7('0x23')][_0x108313[_0x43e7('0x12')][_0x234fe6][_0x43e7('0x3d')]][_0x43e7('0x2c')]),_0x43e7('0x3e'),JSON[_0x43e7('0x27')](_0x108313['campaignsPreview'][_0x108313['actions'][_0x234fe6]['queue']][_0x43e7('0x3f')]),JSON[_0x43e7('0x27')](_0x108313[_0x43e7('0x12')][_0x234fe6][_0x43e7('0x40')]),JSON[_0x43e7('0x27')](_[_0x43e7('0x41')](_0x108313[_0x43e7('0x12')][_0x234fe6],[_0x43e7('0x42'),'UserId',_0x43e7('0x43'),_0x43e7('0x44')])));return ami['Action']({'action':_0x43e7('0x45'),'channel':_0x108313['actions'][_0x234fe6][_0x43e7('0x46')]})[_0x43e7('0x47')](function(_0x1c6f45){if(_0x1c6f45[_0x43e7('0x32')]===_0x43e7('0x48')){setTimeout(function(){if(_0x108313[_0x43e7('0x12')][_0x234fe6]){ut['updateOriginated'](_0x108313['campaignsPreview'][_0x108313[_0x43e7('0x12')][_0x234fe6][_0x43e7('0x3d')]],_0x43e7('0x49'));if(_0x108313[_0x43e7('0x12')][_0x234fe6][_0x43e7('0x40')]===!![]){ut['decrementTalkink'](_0x108313[_0x43e7('0x23')][_0x108313[_0x43e7('0x12')][_0x234fe6]['queue']],_0x43e7('0x49'));ut['loggerError'](_0x43e7('0x4a')+_0x234fe6,_0x108313['actions'][_0x234fe6][_0x43e7('0x3d')]);}ut[_0x43e7('0x4b')](_0x43e7('0x4c')+_0x234fe6,_0x108313[_0x43e7('0x12')][_0x234fe6]['queue']);delete _0x108313['actions'][_0x234fe6];}},0x2328);}});}});};Preview[_0x43e7('0x34')][_0x43e7('0x3a')]=function(){var _0xe979b5=this;loggerAction[_0x43e7('0x25')]('[action]',_['size'](this['actions']));for(var _0x35e4fb in this['actions']){if(_0xe979b5[_0x43e7('0x12')]['hasOwnProperty'](_0x35e4fb)){_0xe979b5['clearZombieChannel'](_0x35e4fb);}}};Preview[_0x43e7('0x34')]['recallMe']=function(_0x2de14f){var _0x39db7f=this;rpcDb[_0x43e7('0x4d')](_0x2de14f['id'],ut[_0x43e7('0x4e')](this['agents']))[_0x43e7('0x4f')](function(_0x2b9046){if(!_[_0x43e7('0x50')](_0x2b9046)){for(var _0x1fd277=0x0;_0x1fd277<_0x2b9046[_0x43e7('0x51')];_0x1fd277+=0x1){if(ut[_0x43e7('0x52')](_0x2b9046[_0x1fd277]['scheduledat'])<_0x2de14f['dialRecallMeTimeout']*0x3c){if(_0x2b9046[_0x1fd277][_0x43e7('0x53')]&&!_0x2b9046[_0x1fd277][_0x43e7('0x53')][_0x43e7('0x54')]){_0x39db7f['run'](_0x2b9046[_0x1fd277]['id'])['then'](ut['logger2'](_0x43e7('0x55')))[_0x43e7('0x47')](ut['logger2'](_0x43e7('0x55')));}else{rpcDb[_0x43e7('0x56')](_0x2b9046[_0x1fd277]['id']);}}else{var _0x3c96fe=new Action(_0x2b9046[_0x1fd277],_0x2de14f);_0x3c96fe['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2de14f['outboundReCallsDay']+=0x1;ut[_0x43e7('0x57')](_0x3c96fe,0x17,_0x43e7('0x58'));if(_0x2de14f['dialRecallInQueue']){rpcDb[_0x43e7('0x59')](ut[_0x43e7('0x5a')](_0x2b9046[_0x1fd277]));rpcDb[_0x43e7('0x5b')](_0x3c96fe,_0x43e7('0x5c'));}else{ut['logCustomer'](_0x3c96fe,0x16,_0x43e7('0x5d'));rpcDb['createCustomerHistory'](_0x3c96fe,'[HistoryRecallClose]');rpcDb[_0x43e7('0x5e')](_0x3c96fe,_0x43e7('0x5f'));}}}}})[_0x43e7('0x47')](ut[_0x43e7('0x60')](_0x43e7('0x61')));};Preview[_0x43e7('0x34')][_0x43e7('0x62')]=function(_0x256ddd){_0x256ddd[_0x43e7('0x2b')]=!![];if(ut[_0x43e7('0x63')](_0x256ddd['loggedIn'])){_0x256ddd[_0x43e7('0x32')]=utils[_0x43e7('0x2e')]['NO_AGENTS_LOGGED'];}else if(!ut[_0x43e7('0x64')](_0x256ddd['dialActive'])){_0x256ddd[_0x43e7('0x32')]=utils[_0x43e7('0x2e')][_0x43e7('0x2f')];}else if(!this[_0x43e7('0x65')](_0x256ddd[_0x43e7('0x66')])){if(!this['isTrunkReachable'](_0x256ddd['TrunkBackup'])){_0x256ddd[_0x43e7('0x32')]=utils[_0x43e7('0x2e')][_0x43e7('0x67')];}else{_0x256ddd[_0x43e7('0x32')]=utils[_0x43e7('0x2e')][_0x43e7('0x68')];}}else{_0x256ddd[_0x43e7('0x32')]=utils[_0x43e7('0x2e')][_0x43e7('0x68')];}};Preview[_0x43e7('0x34')][_0x43e7('0x69')]=function(_0x4ace49,_0x1ec35a,_0x2da2f3){var _0x50a3fa=this;var _0x4314d8=this[_0x43e7('0x12')][_0x1ec35a];var _0x2d0052=this['campaignsPreview'][_0x4314d8['queue']];var _0x459c13;var _0x3d9a29=![];var _0x4ebdde=0x2;var _0x283dd8=0x3;if(_0x2d0052){switch(_0x2da2f3){case'1':_0x2d0052['outboundNoSuchCallsDay']+=0x1;_0x4314d8['countnosuchnumberretry']+=0x1;_0x4314d8[_0x43e7('0x6a')]=ut[_0x43e7('0x6b')](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0x0,_0x43e7('0x6c'));ami[_0x43e7('0x24')]('custom:agentnosuchnumber',ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0x6e')));rpcDb['createCustomerHistory'](_0x4314d8,_0x43e7('0x6f'));_0x50a3fa[_0x43e7('0x70')](_0x4314d8,'0',_0x2d0052)[_0x43e7('0x4f')](function(_0x5bb536){_0x3d9a29=_0x5bb536['additional']==0x1;_0x4ebdde=_0x2d0052['dialNoSuchNumberRetryFrequency'];_0x283dd8=_0x2d0052[_0x43e7('0x71')];if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052[_0x43e7('0x72')]){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0xf,'Global');rpcDb['createCustomerFinal'](_0x459c13,_0x43e7('0x74'));}else{if(_0x4314d8[_0x43e7('0x75')]>=_0x2d0052[_0x43e7('0x76')]){rpcDb[_0x43e7('0x5e')](_0x4314d8,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x43e7('0x77')](ut[_0x43e7('0x78')](_0x4314d8,_0x43e7('0x75'),_0x2d0052[_0x43e7('0x79')]),_0x4314d8[_0x43e7('0x7a')],_0x4314d8[_0x43e7('0x7b')]);}}delete this[_0x43e7('0x12')][_0x4ace49[_0x43e7('0x7c')]];}else{_0x4314d8[_0x43e7('0x75')]++;logger[_0x43e7('0x25')](_0x43e7('0x7d'),_0x4314d8['countnosuchnumberretry']);logger['info']('id',_0x4314d8[_0x43e7('0x7e')]);_0x50a3fa['incrementPreviewCounters']({'id':_0x4314d8['idContact'],'field':{'countnosuchnumberretry':_0x4314d8['countnosuchnumberretry']}})[_0x43e7('0x4f')](function(){_0x50a3fa[_0x43e7('0x7f')](_0x4314d8,_0x4ebdde,_0x283dd8)['then'](function(){});});}});break;case _0x43e7('0x80'):var _0x135791=moment()[_0x43e7('0x28')]('YYYY-MM-DD\x20HH:mm:ss');_0x4314d8[_0x43e7('0x81')]=_0x135791;_0x4314d8[_0x43e7('0x82')]=_0x135791;_0x4314d8[_0x43e7('0x40')]=!![];_0x2d0052[_0x43e7('0x3f')]+=0x1;logger[_0x43e7('0x25')](_0x43e7('0x83'),_0x4314d8[_0x43e7('0x84')],'\x20Queue',_0x2d0052[_0x43e7('0x2a')],_0x43e7('0x3e'),_0x2d0052[_0x43e7('0x3f')]);ami['emit']('custom:agentconnect',ut[_0x43e7('0x6d')](_0x4314d8,'connect',this['campaignsPreview'][_0x4314d8[_0x43e7('0x3d')]]));if(_0x2d0052[_0x43e7('0x85')]){ami['emit'](_0x43e7('0x86'),ut[_0x43e7('0x87')](_0x4314d8));}break;case'16':ami[_0x43e7('0x24')](_0x43e7('0x88'),ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0x89'),this[_0x43e7('0x23')][_0x4314d8['queue']]));emitVoiceQueueChannelRemove(ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0x89')));_0x2d0052['outboundAnswerCallsDay']+=0x1;_0x2d0052[_0x43e7('0x8a')]+=0x1;_0x2d0052['answered']+=0x1;ut[_0x43e7('0x8b')](_0x2d0052,_0x43e7('0x8c'));_0x4314d8[_0x43e7('0x6a')]=ut[_0x43e7('0x6b')](_0x4314d8);ut['logCustomer'](_0x4314d8,0x4,_0x43e7('0x8d'));rpcDb[_0x43e7('0x5b')](_0x4314d8,_0x43e7('0x8e'));rpcDb['createCustomerFinal'](_0x4314d8,_0x43e7('0x8f'));rpcDb[_0x43e7('0x90')](_0x4314d8);_0x2d0052[_0x43e7('0x91')]+=_0x4314d8[_0x43e7('0x92')];_0x2d0052[_0x43e7('0x93')]+=_0x4314d8['talktime'];logger[_0x43e7('0x25')](_0x43e7('0x94'),_0x4314d8[_0x43e7('0x84')],_0x43e7('0x95'),_0x2d0052[_0x43e7('0x2a')],_0x43e7('0x3e'),_0x2d0052[_0x43e7('0x3f')]);delete this['actions'][_0x4ace49['linkedid']];break;case _0x43e7('0x96'):_0x2d0052['outboundBusyCallsDay']+=0x1;_0x4314d8['countbusyretry']+=0x1;_0x4314d8['countglobal']=ut[_0x43e7('0x6b')](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0x5,_0x43e7('0x97'));_0x4ebdde=_0x2d0052[_0x43e7('0x98')];_0x283dd8=_0x2d0052[_0x43e7('0x71')];ami[_0x43e7('0x24')]('custom:agentbusy',ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0x99')));rpcDb[_0x43e7('0x5b')](_0x4314d8,'[callProgressDetectingCustomer][logBusy]');_0x50a3fa[_0x43e7('0x70')](_0x4314d8,'5',_0x2d0052)[_0x43e7('0x4f')](function(_0x184ae3){_0x3d9a29=_0x184ae3[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052[_0x43e7('0x72')]){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0xf,_0x43e7('0x9b'));rpcDb['createCustomerFinal'](_0x459c13,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x4314d8['countbusyretry']>=_0x2d0052[_0x43e7('0x9c')]){rpcDb[_0x43e7('0x5e')](_0x4314d8,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x43e7('0x77')](ut[_0x43e7('0x78')](_0x4314d8,_0x43e7('0x9d'),_0x2d0052[_0x43e7('0x98')]),_0x4314d8['unlockAgent'],_0x4314d8['activeContact']);}}}else{_0x4314d8['countbusyretry']++;_0x50a3fa[_0x43e7('0x9e')]({'id':_0x4314d8[_0x43e7('0x7e')],'field':{'countbusyretry':_0x4314d8['countbusyretry']}})['then'](function(){_0x50a3fa[_0x43e7('0x7f')](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});});}});break;case _0x43e7('0x9f'):_0x2d0052['outboundNoAnswerCallsDay']+=0x1;_0x4314d8[_0x43e7('0xa0')]+=0x1;_0x4314d8[_0x43e7('0x6a')]=ut[_0x43e7('0x6b')](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0x3,'NoAnswer');_0x4ebdde=_0x2d0052[_0x43e7('0xa1')];_0x283dd8=_0x2d0052['callAdditionalPhoneAfterMin'];var _0xa66309=ut[_0x43e7('0xa2')](_0x4314d8,_0x2d0052);ami[_0x43e7('0x24')](_0x43e7('0xa3'),_0xa66309);rpcDb[_0x43e7('0x5b')](_0x4314d8,_0x43e7('0xa4'));_0x50a3fa[_0x43e7('0x70')](_0x4314d8,'3',_0x2d0052)['then'](function(_0x109c86){_0x3d9a29=_0x109c86[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052[_0x43e7('0x72')]){_0x459c13=ut['cloneAction'](_0x4314d8,0xf,'Global');rpcDb['createCustomerFinal'](_0x459c13,_0x43e7('0xa5'));}else{if(_0x4314d8['countnoanswerretry']>=_0x2d0052[_0x43e7('0xa6')]){rpcDb[_0x43e7('0x5e')](_0x4314d8,_0x43e7('0xa4'));}else{rpcDb[_0x43e7('0x77')](ut[_0x43e7('0x78')](_0x4314d8,_0x43e7('0xa0'),_0x2d0052[_0x43e7('0xa1')]),_0x4314d8[_0x43e7('0x7a')],_0x4314d8[_0x43e7('0x7b')]);}}}else{_0x4314d8[_0x43e7('0xa0')]++;_0x50a3fa[_0x43e7('0x9e')]({'id':_0x4314d8['idContact'],'field':{'countnoanswerretry':_0x4314d8[_0x43e7('0xa0')]}})[_0x43e7('0x4f')](function(){_0x50a3fa[_0x43e7('0x7f')](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});});}});break;case _0x43e7('0xa7'):_0x2d0052['outboundCongestionCallsDay']+=0x1;_0x4314d8['countcongestionretry']+=0x1;_0x4314d8[_0x43e7('0x6a')]=ut[_0x43e7('0x6b')](_0x4314d8);ut['logCustomer'](_0x4314d8,0x8,_0x43e7('0xa8'));_0x4ebdde=_0x2d0052[_0x43e7('0xa9')];_0x283dd8=_0x2d0052['callAdditionalPhoneAfterMin'];ami['emit'](_0x43e7('0xaa'),ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0xab')));rpcDb[_0x43e7('0x5b')](_0x4314d8,_0x43e7('0xac'));_0x50a3fa['verifyAdditionalPhones'](_0x4314d8,'8',_0x2d0052)['then'](function(_0x403276){_0x3d9a29=_0x403276[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052[_0x43e7('0x72')]){_0x459c13=ut['cloneAction'](_0x4314d8,0xf,_0x43e7('0x9b'));rpcDb[_0x43e7('0x5e')](_0x459c13,_0x43e7('0xad'));}else{if(_0x4314d8[_0x43e7('0xae')]>=_0x2d0052['dialCongestionMaxRetry']){rpcDb[_0x43e7('0x5e')](_0x4314d8,_0x43e7('0xac'));}else{rpcDb[_0x43e7('0x77')](ut[_0x43e7('0x78')](_0x4314d8,_0x43e7('0xae'),_0x2d0052['dialBusyRetryFrequency']),_0x4314d8[_0x43e7('0x7a')],_0x4314d8[_0x43e7('0x7b')]);}}}else{_0x4314d8['countcongestionretry']++;_0x50a3fa[_0x43e7('0x9e')]({'id':_0x4314d8[_0x43e7('0x7e')],'field':{'countcongestionretry':_0x4314d8[_0x43e7('0xae')]}})[_0x43e7('0x4f')](function(){_0x50a3fa['swapAdditionalPhones'](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});});}});break;case'CANCEL':_0x2d0052[_0x43e7('0xaf')]+=0x1;_0x4314d8[_0x43e7('0xb0')]+=0x1;_0x4314d8[_0x43e7('0x6a')]=ut[_0x43e7('0x6b')](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0x14,_0x43e7('0xb1'));_0x4ebdde=_0x2d0052[_0x43e7('0xb2')];_0x283dd8=_0x2d0052[_0x43e7('0x71')];ami[_0x43e7('0x24')]('custom:agentreject',ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0xb3')));rpcDb[_0x43e7('0x5b')](_0x4314d8,_0x43e7('0xb4'));_0x50a3fa['verifyAdditionalPhones'](_0x4314d8,'20',_0x2d0052)['then'](function(_0x2c5bf9){_0x3d9a29=_0x2c5bf9[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052['dialGlobalMaxRetry']){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x459c13,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x4314d8[_0x43e7('0xb0')]>=_0x2d0052['dialAgentRejectMaxRetry']){rpcDb[_0x43e7('0x5e')](_0x4314d8,_0x43e7('0xb5'));}else{rpcDb[_0x43e7('0x77')](ut[_0x43e7('0x78')](_0x4314d8,_0x43e7('0xb0'),_0x2d0052['dialAgentRejectRetryFrequency']),_0x4314d8['unlockAgent'],_0x4314d8[_0x43e7('0x7b')]);}}}else{_0x4314d8[_0x43e7('0xa0')]++;_0x50a3fa['incrementPreviewCounters']({'id':_0x4314d8[_0x43e7('0x7e')],'field':{'countnoanswerretry':_0x4314d8[_0x43e7('0xa0')]}})[_0x43e7('0x4f')](function(){_0x50a3fa[_0x43e7('0x7f')](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});});}});break;case _0x43e7('0xb6'):_0x2d0052[_0x43e7('0xb7')]+=0x1;_0x4314d8[_0x43e7('0xb8')]+=0x1;_0x4314d8[_0x43e7('0x6a')]=ut[_0x43e7('0x6b')](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0xb,_0x43e7('0xb9'));rpcDb[_0x43e7('0x5b')](_0x4314d8,_0x43e7('0xba'));_0x50a3fa[_0x43e7('0x70')](_0x4314d8,'11',_0x2d0052)[_0x43e7('0x4f')](function(_0x3286b1){_0x3d9a29=_0x3286b1[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052[_0x43e7('0x72')]){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0xf,_0x43e7('0x9b'));rpcDb['createCustomerFinal'](_0x459c13,_0x43e7('0xba'));}else{if(_0x4314d8[_0x43e7('0xbb')]>=_0x2d0052[_0x43e7('0xbc')]){rpcDb[_0x43e7('0x5e')](_0x4314d8,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x43e7('0x77')](ut['scheduledAt'](_0x4314d8,_0x43e7('0xb8'),_0x2d0052[_0x43e7('0xbd')]),_0x4314d8[_0x43e7('0x7a')],_0x4314d8[_0x43e7('0x7b')]);}}}else{_0x4314d8[_0x43e7('0xa0')]++;_0x50a3fa[_0x43e7('0x9e')]({'id':_0x4314d8['idContact'],'field':{'countnoanswerretry':_0x4314d8[_0x43e7('0xa0')]}})[_0x43e7('0x4f')](function(){_0x50a3fa[_0x43e7('0x7f')](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});});}});break;case'18':_0x2d0052[_0x43e7('0xbe')]+=0x1;_0x4314d8['countmachineretry']+=0x1;_0x4314d8['countglobal']=ut[_0x43e7('0x6b')](_0x4314d8);ut['logCustomer'](_0x4314d8,0x12,_0x4ace49[_0x43e7('0xbf')]||_0x4ace49[_0x43e7('0xc0')]);ami[_0x43e7('0x24')](_0x43e7('0xc1'),ut['buildObj'](_0x4314d8,'amd'));rpcDb['createCustomerHistory'](_0x4314d8,_0x43e7('0xc2'));_0x50a3fa['verifyAdditionalPhones'](_0x4314d8,'18',_0x2d0052)['then'](function(_0x4d7f0f){_0x3d9a29=_0x4d7f0f[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052['dialGlobalMaxRetry']){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0x12,'Global');rpcDb[_0x43e7('0x5e')](_0x459c13,_0x43e7('0xc2'));}else{rpcDb[_0x43e7('0x5e')](_0x4314d8,_0x43e7('0xc2'));}}else{_0x4314d8[_0x43e7('0xa0')]++;_0x50a3fa['incrementPreviewCounters']({'id':_0x4314d8[_0x43e7('0x7e')],'field':{'countnoanswerretry':_0x4314d8[_0x43e7('0xa0')]}})[_0x43e7('0x4f')](function(){_0x50a3fa['swapAdditionalPhones'](_0x4314d8,_0x4ebdde,_0x283dd8)['then'](function(){});});}});delete this[_0x43e7('0x12')][_0x4ace49[_0x43e7('0x7c')]];break;case'19':_0x2d0052[_0x43e7('0xbe')]+=0x1;_0x4314d8[_0x43e7('0x6a')]=ut['totalGlobal'](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0x13,_0x4ace49[_0x43e7('0xbf')]||_0x4ace49[_0x43e7('0xc0')]);ami['emit'](_0x43e7('0xc1'),ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0xc3')));rpcDb[_0x43e7('0x5b')](_0x4314d8,'[callProgressDetectingCustomer][machine]');_0x50a3fa[_0x43e7('0x70')](_0x4314d8,'18',_0x2d0052)['then'](function(_0x299086){_0x3d9a29=_0x299086[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut['totalGlobal'](_0x4314d8)>=_0x2d0052['dialGlobalMaxRetry']){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0xf,_0x43e7('0x9b'));rpcDb[_0x43e7('0x5e')](_0x459c13,_0x43e7('0xc4'));}else{rpcDb[_0x43e7('0x5e')](_0x4314d8,_0x43e7('0xc4'));}}else{_0x4314d8[_0x43e7('0xa0')]++;_0x50a3fa[_0x43e7('0x9e')]({'id':_0x4314d8[_0x43e7('0x7e')],'field':{'countnoanswerretry':_0x4314d8[_0x43e7('0xa0')]}})[_0x43e7('0x4f')](function(){_0x50a3fa['swapAdditionalPhones'](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});});}});delete this['actions'][_0x4ace49[_0x43e7('0x7c')]];break;default:if(_0x4314d8[_0x43e7('0x40')]){ut[_0x43e7('0x8b')](_0x2d0052,'[default]');ut[_0x43e7('0x4b')](_0x43e7('0xc5')+_0x2d0052[_0x43e7('0x2a')],_0x4ace49);}_0x2d0052[_0x43e7('0xbe')]+=0x1;_0x4314d8['countglobal']=ut[_0x43e7('0x6b')](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0xc,_0x4ace49['cause-txt']||_0x4ace49['dialstatus']);_0x4ebdde=_0x2d0052['dialAgentRejectRetryFrequency'];_0x283dd8=_0x2d0052[_0x43e7('0x71')];rpcDb[_0x43e7('0x5b')](_0x4314d8,_0x43e7('0xc6'));_0x50a3fa[_0x43e7('0x70')](_0x4314d8,'20',_0x2d0052)[_0x43e7('0x4f')](function(_0x40019e){_0x3d9a29=_0x40019e[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052['dialGlobalMaxRetry']){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0xf,_0x43e7('0x9b'));rpcDb[_0x43e7('0x5e')](_0x459c13,_0x43e7('0xc7'));}else{rpcDb['createCustomerFinal'](_0x4314d8,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x43e7('0x12')][_0x4ace49[_0x43e7('0x7c')]];}else{_0x50a3fa[_0x43e7('0x7f')](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});}});}if(!(_0x4314d8['dialAnswer']&&_0x2da2f3==='16')){ut[_0x43e7('0xc8')](_0x2d0052,_0x43e7('0xc9'));logger[_0x43e7('0x25')](_0x43e7('0xca'),_0x4314d8[_0x43e7('0x84')],_0x43e7('0x95'),_0x2d0052['name'],_0x43e7('0xcb'),_0x2d0052['originated']);}if(_0x2da2f3!=='ANSWER'){delete this[_0x43e7('0x12')][_0x4ace49[_0x43e7('0x7c')]];delete this['actions'][_0x4ace49['destlinkedid']];}_0x2d0052[_0x43e7('0xcc')]=!![];}};Preview[_0x43e7('0x34')]['callProgressDetectingAgent']=function(_0x189c38,_0x156a3c,_0x302138){if(_[_0x43e7('0xcd')](_0x156a3c)&&'object'!==typeof _0x156a3c){return;}if(_['isUndefined'](_0x302138)&&_0x43e7('0xce')!==typeof _0x302138){return;}switch(_0x302138[_0x43e7('0xcf')]){case'0':ut[_0x43e7('0xd0')](_0x189c38,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x189c38,_0x43e7('0xd1'));break;case'3':ut[_0x43e7('0xd0')](_0x189c38,0x3,_0x43e7('0xd2'));rpcDb[_0x43e7('0xd3')](_0x189c38,_0x43e7('0xd4'));break;case'5':ut[_0x43e7('0xd0')](_0x189c38,0x5,_0x43e7('0x97'));rpcDb[_0x43e7('0xd3')](_0x189c38,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x189c38,0x8,'Congestion');rpcDb[_0x43e7('0xd3')](_0x189c38,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x43e7('0xd0')](_0x189c38,0x16,_0x43e7('0xd5'));rpcDb[_0x43e7('0xd3')](_0x189c38,_0x43e7('0xd6'));break;default:ut[_0x43e7('0xd0')](_0x189c38,0xc,_0x302138['reason']);rpcDb[_0x43e7('0xd3')](_0x189c38,_0x43e7('0xd7'));}ut[_0x43e7('0xc8')](_0x156a3c,_0x43e7('0xd8'));logger['info'](_0x43e7('0xd9'),_0x189c38[_0x43e7('0x84')],_0x43e7('0x95'),_0x156a3c[_0x43e7('0x2a')],_0x43e7('0xcb'),_0x156a3c[_0x43e7('0x2c')]);delete this[_0x43e7('0x12')][_0x189c38['uniqueid']];};Preview[_0x43e7('0x34')][_0x43e7('0x70')]=function(_0x20fab2,_0x3637d9,_0x3c52d3){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x20fab2,_0x3637d9,_0x3c52d3)[_0x43e7('0x47')](logger[_0x43e7('0x25')]('[verifyAdditionalPhone]\x20'));};Preview[_0x43e7('0x34')][_0x43e7('0x7f')]=function(_0x577ac6,_0x235418,_0x368c57){return cmHopperAdditionalPhone[_0x43e7('0x7f')](_0x577ac6,_0x235418,_0x368c57)[_0x43e7('0x47')](logger[_0x43e7('0x25')]('[swapAdditionalPhone]\x20'));};Preview[_0x43e7('0x34')][_0x43e7('0x9e')]=function(_0x1e5d48){return Promise['resolve']()[_0x43e7('0x4f')](cmHopperAdditionalPhone[_0x43e7('0x9e')](_0x1e5d48))['catch'](logger[_0x43e7('0x25')](_0x43e7('0xda')));};Preview[_0x43e7('0x34')][_0x43e7('0xdb')]=function(_0x15b04a,_0x3b5f39,_0x4d5736,_0xcbdb35,_0xa5981f){var _0x19ddfa=this;return new Promise(function(_0x4a4031,_0x5a7f2e){if(_[_0x43e7('0x50')](_0x3b5f39)||_[_0x43e7('0x50')](_0x3b5f39[_0x43e7('0xdc')])||_[_0x43e7('0x50')](_0x3b5f39[_0x43e7('0xdd')])||_[_0x43e7('0x50')](_0x3b5f39[_0x43e7('0x43')])){_0x5a7f2e(ut[_0x43e7('0x32')]('Contact\x20is\x20undefined',_0xcbdb35,_0xa5981f));return;}var _0x723c7=uuid['v4']();var _0xfbdb90=_0x19ddfa[_0x43e7('0x23')][_0x3b5f39[_0x43e7('0xde')][_0x43e7('0x2a')]];var _0x114e00=_0x4d5736?_0x19ddfa[_0x43e7('0xdf')][_0x4d5736]['id']:undefined;_0x19ddfa[_0x43e7('0x12')][_0x723c7]=new Action(_0x3b5f39,_0xfbdb90,_0x723c7,_0x4d5736,_0x114e00);var _0x51e17c=_0x19ddfa[_0x43e7('0x12')][_0x723c7];_0x51e17c[_0x43e7('0x7a')]=_0xcbdb35;_0x51e17c[_0x43e7('0x7b')]=_0xa5981f;_0x51e17c[_0x43e7('0xe0')]=_0x4d5736;if(_[_0x43e7('0xe1')](_0x15b04a)){_0x19ddfa['execCall'](_0x51e17c,_0xfbdb90,_0x3b5f39,_0x4d5736)[_0x43e7('0x4f')](function(_0x186e57){logger[_0x43e7('0x25')](_0x43e7('0xe2'),_0x43e7('0xe3')+_0x51e17c['queue']+_0x43e7('0xe4')+_0x51e17c['idContact'],JSON[_0x43e7('0x27')](_0x186e57));ami[_0x43e7('0x24')](_0x43e7('0xe5'),ut[_0x43e7('0x6d')](_0x51e17c,'called',_0x19ddfa[_0x43e7('0x23')][_0x51e17c[_0x43e7('0x3d')]]));_0x4a4031(ut[_0x43e7('0x32')](_0x43e7('0xe6')));})[_0x43e7('0x47')](function(_0x27bbd6){ut[_0x43e7('0x30')](_0x43e7('0xe7'),_0x27bbd6);_0x5a7f2e(ut[_0x43e7('0x32')](_0x43e7('0xe8'),_0xcbdb35,_0xa5981f));});}else{_0xfbdb90[_0x43e7('0xe9')]+=0x1;ut['logBlacklist'](_0x51e17c);rpcDb['createHistory'](_0x51e17c,_0x43e7('0xea'));delete _0x19ddfa['actions'][_0x723c7];_0x5a7f2e(ut['message'](_0x43e7('0xeb'),_0xcbdb35,_0xa5981f));}});};Preview[_0x43e7('0x34')]['isTrunkReachable']=function(_0x143be2){return!_['isNil'](_0x143be2)&&!_['isNil'](_0x143be2['name'])&&!_[_0x43e7('0x50')](_0x143be2[_0x43e7('0xec')])&&_0x143be2[_0x43e7('0xec')]&&!_[_0x43e7('0x50')](this[_0x43e7('0x11')][util[_0x43e7('0x28')](_0x43e7('0xed'),_0x143be2[_0x43e7('0x2a')])])&&!_[_0x43e7('0x50')](this[_0x43e7('0x11')][util[_0x43e7('0x28')](_0x43e7('0xed'),_0x143be2[_0x43e7('0x2a')])][_0x43e7('0x45')])&&(this[_0x43e7('0x11')][util[_0x43e7('0x28')](_0x43e7('0xed'),_0x143be2[_0x43e7('0x2a')])][_0x43e7('0x45')]===_0x43e7('0xee')||this['trunks'][util[_0x43e7('0x28')](_0x43e7('0xed'),_0x143be2['name'])][_0x43e7('0x45')]===_0x43e7('0xef'));};Preview[_0x43e7('0x34')][_0x43e7('0xf0')]=function(_0x49441c,_0x31797a){return this[_0x43e7('0xf1')](_0x49441c,_0x31797a)['then'](function(_0x43500a){return _[_0x43e7('0x41')](_0x43500a,[_0x43e7('0x32')]);})['catch'](function(_0x22b824){if(_0x22b824[_0x43e7('0xf2')]){rpcDb[_0x43e7('0xf3')](_0x49441c);}if(_0x22b824[_0x43e7('0xec')]){rpcDb[_0x43e7('0x56')](_0x49441c);}throw _['pick'](_0x22b824,[_0x43e7('0x32')]);});};Preview[_0x43e7('0x34')]['execRun']=function(_0x1d31f5,_0x47b03b){var _0x4bf8ad=this;var _0x55baca,_0x5486a6;return rpcDb[_0x43e7('0xf4')](_0x1d31f5)[_0x43e7('0x4f')](function(_0x7f518f){if(!_[_0x43e7('0x50')](_0x7f518f[0x0])){_0x5486a6=_0x7f518f[0x0]['recallme']?![]:!![];_0x55baca=_0x7f518f[0x0]['recallme']?!![]:![];_0x55baca=_0x47b03b?!![]:_0x55baca;}var _0x267b26=_0x4bf8ad['validateContact'](_0x7f518f);if(_0x267b26[_0x43e7('0xf5')]){rpcDb['checkIsBlackList'](_[_0x43e7('0x41')](_0x7f518f[0x0],['VoiceQueueId','phone']))['then'](function(_0x5653b0){_0x4bf8ad[_0x43e7('0xdb')](_0x5653b0,_0x7f518f[0x0],_0x47b03b,_0x5486a6,_0x55baca)[_0x43e7('0x4f')](function(_0x574658){return _0x574658;})['catch'](function(_0x466aa7){throw _0x466aa7;});})[_0x43e7('0x47')](function(_0x517289){ut['logger'](_0x43e7('0xf6'),_0x517289);throw ut[_0x43e7('0x32')](_0x43e7('0xf7'),_0x5486a6,_0x55baca);});}else{throw ut[_0x43e7('0x32')](_0x267b26['message'],_0x5486a6,_0x55baca);}})[_0x43e7('0x47')](function(_0x536b7d){ut[_0x43e7('0x30')](_0x43e7('0xf8'),_0x536b7d);throw ut[_0x43e7('0x32')](_0x43e7('0xf7'),![],!![]);});};Preview[_0x43e7('0x34')][_0x43e7('0xf9')]=function(_0x2cbbda){if(_['isNil'](_0x2cbbda)||_[_0x43e7('0xe1')](_0x2cbbda)||!_[_0x43e7('0x50')](_0x2cbbda[0x0]['Agent'])&&_[_0x43e7('0x50')](_0x2cbbda[0x0][_0x43e7('0x53')][_0x43e7('0x2a')])){ut[_0x43e7('0x30')](_0x43e7('0xfa'),_0x2cbbda);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x3fd573=this['campaignsPreview'][_0x2cbbda[0x0][_0x43e7('0xde')]['name']];_0x3fd573[_0x43e7('0x32')]=utils[_0x43e7('0x2e')][_0x43e7('0x68')];if(_[_0x43e7('0x50')](_0x3fd573)){ut[_0x43e7('0x30')]('[Preview][validateContact][Empty\x20Campaign]',_0x3fd573);return{'isValid':![],'message':_0x43e7('0xfb')};}if(!this['isTrunkReachable'](_0x3fd573[_0x43e7('0x66')])){ut[_0x43e7('0x30')](_0x43e7('0xfc'),'campaign\x20Name:\x20'+_0x3fd573[_0x43e7('0x2a')]+_0x43e7('0xfd'));if(!this[_0x43e7('0x65')](_0x3fd573[_0x43e7('0xfe')])){ut[_0x43e7('0x30')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x3fd573[_0x43e7('0x2a')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x43e7('0xff')};}}if(!ut[_0x43e7('0x64')](_0x3fd573[_0x43e7('0x100')])){ut[_0x43e7('0x30')](_0x43e7('0x101'),_0x3fd573[_0x43e7('0x2a')]+_0x43e7('0x102'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x3fd573[_0x43e7('0x2a')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x43e7('0x103')};};Preview[_0x43e7('0x34')][_0x43e7('0x104')]=function(_0xbc6e18,_0x16c757,_0xf9178f,_0x3bb7ab){var _0x2be8c7=this;return new Promise(function(_0x2bb14d,_0x57f7ea){var _0x240478=_0xbc6e18['uniqueid'];var _0x2b7b33=_0x2be8c7[_0x43e7('0x65')](_0x16c757['Trunk'])?util[_0x43e7('0x28')](_0x43e7('0x105'),_0x16c757['Trunk'][_0x43e7('0x2a')],_[_0x43e7('0x50')](_0x16c757[_0x43e7('0x106')])?'':_0x16c757[_0x43e7('0x106')][_0x43e7('0x107')]()||'',_0x16c757[_0x43e7('0x108')]>0x0?_0xf9178f[_0x43e7('0xdd')][_0x43e7('0x109')](_0x16c757['dialCutDigit']):_0xf9178f[_0x43e7('0xdd')]):util[_0x43e7('0x28')](_0x43e7('0x105'),_['isNil'](_0x16c757[_0x43e7('0xfe')])?_0x16c757[_0x43e7('0x66')]['name']:_0x16c757[_0x43e7('0xfe')][_0x43e7('0x2a')],_['isNil'](_0x16c757[_0x43e7('0x106')])?'':_0x16c757[_0x43e7('0x106')][_0x43e7('0x107')]()||'',_0x16c757['dialCutDigit']>0x0?_0xf9178f[_0x43e7('0xdd')][_0x43e7('0x109')](_0x16c757['dialCutDigit']):_0xf9178f[_0x43e7('0xdd')]);var _0x2ed5e0=_0x2be8c7[_0x43e7('0x65')](_0x16c757[_0x43e7('0x66')])?ut['getCallerId'](_0x16c757['Trunk'][_0x43e7('0x10a')],_0x16c757[_0x43e7('0x10b')],_0x16c757[_0x43e7('0x10c')]>0x0?ut[_0x43e7('0x10d')](_0x16c757['dialOriginateCallerIdNumber'],_0x16c757[_0x43e7('0x10c')]):_0x16c757[_0x43e7('0x10e')]):ut[_0x43e7('0x10f')](_[_0x43e7('0x50')](_0x16c757['TrunkBackup'])?_0x16c757[_0x43e7('0x66')][_0x43e7('0x10a')]:_0x16c757[_0x43e7('0xfe')][_0x43e7('0x10a')],_0x16c757[_0x43e7('0x10b')],_0x16c757['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x16c757['dialOriginateCallerIdNumber'],_0x16c757[_0x43e7('0x10c')]):_0x16c757[_0x43e7('0x10e')]);if(_0x2ed5e0){_0xbc6e18[_0x43e7('0x110')]=ut['extractCalleridName'](_0x2ed5e0);_0xbc6e18[_0x43e7('0x111')]=ut['extractCalleridNumber'](_0x2ed5e0);}var _0x1c7f6a=ut[_0x43e7('0x112')](_0x16c757,_0xf9178f,_0x2b7b33,_0x2ed5e0,_0x240478,_0xbc6e18);_[_0x43e7('0x113')](_0xbc6e18,ut[_0x43e7('0x114')](_0x1c7f6a));_0xbc6e18[_0x43e7('0x115')]=moment()[_0x43e7('0x28')]('YYYY-MM-DD\x20HH:mm:ss');_0x16c757[_0x43e7('0x116')]=_0x1c7f6a;var _0x202421=ut[_0x43e7('0x117')](_0xbc6e18,_0x16c757,_0x1c7f6a,_0xbc6e18[_0x43e7('0x7b')],_0x3bb7ab);return ami[_0x43e7('0x118')](_0x202421)[_0x43e7('0x4f')](function(_0x4637f6){_0x16c757[_0x43e7('0x2c')]+=0x1;logger[_0x43e7('0x25')](_0x43e7('0x119'),_0x240478,_0x43e7('0x95'),_0x16c757[_0x43e7('0x2a')],_0x43e7('0xcb'),_0x16c757['originated']);_0x2bb14d(_0x4637f6);})[_0x43e7('0x47')](function(_0x24d6e4){ut['logAgent'](_0xbc6e18,0xe,_0x43e7('0x11a'));rpcDb[_0x43e7('0xd3')](_0xbc6e18,'[originateFailure][logOriginateFailure]');_0x57f7ea(_0x24d6e4);});});};Preview[_0x43e7('0x34')][_0x43e7('0x11b')]=function(_0x2b9cf9){if(this['actions'][_0x2b9cf9['linkedid']]){this[_0x43e7('0x12')][_0x2b9cf9[_0x43e7('0x7c')]][_0x43e7('0x46')]=_0x2b9cf9[_0x43e7('0x46')];}};Preview[_0x43e7('0x34')][_0x43e7('0x15')]=function(_0x25b5a2){var _0xfe77ea=this;var _0x5d2cb0=this[_0x43e7('0x12')][_0x25b5a2[_0x43e7('0x11c')]];if(_0x5d2cb0){if(_0x5d2cb0[_0x43e7('0xe0')]&&this[_0x43e7('0xdf')][_0x5d2cb0[_0x43e7('0xe0')]]){ut[_0x43e7('0x11d')](_0x5d2cb0,this[_0x43e7('0xdf')][_0x5d2cb0[_0x43e7('0xe0')]][_0x43e7('0x2a')],this[_0x43e7('0xdf')][_0x5d2cb0[_0x43e7('0xe0')]]['id']);}var _0x218743=_['clone'](_0x5d2cb0);_0x218743[_0x43e7('0x81')]=moment()[_0x43e7('0x28')](_0x43e7('0x11e'));var _0x21c8b9=_0xfe77ea[_0x43e7('0x23')][_0x5d2cb0[_0x43e7('0x3d')]];if(ut['isFailure'](_0x25b5a2[_0x43e7('0x11f')])){if(_0x5d2cb0['unlockAgent']){rpcDb[_0x43e7('0xf3')](_0x5d2cb0[_0x43e7('0x7e')]);}if(_0x5d2cb0[_0x43e7('0x7b')]){rpcDb['disableContact'](_0x5d2cb0[_0x43e7('0x7e')]);}ami[_0x43e7('0x24')]('custom:agentringnoanswer',ut[_0x43e7('0x6d')](_0x5d2cb0,'rejected',this[_0x43e7('0x23')][_0x5d2cb0[_0x43e7('0x3d')]]));this[_0x43e7('0x120')](_0x218743,_0x21c8b9,_0x25b5a2);}else{_0x5d2cb0[_0x43e7('0x115')]=moment()['format'](_0x43e7('0x11e'));ut[_0x43e7('0xd0')](_0x218743,0x4,_0x43e7('0x8d'));rpcDb['createAgentHistory'](_0x218743,_0x43e7('0x121'));}}};Preview[_0x43e7('0x34')][_0x43e7('0x16')]=function(_0x431345){var _0x77c2f=this[_0x43e7('0x12')][_0x431345['linkedid']];var _0x3f057e;if(_0x77c2f){_0x3f057e=this['campaignsPreview'][_0x77c2f[_0x43e7('0x3d')]];logger[_0x43e7('0x25')]('[syncHangup][talking]',_0x431345[_0x43e7('0x7c')],_0x43e7('0x95'),_0x3f057e['name'],_0x43e7('0x3e'),_0x3f057e[_0x43e7('0x3f')]);}if(this[_0x43e7('0x12')][_0x431345[_0x43e7('0x7c')]]&&_0x431345['linkedid']!==_0x431345['uniqueid']){if(_0x431345[_0x43e7('0x122')]==='16'&&this[_0x43e7('0x12')][_0x431345[_0x43e7('0x7c')]][_0x43e7('0x40')]){this[_0x43e7('0x69')](_0x431345,_0x431345[_0x43e7('0x7c')],_0x431345[_0x43e7('0x122')]);}else if(this[_0x43e7('0x12')][_0x431345['linkedid']][_0x43e7('0x40')]){logger[_0x43e7('0x25')]('[syncHangup][talking][cause]',_0x431345[_0x43e7('0x7c')],_0x431345[_0x43e7('0x122')],_0x43e7('0x95'),_0x3f057e[_0x43e7('0x2a')],_0x43e7('0x3e'),_0x3f057e[_0x43e7('0x3f')]);this[_0x43e7('0x69')](_0x431345,_0x431345['linkedid'],_0x431345[_0x43e7('0x122')]);}}else if(_0x77c2f&&_['isNil'](_0x77c2f[_0x43e7('0x123')])&&_0x3f057e[_0x43e7('0x124')]&&_0x431345['linkedid']===_0x431345[_0x43e7('0x84')]&&_['isNil'](_0x431345[_0x43e7('0xcf')])&&_0x431345[_0x43e7('0x122')]==='16'&&_0x431345[_0x43e7('0x125')]==='6'&&_['isUndefined'](_0x77c2f['transfer'])){if(_0x77c2f[_0x43e7('0x7a')]){rpcDb[_0x43e7('0xf3')](_0x77c2f['idContact']);}if(_0x77c2f[_0x43e7('0x7b')]){rpcDb[_0x43e7('0x56')](_0x77c2f[_0x43e7('0x7e')]);}_0x431345['reason']='22';this[_0x43e7('0x120')](_0x77c2f,_0x3f057e,_0x431345);}else if(_0x77c2f&&_0x77c2f[_0x43e7('0x126')]){if(_0x431345[_0x43e7('0x122')]==='16'&&this['actions'][_0x431345[_0x43e7('0x7c')]][_0x43e7('0x40')]){logger[_0x43e7('0x25')](_0x43e7('0x127'),_0x431345[_0x43e7('0x7c')],_0x431345[_0x43e7('0x122')],'\x20Queue',_0x3f057e[_0x43e7('0x2a')],_0x43e7('0x3e'),_0x3f057e[_0x43e7('0x3f')]);this[_0x43e7('0x69')](_0x431345,_0x431345[_0x43e7('0x7c')],_0x431345[_0x43e7('0x122')]);}else if(this[_0x43e7('0x12')][_0x431345[_0x43e7('0x7c')]][_0x43e7('0x40')]){logger[_0x43e7('0x25')](_0x43e7('0x128'),_0x431345[_0x43e7('0x7c')],_0x431345['cause'],'\x20Queue',_0x3f057e['name'],'pTalking:\x20',_0x3f057e[_0x43e7('0x3f')]);this[_0x43e7('0x69')](_0x431345,_0x431345[_0x43e7('0x7c')],_0x431345[_0x43e7('0x122')]);}}};Preview[_0x43e7('0x34')][_0x43e7('0x1a')]=function(_0x51dc07){if(this['actions'][_0x51dc07[_0x43e7('0x129')]]&&_0x51dc07[_0x43e7('0x129')]!==_0x51dc07['destuniqueid']){this['callProgressDetectingCustomer'](_0x51dc07,_0x51dc07[_0x43e7('0x129')],_0x51dc07[_0x43e7('0xc0')]);}};Preview['prototype'][_0x43e7('0x19')]=function(_0x57bcab){if(this['actions'][_0x57bcab[_0x43e7('0x7c')]]&&_0x57bcab[_0x43e7('0x7c')]!==_0x57bcab['uniqueid']&&!this['actions'][_0x57bcab[_0x43e7('0x7c')]][_0x43e7('0x40')]){if(_0x57bcab[_0x43e7('0x122')]==='1'){this[_0x43e7('0x69')](_0x57bcab,_0x57bcab['linkedid'],_0x57bcab[_0x43e7('0x122')]);}}};Preview[_0x43e7('0x34')]['addVariable']=function(_0x560373,_0x4cdb87,_0x4eaf92){if(this[_0x43e7('0x12')][_0x560373]){if(_[_0x43e7('0x50')](this['actions'][_0x560373]['variables'])){this[_0x43e7('0x12')][_0x560373][_0x43e7('0x116')]={};}this[_0x43e7('0x12')][_0x560373][_0x43e7('0x116')][_0x4cdb87]=_0x4eaf92;}};Preview[_0x43e7('0x34')]['syncVarSet']=function(_0x3836e7){try{if(!_[_0x43e7('0x50')](_0x3836e7)){if(ut[_0x43e7('0x12a')](_[_0x43e7('0x12b')](_0x3836e7[_0x43e7('0x12c')])[0x0])){this['addVariable'](_0x3836e7[_0x43e7('0x84')],_[_0x43e7('0x12b')](_0x3836e7[_0x43e7('0x12c')])[0x0],_0x3836e7[_0x43e7('0x12d')]);}}}catch(_0x5564b4){logger[_0x43e7('0x12e')](_0x43e7('0x12f'),util[_0x43e7('0x130')](_0x5564b4,{'showHidden':![],'depth':null}));}};Preview[_0x43e7('0x34')][_0x43e7('0x1f')]=function(_0x308403){if(_0x308403){if(this['actions'][_0x308403[_0x43e7('0x131')]]){this[_0x43e7('0x12')][_0x308403[_0x43e7('0x131')]][_0x43e7('0x126')]=!![];}}};Preview['prototype'][_0x43e7('0x21')]=function(_0x48c784){if(_0x48c784){if(this[_0x43e7('0x12')][_0x48c784['transfererlinkedid']]){this[_0x43e7('0x12')][_0x48c784['transfererlinkedid']][_0x43e7('0x126')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 238167c..a0b56d2 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 _0x84a1=['type','uniqueid','calleridnum','queue','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','exten','holdtime','assigned','membername','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','createHistory','catch','[createHistory]\x20','resolve','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','then','[getContactPreview]\x20','createAgentHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue'];(function(_0x3b0586,_0x4d1836){var _0x27bf73=function(_0xb43383){while(--_0xb43383){_0x3b0586['push'](_0x3b0586['shift']());}};_0x27bf73(++_0x4d1836);}(_0x84a1,0x1f4));var _0x184a=function(_0x73ef55,_0x292f45){_0x73ef55=_0x73ef55-0x0;var _0x20c009=_0x84a1[_0x73ef55];return _0x20c009;};'use strict';var util=require(_0x184a('0x0'));var BPromise=require(_0x184a('0x1'));var logger=require(_0x184a('0x2'))(_0x184a('0x3'));var cmHopper=require(_0x184a('0x4'));var cmHopperHistory=require(_0x184a('0x5'));var cmHopperBlack=require(_0x184a('0x6'));var agentReportPreview=require(_0x184a('0x7'));var voiceQueueReport=require(_0x184a('0x8'));function loggerCatch(_0x4357dc){return function(_0x2ef090){logger[_0x184a('0x9')](_0x4357dc,util['inspect'](_0x2ef090,{'showHidden':![],'depth':null}));};}function create(_0x167c5b){return cmHopperHistory[_0x184a('0xa')](_0x167c5b)[_0x184a('0xb')](loggerCatch(_0x184a('0xc')));}function createAgent(_0x259903){return BPromise[_0x184a('0xd')]()['then'](agentReportPreview[_0x184a('0xa')](_0x259903))[_0x184a('0xb')](loggerCatch(_0x184a('0xc')));}function moveContact(_0x1ea43c){return cmHopper['moveContactManagedDialer'](_0x1ea43c,!![])[_0x184a('0xb')](loggerCatch(_0x184a('0xe')));}exports[_0x184a('0xf')]=function(_0x543ebf){return cmHopperBlack[_0x184a('0xf')](_0x543ebf)[_0x184a('0xb')](loggerCatch(_0x184a('0x10')));};exports[_0x184a('0x11')]=function(_0x507851){return BPromise[_0x184a('0xd')]()[_0x184a('0x12')](cmHopper[_0x184a('0x11')](_0x507851))[_0x184a('0xb')](loggerCatch(_0x184a('0x13')));};exports[_0x184a('0xa')]=function(_0x56b4f3,_0x19b9b3){create(_0x56b4f3)[_0x184a('0xb')](loggerCatch(_0x19b9b3));moveContact(_0x56b4f3)[_0x184a('0xb')](loggerCatch(_0x19b9b3));};exports[_0x184a('0x14')]=function(_0xdc5c38,_0x4f9d44){createAgent(_0xdc5c38)[_0x184a('0xb')](loggerCatch(_0x4f9d44));};exports['createCustomerHistory']=function(_0x11cf3e,_0x308d8d){create(_0x11cf3e)[_0x184a('0xb')](loggerCatch(_0x308d8d));};exports['createCustomerFinal']=function(_0x53a94e,_0x45580c){moveContact(_0x53a94e)['catch'](loggerCatch(_0x45580c));};exports[_0x184a('0x15')]=function(_0x451ccd,_0x4736aa,_0xb71cb8){if(_0x4736aa){_0x451ccd[_0x184a('0x16')]=null;}if(_0xb71cb8){_0x451ccd[_0x184a('0x17')]=![];}return cmHopper['rescheduleContact'](_0x451ccd)[_0x184a('0xb')](loggerCatch(_0x184a('0x18')));};exports[_0x184a('0x19')]=function(_0x2eca0b){return cmHopper['countReScheduled'](_0x2eca0b)[_0x184a('0xb')](loggerCatch('[countReScheduled]\x20'));};exports[_0x184a('0x1a')]=function(_0x422675){return cmHopper['unlockContact']({'UserId':null},_0x422675,0x1)['catch'](loggerCatch(_0x184a('0x1b')));};exports['disableContact']=function(_0xb60b9d){return cmHopper[_0x184a('0x1a')]({'active':![]},_0xb60b9d,0x1)['catch'](loggerCatch(_0x184a('0x1c')));};exports[_0x184a('0x1d')]=function(_0x154c72){var _0x5c0dd5={};_0x5c0dd5[_0x184a('0x1e')]=_0x154c72[_0x184a('0x1e')];_0x5c0dd5[_0x184a('0x1f')]=_0x154c72[_0x184a('0x1f')];_0x5c0dd5[_0x184a('0x20')]=_0x154c72['calleridnum'];_0x5c0dd5['calleridname']=_0x154c72['calleridname'];_0x5c0dd5[_0x184a('0x21')]=_0x154c72['queue'];_0x5c0dd5['queuecallerjoinAt']=_0x154c72['answertime'];_0x5c0dd5[_0x184a('0x22')]=_0x154c72[_0x184a('0x23')];_0x5c0dd5[_0x184a('0x24')]=0x1;_0x5c0dd5[_0x184a('0x25')]=_0x154c72[_0x184a('0x26')];_0x5c0dd5[_0x184a('0x27')]=_0x154c72['membername'];_0x5c0dd5[_0x184a('0x28')]=_0x184a('0x29');_0x5c0dd5[_0x184a('0x2a')]='xcally-motion-preview';_0x5c0dd5[_0x184a('0x2b')]=0x0;_0x5c0dd5[_0x184a('0x2c')]=0x1;_0x5c0dd5['lastAssignedTo']=_0x154c72[_0x184a('0x2d')];_0x5c0dd5[_0x184a('0x2e')]=_0x184a('0x2f');return BPromise[_0x184a('0xd')]()[_0x184a('0x12')](voiceQueueReport[_0x184a('0x30')](_0x5c0dd5))[_0x184a('0xb')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x184a('0x31')]=function(_0x2be74d,_0x58ab28){return BPromise[_0x184a('0xd')]()[_0x184a('0x12')](cmHopper[_0x184a('0x31')](_0x2be74d,_0x58ab28))[_0x184a('0xb')](loggerCatch(_0x184a('0x32')));};exports[_0x184a('0x33')]=function(_0xa50b3b){return cmHopper[_0x184a('0x15')](_0xa50b3b,!![],!![])[_0x184a('0xb')](loggerCatch(_0x184a('0x34')));}; \ No newline at end of file +var _0x3676=['queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','catch','[createHistory]\x20','resolve','createHistory','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','then','[getContactPreview]\x20','createCustomerHistory','rescheduleContact','active','countReScheduled','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime'];(function(_0x5645a3,_0x24e6c9){var _0x432408=function(_0x20c208){while(--_0x20c208){_0x5645a3['push'](_0x5645a3['shift']());}};_0x432408(++_0x24e6c9);}(_0x3676,0x1b1));var _0x6367=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x3676[_0x1f36bb];return _0xaf97fa;};'use strict';var util=require(_0x6367('0x0'));var BPromise=require(_0x6367('0x1'));var logger=require(_0x6367('0x2'))(_0x6367('0x3'));var cmHopper=require(_0x6367('0x4'));var cmHopperHistory=require(_0x6367('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0x6367('0x6'));var voiceQueueReport=require(_0x6367('0x7'));function loggerCatch(_0x3b3a85){return function(_0x43f3e2){logger['error'](_0x3b3a85,util[_0x6367('0x8')](_0x43f3e2,{'showHidden':![],'depth':null}));};}function create(_0x26fc34){return cmHopperHistory['createHistory'](_0x26fc34)[_0x6367('0x9')](loggerCatch(_0x6367('0xa')));}function createAgent(_0x17f782){return BPromise[_0x6367('0xb')]()['then'](agentReportPreview[_0x6367('0xc')](_0x17f782))[_0x6367('0x9')](loggerCatch(_0x6367('0xa')));}function moveContact(_0x4ece34){return cmHopper['moveContactManagedDialer'](_0x4ece34,!![])['catch'](loggerCatch(_0x6367('0xd')));}exports[_0x6367('0xe')]=function(_0x32fb4a){return cmHopperBlack[_0x6367('0xe')](_0x32fb4a)[_0x6367('0x9')](loggerCatch(_0x6367('0xf')));};exports[_0x6367('0x10')]=function(_0x6315ea){return BPromise['resolve']()[_0x6367('0x11')](cmHopper[_0x6367('0x10')](_0x6315ea))[_0x6367('0x9')](loggerCatch(_0x6367('0x12')));};exports[_0x6367('0xc')]=function(_0x590e6d,_0x367d5e){create(_0x590e6d)[_0x6367('0x9')](loggerCatch(_0x367d5e));moveContact(_0x590e6d)['catch'](loggerCatch(_0x367d5e));};exports['createAgentHistory']=function(_0x2f6a62,_0x465125){createAgent(_0x2f6a62)[_0x6367('0x9')](loggerCatch(_0x465125));};exports[_0x6367('0x13')]=function(_0x3e7c17,_0x4e7338){create(_0x3e7c17)[_0x6367('0x9')](loggerCatch(_0x4e7338));};exports['createCustomerFinal']=function(_0x4f04c2,_0x2feb99){moveContact(_0x4f04c2)[_0x6367('0x9')](loggerCatch(_0x2feb99));};exports[_0x6367('0x14')]=function(_0x12d715,_0x18b38e,_0x503c96){if(_0x18b38e){_0x12d715['UserId']=null;}if(_0x503c96){_0x12d715[_0x6367('0x15')]=![];}return cmHopper[_0x6367('0x14')](_0x12d715)[_0x6367('0x9')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x6367('0x16')]=function(_0x523722){return cmHopper[_0x6367('0x16')](_0x523722)['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0x6367('0x17')]=function(_0x198b48){return cmHopper['unlockContact']({'UserId':null},_0x198b48,0x1)['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0x6367('0x18')]=function(_0x21299e){return cmHopper[_0x6367('0x17')]({'active':![]},_0x21299e,0x1)[_0x6367('0x9')](loggerCatch(_0x6367('0x19')));};exports[_0x6367('0x1a')]=function(_0x567d9a){var _0x4e7edb={};_0x4e7edb[_0x6367('0x1b')]=_0x567d9a[_0x6367('0x1b')];_0x4e7edb[_0x6367('0x1c')]=_0x567d9a[_0x6367('0x1c')];_0x4e7edb[_0x6367('0x1d')]=_0x567d9a[_0x6367('0x1d')];_0x4e7edb[_0x6367('0x1e')]=_0x567d9a[_0x6367('0x1e')];_0x4e7edb[_0x6367('0x1f')]=_0x567d9a[_0x6367('0x1f')];_0x4e7edb[_0x6367('0x20')]=_0x567d9a['answertime'];_0x4e7edb[_0x6367('0x21')]=_0x567d9a[_0x6367('0x22')];_0x4e7edb[_0x6367('0x23')]=0x1;_0x4e7edb[_0x6367('0x24')]=_0x567d9a[_0x6367('0x25')];_0x4e7edb[_0x6367('0x26')]=_0x567d9a[_0x6367('0x27')];_0x4e7edb[_0x6367('0x28')]=_0x6367('0x29');_0x4e7edb[_0x6367('0x2a')]='xcally-motion-preview';_0x4e7edb[_0x6367('0x2b')]=0x0;_0x4e7edb[_0x6367('0x2c')]=0x1;_0x4e7edb[_0x6367('0x2d')]=_0x567d9a[_0x6367('0x27')];_0x4e7edb[_0x6367('0x2e')]='COMPLETED';return BPromise[_0x6367('0xb')]()['then'](voiceQueueReport['create'](_0x4e7edb))[_0x6367('0x9')](loggerCatch(_0x6367('0x2f')));};exports[_0x6367('0x30')]=function(_0x2caf49,_0x502063){return BPromise[_0x6367('0xb')]()[_0x6367('0x11')](cmHopper[_0x6367('0x30')](_0x2caf49,_0x502063))[_0x6367('0x9')](loggerCatch(_0x6367('0x31')));};exports[_0x6367('0x32')]=function(_0x1a16e1){return cmHopper[_0x6367('0x14')](_0x1a16e1,!![],!![])[_0x6367('0x9')](loggerCatch(_0x6367('0x33')));}; \ 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 8c67462..b601150 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 _0xb5d9=['Contact','hasOwnProperty','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','starttime','responsetime','endtime','logAgent','statedesc','getSeconds','logLookAgent','membername','UserId','logCustomer','ringtime','answertime','isFailure','Failure','variablesAction','calleridname','originate','channelAgent','xcally-motion-preview','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','add','minutes','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','name','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','uniqueid','agentReadyId','status','getDiff','milliseconds','diff','seconds','filterKey','idContact','type','campaigntype','dialAnswer','scheduledat','countbusyretry','countglobal','callback','callbackuniqueid','callbackat','recallme','ListId','sipcallid','xmd-voicequeueid','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','random','extractCalleridName','match','extractCalleridNumber','noanswer','keys','variables','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','logger','info','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','Queue','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT'];(function(_0x9b64b2,_0x28fbc7){var _0x1ca2ad=function(_0x163cbd){while(--_0x163cbd){_0x9b64b2['push'](_0x9b64b2['shift']());}};_0x1ca2ad(++_0x28fbc7);}(_0xb5d9,0x18f));var _0x9b5d=function(_0x4a8f12,_0x2c9f5f){_0x4a8f12=_0x4a8f12-0x0;var _0x1b5294=_0xb5d9[_0x4a8f12];return _0x1b5294;};'use strict';var util=require(_0x9b5d('0x0'));var _=require(_0x9b5d('0x1'));var moment=require(_0x9b5d('0x2'));var logger=require(_0x9b5d('0x3'))('preview');var ipAgi=process[_0x9b5d('0x4')][_0x9b5d('0x5')]||_0x9b5d('0x6');var utils=require(_0x9b5d('0x7'));exports[_0x9b5d('0x8')]=function(_0x245c39){return function(_0x27fa16){logger[_0x9b5d('0x9')](_0x245c39,util[_0x9b5d('0xa')](_0x27fa16,{'showHidden':![],'depth':null}));};};exports[_0x9b5d('0xb')]=function(_0x2cff03,_0x2491cb){logger[_0x9b5d('0xc')](_0x2cff03,util['inspect'](_0x2491cb,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x19a42e,_0x5b0c06){logger[_0x9b5d('0x9')](_0x19a42e,util['inspect'](_0x5b0c06,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x52e1f1){return function(_0xa61230){logger[_0x9b5d('0xc')](_0x52e1f1,util['inspect'](_0xa61230,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x6091da,_0x20308c,_0x572f21){return{'message':_0x6091da,'unlock':_0x20308c,'active':_0x572f21};};exports['getCallerId']=function(_0x354a67,_0x5b7b6d,_0x1c2ebc){if(!_[_0x9b5d('0xd')](_0x1c2ebc)&&_0x9b5d('0xe')===typeof _0x1c2ebc&&!_['isEmpty'](_0x1c2ebc)){if(!_[_0x9b5d('0xd')](_0x5b7b6d)&&'string'===typeof _0x5b7b6d&&!_[_0x9b5d('0xf')](_0x5b7b6d)){return util[_0x9b5d('0x10')](_0x9b5d('0x11'),_0x5b7b6d,_0x1c2ebc);}return util['format'](_0x9b5d('0x11'),_0x1c2ebc,_0x1c2ebc);}if(!_[_0x9b5d('0xd')](_0x354a67)&&_0x9b5d('0xe')===typeof _0x354a67&&!_['isEmpty'](_0x354a67)){return _0x354a67;}return _0x9b5d('0x12');};exports['isActive']=function(_0x36e83d){if(_[_0x9b5d('0x13')](_0x36e83d)){return![];}return _0x36e83d;};exports['addVariables']=function(_0xd72941,_0x1340f6,_0x4f266e,_0x5b5fcd,_0x34ba7b,_0x1e0eb2){var _0xf3c011={'XMD-QUEUE':_0x1340f6[_0x9b5d('0x14')]?_0x1340f6[_0x9b5d('0x14')]['name']:'','XMD-CALLERID':_0x5b5fcd,'XMD-CALLERID-PREVIEW':_0x1e0eb2?util[_0x9b5d('0x10')](_0x9b5d('0x11'),_0x1e0eb2['calleridname'],_0x1e0eb2[_0x9b5d('0x15')]):_0x5b5fcd,'XMD-DIALID':_0x34ba7b,'XMD-CONTACTID':_0x1340f6[_0x9b5d('0x16')],'XMD-CDRTYPE':_0x9b5d('0x17'),'CALLERID(all)':_0x5b5fcd,'XMD-VOICEQUEUEID':_0x1340f6[_0x9b5d('0x18')],'XMD-DIALCHANNEL':_0x4f266e,'XMD-DIALTIMEOUT':_0xd72941[_0x9b5d('0x19')]||0x1e,'XMD-DIALOPTIONS':util[_0x9b5d('0x10')](_0x9b5d('0x1a'),_0xd72941[_0x9b5d('0x1b')]?'g':'',_['isEmpty'](_0xd72941[_0x9b5d('0x1c')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0xd72941[_0x9b5d('0x1d')]||'','XMD-AGI':_0xd72941[_0x9b5d('0x1e')]?util['format'](_0x9b5d('0x1f'),ipAgi,_0xd72941[_0x9b5d('0x1e')]):_0x9b5d('0x20'),'XMD-AGIAFTER':_0xd72941[_0x9b5d('0x1b')]?util[_0x9b5d('0x10')](_0x9b5d('0x1f'),ipAgi,_0xd72941[_0x9b5d('0x1b')]):_0x9b5d('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x1e0eb2?_0x1e0eb2[_0x9b5d('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0x1e0eb2?_0x1e0eb2[_0x9b5d('0x22')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_['isEmpty'](_0xd72941[_0x9b5d('0x1c')])){_0xf3c011[util[_0x9b5d('0x10')]('%s',_0x9b5d('0x23'))]=_0xd72941['monitor_format'];_0xf3c011[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x34ba7b;}if(_0x1340f6&&_0x1340f6['Contact']){for(var _0x5b7d89 in _0x1340f6[_0x9b5d('0x24')]){if(_0x1340f6[_0x9b5d('0x24')][_0x9b5d('0x25')](_0x5b7d89)){if(!_['isNil'](_0x1340f6[_0x9b5d('0x24')][_0x5b7d89])&&_0x5b7d89!=='id'&&_0x5b7d89!=='tags'&&_0x5b7d89!==_0x9b5d('0x26')&&_0x5b7d89!==_0x9b5d('0x27')){_0xf3c011[util['format']('%s%s',_0x9b5d('0x28'),_[_0x9b5d('0x29')](_0x5b7d89))]=_0x1340f6[_0x9b5d('0x24')][_0x5b7d89];}}}}return _0xf3c011;};exports[_0x9b5d('0x2a')]=function(_0x516064){var _0x452efc={};for(var _0x22faa6 in _0x516064){if(_0x516064[_0x9b5d('0x25')](_0x22faa6)){_0x452efc[util[_0x9b5d('0x10')]('%s',_[_0x9b5d('0x2b')](_0x22faa6))]=_0x516064[_0x22faa6];}}return{'variables':_0x452efc};};exports[_0x9b5d('0x2c')]=function(_0x46f9cb,_0x5b9bf9){if(!_[_0x9b5d('0x13')](_0x46f9cb)){if(_0x46f9cb[_0x9b5d('0x25')](_0x9b5d('0x2d'))){if(_0x46f9cb[_0x9b5d('0x2d')]>0x0){_0x46f9cb['originated']-=0x1;}else{logger['error'](_0x9b5d('0x2e'),_0x5b9bf9);}}}else{logger[_0x9b5d('0x9')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x5b9bf9);}};exports[_0x9b5d('0x2f')]=function(_0xaa313){var _0x4d13a5=moment()['format'](_0x9b5d('0x30'));_0xaa313[_0x9b5d('0x31')]=0xd;_0xaa313['statedesc']='Blacklist';_0xaa313[_0x9b5d('0x32')]=_0x4d13a5;_0xaa313[_0x9b5d('0x33')]=_0x4d13a5;_0xaa313[_0x9b5d('0x34')]=_0x4d13a5;};exports[_0x9b5d('0x35')]=function(_0x80959b,_0xd53b52,_0x465d89){var _0x34b440=moment()[_0x9b5d('0x10')](_0x9b5d('0x30'));_0x80959b[_0x9b5d('0x31')]=_0xd53b52;_0x80959b[_0x9b5d('0x36')]=_0x465d89;_0x80959b[_0x9b5d('0x33')]=_0x34b440;_0x80959b['ringtime']=utils[_0x9b5d('0x37')](_0x80959b['responsetime'],_0x80959b[_0x9b5d('0x32')]);};exports[_0x9b5d('0x38')]=function(_0x129c19,_0xe4e581,_0x1f3f38){_0x129c19[_0x9b5d('0x39')]=_0xe4e581;_0x129c19[_0x9b5d('0x3a')]=_0x1f3f38;};exports[_0x9b5d('0x3b')]=function(_0xd097f3,_0x246a99,_0xf07d91){var _0x35ae73=moment()[_0x9b5d('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0xd097f3[_0x9b5d('0x31')]=_0x246a99;_0xd097f3['statedesc']=_0xf07d91;_0xd097f3[_0x9b5d('0x33')]=_0xd097f3[_0x9b5d('0x33')]?_0xd097f3[_0x9b5d('0x33')]:_0x35ae73;_0xd097f3[_0x9b5d('0x34')]=_0xd097f3[_0x9b5d('0x34')]?_0xd097f3[_0x9b5d('0x34')]:_0x35ae73;_0xd097f3[_0x9b5d('0x3c')]=utils[_0x9b5d('0x37')](_0xd097f3[_0x9b5d('0x33')]||0x0,_0xd097f3[_0x9b5d('0x32')]||0x0);_0xd097f3['talktime']=_0xd097f3[_0x9b5d('0x3d')]?utils[_0x9b5d('0x37')](_0xd097f3['endtime'],_0xd097f3['answertime']):0x0;};exports[_0x9b5d('0x3e')]=function(_0x254f8d){return _0x254f8d===_0x9b5d('0x3f');};exports[_0x9b5d('0x40')]=function(_0x56f820,_0x1f0f4d,_0x2bce32,_0x2a0aa8,_0x2c6828){var _0x56e6ba=_0x2a0aa8?'RECALL':_0x56f820[_0x9b5d('0x41')];_0x56e6ba=_0x2c6828?'BOOKED':_0x56e6ba;return{'actionid':_0x56f820['uniqueid'],'action':_0x9b5d('0x42'),'channel':_0x56f820[_0x9b5d('0x43')],'callerid':util['format'](_0x9b5d('0x11'),_0x56e6ba,_0x56f820['calleridnum']),'Exten':_0x9b5d('0x44'),'Context':_0x9b5d('0x45'),'Priority':'1','variable':_0x2bce32,'timeout':(_0x1f0f4d[_0x9b5d('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x56f820['uniqueid']};};exports[_0x9b5d('0x47')]=function(_0x2c4a5b){return _0x2c4a5b['countbusyretry']+_0x2c4a5b[_0x9b5d('0x48')]+_0x2c4a5b[_0x9b5d('0x49')]+_0x2c4a5b[_0x9b5d('0x4a')]+_0x2c4a5b[_0x9b5d('0x4b')];};exports[_0x9b5d('0x4c')]=function(_0xd04866){var _0x3e97ca=_[_0x9b5d('0x4d')](_0xd04866);_0x3e97ca[_0x9b5d('0x31')]=0xf;_0x3e97ca['statedesc']=_0x9b5d('0x4e');return _0x3e97ca;};exports['scheduledAt']=function(_0x39bb85,_0x5ecf41,_0x434ee4){var _0x531111={};_0x531111[_0x5ecf41]=_0x39bb85[_0x5ecf41];_0x531111[_0x9b5d('0x4f')]=![];_0x531111['scheduledat']=moment()[_0x9b5d('0x50')](_0x434ee4,_0x9b5d('0x51'))[_0x9b5d('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x531111[_0x9b5d('0x16')]=_0x39bb85[_0x9b5d('0x16')];_0x531111['ListId']=_0x39bb85['ListId'];_0x531111[_0x9b5d('0x18')]=_0x39bb85[_0x9b5d('0x18')]||undefined;return _0x531111;};exports[_0x9b5d('0x52')]=function(_0x36fb0e,_0x38dbf2){if(!_[_0x9b5d('0x13')](_0x36fb0e)){if(_0x36fb0e[_0x9b5d('0x53')]>0x0){_0x36fb0e['pTalking']-=0x1;}else{logger['error'](_0x38dbf2,_0x9b5d('0x54'));}}else{logger[_0x9b5d('0x9')](_0x38dbf2,_0x9b5d('0x55'));}};exports['IsNotLoggedIn']=function(_0x462d45){if(_0x462d45<=0x0){return!![];}return![];};function buildObj(_0x4ebd9b,_0x29e8ff,_0x348405){_0x4ebd9b['lastevent']=_0x29e8ff;_0x4ebd9b[_0x9b5d('0x56')]=_0x4ebd9b[_0x9b5d('0x57')];_0x4ebd9b[_0x9b5d('0x58')]=_0x4ebd9b['channelAgent'];_0x4ebd9b[_0x9b5d('0x59')]=_0x9b5d('0x5a');if(_0x348405){_0x4ebd9b[_0x9b5d('0x5b')]=_0x348405[_0x9b5d('0x5b')];}return _0x4ebd9b;}exports['buildObj']=buildObj;exports[_0x9b5d('0x5c')]=function(_0x27e8cf){var _0x583c43={};_0x583c43[_0x9b5d('0x57')]=_0x27e8cf[_0x9b5d('0x57')];_0x583c43['interface']=_0x27e8cf[_0x9b5d('0x43')];_0x583c43[_0x9b5d('0x5d')]=_0x27e8cf[_0x9b5d('0x5d')];return _0x583c43;};exports[_0x9b5d('0x5e')]=function(_0x11778c){var _0x3da88f=[];for(var _0xf9d99f in _0x11778c){if(_0x11778c[_0x9b5d('0x25')](_0xf9d99f)){if(!_[_0x9b5d('0x13')](_0x11778c[_0xf9d99f])&&_0x11778c[_0xf9d99f][_0x9b5d('0x31')]==='not_inuse'&&_0x11778c[_0xf9d99f][_0x9b5d('0x5f')]==='reachable'){_0x3da88f['push'](_0x11778c[_0xf9d99f]['id']);}}}return _0x3da88f;};exports[_0x9b5d('0x60')]=function(_0x21aa0f){var _0x1add70=moment()[_0x9b5d('0x61')](0x0);var _0x4c65a9=moment(_0x21aa0f)[_0x9b5d('0x61')](0x0);return _0x1add70[_0x9b5d('0x62')](_0x4c65a9,_0x9b5d('0x63'));};exports['createBody']=function(_0x572c56){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x572c56[_0x9b5d('0x16')],'ListId':_0x572c56['ListId'],'VoiceQueueId':_0x572c56['VoiceQueueId']||undefined,'CampaignId':_0x572c56['CampaignId']||undefined};};exports[_0x9b5d('0x64')]=function(_0x41b003){if(_0x41b003===_0x9b5d('0x5d')||_0x41b003===_0x9b5d('0x65')||_0x41b003===_0x9b5d('0x57')||_0x41b003===_0x9b5d('0x66')||_0x41b003===_0x9b5d('0x67')||_0x41b003===_0x9b5d('0x68')||_0x41b003===_0x9b5d('0x39')||_0x41b003===_0x9b5d('0x43')||_0x41b003===_0x9b5d('0x41')||_0x41b003==='active'||_0x41b003==='calleridnum'||_0x41b003===_0x9b5d('0x69')||_0x41b003===_0x9b5d('0x6a')||_0x41b003===_0x9b5d('0x48')||_0x41b003===_0x9b5d('0x49')||_0x41b003===_0x9b5d('0x6b')||_0x41b003===_0x9b5d('0x6c')||_0x41b003===_0x9b5d('0x6d')||_0x41b003===_0x9b5d('0x6e')||_0x41b003===_0x9b5d('0x6f')||_0x41b003===_0x9b5d('0x16')||_0x41b003===_0x9b5d('0x70')||_0x41b003===_0x9b5d('0x3a')||_0x41b003===_0x9b5d('0x18')||_0x41b003===_0x9b5d('0x71')||_0x41b003===_0x9b5d('0x72')||_0x41b003==='xmd-queue'||_0x41b003==='xmd-phone'||_0x41b003===_0x9b5d('0x73')||_0x41b003===_0x9b5d('0x74')||_0x41b003===_0x9b5d('0x75')||_0x41b003===_0x9b5d('0x76')||_0x41b003===_0x9b5d('0x77')||_0x41b003===_0x9b5d('0x78')||_0x41b003===_0x9b5d('0x79')||_0x41b003==='xmd-cdrtype'||_0x41b003===_0x9b5d('0x7a')||_0x41b003==='xmd-agiafter'||_0x41b003===_0x9b5d('0x7b')||_0x41b003===_0x9b5d('0x7c')||_0x41b003===_0x9b5d('0x7d')||_0x41b003===_0x9b5d('0x7e')||_0x41b003===_0x9b5d('0x7f')||_0x41b003===_0x9b5d('0x80')||_0x41b003==='rtpaudioqoslossbridged'||_0x41b003===_0x9b5d('0x81')||_0x41b003===_0x9b5d('0x82')||_0x41b003==='rtpaudioqos'||_0x41b003===_0x9b5d('0x7d')||_0x41b003===_0x9b5d('0x7e')||_0x41b003==='rtpaudioqosjitterbridged'||_0x41b003===_0x9b5d('0x80')||_0x41b003===_0x9b5d('0x83')||_0x41b003===_0x9b5d('0x81')||_0x41b003===_0x9b5d('0x82')||_0x41b003===_0x9b5d('0x84')||_0x41b003===_0x9b5d('0x85')||_0x41b003==='state'||_0x41b003===_0x9b5d('0x36')){return![];}return!![];};exports[_0x9b5d('0x86')]=function(_0x321b1c,_0x5bbcac){var _0xa5e118,_0x508e33,_0x56c957;if(_0x5bbcac<=0x0){_0x5bbcac=0x1;}_0xa5e118=new RegExp('\x5cw{0,'+_0x5bbcac+'}$');_0x508e33=Math[_0x9b5d('0x87')](0xa,_0x5bbcac-0x1);_0x56c957=Math[_0x9b5d('0x87')](0xa,_0x5bbcac)-0x1;return util[_0x9b5d('0x10')]('%s',_['replace'](_0x321b1c,_0xa5e118,_[_0x9b5d('0x88')](_0x508e33,_0x56c957)));};exports[_0x9b5d('0x89')]=function(_0x2fd793){var _0x2526e7=_0x2fd793[_0x9b5d('0x8a')](/"(.*?)"/);return _0x2526e7?_0x2526e7[0x1]:_0x2fd793;};exports[_0x9b5d('0x8b')]=function(_0x38309f){var _0x45abf1=_0x38309f['match'](/<(.*?)>/);return _0x45abf1?_0x45abf1[0x1]:_0x38309f;};function buildNoAnswerEventPayload(_0x4c4cd4,_0x32bf27){var _0x6cb23=buildObj(_0x4c4cd4,_0x9b5d('0x8c'));if(!_['isEmpty'](_0x32bf27['variables'])){Object[_0x9b5d('0x8d')](_0x32bf27[_0x9b5d('0x8e')])['forEach'](function(_0x5b6a08){_0x6cb23[_0x5b6a08[_0x9b5d('0x8f')]()]=_0x32bf27[_0x9b5d('0x8e')][_0x5b6a08];});}return _0x6cb23;}exports[_0x9b5d('0x90')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xf577=['push','getDiff','milliseconds','seconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','countglobal','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','match','noanswer','variables','keys','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','preview','env','XCALLY_IP_AGI','loggerCatch','error','inspect','logger','info','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','Queue','calleridname','calleridnum','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','updatedAt','XMD-','toUpper','toLowerVariables','hasOwnProperty','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','endtime','logAgent','responsetime','ringtime','starttime','logLookAgent','membername','UserId','getSeconds','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','originate','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','scheduledAt','add','ContactId','ListId','decrementTalkink','pTalking','IsNotLoggedIn','name','queue','interface','channelAgent','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','agentReadyId','status','reachable'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf577,0x14b));var _0x7f57=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xf577[_0x1a7846];return _0x48049;};'use strict';var util=require(_0x7f57('0x0'));var _=require(_0x7f57('0x1'));var moment=require(_0x7f57('0x2'));var logger=require('../../../../config/logger')(_0x7f57('0x3'));var ipAgi=process[_0x7f57('0x4')][_0x7f57('0x5')]||'127.0.0.1';var utils=require('../../dialer/utils');exports[_0x7f57('0x6')]=function(_0x1d8f55){return function(_0x4391c0){logger[_0x7f57('0x7')](_0x1d8f55,util[_0x7f57('0x8')](_0x4391c0,{'showHidden':![],'depth':null}));};};exports[_0x7f57('0x9')]=function(_0x106bd7,_0x554409){logger[_0x7f57('0xa')](_0x106bd7,util[_0x7f57('0x8')](_0x554409,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x50887a,_0x4fe27f){logger[_0x7f57('0x7')](_0x50887a,util[_0x7f57('0x8')](_0x4fe27f,{'showHidden':![],'depth':null}));};exports[_0x7f57('0xb')]=function(_0x255a5c){return function(_0x14782d){logger['info'](_0x255a5c,util[_0x7f57('0x8')](_0x14782d,{'showHidden':![],'depth':null}));};};exports[_0x7f57('0xc')]=function(_0x477d07,_0x20283f,_0xf58024){return{'message':_0x477d07,'unlock':_0x20283f,'active':_0xf58024};};exports['getCallerId']=function(_0x392f2e,_0x10cd3c,_0xbbc41f){if(!_[_0x7f57('0xd')](_0xbbc41f)&&_0x7f57('0xe')===typeof _0xbbc41f&&!_[_0x7f57('0xf')](_0xbbc41f)){if(!_[_0x7f57('0xd')](_0x10cd3c)&&_0x7f57('0xe')===typeof _0x10cd3c&&!_['isEmpty'](_0x10cd3c)){return util[_0x7f57('0x10')]('\x22%s\x22\x20<%s>',_0x10cd3c,_0xbbc41f);}return util[_0x7f57('0x10')](_0x7f57('0x11'),_0xbbc41f,_0xbbc41f);}if(!_[_0x7f57('0xd')](_0x392f2e)&&_0x7f57('0xe')===typeof _0x392f2e&&!_[_0x7f57('0xf')](_0x392f2e)){return _0x392f2e;}return _0x7f57('0x12');};exports['isActive']=function(_0x4805e9){if(_[_0x7f57('0x13')](_0x4805e9)){return![];}return _0x4805e9;};exports['addVariables']=function(_0x4e89cb,_0x1cf6eb,_0x2e438f,_0x244c6d,_0x1ce2af,_0x41a9fb){var _0x45dc1a={'XMD-QUEUE':_0x1cf6eb[_0x7f57('0x14')]?_0x1cf6eb[_0x7f57('0x14')]['name']:'','XMD-CALLERID':_0x244c6d,'XMD-CALLERID-PREVIEW':_0x41a9fb?util[_0x7f57('0x10')](_0x7f57('0x11'),_0x41a9fb[_0x7f57('0x15')],_0x41a9fb[_0x7f57('0x16')]):_0x244c6d,'XMD-DIALID':_0x1ce2af,'XMD-CONTACTID':_0x1cf6eb['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x244c6d,'XMD-VOICEQUEUEID':_0x1cf6eb[_0x7f57('0x17')],'XMD-DIALCHANNEL':_0x2e438f,'XMD-DIALTIMEOUT':_0x4e89cb[_0x7f57('0x18')]||0x1e,'XMD-DIALOPTIONS':util[_0x7f57('0x10')]('\x22rtTxX%s%s\x22',_0x4e89cb[_0x7f57('0x19')]?'g':'',_[_0x7f57('0xf')](_0x4e89cb[_0x7f57('0x1a')])?'':_0x7f57('0x1b')),'XMD-DIALURL':_0x4e89cb[_0x7f57('0x1c')]||'','XMD-AGI':_0x4e89cb[_0x7f57('0x1d')]?util[_0x7f57('0x10')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4e89cb['dialQueueProject']):_0x7f57('0x1e'),'XMD-AGIAFTER':_0x4e89cb[_0x7f57('0x19')]?util[_0x7f57('0x10')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4e89cb['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x41a9fb?_0x41a9fb['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x41a9fb?_0x41a9fb[_0x7f57('0x1f')]:'','XMD-DESTINATION':_0x7f57('0x20'),'SIPADDHEADER':_0x7f57('0x21')};if(!_[_0x7f57('0xf')](_0x4e89cb[_0x7f57('0x1a')])){_0x45dc1a[util[_0x7f57('0x10')]('%s',_0x7f57('0x22'))]=_0x4e89cb[_0x7f57('0x1a')];_0x45dc1a[util[_0x7f57('0x10')]('%s',_0x7f57('0x23'))]=_0x1ce2af;}if(_0x1cf6eb&&_0x1cf6eb[_0x7f57('0x24')]){for(var _0x256c5e in _0x1cf6eb['Contact']){if(_0x1cf6eb['Contact']['hasOwnProperty'](_0x256c5e)){if(!_['isNil'](_0x1cf6eb[_0x7f57('0x24')][_0x256c5e])&&_0x256c5e!=='id'&&_0x256c5e!==_0x7f57('0x25')&&_0x256c5e!=='createdAt'&&_0x256c5e!==_0x7f57('0x26')){_0x45dc1a[util[_0x7f57('0x10')]('%s%s',_0x7f57('0x27'),_[_0x7f57('0x28')](_0x256c5e))]=_0x1cf6eb[_0x7f57('0x24')][_0x256c5e];}}}}return _0x45dc1a;};exports[_0x7f57('0x29')]=function(_0x415813){var _0x16ba7d={};for(var _0x12a34e in _0x415813){if(_0x415813[_0x7f57('0x2a')](_0x12a34e)){_0x16ba7d[util[_0x7f57('0x10')]('%s',_[_0x7f57('0x2b')](_0x12a34e))]=_0x415813[_0x12a34e];}}return{'variables':_0x16ba7d};};exports['updateOriginated']=function(_0x7b3fb0,_0x373286){if(!_[_0x7f57('0x13')](_0x7b3fb0)){if(_0x7b3fb0[_0x7f57('0x2a')]('originated')){if(_0x7b3fb0[_0x7f57('0x2c')]>0x0){_0x7b3fb0[_0x7f57('0x2c')]-=0x1;}else{logger[_0x7f57('0x7')](_0x7f57('0x2d'),_0x373286);}}}else{logger[_0x7f57('0x7')](_0x7f57('0x2e'),_0x373286);}};exports[_0x7f57('0x2f')]=function(_0x550768){var _0x4821b0=moment()[_0x7f57('0x10')](_0x7f57('0x30'));_0x550768[_0x7f57('0x31')]=0xd;_0x550768[_0x7f57('0x32')]=_0x7f57('0x33');_0x550768['starttime']=_0x4821b0;_0x550768['responsetime']=_0x4821b0;_0x550768[_0x7f57('0x34')]=_0x4821b0;};exports[_0x7f57('0x35')]=function(_0x4f5aad,_0x2414f2,_0x46a042){var _0x40e5b3=moment()[_0x7f57('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f5aad['state']=_0x2414f2;_0x4f5aad[_0x7f57('0x32')]=_0x46a042;_0x4f5aad[_0x7f57('0x36')]=_0x40e5b3;_0x4f5aad[_0x7f57('0x37')]=utils['getSeconds'](_0x4f5aad[_0x7f57('0x36')],_0x4f5aad[_0x7f57('0x38')]);};exports[_0x7f57('0x39')]=function(_0x246674,_0x3dd6d5,_0x2c66dc){_0x246674[_0x7f57('0x3a')]=_0x3dd6d5;_0x246674[_0x7f57('0x3b')]=_0x2c66dc;};exports['logCustomer']=function(_0x4c0197,_0x5e7736,_0x55c4a5){var _0x5e6d8d=moment()[_0x7f57('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x4c0197['state']=_0x5e7736;_0x4c0197['statedesc']=_0x55c4a5;_0x4c0197['responsetime']=_0x4c0197[_0x7f57('0x36')]?_0x4c0197[_0x7f57('0x36')]:_0x5e6d8d;_0x4c0197[_0x7f57('0x34')]=_0x4c0197[_0x7f57('0x34')]?_0x4c0197[_0x7f57('0x34')]:_0x5e6d8d;_0x4c0197[_0x7f57('0x37')]=utils[_0x7f57('0x3c')](_0x4c0197[_0x7f57('0x36')]||0x0,_0x4c0197[_0x7f57('0x38')]||0x0);_0x4c0197[_0x7f57('0x3d')]=_0x4c0197['answertime']?utils[_0x7f57('0x3c')](_0x4c0197['endtime'],_0x4c0197[_0x7f57('0x3e')]):0x0;};exports[_0x7f57('0x3f')]=function(_0x4b7a9b){return _0x4b7a9b===_0x7f57('0x40');};exports[_0x7f57('0x41')]=function(_0x757ca4,_0x51cf49,_0x42f4a9,_0x2205f3,_0x4db85c){var _0x150e7b=_0x2205f3?'RECALL':_0x757ca4[_0x7f57('0x15')];_0x150e7b=_0x4db85c?_0x7f57('0x42'):_0x150e7b;return{'actionid':_0x757ca4[_0x7f57('0x43')],'action':_0x7f57('0x44'),'channel':_0x757ca4['channelAgent'],'callerid':util[_0x7f57('0x10')]('\x22%s\x22\x20<%s>',_0x150e7b,_0x757ca4[_0x7f57('0x16')]),'Exten':_0x7f57('0x20'),'Context':'from-sip','Priority':'1','variable':_0x42f4a9,'timeout':(_0x51cf49[_0x7f57('0x45')]||0x1e)*0x3e8,'async':!![],'channelid':_0x757ca4[_0x7f57('0x43')]};};exports[_0x7f57('0x46')]=function(_0x51140f){return _0x51140f[_0x7f57('0x47')]+_0x51140f[_0x7f57('0x48')]+_0x51140f[_0x7f57('0x49')]+_0x51140f['countagentrejectretry']+_0x51140f[_0x7f57('0x4a')];};exports[_0x7f57('0x4b')]=function(_0x61259f){var _0x314f11=_['clone'](_0x61259f);_0x314f11[_0x7f57('0x31')]=0xf;_0x314f11[_0x7f57('0x32')]='Global';return _0x314f11;};exports[_0x7f57('0x4c')]=function(_0x1c1424,_0x2bbb2c,_0x3a3295){var _0x220ea5={};_0x220ea5[_0x2bbb2c]=_0x1c1424[_0x2bbb2c];_0x220ea5['active']=![];_0x220ea5['scheduledat']=moment()[_0x7f57('0x4d')](_0x3a3295,'minutes')[_0x7f57('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x220ea5[_0x7f57('0x4e')]=_0x1c1424[_0x7f57('0x4e')];_0x220ea5['ListId']=_0x1c1424[_0x7f57('0x4f')];_0x220ea5[_0x7f57('0x17')]=_0x1c1424[_0x7f57('0x17')]||undefined;return _0x220ea5;};exports[_0x7f57('0x50')]=function(_0x1f9b7e,_0x2ba05e){if(!_[_0x7f57('0x13')](_0x1f9b7e)){if(_0x1f9b7e[_0x7f57('0x51')]>0x0){_0x1f9b7e[_0x7f57('0x51')]-=0x1;}else{logger['error'](_0x2ba05e,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x2ba05e,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x7f57('0x52')]=function(_0x10b056){if(_0x10b056<=0x0){return!![];}return![];};function buildObj(_0x4157d0,_0x1d5d66,_0x1d40b2){_0x4157d0['lastevent']=_0x1d5d66;_0x4157d0[_0x7f57('0x53')]=_0x4157d0[_0x7f57('0x54')];_0x4157d0[_0x7f57('0x55')]=_0x4157d0[_0x7f57('0x56')];_0x4157d0[_0x7f57('0x57')]=_0x7f57('0x58');if(_0x1d40b2){_0x4157d0['mandatoryDisposition']=_0x1d40b2[_0x7f57('0x59')];}return _0x4157d0;}exports[_0x7f57('0x5a')]=buildObj;exports[_0x7f57('0x5b')]=function(_0x1c927c){var _0x435d81={};_0x435d81[_0x7f57('0x54')]=_0x1c927c[_0x7f57('0x54')];_0x435d81[_0x7f57('0x55')]=_0x1c927c[_0x7f57('0x56')];_0x435d81['uniqueid']=_0x1c927c['uniqueid'];return _0x435d81;};exports[_0x7f57('0x5c')]=function(_0x5a5bed){var _0x851f8c=[];for(var _0x55d2d6 in _0x5a5bed){if(_0x5a5bed['hasOwnProperty'](_0x55d2d6)){if(!_[_0x7f57('0x13')](_0x5a5bed[_0x55d2d6])&&_0x5a5bed[_0x55d2d6][_0x7f57('0x31')]==='not_inuse'&&_0x5a5bed[_0x55d2d6][_0x7f57('0x5d')]===_0x7f57('0x5e')){_0x851f8c[_0x7f57('0x5f')](_0x5a5bed[_0x55d2d6]['id']);}}}return _0x851f8c;};exports[_0x7f57('0x60')]=function(_0x5424c2){var _0x2a071e=moment()[_0x7f57('0x61')](0x0);var _0x45cf51=moment(_0x5424c2)[_0x7f57('0x61')](0x0);return _0x2a071e['diff'](_0x45cf51,_0x7f57('0x62'));};exports[_0x7f57('0x63')]=function(_0x2c8479){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2c8479[_0x7f57('0x4e')],'ListId':_0x2c8479[_0x7f57('0x4f')],'VoiceQueueId':_0x2c8479['VoiceQueueId']||undefined,'CampaignId':_0x2c8479[_0x7f57('0x64')]||undefined};};exports[_0x7f57('0x65')]=function(_0xfcfa20){if(_0xfcfa20==='uniqueid'||_0xfcfa20===_0x7f57('0x66')||_0xfcfa20===_0x7f57('0x54')||_0xfcfa20===_0x7f57('0x67')||_0xfcfa20===_0x7f57('0x68')||_0xfcfa20==='dialAnswer'||_0xfcfa20===_0x7f57('0x3a')||_0xfcfa20===_0x7f57('0x56')||_0xfcfa20===_0x7f57('0x15')||_0xfcfa20==='active'||_0xfcfa20==='calleridnum'||_0xfcfa20==='scheduledat'||_0xfcfa20===_0x7f57('0x47')||_0xfcfa20===_0x7f57('0x48')||_0xfcfa20===_0x7f57('0x49')||_0xfcfa20===_0x7f57('0x69')||_0xfcfa20==='callback'||_0xfcfa20===_0x7f57('0x6a')||_0xfcfa20===_0x7f57('0x6b')||_0xfcfa20===_0x7f57('0x6c')||_0xfcfa20===_0x7f57('0x4e')||_0xfcfa20===_0x7f57('0x4f')||_0xfcfa20==='UserId'||_0xfcfa20===_0x7f57('0x17')||_0xfcfa20===_0x7f57('0x6d')||_0xfcfa20===_0x7f57('0x6e')||_0xfcfa20===_0x7f57('0x6f')||_0xfcfa20===_0x7f57('0x70')||_0xfcfa20===_0x7f57('0x71')||_0xfcfa20===_0x7f57('0x72')||_0xfcfa20==='xmd-dialtimeout'||_0xfcfa20===_0x7f57('0x73')||_0xfcfa20==='xmd-dialid'||_0xfcfa20===_0x7f57('0x74')||_0xfcfa20===_0x7f57('0x75')||_0xfcfa20===_0x7f57('0x76')||_0xfcfa20===_0x7f57('0x77')||_0xfcfa20==='xmd-agiafter'||_0xfcfa20===_0x7f57('0x78')||_0xfcfa20===_0x7f57('0x79')||_0xfcfa20===_0x7f57('0x7a')||_0xfcfa20===_0x7f57('0x7b')||_0xfcfa20===_0x7f57('0x7c')||_0xfcfa20===_0x7f57('0x7d')||_0xfcfa20===_0x7f57('0x7e')||_0xfcfa20===_0x7f57('0x7f')||_0xfcfa20===_0x7f57('0x80')||_0xfcfa20===_0x7f57('0x79')||_0xfcfa20===_0x7f57('0x7a')||_0xfcfa20===_0x7f57('0x7b')||_0xfcfa20===_0x7f57('0x7c')||_0xfcfa20===_0x7f57('0x7d')||_0xfcfa20===_0x7f57('0x7e')||_0xfcfa20===_0x7f57('0x7f')||_0xfcfa20===_0x7f57('0x80')||_0xfcfa20===_0x7f57('0x81')||_0xfcfa20===_0x7f57('0x82')||_0xfcfa20===_0x7f57('0x31')||_0xfcfa20===_0x7f57('0x32')){return![];}return!![];};exports[_0x7f57('0x83')]=function(_0x4b4fc8,_0x11c150){var _0x58d250,_0x59b2d1,_0x59f212;if(_0x11c150<=0x0){_0x11c150=0x1;}_0x58d250=new RegExp('\x5cw{0,'+_0x11c150+'}$');_0x59b2d1=Math[_0x7f57('0x84')](0xa,_0x11c150-0x1);_0x59f212=Math[_0x7f57('0x84')](0xa,_0x11c150)-0x1;return util[_0x7f57('0x10')]('%s',_[_0x7f57('0x85')](_0x4b4fc8,_0x58d250,_[_0x7f57('0x86')](_0x59b2d1,_0x59f212)));};exports[_0x7f57('0x87')]=function(_0x3d1219){var _0x53c06b=_0x3d1219[_0x7f57('0x88')](/"(.*?)"/);return _0x53c06b?_0x53c06b[0x1]:_0x3d1219;};exports['extractCalleridNumber']=function(_0x17e5e6){var _0x479d92=_0x17e5e6[_0x7f57('0x88')](/<(.*?)>/);return _0x479d92?_0x479d92[0x1]:_0x17e5e6;};function buildNoAnswerEventPayload(_0x20040f,_0x549a7){var _0xdac6d2=buildObj(_0x20040f,_0x7f57('0x89'));if(!_['isEmpty'](_0x549a7[_0x7f57('0x8a')])){Object[_0x7f57('0x8b')](_0x549a7[_0x7f57('0x8a')])['forEach'](function(_0x58db23){_0xdac6d2[_0x58db23[_0x7f57('0x8c')]()]=_0x549a7[_0x7f57('0x8a')][_0x58db23];});}return _0xdac6d2;}exports[_0x7f57('0x8d')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 33a80f8..1943f03 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 _0xdf6c=['queueadd','string','number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelredirect'];(function(_0x5630b1,_0x59c4b4){var _0x558a8b=function(_0x308898){while(--_0x308898){_0x5630b1['push'](_0x5630b1['shift']());}};_0x558a8b(++_0x59c4b4);}(_0xdf6c,0xf0));var _0xcdf6=function(_0x19cf75,_0x1305dd){_0x19cf75=_0x19cf75-0x0;var _0x8add2c=_0xdf6c[_0x19cf75];return _0x8add2c;};'use strict';exports[_0xcdf6('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xcdf6('0x1'),'required':!![]},'penalty':{'type':_0xcdf6('0x2'),'required':![]},'paused':{'type':_0xcdf6('0x3'),'required':![]}};exports[_0xcdf6('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xcdf6('0x1'),'required':!![]}};exports[_0xcdf6('0x5')]={'interface':{'type':_0xcdf6('0x1'),'required':!![]},'paused':{'type':_0xcdf6('0x3')},'reason':{'type':_0xcdf6('0x1'),'required':![]}};exports[_0xcdf6('0x6')]={'module':{'type':_0xcdf6('0x1'),'required':![]}};exports[_0xcdf6('0x7')]={'uniqueid':{'type':_0xcdf6('0x1'),'required':!![]}};exports[_0xcdf6('0x8')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xcdf6('0x1')},'format':{'type':_0xcdf6('0x1')},'mixmonitorid':{'type':_0xcdf6('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0xcdf6('0x1'),'required':!![]}};exports[_0xcdf6('0x9')]={'uniqueid':{'type':_0xcdf6('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0xcdf6('0x1')}}; \ No newline at end of file +var _0xe220=['string','number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd'];(function(_0xdfede3,_0x4f6574){var _0x33604b=function(_0x4346af){while(--_0x4346af){_0xdfede3['push'](_0xdfede3['shift']());}};_0x33604b(++_0x4f6574);}(_0xe220,0xb3));var _0x0e22=function(_0x340e3b,_0x39fd94){_0x340e3b=_0x340e3b-0x0;var _0x240ace=_0xe220[_0x340e3b];return _0x240ace;};'use strict';exports[_0x0e22('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x0e22('0x1'),'required':!![]},'membername':{'type':_0x0e22('0x1'),'required':!![]},'penalty':{'type':_0x0e22('0x2'),'required':![]},'paused':{'type':_0x0e22('0x3'),'required':![]}};exports[_0x0e22('0x4')]={'queue':{'type':_0x0e22('0x1'),'required':!![]},'interface':{'type':_0x0e22('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':'string','required':!![]},'paused':{'type':_0x0e22('0x3')},'reason':{'type':'string','required':![]}};exports[_0x0e22('0x5')]={'module':{'type':'string','required':![]}};exports[_0x0e22('0x6')]={'uniqueid':{'type':_0x0e22('0x1'),'required':!![]}};exports[_0x0e22('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0x0e22('0x1')},'mixmonitorid':{'type':_0x0e22('0x1')}};exports[_0x0e22('0x8')]={'uniqueid':{'type':_0x0e22('0x1'),'required':!![]}};exports[_0x0e22('0x9')]={'uniqueid':{'type':_0x0e22('0x1'),'required':!![]},'exten':{'type':_0x0e22('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index f3af032..d28909c 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 _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x330723,_0x8de382){var _0x60c546=function(_0xd6d3fe){while(--_0xd6d3fe){_0x330723['push'](_0x330723['shift']());}};_0x60c546(++_0x8de382);}(_0x5f2f,0x73));var _0xf5f2=function(_0x19d575,_0x40ab33){_0x19d575=_0x19d575-0x0;var _0x4d1eff=_0x5f2f[_0x19d575];return _0x4d1eff;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file +var _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x54b0f3,_0x1fe2f7){_0x54b0f3=_0x54b0f3-0x0;var _0x5ae957=_0x0b0e[_0x54b0f3];return _0x5ae957;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 8cb8f80..a0bb900 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a97=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0x6a97,0x133));var _0x76a9=function(_0x11ba46,_0x1d6752){_0x11ba46=_0x11ba46-0x0;var _0x1c8c6f=_0x6a97[_0x11ba46];return _0x1c8c6f;};'use strict';function mergeDBDataToRealtime(_0x186942,_0x54fa12){var _0x54e8f6=Object[_0x76a9('0x0')]({},_0x186942);for(var _0x20a824 in _0x54fa12){if(_0x54e8f6[_0x76a9('0x1')](_0x20a824)){_0x54e8f6[_0x20a824]=_0x54fa12[_0x20a824];}}return _0x54e8f6;}exports[_0x76a9('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x0a67=['assign','mergeDBDataToRealtime'];(function(_0x2c7975,_0x66dbbb){var _0x78299e=function(_0x7314f8){while(--_0x7314f8){_0x2c7975['push'](_0x2c7975['shift']());}};_0x78299e(++_0x66dbbb);}(_0x0a67,0x18e));var _0x70a6=function(_0xd9fc51,_0xc9e379){_0xd9fc51=_0xd9fc51-0x0;var _0x31917d=_0x0a67[_0xd9fc51];return _0x31917d;};'use strict';function mergeDBDataToRealtime(_0x1a55c7,_0x23d732){var _0x134e68=Object[_0x70a6('0x0')]({},_0x1a55c7);for(var _0x347078 in _0x23d732){if(_0x134e68['hasOwnProperty'](_0x347078)){_0x134e68[_0x347078]=_0x23d732[_0x347078];}}return _0x134e68;}exports[_0x70a6('0x1')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 62b8d25..7accdba 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 _0x88c7=['keys','length','split','outbound','internal','destination','exten','dialer','lastapplication','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridnum','destinationchannel','channel','calleridpreview','disposition','ANSWERED','transfers','linkedid','transfereelinkedid','type','getCallType','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','calleridname','connectedlinename','originatecalleridnum','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','phone','lastIndexOf','transfererlinkedid','util','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','isNil','name','interface','format','SIP/%s','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','getAgentByInternal'];(function(_0x3d1678,_0x28cdc5){var _0x337804=function(_0x11483b){while(--_0x11483b){_0x3d1678['push'](_0x3d1678['shift']());}};_0x337804(++_0x28cdc5);}(_0x88c7,0x1ae));var _0x788c=function(_0xe30f52,_0x231130){_0xe30f52=_0xe30f52-0x0;var _0x609ec0=_0x88c7[_0xe30f52];return _0x609ec0;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x788c('0x0'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x788c('0x1'));var RpcVoiceCallReport=require(_0x788c('0x2'));var RpcVoiceDialReport=require(_0x788c('0x3'));var RpcMemberReport=require(_0x788c('0x4'));var RpcVoiceQueueReport=require(_0x788c('0x5'));var RpcVoiceRecording=require(_0x788c('0x6'));var RpcVoiceTransferReport=require(_0x788c('0x7'));var VoiceQueueReport=require(_0x788c('0x8'));var VoiceCallReport=require(_0x788c('0x9'));var VoiceAgentReport=require(_0x788c('0xa'));var VoiceDialReport=require(_0x788c('0xb'));var UserReport=require(_0x788c('0xc'));function Report(_0x39e747){this['realtime']=_0x39e747;this['agents']=_0x39e747[_0x788c('0xd')];this['telephones']=_0x39e747[_0x788c('0xe')];}Report[_0x788c('0xf')][_0x788c('0x10')]=function(_0x54abe7){var _0x5e4b97=new VoiceQueueReport(this[_0x788c('0x11')]);var _0x21ae72=new VoiceAgentReport(this[_0x788c('0x11')]);var _0x423737=new VoiceDialReport(this[_0x788c('0x11')]);var _0x1ccfb2=new VoiceCallReport(this['realtime']);var _0x38bcf6=new UserReport(this[_0x788c('0x11')]);if(config[_0x788c('0x12')]&&config[_0x788c('0x12')][_0x788c('0x13')]){ami['on']('custom:voiceQueueReport',this[_0x788c('0x14')]['bind'](this));ami['on'](_0x788c('0x15'),this[_0x788c('0x16')][_0x788c('0x17')](this));ami['on'](_0x788c('0x18'),this[_0x788c('0x19')][_0x788c('0x17')](this));ami['on'](_0x788c('0x1a'),this[_0x788c('0x1b')][_0x788c('0x17')](this));ami['on'](_0x788c('0x1c'),this[_0x788c('0x1d')][_0x788c('0x17')](this));ami['on'](_0x788c('0x1e'),this[_0x788c('0x1f')]['bind'](this));}};Report[_0x788c('0xf')][_0x788c('0x20')]=function(_0x4b2661){var _0x16a7b5;_0x16a7b5=_[_0x788c('0x21')](this[_0x788c('0xd')],function(_0x788edd){return _0x788edd[_0x788c('0x22')]==_0x4b2661||_0x788edd['name']==_0x4b2661;});if(_[_0x788c('0x23')](_0x16a7b5)){var _0x354ba7=_[_0x788c('0x21')](this[_0x788c('0xe')],function(_0x519076){return _0x519076[_0x788c('0x22')]==_0x4b2661||_0x519076[_0x788c('0x24')]==_0x4b2661;});if(_0x354ba7){_0x16a7b5=_[_0x788c('0x21')](this[_0x788c('0xd')],function(_0x870630){return _0x870630[_0x788c('0x25')]==util[_0x788c('0x26')](_0x788c('0x27'),_0x354ba7[_0x788c('0x24')]);});}}return _0x16a7b5;};Report[_0x788c('0xf')][_0x788c('0x14')]=function(_0x493726){for(var _0x4401cf=0x0;_0x4401cf<_0x493726['length'];_0x4401cf+=0x1){var _0x2b6f69=this['findAgent'](_0x493726[_0x4401cf][_0x788c('0x28')]);if(_0x2b6f69){_0x493726[_0x4401cf]['accountcode']=_0x2b6f69[_0x788c('0x22')];_0x493726[_0x4401cf][_0x788c('0x29')]=!![];_0x493726[_0x4401cf][_0x788c('0x2a')]=_0x2b6f69[_0x788c('0x24')];_0x493726[_0x4401cf][_0x788c('0x25')]=_['isNil'](_0x2b6f69[_0x788c('0x25')])?util[_0x788c('0x26')](_0x788c('0x27'),_0x2b6f69['name']):_0x2b6f69[_0x788c('0x25')];if(_0x493726[_0x4401cf][_0x788c('0x2b')]){_0x493726[_0x4401cf][_0x788c('0x2c')]=moment()['format'](_0x788c('0x2d'));}if(_0x493726[_0x4401cf]['queuecallerexit']){_0x493726[_0x4401cf][_0x788c('0x2e')]=moment()[_0x788c('0x26')](_0x788c('0x2d'));}RpcMemberReport[_0x788c('0x14')](_0x493726[_0x4401cf]);}RpcVoiceQueueReport[_0x788c('0x2f')](_0x493726[_0x4401cf]);}};function extractCalleridNumber(_0x26d418){var _0x53d1b5=_0x26d418[_0x788c('0x30')](/<(.*?)>/);return _0x53d1b5?_0x53d1b5[0x1]:_0x26d418;}Report[_0x788c('0xf')][_0x788c('0x31')]=function(_0x586058){for(var _0x105365=0x0;_0x105365',_0x19e621['calleridname'],_0x19e621[_0x788c('0x41')]);}if(RpcVoiceTransferReport[_0x788c('0x47')][_0x19e621[_0x788c('0x48')]]){var _0x16298b=RpcVoiceTransferReport[_0x788c('0x47')][_0x19e621[_0x788c('0x48')]];_0x16298b[_0x788c('0x49')]=_0x19e621['uniqueid'];RpcVoiceTransferReport[_0x788c('0x1d')](_0x16298b);delete RpcVoiceTransferReport[_0x788c('0x47')][_0x19e621[_0x788c('0x48')]];}if(_[_0x788c('0x23')](_0x19e621[_0x788c('0x4a')])){_0x19e621[_0x788c('0x4a')]=this[_0x788c('0x4b')](_0x19e621);}if(_['isNil'](_0x19e621[_0x788c('0x4c')])){var _0x50c603=_0x19e621[_0x788c('0x43')]['split']('-')[0x0];var _0xf35389=this[_0x788c('0xd')][_0x50c603];if(!_0xf35389)_0xf35389=this['getAgentByInternal'](_0x19e621[_0x788c('0x22')]);if(_0xf35389){_0x19e621[_0x788c('0x4c')]=_0xf35389['id'];_0x19e621[_0x788c('0x4d')]=_0xf35389[_0x788c('0x24')];}}RpcVoiceCallReport[_0x788c('0x2f')](_0x19e621);if(_0x19e621[_0x788c('0x4e')]){for(var _0x1b349b=0x0;_0x1b349b<_0x19e621[_0x788c('0x4f')]['length'];_0x1b349b+=0x1){_0x19e621[_0x788c('0x50')]=_0x19e621[_0x788c('0x4f')][_0x1b349b][_0x788c('0x51')];_0x19e621[_0x788c('0x52')]=_0x19e621['monitors'][_0x1b349b][_0x788c('0x52')];if(_0x19e621['exten']=='xcally-motion-preview'){_0x19e621[_0x788c('0x41')]=_0x19e621['connectedlinenum'];_0x19e621[_0x788c('0x53')]=_0x19e621[_0x788c('0x54')];_0x19e621[_0x788c('0x28')]=_0x19e621[_0x788c('0x22')];_0x19e621[_0x788c('0x54')]=_0x19e621[_0x788c('0x4d')];_0x19e621[_0x788c('0x38')]=_0x19e621[_0x788c('0x55')];}else if(_0x19e621[_0x788c('0x38')]==_0x788c('0x56')){_0x19e621[_0x788c('0x41')]=_0x19e621[_0x788c('0x37')];_0x19e621[_0x788c('0x38')]=_0x19e621[_0x788c('0x55')];}RpcVoiceRecording[_0x788c('0x2f')](_0x19e621);}}};Report[_0x788c('0xf')][_0x788c('0x19')]=function(_0x47ace2){if(_[_0x788c('0x57')](_0x47ace2)){_0x47ace2[_0x788c('0x58')](function(_0x1426ca){RpcVoiceAgentReport[_0x788c('0x2f')](_0x1426ca);});}else{RpcVoiceAgentReport[_0x788c('0x2f')](_0x47ace2);}};Report[_0x788c('0xf')][_0x788c('0x1b')]=function(_0x28362e){RpcVoiceDialReport[_0x788c('0x2f')](_0x28362e);var _0x301c33;var _0x39766e;var _0x40da1f=_0x28362e[_0x788c('0x43')];if(_[_0x788c('0x59')](_0x40da1f,_0x788c('0x5a'))){_0x39766e=_0x40da1f[_0x788c('0x5b')](_0x40da1f['indexOf']('/')+0x1,_0x40da1f[_0x788c('0x5c')]('@'));_0x301c33=_[_0x788c('0x21')](this[_0x788c('0xd')],function(_0x2aa9c4){return _0x2aa9c4['mobile']==_0x39766e||_0x2aa9c4[_0x788c('0x5d')]==_0x39766e||_0x2aa9c4[_0x788c('0x22')]==_0x39766e;});}else{_0x39766e=_0x40da1f[_0x788c('0x5b')](_0x40da1f[_0x788c('0x5c')]('/')+0x1,_0x40da1f[_0x788c('0x5e')]('-'));_0x301c33=this[_0x788c('0x20')](_0x39766e);}if(_0x301c33){_0x28362e[_0x788c('0x25')]=_[_0x788c('0x23')](_0x301c33[_0x788c('0x25')])?util['format']('SIP/%s',_0x301c33['name']):_0x301c33[_0x788c('0x25')];_0x28362e[_0x788c('0x4d')]=_0x301c33[_0x788c('0x24')];_0x28362e[_0x788c('0x22')]=_0x301c33[_0x788c('0x22')];RpcMemberReport[_0x788c('0x1b')](_0x28362e);}};Report[_0x788c('0xf')][_0x788c('0x1d')]=function(_0x233661){RpcVoiceTransferReport[_0x788c('0x47')][_0x233661[_0x788c('0x5f')]]=_0x233661;};Report['prototype'][_0x788c('0x1f')]=function(_0x1460b4){RpcVoiceTransferReport['attendedTransfer'](_0x1460b4);};module['exports']=Report; \ No newline at end of file +var _0xf734=['custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','agents','name','find','interface','format','SIP/%s','length','connectedlinenum','accountcode','assigned','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','match','getAgentByInternal','keys','channel','split','calleridnum','outbound','internal','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','getCallType','isNil','UserId','membername','create','monitor','monitors','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','Local','indexOf','mobile','lastIndexOf','exports','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','telephones','prototype','sync','realtime','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport'];(function(_0x23e702,_0x292e9c){var _0x328796=function(_0x4b0255){while(--_0x4b0255){_0x23e702['push'](_0x23e702['shift']());}};_0x328796(++_0x292e9c);}(_0xf734,0x101));var _0x4f73=function(_0xa7ef49,_0x240cb0){_0xa7ef49=_0xa7ef49-0x0;var _0x21e399=_0xf734[_0xa7ef49];return _0x21e399;};'use strict';var _=require('lodash');var moment=require(_0x4f73('0x0'));var util=require(_0x4f73('0x1'));var config=require(_0x4f73('0x2'));var ami=require(_0x4f73('0x3'));var RpcVoiceAgentReport=require(_0x4f73('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x4f73('0x5'));var RpcVoiceQueueReport=require(_0x4f73('0x6'));var RpcVoiceRecording=require(_0x4f73('0x7'));var RpcVoiceTransferReport=require(_0x4f73('0x8'));var VoiceQueueReport=require(_0x4f73('0x9'));var VoiceCallReport=require(_0x4f73('0xa'));var VoiceAgentReport=require(_0x4f73('0xb'));var VoiceDialReport=require(_0x4f73('0xc'));var UserReport=require(_0x4f73('0xd'));function Report(_0x1b4e8f){this['realtime']=_0x1b4e8f;this['agents']=_0x1b4e8f['agents'];this[_0x4f73('0xe')]=_0x1b4e8f[_0x4f73('0xe')];}Report[_0x4f73('0xf')][_0x4f73('0x10')]=function(_0x9f692f){var _0x1e568e=new VoiceQueueReport(this['realtime']);var _0x5b5e88=new VoiceAgentReport(this[_0x4f73('0x11')]);var _0x278af1=new VoiceDialReport(this[_0x4f73('0x11')]);var _0x4b826c=new VoiceCallReport(this[_0x4f73('0x11')]);var _0x5fb9fe=new UserReport(this[_0x4f73('0x11')]);if(config[_0x4f73('0x12')]&&config['xdr'][_0x4f73('0x13')]){ami['on']('custom:voiceQueueReport',this[_0x4f73('0x14')][_0x4f73('0x15')](this));ami['on'](_0x4f73('0x16'),this[_0x4f73('0x17')][_0x4f73('0x15')](this));ami['on']('custom:voiceAgentReport',this[_0x4f73('0x18')]['bind'](this));ami['on'](_0x4f73('0x19'),this[_0x4f73('0x1a')][_0x4f73('0x15')](this));ami['on'](_0x4f73('0x1b'),this[_0x4f73('0x1c')][_0x4f73('0x15')](this));ami['on'](_0x4f73('0x1d'),this[_0x4f73('0x1e')][_0x4f73('0x15')](this));}};Report[_0x4f73('0xf')][_0x4f73('0x1f')]=function(_0x555768){var _0x4f9610;_0x4f9610=_['find'](this[_0x4f73('0x20')],function(_0x19890e){return _0x19890e['accountcode']==_0x555768||_0x19890e[_0x4f73('0x21')]==_0x555768;});if(_['isNil'](_0x4f9610)){var _0x4555ed=_['find'](this[_0x4f73('0xe')],function(_0x207344){return _0x207344['accountcode']==_0x555768||_0x207344[_0x4f73('0x21')]==_0x555768;});if(_0x4555ed){_0x4f9610=_[_0x4f73('0x22')](this[_0x4f73('0x20')],function(_0xe42f07){return _0xe42f07[_0x4f73('0x23')]==util[_0x4f73('0x24')](_0x4f73('0x25'),_0x4555ed[_0x4f73('0x21')]);});}}return _0x4f9610;};Report['prototype']['voiceQueueReport']=function(_0x4da43b){for(var _0xf71739=0x0;_0xf71739<_0x4da43b[_0x4f73('0x26')];_0xf71739+=0x1){var _0x4e176f=this[_0x4f73('0x1f')](_0x4da43b[_0xf71739][_0x4f73('0x27')]);if(_0x4e176f){_0x4da43b[_0xf71739][_0x4f73('0x28')]=_0x4e176f['accountcode'];_0x4da43b[_0xf71739][_0x4f73('0x29')]=!![];_0x4da43b[_0xf71739]['lastAssignedTo']=_0x4e176f['name'];_0x4da43b[_0xf71739][_0x4f73('0x23')]=_['isNil'](_0x4e176f[_0x4f73('0x23')])?util[_0x4f73('0x24')](_0x4f73('0x25'),_0x4e176f[_0x4f73('0x21')]):_0x4e176f[_0x4f73('0x23')];if(_0x4da43b[_0xf71739][_0x4f73('0x2a')]){_0x4da43b[_0xf71739][_0x4f73('0x2b')]=moment()['format'](_0x4f73('0x2c'));}if(_0x4da43b[_0xf71739][_0x4f73('0x2d')]){_0x4da43b[_0xf71739]['queuecallerexitAt']=moment()[_0x4f73('0x24')](_0x4f73('0x2c'));}RpcMemberReport[_0x4f73('0x14')](_0x4da43b[_0xf71739]);}RpcVoiceQueueReport['create'](_0x4da43b[_0xf71739]);}};function extractCalleridNumber(_0x3e7a74){var _0xc04915=_0x3e7a74[_0x4f73('0x2e')](/<(.*?)>/);return _0xc04915?_0xc04915[0x1]:_0x3e7a74;}Report[_0x4f73('0xf')][_0x4f73('0x2f')]=function(_0x33408f){for(var _0x4cdf9e=0x0;_0x4cdf9e0x0?!![]:![];if(!_0x21516f){return this['syncQueueSummaryComplete'](this[_0xd7a8('0x14')][_0xd7a8('0x6e')]);}};VoiceQueueReport['prototype'][_0xd7a8('0x1b')]=function(_0x57bd0c){var _0x565d2c=this[_0xd7a8('0x14')]['id'];if(this[_0xd7a8('0x14')][_0xd7a8('0x66')][_0x565d2c]&&this['summary'][_0xd7a8('0x66')][_0x565d2c][_0x57bd0c[_0xd7a8('0x65')]]){this['summary']['queuestatus'][_0x565d2c][_0x57bd0c[_0xd7a8('0x65')]][_0xd7a8('0xf')][_0xd7a8('0x6f')](_0x57bd0c);}};VoiceQueueReport[_0xd7a8('0x45')][_0xd7a8('0x17')]=function(_0x41c791){var _0x2572b8=this;try{if(this[_0xd7a8('0x5d')](_0x41c791)&&this[_0xd7a8('0x5d')](_0x41c791[_0xd7a8('0x50')])){logger[_0xd7a8('0x4c')](_0xd7a8('0x70'),util['inspect'](_0x41c791,{'showHidden':![],'depth':null}));var _0x1efe39=this[_0xd7a8('0x12')][_0x41c791[_0xd7a8('0x50')]];if(_0x1efe39){logger['info']('[voiceQueueReport][queuesummary]\x20name:%s',_0x1efe39[_0xd7a8('0x5c')]);this[_0xd7a8('0x14')][_0xd7a8('0x61')][_0x1efe39['name']]={'summaryEvent':_0x41c791};this['summary'][_0xd7a8('0x71')]+=0x1;return ami[_0xd7a8('0x3b')]({'action':_0xd7a8('0x66'),'queue':_0x1efe39[_0xd7a8('0x5c')]})[_0xd7a8('0x64')](function(_0x18da44){if(!_0x2572b8[_0xd7a8('0x14')]['queuestatus'][_0x41c791[_0xd7a8('0x65')]]){_0x2572b8[_0xd7a8('0x14')]['queuestatus'][_0x41c791[_0xd7a8('0x65')]]={};}_0x2572b8[_0xd7a8('0x14')]['queuestatus'][_0x41c791[_0xd7a8('0x65')]][_0x18da44['actionid']]={'queue':_0x1efe39['name'],'agents':[]};})[_0xd7a8('0x3d')](function(_0x43a49c){throw _0x43a49c;});}}}catch(_0x81361a){logger[_0xd7a8('0x40')](_0xd7a8('0x67'),util['inspect'](_0x81361a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd7a8('0x45')]['syncQueueSummaryComplete']=function(_0x4e78d3){if(this[_0xd7a8('0x14')][_0xd7a8('0x71')]>0x0){this['summary'][_0xd7a8('0x6e')]=_0x4e78d3;return;}logger['debug'](_0xd7a8('0x72'),util[_0xd7a8('0x42')](_0x4e78d3,{'showHidden':![],'depth':null}));this[_0xd7a8('0x14')]=initializeSummary();ami[_0xd7a8('0x4a')](_0xd7a8('0x73'),{});};VoiceQueueReport[_0xd7a8('0x45')][_0xd7a8('0x1e')]=function(_0x36886b){try{if(this[_0xd7a8('0x5d')](_0x36886b)){logger[_0xd7a8('0x4c')](_0xd7a8('0x74'),_0x36886b[_0xd7a8('0x75')],util[_0xd7a8('0x42')](_0x36886b,{'showHidden':![],'depth':null}));if(_[_0xd7a8('0x5e')](this[_0xd7a8('0xd')][_0x36886b['uniqueid']])){this['queueReports'][_0x36886b['uniqueid']]=[];}if(_['isUndefined'](this[_0xd7a8('0x10')][_0x36886b[_0xd7a8('0x75')]])){this['channels'][_0x36886b[_0xd7a8('0x75')]]={};}var _0xee75fa=new QueueReport();_0xee75fa['queue']=_0x36886b[_0xd7a8('0x50')];_0xee75fa[_0xd7a8('0x5a')]=this[_0xd7a8('0x12')][_0xee75fa[_0xd7a8('0x50')]]&&this[_0xd7a8('0x12')][_0xee75fa['queue']]['type']?this[_0xd7a8('0x12')][_0xee75fa['queue']][_0xd7a8('0x5a')]||_0xd7a8('0x76'):'inbound';_0xee75fa[_0xd7a8('0x77')]=moment()[_0xd7a8('0x4f')](_0xd7a8('0x78'));_0xee75fa['position']=_0x36886b[_0xd7a8('0x79')];_0xee75fa[_0xd7a8('0x7a')]=_0x36886b[_0xd7a8('0x7a')];_0xee75fa['uniqueid']=_0x36886b[_0xd7a8('0x75')];_0xee75fa[_0xd7a8('0x7b')]=this[_0xd7a8('0x10')][_0x36886b[_0xd7a8('0x75')]][_0xd7a8('0x7b')];logger[_0xd7a8('0x7c')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0xee75fa[_0xd7a8('0x50')],_0xee75fa[_0xd7a8('0x5a')]);_[_0xd7a8('0x7d')](_0xee75fa,_[_0xd7a8('0x7e')](_0x36886b,_[_0xd7a8('0x7f')](_0xee75fa)));this[_0xd7a8('0xd')][_0x36886b['uniqueid']][_0xd7a8('0x6f')](_0xee75fa);this[_0xd7a8('0x10')][_0x36886b[_0xd7a8('0x75')]]=_0xee75fa;this[_0xd7a8('0x4b')](_0xee75fa,_0xd7a8('0x1d'));}}catch(_0x275a61){logger['error'](_0xd7a8('0x74'),_0x36886b[_0xd7a8('0x75')],util['inspect'](_0x275a61,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd7a8('0x45')][_0xd7a8('0x1f')]=function(_0x393143){try{if(this[_0xd7a8('0x5d')](_0x393143)){logger[_0xd7a8('0x4c')]('[%s][voiceQueueReport][queuecallerabandon]',_0x393143[_0xd7a8('0x75')],util['inspect'](_0x393143,{'showHidden':![],'depth':null}));if(this[_0xd7a8('0xd')][_0x393143[_0xd7a8('0x75')]]){var _0x483b6e=_[_0xd7a8('0x80')](this['queueReports'][_0x393143[_0xd7a8('0x75')]]);_0x483b6e[_0xd7a8('0x81')]=![];_0x483b6e[_0xd7a8('0x82')]=null;_0x483b6e[_0xd7a8('0x83')]=_0x393143[_0xd7a8('0x83')];_0x483b6e[_0xd7a8('0x84')]=_0x393143[_0xd7a8('0x84')];_0x483b6e[_0xd7a8('0x85')]=!![];_0x483b6e[_0xd7a8('0x86')]=moment()['format'](_0xd7a8('0x78'));_0x483b6e[_0xd7a8('0x54')]=_0xd7a8('0x87');_0x483b6e[_0xd7a8('0x88')]=null;logger[_0xd7a8('0x7c')](_0xd7a8('0x89'),_0x483b6e['queue'],_0x483b6e[_0xd7a8('0x5a')]);this[_0xd7a8('0x10')][_0x393143['uniqueid']]=_0x483b6e;this['emitVoiceQueueChannelRemove'](_0x483b6e,_0xd7a8('0x85'));}}}catch(_0x7fa7df){logger[_0xd7a8('0x40')]('[%s][voiceQueueReport][queuecallerabandon]',_0x393143[_0xd7a8('0x75')],util[_0xd7a8('0x42')](_0x7fa7df,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd7a8('0x21')]=function(_0x38d917){try{if(this[_0xd7a8('0x5d')](_0x38d917)){logger[_0xd7a8('0x4c')](_0xd7a8('0x8a'),_0x38d917[_0xd7a8('0x75')],util[_0xd7a8('0x42')](_0x38d917,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x38d917[_0xd7a8('0x75')]]){var _0x3b24e2=_[_0xd7a8('0x80')](this['queueReports'][_0x38d917[_0xd7a8('0x75')]]);_0x3b24e2[_0xd7a8('0x8b')]=moment()[_0xd7a8('0x4f')](_0xd7a8('0x78'));_0x3b24e2[_0xd7a8('0x8c')]=_0x38d917[_0xd7a8('0x8c')];_0x3b24e2[_0xd7a8('0x8d')]=_0x38d917[_0xd7a8('0x8d')];logger[_0xd7a8('0x7c')](_0xd7a8('0x8e'),_0x3b24e2[_0xd7a8('0x50')],_0x3b24e2[_0xd7a8('0x5a')],_0x38d917['connectedlinenum'],_0x38d917[_0xd7a8('0x8d')]);this[_0xd7a8('0x10')][_0x38d917[_0xd7a8('0x75')]]=_0x3b24e2;this[_0xd7a8('0x4b')](_0x3b24e2,'queuecallerleave');}}}catch(_0x2df2f4){logger['error'](_0xd7a8('0x8a'),_0x38d917[_0xd7a8('0x75')],util[_0xd7a8('0x42')](_0x2df2f4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd7a8('0x25')]=function(_0x5091db){try{if(this[_0xd7a8('0x5d')](_0x5091db)){logger['debug'](_0xd7a8('0x8f'),_0x5091db[_0xd7a8('0x75')],util[_0xd7a8('0x42')](_0x5091db,{'showHidden':![],'depth':null}));if(this[_0xd7a8('0xd')][_0x5091db[_0xd7a8('0x75')]]){var _0x2c3d3f=_[_0xd7a8('0x80')](this['queueReports'][_0x5091db[_0xd7a8('0x75')]]);_0x2c3d3f[_0xd7a8('0x81')]=!![];_0x2c3d3f[_0xd7a8('0x54')]=_0xd7a8('0x90');logger[_0xd7a8('0x7c')](_0xd7a8('0x91'),_0x2c3d3f['queue'],_0x2c3d3f['type']);}}}catch(_0x59e2e7){logger['error'](_0xd7a8('0x8f'),_0x5091db['uniqueid'],util[_0xd7a8('0x42')](_0x59e2e7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd7a8('0x23')]=function(_0x2a69ae){try{if(this[_0xd7a8('0x5d')](_0x2a69ae)){logger[_0xd7a8('0x4c')]('[%s][voiceQueueReport][agentcomplete]',_0x2a69ae[_0xd7a8('0x75')],util[_0xd7a8('0x42')](_0x2a69ae,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2a69ae[_0xd7a8('0x75')]]){var _0x42043a=_[_0xd7a8('0x80')](this[_0xd7a8('0xd')][_0x2a69ae[_0xd7a8('0x75')]]);_0x42043a['queuecallerabandon']=![];_0x42043a['queuecallerabandonAt']=null;_0x42043a[_0xd7a8('0x92')]=!![];_0x42043a[_0xd7a8('0x88')]=_0x2a69ae[_0xd7a8('0x93')];_0x42043a['holdtime']=_0x2a69ae[_0xd7a8('0x83')];_0x42043a[_0xd7a8('0x81')]=!![];_0x42043a[_0xd7a8('0x94')]=![];_0x42043a[_0xd7a8('0x95')]=null;if(!_0x42043a[_0xd7a8('0x96')]){if(_0x2a69ae[_0xd7a8('0x97')]=='transfer'){_0x42043a[_0xd7a8('0x54')]='COMPLETED';logger['info'](_0xd7a8('0x98'),_0x42043a[_0xd7a8('0x50')],_0x42043a[_0xd7a8('0x5a')]);}else{if(_[_0xd7a8('0x99')](_0x2a69ae[_0xd7a8('0x9a')]['toLowerCase'](),_0xd7a8('0x9b'))){if(this[_0xd7a8('0xd')][_0x2a69ae[_0xd7a8('0x9c')]]){var _0x18e055=_[_0xd7a8('0x80')](this[_0xd7a8('0xd')][_0x2a69ae[_0xd7a8('0x9c')]]);_0x18e055[_0xd7a8('0x81')]=![];_0x18e055['queuecallerexit']=!![];_0x18e055[_0xd7a8('0x95')]=moment(_0x42043a[_0xd7a8('0x77')])['add'](_0x2a69ae['holdtime'],'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');_0x18e055[_0xd7a8('0x54')]=_0xd7a8('0x9d');_0x18e055[_0xd7a8('0x96')]=!![];_0x18e055[_0xd7a8('0x9e')]='FORWARD';_0x18e055[_0xd7a8('0x9f')]=_0x2a69ae['destexten'];_0x18e055[_0xd7a8('0xa0')]=_0x2a69ae['uniqueid'];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x18e055[_0xd7a8('0x50')],_0x18e055[_0xd7a8('0x5a')]);var _0x1d3cb1=this[_0xd7a8('0xd')][_0x2a69ae[_0xd7a8('0x9c')]];this['queueReports'][_0x2a69ae[_0xd7a8('0x9c')]]=this['queueReports'][_0x2a69ae[_0xd7a8('0x75')]];this[_0xd7a8('0xd')][_0x2a69ae['uniqueid']]=_0x1d3cb1;}}else{_0x42043a[_0xd7a8('0x54')]=_0xd7a8('0xa1')+_0x2a69ae['reason'][_0xd7a8('0xa2')]();logger[_0xd7a8('0x7c')](_0xd7a8('0xa3'),_0x42043a[_0xd7a8('0x50')],_0x42043a[_0xd7a8('0x5a')],_0x42043a[_0xd7a8('0x54')]);}}}this[_0xd7a8('0x10')][_0x2a69ae['uniqueid']]=_0x42043a;}}}catch(_0x547852){logger[_0xd7a8('0x40')]('[%s][voiceQueueReport][agentcomplete]',_0x2a69ae[_0xd7a8('0x75')],util['inspect'](_0x547852,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd7a8('0x45')]['syncVarSet']=function(_0x849a33){try{if(this['isNotNull'](_0x849a33)){logger[_0xd7a8('0x4c')](_0xd7a8('0xa4'),_0x849a33[_0xd7a8('0x75')],util[_0xd7a8('0x42')](_0x849a33,{'showHidden':![],'depth':null}));this[_0xd7a8('0xa5')](_0x849a33['uniqueid'],_[_0xd7a8('0x7f')](_0x849a33[_0xd7a8('0xa6')])[0x0],_0x849a33[_0xd7a8('0xa7')]);if(this['queueReports'][_0x849a33[_0xd7a8('0x75')]]){var _0x593c78=_[_0xd7a8('0x80')](this[_0xd7a8('0xd')][_0x849a33[_0xd7a8('0x75')]]);if(_0x593c78){if(this[_0xd7a8('0x5d')](_0x849a33['variable'])&&this[_0xd7a8('0x5d')](_0x849a33['variable'][_0xd7a8('0x66')])){switch(_0x849a33[_0xd7a8('0xa7')]){case _0xd7a8('0xa8'):_0x593c78[_0xd7a8('0x94')]=![];_0x593c78[_0xd7a8('0x95')]=null;break;case'TIMEOUT':_0x593c78['lastevent']=_0xd7a8('0xa9');_0x593c78[_0xd7a8('0x94')]=!![];_0x593c78['queuecallerexitAt']=moment()[_0xd7a8('0x4f')](_0xd7a8('0x78'));_0x593c78[_0xd7a8('0x8b')]=moment()[_0xd7a8('0x4f')](_0xd7a8('0x78'));logger[_0xd7a8('0x4c')](_0xd7a8('0xaa'),_0x849a33[_0xd7a8('0x75')],util[_0xd7a8('0x42')](_0x593c78,{'showHidden':![],'depth':null}));ami[_0xd7a8('0x4a')](_0xd7a8('0xab'),_0x593c78);break;default:_0x593c78[_0xd7a8('0x94')]=!![];_0x593c78[_0xd7a8('0x95')]=moment()[_0xd7a8('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x593c78['queuecallerleaveAt']=moment()[_0xd7a8('0x4f')](_0xd7a8('0x78'));}_0x593c78[_0xd7a8('0x85')]=![];_0x593c78[_0xd7a8('0x86')]=null;_0x593c78[_0xd7a8('0x54')]=_0x849a33[_0xd7a8('0xa7')];this[_0xd7a8('0x10')][_0x849a33['uniqueid']]=_0x593c78;this[_0xd7a8('0x48')](_0x593c78,_0xd7a8('0x26'));}else if(this['isNotNull'](_0x849a33['variable'])&&this[_0xd7a8('0x5d')](_0x849a33[_0xd7a8('0xa6')][_0xd7a8('0xac')])){if(!_0x593c78['queuecallerabandon']){_0x593c78[_0xd7a8('0x94')]=!![];_0x593c78[_0xd7a8('0x95')]=moment()[_0xd7a8('0x4f')](_0xd7a8('0x78'));_0x593c78['queuecallerexitreason']=_0xd7a8('0xad');_0x593c78[_0xd7a8('0x8b')]=moment()[_0xd7a8('0x4f')](_0xd7a8('0x78'));this[_0xd7a8('0x10')][_0x849a33[_0xd7a8('0x75')]]=_0x593c78;}}logger[_0xd7a8('0x7c')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x849a33['uniqueid'],_0x593c78[_0xd7a8('0x50')],_0x593c78['type'],_[_0xd7a8('0x7f')](_0x849a33[_0xd7a8('0xa6')])[0x0],_0x849a33[_0xd7a8('0xa7')]);_0x593c78[_0xd7a8('0x15')]=this[_0xd7a8('0x15')][_0x849a33[_0xd7a8('0x75')]];}}}}catch(_0x2cb8b4){logger['error'](_0xd7a8('0xa4'),_0x849a33[_0xd7a8('0x75')],util[_0xd7a8('0x42')](_0x2cb8b4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd7a8('0x45')][_0xd7a8('0xa5')]=function(_0x26e7f1,_0x4bedb4,_0xd26b5c){var _0x4f2542=['rtpaudioqos',_0xd7a8('0xae'),_0xd7a8('0xaf'),_0xd7a8('0xb0'),_0xd7a8('0xb1'),_0xd7a8('0xb2'),_0xd7a8('0xb3'),'rtpaudioqosrttbridged',_0xd7a8('0xb4'),_0xd7a8('0xb5'),'bridgepeer',_0xd7a8('0xb6'),_0xd7a8('0xb7'),'memberdynamic',_0xd7a8('0xb8'),_0xd7a8('0xb9'),_0xd7a8('0x93'),_0xd7a8('0xba'),_0xd7a8('0xbb')];if(!_[_0xd7a8('0xbc')](_0x4bedb4)&&!_[_0xd7a8('0xbd')](_0x4f2542,_0x4bedb4)){if(_[_0xd7a8('0x5e')](this[_0xd7a8('0x15')][_0x26e7f1])){this['variables'][_0x26e7f1]={};}this['variables'][_0x26e7f1][_0x4bedb4]=_0xd26b5c;}};VoiceQueueReport[_0xd7a8('0x45')][_0xd7a8('0xbe')]=function(_0xc25c1,_0xf2faaa,_0x804f76){var _0x35c12c={};for(var _0x497a8d=0x0;_0x497a8d0x0?!![]:![];if(!_0x5ce2c5){return this[_0x1ab2('0x19')](this[_0x1ab2('0x15')][_0x1ab2('0x70')]);}};VoiceQueueReport[_0x1ab2('0xc')][_0x1ab2('0x71')]=function(_0x100e4a){var _0x10a5c7=this['summary']['id'];if(this[_0x1ab2('0x15')][_0x1ab2('0x6b')][_0x10a5c7]&&this[_0x1ab2('0x15')][_0x1ab2('0x6b')][_0x10a5c7][_0x100e4a[_0x1ab2('0x63')]]){this[_0x1ab2('0x15')]['queuestatus'][_0x10a5c7][_0x100e4a[_0x1ab2('0x63')]][_0x1ab2('0x11')][_0x1ab2('0x72')](_0x100e4a);}};VoiceQueueReport['prototype']['syncQueueSummary']=function(_0x33ae0e){var _0x428899=this;try{if(this[_0x1ab2('0x73')](_0x33ae0e)&&this[_0x1ab2('0x73')](_0x33ae0e[_0x1ab2('0x56')])){logger[_0x1ab2('0x4d')](_0x1ab2('0x74'),util[_0x1ab2('0x44')](_0x33ae0e,{'showHidden':![],'depth':null}));var _0x3e9376=this[_0x1ab2('0x13')][_0x33ae0e['queue']];if(_0x3e9376){logger['info'](_0x1ab2('0x75'),_0x3e9376[_0x1ab2('0x5b')]);this[_0x1ab2('0x15')][_0x1ab2('0x5e')][_0x3e9376['name']]={'summaryEvent':_0x33ae0e};this['summary'][_0x1ab2('0x6f')]+=0x1;return ami['Action']({'action':_0x1ab2('0x6b'),'queue':_0x3e9376[_0x1ab2('0x5b')]})[_0x1ab2('0x76')](function(_0xe08e32){if(!_0x428899['summary'][_0x1ab2('0x6b')][_0x33ae0e[_0x1ab2('0x63')]]){_0x428899['summary'][_0x1ab2('0x6b')][_0x33ae0e[_0x1ab2('0x63')]]={};}_0x428899[_0x1ab2('0x15')]['queuestatus'][_0x33ae0e[_0x1ab2('0x63')]][_0xe08e32[_0x1ab2('0x63')]]={'queue':_0x3e9376[_0x1ab2('0x5b')],'agents':[]};})[_0x1ab2('0x41')](function(_0x249fec){throw _0x249fec;});}}}catch(_0xcff60b){logger[_0x1ab2('0x45')](_0x1ab2('0x64'),util[_0x1ab2('0x44')](_0xcff60b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1ab2('0xc')][_0x1ab2('0x19')]=function(_0x1aec96){if(this['summary'][_0x1ab2('0x6f')]>0x0){this[_0x1ab2('0x15')][_0x1ab2('0x70')]=_0x1aec96;return;}logger[_0x1ab2('0x4d')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x1ab2('0x44')](_0x1aec96,{'showHidden':![],'depth':null}));this[_0x1ab2('0x15')]=initializeSummary();ami[_0x1ab2('0x4c')](_0x1ab2('0x77'),{});};VoiceQueueReport[_0x1ab2('0xc')][_0x1ab2('0x78')]=function(_0x5804d1){try{if(this[_0x1ab2('0x73')](_0x5804d1)){logger[_0x1ab2('0x4d')](_0x1ab2('0x79'),_0x5804d1[_0x1ab2('0x50')],util[_0x1ab2('0x44')](_0x5804d1,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x1ab2('0x10')][_0x5804d1['uniqueid']])){this[_0x1ab2('0x10')][_0x5804d1[_0x1ab2('0x50')]]=[];}if(_[_0x1ab2('0x5c')](this[_0x1ab2('0x3b')][_0x5804d1['uniqueid']])){this[_0x1ab2('0x3b')][_0x5804d1[_0x1ab2('0x50')]]={};}var _0x17415d=new QueueReport();_0x17415d[_0x1ab2('0x56')]=_0x5804d1[_0x1ab2('0x56')];_0x17415d[_0x1ab2('0x6c')]=this[_0x1ab2('0x13')][_0x17415d[_0x1ab2('0x56')]]&&this[_0x1ab2('0x13')][_0x17415d[_0x1ab2('0x56')]][_0x1ab2('0x6c')]?this[_0x1ab2('0x13')][_0x17415d[_0x1ab2('0x56')]][_0x1ab2('0x6c')]||_0x1ab2('0x59'):_0x1ab2('0x59');_0x17415d['queuecallerjoinAt']=moment()[_0x1ab2('0x7a')](_0x1ab2('0x7b'));_0x17415d['position']=_0x5804d1[_0x1ab2('0x7c')];_0x17415d[_0x1ab2('0x7d')]=_0x5804d1[_0x1ab2('0x7d')];_0x17415d['uniqueid']=_0x5804d1['uniqueid'];_0x17415d['routealias']=this['channels'][_0x5804d1[_0x1ab2('0x50')]][_0x1ab2('0x7e')];logger[_0x1ab2('0x7f')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x17415d[_0x1ab2('0x56')],_0x17415d['type']);_[_0x1ab2('0x80')](_0x17415d,_[_0x1ab2('0x81')](_0x5804d1,_[_0x1ab2('0x82')](_0x17415d)));this[_0x1ab2('0x10')][_0x5804d1['uniqueid']][_0x1ab2('0x72')](_0x17415d);this[_0x1ab2('0x3b')][_0x5804d1[_0x1ab2('0x50')]]=_0x17415d;this[_0x1ab2('0x83')](_0x17415d,_0x1ab2('0x1e'));}}catch(_0x4fa0bb){logger['error'](_0x1ab2('0x79'),_0x5804d1[_0x1ab2('0x50')],util[_0x1ab2('0x44')](_0x4fa0bb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1ab2('0xc')][_0x1ab2('0x20')]=function(_0x358e69){try{if(this[_0x1ab2('0x73')](_0x358e69)){logger['debug'](_0x1ab2('0x84'),_0x358e69[_0x1ab2('0x50')],util[_0x1ab2('0x44')](_0x358e69,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x358e69[_0x1ab2('0x50')]]){var _0x30defa=_[_0x1ab2('0x85')](this['queueReports'][_0x358e69[_0x1ab2('0x50')]]);_0x30defa[_0x1ab2('0x86')]=![];_0x30defa['queuecallercompleteAt']=null;_0x30defa[_0x1ab2('0x87')]=_0x358e69[_0x1ab2('0x87')];_0x30defa[_0x1ab2('0x88')]=_0x358e69[_0x1ab2('0x88')];_0x30defa[_0x1ab2('0x1f')]=!![];_0x30defa[_0x1ab2('0x89')]=moment()[_0x1ab2('0x7a')](_0x1ab2('0x7b'));_0x30defa[_0x1ab2('0x8a')]=_0x1ab2('0x8b');_0x30defa[_0x1ab2('0x8c')]=null;logger[_0x1ab2('0x7f')](_0x1ab2('0x8d'),_0x30defa[_0x1ab2('0x56')],_0x30defa[_0x1ab2('0x6c')]);this[_0x1ab2('0x3b')][_0x358e69[_0x1ab2('0x50')]]=_0x30defa;this['emitVoiceQueueChannelRemove'](_0x30defa,_0x1ab2('0x1f'));}}}catch(_0xdcb742){logger[_0x1ab2('0x45')](_0x1ab2('0x84'),_0x358e69[_0x1ab2('0x50')],util[_0x1ab2('0x44')](_0xdcb742,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1ab2('0xc')][_0x1ab2('0x22')]=function(_0x2e1141){try{if(this[_0x1ab2('0x73')](_0x2e1141)){logger[_0x1ab2('0x4d')](_0x1ab2('0x8e'),_0x2e1141[_0x1ab2('0x50')],util['inspect'](_0x2e1141,{'showHidden':![],'depth':null}));if(this[_0x1ab2('0x10')][_0x2e1141[_0x1ab2('0x50')]]){var _0x3edc5c=_[_0x1ab2('0x85')](this[_0x1ab2('0x10')][_0x2e1141[_0x1ab2('0x50')]]);_0x3edc5c['queuecallerleaveAt']=moment()[_0x1ab2('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');_0x3edc5c['connectedlinenum']=_0x2e1141[_0x1ab2('0x8f')];_0x3edc5c[_0x1ab2('0x90')]=_0x2e1141['connectedlinename'];logger[_0x1ab2('0x7f')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x3edc5c[_0x1ab2('0x56')],_0x3edc5c[_0x1ab2('0x6c')],_0x2e1141[_0x1ab2('0x8f')],_0x2e1141[_0x1ab2('0x90')]);this[_0x1ab2('0x3b')][_0x2e1141[_0x1ab2('0x50')]]=_0x3edc5c;this[_0x1ab2('0x83')](_0x3edc5c,_0x1ab2('0x21'));}}}catch(_0x30e931){logger[_0x1ab2('0x45')](_0x1ab2('0x8e'),_0x2e1141['uniqueid'],util['inspect'](_0x30e931,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x1ab2('0x26')]=function(_0x116001){try{if(this['isNotNull'](_0x116001)){logger[_0x1ab2('0x4d')](_0x1ab2('0x91'),_0x116001[_0x1ab2('0x50')],util[_0x1ab2('0x44')](_0x116001,{'showHidden':![],'depth':null}));if(this[_0x1ab2('0x10')][_0x116001[_0x1ab2('0x50')]]){var _0x34e245=_['last'](this[_0x1ab2('0x10')][_0x116001[_0x1ab2('0x50')]]);_0x34e245[_0x1ab2('0x86')]=!![];_0x34e245[_0x1ab2('0x8a')]='COMPLETEDBYAGENT';logger['info'](_0x1ab2('0x92'),_0x34e245['queue'],_0x34e245[_0x1ab2('0x6c')]);}}}catch(_0x4bf817){logger[_0x1ab2('0x45')]('[%s][voiceQueueReport][agentconnect]',_0x116001[_0x1ab2('0x50')],util[_0x1ab2('0x44')](_0x4bf817,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1ab2('0xc')][_0x1ab2('0x24')]=function(_0x1ba474){try{if(this[_0x1ab2('0x73')](_0x1ba474)){logger[_0x1ab2('0x4d')](_0x1ab2('0x93'),_0x1ba474[_0x1ab2('0x50')],util[_0x1ab2('0x44')](_0x1ba474,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1ba474[_0x1ab2('0x50')]]){var _0x4b689a=_[_0x1ab2('0x85')](this[_0x1ab2('0x10')][_0x1ba474[_0x1ab2('0x50')]]);_0x4b689a[_0x1ab2('0x1f')]=![];_0x4b689a[_0x1ab2('0x89')]=null;_0x4b689a[_0x1ab2('0x94')]=!![];_0x4b689a['lastAssignedTo']=_0x1ba474[_0x1ab2('0x95')];_0x4b689a[_0x1ab2('0x87')]=_0x1ba474[_0x1ab2('0x87')];_0x4b689a['queuecallercomplete']=!![];_0x4b689a[_0x1ab2('0x96')]=![];_0x4b689a[_0x1ab2('0x97')]=null;if(!_0x4b689a[_0x1ab2('0x98')]){if(_0x1ba474['reason']==_0x1ab2('0x98')){_0x4b689a[_0x1ab2('0x8a')]=_0x1ab2('0x99');logger[_0x1ab2('0x7f')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x4b689a[_0x1ab2('0x56')],_0x4b689a[_0x1ab2('0x6c')]);}else{if(_[_0x1ab2('0x9a')](_0x1ba474['channel'][_0x1ab2('0x9b')](),_0x1ab2('0x9c'))){if(this[_0x1ab2('0x10')][_0x1ba474[_0x1ab2('0x9d')]]){var _0x93afe2=_[_0x1ab2('0x85')](this['queueReports'][_0x1ba474['linkedid']]);_0x93afe2['queuecallercomplete']=![];_0x93afe2[_0x1ab2('0x96')]=!![];_0x93afe2['queuecallerexitAt']=moment(_0x4b689a[_0x1ab2('0x9e')])[_0x1ab2('0x9f')](_0x1ba474[_0x1ab2('0x87')],_0x1ab2('0xa0'))[_0x1ab2('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');_0x93afe2[_0x1ab2('0x8a')]=_0x1ab2('0xa1');_0x93afe2[_0x1ab2('0x98')]=!![];_0x93afe2[_0x1ab2('0xa2')]=_0x1ab2('0xa3');_0x93afe2[_0x1ab2('0xa4')]=_0x1ba474[_0x1ab2('0xa5')];_0x93afe2[_0x1ab2('0xa6')]=_0x1ba474[_0x1ab2('0x50')];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x93afe2[_0x1ab2('0x56')],_0x93afe2['type']);var _0xf19751=this[_0x1ab2('0x10')][_0x1ba474['linkedid']];this[_0x1ab2('0x10')][_0x1ba474[_0x1ab2('0x9d')]]=this[_0x1ab2('0x10')][_0x1ba474[_0x1ab2('0x50')]];this['queueReports'][_0x1ba474[_0x1ab2('0x50')]]=_0xf19751;}}else{_0x4b689a[_0x1ab2('0x8a')]=_0x1ab2('0xa7')+_0x1ba474[_0x1ab2('0xa8')]['toUpperCase']();logger[_0x1ab2('0x7f')](_0x1ab2('0xa9'),_0x4b689a[_0x1ab2('0x56')],_0x4b689a['type'],_0x4b689a[_0x1ab2('0x8a')]);}}}this[_0x1ab2('0x3b')][_0x1ba474[_0x1ab2('0x50')]]=_0x4b689a;}}}catch(_0x134d96){logger[_0x1ab2('0x45')](_0x1ab2('0x93'),_0x1ba474[_0x1ab2('0x50')],util[_0x1ab2('0x44')](_0x134d96,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x1ab2('0xaa')]=function(_0x2d1c9a){try{if(this['isNotNull'](_0x2d1c9a)){logger[_0x1ab2('0x4d')](_0x1ab2('0xab'),_0x2d1c9a[_0x1ab2('0x50')],util[_0x1ab2('0x44')](_0x2d1c9a,{'showHidden':![],'depth':null}));this[_0x1ab2('0xac')](_0x2d1c9a[_0x1ab2('0x50')],_[_0x1ab2('0x82')](_0x2d1c9a[_0x1ab2('0xad')])[0x0],_0x2d1c9a[_0x1ab2('0xae')]);if(this[_0x1ab2('0x10')][_0x2d1c9a['uniqueid']]){var _0x13bf30=_['last'](this[_0x1ab2('0x10')][_0x2d1c9a[_0x1ab2('0x50')]]);if(_0x13bf30){if(this[_0x1ab2('0x73')](_0x2d1c9a[_0x1ab2('0xad')])&&this['isNotNull'](_0x2d1c9a[_0x1ab2('0xad')]['queuestatus'])){switch(_0x2d1c9a[_0x1ab2('0xae')]){case _0x1ab2('0xaf'):_0x13bf30[_0x1ab2('0x96')]=![];_0x13bf30[_0x1ab2('0x97')]=null;break;case _0x1ab2('0xb0'):_0x13bf30[_0x1ab2('0xb1')]=_0x1ab2('0xb2');_0x13bf30[_0x1ab2('0x96')]=!![];_0x13bf30[_0x1ab2('0x97')]=moment()[_0x1ab2('0x7a')](_0x1ab2('0x7b'));_0x13bf30[_0x1ab2('0xb3')]=moment()['format'](_0x1ab2('0x7b'));logger[_0x1ab2('0x4d')](_0x1ab2('0xb4'),_0x2d1c9a[_0x1ab2('0x50')],util[_0x1ab2('0x44')](_0x13bf30,{'showHidden':![],'depth':null}));ami[_0x1ab2('0x4c')]('custom:timeout',_0x13bf30);break;default:_0x13bf30[_0x1ab2('0x96')]=!![];_0x13bf30[_0x1ab2('0x97')]=moment()['format'](_0x1ab2('0x7b'));_0x13bf30[_0x1ab2('0xb3')]=moment()[_0x1ab2('0x7a')](_0x1ab2('0x7b'));}_0x13bf30[_0x1ab2('0x1f')]=![];_0x13bf30[_0x1ab2('0x89')]=null;_0x13bf30[_0x1ab2('0x8a')]=_0x2d1c9a[_0x1ab2('0xae')];this[_0x1ab2('0x3b')][_0x2d1c9a[_0x1ab2('0x50')]]=_0x13bf30;this[_0x1ab2('0x4a')](_0x13bf30,_0x1ab2('0x27'));}else if(this[_0x1ab2('0x73')](_0x2d1c9a['variable'])&&this[_0x1ab2('0x73')](_0x2d1c9a['variable'][_0x1ab2('0xb5')])){if(!_0x13bf30['queuecallerabandon']){_0x13bf30[_0x1ab2('0x96')]=!![];_0x13bf30[_0x1ab2('0x97')]=moment()[_0x1ab2('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');_0x13bf30[_0x1ab2('0x8a')]='EXITWITHKEY';_0x13bf30['queuecallerleaveAt']=moment()['format'](_0x1ab2('0x7b'));this['channels'][_0x2d1c9a[_0x1ab2('0x50')]]=_0x13bf30;}}logger['info'](_0x1ab2('0xb6'),_0x2d1c9a[_0x1ab2('0x50')],_0x13bf30['queue'],_0x13bf30[_0x1ab2('0x6c')],_['keys'](_0x2d1c9a['variable'])[0x0],_0x2d1c9a['value']);_0x13bf30[_0x1ab2('0x16')]=this[_0x1ab2('0x16')][_0x2d1c9a[_0x1ab2('0x50')]];}}}}catch(_0x61d37f){logger[_0x1ab2('0x45')]('[%s][voiceQueueReport][varset]',_0x2d1c9a[_0x1ab2('0x50')],util[_0x1ab2('0x44')](_0x61d37f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1ab2('0xc')]['addVariable']=function(_0x3d409f,_0x1cdaed,_0x3e3fbe){var _0x215b14=[_0x1ab2('0xb7'),'rtpaudioqosbridged','rtpaudioqosjitter',_0x1ab2('0xb8'),_0x1ab2('0xb9'),'rtpaudioqoslossbridged',_0x1ab2('0xba'),_0x1ab2('0xbb'),_0x1ab2('0xbc'),_0x1ab2('0xbd'),_0x1ab2('0xbe'),_0x1ab2('0xbf'),_0x1ab2('0xc0'),_0x1ab2('0xc1'),'memberinterface',_0x1ab2('0xc2'),_0x1ab2('0x95'),'memberpenalty','memberrealtime'];if(!_[_0x1ab2('0x3d')](_0x1cdaed)&&!_['includes'](_0x215b14,_0x1cdaed)){if(_[_0x1ab2('0x5c')](this[_0x1ab2('0x16')][_0x3d409f])){this[_0x1ab2('0x16')][_0x3d409f]={};}this[_0x1ab2('0x16')][_0x3d409f][_0x1cdaed]=_0x3e3fbe;}};VoiceQueueReport[_0x1ab2('0xc')][_0x1ab2('0xc3')]=function(_0x44e533,_0x27450c,_0x40c775){var _0x5100be={};for(var _0x26f201=0x0;_0x26f201=0x0?moment(_0x2a91f8[_0xf6ca('0x1c')])[_0xf6ca('0x11')](_0x2a91f8[_0xf6ca('0x1b')],_0xf6ca('0x1d')):null,'data1':_0xf6ca('0x1e'),'data2':_0x2a91f8['accountcode'],'data3':_0x2a91f8[_0xf6ca('0x14')],'data4':_0x2a91f8['dialstring']||null,'role':_0xf6ca('0x15'),'internal':_0x2a91f8[_0xf6ca('0x16')]?_[_0xf6ca('0x17')](_0x2a91f8['accountcode']):undefined,'uniqueid':_0x2a91f8[_0xf6ca('0x18')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x3a44=['uniqueid','voiceDialReport','Request','membername','starttime','endtime','outbound','exten','moment','lodash','util','../client','voiceQueueReport','queuecallerexitAt','CreateMemberReport','voice','lastAssignedTo','isNil','format','SIP/%s','interface','TALKING','queuecallerleaveAt','diff','seconds','agent','accountcode','toNumber'];(function(_0x338f60,_0x3eb1f6){var _0x5cda7f=function(_0x1f2e86){while(--_0x1f2e86){_0x338f60['push'](_0x338f60['shift']());}};_0x5cda7f(++_0x3eb1f6);}(_0x3a44,0x94));var _0x43a4=function(_0xd1385d,_0x4a48a1){_0xd1385d=_0xd1385d-0x0;var _0xe2d660=_0x3a44[_0xd1385d];return _0xe2d660;};'use strict';var moment=require(_0x43a4('0x0'));var _=require(_0x43a4('0x1'));var util=require(_0x43a4('0x2'));var client=require(_0x43a4('0x3'));exports[_0x43a4('0x4')]=function(_0x5b4ed6){var _0x224a93=_0x5b4ed6['queuecallercompleteAt']||_0x5b4ed6[_0x43a4('0x5')];return client['Request'](_0x43a4('0x6'),{'body':{'channel':_0x43a4('0x7'),'membername':_0x5b4ed6[_0x43a4('0x8')],'interface':_[_0x43a4('0x9')](_0x5b4ed6['interface'])?util[_0x43a4('0xa')](_0x43a4('0xb'),_0x5b4ed6[_0x43a4('0x8')]):_0x5b4ed6[_0x43a4('0xc')],'type':_0x43a4('0xd'),'enterAt':_0x5b4ed6[_0x43a4('0xe')],'exitAt':_0x224a93,'duration':moment(_0x224a93)[_0x43a4('0xf')](_0x5b4ed6[_0x43a4('0xe')],_0x43a4('0x10')),'data1':'inbound','data2':_0x5b4ed6['calleridnum'],'data3':_0x5b4ed6['exten'],'data4':null,'data5':_0x5b4ed6['queue'],'role':_0x43a4('0x11'),'internal':_0x5b4ed6[_0x43a4('0x12')]?_[_0x43a4('0x13')](_0x5b4ed6['accountcode']):undefined,'uniqueid':_0x5b4ed6[_0x43a4('0x14')]},'log':_0x43a4('0x6')});};exports[_0x43a4('0x15')]=function(_0x153d6e){return client[_0x43a4('0x16')]('CreateMemberReport',{'body':{'channel':_0x43a4('0x7'),'membername':_0x153d6e[_0x43a4('0x17')],'interface':_0x153d6e['interface'],'type':_0x43a4('0xd'),'enterAt':_0x153d6e[_0x43a4('0x18')],'exitAt':_0x153d6e[_0x43a4('0x19')],'duration':moment(_0x153d6e[_0x43a4('0x19')])[_0x43a4('0xf')](_0x153d6e[_0x43a4('0x18')],_0x43a4('0x10'))>=0x0?moment(_0x153d6e[_0x43a4('0x19')])[_0x43a4('0xf')](_0x153d6e[_0x43a4('0x18')],_0x43a4('0x10')):null,'data1':_0x43a4('0x1a'),'data2':_0x153d6e[_0x43a4('0x12')],'data3':_0x153d6e[_0x43a4('0x1b')],'data4':_0x153d6e['dialstring']||null,'role':'agent','internal':_0x153d6e[_0x43a4('0x12')]?_[_0x43a4('0x13')](_0x153d6e[_0x43a4('0x12')]):undefined,'uniqueid':_0x153d6e[_0x43a4('0x14')]},'log':_0x43a4('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 72e2f31..f501f29 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 _0x1a05=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','getSettings','ShowSetting'];(function(_0x168e24,_0x347c8a){var _0x2f90de=function(_0x47e50b){while(--_0x47e50b){_0x168e24['push'](_0x168e24['shift']());}};_0x2f90de(++_0x347c8a);}(_0x1a05,0x153));var _0x51a0=function(_0x1927f0,_0x50e2df){_0x1927f0=_0x1927f0-0x0;var _0x39c58a=_0x1a05[_0x1927f0];return _0x39c58a;};'use strict';var client=require(_0x51a0('0x0'));exports[_0x51a0('0x1')]=function(){return client['Request'](_0x51a0('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x51a0('0x3'),_0x51a0('0x4')]},'log':_0x51a0('0x5')});}; \ No newline at end of file +var _0x0472=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','Request'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x0472,0x197));var _0x2047=function(_0x8fae0f,_0x54af11){_0x8fae0f=_0x8fae0f-0x0;var _0x2dadd8=_0x0472[_0x8fae0f];return _0x2dadd8;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x2047('0x0')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2047('0x1'),_0x2047('0x2')]},'log':_0x2047('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index fbb69be..b163851 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 _0xd3ee=['GetTemplate','getTemplates','Request'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0xd3ee,0x190));var _0xed3e=function(_0x1153ff,_0x2bb354){_0x1153ff=_0x1153ff-0x0;var _0xbc230a=_0xd3ee[_0x1153ff];return _0xbc230a;};'use strict';var client=require('../client');exports[_0xed3e('0x0')]=function(_0x471ce7){return function(_0x181e2f){return client[_0xed3e('0x1')](_0xed3e('0x2'),{'options':{'raw':!![],'attributes':['id','name','html']},'log':_0xed3e('0x2')});};}; \ No newline at end of file +var _0x13fd=['name','../client','Request','GetTemplate'];(function(_0x284516,_0x4dce5d){var _0x358c60=function(_0x483b0e){while(--_0x483b0e){_0x284516['push'](_0x284516['shift']());}};_0x358c60(++_0x4dce5d);}(_0x13fd,0x1d5));var _0xd13f=function(_0x24fd4b,_0x13b18d){_0x24fd4b=_0x24fd4b-0x0;var _0x596a96=_0x13fd[_0x24fd4b];return _0x596a96;};'use strict';var client=require(_0xd13f('0x0'));exports['getTemplates']=function(_0x2f7089){return function(_0x92b9a6){return client[_0xd13f('0x1')](_0xd13f('0x2'),{'options':{'raw':!![],'attributes':['id',_0xd13f('0x3'),'html']},'log':_0xd13f('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 5506058..34ef682 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 _0x16e4=['data6','../client','GetTrigger','channel','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data1','data3','data4'];(function(_0x23e859,_0x419ccc){var _0xe4964=function(_0x2e2501){while(--_0x2e2501){_0x23e859['push'](_0x23e859['shift']());}};_0xe4964(++_0x419ccc);}(_0x16e4,0x91));var _0x416e=function(_0x695ca5,_0x46379e){_0x695ca5=_0x695ca5-0x0;var _0x1ef3af=_0x16e4[_0x695ca5];return _0x1ef3af;};'use strict';var client=require(_0x416e('0x0'));exports['getTriggers']=function(_0x37cc61){return function(_0x3f64d1){return client['Request'](_0x416e('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x416e('0x2'),'status'],'include':[{'model':_0x416e('0x3'),'as':_0x416e('0x4'),'attributes':['id',_0x416e('0x5'),_0x416e('0x6'),_0x416e('0x7')]},{'model':_0x416e('0x3'),'as':_0x416e('0x8'),'attributes':['id',_0x416e('0x5'),'operator',_0x416e('0x7')]},{'model':_0x416e('0x9'),'as':_0x416e('0xa'),'attributes':['id',_0x416e('0xb'),_0x416e('0xc'),'data2',_0x416e('0xd'),_0x416e('0xe'),'data5',_0x416e('0xf'),'data7']}]},'log':_0x416e('0x1')});};}; \ No newline at end of file +var _0xbdf8=['channel','status','Condition','field','value','AnyConditions','operator','Action','Actions','data1','data2','data5','data7','../client','Request','GetTrigger','name'];(function(_0x1f1726,_0x5538e8){var _0xa47567=function(_0x8c6841){while(--_0x8c6841){_0x1f1726['push'](_0x1f1726['shift']());}};_0xa47567(++_0x5538e8);}(_0xbdf8,0x95));var _0x8bdf=function(_0x3ede32,_0x9503f6){_0x3ede32=_0x3ede32-0x0;var _0x53bf90=_0xbdf8[_0x3ede32];return _0x53bf90;};'use strict';var client=require(_0x8bdf('0x0'));exports['getTriggers']=function(_0x471865){return function(_0xb48b82){return client[_0x8bdf('0x1')](_0x8bdf('0x2'),{'options':{'raw':![],'attributes':['id',_0x8bdf('0x3'),_0x8bdf('0x4'),_0x8bdf('0x5')],'include':[{'model':_0x8bdf('0x6'),'as':'AllConditions','attributes':['id',_0x8bdf('0x7'),'operator',_0x8bdf('0x8')]},{'model':'Condition','as':_0x8bdf('0x9'),'attributes':['id',_0x8bdf('0x7'),_0x8bdf('0xa'),'value']},{'model':_0x8bdf('0xb'),'as':_0x8bdf('0xc'),'attributes':['id','action',_0x8bdf('0xd'),_0x8bdf('0xe'),'data3','data4',_0x8bdf('0xf'),'data6',_0x8bdf('0x10')]}]},'log':_0x8bdf('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index f00aace..9d6555c 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 _0x9b0d=['defaultuser','../client','getTrunks','Request','GetTrunk','registry'];(function(_0x22ea59,_0x387ed1){var _0x444611=function(_0x5b2fea){while(--_0x5b2fea){_0x22ea59['push'](_0x22ea59['shift']());}};_0x444611(++_0x387ed1);}(_0x9b0d,0x139));var _0xd9b0=function(_0x41ea3e,_0x1fc9a4){_0x41ea3e=_0x41ea3e-0x0;var _0x28fe1a=_0x9b0d[_0x41ea3e];return _0x28fe1a;};'use strict';var client=require(_0xd9b0('0x0'));exports[_0xd9b0('0x1')]=function(_0x3a7c37){return function(_0x3feb62){return client[_0xd9b0('0x2')](_0xd9b0('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xd9b0('0x4'),_0xd9b0('0x5')]},'log':_0xd9b0('0x3')});};}; \ No newline at end of file +var _0x3677=['getTrunks','GetTrunk','registry','defaultuser','../client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3677,0x1e9));var _0x7367=function(_0x454912,_0x59ea1f){_0x454912=_0x454912-0x0;var _0x1b11dc=_0x3677[_0x454912];return _0x1b11dc;};'use strict';var client=require(_0x7367('0x0'));exports[_0x7367('0x1')]=function(_0x307eb4){return function(_0x378609){return client['Request'](_0x7367('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x7367('0x3'),_0x7367('0x4')]},'log':_0x7367('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index cb1af29..9044905 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0xf492c5,_0x2ada47){var _0x376063=function(_0x209dfb){while(--_0x209dfb){_0xf492c5['push'](_0xf492c5['shift']());}};_0x376063(++_0x2ada47);}(_0x70e0,0x17b));var _0x070e=function(_0x43c750,_0x1102f6){_0x43c750=_0x43c750-0x0;var _0x36cfd5=_0x70e0[_0x43c750];return _0x36cfd5;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file +var _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x513cea,_0x525f2c){var _0x2e237f=function(_0x4850de){while(--_0x4850de){_0x513cea['push'](_0x513cea['shift']());}};_0x2e237f(++_0x525f2c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 9b74a9a..1458c4f 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 _0x38ff=['update','UpdateVoiceAgentReport','../client','Request','CreateVoiceAgentReport'];(function(_0x4022c2,_0x33475a){var _0x20bf0e=function(_0x218338){while(--_0x218338){_0x4022c2['push'](_0x4022c2['shift']());}};_0x20bf0e(++_0x33475a);}(_0x38ff,0x9d));var _0xf38f=function(_0x3ff2f9,_0x544ba1){_0x3ff2f9=_0x3ff2f9-0x0;var _0x3b0913=_0x38ff[_0x3ff2f9];return _0x3b0913;};'use strict';var client=require(_0xf38f('0x0'));exports['create']=function(_0x595902){return client[_0xf38f('0x1')](_0xf38f('0x2'),{'body':_0x595902,'log':_0xf38f('0x2')});};exports[_0xf38f('0x3')]=function(_0x32357d,_0x3aba86,_0x247b80){return client['Request']('UpdateVoiceAgentReport',{'body':_0x32357d,'options':{'where':{'uniqueid':_0x3aba86,'interface':_0x247b80,'agentcomplete':!![]}},'log':_0xf38f('0x4')});}; \ No newline at end of file +var _0x7639=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x39cff5,_0x234f0c){var _0x430437=function(_0xb2375){while(--_0xb2375){_0x39cff5['push'](_0x39cff5['shift']());}};_0x430437(++_0x234f0c);}(_0x7639,0x1d6));var _0x9763=function(_0xdcc2f7,_0x5d0c2d){_0xdcc2f7=_0xdcc2f7-0x0;var _0x1f007f=_0x7639[_0xdcc2f7];return _0x1f007f;};'use strict';var client=require(_0x9763('0x0'));exports[_0x9763('0x1')]=function(_0x5c55f1){return client[_0x9763('0x2')](_0x9763('0x3'),{'body':_0x5c55f1,'log':'CreateVoiceAgentReport'});};exports[_0x9763('0x4')]=function(_0x2eec83,_0x485409,_0x1f9a4f){return client['Request']('UpdateVoiceAgentReport',{'body':_0x2eec83,'options':{'where':{'uniqueid':_0x485409,'interface':_0x1f9a4f,'agentcomplete':!![]}},'log':_0x9763('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index f19ca24..1b53634 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 _0x6caf=['day','format','endOf','type','disposition','duration','billableseconds','lodash','create','Request','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','startOf'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x6caf,0xf1));var _0xf6ca=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x6caf[_0x75f869];return _0x10af8b;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0xf6ca('0x0'));var client=require('../client');exports[_0xf6ca('0x1')]=function(_0x5310ef){return client[_0xf6ca('0x2')]('CreateVoiceCallReport',{'body':_[_0xf6ca('0x3')](_0x5310ef,{'source':_0x5310ef[_0xf6ca('0x4')],'destinationcontext':_0x5310ef[_0xf6ca('0x5')],'callerid':_0x5310ef[_0xf6ca('0x6')],'amaflags':_0xf6ca('0x7')}),'log':'CreateVoiceCallReport'});};exports[_0xf6ca('0x8')]=function(){return function(){return client[_0xf6ca('0x2')](_0xf6ca('0x9'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xf6ca('0xa')](_0xf6ca('0xb'))[_0xf6ca('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xf6ca('0xd')](_0xf6ca('0xb'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xf6ca('0xe'),_0xf6ca('0xf'),_0xf6ca('0x10'),_0xf6ca('0x11')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0xb878=['moment','util','lodash','../client','create','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','Request','outbound','startOf','day','format','type','disposition','billableseconds'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb878,0x1b0));var _0x8b87=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb878[_0x42cae2];return _0x5f256f;};'use strict';var moment=require(_0x8b87('0x0'));var util=require(_0x8b87('0x1'));var _=require(_0x8b87('0x2'));var client=require(_0x8b87('0x3'));exports[_0x8b87('0x4')]=function(_0x5de16f){return client['Request'](_0x8b87('0x5'),{'body':_[_0x8b87('0x6')](_0x5de16f,{'source':_0x5de16f['calleridnum'],'destinationcontext':_0x5de16f[_0x8b87('0x7')],'callerid':_0x5de16f[_0x8b87('0x8')],'amaflags':_0x8b87('0x9')}),'log':_0x8b87('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x8b87('0xa')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x8b87('0xb')],'createdAt':{'$between':[moment()[_0x8b87('0xc')](_0x8b87('0xd'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x8b87('0xd'))[_0x8b87('0xe')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x8b87('0xf'),_0x8b87('0x10'),'duration',_0x8b87('0x11')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 22bf4cc..120cb9c 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 _0x900c=['CreateVoiceDialReport','create'];(function(_0x466bc5,_0x3a0f2a){var _0x138952=function(_0x392fa2){while(--_0x392fa2){_0x466bc5['push'](_0x466bc5['shift']());}};_0x138952(++_0x3a0f2a);}(_0x900c,0x10f));var _0xc900=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x900c[_0xa464c9];return _0x3d73c4;};'use strict';var client=require('../client');exports[_0xc900('0x0')]=function(_0x5bfc90){return client['Request'](_0xc900('0x1'),{'body':_0x5bfc90,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x7bc4=['create','Request','CreateVoiceDialReport','../client'];(function(_0x8fd7d4,_0x193efb){var _0x39afb5=function(_0x1a1a80){while(--_0x1a1a80){_0x8fd7d4['push'](_0x8fd7d4['shift']());}};_0x39afb5(++_0x193efb);}(_0x7bc4,0x8f));var _0x47bc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7bc4[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x47bc('0x0'));exports[_0x47bc('0x1')]=function(_0x18646b){return client[_0x47bc('0x2')](_0x47bc('0x3'),{'body':_0x18646b,'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 e9cc2ec..fe046e2 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 _0xf323=['recordingFormat','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0xc9e36d,_0x32486b){var _0x1c4394=function(_0x3d0670){while(--_0x3d0670){_0xc9e36d['push'](_0xc9e36d['shift']());}};_0x1c4394(++_0x32486b);}(_0xf323,0x1c6));var _0x3f32=function(_0x2f098e,_0x2635a3){_0x2f098e=_0x2f098e-0x0;var _0x4f37f3=_0xf323[_0x2f098e];return _0x4f37f3;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x3f32('0x0')](_0x3f32('0x1'),{'options':{'raw':!![],'attributes':['id','exten',_0x3f32('0x2')],'where':{'VoiceExtensionId':null}},'log':_0x3f32('0x3')});};}; \ No newline at end of file +var _0xd49c=['exten','getVoiceExtensions','GetVoiceExtension'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xd49c,0x1d8));var _0xcd49=function(_0x4f6471,_0x49761f){_0x4f6471=_0x4f6471-0x0;var _0x5692d3=_0xd49c[_0x4f6471];return _0x5692d3;};'use strict';var client=require('../client');exports[_0xcd49('0x0')]=function(){return function(){return client['Request'](_0xcd49('0x1'),{'options':{'raw':!![],'attributes':['id',_0xcd49('0x2'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xcd49('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index ccdc3a1..f9638c3 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 _0x2d0d=['dialNoAnswerRetryFrequency','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','dialActive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry'];(function(_0x49982b,_0x42ef27){var _0xacef19=function(_0x3ddf53){while(--_0x3ddf53){_0x49982b['push'](_0x49982b['shift']());}};_0xacef19(++_0x42ef27);}(_0x2d0d,0xa5));var _0xd2d0=function(_0x3fa37f,_0x397f16){_0x3fa37f=_0x3fa37f-0x0;var _0x5a01d5=_0x2d0d[_0x3fa37f];return _0x5a01d5;};'use strict';var client=require('../client');exports[_0xd2d0('0x0')]=function(){return function(){return client[_0xd2d0('0x1')](_0xd2d0('0x2'),{'options':{'raw':![],'attributes':['id',_0xd2d0('0x3'),_0xd2d0('0x4'),_0xd2d0('0x5'),_0xd2d0('0x6'),_0xd2d0('0x7'),'type',_0xd2d0('0x8'),'dialMethod',_0xd2d0('0x9'),_0xd2d0('0xa'),'dialPowerLevel',_0xd2d0('0xb'),_0xd2d0('0xc'),_0xd2d0('0xd'),_0xd2d0('0xe'),_0xd2d0('0xf'),_0xd2d0('0x10'),_0xd2d0('0x11'),_0xd2d0('0x12'),_0xd2d0('0x13'),_0xd2d0('0x14'),'dialCongestionRetryFrequency',_0xd2d0('0x15'),_0xd2d0('0x16'),_0xd2d0('0x17'),_0xd2d0('0x18'),'dialGlobalMaxRetry',_0xd2d0('0x19'),'dialGlobalInterval',_0xd2d0('0x1a'),_0xd2d0('0x1b'),'dialAMDActive',_0xd2d0('0x1c'),'dialAMDGreeting',_0xd2d0('0x1d'),_0xd2d0('0x1e'),_0xd2d0('0x1f'),_0xd2d0('0x20'),_0xd2d0('0x21'),_0xd2d0('0x22'),_0xd2d0('0x23'),_0xd2d0('0x24'),_0xd2d0('0x25'),_0xd2d0('0x26'),_0xd2d0('0x27'),_0xd2d0('0x28'),'dialAgiAfterHangupClient',_0xd2d0('0x29'),_0xd2d0('0x7'),_0xd2d0('0x2a'),_0xd2d0('0x2b'),_0xd2d0('0x2c'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency',_0xd2d0('0x2d'),'dialAbandonedRetryFrequency',_0xd2d0('0x2e'),_0xd2d0('0x2f'),_0xd2d0('0x30'),_0xd2d0('0x31'),_0xd2d0('0x32'),_0xd2d0('0x33'),_0xd2d0('0x34'),_0xd2d0('0x35'),_0xd2d0('0x36')],'include':[{'model':_0xd2d0('0x37'),'as':_0xd2d0('0x37'),'attributes':['id',_0xd2d0('0x3'),_0xd2d0('0x38'),_0xd2d0('0x39')]},{'model':_0xd2d0('0x3a'),'as':_0xd2d0('0x3b'),'attributes':['id',_0xd2d0('0x3')]},{'model':_0xd2d0('0x37'),'as':'TrunkBackup','attributes':['id',_0xd2d0('0x3'),_0xd2d0('0x38'),_0xd2d0('0x39')]},{'model':_0xd2d0('0x3c'),'as':_0xd2d0('0x3c'),'attributes':['id',_0xd2d0('0x3')],'include':[{'model':_0xd2d0('0x3c'),'as':_0xd2d0('0x3d'),'attributes':['id','name',_0xd2d0('0x3e')]}]}]},'log':_0xd2d0('0x0')});};}; \ No newline at end of file +var _0x6cef=['dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0x6cef,0xe8));var _0xf6ce=function(_0x53ec7a,_0x2c1f7e){_0x53ec7a=_0x53ec7a-0x0;var _0x3a1407=_0x6cef[_0x53ec7a];return _0x3a1407;};'use strict';var client=require('../client');exports[_0xf6ce('0x0')]=function(){return function(){return client[_0xf6ce('0x1')](_0xf6ce('0x2'),{'options':{'raw':![],'attributes':['id',_0xf6ce('0x3'),_0xf6ce('0x4'),_0xf6ce('0x5'),_0xf6ce('0x6'),_0xf6ce('0x7'),'type',_0xf6ce('0x8'),_0xf6ce('0x9'),_0xf6ce('0xa'),_0xf6ce('0xb'),_0xf6ce('0xc'),_0xf6ce('0xd'),_0xf6ce('0xe'),_0xf6ce('0xf'),_0xf6ce('0x10'),_0xf6ce('0x11'),_0xf6ce('0x12'),_0xf6ce('0x13'),'dialQueueTimeout',_0xf6ce('0x14'),_0xf6ce('0x15'),_0xf6ce('0x16'),'dialBusyMaxRetry',_0xf6ce('0x17'),_0xf6ce('0x18'),_0xf6ce('0x19'),_0xf6ce('0x1a'),_0xf6ce('0x1b'),_0xf6ce('0x1c'),_0xf6ce('0x1d'),_0xf6ce('0x1e'),'dialAMDActive',_0xf6ce('0x1f'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0xf6ce('0x20'),'dialAMDMinWordLength',_0xf6ce('0x21'),'dialAMDMaximumNumberOfWords',_0xf6ce('0x22'),_0xf6ce('0x23'),'timeout','dialRecallMeTimeout',_0xf6ce('0x24'),_0xf6ce('0x25'),_0xf6ce('0x26'),_0xf6ce('0x27'),_0xf6ce('0x28'),_0xf6ce('0x7'),_0xf6ce('0x29'),_0xf6ce('0x2a'),'dialCutDigit',_0xf6ce('0x2b'),_0xf6ce('0x2c'),_0xf6ce('0x2d'),_0xf6ce('0x2e'),_0xf6ce('0x2f'),_0xf6ce('0x30'),'dialMachineMaxRetry',_0xf6ce('0x31'),_0xf6ce('0x32'),_0xf6ce('0x33'),_0xf6ce('0x34'),_0xf6ce('0x35'),_0xf6ce('0x36'),_0xf6ce('0x37'),_0xf6ce('0x38')],'include':[{'model':_0xf6ce('0x39'),'as':_0xf6ce('0x39'),'attributes':['id',_0xf6ce('0x3'),_0xf6ce('0x3a'),_0xf6ce('0x3b')]},{'model':_0xf6ce('0x3c'),'as':_0xf6ce('0x3d'),'attributes':['id',_0xf6ce('0x3')]},{'model':_0xf6ce('0x39'),'as':_0xf6ce('0x3e'),'attributes':['id',_0xf6ce('0x3'),_0xf6ce('0x3a'),_0xf6ce('0x3b')]},{'model':_0xf6ce('0x3f'),'as':_0xf6ce('0x3f'),'attributes':['id',_0xf6ce('0x3')],'include':[{'model':_0xf6ce('0x3f'),'as':_0xf6ce('0x40'),'attributes':['id','name',_0xf6ce('0x41')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index ab4c2ea..38ffa7a 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(_0x1842c8,_0x617d5e){var _0x47f11c=function(_0x21cf31){while(--_0x21cf31){_0x1842c8['push'](_0x1842c8['shift']());}};_0x47f11c(++_0x617d5e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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(_0x34a45b,_0x1b8f13){var _0x3fdc8f=function(_0x131cc1){while(--_0x131cc1){_0x34a45b['push'](_0x34a45b['shift']());}};_0x3fdc8f(++_0x1b8f13);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 875a6e2..10421e1 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 _0xba67=['getVoiceQueueRtPauses','Request'];(function(_0x27fbe7,_0x2731e1){var _0x577154=function(_0x57f617){while(--_0x57f617){_0x27fbe7['push'](_0x27fbe7['shift']());}};_0x577154(++_0x2731e1);}(_0xba67,0x15e));var _0x7ba6=function(_0x14adc6,_0x3bbba8){_0x14adc6=_0x14adc6-0x0;var _0x4c5a79=_0xba67[_0x14adc6];return _0x4c5a79;};'use strict';var client=require('../client');exports[_0x7ba6('0x0')]=function(_0x59739d){return function(){return client[_0x7ba6('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x59739d,'paused':!![]},'raw':!![]},'log':_0x7ba6('0x0')});};}; \ No newline at end of file +var _0x2fa6=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x47b309,_0x1da482){var _0x28b8b6=function(_0x528278){while(--_0x528278){_0x47b309['push'](_0x47b309['shift']());}};_0x28b8b6(++_0x1da482);}(_0x2fa6,0x88));var _0x62fa=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x2fa6[_0x3ab9ee];return _0x82ee88;};'use strict';var client=require(_0x62fa('0x0'));exports[_0x62fa('0x1')]=function(_0x1a76e6){return function(){return client[_0x62fa('0x2')](_0x62fa('0x3'),{'options':{'where':{'VoiceQueueId':_0x1a76e6,'paused':!![]},'raw':!![]},'log':_0x62fa('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index edd0d89..e77d4af 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(_0x19a389,_0x15b2dc){var _0x19b995=function(_0x116f07){while(--_0x116f07){_0x19a389['push'](_0x19a389['shift']());}};_0x19b995(++_0x15b2dc);}(_0x7a54,0x106));var _0x47a5=function(_0x10fece,_0x35ea30){_0x10fece=_0x10fece-0x0;var _0x6f33c0=_0x7a54[_0x10fece];return _0x6f33c0;};'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(_0xe22e4d,_0x29e24b){var _0x58794f=function(_0x4cbb4e){while(--_0x4cbb4e){_0xe22e4d['push'](_0xe22e4d['shift']());}};_0x58794f(++_0x29e24b);}(_0x7a54,0x106));var _0x47a5=function(_0x826cd4,_0x1942c5){_0x826cd4=_0x826cd4-0x0;var _0x35bc96=_0x7a54[_0x826cd4];return _0x35bc96;};'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 e0aa096..24fe40c 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 _0x6e1f=['origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','isexternal','context','blind','attendedTransfer','result','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext'];(function(_0x2ddd5a,_0x132cea){var _0x35a682=function(_0x2578b1){while(--_0x2578b1){_0x2ddd5a['push'](_0x2ddd5a['shift']());}};_0x35a682(++_0x132cea);}(_0x6e1f,0x1c4));var _0xf6e1=function(_0x365b3c,_0x5b4304){_0x365b3c=_0x365b3c-0x0;var _0x152e77=_0x6e1f[_0x365b3c];return _0x152e77;};'use strict';var client=require('../client');exports[_0xf6e1('0x0')]={};exports['blindTransfer']=function(_0x57f3b3){return client[_0xf6e1('0x1')](_0xf6e1('0x2'),{'body':{'result':_0x57f3b3['result'],'transfererchannel':_0x57f3b3[_0xf6e1('0x3')],'transferercalleridnum':_0x57f3b3['transferercalleridnum'],'transferercalleridname':_0x57f3b3[_0xf6e1('0x4')],'transfererconnectedlinenum':_0x57f3b3[_0xf6e1('0x5')],'transfererconnectedlinename':_0x57f3b3[_0xf6e1('0x6')],'transfereraccountcode':_0x57f3b3[_0xf6e1('0x7')],'transferercontext':_0x57f3b3[_0xf6e1('0x8')],'transfererexten':_0x57f3b3['transfererexten'],'transfererlinkedid':_0x57f3b3[_0xf6e1('0x9')],'transfereechannel':_0x57f3b3[_0xf6e1('0xa')],'transfereecalleridnum':_0x57f3b3['transfereecalleridnum'],'transfereecalleridname':_0x57f3b3[_0xf6e1('0xb')],'transfereeconnectedlinenum':_0x57f3b3[_0xf6e1('0xc')],'transfereeconnectedlinename':_0x57f3b3[_0xf6e1('0xd')],'transfereeaccountcode':_0x57f3b3['transfereeaccountcode'],'transfereecontext':_0x57f3b3['transfereecontext'],'transfereeexten':_0x57f3b3['transfereeexten'],'transfereelinkedid':_0x57f3b3['transfereelinkedid'],'isexternal':_0x57f3b3[_0xf6e1('0xe')],'context':_0x57f3b3[_0xf6e1('0xf')],'extension':_0x57f3b3['extension'],'type':_0xf6e1('0x10')},'log':_0xf6e1('0x2')});};exports[_0xf6e1('0x11')]=function(_0x262908){return client[_0xf6e1('0x1')](_0xf6e1('0x2'),{'body':{'result':_0x262908[_0xf6e1('0x12')],'transfererchannel':_0x262908[_0xf6e1('0x13')],'transferercalleridnum':_0x262908['origtransferercalleridnum'],'transferercalleridname':_0x262908['origtransferercalleridname'],'transfererconnectedlinenum':_0x262908[_0xf6e1('0x14')],'transfererconnectedlinename':_0x262908[_0xf6e1('0x15')],'transfereraccountcode':_0x262908[_0xf6e1('0x16')],'transferercontext':_0x262908[_0xf6e1('0x17')],'transfererexten':_0x262908['secondtransfererexten'],'transfererlinkedid':_0x262908[_0xf6e1('0x18')],'transfereechannel':_0x262908['transfertargetchannel'],'transfereecalleridnum':_0x262908[_0xf6e1('0x19')],'transfereecalleridname':_0x262908[_0xf6e1('0x1a')],'transfereeconnectedlinenum':_0x262908[_0xf6e1('0x1b')],'transfereeconnectedlinename':_0x262908[_0xf6e1('0x1c')],'transfereeaccountcode':_0x262908['transfertargetaccountcode'],'transfereecontext':_0x262908['transfertargetcontext'],'transfereeexten':_0x262908[_0xf6e1('0x1d')],'transfereelinkedid':_0x262908[_0xf6e1('0x1e')],'isexternal':_0x262908[_0xf6e1('0xe')],'context':_0x262908[_0xf6e1('0x1f')],'extension':_0x262908[_0xf6e1('0x20')],'type':_0xf6e1('0x21')},'log':_0xf6e1('0x2')});}; \ No newline at end of file +var _0x6e3e=['transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','attendedTransfer','origtransferercalleridnum','origtransferercalleridname','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum'];(function(_0x37ee44,_0xb91a6d){var _0xb40465=function(_0x178f14){while(--_0x178f14){_0x37ee44['push'](_0x37ee44['shift']());}};_0xb40465(++_0xb91a6d);}(_0x6e3e,0xd1));var _0xe6e3=function(_0x6181cb,_0x55635c){_0x6181cb=_0x6181cb-0x0;var _0x29ff9e=_0x6e3e[_0x6181cb];return _0x29ff9e;};'use strict';var client=require('../client');exports[_0xe6e3('0x0')]={};exports[_0xe6e3('0x1')]=function(_0x29219b){return client[_0xe6e3('0x2')](_0xe6e3('0x3'),{'body':{'result':_0x29219b[_0xe6e3('0x4')],'transfererchannel':_0x29219b[_0xe6e3('0x5')],'transferercalleridnum':_0x29219b[_0xe6e3('0x6')],'transferercalleridname':_0x29219b[_0xe6e3('0x7')],'transfererconnectedlinenum':_0x29219b[_0xe6e3('0x8')],'transfererconnectedlinename':_0x29219b['transfererconnectedlinename'],'transfereraccountcode':_0x29219b[_0xe6e3('0x9')],'transferercontext':_0x29219b[_0xe6e3('0xa')],'transfererexten':_0x29219b[_0xe6e3('0xb')],'transfererlinkedid':_0x29219b['transfererlinkedid'],'transfereechannel':_0x29219b[_0xe6e3('0xc')],'transfereecalleridnum':_0x29219b['transfereecalleridnum'],'transfereecalleridname':_0x29219b[_0xe6e3('0xd')],'transfereeconnectedlinenum':_0x29219b[_0xe6e3('0xe')],'transfereeconnectedlinename':_0x29219b[_0xe6e3('0xf')],'transfereeaccountcode':_0x29219b[_0xe6e3('0x10')],'transfereecontext':_0x29219b[_0xe6e3('0x11')],'transfereeexten':_0x29219b[_0xe6e3('0x12')],'transfereelinkedid':_0x29219b[_0xe6e3('0x13')],'isexternal':_0x29219b[_0xe6e3('0x14')],'context':_0x29219b[_0xe6e3('0x15')],'extension':_0x29219b['extension'],'type':'blind'},'log':_0xe6e3('0x3')});};exports[_0xe6e3('0x16')]=function(_0x3129d6){return client['Request'](_0xe6e3('0x3'),{'body':{'result':_0x3129d6['result'],'transfererchannel':_0x3129d6['origtransfererchannel'],'transferercalleridnum':_0x3129d6[_0xe6e3('0x17')],'transferercalleridname':_0x3129d6[_0xe6e3('0x18')],'transfererconnectedlinenum':_0x3129d6['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x3129d6['secondtransfererconnectedlinename'],'transfereraccountcode':_0x3129d6['origtransfereraccountcode'],'transferercontext':_0x3129d6['secondtransferercontext'],'transfererexten':_0x3129d6[_0xe6e3('0x19')],'transfererlinkedid':_0x3129d6[_0xe6e3('0x1a')],'transfereechannel':_0x3129d6[_0xe6e3('0x1b')],'transfereecalleridnum':_0x3129d6[_0xe6e3('0x1c')],'transfereecalleridname':_0x3129d6[_0xe6e3('0x1d')],'transfereeconnectedlinenum':_0x3129d6[_0xe6e3('0x1e')],'transfereeconnectedlinename':_0x3129d6['transfertargetconnectedlinename'],'transfereeaccountcode':_0x3129d6[_0xe6e3('0x1f')],'transfereecontext':_0x3129d6['transfertargetcontext'],'transfereeexten':_0x3129d6[_0xe6e3('0x20')],'transfereelinkedid':_0x3129d6['transfertargetlinkedid'],'isexternal':_0x3129d6[_0xe6e3('0x14')],'context':_0x3129d6['origtransferercontext'],'extension':_0x3129d6['origtransfererexten'],'type':_0xe6e3('0x21')},'log':_0xe6e3('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index dc7287e..8268058 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 _0xcca7=['action','content','catch','voiceQueues','hasOwnProperty','length','find','omit','undefined','values','channels','voicechannel','map','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','push','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','status','stop','StopMixMonitor\x20Success','queueChannels','type','inbound','outbound','count','voicequeuechannel','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','send','checkAfterSend','server','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','../properties','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','keys','Reload','Action','then','message','pick','command'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xcca7,0x1aa));var _0x7cca=function(_0x27f3df,_0xd3f6f7){_0x27f3df=_0x27f3df-0x0;var _0x20af94=_0xcca7[_0x27f3df];return _0x20af94;};'use strict';var _=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var jayson=require(_0x7cca('0x2'));var schema=require(_0x7cca('0x3'));var moment=require('moment');var config=require('../../../config/environment');var properties=require(_0x7cca('0x4'));var ami=require('../ami');var VoiceQueueSummary=require(_0x7cca('0x5'));exports[_0x7cca('0x6')]=function(_0x2126f7,_0x312e98,_0x1c6c95){return new Promise(function(_0xe70805,_0x5aec51){var _0x508f29={'QueuePause':function(_0x937fad){return new Promise(function(_0xd7a28d){var _0x1aed1b=util[_0x7cca('0x7')](_0x7cca('0x8'),_0x7cca('0x9'),_0x937fad[_0x7cca('0xa')]);if(_0x2126f7[_0x7cca('0xb')]&&_0x2126f7[_0x7cca('0xb')][_0x1aed1b]&&_0x2126f7[_0x7cca('0xb')][_0x1aed1b]['timer']){_0x2126f7[_0x7cca('0xb')][_0x1aed1b][_0x7cca('0xc')]();}if(_0x2126f7[_0x7cca('0xd')][_0x1aed1b]){_0x2126f7[_0x7cca('0xd')][_0x1aed1b][_0x7cca('0xe')]({'statePause':_0x937fad['pause']?!![]:![]});}_0xd7a28d({'code':0xc8,'message':_0x7cca('0xf')});});},'Reload':function(_0x41e0a2){var _0x2854c7=this;return new Promise(function(_0x4d0d6d,_0x54e492){if(ami[_0x7cca('0x10')]()==![]){return _0x54e492(_0x2854c7[_0x7cca('0x11')](0x1f4,[config[_0x7cca('0x12')]['ip'],config[_0x7cca('0x12')][_0x7cca('0x13')],_0x7cca('0x14')][_0x7cca('0x15')]('\x20')));}_0x41e0a2=_['pick'](_0x41e0a2,_[_0x7cca('0x16')](properties['reload']['module']));_0x41e0a2['action']=_0x7cca('0x17');return ami[_0x7cca('0x18')](_0x41e0a2)[_0x7cca('0x19')](function(_0x33db6b){_0x4d0d6d({'code':0xc8,'message':_0x33db6b[_0x7cca('0x1a')]});})['catch'](function(_0xb35e1d){_0x54e492(_0x2854c7['error'](0x1f5,_0xb35e1d['message']));});});},'Command':function(_0x5d7ac6){var _0x370469=this;return new Promise(function(_0x25297b,_0x2beb6c){if(ami[_0x7cca('0x10')]()==![]){return _0x2beb6c(_0x370469[_0x7cca('0x11')](0x1f4,[config[_0x7cca('0x12')]['ip'],config[_0x7cca('0x12')][_0x7cca('0x13')],'ami\x20disconnected'][_0x7cca('0x15')]('\x20')));}_0x5d7ac6=_[_0x7cca('0x1b')](_0x5d7ac6,_0x7cca('0x1c'));_0x5d7ac6[_0x7cca('0x1d')]='Command';return ami[_0x7cca('0x18')](_0x5d7ac6)[_0x7cca('0x19')](function(_0x4367f9){_0x25297b({'code':0xc8,'message':_0x4367f9[_0x7cca('0x1e')]});})[_0x7cca('0x1f')](function(_0x3fc157){_0x2beb6c(_0x370469[_0x7cca('0x11')](0x1f5,_0x3fc157[_0x7cca('0x1a')]));});});},'VoiceQueues':function(){return new Promise(function(_0x4b99b6){var _0xfe121c=[];for(var _0x1dd3b3 in _0x2126f7[_0x7cca('0x20')]){if(_0x2126f7[_0x7cca('0x20')][_0x7cca('0x21')](_0x1dd3b3)){var _0x21da68=_0x2126f7[_0x7cca('0x20')][_0x1dd3b3];var _0x40ac86=new VoiceQueueSummary(_0x21da68);_0xfe121c['push'](_0x40ac86);}}_0x4b99b6({'count':_0xfe121c[_0x7cca('0x22')],'rows':_0xfe121c});});},'UpdateVoiceQueue':function(_0x5c8410){return new Promise(function(_0xc86c1b,_0x201fbb){var _0x5a87d6=_[_0x7cca('0x23')](_0x2126f7[_0x7cca('0x20')],{'id':parseInt(_0x5c8410['id'])});var _0x5533fb=_[_0x7cca('0x24')](_0x5c8410,['id']);if(_0x5a87d6){for(var _0x1cd53a in _0x5533fb){if(typeof _0x5533fb[_0x1cd53a]!==_0x7cca('0x25')&&typeof _0x5a87d6[_0x1cd53a]!=='undefined'){_0x5a87d6[_0x1cd53a]=_0x5533fb[_0x1cd53a];}}_0xc86c1b(_0x5a87d6);}else{_0x201fbb();}});},'VoiceChannels':function(){return new Promise(function(_0x5adfd1){var _0x41f5bc=_[_0x7cca('0x26')](_0x2126f7[_0x7cca('0x27')]);_0x5adfd1({'count':_0x41f5bc[_0x7cca('0x22')],'rows':_0x41f5bc});});},'VoiceChannelMixMonitor':function(_0x34336c){var _0xe1ee18=this;return new Promise(function(_0x3a77c8,_0x5a2c7c){if(ami['isConnected']()==![]){return _0x5a2c7c(_0xe1ee18[_0x7cca('0x11')](0x1f4,[config[_0x7cca('0x12')]['ip'],config[_0x7cca('0x12')]['username'],_0x7cca('0x14')]['join']('\x20')));}var _0x2061fe=schema(properties[_0x7cca('0x28')])[_0x7cca('0x3')](_0x34336c);if(_0x2061fe[_0x7cca('0x22')]>0x0){return _0x5a2c7c(_0xe1ee18['error'](0x1f4,_[_0x7cca('0x29')](_0x2061fe,_0x7cca('0x1a'))[_0x7cca('0x15')](',\x20')));}var _0x52eaf7=_['find'](_0x2126f7['channels'],{'uniqueid':_0x34336c[_0x7cca('0x2a')]});if(_0x52eaf7&&_0x52eaf7[_0x7cca('0x2b')]){var _0x4e2fbe=util[_0x7cca('0x7')](_0x7cca('0x2c'),_0x34336c[_0x7cca('0x2d')]||_0x34336c[_0x7cca('0x2a')],_0x34336c[_0x7cca('0x7')]||_0x7cca('0x2e'));return ami[_0x7cca('0x18')]({'action':'MixMonitor','channel':_0x52eaf7[_0x7cca('0x2b')],'file':_0x4e2fbe,'options':_0x7cca('0x2f')})[_0x7cca('0x19')](function(_0x147cf8){var _0x4f28ac=_[_0x7cca('0x23')](_0x52eaf7[_0x7cca('0x30')],{'filename':_0x7cca('0x31')+_0x4e2fbe['toLowerCase']()});if(_[_0x7cca('0x32')](_0x4f28ac)){_0x52eaf7['monitors'][_0x7cca('0x33')]({'filename':_0x7cca('0x31')+_0x4e2fbe[_0x7cca('0x34')](),'createdAt':moment()[_0x7cca('0x7')](_0x7cca('0x35')),'mixmonitorid':_0x147cf8[_0x7cca('0x36')],'status':_0x7cca('0x37')});}else{_0x4f28ac[_0x7cca('0x36')]=_0x147cf8[_0x7cca('0x36')];_0x4f28ac['status']='rec';}_0x3a77c8({'code':0xc8,'message':[_0x34336c[_0x7cca('0x2a')],_0x7cca('0x38'),_0x147cf8['mixmonitorid']]['join']('\x20'),'mixmonitorid':_0x147cf8[_0x7cca('0x36')]});})[_0x7cca('0x1f')](function(_0x1837b0){_0x5a2c7c(_0xe1ee18[_0x7cca('0x11')](0x1f5,[_0x34336c[_0x7cca('0x2a')],_0x1837b0['message'][_0x7cca('0x34')]()]['join']('\x20')));});}else{return _0x5a2c7c(_0xe1ee18['error'](0x1f5,_0x7cca('0x39')));}});},'VoiceChannelStopMixMonitor':function(_0x33d069){var _0x4c27de=this;return new Promise(function(_0x3b120b,_0x5d1a4a){if(ami[_0x7cca('0x10')]()==![]){return _0x5d1a4a(_0x4c27de[_0x7cca('0x11')](0x1f4,[config[_0x7cca('0x12')]['ip'],config['asterisk'][_0x7cca('0x13')],_0x7cca('0x14')][_0x7cca('0x15')]('\x20')));}var _0x3e7f95=schema(properties['voicechannel'])[_0x7cca('0x3')](_0x33d069);if(_0x3e7f95[_0x7cca('0x22')]>0x0){return _0x5d1a4a(_0x4c27de[_0x7cca('0x11')](0x1f4,_[_0x7cca('0x29')](_0x3e7f95,_0x7cca('0x1a'))[_0x7cca('0x15')](',\x20')));}var _0x57f440=_['find'](_0x2126f7['channels'],{'uniqueid':_0x33d069['uniqueid']});if(_0x57f440){return Promise[_0x7cca('0x3a')]()['then'](function(){if(_0x57f440['channel']){return ami[_0x7cca('0x18')]({'action':_0x7cca('0x3b'),'channel':_0x57f440[_0x7cca('0x2b')],'mixmonitorid':_0x33d069[_0x7cca('0x36')]})[_0x7cca('0x1f')](function(){});}})['then'](function(){if(_0x57f440[_0x7cca('0x3c')]){return ami[_0x7cca('0x18')]({'action':_0x7cca('0x3b'),'channel':_0x57f440[_0x7cca('0x3c')],'mixmonitorid':_0x33d069[_0x7cca('0x36')]})[_0x7cca('0x1f')](function(){});}})[_0x7cca('0x19')](function(){var _0x71f1d0=_[_0x7cca('0x23')](_0x57f440[_0x7cca('0x30')],{'mixmonitorid':_0x33d069[_0x7cca('0x36')]});if(_0x71f1d0){_0x71f1d0['status']='stop';}})[_0x7cca('0x19')](function(){var _0x5913eb=util[_0x7cca('0x7')](_0x7cca('0x2c'),_0x33d069[_0x7cca('0x2d')]||_0x33d069[_0x7cca('0x2a')],_0x33d069[_0x7cca('0x7')]||_0x7cca('0x2e'));var _0x184b56=_[_0x7cca('0x23')](_0x57f440[_0x7cca('0x30')],{'filename':_0x7cca('0x31')+_0x5913eb['toLowerCase']()});if(_0x184b56){_0x184b56[_0x7cca('0x3d')]=_0x7cca('0x3e');}})[_0x7cca('0x19')](function(){_0x3b120b({'code':0xc8,'message':[_0x33d069[_0x7cca('0x2a')],_0x7cca('0x3f')][_0x7cca('0x15')]('\x20')});})[_0x7cca('0x1f')](function(_0x19298c){_0x5d1a4a(_0x4c27de[_0x7cca('0x11')](0x1f5,[_0x33d069[_0x7cca('0x2a')],_0x19298c[_0x7cca('0x1a')][_0x7cca('0x34')]()][_0x7cca('0x15')]('\x20')));});}else{return _0x5d1a4a(_0x4c27de[_0x7cca('0x11')](0x1f5,_0x7cca('0x39')));}});},'VoiceQueuesChannels':function(_0x123727){var _0x45d6ff=this;return new Promise(function(_0x27c527){var _0x343a64=_[_0x7cca('0x26')](_0x2126f7[_0x7cca('0x40')]);var _0xa7c67d={'count':_0x343a64[_0x7cca('0x22')],'rows':_0x343a64};if(_0x123727&&_0x123727[_0x7cca('0x41')]){if(![_0x7cca('0x42'),_0x7cca('0x43')]['includes'](_0x123727[_0x7cca('0x41')])){return _0x5aec51(_0x45d6ff[_0x7cca('0x11')](0x190,'Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound'));}var _0x49bce5=_['filter'](_0x343a64,function(_0x41278c){return _0x41278c[_0x7cca('0x41')]===_0x123727['type'];});_0xa7c67d[_0x7cca('0x44')]=_0x49bce5[_0x7cca('0x22')];_0xa7c67d['rows']=_0x49bce5;}_0x27c527(_0xa7c67d);});},'VoiceQueuesChannel':function(_0x347496){var _0x4e871b=this;return new Promise(function(_0x1aa39b,_0x385e4e){var _0x33300a=schema(properties[_0x7cca('0x45')])[_0x7cca('0x3')](_0x347496);if(_0x33300a[_0x7cca('0x22')]>0x0){return _0x385e4e(_0x4e871b[_0x7cca('0x11')](0x1f4,_[_0x7cca('0x29')](_0x33300a,_0x7cca('0x1a'))[_0x7cca('0x15')](',\x20')));}var _0x172ce1=_[_0x7cca('0x23')](_0x2126f7[_0x7cca('0x40')],{'uniqueid':_0x347496['uniqueid']});if(_0x172ce1){_0x1aa39b(_0x172ce1);}else{return _0x385e4e(_0x4e871b[_0x7cca('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x2078e8){var _0x4d37ba=this;return new Promise(function(_0x372c73,_0x282e6b){if(ami[_0x7cca('0x10')]()==![]){return _0x282e6b(_0x4d37ba['error'](0x1f4,[config[_0x7cca('0x12')]['ip'],config[_0x7cca('0x12')][_0x7cca('0x13')],_0x7cca('0x14')][_0x7cca('0x15')]('\x20')));}var _0x538b56=schema(properties['voicequeuechannelhangup'])[_0x7cca('0x3')](_0x2078e8);if(_0x538b56[_0x7cca('0x22')]>0x0){return _0x282e6b(_0x4d37ba[_0x7cca('0x11')](0x1f4,_[_0x7cca('0x29')](_0x538b56,_0x7cca('0x1a'))[_0x7cca('0x15')](',\x20')));}var _0x474a24=_[_0x7cca('0x23')](_0x2126f7[_0x7cca('0x40')],{'uniqueid':_0x2078e8[_0x7cca('0x2a')]});if(_0x474a24&&_0x474a24[_0x7cca('0x2b')]){return ami[_0x7cca('0x18')]({'action':_0x7cca('0x46'),'channel':_0x474a24['channel']})[_0x7cca('0x19')](function(_0x4e3582){_0x372c73({'code':0xc8,'message':[_0x2078e8['uniqueid'],_0x4e3582[_0x7cca('0x1a')][_0x7cca('0x34')]()][_0x7cca('0x15')]('\x20')});})['catch'](function(_0x1985b){_0x282e6b(_0x4d37ba[_0x7cca('0x11')](0x1f5,[_0x2078e8[_0x7cca('0x2a')],_0x1985b[_0x7cca('0x1a')][_0x7cca('0x34')]()]['join']('\x20')));});}else{return _0x282e6b(_0x4d37ba[_0x7cca('0x11')](0x1f5,_0x7cca('0x39')));}});},'VoiceQueuesChannelRedirect':function(_0x3bf984){var _0x3da37b=this;return new Promise(function(_0x4ae638,_0x399d14){if(ami[_0x7cca('0x10')]()==![]){return _0x399d14(_0x3da37b['error'](0x1f4,[config[_0x7cca('0x12')]['ip'],config['asterisk'][_0x7cca('0x13')],'ami\x20disconnected'][_0x7cca('0x15')]('\x20')));}var _0x3aa651=schema(properties[_0x7cca('0x47')])[_0x7cca('0x3')](_0x3bf984);if(_0x3aa651[_0x7cca('0x22')]>0x0){return _0x399d14(_0x3da37b[_0x7cca('0x11')](0x1f4,_[_0x7cca('0x29')](_0x3aa651,_0x7cca('0x1a'))[_0x7cca('0x15')](',\x20')));}var _0x468ffa=_[_0x7cca('0x23')](_0x2126f7[_0x7cca('0x40')],{'uniqueid':_0x3bf984[_0x7cca('0x2a')]});if(_0x468ffa&&_0x468ffa[_0x7cca('0x2b')]){return ami['Action']({'action':_0x7cca('0x48'),'channel':_0x468ffa[_0x7cca('0x2b')],'exten':_0x3bf984[_0x7cca('0x49')],'context':_0x3bf984['context']||_0x468ffa[_0x7cca('0x4a')],'priority':0x1})['then'](function(_0x10c470){_0x4ae638({'code':0xc8,'message':[_0x3bf984[_0x7cca('0x2a')],_0x10c470[_0x7cca('0x1a')][_0x7cca('0x34')]()][_0x7cca('0x15')]('\x20')});})[_0x7cca('0x1f')](function(_0xb6832){_0x399d14(_0x3da37b[_0x7cca('0x11')](0x1f5,[_0x3bf984[_0x7cca('0x2a')],_0xb6832[_0x7cca('0x1a')][_0x7cca('0x34')]()][_0x7cca('0x15')]('\x20')));});}else{return _0x399d14(_0x3da37b[_0x7cca('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x36fc17){return new Promise(function(_0x4ac68e){var _0xca272e=_[_0x7cca('0x26')](_0x2126f7[_0x7cca('0xd')]);if(_0x36fc17&&_0x36fc17['id']){var _0x3422cf=_['find'](_0xca272e,function(_0x319a03){return _0x319a03['id']===_0x36fc17['id'];});_0x4ac68e(_0x3422cf);}else{_0x4ac68e({'count':_0xca272e[_0x7cca('0x22')],'rows':_0xca272e});}});},'Telephones':function(){return new Promise(function(_0x2e981b){var _0x209b37=_[_0x7cca('0x26')](_0x2126f7[_0x7cca('0x4b')]);_0x2e981b({'count':_0x209b37['length'],'rows':_0x209b37});});},'Trunks':function(){return new Promise(function(_0x41fde5){var _0x479558=_[_0x7cca('0x26')](_0x2126f7[_0x7cca('0x4c')]);_0x41fde5({'count':_0x479558[_0x7cca('0x22')],'rows':_0x479558});});},'OutboundChannels':function(){return new Promise(function(_0xdada0d){var _0x33dfec=_[_0x7cca('0x26')](_0x2126f7[_0x7cca('0x4d')]);_0xdada0d({'count':_0x33dfec['length'],'rows':_0x33dfec});});},'Outbound':function(){return new Promise(function(_0x1ef432){_0x1ef432(_0x2126f7[_0x7cca('0x43')]);});},'Campaigns':function(){return new Promise(function(_0x4c55e6){var _0x327227=_['values'](_0x2126f7[_0x7cca('0x4e')]);_0x4c55e6({'count':_0x327227[_0x7cca('0x22')],'rows':_0x327227});});},'VoiceQueuesPreview':function(_0x313cd1){var _0x27e79c=this;return new Promise(function(_0x1a490b,_0x2af32b){_0x312e98[_0x7cca('0x4f')](_0x313cd1['id'])[_0x7cca('0x19')](function(_0x6a8a74){_0x1a490b({'code':0xc8,'message':_0x6a8a74[_0x7cca('0x1a')]});})['catch'](function(_0x3bc1a7){_0x2af32b(_0x27e79c[_0x7cca('0x11')](0x1f4,_0x3bc1a7[_0x7cca('0x1a')]));});});},'EventManager':function(_0x294484){var _0x37deae=this;return new Promise(function(_0x2395c8,_0x414d6c){if(!_0x294484[_0x7cca('0x50')]){return _0x414d6c(_0x37deae['error'](0x1f4,_0x7cca('0x51')));}ami[_0x7cca('0x52')](_0x7cca('0x53')+_0x294484['event'],_0x294484[_0x7cca('0x1a')]);_0x2395c8({'code':0xc8,'message':_0x294484});});},'FaxAccounts':function(){return new Promise(function(_0x174fbd){var _0x56c665=_[_0x7cca('0x26')](_0x2126f7['faxAccounts']);_0x174fbd({'count':_0x56c665[_0x7cca('0x22')],'rows':_0x56c665});});},'SendFax':function(_0x198784){var _0x2e93d6=this;return new Promise(function(_0xaa0e03,_0xf759d9){_0x1c6c95[_0x7cca('0x54')](_0x198784)[_0x7cca('0x19')](function(_0x4d8f5d){_0xaa0e03({'code':0xc8,'message':_0x4d8f5d[_0x7cca('0x1a')]});})[_0x7cca('0x1f')](function(_0x1fd60d){_0xf759d9(_0x2e93d6[_0x7cca('0x11')](0x1f4,_0x1fd60d[_0x7cca('0x1a')]));});});},'CheckAfterSend':function(_0x5afecc){var _0x30204b=this;return new Promise(function(_0x1c45c3,_0x5465d7){_0x1c6c95[_0x7cca('0x55')](_0x5afecc)[_0x7cca('0x19')](function(_0x5d23d5){_0x1c45c3({'code':0xc8,'message':_0x5d23d5[_0x7cca('0x1a')]});})[_0x7cca('0x1f')](function(_0x23ce9b){_0x5465d7(_0x30204b[_0x7cca('0x11')](0x1f4,_0x23ce9b[_0x7cca('0x1a')]));});});}};var _0x40a3e8=jayson[_0x7cca('0x56')](_0x508f29)[_0x7cca('0x57')]();_0x40a3e8['on'](_0x7cca('0x11'),function(_0xfde4f3){return _0x5aec51(_0xfde4f3);});_0x40a3e8[_0x7cca('0x6')](0x232a,_0x7cca('0x58'),function(){console['log'](_0x7cca('0x59'),0x232a);return _0xe70805(_0x7cca('0x5a')+0x232a);});});}; \ No newline at end of file +var _0x7bae=['%s.%s','filename','wav','ai(mixmonitorid)','toLowerCase','isNil','monitors','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicechannel','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','type','inbound','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','count','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','telephones','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','validate','../../../config/environment','../ami','../model/voiceQueueSummary','listen','format','%s/%s','name','timers','timer','updateAcw','agents','pause','isConnected','error','username','ami\x20disconnected','join','keys','Reload','then','message','asterisk','pick','command','action','Command','Action','content','catch','voiceQueues','push','length','find','omit','values','channels','map','uniqueid','channel'];(function(_0x371120,_0x2fc657){var _0x4a3bb9=function(_0x24f686){while(--_0x24f686){_0x371120['push'](_0x371120['shift']());}};_0x4a3bb9(++_0x2fc657);}(_0x7bae,0x13b));var _0xe7ba=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x7bae[_0x1c546c];return _0x2cc384;};'use strict';var _=require('lodash');var util=require('util');var jayson=require(_0xe7ba('0x0'));var schema=require(_0xe7ba('0x1'));var moment=require('moment');var config=require(_0xe7ba('0x2'));var properties=require('../properties');var ami=require(_0xe7ba('0x3'));var VoiceQueueSummary=require(_0xe7ba('0x4'));exports[_0xe7ba('0x5')]=function(_0x2276df,_0x398a6a,_0xfd3a22){return new Promise(function(_0x2d31df,_0x3c5e59){var _0x10b307={'QueuePause':function(_0x34fb18){return new Promise(function(_0x160565){var _0x27b1d5=util[_0xe7ba('0x6')](_0xe7ba('0x7'),'SIP',_0x34fb18[_0xe7ba('0x8')]);if(_0x2276df[_0xe7ba('0x9')]&&_0x2276df[_0xe7ba('0x9')][_0x27b1d5]&&_0x2276df[_0xe7ba('0x9')][_0x27b1d5][_0xe7ba('0xa')]){_0x2276df[_0xe7ba('0x9')][_0x27b1d5][_0xe7ba('0xb')]();}if(_0x2276df[_0xe7ba('0xc')][_0x27b1d5]){_0x2276df[_0xe7ba('0xc')][_0x27b1d5]['updateStatusRealtime']({'statePause':_0x34fb18[_0xe7ba('0xd')]?!![]:![]});}_0x160565({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x602b1){var _0x45229c=this;return new Promise(function(_0x390596,_0x17e4e6){if(ami[_0xe7ba('0xe')]()==![]){return _0x17e4e6(_0x45229c[_0xe7ba('0xf')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xe7ba('0x10')],_0xe7ba('0x11')][_0xe7ba('0x12')]('\x20')));}_0x602b1=_['pick'](_0x602b1,_[_0xe7ba('0x13')](properties['reload']['module']));_0x602b1['action']=_0xe7ba('0x14');return ami['Action'](_0x602b1)[_0xe7ba('0x15')](function(_0x4888d9){_0x390596({'code':0xc8,'message':_0x4888d9['message']});})['catch'](function(_0x3f326a){_0x17e4e6(_0x45229c[_0xe7ba('0xf')](0x1f5,_0x3f326a[_0xe7ba('0x16')]));});});},'Command':function(_0x3c06c3){var _0x1c8b5b=this;return new Promise(function(_0x58550c,_0x149c62){if(ami[_0xe7ba('0xe')]()==![]){return _0x149c62(_0x1c8b5b[_0xe7ba('0xf')](0x1f4,[config[_0xe7ba('0x17')]['ip'],config['asterisk'][_0xe7ba('0x10')],_0xe7ba('0x11')]['join']('\x20')));}_0x3c06c3=_[_0xe7ba('0x18')](_0x3c06c3,_0xe7ba('0x19'));_0x3c06c3[_0xe7ba('0x1a')]=_0xe7ba('0x1b');return ami[_0xe7ba('0x1c')](_0x3c06c3)[_0xe7ba('0x15')](function(_0x293b14){_0x58550c({'code':0xc8,'message':_0x293b14[_0xe7ba('0x1d')]});})[_0xe7ba('0x1e')](function(_0xa72f1c){_0x149c62(_0x1c8b5b['error'](0x1f5,_0xa72f1c['message']));});});},'VoiceQueues':function(){return new Promise(function(_0x4dcc7b){var _0x4cd124=[];for(var _0x4363a8 in _0x2276df['voiceQueues']){if(_0x2276df['voiceQueues']['hasOwnProperty'](_0x4363a8)){var _0x255def=_0x2276df[_0xe7ba('0x1f')][_0x4363a8];var _0xe32862=new VoiceQueueSummary(_0x255def);_0x4cd124[_0xe7ba('0x20')](_0xe32862);}}_0x4dcc7b({'count':_0x4cd124[_0xe7ba('0x21')],'rows':_0x4cd124});});},'UpdateVoiceQueue':function(_0xc88099){return new Promise(function(_0x4ed792,_0x3a59d6){var _0x47be66=_[_0xe7ba('0x22')](_0x2276df['voiceQueues'],{'id':parseInt(_0xc88099['id'])});var _0x102925=_[_0xe7ba('0x23')](_0xc88099,['id']);if(_0x47be66){for(var _0x369451 in _0x102925){if(typeof _0x102925[_0x369451]!=='undefined'&&typeof _0x47be66[_0x369451]!=='undefined'){_0x47be66[_0x369451]=_0x102925[_0x369451];}}_0x4ed792(_0x47be66);}else{_0x3a59d6();}});},'VoiceChannels':function(){return new Promise(function(_0x1735da){var _0x276885=_[_0xe7ba('0x24')](_0x2276df[_0xe7ba('0x25')]);_0x1735da({'count':_0x276885[_0xe7ba('0x21')],'rows':_0x276885});});},'VoiceChannelMixMonitor':function(_0x5279dd){var _0x37911d=this;return new Promise(function(_0x339f53,_0x5b5ff3){if(ami[_0xe7ba('0xe')]()==![]){return _0x5b5ff3(_0x37911d['error'](0x1f4,[config['asterisk']['ip'],config[_0xe7ba('0x17')][_0xe7ba('0x10')],_0xe7ba('0x11')]['join']('\x20')));}var _0x3b14b4=schema(properties['voicechannel'])[_0xe7ba('0x1')](_0x5279dd);if(_0x3b14b4[_0xe7ba('0x21')]>0x0){return _0x5b5ff3(_0x37911d[_0xe7ba('0xf')](0x1f4,_[_0xe7ba('0x26')](_0x3b14b4,_0xe7ba('0x16'))['join'](',\x20')));}var _0x327c9=_[_0xe7ba('0x22')](_0x2276df['channels'],{'uniqueid':_0x5279dd[_0xe7ba('0x27')]});if(_0x327c9&&_0x327c9[_0xe7ba('0x28')]){var _0x499d3b=util['format'](_0xe7ba('0x29'),_0x5279dd[_0xe7ba('0x2a')]||_0x5279dd['uniqueid'],_0x5279dd[_0xe7ba('0x6')]||_0xe7ba('0x2b'));return ami[_0xe7ba('0x1c')]({'action':'MixMonitor','channel':_0x327c9[_0xe7ba('0x28')],'file':_0x499d3b,'options':_0xe7ba('0x2c')})['then'](function(_0x330e98){var _0x3182d9=_[_0xe7ba('0x22')](_0x327c9['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x499d3b[_0xe7ba('0x2d')]()});if(_[_0xe7ba('0x2e')](_0x3182d9)){_0x327c9[_0xe7ba('0x2f')][_0xe7ba('0x20')]({'filename':_0xe7ba('0x30')+_0x499d3b['toLowerCase'](),'createdAt':moment()[_0xe7ba('0x6')](_0xe7ba('0x31')),'mixmonitorid':_0x330e98[_0xe7ba('0x32')],'status':_0xe7ba('0x33')});}else{_0x3182d9['mixmonitorid']=_0x330e98[_0xe7ba('0x32')];_0x3182d9[_0xe7ba('0x34')]=_0xe7ba('0x33');}_0x339f53({'code':0xc8,'message':[_0x5279dd[_0xe7ba('0x27')],_0xe7ba('0x35'),_0x330e98[_0xe7ba('0x32')]][_0xe7ba('0x12')]('\x20'),'mixmonitorid':_0x330e98['mixmonitorid']});})[_0xe7ba('0x1e')](function(_0x17b1cb){_0x5b5ff3(_0x37911d[_0xe7ba('0xf')](0x1f5,[_0x5279dd[_0xe7ba('0x27')],_0x17b1cb[_0xe7ba('0x16')][_0xe7ba('0x2d')]()][_0xe7ba('0x12')]('\x20')));});}else{return _0x5b5ff3(_0x37911d[_0xe7ba('0xf')](0x1f5,_0xe7ba('0x36')));}});},'VoiceChannelStopMixMonitor':function(_0x50792c){var _0x22668f=this;return new Promise(function(_0x417734,_0x5d4be2){if(ami['isConnected']()==![]){return _0x5d4be2(_0x22668f[_0xe7ba('0xf')](0x1f4,[config[_0xe7ba('0x17')]['ip'],config[_0xe7ba('0x17')]['username'],_0xe7ba('0x11')][_0xe7ba('0x12')]('\x20')));}var _0x3569b6=schema(properties[_0xe7ba('0x37')])[_0xe7ba('0x1')](_0x50792c);if(_0x3569b6['length']>0x0){return _0x5d4be2(_0x22668f[_0xe7ba('0xf')](0x1f4,_['map'](_0x3569b6,_0xe7ba('0x16'))[_0xe7ba('0x12')](',\x20')));}var _0xe0f1c3=_[_0xe7ba('0x22')](_0x2276df[_0xe7ba('0x25')],{'uniqueid':_0x50792c[_0xe7ba('0x27')]});if(_0xe0f1c3){return Promise[_0xe7ba('0x38')]()[_0xe7ba('0x15')](function(){if(_0xe0f1c3['channel']){return ami[_0xe7ba('0x1c')]({'action':_0xe7ba('0x39'),'channel':_0xe0f1c3[_0xe7ba('0x28')],'mixmonitorid':_0x50792c[_0xe7ba('0x32')]})[_0xe7ba('0x1e')](function(){});}})[_0xe7ba('0x15')](function(){if(_0xe0f1c3[_0xe7ba('0x3a')]){return ami[_0xe7ba('0x1c')]({'action':_0xe7ba('0x39'),'channel':_0xe0f1c3[_0xe7ba('0x3a')],'mixmonitorid':_0x50792c['mixmonitorid']})[_0xe7ba('0x1e')](function(){});}})['then'](function(){var _0x31ac09=_[_0xe7ba('0x22')](_0xe0f1c3[_0xe7ba('0x2f')],{'mixmonitorid':_0x50792c[_0xe7ba('0x32')]});if(_0x31ac09){_0x31ac09[_0xe7ba('0x34')]=_0xe7ba('0x3b');}})['then'](function(){var _0x271592=util[_0xe7ba('0x6')](_0xe7ba('0x29'),_0x50792c[_0xe7ba('0x2a')]||_0x50792c[_0xe7ba('0x27')],_0x50792c[_0xe7ba('0x6')]||_0xe7ba('0x2b'));var _0x266ace=_[_0xe7ba('0x22')](_0xe0f1c3[_0xe7ba('0x2f')],{'filename':_0xe7ba('0x30')+_0x271592['toLowerCase']()});if(_0x266ace){_0x266ace[_0xe7ba('0x34')]=_0xe7ba('0x3b');}})[_0xe7ba('0x15')](function(){_0x417734({'code':0xc8,'message':[_0x50792c[_0xe7ba('0x27')],_0xe7ba('0x3c')][_0xe7ba('0x12')]('\x20')});})['catch'](function(_0x4590d4){_0x5d4be2(_0x22668f[_0xe7ba('0xf')](0x1f5,[_0x50792c['uniqueid'],_0x4590d4[_0xe7ba('0x16')][_0xe7ba('0x2d')]()][_0xe7ba('0x12')]('\x20')));});}else{return _0x5d4be2(_0x22668f[_0xe7ba('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x54e2ad){var _0xa80cf=this;return new Promise(function(_0x2cfdc3){var _0x285743=_['values'](_0x2276df[_0xe7ba('0x3d')]);var _0x365573={'count':_0x285743[_0xe7ba('0x21')],'rows':_0x285743};if(_0x54e2ad&&_0x54e2ad[_0xe7ba('0x3e')]){if(![_0xe7ba('0x3f'),_0xe7ba('0x40')][_0xe7ba('0x41')](_0x54e2ad['type'])){return _0x3c5e59(_0xa80cf[_0xe7ba('0xf')](0x190,_0xe7ba('0x42')));}var _0x316b51=_['filter'](_0x285743,function(_0x102066){return _0x102066[_0xe7ba('0x3e')]===_0x54e2ad['type'];});_0x365573[_0xe7ba('0x43')]=_0x316b51[_0xe7ba('0x21')];_0x365573['rows']=_0x316b51;}_0x2cfdc3(_0x365573);});},'VoiceQueuesChannel':function(_0x3b4ae4){var _0x4f91fa=this;return new Promise(function(_0xe2cbba,_0x2a8317){var _0x30df6b=schema(properties['voicequeuechannel'])[_0xe7ba('0x1')](_0x3b4ae4);if(_0x30df6b[_0xe7ba('0x21')]>0x0){return _0x2a8317(_0x4f91fa[_0xe7ba('0xf')](0x1f4,_[_0xe7ba('0x26')](_0x30df6b,_0xe7ba('0x16'))['join'](',\x20')));}var _0x2cff22=_[_0xe7ba('0x22')](_0x2276df[_0xe7ba('0x3d')],{'uniqueid':_0x3b4ae4[_0xe7ba('0x27')]});if(_0x2cff22){_0xe2cbba(_0x2cff22);}else{return _0x2a8317(_0x4f91fa[_0xe7ba('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x2cbdb1){var _0x16df22=this;return new Promise(function(_0x37a449,_0x41dbf2){if(ami['isConnected']()==![]){return _0x41dbf2(_0x16df22[_0xe7ba('0xf')](0x1f4,[config[_0xe7ba('0x17')]['ip'],config[_0xe7ba('0x17')][_0xe7ba('0x10')],_0xe7ba('0x11')][_0xe7ba('0x12')]('\x20')));}var _0x4db315=schema(properties[_0xe7ba('0x44')])[_0xe7ba('0x1')](_0x2cbdb1);if(_0x4db315[_0xe7ba('0x21')]>0x0){return _0x41dbf2(_0x16df22['error'](0x1f4,_[_0xe7ba('0x26')](_0x4db315,_0xe7ba('0x16'))[_0xe7ba('0x12')](',\x20')));}var _0x3187fd=_[_0xe7ba('0x22')](_0x2276df[_0xe7ba('0x3d')],{'uniqueid':_0x2cbdb1[_0xe7ba('0x27')]});if(_0x3187fd&&_0x3187fd[_0xe7ba('0x28')]){return ami[_0xe7ba('0x1c')]({'action':_0xe7ba('0x45'),'channel':_0x3187fd[_0xe7ba('0x28')]})[_0xe7ba('0x15')](function(_0x4a5c8c){_0x37a449({'code':0xc8,'message':[_0x2cbdb1[_0xe7ba('0x27')],_0x4a5c8c[_0xe7ba('0x16')][_0xe7ba('0x2d')]()]['join']('\x20')});})[_0xe7ba('0x1e')](function(_0x49e66a){_0x41dbf2(_0x16df22[_0xe7ba('0xf')](0x1f5,[_0x2cbdb1[_0xe7ba('0x27')],_0x49e66a[_0xe7ba('0x16')]['toLowerCase']()]['join']('\x20')));});}else{return _0x41dbf2(_0x16df22[_0xe7ba('0xf')](0x1f5,_0xe7ba('0x36')));}});},'VoiceQueuesChannelRedirect':function(_0x2c052b){var _0x4de4c9=this;return new Promise(function(_0x3ba4fd,_0x6866ef){if(ami[_0xe7ba('0xe')]()==![]){return _0x6866ef(_0x4de4c9[_0xe7ba('0xf')](0x1f4,[config[_0xe7ba('0x17')]['ip'],config['asterisk'][_0xe7ba('0x10')],_0xe7ba('0x11')][_0xe7ba('0x12')]('\x20')));}var _0x50cc8b=schema(properties[_0xe7ba('0x46')])[_0xe7ba('0x1')](_0x2c052b);if(_0x50cc8b[_0xe7ba('0x21')]>0x0){return _0x6866ef(_0x4de4c9[_0xe7ba('0xf')](0x1f4,_[_0xe7ba('0x26')](_0x50cc8b,_0xe7ba('0x16'))[_0xe7ba('0x12')](',\x20')));}var _0x318d99=_[_0xe7ba('0x22')](_0x2276df[_0xe7ba('0x3d')],{'uniqueid':_0x2c052b['uniqueid']});if(_0x318d99&&_0x318d99[_0xe7ba('0x28')]){return ami[_0xe7ba('0x1c')]({'action':_0xe7ba('0x47'),'channel':_0x318d99[_0xe7ba('0x28')],'exten':_0x2c052b['exten'],'context':_0x2c052b['context']||_0x318d99[_0xe7ba('0x48')],'priority':0x1})[_0xe7ba('0x15')](function(_0x10bd7c){_0x3ba4fd({'code':0xc8,'message':[_0x2c052b['uniqueid'],_0x10bd7c['message']['toLowerCase']()][_0xe7ba('0x12')]('\x20')});})[_0xe7ba('0x1e')](function(_0x4c64eb){_0x6866ef(_0x4de4c9[_0xe7ba('0xf')](0x1f5,[_0x2c052b['uniqueid'],_0x4c64eb[_0xe7ba('0x16')]['toLowerCase']()][_0xe7ba('0x12')]('\x20')));});}else{return _0x6866ef(_0x4de4c9['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x2ba416){return new Promise(function(_0x2cabcf){var _0x65ea35=_[_0xe7ba('0x24')](_0x2276df[_0xe7ba('0xc')]);if(_0x2ba416&&_0x2ba416['id']){var _0x35b755=_['find'](_0x65ea35,function(_0x5a3591){return _0x5a3591['id']===_0x2ba416['id'];});_0x2cabcf(_0x35b755);}else{_0x2cabcf({'count':_0x65ea35[_0xe7ba('0x21')],'rows':_0x65ea35});}});},'Telephones':function(){return new Promise(function(_0x221f05){var _0xbf140a=_[_0xe7ba('0x24')](_0x2276df[_0xe7ba('0x49')]);_0x221f05({'count':_0xbf140a[_0xe7ba('0x21')],'rows':_0xbf140a});});},'Trunks':function(){return new Promise(function(_0x1f36c8){var _0x2d09df=_[_0xe7ba('0x24')](_0x2276df[_0xe7ba('0x4a')]);_0x1f36c8({'count':_0x2d09df[_0xe7ba('0x21')],'rows':_0x2d09df});});},'OutboundChannels':function(){return new Promise(function(_0x246f91){var _0x2022e2=_[_0xe7ba('0x24')](_0x2276df[_0xe7ba('0x4b')]);_0x246f91({'count':_0x2022e2['length'],'rows':_0x2022e2});});},'Outbound':function(){return new Promise(function(_0xc4b4e0){_0xc4b4e0(_0x2276df[_0xe7ba('0x40')]);});},'Campaigns':function(){return new Promise(function(_0x5e16f1){var _0xe047bc=_[_0xe7ba('0x24')](_0x2276df[_0xe7ba('0x4c')]);_0x5e16f1({'count':_0xe047bc[_0xe7ba('0x21')],'rows':_0xe047bc});});},'VoiceQueuesPreview':function(_0x11ca03){var _0x2044db=this;return new Promise(function(_0x24c94a,_0x418831){_0x398a6a[_0xe7ba('0x4d')](_0x11ca03['id'])['then'](function(_0x38cf09){_0x24c94a({'code':0xc8,'message':_0x38cf09['message']});})[_0xe7ba('0x1e')](function(_0x6a7bac){_0x418831(_0x2044db[_0xe7ba('0xf')](0x1f4,_0x6a7bac['message']));});});},'EventManager':function(_0x156b66){var _0x40eb35=this;return new Promise(function(_0x2f1938,_0x3a1dca){if(!_0x156b66['event']){return _0x3a1dca(_0x40eb35[_0xe7ba('0xf')](0x1f4,_0xe7ba('0x4e')));}ami[_0xe7ba('0x4f')](_0xe7ba('0x50')+_0x156b66['event'],_0x156b66[_0xe7ba('0x16')]);_0x2f1938({'code':0xc8,'message':_0x156b66});});},'FaxAccounts':function(){return new Promise(function(_0x34781a){var _0x1800f4=_[_0xe7ba('0x24')](_0x2276df[_0xe7ba('0x51')]);_0x34781a({'count':_0x1800f4['length'],'rows':_0x1800f4});});},'SendFax':function(_0x5162e6){var _0x4cb086=this;return new Promise(function(_0x374e59,_0x45ad54){_0xfd3a22[_0xe7ba('0x52')](_0x5162e6)[_0xe7ba('0x15')](function(_0x1b64de){_0x374e59({'code':0xc8,'message':_0x1b64de[_0xe7ba('0x16')]});})['catch'](function(_0xba3f50){_0x45ad54(_0x4cb086['error'](0x1f4,_0xba3f50[_0xe7ba('0x16')]));});});},'CheckAfterSend':function(_0x2e3e28){var _0x34f7ac=this;return new Promise(function(_0x146e33,_0x2d1076){_0xfd3a22[_0xe7ba('0x53')](_0x2e3e28)['then'](function(_0x44563b){_0x146e33({'code':0xc8,'message':_0x44563b[_0xe7ba('0x16')]});})[_0xe7ba('0x1e')](function(_0x18e715){_0x2d1076(_0x34f7ac[_0xe7ba('0xf')](0x1f4,_0x18e715['message']));});});}};var _0x460bc0=jayson['server'](_0x10b307)[_0xe7ba('0x54')]();_0x460bc0['on'](_0xe7ba('0xf'),function(_0x6714af){return _0x3c5e59(_0x6714af);});_0x460bc0[_0xe7ba('0x5')](0x232a,_0xe7ba('0x55'),function(){console[_0xe7ba('0x56')](_0xe7ba('0x57'),0x232a);return _0x2d31df(_0xe7ba('0x58')+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 6bc09c3..d4a7174 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 _0x20c9=['destcalleridnum','calleridnum','mobile','fax','createdAt','scheduledAt','updatedAt','resolve','getContacts','then','isEmpty','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','Unknown','firstName','destcalleridname','','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','trigger:%s','action','toLowerCase','length','lodash','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId'];(function(_0x1f0639,_0x306cfb){var _0x1080c2=function(_0x3d6490){while(--_0x3d6490){_0x1f0639['push'](_0x1f0639['shift']());}};_0x1080c2(++_0x306cfb);}(_0x20c9,0x163));var _0x920c=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0x20c9[_0x1d87fc];return _0x492b56;};'use strict';var _=require(_0x920c('0x0'));var BPromise=require('bluebird');var Redis=require(_0x920c('0x1'));var util=require(_0x920c('0x2'));var config=require('../../../../config/environment');var logger=require(_0x920c('0x3'))(_0x920c('0x4'));var cmContactRpc=require(_0x920c('0x5'));config[_0x920c('0x6')]=_[_0x920c('0x7')](config[_0x920c('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x920c('0x8'))(new Redis(config[_0x920c('0x6')]));function emit(_0x549568,_0x113386,_0xfa8952,_0x52a16b,_0x15973d){logger[_0x920c('0x9')](_0x920c('0xa'),_0x549568,_0x113386['id'],_0xfa8952,_0x52a16b,JSON['stringify'](_0x15973d));io['to'](_0xfa8952)['emit'](_0x52a16b,_0x15973d);}exports[_0x920c('0xb')]=function(_0x3de5c3,_0x71c14c,_0x1d8ffc,_0x452f43){var _0x4d71fb,_0x58ab98;var _0x572424={};var _0x27c19a;var _0x54185f=Number(_0x1d8ffc['data1']);var _0x5e66c6=_0x1d8ffc[_0x920c('0xc')]?Boolean(Number(_0x1d8ffc[_0x920c('0xc')])):![];var _0x32c441;var _0x57de9f=![];if(!_[_0x920c('0xd')](_0x1d8ffc['data5'])){if(_0x1d8ffc[_0x920c('0xe')]=='1')_0x57de9f=!![];}if(!_0x57de9f){if(_0x452f43['xmd-contactid']){_0x572424['id']=_0x452f43[_0x920c('0xf')];}}if(!_0x572424['id']){_0x572424[_0x920c('0x10')]=_0x54185f;_0x32c441=_0x1d8ffc['data3']&&_0x1d8ffc['data3']!=='0'?_0x1d8ffc[_0x920c('0x11')][_0x920c('0x12')](','):[_0x920c('0x13')];_0x572424[_0x920c('0x14')]=_[_0x920c('0x15')](_0x32c441,function(_0x4e2f8b){var _0xdeb9c5={};_0xdeb9c5[_0x4e2f8b]=_0x452f43[_0x920c('0x16')]?_0x452f43[_0x920c('0x17')]:_0x452f43[_0x920c('0x18')];return _0xdeb9c5;});_0x27c19a=_0x452f43[_0x920c('0x16')]?_0x452f43[_0x920c('0x17')]:_0x452f43[_0x920c('0x18')];}var _0x31d76c=['id','firstName','lastName',_0x920c('0x13'),_0x920c('0x19'),_0x920c('0x1a'),_0x920c('0x10'),_0x920c('0x1b'),_0x920c('0x1c'),_0x920c('0x1d')];var _0x2b536c=_['union'](_0x31d76c,_0x32c441);BPromise[_0x920c('0x1e')]()['then'](cmContactRpc[_0x920c('0x1f')]({'attributes':_0x2b536c,'where':_0x572424,'phone':_0x27c19a}))[_0x920c('0x20')](function(_0x55f088){_0x58ab98=_0x55f088;if(!_[_0x920c('0x21')](_0x58ab98)){if(_0x58ab98['length']===0x1){_0x4d71fb=_0x58ab98[0x0];logger[_0x920c('0x9')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x452f43[_0x920c('0x22')],_0x71c14c['id'],_0x4d71fb['id']);}else{logger[_0x920c('0x9')](_0x920c('0x23'),_0x452f43[_0x920c('0x22')],_0x71c14c['id'],_['map'](_0x58ab98,'id')[_0x920c('0x24')](','));}return;}else{logger[_0x920c('0x9')](_0x920c('0x25'),_0x452f43['uniqueid'],_0x71c14c['id']);var _0x57af2a={'ListId':_0x54185f};var _0x11f322=_0x1d8ffc['data4']&&_0x1d8ffc[_0x920c('0x26')]!=='0'?_0x1d8ffc[_0x920c('0x26')]:_0x920c('0x13');if(_0x5e66c6){logger[_0x920c('0x9')](_0x920c('0x27'),_0x452f43[_0x920c('0x22')],_0x71c14c['id']);_0x57af2a[_0x11f322]=_[_0x920c('0xd')](_0x452f43[_0x920c('0x16')])?_0x452f43[_0x920c('0x18')]:_0x452f43[_0x920c('0x17')];if(_[_0x920c('0xd')](_0x452f43[_0x920c('0x16')])){_0x57af2a['firstName']=_0x452f43[_0x920c('0x28')]&&_0x452f43[_0x920c('0x28')]!==''?_0x452f43[_0x920c('0x28')]:_0x920c('0x29');}else{_0x57af2a[_0x920c('0x2a')]=_0x452f43[_0x920c('0x2b')]&&_0x452f43[_0x920c('0x2b')]!==_0x920c('0x2c')?_0x452f43[_0x920c('0x2b')]:_0x920c('0x29');}return BPromise[_0x920c('0x1e')]()[_0x920c('0x20')](cmContactRpc[_0x920c('0x2d')](_0x57af2a))['then'](function(_0x56abb7){_0x4d71fb=_0x56abb7;_0x58ab98['push'](_0x56abb7);if(_0x4d71fb){logger[_0x920c('0x9')](_0x920c('0x2e'),_0x452f43[_0x920c('0x22')],_0x71c14c['id'],_0x4d71fb['id']);}return;});}else{logger['info'](_0x920c('0x2f'),_0x452f43['uniqueid'],_0x71c14c['id']);_0x57af2a[_0x11f322]=_['isNil'](_0x452f43[_0x920c('0x16')])?_0x452f43[_0x920c('0x18')]:_0x452f43[_0x920c('0x17')];if(_[_0x920c('0xd')](_0x452f43['routeId'])){_0x57af2a['firstName']=_0x452f43[_0x920c('0x28')]&&_0x452f43[_0x920c('0x28')]!==''?_0x452f43['calleridname']:_0x920c('0x29');}else{_0x57af2a[_0x920c('0x2a')]=_0x452f43[_0x920c('0x2b')]&&_0x452f43[_0x920c('0x2b')]!==_0x920c('0x2c')?_0x452f43[_0x920c('0x2b')]:_0x920c('0x29');}_0x4d71fb=_0x57af2a;_0x58ab98[_0x920c('0x30')](_0x57af2a);return;}}})[_0x920c('0x20')](function(){if(_0x3de5c3){emit(_0x452f43[_0x920c('0x22')],_0x71c14c,util[_0x920c('0x31')]('user:%s',_0x3de5c3['name']),util[_0x920c('0x31')](_0x920c('0x32'),_0x1d8ffc[_0x920c('0x33')][_0x920c('0x34')]()),{'evt':_['merge'](_0x452f43,{'autoCreate':_0x5e66c6}),'contact':_0x4d71fb===undefined?{}:_0x4d71fb,'contacts':_0x58ab98[_0x920c('0x35')]===0x0?undefined:_0x58ab98});}});}; \ No newline at end of file +var _0xdf08=['action','toLowerCase','merge','lodash','bluebird','ioredis','../../../../config/logger','trigger','defaults','redis','localhost','[CM][%s][%s]','emit','exec','data1','data2','isNil','data5','data3','split','phone','$or','routeId','calleridnum','firstName','lastName','mobile','fax','ListId','createdAt','scheduledAt','updatedAt','union','resolve','then','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','info','[CM][%s][%s]\x20Contact\x20not\x20found','uniqueid','data4','destcalleridnum','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','trigger:%s'];(function(_0xced98a,_0x5cb79a){var _0x2055db=function(_0x7c4807){while(--_0x7c4807){_0xced98a['push'](_0xced98a['shift']());}};_0x2055db(++_0x5cb79a);}(_0xdf08,0x1f2));var _0x8df0=function(_0x251c99,_0x2351fc){_0x251c99=_0x251c99-0x0;var _0x4a747b=_0xdf08[_0x251c99];return _0x4a747b;};'use strict';var _=require(_0x8df0('0x0'));var BPromise=require(_0x8df0('0x1'));var Redis=require(_0x8df0('0x2'));var util=require('util');var config=require('../../../../config/environment');var logger=require(_0x8df0('0x3'))(_0x8df0('0x4'));var cmContactRpc=require('../../rpc/cmContact');config['redis']=_[_0x8df0('0x5')](config[_0x8df0('0x6')],{'host':_0x8df0('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8df0('0x6')]));function emit(_0x402f06,_0x5cee55,_0x5d5756,_0x245c72,_0x2dc996){logger['info'](_0x8df0('0x8'),_0x402f06,_0x5cee55['id'],_0x5d5756,_0x245c72,JSON['stringify'](_0x2dc996));io['to'](_0x5d5756)[_0x8df0('0x9')](_0x245c72,_0x2dc996);}exports[_0x8df0('0xa')]=function(_0x656225,_0x39bb5b,_0x295ad7,_0x30c12d){var _0x3fc4ab,_0x4db131;var _0x4ffb20={};var _0x1c7e03;var _0x5b1c0c=Number(_0x295ad7[_0x8df0('0xb')]);var _0x5cc0ac=_0x295ad7[_0x8df0('0xc')]?Boolean(Number(_0x295ad7[_0x8df0('0xc')])):![];var _0x36bc92;var _0x39a0ec=![];if(!_[_0x8df0('0xd')](_0x295ad7[_0x8df0('0xe')])){if(_0x295ad7[_0x8df0('0xe')]=='1')_0x39a0ec=!![];}if(!_0x39a0ec){if(_0x30c12d['xmd-contactid']){_0x4ffb20['id']=_0x30c12d['xmd-contactid'];}}if(!_0x4ffb20['id']){_0x4ffb20['ListId']=_0x5b1c0c;_0x36bc92=_0x295ad7[_0x8df0('0xf')]&&_0x295ad7['data3']!=='0'?_0x295ad7[_0x8df0('0xf')][_0x8df0('0x10')](','):[_0x8df0('0x11')];_0x4ffb20[_0x8df0('0x12')]=_['map'](_0x36bc92,function(_0x3ee08c){var _0xb7dae8={};_0xb7dae8[_0x3ee08c]=_0x30c12d[_0x8df0('0x13')]?_0x30c12d['destcalleridnum']:_0x30c12d[_0x8df0('0x14')];return _0xb7dae8;});_0x1c7e03=_0x30c12d[_0x8df0('0x13')]?_0x30c12d['destcalleridnum']:_0x30c12d[_0x8df0('0x14')];}var _0x2a35d9=['id',_0x8df0('0x15'),_0x8df0('0x16'),_0x8df0('0x11'),_0x8df0('0x17'),_0x8df0('0x18'),_0x8df0('0x19'),_0x8df0('0x1a'),_0x8df0('0x1b'),_0x8df0('0x1c')];var _0x457bcb=_[_0x8df0('0x1d')](_0x2a35d9,_0x36bc92);BPromise[_0x8df0('0x1e')]()[_0x8df0('0x1f')](cmContactRpc['getContacts']({'attributes':_0x457bcb,'where':_0x4ffb20,'phone':_0x1c7e03}))[_0x8df0('0x1f')](function(_0x1eab32){_0x4db131=_0x1eab32;if(!_['isEmpty'](_0x4db131)){if(_0x4db131[_0x8df0('0x20')]===0x1){_0x3fc4ab=_0x4db131[0x0];logger['info'](_0x8df0('0x21'),_0x30c12d['uniqueid'],_0x39bb5b['id'],_0x3fc4ab['id']);}else{logger['info'](_0x8df0('0x22'),_0x30c12d['uniqueid'],_0x39bb5b['id'],_['map'](_0x4db131,'id')[_0x8df0('0x23')](','));}return;}else{logger[_0x8df0('0x24')](_0x8df0('0x25'),_0x30c12d[_0x8df0('0x26')],_0x39bb5b['id']);var _0x23b0e4={'ListId':_0x5b1c0c};var _0x5c7921=_0x295ad7[_0x8df0('0x27')]&&_0x295ad7['data4']!=='0'?_0x295ad7[_0x8df0('0x27')]:_0x8df0('0x11');if(_0x5cc0ac){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x30c12d[_0x8df0('0x26')],_0x39bb5b['id']);_0x23b0e4[_0x5c7921]=_['isNil'](_0x30c12d[_0x8df0('0x13')])?_0x30c12d['calleridnum']:_0x30c12d[_0x8df0('0x28')];if(_['isNil'](_0x30c12d[_0x8df0('0x13')])){_0x23b0e4[_0x8df0('0x15')]=_0x30c12d['calleridname']&&_0x30c12d[_0x8df0('0x29')]!==_0x8df0('0x2a')?_0x30c12d[_0x8df0('0x29')]:_0x8df0('0x2b');}else{_0x23b0e4[_0x8df0('0x15')]=_0x30c12d[_0x8df0('0x2c')]&&_0x30c12d[_0x8df0('0x2c')]!==_0x8df0('0x2a')?_0x30c12d['destcalleridname']:_0x8df0('0x2b');}return BPromise[_0x8df0('0x1e')]()[_0x8df0('0x1f')](cmContactRpc[_0x8df0('0x2d')](_0x23b0e4))[_0x8df0('0x1f')](function(_0x41e3c4){_0x3fc4ab=_0x41e3c4;_0x4db131[_0x8df0('0x2e')](_0x41e3c4);if(_0x3fc4ab){logger[_0x8df0('0x24')](_0x8df0('0x2f'),_0x30c12d[_0x8df0('0x26')],_0x39bb5b['id'],_0x3fc4ab['id']);}return;});}else{logger[_0x8df0('0x24')](_0x8df0('0x30'),_0x30c12d[_0x8df0('0x26')],_0x39bb5b['id']);_0x23b0e4[_0x5c7921]=_[_0x8df0('0xd')](_0x30c12d[_0x8df0('0x13')])?_0x30c12d[_0x8df0('0x14')]:_0x30c12d[_0x8df0('0x28')];if(_[_0x8df0('0xd')](_0x30c12d[_0x8df0('0x13')])){_0x23b0e4['firstName']=_0x30c12d[_0x8df0('0x29')]&&_0x30c12d[_0x8df0('0x29')]!==_0x8df0('0x2a')?_0x30c12d[_0x8df0('0x29')]:_0x8df0('0x2b');}else{_0x23b0e4[_0x8df0('0x15')]=_0x30c12d[_0x8df0('0x2c')]&&_0x30c12d[_0x8df0('0x2c')]!==_0x8df0('0x2a')?_0x30c12d[_0x8df0('0x2c')]:_0x8df0('0x2b');}_0x3fc4ab=_0x23b0e4;_0x4db131['push'](_0x23b0e4);return;}}})[_0x8df0('0x1f')](function(){if(_0x656225){emit(_0x30c12d['uniqueid'],_0x39bb5b,util[_0x8df0('0x31')](_0x8df0('0x32'),_0x656225['name']),util[_0x8df0('0x31')](_0x8df0('0x33'),_0x295ad7[_0x8df0('0x34')][_0x8df0('0x35')]()),{'evt':_[_0x8df0('0x36')](_0x30c12d,{'autoCreate':_0x5cc0ac}),'contact':_0x3fc4ab===undefined?{}:_0x3fc4ab,'contacts':_0x4db131[_0x8df0('0x20')]===0x0?undefined:_0x4db131});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 999aa28..71e9817 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 _0x17ae=['salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentringnoanswer','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','stringify','clone','motionChannel','undefined','voice','debug','inspect','checkTriggers','interface','hasOwnProperty','status','checkTrigger','variables','Actions','length','action','contactmanager','motionbar','browser','data1','TemplateId','data2','html','render','uri','buildUri','isNil','data3','data4','location','uriLocation','data5','800','windowHeight','data6','winArguments','format','user:%s','name','trigger:%s:%s','toLowerCase','jscripty','trigger:%s','merge','integration','exec','queue','routeId','urlforward','script','parse','query','search','replace','channel','AllConditions','every','checkConditions','AnyConditions','checkTrigger:\x20trigger','evt','field','account','chat','ChatWebsiteId','AccountId','operator','value','upperFirst','interaction','message','agent','membername','lastevent','mailSubstatus','null','substatus','created','equals','exports','util','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','defaults','redis','localhost','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x17ae,0x189));var _0xe17a=function(_0x12a901,_0x386473){_0x12a901=_0x12a901-0x0;var _0x42437e=_0x17ae[_0x12a901];return _0x42437e;};'use strict';var util=require(_0xe17a('0x0'));var _=require('lodash');var url=require(_0xe17a('0x1'));var Mustache=require(_0xe17a('0x2'));var Redis=require(_0xe17a('0x3'));var urlforward=require(_0xe17a('0x4'));var integration=require(_0xe17a('0x5'));var cmContact=require(_0xe17a('0x6'));var script=require(_0xe17a('0x7'));var config=require(_0xe17a('0x8'));var logger=require(_0xe17a('0x9'))(_0xe17a('0xa'));var ami=require(_0xe17a('0xb'));config['redis']=_[_0xe17a('0xc')](config[_0xe17a('0xd')],{'host':_0xe17a('0xe'),'port':0x18eb});var io=require(_0xe17a('0xf'))(new Redis(config[_0xe17a('0xd')]));var operators={'equals':function(_0x2a0ce4,_0x4a5ae4){return _0x2a0ce4==_0x4a5ae4;},'not_equals':function(_0x42df9a,_0x33871e){return _0x42df9a!=_0x33871e;}};var barAndWebActions=['popup',_0xe17a('0x1'),_0xe17a('0x10')];function Trigger(_0x3ddb95){this[_0xe17a('0x11')]=_0x3ddb95[_0xe17a('0x11')];this[_0xe17a('0x12')]=_0x3ddb95[_0xe17a('0x12')];this['voiceQueues']=_0x3ddb95[_0xe17a('0x13')];this['templates']=_0x3ddb95[_0xe17a('0x14')];this[_0xe17a('0x15')]=_0x3ddb95['voiceExtensions'];this[_0xe17a('0x16')]=_0x3ddb95['zendeskAccounts'];this[_0xe17a('0x17')]=_0x3ddb95[_0xe17a('0x17')];this['salesforceAccounts']=_0x3ddb95[_0xe17a('0x18')];this[_0xe17a('0x19')]=_0x3ddb95['sugarcrmAccounts'];this['zohoAccounts']=_0x3ddb95[_0xe17a('0x1a')];this[_0xe17a('0x1b')]=_0x3ddb95['deskAccounts'];this[_0xe17a('0x1c')]=_0x3ddb95[_0xe17a('0x1c')];this[_0xe17a('0x1d')]=_0x3ddb95[_0xe17a('0x1d')];this[_0xe17a('0x1e')]=_0x3ddb95[_0xe17a('0x1e')];this['freshsalesAccounts']=_0x3ddb95[_0xe17a('0x1f')];this[_0xe17a('0x20')]={'zendesk':this[_0xe17a('0x16')],'salesforce':this[_0xe17a('0x18')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0xe17a('0x19')],'zoho':this[_0xe17a('0x1a')],'desk':this[_0xe17a('0x1b')],'vtiger':this[_0xe17a('0x1c')],'dynamics365':this[_0xe17a('0x1e')],'freshsales':this[_0xe17a('0x1f')],'servicenow':this[_0xe17a('0x1d')]};ami['on'](_0xe17a('0x21'),this['syncCustomEvent'][_0xe17a('0x22')](this));ami['on'](_0xe17a('0x23'),this[_0xe17a('0x24')][_0xe17a('0x22')](this));ami['on'](_0xe17a('0x25'),this['syncCustomEvent'][_0xe17a('0x22')](this));ami['on']('custom:agentcomplete',this[_0xe17a('0x24')][_0xe17a('0x22')](this));ami['on']('custom:agentnosuchnumber',this['syncCustomEvent'][_0xe17a('0x22')](this));ami['on'](_0xe17a('0x26'),this[_0xe17a('0x24')][_0xe17a('0x22')](this));ami['on'](_0xe17a('0x27'),this[_0xe17a('0x24')][_0xe17a('0x22')](this));ami['on'](_0xe17a('0x28'),this[_0xe17a('0x24')][_0xe17a('0x22')](this));ami['on'](_0xe17a('0x29'),this[_0xe17a('0x24')]['bind'](this));ami['on'](_0xe17a('0x2a'),this[_0xe17a('0x24')][_0xe17a('0x22')](this));ami['on'](_0xe17a('0x2b'),this[_0xe17a('0x24')]['bind'](this));ami['on'](_0xe17a('0x2c'),this['syncCustomEvent'][_0xe17a('0x22')](this));ami['on'](_0xe17a('0x2d'),this[_0xe17a('0x2e')][_0xe17a('0x22')](this));ami['on'](_0xe17a('0x2f'),this[_0xe17a('0x2e')][_0xe17a('0x22')](this));ami['on'](_0xe17a('0x30'),this['syncAgentDial']['bind'](this));ami['on'](_0xe17a('0x31'),this['syncCustomEvent'][_0xe17a('0x22')](this));ami['on'](_0xe17a('0x32'),this[_0xe17a('0x24')][_0xe17a('0x22')](this));ami['on']('custom:substatus',this[_0xe17a('0x24')][_0xe17a('0x22')](this));ami['on'](_0xe17a('0x33'),this[_0xe17a('0x24')][_0xe17a('0x22')](this));ami['on'](_0xe17a('0x34'),this[_0xe17a('0x24')]['bind'](this));ami['on'](_0xe17a('0x35'),this['syncCustomEvent'][_0xe17a('0x22')](this));ami['on'](_0xe17a('0x36'),this[_0xe17a('0x24')][_0xe17a('0x22')](this));ami['on'](_0xe17a('0x37'),this['syncCustomEvent']['bind'](this));}Trigger[_0xe17a('0x38')][_0xe17a('0x39')]=function(_0x3ead28,_0x1c705b,_0x76dda4){logger[_0xe17a('0x3a')](_0x3ead28,_0x1c705b,JSON[_0xe17a('0x3b')](_0x76dda4));io['to'](_0x3ead28)[_0xe17a('0x39')](_0x1c705b,_0x76dda4);};Trigger[_0xe17a('0x38')][_0xe17a('0x24')]=function(_0x2f3cd9){var _0x31e471=_[_0xe17a('0x3c')](_0x2f3cd9);if(typeof _0x31e471[_0xe17a('0x3d')]===_0xe17a('0x3e')){_0x31e471[_0xe17a('0x3d')]=_0xe17a('0x3f');}logger[_0xe17a('0x40')](_0xe17a('0x24'),util[_0xe17a('0x41')](_0x31e471,{'showHidden':!![],'depth':null}));this[_0xe17a('0x42')](_0x31e471);};Trigger['prototype'][_0xe17a('0x2e')]=function(_0x1236c9){if(this['agents'][_0x1236c9[_0xe17a('0x43')]]){this[_0xe17a('0x24')](_0x1236c9);}};Trigger[_0xe17a('0x38')][_0xe17a('0x42')]=function(_0x1a8f4f){var _0x2cc849;for(var _0x8cb922 in this[_0xe17a('0x11')]){if(this[_0xe17a('0x11')][_0xe17a('0x44')](_0x8cb922)){if(this[_0xe17a('0x11')][_0x8cb922][_0xe17a('0x45')]){_0x2cc849=this[_0xe17a('0x46')](this['triggers'][_0x8cb922],_0x1a8f4f);if(_0x2cc849){_['merge'](_0x1a8f4f,_0x1a8f4f[_0xe17a('0x47')]);for(var _0x5a0f4e=0x0,_0x4d9e8c,_0x24950b,_0x1cb2c8;_0x5a0f4e0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file +var _0x7217=['format','%s/users','remoteUri','then','total_entries','find','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','length','map','forEach','string','picklist','nameField','customField','content','toString','includes','idField','custom_fields','variable','variableName','type','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','new','xCALLY','Motion','CTI','Tags','Descriptions','user','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','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','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x302294,_0x218c81){var _0xe3eae4=function(_0x41780f){while(--_0x41780f){_0x302294['push'](_0x302294['shift']());}};_0xe3eae4(++_0x218c81);}(_0x7217,0x19e));var _0x7721=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x7217[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x7721('0x0'));var rp=require('request-promise');var md5=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var Redis=require(_0x7721('0x3'));var intUtil=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('desk');config[_0x7721('0x6')]=_[_0x7721('0x7')](config[_0x7721('0x6')],{'host':_0x7721('0x8'),'port':0x18eb});var io=require(_0x7721('0x9'))(new Redis(config[_0x7721('0x6')]));function emit(_0x18ab6b,_0x21f680,_0x225610){io['to'](_0x18ab6b)[_0x7721('0xa')](_0x21f680,_0x225610);}var headers={'Content-Type':_0x7721('0xb'),'Accept':_0x7721('0xb')};function getUser(_0xfa8835,_0x138740){if(intUtil[_0x7721('0xc')](_0x138740)===!![]){logger['info'](_0x7721('0xd'),_0x138740);return request({'uri':util[_0x7721('0xe')](_0x7721('0xf'),_0xfa8835[_0x7721('0x10')])})[_0x7721('0x11')](function(_0x409b37){if(_0x409b37[_0x7721('0x12')]){return _[_0x7721('0x13')](_0x409b37['_embedded'][_0x7721('0x14')],{'email':_0x138740});}})[_0x7721('0x11')](function(_0x57ff6d){if(_0x57ff6d){logger[_0x7721('0x15')](_0x7721('0x16'));return _0x57ff6d;}else{logger[_0x7721('0x15')](_0x7721('0x17'));return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}}function request(_0x3cc909){logger[_0x7721('0x19')]('[HTTP]',JSON[_0x7721('0x1a')](_0x3cc909));return rp(_['defaults'](_0x3cc909,{'method':_0x7721('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x5cb0e6){var _0xfec626;if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x1d')){_0xfec626=util[_0x7721('0xe')](_0x7721('0x1e'),_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x20')]);}else if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x21')){_0xfec626=util[_0x7721('0xe')]('%s/token:%s',_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x21')]);}return util[_0x7721('0xe')](_0x7721('0x22'),new Buffer(_0xfec626)['toString'](_0x7721('0x23')));}function getEndUser(_0x512f31,_0xb9e9dd,_0x288e3a){logger[_0x7721('0x15')](_0x7721('0x24'),_0x288e3a);return request({'uri':util[_0x7721('0xe')](_0x7721('0x25'),_0x512f31[_0x7721('0x10')]),'qs':{'phone':_0x288e3a}})['then'](function(_0x216f20){if(_0x216f20[_0x7721('0x12')]){logger[_0x7721('0x15')](_0x7721('0x26'));return _0x216f20[_0x7721('0x27')][_0x7721('0x14')][0x0];}else{logger[_0x7721('0x15')](_0x7721('0x28'));return request({'uri':util[_0x7721('0xe')]('%s/customers',_0x512f31[_0x7721('0x10')]),'method':'POST','body':{'first_name':_0xb9e9dd,'title':_0xb9e9dd,'phone_numbers':[{'type':'work','value':_0x288e3a}]}});}});}function getTags(_0x315202,_0x343c19){var _0x53c904=[];if(_0x315202&&_0x315202[_0x7721('0x29')]>0x0){_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 diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 2d15d7b..fe9d30c 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 _0x98b8=[']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','dynamics365','redis','defaults','localhost','modernAuthentication','CloudProvider','tenantId','data2','POST','clientId','remoteUri','password','clientSecret','then','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','length','isdisabled','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','username','userId','toLowerCase','outbound','destcalleridnum','/systemusers(','body','headers','lastIndexOf','enduserId','calleridnum','telephone1','&$filter=','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','includes','string','type','nameField','customField','substring','indexOf','content','ticketType','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','callDirection','queue','phonecalls','odata-entityid','ticketId','format','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','data7','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact'];(function(_0x3ce1dc,_0x40e4de){var _0x4dbfd6=function(_0xb81a7b){while(--_0xb81a7b){_0x3ce1dc['push'](_0x3ce1dc['shift']());}};_0x4dbfd6(++_0x40e4de);}(_0x98b8,0x1b2));var _0x898b=function(_0x5738d7,_0x424f69){_0x5738d7=_0x5738d7-0x0;var _0x19dd9c=_0x98b8[_0x5738d7];return _0x19dd9c;};'use strict';var _=require(_0x898b('0x0'));var rp=require(_0x898b('0x1'));var util=require(_0x898b('0x2'));var intUtil=require(_0x898b('0x3'));var md5=require(_0x898b('0x4'));var Redis=require(_0x898b('0x5'));var logger=require('../../../../config/logger')(_0x898b('0x6'));var config=require('../../../../config/environment');config[_0x898b('0x7')]=_[_0x898b('0x8')](config['redis'],{'host':_0x898b('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x898b('0x7')]));function getAuthToken(_0x185f6c,_0x934233,_0x549dd4){if(_0x185f6c[_0x898b('0xa')]){_0x185f6c['remoteUri']=_0x185f6c[_0x898b('0xb')]['data7'];_0x185f6c[_0x898b('0xc')]=_0x185f6c[_0x898b('0xb')][_0x898b('0xd')];return Promise['resolve'](_0x185f6c[_0x898b('0xb')]['data5']);}var _0x270f55={'method':_0x898b('0xe'),'uri':_0x934233,'form':{'client_id':_0x185f6c[_0x898b('0xf')],'resource':_0x185f6c[_0x898b('0x10')],'username':_0x185f6c['username'],'password':_0x185f6c[_0x898b('0x11')],'grant_type':_0x898b('0x11'),'client_secret':_0x185f6c[_0x898b('0x12')]},'json':!![]};return rp(_0x270f55)[_0x898b('0x13')](function(_0x304c35){return _0x304c35['access_token'];})[_0x898b('0x14')](function(_0x10f2c0){logger['error']('['+[_0x549dd4[_0x898b('0x15')]()]+_0x898b('0x16'));return _0x10f2c0[_0x898b('0x17')];});}function getUser(_0x2d910a,_0x129b74,_0x4f348b,_0x24902a,_0x2c8b10,_0x52ccb5){return new Promise(function(_0x489f4a,_0x2b871e){return getAuthToken(_0x129b74,_0x24902a,_0x52ccb5)[_0x898b('0x13')](function(_0x26a9a1){var _0x38d2b9={'method':_0x898b('0x18'),'uri':_0x2c8b10+_0x898b('0x19'),'headers':{'Authorization':_0x898b('0x1a')+_0x26a9a1,'OData-Version':_0x898b('0x1b')},'json':!![]};return rp(_0x38d2b9);})['then'](function(_0x58e9e5){var _0x561f93=_0x58e9e5[_0x898b('0x1c')];var _0x4a07cd=![];var _0x35c458=null;if(!_['isNil'](_0x4f348b)){if(intUtil[_0x898b('0x1d')](_0x4f348b['email'])){_0x2d910a['userEmail']=_0x4f348b['email'];for(_0x35c458=0x0;_0x35c458<_0x561f93[_0x898b('0x1e')];_0x35c458++){if(_0x561f93[_0x35c458]['internalemailaddress']===_0x4f348b['email']&&!_0x561f93[_0x35c458][_0x898b('0x1f')]){_0x4a07cd=!![];logger[_0x898b('0x20')]('['+[_0x52ccb5[_0x898b('0x15')]()]+_0x898b('0x21')+_0x561f93[_0x35c458][_0x898b('0x22')]+'!');_0x2d910a['userId']=_0x561f93[_0x35c458]['systemuserid'];}}}}if(!_0x4a07cd){logger['info']('['+[_0x52ccb5[_0x898b('0x15')]()]+_0x898b('0x23'));_0x2d910a[_0x898b('0x24')]=_0x129b74['username'];for(_0x35c458=0x0;_0x35c458<_0x561f93['length'];_0x35c458++){if(_0x561f93[_0x35c458]['internalemailaddress']===_0x129b74[_0x898b('0x25')]){_0x2d910a[_0x898b('0x26')]=_0x561f93[_0x35c458]['systemuserid'];}}}_0x489f4a(_0x2d910a);})[_0x898b('0x14')](function(_0x4c6c7e){_0x2b871e(_0x4c6c7e['message']);});});}function createEndUser(_0x14ac4a,_0x29c193,_0x516550,_0x5d8a57,_0x54cb95,_0x253e91,_0xa74885){return new Promise(function(_0x5dd203,_0x10d576){return getAuthToken(_0x29c193,_0x516550,_0x253e91)[_0x898b('0x13')](function(_0x35d489){var _0x3fc425=_0x253e91[_0x898b('0x27')]()===_0x898b('0x28')?_0x54cb95[_0x898b('0x29')]:_0x54cb95['calleridnum'];var _0x5761f4={'method':_0x898b('0xe'),'uri':_0x5d8a57+'contacts','body':{'fullname':_0x3fc425,'firstname':_0x3fc425,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x898b('0x2a')+_0x14ac4a[_0x898b('0x26')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x35d489,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x5761f4[_0x898b('0x2b')][_0xa74885]=_0x3fc425;return rp(_0x5761f4);})[_0x898b('0x13')](function(_0x1ecc8c){var _0x1ba296=_0x1ecc8c[_0x898b('0x2c')]['odata-entityid'];var _0x2766d6=_0x1ba296['substring'](_0x1ba296[_0x898b('0x2d')]('(')+0x1,_0x1ba296[_0x898b('0x2d')](')'));_0x14ac4a[_0x898b('0x2e')]=_0x2766d6;_0x5dd203(_0x14ac4a);})['catch'](function(_0x2ed6c7){_0x10d576(_0x2ed6c7['message']);});});}function getEndUser(_0x1899cc,_0x3ae357,_0x153cb1,_0xc1f595,_0xad0382,_0x32b62a,_0x4a61c4,_0xff8c12){var _0x16c7b8=_0x32b62a[_0x898b('0x27')]()==='outbound'?_0xad0382[_0x898b('0x29')]:_0xad0382[_0x898b('0x2f')];return getAuthToken(_0x3ae357,_0x153cb1,_0x32b62a)[_0x898b('0x13')](function(_0x304b05){_0xff8c12=_0xff8c12?_0xff8c12:_0x898b('0x30');var _0x166e06={'method':_0x898b('0x18'),'uri':_0xc1f595+'contacts?$select='+_0xff8c12+_0x898b('0x31')+_0xff8c12+'\x20eq\x20\x27'+_0x16c7b8[_0x898b('0x32')]('+',_0x898b('0x33'))+'\x27','headers':{'Authorization':_0x898b('0x1a')+_0x304b05,'If-None-Match':null,'OData-Version':_0x898b('0x1b')},'json':!![]};return rp(_0x166e06);})['then'](function(_0x1d6be8){var _0x5deb48=![];if(!_0x1d6be8)return _0x5deb48;var _0x44905d=_0x1d6be8[_0x898b('0x1c')];for(var _0x174bd3=0x0;_0x174bd3<_0x44905d['length'];_0x174bd3++){if(_0x44905d[_0x174bd3][_0xff8c12]===_0x16c7b8){_0x5deb48=!![];_0x1899cc[_0x898b('0x2e')]=_0x44905d[_0x174bd3][_0x898b('0x34')];}}return _0x5deb48;})['then'](function(_0x551200){if(_0x551200)return _0x1899cc;if(_0x4a61c4===_0x898b('0x35')){logger[_0x898b('0x20')]('['+[_0x32b62a['toUpperCase']()]+_0x898b('0x36'));return _0x1899cc;}return createEndUser(_0x1899cc,_0x3ae357,_0x153cb1,_0xc1f595,_0xad0382,_0x32b62a,_0xff8c12)[_0x898b('0x13')](function(_0x42be2a){logger['info']('['+[_0x32b62a[_0x898b('0x15')]()]+_0x898b('0x37'),_0x42be2a[_0x898b('0x2e')]);return _0x42be2a;});});}function getCustomFields(_0x245f78,_0x4c2c8f,_0x389592){var _0x2b10fd={};if(_0x245f78[_0x898b('0x1e')]>0x0){_['forEach'](_0x245f78,function(_0x147201){if(_[_0x898b('0x38')]([_0x898b('0x39'),'picklist'],_0x147201[_0x898b('0x3a')])&&_0x147201[_0x898b('0x3b')]&&!_0x147201[_0x898b('0x3c')]){var _0x58d836=_0x147201['idField'][_0x898b('0x27')]();var _0x57edd7=_0x58d836[_0x898b('0x3d')](0x0,_0x58d836[_0x898b('0x3e')]('_'));var _0x237f18=_0x58d836['substring'](_0x58d836['indexOf']('_')+0x1);if(_0x57edd7===_0x389592){_0x2b10fd[_0x237f18]=_0x147201[_0x898b('0x3f')];}}});}return _0x2b10fd;}function getTicket(_0x33521d,_0x2bf25f,_0x209680,_0x231f6b,_0x3b61e7,_0x50cfc1,_0x2ad36f){return new Promise(function(_0x244f97,_0x57da8b){var _0x58b117;return getAuthToken(_0x2bf25f,_0x209680,_0x2ad36f)[_0x898b('0x13')](function(_0x12b7cc){if(_0x50cfc1[_0x898b('0x40')]==='incident'){_0x58b117={'method':_0x898b('0xe'),'uri':_0x231f6b+_0x898b('0x41'),'body':Object[_0x898b('0x42')]({},{'title':intUtil[_0x898b('0x43')](_0x50cfc1[_0x898b('0x44')],_0x3b61e7,'\x20'),'description':intUtil[_0x898b('0x43')](_0x50cfc1[_0x898b('0x45')],_0x3b61e7,'\x0a'),'customerid_contact@odata.bind':_0x33521d['enduserId']?_0x898b('0x46')+_0x33521d[_0x898b('0x2e')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x33521d[_0x898b('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x50cfc1[_0x898b('0x47')],_0x3b61e7,_0x50cfc1[_0x898b('0x40')])),'headers':{'Authorization':_0x898b('0x1a')+_0x12b7cc,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x50cfc1[_0x898b('0x40')]==='phonecall'){var _0x22aefd=_0x33521d[_0x898b('0x2e')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x33521d[_0x898b('0x26')]+')','participationtypemask':_0x33521d[_0x898b('0x48')]===_0x898b('0x49')?0x2:0x1},{'partyid_contact@odata.bind':_0x898b('0x46')+_0x33521d['enduserId']+')','participationtypemask':_0x33521d['callDirection']===_0x898b('0x49')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x33521d[_0x898b('0x26')]+')','participationtypemask':_0x33521d['callDirection']===_0x898b('0x49')?0x2:0x1}];_0x58b117={'method':'POST','uri':_0x231f6b+_0x898b('0x4a'),'body':Object[_0x898b('0x42')]({},{'subject':intUtil[_0x898b('0x43')](_0x50cfc1[_0x898b('0x44')],_0x3b61e7,'\x20'),'phonenumber':String(_0x3b61e7[_0x898b('0x2f')]),'description':intUtil[_0x898b('0x43')](_0x50cfc1[_0x898b('0x45')],_0x3b61e7,'\x0a'),'regardingobjectid_contact@odata.bind':_0x33521d['enduserId']?_0x898b('0x46')+_0x33521d[_0x898b('0x2e')]+')':undefined,'ownerid@odata.bind':_0x898b('0x2a')+_0x33521d[_0x898b('0x26')]+')','directioncode':_0x33521d[_0x898b('0x48')]===_0x898b('0x49')?![]:!![],'phonecall_activity_parties':_0x22aefd},getCustomFields(_0x50cfc1['Fields'],_0x3b61e7,_0x50cfc1[_0x898b('0x40')])),'headers':{'Authorization':'Bearer\x20'+_0x12b7cc,'OData-Version':_0x898b('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x58b117);})[_0x898b('0x13')](function(_0x3c7449){var _0x58df1f=_0x3c7449[_0x898b('0x2c')][_0x898b('0x4b')];var _0x1db387=_0x58df1f[_0x898b('0x3d')](_0x58df1f['lastIndexOf']('(')+0x1,_0x58df1f[_0x898b('0x2d')](')'));_0x33521d[_0x898b('0x4c')]=_0x1db387;_0x244f97(_0x33521d);})[_0x898b('0x14')](function(_0x1f12ed){_0x57da8b(_0x1f12ed[_0x898b('0x17')]);});});}function emit(_0x305eb8,_0x18ab44,_0x14cc90,_0x1de4c6){var _0x14ae67={'uri':util[_0x898b('0x4d')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x305eb8,_0x14cc90,_0x1de4c6)};io['to'](util[_0x898b('0x4d')]('user:%s',_0x18ab44))[_0x898b('0x4e')](_0x898b('0x4f'),_0x14ae67);}exports['cs']=function(_0x3a70ff,_0x3a4d01,_0x43a0f7,_0x5329b6,_0x474125,_0x443b48,_0x39deeb,_0x55acff){var _0x339b30={};_0x443b48[_0x898b('0x10')]=_0x443b48[_0x898b('0xa')]?intUtil[_0x898b('0x50')](_0x443b48['CloudProvider']['data7']):intUtil['stripTrailingSlash'](_0x443b48[_0x898b('0x10')]);_0x443b48['serverUrl']=intUtil['stripTrailingSlash'](_0x443b48[_0x898b('0x51')]);_0x339b30['callDirection']=_0x55acff===_0x898b('0x49')||_0x55acff===_0x898b('0x52')?_0x898b('0x49'):_0x898b('0x28');var _0x53d506=_0x443b48[_0x898b('0xa')]?util[_0x898b('0x4d')](_0x898b('0x53'),_0x443b48[_0x898b('0xb')][_0x898b('0x54')]):util['format']('%s/api/data/v9.0/',_0x443b48[_0x898b('0x10')]);var _0x36b021=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x443b48[_0x898b('0xc')]);var _0x4b6589=util[_0x898b('0x4d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x443b48[_0x898b('0x51')],_0x3a4d01[_0x898b('0x55')],md5(_0x3a4d01[_0x898b('0x55')]));if(_0x474125&&_0x474125[_0x898b('0x56')]){logger[_0x898b('0x20')]('[QUEUE]',_0x898b('0x57'));_0x3a4d01['recordingURL']=_0x4b6589;}else if(_0x39deeb&&_0x39deeb['recordingFormat']&&_0x39deeb[_0x898b('0x58')]!==_0x898b('0x59')){logger[_0x898b('0x20')](_0x898b('0x5a'),_0x898b('0x57'));_0x3a4d01[_0x898b('0x5b')]=_0x4b6589;}else{_0x3a4d01['recordingURL']='';}return getUser(_0x339b30,_0x443b48,_0x5329b6,_0x36b021,_0x53d506,_0x55acff)[_0x898b('0x13')](function(_0x4b1638){logger[_0x898b('0x20')]('['+_0x55acff['toUpperCase']()+_0x898b('0x5c'),_0x4b1638['userId']);logger[_0x898b('0x20')]('['+_0x55acff[_0x898b('0x15')]()+_0x898b('0x5d'),_0x4b1638[_0x898b('0x24')]);return getEndUser(_0x4b1638,_0x443b48,_0x36b021,_0x53d506,_0x3a4d01,_0x55acff,_0x43a0f7[_0x898b('0x5e')],_0x43a0f7[_0x898b('0x5f')]);})[_0x898b('0x13')](function(_0x7f8de6){logger[_0x898b('0x20')]('['+_0x55acff[_0x898b('0x15')]()+_0x898b('0x60'),_0x7f8de6['enduserId']);logger[_0x898b('0x20')]('['+_0x55acff[_0x898b('0x15')]()+_0x898b('0x61'),_0x3a4d01[_0x898b('0x2f')]);return getTicket(_0x7f8de6,_0x443b48,_0x36b021,_0x53d506,_0x3a4d01,_0x43a0f7,_0x55acff);})['then'](function(_0x57ef7e){logger['info'](util[_0x898b('0x4d')]('['+_0x55acff['toUpperCase']()+_0x898b('0x62'),_0x43a0f7['ticketType'],_0x57ef7e[_0x898b('0x4c')]));logger[_0x898b('0x20')](util[_0x898b('0x4d')]('['+_0x55acff[_0x898b('0x15')]()+_0x898b('0x63'),_0x55acff));if(_0x55acff!==_0x898b('0x52')&&_0x43a0f7[_0x898b('0x64')]){logger['info']('['+_0x55acff['toUpperCase']()+']',_0x898b('0x65'));emit(_0x443b48[_0x898b('0x10')],_0x5329b6[_0x898b('0x66')],_0x43a0f7[_0x898b('0x40')],_0x57ef7e[_0x898b('0x4c')]);}})['catch'](function(_0x4efc6f){logger[_0x898b('0x67')]('['+_0x55acff['toUpperCase']()+_0x898b('0x68'),_0x4efc6f[_0x898b('0x17')]);console[_0x898b('0x67')](_0x898b('0x69'),_0x4efc6f);});}; \ No newline at end of file +var _0x24b0=['enduserId','message','calleridnum','telephone1','GET','contacts?$select=','\x20eq\x20\x27','replace','%2b','4.0','contactid','nothing',']\x20Enduser\x20created!','forEach','string','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','Subjects','getString','/contacts(','Fields','phonecall','callDirection','queue','Descriptions','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','POST','username','password','clientSecret','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf'];(function(_0x43b6da,_0x5f52fc){var _0x3ad946=function(_0x4a13e4){while(--_0x4a13e4){_0x43b6da['push'](_0x43b6da['shift']());}};_0x3ad946(++_0x5f52fc);}(_0x24b0,0xb0));var _0x024b=function(_0x5a7e99,_0x5e5cd4){_0x5a7e99=_0x5a7e99-0x0;var _0x4aafa6=_0x24b0[_0x5a7e99];return _0x4aafa6;};'use strict';var _=require(_0x024b('0x0'));var rp=require(_0x024b('0x1'));var util=require(_0x024b('0x2'));var intUtil=require('./util');var md5=require('md5');var Redis=require(_0x024b('0x3'));var logger=require(_0x024b('0x4'))(_0x024b('0x5'));var config=require(_0x024b('0x6'));config[_0x024b('0x7')]=_[_0x024b('0x8')](config[_0x024b('0x7')],{'host':_0x024b('0x9'),'port':0x18eb});var io=require(_0x024b('0xa'))(new Redis(config[_0x024b('0x7')]));function getAuthToken(_0x384104,_0x3a9395,_0x28b34b){if(_0x384104[_0x024b('0xb')]){_0x384104[_0x024b('0xc')]=_0x384104[_0x024b('0xd')][_0x024b('0xe')];_0x384104[_0x024b('0xf')]=_0x384104['CloudProvider'][_0x024b('0x10')];return Promise[_0x024b('0x11')](_0x384104['CloudProvider']['data5']);}var _0x302ef8={'method':_0x024b('0x12'),'uri':_0x3a9395,'form':{'client_id':_0x384104['clientId'],'resource':_0x384104['remoteUri'],'username':_0x384104[_0x024b('0x13')],'password':_0x384104[_0x024b('0x14')],'grant_type':_0x024b('0x14'),'client_secret':_0x384104[_0x024b('0x15')]},'json':!![]};return rp(_0x302ef8)[_0x024b('0x16')](function(_0x1d3519){return _0x1d3519[_0x024b('0x17')];})[_0x024b('0x18')](function(_0x22e00f){logger['error']('['+[_0x28b34b[_0x024b('0x19')]()]+_0x024b('0x1a'));return _0x22e00f['message'];});}function getUser(_0x33dbc9,_0x3bd671,_0x42c707,_0x3aca61,_0x3d94d5,_0x54beea){return new Promise(function(_0x22ef40,_0x3783b2){return getAuthToken(_0x3bd671,_0x3aca61,_0x54beea)[_0x024b('0x16')](function(_0x152774){var _0x4089ac={'method':'GET','uri':_0x3d94d5+_0x024b('0x1b'),'headers':{'Authorization':_0x024b('0x1c')+_0x152774,'OData-Version':'4.0'},'json':!![]};return rp(_0x4089ac);})[_0x024b('0x16')](function(_0xbb072c){var _0x134777=_0xbb072c[_0x024b('0x1d')];var _0xe9c54d=![];var _0x324652=null;if(!_[_0x024b('0x1e')](_0x42c707)){if(intUtil[_0x024b('0x1f')](_0x42c707[_0x024b('0x20')])){_0x33dbc9['userEmail']=_0x42c707[_0x024b('0x20')];for(_0x324652=0x0;_0x324652<_0x134777[_0x024b('0x21')];_0x324652++){if(_0x134777[_0x324652][_0x024b('0x22')]===_0x42c707[_0x024b('0x20')]&&!_0x134777[_0x324652][_0x024b('0x23')]){_0xe9c54d=!![];logger[_0x024b('0x24')]('['+[_0x54beea[_0x024b('0x19')]()]+_0x024b('0x25')+_0x134777[_0x324652][_0x024b('0x26')]+'!');_0x33dbc9[_0x024b('0x27')]=_0x134777[_0x324652][_0x024b('0x26')];}}}}if(!_0xe9c54d){logger[_0x024b('0x24')]('['+[_0x54beea[_0x024b('0x19')]()]+_0x024b('0x28'));_0x33dbc9[_0x024b('0x29')]=_0x3bd671[_0x024b('0x13')];for(_0x324652=0x0;_0x324652<_0x134777['length'];_0x324652++){if(_0x134777[_0x324652]['internalemailaddress']===_0x3bd671[_0x024b('0x13')]){_0x33dbc9[_0x024b('0x27')]=_0x134777[_0x324652]['systemuserid'];}}}_0x22ef40(_0x33dbc9);})[_0x024b('0x18')](function(_0x38e63d){_0x3783b2(_0x38e63d['message']);});});}function createEndUser(_0x148d0b,_0x29cf64,_0xe217e1,_0x465917,_0x28c36b,_0x486360,_0x4db465){return new Promise(function(_0x182d1c,_0x1d9d58){return getAuthToken(_0x29cf64,_0xe217e1,_0x486360)[_0x024b('0x16')](function(_0x37dedb){var _0x35342b=_0x486360[_0x024b('0x2a')]()===_0x024b('0x2b')?_0x28c36b[_0x024b('0x2c')]:_0x28c36b['calleridnum'];var _0x1b2010={'method':'POST','uri':_0x465917+_0x024b('0x2d'),'body':{'fullname':_0x35342b,'firstname':_0x35342b,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x024b('0x2e')+_0x148d0b['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x37dedb,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x1b2010[_0x024b('0x2f')][_0x4db465]=_0x35342b;return rp(_0x1b2010);})[_0x024b('0x16')](function(_0x188dbe){var _0x39fb1d=_0x188dbe[_0x024b('0x30')][_0x024b('0x31')];var _0x465d7a=_0x39fb1d[_0x024b('0x32')](_0x39fb1d[_0x024b('0x33')]('(')+0x1,_0x39fb1d[_0x024b('0x33')](')'));_0x148d0b[_0x024b('0x34')]=_0x465d7a;_0x182d1c(_0x148d0b);})[_0x024b('0x18')](function(_0x86ce21){_0x1d9d58(_0x86ce21[_0x024b('0x35')]);});});}function getEndUser(_0x2af2e9,_0x2892ef,_0x22c9e9,_0x53e632,_0x362d2d,_0x43ada0,_0x304ac4,_0x532b94){var _0x3d609e=_0x43ada0[_0x024b('0x2a')]()==='outbound'?_0x362d2d[_0x024b('0x2c')]:_0x362d2d[_0x024b('0x36')];return getAuthToken(_0x2892ef,_0x22c9e9,_0x43ada0)[_0x024b('0x16')](function(_0x51537){_0x532b94=_0x532b94?_0x532b94:_0x024b('0x37');var _0x107f2d={'method':_0x024b('0x38'),'uri':_0x53e632+_0x024b('0x39')+_0x532b94+'&$filter='+_0x532b94+_0x024b('0x3a')+_0x3d609e[_0x024b('0x3b')]('+',_0x024b('0x3c'))+'\x27','headers':{'Authorization':_0x024b('0x1c')+_0x51537,'If-None-Match':null,'OData-Version':_0x024b('0x3d')},'json':!![]};return rp(_0x107f2d);})[_0x024b('0x16')](function(_0x3fc91f){var _0x1aeeba=![];if(!_0x3fc91f)return _0x1aeeba;var _0x503bbe=_0x3fc91f[_0x024b('0x1d')];for(var _0x3d90d9=0x0;_0x3d90d9<_0x503bbe[_0x024b('0x21')];_0x3d90d9++){if(_0x503bbe[_0x3d90d9][_0x532b94]===_0x3d609e){_0x1aeeba=!![];_0x2af2e9[_0x024b('0x34')]=_0x503bbe[_0x3d90d9][_0x024b('0x3e')];}}return _0x1aeeba;})[_0x024b('0x16')](function(_0x566809){if(_0x566809)return _0x2af2e9;if(_0x304ac4===_0x024b('0x3f')){logger[_0x024b('0x24')]('['+[_0x43ada0[_0x024b('0x19')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x2af2e9;}return createEndUser(_0x2af2e9,_0x2892ef,_0x22c9e9,_0x53e632,_0x362d2d,_0x43ada0,_0x532b94)[_0x024b('0x16')](function(_0xceda53){logger[_0x024b('0x24')]('['+[_0x43ada0[_0x024b('0x19')]()]+_0x024b('0x40'),_0xceda53['enduserId']);return _0xceda53;});});}function getCustomFields(_0x3a0c1a,_0x34be16,_0x42def8){var _0x29721c={};if(_0x3a0c1a[_0x024b('0x21')]>0x0){_[_0x024b('0x41')](_0x3a0c1a,function(_0x278182){if(_['includes']([_0x024b('0x42'),_0x024b('0x43')],_0x278182[_0x024b('0x44')])&&_0x278182[_0x024b('0x45')]&&!_0x278182[_0x024b('0x46')]){var _0x2c13bb=_0x278182[_0x024b('0x47')]['toLowerCase']();var _0x410521=_0x2c13bb['substring'](0x0,_0x2c13bb[_0x024b('0x48')]('_'));var _0x3a2f0a=_0x2c13bb[_0x024b('0x32')](_0x2c13bb[_0x024b('0x48')]('_')+0x1);if(_0x410521===_0x42def8){_0x29721c[_0x3a2f0a]=_0x278182[_0x024b('0x49')];}}});}return _0x29721c;}function getTicket(_0x29c21f,_0x306f4d,_0x1d156a,_0x2917cd,_0x274905,_0x290ac6,_0x400bad){return new Promise(function(_0x1835f3,_0x23bc53){var _0x44b547;return getAuthToken(_0x306f4d,_0x1d156a,_0x400bad)[_0x024b('0x16')](function(_0x384802){if(_0x290ac6[_0x024b('0x4a')]===_0x024b('0x4b')){_0x44b547={'method':_0x024b('0x12'),'uri':_0x2917cd+_0x024b('0x4c'),'body':Object['assign']({},{'title':intUtil['getString'](_0x290ac6[_0x024b('0x4d')],_0x274905,'\x20'),'description':intUtil[_0x024b('0x4e')](_0x290ac6['Descriptions'],_0x274905,'\x0a'),'customerid_contact@odata.bind':_0x29c21f['enduserId']?_0x024b('0x4f')+_0x29c21f['enduserId']+')':undefined,'ownerid@odata.bind':_0x024b('0x2e')+_0x29c21f[_0x024b('0x27')]+')','caseorigincode':'1'},getCustomFields(_0x290ac6[_0x024b('0x50')],_0x274905,_0x290ac6[_0x024b('0x4a')])),'headers':{'Authorization':_0x024b('0x1c')+_0x384802,'OData-Version':_0x024b('0x3d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x290ac6[_0x024b('0x4a')]===_0x024b('0x51')){var _0x5c4328=_0x29c21f[_0x024b('0x34')]?[{'partyid_systemuser@odata.bind':_0x024b('0x2e')+_0x29c21f[_0x024b('0x27')]+')','participationtypemask':_0x29c21f[_0x024b('0x52')]===_0x024b('0x53')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x29c21f[_0x024b('0x34')]+')','participationtypemask':_0x29c21f['callDirection']===_0x024b('0x53')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x024b('0x2e')+_0x29c21f[_0x024b('0x27')]+')','participationtypemask':_0x29c21f[_0x024b('0x52')]===_0x024b('0x53')?0x2:0x1}];_0x44b547={'method':_0x024b('0x12'),'uri':_0x2917cd+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0x024b('0x4e')](_0x290ac6[_0x024b('0x4d')],_0x274905,'\x20'),'phonenumber':String(_0x274905[_0x024b('0x36')]),'description':intUtil[_0x024b('0x4e')](_0x290ac6[_0x024b('0x54')],_0x274905,'\x0a'),'regardingobjectid_contact@odata.bind':_0x29c21f[_0x024b('0x34')]?_0x024b('0x4f')+_0x29c21f[_0x024b('0x34')]+')':undefined,'ownerid@odata.bind':_0x024b('0x2e')+_0x29c21f[_0x024b('0x27')]+')','directioncode':_0x29c21f[_0x024b('0x52')]==='queue'?![]:!![],'phonecall_activity_parties':_0x5c4328},getCustomFields(_0x290ac6['Fields'],_0x274905,_0x290ac6[_0x024b('0x4a')])),'headers':{'Authorization':'Bearer\x20'+_0x384802,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x44b547);})[_0x024b('0x16')](function(_0x3ff308){var _0x4d1f8e=_0x3ff308[_0x024b('0x30')][_0x024b('0x31')];var _0x5777e7=_0x4d1f8e[_0x024b('0x32')](_0x4d1f8e[_0x024b('0x33')]('(')+0x1,_0x4d1f8e[_0x024b('0x33')](')'));_0x29c21f[_0x024b('0x55')]=_0x5777e7;_0x1835f3(_0x29c21f);})['catch'](function(_0x2037d2){_0x23bc53(_0x2037d2['message']);});});}function emit(_0x30f1f9,_0x25aa97,_0x1bdd23,_0x212f30){var _0x36d044={'uri':util[_0x024b('0x56')](_0x024b('0x57'),_0x30f1f9,_0x1bdd23,_0x212f30)};io['to'](util[_0x024b('0x56')](_0x024b('0x58'),_0x25aa97))['emit'](_0x024b('0x59'),_0x36d044);}exports['cs']=function(_0x3fea95,_0x51b7c9,_0xb6ce1,_0x32c05d,_0x1fe3f8,_0x500dd9,_0x5d09f9,_0x3bf5bf){var _0x4fe50f={};_0x500dd9[_0x024b('0xc')]=_0x500dd9['modernAuthentication']?intUtil[_0x024b('0x5a')](_0x500dd9[_0x024b('0xd')][_0x024b('0xe')]):intUtil[_0x024b('0x5a')](_0x500dd9['remoteUri']);_0x500dd9[_0x024b('0x5b')]=intUtil['stripTrailingSlash'](_0x500dd9[_0x024b('0x5b')]);_0x4fe50f[_0x024b('0x52')]=_0x3bf5bf===_0x024b('0x53')||_0x3bf5bf===_0x024b('0x5c')?_0x024b('0x53'):_0x024b('0x2b');var _0x353b19=_0x500dd9['modernAuthentication']?util['format'](_0x024b('0x5d'),_0x500dd9[_0x024b('0xd')][_0x024b('0xe')]):util['format'](_0x024b('0x5d'),_0x500dd9[_0x024b('0xc')]);var _0x59c4cb=util['format'](_0x024b('0x5e'),_0x500dd9['tenantId']);var _0x1a8e97=util[_0x024b('0x56')](_0x024b('0x5f'),_0x500dd9['serverUrl'],_0x51b7c9['uniqueid'],md5(_0x51b7c9['uniqueid']));if(_0x1fe3f8&&_0x1fe3f8[_0x024b('0x60')]){logger['info'](_0x024b('0x61'),_0x024b('0x62'));_0x51b7c9[_0x024b('0x63')]=_0x1a8e97;}else if(_0x5d09f9&&_0x5d09f9[_0x024b('0x64')]&&_0x5d09f9[_0x024b('0x64')]!==_0x024b('0x65')){logger['info']('[OUTBOUND]',_0x024b('0x62'));_0x51b7c9[_0x024b('0x63')]=_0x1a8e97;}else{_0x51b7c9[_0x024b('0x63')]='';}return getUser(_0x4fe50f,_0x500dd9,_0x32c05d,_0x59c4cb,_0x353b19,_0x3bf5bf)['then'](function(_0x3dcd14){logger['info']('['+_0x3bf5bf['toUpperCase']()+_0x024b('0x66'),_0x3dcd14[_0x024b('0x27')]);logger['info']('['+_0x3bf5bf['toUpperCase']()+_0x024b('0x67'),_0x3dcd14[_0x024b('0x29')]);return getEndUser(_0x3dcd14,_0x500dd9,_0x59c4cb,_0x353b19,_0x51b7c9,_0x3bf5bf,_0xb6ce1[_0x024b('0x68')],_0xb6ce1[_0x024b('0x69')]);})[_0x024b('0x16')](function(_0x298fcd){logger[_0x024b('0x24')]('['+_0x3bf5bf[_0x024b('0x19')]()+_0x024b('0x6a'),_0x298fcd[_0x024b('0x34')]);logger[_0x024b('0x24')]('['+_0x3bf5bf[_0x024b('0x19')]()+_0x024b('0x6b'),_0x51b7c9['calleridnum']);return getTicket(_0x298fcd,_0x500dd9,_0x59c4cb,_0x353b19,_0x51b7c9,_0xb6ce1,_0x3bf5bf);})['then'](function(_0xbcc435){logger[_0x024b('0x24')](util[_0x024b('0x56')]('['+_0x3bf5bf[_0x024b('0x19')]()+_0x024b('0x6c'),_0xb6ce1['ticketType'],_0xbcc435['ticketId']));logger[_0x024b('0x24')](util[_0x024b('0x56')]('['+_0x3bf5bf[_0x024b('0x19')]()+']\x20Call\x20direction:\x20%s',_0x3bf5bf));if(_0x3bf5bf!==_0x024b('0x5c')&&_0xb6ce1[_0x024b('0x6d')]){logger[_0x024b('0x24')]('['+_0x3bf5bf[_0x024b('0x19')]()+']',_0x024b('0x6e'));emit(_0x500dd9[_0x024b('0xc')],_0x32c05d[_0x024b('0x6f')],_0xb6ce1[_0x024b('0x4a')],_0xbcc435[_0x024b('0x55')]);}})[_0x024b('0x18')](function(_0xf0e51d){logger[_0x024b('0x70')]('['+_0x3bf5bf[_0x024b('0x19')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0xf0e51d[_0x024b('0x35')]);console[_0x024b('0x70')](_0x024b('0x71'),_0xf0e51d);});}; \ 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 ba36380..f37c50d 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 _0x6763=['toLowerCase','content','string','type','idField','push','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','user:%s','stringify','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','name','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','length','find','contact','email','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','GET','map','includes','picklist','customField'];(function(_0xc5afe0,_0x211e91){var _0x24de40=function(_0x4f5476){while(--_0x4f5476){_0xc5afe0['push'](_0xc5afe0['shift']());}};_0x24de40(++_0x211e91);}(_0x6763,0x1e0));var _0x3676=function(_0x4af01e,_0x543f5c){_0x4af01e=_0x4af01e-0x0;var _0x178c11=_0x6763[_0x4af01e];return _0x178c11;};'use strict';var _=require(_0x3676('0x0'));var rp=require(_0x3676('0x1'));var md5=require(_0x3676('0x2'));var util=require(_0x3676('0x3'));var Redis=require(_0x3676('0x4'));var intUtil=require(_0x3676('0x5'));var config=require(_0x3676('0x6'));var logger=require(_0x3676('0x7'))('freshdesk');config[_0x3676('0x8')]=_[_0x3676('0x9')](config['redis'],{'host':_0x3676('0xa'),'port':0x18eb});var io=require(_0x3676('0xb'))(new Redis(config[_0x3676('0x8')]));var headers={'Content-Type':_0x3676('0xc'),'Accept':_0x3676('0xc')};function emit(_0x352a0d,_0x491c70,_0x399f81){io['to'](_0x352a0d)['emit'](_0x491c70,_0x399f81);}function getTicket(_0x3cdfaa,_0x164df1,_0x25c55b,_0xf1a4d7,_0x23fcc7){logger[_0x3676('0xd')](_0x3676('0xe'));var _0x30af0e=_[_0x3676('0xf')]({'responder_id':_0x164df1['id'],'requester_id':_0x25c55b['id'],'name':util[_0x3676('0x10')]('Caller\x20-\x20%s',_0x23fcc7[_0x3676('0x11')]),'phone':_0x23fcc7[_0x3676('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x3676('0x13')](_0xf1a4d7[_0x3676('0x14')],_0x23fcc7,'\x20'),'description':intUtil[_0x3676('0x13')](_0xf1a4d7[_0x3676('0x15')],_0x23fcc7,'
'),'tags':getTags(_0xf1a4d7[_0x3676('0x16')],_0x3676('0x17'))},getCustomFields(_0xf1a4d7['Fields'],_0x23fcc7));_0x30af0e[_0x3676('0x18')]=_[_0x3676('0x19')](_[_0x3676('0x1a')](_0x30af0e['custom_fields'],'id'),_0x3676('0x1b'));return request({'uri':util[_0x3676('0x10')](_0x3676('0x1c'),_0x3cdfaa['remoteUri']),'method':_0x3676('0x1d'),'body':_0x30af0e})[_0x3676('0x1e')](function(_0x565c87){logger[_0x3676('0xd')](_0x3676('0x1f'));return _0x565c87;});}function getUser(_0x46e7bb,_0x2e8591){if(intUtil[_0x3676('0x20')](_0x2e8591)){return request({'uri':util[_0x3676('0x10')](_0x3676('0x21'),_0x46e7bb[_0x3676('0x22')]),'qs':{'email':_0x2e8591}})[_0x3676('0x1e')](function(_0x3b681a){if(_0x3b681a[_0x3676('0x23')]){logger[_0x3676('0xd')]('Agent\x20found!');return _[_0x3676('0x24')](_0x3b681a,function(_0x3a4b76){return _0x3a4b76[_0x3676('0x25')][_0x3676('0x26')]===_0x2e8591;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x3676('0x10')]('%s/api/v2/agents/me',_0x46e7bb[_0x3676('0x22')])})[_0x3676('0x1e')](function(_0x467344){logger['info']('Admin\x20account\x20selected.');return _0x467344;});}});}else{logger[_0x3676('0xd')](_0x3676('0x27'));return request({'uri':util[_0x3676('0x10')]('%s/api/v2/agents/me',_0x46e7bb[_0x3676('0x22')])})[_0x3676('0x1e')](function(_0x3e8065){logger['info'](_0x3676('0x28'));return _0x3e8065;});}}function getEndUser(_0x47827c,_0x29520a,_0x1584cb){logger['info'](_0x3676('0x29'),_0x1584cb);return request({'uri':util[_0x3676('0x10')](_0x3676('0x2a'),_0x47827c[_0x3676('0x22')]),'qs':{'phone':_0x1584cb}})[_0x3676('0x1e')](function(_0x4705e1){if(_0x4705e1['length']){logger['info']('Enduser\x20found!');return _[_0x3676('0x24')](_0x4705e1,{'phone':_0x1584cb});}else{logger[_0x3676('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x3676('0x2a'),_0x47827c[_0x3676('0x22')]),'method':'POST','body':{'name':_0x29520a,'phone':_0x1584cb}})[_0x3676('0x1e')](function(_0x27fdeb){logger['info'](_0x3676('0x2b'));return _0x27fdeb;});}});}function getAuth(_0x546dc8){return util[_0x3676('0x10')](_0x3676('0x2c'),new Buffer(_0x546dc8['apiKey']+':X')[_0x3676('0x2d')](_0x3676('0x2e')));}function request(_0x5cc917){logger[_0x3676('0x2f')](_0x3676('0x30'),JSON['stringify'](_0x5cc917));return rp(_[_0x3676('0x9')](_0x5cc917,{'method':_0x3676('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x16ae5b,_0x47523e){var _0x6087ac=[];if(_0x16ae5b&&_0x16ae5b[_0x3676('0x23')]>0x0){_0x6087ac=_[_0x3676('0x32')](_0x16ae5b,_0x47523e);}return _0x6087ac;}function getCustomFields(_0x52b7b1,_0x3da9d0){var _0x3f9bd9=[];var _0x5d877f={'custom_fields':[]};if(_0x52b7b1['length']>0x0){_['forEach'](_0x52b7b1,function(_0x275e2c){if(_[_0x3676('0x33')](['string',_0x3676('0x34')],_0x275e2c['type'])&&_0x275e2c['nameField']&&!_0x275e2c[_0x3676('0x35')]){_0x5d877f[_0x275e2c['nameField'][_0x3676('0x36')]()]=_0x275e2c[_0x3676('0x37')][_0x3676('0x2d')]();}else if(_['includes']([_0x3676('0x38'),_0x3676('0x34')],_0x275e2c[_0x3676('0x39')])&&_0x275e2c[_0x3676('0x3a')]&&_0x275e2c[_0x3676('0x35')]){_0x5d877f[_0x3676('0x18')][_0x3676('0x3b')]({'id':_0x275e2c[_0x3676('0x3a')],'value':_0x275e2c[_0x3676('0x37')]['toString']()});}else if(_0x275e2c['type']==='variable'&&_0x275e2c[_0x3676('0x3c')]&&_0x275e2c[_0x3676('0x3a')]&&_0x275e2c['customField']){_0x3da9d0[_0x275e2c['variableName']]&&_0x5d877f[_0x3676('0x18')]['push']({'id':_0x275e2c[_0x3676('0x3a')],'value':_0x3da9d0[_0x275e2c[_0x3676('0x3c')]][_0x3676('0x2d')]()});}else if(_0x275e2c[_0x3676('0x39')]===_0x3676('0x3d')&&_0x275e2c['Variable']&&_0x275e2c['Variable'][_0x3676('0x17')]&&_0x275e2c[_0x3676('0x3a')]&&_0x275e2c['customField']){_0x3da9d0[_0x275e2c[_0x3676('0x3e')][_0x3676('0x17')][_0x3676('0x36')]()]&&_0x5d877f['custom_fields'][_0x3676('0x3b')]({'id':_0x275e2c[_0x3676('0x3a')],'value':_0x3da9d0[_0x275e2c[_0x3676('0x3e')][_0x3676('0x17')][_0x3676('0x36')]()]['toString']()});}});}return _0x5d877f;}exports[_0x3676('0x3f')]=function(_0x1772e6,_0x3ca93c,_0x5c05a9,_0x3363cb,_0x201c9d,_0xf294da){var _0x2268a7,_0x4e2263;_0xf294da[_0x3676('0x22')]=intUtil[_0x3676('0x40')](_0xf294da[_0x3676('0x22')]);_0xf294da[_0x3676('0x41')]=intUtil['stripTrailingSlash'](_0xf294da[_0x3676('0x41')]);if(_0x201c9d&&_0x201c9d[_0x3676('0x42')]){logger['info'](_0x3676('0x43'),_0x3676('0x44'));_0x3ca93c[_0x3676('0x45')]=util[_0x3676('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xf294da[_0x3676('0x41')],_0x3ca93c[_0x3676('0x46')],md5(_0x3ca93c[_0x3676('0x46')]));}else{_0x3ca93c[_0x3676('0x45')]='';}headers[_0x3676('0x47')]=getAuth(_0xf294da);return getUser(_0xf294da,_0x3363cb['email'])[_0x3676('0x1e')](function(_0x39f480){_0x2268a7=_0x39f480;logger[_0x3676('0xd')](_0x3676('0x48'),_0x2268a7['id']);return getEndUser(_0xf294da,_0x3ca93c[_0x3676('0x11')],_0x3ca93c[_0x3676('0x12')]);})[_0x3676('0x1e')](function(_0x53723b){_0x4e2263=_0x53723b;logger[_0x3676('0xd')](_0x3676('0x49'),_0x4e2263['id']);return getTicket(_0xf294da,_0x2268a7,_0x4e2263,_0x5c05a9,_0x3ca93c);})[_0x3676('0x1e')](function(_0x21afc8){if(_0x21afc8&&_0x21afc8['id']){logger['info'](_0x3676('0x1f'));logger[_0x3676('0xd')]('The\x20Ticket\x20ID\x20is:',_0x21afc8['id']);logger[_0x3676('0xd')](_0x3676('0x43'),_0x3676('0x4a'));emit(util[_0x3676('0x10')]('user:%s',_0x3363cb['name']),_0x3676('0x4b'),{'uri':util[_0x3676('0x10')](_0x3676('0x4c'),_0xf294da['remoteUri'],_0x21afc8['id'])});}})[_0x3676('0x4d')](function(_0x24af44){logger[_0x3676('0x4e')](_0x3676('0x43'),JSON['stringify'](_0x24af44));});};exports['outbound']=function(_0x8fa615,_0x4bb024,_0x5d1644,_0x4b2df3,_0xac3874,_0x19938c,_0x2b72f0){var _0x574b18,_0xf32a9b;_0x19938c[_0x3676('0x22')]=intUtil[_0x3676('0x40')](_0x19938c[_0x3676('0x22')]);_0x19938c[_0x3676('0x41')]=intUtil['stripTrailingSlash'](_0x19938c[_0x3676('0x41')]);if(_0x2b72f0&&_0x2b72f0[_0x3676('0x4f')]&&_0x2b72f0['recordingFormat']!==_0x3676('0x50')){logger[_0x3676('0xd')](_0x3676('0x51'),_0x3676('0x44'));_0x4bb024['recordingURL']=util[_0x3676('0x10')](_0x3676('0x52'),_0x19938c['serverUrl'],_0x4bb024[_0x3676('0x46')],md5(_0x4bb024[_0x3676('0x46')]));}headers[_0x3676('0x47')]=getAuth(_0x19938c);return getUser(_0x19938c,_0x4b2df3[_0x3676('0x26')])[_0x3676('0x1e')](function(_0x1da006){_0x574b18=_0x1da006;logger['info']('The\x20User\x20ID\x20is:',_0x574b18['id']);return getEndUser(_0x19938c,_0x4bb024['destcalleridname'],_0x4bb024[_0x3676('0x53')]);})[_0x3676('0x1e')](function(_0x1e3d5b){_0xf32a9b=_0x1e3d5b;logger[_0x3676('0xd')](_0x3676('0x49'),_0xf32a9b['id']);return getTicket(_0x19938c,_0x574b18,_0xf32a9b,_0x5d1644,_0x4bb024);})[_0x3676('0x1e')](function(_0x36b6e7){if(_0x36b6e7&&_0x36b6e7['id']){logger['info'](_0x3676('0x1f'));logger[_0x3676('0xd')]('The\x20Ticket\x20ID\x20is:',_0x36b6e7['id']);logger[_0x3676('0xd')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3676('0x10')](_0x3676('0x54'),_0x4b2df3[_0x3676('0x17')]),_0x3676('0x4b'),{'uri':util[_0x3676('0x10')](_0x3676('0x4c'),_0x19938c['remoteUri'],_0x36b6e7['id'])});}})[_0x3676('0x4d')](function(_0x3b0a3a){logger['error'](_0x3676('0x51'),JSON[_0x3676('0x55')](_0x3b0a3a));});};exports[_0x3676('0x56')]=function(_0x4b4e3a,_0x12cec9,_0x4ebe76,_0x15e0e7,_0xf1cacd,_0x3fa76a){var _0x3e6bb3,_0x29a73f;_0x3fa76a[_0x3676('0x22')]=intUtil['stripTrailingSlash'](_0x3fa76a[_0x3676('0x22')]);_0x3fa76a[_0x3676('0x41')]=intUtil[_0x3676('0x40')](_0x3fa76a[_0x3676('0x41')]);if(_0xf1cacd&&_0xf1cacd['monitor_format']){logger[_0x3676('0xd')]('['+_0x12cec9[_0x3676('0x57')][_0x3676('0x58')]()+']',_0x3676('0x44'));_0x12cec9['recordingURL']=util[_0x3676('0x10')](_0x3676('0x52'),_0x3fa76a[_0x3676('0x41')],_0x12cec9[_0x3676('0x46')],md5(_0x12cec9[_0x3676('0x46')]));}else{_0x12cec9[_0x3676('0x45')]='';}headers['Authorization']=getAuth(_0x3fa76a);return getUser(_0x3fa76a,'')[_0x3676('0x1e')](function(_0x103e81){_0x3e6bb3=_0x103e81;logger[_0x3676('0xd')]('The\x20User\x20ID\x20is:',_0x3e6bb3['id']);return getEndUser(_0x3fa76a,_0x12cec9['calleridname'],_0x12cec9[_0x3676('0x12')]);})['then'](function(_0x32d651){_0x29a73f=_0x32d651;logger[_0x3676('0xd')](_0x3676('0x49'),_0x29a73f['id']);return getTicket(_0x3fa76a,_0x3e6bb3,_0x29a73f,_0x4ebe76,_0x12cec9);})[_0x3676('0x1e')](function(_0x3c8986){if(_0x3c8986){logger[_0x3676('0xd')]('Ticket\x20created!');logger[_0x3676('0xd')]('The\x20Ticket\x20ID\x20is:',_0x3c8986['id']);}})[_0x3676('0x4d')](function(_0x279a2b){logger[_0x3676('0x4e')]('['+_0x12cec9[_0x3676('0x57')]['toUpperCase']()+']',JSON[_0x3676('0x55')](_0x279a2b));});}; \ No newline at end of file +var _0xc016=['Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','error','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','The\x20Ticket\x20ID\x20is:','trigger:browser:url','unmanaged','toUpperCase','The\x20Enduser\x20ID\x20is:','lastevent','lodash','request-promise','md5','util','ioredis','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Descriptions','Tags','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','POST','then','Ticket\x20created!','validateEmail','format','%s/api/v2/agents','remoteUri','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20created.','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','idField','push','content','toString','variable','variableName','customVariable'];(function(_0x1847d7,_0xf4e0da){var _0x5e4f3f=function(_0x15ee4d){while(--_0x15ee4d){_0x1847d7['push'](_0x1847d7['shift']());}};_0x5e4f3f(++_0xf4e0da);}(_0xc016,0x19c));var _0x6c01=function(_0x4af6cb,_0x58c7b5){_0x4af6cb=_0x4af6cb-0x0;var _0xb5e7d2=_0xc016[_0x4af6cb];return _0xb5e7d2;};'use strict';var _=require(_0x6c01('0x0'));var rp=require(_0x6c01('0x1'));var md5=require(_0x6c01('0x2'));var util=require(_0x6c01('0x3'));var Redis=require(_0x6c01('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x6c01('0x5'))(_0x6c01('0x6'));config[_0x6c01('0x7')]=_[_0x6c01('0x8')](config['redis'],{'host':_0x6c01('0x9'),'port':0x18eb});var io=require(_0x6c01('0xa'))(new Redis(config[_0x6c01('0x7')]));var headers={'Content-Type':'application/json','Accept':_0x6c01('0xb')};function emit(_0x396deb,_0xcaf25d,_0xe464ce){io['to'](_0x396deb)[_0x6c01('0xc')](_0xcaf25d,_0xe464ce);}function getTicket(_0x48bace,_0x259104,_0x1d420f,_0x1091b5,_0x1d3107){logger[_0x6c01('0xd')](_0x6c01('0xe'));var _0x2eef62=_[_0x6c01('0xf')]({'responder_id':_0x259104['id'],'requester_id':_0x1d420f['id'],'name':util['format'](_0x6c01('0x10'),_0x1d3107[_0x6c01('0x11')]),'phone':_0x1d3107[_0x6c01('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x1091b5[_0x6c01('0x13')],_0x1d3107,'\x20'),'description':intUtil[_0x6c01('0x14')](_0x1091b5[_0x6c01('0x15')],_0x1d3107,'
'),'tags':getTags(_0x1091b5[_0x6c01('0x16')],_0x6c01('0x17'))},getCustomFields(_0x1091b5[_0x6c01('0x18')],_0x1d3107));_0x2eef62[_0x6c01('0x19')]=_[_0x6c01('0x1a')](_[_0x6c01('0x1b')](_0x2eef62[_0x6c01('0x19')],'id'),'value');return request({'uri':util['format'](_0x6c01('0x1c'),_0x48bace['remoteUri']),'method':_0x6c01('0x1d'),'body':_0x2eef62})[_0x6c01('0x1e')](function(_0x31223f){logger['info'](_0x6c01('0x1f'));return _0x31223f;});}function getUser(_0x11ee26,_0x7b30e7){if(intUtil[_0x6c01('0x20')](_0x7b30e7)){return request({'uri':util[_0x6c01('0x21')](_0x6c01('0x22'),_0x11ee26[_0x6c01('0x23')]),'qs':{'email':_0x7b30e7}})[_0x6c01('0x1e')](function(_0x1cbb20){if(_0x1cbb20[_0x6c01('0x24')]){logger[_0x6c01('0xd')](_0x6c01('0x25'));return _[_0x6c01('0x26')](_0x1cbb20,function(_0x9948df){return _0x9948df[_0x6c01('0x27')][_0x6c01('0x28')]===_0x7b30e7;});}else{logger['info'](_0x6c01('0x29'));return request({'uri':util[_0x6c01('0x21')]('%s/api/v2/agents/me',_0x11ee26['remoteUri'])})[_0x6c01('0x1e')](function(_0x4c706d){logger['info'](_0x6c01('0x2a'));return _0x4c706d;});}});}else{logger[_0x6c01('0xd')](_0x6c01('0x2b'));return request({'uri':util[_0x6c01('0x21')](_0x6c01('0x2c'),_0x11ee26[_0x6c01('0x23')])})[_0x6c01('0x1e')](function(_0x4fe7f3){logger['info'](_0x6c01('0x2a'));return _0x4fe7f3;});}}function getEndUser(_0x35ba98,_0x194e7a,_0x1277fc){logger['info'](_0x6c01('0x2d'),_0x1277fc);return request({'uri':util['format']('%s/api/v2/contacts',_0x35ba98[_0x6c01('0x23')]),'qs':{'phone':_0x1277fc}})[_0x6c01('0x1e')](function(_0x52421b){if(_0x52421b[_0x6c01('0x24')]){logger[_0x6c01('0xd')]('Enduser\x20found!');return _['find'](_0x52421b,{'phone':_0x1277fc});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x6c01('0x21')](_0x6c01('0x2e'),_0x35ba98[_0x6c01('0x23')]),'method':_0x6c01('0x1d'),'body':{'name':_0x194e7a,'phone':_0x1277fc}})['then'](function(_0xd7a9){logger['info'](_0x6c01('0x2f'));return _0xd7a9;});}});}function getAuth(_0x4a45c9){return util[_0x6c01('0x21')]('Basic\x20%s',new Buffer(_0x4a45c9['apiKey']+':X')['toString']('base64'));}function request(_0x3398c3){logger[_0x6c01('0x30')](_0x6c01('0x31'),JSON[_0x6c01('0x32')](_0x3398c3));return rp(_[_0x6c01('0x8')](_0x3398c3,{'method':_0x6c01('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x208564,_0x2e443f){var _0x853f0c=[];if(_0x208564&&_0x208564[_0x6c01('0x24')]>0x0){_0x853f0c=_[_0x6c01('0x34')](_0x208564,_0x2e443f);}return _0x853f0c;}function getCustomFields(_0x46ea32,_0x92322){var _0x54354e=[];var _0x3606d4={'custom_fields':[]};if(_0x46ea32[_0x6c01('0x24')]>0x0){_[_0x6c01('0x35')](_0x46ea32,function(_0xa977c){if(_[_0x6c01('0x36')]([_0x6c01('0x37'),_0x6c01('0x38')],_0xa977c[_0x6c01('0x39')])&&_0xa977c[_0x6c01('0x3a')]&&!_0xa977c[_0x6c01('0x3b')]){_0x3606d4[_0xa977c[_0x6c01('0x3a')][_0x6c01('0x3c')]()]=_0xa977c['content']['toString']();}else if(_[_0x6c01('0x36')]([_0x6c01('0x37'),_0x6c01('0x38')],_0xa977c[_0x6c01('0x39')])&&_0xa977c[_0x6c01('0x3d')]&&_0xa977c[_0x6c01('0x3b')]){_0x3606d4[_0x6c01('0x19')][_0x6c01('0x3e')]({'id':_0xa977c[_0x6c01('0x3d')],'value':_0xa977c[_0x6c01('0x3f')][_0x6c01('0x40')]()});}else if(_0xa977c['type']===_0x6c01('0x41')&&_0xa977c[_0x6c01('0x42')]&&_0xa977c[_0x6c01('0x3d')]&&_0xa977c[_0x6c01('0x3b')]){_0x92322[_0xa977c[_0x6c01('0x42')]]&&_0x3606d4[_0x6c01('0x19')][_0x6c01('0x3e')]({'id':_0xa977c[_0x6c01('0x3d')],'value':_0x92322[_0xa977c[_0x6c01('0x42')]][_0x6c01('0x40')]()});}else if(_0xa977c[_0x6c01('0x39')]===_0x6c01('0x43')&&_0xa977c[_0x6c01('0x44')]&&_0xa977c[_0x6c01('0x44')][_0x6c01('0x17')]&&_0xa977c[_0x6c01('0x3d')]&&_0xa977c['customField']){_0x92322[_0xa977c['Variable'][_0x6c01('0x17')][_0x6c01('0x3c')]()]&&_0x3606d4[_0x6c01('0x19')][_0x6c01('0x3e')]({'id':_0xa977c['idField'],'value':_0x92322[_0xa977c[_0x6c01('0x44')]['name'][_0x6c01('0x3c')]()][_0x6c01('0x40')]()});}});}return _0x3606d4;}exports[_0x6c01('0x45')]=function(_0x555a79,_0x5bf535,_0x2c2576,_0x138ecf,_0x47f2c4,_0x52b52d){var _0xf0ca15,_0x12cf06;_0x52b52d[_0x6c01('0x23')]=intUtil[_0x6c01('0x46')](_0x52b52d[_0x6c01('0x23')]);_0x52b52d[_0x6c01('0x47')]=intUtil[_0x6c01('0x46')](_0x52b52d[_0x6c01('0x47')]);if(_0x47f2c4&&_0x47f2c4[_0x6c01('0x48')]){logger[_0x6c01('0xd')]('[QUEUE]',_0x6c01('0x49'));_0x5bf535[_0x6c01('0x4a')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x52b52d['serverUrl'],_0x5bf535[_0x6c01('0x4b')],md5(_0x5bf535[_0x6c01('0x4b')]));}else{_0x5bf535['recordingURL']='';}headers[_0x6c01('0x4c')]=getAuth(_0x52b52d);return getUser(_0x52b52d,_0x138ecf[_0x6c01('0x28')])[_0x6c01('0x1e')](function(_0x46c720){_0xf0ca15=_0x46c720;logger[_0x6c01('0xd')](_0x6c01('0x4d'),_0xf0ca15['id']);return getEndUser(_0x52b52d,_0x5bf535[_0x6c01('0x11')],_0x5bf535['calleridnum']);})['then'](function(_0x26d3ff){_0x12cf06=_0x26d3ff;logger[_0x6c01('0xd')]('The\x20Enduser\x20ID\x20is:',_0x12cf06['id']);return getTicket(_0x52b52d,_0xf0ca15,_0x12cf06,_0x2c2576,_0x5bf535);})[_0x6c01('0x1e')](function(_0x1f228d){if(_0x1f228d&&_0x1f228d['id']){logger[_0x6c01('0xd')]('Ticket\x20created!');logger[_0x6c01('0xd')]('The\x20Ticket\x20ID\x20is:',_0x1f228d['id']);logger['info']('[QUEUE]',_0x6c01('0x4e'));emit(util['format'](_0x6c01('0x4f'),_0x138ecf[_0x6c01('0x17')]),'trigger:browser:url',{'uri':util[_0x6c01('0x21')](_0x6c01('0x50'),_0x52b52d['remoteUri'],_0x1f228d['id'])});}})[_0x6c01('0x51')](function(_0x1a6125){logger[_0x6c01('0x52')](_0x6c01('0x53'),JSON[_0x6c01('0x32')](_0x1a6125));});};exports[_0x6c01('0x54')]=function(_0x59a192,_0x3b8e64,_0x55ecad,_0x3a6d00,_0x375f59,_0x46e47d,_0xcc5523){var _0x949a22,_0x2a5586;_0x46e47d[_0x6c01('0x23')]=intUtil[_0x6c01('0x46')](_0x46e47d[_0x6c01('0x23')]);_0x46e47d[_0x6c01('0x47')]=intUtil[_0x6c01('0x46')](_0x46e47d['serverUrl']);if(_0xcc5523&&_0xcc5523['recordingFormat']&&_0xcc5523[_0x6c01('0x55')]!==_0x6c01('0x56')){logger[_0x6c01('0xd')](_0x6c01('0x57'),_0x6c01('0x49'));_0x3b8e64['recordingURL']=util[_0x6c01('0x21')](_0x6c01('0x58'),_0x46e47d[_0x6c01('0x47')],_0x3b8e64[_0x6c01('0x4b')],md5(_0x3b8e64[_0x6c01('0x4b')]));}headers[_0x6c01('0x4c')]=getAuth(_0x46e47d);return getUser(_0x46e47d,_0x3a6d00[_0x6c01('0x28')])[_0x6c01('0x1e')](function(_0x136ee3){_0x949a22=_0x136ee3;logger[_0x6c01('0xd')](_0x6c01('0x4d'),_0x949a22['id']);return getEndUser(_0x46e47d,_0x3b8e64[_0x6c01('0x59')],_0x3b8e64['destcalleridnum']);})[_0x6c01('0x1e')](function(_0x3eb522){_0x2a5586=_0x3eb522;logger[_0x6c01('0xd')]('The\x20Enduser\x20ID\x20is:',_0x2a5586['id']);return getTicket(_0x46e47d,_0x949a22,_0x2a5586,_0x55ecad,_0x3b8e64);})[_0x6c01('0x1e')](function(_0x54aa22){if(_0x54aa22&&_0x54aa22['id']){logger[_0x6c01('0xd')]('Ticket\x20created!');logger['info'](_0x6c01('0x5a'),_0x54aa22['id']);logger[_0x6c01('0xd')](_0x6c01('0x57'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6c01('0x21')]('user:%s',_0x3a6d00['name']),_0x6c01('0x5b'),{'uri':util['format'](_0x6c01('0x50'),_0x46e47d[_0x6c01('0x23')],_0x54aa22['id'])});}})['catch'](function(_0x55b902){logger[_0x6c01('0x52')](_0x6c01('0x57'),JSON['stringify'](_0x55b902));});};exports[_0x6c01('0x5c')]=function(_0x30ad54,_0x42178c,_0x1152d8,_0xf82dc6,_0x403485,_0x415f05){var _0x1496a0,_0x35a156;_0x415f05[_0x6c01('0x23')]=intUtil[_0x6c01('0x46')](_0x415f05['remoteUri']);_0x415f05['serverUrl']=intUtil[_0x6c01('0x46')](_0x415f05[_0x6c01('0x47')]);if(_0x403485&&_0x403485['monitor_format']){logger['info']('['+_0x42178c['lastevent'][_0x6c01('0x5d')]()+']',_0x6c01('0x49'));_0x42178c['recordingURL']=util[_0x6c01('0x21')](_0x6c01('0x58'),_0x415f05['serverUrl'],_0x42178c[_0x6c01('0x4b')],md5(_0x42178c[_0x6c01('0x4b')]));}else{_0x42178c[_0x6c01('0x4a')]='';}headers[_0x6c01('0x4c')]=getAuth(_0x415f05);return getUser(_0x415f05,'')[_0x6c01('0x1e')](function(_0x2a3eef){_0x1496a0=_0x2a3eef;logger['info'](_0x6c01('0x4d'),_0x1496a0['id']);return getEndUser(_0x415f05,_0x42178c[_0x6c01('0x11')],_0x42178c[_0x6c01('0x12')]);})[_0x6c01('0x1e')](function(_0x3fb6e1){_0x35a156=_0x3fb6e1;logger['info'](_0x6c01('0x5e'),_0x35a156['id']);return getTicket(_0x415f05,_0x1496a0,_0x35a156,_0x1152d8,_0x42178c);})['then'](function(_0x5d9473){if(_0x5d9473){logger['info'](_0x6c01('0x1f'));logger[_0x6c01('0xd')](_0x6c01('0x5a'),_0x5d9473['id']);}})['catch'](function(_0x10d432){logger[_0x6c01('0x52')]('['+_0x42178c[_0x6c01('0x5f')][_0x6c01('0x5d')]()+']',JSON[_0x6c01('0x32')](_0x10d432));});}; \ 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 7b89a72..13c3add 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 _0x5ad4=[']\x20Error\x20running\x20Freshsales\x20integration','inspect','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','length','email','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','users','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','userEmail','error','message','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','add','ticketId','task','Task\x20created:','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...'];(function(_0x429447,_0x1eeecb){var _0x1f19ae=function(_0x2bd0a7){while(--_0x2bd0a7){_0x429447['push'](_0x429447['shift']());}};_0x1f19ae(++_0x1eeecb);}(_0x5ad4,0x15a));var _0x45ad=function(_0x565e21,_0x5d843a){_0x565e21=_0x565e21-0x0;var _0x3d2645=_0x5ad4[_0x565e21];return _0x3d2645;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x45ad('0x0'));var util=require(_0x45ad('0x1'));var moment=require(_0x45ad('0x2'));var Promise=require(_0x45ad('0x3'));var Redis=require(_0x45ad('0x4'));var intUtil=require(_0x45ad('0x5'));var config=require(_0x45ad('0x6'));var logger=require('../../../../config/logger')('freshsales');config[_0x45ad('0x7')]=_[_0x45ad('0x8')](config['redis'],{'host':_0x45ad('0x9'),'port':0x18eb});var io=require(_0x45ad('0xa'))(new Redis(config[_0x45ad('0x7')]));function getAdminId(_0x2d22ed,_0x296061,_0x57b65b,_0x52185e){return new Promise(function(_0x131b9c,_0x21ae2c){var _0x470867=![];var _0x5174d2={'method':_0x45ad('0xb'),'uri':_0x52185e+_0x45ad('0xc'),'json':!![]};_0x5174d2[_0x45ad('0xd')]=_0x57b65b;logger['info'](_0x45ad('0xe'));return rp(_0x5174d2)[_0x45ad('0xf')](function(_0x1966e6){if(_0x1966e6){var _0x1fbea9=_0x1966e6['users'];var _0xa91fbc=null;for(_0xa91fbc=0x0;_0xa91fbc<_0x1fbea9[_0x45ad('0x10')];_0xa91fbc++){if(_0x1fbea9[_0xa91fbc][_0x45ad('0x11')]===_0x2d22ed[_0x45ad('0x12')]){_0x2d22ed[_0x45ad('0x13')]=_0x1fbea9[_0xa91fbc]['id'];_0x470867=!![];}}if(_0x470867){logger[_0x45ad('0x14')](_0x45ad('0x15'),_0x2d22ed[_0x45ad('0x13')]);_0x131b9c(_0x2d22ed);}else{_0x21ae2c({'statusCode':0x194,'message':_0x45ad('0x16')});}}else{_0x21ae2c({'statusCode':0x194,'message':_0x45ad('0x16')});}})[_0x45ad('0x17')](function(_0x6f7f2){logger['error']('['+[_0x296061[_0x45ad('0x18')]()]+']',_0x6f7f2['message']);_0x21ae2c(_0x6f7f2);});});}function getUser(_0x5519de,_0x3c9043,_0x1fb114){return function(_0x250188){return new Promise(function(_0x37259a,_0x1c230c){var _0x3c918f={'method':_0x45ad('0xb'),'uri':_0x1fb114+_0x45ad('0xc'),'json':!![]};_0x3c918f[_0x45ad('0xd')]=_0x3c9043;logger[_0x45ad('0x14')]('Getting\x20user\x20list');return rp(_0x3c918f)[_0x45ad('0xf')](function(_0x2a63a2){if(_0x2a63a2){var _0x4d8271=_0x2a63a2[_0x45ad('0x19')];var _0x2ce55b=![];var _0x40398e=null;if(_0x250188[_0x45ad('0x1a')]!==null){logger['info'](_0x45ad('0x1b'),_0x250188[_0x45ad('0x1a')]);_0x250188['userEmail']=_0x250188[_0x45ad('0x1a')];for(_0x40398e=0x0;_0x40398e<_0x4d8271['length'];_0x40398e++){if(_0x4d8271[_0x40398e][_0x45ad('0x11')]===_0x250188['agentEmail']){_0x2ce55b=!![];_0x250188[_0x45ad('0x1c')]=_0x4d8271[_0x40398e]['id'];logger['info'](_0x45ad('0x1d'),_0x250188[_0x45ad('0x1c')]);}}}if(!_0x2ce55b){logger[_0x45ad('0x14')](_0x45ad('0x1e'));_0x250188[_0x45ad('0x1f')]=_0x250188[_0x45ad('0x12')];_0x250188[_0x45ad('0x1c')]=_0x250188[_0x45ad('0x13')];_0x2ce55b=!![];}if(_0x2ce55b){_0x37259a(_0x250188);}else{_0x1c230c({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x1c230c({'statusCode':0x194,'message':_0x45ad('0x16')});}})[_0x45ad('0x17')](function(_0x15713c){logger[_0x45ad('0x20')]('['+[_0x5519de['toUpperCase']()]+']',_0x15713c[_0x45ad('0x21')]);_0x1c230c(_0x15713c);});});};}function searchContact(_0x545f19,_0x3147aa,_0x37b955,_0x4e0c2b){return new Promise(function(_0x339c44,_0x18e8ee){var _0x5d9f36={'method':'GET','headers':_0x3147aa,'uri':_0x545f19+'/api/lookup?q='+_0x4e0c2b+_0x45ad('0x22')+_0x37b955+'&entities=contact','json':!![]};rp(_0x5d9f36)['then'](function(_0x2fbeaa){var _0x234076=_[_0x45ad('0x23')](_0x2fbeaa[_0x45ad('0x24')]['contacts'],[_0x37b955,_0x4e0c2b]);_0x339c44(_0x234076);})[_0x45ad('0x17')](function(_0x448913){_0x18e8ee(_0x448913);});});}function getEndUser(_0x275741,_0x48f117,_0x5cb202){return function(_0x27981b){return new Promise(function(_0x129f51,_0xd14205){logger['info'](util[_0x45ad('0x25')](_0x45ad('0x26'),_0x27981b[_0x45ad('0x27')]));searchContact(_0x5cb202,_0x48f117,_0x45ad('0x28'),_0x27981b['contactNumber'])[_0x45ad('0xf')](function(_0xcd1bbf){if(_0xcd1bbf){_0x27981b['endUserId']=_0xcd1bbf['id'];logger[_0x45ad('0x14')](_0x45ad('0x29'),_0x27981b[_0x45ad('0x2a')]);return _0x129f51(_0x27981b);}searchContact(_0x5cb202,_0x48f117,_0x45ad('0x2b'),_0x27981b['contactNumber'])['then'](function(_0x2639c9){if(_0x2639c9){_0x27981b[_0x45ad('0x2a')]=_0x2639c9['id'];logger['info'](_0x45ad('0x2c'),_0x27981b[_0x45ad('0x2a')]);return _0x129f51(_0x27981b);}createEndUser(_0x27981b,_0x275741,_0x48f117,_0x5cb202)[_0x45ad('0xf')](function(_0x55ebc3){logger[_0x45ad('0x14')](_0x45ad('0x2d'),_0x55ebc3[_0x45ad('0x2a')]);return _0x129f51(_0x55ebc3);});});})[_0x45ad('0x17')](function(_0x1e5b45){_0xd14205(_0x1e5b45);});});};}function createEndUser(_0x38e8c8,_0x37ccd2,_0x289a58,_0x572088){return new Promise(function(_0xdcad6,_0x5f18d3){var _0x6f9000=moment();var _0x5beb85={'method':_0x45ad('0x2e'),'uri':_0x572088+_0x45ad('0x2f'),'body':{'contact':{'last_name':_0x38e8c8[_0x45ad('0x27')],'work_number':_0x38e8c8[_0x45ad('0x27')],'mobile_number':_0x38e8c8[_0x45ad('0x27')],'owner_id':_0x38e8c8['userId'],'created_at':_0x6f9000[_0x45ad('0x25')](_0x45ad('0x30'))}},'json':!![]};_0x5beb85[_0x45ad('0xd')]=_0x289a58;logger[_0x45ad('0x14')](_0x45ad('0x31'));return rp(_0x5beb85)[_0x45ad('0xf')](function(_0x291c34){_0x38e8c8['endUserId']=_0x291c34[_0x45ad('0x32')]['id'];_0xdcad6(_0x38e8c8);})[_0x45ad('0x17')](function(_0x44d9d7){logger[_0x45ad('0x20')]('['+[_0x37ccd2[_0x45ad('0x18')]()]+']',_0x44d9d7[_0x45ad('0x21')]);_0x5f18d3(_0x44d9d7[_0x45ad('0x21')]);});});}function getTicket(_0x495681,_0x5759fa,_0x2501fe,_0x1c28f5,_0x1c8a6f){return function(_0x225820){logger['info'](_0x45ad('0x33'));return new Promise(function(_0x4360aa,_0x2a2291){var _0x5acc23=moment();var _0x343ddf={'method':_0x45ad('0x2e'),'uri':_0x2501fe+_0x45ad('0x34'),'body':{'title':intUtil[_0x45ad('0x35')](_0x1c28f5['Subjects'],_0x1c8a6f,'\x20'),'description':intUtil[_0x45ad('0x35')](_0x1c28f5[_0x45ad('0x36')],_0x1c8a6f,'\x0a'),'owner_id':_0x225820[_0x45ad('0x1c')],'creater_id':_0x225820['adminId'],'targetable_id':_0x225820[_0x45ad('0x2a')],'targetable_type':_0x45ad('0x37'),'created_at':_0x5acc23[_0x45ad('0x25')](_0x45ad('0x30')),'due_date':_0x5acc23[_0x45ad('0x38')](0x1e,'m')['format'](_0x45ad('0x30'))},'json':!![]};_0x343ddf[_0x45ad('0xd')]=_0x5759fa;return rp(_0x343ddf)['then'](function(_0x2d4e93){_0x225820[_0x45ad('0x39')]=_0x2d4e93[_0x45ad('0x3a')]['id'];logger[_0x45ad('0x14')](_0x45ad('0x3b'),_0x225820[_0x45ad('0x39')]);_0x4360aa(_0x225820);})['catch'](function(_0x30bb12){logger[_0x45ad('0x20')]('['+[_0x495681[_0x45ad('0x18')]()]+']',_0x30bb12[_0x45ad('0x21')]);_0x2a2291(_0x30bb12[_0x45ad('0x21')]);});});};}function emit(_0x4d1155,_0x33575b,_0x295630){var _0x2f83bb={'uri':_0x4d1155+'/contacts/'+_0x295630};io['to'](util[_0x45ad('0x25')]('user:%s',_0x33575b))[_0x45ad('0x3c')](_0x45ad('0x3d'),_0x2f83bb);}exports['cs']=function(_0x1ab76b,_0x5032c6,_0xf6c3c6,_0x228b5b,_0x11aadb,_0x202bd5,_0x4553a3,_0x541239){var _0x2a0376={};var _0x42343d={'Authorization':_0x45ad('0x3e')+_0x202bd5[_0x45ad('0x3f')]};_0x202bd5[_0x45ad('0x40')]=intUtil[_0x45ad('0x41')](_0x202bd5[_0x45ad('0x40')]);_0x202bd5[_0x45ad('0x42')]=intUtil['stripTrailingSlash'](_0x202bd5['serverUrl']);var _0x1db527=_0x202bd5['remoteUri'];_0x2a0376[_0x45ad('0x12')]=_0x202bd5[_0x45ad('0x43')];_0x2a0376[_0x45ad('0x27')]=_0x541239[_0x45ad('0x44')]()===_0x45ad('0x45')?_0x5032c6['destcalleridnum']:_0x5032c6[_0x45ad('0x46')];_0x2a0376[_0x45ad('0x47')]=_0x541239===_0x45ad('0x48')||_0x541239===_0x45ad('0x49')?_0x45ad('0x48'):_0x45ad('0x45');if(_0x228b5b){_0x2a0376[_0x45ad('0x1a')]=_0x228b5b['email'];}var _0x13dd92=util['format'](_0x45ad('0x4a'),_0x202bd5[_0x45ad('0x42')],_0x5032c6[_0x45ad('0x4b')],md5(_0x5032c6[_0x45ad('0x4b')]));if(_0x11aadb&&_0x11aadb[_0x45ad('0x4c')]){logger[_0x45ad('0x14')](_0x45ad('0x4d'),'Recording\x20is\x20enabled!');_0x5032c6[_0x45ad('0x4e')]=_0x13dd92;}else if(_0x4553a3&&_0x4553a3[_0x45ad('0x4f')]&&_0x4553a3[_0x45ad('0x4f')]!=='none'){logger[_0x45ad('0x14')](_0x45ad('0x50'),_0x45ad('0x51'));_0x5032c6['recordingURL']=_0x13dd92;}else{_0x5032c6[_0x45ad('0x4e')]='';}return getAdminId(_0x2a0376,_0x541239,_0x42343d,_0x1db527)[_0x45ad('0xf')](getUser(_0x541239,_0x42343d,_0x1db527))[_0x45ad('0xf')](getEndUser(_0x541239,_0x42343d,_0x1db527))[_0x45ad('0xf')](getTicket(_0x541239,_0x42343d,_0x1db527,_0xf6c3c6,_0x5032c6))[_0x45ad('0xf')](function(_0x5c79df){logger[_0x45ad('0x14')](util['format'](_0x45ad('0x52'),_0x5c79df['ticketId']));if(_0x541239!==_0x45ad('0x49')){logger[_0x45ad('0x14')]('['+[_0x541239[_0x45ad('0x18')]()]+']',_0x45ad('0x53'));emit(_0x1db527,_0x228b5b['name'],_0x5c79df[_0x45ad('0x2a')]);}})[_0x45ad('0x17')](function(_0x5ef9b7){logger[_0x45ad('0x20')]('['+[_0x541239[_0x45ad('0x18')]()]+_0x45ad('0x54'),util[_0x45ad('0x55')](_0x5ef9b7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd13d=['/contacts/','user:%s','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','[QUEUE]','recordingFormat','none','Recording\x20is\x20enabled!','recordingURL','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','md5','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','info','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','Admin\x20selected','&f=','&entities=contact','find','contacts','catch','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','POST','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','task'];(function(_0x2511c5,_0x562bf1){var _0x3f4b95=function(_0x297a23){while(--_0x297a23){_0x2511c5['push'](_0x2511c5['shift']());}};_0x3f4b95(++_0x562bf1);}(_0xd13d,0x19b));var _0xdd13=function(_0xe4b01f,_0x1519f4){_0xe4b01f=_0xe4b01f-0x0;var _0x97481c=_0xd13d[_0xe4b01f];return _0x97481c;};'use strict';var _=require(_0xdd13('0x0'));var rp=require('request-promise');var md5=require(_0xdd13('0x1'));var util=require('util');var moment=require(_0xdd13('0x2'));var Promise=require(_0xdd13('0x3'));var Redis=require(_0xdd13('0x4'));var intUtil=require(_0xdd13('0x5'));var config=require(_0xdd13('0x6'));var logger=require(_0xdd13('0x7'))(_0xdd13('0x8'));config[_0xdd13('0x9')]=_[_0xdd13('0xa')](config['redis'],{'host':_0xdd13('0xb'),'port':0x18eb});var io=require(_0xdd13('0xc'))(new Redis(config[_0xdd13('0x9')]));function getAdminId(_0x3bac66,_0x535fa7,_0x436139,_0x219a99){return new Promise(function(_0x591a1f,_0x3ab53f){var _0x3819df=![];var _0x23f567={'method':_0xdd13('0xd'),'uri':_0x219a99+_0xdd13('0xe'),'json':!![]};_0x23f567[_0xdd13('0xf')]=_0x436139;logger['info'](_0xdd13('0x10'));return rp(_0x23f567)[_0xdd13('0x11')](function(_0x3bb1bc){if(_0x3bb1bc){var _0xa4419a=_0x3bb1bc[_0xdd13('0x12')];var _0x150637=null;for(_0x150637=0x0;_0x150637<_0xa4419a[_0xdd13('0x13')];_0x150637++){if(_0xa4419a[_0x150637][_0xdd13('0x14')]===_0x3bac66[_0xdd13('0x15')]){_0x3bac66[_0xdd13('0x16')]=_0xa4419a[_0x150637]['id'];_0x3819df=!![];}}if(_0x3819df){logger['info'](_0xdd13('0x17'),_0x3bac66['adminId']);_0x591a1f(_0x3bac66);}else{_0x3ab53f({'statusCode':0x194,'message':_0xdd13('0x18')});}}else{_0x3ab53f({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x8a83a9){logger[_0xdd13('0x19')]('['+[_0x535fa7[_0xdd13('0x1a')]()]+']',_0x8a83a9[_0xdd13('0x1b')]);_0x3ab53f(_0x8a83a9);});});}function getUser(_0x136b09,_0x3d0e54,_0x20695c){return function(_0x454829){return new Promise(function(_0x13700f,_0x3db4ab){var _0x14c991={'method':'GET','uri':_0x20695c+_0xdd13('0xe'),'json':!![]};_0x14c991['headers']=_0x3d0e54;logger[_0xdd13('0x1c')](_0xdd13('0x1d'));return rp(_0x14c991)[_0xdd13('0x11')](function(_0x54ec67){if(_0x54ec67){var _0x10a36e=_0x54ec67['users'];var _0x13be31=![];var _0x36a442=null;if(_0x454829[_0xdd13('0x1e')]!==null){logger[_0xdd13('0x1c')](_0xdd13('0x1f'),_0x454829['agentEmail']);_0x454829[_0xdd13('0x20')]=_0x454829[_0xdd13('0x1e')];for(_0x36a442=0x0;_0x36a442<_0x10a36e[_0xdd13('0x13')];_0x36a442++){if(_0x10a36e[_0x36a442][_0xdd13('0x14')]===_0x454829[_0xdd13('0x1e')]){_0x13be31=!![];_0x454829['userId']=_0x10a36e[_0x36a442]['id'];logger[_0xdd13('0x1c')]('User\x20found:',_0x454829['userId']);}}}if(!_0x13be31){logger['info'](_0xdd13('0x21'));_0x454829['userEmail']=_0x454829[_0xdd13('0x15')];_0x454829['userId']=_0x454829[_0xdd13('0x16')];_0x13be31=!![];}if(_0x13be31){_0x13700f(_0x454829);}else{_0x3db4ab({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x3db4ab({'statusCode':0x194,'message':_0xdd13('0x18')});}})['catch'](function(_0x5c75b3){logger[_0xdd13('0x19')]('['+[_0x136b09['toUpperCase']()]+']',_0x5c75b3[_0xdd13('0x1b')]);_0x3db4ab(_0x5c75b3);});});};}function searchContact(_0x4a3d77,_0x2170c3,_0x59ee47,_0x1cabe5){return new Promise(function(_0x501211,_0x5bfd23){var _0x8a5fbb={'method':_0xdd13('0xd'),'headers':_0x2170c3,'uri':_0x4a3d77+'/api/lookup?q='+_0x1cabe5+_0xdd13('0x22')+_0x59ee47+_0xdd13('0x23'),'json':!![]};rp(_0x8a5fbb)[_0xdd13('0x11')](function(_0x5a3449){var _0x330ffe=_[_0xdd13('0x24')](_0x5a3449[_0xdd13('0x25')][_0xdd13('0x25')],[_0x59ee47,_0x1cabe5]);_0x501211(_0x330ffe);})[_0xdd13('0x26')](function(_0x474372){_0x5bfd23(_0x474372);});});}function getEndUser(_0x2e016a,_0x5d31ab,_0x595488){return function(_0x4aa853){return new Promise(function(_0x60b122,_0x198efb){logger[_0xdd13('0x1c')](util[_0xdd13('0x27')](_0xdd13('0x28'),_0x4aa853[_0xdd13('0x29')]));searchContact(_0x595488,_0x5d31ab,_0xdd13('0x2a'),_0x4aa853['contactNumber'])['then'](function(_0x4cd17b){if(_0x4cd17b){_0x4aa853[_0xdd13('0x2b')]=_0x4cd17b['id'];logger[_0xdd13('0x1c')](_0xdd13('0x2c'),_0x4aa853[_0xdd13('0x2b')]);return _0x60b122(_0x4aa853);}searchContact(_0x595488,_0x5d31ab,'work_number',_0x4aa853[_0xdd13('0x29')])[_0xdd13('0x11')](function(_0x53979a){if(_0x53979a){_0x4aa853['endUserId']=_0x53979a['id'];logger[_0xdd13('0x1c')](_0xdd13('0x2d'),_0x4aa853[_0xdd13('0x2b')]);return _0x60b122(_0x4aa853);}createEndUser(_0x4aa853,_0x2e016a,_0x5d31ab,_0x595488)[_0xdd13('0x11')](function(_0xd6e4cf){logger[_0xdd13('0x1c')]('Contact\x20created:',_0xd6e4cf['endUserId']);return _0x60b122(_0xd6e4cf);});});})['catch'](function(_0x2380ac){_0x198efb(_0x2380ac);});});};}function createEndUser(_0x5e68d9,_0x31bdf9,_0x53469e,_0x4231c5){return new Promise(function(_0x19a143,_0x441dfd){var _0x4d0bc4=moment();var _0x30031f={'method':_0xdd13('0x2e'),'uri':_0x4231c5+'/api/contacts','body':{'contact':{'last_name':_0x5e68d9[_0xdd13('0x29')],'work_number':_0x5e68d9[_0xdd13('0x29')],'mobile_number':_0x5e68d9['contactNumber'],'owner_id':_0x5e68d9['userId'],'created_at':_0x4d0bc4[_0xdd13('0x27')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x30031f[_0xdd13('0xf')]=_0x53469e;logger[_0xdd13('0x1c')](_0xdd13('0x2f'));return rp(_0x30031f)[_0xdd13('0x11')](function(_0x230637){_0x5e68d9[_0xdd13('0x2b')]=_0x230637['contact']['id'];_0x19a143(_0x5e68d9);})['catch'](function(_0x2a721e){logger[_0xdd13('0x19')]('['+[_0x31bdf9[_0xdd13('0x1a')]()]+']',_0x2a721e[_0xdd13('0x1b')]);_0x441dfd(_0x2a721e[_0xdd13('0x1b')]);});});}function getTicket(_0x2790e1,_0x3a197a,_0x507249,_0x26ac0a,_0x2b1f23){return function(_0xa47fbd){logger['info'](_0xdd13('0x30'));return new Promise(function(_0x17fe84,_0x5881fe){var _0x45b6f2=moment();var _0x19811f={'method':_0xdd13('0x2e'),'uri':_0x507249+_0xdd13('0x31'),'body':{'title':intUtil[_0xdd13('0x32')](_0x26ac0a['Subjects'],_0x2b1f23,'\x20'),'description':intUtil[_0xdd13('0x32')](_0x26ac0a[_0xdd13('0x33')],_0x2b1f23,'\x0a'),'owner_id':_0xa47fbd['userId'],'creater_id':_0xa47fbd[_0xdd13('0x16')],'targetable_id':_0xa47fbd[_0xdd13('0x2b')],'targetable_type':_0xdd13('0x34'),'created_at':_0x45b6f2[_0xdd13('0x27')](_0xdd13('0x35')),'due_date':_0x45b6f2[_0xdd13('0x36')](0x1e,'m')[_0xdd13('0x27')](_0xdd13('0x35'))},'json':!![]};_0x19811f['headers']=_0x3a197a;return rp(_0x19811f)[_0xdd13('0x11')](function(_0x46e0eb){_0xa47fbd[_0xdd13('0x37')]=_0x46e0eb[_0xdd13('0x38')]['id'];logger[_0xdd13('0x1c')]('Task\x20created:',_0xa47fbd[_0xdd13('0x37')]);_0x17fe84(_0xa47fbd);})['catch'](function(_0x46ae65){logger[_0xdd13('0x19')]('['+[_0x2790e1[_0xdd13('0x1a')]()]+']',_0x46ae65['message']);_0x5881fe(_0x46ae65[_0xdd13('0x1b')]);});});};}function emit(_0x4545ca,_0x368e5e,_0x349d54){var _0x22ed75={'uri':_0x4545ca+_0xdd13('0x39')+_0x349d54};io['to'](util[_0xdd13('0x27')](_0xdd13('0x3a'),_0x368e5e))['emit']('trigger:browser:url',_0x22ed75);}exports['cs']=function(_0x2491c5,_0x2ba740,_0x227130,_0x2023b9,_0x1f24be,_0x5cb95e,_0x166b2d,_0x16134a){var _0x195fa7={};var _0x5a5616={'Authorization':'Token\x20token='+_0x5cb95e[_0xdd13('0x3b')]};_0x5cb95e[_0xdd13('0x3c')]=intUtil[_0xdd13('0x3d')](_0x5cb95e['remoteUri']);_0x5cb95e[_0xdd13('0x3e')]=intUtil['stripTrailingSlash'](_0x5cb95e['serverUrl']);var _0x5bd587=_0x5cb95e[_0xdd13('0x3c')];_0x195fa7[_0xdd13('0x15')]=_0x5cb95e[_0xdd13('0x3f')];_0x195fa7['contactNumber']=_0x16134a[_0xdd13('0x40')]()===_0xdd13('0x41')?_0x2ba740[_0xdd13('0x42')]:_0x2ba740['calleridnum'];_0x195fa7[_0xdd13('0x43')]=_0x16134a==='queue'||_0x16134a==='unmanaged'?_0xdd13('0x44'):'outbound';if(_0x2023b9){_0x195fa7[_0xdd13('0x1e')]=_0x2023b9['email'];}var _0x3832d7=util[_0xdd13('0x27')](_0xdd13('0x45'),_0x5cb95e['serverUrl'],_0x2ba740['uniqueid'],md5(_0x2ba740['uniqueid']));if(_0x1f24be&&_0x1f24be['monitor_format']){logger[_0xdd13('0x1c')](_0xdd13('0x46'),'Recording\x20is\x20enabled!');_0x2ba740['recordingURL']=_0x3832d7;}else if(_0x166b2d&&_0x166b2d[_0xdd13('0x47')]&&_0x166b2d[_0xdd13('0x47')]!==_0xdd13('0x48')){logger[_0xdd13('0x1c')]('[OUTBOUND]',_0xdd13('0x49'));_0x2ba740[_0xdd13('0x4a')]=_0x3832d7;}else{_0x2ba740[_0xdd13('0x4a')]='';}return getAdminId(_0x195fa7,_0x16134a,_0x5a5616,_0x5bd587)[_0xdd13('0x11')](getUser(_0x16134a,_0x5a5616,_0x5bd587))['then'](getEndUser(_0x16134a,_0x5a5616,_0x5bd587))[_0xdd13('0x11')](getTicket(_0x16134a,_0x5a5616,_0x5bd587,_0x227130,_0x2ba740))['then'](function(_0x4b7235){logger[_0xdd13('0x1c')](util[_0xdd13('0x27')]('The\x20ticket\x20ID\x20is:\x20%s',_0x4b7235[_0xdd13('0x37')]));if(_0x16134a!=='unmanaged'){logger[_0xdd13('0x1c')]('['+[_0x16134a[_0xdd13('0x1a')]()]+']',_0xdd13('0x4b'));emit(_0x5bd587,_0x2023b9[_0xdd13('0x4c')],_0x4b7235[_0xdd13('0x2b')]);}})['catch'](function(_0x3010b3){logger[_0xdd13('0x19')]('['+[_0x16134a[_0xdd13('0x1a')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xdd13('0x4d')](_0x3010b3,{'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 fb681a3..ce490e5 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 _0xa192=['find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','lodash','util','./salesforce','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2'];(function(_0x287162,_0x2231a9){var _0x5a16e5=function(_0x51da73){while(--_0x51da73){_0x287162['push'](_0x287162['shift']());}};_0x5a16e5(++_0x2231a9);}(_0xa192,0x1bd));var _0x2a19=function(_0x1aa016,_0x3b1b7c){_0x1aa016=_0x1aa016-0x0;var _0x2cc4ee=_0xa192[_0x1aa016];return _0x2cc4ee;};'use strict';var _=require(_0x2a19('0x0'));var util=require(_0x2a19('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x2a19('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x2a19('0x3'));var zoho=require(_0x2a19('0x4'));var desk=require('./desk');var vtiger=require(_0x2a19('0x5'));var servicenow=require(_0x2a19('0x6'));var dynamics365=require(_0x2a19('0x7'));var freshsales=require(_0x2a19('0x8'));var integrations=[_0x2a19('0x9'),_0x2a19('0xa'),_0x2a19('0xb'),'freshdesk',_0x2a19('0xc'),_0x2a19('0xd'),_0x2a19('0xe'),_0x2a19('0xf'),_0x2a19('0x10'),_0x2a19('0x11')];exports[_0x2a19('0x12')]=function(_0x1c45a3,_0x2c3e55,_0xef5f69,_0x299ca6,_0x5bfe6a,_0x15e2d2){if(_0xef5f69){if(_[_0x2a19('0x13')](integrations,_0x1c45a3['data1']['toLowerCase']())){try{var _0x562480=null;var _0xb30810='';var _0x5b47ab=_0xef5f69[_0x1c45a3[_0x2a19('0x14')][_0x2a19('0x15')]()];if(_0x5b47ab){var _0x117aff=_0x5b47ab[_0x1c45a3[_0x2a19('0x16')]];if(_0x117aff){var _0x38d614=_[_0x2a19('0x17')](_0x117aff[_0x2a19('0x18')],{'id':parseInt(_0x1c45a3[_0x2a19('0x19')],0xa)});if(_0x38d614){if(_0x299ca6){if(_0x5bfe6a&&_0x2c3e55['queue']){_0xb30810=_0x2a19('0x1a');}else if(_0x2c3e55[_0x2a19('0x1b')]){_0xb30810=_0x2a19('0x1c');}else{console[_0x2a19('0x1d')](_0x2a19('0x1e'),_0x2c3e55);}}else{_0xb30810=_0x2a19('0x1f');}switch(_0x1c45a3[_0x2a19('0x14')][_0x2a19('0x15')]()){case'zendesk':zendesk[_0xb30810](_0x1c45a3,_0x2c3e55,_0x38d614,_0x299ca6,_0x5bfe6a,_0x117aff,_0x15e2d2);break;case _0x2a19('0xa'):salesforce[_0xb30810](_0x1c45a3,_0x2c3e55,_0x38d614,_0x299ca6,_0x5bfe6a,_0x117aff,_0x15e2d2);break;case _0x2a19('0xb'):sugarcrm[_0xb30810](_0x1c45a3,_0x2c3e55,_0x38d614,_0x299ca6,_0x5bfe6a,_0x117aff,_0x15e2d2);break;case'freshdesk':freshdesk[_0xb30810](_0x1c45a3,_0x2c3e55,_0x38d614,_0x299ca6,_0x5bfe6a,_0x117aff,_0x15e2d2);break;case _0x2a19('0xc'):zoho[_0xb30810](_0x1c45a3,_0x2c3e55,_0x38d614,_0x299ca6,_0x5bfe6a,_0x117aff,_0x15e2d2);break;case _0x2a19('0xd'):desk[_0xb30810](_0x1c45a3,_0x2c3e55,_0x38d614,_0x299ca6,_0x5bfe6a,_0x117aff,_0x15e2d2);break;case _0x2a19('0xe'):vtiger[_0xb30810](_0x1c45a3,_0x2c3e55,_0x38d614,_0x299ca6,_0x5bfe6a,_0x117aff,_0x15e2d2);break;case'freshsales':freshsales['cs'](_0x1c45a3,_0x2c3e55,_0x38d614,_0x299ca6,_0x5bfe6a,_0x117aff,_0x15e2d2,_0xb30810);break;case _0x2a19('0x11'):servicenow['cs'](_0x1c45a3,_0x2c3e55,_0x38d614,_0x299ca6,_0x5bfe6a,_0x117aff,_0x15e2d2,_0xb30810);break;case'dynamics365':dynamics365['cs'](_0x1c45a3,_0x2c3e55,_0x38d614,_0x299ca6,_0x5bfe6a,_0x117aff,_0x15e2d2,_0xb30810);break;default:console['log']('unknown\x20integration');}}else{_0x562480=require('../../../../config/logger')(_0x1c45a3[_0x2a19('0x14')][_0x2a19('0x15')]());_0x562480[_0x2a19('0x20')](_0x2a19('0x21'),util['format'](_0x2a19('0x22'),_0x1c45a3[_0x2a19('0x14')]['toLowerCase'](),_0x1c45a3['data3']));}}else{_0x562480=require(_0x2a19('0x23'))(_0x1c45a3[_0x2a19('0x14')][_0x2a19('0x15')]());_0x562480[_0x2a19('0x20')](_0x2a19('0x21'),util['format']('%s\x20account\x20#%s\x20not\x20found',_0x1c45a3[_0x2a19('0x14')]['toLowerCase'](),_0x1c45a3[_0x2a19('0x16')]));}}else{}}catch(_0x42d1dc){console['error'](_0x42d1dc);}}}}; \ No newline at end of file +var _0x2c3c=['servicenow','exec','includes','data1','toLowerCase','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','sugarcrm','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data2','util','./salesforce','./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','freshdesk','zoho','desk','vtiger','dynamics365','freshsales'];(function(_0x100d39,_0x30b6b1){var _0x943b9=function(_0x1249d4){while(--_0x1249d4){_0x100d39['push'](_0x100d39['shift']());}};_0x943b9(++_0x30b6b1);}(_0x2c3c,0x134));var _0xc2c3=function(_0x524159,_0x1455b6){_0x524159=_0x524159-0x0;var _0x42cbdc=_0x2c3c[_0x524159];return _0x42cbdc;};'use strict';var _=require('lodash');var util=require(_0xc2c3('0x0'));var zendesk=require('./zendesk');var salesforce=require(_0xc2c3('0x1'));var sugarcrm=require(_0xc2c3('0x2'));var freshdesk=require('./freshdesk');var zoho=require(_0xc2c3('0x3'));var desk=require(_0xc2c3('0x4'));var vtiger=require(_0xc2c3('0x5'));var servicenow=require(_0xc2c3('0x6'));var dynamics365=require(_0xc2c3('0x7'));var freshsales=require('./freshsales');var integrations=[_0xc2c3('0x8'),_0xc2c3('0x9'),'sugarcrm',_0xc2c3('0xa'),_0xc2c3('0xb'),_0xc2c3('0xc'),_0xc2c3('0xd'),_0xc2c3('0xe'),_0xc2c3('0xf'),_0xc2c3('0x10')];exports[_0xc2c3('0x11')]=function(_0x330b42,_0x1d613f,_0x43a6aa,_0x407a6e,_0x1e8c5d,_0x143d60){if(_0x43a6aa){if(_[_0xc2c3('0x12')](integrations,_0x330b42['data1']['toLowerCase']())){try{var _0x4fa74a=null;var _0x190180='';var _0x25dcfd=_0x43a6aa[_0x330b42[_0xc2c3('0x13')][_0xc2c3('0x14')]()];if(_0x25dcfd){var _0x52f1d9=_0x25dcfd[_0x330b42['data2']];if(_0x52f1d9){var _0x3f3ad5=_['find'](_0x52f1d9[_0xc2c3('0x15')],{'id':parseInt(_0x330b42[_0xc2c3('0x16')],0xa)});if(_0x3f3ad5){if(_0x407a6e){if(_0x1e8c5d&&_0x1d613f['queue']){_0x190180=_0xc2c3('0x17');}else if(_0x1d613f[_0xc2c3('0x18')]){_0x190180=_0xc2c3('0x19');}else{console[_0xc2c3('0x1a')](_0xc2c3('0x1b'),_0x1d613f);}}else{_0x190180=_0xc2c3('0x1c');}switch(_0x330b42[_0xc2c3('0x13')][_0xc2c3('0x14')]()){case'zendesk':zendesk[_0x190180](_0x330b42,_0x1d613f,_0x3f3ad5,_0x407a6e,_0x1e8c5d,_0x52f1d9,_0x143d60);break;case'salesforce':salesforce[_0x190180](_0x330b42,_0x1d613f,_0x3f3ad5,_0x407a6e,_0x1e8c5d,_0x52f1d9,_0x143d60);break;case _0xc2c3('0x1d'):sugarcrm[_0x190180](_0x330b42,_0x1d613f,_0x3f3ad5,_0x407a6e,_0x1e8c5d,_0x52f1d9,_0x143d60);break;case _0xc2c3('0xa'):freshdesk[_0x190180](_0x330b42,_0x1d613f,_0x3f3ad5,_0x407a6e,_0x1e8c5d,_0x52f1d9,_0x143d60);break;case _0xc2c3('0xb'):zoho[_0x190180](_0x330b42,_0x1d613f,_0x3f3ad5,_0x407a6e,_0x1e8c5d,_0x52f1d9,_0x143d60);break;case _0xc2c3('0xc'):desk[_0x190180](_0x330b42,_0x1d613f,_0x3f3ad5,_0x407a6e,_0x1e8c5d,_0x52f1d9,_0x143d60);break;case _0xc2c3('0xd'):vtiger[_0x190180](_0x330b42,_0x1d613f,_0x3f3ad5,_0x407a6e,_0x1e8c5d,_0x52f1d9,_0x143d60);break;case _0xc2c3('0xf'):freshsales['cs'](_0x330b42,_0x1d613f,_0x3f3ad5,_0x407a6e,_0x1e8c5d,_0x52f1d9,_0x143d60,_0x190180);break;case _0xc2c3('0x10'):servicenow['cs'](_0x330b42,_0x1d613f,_0x3f3ad5,_0x407a6e,_0x1e8c5d,_0x52f1d9,_0x143d60,_0x190180);break;case _0xc2c3('0xe'):dynamics365['cs'](_0x330b42,_0x1d613f,_0x3f3ad5,_0x407a6e,_0x1e8c5d,_0x52f1d9,_0x143d60,_0x190180);break;default:console[_0xc2c3('0x1a')]('unknown\x20integration');}}else{_0x4fa74a=require(_0xc2c3('0x1e'))(_0x330b42['data1'][_0xc2c3('0x14')]());_0x4fa74a[_0xc2c3('0x1f')](_0xc2c3('0x20'),util[_0xc2c3('0x21')](_0xc2c3('0x22'),_0x330b42['data1'][_0xc2c3('0x14')](),_0x330b42[_0xc2c3('0x16')]));}}else{_0x4fa74a=require(_0xc2c3('0x1e'))(_0x330b42[_0xc2c3('0x13')]['toLowerCase']());_0x4fa74a[_0xc2c3('0x1f')](_0xc2c3('0x20'),util[_0xc2c3('0x21')]('%s\x20account\x20#%s\x20not\x20found',_0x330b42[_0xc2c3('0x13')][_0xc2c3('0x14')](),_0x330b42[_0xc2c3('0x23')]));}}else{}}catch(_0x30daea){console[_0xc2c3('0x1f')](_0x30daea);}}}}; \ 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 a775b43..5aa924e 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 _0x24f4=['getString','Descriptions','ticketType','ActivityDate','utc','IsRecurrence','endUserType','WhoId','account','WhatId','Case','contact','ContactId','AccountId','lead','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','execute','then','length','find','Email','Agent\x20%s\x20found.','Name','info','identity','resolve','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','contact_lead','cloneDeep','additionalSearchContact','merge','$or','additionalSearchLead','additionalSearchAccount','Account','Contact','Lead','first','attributes','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','upperFirst','create','includes','string','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','Connection\x20established.','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','[QUEUE]\x20Ticket\x20%s\x20created','[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','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','instanceUrl','unmanaged','lastevent','calleridname','calleridnum','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','Subjects'];(function(_0x3d7e5f,_0xaba460){var _0x34fcf6=function(_0x51d9e0){while(--_0x51d9e0){_0x3d7e5f['push'](_0x3d7e5f['shift']());}};_0x34fcf6(++_0xaba460);}(_0x24f4,0x6e));var _0x424f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24f4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x424f('0x0'));var rp=require(_0x424f('0x1'));var moment=require('moment');var BPromise=require(_0x424f('0x2'));var md5=require(_0x424f('0x3'));var jsforce=require('jsforce');var util=require(_0x424f('0x4'));var Redis=require(_0x424f('0x5'));var intUtil=require(_0x424f('0x6'));var config=require(_0x424f('0x7'));var logger=require('../../../../config/logger')(_0x424f('0x8'));config[_0x424f('0x9')]=_[_0x424f('0xa')](config[_0x424f('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x13d69b,_0x58634f,_0x399af6){io['to'](_0x13d69b)['emit'](_0x58634f,_0x399af6);}function getTicket(_0x48648a,_0x1c3d11,_0x53dd50,_0x525df4,_0x1f938b,_0x31a4b6,_0x3fe9e5,_0x493f8f){var _0x10b147=Object['assign']({},{'OwnerId':_0x1c3d11['id'],'Subject':intUtil['getString'](_0x525df4[_0x424f('0xb')],_0x1f938b,'\x20'),'Description':intUtil[_0x424f('0xc')](_0x525df4[_0x424f('0xd')],_0x1f938b,'\x0a')},getCustomFields(_0x31a4b6,_0x1f938b));if(_0x53dd50){if(_0x525df4[_0x424f('0xe')]==='Task'){_0x10b147[_0x424f('0xf')]=moment[_0x424f('0x10')]();_0x10b147['IsReminderSet']=![];_0x10b147[_0x424f('0x11')]=![];if(_0x53dd50['endUserType']==='contact'||_0x53dd50[_0x424f('0x12')]==='lead'){_0x10b147[_0x424f('0x13')]=_0x53dd50['id'];}else if(_0x53dd50['endUserType']===_0x424f('0x14')){_0x10b147[_0x424f('0x15')]=_0x53dd50['id'];}}else if(_0x525df4[_0x424f('0xe')]===_0x424f('0x16')){if(_0x53dd50['endUserType']===_0x424f('0x17')){_0x10b147[_0x424f('0x18')]=_0x53dd50['id'];}else if(_0x53dd50['endUserType']===_0x424f('0x14')){_0x10b147[_0x424f('0x19')]=_0x53dd50['id'];}else if(_0x53dd50[_0x424f('0x12')]===_0x424f('0x1a')&&_0x525df4[_0x424f('0x1b')]){_0x10b147[_0x525df4[_0x424f('0x1b')]]=_0x53dd50['id'];}else{logger['info'](_0x424f('0x1c'));}}}return _0x3fe9e5[_0x424f('0x1d')](_0x525df4[_0x424f('0xe')])['create'](_0x10b147);}function getUser(_0x435804,_0x2b7f49,_0x4d7c9d){if(!_[_0x424f('0x1e')](_0x2b7f49)&&intUtil[_0x424f('0x1f')](_0x2b7f49)){var _0x1338ac={'Email':_0x2b7f49};var _0x57769d={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4d7c9d[_0x424f('0x1d')]('User')['find'](_0x1338ac,_0x57769d)[_0x424f('0x20')]()[_0x424f('0x21')](function(_0x48f082){if(_0x48f082[_0x424f('0x22')]){var _0x47eb6d=_[_0x424f('0x23')](_0x48f082,function(_0xefe708){return _0xefe708[_0x424f('0x24')]===_0x2b7f49;});if(_0x47eb6d){logger['info'](_0x424f('0x25'),_0x2b7f49);return BPromise['resolve']({'id':_0x47eb6d['Id'],'name':_0x47eb6d[_0x424f('0x26')]});}}else{logger[_0x424f('0x27')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x2b7f49);return _0x4d7c9d[_0x424f('0x28')]()[_0x424f('0x21')](function(_0x484055){return BPromise[_0x424f('0x29')]({'id':_0x484055[_0x424f('0x2a')],'name':_0x484055[_0x424f('0x2b')]});});}});}else{logger['info'](_0x424f('0x2c'),_0x2b7f49);return _0x4d7c9d[_0x424f('0x28')]()[_0x424f('0x21')](function(_0x3dece9){return BPromise[_0x424f('0x29')]({'id':_0x3dece9[_0x424f('0x2a')],'name':_0x3dece9[_0x424f('0x2b')]});});}}function getEndUser(_0x59ab4b,_0xc848f1,_0x4729c3,_0x3b3502,_0x109917){var _0x5b5228={'$or':{'Phone':_0x3b3502}};var _0x13a5ef={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x424f('0x29')]()[_0x424f('0x21')](function(){logger[_0x424f('0x27')](_0x424f('0x2d'),_0x3b3502,_0xc848f1['moduleSearch']);switch(_0xc848f1['moduleSearch']){case _0x424f('0x2e'):var _0x38ee47=_[_0x424f('0x2f')](_0x5b5228);if(_0xc848f1[_0x424f('0x30')]){var _0x4c4bfe={};_0x4c4bfe[_0xc848f1[_0x424f('0x30')]]=_0x3b3502;_[_0x424f('0x31')](_0x38ee47[_0x424f('0x32')],_0x4c4bfe);}return _0x109917[_0x424f('0x1d')]('Contact')[_0x424f('0x23')](_0x38ee47,_0x13a5ef)[_0x424f('0x20')]()[_0x424f('0x21')](function(_0x4e7b53){if(_0x4e7b53&&_0x4e7b53[_0x424f('0x22')]){return _0x4e7b53;}else{var _0x10246e=_[_0x424f('0x2f')](_0x5b5228);if(_0xc848f1[_0x424f('0x33')]){var _0x93f4b7={};_0x93f4b7[_0xc848f1[_0x424f('0x33')]]=_0x3b3502;_['merge'](_0x10246e[_0x424f('0x32')],_0x93f4b7);}return _0x109917[_0x424f('0x1d')]('Lead')[_0x424f('0x23')](_0x10246e,_0x13a5ef);}});case'account_contact_lead':var _0x5cb9f7=_[_0x424f('0x2f')](_0x5b5228);if(_0xc848f1['additionalSearchAccount']){var _0x4c4bfe={};_0x4c4bfe[_0xc848f1[_0x424f('0x34')]]=_0x3b3502;_[_0x424f('0x31')](_0x5cb9f7[_0x424f('0x32')],_0x4c4bfe);}return _0x109917[_0x424f('0x1d')](_0x424f('0x35'))[_0x424f('0x23')](_0x5cb9f7,_0x13a5ef)[_0x424f('0x20')]()[_0x424f('0x21')](function(_0x29d582){if(_0x29d582&&_0x29d582[_0x424f('0x22')]){return _0x29d582;}else{var _0x4c4a14=_[_0x424f('0x2f')](_0x5b5228);if(_0xc848f1[_0x424f('0x30')]){var _0x4c71e1={};_0x4c71e1[_0xc848f1[_0x424f('0x30')]]=_0x3b3502;_['merge'](_0x4c4a14[_0x424f('0x32')],_0x4c71e1);}return _0x109917[_0x424f('0x1d')]('Contact')[_0x424f('0x23')](_0x4c4a14,_0x13a5ef)[_0x424f('0x21')](function(_0xdfa3eb){if(_0xdfa3eb&&_0xdfa3eb['length']){return _0xdfa3eb;}else{var _0x21f424=_[_0x424f('0x2f')](_0x5b5228);if(_0xc848f1[_0x424f('0x33')]){var _0x13b7ca={};_0x13b7ca[_0xc848f1[_0x424f('0x33')]]=_0x3b3502;_[_0x424f('0x31')](_0x21f424['$or'],_0x13b7ca);}return _0x109917[_0x424f('0x1d')]('Lead')[_0x424f('0x23')](_0x21f424,_0x13a5ef);}});}});case'contact':var _0x38ee47=_[_0x424f('0x2f')](_0x5b5228);if(_0xc848f1[_0x424f('0x30')]){var _0x4c4bfe={};_0x4c4bfe[_0xc848f1[_0x424f('0x30')]]=_0x3b3502;_[_0x424f('0x31')](_0x38ee47['$or'],_0x4c4bfe);}return _0x109917[_0x424f('0x1d')](_0x424f('0x36'))[_0x424f('0x23')](_0x38ee47,_0x13a5ef)['execute']();case'lead':var _0x2c05a2=_[_0x424f('0x2f')](_0x5b5228);if(_0xc848f1[_0x424f('0x33')]){var _0x4c4bfe={};_0x4c4bfe[_0xc848f1[_0x424f('0x33')]]=_0x3b3502;_[_0x424f('0x31')](_0x2c05a2[_0x424f('0x32')],_0x4c4bfe);}return _0x109917[_0x424f('0x1d')](_0x424f('0x37'))[_0x424f('0x23')](_0x2c05a2,_0x13a5ef);case _0x424f('0x14'):var _0x5cb9f7=_[_0x424f('0x2f')](_0x5b5228);if(_0xc848f1[_0x424f('0x34')]){var _0x4c4bfe={};_0x4c4bfe[_0xc848f1[_0x424f('0x34')]]=_0x3b3502;_[_0x424f('0x31')](_0x5cb9f7['$or'],_0x4c4bfe);}return _0x109917[_0x424f('0x1d')]('Account')[_0x424f('0x23')](_0x5cb9f7,_0x13a5ef);default:return null;}})[_0x424f('0x21')](function(_0x55439e){if(_0x55439e&&_0x55439e['length']){var _0x31a633=_[_0x424f('0x38')](_0x55439e);if(_0x31a633){return BPromise[_0x424f('0x29')]({'id':_0x31a633['Id'],'name':_0x31a633['Name'],'phone':_0x31a633['Phone'],'endUserType':_0x31a633[_0x424f('0x39')]['type']['toLowerCase']()});}}})[_0x424f('0x21')](function(_0x57ebce){if(_0x57ebce){logger[_0x424f('0x27')](_0x424f('0x3a'),_0x57ebce[_0x424f('0x12')],_0x3b3502);return BPromise[_0x424f('0x29')](_0x57ebce);}else{logger['info'](_0x424f('0x3b'),_0x3b3502);var _0x21b3db={'Phone':_0x3b3502};if(_0xc848f1[_0x424f('0x3c')]){if(_0xc848f1[_0x424f('0x3c')]==='contact'){logger['info'](_0x424f('0x3d'),_0x3b3502,_0xc848f1[_0x424f('0x3c')]);_0x21b3db[_0x424f('0x3e')]=_0x4729c3!==_0x424f('0x3f')?_0x4729c3:util[_0x424f('0x40')]('Caller\x20-\x20%s',_0x3b3502);}else if(_0xc848f1['moduleCreate']===_0x424f('0x1a')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3b3502,_0xc848f1[_0x424f('0x3c')]);_0x21b3db['LastName']=_0x4729c3!==_0x424f('0x3f')?_0x4729c3:util[_0x424f('0x40')](_0x424f('0x41'),_0x3b3502);_0x21b3db['Company']='No\x20Company';}else if(_0xc848f1['moduleCreate']===_0x424f('0x14')){logger[_0x424f('0x27')](_0x424f('0x3d'),_0x3b3502,_0xc848f1[_0x424f('0x3c')]);_0x21b3db['Name']=_0x4729c3!==''?_0x4729c3:util[_0x424f('0x40')]('Caller\x20-\x20%s',_0x3b3502);}else{return null;}}return _0x109917['sobject'](_[_0x424f('0x42')](_0xc848f1[_0x424f('0x3c')]))[_0x424f('0x43')](_0x21b3db)['then'](function(_0x432524){return BPromise[_0x424f('0x29')]({'id':_0x432524['id'],'endUserType':_0xc848f1[_0x424f('0x3c')]});});}});}function getCustomFields(_0x54b576,_0x1ae718){var _0x348a1e={};if(_0x54b576[_0x424f('0x22')]>0x0){_['forEach'](_0x54b576,function(_0x3d52a5){if(_[_0x424f('0x44')]([_0x424f('0x45'),'picklist'],_0x3d52a5[_0x424f('0x46')])&&_0x3d52a5[_0x424f('0x47')]){_0x348a1e[_0x3d52a5[_0x424f('0x47')]]=_0x3d52a5[_0x424f('0x48')][_0x424f('0x49')]();}else if(_0x3d52a5[_0x424f('0x46')]===_0x424f('0x4a')&&_0x3d52a5[_0x424f('0x4b')]&&_0x3d52a5[_0x424f('0x47')]){_0x1ae718[_0x3d52a5[_0x424f('0x4b')]]&&(_0x348a1e[_0x3d52a5[_0x424f('0x47')]]=_0x1ae718[_0x3d52a5[_0x424f('0x4b')]][_0x424f('0x49')]());}else if(_0x3d52a5['type']==='customVariable'&&_0x3d52a5[_0x424f('0x4c')]&&_0x3d52a5[_0x424f('0x4c')][_0x424f('0x4d')]&&_0x3d52a5['idField']){_0x1ae718[_0x3d52a5['Variable'][_0x424f('0x4d')][_0x424f('0x4e')]()]&&(_0x348a1e[_0x3d52a5[_0x424f('0x47')]]=_0x1ae718[_0x3d52a5[_0x424f('0x4c')][_0x424f('0x4d')][_0x424f('0x4e')]()]['toString']());}});}return _0x348a1e;}function getConnection(_0x34cfcf){var _0x17cf25=_0x34cfcf[_0x424f('0x4f')][_0x424f('0x50')](_0x34cfcf[_0x424f('0x51')]);var _0x2464d1=new jsforce[(_0x424f('0x52'))]({'oauth2':{'loginUrl':_0x34cfcf[_0x424f('0x53')]||_0x424f('0x54'),'clientId':_0x34cfcf[_0x424f('0x55')],'clientSecret':_0x34cfcf['clientSecret']}});return _0x2464d1[_0x424f('0x56')](_0x34cfcf['username'],_0x17cf25)['then'](function(){logger[_0x424f('0x27')](_0x424f('0x57'));return _0x2464d1;});}exports['queue']=function(_0x5aa588,_0x2b6c45,_0x5c0dd7,_0x1d0f53,_0x2599a3,_0x1fec44){var _0x5c1da1,_0x11fab0,_0x57fe75,_0x427676;_0x1fec44['serverUrl']=intUtil[_0x424f('0x58')](_0x1fec44[_0x424f('0x59')]);_0x1fec44[_0x424f('0x53')]=intUtil[_0x424f('0x58')](_0x1fec44['remoteUri']);if(_0x2599a3&&_0x2599a3[_0x424f('0x5a')]){logger[_0x424f('0x27')](_0x424f('0x5b'),_0x424f('0x5c'));_0x2b6c45[_0x424f('0x5d')]=util[_0x424f('0x40')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1fec44[_0x424f('0x59')],_0x2b6c45['uniqueid'],md5(_0x2b6c45[_0x424f('0x5e')]));}else{_0x2b6c45[_0x424f('0x5d')]='';}return getConnection(_0x1fec44)[_0x424f('0x21')](function(_0x285f8f){_0x427676=_0x285f8f;return getUser(_0x1fec44,_0x1d0f53[_0x424f('0x5f')],_0x427676);})['then'](function(_0xfd44c3){_0x5c1da1=_0xfd44c3;return getEndUser(_0x1fec44,_0x5c0dd7,_0x2b6c45['calleridname'],_0x2b6c45['calleridnum'],_0x427676);})[_0x424f('0x21')](function(_0x2ddc22){_0x11fab0=_0x2ddc22;return getTicket(_0x1fec44,_0x5c1da1,_0x11fab0,_0x5c0dd7,_0x2b6c45,_0x5c0dd7['Fields'],_0x427676,'queue');})[_0x424f('0x21')](function(_0x3459f3){_0x57fe75=_0x3459f3;logger[_0x424f('0x27')](_0x424f('0x60'),_0x57fe75['id']);logger[_0x424f('0x27')](_0x424f('0x61'),_0x57fe75['id'],_0x1d0f53[_0x424f('0x4d')],_0x1fec44[_0x424f('0x46')]);switch(_0x1fec44[_0x424f('0x46')]){case _0x424f('0x62'):emit(util['format']('user:%s',_0x1d0f53[_0x424f('0x4d')]),_0x424f('0x63'),{'recordId':_0x57fe75['id']});break;case _0x424f('0x64'):emit(util[_0x424f('0x40')](_0x424f('0x65'),_0x1d0f53[_0x424f('0x4d')]),_0x424f('0x66'),{'uri':util[_0x424f('0x40')](_0x424f('0x67'),_0x427676['instanceUrl'],_0x57fe75['id'])});break;default:logger[_0x424f('0x68')](_0x424f('0x69'));}})[_0x424f('0x6a')](function(_0x5aa621){logger[_0x424f('0x68')]('[QUEUE]',_0x5aa621);});};exports[_0x424f('0x6b')]=function(_0x5dbe43,_0x14a210,_0x294565,_0x5c86a8,_0x2ab284,_0xb058fb,_0x2c2c8c){var _0x1bc79c,_0x5b8055,_0x5f26f6,_0x304e77;_0xb058fb[_0x424f('0x59')]=intUtil[_0x424f('0x58')](_0xb058fb[_0x424f('0x59')]);_0xb058fb[_0x424f('0x53')]=intUtil[_0x424f('0x58')](_0xb058fb[_0x424f('0x53')]);if(_0x2c2c8c&&_0x2c2c8c[_0x424f('0x6c')]&&_0x2c2c8c[_0x424f('0x6c')]!==_0x424f('0x6d')){logger[_0x424f('0x27')](_0x424f('0x6e'),_0x424f('0x5c'));_0x14a210['recordingURL']=util[_0x424f('0x40')](_0x424f('0x6f'),_0xb058fb[_0x424f('0x59')],_0x14a210[_0x424f('0x5e')],md5(_0x14a210[_0x424f('0x5e')]));}return getConnection(_0xb058fb)[_0x424f('0x21')](function(_0x2456bf){_0x304e77=_0x2456bf;return getUser(_0xb058fb,_0x5c86a8[_0x424f('0x5f')],_0x304e77);})[_0x424f('0x21')](function(_0x4e5861){_0x1bc79c=_0x4e5861;return getEndUser(_0xb058fb,_0x294565,_0x14a210[_0x424f('0x70')],_0x14a210[_0x424f('0x71')],_0x304e77);})['then'](function(_0x355d6e){_0x5b8055=_0x355d6e;return getTicket(_0xb058fb,_0x1bc79c,_0x5b8055,_0x294565,_0x14a210,_0x294565[_0x424f('0x72')],_0x304e77,_0x424f('0x6b'));})[_0x424f('0x21')](function(_0x5de2d6){_0x5f26f6=_0x5de2d6;logger[_0x424f('0x27')](_0x424f('0x73'),_0x5f26f6['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x5f26f6['id'],_0x5c86a8[_0x424f('0x4d')],_0xb058fb[_0x424f('0x46')]);switch(_0xb058fb[_0x424f('0x46')]){case'integrationTab':emit(util[_0x424f('0x40')](_0x424f('0x65'),_0x5c86a8[_0x424f('0x4d')]),_0x424f('0x63'),{'recordId':_0x5f26f6['id']});break;case'newTab':emit(util[_0x424f('0x40')](_0x424f('0x65'),_0x5c86a8[_0x424f('0x4d')]),_0x424f('0x66'),{'uri':util[_0x424f('0x40')](_0x424f('0x67'),_0x304e77[_0x424f('0x74')],_0x5f26f6['id'])});break;default:logger[_0x424f('0x68')](_0x424f('0x6e'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x179638){logger['error'](_0x424f('0x6e'),_0x179638);});};exports[_0x424f('0x75')]=function(_0x1ca3dc,_0x34c337,_0x30080a,_0x52e282,_0xb314f5,_0x58ee4f){var _0xf8c75e,_0x3f7a57,_0x50fa0c,_0x367ca4;_0x58ee4f[_0x424f('0x59')]=intUtil['stripTrailingSlash'](_0x58ee4f[_0x424f('0x59')]);_0x58ee4f[_0x424f('0x53')]=intUtil[_0x424f('0x58')](_0x58ee4f['remoteUri']);if(_0xb314f5&&_0xb314f5[_0x424f('0x5a')]){logger['info']('['+_0x34c337[_0x424f('0x76')]['toUpperCase']()+']',_0x424f('0x5c'));_0x34c337[_0x424f('0x5d')]=util['format'](_0x424f('0x6f'),_0x58ee4f['serverUrl'],_0x34c337[_0x424f('0x5e')],md5(_0x34c337[_0x424f('0x5e')]));}else{_0x34c337[_0x424f('0x5d')]='';}return getConnection(_0x58ee4f)[_0x424f('0x21')](function(_0x2a465a){_0x367ca4=_0x2a465a;if(!_[_0x424f('0x1e')](_0x52e282)){return getUser(_0x58ee4f,_0x52e282[_0x424f('0x4d')],_0x367ca4);}else{return getUser(_0x58ee4f,null,_0x367ca4);}})[_0x424f('0x21')](function(_0x2605cd){_0xf8c75e=_0x2605cd;return getEndUser(_0x58ee4f,_0x30080a,_0x34c337[_0x424f('0x77')],_0x34c337[_0x424f('0x78')],_0x367ca4);})[_0x424f('0x21')](function(_0x157ffc){_0x3f7a57=_0x157ffc;return getTicket(_0x58ee4f,_0xf8c75e,_0x3f7a57,_0x30080a,_0x34c337,_0x30080a[_0x424f('0x72')],_0x367ca4);})['then'](function(_0x208de7){_0x50fa0c=_0x208de7;logger['info']('['+_0x34c337['lastevent'][_0x424f('0x79')]()+']\x20Ticket\x20%s\x20created.',_0x50fa0c['id']);logger[_0x424f('0x27')]('['+_0x34c337[_0x424f('0x76')][_0x424f('0x79')]()+']\x20Integration\x20account\x20type\x20%s.',_0x58ee4f['type']);})[_0x424f('0x6a')](function(_0x36753e){logger['error']('['+_0x34c337[_0x424f('0x76')]['toUpperCase']()+']',_0x36753e);});}; \ No newline at end of file +var _0x8bd8=['Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','lead','Company','No\x20Company','forEach','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','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','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','[QUEUE]','outbound','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','monitor_format','lastevent','calleridname',']\x20Ticket\x20%s\x20created.','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','util','ioredis','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','getString','Task','ActivityDate','utc','IsReminderSet','endUserType','WhoId','account','WhatId','Case','contact','ContactId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','ticketType','create','validateEmail','find','execute','then','length','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','additionalSearchLead','Lead','additionalSearchAccount','Account','Contact','first'];(function(_0x52648a,_0x937cd9){var _0x124728=function(_0x59a13e){while(--_0x59a13e){_0x52648a['push'](_0x52648a['shift']());}};_0x124728(++_0x937cd9);}(_0x8bd8,0x1c5));var _0x88bd=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x8bd8[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x88bd('0x0'));var rp=require(_0x88bd('0x1'));var moment=require(_0x88bd('0x2'));var BPromise=require('bluebird');var md5=require(_0x88bd('0x3'));var jsforce=require(_0x88bd('0x4'));var util=require(_0x88bd('0x5'));var Redis=require(_0x88bd('0x6'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x88bd('0x7'))(_0x88bd('0x8'));config[_0x88bd('0x9')]=_['defaults'](config['redis'],{'host':_0x88bd('0xa'),'port':0x18eb});var io=require(_0x88bd('0xb'))(new Redis(config[_0x88bd('0x9')]));function emit(_0x3af63a,_0x4a0175,_0x38ed8f){io['to'](_0x3af63a)[_0x88bd('0xc')](_0x4a0175,_0x38ed8f);}function getTicket(_0x1eac19,_0x5b3e65,_0x269fd6,_0x3bbd33,_0x43baca,_0x840c1d,_0x5f1eaa,_0x31c7b6){var _0x5f43d7=Object['assign']({},{'OwnerId':_0x5b3e65['id'],'Subject':intUtil[_0x88bd('0xd')](_0x3bbd33['Subjects'],_0x43baca,'\x20'),'Description':intUtil[_0x88bd('0xd')](_0x3bbd33['Descriptions'],_0x43baca,'\x0a')},getCustomFields(_0x840c1d,_0x43baca));if(_0x269fd6){if(_0x3bbd33['ticketType']===_0x88bd('0xe')){_0x5f43d7[_0x88bd('0xf')]=moment[_0x88bd('0x10')]();_0x5f43d7[_0x88bd('0x11')]=![];_0x5f43d7['IsRecurrence']=![];if(_0x269fd6[_0x88bd('0x12')]==='contact'||_0x269fd6[_0x88bd('0x12')]==='lead'){_0x5f43d7[_0x88bd('0x13')]=_0x269fd6['id'];}else if(_0x269fd6[_0x88bd('0x12')]===_0x88bd('0x14')){_0x5f43d7[_0x88bd('0x15')]=_0x269fd6['id'];}}else if(_0x3bbd33['ticketType']===_0x88bd('0x16')){if(_0x269fd6['endUserType']===_0x88bd('0x17')){_0x5f43d7[_0x88bd('0x18')]=_0x269fd6['id'];}else if(_0x269fd6[_0x88bd('0x12')]===_0x88bd('0x14')){_0x5f43d7['AccountId']=_0x269fd6['id'];}else if(_0x269fd6[_0x88bd('0x12')]==='lead'&&_0x3bbd33[_0x88bd('0x19')]){_0x5f43d7[_0x3bbd33[_0x88bd('0x19')]]=_0x269fd6['id'];}else{logger[_0x88bd('0x1a')](_0x88bd('0x1b'));}}}return _0x5f1eaa[_0x88bd('0x1c')](_0x3bbd33[_0x88bd('0x1d')])[_0x88bd('0x1e')](_0x5f43d7);}function getUser(_0x2175ed,_0x3c146e,_0x12c13a){if(!_['isNil'](_0x3c146e)&&intUtil[_0x88bd('0x1f')](_0x3c146e)){var _0x151800={'Email':_0x3c146e};var _0x1b81a9={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x12c13a[_0x88bd('0x1c')]('User')[_0x88bd('0x20')](_0x151800,_0x1b81a9)[_0x88bd('0x21')]()[_0x88bd('0x22')](function(_0x2f2717){if(_0x2f2717[_0x88bd('0x23')]){var _0x57c824=_[_0x88bd('0x20')](_0x2f2717,function(_0x571126){return _0x571126['Email']===_0x3c146e;});if(_0x57c824){logger['info']('Agent\x20%s\x20found.',_0x3c146e);return BPromise[_0x88bd('0x24')]({'id':_0x57c824['Id'],'name':_0x57c824[_0x88bd('0x25')]});}}else{logger[_0x88bd('0x1a')](_0x88bd('0x26'),_0x3c146e);return _0x12c13a[_0x88bd('0x27')]()[_0x88bd('0x22')](function(_0x597bbe){return BPromise[_0x88bd('0x24')]({'id':_0x597bbe['user_id'],'name':_0x597bbe[_0x88bd('0x28')]});});}});}else{logger[_0x88bd('0x1a')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x3c146e);return _0x12c13a[_0x88bd('0x27')]()['then'](function(_0x4799ab){return BPromise[_0x88bd('0x24')]({'id':_0x4799ab[_0x88bd('0x29')],'name':_0x4799ab[_0x88bd('0x28')]});});}}function getEndUser(_0x59172a,_0x1affd2,_0x4056eb,_0x4d1892,_0x3e90fb){var _0x1a7e71={'$or':{'Phone':_0x4d1892}};var _0x1fd154={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x88bd('0x24')]()[_0x88bd('0x22')](function(){logger[_0x88bd('0x1a')](_0x88bd('0x2a'),_0x4d1892,_0x1affd2[_0x88bd('0x2b')]);switch(_0x1affd2[_0x88bd('0x2b')]){case _0x88bd('0x2c'):var _0x248ce9=_[_0x88bd('0x2d')](_0x1a7e71);if(_0x1affd2[_0x88bd('0x2e')]){var _0x54b57c={};_0x54b57c[_0x1affd2[_0x88bd('0x2e')]]=_0x4d1892;_[_0x88bd('0x2f')](_0x248ce9[_0x88bd('0x30')],_0x54b57c);}return _0x3e90fb[_0x88bd('0x1c')]('Contact')[_0x88bd('0x20')](_0x248ce9,_0x1fd154)[_0x88bd('0x21')]()[_0x88bd('0x22')](function(_0x1baa74){if(_0x1baa74&&_0x1baa74[_0x88bd('0x23')]){return _0x1baa74;}else{var _0x4412ad=_['cloneDeep'](_0x1a7e71);if(_0x1affd2[_0x88bd('0x31')]){var _0x5e3cbb={};_0x5e3cbb[_0x1affd2[_0x88bd('0x31')]]=_0x4d1892;_[_0x88bd('0x2f')](_0x4412ad[_0x88bd('0x30')],_0x5e3cbb);}return _0x3e90fb[_0x88bd('0x1c')](_0x88bd('0x32'))[_0x88bd('0x20')](_0x4412ad,_0x1fd154);}});case'account_contact_lead':var _0x534ec0=_[_0x88bd('0x2d')](_0x1a7e71);if(_0x1affd2[_0x88bd('0x33')]){var _0x54b57c={};_0x54b57c[_0x1affd2[_0x88bd('0x33')]]=_0x4d1892;_[_0x88bd('0x2f')](_0x534ec0[_0x88bd('0x30')],_0x54b57c);}return _0x3e90fb['sobject'](_0x88bd('0x34'))[_0x88bd('0x20')](_0x534ec0,_0x1fd154)[_0x88bd('0x21')]()['then'](function(_0x2c3a9c){if(_0x2c3a9c&&_0x2c3a9c['length']){return _0x2c3a9c;}else{var _0xfb7c4e=_[_0x88bd('0x2d')](_0x1a7e71);if(_0x1affd2[_0x88bd('0x2e')]){var _0x287a50={};_0x287a50[_0x1affd2['additionalSearchContact']]=_0x4d1892;_['merge'](_0xfb7c4e[_0x88bd('0x30')],_0x287a50);}return _0x3e90fb[_0x88bd('0x1c')](_0x88bd('0x35'))['find'](_0xfb7c4e,_0x1fd154)[_0x88bd('0x22')](function(_0x203643){if(_0x203643&&_0x203643['length']){return _0x203643;}else{var _0x5ac2d0=_[_0x88bd('0x2d')](_0x1a7e71);if(_0x1affd2[_0x88bd('0x31')]){var _0x5d64da={};_0x5d64da[_0x1affd2[_0x88bd('0x31')]]=_0x4d1892;_[_0x88bd('0x2f')](_0x5ac2d0[_0x88bd('0x30')],_0x5d64da);}return _0x3e90fb[_0x88bd('0x1c')](_0x88bd('0x32'))['find'](_0x5ac2d0,_0x1fd154);}});}});case _0x88bd('0x17'):var _0x248ce9=_['cloneDeep'](_0x1a7e71);if(_0x1affd2[_0x88bd('0x2e')]){var _0x54b57c={};_0x54b57c[_0x1affd2[_0x88bd('0x2e')]]=_0x4d1892;_[_0x88bd('0x2f')](_0x248ce9['$or'],_0x54b57c);}return _0x3e90fb[_0x88bd('0x1c')](_0x88bd('0x35'))['find'](_0x248ce9,_0x1fd154)[_0x88bd('0x21')]();case'lead':var _0x497377=_[_0x88bd('0x2d')](_0x1a7e71);if(_0x1affd2[_0x88bd('0x31')]){var _0x54b57c={};_0x54b57c[_0x1affd2[_0x88bd('0x31')]]=_0x4d1892;_[_0x88bd('0x2f')](_0x497377['$or'],_0x54b57c);}return _0x3e90fb[_0x88bd('0x1c')](_0x88bd('0x32'))[_0x88bd('0x20')](_0x497377,_0x1fd154);case _0x88bd('0x14'):var _0x534ec0=_['cloneDeep'](_0x1a7e71);if(_0x1affd2[_0x88bd('0x33')]){var _0x54b57c={};_0x54b57c[_0x1affd2['additionalSearchAccount']]=_0x4d1892;_[_0x88bd('0x2f')](_0x534ec0[_0x88bd('0x30')],_0x54b57c);}return _0x3e90fb[_0x88bd('0x1c')](_0x88bd('0x34'))[_0x88bd('0x20')](_0x534ec0,_0x1fd154);default:return null;}})['then'](function(_0x316a12){if(_0x316a12&&_0x316a12[_0x88bd('0x23')]){var _0x242cb2=_[_0x88bd('0x36')](_0x316a12);if(_0x242cb2){return BPromise[_0x88bd('0x24')]({'id':_0x242cb2['Id'],'name':_0x242cb2[_0x88bd('0x25')],'phone':_0x242cb2[_0x88bd('0x37')],'endUserType':_0x242cb2[_0x88bd('0x38')]['type'][_0x88bd('0x39')]()});}}})[_0x88bd('0x22')](function(_0x5c3d8e){if(_0x5c3d8e){logger['info'](_0x88bd('0x3a'),_0x5c3d8e['endUserType'],_0x4d1892);return BPromise[_0x88bd('0x24')](_0x5c3d8e);}else{logger[_0x88bd('0x1a')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x4d1892);var _0x4cac02={'Phone':_0x4d1892};if(_0x1affd2[_0x88bd('0x3b')]){if(_0x1affd2['moduleCreate']==='contact'){logger[_0x88bd('0x1a')](_0x88bd('0x3c'),_0x4d1892,_0x1affd2[_0x88bd('0x3b')]);_0x4cac02[_0x88bd('0x3d')]=_0x4056eb!==_0x88bd('0x3e')?_0x4056eb:util[_0x88bd('0x3f')](_0x88bd('0x40'),_0x4d1892);}else if(_0x1affd2[_0x88bd('0x3b')]===_0x88bd('0x41')){logger[_0x88bd('0x1a')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x4d1892,_0x1affd2[_0x88bd('0x3b')]);_0x4cac02[_0x88bd('0x3d')]=_0x4056eb!==''?_0x4056eb:util[_0x88bd('0x3f')](_0x88bd('0x40'),_0x4d1892);_0x4cac02[_0x88bd('0x42')]=_0x88bd('0x43');}else if(_0x1affd2['moduleCreate']===_0x88bd('0x14')){logger[_0x88bd('0x1a')](_0x88bd('0x3c'),_0x4d1892,_0x1affd2[_0x88bd('0x3b')]);_0x4cac02[_0x88bd('0x25')]=_0x4056eb!==_0x88bd('0x3e')?_0x4056eb:util[_0x88bd('0x3f')](_0x88bd('0x40'),_0x4d1892);}else{return null;}}return _0x3e90fb[_0x88bd('0x1c')](_['upperFirst'](_0x1affd2['moduleCreate']))[_0x88bd('0x1e')](_0x4cac02)['then'](function(_0xc9c90c){return BPromise[_0x88bd('0x24')]({'id':_0xc9c90c['id'],'endUserType':_0x1affd2[_0x88bd('0x3b')]});});}});}function getCustomFields(_0x26ca2c,_0x26b5ae){var _0x512e0d={};if(_0x26ca2c[_0x88bd('0x23')]>0x0){_[_0x88bd('0x44')](_0x26ca2c,function(_0xf132a8){if(_[_0x88bd('0x45')](['string',_0x88bd('0x46')],_0xf132a8[_0x88bd('0x47')])&&_0xf132a8[_0x88bd('0x48')]){_0x512e0d[_0xf132a8[_0x88bd('0x48')]]=_0xf132a8[_0x88bd('0x49')][_0x88bd('0x4a')]();}else if(_0xf132a8[_0x88bd('0x47')]===_0x88bd('0x4b')&&_0xf132a8[_0x88bd('0x4c')]&&_0xf132a8['idField']){_0x26b5ae[_0xf132a8[_0x88bd('0x4c')]]&&(_0x512e0d[_0xf132a8[_0x88bd('0x48')]]=_0x26b5ae[_0xf132a8[_0x88bd('0x4c')]][_0x88bd('0x4a')]());}else if(_0xf132a8[_0x88bd('0x47')]===_0x88bd('0x4d')&&_0xf132a8[_0x88bd('0x4e')]&&_0xf132a8['Variable']['name']&&_0xf132a8[_0x88bd('0x48')]){_0x26b5ae[_0xf132a8[_0x88bd('0x4e')]['name']['toLowerCase']()]&&(_0x512e0d[_0xf132a8[_0x88bd('0x48')]]=_0x26b5ae[_0xf132a8[_0x88bd('0x4e')][_0x88bd('0x4f')][_0x88bd('0x39')]()][_0x88bd('0x4a')]());}});}return _0x512e0d;}function getConnection(_0x389e8c){var _0xb00b9f=_0x389e8c[_0x88bd('0x50')][_0x88bd('0x51')](_0x389e8c[_0x88bd('0x52')]);var _0x3e2696=new jsforce[(_0x88bd('0x53'))]({'oauth2':{'loginUrl':_0x389e8c[_0x88bd('0x54')]||_0x88bd('0x55'),'clientId':_0x389e8c[_0x88bd('0x56')],'clientSecret':_0x389e8c[_0x88bd('0x57')]}});return _0x3e2696[_0x88bd('0x58')](_0x389e8c['username'],_0xb00b9f)[_0x88bd('0x22')](function(){logger[_0x88bd('0x1a')](_0x88bd('0x59'));return _0x3e2696;});}exports[_0x88bd('0x5a')]=function(_0x4bd6ab,_0x5313ed,_0x37f9c5,_0x435dec,_0x25eaef,_0x7e755){var _0x225cc7,_0x3c5b39,_0x441ae6,_0x29f037;_0x7e755[_0x88bd('0x5b')]=intUtil[_0x88bd('0x5c')](_0x7e755['serverUrl']);_0x7e755[_0x88bd('0x54')]=intUtil[_0x88bd('0x5c')](_0x7e755[_0x88bd('0x54')]);if(_0x25eaef&&_0x25eaef['monitor_format']){logger['info']('[QUEUE]',_0x88bd('0x5d'));_0x5313ed[_0x88bd('0x5e')]=util['format'](_0x88bd('0x5f'),_0x7e755[_0x88bd('0x5b')],_0x5313ed['uniqueid'],md5(_0x5313ed[_0x88bd('0x60')]));}else{_0x5313ed[_0x88bd('0x5e')]='';}return getConnection(_0x7e755)[_0x88bd('0x22')](function(_0x4eebb4){_0x29f037=_0x4eebb4;return getUser(_0x7e755,_0x435dec['email'],_0x29f037);})[_0x88bd('0x22')](function(_0x23ee14){_0x225cc7=_0x23ee14;return getEndUser(_0x7e755,_0x37f9c5,_0x5313ed['calleridname'],_0x5313ed[_0x88bd('0x61')],_0x29f037);})['then'](function(_0x19b663){_0x3c5b39=_0x19b663;return getTicket(_0x7e755,_0x225cc7,_0x3c5b39,_0x37f9c5,_0x5313ed,_0x37f9c5[_0x88bd('0x62')],_0x29f037,_0x88bd('0x5a'));})[_0x88bd('0x22')](function(_0x274a7b){_0x441ae6=_0x274a7b;logger[_0x88bd('0x1a')](_0x88bd('0x63'),_0x441ae6['id']);logger[_0x88bd('0x1a')](_0x88bd('0x64'),_0x441ae6['id'],_0x435dec[_0x88bd('0x4f')],_0x7e755[_0x88bd('0x47')]);switch(_0x7e755['type']){case _0x88bd('0x65'):emit(util[_0x88bd('0x3f')](_0x88bd('0x66'),_0x435dec[_0x88bd('0x4f')]),_0x88bd('0x67'),{'recordId':_0x441ae6['id']});break;case _0x88bd('0x68'):emit(util[_0x88bd('0x3f')]('user:%s',_0x435dec[_0x88bd('0x4f')]),_0x88bd('0x69'),{'uri':util[_0x88bd('0x3f')]('%s/%s/e',_0x29f037[_0x88bd('0x6a')],_0x441ae6['id'])});break;default:logger[_0x88bd('0x6b')](_0x88bd('0x6c'));}})['catch'](function(_0x27dedd){logger[_0x88bd('0x6b')](_0x88bd('0x6d'),_0x27dedd);});};exports[_0x88bd('0x6e')]=function(_0x3586ff,_0x16e692,_0x1cdc94,_0x4aeca2,_0x28e9a2,_0x3f3123,_0x54bb3d){var _0x35985d,_0x29c810,_0x2b6639,_0x3b879a;_0x3f3123['serverUrl']=intUtil['stripTrailingSlash'](_0x3f3123[_0x88bd('0x5b')]);_0x3f3123[_0x88bd('0x54')]=intUtil[_0x88bd('0x5c')](_0x3f3123[_0x88bd('0x54')]);if(_0x54bb3d&&_0x54bb3d['recordingFormat']&&_0x54bb3d['recordingFormat']!==_0x88bd('0x6f')){logger[_0x88bd('0x1a')](_0x88bd('0x70'),_0x88bd('0x5d'));_0x16e692['recordingURL']=util[_0x88bd('0x3f')](_0x88bd('0x5f'),_0x3f3123[_0x88bd('0x5b')],_0x16e692[_0x88bd('0x60')],md5(_0x16e692[_0x88bd('0x60')]));}return getConnection(_0x3f3123)['then'](function(_0x3f179f){_0x3b879a=_0x3f179f;return getUser(_0x3f3123,_0x4aeca2[_0x88bd('0x71')],_0x3b879a);})[_0x88bd('0x22')](function(_0x1eb048){_0x35985d=_0x1eb048;return getEndUser(_0x3f3123,_0x1cdc94,_0x16e692[_0x88bd('0x72')],_0x16e692[_0x88bd('0x73')],_0x3b879a);})[_0x88bd('0x22')](function(_0x20ef3c){_0x29c810=_0x20ef3c;return getTicket(_0x3f3123,_0x35985d,_0x29c810,_0x1cdc94,_0x16e692,_0x1cdc94[_0x88bd('0x62')],_0x3b879a,'outbound');})['then'](function(_0x4835b2){_0x2b6639=_0x4835b2;logger[_0x88bd('0x1a')](_0x88bd('0x74'),_0x2b6639['id']);logger[_0x88bd('0x1a')](_0x88bd('0x75'),_0x2b6639['id'],_0x4aeca2[_0x88bd('0x4f')],_0x3f3123[_0x88bd('0x47')]);switch(_0x3f3123[_0x88bd('0x47')]){case _0x88bd('0x65'):emit(util[_0x88bd('0x3f')](_0x88bd('0x66'),_0x4aeca2[_0x88bd('0x4f')]),'trigger:salesforce:display',{'recordId':_0x2b6639['id']});break;case _0x88bd('0x68'):emit(util['format'](_0x88bd('0x66'),_0x4aeca2[_0x88bd('0x4f')]),_0x88bd('0x69'),{'uri':util['format']('%s/%s/e',_0x3b879a[_0x88bd('0x6a')],_0x2b6639['id'])});break;default:logger[_0x88bd('0x6b')](_0x88bd('0x70'),_0x88bd('0x76'));}})[_0x88bd('0x77')](function(_0x3fc773){logger[_0x88bd('0x6b')](_0x88bd('0x70'),_0x3fc773);});};exports[_0x88bd('0x78')]=function(_0x4c2db0,_0x5c134a,_0xf49f9c,_0xdd37da,_0x46ce16,_0x143bc3){var _0x4617bc,_0x4be1b6,_0x30788c,_0x267379;_0x143bc3[_0x88bd('0x5b')]=intUtil[_0x88bd('0x5c')](_0x143bc3['serverUrl']);_0x143bc3['remoteUri']=intUtil[_0x88bd('0x5c')](_0x143bc3[_0x88bd('0x54')]);if(_0x46ce16&&_0x46ce16[_0x88bd('0x79')]){logger[_0x88bd('0x1a')]('['+_0x5c134a[_0x88bd('0x7a')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x5c134a['recordingURL']=util['format'](_0x88bd('0x5f'),_0x143bc3[_0x88bd('0x5b')],_0x5c134a['uniqueid'],md5(_0x5c134a[_0x88bd('0x60')]));}else{_0x5c134a[_0x88bd('0x5e')]='';}return getConnection(_0x143bc3)[_0x88bd('0x22')](function(_0xa7e3d8){_0x267379=_0xa7e3d8;if(!_['isNil'](_0xdd37da)){return getUser(_0x143bc3,_0xdd37da[_0x88bd('0x4f')],_0x267379);}else{return getUser(_0x143bc3,null,_0x267379);}})[_0x88bd('0x22')](function(_0x34a821){_0x4617bc=_0x34a821;return getEndUser(_0x143bc3,_0xf49f9c,_0x5c134a[_0x88bd('0x7b')],_0x5c134a[_0x88bd('0x61')],_0x267379);})[_0x88bd('0x22')](function(_0x4af1f2){_0x4be1b6=_0x4af1f2;return getTicket(_0x143bc3,_0x4617bc,_0x4be1b6,_0xf49f9c,_0x5c134a,_0xf49f9c[_0x88bd('0x62')],_0x267379);})[_0x88bd('0x22')](function(_0xbddce3){_0x30788c=_0xbddce3;logger['info']('['+_0x5c134a[_0x88bd('0x7a')]['toUpperCase']()+_0x88bd('0x7c'),_0x30788c['id']);logger['info']('['+_0x5c134a[_0x88bd('0x7a')][_0x88bd('0x7d')]()+_0x88bd('0x7e'),_0x143bc3[_0x88bd('0x47')]);})[_0x88bd('0x77')](function(_0x4da7ca){logger['error']('['+_0x5c134a[_0x88bd('0x7a')]['toUpperCase']()+']',_0x4da7ca);});}; \ 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 7489e64..82e122f 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 _0x89e0=['remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','adminEmail','],\x20getUser\x20crm','error','userId','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','includes','string','picklist','customField','toLowerCase','content','type','idField','toString','variable','variableName','customVariable','Variable',']\x20getTicket\x20input\x20crm','outbound','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','POST','label','label_entry','incident','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','name','%26sysparm_record_target%3Dincident','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','username','password','sysparm_display_value=true'];(function(_0x407ef0,_0x3d3015){var _0x305105=function(_0x138ccf){while(--_0x138ccf){_0x407ef0['push'](_0x407ef0['shift']());}};_0x305105(++_0x3d3015);}(_0x89e0,0x157));var _0x089e=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0x89e0[_0x25e109];return _0xc0f7d6;};'use strict';var _=require(_0x089e('0x0'));var Promise=require('bluebird');var rp=require(_0x089e('0x1'));var util=require(_0x089e('0x2'));var md5=require(_0x089e('0x3'));var Redis=require(_0x089e('0x4'));var intUtil=require(_0x089e('0x5'));var config=require(_0x089e('0x6'));var logger=require(_0x089e('0x7'))(_0x089e('0x8'));config[_0x089e('0x9')]=_['defaults'](config['redis'],{'host':_0x089e('0xa'),'port':0x18eb});var io=require(_0x089e('0xb'))(new Redis(config[_0x089e('0x9')]));function getAdminUser(_0x46c10d,_0x1c43c4,_0x42921c,_0x27d5cf,_0x560dfd,_0x298a3e){return new Promise(function(_0x195683,_0x5b498d){var _0x751979={'method':_0x089e('0xc'),'uri':_0x27d5cf+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x560dfd+'&'+_0x298a3e,'auth':_0x1c43c4,'json':!![]};return rp(_0x751979)[_0x089e('0xd')](function(_0x16b093){if(_0x16b093[_0x089e('0xe')][_0x089e('0xf')]>0x0){_0x42921c[_0x089e('0x10')]=_0x16b093['result'][0x0][_0x089e('0x11')];}logger[_0x089e('0x12')]('['+[_0x46c10d[_0x089e('0x13')]()]+_0x089e('0x14'),_0x42921c);_0x195683(_0x42921c);})[_0x089e('0x15')](function(_0x2630ed){logger['error']('['+[_0x46c10d[_0x089e('0x13')]()]+']',_0x2630ed[_0x089e('0x16')]);_0x5b498d(_0x2630ed[_0x089e('0x16')]);});});}function getUser(_0x13411b,_0x3449ff,_0x1d84d3,_0x42e4c3,_0xfc2361){return function(_0xa7e74d){logger[_0x089e('0x12')]('['+[_0x13411b[_0x089e('0x13')]()]+'],\x20getUser\x20input\x20crm',_0xa7e74d);return new Promise(function(_0x430e4d,_0x235c3b){if(intUtil[_0x089e('0x17')](_0xa7e74d[_0x089e('0x18')])){var _0x3926c5={'method':_0x089e('0xc'),'uri':_0x1d84d3+_0x089e('0x19')+_0xa7e74d[_0x089e('0x18')]+'&'+_0x42e4c3+'&'+_0xfc2361,'auth':_0x3449ff,'json':!![]};logger[_0x089e('0x12')]('['+[_0x13411b[_0x089e('0x13')]()]+_0x089e('0x1a'),_0x3926c5);return rp(_0x3926c5)[_0x089e('0xd')](function(_0x27cb30){logger[_0x089e('0x12')]('['+[_0x13411b['toUpperCase']()]+_0x089e('0x1b'),_0x27cb30);if(_0x27cb30['result']['length']>0x0&&String(_0x27cb30[_0x089e('0xe')][0x0][_0x089e('0x1c')])===_0x089e('0x1d')){_0xa7e74d['userId']=_0x27cb30[_0x089e('0xe')][0x0][_0x089e('0x11')];}else{_0xa7e74d['userId']=_0xa7e74d[_0x089e('0x10')];_0xa7e74d[_0x089e('0x18')]=_0xa7e74d[_0x089e('0x1e')];}logger['info']('['+[_0x13411b['toUpperCase']()]+_0x089e('0x1f'),_0xa7e74d);_0x430e4d(_0xa7e74d);})[_0x089e('0x15')](function(_0x4eb568){logger[_0x089e('0x20')]('['+[_0x13411b[_0x089e('0x13')]()]+']',_0x4eb568['message']);_0x235c3b(_0x4eb568[_0x089e('0x16')]);});}else{logger[_0x089e('0x12')]('['+[_0x13411b[_0x089e('0x13')]()]+']\x20using\x20admin\x20profile');_0xa7e74d[_0x089e('0x21')]=_0xa7e74d['adminId'];_0xa7e74d[_0x089e('0x18')]=_0xa7e74d['adminEmail'];_0x430e4d(_0xa7e74d);}});};}function createEndUser(_0xb580b4,_0x5b67be,_0x477746,_0x448fe0,_0x1fa741){logger['info']('['+[_0xb580b4[_0x089e('0x13')]()]+_0x089e('0x22'),_0x477746);return new Promise(function(_0x4b1a8c,_0x753016){var _0x33443f={'method':'POST','uri':_0x448fe0+_0x089e('0x23')+_0x1fa741,'body':{'user_name':_0x477746[_0x089e('0x24')],'roles':_0x089e('0x25'),'first_name':_0x477746[_0x089e('0x24')],'active':_0x089e('0x1d'),'date_format':_0x089e('0x26'),'phone':_0x477746['endUserNumber']},'auth':_0x5b67be,'json':!![]};return rp(_0x33443f)[_0x089e('0xd')](function(_0x9be48e){logger[_0x089e('0x12')]('['+[_0xb580b4[_0x089e('0x13')]()]+_0x089e('0x27'),_0x9be48e[_0x089e('0xe')]);_0x477746[_0x089e('0x28')]=_0x9be48e[_0x089e('0xe')][_0x089e('0x11')];_0x4b1a8c(_0x477746);})[_0x089e('0x15')](function(_0x4ec207){logger[_0x089e('0x20')]('['+[_0xb580b4['toUpperCase']()]+']',_0x4ec207[_0x089e('0x16')]);_0x753016(_0x4ec207['message']);});});}function getEndUser(_0x1f5c05,_0x18a5ee,_0x1537f8,_0xb605a6,_0x34b67d){return function(_0x1f76ce){logger[_0x089e('0x12')]('['+[_0x1f5c05[_0x089e('0x13')]()]+'],\x20getEndUser\x20input\x20crm',_0x1f76ce);return new Promise(function(_0x3bc463,_0x38cee3){var _0x58345f={'method':_0x089e('0xc'),'uri':_0x1537f8+_0x089e('0x29')+_0x1f76ce[_0x089e('0x24')]+'&'+_0xb605a6+'&'+_0x34b67d,'auth':_0x18a5ee,'json':!![]};return rp(_0x58345f)[_0x089e('0xd')](function(_0x2d23bc){if(_0x2d23bc[_0x089e('0xe')][_0x089e('0xf')]>0x0){_0x1f76ce['endUserId']=_0x2d23bc[_0x089e('0xe')][0x0]['sys_id'];logger[_0x089e('0x12')]('['+[_0x1f5c05[_0x089e('0x13')]()]+_0x089e('0x2a'),_0x1f76ce);_0x3bc463(_0x1f76ce);}else{return createEndUser(_0x1f5c05,_0x18a5ee,_0x1f76ce,_0x1537f8,_0xb605a6)[_0x089e('0xd')](function(_0x56fff0){logger[_0x089e('0x12')]('['+[_0x1f5c05[_0x089e('0x13')]()]+'],\x20createEndUser\x20crm',_0x56fff0);_0x3bc463(_0x56fff0);});}})[_0x089e('0x15')](function(_0x533c32){logger['error']('['+[_0x1f5c05['toUpperCase']()]+']',_0x533c32[_0x089e('0x16')]);_0x38cee3(_0x533c32[_0x089e('0x16')]);});});};}function getCustomFields(_0x80c932,_0x199506){var _0x4948d2={};if(_0x80c932['length']>0x0){_[_0x089e('0x2b')](_0x80c932,function(_0x5be446){if(_[_0x089e('0x2c')]([_0x089e('0x2d'),_0x089e('0x2e')],_0x5be446['type'])&&_0x5be446['nameField']&&!_0x5be446[_0x089e('0x2f')]){_0x4948d2[_0x5be446['nameField'][_0x089e('0x30')]()]=_0x5be446[_0x089e('0x31')]['toString']();}else if(_[_0x089e('0x2c')]([_0x089e('0x2d'),_0x089e('0x2e')],_0x5be446[_0x089e('0x32')])&&_0x5be446[_0x089e('0x33')]&&_0x5be446[_0x089e('0x2f')]){_0x4948d2[_0x5be446[_0x089e('0x33')][_0x089e('0x30')]()]=_0x5be446[_0x089e('0x31')][_0x089e('0x34')]();}else if(_0x5be446[_0x089e('0x32')]===_0x089e('0x35')&&_0x5be446[_0x089e('0x36')]&&_0x5be446[_0x089e('0x33')]&&_0x5be446['customField']){_0x4948d2[_0x5be446['idField']['toLowerCase']()]=_0x199506[_0x5be446['variableName']][_0x089e('0x34')]();}else if(_0x5be446[_0x089e('0x32')]===_0x089e('0x37')&&_0x5be446['Variable']&&_0x5be446['Variable']['name']&&_0x5be446[_0x089e('0x33')]&&_0x5be446[_0x089e('0x2f')]){_0x4948d2[_0x5be446['idField']['toLowerCase']()]=_0x199506[_0x5be446[_0x089e('0x38')]['name'][_0x089e('0x30')]()]['toString']();}});}return _0x4948d2;}function getTicket(_0x310c83,_0x363431,_0x5e6f30,_0x3c9d2a,_0x49120e,_0x47a355){return function(_0x30c091){logger['info']('['+[_0x310c83['toUpperCase']()]+_0x089e('0x39'),_0x30c091);return new Promise(function(_0x3061c7,_0x192763){var _0x3b131c=_0x310c83[_0x089e('0x30')]()===_0x089e('0x3a')?_0x30c091[_0x089e('0x21')]:_0x30c091[_0x089e('0x28')];var _0x4d094e={'method':'POST','uri':_0x5e6f30+'incident'+'?'+_0x47a355,'body':Object['assign']({},{'active':_0x089e('0x1d'),'caller_id':_0x3b131c,'assigned_to':_0x30c091['userId'],'short_description':intUtil['getString'](_0x3c9d2a['Subjects'],_0x49120e,'\x20'),'description':intUtil[_0x089e('0x3b')](_0x3c9d2a[_0x089e('0x3c')],_0x49120e,'\x0a')},getCustomFields(_0x3c9d2a[_0x089e('0x3d')],_0x49120e)),'auth':_0x363431,'json':!![]};return rp(_0x4d094e)[_0x089e('0xd')](function(_0x13112e){logger[_0x089e('0x12')]('['+[_0x310c83['toUpperCase']()]+_0x089e('0x3e'),_0x13112e[_0x089e('0xe')]);_0x30c091[_0x089e('0x3f')]=_0x13112e[_0x089e('0xe')][_0x089e('0x11')];_0x30c091[_0x089e('0x40')]=_0x13112e[_0x089e('0xe')]['number'];logger[_0x089e('0x12')]('['+[_0x310c83['toUpperCase']()]+_0x089e('0x41'),_0x30c091);_0x3061c7(_0x30c091);})[_0x089e('0x15')](function(_0x29a332){logger[_0x089e('0x20')]('['+[_0x310c83['toUpperCase']()]+']',_0x29a332['message']);_0x192763(_0x29a332[_0x089e('0x16')]);});});};}function createRemoteTag(_0x1fc1e3,_0x426a2e,_0x1a5940,_0x42e037){return new Promise(function(_0x146a0f,_0x2d50ef){var _0x340c7f={'method':_0x089e('0x42'),'uri':_0x1a5940+_0x089e('0x43')+'?'+_0x42e037,'body':{'short_description':_0x1fc1e3,'global':!![],'active':!![],'name':_0x1fc1e3},'auth':_0x426a2e,'json':!![]};return rp(_0x340c7f)[_0x089e('0xd')](function(_0x81f10){var _0x40f8d2=_0x81f10[_0x089e('0xe')]['sys_id'];_0x146a0f(_0x40f8d2);});});}function getRemoteTag(_0x51679c,_0x327c0e,_0x287703,_0x4ba52d,_0x300f91){return new Promise(function(_0x17de07,_0x29ef09){var _0x2fed37={'method':_0x089e('0xc'),'uri':_0x287703+'label'+'?sysparm_query=name%3D'+_0x51679c+'&'+_0x4ba52d,'auth':_0x327c0e,'json':!![]};return rp(_0x2fed37)['then'](function(_0x51f04e){if(_0x51f04e[_0x089e('0xe')]['length']>0x0){var _0x3f2088=_0x51f04e[_0x089e('0xe')][0x0][_0x089e('0x11')];_0x17de07(_0x3f2088);}else{return createRemoteTag(_0x51679c,_0x327c0e,_0x287703,_0x4ba52d)[_0x089e('0xd')](function(_0x2ba189){_0x17de07(_0x2ba189);});}});});}function assignTagToIncident(_0x390d33,_0x5e941d,_0x29c9a2,_0x55cd66,_0x769732){return new Promise(function(_0x2ebf77,_0x335498){var _0x12fe8d={'method':_0x089e('0x42'),'uri':_0x29c9a2+_0x089e('0x44')+'?'+_0x769732,'body':{'label':_0x390d33,'table':_0x089e('0x45'),'id_type':_0x089e('0x46'),'table_key':_0x55cd66['ticketId'],'title':_0x089e('0x47')+_0x55cd66[_0x089e('0x40')],'id_display':_0x55cd66[_0x089e('0x40')]},'auth':_0x5e941d,'json':!![]};return rp(_0x12fe8d)[_0x089e('0xd')](function(_0x6bbc4){_0x2ebf77();})[_0x089e('0x15')](function(){_0x2ebf77();});});}function manageTags(_0x507154,_0x5a7adb,_0x1e83e1,_0x2c98c3,_0x156fbb,_0x182c63,_0x87f3d7){return new Promise(function(_0x3c6788,_0x16eb9a){var _0x12b3e8=[];_0x5a7adb[_0x089e('0x2b')](function(_0x4f20f5){_0x12b3e8[_0x089e('0x48')](getRemoteTag(_0x4f20f5,_0x1e83e1,_0x2c98c3,_0x182c63,_0x87f3d7));});return Promise[_0x089e('0x49')](_0x12b3e8)[_0x089e('0xd')](function(_0x56a6c1){if(_0x56a6c1[_0x089e('0xf')]){logger['info']('['+[_0x507154['toUpperCase']()]+_0x089e('0x4a'),_0x56a6c1);var _0x5840aa=[];_0x56a6c1['forEach'](function(_0x5787db){_0x5840aa[_0x089e('0x48')](assignTagToIncident(_0x5787db,_0x1e83e1,_0x2c98c3,_0x156fbb,_0x182c63));});return Promise[_0x089e('0x49')](_0x5840aa)[_0x089e('0xd')](function(){_0x3c6788();})[_0x089e('0x15')](function(){_0x3c6788();});}else{_0x3c6788();}});});}function getTags(_0x1f069b,_0x333b1a,_0x29f7f2,_0x534597,_0x4e0e56,_0x421742){return function(_0x1fe970){return new Promise(function(_0x4fa696,_0x149cb9){var _0x428a2d=[];var _0x4a98ee=_0x534597['Tags'];if(_0x4a98ee&&_0x4a98ee[_0x089e('0xf')]>0x0){_0x428a2d=_[_0x089e('0x4b')](_0x4a98ee,_0x089e('0x4c'));}if(_0x428a2d[_0x089e('0xf')]>0x0){return manageTags(_0x1f069b,_0x428a2d,_0x333b1a,_0x29f7f2,_0x1fe970,_0x4e0e56,_0x421742)[_0x089e('0xd')](function(){_0x4fa696(_0x1fe970);});}else{_0x4fa696(_0x1fe970);}});};}function emit(_0x1f1754,_0xa8d62b,_0x1f7822){var _0x3c7ef7=_0x089e('0x4d')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+'%255EORDERBYDESCnumber';var _0x59e0f6={'uri':_0x1f1754+_0x089e('0x4e')+_0x1f7822+_0x3c7ef7};io['to'](util[_0x089e('0x4f')]('user:%s',_0xa8d62b))[_0x089e('0x50')](_0x089e('0x51'),_0x59e0f6);}exports['cs']=function(_0x2f5c83,_0x580d9c,_0x48c24b,_0x45073a,_0x3e6f77,_0x206cb9,_0x3d1c7e,_0x30c591){var _0x5cd39d={};var _0x358a1a={'user':_0x206cb9[_0x089e('0x52')],'pass':_0x206cb9[_0x089e('0x53')]};var _0x7080b1='sysparm_limit=1';var _0x2571f9=_0x089e('0x54');_0x206cb9[_0x089e('0x55')]=intUtil[_0x089e('0x56')](_0x206cb9[_0x089e('0x55')]);_0x206cb9[_0x089e('0x57')]=intUtil[_0x089e('0x56')](_0x206cb9['serverUrl']);var _0x5ba91b=util[_0x089e('0x4f')](_0x089e('0x58'),_0x206cb9[_0x089e('0x55')]);_0x5cd39d[_0x089e('0x18')]=!_[_0x089e('0x59')](_0x45073a)?_0x45073a[_0x089e('0x5a')]:null;_0x5cd39d[_0x089e('0x1e')]=_0x206cb9[_0x089e('0x5a')];_0x5cd39d[_0x089e('0x24')]=_0x30c591[_0x089e('0x30')]()==='outbound'?_0x580d9c['destcalleridnum']:_0x580d9c[_0x089e('0x5b')];_0x5cd39d[_0x089e('0x5c')]=_0x30c591===_0x089e('0x5d')||_0x30c591===_0x089e('0x5e')?_0x089e('0x5d'):_0x089e('0x3a');var _0x2e9373=util[_0x089e('0x4f')](_0x089e('0x5f'),_0x206cb9[_0x089e('0x57')],_0x580d9c[_0x089e('0x60')],md5(_0x580d9c[_0x089e('0x60')]));if(_0x3e6f77&&_0x3e6f77['monitor_format']){logger[_0x089e('0x12')](_0x089e('0x61'),_0x089e('0x62'));_0x580d9c[_0x089e('0x63')]=_0x2e9373;}else if(_0x3d1c7e&&_0x3d1c7e[_0x089e('0x64')]&&_0x3d1c7e['recordingFormat']!==_0x089e('0x65')){logger[_0x089e('0x12')](_0x089e('0x66'),'Recording\x20is\x20enabled!');_0x580d9c['recordingURL']=_0x2e9373;}else{_0x580d9c[_0x089e('0x63')]='';}return getAdminUser(_0x30c591,_0x358a1a,_0x5cd39d,_0x5ba91b,_0x2571f9,_0x7080b1)[_0x089e('0xd')](getUser(_0x30c591,_0x358a1a,_0x5ba91b,_0x2571f9,_0x7080b1))[_0x089e('0xd')](getEndUser(_0x30c591,_0x358a1a,_0x5ba91b,_0x2571f9,_0x7080b1))['then'](getTicket(_0x30c591,_0x358a1a,_0x5ba91b,_0x48c24b,_0x580d9c,_0x2571f9))[_0x089e('0xd')](function(_0xad219d){logger[_0x089e('0x12')](util[_0x089e('0x4f')]('The\x20ticket\x20ID\x20is:\x20%s',_0xad219d['ticketId']));logger[_0x089e('0x12')](util[_0x089e('0x4f')](_0x089e('0x67'),_0x30c591));if(_0x30c591!==_0x089e('0x5e')){logger[_0x089e('0x12')]('['+[_0x30c591['toUpperCase']()]+']',_0x089e('0x68'));emit(_0x206cb9[_0x089e('0x55')],_0x45073a[_0x089e('0x4c')],_0xad219d[_0x089e('0x3f')]);}})[_0x089e('0x15')](function(_0x47840a){logger[_0x089e('0x20')]('['+[_0x30c591['toUpperCase']()]+_0x089e('0x69'),util[_0x089e('0x6a')](_0x47840a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x37c3=['],\x20getUser\x20rp\x20obj','true','userId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes','picklist','type','nameField','customField','toString','string','idField','toLowerCase','content','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','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','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D'];(function(_0x4c2c72,_0x295857){var _0x13e980=function(_0x143c39){while(--_0x143c39){_0x4c2c72['push'](_0x4c2c72['shift']());}};_0x13e980(++_0x295857);}(_0x37c3,0x192));var _0x337c=function(_0x45066c,_0x106747){_0x45066c=_0x45066c-0x0;var _0x4ef8a2=_0x37c3[_0x45066c];return _0x4ef8a2;};'use strict';var _=require(_0x337c('0x0'));var Promise=require(_0x337c('0x1'));var rp=require(_0x337c('0x2'));var util=require(_0x337c('0x3'));var md5=require(_0x337c('0x4'));var Redis=require(_0x337c('0x5'));var intUtil=require(_0x337c('0x6'));var config=require(_0x337c('0x7'));var logger=require('../../../../config/logger')(_0x337c('0x8'));config[_0x337c('0x9')]=_[_0x337c('0xa')](config[_0x337c('0x9')],{'host':_0x337c('0xb'),'port':0x18eb});var io=require(_0x337c('0xc'))(new Redis(config['redis']));function getAdminUser(_0x5debce,_0x1c894f,_0x2a9c3f,_0x21fde1,_0x477a86,_0x276e5f){return new Promise(function(_0x450160,_0x49a1c2){var _0x9ba752={'method':'GET','uri':_0x21fde1+_0x337c('0xd')+'&'+_0x477a86+'&'+_0x276e5f,'auth':_0x1c894f,'json':!![]};return rp(_0x9ba752)[_0x337c('0xe')](function(_0x3db253){if(_0x3db253[_0x337c('0xf')][_0x337c('0x10')]>0x0){_0x2a9c3f[_0x337c('0x11')]=_0x3db253['result'][0x0][_0x337c('0x12')];}logger[_0x337c('0x13')]('['+[_0x5debce[_0x337c('0x14')]()]+_0x337c('0x15'),_0x2a9c3f);_0x450160(_0x2a9c3f);})[_0x337c('0x16')](function(_0x7707b3){logger[_0x337c('0x17')]('['+[_0x5debce[_0x337c('0x14')]()]+']',_0x7707b3[_0x337c('0x18')]);_0x49a1c2(_0x7707b3[_0x337c('0x18')]);});});}function getUser(_0x527a3f,_0x342aae,_0x1defd5,_0x1a55de,_0x40c8ba){return function(_0x3af173){logger[_0x337c('0x13')]('['+[_0x527a3f[_0x337c('0x14')]()]+_0x337c('0x19'),_0x3af173);return new Promise(function(_0x47d27d,_0xf2209){if(intUtil[_0x337c('0x1a')](_0x3af173[_0x337c('0x1b')])){var _0x5ca5ea={'method':_0x337c('0x1c'),'uri':_0x1defd5+_0x337c('0x1d')+_0x3af173[_0x337c('0x1b')]+'&'+_0x1a55de+'&'+_0x40c8ba,'auth':_0x342aae,'json':!![]};logger['info']('['+[_0x527a3f[_0x337c('0x14')]()]+_0x337c('0x1e'),_0x5ca5ea);return rp(_0x5ca5ea)[_0x337c('0xe')](function(_0x4068a0){logger[_0x337c('0x13')]('['+[_0x527a3f[_0x337c('0x14')]()]+'],\x20getUser\x20entity',_0x4068a0);if(_0x4068a0[_0x337c('0xf')][_0x337c('0x10')]>0x0&&String(_0x4068a0[_0x337c('0xf')][0x0]['active'])===_0x337c('0x1f')){_0x3af173[_0x337c('0x20')]=_0x4068a0[_0x337c('0xf')][0x0]['sys_id'];}else{_0x3af173[_0x337c('0x20')]=_0x3af173[_0x337c('0x11')];_0x3af173['userEmail']=_0x3af173[_0x337c('0x21')];}logger[_0x337c('0x13')]('['+[_0x527a3f['toUpperCase']()]+'],\x20getUser\x20crm',_0x3af173);_0x47d27d(_0x3af173);})['catch'](function(_0xe66eb4){logger[_0x337c('0x17')]('['+[_0x527a3f[_0x337c('0x14')]()]+']',_0xe66eb4[_0x337c('0x18')]);_0xf2209(_0xe66eb4['message']);});}else{logger['info']('['+[_0x527a3f[_0x337c('0x14')]()]+_0x337c('0x22'));_0x3af173[_0x337c('0x20')]=_0x3af173[_0x337c('0x11')];_0x3af173[_0x337c('0x1b')]=_0x3af173[_0x337c('0x21')];_0x47d27d(_0x3af173);}});};}function createEndUser(_0x3f1bf8,_0x1dc860,_0x5f571c,_0xacf4f0,_0x42fd35){logger[_0x337c('0x13')]('['+[_0x3f1bf8['toUpperCase']()]+_0x337c('0x23'),_0x5f571c);return new Promise(function(_0x9f5f3c,_0x404b18){var _0x55fc3e={'method':_0x337c('0x24'),'uri':_0xacf4f0+_0x337c('0x25')+_0x42fd35,'body':{'user_name':_0x5f571c[_0x337c('0x26')],'roles':_0x337c('0x27'),'first_name':_0x5f571c[_0x337c('0x26')],'active':_0x337c('0x1f'),'date_format':_0x337c('0x28'),'phone':_0x5f571c['endUserNumber']},'auth':_0x1dc860,'json':!![]};return rp(_0x55fc3e)[_0x337c('0xe')](function(_0x40e925){logger[_0x337c('0x13')]('['+[_0x3f1bf8[_0x337c('0x14')]()]+_0x337c('0x29'),_0x40e925[_0x337c('0xf')]);_0x5f571c[_0x337c('0x2a')]=_0x40e925[_0x337c('0xf')][_0x337c('0x12')];_0x9f5f3c(_0x5f571c);})[_0x337c('0x16')](function(_0x246e8b){logger[_0x337c('0x17')]('['+[_0x3f1bf8['toUpperCase']()]+']',_0x246e8b[_0x337c('0x18')]);_0x404b18(_0x246e8b['message']);});});}function getEndUser(_0x4a3d9d,_0x5c56d1,_0x4e865d,_0x1dc3cc,_0x32ae11){return function(_0x44a061){logger['info']('['+[_0x4a3d9d[_0x337c('0x14')]()]+_0x337c('0x2b'),_0x44a061);return new Promise(function(_0x3dd067,_0x193922){var _0x3834d7={'method':_0x337c('0x1c'),'uri':_0x4e865d+_0x337c('0x2c')+_0x44a061['endUserNumber']+'&'+_0x1dc3cc+'&'+_0x32ae11,'auth':_0x5c56d1,'json':!![]};return rp(_0x3834d7)['then'](function(_0x103f6c){if(_0x103f6c[_0x337c('0xf')][_0x337c('0x10')]>0x0){_0x44a061[_0x337c('0x2a')]=_0x103f6c['result'][0x0][_0x337c('0x12')];logger[_0x337c('0x13')]('['+[_0x4a3d9d[_0x337c('0x14')]()]+'],\x20getEndUser\x20crm',_0x44a061);_0x3dd067(_0x44a061);}else{return createEndUser(_0x4a3d9d,_0x5c56d1,_0x44a061,_0x4e865d,_0x1dc3cc)[_0x337c('0xe')](function(_0x1c7fc4){logger[_0x337c('0x13')]('['+[_0x4a3d9d[_0x337c('0x14')]()]+_0x337c('0x2d'),_0x1c7fc4);_0x3dd067(_0x1c7fc4);});}})[_0x337c('0x16')](function(_0x5f586f){logger[_0x337c('0x17')]('['+[_0x4a3d9d[_0x337c('0x14')]()]+']',_0x5f586f[_0x337c('0x18')]);_0x193922(_0x5f586f[_0x337c('0x18')]);});});};}function getCustomFields(_0x4808f6,_0x3c82dd){var _0x2771c6={};if(_0x4808f6[_0x337c('0x10')]>0x0){_[_0x337c('0x2e')](_0x4808f6,function(_0x28c6e7){if(_[_0x337c('0x2f')](['string',_0x337c('0x30')],_0x28c6e7[_0x337c('0x31')])&&_0x28c6e7[_0x337c('0x32')]&&!_0x28c6e7[_0x337c('0x33')]){_0x2771c6[_0x28c6e7[_0x337c('0x32')]['toLowerCase']()]=_0x28c6e7['content'][_0x337c('0x34')]();}else if(_[_0x337c('0x2f')]([_0x337c('0x35'),_0x337c('0x30')],_0x28c6e7[_0x337c('0x31')])&&_0x28c6e7[_0x337c('0x36')]&&_0x28c6e7['customField']){_0x2771c6[_0x28c6e7[_0x337c('0x36')][_0x337c('0x37')]()]=_0x28c6e7[_0x337c('0x38')][_0x337c('0x34')]();}else if(_0x28c6e7[_0x337c('0x31')]===_0x337c('0x39')&&_0x28c6e7[_0x337c('0x3a')]&&_0x28c6e7[_0x337c('0x36')]&&_0x28c6e7[_0x337c('0x33')]){_0x2771c6[_0x28c6e7[_0x337c('0x36')][_0x337c('0x37')]()]=_0x3c82dd[_0x28c6e7[_0x337c('0x3a')]][_0x337c('0x34')]();}else if(_0x28c6e7[_0x337c('0x31')]===_0x337c('0x3b')&&_0x28c6e7[_0x337c('0x3c')]&&_0x28c6e7[_0x337c('0x3c')][_0x337c('0x3d')]&&_0x28c6e7[_0x337c('0x36')]&&_0x28c6e7['customField']){_0x2771c6[_0x28c6e7[_0x337c('0x36')][_0x337c('0x37')]()]=_0x3c82dd[_0x28c6e7[_0x337c('0x3c')][_0x337c('0x3d')][_0x337c('0x37')]()][_0x337c('0x34')]();}});}return _0x2771c6;}function getTicket(_0x57636e,_0x3e6244,_0x403bf7,_0x531e3e,_0x4b845b,_0x4135ef){return function(_0x2461d7){logger[_0x337c('0x13')]('['+[_0x57636e[_0x337c('0x14')]()]+_0x337c('0x3e'),_0x2461d7);return new Promise(function(_0x4deb18,_0x3b92b4){var _0x152059=_0x57636e['toLowerCase']()===_0x337c('0x3f')?_0x2461d7[_0x337c('0x20')]:_0x2461d7[_0x337c('0x2a')];var _0x2e1a84={'method':_0x337c('0x24'),'uri':_0x403bf7+_0x337c('0x40')+'?'+_0x4135ef,'body':Object['assign']({},{'active':_0x337c('0x1f'),'caller_id':_0x152059,'assigned_to':_0x2461d7[_0x337c('0x20')],'short_description':intUtil[_0x337c('0x41')](_0x531e3e[_0x337c('0x42')],_0x4b845b,'\x20'),'description':intUtil[_0x337c('0x41')](_0x531e3e[_0x337c('0x43')],_0x4b845b,'\x0a')},getCustomFields(_0x531e3e[_0x337c('0x44')],_0x4b845b)),'auth':_0x3e6244,'json':!![]};return rp(_0x2e1a84)[_0x337c('0xe')](function(_0x5bbb1b){logger[_0x337c('0x13')]('['+[_0x57636e[_0x337c('0x14')]()]+_0x337c('0x45'),_0x5bbb1b[_0x337c('0xf')]);_0x2461d7[_0x337c('0x46')]=_0x5bbb1b['result'][_0x337c('0x12')];_0x2461d7['ticketNumber']=_0x5bbb1b['result'][_0x337c('0x47')];logger[_0x337c('0x13')]('['+[_0x57636e[_0x337c('0x14')]()]+_0x337c('0x48'),_0x2461d7);_0x4deb18(_0x2461d7);})[_0x337c('0x16')](function(_0x4c1b83){logger['error']('['+[_0x57636e[_0x337c('0x14')]()]+']',_0x4c1b83['message']);_0x3b92b4(_0x4c1b83['message']);});});};}function createRemoteTag(_0x2e47da,_0x4192b5,_0x4f072e,_0x470450){return new Promise(function(_0x5cbf29,_0x1d4ac3){var _0x17c2bf={'method':_0x337c('0x24'),'uri':_0x4f072e+'label'+'?'+_0x470450,'body':{'short_description':_0x2e47da,'global':!![],'active':!![],'name':_0x2e47da},'auth':_0x4192b5,'json':!![]};return rp(_0x17c2bf)[_0x337c('0xe')](function(_0x4169a0){var _0x51bc86=_0x4169a0[_0x337c('0xf')][_0x337c('0x12')];_0x5cbf29(_0x51bc86);});});}function getRemoteTag(_0x1d99a9,_0x41eee7,_0x161053,_0x25a487,_0x51a217){return new Promise(function(_0x341699,_0x54be78){var _0x44b576={'method':_0x337c('0x1c'),'uri':_0x161053+_0x337c('0x49')+_0x337c('0x4a')+_0x1d99a9+'&'+_0x25a487,'auth':_0x41eee7,'json':!![]};return rp(_0x44b576)[_0x337c('0xe')](function(_0x9517dd){if(_0x9517dd[_0x337c('0xf')]['length']>0x0){var _0x11d488=_0x9517dd[_0x337c('0xf')][0x0]['sys_id'];_0x341699(_0x11d488);}else{return createRemoteTag(_0x1d99a9,_0x41eee7,_0x161053,_0x25a487)[_0x337c('0xe')](function(_0x39a226){_0x341699(_0x39a226);});}});});}function assignTagToIncident(_0x432b10,_0x547d06,_0x8fec88,_0x5f2609,_0x189a82){return new Promise(function(_0x51cd5e,_0x2ca38a){var _0x2c4587={'method':_0x337c('0x24'),'uri':_0x8fec88+_0x337c('0x4b')+'?'+_0x189a82,'body':{'label':_0x432b10,'table':_0x337c('0x40'),'id_type':_0x337c('0x4c'),'table_key':_0x5f2609[_0x337c('0x46')],'title':_0x337c('0x4d')+_0x5f2609[_0x337c('0x4e')],'id_display':_0x5f2609[_0x337c('0x4e')]},'auth':_0x547d06,'json':!![]};return rp(_0x2c4587)[_0x337c('0xe')](function(_0x2af890){_0x51cd5e();})[_0x337c('0x16')](function(){_0x51cd5e();});});}function manageTags(_0xf54edd,_0x3433dc,_0x5abf05,_0x3a2e8c,_0xe9c763,_0xe66f5b,_0x37a302){return new Promise(function(_0x2c0392,_0x158fef){var _0x6f5f49=[];_0x3433dc[_0x337c('0x2e')](function(_0x3fd675){_0x6f5f49[_0x337c('0x4f')](getRemoteTag(_0x3fd675,_0x5abf05,_0x3a2e8c,_0xe66f5b,_0x37a302));});return Promise[_0x337c('0x50')](_0x6f5f49)['then'](function(_0x174e2c){if(_0x174e2c['length']){logger[_0x337c('0x13')]('['+[_0xf54edd[_0x337c('0x14')]()]+_0x337c('0x51'),_0x174e2c);var _0x262f45=[];_0x174e2c['forEach'](function(_0x58db0f){_0x262f45[_0x337c('0x4f')](assignTagToIncident(_0x58db0f,_0x5abf05,_0x3a2e8c,_0xe9c763,_0xe66f5b));});return Promise[_0x337c('0x50')](_0x262f45)[_0x337c('0xe')](function(){_0x2c0392();})[_0x337c('0x16')](function(){_0x2c0392();});}else{_0x2c0392();}});});}function getTags(_0x433e59,_0x2079ee,_0x47e03e,_0x35b31c,_0x20260b,_0x8fd7c8){return function(_0x5ea6e8){return new Promise(function(_0x1c8ab4,_0xecab1a){var _0x47f8c8=[];var _0x56e90b=_0x35b31c[_0x337c('0x52')];if(_0x56e90b&&_0x56e90b['length']>0x0){_0x47f8c8=_['map'](_0x56e90b,'name');}if(_0x47f8c8[_0x337c('0x10')]>0x0){return manageTags(_0x433e59,_0x47f8c8,_0x2079ee,_0x47e03e,_0x5ea6e8,_0x20260b,_0x8fd7c8)[_0x337c('0xe')](function(){_0x1c8ab4(_0x5ea6e8);});}else{_0x1c8ab4(_0x5ea6e8);}});};}function emit(_0x25290e,_0x241027,_0x43d97c){var _0x5bea14='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x337c('0x53');var _0x125249={'uri':_0x25290e+_0x337c('0x54')+_0x43d97c+_0x5bea14};io['to'](util[_0x337c('0x55')]('user:%s',_0x241027))['emit']('trigger:browser:url',_0x125249);}exports['cs']=function(_0x4eb653,_0x20dd85,_0x4bd1fd,_0x11ce2d,_0x269363,_0x4c3c1c,_0x50d7e6,_0x25862d){var _0x5c9d95={};var _0x45f3e1={'user':_0x4c3c1c['username'],'pass':_0x4c3c1c[_0x337c('0x56')]};var _0x92df60='sysparm_limit=1';var _0x2f7ee6=_0x337c('0x57');_0x4c3c1c[_0x337c('0x58')]=intUtil[_0x337c('0x59')](_0x4c3c1c[_0x337c('0x58')]);_0x4c3c1c['serverUrl']=intUtil[_0x337c('0x59')](_0x4c3c1c[_0x337c('0x5a')]);var _0x5554a6=util[_0x337c('0x55')](_0x337c('0x5b'),_0x4c3c1c[_0x337c('0x58')]);_0x5c9d95['userEmail']=!_[_0x337c('0x5c')](_0x11ce2d)?_0x11ce2d[_0x337c('0x5d')]:null;_0x5c9d95[_0x337c('0x21')]=_0x4c3c1c[_0x337c('0x5d')];_0x5c9d95[_0x337c('0x26')]=_0x25862d[_0x337c('0x37')]()===_0x337c('0x3f')?_0x20dd85[_0x337c('0x5e')]:_0x20dd85[_0x337c('0x5f')];_0x5c9d95[_0x337c('0x60')]=_0x25862d==='queue'||_0x25862d==='unmanaged'?_0x337c('0x61'):_0x337c('0x3f');var _0x8c15ba=util[_0x337c('0x55')](_0x337c('0x62'),_0x4c3c1c[_0x337c('0x5a')],_0x20dd85['uniqueid'],md5(_0x20dd85['uniqueid']));if(_0x269363&&_0x269363['monitor_format']){logger[_0x337c('0x13')](_0x337c('0x63'),_0x337c('0x64'));_0x20dd85[_0x337c('0x65')]=_0x8c15ba;}else if(_0x50d7e6&&_0x50d7e6[_0x337c('0x66')]&&_0x50d7e6[_0x337c('0x66')]!=='none'){logger[_0x337c('0x13')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x20dd85[_0x337c('0x65')]=_0x8c15ba;}else{_0x20dd85[_0x337c('0x65')]='';}return getAdminUser(_0x25862d,_0x45f3e1,_0x5c9d95,_0x5554a6,_0x2f7ee6,_0x92df60)[_0x337c('0xe')](getUser(_0x25862d,_0x45f3e1,_0x5554a6,_0x2f7ee6,_0x92df60))['then'](getEndUser(_0x25862d,_0x45f3e1,_0x5554a6,_0x2f7ee6,_0x92df60))[_0x337c('0xe')](getTicket(_0x25862d,_0x45f3e1,_0x5554a6,_0x4bd1fd,_0x20dd85,_0x2f7ee6))[_0x337c('0xe')](function(_0x48fd0c){logger[_0x337c('0x13')](util[_0x337c('0x55')](_0x337c('0x67'),_0x48fd0c[_0x337c('0x46')]));logger['info'](util[_0x337c('0x55')]('call\x20direction:\x20%s',_0x25862d));if(_0x25862d!==_0x337c('0x68')){logger[_0x337c('0x13')]('['+[_0x25862d[_0x337c('0x14')]()]+']',_0x337c('0x69'));emit(_0x4c3c1c[_0x337c('0x58')],_0x11ce2d[_0x337c('0x3d')],_0x48fd0c[_0x337c('0x46')]);}})[_0x337c('0x16')](function(_0x551871){logger[_0x337c('0x17')]('['+[_0x25862d[_0x337c('0x14')]()]+_0x337c('0x6a'),util[_0x337c('0x6b')](_0x551871,{'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 c209e37..a9f460a 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 _0xe164=['user:%s','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','Fields','users','catch','error','unmanaged','lastevent','toUpperCase','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','created_by','getString','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','forEach','variableName','push','idField','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','length','Enduser\x20found!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','string','customField','toLowerCase','content','type','custom_fields','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','remoteUri','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','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','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...'];(function(_0x3babd6,_0xc4f067){var _0x5b374c=function(_0x40864f){while(--_0x40864f){_0x3babd6['push'](_0x3babd6['shift']());}};_0x5b374c(++_0xc4f067);}(_0xe164,0x87));var _0x4e16=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xe164[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0x4e16('0x0'));var rp=require('request-promise');var BPromise=require(_0x4e16('0x1'));var md5=require(_0x4e16('0x2'));var util=require(_0x4e16('0x3'));var Redis=require(_0x4e16('0x4'));var intUtil=require(_0x4e16('0x5'));var config=require(_0x4e16('0x6'));var logger=require(_0x4e16('0x7'))(_0x4e16('0x8'));config[_0x4e16('0x9')]=_['defaults'](config['redis'],{'host':_0x4e16('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4e16('0x9')]));var def={'method':_0x4e16('0xb'),'json':!![]};function emit(_0x2df8ef,_0x67f0e6,_0x52b2b2){io['to'](_0x2df8ef)[_0x4e16('0xc')](_0x67f0e6,_0x52b2b2);}function getTicket(_0x1f3847,_0x25fc07,_0x420b83,_0x537ea8,_0x197d15,_0x2e1cc8,_0x1ff871,_0x2e3e29){logger[_0x4e16('0xd')](_0x4e16('0xe'));var _0x3b4f18=new Date();var _0x2c6151=[{'name':_0x4e16('0xf'),'value':intUtil['getString'](_0x537ea8[_0x4e16('0x10')],_0x197d15,'\x20')},{'name':'assigned_user_id','value':_0x25fc07['id']},{'name':_0x4e16('0x11'),'value':_0x25fc07['id']},{'name':'description','value':intUtil[_0x4e16('0x12')](_0x537ea8['Descriptions'],_0x197d15,'\x0a')},{'name':'date_start','value':_0x3b4f18[_0x4e16('0x13')]()[_0x4e16('0x14')](0x0,0x13)[_0x4e16('0x15')]('T','\x20')},{'name':_0x4e16('0x16'),'value':'0'},{'name':_0x4e16('0x17'),'value':'15'},{'name':_0x4e16('0x18'),'value':_0x420b83['id']},{'name':_0x4e16('0x19'),'value':_0x4e16('0x1a')},{'name':_0x4e16('0x1b'),'value':_0x420b83[_0x4e16('0xf')]},{'name':_0x4e16('0x1c'),'value':_0x2e3e29}];if(_0x2e1cc8['length']){_[_0x4e16('0x1d')](_0x2e1cc8,function(_0x44505f){if(_0x197d15[_0x44505f[_0x4e16('0x1e')]]){_0x2c6151[_0x4e16('0x1f')]({'name':_0x44505f[_0x4e16('0x20')],'value':_0x197d15[_0x44505f[_0x4e16('0x1e')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x4e16('0x21'),'response_type':_0x4e16('0x21'),'rest_data':JSON[_0x4e16('0x22')]({'session':_0x1ff871['id'],'module_name':_0x4e16('0x23'),'name_value_list':_0x2c6151})}});}function getAuth(_0x3a4741){return util[_0x4e16('0x24')](_0x4e16('0x25'),new Buffer(_0x3a4741[_0x4e16('0x26')]+':X')[_0x4e16('0x27')]('base64'));}function getServerInfo(_0xda0941){return request({'form':{'method':_0x4e16('0x28'),'input_type':'JSON','response_type':_0x4e16('0x21'),'rest_data':JSON[_0x4e16('0x22')]({'session':_0xda0941['id']})}});}function getUser(_0x51ef19,_0x16296f,_0x130709){if(!_[_0x4e16('0x29')](_0x16296f)){logger[_0x4e16('0xd')](_0x4e16('0x2a'),_0x16296f);return request({'form':{'method':_0x4e16('0x2b'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x4e16('0x22')]({'session':_0x130709['id'],'module_name':_0x4e16('0x2c'),'query':util[_0x4e16('0x24')](_0x4e16('0x2d'),_0x16296f),'order_by':'','offset':'0','select_fields':['id',_0x4e16('0xf'),_0x4e16('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4e16('0x2f')](function(_0x231c0a){if(_0x231c0a['entry_list']['length']){var _0x14fdd5=_[_0x4e16('0x30')](_0x231c0a[_0x4e16('0x31')],function(_0x4d7d76){return _0x4d7d76[_0x4e16('0x32')]['user_name'][_0x4e16('0x33')]===_0x16296f;});if(_0x14fdd5){logger[_0x4e16('0xd')](_0x4e16('0x34'));return BPromise[_0x4e16('0x35')]({'id':_0x14fdd5[_0x4e16('0x32')]['id']['value'],'name':_0x14fdd5[_0x4e16('0x32')][_0x4e16('0xf')][_0x4e16('0x33')]});}}logger[_0x4e16('0xd')](_0x4e16('0x36'));return BPromise[_0x4e16('0x35')]({'id':_0x130709[_0x4e16('0x32')][_0x4e16('0x37')][_0x4e16('0x33')],'name':_0x130709['name_value_list'][_0x4e16('0x2e')][_0x4e16('0x33')]});});}else{logger[_0x4e16('0xd')](_0x4e16('0x38'));return BPromise[_0x4e16('0x35')]({'id':_0x130709['name_value_list'][_0x4e16('0x37')]['value'],'name':_0x130709[_0x4e16('0x32')][_0x4e16('0x2e')][_0x4e16('0x33')]});}}function getEndUser(_0x59d449,_0x1acd6e,_0x20a488,_0x333512){logger[_0x4e16('0xd')](_0x4e16('0x39'),_0x20a488);return request({'form':{'method':_0x4e16('0x2b'),'input_type':_0x4e16('0x21'),'response_type':'JSON','rest_data':JSON[_0x4e16('0x22')]({'session':_0x333512['id'],'module_name':_0x4e16('0x1a'),'query':util[_0x4e16('0x24')](_0x4e16('0x3a'),_0x20a488),'order_by':'','offset':'0','select_fields':['id',_0x4e16('0xf'),_0x4e16('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4e16('0x2f')](function(_0x76c99a){if(_0x76c99a['entry_list'][_0x4e16('0x3c')]){var _0x752259=_[_0x4e16('0x30')](_0x76c99a[_0x4e16('0x31')],function(_0xea129d){return _0xea129d['name_value_list'][_0x4e16('0x3b')][_0x4e16('0x33')]===_0x20a488;});if(_0x752259){logger[_0x4e16('0xd')](_0x4e16('0x3d'));return BPromise[_0x4e16('0x35')]({'id':_0x752259[_0x4e16('0x32')]['id'][_0x4e16('0x33')],'name':_0x752259[_0x4e16('0x32')][_0x4e16('0xf')][_0x4e16('0x33')],'phone':_0x752259[_0x4e16('0x32')][_0x4e16('0x3b')][_0x4e16('0x33')]});}}else{logger[_0x4e16('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x4e16('0x3e'),'input_type':_0x4e16('0x21'),'response_type':_0x4e16('0x21'),'rest_data':JSON[_0x4e16('0x22')]({'session':_0x333512['id'],'module_name':_0x4e16('0x1a'),'name_value_list':[{'name':_0x4e16('0x3f'),'value':_0x1acd6e!==_0x4e16('0x40')?_0x1acd6e:util[_0x4e16('0x24')](_0x4e16('0x41'),_0x20a488)},{'name':_0x4e16('0x3b'),'value':_0x20a488}]})}})['then'](function(_0x1af451){logger['info'](_0x4e16('0x42'));return BPromise['resolve']({'id':_0x1af451['id'],'name':_0x1af451['entry_list'][_0x4e16('0x3f')]['value'],'phone':_0x1af451[_0x4e16('0x31')][_0x4e16('0x3b')]['value']});});}});}function request(_0x2db5a0){logger[_0x4e16('0x43')](_0x4e16('0x44'),JSON[_0x4e16('0x22')](_0x2db5a0));return rp(_['merge'](def,_0x2db5a0));}function getTags(_0x54119a,_0x49f041){var _0x30e7e7=[];if(_0x54119a&&_0x54119a[_0x4e16('0x3c')]>0x0){_0x30e7e7=_['map'](_0x54119a,_0x49f041);}return _0x30e7e7;}function getCustomFields(_0x39305e,_0x140870){var _0x2c3b66=[];var _0x22f968={'custom_fields':[]};if(_0x39305e['length']>0x0){_[_0x4e16('0x1d')](_0x39305e,function(_0x1e0b57){if(_0x1e0b57['type']===_0x4e16('0x45')&&_0x1e0b57['nameField']&&!_0x1e0b57[_0x4e16('0x46')]){_0x22f968[_0x1e0b57['nameField'][_0x4e16('0x47')]()]=_0x1e0b57[_0x4e16('0x48')]['toString']();}else if(_0x1e0b57[_0x4e16('0x49')]===_0x4e16('0x45')&&_0x1e0b57['idField']&&_0x1e0b57['customField']){_0x22f968[_0x4e16('0x4a')]['push']({'id':_0x1e0b57[_0x4e16('0x20')],'value':_0x1e0b57[_0x4e16('0x48')][_0x4e16('0x27')]()});}else if(_0x1e0b57[_0x4e16('0x49')]==='variable'&&_0x1e0b57[_0x4e16('0x1e')]&&_0x1e0b57['idField']&&_0x1e0b57[_0x4e16('0x46')]){_0x140870[_0x1e0b57['variableName']]&&_0x22f968[_0x4e16('0x4a')]['push']({'id':_0x1e0b57[_0x4e16('0x20')],'value':_0x140870[_0x1e0b57[_0x4e16('0x1e')]]['toString']()});}else if(_0x1e0b57[_0x4e16('0x49')]==='customVariable'&&_0x1e0b57['Variable']&&_0x1e0b57[_0x4e16('0x4b')][_0x4e16('0xf')]&&_0x1e0b57[_0x4e16('0x20')]&&_0x1e0b57[_0x4e16('0x46')]){_0x140870[_0x1e0b57[_0x4e16('0x4b')][_0x4e16('0xf')][_0x4e16('0x47')]()]&&_0x22f968[_0x4e16('0x4a')][_0x4e16('0x1f')]({'id':_0x1e0b57[_0x4e16('0x20')],'value':_0x140870[_0x1e0b57[_0x4e16('0x4b')][_0x4e16('0xf')][_0x4e16('0x47')]()][_0x4e16('0x27')]()});}});}return _0x22f968;}function getConnection(_0x1e2289){return request({'method':_0x4e16('0xb'),'form':{'method':_0x4e16('0x4c'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1e2289[_0x4e16('0x4d')],'password':_0x1e2289[_0x4e16('0x4e')],'encryption':_0x4e16('0x4f')},'application':_0x4e16('0x50')})}})[_0x4e16('0x2f')](function(_0x4b9d38){var _0x458209=_0x4b9d38;if(_0x458209['id']){def['sessionID']=_0x458209['id'];return BPromise[_0x4e16('0x35')](_0x458209);}else{throw new Error(util[_0x4e16('0x24')](_0x4e16('0x51'),_0x1e2289['id']));}});}function setRelationship(_0x4ec453,_0x3755db,_0x4179cd,_0x4d4043){return request({'form':{'method':_0x4e16('0x52'),'input_type':_0x4e16('0x21'),'response_type':_0x4e16('0x21'),'rest_data':JSON['stringify']({'session':_0x4ec453['id'],'module_name':_0x4e16('0x23'),'module_id':_0x4179cd['id'],'link_field_name':_0x4d4043,'related_ids':[_0x3755db['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x21036d,_0x253192,_0x15c3d3,_0x3190f4,_0x241697,_0x37ad6a){var _0x2edabb,_0x3cee20,_0x3d39d1,_0x157b9c;_0x37ad6a['remoteUri']=intUtil[_0x4e16('0x53')](_0x37ad6a['remoteUri']);_0x37ad6a[_0x4e16('0x54')]=intUtil[_0x4e16('0x53')](_0x37ad6a['serverUrl']);def[_0x4e16('0x55')]=util[_0x4e16('0x24')](_0x4e16('0x56'),_0x37ad6a[_0x4e16('0x57')]);if(_0x241697&&_0x241697[_0x4e16('0x58')]){logger[_0x4e16('0xd')]('[QUEUE]','Recording\x20is\x20enabled!');_0x253192[_0x4e16('0x59')]=util['format'](_0x4e16('0x5a'),_0x37ad6a[_0x4e16('0x54')],_0x253192[_0x4e16('0x5b')],md5(_0x253192['uniqueid']));}else{_0x253192[_0x4e16('0x59')]='';}return getConnection(_0x37ad6a)[_0x4e16('0x2f')](function(_0x355435){_0x157b9c=_0x355435;return getUser(_0x37ad6a,_0x3190f4[_0x4e16('0xf')],_0x157b9c);})[_0x4e16('0x2f')](function(_0x1951c4){_0x2edabb=_0x1951c4;logger[_0x4e16('0xd')]('The\x20User\x20ID\x20is:',_0x2edabb['id']);return getEndUser(_0x37ad6a,_0x253192[_0x4e16('0x5c')],_0x253192[_0x4e16('0x5d')],_0x157b9c);})[_0x4e16('0x2f')](function(_0x2e3f81){_0x3cee20=_0x2e3f81;logger[_0x4e16('0xd')](_0x4e16('0x5e'),_0x3cee20['id']);return getTicket(_0x37ad6a,_0x2edabb,_0x3cee20,_0x15c3d3,_0x253192,_0x15c3d3['Fields'],_0x157b9c,_0x4e16('0x5f'));})['then'](function(_0x35d014){_0x3d39d1=_0x35d014;logger['info'](_0x4e16('0x60'));logger['info'](_0x4e16('0x61'),_0x3d39d1['id']);return setRelationship(_0x157b9c,_0x2edabb,_0x3d39d1,'users');})[_0x4e16('0x2f')](function(){return setRelationship(_0x157b9c,_0x3cee20,_0x3d39d1,_0x4e16('0x62'));})[_0x4e16('0x2f')](function(){return getServerInfo(_0x157b9c);})[_0x4e16('0x2f')](function(_0x3448ab){var _0x590d14=parseInt(_0x3448ab[_0x4e16('0x63')][_0x4e16('0x64')](0x0));var _0x42006c=util['format'](_0x4e16('0x65'),_0x37ad6a[_0x4e16('0x57')],_0x3d39d1['id']);if(_0x590d14>0x6){_0x42006c=util[_0x4e16('0x24')](_0x4e16('0x66'),_0x37ad6a[_0x4e16('0x57')],_0x3d39d1['id']);}logger[_0x4e16('0xd')](_0x4e16('0x67'),_0x4e16('0x68'));emit(util['format'](_0x4e16('0x69'),_0x3190f4['name']),_0x4e16('0x6a'),{'uri':_0x42006c});})['catch'](function(_0x370fd8){logger['error'](_0x4e16('0x67'),JSON[_0x4e16('0x22')](_0x370fd8));});};exports[_0x4e16('0x6b')]=function(_0x2967e6,_0x35135e,_0x225982,_0x5c8ebc,_0x435269,_0x3a9943,_0x2d47e7){var _0x3269a0,_0x23604a,_0x3f1a3f,_0x170c4a;_0x3a9943[_0x4e16('0x57')]=intUtil[_0x4e16('0x53')](_0x3a9943[_0x4e16('0x57')]);_0x3a9943[_0x4e16('0x54')]=intUtil[_0x4e16('0x53')](_0x3a9943[_0x4e16('0x54')]);def['uri']=util[_0x4e16('0x24')](_0x4e16('0x56'),_0x3a9943['remoteUri']);if(_0x2d47e7&&_0x2d47e7[_0x4e16('0x6c')]&&_0x2d47e7[_0x4e16('0x6c')]!==_0x4e16('0x6d')){logger[_0x4e16('0xd')](_0x4e16('0x6e'),_0x4e16('0x6f'));_0x35135e[_0x4e16('0x59')]=util[_0x4e16('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3a9943[_0x4e16('0x54')],_0x35135e[_0x4e16('0x5b')],md5(_0x35135e[_0x4e16('0x5b')]));}return getConnection(_0x3a9943)['then'](function(_0x1e0144){_0x170c4a=_0x1e0144;return getUser(_0x3a9943,_0x5c8ebc[_0x4e16('0xf')],_0x170c4a);})[_0x4e16('0x2f')](function(_0x464918){_0x3269a0=_0x464918;logger[_0x4e16('0xd')]('The\x20User\x20ID\x20is:',_0x3269a0['id']);return getEndUser(_0x3a9943,_0x35135e['destcalleridname'],_0x35135e[_0x4e16('0x70')],_0x170c4a);})[_0x4e16('0x2f')](function(_0x5e890a){_0x23604a=_0x5e890a;logger[_0x4e16('0xd')](_0x4e16('0x5e'),_0x23604a['id']);return getTicket(_0x3a9943,_0x3269a0,_0x23604a,_0x225982,_0x35135e,_0x225982[_0x4e16('0x71')],_0x170c4a,'Outbound');})[_0x4e16('0x2f')](function(_0x1c78fc){_0x3f1a3f=_0x1c78fc;logger[_0x4e16('0xd')](_0x4e16('0x60'));logger[_0x4e16('0xd')](_0x4e16('0x61'),_0x3f1a3f['id']);return setRelationship(_0x170c4a,_0x3269a0,_0x3f1a3f,_0x4e16('0x72'));})['then'](function(){return setRelationship(_0x170c4a,_0x23604a,_0x3f1a3f,_0x4e16('0x62'));})[_0x4e16('0x2f')](function(){return getServerInfo(_0x170c4a);})[_0x4e16('0x2f')](function(_0x179d5c){var _0x1935d8=parseInt(_0x179d5c[_0x4e16('0x63')][_0x4e16('0x64')](0x0));var _0x296b92=util[_0x4e16('0x24')](_0x4e16('0x65'),_0x3a9943[_0x4e16('0x57')],_0x3f1a3f['id']);if(_0x1935d8>0x6){_0x296b92=util[_0x4e16('0x24')](_0x4e16('0x66'),_0x3a9943[_0x4e16('0x57')],_0x3f1a3f['id']);}logger[_0x4e16('0xd')](_0x4e16('0x6e'),_0x4e16('0x68'));emit(util[_0x4e16('0x24')]('user:%s',_0x5c8ebc['name']),'trigger:browser:url',{'uri':_0x296b92});})[_0x4e16('0x73')](function(_0x3295f2){logger[_0x4e16('0x74')](_0x4e16('0x6e'),JSON['stringify'](_0x3295f2));});};exports[_0x4e16('0x75')]=function(_0xfc08c3,_0x257bcc,_0x1700da,_0x416549,_0x4c28a6,_0x4e2828){var _0x4b5e01,_0x461b2a,_0x2f7041,_0x318a43;_0x4e2828['remoteUri']=intUtil['stripTrailingSlash'](_0x4e2828['remoteUri']);_0x4e2828[_0x4e16('0x54')]=intUtil[_0x4e16('0x53')](_0x4e2828[_0x4e16('0x54')]);def['uri']=util[_0x4e16('0x24')]('%s/service/v4_1/rest.php',_0x4e2828[_0x4e16('0x57')]);if(_0x4c28a6&&_0x4c28a6[_0x4e16('0x58')]){logger[_0x4e16('0xd')]('['+_0x257bcc[_0x4e16('0x76')][_0x4e16('0x77')]()+']','Recording\x20is\x20enabled!');_0x257bcc['recordingURL']=util[_0x4e16('0x24')](_0x4e16('0x5a'),_0x4e2828['serverUrl'],_0x257bcc[_0x4e16('0x5b')],md5(_0x257bcc[_0x4e16('0x5b')]));}else{_0x257bcc[_0x4e16('0x59')]='';}return getConnection(_0x4e2828)[_0x4e16('0x2f')](function(_0x2c2029){_0x318a43=_0x2c2029;if(!_[_0x4e16('0x29')](_0x416549)){return getUser(_0x4e2828,_0x416549[_0x4e16('0xf')],_0x318a43);}else{return getUser(_0x4e2828,null,_0x318a43);}})[_0x4e16('0x2f')](function(_0x1eaeb5){_0x4b5e01=_0x1eaeb5;logger['info']('The\x20User\x20ID\x20is:',_0x4b5e01['id']);return getEndUser(_0x4e2828,_0x257bcc[_0x4e16('0x5c')],_0x257bcc['calleridnum'],_0x318a43);})[_0x4e16('0x2f')](function(_0x474fde){_0x461b2a=_0x474fde;logger[_0x4e16('0xd')](_0x4e16('0x5e'),_0x461b2a['id']);return getTicket(_0x4e2828,_0x4b5e01,_0x461b2a,_0x1700da,_0x257bcc,_0x1700da[_0x4e16('0x71')],_0x318a43,_0x4e16('0x5f'));})[_0x4e16('0x2f')](function(_0x231148){_0x2f7041=_0x231148;logger[_0x4e16('0xd')](_0x4e16('0x60'));logger[_0x4e16('0xd')]('The\x20Ticket\x20ID\x20is:',_0x2f7041['id']);return setRelationship(_0x318a43,_0x4b5e01,_0x2f7041,_0x4e16('0x72'));})['then'](function(){return setRelationship(_0x318a43,_0x461b2a,_0x2f7041,_0x4e16('0x62'));})['then'](function(){return getServerInfo(_0x318a43);})[_0x4e16('0x73')](function(_0x10cfe7){logger[_0x4e16('0x74')]('['+_0x257bcc[_0x4e16('0x76')]['toUpperCase']()+']',JSON[_0x4e16('0x22')](_0x10cfe7));});}; \ No newline at end of file +var _0xe5de=['stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','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','user:%s','catch','outbound','%s/service/v4_1/rest.php','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Outbound','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','[OUTBOUND]','unmanaged','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','bluebird','md5','util','ioredis','../../../../config/logger','redis','localhost','socket.io-emitter','POST','info','name','getString','Subjects','assigned_user_id','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_type','Contacts','direction','forEach','variableName','push','idField','set_entry','Calls','format','get_server_info','JSON','stringify','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','length','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','type','string','nameField','toLowerCase','content','customField','custom_fields','toString','customVariable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xe5de,0x18a));var _0xee5d=function(_0x4324d3,_0x187571){_0x4324d3=_0x4324d3-0x0;var _0x1db79b=_0xe5de[_0x4324d3];return _0x1db79b;};'use strict';var _=require(_0xee5d('0x0'));var rp=require(_0xee5d('0x1'));var BPromise=require(_0xee5d('0x2'));var md5=require(_0xee5d('0x3'));var util=require(_0xee5d('0x4'));var Redis=require(_0xee5d('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xee5d('0x6'))('sugarcrm');config['redis']=_['defaults'](config[_0xee5d('0x7')],{'host':_0xee5d('0x8'),'port':0x18eb});var io=require(_0xee5d('0x9'))(new Redis(config[_0xee5d('0x7')]));var def={'method':_0xee5d('0xa'),'json':!![]};function emit(_0xdcbab7,_0x9e201d,_0x4a59cc){io['to'](_0xdcbab7)['emit'](_0x9e201d,_0x4a59cc);}function getTicket(_0x3ec33b,_0x886829,_0x2ae564,_0x105238,_0x432709,_0x45171b,_0x3a4905,_0x23d9fd){logger[_0xee5d('0xb')]('Creating\x20new\x20ticket...');var _0x22f306=new Date();var _0x36ed6c=[{'name':_0xee5d('0xc'),'value':intUtil[_0xee5d('0xd')](_0x105238[_0xee5d('0xe')],_0x432709,'\x20')},{'name':_0xee5d('0xf'),'value':_0x886829['id']},{'name':'created_by','value':_0x886829['id']},{'name':_0xee5d('0x10'),'value':intUtil['getString'](_0x105238[_0xee5d('0x11')],_0x432709,'\x0a')},{'name':_0xee5d('0x12'),'value':_0x22f306[_0xee5d('0x13')]()[_0xee5d('0x14')](0x0,0x13)[_0xee5d('0x15')]('T','\x20')},{'name':_0xee5d('0x16'),'value':'0'},{'name':_0xee5d('0x17'),'value':'15'},{'name':'parent_id','value':_0x2ae564['id']},{'name':_0xee5d('0x18'),'value':_0xee5d('0x19')},{'name':'parent_name','value':_0x2ae564[_0xee5d('0xc')]},{'name':_0xee5d('0x1a'),'value':_0x23d9fd}];if(_0x45171b['length']){_[_0xee5d('0x1b')](_0x45171b,function(_0x1b7e56){if(_0x432709[_0x1b7e56[_0xee5d('0x1c')]]){_0x36ed6c[_0xee5d('0x1d')]({'name':_0x1b7e56[_0xee5d('0x1e')],'value':_0x432709[_0x1b7e56[_0xee5d('0x1c')]]});}});}return request({'form':{'method':_0xee5d('0x1f'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x3a4905['id'],'module_name':_0xee5d('0x20'),'name_value_list':_0x36ed6c})}});}function getAuth(_0x3d6894){return util[_0xee5d('0x21')]('Basic\x20%s',new Buffer(_0x3d6894['apiKey']+':X')['toString']('base64'));}function getServerInfo(_0x43da46){return request({'form':{'method':_0xee5d('0x22'),'input_type':_0xee5d('0x23'),'response_type':'JSON','rest_data':JSON[_0xee5d('0x24')]({'session':_0x43da46['id']})}});}function getUser(_0x5ce953,_0x3380c7,_0xf272fe){if(!_[_0xee5d('0x25')](_0x3380c7)){logger[_0xee5d('0xb')](_0xee5d('0x26'),_0x3380c7);return request({'form':{'method':_0xee5d('0x27'),'input_type':_0xee5d('0x23'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0xf272fe['id'],'module_name':_0xee5d('0x28'),'query':util[_0xee5d('0x21')](_0xee5d('0x29'),_0x3380c7),'order_by':'','offset':'0','select_fields':['id',_0xee5d('0xc'),_0xee5d('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xee5d('0x2b')](function(_0x1e8376){if(_0x1e8376[_0xee5d('0x2c')]['length']){var _0xaaa0e1=_[_0xee5d('0x2d')](_0x1e8376['entry_list'],function(_0x1e049c){return _0x1e049c[_0xee5d('0x2e')][_0xee5d('0x2a')][_0xee5d('0x2f')]===_0x3380c7;});if(_0xaaa0e1){logger[_0xee5d('0xb')](_0xee5d('0x30'));return BPromise[_0xee5d('0x31')]({'id':_0xaaa0e1['name_value_list']['id'][_0xee5d('0x2f')],'name':_0xaaa0e1['name_value_list'][_0xee5d('0xc')]['value']});}}logger[_0xee5d('0xb')](_0xee5d('0x32'));return BPromise[_0xee5d('0x31')]({'id':_0xf272fe[_0xee5d('0x2e')][_0xee5d('0x33')][_0xee5d('0x2f')],'name':_0xf272fe[_0xee5d('0x2e')][_0xee5d('0x2a')][_0xee5d('0x2f')]});});}else{logger[_0xee5d('0xb')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0xf272fe[_0xee5d('0x2e')]['user_id'][_0xee5d('0x2f')],'name':_0xf272fe[_0xee5d('0x2e')][_0xee5d('0x2a')][_0xee5d('0x2f')]});}}function getEndUser(_0xcfbaa7,_0x303ace,_0x39ce8b,_0x16cdfe){logger['info'](_0xee5d('0x34'),_0x39ce8b);return request({'form':{'method':_0xee5d('0x27'),'input_type':'JSON','response_type':_0xee5d('0x23'),'rest_data':JSON[_0xee5d('0x24')]({'session':_0x16cdfe['id'],'module_name':_0xee5d('0x19'),'query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x39ce8b),'order_by':'','offset':'0','select_fields':['id',_0xee5d('0xc'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x5a2077){if(_0x5a2077[_0xee5d('0x2c')][_0xee5d('0x35')]){var _0x1ba99f=_[_0xee5d('0x2d')](_0x5a2077[_0xee5d('0x2c')],function(_0x26a80f){return _0x26a80f['name_value_list'][_0xee5d('0x36')][_0xee5d('0x2f')]===_0x39ce8b;});if(_0x1ba99f){logger[_0xee5d('0xb')](_0xee5d('0x37'));return BPromise[_0xee5d('0x31')]({'id':_0x1ba99f[_0xee5d('0x2e')]['id'][_0xee5d('0x2f')],'name':_0x1ba99f[_0xee5d('0x2e')][_0xee5d('0xc')]['value'],'phone':_0x1ba99f[_0xee5d('0x2e')]['phone_home'][_0xee5d('0x2f')]});}}else{logger['info'](_0xee5d('0x38'));return request({'form':{'method':'set_entry','input_type':_0xee5d('0x23'),'response_type':_0xee5d('0x23'),'rest_data':JSON[_0xee5d('0x24')]({'session':_0x16cdfe['id'],'module_name':'Contacts','name_value_list':[{'name':_0xee5d('0x39'),'value':_0x303ace!==''?_0x303ace:util[_0xee5d('0x21')](_0xee5d('0x3a'),_0x39ce8b)},{'name':'phone_home','value':_0x39ce8b}]})}})[_0xee5d('0x2b')](function(_0x587ced){logger[_0xee5d('0xb')](_0xee5d('0x3b'));return BPromise[_0xee5d('0x31')]({'id':_0x587ced['id'],'name':_0x587ced[_0xee5d('0x2c')][_0xee5d('0x39')]['value'],'phone':_0x587ced['entry_list'][_0xee5d('0x36')][_0xee5d('0x2f')]});});}});}function request(_0x53d1b2){logger[_0xee5d('0x3c')](_0xee5d('0x3d'),JSON[_0xee5d('0x24')](_0x53d1b2));return rp(_['merge'](def,_0x53d1b2));}function getTags(_0x2ff345,_0x1ddf07){var _0x4d469f=[];if(_0x2ff345&&_0x2ff345['length']>0x0){_0x4d469f=_[_0xee5d('0x3e')](_0x2ff345,_0x1ddf07);}return _0x4d469f;}function getCustomFields(_0x10153d,_0x359f7f){var _0x2d65fb=[];var _0x41e39c={'custom_fields':[]};if(_0x10153d['length']>0x0){_[_0xee5d('0x1b')](_0x10153d,function(_0x1dbb92){if(_0x1dbb92[_0xee5d('0x3f')]===_0xee5d('0x40')&&_0x1dbb92[_0xee5d('0x41')]&&!_0x1dbb92['customField']){_0x41e39c[_0x1dbb92[_0xee5d('0x41')][_0xee5d('0x42')]()]=_0x1dbb92[_0xee5d('0x43')]['toString']();}else if(_0x1dbb92[_0xee5d('0x3f')]===_0xee5d('0x40')&&_0x1dbb92[_0xee5d('0x1e')]&&_0x1dbb92[_0xee5d('0x44')]){_0x41e39c[_0xee5d('0x45')]['push']({'id':_0x1dbb92[_0xee5d('0x1e')],'value':_0x1dbb92['content'][_0xee5d('0x46')]()});}else if(_0x1dbb92[_0xee5d('0x3f')]==='variable'&&_0x1dbb92['variableName']&&_0x1dbb92[_0xee5d('0x1e')]&&_0x1dbb92[_0xee5d('0x44')]){_0x359f7f[_0x1dbb92['variableName']]&&_0x41e39c[_0xee5d('0x45')]['push']({'id':_0x1dbb92['idField'],'value':_0x359f7f[_0x1dbb92[_0xee5d('0x1c')]][_0xee5d('0x46')]()});}else if(_0x1dbb92[_0xee5d('0x3f')]===_0xee5d('0x47')&&_0x1dbb92['Variable']&&_0x1dbb92[_0xee5d('0x48')][_0xee5d('0xc')]&&_0x1dbb92[_0xee5d('0x1e')]&&_0x1dbb92['customField']){_0x359f7f[_0x1dbb92['Variable']['name']['toLowerCase']()]&&_0x41e39c[_0xee5d('0x45')]['push']({'id':_0x1dbb92['idField'],'value':_0x359f7f[_0x1dbb92[_0xee5d('0x48')][_0xee5d('0xc')][_0xee5d('0x42')]()]['toString']()});}});}return _0x41e39c;}function getConnection(_0x419595){return request({'method':_0xee5d('0xa'),'form':{'method':_0xee5d('0x49'),'input_type':_0xee5d('0x23'),'response_type':_0xee5d('0x23'),'rest_data':JSON[_0xee5d('0x24')]({'user_auth':{'user_name':_0x419595['username'],'password':_0x419595[_0xee5d('0x4a')],'encryption':_0xee5d('0x4b')},'application':_0xee5d('0x4c')})}})[_0xee5d('0x2b')](function(_0x2464d3){var _0x2a49ff=_0x2464d3;if(_0x2a49ff['id']){def[_0xee5d('0x4d')]=_0x2a49ff['id'];return BPromise[_0xee5d('0x31')](_0x2a49ff);}else{throw new Error(util['format'](_0xee5d('0x4e'),_0x419595['id']));}});}function setRelationship(_0x457c4a,_0x15a90e,_0x5688f2,_0x6c788b){return request({'form':{'method':_0xee5d('0x4f'),'input_type':_0xee5d('0x23'),'response_type':_0xee5d('0x23'),'rest_data':JSON[_0xee5d('0x24')]({'session':_0x457c4a['id'],'module_name':_0xee5d('0x20'),'module_id':_0x5688f2['id'],'link_field_name':_0x6c788b,'related_ids':[_0x15a90e['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xee5d('0x50')]=function(_0x8592db,_0x44738e,_0x4c7d20,_0x4dedb0,_0x3b2714,_0x2b43b1){var _0x52e314,_0x2af2b0,_0x7e5b41,_0xdf9779;_0x2b43b1[_0xee5d('0x51')]=intUtil[_0xee5d('0x52')](_0x2b43b1[_0xee5d('0x51')]);_0x2b43b1[_0xee5d('0x53')]=intUtil[_0xee5d('0x52')](_0x2b43b1[_0xee5d('0x53')]);def[_0xee5d('0x54')]=util['format']('%s/service/v4_1/rest.php',_0x2b43b1[_0xee5d('0x51')]);if(_0x3b2714&&_0x3b2714[_0xee5d('0x55')]){logger['info'](_0xee5d('0x56'),'Recording\x20is\x20enabled!');_0x44738e['recordingURL']=util[_0xee5d('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2b43b1['serverUrl'],_0x44738e[_0xee5d('0x57')],md5(_0x44738e['uniqueid']));}else{_0x44738e[_0xee5d('0x58')]='';}return getConnection(_0x2b43b1)[_0xee5d('0x2b')](function(_0x1cf814){_0xdf9779=_0x1cf814;return getUser(_0x2b43b1,_0x4dedb0[_0xee5d('0xc')],_0xdf9779);})[_0xee5d('0x2b')](function(_0x106649){_0x52e314=_0x106649;logger['info'](_0xee5d('0x59'),_0x52e314['id']);return getEndUser(_0x2b43b1,_0x44738e['calleridname'],_0x44738e[_0xee5d('0x5a')],_0xdf9779);})[_0xee5d('0x2b')](function(_0x47b3f6){_0x2af2b0=_0x47b3f6;logger['info'](_0xee5d('0x5b'),_0x2af2b0['id']);return getTicket(_0x2b43b1,_0x52e314,_0x2af2b0,_0x4c7d20,_0x44738e,_0x4c7d20[_0xee5d('0x5c')],_0xdf9779,_0xee5d('0x5d'));})[_0xee5d('0x2b')](function(_0x3648e4){_0x7e5b41=_0x3648e4;logger[_0xee5d('0xb')](_0xee5d('0x5e'));logger[_0xee5d('0xb')](_0xee5d('0x5f'),_0x7e5b41['id']);return setRelationship(_0xdf9779,_0x52e314,_0x7e5b41,_0xee5d('0x60'));})[_0xee5d('0x2b')](function(){return setRelationship(_0xdf9779,_0x2af2b0,_0x7e5b41,_0xee5d('0x61'));})[_0xee5d('0x2b')](function(){return getServerInfo(_0xdf9779);})[_0xee5d('0x2b')](function(_0x3d0054){var _0x3bc0a3=parseInt(_0x3d0054[_0xee5d('0x62')][_0xee5d('0x63')](0x0));var _0x196e72=util[_0xee5d('0x21')](_0xee5d('0x64'),_0x2b43b1[_0xee5d('0x51')],_0x7e5b41['id']);if(_0x3bc0a3>0x6){_0x196e72=util['format'](_0xee5d('0x65'),_0x2b43b1[_0xee5d('0x51')],_0x7e5b41['id']);}logger[_0xee5d('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xee5d('0x66'),_0x4dedb0[_0xee5d('0xc')]),'trigger:browser:url',{'uri':_0x196e72});})[_0xee5d('0x67')](function(_0x182cb9){logger['error'](_0xee5d('0x56'),JSON[_0xee5d('0x24')](_0x182cb9));});};exports[_0xee5d('0x68')]=function(_0xabd77a,_0x2300d3,_0x149df8,_0x3b6b1a,_0x380997,_0xc50c14,_0x33ab3b){var _0x108faa,_0x4a8fef,_0x149397,_0x4efaf9;_0xc50c14[_0xee5d('0x51')]=intUtil[_0xee5d('0x52')](_0xc50c14[_0xee5d('0x51')]);_0xc50c14['serverUrl']=intUtil['stripTrailingSlash'](_0xc50c14[_0xee5d('0x53')]);def[_0xee5d('0x54')]=util[_0xee5d('0x21')](_0xee5d('0x69'),_0xc50c14['remoteUri']);if(_0x33ab3b&&_0x33ab3b['recordingFormat']&&_0x33ab3b[_0xee5d('0x6a')]!==_0xee5d('0x6b')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2300d3[_0xee5d('0x58')]=util[_0xee5d('0x21')](_0xee5d('0x6c'),_0xc50c14['serverUrl'],_0x2300d3['uniqueid'],md5(_0x2300d3[_0xee5d('0x57')]));}return getConnection(_0xc50c14)[_0xee5d('0x2b')](function(_0x320861){_0x4efaf9=_0x320861;return getUser(_0xc50c14,_0x3b6b1a['name'],_0x4efaf9);})[_0xee5d('0x2b')](function(_0x37160a){_0x108faa=_0x37160a;logger[_0xee5d('0xb')](_0xee5d('0x59'),_0x108faa['id']);return getEndUser(_0xc50c14,_0x2300d3[_0xee5d('0x6d')],_0x2300d3[_0xee5d('0x6e')],_0x4efaf9);})[_0xee5d('0x2b')](function(_0x7a15de){_0x4a8fef=_0x7a15de;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4a8fef['id']);return getTicket(_0xc50c14,_0x108faa,_0x4a8fef,_0x149df8,_0x2300d3,_0x149df8[_0xee5d('0x5c')],_0x4efaf9,_0xee5d('0x6f'));})[_0xee5d('0x2b')](function(_0x4d331d){_0x149397=_0x4d331d;logger[_0xee5d('0xb')](_0xee5d('0x5e'));logger['info'](_0xee5d('0x5f'),_0x149397['id']);return setRelationship(_0x4efaf9,_0x108faa,_0x149397,'users');})[_0xee5d('0x2b')](function(){return setRelationship(_0x4efaf9,_0x4a8fef,_0x149397,_0xee5d('0x61'));})[_0xee5d('0x2b')](function(){return getServerInfo(_0x4efaf9);})[_0xee5d('0x2b')](function(_0x601e92){var _0x949009=parseInt(_0x601e92['version'][_0xee5d('0x63')](0x0));var _0x332696=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0xc50c14[_0xee5d('0x51')],_0x149397['id']);if(_0x949009>0x6){_0x332696=util[_0xee5d('0x21')](_0xee5d('0x65'),_0xc50c14[_0xee5d('0x51')],_0x149397['id']);}logger[_0xee5d('0xb')]('[OUTBOUND]',_0xee5d('0x70'));emit(util[_0xee5d('0x21')]('user:%s',_0x3b6b1a['name']),_0xee5d('0x71'),{'uri':_0x332696});})[_0xee5d('0x67')](function(_0x209635){logger[_0xee5d('0x72')](_0xee5d('0x73'),JSON['stringify'](_0x209635));});};exports[_0xee5d('0x74')]=function(_0x3f5817,_0x3e9218,_0x3f422b,_0x14da58,_0x337f6c,_0x5ecf9e){var _0x3ca47c,_0x13a3b8,_0x338c3d,_0x1508d1;_0x5ecf9e[_0xee5d('0x51')]=intUtil[_0xee5d('0x52')](_0x5ecf9e[_0xee5d('0x51')]);_0x5ecf9e[_0xee5d('0x53')]=intUtil[_0xee5d('0x52')](_0x5ecf9e['serverUrl']);def[_0xee5d('0x54')]=util[_0xee5d('0x21')]('%s/service/v4_1/rest.php',_0x5ecf9e[_0xee5d('0x51')]);if(_0x337f6c&&_0x337f6c[_0xee5d('0x55')]){logger['info']('['+_0x3e9218['lastevent'][_0xee5d('0x75')]()+']',_0xee5d('0x76'));_0x3e9218[_0xee5d('0x58')]=util[_0xee5d('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5ecf9e[_0xee5d('0x53')],_0x3e9218['uniqueid'],md5(_0x3e9218[_0xee5d('0x57')]));}else{_0x3e9218[_0xee5d('0x58')]='';}return getConnection(_0x5ecf9e)[_0xee5d('0x2b')](function(_0x315ff2){_0x1508d1=_0x315ff2;if(!_[_0xee5d('0x25')](_0x14da58)){return getUser(_0x5ecf9e,_0x14da58[_0xee5d('0xc')],_0x1508d1);}else{return getUser(_0x5ecf9e,null,_0x1508d1);}})[_0xee5d('0x2b')](function(_0x8ab943){_0x3ca47c=_0x8ab943;logger[_0xee5d('0xb')]('The\x20User\x20ID\x20is:',_0x3ca47c['id']);return getEndUser(_0x5ecf9e,_0x3e9218['calleridname'],_0x3e9218[_0xee5d('0x5a')],_0x1508d1);})[_0xee5d('0x2b')](function(_0x3319ea){_0x13a3b8=_0x3319ea;logger[_0xee5d('0xb')](_0xee5d('0x5b'),_0x13a3b8['id']);return getTicket(_0x5ecf9e,_0x3ca47c,_0x13a3b8,_0x3f422b,_0x3e9218,_0x3f422b[_0xee5d('0x5c')],_0x1508d1,_0xee5d('0x5d'));})['then'](function(_0x1fe2bd){_0x338c3d=_0x1fe2bd;logger[_0xee5d('0xb')]('Ticket\x20created!');logger[_0xee5d('0xb')](_0xee5d('0x5f'),_0x338c3d['id']);return setRelationship(_0x1508d1,_0x3ca47c,_0x338c3d,_0xee5d('0x60'));})[_0xee5d('0x2b')](function(){return setRelationship(_0x1508d1,_0x13a3b8,_0x338c3d,_0xee5d('0x61'));})[_0xee5d('0x2b')](function(){return getServerInfo(_0x1508d1);})[_0xee5d('0x67')](function(_0x3c66e7){logger[_0xee5d('0x72')]('['+_0x3e9218['lastevent'][_0xee5d('0x75')]()+']',JSON[_0xee5d('0x24')](_0x3c66e7));});}; \ 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 03d38bf..b4aeeaa 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 _0xca61=['%s:\x20%s','keyContent','customVariable','stripTrailingSlash','slice','substring','validateEmail','isNil','test','lodash','util','getString','sortBy','length','push','content','type','variable','variableName','Variable','name','toLowerCase','toString','keyValue','keyType','key','format'];(function(_0x38d305,_0xe92928){var _0x32c39b=function(_0x4082d0){while(--_0x4082d0){_0x38d305['push'](_0x38d305['shift']());}};_0x32c39b(++_0xe92928);}(_0xca61,0x90));var _0x1ca6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xca61[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1ca6('0x0'));var util=require(_0x1ca6('0x1'));exports[_0x1ca6('0x2')]=function(_0xb3ab5c,_0x37335c,_0x530826){var _0x32acba=[];if(_0xb3ab5c['length']>0x0){var _0x4a84ea=_[_0x1ca6('0x3')](_0xb3ab5c,['id']);for(var _0x1d6940=0x0;_0x1d6940<_0x4a84ea[_0x1ca6('0x4')];_0x1d6940++){var _0x488b2d=_0x4a84ea[_0x1d6940];if(_0x488b2d['type']==='string'){_0x32acba[_0x1ca6('0x5')](_0x488b2d[_0x1ca6('0x6')]);}else if(_0x488b2d[_0x1ca6('0x7')]===_0x1ca6('0x8')&&_0x488b2d[_0x1ca6('0x9')]){_0x37335c[_0x488b2d[_0x1ca6('0x9')]]&&_0x32acba[_0x1ca6('0x5')](_0x37335c[_0x488b2d[_0x1ca6('0x9')]]['toString']());}else if(_0x488b2d['type']==='customVariable'&&_0x488b2d[_0x1ca6('0xa')]&&_0x488b2d['Variable'][_0x1ca6('0xb')]){_0x37335c[_0x488b2d[_0x1ca6('0xa')]['name']['toLowerCase']()]&&_0x32acba[_0x1ca6('0x5')](_0x37335c[_0x488b2d['Variable'][_0x1ca6('0xb')][_0x1ca6('0xc')]()][_0x1ca6('0xd')]());}else if(_0x488b2d[_0x1ca6('0x7')]===_0x1ca6('0xe')){if(_0x488b2d[_0x1ca6('0xf')]==='string'&&_0x488b2d[_0x1ca6('0x10')]){_0x32acba['push'](util[_0x1ca6('0x11')](_0x1ca6('0x12'),_0x488b2d[_0x1ca6('0x10')],_0x488b2d[_0x1ca6('0x13')]));}else if(_0x488b2d[_0x1ca6('0xf')]===_0x1ca6('0x8')&&_0x488b2d[_0x1ca6('0x9')]&&_0x488b2d[_0x1ca6('0x10')]){_0x37335c[_0x488b2d[_0x1ca6('0x9')]]&&_0x32acba[_0x1ca6('0x5')](util[_0x1ca6('0x11')](_0x1ca6('0x12'),_0x488b2d[_0x1ca6('0x10')],_0x37335c[_0x488b2d[_0x1ca6('0x9')]]));}else if(_0x488b2d[_0x1ca6('0xf')]===_0x1ca6('0x14')&&_0x488b2d[_0x1ca6('0xa')]&&_0x488b2d[_0x1ca6('0xa')]['name']&&_0x488b2d['key']){_0x37335c[_0x488b2d[_0x1ca6('0xa')][_0x1ca6('0xb')][_0x1ca6('0xc')]()]&&_0x32acba['push'](util[_0x1ca6('0x11')](_0x1ca6('0x12'),_0x488b2d[_0x1ca6('0x10')],_0x37335c[_0x488b2d[_0x1ca6('0xa')][_0x1ca6('0xb')][_0x1ca6('0xc')]()]));}}}}return _0x32acba['join'](_0x530826);};exports[_0x1ca6('0x15')]=function(_0x340e4d){var _0x3f8729=_0x340e4d[_0x1ca6('0x16')](-0x1);if(_0x3f8729==='/'){_0x340e4d=_0x340e4d[_0x1ca6('0x17')](0x0,_0x340e4d['lastIndexOf'](_0x3f8729));}return _0x340e4d;};exports[_0x1ca6('0x18')]=function(_0x1a4659){if(!_[_0x1ca6('0x19')](_0x1a4659)&&_0x1a4659!==''){var _0x52a869=/^(([^<>()\[\]\\.,;:\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 _0x52a869[_0x1ca6('0x1a')](String(_0x1a4659)[_0x1ca6('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x6c3a=['stripTrailingSlash','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','sortBy','length','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','key','format','%s:\x20%s','keyContent','keyType','join'];(function(_0x1b331b,_0x33beb6){var _0x1bf7f4=function(_0x5ecde8){while(--_0x5ecde8){_0x1b331b['push'](_0x1b331b['shift']());}};_0x1bf7f4(++_0x33beb6);}(_0x6c3a,0x11d));var _0xa6c3=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x6c3a[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0xa6c3('0x0'));var util=require(_0xa6c3('0x1'));exports[_0xa6c3('0x2')]=function(_0x54d022,_0x3ea866,_0x4c58e8){var _0x50f89d=[];if(_0x54d022['length']>0x0){var _0x7ae45c=_[_0xa6c3('0x3')](_0x54d022,['id']);for(var _0x47bf08=0x0;_0x47bf08<_0x7ae45c[_0xa6c3('0x4')];_0x47bf08++){var _0x4db2a9=_0x7ae45c[_0x47bf08];if(_0x4db2a9[_0xa6c3('0x5')]===_0xa6c3('0x6')){_0x50f89d[_0xa6c3('0x7')](_0x4db2a9[_0xa6c3('0x8')]);}else if(_0x4db2a9['type']===_0xa6c3('0x9')&&_0x4db2a9[_0xa6c3('0xa')]){_0x3ea866[_0x4db2a9[_0xa6c3('0xa')]]&&_0x50f89d[_0xa6c3('0x7')](_0x3ea866[_0x4db2a9[_0xa6c3('0xa')]][_0xa6c3('0xb')]());}else if(_0x4db2a9[_0xa6c3('0x5')]===_0xa6c3('0xc')&&_0x4db2a9[_0xa6c3('0xd')]&&_0x4db2a9[_0xa6c3('0xd')][_0xa6c3('0xe')]){_0x3ea866[_0x4db2a9[_0xa6c3('0xd')][_0xa6c3('0xe')][_0xa6c3('0xf')]()]&&_0x50f89d[_0xa6c3('0x7')](_0x3ea866[_0x4db2a9[_0xa6c3('0xd')]['name'][_0xa6c3('0xf')]()][_0xa6c3('0xb')]());}else if(_0x4db2a9[_0xa6c3('0x5')]===_0xa6c3('0x10')){if(_0x4db2a9['keyType']===_0xa6c3('0x6')&&_0x4db2a9[_0xa6c3('0x11')]){_0x50f89d['push'](util[_0xa6c3('0x12')](_0xa6c3('0x13'),_0x4db2a9[_0xa6c3('0x11')],_0x4db2a9[_0xa6c3('0x14')]));}else if(_0x4db2a9['keyType']===_0xa6c3('0x9')&&_0x4db2a9[_0xa6c3('0xa')]&&_0x4db2a9['key']){_0x3ea866[_0x4db2a9[_0xa6c3('0xa')]]&&_0x50f89d['push'](util[_0xa6c3('0x12')]('%s:\x20%s',_0x4db2a9[_0xa6c3('0x11')],_0x3ea866[_0x4db2a9[_0xa6c3('0xa')]]));}else if(_0x4db2a9[_0xa6c3('0x15')]===_0xa6c3('0xc')&&_0x4db2a9[_0xa6c3('0xd')]&&_0x4db2a9[_0xa6c3('0xd')]['name']&&_0x4db2a9[_0xa6c3('0x11')]){_0x3ea866[_0x4db2a9['Variable'][_0xa6c3('0xe')][_0xa6c3('0xf')]()]&&_0x50f89d[_0xa6c3('0x7')](util['format']('%s:\x20%s',_0x4db2a9['key'],_0x3ea866[_0x4db2a9[_0xa6c3('0xd')][_0xa6c3('0xe')]['toLowerCase']()]));}}}}return _0x50f89d[_0xa6c3('0x16')](_0x4c58e8);};exports[_0xa6c3('0x17')]=function(_0x4a639b){var _0x5874ff=_0x4a639b['slice'](-0x1);if(_0x5874ff==='/'){_0x4a639b=_0x4a639b['substring'](0x0,_0x4a639b[_0xa6c3('0x18')](_0x5874ff));}return _0x4a639b;};exports[_0xa6c3('0x19')]=function(_0x236096){if(!_[_0xa6c3('0x1a')](_0x236096)&&_0x236096!==''){var _0x44d58c=/^(([^<>()\[\]\\.,;:\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 _0x44d58c[_0xa6c3('0x1b')](String(_0x236096)[_0xa6c3('0xf')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index e2e5bad..30c3505 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 _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','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','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x2513ad,_0x5c7ac8){var _0x14a6c3=function(_0x37a47c){while(--_0x37a47c){_0x2513ad['push'](_0x2513ad['shift']());}};_0x14a6c3(++_0x5c7ac8);}(_0xe706,0xa3));var _0x6e70=function(_0x58f83c,_0x563967){_0x58f83c=_0x58f83c-0x0;var _0x5d2f70=_0xe706[_0x58f83c];return _0x5d2f70;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','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','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x828add,_0x1339c2){var _0x157fce=function(_0x55dcc2){while(--_0x55dcc2){_0x828add['push'](_0x828add['shift']());}};_0x157fce(++_0x1339c2);}(_0xe706,0xa3));var _0x6e70=function(_0x30a204,_0x48370f){_0x30a204=_0x30a204-0x0;var _0x1a1350=_0xe706[_0x30a204];return _0x1a1350;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ 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 44d63a4..273d28b 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 _0xbc56=['then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','debug','[HTTP]','stringify','length','map','string','picklist','type','nameField','customField','toLowerCase','content','custom_fields','push','idField','variable','variableName','customVariable','Variable','toString','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','integrationTab','user:%s','replace','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/environment','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','Tags','name','getString','Subjects','Descriptions','Fields'];(function(_0x304950,_0x32e532){var _0x311125=function(_0x2dd0a2){while(--_0x2dd0a2){_0x304950['push'](_0x304950['shift']());}};_0x311125(++_0x32e532);}(_0xbc56,0xcf));var _0x6bc5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbc56[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6bc5('0x0'));var rp=require('request-promise');var md5=require(_0x6bc5('0x1'));var util=require(_0x6bc5('0x2'));var Redis=require(_0x6bc5('0x3'));var intUtil=require(_0x6bc5('0x4'));var config=require(_0x6bc5('0x5'));var logger=require('../../../../config/logger')(_0x6bc5('0x6'));config[_0x6bc5('0x7')]=_['defaults'](config[_0x6bc5('0x7')],{'host':_0x6bc5('0x8'),'port':0x18eb});var io=require(_0x6bc5('0x9'))(new Redis(config[_0x6bc5('0x7')]));function emit(_0x131afd,_0x516ad0,_0x7810b0){io['to'](_0x131afd)[_0x6bc5('0xa')](_0x516ad0,_0x7810b0);}var headers={'Content-Type':_0x6bc5('0xb'),'Accept':_0x6bc5('0xb')};function getTicket(_0x3a8500,_0x577bd3,_0x35631a,_0x18268f,_0x4f497d){logger[_0x6bc5('0xc')](_0x6bc5('0xd'));return request({'uri':util[_0x6bc5('0xe')](_0x6bc5('0xf'),_0x3a8500['remoteUri']),'method':_0x6bc5('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x35631a['id'],'submitter_id':_0x577bd3?_0x577bd3['id']:undefined,'assignee_id':_0x577bd3?_0x577bd3['id']:undefined,'tags':getTags(_0x18268f[_0x6bc5('0x11')],_0x6bc5('0x12')),'subject':intUtil[_0x6bc5('0x13')](_0x18268f[_0x6bc5('0x14')],_0x4f497d,'\x20'),'description':intUtil[_0x6bc5('0x13')](_0x18268f[_0x6bc5('0x15')],_0x4f497d,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x18268f[_0x6bc5('0x15')],_0x4f497d,'\x0a')}},getCustomFields(_0x18268f[_0x6bc5('0x16')],_0x4f497d))}})[_0x6bc5('0x17')](function(_0x29e5d5){logger['info'](_0x6bc5('0x18'));return _0x29e5d5[_0x6bc5('0x19')];});}function getUser(_0x256fe3,_0x298ebb){if(intUtil['validateEmail'](_0x298ebb)){logger['info'](_0x6bc5('0x1a'),_0x298ebb);return request({'uri':util[_0x6bc5('0xe')](_0x6bc5('0x1b'),_0x256fe3[_0x6bc5('0x1c')]),'qs':{'query':util[_0x6bc5('0xe')](_0x6bc5('0x1d'),_0x298ebb)}})['then'](function(_0x2696a6){if(_0x2696a6['count']){logger[_0x6bc5('0xc')](_0x6bc5('0x1e'));return _[_0x6bc5('0x1f')](_0x2696a6[_0x6bc5('0x20')],{'email':_0x298ebb,'role':_0x6bc5('0x21')});}else{logger[_0x6bc5('0xc')](_0x6bc5('0x22'));return request({'uri':util[_0x6bc5('0xe')]('%s/users/me.json',_0x256fe3[_0x6bc5('0x1c')])})[_0x6bc5('0x17')](function(_0xb82a23){logger[_0x6bc5('0xc')](_0x6bc5('0x23'));return _0xb82a23[_0x6bc5('0x24')];});}});}else{logger[_0x6bc5('0xc')](_0x6bc5('0x22'));return request({'uri':util['format']('%s/users/me.json',_0x256fe3[_0x6bc5('0x1c')])})[_0x6bc5('0x17')](function(_0x4c9e8e){logger[_0x6bc5('0xc')](_0x6bc5('0x23'));return _0x4c9e8e[_0x6bc5('0x24')];});}}function getEndUser(_0x3e3aa8,_0xf1cf9d,_0x3726c5){logger[_0x6bc5('0xc')](_0x6bc5('0x25'),_0x3726c5);return request({'uri':util[_0x6bc5('0xe')]('%s/search.json',_0x3e3aa8['remoteUri']),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x3726c5)}})[_0x6bc5('0x17')](function(_0x2b1397){var _0x5e8645;if(_0x2b1397[_0x6bc5('0x20')]['length']){_0x2b1397[_0x6bc5('0x20')]=_[_0x6bc5('0x26')](_0x2b1397[_0x6bc5('0x20')],{'suspended':![],'role':_0x6bc5('0x27')});if(_0x2b1397[_0x6bc5('0x20')]['length']){_0x5e8645=_[_0x6bc5('0x28')](_0x2b1397[_0x6bc5('0x20')]);}}if(_0x5e8645){logger[_0x6bc5('0xc')](_0x6bc5('0x29'));return _0x5e8645;}else{logger[_0x6bc5('0xc')](_0x6bc5('0x2a'));return request({'uri':util['format'](_0x6bc5('0x2b'),_0x3e3aa8[_0x6bc5('0x1c')]),'method':_0x6bc5('0x10'),'body':{'user':{'role':_0x6bc5('0x27'),'name':util[_0x6bc5('0xe')](_0x6bc5('0x2c'),_0xf1cf9d||_0x3726c5),'phone':_0x3726c5}}})[_0x6bc5('0x17')](function(_0x479822){logger['info']('Enduser\x20created.');return _0x479822[_0x6bc5('0x24')];});}});}function getAuth(_0xddc4a2){var _0x50ac94;if(_0xddc4a2[_0x6bc5('0x2d')]==='password'){_0x50ac94=util['format'](_0x6bc5('0x2e'),_0xddc4a2[_0x6bc5('0x2f')],_0xddc4a2[_0x6bc5('0x30')]);}else if(_0xddc4a2[_0x6bc5('0x2d')]===_0x6bc5('0x31')){_0x50ac94=util['format'](_0x6bc5('0x32'),_0xddc4a2['username'],_0xddc4a2[_0x6bc5('0x31')]);}return util[_0x6bc5('0xe')](_0x6bc5('0x33'),new Buffer(_0x50ac94)['toString'](_0x6bc5('0x34')));}function request(_0x296013){logger[_0x6bc5('0x35')](_0x6bc5('0x36'),JSON[_0x6bc5('0x37')](_0x296013));return rp(_['defaults'](_0x296013,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4a59c3,_0x1ec5a7){var _0x10d315=[];if(_0x4a59c3&&_0x4a59c3[_0x6bc5('0x38')]>0x0){_0x10d315=_[_0x6bc5('0x39')](_0x4a59c3,_0x1ec5a7);}return _0x10d315;}function getCustomFields(_0x48c931,_0x31b828){var _0x4a0bb9=[];var _0x1ae4b1={'custom_fields':[]};if(_0x48c931['length']>0x0){_['forEach'](_0x48c931,function(_0x22e205){if(_['includes']([_0x6bc5('0x3a'),_0x6bc5('0x3b')],_0x22e205[_0x6bc5('0x3c')])&&_0x22e205[_0x6bc5('0x3d')]&&!_0x22e205[_0x6bc5('0x3e')]){_0x1ae4b1[_0x22e205[_0x6bc5('0x3d')][_0x6bc5('0x3f')]()]=_0x22e205[_0x6bc5('0x40')]['toString']();}else if(_['includes']([_0x6bc5('0x3a'),'picklist'],_0x22e205['type'])&&_0x22e205['idField']&&_0x22e205['customField']){_0x1ae4b1[_0x6bc5('0x41')][_0x6bc5('0x42')]({'id':_0x22e205[_0x6bc5('0x43')],'value':_0x22e205[_0x6bc5('0x40')]['toString']()});}else if(_0x22e205[_0x6bc5('0x3c')]===_0x6bc5('0x44')&&_0x22e205['variableName']&&_0x22e205[_0x6bc5('0x43')]&&_0x22e205[_0x6bc5('0x3e')]){_0x31b828[_0x22e205[_0x6bc5('0x45')]]&&_0x1ae4b1[_0x6bc5('0x41')][_0x6bc5('0x42')]({'id':_0x22e205[_0x6bc5('0x43')],'value':_0x31b828[_0x22e205[_0x6bc5('0x45')]]['toString']()});}else if(_0x22e205[_0x6bc5('0x3c')]===_0x6bc5('0x46')&&_0x22e205[_0x6bc5('0x47')]&&_0x22e205[_0x6bc5('0x47')][_0x6bc5('0x12')]&&_0x22e205[_0x6bc5('0x43')]&&_0x22e205[_0x6bc5('0x3e')]){_0x31b828[_0x22e205['Variable'][_0x6bc5('0x12')][_0x6bc5('0x3f')]()]&&_0x1ae4b1[_0x6bc5('0x41')][_0x6bc5('0x42')]({'id':_0x22e205[_0x6bc5('0x43')],'value':_0x31b828[_0x22e205[_0x6bc5('0x47')][_0x6bc5('0x12')]['toLowerCase']()][_0x6bc5('0x48')]()});}});}return _0x1ae4b1;}exports[_0x6bc5('0x49')]=function(_0x2fa090,_0x30f469,_0x5ce3ac,_0x218511,_0x6108df,_0x4c7551){var _0x21108b,_0x565130;_0x4c7551['remoteUri']=intUtil[_0x6bc5('0x4a')](_0x4c7551['remoteUri']);_0x4c7551[_0x6bc5('0x4b')]=intUtil['stripTrailingSlash'](_0x4c7551['serverUrl']);if(_0x6108df&&_0x6108df[_0x6bc5('0x4c')]){logger[_0x6bc5('0xc')](_0x6bc5('0x4d'),'Recording\x20is\x20enabled!');_0x30f469[_0x6bc5('0x4e')]=util[_0x6bc5('0xe')](_0x6bc5('0x4f'),_0x4c7551[_0x6bc5('0x4b')],_0x30f469[_0x6bc5('0x50')],md5(_0x30f469['uniqueid']));}else{_0x30f469[_0x6bc5('0x4e')]='';}headers[_0x6bc5('0x51')]=getAuth(_0x4c7551);return getUser(_0x4c7551,_0x218511[_0x6bc5('0x52')])[_0x6bc5('0x17')](function(_0x1e7541){_0x21108b=_0x1e7541;logger['info'](_0x6bc5('0x53'),_0x21108b['id']);return getEndUser(_0x4c7551,_0x30f469[_0x6bc5('0x54')],_0x30f469[_0x6bc5('0x55')]);})[_0x6bc5('0x17')](function(_0x5261e0){_0x565130=_0x5261e0;logger[_0x6bc5('0xc')](_0x6bc5('0x56'),_0x565130['id']);return getTicket(_0x4c7551,_0x21108b,_0x565130,_0x5ce3ac,_0x30f469);})[_0x6bc5('0x17')](function(_0x4fdb0a){if(_0x4fdb0a){logger['info'](_0x6bc5('0x57'),_0x4fdb0a['id']);switch(_0x4c7551[_0x6bc5('0x3c')]){case'integrationTab':logger[_0x6bc5('0xc')](_0x6bc5('0x4d'),_0x6bc5('0x58'));return request({'uri':util[_0x6bc5('0xe')](_0x6bc5('0x59'),_0x4c7551[_0x6bc5('0x1c')],_0x21108b['id'],_0x4fdb0a['id']),'method':'POST'});case _0x6bc5('0x5a'):logger['info']('[QUEUE]',_0x6bc5('0x5b'));emit(util['format']('user:%s',_0x218511[_0x6bc5('0x12')]),_0x6bc5('0x5c'),{'uri':util[_0x6bc5('0xe')](_0x6bc5('0x5d'),_0x4c7551[_0x6bc5('0x1c')]['replace']('/api/v2',''),_0x4fdb0a['id'])});break;default:logger[_0x6bc5('0x5e')](_0x6bc5('0x4d'),_0x6bc5('0x5f'));}}})[_0x6bc5('0x60')](function(_0x5419ee){logger['error'](_0x6bc5('0x61'),util[_0x6bc5('0x62')](_0x5419ee,{'showHidden':!![],'depth':null}));});};exports[_0x6bc5('0x63')]=function(_0x44e9f9,_0x25e435,_0x1a7745,_0x166748,_0x259cb8,_0x3ae8a9,_0x2d769c){var _0x6ebeba,_0x35ed50;_0x3ae8a9[_0x6bc5('0x1c')]=intUtil[_0x6bc5('0x4a')](_0x3ae8a9['remoteUri']);_0x3ae8a9[_0x6bc5('0x4b')]=intUtil[_0x6bc5('0x4a')](_0x3ae8a9[_0x6bc5('0x4b')]);if(_0x2d769c&&_0x2d769c['recordingFormat']&&_0x2d769c[_0x6bc5('0x64')]!==_0x6bc5('0x65')){logger['info'](_0x6bc5('0x66'),'Recording\x20is\x20enabled!');_0x25e435['recordingURL']=util[_0x6bc5('0xe')](_0x6bc5('0x4f'),_0x3ae8a9['serverUrl'],_0x25e435[_0x6bc5('0x50')],md5(_0x25e435[_0x6bc5('0x50')]));}headers[_0x6bc5('0x51')]=getAuth(_0x3ae8a9);return getUser(_0x3ae8a9,_0x166748['email'])['then'](function(_0x5c759d){_0x6ebeba=_0x5c759d;logger[_0x6bc5('0xc')](_0x6bc5('0x53'),_0x6ebeba['id']);return getEndUser(_0x3ae8a9,_0x25e435[_0x6bc5('0x67')],_0x25e435[_0x6bc5('0x68')]);})[_0x6bc5('0x17')](function(_0x49960b){_0x35ed50=_0x49960b;logger[_0x6bc5('0xc')](_0x6bc5('0x56'),_0x35ed50['id']);return getTicket(_0x3ae8a9,_0x6ebeba,_0x35ed50,_0x1a7745,_0x25e435);})['then'](function(_0x2b4c99){if(_0x2b4c99){logger[_0x6bc5('0xc')](_0x6bc5('0x57'),_0x2b4c99['id']);switch(_0x3ae8a9[_0x6bc5('0x3c')]){case _0x6bc5('0x69'):logger[_0x6bc5('0xc')](_0x6bc5('0x66'),_0x6bc5('0x58'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3ae8a9['remoteUri'],_0x6ebeba['id'],_0x2b4c99['id']),'method':_0x6bc5('0x10')});case _0x6bc5('0x5a'):logger[_0x6bc5('0xc')]('[OUTBOUND]',_0x6bc5('0x5b'));emit(util['format'](_0x6bc5('0x6a'),_0x166748[_0x6bc5('0x12')]),_0x6bc5('0x5c'),{'uri':util['format'](_0x6bc5('0x5d'),_0x3ae8a9[_0x6bc5('0x1c')][_0x6bc5('0x6b')](_0x6bc5('0x6c'),''),_0x2b4c99['id'])});break;default:logger[_0x6bc5('0x5e')](_0x6bc5('0x66'),_0x6bc5('0x5f'));}}})[_0x6bc5('0x60')](function(_0x195b69){logger['error'](_0x6bc5('0x6d'),util[_0x6bc5('0x62')](_0x195b69,{'showHidden':!![],'depth':null}));});};exports[_0x6bc5('0x6e')]=function(_0x1a384e,_0x431ec6,_0x5a2885,_0x1b77b3,_0x5716d0,_0x29bef7){var _0x27ebd1,_0x44e244;_0x29bef7[_0x6bc5('0x1c')]=intUtil[_0x6bc5('0x4a')](_0x29bef7['remoteUri']);_0x29bef7['serverUrl']=intUtil[_0x6bc5('0x4a')](_0x29bef7[_0x6bc5('0x4b')]);if(_0x5716d0&&_0x5716d0[_0x6bc5('0x4c')]){logger[_0x6bc5('0xc')]('['+_0x431ec6[_0x6bc5('0x6f')][_0x6bc5('0x70')]()+']',_0x6bc5('0x71'));_0x431ec6[_0x6bc5('0x4e')]=util[_0x6bc5('0xe')](_0x6bc5('0x4f'),_0x29bef7['serverUrl'],_0x431ec6[_0x6bc5('0x50')],md5(_0x431ec6['uniqueid']));}else{_0x431ec6[_0x6bc5('0x4e')]='';}headers['Authorization']=getAuth(_0x29bef7);return getUser(_0x29bef7)[_0x6bc5('0x17')](function(_0x21865c){_0x27ebd1=_0x21865c;logger['info']('The\x20User\x20ID\x20is:',_0x27ebd1['id']);return getEndUser(_0x29bef7,_0x431ec6[_0x6bc5('0x54')],_0x431ec6[_0x6bc5('0x55')]);})[_0x6bc5('0x17')](function(_0x1e16c6){_0x44e244=_0x1e16c6;logger['info'](_0x6bc5('0x56'),_0x44e244['id']);return getTicket(_0x29bef7,_0x27ebd1,_0x44e244,_0x5a2885,_0x431ec6);})[_0x6bc5('0x17')](function(_0x3fd085){if(_0x3fd085){logger[_0x6bc5('0xc')](_0x6bc5('0x57'),_0x3fd085['id']);}})[_0x6bc5('0x60')](function(_0x236c46){logger['error']('['+_0x431ec6['lastevent'][_0x6bc5('0x70')]()+']'+_0x6bc5('0x72'),util[_0x6bc5('0x62')](_0x236c46,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xea90=['customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','Authorization','destcalleridname','destcalleridnum','[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','merge','Tags','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','%s:%s','username','password','authType','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','defaults','GET','map','forEach','includes','string','picklist','type','nameField','customField','content','idField','push','variableName','custom_fields'];(function(_0xf4fa86,_0xabc3c){var _0x37f8bc=function(_0x3b62a5){while(--_0x3b62a5){_0xf4fa86['push'](_0xf4fa86['shift']());}};_0x37f8bc(++_0xabc3c);}(_0xea90,0x1f1));var _0x0ea9=function(_0x190b82,_0x183226){_0x190b82=_0x190b82-0x0;var _0x3ef134=_0xea90[_0x190b82];return _0x3ef134;};'use strict';var _=require('lodash');var rp=require(_0x0ea9('0x0'));var md5=require(_0x0ea9('0x1'));var util=require(_0x0ea9('0x2'));var Redis=require(_0x0ea9('0x3'));var intUtil=require(_0x0ea9('0x4'));var config=require(_0x0ea9('0x5'));var logger=require(_0x0ea9('0x6'))(_0x0ea9('0x7'));config[_0x0ea9('0x8')]=_['defaults'](config[_0x0ea9('0x8')],{'host':_0x0ea9('0x9'),'port':0x18eb});var io=require(_0x0ea9('0xa'))(new Redis(config[_0x0ea9('0x8')]));function emit(_0x13b427,_0x5de278,_0x3f99ec){io['to'](_0x13b427)[_0x0ea9('0xb')](_0x5de278,_0x3f99ec);}var headers={'Content-Type':_0x0ea9('0xc'),'Accept':'application/json'};function getTicket(_0x46bd3,_0xecffb8,_0xeea7f9,_0x26afe9,_0x42ae28){logger[_0x0ea9('0xd')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x0ea9('0xe')](_0x0ea9('0xf'),_0x46bd3[_0x0ea9('0x10')]),'method':'POST','body':{'ticket':_[_0x0ea9('0x11')]({'requester_id':_0xeea7f9['id'],'submitter_id':_0xecffb8?_0xecffb8['id']:undefined,'assignee_id':_0xecffb8?_0xecffb8['id']:undefined,'tags':getTags(_0x26afe9[_0x0ea9('0x12')],_0x0ea9('0x13')),'subject':intUtil[_0x0ea9('0x14')](_0x26afe9[_0x0ea9('0x15')],_0x42ae28,'\x20'),'description':intUtil[_0x0ea9('0x14')](_0x26afe9[_0x0ea9('0x16')],_0x42ae28,'\x0a'),'comment':{'public':![],'body':intUtil[_0x0ea9('0x14')](_0x26afe9[_0x0ea9('0x16')],_0x42ae28,'\x0a')}},getCustomFields(_0x26afe9['Fields'],_0x42ae28))}})[_0x0ea9('0x17')](function(_0x353ec6){logger[_0x0ea9('0xd')](_0x0ea9('0x18'));return _0x353ec6[_0x0ea9('0x19')];});}function getUser(_0x3f0467,_0x480c6c){if(intUtil[_0x0ea9('0x1a')](_0x480c6c)){logger[_0x0ea9('0xd')](_0x0ea9('0x1b'),_0x480c6c);return request({'uri':util[_0x0ea9('0xe')](_0x0ea9('0x1c'),_0x3f0467[_0x0ea9('0x10')]),'qs':{'query':util[_0x0ea9('0xe')](_0x0ea9('0x1d'),_0x480c6c)}})[_0x0ea9('0x17')](function(_0x409b5a){if(_0x409b5a[_0x0ea9('0x1e')]){logger[_0x0ea9('0xd')]('Agent\x20found!');return _['find'](_0x409b5a[_0x0ea9('0x1f')],{'email':_0x480c6c,'role':_0x0ea9('0x20')});}else{logger[_0x0ea9('0xd')](_0x0ea9('0x21'));return request({'uri':util[_0x0ea9('0xe')](_0x0ea9('0x22'),_0x3f0467['remoteUri'])})[_0x0ea9('0x17')](function(_0x36970c){logger[_0x0ea9('0xd')]('Admin\x20account\x20selected.');return _0x36970c[_0x0ea9('0x23')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x0ea9('0xe')](_0x0ea9('0x22'),_0x3f0467[_0x0ea9('0x10')])})[_0x0ea9('0x17')](function(_0x3f2816){logger['info'](_0x0ea9('0x24'));return _0x3f2816[_0x0ea9('0x23')];});}}function getEndUser(_0x3c268e,_0x48045c,_0x32bd61){logger[_0x0ea9('0xd')]('Searching\x20enduser\x20with\x20phone',_0x32bd61);return request({'uri':util[_0x0ea9('0xe')](_0x0ea9('0x1c'),_0x3c268e[_0x0ea9('0x10')]),'qs':{'query':util['format'](_0x0ea9('0x25'),_0x32bd61)}})[_0x0ea9('0x17')](function(_0x5e71eb){var _0x58cd06;if(_0x5e71eb[_0x0ea9('0x1f')][_0x0ea9('0x26')]){_0x5e71eb[_0x0ea9('0x1f')]=_[_0x0ea9('0x27')](_0x5e71eb[_0x0ea9('0x1f')],{'suspended':![],'role':_0x0ea9('0x28')});if(_0x5e71eb[_0x0ea9('0x1f')]['length']){_0x58cd06=_['first'](_0x5e71eb[_0x0ea9('0x1f')]);}}if(_0x58cd06){logger[_0x0ea9('0xd')](_0x0ea9('0x29'));return _0x58cd06;}else{logger[_0x0ea9('0xd')](_0x0ea9('0x2a'));return request({'uri':util[_0x0ea9('0xe')](_0x0ea9('0x2b'),_0x3c268e[_0x0ea9('0x10')]),'method':_0x0ea9('0x2c'),'body':{'user':{'role':_0x0ea9('0x28'),'name':util[_0x0ea9('0xe')](_0x0ea9('0x2d'),_0x48045c||_0x32bd61),'phone':_0x32bd61}}})[_0x0ea9('0x17')](function(_0x2f1a5f){logger[_0x0ea9('0xd')](_0x0ea9('0x2e'));return _0x2f1a5f[_0x0ea9('0x23')];});}});}function getAuth(_0x4bc59b){var _0x9e4280;if(_0x4bc59b['authType']==='password'){_0x9e4280=util[_0x0ea9('0xe')](_0x0ea9('0x2f'),_0x4bc59b[_0x0ea9('0x30')],_0x4bc59b[_0x0ea9('0x31')]);}else if(_0x4bc59b[_0x0ea9('0x32')]===_0x0ea9('0x33')){_0x9e4280=util['format'](_0x0ea9('0x34'),_0x4bc59b['username'],_0x4bc59b[_0x0ea9('0x33')]);}return util[_0x0ea9('0xe')](_0x0ea9('0x35'),new Buffer(_0x9e4280)[_0x0ea9('0x36')](_0x0ea9('0x37')));}function request(_0x4be723){logger[_0x0ea9('0x38')](_0x0ea9('0x39'),JSON['stringify'](_0x4be723));return rp(_[_0x0ea9('0x3a')](_0x4be723,{'method':_0x0ea9('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x369587,_0x4049b5){var _0x483daf=[];if(_0x369587&&_0x369587[_0x0ea9('0x26')]>0x0){_0x483daf=_[_0x0ea9('0x3c')](_0x369587,_0x4049b5);}return _0x483daf;}function getCustomFields(_0x2bb2ec,_0x126147){var _0x42c197=[];var _0x3fa3da={'custom_fields':[]};if(_0x2bb2ec['length']>0x0){_[_0x0ea9('0x3d')](_0x2bb2ec,function(_0x412f24){if(_[_0x0ea9('0x3e')]([_0x0ea9('0x3f'),_0x0ea9('0x40')],_0x412f24[_0x0ea9('0x41')])&&_0x412f24[_0x0ea9('0x42')]&&!_0x412f24[_0x0ea9('0x43')]){_0x3fa3da[_0x412f24[_0x0ea9('0x42')]['toLowerCase']()]=_0x412f24[_0x0ea9('0x44')]['toString']();}else if(_['includes']([_0x0ea9('0x3f'),'picklist'],_0x412f24['type'])&&_0x412f24[_0x0ea9('0x45')]&&_0x412f24[_0x0ea9('0x43')]){_0x3fa3da['custom_fields'][_0x0ea9('0x46')]({'id':_0x412f24[_0x0ea9('0x45')],'value':_0x412f24[_0x0ea9('0x44')][_0x0ea9('0x36')]()});}else if(_0x412f24[_0x0ea9('0x41')]==='variable'&&_0x412f24[_0x0ea9('0x47')]&&_0x412f24[_0x0ea9('0x45')]&&_0x412f24[_0x0ea9('0x43')]){_0x126147[_0x412f24[_0x0ea9('0x47')]]&&_0x3fa3da[_0x0ea9('0x48')][_0x0ea9('0x46')]({'id':_0x412f24['idField'],'value':_0x126147[_0x412f24[_0x0ea9('0x47')]][_0x0ea9('0x36')]()});}else if(_0x412f24[_0x0ea9('0x41')]===_0x0ea9('0x49')&&_0x412f24[_0x0ea9('0x4a')]&&_0x412f24[_0x0ea9('0x4a')][_0x0ea9('0x13')]&&_0x412f24[_0x0ea9('0x45')]&&_0x412f24['customField']){_0x126147[_0x412f24[_0x0ea9('0x4a')]['name'][_0x0ea9('0x4b')]()]&&_0x3fa3da[_0x0ea9('0x48')][_0x0ea9('0x46')]({'id':_0x412f24[_0x0ea9('0x45')],'value':_0x126147[_0x412f24[_0x0ea9('0x4a')][_0x0ea9('0x13')][_0x0ea9('0x4b')]()][_0x0ea9('0x36')]()});}});}return _0x3fa3da;}exports[_0x0ea9('0x4c')]=function(_0x25c89a,_0x56c29c,_0x2d67a2,_0x332250,_0x190e72,_0x31a60a){var _0x4623ab,_0x5ec236;_0x31a60a['remoteUri']=intUtil['stripTrailingSlash'](_0x31a60a[_0x0ea9('0x10')]);_0x31a60a['serverUrl']=intUtil[_0x0ea9('0x4d')](_0x31a60a[_0x0ea9('0x4e')]);if(_0x190e72&&_0x190e72['monitor_format']){logger[_0x0ea9('0xd')](_0x0ea9('0x4f'),_0x0ea9('0x50'));_0x56c29c[_0x0ea9('0x51')]=util[_0x0ea9('0xe')](_0x0ea9('0x52'),_0x31a60a[_0x0ea9('0x4e')],_0x56c29c[_0x0ea9('0x53')],md5(_0x56c29c[_0x0ea9('0x53')]));}else{_0x56c29c[_0x0ea9('0x51')]='';}headers['Authorization']=getAuth(_0x31a60a);return getUser(_0x31a60a,_0x332250[_0x0ea9('0x54')])[_0x0ea9('0x17')](function(_0x308ca4){_0x4623ab=_0x308ca4;logger['info'](_0x0ea9('0x55'),_0x4623ab['id']);return getEndUser(_0x31a60a,_0x56c29c[_0x0ea9('0x56')],_0x56c29c['calleridnum']);})['then'](function(_0x39dd0d){_0x5ec236=_0x39dd0d;logger['info'](_0x0ea9('0x57'),_0x5ec236['id']);return getTicket(_0x31a60a,_0x4623ab,_0x5ec236,_0x2d67a2,_0x56c29c);})[_0x0ea9('0x17')](function(_0x39a1d0){if(_0x39a1d0){logger[_0x0ea9('0xd')](_0x0ea9('0x58'),_0x39a1d0['id']);switch(_0x31a60a[_0x0ea9('0x41')]){case _0x0ea9('0x59'):logger[_0x0ea9('0xd')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x0ea9('0xe')](_0x0ea9('0x5a'),_0x31a60a['remoteUri'],_0x4623ab['id'],_0x39a1d0['id']),'method':_0x0ea9('0x2c')});case _0x0ea9('0x5b'):logger[_0x0ea9('0xd')](_0x0ea9('0x4f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x0ea9('0xe')](_0x0ea9('0x5c'),_0x332250[_0x0ea9('0x13')]),_0x0ea9('0x5d'),{'uri':util[_0x0ea9('0xe')](_0x0ea9('0x5e'),_0x31a60a[_0x0ea9('0x10')][_0x0ea9('0x5f')](_0x0ea9('0x60'),''),_0x39a1d0['id'])});break;default:logger[_0x0ea9('0x61')](_0x0ea9('0x4f'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x0ea9('0x62')](function(_0x291973){logger[_0x0ea9('0x61')](_0x0ea9('0x63'),util[_0x0ea9('0x64')](_0x291973,{'showHidden':!![],'depth':null}));});};exports[_0x0ea9('0x65')]=function(_0x2d9ed0,_0x294f7c,_0x44ea4a,_0x16f27d,_0x30ee22,_0x18f46d,_0x29f112){var _0x482387,_0x62049f;_0x18f46d['remoteUri']=intUtil[_0x0ea9('0x4d')](_0x18f46d['remoteUri']);_0x18f46d['serverUrl']=intUtil['stripTrailingSlash'](_0x18f46d['serverUrl']);if(_0x29f112&&_0x29f112[_0x0ea9('0x66')]&&_0x29f112[_0x0ea9('0x66')]!=='none'){logger[_0x0ea9('0xd')]('[OUTBOUND]',_0x0ea9('0x50'));_0x294f7c[_0x0ea9('0x51')]=util[_0x0ea9('0xe')](_0x0ea9('0x52'),_0x18f46d['serverUrl'],_0x294f7c[_0x0ea9('0x53')],md5(_0x294f7c[_0x0ea9('0x53')]));}headers[_0x0ea9('0x67')]=getAuth(_0x18f46d);return getUser(_0x18f46d,_0x16f27d[_0x0ea9('0x54')])[_0x0ea9('0x17')](function(_0x13545a){_0x482387=_0x13545a;logger[_0x0ea9('0xd')]('The\x20User\x20ID\x20is:',_0x482387['id']);return getEndUser(_0x18f46d,_0x294f7c[_0x0ea9('0x68')],_0x294f7c[_0x0ea9('0x69')]);})[_0x0ea9('0x17')](function(_0x68027){_0x62049f=_0x68027;logger[_0x0ea9('0xd')](_0x0ea9('0x57'),_0x62049f['id']);return getTicket(_0x18f46d,_0x482387,_0x62049f,_0x44ea4a,_0x294f7c);})[_0x0ea9('0x17')](function(_0x23a31c){if(_0x23a31c){logger['info'](_0x0ea9('0x58'),_0x23a31c['id']);switch(_0x18f46d['type']){case'integrationTab':logger[_0x0ea9('0xd')](_0x0ea9('0x6a'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x0ea9('0x5a'),_0x18f46d[_0x0ea9('0x10')],_0x482387['id'],_0x23a31c['id']),'method':'POST'});case _0x0ea9('0x5b'):logger[_0x0ea9('0xd')](_0x0ea9('0x6a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x0ea9('0xe')]('user:%s',_0x16f27d['name']),_0x0ea9('0x5d'),{'uri':util[_0x0ea9('0xe')](_0x0ea9('0x5e'),_0x18f46d[_0x0ea9('0x10')]['replace'](_0x0ea9('0x60'),''),_0x23a31c['id'])});break;default:logger['error']('[OUTBOUND]',_0x0ea9('0x6b'));}}})[_0x0ea9('0x62')](function(_0x22ae9b){logger[_0x0ea9('0x61')](_0x0ea9('0x6c'),util['inspect'](_0x22ae9b,{'showHidden':!![],'depth':null}));});};exports[_0x0ea9('0x6d')]=function(_0x6d2dc1,_0x825e9a,_0x2a45e8,_0x3e0cd8,_0x3d09c1,_0x137bff){var _0xbb3636,_0x447363;_0x137bff['remoteUri']=intUtil[_0x0ea9('0x4d')](_0x137bff[_0x0ea9('0x10')]);_0x137bff[_0x0ea9('0x4e')]=intUtil[_0x0ea9('0x4d')](_0x137bff[_0x0ea9('0x4e')]);if(_0x3d09c1&&_0x3d09c1[_0x0ea9('0x6e')]){logger[_0x0ea9('0xd')]('['+_0x825e9a['lastevent'][_0x0ea9('0x6f')]()+']','Recording\x20is\x20enabled!');_0x825e9a['recordingURL']=util[_0x0ea9('0xe')](_0x0ea9('0x52'),_0x137bff[_0x0ea9('0x4e')],_0x825e9a['uniqueid'],md5(_0x825e9a['uniqueid']));}else{_0x825e9a[_0x0ea9('0x51')]='';}headers[_0x0ea9('0x67')]=getAuth(_0x137bff);return getUser(_0x137bff)[_0x0ea9('0x17')](function(_0x2fface){_0xbb3636=_0x2fface;logger[_0x0ea9('0xd')](_0x0ea9('0x55'),_0xbb3636['id']);return getEndUser(_0x137bff,_0x825e9a['calleridname'],_0x825e9a['calleridnum']);})['then'](function(_0x5a41ec){_0x447363=_0x5a41ec;logger['info']('The\x20Enduser\x20ID\x20is:',_0x447363['id']);return getTicket(_0x137bff,_0xbb3636,_0x447363,_0x2a45e8,_0x825e9a);})[_0x0ea9('0x17')](function(_0x5ee25a){if(_0x5ee25a){logger[_0x0ea9('0xd')](_0x0ea9('0x58'),_0x5ee25a['id']);}})[_0x0ea9('0x62')](function(_0x5d5fc3){logger['error']('['+_0x825e9a[_0x0ea9('0x70')][_0x0ea9('0x6f')]()+']'+_0x0ea9('0x71'),util[_0x0ea9('0x64')](_0x5d5fc3,{'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 f47e1ea..2d1a7a0 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 _0xfd7f=['Fields','POST','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','com','destcalleridname','Outbound','toUpperCase','request-promise','md5','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','length','forEach','includes','string','type','idField','toString','variable','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','refreshToken','clientId','clientSecret','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','stringify','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Creating\x20new\x20call...','Owner','administrator','Subjects','Description','getString','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','starttime','format','lastevent','called','Called','complete','connect','Answered','rejected','Call_Result','Rejected','abandoned','Abandoned','timeout','Timeout','agentcalledAt','Call_Type','Inbound','merge'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xfd7f,0xba));var _0xffd7=function(_0xfaa4b5,_0xf6f600){_0xfaa4b5=_0xfaa4b5-0x0;var _0x42316b=_0xfd7f[_0xfaa4b5];return _0x42316b;};'use strict';var _=require('lodash');var rp=require(_0xffd7('0x0'));var md5=require(_0xffd7('0x1'));var util=require('util');var intUtil=require('./util');var moment=require('moment');var Redis=require('ioredis');var BPromise=require(_0xffd7('0x2'));var config=require(_0xffd7('0x3'));var logger=require(_0xffd7('0x4'))(_0xffd7('0x5'));config[_0xffd7('0x6')]=_[_0xffd7('0x7')](config[_0xffd7('0x6')],{'host':_0xffd7('0x8'),'port':0x18eb});var io=require(_0xffd7('0x9'))(new Redis(config[_0xffd7('0x6')]));function emit(_0x509d2a,_0x29dc52,_0x157612){io['to'](_0x509d2a)[_0xffd7('0xa')](_0x29dc52,_0x157612);}function request(_0x4dc800){logger[_0xffd7('0xb')](_0xffd7('0xc'),JSON['stringify'](_0x4dc800));return rp(_0x4dc800);}function getCustomFields(_0x782dd,_0x1d7def){var _0x399c3c={};if(_0x782dd[_0xffd7('0xd')]>0x0){_[_0xffd7('0xe')](_0x782dd,function(_0x53a84e){if(_[_0xffd7('0xf')]([_0xffd7('0x10'),'picklist'],_0x53a84e[_0xffd7('0x11')])&&_0x53a84e['idField']){_0x399c3c[_0x53a84e[_0xffd7('0x12')]]=_0x53a84e['content'][_0xffd7('0x13')]();}else if(_0x53a84e[_0xffd7('0x11')]===_0xffd7('0x14')&&_0x53a84e['variableName']&&_0x53a84e[_0xffd7('0x12')]&&_0x1d7def[_0x53a84e['variableName']]){_0x399c3c[_0x53a84e[_0xffd7('0x12')]]=_0x1d7def[_0x53a84e['variableName']][_0xffd7('0x13')]();}else if(_0x53a84e[_0xffd7('0x11')]==='customVariable'&&_0x53a84e[_0xffd7('0x15')]&&_0x53a84e[_0xffd7('0x15')]['name']&&_0x53a84e[_0xffd7('0x12')]&&_0x1d7def[_0x53a84e[_0xffd7('0x15')][_0xffd7('0x16')][_0xffd7('0x17')]()]){_0x399c3c[_0x53a84e[_0xffd7('0x12')]]=_0x1d7def[_0x53a84e['Variable'][_0xffd7('0x16')][_0xffd7('0x17')]()]['toString']();}});}return _0x399c3c;}function getName(_0x109594){if(_0x109594[_0xffd7('0x18')]('\x20')>0x0){var _0x302bc3=_0x109594['split'](/ (.+)/);if(_0x302bc3[0x1]){return _0x302bc3;}}return[_0x109594,_0x109594];}var accountsTokens={};function getAccessToken(_0x48caee){return new Promise(function(_0x4e7406,_0x12c739){if(!_[_0xffd7('0x19')](accountsTokens[_0x48caee['id']])&&!_['isNil'](accountsTokens[_0x48caee['id']][_0xffd7('0x1a')])){if(moment()[_0xffd7('0x1b')](accountsTokens[_0x48caee['id']][_0xffd7('0x1c')])){_0x4e7406(accountsTokens[_0x48caee['id']]['access_token']);}}var _0x4c4b86;switch(_0x48caee['zone']){case'US':_0x4c4b86=_0xffd7('0x1d');break;case'AU':_0x4c4b86=_0xffd7('0x1e');break;case'EU':_0x4c4b86=_0xffd7('0x1f');break;case'IN':_0x4c4b86=_0xffd7('0x20');break;case'CN':_0x4c4b86=_0xffd7('0x21');break;default:_0x4c4b86=_0xffd7('0x1f');break;}var _0x5438d8={'method':'POST','uri':_0x4c4b86+'/oauth/v2/token','qs':{'refresh_token':_0x48caee[_0xffd7('0x22')],'client_id':_0x48caee[_0xffd7('0x23')],'client_secret':_0x48caee[_0xffd7('0x24')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5438d8)[_0xffd7('0x25')](function(_0x4902ef){accountsTokens[_0x48caee['id']]={'access_token':_0x4902ef[_0xffd7('0x1a')],'expires_in':moment()[_0xffd7('0x26')](_0x4902ef[_0xffd7('0x1c')],_0xffd7('0x27'))};_0x4e7406(_0x4902ef[_0xffd7('0x1a')]);})['catch'](function(_0xbea3cc){logger[_0xffd7('0x28')](_0xffd7('0x29'),_0xbea3cc[_0xffd7('0x2a')]);_0x12c739(_0xbea3cc);});});}function getUser(_0x8f68d3,_0x285968,_0x4cfec1,_0x11052e){logger[_0xffd7('0x2b')](_0xffd7('0x2c'));return request({'method':_0xffd7('0x2d'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x285968),'qs':{'type':_0xffd7('0x2e')},'headers':{'Authorization':_0xffd7('0x2f')+_0x8f68d3},'json':!![]})[_0xffd7('0x25')](function(_0x26a7f3){if(_0x26a7f3[_0xffd7('0x30')]){var _0xacf4d1=-0x1;if(_[_0xffd7('0x31')](_0x26a7f3['users'])){if(!_[_0xffd7('0x19')](_0x11052e)){_0xacf4d1=_['findIndex'](_0x26a7f3[_0xffd7('0x30')],function(_0xd28a2a){return _0xd28a2a[_0xffd7('0x32')]===_0x11052e;});}if(_0xacf4d1>=0x0){logger[_0xffd7('0x2b')](_0xffd7('0x33'));}else{logger[_0xffd7('0x2b')](_0xffd7('0x34'));_0xacf4d1=_['findIndex'](_0x26a7f3[_0xffd7('0x30')],function(_0x56f732){return _0x56f732[_0xffd7('0x35')][_0xffd7('0x16')]===_0xffd7('0x36');});}return _0x26a7f3['users'][_0xacf4d1];}else{if(_0x26a7f3[_0xffd7('0x37')][_0xffd7('0x35')][_0xffd7('0x16')]==='Administrator'){logger[_0xffd7('0x2b')](_0xffd7('0x34'));user=_0x26a7f3[_0xffd7('0x37')];return user;}else{logger[_0xffd7('0x28')](_0xffd7('0x38'),JSON['stringify'](_0x26a7f3));throw new Error(_0xffd7('0x39')+JSON['stringify'](_0x26a7f3));}}}else{logger['error'](_0xffd7('0x38'),JSON[_0xffd7('0x3a')](_0x26a7f3));throw new Error(_0xffd7('0x39')+JSON[_0xffd7('0x3a')](_0x26a7f3));}})[_0xffd7('0x3b')](function(_0xa9b6f2){console[_0xffd7('0x28')](_0xa9b6f2);});}function getZohoUser(_0x3ce896,_0x1b23ab){return new BPromise(function(_0x3db573,_0xb755ce){request(_0x3ce896)[_0xffd7('0x25')](function(_0x2174de){var _0x5253e5=null;if(_0x2174de){_0x5253e5=_0x2174de[_0xffd7('0x3c')][0x0];_0x5253e5[_0xffd7('0x3d')]=_0x1b23ab;}_0x3db573(_0x5253e5);})[_0xffd7('0x3b')](function(_0x242e7a){_0xb755ce(_0x242e7a);});});}function createEndUser(_0x1ff74f,_0x4efc14,_0x26eba4,_0x1c6eae,_0x1f6265,_0x4df156){var _0x26eba4=getName(_0x26eba4);return request({'method':'POST','uri':_0xffd7('0x3e')+_0x4efc14+_0xffd7('0x3f')+_[_0xffd7('0x40')](_0x4df156[_0xffd7('0x41')])+'s','body':{'data':[{'Last_Name':_0x26eba4[0x1],'First_Name':_0x26eba4[0x0],'Phone':_0x1c6eae,'Owner':{'name':!_['isNil'](_0x1f6265[_0xffd7('0x42')][_0xffd7('0x16')])?_0x1f6265['role'][_0xffd7('0x16')]:!_[_0xffd7('0x19')](_0x1f6265['first_name'])?_0x1f6265[_0xffd7('0x43')]+'\x20'+_0x1f6265['last_name']:_0x1f6265[_0xffd7('0x44')],'id':_0x1f6265['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1ff74f},'json':!![]})[_0xffd7('0x25')](function(_0x1b208e){if(_0x1b208e&&_0x1b208e['data'][0x0][_0xffd7('0x45')]===_0xffd7('0x46')){var _0x5c9254=_0x1b208e['data'][0x0][_0xffd7('0x47')];_0x5c9254[_0xffd7('0x3d')]=_['startCase'](_0x4df156[_0xffd7('0x41')])+'s';return _0x5c9254;}logger['error'](_0xffd7('0x38'),JSON['stringify'](data));throw new Error(_0xffd7('0x48')+JSON['stringify'](data));})['catch'](function(_0x19083a){console[_0xffd7('0x49')](_0xffd7('0x4a'),_0x19083a);});}function getEndUser(_0x36dde7,_0xb79666,_0x36a33f,_0x1ffb53,_0x1e1ad2,_0x258734,_0xff3e13){var _0x4bc046={'method':'GET','uri':'','headers':{'Authorization':_0xffd7('0x2f')+_0x36dde7},'json':!![]};switch(_0xff3e13[_0xffd7('0x4b')]){case _0xffd7('0x4c'):_0x4bc046[_0xffd7('0x4d')]=_0xffd7('0x3e')+_0xb79666+_0xffd7('0x4e')+_0x1e1ad2+'))';return getZohoUser(_0x4bc046,_0xffd7('0x4f'))[_0xffd7('0x25')](function(_0x18bfcb){if(_0x18bfcb)return _0x18bfcb;_0x4bc046['uri']=_0xffd7('0x3e')+_0xb79666+_0xffd7('0x50')+_0x1e1ad2+'))';return getZohoUser(_0x4bc046,_0xffd7('0x51'))[_0xffd7('0x25')](function(_0x14cad8){if(_0x14cad8)return _0x14cad8;if(_0xff3e13[_0xffd7('0x41')]!=_0xffd7('0x52')){return createEndUser(_0x36dde7,_0xb79666,_0x1ffb53,_0x1e1ad2,_0x258734,_0xff3e13);}else{return{};}});});break;case _0xffd7('0x53'):_0x4bc046['uri']=_0xffd7('0x3e')+_0xb79666+_0xffd7('0x4e')+_0x1e1ad2+'))';return getZohoUser(_0x4bc046,_0xffd7('0x4f'))[_0xffd7('0x25')](function(_0x2011f0){if(_0x2011f0)return _0x2011f0;if(_0xff3e13[_0xffd7('0x41')]!=_0xffd7('0x52')){return createEndUser(_0x36dde7,_0xb79666,_0x1ffb53,_0x1e1ad2,_0x258734,_0xff3e13);}else{return{};}});break;case'lead':_0x4bc046[_0xffd7('0x4d')]='https://www.zohoapis.'+_0xb79666+_0xffd7('0x50')+_0x1e1ad2+'))';return getZohoUser(_0x4bc046,'Leads')[_0xffd7('0x25')](function(_0x4649ce){if(_0x4649ce)return _0x4649ce;if(_0xff3e13[_0xffd7('0x41')]!=_0xffd7('0x52')){return createEndUser(_0x36dde7,_0xb79666,_0x1ffb53,_0x1e1ad2,_0x258734,_0xff3e13);}else{return{};}});break;}}function getCall(_0x39ba2a,_0x2e000c,_0x3cbb52,_0x49fe2a,_0x4c6ac2,_0xdb6cf3,_0x481835,_0x1c20dc){logger[_0xffd7('0x2b')](_0xffd7('0x54'));var _0x5c7ee4={};_0x5c7ee4[_0xffd7('0x55')]={'name':!_[_0xffd7('0x19')](_0x49fe2a[_0xffd7('0x42')][_0xffd7('0x16')])&&!_[_0xffd7('0x19')](_0x49fe2a[_0xffd7('0x35')]['name'])&&_0x49fe2a['profile'][_0xffd7('0x16')]===_0xffd7('0x56')?_0x49fe2a[_0xffd7('0x42')][_0xffd7('0x16')]:!_[_0xffd7('0x19')](_0x49fe2a['first_name'])?_0x49fe2a[_0xffd7('0x43')]+'\x20'+_0x49fe2a['last_name']:_0x49fe2a[_0xffd7('0x44')],'id':_0x49fe2a['id']};_0x5c7ee4['Subject']=intUtil['getString'](_0xdb6cf3[_0xffd7('0x57')],_0x481835,'\x20');_0x5c7ee4[_0xffd7('0x58')]=intUtil[_0xffd7('0x59')](_0xdb6cf3['Descriptions'],_0x481835,'\x0a');if(_0x4c6ac2[_0xffd7('0x3d')]===_0xffd7('0x4f')){_0x5c7ee4['Who_Id']={'name':!_['isNil'](_0x4c6ac2[_0xffd7('0x5a')])?_0x4c6ac2[_0xffd7('0x5a')]:!_['isNil'](_0x4c6ac2[_0xffd7('0x5b')])?_0x4c6ac2[_0xffd7('0x5b')]+'\x20'+_0x4c6ac2[_0xffd7('0x5c')]:_0x4c6ac2[_0xffd7('0x5c')],'id':_0x4c6ac2['id']};}if(_0x4c6ac2['enduserType']==='Leads'){_0x5c7ee4[_0xffd7('0x5d')]={'name':!_[_0xffd7('0x19')](_0x4c6ac2[_0xffd7('0x5a')])?_0x4c6ac2[_0xffd7('0x5a')]:!_[_0xffd7('0x19')](_0x4c6ac2[_0xffd7('0x5b')])?_0x4c6ac2['First_Name']+'\x20'+_0x4c6ac2[_0xffd7('0x5c')]:_0x4c6ac2['Last_Name'],'id':_0x4c6ac2['id']};_0x5c7ee4[_0xffd7('0x5e')]=_[_0xffd7('0x40')](_0x4c6ac2[_0xffd7('0x3d')]);}if(_0x481835[_0xffd7('0x5f')]){_0x5c7ee4[_0xffd7('0x60')]=moment[_0xffd7('0x61')](parseInt(_0x481835[_0xffd7('0x5f')])*0x3e8)['format'](_0xffd7('0x62'));}else if(_0x481835['answertime']&&_0x481835[_0xffd7('0x63')]){_0x5c7ee4['Call_Duration']=moment['utc'](moment(_0x481835[_0xffd7('0x63')],_0xffd7('0x64'))['diff'](moment(_0x481835[_0xffd7('0x65')],'YYYY-MM-DDTHH:mm:ss')))[_0xffd7('0x66')]('mm:ss');}switch(_0x481835[_0xffd7('0x67')]){case _0xffd7('0x68'):_0x5c7ee4['Call_Result']=_0xffd7('0x69');break;case _0xffd7('0x6a'):case _0xffd7('0x6b'):_0x5c7ee4['Call_Result']=_0xffd7('0x6c');break;case _0xffd7('0x6d'):_0x5c7ee4[_0xffd7('0x6e')]=_0xffd7('0x6f');break;case _0xffd7('0x70'):_0x5c7ee4[_0xffd7('0x6e')]=_0xffd7('0x71');break;case _0xffd7('0x72'):_0x5c7ee4[_0xffd7('0x6e')]=_0xffd7('0x73');default:}_0x5c7ee4['Call_Start_Time']=(_0x1c20dc==='outbound'?moment(_0x481835[_0xffd7('0x65')])[_0xffd7('0x66')](_0xffd7('0x64')):moment(_0x481835[_0xffd7('0x74')])['format']('YYYY-MM-DDTHH:mm:ss'))||moment()[_0xffd7('0x66')](_0xffd7('0x64'));_0x5c7ee4[_0xffd7('0x75')]=_0x1c20dc||_0xffd7('0x76');_0x5c7ee4=_[_0xffd7('0x77')](_0x5c7ee4,getCustomFields(_0xdb6cf3[_0xffd7('0x78')],_0x481835));return request({'method':_0xffd7('0x79'),'uri':_0xffd7('0x3e')+_0x2e000c+'/crm/v2/Calls','headers':{'Authorization':_0xffd7('0x2f')+_0x39ba2a},'body':{'data':[_0x5c7ee4]},'json':!![]})[_0xffd7('0x25')](function(_0x51d237){if(_0x51d237&&_0x51d237['data'][0x0][_0xffd7('0x45')]===_0xffd7('0x46')){logger['info'](_0xffd7('0x7a'));return{'id':_0x51d237[_0xffd7('0x3c')][0x0][_0xffd7('0x47')]['id']};}})[_0xffd7('0x3b')](function(_0x3df8fd){logger[_0xffd7('0x2b')]('err',_0x3df8fd[_0xffd7('0x2a')]);console['log'](_0xffd7('0x7b'),_0x3df8fd);});}exports[_0xffd7('0x7c')]=function(_0x294056,_0x44d8c5,_0x5d4e65,_0x1d049e,_0xa89227,_0x1245b5){var _0x11adbd,_0x2c4f19,_0x56f353;_0x1245b5[_0xffd7('0x7d')]=intUtil[_0xffd7('0x7e')](_0x1245b5[_0xffd7('0x7d')]);_0x1245b5['serverUrl']=intUtil[_0xffd7('0x7e')](_0x1245b5[_0xffd7('0x7f')]);if(_0xa89227&&_0xa89227[_0xffd7('0x80')]){logger[_0xffd7('0x2b')](_0xffd7('0x81'),_0xffd7('0x82'));_0x44d8c5['recordingURL']=_0x1245b5[_0xffd7('0x7f')]+'/api/voice/recordings/'+_0x44d8c5[_0xffd7('0x83')]+_0xffd7('0x84')+md5(_0x44d8c5['uniqueid']);}else{_0x44d8c5[_0xffd7('0x85')]='';}var _0x45681a=_0x1245b5['host']===_0xffd7('0x86')?'eu':'com';return getAccessToken(_0x1245b5)[_0xffd7('0x25')](function(_0x5832f0){_0x56f353=_0x5832f0;return getUser(_0x56f353,_0x45681a,_0x1245b5,_0x1d049e[_0xffd7('0x32')]);})['then'](function(_0x13cbea){_0x11adbd=_0x13cbea;logger[_0xffd7('0x2b')](_0xffd7('0x87'),_0x11adbd['id']);return getEndUser(_0x56f353,_0x45681a,_0x1245b5,_0x44d8c5[_0xffd7('0x88')],_0x44d8c5[_0xffd7('0x89')],_0x11adbd,_0x5d4e65);})[_0xffd7('0x25')](function(_0x505b2a){_0x2c4f19=_0x505b2a;return getCall(_0x56f353,_0x45681a,_0x1245b5,_0x11adbd,_0x2c4f19,_0x5d4e65,_0x44d8c5,_0xffd7('0x76'));})['then'](function(_0x4edfb3){if(_0x4edfb3){logger['info'](_0xffd7('0x8a'),_0x4edfb3['id']);logger[_0xffd7('0x2b')]('[QUEUE]',_0xffd7('0x8b'));emit(util[_0xffd7('0x66')](_0xffd7('0x8c'),_0x1d049e[_0xffd7('0x16')]),_0xffd7('0x8d'),{'uri':_0xffd7('0x8e')+_0x1245b5[_0xffd7('0x7d')]+_0xffd7('0x8f')+_0x4edfb3['id']});}})[_0xffd7('0x3b')](function(_0x244de6){logger[_0xffd7('0x28')]('[QUEUE]',JSON['stringify'](_0x244de6));});};exports[_0xffd7('0x90')]=function(_0xa264fd,_0x1fb6fb,_0x49d037,_0x513872,_0x520d1e,_0x48ea74,_0x1bf399){var _0xd01fc4,_0x49166d,_0x18f4ad;_0x48ea74[_0xffd7('0x7d')]=intUtil[_0xffd7('0x7e')](_0x48ea74['host']);_0x48ea74[_0xffd7('0x7f')]=intUtil['stripTrailingSlash'](_0x48ea74[_0xffd7('0x7f')]);if(_0x1bf399&&_0x1bf399[_0xffd7('0x91')]&&_0x1bf399['recordingFormat']!==_0xffd7('0x92')){logger[_0xffd7('0x2b')](_0xffd7('0x93'),_0xffd7('0x82'));_0x1fb6fb[_0xffd7('0x85')]=_0x48ea74['serverUrl']+_0xffd7('0x94')+_0x1fb6fb['uniqueid']+_0xffd7('0x84')+md5(_0x1fb6fb[_0xffd7('0x83')]);}var _0x536266=_0x48ea74[_0xffd7('0x7d')]==='zoho.eu'?'eu':_0xffd7('0x95');return getAccessToken(_0x48ea74)['then'](function(_0x508293){_0x18f4ad=_0x508293;return getUser(_0x18f4ad,_0x536266,_0x48ea74,_0x513872[_0xffd7('0x32')]);})[_0xffd7('0x25')](function(_0x4f016f){_0xd01fc4=_0x4f016f;logger['info'](_0xffd7('0x87'),_0xd01fc4['id']);return getEndUser(_0x18f4ad,_0x536266,_0x48ea74,_0x1fb6fb[_0xffd7('0x96')],_0x1fb6fb['destcalleridnum'],_0xd01fc4,_0x49d037);})[_0xffd7('0x25')](function(_0x35ae28){_0x49166d=_0x35ae28;return getCall(_0x18f4ad,_0x536266,_0x48ea74,_0xd01fc4,_0x49166d,_0x49d037,_0x1fb6fb,_0xffd7('0x97'));})[_0xffd7('0x25')](function(_0xe519c2){if(_0xe519c2){logger['info'](_0xffd7('0x8a'),_0xe519c2['id']);logger[_0xffd7('0x2b')](_0xffd7('0x93'),_0xffd7('0x8b'));emit(util[_0xffd7('0x66')](_0xffd7('0x8c'),_0x513872[_0xffd7('0x16')]),'trigger:browser:url',{'uri':_0xffd7('0x8e')+_0x48ea74[_0xffd7('0x7d')]+_0xffd7('0x8f')+_0xe519c2['id']});}})[_0xffd7('0x3b')](function(_0x571fb3){logger[_0xffd7('0x28')](_0xffd7('0x93'),JSON['stringify'](_0x571fb3));});};exports['unmanaged']=function(_0x564b15,_0x37c393,_0xfd6bee,_0x4dfb07,_0x2fbfa4,_0x14f75e){var _0x469b72,_0x57b82f,_0x49e28d;_0x14f75e[_0xffd7('0x7d')]=intUtil[_0xffd7('0x7e')](_0x14f75e[_0xffd7('0x7d')]);_0x14f75e['serverUrl']=intUtil[_0xffd7('0x7e')](_0x14f75e[_0xffd7('0x7f')]);if(_0x2fbfa4&&_0x2fbfa4[_0xffd7('0x80')]){logger[_0xffd7('0x2b')]('['+_0x37c393['lastevent'][_0xffd7('0x98')]()+']',_0xffd7('0x82'));_0x37c393['recordingURL']=_0x14f75e[_0xffd7('0x7f')]+'/api/voice/recordings/'+_0x37c393[_0xffd7('0x83')]+_0xffd7('0x84')+md5(_0x37c393[_0xffd7('0x83')]);}else{_0x37c393['recordingURL']='';}var _0x3366c7=_0x14f75e[_0xffd7('0x7d')]==='zoho.eu'?'eu':_0xffd7('0x95');return getAccessToken(_0x14f75e)[_0xffd7('0x25')](function(_0x45ad73){_0x49e28d=_0x45ad73;return getUser(_0x49e28d,_0x3366c7,_0x14f75e);})[_0xffd7('0x25')](function(_0x71a724){_0x469b72=_0x71a724;logger[_0xffd7('0x2b')](_0xffd7('0x87'),_0x469b72['id']);return getEndUser(_0x49e28d,_0x3366c7,_0x14f75e,_0x37c393['calleridname'],_0x37c393[_0xffd7('0x89')],_0x469b72,_0xfd6bee);})[_0xffd7('0x25')](function(_0x35a188){_0x57b82f=_0x35a188;return getCall(_0x49e28d,_0x3366c7,_0x14f75e,_0x469b72,_0x57b82f,_0xfd6bee,_0x37c393,_0xffd7('0x76'));})[_0xffd7('0x25')](function(_0x163ac4){if(_0x163ac4){logger[_0xffd7('0x2b')](_0xffd7('0x8a'),_0x163ac4['id']);}})[_0xffd7('0x3b')](function(_0x180747){logger[_0xffd7('0x28')]('['+_0x37c393[_0xffd7('0x67')][_0xffd7('0x98')]()+']',JSON['stringify'](_0x180747));});}; \ No newline at end of file +var _0x0cad=['stringify','length','forEach','includes','picklist','idField','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','zone','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','refresh_token','then','expires_in','catch','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','SUCCESS','details','moduleCreate','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Contacts','lead','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','starttime','mm:ss','lastevent','called','Call_Result','complete','connect','Answered','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','log','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','none','recordingURL','destcalleridname','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','[OUTBOUND]','unmanaged','toUpperCase','lodash','request-promise','md5','ioredis','../../../../config/logger','zoho','redis','socket.io-emitter','emit','debug','[HTTP]'];(function(_0x422d6a,_0x20d24f){var _0x3bff4b=function(_0x3789a8){while(--_0x3789a8){_0x422d6a['push'](_0x422d6a['shift']());}};_0x3bff4b(++_0x20d24f);}(_0x0cad,0x8c));var _0xd0ca=function(_0x365c78,_0x23ab28){_0x365c78=_0x365c78-0x0;var _0x40d398=_0x0cad[_0x365c78];return _0x40d398;};'use strict';var _=require(_0xd0ca('0x0'));var rp=require(_0xd0ca('0x1'));var md5=require(_0xd0ca('0x2'));var util=require('util');var intUtil=require('./util');var moment=require('moment');var Redis=require(_0xd0ca('0x3'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0xd0ca('0x4'))(_0xd0ca('0x5'));config['redis']=_['defaults'](config[_0xd0ca('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xd0ca('0x7'))(new Redis(config[_0xd0ca('0x6')]));function emit(_0x5340d2,_0x45ee12,_0x43cc33){io['to'](_0x5340d2)[_0xd0ca('0x8')](_0x45ee12,_0x43cc33);}function request(_0x157bc2){logger[_0xd0ca('0x9')](_0xd0ca('0xa'),JSON[_0xd0ca('0xb')](_0x157bc2));return rp(_0x157bc2);}function getCustomFields(_0x368c31,_0x43ca51){var _0x2df09c={};if(_0x368c31[_0xd0ca('0xc')]>0x0){_[_0xd0ca('0xd')](_0x368c31,function(_0x45bf5c){if(_[_0xd0ca('0xe')](['string',_0xd0ca('0xf')],_0x45bf5c['type'])&&_0x45bf5c[_0xd0ca('0x10')]){_0x2df09c[_0x45bf5c[_0xd0ca('0x10')]]=_0x45bf5c['content'][_0xd0ca('0x11')]();}else if(_0x45bf5c[_0xd0ca('0x12')]===_0xd0ca('0x13')&&_0x45bf5c[_0xd0ca('0x14')]&&_0x45bf5c['idField']&&_0x43ca51[_0x45bf5c['variableName']]){_0x2df09c[_0x45bf5c[_0xd0ca('0x10')]]=_0x43ca51[_0x45bf5c[_0xd0ca('0x14')]][_0xd0ca('0x11')]();}else if(_0x45bf5c[_0xd0ca('0x12')]===_0xd0ca('0x15')&&_0x45bf5c[_0xd0ca('0x16')]&&_0x45bf5c['Variable'][_0xd0ca('0x17')]&&_0x45bf5c['idField']&&_0x43ca51[_0x45bf5c['Variable'][_0xd0ca('0x17')][_0xd0ca('0x18')]()]){_0x2df09c[_0x45bf5c[_0xd0ca('0x10')]]=_0x43ca51[_0x45bf5c[_0xd0ca('0x16')][_0xd0ca('0x17')][_0xd0ca('0x18')]()][_0xd0ca('0x11')]();}});}return _0x2df09c;}function getName(_0x44d98d){if(_0x44d98d[_0xd0ca('0x19')]('\x20')>0x0){var _0x44c33c=_0x44d98d[_0xd0ca('0x1a')](/ (.+)/);if(_0x44c33c[0x1]){return _0x44c33c;}}return[_0x44d98d,_0x44d98d];}var accountsTokens={};function getAccessToken(_0x38d306){return new Promise(function(_0x458b4c,_0xfb1964){if(!_[_0xd0ca('0x1b')](accountsTokens[_0x38d306['id']])&&!_[_0xd0ca('0x1b')](accountsTokens[_0x38d306['id']][_0xd0ca('0x1c')])){if(moment()[_0xd0ca('0x1d')](accountsTokens[_0x38d306['id']]['expires_in'])){_0x458b4c(accountsTokens[_0x38d306['id']][_0xd0ca('0x1c')]);}}var _0xdac5a7;switch(_0x38d306[_0xd0ca('0x1e')]){case'US':_0xdac5a7='https://accounts.zoho.com';break;case'AU':_0xdac5a7='https://accounts.zoho.com.au';break;case'EU':_0xdac5a7=_0xd0ca('0x1f');break;case'IN':_0xdac5a7=_0xd0ca('0x20');break;case'CN':_0xdac5a7=_0xd0ca('0x21');break;default:_0xdac5a7=_0xd0ca('0x1f');break;}var _0x24a1d9={'method':_0xd0ca('0x22'),'uri':_0xdac5a7+'/oauth/v2/token','qs':{'refresh_token':_0x38d306[_0xd0ca('0x23')],'client_id':_0x38d306['clientId'],'client_secret':_0x38d306['clientSecret'],'grant_type':_0xd0ca('0x24')},'json':!![]};return rp(_0x24a1d9)[_0xd0ca('0x25')](function(_0x5cdea7){accountsTokens[_0x38d306['id']]={'access_token':_0x5cdea7[_0xd0ca('0x1c')],'expires_in':moment()['add'](_0x5cdea7[_0xd0ca('0x26')],'seconds')};_0x458b4c(_0x5cdea7[_0xd0ca('0x1c')]);})[_0xd0ca('0x27')](function(_0x543e57){logger[_0xd0ca('0x28')]('Failing\x20creating\x20the\x20access_token',_0x543e57[_0xd0ca('0x29')]);_0xfb1964(_0x543e57);});});}function getUser(_0x5f3700,_0x35f0f6,_0x5ac37e,_0x1bc10d){logger[_0xd0ca('0x2a')](_0xd0ca('0x2b'));return request({'method':_0xd0ca('0x2c'),'uri':util[_0xd0ca('0x2d')](_0xd0ca('0x2e'),_0x35f0f6),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xd0ca('0x2f')+_0x5f3700},'json':!![]})[_0xd0ca('0x25')](function(_0x3e66f8){if(_0x3e66f8[_0xd0ca('0x30')]){var _0x50386c=-0x1;if(_[_0xd0ca('0x31')](_0x3e66f8[_0xd0ca('0x30')])){if(!_[_0xd0ca('0x1b')](_0x1bc10d)){_0x50386c=_[_0xd0ca('0x32')](_0x3e66f8[_0xd0ca('0x30')],function(_0x47d6ca){return _0x47d6ca[_0xd0ca('0x33')]===_0x1bc10d;});}if(_0x50386c>=0x0){logger['info'](_0xd0ca('0x34'));}else{logger[_0xd0ca('0x2a')](_0xd0ca('0x35'));_0x50386c=_[_0xd0ca('0x32')](_0x3e66f8[_0xd0ca('0x30')],function(_0x2d0042){return _0x2d0042['profile'][_0xd0ca('0x17')]===_0xd0ca('0x36');});}return _0x3e66f8[_0xd0ca('0x30')][_0x50386c];}else{if(_0x3e66f8[_0xd0ca('0x37')][_0xd0ca('0x38')][_0xd0ca('0x17')]==='Administrator'){logger[_0xd0ca('0x2a')](_0xd0ca('0x35'));user=_0x3e66f8[_0xd0ca('0x37')];return user;}else{logger[_0xd0ca('0x28')](_0xd0ca('0x39'),JSON[_0xd0ca('0xb')](_0x3e66f8));throw new Error(_0xd0ca('0x3a')+JSON[_0xd0ca('0xb')](_0x3e66f8));}}}else{logger['error'](_0xd0ca('0x39'),JSON[_0xd0ca('0xb')](_0x3e66f8));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xd0ca('0xb')](_0x3e66f8));}})[_0xd0ca('0x27')](function(_0x24c575){console[_0xd0ca('0x28')](_0x24c575);});}function getZohoUser(_0x53b64e,_0x1034ed){return new BPromise(function(_0x5a2449,_0x404bc9){request(_0x53b64e)[_0xd0ca('0x25')](function(_0xfc8ada){var _0x152e65=null;if(_0xfc8ada){_0x152e65=_0xfc8ada[_0xd0ca('0x3b')][0x0];_0x152e65[_0xd0ca('0x3c')]=_0x1034ed;}_0x5a2449(_0x152e65);})[_0xd0ca('0x27')](function(_0x2aaadd){_0x404bc9(_0x2aaadd);});});}function createEndUser(_0x3cd3c9,_0x57f191,_0xb47a72,_0x1b9cea,_0x6ffec4,_0x4423d5){var _0xb47a72=getName(_0xb47a72);return request({'method':_0xd0ca('0x22'),'uri':_0xd0ca('0x3d')+_0x57f191+_0xd0ca('0x3e')+_[_0xd0ca('0x3f')](_0x4423d5['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0xb47a72[0x1],'First_Name':_0xb47a72[0x0],'Phone':_0x1b9cea,'Owner':{'name':!_[_0xd0ca('0x1b')](_0x6ffec4[_0xd0ca('0x40')][_0xd0ca('0x17')])?_0x6ffec4[_0xd0ca('0x40')]['name']:!_[_0xd0ca('0x1b')](_0x6ffec4[_0xd0ca('0x41')])?_0x6ffec4[_0xd0ca('0x41')]+'\x20'+_0x6ffec4[_0xd0ca('0x42')]:_0x6ffec4['last_name'],'id':_0x6ffec4['id']}}]},'headers':{'Authorization':_0xd0ca('0x2f')+_0x3cd3c9},'json':!![]})[_0xd0ca('0x25')](function(_0x2856a2){if(_0x2856a2&&_0x2856a2['data'][0x0][_0xd0ca('0x43')]===_0xd0ca('0x44')){var _0x12b141=_0x2856a2[_0xd0ca('0x3b')][0x0][_0xd0ca('0x45')];_0x12b141['enduserType']=_[_0xd0ca('0x3f')](_0x4423d5[_0xd0ca('0x46')])+'s';return _0x12b141;}logger[_0xd0ca('0x28')](_0xd0ca('0x39'),JSON[_0xd0ca('0xb')](data));throw new Error(_0xd0ca('0x47')+JSON[_0xd0ca('0xb')](data));})[_0xd0ca('0x27')](function(_0x48ee0d){console['log'](_0xd0ca('0x48'),_0x48ee0d);});}function getEndUser(_0x4ad557,_0x18ed4c,_0x3bb346,_0x2dbd86,_0x30b367,_0x5a436b,_0x48ca74){var _0x39f8e3={'method':'GET','uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4ad557},'json':!![]};switch(_0x48ca74[_0xd0ca('0x49')]){case _0xd0ca('0x4a'):_0x39f8e3[_0xd0ca('0x4b')]=_0xd0ca('0x3d')+_0x18ed4c+_0xd0ca('0x4c')+_0x30b367+'))';return getZohoUser(_0x39f8e3,'Contacts')[_0xd0ca('0x25')](function(_0x24f2f8){if(_0x24f2f8)return _0x24f2f8;_0x39f8e3['uri']='https://www.zohoapis.'+_0x18ed4c+_0xd0ca('0x4d')+_0x30b367+'))';return getZohoUser(_0x39f8e3,_0xd0ca('0x4e'))['then'](function(_0x135ff9){if(_0x135ff9)return _0x135ff9;if(_0x48ca74[_0xd0ca('0x46')]!=_0xd0ca('0x4f')){return createEndUser(_0x4ad557,_0x18ed4c,_0x2dbd86,_0x30b367,_0x5a436b,_0x48ca74);}else{return{};}});});break;case _0xd0ca('0x50'):_0x39f8e3['uri']='https://www.zohoapis.'+_0x18ed4c+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x30b367+'))';return getZohoUser(_0x39f8e3,_0xd0ca('0x51'))[_0xd0ca('0x25')](function(_0x37d49f){if(_0x37d49f)return _0x37d49f;if(_0x48ca74[_0xd0ca('0x46')]!=_0xd0ca('0x4f')){return createEndUser(_0x4ad557,_0x18ed4c,_0x2dbd86,_0x30b367,_0x5a436b,_0x48ca74);}else{return{};}});break;case _0xd0ca('0x52'):_0x39f8e3[_0xd0ca('0x4b')]='https://www.zohoapis.'+_0x18ed4c+_0xd0ca('0x4d')+_0x30b367+'))';return getZohoUser(_0x39f8e3,'Leads')['then'](function(_0x22cd6c){if(_0x22cd6c)return _0x22cd6c;if(_0x48ca74[_0xd0ca('0x46')]!=_0xd0ca('0x4f')){return createEndUser(_0x4ad557,_0x18ed4c,_0x2dbd86,_0x30b367,_0x5a436b,_0x48ca74);}else{return{};}});break;}}function getCall(_0x1f6299,_0x43a72a,_0x578670,_0x19bad2,_0x557bb3,_0xfa1f2f,_0x4b0b00,_0x1f4070){logger[_0xd0ca('0x2a')]('Creating\x20new\x20call...');var _0x1c6a7d={};_0x1c6a7d[_0xd0ca('0x53')]={'name':!_['isNil'](_0x19bad2[_0xd0ca('0x40')][_0xd0ca('0x17')])&&!_['isNil'](_0x19bad2['profile'][_0xd0ca('0x17')])&&_0x19bad2[_0xd0ca('0x38')][_0xd0ca('0x17')]===_0xd0ca('0x54')?_0x19bad2[_0xd0ca('0x40')][_0xd0ca('0x17')]:!_[_0xd0ca('0x1b')](_0x19bad2['first_name'])?_0x19bad2[_0xd0ca('0x41')]+'\x20'+_0x19bad2[_0xd0ca('0x42')]:_0x19bad2[_0xd0ca('0x42')],'id':_0x19bad2['id']};_0x1c6a7d[_0xd0ca('0x55')]=intUtil[_0xd0ca('0x56')](_0xfa1f2f[_0xd0ca('0x57')],_0x4b0b00,'\x20');_0x1c6a7d[_0xd0ca('0x58')]=intUtil['getString'](_0xfa1f2f[_0xd0ca('0x59')],_0x4b0b00,'\x0a');if(_0x557bb3[_0xd0ca('0x3c')]===_0xd0ca('0x51')){_0x1c6a7d['Who_Id']={'name':!_[_0xd0ca('0x1b')](_0x557bb3[_0xd0ca('0x5a')])?_0x557bb3[_0xd0ca('0x5a')]:!_[_0xd0ca('0x1b')](_0x557bb3[_0xd0ca('0x5b')])?_0x557bb3[_0xd0ca('0x5b')]+'\x20'+_0x557bb3[_0xd0ca('0x5c')]:_0x557bb3['Last_Name'],'id':_0x557bb3['id']};}if(_0x557bb3[_0xd0ca('0x3c')]===_0xd0ca('0x4e')){_0x1c6a7d[_0xd0ca('0x5d')]={'name':!_[_0xd0ca('0x1b')](_0x557bb3[_0xd0ca('0x5a')])?_0x557bb3[_0xd0ca('0x5a')]:!_[_0xd0ca('0x1b')](_0x557bb3[_0xd0ca('0x5b')])?_0x557bb3[_0xd0ca('0x5b')]+'\x20'+_0x557bb3[_0xd0ca('0x5c')]:_0x557bb3[_0xd0ca('0x5c')],'id':_0x557bb3['id']};_0x1c6a7d[_0xd0ca('0x5e')]=_[_0xd0ca('0x3f')](_0x557bb3[_0xd0ca('0x3c')]);}if(_0x4b0b00[_0xd0ca('0x5f')]){_0x1c6a7d[_0xd0ca('0x60')]=moment['utc'](parseInt(_0x4b0b00['talktime'])*0x3e8)[_0xd0ca('0x2d')]('mm:ss');}else if(_0x4b0b00[_0xd0ca('0x61')]&&_0x4b0b00[_0xd0ca('0x62')]){_0x1c6a7d[_0xd0ca('0x60')]=moment[_0xd0ca('0x63')](moment(_0x4b0b00[_0xd0ca('0x62')],_0xd0ca('0x64'))['diff'](moment(_0x4b0b00[_0xd0ca('0x65')],_0xd0ca('0x64'))))[_0xd0ca('0x2d')](_0xd0ca('0x66'));}switch(_0x4b0b00[_0xd0ca('0x67')]){case _0xd0ca('0x68'):_0x1c6a7d[_0xd0ca('0x69')]='Called';break;case _0xd0ca('0x6a'):case _0xd0ca('0x6b'):_0x1c6a7d[_0xd0ca('0x69')]=_0xd0ca('0x6c');break;case _0xd0ca('0x6d'):_0x1c6a7d[_0xd0ca('0x69')]=_0xd0ca('0x6e');break;case'abandoned':_0x1c6a7d[_0xd0ca('0x69')]=_0xd0ca('0x6f');break;case _0xd0ca('0x70'):_0x1c6a7d[_0xd0ca('0x69')]=_0xd0ca('0x71');default:}_0x1c6a7d[_0xd0ca('0x72')]=(_0x1f4070===_0xd0ca('0x73')?moment(_0x4b0b00[_0xd0ca('0x65')])['format'](_0xd0ca('0x64')):moment(_0x4b0b00[_0xd0ca('0x74')])['format'](_0xd0ca('0x64')))||moment()[_0xd0ca('0x2d')](_0xd0ca('0x64'));_0x1c6a7d['Call_Type']=_0x1f4070||_0xd0ca('0x75');_0x1c6a7d=_[_0xd0ca('0x76')](_0x1c6a7d,getCustomFields(_0xfa1f2f[_0xd0ca('0x77')],_0x4b0b00));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x43a72a+_0xd0ca('0x78'),'headers':{'Authorization':_0xd0ca('0x2f')+_0x1f6299},'body':{'data':[_0x1c6a7d]},'json':!![]})[_0xd0ca('0x25')](function(_0x122026){if(_0x122026&&_0x122026[_0xd0ca('0x3b')][0x0][_0xd0ca('0x43')]===_0xd0ca('0x44')){logger[_0xd0ca('0x2a')](_0xd0ca('0x79'));return{'id':_0x122026[_0xd0ca('0x3b')][0x0][_0xd0ca('0x45')]['id']};}})['catch'](function(_0x453fad){logger['info'](_0xd0ca('0x7a'),_0x453fad[_0xd0ca('0x29')]);console[_0xd0ca('0x7b')](_0xd0ca('0x7a'),_0x453fad);});}exports[_0xd0ca('0x7c')]=function(_0x48808c,_0x480260,_0x140342,_0x5198d8,_0x5da912,_0x485769){var _0x273454,_0x5e6018,_0x1012e0;_0x485769[_0xd0ca('0x7d')]=intUtil['stripTrailingSlash'](_0x485769[_0xd0ca('0x7d')]);_0x485769[_0xd0ca('0x7e')]=intUtil[_0xd0ca('0x7f')](_0x485769[_0xd0ca('0x7e')]);if(_0x5da912&&_0x5da912[_0xd0ca('0x80')]){logger[_0xd0ca('0x2a')](_0xd0ca('0x81'),_0xd0ca('0x82'));_0x480260['recordingURL']=_0x485769[_0xd0ca('0x7e')]+_0xd0ca('0x83')+_0x480260['uniqueid']+_0xd0ca('0x84')+md5(_0x480260[_0xd0ca('0x85')]);}else{_0x480260['recordingURL']='';}var _0x57c4a6=_0x485769[_0xd0ca('0x7d')]===_0xd0ca('0x86')?'eu':_0xd0ca('0x87');return getAccessToken(_0x485769)[_0xd0ca('0x25')](function(_0x556590){_0x1012e0=_0x556590;return getUser(_0x1012e0,_0x57c4a6,_0x485769,_0x5198d8['email']);})['then'](function(_0x566d29){_0x273454=_0x566d29;logger['info'](_0xd0ca('0x88'),_0x273454['id']);return getEndUser(_0x1012e0,_0x57c4a6,_0x485769,_0x480260[_0xd0ca('0x89')],_0x480260[_0xd0ca('0x8a')],_0x273454,_0x140342);})[_0xd0ca('0x25')](function(_0x51834a){_0x5e6018=_0x51834a;return getCall(_0x1012e0,_0x57c4a6,_0x485769,_0x273454,_0x5e6018,_0x140342,_0x480260,_0xd0ca('0x75'));})[_0xd0ca('0x25')](function(_0xe9b3aa){if(_0xe9b3aa){logger[_0xd0ca('0x2a')](_0xd0ca('0x8b'),_0xe9b3aa['id']);logger[_0xd0ca('0x2a')](_0xd0ca('0x81'),_0xd0ca('0x8c'));emit(util[_0xd0ca('0x2d')](_0xd0ca('0x8d'),_0x5198d8[_0xd0ca('0x17')]),'trigger:browser:url',{'uri':_0xd0ca('0x8e')+_0x485769[_0xd0ca('0x7d')]+'/crm/EntityInfo.do?module=Calls&id='+_0xe9b3aa['id']});}})['catch'](function(_0x4ae7e5){logger[_0xd0ca('0x28')]('[QUEUE]',JSON[_0xd0ca('0xb')](_0x4ae7e5));});};exports[_0xd0ca('0x73')]=function(_0x27e220,_0x481e96,_0x25e0c2,_0x12ce1e,_0x46d47a,_0x686371,_0x5d5955){var _0x1df6c9,_0xa18a5b,_0xd49fa1;_0x686371[_0xd0ca('0x7d')]=intUtil[_0xd0ca('0x7f')](_0x686371['host']);_0x686371[_0xd0ca('0x7e')]=intUtil[_0xd0ca('0x7f')](_0x686371[_0xd0ca('0x7e')]);if(_0x5d5955&&_0x5d5955['recordingFormat']&&_0x5d5955['recordingFormat']!==_0xd0ca('0x8f')){logger['info']('[OUTBOUND]',_0xd0ca('0x82'));_0x481e96[_0xd0ca('0x90')]=_0x686371['serverUrl']+_0xd0ca('0x83')+_0x481e96['uniqueid']+_0xd0ca('0x84')+md5(_0x481e96[_0xd0ca('0x85')]);}var _0x216074=_0x686371[_0xd0ca('0x7d')]===_0xd0ca('0x86')?'eu':_0xd0ca('0x87');return getAccessToken(_0x686371)[_0xd0ca('0x25')](function(_0x1de547){_0xd49fa1=_0x1de547;return getUser(_0xd49fa1,_0x216074,_0x686371,_0x12ce1e[_0xd0ca('0x33')]);})['then'](function(_0x17fb47){_0x1df6c9=_0x17fb47;logger['info'](_0xd0ca('0x88'),_0x1df6c9['id']);return getEndUser(_0xd49fa1,_0x216074,_0x686371,_0x481e96[_0xd0ca('0x91')],_0x481e96['destcalleridnum'],_0x1df6c9,_0x25e0c2);})[_0xd0ca('0x25')](function(_0x2dc3f3){_0xa18a5b=_0x2dc3f3;return getCall(_0xd49fa1,_0x216074,_0x686371,_0x1df6c9,_0xa18a5b,_0x25e0c2,_0x481e96,'Outbound');})[_0xd0ca('0x25')](function(_0x50d75d){if(_0x50d75d){logger['info'](_0xd0ca('0x8b'),_0x50d75d['id']);logger['info']('[OUTBOUND]',_0xd0ca('0x8c'));emit(util[_0xd0ca('0x2d')]('user:%s',_0x12ce1e['name']),_0xd0ca('0x92'),{'uri':_0xd0ca('0x8e')+_0x686371['host']+_0xd0ca('0x93')+_0x50d75d['id']});}})[_0xd0ca('0x27')](function(_0x34378f){logger[_0xd0ca('0x28')](_0xd0ca('0x94'),JSON[_0xd0ca('0xb')](_0x34378f));});};exports[_0xd0ca('0x95')]=function(_0x111de3,_0x23375d,_0xbdf589,_0xea4557,_0xcc655,_0x508669){var _0x24a295,_0x5b5a05,_0x4c6ae0;_0x508669[_0xd0ca('0x7d')]=intUtil[_0xd0ca('0x7f')](_0x508669[_0xd0ca('0x7d')]);_0x508669[_0xd0ca('0x7e')]=intUtil[_0xd0ca('0x7f')](_0x508669[_0xd0ca('0x7e')]);if(_0xcc655&&_0xcc655['monitor_format']){logger['info']('['+_0x23375d[_0xd0ca('0x67')][_0xd0ca('0x96')]()+']',_0xd0ca('0x82'));_0x23375d['recordingURL']=_0x508669[_0xd0ca('0x7e')]+_0xd0ca('0x83')+_0x23375d[_0xd0ca('0x85')]+'/downloads?type=uniqueid&token='+md5(_0x23375d['uniqueid']);}else{_0x23375d[_0xd0ca('0x90')]='';}var _0x82cd31=_0x508669[_0xd0ca('0x7d')]===_0xd0ca('0x86')?'eu':_0xd0ca('0x87');return getAccessToken(_0x508669)['then'](function(_0x4b620d){_0x4c6ae0=_0x4b620d;return getUser(_0x4c6ae0,_0x82cd31,_0x508669);})[_0xd0ca('0x25')](function(_0x516624){_0x24a295=_0x516624;logger[_0xd0ca('0x2a')](_0xd0ca('0x88'),_0x24a295['id']);return getEndUser(_0x4c6ae0,_0x82cd31,_0x508669,_0x23375d['calleridname'],_0x23375d[_0xd0ca('0x8a')],_0x24a295,_0xbdf589);})[_0xd0ca('0x25')](function(_0x4332f7){_0x5b5a05=_0x4332f7;return getCall(_0x4c6ae0,_0x82cd31,_0x508669,_0x24a295,_0x5b5a05,_0xbdf589,_0x23375d,_0xd0ca('0x75'));})[_0xd0ca('0x25')](function(_0x5ade6a){if(_0x5ade6a){logger[_0xd0ca('0x2a')]('The\x20Call\x20ID\x20is:',_0x5ade6a['id']);}})[_0xd0ca('0x27')](function(_0x45e0e1){logger[_0xd0ca('0x28')]('['+_0x23375d[_0xd0ca('0x67')][_0xd0ca('0x96')]()+']',JSON[_0xd0ca('0xb')](_0x45e0e1));});}; \ 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 de57304..7d63b96 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 _0x6588=['../../../../config/logger','trigger','exec','data2','Script','data3','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format'];(function(_0x29df9a,_0x42aff3){var _0x3a8e96=function(_0x70fbe7){while(--_0x70fbe7){_0x29df9a['push'](_0x29df9a['shift']());}};_0x3a8e96(++_0x42aff3);}(_0x6588,0x1a4));var _0x8658=function(_0x44dba1,_0x270ad5){_0x44dba1=_0x44dba1-0x0;var _0x2fbd3f=_0x6588[_0x44dba1];return _0x2fbd3f;};'use strict';var util=require('util');var sh=require('shelljs');var Mustache=require('mustache');var logger=require(_0x8658('0x0'))(_0x8658('0x1'));exports[_0x8658('0x2')]=function(_0x42531d,_0x5d4b2e){var _0x564b06=_0x42531d[_0x8658('0x3')]?_0x42531d['data2']:_0x8658('0x4');var _0x565d4c=_0x42531d[_0x8658('0x5')]?Mustache['render'](_0x42531d[_0x8658('0x5')],_0x5d4b2e):_0x5d4b2e;sh['exec'](_0x565d4c,function(_0x15b365,_0x32353a,_0x112b1b){if(_0x15b365!==0x0){logger[_0x8658('0x6')](util['format'](_0x8658('0x7'),_0x564b06,_0x565d4c,_0x15b365,_0x112b1b));}else{logger[_0x8658('0x8')](util[_0x8658('0x9')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x564b06,_0x565d4c,_0x32353a));}});}; \ No newline at end of file +var _0xe2d8=['data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','mustache','../../../../config/logger','exec'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0xe2d8,0xe6));var _0x8e2d=function(_0x55c937,_0x4136f7){_0x55c937=_0x55c937-0x0;var _0xc45fad=_0xe2d8[_0x55c937];return _0xc45fad;};'use strict';var util=require(_0x8e2d('0x0'));var sh=require('shelljs');var Mustache=require(_0x8e2d('0x1'));var logger=require(_0x8e2d('0x2'))('trigger');exports[_0x8e2d('0x3')]=function(_0xec357,_0x32ad0e){var _0x498e6f=_0xec357[_0x8e2d('0x4')]?_0xec357[_0x8e2d('0x4')]:_0x8e2d('0x5');var _0x25c55d=_0xec357[_0x8e2d('0x6')]?Mustache[_0x8e2d('0x7')](_0xec357['data3'],_0x32ad0e):_0x32ad0e;sh['exec'](_0x25c55d,function(_0x478dea,_0x2b3725,_0x1b46fd){if(_0x478dea!==0x0){logger[_0x8e2d('0x8')](util[_0x8e2d('0x9')](_0x8e2d('0xa'),_0x498e6f,_0x25c55d,_0x478dea,_0x1b46fd));}else{logger[_0x8e2d('0xb')](util[_0x8e2d('0x9')](_0x8e2d('0xc'),_0x498e6f,_0x25c55d,_0x2b3725));}});}; \ 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 d92c69a..4b3d275 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 _0xc706=['%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data2','data5','headers','data6','data1','data7','parse','body','error','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch'];(function(_0xe25a3b,_0x2cde69){var _0x550c0f=function(_0x44cffd){while(--_0x44cffd){_0xe25a3b['push'](_0xe25a3b['shift']());}};_0x550c0f(++_0x2cde69);}(_0xc706,0x15e));var _0x6c70=function(_0x1c31fc,_0x39514d){_0x1c31fc=_0x1c31fc-0x0;var _0x400ade=_0xc706[_0x1c31fc];return _0x400ade;};'use strict';var rp=require(_0x6c70('0x0'));var util=require('util');var _=require(_0x6c70('0x1'));var Mustache=require(_0x6c70('0x2'));var logger=require(_0x6c70('0x3'))('trigger');exports[_0x6c70('0x4')]=function(_0x5a8d9e,_0x593a69){var _0x599475,_0x14b9fe;var _0x570746={'method':_0x5a8d9e['data1'][_0x6c70('0x5')](),'uri':Mustache[_0x6c70('0x6')](_0x5a8d9e[_0x6c70('0x7')],_0x593a69),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5a8d9e[_0x6c70('0x8')])==='number'&&parseInt(_0x5a8d9e[_0x6c70('0x8')])>=0x1&&parseInt(_0x5a8d9e['data5'])<=0xa?parseInt(_0x5a8d9e['data5'])*0x3e8:0x5*0x3e8};try{_0x570746[_0x6c70('0x9')]=_0x5a8d9e['data6']?JSON['parse'](Mustache[_0x6c70('0x6')](_0x5a8d9e[_0x6c70('0xa')],_0x593a69)):{};}catch(_0x15b8cd){logger['error'](_0x15b8cd['stack']);}switch(_0x5a8d9e[_0x6c70('0xb')]['toUpperCase']()){case'GET':case'DELETE':_0x599475=null;_0x570746['qs']=_0x593a69;break;case'POST':case'PUT':if(_0x5a8d9e[_0x6c70('0xc')]){try{_0x599475=JSON[_0x6c70('0xd')](Mustache[_0x6c70('0x6')](_0x5a8d9e[_0x6c70('0xc')],_0x593a69));_0x570746[_0x6c70('0xe')]=_0x599475;}catch(_0x31cc08){logger['error'](_0x31cc08['stack']);logger[_0x6c70('0xf')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x599475=_0x593a69;_0x570746[_0x6c70('0xe')]=_0x599475;}break;}logger[_0x6c70('0x10')](util['format'](_0x6c70('0x11'),_0x5a8d9e[_0x6c70('0xb')],_0x5a8d9e[_0x6c70('0x7')],JSON[_0x6c70('0x12')](_0x570746)));rp(_0x570746)[_0x6c70('0x13')](function(_0x1a200c){_0x599475=!_[_0x6c70('0x14')](_0x599475)?_0x6c70('0x15')+_0x599475:'';_0x14b9fe=typeof _0x1a200c['body']===_0x6c70('0x16')?JSON[_0x6c70('0x12')](_0x1a200c[_0x6c70('0xe')]):_0x1a200c[_0x6c70('0xe')];logger[_0x6c70('0x10')](util[_0x6c70('0x17')](_0x6c70('0x18'),_0x5a8d9e[_0x6c70('0xb')],_0x5a8d9e[_0x6c70('0x7')],_0x1a200c[_0x6c70('0x19')],_0x14b9fe));})[_0x6c70('0x1a')](function(_0x304e26){logger[_0x6c70('0xf')](util[_0x6c70('0x17')](_0x6c70('0x1b'),_0x5a8d9e[_0x6c70('0xb')],_0x5a8d9e['data2'],_0x304e26[_0x6c70('0x19')],_0x304e26[_0x6c70('0x1c')],_0x304e26['message']));});}; \ No newline at end of file +var _0xb615=['catch','name','message','util','lodash','mustache','exec','toUpperCase','render','data2','data5','headers','data6','parse','error','data1','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'];(function(_0x42e3a0,_0x983ac0){var _0x2281a2=function(_0x1b4af0){while(--_0x1b4af0){_0x42e3a0['push'](_0x42e3a0['shift']());}};_0x2281a2(++_0x983ac0);}(_0xb615,0xe3));var _0x5b61=function(_0x27d265,_0x1ba6c0){_0x27d265=_0x27d265-0x0;var _0xfed3a9=_0xb615[_0x27d265];return _0xfed3a9;};'use strict';var rp=require('request-promise');var util=require(_0x5b61('0x0'));var _=require(_0x5b61('0x1'));var Mustache=require(_0x5b61('0x2'));var logger=require('../../../../config/logger')('trigger');exports[_0x5b61('0x3')]=function(_0x20a9d8,_0x2c70aa){var _0x4bacd5,_0x337f46;var _0xb604e9={'method':_0x20a9d8['data1'][_0x5b61('0x4')](),'uri':Mustache[_0x5b61('0x5')](_0x20a9d8[_0x5b61('0x6')],_0x2c70aa),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x20a9d8[_0x5b61('0x7')])==='number'&&parseInt(_0x20a9d8[_0x5b61('0x7')])>=0x1&&parseInt(_0x20a9d8[_0x5b61('0x7')])<=0xa?parseInt(_0x20a9d8['data5'])*0x3e8:0x5*0x3e8};try{_0xb604e9[_0x5b61('0x8')]=_0x20a9d8[_0x5b61('0x9')]?JSON[_0x5b61('0xa')](Mustache[_0x5b61('0x5')](_0x20a9d8[_0x5b61('0x9')],_0x2c70aa)):{};}catch(_0x362fb1){logger[_0x5b61('0xb')](_0x362fb1['stack']);}switch(_0x20a9d8[_0x5b61('0xc')][_0x5b61('0x4')]()){case _0x5b61('0xd'):case _0x5b61('0xe'):_0x4bacd5=null;_0xb604e9['qs']=_0x2c70aa;break;case _0x5b61('0xf'):case _0x5b61('0x10'):if(_0x20a9d8[_0x5b61('0x11')]){try{_0x4bacd5=JSON['parse'](Mustache['render'](_0x20a9d8[_0x5b61('0x11')],_0x2c70aa));_0xb604e9[_0x5b61('0x12')]=_0x4bacd5;}catch(_0x2d9e29){logger[_0x5b61('0xb')](_0x2d9e29[_0x5b61('0x13')]);logger[_0x5b61('0xb')](_0x5b61('0x14'));}}else{_0x4bacd5=_0x2c70aa;_0xb604e9['body']=_0x4bacd5;}break;}logger[_0x5b61('0x15')](util[_0x5b61('0x16')](_0x5b61('0x17'),_0x20a9d8[_0x5b61('0xc')],_0x20a9d8[_0x5b61('0x6')],JSON[_0x5b61('0x18')](_0xb604e9)));rp(_0xb604e9)[_0x5b61('0x19')](function(_0x3ddaf4){_0x4bacd5=!_[_0x5b61('0x1a')](_0x4bacd5)?_0x5b61('0x1b')+_0x4bacd5:'';_0x337f46=typeof _0x3ddaf4['body']===_0x5b61('0x1c')?JSON[_0x5b61('0x18')](_0x3ddaf4[_0x5b61('0x12')]):_0x3ddaf4[_0x5b61('0x12')];logger['info'](util[_0x5b61('0x16')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x20a9d8[_0x5b61('0xc')],_0x20a9d8[_0x5b61('0x6')],_0x3ddaf4['statusCode'],_0x337f46));})[_0x5b61('0x1d')](function(_0x5b8a49){logger[_0x5b61('0xb')](util[_0x5b61('0x16')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x20a9d8['data1'],_0x20a9d8[_0x5b61('0x6')],_0x5b8a49['statusCode'],_0x5b8a49[_0x5b61('0x1e')],_0x5b8a49[_0x5b61('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index dbc60cf..ab067da 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 _0x0f77=['message','result','catch','exports','jayson/promise','bluebird','routing','client','request','then','debug','rpc','error'];(function(_0x526f31,_0x802c39){var _0x302d3b=function(_0x3b81c7){while(--_0x3b81c7){_0x526f31['push'](_0x526f31['shift']());}};_0x302d3b(++_0x802c39);}(_0x0f77,0x1be));var _0x70f7=function(_0x18d3e5,_0x58eb9e){_0x18d3e5=_0x18d3e5-0x0;var _0x160fd7=_0x0f77[_0x18d3e5];return _0x160fd7;};'use strict';var jayson=require(_0x70f7('0x0'));var BPromise=require(_0x70f7('0x1'));var logger=require('../../config/logger')(_0x70f7('0x2'));var client=jayson[_0x70f7('0x3')]['http']({'port':0x2329});client['Request']=function(_0x1b6a64,_0x1b9b79){return new BPromise(function(_0x19852b,_0x4cb131){return client[_0x70f7('0x4')](_0x1b6a64,_0x1b9b79)[_0x70f7('0x5')](function(_0xd7ff68){logger[_0x70f7('0x6')](_0x70f7('0x7'),'routing',_0x1b6a64,_0x1b9b79,_0xd7ff68);if(_0xd7ff68[_0x70f7('0x8')]){logger[_0x70f7('0x8')](_0x70f7('0x7'),_0x70f7('0x2'),_0x1b6a64,_0xd7ff68[_0x70f7('0x8')][_0x70f7('0x9')],_0x1b9b79);return _0x4cb131(_0xd7ff68[_0x70f7('0x8')]['message']);}else{return _0x19852b(_0xd7ff68[_0x70f7('0xa')]);}})[_0x70f7('0xb')](function(_0x46f086){logger[_0x70f7('0x8')](_0x70f7('0x7'),_0x70f7('0x2'),_0x1b6a64,_0x46f086,_0x1b9b79);return _0x4cb131(_0x46f086);});});};module[_0x70f7('0xc')]=client; \ No newline at end of file +var _0xfa1e=['message','catch','exports','jayson/promise','bluebird','../../config/logger','routing','http','Request','request','then','rpc','error'];(function(_0x10d670,_0x178996){var _0x20d6f8=function(_0x4a4b87){while(--_0x4a4b87){_0x10d670['push'](_0x10d670['shift']());}};_0x20d6f8(++_0x178996);}(_0xfa1e,0xe0));var _0xefa1=function(_0x5da27f,_0x504b76){_0x5da27f=_0x5da27f-0x0;var _0x54a3fb=_0xfa1e[_0x5da27f];return _0x54a3fb;};'use strict';var jayson=require(_0xefa1('0x0'));var BPromise=require(_0xefa1('0x1'));var logger=require(_0xefa1('0x2'))(_0xefa1('0x3'));var client=jayson['client'][_0xefa1('0x4')]({'port':0x2329});client[_0xefa1('0x5')]=function(_0x1e9bfb,_0x3a1c2d){return new BPromise(function(_0x57e319,_0x51bd71){return client[_0xefa1('0x6')](_0x1e9bfb,_0x3a1c2d)[_0xefa1('0x7')](function(_0x8c7a){logger['debug'](_0xefa1('0x8'),'routing',_0x1e9bfb,_0x3a1c2d,_0x8c7a);if(_0x8c7a['error']){logger[_0xefa1('0x9')]('rpc',_0xefa1('0x3'),_0x1e9bfb,_0x8c7a[_0xefa1('0x9')][_0xefa1('0xa')],_0x3a1c2d);return _0x51bd71(_0x8c7a[_0xefa1('0x9')][_0xefa1('0xa')]);}else{return _0x57e319(_0x8c7a['result']);}})[_0xefa1('0xb')](function(_0x54c163){logger[_0xefa1('0x9')](_0xefa1('0x8'),_0xefa1('0x3'),_0x1e9bfb,_0x54c163,_0x3a1c2d);return _0x51bd71(_0x54c163);});});};module[_0xefa1('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 469a3c3..4677d99 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 _0xaa8a=['./server','./lib/email','./rpc/setting','../../config/logger','email','then','initMailAccounts','mailAccounts','listen','catch','error','Email\x20service\x20initialization'];(function(_0x5066fa,_0x366c92){var _0x97f11c=function(_0x27c23f){while(--_0x27c23f){_0x5066fa['push'](_0x5066fa['shift']());}};_0x97f11c(++_0x366c92);}(_0xaa8a,0x144));var _0xaaa8=function(_0x133277,_0xb1d6b2){_0x133277=_0x133277-0x0;var _0x5b4a22=_0xaa8a[_0x133277];return _0x5b4a22;};'use strict';var server=require(_0xaaa8('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0xaaa8('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0xaaa8('0x2'));var logger=require(_0xaaa8('0x3'))(_0xaaa8('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0xaaa8('0x5')](mailAccount['getMailAccounts']())[_0xaaa8('0x5')](realtime[_0xaaa8('0x6')]())[_0xaaa8('0x5')](function(){email['refresh'](realtime[_0xaaa8('0x7')]);return realtime;});}function main(){return server[_0xaaa8('0x8')](realtime,email)[_0xaaa8('0x5')](function(){return initRealtime();})[_0xaaa8('0x5')](function(){return setting['getSettings']();})['then'](function(_0x53da52){return setInterval(initRealtime,_0x53da52['loginMailFrequency']*0x3e8);})[_0xaaa8('0x9')](function(_0x9f01ce){logger[_0xaaa8('0xa')](_0xaaa8('0xb'),_0x9f01ce);});}main(); \ No newline at end of file +var _0x1c0c=['error','Email\x20service\x20initialization','./server','email','then','getMailAccounts','initMailAccounts','mailAccounts','listen','getSettings','catch'];(function(_0x3ed091,_0x3491d4){var _0x49f07c=function(_0x296cbc){while(--_0x296cbc){_0x3ed091['push'](_0x3ed091['shift']());}};_0x49f07c(++_0x3491d4);}(_0x1c0c,0xc8));var _0xc1c0=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x1c0c[_0x4ae625];return _0x31accf;};'use strict';var server=require(_0xc1c0('0x0'));var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require('../../config/logger')(_0xc1c0('0x1'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0xc1c0('0x2')](mailAccount[_0xc1c0('0x3')]())['then'](realtime[_0xc1c0('0x4')]())[_0xc1c0('0x2')](function(){email['refresh'](realtime[_0xc1c0('0x5')]);return realtime;});}function main(){return server[_0xc1c0('0x6')](realtime,email)[_0xc1c0('0x2')](function(){return initRealtime();})[_0xc1c0('0x2')](function(){return setting[_0xc1c0('0x7')]();})[_0xc1c0('0x2')](function(_0x133a65){return setInterval(initRealtime,_0x133a65['loginMailFrequency']*0x3e8);})[_0xc1c0('0x8')](function(_0xcf5f87){logger[_0xc1c0('0x9')](_0xc1c0('0xa'),_0xcf5f87);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 648b874..2e08b59 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 _0x39ad=['imapAccounts','smtp','prototype','emit','Imap','total','isNil','stringify','md5','mailAccount:update','refresh','service','provider','custom','hasOwnProperty','email','box','handleImapBox','handleImapEmail','bind','end','handleImapEnd','error','handleImapError','messageStatus','name','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','status','send','verifySmtp','Smtp','verify','catch','exports','lodash','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','mailAccounts'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x39ad,0x16e));var _0xd39a=function(_0x344826,_0x4f568d){_0x344826=_0x344826-0x0;var _0x14ec59=_0x39ad[_0x344826];return _0x14ec59;};'use strict';var _=require(_0xd39a('0x0'));var moment=require(_0xd39a('0x1'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0xd39a('0x2'));var config=require(_0xd39a('0x3'));var logger=require('../../../config/logger')('email');config[_0xd39a('0x4')]=_[_0xd39a('0x5')](config[_0xd39a('0x4')],{'host':_0xd39a('0x6'),'port':0x18eb});var io=require(_0xd39a('0x7'))(new Redis(config['redis']));var EmailImap=require(_0xd39a('0x8'));var EmailSmtp=require(_0xd39a('0x9'));var mailAccount=require(_0xd39a('0xa'));var md5Accounts={};function EmailChannel(_0x3da900){logger['info']('start\x20email\x20channel');this[_0xd39a('0xb')]=_0x3da900[_0xd39a('0xb')];this[_0xd39a('0xc')]={};this[_0xd39a('0xd')]=new EmailSmtp();}EmailChannel[_0xd39a('0xe')][_0xd39a('0xf')]=function(_0x49b392){var _0x1d2240=this['mailAccounts'][_0x49b392];var _0x1b3f80={'id':_0x1d2240['id'],'name':_0x1d2240['name'],'key':_0x1d2240['key'],'active':_0x1d2240['active'],'Imap':{'status':_0x1d2240[_0xd39a('0x10')]['status'],'messageStatus':_0x1d2240[_0xd39a('0x10')]['messageStatus'],'total':_0x1d2240[_0xd39a('0x10')][_0xd39a('0x11')]}};if(_[_0xd39a('0x12')](md5Accounts[_0x49b392])){md5Accounts[_0x49b392]={};}var _0x58c6b1=md5(JSON[_0xd39a('0x13')](_0x1b3f80));if(md5Accounts[_0x49b392][_0xd39a('0x14')]!==_0x58c6b1){md5Accounts[_0x49b392][_0xd39a('0x14')]=_0x58c6b1;io['emit'](_0xd39a('0x15'),_0x1b3f80);}};EmailChannel['prototype'][_0xd39a('0x16')]=function(_0x1b2ab2){for(var _0x3a0e80 in _0x1b2ab2){if(_0x1b2ab2['hasOwnProperty'](_0x3a0e80)){if(_0x1b2ab2[_0x3a0e80]['Imap']&&_0x1b2ab2[_0x3a0e80]['active']){var _0x4dbfd1=_0x1b2ab2[_0x3a0e80][_0xd39a('0x10')];if(!_0x4dbfd1[_0xd39a('0x17')]&&_0x1b2ab2[_0x3a0e80][_0xd39a('0x18')]!==_0xd39a('0x19'))_0x4dbfd1[_0xd39a('0x17')]=_0x1b2ab2[_0x3a0e80][_0xd39a('0x18')];if(!this[_0xd39a('0xc')][_0xd39a('0x1a')](_0x4dbfd1['id'])){this[_0xd39a('0xc')][_0x4dbfd1['id']]=new EmailImap(_0x4dbfd1,_0x1b2ab2[_0x3a0e80][_0xd39a('0x1b')]);this['imapAccounts'][_0x4dbfd1['id']]['on'](_0xd39a('0x1c'),this[_0xd39a('0x1d')]['bind'](this,_0x3a0e80));this['imapAccounts'][_0x4dbfd1['id']]['on'](_0xd39a('0x1b'),this[_0xd39a('0x1e')][_0xd39a('0x1f')](this,_0x3a0e80));this['imapAccounts'][_0x4dbfd1['id']]['on'](_0xd39a('0x20'),this[_0xd39a('0x21')][_0xd39a('0x1f')](this,_0x3a0e80));this[_0xd39a('0xc')][_0x4dbfd1['id']]['on'](_0xd39a('0x22'),this[_0xd39a('0x23')][_0xd39a('0x1f')](this,_0x3a0e80));}}else{if(_[_0xd39a('0x12')](this[_0xd39a('0xb')][_0x3a0e80][_0xd39a('0x10')])){this[_0xd39a('0xb')][_0x3a0e80]['Imap']={};}this[_0xd39a('0xb')][_0x3a0e80][_0xd39a('0x10')]['status']='disabled';this[_0xd39a('0xb')][_0x3a0e80][_0xd39a('0x10')][_0xd39a('0x24')]='';this['emit'](_0x3a0e80);}}}};EmailChannel[_0xd39a('0xe')][_0xd39a('0x1d')]=function(_0x4aec55,_0x4dcedd){if(this[_0xd39a('0xb')][_0x4aec55]){this[_0xd39a('0xb')][_0x4aec55]['Imap']['status']='connected';this['mailAccounts'][_0x4aec55]['Imap'][_0xd39a('0x24')]=_0x4dcedd[_0xd39a('0x25')];if(_0x4dcedd['messages']){this[_0xd39a('0xb')][_0x4aec55][_0xd39a('0x10')]['total']=_0x4dcedd['messages'][_0xd39a('0x11')];}return this['emit'](_0x4aec55);}};EmailChannel[_0xd39a('0xe')][_0xd39a('0x1e')]=function(_0x35b940,_0x5d640f){logger[_0xd39a('0x26')](_0xd39a('0x27'),_0x5d640f[_0xd39a('0x28')],_0x5d640f[_0xd39a('0x29')],_0x5d640f[_0xd39a('0x2a')],_0x35b940);if(this['mailAccounts'][_0x35b940]){return mailAccount['notify'](_0x35b940,_0x5d640f)[_0xd39a('0x2b')](function(_0x74b8d6){if(_0x74b8d6){logger[_0xd39a('0x26')](_0xd39a('0x2c'));}})['catch'](function(_0x3358e4){logger[_0xd39a('0x22')](_0xd39a('0x2d'),JSON['stringify'](_0x3358e4));});}};EmailChannel[_0xd39a('0xe')][_0xd39a('0x21')]=function(_0x5e771a){if(this['mailAccounts'][_0x5e771a]&&this['mailAccounts'][_0x5e771a][_0xd39a('0x10')]){if(this['imapAccounts'][this[_0xd39a('0xb')][_0x5e771a]['Imap']['id']]){delete this[_0xd39a('0xc')][this[_0xd39a('0xb')][_0x5e771a][_0xd39a('0x10')]['id']];}this[_0xd39a('0xb')][_0x5e771a][_0xd39a('0x10')][_0xd39a('0x2e')]=moment();this[_0xd39a('0xf')](_0x5e771a);}};EmailChannel[_0xd39a('0xe')][_0xd39a('0x23')]=function(_0x40f2bc,_0x29d08b){if(this[_0xd39a('0xb')][_0x40f2bc]){this[_0xd39a('0xb')][_0x40f2bc]['Imap'][_0xd39a('0x2f')]=_0xd39a('0x22');this[_0xd39a('0xb')][_0x40f2bc]['Imap']['messageStatus']=_0x29d08b;return this[_0xd39a('0xf')](_0x40f2bc);}};EmailChannel['prototype']['sendMail']=function(_0x25945d,_0x537c50){return this['smtp'][_0xd39a('0x30')](_0x25945d,_0x537c50);};EmailChannel[_0xd39a('0xe')][_0xd39a('0x31')]=function(_0x248873){var _0x220b5f=this;if(this[_0xd39a('0xb')][_0x248873['id']]){if(_[_0xd39a('0x12')](this['mailAccounts'][_0x248873['id']][_0xd39a('0x32')])){this[_0xd39a('0xb')][_0x248873['id']][_0xd39a('0x32')]={};}this[_0xd39a('0xb')][_0x248873['id']][_0xd39a('0x32')][_0xd39a('0x2e')]=moment();return new BPromise(function(_0x59de30,_0x3b8784){return _0x220b5f['smtp'][_0xd39a('0x33')](_0x248873)[_0xd39a('0x2b')](function(_0x22f5b4){_0x220b5f['mailAccounts'][_0x248873['id']][_0xd39a('0x32')][_0xd39a('0x2f')]='verified';_0x220b5f['mailAccounts'][_0x248873['id']]['Smtp'][_0xd39a('0x24')]='';_0x220b5f[_0xd39a('0xf')](_0x248873['id']);_0x59de30(_0x22f5b4);})[_0xd39a('0x34')](function(_0x20d386){_0x220b5f['mailAccounts'][_0x248873['id']][_0xd39a('0x32')][_0xd39a('0x2f')]=_0xd39a('0x22');_0x220b5f[_0xd39a('0xb')][_0x248873['id']][_0xd39a('0x32')][_0xd39a('0x24')]=_0x20d386;_0x220b5f[_0xd39a('0xf')](_0x248873['id']);_0x3b8784(_0x20d386);});});}return this[_0xd39a('0xd')]['verify'](_0x248873);};module[_0xd39a('0x35')]=EmailChannel; \ No newline at end of file +var _0x65f1=['messages','handleImapEmail','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','sendMail','smtp','verifySmtp','Smtp','verify','verified','catch','md5','redis','localhost','socket.io-emitter','./imap','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','provider','service','email','box','handleImapBox','bind','end','handleImapEnd','error','disabled','connected'];(function(_0x5e0e16,_0x5e75e9){var _0xb5a92a=function(_0x4d4ac4){while(--_0x4d4ac4){_0x5e0e16['push'](_0x5e0e16['shift']());}};_0xb5a92a(++_0x5e75e9);}(_0x65f1,0xe7));var _0x165f=function(_0x45c981,_0x2ad2d4){_0x45c981=_0x45c981-0x0;var _0x4f62c8=_0x65f1[_0x45c981];return _0x4f62c8;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x165f('0x0'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require('../../../config/logger')('email');config[_0x165f('0x1')]=_['defaults'](config['redis'],{'host':_0x165f('0x2'),'port':0x18eb});var io=require(_0x165f('0x3'))(new Redis(config[_0x165f('0x1')]));var EmailImap=require(_0x165f('0x4'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x165f('0x5'));var md5Accounts={};function EmailChannel(_0x2c095e){logger['info'](_0x165f('0x6'));this[_0x165f('0x7')]=_0x2c095e[_0x165f('0x7')];this[_0x165f('0x8')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x165f('0x9')][_0x165f('0xa')]=function(_0xacb97a){var _0x5ccf9f=this[_0x165f('0x7')][_0xacb97a];var _0x2f59cc={'id':_0x5ccf9f['id'],'name':_0x5ccf9f[_0x165f('0xb')],'key':_0x5ccf9f[_0x165f('0xc')],'active':_0x5ccf9f[_0x165f('0xd')],'Imap':{'status':_0x5ccf9f[_0x165f('0xe')][_0x165f('0xf')],'messageStatus':_0x5ccf9f[_0x165f('0xe')][_0x165f('0x10')],'total':_0x5ccf9f['Imap'][_0x165f('0x11')]}};if(_[_0x165f('0x12')](md5Accounts[_0xacb97a])){md5Accounts[_0xacb97a]={};}var _0xdc9ed5=md5(JSON[_0x165f('0x13')](_0x2f59cc));if(md5Accounts[_0xacb97a][_0x165f('0x0')]!==_0xdc9ed5){md5Accounts[_0xacb97a][_0x165f('0x0')]=_0xdc9ed5;io['emit'](_0x165f('0x14'),_0x2f59cc);}};EmailChannel[_0x165f('0x9')][_0x165f('0x15')]=function(_0x5afb21){for(var _0x3b5435 in _0x5afb21){if(_0x5afb21[_0x165f('0x16')](_0x3b5435)){if(_0x5afb21[_0x3b5435][_0x165f('0xe')]&&_0x5afb21[_0x3b5435][_0x165f('0xd')]){var _0x2b8c23=_0x5afb21[_0x3b5435][_0x165f('0xe')];if(!_0x2b8c23['service']&&_0x5afb21[_0x3b5435][_0x165f('0x17')]!=='custom')_0x2b8c23[_0x165f('0x18')]=_0x5afb21[_0x3b5435][_0x165f('0x17')];if(!this[_0x165f('0x8')][_0x165f('0x16')](_0x2b8c23['id'])){this[_0x165f('0x8')][_0x2b8c23['id']]=new EmailImap(_0x2b8c23,_0x5afb21[_0x3b5435][_0x165f('0x19')]);this['imapAccounts'][_0x2b8c23['id']]['on'](_0x165f('0x1a'),this[_0x165f('0x1b')]['bind'](this,_0x3b5435));this['imapAccounts'][_0x2b8c23['id']]['on'](_0x165f('0x19'),this['handleImapEmail'][_0x165f('0x1c')](this,_0x3b5435));this[_0x165f('0x8')][_0x2b8c23['id']]['on'](_0x165f('0x1d'),this[_0x165f('0x1e')][_0x165f('0x1c')](this,_0x3b5435));this[_0x165f('0x8')][_0x2b8c23['id']]['on'](_0x165f('0x1f'),this['handleImapError'][_0x165f('0x1c')](this,_0x3b5435));}}else{if(_[_0x165f('0x12')](this[_0x165f('0x7')][_0x3b5435][_0x165f('0xe')])){this[_0x165f('0x7')][_0x3b5435][_0x165f('0xe')]={};}this['mailAccounts'][_0x3b5435][_0x165f('0xe')][_0x165f('0xf')]=_0x165f('0x20');this[_0x165f('0x7')][_0x3b5435]['Imap'][_0x165f('0x10')]='';this[_0x165f('0xa')](_0x3b5435);}}}};EmailChannel[_0x165f('0x9')]['handleImapBox']=function(_0x1d9b5b,_0x669178){if(this[_0x165f('0x7')][_0x1d9b5b]){this[_0x165f('0x7')][_0x1d9b5b][_0x165f('0xe')][_0x165f('0xf')]=_0x165f('0x21');this[_0x165f('0x7')][_0x1d9b5b][_0x165f('0xe')][_0x165f('0x10')]=_0x669178[_0x165f('0xb')];if(_0x669178[_0x165f('0x22')]){this[_0x165f('0x7')][_0x1d9b5b][_0x165f('0xe')]['total']=_0x669178[_0x165f('0x22')][_0x165f('0x11')];}return this[_0x165f('0xa')](_0x1d9b5b);}};EmailChannel[_0x165f('0x9')][_0x165f('0x23')]=function(_0x4a85bb,_0x3c1111){logger[_0x165f('0x24')](_0x165f('0x25'),_0x3c1111[_0x165f('0x26')],_0x3c1111[_0x165f('0x27')],_0x3c1111[_0x165f('0x28')],_0x4a85bb);if(this['mailAccounts'][_0x4a85bb]){return mailAccount[_0x165f('0x29')](_0x4a85bb,_0x3c1111)['then'](function(_0x3f40f3){if(_0x3f40f3){logger[_0x165f('0x24')](_0x165f('0x2a'));}})['catch'](function(_0xd69034){logger[_0x165f('0x1f')](_0x165f('0x2b'),JSON[_0x165f('0x13')](_0xd69034));});}};EmailChannel[_0x165f('0x9')][_0x165f('0x1e')]=function(_0x165e46){if(this[_0x165f('0x7')][_0x165e46]&&this['mailAccounts'][_0x165e46][_0x165f('0xe')]){if(this['imapAccounts'][this['mailAccounts'][_0x165e46][_0x165f('0xe')]['id']]){delete this['imapAccounts'][this[_0x165f('0x7')][_0x165e46][_0x165f('0xe')]['id']];}this[_0x165f('0x7')][_0x165e46][_0x165f('0xe')][_0x165f('0x2c')]=moment();this[_0x165f('0xa')](_0x165e46);}};EmailChannel[_0x165f('0x9')][_0x165f('0x2d')]=function(_0x414090,_0x4ede09){if(this[_0x165f('0x7')][_0x414090]){this[_0x165f('0x7')][_0x414090][_0x165f('0xe')]['status']='error';this['mailAccounts'][_0x414090][_0x165f('0xe')][_0x165f('0x10')]=_0x4ede09;return this[_0x165f('0xa')](_0x414090);}};EmailChannel[_0x165f('0x9')][_0x165f('0x2e')]=function(_0x546b5d,_0x3f2c80){return this[_0x165f('0x2f')]['send'](_0x546b5d,_0x3f2c80);};EmailChannel[_0x165f('0x9')][_0x165f('0x30')]=function(_0x5a2b7f){var _0x31f120=this;if(this['mailAccounts'][_0x5a2b7f['id']]){if(_[_0x165f('0x12')](this['mailAccounts'][_0x5a2b7f['id']][_0x165f('0x31')])){this[_0x165f('0x7')][_0x5a2b7f['id']][_0x165f('0x31')]={};}this[_0x165f('0x7')][_0x5a2b7f['id']][_0x165f('0x31')]['lastSync']=moment();return new BPromise(function(_0x16dab,_0x1a426d){return _0x31f120[_0x165f('0x2f')][_0x165f('0x32')](_0x5a2b7f)['then'](function(_0x3a9f60){_0x31f120[_0x165f('0x7')][_0x5a2b7f['id']][_0x165f('0x31')][_0x165f('0xf')]=_0x165f('0x33');_0x31f120[_0x165f('0x7')][_0x5a2b7f['id']][_0x165f('0x31')]['messageStatus']='';_0x31f120['emit'](_0x5a2b7f['id']);_0x16dab(_0x3a9f60);})[_0x165f('0x34')](function(_0x5ab420){_0x31f120[_0x165f('0x7')][_0x5a2b7f['id']]['Smtp'][_0x165f('0xf')]=_0x165f('0x1f');_0x31f120[_0x165f('0x7')][_0x5a2b7f['id']][_0x165f('0x31')][_0x165f('0x10')]=_0x5ab420;_0x31f120[_0x165f('0xa')](_0x5a2b7f['id']);_0x1a426d(_0x5ab420);});});}return this[_0x165f('0x2f')]['verify'](_0x5a2b7f);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 22868fc..21c1864 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 _0xbcbd=['CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','openBox','handleOpenBox','emit','readUnseen','search','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','stringify','textCode','hasOwnProperty','upperFirst','lodash','imap','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','ready','handleReady','bind','once','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','generateXOAuth2Token'];(function(_0x51cee0,_0x9d4b0d){var _0x1310d5=function(_0x2dba7c){while(--_0x2dba7c){_0x51cee0['push'](_0x51cee0['shift']());}};_0x1310d5(++_0x9d4b0d);}(_0xbcbd,0x194));var _0xdbcb=function(_0xe9f4a2,_0x50f0c4){_0xe9f4a2=_0xe9f4a2-0x0;var _0x25e066=_0xbcbd[_0xe9f4a2];return _0x25e066;};'use strict';var _=require(_0xdbcb('0x0'));var util=require('util');var Imap=require(_0xdbcb('0x1'));var simpleParser=require(_0xdbcb('0x2'))[_0xdbcb('0x3')];var Iconv=require('iconv')[_0xdbcb('0x4')];var EventEmitter=require(_0xdbcb('0x5'))[_0xdbcb('0x6')];var utils=require(_0xdbcb('0x7'));var logger=require(_0xdbcb('0x8'))(_0xdbcb('0x9'));function EmailImap(_0x25567b,_0x164f97){this[_0xdbcb('0xa')]=_0x25567b['mailbox'];this[_0xdbcb('0xb')]=this[_0xdbcb('0xc')](_0x25567b,_0x164f97);this[_0xdbcb('0x1')]=new Imap(this['account']);this[_0xdbcb('0x1')]['once'](_0xdbcb('0xd'),this[_0xdbcb('0xe')][_0xdbcb('0xf')](this));this['imap'][_0xdbcb('0x10')](_0xdbcb('0x11'),this[_0xdbcb('0x12')][_0xdbcb('0xf')](this));this[_0xdbcb('0x1')]['on'](_0xdbcb('0x13'),this[_0xdbcb('0x14')]['bind'](this));this[_0xdbcb('0x1')][_0xdbcb('0x15')]();}util[_0xdbcb('0x16')](EmailImap,EventEmitter);EmailImap[_0xdbcb('0x17')][_0xdbcb('0xc')]=function(_0x34fece,_0x141601){var _0x120e45={'connTimeout':_0x34fece[_0xdbcb('0x18')]?_0x34fece[_0xdbcb('0x18')]*0x3e8:0x2710,'authTimeout':_0x34fece[_0xdbcb('0x19')]?_0x34fece[_0xdbcb('0x19')]*0x3e8:0x1388};if(_0x34fece[_0xdbcb('0x1a')]){_0x120e45[_0xdbcb('0x1b')]=_0x34fece[_0xdbcb('0x1b')];if(_0x34fece[_0xdbcb('0x1c')]){_0x120e45['xoauth2']=utils[_0xdbcb('0x1d')](_0x34fece[_0xdbcb('0x1e')][_0xdbcb('0x1f')],_0x34fece[_0xdbcb('0x1b')]);}else{_0x120e45[_0xdbcb('0x20')]=_0x34fece[_0xdbcb('0x20')];}}else{if(_0x34fece[_0xdbcb('0x21')]){_0x120e45[_0xdbcb('0x1b')]=_0x34fece[_0xdbcb('0x1b')];_0x120e45[_0xdbcb('0x20')]=_0x34fece[_0xdbcb('0x20')];}}_0x120e45[_0xdbcb('0x9')]=_0x141601||_0x34fece[_0xdbcb('0x1b')]||_0xdbcb('0x22');_0x120e45['host']=_0x34fece[_0xdbcb('0x23')];_0x120e45['port']=_0x34fece[_0xdbcb('0x24')]||0x3e1;if(_0x34fece['tls']){_0x120e45[_0xdbcb('0x25')]=!![];}else{_0x120e45[_0xdbcb('0x25')]=![];_0x120e45[_0xdbcb('0x26')]='required';}return _0x120e45;};EmailImap[_0xdbcb('0x17')]['handleReady']=function(){this[_0xdbcb('0x1')][_0xdbcb('0x27')](this['mailbox'],![],this['handleOpenBox']['bind'](this));};EmailImap[_0xdbcb('0x17')][_0xdbcb('0x28')]=function(_0x3b6a74,_0x3cdd15){if(_0x3b6a74){this[_0xdbcb('0x14')](_0x3b6a74,!![]);}else{this[_0xdbcb('0x29')]('box',_0x3cdd15);this[_0xdbcb('0x2a')]();}};EmailImap[_0xdbcb('0x17')]['handleCloseBox']=function(_0x1dc722){if(_0x1dc722){this[_0xdbcb('0x14')](_0x1dc722,!![]);}else{this['imap'][_0xdbcb('0x11')]();}};EmailImap[_0xdbcb('0x17')][_0xdbcb('0x2a')]=function(){this['imap'][_0xdbcb('0x2b')](['UNSEEN'],this[_0xdbcb('0x2c')][_0xdbcb('0xf')](this));};EmailImap[_0xdbcb('0x17')][_0xdbcb('0x2c')]=function(_0xee6c85,_0x1a09ae){if(_0xee6c85){this[_0xdbcb('0x14')](_0xee6c85,!![]);}else{if(_0x1a09ae['length']){try{var _0x4d61eb=this[_0xdbcb('0x1')][_0xdbcb('0x2d')](_0x1a09ae,{'bodies':'','markSeen':!![]});_0x4d61eb['on'](_0xdbcb('0x2e'),this[_0xdbcb('0x2f')][_0xdbcb('0xf')](this));_0x4d61eb[_0xdbcb('0x10')]('error',this[_0xdbcb('0x30')][_0xdbcb('0xf')](this));_0x4d61eb[_0xdbcb('0x10')](_0xdbcb('0x11'),this[_0xdbcb('0x31')][_0xdbcb('0xf')](this));}catch(_0x14c8e8){logger['error'](_0x14c8e8);}}else{this[_0xdbcb('0x1')][_0xdbcb('0x32')](!![],this[_0xdbcb('0x33')][_0xdbcb('0xf')](this));}}};EmailImap[_0xdbcb('0x17')][_0xdbcb('0x2f')]=function(_0x23f364){_0x23f364['on']('body',this[_0xdbcb('0x34')][_0xdbcb('0xf')](this));_0x23f364[_0xdbcb('0x10')](_0xdbcb('0x35'),this['handleMessageAttributes']['bind'](this));_0x23f364[_0xdbcb('0x10')]('end',this[_0xdbcb('0x36')][_0xdbcb('0xf')](this));};EmailImap[_0xdbcb('0x17')][_0xdbcb('0x34')]=function(_0x98fd2d){simpleParser(_0x98fd2d,{'Iconv':Iconv},this[_0xdbcb('0x37')][_0xdbcb('0xf')](this));};EmailImap[_0xdbcb('0x17')][_0xdbcb('0x38')]=function(){};EmailImap[_0xdbcb('0x17')][_0xdbcb('0x36')]=function(){};EmailImap[_0xdbcb('0x17')][_0xdbcb('0x37')]=function(_0x84e852,_0x3b45ca){if(_0x84e852){logger[_0xdbcb('0x13')](_0x84e852);}else{var _0x251ced=this;utils[_0xdbcb('0x39')](this[_0xdbcb('0xb')],_0x3b45ca,function(_0x11c184){_0x251ced['emit'](_0xdbcb('0x9'),_0x11c184);});}};EmailImap[_0xdbcb('0x17')][_0xdbcb('0x31')]=function(){this[_0xdbcb('0x1')][_0xdbcb('0x32')](!![],this['handleCloseBox']['bind'](this));};EmailImap['prototype']['handleFetchError']=function(_0x383394){this[_0xdbcb('0x14')](_0x383394);this[_0xdbcb('0x1')][_0xdbcb('0x32')](!![],this['handleCloseBox'][_0xdbcb('0xf')](this));};EmailImap[_0xdbcb('0x17')][_0xdbcb('0x12')]=function(){this[_0xdbcb('0x29')]('end');};EmailImap[_0xdbcb('0x17')][_0xdbcb('0x14')]=function(_0x495d9f,_0x1b1d63){logger[_0xdbcb('0x13')](_0xdbcb('0x14'),this[_0xdbcb('0xb')][_0xdbcb('0x9')],JSON[_0xdbcb('0x3a')](_0x495d9f));var _0x33f5a1='';if(_0x495d9f){if(_0x495d9f[_0xdbcb('0x3b')]){_0x33f5a1=_0x495d9f[_0xdbcb('0x3b')];}else{for(var _0x41f763 in _0x495d9f){if(_0x495d9f[_0xdbcb('0x3c')](_0x41f763)){_0x33f5a1+=_[_0xdbcb('0x3d')](_0x41f763)+':\x20'+_0x495d9f[_0x41f763]+'\x0a';}}}}if(_0x1b1d63){this['imap'][_0xdbcb('0x11')]();}else{this[_0xdbcb('0x29')]('error',_0x33f5a1);this[_0xdbcb('0x29')]('end');}};module['exports']=EmailImap; \ No newline at end of file +var _0xeb08=['length','fetch','message','handleFetchMessage','handleFetchError','closeBox','handleMessageEnd','handleMessageBody','handleMessageAttributes','handleSimpleParser','parser','emit','handleFetchEnd','stringify','textCode','exports','lodash','util','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','imap','once','ready','handleEnd','error','handleError','bind','connect','inherits','prototype','connTimeout','authTimeout','service','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','user','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','handleReady','openBox','handleOpenBox','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen'];(function(_0x336264,_0x32e1d9){var _0x53cf91=function(_0x21026c){while(--_0x21026c){_0x336264['push'](_0x336264['shift']());}};_0x53cf91(++_0x32e1d9);}(_0xeb08,0x96));var _0x8eb0=function(_0x157111,_0x3a9771){_0x157111=_0x157111-0x0;var _0x5b00c4=_0xeb08[_0x157111];return _0x5b00c4;};'use strict';var _=require(_0x8eb0('0x0'));var util=require(_0x8eb0('0x1'));var Imap=require('imap');var simpleParser=require(_0x8eb0('0x2'))[_0x8eb0('0x3')];var Iconv=require(_0x8eb0('0x4'))[_0x8eb0('0x5')];var EventEmitter=require(_0x8eb0('0x6'))[_0x8eb0('0x7')];var utils=require(_0x8eb0('0x8'));var logger=require(_0x8eb0('0x9'))(_0x8eb0('0xa'));function EmailImap(_0x37c2f2,_0x3f1e56){this[_0x8eb0('0xb')]=_0x37c2f2['mailbox'];this[_0x8eb0('0xc')]=this[_0x8eb0('0xd')](_0x37c2f2,_0x3f1e56);this[_0x8eb0('0xe')]=new Imap(this[_0x8eb0('0xc')]);this[_0x8eb0('0xe')][_0x8eb0('0xf')](_0x8eb0('0x10'),this['handleReady']['bind'](this));this[_0x8eb0('0xe')]['once']('end',this[_0x8eb0('0x11')]['bind'](this));this[_0x8eb0('0xe')]['on'](_0x8eb0('0x12'),this[_0x8eb0('0x13')][_0x8eb0('0x14')](this));this['imap'][_0x8eb0('0x15')]();}util[_0x8eb0('0x16')](EmailImap,EventEmitter);EmailImap[_0x8eb0('0x17')][_0x8eb0('0xd')]=function(_0x4eebdf,_0x4cf70f){var _0x55a180={'connTimeout':_0x4eebdf['connTimeout']?_0x4eebdf[_0x8eb0('0x18')]*0x3e8:0x2710,'authTimeout':_0x4eebdf[_0x8eb0('0x19')]?_0x4eebdf[_0x8eb0('0x19')]*0x3e8:0x1388};if(_0x4eebdf[_0x8eb0('0x1a')]){_0x55a180['user']=_0x4eebdf['user'];if(_0x4eebdf[_0x8eb0('0x1b')]){_0x55a180[_0x8eb0('0x1c')]=utils[_0x8eb0('0x1d')](_0x4eebdf[_0x8eb0('0x1e')][_0x8eb0('0x1f')],_0x4eebdf[_0x8eb0('0x20')]);}else{_0x55a180[_0x8eb0('0x21')]=_0x4eebdf['password'];}}else{if(_0x4eebdf[_0x8eb0('0x22')]){_0x55a180[_0x8eb0('0x20')]=_0x4eebdf['user'];_0x55a180[_0x8eb0('0x21')]=_0x4eebdf[_0x8eb0('0x21')];}}_0x55a180[_0x8eb0('0xa')]=_0x4cf70f||_0x4eebdf[_0x8eb0('0x20')]||_0x8eb0('0x23');_0x55a180['host']=_0x4eebdf[_0x8eb0('0x24')];_0x55a180[_0x8eb0('0x25')]=_0x4eebdf['port']||0x3e1;if(_0x4eebdf['tls']){_0x55a180[_0x8eb0('0x26')]=!![];}else{_0x55a180['tls']=![];_0x55a180[_0x8eb0('0x27')]=_0x8eb0('0x28');}return _0x55a180;};EmailImap[_0x8eb0('0x17')][_0x8eb0('0x29')]=function(){this[_0x8eb0('0xe')][_0x8eb0('0x2a')](this[_0x8eb0('0xb')],![],this[_0x8eb0('0x2b')]['bind'](this));};EmailImap['prototype']['handleOpenBox']=function(_0x366e97,_0x11c55f){if(_0x366e97){this[_0x8eb0('0x13')](_0x366e97,!![]);}else{this['emit'](_0x8eb0('0x2c'),_0x11c55f);this[_0x8eb0('0x2d')]();}};EmailImap[_0x8eb0('0x17')][_0x8eb0('0x2e')]=function(_0x7cd2fc){if(_0x7cd2fc){this[_0x8eb0('0x13')](_0x7cd2fc,!![]);}else{this['imap'][_0x8eb0('0x2f')]();}};EmailImap[_0x8eb0('0x17')][_0x8eb0('0x2d')]=function(){this['imap'][_0x8eb0('0x30')]([_0x8eb0('0x31')],this[_0x8eb0('0x32')]['bind'](this));};EmailImap[_0x8eb0('0x17')][_0x8eb0('0x32')]=function(_0x54a70d,_0x5e3ebd){if(_0x54a70d){this[_0x8eb0('0x13')](_0x54a70d,!![]);}else{if(_0x5e3ebd[_0x8eb0('0x33')]){try{var _0x2694d4=this[_0x8eb0('0xe')][_0x8eb0('0x34')](_0x5e3ebd,{'bodies':'','markSeen':!![]});_0x2694d4['on'](_0x8eb0('0x35'),this[_0x8eb0('0x36')][_0x8eb0('0x14')](this));_0x2694d4[_0x8eb0('0xf')](_0x8eb0('0x12'),this[_0x8eb0('0x37')][_0x8eb0('0x14')](this));_0x2694d4[_0x8eb0('0xf')](_0x8eb0('0x2f'),this['handleFetchEnd'][_0x8eb0('0x14')](this));}catch(_0x14b74c){logger[_0x8eb0('0x12')](_0x14b74c);}}else{this['imap'][_0x8eb0('0x38')](!![],this[_0x8eb0('0x2e')][_0x8eb0('0x14')](this));}}};EmailImap[_0x8eb0('0x17')]['handleFetchMessage']=function(_0xa1087d){_0xa1087d['on']('body',this['handleMessageBody'][_0x8eb0('0x14')](this));_0xa1087d[_0x8eb0('0xf')]('attributes',this['handleMessageAttributes'][_0x8eb0('0x14')](this));_0xa1087d[_0x8eb0('0xf')](_0x8eb0('0x2f'),this[_0x8eb0('0x39')]['bind'](this));};EmailImap[_0x8eb0('0x17')][_0x8eb0('0x3a')]=function(_0x3d0ae8){simpleParser(_0x3d0ae8,{'Iconv':Iconv},this['handleSimpleParser'][_0x8eb0('0x14')](this));};EmailImap[_0x8eb0('0x17')][_0x8eb0('0x3b')]=function(){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0x8eb0('0x17')][_0x8eb0('0x3c')]=function(_0x3c62a4,_0x46b32f){if(_0x3c62a4){logger[_0x8eb0('0x12')](_0x3c62a4);}else{var _0x4af259=this;utils[_0x8eb0('0x3d')](this[_0x8eb0('0xc')],_0x46b32f,function(_0x26abd7){_0x4af259[_0x8eb0('0x3e')]('email',_0x26abd7);});}};EmailImap[_0x8eb0('0x17')][_0x8eb0('0x3f')]=function(){this[_0x8eb0('0xe')]['closeBox'](!![],this[_0x8eb0('0x2e')]['bind'](this));};EmailImap[_0x8eb0('0x17')][_0x8eb0('0x37')]=function(_0x4cb9ad){this[_0x8eb0('0x13')](_0x4cb9ad);this['imap'][_0x8eb0('0x38')](!![],this[_0x8eb0('0x2e')][_0x8eb0('0x14')](this));};EmailImap[_0x8eb0('0x17')][_0x8eb0('0x11')]=function(){this[_0x8eb0('0x3e')](_0x8eb0('0x2f'));};EmailImap[_0x8eb0('0x17')]['handleError']=function(_0x36bb54,_0x301621){logger['error'](_0x8eb0('0x13'),this['account']['email'],JSON[_0x8eb0('0x40')](_0x36bb54));var _0x456f43='';if(_0x36bb54){if(_0x36bb54[_0x8eb0('0x41')]){_0x456f43=_0x36bb54[_0x8eb0('0x41')];}else{for(var _0x4193d1 in _0x36bb54){if(_0x36bb54['hasOwnProperty'](_0x4193d1)){_0x456f43+=_['upperFirst'](_0x4193d1)+':\x20'+_0x36bb54[_0x4193d1]+'\x0a';}}}}if(_0x301621){this[_0x8eb0('0xe')][_0x8eb0('0x2f')]();}else{this[_0x8eb0('0x3e')]('error',_0x456f43);this['emit']('end');}};module[_0x8eb0('0x42')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index bce9c89..0108936 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 _0x877e=['compile','sendMail','verify','toString','Not\x20verifired','exports','prototype','send','createTransport','use'];(function(_0x345764,_0x223384){var _0x5e508d=function(_0x16a2a4){while(--_0x16a2a4){_0x345764['push'](_0x345764['shift']());}};_0x5e508d(++_0x223384);}(_0x877e,0x196));var _0xe877=function(_0x44eb42,_0x321bb5){_0x44eb42=_0x44eb42-0x0;var _0x8d59ae=_0x877e[_0x44eb42];return _0x8d59ae;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xe877('0x0')][_0xe877('0x1')]=function(_0x13244c,_0x281a83){return new Promise(function(_0x1d2640,_0x5980a3){var _0x554db5=nodemailer[_0xe877('0x2')](_0x13244c);_0x554db5[_0xe877('0x3')](_0xe877('0x4'),inlineBase64());_0x554db5[_0xe877('0x5')](_0x281a83,function(_0x5970cd,_0x12cdab){if(_0x5970cd){_0x5980a3(_0x5970cd['toString']());}else{_0x1d2640(_0x12cdab);}});});};EmailSmtp[_0xe877('0x0')][_0xe877('0x6')]=function(_0x286722){return new Promise(function(_0x5d5a96,_0x44cdb2){var _0x2464d5=nodemailer['createTransport'](_0x286722);_0x2464d5[_0xe877('0x6')](function(_0x26988a,_0x55d457){if(_0x26988a){_0x44cdb2(_0x26988a[_0xe877('0x7')]());}else{if(_0x55d457){_0x5d5a96(_0x55d457);}else{_0x44cdb2(_0xe877('0x8'));}}});});};module[_0xe877('0x9')]=EmailSmtp; \ No newline at end of file +var _0x792c=['Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','sendMail','toString','verify'];(function(_0x1a8a36,_0x51d677){var _0x33bef2=function(_0x17a598){while(--_0x17a598){_0x1a8a36['push'](_0x1a8a36['shift']());}};_0x33bef2(++_0x51d677);}(_0x792c,0xfe));var _0xc792=function(_0x2d2a39,_0x308dc3){_0x2d2a39=_0x2d2a39-0x0;var _0x4143c3=_0x792c[_0x2d2a39];return _0x4143c3;};'use strict';var nodemailer=require(_0xc792('0x0'));var inlineBase64=require(_0xc792('0x1'));function EmailSmtp(){}EmailSmtp[_0xc792('0x2')][_0xc792('0x3')]=function(_0x31ad51,_0x47c0e1){return new Promise(function(_0x101c49,_0x8b8cb9){var _0x12e967=nodemailer[_0xc792('0x4')](_0x31ad51);_0x12e967[_0xc792('0x5')](_0xc792('0x6'),inlineBase64());_0x12e967[_0xc792('0x7')](_0x47c0e1,function(_0x9e5007,_0x5e7dcc){if(_0x9e5007){_0x8b8cb9(_0x9e5007[_0xc792('0x8')]());}else{_0x101c49(_0x5e7dcc);}});});};EmailSmtp['prototype']['verify']=function(_0x4c1177){return new Promise(function(_0x3d5662,_0x495fa){var _0x2e85e9=nodemailer[_0xc792('0x4')](_0x4c1177);_0x2e85e9[_0xc792('0x9')](function(_0x1028f2,_0x4653ce){if(_0x1028f2){_0x495fa(_0x1028f2[_0xc792('0x8')]());}else{if(_0x4653ce){_0x3d5662(_0x4653ce);}else{_0x495fa(_0xc792('0xa'));}}});});};module[_0xc792('0xb')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index a11bd96..4a54546 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 _0x4255=['isEmpty','html','test','replace','','body','textAsHtml','Empty\x20message

','Attachments','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','moment','randomstring','path','util','head','value','address','anonymous','generate','@xcally.com','name','split','length','slice','pop'];(function(_0x48f4f9,_0x4ee907){var _0x3e4f66=function(_0x297506){while(--_0x297506){_0x48f4f9['push'](_0x48f4f9['shift']());}};_0x3e4f66(++_0x4ee907);}(_0x4255,0x7d));var _0x5425=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0x4255[_0xf73c09];return _0xa8923c;};'use strict';var _=require('lodash');var moment=require(_0x5425('0x0'));var random=require(_0x5425('0x1'));var fs=require('fs');var path=require(_0x5425('0x2'));var util=require(_0x5425('0x3'));var tnef=require('node-tnef');var logger=require('../../../config/logger')('email');var config=require('../../../config/environment');function getAddress(_0x2f4d2a){var _0x35087e=_[_0x5425('0x4')](_0x2f4d2a[_0x5425('0x5')]);return _0x35087e&&_0x35087e[_0x5425('0x6')]?_0x35087e['address']:_0x5425('0x7')+random[_0x5425('0x8')](0x6)+_0x5425('0x9');}function getFirstName(_0x1b0165){var _0x5c9d66=_[_0x5425('0x4')](_0x1b0165[_0x5425('0x5')]);if(_0x5c9d66&&_0x5c9d66[_0x5425('0xa')]){if(_0x5c9d66[_0x5425('0xa')]==_0x5c9d66[_0x5425('0x6')]){return _0x5c9d66[_0x5425('0xa')]['substring'](0x0,_0x5c9d66['name']['indexOf']('@'));}var _0x3e26dc=_0x5c9d66['name'][_0x5425('0xb')](/\s+/);return _0x3e26dc[_0x5425('0xc')]>0x1?_0x3e26dc[_0x5425('0xd')](0x0,-0x1)['join']('\x20'):_0x5c9d66['name'];}return'Anonymous';}function getLastName(_0x863b62){var _0x18c4c1=_[_0x5425('0x4')](_0x863b62[_0x5425('0x5')]);if(_0x18c4c1&&_0x18c4c1[_0x5425('0xa')]){var _0x3ced89=_0x18c4c1[_0x5425('0xa')][_0x5425('0xb')](/\s+/);return _0x3ced89[_0x5425('0xc')]>0x1?_0x3ced89[_0x5425('0xe')]():'';}return'';}function getMails(_0x1bef08,_0x5214d1){var _0x2496ca='';for(var _0x2e470d=0x0;_0x2e470d<_0x5214d1[_0x5425('0x5')][_0x5425('0xc')];_0x2e470d+=0x1){if(_0x5214d1[_0x5425('0x5')][_0x2e470d][_0x5425('0x6')]!==_0x1bef08){if(!_[_0x5425('0xf')](_0x2496ca)){_0x2496ca+=',';}_0x2496ca+=_0x5214d1[_0x5425('0x5')][_0x2e470d][_0x5425('0xa')]||_0x5214d1[_0x5425('0x5')][_0x2e470d][_0x5425('0x6')]||'';_0x2496ca+='\x20<';_0x2496ca+=_0x5214d1[_0x5425('0x5')][_0x2e470d][_0x5425('0x6')]?_0x5214d1[_0x5425('0x5')][_0x2e470d]['address']:_0x5425('0x7')+random[_0x5425('0x8')](0x6)+_0x5425('0x9');_0x2496ca+='>';}}return _0x2496ca;}function parseEmail(_0x2771f9,_0x112ceb,_0x2af137){if(_0x112ceb[_0x5425('0x10')]){var _0x3e56be=/)<[^<]*)*<\/script>/gi;while(_0x3e56be[_0x5425('0x11')](_0x112ceb[_0x5425('0x10')])){_0x112ceb[_0x5425('0x10')]=_0x112ceb['html'][_0x5425('0x12')](_0x3e56be,'');}if(_0x112ceb[_0x5425('0x10')]['includes'](_0x5425('0x13'))){var _0x55821b=[];_0x112ceb[_0x5425('0x14')]['forEach'](_0x1991ba=>{_0x55821b[_0x5425('0x15')](_0x1991ba[_0x5425('0x16')]);});var _0x17a5dc=/]+>/g;var _0x550a09=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x221bec=_0x112ceb[_0x5425('0x10')][_0x5425('0x12')](_0x550a09,'_SRC');var _0x5a75d3=_0x221bec[_0x5425('0x12')](_0x17a5dc,_0x5425('0x17'));for(let _0x308a0c=0x0;_0x308a0c<_0x55821b[_0x5425('0xc')];_0x308a0c++){var _0x44a43a=_0x5a75d3['replace'](_0x5425('0x17'),'\x20[Attachment:\x20'+_0x55821b[_0x308a0c]+_0x5425('0x18'));_0x5a75d3=_0x44a43a;}_0x112ceb[_0x5425('0x10')]=_0x5a75d3;}_0x2af137['body']=_0x112ceb[_0x5425('0x10')];}else{_0x2af137[_0x5425('0x19')]=_0x112ceb[_0x5425('0x1a')];}if(_0x2af137['body']){_0x2af137[_0x5425('0x19')]=_0x2af137[_0x5425('0x19')][_0x5425('0x12')](/0x0){var _0x48d756=[_0x5425('0x2d'),_0x5425('0x2e'),_0x5425('0x2f')];for(var _0x3ee4db=0x0;_0x3ee4db<_0x112ceb[_0x5425('0x2c')][_0x5425('0xc')];_0x3ee4db++){var _0x5549ff=_[_0x5425('0x30')](_0x48d756,_0x112ceb[_0x5425('0x2c')][_0x3ee4db]['line']);if(_0x5549ff>=0x0){_0x2af137[_0x5425('0x31')]=!![];}}}return _0x2af137;}exports[_0x5425('0x32')]=function(_0x3eb2d3,_0x55180f,_0x165d72){var _0x2ff0da={'from':getAddress(_0x55180f[_0x5425('0x33')]),'firstName':getFirstName(_0x55180f['from']),'lastName':getLastName(_0x55180f[_0x5425('0x33')]),'mapKey':'email','message':{'from':getMails(_0x3eb2d3[_0x5425('0x1e')],_0x55180f['from']),'to':_0x3eb2d3[_0x5425('0x1e')],'cc':'','subject':_0x55180f[_0x5425('0x34')]||'','messageId':_0x55180f['messageId'],'inReplyTo':_0x55180f[_0x5425('0x35')],'sentAt':moment(_0x55180f[_0x5425('0x36')])[_0x5425('0x25')](_0x5425('0x37')),'attach':![],'attachments':[]}};if(!_0x55180f[_0x5425('0x10')]&&!_0x55180f['textAsHtml']){var _0x552dc3=_[_0x5425('0x38')](_0x55180f[_0x5425('0x14')],{'contentType':_0x5425('0x39')});if(_0x552dc3[_0x5425('0xc')]){logger['info'](util[_0x5425('0x25')](_0x5425('0x3a'),_0x55180f[_0x5425('0x3b')]));tnef[_0x5425('0x3c')](_[_0x5425('0x3d')](_0x552dc3)[_0x5425('0x2a')],function(_0x331a82,_0x4987fb){if(_0x4987fb){_0x55180f[_0x5425('0x10')]=_0x4987fb['BodyHTML']||_0x5425('0x3e');if(_0x4987fb[_0x5425('0x3f')]){for(var _0x543ef3=0x0;_0x543ef3<_0x4987fb['Attachments'][_0x5425('0xc')];_0x543ef3++){var _0x1da165=_0x4987fb[_0x5425('0x3f')][_0x543ef3];_0x2ff0da[_0x5425('0x1c')][_0x5425('0x14')][_0x5425('0x15')]({'filename':_0x1da165['Title'],'content':Buffer[_0x5425('0x33')](_0x1da165[_0x5425('0x40')])});}}}_0x165d72(parseEmail(_0x3eb2d3,_0x55180f,_0x2ff0da));});}else{_0x55180f[_0x5425('0x10')]=_0x5425('0x3e');_0x165d72(parseEmail(_0x3eb2d3,_0x55180f,_0x2ff0da));}}else{_0x165d72(parseEmail(_0x3eb2d3,_0x55180f,_0x2ff0da));}};exports[_0x5425('0x41')]=function(_0x179ee6,_0x21282a){var _0x4cbe16=[_0x5425('0x42')+(_0x21282a||''),_0x5425('0x43')+_0x179ee6,'',''];return Buffer['from'](_0x4cbe16[_0x5425('0x27')](''),_0x5425('0x44'))[_0x5425('0x45')]('base64');}; \ No newline at end of file +var _0xa678=['push','headerLines','Auto-Submitted:\x20auto-replied','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','messageId','inReplyTo','date','format','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','content','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','toString','base64','moment','randomstring','path','util','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','generate','@xcally.com','test','html','replace','includes','','body','0x1?_0xc28841[_0x8a67('0x10')](0x0,-0x1)[_0x8a67('0x11')]('\x20'):_0x5e26de[_0x8a67('0xb')];}return _0x8a67('0x12');}function getLastName(_0x1f3fe6){var _0x188197=_['head'](_0x1f3fe6['value']);if(_0x188197&&_0x188197['name']){var _0xf827cd=_0x188197[_0x8a67('0xb')][_0x8a67('0xe')](/\s+/);return _0xf827cd[_0x8a67('0xf')]>0x1?_0xf827cd[_0x8a67('0x13')]():'';}return'';}function getMails(_0x4e7ec6,_0x15c43a){var _0x49c2a7='';for(var _0x3e00a0=0x0;_0x3e00a0<_0x15c43a[_0x8a67('0x8')][_0x8a67('0xf')];_0x3e00a0+=0x1){if(_0x15c43a[_0x8a67('0x8')][_0x3e00a0][_0x8a67('0x9')]!==_0x4e7ec6){if(!_[_0x8a67('0x14')](_0x49c2a7)){_0x49c2a7+=',';}_0x49c2a7+=_0x15c43a[_0x8a67('0x8')][_0x3e00a0][_0x8a67('0xb')]||_0x15c43a[_0x8a67('0x8')][_0x3e00a0]['address']||'';_0x49c2a7+='\x20<';_0x49c2a7+=_0x15c43a[_0x8a67('0x8')][_0x3e00a0][_0x8a67('0x9')]?_0x15c43a[_0x8a67('0x8')][_0x3e00a0][_0x8a67('0x9')]:_0x8a67('0xa')+random[_0x8a67('0x15')](0x6)+_0x8a67('0x16');_0x49c2a7+='>';}}return _0x49c2a7;}function parseEmail(_0x5065de,_0x49a75c,_0x42d147){if(_0x49a75c['html']){var _0x481c6a=/)<[^<]*)*<\/script>/gi;while(_0x481c6a[_0x8a67('0x17')](_0x49a75c[_0x8a67('0x18')])){_0x49a75c[_0x8a67('0x18')]=_0x49a75c['html'][_0x8a67('0x19')](_0x481c6a,'');}if(_0x49a75c[_0x8a67('0x18')][_0x8a67('0x1a')](_0x8a67('0x1b'))){var _0x120acb=[];_0x49a75c[_0x8a67('0x1c')]['forEach'](_0x195096=>{_0x120acb['push'](_0x195096[_0x8a67('0x1d')]);});var _0x41ab36=/]+>/g;var _0x22fb42=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x12c963=_0x49a75c['html'][_0x8a67('0x19')](_0x22fb42,_0x8a67('0x1e'));var _0x322fbb=_0x12c963[_0x8a67('0x19')](_0x41ab36,_0x8a67('0x1f'));for(let _0x6b93c=0x0;_0x6b93c<_0x120acb['length'];_0x6b93c++){var _0x173972=_0x322fbb['replace'](_0x8a67('0x1f'),'\x20[Attachment:\x20'+_0x120acb[_0x6b93c]+_0x8a67('0x20'));_0x322fbb=_0x173972;}_0x49a75c[_0x8a67('0x18')]=_0x322fbb;}_0x42d147[_0x8a67('0x21')]=_0x49a75c[_0x8a67('0x18')];}else{_0x42d147['body']=_0x49a75c['textAsHtml'];}if(_0x42d147[_0x8a67('0x21')]){_0x42d147[_0x8a67('0x21')]=_0x42d147[_0x8a67('0x21')][_0x8a67('0x19')](/0x0){var _0x3bcf0f=[_0x8a67('0x2f'),'X-Auto-Response-Suppress:\x20All',_0x8a67('0x30')];for(var _0x523b26=0x0;_0x523b26<_0x49a75c[_0x8a67('0x2e')][_0x8a67('0xf')];_0x523b26++){var _0x35734b=_[_0x8a67('0xd')](_0x3bcf0f,_0x49a75c['headerLines'][_0x523b26][_0x8a67('0x31')]);if(_0x35734b>=0x0){_0x42d147[_0x8a67('0x32')]=!![];}}}return _0x42d147;}exports[_0x8a67('0x33')]=function(_0x1ca545,_0x372ebc,_0x381b10){var _0xa6412={'from':getAddress(_0x372ebc[_0x8a67('0x34')]),'firstName':getFirstName(_0x372ebc[_0x8a67('0x34')]),'lastName':getLastName(_0x372ebc[_0x8a67('0x34')]),'mapKey':'email','message':{'from':getMails(_0x1ca545[_0x8a67('0x5')],_0x372ebc['from']),'to':_0x1ca545[_0x8a67('0x5')],'cc':'','subject':_0x372ebc[_0x8a67('0x35')]||'','messageId':_0x372ebc[_0x8a67('0x36')],'inReplyTo':_0x372ebc[_0x8a67('0x37')],'sentAt':moment(_0x372ebc[_0x8a67('0x38')])[_0x8a67('0x39')](_0x8a67('0x3a')),'attach':![],'attachments':[]}};if(!_0x372ebc[_0x8a67('0x18')]&&!_0x372ebc[_0x8a67('0x3b')]){var _0xc1611c=_[_0x8a67('0x3c')](_0x372ebc[_0x8a67('0x1c')],{'contentType':_0x8a67('0x3d')});if(_0xc1611c['length']){logger['info'](util['format'](_0x8a67('0x3e'),_0x372ebc[_0x8a67('0x36')]));tnef[_0x8a67('0x3f')](_[_0x8a67('0x40')](_0xc1611c)[_0x8a67('0x41')],function(_0x411583,_0x59bbe2){if(_0x59bbe2){_0x372ebc['html']=_0x59bbe2['BodyHTML']||_0x8a67('0x42');if(_0x59bbe2['Attachments']){for(var _0x1ad16e=0x0;_0x1ad16e<_0x59bbe2[_0x8a67('0x43')][_0x8a67('0xf')];_0x1ad16e++){var _0x434271=_0x59bbe2['Attachments'][_0x1ad16e];_0xa6412[_0x8a67('0x23')]['attachments']['push']({'filename':_0x434271[_0x8a67('0x44')],'content':Buffer[_0x8a67('0x34')](_0x434271[_0x8a67('0x45')])});}}}_0x381b10(parseEmail(_0x1ca545,_0x372ebc,_0xa6412));});}else{_0x372ebc[_0x8a67('0x18')]=_0x8a67('0x42');_0x381b10(parseEmail(_0x1ca545,_0x372ebc,_0xa6412));}}else{_0x381b10(parseEmail(_0x1ca545,_0x372ebc,_0xa6412));}};exports[_0x8a67('0x46')]=function(_0x3cdc5a,_0x5d0a4e){var _0x42d94e=[_0x8a67('0x47')+(_0x5d0a4e||''),_0x8a67('0x48')+_0x3cdc5a,'',''];return Buffer['from'](_0x42d94e[_0x8a67('0x11')](''),'utf-8')[_0x8a67('0x49')](_0x8a67('0x4a'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 5dad435..a1b3c19 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 _0x1649=['key','SERV','active','Imap','exports','name','Service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1649,0x194));var _0x9164=function(_0x162c75,_0x3cb548){_0x162c75=_0x162c75-0x0;var _0x383f6a=_0x1649[_0x162c75];return _0x383f6a;};'use strict';var _=require('lodash');function MailAccount(_0x19d6de){this['id']=_0x19d6de['id']||0x0;this[_0x9164('0x0')]=_0x19d6de['name']||_0x9164('0x1');this[_0x9164('0x2')]=_0x19d6de[_0x9164('0x2')]||_0x9164('0x3');this[_0x9164('0x4')]=_0x19d6de[_0x9164('0x4')]||![];this['Imap']=_0x19d6de[_0x9164('0x5')]||[];this['Smtp']=_0x19d6de['Smtp']||[];}module[_0x9164('0x6')]=MailAccount; \ No newline at end of file +var _0x4ca5=['Service','key','SERV','active','Imap','Smtp','exports','lodash'];(function(_0x307607,_0x56f86b){var _0x1ee515=function(_0x5f5910){while(--_0x5f5910){_0x307607['push'](_0x307607['shift']());}};_0x1ee515(++_0x56f86b);}(_0x4ca5,0x18f));var _0x54ca=function(_0x3bf46d,_0x5d6ee5){_0x3bf46d=_0x3bf46d-0x0;var _0x21f62a=_0x4ca5[_0x3bf46d];return _0x21f62a;};'use strict';var _=require(_0x54ca('0x0'));function MailAccount(_0x34512b){this['id']=_0x34512b['id']||0x0;this['name']=_0x34512b['name']||_0x54ca('0x1');this[_0x54ca('0x2')]=_0x34512b[_0x54ca('0x2')]||_0x54ca('0x3');this['active']=_0x34512b[_0x54ca('0x4')]||![];this['Imap']=_0x34512b[_0x54ca('0x5')]||[];this['Smtp']=_0x34512b[_0x54ca('0x6')]||[];}module[_0x54ca('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index c6336ba..c1906d6 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 _0x0bac=['mergeFromDatabase','initMailAccounts','length','merge','exports','lodash','mailAccounts','mapKeys','hasOwnProperty','prototype'];(function(_0x473f31,_0x47d0f8){var _0x7efef=function(_0x52f92b){while(--_0x52f92b){_0x473f31['push'](_0x473f31['shift']());}};_0x7efef(++_0x47d0f8);}(_0x0bac,0x1b3));var _0xc0ba=function(_0x1181cc,_0x2d4ad9){_0x1181cc=_0x1181cc-0x0;var _0x286cd3=_0x0bac[_0x1181cc];return _0x286cd3;};'use strict';var _=require(_0xc0ba('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xc0ba('0x1')]={};};function freeIsNotKey(_0x4f52c5,_0xb277d7,_0x57fbc5){var _0x267d3c=_[_0xc0ba('0x2')](_0x4f52c5,function(_0x5138b2,_0x41acf4){return _0x5138b2[_0x57fbc5];});for(var _0x373181 in _0xb277d7){if(_0xb277d7[_0xc0ba('0x3')](_0x373181)){if(!_0x267d3c[_0x373181]){delete _0xb277d7[_0x373181];}}}}Realtime[_0xc0ba('0x4')][_0xc0ba('0x5')]=function(_0x49dccb,_0xa85465){for(var _0xabc0de in _0xa85465){if(_0x49dccb['hasOwnProperty'](_0xabc0de)){_0x49dccb[_0xabc0de]=_0xa85465[_0xabc0de];}}};Realtime[_0xc0ba('0x4')][_0xc0ba('0x6')]=function(){var _0x4fc299=this;return function(_0x18ef48){if(_0x18ef48){freeIsNotKey(_0x18ef48,_0x4fc299[_0xc0ba('0x1')],'id');for(var _0x162db2=0x0,_0x2d6eba={},_0x2eedda={};_0x162db2<_0x18ef48[_0xc0ba('0x7')];_0x162db2+=0x1){_0x2d6eba=_0x18ef48[_0x162db2];if(_['isUndefined'](_0x4fc299[_0xc0ba('0x1')][_0x2d6eba['id']])){_0x4fc299['mailAccounts'][_0x2d6eba['id']]=new MailAccount(_0x2d6eba);}else{_[_0xc0ba('0x8')](_0x4fc299['mailAccounts'][_0x2d6eba['id']],_0x2d6eba);}}}return _0x4fc299[_0xc0ba('0x1')];};};module[_0xc0ba('0x9')]=Realtime; \ No newline at end of file +var _0xb3d2=['hasOwnProperty','initMailAccounts','mailAccounts','merge','exports','lodash','mapKeys','prototype','mergeFromDatabase'];(function(_0x22eb22,_0x3ca3cf){var _0x2a837c=function(_0x1e5aa3){while(--_0x1e5aa3){_0x22eb22['push'](_0x22eb22['shift']());}};_0x2a837c(++_0x3ca3cf);}(_0xb3d2,0x68));var _0x2b3d=function(_0x5406f9,_0x2f03a8){_0x5406f9=_0x5406f9-0x0;var _0x17b3e8=_0xb3d2[_0x5406f9];return _0x17b3e8;};'use strict';var _=require(_0x2b3d('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x481c15,_0x4f8b9c,_0x3c8901){var _0x381e4a=_[_0x2b3d('0x1')](_0x481c15,function(_0x1c12da,_0x1decd1){return _0x1c12da[_0x3c8901];});for(var _0x45d4ea in _0x4f8b9c){if(_0x4f8b9c['hasOwnProperty'](_0x45d4ea)){if(!_0x381e4a[_0x45d4ea]){delete _0x4f8b9c[_0x45d4ea];}}}}Realtime[_0x2b3d('0x2')][_0x2b3d('0x3')]=function(_0x91d511,_0x190947){for(var _0x49d337 in _0x190947){if(_0x91d511[_0x2b3d('0x4')](_0x49d337)){_0x91d511[_0x49d337]=_0x190947[_0x49d337];}}};Realtime['prototype'][_0x2b3d('0x5')]=function(){var _0x2690c7=this;return function(_0x30d177){if(_0x30d177){freeIsNotKey(_0x30d177,_0x2690c7[_0x2b3d('0x6')],'id');for(var _0x542353=0x0,_0x56855a={},_0x4b79c2={};_0x542353<_0x30d177['length'];_0x542353+=0x1){_0x56855a=_0x30d177[_0x542353];if(_['isUndefined'](_0x2690c7[_0x2b3d('0x6')][_0x56855a['id']])){_0x2690c7[_0x2b3d('0x6')][_0x56855a['id']]=new MailAccount(_0x56855a);}else{_[_0x2b3d('0x7')](_0x2690c7[_0x2b3d('0x6')][_0x56855a['id']],_0x56855a);}}}return _0x2690c7[_0x2b3d('0x6')];};};module[_0x2b3d('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 2291c08..e171a2b 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 _0xadb5=['notify','NotifyMailAccount','getMailAccounts','GetMailAccount','name','provider','email','active','key','TemplateId','MailServerIn','Imap','CloudProvider','service','type','data5','MailServerOut','Smtp','getMailAccount'];(function(_0x40d83,_0x1d2c94){var _0x38c64c=function(_0x2ce9c1){while(--_0x2ce9c1){_0x40d83['push'](_0x40d83['shift']());}};_0x38c64c(++_0x1d2c94);}(_0xadb5,0xad));var _0x5adb=function(_0x1f436d,_0x1bbc6f){_0x1f436d=_0x1f436d-0x0;var _0xfef1c3=_0xadb5[_0x1f436d];return _0xfef1c3;};'use strict';var client=require('../client');exports[_0x5adb('0x0')]=function(){return function(){return client['Request'](_0x5adb('0x1'),{'options':{'attributes':['id',_0x5adb('0x2'),_0x5adb('0x3'),'service',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'ListId',_0x5adb('0x7')],'raw':![],'include':[{'model':_0x5adb('0x8'),'as':_0x5adb('0x9'),'include':[{'model':_0x5adb('0xa'),'attributes':['id',_0x5adb('0x2'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd')],'as':_0x5adb('0xa')}]},{'model':_0x5adb('0xe'),'as':_0x5adb('0xf'),'include':[{'model':_0x5adb('0xa'),'attributes':['id',_0x5adb('0x2'),_0x5adb('0xb'),'type','data5'],'as':_0x5adb('0xa')}]}]},'log':_0x5adb('0x10')});};};exports[_0x5adb('0x11')]=function(_0x53b772,_0x29f0d5){return client['Request'](_0x5adb('0x12'),{'account':{'id':_0x53b772},'body':_0x29f0d5,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x2b47=['email','active','key','ListId','TemplateId','Imap','type','data5','CloudProvider','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','Request','GetMailAccount','name','service'];(function(_0x305468,_0x4f8df8){var _0x1a8597=function(_0x58ef3b){while(--_0x58ef3b){_0x305468['push'](_0x305468['shift']());}};_0x1a8597(++_0x4f8df8);}(_0x2b47,0x177));var _0x72b4=function(_0xaae2aa,_0x262e63){_0xaae2aa=_0xaae2aa-0x0;var _0x14e439=_0x2b47[_0xaae2aa];return _0x14e439;};'use strict';var client=require(_0x72b4('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x72b4('0x1')](_0x72b4('0x2'),{'options':{'attributes':['id',_0x72b4('0x3'),'provider',_0x72b4('0x4'),_0x72b4('0x5'),_0x72b4('0x6'),_0x72b4('0x7'),_0x72b4('0x8'),_0x72b4('0x9')],'raw':![],'include':[{'model':'MailServerIn','as':_0x72b4('0xa'),'include':[{'model':'CloudProvider','attributes':['id',_0x72b4('0x3'),_0x72b4('0x4'),_0x72b4('0xb'),_0x72b4('0xc')],'as':_0x72b4('0xd')}]},{'model':_0x72b4('0xe'),'as':_0x72b4('0xf'),'include':[{'model':_0x72b4('0xd'),'attributes':['id',_0x72b4('0x3'),_0x72b4('0x4'),_0x72b4('0xb'),'data5'],'as':_0x72b4('0xd')}]}]},'log':_0x72b4('0x10')});};};exports[_0x72b4('0x11')]=function(_0x24cd0b,_0x19e7d3){return client[_0x72b4('0x1')](_0x72b4('0x12'),{'account':{'id':_0x24cd0b},'body':_0x19e7d3,'log':_0x72b4('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 99228cb..81bdb0c 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 _0xe4db=['ShowSetting','loginMailFrequency','../client','getSettings','Request'];(function(_0xb104fd,_0x2b3084){var _0xc858ab=function(_0x129746){while(--_0x129746){_0xb104fd['push'](_0xb104fd['shift']());}};_0xc858ab(++_0x2b3084);}(_0xe4db,0x84));var _0xbe4d=function(_0x107c1d,_0x5afdb8){_0x107c1d=_0x107c1d-0x0;var _0x2c36f2=_0xe4db[_0x107c1d];return _0x2c36f2;};'use strict';var client=require(_0xbe4d('0x0'));exports[_0xbe4d('0x1')]=function(){return client[_0xbe4d('0x2')](_0xbe4d('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbe4d('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x111d=['../client','getSettings','loginMailFrequency','GetSettings'];(function(_0xe30e17,_0xce02be){var _0x2342c9=function(_0x20b733){while(--_0x20b733){_0xe30e17['push'](_0xe30e17['shift']());}};_0x2342c9(++_0xce02be);}(_0x111d,0x1f0));var _0xd111=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x111d[_0x543084];return _0x306a57;};'use strict';var client=require(_0xd111('0x0'));exports[_0xd111('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xd111('0x2')]},'log':_0xd111('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index bf67543..161cf8a 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 2ad31ff..9ed3ff3 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 _0x562e=['Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','http','express','sticky-session','../../config/environment','createServer','websocket','defaults','redis','localhost','adapter','../../config/triggers','../../config/express','once','log'];(function(_0x30c7c5,_0x168208){var _0x29e24e=function(_0x427d3e){while(--_0x427d3e){_0x30c7c5['push'](_0x30c7c5['shift']());}};_0x29e24e(++_0x168208);}(_0x562e,0x146));var _0xe562=function(_0x2c1e67,_0x30bfcd){_0x2c1e67=_0x2c1e67-0x0;var _0x373bd4=_0x562e[_0x2c1e67];return _0x373bd4;};'use strict';var _=require('lodash');var http=require(_0xe562('0x0'));var express=require(_0xe562('0x1'));var sticky=require(_0xe562('0x2'));var Redis=require('ioredis');var config=require(_0xe562('0x3'));var app=express();var server=http[_0xe562('0x4')](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config['port'])){var socketio=require('socket.io')(server,{'transports':[_0xe562('0x5'),'polling']});config['redis']=_[_0xe562('0x6')](config[_0xe562('0x7')],{'host':_0xe562('0x8'),'port':0x18eb});socketio[_0xe562('0x9')](require('socket.io-redis')({'pubClient':new Redis(config[_0xe562('0x7')]),'subClient':new Redis(config[_0xe562('0x7')])}));require(_0xe562('0xa'))['default']();require('../../config/socketio')['default'](socketio);require(_0xe562('0xb'))['default'](app);require('../../routes')['default'](app);}else{server[_0xe562('0xc')]('listening',function(){console[_0xe562('0xd')](_0xe562('0xe'),config[_0xe562('0xf')]);});}exports=module[_0xe562('0x10')]=app; \ No newline at end of file +var _0x403a=['http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','polling','redis','defaults','adapter','socket.io-redis','../../config/triggers','../../config/socketio','../../config/express','default','../../routes','once','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash'];(function(_0x57d991,_0x5d546b){var _0x16f84c=function(_0x11f128){while(--_0x11f128){_0x57d991['push'](_0x57d991['shift']());}};_0x16f84c(++_0x5d546b);}(_0x403a,0x14f));var _0xa403=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x403a[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0xa403('0x0'));var http=require(_0xa403('0x1'));var express=require(_0xa403('0x2'));var sticky=require(_0xa403('0x3'));var Redis=require(_0xa403('0x4'));var config=require(_0xa403('0x5'));var app=express();var server=http[_0xa403('0x6')](app);server[_0xa403('0x7')]=0xdbba0;if(sticky[_0xa403('0x8')](server,config[_0xa403('0x9')])){var socketio=require(_0xa403('0xa'))(server,{'transports':['websocket',_0xa403('0xb')]});config[_0xa403('0xc')]=_[_0xa403('0xd')](config[_0xa403('0xc')],{'host':'localhost','port':0x18eb});socketio[_0xa403('0xe')](require(_0xa403('0xf'))({'pubClient':new Redis(config[_0xa403('0xc')]),'subClient':new Redis(config[_0xa403('0xc')])}));require(_0xa403('0x10'))['default']();require(_0xa403('0x11'))['default'](socketio);require(_0xa403('0x12'))[_0xa403('0x13')](app);require(_0xa403('0x14'))[_0xa403('0x13')](app);}else{server[_0xa403('0x15')]('listening',function(){console['log'](_0xa403('0x16'),config[_0xa403('0x9')]);});}exports=module[_0xa403('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index ab2fdfc..2bd5928 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 _0x3fe3=['jayson/promise','../../config/logger','client','http','request','then','debug','rpc','error','message','catch','routing','exports'];(function(_0x203d64,_0x1ec79c){var _0x462ab3=function(_0x55ee6e){while(--_0x55ee6e){_0x203d64['push'](_0x203d64['shift']());}};_0x462ab3(++_0x1ec79c);}(_0x3fe3,0xb6));var _0x33fe=function(_0x4687a2,_0x4b35bd){_0x4687a2=_0x4687a2-0x0;var _0x514865=_0x3fe3[_0x4687a2];return _0x514865;};'use strict';var jayson=require(_0x33fe('0x0'));var BPromise=require('bluebird');var logger=require(_0x33fe('0x1'))('routing');var client=jayson[_0x33fe('0x2')][_0x33fe('0x3')]({'port':0x2329});client['Request']=function(_0x5c59cd,_0x372c3e){return new BPromise(function(_0x317123,_0x407b4a){return client[_0x33fe('0x4')](_0x5c59cd,_0x372c3e)[_0x33fe('0x5')](function(_0x25857d){logger[_0x33fe('0x6')](_0x33fe('0x7'),'routing',_0x5c59cd,_0x372c3e,_0x25857d);if(_0x25857d['error']){logger[_0x33fe('0x8')](_0x33fe('0x7'),'routing',_0x5c59cd,_0x25857d[_0x33fe('0x8')][_0x33fe('0x9')],_0x372c3e);return _0x407b4a(_0x25857d[_0x33fe('0x8')][_0x33fe('0x9')]);}else{return _0x317123(_0x25857d['result']);}})[_0x33fe('0xa')](function(_0x3ffdfa){logger['error'](_0x33fe('0x7'),_0x33fe('0xb'),_0x5c59cd,_0x3ffdfa,_0x372c3e);return _0x407b4a(_0x3ffdfa);});});};module[_0x33fe('0xc')]=client; \ No newline at end of file +var _0x61ab=['then','rpc','error','message','result','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x61ab,0x1b8));var _0xb61a=function(_0x2a2170,_0x2326de){_0x2a2170=_0x2a2170-0x0;var _0x59abbe=_0x61ab[_0x2a2170];return _0x59abbe;};'use strict';var jayson=require(_0xb61a('0x0'));var BPromise=require(_0xb61a('0x1'));var logger=require(_0xb61a('0x2'))(_0xb61a('0x3'));var client=jayson[_0xb61a('0x4')][_0xb61a('0x5')]({'port':0x2329});client[_0xb61a('0x6')]=function(_0xcfea6d,_0x46f024){return new BPromise(function(_0x190622,_0x580e18){return client[_0xb61a('0x7')](_0xcfea6d,_0x46f024)[_0xb61a('0x8')](function(_0x207e31){logger['debug'](_0xb61a('0x9'),_0xb61a('0x3'),_0xcfea6d,_0x46f024,_0x207e31);if(_0x207e31[_0xb61a('0xa')]){logger[_0xb61a('0xa')]('rpc',_0xb61a('0x3'),_0xcfea6d,_0x207e31[_0xb61a('0xa')][_0xb61a('0xb')],_0x46f024);return _0x580e18(_0x207e31[_0xb61a('0xa')][_0xb61a('0xb')]);}else{return _0x190622(_0x207e31[_0xb61a('0xc')]);}})['catch'](function(_0xd73667){logger[_0xb61a('0xa')](_0xb61a('0x9'),_0xb61a('0x3'),_0xcfea6d,_0xd73667,_0x46f024);return _0x580e18(_0xd73667);});});};module[_0xb61a('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index ec4a703..04f85e6 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 _0x74c9=['getAgents','initAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/whatsappQueue','then'];(function(_0x1a9a41,_0x573a34){var _0x3430cf=function(_0x2facf6){while(--_0x2facf6){_0x1a9a41['push'](_0x1a9a41['shift']());}};_0x3430cf(++_0x573a34);}(_0x74c9,0x7d));var _0x974c=function(_0x327aee,_0x11c855){_0x327aee=_0x327aee-0x0;var _0x1f5891=_0x74c9[_0x327aee];return _0x1f5891;};'use strict';var BPromise=require(_0x974c('0x0'));var server=require(_0x974c('0x1'));var Realtime=require(_0x974c('0x2'));var user=require(_0x974c('0x3'));var interval=require(_0x974c('0x4'));var openchannelQueue=require(_0x974c('0x5'));var chatQueue=require(_0x974c('0x6'));var smsQueue=require(_0x974c('0x7'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x974c('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x974c('0x9')](user[_0x974c('0xa')]())['then'](realtime[_0x974c('0xb')]())[_0x974c('0x9')](interval[_0x974c('0xc')]())[_0x974c('0x9')](realtime[_0x974c('0xd')]())['then'](openchannelQueue['getOpenchannelQueues']())['then'](realtime[_0x974c('0xe')]())['then'](chatQueue[_0x974c('0xf')]())[_0x974c('0x9')](realtime[_0x974c('0x10')]())['then'](smsQueue[_0x974c('0x11')]())[_0x974c('0x9')](realtime[_0x974c('0x12')]())[_0x974c('0x9')](mailQueue[_0x974c('0x13')]())[_0x974c('0x9')](realtime[_0x974c('0x14')]())[_0x974c('0x9')](faxQueue[_0x974c('0x15')]())[_0x974c('0x9')](realtime[_0x974c('0x16')]())[_0x974c('0x9')](whatsappQueue[_0x974c('0x17')]())[_0x974c('0x9')](realtime[_0x974c('0x18')]())[_0x974c('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x974c('0x9')](function(_0x2cc6e7){return initRealtime();})[_0x974c('0x9')](function(_0x216105){return setInterval(initRealtime,0x1388);})[_0x974c('0x19')](function(_0x25d2d3){console[_0x974c('0x1a')](_0x25d2d3);});}main(); \ No newline at end of file +var _0xb6bb=['./rpc/whatsappQueue','resolve','getAgents','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','listen','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue'];(function(_0x154432,_0x16dfcf){var _0x387e4f=function(_0x27be4f){while(--_0x27be4f){_0x154432['push'](_0x154432['shift']());}};_0x387e4f(++_0x16dfcf);}(_0xb6bb,0xe1));var _0xbb6b=function(_0x4de5ea,_0x39b279){_0x4de5ea=_0x4de5ea-0x0;var _0x20fb91=_0xb6bb[_0x4de5ea];return _0x20fb91;};'use strict';var BPromise=require(_0xbb6b('0x0'));var server=require(_0xbb6b('0x1'));var Realtime=require(_0xbb6b('0x2'));var user=require(_0xbb6b('0x3'));var interval=require(_0xbb6b('0x4'));var openchannelQueue=require(_0xbb6b('0x5'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xbb6b('0x6'));var mailQueue=require(_0xbb6b('0x7'));var faxQueue=require(_0xbb6b('0x8'));var whatsappQueue=require(_0xbb6b('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xbb6b('0xa')]()['then'](user[_0xbb6b('0xb')]())[_0xbb6b('0xc')](realtime[_0xbb6b('0xd')]())['then'](interval[_0xbb6b('0xe')]())[_0xbb6b('0xc')](realtime[_0xbb6b('0xf')]())[_0xbb6b('0xc')](openchannelQueue[_0xbb6b('0x10')]())[_0xbb6b('0xc')](realtime['initOpenchannelQueues']())[_0xbb6b('0xc')](chatQueue['getChatQueues']())['then'](realtime[_0xbb6b('0x11')]())[_0xbb6b('0xc')](smsQueue[_0xbb6b('0x12')]())[_0xbb6b('0xc')](realtime[_0xbb6b('0x13')]())[_0xbb6b('0xc')](mailQueue[_0xbb6b('0x14')]())[_0xbb6b('0xc')](realtime[_0xbb6b('0x15')]())[_0xbb6b('0xc')](faxQueue[_0xbb6b('0x16')]())['then'](realtime['initFaxQueues']())[_0xbb6b('0xc')](whatsappQueue[_0xbb6b('0x17')]())['then'](realtime['initWhatsappQueues']())['then'](function(){return realtime;});}function main(){return server[_0xbb6b('0x18')](realtime)['then'](function(_0x52796f){return initRealtime();})['then'](function(_0x3a1d16){return setInterval(initRealtime,0x1388);})['catch'](function(_0x9441c9){console[_0xbb6b('0x19')](_0x9441c9);});}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 3c7b7dc..f5da556 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x389528,_0x104462){var _0x165786=function(_0x4534c5){while(--_0x4534c5){_0x389528['push'](_0x389528['shift']());}};_0x165786(++_0x104462);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xc4aa[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file +var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x12bcf7,_0x20878d){var _0x516440=function(_0x26eff1){while(--_0x26eff1){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x516440(++_0x20878d);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x5fc3[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index b3ccb48..3222579 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 _0xcf14=['result','catch','bluebird','jayson/promise','client','request','error','message'];(function(_0x55a348,_0x15a153){var _0x2c28c7=function(_0x359f43){while(--_0x359f43){_0x55a348['push'](_0x55a348['shift']());}};_0x2c28c7(++_0x15a153);}(_0xcf14,0x1b2));var _0x4cf1=function(_0x1fb56e,_0x4b3c87){_0x1fb56e=_0x1fb56e-0x0;var _0x42cb53=_0xcf14[_0x1fb56e];return _0x42cb53;};'use strict';var BPromise=require(_0x4cf1('0x0'));var jayson=require(_0x4cf1('0x1'));var client=jayson[_0x4cf1('0x2')]['http']({'port':0x232b});function request(_0x5d9db4,_0x3ed4a6){return new BPromise(function(_0x3d118c,_0x5d107c){return client[_0x4cf1('0x3')](_0x5d9db4,_0x3ed4a6)['then'](function(_0x3eaec9){if(_0x3eaec9[_0x4cf1('0x4')]){return _0x5d107c(_0x3eaec9['error'][_0x4cf1('0x5')]);}else{return _0x3d118c(_0x3eaec9[_0x4cf1('0x6')]);}})[_0x4cf1('0x7')](function(_0x1392b9){return _0x5d107c(_0x1392b9);});});}exports['sendMailMessage']=function(_0x26f27d,_0x214be8){return request('SendMail',{'account':_0x26f27d,'message':_0x214be8});}; \ No newline at end of file +var _0xb909=['client','http','request','then','error','result','catch','sendMailMessage','SendMail','bluebird'];(function(_0xb0a850,_0x109004){var _0x569790=function(_0x35831e){while(--_0x35831e){_0xb0a850['push'](_0xb0a850['shift']());}};_0x569790(++_0x109004);}(_0xb909,0x1f3));var _0x9b90=function(_0x55f5fd,_0x251323){_0x55f5fd=_0x55f5fd-0x0;var _0xea095b=_0xb909[_0x55f5fd];return _0xea095b;};'use strict';var BPromise=require(_0x9b90('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x9b90('0x1')][_0x9b90('0x2')]({'port':0x232b});function request(_0x35eb1b,_0x4635e9){return new BPromise(function(_0x59f619,_0x3c739e){return client[_0x9b90('0x3')](_0x35eb1b,_0x4635e9)[_0x9b90('0x4')](function(_0x470966){if(_0x470966['error']){return _0x3c739e(_0x470966[_0x9b90('0x5')]['message']);}else{return _0x59f619(_0x470966[_0x9b90('0x6')]);}})[_0x9b90('0x7')](function(_0x31af30){return _0x3c739e(_0x31af30);});});}exports[_0x9b90('0x8')]=function(_0x1236ab,_0x4164a8){return request(_0x9b90('0x9'),{'account':_0x1236ab,'message':_0x4164a8});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 2e8ab28..fc51355 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 _0x91cd=['faxStatus','faxCurrentCapacity','smsCurrentCapacity','openchannelStatus','emit','exports','lodash','moment','md5','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','smsPause','chatStatus','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','unknown','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','openchannel','fax','length','Status','format','faxPause'];(function(_0x52a1c3,_0x128e4a){var _0xac60a6=function(_0x416dcd){while(--_0x416dcd){_0x52a1c3['push'](_0x52a1c3['shift']());}};_0xac60a6(++_0x128e4a);}(_0x91cd,0x7e));var _0xd91c=function(_0x705b98,_0x1c345b){_0x705b98=_0x705b98-0x0;var _0x47b72f=_0x91cd[_0x705b98];return _0x47b72f;};'use strict';var _=require(_0xd91c('0x0'));var moment=require(_0xd91c('0x1'));var md5=require(_0xd91c('0x2'));var Redis=require('ioredis');var config=require(_0xd91c('0x3'));config[_0xd91c('0x4')]=_[_0xd91c('0x5')](config[_0xd91c('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xd91c('0x6'))(new Redis(config[_0xd91c('0x4')]));function Agent(_0x1ca62d){this['id']=_0x1ca62d['id']||0x0;this[_0xd91c('0x7')]=_0x1ca62d[_0xd91c('0x7')]||'';this[_0xd91c('0x8')]=_0x1ca62d[_0xd91c('0x8')]||!![];this[_0xd91c('0x9')]=_0x1ca62d[_0xd91c('0x9')]||![];this[_0xd91c('0xa')]=_0x1ca62d[_0xd91c('0xa')]||![];this[_0xd91c('0xb')]=_0x1ca62d[_0xd91c('0xb')]||![];this['faxPause']=_0x1ca62d['faxPause']||![];this[_0xd91c('0xc')]=_0x1ca62d[_0xd91c('0xc')]||![];this['openchannelPause']=_0x1ca62d['openchannelPause']||![];this[_0xd91c('0xd')]='unknown';this['chatStatusTime']=0x0;this[_0xd91c('0xe')]=_0x1ca62d[_0xd91c('0xe')]||0x0;this['chatCurrentCapacity']=0x0;this[_0xd91c('0xf')]='unknown';this[_0xd91c('0x10')]=0x0;this[_0xd91c('0x11')]=_0x1ca62d[_0xd91c('0x11')]||0x0;this[_0xd91c('0x12')]=0x0;this['faxStatus']=_0xd91c('0x13');this[_0xd91c('0x14')]=0x0;this[_0xd91c('0x15')]=_0x1ca62d[_0xd91c('0x15')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xd91c('0x16')]='unknown';this[_0xd91c('0x17')]=0x0;this[_0xd91c('0x18')]=_0x1ca62d[_0xd91c('0x18')]||0x0;this['smsCurrentCapacity']=0x0;this[_0xd91c('0x19')]=_0xd91c('0x13');this[_0xd91c('0x1a')]=0x0;this[_0xd91c('0x1b')]=_0x1ca62d[_0xd91c('0x1b')]||0x0;this[_0xd91c('0x1c')]=0x0;this['openchannelStatus']=_0xd91c('0x13');this[_0xd91c('0x1d')]=0x0;this[_0xd91c('0x1e')]=_0x1ca62d[_0xd91c('0x1e')]||0x0;this[_0xd91c('0x1f')]=0x0;this[_0xd91c('0x20')]=![];this[_0xd91c('0x21')]=undefined;this['md5']='';this[_0xd91c('0x22')]={};this[_0xd91c('0x23')]={};this[_0xd91c('0x24')]={};this[_0xd91c('0x25')]={};this[_0xd91c('0x26')]={};this[_0xd91c('0x27')]={};this[_0xd91c('0x28')]();}Agent[_0xd91c('0x29')][_0xd91c('0x2a')]=function(_0xaafa26){if(this[_0xaafa26+_0xd91c('0x2b')]>0x0){if(this[_0xaafa26+_0xd91c('0x2c')]>0x0&&this[_0xaafa26+_0xd91c('0x2b')]>=this[_0xaafa26+_0xd91c('0x2c')]){return _0xd91c('0x2d');}else{return _0xd91c('0x2e');}}else{return _0xd91c('0x2f');}};Agent['prototype'][_0xd91c('0x28')]=function(){var _0x4465ad=['mail','chat',_0xd91c('0x30'),_0xd91c('0x31'),'sms','whatsapp'];for(var _0x12a7ea=0x0;_0x12a7ea<_0x4465ad[_0xd91c('0x32')];_0x12a7ea+=0x1){var _0x4edf89=this[_0xd91c('0x2a')](_0x4465ad[_0x12a7ea]);if(this[_0x4465ad[_0x12a7ea]+_0xd91c('0x33')]!==_0x4edf89){this[_0x4465ad[_0x12a7ea]+'StatusTime']=_['toNumber'](moment()[_0xd91c('0x34')]('x'));}this[_0x4465ad[_0x12a7ea]+_0xd91c('0x33')]=_0x4edf89;}var _0x4407de={'id':this['id'],'name':this['name'],'online':this[_0xd91c('0x8')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this[_0xd91c('0xb')],'smsPause':this[_0xd91c('0xc')],'faxPause':this[_0xd91c('0x35')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xd91c('0xe')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xd91c('0xf')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xd91c('0x11')],'mailCurrentCapacity':this[_0xd91c('0x12')],'faxStatus':this[_0xd91c('0x36')],'faxStatusTime':this[_0xd91c('0x14')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xd91c('0x37')],'smsStatus':this[_0xd91c('0x16')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xd91c('0x18')],'smsCurrentCapacity':this[_0xd91c('0x38')],'whatsappStatus':this[_0xd91c('0x19')],'whatsappStatusTime':this[_0xd91c('0x1a')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0xd91c('0x1c')],'openchannelStatus':this[_0xd91c('0x39')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xd91c('0x1e')],'openchannelCurrentCapacity':this[_0xd91c('0x1f')],'busy':this[_0xd91c('0x20')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0xd91c('0x22')],'faxWaitingInteractions':this[_0xd91c('0x23')],'mailWaitingInteractions':this[_0xd91c('0x24')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0xd91c('0x26')],'whatsappWaitingInteractions':this[_0xd91c('0x27')]};var _0x3d379c=md5(JSON['stringify'](_0x4407de));if(this['md5']!==_0x3d379c){this[_0xd91c('0x2')]=_0x3d379c;io[_0xd91c('0x3a')]('user:save',_0x4407de);}};module[_0xd91c('0x3b')]=Agent; \ No newline at end of file +var _0x75dd=['mailStatus','smsCurrentCapacity','whatsappStatus','openchannelStatus','busyQueue','stringify','emit','user:save','moment','md5','ioredis','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','busy','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','prototype','getChannelStatus','Capacity','maxcapacity','working','idle','updateRealtime','mail','chat','fax','sms','whatsapp','length','Status','StatusTime','format','chatStatus','chatCurrentCapacity'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x75dd,0x188));var _0xd75d=function(_0x2efede,_0x5c9b9a){_0x2efede=_0x2efede-0x0;var _0xfab84c=_0x75dd[_0x2efede];return _0xfab84c;};'use strict';var _=require('lodash');var moment=require(_0xd75d('0x0'));var md5=require(_0xd75d('0x1'));var Redis=require(_0xd75d('0x2'));var config=require('../../../config/environment');config[_0xd75d('0x3')]=_['defaults'](config['redis'],{'host':_0xd75d('0x4'),'port':0x18eb});var io=require(_0xd75d('0x5'))(new Redis(config[_0xd75d('0x3')]));function Agent(_0x5ab8ea){this['id']=_0x5ab8ea['id']||0x0;this[_0xd75d('0x6')]=_0x5ab8ea[_0xd75d('0x6')]||'';this[_0xd75d('0x7')]=_0x5ab8ea[_0xd75d('0x7')]||!![];this[_0xd75d('0x8')]=_0x5ab8ea[_0xd75d('0x8')]||![];this[_0xd75d('0x9')]=_0x5ab8ea[_0xd75d('0x9')]||![];this[_0xd75d('0xa')]=_0x5ab8ea[_0xd75d('0xa')]||![];this[_0xd75d('0xb')]=_0x5ab8ea['faxPause']||![];this['smsPause']=_0x5ab8ea[_0xd75d('0xc')]||![];this[_0xd75d('0xd')]=_0x5ab8ea[_0xd75d('0xd')]||![];this['chatStatus']=_0xd75d('0xe');this[_0xd75d('0xf')]=0x0;this[_0xd75d('0x10')]=_0x5ab8ea['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']=_0xd75d('0xe');this['mailStatusTime']=0x0;this[_0xd75d('0x11')]=_0x5ab8ea[_0xd75d('0x11')]||0x0;this[_0xd75d('0x12')]=0x0;this[_0xd75d('0x13')]=_0xd75d('0xe');this[_0xd75d('0x14')]=0x0;this['faxCapacity']=_0x5ab8ea[_0xd75d('0x15')]||0x0;this[_0xd75d('0x16')]=0x0;this[_0xd75d('0x17')]=_0xd75d('0xe');this[_0xd75d('0x18')]=0x0;this[_0xd75d('0x19')]=_0x5ab8ea[_0xd75d('0x19')]||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']='unknown';this[_0xd75d('0x1a')]=0x0;this[_0xd75d('0x1b')]=_0x5ab8ea['whatsappCapacity']||0x0;this[_0xd75d('0x1c')]=0x0;this['openchannelStatus']=_0xd75d('0xe');this[_0xd75d('0x1d')]=0x0;this[_0xd75d('0x1e')]=_0x5ab8ea[_0xd75d('0x1e')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xd75d('0x1f')]=![];this['busyQueue']=undefined;this[_0xd75d('0x1')]='';this[_0xd75d('0x20')]={};this[_0xd75d('0x21')]={};this[_0xd75d('0x22')]={};this[_0xd75d('0x23')]={};this[_0xd75d('0x24')]={};this[_0xd75d('0x25')]={};this['updateRealtime']();}Agent[_0xd75d('0x26')][_0xd75d('0x27')]=function(_0x2f2944){if(this[_0x2f2944+'CurrentCapacity']>0x0){if(this[_0x2f2944+_0xd75d('0x28')]>0x0&&this[_0x2f2944+'CurrentCapacity']>=this[_0x2f2944+_0xd75d('0x28')]){return _0xd75d('0x29');}else{return _0xd75d('0x2a');}}else{return _0xd75d('0x2b');}};Agent['prototype'][_0xd75d('0x2c')]=function(){var _0x5a5bf7=[_0xd75d('0x2d'),_0xd75d('0x2e'),'openchannel',_0xd75d('0x2f'),_0xd75d('0x30'),_0xd75d('0x31')];for(var _0x2bad26=0x0;_0x2bad26<_0x5a5bf7[_0xd75d('0x32')];_0x2bad26+=0x1){var _0x480c2f=this[_0xd75d('0x27')](_0x5a5bf7[_0x2bad26]);if(this[_0x5a5bf7[_0x2bad26]+_0xd75d('0x33')]!==_0x480c2f){this[_0x5a5bf7[_0x2bad26]+_0xd75d('0x34')]=_['toNumber'](moment()[_0xd75d('0x35')]('x'));}this[_0x5a5bf7[_0x2bad26]+_0xd75d('0x33')]=_0x480c2f;}var _0x2fa6a2={'id':this['id'],'name':this[_0xd75d('0x6')],'online':this[_0xd75d('0x7')],'voicePause':this[_0xd75d('0x8')],'chatPause':this[_0xd75d('0x9')],'mailPause':this['mailPause'],'smsPause':this[_0xd75d('0xc')],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xd75d('0x36')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xd75d('0x37')],'mailStatus':this[_0xd75d('0x38')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xd75d('0x11')],'mailCurrentCapacity':this[_0xd75d('0x12')],'faxStatus':this[_0xd75d('0x13')],'faxStatusTime':this[_0xd75d('0x14')],'faxCapacity':this[_0xd75d('0x15')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xd75d('0x39')],'whatsappStatus':this[_0xd75d('0x3a')],'whatsappStatusTime':this[_0xd75d('0x1a')],'whatsappCapacity':this[_0xd75d('0x1b')],'whatsappCurrentCapacity':this[_0xd75d('0x1c')],'openchannelStatus':this[_0xd75d('0x3b')],'openchannelStatusTime':this[_0xd75d('0x1d')],'openchannelCapacity':this[_0xd75d('0x1e')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xd75d('0x1f')],'busyQueue':this[_0xd75d('0x3c')],'chatWaitingInteractions':this[_0xd75d('0x20')],'faxWaitingInteractions':this[_0xd75d('0x21')],'mailWaitingInteractions':this[_0xd75d('0x22')],'openchannelWaitingInteractions':this[_0xd75d('0x23')],'smsWaitingInteractions':this[_0xd75d('0x24')],'whatsappWaitingInteractions':this[_0xd75d('0x25')]};var _0x5bbfdb=md5(JSON[_0xd75d('0x3d')](_0x2fa6a2));if(this[_0xd75d('0x1')]!==_0x5bbfdb){this[_0xd75d('0x1')]=_0x5bbfdb;io[_0xd75d('0x3e')](_0xd75d('0x3f'),_0x2fa6a2);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index a95879a..8da3289 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 _0xc231=['Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','paused','available','loggedIn','waiting','stringify','format','chat:queue:%s','emit','md5','util','ioredis','../../../config/environment','redis','defaults','name','timeout','strategy','beepall'];(function(_0x34deda,_0x37a99a){var _0x237e8c=function(_0xbbff11){while(--_0xbbff11){_0x34deda['push'](_0x34deda['shift']());}};_0x237e8c(++_0x37a99a);}(_0xc231,0x1d1));var _0x1c23=function(_0x5330ce,_0x390bfc){_0x5330ce=_0x5330ce-0x0;var _0x146a90=_0xc231[_0x5330ce];return _0x146a90;};'use strict';var _=require('lodash');var md5=require(_0x1c23('0x0'));var util=require(_0x1c23('0x1'));var Redis=require(_0x1c23('0x2'));var config=require(_0x1c23('0x3'));config[_0x1c23('0x4')]=_[_0x1c23('0x5')](config[_0x1c23('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1c23('0x4')]));function ChatQueue(_0x2da14d){this['id']=_0x2da14d['id']||0x0;this[_0x1c23('0x6')]=_0x2da14d['name']||'';this[_0x1c23('0x7')]=_0x2da14d[_0x1c23('0x7')]||0xa;this['strategy']=_0x2da14d[_0x1c23('0x8')]||_0x1c23('0x9');this[_0x1c23('0xa')]=_0x2da14d[_0x1c23('0xa')];this[_0x1c23('0xb')]={};this['waiting']=0x0;this[_0x1c23('0x0')]='';this[_0x1c23('0xc')]();this[_0x1c23('0xd')]();}ChatQueue[_0x1c23('0xe')][_0x1c23('0xc')]=function(){var _0x227654=this[_0x1c23('0xb')][_0x1c23('0xf')];this[_0x1c23('0xb')]=_[_0x1c23('0x10')](this[_0x1c23('0xa')],'id');this[_0x1c23('0xb')][_0x1c23('0xf')]=_0x227654;};ChatQueue[_0x1c23('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x1c23('0x11')]=0x0;for(var _0x269656=0x0;_0x269656=0x0?this[_0x1c23('0x12')]:0x0;var _0x3df746={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1c23('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1c23('0x14')]};var _0x5bb806=md5(JSON[_0x1c23('0x15')](_0x3df746));if(this['md5']!==_0x5bb806){this['md5']=_0x5bb806;io['to'](util[_0x1c23('0x16')](_0x1c23('0x17'),_0x3df746[_0x1c23('0x6')]))[_0x1c23('0x18')]('chat_queue:save',_0x3df746);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x2470=['chat:queue:%s','emit','chat_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','chatPause','available','format'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x2470,0xb8));var _0x0247=function(_0x5ac9fe,_0x123b4f){_0x5ac9fe=_0x5ac9fe-0x0;var _0x2c500e=_0x2470[_0x5ac9fe];return _0x2c500e;};'use strict';var _=require('lodash');var md5=require(_0x0247('0x0'));var util=require(_0x0247('0x1'));var Redis=require(_0x0247('0x2'));var config=require(_0x0247('0x3'));config[_0x0247('0x4')]=_[_0x0247('0x5')](config[_0x0247('0x4')],{'host':_0x0247('0x6'),'port':0x18eb});var io=require(_0x0247('0x7'))(new Redis(config[_0x0247('0x4')]));function ChatQueue(_0x18ff85){this['id']=_0x18ff85['id']||0x0;this['name']=_0x18ff85[_0x0247('0x8')]||'';this[_0x0247('0x9')]=_0x18ff85[_0x0247('0x9')]||0xa;this['strategy']=_0x18ff85[_0x0247('0xa')]||'beepall';this[_0x0247('0xb')]=_0x18ff85['Agents'];this[_0x0247('0xc')]={};this[_0x0247('0xd')]=0x0;this[_0x0247('0x0')]='';this[_0x0247('0xe')]();this[_0x0247('0xf')]();}ChatQueue[_0x0247('0x10')]['updateRouting']=function(){var _0xb7ff89=this[_0x0247('0xc')][_0x0247('0x11')];this[_0x0247('0xc')]=_[_0x0247('0x12')](this[_0x0247('0xb')],'id');this['mapAgentsId'][_0x0247('0x11')]=_0xb7ff89;};ChatQueue['prototype'][_0x0247('0xf')]=function(){this['loggedIn']=0x0;this[_0x0247('0x13')]=0x0;for(var _0x3dcd70=0x0;_0x3dcd70=0x0?this[_0x0247('0x18')]:0x0;var _0x197105={'id':this['id'],'available':this[_0x0247('0x18')],'loggedIn':this[_0x0247('0x16')],'name':this['name'],'paused':this[_0x0247('0x13')],'waiting':this['waiting']};var _0x3d038a=md5(JSON['stringify'](_0x197105));if(this[_0x0247('0x0')]!==_0x3d038a){this['md5']=_0x3d038a;io['to'](util[_0x0247('0x19')](_0x0247('0x1a'),_0x197105['name']))[_0x0247('0x1b')](_0x0247('0x1c'),_0x197105);}};module[_0x0247('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index d9963ed..03c1d72 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 _0x9db3=['fax_queue:save','exports','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','paused','online','loggedIn','faxPause','available','stringify','format'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0x9db3,0x161));var _0x39db=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x9db3[_0x413feb];return _0x40ee88;};'use strict';var _=require('lodash');var md5=require(_0x39db('0x0'));var util=require(_0x39db('0x1'));var Redis=require(_0x39db('0x2'));var config=require('../../../config/environment');config[_0x39db('0x3')]=_[_0x39db('0x4')](config[_0x39db('0x3')],{'host':_0x39db('0x5'),'port':0x18eb});var io=require(_0x39db('0x6'))(new Redis(config[_0x39db('0x3')]));function FaxQueue(_0x4e7f58){this['id']=_0x4e7f58['id']||0x0;this[_0x39db('0x7')]=_0x4e7f58[_0x39db('0x7')]||'';this[_0x39db('0x8')]=_0x4e7f58[_0x39db('0x8')]||0xa;this[_0x39db('0x9')]=_0x4e7f58['strategy']||'beepall';this[_0x39db('0xa')]=_0x4e7f58[_0x39db('0xa')];this[_0x39db('0xb')]={};this[_0x39db('0xc')]=0x0;this['md5']='';this[_0x39db('0xd')]();this[_0x39db('0xe')]();}FaxQueue[_0x39db('0xf')][_0x39db('0xd')]=function(){var _0x5e86ff=this[_0x39db('0xb')]['_rr'];this['mapAgentsId']=_[_0x39db('0x10')](this[_0x39db('0xa')],'id');this[_0x39db('0xb')][_0x39db('0x11')]=_0x5e86ff;};FaxQueue['prototype'][_0x39db('0xe')]=function(){this['loggedIn']=0x0;this[_0x39db('0x12')]=0x0;for(var _0x47c3c0=0x0;_0x47c3c0=0x0?this[_0x39db('0x16')]:0x0;var _0x20e881={'id':this['id'],'available':this[_0x39db('0x16')],'loggedIn':this[_0x39db('0x14')],'name':this['name'],'paused':this[_0x39db('0x12')],'waiting':this[_0x39db('0xc')]};var _0x59efd5=md5(JSON[_0x39db('0x17')](_0x20e881));if(this[_0x39db('0x0')]!==_0x59efd5){this[_0x39db('0x0')]=_0x59efd5;io['to'](util[_0x39db('0x18')]('fax:queue:%s',_0x20e881[_0x39db('0x7')]))['emit'](_0x39db('0x19'),_0x20e881);}};module[_0x39db('0x1a')]=FaxQueue; \ No newline at end of file +var _0xa0a0=['prototype','_rr','map','loggedIn','paused','length','faxPause','available','stringify','format','emit','fax_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x26df3f,_0x50bfc8){var _0x239cc4=function(_0x5af5f3){while(--_0x5af5f3){_0x26df3f['push'](_0x26df3f['shift']());}};_0x239cc4(++_0x50bfc8);}(_0xa0a0,0x1a3));var _0x0a0a=function(_0x1ca9e9,_0x1c4391){_0x1ca9e9=_0x1ca9e9-0x0;var _0x309f3c=_0xa0a0[_0x1ca9e9];return _0x309f3c;};'use strict';var _=require(_0x0a0a('0x0'));var md5=require(_0x0a0a('0x1'));var util=require(_0x0a0a('0x2'));var Redis=require('ioredis');var config=require(_0x0a0a('0x3'));config[_0x0a0a('0x4')]=_[_0x0a0a('0x5')](config[_0x0a0a('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x0a0a('0x6'))(new Redis(config[_0x0a0a('0x4')]));function FaxQueue(_0x13b8e6){this['id']=_0x13b8e6['id']||0x0;this['name']=_0x13b8e6[_0x0a0a('0x7')]||'';this[_0x0a0a('0x8')]=_0x13b8e6[_0x0a0a('0x8')]||0xa;this[_0x0a0a('0x9')]=_0x13b8e6[_0x0a0a('0x9')]||_0x0a0a('0xa');this[_0x0a0a('0xb')]=_0x13b8e6[_0x0a0a('0xb')];this[_0x0a0a('0xc')]={};this[_0x0a0a('0xd')]=0x0;this[_0x0a0a('0x1')]='';this[_0x0a0a('0xe')]();this[_0x0a0a('0xf')]();}FaxQueue[_0x0a0a('0x10')][_0x0a0a('0xe')]=function(){var _0x37b625=this[_0x0a0a('0xc')][_0x0a0a('0x11')];this[_0x0a0a('0xc')]=_[_0x0a0a('0x12')](this[_0x0a0a('0xb')],'id');this[_0x0a0a('0xc')]['_rr']=_0x37b625;};FaxQueue[_0x0a0a('0x10')][_0x0a0a('0xf')]=function(){this[_0x0a0a('0x13')]=0x0;this[_0x0a0a('0x14')]=0x0;for(var _0x21cb0f=0x0;_0x21cb0f=0x0?this[_0x0a0a('0x17')]:0x0;var _0x49d36c={'id':this['id'],'available':this[_0x0a0a('0x17')],'loggedIn':this[_0x0a0a('0x13')],'name':this[_0x0a0a('0x7')],'paused':this[_0x0a0a('0x14')],'waiting':this[_0x0a0a('0xd')]};var _0x4f7325=md5(JSON[_0x0a0a('0x18')](_0x49d36c));if(this[_0x0a0a('0x1')]!==_0x4f7325){this[_0x0a0a('0x1')]=_0x4f7325;io['to'](util[_0x0a0a('0x19')]('fax:queue:%s',_0x49d36c[_0x0a0a('0x7')]))[_0x0a0a('0x1a')](_0x0a0a('0x1b'),_0x49d36c);}};module[_0x0a0a('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index b927c69..bca0c5c 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 _0x2f9d=['name','Intervals','exports'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x2f9d,0x1ef));var _0xd2f9=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x2f9d[_0x92c450];return _0x2a9599;};'use strict';function Interval(_0x3dbb04){this['id']=_0x3dbb04['id']||0x0;this['name']=_0x3dbb04[_0xd2f9('0x0')]||'';this[_0xd2f9('0x1')]=_0x3dbb04[_0xd2f9('0x1')]||{};}module[_0xd2f9('0x2')]=Interval; \ No newline at end of file +var _0x22a0=['Intervals','name'];(function(_0x43c55c,_0x105345){var _0x459a97=function(_0x18f468){while(--_0x18f468){_0x43c55c['push'](_0x43c55c['shift']());}};_0x459a97(++_0x105345);}(_0x22a0,0x18b));var _0x022a=function(_0x1ae964,_0x5cee0c){_0x1ae964=_0x1ae964-0x0;var _0x4212d5=_0x22a0[_0x1ae964];return _0x4212d5;};'use strict';function Interval(_0x4bd3c6){this['id']=_0x4bd3c6['id']||0x0;this[_0x022a('0x0')]=_0x4bd3c6[_0x022a('0x0')]||'';this[_0x022a('0x1')]=_0x4bd3c6[_0x022a('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 d00781a..f2fe99f 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 _0xee94=['mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype','updateRouting','map','loggedIn','length','online','mailPause','paused','available','waiting','stringify','format'];(function(_0x360484,_0x2d14e5){var _0x461a10=function(_0x4c47c3){while(--_0x4c47c3){_0x360484['push'](_0x360484['shift']());}};_0x461a10(++_0x2d14e5);}(_0xee94,0x104));var _0x4ee9=function(_0x29b79f,_0x591a52){_0x29b79f=_0x29b79f-0x0;var _0x23f82a=_0xee94[_0x29b79f];return _0x23f82a;};'use strict';var _=require(_0x4ee9('0x0'));var md5=require(_0x4ee9('0x1'));var util=require(_0x4ee9('0x2'));var Redis=require(_0x4ee9('0x3'));var config=require(_0x4ee9('0x4'));config[_0x4ee9('0x5')]=_[_0x4ee9('0x6')](config[_0x4ee9('0x5')],{'host':_0x4ee9('0x7'),'port':0x18eb});var io=require(_0x4ee9('0x8'))(new Redis(config[_0x4ee9('0x5')]));function MailQueue(_0x32e769){this['id']=_0x32e769['id']||0x0;this[_0x4ee9('0x9')]=_0x32e769[_0x4ee9('0x9')]||'';this[_0x4ee9('0xa')]=_0x32e769[_0x4ee9('0xa')]||0xa;this['strategy']=_0x32e769[_0x4ee9('0xb')]||_0x4ee9('0xc');this[_0x4ee9('0xd')]=_0x32e769[_0x4ee9('0xd')];this[_0x4ee9('0xe')]={};this['waiting']=0x0;this[_0x4ee9('0x1')]='';this['updateRouting']();this[_0x4ee9('0xf')]();}MailQueue[_0x4ee9('0x10')][_0x4ee9('0x11')]=function(){var _0x5c0788=this[_0x4ee9('0xe')]['_rr'];this[_0x4ee9('0xe')]=_[_0x4ee9('0x12')](this[_0x4ee9('0xd')],'id');this[_0x4ee9('0xe')]['_rr']=_0x5c0788;};MailQueue[_0x4ee9('0x10')][_0x4ee9('0xf')]=function(){this[_0x4ee9('0x13')]=0x0;this['paused']=0x0;for(var _0x323cdc=0x0;_0x323cdc=0x0?this[_0x4ee9('0x18')]:0x0;var _0x18f6c1={'id':this['id'],'available':this[_0x4ee9('0x18')],'loggedIn':this[_0x4ee9('0x13')],'name':this[_0x4ee9('0x9')],'paused':this[_0x4ee9('0x17')],'waiting':this[_0x4ee9('0x19')]};var _0x10e924=md5(JSON[_0x4ee9('0x1a')](_0x18f6c1));if(this[_0x4ee9('0x1')]!==_0x10e924){this['md5']=_0x10e924;io['to'](util[_0x4ee9('0x1b')](_0x4ee9('0x1c'),_0x18f6c1['name']))[_0x4ee9('0x1d')](_0x4ee9('0x1e'),_0x18f6c1);}};module[_0x4ee9('0x1f')]=MailQueue; \ No newline at end of file +var _0x50d5=['ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','mailPause','available','format','mail:queue:%s','emit','lodash','md5','util'];(function(_0x178f9c,_0x9dc87a){var _0x413f4a=function(_0xfe1042){while(--_0xfe1042){_0x178f9c['push'](_0x178f9c['shift']());}};_0x413f4a(++_0x9dc87a);}(_0x50d5,0x14d));var _0x550d=function(_0x2a2492,_0x4de476){_0x2a2492=_0x2a2492-0x0;var _0xf3aaa0=_0x50d5[_0x2a2492];return _0xf3aaa0;};'use strict';var _=require(_0x550d('0x0'));var md5=require(_0x550d('0x1'));var util=require(_0x550d('0x2'));var Redis=require(_0x550d('0x3'));var config=require(_0x550d('0x4'));config[_0x550d('0x5')]=_['defaults'](config[_0x550d('0x5')],{'host':_0x550d('0x6'),'port':0x18eb});var io=require(_0x550d('0x7'))(new Redis(config[_0x550d('0x5')]));function MailQueue(_0x144d99){this['id']=_0x144d99['id']||0x0;this[_0x550d('0x8')]=_0x144d99[_0x550d('0x8')]||'';this[_0x550d('0x9')]=_0x144d99[_0x550d('0x9')]||0xa;this[_0x550d('0xa')]=_0x144d99[_0x550d('0xa')]||'beepall';this[_0x550d('0xb')]=_0x144d99['Agents'];this[_0x550d('0xc')]={};this[_0x550d('0xd')]=0x0;this[_0x550d('0x1')]='';this[_0x550d('0xe')]();this[_0x550d('0xf')]();}MailQueue[_0x550d('0x10')][_0x550d('0xe')]=function(){var _0x127bc0=this[_0x550d('0xc')][_0x550d('0x11')];this['mapAgentsId']=_[_0x550d('0x12')](this[_0x550d('0xb')],'id');this['mapAgentsId']['_rr']=_0x127bc0;};MailQueue[_0x550d('0x10')][_0x550d('0xf')]=function(){this['loggedIn']=0x0;this[_0x550d('0x13')]=0x0;for(var _0x4cface=0x0;_0x4cface=0x0?this[_0x550d('0x18')]:0x0;var _0x5cf924={'id':this['id'],'available':this[_0x550d('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x550d('0x8')],'paused':this[_0x550d('0x13')],'waiting':this[_0x550d('0xd')]};var _0xdac510=md5(JSON['stringify'](_0x5cf924));if(this['md5']!==_0xdac510){this[_0x550d('0x1')]=_0xdac510;io['to'](util[_0x550d('0x19')](_0x550d('0x1a'),_0x5cf924['name']))[_0x550d('0x1b')]('mail_queue:save',_0x5cf924);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 57e61b4..a9d0d3a 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0x2ef3,0xba));var _0x32ef=function(_0x5ad59e,_0x270aee){_0x5ad59e=_0x5ad59e-0x0;var _0x565f76=_0x2ef3[_0x5ad59e];return _0x565f76;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xc4aa[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 57311b1..4e48220 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 _0xc2cc=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','Agents','paused','loggedIn','smsPause','available','name','stringify','sms_queue:save','exports','md5','util','ioredis','redis','socket.io-emitter','timeout','strategy','beepall'];(function(_0x4fa9b2,_0x552d40){var _0x40770e=function(_0x59ad42){while(--_0x59ad42){_0x4fa9b2['push'](_0x4fa9b2['shift']());}};_0x40770e(++_0x552d40);}(_0xc2cc,0x70));var _0xcc2c=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc2cc[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var md5=require(_0xcc2c('0x0'));var util=require(_0xcc2c('0x1'));var Redis=require(_0xcc2c('0x2'));var config=require('../../../config/environment');config[_0xcc2c('0x3')]=_['defaults'](config[_0xcc2c('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xcc2c('0x4'))(new Redis(config['redis']));function SmsQueue(_0x342a00){this['id']=_0x342a00['id']||0x0;this['name']=_0x342a00['name']||'';this[_0xcc2c('0x5')]=_0x342a00['timeout']||0xa;this[_0xcc2c('0x6')]=_0x342a00['strategy']||_0xcc2c('0x7');this['Agents']=_0x342a00['Agents'];this[_0xcc2c('0x8')]={};this[_0xcc2c('0x9')]=0x0;this[_0xcc2c('0x0')]='';this[_0xcc2c('0xa')]();this[_0xcc2c('0xb')]();}SmsQueue[_0xcc2c('0xc')][_0xcc2c('0xa')]=function(){var _0x1c18a8=this['mapAgentsId'][_0xcc2c('0xd')];this['mapAgentsId']=_[_0xcc2c('0xe')](this[_0xcc2c('0xf')],'id');this[_0xcc2c('0x8')][_0xcc2c('0xd')]=_0x1c18a8;};SmsQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xcc2c('0x10')]=0x0;for(var _0xc1cafd=0x0;_0xc1cafd=0x0?this[_0xcc2c('0x13')]:0x0;var _0x285deb={'id':this['id'],'available':this[_0xcc2c('0x13')],'loggedIn':this[_0xcc2c('0x11')],'name':this[_0xcc2c('0x14')],'paused':this[_0xcc2c('0x10')],'waiting':this[_0xcc2c('0x9')]};var _0x5a1f0a=md5(JSON[_0xcc2c('0x15')](_0x285deb));if(this[_0xcc2c('0x0')]!==_0x5a1f0a){this['md5']=_0x5a1f0a;io['to'](util['format']('sms:queue:%s',_0x285deb[_0xcc2c('0x14')]))['emit'](_0xcc2c('0x16'),_0x285deb);}};module[_0xcc2c('0x17')]=SmsQueue; \ No newline at end of file +var _0x255f=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRealtime','prototype','updateRouting','map','_rr','loggedIn','paused','length','online','smsPause','available','waiting','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x255f,0x185));var _0xf255=function(_0xd67723,_0x1e576f){_0xd67723=_0xd67723-0x0;var _0x53b62b=_0x255f[_0xd67723];return _0x53b62b;};'use strict';var _=require(_0xf255('0x0'));var md5=require('md5');var util=require(_0xf255('0x1'));var Redis=require(_0xf255('0x2'));var config=require(_0xf255('0x3'));config['redis']=_[_0xf255('0x4')](config[_0xf255('0x5')],{'host':_0xf255('0x6'),'port':0x18eb});var io=require(_0xf255('0x7'))(new Redis(config[_0xf255('0x5')]));function SmsQueue(_0x674218){this['id']=_0x674218['id']||0x0;this[_0xf255('0x8')]=_0x674218['name']||'';this[_0xf255('0x9')]=_0x674218['timeout']||0xa;this['strategy']=_0x674218[_0xf255('0xa')]||_0xf255('0xb');this['Agents']=_0x674218[_0xf255('0xc')];this[_0xf255('0xd')]={};this['waiting']=0x0;this[_0xf255('0xe')]='';this['updateRouting']();this[_0xf255('0xf')]();}SmsQueue[_0xf255('0x10')][_0xf255('0x11')]=function(){var _0x3afcb3=this[_0xf255('0xd')]['_rr'];this[_0xf255('0xd')]=_[_0xf255('0x12')](this[_0xf255('0xc')],'id');this['mapAgentsId'][_0xf255('0x13')]=_0x3afcb3;};SmsQueue[_0xf255('0x10')]['updateRealtime']=function(){this[_0xf255('0x14')]=0x0;this[_0xf255('0x15')]=0x0;for(var _0x233853=0x0;_0x233853=0x0?this[_0xf255('0x19')]:0x0;var _0x45b51b={'id':this['id'],'available':this[_0xf255('0x19')],'loggedIn':this[_0xf255('0x14')],'name':this[_0xf255('0x8')],'paused':this[_0xf255('0x15')],'waiting':this[_0xf255('0x1a')]};var _0xbb58e8=md5(JSON[_0xf255('0x1b')](_0x45b51b));if(this[_0xf255('0xe')]!==_0xbb58e8){this['md5']=_0xbb58e8;io['to'](util[_0xf255('0x1c')](_0xf255('0x1d'),_0x45b51b[_0xf255('0x8')]))[_0xf255('0x1e')](_0xf255('0x1f'),_0x45b51b);}};module[_0xf255('0x20')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index c6137bd..842d3aa 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 _0x0a04=['whatsappPause','paused','available','stringify','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype','loggedIn','length','online'];(function(_0x51702d,_0x5d8285){var _0x166952=function(_0x35a68e){while(--_0x35a68e){_0x51702d['push'](_0x51702d['shift']());}};_0x166952(++_0x5d8285);}(_0x0a04,0x1d2));var _0x40a0=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x0a04[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x40a0('0x0'));var md5=require(_0x40a0('0x1'));var util=require(_0x40a0('0x2'));var Redis=require(_0x40a0('0x3'));var config=require('../../../config/environment');config[_0x40a0('0x4')]=_[_0x40a0('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x40a0('0x4')]));function WhatsappQueue(_0x21aab5){this['id']=_0x21aab5['id']||0x0;this[_0x40a0('0x6')]=_0x21aab5[_0x40a0('0x6')]||'';this[_0x40a0('0x7')]=_0x21aab5[_0x40a0('0x7')]||0xa;this[_0x40a0('0x8')]=_0x21aab5[_0x40a0('0x8')]||_0x40a0('0x9');this['Agents']=_0x21aab5[_0x40a0('0xa')];this[_0x40a0('0xb')]={};this[_0x40a0('0xc')]=0x0;this['md5']='';this[_0x40a0('0xd')]();this['updateRealtime']();}WhatsappQueue['prototype'][_0x40a0('0xd')]=function(){var _0x15b428=this[_0x40a0('0xb')][_0x40a0('0xe')];this[_0x40a0('0xb')]=_[_0x40a0('0xf')](this['Agents'],'id');this[_0x40a0('0xb')][_0x40a0('0xe')]=_0x15b428;};WhatsappQueue[_0x40a0('0x10')]['updateRealtime']=function(){this[_0x40a0('0x11')]=0x0;this['paused']=0x0;for(var _0x22ed24=0x0;_0x22ed24=0x0?this[_0x40a0('0x16')]:0x0;var _0x5c8183={'id':this['id'],'available':this['available'],'loggedIn':this[_0x40a0('0x11')],'name':this[_0x40a0('0x6')],'paused':this[_0x40a0('0x15')],'waiting':this[_0x40a0('0xc')]};var _0x358b5d=md5(JSON[_0x40a0('0x17')](_0x5c8183));if(this[_0x40a0('0x1')]!==_0x358b5d){this[_0x40a0('0x1')]=_0x358b5d;io['to'](util['format'](_0x40a0('0x18'),_0x5c8183[_0x40a0('0x6')]))['emit'](_0x40a0('0x19'),_0x5c8183);}};module[_0x40a0('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0xbcad=['_rr','loggedIn','online','whatsappPause','paused','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype'];(function(_0x23cf72,_0x22e108){var _0x3bc541=function(_0x59ef43){while(--_0x59ef43){_0x23cf72['push'](_0x23cf72['shift']());}};_0x3bc541(++_0x22e108);}(_0xbcad,0xeb));var _0xdbca=function(_0x5c7a2c,_0x44c4d0){_0x5c7a2c=_0x5c7a2c-0x0;var _0x217621=_0xbcad[_0x5c7a2c];return _0x217621;};'use strict';var _=require('lodash');var md5=require(_0xdbca('0x0'));var util=require(_0xdbca('0x1'));var Redis=require(_0xdbca('0x2'));var config=require(_0xdbca('0x3'));config[_0xdbca('0x4')]=_[_0xdbca('0x5')](config[_0xdbca('0x4')],{'host':_0xdbca('0x6'),'port':0x18eb});var io=require(_0xdbca('0x7'))(new Redis(config[_0xdbca('0x4')]));function WhatsappQueue(_0x547641){this['id']=_0x547641['id']||0x0;this[_0xdbca('0x8')]=_0x547641[_0xdbca('0x8')]||'';this[_0xdbca('0x9')]=_0x547641[_0xdbca('0x9')]||0xa;this[_0xdbca('0xa')]=_0x547641[_0xdbca('0xa')]||'beepall';this[_0xdbca('0xb')]=_0x547641['Agents'];this[_0xdbca('0xc')]={};this[_0xdbca('0xd')]=0x0;this[_0xdbca('0x0')]='';this[_0xdbca('0xe')]();this[_0xdbca('0xf')]();}WhatsappQueue[_0xdbca('0x10')]['updateRouting']=function(){var _0x284b28=this[_0xdbca('0xc')][_0xdbca('0x11')];this[_0xdbca('0xc')]=_['map'](this['Agents'],'id');this['mapAgentsId'][_0xdbca('0x11')]=_0x284b28;};WhatsappQueue[_0xdbca('0x10')][_0xdbca('0xf')]=function(){this[_0xdbca('0x12')]=0x0;this['paused']=0x0;for(var _0x486c4f=0x0;_0x486c4f=0x0?this[_0xdbca('0x16')]:0x0;var _0x2247a9={'id':this['id'],'available':this[_0xdbca('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xdbca('0x15')],'waiting':this[_0xdbca('0xd')]};var _0x4b872b=md5(JSON['stringify'](_0x2247a9));if(this['md5']!==_0x4b872b){this[_0xdbca('0x0')]=_0x4b872b;io['to'](util[_0xdbca('0x17')](_0xdbca('0x18'),_0x2247a9['name']))[_0xdbca('0x19')](_0xdbca('0x1a'),_0x2247a9);}};module[_0xdbca('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 91fb315..3dfc2a9 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x451120,_0x55b8d8){var _0x73e0d2=function(_0x767386){while(--_0x767386){_0x451120['push'](_0x451120['shift']());}};_0x73e0d2(++_0x55b8d8);}(_0xb10b,0x12a));var _0xbb10=function(_0x5f50b5,_0xa8db83){_0x5f50b5=_0x5f50b5-0x0;var _0x54c383=_0xb10b[_0x5f50b5];return _0x54c383;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x346af0,_0x5b1e4c){var _0x3b2822=function(_0x582fb8){while(--_0x582fb8){_0x346af0['push'](_0x346af0['shift']());}};_0x3b2822(++_0x5b1e4c);}(_0xb10b,0x12a));var _0xbb10=function(_0x9b14ee,_0x574340){_0x9b14ee=_0x9b14ee-0x0;var _0xc3fa3c=_0xb10b[_0x9b14ee];return _0xc3fa3c;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index dea38e5..a8f09c6 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 _0x02e9=['addTags','../client','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0xddd8c2,_0x348237){var _0x51dfb5=function(_0x2e42d1){while(--_0x2e42d1){_0xddd8c2['push'](_0xddd8c2['shift']());}};_0x51dfb5(++_0x348237);}(_0x02e9,0x79));var _0x902e=function(_0x27524a,_0x362ec0){_0x27524a=_0x27524a-0x0;var _0x1d4ed=_0x02e9[_0x27524a];return _0x1d4ed;};'use strict';var client=require(_0x902e('0x0'));exports['update']=function(_0x534101,_0x552164){return client[_0x902e('0x1')](_0x902e('0x2'),{'body':_0x552164,'options':{'where':{'id':_0x534101}},'log':_0x902e('0x3')});};exports[_0x902e('0x4')]=function(_0x2a792d,_0x24a0a7){return client[_0x902e('0x1')]('AddTagsToChatInteraction',{'body':_0x24a0a7,'options':{'where':{'id':_0x2a792d}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x6e92=['../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x5c624e,_0x508cd0){var _0x32fa70=function(_0x4cfd62){while(--_0x4cfd62){_0x5c624e['push'](_0x5c624e['shift']());}};_0x32fa70(++_0x508cd0);}(_0x6e92,0xd8));var _0x26e9=function(_0x3cfb3c,_0x8b172){_0x3cfb3c=_0x3cfb3c-0x0;var _0x5c3d52=_0x6e92[_0x3cfb3c];return _0x5c3d52;};'use strict';var client=require(_0x26e9('0x0'));exports[_0x26e9('0x1')]=function(_0x2b6d31,_0x27d757){return client[_0x26e9('0x2')](_0x26e9('0x3'),{'body':_0x27d757,'options':{'where':{'id':_0x2b6d31}},'log':_0x26e9('0x4')});};exports[_0x26e9('0x5')]=function(_0xd5f41b,_0x522244){return client['Request'](_0x26e9('0x6'),{'body':_0x522244,'options':{'where':{'id':_0xd5f41b}},'log':_0x26e9('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 747b09a..e35dfaf 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 _0x55c8=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x42f3a5,_0x3a4470){var _0x1a7d74=function(_0x43cc36){while(--_0x43cc36){_0x42f3a5['push'](_0x42f3a5['shift']());}};_0x1a7d74(++_0x3a4470);}(_0x55c8,0x85));var _0x855c=function(_0x717722,_0x3be4bd){_0x717722=_0x717722-0x0;var _0x524796=_0x55c8[_0x717722];return _0x524796;};'use strict';var client=require(_0x855c('0x0'));exports[_0x855c('0x1')]=function(_0xdbe98e){return client[_0x855c('0x2')](_0x855c('0x3'),{'body':_0xdbe98e,'log':_0x855c('0x4')});}; \ No newline at end of file +var _0x3a1e=['create','Request','CreateChatMessage','../client'];(function(_0x1946da,_0x544045){var _0x1f6c2b=function(_0xa79b73){while(--_0xa79b73){_0x1946da['push'](_0x1946da['shift']());}};_0x1f6c2b(++_0x544045);}(_0x3a1e,0x113));var _0xe3a1=function(_0x555ebb,_0x4b1b68){_0x555ebb=_0x555ebb-0x0;var _0x3c0a4a=_0x3a1e[_0x555ebb];return _0x3c0a4a;};'use strict';var client=require(_0xe3a1('0x0'));exports[_0xe3a1('0x1')]=function(_0x26f1b9){return client[_0xe3a1('0x2')](_0xe3a1('0x3'),{'body':_0x26f1b9,'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 507aef1..30e60bb 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 _0x374c=['getChatQueues','Request','GetChatQueue','name','timeout','User','online'];(function(_0x50d84b,_0x1d7ea7){var _0x6d4270=function(_0x883f21){while(--_0x883f21){_0x50d84b['push'](_0x50d84b['shift']());}};_0x6d4270(++_0x1d7ea7);}(_0x374c,0x1e3));var _0xc374=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x374c[_0x43d11d];return _0x38cd08;};'use strict';var client=require('../client');exports[_0xc374('0x0')]=function(){return function(){return client[_0xc374('0x1')](_0xc374('0x2'),{'options':{'raw':![],'attributes':['id',_0xc374('0x3'),_0xc374('0x4'),'strategy'],'include':[{'model':_0xc374('0x5'),'as':'Agents','attributes':['id',_0xc374('0x3'),_0xc374('0x6'),'chatPause']}]},'log':_0xc374('0x0')});};}; \ No newline at end of file +var _0x2d17=['name','strategy','User','chatPause','../client','getChatQueues','GetChatQueue'];(function(_0x1050f8,_0x2a2a1a){var _0x1d3764=function(_0x59541f){while(--_0x59541f){_0x1050f8['push'](_0x1050f8['shift']());}};_0x1d3764(++_0x2a2a1a);}(_0x2d17,0x17e));var _0x72d1=function(_0x3632b0,_0x36d41c){_0x3632b0=_0x3632b0-0x0;var _0x109881=_0x2d17[_0x3632b0];return _0x109881;};'use strict';var client=require(_0x72d1('0x0'));exports[_0x72d1('0x1')]=function(){return function(){return client['Request'](_0x72d1('0x2'),{'options':{'raw':![],'attributes':['id',_0x72d1('0x3'),'timeout',_0x72d1('0x4')],'include':[{'model':_0x72d1('0x5'),'as':'Agents','attributes':['id',_0x72d1('0x3'),'online',_0x72d1('0x6')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index e6f64bb..73efdb9 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 _0xd52d=['create','CreateChatQueueReport','Request','UpdateChatQueueReport','DESC'];(function(_0x5a4291,_0x389789){var _0x1c2e70=function(_0x1225e7){while(--_0x1225e7){_0x5a4291['push'](_0x5a4291['shift']());}};_0x1c2e70(++_0x389789);}(_0xd52d,0x1c7));var _0xdd52=function(_0x104bcb,_0x5a8e68){_0x104bcb=_0x104bcb-0x0;var _0x60bbbe=_0xd52d[_0x104bcb];return _0x60bbbe;};'use strict';var client=require('../client');exports[_0xdd52('0x0')]=function(_0x1dd2e9){return client['Request'](_0xdd52('0x1'),{'body':_0x1dd2e9,'log':'CreateChatQueueReport'});};exports['update']=function(_0x1dfed5,_0x211062){return client[_0xdd52('0x2')](_0xdd52('0x3'),{'body':_0x211062,'options':{'where':{'uniqueid':_0x1dfed5},'order':[['id',_0xdd52('0x4')]],'limit':0x1},'log':_0xdd52('0x3')});}; \ No newline at end of file +var _0xf9bb=['Request','UpdateChatQueueReport','DESC','../client','create','CreateChatQueueReport'];(function(_0x27badb,_0x5a03fe){var _0x221ebe=function(_0x1f4641){while(--_0x1f4641){_0x27badb['push'](_0x27badb['shift']());}};_0x221ebe(++_0x5a03fe);}(_0xf9bb,0x14d));var _0xbf9b=function(_0x36de4f,_0x350d30){_0x36de4f=_0x36de4f-0x0;var _0x1a91c2=_0xf9bb[_0x36de4f];return _0x1a91c2;};'use strict';var client=require(_0xbf9b('0x0'));exports[_0xbf9b('0x1')]=function(_0x26844f){return client['Request'](_0xbf9b('0x2'),{'body':_0x26844f,'log':_0xbf9b('0x2')});};exports['update']=function(_0x4e5db7,_0x190028){return client[_0xbf9b('0x3')](_0xbf9b('0x4'),{'body':_0x190028,'options':{'where':{'uniqueid':_0x4e5db7},'order':[['id',_0xbf9b('0x5')]],'limit':0x1},'log':_0xbf9b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 1e7a5f2..c3d2318 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x7a54,0x106));var _0x47a5=function(_0x1cde22,_0x264dca){_0x1cde22=_0x1cde22-0x0;var _0x647f8b=_0x7a54[_0x1cde22];return _0x647f8b;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x7a54,0x106));var _0x47a5=function(_0x5c577a,_0x5a1938){_0x5c577a=_0x5c577a-0x0;var _0x398de9=_0x7a54[_0x5c577a];return _0x398de9;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 592eb15..899d8ef 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 _0x2970=['Request','../client'];(function(_0x1ff17d,_0x375a19){var _0xf4280f=function(_0x5b0e52){while(--_0x5b0e52){_0x1ff17d['push'](_0x1ff17d['shift']());}};_0xf4280f(++_0x375a19);}(_0x2970,0x1c3));var _0x0297=function(_0x497694,_0x45a883){_0x497694=_0x497694-0x0;var _0x522d39=_0x2970[_0x497694];return _0x522d39;};'use strict';var client=require(_0x0297('0x0'));exports['create']=function(_0x163db4){return client[_0x0297('0x1')]('CreateFaxMessage',{'body':_0x163db4,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x7c1c=['../client','create','CreateFaxMessage'];(function(_0x43941d,_0x45fd0d){var _0x27b82a=function(_0x21851e){while(--_0x21851e){_0x43941d['push'](_0x43941d['shift']());}};_0x27b82a(++_0x45fd0d);}(_0x7c1c,0x1ec));var _0xc7c1=function(_0xc5715a,_0xdb4d97){_0xc5715a=_0xc5715a-0x0;var _0x19fb62=_0x7c1c[_0xc5715a];return _0x19fb62;};'use strict';var client=require(_0xc7c1('0x0'));exports[_0xc7c1('0x1')]=function(_0xa11f4e){return client['Request'](_0xc7c1('0x2'),{'body':_0xa11f4e,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index d30eee6..63e6f17 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 _0xcf32=['faxPause','../client','getFaxQueues','GetFaxQueue','name','timeout','Agents','online'];(function(_0x361fe4,_0x394bc7){var _0x3e20f6=function(_0x132135){while(--_0x132135){_0x361fe4['push'](_0x361fe4['shift']());}};_0x3e20f6(++_0x394bc7);}(_0xcf32,0xd9));var _0x2cf3=function(_0x3c59fc,_0x10dbd2){_0x3c59fc=_0x3c59fc-0x0;var _0x2b78d4=_0xcf32[_0x3c59fc];return _0x2b78d4;};'use strict';var client=require(_0x2cf3('0x0'));exports[_0x2cf3('0x1')]=function(){return function(){return client['Request'](_0x2cf3('0x2'),{'options':{'raw':![],'attributes':['id',_0x2cf3('0x3'),_0x2cf3('0x4'),'strategy'],'include':[{'model':'User','as':_0x2cf3('0x5'),'attributes':['id',_0x2cf3('0x3'),_0x2cf3('0x6'),_0x2cf3('0x7')]}]},'log':_0x2cf3('0x1')});};}; \ No newline at end of file +var _0xbea3=['getFaxQueues','timeout','strategy','User','Agents','name','online','faxPause','../client'];(function(_0x52e022,_0x6d05fa){var _0x4d6b26=function(_0x3a8579){while(--_0x3a8579){_0x52e022['push'](_0x52e022['shift']());}};_0x4d6b26(++_0x6d05fa);}(_0xbea3,0x155));var _0x3bea=function(_0x4f8041,_0x1450c8){_0x4f8041=_0x4f8041-0x0;var _0x26036d=_0xbea3[_0x4f8041];return _0x26036d;};'use strict';var client=require(_0x3bea('0x0'));exports[_0x3bea('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0x3bea('0x2'),_0x3bea('0x3')],'include':[{'model':_0x3bea('0x4'),'as':_0x3bea('0x5'),'attributes':['id',_0x3bea('0x6'),_0x3bea('0x7'),_0x3bea('0x8')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index d9ed97d..39febd7 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 _0x6405=['../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x2917da,_0x3b73f8){var _0x3e656d=function(_0x2bcf76){while(--_0x2bcf76){_0x2917da['push'](_0x2917da['shift']());}};_0x3e656d(++_0x3b73f8);}(_0x6405,0x192));var _0x5640=function(_0x4a68dd,_0x110bc5){_0x4a68dd=_0x4a68dd-0x0;var _0x266bf9=_0x6405[_0x4a68dd];return _0x266bf9;};'use strict';var client=require(_0x5640('0x0'));exports[_0x5640('0x1')]=function(_0x4ba950){return client[_0x5640('0x2')]('CreateFaxQueueReport',{'body':_0x4ba950,'log':_0x5640('0x3')});};exports[_0x5640('0x4')]=function(_0x3fc599,_0x19031c){return client[_0x5640('0x2')](_0x5640('0x5'),{'body':_0x19031c,'options':{'where':{'uniqueid':_0x3fc599},'order':[['id','DESC']],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x8116=['DESC','../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x416f78,_0x3fc3b2){var _0x392cb0=function(_0x2576f6){while(--_0x2576f6){_0x416f78['push'](_0x416f78['shift']());}};_0x392cb0(++_0x3fc3b2);}(_0x8116,0x166));var _0x6811=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8116[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0x6811('0x0'));exports[_0x6811('0x1')]=function(_0x2cbf6e){return client[_0x6811('0x2')](_0x6811('0x3'),{'body':_0x2cbf6e,'log':'CreateFaxQueueReport'});};exports[_0x6811('0x4')]=function(_0x3e13ab,_0x10e981){return client[_0x6811('0x2')](_0x6811('0x5'),{'body':_0x10e981,'options':{'where':{'uniqueid':_0x3e13ab},'order':[['id',_0x6811('0x6')]],'limit':0x1},'log':_0x6811('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index c9ab100..e0313bd 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 _0xd434=['Interval','name','getIntervals','../client','Request','GetInterval'];(function(_0x290c9b,_0x896ae1){var _0x41011f=function(_0x5e4682){while(--_0x5e4682){_0x290c9b['push'](_0x290c9b['shift']());}};_0x41011f(++_0x896ae1);}(_0xd434,0x19b));var _0x4d43=function(_0x38f4bb,_0x5cc0e1){_0x38f4bb=_0x38f4bb-0x0;var _0x46e5af=_0xd434[_0x38f4bb];return _0x46e5af;};'use strict';var client=require(_0x4d43('0x0'));exports['getIntervals']=function(){return function(){return client[_0x4d43('0x1')](_0x4d43('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x4d43('0x3'),'as':'Intervals','attributes':['id',_0x4d43('0x4'),'interval']}]},'log':_0x4d43('0x5')});};}; \ No newline at end of file +var _0x9253=['getIntervals','GetInterval','Interval','name','interval','../client'];(function(_0x37b48d,_0x2b11f6){var _0x1c33a0=function(_0x438692){while(--_0x438692){_0x37b48d['push'](_0x37b48d['shift']());}};_0x1c33a0(++_0x2b11f6);}(_0x9253,0x1a3));var _0x3925=function(_0x56f8d7,_0x334464){_0x56f8d7=_0x56f8d7-0x0;var _0x1b6aee=_0x9253[_0x56f8d7];return _0x1b6aee;};'use strict';var client=require(_0x3925('0x0'));exports[_0x3925('0x1')]=function(){return function(){return client['Request'](_0x3925('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x3925('0x3'),'as':'Intervals','attributes':['id',_0x3925('0x4'),_0x3925('0x5')]}]},'log':_0x3925('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index da0a1b5..fd78979 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 _0xdd4f=['../client','Request','UpdateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0xc58981,_0xdb502a){_0xc58981=_0xc58981-0x0;var _0x2f190e=_0xdd4f[_0xc58981];return _0x2f190e;};'use strict';var client=require(_0xfdd4('0x0'));exports['update']=function(_0x5656ab,_0x55d8f9){return client[_0xfdd4('0x1')](_0xfdd4('0x2'),{'body':_0x55d8f9,'options':{'where':{'id':_0x5656ab}},'log':'updateMailInteraction'});};exports[_0xfdd4('0x3')]=function(_0x3175f6,_0x6b2b0d){return client['Request'](_0xfdd4('0x4'),{'body':_0x6b2b0d,'options':{'where':{'id':_0x3175f6}},'log':_0xfdd4('0x5')});}; \ No newline at end of file +var _0xfb11=['UpdateMailInteraction','addTags','Request','addTagsToChatInteraction','../client'];(function(_0x497a13,_0x54c159){var _0x5d5556=function(_0x26227d){while(--_0x26227d){_0x497a13['push'](_0x497a13['shift']());}};_0x5d5556(++_0x54c159);}(_0xfb11,0x1ad));var _0x1fb1=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xfb11[_0xbe200f];return _0x192597;};'use strict';var client=require(_0x1fb1('0x0'));exports['update']=function(_0x3418a7,_0x34e2d6){return client['Request'](_0x1fb1('0x1'),{'body':_0x34e2d6,'options':{'where':{'id':_0x3418a7}},'log':'updateMailInteraction'});};exports[_0x1fb1('0x2')]=function(_0x5a830e,_0x190f74){return client[_0x1fb1('0x3')]('AddTagsToMailInteraction',{'body':_0x190f74,'options':{'where':{'id':_0x5a830e}},'log':_0x1fb1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index d0d3f82..5102f82 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 _0xac6b=['CreateMailMessage','create','Request'];(function(_0x4a984c,_0x2acc29){var _0x3b8ad4=function(_0x35cbf0){while(--_0x35cbf0){_0x4a984c['push'](_0x4a984c['shift']());}};_0x3b8ad4(++_0x2acc29);}(_0xac6b,0x1de));var _0xbac6=function(_0x5cecad,_0x37dc3c){_0x5cecad=_0x5cecad-0x0;var _0x200262=_0xac6b[_0x5cecad];return _0x200262;};'use strict';var client=require('../client');exports[_0xbac6('0x0')]=function(_0x5f240d){return client[_0xbac6('0x1')](_0xbac6('0x2'),{'body':_0x5f240d,'log':'createMailMessage'});}; \ No newline at end of file +var _0xc8e3=['CreateMailMessage','createMailMessage','create','Request'];(function(_0x510762,_0x5151f7){var _0x46c058=function(_0x37ca3b){while(--_0x37ca3b){_0x510762['push'](_0x510762['shift']());}};_0x46c058(++_0x5151f7);}(_0xc8e3,0x18a));var _0x3c8e=function(_0x160ec9,_0x169902){_0x160ec9=_0x160ec9-0x0;var _0xf1fa69=_0xc8e3[_0x160ec9];return _0xf1fa69;};'use strict';var client=require('../client');exports[_0x3c8e('0x0')]=function(_0x4138ac){return client[_0x3c8e('0x1')](_0x3c8e('0x2'),{'body':_0x4138ac,'log':_0x3c8e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index e2cad07..4c68eb7 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 _0x8671=['name','strategy','User','Agents','online','mailPause','getMailQueues','../client','Request'];(function(_0x178aa3,_0x5d6f25){var _0x51efed=function(_0xc6eadc){while(--_0xc6eadc){_0x178aa3['push'](_0x178aa3['shift']());}};_0x51efed(++_0x5d6f25);}(_0x8671,0x178));var _0x1867=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x8671[_0x2b10c6];return _0x3789d2;};'use strict';var client=require(_0x1867('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x1867('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x1867('0x2'),'timeout',_0x1867('0x3')],'include':[{'model':_0x1867('0x4'),'as':_0x1867('0x5'),'attributes':['id','name',_0x1867('0x6'),_0x1867('0x7')]}]},'log':_0x1867('0x8')});};}; \ No newline at end of file +var _0xdab1=['timeout','strategy','User','Agents','online','getMailQueues','Request','GetMailQueue','name'];(function(_0x4fbbb7,_0x51ae8f){var _0x3fae1b=function(_0x19d70c){while(--_0x19d70c){_0x4fbbb7['push'](_0x4fbbb7['shift']());}};_0x3fae1b(++_0x51ae8f);}(_0xdab1,0xdd));var _0x1dab=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xdab1[_0x7e2eb0];return _0xd92de4;};'use strict';var client=require('../client');exports[_0x1dab('0x0')]=function(){return function(){return client[_0x1dab('0x1')](_0x1dab('0x2'),{'options':{'raw':![],'attributes':['id',_0x1dab('0x3'),_0x1dab('0x4'),_0x1dab('0x5')],'include':[{'model':_0x1dab('0x6'),'as':_0x1dab('0x7'),'attributes':['id',_0x1dab('0x3'),_0x1dab('0x8'),'mailPause']}]},'log':_0x1dab('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 6e7ca53..b3f2c64 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 _0x3d2d=['update','UpdateMailQueueReport','create','CreateMailQueueReport'];(function(_0x533a7b,_0x3c3f98){var _0x3b5705=function(_0x2b1662){while(--_0x2b1662){_0x533a7b['push'](_0x533a7b['shift']());}};_0x3b5705(++_0x3c3f98);}(_0x3d2d,0xfa));var _0xd3d2=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0x3d2d[_0x1f99a0];return _0x1e0849;};'use strict';var client=require('../client');exports[_0xd3d2('0x0')]=function(_0x945ded){return client['Request'](_0xd3d2('0x1'),{'body':_0x945ded,'log':_0xd3d2('0x1')});};exports[_0xd3d2('0x2')]=function(_0x3f8e70,_0x5cdda8){return client['Request'](_0xd3d2('0x3'),{'body':_0x5cdda8,'options':{'where':{'uniqueid':_0x3f8e70},'order':[['id','DESC']],'limit':0x1},'log':_0xd3d2('0x3')});}; \ No newline at end of file +var _0x88ae=['create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x88ae,0xd8));var _0xe88a=function(_0x434321,_0x152a2a){_0x434321=_0x434321-0x0;var _0x1a0b0f=_0x88ae[_0x434321];return _0x1a0b0f;};'use strict';var client=require(_0xe88a('0x0'));exports[_0xe88a('0x1')]=function(_0x44e200){return client[_0xe88a('0x2')](_0xe88a('0x3'),{'body':_0x44e200,'log':_0xe88a('0x3')});};exports[_0xe88a('0x4')]=function(_0x1719f8,_0x507c70){return client['Request'](_0xe88a('0x5'),{'body':_0x507c70,'options':{'where':{'uniqueid':_0x1719f8},'order':[['id',_0xe88a('0x6')]],'limit':0x1},'log':_0xe88a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index f8d2692..06aa1af 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 _0x44a0=['addTagsToChatInteraction','update','Request','addTags'];(function(_0x4fca73,_0x5cfb22){var _0x94e3cd=function(_0x1196c5){while(--_0x1196c5){_0x4fca73['push'](_0x4fca73['shift']());}};_0x94e3cd(++_0x5cfb22);}(_0x44a0,0x81));var _0x044a=function(_0x218f41,_0x1e27c1){_0x218f41=_0x218f41-0x0;var _0x4c84e9=_0x44a0[_0x218f41];return _0x4c84e9;};'use strict';var client=require('../client');exports[_0x044a('0x0')]=function(_0x57f226,_0x55e44f){return client[_0x044a('0x1')]('UpdateOpenchannelInteraction',{'body':_0x55e44f,'options':{'where':{'id':_0x57f226}},'log':'updateOpenchannelInteraction'});};exports[_0x044a('0x2')]=function(_0x2793cd,_0x39cd3e){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x39cd3e,'options':{'where':{'id':_0x2793cd}},'log':_0x044a('0x3')});}; \ No newline at end of file +var _0xf22d=['Request','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x265489,_0xfbef80){var _0x902692=function(_0x5ae27d){while(--_0x5ae27d){_0x265489['push'](_0x265489['shift']());}};_0x902692(++_0xfbef80);}(_0xf22d,0x180));var _0xdf22=function(_0x1a8bbc,_0x17a086){_0x1a8bbc=_0x1a8bbc-0x0;var _0x212fc2=_0xf22d[_0x1a8bbc];return _0x212fc2;};'use strict';var client=require(_0xdf22('0x0'));exports['update']=function(_0xad233a,_0x5870c1){return client[_0xdf22('0x1')]('UpdateOpenchannelInteraction',{'body':_0x5870c1,'options':{'where':{'id':_0xad233a}},'log':_0xdf22('0x2')});};exports['addTags']=function(_0x4991f0,_0x52eea4){return client['Request'](_0xdf22('0x3'),{'body':_0x52eea4,'options':{'where':{'id':_0x4991f0}},'log':_0xdf22('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index d3fd36d..d46d784 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 _0x2613=['../client','create','CreateOpenchannelMessage'];(function(_0x528902,_0x3c3ec8){var _0x131dfa=function(_0x1bcfd8){while(--_0x1bcfd8){_0x528902['push'](_0x528902['shift']());}};_0x131dfa(++_0x3c3ec8);}(_0x2613,0xe4));var _0x3261=function(_0x3b613e,_0x3a9d45){_0x3b613e=_0x3b613e-0x0;var _0x25e0a8=_0x2613[_0x3b613e];return _0x25e0a8;};'use strict';var client=require(_0x3261('0x0'));exports[_0x3261('0x1')]=function(_0x2dbdd8){return client['Request'](_0x3261('0x2'),{'body':_0x2dbdd8,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x3ba7=['../client','create','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3ba7,0x140));var _0x73ba=function(_0x4be7fc,_0x5e8e9d){_0x4be7fc=_0x4be7fc-0x0;var _0x117d9e=_0x3ba7[_0x4be7fc];return _0x117d9e;};'use strict';var client=require(_0x73ba('0x0'));exports[_0x73ba('0x1')]=function(_0x119456){return client['Request'](_0x73ba('0x2'),{'body':_0x119456,'log':_0x73ba('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 088215e..fbbe778 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 _0xc90c=['Request','User','Agents','name','openchannelPause','../client','getOpenchannelQueues'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xc90c,0xec));var _0xcc90=function(_0x188166,_0x50cff0){_0x188166=_0x188166-0x0;var _0x128c7a=_0xc90c[_0x188166];return _0x128c7a;};'use strict';var client=require(_0xcc90('0x0'));exports[_0xcc90('0x1')]=function(){return function(){return client[_0xcc90('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0xcc90('0x3'),'as':_0xcc90('0x4'),'attributes':['id',_0xcc90('0x5'),'online',_0xcc90('0x6')]}]},'log':_0xcc90('0x1')});};}; \ No newline at end of file +var _0x0042=['Agents','online','openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue','name','strategy'];(function(_0x4c2b76,_0x5e9057){var _0x38c90a=function(_0x143296){while(--_0x143296){_0x4c2b76['push'](_0x4c2b76['shift']());}};_0x38c90a(++_0x5e9057);}(_0x0042,0x18b));var _0x2004=function(_0x49fcfb,_0x504dec){_0x49fcfb=_0x49fcfb-0x0;var _0x964926=_0x0042[_0x49fcfb];return _0x964926;};'use strict';var client=require(_0x2004('0x0'));exports[_0x2004('0x1')]=function(){return function(){return client['Request'](_0x2004('0x2'),{'options':{'raw':![],'attributes':['id',_0x2004('0x3'),'timeout',_0x2004('0x4')],'include':[{'model':'User','as':_0x2004('0x5'),'attributes':['id','name',_0x2004('0x6'),_0x2004('0x7')]}]},'log':_0x2004('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 96913df..75da8ff 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 _0x7fe7=['UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport','update','DESC'];(function(_0x27dba4,_0x419253){var _0x35ec9d=function(_0x2d13b2){while(--_0x2d13b2){_0x27dba4['push'](_0x27dba4['shift']());}};_0x35ec9d(++_0x419253);}(_0x7fe7,0x104));var _0x77fe=function(_0x47199b,_0x16e824){_0x47199b=_0x47199b-0x0;var _0x390911=_0x7fe7[_0x47199b];return _0x390911;};'use strict';var client=require(_0x77fe('0x0'));exports[_0x77fe('0x1')]=function(_0x4c4643){return client[_0x77fe('0x2')](_0x77fe('0x3'),{'body':_0x4c4643,'log':'CreateOpenchannelQueueReport'});};exports[_0x77fe('0x4')]=function(_0x1692d7,_0x509dba){return client[_0x77fe('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x509dba,'options':{'where':{'uniqueid':_0x1692d7},'order':[['id',_0x77fe('0x5')]],'limit':0x1},'log':_0x77fe('0x6')});}; \ No newline at end of file +var _0x4c4d=['Request','UpdateOpenchannelQueueReport','DESC','../client','CreateOpenchannelQueueReport'];(function(_0x32a8a8,_0x340cd5){var _0x25837c=function(_0x4c81ec){while(--_0x4c81ec){_0x32a8a8['push'](_0x32a8a8['shift']());}};_0x25837c(++_0x340cd5);}(_0x4c4d,0x1a2));var _0xd4c4=function(_0x2233bc,_0x2e2916){_0x2233bc=_0x2233bc-0x0;var _0x5ea8e2=_0x4c4d[_0x2233bc];return _0x5ea8e2;};'use strict';var client=require(_0xd4c4('0x0'));exports['create']=function(_0x4ccde2){return client['Request']('CreateOpenchannelQueueReport',{'body':_0x4ccde2,'log':_0xd4c4('0x1')});};exports['update']=function(_0x3418ee,_0x2a930f){return client[_0xd4c4('0x2')](_0xd4c4('0x3'),{'body':_0x2a930f,'options':{'where':{'uniqueid':_0x3418ee},'order':[['id',_0xd4c4('0x4')]],'limit':0x1},'log':_0xd4c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index e5ba515..a4419b4 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 _0x6726=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction'];(function(_0x854f15,_0x37ea0e){var _0x5fc6ad=function(_0x20081d){while(--_0x20081d){_0x854f15['push'](_0x854f15['shift']());}};_0x5fc6ad(++_0x37ea0e);}(_0x6726,0xdb));var _0x6672=function(_0x43b08,_0x15f967){_0x43b08=_0x43b08-0x0;var _0x5e05f4=_0x6726[_0x43b08];return _0x5e05f4;};'use strict';var client=require('../client');exports[_0x6672('0x0')]=function(_0x4672bf,_0x4ad73d){return client[_0x6672('0x1')](_0x6672('0x2'),{'body':_0x4ad73d,'options':{'where':{'id':_0x4672bf}},'log':'updateSmsInteraction'});};exports[_0x6672('0x3')]=function(_0x5bf86c,_0x32e5c6){return client[_0x6672('0x1')](_0x6672('0x4'),{'body':_0x32e5c6,'options':{'where':{'id':_0x5bf86c}},'log':_0x6672('0x5')});}; \ No newline at end of file +var _0x383a=['addTagsToSmsInteraction','update','UpdateSmsInteraction','addTags'];(function(_0xe6f33e,_0x193f9e){var _0x3b5537=function(_0x29c475){while(--_0x29c475){_0xe6f33e['push'](_0xe6f33e['shift']());}};_0x3b5537(++_0x193f9e);}(_0x383a,0x1ad));var _0xa383=function(_0x9f0bdf,_0x14e6ca){_0x9f0bdf=_0x9f0bdf-0x0;var _0x523eca=_0x383a[_0x9f0bdf];return _0x523eca;};'use strict';var client=require('../client');exports[_0xa383('0x0')]=function(_0xe0a361,_0x544727){return client['Request'](_0xa383('0x1'),{'body':_0x544727,'options':{'where':{'id':_0xe0a361}},'log':'updateSmsInteraction'});};exports[_0xa383('0x2')]=function(_0x2d5b89,_0x86d0d9){return client['Request']('AddTagsToSmsInteraction',{'body':_0x86d0d9,'options':{'where':{'id':_0x2d5b89}},'log':_0xa383('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index ba7414c..624d76c 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 _0x6c90=['createSmsMessage','create'];(function(_0x372515,_0xdd11f){var _0xa3bf4e=function(_0x212cc8){while(--_0x212cc8){_0x372515['push'](_0x372515['shift']());}};_0xa3bf4e(++_0xdd11f);}(_0x6c90,0x195));var _0x06c9=function(_0xc2beb1,_0x294260){_0xc2beb1=_0xc2beb1-0x0;var _0x213121=_0x6c90[_0xc2beb1];return _0x213121;};'use strict';var client=require('../client');exports[_0x06c9('0x0')]=function(_0x53cb0b){return client['Request']('CreateSmsMessage',{'body':_0x53cb0b,'log':_0x06c9('0x1')});}; \ No newline at end of file +var _0xd08a=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x3dfea6,_0x5cd685){var _0x567aca=function(_0x100a5f){while(--_0x100a5f){_0x3dfea6['push'](_0x3dfea6['shift']());}};_0x567aca(++_0x5cd685);}(_0xd08a,0x106));var _0xad08=function(_0x3ec221,_0x591deb){_0x3ec221=_0x3ec221-0x0;var _0x2e692f=_0xd08a[_0x3ec221];return _0x2e692f;};'use strict';var client=require(_0xad08('0x0'));exports[_0xad08('0x1')]=function(_0x2eb9f9){return client[_0xad08('0x2')](_0xad08('0x3'),{'body':_0x2eb9f9,'log':_0xad08('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index f7f0dcf..a193586 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x8027e,_0x31e655){var _0x5eaad1=function(_0x2bd4fd){while(--_0x2bd4fd){_0x8027e['push'](_0x8027e['shift']());}};_0x5eaad1(++_0x31e655);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x23f720,_0x5dba43){var _0x190f8f=function(_0x82064f){while(--_0x82064f){_0x23f720['push'](_0x23f720['shift']());}};_0x190f8f(++_0x5dba43);}(_0x70e0,0x17b));var _0x070e=function(_0x3a0b1e,_0x5d5183){_0x3a0b1e=_0x3a0b1e-0x0;var _0x29f298=_0x70e0[_0x3a0b1e];return _0x29f298;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index b58acb6..169fd98 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 _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x469f93,_0x2a2c71){var _0x465f36=function(_0x49e22a){while(--_0x49e22a){_0x469f93['push'](_0x469f93['shift']());}};_0x465f36(++_0x2a2c71);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x2d086e,_0x5516c7){var _0x39bd87=function(_0x4c9997){while(--_0x4c9997){_0x2d086e['push'](_0x2d086e['shift']());}};_0x39bd87(++_0x5516c7);}(_0x70e0,0x17b));var _0x070e=function(_0x26f6a0,_0x1862e8){_0x26f6a0=_0x26f6a0-0x0;var _0x1d8540=_0x70e0[_0x26f6a0];return _0x1d8540;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 0496eca..93810e7 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(_0x53cbd5,_0x112999){var _0x56b241=function(_0x210d88){while(--_0x210d88){_0x53cbd5['push'](_0x53cbd5['shift']());}};_0x56b241(++_0x112999);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x246366,_0x56178a){var _0x3effd4=function(_0x11d64e){while(--_0x11d64e){_0x246366['push'](_0x246366['shift']());}};_0x3effd4(++_0x56178a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 ca401a4..4cc92cd 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 _0x81d4=['updateWhatsappInteraction','AddTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction'];(function(_0x393500,_0x1037af){var _0x120d3b=function(_0x17234e){while(--_0x17234e){_0x393500['push'](_0x393500['shift']());}};_0x120d3b(++_0x1037af);}(_0x81d4,0x197));var _0x481d=function(_0x2afbc9,_0x21d12b){_0x2afbc9=_0x2afbc9-0x0;var _0x4150a7=_0x81d4[_0x2afbc9];return _0x4150a7;};'use strict';var client=require('../client');exports[_0x481d('0x0')]=function(_0x1017c5,_0x51dfad){return client[_0x481d('0x1')](_0x481d('0x2'),{'body':_0x51dfad,'options':{'where':{'id':_0x1017c5}},'log':_0x481d('0x3')});};exports['addTags']=function(_0x5af777,_0x37813e){return client[_0x481d('0x1')](_0x481d('0x4'),{'body':_0x37813e,'options':{'where':{'id':_0x5af777}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x444e=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request','updateWhatsappInteraction'];(function(_0x35c971,_0x260333){var _0x1e3f9a=function(_0x406b3b){while(--_0x406b3b){_0x35c971['push'](_0x35c971['shift']());}};_0x1e3f9a(++_0x260333);}(_0x444e,0xe8));var _0xe444=function(_0x4b5eaf,_0x9d1cbc){_0x4b5eaf=_0x4b5eaf-0x0;var _0x51ea69=_0x444e[_0x4b5eaf];return _0x51ea69;};'use strict';var client=require(_0xe444('0x0'));exports['update']=function(_0x17e44e,_0x562376){return client[_0xe444('0x1')]('UpdateWhatsappInteraction',{'body':_0x562376,'options':{'where':{'id':_0x17e44e}},'log':_0xe444('0x2')});};exports['addTags']=function(_0xd7b634,_0x389c5b){return client[_0xe444('0x1')](_0xe444('0x3'),{'body':_0x389c5b,'options':{'where':{'id':_0xd7b634}},'log':_0xe444('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 5ff308b..0be603a 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 _0xe88a=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x3865d0,_0x131b08){var _0x3402ea=function(_0xfcdd43){while(--_0xfcdd43){_0x3865d0['push'](_0x3865d0['shift']());}};_0x3402ea(++_0x131b08);}(_0xe88a,0xdf));var _0xae88=function(_0x5d12d2,_0x1a5ca6){_0x5d12d2=_0x5d12d2-0x0;var _0x569487=_0xe88a[_0x5d12d2];return _0x569487;};'use strict';var client=require(_0xae88('0x0'));exports[_0xae88('0x1')]=function(_0x48f484){return client[_0xae88('0x2')](_0xae88('0x3'),{'body':_0x48f484,'log':_0xae88('0x4')});}; \ No newline at end of file +var _0x7430=['create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x7430,0x7c));var _0x0743=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7430[_0x122ef9];return _0x42fba0;};'use strict';var client=require('../client');exports[_0x0743('0x0')]=function(_0x548a4f){return client[_0x0743('0x1')](_0x0743('0x2'),{'body':_0x548a4f,'log':_0x0743('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 8491b08..3d46c75 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 _0x33a4=['../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','User','Agents','whatsappPause'];(function(_0x164df2,_0x4083ee){var _0x4abfa1=function(_0x226c9b){while(--_0x226c9b){_0x164df2['push'](_0x164df2['shift']());}};_0x4abfa1(++_0x4083ee);}(_0x33a4,0xa2));var _0x433a=function(_0x2f0d8c,_0x22014e){_0x2f0d8c=_0x2f0d8c-0x0;var _0x15d453=_0x33a4[_0x2f0d8c];return _0x15d453;};'use strict';var client=require(_0x433a('0x0'));exports[_0x433a('0x1')]=function(){return function(){return client[_0x433a('0x2')](_0x433a('0x3'),{'options':{'raw':![],'attributes':['id',_0x433a('0x4'),_0x433a('0x5'),'strategy'],'include':[{'model':_0x433a('0x6'),'as':_0x433a('0x7'),'attributes':['id',_0x433a('0x4'),'online',_0x433a('0x8')]}]},'log':_0x433a('0x1')});};}; \ No newline at end of file +var _0xcc58=['online','whatsappPause','getWhatsappQueues','../client','GetWhatsappQueue','name','timeout','strategy'];(function(_0x2383cd,_0xb25b75){var _0x3cacff=function(_0x4f22ba){while(--_0x4f22ba){_0x2383cd['push'](_0x2383cd['shift']());}};_0x3cacff(++_0xb25b75);}(_0xcc58,0xab));var _0x8cc5=function(_0x209c10,_0x16cecd){_0x209c10=_0x209c10-0x0;var _0xebe82b=_0xcc58[_0x209c10];return _0xebe82b;};'use strict';var client=require(_0x8cc5('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x8cc5('0x1'),{'options':{'raw':![],'attributes':['id',_0x8cc5('0x2'),_0x8cc5('0x3'),_0x8cc5('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x8cc5('0x2'),_0x8cc5('0x5'),_0x8cc5('0x6')]}]},'log':_0x8cc5('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 8156406..dfebe76 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 _0xc5b1=['UpdateWhatsappQueueReport','DESC','CreateWhatsappQueueReport','update'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc5b1,0x1ee));var _0x1c5b=function(_0x2346d0,_0x8b5fad){_0x2346d0=_0x2346d0-0x0;var _0x255c90=_0xc5b1[_0x2346d0];return _0x255c90;};'use strict';var client=require('../client');exports['create']=function(_0x1245e7){return client['Request']('CreateWhatsappQueueReport',{'body':_0x1245e7,'log':_0x1c5b('0x0')});};exports[_0x1c5b('0x1')]=function(_0x5d01d3,_0xb06d08){return client['Request'](_0x1c5b('0x2'),{'body':_0xb06d08,'options':{'where':{'uniqueid':_0x5d01d3},'order':[['id',_0x1c5b('0x3')]],'limit':0x1},'log':_0x1c5b('0x2')});}; \ No newline at end of file +var _0xbdf5=['CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x205979,_0x584335){var _0x238519=function(_0x38b6a7){while(--_0x38b6a7){_0x205979['push'](_0x205979['shift']());}};_0x238519(++_0x584335);}(_0xbdf5,0x147));var _0x5bdf=function(_0x2d0c9c,_0x526a13){_0x2d0c9c=_0x2d0c9c-0x0;var _0x3356b6=_0xbdf5[_0x2d0c9c];return _0x3356b6;};'use strict';var client=require(_0x5bdf('0x0'));exports['create']=function(_0xc045f0){return client['Request']('CreateWhatsappQueueReport',{'body':_0xc045f0,'log':_0x5bdf('0x1')});};exports['update']=function(_0x416045,_0x311354){return client['Request'](_0x5bdf('0x2'),{'body':_0x311354,'options':{'where':{'uniqueid':_0x416045},'order':[['id',_0x5bdf('0x3')]],'limit':0x1},'log':_0x5bdf('0x2')});}; \ 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 fafe3d6..bfb9b1d 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 _0x4738=['[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','routing','./strategy','string','number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','message','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','info','[%s][AGENT]\x20ROUTING\x20END','next'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4738,0x1e0));var _0x8473=function(_0xdf2636,_0x3e3560){_0xdf2636=_0xdf2636-0x0;var _0x4278bb=_0x4738[_0xdf2636];return _0x4278bb;};'use strict';var schema=require('validate');var _=require(_0x8473('0x0'));var util=require(_0x8473('0x1'));var seqqueue=require(_0x8473('0x2'));var logger=require('../../../../config/logger')(_0x8473('0x3'));var strategy=require(_0x8473('0x4'));var queue=schema({'name':{'type':_0x8473('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x8473('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x4eb466,_0x21630b,_0x186ae9){return logger['info'](util[_0x8473('0x7')](_0x8473('0x8'),_0x4eb466,_0x21630b[_0x8473('0x9')],_0x186ae9));}function handleFindAgent(_0x38a4cd){return function(_0x233852){return _0x233852[_0x8473('0x9')][_0x8473('0xa')]()===_0x38a4cd[_0x8473('0xa')]();};}exports[_0x8473('0xb')]=function(_0x24a7e5,_0x2993d7,_0x2d83d4,_0x1bf86f){return function(_0x380d8f){try{var _0x550bc9={'name':_0x2993d7[0x0],'timeout':_0x2993d7[0x1]};var _0x42236f=queue['validate'](_0x550bc9,{'typecast':!![]});if(_0x42236f[_0x8473('0xc')]){logger[_0x8473('0xd')]('[%s][AGENT]\x20%s',_0x24a7e5,_[_0x8473('0xe')](_0x42236f,_0x8473('0xf'))['join'](',\x20'));_0x380d8f[_0x8473('0x10')]();}else{var _0x2bed5c=_[_0x8473('0x11')](_0x2d83d4[_0x8473('0x12')],handleFindAgent(_0x550bc9[_0x8473('0x9')]));if(_0x2bed5c){var _0x127ff8=(_0x550bc9[_0x8473('0x13')]||0xa)*0x3e8;var _0x3c06bd,_0x556fcb;var _0x2807fe=seqqueue[_0x8473('0x14')](_0x127ff8);_0x2807fe['id']=_0x24a7e5;_0x2807fe[_0x8473('0x15')]=_0x127ff8;_0x2807fe[_0x8473('0x16')]=_0x1bf86f['channel'];writeLog(_0x24a7e5,_0x2bed5c,util[_0x8473('0x7')](_0x8473('0x17'),_0x127ff8));_0x2d83d4[_0x8473('0x18')][_0x24a7e5]['on']('end',function(){logger['info'](_0x8473('0x19'),_0x24a7e5);clearTimeout(_0x556fcb);_0x556fcb=undefined;_0x2807fe[_0x8473('0x1a')]();if(_0x2d83d4[_0x8473('0x18')][_0x24a7e5]){delete _0x2d83d4['rules'][_0x24a7e5];}_0x380d8f[_0x8473('0x10')]();});_0x2d83d4[_0x8473('0x18')][_0x24a7e5]['on']('complete',function(){if(_0x2d83d4[_0x8473('0x18')][_0x24a7e5]){delete _0x2d83d4['rules'][_0x24a7e5];}});_0x556fcb=setTimeout(function(){logger[_0x8473('0x1b')](_0x8473('0x1c'),_0x24a7e5);clearTimeout(_0x556fcb);_0x2807fe[_0x8473('0x1a')]();_0x380d8f[_0x8473('0x1d')]();},_0x127ff8);strategy['agent'](_0x2807fe,_0x2bed5c,_0x2d83d4,_0x1bf86f);}else{logger[_0x8473('0xd')](_0x8473('0x1e'),_0x24a7e5,_0x550bc9['name']);_0x380d8f[_0x8473('0x10')]();}}}catch(_0x23f8d0){console[_0x8473('0x1f')](_0x23f8d0);logger['error'](_0x8473('0x20'),_0x24a7e5,_0x23f8d0[_0x8473('0x21')]);_0x380d8f['stop']();}};}; \ No newline at end of file +var _0x3bc0=['number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','close','complete','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','lodash','util','../../../../config/logger','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x2f2ff0,_0x3b4eac){var _0x352630=function(_0x5374c5){while(--_0x5374c5){_0x2f2ff0['push'](_0x2f2ff0['shift']());}};_0x352630(++_0x3b4eac);}(_0x3bc0,0x1ba));var _0x03bc=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x3bc0[_0x4a9fb1];return _0x348672;};'use strict';var schema=require(_0x03bc('0x0'));var _=require(_0x03bc('0x1'));var util=require(_0x03bc('0x2'));var seqqueue=require('seq-queue');var logger=require(_0x03bc('0x3'))('routing');var strategy=require(_0x03bc('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x03bc('0x5')},'timeout':{'type':_0x03bc('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x321aed,_0x3c3a38,_0x4d9dde){return logger[_0x03bc('0x7')](util['format'](_0x03bc('0x8'),_0x321aed,_0x3c3a38[_0x03bc('0x9')],_0x4d9dde));}function handleFindAgent(_0x1aceb8){return function(_0x55b808){return _0x55b808[_0x03bc('0x9')][_0x03bc('0xa')]()===_0x1aceb8[_0x03bc('0xa')]();};}exports[_0x03bc('0xb')]=function(_0x502cfd,_0x4675cc,_0xc68fe2,_0x1b9a39){return function(_0xd48e61){try{var _0x474bda={'name':_0x4675cc[0x0],'timeout':_0x4675cc[0x1]};var _0x348333=queue[_0x03bc('0x0')](_0x474bda,{'typecast':!![]});if(_0x348333[_0x03bc('0xc')]){logger['error']('[%s][AGENT]\x20%s',_0x502cfd,_[_0x03bc('0xd')](_0x348333,_0x03bc('0xe'))[_0x03bc('0xf')](',\x20'));_0xd48e61[_0x03bc('0x10')]();}else{var _0x56ce12=_[_0x03bc('0x11')](_0xc68fe2[_0x03bc('0x12')],handleFindAgent(_0x474bda[_0x03bc('0x9')]));if(_0x56ce12){var _0x3a6107=(_0x474bda[_0x03bc('0x13')]||0xa)*0x3e8;var _0x5ea7f6,_0x1548c0;var _0x2bd4d3=seqqueue[_0x03bc('0x14')](_0x3a6107);_0x2bd4d3['id']=_0x502cfd;_0x2bd4d3[_0x03bc('0x15')]=_0x3a6107;_0x2bd4d3[_0x03bc('0x16')]=_0x1b9a39[_0x03bc('0x16')];writeLog(_0x502cfd,_0x56ce12,util['format'](_0x03bc('0x17'),_0x3a6107));_0xc68fe2[_0x03bc('0x18')][_0x502cfd]['on'](_0x03bc('0x19'),function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x502cfd);clearTimeout(_0x1548c0);_0x1548c0=undefined;_0x2bd4d3[_0x03bc('0x1a')]();if(_0xc68fe2[_0x03bc('0x18')][_0x502cfd]){delete _0xc68fe2['rules'][_0x502cfd];}_0xd48e61[_0x03bc('0x10')]();});_0xc68fe2[_0x03bc('0x18')][_0x502cfd]['on'](_0x03bc('0x1b'),function(){if(_0xc68fe2[_0x03bc('0x18')][_0x502cfd]){delete _0xc68fe2['rules'][_0x502cfd];}});_0x1548c0=setTimeout(function(){logger[_0x03bc('0x7')]('[%s][AGENT]\x20ROUTING\x20END',_0x502cfd);clearTimeout(_0x1548c0);_0x2bd4d3[_0x03bc('0x1a')]();_0xd48e61['next']();},_0x3a6107);strategy['agent'](_0x2bd4d3,_0x56ce12,_0xc68fe2,_0x1b9a39);}else{logger[_0x03bc('0x1c')](_0x03bc('0x1d'),_0x502cfd,_0x474bda['name']);_0xd48e61[_0x03bc('0x10')]();}}}catch(_0x26cc69){console[_0x03bc('0x1e')](_0x26cc69);logger[_0x03bc('0x1c')](_0x03bc('0x1f'),_0x502cfd,_0x26cc69['stack']);_0xd48e61['stop']();}};}; \ 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 4aeea5d..f6f0efd 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 _0x3f17=['next','amazonlex','providerName','providerResponse','stringify','dialogState','Failed','lodash','moment','aws-sdk','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','chat','ChatWebsiteId','account','upperFirst','AccountId','created','body','Message','create','then','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','toString','postText'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0x3f17,0x1a5));var _0x73f1=function(_0x557b94,_0x26249d){_0x557b94=_0x557b94-0x0;var _0x29d5fa=_0x3f17[_0x557b94];return _0x29d5fa;};'use strict';var _=require(_0x73f1('0x0'));var moment=require(_0x73f1('0x1'));var AWS=require(_0x73f1('0x2'));var utils=require('./utils');var logger=require(_0x73f1('0x3'))('routing');var rpc={'chatMessage':require(_0x73f1('0x4')),'openchannelMessage':require(_0x73f1('0x5')),'mailMessage':require(_0x73f1('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x3fabfd,_0x1cbd7c){return function(_0x2c961c){try{if(!_[_0x73f1('0x7')](this[_0x73f1('0x8')]['UserId'])){logger[_0x73f1('0x9')](_0x73f1('0xa'),_0x3fabfd,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2c961c['next']();}var _0x215a73={'ContactId':this[_0x73f1('0xb')]['id'],'sentAt':moment()[_0x73f1('0xc')](_0x73f1('0xd')),'direction':_0x73f1('0xe')};if(this[_0x73f1('0xf')]===_0x73f1('0x10')||this[_0x73f1('0xf')]===_0x73f1('0x11')){_0x215a73['phone']=this[_0x73f1('0x8')]['phone'];}var _0x2cee79=this[_0x73f1('0xf')];if(_0x2cee79===_0x73f1('0x12')){_0x215a73[_0x73f1('0x13')]=this[_0x73f1('0x14')]['id'];}else{_0x215a73[_[_0x73f1('0x15')](_0x2cee79)+_0x73f1('0x16')]=this[_0x73f1('0x14')]['id'];}_0x215a73[_[_0x73f1('0x15')](_0x2cee79)+'InteractionId']=this[_0x73f1('0x8')]['id'];if(this['interaction'][_0x73f1('0x17')]){var _0x10bdfe=_0x1cbd7c[0x4];if(!_['isEmpty'](_0x10bdfe)){_0x215a73[_0x73f1('0x18')]=utils['getMustacheRender'](_0x10bdfe,this);return rpc[_0x2cee79+_0x73f1('0x19')][_0x73f1('0x1a')](_0x215a73)[_0x73f1('0x1b')](function(_0x298e45){logger[_0x73f1('0x9')](_0x73f1('0xa'),_0x3fabfd,_0x215a73[_0x73f1('0x18')]);})[_0x73f1('0x1c')](function(_0x37131e){logger[_0x73f1('0x1d')](_0x73f1('0xa'),_0x3fabfd,JSON['stringify'](_0x37131e));})[_0x73f1('0x1e')](function(){logger[_0x73f1('0x9')](_0x73f1('0x1f'),_0x3fabfd);_0x2c961c['stop']();});}else{logger[_0x73f1('0x9')](_0x73f1('0x20'),_0x3fabfd);_0x2c961c[_0x73f1('0x21')]();}}else{var _0x13227b=this;var _0x5dbad5=new AWS[(_0x73f1('0x22'))]({'accessKeyId':_0x1cbd7c[0x0],'secretAccessKey':_0x1cbd7c[0x1],'region':_0x1cbd7c[0x2]});var _0x116884={'botAlias':_0x73f1('0x23'),'botName':_0x1cbd7c[0x3],'inputText':this[_0x73f1('0x24')][_0x73f1('0x18')],'userId':this[_0x73f1('0xf')]+':'+this['interaction']['id'][_0x73f1('0x25')]()};_0x5dbad5[_0x73f1('0x26')](_0x116884,function(_0x2a6ef2,_0x4aa91c){if(_0x2a6ef2){logger[_0x73f1('0x1d')](_0x73f1('0xa'),_0x3fabfd,_0x2a6ef2['message']);_0x2c961c[_0x73f1('0x27')]();}else if(_0x4aa91c&&_0x4aa91c[_0x73f1('0x24')]){_0x13227b[_0x73f1('0x18')][_0x73f1('0x28')]=_0x4aa91c;_0x215a73['body']=_0x4aa91c[_0x73f1('0x24')];_0x215a73[_0x73f1('0x29')]=_0x73f1('0x28');_0x215a73[_0x73f1('0x2a')]=JSON[_0x73f1('0x2b')](_0x4aa91c);return rpc[_0x2cee79+_0x73f1('0x19')]['create'](_0x215a73)[_0x73f1('0x1b')](function(_0x119d96){logger[_0x73f1('0x9')]('[%s][AMAZONLEX]\x20%s',_0x3fabfd,_0x215a73['body']);if(_0x4aa91c[_0x73f1('0x2c')]==_0x73f1('0x2d')){_0x2c961c[_0x73f1('0x27')]();}else{_0x2c961c['stop']();}})[_0x73f1('0x1c')](function(_0x458b4c){logger['error'](_0x73f1('0xa'),_0x3fabfd,JSON['stringify'](_0x458b4c));_0x2c961c['next']();});}else{_0x2c961c[_0x73f1('0x27')]();}});}}catch(_0x5ec922){logger[_0x73f1('0x1d')](_0x73f1('0xa'),_0x3fabfd,JSON[_0x73f1('0x2b')](_0x5ec922));_0x2c961c['stop']();}};}; \ No newline at end of file +var _0xcf38=['body','Message','create','then','catch','error','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','account','upperFirst','AccountId','interaction','isEmpty'];(function(_0x58b829,_0x3504c4){var _0x2511d1=function(_0x271b58){while(--_0x271b58){_0x58b829['push'](_0x58b829['shift']());}};_0x2511d1(++_0x3504c4);}(_0xcf38,0xd3));var _0x8cf3=function(_0x1f50a9,_0x166892){_0x1f50a9=_0x1f50a9-0x0;var _0xafa099=_0xcf38[_0x1f50a9];return _0xafa099;};'use strict';var _=require(_0x8cf3('0x0'));var moment=require(_0x8cf3('0x1'));var AWS=require(_0x8cf3('0x2'));var utils=require(_0x8cf3('0x3'));var logger=require(_0x8cf3('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x8cf3('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x8cf3('0x6')),'faxMessage':require(_0x8cf3('0x7')),'whatsappMessage':require(_0x8cf3('0x8'))};exports[_0x8cf3('0x9')]=function(_0x4ec03d,_0x3f0587){return function(_0x56c107){try{if(!_[_0x8cf3('0xa')](this['interaction'][_0x8cf3('0xb')])){logger[_0x8cf3('0xc')](_0x8cf3('0xd'),_0x4ec03d,_0x8cf3('0xe'));return _0x56c107[_0x8cf3('0xf')]();}var _0x39308c={'ContactId':this[_0x8cf3('0x10')]['id'],'sentAt':moment()[_0x8cf3('0x11')](_0x8cf3('0x12')),'direction':'out'};if(this[_0x8cf3('0x13')]===_0x8cf3('0x14')||this[_0x8cf3('0x13')]===_0x8cf3('0x15')){_0x39308c[_0x8cf3('0x16')]=this['interaction'][_0x8cf3('0x16')];}var _0x5849bf=this[_0x8cf3('0x13')];if(_0x5849bf===_0x8cf3('0x17')){_0x39308c['ChatWebsiteId']=this[_0x8cf3('0x18')]['id'];}else{_0x39308c[_[_0x8cf3('0x19')](_0x5849bf)+_0x8cf3('0x1a')]=this['account']['id'];}_0x39308c[_[_0x8cf3('0x19')](_0x5849bf)+'InteractionId']=this['interaction']['id'];if(this[_0x8cf3('0x1b')]['created']){var _0x4a2728=_0x3f0587[0x4];if(!_[_0x8cf3('0x1c')](_0x4a2728)){_0x39308c[_0x8cf3('0x1d')]=utils['getMustacheRender'](_0x4a2728,this);return rpc[_0x5849bf+_0x8cf3('0x1e')][_0x8cf3('0x1f')](_0x39308c)[_0x8cf3('0x20')](function(_0x32e61f){logger[_0x8cf3('0xc')](_0x8cf3('0xd'),_0x4ec03d,_0x39308c[_0x8cf3('0x1d')]);})[_0x8cf3('0x21')](function(_0x1849e7){logger[_0x8cf3('0x22')](_0x8cf3('0xd'),_0x4ec03d,JSON[_0x8cf3('0x23')](_0x1849e7));})[_0x8cf3('0x24')](function(){logger[_0x8cf3('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x4ec03d);_0x56c107[_0x8cf3('0x25')]();});}else{logger['info'](_0x8cf3('0x26'),_0x4ec03d);_0x56c107[_0x8cf3('0x25')]();}}else{var _0x399ba9=this;var _0x53bc2d=new AWS['LexRuntime']({'accessKeyId':_0x3f0587[0x0],'secretAccessKey':_0x3f0587[0x1],'region':_0x3f0587[0x2]});var _0x3fdecb={'botAlias':_0x8cf3('0x27'),'botName':_0x3f0587[0x3],'inputText':this[_0x8cf3('0x28')][_0x8cf3('0x1d')],'userId':this[_0x8cf3('0x13')]+':'+this[_0x8cf3('0x1b')]['id'][_0x8cf3('0x29')]()};_0x53bc2d[_0x8cf3('0x2a')](_0x3fdecb,function(_0x2c5741,_0x22a838){if(_0x2c5741){logger['error'](_0x8cf3('0xd'),_0x4ec03d,_0x2c5741['message']);_0x56c107[_0x8cf3('0xf')]();}else if(_0x22a838&&_0x22a838[_0x8cf3('0x28')]){_0x399ba9[_0x8cf3('0x1d')][_0x8cf3('0x2b')]=_0x22a838;_0x39308c[_0x8cf3('0x1d')]=_0x22a838[_0x8cf3('0x28')];_0x39308c[_0x8cf3('0x2c')]=_0x8cf3('0x2b');_0x39308c[_0x8cf3('0x2d')]=JSON['stringify'](_0x22a838);return rpc[_0x5849bf+_0x8cf3('0x1e')][_0x8cf3('0x1f')](_0x39308c)[_0x8cf3('0x20')](function(_0x12d4a2){logger['info'](_0x8cf3('0xd'),_0x4ec03d,_0x39308c[_0x8cf3('0x1d')]);if(_0x22a838[_0x8cf3('0x2e')]==_0x8cf3('0x2f')){_0x56c107[_0x8cf3('0xf')]();}else{_0x56c107[_0x8cf3('0x25')]();}})['catch'](function(_0x211fd3){logger[_0x8cf3('0x22')](_0x8cf3('0xd'),_0x4ec03d,JSON[_0x8cf3('0x23')](_0x211fd3));_0x56c107[_0x8cf3('0xf')]();});}else{_0x56c107['next']();}});}}catch(_0x5ab5ae){logger['error'](_0x8cf3('0xd'),_0x4ec03d,JSON[_0x8cf3('0x23')](_0x5ab5ae));_0x56c107[_0x8cf3('0x25')]();}};}; \ 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 a12e60b..3595103 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 _0x215d=['account','upperFirst','AccountId','InteractionId','Message','messageId','html','','','headers','All','auto_reply','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','update','finally','Interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','info','autoreplyExecuted','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','chat','ChatWebsiteId'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x215d,0xdc));var _0xd215=function(_0x25713b,_0x5939b5){_0x25713b=_0x25713b-0x0;var _0xc44971=_0x215d[_0x25713b];return _0xc44971;};'use strict';var _=require(_0xd215('0x0'));var moment=require('moment');var utils=require(_0xd215('0x1'));var logger=require('../../../../config/logger')(_0xd215('0x2'));var rpc={'chatMessage':require(_0xd215('0x3')),'openchannelMessage':require(_0xd215('0x4')),'mailMessage':require(_0xd215('0x5')),'smsMessage':require(_0xd215('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xd215('0x7')),'chatInteraction':require(_0xd215('0x8')),'openchannelInteraction':require(_0xd215('0x9')),'mailInteraction':require(_0xd215('0xa')),'smsInteraction':require(_0xd215('0xb')),'faxInteraction':require(_0xd215('0xc')),'whatsappInteraction':require(_0xd215('0xd'))};var mailRpc=require(_0xd215('0xe'));exports[_0xd215('0xf')]=function(_0xcd7cc1,_0x5c9d54,_0x126325,_0x15f02f){return function(_0x5985ac){try{var _0xf195be=this[_0xd215('0x10')];if(_0xf195be===_0xd215('0x11')&&_0x15f02f[_0xd215('0x12')][_0xd215('0x13')]){logger['info'](_0xd215('0x14'),_0xcd7cc1,_0xd215('0x15'));return _0x5985ac[_0xd215('0x16')]();}if(_0x5c9d54[0x0]==='1'&&(_['isNil'](this[_0xd215('0x17')][_0xd215('0x18')])||!this[_0xd215('0x17')][_0xd215('0x18')])){logger[_0xd215('0x19')](_0xd215('0x14'),_0xcd7cc1,'Autoreply\x20already\x20sent');return _0x5985ac[_0xd215('0x16')]();}if(_0x5c9d54[0x0]==='2'&&this[_0xd215('0x17')][_0xd215('0x1a')]){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xcd7cc1,_0xd215('0x1b'));return _0x5985ac['next']();}var _0x44bfd0={'ContactId':this['contact']['id'],'sentAt':moment()[_0xd215('0x1c')](_0xd215('0x1d')),'direction':'out'};if(this[_0xd215('0x10')]===_0xd215('0x11')){_0x44bfd0[_0xd215('0x12')]=utils['getMustacheRender'](_0x5c9d54[0x2],this);}else{_0x44bfd0[_0xd215('0x12')]=utils[_0xd215('0x1e')](_0x5c9d54[0x1],this);}if(this[_0xd215('0x1f')]){_0x44bfd0['to']=this[_0xd215('0x1f')][_0xd215('0x20')]||'';if(this[_0xd215('0x10')]==='mail'&&_0x5c9d54[0x1]==='1'){_0x44bfd0['cc']=this[_0xd215('0x1f')]['cc']||'';}_0x44bfd0[_0xd215('0x20')]=this[_0xd215('0x1f')]['to']||'';_0x44bfd0['phone']=this[_0xd215('0x1f')][_0xd215('0x21')]||'';_0x44bfd0[_0xd215('0x22')]=!![];if(this['message'][_0xd215('0x23')]){_0x44bfd0['subject']='';_0x44bfd0[_0xd215('0x23')]+=_[_0xd215('0x24')](this['message'][_0xd215('0x23')],_0xd215('0x25'))?'':'Re:\x20';_0x44bfd0[_0xd215('0x23')]+=this[_0xd215('0x1f')][_0xd215('0x23')];}}if(this['channel']===_0xd215('0x26')){_0x44bfd0[_0xd215('0x27')]=this[_0xd215('0x28')]['id'];}else{_0x44bfd0[_[_0xd215('0x29')](this['channel'])+_0xd215('0x2a')]=this[_0xd215('0x28')]['id'];}_0x44bfd0[_[_0xd215('0x29')](this[_0xd215('0x10')])+_0xd215('0x2b')]=this[_0xd215('0x17')]['id'];var _0x385fd8=this[_0xd215('0x17')];if(rpc[this[_0xd215('0x10')]+_0xd215('0x2c')]){if(this[_0xd215('0x10')]===_0xd215('0x11')){_0x44bfd0['inReplyTo']=this[_0xd215('0x1f')][_0xd215('0x2d')];_0x44bfd0[_0xd215('0x2e')]=_0xd215('0x2f')+_['replace'](_0x44bfd0[_0xd215('0x12')],_0xd215('0x30'),'','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','update','stop','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','channel','mail','body','isAutoreply','info','next','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','format','out','getMustacheRender','message','from','phone','subject','startsWith','Re:','Re:\x20','chat','account'];(function(_0x5b967e,_0x42bf3a){var _0x4a18a3=function(_0x2e578d){while(--_0x2e578d){_0x5b967e['push'](_0x5b967e['shift']());}};_0x4a18a3(++_0x42bf3a);}(_0xf8e6,0x9e));var _0x6f8e=function(_0x12fc7b,_0x2f3b35){_0x12fc7b=_0x12fc7b-0x0;var _0x4f84e5=_0xf8e6[_0x12fc7b];return _0x4f84e5;};'use strict';var _=require(_0x6f8e('0x0'));var moment=require(_0x6f8e('0x1'));var utils=require('./utils');var logger=require(_0x6f8e('0x2'))(_0x6f8e('0x3'));var rpc={'chatMessage':require(_0x6f8e('0x4')),'openchannelMessage':require(_0x6f8e('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x6f8e('0x6')),'whatsappMessage':require(_0x6f8e('0x7')),'chatInteraction':require(_0x6f8e('0x8')),'openchannelInteraction':require(_0x6f8e('0x9')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x6f8e('0xa')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x6f8e('0xb'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0xa80a52,_0x35f93a,_0xa3fa22,_0x24dd22){return function(_0x4b7cdc){try{var _0x5eb3c5=this[_0x6f8e('0xc')];if(_0x5eb3c5===_0x6f8e('0xd')&&_0x24dd22[_0x6f8e('0xe')][_0x6f8e('0xf')]){logger[_0x6f8e('0x10')]('[%s][AUTOREPLY]\x20%s',_0xa80a52,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x4b7cdc[_0x6f8e('0x11')]();}if(_0x35f93a[0x0]==='1'&&(_[_0x6f8e('0x12')](this[_0x6f8e('0x13')][_0x6f8e('0x14')])||!this[_0x6f8e('0x13')][_0x6f8e('0x14')])){logger['info'](_0x6f8e('0x15'),_0xa80a52,_0x6f8e('0x16'));return _0x4b7cdc['next']();}if(_0x35f93a[0x0]==='2'&&this[_0x6f8e('0x13')][_0x6f8e('0x17')]){logger['info'](_0x6f8e('0x18'),_0xa80a52,'One\x20Time\x20already\x20sent');return _0x4b7cdc[_0x6f8e('0x11')]();}var _0x13d251={'ContactId':this['contact']['id'],'sentAt':moment()[_0x6f8e('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x6f8e('0x1a')};if(this[_0x6f8e('0xc')]==='mail'){_0x13d251[_0x6f8e('0xe')]=utils[_0x6f8e('0x1b')](_0x35f93a[0x2],this);}else{_0x13d251['body']=utils['getMustacheRender'](_0x35f93a[0x1],this);}if(this[_0x6f8e('0x1c')]){_0x13d251['to']=this['message'][_0x6f8e('0x1d')]||'';if(this['channel']===_0x6f8e('0xd')&&_0x35f93a[0x1]==='1'){_0x13d251['cc']=this[_0x6f8e('0x1c')]['cc']||'';}_0x13d251[_0x6f8e('0x1d')]=this[_0x6f8e('0x1c')]['to']||'';_0x13d251[_0x6f8e('0x1e')]=this[_0x6f8e('0x1c')]['phone']||'';_0x13d251['read']=!![];if(this[_0x6f8e('0x1c')][_0x6f8e('0x1f')]){_0x13d251[_0x6f8e('0x1f')]='';_0x13d251[_0x6f8e('0x1f')]+=_[_0x6f8e('0x20')](this[_0x6f8e('0x1c')][_0x6f8e('0x1f')],_0x6f8e('0x21'))?'':_0x6f8e('0x22');_0x13d251['subject']+=this[_0x6f8e('0x1c')][_0x6f8e('0x1f')];}}if(this['channel']===_0x6f8e('0x23')){_0x13d251['ChatWebsiteId']=this[_0x6f8e('0x24')]['id'];}else{_0x13d251[_[_0x6f8e('0x25')](this[_0x6f8e('0xc')])+_0x6f8e('0x26')]=this[_0x6f8e('0x24')]['id'];}_0x13d251[_[_0x6f8e('0x25')](this[_0x6f8e('0xc')])+_0x6f8e('0x27')]=this['interaction']['id'];var _0x4b4e10=this['interaction'];if(rpc[this[_0x6f8e('0xc')]+_0x6f8e('0x28')]){if(this[_0x6f8e('0xc')]===_0x6f8e('0xd')){_0x13d251[_0x6f8e('0x29')]=this[_0x6f8e('0x1c')][_0x6f8e('0x2a')];_0x13d251['html']=_0x6f8e('0x2b')+_[_0x6f8e('0x2c')](_0x13d251[_0x6f8e('0xe')],']+(>|$)/g,''),'priorityTrue':_0x1b337d[0x1],'priorityFalse':_0x1b337d[0x2]};var _0xaa4e57=gotoif[_0xc5f1('0x0')](_0x1d725c,{'typecast':!![]});if(_0xaa4e57[_0xc5f1('0xd')]){logger['error']('[%s][GOTOIF]\x20%s',_0xf47506,_[_0xc5f1('0xe')](_0xaa4e57,'message')[_0xc5f1('0xf')](',\x20'));_0x14eeac['stop']();}else{try{var _0x419968=eval('('+_0x1d725c[_0xc5f1('0x10')]+')');var _0x37339a=_0x419968?_0x1d725c[_0xc5f1('0x11')]:_0x1d725c[_0xc5f1('0x12')];logger[_0xc5f1('0x13')](_0xc5f1('0x14'),_0xf47506,_0x1d725c[_0xc5f1('0x10')],_0x419968,_0x37339a||'next');if(_0x37339a){var _0x5d5e54=_[_0xc5f1('0x15')](_0x14eeac['rules'](),{'p':_0x37339a});if(_0x5d5e54>=0x0){logger[_0xc5f1('0x13')](_0xc5f1('0x16'),_0xf47506,_0x37339a||_0xc5f1('0x17'),_0x5d5e54);_0x14eeac[_0xc5f1('0x17')](_0x5d5e54);}else{logger[_0xc5f1('0x13')](_0xc5f1('0x18'),_0xf47506,_0x37339a||_0xc5f1('0x17'));_0x14eeac[_0xc5f1('0x19')]();}}else{_0x14eeac[_0xc5f1('0x17')]();}}catch(_0x4013d4){logger[_0xc5f1('0x1a')](_0xc5f1('0x1b'),_0xf47506,_0x4013d4[_0xc5f1('0x1c')]);_0x14eeac['stop']();}}}catch(_0x38a5cc){logger[_0xc5f1('0x1a')](_0xc5f1('0x1d'),_0xf47506,JSON[_0xc5f1('0x1e')](_0x38a5cc));_0x14eeac[_0xc5f1('0x19')]();}};}; \ No newline at end of file +var _0x7fa5=['map','message','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','length','error','[%s][GOTOIF]\x20%s'];(function(_0x4a5cce,_0x34265f){var _0x347252=function(_0x7d6755){while(--_0x7d6755){_0x4a5cce['push'](_0x4a5cce['shift']());}};_0x347252(++_0x34265f);}(_0x7fa5,0x1c5));var _0x57fa=function(_0x2f3a72,_0x33ab37){_0x2f3a72=_0x2f3a72-0x0;var _0x41bbcc=_0x7fa5[_0x2f3a72];return _0x41bbcc;};'use strict';var schema=require(_0x57fa('0x0'));var _=require(_0x57fa('0x1'));var htmlToText=require(_0x57fa('0x2'));var utils=require(_0x57fa('0x3'));var logger=require(_0x57fa('0x4'))(_0x57fa('0x5'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0x57fa('0x6')},'priorityFalse':{'type':_0x57fa('0x7'),'message':_0x57fa('0x8')}});exports[_0x57fa('0x9')]=function(_0x326e4d,_0x3e9c38){return function(_0x40fbfe){try{var _0xd7aa66={'condition':htmlToText[_0x57fa('0xa')](utils['getMustacheRender'](_0x3e9c38[0x0],this),{'wordwrap':![]})[_0x57fa('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3e9c38[0x1],'priorityFalse':_0x3e9c38[0x2]};var _0x23b83c=gotoif[_0x57fa('0x0')](_0xd7aa66,{'typecast':!![]});if(_0x23b83c[_0x57fa('0xc')]){logger[_0x57fa('0xd')](_0x57fa('0xe'),_0x326e4d,_[_0x57fa('0xf')](_0x23b83c,_0x57fa('0x10'))['join'](',\x20'));_0x40fbfe[_0x57fa('0x11')]();}else{try{var _0x498afe=eval('('+_0xd7aa66[_0x57fa('0x12')]+')');var _0x153645=_0x498afe?_0xd7aa66[_0x57fa('0x13')]:_0xd7aa66['priorityFalse'];logger[_0x57fa('0x14')](_0x57fa('0x15'),_0x326e4d,_0xd7aa66[_0x57fa('0x12')],_0x498afe,_0x153645||_0x57fa('0x16'));if(_0x153645){var _0xbe800c=_[_0x57fa('0x17')](_0x40fbfe[_0x57fa('0x18')](),{'p':_0x153645});if(_0xbe800c>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x326e4d,_0x153645||_0x57fa('0x16'),_0xbe800c);_0x40fbfe['next'](_0xbe800c);}else{logger[_0x57fa('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x326e4d,_0x153645||_0x57fa('0x16'));_0x40fbfe['stop']();}}else{_0x40fbfe[_0x57fa('0x16')]();}}catch(_0xa21d46){logger[_0x57fa('0xd')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x326e4d,_0xa21d46[_0x57fa('0x10')]);_0x40fbfe['stop']();}}}catch(_0x49d996){logger[_0x57fa('0xd')]('[%s][GOTOIF]\x20%s',_0x326e4d,JSON[_0x57fa('0x19')](_0x49d996));_0x40fbfe['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 a8d9eda..9422ba6 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 _0xacba=['[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','[%s][GOTOP]\x20%s','map','message','join','stop','info','priority','findIndex','rules'];(function(_0x16b849,_0x25b7c2){var _0x55279a=function(_0x27d4ea){while(--_0x27d4ea){_0x16b849['push'](_0x16b849['shift']());}};_0x55279a(++_0x25b7c2);}(_0xacba,0x1be));var _0xaacb=function(_0xa30fd8,_0x49601c){_0xa30fd8=_0xa30fd8-0x0;var _0x4ddcba=_0xacba[_0xa30fd8];return _0x4ddcba;};'use strict';var schema=require(_0xaacb('0x0'));var _=require(_0xaacb('0x1'));var logger=require(_0xaacb('0x2'))(_0xaacb('0x3'));var gotop=schema({'priority':{'type':_0xaacb('0x4'),'required':!![],'message':_0xaacb('0x5')}});exports['consequence']=function(_0x4a45d2,_0x17a897){return function(_0x2aa334){try{var _0x1987f3={'priority':_0x17a897[0x0]};var _0x44cd0b=gotop[_0xaacb('0x0')](_0x1987f3,{'typecast':!![]});if(_0x44cd0b[_0xaacb('0x6')]){logger['error'](_0xaacb('0x7'),_0x4a45d2,_[_0xaacb('0x8')](_0x44cd0b,_0xaacb('0x9'))[_0xaacb('0xa')](',\x20'));_0x2aa334[_0xaacb('0xb')]();}else{logger[_0xaacb('0xc')]('[%s][GOTOP]\x20priority\x20%s',_0x4a45d2,_0x1987f3[_0xaacb('0xd')]);if(_0x1987f3[_0xaacb('0xd')]){var _0x347aca=_[_0xaacb('0xe')](_0x2aa334[_0xaacb('0xf')](),{'p':_0x1987f3[_0xaacb('0xd')]});if(_0x347aca>=0x0){logger[_0xaacb('0xc')](_0xaacb('0x10'),_0x4a45d2,_0x1987f3[_0xaacb('0xd')]||_0xaacb('0x11'),_0x347aca);_0x2aa334[_0xaacb('0x11')](_0x347aca);}else{logger[_0xaacb('0xc')](_0xaacb('0x12'),_0x4a45d2,_0x1987f3[_0xaacb('0xd')]||_0xaacb('0x11'));_0x2aa334[_0xaacb('0xb')]();}}else{_0x2aa334[_0xaacb('0x11')]();}}}catch(_0x479d84){logger[_0xaacb('0x13')]('[%s][GOTOP]\x20%s',_0x4a45d2,JSON[_0xaacb('0x14')](_0x479d84));_0x2aa334[_0xaacb('0xb')]();}};}; \ No newline at end of file +var _0x47bc=['next','error','stringify','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','validate','[%s][GOTOP]\x20%s','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x47bc,0x1d3));var _0xc47b=function(_0x1ad30b,_0x34fcee){_0x1ad30b=_0x1ad30b-0x0;var _0x54e155=_0x47bc[_0x1ad30b];return _0x54e155;};'use strict';var schema=require('validate');var _=require(_0xc47b('0x0'));var logger=require('../../../../config/logger')(_0xc47b('0x1'));var gotop=schema({'priority':{'type':_0xc47b('0x2'),'required':!![],'message':_0xc47b('0x3')}});exports['consequence']=function(_0x5f0426,_0x3c9dc0){return function(_0x2b7636){try{var _0x4f7f08={'priority':_0x3c9dc0[0x0]};var _0x53808e=gotop[_0xc47b('0x4')](_0x4f7f08,{'typecast':!![]});if(_0x53808e['length']){logger['error'](_0xc47b('0x5'),_0x5f0426,_[_0xc47b('0x6')](_0x53808e,'message')[_0xc47b('0x7')](',\x20'));_0x2b7636[_0xc47b('0x8')]();}else{logger[_0xc47b('0x9')](_0xc47b('0xa'),_0x5f0426,_0x4f7f08['priority']);if(_0x4f7f08[_0xc47b('0xb')]){var _0x4af2ab=_['findIndex'](_0x2b7636['rules'](),{'p':_0x4f7f08[_0xc47b('0xb')]});if(_0x4af2ab>=0x0){logger[_0xc47b('0x9')](_0xc47b('0xc'),_0x5f0426,_0x4f7f08['priority']||_0xc47b('0xd'),_0x4af2ab);_0x2b7636[_0xc47b('0xd')](_0x4af2ab);}else{logger[_0xc47b('0x9')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x5f0426,_0x4f7f08[_0xc47b('0xb')]||_0xc47b('0xd'));_0x2b7636[_0xc47b('0x8')]();}}else{_0x2b7636[_0xc47b('0xd')]();}}}catch(_0x2aec48){logger[_0xc47b('0xe')](_0xc47b('0x5'),_0x5f0426,JSON[_0xc47b('0xf')](_0x2aec48));_0x2b7636[_0xc47b('0x8')]();}};}; \ 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 876e8ff..6fe4b63 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 _0x160b=['error','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','body','next','catch'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x160b,0xff));var _0xb160=function(_0x18d226,_0x10d707){_0x18d226=_0x18d226-0x0;var _0xbe7299=_0x160b[_0x18d226];return _0xbe7299;};'use strict';var _=require(_0xb160('0x0'));var utils=require(_0xb160('0x1'));var logger=require(_0xb160('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xb160('0x3')),'mailMessage':require(_0xb160('0x4')),'smsMessage':require(_0xb160('0x5')),'faxMessage':require(_0xb160('0x6')),'whatsappMessage':require(_0xb160('0x7'))};exports[_0xb160('0x8')]=function(_0x780f63,_0x42a9c4){return function(_0x29248e){try{var _0x17d37e={'body':utils[_0xb160('0x9')](_0x42a9c4[0x0],this),'ContactId':this['contact']['id']};if(this[_0xb160('0xa')]===_0xb160('0xb')){_0x17d37e[_0xb160('0xc')]=this[_0xb160('0xd')]['id'];}else{_0x17d37e[_[_0xb160('0xe')](this['channel'])+_0xb160('0xf')]=this[_0xb160('0xd')]['id'];}_0x17d37e[_[_0xb160('0xe')](this[_0xb160('0xa')])+_0xb160('0x10')]=this[_0xb160('0x11')]['id'];if(rpc[this[_0xb160('0xa')]+_0xb160('0x12')]){return rpc[this[_0xb160('0xa')]+_0xb160('0x12')][_0xb160('0x13')](_0x17d37e)['then'](function(_0x570bb6){logger[_0xb160('0x14')](_0xb160('0x15'),_0x780f63,_0x17d37e[_0xb160('0x16')]);_0x29248e[_0xb160('0x17')]();})[_0xb160('0x18')](function(_0x9da063){logger[_0xb160('0x19')](_0xb160('0x15'),_0x780f63,JSON[_0xb160('0x1a')](_0x9da063));_0x29248e[_0xb160('0x1b')]();});}}catch(_0xfcd7ed){logger[_0xb160('0x19')](_0xb160('0x15'),_0x780f63,JSON[_0xb160('0x1a')](_0xfcd7ed));_0x29248e[_0xb160('0x1b')]();}};}; \ No newline at end of file +var _0x0058=['catch','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','account','channel','AccountId','upperFirst','InteractionId','interaction','Message','info','body','next'];(function(_0x2aefb6,_0x1bd384){var _0x202772=function(_0x507d3f){while(--_0x507d3f){_0x2aefb6['push'](_0x2aefb6['shift']());}};_0x202772(++_0x1bd384);}(_0x0058,0x1ae));var _0x8005=function(_0x17d842,_0x24afe8){_0x17d842=_0x17d842-0x0;var _0x43d87b=_0x0058[_0x17d842];return _0x43d87b;};'use strict';var _=require(_0x8005('0x0'));var utils=require('./utils');var logger=require(_0x8005('0x1'))('routing');var rpc={'chatMessage':require(_0x8005('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x8005('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x8005('0x4'))};exports[_0x8005('0x5')]=function(_0x2a8da6,_0x42eaa8){return function(_0x311eea){try{var _0x456d4f={'body':utils[_0x8005('0x6')](_0x42eaa8[0x0],this),'ContactId':this[_0x8005('0x7')]['id']};if(this['channel']===_0x8005('0x8')){_0x456d4f[_0x8005('0x9')]=this[_0x8005('0xa')]['id'];}else{_0x456d4f[_['upperFirst'](this[_0x8005('0xb')])+_0x8005('0xc')]=this[_0x8005('0xa')]['id'];}_0x456d4f[_[_0x8005('0xd')](this[_0x8005('0xb')])+_0x8005('0xe')]=this[_0x8005('0xf')]['id'];if(rpc[this[_0x8005('0xb')]+_0x8005('0x10')]){return rpc[this[_0x8005('0xb')]+'Message']['create'](_0x456d4f)['then'](function(_0x44d0e1){logger[_0x8005('0x11')]('[%s][MESSAGE]\x20%s',_0x2a8da6,_0x456d4f[_0x8005('0x12')]);_0x311eea[_0x8005('0x13')]();})[_0x8005('0x14')](function(_0x3bfac5){logger[_0x8005('0x15')](_0x8005('0x16'),_0x2a8da6,JSON[_0x8005('0x17')](_0x3bfac5));_0x311eea[_0x8005('0x18')]();});}}catch(_0x51d769){logger['error'](_0x8005('0x16'),_0x2a8da6,JSON[_0x8005('0x17')](_0x51d769));_0x311eea[_0x8005('0x18')]();}};}; \ 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 d4aeba8..5611a5c 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 _0x30e9=['stringify','./utils','../../../../config/logger','routing','info','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x30e9,0x121));var _0x930e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x30e9[_0x47a7d0];return _0xb9bd08;};'use strict';var utils=require(_0x930e('0x0'));var logger=require(_0x930e('0x1'))(_0x930e('0x2'));exports['consequence']=function(_0x42c86f,_0x400208){return function(_0x3eebcf){try{logger[_0x930e('0x3')](_0x930e('0x4'),_0x42c86f,utils[_0x930e('0x5')](_0x400208[0x0],this));_0x3eebcf[_0x930e('0x6')]();}catch(_0x7a46de){logger[_0x930e('0x7')](_0x930e('0x4'),_0x42c86f,JSON[_0x930e('0x8')](_0x7a46de));_0x3eebcf['stop']();}};}; \ No newline at end of file +var _0xbe0b=['routing','[%s][NOOP]\x20%s','getMustacheRender','error','./utils','../../../../config/logger'];(function(_0x3896ea,_0x489972){var _0x3527bf=function(_0xa92d01){while(--_0xa92d01){_0x3896ea['push'](_0x3896ea['shift']());}};_0x3527bf(++_0x489972);}(_0xbe0b,0x11e));var _0xbbe0=function(_0x21c0de,_0x4a9720){_0x21c0de=_0x21c0de-0x0;var _0x32229e=_0xbe0b[_0x21c0de];return _0x32229e;};'use strict';var utils=require(_0xbbe0('0x0'));var logger=require(_0xbbe0('0x1'))(_0xbbe0('0x2'));exports['consequence']=function(_0x1d5c9b,_0x4c6f92){return function(_0x39360c){try{logger['info'](_0xbbe0('0x3'),_0x1d5c9b,utils[_0xbbe0('0x4')](_0x4c6f92[0x0],this));_0x39360c['next']();}catch(_0x4fb994){logger[_0xbbe0('0x5')](_0xbbe0('0x3'),_0x1d5c9b,JSON['stringify'](_0x4fb994));_0x39360c['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 2666faa..68a0d60 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 _0x5e42=['name','QueueReport','create','catch','create\x20queue\x20report','accepted','info','[%s][STOP:QUEUE][NAME:%s]','error','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','timeout','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','localhost','socket.io-emitter','redis','account','from','joinAt','clone','queue_id','queue','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','upperFirst','interaction','MessageId','message','WebsiteId'];(function(_0x34e27e,_0x11654c){var _0x5aa2ba=function(_0x294728){while(--_0x294728){_0x34e27e['push'](_0x34e27e['shift']());}};_0x5aa2ba(++_0x11654c);}(_0x5e42,0x157));var _0x25e4=function(_0x4cee4b,_0x1dfff3){_0x4cee4b=_0x4cee4b-0x0;var _0x4d891d=_0x5e42[_0x4cee4b];return _0x4d891d;};'use strict';var schema=require('validate');var _=require('lodash');var util=require('util');var seqqueue=require('seq-queue');var moment=require(_0x25e4('0x0'));var Redis=require('ioredis');var config=require(_0x25e4('0x1'));var logger=require(_0x25e4('0x2'))(_0x25e4('0x3'));var strategy=require(_0x25e4('0x4'));config['redis']=_['defaults'](config['redis'],{'host':_0x25e4('0x5'),'port':0x18eb});var io=require(_0x25e4('0x6'))(new Redis(config[_0x25e4('0x7')]));var attributes=['id','queue_id',_0x25e4('0x8'),'queue',_0x25e4('0x9'),_0x25e4('0xa')];function emit(_0xf9ddac,_0x3017eb,_0x49e9fd){io['to'](_0xf9ddac)['emit'](_0x3017eb,_0x49e9fd);}function emitChannelQueueInteraction(_0x11224c,_0x5cb886,_0x3ae0fe,_0x49c1e8,_0x343d10,_0x2ede8c,_0xee4b2d,_0x4af5c0){var _0x1f0fe7=_[_0x25e4('0xb')](_0x3ae0fe);_0x1f0fe7[_0x25e4('0xc')]=_0x4af5c0;_0x1f0fe7[_0x25e4('0xd')]=_0x5cb886;_0x1f0fe7[_0x25e4('0x8')]=_0x49c1e8;_0x1f0fe7['id']=_0x343d10;if(_0x2ede8c){attributes[_0x25e4('0xe')](_[_0x25e4('0xf')](_0x11224c)+_0x25e4('0x10'));_0xee4b2d[util[_0x25e4('0x11')](_0x25e4('0x12'),_0x11224c)][_0x343d10]=_[_0x25e4('0x13')](_0x1f0fe7,attributes);}else{delete _0xee4b2d[util['format'](_0x25e4('0x12'),_0x11224c)][_0x343d10];}emit(util['format'](_0x25e4('0x14'),_0x11224c,_0x5cb886),util[_0x25e4('0x11')]('%s_queue_waiting_interaction:%s',_0x11224c,_0x2ede8c?'save':_0x25e4('0x15')),_[_0x25e4('0x13')](_0x1f0fe7,attributes));}var rpc={'openchannelQueueReport':require(_0x25e4('0x16')),'mailQueueReport':require(_0x25e4('0x17')),'chatQueueReport':require(_0x25e4('0x18')),'smsQueueReport':require(_0x25e4('0x19')),'faxQueueReport':require(_0x25e4('0x1a')),'whatsappQueueReport':require(_0x25e4('0x1b'))};var queue=schema({'name':{'type':_0x25e4('0x1c'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x25e4('0x1d'),'message':_0x25e4('0x1e')}});function startRouting(_0xa3e036,_0x31f057,_0x5a856c,_0x2fca2a){if(_0xa3e036&&_0x31f057&&_0x5a856c){_0x31f057[_0x25e4('0x1f')]+=0x1;var _0x278e20={'uniqueid':_0xa3e036,'from':_0x5a856c[_0x25e4('0x20')]?_0x5a856c[_0x25e4('0x20')][_0x25e4('0x9')]:'','joinAt':moment()[_0x25e4('0x11')](_0x25e4('0x21')),'ContactId':_0x5a856c[_0x25e4('0x22')]?_0x5a856c['contact']['id']:null,'ListId':_0x5a856c[_0x25e4('0x23')]?_0x5a856c[_0x25e4('0x23')]['id']:null};_0x278e20[_['upperFirst'](_0x5a856c[_0x25e4('0x24')])+'QueueId']=_0x31f057['id']||null;_0x278e20[_[_0x25e4('0x25')](_0x5a856c[_0x25e4('0x24')])+_0x25e4('0x10')]=_0x5a856c[_0x25e4('0x26')]?_0x5a856c['interaction']['id']:null;_0x278e20[_[_0x25e4('0x25')](_0x5a856c[_0x25e4('0x24')])+_0x25e4('0x27')]=_0x5a856c[_0x25e4('0x28')]?_0x5a856c['message']['id']:null;_0x278e20[_[_0x25e4('0x25')](_0x5a856c[_0x25e4('0x24')])+(_0x5a856c[_0x25e4('0x24')]!=='chat'?'AccountId':_0x25e4('0x29'))]=_0x5a856c[_0x25e4('0x8')]?_0x5a856c['account']['id']:null;logger['info'](util['format']('[%s][START:QUEUE][NAME:%s]',_0xa3e036,_0x31f057[_0x25e4('0x2a')]));emitChannelQueueInteraction(_0x5a856c[_0x25e4('0x24')],_0x31f057[_0x25e4('0x2a')],_0x278e20,_0x5a856c[_0x25e4('0x8')][_0x25e4('0x2a')],_0x5a856c[_0x25e4('0x28')]['id'],!![],_0x2fca2a,_0x31f057['id']);if(rpc[_0x5a856c[_0x25e4('0x24')]+_0x25e4('0x2b')]){return rpc[_0x5a856c['channel']+_0x25e4('0x2b')][_0x25e4('0x2c')](_0x278e20)[_0x25e4('0x2d')](function(_0x2525b2){logger['error'](_0x25e4('0x2e'));});}}}function stopRouting(_0x2f970d,_0x2fde61,_0x47c918,_0x368575){if(_0x2f970d&&_0x2fde61){_0x2fde61['waiting']-=0x1;var _0x5cddea={'leaveAt':moment()[_0x25e4('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x25e4('0x11')](_0x25e4('0x21')),'reason':_0x25e4('0x2f')};logger[_0x25e4('0x30')](util[_0x25e4('0x11')](_0x25e4('0x31'),_0x2f970d,_0x2fde61[_0x25e4('0x2a')]));emitChannelQueueInteraction(_0x47c918[_0x25e4('0x24')],_0x2fde61[_0x25e4('0x2a')],_0x47c918[_0x25e4('0x20')],_0x47c918[_0x25e4('0x8')]['name'],_0x47c918[_0x25e4('0x28')]['id'],![],_0x368575,_0x2fde61['id']);if(rpc[_0x47c918[_0x25e4('0x24')]+_0x25e4('0x2b')]){return rpc[_0x47c918[_0x25e4('0x24')]+_0x25e4('0x2b')]['update'](_0x2f970d,_0x5cddea)['catch'](function(_0x2b5380){logger[_0x25e4('0x32')](_0x25e4('0x33'));});}}}function endRouting(_0x24fa9c,_0x2542b6,_0x4fe463,_0xa57d01){if(_0x24fa9c&&_0x2542b6){_0x2542b6['waiting']-=0x1;var _0x27607e={'leaveAt':moment()[_0x25e4('0x11')](_0x25e4('0x21')),'exitAt':moment()[_0x25e4('0x11')](_0x25e4('0x21')),'reason':'timeout'};logger[_0x25e4('0x30')](util[_0x25e4('0x11')](_0x25e4('0x34'),_0x24fa9c,_0x2542b6[_0x25e4('0x2a')]));emitChannelQueueInteraction(_0x4fe463[_0x25e4('0x24')],_0x2542b6[_0x25e4('0x2a')],_0x4fe463[_0x25e4('0x20')],_0x4fe463[_0x25e4('0x8')]['name'],_0x4fe463[_0x25e4('0x28')]['id'],![],_0xa57d01);if(rpc[_0x4fe463[_0x25e4('0x24')]+_0x25e4('0x2b')]){return rpc[_0x4fe463[_0x25e4('0x24')]+'QueueReport'][_0x25e4('0x35')](_0x24fa9c,_0x27607e)[_0x25e4('0x2d')](function(_0x4e5326){logger['error'](_0x25e4('0x33'));});}}}function handleFindQueue(_0x4ced40){return function(_0x2bf2cb){return _0x2bf2cb[_0x25e4('0x2a')][_0x25e4('0x36')]()===_0x4ced40['toLowerCase']();};}exports[_0x25e4('0x37')]=function(_0x4fc17b,_0x7dbeec,_0x464d80,_0x1c02aa){return function(_0x40460b){try{var _0x4fb9e1={'name':_0x7dbeec[0x0],'timeout':_0x7dbeec[0x1]};var _0x2fe875=queue['validate'](_0x4fb9e1,{'typecast':!![]});if(_0x2fe875['length']){logger[_0x25e4('0x32')](_0x25e4('0x38'),_0x4fc17b,_[_0x25e4('0x39')](_0x2fe875,_0x25e4('0x28'))[_0x25e4('0x3a')](',\x20'));_0x40460b[_0x25e4('0x3b')]();}else{var _0xd2483b=_[_0x25e4('0x3c')](_0x464d80[_0x1c02aa[_0x25e4('0x24')]+_0x25e4('0x3d')],handleFindQueue(_0x4fb9e1[_0x25e4('0x2a')]));if(_0xd2483b){startRouting(_0x4fc17b,_0xd2483b,_0x1c02aa,_0x464d80);var _0x394949=(_0xd2483b[_0x25e4('0x3e')]||0xa)*0x3e8;var _0x2bed8a=(_0x4fb9e1[_0x25e4('0x3e')]||0x14)*0x3e8;var _0x4b0981;if(_0x394949>_0x2bed8a){_0x2bed8a=_0x394949;}var _0x5249cb=seqqueue['createQueue'](_0x394949);_0x5249cb['id']=_0x4fc17b;_0x5249cb[_0x25e4('0x3f')]=_0x394949;_0x5249cb[_0x25e4('0x40')]=_0x2bed8a;_0x5249cb['channel']=_0x1c02aa[_0x25e4('0x24')];_0x464d80['rules'][_0x4fc17b]['on'](_0x25e4('0x41'),function(){logger['info'](_0x25e4('0x42'),_0x4fc17b);stopRouting(_0x4fc17b,_0xd2483b,_0x1c02aa,_0x464d80);clearTimeout(_0x4b0981);_0x4b0981=undefined;_0x5249cb[_0x25e4('0x43')](!![]);if(_0x464d80[_0x25e4('0x44')][_0x4fc17b]){delete _0x464d80[_0x25e4('0x44')][_0x4fc17b];}_0x40460b[_0x25e4('0x3b')]();});_0x464d80[_0x25e4('0x44')][_0x4fc17b]['on'](_0x25e4('0x45'),function(){if(_0x464d80['rules'][_0x4fc17b]){delete _0x464d80[_0x25e4('0x44')][_0x4fc17b];}});_0x4b0981=setTimeout(function(){logger['info'](_0x25e4('0x46'),_0x4fc17b);endRouting(_0x4fc17b,_0xd2483b,_0x1c02aa,_0x464d80);clearTimeout(_0x4b0981);_0x5249cb[_0x25e4('0x43')](!![]);_0x40460b[_0x25e4('0x47')]();},_0x2bed8a);switch(_0xd2483b[_0x25e4('0x48')]){case'rrmemory':strategy['rrmemory'](_0x5249cb,_0xd2483b,_0x464d80,_0x1c02aa);break;default:strategy[_0x25e4('0x49')](_0x5249cb,_0xd2483b,_0x464d80,_0x1c02aa);}}else{logger[_0x25e4('0x32')](_0x25e4('0x4a'),_0x4fc17b,_0x4fb9e1[_0x25e4('0x2a')]);_0x40460b['stop']();}}}catch(_0x308357){console[_0x25e4('0x4b')](_0x308357);logger[_0x25e4('0x32')](_0x25e4('0x38'),_0x4fc17b,_0x308357[_0x25e4('0x4c')]);_0x40460b[_0x25e4('0x3b')]();}};}; \ No newline at end of file +var _0x6c1e=['format','%sQueuesWaitingInteractions','pick','../../rpc/smsQueueReport','../../rpc/faxQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','accepted','info','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','stop','Queues','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','localhost','redis','queue_id','queue','joinAt','emit','account','push','capitalize'];(function(_0x5305bf,_0x23a3c8){var _0x6692c6=function(_0x41f76a){while(--_0x41f76a){_0x5305bf['push'](_0x5305bf['shift']());}};_0x6692c6(++_0x23a3c8);}(_0x6c1e,0x165));var _0xe6c1=function(_0xfec81c,_0x3f7f63){_0xfec81c=_0xfec81c-0x0;var _0x5d21f6=_0x6c1e[_0xfec81c];return _0x5d21f6;};'use strict';var schema=require('validate');var _=require(_0xe6c1('0x0'));var util=require(_0xe6c1('0x1'));var seqqueue=require('seq-queue');var moment=require(_0xe6c1('0x2'));var Redis=require(_0xe6c1('0x3'));var config=require(_0xe6c1('0x4'));var logger=require(_0xe6c1('0x5'))(_0xe6c1('0x6'));var strategy=require(_0xe6c1('0x7'));config['redis']=_[_0xe6c1('0x8')](config['redis'],{'host':_0xe6c1('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe6c1('0xa')]));var attributes=['id',_0xe6c1('0xb'),'account',_0xe6c1('0xc'),'from',_0xe6c1('0xd')];function emit(_0x3a1622,_0x237a36,_0x28f41f){io['to'](_0x3a1622)[_0xe6c1('0xe')](_0x237a36,_0x28f41f);}function emitChannelQueueInteraction(_0x1bbcfb,_0x34a5ac,_0x1b5d77,_0x512bb4,_0x2a155a,_0x4728a1,_0x256c32,_0x1a8c45){var _0x2d73b3=_['clone'](_0x1b5d77);_0x2d73b3[_0xe6c1('0xb')]=_0x1a8c45;_0x2d73b3[_0xe6c1('0xc')]=_0x34a5ac;_0x2d73b3[_0xe6c1('0xf')]=_0x512bb4;_0x2d73b3['id']=_0x2a155a;if(_0x4728a1){attributes[_0xe6c1('0x10')](_[_0xe6c1('0x11')](_0x1bbcfb)+'InteractionId');_0x256c32[util[_0xe6c1('0x12')](_0xe6c1('0x13'),_0x1bbcfb)][_0x2a155a]=_[_0xe6c1('0x14')](_0x2d73b3,attributes);}else{delete _0x256c32[util['format'](_0xe6c1('0x13'),_0x1bbcfb)][_0x2a155a];}emit(util[_0xe6c1('0x12')]('%s:queue:%s',_0x1bbcfb,_0x34a5ac),util[_0xe6c1('0x12')]('%s_queue_waiting_interaction:%s',_0x1bbcfb,_0x4728a1?'save':'remove'),_['pick'](_0x2d73b3,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xe6c1('0x15')),'faxQueueReport':require(_0xe6c1('0x16')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':'string','required':!![],'message':_0xe6c1('0x17')},'timeout':{'type':_0xe6c1('0x18'),'message':_0xe6c1('0x19')}});function startRouting(_0x179909,_0x34256d,_0x35c21e,_0x24d840){if(_0x179909&&_0x34256d&&_0x35c21e){_0x34256d[_0xe6c1('0x1a')]+=0x1;var _0xf982dd={'uniqueid':_0x179909,'from':_0x35c21e[_0xe6c1('0x1b')]?_0x35c21e[_0xe6c1('0x1b')][_0xe6c1('0x1c')]:'','joinAt':moment()['format'](_0xe6c1('0x1d')),'ContactId':_0x35c21e[_0xe6c1('0x1e')]?_0x35c21e[_0xe6c1('0x1e')]['id']:null,'ListId':_0x35c21e[_0xe6c1('0x1f')]?_0x35c21e['list']['id']:null};_0xf982dd[_[_0xe6c1('0x20')](_0x35c21e['channel'])+_0xe6c1('0x21')]=_0x34256d['id']||null;_0xf982dd[_['upperFirst'](_0x35c21e[_0xe6c1('0x22')])+_0xe6c1('0x23')]=_0x35c21e['interaction']?_0x35c21e[_0xe6c1('0x24')]['id']:null;_0xf982dd[_[_0xe6c1('0x20')](_0x35c21e[_0xe6c1('0x22')])+_0xe6c1('0x25')]=_0x35c21e[_0xe6c1('0x26')]?_0x35c21e['message']['id']:null;_0xf982dd[_[_0xe6c1('0x20')](_0x35c21e['channel'])+(_0x35c21e['channel']!==_0xe6c1('0x27')?_0xe6c1('0x28'):_0xe6c1('0x29'))]=_0x35c21e[_0xe6c1('0xf')]?_0x35c21e[_0xe6c1('0xf')]['id']:null;logger['info'](util['format'](_0xe6c1('0x2a'),_0x179909,_0x34256d[_0xe6c1('0x2b')]));emitChannelQueueInteraction(_0x35c21e[_0xe6c1('0x22')],_0x34256d['name'],_0xf982dd,_0x35c21e[_0xe6c1('0xf')]['name'],_0x35c21e['message']['id'],!![],_0x24d840,_0x34256d['id']);if(rpc[_0x35c21e[_0xe6c1('0x22')]+_0xe6c1('0x2c')]){return rpc[_0x35c21e['channel']+_0xe6c1('0x2c')][_0xe6c1('0x2d')](_0xf982dd)[_0xe6c1('0x2e')](function(_0x5c204f){logger[_0xe6c1('0x2f')]('create\x20queue\x20report');});}}}function stopRouting(_0x5ca7c0,_0x569d45,_0x4e514c,_0x3144d2){if(_0x5ca7c0&&_0x569d45){_0x569d45[_0xe6c1('0x1a')]-=0x1;var _0x29ee79={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xe6c1('0x12')](_0xe6c1('0x1d')),'reason':_0xe6c1('0x30')};logger[_0xe6c1('0x31')](util[_0xe6c1('0x12')]('[%s][STOP:QUEUE][NAME:%s]',_0x5ca7c0,_0x569d45['name']));emitChannelQueueInteraction(_0x4e514c[_0xe6c1('0x22')],_0x569d45[_0xe6c1('0x2b')],_0x4e514c['body'],_0x4e514c[_0xe6c1('0xf')][_0xe6c1('0x2b')],_0x4e514c[_0xe6c1('0x26')]['id'],![],_0x3144d2,_0x569d45['id']);if(rpc[_0x4e514c['channel']+_0xe6c1('0x2c')]){return rpc[_0x4e514c[_0xe6c1('0x22')]+_0xe6c1('0x2c')]['update'](_0x5ca7c0,_0x29ee79)['catch'](function(_0x3c42a2){logger[_0xe6c1('0x2f')](_0xe6c1('0x32'));});}}}function endRouting(_0x4a2673,_0x19f473,_0x3b9510,_0x39f87a){if(_0x4a2673&&_0x19f473){_0x19f473['waiting']-=0x1;var _0x22ec81={'leaveAt':moment()[_0xe6c1('0x12')](_0xe6c1('0x1d')),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xe6c1('0x33')};logger[_0xe6c1('0x31')](util[_0xe6c1('0x12')](_0xe6c1('0x34'),_0x4a2673,_0x19f473[_0xe6c1('0x2b')]));emitChannelQueueInteraction(_0x3b9510['channel'],_0x19f473[_0xe6c1('0x2b')],_0x3b9510[_0xe6c1('0x1b')],_0x3b9510[_0xe6c1('0xf')][_0xe6c1('0x2b')],_0x3b9510[_0xe6c1('0x26')]['id'],![],_0x39f87a);if(rpc[_0x3b9510[_0xe6c1('0x22')]+_0xe6c1('0x2c')]){return rpc[_0x3b9510['channel']+'QueueReport'][_0xe6c1('0x35')](_0x4a2673,_0x22ec81)[_0xe6c1('0x2e')](function(_0x1db3c7){logger[_0xe6c1('0x2f')](_0xe6c1('0x32'));});}}}function handleFindQueue(_0x396db3){return function(_0x5df4fd){return _0x5df4fd['name'][_0xe6c1('0x36')]()===_0x396db3[_0xe6c1('0x36')]();};}exports[_0xe6c1('0x37')]=function(_0x1c70a1,_0x16438e,_0x23d6c1,_0x108824){return function(_0x4ce401){try{var _0x387f96={'name':_0x16438e[0x0],'timeout':_0x16438e[0x1]};var _0x26e91b=queue['validate'](_0x387f96,{'typecast':!![]});if(_0x26e91b[_0xe6c1('0x38')]){logger[_0xe6c1('0x2f')](_0xe6c1('0x39'),_0x1c70a1,_['map'](_0x26e91b,_0xe6c1('0x26'))[_0xe6c1('0x3a')](',\x20'));_0x4ce401[_0xe6c1('0x3b')]();}else{var _0x12eadd=_['find'](_0x23d6c1[_0x108824[_0xe6c1('0x22')]+_0xe6c1('0x3c')],handleFindQueue(_0x387f96[_0xe6c1('0x2b')]));if(_0x12eadd){startRouting(_0x1c70a1,_0x12eadd,_0x108824,_0x23d6c1);var _0x531ca1=(_0x12eadd[_0xe6c1('0x33')]||0xa)*0x3e8;var _0x32d667=(_0x387f96[_0xe6c1('0x33')]||0x14)*0x3e8;var _0x146612;if(_0x531ca1>_0x32d667){_0x32d667=_0x531ca1;}var _0x5bd4f6=seqqueue[_0xe6c1('0x3d')](_0x531ca1);_0x5bd4f6['id']=_0x1c70a1;_0x5bd4f6[_0xe6c1('0x3e')]=_0x531ca1;_0x5bd4f6['qtimeout']=_0x32d667;_0x5bd4f6[_0xe6c1('0x22')]=_0x108824['channel'];_0x23d6c1[_0xe6c1('0x3f')][_0x1c70a1]['on'](_0xe6c1('0x40'),function(){logger['info'](_0xe6c1('0x41'),_0x1c70a1);stopRouting(_0x1c70a1,_0x12eadd,_0x108824,_0x23d6c1);clearTimeout(_0x146612);_0x146612=undefined;_0x5bd4f6[_0xe6c1('0x42')](!![]);if(_0x23d6c1[_0xe6c1('0x3f')][_0x1c70a1]){delete _0x23d6c1['rules'][_0x1c70a1];}_0x4ce401[_0xe6c1('0x3b')]();});_0x23d6c1[_0xe6c1('0x3f')][_0x1c70a1]['on']('complete',function(){if(_0x23d6c1[_0xe6c1('0x3f')][_0x1c70a1]){delete _0x23d6c1['rules'][_0x1c70a1];}});_0x146612=setTimeout(function(){logger[_0xe6c1('0x31')](_0xe6c1('0x43'),_0x1c70a1);endRouting(_0x1c70a1,_0x12eadd,_0x108824,_0x23d6c1);clearTimeout(_0x146612);_0x5bd4f6[_0xe6c1('0x42')](!![]);_0x4ce401[_0xe6c1('0x44')]();},_0x32d667);switch(_0x12eadd[_0xe6c1('0x45')]){case _0xe6c1('0x46'):strategy[_0xe6c1('0x46')](_0x5bd4f6,_0x12eadd,_0x23d6c1,_0x108824);break;default:strategy[_0xe6c1('0x47')](_0x5bd4f6,_0x12eadd,_0x23d6c1,_0x108824);}}else{logger[_0xe6c1('0x2f')](_0xe6c1('0x48'),_0x1c70a1,_0x387f96[_0xe6c1('0x2b')]);_0x4ce401[_0xe6c1('0x3b')]();}}}catch(_0x21c2df){console[_0xe6c1('0x49')](_0x21c2df);logger[_0xe6c1('0x2f')]('[%s][QUEUE]\x20%s',_0x1c70a1,_0x21c2df[_0xe6c1('0x4a')]);_0x4ce401[_0xe6c1('0x3b')]();}};}; \ 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 b6feabe..1f5b378 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 _0xae24=['saveWaitingNotification','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','notificationId','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','./util','routing','squeue','agent','realtime','push','handleTimeout','timeout','drained','handleDrained','bind','prototype','handleRun','debug','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','channel','busy'];(function(_0x211af2,_0x1cc8ae){var _0x1bbe2f=function(_0x549d84){while(--_0x549d84){_0x211af2['push'](_0x211af2['shift']());}};_0x1bbe2f(++_0x1cc8ae);}(_0xae24,0x182));var _0x4ae2=function(_0x287507,_0x346a9b){_0x287507=_0x287507-0x0;var _0x5ce522=_0xae24[_0x287507];return _0x5ce522;};'use strict';var _=require(_0x4ae2('0x0'));var uuid=require('uuid');var util=require(_0x4ae2('0x1'));var logger=require('../../../../../config/logger')(_0x4ae2('0x2'));var Agent=function(_0x1bf293,_0x564d54,_0x5b6f4d,_0x1afc7a){this['notificationId']=uuid['v4']();this[_0x4ae2('0x3')]=_0x1bf293;this[_0x4ae2('0x4')]=_0x564d54;this[_0x4ae2('0x5')]=_0x5b6f4d;this[_0x4ae2('0x2')]=_0x1afc7a;this[_0x4ae2('0x3')][_0x4ae2('0x6')](this['handleRun']['bind'](this),this[_0x4ae2('0x7')]['bind'](this));this['squeue']['on'](_0x4ae2('0x8'),this[_0x4ae2('0x7')]['bind'](this));this[_0x4ae2('0x3')]['on'](_0x4ae2('0x9'),this[_0x4ae2('0xa')][_0x4ae2('0xb')](this));};Agent['prototype'][_0x4ae2('0x6')]=function(){this[_0x4ae2('0x3')][_0x4ae2('0x6')](this['handleRun'][_0x4ae2('0xb')](this),this[_0x4ae2('0x7')][_0x4ae2('0xb')](this));};Agent[_0x4ae2('0xc')][_0x4ae2('0xa')]=function(){this[_0x4ae2('0x7')](!![]);};Agent[_0x4ae2('0xc')][_0x4ae2('0xd')]=function(){logger[_0x4ae2('0xe')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this['agent']['id']);if(_[_0x4ae2('0xf')](this[_0x4ae2('0x5')]['agents'][this[_0x4ae2('0x4')]['id']])){logger[_0x4ae2('0xe')](_0x4ae2('0x10'),this[_0x4ae2('0x3')]['id'],this[_0x4ae2('0x4')]['id']);setTimeout(this[_0x4ae2('0x6')][_0x4ae2('0xb')](this),0x3e8);}else{if(this[_0x4ae2('0x2')][_0x4ae2('0x11')]||util[_0x4ae2('0x12')](this['squeue']['id'],this['realtime'][_0x4ae2('0x13')][this[_0x4ae2('0x4')]['id']],this['squeue'][_0x4ae2('0x14')],![])){this[_0x4ae2('0x5')][_0x4ae2('0x13')][this[_0x4ae2('0x4')]['id']][_0x4ae2('0x15')]=!![];this['realtime'][_0x4ae2('0x13')][this['agent']['id']]['busyQueue']=undefined;util[_0x4ae2('0x16')](this[_0x4ae2('0x5')],this[_0x4ae2('0x2')],this[_0x4ae2('0x4')],this[_0x4ae2('0x3')]['channel']);util[_0x4ae2('0x17')](this['notificationId'],this[_0x4ae2('0x3')]['id'],this[_0x4ae2('0x5')][_0x4ae2('0x13')][this['agent']['id']],null,this[_0x4ae2('0x2')]);util[_0x4ae2('0x18')](this[_0x4ae2('0x3')]['id'],this[_0x4ae2('0x5')][_0x4ae2('0x13')][this[_0x4ae2('0x4')]['id']],'RINGING'+(this['routing'][_0x4ae2('0x11')]?_0x4ae2('0x19'):''));}else{logger[_0x4ae2('0xe')](_0x4ae2('0x1a'),this[_0x4ae2('0x3')]['id'],this[_0x4ae2('0x4')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0x4ae2('0xc')]['handleTimeout']=function(_0x554cff){if(_['isNil'](this[_0x4ae2('0x5')][_0x4ae2('0x13')][this['agent']['id']])){return logger[_0x4ae2('0xe')](_0x4ae2('0x10'),this[_0x4ae2('0x3')]['id'],this[_0x4ae2('0x4')]['id']);}else{logger[_0x4ae2('0xe')](_0x4ae2('0x1b'),this[_0x4ae2('0x3')]['id'],this[_0x4ae2('0x4')]['id']);util[_0x4ae2('0x1c')](this[_0x4ae2('0x1d')],this[_0x4ae2('0x3')]['id'],this[_0x4ae2('0x5')][_0x4ae2('0x13')][this[_0x4ae2('0x4')]['id']],null,this[_0x4ae2('0x2')]);this[_0x4ae2('0x5')][_0x4ae2('0x13')][this['agent']['id']][_0x4ae2('0x15')]=![];this['realtime'][_0x4ae2('0x13')][this[_0x4ae2('0x4')]['id']]['busyQueue']=undefined;util[_0x4ae2('0x1e')](this[_0x4ae2('0x5')],this[_0x4ae2('0x2')],this[_0x4ae2('0x4')],this['squeue'][_0x4ae2('0x14')]);util[_0x4ae2('0x18')](this[_0x4ae2('0x3')]['id'],this[_0x4ae2('0x5')][_0x4ae2('0x13')][this[_0x4ae2('0x4')]['id']],_0x554cff?_0x4ae2('0x1f'):_0x4ae2('0x20'));}if(!_0x554cff){setTimeout(this[_0x4ae2('0x6')]['bind'](this),0x3e8);}};function agent(_0x4275d5,_0x47ee5d,_0xe34b4c,_0x41b0f4){return new Agent(_0x4275d5,_0x47ee5d,_0xe34b4c,_0x41b0f4);}module[_0x4ae2('0x21')]=agent; \ No newline at end of file +var _0x0c02=['squeue','agent','realtime','handleTimeout','bind','timeout','push','handleRun','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','TIMEOUT','exports','uuid','./util','routing','notificationId'];(function(_0x214185,_0x2d96bf){var _0x34abeb=function(_0x361251){while(--_0x361251){_0x214185['push'](_0x214185['shift']());}};_0x34abeb(++_0x2d96bf);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var uuid=require(_0x20c0('0x0'));var util=require(_0x20c0('0x1'));var logger=require('../../../../../config/logger')(_0x20c0('0x2'));var Agent=function(_0x5c8750,_0x454922,_0x6d03d0,_0x38022e){this[_0x20c0('0x3')]=uuid['v4']();this[_0x20c0('0x4')]=_0x5c8750;this[_0x20c0('0x5')]=_0x454922;this[_0x20c0('0x6')]=_0x6d03d0;this[_0x20c0('0x2')]=_0x38022e;this['squeue']['push'](this['handleRun']['bind'](this),this[_0x20c0('0x7')][_0x20c0('0x8')](this));this[_0x20c0('0x4')]['on'](_0x20c0('0x9'),this[_0x20c0('0x7')][_0x20c0('0x8')](this));this['squeue']['on']('drained',this['handleDrained']['bind'](this));};Agent['prototype'][_0x20c0('0xa')]=function(){this[_0x20c0('0x4')][_0x20c0('0xa')](this[_0x20c0('0xb')]['bind'](this),this[_0x20c0('0x7')]['bind'](this));};Agent['prototype'][_0x20c0('0xc')]=function(){this[_0x20c0('0x7')](!![]);};Agent[_0x20c0('0xd')][_0x20c0('0xb')]=function(){logger[_0x20c0('0xe')](_0x20c0('0xf'),this[_0x20c0('0x4')]['id'],this[_0x20c0('0x5')]['id']);if(_[_0x20c0('0x10')](this['realtime'][_0x20c0('0x11')][this[_0x20c0('0x5')]['id']])){logger[_0x20c0('0xe')](_0x20c0('0x12'),this[_0x20c0('0x4')]['id'],this[_0x20c0('0x5')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this['routing'][_0x20c0('0x13')]||util[_0x20c0('0x14')](this[_0x20c0('0x4')]['id'],this[_0x20c0('0x6')]['agents'][this[_0x20c0('0x5')]['id']],this[_0x20c0('0x4')][_0x20c0('0x15')],![])){this['realtime']['agents'][this[_0x20c0('0x5')]['id']][_0x20c0('0x16')]=!![];this[_0x20c0('0x6')][_0x20c0('0x11')][this[_0x20c0('0x5')]['id']]['busyQueue']=undefined;util[_0x20c0('0x17')](this[_0x20c0('0x6')],this[_0x20c0('0x2')],this[_0x20c0('0x5')],this['squeue'][_0x20c0('0x15')]);util[_0x20c0('0x18')](this[_0x20c0('0x3')],this[_0x20c0('0x4')]['id'],this[_0x20c0('0x6')][_0x20c0('0x11')][this[_0x20c0('0x5')]['id']],null,this['routing']);util[_0x20c0('0x19')](this[_0x20c0('0x4')]['id'],this[_0x20c0('0x6')][_0x20c0('0x11')][this[_0x20c0('0x5')]['id']],_0x20c0('0x1a')+(this['routing']['forcedOwnership']?_0x20c0('0x1b'):''));}else{logger[_0x20c0('0xe')](_0x20c0('0x1c'),this['squeue']['id'],this[_0x20c0('0x5')]['id']);setTimeout(this[_0x20c0('0xa')][_0x20c0('0x8')](this),0x3e8);}}};Agent[_0x20c0('0xd')]['handleTimeout']=function(_0x49b738){if(_[_0x20c0('0x10')](this[_0x20c0('0x6')][_0x20c0('0x11')][this[_0x20c0('0x5')]['id']])){return logger[_0x20c0('0xe')](_0x20c0('0x12'),this[_0x20c0('0x4')]['id'],this[_0x20c0('0x5')]['id']);}else{logger[_0x20c0('0xe')](_0x20c0('0x1d'),this[_0x20c0('0x4')]['id'],this[_0x20c0('0x5')]['id']);util[_0x20c0('0x1e')](this[_0x20c0('0x3')],this['squeue']['id'],this[_0x20c0('0x6')][_0x20c0('0x11')][this[_0x20c0('0x5')]['id']],null,this[_0x20c0('0x2')]);this['realtime'][_0x20c0('0x11')][this[_0x20c0('0x5')]['id']][_0x20c0('0x16')]=![];this[_0x20c0('0x6')][_0x20c0('0x11')][this['agent']['id']][_0x20c0('0x1f')]=undefined;util['removeWaitingNotification'](this['realtime'],this[_0x20c0('0x2')],this[_0x20c0('0x5')],this[_0x20c0('0x4')][_0x20c0('0x15')]);util[_0x20c0('0x19')](this[_0x20c0('0x4')]['id'],this[_0x20c0('0x6')]['agents'][this['agent']['id']],_0x49b738?'STOP':_0x20c0('0x20'));}if(!_0x49b738){setTimeout(this[_0x20c0('0xa')]['bind'](this),0x3e8);}};function agent(_0x346a04,_0x20d6f3,_0x550d2c,_0x5a7641){return new Agent(_0x346a04,_0x20d6f3,_0x550d2c,_0x5a7641);}module[_0x20c0('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 00fdd97..e58813e 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 _0x9fe6=['Agents','length','isAgentAvailable','agents','writeLog','RINGING','busy','routing','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','debug','hideNotification','STOP','TIMEOUT','busyQueue','removeWaitingNotification','channel','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','queue','realtime','push','bind','handleTimeout','timeout','drained','handleDrained','handleRun','prototype','isNil'];(function(_0x6989d3,_0x4ccb20){var _0x540e12=function(_0x33bcd0){while(--_0x33bcd0){_0x6989d3['push'](_0x6989d3['shift']());}};_0x540e12(++_0x4ccb20);}(_0x9fe6,0x193));var _0x69fe=function(_0x24345c,_0x3bc0bb){_0x24345c=_0x24345c-0x0;var _0x2b80c3=_0x9fe6[_0x24345c];return _0x2b80c3;};'use strict';var _=require(_0x69fe('0x0'));var uuid=require(_0x69fe('0x1'));var util=require(_0x69fe('0x2'));var logger=require(_0x69fe('0x3'))('routing');var Beepall=function(_0x11b6ec,_0x485cb7,_0x391a11,_0x4e6c36){this[_0x69fe('0x4')]=uuid['v4']();this[_0x69fe('0x5')]=_0x11b6ec;this[_0x69fe('0x6')]=_0x485cb7;this[_0x69fe('0x7')]=_0x391a11;this['routing']=_0x4e6c36;this[_0x69fe('0x5')][_0x69fe('0x8')](this['handleRun'][_0x69fe('0x9')](this),this[_0x69fe('0xa')]['bind'](this));this[_0x69fe('0x5')]['on'](_0x69fe('0xb'),this[_0x69fe('0xa')][_0x69fe('0x9')](this));this['squeue']['on'](_0x69fe('0xc'),this[_0x69fe('0xd')][_0x69fe('0x9')](this));};Beepall['prototype'][_0x69fe('0x8')]=function(){this[_0x69fe('0x5')]['push'](this[_0x69fe('0xe')][_0x69fe('0x9')](this),this[_0x69fe('0xa')][_0x69fe('0x9')](this));};Beepall[_0x69fe('0xf')][_0x69fe('0xd')]=function(){this[_0x69fe('0xa')](!![]);};Beepall['prototype']['handleRun']=function(){var _0x29c9e2=!![];if(!_['isNil'](this[_0x69fe('0x6')])&&!_[_0x69fe('0x10')](this[_0x69fe('0x6')]['Agents'])&&this[_0x69fe('0x6')][_0x69fe('0x11')][_0x69fe('0x12')]>0x0){for(var _0x2b19b7=0x0,_0x4f02fb;_0x2b19b70x0){for(var _0x36d779=0x0,_0x594052;_0x36d7790x0&&_0x2fd6e9[_0x522d09+_0x0768('0x24')]>=_0x2fd6e9[_0x522d09+'Capacity']){writeLog(_0x477f24,_0x2fd6e9,_0x522d09[_0x0768('0x25')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x0768('0x26')]=function(_0x1c7ae5,_0x1163c0,_0x5662a2,_0x360212,_0x237b7a){return sendNotification(!![],_0x1c7ae5,_0x1163c0,_0x5662a2,_0x360212,_0x237b7a);};exports['hideNotification']=function(_0x210d6c,_0x562e4d,_0x340453,_0x186c2d,_0x8bda83){return sendNotification(![],_0x210d6c,_0x562e4d,_0x340453,_0x186c2d,_0x8bda83);};exports['checkWaitingNotifications']=function(_0x3f77df,_0x3781c1,_0x48b1d5){var _0x195f0c=_0x3781c1[_0x0768('0x27')][_0x0768('0x28')];if(!_0x195f0c&&_0x48b1d5){_0x195f0c=_0x48b1d5['id'];}var _0x327540=_[_0x0768('0x29')](_0x3f77df[_0x3781c1['channel']+_0x0768('0x2a')],function(_0x135f1b){var _0x21d30f=_['capitalize'](_0x3781c1[_0x0768('0x2b')])+_0x0768('0x2c');return _0x135f1b[_0x21d30f]===_0x3781c1[_0x0768('0x27')]['id'];});if(!_0x327540&&_0x195f0c){_0x327540=_[_0x0768('0x29')](_0x3f77df[_0x0768('0x2d')][_0x195f0c][_0x3781c1['channel']+_0x0768('0x2e')],function(_0x126979){return _0x126979['id']===_0x3781c1[_0x0768('0x27')]['id'];});}return _0x327540;};exports[_0x0768('0x2f')]=function(_0x2d15cf,_0x1dcd8b,_0x2d7ae7,_0x3ef5d5){_0x2d15cf[_0x0768('0x2d')][_0x2d7ae7['id']][_0x3ef5d5+_0x0768('0x2e')][_0x1dcd8b[_0x0768('0x30')]['id']]={'id':_0x1dcd8b[_0x0768('0x27')]['id']};};exports[_0x0768('0x31')]=function(_0x2004bb,_0x56f86b,_0x59d4b2,_0x2a7be9){delete _0x2004bb[_0x0768('0x2d')][_0x59d4b2['id']][_0x2a7be9+'WaitingInteractions'][_0x56f86b['message']['id']];};exports[_0x0768('0x32')]=writeLog; \ No newline at end of file +var _0x605f=['../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','format','user:%s','name','emit','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','notification:%s','save','remove','debug','isAgentAvailable','busy','Pause','Capacity','hasOwnProperty','CurrentCapacity','showNotification','hideNotification','checkWaitingNotifications','interaction','some','channel','QueuesWaitingInteractions','agents','WaitingInteractions','message','writeLog','lodash','util','../utils','ioredis'];(function(_0x50e6c6,_0x1507e5){var _0x1858a3=function(_0x30fec8){while(--_0x30fec8){_0x50e6c6['push'](_0x50e6c6['shift']());}};_0x1858a3(++_0x1507e5);}(_0x605f,0x8f));var _0xf605=function(_0x1f4c35,_0x4cfd0d){_0x1f4c35=_0x1f4c35-0x0;var _0x5ddeba=_0x605f[_0x1f4c35];return _0x5ddeba;};'use strict';var _=require(_0xf605('0x0'));var util=require(_0xf605('0x1'));var utils=require(_0xf605('0x2'));var Redis=require(_0xf605('0x3'));var config=require(_0xf605('0x4'));var logger=require(_0xf605('0x5'))(_0xf605('0x6'));config[_0xf605('0x7')]=_[_0xf605('0x8')](config[_0xf605('0x7')],{'host':_0xf605('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function sendNotification(_0x135542,_0xb52deb,_0x4e081a,_0x457cfc,_0x34c577,_0x3d5130){io['to'](util[_0xf605('0xa')](_0xf605('0xb'),_0x457cfc[_0xf605('0xc')]))[_0xf605('0xd')](_0xf605('0xe'),_0x457cfc);var _0x14b07=_0x3d5130||{};var _0x1dba1c=_0x4e081a[_0xf605('0xf')]('.');var _0x2d8987={'uniqueid':_0xb52deb,'channel':_0x1dba1c[0x0],'id':_0x1dba1c[0x1],'title':_0x1dba1c[0x0]+_0xf605('0x10'),'interactionId':_0x1dba1c[0x2],'queue':_0x34c577?_0x34c577[_0xf605('0xc')]:null,'sound':_0x14b07[_0xf605('0x11')][_0xf605('0x12')],'shake':_0x14b07[_0xf605('0x11')][_0xf605('0x13')]};try{if(!_0x14b07[_0xf605('0x14')]){_0x14b07[_0xf605('0x14')]={};}if(_0x34c577){_0x14b07[_0xf605('0x14')][_0xf605('0x15')]=_0x34c577;}else if(_0x14b07[_0xf605('0x14')][_0xf605('0x15')]){delete _0x14b07['body'][_0xf605('0x15')];}_0x2d8987[_0xf605('0x16')]=utils[_0xf605('0x17')](_0x14b07['account'][_0xf605('0x18')],_0x14b07);}catch(_0x59a9d5){_0x2d8987[_0xf605('0x16')]=_0xf605('0x19');logger[_0xf605('0x1a')](util[_0xf605('0xa')](_0xf605('0x1b'),_0xb52deb,_0x59a9d5['message']));}io['to'](util[_0xf605('0xa')](_0xf605('0xb'),_0x457cfc[_0xf605('0xc')]))[_0xf605('0xd')](util[_0xf605('0xa')](_0xf605('0x1c'),_0x135542?_0xf605('0x1d'):_0xf605('0x1e')),_0x2d8987);}function writeLog(_0x561bda,_0x1ca439,_0x5561b5){return logger[_0xf605('0x1f')](util[_0xf605('0xa')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x561bda,_0x1ca439[_0xf605('0xc')],_0x5561b5));}exports[_0xf605('0x20')]=function(_0x262316,_0x5507f7,_0x491c36,_0x101992){if(_0x5507f7[_0xf605('0x21')]){writeLog(_0x262316,_0x5507f7,'BUSY');return![];}if(!_0x5507f7['online']){writeLog(_0x262316,_0x5507f7,'OFFLINE');return![];}if(_0x5507f7[_0x491c36+_0xf605('0x22')]){writeLog(_0x262316,_0x5507f7,'PAUSE');return![];}if(_0x101992&&_0x5507f7['hasOwnProperty'](_0x491c36+_0xf605('0x23'))&&_0x5507f7[_0xf605('0x24')](_0x491c36+_0xf605('0x25'))){if(_0x5507f7[_0x491c36+_0xf605('0x23')]>0x0&&_0x5507f7[_0x491c36+_0xf605('0x25')]>=_0x5507f7[_0x491c36+_0xf605('0x23')]){writeLog(_0x262316,_0x5507f7,_0x491c36['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xf605('0x26')]=function(_0x20ddf4,_0x2ff007,_0x33bc8b,_0x702e89,_0x5a780e){return sendNotification(!![],_0x20ddf4,_0x2ff007,_0x33bc8b,_0x702e89,_0x5a780e);};exports[_0xf605('0x27')]=function(_0x54d5a8,_0x36aa22,_0x30b9a2,_0x162a4c,_0x43bf4c){return sendNotification(![],_0x54d5a8,_0x36aa22,_0x30b9a2,_0x162a4c,_0x43bf4c);};exports[_0xf605('0x28')]=function(_0x316a4a,_0x5b0dd8,_0x3d6dab){var _0x23ef24=_0x5b0dd8[_0xf605('0x29')]['UserId'];if(!_0x23ef24&&_0x3d6dab){_0x23ef24=_0x3d6dab['id'];}var _0x5063b6=_[_0xf605('0x2a')](_0x316a4a[_0x5b0dd8[_0xf605('0x2b')]+_0xf605('0x2c')],function(_0x17f643){var _0x32b17a=_['capitalize'](_0x5b0dd8[_0xf605('0x2b')])+'InteractionId';return _0x17f643[_0x32b17a]===_0x5b0dd8[_0xf605('0x29')]['id'];});if(!_0x5063b6&&_0x23ef24){_0x5063b6=_[_0xf605('0x2a')](_0x316a4a[_0xf605('0x2d')][_0x23ef24][_0x5b0dd8[_0xf605('0x2b')]+_0xf605('0x2e')],function(_0x5b7916){return _0x5b7916['id']===_0x5b0dd8[_0xf605('0x29')]['id'];});}return _0x5063b6;};exports['saveWaitingNotification']=function(_0x55475b,_0x1b93a3,_0x2c2a43,_0x5a8db3){_0x55475b['agents'][_0x2c2a43['id']][_0x5a8db3+_0xf605('0x2e')][_0x1b93a3[_0xf605('0x2f')]['id']]={'id':_0x1b93a3[_0xf605('0x29')]['id']};};exports['removeWaitingNotification']=function(_0x449010,_0x1d45d7,_0x36c9,_0x5aa55b){delete _0x449010[_0xf605('0x2d')][_0x36c9['id']][_0x5aa55b+'WaitingInteractions'][_0x1d45d7[_0xf605('0x2f')]['id']];};exports[_0xf605('0x30')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 2a7e119..f4cce39 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 _0x4ce7=['body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','string','consequence','length','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable'];(function(_0x4a3617,_0x2a1efe){var _0x45d2d6=function(_0x5f379b){while(--_0x5f379b){_0x4a3617['push'](_0x4a3617['shift']());}};_0x45d2d6(++_0x2a1efe);}(_0x4ce7,0x1d2));var _0x74ce=function(_0x260b7c,_0x61fcb){_0x260b7c=_0x260b7c-0x0;var _0x128ac5=_0x4ce7[_0x260b7c];return _0x128ac5;};'use strict';var schema=require(_0x74ce('0x0'));var sh=require(_0x74ce('0x1'));var _=require(_0x74ce('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':_0x74ce('0x3'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x74ce('0x4')]=function(_0x26d1f7,_0x3c8c9e){return function(_0x25bc5a){try{var _0x5cd040={'command':_0x3c8c9e[0x0]};var _0x42e5a4=system[_0x74ce('0x0')](_0x5cd040,{'typecast':!![]});if(_0x42e5a4[_0x74ce('0x5')]){logger['error'](_0x74ce('0x6'),_0x26d1f7,_[_0x74ce('0x7')](_0x42e5a4,_0x74ce('0x8'))[_0x74ce('0x9')](',\x20'));logger[_0x74ce('0xa')](_0x74ce('0xb'),_0x26d1f7);_0x25bc5a['next']();}else{var _0x3611a5=this;var _0xb7ece3=utils['getMustacheRender'](_0x3c8c9e[0x0],this);logger['info'](_0x74ce('0xc'),_0x26d1f7,_0xb7ece3);sh[_0x74ce('0xd')](_[_0x74ce('0xe')](_0xb7ece3),function(_0x2c18e8,_0x86405f){logger[_0x74ce('0xa')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x26d1f7,_0x2c18e8);if(_0x2c18e8==0x0){var _0xed0b40=_0x86405f['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x74ce('0xf')](_0x3c8c9e[0x1])||_[_0x74ce('0x10')](_0x3c8c9e[0x1])){logger[_0x74ce('0xa')](_0x74ce('0x11'),_0x26d1f7);_0x3611a5[_0x74ce('0x12')][_0x3c8c9e[0x1]]=_0xed0b40;}else{logger[_0x74ce('0xa')](_0x74ce('0x13'),_0x26d1f7,_0x3c8c9e[0x1],_0xed0b40);_0x3611a5[_0x74ce('0x12')][_0x3c8c9e[0x1]]=_0xed0b40;}}_0x25bc5a['next']();});}}catch(_0x1857ec){logger['error'](_0x74ce('0x6'),_0x26d1f7,_[_0x74ce('0x14')](_0x1857ec)?JSON[_0x74ce('0x15')](_0x1857ec):_0x1857ec);logger[_0x74ce('0xa')](_0x74ce('0xb'),_0x26d1f7);_0x25bc5a['next']();}};}; \ No newline at end of file +var _0x66fa=['validate','shelljs','lodash','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','error','isObject','stringify'];(function(_0x26842d,_0x3b95f8){var _0xdc9e6=function(_0x2accc6){while(--_0x2accc6){_0x26842d['push'](_0x26842d['shift']());}};_0xdc9e6(++_0x3b95f8);}(_0x66fa,0x168));var _0xa66f=function(_0x1074b5,_0x12cd2f){_0x1074b5=_0x1074b5-0x0;var _0xe9a707=_0x66fa[_0x1074b5];return _0xe9a707;};'use strict';var schema=require(_0xa66f('0x0'));var sh=require(_0xa66f('0x1'));var _=require(_0xa66f('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xa66f('0x3'));var system=schema({'command':{'type':_0xa66f('0x4'),'required':!![],'message':_0xa66f('0x5')}});exports[_0xa66f('0x6')]=function(_0x2143e6,_0x383512){return function(_0x342dd9){try{var _0x4532ee={'command':_0x383512[0x0]};var _0x25a7a0=system[_0xa66f('0x0')](_0x4532ee,{'typecast':!![]});if(_0x25a7a0[_0xa66f('0x7')]){logger['error'](_0xa66f('0x8'),_0x2143e6,_['map'](_0x25a7a0,_0xa66f('0x9'))[_0xa66f('0xa')](',\x20'));logger['info'](_0xa66f('0xb'),_0x2143e6);_0x342dd9[_0xa66f('0xc')]();}else{var _0xd309dc=this;var _0x3800d9=utils[_0xa66f('0xd')](_0x383512[0x0],this);logger[_0xa66f('0xe')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x2143e6,_0x3800d9);sh['exec'](_[_0xa66f('0xf')](_0x3800d9),function(_0x59f8f8,_0x45dbb4){logger[_0xa66f('0xe')](_0xa66f('0x10'),_0x2143e6,_0x59f8f8);if(_0x59f8f8==0x0){var _0x4b0dad=_0x45dbb4[_0xa66f('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0xa66f('0x12')](_0x383512[0x1])||_['isEmpty'](_0x383512[0x1])){logger[_0xa66f('0xe')](_0xa66f('0x13'),_0x2143e6);_0xd309dc[_0xa66f('0x14')][_0x383512[0x1]]=_0x4b0dad;}else{logger[_0xa66f('0xe')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x2143e6,_0x383512[0x1],_0x4b0dad);_0xd309dc[_0xa66f('0x14')][_0x383512[0x1]]=_0x4b0dad;}}_0x342dd9[_0xa66f('0xc')]();});}}catch(_0x5685c4){logger[_0xa66f('0x15')](_0xa66f('0x8'),_0x2143e6,_[_0xa66f('0x16')](_0x5685c4)?JSON[_0xa66f('0x17')](_0x5685c4):_0x5685c4);logger[_0xa66f('0xe')](_0xa66f('0xb'),_0x2143e6);_0x342dd9['next']();}};}; \ 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 c9ad2a9..ecbeac1 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 _0x1068=['../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','message','join','info','next','channel','Interaction','addTags','interaction','stringify','finally','isObject','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0x4d4cc6,_0x1c1732){var _0x1599d8=function(_0x811070){while(--_0x811070){_0x4d4cc6['push'](_0x4d4cc6['shift']());}};_0x1599d8(++_0x1c1732);}(_0x1068,0xaf));var _0x8106=function(_0x5cbe51,_0x4d5b11){_0x5cbe51=_0x5cbe51-0x0;var _0x3f5b79=_0x1068[_0x5cbe51];return _0x3f5b79;};'use strict';var schema=require(_0x8106('0x0'));var _=require(_0x8106('0x1'));var rpc={'chatInteraction':require(_0x8106('0x2')),'openchannelInteraction':require(_0x8106('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x8106('0x4')),'faxInteraction':require(_0x8106('0x5')),'whatsappInteraction':require(_0x8106('0x6'))};var logger=require(_0x8106('0x7'))(_0x8106('0x8'));var tag=schema({'tag':{'type':_0x8106('0x9'),'required':!![],'message':_0x8106('0xa')}});exports[_0x8106('0xb')]=function(_0x1d1fc4,_0x3499b1,_0x376847,_0x2f125f){return function(_0x213c46){try{var _0x5f8182={'tag':_0x3499b1[0x0]};var _0x1197ae=tag['validate'](_0x5f8182,{'typecast':!![]});if(_0x1197ae['length']){logger[_0x8106('0xc')](_0x8106('0xd'),_0x1d1fc4,_['map'](_0x1197ae,_0x8106('0xe'))[_0x8106('0xf')](',\x20'));logger[_0x8106('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x1d1fc4);_0x213c46[_0x8106('0x11')]();}else{var _0x2a6c77={'ids':[_0x3499b1[0x0]]};if(rpc[_0x2f125f[_0x8106('0x12')]+_0x8106('0x13')]){rpc[_0x2f125f[_0x8106('0x12')]+'Interaction'][_0x8106('0x14')](_0x2f125f['interaction']['id'],_0x2a6c77)['then'](function(_0x4f94c4){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x1d1fc4,_0x3499b1[0x1],_0x2f125f[_0x8106('0x12')],_0x2f125f[_0x8106('0x15')]['id']);})['catch'](function(_0x224b00){logger['error'](_0x8106('0xd'),_0x1d1fc4,JSON[_0x8106('0x16')](_0x224b00));logger[_0x8106('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x1d1fc4);})[_0x8106('0x17')](function(){_0x213c46[_0x8106('0x11')]();});}}}catch(_0x2f4e00){logger[_0x8106('0xc')](_0x8106('0xd'),_0x1d1fc4,_[_0x8106('0x18')](_0x2f4e00)?JSON['stringify'](_0x2f4e00):_0x2f4e00);logger[_0x8106('0x10')](_0x8106('0x19'),_0x1d1fc4);_0x213c46['next']();}};}; \ No newline at end of file +var _0x029c=['../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','message','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','validate','lodash','../../rpc/chatInteraction'];(function(_0x2e249d,_0x41b7e7){var _0x1faa37=function(_0x1422b4){while(--_0x1422b4){_0x2e249d['push'](_0x2e249d['shift']());}};_0x1faa37(++_0x41b7e7);}(_0x029c,0x185));var _0xc029=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x029c[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0xc029('0x0'));var _=require(_0xc029('0x1'));var rpc={'chatInteraction':require(_0xc029('0x2')),'openchannelInteraction':require(_0xc029('0x3')),'smsInteraction':require(_0xc029('0x4')),'mailInteraction':require(_0xc029('0x5')),'faxInteraction':require(_0xc029('0x6')),'whatsappInteraction':require(_0xc029('0x7'))};var logger=require(_0xc029('0x8'))('routing');var tag=schema({'tag':{'type':_0xc029('0x9'),'required':!![],'message':_0xc029('0xa')}});exports[_0xc029('0xb')]=function(_0x347156,_0x1a40f9,_0x1b698d,_0x39276f){return function(_0x26f8d5){try{var _0x413f23={'tag':_0x1a40f9[0x0]};var _0x45efdf=tag['validate'](_0x413f23,{'typecast':!![]});if(_0x45efdf[_0xc029('0xc')]){logger[_0xc029('0xd')](_0xc029('0xe'),_0x347156,_['map'](_0x45efdf,_0xc029('0xf'))['join'](',\x20'));logger[_0xc029('0x10')](_0xc029('0x11'),_0x347156);_0x26f8d5[_0xc029('0x12')]();}else{var _0x1cff99={'ids':[_0x1a40f9[0x0]]};if(rpc[_0x39276f[_0xc029('0x13')]+_0xc029('0x14')]){rpc[_0x39276f['channel']+_0xc029('0x14')][_0xc029('0x15')](_0x39276f[_0xc029('0x16')]['id'],_0x1cff99)[_0xc029('0x17')](function(_0x58b411){logger[_0xc029('0x10')](_0xc029('0x18'),_0x347156,_0x1a40f9[0x1],_0x39276f[_0xc029('0x13')],_0x39276f[_0xc029('0x16')]['id']);})[_0xc029('0x19')](function(_0x40968d){logger[_0xc029('0xd')](_0xc029('0xe'),_0x347156,JSON[_0xc029('0x1a')](_0x40968d));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x347156);})[_0xc029('0x1b')](function(){_0x26f8d5[_0xc029('0x12')]();});}}}catch(_0x6cdcd5){logger[_0xc029('0xd')](_0xc029('0xe'),_0x347156,_['isObject'](_0x6cdcd5)?JSON[_0xc029('0x1a')](_0x6cdcd5):_0x6cdcd5);logger[_0xc029('0x10')](_0xc029('0x11'),_0x347156);_0x26f8d5[_0xc029('0x12')]();}};}; \ 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 e58472c..8813ed5 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 _0x8860=['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','request-promise','../../../../config/logger','lodash','consequence','replace','includes','push','urlOnAnswer','urlOnRing','?params=','jsonrpc','login','params','stringify','utf8','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data='];(function(_0x3b0a3a,_0x652681){var _0x5ab810=function(_0x6df18c){while(--_0x6df18c){_0x3b0a3a['push'](_0x3b0a3a['shift']());}};_0x5ab810(++_0x652681);}(_0x8860,0x118));var _0x0886=function(_0x9ea933,_0x565d76){_0x9ea933=_0x9ea933-0x0;var _0x4fdcd0=_0x8860[_0x9ea933];return _0x4fdcd0;};'use strict';var rp=require(_0x0886('0x0'));var logger=require(_0x0886('0x1'))('routing');var _=require(_0x0886('0x2'));var arr=[];exports[_0x0886('0x3')]=function(_0x55664e,_0x18293a){return function(_0x4832be){var _0x185466=_0x18293a[0xa];var _0x4daaf7=_0x18293a[0xb];var _0x325245=_0x18293a[0xc];var _0x5a8783=_0x18293a[0xd];var _0x2a2dde=_0x18293a[0xe];var _0x5ef01f=_0x18293a[0xf][_0x0886('0x4')](/\n/g,'\x20-\x20');var _0x365054=_0x18293a[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x0886('0x5')](_0x4daaf7)){arr[_0x0886('0x6')](_0x4daaf7);var _0x1d2d5c=_0x18293a[0x3];var _0x138461=_0x18293a[0x4];var _0x54ac1e=_0x18293a[0x1];var _0x227773=_0x18293a[0x0];var _0x200028={};_0x200028[_0x0886('0x7')]=_0x18293a[0x8]+'?params='+_0x325245+'|'+_0x185466+'|'+_0x5a8783+'|'+_0x4daaf7+'|'+_0x2a2dde;_0x200028[_0x0886('0x8')]=_0x18293a[0x7]+_0x0886('0x9')+_0x325245+'|'+_0x185466+'|'+_0x5a8783+'|'+_0x4daaf7+'|'+_0x2a2dde+'|'+_0x5ef01f+'|'+_0x365054;_0x200028['title']=_0x18293a[0x9];var _0x5c9d30={};_0x5c9d30[_0x0886('0xa')]='2.0';_0x5c9d30['method']=_0x0886('0xb');var _0x1ee72e=[];_0x1ee72e['push'](_0x18293a[0x2]);_0x1ee72e[_0x0886('0x6')](_0x18293a[0x5]);_0x1ee72e[_0x0886('0x6')](_0x18293a[0x6]);_0x5c9d30[_0x0886('0xc')]=_0x1ee72e;_0x5c9d30['id']=0x1;var _0x43626c=JSON[_0x0886('0xd')](_0x5c9d30);var _0x6e7f34={'encoding':_0x0886('0xe'),'method':_0x0886('0xf'),'timeout':0x2710,'url':_0x1d2d5c,'headers':{'Content-Type':_0x0886('0x10')},'body':_0x43626c};return rp(_0x6e7f34)[_0x0886('0x11')](function(_0x919421){const _0x560ba1=JSON[_0x0886('0x12')](_0x919421);if(!_0x560ba1[_0x0886('0x13')][_0x0886('0x14')]){throw new Error(_0x0886('0x15'));}var _0x593d3e=_0x4daaf7;var _0x1fd47e=_0x0886('0x16')+_0x54ac1e+_0x0886('0x17')+_0x227773+_0x0886('0x18')+_0x593d3e+_0x0886('0x19')+JSON[_0x0886('0xd')](_0x200028);var _0x55251d=_0x138461+'?'+_0x1fd47e;return rp(_0x55251d);})['then'](function(_0x315124){logger[_0x0886('0x1a')](_0x0886('0x1b'),_0x55664e,_0x315124);_0x4832be[_0x0886('0x1c')]();})[_0x0886('0x1d')](function(_0x549995){logger[_0x0886('0x1e')]('[%s][TVOX]\x20%s',_0x55664e,_[_0x0886('0x1f')](_0x549995)?JSON[_0x0886('0xd')](_0x549995):_0x549995);_0x4832be[_0x0886('0x1c')]();});}else{logger['info'](_0x0886('0x20'),_0x55664e);_0x4832be[_0x0886('0x21')]();}};}; \ No newline at end of file +var _0x21a5=['\x20-\x20','replace','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','stringify','application/json-rpc','then','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','info','stop','catch','error','[%s][TVOX]\x20%s','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing'];(function(_0x1b96d0,_0x578c05){var _0x3d6782=function(_0x38a4dc){while(--_0x38a4dc){_0x1b96d0['push'](_0x1b96d0['shift']());}};_0x3d6782(++_0x578c05);}(_0x21a5,0x1cd));var _0x521a=function(_0xdd827a,_0x482ad2){_0xdd827a=_0xdd827a-0x0;var _0x2f46f1=_0x21a5[_0xdd827a];return _0x2f46f1;};'use strict';var rp=require(_0x521a('0x0'));var logger=require(_0x521a('0x1'))(_0x521a('0x2'));var _=require('lodash');var arr=[];exports['consequence']=function(_0x4c943f,_0x617352){return function(_0x575ea4){var _0x2970c5=_0x617352[0xa];var _0x5a1cb1=_0x617352[0xb];var _0x3f3e26=_0x617352[0xc];var _0x45bc3a=_0x617352[0xd];var _0x5da57c=_0x617352[0xe];var _0x5127f8=_0x617352[0xf]['replace'](/\n/g,_0x521a('0x3'));var _0x9ba0d0=_0x617352[0x10][_0x521a('0x4')](/\n/g,'\x20');if(!arr[_0x521a('0x5')](_0x5a1cb1)){arr[_0x521a('0x6')](_0x5a1cb1);var _0xd38bff=_0x617352[0x3];var _0x5af60b=_0x617352[0x4];var _0x59c3b6=_0x617352[0x1];var _0x1537a8=_0x617352[0x0];var _0x4a1a5f={};_0x4a1a5f[_0x521a('0x7')]=_0x617352[0x8]+_0x521a('0x8')+_0x3f3e26+'|'+_0x2970c5+'|'+_0x45bc3a+'|'+_0x5a1cb1+'|'+_0x5da57c;_0x4a1a5f[_0x521a('0x9')]=_0x617352[0x7]+_0x521a('0x8')+_0x3f3e26+'|'+_0x2970c5+'|'+_0x45bc3a+'|'+_0x5a1cb1+'|'+_0x5da57c+'|'+_0x5127f8+'|'+_0x9ba0d0;_0x4a1a5f[_0x521a('0xa')]=_0x617352[0x9];var _0x8f7ff7={};_0x8f7ff7[_0x521a('0xb')]=_0x521a('0xc');_0x8f7ff7[_0x521a('0xd')]='login';var _0x206ac6=[];_0x206ac6[_0x521a('0x6')](_0x617352[0x2]);_0x206ac6['push'](_0x617352[0x5]);_0x206ac6['push'](_0x617352[0x6]);_0x8f7ff7['params']=_0x206ac6;_0x8f7ff7['id']=0x1;var _0xbbedca=JSON[_0x521a('0xe')](_0x8f7ff7);var _0x5eb7fd={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0xd38bff,'headers':{'Content-Type':_0x521a('0xf')},'body':_0xbbedca};return rp(_0x5eb7fd)[_0x521a('0x10')](function(_0xc1f0e2){const _0x50fdd1=JSON[_0x521a('0x11')](_0xc1f0e2);if(!_0x50fdd1[_0x521a('0x12')]['logged']){throw new Error(_0x521a('0x13'));}var _0x3e6c13=_0x5a1cb1;var _0x10ec43=_0x521a('0x14')+_0x59c3b6+_0x521a('0x15')+_0x1537a8+'&sessionId='+_0x3e6c13+'&data='+JSON[_0x521a('0xe')](_0x4a1a5f);var _0x13306f=_0x5af60b+'?'+_0x10ec43;return rp(_0x13306f);})['then'](function(_0x14974d){logger[_0x521a('0x16')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x4c943f,_0x14974d);_0x575ea4[_0x521a('0x17')]();})[_0x521a('0x18')](function(_0x5e8d89){logger[_0x521a('0x19')](_0x521a('0x1a'),_0x4c943f,_['isObject'](_0x5e8d89)?JSON[_0x521a('0xe')](_0x5e8d89):_0x5e8d89);_0x575ea4[_0x521a('0x17')]();});}else{logger[_0x521a('0x16')](_0x521a('0x1b'),_0x4c943f);_0x575ea4[_0x521a('0x1c')]();}};}; \ 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 621b156..4290dd7 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x8cd850,_0x334088){var _0x81072e=function(_0x150bee){while(--_0x150bee){_0x8cd850['push'](_0x8cd850['shift']());}};_0x81072e(++_0x334088);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0xc46589,_0x46874e){var _0x4a4c27=function(_0x5da0b9){while(--_0x5da0b9){_0xc46589['push'](_0xc46589['shift']());}};_0x4a4c27(++_0x46874e);}(_0xe706,0xa3));var _0x6e70=function(_0x2a0183,_0x3fc93c){_0x2a0183=_0x2a0183-0x0;var _0x158c3a=_0xe706[_0x2a0183];return _0x158c3a;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 84d8a71..0973c7f 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 _0x7faf=['whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','bluebird','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','mail','push','slice','dialogflow','split','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','stringify','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','agent','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues'];(function(_0x4cd294,_0x384785){var _0x21971e=function(_0x226fd1){while(--_0x226fd1){_0x4cd294['push'](_0x4cd294['shift']());}};_0x21971e(++_0x384785);}(_0x7faf,0x145));var _0xf7fa=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x7faf[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xf7fa('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xf7fa('0x1'));var utils=require('./applications/utils');var sUtils=require(_0xf7fa('0x2'));var logger=require(_0xf7fa('0x3'))(_0xf7fa('0x4'));var rpc={'openchannelQueueReport':require(_0xf7fa('0x5')),'mailQueueReport':require(_0xf7fa('0x6')),'chatQueueReport':require(_0xf7fa('0x7')),'smsQueueReport':require(_0xf7fa('0x8')),'faxQueueReport':require(_0xf7fa('0x9')),'whatsappQueueReport':require(_0xf7fa('0xa'))};var RuleEngine=require(_0xf7fa('0xb'));function getId(_0x55a702,_0x4cfb60,_0x14480c){return util[_0xf7fa('0xc')](_0xf7fa('0xd'),_0x55a702,_0x4cfb60||0x0,_0x14480c||0x0);}function getIntervals(_0x5ec896,_0x5f43a9){var _0x20fa39=[];if(!_['isNil'](_0x5f43a9[_0xf7fa('0xe')])&&!_['isNil'](_0x5ec896[_0x5f43a9[_0xf7fa('0xe')]])&&!_[_0xf7fa('0xf')](_0x5ec896[_0x5f43a9[_0xf7fa('0xe')]][_0xf7fa('0x10')])){_0x20fa39=_[_0xf7fa('0x11')](_0x5ec896[_0x5f43a9[_0xf7fa('0xe')]][_0xf7fa('0x10')],'interval');}else if(!_[_0xf7fa('0xf')](_0x5f43a9['interval'])){_0x20fa39=[_0x5f43a9[_0xf7fa('0x12')]];}return _0x20fa39;}exports[_0xf7fa('0x13')]=function(_0x57558f){_0x57558f[_0xf7fa('0x14')]={};return new BPromise(function(_0x4b16da,_0x10faf8){var _0x1b540d={'Start':function(_0x3062fc){var _0x4dea72=this;return new Promise(function(_0x5b3843,_0x27285a){if(_0x3062fc){try{var _0x59e0ac=[];var _0x15185e=getId(_0x3062fc[_0xf7fa('0x15')],_0x3062fc[_0xf7fa('0x16')]?_0x3062fc[_0xf7fa('0x16')]['id']:0x0,_0x3062fc[_0xf7fa('0x17')]?_0x3062fc[_0xf7fa('0x17')]['id']:0x0);var _0x1cc362=sUtils[_0xf7fa('0x18')](_0x57558f,_0x3062fc);if(!_0x1cc362&&_0x3062fc['applications']&&_['isArray'](_0x3062fc[_0xf7fa('0x19')])&&_0x3062fc[_0xf7fa('0x19')][_0xf7fa('0x1a')]){for(var _0x116675=0x0;_0x116675<_0x3062fc[_0xf7fa('0x19')]['length'];_0x116675+=0x1){var _0x22eadd=_0x3062fc[_0xf7fa('0x19')][_0x116675];if(fs[_0xf7fa('0x1b')](path[_0xf7fa('0x1c')](__dirname,_0xf7fa('0x19'),_0x22eadd[_0xf7fa('0x1d')]+_0xf7fa('0x1e')))){var _0x3373b7=[];switch(_0x22eadd[_0xf7fa('0x1d')][_0xf7fa('0x1f')]()){case _0xf7fa('0x20'):var _0x43bcda=_0x22eadd[_0xf7fa('0x21')]['split'](',');if(_0x3062fc['channel']===_0xf7fa('0x22')){_0x3373b7[_0xf7fa('0x23')](_0x43bcda[0x0]);_0x3373b7[_0xf7fa('0x23')](_0x43bcda[0x1]);_0x3373b7[_0xf7fa('0x23')](_0x43bcda['slice'](0x2,_0x43bcda['length'])[_0xf7fa('0x1c')](','));}else{_0x3373b7['push'](_0x43bcda[0x0]);_0x3373b7['push'](_0x43bcda[_0xf7fa('0x24')](0x1,_0x43bcda['length'])[_0xf7fa('0x1c')](','));}break;case _0xf7fa('0x25'):var _0x44a813=_0x22eadd[_0xf7fa('0x21')][_0xf7fa('0x26')](',');_0x3373b7[_0xf7fa('0x23')](_0x44a813[0x0]);_0x3373b7[_0xf7fa('0x23')](_0x44a813[0x1]);_0x3373b7[_0xf7fa('0x23')](_0x44a813['slice'](0x2,_0x44a813[_0xf7fa('0x1a')])[_0xf7fa('0x1c')](','));break;case _0xf7fa('0x27'):var _0x12deb5=_0x22eadd[_0xf7fa('0x21')]['split'](',');_0x3373b7[_0xf7fa('0x23')](_0x12deb5[0x0]);_0x3373b7[_0xf7fa('0x23')](_0x12deb5[0x1]);_0x3373b7[_0xf7fa('0x23')](_0x12deb5[0x2]);_0x3373b7['push'](_0x12deb5[0x3]);_0x3373b7[_0xf7fa('0x23')](_0x12deb5[_0xf7fa('0x24')](0x4,_0x12deb5[_0xf7fa('0x1a')])['join'](','));break;case _0xf7fa('0x28'):var _0x5486da=_0x22eadd[_0xf7fa('0x21')][_0xf7fa('0x26')](',');_0x3373b7[_0xf7fa('0x23')](_0x5486da[0x0]);_0x3373b7[_0xf7fa('0x23')](_0x5486da[0x1]);_0x3373b7['push'](_0x5486da[0x2]);_0x3373b7[_0xf7fa('0x23')](_0x5486da[0x3]);_0x3373b7[_0xf7fa('0x23')](_0x5486da[_0xf7fa('0x24')](0x4,_0x5486da[_0xf7fa('0x1a')])[_0xf7fa('0x1c')](','));break;case'message':_0x3373b7['push'](_0x22eadd['appdata']);break;case _0xf7fa('0x29'):_0x3373b7[_0xf7fa('0x23')](_0x22eadd[_0xf7fa('0x2a')]);_0x3373b7[_0xf7fa('0x23')](_0x22eadd[_0xf7fa('0x21')]);break;case _0xf7fa('0x2b'):var _0x1a1bf0=utils[_0xf7fa('0x2c')](_0x3062fc[_0xf7fa('0x2d')][_0xf7fa('0x2e')],_0x3062fc);var _0xe5131a=_0x22eadd['appdata'][_0xf7fa('0x26')](',');_0x3373b7['push'](_0xe5131a[0x0]);_0x3373b7[_0xf7fa('0x23')](_0xe5131a[0x1]);_0x3373b7[_0xf7fa('0x23')](_0xe5131a[0x2]);_0x3373b7[_0xf7fa('0x23')](_0xe5131a[0x3]);_0x3373b7[_0xf7fa('0x23')](_0xe5131a[0x4]);_0x3373b7['push'](_0xe5131a[0x5]);_0x3373b7['push'](_0xe5131a[0x6]);_0x3373b7[_0xf7fa('0x23')](_0xe5131a[0x7]);_0x3373b7[_0xf7fa('0x23')](_0xe5131a[0x8]);_0x3373b7[_0xf7fa('0x23')](_0xe5131a[0x9]);_0x3373b7[_0xf7fa('0x23')](_0xe5131a[0xa]);_0x3373b7['push'](_0x3062fc[_0xf7fa('0x17')]['id']);_0x3373b7[_0xf7fa('0x23')](_0x3062fc[_0xf7fa('0x16')]['id']);_0x3373b7[_0xf7fa('0x23')](_0x22eadd[_0xf7fa('0x2f')]);_0x3373b7[_0xf7fa('0x23')](_0x3062fc[_0xf7fa('0x17')][_0xf7fa('0x30')]);_0x3373b7[_0xf7fa('0x23')](_0x3062fc[_0xf7fa('0x31')]['body']);_0x3373b7[_0xf7fa('0x23')](_0x1a1bf0);break;default:_0x3373b7=_[_0xf7fa('0xf')](_0x22eadd[_0xf7fa('0x21')])?[]:_0x22eadd[_0xf7fa('0x21')][_0xf7fa('0x26')](',');}var _0x119a79={'id':util[_0xf7fa('0xc')](_0xf7fa('0x32'),_0x15185e,_0x22eadd['id'],_0x22eadd['app']),'condition':require(_0xf7fa('0x33'))[_0xf7fa('0x34')](_0x15185e,getIntervals(_0x57558f[_0xf7fa('0x35')],_0x22eadd),_0x57558f),'consequence':require(_0xf7fa('0x36')+_0x22eadd[_0xf7fa('0x1d')])['consequence'](_0x15185e,_0x3373b7,_0x57558f,_0x3062fc),'p':_0x22eadd['priority']||0x0};logger[_0xf7fa('0x37')](_0xf7fa('0x38'),_0x119a79['id'],_0xf7fa('0x39'),getIntervals(_0x57558f[_0xf7fa('0x35')],_0x22eadd)[_0xf7fa('0x1c')](_0xf7fa('0x3a')));_0x59e0ac[_0xf7fa('0x23')](_0x119a79);}else{logger[_0xf7fa('0x3b')](_0xf7fa('0x3c'),path[_0xf7fa('0x1c')](__dirname,_0xf7fa('0x19'),_0x22eadd[_0xf7fa('0x1d')]+_0xf7fa('0x1e')));}}_0x57558f[_0xf7fa('0x14')][_0x15185e]=new RuleEngine(_0x59e0ac);_0x57558f[_0xf7fa('0x14')][_0x15185e]['execute'](_0x3062fc,function(_0x5c6217){logger[_0xf7fa('0x37')](_0xf7fa('0x3d'),JSON[_0xf7fa('0x3e')](_0x5c6217['matchPath']));if(_0x57558f[_0xf7fa('0x14')][_0x15185e]){_0x57558f[_0xf7fa('0x14')][_0x15185e][_0xf7fa('0x3f')](_0xf7fa('0x40'));}});return _0x5b3843({'code':0xc8,'message':_0x3062fc});}else{if(_0x1cc362){logger[_0xf7fa('0x37')](util[_0xf7fa('0xc')](_0xf7fa('0x41'),_0x15185e));}else{logger[_0xf7fa('0x37')](_0xf7fa('0x42'));}return _0x5b3843({'code':0xc8,'message':_0x3062fc});}}catch(_0x20db7d){logger[_0xf7fa('0x3b')](_0x20db7d[_0xf7fa('0x43')]);return _0x27285a(_0x4dea72[_0xf7fa('0x3b')](0x1f4,_0x20db7d));}}return _0x27285a('routing\x20is\x20empty');});},'AcceptMessage':function(_0x407306){var _0x213409=this;return new Promise(function(_0x54f272,_0x391855){if(_0x407306[_0xf7fa('0x44')]&&_0x407306[_0xf7fa('0x44')]['id']){if(_0x57558f[_0xf7fa('0x45')][_0x407306[_0xf7fa('0x44')]['id']]){_0x57558f[_0xf7fa('0x45')][_0x407306[_0xf7fa('0x44')]['id']]['busy']=![];_0x57558f[_0xf7fa('0x45')][_0x407306[_0xf7fa('0x44')]['id']][_0xf7fa('0x46')]=undefined;}}if(_0x407306[_0xf7fa('0x16')]&&_0x407306['message']['id']){try{var _0x26f38d=getId(_0x407306[_0xf7fa('0x15')],_0x407306[_0xf7fa('0x16')]?_0x407306[_0xf7fa('0x16')]['id']:0x0,_0x407306[_0xf7fa('0x17')]?_0x407306[_0xf7fa('0x17')]['id']:0x0);if(_0x57558f[_0xf7fa('0x14')][_0x26f38d]){_0x57558f[_0xf7fa('0x14')][_0x26f38d][_0xf7fa('0x3f')](_0xf7fa('0x47'));if(rpc[_0x407306[_0xf7fa('0x15')]+_0xf7fa('0x48')]){rpc[_0x407306[_0xf7fa('0x15')]+_0xf7fa('0x48')][_0xf7fa('0x49')](_0x26f38d,{'UserId':_0x407306[_0xf7fa('0x16')][_0xf7fa('0x4a')]})[_0xf7fa('0x4b')](function(){logger[_0xf7fa('0x3b')](_0xf7fa('0x4c'));});}}return _0x54f272({'code':0xc8,'message':_0x407306});}catch(_0x1fcbe4){logger[_0xf7fa('0x3b')](_0x1fcbe4[_0xf7fa('0x43')]);return _0x391855(_0x213409[_0xf7fa('0x3b')](0x1f4,_0x1fcbe4));}}logger[_0xf7fa('0x3b')](_0xf7fa('0x4d'));return _0x391855(_0x213409[_0xf7fa('0x3b')](0x1f4,_0xf7fa('0x4d')));});},'RejectMessage':function(_0x5f3e3b){var _0x33b3e4=this;return new Promise(function(_0xfd05d6,_0x238a5e){if(_0x5f3e3b['agent']&&_0x5f3e3b[_0xf7fa('0x44')]['id']){try{if(_0x57558f['agents'][_0x5f3e3b[_0xf7fa('0x44')]['id']]){_0x57558f['agents'][_0x5f3e3b[_0xf7fa('0x44')]['id']]['busy']=![];_0x57558f['agents'][_0x5f3e3b[_0xf7fa('0x44')]['id']][_0xf7fa('0x46')]=undefined;}return _0xfd05d6({'code':0xc8,'message':_0x5f3e3b});}catch(_0x3aa62b){logger[_0xf7fa('0x3b')](_0x3aa62b[_0xf7fa('0x43')]);return _0x238a5e(_0x33b3e4[_0xf7fa('0x3b')](0x1f4,_0x3aa62b));}}logger[_0xf7fa('0x3b')](_0xf7fa('0x4d'));return _0x238a5e(_0x33b3e4[_0xf7fa('0x3b')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x3b959a){var _0x2b4fb2=this;return new Promise(function(_0x226298,_0x3d8b4c){if(_0x3b959a['channel']&&_0x3b959a[_0xf7fa('0x17')]&&_0x3b959a[_0xf7fa('0x17')]['id']){try{var _0x1f4f10=getId(_0x3b959a[_0xf7fa('0x15')],_0x3b959a[_0xf7fa('0x16')]?_0x3b959a[_0xf7fa('0x16')]['id']:0x0,_0x3b959a[_0xf7fa('0x17')]?_0x3b959a[_0xf7fa('0x17')]['id']:0x0);if(_0x57558f[_0xf7fa('0x14')][_0x1f4f10]){_0x57558f[_0xf7fa('0x14')][_0x1f4f10][_0xf7fa('0x3f')](_0xf7fa('0x47'));}return _0x226298({'code':0xc8,'message':_0x3b959a});}catch(_0x8f78a9){logger['error'](_0x8f78a9[_0xf7fa('0x43')]);return _0x3d8b4c(_0x2b4fb2[_0xf7fa('0x3b')](0x1f4,_0x8f78a9));}}logger[_0xf7fa('0x3b')](_0xf7fa('0x4d'));return _0x3d8b4c(_0x2b4fb2[_0xf7fa('0x3b')](0x1f4,_0xf7fa('0x4d')));});},'AgentCapacity':function(_0x3a95af){var _0x466fbe=this;return new Promise(function(_0x5f31be,_0x228c87){if(_0x57558f[_0xf7fa('0x45')][_0xf7fa('0x4e')](_0x3a95af['id'])){for(var _0x589656 in _0x3a95af['capacity']){if(_0x3a95af[_0xf7fa('0x4f')][_0xf7fa('0x4e')](_0x589656)){if(_0x57558f[_0xf7fa('0x45')][_0x3a95af['id']][_0xf7fa('0x4e')](_0x589656+_0xf7fa('0x50'))){_0x57558f[_0xf7fa('0x45')][_0x3a95af['id']][_0x589656+_0xf7fa('0x50')]=parseInt(_0x3a95af[_0xf7fa('0x4f')][_0x589656],0xa);}}}_0x57558f['agents'][_0x3a95af['id']][_0xf7fa('0x51')]();return _0x5f31be({'code':0xc8,'message':_0x57558f[_0xf7fa('0x45')][_0x3a95af['id']]});}else{return _0x228c87(_0x466fbe[_0xf7fa('0x3b')](0x1f4,_0xf7fa('0x52')));}});},'Agents':function(_0x48aecf){return new Promise(function(_0x5d6dc0){var _0x560169=_[_0xf7fa('0x53')](_0x57558f[_0xf7fa('0x45')]);if(_0x48aecf&&_0x48aecf['id']){var _0x3f8d5f=_[_0xf7fa('0x54')](_0x560169,function(_0x15e807){return _0x15e807['id']===_0x48aecf['id'];});_0x5d6dc0(_0x3f8d5f);}else{_0x5d6dc0({'count':_0x560169[_0xf7fa('0x1a')],'rows':_0x560169});}});},'ChatQueues':function(){return new Promise(function(_0x2db0ec){var _0x2630ae=[];for(var _0x5eea50 in _0x57558f['chatQueues']){if(_0x57558f[_0xf7fa('0x55')]['hasOwnProperty'](_0x5eea50)){var _0x131219=_0x57558f[_0xf7fa('0x55')][_0x5eea50];var _0x29e2b1={'id':_0x131219['id'],'available':_0x131219[_0xf7fa('0x56')],'loggedIn':_0x131219[_0xf7fa('0x57')],'name':_0x131219[_0xf7fa('0x58')],'paused':_0x131219[_0xf7fa('0x59')],'waiting':_0x131219['waiting']};_0x2630ae[_0xf7fa('0x23')](_0x29e2b1);}}_0x2db0ec({'count':_0x2630ae['length'],'rows':_0x2630ae});});},'MailQueues':function(){return new Promise(function(_0xc78135){var _0x5554a0=[];for(var _0xe88927 in _0x57558f[_0xf7fa('0x5a')]){if(_0x57558f[_0xf7fa('0x5a')]['hasOwnProperty'](_0xe88927)){var _0x37485d=_0x57558f[_0xf7fa('0x5a')][_0xe88927];var _0x11f205={'id':_0x37485d['id'],'available':_0x37485d['available'],'loggedIn':_0x37485d[_0xf7fa('0x57')],'name':_0x37485d['name'],'paused':_0x37485d[_0xf7fa('0x59')],'waiting':_0x37485d[_0xf7fa('0x5b')]};_0x5554a0['push'](_0x11f205);}}_0xc78135({'count':_0x5554a0['length'],'rows':_0x5554a0});});},'OpenchannelQueues':function(){return new Promise(function(_0x459f39){var _0xefbbd2=[];for(var _0x4fb853 in _0x57558f[_0xf7fa('0x5c')]){if(_0x57558f['openchannelQueues']['hasOwnProperty'](_0x4fb853)){var _0x2ba623=_0x57558f[_0xf7fa('0x5c')][_0x4fb853];var _0x1476d0={'id':_0x2ba623['id'],'available':_0x2ba623[_0xf7fa('0x56')],'loggedIn':_0x2ba623[_0xf7fa('0x57')],'name':_0x2ba623[_0xf7fa('0x58')],'paused':_0x2ba623[_0xf7fa('0x59')],'waiting':_0x2ba623[_0xf7fa('0x5b')]};_0xefbbd2[_0xf7fa('0x23')](_0x1476d0);}}_0x459f39({'count':_0xefbbd2[_0xf7fa('0x1a')],'rows':_0xefbbd2});});},'SmsQueues':function(){return new Promise(function(_0x33e38e){var _0x53d3bb=[];for(var _0x8b42ea in _0x57558f[_0xf7fa('0x5d')]){if(_0x57558f[_0xf7fa('0x5d')][_0xf7fa('0x4e')](_0x8b42ea)){var _0x5e3cfb=_0x57558f[_0xf7fa('0x5d')][_0x8b42ea];var _0x2e1060={'id':_0x5e3cfb['id'],'available':_0x5e3cfb['available'],'loggedIn':_0x5e3cfb[_0xf7fa('0x57')],'name':_0x5e3cfb[_0xf7fa('0x58')],'paused':_0x5e3cfb[_0xf7fa('0x59')],'waiting':_0x5e3cfb[_0xf7fa('0x5b')]};_0x53d3bb['push'](_0x2e1060);}}_0x33e38e({'count':_0x53d3bb[_0xf7fa('0x1a')],'rows':_0x53d3bb});});},'FaxQueues':function(){return new Promise(function(_0x139247){var _0x2add7a=[];for(var _0x15a06b in _0x57558f[_0xf7fa('0x5e')]){if(_0x57558f[_0xf7fa('0x5e')][_0xf7fa('0x4e')](_0x15a06b)){var _0x287f09=_0x57558f[_0xf7fa('0x5e')][_0x15a06b];var _0xc783af={'id':_0x287f09['id'],'available':_0x287f09[_0xf7fa('0x56')],'loggedIn':_0x287f09[_0xf7fa('0x57')],'name':_0x287f09[_0xf7fa('0x58')],'paused':_0x287f09[_0xf7fa('0x59')],'waiting':_0x287f09[_0xf7fa('0x5b')]};_0x2add7a[_0xf7fa('0x23')](_0xc783af);}}_0x139247({'count':_0x2add7a[_0xf7fa('0x1a')],'rows':_0x2add7a});});},'WhatsappQueues':function(){return new Promise(function(_0x33ef3c){var _0x55d232=[];for(var _0x27874e in _0x57558f['whatsappQueues']){if(_0x57558f[_0xf7fa('0x5f')][_0xf7fa('0x4e')](_0x27874e)){var _0x4ad83c=_0x57558f[_0xf7fa('0x5f')][_0x27874e];var _0x2f99de={'id':_0x4ad83c['id'],'available':_0x4ad83c[_0xf7fa('0x56')],'loggedIn':_0x4ad83c[_0xf7fa('0x57')],'name':_0x4ad83c['name'],'paused':_0x4ad83c[_0xf7fa('0x59')],'waiting':_0x4ad83c['waiting']};_0x55d232[_0xf7fa('0x23')](_0x2f99de);}}_0x33ef3c({'count':_0x55d232[_0xf7fa('0x1a')],'rows':_0x55d232});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x4a7c50){var _0x24c479=_['values'](_0x57558f[_0xf7fa('0x60')]);_0x4a7c50({'count':_0x24c479[_0xf7fa('0x1a')],'rows':_0x24c479});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x12a2e4){var _0x43b2d6=_[_0xf7fa('0x53')](_0x57558f[_0xf7fa('0x61')]);_0x12a2e4({'count':_0x43b2d6['length'],'rows':_0x43b2d6});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x5dca55){var _0x3f1f09=_['values'](_0x57558f['openchannelQueuesWaitingInteractions']);_0x5dca55({'count':_0x3f1f09['length'],'rows':_0x3f1f09});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x451c0c){var _0x155e18=_[_0xf7fa('0x53')](_0x57558f['smsQueuesWaitingInteractions']);_0x451c0c({'count':_0x155e18['length'],'rows':_0x155e18});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x808b93){var _0x3228ff=_[_0xf7fa('0x53')](_0x57558f[_0xf7fa('0x62')]);_0x808b93({'count':_0x3228ff[_0xf7fa('0x1a')],'rows':_0x3228ff});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x1dc36c){var _0x34db1e=_[_0xf7fa('0x53')](_0x57558f['whatsappQueuesWaitingInteractions']);_0x1dc36c({'count':_0x34db1e[_0xf7fa('0x1a')],'rows':_0x34db1e});});}};var _0xbaabbf=jayson[_0xf7fa('0x63')](_0x1b540d)[_0xf7fa('0x64')]();_0xbaabbf['on']('error',function(_0x339b50){logger['error'](JSON[_0xf7fa('0x3e')](_0x339b50));return _0x10faf8(_0x339b50);});_0xbaabbf[_0xf7fa('0x13')](0x232c,_0xf7fa('0x65'),function(){console[_0xf7fa('0x66')](_0xf7fa('0x67'),0x232c);return _0x4b16da(_0xf7fa('0x68')+0x232c);});});}; \ No newline at end of file +var _0x3c52=['priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','waiting','mailQueues','name','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','routing','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','TagId','tvox','getMustacheRender','notificationTemplate','ChatWebsiteId','format','%s:%s:%s','./interval','condition','intervals','consequence'];(function(_0x324e8f,_0x3e7b26){var _0x489b61=function(_0xaf9000){while(--_0xaf9000){_0x324e8f['push'](_0x324e8f['shift']());}};_0x489b61(++_0x3e7b26);}(_0x3c52,0x168));var _0x23c5=function(_0x324147,_0x40f406){_0x324147=_0x324147-0x0;var _0x5982a5=_0x3c52[_0x324147];return _0x5982a5;};'use strict';var _=require(_0x23c5('0x0'));var util=require('util');var path=require(_0x23c5('0x1'));var fs=require('fs');var jayson=require(_0x23c5('0x2'));var BPromise=require(_0x23c5('0x3'));var utils=require(_0x23c5('0x4'));var sUtils=require(_0x23c5('0x5'));var logger=require('../../../config/logger')(_0x23c5('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x23c5('0x7')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x23c5('0x8')),'faxQueueReport':require(_0x23c5('0x9')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x23c5('0xa'));function getId(_0x3bc789,_0x3f9222,_0x19abbf){return util['format'](_0x23c5('0xb'),_0x3bc789,_0x3f9222||0x0,_0x19abbf||0x0);}function getIntervals(_0x1a6a7f,_0x5210b1){var _0x443654=[];if(!_[_0x23c5('0xc')](_0x5210b1['IntervalId'])&&!_['isNil'](_0x1a6a7f[_0x5210b1[_0x23c5('0xd')]])&&!_[_0x23c5('0xc')](_0x1a6a7f[_0x5210b1[_0x23c5('0xd')]][_0x23c5('0xe')])){_0x443654=_['map'](_0x1a6a7f[_0x5210b1['IntervalId']][_0x23c5('0xe')],_0x23c5('0xf'));}else if(!_[_0x23c5('0xc')](_0x5210b1[_0x23c5('0xf')])){_0x443654=[_0x5210b1['interval']];}return _0x443654;}exports[_0x23c5('0x10')]=function(_0x19861c){_0x19861c[_0x23c5('0x11')]={};return new BPromise(function(_0x5ed5e9,_0x308303){var _0x172320={'Start':function(_0x1784bb){var _0x531e4c=this;return new Promise(function(_0xca66cc,_0x43d113){if(_0x1784bb){try{var _0x417158=[];var _0x3a0593=getId(_0x1784bb[_0x23c5('0x12')],_0x1784bb[_0x23c5('0x13')]?_0x1784bb[_0x23c5('0x13')]['id']:0x0,_0x1784bb[_0x23c5('0x14')]?_0x1784bb[_0x23c5('0x14')]['id']:0x0);var _0x3ad110=sUtils['checkWaitingNotifications'](_0x19861c,_0x1784bb);if(!_0x3ad110&&_0x1784bb[_0x23c5('0x15')]&&_[_0x23c5('0x16')](_0x1784bb[_0x23c5('0x15')])&&_0x1784bb[_0x23c5('0x15')][_0x23c5('0x17')]){for(var _0x445a6f=0x0;_0x445a6f<_0x1784bb[_0x23c5('0x15')]['length'];_0x445a6f+=0x1){var _0x2b3358=_0x1784bb[_0x23c5('0x15')][_0x445a6f];if(fs[_0x23c5('0x18')](path[_0x23c5('0x19')](__dirname,'applications',_0x2b3358[_0x23c5('0x1a')]+'.js'))){var _0x33de4b=[];switch(_0x2b3358[_0x23c5('0x1a')][_0x23c5('0x1b')]()){case _0x23c5('0x1c'):var _0x522078=_0x2b3358[_0x23c5('0x1d')][_0x23c5('0x1e')](',');if(_0x1784bb[_0x23c5('0x12')]===_0x23c5('0x1f')){_0x33de4b['push'](_0x522078[0x0]);_0x33de4b[_0x23c5('0x20')](_0x522078[0x1]);_0x33de4b[_0x23c5('0x20')](_0x522078[_0x23c5('0x21')](0x2,_0x522078[_0x23c5('0x17')])[_0x23c5('0x19')](','));}else{_0x33de4b[_0x23c5('0x20')](_0x522078[0x0]);_0x33de4b[_0x23c5('0x20')](_0x522078['slice'](0x1,_0x522078[_0x23c5('0x17')])['join'](','));}break;case _0x23c5('0x22'):var _0x50d454=_0x2b3358['appdata']['split'](',');_0x33de4b['push'](_0x50d454[0x0]);_0x33de4b[_0x23c5('0x20')](_0x50d454[0x1]);_0x33de4b[_0x23c5('0x20')](_0x50d454['slice'](0x2,_0x50d454[_0x23c5('0x17')])[_0x23c5('0x19')](','));break;case _0x23c5('0x23'):var _0x4b6835=_0x2b3358[_0x23c5('0x1d')][_0x23c5('0x1e')](',');_0x33de4b[_0x23c5('0x20')](_0x4b6835[0x0]);_0x33de4b[_0x23c5('0x20')](_0x4b6835[0x1]);_0x33de4b[_0x23c5('0x20')](_0x4b6835[0x2]);_0x33de4b[_0x23c5('0x20')](_0x4b6835[0x3]);_0x33de4b[_0x23c5('0x20')](_0x4b6835[_0x23c5('0x21')](0x4,_0x4b6835[_0x23c5('0x17')])[_0x23c5('0x19')](','));break;case _0x23c5('0x24'):var _0x21ef32=_0x2b3358['appdata'][_0x23c5('0x1e')](',');_0x33de4b[_0x23c5('0x20')](_0x21ef32[0x0]);_0x33de4b[_0x23c5('0x20')](_0x21ef32[0x1]);_0x33de4b[_0x23c5('0x20')](_0x21ef32[0x2]);_0x33de4b[_0x23c5('0x20')](_0x21ef32[0x3]);_0x33de4b[_0x23c5('0x20')](_0x21ef32['slice'](0x4,_0x21ef32[_0x23c5('0x17')])[_0x23c5('0x19')](','));break;case _0x23c5('0x13'):_0x33de4b[_0x23c5('0x20')](_0x2b3358['appdata']);break;case'tag':_0x33de4b[_0x23c5('0x20')](_0x2b3358[_0x23c5('0x25')]);_0x33de4b['push'](_0x2b3358[_0x23c5('0x1d')]);break;case _0x23c5('0x26'):var _0x483aa9=utils[_0x23c5('0x27')](_0x1784bb['account'][_0x23c5('0x28')],_0x1784bb);var _0x402ce8=_0x2b3358[_0x23c5('0x1d')][_0x23c5('0x1e')](',');_0x33de4b[_0x23c5('0x20')](_0x402ce8[0x0]);_0x33de4b[_0x23c5('0x20')](_0x402ce8[0x1]);_0x33de4b[_0x23c5('0x20')](_0x402ce8[0x2]);_0x33de4b[_0x23c5('0x20')](_0x402ce8[0x3]);_0x33de4b[_0x23c5('0x20')](_0x402ce8[0x4]);_0x33de4b[_0x23c5('0x20')](_0x402ce8[0x5]);_0x33de4b[_0x23c5('0x20')](_0x402ce8[0x6]);_0x33de4b[_0x23c5('0x20')](_0x402ce8[0x7]);_0x33de4b[_0x23c5('0x20')](_0x402ce8[0x8]);_0x33de4b['push'](_0x402ce8[0x9]);_0x33de4b['push'](_0x402ce8[0xa]);_0x33de4b['push'](_0x1784bb['interaction']['id']);_0x33de4b[_0x23c5('0x20')](_0x1784bb[_0x23c5('0x13')]['id']);_0x33de4b[_0x23c5('0x20')](_0x2b3358[_0x23c5('0x29')]);_0x33de4b[_0x23c5('0x20')](_0x1784bb[_0x23c5('0x14')]['ContactId']);_0x33de4b[_0x23c5('0x20')](_0x1784bb['body']['body']);_0x33de4b[_0x23c5('0x20')](_0x483aa9);break;default:_0x33de4b=_[_0x23c5('0xc')](_0x2b3358[_0x23c5('0x1d')])?[]:_0x2b3358[_0x23c5('0x1d')][_0x23c5('0x1e')](',');}var _0x2f538f={'id':util[_0x23c5('0x2a')](_0x23c5('0x2b'),_0x3a0593,_0x2b3358['id'],_0x2b3358[_0x23c5('0x1a')]),'condition':require(_0x23c5('0x2c'))[_0x23c5('0x2d')](_0x3a0593,getIntervals(_0x19861c[_0x23c5('0x2e')],_0x2b3358),_0x19861c),'consequence':require('./applications/'+_0x2b3358[_0x23c5('0x1a')])[_0x23c5('0x2f')](_0x3a0593,_0x33de4b,_0x19861c,_0x1784bb),'p':_0x2b3358[_0x23c5('0x30')]||0x0};logger[_0x23c5('0x31')](_0x23c5('0x32'),_0x2f538f['id'],_0x23c5('0x33'),getIntervals(_0x19861c['intervals'],_0x2b3358)[_0x23c5('0x19')](_0x23c5('0x34')));_0x417158['push'](_0x2f538f);}else{logger[_0x23c5('0x35')](_0x23c5('0x36'),path[_0x23c5('0x19')](__dirname,'applications',_0x2b3358[_0x23c5('0x1a')]+'.js'));}}_0x19861c['rules'][_0x3a0593]=new RuleEngine(_0x417158);_0x19861c[_0x23c5('0x11')][_0x3a0593]['execute'](_0x1784bb,function(_0x4fb8fb){logger[_0x23c5('0x31')](_0x23c5('0x37'),JSON['stringify'](_0x4fb8fb[_0x23c5('0x38')]));if(_0x19861c['rules'][_0x3a0593]){_0x19861c[_0x23c5('0x11')][_0x3a0593][_0x23c5('0x39')](_0x23c5('0x3a'));}});return _0xca66cc({'code':0xc8,'message':_0x1784bb});}else{if(_0x3ad110){logger[_0x23c5('0x31')](util[_0x23c5('0x2a')](_0x23c5('0x3b'),_0x3a0593));}else{logger['info'](_0x23c5('0x3c'));}return _0xca66cc({'code':0xc8,'message':_0x1784bb});}}catch(_0x6743a2){logger[_0x23c5('0x35')](_0x6743a2[_0x23c5('0x3d')]);return _0x43d113(_0x531e4c['error'](0x1f4,_0x6743a2));}}return _0x43d113(_0x23c5('0x3e'));});},'AcceptMessage':function(_0x400463){var _0x3b0e3a=this;return new Promise(function(_0x109c20,_0x5c6408){if(_0x400463[_0x23c5('0x3f')]&&_0x400463[_0x23c5('0x3f')]['id']){if(_0x19861c[_0x23c5('0x40')][_0x400463[_0x23c5('0x3f')]['id']]){_0x19861c[_0x23c5('0x40')][_0x400463[_0x23c5('0x3f')]['id']][_0x23c5('0x41')]=![];_0x19861c[_0x23c5('0x40')][_0x400463[_0x23c5('0x3f')]['id']][_0x23c5('0x42')]=undefined;}}if(_0x400463[_0x23c5('0x13')]&&_0x400463[_0x23c5('0x13')]['id']){try{var _0x591ebf=getId(_0x400463[_0x23c5('0x12')],_0x400463[_0x23c5('0x13')]?_0x400463['message']['id']:0x0,_0x400463[_0x23c5('0x14')]?_0x400463[_0x23c5('0x14')]['id']:0x0);if(_0x19861c['rules'][_0x591ebf]){_0x19861c[_0x23c5('0x11')][_0x591ebf]['emit'](_0x23c5('0x43'));if(rpc[_0x400463[_0x23c5('0x12')]+_0x23c5('0x44')]){rpc[_0x400463['channel']+_0x23c5('0x44')]['update'](_0x591ebf,{'UserId':_0x400463['message'][_0x23c5('0x45')]})[_0x23c5('0x46')](function(){logger[_0x23c5('0x35')](_0x23c5('0x47'));});}}return _0x109c20({'code':0xc8,'message':_0x400463});}catch(_0x2ea5a5){logger[_0x23c5('0x35')](_0x2ea5a5[_0x23c5('0x3d')]);return _0x5c6408(_0x3b0e3a['error'](0x1f4,_0x2ea5a5));}}logger[_0x23c5('0x35')]('message\x20is\x20empty');return _0x5c6408(_0x3b0e3a[_0x23c5('0x35')](0x1f4,_0x23c5('0x48')));});},'RejectMessage':function(_0x1d8287){var _0x463cea=this;return new Promise(function(_0x597539,_0x3e79e4){if(_0x1d8287[_0x23c5('0x3f')]&&_0x1d8287[_0x23c5('0x3f')]['id']){try{if(_0x19861c['agents'][_0x1d8287[_0x23c5('0x3f')]['id']]){_0x19861c[_0x23c5('0x40')][_0x1d8287[_0x23c5('0x3f')]['id']][_0x23c5('0x41')]=![];_0x19861c[_0x23c5('0x40')][_0x1d8287[_0x23c5('0x3f')]['id']]['busyQueue']=undefined;}return _0x597539({'code':0xc8,'message':_0x1d8287});}catch(_0x51ab7f){logger['error'](_0x51ab7f[_0x23c5('0x3d')]);return _0x3e79e4(_0x463cea[_0x23c5('0x35')](0x1f4,_0x51ab7f));}}logger[_0x23c5('0x35')]('message\x20is\x20empty');return _0x3e79e4(_0x463cea['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x5b2098){var _0x5ebfae=this;return new Promise(function(_0x138f08,_0x3c1b9a){if(_0x5b2098['channel']&&_0x5b2098[_0x23c5('0x14')]&&_0x5b2098[_0x23c5('0x14')]['id']){try{var _0x43c2e6=getId(_0x5b2098[_0x23c5('0x12')],_0x5b2098[_0x23c5('0x13')]?_0x5b2098[_0x23c5('0x13')]['id']:0x0,_0x5b2098[_0x23c5('0x14')]?_0x5b2098[_0x23c5('0x14')]['id']:0x0);if(_0x19861c[_0x23c5('0x11')][_0x43c2e6]){_0x19861c[_0x23c5('0x11')][_0x43c2e6][_0x23c5('0x39')](_0x23c5('0x43'));}return _0x138f08({'code':0xc8,'message':_0x5b2098});}catch(_0xebde29){logger[_0x23c5('0x35')](_0xebde29[_0x23c5('0x3d')]);return _0x3c1b9a(_0x5ebfae['error'](0x1f4,_0xebde29));}}logger[_0x23c5('0x35')]('message\x20is\x20empty');return _0x3c1b9a(_0x5ebfae['error'](0x1f4,_0x23c5('0x48')));});},'AgentCapacity':function(_0x5354d6){var _0x33bf75=this;return new Promise(function(_0x125dad,_0x41ec56){if(_0x19861c[_0x23c5('0x40')][_0x23c5('0x49')](_0x5354d6['id'])){for(var _0x2ebeab in _0x5354d6[_0x23c5('0x4a')]){if(_0x5354d6[_0x23c5('0x4a')][_0x23c5('0x49')](_0x2ebeab)){if(_0x19861c[_0x23c5('0x40')][_0x5354d6['id']][_0x23c5('0x49')](_0x2ebeab+'CurrentCapacity')){_0x19861c[_0x23c5('0x40')][_0x5354d6['id']][_0x2ebeab+_0x23c5('0x4b')]=parseInt(_0x5354d6[_0x23c5('0x4a')][_0x2ebeab],0xa);}}}_0x19861c[_0x23c5('0x40')][_0x5354d6['id']][_0x23c5('0x4c')]();return _0x125dad({'code':0xc8,'message':_0x19861c[_0x23c5('0x40')][_0x5354d6['id']]});}else{return _0x41ec56(_0x33bf75[_0x23c5('0x35')](0x1f4,_0x23c5('0x4d')));}});},'Agents':function(_0x5690ac){return new Promise(function(_0x532b8c){var _0x1178af=_[_0x23c5('0x4e')](_0x19861c[_0x23c5('0x40')]);if(_0x5690ac&&_0x5690ac['id']){var _0x2f54c9=_[_0x23c5('0x4f')](_0x1178af,function(_0x58593c){return _0x58593c['id']===_0x5690ac['id'];});_0x532b8c(_0x2f54c9);}else{_0x532b8c({'count':_0x1178af[_0x23c5('0x17')],'rows':_0x1178af});}});},'ChatQueues':function(){return new Promise(function(_0x42bc83){var _0x4927a6=[];for(var _0x3599a0 in _0x19861c[_0x23c5('0x50')]){if(_0x19861c[_0x23c5('0x50')][_0x23c5('0x49')](_0x3599a0)){var _0x501d9d=_0x19861c['chatQueues'][_0x3599a0];var _0x2a4eab={'id':_0x501d9d['id'],'available':_0x501d9d[_0x23c5('0x51')],'loggedIn':_0x501d9d[_0x23c5('0x52')],'name':_0x501d9d['name'],'paused':_0x501d9d['paused'],'waiting':_0x501d9d[_0x23c5('0x53')]};_0x4927a6[_0x23c5('0x20')](_0x2a4eab);}}_0x42bc83({'count':_0x4927a6[_0x23c5('0x17')],'rows':_0x4927a6});});},'MailQueues':function(){return new Promise(function(_0x3e8911){var _0x3b3347=[];for(var _0x486a31 in _0x19861c['mailQueues']){if(_0x19861c[_0x23c5('0x54')][_0x23c5('0x49')](_0x486a31)){var _0x578eaf=_0x19861c[_0x23c5('0x54')][_0x486a31];var _0x1b7478={'id':_0x578eaf['id'],'available':_0x578eaf['available'],'loggedIn':_0x578eaf[_0x23c5('0x52')],'name':_0x578eaf[_0x23c5('0x55')],'paused':_0x578eaf[_0x23c5('0x56')],'waiting':_0x578eaf[_0x23c5('0x53')]};_0x3b3347[_0x23c5('0x20')](_0x1b7478);}}_0x3e8911({'count':_0x3b3347['length'],'rows':_0x3b3347});});},'OpenchannelQueues':function(){return new Promise(function(_0x3f51c4){var _0xed56c7=[];for(var _0x44497a in _0x19861c[_0x23c5('0x57')]){if(_0x19861c[_0x23c5('0x57')][_0x23c5('0x49')](_0x44497a)){var _0x17cfdf=_0x19861c[_0x23c5('0x57')][_0x44497a];var _0x34c649={'id':_0x17cfdf['id'],'available':_0x17cfdf['available'],'loggedIn':_0x17cfdf['loggedIn'],'name':_0x17cfdf[_0x23c5('0x55')],'paused':_0x17cfdf[_0x23c5('0x56')],'waiting':_0x17cfdf[_0x23c5('0x53')]};_0xed56c7['push'](_0x34c649);}}_0x3f51c4({'count':_0xed56c7[_0x23c5('0x17')],'rows':_0xed56c7});});},'SmsQueues':function(){return new Promise(function(_0x58c509){var _0x1c46cb=[];for(var _0xcaddea in _0x19861c[_0x23c5('0x58')]){if(_0x19861c[_0x23c5('0x58')]['hasOwnProperty'](_0xcaddea)){var _0x392d1a=_0x19861c[_0x23c5('0x58')][_0xcaddea];var _0x2f42cb={'id':_0x392d1a['id'],'available':_0x392d1a[_0x23c5('0x51')],'loggedIn':_0x392d1a[_0x23c5('0x52')],'name':_0x392d1a['name'],'paused':_0x392d1a[_0x23c5('0x56')],'waiting':_0x392d1a[_0x23c5('0x53')]};_0x1c46cb['push'](_0x2f42cb);}}_0x58c509({'count':_0x1c46cb['length'],'rows':_0x1c46cb});});},'FaxQueues':function(){return new Promise(function(_0x4cdf12){var _0x4d1921=[];for(var _0xad08e in _0x19861c[_0x23c5('0x59')]){if(_0x19861c[_0x23c5('0x59')]['hasOwnProperty'](_0xad08e)){var _0x53ca7a=_0x19861c[_0x23c5('0x59')][_0xad08e];var _0x272882={'id':_0x53ca7a['id'],'available':_0x53ca7a[_0x23c5('0x51')],'loggedIn':_0x53ca7a[_0x23c5('0x52')],'name':_0x53ca7a[_0x23c5('0x55')],'paused':_0x53ca7a[_0x23c5('0x56')],'waiting':_0x53ca7a[_0x23c5('0x53')]};_0x4d1921['push'](_0x272882);}}_0x4cdf12({'count':_0x4d1921[_0x23c5('0x17')],'rows':_0x4d1921});});},'WhatsappQueues':function(){return new Promise(function(_0x1e0289){var _0x4df584=[];for(var _0x348ecb in _0x19861c[_0x23c5('0x5a')]){if(_0x19861c[_0x23c5('0x5a')][_0x23c5('0x49')](_0x348ecb)){var _0x354743=_0x19861c[_0x23c5('0x5a')][_0x348ecb];var _0x4954cc={'id':_0x354743['id'],'available':_0x354743[_0x23c5('0x51')],'loggedIn':_0x354743[_0x23c5('0x52')],'name':_0x354743['name'],'paused':_0x354743['paused'],'waiting':_0x354743[_0x23c5('0x53')]};_0x4df584[_0x23c5('0x20')](_0x4954cc);}}_0x1e0289({'count':_0x4df584[_0x23c5('0x17')],'rows':_0x4df584});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x5d59bb){var _0x13ef2a=_[_0x23c5('0x4e')](_0x19861c[_0x23c5('0x5b')]);_0x5d59bb({'count':_0x13ef2a[_0x23c5('0x17')],'rows':_0x13ef2a});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x40113d){var _0x97f562=_[_0x23c5('0x4e')](_0x19861c[_0x23c5('0x5c')]);_0x40113d({'count':_0x97f562[_0x23c5('0x17')],'rows':_0x97f562});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x413dc8){var _0x59f004=_[_0x23c5('0x4e')](_0x19861c[_0x23c5('0x5d')]);_0x413dc8({'count':_0x59f004['length'],'rows':_0x59f004});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2409fa){var _0x42fdac=_['values'](_0x19861c[_0x23c5('0x5e')]);_0x2409fa({'count':_0x42fdac['length'],'rows':_0x42fdac});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x535924){var _0x3f0cd9=_['values'](_0x19861c[_0x23c5('0x5f')]);_0x535924({'count':_0x3f0cd9[_0x23c5('0x17')],'rows':_0x3f0cd9});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0xc9c67a){var _0x3f5c8c=_[_0x23c5('0x4e')](_0x19861c[_0x23c5('0x60')]);_0xc9c67a({'count':_0x3f5c8c[_0x23c5('0x17')],'rows':_0x3f5c8c});});}};var _0x33a76c=jayson[_0x23c5('0x61')](_0x172320)[_0x23c5('0x62')]();_0x33a76c['on'](_0x23c5('0x35'),function(_0x24da9d){logger[_0x23c5('0x35')](JSON[_0x23c5('0x63')](_0x24da9d));return _0x308303(_0x24da9d);});_0x33a76c['listen'](0x232c,_0x23c5('0x64'),function(){console['log'](_0x23c5('0x65'),0x232c);return _0x5ed5e9('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 d016be8..7719cd2 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 _0xbf9a=['result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s','true','all','some','\x20|\x20','log','[%s][INTERVAL]\x20%s\x20%s','join','stack','util','bluebird','jayson/promise','../../../config/logger','routing','client','request','then','error','message'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xbf9a,0x1e3));var _0xabf9=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0xbf9a[_0x100e36];return _0x1df0c9;};'use strict';var util=require(_0xabf9('0x0'));var BPromise=require(_0xabf9('0x1'));var jayson=require(_0xabf9('0x2'));var _=require('lodash');var logger=require(_0xabf9('0x3'))(_0xabf9('0x4'));var client=jayson[_0xabf9('0x5')]['http']({'port':0x232a});function request(_0xac590d,_0x88d607){return new BPromise(function(_0x1daa52,_0x1dc242){return client[_0xabf9('0x6')](_0xac590d,_0x88d607)[_0xabf9('0x7')](function(_0x51a7d8){if(_0x51a7d8[_0xabf9('0x8')]){return _0x1dc242(_0x51a7d8['error'][_0xabf9('0x9')]);}else{return _0x1daa52(_0x51a7d8[_0xabf9('0xa')]);}})[_0xabf9('0xb')](function(_0x596d68){return _0x1dc242(_0x596d68);});});}exports[_0xabf9('0xc')]=function(_0x395966,_0x1c796b,_0x104270){return function(_0x4b9bf7){if(_0x104270[_0xabf9('0xd')]&&!_0x104270[_0xabf9('0xd')][_0x395966]){logger[_0xabf9('0xe')](_0xabf9('0xf'),_0x395966);return _0x4b9bf7[_0xabf9('0x10')]();}var _0x56d1d8=[];for(var _0x597540=0x0;_0x597540<_0x1c796b['length'];_0x597540+=0x1){_0x56d1d8[_0xabf9('0x11')](request(_0xabf9('0x12'),{'command':util[_0xabf9('0x13')](_0xabf9('0x14'),_0x1c796b[_0x597540])})[_0xabf9('0x7')](function(_0x435d61){return _0x435d61&&_0x435d61[_0xabf9('0x9')]&&_0x435d61[_0xabf9('0x9')]['indexOf'](_0xabf9('0x15'))>=0x0?!![]:![];})[_0xabf9('0xb')](function(_0x121c43){logger['error']('[%s][INTERVAL]\x20%s',_0x395966,_0x1c796b[_0x597540]);}));}BPromise[_0xabf9('0x16')](_0x56d1d8)['then'](function(_0x134cff){var _0x4f9697=_[_0xabf9('0x17')](_0x134cff);logger[_0xabf9('0xe')]('[%s][INTERVAL]\x20%s\x20%s',_0x395966,_0x1c796b['join'](_0xabf9('0x18')),_0x4f9697);_0x4b9bf7['when'](_0x4f9697);})['catch'](function(_0x2407c3){console[_0xabf9('0x19')](_0x2407c3);logger[_0xabf9('0x8')](_0xabf9('0x1a'),_0x395966,_0x1c796b[_0xabf9('0x1b')]('\x20|\x20'),_0x2407c3[_0xabf9('0x1c')]);_0x4b9bf7['stop']();});};}; \ No newline at end of file +var _0x49c6=['message','true','catch','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','when','\x20|\x20','stack','util','bluebird','routing','client','http','request','then','error','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s'];(function(_0x317124,_0x25b86e){var _0x5d94ed=function(_0x3935e2){while(--_0x3935e2){_0x317124['push'](_0x317124['shift']());}};_0x5d94ed(++_0x25b86e);}(_0x49c6,0x1de));var _0x649c=function(_0x337438,_0x157dec){_0x337438=_0x337438-0x0;var _0xfcffc2=_0x49c6[_0x337438];return _0xfcffc2;};'use strict';var util=require(_0x649c('0x0'));var BPromise=require(_0x649c('0x1'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require('../../../config/logger')(_0x649c('0x2'));var client=jayson[_0x649c('0x3')][_0x649c('0x4')]({'port':0x232a});function request(_0x38d0b4,_0xe39e48){return new BPromise(function(_0x466c69,_0x5364c3){return client[_0x649c('0x5')](_0x38d0b4,_0xe39e48)[_0x649c('0x6')](function(_0x48b7af){if(_0x48b7af[_0x649c('0x7')]){return _0x5364c3(_0x48b7af[_0x649c('0x7')]['message']);}else{return _0x466c69(_0x48b7af['result']);}})['catch'](function(_0x56dd17){return _0x5364c3(_0x56dd17);});});}exports['condition']=function(_0x5f5236,_0x1508f6,_0x1a1edd){return function(_0x695d72){if(_0x1a1edd[_0x649c('0x8')]&&!_0x1a1edd['rules'][_0x5f5236]){logger[_0x649c('0x9')](_0x649c('0xa'),_0x5f5236);return _0x695d72[_0x649c('0xb')]();}var _0x173048=[];for(var _0x291db8=0x0;_0x291db8<_0x1508f6['length'];_0x291db8+=0x1){_0x173048[_0x649c('0xc')](request(_0x649c('0xd'),{'command':util[_0x649c('0xe')](_0x649c('0xf'),_0x1508f6[_0x291db8])})[_0x649c('0x6')](function(_0x14e259){return _0x14e259&&_0x14e259[_0x649c('0x10')]&&_0x14e259[_0x649c('0x10')]['indexOf'](_0x649c('0x11'))>=0x0?!![]:![];})[_0x649c('0x12')](function(_0x1fdfb7){logger[_0x649c('0x7')](_0x649c('0x13'),_0x5f5236,_0x1508f6[_0x291db8]);}));}BPromise[_0x649c('0x14')](_0x173048)[_0x649c('0x6')](function(_0x913148){var _0x256f2f=_['some'](_0x913148);logger[_0x649c('0x9')](_0x649c('0x15'),_0x5f5236,_0x1508f6[_0x649c('0x16')]('\x20|\x20'),_0x256f2f);_0x695d72[_0x649c('0x17')](_0x256f2f);})[_0x649c('0x12')](function(_0x2ad8a1){console['log'](_0x2ad8a1);logger['error'](_0x649c('0x15'),_0x5f5236,_0x1508f6[_0x649c('0x16')](_0x649c('0x18')),_0x2ad8a1[_0x649c('0x19')]);_0x695d72[_0x649c('0xb')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 42ebe39..c53dad6 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 _0xcb91=['blind','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','./utils','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','debug','format','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','lastevent','timeout','reason','holdtime','ringtime','talktime','push','[%s][agents][queuecallerabandon]','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype'];(function(_0x365abc,_0x15dc0f){var _0x58c8ca=function(_0x4d720d){while(--_0x4d720d){_0x365abc['push'](_0x365abc['shift']());}};_0x58c8ca(++_0x15dc0f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0xcb91[_0x2f3794];return _0x1c9fbe;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x1cb9('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0xe4a5bf,_0x17d4ec){utils[_0x1cb9('0x1')](util['format'](_0x1cb9('0x2'),_0xe4a5bf[_0x1cb9('0x3')],_0xe4a5bf['channel'],_0xe4a5bf[_0x1cb9('0x4')],_0xe4a5bf[_0x1cb9('0x5')],_0xe4a5bf['interface'],_0xe4a5bf[_0x1cb9('0x6')],_0xe4a5bf[_0x1cb9('0x7')],_0xe4a5bf['lastevent']));if(_0xe4a5bf[_0x1cb9('0x4')]){utils[_0x1cb9('0x8')](_0xe4a5bf['queue'])[_0x1cb9('0x9')](function(_0x5a0e99){if(_0x5a0e99){_0xe4a5bf['type']=_0x5a0e99[_0x1cb9('0xa')];_0xe4a5bf[_0x1cb9('0xb')]=_0xe4a5bf[_0x1cb9('0xc')]?_0x5a0e99[_0x1cb9('0xd')]:![];_0xe4a5bf[_0x1cb9('0xe')]=_0xe4a5bf['agentacw']?_0x5a0e99[_0x1cb9('0xf')]:0x0;}utils[_0x1cb9('0x10')](_0x1cb9('0x11'),_0xe4a5bf);});}else{utils[_0x1cb9('0x10')](_0x1cb9('0x11'),_0xe4a5bf);}if(_0x17d4ec){delete transfers[_0xe4a5bf['uniqueid']];}else{delete agents[_0xe4a5bf['destuniqueid']];}}exports['agentcalled']=function(_0x358866){try{utils[_0x1cb9('0x12')](util[_0x1cb9('0x13')](_0x1cb9('0x14'),_0x358866['uniqueid']),_0x358866);agents[_0x358866[_0x1cb9('0x15')]]=_0x358866;agents[_0x358866[_0x1cb9('0x15')]][_0x1cb9('0x16')]=utils[_0x1cb9('0x17')]();agents[_0x358866[_0x1cb9('0x15')]]['lastevent']='called';agents[_0x358866[_0x1cb9('0x15')]][_0x1cb9('0x7')]=null;agents[_0x358866[_0x1cb9('0x15')]][_0x1cb9('0x18')]=null;utils[_0x1cb9('0x1')](util[_0x1cb9('0x13')](_0x1cb9('0x19'),_0x358866['uniqueid'],agents[_0x358866['destuniqueid']][_0x1cb9('0x5')],_0x358866[_0x1cb9('0x15')]));}catch(_0x2b2669){utils[_0x1cb9('0x1a')](util[_0x1cb9('0x13')](_0x1cb9('0x14'),_0x358866[_0x1cb9('0x3')]),_0x2b2669);}};exports['agentringnoanswer']=function(_0x559bcc){try{if(!_[_0x1cb9('0x1b')](agents[_0x559bcc['destuniqueid']])){utils[_0x1cb9('0x12')](util[_0x1cb9('0x13')]('[%s][agents][agentringnoanswer]',_0x559bcc['uniqueid']),_0x559bcc);utils[_0x1cb9('0x1')](util[_0x1cb9('0x13')](_0x1cb9('0x1c'),_0x559bcc[_0x1cb9('0x3')],agents[_0x559bcc[_0x1cb9('0x15')]][_0x1cb9('0x5')],_0x559bcc['destuniqueid']));agents[_0x559bcc['destuniqueid']][_0x1cb9('0x1d')]=!![];agents[_0x559bcc['destuniqueid']][_0x1cb9('0x1e')]=utils[_0x1cb9('0x17')]();agents[_0x559bcc[_0x1cb9('0x15')]][_0x1cb9('0x1f')]=_0x1cb9('0x20');agents[_0x559bcc['destuniqueid']][_0x1cb9('0x21')]=_0x1cb9('0x20');agents[_0x559bcc['destuniqueid']][_0x1cb9('0x22')]=_0x559bcc[_0x1cb9('0x23')]?parseInt(_0x559bcc[_0x1cb9('0x23')])/0x3e8:0x0;agents[_0x559bcc[_0x1cb9('0x15')]][_0x1cb9('0x24')]=0x0;unanswered[_0x1cb9('0x25')](_0x559bcc[_0x1cb9('0x15')]);}}catch(_0xb644b3){utils[_0x1cb9('0x1a')](util[_0x1cb9('0x13')]('[%s][agents][agentringnoanswer]',_0x559bcc[_0x1cb9('0x3')]),_0xb644b3);}};exports['queuecallerabandon']=function(_0x110282){try{_['forIn'](agents,function(_0x278327,_0x41011c){if(_0x278327[_0x1cb9('0x3')]==_0x110282[_0x1cb9('0x3')]&&!_['includes'](unanswered,_0x278327[_0x1cb9('0x15')])){utils['debug'](util[_0x1cb9('0x13')](_0x1cb9('0x26'),_0x110282[_0x1cb9('0x3')]),_0x110282);utils['info'](util[_0x1cb9('0x13')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x110282[_0x1cb9('0x3')],_0x278327['membername'],_0x278327[_0x1cb9('0x15')]));_0x278327[_0x1cb9('0x1d')]=!![];_0x278327[_0x1cb9('0x1e')]=utils[_0x1cb9('0x17')]();_0x278327['lastevent']=_0x1cb9('0x27');_0x278327[_0x1cb9('0x21')]=_0x1cb9('0x27');_0x278327[_0x1cb9('0x22')]=_0x110282[_0x1cb9('0x22')];_0x278327[_0x1cb9('0x24')]=0x0;writeDB(_0x278327);}});}catch(_0xc6d5fd){utils[_0x1cb9('0x1a')](util[_0x1cb9('0x13')](_0x1cb9('0x26'),_0x110282[_0x1cb9('0x3')]),_0xc6d5fd);}};exports[_0x1cb9('0x28')]=function(_0x29f149){try{if(agents[_0x29f149['destuniqueid']]){utils['debug'](util[_0x1cb9('0x13')](_0x1cb9('0x29'),_0x29f149[_0x1cb9('0x3')]),_0x29f149);utils[_0x1cb9('0x1')](util[_0x1cb9('0x13')](_0x1cb9('0x2a'),_0x29f149[_0x1cb9('0x3')],agents[_0x29f149[_0x1cb9('0x15')]]['membername'],_0x29f149[_0x1cb9('0x15')]));agents[_0x29f149[_0x1cb9('0x15')]][_0x1cb9('0x2b')]=utils['now']();agents[_0x29f149[_0x1cb9('0x15')]]['connectedlinenum']=_0x29f149[_0x1cb9('0x7')];agents[_0x29f149['destuniqueid']][_0x1cb9('0x18')]=_0x29f149[_0x1cb9('0x18')];agents[_0x29f149[_0x1cb9('0x15')]][_0x1cb9('0x22')]=_0x29f149[_0x1cb9('0x23')];agents[_0x29f149[_0x1cb9('0x15')]][_0x1cb9('0x1f')]='connect';_['forIn'](agents,function(_0x4111b8,_0x1d2723){if(_0x4111b8[_0x1cb9('0x15')]!=_0x29f149[_0x1cb9('0x15')]&&_0x4111b8[_0x1cb9('0x3')]==_0x29f149[_0x1cb9('0x3')]){_0x4111b8[_0x1cb9('0x24')]=0x0;_0x4111b8['holdtime']=_0x29f149[_0x1cb9('0x23')];_0x4111b8['agentringnoanswer']=!![];_0x4111b8['agentringnoanswerAt']=utils['now']();_0x4111b8[_0x1cb9('0x1f')]=_0x1cb9('0x2c');_0x4111b8[_0x1cb9('0x21')]=_0x1cb9('0x2c');_0x4111b8[_0x1cb9('0x2d')]=_0x29f149['destuniqueid'];_0x4111b8[_0x1cb9('0x2e')]=_0x29f149['membername'];writeDB(_0x4111b8);}});}}catch(_0x91121){utils[_0x1cb9('0x1a')](util[_0x1cb9('0x13')]('[%s][agents][agentconnect]',_0x29f149[_0x1cb9('0x3')]),_0x91121);}};exports['agentcomplete']=function(_0xda1a44){try{if(!_[_0x1cb9('0x1b')](agents[_0xda1a44['destuniqueid']])){utils['debug'](util[_0x1cb9('0x13')](_0x1cb9('0x2f'),_0xda1a44[_0x1cb9('0x3')]),_0xda1a44);utils[_0x1cb9('0x1')](util[_0x1cb9('0x13')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xda1a44[_0x1cb9('0x3')],agents[_0xda1a44['destuniqueid']]['membername'],_0xda1a44['destuniqueid']));agents[_0xda1a44[_0x1cb9('0x15')]][_0x1cb9('0xc')]=!![];agents[_0xda1a44[_0x1cb9('0x15')]][_0x1cb9('0x30')]=utils[_0x1cb9('0x17')]();agents[_0xda1a44[_0x1cb9('0x15')]][_0x1cb9('0x24')]=utils[_0x1cb9('0x31')](agents[_0xda1a44[_0x1cb9('0x15')]][_0x1cb9('0x30')],agents[_0xda1a44[_0x1cb9('0x15')]]['agentconnectAt']);agents[_0xda1a44[_0x1cb9('0x15')]][_0x1cb9('0x21')]=_0xda1a44[_0x1cb9('0x21')];agents[_0xda1a44['destuniqueid']][_0x1cb9('0x1f')]=_0x1cb9('0x32');writeDB(agents[_0xda1a44[_0x1cb9('0x15')]]);}}catch(_0x2efdbb){utils[_0x1cb9('0x1a')](util['format'](_0x1cb9('0x2f'),_0xda1a44['uniqueid']),_0x2efdbb);}};exports[_0x1cb9('0x33')]=function(_0x4ac483){try{if(!_[_0x1cb9('0x1b')](agents[_0x4ac483[_0x1cb9('0x34')]])){utils[_0x1cb9('0x12')](util[_0x1cb9('0x13')]('[%s][agents][blindtransfer]',_0x4ac483[_0x1cb9('0x3')]),_0x4ac483);utils[_0x1cb9('0x1')](util[_0x1cb9('0x13')](_0x1cb9('0x35'),_0x4ac483[_0x1cb9('0x3')],agents[_0x4ac483[_0x1cb9('0x34')]][_0x1cb9('0x5')],agents[_0x4ac483[_0x1cb9('0x34')]][_0x1cb9('0x3')]));agents[_0x4ac483[_0x1cb9('0x34')]]['transfer']=!![];agents[_0x4ac483['transfereruniqueid']][_0x1cb9('0x36')]=_0x1cb9('0x37');agents[_0x4ac483[_0x1cb9('0x34')]][_0x1cb9('0x38')]=_0x4ac483[_0x1cb9('0x39')];agents[_0x4ac483[_0x1cb9('0x34')]][_0x1cb9('0x3a')]=agents[_0x4ac483[_0x1cb9('0x34')]][_0x1cb9('0x3')];}}catch(_0x166ca2){utils['error'](util[_0x1cb9('0x13')]('[%s][agents][blindtransfer]',_0x4ac483[_0x1cb9('0x3')]),_0x166ca2);}};exports['attendedtransfer']=function(_0x135795){try{utils['debug'](util['format'](_0x1cb9('0x3b'),_0x135795[_0x1cb9('0x3c')]),_0x135795);if(_0x135795[_0x1cb9('0x3c')]==_0x135795['origtransfererlinkedid']){if(!_[_0x1cb9('0x1b')](agents[_0x135795[_0x1cb9('0x3d')]])){utils['info'](util['format'](_0x1cb9('0x3e'),_0x135795[_0x1cb9('0x3c')],agents[_0x135795[_0x1cb9('0x3d')]][_0x1cb9('0x5')]));agents[_0x135795[_0x1cb9('0x3d')]][_0x1cb9('0x3f')]=!![];agents[_0x135795[_0x1cb9('0x3d')]]['transfertype']=_0x1cb9('0x40');agents[_0x135795[_0x1cb9('0x3d')]][_0x1cb9('0x38')]=_0x135795['origtransfererexten'];agents[_0x135795[_0x1cb9('0x3d')]][_0x1cb9('0x3a')]=_0x135795[_0x1cb9('0x3c')];}if(_0x135795[_0x1cb9('0x41')]&&agents[_0x135795[_0x1cb9('0x41')]]){agents[_0x135795[_0x1cb9('0x41')]]['agententerreason']=0x1;transfers[_0x135795[_0x1cb9('0x41')]]=_[_0x1cb9('0x42')](agents[_0x135795[_0x1cb9('0x41')]]);transfers[_0x135795[_0x1cb9('0x41')]][_0x1cb9('0x6')]=agents[_0x135795[_0x1cb9('0x3d')]][_0x1cb9('0x6')];transfers[_0x135795[_0x1cb9('0x41')]][_0x1cb9('0x43')]=agents[_0x135795[_0x1cb9('0x3d')]][_0x1cb9('0x43')];transfers[_0x135795['transfereeuniqueid']][_0x1cb9('0x16')]=utils[_0x1cb9('0x17')]();transfers[_0x135795[_0x1cb9('0x41')]][_0x1cb9('0x2b')]=utils['now']();transfers[_0x135795['transfereeuniqueid']][_0x1cb9('0x22')]=0x0;transfers[_0x135795[_0x1cb9('0x41')]][_0x1cb9('0x44')]=0x2;}}else if(_0x135795[_0x1cb9('0x3d')]==_0x135795[_0x1cb9('0x45')]){if(!_[_0x1cb9('0x1b')](agents[_0x135795[_0x1cb9('0x3c')]])){utils[_0x1cb9('0x1')](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x135795[_0x1cb9('0x3c')],agents[_0x135795['origtransfereruniqueid']]['membername']));agents[_0x135795['origtransfereruniqueid']]['transfer']=!![];agents[_0x135795['origtransfereruniqueid']][_0x1cb9('0x36')]=_0x1cb9('0x40');agents[_0x135795[_0x1cb9('0x3c')]][_0x1cb9('0x38')]=_0x135795[_0x1cb9('0x46')];agents[_0x135795[_0x1cb9('0x3c')]]['transferuniqueid']=_0x135795[_0x1cb9('0x3d')];}if(_0x135795[_0x1cb9('0x47')]&&agents[_0x135795['transfertargetuniqueid']]){agents[_0x135795['transfertargetuniqueid']][_0x1cb9('0x44')]=0x1;transfers[_0x135795[_0x1cb9('0x47')]]=_[_0x1cb9('0x42')](agents[_0x135795[_0x1cb9('0x47')]]);transfers[_0x135795[_0x1cb9('0x47')]]['calleridnum']=agents[_0x135795['origtransfereruniqueid']]['calleridnum'];transfers[_0x135795[_0x1cb9('0x47')]][_0x1cb9('0x43')]=agents[_0x135795[_0x1cb9('0x3c')]][_0x1cb9('0x43')];transfers[_0x135795[_0x1cb9('0x47')]]['agentcalledAt']=utils[_0x1cb9('0x17')]();transfers[_0x135795[_0x1cb9('0x47')]]['agentconnectAt']=utils['now']();transfers[_0x135795[_0x1cb9('0x47')]]['holdtime']=0x0;transfers[_0x135795[_0x1cb9('0x47')]][_0x1cb9('0x44')]=0x2;}}}catch(_0x2c54ea){utils[_0x1cb9('0x1a')](util[_0x1cb9('0x13')](_0x1cb9('0x3b'),_0x135795['origtransfereruniqueid']),_0x2c54ea);}};exports[_0x1cb9('0x48')]=function(_0x15fc04){try{utils[_0x1cb9('0x12')](util[_0x1cb9('0x13')]('[%s][agents][hangup]',_0x15fc04['uniqueid']),_0x15fc04);if(agents[_0x15fc04[_0x1cb9('0x3')]]&&agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x21')]===_0x1cb9('0x20')){if(_0x15fc04[_0x1cb9('0x49')]==='21'){agents[_0x15fc04[_0x1cb9('0x3')]]['reason']=_0x1cb9('0x4a');agents[_0x15fc04['uniqueid']][_0x1cb9('0x1f')]=_0x1cb9('0x4a');}utils['info'](util[_0x1cb9('0x13')](_0x1cb9('0x4b'),_0x15fc04[_0x1cb9('0x3')],agents[_0x15fc04['uniqueid']][_0x1cb9('0x5')],agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x21')],agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x1f')]));writeDB(agents[_0x15fc04[_0x1cb9('0x3')]]);var _0x5a3f1d=unanswered[_0x1cb9('0x4c')](_0x15fc04[_0x1cb9('0x3')]);if(_0x5a3f1d>-0x1){unanswered[_0x1cb9('0x4d')](_0x5a3f1d,0x1);}}if(transfers[_0x15fc04[_0x1cb9('0x3')]]){transfers[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0xc')]=!![];transfers[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x30')]=utils['now']();transfers[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x24')]=utils['diffTime'](transfers[_0x15fc04[_0x1cb9('0x3')]]['agentcompleteAt'],transfers[_0x15fc04[_0x1cb9('0x3')]]['agentconnectAt']);transfers[_0x15fc04['uniqueid']][_0x1cb9('0x21')]=_0x1cb9('0x4e');transfers[_0x15fc04['uniqueid']][_0x1cb9('0x1f')]='complete';utils[_0x1cb9('0x1')](util[_0x1cb9('0x13')](_0x1cb9('0x4b'),_0x15fc04[_0x1cb9('0x3')],transfers[_0x15fc04['uniqueid']][_0x1cb9('0x5')],transfers[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x21')],transfers[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x1f')]));writeDB(transfers[_0x15fc04[_0x1cb9('0x3')]],!![]);}if(agents[_0x15fc04['uniqueid']]&&agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x2b')]){agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0xc')]=!![];agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x30')]=utils['now']();agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x24')]=utils['diffTime'](agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x30')],agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x2b')]);agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x21')]=agents[_0x15fc04[_0x1cb9('0x3')]]['transfer']?_0x1cb9('0x3f'):'agent';agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x1f')]='complete';utils[_0x1cb9('0x1')](util[_0x1cb9('0x13')](_0x1cb9('0x4b'),_0x15fc04[_0x1cb9('0x3')],agents[_0x15fc04['uniqueid']][_0x1cb9('0x5')],agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x21')],agents[_0x15fc04['uniqueid']][_0x1cb9('0x1f')]));writeDB(agents[_0x15fc04[_0x1cb9('0x3')]]);}}catch(_0x3b456a){utils[_0x1cb9('0x1a')](util[_0x1cb9('0x13')](_0x1cb9('0x4f'),_0x15fc04[_0x1cb9('0x3')]),_0x3b456a);}}; \ No newline at end of file +var _0x4ded=['agentcompleteAt','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfertype','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','agentcomplete','acw','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','error','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','diffTime'];(function(_0x1b734c,_0x49a7e9){var _0x39e843=function(_0xf795c0){while(--_0xf795c0){_0x1b734c['push'](_0x1b734c['shift']());}};_0x39e843(++_0x49a7e9);}(_0x4ded,0x116));var _0xd4de=function(_0x498859,_0x5b6aa8){_0x498859=_0x498859-0x0;var _0xeca5fe=_0x4ded[_0x498859];return _0xeca5fe;};'use strict';var _=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var utils=require(_0xd4de('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1fa334,_0x2349f5){utils[_0xd4de('0x3')](util[_0xd4de('0x4')](_0xd4de('0x5'),_0x1fa334[_0xd4de('0x6')],_0x1fa334[_0xd4de('0x7')],_0x1fa334[_0xd4de('0x8')],_0x1fa334[_0xd4de('0x9')],_0x1fa334['interface'],_0x1fa334[_0xd4de('0xa')],_0x1fa334[_0xd4de('0xb')],_0x1fa334[_0xd4de('0xc')]));if(_0x1fa334[_0xd4de('0x8')]){utils[_0xd4de('0xd')](_0x1fa334[_0xd4de('0x8')])['then'](function(_0xb7e8cf){if(_0xb7e8cf){_0x1fa334['type']=_0xb7e8cf['type'];_0x1fa334['agentacw']=_0x1fa334[_0xd4de('0xe')]?_0xb7e8cf[_0xd4de('0xf')]:![];_0x1fa334['acwtime']=_0x1fa334['agentacw']?_0xb7e8cf['acwTimeout']:0x0;}utils[_0xd4de('0x10')]('CreateVoiceAgentReport',_0x1fa334);});}else{utils[_0xd4de('0x10')](_0xd4de('0x11'),_0x1fa334);}if(_0x2349f5){delete transfers[_0x1fa334[_0xd4de('0x6')]];}else{delete agents[_0x1fa334[_0xd4de('0x12')]];}}exports[_0xd4de('0x13')]=function(_0x3af6e0){try{utils[_0xd4de('0x14')](util[_0xd4de('0x4')](_0xd4de('0x15'),_0x3af6e0[_0xd4de('0x6')]),_0x3af6e0);agents[_0x3af6e0[_0xd4de('0x12')]]=_0x3af6e0;agents[_0x3af6e0[_0xd4de('0x12')]][_0xd4de('0x16')]=utils[_0xd4de('0x17')]();agents[_0x3af6e0[_0xd4de('0x12')]][_0xd4de('0xc')]=_0xd4de('0x18');agents[_0x3af6e0['destuniqueid']]['connectedlinenum']=null;agents[_0x3af6e0[_0xd4de('0x12')]][_0xd4de('0x19')]=null;utils[_0xd4de('0x3')](util[_0xd4de('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x3af6e0['uniqueid'],agents[_0x3af6e0[_0xd4de('0x12')]]['membername'],_0x3af6e0[_0xd4de('0x12')]));}catch(_0x29c028){utils['error'](util[_0xd4de('0x4')]('[%s][agents][agentcalled]',_0x3af6e0[_0xd4de('0x6')]),_0x29c028);}};exports[_0xd4de('0x1a')]=function(_0x2bad14){try{if(!_[_0xd4de('0x1b')](agents[_0x2bad14['destuniqueid']])){utils[_0xd4de('0x14')](util[_0xd4de('0x4')](_0xd4de('0x1c'),_0x2bad14[_0xd4de('0x6')]),_0x2bad14);utils[_0xd4de('0x3')](util[_0xd4de('0x4')](_0xd4de('0x1d'),_0x2bad14[_0xd4de('0x6')],agents[_0x2bad14[_0xd4de('0x12')]][_0xd4de('0x9')],_0x2bad14['destuniqueid']));agents[_0x2bad14[_0xd4de('0x12')]][_0xd4de('0x1a')]=!![];agents[_0x2bad14[_0xd4de('0x12')]][_0xd4de('0x1e')]=utils[_0xd4de('0x17')]();agents[_0x2bad14[_0xd4de('0x12')]][_0xd4de('0xc')]=_0xd4de('0x1f');agents[_0x2bad14[_0xd4de('0x12')]][_0xd4de('0x20')]=_0xd4de('0x1f');agents[_0x2bad14[_0xd4de('0x12')]]['holdtime']=_0x2bad14[_0xd4de('0x21')]?parseInt(_0x2bad14[_0xd4de('0x21')])/0x3e8:0x0;agents[_0x2bad14['destuniqueid']][_0xd4de('0x22')]=0x0;unanswered['push'](_0x2bad14[_0xd4de('0x12')]);}}catch(_0x32e407){utils[_0xd4de('0x23')](util['format'](_0xd4de('0x1c'),_0x2bad14[_0xd4de('0x6')]),_0x32e407);}};exports[_0xd4de('0x24')]=function(_0x50cb73){try{_[_0xd4de('0x25')](agents,function(_0x1804c7,_0x55f9f9){if(_0x1804c7['uniqueid']==_0x50cb73['uniqueid']&&!_[_0xd4de('0x26')](unanswered,_0x1804c7['destuniqueid'])){utils[_0xd4de('0x14')](util[_0xd4de('0x4')](_0xd4de('0x27'),_0x50cb73[_0xd4de('0x6')]),_0x50cb73);utils['info'](util[_0xd4de('0x4')](_0xd4de('0x28'),_0x50cb73['uniqueid'],_0x1804c7[_0xd4de('0x9')],_0x1804c7[_0xd4de('0x12')]));_0x1804c7['agentringnoanswer']=!![];_0x1804c7['agentringnoanswerAt']=utils[_0xd4de('0x17')]();_0x1804c7[_0xd4de('0xc')]=_0xd4de('0x29');_0x1804c7[_0xd4de('0x20')]='abandoned';_0x1804c7[_0xd4de('0x2a')]=_0x50cb73[_0xd4de('0x2a')];_0x1804c7['talktime']=0x0;writeDB(_0x1804c7);}});}catch(_0x329d49){utils[_0xd4de('0x23')](util[_0xd4de('0x4')](_0xd4de('0x27'),_0x50cb73[_0xd4de('0x6')]),_0x329d49);}};exports[_0xd4de('0x2b')]=function(_0x53441c){try{if(agents[_0x53441c['destuniqueid']]){utils[_0xd4de('0x14')](util[_0xd4de('0x4')](_0xd4de('0x2c'),_0x53441c['uniqueid']),_0x53441c);utils[_0xd4de('0x3')](util[_0xd4de('0x4')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x53441c[_0xd4de('0x6')],agents[_0x53441c[_0xd4de('0x12')]][_0xd4de('0x9')],_0x53441c[_0xd4de('0x12')]));agents[_0x53441c['destuniqueid']]['agentconnectAt']=utils[_0xd4de('0x17')]();agents[_0x53441c['destuniqueid']][_0xd4de('0xb')]=_0x53441c['connectedlinenum'];agents[_0x53441c[_0xd4de('0x12')]][_0xd4de('0x19')]=_0x53441c[_0xd4de('0x19')];agents[_0x53441c[_0xd4de('0x12')]]['holdtime']=_0x53441c[_0xd4de('0x21')];agents[_0x53441c['destuniqueid']][_0xd4de('0xc')]=_0xd4de('0x2d');_[_0xd4de('0x25')](agents,function(_0x4517a6,_0x349c5f){if(_0x4517a6[_0xd4de('0x12')]!=_0x53441c[_0xd4de('0x12')]&&_0x4517a6['uniqueid']==_0x53441c[_0xd4de('0x6')]){_0x4517a6[_0xd4de('0x22')]=0x0;_0x4517a6[_0xd4de('0x2a')]=_0x53441c[_0xd4de('0x21')];_0x4517a6[_0xd4de('0x1a')]=!![];_0x4517a6['agentringnoanswerAt']=utils[_0xd4de('0x17')]();_0x4517a6[_0xd4de('0xc')]=_0xd4de('0x2e');_0x4517a6['reason']=_0xd4de('0x2e');_0x4517a6[_0xd4de('0x2f')]=_0x53441c[_0xd4de('0x12')];_0x4517a6['answeredelsewheremembername']=_0x53441c[_0xd4de('0x9')];writeDB(_0x4517a6);}});}}catch(_0x10a42c){utils[_0xd4de('0x23')](util[_0xd4de('0x4')](_0xd4de('0x2c'),_0x53441c[_0xd4de('0x6')]),_0x10a42c);}};exports[_0xd4de('0xe')]=function(_0x5ecbbd){try{if(!_[_0xd4de('0x1b')](agents[_0x5ecbbd[_0xd4de('0x12')]])){utils[_0xd4de('0x14')](util['format'](_0xd4de('0x30'),_0x5ecbbd[_0xd4de('0x6')]),_0x5ecbbd);utils[_0xd4de('0x3')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x5ecbbd[_0xd4de('0x6')],agents[_0x5ecbbd[_0xd4de('0x12')]]['membername'],_0x5ecbbd[_0xd4de('0x12')]));agents[_0x5ecbbd[_0xd4de('0x12')]][_0xd4de('0xe')]=!![];agents[_0x5ecbbd[_0xd4de('0x12')]]['agentcompleteAt']=utils[_0xd4de('0x17')]();agents[_0x5ecbbd[_0xd4de('0x12')]][_0xd4de('0x22')]=utils[_0xd4de('0x31')](agents[_0x5ecbbd[_0xd4de('0x12')]][_0xd4de('0x32')],agents[_0x5ecbbd['destuniqueid']][_0xd4de('0x33')]);agents[_0x5ecbbd[_0xd4de('0x12')]][_0xd4de('0x20')]=_0x5ecbbd[_0xd4de('0x20')];agents[_0x5ecbbd[_0xd4de('0x12')]][_0xd4de('0xc')]=_0xd4de('0x34');writeDB(agents[_0x5ecbbd[_0xd4de('0x12')]]);}}catch(_0xaf442c){utils[_0xd4de('0x23')](util['format'](_0xd4de('0x30'),_0x5ecbbd[_0xd4de('0x6')]),_0xaf442c);}};exports[_0xd4de('0x35')]=function(_0x518bfe){try{if(!_[_0xd4de('0x1b')](agents[_0x518bfe[_0xd4de('0x36')]])){utils[_0xd4de('0x14')](util[_0xd4de('0x4')](_0xd4de('0x37'),_0x518bfe[_0xd4de('0x6')]),_0x518bfe);utils[_0xd4de('0x3')](util[_0xd4de('0x4')](_0xd4de('0x38'),_0x518bfe[_0xd4de('0x6')],agents[_0x518bfe['transfereruniqueid']][_0xd4de('0x9')],agents[_0x518bfe[_0xd4de('0x36')]][_0xd4de('0x6')]));agents[_0x518bfe[_0xd4de('0x36')]][_0xd4de('0x39')]=!![];agents[_0x518bfe['transfereruniqueid']]['transfertype']=_0xd4de('0x3a');agents[_0x518bfe[_0xd4de('0x36')]]['transferexten']=_0x518bfe['extension'];agents[_0x518bfe[_0xd4de('0x36')]][_0xd4de('0x3b')]=agents[_0x518bfe[_0xd4de('0x36')]][_0xd4de('0x6')];}}catch(_0x34d772){utils[_0xd4de('0x23')](util[_0xd4de('0x4')](_0xd4de('0x37'),_0x518bfe[_0xd4de('0x6')]),_0x34d772);}};exports[_0xd4de('0x3c')]=function(_0x3be8c2){try{utils[_0xd4de('0x14')](util['format'](_0xd4de('0x3d'),_0x3be8c2[_0xd4de('0x3e')]),_0x3be8c2);if(_0x3be8c2[_0xd4de('0x3e')]==_0x3be8c2[_0xd4de('0x3f')]){if(!_[_0xd4de('0x1b')](agents[_0x3be8c2[_0xd4de('0x40')]])){utils['info'](util[_0xd4de('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x3be8c2['origtransfereruniqueid'],agents[_0x3be8c2[_0xd4de('0x40')]][_0xd4de('0x9')]));agents[_0x3be8c2[_0xd4de('0x40')]][_0xd4de('0x39')]=!![];agents[_0x3be8c2['secondtransfereruniqueid']][_0xd4de('0x41')]=_0xd4de('0x42');agents[_0x3be8c2[_0xd4de('0x40')]][_0xd4de('0x43')]=_0x3be8c2[_0xd4de('0x44')];agents[_0x3be8c2['secondtransfereruniqueid']]['transferuniqueid']=_0x3be8c2['origtransfereruniqueid'];}if(_0x3be8c2[_0xd4de('0x45')]&&agents[_0x3be8c2[_0xd4de('0x45')]]){agents[_0x3be8c2[_0xd4de('0x45')]][_0xd4de('0x46')]=0x1;transfers[_0x3be8c2['transfereeuniqueid']]=_[_0xd4de('0x47')](agents[_0x3be8c2[_0xd4de('0x45')]]);transfers[_0x3be8c2[_0xd4de('0x45')]][_0xd4de('0xa')]=agents[_0x3be8c2['secondtransfereruniqueid']][_0xd4de('0xa')];transfers[_0x3be8c2[_0xd4de('0x45')]][_0xd4de('0x48')]=agents[_0x3be8c2[_0xd4de('0x40')]]['calleridname'];transfers[_0x3be8c2['transfereeuniqueid']]['agentcalledAt']=utils[_0xd4de('0x17')]();transfers[_0x3be8c2[_0xd4de('0x45')]][_0xd4de('0x33')]=utils['now']();transfers[_0x3be8c2[_0xd4de('0x45')]][_0xd4de('0x2a')]=0x0;transfers[_0x3be8c2[_0xd4de('0x45')]]['agententerreason']=0x2;}}else if(_0x3be8c2[_0xd4de('0x40')]==_0x3be8c2['secondtransfererlinkedid']){if(!_[_0xd4de('0x1b')](agents[_0x3be8c2[_0xd4de('0x3e')]])){utils[_0xd4de('0x3')](util[_0xd4de('0x4')](_0xd4de('0x49'),_0x3be8c2[_0xd4de('0x3e')],agents[_0x3be8c2[_0xd4de('0x3e')]][_0xd4de('0x9')]));agents[_0x3be8c2['origtransfereruniqueid']][_0xd4de('0x39')]=!![];agents[_0x3be8c2['origtransfereruniqueid']][_0xd4de('0x41')]=_0xd4de('0x42');agents[_0x3be8c2['origtransfereruniqueid']][_0xd4de('0x43')]=_0x3be8c2[_0xd4de('0x4a')];agents[_0x3be8c2[_0xd4de('0x3e')]][_0xd4de('0x3b')]=_0x3be8c2[_0xd4de('0x40')];}if(_0x3be8c2[_0xd4de('0x4b')]&&agents[_0x3be8c2[_0xd4de('0x4b')]]){agents[_0x3be8c2[_0xd4de('0x4b')]][_0xd4de('0x46')]=0x1;transfers[_0x3be8c2[_0xd4de('0x4b')]]=_[_0xd4de('0x47')](agents[_0x3be8c2[_0xd4de('0x4b')]]);transfers[_0x3be8c2[_0xd4de('0x4b')]]['calleridnum']=agents[_0x3be8c2[_0xd4de('0x3e')]][_0xd4de('0xa')];transfers[_0x3be8c2[_0xd4de('0x4b')]][_0xd4de('0x48')]=agents[_0x3be8c2[_0xd4de('0x3e')]][_0xd4de('0x48')];transfers[_0x3be8c2[_0xd4de('0x4b')]][_0xd4de('0x16')]=utils['now']();transfers[_0x3be8c2[_0xd4de('0x4b')]]['agentconnectAt']=utils['now']();transfers[_0x3be8c2['transfertargetuniqueid']][_0xd4de('0x2a')]=0x0;transfers[_0x3be8c2[_0xd4de('0x4b')]]['agententerreason']=0x2;}}}catch(_0x4a06b2){utils['error'](util['format'](_0xd4de('0x3d'),_0x3be8c2['origtransfereruniqueid']),_0x4a06b2);}};exports[_0xd4de('0x4c')]=function(_0x5ddba5){try{utils[_0xd4de('0x14')](util[_0xd4de('0x4')]('[%s][agents][hangup]',_0x5ddba5['uniqueid']),_0x5ddba5);if(agents[_0x5ddba5['uniqueid']]&&agents[_0x5ddba5['uniqueid']][_0xd4de('0x20')]===_0xd4de('0x1f')){if(_0x5ddba5[_0xd4de('0x4d')]==='21'){agents[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x20')]=_0xd4de('0x4e');agents[_0x5ddba5['uniqueid']]['lastevent']='rejected';}utils[_0xd4de('0x3')](util[_0xd4de('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5ddba5[_0xd4de('0x6')],agents[_0x5ddba5['uniqueid']][_0xd4de('0x9')],agents[_0x5ddba5['uniqueid']][_0xd4de('0x20')],agents[_0x5ddba5[_0xd4de('0x6')]]['lastevent']));writeDB(agents[_0x5ddba5[_0xd4de('0x6')]]);var _0x5a4882=unanswered[_0xd4de('0x4f')](_0x5ddba5[_0xd4de('0x6')]);if(_0x5a4882>-0x1){unanswered[_0xd4de('0x50')](_0x5a4882,0x1);}}if(transfers[_0x5ddba5[_0xd4de('0x6')]]){transfers[_0x5ddba5['uniqueid']][_0xd4de('0xe')]=!![];transfers[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x32')]=utils[_0xd4de('0x17')]();transfers[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x22')]=utils[_0xd4de('0x31')](transfers[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x32')],transfers[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x33')]);transfers[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x20')]='agent';transfers[_0x5ddba5[_0xd4de('0x6')]]['lastevent']='complete';utils[_0xd4de('0x3')](util[_0xd4de('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5ddba5[_0xd4de('0x6')],transfers[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x9')],transfers[_0x5ddba5[_0xd4de('0x6')]]['reason'],transfers[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0xc')]));writeDB(transfers[_0x5ddba5[_0xd4de('0x6')]],!![]);}if(agents[_0x5ddba5[_0xd4de('0x6')]]&&agents[_0x5ddba5[_0xd4de('0x6')]]['agentconnectAt']){agents[_0x5ddba5['uniqueid']]['agentcomplete']=!![];agents[_0x5ddba5['uniqueid']][_0xd4de('0x32')]=utils['now']();agents[_0x5ddba5[_0xd4de('0x6')]]['talktime']=utils[_0xd4de('0x31')](agents[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x32')],agents[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x33')]);agents[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x20')]=agents[_0x5ddba5[_0xd4de('0x6')]]['transfer']?_0xd4de('0x39'):_0xd4de('0x51');agents[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0xc')]='complete';utils[_0xd4de('0x3')](util[_0xd4de('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5ddba5[_0xd4de('0x6')],agents[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x9')],agents[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x20')],agents[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0xc')]));writeDB(agents[_0x5ddba5[_0xd4de('0x6')]]);}}catch(_0x27fd09){utils[_0xd4de('0x23')](util[_0xd4de('0x4')]('[%s][agents][hangup]',_0x5ddba5[_0xd4de('0x6')]),_0x27fd09);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 2981fd5..4604e7e 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 _0x20b6=['then','request','CreateVoiceCallReport','recording','newchannel','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','now','DOCUMENTATION','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','context','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','destinationchannel','answertime','disposition','toNumber','error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','diffTime','endtime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','musiconholdstartAt','mohtime','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','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:sipcallid\x20value:%s','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','application','appdata','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','includes','execif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal'];(function(_0x105595,_0xf44fe5){var _0x2535af=function(_0x1140b0){while(--_0x1140b0){_0x105595['push'](_0x105595['shift']());}};_0x2535af(++_0xf44fe5);}(_0x20b6,0x1ab));var _0x620b=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x20b6[_0x369151];return _0x4292d5;};'use strict';var _=require(_0x620b('0x0'));var util=require(_0x620b('0x1'));var utils=require(_0x620b('0x2'));var transfers=require(_0x620b('0x3'));var dispositions=[_0x620b('0x4'),'FAILED',_0x620b('0x5'),'NO\x20ANSWER',_0x620b('0x4'),'NO\x20ANSWER',_0x620b('0x6'),_0x620b('0x7'),'FAILED',_0x620b('0x5'),_0x620b('0x5')];var channels={};function writeDB(_0x8f0326){var _0x55d3ef;if(transfers[_0x620b('0x8')][_0x8f0326[_0x620b('0x9')]]){_0x55d3ef=_0x8f0326[_0x620b('0x9')];_0x8f0326[_0x620b('0x9')]=transfers[_0x620b('0x8')][_0x8f0326[_0x620b('0x9')]][_0x620b('0xa')];}utils[_0x620b('0xb')](util[_0x620b('0xc')](_0x620b('0xd'),_0x8f0326[_0x620b('0x9')],_0x8f0326[_0x620b('0xe')],_0x8f0326[_0x620b('0xf')],_0x8f0326['membername'],_0x8f0326[_0x620b('0x10')],_0x8f0326[_0x620b('0x11')],_0x8f0326[_0x620b('0x12')],_0x8f0326['lastevent']));if(_0x8f0326[_0x620b('0x13')]){utils[_0x620b('0x14')](_0x8f0326['accountcode'])[_0x620b('0x15')](function(_0x312a18){if(_0x312a18){_0x8f0326['UserId']=_0x312a18['id'];}utils[_0x620b('0x16')](_0x620b('0x17'),_0x8f0326);});}else{utils['request'](_0x620b('0x17'),_0x8f0326);}if(channels[_0x8f0326['uniqueid']]){delete channels[_0x8f0326['uniqueid']];}else if(_0x55d3ef&&channels[_0x55d3ef]){if(!transfers[_0x620b('0x8')][_0x55d3ef][_0x620b('0x18')])delete transfers['blinds'][_0x55d3ef];delete channels[_0x55d3ef];}}exports[_0x620b('0x19')]=function(_0x2d4efb){try{utils[_0x620b('0x1a')](util[_0x620b('0xc')](_0x620b('0x1b'),_0x2d4efb[_0x620b('0x9')]),_0x2d4efb);if(_0x2d4efb['uniqueid']==_0x2d4efb['linkedid']&&_0x2d4efb[_0x620b('0xe')]!=_0x620b('0x1c')){utils[_0x620b('0xb')](util['format'](_0x620b('0x1d'),_0x2d4efb[_0x620b('0x9')],_0x2d4efb['context'],_0x2d4efb[_0x620b('0x1e')]));channels[_0x2d4efb[_0x620b('0x9')]]={'uniqueid':_0x2d4efb['uniqueid'],'accountcode':_0x2d4efb[_0x620b('0x13')],'source':_0x2d4efb[_0x620b('0x11')],'destination':_0x2d4efb[_0x620b('0x1e')],'destinationcontext':_0x2d4efb['context'],'channel':_0x2d4efb['channel'],'starttime':utils[_0x620b('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x620b('0x4'),'amaflags':_0x620b('0x20')};}}catch(_0x12193d){utils['error'](util[_0x620b('0xc')](_0x620b('0x1b'),_0x2d4efb[_0x620b('0x9')]),_0x12193d);}};exports[_0x620b('0x21')]=function(_0x31b082){try{utils[_0x620b('0x1a')](util[_0x620b('0xc')](_0x620b('0x22'),_0x31b082[_0x620b('0x9')]),_0x31b082);if(!_[_0x620b('0x23')](channels[_0x31b082[_0x620b('0x9')]])&&_0x31b082[_0x620b('0x24')]==0x6){utils[_0x620b('0xb')](util[_0x620b('0xc')](_0x620b('0x25'),_0x31b082[_0x620b('0x9')],_0x31b082[_0x620b('0x26')],_0x31b082[_0x620b('0xe')]));if(_[_0x620b('0x23')](channels[_0x31b082[_0x620b('0x9')]][_0x620b('0x27')])){channels[_0x31b082[_0x620b('0x9')]][_0x620b('0x27')]=utils[_0x620b('0x1f')]();}}else if(!_[_0x620b('0x23')](channels[_0x31b082['linkedid']])&&_0x31b082[_0x620b('0x24')]==0x6&&_0x31b082['context']!=_0x620b('0x28')){utils['info'](util[_0x620b('0xc')](_0x620b('0x29'),_0x31b082['uniqueid'],_0x31b082[_0x620b('0x2a')],_0x31b082[_0x620b('0x26')],_0x31b082[_0x620b('0xe')]));channels[_0x31b082[_0x620b('0x2a')]][_0x620b('0x13')]=_0x31b082[_0x620b('0x13')];channels[_0x31b082['linkedid']][_0x620b('0x2b')]=_0x31b082['channel'];if(_[_0x620b('0x23')](channels[_0x31b082['linkedid']]['answertime'])){channels[_0x31b082['linkedid']][_0x620b('0x2c')]=utils[_0x620b('0x1f')]();}channels[_0x31b082[_0x620b('0x2a')]][_0x620b('0x2d')]=dispositions[_[_0x620b('0x2e')](_0x31b082['channelstate'])]||_0x620b('0x6');}}catch(_0x20bf00){utils[_0x620b('0x2f')](util[_0x620b('0xc')](_0x620b('0x22'),_0x31b082['uniqueid']),_0x20bf00);}};exports[_0x620b('0x30')]=function(_0x5f367d){try{if(!_[_0x620b('0x23')](channels[_0x5f367d[_0x620b('0x9')]])){utils['debug'](util[_0x620b('0xc')](_0x620b('0x31'),_0x5f367d['uniqueid']),_0x5f367d);if(_[_0x620b('0x23')](channels[_0x5f367d[_0x620b('0x9')]][_0x620b('0x32')])){channels[_0x5f367d[_0x620b('0x9')]]['callerid']=_0x5f367d[_0x620b('0x33')]+'\x20<'+_0x5f367d[_0x620b('0x11')]+'>';}utils[_0x620b('0xb')](util[_0x620b('0xc')](_0x620b('0x34'),_0x5f367d['uniqueid'],channels[_0x5f367d[_0x620b('0x9')]][_0x620b('0x32')],_0x5f367d['cause-txt']));channels[_0x5f367d[_0x620b('0x9')]]['endtime']=utils['now']();channels[_0x5f367d['uniqueid']]['duration']=utils[_0x620b('0x35')](channels[_0x5f367d[_0x620b('0x9')]][_0x620b('0x36')],channels[_0x5f367d[_0x620b('0x9')]][_0x620b('0x37')]);channels[_0x5f367d[_0x620b('0x9')]][_0x620b('0x38')]=channels[_0x5f367d[_0x620b('0x9')]][_0x620b('0x2c')]?utils[_0x620b('0x35')](channels[_0x5f367d[_0x620b('0x9')]]['endtime'],channels[_0x5f367d[_0x620b('0x9')]][_0x620b('0x2c')]):0x0;writeDB(channels[_0x5f367d['uniqueid']]);}}catch(_0x4afa81){utils[_0x620b('0x2f')](util['format']('[%s][calls][hangup]',_0x5f367d[_0x620b('0x9')]),_0x4afa81);}};exports[_0x620b('0x39')]=function(_0x224a45){try{if(!_[_0x620b('0x23')](channels[_0x224a45[_0x620b('0x3a')]])){utils['debug'](util[_0x620b('0xc')](_0x620b('0x3b'),_0x224a45[_0x620b('0x3c')]),_0x224a45);if(channels[_0x224a45['localtwolinkedid']][_0x620b('0xe')]==_0x224a45['transfereechannel']){utils['info'](util[_0x620b('0xc')](_0x620b('0x3d'),_0x224a45[_0x620b('0x3c')],_0x224a45[_0x620b('0x3a')],_0x224a45['secondtransfererchannel']));channels[_0x224a45[_0x620b('0x3a')]][_0x620b('0x2b')]=_0x224a45[_0x620b('0x3e')];channels[_0x224a45[_0x620b('0x3a')]]['userfield']=_0x620b('0x3f');}else if(channels[_0x224a45[_0x620b('0x3a')]][_0x620b('0xe')]=_0x224a45[_0x620b('0x40')]){utils[_0x620b('0xb')](util[_0x620b('0xc')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x224a45[_0x620b('0x3c')],_0x224a45[_0x620b('0x3a')],_0x224a45[_0x620b('0x41')]));channels[_0x224a45[_0x620b('0x3a')]]['destinationchannel']=_0x224a45[_0x620b('0x41')];channels[_0x224a45[_0x620b('0x3a')]][_0x620b('0x42')]=_0x620b('0x3f');}}}catch(_0x1c1835){utils[_0x620b('0x2f')](util['format'](_0x620b('0x3b'),_0x224a45['origtransfereruniqueid']),_0x1c1835);}};exports['musiconholdstart']=function(_0x5e33c7){try{if(!_[_0x620b('0x23')](channels[_0x5e33c7['uniqueid']])){utils[_0x620b('0x1a')](util[_0x620b('0xc')](_0x620b('0x43'),_0x5e33c7['uniqueid']),_0x5e33c7);channels[_0x5e33c7[_0x620b('0x9')]]['musiconholdstartAt']=utils[_0x620b('0x1f')]();utils['info'](util[_0x620b('0xc')](_0x620b('0x44'),_0x5e33c7[_0x620b('0x9')],channels[_0x5e33c7[_0x620b('0x9')]]['musiconholdstartAt']));}}catch(_0x5ba638){utils[_0x620b('0x2f')](util[_0x620b('0xc')](_0x620b('0x43'),_0x5e33c7[_0x620b('0x9')]),_0x5ba638);}};exports[_0x620b('0x45')]=function(_0xbb4a2){try{if(!_[_0x620b('0x23')](channels[_0xbb4a2[_0x620b('0x9')]])){utils[_0x620b('0x1a')](util['format'](_0x620b('0x46'),_0xbb4a2[_0x620b('0x9')]),_0xbb4a2);if(!_[_0x620b('0x23')](channels[_0xbb4a2[_0x620b('0x9')]][_0x620b('0x47')])){channels[_0xbb4a2[_0x620b('0x9')]][_0x620b('0x48')]+=utils[_0x620b('0x35')](utils['now'](),channels[_0xbb4a2['uniqueid']][_0x620b('0x47')]);utils[_0x620b('0xb')](util[_0x620b('0xc')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0xbb4a2[_0x620b('0x9')],channels[_0xbb4a2[_0x620b('0x9')]][_0x620b('0x48')]));delete channels[_0xbb4a2[_0x620b('0x9')]][_0x620b('0x47')];}}}catch(_0x1c79c9){utils[_0x620b('0x2f')](util['format'](_0x620b('0x46'),_0xbb4a2[_0x620b('0x9')]),_0x1c79c9);}};exports['varset']=function(_0x43b2fc){try{if(!_[_0x620b('0x23')](channels[_0x43b2fc[_0x620b('0x9')]])){utils['debug'](util[_0x620b('0xc')]('[%s][calls][varset]',_0x43b2fc['uniqueid']),_0x43b2fc);if(!_['isNil'](_0x43b2fc[_0x620b('0x49')]['xmd-originatecalleridnum'])){utils[_0x620b('0xb')](util['format'](_0x620b('0x4a'),_0x43b2fc[_0x620b('0x9')],_0x43b2fc[_0x620b('0x4b')]));channels[_0x43b2fc[_0x620b('0x9')]][_0x620b('0x4c')]=_0x43b2fc[_0x620b('0x4b')];}if(!_['isNil'](_0x43b2fc['variable'][_0x620b('0x4d')])){utils[_0x620b('0xb')](util[_0x620b('0xc')](_0x620b('0x4e'),_0x43b2fc[_0x620b('0x9')],_0x43b2fc[_0x620b('0x4b')]));channels[_0x43b2fc[_0x620b('0x9')]][_0x620b('0x4f')]=_0x43b2fc[_0x620b('0x4b')];channels[_0x43b2fc[_0x620b('0x9')]][_0x620b('0x32')]='\x22'+_0x43b2fc[_0x620b('0x4b')]+_0x620b('0x50')+_0x43b2fc[_0x620b('0x4b')]+'>';}if(!_[_0x620b('0x23')](_0x43b2fc[_0x620b('0x49')][_0x620b('0x51')])||!_[_0x620b('0x23')](_0x43b2fc[_0x620b('0x49')]['xmd-callerid'])){utils[_0x620b('0xb')](util[_0x620b('0xc')](_0x620b('0x52'),_0x43b2fc[_0x620b('0x9')],!_[_0x620b('0x23')](_0x43b2fc[_0x620b('0x49')][_0x620b('0x51')])?_0x620b('0x51'):_0x620b('0x53'),_0x43b2fc['value']));channels[_0x43b2fc[_0x620b('0x9')]][_0x620b('0x32')]=_0x43b2fc[_0x620b('0x4b')];}if(!_[_0x620b('0x23')](_0x43b2fc[_0x620b('0x49')][_0x620b('0x54')])||!_[_0x620b('0x23')](_0x43b2fc[_0x620b('0x49')][_0x620b('0x55')])){utils['info'](util['format'](_0x620b('0x52'),_0x43b2fc['uniqueid'],!_[_0x620b('0x23')](_0x43b2fc[_0x620b('0x49')][_0x620b('0x54')])?_0x620b('0x54'):_0x620b('0x55'),_0x43b2fc[_0x620b('0x4b')]));channels[_0x43b2fc[_0x620b('0x9')]][_0x620b('0x56')]=_0x620b('0x57');channels[_0x43b2fc[_0x620b('0x9')]][_0x620b('0x58')]=_0x43b2fc[_0x620b('0x4b')];channels[_0x43b2fc['uniqueid']][_0x620b('0xf')]=!![];}if(!_[_0x620b('0x23')](_0x43b2fc[_0x620b('0x49')][_0x620b('0x59')])){utils[_0x620b('0xb')](util[_0x620b('0xc')](_0x620b('0x5a'),_0x43b2fc[_0x620b('0x9')],_0x43b2fc[_0x620b('0x4b')]));channels[_0x43b2fc[_0x620b('0x9')]][_0x620b('0x5b')]=_0x43b2fc['value'];}if(!_[_0x620b('0x23')](_0x43b2fc['variable'][_0x620b('0x5c')])){utils[_0x620b('0xb')](util[_0x620b('0xc')](_0x620b('0x5d'),_0x43b2fc['uniqueid'],_0x43b2fc[_0x620b('0x4b')]));channels[_0x43b2fc[_0x620b('0x9')]][_0x620b('0x5e')]=_0x43b2fc[_0x620b('0x4b')];}if(!_[_0x620b('0x23')](_0x43b2fc[_0x620b('0x49')][_0x620b('0x5f')])){utils[_0x620b('0xb')](util[_0x620b('0xc')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x43b2fc['uniqueid'],_0x43b2fc[_0x620b('0x4b')]));channels[_0x43b2fc[_0x620b('0x9')]]['routeid']=_0x43b2fc[_0x620b('0x4b')];}if(!_[_0x620b('0x23')](_0x43b2fc[_0x620b('0x49')]['sipcallid'])){utils['info'](util[_0x620b('0xc')](_0x620b('0x60'),_0x43b2fc[_0x620b('0x9')],_0x43b2fc[_0x620b('0x4b')]));channels[_0x43b2fc['uniqueid']][_0x620b('0x61')]=_0x43b2fc[_0x620b('0x4b')];}}}catch(_0x31cbd9){utils[_0x620b('0x2f')](util[_0x620b('0xc')](_0x620b('0x62'),_0x43b2fc[_0x620b('0x9')]),_0x31cbd9);}};exports[_0x620b('0x63')]=function(_0x568eed){try{if(!_['isNil'](channels[_0x568eed[_0x620b('0x9')]])){utils[_0x620b('0x1a')](util[_0x620b('0xc')](_0x620b('0x64'),_0x568eed[_0x620b('0x9')]),_0x568eed);utils[_0x620b('0xb')](util[_0x620b('0xc')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x568eed['uniqueid'],_0x568eed[_0x620b('0x65')],_0x568eed[_0x620b('0x66')]));if(_0x568eed[_0x620b('0x65')]['toLowerCase']()==_0x620b('0x67')&&_[_0x620b('0x68')](_0x568eed[_0x620b('0x66')][_0x620b('0x69')](),_0x620b('0x6a'))){var _0x15b052=_0x568eed[_0x620b('0x66')][_0x620b('0x6b')]('=');var _0x11f82d=_0x15b052[0x0][_0x620b('0x6c')](_0x15b052[0x0][_0x620b('0x6d')]('(')+0x1,_0x15b052[0x0][_0x620b('0x6d')](')'));var _0x4cfe7b=_0x15b052[0x1];channels[_0x568eed[_0x620b('0x9')]][_0x11f82d]=_0x4cfe7b;}if(!_[_0x620b('0x6e')](['hangup','noop',_0x620b('0x6f'),_0x620b('0x67'),'gotoif'],_0x568eed['application'][_0x620b('0x69')]())){channels[_0x568eed[_0x620b('0x9')]][_0x620b('0x56')]=_0x568eed[_0x620b('0x65')];channels[_0x568eed['uniqueid']][_0x620b('0x58')]=_0x568eed[_0x620b('0x66')];}}}catch(_0x3f9243){utils[_0x620b('0x2f')](util[_0x620b('0xc')]('[%s][calls][newexten]',_0x568eed[_0x620b('0x9')]),_0x3f9243);}}; \ No newline at end of file +var _0xb458=['mohtime','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','includes','execif','gotoif','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','uniqueid','blinds','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','connectedlinenum','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','newchannel','debug','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','isNil','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','now','toNumber','channelstate','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','endtime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','localtwolinkedid','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]'];(function(_0x946fb9,_0xf2b58b){var _0x2a16b6=function(_0x545b09){while(--_0x545b09){_0x946fb9['push'](_0x946fb9['shift']());}};_0x2a16b6(++_0xf2b58b);}(_0xb458,0x94));var _0x8b45=function(_0x397eee,_0x5ad835){_0x397eee=_0x397eee-0x0;var _0x3d3fcc=_0xb458[_0x397eee];return _0x3d3fcc;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var utils=require(_0x8b45('0x2'));var transfers=require('./transfers.controller');var dispositions=['NO\x20ANSWER',_0x8b45('0x3'),'FAILED',_0x8b45('0x4'),_0x8b45('0x4'),_0x8b45('0x4'),_0x8b45('0x5'),'BUSY',_0x8b45('0x3'),_0x8b45('0x3'),_0x8b45('0x3')];var channels={};function writeDB(_0x24e0bc){var _0x3d3381;if(transfers['blinds'][_0x24e0bc['uniqueid']]){_0x3d3381=_0x24e0bc[_0x8b45('0x6')];_0x24e0bc[_0x8b45('0x6')]=transfers[_0x8b45('0x7')][_0x24e0bc[_0x8b45('0x6')]][_0x8b45('0x8')];}utils[_0x8b45('0x9')](util[_0x8b45('0xa')](_0x8b45('0xb'),_0x24e0bc['uniqueid'],_0x24e0bc[_0x8b45('0xc')],_0x24e0bc[_0x8b45('0xd')],_0x24e0bc[_0x8b45('0xe')],_0x24e0bc[_0x8b45('0xf')],_0x24e0bc[_0x8b45('0x10')],_0x24e0bc[_0x8b45('0x11')],_0x24e0bc['lastevent']));if(_0x24e0bc[_0x8b45('0x12')]){utils[_0x8b45('0x13')](_0x24e0bc[_0x8b45('0x12')])[_0x8b45('0x14')](function(_0x28af66){if(_0x28af66){_0x24e0bc['UserId']=_0x28af66['id'];}utils[_0x8b45('0x15')](_0x8b45('0x16'),_0x24e0bc);});}else{utils[_0x8b45('0x15')](_0x8b45('0x16'),_0x24e0bc);}if(channels[_0x24e0bc[_0x8b45('0x6')]]){delete channels[_0x24e0bc[_0x8b45('0x6')]];}else if(_0x3d3381&&channels[_0x3d3381]){if(!transfers[_0x8b45('0x7')][_0x3d3381]['recording'])delete transfers['blinds'][_0x3d3381];delete channels[_0x3d3381];}}exports[_0x8b45('0x17')]=function(_0x43b9c7){try{utils[_0x8b45('0x18')](util['format']('[%s][calls][newchannel]',_0x43b9c7['uniqueid']),_0x43b9c7);if(_0x43b9c7[_0x8b45('0x6')]==_0x43b9c7[_0x8b45('0x19')]&&_0x43b9c7[_0x8b45('0xc')]!='OutgoingSpoolFailed'){utils[_0x8b45('0x9')](util[_0x8b45('0xa')](_0x8b45('0x1a'),_0x43b9c7[_0x8b45('0x6')],_0x43b9c7[_0x8b45('0x1b')],_0x43b9c7[_0x8b45('0x1c')]));channels[_0x43b9c7[_0x8b45('0x6')]]={'uniqueid':_0x43b9c7[_0x8b45('0x6')],'accountcode':_0x43b9c7[_0x8b45('0x12')],'source':_0x43b9c7[_0x8b45('0x10')],'destination':_0x43b9c7['exten'],'destinationcontext':_0x43b9c7[_0x8b45('0x1b')],'channel':_0x43b9c7['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x8b45('0x1d')};}}catch(_0x452006){utils[_0x8b45('0x1e')](util[_0x8b45('0xa')](_0x8b45('0x1f'),_0x43b9c7['uniqueid']),_0x452006);}};exports[_0x8b45('0x20')]=function(_0x1934b9){try{utils['debug'](util[_0x8b45('0xa')](_0x8b45('0x21'),_0x1934b9[_0x8b45('0x6')]),_0x1934b9);if(!_['isNil'](channels[_0x1934b9[_0x8b45('0x6')]])&&_0x1934b9['channelstate']==0x6){utils[_0x8b45('0x9')](util[_0x8b45('0xa')](_0x8b45('0x22'),_0x1934b9[_0x8b45('0x6')],_0x1934b9['context'],_0x1934b9[_0x8b45('0xc')]));if(_['isNil'](channels[_0x1934b9[_0x8b45('0x6')]][_0x8b45('0x23')])){channels[_0x1934b9['uniqueid']][_0x8b45('0x23')]=utils['now']();}}else if(!_[_0x8b45('0x24')](channels[_0x1934b9[_0x8b45('0x19')]])&&_0x1934b9['channelstate']==0x6&&_0x1934b9['context']!=_0x8b45('0x25')){utils['info'](util['format'](_0x8b45('0x26'),_0x1934b9[_0x8b45('0x6')],_0x1934b9[_0x8b45('0x19')],_0x1934b9['context'],_0x1934b9[_0x8b45('0xc')]));channels[_0x1934b9[_0x8b45('0x19')]][_0x8b45('0x12')]=_0x1934b9[_0x8b45('0x12')];channels[_0x1934b9[_0x8b45('0x19')]][_0x8b45('0x27')]=_0x1934b9['channel'];if(_[_0x8b45('0x24')](channels[_0x1934b9[_0x8b45('0x19')]][_0x8b45('0x28')])){channels[_0x1934b9['linkedid']][_0x8b45('0x28')]=utils[_0x8b45('0x29')]();}channels[_0x1934b9[_0x8b45('0x19')]]['disposition']=dispositions[_[_0x8b45('0x2a')](_0x1934b9[_0x8b45('0x2b')])]||'ANSWERED';}}catch(_0x355e4b){utils[_0x8b45('0x1e')](util[_0x8b45('0xa')]('[%s][calls][newstate]',_0x1934b9[_0x8b45('0x6')]),_0x355e4b);}};exports[_0x8b45('0x2c')]=function(_0xf52510){try{if(!_['isNil'](channels[_0xf52510[_0x8b45('0x6')]])){utils[_0x8b45('0x18')](util[_0x8b45('0xa')]('[%s][calls][hangup]',_0xf52510['uniqueid']),_0xf52510);if(_[_0x8b45('0x24')](channels[_0xf52510[_0x8b45('0x6')]][_0x8b45('0x2d')])){channels[_0xf52510['uniqueid']][_0x8b45('0x2d')]=_0xf52510[_0x8b45('0x2e')]+'\x20<'+_0xf52510['calleridnum']+'>';}utils[_0x8b45('0x9')](util[_0x8b45('0xa')](_0x8b45('0x2f'),_0xf52510[_0x8b45('0x6')],channels[_0xf52510[_0x8b45('0x6')]][_0x8b45('0x2d')],_0xf52510[_0x8b45('0x30')]));channels[_0xf52510[_0x8b45('0x6')]]['endtime']=utils[_0x8b45('0x29')]();channels[_0xf52510[_0x8b45('0x6')]][_0x8b45('0x31')]=utils[_0x8b45('0x32')](channels[_0xf52510[_0x8b45('0x6')]][_0x8b45('0x33')],channels[_0xf52510[_0x8b45('0x6')]][_0x8b45('0x34')]);channels[_0xf52510[_0x8b45('0x6')]][_0x8b45('0x35')]=channels[_0xf52510[_0x8b45('0x6')]][_0x8b45('0x28')]?utils['diffTime'](channels[_0xf52510['uniqueid']]['endtime'],channels[_0xf52510[_0x8b45('0x6')]]['answertime']):0x0;writeDB(channels[_0xf52510[_0x8b45('0x6')]]);}}catch(_0x3d1b07){utils[_0x8b45('0x1e')](util['format'](_0x8b45('0x36'),_0xf52510[_0x8b45('0x6')]),_0x3d1b07);}};exports[_0x8b45('0x37')]=function(_0x3807dc){try{if(!_[_0x8b45('0x24')](channels[_0x3807dc['localtwolinkedid']])){utils[_0x8b45('0x18')](util[_0x8b45('0xa')]('[%s][calls][attendedtransfer]',_0x3807dc['origtransfereruniqueid']),_0x3807dc);if(channels[_0x3807dc['localtwolinkedid']]['channel']==_0x3807dc[_0x8b45('0x38')]){utils[_0x8b45('0x9')](util[_0x8b45('0xa')](_0x8b45('0x39'),_0x3807dc[_0x8b45('0x3a')],_0x3807dc['localtwolinkedid'],_0x3807dc[_0x8b45('0x3b')]));channels[_0x3807dc['localtwolinkedid']][_0x8b45('0x27')]=_0x3807dc[_0x8b45('0x3b')];channels[_0x3807dc['localtwolinkedid']][_0x8b45('0x3c')]=_0x8b45('0x3d');}else if(channels[_0x3807dc[_0x8b45('0x3e')]]['channel']=_0x3807dc[_0x8b45('0x3f')]){utils[_0x8b45('0x9')](util[_0x8b45('0xa')](_0x8b45('0x39'),_0x3807dc[_0x8b45('0x3a')],_0x3807dc[_0x8b45('0x3e')],_0x3807dc[_0x8b45('0x40')]));channels[_0x3807dc['localtwolinkedid']]['destinationchannel']=_0x3807dc[_0x8b45('0x40')];channels[_0x3807dc[_0x8b45('0x3e')]]['userfield']=_0x8b45('0x3d');}}}catch(_0x16603b){utils[_0x8b45('0x1e')](util['format']('[%s][calls][attendedtransfer]',_0x3807dc[_0x8b45('0x3a')]),_0x16603b);}};exports[_0x8b45('0x41')]=function(_0x2b475c){try{if(!_['isNil'](channels[_0x2b475c['uniqueid']])){utils[_0x8b45('0x18')](util[_0x8b45('0xa')]('[%s][calls][musiconholdstart]',_0x2b475c['uniqueid']),_0x2b475c);channels[_0x2b475c[_0x8b45('0x6')]][_0x8b45('0x42')]=utils[_0x8b45('0x29')]();utils[_0x8b45('0x9')](util['format']('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x2b475c[_0x8b45('0x6')],channels[_0x2b475c[_0x8b45('0x6')]][_0x8b45('0x42')]));}}catch(_0x15fc2a){utils[_0x8b45('0x1e')](util[_0x8b45('0xa')](_0x8b45('0x43'),_0x2b475c[_0x8b45('0x6')]),_0x15fc2a);}};exports[_0x8b45('0x44')]=function(_0x24acaa){try{if(!_[_0x8b45('0x24')](channels[_0x24acaa[_0x8b45('0x6')]])){utils[_0x8b45('0x18')](util['format'](_0x8b45('0x45'),_0x24acaa[_0x8b45('0x6')]),_0x24acaa);if(!_[_0x8b45('0x24')](channels[_0x24acaa[_0x8b45('0x6')]][_0x8b45('0x42')])){channels[_0x24acaa['uniqueid']][_0x8b45('0x46')]+=utils[_0x8b45('0x32')](utils[_0x8b45('0x29')](),channels[_0x24acaa[_0x8b45('0x6')]][_0x8b45('0x42')]);utils[_0x8b45('0x9')](util['format']('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x24acaa[_0x8b45('0x6')],channels[_0x24acaa['uniqueid']][_0x8b45('0x46')]));delete channels[_0x24acaa[_0x8b45('0x6')]][_0x8b45('0x42')];}}}catch(_0x56768b){utils[_0x8b45('0x1e')](util['format'](_0x8b45('0x45'),_0x24acaa[_0x8b45('0x6')]),_0x56768b);}};exports['varset']=function(_0x3cd323){try{if(!_[_0x8b45('0x24')](channels[_0x3cd323[_0x8b45('0x6')]])){utils[_0x8b45('0x18')](util[_0x8b45('0xa')](_0x8b45('0x47'),_0x3cd323['uniqueid']),_0x3cd323);if(!_[_0x8b45('0x24')](_0x3cd323[_0x8b45('0x48')][_0x8b45('0x49')])){utils[_0x8b45('0x9')](util['format'](_0x8b45('0x4a'),_0x3cd323[_0x8b45('0x6')],_0x3cd323[_0x8b45('0x4b')]));channels[_0x3cd323[_0x8b45('0x6')]]['source']=_0x3cd323[_0x8b45('0x4b')];}if(!_[_0x8b45('0x24')](_0x3cd323[_0x8b45('0x48')][_0x8b45('0x4c')])){utils[_0x8b45('0x9')](util[_0x8b45('0xa')](_0x8b45('0x4d'),_0x3cd323['uniqueid'],_0x3cd323['value']));channels[_0x3cd323[_0x8b45('0x6')]][_0x8b45('0x4e')]=_0x3cd323[_0x8b45('0x4b')];channels[_0x3cd323[_0x8b45('0x6')]][_0x8b45('0x2d')]='\x22'+_0x3cd323[_0x8b45('0x4b')]+_0x8b45('0x4f')+_0x3cd323['value']+'>';}if(!_['isNil'](_0x3cd323[_0x8b45('0x48')]['xmd-callerid-preview'])||!_[_0x8b45('0x24')](_0x3cd323[_0x8b45('0x48')][_0x8b45('0x50')])){utils[_0x8b45('0x9')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x3cd323[_0x8b45('0x6')],!_[_0x8b45('0x24')](_0x3cd323[_0x8b45('0x48')]['xmd-callerid-preview'])?_0x8b45('0x51'):_0x8b45('0x50'),_0x3cd323[_0x8b45('0x4b')]));channels[_0x3cd323[_0x8b45('0x6')]]['callerid']=_0x3cd323[_0x8b45('0x4b')];}if(!_[_0x8b45('0x24')](_0x3cd323['variable'][_0x8b45('0x52')])||!_[_0x8b45('0x24')](_0x3cd323[_0x8b45('0x48')]['xmcs-queue'])){utils[_0x8b45('0x9')](util[_0x8b45('0xa')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x3cd323[_0x8b45('0x6')],!_['isNil'](_0x3cd323[_0x8b45('0x48')][_0x8b45('0x52')])?_0x8b45('0x52'):_0x8b45('0x53'),_0x3cd323[_0x8b45('0x4b')]));channels[_0x3cd323[_0x8b45('0x6')]][_0x8b45('0x54')]=_0x8b45('0x55');channels[_0x3cd323['uniqueid']][_0x8b45('0x56')]=_0x3cd323[_0x8b45('0x4b')];channels[_0x3cd323[_0x8b45('0x6')]][_0x8b45('0xd')]=!![];}if(!_[_0x8b45('0x24')](_0x3cd323['variable'][_0x8b45('0x57')])){utils[_0x8b45('0x9')](util['format'](_0x8b45('0x58'),_0x3cd323[_0x8b45('0x6')],_0x3cd323[_0x8b45('0x4b')]));channels[_0x3cd323[_0x8b45('0x6')]]['ContactId']=_0x3cd323[_0x8b45('0x4b')];}if(!_[_0x8b45('0x24')](_0x3cd323[_0x8b45('0x48')][_0x8b45('0x59')])){utils['info'](util[_0x8b45('0xa')](_0x8b45('0x5a'),_0x3cd323['uniqueid'],_0x3cd323[_0x8b45('0x4b')]));channels[_0x3cd323[_0x8b45('0x6')]][_0x8b45('0x5b')]=_0x3cd323[_0x8b45('0x4b')];}if(!_['isNil'](_0x3cd323['variable'][_0x8b45('0x5c')])){utils[_0x8b45('0x9')](util[_0x8b45('0xa')](_0x8b45('0x5d'),_0x3cd323[_0x8b45('0x6')],_0x3cd323[_0x8b45('0x4b')]));channels[_0x3cd323[_0x8b45('0x6')]]['routeid']=_0x3cd323[_0x8b45('0x4b')];}if(!_[_0x8b45('0x24')](_0x3cd323[_0x8b45('0x48')][_0x8b45('0x5e')])){utils[_0x8b45('0x9')](util[_0x8b45('0xa')](_0x8b45('0x5f'),_0x3cd323[_0x8b45('0x6')],_0x3cd323[_0x8b45('0x4b')]));channels[_0x3cd323[_0x8b45('0x6')]][_0x8b45('0x5e')]=_0x3cd323['value'];}}}catch(_0xafd54d){utils['error'](util[_0x8b45('0xa')](_0x8b45('0x47'),_0x3cd323[_0x8b45('0x6')]),_0xafd54d);}};exports['newexten']=function(_0x43dcdd){try{if(!_[_0x8b45('0x24')](channels[_0x43dcdd[_0x8b45('0x6')]])){utils['debug'](util[_0x8b45('0xa')](_0x8b45('0x60'),_0x43dcdd['uniqueid']),_0x43dcdd);utils[_0x8b45('0x9')](util['format'](_0x8b45('0x61'),_0x43dcdd[_0x8b45('0x6')],_0x43dcdd['application'],_0x43dcdd[_0x8b45('0x62')]));if(_0x43dcdd[_0x8b45('0x63')][_0x8b45('0x64')]()==_0x8b45('0x65')&&_[_0x8b45('0x66')](_0x43dcdd['appdata'][_0x8b45('0x64')](),_0x8b45('0x67'))){var _0x4379ce=_0x43dcdd[_0x8b45('0x62')]['split']('=');var _0x137c64=_0x4379ce[0x0][_0x8b45('0x68')](_0x4379ce[0x0][_0x8b45('0x69')]('(')+0x1,_0x4379ce[0x0][_0x8b45('0x69')](')'));var _0x22bd2e=_0x4379ce[0x1];channels[_0x43dcdd['uniqueid']][_0x137c64]=_0x22bd2e;}if(!_[_0x8b45('0x6a')]([_0x8b45('0x2c'),'noop',_0x8b45('0x6b'),_0x8b45('0x65'),_0x8b45('0x6c')],_0x43dcdd[_0x8b45('0x63')][_0x8b45('0x64')]())){channels[_0x43dcdd['uniqueid']]['lastapplication']=_0x43dcdd[_0x8b45('0x63')];channels[_0x43dcdd['uniqueid']][_0x8b45('0x56')]=_0x43dcdd[_0x8b45('0x62')];}}}catch(_0x222ce3){utils['error'](util[_0x8b45('0xa')](_0x8b45('0x60'),_0x43dcdd[_0x8b45('0x6')]),_0x222ce3);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 38c212a..151db9c 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 _0x5e67=['error','[core]\x20error','close','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','[core]\x20fullybooted'];(function(_0x333100,_0x51d5d2){var _0x370b27=function(_0x2174fa){while(--_0x2174fa){_0x333100['push'](_0x333100['shift']());}};_0x370b27(++_0x51d5d2);}(_0x5e67,0x12f));var _0x75e6=function(_0x1991e6,_0x4a38c7){_0x1991e6=_0x1991e6-0x0;var _0x2487b0=_0x5e67[_0x1991e6];return _0x2487b0;};'use strict';var utils=require(_0x75e6('0x0'));exports[_0x75e6('0x1')]=function(){utils[_0x75e6('0x2')](_0x75e6('0x3'));};exports[_0x75e6('0x4')]=function(){utils[_0x75e6('0x2')](_0x75e6('0x5'));};exports['fullybooted']=function(){utils[_0x75e6('0x2')](_0x75e6('0x6'));};exports[_0x75e6('0x7')]=function(_0x54dec1){utils[_0x75e6('0x7')](_0x75e6('0x8'),_0x54dec1);};exports[_0x75e6('0x9')]=function(){utils[_0x75e6('0x2')]('[core]\x20close');};exports['managerevent']=function(_0x277d4b){}; \ No newline at end of file +var _0x4104=['fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','managerevent','connect','info','shutdown'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0x4104,0x180));var _0x4410=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0x4104[_0x4d8666];return _0x37175b;};'use strict';var utils=require('./utils');exports[_0x4410('0x0')]=function(){utils[_0x4410('0x1')]('[core]\x20connected');};exports[_0x4410('0x2')]=function(){utils[_0x4410('0x1')]('[core]\x20shutdown');};exports[_0x4410('0x3')]=function(){utils[_0x4410('0x1')](_0x4410('0x4'));};exports['error']=function(_0x57116d){utils[_0x4410('0x5')](_0x4410('0x6'),_0x57116d);};exports[_0x4410('0x7')]=function(){utils[_0x4410('0x1')]('[core]\x20close');};exports[_0x4410('0x8')]=function(_0xffb32){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 9d88e7a..3d9b086 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 _0x205b=['complete','duration','diffTime','endtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','request','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','set','startsWith','toLowerCase','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt'];(function(_0x34298f,_0x38515a){var _0x9d735f=function(_0x52436c){while(--_0x52436c){_0x34298f['push'](_0x34298f['shift']());}};_0x9d735f(++_0x38515a);}(_0x205b,0x9b));var _0xb205=function(_0x509b8f,_0x514ade){_0x509b8f=_0x509b8f-0x0;var _0x230014=_0x205b[_0x509b8f];return _0x230014;};'use strict';var _=require(_0xb205('0x0'));var util=require(_0xb205('0x1'));var utils=require(_0xb205('0x2'));var dials={};function writeDB(_0x13192f){utils[_0xb205('0x3')](util[_0xb205('0x4')](_0xb205('0x5'),_0x13192f[_0xb205('0x6')],_0x13192f[_0xb205('0x7')],_0x13192f['dialstring'],_0x13192f[_0xb205('0x8')],_0x13192f[_0xb205('0x9')],_0x13192f[_0xb205('0xa')]));utils[_0xb205('0xb')]('CreateVoiceDialReport',_0x13192f);delete dials[_0x13192f[_0xb205('0x6')]];}exports['newexten']=function(_0x490a00){try{utils[_0xb205('0xc')](util[_0xb205('0x4')](_0xb205('0xd'),_0x490a00[_0xb205('0x6')]),_0x490a00);utils[_0xb205('0x3')](util[_0xb205('0x4')](_0xb205('0xe'),_0x490a00['uniqueid'],_0x490a00['application'],_0x490a00[_0xb205('0xf')]));if(_0x490a00['application']['toLowerCase']()==_0xb205('0x10')&&_[_0xb205('0x11')](_0x490a00['appdata'][_0xb205('0x12')](),'cdr(routeid)')){var _0x343797=_0x490a00['appdata'][_0xb205('0x13')]('=');dials[_0x490a00[_0xb205('0x6')]]={'routeId':_0x343797[0x1]};}}catch(_0x5416b3){utils[_0xb205('0x14')](util[_0xb205('0x4')](_0xb205('0xd'),_0x490a00['uniqueid']),_0x5416b3);}};exports[_0xb205('0x15')]=function(_0xcfb334){try{utils[_0xb205('0xc')](util[_0xb205('0x4')](_0xb205('0x16'),_0xcfb334['uniqueid']),_0xcfb334);if(!_[_0xb205('0x17')](_0xcfb334[_0xb205('0x18')][_0xb205('0x19')])){utils[_0xb205('0x3')](util[_0xb205('0x4')](_0xb205('0x1a'),_0xcfb334[_0xb205('0x6')],_0xcfb334['value']));dials[_0xcfb334[_0xb205('0x6')]]={'routeId':_0xcfb334[_0xb205('0x1b')]};}}catch(_0x1aad4c){utils['error'](util[_0xb205('0x4')]('[%s][dials][varset]',_0xcfb334['uniqueid']),_0x1aad4c);}};exports[_0xb205('0x1c')]=function(_0x264716){try{if(!_[_0xb205('0x17')](dials[_0x264716['uniqueid']])){utils[_0xb205('0xc')](util[_0xb205('0x4')]('[%s][dials][dialbegin]',_0x264716[_0xb205('0x6')]),_0x264716);dials[_0x264716['uniqueid']]=_[_0xb205('0x1d')](dials[_0x264716['uniqueid']],_0x264716);dials[_0x264716[_0xb205('0x6')]][_0xb205('0x1e')]=utils[_0xb205('0x1f')]();dials[_0x264716[_0xb205('0x6')]][_0xb205('0x20')]=_0xb205('0x21');utils['info'](util[_0xb205('0x4')](_0xb205('0x22'),_0x264716[_0xb205('0x6')],dials[_0x264716[_0xb205('0x6')]][_0xb205('0x1e')]));}}catch(_0x4d0843){utils[_0xb205('0x14')](util['format']('[%s][dials][dialbegin]',_0x264716[_0xb205('0x6')]),_0x4d0843);}};exports[_0xb205('0x23')]=function(_0x3f8699){try{if(!_[_0xb205('0x17')](dials[_0x3f8699[_0xb205('0x6')]])){utils['debug'](util['format'](_0xb205('0x24'),_0x3f8699[_0xb205('0x6')]),_0x3f8699);dials[_0x3f8699[_0xb205('0x6')]][_0xb205('0xa')]=_0x3f8699['dialstatus'];if(_0x3f8699[_0xb205('0xa')]=='ANSWER'){dials[_0x3f8699[_0xb205('0x6')]]=_['assign'](dials[_0x3f8699['uniqueid']],_0x3f8699);dials[_0x3f8699[_0xb205('0x6')]][_0xb205('0x25')]=utils['now']();dials[_0x3f8699[_0xb205('0x6')]]['lastevent']=_0xb205('0x26');utils['info'](util[_0xb205('0x4')](_0xb205('0x27'),_0x3f8699['uniqueid'],_0x3f8699[_0xb205('0xa')],dials[_0x3f8699[_0xb205('0x6')]][_0xb205('0x25')]));}else{utils[_0xb205('0x3')](util['format'](_0xb205('0x28'),_0x3f8699[_0xb205('0x6')],_0x3f8699[_0xb205('0xa')]));}}}catch(_0x2585d){utils[_0xb205('0x14')](util['format']('[%s][dials][dialend]',_0x3f8699['uniqueid']),_0x2585d);}};exports[_0xb205('0x29')]=function(_0x1cfa8e){try{if(!_['isNil'](dials[_0x1cfa8e[_0xb205('0x6')]])){utils['debug'](util['format']('[%s][dials][hangup]',_0x1cfa8e['uniqueid']),_0x1cfa8e);utils[_0xb205('0x3')](util[_0xb205('0x4')](_0xb205('0x2a'),_0x1cfa8e['uniqueid'],_0x1cfa8e['calleridnum'],_0x1cfa8e[_0xb205('0x2b')],_0x1cfa8e[_0xb205('0x2c')]));dials[_0x1cfa8e[_0xb205('0x6')]]=_[_0xb205('0x1d')](dials[_0x1cfa8e[_0xb205('0x6')]],{'endtime':utils[_0xb205('0x1f')](),'lastevent':_0xb205('0x2d')});dials[_0x1cfa8e[_0xb205('0x6')]][_0xb205('0x2e')]=utils[_0xb205('0x2f')](dials[_0x1cfa8e[_0xb205('0x6')]][_0xb205('0x30')],dials[_0x1cfa8e[_0xb205('0x6')]]['starttime']);dials[_0x1cfa8e[_0xb205('0x6')]]['holdtime']=utils[_0xb205('0x2f')](dials[_0x1cfa8e[_0xb205('0x6')]][_0xb205('0x25')]||dials[_0x1cfa8e[_0xb205('0x6')]][_0xb205('0x30')],dials[_0x1cfa8e[_0xb205('0x6')]][_0xb205('0x1e')]);dials[_0x1cfa8e[_0xb205('0x6')]][_0xb205('0x31')]=dials[_0x1cfa8e[_0xb205('0x6')]][_0xb205('0x25')]?utils[_0xb205('0x2f')](dials[_0x1cfa8e[_0xb205('0x6')]][_0xb205('0x30')],dials[_0x1cfa8e[_0xb205('0x6')]][_0xb205('0x25')]):0x0;writeDB(dials[_0x1cfa8e[_0xb205('0x6')]]);}}catch(_0xfc994d){utils[_0xb205('0x14')](util['format']('[%s][dials][hangup]',_0x1cfa8e['uniqueid']),_0xfc994d);}}; \ No newline at end of file +var _0x98ac=['diffTime','holdtime','endtime','billableseconds','[%s][dials][hangup]','lodash','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','startsWith','toLowerCase','split','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','info','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','error','[%s][dials][dialend]','ANSWER','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete'];(function(_0x2d8e75,_0x5de2d5){var _0x4cde82=function(_0x559a25){while(--_0x559a25){_0x2d8e75['push'](_0x2d8e75['shift']());}};_0x4cde82(++_0x5de2d5);}(_0x98ac,0x137));var _0xc98a=function(_0x8f3ec6,_0x5c6eff){_0x8f3ec6=_0x8f3ec6-0x0;var _0xc4a11e=_0x98ac[_0x8f3ec6];return _0xc4a11e;};'use strict';var _=require(_0xc98a('0x0'));var util=require('util');var utils=require(_0xc98a('0x1'));var dials={};function writeDB(_0x37e3f2){utils['info'](util[_0xc98a('0x2')](_0xc98a('0x3'),_0x37e3f2['uniqueid'],_0x37e3f2[_0xc98a('0x4')],_0x37e3f2[_0xc98a('0x5')],_0x37e3f2[_0xc98a('0x6')],_0x37e3f2[_0xc98a('0x7')],_0x37e3f2[_0xc98a('0x8')]));utils['request'](_0xc98a('0x9'),_0x37e3f2);delete dials[_0x37e3f2[_0xc98a('0xa')]];}exports[_0xc98a('0xb')]=function(_0x3ff2fc){try{utils[_0xc98a('0xc')](util[_0xc98a('0x2')]('[%s][dials][newexten]',_0x3ff2fc[_0xc98a('0xa')]),_0x3ff2fc);utils['info'](util[_0xc98a('0x2')](_0xc98a('0xd'),_0x3ff2fc[_0xc98a('0xa')],_0x3ff2fc[_0xc98a('0xe')],_0x3ff2fc[_0xc98a('0xf')]));if(_0x3ff2fc[_0xc98a('0xe')]['toLowerCase']()=='set'&&_[_0xc98a('0x10')](_0x3ff2fc[_0xc98a('0xf')][_0xc98a('0x11')](),'cdr(routeid)')){var _0x3c7393=_0x3ff2fc[_0xc98a('0xf')][_0xc98a('0x12')]('=');dials[_0x3ff2fc[_0xc98a('0xa')]]={'routeId':_0x3c7393[0x1]};}}catch(_0x2d8dc4){utils['error'](util[_0xc98a('0x2')](_0xc98a('0x13'),_0x3ff2fc[_0xc98a('0xa')]),_0x2d8dc4);}};exports[_0xc98a('0x14')]=function(_0x25f662){try{utils[_0xc98a('0xc')](util[_0xc98a('0x2')](_0xc98a('0x15'),_0x25f662[_0xc98a('0xa')]),_0x25f662);if(!_[_0xc98a('0x16')](_0x25f662[_0xc98a('0x17')][_0xc98a('0x18')])){utils[_0xc98a('0x19')](util[_0xc98a('0x2')](_0xc98a('0x1a'),_0x25f662[_0xc98a('0xa')],_0x25f662[_0xc98a('0x1b')]));dials[_0x25f662['uniqueid']]={'routeId':_0x25f662[_0xc98a('0x1b')]};}}catch(_0x5a16cb){utils['error'](util[_0xc98a('0x2')](_0xc98a('0x15'),_0x25f662['uniqueid']),_0x5a16cb);}};exports[_0xc98a('0x1c')]=function(_0x4f415c){try{if(!_[_0xc98a('0x16')](dials[_0x4f415c['uniqueid']])){utils[_0xc98a('0xc')](util[_0xc98a('0x2')](_0xc98a('0x1d'),_0x4f415c[_0xc98a('0xa')]),_0x4f415c);dials[_0x4f415c[_0xc98a('0xa')]]=_[_0xc98a('0x1e')](dials[_0x4f415c[_0xc98a('0xa')]],_0x4f415c);dials[_0x4f415c['uniqueid']]['starttime']=utils['now']();dials[_0x4f415c['uniqueid']][_0xc98a('0x1f')]='called';utils['info'](util['format'](_0xc98a('0x20'),_0x4f415c[_0xc98a('0xa')],dials[_0x4f415c[_0xc98a('0xa')]][_0xc98a('0x21')]));}}catch(_0x431ff8){utils[_0xc98a('0x22')](util['format'](_0xc98a('0x1d'),_0x4f415c['uniqueid']),_0x431ff8);}};exports['dialend']=function(_0x3dd6a4){try{if(!_['isNil'](dials[_0x3dd6a4[_0xc98a('0xa')]])){utils[_0xc98a('0xc')](util['format'](_0xc98a('0x23'),_0x3dd6a4[_0xc98a('0xa')]),_0x3dd6a4);dials[_0x3dd6a4[_0xc98a('0xa')]][_0xc98a('0x8')]=_0x3dd6a4['dialstatus'];if(_0x3dd6a4['dialstatus']==_0xc98a('0x24')){dials[_0x3dd6a4['uniqueid']]=_[_0xc98a('0x1e')](dials[_0x3dd6a4['uniqueid']],_0x3dd6a4);dials[_0x3dd6a4[_0xc98a('0xa')]]['answertime']=utils[_0xc98a('0x25')]();dials[_0x3dd6a4['uniqueid']][_0xc98a('0x1f')]=_0xc98a('0x26');utils['info'](util['format'](_0xc98a('0x27'),_0x3dd6a4[_0xc98a('0xa')],_0x3dd6a4[_0xc98a('0x8')],dials[_0x3dd6a4[_0xc98a('0xa')]][_0xc98a('0x28')]));}else{utils['info'](util[_0xc98a('0x2')]('[%s][dials][dialend]\x20dialstatus:%s',_0x3dd6a4[_0xc98a('0xa')],_0x3dd6a4['dialstatus']));}}}catch(_0x4cd529){utils[_0xc98a('0x22')](util[_0xc98a('0x2')]('[%s][dials][dialend]',_0x3dd6a4['uniqueid']),_0x4cd529);}};exports[_0xc98a('0x29')]=function(_0x426c00){try{if(!_['isNil'](dials[_0x426c00[_0xc98a('0xa')]])){utils[_0xc98a('0xc')](util['format']('[%s][dials][hangup]',_0x426c00[_0xc98a('0xa')]),_0x426c00);utils[_0xc98a('0x19')](util[_0xc98a('0x2')](_0xc98a('0x2a'),_0x426c00[_0xc98a('0xa')],_0x426c00[_0xc98a('0x6')],_0x426c00[_0xc98a('0x2b')],_0x426c00[_0xc98a('0x2c')]));dials[_0x426c00[_0xc98a('0xa')]]=_['assign'](dials[_0x426c00[_0xc98a('0xa')]],{'endtime':utils[_0xc98a('0x25')](),'lastevent':_0xc98a('0x2d')});dials[_0x426c00[_0xc98a('0xa')]]['duration']=utils[_0xc98a('0x2e')](dials[_0x426c00['uniqueid']]['endtime'],dials[_0x426c00[_0xc98a('0xa')]]['starttime']);dials[_0x426c00[_0xc98a('0xa')]][_0xc98a('0x2f')]=utils[_0xc98a('0x2e')](dials[_0x426c00['uniqueid']]['answertime']||dials[_0x426c00[_0xc98a('0xa')]][_0xc98a('0x30')],dials[_0x426c00[_0xc98a('0xa')]]['starttime']);dials[_0x426c00[_0xc98a('0xa')]][_0xc98a('0x31')]=dials[_0x426c00['uniqueid']]['answertime']?utils[_0xc98a('0x2e')](dials[_0x426c00[_0xc98a('0xa')]][_0xc98a('0x30')],dials[_0x426c00[_0xc98a('0xa')]][_0xc98a('0x28')]):0x0;writeDB(dials[_0x426c00['uniqueid']]);}}catch(_0x1c497a){utils[_0xc98a('0x22')](util['format'](_0xc98a('0x32'),_0x426c00['uniqueid']),_0x1c497a);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 8a63d3a..82fa99a 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 _0xd230=['connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','device','format','[%s][index][devicestatechange]','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','disabled','env','local','port','asterisk','username','keepConnected','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./core.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd230,0x102));var _0x0d23=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xd230[_0x484e36];return _0xafc85d;};var AsteriskManager=require(_0x0d23('0x0'));var config=require(_0x0d23('0x1'));var utils=require('./utils');var util=require(_0x0d23('0x2'));var isXDREnabled=config[_0x0d23('0x3')]&&config[_0x0d23('0x3')]['disabled']?!config[_0x0d23('0x3')][_0x0d23('0x4')]:!![];var isProduction=config[_0x0d23('0x5')]==='production'||![];var isLocalAsterisk=config['xdr']&&config[_0x0d23('0x3')][_0x0d23('0x6')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x0d23('0x7')],config['asterisk']['ip'],config[_0x0d23('0x8')][_0x0d23('0x9')],config['asterisk']['password'],!![]);ami[_0x0d23('0xa')]();if(!isXDREnabled){utils['info'](_0x0d23('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils['info']('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x0d23('0xc'));var calls=require(_0x0d23('0xd'));var queues=require(_0x0d23('0xe'));var recordings=require(_0x0d23('0xf'));var members=require(_0x0d23('0x10'));var dials=require('./dials.controller');var transfers=require('./transfers.controller');var core=require(_0x0d23('0x11'));ami['on']('connect',core[_0x0d23('0x12')]);ami['on'](_0x0d23('0x13'),core[_0x0d23('0x13')]);ami['on'](_0x0d23('0x14'),core['fullybooted']);ami['on'](_0x0d23('0x15'),core['error']);ami['on'](_0x0d23('0x16'),core[_0x0d23('0x16')]);ami['on']('managerevent',core[_0x0d23('0x17')]);ami['on'](_0x0d23('0x18'),function(_0x4bab45){try{utils[_0x0d23('0x19')](util['format']('[%s][index][devicestatechange]',_0x4bab45[_0x0d23('0x1a')]),_0x4bab45);members[_0x0d23('0x18')](_0x4bab45);}catch(_0x1401e9){utils[_0x0d23('0x15')](util[_0x0d23('0x1b')](_0x0d23('0x1c'),_0x4bab45[_0x0d23('0x1a')]),_0x1401e9);}});ami['on']('agentcalled',function(_0x8abb7f){try{utils[_0x0d23('0x19')](util[_0x0d23('0x1b')](_0x0d23('0x1d'),_0x8abb7f[_0x0d23('0x1e')]),_0x8abb7f);agents['agentcalled'](_0x8abb7f);}catch(_0x1097ef){utils[_0x0d23('0x15')](util[_0x0d23('0x1b')](_0x0d23('0x1d'),_0x8abb7f[_0x0d23('0x1e')]),_0x1097ef);}});ami['on']('agentringnoanswer',function(_0x3b3a36){try{utils[_0x0d23('0x19')](util[_0x0d23('0x1b')]('[%s][index][agentringnoanswer]',_0x3b3a36['uniqueid']),_0x3b3a36);agents[_0x0d23('0x1f')](_0x3b3a36);}catch(_0x32c99b){utils[_0x0d23('0x15')](util[_0x0d23('0x1b')](_0x0d23('0x20'),_0x3b3a36[_0x0d23('0x1e')]),_0x32c99b);}});ami['on'](_0x0d23('0x21'),function(_0x1aa0b4){try{utils['debug'](util[_0x0d23('0x1b')](_0x0d23('0x22'),_0x1aa0b4['uniqueid']),_0x1aa0b4);agents['agentconnect'](_0x1aa0b4);queues[_0x0d23('0x21')](_0x1aa0b4);}catch(_0x469e3b){utils[_0x0d23('0x15')](util['format']('[%s][index][agentconnect]',_0x1aa0b4['uniqueid']),_0x469e3b);}});ami['on'](_0x0d23('0x23'),function(_0x1b715e){try{utils[_0x0d23('0x19')](util[_0x0d23('0x1b')](_0x0d23('0x24'),_0x1b715e['uniqueid']),_0x1b715e);agents['agentcomplete'](_0x1b715e);queues[_0x0d23('0x23')](_0x1b715e);members[_0x0d23('0x23')](_0x1b715e);}catch(_0x253f7a){utils['error'](util[_0x0d23('0x1b')]('[%s][index][agentcomplete]',_0x1b715e[_0x0d23('0x1e')]),_0x253f7a);}});ami['on']('queuecallerabandon',function(_0xde3e5c){try{utils[_0x0d23('0x19')](util[_0x0d23('0x1b')](_0x0d23('0x25'),_0xde3e5c[_0x0d23('0x1e')]),_0xde3e5c);agents[_0x0d23('0x26')](_0xde3e5c);queues[_0x0d23('0x26')](_0xde3e5c);}catch(_0x3f9753){utils['error'](util['format'](_0x0d23('0x25'),_0xde3e5c['uniqueid']),_0x3f9753);}});ami['on'](_0x0d23('0x27'),function(_0x3da1da){try{utils[_0x0d23('0x19')](util[_0x0d23('0x1b')](_0x0d23('0x28'),_0x3da1da['uniqueid']),_0x3da1da);queues[_0x0d23('0x27')](_0x3da1da);recordings[_0x0d23('0x27')](_0x3da1da);}catch(_0x1ddec0){utils['error'](util[_0x0d23('0x1b')](_0x0d23('0x28'),_0x3da1da[_0x0d23('0x1e')]),_0x1ddec0);}});ami['on']('queuecallerleave',function(_0x367028){try{utils['debug'](util[_0x0d23('0x1b')](_0x0d23('0x29'),_0x367028[_0x0d23('0x1e')]),_0x367028);queues[_0x0d23('0x2a')](_0x367028);}catch(_0x12050f){utils[_0x0d23('0x15')](util[_0x0d23('0x1b')](_0x0d23('0x29'),_0x367028[_0x0d23('0x1e')]),_0x12050f);}});ami['on'](_0x0d23('0x2b'),function(_0x165c77){try{utils[_0x0d23('0x19')](util[_0x0d23('0x1b')]('[%s][index][musiconholdstart]',_0x165c77[_0x0d23('0x1e')]),_0x165c77);queues[_0x0d23('0x2b')](_0x165c77);calls[_0x0d23('0x2b')](_0x165c77);}catch(_0x2f9817){utils['error'](util[_0x0d23('0x1b')](_0x0d23('0x2c'),_0x165c77[_0x0d23('0x1e')]),_0x2f9817);}});ami['on']('musiconholdstop',function(_0x30d066){try{utils[_0x0d23('0x19')](util['format'](_0x0d23('0x2d'),_0x30d066[_0x0d23('0x1e')]),_0x30d066);queues[_0x0d23('0x2e')](_0x30d066);calls['musiconholdstop'](_0x30d066);}catch(_0x43d46f){utils['error'](util['format'](_0x0d23('0x2d'),_0x30d066[_0x0d23('0x1e')]),_0x43d46f);}});ami['on'](_0x0d23('0x2f'),function(_0x3d686a){try{utils[_0x0d23('0x19')](util[_0x0d23('0x1b')](_0x0d23('0x30'),_0x3d686a[_0x0d23('0x1e')]),_0x3d686a);calls[_0x0d23('0x2f')](_0x3d686a);recordings['newstate'](_0x3d686a);}catch(_0x541b7d){utils[_0x0d23('0x15')](util[_0x0d23('0x1b')](_0x0d23('0x30'),_0x3d686a[_0x0d23('0x1e')]),_0x541b7d);}});ami['on'](_0x0d23('0x31'),function(_0x1d0b03){try{utils[_0x0d23('0x19')](util['format'](_0x0d23('0x32'),_0x1d0b03[_0x0d23('0x1e')]),_0x1d0b03);calls[_0x0d23('0x31')](_0x1d0b03);recordings[_0x0d23('0x31')](_0x1d0b03);dials['hangup'](_0x1d0b03);agents[_0x0d23('0x31')](_0x1d0b03);queues[_0x0d23('0x31')](_0x1d0b03);}catch(_0x47eba7){utils[_0x0d23('0x15')](util[_0x0d23('0x1b')](_0x0d23('0x32'),_0x1d0b03['uniqueid']),_0x47eba7);}});ami['on'](_0x0d23('0x33'),function(_0x219403){try{utils['debug'](util[_0x0d23('0x1b')](_0x0d23('0x34'),_0x219403['uniqueid']),_0x219403);members[_0x0d23('0x33')](_0x219403);}catch(_0x57b24f){utils[_0x0d23('0x15')](util[_0x0d23('0x1b')]('[%s][index][cdr]',_0x219403[_0x0d23('0x1e')]),_0x57b24f);}});ami['on'](_0x0d23('0x35'),function(_0x7f3ddd){try{utils['debug'](util[_0x0d23('0x1b')](_0x0d23('0x36'),_0x7f3ddd[_0x0d23('0x1e')]),_0x7f3ddd);queues[_0x0d23('0x35')](_0x7f3ddd);agents[_0x0d23('0x35')](_0x7f3ddd);transfers[_0x0d23('0x35')](_0x7f3ddd);recordings[_0x0d23('0x35')](_0x7f3ddd);}catch(_0x135fbc){utils[_0x0d23('0x15')](util[_0x0d23('0x1b')](_0x0d23('0x36'),_0x7f3ddd[_0x0d23('0x1e')]),_0x135fbc);}});ami['on'](_0x0d23('0x37'),function(_0x5ba0a2){try{utils[_0x0d23('0x19')](util[_0x0d23('0x1b')](_0x0d23('0x38'),_0x5ba0a2[_0x0d23('0x39')]),_0x5ba0a2);queues[_0x0d23('0x37')](_0x5ba0a2);transfers[_0x0d23('0x37')](_0x5ba0a2);agents['attendedtransfer'](_0x5ba0a2);calls['attendedtransfer'](_0x5ba0a2);}catch(_0x5599c2){utils[_0x0d23('0x15')](util[_0x0d23('0x1b')]('[%s][index][attendedtransfer]',_0x5ba0a2[_0x0d23('0x39')]),_0x5599c2);}});ami['on']('varset',function(_0x2fdbcf){try{utils[_0x0d23('0x19')](util[_0x0d23('0x1b')](_0x0d23('0x3a'),_0x2fdbcf['uniqueid']),_0x2fdbcf);queues[_0x0d23('0x3b')](_0x2fdbcf);recordings[_0x0d23('0x3b')](_0x2fdbcf);calls[_0x0d23('0x3b')](_0x2fdbcf);dials[_0x0d23('0x3b')](_0x2fdbcf);}catch(_0x23d3f4){utils[_0x0d23('0x15')](util['format'](_0x0d23('0x3a'),_0x2fdbcf['uniqueid']),_0x23d3f4);}});ami['on'](_0x0d23('0x3c'),function(_0x425894){try{utils[_0x0d23('0x19')](util['format'](_0x0d23('0x3d'),_0x425894[_0x0d23('0x1e')]),_0x425894);calls[_0x0d23('0x3c')](_0x425894);recordings[_0x0d23('0x3c')](_0x425894);dials['newexten'](_0x425894);}catch(_0x14979e){utils['error'](util[_0x0d23('0x1b')](_0x0d23('0x3d'),_0x425894[_0x0d23('0x1e')]),_0x14979e);}});ami['on'](_0x0d23('0x3e'),function(_0x18e01c){try{utils[_0x0d23('0x19')](util[_0x0d23('0x1b')]('[%s][index][newchannel]',_0x18e01c[_0x0d23('0x1e')]),_0x18e01c);calls[_0x0d23('0x3e')](_0x18e01c);recordings['newchannel'](_0x18e01c);}catch(_0x481d10){utils['error'](util[_0x0d23('0x1b')](_0x0d23('0x3f'),_0x18e01c[_0x0d23('0x1e')]),_0x481d10);}});ami['on']('dialbegin',function(_0x7c769f){try{utils[_0x0d23('0x19')](util[_0x0d23('0x1b')](_0x0d23('0x40'),_0x7c769f[_0x0d23('0x1e')]),_0x7c769f);dials[_0x0d23('0x41')](_0x7c769f);}catch(_0x30a58d){utils['error'](util['format'](_0x0d23('0x42'),_0x7c769f[_0x0d23('0x1e')]),_0x30a58d);}});ami['on'](_0x0d23('0x43'),function(_0x68bfce){try{utils[_0x0d23('0x19')](util[_0x0d23('0x1b')](_0x0d23('0x44'),_0x68bfce[_0x0d23('0x1e')]),_0x68bfce);dials[_0x0d23('0x43')](_0x68bfce);}catch(_0x537c72){utils[_0x0d23('0x15')](util['format'](_0x0d23('0x44'),_0x68bfce[_0x0d23('0x1e')]),_0x537c72);}});} \ No newline at end of file +var _0xb9e7=['musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./recordings.controller','./members.controller','./dials.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','[%s][index][devicestatechange]','device','devicestatechange','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]'];(function(_0x4ae722,_0x29b5bd){var _0x1b924d=function(_0x48ee28){while(--_0x48ee28){_0x4ae722['push'](_0x4ae722['shift']());}};_0x1b924d(++_0x29b5bd);}(_0xb9e7,0x1b6));var _0x7b9e=function(_0x128bef,_0xc7a0af){_0x128bef=_0x128bef-0x0;var _0x1ba862=_0xb9e7[_0x128bef];return _0x1ba862;};var AsteriskManager=require(_0x7b9e('0x0'));var config=require(_0x7b9e('0x1'));var utils=require(_0x7b9e('0x2'));var util=require(_0x7b9e('0x3'));var isXDREnabled=config[_0x7b9e('0x4')]&&config[_0x7b9e('0x4')][_0x7b9e('0x5')]?!config[_0x7b9e('0x4')][_0x7b9e('0x5')]:!![];var isProduction=config[_0x7b9e('0x6')]===_0x7b9e('0x7')||![];var isLocalAsterisk=config[_0x7b9e('0x4')]&&config[_0x7b9e('0x4')][_0x7b9e('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0x7b9e('0x9')][_0x7b9e('0xa')],config['asterisk']['ip'],config['asterisk']['username'],config['asterisk']['password'],!![]);ami[_0x7b9e('0xb')]();if(!isXDREnabled){utils[_0x7b9e('0xc')](_0x7b9e('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0x7b9e('0xe'));}else{var agents=require('./agents.controller');var calls=require(_0x7b9e('0xf'));var queues=require('./queues.controller');var recordings=require(_0x7b9e('0x10'));var members=require(_0x7b9e('0x11'));var dials=require(_0x7b9e('0x12'));var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on'](_0x7b9e('0x13'),core[_0x7b9e('0x13')]);ami['on'](_0x7b9e('0x14'),core[_0x7b9e('0x14')]);ami['on']('fullybooted',core[_0x7b9e('0x15')]);ami['on']('error',core[_0x7b9e('0x16')]);ami['on'](_0x7b9e('0x17'),core['close']);ami['on'](_0x7b9e('0x18'),core[_0x7b9e('0x18')]);ami['on']('devicestatechange',function(_0x2136bd){try{utils[_0x7b9e('0x19')](util[_0x7b9e('0x1a')](_0x7b9e('0x1b'),_0x2136bd[_0x7b9e('0x1c')]),_0x2136bd);members[_0x7b9e('0x1d')](_0x2136bd);}catch(_0x3823f3){utils[_0x7b9e('0x16')](util[_0x7b9e('0x1a')](_0x7b9e('0x1b'),_0x2136bd[_0x7b9e('0x1c')]),_0x3823f3);}});ami['on'](_0x7b9e('0x1e'),function(_0x4e819d){try{utils[_0x7b9e('0x19')](util[_0x7b9e('0x1a')]('[%s][index][agentcalled]',_0x4e819d[_0x7b9e('0x1f')]),_0x4e819d);agents[_0x7b9e('0x1e')](_0x4e819d);}catch(_0x4c1c62){utils['error'](util['format'](_0x7b9e('0x20'),_0x4e819d[_0x7b9e('0x1f')]),_0x4c1c62);}});ami['on']('agentringnoanswer',function(_0x5a5395){try{utils['debug'](util[_0x7b9e('0x1a')]('[%s][index][agentringnoanswer]',_0x5a5395[_0x7b9e('0x1f')]),_0x5a5395);agents[_0x7b9e('0x21')](_0x5a5395);}catch(_0x2950eb){utils[_0x7b9e('0x16')](util[_0x7b9e('0x1a')](_0x7b9e('0x22'),_0x5a5395[_0x7b9e('0x1f')]),_0x2950eb);}});ami['on'](_0x7b9e('0x23'),function(_0xb3e140){try{utils['debug'](util['format'](_0x7b9e('0x24'),_0xb3e140[_0x7b9e('0x1f')]),_0xb3e140);agents[_0x7b9e('0x23')](_0xb3e140);queues[_0x7b9e('0x23')](_0xb3e140);}catch(_0x4f7644){utils[_0x7b9e('0x16')](util[_0x7b9e('0x1a')](_0x7b9e('0x24'),_0xb3e140[_0x7b9e('0x1f')]),_0x4f7644);}});ami['on'](_0x7b9e('0x25'),function(_0x11af09){try{utils[_0x7b9e('0x19')](util[_0x7b9e('0x1a')](_0x7b9e('0x26'),_0x11af09['uniqueid']),_0x11af09);agents[_0x7b9e('0x25')](_0x11af09);queues[_0x7b9e('0x25')](_0x11af09);members[_0x7b9e('0x25')](_0x11af09);}catch(_0x35be8d){utils[_0x7b9e('0x16')](util[_0x7b9e('0x1a')]('[%s][index][agentcomplete]',_0x11af09[_0x7b9e('0x1f')]),_0x35be8d);}});ami['on']('queuecallerabandon',function(_0x518890){try{utils[_0x7b9e('0x19')](util['format'](_0x7b9e('0x27'),_0x518890[_0x7b9e('0x1f')]),_0x518890);agents[_0x7b9e('0x28')](_0x518890);queues[_0x7b9e('0x28')](_0x518890);}catch(_0x30d1f2){utils[_0x7b9e('0x16')](util[_0x7b9e('0x1a')](_0x7b9e('0x27'),_0x518890[_0x7b9e('0x1f')]),_0x30d1f2);}});ami['on'](_0x7b9e('0x29'),function(_0x4ca1f6){try{utils[_0x7b9e('0x19')](util['format'](_0x7b9e('0x2a'),_0x4ca1f6[_0x7b9e('0x1f')]),_0x4ca1f6);queues[_0x7b9e('0x29')](_0x4ca1f6);recordings[_0x7b9e('0x29')](_0x4ca1f6);}catch(_0x531abc){utils[_0x7b9e('0x16')](util[_0x7b9e('0x1a')]('[%s][index][queuecallerjoin]',_0x4ca1f6[_0x7b9e('0x1f')]),_0x531abc);}});ami['on'](_0x7b9e('0x2b'),function(_0x3d5a73){try{utils[_0x7b9e('0x19')](util[_0x7b9e('0x1a')](_0x7b9e('0x2c'),_0x3d5a73[_0x7b9e('0x1f')]),_0x3d5a73);queues['queuecallerleave'](_0x3d5a73);}catch(_0x51b612){utils[_0x7b9e('0x16')](util[_0x7b9e('0x1a')](_0x7b9e('0x2c'),_0x3d5a73[_0x7b9e('0x1f')]),_0x51b612);}});ami['on'](_0x7b9e('0x2d'),function(_0x11aca7){try{utils['debug'](util[_0x7b9e('0x1a')]('[%s][index][musiconholdstart]',_0x11aca7[_0x7b9e('0x1f')]),_0x11aca7);queues['musiconholdstart'](_0x11aca7);calls[_0x7b9e('0x2d')](_0x11aca7);}catch(_0x425c41){utils[_0x7b9e('0x16')](util[_0x7b9e('0x1a')]('[%s][index][musiconholdstart]',_0x11aca7[_0x7b9e('0x1f')]),_0x425c41);}});ami['on'](_0x7b9e('0x2e'),function(_0x3287a6){try{utils[_0x7b9e('0x19')](util[_0x7b9e('0x1a')]('[%s][index][musiconholdstop]',_0x3287a6[_0x7b9e('0x1f')]),_0x3287a6);queues[_0x7b9e('0x2e')](_0x3287a6);calls['musiconholdstop'](_0x3287a6);}catch(_0x40748f){utils['error'](util[_0x7b9e('0x1a')](_0x7b9e('0x2f'),_0x3287a6[_0x7b9e('0x1f')]),_0x40748f);}});ami['on'](_0x7b9e('0x30'),function(_0x11b469){try{utils[_0x7b9e('0x19')](util[_0x7b9e('0x1a')](_0x7b9e('0x31'),_0x11b469[_0x7b9e('0x1f')]),_0x11b469);calls[_0x7b9e('0x30')](_0x11b469);recordings[_0x7b9e('0x30')](_0x11b469);}catch(_0xac076f){utils[_0x7b9e('0x16')](util[_0x7b9e('0x1a')](_0x7b9e('0x31'),_0x11b469[_0x7b9e('0x1f')]),_0xac076f);}});ami['on'](_0x7b9e('0x32'),function(_0x45de67){try{utils[_0x7b9e('0x19')](util[_0x7b9e('0x1a')](_0x7b9e('0x33'),_0x45de67[_0x7b9e('0x1f')]),_0x45de67);calls[_0x7b9e('0x32')](_0x45de67);recordings[_0x7b9e('0x32')](_0x45de67);dials[_0x7b9e('0x32')](_0x45de67);agents[_0x7b9e('0x32')](_0x45de67);queues[_0x7b9e('0x32')](_0x45de67);}catch(_0x560258){utils[_0x7b9e('0x16')](util[_0x7b9e('0x1a')]('[%s][index][hangup]',_0x45de67[_0x7b9e('0x1f')]),_0x560258);}});ami['on']('cdr',function(_0x49a45f){try{utils[_0x7b9e('0x19')](util['format'](_0x7b9e('0x34'),_0x49a45f['uniqueid']),_0x49a45f);members['cdr'](_0x49a45f);}catch(_0x5a2fed){utils['error'](util[_0x7b9e('0x1a')](_0x7b9e('0x34'),_0x49a45f[_0x7b9e('0x1f')]),_0x5a2fed);}});ami['on'](_0x7b9e('0x35'),function(_0x329d0e){try{utils[_0x7b9e('0x19')](util[_0x7b9e('0x1a')](_0x7b9e('0x36'),_0x329d0e['uniqueid']),_0x329d0e);queues['blindtransfer'](_0x329d0e);agents[_0x7b9e('0x35')](_0x329d0e);transfers[_0x7b9e('0x35')](_0x329d0e);recordings['blindtransfer'](_0x329d0e);}catch(_0x430450){utils['error'](util[_0x7b9e('0x1a')](_0x7b9e('0x36'),_0x329d0e[_0x7b9e('0x1f')]),_0x430450);}});ami['on']('attendedtransfer',function(_0x51fc9d){try{utils[_0x7b9e('0x19')](util['format']('[%s][index][attendedtransfer]',_0x51fc9d['origtransfereruniqueid']),_0x51fc9d);queues['attendedtransfer'](_0x51fc9d);transfers['attendedtransfer'](_0x51fc9d);agents[_0x7b9e('0x37')](_0x51fc9d);calls[_0x7b9e('0x37')](_0x51fc9d);}catch(_0x487bbb){utils[_0x7b9e('0x16')](util['format'](_0x7b9e('0x38'),_0x51fc9d[_0x7b9e('0x39')]),_0x487bbb);}});ami['on'](_0x7b9e('0x3a'),function(_0x38e3c8){try{utils[_0x7b9e('0x19')](util[_0x7b9e('0x1a')](_0x7b9e('0x3b'),_0x38e3c8[_0x7b9e('0x1f')]),_0x38e3c8);queues['varset'](_0x38e3c8);recordings[_0x7b9e('0x3a')](_0x38e3c8);calls['varset'](_0x38e3c8);dials[_0x7b9e('0x3a')](_0x38e3c8);}catch(_0x2e30bd){utils[_0x7b9e('0x16')](util[_0x7b9e('0x1a')](_0x7b9e('0x3b'),_0x38e3c8['uniqueid']),_0x2e30bd);}});ami['on'](_0x7b9e('0x3c'),function(_0x4613ee){try{utils[_0x7b9e('0x19')](util[_0x7b9e('0x1a')](_0x7b9e('0x3d'),_0x4613ee[_0x7b9e('0x1f')]),_0x4613ee);calls['newexten'](_0x4613ee);recordings[_0x7b9e('0x3c')](_0x4613ee);dials['newexten'](_0x4613ee);}catch(_0x4d5ebe){utils[_0x7b9e('0x16')](util[_0x7b9e('0x1a')](_0x7b9e('0x3d'),_0x4613ee[_0x7b9e('0x1f')]),_0x4d5ebe);}});ami['on'](_0x7b9e('0x3e'),function(_0x22621a){try{utils[_0x7b9e('0x19')](util[_0x7b9e('0x1a')](_0x7b9e('0x3f'),_0x22621a[_0x7b9e('0x1f')]),_0x22621a);calls[_0x7b9e('0x3e')](_0x22621a);recordings[_0x7b9e('0x3e')](_0x22621a);}catch(_0xff5faa){utils[_0x7b9e('0x16')](util[_0x7b9e('0x1a')](_0x7b9e('0x3f'),_0x22621a[_0x7b9e('0x1f')]),_0xff5faa);}});ami['on']('dialbegin',function(_0x4a27b0){try{utils['debug'](util[_0x7b9e('0x1a')](_0x7b9e('0x40'),_0x4a27b0['uniqueid']),_0x4a27b0);dials[_0x7b9e('0x41')](_0x4a27b0);}catch(_0x10c12f){utils[_0x7b9e('0x16')](util[_0x7b9e('0x1a')](_0x7b9e('0x42'),_0x4a27b0['uniqueid']),_0x10c12f);}});ami['on'](_0x7b9e('0x43'),function(_0x52e124){try{utils['debug'](util[_0x7b9e('0x1a')](_0x7b9e('0x44'),_0x52e124[_0x7b9e('0x1f')]),_0x52e124);dials['dialend'](_0x52e124);}catch(_0x33768a){utils['error'](util[_0x7b9e('0x1a')]('[%s][index][dialend]',_0x52e124[_0x7b9e('0x1f')]),_0x33768a);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index d14bc75..e45a000 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 _0x1457=['./utils','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','data2','membername','type','interface','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','then','catch','error','format','[%s][members][writeDB]','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','agentcomplete','debug','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','util'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x1457,0x67));var _0x7145=function(_0x5bf420,_0x2d068d){_0x5bf420=_0x5bf420-0x0;var _0x1c5255=_0x1457[_0x5bf420];return _0x1c5255;};'use strict';var _=require('lodash');var util=require(_0x7145('0x0'));var utils=require(_0x7145('0x1'));var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x1ff8c4){utils['info'](util['format'](_0x7145('0x2'),_0x1ff8c4[_0x7145('0x3')],_0x1ff8c4['interface'],_0x1ff8c4[_0x7145('0x4')],_0x1ff8c4[_0x7145('0x5')],_0x1ff8c4[_0x7145('0x6')],_0x1ff8c4[_0x7145('0x7')]));if(_0x1ff8c4[_0x7145('0x8')]){utils[_0x7145('0x9')](_0x1ff8c4[_0x7145('0x8')])['then'](function(_0x211930){if(_0x211930){_0x1ff8c4['membername']=_0x211930[_0x7145('0xa')];_0x1ff8c4[_0x7145('0xb')]=_0x211930[_0x7145('0xb')];utils[_0x7145('0xc')](_0x7145('0xd'),_0x1ff8c4);}else{utils[_0x7145('0xe')](_0x1ff8c4[_0x7145('0x8')][_0x7145('0xf')]('/')[0x1])[_0x7145('0x10')](function(_0xa3b262){if(_0xa3b262){_0x1ff8c4['membername']=_0xa3b262[_0x7145('0xa')];_0x1ff8c4['internal']=_0xa3b262[_0x7145('0xb')];utils[_0x7145('0xc')]('CreateMemberReport',_0x1ff8c4);}});}})[_0x7145('0x11')](function(_0x1b3d03){utils[_0x7145('0x12')](util[_0x7145('0x13')](_0x7145('0x14'),_0x1ff8c4[_0x7145('0x3')]),_0x1b3d03);});}delete members[_0x1ff8c4[_0x7145('0x8')]];}function startsWith(_0x546d95,_0x17ad4f){return _[_0x7145('0x15')](_0x546d95,function(_0x1f515e){return _[_0x7145('0x16')](_0x17ad4f,_0x1f515e);});}exports[_0x7145('0x17')]=function(_0x172c58){try{utils['debug'](util[_0x7145('0x13')](_0x7145('0x18'),members[_0x172c58[_0x7145('0x19')]]?members[_0x172c58[_0x7145('0x19')]][_0x7145('0x3')]:_0x172c58[_0x7145('0x19')]),_0x172c58);utils[_0x7145('0x1a')](util[_0x7145('0x13')](_0x7145('0x1b'),members[_0x172c58[_0x7145('0x19')]]?members[_0x172c58[_0x7145('0x19')]][_0x7145('0x3')]:_0x172c58[_0x7145('0x19')],_0x172c58[_0x7145('0x1c')],_0x172c58['device']));switch(_0x172c58[_0x7145('0x1c')]){case'INUSE':case _0x7145('0x1d'):if(!startsWith(exclude,_0x172c58[_0x7145('0x19')])){members[_0x172c58[_0x7145('0x19')]]={'channel':_0x7145('0x1e'),'interface':_0x172c58[_0x7145('0x19')],'type':_0x7145('0x1f'),'enterAt':utils[_0x7145('0x20')](),'role':_0x7145('0x21')};}break;case _0x7145('0x22'):if(!_[_0x7145('0x23')](members[_0x172c58[_0x7145('0x19')]])){members[_0x172c58[_0x7145('0x19')]][_0x7145('0x24')]=utils[_0x7145('0x20')]();members[_0x172c58[_0x7145('0x19')]][_0x7145('0x25')]=utils[_0x7145('0x26')](members[_0x172c58[_0x7145('0x19')]][_0x7145('0x24')],members[_0x172c58[_0x7145('0x19')]]['enterAt']);if(members[_0x172c58[_0x7145('0x19')]][_0x7145('0x3')]){writeDB(members[_0x172c58[_0x7145('0x19')]]);}}break;default:break;}}catch(_0x8e6460){utils['error'](util[_0x7145('0x13')](_0x7145('0x18'),members[_0x172c58[_0x7145('0x19')]]?members[_0x172c58[_0x7145('0x19')]]['uniqueid']:_0x172c58[_0x7145('0x19')]),_0x8e6460);}};exports[_0x7145('0x27')]=function(_0x301489){try{if(!_['isNil'](members[_0x301489[_0x7145('0x8')]])){utils[_0x7145('0x28')](util[_0x7145('0x13')]('[%s][members][agentcomplete]',_0x301489[_0x7145('0x3')]),_0x301489);utils[_0x7145('0x1a')](util[_0x7145('0x13')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x301489[_0x7145('0x3')],_0x301489[_0x7145('0x8')],_0x301489[_0x7145('0x29')]));members[_0x301489[_0x7145('0x8')]]=_[_0x7145('0x2a')](members[_0x301489[_0x7145('0x8')]],{'data4':_0x301489['queue'],'uniqueid':_0x301489[_0x7145('0x3')]});}}catch(_0x4e4a75){utils[_0x7145('0x12')](util['format'](_0x7145('0x2b'),_0x301489[_0x7145('0x3')]),_0x4e4a75);}};exports[_0x7145('0x2c')]=function(_0x3b604b){try{utils[_0x7145('0x28')](util[_0x7145('0x13')](_0x7145('0x2d'),_0x3b604b['uniqueid']),_0x3b604b);if(_0x3b604b['channel']){var _0x5163f4=_0x3b604b['channel'][_0x7145('0xf')]('-')[0x0];if(!_[_0x7145('0x23')](members[_0x5163f4])){members[_0x5163f4]=_[_0x7145('0x2a')](members[_0x5163f4],{'data1':members[_0x5163f4][_0x7145('0x2e')]||_0x3b604b[_0x7145('0x7')],'data2':members[_0x5163f4][_0x7145('0x5')]||_0x3b604b[_0x7145('0x2f')],'data3':members[_0x5163f4][_0x7145('0x30')]||_0x3b604b[_0x7145('0x31')],'uniqueid':members[_0x5163f4][_0x7145('0x3')]||_0x3b604b[_0x7145('0x3')]});utils[_0x7145('0x1a')](util[_0x7145('0x13')](_0x7145('0x32'),_0x3b604b['uniqueid'],members[_0x5163f4]['data1'],members[_0x5163f4][_0x7145('0x5')],members[_0x5163f4][_0x7145('0x30')]));if(members[_0x5163f4][_0x7145('0x24')]){writeDB(members[_0x5163f4]);}}}if(_0x3b604b[_0x7145('0x33')]){var _0x55afee=_0x3b604b[_0x7145('0x33')][_0x7145('0xf')]('-')[0x0];if(!_[_0x7145('0x23')](members[_0x55afee])){members[_0x55afee]=_[_0x7145('0x2a')](members[_0x55afee],{'data1':members[_0x55afee][_0x7145('0x2e')]||_0x3b604b[_0x7145('0x7')],'data2':members[_0x55afee]['data2']||_0x3b604b['source'],'data3':members[_0x55afee][_0x7145('0x30')]||_0x3b604b[_0x7145('0x31')],'uniqueid':members[_0x55afee][_0x7145('0x3')]||_0x3b604b['uniqueid']});utils[_0x7145('0x1a')](util[_0x7145('0x13')](_0x7145('0x32'),_0x3b604b[_0x7145('0x3')],members[_0x55afee][_0x7145('0x2e')],members[_0x55afee][_0x7145('0x5')],members[_0x55afee]['data3']));if(members[_0x55afee]['exitAt']){writeDB(members[_0x55afee]);}}}}catch(_0x469745){utils[_0x7145('0x12')](util[_0x7145('0x13')](_0x7145('0x2d'),_0x3b604b[_0x7145('0x3')]),_0x469745);}}; \ No newline at end of file +var _0x47e6=['internal','request','getUserByName','split','catch','[%s][members][writeDB]','some','startsWith','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','NOT_INUSE','isNil','exitAt','now','duration','diffTime','enterAt','error','agentcomplete','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','data1','source','data3','destination','info','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','type','util','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','data2','membername','interface','getUserByInterface','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x47e6,0xe5));var _0x647e=function(_0xa5f2bc,_0x3bc23f){_0xa5f2bc=_0xa5f2bc-0x0;var _0x3889ab=_0x47e6[_0xa5f2bc];return _0x3889ab;};'use strict';var _=require('lodash');var util=require(_0x647e('0x0'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer',_0x647e('0x1')];function writeDB(_0x4f1aeb){utils['info'](util[_0x647e('0x2')](_0x647e('0x3'),_0x4f1aeb[_0x647e('0x4')],_0x4f1aeb['interface'],_0x4f1aeb[_0x647e('0x5')],_0x4f1aeb[_0x647e('0x6')],_0x4f1aeb[_0x647e('0x7')],_0x4f1aeb['type']));if(_0x4f1aeb[_0x647e('0x8')]){utils[_0x647e('0x9')](_0x4f1aeb['interface'])['then'](function(_0x417836){if(_0x417836){_0x4f1aeb[_0x647e('0x7')]=_0x417836[_0x647e('0xa')];_0x4f1aeb[_0x647e('0xb')]=_0x417836[_0x647e('0xb')];utils[_0x647e('0xc')]('CreateMemberReport',_0x4f1aeb);}else{utils[_0x647e('0xd')](_0x4f1aeb[_0x647e('0x8')][_0x647e('0xe')]('/')[0x1])['then'](function(_0x307167){if(_0x307167){_0x4f1aeb[_0x647e('0x7')]=_0x307167[_0x647e('0xa')];_0x4f1aeb[_0x647e('0xb')]=_0x307167[_0x647e('0xb')];utils[_0x647e('0xc')]('CreateMemberReport',_0x4f1aeb);}});}})[_0x647e('0xf')](function(_0x251886){utils['error'](util[_0x647e('0x2')](_0x647e('0x10'),_0x4f1aeb[_0x647e('0x4')]),_0x251886);});}delete members[_0x4f1aeb['interface']];}function startsWith(_0x9953f0,_0x5c5a5c){return _[_0x647e('0x11')](_0x9953f0,function(_0x5b643a){return _[_0x647e('0x12')](_0x5c5a5c,_0x5b643a);});}exports['devicestatechange']=function(_0x90d906){try{utils[_0x647e('0x13')](util[_0x647e('0x2')](_0x647e('0x14'),members[_0x90d906[_0x647e('0x15')]]?members[_0x90d906[_0x647e('0x15')]][_0x647e('0x4')]:_0x90d906[_0x647e('0x15')]),_0x90d906);utils['info'](util[_0x647e('0x2')](_0x647e('0x16'),members[_0x90d906[_0x647e('0x15')]]?members[_0x90d906['device']][_0x647e('0x4')]:_0x90d906[_0x647e('0x15')],_0x90d906[_0x647e('0x17')],_0x90d906[_0x647e('0x15')]));switch(_0x90d906[_0x647e('0x17')]){case'INUSE':case _0x647e('0x18'):if(!startsWith(exclude,_0x90d906['device'])){members[_0x90d906['device']]={'channel':_0x647e('0x19'),'interface':_0x90d906[_0x647e('0x15')],'type':'TALKING','enterAt':utils['now'](),'role':'agent'};}break;case _0x647e('0x1a'):if(!_[_0x647e('0x1b')](members[_0x90d906['device']])){members[_0x90d906[_0x647e('0x15')]][_0x647e('0x1c')]=utils[_0x647e('0x1d')]();members[_0x90d906[_0x647e('0x15')]][_0x647e('0x1e')]=utils[_0x647e('0x1f')](members[_0x90d906[_0x647e('0x15')]][_0x647e('0x1c')],members[_0x90d906[_0x647e('0x15')]][_0x647e('0x20')]);if(members[_0x90d906['device']]['uniqueid']){writeDB(members[_0x90d906['device']]);}}break;default:break;}}catch(_0x5822de){utils[_0x647e('0x21')](util[_0x647e('0x2')](_0x647e('0x14'),members[_0x90d906[_0x647e('0x15')]]?members[_0x90d906[_0x647e('0x15')]][_0x647e('0x4')]:_0x90d906['device']),_0x5822de);}};exports[_0x647e('0x22')]=function(_0x519c57){try{if(!_[_0x647e('0x1b')](members[_0x519c57['interface']])){utils['debug'](util[_0x647e('0x2')]('[%s][members][agentcomplete]',_0x519c57[_0x647e('0x4')]),_0x519c57);utils['info'](util[_0x647e('0x2')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x519c57[_0x647e('0x4')],_0x519c57[_0x647e('0x8')],_0x519c57[_0x647e('0x23')]));members[_0x519c57['interface']]=_[_0x647e('0x24')](members[_0x519c57[_0x647e('0x8')]],{'data4':_0x519c57[_0x647e('0x23')],'uniqueid':_0x519c57['uniqueid']});}}catch(_0x401ff2){utils[_0x647e('0x21')](util[_0x647e('0x2')](_0x647e('0x25'),_0x519c57[_0x647e('0x4')]),_0x401ff2);}};exports[_0x647e('0x26')]=function(_0x232a1a){try{utils[_0x647e('0x13')](util[_0x647e('0x2')](_0x647e('0x27'),_0x232a1a[_0x647e('0x4')]),_0x232a1a);if(_0x232a1a[_0x647e('0x5')]){var _0x40d3df=_0x232a1a['channel'][_0x647e('0xe')]('-')[0x0];if(!_[_0x647e('0x1b')](members[_0x40d3df])){members[_0x40d3df]=_['assign'](members[_0x40d3df],{'data1':members[_0x40d3df][_0x647e('0x28')]||_0x232a1a['type'],'data2':members[_0x40d3df][_0x647e('0x6')]||_0x232a1a[_0x647e('0x29')],'data3':members[_0x40d3df][_0x647e('0x2a')]||_0x232a1a[_0x647e('0x2b')],'uniqueid':members[_0x40d3df][_0x647e('0x4')]||_0x232a1a[_0x647e('0x4')]});utils[_0x647e('0x2c')](util[_0x647e('0x2')](_0x647e('0x2d'),_0x232a1a[_0x647e('0x4')],members[_0x40d3df]['data1'],members[_0x40d3df][_0x647e('0x6')],members[_0x40d3df][_0x647e('0x2a')]));if(members[_0x40d3df]['exitAt']){writeDB(members[_0x40d3df]);}}}if(_0x232a1a[_0x647e('0x2e')]){var _0x4556f6=_0x232a1a[_0x647e('0x2e')][_0x647e('0xe')]('-')[0x0];if(!_[_0x647e('0x1b')](members[_0x4556f6])){members[_0x4556f6]=_[_0x647e('0x24')](members[_0x4556f6],{'data1':members[_0x4556f6][_0x647e('0x28')]||_0x232a1a[_0x647e('0x2f')],'data2':members[_0x4556f6][_0x647e('0x6')]||_0x232a1a[_0x647e('0x29')],'data3':members[_0x4556f6][_0x647e('0x2a')]||_0x232a1a[_0x647e('0x2b')],'uniqueid':members[_0x4556f6][_0x647e('0x4')]||_0x232a1a[_0x647e('0x4')]});utils[_0x647e('0x2c')](util[_0x647e('0x2')](_0x647e('0x2d'),_0x232a1a['uniqueid'],members[_0x4556f6]['data1'],members[_0x4556f6]['data2'],members[_0x4556f6][_0x647e('0x2a')]));if(members[_0x4556f6][_0x647e('0x1c')]){writeDB(members[_0x4556f6]);}}}}catch(_0x220549){utils['error'](util['format'](_0x647e('0x27'),_0x232a1a[_0x647e('0x4')]),_0x220549);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 01abe35..dc6c0ef 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 _0x3de5=['type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','error','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','now','name','varset','[%s][queues][varset]','queuestatus','toUpperCase','CONTINUE','queuecallerexitAt','value','variable','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','position','count','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','membername','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','assigned','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','then'];(function(_0x5c5535,_0x4f21d2){var _0x4fef1d=function(_0x47ab66){while(--_0x47ab66){_0x5c5535['push'](_0x5c5535['shift']());}};_0x4fef1d(++_0x4f21d2);}(_0x3de5,0x129));var _0x53de=function(_0xffd14,_0x3cb980){_0xffd14=_0xffd14-0x0;var _0x36cc38=_0x3de5[_0xffd14];return _0x36cc38;};'use strict';var _=require('lodash');var util=require(_0x53de('0x0'));var utils=require(_0x53de('0x1'));var queues={};function writeDB(_0x3b7a90){utils[_0x53de('0x2')](util['format'](_0x53de('0x3'),_0x3b7a90[_0x53de('0x4')],_0x3b7a90[_0x53de('0x5')],_0x3b7a90[_0x53de('0x6')],_0x3b7a90[_0x53de('0x7')],_0x3b7a90[_0x53de('0x8')],_0x3b7a90[_0x53de('0x9')],_0x3b7a90[_0x53de('0xa')]));if(_0x3b7a90[_0x53de('0x6')]){utils['getVoiceQueueByName'](_0x3b7a90['queue'])[_0x53de('0xb')](function(_0x2b9476){if(_0x2b9476){_0x3b7a90[_0x53de('0xc')]=_0x2b9476[_0x53de('0xc')];}utils[_0x53de('0xd')](_0x53de('0xe'),_0x3b7a90);});}else{utils[_0x53de('0xd')](_0x53de('0xe'),_0x3b7a90);}if(_0x3b7a90[_0x53de('0xf')]){delete queues[_0x3b7a90['transfereduniqueid']];}else{delete queues[_0x3b7a90[_0x53de('0x4')]];}}exports[_0x53de('0x10')]=function(_0x59f4cd){try{utils[_0x53de('0x11')](util[_0x53de('0x12')](_0x53de('0x13'),_0x59f4cd[_0x53de('0x4')]),_0x59f4cd);utils['info'](util[_0x53de('0x12')](_0x53de('0x14'),_0x59f4cd[_0x53de('0x4')],_0x59f4cd[_0x53de('0x6')],_0x59f4cd['position']));queues[_0x59f4cd['uniqueid']]=_[_0x53de('0x15')](_0x59f4cd,{'originalposition':_0x59f4cd['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x20c50f){utils[_0x53de('0x16')](util[_0x53de('0x12')](_0x53de('0x13'),_0x59f4cd['uniqueid']),_0x20c50f);}};exports[_0x53de('0x17')]=function(_0x10b8f8){try{if(!_[_0x53de('0x18')](queues[_0x10b8f8[_0x53de('0x4')]])){utils['debug'](util[_0x53de('0x12')]('[%s][queues][hangup]',_0x10b8f8['uniqueid']),_0x10b8f8);if(queues[_0x10b8f8[_0x53de('0x4')]][_0x53de('0x19')]){if(!queues[_0x10b8f8[_0x53de('0x4')]][_0x53de('0x1a')]&&!queues[_0x10b8f8[_0x53de('0x4')]][_0x53de('0x1b')]){queues[_0x10b8f8[_0x53de('0x4')]][_0x53de('0x1c')]=!![];queues[_0x10b8f8[_0x53de('0x4')]]['queuecallercompleteAt']=utils[_0x53de('0x1d')]();queues[_0x10b8f8[_0x53de('0x4')]][_0x53de('0xa')]='COMPLETEDBYAGENT';}utils['info'](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x10b8f8['uniqueid'],queues[_0x10b8f8[_0x53de('0x4')]][_0x53de('0x1e')],queues[_0x10b8f8[_0x53de('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x10b8f8[_0x53de('0x4')]]);}else if(queues[_0x10b8f8['uniqueid']][_0x53de('0xf')]){utils[_0x53de('0x2')](util[_0x53de('0x12')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x10b8f8['uniqueid'],queues[_0x10b8f8[_0x53de('0x4')]][_0x53de('0x1e')],queues[_0x10b8f8[_0x53de('0x4')]][_0x53de('0xf')]));queues[queues[_0x10b8f8[_0x53de('0x4')]][_0x53de('0xf')]]=queues[_0x10b8f8['uniqueid']];queues[queues[_0x10b8f8['uniqueid']][_0x53de('0xf')]]['queuecallerenterreason']=0x2;delete queues[_0x10b8f8[_0x53de('0x4')]];}}}catch(_0x3f52f5){utils[_0x53de('0x16')](util[_0x53de('0x12')]('[%s][queues][hangup]',_0x10b8f8['uniqueid']),_0x3f52f5);}};exports[_0x53de('0x1f')]=function(_0x20c9da){try{utils['debug'](util[_0x53de('0x12')](_0x53de('0x20'),_0x20c9da[_0x53de('0x4')]),_0x20c9da);if(!_['isNil'](_0x20c9da['variable'][_0x53de('0x21')])&&_0x20c9da['value'][_0x53de('0x22')]()!==_0x53de('0x23')){if(!_[_0x53de('0x18')](queues[_0x20c9da[_0x53de('0x4')]])){queues[_0x20c9da[_0x53de('0x4')]][_0x53de('0x1a')]=![];queues[_0x20c9da['uniqueid']]['queuecallerabandonAt']=null;queues[_0x20c9da[_0x53de('0x4')]][_0x53de('0x1b')]=!![];queues[_0x20c9da['uniqueid']][_0x53de('0x24')]=utils['now']();queues[_0x20c9da[_0x53de('0x4')]]['queuecallerexitreason']=_0x20c9da[_0x53de('0x25')]['toUpperCase']();utils[_0x53de('0x2')](util[_0x53de('0x12')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x20c9da[_0x53de('0x4')],queues[_0x20c9da['uniqueid']][_0x53de('0x1e')],_0x20c9da[_0x53de('0x25')],queues[_0x20c9da[_0x53de('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x20c9da[_0x53de('0x4')]]);}}else if(!_[_0x53de('0x18')](_0x20c9da[_0x53de('0x26')][_0x53de('0x27')])){if(!_[_0x53de('0x18')](queues[_0x20c9da['uniqueid']])&&!queues[_0x20c9da['uniqueid']][_0x53de('0x1a')]){queues[_0x20c9da[_0x53de('0x4')]][_0x53de('0x1a')]=![];queues[_0x20c9da[_0x53de('0x4')]][_0x53de('0x28')]=null;queues[_0x20c9da[_0x53de('0x4')]][_0x53de('0x1b')]=!![];queues[_0x20c9da['uniqueid']][_0x53de('0x24')]=utils[_0x53de('0x1d')]();queues[_0x20c9da[_0x53de('0x4')]]['queuecallerexitreason']=_0x53de('0x29');utils['info'](util[_0x53de('0x12')](_0x53de('0x2a'),_0x20c9da[_0x53de('0x4')],queues[_0x20c9da['uniqueid']][_0x53de('0x1e')],_0x20c9da[_0x53de('0x25')],queues[_0x20c9da['uniqueid']][_0x53de('0xa')]));}}}catch(_0x13efc7){utils[_0x53de('0x16')](util[_0x53de('0x12')](_0x53de('0x20'),_0x20c9da[_0x53de('0x4')]),_0x13efc7);}};exports[_0x53de('0x1a')]=function(_0x3a1be3){try{if(!_[_0x53de('0x18')](queues[_0x3a1be3[_0x53de('0x4')]])){utils[_0x53de('0x11')](util[_0x53de('0x12')]('[%s][queues][queuecallerabandon]',_0x3a1be3[_0x53de('0x4')]),_0x3a1be3);queues[_0x3a1be3[_0x53de('0x4')]][_0x53de('0x1b')]=![];queues[_0x3a1be3[_0x53de('0x4')]][_0x53de('0x24')]=null;queues[_0x3a1be3[_0x53de('0x4')]][_0x53de('0x1a')]=!![];queues[_0x3a1be3[_0x53de('0x4')]][_0x53de('0x28')]=utils[_0x53de('0x1d')]();queues[_0x3a1be3[_0x53de('0x4')]][_0x53de('0xa')]=_0x53de('0x2b');utils['info'](util['format'](_0x53de('0x2c'),_0x3a1be3[_0x53de('0x4')],queues[_0x3a1be3[_0x53de('0x4')]]['name'],queues[_0x3a1be3[_0x53de('0x4')]][_0x53de('0xa')]));}}catch(_0x51853a){utils[_0x53de('0x16')](util[_0x53de('0x12')](_0x53de('0x2d'),_0x3a1be3[_0x53de('0x4')]),_0x51853a);}};exports[_0x53de('0x2e')]=function(_0x4af0a3){try{if(!_[_0x53de('0x18')](queues[_0x4af0a3['uniqueid']])){utils['debug'](util[_0x53de('0x12')](_0x53de('0x2f'),_0x4af0a3['uniqueid']),_0x4af0a3);utils[_0x53de('0x2')](util[_0x53de('0x12')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x4af0a3['uniqueid'],queues[_0x4af0a3[_0x53de('0x4')]][_0x53de('0x1e')],_0x4af0a3[_0x53de('0x30')],_0x4af0a3[_0x53de('0x31')]));queues[_0x4af0a3[_0x53de('0x4')]]['queuecallerleave']=!![];queues[_0x4af0a3['uniqueid']]['queuecallerleaveAt']=utils[_0x53de('0x1d')]();queues[_0x4af0a3[_0x53de('0x4')]][_0x53de('0x32')]=utils[_0x53de('0x33')](queues[_0x4af0a3[_0x53de('0x4')]][_0x53de('0x19')],queues[_0x4af0a3[_0x53de('0x4')]][_0x53de('0x34')]);queues[_0x4af0a3[_0x53de('0x4')]][_0x53de('0x35')]=_0x4af0a3[_0x53de('0x35')];queues[_0x4af0a3[_0x53de('0x4')]][_0x53de('0x36')]=_0x4af0a3[_0x53de('0x36')];queues[_0x4af0a3[_0x53de('0x4')]][_0x53de('0x30')]=_0x4af0a3[_0x53de('0x30')];queues[_0x4af0a3[_0x53de('0x4')]][_0x53de('0x31')]=_0x4af0a3[_0x53de('0x31')];}}catch(_0x3c1f09){utils[_0x53de('0x16')](util['format'](_0x53de('0x2f'),_0x4af0a3[_0x53de('0x4')]),_0x3c1f09);}};exports['agentconnect']=function(_0x2d92e7){try{if(!_['isNil'](queues[_0x2d92e7[_0x53de('0x4')]])){utils[_0x53de('0x11')](util[_0x53de('0x12')]('[%s][queues][agentconnect]',_0x2d92e7[_0x53de('0x4')]),_0x2d92e7);utils[_0x53de('0x2')](util['format'](_0x53de('0x37'),_0x2d92e7[_0x53de('0x4')],queues[_0x2d92e7['uniqueid']][_0x53de('0x1e')],_0x2d92e7['membername'],_0x2d92e7[_0x53de('0x38')]));queues[_0x2d92e7['uniqueid']]['queuecallerabandon']=![];queues[_0x2d92e7[_0x53de('0x4')]][_0x53de('0x1a')]=![];queues[_0x2d92e7['uniqueid']][_0x53de('0x28')]=null;queues[_0x2d92e7[_0x53de('0x4')]]['queuecallerexit']=![];queues[_0x2d92e7[_0x53de('0x4')]][_0x53de('0xa')]=null;queues[_0x2d92e7[_0x53de('0x4')]][_0x53de('0x24')]=null;queues[_0x2d92e7['uniqueid']]['assigned']=!![];queues[_0x2d92e7['uniqueid']][_0x53de('0x9')]=_0x2d92e7['destaccountcode'];queues[_0x2d92e7[_0x53de('0x4')]][_0x53de('0x7')]=_0x2d92e7[_0x53de('0x39')];}}catch(_0x2419c7){utils['error'](util['format'](_0x53de('0x3a'),_0x2d92e7[_0x53de('0x4')]),_0x2419c7);}};exports[_0x53de('0x3b')]=function(_0x1724ed){try{if(!_[_0x53de('0x18')](queues[_0x1724ed[_0x53de('0x4')]])){if(queues[_0x1724ed['uniqueid']][_0x53de('0x19')]){utils['debug'](util[_0x53de('0x12')](_0x53de('0x3c'),_0x1724ed[_0x53de('0x4')]),_0x1724ed);queues[_0x1724ed[_0x53de('0x4')]][_0x53de('0x1a')]=![];queues[_0x1724ed[_0x53de('0x4')]][_0x53de('0x1a')]=![];queues[_0x1724ed[_0x53de('0x4')]][_0x53de('0x28')]=null;queues[_0x1724ed[_0x53de('0x4')]][_0x53de('0x1b')]=![];queues[_0x1724ed[_0x53de('0x4')]][_0x53de('0x24')]=null;queues[_0x1724ed['uniqueid']][_0x53de('0x3d')]=!![];queues[_0x1724ed[_0x53de('0x4')]][_0x53de('0x7')]=_0x1724ed[_0x53de('0x39')];queues[_0x1724ed[_0x53de('0x4')]]['queuecallercomplete']=!![];queues[_0x1724ed[_0x53de('0x4')]][_0x53de('0x3e')]=utils[_0x53de('0x1d')]();if(_0x1724ed[_0x53de('0x3f')]==_0x53de('0x40')){if(!queues[_0x1724ed[_0x53de('0x4')]][_0x53de('0x40')]){queues[_0x1724ed[_0x53de('0x4')]][_0x53de('0xa')]=_0x53de('0x41');}}else{queues[_0x1724ed['uniqueid']][_0x53de('0xa')]=_0x53de('0x42')+_0x1724ed[_0x53de('0x3f')][_0x53de('0x22')]();}utils[_0x53de('0x2')](util['format'](_0x53de('0x43'),_0x1724ed['uniqueid'],queues[_0x1724ed[_0x53de('0x4')]]['name'],_0x1724ed[_0x53de('0x39')],queues[_0x1724ed[_0x53de('0x4')]][_0x53de('0xa')]));writeDB(queues[_0x1724ed['uniqueid']]);}}}catch(_0xf99c5){utils[_0x53de('0x16')](util[_0x53de('0x12')](_0x53de('0x3c'),_0x1724ed[_0x53de('0x4')]),_0xf99c5);}};exports['blindtransfer']=function(_0x4b345f){try{if(!_['isNil'](queues[_0x4b345f[_0x53de('0x44')]])){utils['debug'](util[_0x53de('0x12')](_0x53de('0x45'),_0x4b345f[_0x53de('0x4')]),_0x4b345f);queues[_0x4b345f[_0x53de('0x44')]][_0x53de('0x40')]=!![];queues[_0x4b345f[_0x53de('0x44')]][_0x53de('0x46')]='BLIND';queues[_0x4b345f[_0x53de('0x44')]][_0x53de('0x47')]=_0x4b345f[_0x53de('0x48')];queues[_0x4b345f[_0x53de('0x44')]]['transferuniqueid']=_0x4b345f[_0x53de('0x44')];queues[_0x4b345f[_0x53de('0x44')]][_0x53de('0xa')]=_0x53de('0x49');utils[_0x53de('0x2')](util[_0x53de('0x12')](_0x53de('0x4a'),_0x4b345f[_0x53de('0x4')],queues[_0x4b345f[_0x53de('0x44')]]['name'],_0x4b345f[_0x53de('0x44')],_0x4b345f[_0x53de('0x48')]));}}catch(_0x171ed0){utils['error'](util[_0x53de('0x12')](_0x53de('0x45'),_0x4b345f[_0x53de('0x4')]),_0x171ed0);}};exports[_0x53de('0x4b')]=function(_0x52462b){try{utils[_0x53de('0x11')](util[_0x53de('0x12')](_0x53de('0x4c'),_0x52462b['origtransfereruniqueid']),_0x52462b);if(_0x52462b[_0x53de('0x4d')]==_0x52462b[_0x53de('0x4e')]){if(!_[_0x53de('0x18')](queues[_0x52462b['secondtransfererlinkedid']])){utils[_0x53de('0x2')](util[_0x53de('0x12')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x52462b[_0x53de('0x4d')],queues[_0x52462b[_0x53de('0x4f')]][_0x53de('0x1e')],_0x52462b[_0x53de('0x50')]));queues[_0x52462b[_0x53de('0x4f')]][_0x53de('0x40')]=!![];queues[_0x52462b[_0x53de('0x4f')]][_0x53de('0x46')]=_0x53de('0x51');queues[_0x52462b[_0x53de('0x4f')]][_0x53de('0x47')]=_0x52462b[_0x53de('0x50')];queues[_0x52462b[_0x53de('0x4f')]][_0x53de('0x52')]=_0x52462b[_0x53de('0x4d')];queues[_0x52462b['secondtransfererlinkedid']]['queuecallerexitreason']=_0x53de('0x53');}if(!_[_0x53de('0x18')](queues[_0x52462b[_0x53de('0x4e')]])){if(_0x52462b[_0x53de('0x54')]&&queues[_0x52462b[_0x53de('0x54')]]){queues[_0x52462b[_0x53de('0x54')]][_0x53de('0x55')]=0x1;queues[_0x52462b[_0x53de('0x44')]]=_[_0x53de('0x56')](queues[_0x52462b[_0x53de('0x54')]]);queues[_0x52462b[_0x53de('0x44')]][_0x53de('0xf')]=_0x52462b[_0x53de('0x57')];queues[_0x52462b[_0x53de('0x44')]]['queuecallerenterreason']=0x2;queues[_0x52462b['transfereeuniqueid']][_0x53de('0x8')]=queues[_0x52462b[_0x53de('0x4f')]]['calleridnum'];queues[_0x52462b['transfereeuniqueid']]['calleridname']=queues[_0x52462b[_0x53de('0x4f')]]['calleridname'];queues[_0x52462b[_0x53de('0x44')]][_0x53de('0x34')]=utils[_0x53de('0x1d')]();queues[_0x52462b[_0x53de('0x44')]][_0x53de('0x19')]=utils[_0x53de('0x1d')]();queues[_0x52462b[_0x53de('0x44')]][_0x53de('0x32')]=0x0;queues[_0x52462b['transfereeuniqueid']][_0x53de('0x58')]=0x0;utils[_0x53de('0x2')](util[_0x53de('0x12')](_0x53de('0x59'),_0x52462b[_0x53de('0x4d')],queues[_0x52462b[_0x53de('0x44')]][_0x53de('0x1e')],queues[_0x52462b[_0x53de('0x44')]][_0x53de('0x8')],queues[_0x52462b[_0x53de('0x44')]][_0x53de('0x5a')]));}else{utils['info'](util[_0x53de('0x12')](_0x53de('0x5b'),_0x52462b['origtransfereruniqueid'],queues[_0x52462b[_0x53de('0x4e')]][_0x53de('0x1e')],_0x52462b['secondtransfererlinkedid']));queues[_0x52462b['origtransfererlinkedid']][_0x53de('0xf')]=_0x52462b[_0x53de('0x4f')];}}}else if(_0x52462b[_0x53de('0x5c')]==_0x52462b[_0x53de('0x4f')]){if(!_[_0x53de('0x18')](queues[_0x52462b['origtransfererlinkedid']])){utils[_0x53de('0x2')](util[_0x53de('0x12')](_0x53de('0x5d'),_0x52462b[_0x53de('0x4d')],queues[_0x52462b[_0x53de('0x4e')]][_0x53de('0x1e')],_0x52462b['secondtransfereruniqueid'],_0x52462b['secondtransfererexten']));queues[_0x52462b[_0x53de('0x4e')]]['transfer']=!![];queues[_0x52462b[_0x53de('0x4e')]]['transfertype']=_0x53de('0x51');queues[_0x52462b[_0x53de('0x4e')]][_0x53de('0x47')]=_0x52462b[_0x53de('0x5e')];queues[_0x52462b['origtransfererlinkedid']][_0x53de('0x52')]=_0x52462b[_0x53de('0x5c')];queues[_0x52462b['origtransfererlinkedid']][_0x53de('0xa')]='ATTENDEDTRANSFER';}if(!_[_0x53de('0x18')](queues[_0x52462b[_0x53de('0x4f')]])){if(_0x52462b[_0x53de('0x5f')]&&queues[_0x52462b[_0x53de('0x5f')]]){queues[_0x52462b[_0x53de('0x5f')]]['queuecallerenterreason']=0x1;queues[_0x52462b[_0x53de('0x57')]]=_[_0x53de('0x56')](queues[_0x52462b['transfertargetlinkedid']]);queues[_0x52462b[_0x53de('0x57')]][_0x53de('0xf')]=_0x52462b['transfertargetuniqueid'];queues[_0x52462b[_0x53de('0x57')]]['queuecallerenterreason']=0x2;queues[_0x52462b['transfertargetuniqueid']][_0x53de('0x8')]=queues[_0x52462b[_0x53de('0x4e')]][_0x53de('0x8')];queues[_0x52462b[_0x53de('0x57')]]['calleridname']=queues[_0x52462b[_0x53de('0x4e')]][_0x53de('0x5a')];queues[_0x52462b[_0x53de('0x57')]]['queuecallerjoinAt']=utils[_0x53de('0x1d')]();queues[_0x52462b[_0x53de('0x57')]][_0x53de('0x19')]=utils[_0x53de('0x1d')]();queues[_0x52462b[_0x53de('0x57')]][_0x53de('0x32')]=0x0;queues[_0x52462b[_0x53de('0x57')]][_0x53de('0x58')]=0x0;utils[_0x53de('0x2')](util[_0x53de('0x12')](_0x53de('0x60'),_0x52462b[_0x53de('0x4d')],queues[_0x52462b[_0x53de('0x57')]][_0x53de('0x1e')],queues[_0x52462b[_0x53de('0x57')]][_0x53de('0xf')],queues[_0x52462b[_0x53de('0x57')]][_0x53de('0x8')],queues[_0x52462b[_0x53de('0x57')]][_0x53de('0x5a')]));}else{utils['info'](util[_0x53de('0x12')](_0x53de('0x5b'),_0x52462b[_0x53de('0x4d')],queues[_0x52462b['secondtransfererlinkedid']][_0x53de('0x1e')],_0x52462b[_0x53de('0x4e')]));queues[_0x52462b[_0x53de('0x4f')]][_0x53de('0xf')]=_0x52462b[_0x53de('0x4e')];}}}}catch(_0x1a7b6c){utils[_0x53de('0x16')](util[_0x53de('0x12')](_0x53de('0x4c'),_0x52462b[_0x53de('0x4d')]),_0x1a7b6c);}};exports[_0x53de('0x61')]=function(_0x4d7cf1){try{if(!_[_0x53de('0x18')](queues[_0x4d7cf1[_0x53de('0x4')]])){utils[_0x53de('0x11')](util[_0x53de('0x12')](_0x53de('0x62'),_0x4d7cf1[_0x53de('0x4')]),_0x4d7cf1);queues[_0x4d7cf1[_0x53de('0x4')]][_0x53de('0x63')]=utils[_0x53de('0x1d')]();utils[_0x53de('0x2')](util[_0x53de('0x12')](_0x53de('0x64'),_0x4d7cf1[_0x53de('0x4')],queues[_0x4d7cf1['uniqueid']][_0x53de('0x1e')],queues[_0x4d7cf1[_0x53de('0x4')]][_0x53de('0x63')]));}}catch(_0x2449f6){utils[_0x53de('0x16')](util['format'](_0x53de('0x62'),_0x4d7cf1['uniqueid']),_0x2449f6);}};exports[_0x53de('0x65')]=function(_0x12177f){try{if(!_['isNil'](queues[_0x12177f[_0x53de('0x4')]])){if(!_[_0x53de('0x18')](queues[_0x12177f[_0x53de('0x4')]][_0x53de('0x63')])){utils[_0x53de('0x11')](util['format'](_0x53de('0x66'),_0x12177f['uniqueid']),_0x12177f);queues[_0x12177f['uniqueid']][_0x53de('0x58')]+=utils[_0x53de('0x33')](utils[_0x53de('0x1d')](),queues[_0x12177f['uniqueid']][_0x53de('0x63')]);utils[_0x53de('0x2')](util[_0x53de('0x12')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x12177f['uniqueid'],queues[_0x12177f['uniqueid']][_0x53de('0x1e')],queues[_0x12177f[_0x53de('0x4')]][_0x53de('0x58')]));delete queues[_0x12177f[_0x53de('0x4')]]['musiconholdstartAt'];}}}catch(_0x18fcdf){utils[_0x53de('0x16')](util['format']('[%s][queues][musiconholdstop]',_0x12177f[_0x53de('0x4')]),_0x18fcdf);}}; \ No newline at end of file +var _0x0267=['transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','calleridnum','accountcode','queuecallerexitreason','then','type','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','hangup','isNil','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','error','[%s][queues][varset]','variable','queuestatus','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','BLIND','transferexten','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','transfertype','ATTENDED','origtransfererexten'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x0267,0xe1));var _0x7026=function(_0x196e14,_0x35857f){_0x196e14=_0x196e14-0x0;var _0x4a387b=_0x0267[_0x196e14];return _0x4a387b;};'use strict';var _=require(_0x7026('0x0'));var util=require('util');var utils=require(_0x7026('0x1'));var queues={};function writeDB(_0x305a56){utils[_0x7026('0x2')](util[_0x7026('0x3')](_0x7026('0x4'),_0x305a56[_0x7026('0x5')],_0x305a56['channel'],_0x305a56[_0x7026('0x6')],_0x305a56['lastAssignedTo'],_0x305a56[_0x7026('0x7')],_0x305a56[_0x7026('0x8')],_0x305a56[_0x7026('0x9')]));if(_0x305a56[_0x7026('0x6')]){utils['getVoiceQueueByName'](_0x305a56[_0x7026('0x6')])[_0x7026('0xa')](function(_0x3f72f3){if(_0x3f72f3){_0x305a56[_0x7026('0xb')]=_0x3f72f3['type'];}utils[_0x7026('0xc')]('CreateVoiceQueueReport',_0x305a56);});}else{utils['request']('CreateVoiceQueueReport',_0x305a56);}if(_0x305a56[_0x7026('0xd')]){delete queues[_0x305a56[_0x7026('0xd')]];}else{delete queues[_0x305a56[_0x7026('0x5')]];}}exports[_0x7026('0xe')]=function(_0x7c3c6){try{utils[_0x7026('0xf')](util['format'](_0x7026('0x10'),_0x7c3c6[_0x7026('0x5')]),_0x7c3c6);utils[_0x7026('0x2')](util[_0x7026('0x3')](_0x7026('0x11'),_0x7c3c6['uniqueid'],_0x7c3c6[_0x7026('0x6')],_0x7c3c6[_0x7026('0x12')]));queues[_0x7c3c6[_0x7026('0x5')]]=_[_0x7026('0x13')](_0x7c3c6,{'originalposition':_0x7c3c6['position'],'queuecallerjoinAt':utils[_0x7026('0x14')](),'mohtime':0x0});}catch(_0x3ce4f1){utils['error'](util[_0x7026('0x3')](_0x7026('0x10'),_0x7c3c6['uniqueid']),_0x3ce4f1);}};exports[_0x7026('0x15')]=function(_0x2a983d){try{if(!_[_0x7026('0x16')](queues[_0x2a983d['uniqueid']])){utils['debug'](util[_0x7026('0x3')]('[%s][queues][hangup]',_0x2a983d['uniqueid']),_0x2a983d);if(queues[_0x2a983d[_0x7026('0x5')]][_0x7026('0x17')]){if(!queues[_0x2a983d[_0x7026('0x5')]]['queuecallerabandon']&&!queues[_0x2a983d[_0x7026('0x5')]][_0x7026('0x18')]){queues[_0x2a983d['uniqueid']][_0x7026('0x19')]=!![];queues[_0x2a983d['uniqueid']][_0x7026('0x1a')]=utils[_0x7026('0x14')]();queues[_0x2a983d[_0x7026('0x5')]]['queuecallerexitreason']=_0x7026('0x1b');}utils['info'](util['format'](_0x7026('0x1c'),_0x2a983d[_0x7026('0x5')],queues[_0x2a983d[_0x7026('0x5')]]['name'],queues[_0x2a983d['uniqueid']][_0x7026('0x9')]));writeDB(queues[_0x2a983d['uniqueid']]);}else if(queues[_0x2a983d[_0x7026('0x5')]][_0x7026('0xd')]){utils['info'](util[_0x7026('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x2a983d['uniqueid'],queues[_0x2a983d[_0x7026('0x5')]][_0x7026('0x1d')],queues[_0x2a983d[_0x7026('0x5')]][_0x7026('0xd')]));queues[queues[_0x2a983d[_0x7026('0x5')]]['transfereduniqueid']]=queues[_0x2a983d['uniqueid']];queues[queues[_0x2a983d[_0x7026('0x5')]][_0x7026('0xd')]][_0x7026('0x1e')]=0x2;delete queues[_0x2a983d['uniqueid']];}}}catch(_0x7f2206){utils[_0x7026('0x1f')](util[_0x7026('0x3')]('[%s][queues][hangup]',_0x2a983d['uniqueid']),_0x7f2206);}};exports['varset']=function(_0x2c82c9){try{utils[_0x7026('0xf')](util[_0x7026('0x3')](_0x7026('0x20'),_0x2c82c9[_0x7026('0x5')]),_0x2c82c9);if(!_['isNil'](_0x2c82c9[_0x7026('0x21')][_0x7026('0x22')])&&_0x2c82c9['value'][_0x7026('0x23')]()!==_0x7026('0x24')){if(!_[_0x7026('0x16')](queues[_0x2c82c9[_0x7026('0x5')]])){queues[_0x2c82c9[_0x7026('0x5')]][_0x7026('0x25')]=![];queues[_0x2c82c9[_0x7026('0x5')]][_0x7026('0x26')]=null;queues[_0x2c82c9['uniqueid']][_0x7026('0x18')]=!![];queues[_0x2c82c9[_0x7026('0x5')]][_0x7026('0x27')]=utils[_0x7026('0x14')]();queues[_0x2c82c9[_0x7026('0x5')]][_0x7026('0x9')]=_0x2c82c9[_0x7026('0x28')][_0x7026('0x23')]();utils['info'](util['format'](_0x7026('0x29'),_0x2c82c9[_0x7026('0x5')],queues[_0x2c82c9[_0x7026('0x5')]]['name'],_0x2c82c9[_0x7026('0x28')],queues[_0x2c82c9[_0x7026('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x2c82c9['uniqueid']]);}}else if(!_[_0x7026('0x16')](_0x2c82c9[_0x7026('0x21')][_0x7026('0x2a')])){if(!_[_0x7026('0x16')](queues[_0x2c82c9[_0x7026('0x5')]])&&!queues[_0x2c82c9[_0x7026('0x5')]][_0x7026('0x25')]){queues[_0x2c82c9['uniqueid']][_0x7026('0x25')]=![];queues[_0x2c82c9[_0x7026('0x5')]]['queuecallerabandonAt']=null;queues[_0x2c82c9[_0x7026('0x5')]][_0x7026('0x18')]=!![];queues[_0x2c82c9[_0x7026('0x5')]][_0x7026('0x27')]=utils['now']();queues[_0x2c82c9[_0x7026('0x5')]][_0x7026('0x9')]=_0x7026('0x2b');utils[_0x7026('0x2')](util[_0x7026('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x2c82c9['uniqueid'],queues[_0x2c82c9['uniqueid']][_0x7026('0x1d')],_0x2c82c9['value'],queues[_0x2c82c9['uniqueid']][_0x7026('0x9')]));}}}catch(_0x3ed0ee){utils[_0x7026('0x1f')](util[_0x7026('0x3')]('[%s][queues][varset]',_0x2c82c9[_0x7026('0x5')]),_0x3ed0ee);}};exports['queuecallerabandon']=function(_0x167ce9){try{if(!_[_0x7026('0x16')](queues[_0x167ce9['uniqueid']])){utils[_0x7026('0xf')](util[_0x7026('0x3')](_0x7026('0x2c'),_0x167ce9[_0x7026('0x5')]),_0x167ce9);queues[_0x167ce9[_0x7026('0x5')]][_0x7026('0x18')]=![];queues[_0x167ce9[_0x7026('0x5')]][_0x7026('0x27')]=null;queues[_0x167ce9[_0x7026('0x5')]][_0x7026('0x25')]=!![];queues[_0x167ce9[_0x7026('0x5')]]['queuecallerabandonAt']=utils[_0x7026('0x14')]();queues[_0x167ce9[_0x7026('0x5')]]['queuecallerexitreason']=_0x7026('0x2d');utils[_0x7026('0x2')](util['format'](_0x7026('0x2e'),_0x167ce9[_0x7026('0x5')],queues[_0x167ce9[_0x7026('0x5')]]['name'],queues[_0x167ce9['uniqueid']]['queuecallerexitreason']));}}catch(_0x3ce295){utils[_0x7026('0x1f')](util[_0x7026('0x3')](_0x7026('0x2c'),_0x167ce9[_0x7026('0x5')]),_0x3ce295);}};exports[_0x7026('0x2f')]=function(_0x3dbf6c){try{if(!_[_0x7026('0x16')](queues[_0x3dbf6c[_0x7026('0x5')]])){utils[_0x7026('0xf')](util['format']('[%s][queues][queuecallerleave]',_0x3dbf6c[_0x7026('0x5')]),_0x3dbf6c);utils[_0x7026('0x2')](util[_0x7026('0x3')](_0x7026('0x30'),_0x3dbf6c[_0x7026('0x5')],queues[_0x3dbf6c[_0x7026('0x5')]][_0x7026('0x1d')],_0x3dbf6c[_0x7026('0x31')],_0x3dbf6c[_0x7026('0x32')]));queues[_0x3dbf6c[_0x7026('0x5')]][_0x7026('0x2f')]=!![];queues[_0x3dbf6c[_0x7026('0x5')]][_0x7026('0x17')]=utils[_0x7026('0x14')]();queues[_0x3dbf6c[_0x7026('0x5')]][_0x7026('0x33')]=utils['diffTime'](queues[_0x3dbf6c[_0x7026('0x5')]][_0x7026('0x17')],queues[_0x3dbf6c[_0x7026('0x5')]][_0x7026('0x34')]);queues[_0x3dbf6c[_0x7026('0x5')]][_0x7026('0x12')]=_0x3dbf6c[_0x7026('0x12')];queues[_0x3dbf6c[_0x7026('0x5')]][_0x7026('0x35')]=_0x3dbf6c['count'];queues[_0x3dbf6c[_0x7026('0x5')]]['connectedlinenum']=_0x3dbf6c[_0x7026('0x31')];queues[_0x3dbf6c[_0x7026('0x5')]][_0x7026('0x32')]=_0x3dbf6c[_0x7026('0x32')];}}catch(_0x78fa49){utils[_0x7026('0x1f')](util['format']('[%s][queues][queuecallerleave]',_0x3dbf6c[_0x7026('0x5')]),_0x78fa49);}};exports[_0x7026('0x36')]=function(_0x53bfe7){try{if(!_[_0x7026('0x16')](queues[_0x53bfe7[_0x7026('0x5')]])){utils[_0x7026('0xf')](util[_0x7026('0x3')]('[%s][queues][agentconnect]',_0x53bfe7[_0x7026('0x5')]),_0x53bfe7);utils['info'](util[_0x7026('0x3')](_0x7026('0x37'),_0x53bfe7[_0x7026('0x5')],queues[_0x53bfe7[_0x7026('0x5')]][_0x7026('0x1d')],_0x53bfe7[_0x7026('0x38')],_0x53bfe7[_0x7026('0x39')]));queues[_0x53bfe7[_0x7026('0x5')]][_0x7026('0x25')]=![];queues[_0x53bfe7['uniqueid']][_0x7026('0x25')]=![];queues[_0x53bfe7['uniqueid']]['queuecallerabandonAt']=null;queues[_0x53bfe7[_0x7026('0x5')]][_0x7026('0x18')]=![];queues[_0x53bfe7[_0x7026('0x5')]][_0x7026('0x9')]=null;queues[_0x53bfe7[_0x7026('0x5')]][_0x7026('0x27')]=null;queues[_0x53bfe7[_0x7026('0x5')]][_0x7026('0x3a')]=!![];queues[_0x53bfe7['uniqueid']][_0x7026('0x8')]=_0x53bfe7['destaccountcode'];queues[_0x53bfe7[_0x7026('0x5')]][_0x7026('0x3b')]=_0x53bfe7[_0x7026('0x38')];}}catch(_0x3a98bb){utils[_0x7026('0x1f')](util[_0x7026('0x3')](_0x7026('0x3c'),_0x53bfe7[_0x7026('0x5')]),_0x3a98bb);}};exports[_0x7026('0x3d')]=function(_0x5ec4d3){try{if(!_[_0x7026('0x16')](queues[_0x5ec4d3[_0x7026('0x5')]])){if(queues[_0x5ec4d3[_0x7026('0x5')]][_0x7026('0x17')]){utils[_0x7026('0xf')](util['format'](_0x7026('0x3e'),_0x5ec4d3[_0x7026('0x5')]),_0x5ec4d3);queues[_0x5ec4d3[_0x7026('0x5')]]['queuecallerabandon']=![];queues[_0x5ec4d3[_0x7026('0x5')]]['queuecallerabandon']=![];queues[_0x5ec4d3[_0x7026('0x5')]]['queuecallerabandonAt']=null;queues[_0x5ec4d3[_0x7026('0x5')]][_0x7026('0x18')]=![];queues[_0x5ec4d3['uniqueid']]['queuecallerexitAt']=null;queues[_0x5ec4d3['uniqueid']][_0x7026('0x3a')]=!![];queues[_0x5ec4d3[_0x7026('0x5')]]['lastAssignedTo']=_0x5ec4d3[_0x7026('0x38')];queues[_0x5ec4d3['uniqueid']][_0x7026('0x19')]=!![];queues[_0x5ec4d3[_0x7026('0x5')]][_0x7026('0x1a')]=utils[_0x7026('0x14')]();if(_0x5ec4d3[_0x7026('0x3f')]==_0x7026('0x40')){if(!queues[_0x5ec4d3[_0x7026('0x5')]]['transfer']){queues[_0x5ec4d3[_0x7026('0x5')]][_0x7026('0x9')]=_0x7026('0x41');}}else{queues[_0x5ec4d3[_0x7026('0x5')]][_0x7026('0x9')]=_0x7026('0x42')+_0x5ec4d3[_0x7026('0x3f')][_0x7026('0x23')]();}utils[_0x7026('0x2')](util[_0x7026('0x3')](_0x7026('0x43'),_0x5ec4d3[_0x7026('0x5')],queues[_0x5ec4d3[_0x7026('0x5')]][_0x7026('0x1d')],_0x5ec4d3[_0x7026('0x38')],queues[_0x5ec4d3[_0x7026('0x5')]][_0x7026('0x9')]));writeDB(queues[_0x5ec4d3['uniqueid']]);}}}catch(_0x290634){utils[_0x7026('0x1f')](util[_0x7026('0x3')](_0x7026('0x3e'),_0x5ec4d3[_0x7026('0x5')]),_0x290634);}};exports[_0x7026('0x44')]=function(_0x487fd0){try{if(!_[_0x7026('0x16')](queues[_0x487fd0['transfereeuniqueid']])){utils[_0x7026('0xf')](util[_0x7026('0x3')](_0x7026('0x45'),_0x487fd0[_0x7026('0x5')]),_0x487fd0);queues[_0x487fd0[_0x7026('0x46')]]['transfer']=!![];queues[_0x487fd0['transfereeuniqueid']]['transfertype']=_0x7026('0x47');queues[_0x487fd0[_0x7026('0x46')]][_0x7026('0x48')]=_0x487fd0['extension'];queues[_0x487fd0[_0x7026('0x46')]]['transferuniqueid']=_0x487fd0[_0x7026('0x46')];queues[_0x487fd0[_0x7026('0x46')]][_0x7026('0x9')]='BLINDTRANSFER';utils['info'](util[_0x7026('0x3')](_0x7026('0x49'),_0x487fd0[_0x7026('0x5')],queues[_0x487fd0[_0x7026('0x46')]][_0x7026('0x1d')],_0x487fd0[_0x7026('0x46')],_0x487fd0[_0x7026('0x4a')]));}}catch(_0x1beb37){utils[_0x7026('0x1f')](util[_0x7026('0x3')](_0x7026('0x45'),_0x487fd0[_0x7026('0x5')]),_0x1beb37);}};exports[_0x7026('0x4b')]=function(_0x3470cd){try{utils['debug'](util[_0x7026('0x3')](_0x7026('0x4c'),_0x3470cd[_0x7026('0x4d')]),_0x3470cd);if(_0x3470cd[_0x7026('0x4d')]==_0x3470cd[_0x7026('0x4e')]){if(!_[_0x7026('0x16')](queues[_0x3470cd['secondtransfererlinkedid']])){utils['info'](util['format'](_0x7026('0x4f'),_0x3470cd[_0x7026('0x4d')],queues[_0x3470cd['secondtransfererlinkedid']][_0x7026('0x1d')],_0x3470cd['origtransfererexten']));queues[_0x3470cd[_0x7026('0x50')]][_0x7026('0x40')]=!![];queues[_0x3470cd['secondtransfererlinkedid']][_0x7026('0x51')]=_0x7026('0x52');queues[_0x3470cd[_0x7026('0x50')]]['transferexten']=_0x3470cd[_0x7026('0x53')];queues[_0x3470cd[_0x7026('0x50')]][_0x7026('0x54')]=_0x3470cd[_0x7026('0x4d')];queues[_0x3470cd['secondtransfererlinkedid']][_0x7026('0x9')]=_0x7026('0x55');}if(!_['isNil'](queues[_0x3470cd['origtransfererlinkedid']])){if(_0x3470cd[_0x7026('0x56')]&&queues[_0x3470cd[_0x7026('0x56')]]){queues[_0x3470cd[_0x7026('0x56')]]['queuecallerenterreason']=0x1;queues[_0x3470cd['transfereeuniqueid']]=_[_0x7026('0x57')](queues[_0x3470cd[_0x7026('0x56')]]);queues[_0x3470cd['transfereeuniqueid']][_0x7026('0xd')]=_0x3470cd[_0x7026('0x58')];queues[_0x3470cd[_0x7026('0x46')]][_0x7026('0x1e')]=0x2;queues[_0x3470cd[_0x7026('0x46')]]['calleridnum']=queues[_0x3470cd[_0x7026('0x50')]][_0x7026('0x7')];queues[_0x3470cd['transfereeuniqueid']][_0x7026('0x59')]=queues[_0x3470cd[_0x7026('0x50')]][_0x7026('0x59')];queues[_0x3470cd['transfereeuniqueid']][_0x7026('0x34')]=utils['now']();queues[_0x3470cd[_0x7026('0x46')]]['queuecallerleaveAt']=utils[_0x7026('0x14')]();queues[_0x3470cd['transfereeuniqueid']][_0x7026('0x33')]=0x0;queues[_0x3470cd[_0x7026('0x46')]][_0x7026('0x5a')]=0x0;utils['info'](util[_0x7026('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x3470cd['origtransfereruniqueid'],queues[_0x3470cd[_0x7026('0x46')]][_0x7026('0x1d')],queues[_0x3470cd[_0x7026('0x46')]][_0x7026('0x7')],queues[_0x3470cd[_0x7026('0x46')]][_0x7026('0x59')]));}else{utils[_0x7026('0x2')](util['format'](_0x7026('0x5b'),_0x3470cd['origtransfereruniqueid'],queues[_0x3470cd[_0x7026('0x4e')]]['name'],_0x3470cd['secondtransfererlinkedid']));queues[_0x3470cd[_0x7026('0x4e')]][_0x7026('0xd')]=_0x3470cd['secondtransfererlinkedid'];}}}else if(_0x3470cd['secondtransfereruniqueid']==_0x3470cd[_0x7026('0x50')]){if(!_[_0x7026('0x16')](queues[_0x3470cd[_0x7026('0x4e')]])){utils[_0x7026('0x2')](util[_0x7026('0x3')](_0x7026('0x5c'),_0x3470cd['origtransfereruniqueid'],queues[_0x3470cd['origtransfererlinkedid']][_0x7026('0x1d')],_0x3470cd[_0x7026('0x5d')],_0x3470cd[_0x7026('0x5e')]));queues[_0x3470cd[_0x7026('0x4e')]]['transfer']=!![];queues[_0x3470cd[_0x7026('0x4e')]][_0x7026('0x51')]='ATTENDED';queues[_0x3470cd[_0x7026('0x4e')]][_0x7026('0x48')]=_0x3470cd[_0x7026('0x5e')];queues[_0x3470cd['origtransfererlinkedid']][_0x7026('0x54')]=_0x3470cd[_0x7026('0x5d')];queues[_0x3470cd[_0x7026('0x4e')]][_0x7026('0x9')]='ATTENDEDTRANSFER';}if(!_[_0x7026('0x16')](queues[_0x3470cd[_0x7026('0x50')]])){if(_0x3470cd[_0x7026('0x5f')]&&queues[_0x3470cd['transfertargetlinkedid']]){queues[_0x3470cd[_0x7026('0x5f')]][_0x7026('0x1e')]=0x1;queues[_0x3470cd[_0x7026('0x58')]]=_[_0x7026('0x57')](queues[_0x3470cd['transfertargetlinkedid']]);queues[_0x3470cd[_0x7026('0x58')]][_0x7026('0xd')]=_0x3470cd['transfertargetuniqueid'];queues[_0x3470cd[_0x7026('0x58')]][_0x7026('0x1e')]=0x2;queues[_0x3470cd[_0x7026('0x58')]]['calleridnum']=queues[_0x3470cd[_0x7026('0x4e')]][_0x7026('0x7')];queues[_0x3470cd[_0x7026('0x58')]][_0x7026('0x59')]=queues[_0x3470cd['origtransfererlinkedid']]['calleridname'];queues[_0x3470cd[_0x7026('0x58')]]['queuecallerjoinAt']=utils[_0x7026('0x14')]();queues[_0x3470cd[_0x7026('0x58')]][_0x7026('0x17')]=utils[_0x7026('0x14')]();queues[_0x3470cd['transfertargetuniqueid']][_0x7026('0x33')]=0x0;queues[_0x3470cd[_0x7026('0x58')]]['mohtime']=0x0;utils[_0x7026('0x2')](util['format'](_0x7026('0x60'),_0x3470cd[_0x7026('0x4d')],queues[_0x3470cd[_0x7026('0x58')]][_0x7026('0x1d')],queues[_0x3470cd['transfertargetuniqueid']][_0x7026('0xd')],queues[_0x3470cd[_0x7026('0x58')]][_0x7026('0x7')],queues[_0x3470cd[_0x7026('0x58')]]['calleridname']));}else{utils[_0x7026('0x2')](util['format'](_0x7026('0x5b'),_0x3470cd[_0x7026('0x4d')],queues[_0x3470cd[_0x7026('0x50')]][_0x7026('0x1d')],_0x3470cd[_0x7026('0x4e')]));queues[_0x3470cd['secondtransfererlinkedid']][_0x7026('0xd')]=_0x3470cd[_0x7026('0x4e')];}}}}catch(_0x36512a){utils['error'](util[_0x7026('0x3')](_0x7026('0x4c'),_0x3470cd[_0x7026('0x4d')]),_0x36512a);}};exports['musiconholdstart']=function(_0x41f76b){try{if(!_[_0x7026('0x16')](queues[_0x41f76b[_0x7026('0x5')]])){utils[_0x7026('0xf')](util['format'](_0x7026('0x61'),_0x41f76b[_0x7026('0x5')]),_0x41f76b);queues[_0x41f76b[_0x7026('0x5')]]['musiconholdstartAt']=utils[_0x7026('0x14')]();utils[_0x7026('0x2')](util[_0x7026('0x3')](_0x7026('0x62'),_0x41f76b[_0x7026('0x5')],queues[_0x41f76b[_0x7026('0x5')]]['name'],queues[_0x41f76b[_0x7026('0x5')]]['musiconholdstartAt']));}}catch(_0x13dcb5){utils[_0x7026('0x1f')](util[_0x7026('0x3')](_0x7026('0x61'),_0x41f76b[_0x7026('0x5')]),_0x13dcb5);}};exports['musiconholdstop']=function(_0x157c2e){try{if(!_['isNil'](queues[_0x157c2e[_0x7026('0x5')]])){if(!_[_0x7026('0x16')](queues[_0x157c2e['uniqueid']][_0x7026('0x63')])){utils[_0x7026('0xf')](util[_0x7026('0x3')](_0x7026('0x64'),_0x157c2e[_0x7026('0x5')]),_0x157c2e);queues[_0x157c2e[_0x7026('0x5')]][_0x7026('0x5a')]+=utils[_0x7026('0x65')](utils['now'](),queues[_0x157c2e['uniqueid']][_0x7026('0x63')]);utils['info'](util[_0x7026('0x3')](_0x7026('0x66'),_0x157c2e[_0x7026('0x5')],queues[_0x157c2e['uniqueid']][_0x7026('0x1d')],queues[_0x157c2e['uniqueid']][_0x7026('0x5a')]));delete queues[_0x157c2e[_0x7026('0x5')]]['musiconholdstartAt'];}}}catch(_0x3455dd){utils['error'](util[_0x7026('0x3')]('[%s][queues][musiconholdstop]',_0x157c2e[_0x7026('0x5')]),_0x3455dd);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 0535814..6bc8a51 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 _0xef58=['membername','name','UserId','request','CreateVoiceRecording','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','debug','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','varset','variable','[%s][recordings][varset]','value','endsWith','.wav49','replace','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereruniqueid','recording','./utils','./transfers.controller','info','format','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then'];(function(_0xd3b861,_0x524fc8){var _0x2ef9a8=function(_0x3161eb){while(--_0x3161eb){_0xd3b861['push'](_0xd3b861['shift']());}};_0x2ef9a8(++_0x524fc8);}(_0xef58,0x14a));var _0x8ef5=function(_0x3d6084,_0x4b738b){_0x3d6084=_0x3d6084-0x0;var _0x342378=_0xef58[_0x3d6084];return _0x342378;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x8ef5('0x0'));var transfers=require(_0x8ef5('0x1'));var recordings={};function writeDB(_0x39247e){var _0x319768;utils[_0x8ef5('0x2')](util[_0x8ef5('0x3')]('[%s][recordings][writeDB]',_0x39247e[_0x8ef5('0x4')]));if(transfers[_0x8ef5('0x5')][_0x39247e['uniqueid']]){_0x319768=_0x39247e[_0x8ef5('0x4')];_0x39247e[_0x8ef5('0x4')]=transfers[_0x8ef5('0x5')][_0x39247e['uniqueid']][_0x8ef5('0x6')];}if(_0x39247e[_0x8ef5('0x7')]){utils[_0x8ef5('0x8')](_0x39247e['accountcode'])[_0x8ef5('0x9')](function(_0xee728d){if(_0xee728d){_0x39247e[_0x8ef5('0xa')]=_0xee728d[_0x8ef5('0xb')];_0x39247e[_0x8ef5('0xc')]=_0xee728d['id'];}utils[_0x8ef5('0xd')](_0x8ef5('0xe'),_0x39247e);});}else{utils[_0x8ef5('0xd')](_0x8ef5('0xe'),_0x39247e);}if(_0x319768)delete transfers[_0x8ef5('0x5')][_0x319768];}exports['newchannel']=function(_0x44126a){try{utils['debug'](util[_0x8ef5('0x3')](_0x8ef5('0xf'),_0x44126a[_0x8ef5('0x4')]),_0x44126a);if(_0x44126a[_0x8ef5('0x4')]==_0x44126a[_0x8ef5('0x10')]){utils[_0x8ef5('0x2')](util[_0x8ef5('0x3')](_0x8ef5('0x11'),_0x44126a[_0x8ef5('0x4')],_0x44126a[_0x8ef5('0x12')],_0x44126a[_0x8ef5('0x13')]));recordings[_0x44126a[_0x8ef5('0x4')]]={'uniqueid':_0x44126a[_0x8ef5('0x4')],'accountcode':_0x44126a[_0x8ef5('0x7')],'exten':_0x44126a[_0x8ef5('0x13')],'context':_0x44126a[_0x8ef5('0x12')],'channel':_0x44126a[_0x8ef5('0x14')],'monitors':[]};}}catch(_0x4fa885){utils[_0x8ef5('0x15')](util[_0x8ef5('0x3')](_0x8ef5('0xf'),_0x44126a[_0x8ef5('0x4')]),_0x4fa885);}};exports['newstate']=function(_0x2418ae){try{utils[_0x8ef5('0x16')](util[_0x8ef5('0x3')](_0x8ef5('0x17'),_0x2418ae[_0x8ef5('0x4')]),_0x2418ae);if(!_['isNil'](recordings[_0x2418ae[_0x8ef5('0x4')]])&&_0x2418ae[_0x8ef5('0x18')]==0x6){utils[_0x8ef5('0x2')](util[_0x8ef5('0x3')](_0x8ef5('0x19'),_0x2418ae['uniqueid'],_0x2418ae[_0x8ef5('0x12')],_0x2418ae[_0x8ef5('0x14')]));}else if(!_[_0x8ef5('0x1a')](recordings[_0x2418ae[_0x8ef5('0x10')]])&&_0x2418ae[_0x8ef5('0x18')]==0x6&&_0x2418ae[_0x8ef5('0x12')]!=_0x8ef5('0x1b')){utils[_0x8ef5('0x2')](util[_0x8ef5('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x2418ae[_0x8ef5('0x4')],_0x2418ae[_0x8ef5('0x10')],_0x2418ae[_0x8ef5('0x12')],_0x2418ae['channel']));recordings[_0x2418ae[_0x8ef5('0x10')]][_0x8ef5('0x7')]=_0x2418ae[_0x8ef5('0x7')];}}catch(_0x397eaa){utils['error'](util['format']('[%s][recordings][newstate]',_0x2418ae['uniqueid']),_0x397eaa);}};exports[_0x8ef5('0x1c')]=function(_0x3f74f1){try{if(!_[_0x8ef5('0x1a')](_0x3f74f1[_0x8ef5('0x1d')])&&!_[_0x8ef5('0x1a')](_0x3f74f1[_0x8ef5('0x1d')]['mixmonitor_filename'])){utils[_0x8ef5('0x16')](util[_0x8ef5('0x3')](_0x8ef5('0x1e'),_0x3f74f1[_0x8ef5('0x4')]),_0x3f74f1);utils[_0x8ef5('0x2')](util[_0x8ef5('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x3f74f1[_0x8ef5('0x4')],_0x3f74f1[_0x8ef5('0x1d')],_0x3f74f1[_0x8ef5('0x1f')]));if(_[_0x8ef5('0x20')](_0x3f74f1[_0x8ef5('0x1f')],_0x8ef5('0x21'))){_0x3f74f1['value']=_0x3f74f1[_0x8ef5('0x1f')][_0x8ef5('0x22')]('.wav49','.WAV');}if(recordings[_0x3f74f1[_0x8ef5('0x10')]]){var _0x4640da=_['find'](recordings[_0x3f74f1[_0x8ef5('0x10')]][_0x8ef5('0x23')],{'value':_0x3f74f1['value']});if(_[_0x8ef5('0x1a')](_0x4640da)){recordings[_0x3f74f1['linkedid']][_0x8ef5('0x23')][_0x8ef5('0x24')]({'value':_0x3f74f1[_0x8ef5('0x1f')]});}}}}catch(_0x39c5dc){utils['error'](util[_0x8ef5('0x3')](_0x8ef5('0x1e'),_0x3f74f1['uniqueid']),_0x39c5dc);}};exports[_0x8ef5('0x25')]=function(_0x529e3e){try{if(!_['isNil'](recordings[_0x529e3e[_0x8ef5('0x4')]])){utils['debug'](util[_0x8ef5('0x3')](_0x8ef5('0x26'),_0x529e3e['uniqueid']),_0x529e3e);utils['info'](util[_0x8ef5('0x3')](_0x8ef5('0x27'),_0x529e3e[_0x8ef5('0x4')],_0x529e3e[_0x8ef5('0x28')],_0x529e3e['calleridname'],_0x529e3e[_0x8ef5('0x29')]));recordings[_0x529e3e['uniqueid']][_0x8ef5('0x28')]=_0x529e3e['calleridnum'];recordings[_0x529e3e[_0x8ef5('0x4')]]['calleridname']=_0x529e3e[_0x8ef5('0x2a')];recordings[_0x529e3e[_0x8ef5('0x4')]][_0x8ef5('0x2b')]=_0x529e3e['connectedlinenum'];recordings[_0x529e3e[_0x8ef5('0x4')]][_0x8ef5('0x2c')]=_0x529e3e[_0x8ef5('0x2c')];if(recordings[_0x529e3e['uniqueid']][_0x8ef5('0x2d')]=='outbound'&&recordings[_0x529e3e[_0x8ef5('0x4')]][_0x8ef5('0x7')]){recordings[_0x529e3e['uniqueid']][_0x8ef5('0x2b')]=recordings[_0x529e3e['uniqueid']][_0x8ef5('0x7')];recordings[_0x529e3e[_0x8ef5('0x4')]][_0x8ef5('0x2c')]='';}recordings[_0x529e3e[_0x8ef5('0x4')]]['monitors']['forEach'](function(_0x45c28e){var _0x422a21=_[_0x8ef5('0x2e')](recordings[_0x529e3e[_0x8ef5('0x4')]]);_0x422a21[_0x8ef5('0x1f')]=_0x45c28e['value'];writeDB(_0x422a21);});delete recordings[_0x529e3e[_0x8ef5('0x4')]];}}catch(_0x52a6b4){utils[_0x8ef5('0x15')](util[_0x8ef5('0x3')]('[%s][recordings][hangup]',_0x529e3e[_0x8ef5('0x4')]),_0x52a6b4);}};exports['newexten']=function(_0x2f54ee){try{if(!_[_0x8ef5('0x1a')](recordings[_0x2f54ee[_0x8ef5('0x4')]])){utils[_0x8ef5('0x16')](util['format'](_0x8ef5('0x2f'),_0x2f54ee['uniqueid']),_0x2f54ee);utils[_0x8ef5('0x2')](util[_0x8ef5('0x3')](_0x8ef5('0x30'),_0x2f54ee[_0x8ef5('0x4')],_0x2f54ee[_0x8ef5('0x31')],_0x2f54ee[_0x8ef5('0x32')]));if(_0x2f54ee[_0x8ef5('0x31')]['toLowerCase']()==_0x8ef5('0x33')&&_[_0x8ef5('0x34')](_0x2f54ee[_0x8ef5('0x32')][_0x8ef5('0x35')](),_0x8ef5('0x36'))){var _0x1b9b4d=_0x2f54ee[_0x8ef5('0x32')][_0x8ef5('0x37')]('=');var _0x3e6bed=_0x1b9b4d[0x0]['substring'](_0x1b9b4d[0x0][_0x8ef5('0x38')]('(')+0x1,_0x1b9b4d[0x0][_0x8ef5('0x38')](')'));var _0x398aff=_0x1b9b4d[0x1];recordings[_0x2f54ee[_0x8ef5('0x4')]][_0x3e6bed]=_0x398aff;}}}catch(_0x5e0307){utils[_0x8ef5('0x15')](util['format'](_0x8ef5('0x2f'),_0x2f54ee['uniqueid']),_0x5e0307);}};exports[_0x8ef5('0x39')]=function(_0x130ef1){try{if(!_[_0x8ef5('0x1a')](recordings[_0x130ef1['uniqueid']])){utils[_0x8ef5('0x16')](util[_0x8ef5('0x3')]('[%s][recordings][queuecallerjoin]',_0x130ef1[_0x8ef5('0x4')]),_0x130ef1);utils['info'](util[_0x8ef5('0x3')](_0x8ef5('0x3a'),_0x130ef1[_0x8ef5('0x4')],_0x130ef1[_0x8ef5('0x3b')]));recordings[_0x130ef1[_0x8ef5('0x4')]][_0x8ef5('0x3b')]=_0x130ef1[_0x8ef5('0x3b')];}}catch(_0x3d2d5e){utils[_0x8ef5('0x15')](util[_0x8ef5('0x3')](_0x8ef5('0x3c'),_0x130ef1[_0x8ef5('0x4')]),_0x3d2d5e);}};exports['blindtransfer']=function(_0x52b192){try{utils['debug'](util[_0x8ef5('0x3')](_0x8ef5('0x3d'),_0x52b192[_0x8ef5('0x4')]),_0x52b192);utils[_0x8ef5('0x2')](util[_0x8ef5('0x3')](_0x8ef5('0x3e'),_0x52b192[_0x8ef5('0x4')],_0x52b192[_0x8ef5('0x3f')],_0x52b192[_0x8ef5('0x40')],_0x52b192[_0x8ef5('0x41')],_0x52b192['transfereecalleridname']));if(recordings[_0x52b192[_0x8ef5('0x42')]]&&transfers['blinds'][_0x52b192[_0x8ef5('0x42')]]){transfers[_0x8ef5('0x5')][_0x52b192[_0x8ef5('0x42')]][_0x8ef5('0x43')]=!![];}}catch(_0x1e62b4){utils[_0x8ef5('0x15')](util[_0x8ef5('0x3')]('[%s][recordings][blindtransfer]',_0x52b192['uniqueid']),_0x1e62b4);}}; \ No newline at end of file +var _0x51af=['[%s][recordings][newchannel]','linkedid','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.WAV','find','monitors','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','./utils','./transfers.controller','info','uniqueid','blinds','transfereeuniqueid','getUserByInternal','accountcode','then','membername','name','UserId','CreateVoiceRecording','request','debug','format'];(function(_0x677685,_0x445c95){var _0x34c52c=function(_0x326a41){while(--_0x326a41){_0x677685['push'](_0x677685['shift']());}};_0x34c52c(++_0x445c95);}(_0x51af,0x148));var _0xf51a=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x51af[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0xf51a('0x0'));var util=require('util');var utils=require(_0xf51a('0x1'));var transfers=require(_0xf51a('0x2'));var recordings={};function writeDB(_0x4d76a8){var _0xbf525;utils[_0xf51a('0x3')](util['format']('[%s][recordings][writeDB]',_0x4d76a8[_0xf51a('0x4')]));if(transfers[_0xf51a('0x5')][_0x4d76a8['uniqueid']]){_0xbf525=_0x4d76a8[_0xf51a('0x4')];_0x4d76a8[_0xf51a('0x4')]=transfers[_0xf51a('0x5')][_0x4d76a8[_0xf51a('0x4')]][_0xf51a('0x6')];}if(_0x4d76a8['accountcode']){utils[_0xf51a('0x7')](_0x4d76a8[_0xf51a('0x8')])[_0xf51a('0x9')](function(_0x378b78){if(_0x378b78){_0x4d76a8[_0xf51a('0xa')]=_0x378b78[_0xf51a('0xb')];_0x4d76a8[_0xf51a('0xc')]=_0x378b78['id'];}utils['request'](_0xf51a('0xd'),_0x4d76a8);});}else{utils[_0xf51a('0xe')](_0xf51a('0xd'),_0x4d76a8);}if(_0xbf525)delete transfers['blinds'][_0xbf525];}exports['newchannel']=function(_0x365a20){try{utils[_0xf51a('0xf')](util[_0xf51a('0x10')](_0xf51a('0x11'),_0x365a20[_0xf51a('0x4')]),_0x365a20);if(_0x365a20['uniqueid']==_0x365a20[_0xf51a('0x12')]){utils[_0xf51a('0x3')](util[_0xf51a('0x10')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x365a20['uniqueid'],_0x365a20[_0xf51a('0x13')],_0x365a20[_0xf51a('0x14')]));recordings[_0x365a20[_0xf51a('0x4')]]={'uniqueid':_0x365a20['uniqueid'],'accountcode':_0x365a20[_0xf51a('0x8')],'exten':_0x365a20[_0xf51a('0x14')],'context':_0x365a20[_0xf51a('0x13')],'channel':_0x365a20[_0xf51a('0x15')],'monitors':[]};}}catch(_0x1f8cf8){utils[_0xf51a('0x16')](util['format']('[%s][recordings][newchannel]',_0x365a20['uniqueid']),_0x1f8cf8);}};exports[_0xf51a('0x17')]=function(_0x172863){try{utils[_0xf51a('0xf')](util[_0xf51a('0x10')](_0xf51a('0x18'),_0x172863['uniqueid']),_0x172863);if(!_[_0xf51a('0x19')](recordings[_0x172863[_0xf51a('0x4')]])&&_0x172863[_0xf51a('0x1a')]==0x6){utils['info'](util[_0xf51a('0x10')](_0xf51a('0x1b'),_0x172863['uniqueid'],_0x172863[_0xf51a('0x13')],_0x172863[_0xf51a('0x15')]));}else if(!_[_0xf51a('0x19')](recordings[_0x172863[_0xf51a('0x12')]])&&_0x172863[_0xf51a('0x1a')]==0x6&&_0x172863[_0xf51a('0x13')]!='transfer'){utils['info'](util[_0xf51a('0x10')](_0xf51a('0x1c'),_0x172863['uniqueid'],_0x172863['linkedid'],_0x172863[_0xf51a('0x13')],_0x172863['channel']));recordings[_0x172863['linkedid']][_0xf51a('0x8')]=_0x172863['accountcode'];}}catch(_0x421a55){utils[_0xf51a('0x16')](util[_0xf51a('0x10')](_0xf51a('0x18'),_0x172863[_0xf51a('0x4')]),_0x421a55);}};exports[_0xf51a('0x1d')]=function(_0x102115){try{if(!_[_0xf51a('0x19')](_0x102115[_0xf51a('0x1e')])&&!_[_0xf51a('0x19')](_0x102115['variable'][_0xf51a('0x1f')])){utils[_0xf51a('0xf')](util['format'](_0xf51a('0x20'),_0x102115['uniqueid']),_0x102115);utils['info'](util[_0xf51a('0x10')](_0xf51a('0x21'),_0x102115['uniqueid'],_0x102115[_0xf51a('0x1e')],_0x102115[_0xf51a('0x22')]));if(_['endsWith'](_0x102115['value'],'.wav49')){_0x102115['value']=_0x102115[_0xf51a('0x22')]['replace']('.wav49',_0xf51a('0x23'));}if(recordings[_0x102115[_0xf51a('0x12')]]){var _0x109759=_[_0xf51a('0x24')](recordings[_0x102115[_0xf51a('0x12')]][_0xf51a('0x25')],{'value':_0x102115[_0xf51a('0x22')]});if(_[_0xf51a('0x19')](_0x109759)){recordings[_0x102115['linkedid']][_0xf51a('0x25')]['push']({'value':_0x102115[_0xf51a('0x22')]});}}}}catch(_0x49b9d4){utils['error'](util['format'](_0xf51a('0x20'),_0x102115[_0xf51a('0x4')]),_0x49b9d4);}};exports[_0xf51a('0x26')]=function(_0xfd5f8e){try{if(!_['isNil'](recordings[_0xfd5f8e[_0xf51a('0x4')]])){utils[_0xf51a('0xf')](util[_0xf51a('0x10')](_0xf51a('0x27'),_0xfd5f8e[_0xf51a('0x4')]),_0xfd5f8e);utils['info'](util[_0xf51a('0x10')](_0xf51a('0x28'),_0xfd5f8e[_0xf51a('0x4')],_0xfd5f8e[_0xf51a('0x29')],_0xfd5f8e['calleridname'],_0xfd5f8e[_0xf51a('0x2a')]));recordings[_0xfd5f8e[_0xf51a('0x4')]]['calleridnum']=_0xfd5f8e['calleridnum'];recordings[_0xfd5f8e[_0xf51a('0x4')]][_0xf51a('0x2b')]=_0xfd5f8e['calleridname'];recordings[_0xfd5f8e[_0xf51a('0x4')]][_0xf51a('0x2c')]=_0xfd5f8e['connectedlinenum'];recordings[_0xfd5f8e[_0xf51a('0x4')]]['connectedlinename']=_0xfd5f8e[_0xf51a('0x2d')];if(recordings[_0xfd5f8e[_0xf51a('0x4')]][_0xf51a('0x2e')]==_0xf51a('0x2f')&&recordings[_0xfd5f8e[_0xf51a('0x4')]]['accountcode']){recordings[_0xfd5f8e[_0xf51a('0x4')]]['connectedlinenum']=recordings[_0xfd5f8e[_0xf51a('0x4')]]['accountcode'];recordings[_0xfd5f8e['uniqueid']][_0xf51a('0x2d')]='';}recordings[_0xfd5f8e[_0xf51a('0x4')]][_0xf51a('0x25')][_0xf51a('0x30')](function(_0x211498){var _0x33568b=_[_0xf51a('0x31')](recordings[_0xfd5f8e[_0xf51a('0x4')]]);_0x33568b[_0xf51a('0x22')]=_0x211498['value'];writeDB(_0x33568b);});delete recordings[_0xfd5f8e['uniqueid']];}}catch(_0x285af8){utils['error'](util[_0xf51a('0x10')](_0xf51a('0x27'),_0xfd5f8e[_0xf51a('0x4')]),_0x285af8);}};exports['newexten']=function(_0x306496){try{if(!_[_0xf51a('0x19')](recordings[_0x306496[_0xf51a('0x4')]])){utils['debug'](util[_0xf51a('0x10')]('[%s][recordings][newexten]',_0x306496['uniqueid']),_0x306496);utils[_0xf51a('0x3')](util[_0xf51a('0x10')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x306496[_0xf51a('0x4')],_0x306496[_0xf51a('0x32')],_0x306496[_0xf51a('0x33')]));if(_0x306496[_0xf51a('0x32')][_0xf51a('0x34')]()=='set'&&_[_0xf51a('0x35')](_0x306496[_0xf51a('0x33')][_0xf51a('0x34')](),_0xf51a('0x36'))){var _0x6a225=_0x306496[_0xf51a('0x33')][_0xf51a('0x37')]('=');var _0x36d325=_0x6a225[0x0][_0xf51a('0x38')](_0x6a225[0x0][_0xf51a('0x39')]('(')+0x1,_0x6a225[0x0][_0xf51a('0x39')](')'));var _0x54facd=_0x6a225[0x1];recordings[_0x306496[_0xf51a('0x4')]][_0x36d325]=_0x54facd;}}}catch(_0x46ca4f){utils['error'](util['format']('[%s][recordings][newexten]',_0x306496[_0xf51a('0x4')]),_0x46ca4f);}};exports[_0xf51a('0x3a')]=function(_0x151c11){try{if(!_[_0xf51a('0x19')](recordings[_0x151c11[_0xf51a('0x4')]])){utils['debug'](util[_0xf51a('0x10')](_0xf51a('0x3b'),_0x151c11[_0xf51a('0x4')]),_0x151c11);utils[_0xf51a('0x3')](util[_0xf51a('0x10')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x151c11[_0xf51a('0x4')],_0x151c11[_0xf51a('0x3c')]));recordings[_0x151c11[_0xf51a('0x4')]][_0xf51a('0x3c')]=_0x151c11['queue'];}}catch(_0x30e278){utils[_0xf51a('0x16')](util[_0xf51a('0x10')](_0xf51a('0x3b'),_0x151c11[_0xf51a('0x4')]),_0x30e278);}};exports['blindtransfer']=function(_0x577c3c){try{utils['debug'](util[_0xf51a('0x10')](_0xf51a('0x3d'),_0x577c3c[_0xf51a('0x4')]),_0x577c3c);utils[_0xf51a('0x3')](util['format'](_0xf51a('0x3e'),_0x577c3c[_0xf51a('0x4')],_0x577c3c[_0xf51a('0x3f')],_0x577c3c[_0xf51a('0x40')],_0x577c3c[_0xf51a('0x41')],_0x577c3c[_0xf51a('0x42')]));if(recordings[_0x577c3c[_0xf51a('0x43')]]&&transfers[_0xf51a('0x5')][_0x577c3c['transfereruniqueid']]){transfers['blinds'][_0x577c3c[_0xf51a('0x43')]][_0xf51a('0x44')]=!![];}}catch(_0x44681a){utils[_0xf51a('0x16')](util[_0xf51a('0x10')](_0xf51a('0x3d'),_0x577c3c[_0xf51a('0x4')]),_0x44681a);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index bf3a182..e24859c 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 _0x3b6e=['CreateVoiceTransferReport','blinds','blindtransfer','debug','format','[%s][transfers][blindtransfer]','transferercalleridnum','blind','transfereruniqueid','error','attendedtransfer','origtransfereruniqueid','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request'];(function(_0x3011b7,_0x56b4b0){var _0x304ca2=function(_0x5832be){while(--_0x5832be){_0x3011b7['push'](_0x3011b7['shift']());}};_0x304ca2(++_0x56b4b0);}(_0x3b6e,0x171));var _0xe3b6=function(_0x58c09e,_0x16ae6f){_0x58c09e=_0x58c09e-0x0;var _0x47636a=_0x3b6e[_0x58c09e];return _0x47636a;};'use strict';var _=require(_0xe3b6('0x0'));var util=require(_0xe3b6('0x1'));var utils=require(_0xe3b6('0x2'));function writeDB(_0xa9b24b){utils[_0xe3b6('0x3')](util['format'](_0xe3b6('0x4'),_0xa9b24b[_0xe3b6('0x5')]===_0xe3b6('0x6')?_0xa9b24b['origtransfereruniqueid']:_0xa9b24b[_0xe3b6('0x7')],_0xa9b24b[_0xe3b6('0x5')]));utils[_0xe3b6('0x8')](_0xe3b6('0x9'),_0xa9b24b);}exports[_0xe3b6('0xa')]={};exports[_0xe3b6('0xb')]=function(_0xe1bd35){try{utils[_0xe3b6('0xc')](util[_0xe3b6('0xd')](_0xe3b6('0xe'),_0xe1bd35['uniqueid']),_0xe1bd35);utils['info'](util[_0xe3b6('0xd')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0xe1bd35[_0xe3b6('0x7')],_0xe1bd35[_0xe3b6('0xf')],_0xe1bd35['transferercalleridname'],_0xe1bd35['transfereecalleridnum'],_0xe1bd35['transfereecalleridname']));_0xe1bd35[_0xe3b6('0x5')]=_0xe3b6('0x10');exports[_0xe3b6('0xa')][_0xe1bd35[_0xe3b6('0x11')]]=_0xe1bd35;writeDB(_0xe1bd35);}catch(_0xdf138a){utils[_0xe3b6('0x12')](util[_0xe3b6('0xd')](_0xe3b6('0xe'),_0xe1bd35[_0xe3b6('0x7')]),_0xdf138a);}};exports[_0xe3b6('0x13')]=function(_0xf8cc42){try{utils[_0xe3b6('0xc')](util[_0xe3b6('0xd')]('[%s][transfers][attendedtransfer]',_0xf8cc42[_0xe3b6('0x14')]),_0xf8cc42);utils[_0xe3b6('0x3')](util[_0xe3b6('0xd')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0xf8cc42[_0xe3b6('0x14')],_0xf8cc42[_0xe3b6('0x15')],_0xf8cc42[_0xe3b6('0x16')],_0xf8cc42[_0xe3b6('0x17')],_0xf8cc42[_0xe3b6('0x18')]));_0xf8cc42=_[_0xe3b6('0x19')](_0xf8cc42,{'transfererchannel':_0xf8cc42[_0xe3b6('0x1a')],'transferercalleridnum':_0xf8cc42[_0xe3b6('0x15')],'transferercalleridname':_0xf8cc42['origtransferercalleridname'],'transfererconnectedlinenum':_0xf8cc42[_0xe3b6('0x1b')],'transfererconnectedlinename':_0xf8cc42[_0xe3b6('0x1c')],'transfereraccountcode':_0xf8cc42[_0xe3b6('0x1d')],'transferercontext':_0xf8cc42[_0xe3b6('0x1e')],'transfererexten':_0xf8cc42[_0xe3b6('0x1f')],'transfererlinkedid':_0xf8cc42['origtransfererlinkedid'],'context':_0xf8cc42[_0xe3b6('0x20')],'extension':_0xf8cc42[_0xe3b6('0x21')],'type':'attended'});if(_[_0xe3b6('0x22')](_0xf8cc42[_0xe3b6('0x23')])){_0xf8cc42=_['assign'](_0xf8cc42,{'transfereechannel':_0xf8cc42['transfertargetchannel'],'transfereecalleridnum':_0xf8cc42['transfertargetcalleridnum'],'transfereecalleridname':_0xf8cc42[_0xe3b6('0x18')],'transfereeconnectedlinenum':_0xf8cc42[_0xe3b6('0x24')],'transfereeconnectedlinename':_0xf8cc42[_0xe3b6('0x25')],'transfereeaccountcode':_0xf8cc42[_0xe3b6('0x26')],'transfereecontext':_0xf8cc42['transfertargetcontext'],'transfereeexten':_0xf8cc42[_0xe3b6('0x27')],'transfereelinkedid':_0xf8cc42[_0xe3b6('0x28')]});}writeDB(_0xf8cc42);}catch(_0x4460e9){utils[_0xe3b6('0x12')](util['format'](_0xe3b6('0x29'),_0xf8cc42[_0xe3b6('0x14')]),_0x4460e9);}}; \ No newline at end of file +var _0xf290=['attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','blinds','transfereruniqueid','error','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type'];(function(_0x17d195,_0x3ef6c1){var _0x3aa733=function(_0x3fcea2){while(--_0x3fcea2){_0x17d195['push'](_0x17d195['shift']());}};_0x3aa733(++_0x3ef6c1);}(_0xf290,0x80));var _0x0f29=function(_0x25c326,_0x250137){_0x25c326=_0x25c326-0x0;var _0x762452=_0xf290[_0x25c326];return _0x762452;};'use strict';var _=require(_0x0f29('0x0'));var util=require(_0x0f29('0x1'));var utils=require(_0x0f29('0x2'));function writeDB(_0x55b67a){utils[_0x0f29('0x3')](util[_0x0f29('0x4')](_0x0f29('0x5'),_0x55b67a[_0x0f29('0x6')]===_0x0f29('0x7')?_0x55b67a[_0x0f29('0x8')]:_0x55b67a[_0x0f29('0x9')],_0x55b67a['type']));utils['request'](_0x0f29('0xa'),_0x55b67a);}exports['blinds']={};exports[_0x0f29('0xb')]=function(_0x3d78fd){try{utils[_0x0f29('0xc')](util[_0x0f29('0x4')]('[%s][transfers][blindtransfer]',_0x3d78fd[_0x0f29('0x9')]),_0x3d78fd);utils['info'](util[_0x0f29('0x4')](_0x0f29('0xd'),_0x3d78fd['uniqueid'],_0x3d78fd[_0x0f29('0xe')],_0x3d78fd[_0x0f29('0xf')],_0x3d78fd[_0x0f29('0x10')],_0x3d78fd[_0x0f29('0x11')]));_0x3d78fd[_0x0f29('0x6')]=_0x0f29('0x12');exports[_0x0f29('0x13')][_0x3d78fd[_0x0f29('0x14')]]=_0x3d78fd;writeDB(_0x3d78fd);}catch(_0x4860e5){utils[_0x0f29('0x15')](util[_0x0f29('0x4')](_0x0f29('0x16'),_0x3d78fd[_0x0f29('0x9')]),_0x4860e5);}};exports[_0x0f29('0x17')]=function(_0x1eb930){try{utils[_0x0f29('0xc')](util[_0x0f29('0x4')](_0x0f29('0x18'),_0x1eb930[_0x0f29('0x8')]),_0x1eb930);utils[_0x0f29('0x3')](util[_0x0f29('0x4')](_0x0f29('0x19'),_0x1eb930['origtransfereruniqueid'],_0x1eb930[_0x0f29('0x1a')],_0x1eb930[_0x0f29('0x1b')],_0x1eb930[_0x0f29('0x1c')],_0x1eb930[_0x0f29('0x1d')]));_0x1eb930=_['assign'](_0x1eb930,{'transfererchannel':_0x1eb930[_0x0f29('0x1e')],'transferercalleridnum':_0x1eb930[_0x0f29('0x1a')],'transferercalleridname':_0x1eb930[_0x0f29('0x1b')],'transfererconnectedlinenum':_0x1eb930[_0x0f29('0x1f')],'transfererconnectedlinename':_0x1eb930[_0x0f29('0x20')],'transfereraccountcode':_0x1eb930[_0x0f29('0x21')],'transferercontext':_0x1eb930['secondtransferercontext'],'transfererexten':_0x1eb930[_0x0f29('0x22')],'transfererlinkedid':_0x1eb930[_0x0f29('0x23')],'context':_0x1eb930[_0x0f29('0x24')],'extension':_0x1eb930['origtransfererexten'],'type':_0x0f29('0x7')});if(_[_0x0f29('0x25')](_0x1eb930['transfereechannel'])){_0x1eb930=_['assign'](_0x1eb930,{'transfereechannel':_0x1eb930[_0x0f29('0x26')],'transfereecalleridnum':_0x1eb930[_0x0f29('0x1c')],'transfereecalleridname':_0x1eb930[_0x0f29('0x1d')],'transfereeconnectedlinenum':_0x1eb930[_0x0f29('0x27')],'transfereeconnectedlinename':_0x1eb930[_0x0f29('0x28')],'transfereeaccountcode':_0x1eb930[_0x0f29('0x29')],'transfereecontext':_0x1eb930[_0x0f29('0x2a')],'transfereeexten':_0x1eb930[_0x0f29('0x2b')],'transfereelinkedid':_0x1eb930[_0x0f29('0x2c')]});}writeDB(_0x1eb930);}catch(_0x1f950d){utils[_0x0f29('0x15')](util['format']('[%s][transfers][attendedtransfer]',_0x1eb930['origtransfereruniqueid']),_0x1f950d);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 01cdff2..1ba1667 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 _0xb5f1=['info','debug','inspect','error','then','[utils][request]\x20name:%s','catch','request','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','jayson/promise','util','client','http','../../config/logger','xdr'];(function(_0x2b7bbf,_0x391fba){var _0x3cf2ed=function(_0x2bf0b7){while(--_0x2bf0b7){_0x2b7bbf['push'](_0x2b7bbf['shift']());}};_0x3cf2ed(++_0x391fba);}(_0xb5f1,0x150));var _0x1b5f=function(_0x23e46d,_0x4304f2){_0x23e46d=_0x23e46d-0x0;var _0x6b740d=_0xb5f1[_0x23e46d];return _0x6b740d;};'use strict';var BPromise=require(_0x1b5f('0x0'));var jayson=require(_0x1b5f('0x1'));var moment=require('moment');var util=require(_0x1b5f('0x2'));var client=jayson[_0x1b5f('0x3')][_0x1b5f('0x4')]({'port':0x2329});var logger=require(_0x1b5f('0x5'))(_0x1b5f('0x6'));exports['info']=function(_0x6c0add,_0x40ee35){logger[_0x1b5f('0x7')](_0x6c0add,_0x40ee35?util['inspect'](_0x40ee35,{'showHidden':![],'depth':null}):'');};exports[_0x1b5f('0x8')]=function(_0x26a200,_0x59cab7){logger[_0x1b5f('0x8')](_0x26a200,_0x59cab7?util[_0x1b5f('0x9')](_0x59cab7,{'showHidden':![],'depth':null}):'');};exports[_0x1b5f('0xa')]=function(_0x5e3365,_0x25c9ca){logger['error'](_0x5e3365,_0x25c9ca?util['inspect'](_0x25c9ca,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0xbd4788,_0x25dced){return client['request'](_0xbd4788,{'body':_0x25dced})[_0x1b5f('0xb')](function(_0x3f01b0){logger[_0x1b5f('0x8')](_0x1b5f('0xc'),_0xbd4788,_0x3f01b0?util[_0x1b5f('0x9')](_0x3f01b0,{'showHidden':![],'depth':null}):'');})[_0x1b5f('0xd')](function(_0x22b293){logger[_0x1b5f('0xa')](_0x1b5f('0xc'),_0xbd4788,_0x22b293?util['inspect'](_0x22b293,{'showHidden':![],'depth':null}):'');});};function getUser(_0x57172b){return client[_0x1b5f('0xe')](_0x1b5f('0xf'),{'options':{'raw':!![],'attributes':['id',_0x1b5f('0x10'),_0x1b5f('0x11'),_0x1b5f('0x12')],'where':_0x57172b,'limit':0x1}})[_0x1b5f('0xb')](function(_0x50faf7){logger[_0x1b5f('0x8')](_0x1b5f('0x13'),JSON[_0x1b5f('0x14')](_0x57172b),_0x50faf7?util[_0x1b5f('0x9')](_0x50faf7,{'showHidden':![],'depth':null}):'');return _0x50faf7[_0x1b5f('0x15')][_0x1b5f('0x16')]?_0x50faf7[_0x1b5f('0x15')][0x0]:null;});}exports[_0x1b5f('0x17')]=function(_0x56ffb6){return new BPromise(function(_0x59963b,_0x370dd8){if(_0x56ffb6){return getUser({'internal':_0x56ffb6})[_0x1b5f('0xb')](function(_0x21326e){logger[_0x1b5f('0x7')](_0x1b5f('0x18'),_0x56ffb6,_0x21326e?_0x1b5f('0x19'):_0x1b5f('0x1a'));return _0x59963b(_0x21326e);})[_0x1b5f('0xd')](function(_0x19bc91){logger[_0x1b5f('0xa')](_0x1b5f('0x1b'),_0x19bc91?util[_0x1b5f('0x9')](_0x19bc91,{'showHidden':![],'depth':null}):'');return _0x59963b(null);});}return _0x59963b(null);});};exports['getUserByInterface']=function(_0x4ab3f6){return new BPromise(function(_0x3139c4,_0x1ab850){if(_0x4ab3f6){return getUser({'interface':_0x4ab3f6})[_0x1b5f('0xb')](function(_0x2c70be){logger['info'](_0x1b5f('0x1c'),_0x4ab3f6,_0x2c70be?_0x1b5f('0x19'):'notfound');return _0x3139c4(_0x2c70be);})['catch'](function(_0x4331d3){logger[_0x1b5f('0xa')](_0x1b5f('0x1d'),_0x4331d3?util[_0x1b5f('0x9')](_0x4331d3,{'showHidden':![],'depth':null}):'');return _0x3139c4(null);});}return _0x3139c4(null);});};exports[_0x1b5f('0x1e')]=function(_0x544754){return new BPromise(function(_0x450a5c,_0x2966e1){if(_0x544754){return getUser({'name':_0x544754})['then'](function(_0x15a576){logger['info'](_0x1b5f('0x1f'),_0x544754,_0x15a576?_0x1b5f('0x19'):_0x1b5f('0x1a'));return _0x450a5c(_0x15a576);})['catch'](function(_0x4df2bc){logger['error'](_0x1b5f('0x20'),_0x4df2bc?util[_0x1b5f('0x9')](_0x4df2bc,{'showHidden':![],'depth':null}):'');return _0x450a5c(null);});}return _0x450a5c(null);});};exports[_0x1b5f('0x21')]=function(_0xe68402){return new BPromise(function(_0x21d980,_0x3a74ab){if(_0xe68402){return client[_0x1b5f('0xe')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x1b5f('0x11'),'type',_0x1b5f('0x22'),_0x1b5f('0x23')],'where':{'name':_0xe68402},'limit':0x1}})[_0x1b5f('0xb')](function(_0x44b497){logger['debug'](_0x1b5f('0x24'),_0xe68402,_0x44b497?util[_0x1b5f('0x9')](_0x44b497,{'showHidden':![],'depth':null}):'');logger[_0x1b5f('0x7')](_0x1b5f('0x25'),_0xe68402,_0x44b497?_0x1b5f('0x19'):_0x1b5f('0x1a'));return _0x21d980(_0x44b497[_0x1b5f('0x15')]['length']?_0x44b497[_0x1b5f('0x15')][0x0]:null);})[_0x1b5f('0xd')](function(_0x295820){logger['error'](_0x1b5f('0x26'),_0x295820?util['inspect'](_0x295820,{'showHidden':![],'depth':null}):'');return _0x21d980(null);});}return _0x21d980(null);});};exports['addTime']=function(_0xa051ba,_0x22fde9){return moment(_0xa051ba)['add'](_0x22fde9,_0x1b5f('0x27'))[_0x1b5f('0x28')](_0x1b5f('0x29'));};exports[_0x1b5f('0x2a')]=function(_0x93a459,_0x48210d){return moment(_0x93a459)[_0x1b5f('0x2b')](_0x48210d,_0x1b5f('0x27'))['format'](_0x1b5f('0x29'));};exports[_0x1b5f('0x2c')]=function(_0x13d793,_0x25efa1){return moment(_0x13d793)[_0x1b5f('0x2d')](moment(_0x25efa1),_0x1b5f('0x27'));};exports['sumTime']=function(_0x205c1a,_0x1041dd){return parseInt(_0x205c1a,0xa)+parseInt(_0x1041dd,0xa);};exports[_0x1b5f('0x2e')]=function(){return moment()['format'](_0x1b5f('0x29'));};exports[_0x1b5f('0x2f')]=function(_0x36aae3,_0x2b11dd){if(_0x2b11dd){return moment(_0x36aae3)[_0x1b5f('0x2f')](_0x2b11dd);}return!![];};exports[_0x1b5f('0x30')]=function(_0x29e1e9,_0x495e7c){if(_0x495e7c){return moment(_0x29e1e9)[_0x1b5f('0x30')](_0x495e7c);}else if(_0x29e1e9){return!![];}return![];}; \ No newline at end of file +var _0x9333=['[utils][request]\x20name:%s','catch','GetUser','internal','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','client','http','info','inspect','error','request','then','debug'];(function(_0x34cc52,_0x5f0c7e){var _0x296404=function(_0x5678a5){while(--_0x5678a5){_0x34cc52['push'](_0x34cc52['shift']());}};_0x296404(++_0x5f0c7e);}(_0x9333,0x122));var _0x3933=function(_0x6fc90c,_0x51c095){_0x6fc90c=_0x6fc90c-0x0;var _0x3ddd7e=_0x9333[_0x6fc90c];return _0x3ddd7e;};'use strict';var BPromise=require(_0x3933('0x0'));var jayson=require(_0x3933('0x1'));var moment=require('moment');var util=require('util');var client=jayson[_0x3933('0x2')][_0x3933('0x3')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0x3933('0x4')]=function(_0x346b75,_0x1de9e1){logger[_0x3933('0x4')](_0x346b75,_0x1de9e1?util[_0x3933('0x5')](_0x1de9e1,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x3a87d3,_0x4bd800){logger['debug'](_0x3a87d3,_0x4bd800?util['inspect'](_0x4bd800,{'showHidden':![],'depth':null}):'');};exports[_0x3933('0x6')]=function(_0x391109,_0x3e9ec7){logger[_0x3933('0x6')](_0x391109,_0x3e9ec7?util[_0x3933('0x5')](_0x3e9ec7,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x1b66ce,_0x592dae){return client[_0x3933('0x7')](_0x1b66ce,{'body':_0x592dae})[_0x3933('0x8')](function(_0x36ab90){logger[_0x3933('0x9')](_0x3933('0xa'),_0x1b66ce,_0x36ab90?util[_0x3933('0x5')](_0x36ab90,{'showHidden':![],'depth':null}):'');})[_0x3933('0xb')](function(_0x3d4c21){logger['error']('[utils][request]\x20name:%s',_0x1b66ce,_0x3d4c21?util['inspect'](_0x3d4c21,{'showHidden':![],'depth':null}):'');});};function getUser(_0x5f4b80){return client[_0x3933('0x7')](_0x3933('0xc'),{'options':{'raw':!![],'attributes':['id',_0x3933('0xd'),'name',_0x3933('0xe')],'where':_0x5f4b80,'limit':0x1}})[_0x3933('0x8')](function(_0x129b75){logger[_0x3933('0x9')](_0x3933('0xf'),JSON[_0x3933('0x10')](_0x5f4b80),_0x129b75?util[_0x3933('0x5')](_0x129b75,{'showHidden':![],'depth':null}):'');return _0x129b75['result'][_0x3933('0x11')]?_0x129b75[_0x3933('0x12')][0x0]:null;});}exports[_0x3933('0x13')]=function(_0x58dc25){return new BPromise(function(_0x2ea11f,_0xd044d8){if(_0x58dc25){return getUser({'internal':_0x58dc25})[_0x3933('0x8')](function(_0x5323a3){logger[_0x3933('0x4')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x58dc25,_0x5323a3?_0x3933('0x14'):_0x3933('0x15'));return _0x2ea11f(_0x5323a3);})['catch'](function(_0x196710){logger['error'](_0x3933('0x16'),_0x196710?util[_0x3933('0x5')](_0x196710,{'showHidden':![],'depth':null}):'');return _0x2ea11f(null);});}return _0x2ea11f(null);});};exports[_0x3933('0x17')]=function(_0x393206){return new BPromise(function(_0x4b0293,_0x1e685c){if(_0x393206){return getUser({'interface':_0x393206})['then'](function(_0x32bc84){logger[_0x3933('0x4')](_0x3933('0x18'),_0x393206,_0x32bc84?_0x3933('0x14'):_0x3933('0x15'));return _0x4b0293(_0x32bc84);})[_0x3933('0xb')](function(_0x7639e8){logger['error'](_0x3933('0x19'),_0x7639e8?util[_0x3933('0x5')](_0x7639e8,{'showHidden':![],'depth':null}):'');return _0x4b0293(null);});}return _0x4b0293(null);});};exports[_0x3933('0x1a')]=function(_0x48de18){return new BPromise(function(_0xa17ac5,_0xae419c){if(_0x48de18){return getUser({'name':_0x48de18})[_0x3933('0x8')](function(_0x25ab9d){logger[_0x3933('0x4')]('[utils][getUserByName]\x20name:%s\x20%s',_0x48de18,_0x25ab9d?_0x3933('0x14'):'notfound');return _0xa17ac5(_0x25ab9d);})[_0x3933('0xb')](function(_0xb587a3){logger[_0x3933('0x6')](_0x3933('0x1b'),_0xb587a3?util[_0x3933('0x5')](_0xb587a3,{'showHidden':![],'depth':null}):'');return _0xa17ac5(null);});}return _0xa17ac5(null);});};exports[_0x3933('0x1c')]=function(_0x296521){return new BPromise(function(_0x46ba9a,_0xb20f0e){if(_0x296521){return client[_0x3933('0x7')](_0x3933('0x1d'),{'options':{'raw':!![],'attributes':['id',_0x3933('0x1e'),_0x3933('0x1f'),_0x3933('0x20'),_0x3933('0x21')],'where':{'name':_0x296521},'limit':0x1}})['then'](function(_0xc99574){logger[_0x3933('0x9')](_0x3933('0x22'),_0x296521,_0xc99574?util[_0x3933('0x5')](_0xc99574,{'showHidden':![],'depth':null}):'');logger['info'](_0x3933('0x23'),_0x296521,_0xc99574?_0x3933('0x14'):_0x3933('0x15'));return _0x46ba9a(_0xc99574['result'][_0x3933('0x11')]?_0xc99574['result'][0x0]:null);})[_0x3933('0xb')](function(_0x1ad9a5){logger[_0x3933('0x6')](_0x3933('0x24'),_0x1ad9a5?util['inspect'](_0x1ad9a5,{'showHidden':![],'depth':null}):'');return _0x46ba9a(null);});}return _0x46ba9a(null);});};exports[_0x3933('0x25')]=function(_0x5b05a6,_0x516d38){return moment(_0x5b05a6)[_0x3933('0x26')](_0x516d38,_0x3933('0x27'))[_0x3933('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x3933('0x29')]=function(_0x42b7ca,_0x14915b){return moment(_0x42b7ca)[_0x3933('0x2a')](_0x14915b,'seconds')[_0x3933('0x28')](_0x3933('0x2b'));};exports[_0x3933('0x2c')]=function(_0x3ebd58,_0x3e1fdc){return moment(_0x3ebd58)[_0x3933('0x2d')](moment(_0x3e1fdc),_0x3933('0x27'));};exports[_0x3933('0x2e')]=function(_0x209a0f,_0x5c6ac6){return parseInt(_0x209a0f,0xa)+parseInt(_0x5c6ac6,0xa);};exports[_0x3933('0x2f')]=function(){return moment()[_0x3933('0x28')](_0x3933('0x2b'));};exports[_0x3933('0x30')]=function(_0x1074dd,_0x5b0a98){if(_0x5b0a98){return moment(_0x1074dd)[_0x3933('0x30')](_0x5b0a98);}return!![];};exports[_0x3933('0x31')]=function(_0x215c1f,_0x5c8a51){if(_0x5c8a51){return moment(_0x215c1f)['isBefore'](_0x5c8a51);}else if(_0x215c1f){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 389372b..7bc49ad 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 _0x0193=['log','xcally','client','name','ensureDir','catch','user','then','no-user','data','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','method','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var'];(function(_0x5e86a0,_0x279e01){var _0x19055e=function(_0x2735df){while(--_0x2735df){_0x5e86a0['push'](_0x5e86a0['shift']());}};_0x19055e(++_0x279e01);}(_0x0193,0x11a));var _0x3019=function(_0x284e33,_0x234d65){_0x284e33=_0x284e33-0x0;var _0x55eaa6=_0x0193[_0x284e33];return _0x55eaa6;};var fs=require(_0x3019('0x0'));var _=require(_0x3019('0x1'));var ewinston=require(_0x3019('0x2'));var path=require(_0x3019('0x3'));var util=require('util');var fileLogger=require(_0x3019('0x4'))[_0x3019('0x5')];var safeTemplate=require(_0x3019('0x6'))[_0x3019('0x7')];var maskSensitiveData=require(_0x3019('0x8'))[_0x3019('0x9')];function ClientSideLogger(){function _0x399b2e(_0x184b04){var _0x31aa2c=path[_0x3019('0xa')](_0x3019('0xb'),_0x3019('0xc'),_0x3019('0xd'));var _0x54b499=path[_0x3019('0xa')](_0x3019('0xe'),_0x184b04['role']+'-'+_0x184b04[_0x3019('0xf')]);return fs[_0x3019('0x10')](path[_0x3019('0xa')](_0x31aa2c,_0x54b499))['then'](function(){var _0x2a9d4c=fileLogger(_0x3019('0xe'),path[_0x3019('0xa')](_0x31aa2c,_0x54b499));return _0x2a9d4c;})[_0x3019('0x11')](function(_0x12e9fc){throw _0x12e9fc;});}this[_0x3019('0xc')]=function(_0x5d13c8,_0x110257,_0x364e2e,_0x576e02){return _0x399b2e(_0x5d13c8[_0x3019('0x12')])[_0x3019('0x13')](function(_0x5a3e7f){var _0x375c4a=_0x5a3e7f[_0x110257];return _0x375c4a;})['then'](function(_0x4108d0){var _0xc6040f=_0x5d13c8[_0x3019('0x12')]?_0x5d13c8['user']['id']:_0x3019('0x14');var _0x32cb9c=_0x576e02[_0x3019('0x15')];var _0x5a0187=_0x576e02['timestamp'];var _0x1e0620=new Date(Number(_0x5a0187));return _0x4108d0(_0xc6040f,_0x1e0620,_0x364e2e,_0x32cb9c);})['catch'](function(_0xf9e688){fileLogger(_0x3019('0xe'))['error'](_0xf9e688);});};}function setupLoggers(_0x2c2137){return new Promise(function(_0x56a65f){var _0x45e2c0=new ClientSideLogger();var _0x43a3c1=fileLogger('api');var _0x195de1=fileLogger(_0x3019('0x16'));_0x2c2137[_0x3019('0x17')](_0x3019('0x18'),_0x45e2c0);_0x2c2137[_0x3019('0x19')](ewinston[_0x3019('0x1a')]({'winstonInstance':_0x43a3c1,'meta':![],'statusLevels':!![],'msg':function(_0x43086e,_0x3bfb7b){var _0x35de9c=_0x3019('0x1b');if(!_[_0x3019('0x1c')](_0x43086e[_0x3019('0x1d')])){_0x35de9c+=_0x3019('0x1e');var _0x5b2452=_0x43086e['body'];maskSensitiveData(_0x5b2452);}return safeTemplate(util[_0x3019('0x1f')](_0x35de9c,_0x43086e['method'],_0x43086e[_0x3019('0x20')][_0x3019('0x21')]?_0x43086e[_0x3019('0x20')][_0x3019('0x21')]:_0x43086e[_0x3019('0x22')][_0x3019('0x23')]||_0x43086e['ip'],_0x43086e[_0x3019('0x24')],_0x3bfb7b[_0x3019('0x25')],_0x3bfb7b[_0x3019('0x26')],_0x43086e[_0x3019('0x12')]?_0x43086e[_0x3019('0x12')]['id']:null,_0x43086e[_0x3019('0x12')]?_0x43086e[_0x3019('0x12')][_0x3019('0xf')]:null,_0x43086e[_0x3019('0x12')]?_0x43086e[_0x3019('0x12')][_0x3019('0x27')]:null,_0x5b2452?util[_0x3019('0x28')](_0x5b2452,![],null):''));}}));_0x2c2137['use'](ewinston[_0x3019('0x1a')]({'winstonInstance':_0x195de1,'meta':![],'statusLevels':!![],'msg':function(_0x34b6e7,_0x27d58e){var _0x1f354b=_0x3019('0x29');if(_0x34b6e7[_0x3019('0x1d')]&&_0x34b6e7['body'][_0x3019('0x2a')]&&_0x34b6e7['body'][_0x3019('0x2b')]){_0x1f354b='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x3019('0x1f')](_0x1f354b,_0x34b6e7[_0x3019('0x2c')],_0x34b6e7[_0x3019('0x20')][_0x3019('0x21')]?_0x34b6e7[_0x3019('0x20')][_0x3019('0x21')]:_0x34b6e7[_0x3019('0x22')]['remoteAddress']||_0x34b6e7['ip'],_0x34b6e7[_0x3019('0x24')],_0x27d58e['statusCode'],_0x27d58e[_0x3019('0x26')],_0x34b6e7['user']?_0x34b6e7['user']['id']:null,_0x34b6e7['user']?_0x34b6e7['user'][_0x3019('0xf')]:null,_0x34b6e7['user']?_0x34b6e7[_0x3019('0x12')][_0x3019('0x27')]:null,_0x34b6e7['body']&&_0x34b6e7[_0x3019('0x1d')][_0x3019('0x2a')]?_0x34b6e7[_0x3019('0x1d')][_0x3019('0x2a')]:_0x3019('0x2d'),_0x34b6e7[_0x3019('0x1d')]&&_0x34b6e7['body'][_0x3019('0x2b')]?_0x34b6e7[_0x3019('0x1d')][_0x3019('0x2b')]:'',_0x34b6e7['body']&&_0x34b6e7[_0x3019('0x1d')][_0x3019('0x2e')]?_0x34b6e7[_0x3019('0x1d')][_0x3019('0x2e')]:'');},'ignoreRoute':function(_0x8f258d){var _0x166c22=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x166c22[_0x3019('0x2f')](_0x8f258d['url']);}}));return _0x56a65f();});}exports[_0x3019('0x30')]=setupLoggers; \ No newline at end of file +var _0x7a40=['./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','name','then','catch','user','data','api','auth','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','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)','method','other','agent_name','test','lodash','express-winston','path','util'];(function(_0x3ceb54,_0x5bddfd){var _0x26d8a6=function(_0x32e484){while(--_0x32e484){_0x3ceb54['push'](_0x3ceb54['shift']());}};_0x26d8a6(++_0x5bddfd);}(_0x7a40,0x145));var _0x07a4=function(_0x1f5df1,_0xe5c82){_0x1f5df1=_0x1f5df1-0x0;var _0x2d7e0b=_0x7a40[_0x1f5df1];return _0x2d7e0b;};var fs=require('fs-extra');var _=require(_0x07a4('0x0'));var ewinston=require(_0x07a4('0x1'));var path=require(_0x07a4('0x2'));var util=require(_0x07a4('0x3'));var fileLogger=require(_0x07a4('0x4'))[_0x07a4('0x5')];var safeTemplate=require(_0x07a4('0x6'))[_0x07a4('0x7')];var maskSensitiveData=require(_0x07a4('0x8'))[_0x07a4('0x9')];function ClientSideLogger(){function _0x480485(_0x5ab7f9){var _0x3b7e73=path[_0x07a4('0xa')](_0x07a4('0xb'),_0x07a4('0xc'),_0x07a4('0xd'));var _0x1fdb5f=path[_0x07a4('0xa')](_0x07a4('0xe'),_0x5ab7f9[_0x07a4('0xf')]+'-'+_0x5ab7f9[_0x07a4('0x10')]);return fs['ensureDir'](path[_0x07a4('0xa')](_0x3b7e73,_0x1fdb5f))[_0x07a4('0x11')](function(){var _0x3a5f1d=fileLogger(_0x07a4('0xe'),path['join'](_0x3b7e73,_0x1fdb5f));return _0x3a5f1d;})[_0x07a4('0x12')](function(_0x1eb7a1){throw _0x1eb7a1;});}this[_0x07a4('0xc')]=function(_0x245052,_0x5e7c0b,_0x4b4bd6,_0xc4389a){return _0x480485(_0x245052[_0x07a4('0x13')])[_0x07a4('0x11')](function(_0x5a6c71){var _0x4bd3c7=_0x5a6c71[_0x5e7c0b];return _0x4bd3c7;})['then'](function(_0x5c8aad){var _0x1ec5c6=_0x245052[_0x07a4('0x13')]?_0x245052[_0x07a4('0x13')]['id']:'no-user';var _0x5825e6=_0xc4389a[_0x07a4('0x14')];var _0x47ba28=_0xc4389a['timestamp'];var _0x2f98ce=new Date(Number(_0x47ba28));return _0x5c8aad(_0x1ec5c6,_0x2f98ce,_0x4b4bd6,_0x5825e6);})[_0x07a4('0x12')](function(_0x4ddb41){fileLogger(_0x07a4('0xe'))['error'](_0x4ddb41);});};}function setupLoggers(_0x2a47ef){return new Promise(function(_0x4c6f15){var _0x42ca33=new ClientSideLogger();var _0x4bada3=fileLogger(_0x07a4('0x15'));var _0x58e819=fileLogger(_0x07a4('0x16'));_0x2a47ef['set'](_0x07a4('0x17'),_0x42ca33);_0x2a47ef[_0x07a4('0x18')](ewinston[_0x07a4('0x19')]({'winstonInstance':_0x4bada3,'meta':![],'statusLevels':!![],'msg':function(_0x5df641,_0x538745){var _0x4cb0f8=_0x07a4('0x1a');if(!_[_0x07a4('0x1b')](_0x5df641[_0x07a4('0x1c')])){_0x4cb0f8+=_0x07a4('0x1d');var _0x2b9db8=_0x5df641['body'];maskSensitiveData(_0x2b9db8);}return safeTemplate(util[_0x07a4('0x1e')](_0x4cb0f8,_0x5df641['method'],_0x5df641[_0x07a4('0x1f')][_0x07a4('0x20')]?_0x5df641[_0x07a4('0x1f')][_0x07a4('0x20')]:_0x5df641[_0x07a4('0x21')][_0x07a4('0x22')]||_0x5df641['ip'],_0x5df641[_0x07a4('0x23')],_0x538745[_0x07a4('0x24')],_0x538745[_0x07a4('0x25')],_0x5df641[_0x07a4('0x13')]?_0x5df641[_0x07a4('0x13')]['id']:null,_0x5df641[_0x07a4('0x13')]?_0x5df641[_0x07a4('0x13')][_0x07a4('0x10')]:null,_0x5df641[_0x07a4('0x13')]?_0x5df641[_0x07a4('0x13')][_0x07a4('0xf')]:null,_0x2b9db8?util[_0x07a4('0x26')](_0x2b9db8,![],null):''));}}));_0x2a47ef[_0x07a4('0x18')](ewinston['logger']({'winstonInstance':_0x58e819,'meta':![],'statusLevels':!![],'msg':function(_0xe53f97,_0x2ec888){var _0x2db534=_0x07a4('0x27');if(_0xe53f97[_0x07a4('0x1c')]&&_0xe53f97[_0x07a4('0x1c')][_0x07a4('0x28')]&&_0xe53f97[_0x07a4('0x1c')][_0x07a4('0x29')]){_0x2db534=_0x07a4('0x2a');}return util[_0x07a4('0x1e')](_0x2db534,_0xe53f97[_0x07a4('0x2b')],_0xe53f97[_0x07a4('0x1f')]['x-forwarded-for']?_0xe53f97['headers'][_0x07a4('0x20')]:_0xe53f97[_0x07a4('0x21')][_0x07a4('0x22')]||_0xe53f97['ip'],_0xe53f97[_0x07a4('0x23')],_0x2ec888[_0x07a4('0x24')],_0x2ec888['responseTime'],_0xe53f97[_0x07a4('0x13')]?_0xe53f97['user']['id']:null,_0xe53f97[_0x07a4('0x13')]?_0xe53f97['user'][_0x07a4('0x10')]:null,_0xe53f97['user']?_0xe53f97['user'][_0x07a4('0xf')]:null,_0xe53f97[_0x07a4('0x1c')]&&_0xe53f97[_0x07a4('0x1c')][_0x07a4('0x28')]?_0xe53f97[_0x07a4('0x1c')]['device']:_0x07a4('0x2c'),_0xe53f97[_0x07a4('0x1c')]&&_0xe53f97[_0x07a4('0x1c')]['agent_id']?_0xe53f97[_0x07a4('0x1c')][_0x07a4('0x29')]:'',_0xe53f97['body']&&_0xe53f97[_0x07a4('0x1c')][_0x07a4('0x2d')]?_0xe53f97[_0x07a4('0x1c')][_0x07a4('0x2d')]:'');},'ignoreRoute':function(_0x5eb352){var _0x2928b0=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2928b0[_0x07a4('0x2e')](_0x5eb352['url']);}}));return _0x4c6f15();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index d0c5bc4..815d463 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ed5=['source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','monthsShort','exports','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','isBetween','format','ddd','dowCompare','date','daysInMonth','max','min','MMM','guess','test','isMoment','padStart','length','map'];(function(_0x1af8d3,_0x544d86){var _0x3a50c5=function(_0x4179aa){while(--_0x4179aa){_0x1af8d3['push'](_0x1af8d3['shift']());}};_0x3a50c5(++_0x544d86);}(_0x7ed5,0x68));var _0x57ed=function(_0x23973b,_0x495ea3){_0x23973b=_0x23973b-0x0;var _0x14084e=_0x7ed5[_0x23973b];return _0x14084e;};var _=require('lodash');var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x57ed('0x0')](function(_0x496d51){return _0x496d51[_0x57ed('0x1')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x57ed('0x2');var EINVALID_DATE=_0x57ed('0x3');function throwIfDateNotValid(_0x5c0c5d){if(!_0x5c0c5d[_0x57ed('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x342717){var _0x289703=_0x342717[_0x57ed('0x5')](':')[_0x57ed('0x0')](function(_0x10ea5d){return parseInt(_0x10ea5d,0xa);});var _0x5552e7=_0x289703[0x0];var _0x57e459=_0x289703[0x1];if(_0x5552e7<0x0||_0x5552e7>0x17||_0x57e459<0x0||_0x57e459>0x3b){throw new Error(EINVALID_DATE);}return[_0x5552e7,_0x57e459];}function circularDoWInterval(_0x1c2f1a,_0x204d0b){if(_0x1c2f1a===_0x204d0b){return[_0x1c2f1a];}else{var _0x328dbb=moment[_0x57ed('0x6')]();moment[_0x57ed('0x6')]('en');var _0x20ec5e=moment[_0x57ed('0x7')]()['map'](function(_0x456e3a){return _0x456e3a[_0x57ed('0x8')]();});moment['locale'](_0x328dbb);var _0x463bbb=_0x20ec5e[_0x57ed('0x9')](_0x1c2f1a);var _0xe2a69d=_0x20ec5e[_0x57ed('0x9')](_0x204d0b);if(_0xe2a69d>_0x463bbb){return _0x20ec5e[_0x57ed('0xa')](_0x463bbb,_0xe2a69d+0x1);}else{var _0x3025b1=_0x20ec5e[_0x57ed('0xa')](0x0,_0xe2a69d+0x1);var _0x55d373=_0x20ec5e[_0x57ed('0xa')](_0x463bbb);return _0x55d373[_0x57ed('0xb')](_0x3025b1);}}}module['exports']['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x3e4d67,_0x4de3b5){if(_0x3e4d67===_0x4de3b5){return[_0x3e4d67];}else{var _0x28cfc2=moment['locale']();moment[_0x57ed('0x6')]('en');var _0x47ad28=moment[_0x57ed('0xc')]()[_0x57ed('0x0')](function(_0x4ae178){return _0x4ae178[_0x57ed('0x8')]();});moment[_0x57ed('0x6')](_0x28cfc2);var _0xc13eca=_0x47ad28[_0x57ed('0x9')](_0x3e4d67);var _0x4d85f2=_0x47ad28[_0x57ed('0x9')](_0x4de3b5);if(_0x4d85f2>_0xc13eca){return _0x47ad28[_0x57ed('0xa')](_0xc13eca,_0x4d85f2+0x1);}else{var _0x292fbb=_0x47ad28[_0x57ed('0xa')](0x0,_0x4d85f2+0x1);var _0xc84958=_0x47ad28[_0x57ed('0xa')](_0xc13eca);return _0xc84958[_0x57ed('0xb')](_0x292fbb);}}}module[_0x57ed('0xd')][_0x57ed('0xe')]=circularMonthInterval;function parseDom(_0x2b7ca5){var _0x16ded8=parseInt(_0x2b7ca5,0xa);if(_0x16ded8<0x1||_0x16ded8>0x1f){throw new Error(EINVALID_DATE);}return _0x16ded8;}function timeCompare(_0x1515c9,_0x400640,_0x5bacfc){var _0x11ba3d=_0x1515c9[_0x57ed('0xf')]();var _0x1a6d5e=extractTime(_0x400640);var _0x43ebcb=_0x1a6d5e[0x0];var _0x453671=_0x1a6d5e[0x1];var _0x1c46ca=_0x1515c9[_0x57ed('0xf')]()[_0x57ed('0x10')](_0x43ebcb)['minutes'](_0x453671);throwIfDateNotValid(_0x1c46ca);var _0x340bda=extractTime(_0x5bacfc);var _0x45ac23=_0x340bda[0x0];var _0x27953b=_0x340bda[0x1];var _0x56f70a=_0x1515c9[_0x57ed('0xf')]()[_0x57ed('0x10')](_0x45ac23)[_0x57ed('0x11')](_0x27953b);throwIfDateNotValid(_0x56f70a);if(_0x56f70a[_0x57ed('0x12')](_0x1c46ca)){var _0x509df7=_0x11ba3d[_0x57ed('0xf')]()[_0x57ed('0x13')]('day');var _0x5dc98a=_0x11ba3d[_0x57ed('0xf')]()['endOf'](_0x57ed('0x14'));return _0x11ba3d[_0x57ed('0x15')](_0x1c46ca,_0x5dc98a,undefined,'[]')||_0x11ba3d[_0x57ed('0x15')](_0x509df7,_0x56f70a,undefined,'[]');}else{return _0x11ba3d[_0x57ed('0x15')](_0x1c46ca,_0x56f70a,undefined,'[]');}}module['exports']['timeCompare']=timeCompare;function dowCompare(_0x17e0ed,_0x22a734,_0x18fef8){var _0x9a3f39=_0x17e0ed['locale']('en')[_0x57ed('0x16')](_0x57ed('0x17'))[_0x57ed('0x8')]();return circularDoWInterval(_0x22a734,_0x18fef8)['includes'](_0x9a3f39);}module['exports'][_0x57ed('0x18')]=dowCompare;function domCompare(_0x17bda5,_0x4d63e0,_0x2dcc11){var _0x255b82=_0x17bda5[_0x57ed('0x19')]();if(_0x4d63e0===_0x2dcc11){return _0x255b82===_0x4d63e0;}else{var _0x1beb30=_0x17bda5[_0x57ed('0x1a')]();var _0x19f77f=_0x4d63e0<_0x2dcc11;let _0x1bb281=![];var _0x4f3cac=0x0;var _0x441adb=0x0;if(_0x19f77f){_0x4f3cac=Math[_0x57ed('0x1b')](0x1,_0x4d63e0);_0x441adb=Math[_0x57ed('0x1c')](_0x2dcc11,_0x1beb30);_0x1bb281=_0x255b82>=_0x4f3cac&&_0x255b82<=_0x441adb;}else{_0x4f3cac=Math[_0x57ed('0x1c')](_0x4d63e0,_0x1beb30);_0x441adb=Math['max'](0x1,_0x2dcc11);_0x1bb281=_0x255b82>=_0x4f3cac||_0x255b82<=_0x441adb;}return _0x1bb281;}}module[_0x57ed('0xd')]['domCompare']=domCompare;function monthCompare(_0x1bbd7c,_0x2af3fb,_0x132da1){var _0x4fd727=_0x1bbd7c[_0x57ed('0x6')]('en')[_0x57ed('0x16')](_0x57ed('0x1d'))[_0x57ed('0x8')]();return circularMonthInterval(_0x2af3fb,_0x132da1)['includes'](_0x4fd727);}module[_0x57ed('0xd')]['monthCompare']=monthCompare;function iftime(_0x33265b,_0x21ad61=moment['tz'][_0x57ed('0x1e')](),_0x2966f9=moment()){if(!validateRx[_0x57ed('0x1f')](_0x33265b)){throw new Error(EINVALID_STRING);}else{var _0x392cc0=(moment[_0x57ed('0x20')](_0x2966f9)?_0x2966f9[_0x57ed('0xf')]():moment(_0x2966f9))['tz'](_0x21ad61)[_0x57ed('0x6')]('en');throwIfDateNotValid(_0x392cc0);var _0x1f11c2=_0x33265b[_0x57ed('0x5')](',');var _0x5d6f89=_0x1f11c2[0x0];var _0x50efa6=_0x1f11c2[0x1];var _0x1f3ab2=_0x1f11c2[0x2];var _0x2e1f24=_0x1f11c2[0x3];let _0x2c922f=!![];if(_0x5d6f89!=='*'){var _0x49730f=_0x5d6f89['split']('-');var _0x15d676=_[_0x57ed('0x21')](_0x49730f[0x0],0x5,'0');var _0x40fae1=_0x49730f[_0x57ed('0x22')]===0x2?_[_0x57ed('0x21')](_0x49730f[0x1],0x5,'0'):_0x15d676;_0x2c922f=timeCompare(_0x392cc0,_0x15d676,_0x40fae1);}let _0x591178=!![];if(_0x50efa6!=='*'){var _0x425144=_0x50efa6['split']('-');var _0x306b0b=_0x425144[0x0];var _0x404b3e=_0x425144[_0x57ed('0x22')]===0x2?_0x425144[0x1]:_0x306b0b;_0x591178=dowCompare(_0x392cc0,_0x306b0b,_0x404b3e);}let _0x82b7bf=!![];if(_0x1f3ab2!=='*'){var _0x29c0e4=_0x1f3ab2[_0x57ed('0x5')]('-');var _0x20f63d=parseDom(_0x29c0e4[0x0]);var _0x43fb70=_0x29c0e4[_0x57ed('0x22')]===0x2?parseDom(_0x29c0e4[0x1]):_0x20f63d;_0x82b7bf=domCompare(_0x392cc0,_0x20f63d,_0x43fb70);}let _0x1e7cdf=!![];if(_0x2e1f24!=='*'){var _0x20a21a=_0x2e1f24['split']('-');var _0x299c6c=_0x20a21a[0x0];var _0x2cc1b9=_0x20a21a['length']===0x2?_0x20a21a[0x1]:_0x20a21a[0x0];_0x1e7cdf=monthCompare(_0x392cc0,_0x299c6c,_0x2cc1b9);}return _0x2c922f&&_0x591178&&_0x82b7bf&&_0x1e7cdf;}}module[_0x57ed('0xd')]['iftime']=iftime; \ No newline at end of file +var _0x0ac3=['format','ddd','toLowerCase','includes','dowCompare','date','daysInMonth','max','min','domCompare','MMM','guess','test','padStart','length','iftime','moment-timezone','map','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','indexOf','slice','concat','locale','clone','hours','minutes','startOf','day','endOf','isBetween','exports','timeCompare'];(function(_0x38558b,_0x450caa){var _0xa2a2f4=function(_0x446d98){while(--_0x446d98){_0x38558b['push'](_0x38558b['shift']());}};_0xa2a2f4(++_0x450caa);}(_0x0ac3,0x191));var _0x30ac=function(_0x3caf7c,_0x4f3674){_0x3caf7c=_0x3caf7c-0x0;var _0x5770c7=_0x0ac3[_0x3caf7c];return _0x5770c7;};var _=require('lodash');var moment=require(_0x30ac('0x0'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x30ac('0x1')](function(_0x5c2319){return _0x5c2319['source'];})[_0x30ac('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x30ac('0x3');var EINVALID_DATE=_0x30ac('0x4');function throwIfDateNotValid(_0x4c9e6a){if(!_0x4c9e6a['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x209604){var _0x647b0d=_0x209604[_0x30ac('0x5')](':')[_0x30ac('0x1')](function(_0x18d173){return parseInt(_0x18d173,0xa);});var _0x17dcd9=_0x647b0d[0x0];var _0xdec8cb=_0x647b0d[0x1];if(_0x17dcd9<0x0||_0x17dcd9>0x17||_0xdec8cb<0x0||_0xdec8cb>0x3b){throw new Error(EINVALID_DATE);}return[_0x17dcd9,_0xdec8cb];}function circularDoWInterval(_0x2e5907,_0x36a7d8){if(_0x2e5907===_0x36a7d8){return[_0x2e5907];}else{var _0x3a04bf=moment['locale']();moment['locale']('en');var _0x3cb7a3=moment['weekdaysShort']()[_0x30ac('0x1')](function(_0x291f2a){return _0x291f2a['toLowerCase']();});moment['locale'](_0x3a04bf);var _0x4bf326=_0x3cb7a3[_0x30ac('0x6')](_0x2e5907);var _0x198ac5=_0x3cb7a3['indexOf'](_0x36a7d8);if(_0x198ac5>_0x4bf326){return _0x3cb7a3[_0x30ac('0x7')](_0x4bf326,_0x198ac5+0x1);}else{var _0x1832a9=_0x3cb7a3['slice'](0x0,_0x198ac5+0x1);var _0x27574=_0x3cb7a3[_0x30ac('0x7')](_0x4bf326);return _0x27574[_0x30ac('0x8')](_0x1832a9);}}}module['exports']['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x3bab78,_0x48a8e7){if(_0x3bab78===_0x48a8e7){return[_0x3bab78];}else{var _0x395d5d=moment['locale']();moment[_0x30ac('0x9')]('en');var _0x5b7877=moment['monthsShort']()[_0x30ac('0x1')](function(_0x45d126){return _0x45d126['toLowerCase']();});moment[_0x30ac('0x9')](_0x395d5d);var _0x59dc57=_0x5b7877['indexOf'](_0x3bab78);var _0x57e485=_0x5b7877[_0x30ac('0x6')](_0x48a8e7);if(_0x57e485>_0x59dc57){return _0x5b7877[_0x30ac('0x7')](_0x59dc57,_0x57e485+0x1);}else{var _0x333e3=_0x5b7877[_0x30ac('0x7')](0x0,_0x57e485+0x1);var _0x5d2786=_0x5b7877[_0x30ac('0x7')](_0x59dc57);return _0x5d2786[_0x30ac('0x8')](_0x333e3);}}}module['exports']['circularMonthInterval']=circularMonthInterval;function parseDom(_0x214b4a){var _0xd09ac9=parseInt(_0x214b4a,0xa);if(_0xd09ac9<0x1||_0xd09ac9>0x1f){throw new Error(EINVALID_DATE);}return _0xd09ac9;}function timeCompare(_0x504e3a,_0x4c18a4,_0x5b8266){var _0x11f07b=_0x504e3a[_0x30ac('0xa')]();var _0x55cd61=extractTime(_0x4c18a4);var _0x4ab759=_0x55cd61[0x0];var _0x55ca85=_0x55cd61[0x1];var _0x5af59b=_0x504e3a[_0x30ac('0xa')]()[_0x30ac('0xb')](_0x4ab759)['minutes'](_0x55ca85);throwIfDateNotValid(_0x5af59b);var _0x82af0f=extractTime(_0x5b8266);var _0x47212a=_0x82af0f[0x0];var _0x93ac88=_0x82af0f[0x1];var _0x51571d=_0x504e3a['clone']()[_0x30ac('0xb')](_0x47212a)[_0x30ac('0xc')](_0x93ac88);throwIfDateNotValid(_0x51571d);if(_0x51571d['isBefore'](_0x5af59b)){var _0xa769d6=_0x11f07b[_0x30ac('0xa')]()[_0x30ac('0xd')](_0x30ac('0xe'));var _0x1f3bb5=_0x11f07b[_0x30ac('0xa')]()[_0x30ac('0xf')](_0x30ac('0xe'));return _0x11f07b[_0x30ac('0x10')](_0x5af59b,_0x1f3bb5,undefined,'[]')||_0x11f07b[_0x30ac('0x10')](_0xa769d6,_0x51571d,undefined,'[]');}else{return _0x11f07b[_0x30ac('0x10')](_0x5af59b,_0x51571d,undefined,'[]');}}module[_0x30ac('0x11')][_0x30ac('0x12')]=timeCompare;function dowCompare(_0x3ba10c,_0x47e9a3,_0x32235c){var _0x263365=_0x3ba10c[_0x30ac('0x9')]('en')[_0x30ac('0x13')](_0x30ac('0x14'))[_0x30ac('0x15')]();return circularDoWInterval(_0x47e9a3,_0x32235c)[_0x30ac('0x16')](_0x263365);}module[_0x30ac('0x11')][_0x30ac('0x17')]=dowCompare;function domCompare(_0x2e31e7,_0x534334,_0x235f30){var _0x515b30=_0x2e31e7[_0x30ac('0x18')]();if(_0x534334===_0x235f30){return _0x515b30===_0x534334;}else{var _0x5eeebf=_0x2e31e7[_0x30ac('0x19')]();var _0x705bbc=_0x534334<_0x235f30;let _0x22a74a=![];var _0xd51cbc=0x0;var _0x5809ac=0x0;if(_0x705bbc){_0xd51cbc=Math[_0x30ac('0x1a')](0x1,_0x534334);_0x5809ac=Math[_0x30ac('0x1b')](_0x235f30,_0x5eeebf);_0x22a74a=_0x515b30>=_0xd51cbc&&_0x515b30<=_0x5809ac;}else{_0xd51cbc=Math[_0x30ac('0x1b')](_0x534334,_0x5eeebf);_0x5809ac=Math[_0x30ac('0x1a')](0x1,_0x235f30);_0x22a74a=_0x515b30>=_0xd51cbc||_0x515b30<=_0x5809ac;}return _0x22a74a;}}module['exports'][_0x30ac('0x1c')]=domCompare;function monthCompare(_0x4fee71,_0xa97b92,_0x33e9d7){var _0x2e9850=_0x4fee71['locale']('en')[_0x30ac('0x13')](_0x30ac('0x1d'))[_0x30ac('0x15')]();return circularMonthInterval(_0xa97b92,_0x33e9d7)[_0x30ac('0x16')](_0x2e9850);}module[_0x30ac('0x11')]['monthCompare']=monthCompare;function iftime(_0xe1ef56,_0x2b487d=moment['tz'][_0x30ac('0x1e')](),_0x2323f5=moment()){if(!validateRx[_0x30ac('0x1f')](_0xe1ef56)){throw new Error(EINVALID_STRING);}else{var _0x3d117d=(moment['isMoment'](_0x2323f5)?_0x2323f5[_0x30ac('0xa')]():moment(_0x2323f5))['tz'](_0x2b487d)[_0x30ac('0x9')]('en');throwIfDateNotValid(_0x3d117d);var _0x457d42=_0xe1ef56[_0x30ac('0x5')](',');var _0x25471d=_0x457d42[0x0];var _0x3d1d7a=_0x457d42[0x1];var _0x164c5e=_0x457d42[0x2];var _0x3824d0=_0x457d42[0x3];let _0x48e8a1=!![];if(_0x25471d!=='*'){var _0xb596f9=_0x25471d['split']('-');var _0x994565=_[_0x30ac('0x20')](_0xb596f9[0x0],0x5,'0');var _0x418bd4=_0xb596f9['length']===0x2?_[_0x30ac('0x20')](_0xb596f9[0x1],0x5,'0'):_0x994565;_0x48e8a1=timeCompare(_0x3d117d,_0x994565,_0x418bd4);}let _0x1e5ee0=!![];if(_0x3d1d7a!=='*'){var _0x478fd8=_0x3d1d7a[_0x30ac('0x5')]('-');var _0x58df5a=_0x478fd8[0x0];var _0x7eced4=_0x478fd8[_0x30ac('0x21')]===0x2?_0x478fd8[0x1]:_0x58df5a;_0x1e5ee0=dowCompare(_0x3d117d,_0x58df5a,_0x7eced4);}let _0x3929d7=!![];if(_0x164c5e!=='*'){var _0x57f1f1=_0x164c5e[_0x30ac('0x5')]('-');var _0x413ba2=parseDom(_0x57f1f1[0x0]);var _0x5bac5d=_0x57f1f1[_0x30ac('0x21')]===0x2?parseDom(_0x57f1f1[0x1]):_0x413ba2;_0x3929d7=domCompare(_0x3d117d,_0x413ba2,_0x5bac5d);}let _0x5224d0=!![];if(_0x3824d0!=='*'){var _0x5049a4=_0x3824d0[_0x30ac('0x5')]('-');var _0x2f8a5b=_0x5049a4[0x0];var _0x1dbe9e=_0x5049a4[_0x30ac('0x21')]===0x2?_0x5049a4[0x1]:_0x5049a4[0x0];_0x5224d0=monthCompare(_0x3d117d,_0x2f8a5b,_0x1dbe9e);}return _0x48e8a1&&_0x1e5ee0&&_0x3929d7&&_0x5224d0;}}module[_0x30ac('0x11')][_0x30ac('0x22')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index d4b5fc6..4ba76ca 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd0d7=['debugLevel','toLowerCase','info','redBG\x20white','bold\x20yellow','white','gray','bold\x20magenta','bold\x20cyan','addColors','/var/log/xcally','join','message','{{{','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','stringify','transports','Console','Logger','File','error','%s-%s','warn','consoleLogger','fileLogger','path','util','moment','winston'];(function(_0x114008,_0x2f8852){var _0x1bef9e=function(_0x5ef944){while(--_0x5ef944){_0x114008['push'](_0x114008['shift']());}};_0x1bef9e(++_0x2f8852);}(_0xd0d7,0x152));var _0x7d0d=function(_0x5400b,_0x55943a){_0x5400b=_0x5400b-0x0;var _0x36a39b=_0xd0d7[_0x5400b];return _0x36a39b;};'use strict';var path=require(_0x7d0d('0x0'));var util=require(_0x7d0d('0x1'));var moment=require(_0x7d0d('0x2'));var winston=require(_0x7d0d('0x3'));var config=require('../config/environment');var debugLevel=config[_0x7d0d('0x4')]?config['debugLevel'][_0x7d0d('0x5')]():_0x7d0d('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':_0x7d0d('0x7'),'error':'red','warn':_0x7d0d('0x8'),'info':_0x7d0d('0x9'),'print':'bold\x20white','success':'bold\x20green','http':_0x7d0d('0xa'),'verbose':_0x7d0d('0xb'),'debug':'bold\x20blue','silly':_0x7d0d('0xc')};winston[_0x7d0d('0xd')](XC_LOG_COLORS);function getLogFileName(_0x5c4193,_0x3f83bd,_0x2b9c3c){var _0x68855e=_0x5c4193||_0x7d0d('0xe');return path[_0x7d0d('0xf')](_0x68855e,util['format']('%s-%s.log',_0x3f83bd,_0x2b9c3c));}function formatter(_0x101c9d,_0xfb0baa){_0xfb0baa[_0x7d0d('0x10')]=_0xfb0baa['message']['replace'](/@@{/g,_0x7d0d('0x11'))[_0x7d0d('0x12')](/}@@/g,_0x7d0d('0x13'))[_0x7d0d('0x12')](/@{/g,'{{')[_0x7d0d('0x12')](/}@/g,'}}');return util[_0x7d0d('0x14')](_0x7d0d('0x15'),moment()[_0x7d0d('0x14')](_0x7d0d('0x16')),_0xfb0baa[_0x7d0d('0x17')][_0x7d0d('0x18')](),_0x101c9d,_0xfb0baa['message']);}function fileFormat(_0x2321bb,_0x33a74a){_0x33a74a[_0x7d0d('0x10')]=_0x33a74a[_0x7d0d('0x10')][_0x7d0d('0x12')](/@@{/g,_0x7d0d('0x11'))['replace'](/}@@/g,_0x7d0d('0x13'))[_0x7d0d('0x12')](/@{/g,'{{')[_0x7d0d('0x12')](/}@/g,'}}');var _0x4f79eb=_0x33a74a[_0x7d0d('0x19')]&&Object[_0x7d0d('0x1a')](_0x33a74a['meta'])[_0x7d0d('0x1b')]?'\x0a\x09'+JSON[_0x7d0d('0x1c')](_0x33a74a[_0x7d0d('0x19')]):'';return util[_0x7d0d('0x14')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()['format'](_0x7d0d('0x16')),_0x33a74a[_0x7d0d('0x17')][_0x7d0d('0x18')](),_0x2321bb,_0x33a74a[_0x7d0d('0x10')],_0x4f79eb);}function consoleLogger(){var _0x6dc10b=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x7d0d('0x1d'))][(_0x7d0d('0x1e'))]({'level':'warn','json':![],'formatter':function(_0x4f4c61){return formatter('',_0x4f4c61);}})]});return _0x6dc10b;}function fileLogger(_0x464574,_0x5746e9){var _0x1ac493=new winston[(_0x7d0d('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x7d0d('0x1d'))][(_0x7d0d('0x20'))]({'name':util[_0x7d0d('0x14')]('%s-%s',_0x464574,_0x7d0d('0x21')),'filename':getLogFileName(_0x5746e9,_0x464574,_0x7d0d('0x21')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3bc7e6){return fileFormat(_0x464574,_0x3bc7e6);}}),new winston['transports']['File']({'name':util[_0x7d0d('0x14')](_0x7d0d('0x22'),_0x464574,debugLevel),'filename':getLogFileName(_0x5746e9,_0x464574,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3fea12){return fileFormat(_0x464574,_0x3fea12);}}),new winston['transports'][(_0x7d0d('0x1e'))]({'level':_0x7d0d('0x23'),'json':![],'formatter':function(_0x24ced8){return fileFormat(_0x464574,_0x24ced8);}})]});return _0x1ac493;}exports[_0x7d0d('0x24')]=consoleLogger;exports[_0x7d0d('0x25')]=fileLogger; \ No newline at end of file +var _0xd86e=['gray','bold\x20magenta','bold\x20cyan','addColors','/var/log/xcally','join','%s-%s.log','message','replace','{{{','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','meta','keys','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','error','%s-%s','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','redBG\x20white','red','bold\x20yellow'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0xd86e,0x8a));var _0xed86=function(_0x46fb69,_0x5c8a01){_0x46fb69=_0x46fb69-0x0;var _0x10a393=_0xd86e[_0x46fb69];return _0x10a393;};'use strict';var path=require(_0xed86('0x0'));var util=require(_0xed86('0x1'));var moment=require(_0xed86('0x2'));var winston=require(_0xed86('0x3'));var config=require(_0xed86('0x4'));var debugLevel=config[_0xed86('0x5')]?config[_0xed86('0x5')][_0xed86('0x6')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xed86('0x7'),'error':_0xed86('0x8'),'warn':_0xed86('0x9'),'info':'white','print':'bold\x20white','success':'bold\x20green','http':_0xed86('0xa'),'verbose':_0xed86('0xb'),'debug':'bold\x20blue','silly':_0xed86('0xc')};winston[_0xed86('0xd')](XC_LOG_COLORS);function getLogFileName(_0x1d6110,_0x32f2eb,_0x15120c){var _0x5ba0f5=_0x1d6110||_0xed86('0xe');return path[_0xed86('0xf')](_0x5ba0f5,util['format'](_0xed86('0x10'),_0x32f2eb,_0x15120c));}function formatter(_0x4b8ae1,_0x2a923b){_0x2a923b[_0xed86('0x11')]=_0x2a923b[_0xed86('0x11')][_0xed86('0x12')](/@@{/g,_0xed86('0x13'))[_0xed86('0x12')](/}@@/g,_0xed86('0x14'))['replace'](/@{/g,'{{')[_0xed86('0x12')](/}@/g,'}}');return util[_0xed86('0x15')](_0xed86('0x16'),moment()[_0xed86('0x15')](_0xed86('0x17')),_0x2a923b['level'][_0xed86('0x18')](),_0x4b8ae1,_0x2a923b['message']);}function fileFormat(_0x343e1e,_0x3242bd){_0x3242bd['message']=_0x3242bd[_0xed86('0x11')][_0xed86('0x12')](/@@{/g,'{{{')['replace'](/}@@/g,_0xed86('0x14'))[_0xed86('0x12')](/@{/g,'{{')[_0xed86('0x12')](/}@/g,'}}');var _0x1547da=_0x3242bd[_0xed86('0x19')]&&Object[_0xed86('0x1a')](_0x3242bd[_0xed86('0x19')])[_0xed86('0x1b')]?'\x0a\x09'+JSON['stringify'](_0x3242bd['meta']):'';return util[_0xed86('0x15')](_0xed86('0x1c'),moment()[_0xed86('0x15')](_0xed86('0x17')),_0x3242bd['level']['toUpperCase'](),_0x343e1e,_0x3242bd[_0xed86('0x11')],_0x1547da);}function consoleLogger(){var _0x35d40c=new winston[(_0xed86('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xed86('0x1e'))][(_0xed86('0x1f'))]({'level':_0xed86('0x20'),'json':![],'formatter':function(_0x259a82){return formatter('',_0x259a82);}})]});return _0x35d40c;}function fileLogger(_0x47484d,_0x1b40d0){var _0x2c8c04=new winston[(_0xed86('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xed86('0x1e'))][(_0xed86('0x21'))]({'name':util[_0xed86('0x15')]('%s-%s',_0x47484d,_0xed86('0x22')),'filename':getLogFileName(_0x1b40d0,_0x47484d,_0xed86('0x22')),'level':_0xed86('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2f76ba){return fileFormat(_0x47484d,_0x2f76ba);}}),new winston[(_0xed86('0x1e'))][(_0xed86('0x21'))]({'name':util[_0xed86('0x15')](_0xed86('0x23'),_0x47484d,debugLevel),'filename':getLogFileName(_0x1b40d0,_0x47484d,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x381437){return fileFormat(_0x47484d,_0x381437);}}),new winston['transports'][(_0xed86('0x1f'))]({'level':'warn','json':![],'formatter':function(_0x26e60f){return fileFormat(_0x47484d,_0x26e60f);}})]});return _0x2c8c04;}exports['consoleLogger']=consoleLogger;exports[_0xed86('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 0e698e1..2358b21 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 _0x1a85=['isString','@@{','replace','}@@','includes','exports','maskSensitiveData','password','newPassword','apiKey','street','phone','mobile','email','clientSecret','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length'];(function(_0x574617,_0x42eccc){var _0x29de90=function(_0x367aff){while(--_0x367aff){_0x574617['push'](_0x574617['shift']());}};_0x29de90(++_0x42eccc);}(_0x1a85,0x178));var _0x51a8=function(_0x2fe0a5,_0x4f67b9){_0x2fe0a5=_0x2fe0a5-0x0;var _0x3acbcc=_0x1a85[_0x2fe0a5];return _0x3acbcc;};var _=require('lodash');var sensitiveFields=['username',_0x51a8('0x0'),_0x51a8('0x1'),_0x51a8('0x2'),'firstName','lastName',_0x51a8('0x3'),_0x51a8('0x4'),_0x51a8('0x5'),'fax',_0x51a8('0x6'),'clientId',_0x51a8('0x7'),'securityToken',_0x51a8('0x8'),_0x51a8('0x9'),'tenantId',_0x51a8('0xa'),'channelSecret','accessToken',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'localstationid',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'oldPassword'];function maskSensitiveData(_0xf4eb6e){const _0x547d40=/(?!^)[\s\S](?!$)/g;if(_[_0x51a8('0x1f')](_0xf4eb6e)){for(const _0x2b8d37 in _0xf4eb6e){if(_[_0x51a8('0x20')](_0xf4eb6e[_0x2b8d37])){for(let _0x2b0521=0x0;_0x2b0521<_0xf4eb6e[_0x2b8d37][_0x51a8('0x21')];_0x2b0521++){maskSensitiveData(_0xf4eb6e[_0x2b8d37][_0x2b0521]);}}else if(_[_0x51a8('0x1f')](_0xf4eb6e[_0x2b8d37])){maskSensitiveData(_0xf4eb6e[_0x2b8d37]);}else if(_[_0x51a8('0x22')](_0xf4eb6e[_0x2b8d37])){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](/{{{/g,_0x51a8('0x23'))[_0x51a8('0x24')](/}}}/g,_0x51a8('0x25'))[_0x51a8('0x24')](/{{/g,'@{')[_0x51a8('0x24')](/}}/g,'}@');if(_[_0x51a8('0x26')](sensitiveFields,_0x2b8d37)){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](_0x547d40,'*');}}}}}module[_0x51a8('0x27')][_0x51a8('0x28')]=maskSensitiveData; \ No newline at end of file +var _0x1a85=['isString','@@{','replace','}@@','includes','exports','maskSensitiveData','password','newPassword','apiKey','street','phone','mobile','email','clientSecret','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x1a85,0x178));var _0x51a8=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0x1a85[_0x40df5f];return _0x1573f1;};var _=require('lodash');var sensitiveFields=['username',_0x51a8('0x0'),_0x51a8('0x1'),_0x51a8('0x2'),'firstName','lastName',_0x51a8('0x3'),_0x51a8('0x4'),_0x51a8('0x5'),'fax',_0x51a8('0x6'),'clientId',_0x51a8('0x7'),'securityToken',_0x51a8('0x8'),_0x51a8('0x9'),'tenantId',_0x51a8('0xa'),'channelSecret','accessToken',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'localstationid',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'oldPassword'];function maskSensitiveData(_0xf4eb6e){const _0x547d40=/(?!^)[\s\S](?!$)/g;if(_[_0x51a8('0x1f')](_0xf4eb6e)){for(const _0x2b8d37 in _0xf4eb6e){if(_[_0x51a8('0x20')](_0xf4eb6e[_0x2b8d37])){for(let _0x2b0521=0x0;_0x2b0521<_0xf4eb6e[_0x2b8d37][_0x51a8('0x21')];_0x2b0521++){maskSensitiveData(_0xf4eb6e[_0x2b8d37][_0x2b0521]);}}else if(_[_0x51a8('0x1f')](_0xf4eb6e[_0x2b8d37])){maskSensitiveData(_0xf4eb6e[_0x2b8d37]);}else if(_[_0x51a8('0x22')](_0xf4eb6e[_0x2b8d37])){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](/{{{/g,_0x51a8('0x23'))[_0x51a8('0x24')](/}}}/g,_0x51a8('0x25'))[_0x51a8('0x24')](/{{/g,'@{')[_0x51a8('0x24')](/}}/g,'}@');if(_[_0x51a8('0x26')](sensitiveFields,_0x2b8d37)){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](_0x547d40,'*');}}}}}module[_0x51a8('0x27')][_0x51a8('0x28')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 38a3c10..db8f99c 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 _0x9354=['map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','string','replace'];(function(_0x5b70ff,_0x109dd2){var _0x51d5eb=function(_0xb4aea2){while(--_0xb4aea2){_0x5b70ff['push'](_0x5b70ff['shift']());}};_0x51d5eb(++_0x109dd2);}(_0x9354,0x96));var _0x4935=function(_0x12f9e3,_0x3fadc1){_0x12f9e3=_0x12f9e3-0x0;var _0x2de0c8=_0x9354[_0x12f9e3];return _0x2de0c8;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x42d9d9){return _0x42d9d9==='{{'?_0x4935('0x0'):'\x20}\x20}';}function safeTemplate(_0x263dd5){var _0x2a4993=_0x263dd5;if(typeof _0x263dd5===_0x4935('0x1')){_0x2a4993=_0x263dd5[_0x4935('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x263dd5)){_0x2a4993=_0x263dd5[_0x4935('0x3')](function(_0x2d509b){return safeTemplate(_0x2d509b);});}else if(_[_0x4935('0x4')](_0x263dd5)){_0x2a4993=Object[_0x4935('0x5')](_0x263dd5)[_0x4935('0x6')](function(_0x2e47bd,_0x118d36){_0x2e47bd[_0x118d36]=safeTemplate(_0x263dd5[_0x118d36]);return _0x2e47bd;},{});}return _0x2a4993;}module[_0x4935('0x7')][_0x4935('0x8')]=safeTemplate; \ No newline at end of file +var _0x8603=['{\x20{\x20','\x20}\x20}','string','replace','isArray','keys','reduce','exports'];(function(_0x218f72,_0x28cbb1){var _0x42ed15=function(_0x278cf5){while(--_0x278cf5){_0x218f72['push'](_0x218f72['shift']());}};_0x42ed15(++_0x28cbb1);}(_0x8603,0x190));var _0x3860=function(_0x4303cc,_0x4a75fc){_0x4303cc=_0x4303cc-0x0;var _0x6d9fd2=_0x8603[_0x4303cc];return _0x6d9fd2;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2f848f){return _0x2f848f==='{{'?_0x3860('0x0'):_0x3860('0x1');}function safeTemplate(_0x51bfda){var _0x4961d6=_0x51bfda;if(typeof _0x51bfda===_0x3860('0x2')){_0x4961d6=_0x51bfda[_0x3860('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3860('0x4')](_0x51bfda)){_0x4961d6=_0x51bfda['map'](function(_0x2fc97a){return safeTemplate(_0x2fc97a);});}else if(_['isPlainObject'](_0x51bfda)){_0x4961d6=Object[_0x3860('0x5')](_0x51bfda)[_0x3860('0x6')](function(_0x1eca44,_0xd3ce26){_0x1eca44[_0xd3ce26]=safeTemplate(_0x51bfda[_0xd3ce26]);return _0x1eca44;},{});}return _0x4961d6;}module[_0x3860('0x7')]['safeTemplate']=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 4d69056..b523152 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d70=['motion2','env','NODE_PATH','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','path','root','server/app.json','resolve','legacy-libs','apps','findIndex','name'];(function(_0x58a130,_0xc6faaa){var _0x13a8e5=function(_0x3ce08f){while(--_0x3ce08f){_0x58a130['push'](_0x58a130['shift']());}};_0x13a8e5(++_0xc6faaa);}(_0x4d70,0x106));var _0x04d7=function(_0x23ca2f,_0x271c2b){_0x23ca2f=_0x23ca2f-0x0;var _0x4f4b51=_0x4d70[_0x23ca2f];return _0x4f4b51;};var fs=require('fs-extra');var path=require(_0x04d7('0x0'));var config=require('../config/environment');var root=config[_0x04d7('0x1')];var APP_JSON_PATH=path['resolve'](root,_0x04d7('0x2'));var NODEPATH=path[_0x04d7('0x3')](root,_0x04d7('0x4'));function setLegacyLibsNodeEnvPath(_0x56f6b7){let _0x3e1f1b=![];if(Array['isArray'](_0x56f6b7[_0x04d7('0x5')])){var _0x202b03=_0x56f6b7['apps'][_0x04d7('0x6')](function(_0x111b07){return _0x111b07[_0x04d7('0x7')]===_0x04d7('0x8');});if(_0x202b03>-0x1){var _0x4897ca=_0x56f6b7[_0x04d7('0x5')][_0x202b03];if(typeof _0x4897ca[_0x04d7('0x9')][_0x04d7('0xa')]!=='string'){_0x4897ca[_0x04d7('0x9')][_0x04d7('0xa')]=NODEPATH;_0x3e1f1b=!![];}}return{'appConfig':_0x56f6b7,'updated':_0x3e1f1b};}}function updateAppConfig(_0x387707){return fs['pathExists'](APP_JSON_PATH)[_0x04d7('0xb')](function(_0x246ab2){if(_0x246ab2){return fs[_0x04d7('0xc')](APP_JSON_PATH)['then'](function(_0x17c59d){var _0x503b29=setLegacyLibsNodeEnvPath(_0x17c59d);if(_0x503b29[_0x04d7('0xd')]){_0x387707[_0x04d7('0xe')](_0x04d7('0xf'));return fs[_0x04d7('0x10')](APP_JSON_PATH,_0x17c59d,{'spaces':0x2});}else{return Promise[_0x04d7('0x3')]();}});}else{return Promise[_0x04d7('0x3')]();}});}module[_0x04d7('0x11')]=updateAppConfig; \ No newline at end of file +var _0x05a5=['updated','info','Updating\x20app.json','exports','fs-extra','path','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','motion2','env','string','NODE_PATH','pathExists','readJSON','then'];(function(_0x2e026b,_0x20363d){var _0x4007bb=function(_0x3fc1ab){while(--_0x3fc1ab){_0x2e026b['push'](_0x2e026b['shift']());}};_0x4007bb(++_0x20363d);}(_0x05a5,0x1e8));var _0x505a=function(_0x569328,_0x38c09b){_0x569328=_0x569328-0x0;var _0x534919=_0x05a5[_0x569328];return _0x534919;};var fs=require(_0x505a('0x0'));var path=require(_0x505a('0x1'));var config=require(_0x505a('0x2'));var root=config[_0x505a('0x3')];var APP_JSON_PATH=path[_0x505a('0x4')](root,_0x505a('0x5'));var NODEPATH=path[_0x505a('0x4')](root,_0x505a('0x6'));function setLegacyLibsNodeEnvPath(_0x2ddab7){let _0x59fbf3=![];if(Array[_0x505a('0x7')](_0x2ddab7[_0x505a('0x8')])){var _0x10dacf=_0x2ddab7[_0x505a('0x8')][_0x505a('0x9')](function(_0x294822){return _0x294822[_0x505a('0xa')]===_0x505a('0xb');});if(_0x10dacf>-0x1){var _0x26bdfc=_0x2ddab7['apps'][_0x10dacf];if(typeof _0x26bdfc[_0x505a('0xc')]['NODE_PATH']!==_0x505a('0xd')){_0x26bdfc[_0x505a('0xc')][_0x505a('0xe')]=NODEPATH;_0x59fbf3=!![];}}return{'appConfig':_0x2ddab7,'updated':_0x59fbf3};}}function updateAppConfig(_0x6c9f6a){return fs[_0x505a('0xf')](APP_JSON_PATH)['then'](function(_0x132361){if(_0x132361){return fs[_0x505a('0x10')](APP_JSON_PATH)[_0x505a('0x11')](function(_0x821180){var _0x2f03c3=setLegacyLibsNodeEnvPath(_0x821180);if(_0x2f03c3[_0x505a('0x12')]){_0x6c9f6a[_0x505a('0x13')](_0x505a('0x14'));return fs['writeJSON'](APP_JSON_PATH,_0x821180,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0x505a('0x4')]();}});}module[_0x505a('0x15')]=updateAppConfig; \ No newline at end of file